From: Andrea Bianco Date: Sat, 27 Mar 2021 11:16:16 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.23 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=43920324c916a717332193ccbb9997bed9db985b;p=motion2.git Built motion from commit (unavailable).|2.5.23 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index bb49bd6..79c2b27 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-03-27T10:07:49.798Z", + "time": "2021-03-27T11:06:05.220Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 72ad593..e936f97 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-03-27T10:07:49.798Z", + "time": "2021-03-27T11:06:05.220Z", "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 ba48f09..fb1e95e 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 _0x478c=['STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','TEXT','sequelize','getDataValue'];(function(_0x584756,_0x4c6a30){var _0x11447f=function(_0xa9b3b8){while(--_0xa9b3b8){_0x584756['push'](_0x584756['shift']());}};_0x11447f(++_0x4c6a30);}(_0x478c,0x85));var _0xc478=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x478c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc478('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x381c25){return this[_0xc478('0x1')]('action');}},'action':{'type':Sequelize[_0xc478('0x2')],'allowNull':![],'validate':{'isIn':{'args':[[_0xc478('0x3'),_0xc478('0x4'),_0xc478('0x5'),_0xc478('0x6'),_0xc478('0x7'),_0xc478('0x8'),_0xc478('0x9'),_0xc478('0xa')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xc478('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xc478('0xc')},'data2':{'type':Sequelize[_0xc478('0x2')](0x1000),'comment':_0xc478('0xd')},'data3':{'type':Sequelize[_0xc478('0x2')](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize[_0xc478('0x2')](0x1000)},'data6':{'type':Sequelize[_0xc478('0x2')]},'data7':{'type':Sequelize[_0xc478('0xe')]}}; \ No newline at end of file +var _0x85a3=['getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','VIRTUAL'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x85a3,0x19f));var _0x385a=function(_0x249969,_0x4bcf6d){_0x249969=_0x249969-0x0;var _0x4b4a61=_0x85a3[_0x249969];return _0x4b4a61;};'use strict';var Sequelize=require(_0x385a('0x0'));module[_0x385a('0x1')]={'name':{'type':Sequelize[_0x385a('0x2')],'get':function(_0xbee8db){return this[_0x385a('0x3')](_0x385a('0x4'));}},'action':{'type':Sequelize[_0x385a('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x385a('0x6'),_0x385a('0x7'),_0x385a('0x8'),_0x385a('0x9'),_0x385a('0xa'),_0x385a('0xb'),_0x385a('0xc'),_0x385a('0xd')]],'msg':_0x385a('0xe')}},'comment':_0x385a('0xe')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x385a('0xf')},'data2':{'type':Sequelize[_0x385a('0x5')](0x1000),'comment':_0x385a('0x10')},'data3':{'type':Sequelize[_0x385a('0x5')](0x1000),'comment':_0x385a('0x11')},'data4':{'type':Sequelize[_0x385a('0x5')](0x1000)},'data5':{'type':Sequelize[_0x385a('0x5')](0x1000)},'data6':{'type':Sequelize[_0x385a('0x5')]},'data7':{'type':Sequelize[_0x385a('0x12')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 384d1d1..74c05c8 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 _0x948d=['name','send','Action','find','body','catch','params','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','end','error'];(function(_0x3f0ed9,_0x5e7017){var _0x34cb4f=function(_0x317b60){while(--_0x317b60){_0x3f0ed9['push'](_0x3f0ed9['shift']());}};_0x34cb4f(++_0x5e7017);}(_0x948d,0x1c9));var _0xd948=function(_0x59b101,_0x55ec68){_0x59b101=_0x59b101-0x0;var _0x18168e=_0x948d[_0x59b101];return _0x18168e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd948('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd948('0x1'));var jsonpatch=require(_0xd948('0x2'));var rp=require(_0xd948('0x3'));var moment=require('moment');var BPromise=require(_0xd948('0x4'));var Mustache=require('mustache');var util=require(_0xd948('0x5'));var path=require(_0xd948('0x6'));var sox=require(_0xd948('0x7'));var csv=require(_0xd948('0x8'));var ejs=require(_0xd948('0x9'));var fs=require('fs');var fs_extra=require(_0xd948('0xa'));var _=require(_0xd948('0xb'));var squel=require(_0xd948('0xc'));var crypto=require(_0xd948('0xd'));var jsforce=require(_0xd948('0xe'));var deskjs=require(_0xd948('0xf'));var toCsv=require(_0xd948('0x8'));var querystring=require(_0xd948('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd948('0x11'));var as=require(_0xd948('0x12'));var hardwareService=require(_0xd948('0x13'));var logger=require(_0xd948('0x14'))(_0xd948('0x15'));var utils=require('../../config/utils');var config=require(_0xd948('0x16'));var licenseUtil=require(_0xd948('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x501504,_0xb228e9){_0xb228e9=_0xb228e9||0xcc;return function(_0x606c89){if(_0x606c89){return _0x501504[_0xd948('0x18')](_0xb228e9);}return _0x501504[_0xd948('0x19')](_0xb228e9)['end']();};}function respondWithResult(_0x2616f9,_0x5a7d32){_0x5a7d32=_0x5a7d32||0xc8;return function(_0x8727a0){if(_0x8727a0){return _0x2616f9[_0xd948('0x19')](_0x5a7d32)[_0xd948('0x1a')](_0x8727a0);}};}function respondWithFilteredResult(_0x54adc5,_0x262286){return function(_0x58e58a){if(_0x58e58a){var _0x212cc0=_0x58e58a[_0xd948('0x1b')],_0x32c80f=_0x262286[_0xd948('0x1c')],_0x5cfa2b=_0x262286[_0xd948('0x1c')]+_0x262286[_0xd948('0x1d')],_0x4c22a8;if(_0x5cfa2b>=_0x212cc0){_0x5cfa2b=_0x212cc0;_0x4c22a8=0xc8;}else{_0x4c22a8=0xce;}_0x54adc5['status'](_0x4c22a8);return _0x54adc5[_0xd948('0x1e')](_0xd948('0x1f'),_0x32c80f+'-'+_0x5cfa2b+'/'+_0x212cc0)['json'](_0x58e58a);}return null;};}function patchUpdates(_0x2545e8){return function(_0x4065bb){try{jsonpatch[_0xd948('0x20')](_0x4065bb,_0x2545e8,!![]);}catch(_0x19b1a4){return BPromise['reject'](_0x19b1a4);}return _0x4065bb['save']();};}function saveUpdates(_0x1ac8cd,_0x94f76d){return function(_0x5e38bd){if(_0x5e38bd){return _0x5e38bd[_0xd948('0x21')](_0x1ac8cd)[_0xd948('0x22')](function(_0x55a9ae){return _0x55a9ae;});}return null;};}function removeEntity(_0x1151af,_0x4b4ffd){return function(_0x3f6ce0){if(_0x3f6ce0){return _0x3f6ce0[_0xd948('0x23')]()['then'](function(){_0x1151af[_0xd948('0x19')](0xcc)[_0xd948('0x24')]();});}};}function handleEntityNotFound(_0x291110,_0x5adbd3){return function(_0x1709d2){if(!_0x1709d2){_0x291110[_0xd948('0x18')](0x194);}return _0x1709d2;};}function handleError(_0x24b3f4,_0x5b1dd1){_0x5b1dd1=_0x5b1dd1||0x1f4;return function(_0x1411db){logger[_0xd948('0x25')](_0x1411db['stack']);if(_0x1411db[_0xd948('0x26')]){delete _0x1411db[_0xd948('0x26')];}_0x24b3f4['status'](_0x5b1dd1)[_0xd948('0x27')](_0x1411db);};}exports[_0xd948('0x21')]=function(_0x19ee76,_0x5c29fe){if(_0x19ee76['body']['id']){delete _0x19ee76['body']['id'];}return db[_0xd948('0x28')][_0xd948('0x29')]({'where':{'id':_0x19ee76['params']['id']}})[_0xd948('0x22')](handleEntityNotFound(_0x5c29fe,null))[_0xd948('0x22')](saveUpdates(_0x19ee76[_0xd948('0x2a')],null))[_0xd948('0x22')](respondWithResult(_0x5c29fe,null))[_0xd948('0x2b')](handleError(_0x5c29fe,null));};exports[_0xd948('0x23')]=function(_0x262cfb,_0x2926f2){return db[_0xd948('0x28')][_0xd948('0x29')]({'where':{'id':_0x262cfb[_0xd948('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2926f2,null))[_0xd948('0x22')](removeEntity(_0x2926f2,null))['catch'](handleError(_0x2926f2,null));}; \ No newline at end of file +var _0xc42a=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','end','error','stack','name','send','update','Action','params','body','catch','find','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api'];(function(_0x104af4,_0x3cd4ea){var _0x162361=function(_0x198ec6){while(--_0x198ec6){_0x104af4['push'](_0x104af4['shift']());}};_0x162361(++_0x3cd4ea);}(_0xc42a,0x17a));var _0xac42=function(_0x3611a7,_0x59563c){_0x3611a7=_0x3611a7-0x0;var _0x569692=_0xc42a[_0x3611a7];return _0x569692;};'use strict';var pdf=require(_0xac42('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xac42('0x1'));var jsonpatch=require(_0xac42('0x2'));var rp=require(_0xac42('0x3'));var moment=require(_0xac42('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xac42('0x5'));var util=require(_0xac42('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xac42('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xac42('0x8'));var squel=require(_0xac42('0x9'));var crypto=require(_0xac42('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xac42('0xb'));var toCsv=require(_0xac42('0x7'));var querystring=require(_0xac42('0xc'));var Papa=require(_0xac42('0xd'));var Redis=require('ioredis');var authService=require(_0xac42('0xe'));var qs=require(_0xac42('0xf'));var as=require(_0xac42('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xac42('0x11'));var utils=require(_0xac42('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xac42('0x13'));var db=require(_0xac42('0x14'))['db'];function respondWithStatusCode(_0x2297ac,_0x1352c2){_0x1352c2=_0x1352c2||0xcc;return function(_0x1355ae){if(_0x1355ae){return _0x2297ac[_0xac42('0x15')](_0x1352c2);}return _0x2297ac[_0xac42('0x16')](_0x1352c2)['end']();};}function respondWithResult(_0x3b1a7b,_0x57f8a1){_0x57f8a1=_0x57f8a1||0xc8;return function(_0x994e3c){if(_0x994e3c){return _0x3b1a7b['status'](_0x57f8a1)[_0xac42('0x17')](_0x994e3c);}};}function respondWithFilteredResult(_0x11b2d4,_0x5c5aed){return function(_0x1e7a55){if(_0x1e7a55){var _0x2ee92e=_0x1e7a55[_0xac42('0x18')],_0x1634dd=_0x5c5aed[_0xac42('0x19')],_0x4bd779=_0x5c5aed[_0xac42('0x19')]+_0x5c5aed[_0xac42('0x1a')],_0x12ed3f;if(_0x4bd779>=_0x2ee92e){_0x4bd779=_0x2ee92e;_0x12ed3f=0xc8;}else{_0x12ed3f=0xce;}_0x11b2d4['status'](_0x12ed3f);return _0x11b2d4[_0xac42('0x1b')](_0xac42('0x1c'),_0x1634dd+'-'+_0x4bd779+'/'+_0x2ee92e)[_0xac42('0x17')](_0x1e7a55);}return null;};}function patchUpdates(_0x366ccf){return function(_0x504799){try{jsonpatch[_0xac42('0x1d')](_0x504799,_0x366ccf,!![]);}catch(_0x574d3){return BPromise[_0xac42('0x1e')](_0x574d3);}return _0x504799['save']();};}function saveUpdates(_0x1bd8d4,_0x59d8c1){return function(_0x52e362){if(_0x52e362){return _0x52e362['update'](_0x1bd8d4)[_0xac42('0x1f')](function(_0x4dc755){return _0x4dc755;});}return null;};}function removeEntity(_0x51d85b,_0x3658fd){return function(_0x5432f6){if(_0x5432f6){return _0x5432f6[_0xac42('0x20')]()[_0xac42('0x1f')](function(){_0x51d85b['status'](0xcc)[_0xac42('0x21')]();});}};}function handleEntityNotFound(_0x54906c,_0xd73bc4){return function(_0x87afca){if(!_0x87afca){_0x54906c[_0xac42('0x15')](0x194);}return _0x87afca;};}function handleError(_0x2e7337,_0x976eda){_0x976eda=_0x976eda||0x1f4;return function(_0x1ab769){logger[_0xac42('0x22')](_0x1ab769[_0xac42('0x23')]);if(_0x1ab769[_0xac42('0x24')]){delete _0x1ab769[_0xac42('0x24')];}_0x2e7337[_0xac42('0x16')](_0x976eda)[_0xac42('0x25')](_0x1ab769);};}exports[_0xac42('0x26')]=function(_0xb47793,_0x38bf00){if(_0xb47793['body']['id']){delete _0xb47793['body']['id'];}return db[_0xac42('0x27')]['find']({'where':{'id':_0xb47793[_0xac42('0x28')]['id']}})[_0xac42('0x1f')](handleEntityNotFound(_0x38bf00,null))[_0xac42('0x1f')](saveUpdates(_0xb47793[_0xac42('0x29')],null))[_0xac42('0x1f')](respondWithResult(_0x38bf00,null))[_0xac42('0x2a')](handleError(_0x38bf00,null));};exports[_0xac42('0x20')]=function(_0x5cedf3,_0x2165ad){return db[_0xac42('0x27')][_0xac42('0x2b')]({'where':{'id':_0x5cedf3[_0xac42('0x28')]['id']}})[_0xac42('0x1f')](handleEntityNotFound(_0x2165ad,null))['then'](removeEntity(_0x2165ad,null))[_0xac42('0x2a')](handleError(_0x2165ad,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 37bf20e..89e3b37 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 _0x437a=['tools_actions','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x437a,0x173));var _0xa437=function(_0x3f38b0,_0x38ba25){_0x3f38b0=_0x3f38b0-0x0;var _0x475fd9=_0x437a[_0x3f38b0];return _0x475fd9;};'use strict';var _=require(_0xa437('0x0'));var util=require('util');var logger=require(_0xa437('0x1'))(_0xa437('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa437('0x3'));var fs=require('fs');var path=require(_0xa437('0x4'));var rimraf=require(_0xa437('0x5'));var config=require(_0xa437('0x6'));var attributes=require('./action.attributes');module[_0xa437('0x7')]=function(_0x570db4,_0x54da73){return _0x570db4[_0xa437('0x8')]('Action',attributes,{'tableName':_0xa437('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x655c=['bluebird','path','rimraf','../../config/environment','./action.attributes','Action','tools_actions','lodash','util','../../config/logger','api','moment'];(function(_0x3d09ec,_0xf30d0f){var _0x4dcbd8=function(_0x944b6d){while(--_0x944b6d){_0x3d09ec['push'](_0x3d09ec['shift']());}};_0x4dcbd8(++_0xf30d0f);}(_0x655c,0x163));var _0xc655=function(_0x414ef0,_0x507dd8){_0x414ef0=_0x414ef0-0x0;var _0xaaadbd=_0x655c[_0x414ef0];return _0xaaadbd;};'use strict';var _=require(_0xc655('0x0'));var util=require(_0xc655('0x1'));var logger=require(_0xc655('0x2'))(_0xc655('0x3'));var moment=require(_0xc655('0x4'));var BPromise=require(_0xc655('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc655('0x6'));var rimraf=require(_0xc655('0x7'));var config=require(_0xc655('0x8'));var attributes=require(_0xc655('0x9'));module['exports']=function(_0x5ded79,_0x58b276){return _0x5ded79['define'](_0xc655('0xa'),attributes,{'tableName':_0xc655('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index c409739..c53d3f0 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x3e3e1f,_0x576859){var _0x2d357c=function(_0x2b4479){while(--_0x2b4479){_0x3e3e1f['push'](_0x3e3e1f['shift']());}};_0x2d357c(++_0x576859);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0x70e0=['code','Action,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xe6d141,_0x192c19){var _0x5e470b=function(_0x49e816){while(--_0x49e816){_0xe6d141['push'](_0xe6d141['shift']());}};_0x5e470b(++_0x192c19);}(_0x70e0,0x17b));var _0x070e=function(_0x455e72,_0xc76ee7){_0x455e72=_0x455e72-0x0;var _0x28c1aa=_0x70e0[_0x455e72];return _0x28c1aa;};'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')]('Action,\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')]('Action,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('Action,\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/action/index.js b/server/api/action/index.js index b5af151..f13ad77 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 _0xe3c8=['delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./action.controller','put','/:id','isAuthenticated'];(function(_0x4d9bb2,_0x3db50d){var _0x3179fe=function(_0x5272f3){while(--_0x5272f3){_0x4d9bb2['push'](_0x4d9bb2['shift']());}};_0x3179fe(++_0x3db50d);}(_0xe3c8,0x145));var _0x8e3c=function(_0x4a5426,_0x31d016){_0x4a5426=_0x4a5426-0x0;var _0x542078=_0xe3c8[_0x4a5426];return _0x542078;};'use strict';var multer=require(_0x8e3c('0x0'));var util=require(_0x8e3c('0x1'));var path=require(_0x8e3c('0x2'));var timeout=require(_0x8e3c('0x3'));var express=require(_0x8e3c('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8e3c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8e3c('0x6'));var controller=require(_0x8e3c('0x7'));router[_0x8e3c('0x8')](_0x8e3c('0x9'),auth[_0x8e3c('0xa')](),controller['update']);router[_0x8e3c('0xb')](_0x8e3c('0x9'),auth[_0x8e3c('0xa')](),controller[_0x8e3c('0xc')]);module[_0x8e3c('0xd')]=router; \ No newline at end of file +var _0x355e=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete'];(function(_0xf707f5,_0x566532){var _0x246899=function(_0x18f2aa){while(--_0x18f2aa){_0xf707f5['push'](_0xf707f5['shift']());}};_0x246899(++_0x566532);}(_0x355e,0xa7));var _0xe355=function(_0x1daafa,_0x5562d5){_0x1daafa=_0x1daafa-0x0;var _0x421f30=_0x355e[_0x1daafa];return _0x421f30;};'use strict';var multer=require(_0xe355('0x0'));var util=require(_0xe355('0x1'));var path=require('path');var timeout=require(_0xe355('0x2'));var express=require(_0xe355('0x3'));var router=express[_0xe355('0x4')]();var fs_extra=require(_0xe355('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe355('0x6'));var controller=require(_0xe355('0x7'));router[_0xe355('0x8')](_0xe355('0x9'),auth[_0xe355('0xa')](),controller[_0xe355('0xb')]);router[_0xe355('0xc')](_0xe355('0x9'),auth['isAuthenticated'](),controller[_0xe355('0xd')]);module[_0xe355('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 927d3df..48670c9 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 _0x6218=['STRING','TEXT','sequelize','exports'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x6218,0x1be));var _0x8621=function(_0x5c13d5,_0x38a129){_0x5c13d5=_0x5c13d5-0x0;var _0x361eb9=_0x6218[_0x5c13d5];return _0x361eb9;};'use strict';var Sequelize=require(_0x8621('0x0'));module[_0x8621('0x1')]={'name':{'type':Sequelize[_0x8621('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8621('0x2')]},'parent':{'type':Sequelize[_0x8621('0x2')]},'table':{'type':Sequelize[_0x8621('0x2')]},'conditions':{'type':Sequelize[_0x8621('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x75a3=['STRING','TEXT','exports'];(function(_0x7b360c,_0x5cec49){var _0x2dad8e=function(_0x560e7f){while(--_0x560e7f){_0x7b360c['push'](_0x7b360c['shift']());}};_0x2dad8e(++_0x5cec49);}(_0x75a3,0x158));var _0x375a=function(_0x1b4ced,_0x28dfd1){_0x1b4ced=_0x1b4ced-0x0;var _0x34c145=_0x75a3[_0x1b4ced];return _0x34c145;};'use strict';var Sequelize=require('sequelize');module[_0x375a('0x0')]={'name':{'type':Sequelize[_0x375a('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x375a('0x1')]},'parent':{'type':Sequelize[_0x375a('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x375a('0x2')]},'joins':{'type':Sequelize[_0x375a('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index d8b39ca..baa6f3d 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 _0x4054=['bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','UserProfileResource','end','sendStatus','error','stack','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','field','condition','getFields','select','from','table','MetricId','function','replace','format','groupBy','group','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','debug','Limited\x20Query:','toString','QueryTypes','SELECT','IS\x20NOT\x20NULL','value','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','metric','output','fullPath','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','sequelize','runReport','left_join','COUNT(%s)','ValidationErrorItem','clone','html-pdf','eml-format','rimraf','zip-dir','moment'];(function(_0x3a4c79,_0x81f067){var _0x50bbb1=function(_0x3049bf){while(--_0x3049bf){_0x3a4c79['push'](_0x3a4c79['shift']());}};_0x50bbb1(++_0x81f067);}(_0x4054,0x145));var _0x4405=function(_0x3bd2e0,_0x3dc38b){_0x3bd2e0=_0x3bd2e0-0x0;var _0x656dbe=_0x4054[_0x3bd2e0];return _0x656dbe;};'use strict';var pdf=require(_0x4405('0x0'));var emlformat=require(_0x4405('0x1'));var rimraf=require(_0x4405('0x2'));var zipdir=require(_0x4405('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4405('0x4'));var BPromise=require(_0x4405('0x5'));var Mustache=require(_0x4405('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4405('0x7'));var csv=require(_0x4405('0x8'));var ejs=require(_0x4405('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4405('0xa'));var squel=require(_0x4405('0xb'));var crypto=require(_0x4405('0xc'));var jsforce=require(_0x4405('0xd'));var deskjs=require(_0x4405('0xe'));var toCsv=require(_0x4405('0x8'));var querystring=require(_0x4405('0xf'));var Papa=require(_0x4405('0x10'));var Redis=require(_0x4405('0x11'));var authService=require(_0x4405('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4405('0x13'));var logger=require(_0x4405('0x14'))(_0x4405('0x15'));var utils=require(_0x4405('0x16'));var config=require(_0x4405('0x17'));var licenseUtil=require(_0x4405('0x18'));var db=require(_0x4405('0x19'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0x31a214,_0x2d0307){_0x2d0307=_0x2d0307||0xcc;return function(_0x49fdbb){if(_0x49fdbb){return _0x31a214['sendStatus'](_0x2d0307);}return _0x31a214['status'](_0x2d0307)['end']();};}function respondWithResult(_0x253711,_0x48fd5a){_0x48fd5a=_0x48fd5a||0xc8;return function(_0x577ec6){if(_0x577ec6){return _0x253711[_0x4405('0x1a')](_0x48fd5a)['json'](_0x577ec6);}};}function respondWithFilteredResult(_0xb9cc90,_0x5057de){return function(_0x1b19d0){if(_0x1b19d0){var _0x3cae42=_0x1b19d0[_0x4405('0x1b')],_0x513a64=_0x5057de[_0x4405('0x1c')],_0x140ef7=_0x5057de[_0x4405('0x1c')]+_0x5057de[_0x4405('0x1d')],_0x4a87e4;if(_0x140ef7>=_0x3cae42){_0x140ef7=_0x3cae42;_0x4a87e4=0xc8;}else{_0x4a87e4=0xce;}_0xb9cc90['status'](_0x4a87e4);return _0xb9cc90[_0x4405('0x1e')](_0x4405('0x1f'),_0x513a64+'-'+_0x140ef7+'/'+_0x3cae42)[_0x4405('0x20')](_0x1b19d0);}return null;};}function patchUpdates(_0x1e3980){return function(_0x25b7a8){try{jsonpatch[_0x4405('0x21')](_0x25b7a8,_0x1e3980,!![]);}catch(_0x282ca0){return BPromise[_0x4405('0x22')](_0x282ca0);}return _0x25b7a8['save']();};}function saveUpdates(_0x3c5719,_0x5a68c0){return function(_0x17a885){if(_0x17a885){return _0x17a885[_0x4405('0x23')](_0x3c5719)[_0x4405('0x24')](function(_0x3ed19b){return _0x3ed19b;});}return null;};}function removeEntity(_0x4f1163,_0x12b6b9){return function(_0x3a3d53){if(_0x3a3d53){return _0x3a3d53[_0x4405('0x25')]()['then'](function(){var _0x13235e=_0x3a3d53['get']({'plain':!![]});var _0x1cf433='CustomReports';return db[_0x4405('0x26')][_0x4405('0x25')]({'where':{'type':_0x1cf433,'resourceId':_0x13235e['id']}})[_0x4405('0x24')](function(){return _0x3a3d53;});})[_0x4405('0x24')](function(){_0x4f1163['status'](0xcc)[_0x4405('0x27')]();});}};}function handleEntityNotFound(_0x5538f8,_0x58901a){return function(_0x248c01){if(!_0x248c01){_0x5538f8[_0x4405('0x28')](0x194);}return _0x248c01;};}function handleError(_0x3f82b5,_0x2a4b86){_0x2a4b86=_0x2a4b86||0x1f4;return function(_0x57f660){logger[_0x4405('0x29')](_0x57f660[_0x4405('0x2a')]);if(_0x57f660['name']){delete _0x57f660[_0x4405('0x2b')];}_0x3f82b5[_0x4405('0x1a')](_0x2a4b86)['send'](_0x57f660);};}exports[_0x4405('0x2c')]=function(_0x224fb6,_0x106312){var _0x3e6d68={},_0x294dfd={},_0x441c03={'count':0x0,'rows':[]};var _0x2f70ba=_[_0x4405('0x2d')](db[_0x4405('0x2e')][_0x4405('0x2f')],function(_0x1a062e){return{'name':_0x1a062e[_0x4405('0x30')],'type':_0x1a062e['type'][_0x4405('0x31')]};});_0x294dfd[_0x4405('0x32')]=_[_0x4405('0x2d')](_0x2f70ba,'name');_0x294dfd[_0x4405('0x33')]=_['keys'](_0x224fb6[_0x4405('0x33')]);_0x294dfd[_0x4405('0x34')]=_['intersection'](_0x294dfd[_0x4405('0x32')],_0x294dfd[_0x4405('0x33')]);_0x3e6d68['attributes']=_[_0x4405('0x35')](_0x294dfd[_0x4405('0x32')],qs[_0x4405('0x36')](_0x224fb6['query'][_0x4405('0x36')]));_0x3e6d68[_0x4405('0x37')]=_0x3e6d68[_0x4405('0x37')][_0x4405('0x38')]?_0x3e6d68[_0x4405('0x37')]:_0x294dfd[_0x4405('0x32')];if(!_0x224fb6[_0x4405('0x33')][_0x4405('0x39')]('nolimit')){_0x3e6d68[_0x4405('0x1d')]=qs[_0x4405('0x1d')](_0x224fb6[_0x4405('0x33')][_0x4405('0x1d')]);_0x3e6d68[_0x4405('0x1c')]=qs['offset'](_0x224fb6[_0x4405('0x33')][_0x4405('0x1c')]);}_0x3e6d68[_0x4405('0x3a')]=qs['sort'](_0x224fb6[_0x4405('0x33')][_0x4405('0x3b')]);_0x3e6d68[_0x4405('0x3c')]=qs[_0x4405('0x34')](_[_0x4405('0x3d')](_0x224fb6[_0x4405('0x33')],_0x294dfd['filters']),_0x2f70ba);if(_0x224fb6[_0x4405('0x33')][_0x4405('0x3e')]){_0x3e6d68['where']=_[_0x4405('0x3f')](_0x3e6d68[_0x4405('0x3c')],{'$or':_['map'](_0x2f70ba,function(_0x4055de){if(_0x4055de[_0x4405('0x40')]!=='VIRTUAL'){var _0x2872d8={};_0x2872d8[_0x4055de[_0x4405('0x2b')]]={'$like':'%'+_0x224fb6[_0x4405('0x33')][_0x4405('0x3e')]+'%'};return _0x2872d8;}})});}_0x3e6d68=_[_0x4405('0x3f')]({},_0x3e6d68,_0x224fb6[_0x4405('0x41')]);var _0x5ea9c7={'where':_0x3e6d68[_0x4405('0x3c')]};return db[_0x4405('0x2e')][_0x4405('0x1b')](_0x5ea9c7)[_0x4405('0x24')](function(_0x3ef314){_0x441c03[_0x4405('0x1b')]=_0x3ef314;if(_0x224fb6[_0x4405('0x33')]['includeAll']){_0x3e6d68[_0x4405('0x42')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x4405('0x43')](_0x3e6d68);})['then'](function(_0x497a45){_0x441c03[_0x4405('0x44')]=_0x497a45;return _0x441c03;})[_0x4405('0x24')](respondWithFilteredResult(_0x106312,_0x3e6d68))[_0x4405('0x45')](handleError(_0x106312,null));};exports[_0x4405('0x46')]=function(_0x201175,_0x52ebc8){var _0x5468f4={'raw':![],'where':{'id':_0x201175[_0x4405('0x47')]['id']}},_0x75a52={};_0x75a52['model']=_['keys'](db['AnalyticCustomReport'][_0x4405('0x2f')]);_0x75a52['query']=_[_0x4405('0x48')](_0x201175[_0x4405('0x33')]);_0x75a52[_0x4405('0x34')]=_[_0x4405('0x35')](_0x75a52['model'],_0x75a52['query']);_0x5468f4[_0x4405('0x37')]=_['intersection'](_0x75a52[_0x4405('0x32')],qs[_0x4405('0x36')](_0x201175[_0x4405('0x33')]['fields']));_0x5468f4[_0x4405('0x37')]=_0x5468f4['attributes'][_0x4405('0x38')]?_0x5468f4[_0x4405('0x37')]:_0x75a52['model'];if(_0x201175['query'][_0x4405('0x49')]){_0x5468f4[_0x4405('0x42')]=[{'all':!![]}];}_0x5468f4=_[_0x4405('0x3f')]({},_0x5468f4,_0x201175[_0x4405('0x41')]);return db[_0x4405('0x2e')][_0x4405('0x4a')](_0x5468f4)[_0x4405('0x24')](handleEntityNotFound(_0x52ebc8,null))[_0x4405('0x24')](respondWithResult(_0x52ebc8,null))['catch'](handleError(_0x52ebc8,null));};exports[_0x4405('0x4b')]=function(_0x3c0580,_0x3730bb){return db[_0x4405('0x2e')]['create'](_0x3c0580[_0x4405('0x4c')],{})[_0x4405('0x24')](function(_0x226b99){var _0x10ac15=_0x3c0580[_0x4405('0x4d')][_0x4405('0x4e')]({'plain':!![]});if(!_0x10ac15)throw new Error(_0x4405('0x4f'));if(_0x10ac15[_0x4405('0x50')]===_0x4405('0x4d')){var _0x1b8535=_0x226b99[_0x4405('0x4e')]({'plain':!![]});var _0xe58312=_0x4405('0x51');return db[_0x4405('0x52')]['find']({'where':{'name':_0xe58312,'userProfileId':_0x10ac15[_0x4405('0x53')]},'raw':!![]})[_0x4405('0x24')](function(_0x41566f){if(_0x41566f&&_0x41566f['autoAssociation']===0x0){return db['UserProfileResource'][_0x4405('0x4b')]({'name':_0x1b8535[_0x4405('0x2b')],'resourceId':_0x1b8535['id'],'type':'CustomReports','sectionId':_0x41566f['id']},{})['then'](function(){return _0x226b99;});}else{return _0x226b99;}})[_0x4405('0x45')](function(_0x26a04b){logger[_0x4405('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x26a04b);throw _0x26a04b;});}return _0x226b99;})[_0x4405('0x24')](respondWithResult(_0x3730bb,0xc9))['catch'](handleError(_0x3730bb,null));};exports['update']=function(_0x42adcf,_0x3cce1b){if(_0x42adcf[_0x4405('0x4c')]['id']){delete _0x42adcf[_0x4405('0x4c')]['id'];}return db[_0x4405('0x2e')][_0x4405('0x4a')]({'where':{'id':_0x42adcf[_0x4405('0x47')]['id']}})[_0x4405('0x24')](handleEntityNotFound(_0x3cce1b,null))['then'](saveUpdates(_0x42adcf['body'],null))['then'](respondWithResult(_0x3cce1b,null))[_0x4405('0x45')](handleError(_0x3cce1b,null));};exports[_0x4405('0x25')]=function(_0x3393a9,_0x130882){return db[_0x4405('0x2e')]['find']({'where':{'id':_0x3393a9['params']['id']}})[_0x4405('0x24')](handleEntityNotFound(_0x130882,null))[_0x4405('0x24')](removeEntity(_0x130882,null))[_0x4405('0x45')](handleError(_0x130882,null));};exports['preview']=function(_0x468847,_0x3bd209){var _0x1f11e6=0xa;var _0x4ed59b=[_0x4405('0x54'),'left_join',_0x4405('0x55'),_0x4405('0x56')];var _0xf83981={'SUM':_0x4405('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4405('0x58'),'MAX':_0x4405('0x59'),'MIN':_0x4405('0x5a'),'AVG':_0x4405('0x5b'),'GROUP_CONCAT':_0x4405('0x5c'),'GROUP_CONCAT ASC':_0x4405('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4b566a={'SEC_TO_TIME':_0x4405('0x5e'),'DATE':_0x4405('0x5f'),'HOUR':_0x4405('0x60'),'ROUND':_0x4405('0x61'),'UNIX_TIMESTAMP':_0x4405('0x62')};var _0x58cacf=function(_0x56c7f4){return!_[_0x4405('0x63')]([_0x4405('0x64'),'IS\x20NOT\x20NULL',_0x4405('0x65'),_0x4405('0x66')],_0x56c7f4);};var _0x1f5842=function(_0x4336cd){if(!_0x4336cd||!_0x4336cd[_0x4405('0x67')][_0x4405('0x38')]){return'';}for(var _0x41e23b='(',_0x5d4df1=0x0;_0x5d4df1<_0x4336cd[_0x4405('0x67')]['length'];_0x5d4df1+=0x1){_0x5d4df1>0x0&&(_0x41e23b+='\x20'+_0x4336cd[_0x4405('0x68')]+'\x20');_0x41e23b+=_0x4336cd['rules'][_0x5d4df1]['group']?_0x1f5842(_0x4336cd[_0x4405('0x67')][_0x5d4df1]['group']):_0x4336cd[_0x4405('0x67')][_0x5d4df1][_0x4405('0x69')]+'\x20'+_0x4336cd[_0x4405('0x67')][_0x5d4df1]['condition']+(_0x58cacf(_0x4336cd[_0x4405('0x67')][_0x5d4df1][_0x4405('0x6a')])?'\x20'+_0x4336cd[_0x4405('0x67')][_0x5d4df1]['value']:'');}return _0x41e23b+')';};var _0x13736a={'where':{'id':_0x468847[_0x4405('0x47')]['id']}},_0x23868c,_0x4564a2,_0x4c3108,_0x46a52d,_0x5e821a;_0x13736a=_[_0x4405('0x3f')]({},_0x13736a,_0x468847[_0x4405('0x41')]);return db[_0x4405('0x2e')]['find'](_0x13736a)[_0x4405('0x24')](function(_0xb7bc48){if(_0xb7bc48){_0x23868c=_0xb7bc48;return _0xb7bc48[_0x4405('0x6b')]();}return null;})[_0x4405('0x24')](function(_0x36b412){if(_0x36b412){if(!_0x36b412['length']){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4564a2=_0x36b412;return db['AnalyticMetric'][_0x4405('0x43')]({'raw':!![]});}return null;})[_0x4405('0x24')](function(_0x1160dd){if(_0x1160dd){_0x4c3108=_['keyBy'](_0x1160dd,'id');var _0x1885d6;var _0x27a3fa=squel[_0x4405('0x6c')]();_0x27a3fa[_0x4405('0x6d')](_0x23868c[_0x4405('0x6e')]);for(var _0x463510=0x0;_0x463510<_0x4564a2[_0x4405('0x38')];_0x463510+=0x1){_0x1885d6=_0x4564a2[_0x463510][_0x4405('0x6f')]?_0x4c3108[_0x4564a2[_0x463510][_0x4405('0x6f')]]['metric']:_0x4564a2[_0x463510][_0x4405('0x69')];_0x1885d6=_0x4564a2[_0x463510][_0x4405('0x70')]?_[_0x4405('0x71')](_0xf83981[_0x4564a2[_0x463510]['function']],'%s',_0x1885d6):_0x1885d6;_0x1885d6=_0x4564a2[_0x463510][_0x4405('0x72')]?_['replace'](_0x4b566a[_0x4564a2[_0x463510][_0x4405('0x72')]],'%s',_0x1885d6):_0x1885d6;if(_0x4564a2[_0x463510][_0x4405('0x73')]){_0x27a3fa[_0x4405('0x74')](_0x1885d6);}_0x4564a2[_0x463510][_0x4405('0x75')]&&_0x27a3fa[_0x4405('0x3a')](_0x1885d6,_0x4564a2[_0x463510][_0x4405('0x75')]===_0x4405('0x76')?![]:!![]);_0x27a3fa[_0x4405('0x69')](_0x1885d6,_0x4564a2[_0x463510][_0x4405('0x77')]||_0x1885d6);}if(_0x23868c[_0x4405('0x78')]){_0x23868c[_0x4405('0x78')]=JSON[_0x4405('0x79')](_0x23868c[_0x4405('0x78')]);for(var _0x21ae41=0x0;_0x21ae41<_0x23868c['joins'][_0x4405('0x38')];_0x21ae41+=0x1){if(_0x23868c['joins'][_0x21ae41]['type']&&_[_0x4405('0x63')](_0x4ed59b,_0x23868c[_0x4405('0x78')][_0x21ae41][_0x4405('0x40')])&&_0x23868c['joins'][_0x21ae41][_0x4405('0x7a')]&&_0x23868c['joins'][_0x21ae41][_0x4405('0x7b')]&&_0x23868c['joins'][_0x21ae41]['foreignKey']){_0x27a3fa[_0x23868c[_0x4405('0x78')][_0x21ae41][_0x4405('0x40')]](_0x23868c[_0x4405('0x78')][_0x21ae41]['foreignTable'],null,util['format'](_0x4405('0x7c'),_0x23868c['table'],_0x23868c[_0x4405('0x78')][_0x21ae41][_0x4405('0x7a')],_0x23868c[_0x4405('0x78')][_0x21ae41]['foreignTable'],_0x23868c[_0x4405('0x78')][_0x21ae41][_0x4405('0x7d')]));}}}if(_0x23868c[_0x4405('0x7e')]){_0x23868c[_0x4405('0x7e')]=JSON[_0x4405('0x79')](_0x23868c[_0x4405('0x7e')]);_0x27a3fa[_0x4405('0x3c')](_0x1f5842(_0x23868c[_0x4405('0x7e')][_0x4405('0x74')]));}_0x5e821a=_0x27a3fa['clone']();_0x27a3fa[_0x4405('0x1d')](_0x1f11e6);_0x27a3fa['offset'](0x0);logger[_0x4405('0x7f')](_0x4405('0x80'),_0x27a3fa['toString']());return dbH['sequelize'][_0x4405('0x33')](_0x27a3fa[_0x4405('0x81')](),{'type':dbH['sequelize'][_0x4405('0x82')][_0x4405('0x83')]});}})[_0x4405('0x24')](respondWithResult(_0x3bd209,null))[_0x4405('0x45')](handleError(_0x3bd209,null));};function runReport(_0xc46973,_0x36fc07,_0x27d21d){var _0x2a0968=_0x36fc07[_0x4405('0x2b')];var _0x227f57=0xa;var _0x24de72=[_0x4405('0x54'),'left_join',_0x4405('0x55'),_0x4405('0x56')];var _0x25c5e3={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4405('0x58'),'MAX':'MAX(%s)','MIN':_0x4405('0x5a'),'AVG':_0x4405('0x5b'),'GROUP_CONCAT':_0x4405('0x5c'),'GROUP_CONCAT ASC':_0x4405('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3f1087={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4405('0x5f'),'HOUR':_0x4405('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4405('0x62')};var _0x4d22af=function(_0x2ab08f){return!_[_0x4405('0x63')]([_0x4405('0x64'),_0x4405('0x84'),_0x4405('0x65'),_0x4405('0x66')],_0x2ab08f);};var _0x4fe771=function(_0x1f0d08){if(!_0x1f0d08||!_0x1f0d08[_0x4405('0x67')][_0x4405('0x38')]){return'';}for(var _0xe6c11a='(',_0x17d030=0x0;_0x17d030<_0x1f0d08[_0x4405('0x67')][_0x4405('0x38')];_0x17d030+=0x1){_0x17d030>0x0&&(_0xe6c11a+='\x20'+_0x1f0d08['operator']+'\x20');_0xe6c11a+=_0x1f0d08['rules'][_0x17d030][_0x4405('0x74')]?_0x4fe771(_0x1f0d08[_0x4405('0x67')][_0x17d030][_0x4405('0x74')]):_0x1f0d08[_0x4405('0x67')][_0x17d030]['field']+'\x20'+_0x1f0d08[_0x4405('0x67')][_0x17d030][_0x4405('0x6a')]+(_0x4d22af(_0x1f0d08[_0x4405('0x67')][_0x17d030]['condition'])?'\x20'+_0x1f0d08[_0x4405('0x67')][_0x17d030][_0x4405('0x85')]:'');}return _0xe6c11a+')';};var _0x5426ef={'where':{'id':_0xc46973['id']}},_0x7b8664,_0x53c1b5,_0x3ce447,_0x21928a,_0x1b6fa8;_0x5426ef=_[_0x4405('0x3f')]({},_0x5426ef,_0x27d21d);return db['AnalyticCustomReport'][_0x4405('0x4a')](_0x5426ef)['then'](function(_0x24eacc){if(_0x24eacc){_0x7b8664=_0x24eacc;return _0x24eacc[_0x4405('0x6b')]();}return null;})[_0x4405('0x24')](function(_0x1c588b){if(_0x1c588b){if(!_0x1c588b[_0x4405('0x38')]){throw new db[(_0x4405('0x86'))]['ValidationErrorItem'](_0x4405('0x87'),0x193);}_0x53c1b5=_0x1c588b;return db[_0x4405('0x88')][_0x4405('0x43')]({'raw':!![]});}return null;})[_0x4405('0x24')](function(_0x153562){if(_0x153562){_0x3ce447=_[_0x4405('0x89')](_0x153562,'id');var _0x269132;var _0x527680=squel[_0x4405('0x6c')]();_0x527680[_0x4405('0x6d')](_0x7b8664['table']);for(var _0x28d4f0=0x0;_0x28d4f0<_0x53c1b5[_0x4405('0x38')];_0x28d4f0+=0x1){_0x269132=_0x53c1b5[_0x28d4f0][_0x4405('0x6f')]?_0x3ce447[_0x53c1b5[_0x28d4f0]['MetricId']][_0x4405('0x8a')]:_0x53c1b5[_0x28d4f0][_0x4405('0x69')];_0x269132=_0x53c1b5[_0x28d4f0][_0x4405('0x70')]?_[_0x4405('0x71')](_0x25c5e3[_0x53c1b5[_0x28d4f0][_0x4405('0x70')]],'%s',_0x269132):_0x269132;_0x269132=_0x53c1b5[_0x28d4f0][_0x4405('0x72')]?_[_0x4405('0x71')](_0x3f1087[_0x53c1b5[_0x28d4f0][_0x4405('0x72')]],'%s',_0x269132):_0x269132;if(_0x53c1b5[_0x28d4f0][_0x4405('0x73')]){_0x527680[_0x4405('0x74')](_0x269132);}_0x53c1b5[_0x28d4f0][_0x4405('0x75')]&&_0x527680[_0x4405('0x3a')](_0x269132,_0x53c1b5[_0x28d4f0][_0x4405('0x75')]==='DESC'?![]:!![]);_0x527680[_0x4405('0x69')](_0x269132,_0x53c1b5[_0x28d4f0]['alias']||_0x269132);}if(_0x7b8664['joins']){_0x7b8664[_0x4405('0x78')]=JSON['parse'](_0x7b8664[_0x4405('0x78')]);for(var _0x43e4b6=0x0;_0x43e4b6<_0x7b8664[_0x4405('0x78')]['length'];_0x43e4b6+=0x1){if(_0x7b8664[_0x4405('0x78')][_0x43e4b6][_0x4405('0x40')]&&_[_0x4405('0x63')](_0x24de72,_0x7b8664[_0x4405('0x78')][_0x43e4b6][_0x4405('0x40')])&&_0x7b8664[_0x4405('0x78')][_0x43e4b6][_0x4405('0x7a')]&&_0x7b8664[_0x4405('0x78')][_0x43e4b6]['foreignTable']&&_0x7b8664[_0x4405('0x78')][_0x43e4b6][_0x4405('0x7d')]){_0x527680[_0x7b8664[_0x4405('0x78')][_0x43e4b6][_0x4405('0x40')]](_0x7b8664[_0x4405('0x78')][_0x43e4b6]['foreignTable'],null,util[_0x4405('0x72')](_0x4405('0x7c'),_0x7b8664[_0x4405('0x6e')],_0x7b8664[_0x4405('0x78')][_0x43e4b6][_0x4405('0x7a')],_0x7b8664[_0x4405('0x78')][_0x43e4b6]['foreignTable'],_0x7b8664[_0x4405('0x78')][_0x43e4b6][_0x4405('0x7d')]));}}}if(_0x7b8664['conditions']){_0x7b8664[_0x4405('0x7e')]=JSON[_0x4405('0x79')](_0x7b8664['conditions']);_0x527680[_0x4405('0x3c')](_0x4fe771(_0x7b8664[_0x4405('0x7e')][_0x4405('0x74')]));}_0x1b6fa8=_0x527680['clone']();_0x527680['limit'](_0x227f57);_0x527680[_0x4405('0x1c')](0x0);return;}})['then'](function(){if(_0x36fc07[_0x4405('0x8b')]==='web'){return null;}var _0x1b2991=_[_0x4405('0x3f')](_0x36fc07,{'name':_0x36fc07[_0x4405('0x8c')]||_0x36fc07[_0x4405('0x2b')]||_0x7b8664[_0x4405('0x2b')],'basename':_0x2a0968,'savename':util['format']('%s-%s.%s',_0x36fc07[_0x4405('0x2b')]||_0x7b8664['name'],require(_0x4405('0x8d'))[_0x4405('0x8e')](0x4),_0x36fc07[_0x4405('0x8b')]||_0x4405('0x8f')),'reportId':_0x7b8664['id'],'reportType':_0x4405('0x90')});return db[_0x4405('0x91')][_0x4405('0x4b')](_0x1b2991,{'raw':!![]});})[_0x4405('0x24')](function(_0x153048){if(_0x7b8664[_0x4405('0x6e')]===_0x4405('0x92')){_0x1b6fa8[_0x4405('0x3c')](_0x7b8664['table']+_0x4405('0x93'),_0x36fc07['startDate'],_0x36fc07[_0x4405('0x94')]);}else{_0x1b6fa8[_0x4405('0x3c')](_0x7b8664['table']+_0x4405('0x95'),_0x36fc07['startDate'],_0x36fc07['endDate']);}if(_0x153048){logger[_0x4405('0x96')](_0x4405('0x97'),_0x1b6fa8[_0x4405('0x81')]());require(_0x4405('0x98'))[_0x4405('0x99')](path['join'](__dirname,_0x4405('0x9a'),_0x153048[_0x4405('0x8b')]),[_0x153048['id'],_0x1b6fa8['toString'](),path[_0x4405('0x54')](__dirname,_0x4405('0x9b'),_0x153048[_0x4405('0x9c')]),_0x2a0968]);return _0x153048;}else{var _0x3b51b9=squel['select']();_0x3b51b9[_0x4405('0x6d')]('('+_0x1b6fa8[_0x4405('0x81')]()+')',_0x4405('0x9d'));_0x3b51b9[_0x4405('0x69')](_0x4405('0x9e'),_0x4405('0x1b'));_0x1b6fa8[_0x4405('0x1d')](_0x36fc07[_0x4405('0x1d')]||_0x227f57);_0x1b6fa8[_0x4405('0x1c')](_0x36fc07[_0x4405('0x1c')]||0x0);return dbH['sequelize'][_0x4405('0x33')](_0x3b51b9[_0x4405('0x81')](),{'type':dbH[_0x4405('0x9f')]['QueryTypes'][_0x4405('0x83')]})[_0x4405('0x24')](function(_0x329432){if(!_0x329432[_0x4405('0x38')]){_0x21928a=0x0;}else{_0x21928a=_0x329432[0x0][_0x4405('0x1b')]||0x0;}return dbH['sequelize'][_0x4405('0x33')](_0x1b6fa8['toString'](),{'type':dbH[_0x4405('0x9f')][_0x4405('0x82')][_0x4405('0x83')]});})['then'](function(_0x50d35d){return{'rows':_0x50d35d||[],'count':_0x21928a};});}});}exports['run']=function(_0x248df6,_0x403df6){return runReport(_0x248df6[_0x4405('0x47')],_0x248df6[_0x4405('0x33')],_0x248df6[_0x4405('0x41')])['then'](respondWithResult(_0x403df6,null))[_0x4405('0x45')](handleError(_0x403df6,null));};exports[_0x4405('0xa0')]=runReport;exports[_0x4405('0x33')]=function(_0x475a1c,_0x33366e){var _0x1fba62=0xa;var _0x40256a=[_0x4405('0x54'),_0x4405('0xa1'),_0x4405('0x55'),'cross_join'];var _0x280589={'SUM':_0x4405('0x57'),'COUNT':_0x4405('0xa2'),'COUNT DISTINCT':_0x4405('0x58'),'MAX':_0x4405('0x59'),'MIN':_0x4405('0x5a'),'AVG':_0x4405('0x5b'),'GROUP_CONCAT':_0x4405('0x5c'),'GROUP_CONCAT ASC':_0x4405('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xa84cbf={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4405('0x5f'),'HOUR':_0x4405('0x60'),'ROUND':_0x4405('0x61'),'UNIX_TIMESTAMP':_0x4405('0x62')};var _0xffdaca=function(_0x4b00bc){return!_['includes']([_0x4405('0x64'),_0x4405('0x84'),'IS\x20EMPTY',_0x4405('0x66')],_0x4b00bc);};var _0x348697=function(_0x366e0d){if(!_0x366e0d||!_0x366e0d['rules'][_0x4405('0x38')]){return'';}for(var _0x3cf1c6='(',_0x4baccc=0x0;_0x4baccc<_0x366e0d[_0x4405('0x67')]['length'];_0x4baccc+=0x1){_0x4baccc>0x0&&(_0x3cf1c6+='\x20'+_0x366e0d[_0x4405('0x68')]+'\x20');_0x3cf1c6+=_0x366e0d['rules'][_0x4baccc][_0x4405('0x74')]?_0x348697(_0x366e0d['rules'][_0x4baccc][_0x4405('0x74')]):_0x366e0d['rules'][_0x4baccc][_0x4405('0x69')]+'\x20'+_0x366e0d[_0x4405('0x67')][_0x4baccc]['condition']+(_0xffdaca(_0x366e0d[_0x4405('0x67')][_0x4baccc][_0x4405('0x6a')])?'\x20'+_0x366e0d[_0x4405('0x67')][_0x4baccc][_0x4405('0x85')]:'');}return _0x3cf1c6+')';};var _0x362227={'where':{'id':_0x475a1c['params']['id']}},_0x243edf,_0x2a62b2,_0x794fd2,_0x2a145c,_0x4e6538;_0x362227=_[_0x4405('0x3f')]({},_0x362227,_0x475a1c[_0x4405('0x41')]);return db['AnalyticCustomReport'][_0x4405('0x4a')](_0x362227)[_0x4405('0x24')](function(_0x412aca){if(_0x412aca){_0x243edf=_0x412aca;return _0x412aca[_0x4405('0x6b')]();}return null;})[_0x4405('0x24')](function(_0x31c436){if(_0x31c436){if(!_0x31c436['length']){throw new db[(_0x4405('0x86'))][(_0x4405('0xa3'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2a62b2=_0x31c436;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x4405('0x24')](function(_0x436e7b){if(_0x436e7b){_0x794fd2=_[_0x4405('0x89')](_0x436e7b,'id');var _0x53417b;var _0x3da974=squel[_0x4405('0x6c')]();_0x3da974[_0x4405('0x6d')](_0x243edf[_0x4405('0x6e')]);for(var _0x8eafe=0x0;_0x8eafe<_0x2a62b2[_0x4405('0x38')];_0x8eafe+=0x1){_0x53417b=_0x2a62b2[_0x8eafe][_0x4405('0x6f')]?_0x794fd2[_0x2a62b2[_0x8eafe]['MetricId']][_0x4405('0x8a')]:_0x2a62b2[_0x8eafe]['field'];_0x53417b=_0x2a62b2[_0x8eafe]['function']?_[_0x4405('0x71')](_0x280589[_0x2a62b2[_0x8eafe][_0x4405('0x70')]],'%s',_0x53417b):_0x53417b;_0x53417b=_0x2a62b2[_0x8eafe][_0x4405('0x72')]?_[_0x4405('0x71')](_0xa84cbf[_0x2a62b2[_0x8eafe][_0x4405('0x72')]],'%s',_0x53417b):_0x53417b;if(_0x2a62b2[_0x8eafe][_0x4405('0x73')]){_0x3da974[_0x4405('0x74')](_0x53417b);}_0x2a62b2[_0x8eafe][_0x4405('0x75')]&&_0x3da974[_0x4405('0x3a')](_0x53417b,_0x2a62b2[_0x8eafe][_0x4405('0x75')]===_0x4405('0x76')?![]:!![]);_0x3da974[_0x4405('0x69')](_0x53417b,_0x2a62b2[_0x8eafe][_0x4405('0x77')]||_0x53417b);}if(_0x243edf[_0x4405('0x78')]){_0x243edf[_0x4405('0x78')]=JSON[_0x4405('0x79')](_0x243edf[_0x4405('0x78')]);for(var _0x491210=0x0;_0x491210<_0x243edf[_0x4405('0x78')][_0x4405('0x38')];_0x491210+=0x1){if(_0x243edf[_0x4405('0x78')][_0x491210][_0x4405('0x40')]&&_[_0x4405('0x63')](_0x40256a,_0x243edf['joins'][_0x491210]['type'])&&_0x243edf[_0x4405('0x78')][_0x491210]['parentKey']&&_0x243edf['joins'][_0x491210][_0x4405('0x7b')]&&_0x243edf['joins'][_0x491210][_0x4405('0x7d')]){_0x3da974[_0x243edf[_0x4405('0x78')][_0x491210][_0x4405('0x40')]](_0x243edf[_0x4405('0x78')][_0x491210]['foreignTable'],null,util[_0x4405('0x72')](_0x4405('0x7c'),_0x243edf[_0x4405('0x6e')],_0x243edf[_0x4405('0x78')][_0x491210][_0x4405('0x7a')],_0x243edf[_0x4405('0x78')][_0x491210]['foreignTable'],_0x243edf[_0x4405('0x78')][_0x491210][_0x4405('0x7d')]));}}}if(_0x243edf[_0x4405('0x7e')]){_0x243edf[_0x4405('0x7e')]=JSON[_0x4405('0x79')](_0x243edf[_0x4405('0x7e')]);_0x3da974[_0x4405('0x3c')](_0x348697(_0x243edf[_0x4405('0x7e')][_0x4405('0x74')]));}_0x4e6538=_0x3da974[_0x4405('0xa4')]();_0x3da974[_0x4405('0x1d')](_0x1fba62);_0x3da974['offset'](0x0);logger['debug'](_0x4405('0x80'),_0x3da974[_0x4405('0x81')]());return dbH['sequelize'][_0x4405('0x33')](_0x3da974['toString'](),{'type':dbH[_0x4405('0x9f')][_0x4405('0x82')][_0x4405('0x83')]});}})[_0x4405('0x24')](function(){return{'sql':_0x4e6538[_0x4405('0x81')]()};})['then'](respondWithResult(_0x33366e,null))[_0x4405('0x45')](handleError(_0x33366e,null));}; \ No newline at end of file +var _0x2ada=['AnalyticMetric','table','MetricId','metric','function','replace','format','groupBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','right_join','cross_join','COUNT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20EMPTY','operator','keyBy','select','orderBy','output','fullPath','%s-%s.%s','randomstring','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','fork','savename','from','countTable','COUNT(*)','run','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ValidationErrorItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','crypto','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticCustomReport','include','findAll','rows','catch','params','rawAttributes','length','includeAll','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','group','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field'];(function(_0x59a284,_0x28c308){var _0x3de2cf=function(_0x1bd4bf){while(--_0x1bd4bf){_0x59a284['push'](_0x59a284['shift']());}};_0x3de2cf(++_0x28c308);}(_0x2ada,0xda));var _0xa2ad=function(_0x377f50,_0x5589ba){_0x377f50=_0x377f50-0x0;var _0x14a9d2=_0x2ada[_0x377f50];return _0x14a9d2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa2ad('0x0'));var rimraf=require(_0xa2ad('0x1'));var zipdir=require(_0xa2ad('0x2'));var jsonpatch=require(_0xa2ad('0x3'));var rp=require(_0xa2ad('0x4'));var moment=require(_0xa2ad('0x5'));var BPromise=require(_0xa2ad('0x6'));var Mustache=require('mustache');var util=require(_0xa2ad('0x7'));var path=require('path');var sox=require(_0xa2ad('0x8'));var csv=require('to-csv');var ejs=require(_0xa2ad('0x9'));var fs=require('fs');var fs_extra=require(_0xa2ad('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa2ad('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa2ad('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa2ad('0xd'));var hardwareService=require(_0xa2ad('0xe'));var logger=require(_0xa2ad('0xf'))(_0xa2ad('0x10'));var utils=require(_0xa2ad('0x11'));var config=require(_0xa2ad('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xa2ad('0x13'))['db'];var dbH=require(_0xa2ad('0x13'))['dbH'];function respondWithStatusCode(_0x48c972,_0x3affb4){_0x3affb4=_0x3affb4||0xcc;return function(_0x2c1a73){if(_0x2c1a73){return _0x48c972[_0xa2ad('0x14')](_0x3affb4);}return _0x48c972[_0xa2ad('0x15')](_0x3affb4)[_0xa2ad('0x16')]();};}function respondWithResult(_0x97a2b9,_0x5c6883){_0x5c6883=_0x5c6883||0xc8;return function(_0x4a20df){if(_0x4a20df){return _0x97a2b9['status'](_0x5c6883)['json'](_0x4a20df);}};}function respondWithFilteredResult(_0x52a559,_0x524f){return function(_0x1f0fab){if(_0x1f0fab){var _0x3ae5ec=_0x1f0fab[_0xa2ad('0x17')],_0x4399b8=_0x524f[_0xa2ad('0x18')],_0x576575=_0x524f[_0xa2ad('0x18')]+_0x524f[_0xa2ad('0x19')],_0x1e2ac4;if(_0x576575>=_0x3ae5ec){_0x576575=_0x3ae5ec;_0x1e2ac4=0xc8;}else{_0x1e2ac4=0xce;}_0x52a559[_0xa2ad('0x15')](_0x1e2ac4);return _0x52a559[_0xa2ad('0x1a')](_0xa2ad('0x1b'),_0x4399b8+'-'+_0x576575+'/'+_0x3ae5ec)[_0xa2ad('0x1c')](_0x1f0fab);}return null;};}function patchUpdates(_0x5ec712){return function(_0x20ca9e){try{jsonpatch[_0xa2ad('0x1d')](_0x20ca9e,_0x5ec712,!![]);}catch(_0x4e578d){return BPromise[_0xa2ad('0x1e')](_0x4e578d);}return _0x20ca9e[_0xa2ad('0x1f')]();};}function saveUpdates(_0x4bed25,_0x5ef96b){return function(_0x5e3748){if(_0x5e3748){return _0x5e3748[_0xa2ad('0x20')](_0x4bed25)[_0xa2ad('0x21')](function(_0x180c61){return _0x180c61;});}return null;};}function removeEntity(_0x5675fa,_0x1f15ef){return function(_0x4d7830){if(_0x4d7830){return _0x4d7830[_0xa2ad('0x22')]()[_0xa2ad('0x21')](function(){var _0x35adc7=_0x4d7830['get']({'plain':!![]});var _0x4379a1='CustomReports';return db['UserProfileResource']['destroy']({'where':{'type':_0x4379a1,'resourceId':_0x35adc7['id']}})[_0xa2ad('0x21')](function(){return _0x4d7830;});})['then'](function(){_0x5675fa[_0xa2ad('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x496c84,_0x4e7440){return function(_0x3264a5){if(!_0x3264a5){_0x496c84[_0xa2ad('0x14')](0x194);}return _0x3264a5;};}function handleError(_0xf2a54f,_0x4e38ca){_0x4e38ca=_0x4e38ca||0x1f4;return function(_0xfde6e9){logger['error'](_0xfde6e9[_0xa2ad('0x23')]);if(_0xfde6e9[_0xa2ad('0x24')]){delete _0xfde6e9[_0xa2ad('0x24')];}_0xf2a54f['status'](_0x4e38ca)[_0xa2ad('0x25')](_0xfde6e9);};}exports[_0xa2ad('0x26')]=function(_0xee4fd3,_0x1b5ff4){var _0x270ec6={},_0x3757b6={},_0x47f5b3={'count':0x0,'rows':[]};var _0x1c0a34=_['map'](db['AnalyticCustomReport']['rawAttributes'],function(_0x354d90){return{'name':_0x354d90[_0xa2ad('0x27')],'type':_0x354d90[_0xa2ad('0x28')][_0xa2ad('0x29')]};});_0x3757b6[_0xa2ad('0x2a')]=_[_0xa2ad('0x2b')](_0x1c0a34,'name');_0x3757b6[_0xa2ad('0x2c')]=_[_0xa2ad('0x2d')](_0xee4fd3[_0xa2ad('0x2c')]);_0x3757b6[_0xa2ad('0x2e')]=_['intersection'](_0x3757b6[_0xa2ad('0x2a')],_0x3757b6[_0xa2ad('0x2c')]);_0x270ec6['attributes']=_[_0xa2ad('0x2f')](_0x3757b6['model'],qs[_0xa2ad('0x30')](_0xee4fd3[_0xa2ad('0x2c')][_0xa2ad('0x30')]));_0x270ec6[_0xa2ad('0x31')]=_0x270ec6[_0xa2ad('0x31')]['length']?_0x270ec6[_0xa2ad('0x31')]:_0x3757b6[_0xa2ad('0x2a')];if(!_0xee4fd3['query'][_0xa2ad('0x32')]('nolimit')){_0x270ec6[_0xa2ad('0x19')]=qs[_0xa2ad('0x19')](_0xee4fd3['query'][_0xa2ad('0x19')]);_0x270ec6['offset']=qs[_0xa2ad('0x18')](_0xee4fd3[_0xa2ad('0x2c')]['offset']);}_0x270ec6[_0xa2ad('0x33')]=qs[_0xa2ad('0x34')](_0xee4fd3[_0xa2ad('0x2c')][_0xa2ad('0x34')]);_0x270ec6[_0xa2ad('0x35')]=qs[_0xa2ad('0x2e')](_[_0xa2ad('0x36')](_0xee4fd3[_0xa2ad('0x2c')],_0x3757b6[_0xa2ad('0x2e')]),_0x1c0a34);if(_0xee4fd3[_0xa2ad('0x2c')][_0xa2ad('0x37')]){_0x270ec6[_0xa2ad('0x35')]=_[_0xa2ad('0x38')](_0x270ec6[_0xa2ad('0x35')],{'$or':_[_0xa2ad('0x2b')](_0x1c0a34,function(_0x4e455f){if(_0x4e455f[_0xa2ad('0x28')]!==_0xa2ad('0x39')){var _0x386cda={};_0x386cda[_0x4e455f[_0xa2ad('0x24')]]={'$like':'%'+_0xee4fd3[_0xa2ad('0x2c')][_0xa2ad('0x37')]+'%'};return _0x386cda;}})});}_0x270ec6=_['merge']({},_0x270ec6,_0xee4fd3[_0xa2ad('0x3a')]);var _0x2a829c={'where':_0x270ec6[_0xa2ad('0x35')]};return db[_0xa2ad('0x3b')][_0xa2ad('0x17')](_0x2a829c)[_0xa2ad('0x21')](function(_0x3fe629){_0x47f5b3['count']=_0x3fe629;if(_0xee4fd3[_0xa2ad('0x2c')]['includeAll']){_0x270ec6[_0xa2ad('0x3c')]=[{'all':!![]}];}return db[_0xa2ad('0x3b')][_0xa2ad('0x3d')](_0x270ec6);})['then'](function(_0x4179ff){_0x47f5b3[_0xa2ad('0x3e')]=_0x4179ff;return _0x47f5b3;})['then'](respondWithFilteredResult(_0x1b5ff4,_0x270ec6))[_0xa2ad('0x3f')](handleError(_0x1b5ff4,null));};exports['show']=function(_0x5ca31f,_0x65f868){var _0x1874f2={'raw':![],'where':{'id':_0x5ca31f[_0xa2ad('0x40')]['id']}},_0x4b1ebe={};_0x4b1ebe[_0xa2ad('0x2a')]=_[_0xa2ad('0x2d')](db[_0xa2ad('0x3b')][_0xa2ad('0x41')]);_0x4b1ebe[_0xa2ad('0x2c')]=_[_0xa2ad('0x2d')](_0x5ca31f['query']);_0x4b1ebe['filters']=_[_0xa2ad('0x2f')](_0x4b1ebe[_0xa2ad('0x2a')],_0x4b1ebe[_0xa2ad('0x2c')]);_0x1874f2[_0xa2ad('0x31')]=_[_0xa2ad('0x2f')](_0x4b1ebe[_0xa2ad('0x2a')],qs[_0xa2ad('0x30')](_0x5ca31f[_0xa2ad('0x2c')]['fields']));_0x1874f2['attributes']=_0x1874f2[_0xa2ad('0x31')][_0xa2ad('0x42')]?_0x1874f2[_0xa2ad('0x31')]:_0x4b1ebe[_0xa2ad('0x2a')];if(_0x5ca31f[_0xa2ad('0x2c')][_0xa2ad('0x43')]){_0x1874f2[_0xa2ad('0x3c')]=[{'all':!![]}];}_0x1874f2=_[_0xa2ad('0x38')]({},_0x1874f2,_0x5ca31f[_0xa2ad('0x3a')]);return db[_0xa2ad('0x3b')]['find'](_0x1874f2)['then'](handleEntityNotFound(_0x65f868,null))[_0xa2ad('0x21')](respondWithResult(_0x65f868,null))[_0xa2ad('0x3f')](handleError(_0x65f868,null));};exports['create']=function(_0x3453a3,_0x4f9e0e){return db[_0xa2ad('0x3b')][_0xa2ad('0x44')](_0x3453a3['body'],{})[_0xa2ad('0x21')](function(_0x82f27d){var _0x34a011=_0x3453a3[_0xa2ad('0x45')][_0xa2ad('0x46')]({'plain':!![]});if(!_0x34a011)throw new Error(_0xa2ad('0x47'));if(_0x34a011[_0xa2ad('0x48')]===_0xa2ad('0x45')){var _0x275c1e=_0x82f27d[_0xa2ad('0x46')]({'plain':!![]});var _0x371936=_0xa2ad('0x49');return db[_0xa2ad('0x4a')][_0xa2ad('0x4b')]({'where':{'name':_0x371936,'userProfileId':_0x34a011[_0xa2ad('0x4c')]},'raw':!![]})['then'](function(_0x4a0bb9){if(_0x4a0bb9&&_0x4a0bb9[_0xa2ad('0x4d')]===0x0){return db[_0xa2ad('0x4e')][_0xa2ad('0x44')]({'name':_0x275c1e['name'],'resourceId':_0x275c1e['id'],'type':_0xa2ad('0x4f'),'sectionId':_0x4a0bb9['id']},{})['then'](function(){return _0x82f27d;});}else{return _0x82f27d;}})['catch'](function(_0x19cfe1){logger['error'](_0xa2ad('0x50'),_0x19cfe1);throw _0x19cfe1;});}return _0x82f27d;})['then'](respondWithResult(_0x4f9e0e,0xc9))[_0xa2ad('0x3f')](handleError(_0x4f9e0e,null));};exports[_0xa2ad('0x20')]=function(_0x41a119,_0x1f12cb){if(_0x41a119[_0xa2ad('0x51')]['id']){delete _0x41a119[_0xa2ad('0x51')]['id'];}return db[_0xa2ad('0x3b')]['find']({'where':{'id':_0x41a119['params']['id']}})['then'](handleEntityNotFound(_0x1f12cb,null))[_0xa2ad('0x21')](saveUpdates(_0x41a119[_0xa2ad('0x51')],null))[_0xa2ad('0x21')](respondWithResult(_0x1f12cb,null))[_0xa2ad('0x3f')](handleError(_0x1f12cb,null));};exports[_0xa2ad('0x22')]=function(_0x5365bf,_0x8b3eb2){return db[_0xa2ad('0x3b')][_0xa2ad('0x4b')]({'where':{'id':_0x5365bf[_0xa2ad('0x40')]['id']}})[_0xa2ad('0x21')](handleEntityNotFound(_0x8b3eb2,null))[_0xa2ad('0x21')](removeEntity(_0x8b3eb2,null))[_0xa2ad('0x3f')](handleError(_0x8b3eb2,null));};exports[_0xa2ad('0x52')]=function(_0x19dcd7,_0x4a7e9a){var _0x2962a1=0xa;var _0x5cffa0=[_0xa2ad('0x53'),'left_join','right_join','cross_join'];var _0x18e776={'SUM':_0xa2ad('0x54'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xa2ad('0x55'),'MAX':_0xa2ad('0x56'),'MIN':_0xa2ad('0x57'),'AVG':_0xa2ad('0x58'),'GROUP_CONCAT':_0xa2ad('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x187281={'SEC_TO_TIME':_0xa2ad('0x5a'),'DATE':_0xa2ad('0x5b'),'HOUR':_0xa2ad('0x5c'),'ROUND':_0xa2ad('0x5d'),'UNIX_TIMESTAMP':_0xa2ad('0x5e')};var _0x5b423f=function(_0x47b179){return!_[_0xa2ad('0x5f')]([_0xa2ad('0x60'),_0xa2ad('0x61'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x47b179);};var _0x3dbd81=function(_0x20f659){if(!_0x20f659||!_0x20f659[_0xa2ad('0x62')][_0xa2ad('0x42')]){return'';}for(var _0x33e598='(',_0x5d6878=0x0;_0x5d6878<_0x20f659[_0xa2ad('0x62')][_0xa2ad('0x42')];_0x5d6878+=0x1){_0x5d6878>0x0&&(_0x33e598+='\x20'+_0x20f659['operator']+'\x20');_0x33e598+=_0x20f659['rules'][_0x5d6878][_0xa2ad('0x63')]?_0x3dbd81(_0x20f659[_0xa2ad('0x62')][_0x5d6878]['group']):_0x20f659[_0xa2ad('0x62')][_0x5d6878][_0xa2ad('0x64')]+'\x20'+_0x20f659[_0xa2ad('0x62')][_0x5d6878][_0xa2ad('0x65')]+(_0x5b423f(_0x20f659[_0xa2ad('0x62')][_0x5d6878]['condition'])?'\x20'+_0x20f659['rules'][_0x5d6878][_0xa2ad('0x66')]:'');}return _0x33e598+')';};var _0x52b693={'where':{'id':_0x19dcd7['params']['id']}},_0x5c0c19,_0x50b4f3,_0x310c1a,_0x461c4b,_0x3eb905;_0x52b693=_[_0xa2ad('0x38')]({},_0x52b693,_0x19dcd7[_0xa2ad('0x3a')]);return db[_0xa2ad('0x3b')][_0xa2ad('0x4b')](_0x52b693)[_0xa2ad('0x21')](function(_0x7c2345){if(_0x7c2345){_0x5c0c19=_0x7c2345;return _0x7c2345[_0xa2ad('0x67')]();}return null;})[_0xa2ad('0x21')](function(_0x125c8c){if(_0x125c8c){if(!_0x125c8c['length']){throw new db[(_0xa2ad('0x68'))]['ValidationErrorItem'](_0xa2ad('0x69'),0x193);}_0x50b4f3=_0x125c8c;return db[_0xa2ad('0x6a')][_0xa2ad('0x3d')]({'raw':!![]});}return null;})['then'](function(_0x483b52){if(_0x483b52){_0x310c1a=_['keyBy'](_0x483b52,'id');var _0x11e6d3;var _0x2c5045=squel['select']();_0x2c5045['from'](_0x5c0c19[_0xa2ad('0x6b')]);for(var _0x3ed59e=0x0;_0x3ed59e<_0x50b4f3[_0xa2ad('0x42')];_0x3ed59e+=0x1){_0x11e6d3=_0x50b4f3[_0x3ed59e][_0xa2ad('0x6c')]?_0x310c1a[_0x50b4f3[_0x3ed59e][_0xa2ad('0x6c')]][_0xa2ad('0x6d')]:_0x50b4f3[_0x3ed59e][_0xa2ad('0x64')];_0x11e6d3=_0x50b4f3[_0x3ed59e][_0xa2ad('0x6e')]?_[_0xa2ad('0x6f')](_0x18e776[_0x50b4f3[_0x3ed59e]['function']],'%s',_0x11e6d3):_0x11e6d3;_0x11e6d3=_0x50b4f3[_0x3ed59e]['format']?_[_0xa2ad('0x6f')](_0x187281[_0x50b4f3[_0x3ed59e][_0xa2ad('0x70')]],'%s',_0x11e6d3):_0x11e6d3;if(_0x50b4f3[_0x3ed59e][_0xa2ad('0x71')]){_0x2c5045[_0xa2ad('0x63')](_0x11e6d3);}_0x50b4f3[_0x3ed59e]['orderBy']&&_0x2c5045['order'](_0x11e6d3,_0x50b4f3[_0x3ed59e]['orderBy']===_0xa2ad('0x72')?![]:!![]);_0x2c5045[_0xa2ad('0x64')](_0x11e6d3,_0x50b4f3[_0x3ed59e][_0xa2ad('0x73')]||_0x11e6d3);}if(_0x5c0c19[_0xa2ad('0x74')]){_0x5c0c19[_0xa2ad('0x74')]=JSON[_0xa2ad('0x75')](_0x5c0c19[_0xa2ad('0x74')]);for(var _0x15275d=0x0;_0x15275d<_0x5c0c19['joins']['length'];_0x15275d+=0x1){if(_0x5c0c19[_0xa2ad('0x74')][_0x15275d][_0xa2ad('0x28')]&&_[_0xa2ad('0x5f')](_0x5cffa0,_0x5c0c19['joins'][_0x15275d][_0xa2ad('0x28')])&&_0x5c0c19[_0xa2ad('0x74')][_0x15275d]['parentKey']&&_0x5c0c19[_0xa2ad('0x74')][_0x15275d][_0xa2ad('0x76')]&&_0x5c0c19['joins'][_0x15275d]['foreignKey']){_0x2c5045[_0x5c0c19['joins'][_0x15275d][_0xa2ad('0x28')]](_0x5c0c19[_0xa2ad('0x74')][_0x15275d][_0xa2ad('0x76')],null,util[_0xa2ad('0x70')](_0xa2ad('0x77'),_0x5c0c19[_0xa2ad('0x6b')],_0x5c0c19[_0xa2ad('0x74')][_0x15275d][_0xa2ad('0x78')],_0x5c0c19['joins'][_0x15275d][_0xa2ad('0x76')],_0x5c0c19['joins'][_0x15275d][_0xa2ad('0x79')]));}}}if(_0x5c0c19[_0xa2ad('0x7a')]){_0x5c0c19['conditions']=JSON[_0xa2ad('0x75')](_0x5c0c19[_0xa2ad('0x7a')]);_0x2c5045[_0xa2ad('0x35')](_0x3dbd81(_0x5c0c19[_0xa2ad('0x7a')]['group']));}_0x3eb905=_0x2c5045[_0xa2ad('0x7b')]();_0x2c5045[_0xa2ad('0x19')](_0x2962a1);_0x2c5045[_0xa2ad('0x18')](0x0);logger[_0xa2ad('0x7c')](_0xa2ad('0x7d'),_0x2c5045[_0xa2ad('0x7e')]());return dbH[_0xa2ad('0x7f')][_0xa2ad('0x2c')](_0x2c5045[_0xa2ad('0x7e')](),{'type':dbH['sequelize'][_0xa2ad('0x80')][_0xa2ad('0x81')]});}})[_0xa2ad('0x21')](respondWithResult(_0x4a7e9a,null))['catch'](handleError(_0x4a7e9a,null));};function runReport(_0x59947f,_0xdb894c,_0x57c6b3){var _0x3a4fbe=_0xdb894c[_0xa2ad('0x24')];var _0xf9814d=0xa;var _0x522451=[_0xa2ad('0x53'),_0xa2ad('0x82'),_0xa2ad('0x83'),_0xa2ad('0x84')];var _0x43b6a4={'SUM':'SUM(%s)','COUNT':_0xa2ad('0x85'),'COUNT DISTINCT':_0xa2ad('0x55'),'MAX':_0xa2ad('0x56'),'MIN':_0xa2ad('0x57'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xa2ad('0x59'),'GROUP_CONCAT ASC':_0xa2ad('0x86'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1b760c={'SEC_TO_TIME':_0xa2ad('0x5a'),'DATE':_0xa2ad('0x5b'),'HOUR':_0xa2ad('0x5c'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xa2ad('0x5e')};var _0x114651=function(_0x5f4d6c){return!_[_0xa2ad('0x5f')]([_0xa2ad('0x60'),_0xa2ad('0x61'),_0xa2ad('0x87'),'IS\x20NOT\x20EMPTY'],_0x5f4d6c);};var _0x15750b=function(_0x34fa69){if(!_0x34fa69||!_0x34fa69[_0xa2ad('0x62')][_0xa2ad('0x42')]){return'';}for(var _0x509dbf='(',_0x46aeb5=0x0;_0x46aeb5<_0x34fa69['rules']['length'];_0x46aeb5+=0x1){_0x46aeb5>0x0&&(_0x509dbf+='\x20'+_0x34fa69[_0xa2ad('0x88')]+'\x20');_0x509dbf+=_0x34fa69[_0xa2ad('0x62')][_0x46aeb5][_0xa2ad('0x63')]?_0x15750b(_0x34fa69[_0xa2ad('0x62')][_0x46aeb5]['group']):_0x34fa69[_0xa2ad('0x62')][_0x46aeb5][_0xa2ad('0x64')]+'\x20'+_0x34fa69['rules'][_0x46aeb5][_0xa2ad('0x65')]+(_0x114651(_0x34fa69[_0xa2ad('0x62')][_0x46aeb5][_0xa2ad('0x65')])?'\x20'+_0x34fa69['rules'][_0x46aeb5][_0xa2ad('0x66')]:'');}return _0x509dbf+')';};var _0x4cc65f={'where':{'id':_0x59947f['id']}},_0x42fa98,_0x20017e,_0x32809b,_0xefc153,_0x485cfc;_0x4cc65f=_['merge']({},_0x4cc65f,_0x57c6b3);return db[_0xa2ad('0x3b')]['find'](_0x4cc65f)['then'](function(_0x49b315){if(_0x49b315){_0x42fa98=_0x49b315;return _0x49b315[_0xa2ad('0x67')]();}return null;})[_0xa2ad('0x21')](function(_0x4ad506){if(_0x4ad506){if(!_0x4ad506[_0xa2ad('0x42')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x20017e=_0x4ad506;return db[_0xa2ad('0x6a')][_0xa2ad('0x3d')]({'raw':!![]});}return null;})['then'](function(_0x5b2852){if(_0x5b2852){_0x32809b=_[_0xa2ad('0x89')](_0x5b2852,'id');var _0x36f5f5;var _0x4b51c0=squel[_0xa2ad('0x8a')]();_0x4b51c0['from'](_0x42fa98[_0xa2ad('0x6b')]);for(var _0x4bd354=0x0;_0x4bd354<_0x20017e[_0xa2ad('0x42')];_0x4bd354+=0x1){_0x36f5f5=_0x20017e[_0x4bd354]['MetricId']?_0x32809b[_0x20017e[_0x4bd354]['MetricId']][_0xa2ad('0x6d')]:_0x20017e[_0x4bd354]['field'];_0x36f5f5=_0x20017e[_0x4bd354][_0xa2ad('0x6e')]?_[_0xa2ad('0x6f')](_0x43b6a4[_0x20017e[_0x4bd354][_0xa2ad('0x6e')]],'%s',_0x36f5f5):_0x36f5f5;_0x36f5f5=_0x20017e[_0x4bd354][_0xa2ad('0x70')]?_[_0xa2ad('0x6f')](_0x1b760c[_0x20017e[_0x4bd354][_0xa2ad('0x70')]],'%s',_0x36f5f5):_0x36f5f5;if(_0x20017e[_0x4bd354][_0xa2ad('0x71')]){_0x4b51c0[_0xa2ad('0x63')](_0x36f5f5);}_0x20017e[_0x4bd354][_0xa2ad('0x8b')]&&_0x4b51c0[_0xa2ad('0x33')](_0x36f5f5,_0x20017e[_0x4bd354][_0xa2ad('0x8b')]===_0xa2ad('0x72')?![]:!![]);_0x4b51c0[_0xa2ad('0x64')](_0x36f5f5,_0x20017e[_0x4bd354][_0xa2ad('0x73')]||_0x36f5f5);}if(_0x42fa98[_0xa2ad('0x74')]){_0x42fa98['joins']=JSON['parse'](_0x42fa98[_0xa2ad('0x74')]);for(var _0x21b397=0x0;_0x21b397<_0x42fa98[_0xa2ad('0x74')][_0xa2ad('0x42')];_0x21b397+=0x1){if(_0x42fa98[_0xa2ad('0x74')][_0x21b397][_0xa2ad('0x28')]&&_[_0xa2ad('0x5f')](_0x522451,_0x42fa98[_0xa2ad('0x74')][_0x21b397][_0xa2ad('0x28')])&&_0x42fa98['joins'][_0x21b397][_0xa2ad('0x78')]&&_0x42fa98[_0xa2ad('0x74')][_0x21b397][_0xa2ad('0x76')]&&_0x42fa98[_0xa2ad('0x74')][_0x21b397][_0xa2ad('0x79')]){_0x4b51c0[_0x42fa98[_0xa2ad('0x74')][_0x21b397][_0xa2ad('0x28')]](_0x42fa98[_0xa2ad('0x74')][_0x21b397][_0xa2ad('0x76')],null,util[_0xa2ad('0x70')](_0xa2ad('0x77'),_0x42fa98[_0xa2ad('0x6b')],_0x42fa98[_0xa2ad('0x74')][_0x21b397]['parentKey'],_0x42fa98[_0xa2ad('0x74')][_0x21b397]['foreignTable'],_0x42fa98[_0xa2ad('0x74')][_0x21b397][_0xa2ad('0x79')]));}}}if(_0x42fa98[_0xa2ad('0x7a')]){_0x42fa98[_0xa2ad('0x7a')]=JSON[_0xa2ad('0x75')](_0x42fa98['conditions']);_0x4b51c0['where'](_0x15750b(_0x42fa98[_0xa2ad('0x7a')][_0xa2ad('0x63')]));}_0x485cfc=_0x4b51c0[_0xa2ad('0x7b')]();_0x4b51c0['limit'](_0xf9814d);_0x4b51c0[_0xa2ad('0x18')](0x0);return;}})[_0xa2ad('0x21')](function(){if(_0xdb894c[_0xa2ad('0x8c')]==='web'){return null;}var _0x5ef42f=_['merge'](_0xdb894c,{'name':_0xdb894c[_0xa2ad('0x8d')]||_0xdb894c[_0xa2ad('0x24')]||_0x42fa98[_0xa2ad('0x24')],'basename':_0x3a4fbe,'savename':util[_0xa2ad('0x70')](_0xa2ad('0x8e'),_0xdb894c['name']||_0x42fa98['name'],require(_0xa2ad('0x8f'))['generate'](0x4),_0xdb894c[_0xa2ad('0x8c')]||_0xa2ad('0x90')),'reportId':_0x42fa98['id'],'reportType':_0xa2ad('0x91')});return db['AnalyticExtractedReport'][_0xa2ad('0x44')](_0x5ef42f,{'raw':!![]});})[_0xa2ad('0x21')](function(_0x53de66){if(_0x42fa98[_0xa2ad('0x6b')]===_0xa2ad('0x92')){_0x485cfc[_0xa2ad('0x35')](_0x42fa98[_0xa2ad('0x6b')]+_0xa2ad('0x93'),_0xdb894c['startDate'],_0xdb894c[_0xa2ad('0x94')]);}else{_0x485cfc['where'](_0x42fa98['table']+_0xa2ad('0x95'),_0xdb894c[_0xa2ad('0x96')],_0xdb894c[_0xa2ad('0x94')]);}if(_0x53de66){logger[_0xa2ad('0x97')](_0xa2ad('0x98'),_0x485cfc[_0xa2ad('0x7e')]());require(_0xa2ad('0x99'))[_0xa2ad('0x9a')](path['join'](__dirname,'../../components/export/',_0x53de66[_0xa2ad('0x8c')]),[_0x53de66['id'],_0x485cfc[_0xa2ad('0x7e')](),path[_0xa2ad('0x53')](__dirname,'../../files/reports',_0x53de66[_0xa2ad('0x9b')]),_0x3a4fbe]);return _0x53de66;}else{var _0x4765a3=squel[_0xa2ad('0x8a')]();_0x4765a3[_0xa2ad('0x9c')]('('+_0x485cfc[_0xa2ad('0x7e')]()+')',_0xa2ad('0x9d'));_0x4765a3[_0xa2ad('0x64')](_0xa2ad('0x9e'),_0xa2ad('0x17'));_0x485cfc[_0xa2ad('0x19')](_0xdb894c[_0xa2ad('0x19')]||_0xf9814d);_0x485cfc[_0xa2ad('0x18')](_0xdb894c[_0xa2ad('0x18')]||0x0);return dbH[_0xa2ad('0x7f')][_0xa2ad('0x2c')](_0x4765a3[_0xa2ad('0x7e')](),{'type':dbH['sequelize'][_0xa2ad('0x80')]['SELECT']})[_0xa2ad('0x21')](function(_0x3b9051){if(!_0x3b9051['length']){_0xefc153=0x0;}else{_0xefc153=_0x3b9051[0x0]['count']||0x0;}return dbH[_0xa2ad('0x7f')][_0xa2ad('0x2c')](_0x485cfc['toString'](),{'type':dbH['sequelize'][_0xa2ad('0x80')][_0xa2ad('0x81')]});})[_0xa2ad('0x21')](function(_0x34757a){return{'rows':_0x34757a||[],'count':_0xefc153};});}});}exports[_0xa2ad('0x9f')]=function(_0x425a4f,_0x361083){return runReport(_0x425a4f[_0xa2ad('0x40')],_0x425a4f['query'],_0x425a4f[_0xa2ad('0x3a')])[_0xa2ad('0x21')](respondWithResult(_0x361083,null))['catch'](handleError(_0x361083,null));};exports['runReport']=runReport;exports['query']=function(_0x1068d5,_0x156287){var _0x34e6a5=0xa;var _0x1ba373=[_0xa2ad('0x53'),_0xa2ad('0x82'),_0xa2ad('0x83'),_0xa2ad('0x84')];var _0x461868={'SUM':_0xa2ad('0x54'),'COUNT':_0xa2ad('0x85'),'COUNT DISTINCT':_0xa2ad('0x55'),'MAX':_0xa2ad('0x56'),'MIN':_0xa2ad('0x57'),'AVG':_0xa2ad('0x58'),'GROUP_CONCAT':_0xa2ad('0x59'),'GROUP_CONCAT ASC':_0xa2ad('0x86'),'GROUP_CONCAT DESC':_0xa2ad('0xa0')};var _0x1d7ccc={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xa2ad('0x5c'),'ROUND':_0xa2ad('0x5d'),'UNIX_TIMESTAMP':_0xa2ad('0x5e')};var _0x62130a=function(_0x4f20f7){return!_['includes'](['IS\x20NULL',_0xa2ad('0x61'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x4f20f7);};var _0x171530=function(_0x574895){if(!_0x574895||!_0x574895[_0xa2ad('0x62')][_0xa2ad('0x42')]){return'';}for(var _0x33b14f='(',_0x5855e2=0x0;_0x5855e2<_0x574895[_0xa2ad('0x62')][_0xa2ad('0x42')];_0x5855e2+=0x1){_0x5855e2>0x0&&(_0x33b14f+='\x20'+_0x574895[_0xa2ad('0x88')]+'\x20');_0x33b14f+=_0x574895[_0xa2ad('0x62')][_0x5855e2]['group']?_0x171530(_0x574895[_0xa2ad('0x62')][_0x5855e2][_0xa2ad('0x63')]):_0x574895[_0xa2ad('0x62')][_0x5855e2][_0xa2ad('0x64')]+'\x20'+_0x574895['rules'][_0x5855e2][_0xa2ad('0x65')]+(_0x62130a(_0x574895[_0xa2ad('0x62')][_0x5855e2][_0xa2ad('0x65')])?'\x20'+_0x574895[_0xa2ad('0x62')][_0x5855e2]['value']:'');}return _0x33b14f+')';};var _0x3c4d41={'where':{'id':_0x1068d5[_0xa2ad('0x40')]['id']}},_0x265bb5,_0x424b02,_0x2d2b8d,_0x4985ef,_0x316f4c;_0x3c4d41=_['merge']({},_0x3c4d41,_0x1068d5[_0xa2ad('0x3a')]);return db['AnalyticCustomReport'][_0xa2ad('0x4b')](_0x3c4d41)[_0xa2ad('0x21')](function(_0x1fb617){if(_0x1fb617){_0x265bb5=_0x1fb617;return _0x1fb617['getFields']();}return null;})[_0xa2ad('0x21')](function(_0x47a4f1){if(_0x47a4f1){if(!_0x47a4f1[_0xa2ad('0x42')]){throw new db[(_0xa2ad('0x68'))][(_0xa2ad('0xa1'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x424b02=_0x47a4f1;return db[_0xa2ad('0x6a')]['findAll']({'raw':!![]});}return null;})[_0xa2ad('0x21')](function(_0x9af25e){if(_0x9af25e){_0x2d2b8d=_[_0xa2ad('0x89')](_0x9af25e,'id');var _0x21a0fe;var _0x2098fe=squel[_0xa2ad('0x8a')]();_0x2098fe[_0xa2ad('0x9c')](_0x265bb5[_0xa2ad('0x6b')]);for(var _0xd905cd=0x0;_0xd905cd<_0x424b02['length'];_0xd905cd+=0x1){_0x21a0fe=_0x424b02[_0xd905cd][_0xa2ad('0x6c')]?_0x2d2b8d[_0x424b02[_0xd905cd][_0xa2ad('0x6c')]][_0xa2ad('0x6d')]:_0x424b02[_0xd905cd][_0xa2ad('0x64')];_0x21a0fe=_0x424b02[_0xd905cd][_0xa2ad('0x6e')]?_[_0xa2ad('0x6f')](_0x461868[_0x424b02[_0xd905cd][_0xa2ad('0x6e')]],'%s',_0x21a0fe):_0x21a0fe;_0x21a0fe=_0x424b02[_0xd905cd][_0xa2ad('0x70')]?_[_0xa2ad('0x6f')](_0x1d7ccc[_0x424b02[_0xd905cd][_0xa2ad('0x70')]],'%s',_0x21a0fe):_0x21a0fe;if(_0x424b02[_0xd905cd][_0xa2ad('0x71')]){_0x2098fe[_0xa2ad('0x63')](_0x21a0fe);}_0x424b02[_0xd905cd]['orderBy']&&_0x2098fe[_0xa2ad('0x33')](_0x21a0fe,_0x424b02[_0xd905cd][_0xa2ad('0x8b')]===_0xa2ad('0x72')?![]:!![]);_0x2098fe[_0xa2ad('0x64')](_0x21a0fe,_0x424b02[_0xd905cd][_0xa2ad('0x73')]||_0x21a0fe);}if(_0x265bb5[_0xa2ad('0x74')]){_0x265bb5[_0xa2ad('0x74')]=JSON[_0xa2ad('0x75')](_0x265bb5[_0xa2ad('0x74')]);for(var _0x5cd9a9=0x0;_0x5cd9a9<_0x265bb5['joins'][_0xa2ad('0x42')];_0x5cd9a9+=0x1){if(_0x265bb5['joins'][_0x5cd9a9]['type']&&_[_0xa2ad('0x5f')](_0x1ba373,_0x265bb5[_0xa2ad('0x74')][_0x5cd9a9]['type'])&&_0x265bb5[_0xa2ad('0x74')][_0x5cd9a9][_0xa2ad('0x78')]&&_0x265bb5[_0xa2ad('0x74')][_0x5cd9a9][_0xa2ad('0x76')]&&_0x265bb5['joins'][_0x5cd9a9][_0xa2ad('0x79')]){_0x2098fe[_0x265bb5[_0xa2ad('0x74')][_0x5cd9a9][_0xa2ad('0x28')]](_0x265bb5[_0xa2ad('0x74')][_0x5cd9a9][_0xa2ad('0x76')],null,util[_0xa2ad('0x70')](_0xa2ad('0x77'),_0x265bb5['table'],_0x265bb5[_0xa2ad('0x74')][_0x5cd9a9][_0xa2ad('0x78')],_0x265bb5[_0xa2ad('0x74')][_0x5cd9a9]['foreignTable'],_0x265bb5[_0xa2ad('0x74')][_0x5cd9a9]['foreignKey']));}}}if(_0x265bb5['conditions']){_0x265bb5['conditions']=JSON['parse'](_0x265bb5[_0xa2ad('0x7a')]);_0x2098fe[_0xa2ad('0x35')](_0x171530(_0x265bb5[_0xa2ad('0x7a')][_0xa2ad('0x63')]));}_0x316f4c=_0x2098fe['clone']();_0x2098fe[_0xa2ad('0x19')](_0x34e6a5);_0x2098fe['offset'](0x0);logger[_0xa2ad('0x7c')](_0xa2ad('0x7d'),_0x2098fe[_0xa2ad('0x7e')]());return dbH[_0xa2ad('0x7f')]['query'](_0x2098fe[_0xa2ad('0x7e')](),{'type':dbH[_0xa2ad('0x7f')][_0xa2ad('0x80')][_0xa2ad('0x81')]});}})[_0xa2ad('0x21')](function(){return{'sql':_0x316f4c['toString']()};})['then'](respondWithResult(_0x156287,null))[_0xa2ad('0x3f')](handleError(_0x156287,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index a759b8a..b26defa 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 _0x070c=['AnalyticCustomReport','analytics_custom_reports','util','../../config/logger','api','moment','request-promise','path','exports','define'];(function(_0x2f7dca,_0x5bc814){var _0x485433=function(_0x5528b4){while(--_0x5528b4){_0x2f7dca['push'](_0x2f7dca['shift']());}};_0x485433(++_0x5bc814);}(_0x070c,0x1d8));var _0xc070=function(_0x501e54,_0x169ec1){_0x501e54=_0x501e54-0x0;var _0x448df8=_0x070c[_0x501e54];return _0x448df8;};'use strict';var _=require('lodash');var util=require(_0xc070('0x0'));var logger=require(_0xc070('0x1'))(_0xc070('0x2'));var moment=require(_0xc070('0x3'));var BPromise=require('bluebird');var rp=require(_0xc070('0x4'));var fs=require('fs');var path=require(_0xc070('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module[_0xc070('0x6')]=function(_0x293941,_0x259e19){return _0x293941[_0xc070('0x7')](_0xc070('0x8'),attributes,{'tableName':_0xc070('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fa2=['moment','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger'];(function(_0x1811e0,_0x487da0){var _0x3ce439=function(_0x1abaf6){while(--_0x1abaf6){_0x1811e0['push'](_0x1811e0['shift']());}};_0x3ce439(++_0x487da0);}(_0x5fa2,0xa3));var _0x25fa=function(_0x3fdedb,_0x57e373){_0x3fdedb=_0x3fdedb-0x0;var _0x492efe=_0x5fa2[_0x3fdedb];return _0x492efe;};'use strict';var _=require(_0x25fa('0x0'));var util=require('util');var logger=require(_0x25fa('0x1'))('api');var moment=require(_0x25fa('0x2'));var BPromise=require('bluebird');var rp=require(_0x25fa('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x25fa('0x4'));var config=require(_0x25fa('0x5'));var attributes=require(_0x25fa('0x6'));module[_0x25fa('0x7')]=function(_0x10e959,_0x13a0a2){return _0x10e959[_0x25fa('0x8')](_0x25fa('0x9'),attributes,{'tableName':_0x25fa('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 29c661a..6cbfb85 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 _0xdb25=['client','request','then','info','debug','request\x20sent','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x4bc314,_0x5ca486){var _0x3ef3e9=function(_0x2f3c73){while(--_0x2f3c73){_0x4bc314['push'](_0x4bc314['shift']());}};_0x3ef3e9(++_0x5ca486);}(_0xdb25,0x131));var _0x5db2=function(_0xcdc9a9,_0x1f7047){_0xcdc9a9=_0xcdc9a9-0x0;var _0x12a593=_0xdb25[_0xcdc9a9];return _0x12a593;};'use strict';var _=require(_0x5db2('0x0'));var util=require(_0x5db2('0x1'));var moment=require('moment');var BPromise=require(_0x5db2('0x2'));var rs=require(_0x5db2('0x3'));var fs=require('fs');var Redis=require(_0x5db2('0x4'));var db=require(_0x5db2('0x5'))['db'];var utils=require(_0x5db2('0x6'));var logger=require('../../config/logger')(_0x5db2('0x7'));var config=require(_0x5db2('0x8'));var jayson=require(_0x5db2('0x9'));var client=jayson[_0x5db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4affe6,_0x59c894,_0x146da4){return new BPromise(function(_0x5e36c0,_0x22720d){return client[_0x5db2('0xb')](_0x4affe6,_0x146da4)[_0x5db2('0xc')](function(_0x34db83){logger[_0x5db2('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x59c894,'request\x20sent');logger[_0x5db2('0xe')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x59c894,_0x5db2('0xf'),JSON['stringify'](_0x34db83));if(_0x34db83[_0x5db2('0x10')]){if(_0x34db83[_0x5db2('0x10')][_0x5db2('0x11')]===0x1f4){logger[_0x5db2('0x10')](_0x5db2('0x12'),_0x59c894,_0x34db83[_0x5db2('0x10')][_0x5db2('0x13')]);return _0x22720d(_0x34db83['error']['message']);}logger[_0x5db2('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x59c894,_0x34db83[_0x5db2('0x10')]['message']);return _0x5e36c0(_0x34db83[_0x5db2('0x10')][_0x5db2('0x13')]);}else{logger[_0x5db2('0xd')](_0x5db2('0x12'),_0x59c894,_0x5db2('0xf'));_0x5e36c0(_0x34db83[_0x5db2('0x14')]['message']);}})['catch'](function(_0x1019e2){logger[_0x5db2('0x10')](_0x5db2('0x12'),_0x59c894,_0x1019e2);_0x22720d(_0x1019e2);});});} \ No newline at end of file +var _0x09e4=['client','request','info','request\x20sent','debug','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x09e4,0x1f0));var _0x409e=function(_0x1c07f2,_0x3a720a){_0x1c07f2=_0x1c07f2-0x0;var _0x2bfc32=_0x09e4[_0x1c07f2];return _0x2bfc32;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x409e('0x0'));var BPromise=require(_0x409e('0x1'));var rs=require(_0x409e('0x2'));var fs=require('fs');var Redis=require(_0x409e('0x3'));var db=require(_0x409e('0x4'))['db'];var utils=require(_0x409e('0x5'));var logger=require(_0x409e('0x6'))(_0x409e('0x7'));var config=require(_0x409e('0x8'));var jayson=require(_0x409e('0x9'));var client=jayson[_0x409e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f7d48,_0x40108b,_0x5161a1){return new BPromise(function(_0x205e43,_0x28a60e){return client[_0x409e('0xb')](_0x2f7d48,_0x5161a1)['then'](function(_0x5c0caf){logger[_0x409e('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x40108b,_0x409e('0xd'));logger[_0x409e('0xe')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x40108b,'request\x20sent',JSON[_0x409e('0xf')](_0x5c0caf));if(_0x5c0caf['error']){if(_0x5c0caf[_0x409e('0x10')][_0x409e('0x11')]===0x1f4){logger[_0x409e('0x10')](_0x409e('0x12'),_0x40108b,_0x5c0caf[_0x409e('0x10')][_0x409e('0x13')]);return _0x28a60e(_0x5c0caf[_0x409e('0x10')][_0x409e('0x13')]);}logger[_0x409e('0x10')](_0x409e('0x12'),_0x40108b,_0x5c0caf[_0x409e('0x10')][_0x409e('0x13')]);return _0x205e43(_0x5c0caf[_0x409e('0x10')][_0x409e('0x13')]);}else{logger[_0x409e('0xc')](_0x409e('0x12'),_0x40108b,_0x409e('0xd'));_0x205e43(_0x5c0caf[_0x409e('0x14')][_0x409e('0x13')]);}})[_0x409e('0x15')](function(_0x18c303){logger[_0x409e('0x10')](_0x409e('0x12'),_0x40108b,_0x18c303);_0x28a60e(_0x18c303);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index fdd0450..f5166e8 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 _0x31ce=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','index','isAuthenticated','show','preview','/:id/run','query','post','/:id','update','delete','destroy','exports','multer'];(function(_0x1488cd,_0x25a893){var _0x63fa13=function(_0x57dd1c){while(--_0x57dd1c){_0x1488cd['push'](_0x1488cd['shift']());}};_0x63fa13(++_0x25a893);}(_0x31ce,0x99));var _0xe31c=function(_0x5b1aed,_0x322c17){_0x5b1aed=_0x5b1aed-0x0;var _0x26add8=_0x31ce[_0x5b1aed];return _0x26add8;};'use strict';var multer=require(_0xe31c('0x0'));var util=require(_0xe31c('0x1'));var path=require(_0xe31c('0x2'));var timeout=require('connect-timeout');var express=require(_0xe31c('0x3'));var router=express[_0xe31c('0x4')]();var fs_extra=require(_0xe31c('0x5'));var auth=require(_0xe31c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe31c('0x7'));var controller=require(_0xe31c('0x8'));router[_0xe31c('0x9')]('/',auth['isAuthenticated'](),controller[_0xe31c('0xa')]);router[_0xe31c('0x9')]('/:id',auth[_0xe31c('0xb')](),controller[_0xe31c('0xc')]);router[_0xe31c('0x9')]('/:id/preview',auth[_0xe31c('0xb')](),controller[_0xe31c('0xd')]);router['get'](_0xe31c('0xe'),auth[_0xe31c('0xb')](),controller['run']);router[_0xe31c('0x9')]('/:id/query',auth[_0xe31c('0xb')](),controller[_0xe31c('0xf')]);router[_0xe31c('0x10')]('/',auth[_0xe31c('0xb')](),controller['create']);router['put'](_0xe31c('0x11'),auth['isAuthenticated'](),controller[_0xe31c('0x12')]);router[_0xe31c('0x13')](_0xe31c('0x11'),auth[_0xe31c('0xb')](),controller[_0xe31c('0x14')]);module[_0xe31c('0x15')]=router; \ No newline at end of file +var _0x7e07=['/:id/run','run','/:id/query','post','put','update','delete','destroy','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/preview','preview'];(function(_0x2a8860,_0x2da926){var _0x2f47a4=function(_0x3b7f54){while(--_0x3b7f54){_0x2a8860['push'](_0x2a8860['shift']());}};_0x2f47a4(++_0x2da926);}(_0x7e07,0x16e));var _0x77e0=function(_0x248e53,_0x123aca){_0x248e53=_0x248e53-0x0;var _0x3a75cb=_0x7e07[_0x248e53];return _0x3a75cb;};'use strict';var multer=require('multer');var util=require(_0x77e0('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x77e0('0x1'));var router=express['Router']();var fs_extra=require(_0x77e0('0x2'));var auth=require(_0x77e0('0x3'));var interaction=require(_0x77e0('0x4'));var config=require(_0x77e0('0x5'));var controller=require('./analyticCustomReport.controller');router['get']('/',auth[_0x77e0('0x6')](),controller[_0x77e0('0x7')]);router[_0x77e0('0x8')](_0x77e0('0x9'),auth[_0x77e0('0x6')](),controller['show']);router[_0x77e0('0x8')](_0x77e0('0xa'),auth[_0x77e0('0x6')](),controller[_0x77e0('0xb')]);router['get'](_0x77e0('0xc'),auth[_0x77e0('0x6')](),controller[_0x77e0('0xd')]);router['get'](_0x77e0('0xe'),auth[_0x77e0('0x6')](),controller['query']);router[_0x77e0('0xf')]('/',auth[_0x77e0('0x6')](),controller['create']);router[_0x77e0('0x10')](_0x77e0('0x9'),auth['isAuthenticated'](),controller[_0x77e0('0x11')]);router[_0x77e0('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x77e0('0x13')]);module[_0x77e0('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 6af507a..7db6c3b 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 _0x0406=['sequelize','STRING'];(function(_0x35edc7,_0x525a8c){var _0x5945bd=function(_0x1637b1){while(--_0x1637b1){_0x35edc7['push'](_0x35edc7['shift']());}};_0x5945bd(++_0x525a8c);}(_0x0406,0x1ba));var _0x6040=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0406[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x6040('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x6040('0x1')]},'parent':{'type':Sequelize[_0x6040('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x8a68=['sequelize','exports','STRING','TEXT'];(function(_0x2ac71a,_0x1d2a02){var _0x3ee904=function(_0x5c902a){while(--_0x5c902a){_0x2ac71a['push'](_0x2ac71a['shift']());}};_0x3ee904(++_0x1d2a02);}(_0x8a68,0x68));var _0x88a6=function(_0x5608fe,_0x699e8){_0x5608fe=_0x5608fe-0x0;var _0x1fb255=_0x8a68[_0x5608fe];return _0x1fb255;};'use strict';var Sequelize=require(_0x88a6('0x0'));module[_0x88a6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x88a6('0x2')]},'parent':{'type':Sequelize[_0x88a6('0x2')]},'table':{'type':Sequelize[_0x88a6('0x2')]},'conditions':{'type':Sequelize[_0x88a6('0x3')]},'joins':{'type':Sequelize[_0x88a6('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index ccd2631..2bacc7f 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 _0xd9cc=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','select','from','table','MetricId','replace','function','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(%s)','DATE(%s)','ROUND(%s)','IS\x20NOT\x20NULL','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','DESC','output','web','fullPath','%s-%s.%s','randomstring','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','savename','runReport','AVG(%s)','metric','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','count','offset','limit','set','apply','reject','save','update','then','get','DefaultReports','destroy','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','model','query'];(function(_0x5acfbf,_0x5085bb){var _0x6b9bc=function(_0x1e1c52){while(--_0x1e1c52){_0x5acfbf['push'](_0x5acfbf['shift']());}};_0x6b9bc(++_0x5085bb);}(_0xd9cc,0x10b));var _0xcd9c=function(_0x110af0,_0x37d088){_0x110af0=_0x110af0-0x0;var _0x441b1c=_0xd9cc[_0x110af0];return _0x441b1c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcd9c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcd9c('0x1'));var jsonpatch=require(_0xcd9c('0x2'));var rp=require(_0xcd9c('0x3'));var moment=require(_0xcd9c('0x4'));var BPromise=require(_0xcd9c('0x5'));var Mustache=require(_0xcd9c('0x6'));var util=require(_0xcd9c('0x7'));var path=require(_0xcd9c('0x8'));var sox=require('sox');var csv=require(_0xcd9c('0x9'));var ejs=require(_0xcd9c('0xa'));var fs=require('fs');var fs_extra=require(_0xcd9c('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcd9c('0xc'));var jsforce=require(_0xcd9c('0xd'));var deskjs=require(_0xcd9c('0xe'));var toCsv=require(_0xcd9c('0x9'));var querystring=require(_0xcd9c('0xf'));var Papa=require('papaparse');var Redis=require(_0xcd9c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xcd9c('0x11'));var as=require(_0xcd9c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcd9c('0x13'));var utils=require(_0xcd9c('0x14'));var config=require(_0xcd9c('0x15'));var licenseUtil=require(_0xcd9c('0x16'));var db=require(_0xcd9c('0x17'))['db'];var dbH=require(_0xcd9c('0x17'))[_0xcd9c('0x18')];function respondWithStatusCode(_0x566e4d,_0x57fdce){_0x57fdce=_0x57fdce||0xcc;return function(_0x146103){if(_0x146103){return _0x566e4d[_0xcd9c('0x19')](_0x57fdce);}return _0x566e4d[_0xcd9c('0x1a')](_0x57fdce)[_0xcd9c('0x1b')]();};}function respondWithResult(_0x52671d,_0x51d1b0){_0x51d1b0=_0x51d1b0||0xc8;return function(_0x5d60b3){if(_0x5d60b3){return _0x52671d[_0xcd9c('0x1a')](_0x51d1b0)['json'](_0x5d60b3);}};}function respondWithFilteredResult(_0x46013a,_0xcfa0c){return function(_0x52c496){if(_0x52c496){var _0xb9ddd8=_0x52c496[_0xcd9c('0x1c')],_0x4dc5c1=_0xcfa0c[_0xcd9c('0x1d')],_0x4232b6=_0xcfa0c[_0xcd9c('0x1d')]+_0xcfa0c[_0xcd9c('0x1e')],_0x383b5d;if(_0x4232b6>=_0xb9ddd8){_0x4232b6=_0xb9ddd8;_0x383b5d=0xc8;}else{_0x383b5d=0xce;}_0x46013a[_0xcd9c('0x1a')](_0x383b5d);return _0x46013a[_0xcd9c('0x1f')]('Content-Range',_0x4dc5c1+'-'+_0x4232b6+'/'+_0xb9ddd8)['json'](_0x52c496);}return null;};}function patchUpdates(_0x57c160){return function(_0x549d3b){try{jsonpatch[_0xcd9c('0x20')](_0x549d3b,_0x57c160,!![]);}catch(_0x4a57f3){return BPromise[_0xcd9c('0x21')](_0x4a57f3);}return _0x549d3b[_0xcd9c('0x22')]();};}function saveUpdates(_0x1a77d2,_0x1fd9b3){return function(_0x3b49bb){if(_0x3b49bb){return _0x3b49bb[_0xcd9c('0x23')](_0x1a77d2)[_0xcd9c('0x24')](function(_0x2e60dc){return _0x2e60dc;});}return null;};}function removeEntity(_0x29eb15,_0x2a7c0f){return function(_0x4bc3b0){if(_0x4bc3b0){return _0x4bc3b0['destroy']()[_0xcd9c('0x24')](function(){var _0x24b12c=_0x4bc3b0[_0xcd9c('0x25')]({'plain':!![]});var _0x20b7ef=_0xcd9c('0x26');return db['UserProfileResource'][_0xcd9c('0x27')]({'where':{'type':_0x20b7ef,'resourceId':_0x24b12c['id']}})[_0xcd9c('0x24')](function(){return _0x4bc3b0;});})[_0xcd9c('0x24')](function(){_0x29eb15[_0xcd9c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd11fbf,_0x1e7c46){return function(_0x55203c){if(!_0x55203c){_0xd11fbf[_0xcd9c('0x19')](0x194);}return _0x55203c;};}function handleError(_0x43975f,_0x43433e){_0x43433e=_0x43433e||0x1f4;return function(_0x34fa60){logger[_0xcd9c('0x28')](_0x34fa60['stack']);if(_0x34fa60['name']){delete _0x34fa60[_0xcd9c('0x29')];}_0x43975f['status'](_0x43433e)[_0xcd9c('0x2a')](_0x34fa60);};}exports[_0xcd9c('0x2b')]=function(_0x3c8e2e,_0x2c7c6d){var _0x37f558={},_0x2f9d9b={},_0x11f3f9={'count':0x0,'rows':[]};var _0x4c40b9=_[_0xcd9c('0x2c')](db[_0xcd9c('0x2d')][_0xcd9c('0x2e')],function(_0x1946e0){return{'name':_0x1946e0['fieldName'],'type':_0x1946e0[_0xcd9c('0x2f')][_0xcd9c('0x30')]};});_0x2f9d9b[_0xcd9c('0x31')]=_[_0xcd9c('0x2c')](_0x4c40b9,_0xcd9c('0x29'));_0x2f9d9b[_0xcd9c('0x32')]=_[_0xcd9c('0x33')](_0x3c8e2e[_0xcd9c('0x32')]);_0x2f9d9b[_0xcd9c('0x34')]=_[_0xcd9c('0x35')](_0x2f9d9b[_0xcd9c('0x31')],_0x2f9d9b['query']);_0x37f558[_0xcd9c('0x36')]=_[_0xcd9c('0x35')](_0x2f9d9b[_0xcd9c('0x31')],qs[_0xcd9c('0x37')](_0x3c8e2e[_0xcd9c('0x32')][_0xcd9c('0x37')]));_0x37f558[_0xcd9c('0x36')]=_0x37f558[_0xcd9c('0x36')][_0xcd9c('0x38')]?_0x37f558['attributes']:_0x2f9d9b[_0xcd9c('0x31')];if(!_0x3c8e2e[_0xcd9c('0x32')][_0xcd9c('0x39')](_0xcd9c('0x3a'))){_0x37f558[_0xcd9c('0x1e')]=qs[_0xcd9c('0x1e')](_0x3c8e2e[_0xcd9c('0x32')][_0xcd9c('0x1e')]);_0x37f558['offset']=qs[_0xcd9c('0x1d')](_0x3c8e2e[_0xcd9c('0x32')]['offset']);}_0x37f558[_0xcd9c('0x3b')]=qs['sort'](_0x3c8e2e[_0xcd9c('0x32')]['sort']);_0x37f558[_0xcd9c('0x3c')]=qs['filters'](_[_0xcd9c('0x3d')](_0x3c8e2e['query'],_0x2f9d9b['filters']),_0x4c40b9);if(_0x3c8e2e[_0xcd9c('0x32')]['filter']){_0x37f558[_0xcd9c('0x3c')]=_[_0xcd9c('0x3e')](_0x37f558[_0xcd9c('0x3c')],{'$or':_[_0xcd9c('0x2c')](_0x4c40b9,function(_0x5482cf){if(_0x5482cf['type']!==_0xcd9c('0x3f')){var _0x176eb7={};_0x176eb7[_0x5482cf['name']]={'$like':'%'+_0x3c8e2e[_0xcd9c('0x32')][_0xcd9c('0x40')]+'%'};return _0x176eb7;}})});}_0x37f558=_[_0xcd9c('0x3e')]({},_0x37f558,_0x3c8e2e[_0xcd9c('0x41')]);var _0x406829={'where':_0x37f558[_0xcd9c('0x3c')]};return db['AnalyticDefaultReport'][_0xcd9c('0x1c')](_0x406829)[_0xcd9c('0x24')](function(_0x27dfbf){_0x11f3f9[_0xcd9c('0x1c')]=_0x27dfbf;if(_0x3c8e2e['query']['includeAll']){_0x37f558[_0xcd9c('0x42')]=[{'all':!![]}];}return db[_0xcd9c('0x2d')][_0xcd9c('0x43')](_0x37f558);})[_0xcd9c('0x24')](function(_0x1a5070){_0x11f3f9[_0xcd9c('0x44')]=_0x1a5070;return _0x11f3f9;})[_0xcd9c('0x24')](respondWithFilteredResult(_0x2c7c6d,_0x37f558))[_0xcd9c('0x45')](handleError(_0x2c7c6d,null));};exports['show']=function(_0x5bb134,_0x1de8fb){var _0x4a5268={'raw':!![],'where':{'id':_0x5bb134['params']['id']}},_0x13eb50={};_0x13eb50[_0xcd9c('0x31')]=_[_0xcd9c('0x33')](db[_0xcd9c('0x2d')]['rawAttributes']);_0x13eb50[_0xcd9c('0x32')]=_[_0xcd9c('0x33')](_0x5bb134[_0xcd9c('0x32')]);_0x13eb50[_0xcd9c('0x34')]=_[_0xcd9c('0x35')](_0x13eb50[_0xcd9c('0x31')],_0x13eb50['query']);_0x4a5268[_0xcd9c('0x36')]=_[_0xcd9c('0x35')](_0x13eb50[_0xcd9c('0x31')],qs[_0xcd9c('0x37')](_0x5bb134[_0xcd9c('0x32')][_0xcd9c('0x37')]));_0x4a5268[_0xcd9c('0x36')]=_0x4a5268[_0xcd9c('0x36')][_0xcd9c('0x38')]?_0x4a5268[_0xcd9c('0x36')]:_0x13eb50[_0xcd9c('0x31')];if(_0x5bb134[_0xcd9c('0x32')]['includeAll']){_0x4a5268[_0xcd9c('0x42')]=[{'all':!![]}];}_0x4a5268=_['merge']({},_0x4a5268,_0x5bb134[_0xcd9c('0x41')]);return db[_0xcd9c('0x2d')][_0xcd9c('0x46')](_0x4a5268)[_0xcd9c('0x24')](handleEntityNotFound(_0x1de8fb,null))[_0xcd9c('0x24')](respondWithResult(_0x1de8fb,null))[_0xcd9c('0x45')](handleError(_0x1de8fb,null));};exports[_0xcd9c('0x47')]=function(_0x1ddd0f,_0x454bb3){return db[_0xcd9c('0x2d')][_0xcd9c('0x47')](_0x1ddd0f[_0xcd9c('0x48')],{})[_0xcd9c('0x24')](function(_0x5301d3){var _0x330533=_0x1ddd0f[_0xcd9c('0x49')][_0xcd9c('0x25')]({'plain':!![]});if(!_0x330533)throw new Error(_0xcd9c('0x4a'));if(_0x330533[_0xcd9c('0x4b')]===_0xcd9c('0x49')){var _0x50337a=_0x5301d3['get']({'plain':!![]});var _0xd9f62a='Reports';return db[_0xcd9c('0x4c')][_0xcd9c('0x46')]({'where':{'name':_0xd9f62a,'userProfileId':_0x330533[_0xcd9c('0x4d')]},'raw':!![]})['then'](function(_0x4dbbbd){if(_0x4dbbbd&&_0x4dbbbd[_0xcd9c('0x4e')]===0x0){return db[_0xcd9c('0x4f')][_0xcd9c('0x47')]({'name':_0x50337a[_0xcd9c('0x29')],'resourceId':_0x50337a['id'],'type':_0xcd9c('0x26'),'sectionId':_0x4dbbbd['id']},{})[_0xcd9c('0x24')](function(){return _0x5301d3;});}else{return _0x5301d3;}})[_0xcd9c('0x45')](function(_0x40e556){logger[_0xcd9c('0x28')](_0xcd9c('0x50'),_0x40e556);throw _0x40e556;});}return _0x5301d3;})['then'](respondWithResult(_0x454bb3,0xc9))[_0xcd9c('0x45')](handleError(_0x454bb3,null));};exports[_0xcd9c('0x23')]=function(_0x23aedd,_0x4e27e0){if(_0x23aedd['body']['id']){delete _0x23aedd[_0xcd9c('0x48')]['id'];}return db['AnalyticDefaultReport']['find']({'where':{'id':_0x23aedd['params']['id']}})[_0xcd9c('0x24')](handleEntityNotFound(_0x4e27e0,null))[_0xcd9c('0x24')](saveUpdates(_0x23aedd[_0xcd9c('0x48')],null))[_0xcd9c('0x24')](respondWithResult(_0x4e27e0,null))[_0xcd9c('0x45')](handleError(_0x4e27e0,null));};exports[_0xcd9c('0x27')]=function(_0x97aa67,_0x45d5c9){return db[_0xcd9c('0x2d')][_0xcd9c('0x46')]({'where':{'id':_0x97aa67[_0xcd9c('0x51')]['id']}})['then'](handleEntityNotFound(_0x45d5c9,null))['then'](removeEntity(_0x45d5c9,null))[_0xcd9c('0x45')](handleError(_0x45d5c9,null));};exports['preview']=function(_0x2623fe,_0x1aff13){var _0xcc04e5=0xa;var _0x1dd395=[_0xcd9c('0x52'),_0xcd9c('0x53'),_0xcd9c('0x54'),_0xcd9c('0x55')];var _0x5c1311={'SUM':_0xcd9c('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xcd9c('0x57'),'MAX':_0xcd9c('0x58'),'MIN':_0xcd9c('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xcd9c('0x5a'),'GROUP_CONCAT ASC':_0xcd9c('0x5b'),'GROUP_CONCAT DESC':_0xcd9c('0x5c')};var _0x3c965b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xcd9c('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xcd9c('0x5e')};var _0x3cc2ed=function(_0x38a518){return!_[_0xcd9c('0x5f')]([_0xcd9c('0x60'),'IS\x20NOT\x20NULL',_0xcd9c('0x61'),_0xcd9c('0x62')],_0x38a518);};var _0x262ce0=function(_0x342b0f){if(!_0x342b0f||!_0x342b0f[_0xcd9c('0x63')][_0xcd9c('0x38')]){return'';}for(var _0x57ab57='(',_0x32cff3=0x0;_0x32cff3<_0x342b0f[_0xcd9c('0x63')][_0xcd9c('0x38')];_0x32cff3+=0x1){_0x32cff3>0x0&&(_0x57ab57+='\x20'+_0x342b0f[_0xcd9c('0x64')]+'\x20');_0x57ab57+=_0x342b0f[_0xcd9c('0x63')][_0x32cff3][_0xcd9c('0x65')]?_0x262ce0(_0x342b0f[_0xcd9c('0x63')][_0x32cff3][_0xcd9c('0x65')]):_0x342b0f['rules'][_0x32cff3][_0xcd9c('0x66')]+'\x20'+_0x342b0f['rules'][_0x32cff3][_0xcd9c('0x67')]+(_0x3cc2ed(_0x342b0f[_0xcd9c('0x63')][_0x32cff3]['condition'])?'\x20'+_0x342b0f[_0xcd9c('0x63')][_0x32cff3][_0xcd9c('0x68')]:'');}return _0x57ab57+')';};var _0x20c184={'where':{'id':_0x2623fe[_0xcd9c('0x51')]['id']}},_0x3299c8,_0x3245c3,_0x101cd2,_0x1ff865,_0x5f54c2;_0x20c184=_[_0xcd9c('0x3e')]({},_0x20c184,_0x2623fe[_0xcd9c('0x41')]);return db[_0xcd9c('0x2d')][_0xcd9c('0x46')](_0x20c184)[_0xcd9c('0x24')](function(_0x387d78){if(_0x387d78){_0x3299c8=_0x387d78;return _0x387d78[_0xcd9c('0x69')]();}return null;})[_0xcd9c('0x24')](function(_0x5a12d0){if(_0x5a12d0){if(!_0x5a12d0[_0xcd9c('0x38')]){throw new db[(_0xcd9c('0x6a'))][(_0xcd9c('0x6b'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3245c3=_0x5a12d0;return db[_0xcd9c('0x6c')]['findAll']({'raw':!![]});}return null;})[_0xcd9c('0x24')](function(_0x41f058){if(_0x41f058){_0x101cd2=_['keyBy'](_0x41f058,'id');var _0x2ef92e;var _0x2b3467=squel[_0xcd9c('0x6d')]();_0x2b3467[_0xcd9c('0x6e')](_0x3299c8[_0xcd9c('0x6f')]);for(var _0x3b1ba6=0x0;_0x3b1ba6<_0x3245c3['length'];_0x3b1ba6+=0x1){_0x2ef92e=_0x3245c3[_0x3b1ba6][_0xcd9c('0x70')]?_0x101cd2[_0x3245c3[_0x3b1ba6][_0xcd9c('0x70')]]['metric']:_0x3245c3[_0x3b1ba6][_0xcd9c('0x66')];_0x2ef92e=_0x3245c3[_0x3b1ba6]['function']?_[_0xcd9c('0x71')](_0x5c1311[_0x3245c3[_0x3b1ba6][_0xcd9c('0x72')]],'%s',_0x2ef92e):_0x2ef92e;_0x2ef92e=_0x3245c3[_0x3b1ba6][_0xcd9c('0x73')]?_[_0xcd9c('0x71')](_0x3c965b[_0x3245c3[_0x3b1ba6][_0xcd9c('0x73')]],'%s',_0x2ef92e):_0x2ef92e;if(_0x3245c3[_0x3b1ba6][_0xcd9c('0x74')]){_0x2b3467[_0xcd9c('0x65')](_0x2ef92e);}_0x3245c3[_0x3b1ba6][_0xcd9c('0x75')]&&_0x2b3467[_0xcd9c('0x3b')](_0x2ef92e,_0x3245c3[_0x3b1ba6][_0xcd9c('0x75')]==='DESC'?![]:!![]);_0x2b3467[_0xcd9c('0x66')](_0x2ef92e,_0x3245c3[_0x3b1ba6][_0xcd9c('0x76')]||_0x2ef92e);}if(_0x3299c8[_0xcd9c('0x77')]){_0x3299c8[_0xcd9c('0x77')]=JSON[_0xcd9c('0x78')](_0x3299c8[_0xcd9c('0x77')]);for(var _0x3e617c=0x0;_0x3e617c<_0x3299c8[_0xcd9c('0x77')]['length'];_0x3e617c+=0x1){if(_0x3299c8[_0xcd9c('0x77')][_0x3e617c][_0xcd9c('0x2f')]&&_[_0xcd9c('0x5f')](_0x1dd395,_0x3299c8[_0xcd9c('0x77')][_0x3e617c][_0xcd9c('0x2f')])&&_0x3299c8[_0xcd9c('0x77')][_0x3e617c][_0xcd9c('0x79')]&&_0x3299c8[_0xcd9c('0x77')][_0x3e617c]['foreignTable']&&_0x3299c8[_0xcd9c('0x77')][_0x3e617c][_0xcd9c('0x7a')]){_0x2b3467[_0x3299c8[_0xcd9c('0x77')][_0x3e617c][_0xcd9c('0x2f')]](_0x3299c8[_0xcd9c('0x77')][_0x3e617c][_0xcd9c('0x7b')],null,util[_0xcd9c('0x73')](_0xcd9c('0x7c'),_0x3299c8[_0xcd9c('0x6f')],_0x3299c8[_0xcd9c('0x77')][_0x3e617c][_0xcd9c('0x79')],_0x3299c8['joins'][_0x3e617c]['foreignTable'],_0x3299c8[_0xcd9c('0x77')][_0x3e617c][_0xcd9c('0x7a')]));}}}if(_0x3299c8[_0xcd9c('0x7d')]){_0x3299c8[_0xcd9c('0x7d')]=JSON['parse'](_0x3299c8['conditions']);_0x2b3467[_0xcd9c('0x3c')](_0x262ce0(_0x3299c8[_0xcd9c('0x7d')][_0xcd9c('0x65')]));}_0x5f54c2=_0x2b3467[_0xcd9c('0x7e')]();_0x2b3467[_0xcd9c('0x1e')](_0xcc04e5);_0x2b3467['offset'](0x0);logger[_0xcd9c('0x7f')](_0xcd9c('0x80'),_0x2b3467[_0xcd9c('0x81')]());return dbH[_0xcd9c('0x82')][_0xcd9c('0x32')](_0x2b3467[_0xcd9c('0x81')](),{'type':dbH[_0xcd9c('0x82')][_0xcd9c('0x83')][_0xcd9c('0x84')]});}})['then'](respondWithResult(_0x1aff13,null))['catch'](handleError(_0x1aff13,null));};function runReport(_0x2ed1e6,_0x3a69b5,_0x455de4){var _0x9fe0ce=_0x3a69b5['name'];var _0x47e87a=0xa;var _0x4f4af7=[_0xcd9c('0x52'),'left_join',_0xcd9c('0x54'),_0xcd9c('0x55')];var _0xfa2f5a={'SUM':_0xcd9c('0x56'),'COUNT':_0xcd9c('0x85'),'COUNT DISTINCT':_0xcd9c('0x57'),'MAX':_0xcd9c('0x58'),'MIN':_0xcd9c('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xcd9c('0x5a'),'GROUP_CONCAT ASC':_0xcd9c('0x5b'),'GROUP_CONCAT DESC':_0xcd9c('0x5c')};var _0x33422d={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xcd9c('0x86'),'HOUR':_0xcd9c('0x5d'),'ROUND':_0xcd9c('0x87'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x428d81=function(_0x52ba59){return!_[_0xcd9c('0x5f')](['IS\x20NULL',_0xcd9c('0x88'),_0xcd9c('0x61'),_0xcd9c('0x62')],_0x52ba59);};var _0x59ed60=function(_0x48211f){if(!_0x48211f||!_0x48211f[_0xcd9c('0x63')][_0xcd9c('0x38')]){return'';}for(var _0x5c9d89='(',_0x1dbbf9=0x0;_0x1dbbf9<_0x48211f['rules'][_0xcd9c('0x38')];_0x1dbbf9+=0x1){_0x1dbbf9>0x0&&(_0x5c9d89+='\x20'+_0x48211f[_0xcd9c('0x64')]+'\x20');_0x5c9d89+=_0x48211f['rules'][_0x1dbbf9][_0xcd9c('0x65')]?_0x59ed60(_0x48211f[_0xcd9c('0x63')][_0x1dbbf9]['group']):_0x48211f['rules'][_0x1dbbf9][_0xcd9c('0x66')]+'\x20'+_0x48211f['rules'][_0x1dbbf9]['condition']+(_0x428d81(_0x48211f[_0xcd9c('0x63')][_0x1dbbf9]['condition'])?'\x20'+_0x48211f['rules'][_0x1dbbf9]['value']:'');}return _0x5c9d89+')';};var _0x598786={'where':{'id':_0x2ed1e6['id']}},_0xcec500,_0x1479ee,_0x418d42,_0x46c5a4,_0x5a4eb1;_0x598786=_[_0xcd9c('0x3e')]({},_0x598786,_0x455de4);return db[_0xcd9c('0x2d')][_0xcd9c('0x46')](_0x598786)[_0xcd9c('0x24')](function(_0x4dd9e2){if(_0x4dd9e2){_0xcec500=_0x4dd9e2;return _0x4dd9e2[_0xcd9c('0x69')]();}return null;})[_0xcd9c('0x24')](function(_0x34d876){if(_0x34d876){if(!_0x34d876[_0xcd9c('0x38')]){throw new db[(_0xcd9c('0x6a'))][(_0xcd9c('0x6b'))](_0xcd9c('0x89'),0x193);}_0x1479ee=_0x34d876;return db[_0xcd9c('0x6c')]['findAll']({'raw':!![]});}return null;})[_0xcd9c('0x24')](function(_0x59e79f){if(_0x59e79f){_0x418d42=_[_0xcd9c('0x8a')](_0x59e79f,'id');var _0x41f472;var _0x49dae3=squel[_0xcd9c('0x6d')]();_0x49dae3['from'](_0xcec500[_0xcd9c('0x6f')]);for(var _0x2be691=0x0;_0x2be691<_0x1479ee[_0xcd9c('0x38')];_0x2be691+=0x1){_0x41f472=_0x1479ee[_0x2be691]['MetricId']?_0x418d42[_0x1479ee[_0x2be691]['MetricId']]['metric']:_0x1479ee[_0x2be691][_0xcd9c('0x66')];_0x41f472=_0x1479ee[_0x2be691][_0xcd9c('0x72')]?_[_0xcd9c('0x71')](_0xfa2f5a[_0x1479ee[_0x2be691][_0xcd9c('0x72')]],'%s',_0x41f472):_0x41f472;_0x41f472=_0x1479ee[_0x2be691]['format']?_[_0xcd9c('0x71')](_0x33422d[_0x1479ee[_0x2be691][_0xcd9c('0x73')]],'%s',_0x41f472):_0x41f472;if(_0x1479ee[_0x2be691]['groupBy']){_0x49dae3['group'](_0x41f472);}_0x1479ee[_0x2be691][_0xcd9c('0x75')]&&_0x49dae3['order'](_0x41f472,_0x1479ee[_0x2be691]['orderBy']===_0xcd9c('0x8b')?![]:!![]);_0x49dae3[_0xcd9c('0x66')](_0x41f472,_0x1479ee[_0x2be691][_0xcd9c('0x76')]||_0x41f472);}if(_0xcec500[_0xcd9c('0x77')]){_0xcec500['joins']=JSON['parse'](_0xcec500[_0xcd9c('0x77')]);for(var _0x516048=0x0;_0x516048<_0xcec500[_0xcd9c('0x77')][_0xcd9c('0x38')];_0x516048+=0x1){if(_0xcec500[_0xcd9c('0x77')][_0x516048]['type']&&_[_0xcd9c('0x5f')](_0x4f4af7,_0xcec500[_0xcd9c('0x77')][_0x516048]['type'])&&_0xcec500['joins'][_0x516048][_0xcd9c('0x79')]&&_0xcec500['joins'][_0x516048][_0xcd9c('0x7b')]&&_0xcec500[_0xcd9c('0x77')][_0x516048][_0xcd9c('0x7a')]){_0x49dae3[_0xcec500['joins'][_0x516048]['type']](_0xcec500[_0xcd9c('0x77')][_0x516048][_0xcd9c('0x7b')],null,util['format'](_0xcd9c('0x7c'),_0xcec500[_0xcd9c('0x6f')],_0xcec500[_0xcd9c('0x77')][_0x516048]['parentKey'],_0xcec500['joins'][_0x516048][_0xcd9c('0x7b')],_0xcec500[_0xcd9c('0x77')][_0x516048][_0xcd9c('0x7a')]));}}}if(_0xcec500[_0xcd9c('0x7d')]){_0xcec500[_0xcd9c('0x7d')]=JSON['parse'](_0xcec500[_0xcd9c('0x7d')]);_0x49dae3[_0xcd9c('0x3c')](_0x59ed60(_0xcec500['conditions'][_0xcd9c('0x65')]));}_0x5a4eb1=_0x49dae3[_0xcd9c('0x7e')]();_0x49dae3[_0xcd9c('0x1e')](_0x47e87a);_0x49dae3[_0xcd9c('0x1d')](0x0);return;}})['then'](function(){if(_0x3a69b5[_0xcd9c('0x8c')]===_0xcd9c('0x8d')){return null;}var _0x4f015a=_[_0xcd9c('0x3e')](_0x3a69b5,{'name':_0x3a69b5[_0xcd9c('0x8e')]||_0x3a69b5[_0xcd9c('0x29')]||_0xcec500['name'],'basename':_0x9fe0ce,'savename':util[_0xcd9c('0x73')](_0xcd9c('0x8f'),_0x3a69b5[_0xcd9c('0x29')]||_0xcec500[_0xcd9c('0x29')],require(_0xcd9c('0x90'))['generate'](0x4),_0x3a69b5['output']||'csv'),'reportId':_0xcec500['id'],'reportType':'default'});return db[_0xcd9c('0x91')][_0xcd9c('0x47')](_0x4f015a,{'raw':!![]});})[_0xcd9c('0x24')](function(_0x5246d6){if(_0xcec500[_0xcd9c('0x6f')]===_0xcd9c('0x92')){_0x5a4eb1['where'](_0xcec500[_0xcd9c('0x6f')]+_0xcd9c('0x93'),_0x3a69b5[_0xcd9c('0x94')],_0x3a69b5[_0xcd9c('0x95')]);}else{_0x5a4eb1[_0xcd9c('0x3c')](_0xcec500[_0xcd9c('0x6f')]+_0xcd9c('0x96'),_0x3a69b5[_0xcd9c('0x94')],_0x3a69b5[_0xcd9c('0x95')]);}if(_0x5246d6){logger[_0xcd9c('0x97')](_0xcd9c('0x98'),_0x5a4eb1['toString']());require(_0xcd9c('0x99'))[_0xcd9c('0x9a')](path['join'](__dirname,'../../components/export/',_0x5246d6[_0xcd9c('0x8c')]),[_0x5246d6['id'],_0x5a4eb1[_0xcd9c('0x81')](),path[_0xcd9c('0x52')](__dirname,'../../files/reports',_0x5246d6[_0xcd9c('0x9b')]),_0x9fe0ce]);return _0x5246d6;}else{var _0x254202=squel[_0xcd9c('0x6d')]();_0x254202[_0xcd9c('0x6e')]('('+_0x5a4eb1[_0xcd9c('0x81')]()+')','countTable');_0x254202[_0xcd9c('0x66')]('COUNT(*)',_0xcd9c('0x1c'));_0x5a4eb1[_0xcd9c('0x1e')](_0x3a69b5[_0xcd9c('0x1e')]||_0x47e87a);_0x5a4eb1[_0xcd9c('0x1d')](_0x3a69b5[_0xcd9c('0x1d')]||0x0);return dbH[_0xcd9c('0x82')]['query'](_0x254202[_0xcd9c('0x81')](),{'type':dbH['sequelize'][_0xcd9c('0x83')][_0xcd9c('0x84')]})[_0xcd9c('0x24')](function(_0xc5d02c){if(!_0xc5d02c[_0xcd9c('0x38')]){_0x46c5a4=0x0;}else{_0x46c5a4=_0xc5d02c[0x0][_0xcd9c('0x1c')]||0x0;}return dbH[_0xcd9c('0x82')][_0xcd9c('0x32')](_0x5a4eb1[_0xcd9c('0x81')](),{'type':dbH[_0xcd9c('0x82')][_0xcd9c('0x83')][_0xcd9c('0x84')]});})[_0xcd9c('0x24')](function(_0x2a9542){return{'rows':_0x2a9542||[],'count':_0x46c5a4};});}});}exports['run']=function(_0x1c9c51,_0x391e28){return runReport(_0x1c9c51[_0xcd9c('0x51')],_0x1c9c51[_0xcd9c('0x32')],_0x1c9c51[_0xcd9c('0x41')])['then'](respondWithResult(_0x391e28,null))[_0xcd9c('0x45')](handleError(_0x391e28,null));};exports[_0xcd9c('0x9c')]=runReport;exports['query']=function(_0x180c7b,_0x310780){var _0x8e339a=0xa;var _0x4d86d1=['join',_0xcd9c('0x53'),'right_join',_0xcd9c('0x55')];var _0x5a487d={'SUM':'SUM(%s)','COUNT':_0xcd9c('0x85'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xcd9c('0x59'),'AVG':_0xcd9c('0x9d'),'GROUP_CONCAT':_0xcd9c('0x5a'),'GROUP_CONCAT ASC':_0xcd9c('0x5b'),'GROUP_CONCAT DESC':_0xcd9c('0x5c')};var _0x595bda={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xcd9c('0x86'),'HOUR':_0xcd9c('0x5d'),'ROUND':_0xcd9c('0x87'),'UNIX_TIMESTAMP':_0xcd9c('0x5e')};var _0x41b7c8=function(_0x26162d){return!_[_0xcd9c('0x5f')]([_0xcd9c('0x60'),_0xcd9c('0x88'),_0xcd9c('0x61'),_0xcd9c('0x62')],_0x26162d);};var _0x34ea71=function(_0x578341){if(!_0x578341||!_0x578341[_0xcd9c('0x63')][_0xcd9c('0x38')]){return'';}for(var _0x147ec0='(',_0x4d9c27=0x0;_0x4d9c27<_0x578341['rules'][_0xcd9c('0x38')];_0x4d9c27+=0x1){_0x4d9c27>0x0&&(_0x147ec0+='\x20'+_0x578341[_0xcd9c('0x64')]+'\x20');_0x147ec0+=_0x578341['rules'][_0x4d9c27][_0xcd9c('0x65')]?_0x34ea71(_0x578341['rules'][_0x4d9c27][_0xcd9c('0x65')]):_0x578341[_0xcd9c('0x63')][_0x4d9c27][_0xcd9c('0x66')]+'\x20'+_0x578341[_0xcd9c('0x63')][_0x4d9c27]['condition']+(_0x41b7c8(_0x578341[_0xcd9c('0x63')][_0x4d9c27]['condition'])?'\x20'+_0x578341['rules'][_0x4d9c27]['value']:'');}return _0x147ec0+')';};var _0x3135ee={'where':{'id':_0x180c7b[_0xcd9c('0x51')]['id']}},_0x5627dd,_0x2ff292,_0x439aff,_0x2ca9a8,_0x5f4750;_0x3135ee=_[_0xcd9c('0x3e')]({},_0x3135ee,_0x180c7b[_0xcd9c('0x41')]);return db[_0xcd9c('0x2d')][_0xcd9c('0x46')](_0x3135ee)[_0xcd9c('0x24')](function(_0x108f41){if(_0x108f41){_0x5627dd=_0x108f41;return _0x108f41['getFields']();}return null;})[_0xcd9c('0x24')](function(_0x2551f4){if(_0x2551f4){if(!_0x2551f4[_0xcd9c('0x38')]){throw new db[(_0xcd9c('0x6a'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2ff292=_0x2551f4;return db[_0xcd9c('0x6c')][_0xcd9c('0x43')]({'raw':!![]});}return null;})[_0xcd9c('0x24')](function(_0x2bae96){if(_0x2bae96){_0x439aff=_[_0xcd9c('0x8a')](_0x2bae96,'id');var _0x215448;var _0x8817b=squel[_0xcd9c('0x6d')]();_0x8817b[_0xcd9c('0x6e')](_0x5627dd[_0xcd9c('0x6f')]);for(var _0x7a634f=0x0;_0x7a634f<_0x2ff292['length'];_0x7a634f+=0x1){_0x215448=_0x2ff292[_0x7a634f][_0xcd9c('0x70')]?_0x439aff[_0x2ff292[_0x7a634f][_0xcd9c('0x70')]][_0xcd9c('0x9e')]:_0x2ff292[_0x7a634f]['field'];_0x215448=_0x2ff292[_0x7a634f][_0xcd9c('0x72')]?_[_0xcd9c('0x71')](_0x5a487d[_0x2ff292[_0x7a634f]['function']],'%s',_0x215448):_0x215448;_0x215448=_0x2ff292[_0x7a634f][_0xcd9c('0x73')]?_['replace'](_0x595bda[_0x2ff292[_0x7a634f][_0xcd9c('0x73')]],'%s',_0x215448):_0x215448;if(_0x2ff292[_0x7a634f][_0xcd9c('0x74')]){_0x8817b['group'](_0x215448);}_0x2ff292[_0x7a634f][_0xcd9c('0x75')]&&_0x8817b[_0xcd9c('0x3b')](_0x215448,_0x2ff292[_0x7a634f][_0xcd9c('0x75')]==='DESC'?![]:!![]);_0x8817b[_0xcd9c('0x66')](_0x215448,_0x2ff292[_0x7a634f]['alias']||_0x215448);}if(_0x5627dd[_0xcd9c('0x77')]){_0x5627dd[_0xcd9c('0x77')]=JSON['parse'](_0x5627dd['joins']);for(var _0x54d1d8=0x0;_0x54d1d8<_0x5627dd[_0xcd9c('0x77')][_0xcd9c('0x38')];_0x54d1d8+=0x1){if(_0x5627dd[_0xcd9c('0x77')][_0x54d1d8][_0xcd9c('0x2f')]&&_[_0xcd9c('0x5f')](_0x4d86d1,_0x5627dd[_0xcd9c('0x77')][_0x54d1d8][_0xcd9c('0x2f')])&&_0x5627dd['joins'][_0x54d1d8][_0xcd9c('0x79')]&&_0x5627dd[_0xcd9c('0x77')][_0x54d1d8][_0xcd9c('0x7b')]&&_0x5627dd[_0xcd9c('0x77')][_0x54d1d8]['foreignKey']){_0x8817b[_0x5627dd['joins'][_0x54d1d8][_0xcd9c('0x2f')]](_0x5627dd['joins'][_0x54d1d8][_0xcd9c('0x7b')],null,util[_0xcd9c('0x73')](_0xcd9c('0x7c'),_0x5627dd[_0xcd9c('0x6f')],_0x5627dd['joins'][_0x54d1d8][_0xcd9c('0x79')],_0x5627dd['joins'][_0x54d1d8]['foreignTable'],_0x5627dd[_0xcd9c('0x77')][_0x54d1d8]['foreignKey']));}}}if(_0x5627dd[_0xcd9c('0x7d')]){_0x5627dd[_0xcd9c('0x7d')]=JSON['parse'](_0x5627dd[_0xcd9c('0x7d')]);_0x8817b[_0xcd9c('0x3c')](_0x34ea71(_0x5627dd[_0xcd9c('0x7d')][_0xcd9c('0x65')]));}_0x5f4750=_0x8817b[_0xcd9c('0x7e')]();_0x8817b['limit'](_0x8e339a);_0x8817b[_0xcd9c('0x1d')](0x0);logger[_0xcd9c('0x7f')](_0xcd9c('0x80'),_0x8817b[_0xcd9c('0x81')]());return dbH['sequelize'][_0xcd9c('0x32')](_0x8817b[_0xcd9c('0x81')](),{'type':dbH[_0xcd9c('0x82')][_0xcd9c('0x83')][_0xcd9c('0x84')]});}})[_0xcd9c('0x24')](function(){return{'sql':_0x5f4750[_0xcd9c('0x81')]()};})[_0xcd9c('0x24')](respondWithResult(_0x310780,null))[_0xcd9c('0x45')](handleError(_0x310780,null));}; \ No newline at end of file +var _0x66bd=['moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','get','DefaultReports','name','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','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)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','left_join','SEC_TO_TIME(%s)','IS\x20NOT\x20NULL','value','groupBy','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','select','countTable','COUNT(*)','run','runReport','getFields','ValidationErrorItem','html-pdf','rimraf','zip-dir'];(function(_0x5d567e,_0x35f96a){var _0x310c25=function(_0x5d255f){while(--_0x5d255f){_0x5d567e['push'](_0x5d567e['shift']());}};_0x310c25(++_0x35f96a);}(_0x66bd,0x14b));var _0xd66b=function(_0x2a9bf4,_0x5e0ffb){_0x2a9bf4=_0x2a9bf4-0x0;var _0x5f5ff1=_0x66bd[_0x2a9bf4];return _0x5f5ff1;};'use strict';var pdf=require(_0xd66b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd66b('0x1'));var zipdir=require(_0xd66b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd66b('0x3'));var BPromise=require(_0xd66b('0x4'));var Mustache=require(_0xd66b('0x5'));var util=require('util');var path=require('path');var sox=require(_0xd66b('0x6'));var csv=require(_0xd66b('0x7'));var ejs=require(_0xd66b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd66b('0x9'));var squel=require('squel');var crypto=require(_0xd66b('0xa'));var jsforce=require(_0xd66b('0xb'));var deskjs=require(_0xd66b('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd66b('0xd'));var Redis=require(_0xd66b('0xe'));var authService=require(_0xd66b('0xf'));var qs=require(_0xd66b('0x10'));var as=require(_0xd66b('0x11'));var hardwareService=require(_0xd66b('0x12'));var logger=require(_0xd66b('0x13'))(_0xd66b('0x14'));var utils=require(_0xd66b('0x15'));var config=require(_0xd66b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd66b('0x17'))['db'];var dbH=require('../../mysqldb')[_0xd66b('0x18')];function respondWithStatusCode(_0x42acf7,_0x2e4462){_0x2e4462=_0x2e4462||0xcc;return function(_0x42e489){if(_0x42e489){return _0x42acf7[_0xd66b('0x19')](_0x2e4462);}return _0x42acf7[_0xd66b('0x1a')](_0x2e4462)[_0xd66b('0x1b')]();};}function respondWithResult(_0xb4b86b,_0x5c1788){_0x5c1788=_0x5c1788||0xc8;return function(_0x3cc7d1){if(_0x3cc7d1){return _0xb4b86b[_0xd66b('0x1a')](_0x5c1788)[_0xd66b('0x1c')](_0x3cc7d1);}};}function respondWithFilteredResult(_0x4a3fce,_0x1e9a0f){return function(_0x22a1cb){if(_0x22a1cb){var _0x4a77b8=_0x22a1cb[_0xd66b('0x1d')],_0x1d5372=_0x1e9a0f['offset'],_0x45577b=_0x1e9a0f[_0xd66b('0x1e')]+_0x1e9a0f[_0xd66b('0x1f')],_0x1c8f63;if(_0x45577b>=_0x4a77b8){_0x45577b=_0x4a77b8;_0x1c8f63=0xc8;}else{_0x1c8f63=0xce;}_0x4a3fce[_0xd66b('0x1a')](_0x1c8f63);return _0x4a3fce[_0xd66b('0x20')](_0xd66b('0x21'),_0x1d5372+'-'+_0x45577b+'/'+_0x4a77b8)[_0xd66b('0x1c')](_0x22a1cb);}return null;};}function patchUpdates(_0xeb1e44){return function(_0x10e52f){try{jsonpatch['apply'](_0x10e52f,_0xeb1e44,!![]);}catch(_0x277886){return BPromise['reject'](_0x277886);}return _0x10e52f[_0xd66b('0x22')]();};}function saveUpdates(_0x1c2e1e,_0x44e02b){return function(_0x57605b){if(_0x57605b){return _0x57605b[_0xd66b('0x23')](_0x1c2e1e)[_0xd66b('0x24')](function(_0x57a6ce){return _0x57a6ce;});}return null;};}function removeEntity(_0x49a779,_0x2736ca){return function(_0x572748){if(_0x572748){return _0x572748[_0xd66b('0x25')]()['then'](function(){var _0x52f149=_0x572748[_0xd66b('0x26')]({'plain':!![]});var _0x2916b5=_0xd66b('0x27');return db['UserProfileResource'][_0xd66b('0x25')]({'where':{'type':_0x2916b5,'resourceId':_0x52f149['id']}})[_0xd66b('0x24')](function(){return _0x572748;});})[_0xd66b('0x24')](function(){_0x49a779['status'](0xcc)[_0xd66b('0x1b')]();});}};}function handleEntityNotFound(_0x5a6113,_0x5304e7){return function(_0x1ab53e){if(!_0x1ab53e){_0x5a6113[_0xd66b('0x19')](0x194);}return _0x1ab53e;};}function handleError(_0x4e299f,_0x1b0911){_0x1b0911=_0x1b0911||0x1f4;return function(_0x1bb6d3){logger['error'](_0x1bb6d3['stack']);if(_0x1bb6d3['name']){delete _0x1bb6d3[_0xd66b('0x28')];}_0x4e299f[_0xd66b('0x1a')](_0x1b0911)['send'](_0x1bb6d3);};}exports[_0xd66b('0x29')]=function(_0x13653e,_0x3b994a){var _0x419443={},_0x281a0e={},_0x2b5a78={'count':0x0,'rows':[]};var _0x5227=_[_0xd66b('0x2a')](db[_0xd66b('0x2b')][_0xd66b('0x2c')],function(_0x229f4c){return{'name':_0x229f4c[_0xd66b('0x2d')],'type':_0x229f4c[_0xd66b('0x2e')][_0xd66b('0x2f')]};});_0x281a0e[_0xd66b('0x30')]=_[_0xd66b('0x2a')](_0x5227,_0xd66b('0x28'));_0x281a0e[_0xd66b('0x31')]=_[_0xd66b('0x32')](_0x13653e['query']);_0x281a0e[_0xd66b('0x33')]=_[_0xd66b('0x34')](_0x281a0e[_0xd66b('0x30')],_0x281a0e[_0xd66b('0x31')]);_0x419443['attributes']=_[_0xd66b('0x34')](_0x281a0e[_0xd66b('0x30')],qs['fields'](_0x13653e[_0xd66b('0x31')][_0xd66b('0x35')]));_0x419443['attributes']=_0x419443[_0xd66b('0x36')][_0xd66b('0x37')]?_0x419443['attributes']:_0x281a0e[_0xd66b('0x30')];if(!_0x13653e[_0xd66b('0x31')][_0xd66b('0x38')](_0xd66b('0x39'))){_0x419443[_0xd66b('0x1f')]=qs[_0xd66b('0x1f')](_0x13653e[_0xd66b('0x31')][_0xd66b('0x1f')]);_0x419443['offset']=qs[_0xd66b('0x1e')](_0x13653e[_0xd66b('0x31')]['offset']);}_0x419443[_0xd66b('0x3a')]=qs['sort'](_0x13653e[_0xd66b('0x31')][_0xd66b('0x3b')]);_0x419443[_0xd66b('0x3c')]=qs['filters'](_[_0xd66b('0x3d')](_0x13653e[_0xd66b('0x31')],_0x281a0e['filters']),_0x5227);if(_0x13653e[_0xd66b('0x31')][_0xd66b('0x3e')]){_0x419443[_0xd66b('0x3c')]=_[_0xd66b('0x3f')](_0x419443['where'],{'$or':_[_0xd66b('0x2a')](_0x5227,function(_0x2c7b1b){if(_0x2c7b1b['type']!==_0xd66b('0x40')){var _0x660f09={};_0x660f09[_0x2c7b1b['name']]={'$like':'%'+_0x13653e[_0xd66b('0x31')][_0xd66b('0x3e')]+'%'};return _0x660f09;}})});}_0x419443=_['merge']({},_0x419443,_0x13653e[_0xd66b('0x41')]);var _0x2e8a29={'where':_0x419443[_0xd66b('0x3c')]};return db[_0xd66b('0x2b')][_0xd66b('0x1d')](_0x2e8a29)[_0xd66b('0x24')](function(_0x27b4ea){_0x2b5a78[_0xd66b('0x1d')]=_0x27b4ea;if(_0x13653e[_0xd66b('0x31')][_0xd66b('0x42')]){_0x419443[_0xd66b('0x43')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0xd66b('0x44')](_0x419443);})[_0xd66b('0x24')](function(_0x4f5df1){_0x2b5a78['rows']=_0x4f5df1;return _0x2b5a78;})[_0xd66b('0x24')](respondWithFilteredResult(_0x3b994a,_0x419443))['catch'](handleError(_0x3b994a,null));};exports[_0xd66b('0x45')]=function(_0x1d6346,_0x30730b){var _0x54ac49={'raw':!![],'where':{'id':_0x1d6346['params']['id']}},_0x2e7295={};_0x2e7295[_0xd66b('0x30')]=_[_0xd66b('0x32')](db[_0xd66b('0x2b')][_0xd66b('0x2c')]);_0x2e7295[_0xd66b('0x31')]=_[_0xd66b('0x32')](_0x1d6346[_0xd66b('0x31')]);_0x2e7295[_0xd66b('0x33')]=_['intersection'](_0x2e7295[_0xd66b('0x30')],_0x2e7295['query']);_0x54ac49['attributes']=_[_0xd66b('0x34')](_0x2e7295[_0xd66b('0x30')],qs[_0xd66b('0x35')](_0x1d6346[_0xd66b('0x31')]['fields']));_0x54ac49[_0xd66b('0x36')]=_0x54ac49[_0xd66b('0x36')]['length']?_0x54ac49[_0xd66b('0x36')]:_0x2e7295[_0xd66b('0x30')];if(_0x1d6346[_0xd66b('0x31')]['includeAll']){_0x54ac49[_0xd66b('0x43')]=[{'all':!![]}];}_0x54ac49=_['merge']({},_0x54ac49,_0x1d6346[_0xd66b('0x41')]);return db[_0xd66b('0x2b')][_0xd66b('0x46')](_0x54ac49)[_0xd66b('0x24')](handleEntityNotFound(_0x30730b,null))[_0xd66b('0x24')](respondWithResult(_0x30730b,null))[_0xd66b('0x47')](handleError(_0x30730b,null));};exports[_0xd66b('0x48')]=function(_0x5bde1a,_0x540269){return db[_0xd66b('0x2b')]['create'](_0x5bde1a[_0xd66b('0x49')],{})[_0xd66b('0x24')](function(_0x132695){var _0x10f3c5=_0x5bde1a[_0xd66b('0x4a')][_0xd66b('0x26')]({'plain':!![]});if(!_0x10f3c5)throw new Error(_0xd66b('0x4b'));if(_0x10f3c5[_0xd66b('0x4c')]==='user'){var _0x36069a=_0x132695[_0xd66b('0x26')]({'plain':!![]});var _0x241049=_0xd66b('0x4d');return db['UserProfileSection']['find']({'where':{'name':_0x241049,'userProfileId':_0x10f3c5[_0xd66b('0x4e')]},'raw':!![]})[_0xd66b('0x24')](function(_0x279624){if(_0x279624&&_0x279624[_0xd66b('0x4f')]===0x0){return db[_0xd66b('0x50')][_0xd66b('0x48')]({'name':_0x36069a[_0xd66b('0x28')],'resourceId':_0x36069a['id'],'type':_0xd66b('0x27'),'sectionId':_0x279624['id']},{})[_0xd66b('0x24')](function(){return _0x132695;});}else{return _0x132695;}})[_0xd66b('0x47')](function(_0x2755bf){logger[_0xd66b('0x51')](_0xd66b('0x52'),_0x2755bf);throw _0x2755bf;});}return _0x132695;})[_0xd66b('0x24')](respondWithResult(_0x540269,0xc9))['catch'](handleError(_0x540269,null));};exports['update']=function(_0x2c7e6c,_0x401f39){if(_0x2c7e6c[_0xd66b('0x49')]['id']){delete _0x2c7e6c[_0xd66b('0x49')]['id'];}return db[_0xd66b('0x2b')][_0xd66b('0x46')]({'where':{'id':_0x2c7e6c[_0xd66b('0x53')]['id']}})[_0xd66b('0x24')](handleEntityNotFound(_0x401f39,null))[_0xd66b('0x24')](saveUpdates(_0x2c7e6c[_0xd66b('0x49')],null))[_0xd66b('0x24')](respondWithResult(_0x401f39,null))['catch'](handleError(_0x401f39,null));};exports[_0xd66b('0x25')]=function(_0x5bb207,_0x5e738a){return db[_0xd66b('0x2b')][_0xd66b('0x46')]({'where':{'id':_0x5bb207['params']['id']}})[_0xd66b('0x24')](handleEntityNotFound(_0x5e738a,null))[_0xd66b('0x24')](removeEntity(_0x5e738a,null))[_0xd66b('0x47')](handleError(_0x5e738a,null));};exports[_0xd66b('0x54')]=function(_0x296fb7,_0x4d3bab){var _0x11be28=0xa;var _0x57ed01=['join','left_join',_0xd66b('0x55'),_0xd66b('0x56')];var _0x1e432e={'SUM':_0xd66b('0x57'),'COUNT':_0xd66b('0x58'),'COUNT DISTINCT':_0xd66b('0x59'),'MAX':_0xd66b('0x5a'),'MIN':_0xd66b('0x5b'),'AVG':_0xd66b('0x5c'),'GROUP_CONCAT':_0xd66b('0x5d'),'GROUP_CONCAT ASC':_0xd66b('0x5e'),'GROUP_CONCAT DESC':_0xd66b('0x5f')};var _0x776f0b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd66b('0x60'),'HOUR':_0xd66b('0x61'),'ROUND':_0xd66b('0x62'),'UNIX_TIMESTAMP':_0xd66b('0x63')};var _0x4536e2=function(_0x2a15b9){return!_[_0xd66b('0x64')]([_0xd66b('0x65'),'IS\x20NOT\x20NULL',_0xd66b('0x66'),_0xd66b('0x67')],_0x2a15b9);};var _0x5f4073=function(_0x49bab0){if(!_0x49bab0||!_0x49bab0[_0xd66b('0x68')]['length']){return'';}for(var _0x234cf8='(',_0x4cfd51=0x0;_0x4cfd51<_0x49bab0[_0xd66b('0x68')][_0xd66b('0x37')];_0x4cfd51+=0x1){_0x4cfd51>0x0&&(_0x234cf8+='\x20'+_0x49bab0['operator']+'\x20');_0x234cf8+=_0x49bab0[_0xd66b('0x68')][_0x4cfd51][_0xd66b('0x69')]?_0x5f4073(_0x49bab0[_0xd66b('0x68')][_0x4cfd51][_0xd66b('0x69')]):_0x49bab0[_0xd66b('0x68')][_0x4cfd51][_0xd66b('0x6a')]+'\x20'+_0x49bab0[_0xd66b('0x68')][_0x4cfd51][_0xd66b('0x6b')]+(_0x4536e2(_0x49bab0[_0xd66b('0x68')][_0x4cfd51][_0xd66b('0x6b')])?'\x20'+_0x49bab0[_0xd66b('0x68')][_0x4cfd51]['value']:'');}return _0x234cf8+')';};var _0x26c9bb={'where':{'id':_0x296fb7['params']['id']}},_0x2de9c3,_0x582f6e,_0x163218,_0xd35613,_0xf2b27f;_0x26c9bb=_[_0xd66b('0x3f')]({},_0x26c9bb,_0x296fb7[_0xd66b('0x41')]);return db[_0xd66b('0x2b')][_0xd66b('0x46')](_0x26c9bb)[_0xd66b('0x24')](function(_0x182437){if(_0x182437){_0x2de9c3=_0x182437;return _0x182437['getFields']();}return null;})[_0xd66b('0x24')](function(_0x3e7d2a){if(_0x3e7d2a){if(!_0x3e7d2a[_0xd66b('0x37')]){throw new db[(_0xd66b('0x6c'))]['ValidationErrorItem'](_0xd66b('0x6d'),0x193);}_0x582f6e=_0x3e7d2a;return db[_0xd66b('0x6e')][_0xd66b('0x44')]({'raw':!![]});}return null;})[_0xd66b('0x24')](function(_0x4519da){if(_0x4519da){_0x163218=_[_0xd66b('0x6f')](_0x4519da,'id');var _0x2e0ddc;var _0x14805a=squel['select']();_0x14805a[_0xd66b('0x70')](_0x2de9c3['table']);for(var _0x38dc9d=0x0;_0x38dc9d<_0x582f6e[_0xd66b('0x37')];_0x38dc9d+=0x1){_0x2e0ddc=_0x582f6e[_0x38dc9d][_0xd66b('0x71')]?_0x163218[_0x582f6e[_0x38dc9d][_0xd66b('0x71')]][_0xd66b('0x72')]:_0x582f6e[_0x38dc9d]['field'];_0x2e0ddc=_0x582f6e[_0x38dc9d][_0xd66b('0x73')]?_[_0xd66b('0x74')](_0x1e432e[_0x582f6e[_0x38dc9d][_0xd66b('0x73')]],'%s',_0x2e0ddc):_0x2e0ddc;_0x2e0ddc=_0x582f6e[_0x38dc9d][_0xd66b('0x75')]?_['replace'](_0x776f0b[_0x582f6e[_0x38dc9d][_0xd66b('0x75')]],'%s',_0x2e0ddc):_0x2e0ddc;if(_0x582f6e[_0x38dc9d]['groupBy']){_0x14805a['group'](_0x2e0ddc);}_0x582f6e[_0x38dc9d][_0xd66b('0x76')]&&_0x14805a[_0xd66b('0x3a')](_0x2e0ddc,_0x582f6e[_0x38dc9d][_0xd66b('0x76')]===_0xd66b('0x77')?![]:!![]);_0x14805a[_0xd66b('0x6a')](_0x2e0ddc,_0x582f6e[_0x38dc9d][_0xd66b('0x78')]||_0x2e0ddc);}if(_0x2de9c3[_0xd66b('0x79')]){_0x2de9c3['joins']=JSON[_0xd66b('0x7a')](_0x2de9c3[_0xd66b('0x79')]);for(var _0x1af25f=0x0;_0x1af25f<_0x2de9c3[_0xd66b('0x79')][_0xd66b('0x37')];_0x1af25f+=0x1){if(_0x2de9c3[_0xd66b('0x79')][_0x1af25f][_0xd66b('0x2e')]&&_['includes'](_0x57ed01,_0x2de9c3[_0xd66b('0x79')][_0x1af25f][_0xd66b('0x2e')])&&_0x2de9c3[_0xd66b('0x79')][_0x1af25f][_0xd66b('0x7b')]&&_0x2de9c3[_0xd66b('0x79')][_0x1af25f][_0xd66b('0x7c')]&&_0x2de9c3[_0xd66b('0x79')][_0x1af25f]['foreignKey']){_0x14805a[_0x2de9c3[_0xd66b('0x79')][_0x1af25f]['type']](_0x2de9c3[_0xd66b('0x79')][_0x1af25f][_0xd66b('0x7c')],null,util[_0xd66b('0x75')](_0xd66b('0x7d'),_0x2de9c3[_0xd66b('0x7e')],_0x2de9c3[_0xd66b('0x79')][_0x1af25f]['parentKey'],_0x2de9c3['joins'][_0x1af25f]['foreignTable'],_0x2de9c3[_0xd66b('0x79')][_0x1af25f][_0xd66b('0x7f')]));}}}if(_0x2de9c3[_0xd66b('0x80')]){_0x2de9c3[_0xd66b('0x80')]=JSON[_0xd66b('0x7a')](_0x2de9c3[_0xd66b('0x80')]);_0x14805a[_0xd66b('0x3c')](_0x5f4073(_0x2de9c3[_0xd66b('0x80')][_0xd66b('0x69')]));}_0xf2b27f=_0x14805a[_0xd66b('0x81')]();_0x14805a['limit'](_0x11be28);_0x14805a[_0xd66b('0x1e')](0x0);logger[_0xd66b('0x82')](_0xd66b('0x83'),_0x14805a[_0xd66b('0x84')]());return dbH[_0xd66b('0x85')]['query'](_0x14805a['toString'](),{'type':dbH[_0xd66b('0x85')][_0xd66b('0x86')][_0xd66b('0x87')]});}})[_0xd66b('0x24')](respondWithResult(_0x4d3bab,null))['catch'](handleError(_0x4d3bab,null));};function runReport(_0x3d3f37,_0x19ccfe,_0x337096){var _0x551a34=_0x19ccfe['name'];var _0x44eecc=0xa;var _0x3db7cc=[_0xd66b('0x88'),_0xd66b('0x89'),'right_join','cross_join'];var _0x264f28={'SUM':_0xd66b('0x57'),'COUNT':_0xd66b('0x58'),'COUNT DISTINCT':_0xd66b('0x59'),'MAX':_0xd66b('0x5a'),'MIN':_0xd66b('0x5b'),'AVG':_0xd66b('0x5c'),'GROUP_CONCAT':_0xd66b('0x5d'),'GROUP_CONCAT ASC':_0xd66b('0x5e'),'GROUP_CONCAT DESC':_0xd66b('0x5f')};var _0x5b26f2={'SEC_TO_TIME':_0xd66b('0x8a'),'DATE':_0xd66b('0x60'),'HOUR':_0xd66b('0x61'),'ROUND':_0xd66b('0x62'),'UNIX_TIMESTAMP':_0xd66b('0x63')};var _0x24703d=function(_0x12cbbc){return!_[_0xd66b('0x64')]([_0xd66b('0x65'),_0xd66b('0x8b'),_0xd66b('0x66'),_0xd66b('0x67')],_0x12cbbc);};var _0x407434=function(_0x172a64){if(!_0x172a64||!_0x172a64[_0xd66b('0x68')][_0xd66b('0x37')]){return'';}for(var _0x479667='(',_0x1fcf0a=0x0;_0x1fcf0a<_0x172a64[_0xd66b('0x68')]['length'];_0x1fcf0a+=0x1){_0x1fcf0a>0x0&&(_0x479667+='\x20'+_0x172a64['operator']+'\x20');_0x479667+=_0x172a64['rules'][_0x1fcf0a][_0xd66b('0x69')]?_0x407434(_0x172a64[_0xd66b('0x68')][_0x1fcf0a][_0xd66b('0x69')]):_0x172a64[_0xd66b('0x68')][_0x1fcf0a]['field']+'\x20'+_0x172a64[_0xd66b('0x68')][_0x1fcf0a][_0xd66b('0x6b')]+(_0x24703d(_0x172a64[_0xd66b('0x68')][_0x1fcf0a]['condition'])?'\x20'+_0x172a64[_0xd66b('0x68')][_0x1fcf0a][_0xd66b('0x8c')]:'');}return _0x479667+')';};var _0x4ef8b8={'where':{'id':_0x3d3f37['id']}},_0x3d85d0,_0x37c071,_0x45821e,_0x20a8fa,_0x3bb165;_0x4ef8b8=_[_0xd66b('0x3f')]({},_0x4ef8b8,_0x337096);return db['AnalyticDefaultReport'][_0xd66b('0x46')](_0x4ef8b8)['then'](function(_0x4ea839){if(_0x4ea839){_0x3d85d0=_0x4ea839;return _0x4ea839['getFields']();}return null;})[_0xd66b('0x24')](function(_0x417ed1){if(_0x417ed1){if(!_0x417ed1['length']){throw new db[(_0xd66b('0x6c'))]['ValidationErrorItem'](_0xd66b('0x6d'),0x193);}_0x37c071=_0x417ed1;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x471547){if(_0x471547){_0x45821e=_[_0xd66b('0x6f')](_0x471547,'id');var _0x43f201;var _0xce9da7=squel['select']();_0xce9da7[_0xd66b('0x70')](_0x3d85d0['table']);for(var _0x51ab57=0x0;_0x51ab57<_0x37c071[_0xd66b('0x37')];_0x51ab57+=0x1){_0x43f201=_0x37c071[_0x51ab57][_0xd66b('0x71')]?_0x45821e[_0x37c071[_0x51ab57][_0xd66b('0x71')]][_0xd66b('0x72')]:_0x37c071[_0x51ab57][_0xd66b('0x6a')];_0x43f201=_0x37c071[_0x51ab57][_0xd66b('0x73')]?_[_0xd66b('0x74')](_0x264f28[_0x37c071[_0x51ab57][_0xd66b('0x73')]],'%s',_0x43f201):_0x43f201;_0x43f201=_0x37c071[_0x51ab57][_0xd66b('0x75')]?_[_0xd66b('0x74')](_0x5b26f2[_0x37c071[_0x51ab57]['format']],'%s',_0x43f201):_0x43f201;if(_0x37c071[_0x51ab57][_0xd66b('0x8d')]){_0xce9da7[_0xd66b('0x69')](_0x43f201);}_0x37c071[_0x51ab57]['orderBy']&&_0xce9da7[_0xd66b('0x3a')](_0x43f201,_0x37c071[_0x51ab57]['orderBy']==='DESC'?![]:!![]);_0xce9da7['field'](_0x43f201,_0x37c071[_0x51ab57][_0xd66b('0x78')]||_0x43f201);}if(_0x3d85d0[_0xd66b('0x79')]){_0x3d85d0[_0xd66b('0x79')]=JSON['parse'](_0x3d85d0[_0xd66b('0x79')]);for(var _0x3cb102=0x0;_0x3cb102<_0x3d85d0[_0xd66b('0x79')][_0xd66b('0x37')];_0x3cb102+=0x1){if(_0x3d85d0[_0xd66b('0x79')][_0x3cb102][_0xd66b('0x2e')]&&_[_0xd66b('0x64')](_0x3db7cc,_0x3d85d0[_0xd66b('0x79')][_0x3cb102][_0xd66b('0x2e')])&&_0x3d85d0['joins'][_0x3cb102]['parentKey']&&_0x3d85d0[_0xd66b('0x79')][_0x3cb102][_0xd66b('0x7c')]&&_0x3d85d0[_0xd66b('0x79')][_0x3cb102]['foreignKey']){_0xce9da7[_0x3d85d0[_0xd66b('0x79')][_0x3cb102]['type']](_0x3d85d0[_0xd66b('0x79')][_0x3cb102][_0xd66b('0x7c')],null,util['format'](_0xd66b('0x7d'),_0x3d85d0[_0xd66b('0x7e')],_0x3d85d0[_0xd66b('0x79')][_0x3cb102][_0xd66b('0x7b')],_0x3d85d0[_0xd66b('0x79')][_0x3cb102][_0xd66b('0x7c')],_0x3d85d0[_0xd66b('0x79')][_0x3cb102]['foreignKey']));}}}if(_0x3d85d0[_0xd66b('0x80')]){_0x3d85d0[_0xd66b('0x80')]=JSON['parse'](_0x3d85d0[_0xd66b('0x80')]);_0xce9da7['where'](_0x407434(_0x3d85d0[_0xd66b('0x80')][_0xd66b('0x69')]));}_0x3bb165=_0xce9da7[_0xd66b('0x81')]();_0xce9da7['limit'](_0x44eecc);_0xce9da7[_0xd66b('0x1e')](0x0);return;}})[_0xd66b('0x24')](function(){if(_0x19ccfe[_0xd66b('0x8e')]===_0xd66b('0x8f')){return null;}var _0x24f8ca=_['merge'](_0x19ccfe,{'name':_0x19ccfe[_0xd66b('0x90')]||_0x19ccfe[_0xd66b('0x28')]||_0x3d85d0[_0xd66b('0x28')],'basename':_0x551a34,'savename':util[_0xd66b('0x75')](_0xd66b('0x91'),_0x19ccfe[_0xd66b('0x28')]||_0x3d85d0[_0xd66b('0x28')],require(_0xd66b('0x92'))[_0xd66b('0x93')](0x4),_0x19ccfe[_0xd66b('0x8e')]||_0xd66b('0x94')),'reportId':_0x3d85d0['id'],'reportType':'default'});return db[_0xd66b('0x95')][_0xd66b('0x48')](_0x24f8ca,{'raw':!![]});})[_0xd66b('0x24')](function(_0xcd22df){if(_0x3d85d0[_0xd66b('0x7e')]===_0xd66b('0x96')){_0x3bb165[_0xd66b('0x3c')](_0x3d85d0[_0xd66b('0x7e')]+_0xd66b('0x97'),_0x19ccfe[_0xd66b('0x98')],_0x19ccfe[_0xd66b('0x99')]);}else{_0x3bb165[_0xd66b('0x3c')](_0x3d85d0[_0xd66b('0x7e')]+_0xd66b('0x9a'),_0x19ccfe['startDate'],_0x19ccfe[_0xd66b('0x99')]);}if(_0xcd22df){logger[_0xd66b('0x9b')](_0xd66b('0x9c'),_0x3bb165['toString']());require(_0xd66b('0x9d'))[_0xd66b('0x9e')](path['join'](__dirname,_0xd66b('0x9f'),_0xcd22df[_0xd66b('0x8e')]),[_0xcd22df['id'],_0x3bb165[_0xd66b('0x84')](),path[_0xd66b('0x88')](__dirname,'../../files/reports',_0xcd22df['savename']),_0x551a34]);return _0xcd22df;}else{var _0x5709c0=squel[_0xd66b('0xa0')]();_0x5709c0['from']('('+_0x3bb165['toString']()+')',_0xd66b('0xa1'));_0x5709c0[_0xd66b('0x6a')](_0xd66b('0xa2'),_0xd66b('0x1d'));_0x3bb165[_0xd66b('0x1f')](_0x19ccfe[_0xd66b('0x1f')]||_0x44eecc);_0x3bb165[_0xd66b('0x1e')](_0x19ccfe[_0xd66b('0x1e')]||0x0);return dbH[_0xd66b('0x85')]['query'](_0x5709c0[_0xd66b('0x84')](),{'type':dbH[_0xd66b('0x85')][_0xd66b('0x86')][_0xd66b('0x87')]})[_0xd66b('0x24')](function(_0x59f303){if(!_0x59f303[_0xd66b('0x37')]){_0x20a8fa=0x0;}else{_0x20a8fa=_0x59f303[0x0][_0xd66b('0x1d')]||0x0;}return dbH[_0xd66b('0x85')]['query'](_0x3bb165['toString'](),{'type':dbH['sequelize'][_0xd66b('0x86')][_0xd66b('0x87')]});})[_0xd66b('0x24')](function(_0x40fb67){return{'rows':_0x40fb67||[],'count':_0x20a8fa};});}});}exports[_0xd66b('0xa3')]=function(_0x488871,_0x1c41c3){return runReport(_0x488871[_0xd66b('0x53')],_0x488871[_0xd66b('0x31')],_0x488871['options'])[_0xd66b('0x24')](respondWithResult(_0x1c41c3,null))['catch'](handleError(_0x1c41c3,null));};exports[_0xd66b('0xa4')]=runReport;exports['query']=function(_0x2a6a26,_0x53f18a){var _0x203b67=0xa;var _0x3fd9fc=['join',_0xd66b('0x89'),_0xd66b('0x55'),'cross_join'];var _0x2b1412={'SUM':_0xd66b('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd66b('0x59'),'MAX':_0xd66b('0x5a'),'MIN':'MIN(%s)','AVG':_0xd66b('0x5c'),'GROUP_CONCAT':_0xd66b('0x5d'),'GROUP_CONCAT ASC':_0xd66b('0x5e'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1f0507={'SEC_TO_TIME':_0xd66b('0x8a'),'DATE':_0xd66b('0x60'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xd66b('0x63')};var _0x5a65d4=function(_0x108f9a){return!_[_0xd66b('0x64')](['IS\x20NULL',_0xd66b('0x8b'),_0xd66b('0x66'),'IS\x20NOT\x20EMPTY'],_0x108f9a);};var _0x3c5a72=function(_0x22703f){if(!_0x22703f||!_0x22703f[_0xd66b('0x68')][_0xd66b('0x37')]){return'';}for(var _0x480c6f='(',_0x2d0070=0x0;_0x2d0070<_0x22703f['rules'][_0xd66b('0x37')];_0x2d0070+=0x1){_0x2d0070>0x0&&(_0x480c6f+='\x20'+_0x22703f['operator']+'\x20');_0x480c6f+=_0x22703f['rules'][_0x2d0070][_0xd66b('0x69')]?_0x3c5a72(_0x22703f['rules'][_0x2d0070]['group']):_0x22703f['rules'][_0x2d0070]['field']+'\x20'+_0x22703f[_0xd66b('0x68')][_0x2d0070]['condition']+(_0x5a65d4(_0x22703f[_0xd66b('0x68')][_0x2d0070][_0xd66b('0x6b')])?'\x20'+_0x22703f[_0xd66b('0x68')][_0x2d0070][_0xd66b('0x8c')]:'');}return _0x480c6f+')';};var _0x43ee36={'where':{'id':_0x2a6a26['params']['id']}},_0x415ffb,_0x5e0b48,_0xa80241,_0x13d9b8,_0x2e5fed;_0x43ee36=_[_0xd66b('0x3f')]({},_0x43ee36,_0x2a6a26[_0xd66b('0x41')]);return db[_0xd66b('0x2b')][_0xd66b('0x46')](_0x43ee36)[_0xd66b('0x24')](function(_0x5766aa){if(_0x5766aa){_0x415ffb=_0x5766aa;return _0x5766aa[_0xd66b('0xa5')]();}return null;})[_0xd66b('0x24')](function(_0x2e6687){if(_0x2e6687){if(!_0x2e6687[_0xd66b('0x37')]){throw new db[(_0xd66b('0x6c'))][(_0xd66b('0xa6'))](_0xd66b('0x6d'),0x193);}_0x5e0b48=_0x2e6687;return db[_0xd66b('0x6e')][_0xd66b('0x44')]({'raw':!![]});}return null;})[_0xd66b('0x24')](function(_0x1738de){if(_0x1738de){_0xa80241=_[_0xd66b('0x6f')](_0x1738de,'id');var _0x5b0519;var _0x1ee72f=squel[_0xd66b('0xa0')]();_0x1ee72f[_0xd66b('0x70')](_0x415ffb[_0xd66b('0x7e')]);for(var _0x37ce00=0x0;_0x37ce00<_0x5e0b48[_0xd66b('0x37')];_0x37ce00+=0x1){_0x5b0519=_0x5e0b48[_0x37ce00]['MetricId']?_0xa80241[_0x5e0b48[_0x37ce00][_0xd66b('0x71')]]['metric']:_0x5e0b48[_0x37ce00][_0xd66b('0x6a')];_0x5b0519=_0x5e0b48[_0x37ce00]['function']?_[_0xd66b('0x74')](_0x2b1412[_0x5e0b48[_0x37ce00][_0xd66b('0x73')]],'%s',_0x5b0519):_0x5b0519;_0x5b0519=_0x5e0b48[_0x37ce00][_0xd66b('0x75')]?_[_0xd66b('0x74')](_0x1f0507[_0x5e0b48[_0x37ce00][_0xd66b('0x75')]],'%s',_0x5b0519):_0x5b0519;if(_0x5e0b48[_0x37ce00][_0xd66b('0x8d')]){_0x1ee72f[_0xd66b('0x69')](_0x5b0519);}_0x5e0b48[_0x37ce00][_0xd66b('0x76')]&&_0x1ee72f['order'](_0x5b0519,_0x5e0b48[_0x37ce00][_0xd66b('0x76')]===_0xd66b('0x77')?![]:!![]);_0x1ee72f['field'](_0x5b0519,_0x5e0b48[_0x37ce00][_0xd66b('0x78')]||_0x5b0519);}if(_0x415ffb[_0xd66b('0x79')]){_0x415ffb[_0xd66b('0x79')]=JSON[_0xd66b('0x7a')](_0x415ffb[_0xd66b('0x79')]);for(var _0x305728=0x0;_0x305728<_0x415ffb['joins'][_0xd66b('0x37')];_0x305728+=0x1){if(_0x415ffb[_0xd66b('0x79')][_0x305728][_0xd66b('0x2e')]&&_[_0xd66b('0x64')](_0x3fd9fc,_0x415ffb['joins'][_0x305728][_0xd66b('0x2e')])&&_0x415ffb['joins'][_0x305728][_0xd66b('0x7b')]&&_0x415ffb[_0xd66b('0x79')][_0x305728]['foreignTable']&&_0x415ffb[_0xd66b('0x79')][_0x305728]['foreignKey']){_0x1ee72f[_0x415ffb[_0xd66b('0x79')][_0x305728][_0xd66b('0x2e')]](_0x415ffb['joins'][_0x305728]['foreignTable'],null,util['format'](_0xd66b('0x7d'),_0x415ffb[_0xd66b('0x7e')],_0x415ffb[_0xd66b('0x79')][_0x305728][_0xd66b('0x7b')],_0x415ffb['joins'][_0x305728][_0xd66b('0x7c')],_0x415ffb[_0xd66b('0x79')][_0x305728][_0xd66b('0x7f')]));}}}if(_0x415ffb[_0xd66b('0x80')]){_0x415ffb[_0xd66b('0x80')]=JSON[_0xd66b('0x7a')](_0x415ffb['conditions']);_0x1ee72f[_0xd66b('0x3c')](_0x3c5a72(_0x415ffb[_0xd66b('0x80')][_0xd66b('0x69')]));}_0x2e5fed=_0x1ee72f[_0xd66b('0x81')]();_0x1ee72f[_0xd66b('0x1f')](_0x203b67);_0x1ee72f[_0xd66b('0x1e')](0x0);logger['debug']('Limited\x20Query:',_0x1ee72f['toString']());return dbH['sequelize'][_0xd66b('0x31')](_0x1ee72f[_0xd66b('0x84')](),{'type':dbH[_0xd66b('0x85')][_0xd66b('0x86')]['SELECT']});}})['then'](function(){return{'sql':_0x2e5fed['toString']()};})[_0xd66b('0x24')](respondWithResult(_0x53f18a,null))[_0xd66b('0x47')](handleError(_0x53f18a,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 3bfc25b..13cfcaa 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 _0x4483=['./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','lodash','util','../../config/logger','api','path','../../config/environment'];(function(_0xdcb46f,_0x8f628e){var _0x1382d8=function(_0x381441){while(--_0x381441){_0xdcb46f['push'](_0xdcb46f['shift']());}};_0x1382d8(++_0x8f628e);}(_0x4483,0x16c));var _0x3448=function(_0x34a765,_0x1e5bed){_0x34a765=_0x34a765-0x0;var _0x42e664=_0x4483[_0x34a765];return _0x42e664;};'use strict';var _=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var logger=require(_0x3448('0x2'))(_0x3448('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3448('0x4'));var rimraf=require('rimraf');var config=require(_0x3448('0x5'));var attributes=require(_0x3448('0x6'));module[_0x3448('0x7')]=function(_0x565e36,_0x35fa07){return _0x565e36[_0x3448('0x8')](_0x3448('0x9'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc5b5=['./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1956c9,_0x2ad6b4){var _0x499d4=function(_0x2fa03f){while(--_0x2fa03f){_0x1956c9['push'](_0x1956c9['shift']());}};_0x499d4(++_0x2ad6b4);}(_0xc5b5,0x1b2));var _0x5c5b=function(_0x5e8c7c,_0x3429c6){_0x5e8c7c=_0x5e8c7c-0x0;var _0x48f7bd=_0xc5b5[_0x5e8c7c];return _0x48f7bd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5c5b('0x0'))(_0x5c5b('0x1'));var moment=require('moment');var BPromise=require(_0x5c5b('0x2'));var rp=require(_0x5c5b('0x3'));var fs=require('fs');var path=require(_0x5c5b('0x4'));var rimraf=require(_0x5c5b('0x5'));var config=require('../../config/environment');var attributes=require(_0x5c5b('0x6'));module[_0x5c5b('0x7')]=function(_0x27509d,_0x6cb181){return _0x27509d[_0x5c5b('0x8')](_0x5c5b('0x9'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 2e4a206..4b0897e 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 _0xd52d=['jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x129098,_0x5b4d7a){var _0x588f8c=function(_0x634796){while(--_0x634796){_0x129098['push'](_0x129098['shift']());}};_0x588f8c(++_0x5b4d7a);}(_0xd52d,0x1c7));var _0xdd52=function(_0x2ad674,_0x48f568){_0x2ad674=_0x2ad674-0x0;var _0x544a99=_0xd52d[_0x2ad674];return _0x544a99;};'use strict';var _=require('lodash');var util=require(_0xdd52('0x0'));var moment=require(_0xdd52('0x1'));var BPromise=require('bluebird');var rs=require(_0xdd52('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdd52('0x3'));var logger=require(_0xdd52('0x4'))(_0xdd52('0x5'));var config=require(_0xdd52('0x6'));var jayson=require(_0xdd52('0x7'));var client=jayson[_0xdd52('0x8')][_0xdd52('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18d01d,_0x4ca1a2,_0x1b8b74){return new BPromise(function(_0x6ab1e3,_0x8a6170){return client[_0xdd52('0xa')](_0x18d01d,_0x1b8b74)[_0xdd52('0xb')](function(_0xb6616a){logger[_0xdd52('0xc')](_0xdd52('0xd'),_0x4ca1a2,_0xdd52('0xe'));logger[_0xdd52('0xf')](_0xdd52('0x10'),_0x4ca1a2,_0xdd52('0xe'),JSON[_0xdd52('0x11')](_0xb6616a));if(_0xb6616a['error']){if(_0xb6616a[_0xdd52('0x12')][_0xdd52('0x13')]===0x1f4){logger[_0xdd52('0x12')](_0xdd52('0xd'),_0x4ca1a2,_0xb6616a[_0xdd52('0x12')][_0xdd52('0x14')]);return _0x8a6170(_0xb6616a['error'][_0xdd52('0x14')]);}logger[_0xdd52('0x12')](_0xdd52('0xd'),_0x4ca1a2,_0xb6616a['error'][_0xdd52('0x14')]);return _0x6ab1e3(_0xb6616a[_0xdd52('0x12')][_0xdd52('0x14')]);}else{logger[_0xdd52('0xc')](_0xdd52('0xd'),_0x4ca1a2,_0xdd52('0xe'));_0x6ab1e3(_0xb6616a[_0xdd52('0x15')][_0xdd52('0x14')]);}})['catch'](function(_0x468c7a){logger['error'](_0xdd52('0xd'),_0x4ca1a2,_0x468c7a);_0x8a6170(_0x468c7a);});});} \ No newline at end of file +var _0xe3ed=['message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x26c79f,_0x58e5b0){var _0xb36938=function(_0x5e8b6a){while(--_0x5e8b6a){_0x26c79f['push'](_0x26c79f['shift']());}};_0xb36938(++_0x58e5b0);}(_0xe3ed,0x8d));var _0xde3e=function(_0x42ae49,_0x2a8e60){_0x42ae49=_0x42ae49-0x0;var _0x1091a1=_0xe3ed[_0x42ae49];return _0x1091a1;};'use strict';var _=require(_0xde3e('0x0'));var util=require(_0xde3e('0x1'));var moment=require(_0xde3e('0x2'));var BPromise=require(_0xde3e('0x3'));var rs=require(_0xde3e('0x4'));var fs=require('fs');var Redis=require(_0xde3e('0x5'));var db=require(_0xde3e('0x6'))['db'];var utils=require(_0xde3e('0x7'));var logger=require('../../config/logger')(_0xde3e('0x8'));var config=require(_0xde3e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xde3e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x184b02,_0x4c4ac6,_0x47e97f){return new BPromise(function(_0x3e0bb4,_0x3b1597){return client[_0xde3e('0xb')](_0x184b02,_0x47e97f)[_0xde3e('0xc')](function(_0x76daf5){logger['info'](_0xde3e('0xd'),_0x4c4ac6,_0xde3e('0xe'));logger[_0xde3e('0xf')](_0xde3e('0x10'),_0x4c4ac6,'request\x20sent',JSON[_0xde3e('0x11')](_0x76daf5));if(_0x76daf5[_0xde3e('0x12')]){if(_0x76daf5['error'][_0xde3e('0x13')]===0x1f4){logger[_0xde3e('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4c4ac6,_0x76daf5[_0xde3e('0x12')]['message']);return _0x3b1597(_0x76daf5[_0xde3e('0x12')][_0xde3e('0x14')]);}logger[_0xde3e('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4c4ac6,_0x76daf5[_0xde3e('0x12')][_0xde3e('0x14')]);return _0x3e0bb4(_0x76daf5['error']['message']);}else{logger[_0xde3e('0x15')](_0xde3e('0xd'),_0x4c4ac6,_0xde3e('0xe'));_0x3e0bb4(_0x76daf5['result']['message']);}})[_0xde3e('0x16')](function(_0x5e041a){logger['error'](_0xde3e('0xd'),_0x4c4ac6,_0x5e041a);_0x3b1597(_0x5e041a);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 27fb186..bbf93fb 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 _0xbb6c=['query','post','create','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get','index','/:id','isAuthenticated','show','preview','/:id/run'];(function(_0x5c3891,_0x284f4c){var _0x34ecda=function(_0x5d0e10){while(--_0x5d0e10){_0x5c3891['push'](_0x5c3891['shift']());}};_0x34ecda(++_0x284f4c);}(_0xbb6c,0xe1));var _0xcbb6=function(_0x1c6a78,_0x3edd58){_0x1c6a78=_0x1c6a78-0x0;var _0x304b4f=_0xbb6c[_0x1c6a78];return _0x304b4f;};'use strict';var multer=require(_0xcbb6('0x0'));var util=require('util');var path=require(_0xcbb6('0x1'));var timeout=require('connect-timeout');var express=require(_0xcbb6('0x2'));var router=express[_0xcbb6('0x3')]();var fs_extra=require(_0xcbb6('0x4'));var auth=require(_0xcbb6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcbb6('0x6'));var controller=require(_0xcbb6('0x7'));router[_0xcbb6('0x8')]('/',auth['isAuthenticated'](),controller[_0xcbb6('0x9')]);router[_0xcbb6('0x8')](_0xcbb6('0xa'),auth[_0xcbb6('0xb')](),controller[_0xcbb6('0xc')]);router[_0xcbb6('0x8')]('/:id/preview',auth['isAuthenticated'](),controller[_0xcbb6('0xd')]);router[_0xcbb6('0x8')](_0xcbb6('0xe'),auth['isAuthenticated'](),controller['run']);router[_0xcbb6('0x8')]('/:id/query',auth[_0xcbb6('0xb')](),controller[_0xcbb6('0xf')]);router[_0xcbb6('0x10')]('/',auth['isAuthenticated'](),controller[_0xcbb6('0x11')]);router['put']('/:id',auth[_0xcbb6('0xb')](),controller['update']);router['delete'](_0xcbb6('0xa'),auth[_0xcbb6('0xb')](),controller[_0xcbb6('0x12')]);module[_0xcbb6('0x13')]=router; \ No newline at end of file +var _0x706d=['/:id','show','/:id/preview','preview','run','/:id/query','query','post','create','put','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index'];(function(_0x382c73,_0x199cab){var _0x1dd0bf=function(_0x358747){while(--_0x358747){_0x382c73['push'](_0x382c73['shift']());}};_0x1dd0bf(++_0x199cab);}(_0x706d,0x174));var _0xd706=function(_0x3f208a,_0x42a861){_0x3f208a=_0x3f208a-0x0;var _0x3af1d4=_0x706d[_0x3f208a];return _0x3af1d4;};'use strict';var multer=require(_0xd706('0x0'));var util=require('util');var path=require(_0xd706('0x1'));var timeout=require(_0xd706('0x2'));var express=require(_0xd706('0x3'));var router=express['Router']();var fs_extra=require(_0xd706('0x4'));var auth=require(_0xd706('0x5'));var interaction=require(_0xd706('0x6'));var config=require(_0xd706('0x7'));var controller=require(_0xd706('0x8'));router[_0xd706('0x9')]('/',auth[_0xd706('0xa')](),controller[_0xd706('0xb')]);router['get'](_0xd706('0xc'),auth[_0xd706('0xa')](),controller[_0xd706('0xd')]);router[_0xd706('0x9')](_0xd706('0xe'),auth[_0xd706('0xa')](),controller[_0xd706('0xf')]);router['get']('/:id/run',auth[_0xd706('0xa')](),controller[_0xd706('0x10')]);router[_0xd706('0x9')](_0xd706('0x11'),auth['isAuthenticated'](),controller[_0xd706('0x12')]);router[_0xd706('0x13')]('/',auth[_0xd706('0xa')](),controller[_0xd706('0x14')]);router[_0xd706('0x15')](_0xd706('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xd706('0x16')](_0xd706('0xc'),auth[_0xd706('0xa')](),controller[_0xd706('0x17')]);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 9002296..6237932 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 _0x6661=['csv','pdf','xlsx','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM'];(function(_0x39ee5b,_0x3e52be){var _0x5b178c=function(_0x56c8f5){while(--_0x56c8f5){_0x39ee5b['push'](_0x39ee5b['shift']());}};_0x5b178c(++_0x3e52be);}(_0x6661,0x1d7));var _0x1666=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x6661[_0x2112d4];return _0x434972;};'use strict';var Sequelize=require(_0x1666('0x0'));var moment=require(_0x1666('0x1'));module[_0x1666('0x2')]={'name':{'type':Sequelize[_0x1666('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x1666('0x4')](_0x1666('0x5'),_0x1666('0x6'),_0x1666('0x7')),'allowNull':![],'defaultValue':_0x1666('0x5')},'savename':{'type':Sequelize[_0x1666('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x1666('0x8')]},'endDate':{'type':Sequelize[_0x1666('0x8')]},'status':{'type':Sequelize[_0x1666('0x3')],'defaultValue':_0x1666('0x9')},'type':{'type':Sequelize[_0x1666('0x4')](_0x1666('0xa'),_0x1666('0xb')),'allowNull':![],'defaultValue':_0x1666('0xa')},'reportId':{'type':Sequelize[_0x1666('0xc')](0xb)[_0x1666('0xd')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2a06=['moment','exports','STRING','csv','pdf','DATE','Loading','manual','INTEGER','sequelize'];(function(_0x237b41,_0x4639f3){var _0x8544a0=function(_0x1bb11b){while(--_0x1bb11b){_0x237b41['push'](_0x237b41['shift']());}};_0x8544a0(++_0x4639f3);}(_0x2a06,0xd1));var _0x62a0=function(_0x14dd9e,_0x2cafac){_0x14dd9e=_0x14dd9e-0x0;var _0x583c61=_0x2a06[_0x14dd9e];return _0x583c61;};'use strict';var Sequelize=require(_0x62a0('0x0'));var moment=require(_0x62a0('0x1'));module[_0x62a0('0x2')]={'name':{'type':Sequelize[_0x62a0('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x62a0('0x4'),_0x62a0('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0x62a0('0x4')},'savename':{'type':Sequelize[_0x62a0('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x62a0('0x6')]},'endDate':{'type':Sequelize[_0x62a0('0x6')]},'status':{'type':Sequelize[_0x62a0('0x3')],'defaultValue':_0x62a0('0x7')},'type':{'type':Sequelize['ENUM'](_0x62a0('0x8'),'scheduled'),'allowNull':![],'defaultValue':_0x62a0('0x8')},'reportId':{'type':Sequelize[_0x62a0('0x9')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x62a0('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 05f3428..6a42a4e 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 _0xb2ff=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','join','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','root','format','output','toLowerCase','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','end','status','count','offset','limit','json','apply','reject','save','update','then','get','ExtractedReports','UserProfileResource','destroy','error','stack','name','send','index','AnalyticExtractedReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','where','pick','merge','type','filter','options','includeAll','findAll','show','params','find','catch','create','body','role','user','UserProfileSection'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0xb2ff,0xbe));var _0xfb2f=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb2ff[_0x3bf83f];return _0x22c4a9;};'use strict';var pdf=require(_0xfb2f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfb2f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfb2f('0x2'));var rp=require(_0xfb2f('0x3'));var moment=require(_0xfb2f('0x4'));var BPromise=require(_0xfb2f('0x5'));var Mustache=require('mustache');var util=require(_0xfb2f('0x6'));var path=require(_0xfb2f('0x7'));var sox=require(_0xfb2f('0x8'));var csv=require(_0xfb2f('0x9'));var ejs=require(_0xfb2f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfb2f('0xb'));var squel=require(_0xfb2f('0xc'));var crypto=require('crypto');var jsforce=require(_0xfb2f('0xd'));var deskjs=require(_0xfb2f('0xe'));var toCsv=require(_0xfb2f('0x9'));var querystring=require(_0xfb2f('0xf'));var Papa=require(_0xfb2f('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfb2f('0x11'));var as=require(_0xfb2f('0x12'));var hardwareService=require(_0xfb2f('0x13'));var logger=require(_0xfb2f('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfb2f('0x15'))['db'];function respondWithStatusCode(_0x3c58d7,_0x22af20){_0x22af20=_0x22af20||0xcc;return function(_0x105573){if(_0x105573){return _0x3c58d7[_0xfb2f('0x16')](_0x22af20);}return _0x3c58d7['status'](_0x22af20)[_0xfb2f('0x17')]();};}function respondWithResult(_0x2e7f13,_0x43c90f){_0x43c90f=_0x43c90f||0xc8;return function(_0x38f5a0){if(_0x38f5a0){return _0x2e7f13[_0xfb2f('0x18')](_0x43c90f)['json'](_0x38f5a0);}};}function respondWithFilteredResult(_0x3038ce,_0x494538){return function(_0x180fa8){if(_0x180fa8){var _0x85cdbc=_0x180fa8[_0xfb2f('0x19')],_0x1deec1=_0x494538[_0xfb2f('0x1a')],_0x4162e6=_0x494538[_0xfb2f('0x1a')]+_0x494538[_0xfb2f('0x1b')],_0x12873e;if(_0x4162e6>=_0x85cdbc){_0x4162e6=_0x85cdbc;_0x12873e=0xc8;}else{_0x12873e=0xce;}_0x3038ce[_0xfb2f('0x18')](_0x12873e);return _0x3038ce['set']('Content-Range',_0x1deec1+'-'+_0x4162e6+'/'+_0x85cdbc)[_0xfb2f('0x1c')](_0x180fa8);}return null;};}function patchUpdates(_0x108c4e){return function(_0x890dfb){try{jsonpatch[_0xfb2f('0x1d')](_0x890dfb,_0x108c4e,!![]);}catch(_0xbd3cc9){return BPromise[_0xfb2f('0x1e')](_0xbd3cc9);}return _0x890dfb[_0xfb2f('0x1f')]();};}function saveUpdates(_0x554f54,_0x821e20){return function(_0x210e24){if(_0x210e24){return _0x210e24[_0xfb2f('0x20')](_0x554f54)[_0xfb2f('0x21')](function(_0x8e34ef){return _0x8e34ef;});}return null;};}function removeEntity(_0x173e7f,_0x35d0b7){return function(_0x13ce3a){if(_0x13ce3a){return _0x13ce3a['destroy']()[_0xfb2f('0x21')](function(){var _0x9e48fc=_0x13ce3a[_0xfb2f('0x22')]({'plain':!![]});var _0x761add=_0xfb2f('0x23');return db[_0xfb2f('0x24')][_0xfb2f('0x25')]({'where':{'type':_0x761add,'resourceId':_0x9e48fc['id']}})[_0xfb2f('0x21')](function(){return _0x13ce3a;});})[_0xfb2f('0x21')](function(){_0x173e7f[_0xfb2f('0x18')](0xcc)[_0xfb2f('0x17')]();});}};}function handleEntityNotFound(_0x29d56b,_0x3ba7dd){return function(_0x14eb3f){if(!_0x14eb3f){_0x29d56b[_0xfb2f('0x16')](0x194);}return _0x14eb3f;};}function handleError(_0x22ff22,_0x7adba1){_0x7adba1=_0x7adba1||0x1f4;return function(_0x3c969f){logger[_0xfb2f('0x26')](_0x3c969f[_0xfb2f('0x27')]);if(_0x3c969f[_0xfb2f('0x28')]){delete _0x3c969f['name'];}_0x22ff22['status'](_0x7adba1)[_0xfb2f('0x29')](_0x3c969f);};}exports[_0xfb2f('0x2a')]=function(_0x4ebba5,_0x16dd58){var _0x336676={},_0x587f9e={},_0x336906={'count':0x0,'rows':[]};var _0x121d26=_['map'](db[_0xfb2f('0x2b')][_0xfb2f('0x2c')],function(_0x4c28fe){return{'name':_0x4c28fe[_0xfb2f('0x2d')],'type':_0x4c28fe['type'][_0xfb2f('0x2e')]};});_0x587f9e[_0xfb2f('0x2f')]=_[_0xfb2f('0x30')](_0x121d26,_0xfb2f('0x28'));_0x587f9e[_0xfb2f('0x31')]=_[_0xfb2f('0x32')](_0x4ebba5[_0xfb2f('0x31')]);_0x587f9e[_0xfb2f('0x33')]=_[_0xfb2f('0x34')](_0x587f9e[_0xfb2f('0x2f')],_0x587f9e[_0xfb2f('0x31')]);_0x336676[_0xfb2f('0x35')]=_[_0xfb2f('0x34')](_0x587f9e['model'],qs[_0xfb2f('0x36')](_0x4ebba5[_0xfb2f('0x31')][_0xfb2f('0x36')]));_0x336676[_0xfb2f('0x35')]=_0x336676[_0xfb2f('0x35')][_0xfb2f('0x37')]?_0x336676[_0xfb2f('0x35')]:_0x587f9e[_0xfb2f('0x2f')];if(!_0x4ebba5[_0xfb2f('0x31')]['hasOwnProperty']('nolimit')){_0x336676[_0xfb2f('0x1b')]=qs[_0xfb2f('0x1b')](_0x4ebba5[_0xfb2f('0x31')][_0xfb2f('0x1b')]);_0x336676[_0xfb2f('0x1a')]=qs[_0xfb2f('0x1a')](_0x4ebba5[_0xfb2f('0x31')][_0xfb2f('0x1a')]);}_0x336676[_0xfb2f('0x38')]=qs['sort'](_0x4ebba5['query']['sort']);_0x336676[_0xfb2f('0x39')]=qs['filters'](_[_0xfb2f('0x3a')](_0x4ebba5[_0xfb2f('0x31')],_0x587f9e['filters']),_0x121d26);if(_0x4ebba5[_0xfb2f('0x31')]['filter']){_0x336676[_0xfb2f('0x39')]=_[_0xfb2f('0x3b')](_0x336676[_0xfb2f('0x39')],{'$or':_['map'](_0x121d26,function(_0x42a376){if(_0x42a376[_0xfb2f('0x3c')]!=='VIRTUAL'){var _0x55d53a={};_0x55d53a[_0x42a376[_0xfb2f('0x28')]]={'$like':'%'+_0x4ebba5[_0xfb2f('0x31')][_0xfb2f('0x3d')]+'%'};return _0x55d53a;}})});}_0x336676=_['merge']({},_0x336676,_0x4ebba5[_0xfb2f('0x3e')]);var _0x508bc4={'where':_0x336676['where']};return db[_0xfb2f('0x2b')][_0xfb2f('0x19')](_0x508bc4)[_0xfb2f('0x21')](function(_0x44c04e){_0x336906[_0xfb2f('0x19')]=_0x44c04e;if(_0x4ebba5[_0xfb2f('0x31')][_0xfb2f('0x3f')]){_0x336676['include']=[{'all':!![]}];}return db[_0xfb2f('0x2b')][_0xfb2f('0x40')](_0x336676);})[_0xfb2f('0x21')](function(_0x1f8934){_0x336906['rows']=_0x1f8934;return _0x336906;})[_0xfb2f('0x21')](respondWithFilteredResult(_0x16dd58,_0x336676))['catch'](handleError(_0x16dd58,null));};exports[_0xfb2f('0x41')]=function(_0x1f2230,_0x254cf7){var _0x26393b={'raw':!![],'where':{'id':_0x1f2230[_0xfb2f('0x42')]['id']}},_0xbea443={};_0xbea443[_0xfb2f('0x2f')]=_[_0xfb2f('0x32')](db[_0xfb2f('0x2b')][_0xfb2f('0x2c')]);_0xbea443[_0xfb2f('0x31')]=_[_0xfb2f('0x32')](_0x1f2230[_0xfb2f('0x31')]);_0xbea443[_0xfb2f('0x33')]=_[_0xfb2f('0x34')](_0xbea443['model'],_0xbea443['query']);_0x26393b['attributes']=_[_0xfb2f('0x34')](_0xbea443[_0xfb2f('0x2f')],qs[_0xfb2f('0x36')](_0x1f2230['query']['fields']));_0x26393b['attributes']=_0x26393b[_0xfb2f('0x35')][_0xfb2f('0x37')]?_0x26393b[_0xfb2f('0x35')]:_0xbea443['model'];if(_0x1f2230[_0xfb2f('0x31')][_0xfb2f('0x3f')]){_0x26393b['include']=[{'all':!![]}];}_0x26393b=_['merge']({},_0x26393b,_0x1f2230[_0xfb2f('0x3e')]);return db[_0xfb2f('0x2b')][_0xfb2f('0x43')](_0x26393b)['then'](handleEntityNotFound(_0x254cf7,null))[_0xfb2f('0x21')](respondWithResult(_0x254cf7,null))[_0xfb2f('0x44')](handleError(_0x254cf7,null));};exports['create']=function(_0x2f5ad5,_0x115b06){return db[_0xfb2f('0x2b')][_0xfb2f('0x45')](_0x2f5ad5[_0xfb2f('0x46')],{})[_0xfb2f('0x21')](function(_0x3310c9){var _0x173f39=_0x2f5ad5['user']['get']({'plain':!![]});if(!_0x173f39)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x173f39[_0xfb2f('0x47')]===_0xfb2f('0x48')){var _0x4f1e71=_0x3310c9[_0xfb2f('0x22')]({'plain':!![]});var _0x593687=_0xfb2f('0x23');return db[_0xfb2f('0x49')]['find']({'where':{'name':_0x593687,'userProfileId':_0x173f39['userProfileId']},'raw':!![]})[_0xfb2f('0x21')](function(_0x2d60db){if(_0x2d60db&&_0x2d60db[_0xfb2f('0x4a')]===0x0){return db['UserProfileResource'][_0xfb2f('0x45')]({'name':_0x4f1e71[_0xfb2f('0x28')],'resourceId':_0x4f1e71['id'],'type':_0x2d60db[_0xfb2f('0x28')],'sectionId':_0x2d60db['id']},{})['then'](function(){return _0x3310c9;});}else{return _0x3310c9;}})['catch'](function(_0x3569fd){logger['error'](_0xfb2f('0x4b'),_0x3569fd);throw _0x3569fd;});}return _0x3310c9;})[_0xfb2f('0x21')](respondWithResult(_0x115b06,0xc9))[_0xfb2f('0x44')](handleError(_0x115b06,null));};exports[_0xfb2f('0x20')]=function(_0xfe9c4e,_0x611b29){if(_0xfe9c4e[_0xfb2f('0x46')]['id']){delete _0xfe9c4e[_0xfb2f('0x46')]['id'];}return db['AnalyticExtractedReport'][_0xfb2f('0x43')]({'where':{'id':_0xfe9c4e[_0xfb2f('0x42')]['id']}})[_0xfb2f('0x21')](handleEntityNotFound(_0x611b29,null))[_0xfb2f('0x21')](saveUpdates(_0xfe9c4e[_0xfb2f('0x46')],null))[_0xfb2f('0x21')](respondWithResult(_0x611b29,null))[_0xfb2f('0x44')](handleError(_0x611b29,null));};exports[_0xfb2f('0x25')]=function(_0x3df49d,_0x467662){return db['AnalyticExtractedReport'][_0xfb2f('0x43')]({'where':{'id':_0x3df49d[_0xfb2f('0x42')]['id']}})['then'](handleEntityNotFound(_0x467662,null))[_0xfb2f('0x21')](removeEntity(_0x467662,null))[_0xfb2f('0x44')](handleError(_0x467662,null));};exports[_0xfb2f('0x4c')]=function(_0x2465a3,_0x3bc4fb,_0x1bfbfc){return db['AnalyticExtractedReport'][_0xfb2f('0x43')]({'where':{'id':_0x2465a3[_0xfb2f('0x42')]['id']},'attributes':[_0xfb2f('0x28'),_0xfb2f('0x4d'),_0xfb2f('0x4e'),'output'],'raw':!![]})[_0xfb2f('0x21')](handleEntityNotFound(_0x3bc4fb,null))[_0xfb2f('0x21')](function(_0x1f98b3){if(_0x1f98b3){if(!fs['existsSync'](path[_0xfb2f('0x4f')](config['root'],_0xfb2f('0x50'),_0x1f98b3[_0xfb2f('0x4e')]))){throw new db[(_0xfb2f('0x51'))][(_0xfb2f('0x52'))](_0xfb2f('0x53'));}if(_0x2465a3[_0xfb2f('0x31')]['exists']){return _0x3bc4fb['sendStatus'](0xc8);}return _0x3bc4fb[_0xfb2f('0x4c')](path[_0xfb2f('0x4f')](config[_0xfb2f('0x54')],_0xfb2f('0x50'),_0x1f98b3[_0xfb2f('0x4e')]),util[_0xfb2f('0x55')]('%s.%s',_0x1f98b3[_0xfb2f('0x4d')]||_0x1f98b3[_0xfb2f('0x28')],_0x1f98b3[_0xfb2f('0x56')][_0xfb2f('0x57')]()));}})['catch'](handleError(_0x3bc4fb,null));}; \ No newline at end of file +var _0x65c2=['stack','name','index','map','AnalyticExtractedReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','rawAttributes','length','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','savename','join','root','Report\x20not\x20found\x20or\x20empty','exists','download','format','%s.%s','output','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','mustache','sox','ejs','fs-extra','lodash','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error'];(function(_0x15ab62,_0x23feb1){var _0x182543=function(_0x510ef0){while(--_0x510ef0){_0x15ab62['push'](_0x15ab62['shift']());}};_0x182543(++_0x23feb1);}(_0x65c2,0x92));var _0x265c=function(_0x37f0e2,_0x27c5d3){_0x37f0e2=_0x37f0e2-0x0;var _0x3eeb75=_0x65c2[_0x37f0e2];return _0x3eeb75;};'use strict';var pdf=require(_0x265c('0x0'));var emlformat=require(_0x265c('0x1'));var rimraf=require(_0x265c('0x2'));var zipdir=require(_0x265c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x265c('0x4'));var util=require('util');var path=require('path');var sox=require(_0x265c('0x5'));var csv=require('to-csv');var ejs=require(_0x265c('0x6'));var fs=require('fs');var fs_extra=require(_0x265c('0x7'));var _=require(_0x265c('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x265c('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x265c('0xa'));var Papa=require('papaparse');var Redis=require(_0x265c('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x265c('0xc'));var as=require(_0x265c('0xd'));var hardwareService=require(_0x265c('0xe'));var logger=require(_0x265c('0xf'))(_0x265c('0x10'));var utils=require(_0x265c('0x11'));var config=require(_0x265c('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17440f,_0x158c1d){_0x158c1d=_0x158c1d||0xcc;return function(_0x35ae7f){if(_0x35ae7f){return _0x17440f[_0x265c('0x13')](_0x158c1d);}return _0x17440f[_0x265c('0x14')](_0x158c1d)[_0x265c('0x15')]();};}function respondWithResult(_0x2ee295,_0x4b9463){_0x4b9463=_0x4b9463||0xc8;return function(_0x49aae5){if(_0x49aae5){return _0x2ee295[_0x265c('0x14')](_0x4b9463)[_0x265c('0x16')](_0x49aae5);}};}function respondWithFilteredResult(_0x1465b8,_0x7ce747){return function(_0x257466){if(_0x257466){var _0xfbad24=_0x257466[_0x265c('0x17')],_0x1ab230=_0x7ce747[_0x265c('0x18')],_0x21a391=_0x7ce747[_0x265c('0x18')]+_0x7ce747['limit'],_0x17372d;if(_0x21a391>=_0xfbad24){_0x21a391=_0xfbad24;_0x17372d=0xc8;}else{_0x17372d=0xce;}_0x1465b8[_0x265c('0x14')](_0x17372d);return _0x1465b8['set'](_0x265c('0x19'),_0x1ab230+'-'+_0x21a391+'/'+_0xfbad24)[_0x265c('0x16')](_0x257466);}return null;};}function patchUpdates(_0x301adf){return function(_0x9b3719){try{jsonpatch[_0x265c('0x1a')](_0x9b3719,_0x301adf,!![]);}catch(_0x46975c){return BPromise[_0x265c('0x1b')](_0x46975c);}return _0x9b3719[_0x265c('0x1c')]();};}function saveUpdates(_0xd5cf96,_0x57c71a){return function(_0x30e089){if(_0x30e089){return _0x30e089[_0x265c('0x1d')](_0xd5cf96)[_0x265c('0x1e')](function(_0x13f793){return _0x13f793;});}return null;};}function removeEntity(_0x463b95,_0x3370c5){return function(_0x5c0901){if(_0x5c0901){return _0x5c0901[_0x265c('0x1f')]()[_0x265c('0x1e')](function(){var _0x16a3eb=_0x5c0901['get']({'plain':!![]});var _0x25d4d3='ExtractedReports';return db[_0x265c('0x20')][_0x265c('0x1f')]({'where':{'type':_0x25d4d3,'resourceId':_0x16a3eb['id']}})[_0x265c('0x1e')](function(){return _0x5c0901;});})[_0x265c('0x1e')](function(){_0x463b95[_0x265c('0x14')](0xcc)[_0x265c('0x15')]();});}};}function handleEntityNotFound(_0x4518f4,_0x240c1e){return function(_0x445f00){if(!_0x445f00){_0x4518f4['sendStatus'](0x194);}return _0x445f00;};}function handleError(_0x55e270,_0x5a1bb4){_0x5a1bb4=_0x5a1bb4||0x1f4;return function(_0x96878a){logger[_0x265c('0x21')](_0x96878a[_0x265c('0x22')]);if(_0x96878a[_0x265c('0x23')]){delete _0x96878a[_0x265c('0x23')];}_0x55e270[_0x265c('0x14')](_0x5a1bb4)['send'](_0x96878a);};}exports[_0x265c('0x24')]=function(_0x1d32e1,_0x57df82){var _0x148a37={},_0x49732a={},_0x5268c0={'count':0x0,'rows':[]};var _0x5308f3=_[_0x265c('0x25')](db[_0x265c('0x26')]['rawAttributes'],function(_0x13a9dd){return{'name':_0x13a9dd[_0x265c('0x27')],'type':_0x13a9dd[_0x265c('0x28')][_0x265c('0x29')]};});_0x49732a[_0x265c('0x2a')]=_['map'](_0x5308f3,'name');_0x49732a[_0x265c('0x2b')]=_[_0x265c('0x2c')](_0x1d32e1[_0x265c('0x2b')]);_0x49732a[_0x265c('0x2d')]=_[_0x265c('0x2e')](_0x49732a[_0x265c('0x2a')],_0x49732a['query']);_0x148a37[_0x265c('0x2f')]=_[_0x265c('0x2e')](_0x49732a['model'],qs[_0x265c('0x30')](_0x1d32e1[_0x265c('0x2b')][_0x265c('0x30')]));_0x148a37['attributes']=_0x148a37[_0x265c('0x2f')]['length']?_0x148a37['attributes']:_0x49732a[_0x265c('0x2a')];if(!_0x1d32e1[_0x265c('0x2b')][_0x265c('0x31')](_0x265c('0x32'))){_0x148a37[_0x265c('0x33')]=qs[_0x265c('0x33')](_0x1d32e1['query'][_0x265c('0x33')]);_0x148a37[_0x265c('0x18')]=qs[_0x265c('0x18')](_0x1d32e1[_0x265c('0x2b')]['offset']);}_0x148a37[_0x265c('0x34')]=qs[_0x265c('0x35')](_0x1d32e1[_0x265c('0x2b')][_0x265c('0x35')]);_0x148a37[_0x265c('0x36')]=qs['filters'](_[_0x265c('0x37')](_0x1d32e1[_0x265c('0x2b')],_0x49732a[_0x265c('0x2d')]),_0x5308f3);if(_0x1d32e1[_0x265c('0x2b')][_0x265c('0x38')]){_0x148a37[_0x265c('0x36')]=_[_0x265c('0x39')](_0x148a37['where'],{'$or':_[_0x265c('0x25')](_0x5308f3,function(_0x2b8212){if(_0x2b8212[_0x265c('0x28')]!=='VIRTUAL'){var _0xf029df={};_0xf029df[_0x2b8212[_0x265c('0x23')]]={'$like':'%'+_0x1d32e1[_0x265c('0x2b')][_0x265c('0x38')]+'%'};return _0xf029df;}})});}_0x148a37=_['merge']({},_0x148a37,_0x1d32e1[_0x265c('0x3a')]);var _0x3dd4be={'where':_0x148a37['where']};return db[_0x265c('0x26')][_0x265c('0x17')](_0x3dd4be)[_0x265c('0x1e')](function(_0x4cf614){_0x5268c0[_0x265c('0x17')]=_0x4cf614;if(_0x1d32e1[_0x265c('0x2b')][_0x265c('0x3b')]){_0x148a37[_0x265c('0x3c')]=[{'all':!![]}];}return db[_0x265c('0x26')][_0x265c('0x3d')](_0x148a37);})[_0x265c('0x1e')](function(_0x23efac){_0x5268c0['rows']=_0x23efac;return _0x5268c0;})[_0x265c('0x1e')](respondWithFilteredResult(_0x57df82,_0x148a37))['catch'](handleError(_0x57df82,null));};exports[_0x265c('0x3e')]=function(_0x2b4774,_0x228d9b){var _0x21c9cb={'raw':!![],'where':{'id':_0x2b4774[_0x265c('0x3f')]['id']}},_0x422d55={};_0x422d55['model']=_[_0x265c('0x2c')](db[_0x265c('0x26')][_0x265c('0x40')]);_0x422d55[_0x265c('0x2b')]=_[_0x265c('0x2c')](_0x2b4774['query']);_0x422d55[_0x265c('0x2d')]=_['intersection'](_0x422d55[_0x265c('0x2a')],_0x422d55[_0x265c('0x2b')]);_0x21c9cb[_0x265c('0x2f')]=_[_0x265c('0x2e')](_0x422d55[_0x265c('0x2a')],qs['fields'](_0x2b4774[_0x265c('0x2b')]['fields']));_0x21c9cb['attributes']=_0x21c9cb['attributes'][_0x265c('0x41')]?_0x21c9cb[_0x265c('0x2f')]:_0x422d55[_0x265c('0x2a')];if(_0x2b4774[_0x265c('0x2b')][_0x265c('0x3b')]){_0x21c9cb[_0x265c('0x3c')]=[{'all':!![]}];}_0x21c9cb=_[_0x265c('0x39')]({},_0x21c9cb,_0x2b4774[_0x265c('0x3a')]);return db['AnalyticExtractedReport']['find'](_0x21c9cb)[_0x265c('0x1e')](handleEntityNotFound(_0x228d9b,null))[_0x265c('0x1e')](respondWithResult(_0x228d9b,null))[_0x265c('0x42')](handleError(_0x228d9b,null));};exports[_0x265c('0x43')]=function(_0x2e9ece,_0x338cb2){return db[_0x265c('0x26')][_0x265c('0x43')](_0x2e9ece[_0x265c('0x44')],{})[_0x265c('0x1e')](function(_0x770445){var _0x53bcf6=_0x2e9ece[_0x265c('0x45')][_0x265c('0x46')]({'plain':!![]});if(!_0x53bcf6)throw new Error(_0x265c('0x47'));if(_0x53bcf6[_0x265c('0x48')]==='user'){var _0x2ef436=_0x770445['get']({'plain':!![]});var _0x47fa45=_0x265c('0x49');return db[_0x265c('0x4a')][_0x265c('0x4b')]({'where':{'name':_0x47fa45,'userProfileId':_0x53bcf6[_0x265c('0x4c')]},'raw':!![]})[_0x265c('0x1e')](function(_0x17628d){if(_0x17628d&&_0x17628d[_0x265c('0x4d')]===0x0){return db[_0x265c('0x20')][_0x265c('0x43')]({'name':_0x2ef436['name'],'resourceId':_0x2ef436['id'],'type':_0x17628d[_0x265c('0x23')],'sectionId':_0x17628d['id']},{})[_0x265c('0x1e')](function(){return _0x770445;});}else{return _0x770445;}})[_0x265c('0x42')](function(_0x412656){logger[_0x265c('0x21')](_0x265c('0x4e'),_0x412656);throw _0x412656;});}return _0x770445;})[_0x265c('0x1e')](respondWithResult(_0x338cb2,0xc9))['catch'](handleError(_0x338cb2,null));};exports['update']=function(_0x4d6190,_0x1120bc){if(_0x4d6190['body']['id']){delete _0x4d6190[_0x265c('0x44')]['id'];}return db[_0x265c('0x26')][_0x265c('0x4b')]({'where':{'id':_0x4d6190[_0x265c('0x3f')]['id']}})[_0x265c('0x1e')](handleEntityNotFound(_0x1120bc,null))['then'](saveUpdates(_0x4d6190['body'],null))[_0x265c('0x1e')](respondWithResult(_0x1120bc,null))['catch'](handleError(_0x1120bc,null));};exports[_0x265c('0x1f')]=function(_0x56dbf5,_0x390001){return db[_0x265c('0x26')][_0x265c('0x4b')]({'where':{'id':_0x56dbf5[_0x265c('0x3f')]['id']}})[_0x265c('0x1e')](handleEntityNotFound(_0x390001,null))[_0x265c('0x1e')](removeEntity(_0x390001,null))[_0x265c('0x42')](handleError(_0x390001,null));};exports['download']=function(_0xfbfe95,_0x5f4e68,_0x375dd5){return db[_0x265c('0x26')]['find']({'where':{'id':_0xfbfe95['params']['id']},'attributes':[_0x265c('0x23'),_0x265c('0x4f'),_0x265c('0x50'),'output'],'raw':!![]})[_0x265c('0x1e')](handleEntityNotFound(_0x5f4e68,null))['then'](function(_0x1020de){if(_0x1020de){if(!fs['existsSync'](path[_0x265c('0x51')](config[_0x265c('0x52')],'server/files/reports',_0x1020de[_0x265c('0x50')]))){throw new db['Sequelize']['ValidationError'](_0x265c('0x53'));}if(_0xfbfe95['query'][_0x265c('0x54')]){return _0x5f4e68[_0x265c('0x13')](0xc8);}return _0x5f4e68[_0x265c('0x55')](path[_0x265c('0x51')](config[_0x265c('0x52')],'server/files/reports',_0x1020de['savename']),util[_0x265c('0x56')](_0x265c('0x57'),_0x1020de[_0x265c('0x4f')]||_0x1020de[_0x265c('0x23')],_0x1020de[_0x265c('0x58')][_0x265c('0x59')]()));}})[_0x265c('0x42')](handleError(_0x5f4e68,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index f27fb11..68d90c9 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 _0x28da=['exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes'];(function(_0x5a0c34,_0x253025){var _0x19ed37=function(_0x425b89){while(--_0x425b89){_0x5a0c34['push'](_0x5a0c34['shift']());}};_0x19ed37(++_0x253025);}(_0x28da,0x9e));var _0xa28d=function(_0x281d9c,_0x4aa520){_0x281d9c=_0x281d9c-0x0;var _0x2a6149=_0x28da[_0x281d9c];return _0x2a6149;};'use strict';var _=require(_0xa28d('0x0'));var util=require(_0xa28d('0x1'));var logger=require(_0xa28d('0x2'))(_0xa28d('0x3'));var moment=require(_0xa28d('0x4'));var BPromise=require(_0xa28d('0x5'));var rp=require(_0xa28d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa28d('0x7'));var config=require(_0xa28d('0x8'));var attributes=require(_0xa28d('0x9'));module[_0xa28d('0xa')]=function(_0x5e7e3c,_0x66d19e){return _0x5e7e3c[_0xa28d('0xb')]('AnalyticExtractedReport',attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a35=['define','AnalyticExtractedReport','analytics_extracted_reports','lodash','../../config/logger','api','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports'];(function(_0x5de445,_0x6556a){var _0x57b8c4=function(_0x27b039){while(--_0x27b039){_0x5de445['push'](_0x5de445['shift']());}};_0x57b8c4(++_0x6556a);}(_0x7a35,0x1c5));var _0x57a3=function(_0x50ffbb,_0x21a925){_0x50ffbb=_0x50ffbb-0x0;var _0x576a1c=_0x7a35[_0x50ffbb];return _0x576a1c;};'use strict';var _=require(_0x57a3('0x0'));var util=require('util');var logger=require(_0x57a3('0x1'))(_0x57a3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x57a3('0x3'));var config=require(_0x57a3('0x4'));var attributes=require(_0x57a3('0x5'));module[_0x57a3('0x6')]=function(_0x2363bf,_0x1330f9){return _0x2363bf[_0x57a3('0x7')](_0x57a3('0x8'),attributes,{'tableName':_0x57a3('0x9'),'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 b5f879f..5b0c182 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 _0x7739=['debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x7739,0xdb));var _0x9773=function(_0x4460bd,_0x18f742){_0x4460bd=_0x4460bd-0x0;var _0x40a92b=_0x7739[_0x4460bd];return _0x40a92b;};'use strict';var _=require(_0x9773('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9773('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9773('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9773('0x3'))('rpc');var config=require(_0x9773('0x4'));var jayson=require(_0x9773('0x5'));var client=jayson[_0x9773('0x6')][_0x9773('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x442166,_0x33dc53,_0xac1ba7){return new BPromise(function(_0x406c39,_0x434133){return client[_0x9773('0x8')](_0x442166,_0xac1ba7)[_0x9773('0x9')](function(_0xaa2950){logger[_0x9773('0xa')](_0x9773('0xb'),_0x33dc53,'request\x20sent');logger[_0x9773('0xc')](_0x9773('0xd'),_0x33dc53,_0x9773('0xe'),JSON[_0x9773('0xf')](_0xaa2950));if(_0xaa2950['error']){if(_0xaa2950[_0x9773('0x10')][_0x9773('0x11')]===0x1f4){logger[_0x9773('0x10')](_0x9773('0xb'),_0x33dc53,_0xaa2950[_0x9773('0x10')][_0x9773('0x12')]);return _0x434133(_0xaa2950[_0x9773('0x10')]['message']);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x33dc53,_0xaa2950[_0x9773('0x10')][_0x9773('0x12')]);return _0x406c39(_0xaa2950[_0x9773('0x10')][_0x9773('0x12')]);}else{logger[_0x9773('0xa')](_0x9773('0xb'),_0x33dc53,'request\x20sent');_0x406c39(_0xaa2950[_0x9773('0x13')][_0x9773('0x12')]);}})[_0x9773('0x14')](function(_0x1ad93a){logger[_0x9773('0x10')](_0x9773('0xb'),_0x33dc53,_0x1ad93a);_0x434133(_0x1ad93a);});});} \ No newline at end of file +var _0x6d08=['error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x507bff,_0x3ce65b){var _0x714b98=function(_0x3997f9){while(--_0x3997f9){_0x507bff['push'](_0x507bff['shift']());}};_0x714b98(++_0x3ce65b);}(_0x6d08,0x1b5));var _0x86d0=function(_0x560cd8,_0x126e2f){_0x560cd8=_0x560cd8-0x0;var _0x369de0=_0x6d08[_0x560cd8];return _0x369de0;};'use strict';var _=require(_0x86d0('0x0'));var util=require(_0x86d0('0x1'));var moment=require(_0x86d0('0x2'));var BPromise=require(_0x86d0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x86d0('0x4'));var db=require(_0x86d0('0x5'))['db'];var utils=require(_0x86d0('0x6'));var logger=require(_0x86d0('0x7'))(_0x86d0('0x8'));var config=require('../../config/environment');var jayson=require(_0x86d0('0x9'));var client=jayson[_0x86d0('0xa')][_0x86d0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d1331,_0xf14b7c,_0x29b1e9){return new BPromise(function(_0x30022c,_0xcf26d6){return client[_0x86d0('0xc')](_0x3d1331,_0x29b1e9)[_0x86d0('0xd')](function(_0x21fab2){logger['info'](_0x86d0('0xe'),_0xf14b7c,_0x86d0('0xf'));logger[_0x86d0('0x10')](_0x86d0('0x11'),_0xf14b7c,_0x86d0('0xf'),JSON[_0x86d0('0x12')](_0x21fab2));if(_0x21fab2['error']){if(_0x21fab2['error']['code']===0x1f4){logger[_0x86d0('0x13')](_0x86d0('0xe'),_0xf14b7c,_0x21fab2[_0x86d0('0x13')]['message']);return _0xcf26d6(_0x21fab2[_0x86d0('0x13')][_0x86d0('0x14')]);}logger[_0x86d0('0x13')](_0x86d0('0xe'),_0xf14b7c,_0x21fab2[_0x86d0('0x13')][_0x86d0('0x14')]);return _0x30022c(_0x21fab2[_0x86d0('0x13')][_0x86d0('0x14')]);}else{logger[_0x86d0('0x15')](_0x86d0('0xe'),_0xf14b7c,'request\x20sent');_0x30022c(_0x21fab2[_0x86d0('0x16')][_0x86d0('0x14')]);}})[_0x86d0('0x17')](function(_0x2d81f2){logger[_0x86d0('0x13')](_0x86d0('0xe'),_0xf14b7c,_0x2d81f2);_0xcf26d6(_0x2d81f2);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index dbc3ca0..d78c023 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 _0x4fd7=['get','index','/:id','isAuthenticated','show','download','post','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x368d42,_0x5eb5ae){var _0x26da06=function(_0x3823f1){while(--_0x3823f1){_0x368d42['push'](_0x368d42['shift']());}};_0x26da06(++_0x5eb5ae);}(_0x4fd7,0x107));var _0x74fd=function(_0x4499d8,_0x2fb36e){_0x4499d8=_0x4499d8-0x0;var _0x1fd257=_0x4fd7[_0x4499d8];return _0x1fd257;};'use strict';var multer=require(_0x74fd('0x0'));var util=require(_0x74fd('0x1'));var path=require(_0x74fd('0x2'));var timeout=require('connect-timeout');var express=require(_0x74fd('0x3'));var router=express[_0x74fd('0x4')]();var fs_extra=require(_0x74fd('0x5'));var auth=require(_0x74fd('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0x74fd('0x7')]('/',auth['isAuthenticated'](),controller[_0x74fd('0x8')]);router['get'](_0x74fd('0x9'),auth[_0x74fd('0xa')](),controller[_0x74fd('0xb')]);router[_0x74fd('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0x74fd('0xc')]);router[_0x74fd('0xd')]('/',auth[_0x74fd('0xa')](),controller['create']);router[_0x74fd('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x74fd('0xf')]);router[_0x74fd('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x74fd('0x11')]=router; \ No newline at end of file +var _0xa472=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/download','post','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x28f4a3,_0x1e9165){var _0x587861=function(_0x3c4b61){while(--_0x3c4b61){_0x28f4a3['push'](_0x28f4a3['shift']());}};_0x587861(++_0x1e9165);}(_0xa472,0x6c));var _0x2a47=function(_0x373dca,_0x336990){_0x373dca=_0x373dca-0x0;var _0x7a6fe=_0xa472[_0x373dca];return _0x7a6fe;};'use strict';var multer=require(_0x2a47('0x0'));var util=require(_0x2a47('0x1'));var path=require(_0x2a47('0x2'));var timeout=require(_0x2a47('0x3'));var express=require('express');var router=express[_0x2a47('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2a47('0x5'));var interaction=require(_0x2a47('0x6'));var config=require(_0x2a47('0x7'));var controller=require('./analyticExtractedReport.controller');router[_0x2a47('0x8')]('/',auth[_0x2a47('0x9')](),controller[_0x2a47('0xa')]);router[_0x2a47('0x8')]('/:id',auth[_0x2a47('0x9')](),controller[_0x2a47('0xb')]);router[_0x2a47('0x8')](_0x2a47('0xc'),auth['isAuthenticated'](),controller['download']);router[_0x2a47('0xd')]('/',auth[_0x2a47('0x9')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2a47('0xe')]);router[_0x2a47('0xf')](_0x2a47('0x10'),auth[_0x2a47('0x9')](),controller[_0x2a47('0x11')]);module[_0x2a47('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 82bd23e..0c6da3f 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 _0x7217=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x3ac27a,_0x41595a){var _0x29823b=function(_0x17c447){while(--_0x17c447){_0x3ac27a['push'](_0x3ac27a['shift']());}};_0x29823b(++_0x41595a);}(_0x7217,0x19e));var _0x7721=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x7217[_0x298ed3];return _0x5aad28;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'field':{'type':Sequelize[_0x7721('0x1')]},'alias':{'type':Sequelize[_0x7721('0x2')]},'function':{'type':Sequelize[_0x7721('0x2')]},'format':{'type':Sequelize[_0x7721('0x2')]},'groupBy':{'type':Sequelize[_0x7721('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5fc3=['sequelize','exports','STRING','BOOLEAN'];(function(_0x40a91d,_0x565ef0){var _0x2a887e=function(_0x369aa8){while(--_0x369aa8){_0x40a91d['push'](_0x40a91d['shift']());}};_0x2a887e(++_0x565ef0);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3474ac,_0x22d0f7){_0x3474ac=_0x3474ac-0x0;var _0x5345ec=_0x5fc3[_0x3474ac];return _0x5345ec;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x35fc('0x2')]},'function':{'type':Sequelize[_0x35fc('0x2')]},'format':{'type':Sequelize[_0x35fc('0x2')]},'groupBy':{'type':Sequelize[_0x35fc('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x35fc('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index bc09df4..9dacbae 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 _0xc6c3=['apply','reject','save','update','then','destroy','error','stack','send','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','includeAll','findAll','rows','catch','show','params','length','include','merge','options','find','create','bulkCreate','body','bulkDestroy','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc6c3,0x1cc));var _0x3c6c=function(_0x180e04,_0x1c0f31){_0x180e04=_0x180e04-0x0;var _0x37b2f6=_0xc6c3[_0x180e04];return _0x37b2f6;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3c6c('0x0'));var zipdir=require(_0x3c6c('0x1'));var jsonpatch=require(_0x3c6c('0x2'));var rp=require(_0x3c6c('0x3'));var moment=require(_0x3c6c('0x4'));var BPromise=require(_0x3c6c('0x5'));var Mustache=require(_0x3c6c('0x6'));var util=require(_0x3c6c('0x7'));var path=require(_0x3c6c('0x8'));var sox=require(_0x3c6c('0x9'));var csv=require(_0x3c6c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3c6c('0xb'));var squel=require(_0x3c6c('0xc'));var crypto=require('crypto');var jsforce=require(_0x3c6c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3c6c('0xa'));var querystring=require(_0x3c6c('0xe'));var Papa=require(_0x3c6c('0xf'));var Redis=require('ioredis');var authService=require(_0x3c6c('0x10'));var qs=require(_0x3c6c('0x11'));var as=require(_0x3c6c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c6c('0x13'))(_0x3c6c('0x14'));var utils=require('../../config/utils');var config=require(_0x3c6c('0x15'));var licenseUtil=require(_0x3c6c('0x16'));var db=require(_0x3c6c('0x17'))['db'];function respondWithStatusCode(_0x42f50d,_0x37e4be){_0x37e4be=_0x37e4be||0xcc;return function(_0x59e1a4){if(_0x59e1a4){return _0x42f50d[_0x3c6c('0x18')](_0x37e4be);}return _0x42f50d['status'](_0x37e4be)[_0x3c6c('0x19')]();};}function respondWithResult(_0xec6c0a,_0x5795f8){_0x5795f8=_0x5795f8||0xc8;return function(_0x414b93){if(_0x414b93){return _0xec6c0a[_0x3c6c('0x1a')](_0x5795f8)[_0x3c6c('0x1b')](_0x414b93);}};}function respondWithFilteredResult(_0x3276ba,_0x3f7c54){return function(_0x5164a7){if(_0x5164a7){var _0x27c489=_0x5164a7[_0x3c6c('0x1c')],_0x2d0374=_0x3f7c54['offset'],_0x398a2c=_0x3f7c54[_0x3c6c('0x1d')]+_0x3f7c54[_0x3c6c('0x1e')],_0x41d3eb;if(_0x398a2c>=_0x27c489){_0x398a2c=_0x27c489;_0x41d3eb=0xc8;}else{_0x41d3eb=0xce;}_0x3276ba[_0x3c6c('0x1a')](_0x41d3eb);return _0x3276ba['set'](_0x3c6c('0x1f'),_0x2d0374+'-'+_0x398a2c+'/'+_0x27c489)['json'](_0x5164a7);}return null;};}function patchUpdates(_0x30f9b5){return function(_0x1ad18e){try{jsonpatch[_0x3c6c('0x20')](_0x1ad18e,_0x30f9b5,!![]);}catch(_0x4292d4){return BPromise[_0x3c6c('0x21')](_0x4292d4);}return _0x1ad18e[_0x3c6c('0x22')]();};}function saveUpdates(_0x53b97a,_0x20dc17){return function(_0xc9c5ae){if(_0xc9c5ae){return _0xc9c5ae[_0x3c6c('0x23')](_0x53b97a)[_0x3c6c('0x24')](function(_0x62df4f){return _0x62df4f;});}return null;};}function removeEntity(_0x466877,_0x3221e0){return function(_0x24fede){if(_0x24fede){return _0x24fede[_0x3c6c('0x25')]()[_0x3c6c('0x24')](function(){_0x466877[_0x3c6c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28b5de,_0x554190){return function(_0x128eeb){if(!_0x128eeb){_0x28b5de[_0x3c6c('0x18')](0x194);}return _0x128eeb;};}function handleError(_0x547db0,_0x2a092e){_0x2a092e=_0x2a092e||0x1f4;return function(_0x83fdae){logger[_0x3c6c('0x26')](_0x83fdae[_0x3c6c('0x27')]);if(_0x83fdae['name']){delete _0x83fdae['name'];}_0x547db0['status'](_0x2a092e)[_0x3c6c('0x28')](_0x83fdae);};}exports['index']=function(_0x513029,_0x5b6347){var _0x2df226={},_0x21b74f={},_0x140c40={'count':0x0,'rows':[]};var _0x591401=_[_0x3c6c('0x29')](db[_0x3c6c('0x2a')][_0x3c6c('0x2b')],function(_0x347059){return{'name':_0x347059[_0x3c6c('0x2c')],'type':_0x347059[_0x3c6c('0x2d')][_0x3c6c('0x2e')]};});_0x21b74f['model']=_['map'](_0x591401,_0x3c6c('0x2f'));_0x21b74f[_0x3c6c('0x30')]=_[_0x3c6c('0x31')](_0x513029[_0x3c6c('0x30')]);_0x21b74f[_0x3c6c('0x32')]=_[_0x3c6c('0x33')](_0x21b74f[_0x3c6c('0x34')],_0x21b74f[_0x3c6c('0x30')]);_0x2df226['attributes']=_[_0x3c6c('0x33')](_0x21b74f['model'],qs[_0x3c6c('0x35')](_0x513029[_0x3c6c('0x30')][_0x3c6c('0x35')]));_0x2df226[_0x3c6c('0x36')]=_0x2df226[_0x3c6c('0x36')]['length']?_0x2df226[_0x3c6c('0x36')]:_0x21b74f[_0x3c6c('0x34')];if(!_0x513029['query'][_0x3c6c('0x37')](_0x3c6c('0x38'))){_0x2df226[_0x3c6c('0x1e')]=qs[_0x3c6c('0x1e')](_0x513029['query'][_0x3c6c('0x1e')]);_0x2df226['offset']=qs['offset'](_0x513029[_0x3c6c('0x30')][_0x3c6c('0x1d')]);}_0x2df226[_0x3c6c('0x39')]=qs['sort'](_0x513029[_0x3c6c('0x30')][_0x3c6c('0x3a')]);_0x2df226[_0x3c6c('0x3b')]=qs[_0x3c6c('0x32')](_[_0x3c6c('0x3c')](_0x513029[_0x3c6c('0x30')],_0x21b74f[_0x3c6c('0x32')]),_0x591401);if(_0x513029[_0x3c6c('0x30')][_0x3c6c('0x3d')]){_0x2df226[_0x3c6c('0x3b')]=_['merge'](_0x2df226[_0x3c6c('0x3b')],{'$or':_[_0x3c6c('0x29')](_0x591401,function(_0xac0bf2){if(_0xac0bf2[_0x3c6c('0x2d')]!=='VIRTUAL'){var _0x5bf8dc={};_0x5bf8dc[_0xac0bf2[_0x3c6c('0x2f')]]={'$like':'%'+_0x513029[_0x3c6c('0x30')][_0x3c6c('0x3d')]+'%'};return _0x5bf8dc;}})});}_0x2df226=_['merge']({},_0x2df226,_0x513029['options']);var _0x21ef89={'where':_0x2df226['where']};return db[_0x3c6c('0x2a')]['count'](_0x21ef89)[_0x3c6c('0x24')](function(_0x49ab4e){_0x140c40[_0x3c6c('0x1c')]=_0x49ab4e;if(_0x513029[_0x3c6c('0x30')][_0x3c6c('0x3e')]){_0x2df226['include']=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x3c6c('0x3f')](_0x2df226);})[_0x3c6c('0x24')](function(_0x4bc0c4){_0x140c40[_0x3c6c('0x40')]=_0x4bc0c4;return _0x140c40;})[_0x3c6c('0x24')](respondWithFilteredResult(_0x5b6347,_0x2df226))[_0x3c6c('0x41')](handleError(_0x5b6347,null));};exports[_0x3c6c('0x42')]=function(_0x34daf4,_0x39bf9a){var _0x40bf8f={'raw':![],'where':{'id':_0x34daf4[_0x3c6c('0x43')]['id']}},_0x2b05df={};_0x2b05df[_0x3c6c('0x34')]=_[_0x3c6c('0x31')](db[_0x3c6c('0x2a')]['rawAttributes']);_0x2b05df[_0x3c6c('0x30')]=_['keys'](_0x34daf4[_0x3c6c('0x30')]);_0x2b05df[_0x3c6c('0x32')]=_[_0x3c6c('0x33')](_0x2b05df[_0x3c6c('0x34')],_0x2b05df[_0x3c6c('0x30')]);_0x40bf8f['attributes']=_[_0x3c6c('0x33')](_0x2b05df[_0x3c6c('0x34')],qs[_0x3c6c('0x35')](_0x34daf4[_0x3c6c('0x30')][_0x3c6c('0x35')]));_0x40bf8f[_0x3c6c('0x36')]=_0x40bf8f['attributes'][_0x3c6c('0x44')]?_0x40bf8f[_0x3c6c('0x36')]:_0x2b05df[_0x3c6c('0x34')];if(_0x34daf4[_0x3c6c('0x30')]['includeAll']){_0x40bf8f[_0x3c6c('0x45')]=[{'all':!![]}];}_0x40bf8f=_[_0x3c6c('0x46')]({},_0x40bf8f,_0x34daf4[_0x3c6c('0x47')]);return db[_0x3c6c('0x2a')][_0x3c6c('0x48')](_0x40bf8f)[_0x3c6c('0x24')](handleEntityNotFound(_0x39bf9a,null))[_0x3c6c('0x24')](respondWithResult(_0x39bf9a,null))[_0x3c6c('0x41')](handleError(_0x39bf9a,null));};exports['create']=function(_0x4b9431,_0x8a205e){return db['AnalyticFieldReport'][_0x3c6c('0x49')](_0x4b9431['body'],{})['then'](respondWithResult(_0x8a205e,0xc9))[_0x3c6c('0x41')](handleError(_0x8a205e,null));};exports[_0x3c6c('0x4a')]=function(_0x5c5a9e,_0x622fde){return db['AnalyticFieldReport'][_0x3c6c('0x4a')](_0x5c5a9e[_0x3c6c('0x4b')],{'raw':![],'individualHooks':!![]})[_0x3c6c('0x24')](respondWithResult(_0x622fde,0xc9))[_0x3c6c('0x41')](handleError(_0x622fde,null));};exports[_0x3c6c('0x23')]=function(_0x58a2ba,_0x298b9f){if(_0x58a2ba[_0x3c6c('0x4b')]['id']){delete _0x58a2ba[_0x3c6c('0x4b')]['id'];}return db['AnalyticFieldReport'][_0x3c6c('0x48')]({'where':{'id':_0x58a2ba[_0x3c6c('0x43')]['id']}})[_0x3c6c('0x24')](handleEntityNotFound(_0x298b9f,null))[_0x3c6c('0x24')](saveUpdates(_0x58a2ba[_0x3c6c('0x4b')],null))['then'](respondWithResult(_0x298b9f,null))[_0x3c6c('0x41')](handleError(_0x298b9f,null));};exports['destroy']=function(_0x480b28,_0x3238cb){return db[_0x3c6c('0x2a')]['find']({'where':{'id':_0x480b28['params']['id']}})[_0x3c6c('0x24')](handleEntityNotFound(_0x3238cb,null))['then'](removeEntity(_0x3238cb,null))[_0x3c6c('0x41')](handleError(_0x3238cb,null));};exports[_0x3c6c('0x4c')]=function(_0x490678,_0x39042d){return db[_0x3c6c('0x2a')][_0x3c6c('0x25')]({'where':{'id':_0x490678[_0x3c6c('0x30')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x3c6c('0x24')](respondWithResult(_0x39042d,0xcc))[_0x3c6c('0x41')](handleError(_0x39042d,null));};exports['addFields']=function(_0x57ad3d,_0x4d8f60,_0x10744b){return db[_0x3c6c('0x4d')][_0x3c6c('0x4e')]({'where':{'id':_0x57ad3d[_0x3c6c('0x43')]['id']}})[_0x3c6c('0x24')](handleEntityNotFound(_0x4d8f60,null))[_0x3c6c('0x24')](function(_0x38f162){if(_0x38f162){return db[_0x3c6c('0x4f')][_0x3c6c('0x50')](function(_0x3b23d6){return db[_0x3c6c('0x2a')]['destroy']({'where':{'CustomReportId':_0x57ad3d[_0x3c6c('0x43')]['id']},'transaction':_0x3b23d6})[_0x3c6c('0x24')](function(_0x86a02c){var _0xb8ce99=_['map'](_0x57ad3d[_0x3c6c('0x4b')],function(_0x59ba9a){delete _0x59ba9a['id'];_0x59ba9a[_0x3c6c('0x51')]=_0x57ad3d[_0x3c6c('0x43')]['id'];return _0x59ba9a;});return db['AnalyticFieldReport'][_0x3c6c('0x4a')](_0xb8ce99,{'transaction':_0x3b23d6});});})[_0x3c6c('0x24')](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x57ad3d[_0x3c6c('0x43')]['id']}});});}})['then'](respondWithResult(_0x4d8f60,null))['catch'](handleError(_0x4d8f60,null));}; \ No newline at end of file +var _0x475f=['key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','intersection','find','create','bulkCreate','body','params','ids','addFields','AnalyticCustomReport','findOne','transaction','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','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','json','count','limit','apply','update','then','destroy','end','sendStatus','error','stack','name','send','map','AnalyticFieldReport','rawAttributes'];(function(_0xfcc030,_0x3ec053){var _0x5caa66=function(_0xf2e6d2){while(--_0xf2e6d2){_0xfcc030['push'](_0xfcc030['shift']());}};_0x5caa66(++_0x3ec053);}(_0x475f,0x112));var _0xf475=function(_0x73e4cf,_0x2a8375){_0x73e4cf=_0x73e4cf-0x0;var _0x1e1bf8=_0x475f[_0x73e4cf];return _0x1e1bf8;};'use strict';var pdf=require(_0xf475('0x0'));var emlformat=require(_0xf475('0x1'));var rimraf=require(_0xf475('0x2'));var zipdir=require(_0xf475('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf475('0x4'));var moment=require(_0xf475('0x5'));var BPromise=require(_0xf475('0x6'));var Mustache=require(_0xf475('0x7'));var util=require(_0xf475('0x8'));var path=require(_0xf475('0x9'));var sox=require(_0xf475('0xa'));var csv=require(_0xf475('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf475('0xc'));var squel=require(_0xf475('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf475('0xb'));var querystring=require('querystring');var Papa=require(_0xf475('0xe'));var Redis=require(_0xf475('0xf'));var authService=require(_0xf475('0x10'));var qs=require(_0xf475('0x11'));var as=require(_0xf475('0x12'));var hardwareService=require(_0xf475('0x13'));var logger=require(_0xf475('0x14'))(_0xf475('0x15'));var utils=require(_0xf475('0x16'));var config=require(_0xf475('0x17'));var licenseUtil=require(_0xf475('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50fb82,_0x5f577e){_0x5f577e=_0x5f577e||0xcc;return function(_0xa65bb){if(_0xa65bb){return _0x50fb82['sendStatus'](_0x5f577e);}return _0x50fb82[_0xf475('0x19')](_0x5f577e)['end']();};}function respondWithResult(_0x59409f,_0x480bb7){_0x480bb7=_0x480bb7||0xc8;return function(_0x2f56fb){if(_0x2f56fb){return _0x59409f[_0xf475('0x19')](_0x480bb7)[_0xf475('0x1a')](_0x2f56fb);}};}function respondWithFilteredResult(_0x36efc4,_0x46332b){return function(_0x4a97ae){if(_0x4a97ae){var _0x577fc4=_0x4a97ae[_0xf475('0x1b')],_0x28f649=_0x46332b['offset'],_0x1f0ac3=_0x46332b['offset']+_0x46332b[_0xf475('0x1c')],_0x2f0ed4;if(_0x1f0ac3>=_0x577fc4){_0x1f0ac3=_0x577fc4;_0x2f0ed4=0xc8;}else{_0x2f0ed4=0xce;}_0x36efc4[_0xf475('0x19')](_0x2f0ed4);return _0x36efc4['set']('Content-Range',_0x28f649+'-'+_0x1f0ac3+'/'+_0x577fc4)[_0xf475('0x1a')](_0x4a97ae);}return null;};}function patchUpdates(_0xcb936f){return function(_0x3d3d2a){try{jsonpatch[_0xf475('0x1d')](_0x3d3d2a,_0xcb936f,!![]);}catch(_0x5981de){return BPromise['reject'](_0x5981de);}return _0x3d3d2a['save']();};}function saveUpdates(_0x15d8cd,_0x3c4ebf){return function(_0x39d950){if(_0x39d950){return _0x39d950[_0xf475('0x1e')](_0x15d8cd)[_0xf475('0x1f')](function(_0x55be4a){return _0x55be4a;});}return null;};}function removeEntity(_0x46a4c9,_0x487247){return function(_0x20d9c4){if(_0x20d9c4){return _0x20d9c4[_0xf475('0x20')]()[_0xf475('0x1f')](function(){_0x46a4c9[_0xf475('0x19')](0xcc)[_0xf475('0x21')]();});}};}function handleEntityNotFound(_0x5febd4,_0x5f1904){return function(_0x2ba680){if(!_0x2ba680){_0x5febd4[_0xf475('0x22')](0x194);}return _0x2ba680;};}function handleError(_0x4be6a4,_0x281284){_0x281284=_0x281284||0x1f4;return function(_0x5497ef){logger[_0xf475('0x23')](_0x5497ef[_0xf475('0x24')]);if(_0x5497ef[_0xf475('0x25')]){delete _0x5497ef[_0xf475('0x25')];}_0x4be6a4['status'](_0x281284)[_0xf475('0x26')](_0x5497ef);};}exports['index']=function(_0x5a35cd,_0x209ec7){var _0x49657e={},_0xfbbfe7={},_0x278bf1={'count':0x0,'rows':[]};var _0x4c8987=_[_0xf475('0x27')](db[_0xf475('0x28')][_0xf475('0x29')],function(_0x375ded){return{'name':_0x375ded['fieldName'],'type':_0x375ded['type'][_0xf475('0x2a')]};});_0xfbbfe7[_0xf475('0x2b')]=_[_0xf475('0x27')](_0x4c8987,_0xf475('0x25'));_0xfbbfe7[_0xf475('0x2c')]=_[_0xf475('0x2d')](_0x5a35cd['query']);_0xfbbfe7[_0xf475('0x2e')]=_['intersection'](_0xfbbfe7[_0xf475('0x2b')],_0xfbbfe7[_0xf475('0x2c')]);_0x49657e[_0xf475('0x2f')]=_['intersection'](_0xfbbfe7[_0xf475('0x2b')],qs['fields'](_0x5a35cd[_0xf475('0x2c')][_0xf475('0x30')]));_0x49657e['attributes']=_0x49657e[_0xf475('0x2f')][_0xf475('0x31')]?_0x49657e[_0xf475('0x2f')]:_0xfbbfe7[_0xf475('0x2b')];if(!_0x5a35cd[_0xf475('0x2c')][_0xf475('0x32')](_0xf475('0x33'))){_0x49657e[_0xf475('0x1c')]=qs[_0xf475('0x1c')](_0x5a35cd[_0xf475('0x2c')][_0xf475('0x1c')]);_0x49657e[_0xf475('0x34')]=qs['offset'](_0x5a35cd[_0xf475('0x2c')][_0xf475('0x34')]);}_0x49657e[_0xf475('0x35')]=qs[_0xf475('0x36')](_0x5a35cd[_0xf475('0x2c')][_0xf475('0x36')]);_0x49657e[_0xf475('0x37')]=qs[_0xf475('0x2e')](_[_0xf475('0x38')](_0x5a35cd[_0xf475('0x2c')],_0xfbbfe7[_0xf475('0x2e')]),_0x4c8987);if(_0x5a35cd[_0xf475('0x2c')]['filter']){_0x49657e['where']=_[_0xf475('0x39')](_0x49657e[_0xf475('0x37')],{'$or':_[_0xf475('0x27')](_0x4c8987,function(_0xc7136c){if(_0xc7136c[_0xf475('0x3a')]!==_0xf475('0x3b')){var _0x1d493e={};_0x1d493e[_0xc7136c[_0xf475('0x25')]]={'$like':'%'+_0x5a35cd[_0xf475('0x2c')][_0xf475('0x3c')]+'%'};return _0x1d493e;}})});}_0x49657e=_[_0xf475('0x39')]({},_0x49657e,_0x5a35cd[_0xf475('0x3d')]);var _0x491b2f={'where':_0x49657e['where']};return db[_0xf475('0x28')][_0xf475('0x1b')](_0x491b2f)['then'](function(_0x216f21){_0x278bf1[_0xf475('0x1b')]=_0x216f21;if(_0x5a35cd[_0xf475('0x2c')][_0xf475('0x3e')]){_0x49657e[_0xf475('0x3f')]=[{'all':!![]}];}return db[_0xf475('0x28')][_0xf475('0x40')](_0x49657e);})[_0xf475('0x1f')](function(_0x3910dd){_0x278bf1[_0xf475('0x41')]=_0x3910dd;return _0x278bf1;})['then'](respondWithFilteredResult(_0x209ec7,_0x49657e))[_0xf475('0x42')](handleError(_0x209ec7,null));};exports[_0xf475('0x43')]=function(_0x34c629,_0x407ccb){var _0x339eb0={'raw':![],'where':{'id':_0x34c629['params']['id']}},_0x9f8ee1={};_0x9f8ee1[_0xf475('0x2b')]=_['keys'](db[_0xf475('0x28')][_0xf475('0x29')]);_0x9f8ee1['query']=_[_0xf475('0x2d')](_0x34c629[_0xf475('0x2c')]);_0x9f8ee1[_0xf475('0x2e')]=_[_0xf475('0x44')](_0x9f8ee1[_0xf475('0x2b')],_0x9f8ee1[_0xf475('0x2c')]);_0x339eb0[_0xf475('0x2f')]=_[_0xf475('0x44')](_0x9f8ee1[_0xf475('0x2b')],qs[_0xf475('0x30')](_0x34c629[_0xf475('0x2c')][_0xf475('0x30')]));_0x339eb0[_0xf475('0x2f')]=_0x339eb0['attributes'][_0xf475('0x31')]?_0x339eb0[_0xf475('0x2f')]:_0x9f8ee1[_0xf475('0x2b')];if(_0x34c629[_0xf475('0x2c')][_0xf475('0x3e')]){_0x339eb0['include']=[{'all':!![]}];}_0x339eb0=_['merge']({},_0x339eb0,_0x34c629[_0xf475('0x3d')]);return db['AnalyticFieldReport'][_0xf475('0x45')](_0x339eb0)[_0xf475('0x1f')](handleEntityNotFound(_0x407ccb,null))[_0xf475('0x1f')](respondWithResult(_0x407ccb,null))[_0xf475('0x42')](handleError(_0x407ccb,null));};exports[_0xf475('0x46')]=function(_0x1d8db4,_0x5685ac){return db['AnalyticFieldReport'][_0xf475('0x46')](_0x1d8db4['body'],{})[_0xf475('0x1f')](respondWithResult(_0x5685ac,0xc9))[_0xf475('0x42')](handleError(_0x5685ac,null));};exports['bulkCreate']=function(_0x27653d,_0xbe0760){return db[_0xf475('0x28')][_0xf475('0x47')](_0x27653d['body'],{'raw':![],'individualHooks':!![]})[_0xf475('0x1f')](respondWithResult(_0xbe0760,0xc9))[_0xf475('0x42')](handleError(_0xbe0760,null));};exports[_0xf475('0x1e')]=function(_0x77ea2c,_0x56d807){if(_0x77ea2c['body']['id']){delete _0x77ea2c[_0xf475('0x48')]['id'];}return db[_0xf475('0x28')][_0xf475('0x45')]({'where':{'id':_0x77ea2c[_0xf475('0x49')]['id']}})[_0xf475('0x1f')](handleEntityNotFound(_0x56d807,null))['then'](saveUpdates(_0x77ea2c[_0xf475('0x48')],null))[_0xf475('0x1f')](respondWithResult(_0x56d807,null))['catch'](handleError(_0x56d807,null));};exports[_0xf475('0x20')]=function(_0x7bdc99,_0x2b48e0){return db[_0xf475('0x28')][_0xf475('0x45')]({'where':{'id':_0x7bdc99[_0xf475('0x49')]['id']}})['then'](handleEntityNotFound(_0x2b48e0,null))[_0xf475('0x1f')](removeEntity(_0x2b48e0,null))[_0xf475('0x42')](handleError(_0x2b48e0,null));};exports['bulkDestroy']=function(_0x39a657,_0x10a680){return db['AnalyticFieldReport'][_0xf475('0x20')]({'where':{'id':_0x39a657['query'][_0xf475('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0xf475('0x1f')](respondWithResult(_0x10a680,0xcc))[_0xf475('0x42')](handleError(_0x10a680,null));};exports[_0xf475('0x4b')]=function(_0x50cc17,_0x4bfc62,_0xbd9c58){return db[_0xf475('0x4c')][_0xf475('0x4d')]({'where':{'id':_0x50cc17[_0xf475('0x49')]['id']}})[_0xf475('0x1f')](handleEntityNotFound(_0x4bfc62,null))['then'](function(_0x529ffa){if(_0x529ffa){return db['sequelize'][_0xf475('0x4e')](function(_0x57b562){return db['AnalyticFieldReport'][_0xf475('0x20')]({'where':{'CustomReportId':_0x50cc17[_0xf475('0x49')]['id']},'transaction':_0x57b562})[_0xf475('0x1f')](function(_0x5b08f7){var _0x29bf14=_['map'](_0x50cc17['body'],function(_0x4c5d51){delete _0x4c5d51['id'];_0x4c5d51['CustomReportId']=_0x50cc17[_0xf475('0x49')]['id'];return _0x4c5d51;});return db['AnalyticFieldReport'][_0xf475('0x47')](_0x29bf14,{'transaction':_0x57b562});});})[_0xf475('0x1f')](function(){return db['AnalyticFieldReport'][_0xf475('0x40')]({'where':{'CustomReportId':_0x50cc17[_0xf475('0x49')]['id']}});});}})[_0xf475('0x1f')](respondWithResult(_0x4bfc62,null))['catch'](handleError(_0x4bfc62,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 55ef236..1910f3a 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 _0x3e80=['../../config/environment','./analyticFieldReport.attributes','define','AnalyticFieldReport','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2002e5,_0x2a35f2){var _0x12dbb5=function(_0x173de4){while(--_0x173de4){_0x2002e5['push'](_0x2002e5['shift']());}};_0x12dbb5(++_0x2a35f2);}(_0x3e80,0x19c));var _0x03e8=function(_0x5f49c0,_0x27a1b4){_0x5f49c0=_0x5f49c0-0x0;var _0x5ab653=_0x3e80[_0x5f49c0];return _0x5ab653;};'use strict';var _=require(_0x03e8('0x0'));var util=require('util');var logger=require(_0x03e8('0x1'))(_0x03e8('0x2'));var moment=require(_0x03e8('0x3'));var BPromise=require(_0x03e8('0x4'));var rp=require(_0x03e8('0x5'));var fs=require('fs');var path=require(_0x03e8('0x6'));var rimraf=require(_0x03e8('0x7'));var config=require(_0x03e8('0x8'));var attributes=require(_0x03e8('0x9'));module['exports']=function(_0x30d972,_0x1277e9){return _0x30d972[_0x03e8('0xa')](_0x03e8('0xb'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63a8=['lodash','util','api','bluebird','request-promise','path','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport'];(function(_0x22548e,_0x172658){var _0x3e6bc1=function(_0x35c582){while(--_0x35c582){_0x22548e['push'](_0x22548e['shift']());}};_0x3e6bc1(++_0x172658);}(_0x63a8,0x1ef));var _0x863a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x63a8[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x863a('0x0'));var util=require(_0x863a('0x1'));var logger=require('../../config/logger')(_0x863a('0x2'));var moment=require('moment');var BPromise=require(_0x863a('0x3'));var rp=require(_0x863a('0x4'));var fs=require('fs');var path=require(_0x863a('0x5'));var rimraf=require('rimraf');var config=require(_0x863a('0x6'));var attributes=require(_0x863a('0x7'));module[_0x863a('0x8')]=function(_0x42cfea,_0x512d99){return _0x42cfea[_0x863a('0x9')](_0x863a('0xa'),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 302ef2d..3fac200 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 _0x88f7=['../../config/environment','client','http','request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x59c23a,_0x4eb28d){var _0x2ce1ae=function(_0x5e7224){while(--_0x5e7224){_0x59c23a['push'](_0x59c23a['shift']());}};_0x2ce1ae(++_0x4eb28d);}(_0x88f7,0x1c8));var _0x788f=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x88f7[_0x288f5e];return _0x476cc9;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x788f('0x0'));var rs=require(_0x788f('0x1'));var fs=require('fs');var Redis=require(_0x788f('0x2'));var db=require(_0x788f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x788f('0x4'))(_0x788f('0x5'));var config=require(_0x788f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x788f('0x7')][_0x788f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f4c8f,_0x49044d,_0x522cfa){return new BPromise(function(_0x507dbe,_0x56dba1){return client[_0x788f('0x9')](_0x5f4c8f,_0x522cfa)[_0x788f('0xa')](function(_0x4f74bd){logger['info'](_0x788f('0xb'),_0x49044d,_0x788f('0xc'));logger[_0x788f('0xd')](_0x788f('0xe'),_0x49044d,_0x788f('0xc'),JSON['stringify'](_0x4f74bd));if(_0x4f74bd[_0x788f('0xf')]){if(_0x4f74bd[_0x788f('0xf')][_0x788f('0x10')]===0x1f4){logger[_0x788f('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x49044d,_0x4f74bd[_0x788f('0xf')][_0x788f('0x11')]);return _0x56dba1(_0x4f74bd[_0x788f('0xf')]['message']);}logger[_0x788f('0xf')](_0x788f('0xb'),_0x49044d,_0x4f74bd['error'][_0x788f('0x11')]);return _0x507dbe(_0x4f74bd[_0x788f('0xf')]['message']);}else{logger[_0x788f('0x12')](_0x788f('0xb'),_0x49044d,_0x788f('0xc'));_0x507dbe(_0x4f74bd[_0x788f('0x13')][_0x788f('0x11')]);}})[_0x788f('0x14')](function(_0x412d1a){logger[_0x788f('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x49044d,_0x412d1a);_0x56dba1(_0x412d1a);});});} \ No newline at end of file +var _0x7ca0=['AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','request','then','info'];(function(_0x4fc6f7,_0xea9941){var _0x216b2e=function(_0xedf2b5){while(--_0xedf2b5){_0x4fc6f7['push'](_0x4fc6f7['shift']());}};_0x216b2e(++_0xea9941);}(_0x7ca0,0x6e));var _0x07ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7ca0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x07ca('0x0'));var moment=require('moment');var BPromise=require(_0x07ca('0x1'));var rs=require(_0x07ca('0x2'));var fs=require('fs');var Redis=require(_0x07ca('0x3'));var db=require(_0x07ca('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x07ca('0x5'));var client=jayson[_0x07ca('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x491a9c,_0x3342ba,_0x4cf2f5){return new BPromise(function(_0x35df07,_0x4e9810){return client[_0x07ca('0x7')](_0x491a9c,_0x4cf2f5)[_0x07ca('0x8')](function(_0x11fdf8){logger[_0x07ca('0x9')](_0x07ca('0xa'),_0x3342ba,'request\x20sent');logger[_0x07ca('0xb')](_0x07ca('0xc'),_0x3342ba,_0x07ca('0xd'),JSON[_0x07ca('0xe')](_0x11fdf8));if(_0x11fdf8[_0x07ca('0xf')]){if(_0x11fdf8['error'][_0x07ca('0x10')]===0x1f4){logger[_0x07ca('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3342ba,_0x11fdf8[_0x07ca('0xf')]['message']);return _0x4e9810(_0x11fdf8[_0x07ca('0xf')][_0x07ca('0x11')]);}logger['error'](_0x07ca('0xa'),_0x3342ba,_0x11fdf8[_0x07ca('0xf')][_0x07ca('0x11')]);return _0x35df07(_0x11fdf8[_0x07ca('0xf')][_0x07ca('0x11')]);}else{logger[_0x07ca('0x9')](_0x07ca('0xa'),_0x3342ba,_0x07ca('0xd'));_0x35df07(_0x11fdf8[_0x07ca('0x12')][_0x07ca('0x11')]);}})[_0x07ca('0x13')](function(_0x47b571){logger['error'](_0x07ca('0xa'),_0x3342ba,_0x47b571);_0x4e9810(_0x47b571);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 4cd1bb4..bb56062 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 _0xa241=['delete','/destroy_many','bulkDestroy','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','show','post','/create_many','bulkCreate','/:id/create_many','addFields','put','/:id'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xa241,0xe6));var _0x1a24=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa241[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require(_0x1a24('0x0'));var path=require(_0x1a24('0x1'));var timeout=require(_0x1a24('0x2'));var express=require(_0x1a24('0x3'));var router=express[_0x1a24('0x4')]();var fs_extra=require(_0x1a24('0x5'));var auth=require(_0x1a24('0x6'));var interaction=require(_0x1a24('0x7'));var config=require(_0x1a24('0x8'));var controller=require(_0x1a24('0x9'));router[_0x1a24('0xa')]('/',auth[_0x1a24('0xb')](),controller['index']);router[_0x1a24('0xa')]('/:id',auth[_0x1a24('0xb')](),controller[_0x1a24('0xc')]);router[_0x1a24('0xd')]('/',auth[_0x1a24('0xb')](),controller['create']);router[_0x1a24('0xd')](_0x1a24('0xe'),auth[_0x1a24('0xb')](),controller[_0x1a24('0xf')]);router[_0x1a24('0xd')](_0x1a24('0x10'),auth['isAuthenticated'](),controller[_0x1a24('0x11')]);router[_0x1a24('0x12')](_0x1a24('0x13'),auth['isAuthenticated'](),controller['update']);router[_0x1a24('0x14')](_0x1a24('0x15'),auth[_0x1a24('0xb')](),controller[_0x1a24('0x16')]);router[_0x1a24('0x14')]('/:id',auth[_0x1a24('0xb')](),controller[_0x1a24('0x17')]);module[_0x1a24('0x18')]=router; \ No newline at end of file +var _0xe17f=['delete','bulkDestroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','/create_many','put','update'];(function(_0x1cb0b4,_0x1fd48d){var _0x525b60=function(_0x1efccc){while(--_0x1efccc){_0x1cb0b4['push'](_0x1cb0b4['shift']());}};_0x525b60(++_0x1fd48d);}(_0xe17f,0x158));var _0xfe17=function(_0xcf66f6,_0x281d62){_0xcf66f6=_0xcf66f6-0x0;var _0x1c6602=_0xe17f[_0xcf66f6];return _0x1c6602;};'use strict';var multer=require(_0xfe17('0x0'));var util=require(_0xfe17('0x1'));var path=require(_0xfe17('0x2'));var timeout=require(_0xfe17('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfe17('0x4'));var auth=require(_0xfe17('0x5'));var interaction=require(_0xfe17('0x6'));var config=require('../../config/environment');var controller=require('./analyticFieldReport.controller');router[_0xfe17('0x7')]('/',auth[_0xfe17('0x8')](),controller[_0xfe17('0x9')]);router[_0xfe17('0x7')](_0xfe17('0xa'),auth['isAuthenticated'](),controller[_0xfe17('0xb')]);router[_0xfe17('0xc')]('/',auth[_0xfe17('0x8')](),controller['create']);router['post'](_0xfe17('0xd'),auth[_0xfe17('0x8')](),controller['bulkCreate']);router[_0xfe17('0xc')]('/:id/create_many',auth[_0xfe17('0x8')](),controller['addFields']);router[_0xfe17('0xe')](_0xfe17('0xa'),auth[_0xfe17('0x8')](),controller[_0xfe17('0xf')]);router[_0xfe17('0x10')]('/destroy_many',auth[_0xfe17('0x8')](),controller[_0xfe17('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 7dde424..9beab5f 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 _0xddd1=['exports','STRING','name'];(function(_0x365d5c,_0x228ae5){var _0x355a64=function(_0xea70d3){while(--_0xea70d3){_0x365d5c['push'](_0x365d5c['shift']());}};_0x355a64(++_0x228ae5);}(_0xddd1,0xab));var _0x1ddd=function(_0x416c1a,_0x19c685){_0x416c1a=_0x416c1a-0x0;var _0xcf7188=_0xddd1[_0x416c1a];return _0xcf7188;};'use strict';var Sequelize=require('sequelize');module[_0x1ddd('0x0')]={'name':{'type':Sequelize[_0x1ddd('0x1')],'allowNull':![],'unique':_0x1ddd('0x2')},'table':{'type':Sequelize[_0x1ddd('0x1')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x573e=['exports','STRING'];(function(_0x585b10,_0x5d038a){var _0x43f4e6=function(_0x5582b3){while(--_0x5582b3){_0x585b10['push'](_0x585b10['shift']());}};_0x43f4e6(++_0x5d038a);}(_0x573e,0x134));var _0xe573=function(_0x46c955,_0x3e316c){_0x46c955=_0x46c955-0x0;var _0x1b4969=_0x573e[_0x46c955];return _0x1b4969;};'use strict';var Sequelize=require('sequelize');module[_0xe573('0x0')]={'name':{'type':Sequelize[_0xe573('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xe573('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 36bf07b..d95a107 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 _0x444e=['body','html-pdf','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','Metrics','UserProfileResource','sendStatus','error','stack','name','send','index','AnalyticMetric','rawAttributes','fieldName','map','query','keys','intersection','model','fields','attributes','hasOwnProperty','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x3b0912,_0x39d739){var _0xa8f339=function(_0x6a31ab){while(--_0x6a31ab){_0x3b0912['push'](_0x3b0912['shift']());}};_0xa8f339(++_0x39d739);}(_0x444e,0xe8));var _0xe444=function(_0x718a85,_0x5272fb){_0x718a85=_0x718a85-0x0;var _0x180486=_0x444e[_0x718a85];return _0x180486;};'use strict';var pdf=require(_0xe444('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe444('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe444('0x2'));var rp=require('request-promise');var moment=require(_0xe444('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe444('0x4'));var util=require(_0xe444('0x5'));var path=require(_0xe444('0x6'));var sox=require(_0xe444('0x7'));var csv=require(_0xe444('0x8'));var ejs=require(_0xe444('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe444('0xa'));var squel=require('squel');var crypto=require(_0xe444('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe444('0xc'));var toCsv=require(_0xe444('0x8'));var querystring=require(_0xe444('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe444('0xe'));var qs=require(_0xe444('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe444('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xe444('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xe444('0x12'));var db=require(_0xe444('0x13'))['db'];function respondWithStatusCode(_0x59792f,_0x28c3e4){_0x28c3e4=_0x28c3e4||0xcc;return function(_0x4f046c){if(_0x4f046c){return _0x59792f['sendStatus'](_0x28c3e4);}return _0x59792f[_0xe444('0x14')](_0x28c3e4)[_0xe444('0x15')]();};}function respondWithResult(_0x5eb55c,_0x192c1a){_0x192c1a=_0x192c1a||0xc8;return function(_0x5d739a){if(_0x5d739a){return _0x5eb55c[_0xe444('0x14')](_0x192c1a)[_0xe444('0x16')](_0x5d739a);}};}function respondWithFilteredResult(_0x18f7cf,_0x3af415){return function(_0x363716){if(_0x363716){var _0x2d44af=_0x363716[_0xe444('0x17')],_0x16ab23=_0x3af415[_0xe444('0x18')],_0x3e1b57=_0x3af415[_0xe444('0x18')]+_0x3af415[_0xe444('0x19')],_0x11129b;if(_0x3e1b57>=_0x2d44af){_0x3e1b57=_0x2d44af;_0x11129b=0xc8;}else{_0x11129b=0xce;}_0x18f7cf['status'](_0x11129b);return _0x18f7cf[_0xe444('0x1a')](_0xe444('0x1b'),_0x16ab23+'-'+_0x3e1b57+'/'+_0x2d44af)[_0xe444('0x16')](_0x363716);}return null;};}function patchUpdates(_0x2f6a4a){return function(_0x58fd40){try{jsonpatch[_0xe444('0x1c')](_0x58fd40,_0x2f6a4a,!![]);}catch(_0x285dbc){return BPromise[_0xe444('0x1d')](_0x285dbc);}return _0x58fd40[_0xe444('0x1e')]();};}function saveUpdates(_0x37c15e,_0x582bad){return function(_0x21d01d){if(_0x21d01d){return _0x21d01d[_0xe444('0x1f')](_0x37c15e)['then'](function(_0x2b52a6){return _0x2b52a6;});}return null;};}function removeEntity(_0x5ef1a4,_0x13108c){return function(_0x5c5b8){if(_0x5c5b8){return _0x5c5b8[_0xe444('0x20')]()[_0xe444('0x21')](function(){var _0x1fa32b=_0x5c5b8['get']({'plain':!![]});var _0x527bf5=_0xe444('0x22');return db[_0xe444('0x23')][_0xe444('0x20')]({'where':{'type':_0x527bf5,'resourceId':_0x1fa32b['id']}})[_0xe444('0x21')](function(){return _0x5c5b8;});})[_0xe444('0x21')](function(){_0x5ef1a4['status'](0xcc)[_0xe444('0x15')]();});}};}function handleEntityNotFound(_0x40a963,_0x5e36bb){return function(_0x32055b){if(!_0x32055b){_0x40a963[_0xe444('0x24')](0x194);}return _0x32055b;};}function handleError(_0x396fdf,_0x26ca6f){_0x26ca6f=_0x26ca6f||0x1f4;return function(_0x2619cf){logger[_0xe444('0x25')](_0x2619cf[_0xe444('0x26')]);if(_0x2619cf['name']){delete _0x2619cf[_0xe444('0x27')];}_0x396fdf[_0xe444('0x14')](_0x26ca6f)[_0xe444('0x28')](_0x2619cf);};}exports[_0xe444('0x29')]=function(_0x5bc063,_0x594b43){var _0x1bfec6={},_0x6f5319={},_0x33de83={'count':0x0,'rows':[]};var _0x239894=_['map'](db[_0xe444('0x2a')][_0xe444('0x2b')],function(_0x41eac0){return{'name':_0x41eac0[_0xe444('0x2c')],'type':_0x41eac0['type']['key']};});_0x6f5319['model']=_[_0xe444('0x2d')](_0x239894,_0xe444('0x27'));_0x6f5319[_0xe444('0x2e')]=_[_0xe444('0x2f')](_0x5bc063[_0xe444('0x2e')]);_0x6f5319['filters']=_[_0xe444('0x30')](_0x6f5319[_0xe444('0x31')],_0x6f5319[_0xe444('0x2e')]);_0x1bfec6['attributes']=_[_0xe444('0x30')](_0x6f5319['model'],qs['fields'](_0x5bc063[_0xe444('0x2e')][_0xe444('0x32')]));_0x1bfec6['attributes']=_0x1bfec6[_0xe444('0x33')]['length']?_0x1bfec6[_0xe444('0x33')]:_0x6f5319['model'];if(!_0x5bc063['query'][_0xe444('0x34')]('nolimit')){_0x1bfec6[_0xe444('0x19')]=qs[_0xe444('0x19')](_0x5bc063[_0xe444('0x2e')][_0xe444('0x19')]);_0x1bfec6['offset']=qs[_0xe444('0x18')](_0x5bc063[_0xe444('0x2e')][_0xe444('0x18')]);}_0x1bfec6['order']=qs[_0xe444('0x35')](_0x5bc063['query'][_0xe444('0x35')]);_0x1bfec6[_0xe444('0x36')]=qs[_0xe444('0x37')](_['pick'](_0x5bc063['query'],_0x6f5319[_0xe444('0x37')]),_0x239894);if(_0x5bc063[_0xe444('0x2e')][_0xe444('0x38')]){_0x1bfec6[_0xe444('0x36')]=_[_0xe444('0x39')](_0x1bfec6[_0xe444('0x36')],{'$or':_[_0xe444('0x2d')](_0x239894,function(_0x5c2ddf){if(_0x5c2ddf['type']!==_0xe444('0x3a')){var _0x495c9d={};_0x495c9d[_0x5c2ddf[_0xe444('0x27')]]={'$like':'%'+_0x5bc063['query'][_0xe444('0x38')]+'%'};return _0x495c9d;}})});}_0x1bfec6=_[_0xe444('0x39')]({},_0x1bfec6,_0x5bc063[_0xe444('0x3b')]);var _0x16babb={'where':_0x1bfec6[_0xe444('0x36')]};return db[_0xe444('0x2a')]['count'](_0x16babb)[_0xe444('0x21')](function(_0x3039ce){_0x33de83[_0xe444('0x17')]=_0x3039ce;if(_0x5bc063[_0xe444('0x2e')]['includeAll']){_0x1bfec6[_0xe444('0x3c')]=[{'all':!![]}];}return db[_0xe444('0x2a')][_0xe444('0x3d')](_0x1bfec6);})[_0xe444('0x21')](function(_0x1bc32d){_0x33de83[_0xe444('0x3e')]=_0x1bc32d;return _0x33de83;})[_0xe444('0x21')](respondWithFilteredResult(_0x594b43,_0x1bfec6))[_0xe444('0x3f')](handleError(_0x594b43,null));};exports[_0xe444('0x40')]=function(_0x543bae,_0x5cdf87){var _0x4c7713={'raw':!![],'where':{'id':_0x543bae[_0xe444('0x41')]['id']}},_0x22e4de={};_0x22e4de[_0xe444('0x31')]=_[_0xe444('0x2f')](db[_0xe444('0x2a')]['rawAttributes']);_0x22e4de['query']=_[_0xe444('0x2f')](_0x543bae[_0xe444('0x2e')]);_0x22e4de[_0xe444('0x37')]=_['intersection'](_0x22e4de[_0xe444('0x31')],_0x22e4de[_0xe444('0x2e')]);_0x4c7713[_0xe444('0x33')]=_[_0xe444('0x30')](_0x22e4de[_0xe444('0x31')],qs[_0xe444('0x32')](_0x543bae['query']['fields']));_0x4c7713[_0xe444('0x33')]=_0x4c7713[_0xe444('0x33')][_0xe444('0x42')]?_0x4c7713[_0xe444('0x33')]:_0x22e4de['model'];if(_0x543bae[_0xe444('0x2e')][_0xe444('0x43')]){_0x4c7713[_0xe444('0x3c')]=[{'all':!![]}];}_0x4c7713=_[_0xe444('0x39')]({},_0x4c7713,_0x543bae[_0xe444('0x3b')]);return db[_0xe444('0x2a')][_0xe444('0x44')](_0x4c7713)[_0xe444('0x21')](handleEntityNotFound(_0x5cdf87,null))['then'](respondWithResult(_0x5cdf87,null))[_0xe444('0x3f')](handleError(_0x5cdf87,null));};exports[_0xe444('0x45')]=function(_0x5afcdb,_0x4cb019){return db[_0xe444('0x2a')]['create'](_0x5afcdb['body'],{})['then'](function(_0x3b2957){var _0x142af3=_0x5afcdb['user']['get']({'plain':!![]});if(!_0x142af3)throw new Error(_0xe444('0x46'));if(_0x142af3[_0xe444('0x47')]==='user'){var _0xc82495=_0x3b2957[_0xe444('0x48')]({'plain':!![]});var _0x106586='Metrics';return db[_0xe444('0x49')]['find']({'where':{'name':_0x106586,'userProfileId':_0x142af3[_0xe444('0x4a')]},'raw':!![]})[_0xe444('0x21')](function(_0x5d92e6){if(_0x5d92e6&&_0x5d92e6['autoAssociation']===0x0){return db[_0xe444('0x23')]['create']({'name':_0xc82495[_0xe444('0x27')],'resourceId':_0xc82495['id'],'type':_0x5d92e6[_0xe444('0x27')],'sectionId':_0x5d92e6['id']},{})['then'](function(){return _0x3b2957;});}else{return _0x3b2957;}})[_0xe444('0x3f')](function(_0x272482){logger[_0xe444('0x25')](_0xe444('0x4b'),_0x272482);throw _0x272482;});}return _0x3b2957;})[_0xe444('0x21')](respondWithResult(_0x4cb019,0xc9))[_0xe444('0x3f')](handleError(_0x4cb019,null));};exports[_0xe444('0x1f')]=function(_0xc58b,_0x3f92f6){if(_0xc58b[_0xe444('0x4c')]['id']){delete _0xc58b[_0xe444('0x4c')]['id'];}return db[_0xe444('0x2a')]['find']({'where':{'id':_0xc58b[_0xe444('0x41')]['id']}})[_0xe444('0x21')](handleEntityNotFound(_0x3f92f6,null))['then'](saveUpdates(_0xc58b[_0xe444('0x4c')],null))['then'](respondWithResult(_0x3f92f6,null))[_0xe444('0x3f')](handleError(_0x3f92f6,null));};exports['destroy']=function(_0x90a61f,_0x509a4b){return db[_0xe444('0x2a')][_0xe444('0x44')]({'where':{'id':_0x90a61f[_0xe444('0x41')]['id']}})[_0xe444('0x21')](handleEntityNotFound(_0x509a4b,null))[_0xe444('0x21')](removeEntity(_0x509a4b,null))['catch'](handleError(_0x509a4b,null));}; \ No newline at end of file +var _0x565f=['model','attributes','fields','length','nolimit','order','pick','filter','where','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','apply','save','update','destroy','then','get','Metrics','error','name','send','index','AnalyticMetric','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection'];(function(_0x54a0c7,_0x296e82){var _0x2d6783=function(_0x435447){while(--_0x435447){_0x54a0c7['push'](_0x54a0c7['shift']());}};_0x2d6783(++_0x296e82);}(_0x565f,0x68));var _0xf565=function(_0x3ff6bf,_0x438e79){_0x3ff6bf=_0x3ff6bf-0x0;var _0x8980a1=_0x565f[_0x3ff6bf];return _0x8980a1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf565('0x0'));var rimraf=require(_0xf565('0x1'));var zipdir=require(_0xf565('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf565('0x3'));var moment=require(_0xf565('0x4'));var BPromise=require(_0xf565('0x5'));var Mustache=require(_0xf565('0x6'));var util=require(_0xf565('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf565('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf565('0x9'));var squel=require(_0xf565('0xa'));var crypto=require(_0xf565('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf565('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf565('0xd'));var Papa=require('papaparse');var Redis=require(_0xf565('0xe'));var authService=require(_0xf565('0xf'));var qs=require(_0xf565('0x10'));var as=require(_0xf565('0x11'));var hardwareService=require(_0xf565('0x12'));var logger=require(_0xf565('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xf565('0x14'));var licenseUtil=require(_0xf565('0x15'));var db=require(_0xf565('0x16'))['db'];function respondWithStatusCode(_0xb66e55,_0xa56a8b){_0xa56a8b=_0xa56a8b||0xcc;return function(_0x3dad4){if(_0x3dad4){return _0xb66e55[_0xf565('0x17')](_0xa56a8b);}return _0xb66e55[_0xf565('0x18')](_0xa56a8b)[_0xf565('0x19')]();};}function respondWithResult(_0x366ac2,_0x4f926d){_0x4f926d=_0x4f926d||0xc8;return function(_0x25b187){if(_0x25b187){return _0x366ac2[_0xf565('0x18')](_0x4f926d)['json'](_0x25b187);}};}function respondWithFilteredResult(_0x394e33,_0x2cd6a8){return function(_0x468d80){if(_0x468d80){var _0x46ee2e=_0x468d80['count'],_0x38e9d1=_0x2cd6a8['offset'],_0x509ff4=_0x2cd6a8[_0xf565('0x1a')]+_0x2cd6a8[_0xf565('0x1b')],_0x15c485;if(_0x509ff4>=_0x46ee2e){_0x509ff4=_0x46ee2e;_0x15c485=0xc8;}else{_0x15c485=0xce;}_0x394e33['status'](_0x15c485);return _0x394e33['set'](_0xf565('0x1c'),_0x38e9d1+'-'+_0x509ff4+'/'+_0x46ee2e)['json'](_0x468d80);}return null;};}function patchUpdates(_0x248111){return function(_0x1aeb02){try{jsonpatch[_0xf565('0x1d')](_0x1aeb02,_0x248111,!![]);}catch(_0x51215d){return BPromise['reject'](_0x51215d);}return _0x1aeb02[_0xf565('0x1e')]();};}function saveUpdates(_0x3a8a09,_0x2141ee){return function(_0x4114d0){if(_0x4114d0){return _0x4114d0[_0xf565('0x1f')](_0x3a8a09)['then'](function(_0x436a7d){return _0x436a7d;});}return null;};}function removeEntity(_0x24aa90,_0x282f3a){return function(_0x29057a){if(_0x29057a){return _0x29057a[_0xf565('0x20')]()[_0xf565('0x21')](function(){var _0xe23d61=_0x29057a[_0xf565('0x22')]({'plain':!![]});var _0x11d948=_0xf565('0x23');return db['UserProfileResource'][_0xf565('0x20')]({'where':{'type':_0x11d948,'resourceId':_0xe23d61['id']}})['then'](function(){return _0x29057a;});})[_0xf565('0x21')](function(){_0x24aa90[_0xf565('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x385d8f,_0xe06651){return function(_0x2e8f6b){if(!_0x2e8f6b){_0x385d8f[_0xf565('0x17')](0x194);}return _0x2e8f6b;};}function handleError(_0x10a396,_0x1239a7){_0x1239a7=_0x1239a7||0x1f4;return function(_0x42d7ab){logger[_0xf565('0x24')](_0x42d7ab['stack']);if(_0x42d7ab[_0xf565('0x25')]){delete _0x42d7ab[_0xf565('0x25')];}_0x10a396[_0xf565('0x18')](_0x1239a7)[_0xf565('0x26')](_0x42d7ab);};}exports[_0xf565('0x27')]=function(_0x5ecd01,_0x2288db){var _0x2ce91d={},_0x3bf46a={},_0x55b80d={'count':0x0,'rows':[]};var _0x233dca=_['map'](db[_0xf565('0x28')][_0xf565('0x29')],function(_0x3efca0){return{'name':_0x3efca0[_0xf565('0x2a')],'type':_0x3efca0[_0xf565('0x2b')][_0xf565('0x2c')]};});_0x3bf46a['model']=_[_0xf565('0x2d')](_0x233dca,_0xf565('0x25'));_0x3bf46a['query']=_[_0xf565('0x2e')](_0x5ecd01[_0xf565('0x2f')]);_0x3bf46a[_0xf565('0x30')]=_[_0xf565('0x31')](_0x3bf46a[_0xf565('0x32')],_0x3bf46a[_0xf565('0x2f')]);_0x2ce91d[_0xf565('0x33')]=_[_0xf565('0x31')](_0x3bf46a['model'],qs[_0xf565('0x34')](_0x5ecd01[_0xf565('0x2f')][_0xf565('0x34')]));_0x2ce91d['attributes']=_0x2ce91d[_0xf565('0x33')][_0xf565('0x35')]?_0x2ce91d[_0xf565('0x33')]:_0x3bf46a[_0xf565('0x32')];if(!_0x5ecd01[_0xf565('0x2f')]['hasOwnProperty'](_0xf565('0x36'))){_0x2ce91d['limit']=qs[_0xf565('0x1b')](_0x5ecd01[_0xf565('0x2f')]['limit']);_0x2ce91d['offset']=qs[_0xf565('0x1a')](_0x5ecd01[_0xf565('0x2f')]['offset']);}_0x2ce91d[_0xf565('0x37')]=qs['sort'](_0x5ecd01['query']['sort']);_0x2ce91d['where']=qs[_0xf565('0x30')](_[_0xf565('0x38')](_0x5ecd01[_0xf565('0x2f')],_0x3bf46a['filters']),_0x233dca);if(_0x5ecd01[_0xf565('0x2f')][_0xf565('0x39')]){_0x2ce91d[_0xf565('0x3a')]=_['merge'](_0x2ce91d[_0xf565('0x3a')],{'$or':_['map'](_0x233dca,function(_0x2d09fb){if(_0x2d09fb[_0xf565('0x2b')]!==_0xf565('0x3b')){var _0x54bf2d={};_0x54bf2d[_0x2d09fb[_0xf565('0x25')]]={'$like':'%'+_0x5ecd01['query'][_0xf565('0x39')]+'%'};return _0x54bf2d;}})});}_0x2ce91d=_['merge']({},_0x2ce91d,_0x5ecd01[_0xf565('0x3c')]);var _0x25dc34={'where':_0x2ce91d['where']};return db[_0xf565('0x28')][_0xf565('0x3d')](_0x25dc34)[_0xf565('0x21')](function(_0x5b8685){_0x55b80d[_0xf565('0x3d')]=_0x5b8685;if(_0x5ecd01['query'][_0xf565('0x3e')]){_0x2ce91d[_0xf565('0x3f')]=[{'all':!![]}];}return db[_0xf565('0x28')][_0xf565('0x40')](_0x2ce91d);})[_0xf565('0x21')](function(_0x2321f5){_0x55b80d['rows']=_0x2321f5;return _0x55b80d;})['then'](respondWithFilteredResult(_0x2288db,_0x2ce91d))[_0xf565('0x41')](handleError(_0x2288db,null));};exports[_0xf565('0x42')]=function(_0x40920b,_0x43416e){var _0x190f3a={'raw':!![],'where':{'id':_0x40920b[_0xf565('0x43')]['id']}},_0x482efc={};_0x482efc[_0xf565('0x32')]=_[_0xf565('0x2e')](db[_0xf565('0x28')]['rawAttributes']);_0x482efc[_0xf565('0x2f')]=_['keys'](_0x40920b['query']);_0x482efc[_0xf565('0x30')]=_[_0xf565('0x31')](_0x482efc['model'],_0x482efc['query']);_0x190f3a['attributes']=_[_0xf565('0x31')](_0x482efc[_0xf565('0x32')],qs[_0xf565('0x34')](_0x40920b[_0xf565('0x2f')][_0xf565('0x34')]));_0x190f3a[_0xf565('0x33')]=_0x190f3a[_0xf565('0x33')][_0xf565('0x35')]?_0x190f3a[_0xf565('0x33')]:_0x482efc[_0xf565('0x32')];if(_0x40920b[_0xf565('0x2f')]['includeAll']){_0x190f3a['include']=[{'all':!![]}];}_0x190f3a=_['merge']({},_0x190f3a,_0x40920b[_0xf565('0x3c')]);return db[_0xf565('0x28')][_0xf565('0x44')](_0x190f3a)['then'](handleEntityNotFound(_0x43416e,null))['then'](respondWithResult(_0x43416e,null))[_0xf565('0x41')](handleError(_0x43416e,null));};exports[_0xf565('0x45')]=function(_0x1a0386,_0x5ee510){return db[_0xf565('0x28')][_0xf565('0x45')](_0x1a0386[_0xf565('0x46')],{})['then'](function(_0x5b6cbb){var _0x2db9d2=_0x1a0386['user'][_0xf565('0x22')]({'plain':!![]});if(!_0x2db9d2)throw new Error(_0xf565('0x47'));if(_0x2db9d2[_0xf565('0x48')]===_0xf565('0x49')){var _0x3771b9=_0x5b6cbb[_0xf565('0x22')]({'plain':!![]});var _0x4326cc=_0xf565('0x23');return db[_0xf565('0x4a')][_0xf565('0x44')]({'where':{'name':_0x4326cc,'userProfileId':_0x2db9d2[_0xf565('0x4b')]},'raw':!![]})[_0xf565('0x21')](function(_0xe2fffa){if(_0xe2fffa&&_0xe2fffa[_0xf565('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x3771b9[_0xf565('0x25')],'resourceId':_0x3771b9['id'],'type':_0xe2fffa[_0xf565('0x25')],'sectionId':_0xe2fffa['id']},{})['then'](function(){return _0x5b6cbb;});}else{return _0x5b6cbb;}})[_0xf565('0x41')](function(_0x1869ff){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1869ff);throw _0x1869ff;});}return _0x5b6cbb;})[_0xf565('0x21')](respondWithResult(_0x5ee510,0xc9))[_0xf565('0x41')](handleError(_0x5ee510,null));};exports[_0xf565('0x1f')]=function(_0x3d650d,_0x203eed){if(_0x3d650d[_0xf565('0x46')]['id']){delete _0x3d650d[_0xf565('0x46')]['id'];}return db[_0xf565('0x28')]['find']({'where':{'id':_0x3d650d[_0xf565('0x43')]['id']}})['then'](handleEntityNotFound(_0x203eed,null))[_0xf565('0x21')](saveUpdates(_0x3d650d[_0xf565('0x46')],null))['then'](respondWithResult(_0x203eed,null))['catch'](handleError(_0x203eed,null));};exports[_0xf565('0x20')]=function(_0x4243fd,_0x2edcd2){return db[_0xf565('0x28')]['find']({'where':{'id':_0x4243fd[_0xf565('0x43')]['id']}})[_0xf565('0x21')](handleEntityNotFound(_0x2edcd2,null))[_0xf565('0x21')](removeEntity(_0x2edcd2,null))[_0xf565('0x41')](handleError(_0x2edcd2,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index d0f3125..5bbe138 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 _0xa12f=['../../config/logger','bluebird','request-promise','path','../../config/environment','./analyticMetric.attributes','exports','AnalyticMetric','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa12f,0x152));var _0xfa12=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa12f[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xfa12('0x0'));var util=require(_0xfa12('0x1'));var logger=require(_0xfa12('0x2'))('api');var moment=require('moment');var BPromise=require(_0xfa12('0x3'));var rp=require(_0xfa12('0x4'));var fs=require('fs');var path=require(_0xfa12('0x5'));var rimraf=require('rimraf');var config=require(_0xfa12('0x6'));var attributes=require(_0xfa12('0x7'));module[_0xfa12('0x8')]=function(_0x21356d,_0x479994){return _0x21356d['define'](_0xfa12('0x9'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4886=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./analyticMetric.attributes','exports','define','analytics_metrics'];(function(_0x16662c,_0x3d32b3){var _0x3e1a15=function(_0x285b01){while(--_0x285b01){_0x16662c['push'](_0x16662c['shift']());}};_0x3e1a15(++_0x3d32b3);}(_0x4886,0xcc));var _0x6488=function(_0x1b7c84,_0x15c14e){_0x1b7c84=_0x1b7c84-0x0;var _0x2ed9df=_0x4886[_0x1b7c84];return _0x2ed9df;};'use strict';var _=require(_0x6488('0x0'));var util=require(_0x6488('0x1'));var logger=require('../../config/logger')(_0x6488('0x2'));var moment=require(_0x6488('0x3'));var BPromise=require(_0x6488('0x4'));var rp=require(_0x6488('0x5'));var fs=require('fs');var path=require(_0x6488('0x6'));var rimraf=require('rimraf');var config=require(_0x6488('0x7'));var attributes=require(_0x6488('0x8'));module[_0x6488('0x9')]=function(_0x7c95b,_0x37e1ce){return _0x7c95b[_0x6488('0xa')]('AnalyticMetric',attributes,{'tableName':_0x6488('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 06a50f1..d0f7899 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 _0x9138=['result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','AnalyticMetric,\x20%s,\x20%s'];(function(_0x188379,_0x7fa345){var _0x3d8a8f=function(_0x1dee72){while(--_0x1dee72){_0x188379['push'](_0x188379['shift']());}};_0x3d8a8f(++_0x7fa345);}(_0x9138,0xca));var _0x8913=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x9138[_0x31e29a];return _0x32d892;};'use strict';var _=require('lodash');var util=require(_0x8913('0x0'));var moment=require('moment');var BPromise=require(_0x8913('0x1'));var rs=require(_0x8913('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8913('0x3'))['db'];var utils=require(_0x8913('0x4'));var logger=require(_0x8913('0x5'))(_0x8913('0x6'));var config=require(_0x8913('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8913('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a0f68,_0xde5425,_0x16dbd0){return new BPromise(function(_0x400aa7,_0x3bde93){return client['request'](_0x3a0f68,_0x16dbd0)[_0x8913('0x9')](function(_0x4bac56){logger[_0x8913('0xa')]('AnalyticMetric,\x20%s,\x20%s',_0xde5425,'request\x20sent');logger[_0x8913('0xb')](_0x8913('0xc'),_0xde5425,_0x8913('0xd'),JSON[_0x8913('0xe')](_0x4bac56));if(_0x4bac56[_0x8913('0xf')]){if(_0x4bac56[_0x8913('0xf')]['code']===0x1f4){logger[_0x8913('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0xde5425,_0x4bac56[_0x8913('0xf')]['message']);return _0x3bde93(_0x4bac56[_0x8913('0xf')][_0x8913('0x10')]);}logger[_0x8913('0xf')](_0x8913('0x11'),_0xde5425,_0x4bac56[_0x8913('0xf')][_0x8913('0x10')]);return _0x400aa7(_0x4bac56[_0x8913('0xf')][_0x8913('0x10')]);}else{logger[_0x8913('0xa')](_0x8913('0x11'),_0xde5425,'request\x20sent');_0x400aa7(_0x4bac56[_0x8913('0x12')][_0x8913('0x10')]);}})[_0x8913('0x13')](function(_0x4f3065){logger['error'](_0x8913('0x11'),_0xde5425,_0x4f3065);_0x3bde93(_0x4f3065);});});} \ No newline at end of file +var _0xcc8a=['then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticMetric,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x73ae90,_0x3e2d96){var _0x464671=function(_0xdc4b96){while(--_0xdc4b96){_0x73ae90['push'](_0x73ae90['shift']());}};_0x464671(++_0x3e2d96);}(_0xcc8a,0x12a));var _0xacc8=function(_0x519443,_0x235b27){_0x519443=_0x519443-0x0;var _0x315f8c=_0xcc8a[_0x519443];return _0x315f8c;};'use strict';var _=require(_0xacc8('0x0'));var util=require(_0xacc8('0x1'));var moment=require(_0xacc8('0x2'));var BPromise=require(_0xacc8('0x3'));var rs=require(_0xacc8('0x4'));var fs=require('fs');var Redis=require(_0xacc8('0x5'));var db=require(_0xacc8('0x6'))['db'];var utils=require(_0xacc8('0x7'));var logger=require(_0xacc8('0x8'))(_0xacc8('0x9'));var config=require(_0xacc8('0xa'));var jayson=require(_0xacc8('0xb'));var client=jayson[_0xacc8('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18ab7a,_0x5a47cf,_0x1afb22){return new BPromise(function(_0x552ff2,_0x2016af){return client[_0xacc8('0xd')](_0x18ab7a,_0x1afb22)[_0xacc8('0xe')](function(_0x13bd50){logger[_0xacc8('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x5a47cf,_0xacc8('0x10'));logger[_0xacc8('0x11')](_0xacc8('0x12'),_0x5a47cf,_0xacc8('0x10'),JSON[_0xacc8('0x13')](_0x13bd50));if(_0x13bd50[_0xacc8('0x14')]){if(_0x13bd50['error'][_0xacc8('0x15')]===0x1f4){logger[_0xacc8('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0x5a47cf,_0x13bd50[_0xacc8('0x14')][_0xacc8('0x16')]);return _0x2016af(_0x13bd50[_0xacc8('0x14')][_0xacc8('0x16')]);}logger[_0xacc8('0x14')](_0xacc8('0x17'),_0x5a47cf,_0x13bd50[_0xacc8('0x14')]['message']);return _0x552ff2(_0x13bd50[_0xacc8('0x14')][_0xacc8('0x16')]);}else{logger[_0xacc8('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x5a47cf,_0xacc8('0x10'));_0x552ff2(_0x13bd50['result'][_0xacc8('0x16')]);}})['catch'](function(_0x5d7c66){logger[_0xacc8('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0x5a47cf,_0x5d7c66);_0x2016af(_0x5d7c66);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index eb480b4..21703ef 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 _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticMetric.controller','isAuthenticated','index','/:id'];(function(_0x101ccf,_0x37e172){var _0x99b0f1=function(_0x4111c8){while(--_0x4111c8){_0x101ccf['push'](_0x101ccf['shift']());}};_0x99b0f1(++_0x37e172);}(_0x4fc2,0x111));var _0x24fc=function(_0x145a69,_0x243b63){_0x145a69=_0x145a69-0x0;var _0x34ebfb=_0x4fc2[_0x145a69];return _0x34ebfb;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file +var _0xbdb7=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','index','get','show','post','put','/:id','isAuthenticated','update'];(function(_0x502036,_0x502686){var _0x485247=function(_0x135ee3){while(--_0x135ee3){_0x502036['push'](_0x502036['shift']());}};_0x485247(++_0x502686);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x326b39,_0x4143c9){_0x326b39=_0x326b39-0x0;var _0x5b62d1=_0xbdb7[_0x326b39];return _0x5b62d1;};'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('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7bdb('0xe')](_0x7bdb('0xf'),auth[_0x7bdb('0x10')](),controller[_0x7bdb('0x11')]);router[_0x7bdb('0x12')](_0x7bdb('0xf'),auth[_0x7bdb('0x10')](),controller[_0x7bdb('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 540b44a..4ddc1c0 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 _0xa12f=['exports','TEXT','sequelize'];(function(_0x81c1bd,_0x5ee432){var _0x4ad0d7=function(_0x1d4a9a){while(--_0x1d4a9a){_0x81c1bd['push'](_0x81c1bd['shift']());}};_0x4ad0d7(++_0x5ee432);}(_0xa12f,0xf8));var _0xfa12=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa12f[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xfa12('0x0'));module[_0xfa12('0x1')]={'tree':{'type':Sequelize[_0xfa12('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x7769=['TEXT','sequelize'];(function(_0x10ff18,_0x11a300){var _0x76d79c=function(_0x10cd21){while(--_0x10cd21){_0x10ff18['push'](_0x10ff18['shift']());}};_0x76d79c(++_0x11a300);}(_0x7769,0x163));var _0x9776=function(_0x1a1b39,_0x2b180a){_0x1a1b39=_0x1a1b39-0x0;var _0x2e03e7=_0x7769[_0x1a1b39];return _0x2e03e7;};'use strict';var Sequelize=require(_0x9776('0x0'));module['exports']={'tree':{'type':Sequelize[_0x9776('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 4eb825b..72f098c 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 _0x3050=['include','findAll','rows','catch','show','params','fields','includeAll','find','create','body','html-pdf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','AnalyticTreeReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x3050,0x99));var _0x0305=function(_0x184c16,_0x3ac0ee){_0x184c16=_0x184c16-0x0;var _0x5d8e5c=_0x3050[_0x184c16];return _0x5d8e5c;};'use strict';var pdf=require(_0x0305('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0305('0x1'));var jsonpatch=require(_0x0305('0x2'));var rp=require(_0x0305('0x3'));var moment=require(_0x0305('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x0305('0x5'));var sox=require(_0x0305('0x6'));var csv=require(_0x0305('0x7'));var ejs=require(_0x0305('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0305('0x9'));var squel=require(_0x0305('0xa'));var crypto=require(_0x0305('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0305('0x7'));var querystring=require(_0x0305('0xc'));var Papa=require(_0x0305('0xd'));var Redis=require(_0x0305('0xe'));var authService=require(_0x0305('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0305('0x10'));var hardwareService=require(_0x0305('0x11'));var logger=require('../../config/logger')(_0x0305('0x12'));var utils=require('../../config/utils');var config=require(_0x0305('0x13'));var licenseUtil=require(_0x0305('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43f9f5,_0xd2fa5){_0xd2fa5=_0xd2fa5||0xcc;return function(_0x2c51f0){if(_0x2c51f0){return _0x43f9f5['sendStatus'](_0xd2fa5);}return _0x43f9f5[_0x0305('0x15')](_0xd2fa5)[_0x0305('0x16')]();};}function respondWithResult(_0x1af8d4,_0x23ee81){_0x23ee81=_0x23ee81||0xc8;return function(_0x4cd426){if(_0x4cd426){return _0x1af8d4['status'](_0x23ee81)[_0x0305('0x17')](_0x4cd426);}};}function respondWithFilteredResult(_0xc2c761,_0xef7b9c){return function(_0x5171b4){if(_0x5171b4){var _0x57d420=_0x5171b4[_0x0305('0x18')],_0x2706e0=_0xef7b9c[_0x0305('0x19')],_0xbd076c=_0xef7b9c[_0x0305('0x19')]+_0xef7b9c[_0x0305('0x1a')],_0x3ae464;if(_0xbd076c>=_0x57d420){_0xbd076c=_0x57d420;_0x3ae464=0xc8;}else{_0x3ae464=0xce;}_0xc2c761[_0x0305('0x15')](_0x3ae464);return _0xc2c761[_0x0305('0x1b')](_0x0305('0x1c'),_0x2706e0+'-'+_0xbd076c+'/'+_0x57d420)['json'](_0x5171b4);}return null;};}function patchUpdates(_0x101705){return function(_0x2e9c51){try{jsonpatch[_0x0305('0x1d')](_0x2e9c51,_0x101705,!![]);}catch(_0x3670ec){return BPromise[_0x0305('0x1e')](_0x3670ec);}return _0x2e9c51[_0x0305('0x1f')]();};}function saveUpdates(_0x607ebc,_0x276e67){return function(_0x1c3663){if(_0x1c3663){return _0x1c3663[_0x0305('0x20')](_0x607ebc)[_0x0305('0x21')](function(_0xf5d94d){return _0xf5d94d;});}return null;};}function removeEntity(_0x103ef9,_0x4f8379){return function(_0x2df195){if(_0x2df195){return _0x2df195[_0x0305('0x22')]()[_0x0305('0x21')](function(){_0x103ef9['status'](0xcc)[_0x0305('0x16')]();});}};}function handleEntityNotFound(_0x47d895,_0x41e439){return function(_0x3edb9e){if(!_0x3edb9e){_0x47d895[_0x0305('0x23')](0x194);}return _0x3edb9e;};}function handleError(_0x4a8f13,_0x5aa1c0){_0x5aa1c0=_0x5aa1c0||0x1f4;return function(_0x6e3720){logger[_0x0305('0x24')](_0x6e3720[_0x0305('0x25')]);if(_0x6e3720[_0x0305('0x26')]){delete _0x6e3720[_0x0305('0x26')];}_0x4a8f13[_0x0305('0x15')](_0x5aa1c0)[_0x0305('0x27')](_0x6e3720);};}exports['index']=function(_0x182966,_0x2832b6){var _0x2b2777={},_0x46257a={},_0x41896a={'count':0x0,'rows':[]};var _0xe944c8=_[_0x0305('0x28')](db[_0x0305('0x29')][_0x0305('0x2a')],function(_0x57cf2c){return{'name':_0x57cf2c[_0x0305('0x2b')],'type':_0x57cf2c['type']['key']};});_0x46257a[_0x0305('0x2c')]=_['map'](_0xe944c8,_0x0305('0x26'));_0x46257a[_0x0305('0x2d')]=_[_0x0305('0x2e')](_0x182966[_0x0305('0x2d')]);_0x46257a[_0x0305('0x2f')]=_[_0x0305('0x30')](_0x46257a[_0x0305('0x2c')],_0x46257a[_0x0305('0x2d')]);_0x2b2777['attributes']=_[_0x0305('0x30')](_0x46257a[_0x0305('0x2c')],qs['fields'](_0x182966[_0x0305('0x2d')]['fields']));_0x2b2777[_0x0305('0x31')]=_0x2b2777['attributes'][_0x0305('0x32')]?_0x2b2777['attributes']:_0x46257a['model'];if(!_0x182966['query'][_0x0305('0x33')]('nolimit')){_0x2b2777[_0x0305('0x1a')]=qs[_0x0305('0x1a')](_0x182966[_0x0305('0x2d')][_0x0305('0x1a')]);_0x2b2777[_0x0305('0x19')]=qs[_0x0305('0x19')](_0x182966[_0x0305('0x2d')][_0x0305('0x19')]);}_0x2b2777['order']=qs['sort'](_0x182966[_0x0305('0x2d')][_0x0305('0x34')]);_0x2b2777[_0x0305('0x35')]=qs[_0x0305('0x2f')](_[_0x0305('0x36')](_0x182966[_0x0305('0x2d')],_0x46257a[_0x0305('0x2f')]),_0xe944c8);if(_0x182966[_0x0305('0x2d')][_0x0305('0x37')]){_0x2b2777['where']=_[_0x0305('0x38')](_0x2b2777[_0x0305('0x35')],{'$or':_[_0x0305('0x28')](_0xe944c8,function(_0x34ba6e){if(_0x34ba6e[_0x0305('0x39')]!==_0x0305('0x3a')){var _0x257120={};_0x257120[_0x34ba6e['name']]={'$like':'%'+_0x182966['query'][_0x0305('0x37')]+'%'};return _0x257120;}})});}_0x2b2777=_[_0x0305('0x38')]({},_0x2b2777,_0x182966[_0x0305('0x3b')]);var _0xfeb689={'where':_0x2b2777['where']};return db[_0x0305('0x29')][_0x0305('0x18')](_0xfeb689)[_0x0305('0x21')](function(_0x4f6a64){_0x41896a['count']=_0x4f6a64;if(_0x182966[_0x0305('0x2d')]['includeAll']){_0x2b2777[_0x0305('0x3c')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x0305('0x3d')](_0x2b2777);})[_0x0305('0x21')](function(_0xfb4337){_0x41896a[_0x0305('0x3e')]=_0xfb4337;return _0x41896a;})[_0x0305('0x21')](respondWithFilteredResult(_0x2832b6,_0x2b2777))[_0x0305('0x3f')](handleError(_0x2832b6,null));};exports[_0x0305('0x40')]=function(_0x438986,_0x484ff5){var _0x4e2e7b={'raw':!![],'where':{'id':_0x438986[_0x0305('0x41')]['id']}},_0x500feb={};_0x500feb['model']=_[_0x0305('0x2e')](db[_0x0305('0x29')][_0x0305('0x2a')]);_0x500feb['query']=_[_0x0305('0x2e')](_0x438986['query']);_0x500feb[_0x0305('0x2f')]=_[_0x0305('0x30')](_0x500feb[_0x0305('0x2c')],_0x500feb[_0x0305('0x2d')]);_0x4e2e7b['attributes']=_['intersection'](_0x500feb[_0x0305('0x2c')],qs[_0x0305('0x42')](_0x438986[_0x0305('0x2d')]['fields']));_0x4e2e7b[_0x0305('0x31')]=_0x4e2e7b[_0x0305('0x31')][_0x0305('0x32')]?_0x4e2e7b['attributes']:_0x500feb[_0x0305('0x2c')];if(_0x438986[_0x0305('0x2d')][_0x0305('0x43')]){_0x4e2e7b[_0x0305('0x3c')]=[{'all':!![]}];}_0x4e2e7b=_[_0x0305('0x38')]({},_0x4e2e7b,_0x438986['options']);return db['AnalyticTreeReport'][_0x0305('0x44')](_0x4e2e7b)[_0x0305('0x21')](handleEntityNotFound(_0x484ff5,null))['then'](respondWithResult(_0x484ff5,null))['catch'](handleError(_0x484ff5,null));};exports['create']=function(_0x3cbfb1,_0x598ab2){return db['AnalyticTreeReport'][_0x0305('0x45')](_0x3cbfb1[_0x0305('0x46')],{})[_0x0305('0x21')](respondWithResult(_0x598ab2,0xc9))[_0x0305('0x3f')](handleError(_0x598ab2,null));};exports[_0x0305('0x20')]=function(_0x4aacc4,_0x574d2a){if(_0x4aacc4[_0x0305('0x46')]['id']){delete _0x4aacc4[_0x0305('0x46')]['id'];}return db[_0x0305('0x29')][_0x0305('0x44')]({'where':{'id':_0x4aacc4[_0x0305('0x41')]['id']}})[_0x0305('0x21')](handleEntityNotFound(_0x574d2a,null))[_0x0305('0x21')](saveUpdates(_0x4aacc4[_0x0305('0x46')],null))[_0x0305('0x21')](respondWithResult(_0x574d2a,null))[_0x0305('0x3f')](handleError(_0x574d2a,null));};exports[_0x0305('0x22')]=function(_0x3cac08,_0x18d113){return db[_0x0305('0x29')][_0x0305('0x44')]({'where':{'id':_0x3cac08[_0x0305('0x41')]['id']}})[_0x0305('0x21')](handleEntityNotFound(_0x18d113,null))['then'](removeEntity(_0x18d113,null))[_0x0305('0x3f')](handleError(_0x18d113,null));}; \ No newline at end of file +var _0x4d67=['reject','save','update','then','destroy','status','end','stack','name','send','index','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','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','json','count','offset','limit','set','apply'];(function(_0x2a01d3,_0x1b7cf0){var _0x5610d5=function(_0x846f1e){while(--_0x846f1e){_0x2a01d3['push'](_0x2a01d3['shift']());}};_0x5610d5(++_0x1b7cf0);}(_0x4d67,0x16c));var _0x74d6=function(_0x5455e2,_0x4675b4){_0x5455e2=_0x5455e2-0x0;var _0x4c8a44=_0x4d67[_0x5455e2];return _0x4c8a44;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x74d6('0x0'));var rimraf=require(_0x74d6('0x1'));var zipdir=require(_0x74d6('0x2'));var jsonpatch=require(_0x74d6('0x3'));var rp=require(_0x74d6('0x4'));var moment=require(_0x74d6('0x5'));var BPromise=require(_0x74d6('0x6'));var Mustache=require(_0x74d6('0x7'));var util=require(_0x74d6('0x8'));var path=require(_0x74d6('0x9'));var sox=require(_0x74d6('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x74d6('0xb'));var squel=require(_0x74d6('0xc'));var crypto=require(_0x74d6('0xd'));var jsforce=require(_0x74d6('0xe'));var deskjs=require(_0x74d6('0xf'));var toCsv=require(_0x74d6('0x10'));var querystring=require(_0x74d6('0x11'));var Papa=require(_0x74d6('0x12'));var Redis=require(_0x74d6('0x13'));var authService=require(_0x74d6('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x74d6('0x15'));var hardwareService=require(_0x74d6('0x16'));var logger=require(_0x74d6('0x17'))(_0x74d6('0x18'));var utils=require(_0x74d6('0x19'));var config=require(_0x74d6('0x1a'));var licenseUtil=require(_0x74d6('0x1b'));var db=require(_0x74d6('0x1c'))['db'];function respondWithStatusCode(_0x43114e,_0x249bc8){_0x249bc8=_0x249bc8||0xcc;return function(_0x523432){if(_0x523432){return _0x43114e[_0x74d6('0x1d')](_0x249bc8);}return _0x43114e['status'](_0x249bc8)['end']();};}function respondWithResult(_0x1df273,_0x5a09d2){_0x5a09d2=_0x5a09d2||0xc8;return function(_0x10baea){if(_0x10baea){return _0x1df273['status'](_0x5a09d2)[_0x74d6('0x1e')](_0x10baea);}};}function respondWithFilteredResult(_0x4d234f,_0x14f76b){return function(_0x5dd846){if(_0x5dd846){var _0x4da8b8=_0x5dd846[_0x74d6('0x1f')],_0x474347=_0x14f76b[_0x74d6('0x20')],_0x1bc0d5=_0x14f76b[_0x74d6('0x20')]+_0x14f76b[_0x74d6('0x21')],_0x412651;if(_0x1bc0d5>=_0x4da8b8){_0x1bc0d5=_0x4da8b8;_0x412651=0xc8;}else{_0x412651=0xce;}_0x4d234f['status'](_0x412651);return _0x4d234f[_0x74d6('0x22')]('Content-Range',_0x474347+'-'+_0x1bc0d5+'/'+_0x4da8b8)[_0x74d6('0x1e')](_0x5dd846);}return null;};}function patchUpdates(_0x30b156){return function(_0x597b75){try{jsonpatch[_0x74d6('0x23')](_0x597b75,_0x30b156,!![]);}catch(_0x31ae31){return BPromise[_0x74d6('0x24')](_0x31ae31);}return _0x597b75[_0x74d6('0x25')]();};}function saveUpdates(_0x561898,_0x58fa0b){return function(_0x23b006){if(_0x23b006){return _0x23b006[_0x74d6('0x26')](_0x561898)[_0x74d6('0x27')](function(_0x4ca1f9){return _0x4ca1f9;});}return null;};}function removeEntity(_0x20fdc9,_0x36ed3b){return function(_0x2f920e){if(_0x2f920e){return _0x2f920e[_0x74d6('0x28')]()[_0x74d6('0x27')](function(){_0x20fdc9[_0x74d6('0x29')](0xcc)[_0x74d6('0x2a')]();});}};}function handleEntityNotFound(_0x2b2efb,_0x3154fc){return function(_0x2df0b0){if(!_0x2df0b0){_0x2b2efb[_0x74d6('0x1d')](0x194);}return _0x2df0b0;};}function handleError(_0x5328db,_0x585990){_0x585990=_0x585990||0x1f4;return function(_0x4ad4ca){logger['error'](_0x4ad4ca[_0x74d6('0x2b')]);if(_0x4ad4ca['name']){delete _0x4ad4ca[_0x74d6('0x2c')];}_0x5328db[_0x74d6('0x29')](_0x585990)[_0x74d6('0x2d')](_0x4ad4ca);};}exports[_0x74d6('0x2e')]=function(_0x53345a,_0x72f49f){var _0x1159dd={},_0x2cf55c={},_0x564107={'count':0x0,'rows':[]};var _0xc41688=_['map'](db[_0x74d6('0x2f')][_0x74d6('0x30')],function(_0x2db4cd){return{'name':_0x2db4cd[_0x74d6('0x31')],'type':_0x2db4cd[_0x74d6('0x32')][_0x74d6('0x33')]};});_0x2cf55c[_0x74d6('0x34')]=_[_0x74d6('0x35')](_0xc41688,'name');_0x2cf55c[_0x74d6('0x36')]=_['keys'](_0x53345a[_0x74d6('0x36')]);_0x2cf55c[_0x74d6('0x37')]=_['intersection'](_0x2cf55c['model'],_0x2cf55c['query']);_0x1159dd[_0x74d6('0x38')]=_[_0x74d6('0x39')](_0x2cf55c['model'],qs[_0x74d6('0x3a')](_0x53345a[_0x74d6('0x36')]['fields']));_0x1159dd[_0x74d6('0x38')]=_0x1159dd[_0x74d6('0x38')][_0x74d6('0x3b')]?_0x1159dd['attributes']:_0x2cf55c[_0x74d6('0x34')];if(!_0x53345a[_0x74d6('0x36')][_0x74d6('0x3c')](_0x74d6('0x3d'))){_0x1159dd[_0x74d6('0x21')]=qs[_0x74d6('0x21')](_0x53345a[_0x74d6('0x36')][_0x74d6('0x21')]);_0x1159dd[_0x74d6('0x20')]=qs[_0x74d6('0x20')](_0x53345a['query'][_0x74d6('0x20')]);}_0x1159dd[_0x74d6('0x3e')]=qs[_0x74d6('0x3f')](_0x53345a[_0x74d6('0x36')]['sort']);_0x1159dd[_0x74d6('0x40')]=qs[_0x74d6('0x37')](_[_0x74d6('0x41')](_0x53345a[_0x74d6('0x36')],_0x2cf55c[_0x74d6('0x37')]),_0xc41688);if(_0x53345a[_0x74d6('0x36')][_0x74d6('0x42')]){_0x1159dd[_0x74d6('0x40')]=_[_0x74d6('0x43')](_0x1159dd[_0x74d6('0x40')],{'$or':_[_0x74d6('0x35')](_0xc41688,function(_0x31e656){if(_0x31e656[_0x74d6('0x32')]!==_0x74d6('0x44')){var _0x12ca16={};_0x12ca16[_0x31e656['name']]={'$like':'%'+_0x53345a['query'][_0x74d6('0x42')]+'%'};return _0x12ca16;}})});}_0x1159dd=_[_0x74d6('0x43')]({},_0x1159dd,_0x53345a[_0x74d6('0x45')]);var _0x3b6933={'where':_0x1159dd[_0x74d6('0x40')]};return db['AnalyticTreeReport']['count'](_0x3b6933)[_0x74d6('0x27')](function(_0x4db9bc){_0x564107[_0x74d6('0x1f')]=_0x4db9bc;if(_0x53345a[_0x74d6('0x36')][_0x74d6('0x46')]){_0x1159dd[_0x74d6('0x47')]=[{'all':!![]}];}return db[_0x74d6('0x2f')]['findAll'](_0x1159dd);})[_0x74d6('0x27')](function(_0x565edc){_0x564107[_0x74d6('0x48')]=_0x565edc;return _0x564107;})[_0x74d6('0x27')](respondWithFilteredResult(_0x72f49f,_0x1159dd))[_0x74d6('0x49')](handleError(_0x72f49f,null));};exports[_0x74d6('0x4a')]=function(_0x3c0e29,_0x496ddc){var _0x38309d={'raw':!![],'where':{'id':_0x3c0e29[_0x74d6('0x4b')]['id']}},_0x27ce56={};_0x27ce56[_0x74d6('0x34')]=_[_0x74d6('0x4c')](db[_0x74d6('0x2f')][_0x74d6('0x30')]);_0x27ce56[_0x74d6('0x36')]=_['keys'](_0x3c0e29[_0x74d6('0x36')]);_0x27ce56[_0x74d6('0x37')]=_[_0x74d6('0x39')](_0x27ce56[_0x74d6('0x34')],_0x27ce56[_0x74d6('0x36')]);_0x38309d[_0x74d6('0x38')]=_['intersection'](_0x27ce56[_0x74d6('0x34')],qs[_0x74d6('0x3a')](_0x3c0e29[_0x74d6('0x36')][_0x74d6('0x3a')]));_0x38309d[_0x74d6('0x38')]=_0x38309d[_0x74d6('0x38')][_0x74d6('0x3b')]?_0x38309d[_0x74d6('0x38')]:_0x27ce56[_0x74d6('0x34')];if(_0x3c0e29['query'][_0x74d6('0x46')]){_0x38309d[_0x74d6('0x47')]=[{'all':!![]}];}_0x38309d=_[_0x74d6('0x43')]({},_0x38309d,_0x3c0e29[_0x74d6('0x45')]);return db['AnalyticTreeReport'][_0x74d6('0x4d')](_0x38309d)[_0x74d6('0x27')](handleEntityNotFound(_0x496ddc,null))['then'](respondWithResult(_0x496ddc,null))[_0x74d6('0x49')](handleError(_0x496ddc,null));};exports[_0x74d6('0x4e')]=function(_0x4e0e18,_0x2c07fd){return db[_0x74d6('0x2f')][_0x74d6('0x4e')](_0x4e0e18[_0x74d6('0x4f')],{})[_0x74d6('0x27')](respondWithResult(_0x2c07fd,0xc9))[_0x74d6('0x49')](handleError(_0x2c07fd,null));};exports[_0x74d6('0x26')]=function(_0x28d5f4,_0x5a03cf){if(_0x28d5f4[_0x74d6('0x4f')]['id']){delete _0x28d5f4[_0x74d6('0x4f')]['id'];}return db[_0x74d6('0x2f')][_0x74d6('0x4d')]({'where':{'id':_0x28d5f4['params']['id']}})[_0x74d6('0x27')](handleEntityNotFound(_0x5a03cf,null))['then'](saveUpdates(_0x28d5f4[_0x74d6('0x4f')],null))[_0x74d6('0x27')](respondWithResult(_0x5a03cf,null))[_0x74d6('0x49')](handleError(_0x5a03cf,null));};exports[_0x74d6('0x28')]=function(_0x30b90e,_0x4a88ea){return db['AnalyticTreeReport'][_0x74d6('0x4d')]({'where':{'id':_0x30b90e[_0x74d6('0x4b')]['id']}})[_0x74d6('0x27')](handleEntityNotFound(_0x4a88ea,null))[_0x74d6('0x27')](removeEntity(_0x4a88ea,null))['catch'](handleError(_0x4a88ea,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index baf6479..692f72e 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 _0xbd0a=['analytics_report_trees','lodash','../../config/logger','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0xbd0a,0x1b9));var _0xabd0=function(_0x194dae,_0x1288ac){_0x194dae=_0x194dae-0x0;var _0x49560e=_0xbd0a[_0x194dae];return _0x49560e;};'use strict';var _=require(_0xabd0('0x0'));var util=require('util');var logger=require(_0xabd0('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xabd0('0x2'));var fs=require('fs');var path=require(_0xabd0('0x3'));var rimraf=require(_0xabd0('0x4'));var config=require(_0xabd0('0x5'));var attributes=require(_0xabd0('0x6'));module[_0xabd0('0x7')]=function(_0x221368,_0xb41697){return _0x221368[_0xabd0('0x8')]('AnalyticTreeReport',attributes,{'tableName':_0xabd0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5d7=['analytics_report_trees','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','exports','AnalyticTreeReport'];(function(_0x25dd03,_0x38fe2b){var _0x195a85=function(_0x226a6c){while(--_0x226a6c){_0x25dd03['push'](_0x25dd03['shift']());}};_0x195a85(++_0x38fe2b);}(_0xa5d7,0x1c3));var _0x7a5d=function(_0x26218b,_0x2ce309){_0x26218b=_0x26218b-0x0;var _0x2c19be=_0xa5d7[_0x26218b];return _0x2c19be;};'use strict';var _=require(_0x7a5d('0x0'));var util=require(_0x7a5d('0x1'));var logger=require(_0x7a5d('0x2'))(_0x7a5d('0x3'));var moment=require('moment');var BPromise=require(_0x7a5d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a5d('0x5'));var rimraf=require('rimraf');var config=require(_0x7a5d('0x6'));var attributes=require('./analyticTreeReport.attributes');module[_0x7a5d('0x7')]=function(_0x42a143,_0x251ef5){return _0x42a143['define'](_0x7a5d('0x8'),attributes,{'tableName':_0x7a5d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 7757e6e..0c14d63 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 _0xd3c9=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1c1c83,_0x39f701){var _0x3a2650=function(_0xf17943){while(--_0xf17943){_0x1c1c83['push'](_0x1c1c83['shift']());}};_0x3a2650(++_0x39f701);}(_0xd3c9,0xd9));var _0x9d3c=function(_0x9efb2c,_0x18659a){_0x9efb2c=_0x9efb2c-0x0;var _0xc3d5a3=_0xd3c9[_0x9efb2c];return _0xc3d5a3;};'use strict';var _=require(_0x9d3c('0x0'));var util=require(_0x9d3c('0x1'));var moment=require(_0x9d3c('0x2'));var BPromise=require(_0x9d3c('0x3'));var rs=require(_0x9d3c('0x4'));var fs=require('fs');var Redis=require(_0x9d3c('0x5'));var db=require(_0x9d3c('0x6'))['db'];var utils=require(_0x9d3c('0x7'));var logger=require(_0x9d3c('0x8'))(_0x9d3c('0x9'));var config=require(_0x9d3c('0xa'));var jayson=require(_0x9d3c('0xb'));var client=jayson[_0x9d3c('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57396d,_0x1b496a,_0x57967c){return new BPromise(function(_0x4e04a2,_0x1cb565){return client['request'](_0x57396d,_0x57967c)[_0x9d3c('0xd')](function(_0x120de1){logger[_0x9d3c('0xe')](_0x9d3c('0xf'),_0x1b496a,_0x9d3c('0x10'));logger['debug'](_0x9d3c('0x11'),_0x1b496a,_0x9d3c('0x10'),JSON[_0x9d3c('0x12')](_0x120de1));if(_0x120de1[_0x9d3c('0x13')]){if(_0x120de1[_0x9d3c('0x13')]['code']===0x1f4){logger[_0x9d3c('0x13')](_0x9d3c('0xf'),_0x1b496a,_0x120de1[_0x9d3c('0x13')][_0x9d3c('0x14')]);return _0x1cb565(_0x120de1[_0x9d3c('0x13')]['message']);}logger['error'](_0x9d3c('0xf'),_0x1b496a,_0x120de1[_0x9d3c('0x13')][_0x9d3c('0x14')]);return _0x4e04a2(_0x120de1['error'][_0x9d3c('0x14')]);}else{logger[_0x9d3c('0xe')](_0x9d3c('0xf'),_0x1b496a,_0x9d3c('0x10'));_0x4e04a2(_0x120de1[_0x9d3c('0x15')][_0x9d3c('0x14')]);}})[_0x9d3c('0x16')](function(_0x2d9e3b){logger[_0x9d3c('0x13')](_0x9d3c('0xf'),_0x1b496a,_0x2d9e3b);_0x1cb565(_0x2d9e3b);});});} \ No newline at end of file +var _0xca74=['request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca74,0x11a));var _0x4ca7=function(_0x30d87a,_0xf3a07f){_0x30d87a=_0x30d87a-0x0;var _0x48f64b=_0xca74[_0x30d87a];return _0x48f64b;};'use strict';var _=require('lodash');var util=require(_0x4ca7('0x0'));var moment=require(_0x4ca7('0x1'));var BPromise=require(_0x4ca7('0x2'));var rs=require(_0x4ca7('0x3'));var fs=require('fs');var Redis=require(_0x4ca7('0x4'));var db=require(_0x4ca7('0x5'))['db'];var utils=require(_0x4ca7('0x6'));var logger=require(_0x4ca7('0x7'))(_0x4ca7('0x8'));var config=require(_0x4ca7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4ca7('0xa')][_0x4ca7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25be50,_0x1690f7,_0x5c649a){return new BPromise(function(_0xd2d4e4,_0x20f97e){return client[_0x4ca7('0xc')](_0x25be50,_0x5c649a)['then'](function(_0x2974fe){logger[_0x4ca7('0xd')](_0x4ca7('0xe'),_0x1690f7,'request\x20sent');logger[_0x4ca7('0xf')](_0x4ca7('0x10'),_0x1690f7,_0x4ca7('0x11'),JSON[_0x4ca7('0x12')](_0x2974fe));if(_0x2974fe[_0x4ca7('0x13')]){if(_0x2974fe[_0x4ca7('0x13')]['code']===0x1f4){logger[_0x4ca7('0x13')](_0x4ca7('0xe'),_0x1690f7,_0x2974fe[_0x4ca7('0x13')][_0x4ca7('0x14')]);return _0x20f97e(_0x2974fe[_0x4ca7('0x13')][_0x4ca7('0x14')]);}logger[_0x4ca7('0x13')](_0x4ca7('0xe'),_0x1690f7,_0x2974fe['error'][_0x4ca7('0x14')]);return _0xd2d4e4(_0x2974fe[_0x4ca7('0x13')][_0x4ca7('0x14')]);}else{logger[_0x4ca7('0xd')](_0x4ca7('0xe'),_0x1690f7,_0x4ca7('0x11'));_0xd2d4e4(_0x2974fe[_0x4ca7('0x15')]['message']);}})[_0x4ca7('0x16')](function(_0x8b1443){logger['error'](_0x4ca7('0xe'),_0x1690f7,_0x8b1443);_0x20f97e(_0x8b1443);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 63a885b..5e16afe 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 _0x663a=['fs-extra','get','index','isAuthenticated','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x663a,0x119));var _0xa663=function(_0x46b43f,_0x4bc3ff){_0x46b43f=_0x46b43f-0x0;var _0x52e1d0=_0x663a[_0x46b43f];return _0x52e1d0;};'use strict';var multer=require(_0xa663('0x0'));var util=require(_0xa663('0x1'));var path=require(_0xa663('0x2'));var timeout=require(_0xa663('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa663('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router[_0xa663('0x5')]('/',auth['isAuthenticated'](),controller[_0xa663('0x6')]);router['get']('/:id',auth[_0xa663('0x7')](),controller['show']);router[_0xa663('0x8')]('/',auth[_0xa663('0x7')](),controller[_0xa663('0x9')]);router[_0xa663('0xa')](_0xa663('0xb'),auth[_0xa663('0x7')](),controller['update']);router[_0xa663('0xc')](_0xa663('0xb'),auth['isAuthenticated'](),controller[_0xa663('0xd')]);module[_0xa663('0xe')]=router; \ No newline at end of file +var _0x025c=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete'];(function(_0x3b0c9d,_0x3ddeb5){var _0xcfc8d7=function(_0x320dc6){while(--_0x320dc6){_0x3b0c9d['push'](_0x3b0c9d['shift']());}};_0xcfc8d7(++_0x3ddeb5);}(_0x025c,0x128));var _0xc025=function(_0x114975,_0x4c8b1a){_0x114975=_0x114975-0x0;var _0x41a0bd=_0x025c[_0x114975];return _0x41a0bd;};'use strict';var multer=require(_0xc025('0x0'));var util=require(_0xc025('0x1'));var path=require(_0xc025('0x2'));var timeout=require('connect-timeout');var express=require(_0xc025('0x3'));var router=express[_0xc025('0x4')]();var fs_extra=require(_0xc025('0x5'));var auth=require(_0xc025('0x6'));var interaction=require(_0xc025('0x7'));var config=require('../../config/environment');var controller=require(_0xc025('0x8'));router['get']('/',auth[_0xc025('0x9')](),controller[_0xc025('0xa')]);router[_0xc025('0xb')](_0xc025('0xc'),auth[_0xc025('0x9')](),controller[_0xc025('0xd')]);router[_0xc025('0xe')]('/',auth[_0xc025('0x9')](),controller[_0xc025('0xf')]);router[_0xc025('0x10')](_0xc025('0xc'),auth[_0xc025('0x9')](),controller[_0xc025('0x11')]);router[_0xc025('0x12')](_0xc025('0xc'),auth[_0xc025('0x9')](),controller[_0xc025('0x13')]);module[_0xc025('0x14')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index ff47daf..17e62e6 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 _0x50c3=['exports','STRING'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x50c3,0x176));var _0x350c=function(_0x65086d,_0x1b4ee5){_0x65086d=_0x65086d-0x0;var _0x55bca3=_0x50c3[_0x65086d];return _0x55bca3;};'use strict';var Sequelize=require('sequelize');module[_0x350c('0x0')]={'name':{'type':Sequelize[_0x350c('0x1')]},'basename':{'type':Sequelize[_0x350c('0x1')]},'type':{'type':Sequelize[_0x350c('0x1')]}}; \ No newline at end of file +var _0xbacb=['exports','STRING'];(function(_0x42b1e1,_0x2c393d){var _0x2276eb=function(_0x3e7a56){while(--_0x3e7a56){_0x42b1e1['push'](_0x42b1e1['shift']());}};_0x2276eb(++_0x2c393d);}(_0xbacb,0x104));var _0xbbac=function(_0x32eade,_0x4d817e){_0x32eade=_0x32eade-0x0;var _0x1bc1d6=_0xbacb[_0x32eade];return _0x1bc1d6;};'use strict';var Sequelize=require('sequelize');module[_0xbbac('0x0')]={'name':{'type':Sequelize[_0xbbac('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbbac('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 7f03a90..ddad7f5 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 _0xa9e0=['sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','fields','find','clone','omit','createdAt','updatedAt','body','update','create','file','originalname','basename','filename','mimetype','join','root','server/files/attachments/','offline-chat/','download','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','stack','name','index','map','Attachment','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit'];(function(_0x3a2849,_0xf7766a){var _0x1456af=function(_0x466000){while(--_0x466000){_0x3a2849['push'](_0x3a2849['shift']());}};_0x1456af(++_0xf7766a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var fs_extra=require(_0x0a9e('0xa'));var _=require(_0x0a9e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0a9e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0a9e('0xd'));var Papa=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var licenseUtil=require(_0x0a9e('0x14'));var db=require(_0x0a9e('0x15'))['db'];function respondWithStatusCode(_0x26d672,_0x32d742){_0x32d742=_0x32d742||0xcc;return function(_0x69aeb7){if(_0x69aeb7){return _0x26d672['sendStatus'](_0x32d742);}return _0x26d672[_0x0a9e('0x16')](_0x32d742)[_0x0a9e('0x17')]();};}function respondWithResult(_0x2b4227,_0x281129){_0x281129=_0x281129||0xc8;return function(_0x44dcfd){if(_0x44dcfd){return _0x2b4227[_0x0a9e('0x16')](_0x281129)['json'](_0x44dcfd);}};}function respondWithFilteredResult(_0x22dccb,_0x5d0880){return function(_0x1985b6){if(_0x1985b6){var _0x519dfd=_0x1985b6[_0x0a9e('0x18')],_0x16033c=_0x5d0880['offset'],_0x12066b=_0x5d0880[_0x0a9e('0x19')]+_0x5d0880[_0x0a9e('0x1a')],_0x48f32d;if(_0x12066b>=_0x519dfd){_0x12066b=_0x519dfd;_0x48f32d=0xc8;}else{_0x48f32d=0xce;}_0x22dccb[_0x0a9e('0x16')](_0x48f32d);return _0x22dccb[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x16033c+'-'+_0x12066b+'/'+_0x519dfd)[_0x0a9e('0x1d')](_0x1985b6);}return null;};}function patchUpdates(_0x530eb7){return function(_0x20559e){try{jsonpatch[_0x0a9e('0x1e')](_0x20559e,_0x530eb7,!![]);}catch(_0x112016){return BPromise[_0x0a9e('0x1f')](_0x112016);}return _0x20559e[_0x0a9e('0x20')]();};}function saveUpdates(_0x4bb1e3,_0x2c3407){return function(_0x155cce){if(_0x155cce){return _0x155cce['update'](_0x4bb1e3)[_0x0a9e('0x21')](function(_0x5a09ef){return _0x5a09ef;});}return null;};}function removeEntity(_0x588269,_0x3a02e1){return function(_0x432e56){if(_0x432e56){return _0x432e56[_0x0a9e('0x22')]()[_0x0a9e('0x21')](function(){_0x588269['status'](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(!_0x4d00e6){_0x2fb0e4[_0x0a9e('0x23')](0x194);}return _0x4d00e6;};}function handleError(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0x1f4;return function(_0x5ea472){logger['error'](_0x5ea472[_0x0a9e('0x24')]);if(_0x5ea472[_0x0a9e('0x25')]){delete _0x5ea472[_0x0a9e('0x25')];}_0x42ac8f[_0x0a9e('0x16')](_0x16b1ca)['send'](_0x5ea472);};}exports[_0x0a9e('0x26')]=function(_0x479bc4,_0x45a1e7){var _0x5bfb33={},_0x1dc186={},_0x34dc65={'count':0x0,'rows':[]};var _0x25fba9=_[_0x0a9e('0x27')](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x11c3b6){return{'name':_0x11c3b6[_0x0a9e('0x2a')],'type':_0x11c3b6['type'][_0x0a9e('0x2b')]};});_0x1dc186[_0x0a9e('0x2c')]=_[_0x0a9e('0x27')](_0x25fba9,_0x0a9e('0x25'));_0x1dc186['query']=_[_0x0a9e('0x2d')](_0x479bc4[_0x0a9e('0x2e')]);_0x1dc186[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x1dc186[_0x0a9e('0x2c')],_0x1dc186[_0x0a9e('0x2e')]);_0x5bfb33[_0x0a9e('0x31')]=_[_0x0a9e('0x30')](_0x1dc186[_0x0a9e('0x2c')],qs['fields'](_0x479bc4[_0x0a9e('0x2e')]['fields']));_0x5bfb33[_0x0a9e('0x31')]=_0x5bfb33[_0x0a9e('0x31')][_0x0a9e('0x32')]?_0x5bfb33[_0x0a9e('0x31')]:_0x1dc186[_0x0a9e('0x2c')];if(!_0x479bc4['query'][_0x0a9e('0x33')](_0x0a9e('0x34'))){_0x5bfb33[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x479bc4[_0x0a9e('0x2e')][_0x0a9e('0x1a')]);_0x5bfb33[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x479bc4['query'][_0x0a9e('0x19')]);}_0x5bfb33['order']=qs[_0x0a9e('0x35')](_0x479bc4[_0x0a9e('0x2e')][_0x0a9e('0x35')]);_0x5bfb33[_0x0a9e('0x36')]=qs['filters'](_[_0x0a9e('0x37')](_0x479bc4[_0x0a9e('0x2e')],_0x1dc186[_0x0a9e('0x2f')]),_0x25fba9);if(_0x479bc4[_0x0a9e('0x2e')]['filter']){_0x5bfb33['where']=_[_0x0a9e('0x38')](_0x5bfb33['where'],{'$or':_[_0x0a9e('0x27')](_0x25fba9,function(_0x3d9717){if(_0x3d9717[_0x0a9e('0x39')]!==_0x0a9e('0x3a')){var _0x4f41ae={};_0x4f41ae[_0x3d9717[_0x0a9e('0x25')]]={'$like':'%'+_0x479bc4[_0x0a9e('0x2e')][_0x0a9e('0x3b')]+'%'};return _0x4f41ae;}})});}_0x5bfb33=_['merge']({},_0x5bfb33,_0x479bc4[_0x0a9e('0x3c')]);var _0x1a180b={'where':_0x5bfb33[_0x0a9e('0x36')]};return db['Attachment']['count'](_0x1a180b)[_0x0a9e('0x21')](function(_0x40d766){_0x34dc65['count']=_0x40d766;if(_0x479bc4[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0x5bfb33[_0x0a9e('0x3e')]=[{'all':!![]}];}return db[_0x0a9e('0x28')]['findAll'](_0x5bfb33);})['then'](function(_0x15e37d){_0x34dc65[_0x0a9e('0x3f')]=_0x15e37d;return _0x34dc65;})['then'](respondWithFilteredResult(_0x45a1e7,_0x5bfb33))[_0x0a9e('0x40')](handleError(_0x45a1e7,null));};exports[_0x0a9e('0x41')]=function(_0x1459bb,_0x5b4f5e){var _0x316c8f={'raw':!![],'where':{'id':_0x1459bb[_0x0a9e('0x42')]['id']}},_0x2cfea9={};_0x2cfea9[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2cfea9[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x1459bb[_0x0a9e('0x2e')]);_0x2cfea9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x2cfea9[_0x0a9e('0x2c')],_0x2cfea9[_0x0a9e('0x2e')]);_0x316c8f[_0x0a9e('0x31')]=_['intersection'](_0x2cfea9['model'],qs[_0x0a9e('0x43')](_0x1459bb[_0x0a9e('0x2e')][_0x0a9e('0x43')]));_0x316c8f[_0x0a9e('0x31')]=_0x316c8f[_0x0a9e('0x31')][_0x0a9e('0x32')]?_0x316c8f[_0x0a9e('0x31')]:_0x2cfea9[_0x0a9e('0x2c')];if(_0x1459bb[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0x316c8f[_0x0a9e('0x3e')]=[{'all':!![]}];}_0x316c8f=_[_0x0a9e('0x38')]({},_0x316c8f,_0x1459bb['options']);return db[_0x0a9e('0x28')][_0x0a9e('0x44')](_0x316c8f)[_0x0a9e('0x21')](handleEntityNotFound(_0x5b4f5e,null))[_0x0a9e('0x21')](respondWithResult(_0x5b4f5e,null))[_0x0a9e('0x40')](handleError(_0x5b4f5e,null));};exports[_0x0a9e('0x45')]=function(_0x21eb86,_0x44dd99){var _0x59afe8={'where':{'id':_0x21eb86['params']['id']}},_0x2e9d90={};_0x2e9d90[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x28')]['rawAttributes']);_0x59afe8[_0x0a9e('0x31')]=_[_0x0a9e('0x30')](_0x2e9d90[_0x0a9e('0x2c')],qs[_0x0a9e('0x43')](_0x21eb86[_0x0a9e('0x2e')][_0x0a9e('0x43')]));_0x59afe8[_0x0a9e('0x31')]=_0x59afe8['attributes'][_0x0a9e('0x32')]?_0x59afe8[_0x0a9e('0x31')]:_0x2e9d90[_0x0a9e('0x2c')];if(_0x21eb86[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0x59afe8[_0x0a9e('0x3e')]=[{'all':!![]}];}_0x59afe8=_[_0x0a9e('0x38')]({},_0x59afe8,_0x21eb86[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')]['find'](_0x59afe8)[_0x0a9e('0x21')](handleEntityNotFound(_0x44dd99,null))[_0x0a9e('0x21')](function(_0x4f7240){if(_0x4f7240){var _0x4ae14b=_0x4f7240['get']({'plain':!![]});_0x4ae14b=qs[_0x0a9e('0x46')](_0x4ae14b,['id',_0x0a9e('0x47'),_0x0a9e('0x48')]);_0x21eb86[_0x0a9e('0x49')]=_[_0x0a9e('0x46')](_0x21eb86[_0x0a9e('0x49')],['id',_0x0a9e('0x47'),_0x0a9e('0x48')]);return db['Attachment']['create'](_['merge'](_0x4ae14b,_0x21eb86[_0x0a9e('0x49')]),{'include':_0x21eb86[_0x0a9e('0x2e')][_0x0a9e('0x3d')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x44dd99,0xc9))[_0x0a9e('0x40')](handleError(_0x44dd99,null));};exports[_0x0a9e('0x4a')]=function(_0x53d113,_0x5a88da){if(_0x53d113[_0x0a9e('0x49')]['id']){delete _0x53d113['body']['id'];}return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x53d113[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x5a88da,null))[_0x0a9e('0x21')](saveUpdates(_0x53d113['body'],null))[_0x0a9e('0x21')](respondWithResult(_0x5a88da,null))[_0x0a9e('0x40')](handleError(_0x5a88da,null));};exports['destroy']=function(_0x50f687,_0x128aa6){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x50f687[_0x0a9e('0x42')]['id']}})['then'](handleEntityNotFound(_0x128aa6,null))[_0x0a9e('0x21')](removeEntity(_0x128aa6,null))['catch'](handleError(_0x128aa6,null));};exports[_0x0a9e('0x4b')]=function(_0x4a6deb,_0x5da27d,_0x5df0ad){_0x4a6deb[_0x0a9e('0x49')]['name']=_0x4a6deb[_0x0a9e('0x4c')][_0x0a9e('0x4d')];_0x4a6deb[_0x0a9e('0x49')][_0x0a9e('0x4e')]=_0x4a6deb[_0x0a9e('0x4c')][_0x0a9e('0x4f')];_0x4a6deb[_0x0a9e('0x49')][_0x0a9e('0x39')]=_0x4a6deb['file'][_0x0a9e('0x50')];return db[_0x0a9e('0x28')][_0x0a9e('0x4b')](_0x4a6deb[_0x0a9e('0x49')])[_0x0a9e('0x21')](respondWithResult(_0x5da27d,0xc9))[_0x0a9e('0x40')](handleError(_0x5da27d,null));};exports['download']=function(_0x956fbe,_0x26bc80,_0x5239ef){return db[_0x0a9e('0x28')]['findOne']({'where':{'id':_0x956fbe[_0x0a9e('0x42')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x26bc80,null))['then'](function(_0x5674ee){if(_0x5674ee){var _0x273cb5=_0x5674ee['ChatOfflineMessageId']!==null;var _0x2244d6=path[_0x0a9e('0x51')](config[_0x0a9e('0x52')],_0x0a9e('0x53'));if(_0x273cb5){_0x2244d6=path[_0x0a9e('0x51')](_0x2244d6,_0x0a9e('0x54'));}var _0x49eed0=path[_0x0a9e('0x51')](_0x2244d6,_0x5674ee['basename']);return _0x26bc80[_0x0a9e('0x55')](_0x49eed0);}})[_0x0a9e('0x40')](handleError(_0x26bc80,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','fields','find','clone','omit','createdAt','updatedAt','body','update','create','file','originalname','basename','filename','mimetype','join','root','server/files/attachments/','offline-chat/','download','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','stack','name','index','map','Attachment','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit'];(function(_0xe81e03,_0x15695d){var _0x2e87c6=function(_0x17557e){while(--_0x17557e){_0xe81e03['push'](_0xe81e03['shift']());}};_0x2e87c6(++_0x15695d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var fs_extra=require(_0x0a9e('0xa'));var _=require(_0x0a9e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0a9e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0a9e('0xd'));var Papa=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var licenseUtil=require(_0x0a9e('0x14'));var db=require(_0x0a9e('0x15'))['db'];function respondWithStatusCode(_0x26d672,_0x32d742){_0x32d742=_0x32d742||0xcc;return function(_0x69aeb7){if(_0x69aeb7){return _0x26d672['sendStatus'](_0x32d742);}return _0x26d672[_0x0a9e('0x16')](_0x32d742)[_0x0a9e('0x17')]();};}function respondWithResult(_0x2b4227,_0x281129){_0x281129=_0x281129||0xc8;return function(_0x44dcfd){if(_0x44dcfd){return _0x2b4227[_0x0a9e('0x16')](_0x281129)['json'](_0x44dcfd);}};}function respondWithFilteredResult(_0x22dccb,_0x5d0880){return function(_0x1985b6){if(_0x1985b6){var _0x519dfd=_0x1985b6[_0x0a9e('0x18')],_0x16033c=_0x5d0880['offset'],_0x12066b=_0x5d0880[_0x0a9e('0x19')]+_0x5d0880[_0x0a9e('0x1a')],_0x48f32d;if(_0x12066b>=_0x519dfd){_0x12066b=_0x519dfd;_0x48f32d=0xc8;}else{_0x48f32d=0xce;}_0x22dccb[_0x0a9e('0x16')](_0x48f32d);return _0x22dccb[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x16033c+'-'+_0x12066b+'/'+_0x519dfd)[_0x0a9e('0x1d')](_0x1985b6);}return null;};}function patchUpdates(_0x530eb7){return function(_0x20559e){try{jsonpatch[_0x0a9e('0x1e')](_0x20559e,_0x530eb7,!![]);}catch(_0x112016){return BPromise[_0x0a9e('0x1f')](_0x112016);}return _0x20559e[_0x0a9e('0x20')]();};}function saveUpdates(_0x4bb1e3,_0x2c3407){return function(_0x155cce){if(_0x155cce){return _0x155cce['update'](_0x4bb1e3)[_0x0a9e('0x21')](function(_0x5a09ef){return _0x5a09ef;});}return null;};}function removeEntity(_0x588269,_0x3a02e1){return function(_0x432e56){if(_0x432e56){return _0x432e56[_0x0a9e('0x22')]()[_0x0a9e('0x21')](function(){_0x588269['status'](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(!_0x4d00e6){_0x2fb0e4[_0x0a9e('0x23')](0x194);}return _0x4d00e6;};}function handleError(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0x1f4;return function(_0x5ea472){logger['error'](_0x5ea472[_0x0a9e('0x24')]);if(_0x5ea472[_0x0a9e('0x25')]){delete _0x5ea472[_0x0a9e('0x25')];}_0x42ac8f[_0x0a9e('0x16')](_0x16b1ca)['send'](_0x5ea472);};}exports[_0x0a9e('0x26')]=function(_0x479bc4,_0x45a1e7){var _0x5bfb33={},_0x1dc186={},_0x34dc65={'count':0x0,'rows':[]};var _0x25fba9=_[_0x0a9e('0x27')](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x11c3b6){return{'name':_0x11c3b6[_0x0a9e('0x2a')],'type':_0x11c3b6['type'][_0x0a9e('0x2b')]};});_0x1dc186[_0x0a9e('0x2c')]=_[_0x0a9e('0x27')](_0x25fba9,_0x0a9e('0x25'));_0x1dc186['query']=_[_0x0a9e('0x2d')](_0x479bc4[_0x0a9e('0x2e')]);_0x1dc186[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x1dc186[_0x0a9e('0x2c')],_0x1dc186[_0x0a9e('0x2e')]);_0x5bfb33[_0x0a9e('0x31')]=_[_0x0a9e('0x30')](_0x1dc186[_0x0a9e('0x2c')],qs['fields'](_0x479bc4[_0x0a9e('0x2e')]['fields']));_0x5bfb33[_0x0a9e('0x31')]=_0x5bfb33[_0x0a9e('0x31')][_0x0a9e('0x32')]?_0x5bfb33[_0x0a9e('0x31')]:_0x1dc186[_0x0a9e('0x2c')];if(!_0x479bc4['query'][_0x0a9e('0x33')](_0x0a9e('0x34'))){_0x5bfb33[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x479bc4[_0x0a9e('0x2e')][_0x0a9e('0x1a')]);_0x5bfb33[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x479bc4['query'][_0x0a9e('0x19')]);}_0x5bfb33['order']=qs[_0x0a9e('0x35')](_0x479bc4[_0x0a9e('0x2e')][_0x0a9e('0x35')]);_0x5bfb33[_0x0a9e('0x36')]=qs['filters'](_[_0x0a9e('0x37')](_0x479bc4[_0x0a9e('0x2e')],_0x1dc186[_0x0a9e('0x2f')]),_0x25fba9);if(_0x479bc4[_0x0a9e('0x2e')]['filter']){_0x5bfb33['where']=_[_0x0a9e('0x38')](_0x5bfb33['where'],{'$or':_[_0x0a9e('0x27')](_0x25fba9,function(_0x3d9717){if(_0x3d9717[_0x0a9e('0x39')]!==_0x0a9e('0x3a')){var _0x4f41ae={};_0x4f41ae[_0x3d9717[_0x0a9e('0x25')]]={'$like':'%'+_0x479bc4[_0x0a9e('0x2e')][_0x0a9e('0x3b')]+'%'};return _0x4f41ae;}})});}_0x5bfb33=_['merge']({},_0x5bfb33,_0x479bc4[_0x0a9e('0x3c')]);var _0x1a180b={'where':_0x5bfb33[_0x0a9e('0x36')]};return db['Attachment']['count'](_0x1a180b)[_0x0a9e('0x21')](function(_0x40d766){_0x34dc65['count']=_0x40d766;if(_0x479bc4[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0x5bfb33[_0x0a9e('0x3e')]=[{'all':!![]}];}return db[_0x0a9e('0x28')]['findAll'](_0x5bfb33);})['then'](function(_0x15e37d){_0x34dc65[_0x0a9e('0x3f')]=_0x15e37d;return _0x34dc65;})['then'](respondWithFilteredResult(_0x45a1e7,_0x5bfb33))[_0x0a9e('0x40')](handleError(_0x45a1e7,null));};exports[_0x0a9e('0x41')]=function(_0x1459bb,_0x5b4f5e){var _0x316c8f={'raw':!![],'where':{'id':_0x1459bb[_0x0a9e('0x42')]['id']}},_0x2cfea9={};_0x2cfea9[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2cfea9[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x1459bb[_0x0a9e('0x2e')]);_0x2cfea9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x2cfea9[_0x0a9e('0x2c')],_0x2cfea9[_0x0a9e('0x2e')]);_0x316c8f[_0x0a9e('0x31')]=_['intersection'](_0x2cfea9['model'],qs[_0x0a9e('0x43')](_0x1459bb[_0x0a9e('0x2e')][_0x0a9e('0x43')]));_0x316c8f[_0x0a9e('0x31')]=_0x316c8f[_0x0a9e('0x31')][_0x0a9e('0x32')]?_0x316c8f[_0x0a9e('0x31')]:_0x2cfea9[_0x0a9e('0x2c')];if(_0x1459bb[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0x316c8f[_0x0a9e('0x3e')]=[{'all':!![]}];}_0x316c8f=_[_0x0a9e('0x38')]({},_0x316c8f,_0x1459bb['options']);return db[_0x0a9e('0x28')][_0x0a9e('0x44')](_0x316c8f)[_0x0a9e('0x21')](handleEntityNotFound(_0x5b4f5e,null))[_0x0a9e('0x21')](respondWithResult(_0x5b4f5e,null))[_0x0a9e('0x40')](handleError(_0x5b4f5e,null));};exports[_0x0a9e('0x45')]=function(_0x21eb86,_0x44dd99){var _0x59afe8={'where':{'id':_0x21eb86['params']['id']}},_0x2e9d90={};_0x2e9d90[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x28')]['rawAttributes']);_0x59afe8[_0x0a9e('0x31')]=_[_0x0a9e('0x30')](_0x2e9d90[_0x0a9e('0x2c')],qs[_0x0a9e('0x43')](_0x21eb86[_0x0a9e('0x2e')][_0x0a9e('0x43')]));_0x59afe8[_0x0a9e('0x31')]=_0x59afe8['attributes'][_0x0a9e('0x32')]?_0x59afe8[_0x0a9e('0x31')]:_0x2e9d90[_0x0a9e('0x2c')];if(_0x21eb86[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0x59afe8[_0x0a9e('0x3e')]=[{'all':!![]}];}_0x59afe8=_[_0x0a9e('0x38')]({},_0x59afe8,_0x21eb86[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')]['find'](_0x59afe8)[_0x0a9e('0x21')](handleEntityNotFound(_0x44dd99,null))[_0x0a9e('0x21')](function(_0x4f7240){if(_0x4f7240){var _0x4ae14b=_0x4f7240['get']({'plain':!![]});_0x4ae14b=qs[_0x0a9e('0x46')](_0x4ae14b,['id',_0x0a9e('0x47'),_0x0a9e('0x48')]);_0x21eb86[_0x0a9e('0x49')]=_[_0x0a9e('0x46')](_0x21eb86[_0x0a9e('0x49')],['id',_0x0a9e('0x47'),_0x0a9e('0x48')]);return db['Attachment']['create'](_['merge'](_0x4ae14b,_0x21eb86[_0x0a9e('0x49')]),{'include':_0x21eb86[_0x0a9e('0x2e')][_0x0a9e('0x3d')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x44dd99,0xc9))[_0x0a9e('0x40')](handleError(_0x44dd99,null));};exports[_0x0a9e('0x4a')]=function(_0x53d113,_0x5a88da){if(_0x53d113[_0x0a9e('0x49')]['id']){delete _0x53d113['body']['id'];}return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x53d113[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x5a88da,null))[_0x0a9e('0x21')](saveUpdates(_0x53d113['body'],null))[_0x0a9e('0x21')](respondWithResult(_0x5a88da,null))[_0x0a9e('0x40')](handleError(_0x5a88da,null));};exports['destroy']=function(_0x50f687,_0x128aa6){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x50f687[_0x0a9e('0x42')]['id']}})['then'](handleEntityNotFound(_0x128aa6,null))[_0x0a9e('0x21')](removeEntity(_0x128aa6,null))['catch'](handleError(_0x128aa6,null));};exports[_0x0a9e('0x4b')]=function(_0x4a6deb,_0x5da27d,_0x5df0ad){_0x4a6deb[_0x0a9e('0x49')]['name']=_0x4a6deb[_0x0a9e('0x4c')][_0x0a9e('0x4d')];_0x4a6deb[_0x0a9e('0x49')][_0x0a9e('0x4e')]=_0x4a6deb[_0x0a9e('0x4c')][_0x0a9e('0x4f')];_0x4a6deb[_0x0a9e('0x49')][_0x0a9e('0x39')]=_0x4a6deb['file'][_0x0a9e('0x50')];return db[_0x0a9e('0x28')][_0x0a9e('0x4b')](_0x4a6deb[_0x0a9e('0x49')])[_0x0a9e('0x21')](respondWithResult(_0x5da27d,0xc9))[_0x0a9e('0x40')](handleError(_0x5da27d,null));};exports['download']=function(_0x956fbe,_0x26bc80,_0x5239ef){return db[_0x0a9e('0x28')]['findOne']({'where':{'id':_0x956fbe[_0x0a9e('0x42')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x26bc80,null))['then'](function(_0x5674ee){if(_0x5674ee){var _0x273cb5=_0x5674ee['ChatOfflineMessageId']!==null;var _0x2244d6=path[_0x0a9e('0x51')](config[_0x0a9e('0x52')],_0x0a9e('0x53'));if(_0x273cb5){_0x2244d6=path[_0x0a9e('0x51')](_0x2244d6,_0x0a9e('0x54'));}var _0x49eed0=path[_0x0a9e('0x51')](_0x2244d6,_0x5674ee['basename']);return _0x26bc80[_0x0a9e('0x55')](_0x49eed0);}})[_0x0a9e('0x40')](handleError(_0x26bc80,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 36418f7..77e4810 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 _0x98b7=['rimraf','../../config/environment','./attachment.attributes','exports','Attachment','attachments','lodash','util','../../config/logger','api','path'];(function(_0x20210e,_0x1603f6){var _0x439c00=function(_0x5b4cc2){while(--_0x5b4cc2){_0x20210e['push'](_0x20210e['shift']());}};_0x439c00(++_0x1603f6);}(_0x98b7,0xc1));var _0x798b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x98b7[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x798b('0x0'));var util=require(_0x798b('0x1'));var logger=require(_0x798b('0x2'))(_0x798b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x798b('0x4'));var rimraf=require(_0x798b('0x5'));var config=require(_0x798b('0x6'));var attributes=require(_0x798b('0x7'));module[_0x798b('0x8')]=function(_0x4c197e,_0x2bab89){return _0x4c197e['define'](_0x798b('0x9'),attributes,{'tableName':_0x798b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea5b=['bluebird','request-promise','path','rimraf','./attachment.attributes','define','Attachment','attachments','lodash','util','../../config/logger'];(function(_0x2dd390,_0x1bc894){var _0x3afe47=function(_0x42d8d3){while(--_0x42d8d3){_0x2dd390['push'](_0x2dd390['shift']());}};_0x3afe47(++_0x1bc894);}(_0xea5b,0x152));var _0xbea5=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xea5b[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xbea5('0x0'));var util=require(_0xbea5('0x1'));var logger=require(_0xbea5('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbea5('0x3'));var rp=require(_0xbea5('0x4'));var fs=require('fs');var path=require(_0xbea5('0x5'));var rimraf=require(_0xbea5('0x6'));var config=require('../../config/environment');var attributes=require(_0xbea5('0x7'));module['exports']=function(_0x2db67a,_0x3d9263){return _0x2db67a[_0xbea5('0x8')](_0xbea5('0x9'),attributes,{'tableName':_0xbea5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index f2fd575..c6d4d72 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 _0x9cbf=['rpc','../../config/environment','client','http','request','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateAttachment','Attachment','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x4bb555,_0x3aff4a){var _0x71910a=function(_0x3ce4a8){while(--_0x3ce4a8){_0x4bb555['push'](_0x4bb555['shift']());}};_0x71910a(++_0x3aff4a);}(_0x9cbf,0xe1));var _0xf9cb=function(_0x59355c,_0x10ff75){_0x59355c=_0x59355c-0x0;var _0x5f59bf=_0x9cbf[_0x59355c];return _0x5f59bf;};'use strict';var _=require(_0xf9cb('0x0'));var util=require(_0xf9cb('0x1'));var moment=require(_0xf9cb('0x2'));var BPromise=require(_0xf9cb('0x3'));var rs=require(_0xf9cb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf9cb('0x5'))['db'];var utils=require(_0xf9cb('0x6'));var logger=require('../../config/logger')(_0xf9cb('0x7'));var config=require(_0xf9cb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf9cb('0x9')][_0xf9cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x337ed4,_0x50fd0f,_0x3c6061){return new BPromise(function(_0x58b707,_0x36c7f6){return client[_0xf9cb('0xb')](_0x337ed4,_0x3c6061)['then'](function(_0x54e0be){logger['info'](_0xf9cb('0xc'),_0x50fd0f,_0xf9cb('0xd'));logger[_0xf9cb('0xe')](_0xf9cb('0xf'),_0x50fd0f,_0xf9cb('0xd'),JSON[_0xf9cb('0x10')](_0x54e0be));if(_0x54e0be[_0xf9cb('0x11')]){if(_0x54e0be[_0xf9cb('0x11')][_0xf9cb('0x12')]===0x1f4){logger['error'](_0xf9cb('0xc'),_0x50fd0f,_0x54e0be[_0xf9cb('0x11')][_0xf9cb('0x13')]);return _0x36c7f6(_0x54e0be[_0xf9cb('0x11')]['message']);}logger['error'](_0xf9cb('0xc'),_0x50fd0f,_0x54e0be[_0xf9cb('0x11')][_0xf9cb('0x13')]);return _0x58b707(_0x54e0be[_0xf9cb('0x11')]['message']);}else{logger[_0xf9cb('0x14')]('Attachment,\x20%s,\x20%s',_0x50fd0f,_0xf9cb('0xd'));_0x58b707(_0x54e0be['result'][_0xf9cb('0x13')]);}})[_0xf9cb('0x15')](function(_0x1b9dff){logger['error'](_0xf9cb('0xc'),_0x50fd0f,_0x1b9dff);_0x36c7f6(_0x1b9dff);});});}exports[_0xf9cb('0x16')]=function(_0x134700){var _0x424e62=this;return new Promise(function(_0xcd0aa1,_0x36ac9d){return db[_0xf9cb('0x17')][_0xf9cb('0x18')](_0x134700[_0xf9cb('0x19')],{'raw':_0x134700[_0xf9cb('0x1a')]?_0x134700[_0xf9cb('0x1a')][_0xf9cb('0x1b')]===undefined?!![]:![]:!![]})[_0xf9cb('0x1c')](function(_0x3ace7b){logger['info']('CreateAttachment',_0x134700);logger[_0xf9cb('0xe')](_0xf9cb('0x16'),_0x134700,JSON[_0xf9cb('0x10')](_0x3ace7b));_0xcd0aa1(_0x3ace7b);})['catch'](function(_0x239f8b){logger[_0xf9cb('0x11')]('CreateAttachment',_0x239f8b[_0xf9cb('0x13')],_0x134700);_0x36ac9d(_0x424e62[_0xf9cb('0x11')](0x1f4,_0x239f8b[_0xf9cb('0x13')]));});});}; \ No newline at end of file +var _0x970c=['create','options','debug','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','client','http','request','then','info','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Attachment,\x20%s,\x20%s','CreateAttachment'];(function(_0x1a57cb,_0x5ec459){var _0x4d59c8=function(_0x2afc92){while(--_0x2afc92){_0x1a57cb['push'](_0x1a57cb['shift']());}};_0x4d59c8(++_0x5ec459);}(_0x970c,0x1ac));var _0xc970=function(_0x8bda08,_0x1fdb02){_0x8bda08=_0x8bda08-0x0;var _0x50007f=_0x970c[_0x8bda08];return _0x50007f;};'use strict';var _=require(_0xc970('0x0'));var util=require(_0xc970('0x1'));var moment=require(_0xc970('0x2'));var BPromise=require('bluebird');var rs=require(_0xc970('0x3'));var fs=require('fs');var Redis=require(_0xc970('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc970('0x5'));var logger=require('../../config/logger')(_0xc970('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc970('0x7')][_0xc970('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e0645,_0x984617,_0x1e6dcd){return new BPromise(function(_0x15a0ad,_0x46fc94){return client[_0xc970('0x9')](_0x4e0645,_0x1e6dcd)[_0xc970('0xa')](function(_0x4563cf){logger[_0xc970('0xb')]('Attachment,\x20%s,\x20%s',_0x984617,'request\x20sent');logger['debug'](_0xc970('0xc'),_0x984617,_0xc970('0xd'),JSON[_0xc970('0xe')](_0x4563cf));if(_0x4563cf['error']){if(_0x4563cf[_0xc970('0xf')][_0xc970('0x10')]===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x984617,_0x4563cf[_0xc970('0xf')][_0xc970('0x11')]);return _0x46fc94(_0x4563cf[_0xc970('0xf')][_0xc970('0x11')]);}logger[_0xc970('0xf')]('Attachment,\x20%s,\x20%s',_0x984617,_0x4563cf[_0xc970('0xf')][_0xc970('0x11')]);return _0x15a0ad(_0x4563cf[_0xc970('0xf')]['message']);}else{logger[_0xc970('0xb')]('Attachment,\x20%s,\x20%s',_0x984617,'request\x20sent');_0x15a0ad(_0x4563cf[_0xc970('0x12')][_0xc970('0x11')]);}})[_0xc970('0x13')](function(_0x4ebfd2){logger['error'](_0xc970('0x14'),_0x984617,_0x4ebfd2);_0x46fc94(_0x4ebfd2);});});}exports[_0xc970('0x15')]=function(_0xded351){var _0x5b242e=this;return new Promise(function(_0x2e719c,_0x4d9ecf){return db['Attachment'][_0xc970('0x16')](_0xded351['body'],{'raw':_0xded351[_0xc970('0x17')]?_0xded351[_0xc970('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xc970('0xa')](function(_0x34b717){logger[_0xc970('0xb')](_0xc970('0x15'),_0xded351);logger[_0xc970('0x18')](_0xc970('0x15'),_0xded351,JSON['stringify'](_0x34b717));_0x2e719c(_0x34b717);})[_0xc970('0x13')](function(_0x591b80){logger[_0xc970('0xf')]('CreateAttachment',_0x591b80[_0xc970('0x11')],_0xded351);_0x4d9ecf(_0x5b242e[_0xc970('0xf')](0x1f4,_0x591b80[_0xc970('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 258f13e..3c330bf 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 _0xb9be=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','now','originalname','replace','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0x5775c4,_0x11631c){var _0xa2e3a1=function(_0x3c9a67){while(--_0x3c9a67){_0x5775c4['push'](_0x5775c4['shift']());}};_0xa2e3a1(++_0x11631c);}(_0xb9be,0xc5));var _0xeb9b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xb9be[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var path=require(_0xeb9b('0x2'));var timeout=require(_0xeb9b('0x3'));var express=require(_0xeb9b('0x4'));var router=express[_0xeb9b('0x5')]();var fs_extra=require(_0xeb9b('0x6'));var auth=require(_0xeb9b('0x7'));var interaction=require(_0xeb9b('0x8'));var config=require('../../config/environment');var controller=require('./attachment.controller');router[_0xeb9b('0x9')]('/',auth[_0xeb9b('0xa')](),controller[_0xeb9b('0xb')]);router['get'](_0xeb9b('0xc'),auth[_0xeb9b('0xa')](),controller[_0xeb9b('0xd')]);router[_0xeb9b('0x9')](_0xeb9b('0xe'),auth[_0xeb9b('0xa')](),controller[_0xeb9b('0xf')]);router[_0xeb9b('0x10')](_0xeb9b('0x11'),auth['isAuthenticated'](),controller[_0xeb9b('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4ea7bb,_0xa3b541,_0x4236c0){_0x4236c0(null,path['join'](config[_0xeb9b('0x13')],_0xeb9b('0x14')));},'filename':function(_0x3df18a,_0x2a01df,_0x51598f){_0x51598f(null,util['format']('%s-%s',Date[_0xeb9b('0x15')](),_0x2a01df[_0xeb9b('0x16')][_0xeb9b('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload['single']('file'),controller[_0xeb9b('0x18')]);router[_0xeb9b('0x19')](_0xeb9b('0xc'),auth[_0xeb9b('0xa')](),controller[_0xeb9b('0x1a')]);router[_0xeb9b('0x1b')](_0xeb9b('0xc'),auth['isAuthenticated'](),controller[_0xeb9b('0x1c')]);module[_0xeb9b('0x1d')]=router; \ No newline at end of file +var _0x00b3=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','%s-%s','now','originalname','create','put','/:id','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./attachment.controller','get','isAuthenticated','index','/:id/download','download'];(function(_0x272764,_0x16630c){var _0xab237d=function(_0x38195b){while(--_0x38195b){_0x272764['push'](_0x272764['shift']());}};_0xab237d(++_0x16630c);}(_0x00b3,0x17a));var _0x300b=function(_0x529f72,_0x47f1e3){_0x529f72=_0x529f72-0x0;var _0x2d884a=_0x00b3[_0x529f72];return _0x2d884a;};'use strict';var multer=require('multer');var util=require(_0x300b('0x0'));var path=require(_0x300b('0x1'));var timeout=require(_0x300b('0x2'));var express=require(_0x300b('0x3'));var router=express['Router']();var fs_extra=require(_0x300b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x300b('0x5'));var config=require('../../config/environment');var controller=require(_0x300b('0x6'));router[_0x300b('0x7')]('/',auth[_0x300b('0x8')](),controller[_0x300b('0x9')]);router['get']('/:id',auth[_0x300b('0x8')](),controller['show']);router['get'](_0x300b('0xa'),auth[_0x300b('0x8')](),controller[_0x300b('0xb')]);router['post'](_0x300b('0xc'),auth[_0x300b('0x8')](),controller[_0x300b('0xd')]);var upload=multer({'storage':multer[_0x300b('0xe')]({'destination':function(_0x566fb9,_0x1a96aa,_0x2eeb2d){_0x2eeb2d(null,path[_0x300b('0xf')](config['root'],_0x300b('0x10')));},'filename':function(_0xea95bb,_0x138efb,_0x40c03b){_0x40c03b(null,util[_0x300b('0x11')](_0x300b('0x12'),Date[_0x300b('0x13')](),_0x138efb[_0x300b('0x14')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload['single']('file'),controller[_0x300b('0x15')]);router[_0x300b('0x16')](_0x300b('0x17'),auth[_0x300b('0x8')](),controller['update']);router['delete'](_0x300b('0x17'),auth[_0x300b('0x8')](),controller[_0x300b('0x18')]);module[_0x300b('0x19')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 0200fca..4f9dd59 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 _0x5c02=['minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/utils','login','authenticate','google','profile','/login','use','clientSecret','secret','Setting','findOne','allowedLoginAttempts','blockDuration','then','find','map','emails','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add'];(function(_0x446f11,_0x1b4d8f){var _0x4edcbd=function(_0x5e9df5){while(--_0x5e9df5){_0x446f11['push'](_0x446f11['shift']());}};_0x4edcbd(++_0x1b4d8f);}(_0x5c02,0x1a8));var _0x25c0=function(_0x760f5c,_0x533de5){_0x760f5c=_0x760f5c-0x0;var _0x210cd6=_0x5c02[_0x760f5c];return _0x210cd6;};'use strict';var _=require(_0x25c0('0x0'));var passport=require(_0x25c0('0x1'));var GoogleStrategy=require(_0x25c0('0x2'))[_0x25c0('0x3')];var moment=require(_0x25c0('0x4'));var db=require(_0x25c0('0x5'))['db'];var config=require('../../config/environment');var signToken=require('../../components/auth/service')['signToken'];var utils=require(_0x25c0('0x6'));exports[_0x25c0('0x7')]=passport[_0x25c0('0x8')](_0x25c0('0x9'),{'failureRedirect':'/login','scope':[_0x25c0('0xa'),'email'],'session':![]});exports['callback']=passport[_0x25c0('0x8')](_0x25c0('0x9'),{'failureRedirect':_0x25c0('0xb'),'session':![]});passport[_0x25c0('0xc')](new GoogleStrategy({'clientID':config['google']?config[_0x25c0('0x9')]['clientID']:'id','clientSecret':config[_0x25c0('0x9')]?config['google'][_0x25c0('0xd')]:_0x25c0('0xe'),'callbackURL':config['google']?config[_0x25c0('0x9')]['callbackURL']:''},function(_0x25062a,_0x212eb6,_0x1e6f8d,_0x49d933){var _0x4bc567,_0x2b65b7;return db[_0x25c0('0xf')][_0x25c0('0x10')]({'where':{'id':0x1},'attributes':[_0x25c0('0x11'),_0x25c0('0x12')],'raw':!![]})[_0x25c0('0x13')](function(_0xc81c72){_0x4bc567=_0xc81c72;return db['User'][_0x25c0('0x14')]({'where':{'email':_[_0x25c0('0x15')](_0x1e6f8d[_0x25c0('0x16')],'value'),'role':{'$or':['admin','user',_0x25c0('0x17')]}}});})['then'](function(_0x5913c6){_0x2b65b7=_0x5913c6;if(_0x2b65b7){if(_0x2b65b7['disabled']){return _0x49d933(_0x25c0('0x18'));}else if(_0x4bc567['blockDuration']>0x0){if(_0x2b65b7['blocked']){if(moment(_0x2b65b7['blockedAt'])[_0x25c0('0x19')](_0x4bc567[_0x25c0('0x12')],_0x25c0('0x1a'))>moment()){return _0x49d933(_0x25c0('0x18'));}else{return utils[_0x25c0('0x1b')](_0x2b65b7,0x0,![],null)['then'](function(){return utils[_0x25c0('0x1c')](_0x2b65b7);})[_0x25c0('0x13')](function(){return _0x49d933(null,_0x2b65b7);});}}else{return utils[_0x25c0('0x1c')](_0x2b65b7)[_0x25c0('0x13')](function(){return _0x49d933(null,_0x2b65b7);});}}else{return utils['getLicense'](_0x2b65b7)[_0x25c0('0x13')](function(){return _0x49d933(null,_0x2b65b7);});}}return _0x49d933(_0x25c0('0x18'));})[_0x25c0('0x1d')](function(_0x43b28f){_0x49d933(_0x43b28f);});})); \ No newline at end of file +var _0x04fb=['callback','use','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','find','map','emails','admin','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','profile'];(function(_0x24afa6,_0x5c26db){var _0x2896a2=function(_0x598137){while(--_0x598137){_0x24afa6['push'](_0x24afa6['shift']());}};_0x2896a2(++_0x5c26db);}(_0x04fb,0x15a));var _0xb04f=function(_0xc1cb80,_0x60f7cf){_0xc1cb80=_0xc1cb80-0x0;var _0x55ab6b=_0x04fb[_0xc1cb80];return _0x55ab6b;};'use strict';var _=require('lodash');var passport=require(_0xb04f('0x0'));var GoogleStrategy=require(_0xb04f('0x1'))[_0xb04f('0x2')];var moment=require(_0xb04f('0x3'));var db=require(_0xb04f('0x4'))['db'];var config=require(_0xb04f('0x5'));var signToken=require(_0xb04f('0x6'))[_0xb04f('0x7')];var utils=require(_0xb04f('0x8'));exports[_0xb04f('0x9')]=passport[_0xb04f('0xa')](_0xb04f('0xb'),{'failureRedirect':_0xb04f('0xc'),'scope':[_0xb04f('0xd'),'email'],'session':![]});exports[_0xb04f('0xe')]=passport[_0xb04f('0xa')](_0xb04f('0xb'),{'failureRedirect':_0xb04f('0xc'),'session':![]});passport[_0xb04f('0xf')](new GoogleStrategy({'clientID':config[_0xb04f('0xb')]?config[_0xb04f('0xb')]['clientID']:'id','clientSecret':config[_0xb04f('0xb')]?config['google'][_0xb04f('0x10')]:_0xb04f('0x11'),'callbackURL':config[_0xb04f('0xb')]?config[_0xb04f('0xb')][_0xb04f('0x12')]:''},function(_0x9507ad,_0x5b284c,_0x14094e,_0x3662ef){var _0x5ce9df,_0xe0046c;return db[_0xb04f('0x13')][_0xb04f('0x14')]({'where':{'id':0x1},'attributes':[_0xb04f('0x15'),_0xb04f('0x16')],'raw':!![]})[_0xb04f('0x17')](function(_0x3f153b){_0x5ce9df=_0x3f153b;return db['User'][_0xb04f('0x18')]({'where':{'email':_[_0xb04f('0x19')](_0x14094e[_0xb04f('0x1a')],'value'),'role':{'$or':[_0xb04f('0x1b'),'user','agent']}}});})[_0xb04f('0x17')](function(_0x373dd9){_0xe0046c=_0x373dd9;if(_0xe0046c){if(_0xe0046c[_0xb04f('0x1c')]){return _0x3662ef(_0xb04f('0x1d'));}else if(_0x5ce9df['blockDuration']>0x0){if(_0xe0046c[_0xb04f('0x1e')]){if(moment(_0xe0046c[_0xb04f('0x1f')])[_0xb04f('0x20')](_0x5ce9df[_0xb04f('0x16')],_0xb04f('0x21'))>moment()){return _0x3662ef(_0xb04f('0x1d'));}else{return utils[_0xb04f('0x22')](_0xe0046c,0x0,![],null)[_0xb04f('0x17')](function(){return utils['getLicense'](_0xe0046c);})[_0xb04f('0x17')](function(){return _0x3662ef(null,_0xe0046c);});}}else{return utils[_0xb04f('0x23')](_0xe0046c)[_0xb04f('0x17')](function(){return _0x3662ef(null,_0xe0046c);});}}else{return utils[_0xb04f('0x23')](_0xe0046c)['then'](function(){return _0x3662ef(null,_0xe0046c);});}}return _0x3662ef('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})['catch'](function(_0x2ebdc4){_0x3662ef(_0x2ebdc4);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 67fd469..b4c05a9 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 _0x515d=['passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','callback','setTokenCookie','exports'];(function(_0x186648,_0x420365){var _0x102ad3=function(_0x7ba5f6){while(--_0x7ba5f6){_0x186648['push'](_0x186648['shift']());}};_0x102ad3(++_0x420365);}(_0x515d,0x104));var _0xd515=function(_0x4f3de9,_0x1411ab){_0x4f3de9=_0x4f3de9-0x0;var _0x533c9b=_0x515d[_0x4f3de9];return _0x533c9b;};'use strict';var express=require('express');var passport=require(_0xd515('0x0'));var router=express[_0xd515('0x1')]();var controller=require(_0xd515('0x2'));var userController=require(_0xd515('0x3'));var authService=require(_0xd515('0x4'));router[_0xd515('0x5')]('/',controller[_0xd515('0x6')]);router[_0xd515('0x5')]('/callback',controller[_0xd515('0x7')],authService['isMiddleware'],userController['login'],authService[_0xd515('0x8')]);module[_0xd515('0x9')]=router; \ No newline at end of file +var _0x0dba=['callback','isMiddleware','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback'];(function(_0x38af48,_0x400460){var _0x445384=function(_0x464435){while(--_0x464435){_0x38af48['push'](_0x38af48['shift']());}};_0x445384(++_0x400460);}(_0x0dba,0x136));var _0xa0db=function(_0x3d526b,_0x1b6dda){_0x3d526b=_0x3d526b-0x0;var _0x3ed17e=_0x0dba[_0x3d526b];return _0x3ed17e;};'use strict';var express=require(_0xa0db('0x0'));var passport=require(_0xa0db('0x1'));var router=express[_0xa0db('0x2')]();var controller=require(_0xa0db('0x3'));var userController=require(_0xa0db('0x4'));var authService=require(_0xa0db('0x5'));router[_0xa0db('0x6')]('/',controller[_0xa0db('0x7')]);router[_0xa0db('0x6')](_0xa0db('0x8'),controller[_0xa0db('0x9')],authService[_0xa0db('0xa')],userController['login'],authService['setTokenCookie']);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 1693574..0f7cc08 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 _0x6d11=['resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','https://','headers','/reset/','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','Password\x20reset!','use','util','passport','passport-local','jayson/promise','randomstring','moment','../../config/utils','client','http','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','status','send','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.'];(function(_0x5600ba,_0xe51f7c){var _0x2db0f1=function(_0x4a5896){while(--_0x4a5896){_0x5600ba['push'](_0x5600ba['shift']());}};_0x2db0f1(++_0xe51f7c);}(_0x6d11,0xbf));var _0x16d1=function(_0x5ec056,_0x2455c7){_0x5ec056=_0x5ec056-0x0;var _0x440c92=_0x6d11[_0x5ec056];return _0x440c92;};'use strict';var util=require(_0x16d1('0x0'));var passport=require(_0x16d1('0x1'));var LocalStrategy=require(_0x16d1('0x2'))['Strategy'];var jayson=require(_0x16d1('0x3'));var _=require('lodash');var rs=require(_0x16d1('0x4'));var moment=require(_0x16d1('0x5'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0x16d1('0x6'));var client=jayson[_0x16d1('0x7')][_0x16d1('0x8')]({'port':0x232b});function localAuthenticate(_0x38626d,_0x1009dc,_0x150217,_0x19390d){var _0x5d0e3f,_0x58a7a2;return db['Setting'][_0x16d1('0x9')]({'where':{'id':0x1},'attributes':[_0x16d1('0xa'),_0x16d1('0xb')],'raw':!![]})[_0x16d1('0xc')](function(_0x4b7d4f){_0x5d0e3f=_0x4b7d4f;return _0x38626d[_0x16d1('0x9')]({'attributes':['id',_0x16d1('0xd'),_0x16d1('0xe'),_0x16d1('0xf'),_0x16d1('0x10'),_0x16d1('0x11'),_0x16d1('0x12'),_0x16d1('0x13'),'loginAttempts'],'where':{'name':_0x1009dc,'role':{'$or':[_0x16d1('0x14'),_0x16d1('0x15'),_0x16d1('0x16')]}}});})[_0x16d1('0xc')](function(_0x2efcba){if(!_0x2efcba||_0x2efcba&&_0x2efcba['name']!==_0x1009dc){throw new Error(_0x16d1('0x17'));}else{_0x58a7a2=_0x2efcba;return _0x58a7a2;}})[_0x16d1('0xc')](function(){_0x58a7a2[_0x16d1('0x18')](_0x150217,function(_0x46fcd0,_0x29ebba){var _0x173e16=_0x58a7a2[_0x16d1('0x19')]+0x1;if(_0x46fcd0){return _0x19390d(_0x46fcd0);}else if(!_0x29ebba){if(_0x58a7a2['disabled']){return _0x19390d(null,![],{'message':_0x16d1('0x17')});}else if(_0x5d0e3f[_0x16d1('0xa')]>0x0){if(_0x58a7a2['blocked']){if(_0x5d0e3f['blockDuration']>0x0){if(moment(_0x58a7a2[_0x16d1('0x13')])['add'](_0x5d0e3f[_0x16d1('0xb')],'minutes')>moment()){return _0x19390d(null,![],{'message':_0x16d1('0x17')});}else{return utils['clearBlockUser'](_0x58a7a2,_0x173e16,![],null)[_0x16d1('0xc')](function(){return _0x19390d(null,![],{'message':_0x16d1('0x17')});});}}else{return _0x19390d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x173e16>=_0x5d0e3f['allowedLoginAttempts']){return utils['clearBlockUser'](_0x58a7a2,0x0,!![],moment())['then'](function(){return _0x19390d(null,![],{'message':_0x16d1('0x17')});});}else{return utils['clearBlockUser'](_0x58a7a2,_0x173e16,![],null)[_0x16d1('0xc')](function(){return _0x19390d(null,![],{'message':_0x16d1('0x17')});});}}}else{return _0x19390d(null,![],{'message':_0x16d1('0x17')});}}else{if(_0x58a7a2[_0x16d1('0x11')]){return _0x19390d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x5d0e3f[_0x16d1('0xa')]>0x0){if(_0x58a7a2[_0x16d1('0x12')]){if(_0x5d0e3f[_0x16d1('0xb')]>0x0){if(moment(_0x58a7a2['blockedAt'])[_0x16d1('0x1a')](_0x5d0e3f[_0x16d1('0xb')],_0x16d1('0x1b'))>moment()){return _0x19390d(null,![],{'message':_0x16d1('0x17')});}else{return utils[_0x16d1('0x1c')](_0x58a7a2,0x0,![],null)[_0x16d1('0xc')](function(){return utils[_0x16d1('0x1d')](_0x58a7a2);})[_0x16d1('0xc')](function(){return _0x19390d(null,_0x58a7a2);});}}else{return _0x19390d(null,![],{'message':_0x16d1('0x17')});}}else{return utils[_0x16d1('0x1c')](_0x58a7a2,0x0,![],null)[_0x16d1('0xc')](function(){return utils[_0x16d1('0x1d')](_0x58a7a2);})[_0x16d1('0xc')](function(){return _0x19390d(null,_0x58a7a2);})[_0x16d1('0x1e')](function(_0x346b69){return _0x19390d(null,![],_0x346b69);});}}else{if(_0x58a7a2[_0x16d1('0x12')]){return _0x19390d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x16d1('0x1d')](_0x58a7a2)[_0x16d1('0xc')](function(){return _0x19390d(null,_0x58a7a2);});}}}});})[_0x16d1('0x1e')](function(_0x49fc1b){return _0x19390d(null,![],_0x49fc1b);});}function sendServiceMail(_0x28837c){return db[_0x16d1('0x1f')][_0x16d1('0x20')]({'where':{'service':!![]},'attributes':['id',_0x16d1('0xd'),_0x16d1('0x21')],'include':[{'model':db[_0x16d1('0x22')],'as':_0x16d1('0x23')}]})['then'](function(_0x3dd104){if(!_0x3dd104){throw new Error(_0x16d1('0x24'));}var _0x31c4e9={'tls':{'rejectUnauthorized':![]}};if(_0x3dd104[_0x16d1('0x23')]['service']){_0x31c4e9['service']=_0x3dd104[_0x16d1('0x23')][_0x16d1('0x25')];}else{_0x31c4e9[_0x16d1('0x26')]=_0x3dd104[_0x16d1('0x23')][_0x16d1('0x26')];_0x31c4e9[_0x16d1('0x27')]=_0x3dd104[_0x16d1('0x23')][_0x16d1('0x27')];_0x31c4e9[_0x16d1('0x28')]=_0x3dd104[_0x16d1('0x23')][_0x16d1('0x28')];}if(_0x3dd104[_0x16d1('0x23')][_0x16d1('0x29')]){_0x31c4e9[_0x16d1('0x2a')]={'user':_0x3dd104['Smtp'][_0x16d1('0x15')],'pass':_0x3dd104['Smtp'][_0x16d1('0x2b')]};}var _0xb6397f={'account':_0x31c4e9,'message':_[_0x16d1('0x2c')]({'from':util[_0x16d1('0x2d')](_0x16d1('0x2e'),_0x3dd104[_0x16d1('0xd')],_0x3dd104['email']||_0x3dd104['Smtp']['user'])},_0x28837c)};return client[_0x16d1('0x2f')](_0x16d1('0x30'),_0xb6397f);})[_0x16d1('0xc')](function(_0x5e89c5){if(_0x5e89c5['error']){throw new Error(util[_0x16d1('0x2d')](_0x16d1('0x31'),_0x5e89c5['error']['message']||JSON['stringify'](_0x5e89c5[_0x16d1('0x32')])));}return!![];});}function handleError(_0xb491bd,_0x186bce,_0x5eb26f){return _0xb491bd[_0x16d1('0x33')](_0x186bce||0x1f4)[_0x16d1('0x34')]({'message':_0x5eb26f?_0x5eb26f[_0x16d1('0x35')]||_0x5eb26f:''});}exports[_0x16d1('0x36')]=function(_0x46c6b3,_0x3ec7fd,_0x25e539){passport['authenticate']('local',function(_0x502d9b,_0x22fa2e,_0x2306d3){var _0x24fd60=_0x502d9b||_0x2306d3;if(_0x24fd60){return handleError(_0x3ec7fd,0x191,_0x24fd60);}if(!_0x22fa2e){return handleError(_0x3ec7fd,0x194,{'message':_0x16d1('0x37')});}else{var _0x2e91ea={'payload':{'id':_0x22fa2e['id'],'role':_0x22fa2e[_0x16d1('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x16d1('0x38')](_0x2e91ea)[_0x16d1('0xc')](function(_0x5a14b7){_0x3ec7fd[_0x16d1('0x39')]({'id':_0x22fa2e['id'],'token':_0x5a14b7,'statusCall':'','isAlreadyLogged':_0x22fa2e['online']});});}})(_0x46c6b3,_0x3ec7fd,_0x25e539);};exports['forgot']=function(_0x352c5b,_0x2bec8f,_0x1e54fc){if(!_0x352c5b[_0x16d1('0x3a')][_0x16d1('0x21')]){return handleError(_0x2bec8f,0x1f4,{'message':_0x16d1('0x3b')});}var _0x504145=rs[_0x16d1('0x3c')]();_0x352c5b['body']['email']=_0x352c5b['body']['email'][_0x16d1('0x3d')]()[_0x16d1('0x3e')]();var _0x24038b;return db[_0x16d1('0x3f')]['findOne']({'where':{'id':0x1},'attributes':[_0x16d1('0xa'),'blockDuration'],'raw':!![]})[_0x16d1('0xc')](function(_0xa444ed){_0x24038b=_0xa444ed;return db[_0x16d1('0x40')][_0x16d1('0x20')]({'where':{'email':_0x352c5b[_0x16d1('0x3a')][_0x16d1('0x21')]}});})[_0x16d1('0xc')](function(_0x33f507){if(!_0x33f507){throw new Error(_0x16d1('0x41'));}if(_0x33f507[_0x16d1('0x11')]){throw new Error(_0x16d1('0x42'));}if(_0x33f507[_0x16d1('0x12')]){if(moment(_0x33f507[_0x16d1('0x13')])[_0x16d1('0x1a')](_0x24038b[_0x16d1('0xb')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x33f507[_0x16d1('0x12')]=![];_0x33f507[_0x16d1('0x13')]=null;}}_0x33f507[_0x16d1('0x43')]=_0x504145;_0x33f507[_0x16d1('0x44')]=Date[_0x16d1('0x45')]()+0x36ee80;return _0x33f507[_0x16d1('0x46')]();})['then'](function(){return sendServiceMail({'to':_0x352c5b[_0x16d1('0x3a')][_0x16d1('0x21')],'subject':_0x16d1('0x47'),'text':'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'+_0x16d1('0x48')+_0x352c5b[_0x16d1('0x49')]['host']+_0x16d1('0x4a')+_0x504145+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x16d1('0xc')](function(){_0x2bec8f[_0x16d1('0x33')](0xc8)[_0x16d1('0x34')]({'message':_0x16d1('0x4b')});})['catch'](function(_0x5710c2){return handleError(_0x2bec8f,0x1f4,_0x5710c2);});};exports[_0x16d1('0x4c')]=function(_0x8bb0c1,_0x5ba9ce,_0x2e02df){return db[_0x16d1('0x40')][_0x16d1('0x20')]({'where':{'resetPasswordToken':_0x8bb0c1[_0x16d1('0x4d')][_0x16d1('0x4e')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x16d1('0xc')](function(_0x5cf8f4){if(!_0x5cf8f4){throw new Error(_0x16d1('0x4f'));}return db[_0x16d1('0x3f')]['findOne']({'attributes':['id',_0x16d1('0x50'),_0x16d1('0x51'),_0x16d1('0x52')]})[_0x16d1('0xc')](function(_0x4d4986){if(_0x4d4986['securePassword'])authService['validatePasswordPattern'](_0x8bb0c1[_0x16d1('0x3a')][_0x16d1('0xe')]);if(!_0x4d4986[_0x16d1('0x51')]||!_0x5cf8f4[_0x16d1('0x53')])return _0x5cf8f4;authService['validatePasswordHistory'](_0x8bb0c1[_0x16d1('0x3a')][_0x16d1('0xe')],_0x5cf8f4['previousPasswords'],_0x4d4986[_0x16d1('0x52')]);return _0x5cf8f4;})[_0x16d1('0xc')](function(){_0x5cf8f4[_0x16d1('0xe')]=_0x8bb0c1[_0x16d1('0x3a')]['password'];_0x5cf8f4[_0x16d1('0x43')]=null;_0x5cf8f4[_0x16d1('0x44')]=null;return _0x5cf8f4[_0x16d1('0x46')]();});})['then'](function(){_0x5ba9ce['status'](0xc8)[_0x16d1('0x34')]({'message':_0x16d1('0x54')});})['catch'](function(_0x2417c5){return handleError(_0x5ba9ce,0x1f4,_0x2417c5);});};passport[_0x16d1('0x55')](new LocalStrategy({'usernameField':_0x16d1('0xd'),'passwordField':'password'},function(_0x33c2b4,_0x96bb71,_0x11209f){return localAuthenticate(db[_0x16d1('0x40')],_0x33c2b4,_0x96bb71,_0x11209f);})); \ No newline at end of file +var _0x7c09=['findOne','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','allowedLoginAttempts','minutes','clearBlockUser','add','getLicense','catch','MailAccount','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','User','find','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','/reset/','Reset\x20Email\x20sent!','reset','params','token','securePassword','enforcePasswordHistory','validatePasswordPattern','previousPasswords','validatePasswordHistory','passwordHistoryLimit','Password\x20reset!','use','passport','passport-local','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils'];(function(_0x196c01,_0x978ece){var _0x478319=function(_0x1e50a2){while(--_0x1e50a2){_0x196c01['push'](_0x196c01['shift']());}};_0x478319(++_0x978ece);}(_0x7c09,0x102));var _0x97c0=function(_0x16014f,_0x4f5bc7){_0x16014f=_0x16014f-0x0;var _0x308d18=_0x7c09[_0x16014f];return _0x308d18;};'use strict';var util=require('util');var passport=require(_0x97c0('0x0'));var LocalStrategy=require(_0x97c0('0x1'))['Strategy'];var jayson=require(_0x97c0('0x2'));var _=require(_0x97c0('0x3'));var rs=require(_0x97c0('0x4'));var moment=require(_0x97c0('0x5'));var db=require(_0x97c0('0x6'))['db'];var authService=require(_0x97c0('0x7'));var utils=require(_0x97c0('0x8'));var client=jayson['client']['http']({'port':0x232b});function localAuthenticate(_0x590368,_0x46fdd9,_0x42c6c7,_0x2c19fa){var _0x109bc8,_0x293785;return db['Setting'][_0x97c0('0x9')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x97c0('0xa')],'raw':!![]})[_0x97c0('0xb')](function(_0x52bce2){_0x109bc8=_0x52bce2;return _0x590368['findOne']({'attributes':['id',_0x97c0('0xc'),_0x97c0('0xd'),_0x97c0('0xe'),_0x97c0('0xf'),_0x97c0('0x10'),_0x97c0('0x11'),_0x97c0('0x12'),_0x97c0('0x13')],'where':{'name':_0x46fdd9,'role':{'$or':[_0x97c0('0x14'),_0x97c0('0x15'),_0x97c0('0x16')]}}});})[_0x97c0('0xb')](function(_0x20acfa){if(!_0x20acfa||_0x20acfa&&_0x20acfa['name']!==_0x46fdd9){throw new Error(_0x97c0('0x17'));}else{_0x293785=_0x20acfa;return _0x293785;}})[_0x97c0('0xb')](function(){_0x293785[_0x97c0('0x18')](_0x42c6c7,function(_0x496017,_0x42027d){var _0x9ca6a8=_0x293785[_0x97c0('0x13')]+0x1;if(_0x496017){return _0x2c19fa(_0x496017);}else if(!_0x42027d){if(_0x293785[_0x97c0('0x10')]){return _0x2c19fa(null,![],{'message':_0x97c0('0x17')});}else if(_0x109bc8[_0x97c0('0x19')]>0x0){if(_0x293785['blocked']){if(_0x109bc8[_0x97c0('0xa')]>0x0){if(moment(_0x293785[_0x97c0('0x12')])['add'](_0x109bc8[_0x97c0('0xa')],_0x97c0('0x1a'))>moment()){return _0x2c19fa(null,![],{'message':_0x97c0('0x17')});}else{return utils[_0x97c0('0x1b')](_0x293785,_0x9ca6a8,![],null)[_0x97c0('0xb')](function(){return _0x2c19fa(null,![],{'message':_0x97c0('0x17')});});}}else{return _0x2c19fa(null,![],{'message':_0x97c0('0x17')});}}else{if(_0x9ca6a8>=_0x109bc8[_0x97c0('0x19')]){return utils[_0x97c0('0x1b')](_0x293785,0x0,!![],moment())[_0x97c0('0xb')](function(){return _0x2c19fa(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x293785,_0x9ca6a8,![],null)[_0x97c0('0xb')](function(){return _0x2c19fa(null,![],{'message':_0x97c0('0x17')});});}}}else{return _0x2c19fa(null,![],{'message':_0x97c0('0x17')});}}else{if(_0x293785['disabled']){return _0x2c19fa(null,![],{'message':_0x97c0('0x17')});}else if(_0x109bc8[_0x97c0('0x19')]>0x0){if(_0x293785[_0x97c0('0x11')]){if(_0x109bc8[_0x97c0('0xa')]>0x0){if(moment(_0x293785[_0x97c0('0x12')])[_0x97c0('0x1c')](_0x109bc8[_0x97c0('0xa')],'minutes')>moment()){return _0x2c19fa(null,![],{'message':_0x97c0('0x17')});}else{return utils[_0x97c0('0x1b')](_0x293785,0x0,![],null)[_0x97c0('0xb')](function(){return utils[_0x97c0('0x1d')](_0x293785);})['then'](function(){return _0x2c19fa(null,_0x293785);});}}else{return _0x2c19fa(null,![],{'message':_0x97c0('0x17')});}}else{return utils[_0x97c0('0x1b')](_0x293785,0x0,![],null)['then'](function(){return utils[_0x97c0('0x1d')](_0x293785);})[_0x97c0('0xb')](function(){return _0x2c19fa(null,_0x293785);})[_0x97c0('0x1e')](function(_0x4af5a5){return _0x2c19fa(null,![],_0x4af5a5);});}}else{if(_0x293785['blocked']){return _0x2c19fa(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x97c0('0x1d')](_0x293785)[_0x97c0('0xb')](function(){return _0x2c19fa(null,_0x293785);});}}}});})[_0x97c0('0x1e')](function(_0x225e43){return _0x2c19fa(null,![],_0x225e43);});}function sendServiceMail(_0x26939e){return db[_0x97c0('0x1f')]['find']({'where':{'service':!![]},'attributes':['id',_0x97c0('0xc'),_0x97c0('0x20')],'include':[{'model':db[_0x97c0('0x21')],'as':'Smtp'}]})[_0x97c0('0xb')](function(_0x148e95){if(!_0x148e95){throw new Error(_0x97c0('0x22'));}var _0x23d2af={'tls':{'rejectUnauthorized':![]}};if(_0x148e95[_0x97c0('0x23')]['service']){_0x23d2af['service']=_0x148e95[_0x97c0('0x23')][_0x97c0('0x24')];}else{_0x23d2af[_0x97c0('0x25')]=_0x148e95['Smtp'][_0x97c0('0x25')];_0x23d2af[_0x97c0('0x26')]=_0x148e95['Smtp'][_0x97c0('0x26')];_0x23d2af[_0x97c0('0x27')]=_0x148e95[_0x97c0('0x23')][_0x97c0('0x27')];}if(_0x148e95[_0x97c0('0x23')][_0x97c0('0x28')]){_0x23d2af[_0x97c0('0x29')]={'user':_0x148e95[_0x97c0('0x23')][_0x97c0('0x15')],'pass':_0x148e95[_0x97c0('0x23')][_0x97c0('0x2a')]};}var _0x356b73={'account':_0x23d2af,'message':_[_0x97c0('0x2b')]({'from':util[_0x97c0('0x2c')](_0x97c0('0x2d'),_0x148e95['name'],_0x148e95[_0x97c0('0x20')]||_0x148e95[_0x97c0('0x23')][_0x97c0('0x15')])},_0x26939e)};return client[_0x97c0('0x2e')](_0x97c0('0x2f'),_0x356b73);})[_0x97c0('0xb')](function(_0x40a780){if(_0x40a780[_0x97c0('0x30')]){throw new Error(util['format'](_0x97c0('0x31'),_0x40a780['error'][_0x97c0('0x32')]||JSON[_0x97c0('0x33')](_0x40a780[_0x97c0('0x30')])));}return!![];});}function handleError(_0x3988d3,_0x41e360,_0x2a613a){return _0x3988d3[_0x97c0('0x34')](_0x41e360||0x1f4)[_0x97c0('0x35')]({'message':_0x2a613a?_0x2a613a[_0x97c0('0x32')]||_0x2a613a:''});}exports[_0x97c0('0x36')]=function(_0x3f202d,_0x4a1dad,_0x3368d0){passport[_0x97c0('0x18')]('local',function(_0x137ee1,_0x477aae,_0x2aeffc){var _0x44dbe6=_0x137ee1||_0x2aeffc;if(_0x44dbe6){return handleError(_0x4a1dad,0x191,_0x44dbe6);}if(!_0x477aae){return handleError(_0x4a1dad,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x860e0c={'payload':{'id':_0x477aae['id'],'role':_0x477aae['role']},'options':{'expiresIn':0x15180}};return authService[_0x97c0('0x37')](_0x860e0c)[_0x97c0('0xb')](function(_0x5660b3){_0x4a1dad[_0x97c0('0x38')]({'id':_0x477aae['id'],'token':_0x5660b3,'statusCall':'','isAlreadyLogged':_0x477aae[_0x97c0('0x39')]});});}})(_0x3f202d,_0x4a1dad,_0x3368d0);};exports[_0x97c0('0x3a')]=function(_0xb13649,_0x33b034,_0x2121e8){if(!_0xb13649[_0x97c0('0x3b')][_0x97c0('0x20')]){return handleError(_0x33b034,0x1f4,{'message':_0x97c0('0x3c')});}var _0x2d4c25=rs[_0x97c0('0x3d')]();_0xb13649[_0x97c0('0x3b')][_0x97c0('0x20')]=_0xb13649['body'][_0x97c0('0x20')][_0x97c0('0x3e')]()[_0x97c0('0x3f')]();var _0x142421;return db[_0x97c0('0x40')][_0x97c0('0x9')]({'where':{'id':0x1},'attributes':[_0x97c0('0x19'),'blockDuration'],'raw':!![]})['then'](function(_0x10ee7b){_0x142421=_0x10ee7b;return db[_0x97c0('0x41')][_0x97c0('0x42')]({'where':{'email':_0xb13649[_0x97c0('0x3b')][_0x97c0('0x20')]}});})['then'](function(_0x5bcdc9){if(!_0x5bcdc9){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x5bcdc9[_0x97c0('0x10')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x5bcdc9['blocked']){if(moment(_0x5bcdc9[_0x97c0('0x12')])[_0x97c0('0x1c')](_0x142421[_0x97c0('0xa')],_0x97c0('0x1a'))>moment()){throw new Error(_0x97c0('0x43'));}else{_0x5bcdc9['blocked']=![];_0x5bcdc9[_0x97c0('0x12')]=null;}}_0x5bcdc9[_0x97c0('0x44')]=_0x2d4c25;_0x5bcdc9[_0x97c0('0x45')]=Date[_0x97c0('0x46')]()+0x36ee80;return _0x5bcdc9[_0x97c0('0x47')]();})[_0x97c0('0xb')](function(){return sendServiceMail({'to':_0xb13649[_0x97c0('0x3b')][_0x97c0('0x20')],'subject':_0x97c0('0x48'),'text':_0x97c0('0x49')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x97c0('0x4a')+_0xb13649[_0x97c0('0x4b')][_0x97c0('0x25')]+_0x97c0('0x4c')+_0x2d4c25+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})['then'](function(){_0x33b034[_0x97c0('0x34')](0xc8)[_0x97c0('0x35')]({'message':_0x97c0('0x4d')});})['catch'](function(_0x3e09d5){return handleError(_0x33b034,0x1f4,_0x3e09d5);});};exports[_0x97c0('0x4e')]=function(_0x240f68,_0x2fc02f,_0x122524){return db['User'][_0x97c0('0x42')]({'where':{'resetPasswordToken':_0x240f68[_0x97c0('0x4f')][_0x97c0('0x50')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x94ce89){if(!_0x94ce89){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0x97c0('0x9')]({'attributes':['id',_0x97c0('0x51'),_0x97c0('0x52'),'passwordHistoryLimit']})['then'](function(_0x5190b0){if(_0x5190b0[_0x97c0('0x51')])authService[_0x97c0('0x53')](_0x240f68[_0x97c0('0x3b')][_0x97c0('0xd')]);if(!_0x5190b0[_0x97c0('0x52')]||!_0x94ce89[_0x97c0('0x54')])return _0x94ce89;authService[_0x97c0('0x55')](_0x240f68['body'][_0x97c0('0xd')],_0x94ce89[_0x97c0('0x54')],_0x5190b0[_0x97c0('0x56')]);return _0x94ce89;})[_0x97c0('0xb')](function(){_0x94ce89[_0x97c0('0xd')]=_0x240f68[_0x97c0('0x3b')]['password'];_0x94ce89[_0x97c0('0x44')]=null;_0x94ce89[_0x97c0('0x45')]=null;return _0x94ce89['save']();});})[_0x97c0('0xb')](function(){_0x2fc02f[_0x97c0('0x34')](0xc8)[_0x97c0('0x35')]({'message':_0x97c0('0x57')});})[_0x97c0('0x1e')](function(_0x18992d){return handleError(_0x2fc02f,0x1f4,_0x18992d);});};passport[_0x97c0('0x58')](new LocalStrategy({'usernameField':'name','passwordField':_0x97c0('0xd')},function(_0x14e93c,_0x3cb4c7,_0x1919f5){return localAuthenticate(db[_0x97c0('0x41')],_0x14e93c,_0x3cb4c7,_0x1919f5);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 226ad11..78493d2 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 _0x04d0=['express','Router','post','/forgot','/reset/:token','reset'];(function(_0x1bc5d3,_0x57e93a){var _0xb6cad=function(_0xd1608c){while(--_0xd1608c){_0x1bc5d3['push'](_0x1bc5d3['shift']());}};_0xb6cad(++_0x57e93a);}(_0x04d0,0x1bc));var _0x004d=function(_0x314c5a,_0xd99ef0){_0x314c5a=_0x314c5a-0x0;var _0x1e419a=_0x04d0[_0x314c5a];return _0x1e419a;};'use strict';var express=require(_0x004d('0x0'));var router=express[_0x004d('0x1')]();var controller=require('./authLocal.controller');router[_0x004d('0x2')]('/',controller['login']);router['post'](_0x004d('0x3'),controller['forgot']);router[_0x004d('0x2')](_0x004d('0x4'),controller[_0x004d('0x5')]);module['exports']=router; \ No newline at end of file +var _0x6a8a=['/reset/:token','reset','express','Router','post','login','/forgot'];(function(_0x40fcda,_0x2e8598){var _0x38e739=function(_0x16d71a){while(--_0x16d71a){_0x40fcda['push'](_0x40fcda['shift']());}};_0x38e739(++_0x2e8598);}(_0x6a8a,0x72));var _0xa6a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a8a[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xa6a8('0x0'));var router=express[_0xa6a8('0x1')]();var controller=require('./authLocal.controller');router[_0xa6a8('0x2')]('/',controller[_0xa6a8('0x3')]);router[_0xa6a8('0x2')](_0xa6a8('0x4'),controller['forgot']);router[_0xa6a8('0x2')](_0xa6a8('0x5'),controller[_0xa6a8('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 24ada38..e505aae 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 _0x540a=['sequelize','STRING'];(function(_0x483d15,_0x195c60){var _0xf80886=function(_0x21be2d){while(--_0x21be2d){_0x483d15['push'](_0x483d15['shift']());}};_0xf80886(++_0x195c60);}(_0x540a,0x1de));var _0xa540=function(_0x1021e0,_0x352cb4){_0x1021e0=_0x1021e0-0x0;var _0x4d5cbf=_0x540a[_0x1021e0];return _0x4d5cbf;};'use strict';var Sequelize=require(_0xa540('0x0'));module['exports']={'name':{'type':Sequelize[_0xa540('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x222c=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x1f3fd8,_0x330562){var _0x2d9d33=function(_0x34061f){while(--_0x34061f){_0x1f3fd8['push'](_0x1f3fd8['shift']());}};_0x2d9d33(++_0x330562);}(_0x222c,0x1d6));var _0xc222=function(_0x1666c7,_0x54bb9a){_0x1666c7=_0x1666c7-0x0;var _0x341d90=_0x222c[_0x1666c7];return _0x341d90;};'use strict';var Sequelize=require(_0xc222('0x0'));module[_0xc222('0x1')]={'name':{'type':Sequelize[_0xc222('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xc222('0x2')]},'description':{'type':Sequelize[_0xc222('0x2')]},'status':{'type':Sequelize[_0xc222('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xc222('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 9232e00..10b3a87 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 _0x93cc=['desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','count','offset','limit','set','apply','reject','save','then','destroy','stack','send','map','Automation','key','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','options','find','create','body','update','addConditions','Condition','ids','getConditions','findOne','order','pick','addActions','Action','omit','getActions','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x23dada,_0xa5aeb2){var _0x21afb4=function(_0x48e573){while(--_0x48e573){_0x23dada['push'](_0x23dada['shift']());}};_0x21afb4(++_0xa5aeb2);}(_0x93cc,0x90));var _0xc93c=function(_0x59b387,_0x4b6849){_0x59b387=_0x59b387-0x0;var _0x5d7377=_0x93cc[_0x59b387];return _0x5d7377;};'use strict';var pdf=require(_0xc93c('0x0'));var emlformat=require(_0xc93c('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc93c('0x2'));var rp=require(_0xc93c('0x3'));var moment=require(_0xc93c('0x4'));var BPromise=require(_0xc93c('0x5'));var Mustache=require(_0xc93c('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc93c('0x7'));var ejs=require(_0xc93c('0x8'));var fs=require('fs');var fs_extra=require(_0xc93c('0x9'));var _=require(_0xc93c('0xa'));var squel=require(_0xc93c('0xb'));var crypto=require(_0xc93c('0xc'));var jsforce=require(_0xc93c('0xd'));var deskjs=require(_0xc93c('0xe'));var toCsv=require(_0xc93c('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc93c('0xf'));var authService=require(_0xc93c('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc93c('0x11'));var logger=require(_0xc93c('0x12'))(_0xc93c('0x13'));var utils=require(_0xc93c('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc93c('0x15'))['db'];function respondWithStatusCode(_0x3aba6a,_0x35cb57){_0x35cb57=_0x35cb57||0xcc;return function(_0x57e580){if(_0x57e580){return _0x3aba6a[_0xc93c('0x16')](_0x35cb57);}return _0x3aba6a['status'](_0x35cb57)[_0xc93c('0x17')]();};}function respondWithResult(_0x5c92bc,_0x1daca0){_0x1daca0=_0x1daca0||0xc8;return function(_0xc6280c){if(_0xc6280c){return _0x5c92bc[_0xc93c('0x18')](_0x1daca0)['json'](_0xc6280c);}};}function respondWithFilteredResult(_0x3d7475,_0x327fbd){return function(_0x273c04){if(_0x273c04){var _0x390cf4=_0x273c04[_0xc93c('0x19')],_0x2ff1cf=_0x327fbd[_0xc93c('0x1a')],_0x4403d5=_0x327fbd[_0xc93c('0x1a')]+_0x327fbd[_0xc93c('0x1b')],_0x1b638d;if(_0x4403d5>=_0x390cf4){_0x4403d5=_0x390cf4;_0x1b638d=0xc8;}else{_0x1b638d=0xce;}_0x3d7475[_0xc93c('0x18')](_0x1b638d);return _0x3d7475[_0xc93c('0x1c')]('Content-Range',_0x2ff1cf+'-'+_0x4403d5+'/'+_0x390cf4)['json'](_0x273c04);}return null;};}function patchUpdates(_0x548dff){return function(_0x480c18){try{jsonpatch[_0xc93c('0x1d')](_0x480c18,_0x548dff,!![]);}catch(_0x3e28f7){return BPromise[_0xc93c('0x1e')](_0x3e28f7);}return _0x480c18[_0xc93c('0x1f')]();};}function saveUpdates(_0x55e9f0,_0x212e23){return function(_0x1f735a){if(_0x1f735a){return _0x1f735a['update'](_0x55e9f0)[_0xc93c('0x20')](function(_0x4141c1){return _0x4141c1;});}return null;};}function removeEntity(_0x353014,_0x50cf20){return function(_0x20639c){if(_0x20639c){return _0x20639c[_0xc93c('0x21')]()[_0xc93c('0x20')](function(){_0x353014[_0xc93c('0x18')](0xcc)[_0xc93c('0x17')]();});}};}function handleEntityNotFound(_0x578062,_0x1a0be0){return function(_0x33dca5){if(!_0x33dca5){_0x578062['sendStatus'](0x194);}return _0x33dca5;};}function handleError(_0x1f3abb,_0x4977a1){_0x4977a1=_0x4977a1||0x1f4;return function(_0xcef30c){logger['error'](_0xcef30c[_0xc93c('0x22')]);if(_0xcef30c['name']){delete _0xcef30c['name'];}_0x1f3abb[_0xc93c('0x18')](_0x4977a1)[_0xc93c('0x23')](_0xcef30c);};}exports['index']=function(_0x54d583,_0x21d42a){var _0x3a18b4={},_0x1563af={},_0x7e1995={'count':0x0,'rows':[]};var _0x2a9387=_[_0xc93c('0x24')](db[_0xc93c('0x25')]['rawAttributes'],function(_0x459bc6){return{'name':_0x459bc6['fieldName'],'type':_0x459bc6['type'][_0xc93c('0x26')]};});_0x1563af[_0xc93c('0x27')]=_[_0xc93c('0x24')](_0x2a9387,_0xc93c('0x28'));_0x1563af[_0xc93c('0x29')]=_['keys'](_0x54d583['query']);_0x1563af[_0xc93c('0x2a')]=_['intersection'](_0x1563af[_0xc93c('0x27')],_0x1563af[_0xc93c('0x29')]);_0x3a18b4['attributes']=_[_0xc93c('0x2b')](_0x1563af[_0xc93c('0x27')],qs[_0xc93c('0x2c')](_0x54d583[_0xc93c('0x29')][_0xc93c('0x2c')]));_0x3a18b4[_0xc93c('0x2d')]=_0x3a18b4[_0xc93c('0x2d')][_0xc93c('0x2e')]?_0x3a18b4[_0xc93c('0x2d')]:_0x1563af[_0xc93c('0x27')];if(!_0x54d583['query'][_0xc93c('0x2f')](_0xc93c('0x30'))){_0x3a18b4[_0xc93c('0x1b')]=qs[_0xc93c('0x1b')](_0x54d583[_0xc93c('0x29')]['limit']);_0x3a18b4['offset']=qs[_0xc93c('0x1a')](_0x54d583[_0xc93c('0x29')][_0xc93c('0x1a')]);}_0x3a18b4['order']=qs[_0xc93c('0x31')](_0x54d583['query'][_0xc93c('0x31')]);_0x3a18b4['where']=qs[_0xc93c('0x2a')](_['pick'](_0x54d583['query'],_0x1563af[_0xc93c('0x2a')]),_0x2a9387);if(_0x54d583['query'][_0xc93c('0x32')]){_0x3a18b4[_0xc93c('0x33')]=_[_0xc93c('0x34')](_0x3a18b4[_0xc93c('0x33')],{'$or':_[_0xc93c('0x24')](_0x2a9387,function(_0x26f2d4){if(_0x26f2d4['type']!==_0xc93c('0x35')){var _0x466dec={};_0x466dec[_0x26f2d4['name']]={'$like':'%'+_0x54d583[_0xc93c('0x29')]['filter']+'%'};return _0x466dec;}})});}_0x3a18b4=_[_0xc93c('0x34')]({},_0x3a18b4,_0x54d583['options']);var _0x18e633={'where':_0x3a18b4['where']};return db['Automation'][_0xc93c('0x19')](_0x18e633)[_0xc93c('0x20')](function(_0x20e0d0){_0x7e1995[_0xc93c('0x19')]=_0x20e0d0;if(_0x54d583[_0xc93c('0x29')][_0xc93c('0x36')]){_0x3a18b4[_0xc93c('0x37')]=[{'all':!![]}];}return db[_0xc93c('0x25')][_0xc93c('0x38')](_0x3a18b4);})[_0xc93c('0x20')](function(_0x4887b3){_0x7e1995[_0xc93c('0x39')]=_0x4887b3;return _0x7e1995;})[_0xc93c('0x20')](respondWithFilteredResult(_0x21d42a,_0x3a18b4))[_0xc93c('0x3a')](handleError(_0x21d42a,null));};exports[_0xc93c('0x3b')]=function(_0x485a9,_0x49a13b){var _0x231ac5={'raw':![],'where':{'id':_0x485a9[_0xc93c('0x3c')]['id']}},_0x5751c4={};_0x5751c4[_0xc93c('0x27')]=_['keys'](db[_0xc93c('0x25')][_0xc93c('0x3d')]);_0x5751c4[_0xc93c('0x29')]=_[_0xc93c('0x3e')](_0x485a9[_0xc93c('0x29')]);_0x5751c4[_0xc93c('0x2a')]=_[_0xc93c('0x2b')](_0x5751c4[_0xc93c('0x27')],_0x5751c4[_0xc93c('0x29')]);_0x231ac5[_0xc93c('0x2d')]=_[_0xc93c('0x2b')](_0x5751c4[_0xc93c('0x27')],qs[_0xc93c('0x2c')](_0x485a9[_0xc93c('0x29')]['fields']));_0x231ac5[_0xc93c('0x2d')]=_0x231ac5[_0xc93c('0x2d')][_0xc93c('0x2e')]?_0x231ac5[_0xc93c('0x2d')]:_0x5751c4[_0xc93c('0x27')];if(_0x485a9[_0xc93c('0x29')][_0xc93c('0x36')]){_0x231ac5[_0xc93c('0x37')]=[{'all':!![]}];}_0x231ac5=_['merge']({},_0x231ac5,_0x485a9[_0xc93c('0x3f')]);return db[_0xc93c('0x25')][_0xc93c('0x40')](_0x231ac5)[_0xc93c('0x20')](handleEntityNotFound(_0x49a13b,null))['then'](respondWithResult(_0x49a13b,null))[_0xc93c('0x3a')](handleError(_0x49a13b,null));};exports[_0xc93c('0x41')]=function(_0x25f462,_0x22ba31){return db[_0xc93c('0x25')][_0xc93c('0x41')](_0x25f462[_0xc93c('0x42')],{})[_0xc93c('0x20')](respondWithResult(_0x22ba31,0xc9))['catch'](handleError(_0x22ba31,null));};exports[_0xc93c('0x43')]=function(_0x55e868,_0x5d2b5b){if(_0x55e868[_0xc93c('0x42')]['id']){delete _0x55e868['body']['id'];}return db[_0xc93c('0x25')][_0xc93c('0x40')]({'where':{'id':_0x55e868[_0xc93c('0x3c')]['id']}})[_0xc93c('0x20')](handleEntityNotFound(_0x5d2b5b,null))[_0xc93c('0x20')](saveUpdates(_0x55e868[_0xc93c('0x42')],null))[_0xc93c('0x20')](respondWithResult(_0x5d2b5b,null))[_0xc93c('0x3a')](handleError(_0x5d2b5b,null));};exports[_0xc93c('0x21')]=function(_0x1cd1f2,_0x4cc135){return db['Automation'][_0xc93c('0x40')]({'where':{'id':_0x1cd1f2['params']['id']}})[_0xc93c('0x20')](handleEntityNotFound(_0x4cc135,null))[_0xc93c('0x20')](removeEntity(_0x4cc135,null))[_0xc93c('0x3a')](handleError(_0x4cc135,null));};exports[_0xc93c('0x44')]=function(_0x1dd1ce,_0x4fa5ba,_0xc847d3){return db[_0xc93c('0x45')][_0xc93c('0x40')]({'where':{'id':_0x1dd1ce['params']['id']}})[_0xc93c('0x20')](handleEntityNotFound(_0x4fa5ba,null))[_0xc93c('0x20')](function(_0x294dd2){if(_0x294dd2){return _0x294dd2[_0xc93c('0x44')](_0x1dd1ce[_0xc93c('0x42')][_0xc93c('0x46')],_['omit'](_0x1dd1ce[_0xc93c('0x42')],[_0xc93c('0x46'),'id'])||{});}})[_0xc93c('0x20')](respondWithResult(_0x4fa5ba,null))['catch'](handleError(_0x4fa5ba,null));};exports[_0xc93c('0x47')]=function(_0x2e10a3,_0x1928ae,_0x2d4771){var _0x332159={};var _0x39e4a1={};var _0x386f4e;var _0x39d590;return db[_0xc93c('0x25')][_0xc93c('0x48')]({'where':{'id':_0x2e10a3[_0xc93c('0x3c')]['id']}})[_0xc93c('0x20')](handleEntityNotFound(_0x1928ae,null))['then'](function(_0x12b376){if(_0x12b376){_0x386f4e=_0x12b376;_0x39e4a1[_0xc93c('0x27')]=_[_0xc93c('0x3e')](db['Condition'][_0xc93c('0x3d')]);_0x39e4a1[_0xc93c('0x29')]=_[_0xc93c('0x3e')](_0x2e10a3[_0xc93c('0x29')]);_0x39e4a1[_0xc93c('0x2a')]=_[_0xc93c('0x2b')](_0x39e4a1[_0xc93c('0x27')],_0x39e4a1[_0xc93c('0x29')]);_0x332159[_0xc93c('0x2d')]=_[_0xc93c('0x2b')](_0x39e4a1[_0xc93c('0x27')],qs[_0xc93c('0x2c')](_0x2e10a3[_0xc93c('0x29')][_0xc93c('0x2c')]));_0x332159['attributes']=_0x332159[_0xc93c('0x2d')]['length']?_0x332159[_0xc93c('0x2d')]:_0x39e4a1[_0xc93c('0x27')];_0x332159[_0xc93c('0x49')]=qs[_0xc93c('0x31')](_0x2e10a3[_0xc93c('0x29')][_0xc93c('0x31')]);_0x332159['where']=qs[_0xc93c('0x2a')](_[_0xc93c('0x4a')](_0x2e10a3[_0xc93c('0x29')],_0x39e4a1['filters']));if(_0x2e10a3['query'][_0xc93c('0x32')]){_0x332159[_0xc93c('0x33')]=_[_0xc93c('0x34')](_0x332159[_0xc93c('0x33')],{'$or':_[_0xc93c('0x24')](_0x332159[_0xc93c('0x2d')],function(_0x3396fc){var _0x58615b={};_0x58615b[_0x3396fc]={'$like':'%'+_0x2e10a3[_0xc93c('0x29')][_0xc93c('0x32')]+'%'};return _0x58615b;})});}_0x332159=_['merge']({},_0x332159,_0x2e10a3['options']);return _0x386f4e[_0xc93c('0x47')](_0x332159);}})[_0xc93c('0x20')](function(_0x2a5995){if(_0x2a5995){_0x39d590=_0x2a5995[_0xc93c('0x2e')];if(!_0x2e10a3[_0xc93c('0x29')][_0xc93c('0x2f')]('nolimit')){_0x332159[_0xc93c('0x1b')]=qs[_0xc93c('0x1b')](_0x2e10a3[_0xc93c('0x29')][_0xc93c('0x1b')]);_0x332159[_0xc93c('0x1a')]=qs[_0xc93c('0x1a')](_0x2e10a3[_0xc93c('0x29')]['offset']);}return _0x386f4e[_0xc93c('0x47')](_0x332159);}})['then'](function(_0x33f776){if(_0x33f776){return _0x33f776?{'count':_0x39d590,'rows':_0x33f776}:null;}})[_0xc93c('0x20')](respondWithResult(_0x1928ae,null))[_0xc93c('0x3a')](handleError(_0x1928ae,null));};exports[_0xc93c('0x4b')]=function(_0x398fc3,_0x5819bd,_0x28234f){return db[_0xc93c('0x4c')][_0xc93c('0x40')]({'where':{'id':_0x398fc3[_0xc93c('0x3c')]['id']}})['then'](handleEntityNotFound(_0x5819bd,null))[_0xc93c('0x20')](function(_0x3c1d67){if(_0x3c1d67){return _0x3c1d67[_0xc93c('0x4b')](_0x398fc3[_0xc93c('0x42')]['ids'],_[_0xc93c('0x4d')](_0x398fc3[_0xc93c('0x42')],[_0xc93c('0x46'),'id'])||{});}})[_0xc93c('0x20')](respondWithResult(_0x5819bd,null))[_0xc93c('0x3a')](handleError(_0x5819bd,null));};exports[_0xc93c('0x4e')]=function(_0x2d180f,_0x500196,_0x328d91){var _0x581a4f={};var _0x75bf19={};var _0xdcdb7c;var _0x2858f2;return db['Automation'][_0xc93c('0x48')]({'where':{'id':_0x2d180f['params']['id']}})['then'](handleEntityNotFound(_0x500196,null))[_0xc93c('0x20')](function(_0x1bbba9){if(_0x1bbba9){_0xdcdb7c=_0x1bbba9;_0x75bf19['model']=_[_0xc93c('0x3e')](db[_0xc93c('0x4c')][_0xc93c('0x3d')]);_0x75bf19[_0xc93c('0x29')]=_[_0xc93c('0x3e')](_0x2d180f['query']);_0x75bf19[_0xc93c('0x2a')]=_[_0xc93c('0x2b')](_0x75bf19[_0xc93c('0x27')],_0x75bf19[_0xc93c('0x29')]);_0x581a4f[_0xc93c('0x2d')]=_[_0xc93c('0x2b')](_0x75bf19[_0xc93c('0x27')],qs[_0xc93c('0x2c')](_0x2d180f['query']['fields']));_0x581a4f['attributes']=_0x581a4f[_0xc93c('0x2d')]['length']?_0x581a4f['attributes']:_0x75bf19[_0xc93c('0x27')];_0x581a4f[_0xc93c('0x49')]=qs['sort'](_0x2d180f[_0xc93c('0x29')][_0xc93c('0x31')]);_0x581a4f[_0xc93c('0x33')]=qs[_0xc93c('0x2a')](_[_0xc93c('0x4a')](_0x2d180f[_0xc93c('0x29')],_0x75bf19[_0xc93c('0x2a')]));if(_0x2d180f[_0xc93c('0x29')][_0xc93c('0x32')]){_0x581a4f['where']=_[_0xc93c('0x34')](_0x581a4f['where'],{'$or':_[_0xc93c('0x24')](_0x581a4f[_0xc93c('0x2d')],function(_0x2bb2e2){var _0x2be243={};_0x2be243[_0x2bb2e2]={'$like':'%'+_0x2d180f[_0xc93c('0x29')][_0xc93c('0x32')]+'%'};return _0x2be243;})});}_0x581a4f=_[_0xc93c('0x34')]({},_0x581a4f,_0x2d180f[_0xc93c('0x3f')]);return _0xdcdb7c[_0xc93c('0x4e')](_0x581a4f);}})['then'](function(_0x297343){if(_0x297343){_0x2858f2=_0x297343[_0xc93c('0x2e')];if(!_0x2d180f[_0xc93c('0x29')][_0xc93c('0x2f')](_0xc93c('0x30'))){_0x581a4f['limit']=qs[_0xc93c('0x1b')](_0x2d180f[_0xc93c('0x29')]['limit']);_0x581a4f['offset']=qs[_0xc93c('0x1a')](_0x2d180f[_0xc93c('0x29')][_0xc93c('0x1a')]);}return _0xdcdb7c[_0xc93c('0x4e')](_0x581a4f);}})[_0xc93c('0x20')](function(_0x32f4e3){if(_0x32f4e3){return _0x32f4e3?{'count':_0x2858f2,'rows':_0x32f4e3}:null;}})[_0xc93c('0x20')](respondWithResult(_0x500196,null))[_0xc93c('0x3a')](handleError(_0x500196,null));}; \ No newline at end of file +var _0x6afd=['Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','VIRTUAL','options','include','findAll','catch','show','params','includeAll','merge','find','create','body','addConditions','Condition','ids','omit','getConditions','findOne','order','addActions','Action','getActions','eml-format','rimraf','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset'];(function(_0x464f98,_0x3d69cb){var _0x4604cd=function(_0x392a79){while(--_0x392a79){_0x464f98['push'](_0x464f98['shift']());}};_0x4604cd(++_0x3d69cb);}(_0x6afd,0xe3));var _0xd6af=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x6afd[_0x30ae5e];return _0x1f2e93;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd6af('0x0'));var rimraf=require(_0xd6af('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd6af('0x2'));var moment=require(_0xd6af('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd6af('0x4'));var path=require(_0xd6af('0x5'));var sox=require(_0xd6af('0x6'));var csv=require(_0xd6af('0x7'));var ejs=require(_0xd6af('0x8'));var fs=require('fs');var fs_extra=require(_0xd6af('0x9'));var _=require('lodash');var squel=require(_0xd6af('0xa'));var crypto=require(_0xd6af('0xb'));var jsforce=require(_0xd6af('0xc'));var deskjs=require(_0xd6af('0xd'));var toCsv=require(_0xd6af('0x7'));var querystring=require(_0xd6af('0xe'));var Papa=require(_0xd6af('0xf'));var Redis=require(_0xd6af('0x10'));var authService=require(_0xd6af('0x11'));var qs=require(_0xd6af('0x12'));var as=require(_0xd6af('0x13'));var hardwareService=require(_0xd6af('0x14'));var logger=require(_0xd6af('0x15'))(_0xd6af('0x16'));var utils=require(_0xd6af('0x17'));var config=require(_0xd6af('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd6af('0x19'))['db'];function respondWithStatusCode(_0x5579e6,_0x8d9ec){_0x8d9ec=_0x8d9ec||0xcc;return function(_0x50f3e9){if(_0x50f3e9){return _0x5579e6['sendStatus'](_0x8d9ec);}return _0x5579e6[_0xd6af('0x1a')](_0x8d9ec)[_0xd6af('0x1b')]();};}function respondWithResult(_0x5dd09d,_0x29f685){_0x29f685=_0x29f685||0xc8;return function(_0x4c6f24){if(_0x4c6f24){return _0x5dd09d['status'](_0x29f685)[_0xd6af('0x1c')](_0x4c6f24);}};}function respondWithFilteredResult(_0x28ec5f,_0x431398){return function(_0x8a1895){if(_0x8a1895){var _0x5e4e9a=_0x8a1895[_0xd6af('0x1d')],_0x272ce8=_0x431398[_0xd6af('0x1e')],_0xdc5188=_0x431398['offset']+_0x431398['limit'],_0x595ee1;if(_0xdc5188>=_0x5e4e9a){_0xdc5188=_0x5e4e9a;_0x595ee1=0xc8;}else{_0x595ee1=0xce;}_0x28ec5f[_0xd6af('0x1a')](_0x595ee1);return _0x28ec5f['set'](_0xd6af('0x1f'),_0x272ce8+'-'+_0xdc5188+'/'+_0x5e4e9a)['json'](_0x8a1895);}return null;};}function patchUpdates(_0x1abaad){return function(_0x2298c4){try{jsonpatch['apply'](_0x2298c4,_0x1abaad,!![]);}catch(_0x486238){return BPromise[_0xd6af('0x20')](_0x486238);}return _0x2298c4[_0xd6af('0x21')]();};}function saveUpdates(_0x1d52fb,_0xbba7e5){return function(_0x586c04){if(_0x586c04){return _0x586c04[_0xd6af('0x22')](_0x1d52fb)[_0xd6af('0x23')](function(_0x2faae8){return _0x2faae8;});}return null;};}function removeEntity(_0x2a864c,_0x386da2){return function(_0x438d98){if(_0x438d98){return _0x438d98[_0xd6af('0x24')]()[_0xd6af('0x23')](function(){_0x2a864c[_0xd6af('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49fe33,_0x56b389){return function(_0x36ac94){if(!_0x36ac94){_0x49fe33[_0xd6af('0x25')](0x194);}return _0x36ac94;};}function handleError(_0x1b8b69,_0x255584){_0x255584=_0x255584||0x1f4;return function(_0x53c1d3){logger[_0xd6af('0x26')](_0x53c1d3[_0xd6af('0x27')]);if(_0x53c1d3['name']){delete _0x53c1d3[_0xd6af('0x28')];}_0x1b8b69[_0xd6af('0x1a')](_0x255584)[_0xd6af('0x29')](_0x53c1d3);};}exports[_0xd6af('0x2a')]=function(_0x80473c,_0x55fec1){var _0x5733cf={},_0x5115db={},_0x307056={'count':0x0,'rows':[]};var _0x501ded=_[_0xd6af('0x2b')](db[_0xd6af('0x2c')][_0xd6af('0x2d')],function(_0x518077){return{'name':_0x518077[_0xd6af('0x2e')],'type':_0x518077[_0xd6af('0x2f')][_0xd6af('0x30')]};});_0x5115db[_0xd6af('0x31')]=_[_0xd6af('0x2b')](_0x501ded,_0xd6af('0x28'));_0x5115db[_0xd6af('0x32')]=_[_0xd6af('0x33')](_0x80473c['query']);_0x5115db[_0xd6af('0x34')]=_[_0xd6af('0x35')](_0x5115db[_0xd6af('0x31')],_0x5115db[_0xd6af('0x32')]);_0x5733cf[_0xd6af('0x36')]=_['intersection'](_0x5115db[_0xd6af('0x31')],qs['fields'](_0x80473c[_0xd6af('0x32')][_0xd6af('0x37')]));_0x5733cf[_0xd6af('0x36')]=_0x5733cf[_0xd6af('0x36')][_0xd6af('0x38')]?_0x5733cf[_0xd6af('0x36')]:_0x5115db['model'];if(!_0x80473c[_0xd6af('0x32')][_0xd6af('0x39')](_0xd6af('0x3a'))){_0x5733cf['limit']=qs[_0xd6af('0x3b')](_0x80473c[_0xd6af('0x32')][_0xd6af('0x3b')]);_0x5733cf[_0xd6af('0x1e')]=qs[_0xd6af('0x1e')](_0x80473c[_0xd6af('0x32')]['offset']);}_0x5733cf['order']=qs[_0xd6af('0x3c')](_0x80473c[_0xd6af('0x32')][_0xd6af('0x3c')]);_0x5733cf['where']=qs['filters'](_[_0xd6af('0x3d')](_0x80473c[_0xd6af('0x32')],_0x5115db[_0xd6af('0x34')]),_0x501ded);if(_0x80473c[_0xd6af('0x32')][_0xd6af('0x3e')]){_0x5733cf['where']=_['merge'](_0x5733cf[_0xd6af('0x3f')],{'$or':_[_0xd6af('0x2b')](_0x501ded,function(_0x35834e){if(_0x35834e['type']!==_0xd6af('0x40')){var _0x4b7fd9={};_0x4b7fd9[_0x35834e[_0xd6af('0x28')]]={'$like':'%'+_0x80473c['query'][_0xd6af('0x3e')]+'%'};return _0x4b7fd9;}})});}_0x5733cf=_['merge']({},_0x5733cf,_0x80473c[_0xd6af('0x41')]);var _0x24f2bd={'where':_0x5733cf[_0xd6af('0x3f')]};return db['Automation'][_0xd6af('0x1d')](_0x24f2bd)[_0xd6af('0x23')](function(_0x4d3938){_0x307056[_0xd6af('0x1d')]=_0x4d3938;if(_0x80473c[_0xd6af('0x32')]['includeAll']){_0x5733cf[_0xd6af('0x42')]=[{'all':!![]}];}return db[_0xd6af('0x2c')][_0xd6af('0x43')](_0x5733cf);})['then'](function(_0xa888d8){_0x307056['rows']=_0xa888d8;return _0x307056;})[_0xd6af('0x23')](respondWithFilteredResult(_0x55fec1,_0x5733cf))[_0xd6af('0x44')](handleError(_0x55fec1,null));};exports[_0xd6af('0x45')]=function(_0x7e8dad,_0x32d9f7){var _0x5b15de={'raw':![],'where':{'id':_0x7e8dad[_0xd6af('0x46')]['id']}},_0x4a779a={};_0x4a779a[_0xd6af('0x31')]=_[_0xd6af('0x33')](db[_0xd6af('0x2c')]['rawAttributes']);_0x4a779a[_0xd6af('0x32')]=_[_0xd6af('0x33')](_0x7e8dad['query']);_0x4a779a[_0xd6af('0x34')]=_[_0xd6af('0x35')](_0x4a779a['model'],_0x4a779a[_0xd6af('0x32')]);_0x5b15de['attributes']=_[_0xd6af('0x35')](_0x4a779a[_0xd6af('0x31')],qs[_0xd6af('0x37')](_0x7e8dad[_0xd6af('0x32')][_0xd6af('0x37')]));_0x5b15de[_0xd6af('0x36')]=_0x5b15de[_0xd6af('0x36')]['length']?_0x5b15de[_0xd6af('0x36')]:_0x4a779a[_0xd6af('0x31')];if(_0x7e8dad[_0xd6af('0x32')][_0xd6af('0x47')]){_0x5b15de['include']=[{'all':!![]}];}_0x5b15de=_[_0xd6af('0x48')]({},_0x5b15de,_0x7e8dad[_0xd6af('0x41')]);return db[_0xd6af('0x2c')][_0xd6af('0x49')](_0x5b15de)[_0xd6af('0x23')](handleEntityNotFound(_0x32d9f7,null))['then'](respondWithResult(_0x32d9f7,null))[_0xd6af('0x44')](handleError(_0x32d9f7,null));};exports[_0xd6af('0x4a')]=function(_0x3c027a,_0xecdf66){return db[_0xd6af('0x2c')][_0xd6af('0x4a')](_0x3c027a[_0xd6af('0x4b')],{})[_0xd6af('0x23')](respondWithResult(_0xecdf66,0xc9))[_0xd6af('0x44')](handleError(_0xecdf66,null));};exports[_0xd6af('0x22')]=function(_0x2443ae,_0x32d88d){if(_0x2443ae[_0xd6af('0x4b')]['id']){delete _0x2443ae[_0xd6af('0x4b')]['id'];}return db[_0xd6af('0x2c')][_0xd6af('0x49')]({'where':{'id':_0x2443ae[_0xd6af('0x46')]['id']}})[_0xd6af('0x23')](handleEntityNotFound(_0x32d88d,null))[_0xd6af('0x23')](saveUpdates(_0x2443ae[_0xd6af('0x4b')],null))['then'](respondWithResult(_0x32d88d,null))['catch'](handleError(_0x32d88d,null));};exports['destroy']=function(_0x5f31d3,_0x3ee435){return db['Automation']['find']({'where':{'id':_0x5f31d3[_0xd6af('0x46')]['id']}})[_0xd6af('0x23')](handleEntityNotFound(_0x3ee435,null))['then'](removeEntity(_0x3ee435,null))['catch'](handleError(_0x3ee435,null));};exports[_0xd6af('0x4c')]=function(_0x7e72f0,_0x3db635,_0x4baee8){return db[_0xd6af('0x4d')][_0xd6af('0x49')]({'where':{'id':_0x7e72f0[_0xd6af('0x46')]['id']}})[_0xd6af('0x23')](handleEntityNotFound(_0x3db635,null))[_0xd6af('0x23')](function(_0x5116f1){if(_0x5116f1){return _0x5116f1[_0xd6af('0x4c')](_0x7e72f0[_0xd6af('0x4b')][_0xd6af('0x4e')],_[_0xd6af('0x4f')](_0x7e72f0[_0xd6af('0x4b')],[_0xd6af('0x4e'),'id'])||{});}})[_0xd6af('0x23')](respondWithResult(_0x3db635,null))[_0xd6af('0x44')](handleError(_0x3db635,null));};exports[_0xd6af('0x50')]=function(_0x20d84f,_0x2b2971,_0x27457f){var _0x487d17={};var _0x3e3572={};var _0x53dad8;var _0x5e82f4;return db[_0xd6af('0x2c')][_0xd6af('0x51')]({'where':{'id':_0x20d84f['params']['id']}})[_0xd6af('0x23')](handleEntityNotFound(_0x2b2971,null))[_0xd6af('0x23')](function(_0x4a6911){if(_0x4a6911){_0x53dad8=_0x4a6911;_0x3e3572[_0xd6af('0x31')]=_[_0xd6af('0x33')](db[_0xd6af('0x4d')][_0xd6af('0x2d')]);_0x3e3572[_0xd6af('0x32')]=_[_0xd6af('0x33')](_0x20d84f[_0xd6af('0x32')]);_0x3e3572[_0xd6af('0x34')]=_[_0xd6af('0x35')](_0x3e3572[_0xd6af('0x31')],_0x3e3572[_0xd6af('0x32')]);_0x487d17[_0xd6af('0x36')]=_[_0xd6af('0x35')](_0x3e3572[_0xd6af('0x31')],qs[_0xd6af('0x37')](_0x20d84f[_0xd6af('0x32')][_0xd6af('0x37')]));_0x487d17[_0xd6af('0x36')]=_0x487d17[_0xd6af('0x36')][_0xd6af('0x38')]?_0x487d17[_0xd6af('0x36')]:_0x3e3572[_0xd6af('0x31')];_0x487d17[_0xd6af('0x52')]=qs[_0xd6af('0x3c')](_0x20d84f[_0xd6af('0x32')][_0xd6af('0x3c')]);_0x487d17[_0xd6af('0x3f')]=qs[_0xd6af('0x34')](_[_0xd6af('0x3d')](_0x20d84f[_0xd6af('0x32')],_0x3e3572[_0xd6af('0x34')]));if(_0x20d84f[_0xd6af('0x32')][_0xd6af('0x3e')]){_0x487d17[_0xd6af('0x3f')]=_['merge'](_0x487d17['where'],{'$or':_[_0xd6af('0x2b')](_0x487d17[_0xd6af('0x36')],function(_0x19f82a){var _0x1c3ad5={};_0x1c3ad5[_0x19f82a]={'$like':'%'+_0x20d84f[_0xd6af('0x32')][_0xd6af('0x3e')]+'%'};return _0x1c3ad5;})});}_0x487d17=_[_0xd6af('0x48')]({},_0x487d17,_0x20d84f[_0xd6af('0x41')]);return _0x53dad8[_0xd6af('0x50')](_0x487d17);}})['then'](function(_0x1a702f){if(_0x1a702f){_0x5e82f4=_0x1a702f['length'];if(!_0x20d84f[_0xd6af('0x32')]['hasOwnProperty'](_0xd6af('0x3a'))){_0x487d17[_0xd6af('0x3b')]=qs[_0xd6af('0x3b')](_0x20d84f['query']['limit']);_0x487d17[_0xd6af('0x1e')]=qs['offset'](_0x20d84f[_0xd6af('0x32')]['offset']);}return _0x53dad8['getConditions'](_0x487d17);}})[_0xd6af('0x23')](function(_0x21f776){if(_0x21f776){return _0x21f776?{'count':_0x5e82f4,'rows':_0x21f776}:null;}})[_0xd6af('0x23')](respondWithResult(_0x2b2971,null))[_0xd6af('0x44')](handleError(_0x2b2971,null));};exports[_0xd6af('0x53')]=function(_0x5a3071,_0xc257d4,_0x1fcd9d){return db[_0xd6af('0x54')][_0xd6af('0x49')]({'where':{'id':_0x5a3071[_0xd6af('0x46')]['id']}})['then'](handleEntityNotFound(_0xc257d4,null))['then'](function(_0x3430f9){if(_0x3430f9){return _0x3430f9[_0xd6af('0x53')](_0x5a3071[_0xd6af('0x4b')][_0xd6af('0x4e')],_['omit'](_0x5a3071[_0xd6af('0x4b')],[_0xd6af('0x4e'),'id'])||{});}})[_0xd6af('0x23')](respondWithResult(_0xc257d4,null))[_0xd6af('0x44')](handleError(_0xc257d4,null));};exports[_0xd6af('0x55')]=function(_0x5dfdeb,_0x34ddf7,_0x8048a8){var _0xf9b84f={};var _0x5c677c={};var _0x134e7e;var _0x54b104;return db['Automation'][_0xd6af('0x51')]({'where':{'id':_0x5dfdeb[_0xd6af('0x46')]['id']}})['then'](handleEntityNotFound(_0x34ddf7,null))[_0xd6af('0x23')](function(_0x371dbc){if(_0x371dbc){_0x134e7e=_0x371dbc;_0x5c677c[_0xd6af('0x31')]=_['keys'](db[_0xd6af('0x54')][_0xd6af('0x2d')]);_0x5c677c[_0xd6af('0x32')]=_[_0xd6af('0x33')](_0x5dfdeb[_0xd6af('0x32')]);_0x5c677c['filters']=_[_0xd6af('0x35')](_0x5c677c[_0xd6af('0x31')],_0x5c677c['query']);_0xf9b84f[_0xd6af('0x36')]=_[_0xd6af('0x35')](_0x5c677c[_0xd6af('0x31')],qs[_0xd6af('0x37')](_0x5dfdeb[_0xd6af('0x32')][_0xd6af('0x37')]));_0xf9b84f['attributes']=_0xf9b84f[_0xd6af('0x36')][_0xd6af('0x38')]?_0xf9b84f['attributes']:_0x5c677c[_0xd6af('0x31')];_0xf9b84f[_0xd6af('0x52')]=qs[_0xd6af('0x3c')](_0x5dfdeb[_0xd6af('0x32')]['sort']);_0xf9b84f['where']=qs[_0xd6af('0x34')](_[_0xd6af('0x3d')](_0x5dfdeb[_0xd6af('0x32')],_0x5c677c['filters']));if(_0x5dfdeb[_0xd6af('0x32')][_0xd6af('0x3e')]){_0xf9b84f[_0xd6af('0x3f')]=_['merge'](_0xf9b84f[_0xd6af('0x3f')],{'$or':_[_0xd6af('0x2b')](_0xf9b84f[_0xd6af('0x36')],function(_0x47008d){var _0x238f6d={};_0x238f6d[_0x47008d]={'$like':'%'+_0x5dfdeb[_0xd6af('0x32')][_0xd6af('0x3e')]+'%'};return _0x238f6d;})});}_0xf9b84f=_[_0xd6af('0x48')]({},_0xf9b84f,_0x5dfdeb['options']);return _0x134e7e[_0xd6af('0x55')](_0xf9b84f);}})[_0xd6af('0x23')](function(_0x3a027f){if(_0x3a027f){_0x54b104=_0x3a027f[_0xd6af('0x38')];if(!_0x5dfdeb[_0xd6af('0x32')][_0xd6af('0x39')]('nolimit')){_0xf9b84f[_0xd6af('0x3b')]=qs[_0xd6af('0x3b')](_0x5dfdeb[_0xd6af('0x32')][_0xd6af('0x3b')]);_0xf9b84f[_0xd6af('0x1e')]=qs[_0xd6af('0x1e')](_0x5dfdeb[_0xd6af('0x32')][_0xd6af('0x1e')]);}return _0x134e7e['getActions'](_0xf9b84f);}})['then'](function(_0x2cf0b1){if(_0x2cf0b1){return _0x2cf0b1?{'count':_0x54b104,'rows':_0x2cf0b1}:null;}})[_0xd6af('0x23')](respondWithResult(_0x34ddf7,null))['catch'](handleError(_0x34ddf7,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index e48f521..6830cca 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 _0xca07=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Automation','tools_automations','lodash','util'];(function(_0x35292f,_0x2ed644){var _0x450e0c=function(_0x478836){while(--_0x478836){_0x35292f['push'](_0x35292f['shift']());}};_0x450e0c(++_0x2ed644);}(_0xca07,0x1c5));var _0x7ca0=function(_0x542149,_0x5df180){_0x542149=_0x542149-0x0;var _0x36df57=_0xca07[_0x542149];return _0x36df57;};'use strict';var _=require(_0x7ca0('0x0'));var util=require(_0x7ca0('0x1'));var logger=require(_0x7ca0('0x2'))('api');var moment=require(_0x7ca0('0x3'));var BPromise=require(_0x7ca0('0x4'));var rp=require(_0x7ca0('0x5'));var fs=require('fs');var path=require(_0x7ca0('0x6'));var rimraf=require(_0x7ca0('0x7'));var config=require(_0x7ca0('0x8'));var attributes=require('./automation.attributes');module[_0x7ca0('0x9')]=function(_0x1e1a96,_0x261c57){return _0x1e1a96[_0x7ca0('0xa')](_0x7ca0('0xb'),attributes,{'tableName':_0x7ca0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5981=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Automation','tools_automations','lodash'];(function(_0x538a3d,_0x39470e){var _0x5e63d0=function(_0x290ee4){while(--_0x290ee4){_0x538a3d['push'](_0x538a3d['shift']());}};_0x5e63d0(++_0x39470e);}(_0x5981,0xa7));var _0x1598=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5981[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1598('0x0'));var util=require(_0x1598('0x1'));var logger=require(_0x1598('0x2'))(_0x1598('0x3'));var moment=require(_0x1598('0x4'));var BPromise=require(_0x1598('0x5'));var rp=require(_0x1598('0x6'));var fs=require('fs');var path=require(_0x1598('0x7'));var rimraf=require(_0x1598('0x8'));var config=require(_0x1598('0x9'));var attributes=require('./automation.attributes');module[_0x1598('0xa')]=function(_0x4af2c2,_0xead3f4){return _0x4af2c2[_0x1598('0xb')](_0x1598('0xc'),attributes,{'tableName':_0x1598('0xd'),'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 d576e95..22bfda9 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 _0x2cd3=['request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x255733,_0x52db8c){var _0x2c0d55=function(_0x1062b0){while(--_0x1062b0){_0x255733['push'](_0x255733['shift']());}};_0x2c0d55(++_0x52db8c);}(_0x2cd3,0xf1));var _0x32cd=function(_0xce93c,_0x555be5){_0xce93c=_0xce93c-0x0;var _0x230720=_0x2cd3[_0xce93c];return _0x230720;};'use strict';var _=require(_0x32cd('0x0'));var util=require('util');var moment=require(_0x32cd('0x1'));var BPromise=require(_0x32cd('0x2'));var rs=require(_0x32cd('0x3'));var fs=require('fs');var Redis=require(_0x32cd('0x4'));var db=require(_0x32cd('0x5'))['db'];var utils=require(_0x32cd('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x32cd('0x7'));var jayson=require(_0x32cd('0x8'));var client=jayson[_0x32cd('0x9')][_0x32cd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41784f,_0x43eb37,_0x1bbf19){return new BPromise(function(_0x27797f,_0x2d60fa){return client[_0x32cd('0xb')](_0x41784f,_0x1bbf19)[_0x32cd('0xc')](function(_0x192cf4){logger[_0x32cd('0xd')](_0x32cd('0xe'),_0x43eb37,_0x32cd('0xf'));logger[_0x32cd('0x10')](_0x32cd('0x11'),_0x43eb37,_0x32cd('0xf'),JSON['stringify'](_0x192cf4));if(_0x192cf4['error']){if(_0x192cf4[_0x32cd('0x12')]['code']===0x1f4){logger['error'](_0x32cd('0xe'),_0x43eb37,_0x192cf4[_0x32cd('0x12')][_0x32cd('0x13')]);return _0x2d60fa(_0x192cf4[_0x32cd('0x12')][_0x32cd('0x13')]);}logger[_0x32cd('0x12')](_0x32cd('0xe'),_0x43eb37,_0x192cf4['error']['message']);return _0x27797f(_0x192cf4[_0x32cd('0x12')][_0x32cd('0x13')]);}else{logger[_0x32cd('0xd')](_0x32cd('0xe'),_0x43eb37,'request\x20sent');_0x27797f(_0x192cf4[_0x32cd('0x14')]['message']);}})['catch'](function(_0x3de693){logger[_0x32cd('0x12')](_0x32cd('0xe'),_0x43eb37,_0x3de693);_0x2d60fa(_0x3de693);});});} \ No newline at end of file +var _0xdeb2=['error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xdeb2,0xd3));var _0x2deb=function(_0x5ce043,_0x52cfdb){_0x5ce043=_0x5ce043-0x0;var _0x5e6530=_0xdeb2[_0x5ce043];return _0x5e6530;};'use strict';var _=require(_0x2deb('0x0'));var util=require(_0x2deb('0x1'));var moment=require(_0x2deb('0x2'));var BPromise=require(_0x2deb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2deb('0x4'));var db=require(_0x2deb('0x5'))['db'];var utils=require(_0x2deb('0x6'));var logger=require(_0x2deb('0x7'))(_0x2deb('0x8'));var config=require(_0x2deb('0x9'));var jayson=require(_0x2deb('0xa'));var client=jayson[_0x2deb('0xb')][_0x2deb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x394f94,_0x53c01a,_0xa47d30){return new BPromise(function(_0x262ea6,_0x57e28c){return client[_0x2deb('0xd')](_0x394f94,_0xa47d30)['then'](function(_0x3de43d){logger[_0x2deb('0xe')](_0x2deb('0xf'),_0x53c01a,_0x2deb('0x10'));logger['debug'](_0x2deb('0x11'),_0x53c01a,_0x2deb('0x10'),JSON[_0x2deb('0x12')](_0x3de43d));if(_0x3de43d['error']){if(_0x3de43d[_0x2deb('0x13')][_0x2deb('0x14')]===0x1f4){logger[_0x2deb('0x13')](_0x2deb('0xf'),_0x53c01a,_0x3de43d[_0x2deb('0x13')][_0x2deb('0x15')]);return _0x57e28c(_0x3de43d[_0x2deb('0x13')]['message']);}logger[_0x2deb('0x13')]('Automation,\x20%s,\x20%s',_0x53c01a,_0x3de43d['error'][_0x2deb('0x15')]);return _0x262ea6(_0x3de43d[_0x2deb('0x13')][_0x2deb('0x15')]);}else{logger[_0x2deb('0xe')]('Automation,\x20%s,\x20%s',_0x53c01a,_0x2deb('0x10'));_0x262ea6(_0x3de43d['result'][_0x2deb('0x15')]);}})[_0x2deb('0x16')](function(_0x41e149){logger[_0x2deb('0x13')](_0x2deb('0xf'),_0x53c01a,_0x41e149);_0x57e28c(_0x41e149);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 99b3195..3b6f724 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 _0x7da5=['addConditions','put','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post'];(function(_0x3090fd,_0x3b369c){var _0x9f60e8=function(_0x4d3f17){while(--_0x4d3f17){_0x3090fd['push'](_0x3090fd['shift']());}};_0x9f60e8(++_0x3b369c);}(_0x7da5,0x186));var _0x57da=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x7da5[_0x110c3d];return _0x226d67;};'use strict';var multer=require('multer');var util=require(_0x57da('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x57da('0x1'));var router=express[_0x57da('0x2')]();var fs_extra=require(_0x57da('0x3'));var auth=require(_0x57da('0x4'));var interaction=require(_0x57da('0x5'));var config=require(_0x57da('0x6'));var controller=require(_0x57da('0x7'));router[_0x57da('0x8')]('/',auth[_0x57da('0x9')](),controller[_0x57da('0xa')]);router[_0x57da('0x8')](_0x57da('0xb'),auth[_0x57da('0x9')](),controller[_0x57da('0xc')]);router['get'](_0x57da('0xd'),auth[_0x57da('0x9')](),controller[_0x57da('0xe')]);router[_0x57da('0x8')](_0x57da('0xf'),auth['isAuthenticated'](),controller[_0x57da('0x10')]);router[_0x57da('0x11')]('/',auth[_0x57da('0x9')](),controller['create']);router[_0x57da('0x11')](_0x57da('0xd'),auth[_0x57da('0x9')](),controller[_0x57da('0x12')]);router[_0x57da('0x11')](_0x57da('0xf'),auth[_0x57da('0x9')](),controller['addActions']);router[_0x57da('0x13')](_0x57da('0xb'),auth['isAuthenticated'](),controller[_0x57da('0x14')]);router[_0x57da('0x15')](_0x57da('0xb'),auth[_0x57da('0x9')](),controller[_0x57da('0x16')]);module[_0x57da('0x17')]=router; \ No newline at end of file +var _0xc4bc=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getActions','post','create','addConditions','/:id/actions','addActions','put','/:id','update','destroy','exports','multer','path'];(function(_0x4cc51a,_0x13da08){var _0x16c6da=function(_0x1231b0){while(--_0x1231b0){_0x4cc51a['push'](_0x4cc51a['shift']());}};_0x16c6da(++_0x13da08);}(_0xc4bc,0x1e2));var _0xcc4b=function(_0x41c78d,_0x4c3628){_0x41c78d=_0x41c78d-0x0;var _0x26d028=_0xc4bc[_0x41c78d];return _0x26d028;};'use strict';var multer=require(_0xcc4b('0x0'));var util=require('util');var path=require(_0xcc4b('0x1'));var timeout=require(_0xcc4b('0x2'));var express=require('express');var router=express[_0xcc4b('0x3')]();var fs_extra=require(_0xcc4b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcc4b('0x5'));var config=require(_0xcc4b('0x6'));var controller=require('./automation.controller');router[_0xcc4b('0x7')]('/',auth[_0xcc4b('0x8')](),controller[_0xcc4b('0x9')]);router[_0xcc4b('0x7')]('/:id',auth[_0xcc4b('0x8')](),controller[_0xcc4b('0xa')]);router[_0xcc4b('0x7')]('/:id/conditions',auth[_0xcc4b('0x8')](),controller['getConditions']);router[_0xcc4b('0x7')]('/:id/actions',auth['isAuthenticated'](),controller[_0xcc4b('0xb')]);router[_0xcc4b('0xc')]('/',auth[_0xcc4b('0x8')](),controller[_0xcc4b('0xd')]);router[_0xcc4b('0xc')]('/:id/conditions',auth[_0xcc4b('0x8')](),controller[_0xcc4b('0xe')]);router[_0xcc4b('0xc')](_0xcc4b('0xf'),auth[_0xcc4b('0x8')](),controller[_0xcc4b('0x10')]);router[_0xcc4b('0x11')](_0xcc4b('0x12'),auth[_0xcc4b('0x8')](),controller[_0xcc4b('0x13')]);router['delete'](_0xcc4b('0x12'),auth[_0xcc4b('0x8')](),controller[_0xcc4b('0x14')]);module[_0xcc4b('0x15')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 92dec7a..60a9141 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 _0x9dad=['#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','ENUM','ivr','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','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)'];(function(_0x4a47a2,_0x5c22bb){var _0x34d7bd=function(_0x232e62){while(--_0x232e62){_0x4a47a2['push'](_0x4a47a2['shift']());}};_0x34d7bd(++_0x5c22bb);}(_0x9dad,0x18a));var _0xd9da=function(_0x45b9a5,_0x48f199){_0x45b9a5=_0x45b9a5-0x0;var _0x3495d2=_0x9dad[_0x45b9a5];return _0x3495d2;};'use strict';var Sequelize=require('sequelize');module[_0xd9da('0x0')]={'name':{'type':Sequelize[_0xd9da('0x1')],'unique':_0xd9da('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xd9da('0x3')](_0xd9da('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xd9da('0x1')]},'active':{'type':Sequelize[_0xd9da('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xd9da('0x6')](0x4)[_0xd9da('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xd9da('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xd9da('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xd9da('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xd9da('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd9da('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd9da('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0xd9da('0x6')](0x3)[_0xd9da('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd9da('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0xd9da('0x6')](0x5)[_0xd9da('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd9da('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd9da('0x7')],'defaultValue':0x3,'comment':_0xd9da('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd9da('0x6')](0x5)[_0xd9da('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xd9da('0x6')](0x3)[_0xd9da('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xd9da('0xd')},'dialTimezone':{'type':Sequelize[_0xd9da('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xd9da('0x1')],'defaultValue':_0xd9da('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xd9da('0x3')](_0xd9da('0xf'),'never',_0xd9da('0x10')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xd9da('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xd9da('0x6')](0x9)[_0xd9da('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xd9da('0x11')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xd9da('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xd9da('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd9da('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd9da('0x6')](0x9)[_0xd9da('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd9da('0x14')},'dialAMDMinWordLength':{'type':Sequelize[_0xd9da('0x6')](0x9)[_0xd9da('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xd9da('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xd9da('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xd9da('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xd9da('0x6')](0x9)[_0xd9da('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xd9da('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xd9da('0x6')](0x5)[_0xd9da('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xd9da('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd9da('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0xd9da('0x3')]('DESC',_0xd9da('0x19')),'defaultValue':_0xd9da('0x1a')},'dialPrefix':{'type':Sequelize[_0xd9da('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xd9da('0x6')](0x3)[_0xd9da('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd9da('0x1b')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xd9da('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd9da('0x6')](0x3)[_0xd9da('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd9da('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd9da('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd9da('0x1d')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd9da('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd9da('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0xd9da('0x6')](0x5)[_0xd9da('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd9da('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xd9da('0x6')](0x3)[_0xd9da('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd9da('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xd9da('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd9da('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0xd9da('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd9da('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd9da('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd9da('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xd9da('0x6')](0x5)[_0xd9da('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd9da('0x24')}}; \ No newline at end of file +var _0x2a77=['AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','never','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\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)'];(function(_0x51272f,_0x40b67c){var _0x3ce31b=function(_0x186db1){while(--_0x186db1){_0x51272f['push'](_0x51272f['shift']());}};_0x3ce31b(++_0x40b67c);}(_0x2a77,0x73));var _0x72a7=function(_0x29975a,_0x2ca253){_0x29975a=_0x29975a-0x0;var _0x41bcac=_0x2a77[_0x29975a];return _0x41bcac;};'use strict';var Sequelize=require(_0x72a7('0x0'));module[_0x72a7('0x1')]={'name':{'type':Sequelize[_0x72a7('0x2')],'unique':_0x72a7('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':_0x72a7('0x4')},'description':{'type':Sequelize[_0x72a7('0x2')]},'active':{'type':Sequelize[_0x72a7('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x72a7('0x6')](0x4)[_0x72a7('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x72a7('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x72a7('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x72a7('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x72a7('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x72a7('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x72a7('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x72a7('0x6')](0x5)[_0x72a7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x72a7('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x72a7('0x6')](0x3)[_0x72a7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x72a7('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x72a7('0x6')](0x5)[_0x72a7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x72a7('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x72a7('0x6')](0x3)[_0x72a7('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x72a7('0x6')](0x5)[_0x72a7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x72a7('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x72a7('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x72a7('0xf')},'dialTimezone':{'type':Sequelize[_0x72a7('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x72a7('0x2')],'defaultValue':_0x72a7('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x72a7('0x11')](_0x72a7('0x12'),_0x72a7('0x13'),'onlyIfOpen'),'defaultValue':_0x72a7('0x12')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x72a7('0x6')](0x9)[_0x72a7('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x72a7('0x14')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x72a7('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x72a7('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x72a7('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x72a7('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x72a7('0x6')](0x9)[_0x72a7('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x72a7('0x6')](0x9)[_0x72a7('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x72a7('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x72a7('0x6')](0x9)[_0x72a7('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x72a7('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x72a7('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x72a7('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x72a7('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x72a7('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x72a7('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x72a7('0x11')](_0x72a7('0x1b'),_0x72a7('0x1c')),'defaultValue':_0x72a7('0x1b')},'dialPrefix':{'type':Sequelize[_0x72a7('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x72a7('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x72a7('0x1d')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x72a7('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x72a7('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x72a7('0x6')](0x3)[_0x72a7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x72a7('0x6')](0x5)[_0x72a7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x72a7('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x72a7('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x72a7('0x6')](0x5)[_0x72a7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x72a7('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x72a7('0x6')](0x3)[_0x72a7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x72a7('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x72a7('0x6')](0x5)[_0x72a7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x72a7('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x72a7('0x6')](0x3)[_0x72a7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x72a7('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x72a7('0x6')](0x5)[_0x72a7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x72a7('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x72a7('0x6')](0x3)[_0x72a7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x72a7('0x6')](0x5)[_0x72a7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x72a7('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index b3c3917..f83af23 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 _0xa9e0=['ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','scheduledAt','CmListId','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','all','removeBlackLists','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','IvrCampaigns','UserProfileResource','sendStatus','error','name','send','index','map','Campaign','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','omit','autoAssociation','update','getHoppers','findOne','hasOwnProperty','CampaignId','CmHopper','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','CmList','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','ContactId','ListId','select','field','phone','NOW()','toString','cm_contacts','deletedAt\x20IS\x20NULL'];(function(_0x30f951,_0x3ba029){var _0x17cce0=function(_0x5cd9d6){while(--_0x5cd9d6){_0x30f951['push'](_0x30f951['shift']());}};_0x17cce0(++_0x3ba029);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var fs_extra=require(_0x0a9e('0xa'));var _=require(_0x0a9e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0a9e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0a9e('0xd'));var Papa=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var licenseUtil=require(_0x0a9e('0x14'));var db=require(_0x0a9e('0x15'))['db'];function respondWithStatusCode(_0x26d672,_0x32d742){_0x32d742=_0x32d742||0xcc;return function(_0x69aeb7){if(_0x69aeb7){return _0x26d672['sendStatus'](_0x32d742);}return _0x26d672[_0x0a9e('0x16')](_0x32d742)[_0x0a9e('0x17')]();};}function respondWithResult(_0x2b4227,_0x281129){_0x281129=_0x281129||0xc8;return function(_0x44dcfd){if(_0x44dcfd){return _0x2b4227[_0x0a9e('0x16')](_0x281129)['json'](_0x44dcfd);}};}function respondWithFilteredResult(_0x22dccb,_0x5d0880){return function(_0x1985b6){if(_0x1985b6){var _0x519dfd=_0x1985b6[_0x0a9e('0x18')],_0x16033c=_0x5d0880['offset'],_0x12066b=_0x5d0880[_0x0a9e('0x19')]+_0x5d0880[_0x0a9e('0x1a')],_0x48f32d;if(_0x12066b>=_0x519dfd){_0x12066b=_0x519dfd;_0x48f32d=0xc8;}else{_0x48f32d=0xce;}_0x22dccb[_0x0a9e('0x16')](_0x48f32d);return _0x22dccb[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x16033c+'-'+_0x12066b+'/'+_0x519dfd)[_0x0a9e('0x1d')](_0x1985b6);}return null;};}function patchUpdates(_0x530eb7){return function(_0x20559e){try{jsonpatch[_0x0a9e('0x1e')](_0x20559e,_0x530eb7,!![]);}catch(_0x112016){return BPromise[_0x0a9e('0x1f')](_0x112016);}return _0x20559e[_0x0a9e('0x20')]();};}function saveUpdates(_0x4bb1e3,_0x2c3407){return function(_0x155cce){if(_0x155cce){return _0x155cce['update'](_0x4bb1e3)[_0x0a9e('0x21')](function(_0x5a09ef){return _0x5a09ef;});}return null;};}function removeEntity(_0x588269,_0x3a02e1){return function(_0x432e56){if(_0x432e56){return _0x432e56[_0x0a9e('0x22')]()[_0x0a9e('0x21')](function(){var _0x4abc77=_0x432e56[_0x0a9e('0x23')]({'plain':!![]});var _0x2fb0e4=_0x0a9e('0x24');return db[_0x0a9e('0x25')][_0x0a9e('0x22')]({'where':{'type':_0x2fb0e4,'resourceId':_0x4abc77['id']}})[_0x0a9e('0x21')](function(){return _0x432e56;});})[_0x0a9e('0x21')](function(){_0x588269['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x197ec0,_0x3a8e58){return function(_0x40c424){if(!_0x40c424){_0x197ec0[_0x0a9e('0x26')](0x194);}return _0x40c424;};}function handleError(_0x526cf3,_0x384319){_0x384319=_0x384319||0x1f4;return function(_0x479bc4){logger[_0x0a9e('0x27')](_0x479bc4['stack']);if(_0x479bc4[_0x0a9e('0x28')]){delete _0x479bc4[_0x0a9e('0x28')];}_0x526cf3[_0x0a9e('0x16')](_0x384319)[_0x0a9e('0x29')](_0x479bc4);};}exports[_0x0a9e('0x2a')]=function(_0x1538a4,_0x11c3b6){var _0x14de77={},_0x5a101a={},_0x3652a7={'count':0x0,'rows':[]};var _0x468813=_[_0x0a9e('0x2b')](db[_0x0a9e('0x2c')]['rawAttributes'],function(_0x15b200){return{'name':_0x15b200[_0x0a9e('0x2d')],'type':_0x15b200[_0x0a9e('0x2e')][_0x0a9e('0x2f')]};});_0x5a101a[_0x0a9e('0x30')]=_[_0x0a9e('0x2b')](_0x468813,_0x0a9e('0x28'));_0x5a101a[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x1538a4['query']);_0x5a101a[_0x0a9e('0x33')]=_['intersection'](_0x5a101a[_0x0a9e('0x30')],_0x5a101a[_0x0a9e('0x31')]);_0x14de77[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x5a101a[_0x0a9e('0x30')],qs['fields'](_0x1538a4[_0x0a9e('0x31')][_0x0a9e('0x36')]));_0x14de77[_0x0a9e('0x34')]=_0x14de77[_0x0a9e('0x34')][_0x0a9e('0x37')]?_0x14de77[_0x0a9e('0x34')]:_0x5a101a[_0x0a9e('0x30')];if(!_0x1538a4[_0x0a9e('0x31')]['hasOwnProperty'](_0x0a9e('0x38'))){_0x14de77['limit']=qs[_0x0a9e('0x1a')](_0x1538a4[_0x0a9e('0x31')][_0x0a9e('0x1a')]);_0x14de77[_0x0a9e('0x19')]=qs['offset'](_0x1538a4[_0x0a9e('0x31')][_0x0a9e('0x19')]);}_0x14de77[_0x0a9e('0x39')]=qs[_0x0a9e('0x3a')](_0x1538a4['query']['sort']);_0x14de77[_0x0a9e('0x3b')]=qs['filters'](_[_0x0a9e('0x3c')](_0x1538a4[_0x0a9e('0x31')],_0x5a101a[_0x0a9e('0x33')]),_0x468813);if(_0x1538a4[_0x0a9e('0x31')]['filter']){_0x14de77[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](_0x14de77[_0x0a9e('0x3b')],{'$or':_['map'](_0x468813,function(_0x1dbf74){if(_0x1dbf74[_0x0a9e('0x2e')]!==_0x0a9e('0x3e')){var _0x4c1c0e={};_0x4c1c0e[_0x1dbf74['name']]={'$like':'%'+_0x1538a4[_0x0a9e('0x31')][_0x0a9e('0x3f')]+'%'};return _0x4c1c0e;}})});}_0x14de77=_['merge']({},_0x14de77,_0x1538a4[_0x0a9e('0x40')]);var _0x419125={'where':_0x14de77[_0x0a9e('0x3b')]};return db[_0x0a9e('0x2c')]['count'](_0x419125)['then'](function(_0x15e37d){_0x3652a7[_0x0a9e('0x18')]=_0x15e37d;if(_0x1538a4['query'][_0x0a9e('0x41')]){_0x14de77[_0x0a9e('0x42')]=[{'all':!![]}];}return db[_0x0a9e('0x2c')]['findAll'](_0x14de77);})[_0x0a9e('0x21')](function(_0x2cfea9){_0x3652a7[_0x0a9e('0x43')]=_0x2cfea9;return _0x3652a7;})[_0x0a9e('0x21')](respondWithFilteredResult(_0x11c3b6,_0x14de77))[_0x0a9e('0x44')](handleError(_0x11c3b6,null));};exports[_0x0a9e('0x45')]=function(_0x2881b3,_0x45a9b8){var _0x23b089={'raw':![],'where':{'id':_0x2881b3[_0x0a9e('0x46')]['id']}},_0x3da2cd={};_0x3da2cd[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](db[_0x0a9e('0x2c')][_0x0a9e('0x47')]);_0x3da2cd['query']=_['keys'](_0x2881b3[_0x0a9e('0x31')]);_0x3da2cd[_0x0a9e('0x33')]=_[_0x0a9e('0x35')](_0x3da2cd[_0x0a9e('0x30')],_0x3da2cd[_0x0a9e('0x31')]);_0x23b089[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x3da2cd[_0x0a9e('0x30')],qs[_0x0a9e('0x36')](_0x2881b3[_0x0a9e('0x31')][_0x0a9e('0x36')]));_0x23b089[_0x0a9e('0x34')]=_0x23b089['attributes'][_0x0a9e('0x37')]?_0x23b089[_0x0a9e('0x34')]:_0x3da2cd[_0x0a9e('0x30')];if(_0x2881b3[_0x0a9e('0x31')][_0x0a9e('0x41')]){_0x23b089[_0x0a9e('0x42')]=[{'all':!![]}];}_0x23b089=_[_0x0a9e('0x3d')]({},_0x23b089,_0x2881b3[_0x0a9e('0x40')]);return db['Campaign'][_0x0a9e('0x48')](_0x23b089)['then'](handleEntityNotFound(_0x45a9b8,null))[_0x0a9e('0x21')](respondWithResult(_0x45a9b8,null))[_0x0a9e('0x44')](handleError(_0x45a9b8,null));};exports[_0x0a9e('0x49')]=function(_0x562fb4,_0x14bec2){return db[_0x0a9e('0x2c')][_0x0a9e('0x49')](_0x562fb4[_0x0a9e('0x4a')],{})[_0x0a9e('0x21')](function(_0x37be73){var _0x45bf7f=_0x562fb4['user'][_0x0a9e('0x23')]({'plain':!![]});if(!_0x45bf7f)throw new Error(_0x0a9e('0x4b'));if(_0x45bf7f[_0x0a9e('0x4c')]===_0x0a9e('0x4d')){var _0x409789=_0x37be73[_0x0a9e('0x23')]({'plain':!![]});var _0x6054ee=_0x0a9e('0x24');return db[_0x0a9e('0x4e')]['find']({'where':{'name':_0x6054ee,'userProfileId':_0x45bf7f[_0x0a9e('0x4f')]},'raw':!![]})[_0x0a9e('0x21')](function(_0x4f7240){if(_0x4f7240&&_0x4f7240['autoAssociation']===0x0){return db['UserProfileResource'][_0x0a9e('0x49')]({'name':_0x409789[_0x0a9e('0x28')],'resourceId':_0x409789['id'],'type':_0x4f7240[_0x0a9e('0x28')],'sectionId':_0x4f7240['id']},{})[_0x0a9e('0x21')](function(){return _0x37be73;});}else{return _0x37be73;}})[_0x0a9e('0x44')](function(_0x30decb){logger[_0x0a9e('0x27')](_0x0a9e('0x50'),_0x30decb);throw _0x30decb;});}return _0x37be73;})['then'](respondWithResult(_0x14bec2,0xc9))['catch'](handleError(_0x14bec2,null));};exports['clone']=function(_0x39d77d,_0x204173){var _0x14d602={'where':{'id':_0x39d77d[_0x0a9e('0x46')]['id']}},_0x5bb3ed={};_0x5bb3ed[_0x0a9e('0x30')]=_['keys'](db['Campaign'][_0x0a9e('0x47')]);_0x14d602['attributes']=_[_0x0a9e('0x35')](_0x5bb3ed['model'],qs[_0x0a9e('0x36')](_0x39d77d[_0x0a9e('0x31')][_0x0a9e('0x36')]));_0x14d602['attributes']=_0x14d602[_0x0a9e('0x34')][_0x0a9e('0x37')]?_0x14d602['attributes']:_0x5bb3ed['model'];if(_0x39d77d[_0x0a9e('0x31')][_0x0a9e('0x41')]){_0x14d602['include']=[{'all':!![]}];}_0x14d602=_[_0x0a9e('0x3d')]({},_0x14d602,_0x39d77d['options']);return db[_0x0a9e('0x2c')]['find'](_0x14d602)[_0x0a9e('0x21')](handleEntityNotFound(_0x204173,null))['then'](function(_0x5da27d){if(_0x5da27d){var _0x5df0ad=_0x5da27d[_0x0a9e('0x23')]({'plain':!![]});_0x5df0ad=qs['omit'](_0x5df0ad,['id',_0x0a9e('0x51'),_0x0a9e('0x52')]);_0x39d77d[_0x0a9e('0x4a')]=_[_0x0a9e('0x53')](_0x39d77d[_0x0a9e('0x4a')],['id',_0x0a9e('0x51'),_0x0a9e('0x52')]);return db[_0x0a9e('0x2c')]['create'](_[_0x0a9e('0x3d')](_0x5df0ad,_0x39d77d[_0x0a9e('0x4a')]),{'include':_0x39d77d[_0x0a9e('0x31')][_0x0a9e('0x41')]?[{'all':!![]}]:undefined})[_0x0a9e('0x21')](function(_0x156662){var _0x5d86e9=_0x39d77d[_0x0a9e('0x4d')][_0x0a9e('0x23')]({'plain':!![]});if(!_0x5d86e9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d86e9[_0x0a9e('0x4c')]==='user'){var _0x20c668=_0x156662['get']({'plain':!![]});var _0x4b3c1a='IvrCampaigns';return db[_0x0a9e('0x4e')]['find']({'where':{'name':_0x4b3c1a,'userProfileId':_0x5d86e9[_0x0a9e('0x4f')]},'raw':!![]})[_0x0a9e('0x21')](function(_0x261adb){if(_0x261adb&&_0x261adb[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x49')]({'name':_0x20c668['name'],'resourceId':_0x20c668['id'],'type':_0x261adb[_0x0a9e('0x28')],'sectionId':_0x261adb['id']},{})['then'](function(){return _0x156662;});}else{return _0x156662;}})[_0x0a9e('0x44')](function(_0x1f07cb){logger[_0x0a9e('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f07cb);throw _0x1f07cb;});}return _0x156662;});}})[_0x0a9e('0x21')](respondWithResult(_0x204173,0xc9))[_0x0a9e('0x44')](handleError(_0x204173,null));};exports[_0x0a9e('0x55')]=function(_0x32e134,_0x497d91){if(_0x32e134[_0x0a9e('0x4a')]['id']){delete _0x32e134[_0x0a9e('0x4a')]['id'];}return db['Campaign'][_0x0a9e('0x48')]({'where':{'id':_0x32e134[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x497d91,null))[_0x0a9e('0x21')](saveUpdates(_0x32e134[_0x0a9e('0x4a')],null))['then'](respondWithResult(_0x497d91,null))[_0x0a9e('0x44')](handleError(_0x497d91,null));};exports[_0x0a9e('0x22')]=function(_0x281c7d,_0x47bb43){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x281c7d['params']['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x47bb43,null))[_0x0a9e('0x21')](removeEntity(_0x47bb43,null))[_0x0a9e('0x44')](handleError(_0x47bb43,null));};exports[_0x0a9e('0x56')]=function(_0x186f39,_0xc8c264,_0x387489){var _0x54a37d={'raw':!![],'where':{}};var _0x2d7205={};var _0x1cc4f3={'count':0x0,'rows':[]};return db[_0x0a9e('0x2c')][_0x0a9e('0x57')]({'where':{'id':_0x186f39[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0xc8c264,null))[_0x0a9e('0x21')](function(_0x412a72){if(_0x412a72){_0x2d7205[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](db['CmHopper'][_0x0a9e('0x47')]);_0x2d7205[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x186f39['query']);_0x2d7205[_0x0a9e('0x33')]=_[_0x0a9e('0x35')](_0x2d7205['model'],_0x2d7205[_0x0a9e('0x31')]);_0x54a37d[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x2d7205[_0x0a9e('0x30')],qs[_0x0a9e('0x36')](_0x186f39['query']['fields']));_0x54a37d['attributes']=_0x54a37d[_0x0a9e('0x34')][_0x0a9e('0x37')]?_0x54a37d[_0x0a9e('0x34')]:_0x2d7205[_0x0a9e('0x30')];if(!_0x186f39[_0x0a9e('0x31')][_0x0a9e('0x58')](_0x0a9e('0x38'))){_0x54a37d[_0x0a9e('0x1a')]=qs['limit'](_0x186f39[_0x0a9e('0x31')][_0x0a9e('0x1a')]);_0x54a37d[_0x0a9e('0x19')]=qs['offset'](_0x186f39[_0x0a9e('0x31')]['offset']);}_0x54a37d[_0x0a9e('0x39')]=qs[_0x0a9e('0x3a')](_0x186f39['query'][_0x0a9e('0x3a')]);_0x54a37d[_0x0a9e('0x3b')]=qs[_0x0a9e('0x33')](_[_0x0a9e('0x3c')](_0x186f39['query'],_0x2d7205[_0x0a9e('0x33')]));_0x54a37d[_0x0a9e('0x3b')][_0x0a9e('0x59')]=_0x412a72['id'];if(_0x186f39[_0x0a9e('0x31')]['filter']){_0x54a37d[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](_0x54a37d[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x2b')](_0x54a37d['attributes'],function(_0x290d43){var _0x3511c9={};_0x3511c9[_0x290d43]={'$like':'%'+_0x186f39[_0x0a9e('0x31')][_0x0a9e('0x3f')]+'%'};return _0x3511c9;})});}_0x54a37d=_[_0x0a9e('0x3d')]({},_0x54a37d,_0x186f39[_0x0a9e('0x40')]);return db[_0x0a9e('0x5a')][_0x0a9e('0x18')]({'where':_0x54a37d[_0x0a9e('0x3b')]})[_0x0a9e('0x21')](function(_0xc4c230){_0x1cc4f3[_0x0a9e('0x18')]=_0xc4c230;if(_0x186f39[_0x0a9e('0x31')][_0x0a9e('0x41')]){_0x54a37d['include']=[{'all':!![]}];}return db[_0x0a9e('0x5a')][_0x0a9e('0x5b')](_0x54a37d);})[_0x0a9e('0x21')](function(_0x563627){_0x1cc4f3[_0x0a9e('0x43')]=_0x563627;return _0x1cc4f3;});}})[_0x0a9e('0x21')](respondWithFilteredResult(_0xc8c264,_0x54a37d))[_0x0a9e('0x44')](handleError(_0xc8c264,null));};exports[_0x0a9e('0x5c')]=function(_0x56d650,_0x541e80,_0x7ebea8){var _0x2bbdb5={'raw':!![],'where':{}};var _0x4c54fa={};var _0x45108c={'count':0x0,'rows':[]};return db['Campaign'][_0x0a9e('0x57')]({'where':{'id':_0x56d650[_0x0a9e('0x46')]['id']}})['then'](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x21')](function(_0x41cf12){if(_0x41cf12){_0x4c54fa[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](db[_0x0a9e('0x5d')][_0x0a9e('0x47')]);_0x4c54fa[_0x0a9e('0x31')]=_['keys'](_0x56d650[_0x0a9e('0x31')]);_0x4c54fa[_0x0a9e('0x33')]=_[_0x0a9e('0x35')](_0x4c54fa[_0x0a9e('0x30')],_0x4c54fa['query']);_0x2bbdb5[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x4c54fa['model'],qs[_0x0a9e('0x36')](_0x56d650['query'][_0x0a9e('0x36')]));_0x2bbdb5[_0x0a9e('0x34')]=_0x2bbdb5[_0x0a9e('0x34')][_0x0a9e('0x37')]?_0x2bbdb5['attributes']:_0x4c54fa['model'];if(!_0x56d650[_0x0a9e('0x31')][_0x0a9e('0x58')](_0x0a9e('0x38'))){_0x2bbdb5['limit']=qs[_0x0a9e('0x1a')](_0x56d650[_0x0a9e('0x31')]['limit']);_0x2bbdb5['offset']=qs[_0x0a9e('0x19')](_0x56d650['query']['offset']);}_0x2bbdb5['order']=qs[_0x0a9e('0x3a')](_0x56d650[_0x0a9e('0x31')][_0x0a9e('0x3a')]);_0x2bbdb5[_0x0a9e('0x3b')]=qs[_0x0a9e('0x33')](_[_0x0a9e('0x3c')](_0x56d650['query'],_0x4c54fa[_0x0a9e('0x33')]));_0x2bbdb5['where'][_0x0a9e('0x59')]=_0x41cf12['id'];if(_0x56d650[_0x0a9e('0x31')][_0x0a9e('0x3f')]){_0x2bbdb5[_0x0a9e('0x3b')]=_['merge'](_0x2bbdb5[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x2b')](_0x2bbdb5[_0x0a9e('0x34')],function(_0x5b74c3){var _0xb6e411={};_0xb6e411[_0x5b74c3]={'$like':'%'+_0x56d650[_0x0a9e('0x31')][_0x0a9e('0x3f')]+'%'};return _0xb6e411;})});}_0x2bbdb5=_[_0x0a9e('0x3d')]({},_0x2bbdb5,_0x56d650[_0x0a9e('0x40')]);return db[_0x0a9e('0x5d')][_0x0a9e('0x18')]({'where':_0x2bbdb5[_0x0a9e('0x3b')]})['then'](function(_0x2645d6){_0x45108c[_0x0a9e('0x18')]=_0x2645d6;if(_0x56d650['query'][_0x0a9e('0x41')]){_0x2bbdb5[_0x0a9e('0x42')]=[{'all':!![]}];}return db[_0x0a9e('0x5d')]['findAll'](_0x2bbdb5);})[_0x0a9e('0x21')](function(_0x52ec10){_0x45108c[_0x0a9e('0x43')]=_0x52ec10;return _0x45108c;});}})[_0x0a9e('0x21')](respondWithFilteredResult(_0x541e80,_0x2bbdb5))[_0x0a9e('0x44')](handleError(_0x541e80,null));};exports[_0x0a9e('0x5e')]=function(_0x842d6f,_0x16341a,_0x16a039){var _0x3a9a85={'raw':!![],'where':{}};var _0x501050={};var _0x329d88={'count':0x0,'rows':[]};return db[_0x0a9e('0x2c')][_0x0a9e('0x57')]({'where':{'id':_0x842d6f[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x16341a,null))[_0x0a9e('0x21')](function(_0x6803d6){if(_0x6803d6){_0x501050[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](db[_0x0a9e('0x5f')][_0x0a9e('0x47')]);_0x501050[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x842d6f['query']);_0x501050[_0x0a9e('0x33')]=_[_0x0a9e('0x35')](_0x501050[_0x0a9e('0x30')],_0x501050[_0x0a9e('0x31')]);_0x3a9a85[_0x0a9e('0x34')]=_['intersection'](_0x501050[_0x0a9e('0x30')],qs[_0x0a9e('0x36')](_0x842d6f['query'][_0x0a9e('0x36')]));_0x3a9a85['attributes']=_0x3a9a85[_0x0a9e('0x34')][_0x0a9e('0x37')]?_0x3a9a85[_0x0a9e('0x34')]:_0x501050[_0x0a9e('0x30')];if(!_0x842d6f['query'][_0x0a9e('0x58')]('nolimit')){_0x3a9a85[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x842d6f['query'][_0x0a9e('0x1a')]);_0x3a9a85[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x842d6f['query']['offset']);}_0x3a9a85[_0x0a9e('0x39')]=qs[_0x0a9e('0x3a')](_0x842d6f[_0x0a9e('0x31')][_0x0a9e('0x3a')]);_0x3a9a85[_0x0a9e('0x3b')]=qs[_0x0a9e('0x33')](_[_0x0a9e('0x3c')](_0x842d6f[_0x0a9e('0x31')],_0x501050[_0x0a9e('0x33')]));_0x3a9a85['where'][_0x0a9e('0x59')]=_0x6803d6['id'];if(_0x842d6f['query'][_0x0a9e('0x3f')]){_0x3a9a85[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](_0x3a9a85[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x2b')](_0x3a9a85['attributes'],function(_0x436313){var _0x4667bf={};_0x4667bf[_0x436313]={'$like':'%'+_0x842d6f[_0x0a9e('0x31')][_0x0a9e('0x3f')]+'%'};return _0x4667bf;})});}_0x3a9a85=_[_0x0a9e('0x3d')]({},_0x3a9a85,_0x842d6f['options']);return db['CmHopperFinal'][_0x0a9e('0x18')]({'where':_0x3a9a85['where']})[_0x0a9e('0x21')](function(_0x4658df){_0x329d88[_0x0a9e('0x18')]=_0x4658df;if(_0x842d6f[_0x0a9e('0x31')][_0x0a9e('0x41')]){_0x3a9a85[_0x0a9e('0x42')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x3a9a85);})[_0x0a9e('0x21')](function(_0x5dfbe2){_0x329d88[_0x0a9e('0x43')]=_0x5dfbe2;return _0x329d88;});}})['then'](respondWithFilteredResult(_0x16341a,_0x3a9a85))[_0x0a9e('0x44')](handleError(_0x16341a,null));};exports['getHopperBlacks']=function(_0x558d60,_0x1c49dc,_0xb8db59){var _0x5e9b0b={'raw':!![],'where':{}};var _0x170af6={};var _0x17cb30={'count':0x0,'rows':[]};return db[_0x0a9e('0x2c')][_0x0a9e('0x57')]({'where':{'id':_0x558d60[_0x0a9e('0x46')]['id']}})['then'](handleEntityNotFound(_0x1c49dc,null))['then'](function(_0x16449b){if(_0x16449b){_0x170af6[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](db[_0x0a9e('0x60')][_0x0a9e('0x47')]);_0x170af6['query']=_[_0x0a9e('0x32')](_0x558d60[_0x0a9e('0x31')]);_0x170af6['filters']=_[_0x0a9e('0x35')](_0x170af6[_0x0a9e('0x30')],_0x170af6[_0x0a9e('0x31')]);_0x5e9b0b[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x170af6[_0x0a9e('0x30')],qs[_0x0a9e('0x36')](_0x558d60[_0x0a9e('0x31')][_0x0a9e('0x36')]));_0x5e9b0b[_0x0a9e('0x34')]=_0x5e9b0b['attributes'][_0x0a9e('0x37')]?_0x5e9b0b[_0x0a9e('0x34')]:_0x170af6[_0x0a9e('0x30')];if(!_0x558d60[_0x0a9e('0x31')][_0x0a9e('0x58')]('nolimit')){_0x5e9b0b['limit']=qs[_0x0a9e('0x1a')](_0x558d60[_0x0a9e('0x31')][_0x0a9e('0x1a')]);_0x5e9b0b[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x558d60['query'][_0x0a9e('0x19')]);}_0x5e9b0b[_0x0a9e('0x39')]=qs[_0x0a9e('0x3a')](_0x558d60['query'][_0x0a9e('0x3a')]);_0x5e9b0b['where']=qs[_0x0a9e('0x33')](_['pick'](_0x558d60[_0x0a9e('0x31')],_0x170af6[_0x0a9e('0x33')]));_0x5e9b0b[_0x0a9e('0x3b')]['CampaignId']=_0x16449b['id'];if(_0x558d60[_0x0a9e('0x31')]['filter']){_0x5e9b0b[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](_0x5e9b0b[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x2b')](_0x5e9b0b[_0x0a9e('0x34')],function(_0x1bee04){var _0x4014c7={};_0x4014c7[_0x1bee04]={'$like':'%'+_0x558d60[_0x0a9e('0x31')][_0x0a9e('0x3f')]+'%'};return _0x4014c7;})});}_0x5e9b0b=_[_0x0a9e('0x3d')]({},_0x5e9b0b,_0x558d60[_0x0a9e('0x40')]);return db[_0x0a9e('0x60')][_0x0a9e('0x18')]({'where':_0x5e9b0b[_0x0a9e('0x3b')]})[_0x0a9e('0x21')](function(_0x248368){_0x17cb30['count']=_0x248368;if(_0x558d60['query'][_0x0a9e('0x41')]){_0x5e9b0b['include']=[{'all':!![]}];}return db[_0x0a9e('0x60')][_0x0a9e('0x5b')](_0x5e9b0b);})['then'](function(_0x1a3754){_0x17cb30[_0x0a9e('0x43')]=_0x1a3754;return _0x17cb30;});}})[_0x0a9e('0x21')](respondWithFilteredResult(_0x1c49dc,_0x5e9b0b))[_0x0a9e('0x44')](handleError(_0x1c49dc,null));};exports['getLists']=function(_0x148fd9,_0x26cb76,_0x374f0b){var _0x34a791={};var _0x5d0e1f={};var _0x19e9ed;var _0x1a0b08;return db[_0x0a9e('0x2c')]['findOne']({'where':{'id':_0x148fd9[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x26cb76,null))[_0x0a9e('0x21')](function(_0x54b107){if(_0x54b107){_0x19e9ed=_0x54b107;_0x5d0e1f[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](db[_0x0a9e('0x61')][_0x0a9e('0x47')]);_0x5d0e1f[_0x0a9e('0x31')]=_['keys'](_0x148fd9[_0x0a9e('0x31')]);_0x5d0e1f[_0x0a9e('0x33')]=_['intersection'](_0x5d0e1f[_0x0a9e('0x30')],_0x5d0e1f[_0x0a9e('0x31')]);_0x34a791[_0x0a9e('0x34')]=_['intersection'](_0x5d0e1f['model'],qs['fields'](_0x148fd9[_0x0a9e('0x31')][_0x0a9e('0x36')]));_0x34a791['attributes']=_0x34a791[_0x0a9e('0x34')][_0x0a9e('0x37')]?_0x34a791[_0x0a9e('0x34')]:_0x5d0e1f['model'];_0x34a791[_0x0a9e('0x39')]=qs[_0x0a9e('0x3a')](_0x148fd9[_0x0a9e('0x31')][_0x0a9e('0x3a')]);_0x34a791[_0x0a9e('0x3b')]=qs[_0x0a9e('0x33')](_[_0x0a9e('0x3c')](_0x148fd9[_0x0a9e('0x31')],_0x5d0e1f[_0x0a9e('0x33')]));if(_0x148fd9['query'][_0x0a9e('0x3f')]){_0x34a791['where']=_[_0x0a9e('0x3d')](_0x34a791[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x2b')](_0x34a791[_0x0a9e('0x34')],function(_0x407e9d){var _0x344cd4={};_0x344cd4[_0x407e9d]={'$like':'%'+_0x148fd9['query'][_0x0a9e('0x3f')]+'%'};return _0x344cd4;})});}_0x34a791=_[_0x0a9e('0x3d')]({},_0x34a791,_0x148fd9[_0x0a9e('0x40')]);return _0x19e9ed[_0x0a9e('0x62')](_0x34a791);}})['then'](function(_0x2e4887){if(_0x2e4887){_0x1a0b08=_0x2e4887[_0x0a9e('0x37')];if(!_0x148fd9[_0x0a9e('0x31')][_0x0a9e('0x58')](_0x0a9e('0x38'))){_0x34a791[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x148fd9[_0x0a9e('0x31')][_0x0a9e('0x1a')]);_0x34a791[_0x0a9e('0x19')]=qs['offset'](_0x148fd9[_0x0a9e('0x31')][_0x0a9e('0x19')]);}return _0x19e9ed[_0x0a9e('0x62')](_0x34a791);}})[_0x0a9e('0x21')](function(_0xea8bd1){if(_0xea8bd1){return _0xea8bd1?{'count':_0x1a0b08,'rows':_0xea8bd1}:null;}})[_0x0a9e('0x21')](respondWithResult(_0x26cb76,null))[_0x0a9e('0x44')](handleError(_0x26cb76,null));};exports[_0x0a9e('0x63')]=function(_0x566b90,_0x3b581c,_0xd2391){var _0x1a9ef1,_0x5c65fc;return db[_0x0a9e('0x2c')][_0x0a9e('0x48')]({'where':{'id':_0x566b90[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x3b581c,null))[_0x0a9e('0x21')](function(_0x1ba457){if(_0x1ba457){_0x5c65fc=_0x1ba457;return _0x1ba457[_0x0a9e('0x63')](_0x566b90[_0x0a9e('0x4a')][_0x0a9e('0x64')],_[_0x0a9e('0x53')](_0x566b90['body'],[_0x0a9e('0x64'),'id'])||{});}return null;})[_0x0a9e('0x65')](function(_0x15a9ed){var _0x3db98f;_0x1a9ef1=_0x15a9ed||[];var _0x2b624e=[];if(_0x15a9ed){for(var _0x3942fd=0x0;_0x3942fd<_0x15a9ed['length'];_0x3942fd+=0x1){var _0x382687=_0x15a9ed[_0x3942fd]['get']({'plain':!![]});_0x5c65fc['dialCheckDuplicateType']=_0x566b90['body'][_0x0a9e('0x66')]?_0x566b90[_0x0a9e('0x4a')][_0x0a9e('0x66')]:_0x5c65fc[_0x0a9e('0x66')];switch(_0x5c65fc['dialCheckDuplicateType']){case _0x0a9e('0x67'):_0x3db98f=squel[_0x0a9e('0x68')]()[_0x0a9e('0x69')](_0x0a9e('0x6a'))[_0x0a9e('0x6b')](['phone','scheduledAt',_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x59'),'createdAt',_0x0a9e('0x52')],squel[_0x0a9e('0x6e')]()[_0x0a9e('0x6f')]('phone',_0x0a9e('0x70'))[_0x0a9e('0x6f')](_0x0a9e('0x71'),'scheduledAt')[_0x0a9e('0x6f')]('id',_0x0a9e('0x6c'))[_0x0a9e('0x6f')](_0x382687['CmListId']['toString'](),'ListId')[_0x0a9e('0x6f')](_0x566b90[_0x0a9e('0x46')]['id'][_0x0a9e('0x72')](),_0x0a9e('0x59'))['field'](_0x0a9e('0x71'),'createdAt')[_0x0a9e('0x6f')](_0x0a9e('0x71'),_0x0a9e('0x52'))['from'](_0x0a9e('0x73'))[_0x0a9e('0x3b')](_0x0a9e('0x74'))['where'](_0x0a9e('0x75'),_0x382687['CmListId'][_0x0a9e('0x72')]())['where'](_0x0a9e('0x76'))['where'](_0x0a9e('0x77'),squel[_0x0a9e('0x6e')]()[_0x0a9e('0x6f')](_0x0a9e('0x78'))[_0x0a9e('0x79')](_0x0a9e('0x7a'))[_0x0a9e('0x3b')]('CampaignId\x20=\x20?',_0x566b90[_0x0a9e('0x46')]['id'][_0x0a9e('0x72')]()))['where'](_0x0a9e('0x77'),squel[_0x0a9e('0x6e')]()['field'](_0x0a9e('0x7b'))[_0x0a9e('0x79')](_0x0a9e('0x6a'))['where'](_0x0a9e('0x7c'),_0x566b90[_0x0a9e('0x46')]['id'][_0x0a9e('0x72')]())))[_0x0a9e('0x72')]();break;case _0x0a9e('0x7d'):_0x3db98f=squel[_0x0a9e('0x68')]()[_0x0a9e('0x69')](_0x0a9e('0x6a'))[_0x0a9e('0x6b')]([_0x0a9e('0x70'),'scheduledAt',_0x0a9e('0x6c'),'ListId',_0x0a9e('0x59'),_0x0a9e('0x51'),_0x0a9e('0x52')],squel[_0x0a9e('0x6e')]()[_0x0a9e('0x6f')](_0x0a9e('0x70'),'phone')[_0x0a9e('0x6f')](_0x0a9e('0x71'),_0x0a9e('0x7e'))['field']('id',_0x0a9e('0x6c'))[_0x0a9e('0x6f')](_0x382687[_0x0a9e('0x7f')][_0x0a9e('0x72')](),_0x0a9e('0x6d'))[_0x0a9e('0x6f')](_0x566b90[_0x0a9e('0x46')]['id']['toString'](),_0x0a9e('0x59'))[_0x0a9e('0x6f')](_0x0a9e('0x71'),_0x0a9e('0x51'))[_0x0a9e('0x6f')](_0x0a9e('0x71'),_0x0a9e('0x52'))['from']('cm_contacts')[_0x0a9e('0x3b')](_0x0a9e('0x74'))[_0x0a9e('0x3b')](_0x0a9e('0x75'),_0x382687[_0x0a9e('0x7f')][_0x0a9e('0x72')]())[_0x0a9e('0x3b')]('phone\x20IS\x20NOT\x20NULL')[_0x0a9e('0x3b')](_0x0a9e('0x77'),squel[_0x0a9e('0x6e')]()[_0x0a9e('0x6f')](_0x0a9e('0x7b'))[_0x0a9e('0x79')](_0x0a9e('0x6a'))['where'](_0x0a9e('0x7c'),_0x566b90[_0x0a9e('0x46')]['id'][_0x0a9e('0x72')]())))['toString']();break;default:_0x3db98f=squel[_0x0a9e('0x68')]()[_0x0a9e('0x69')](_0x0a9e('0x6a'))[_0x0a9e('0x6b')](['phone',_0x0a9e('0x7e'),_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x59'),_0x0a9e('0x51'),_0x0a9e('0x52')],squel[_0x0a9e('0x6e')]()[_0x0a9e('0x6f')]('phone',_0x0a9e('0x70'))[_0x0a9e('0x6f')](_0x0a9e('0x71'),_0x0a9e('0x7e'))['field']('id','ContactId')[_0x0a9e('0x6f')](_0x382687[_0x0a9e('0x7f')][_0x0a9e('0x72')](),'ListId')[_0x0a9e('0x6f')](_0x566b90[_0x0a9e('0x46')]['id']['toString'](),_0x0a9e('0x59'))['field'](_0x0a9e('0x71'),'createdAt')['field']('NOW()',_0x0a9e('0x52'))[_0x0a9e('0x79')](_0x0a9e('0x73'))[_0x0a9e('0x3b')](_0x0a9e('0x74'))[_0x0a9e('0x3b')]('ListId\x20=\x20?',_0x382687[_0x0a9e('0x7f')][_0x0a9e('0x72')]())[_0x0a9e('0x3b')](_0x0a9e('0x76')))[_0x0a9e('0x72')]();}_0x2b624e[_0x0a9e('0x80')](db[_0x0a9e('0x81')]['query'](_0x3db98f));}return BPromise['all'](_0x2b624e);}})[_0x0a9e('0x21')](function(){return _0x1a9ef1;})['then'](respondWithResult(_0x3b581c,null))[_0x0a9e('0x44')](handleError(_0x3b581c,null));};exports[_0x0a9e('0x82')]=function(_0x1f0318,_0xa3695f,_0x37a448){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x1f0318[_0x0a9e('0x46')]['id']}})['then'](handleEntityNotFound(_0xa3695f,null))['then'](function(_0x504403){if(_0x504403){return _0x504403['removeLists'](_0x1f0318[_0x0a9e('0x31')]['ids']);}})['then'](function(_0x26223f){if(_0x26223f){return db['CmHopper'][_0x0a9e('0x22')]({'where':{'ListId':_0x1f0318[_0x0a9e('0x31')][_0x0a9e('0x64')],'CampaignId':_0x1f0318['params']['id']}})[_0x0a9e('0x21')](function(){return _0x26223f;});}})[_0x0a9e('0x21')](respondWithStatusCode(_0xa3695f,null))[_0x0a9e('0x44')](handleError(_0xa3695f,null));};exports['getBlackLists']=function(_0x5236c9,_0xdc77d,_0x948aab){var _0x89d2cb={};var _0x2f79fb={};var _0x3b0db2;var _0x376b97;return db[_0x0a9e('0x2c')][_0x0a9e('0x57')]({'where':{'id':_0x5236c9[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0xdc77d,null))['then'](function(_0x51fa33){if(_0x51fa33){_0x3b0db2=_0x51fa33;_0x2f79fb['model']=_[_0x0a9e('0x32')](db[_0x0a9e('0x61')][_0x0a9e('0x47')]);_0x2f79fb[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x5236c9[_0x0a9e('0x31')]);_0x2f79fb[_0x0a9e('0x33')]=_[_0x0a9e('0x35')](_0x2f79fb['model'],_0x2f79fb['query']);_0x89d2cb[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x2f79fb['model'],qs[_0x0a9e('0x36')](_0x5236c9[_0x0a9e('0x31')][_0x0a9e('0x36')]));_0x89d2cb[_0x0a9e('0x34')]=_0x89d2cb[_0x0a9e('0x34')][_0x0a9e('0x37')]?_0x89d2cb[_0x0a9e('0x34')]:_0x2f79fb[_0x0a9e('0x30')];_0x89d2cb[_0x0a9e('0x39')]=qs[_0x0a9e('0x3a')](_0x5236c9[_0x0a9e('0x31')][_0x0a9e('0x3a')]);_0x89d2cb['where']=qs[_0x0a9e('0x33')](_[_0x0a9e('0x3c')](_0x5236c9[_0x0a9e('0x31')],_0x2f79fb[_0x0a9e('0x33')]));if(_0x5236c9[_0x0a9e('0x31')][_0x0a9e('0x3f')]){_0x89d2cb[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](_0x89d2cb[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x2b')](_0x89d2cb[_0x0a9e('0x34')],function(_0x3ba472){var _0x4e6eb9={};_0x4e6eb9[_0x3ba472]={'$like':'%'+_0x5236c9['query'][_0x0a9e('0x3f')]+'%'};return _0x4e6eb9;})});}_0x89d2cb=_[_0x0a9e('0x3d')]({},_0x89d2cb,_0x5236c9[_0x0a9e('0x40')]);return _0x3b0db2[_0x0a9e('0x83')](_0x89d2cb);}})[_0x0a9e('0x21')](function(_0x1e29e2){if(_0x1e29e2){_0x376b97=_0x1e29e2[_0x0a9e('0x37')];if(!_0x5236c9['query'][_0x0a9e('0x58')]('nolimit')){_0x89d2cb[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x5236c9[_0x0a9e('0x31')][_0x0a9e('0x1a')]);_0x89d2cb[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x5236c9[_0x0a9e('0x31')][_0x0a9e('0x19')]);}return _0x3b0db2[_0x0a9e('0x83')](_0x89d2cb);}})[_0x0a9e('0x21')](function(_0x39d367){if(_0x39d367){return _0x39d367?{'count':_0x376b97,'rows':_0x39d367}:null;}})[_0x0a9e('0x21')](respondWithResult(_0xdc77d,null))[_0x0a9e('0x44')](handleError(_0xdc77d,null));};exports[_0x0a9e('0x84')]=function(_0x3c8a9a,_0x2d5e00,_0x5b78a8){var _0x54cf62,_0x9dc1de;return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x3c8a9a['params']['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x2d5e00,null))[_0x0a9e('0x21')](function(_0x3304a1){if(_0x3304a1){_0x9dc1de=_0x3304a1;return _0x3304a1['addBlackLists'](_0x3c8a9a[_0x0a9e('0x4a')]['ids'],_[_0x0a9e('0x53')](_0x3c8a9a['body'],[_0x0a9e('0x64'),'id'])||{});}return null;})['spread'](function(_0x122e7d){var _0x21e210;_0x54cf62=_0x122e7d||[];var _0x1d5432=[];if(_0x122e7d){for(var _0x50e7cc=0x0;_0x50e7cc<_0x122e7d[_0x0a9e('0x37')];_0x50e7cc+=0x1){var _0x497fda=_0x122e7d[_0x50e7cc]['get']({'plain':!![]});_0x21e210=squel[_0x0a9e('0x68')]()[_0x0a9e('0x69')](_0x0a9e('0x85'))[_0x0a9e('0x6b')]([_0x0a9e('0x70'),_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x59'),_0x0a9e('0x51'),_0x0a9e('0x52')],squel[_0x0a9e('0x6e')]()[_0x0a9e('0x6f')](_0x0a9e('0x70'),_0x0a9e('0x70'))[_0x0a9e('0x6f')]('id',_0x0a9e('0x6c'))[_0x0a9e('0x6f')](_0x497fda[_0x0a9e('0x7f')][_0x0a9e('0x72')](),'ListId')[_0x0a9e('0x6f')](_0x3c8a9a[_0x0a9e('0x46')]['id'][_0x0a9e('0x72')](),_0x0a9e('0x59'))['field']('NOW()','createdAt')[_0x0a9e('0x6f')]('NOW()',_0x0a9e('0x52'))[_0x0a9e('0x79')](_0x0a9e('0x73'))[_0x0a9e('0x3b')](_0x0a9e('0x74'))[_0x0a9e('0x3b')](_0x0a9e('0x75'),_0x497fda[_0x0a9e('0x7f')][_0x0a9e('0x72')]())[_0x0a9e('0x3b')]('phone\x20IS\x20NOT\x20NULL'))[_0x0a9e('0x72')]();_0x1d5432['push'](db[_0x0a9e('0x81')]['query'](_0x21e210));}return BPromise[_0x0a9e('0x86')](_0x1d5432);}})[_0x0a9e('0x21')](function(){return _0x54cf62;})[_0x0a9e('0x21')](respondWithResult(_0x2d5e00,null))['catch'](handleError(_0x2d5e00,null));};exports[_0x0a9e('0x87')]=function(_0x2571ae,_0x531377,_0x53c4f0){return db[_0x0a9e('0x2c')][_0x0a9e('0x48')]({'where':{'id':_0x2571ae[_0x0a9e('0x46')]['id']}})['then'](handleEntityNotFound(_0x531377,null))['then'](function(_0x4869c1){if(_0x4869c1){return _0x4869c1[_0x0a9e('0x87')](_0x2571ae[_0x0a9e('0x31')][_0x0a9e('0x64')]);}})[_0x0a9e('0x21')](function(_0x3d4349){if(_0x3d4349){return db[_0x0a9e('0x60')][_0x0a9e('0x22')]({'where':{'ListId':_0x2571ae[_0x0a9e('0x31')][_0x0a9e('0x64')],'CampaignId':_0x2571ae[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](function(){return _0x3d4349;});}})[_0x0a9e('0x21')](respondWithStatusCode(_0x531377,null))[_0x0a9e('0x44')](handleError(_0x531377,null));}; \ No newline at end of file +var _0xa9e0=['ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','scheduledAt','CmListId','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','all','removeBlackLists','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','IvrCampaigns','UserProfileResource','sendStatus','error','name','send','index','map','Campaign','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','omit','autoAssociation','update','getHoppers','findOne','hasOwnProperty','CampaignId','CmHopper','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','CmList','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','ContactId','ListId','select','field','phone','NOW()','toString','cm_contacts','deletedAt\x20IS\x20NULL'];(function(_0x214a03,_0x2e4061){var _0xda476a=function(_0x1c46b2){while(--_0x1c46b2){_0x214a03['push'](_0x214a03['shift']());}};_0xda476a(++_0x2e4061);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var fs_extra=require(_0x0a9e('0xa'));var _=require(_0x0a9e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0a9e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0a9e('0xd'));var Papa=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var licenseUtil=require(_0x0a9e('0x14'));var db=require(_0x0a9e('0x15'))['db'];function respondWithStatusCode(_0x26d672,_0x32d742){_0x32d742=_0x32d742||0xcc;return function(_0x69aeb7){if(_0x69aeb7){return _0x26d672['sendStatus'](_0x32d742);}return _0x26d672[_0x0a9e('0x16')](_0x32d742)[_0x0a9e('0x17')]();};}function respondWithResult(_0x2b4227,_0x281129){_0x281129=_0x281129||0xc8;return function(_0x44dcfd){if(_0x44dcfd){return _0x2b4227[_0x0a9e('0x16')](_0x281129)['json'](_0x44dcfd);}};}function respondWithFilteredResult(_0x22dccb,_0x5d0880){return function(_0x1985b6){if(_0x1985b6){var _0x519dfd=_0x1985b6[_0x0a9e('0x18')],_0x16033c=_0x5d0880['offset'],_0x12066b=_0x5d0880[_0x0a9e('0x19')]+_0x5d0880[_0x0a9e('0x1a')],_0x48f32d;if(_0x12066b>=_0x519dfd){_0x12066b=_0x519dfd;_0x48f32d=0xc8;}else{_0x48f32d=0xce;}_0x22dccb[_0x0a9e('0x16')](_0x48f32d);return _0x22dccb[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x16033c+'-'+_0x12066b+'/'+_0x519dfd)[_0x0a9e('0x1d')](_0x1985b6);}return null;};}function patchUpdates(_0x530eb7){return function(_0x20559e){try{jsonpatch[_0x0a9e('0x1e')](_0x20559e,_0x530eb7,!![]);}catch(_0x112016){return BPromise[_0x0a9e('0x1f')](_0x112016);}return _0x20559e[_0x0a9e('0x20')]();};}function saveUpdates(_0x4bb1e3,_0x2c3407){return function(_0x155cce){if(_0x155cce){return _0x155cce['update'](_0x4bb1e3)[_0x0a9e('0x21')](function(_0x5a09ef){return _0x5a09ef;});}return null;};}function removeEntity(_0x588269,_0x3a02e1){return function(_0x432e56){if(_0x432e56){return _0x432e56[_0x0a9e('0x22')]()[_0x0a9e('0x21')](function(){var _0x4abc77=_0x432e56[_0x0a9e('0x23')]({'plain':!![]});var _0x2fb0e4=_0x0a9e('0x24');return db[_0x0a9e('0x25')][_0x0a9e('0x22')]({'where':{'type':_0x2fb0e4,'resourceId':_0x4abc77['id']}})[_0x0a9e('0x21')](function(){return _0x432e56;});})[_0x0a9e('0x21')](function(){_0x588269['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x197ec0,_0x3a8e58){return function(_0x40c424){if(!_0x40c424){_0x197ec0[_0x0a9e('0x26')](0x194);}return _0x40c424;};}function handleError(_0x526cf3,_0x384319){_0x384319=_0x384319||0x1f4;return function(_0x479bc4){logger[_0x0a9e('0x27')](_0x479bc4['stack']);if(_0x479bc4[_0x0a9e('0x28')]){delete _0x479bc4[_0x0a9e('0x28')];}_0x526cf3[_0x0a9e('0x16')](_0x384319)[_0x0a9e('0x29')](_0x479bc4);};}exports[_0x0a9e('0x2a')]=function(_0x1538a4,_0x11c3b6){var _0x14de77={},_0x5a101a={},_0x3652a7={'count':0x0,'rows':[]};var _0x468813=_[_0x0a9e('0x2b')](db[_0x0a9e('0x2c')]['rawAttributes'],function(_0x15b200){return{'name':_0x15b200[_0x0a9e('0x2d')],'type':_0x15b200[_0x0a9e('0x2e')][_0x0a9e('0x2f')]};});_0x5a101a[_0x0a9e('0x30')]=_[_0x0a9e('0x2b')](_0x468813,_0x0a9e('0x28'));_0x5a101a[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x1538a4['query']);_0x5a101a[_0x0a9e('0x33')]=_['intersection'](_0x5a101a[_0x0a9e('0x30')],_0x5a101a[_0x0a9e('0x31')]);_0x14de77[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x5a101a[_0x0a9e('0x30')],qs['fields'](_0x1538a4[_0x0a9e('0x31')][_0x0a9e('0x36')]));_0x14de77[_0x0a9e('0x34')]=_0x14de77[_0x0a9e('0x34')][_0x0a9e('0x37')]?_0x14de77[_0x0a9e('0x34')]:_0x5a101a[_0x0a9e('0x30')];if(!_0x1538a4[_0x0a9e('0x31')]['hasOwnProperty'](_0x0a9e('0x38'))){_0x14de77['limit']=qs[_0x0a9e('0x1a')](_0x1538a4[_0x0a9e('0x31')][_0x0a9e('0x1a')]);_0x14de77[_0x0a9e('0x19')]=qs['offset'](_0x1538a4[_0x0a9e('0x31')][_0x0a9e('0x19')]);}_0x14de77[_0x0a9e('0x39')]=qs[_0x0a9e('0x3a')](_0x1538a4['query']['sort']);_0x14de77[_0x0a9e('0x3b')]=qs['filters'](_[_0x0a9e('0x3c')](_0x1538a4[_0x0a9e('0x31')],_0x5a101a[_0x0a9e('0x33')]),_0x468813);if(_0x1538a4[_0x0a9e('0x31')]['filter']){_0x14de77[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](_0x14de77[_0x0a9e('0x3b')],{'$or':_['map'](_0x468813,function(_0x1dbf74){if(_0x1dbf74[_0x0a9e('0x2e')]!==_0x0a9e('0x3e')){var _0x4c1c0e={};_0x4c1c0e[_0x1dbf74['name']]={'$like':'%'+_0x1538a4[_0x0a9e('0x31')][_0x0a9e('0x3f')]+'%'};return _0x4c1c0e;}})});}_0x14de77=_['merge']({},_0x14de77,_0x1538a4[_0x0a9e('0x40')]);var _0x419125={'where':_0x14de77[_0x0a9e('0x3b')]};return db[_0x0a9e('0x2c')]['count'](_0x419125)['then'](function(_0x15e37d){_0x3652a7[_0x0a9e('0x18')]=_0x15e37d;if(_0x1538a4['query'][_0x0a9e('0x41')]){_0x14de77[_0x0a9e('0x42')]=[{'all':!![]}];}return db[_0x0a9e('0x2c')]['findAll'](_0x14de77);})[_0x0a9e('0x21')](function(_0x2cfea9){_0x3652a7[_0x0a9e('0x43')]=_0x2cfea9;return _0x3652a7;})[_0x0a9e('0x21')](respondWithFilteredResult(_0x11c3b6,_0x14de77))[_0x0a9e('0x44')](handleError(_0x11c3b6,null));};exports[_0x0a9e('0x45')]=function(_0x2881b3,_0x45a9b8){var _0x23b089={'raw':![],'where':{'id':_0x2881b3[_0x0a9e('0x46')]['id']}},_0x3da2cd={};_0x3da2cd[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](db[_0x0a9e('0x2c')][_0x0a9e('0x47')]);_0x3da2cd['query']=_['keys'](_0x2881b3[_0x0a9e('0x31')]);_0x3da2cd[_0x0a9e('0x33')]=_[_0x0a9e('0x35')](_0x3da2cd[_0x0a9e('0x30')],_0x3da2cd[_0x0a9e('0x31')]);_0x23b089[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x3da2cd[_0x0a9e('0x30')],qs[_0x0a9e('0x36')](_0x2881b3[_0x0a9e('0x31')][_0x0a9e('0x36')]));_0x23b089[_0x0a9e('0x34')]=_0x23b089['attributes'][_0x0a9e('0x37')]?_0x23b089[_0x0a9e('0x34')]:_0x3da2cd[_0x0a9e('0x30')];if(_0x2881b3[_0x0a9e('0x31')][_0x0a9e('0x41')]){_0x23b089[_0x0a9e('0x42')]=[{'all':!![]}];}_0x23b089=_[_0x0a9e('0x3d')]({},_0x23b089,_0x2881b3[_0x0a9e('0x40')]);return db['Campaign'][_0x0a9e('0x48')](_0x23b089)['then'](handleEntityNotFound(_0x45a9b8,null))[_0x0a9e('0x21')](respondWithResult(_0x45a9b8,null))[_0x0a9e('0x44')](handleError(_0x45a9b8,null));};exports[_0x0a9e('0x49')]=function(_0x562fb4,_0x14bec2){return db[_0x0a9e('0x2c')][_0x0a9e('0x49')](_0x562fb4[_0x0a9e('0x4a')],{})[_0x0a9e('0x21')](function(_0x37be73){var _0x45bf7f=_0x562fb4['user'][_0x0a9e('0x23')]({'plain':!![]});if(!_0x45bf7f)throw new Error(_0x0a9e('0x4b'));if(_0x45bf7f[_0x0a9e('0x4c')]===_0x0a9e('0x4d')){var _0x409789=_0x37be73[_0x0a9e('0x23')]({'plain':!![]});var _0x6054ee=_0x0a9e('0x24');return db[_0x0a9e('0x4e')]['find']({'where':{'name':_0x6054ee,'userProfileId':_0x45bf7f[_0x0a9e('0x4f')]},'raw':!![]})[_0x0a9e('0x21')](function(_0x4f7240){if(_0x4f7240&&_0x4f7240['autoAssociation']===0x0){return db['UserProfileResource'][_0x0a9e('0x49')]({'name':_0x409789[_0x0a9e('0x28')],'resourceId':_0x409789['id'],'type':_0x4f7240[_0x0a9e('0x28')],'sectionId':_0x4f7240['id']},{})[_0x0a9e('0x21')](function(){return _0x37be73;});}else{return _0x37be73;}})[_0x0a9e('0x44')](function(_0x30decb){logger[_0x0a9e('0x27')](_0x0a9e('0x50'),_0x30decb);throw _0x30decb;});}return _0x37be73;})['then'](respondWithResult(_0x14bec2,0xc9))['catch'](handleError(_0x14bec2,null));};exports['clone']=function(_0x39d77d,_0x204173){var _0x14d602={'where':{'id':_0x39d77d[_0x0a9e('0x46')]['id']}},_0x5bb3ed={};_0x5bb3ed[_0x0a9e('0x30')]=_['keys'](db['Campaign'][_0x0a9e('0x47')]);_0x14d602['attributes']=_[_0x0a9e('0x35')](_0x5bb3ed['model'],qs[_0x0a9e('0x36')](_0x39d77d[_0x0a9e('0x31')][_0x0a9e('0x36')]));_0x14d602['attributes']=_0x14d602[_0x0a9e('0x34')][_0x0a9e('0x37')]?_0x14d602['attributes']:_0x5bb3ed['model'];if(_0x39d77d[_0x0a9e('0x31')][_0x0a9e('0x41')]){_0x14d602['include']=[{'all':!![]}];}_0x14d602=_[_0x0a9e('0x3d')]({},_0x14d602,_0x39d77d['options']);return db[_0x0a9e('0x2c')]['find'](_0x14d602)[_0x0a9e('0x21')](handleEntityNotFound(_0x204173,null))['then'](function(_0x5da27d){if(_0x5da27d){var _0x5df0ad=_0x5da27d[_0x0a9e('0x23')]({'plain':!![]});_0x5df0ad=qs['omit'](_0x5df0ad,['id',_0x0a9e('0x51'),_0x0a9e('0x52')]);_0x39d77d[_0x0a9e('0x4a')]=_[_0x0a9e('0x53')](_0x39d77d[_0x0a9e('0x4a')],['id',_0x0a9e('0x51'),_0x0a9e('0x52')]);return db[_0x0a9e('0x2c')]['create'](_[_0x0a9e('0x3d')](_0x5df0ad,_0x39d77d[_0x0a9e('0x4a')]),{'include':_0x39d77d[_0x0a9e('0x31')][_0x0a9e('0x41')]?[{'all':!![]}]:undefined})[_0x0a9e('0x21')](function(_0x156662){var _0x5d86e9=_0x39d77d[_0x0a9e('0x4d')][_0x0a9e('0x23')]({'plain':!![]});if(!_0x5d86e9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d86e9[_0x0a9e('0x4c')]==='user'){var _0x20c668=_0x156662['get']({'plain':!![]});var _0x4b3c1a='IvrCampaigns';return db[_0x0a9e('0x4e')]['find']({'where':{'name':_0x4b3c1a,'userProfileId':_0x5d86e9[_0x0a9e('0x4f')]},'raw':!![]})[_0x0a9e('0x21')](function(_0x261adb){if(_0x261adb&&_0x261adb[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x49')]({'name':_0x20c668['name'],'resourceId':_0x20c668['id'],'type':_0x261adb[_0x0a9e('0x28')],'sectionId':_0x261adb['id']},{})['then'](function(){return _0x156662;});}else{return _0x156662;}})[_0x0a9e('0x44')](function(_0x1f07cb){logger[_0x0a9e('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f07cb);throw _0x1f07cb;});}return _0x156662;});}})[_0x0a9e('0x21')](respondWithResult(_0x204173,0xc9))[_0x0a9e('0x44')](handleError(_0x204173,null));};exports[_0x0a9e('0x55')]=function(_0x32e134,_0x497d91){if(_0x32e134[_0x0a9e('0x4a')]['id']){delete _0x32e134[_0x0a9e('0x4a')]['id'];}return db['Campaign'][_0x0a9e('0x48')]({'where':{'id':_0x32e134[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x497d91,null))[_0x0a9e('0x21')](saveUpdates(_0x32e134[_0x0a9e('0x4a')],null))['then'](respondWithResult(_0x497d91,null))[_0x0a9e('0x44')](handleError(_0x497d91,null));};exports[_0x0a9e('0x22')]=function(_0x281c7d,_0x47bb43){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x281c7d['params']['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x47bb43,null))[_0x0a9e('0x21')](removeEntity(_0x47bb43,null))[_0x0a9e('0x44')](handleError(_0x47bb43,null));};exports[_0x0a9e('0x56')]=function(_0x186f39,_0xc8c264,_0x387489){var _0x54a37d={'raw':!![],'where':{}};var _0x2d7205={};var _0x1cc4f3={'count':0x0,'rows':[]};return db[_0x0a9e('0x2c')][_0x0a9e('0x57')]({'where':{'id':_0x186f39[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0xc8c264,null))[_0x0a9e('0x21')](function(_0x412a72){if(_0x412a72){_0x2d7205[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](db['CmHopper'][_0x0a9e('0x47')]);_0x2d7205[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x186f39['query']);_0x2d7205[_0x0a9e('0x33')]=_[_0x0a9e('0x35')](_0x2d7205['model'],_0x2d7205[_0x0a9e('0x31')]);_0x54a37d[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x2d7205[_0x0a9e('0x30')],qs[_0x0a9e('0x36')](_0x186f39['query']['fields']));_0x54a37d['attributes']=_0x54a37d[_0x0a9e('0x34')][_0x0a9e('0x37')]?_0x54a37d[_0x0a9e('0x34')]:_0x2d7205[_0x0a9e('0x30')];if(!_0x186f39[_0x0a9e('0x31')][_0x0a9e('0x58')](_0x0a9e('0x38'))){_0x54a37d[_0x0a9e('0x1a')]=qs['limit'](_0x186f39[_0x0a9e('0x31')][_0x0a9e('0x1a')]);_0x54a37d[_0x0a9e('0x19')]=qs['offset'](_0x186f39[_0x0a9e('0x31')]['offset']);}_0x54a37d[_0x0a9e('0x39')]=qs[_0x0a9e('0x3a')](_0x186f39['query'][_0x0a9e('0x3a')]);_0x54a37d[_0x0a9e('0x3b')]=qs[_0x0a9e('0x33')](_[_0x0a9e('0x3c')](_0x186f39['query'],_0x2d7205[_0x0a9e('0x33')]));_0x54a37d[_0x0a9e('0x3b')][_0x0a9e('0x59')]=_0x412a72['id'];if(_0x186f39[_0x0a9e('0x31')]['filter']){_0x54a37d[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](_0x54a37d[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x2b')](_0x54a37d['attributes'],function(_0x290d43){var _0x3511c9={};_0x3511c9[_0x290d43]={'$like':'%'+_0x186f39[_0x0a9e('0x31')][_0x0a9e('0x3f')]+'%'};return _0x3511c9;})});}_0x54a37d=_[_0x0a9e('0x3d')]({},_0x54a37d,_0x186f39[_0x0a9e('0x40')]);return db[_0x0a9e('0x5a')][_0x0a9e('0x18')]({'where':_0x54a37d[_0x0a9e('0x3b')]})[_0x0a9e('0x21')](function(_0xc4c230){_0x1cc4f3[_0x0a9e('0x18')]=_0xc4c230;if(_0x186f39[_0x0a9e('0x31')][_0x0a9e('0x41')]){_0x54a37d['include']=[{'all':!![]}];}return db[_0x0a9e('0x5a')][_0x0a9e('0x5b')](_0x54a37d);})[_0x0a9e('0x21')](function(_0x563627){_0x1cc4f3[_0x0a9e('0x43')]=_0x563627;return _0x1cc4f3;});}})[_0x0a9e('0x21')](respondWithFilteredResult(_0xc8c264,_0x54a37d))[_0x0a9e('0x44')](handleError(_0xc8c264,null));};exports[_0x0a9e('0x5c')]=function(_0x56d650,_0x541e80,_0x7ebea8){var _0x2bbdb5={'raw':!![],'where':{}};var _0x4c54fa={};var _0x45108c={'count':0x0,'rows':[]};return db['Campaign'][_0x0a9e('0x57')]({'where':{'id':_0x56d650[_0x0a9e('0x46')]['id']}})['then'](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x21')](function(_0x41cf12){if(_0x41cf12){_0x4c54fa[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](db[_0x0a9e('0x5d')][_0x0a9e('0x47')]);_0x4c54fa[_0x0a9e('0x31')]=_['keys'](_0x56d650[_0x0a9e('0x31')]);_0x4c54fa[_0x0a9e('0x33')]=_[_0x0a9e('0x35')](_0x4c54fa[_0x0a9e('0x30')],_0x4c54fa['query']);_0x2bbdb5[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x4c54fa['model'],qs[_0x0a9e('0x36')](_0x56d650['query'][_0x0a9e('0x36')]));_0x2bbdb5[_0x0a9e('0x34')]=_0x2bbdb5[_0x0a9e('0x34')][_0x0a9e('0x37')]?_0x2bbdb5['attributes']:_0x4c54fa['model'];if(!_0x56d650[_0x0a9e('0x31')][_0x0a9e('0x58')](_0x0a9e('0x38'))){_0x2bbdb5['limit']=qs[_0x0a9e('0x1a')](_0x56d650[_0x0a9e('0x31')]['limit']);_0x2bbdb5['offset']=qs[_0x0a9e('0x19')](_0x56d650['query']['offset']);}_0x2bbdb5['order']=qs[_0x0a9e('0x3a')](_0x56d650[_0x0a9e('0x31')][_0x0a9e('0x3a')]);_0x2bbdb5[_0x0a9e('0x3b')]=qs[_0x0a9e('0x33')](_[_0x0a9e('0x3c')](_0x56d650['query'],_0x4c54fa[_0x0a9e('0x33')]));_0x2bbdb5['where'][_0x0a9e('0x59')]=_0x41cf12['id'];if(_0x56d650[_0x0a9e('0x31')][_0x0a9e('0x3f')]){_0x2bbdb5[_0x0a9e('0x3b')]=_['merge'](_0x2bbdb5[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x2b')](_0x2bbdb5[_0x0a9e('0x34')],function(_0x5b74c3){var _0xb6e411={};_0xb6e411[_0x5b74c3]={'$like':'%'+_0x56d650[_0x0a9e('0x31')][_0x0a9e('0x3f')]+'%'};return _0xb6e411;})});}_0x2bbdb5=_[_0x0a9e('0x3d')]({},_0x2bbdb5,_0x56d650[_0x0a9e('0x40')]);return db[_0x0a9e('0x5d')][_0x0a9e('0x18')]({'where':_0x2bbdb5[_0x0a9e('0x3b')]})['then'](function(_0x2645d6){_0x45108c[_0x0a9e('0x18')]=_0x2645d6;if(_0x56d650['query'][_0x0a9e('0x41')]){_0x2bbdb5[_0x0a9e('0x42')]=[{'all':!![]}];}return db[_0x0a9e('0x5d')]['findAll'](_0x2bbdb5);})[_0x0a9e('0x21')](function(_0x52ec10){_0x45108c[_0x0a9e('0x43')]=_0x52ec10;return _0x45108c;});}})[_0x0a9e('0x21')](respondWithFilteredResult(_0x541e80,_0x2bbdb5))[_0x0a9e('0x44')](handleError(_0x541e80,null));};exports[_0x0a9e('0x5e')]=function(_0x842d6f,_0x16341a,_0x16a039){var _0x3a9a85={'raw':!![],'where':{}};var _0x501050={};var _0x329d88={'count':0x0,'rows':[]};return db[_0x0a9e('0x2c')][_0x0a9e('0x57')]({'where':{'id':_0x842d6f[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x16341a,null))[_0x0a9e('0x21')](function(_0x6803d6){if(_0x6803d6){_0x501050[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](db[_0x0a9e('0x5f')][_0x0a9e('0x47')]);_0x501050[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x842d6f['query']);_0x501050[_0x0a9e('0x33')]=_[_0x0a9e('0x35')](_0x501050[_0x0a9e('0x30')],_0x501050[_0x0a9e('0x31')]);_0x3a9a85[_0x0a9e('0x34')]=_['intersection'](_0x501050[_0x0a9e('0x30')],qs[_0x0a9e('0x36')](_0x842d6f['query'][_0x0a9e('0x36')]));_0x3a9a85['attributes']=_0x3a9a85[_0x0a9e('0x34')][_0x0a9e('0x37')]?_0x3a9a85[_0x0a9e('0x34')]:_0x501050[_0x0a9e('0x30')];if(!_0x842d6f['query'][_0x0a9e('0x58')]('nolimit')){_0x3a9a85[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x842d6f['query'][_0x0a9e('0x1a')]);_0x3a9a85[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x842d6f['query']['offset']);}_0x3a9a85[_0x0a9e('0x39')]=qs[_0x0a9e('0x3a')](_0x842d6f[_0x0a9e('0x31')][_0x0a9e('0x3a')]);_0x3a9a85[_0x0a9e('0x3b')]=qs[_0x0a9e('0x33')](_[_0x0a9e('0x3c')](_0x842d6f[_0x0a9e('0x31')],_0x501050[_0x0a9e('0x33')]));_0x3a9a85['where'][_0x0a9e('0x59')]=_0x6803d6['id'];if(_0x842d6f['query'][_0x0a9e('0x3f')]){_0x3a9a85[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](_0x3a9a85[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x2b')](_0x3a9a85['attributes'],function(_0x436313){var _0x4667bf={};_0x4667bf[_0x436313]={'$like':'%'+_0x842d6f[_0x0a9e('0x31')][_0x0a9e('0x3f')]+'%'};return _0x4667bf;})});}_0x3a9a85=_[_0x0a9e('0x3d')]({},_0x3a9a85,_0x842d6f['options']);return db['CmHopperFinal'][_0x0a9e('0x18')]({'where':_0x3a9a85['where']})[_0x0a9e('0x21')](function(_0x4658df){_0x329d88[_0x0a9e('0x18')]=_0x4658df;if(_0x842d6f[_0x0a9e('0x31')][_0x0a9e('0x41')]){_0x3a9a85[_0x0a9e('0x42')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x3a9a85);})[_0x0a9e('0x21')](function(_0x5dfbe2){_0x329d88[_0x0a9e('0x43')]=_0x5dfbe2;return _0x329d88;});}})['then'](respondWithFilteredResult(_0x16341a,_0x3a9a85))[_0x0a9e('0x44')](handleError(_0x16341a,null));};exports['getHopperBlacks']=function(_0x558d60,_0x1c49dc,_0xb8db59){var _0x5e9b0b={'raw':!![],'where':{}};var _0x170af6={};var _0x17cb30={'count':0x0,'rows':[]};return db[_0x0a9e('0x2c')][_0x0a9e('0x57')]({'where':{'id':_0x558d60[_0x0a9e('0x46')]['id']}})['then'](handleEntityNotFound(_0x1c49dc,null))['then'](function(_0x16449b){if(_0x16449b){_0x170af6[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](db[_0x0a9e('0x60')][_0x0a9e('0x47')]);_0x170af6['query']=_[_0x0a9e('0x32')](_0x558d60[_0x0a9e('0x31')]);_0x170af6['filters']=_[_0x0a9e('0x35')](_0x170af6[_0x0a9e('0x30')],_0x170af6[_0x0a9e('0x31')]);_0x5e9b0b[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x170af6[_0x0a9e('0x30')],qs[_0x0a9e('0x36')](_0x558d60[_0x0a9e('0x31')][_0x0a9e('0x36')]));_0x5e9b0b[_0x0a9e('0x34')]=_0x5e9b0b['attributes'][_0x0a9e('0x37')]?_0x5e9b0b[_0x0a9e('0x34')]:_0x170af6[_0x0a9e('0x30')];if(!_0x558d60[_0x0a9e('0x31')][_0x0a9e('0x58')]('nolimit')){_0x5e9b0b['limit']=qs[_0x0a9e('0x1a')](_0x558d60[_0x0a9e('0x31')][_0x0a9e('0x1a')]);_0x5e9b0b[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x558d60['query'][_0x0a9e('0x19')]);}_0x5e9b0b[_0x0a9e('0x39')]=qs[_0x0a9e('0x3a')](_0x558d60['query'][_0x0a9e('0x3a')]);_0x5e9b0b['where']=qs[_0x0a9e('0x33')](_['pick'](_0x558d60[_0x0a9e('0x31')],_0x170af6[_0x0a9e('0x33')]));_0x5e9b0b[_0x0a9e('0x3b')]['CampaignId']=_0x16449b['id'];if(_0x558d60[_0x0a9e('0x31')]['filter']){_0x5e9b0b[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](_0x5e9b0b[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x2b')](_0x5e9b0b[_0x0a9e('0x34')],function(_0x1bee04){var _0x4014c7={};_0x4014c7[_0x1bee04]={'$like':'%'+_0x558d60[_0x0a9e('0x31')][_0x0a9e('0x3f')]+'%'};return _0x4014c7;})});}_0x5e9b0b=_[_0x0a9e('0x3d')]({},_0x5e9b0b,_0x558d60[_0x0a9e('0x40')]);return db[_0x0a9e('0x60')][_0x0a9e('0x18')]({'where':_0x5e9b0b[_0x0a9e('0x3b')]})[_0x0a9e('0x21')](function(_0x248368){_0x17cb30['count']=_0x248368;if(_0x558d60['query'][_0x0a9e('0x41')]){_0x5e9b0b['include']=[{'all':!![]}];}return db[_0x0a9e('0x60')][_0x0a9e('0x5b')](_0x5e9b0b);})['then'](function(_0x1a3754){_0x17cb30[_0x0a9e('0x43')]=_0x1a3754;return _0x17cb30;});}})[_0x0a9e('0x21')](respondWithFilteredResult(_0x1c49dc,_0x5e9b0b))[_0x0a9e('0x44')](handleError(_0x1c49dc,null));};exports['getLists']=function(_0x148fd9,_0x26cb76,_0x374f0b){var _0x34a791={};var _0x5d0e1f={};var _0x19e9ed;var _0x1a0b08;return db[_0x0a9e('0x2c')]['findOne']({'where':{'id':_0x148fd9[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x26cb76,null))[_0x0a9e('0x21')](function(_0x54b107){if(_0x54b107){_0x19e9ed=_0x54b107;_0x5d0e1f[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](db[_0x0a9e('0x61')][_0x0a9e('0x47')]);_0x5d0e1f[_0x0a9e('0x31')]=_['keys'](_0x148fd9[_0x0a9e('0x31')]);_0x5d0e1f[_0x0a9e('0x33')]=_['intersection'](_0x5d0e1f[_0x0a9e('0x30')],_0x5d0e1f[_0x0a9e('0x31')]);_0x34a791[_0x0a9e('0x34')]=_['intersection'](_0x5d0e1f['model'],qs['fields'](_0x148fd9[_0x0a9e('0x31')][_0x0a9e('0x36')]));_0x34a791['attributes']=_0x34a791[_0x0a9e('0x34')][_0x0a9e('0x37')]?_0x34a791[_0x0a9e('0x34')]:_0x5d0e1f['model'];_0x34a791[_0x0a9e('0x39')]=qs[_0x0a9e('0x3a')](_0x148fd9[_0x0a9e('0x31')][_0x0a9e('0x3a')]);_0x34a791[_0x0a9e('0x3b')]=qs[_0x0a9e('0x33')](_[_0x0a9e('0x3c')](_0x148fd9[_0x0a9e('0x31')],_0x5d0e1f[_0x0a9e('0x33')]));if(_0x148fd9['query'][_0x0a9e('0x3f')]){_0x34a791['where']=_[_0x0a9e('0x3d')](_0x34a791[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x2b')](_0x34a791[_0x0a9e('0x34')],function(_0x407e9d){var _0x344cd4={};_0x344cd4[_0x407e9d]={'$like':'%'+_0x148fd9['query'][_0x0a9e('0x3f')]+'%'};return _0x344cd4;})});}_0x34a791=_[_0x0a9e('0x3d')]({},_0x34a791,_0x148fd9[_0x0a9e('0x40')]);return _0x19e9ed[_0x0a9e('0x62')](_0x34a791);}})['then'](function(_0x2e4887){if(_0x2e4887){_0x1a0b08=_0x2e4887[_0x0a9e('0x37')];if(!_0x148fd9[_0x0a9e('0x31')][_0x0a9e('0x58')](_0x0a9e('0x38'))){_0x34a791[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x148fd9[_0x0a9e('0x31')][_0x0a9e('0x1a')]);_0x34a791[_0x0a9e('0x19')]=qs['offset'](_0x148fd9[_0x0a9e('0x31')][_0x0a9e('0x19')]);}return _0x19e9ed[_0x0a9e('0x62')](_0x34a791);}})[_0x0a9e('0x21')](function(_0xea8bd1){if(_0xea8bd1){return _0xea8bd1?{'count':_0x1a0b08,'rows':_0xea8bd1}:null;}})[_0x0a9e('0x21')](respondWithResult(_0x26cb76,null))[_0x0a9e('0x44')](handleError(_0x26cb76,null));};exports[_0x0a9e('0x63')]=function(_0x566b90,_0x3b581c,_0xd2391){var _0x1a9ef1,_0x5c65fc;return db[_0x0a9e('0x2c')][_0x0a9e('0x48')]({'where':{'id':_0x566b90[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x3b581c,null))[_0x0a9e('0x21')](function(_0x1ba457){if(_0x1ba457){_0x5c65fc=_0x1ba457;return _0x1ba457[_0x0a9e('0x63')](_0x566b90[_0x0a9e('0x4a')][_0x0a9e('0x64')],_[_0x0a9e('0x53')](_0x566b90['body'],[_0x0a9e('0x64'),'id'])||{});}return null;})[_0x0a9e('0x65')](function(_0x15a9ed){var _0x3db98f;_0x1a9ef1=_0x15a9ed||[];var _0x2b624e=[];if(_0x15a9ed){for(var _0x3942fd=0x0;_0x3942fd<_0x15a9ed['length'];_0x3942fd+=0x1){var _0x382687=_0x15a9ed[_0x3942fd]['get']({'plain':!![]});_0x5c65fc['dialCheckDuplicateType']=_0x566b90['body'][_0x0a9e('0x66')]?_0x566b90[_0x0a9e('0x4a')][_0x0a9e('0x66')]:_0x5c65fc[_0x0a9e('0x66')];switch(_0x5c65fc['dialCheckDuplicateType']){case _0x0a9e('0x67'):_0x3db98f=squel[_0x0a9e('0x68')]()[_0x0a9e('0x69')](_0x0a9e('0x6a'))[_0x0a9e('0x6b')](['phone','scheduledAt',_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x59'),'createdAt',_0x0a9e('0x52')],squel[_0x0a9e('0x6e')]()[_0x0a9e('0x6f')]('phone',_0x0a9e('0x70'))[_0x0a9e('0x6f')](_0x0a9e('0x71'),'scheduledAt')[_0x0a9e('0x6f')]('id',_0x0a9e('0x6c'))[_0x0a9e('0x6f')](_0x382687['CmListId']['toString'](),'ListId')[_0x0a9e('0x6f')](_0x566b90[_0x0a9e('0x46')]['id'][_0x0a9e('0x72')](),_0x0a9e('0x59'))['field'](_0x0a9e('0x71'),'createdAt')[_0x0a9e('0x6f')](_0x0a9e('0x71'),_0x0a9e('0x52'))['from'](_0x0a9e('0x73'))[_0x0a9e('0x3b')](_0x0a9e('0x74'))['where'](_0x0a9e('0x75'),_0x382687['CmListId'][_0x0a9e('0x72')]())['where'](_0x0a9e('0x76'))['where'](_0x0a9e('0x77'),squel[_0x0a9e('0x6e')]()[_0x0a9e('0x6f')](_0x0a9e('0x78'))[_0x0a9e('0x79')](_0x0a9e('0x7a'))[_0x0a9e('0x3b')]('CampaignId\x20=\x20?',_0x566b90[_0x0a9e('0x46')]['id'][_0x0a9e('0x72')]()))['where'](_0x0a9e('0x77'),squel[_0x0a9e('0x6e')]()['field'](_0x0a9e('0x7b'))[_0x0a9e('0x79')](_0x0a9e('0x6a'))['where'](_0x0a9e('0x7c'),_0x566b90[_0x0a9e('0x46')]['id'][_0x0a9e('0x72')]())))[_0x0a9e('0x72')]();break;case _0x0a9e('0x7d'):_0x3db98f=squel[_0x0a9e('0x68')]()[_0x0a9e('0x69')](_0x0a9e('0x6a'))[_0x0a9e('0x6b')]([_0x0a9e('0x70'),'scheduledAt',_0x0a9e('0x6c'),'ListId',_0x0a9e('0x59'),_0x0a9e('0x51'),_0x0a9e('0x52')],squel[_0x0a9e('0x6e')]()[_0x0a9e('0x6f')](_0x0a9e('0x70'),'phone')[_0x0a9e('0x6f')](_0x0a9e('0x71'),_0x0a9e('0x7e'))['field']('id',_0x0a9e('0x6c'))[_0x0a9e('0x6f')](_0x382687[_0x0a9e('0x7f')][_0x0a9e('0x72')](),_0x0a9e('0x6d'))[_0x0a9e('0x6f')](_0x566b90[_0x0a9e('0x46')]['id']['toString'](),_0x0a9e('0x59'))[_0x0a9e('0x6f')](_0x0a9e('0x71'),_0x0a9e('0x51'))[_0x0a9e('0x6f')](_0x0a9e('0x71'),_0x0a9e('0x52'))['from']('cm_contacts')[_0x0a9e('0x3b')](_0x0a9e('0x74'))[_0x0a9e('0x3b')](_0x0a9e('0x75'),_0x382687[_0x0a9e('0x7f')][_0x0a9e('0x72')]())[_0x0a9e('0x3b')]('phone\x20IS\x20NOT\x20NULL')[_0x0a9e('0x3b')](_0x0a9e('0x77'),squel[_0x0a9e('0x6e')]()[_0x0a9e('0x6f')](_0x0a9e('0x7b'))[_0x0a9e('0x79')](_0x0a9e('0x6a'))['where'](_0x0a9e('0x7c'),_0x566b90[_0x0a9e('0x46')]['id'][_0x0a9e('0x72')]())))['toString']();break;default:_0x3db98f=squel[_0x0a9e('0x68')]()[_0x0a9e('0x69')](_0x0a9e('0x6a'))[_0x0a9e('0x6b')](['phone',_0x0a9e('0x7e'),_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x59'),_0x0a9e('0x51'),_0x0a9e('0x52')],squel[_0x0a9e('0x6e')]()[_0x0a9e('0x6f')]('phone',_0x0a9e('0x70'))[_0x0a9e('0x6f')](_0x0a9e('0x71'),_0x0a9e('0x7e'))['field']('id','ContactId')[_0x0a9e('0x6f')](_0x382687[_0x0a9e('0x7f')][_0x0a9e('0x72')](),'ListId')[_0x0a9e('0x6f')](_0x566b90[_0x0a9e('0x46')]['id']['toString'](),_0x0a9e('0x59'))['field'](_0x0a9e('0x71'),'createdAt')['field']('NOW()',_0x0a9e('0x52'))[_0x0a9e('0x79')](_0x0a9e('0x73'))[_0x0a9e('0x3b')](_0x0a9e('0x74'))[_0x0a9e('0x3b')]('ListId\x20=\x20?',_0x382687[_0x0a9e('0x7f')][_0x0a9e('0x72')]())[_0x0a9e('0x3b')](_0x0a9e('0x76')))[_0x0a9e('0x72')]();}_0x2b624e[_0x0a9e('0x80')](db[_0x0a9e('0x81')]['query'](_0x3db98f));}return BPromise['all'](_0x2b624e);}})[_0x0a9e('0x21')](function(){return _0x1a9ef1;})['then'](respondWithResult(_0x3b581c,null))[_0x0a9e('0x44')](handleError(_0x3b581c,null));};exports[_0x0a9e('0x82')]=function(_0x1f0318,_0xa3695f,_0x37a448){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x1f0318[_0x0a9e('0x46')]['id']}})['then'](handleEntityNotFound(_0xa3695f,null))['then'](function(_0x504403){if(_0x504403){return _0x504403['removeLists'](_0x1f0318[_0x0a9e('0x31')]['ids']);}})['then'](function(_0x26223f){if(_0x26223f){return db['CmHopper'][_0x0a9e('0x22')]({'where':{'ListId':_0x1f0318[_0x0a9e('0x31')][_0x0a9e('0x64')],'CampaignId':_0x1f0318['params']['id']}})[_0x0a9e('0x21')](function(){return _0x26223f;});}})[_0x0a9e('0x21')](respondWithStatusCode(_0xa3695f,null))[_0x0a9e('0x44')](handleError(_0xa3695f,null));};exports['getBlackLists']=function(_0x5236c9,_0xdc77d,_0x948aab){var _0x89d2cb={};var _0x2f79fb={};var _0x3b0db2;var _0x376b97;return db[_0x0a9e('0x2c')][_0x0a9e('0x57')]({'where':{'id':_0x5236c9[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0xdc77d,null))['then'](function(_0x51fa33){if(_0x51fa33){_0x3b0db2=_0x51fa33;_0x2f79fb['model']=_[_0x0a9e('0x32')](db[_0x0a9e('0x61')][_0x0a9e('0x47')]);_0x2f79fb[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x5236c9[_0x0a9e('0x31')]);_0x2f79fb[_0x0a9e('0x33')]=_[_0x0a9e('0x35')](_0x2f79fb['model'],_0x2f79fb['query']);_0x89d2cb[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x2f79fb['model'],qs[_0x0a9e('0x36')](_0x5236c9[_0x0a9e('0x31')][_0x0a9e('0x36')]));_0x89d2cb[_0x0a9e('0x34')]=_0x89d2cb[_0x0a9e('0x34')][_0x0a9e('0x37')]?_0x89d2cb[_0x0a9e('0x34')]:_0x2f79fb[_0x0a9e('0x30')];_0x89d2cb[_0x0a9e('0x39')]=qs[_0x0a9e('0x3a')](_0x5236c9[_0x0a9e('0x31')][_0x0a9e('0x3a')]);_0x89d2cb['where']=qs[_0x0a9e('0x33')](_[_0x0a9e('0x3c')](_0x5236c9[_0x0a9e('0x31')],_0x2f79fb[_0x0a9e('0x33')]));if(_0x5236c9[_0x0a9e('0x31')][_0x0a9e('0x3f')]){_0x89d2cb[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](_0x89d2cb[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x2b')](_0x89d2cb[_0x0a9e('0x34')],function(_0x3ba472){var _0x4e6eb9={};_0x4e6eb9[_0x3ba472]={'$like':'%'+_0x5236c9['query'][_0x0a9e('0x3f')]+'%'};return _0x4e6eb9;})});}_0x89d2cb=_[_0x0a9e('0x3d')]({},_0x89d2cb,_0x5236c9[_0x0a9e('0x40')]);return _0x3b0db2[_0x0a9e('0x83')](_0x89d2cb);}})[_0x0a9e('0x21')](function(_0x1e29e2){if(_0x1e29e2){_0x376b97=_0x1e29e2[_0x0a9e('0x37')];if(!_0x5236c9['query'][_0x0a9e('0x58')]('nolimit')){_0x89d2cb[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x5236c9[_0x0a9e('0x31')][_0x0a9e('0x1a')]);_0x89d2cb[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x5236c9[_0x0a9e('0x31')][_0x0a9e('0x19')]);}return _0x3b0db2[_0x0a9e('0x83')](_0x89d2cb);}})[_0x0a9e('0x21')](function(_0x39d367){if(_0x39d367){return _0x39d367?{'count':_0x376b97,'rows':_0x39d367}:null;}})[_0x0a9e('0x21')](respondWithResult(_0xdc77d,null))[_0x0a9e('0x44')](handleError(_0xdc77d,null));};exports[_0x0a9e('0x84')]=function(_0x3c8a9a,_0x2d5e00,_0x5b78a8){var _0x54cf62,_0x9dc1de;return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x3c8a9a['params']['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x2d5e00,null))[_0x0a9e('0x21')](function(_0x3304a1){if(_0x3304a1){_0x9dc1de=_0x3304a1;return _0x3304a1['addBlackLists'](_0x3c8a9a[_0x0a9e('0x4a')]['ids'],_[_0x0a9e('0x53')](_0x3c8a9a['body'],[_0x0a9e('0x64'),'id'])||{});}return null;})['spread'](function(_0x122e7d){var _0x21e210;_0x54cf62=_0x122e7d||[];var _0x1d5432=[];if(_0x122e7d){for(var _0x50e7cc=0x0;_0x50e7cc<_0x122e7d[_0x0a9e('0x37')];_0x50e7cc+=0x1){var _0x497fda=_0x122e7d[_0x50e7cc]['get']({'plain':!![]});_0x21e210=squel[_0x0a9e('0x68')]()[_0x0a9e('0x69')](_0x0a9e('0x85'))[_0x0a9e('0x6b')]([_0x0a9e('0x70'),_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x59'),_0x0a9e('0x51'),_0x0a9e('0x52')],squel[_0x0a9e('0x6e')]()[_0x0a9e('0x6f')](_0x0a9e('0x70'),_0x0a9e('0x70'))[_0x0a9e('0x6f')]('id',_0x0a9e('0x6c'))[_0x0a9e('0x6f')](_0x497fda[_0x0a9e('0x7f')][_0x0a9e('0x72')](),'ListId')[_0x0a9e('0x6f')](_0x3c8a9a[_0x0a9e('0x46')]['id'][_0x0a9e('0x72')](),_0x0a9e('0x59'))['field']('NOW()','createdAt')[_0x0a9e('0x6f')]('NOW()',_0x0a9e('0x52'))[_0x0a9e('0x79')](_0x0a9e('0x73'))[_0x0a9e('0x3b')](_0x0a9e('0x74'))[_0x0a9e('0x3b')](_0x0a9e('0x75'),_0x497fda[_0x0a9e('0x7f')][_0x0a9e('0x72')]())[_0x0a9e('0x3b')]('phone\x20IS\x20NOT\x20NULL'))[_0x0a9e('0x72')]();_0x1d5432['push'](db[_0x0a9e('0x81')]['query'](_0x21e210));}return BPromise[_0x0a9e('0x86')](_0x1d5432);}})[_0x0a9e('0x21')](function(){return _0x54cf62;})[_0x0a9e('0x21')](respondWithResult(_0x2d5e00,null))['catch'](handleError(_0x2d5e00,null));};exports[_0x0a9e('0x87')]=function(_0x2571ae,_0x531377,_0x53c4f0){return db[_0x0a9e('0x2c')][_0x0a9e('0x48')]({'where':{'id':_0x2571ae[_0x0a9e('0x46')]['id']}})['then'](handleEntityNotFound(_0x531377,null))['then'](function(_0x4869c1){if(_0x4869c1){return _0x4869c1[_0x0a9e('0x87')](_0x2571ae[_0x0a9e('0x31')][_0x0a9e('0x64')]);}})[_0x0a9e('0x21')](function(_0x3d4349){if(_0x3d4349){return db[_0x0a9e('0x60')][_0x0a9e('0x22')]({'where':{'ListId':_0x2571ae[_0x0a9e('0x31')][_0x0a9e('0x64')],'CampaignId':_0x2571ae[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](function(){return _0x3d4349;});}})[_0x0a9e('0x21')](respondWithStatusCode(_0x531377,null))[_0x0a9e('0x44')](handleError(_0x531377,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 5381c48..e3266e7 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 _0xd985=['define','campaigns','lodash','util','../../config/logger','api','moment','bluebird','rimraf','./campaign.attributes','exports'];(function(_0x49caac,_0x1d585f){var _0xcd51ba=function(_0x142978){while(--_0x142978){_0x49caac['push'](_0x49caac['shift']());}};_0xcd51ba(++_0x1d585f);}(_0xd985,0x1ba));var _0x5d98=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xd985[_0x26f702];return _0x11417d;};'use strict';var _=require(_0x5d98('0x0'));var util=require(_0x5d98('0x1'));var logger=require(_0x5d98('0x2'))(_0x5d98('0x3'));var moment=require(_0x5d98('0x4'));var BPromise=require(_0x5d98('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5d98('0x6'));var config=require('../../config/environment');var attributes=require(_0x5d98('0x7'));module[_0x5d98('0x8')]=function(_0x48118d,_0xe06e9e){return _0x48118d[_0x5d98('0x9')]('Campaign',attributes,{'tableName':_0x5d98('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf828=['request-promise','./campaign.attributes','exports','define','Campaign','campaigns','lodash','../../config/logger','moment','bluebird'];(function(_0x4f6e4f,_0x4dd2d5){var _0x13ba8f=function(_0x568054){while(--_0x568054){_0x4f6e4f['push'](_0x4f6e4f['shift']());}};_0x13ba8f(++_0x4dd2d5);}(_0xf828,0x146));var _0x8f82=function(_0x4d4c10,_0x37a7f6){_0x4d4c10=_0x4d4c10-0x0;var _0x152e03=_0xf828[_0x4d4c10];return _0x152e03;};'use strict';var _=require(_0x8f82('0x0'));var util=require('util');var logger=require(_0x8f82('0x1'))('api');var moment=require(_0x8f82('0x2'));var BPromise=require(_0x8f82('0x3'));var rp=require(_0x8f82('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8f82('0x5'));module[_0x8f82('0x6')]=function(_0x45d50a,_0x58af70){return _0x45d50a[_0x8f82('0x7')](_0x8f82('0x8'),attributes,{'tableName':_0x8f82('0x9'),'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 03437f1..d2fc678 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 _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x3faf8e,_0x58d15b){var _0x136661=function(_0x3e0204){while(--_0x3e0204){_0x3faf8e['push'](_0x3faf8e['shift']());}};_0x136661(++_0x58d15b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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['GetCampaign']=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')]));});});}; \ No newline at end of file +var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x35641f,_0xcf9399){var _0xeadfe8=function(_0x32ceb4){while(--_0x32ceb4){_0x35641f['push'](_0x35641f['shift']());}};_0xeadfe8(++_0xcf9399);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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['GetCampaign']=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')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index f1d0519..759ae29 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 _0x8a1b=['index','get','/:id','show','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','addLists','addBlackLists','put','update','delete','removeLists','removeBlackLists','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated'];(function(_0x393caf,_0xf1736f){var _0x18b224=function(_0x4155ae){while(--_0x4155ae){_0x393caf['push'](_0x393caf['shift']());}};_0x18b224(++_0xf1736f);}(_0x8a1b,0x160));var _0xb8a1=function(_0x45deca,_0x5c8d38){_0x45deca=_0x45deca-0x0;var _0x1e5c9e=_0x8a1b[_0x45deca];return _0x1e5c9e;};'use strict';var multer=require(_0xb8a1('0x0'));var util=require(_0xb8a1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb8a1('0x2'));var router=express[_0xb8a1('0x3')]();var fs_extra=require(_0xb8a1('0x4'));var auth=require(_0xb8a1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb8a1('0x6'));var controller=require('./campaign.controller');router['get']('/',auth[_0xb8a1('0x7')](),controller[_0xb8a1('0x8')]);router[_0xb8a1('0x9')](_0xb8a1('0xa'),auth[_0xb8a1('0x7')](),controller[_0xb8a1('0xb')]);router[_0xb8a1('0x9')]('/:id/hoppers',auth[_0xb8a1('0x7')](),controller['getHoppers']);router[_0xb8a1('0x9')]('/:id/hopper_histories',auth[_0xb8a1('0x7')](),controller[_0xb8a1('0xc')]);router[_0xb8a1('0x9')](_0xb8a1('0xd'),auth[_0xb8a1('0x7')](),controller[_0xb8a1('0xe')]);router[_0xb8a1('0x9')](_0xb8a1('0xf'),auth[_0xb8a1('0x7')](),controller['getHopperBlacks']);router[_0xb8a1('0x9')](_0xb8a1('0x10'),auth[_0xb8a1('0x7')](),controller[_0xb8a1('0x11')]);router['get'](_0xb8a1('0x12'),auth[_0xb8a1('0x7')](),controller[_0xb8a1('0x13')]);router[_0xb8a1('0x14')]('/',auth[_0xb8a1('0x7')](),controller[_0xb8a1('0x15')]);router[_0xb8a1('0x14')]('/:id/clone',auth[_0xb8a1('0x7')](),controller['clone']);router[_0xb8a1('0x14')]('/:id/lists',auth[_0xb8a1('0x7')](),controller[_0xb8a1('0x16')]);router[_0xb8a1('0x14')](_0xb8a1('0x12'),auth[_0xb8a1('0x7')](),controller[_0xb8a1('0x17')]);router[_0xb8a1('0x18')](_0xb8a1('0xa'),auth[_0xb8a1('0x7')](),controller[_0xb8a1('0x19')]);router[_0xb8a1('0x1a')](_0xb8a1('0xa'),auth[_0xb8a1('0x7')](),controller['destroy']);router[_0xb8a1('0x1a')](_0xb8a1('0x10'),auth[_0xb8a1('0x7')](),controller[_0xb8a1('0x1b')]);router[_0xb8a1('0x1a')](_0xb8a1('0x12'),auth['isAuthenticated'](),controller[_0xb8a1('0x1c')]);module[_0xb8a1('0x1d')]=router; \ No newline at end of file +var _0xf3eb=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperBlacks','/:id/lists','getBlackLists','post','create','/:id/clone','clone','addLists','/:id/blacklists','put','update','delete','exports','util','path','connect-timeout','express','Router'];(function(_0x48de9e,_0x144e00){var _0x20e60f=function(_0x2f65a3){while(--_0x2f65a3){_0x48de9e['push'](_0x48de9e['shift']());}};_0x20e60f(++_0x144e00);}(_0xf3eb,0xf7));var _0xbf3e=function(_0x111dca,_0x4edf9c){_0x111dca=_0x111dca-0x0;var _0x53b7ff=_0xf3eb[_0x111dca];return _0x53b7ff;};'use strict';var multer=require('multer');var util=require(_0xbf3e('0x0'));var path=require(_0xbf3e('0x1'));var timeout=require(_0xbf3e('0x2'));var express=require(_0xbf3e('0x3'));var router=express[_0xbf3e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf3e('0x5'));var config=require(_0xbf3e('0x6'));var controller=require('./campaign.controller');router['get']('/',auth[_0xbf3e('0x7')](),controller[_0xbf3e('0x8')]);router[_0xbf3e('0x9')](_0xbf3e('0xa'),auth[_0xbf3e('0x7')](),controller[_0xbf3e('0xb')]);router[_0xbf3e('0x9')]('/:id/hoppers',auth[_0xbf3e('0x7')](),controller[_0xbf3e('0xc')]);router[_0xbf3e('0x9')]('/:id/hopper_histories',auth[_0xbf3e('0x7')](),controller[_0xbf3e('0xd')]);router[_0xbf3e('0x9')](_0xbf3e('0xe'),auth[_0xbf3e('0x7')](),controller['getHopperFinals']);router[_0xbf3e('0x9')]('/:id/hopper_black',auth[_0xbf3e('0x7')](),controller[_0xbf3e('0xf')]);router[_0xbf3e('0x9')](_0xbf3e('0x10'),auth[_0xbf3e('0x7')](),controller['getLists']);router['get']('/:id/blacklists',auth[_0xbf3e('0x7')](),controller[_0xbf3e('0x11')]);router[_0xbf3e('0x12')]('/',auth[_0xbf3e('0x7')](),controller[_0xbf3e('0x13')]);router['post'](_0xbf3e('0x14'),auth[_0xbf3e('0x7')](),controller[_0xbf3e('0x15')]);router[_0xbf3e('0x12')](_0xbf3e('0x10'),auth[_0xbf3e('0x7')](),controller[_0xbf3e('0x16')]);router['post'](_0xbf3e('0x17'),auth['isAuthenticated'](),controller['addBlackLists']);router[_0xbf3e('0x18')](_0xbf3e('0xa'),auth[_0xbf3e('0x7')](),controller[_0xbf3e('0x19')]);router['delete'](_0xbf3e('0xa'),auth[_0xbf3e('0x7')](),controller['destroy']);router[_0xbf3e('0x1a')](_0xbf3e('0x10'),auth[_0xbf3e('0x7')](),controller['removeLists']);router[_0xbf3e('0x1a')]('/:id/blacklists',auth[_0xbf3e('0x7')](),controller['removeBlackLists']);module[_0xbf3e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index a597aa0..61c7809 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 _0xbf5f=['STRING','TEXT','sequelize','exports'];(function(_0x584c02,_0x4e0a9c){var _0x284a0e=function(_0x48d555){while(--_0x48d555){_0x584c02['push'](_0x584c02['shift']());}};_0x284a0e(++_0x4e0a9c);}(_0xbf5f,0x19e));var _0xfbf5=function(_0x5d5eda,_0x5729b2){_0x5d5eda=_0x5d5eda-0x0;var _0x2f13a7=_0xbf5f[_0x5d5eda];return _0x2f13a7;};'use strict';var Sequelize=require(_0xfbf5('0x0'));module[_0xfbf5('0x1')]={'key':{'type':Sequelize[_0xfbf5('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xfbf5('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file +var _0xa024=['VIRTUAL','getDataValue','key','sequelize','exports','STRING','TEXT'];(function(_0x330376,_0x70a3f){var _0xb7f093=function(_0x3f2586){while(--_0x3f2586){_0x330376['push'](_0x330376['shift']());}};_0xb7f093(++_0x70a3f);}(_0xa024,0x1ae));var _0x4a02=function(_0x52e5a8,_0x347fe8){_0x52e5a8=_0x52e5a8-0x0;var _0x293ba5=_0xa024[_0x52e5a8];return _0x293ba5;};'use strict';var Sequelize=require(_0x4a02('0x0'));module[_0x4a02('0x1')]={'key':{'type':Sequelize[_0x4a02('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x4a02('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x4a02('0x2')]},'name':{'type':Sequelize[_0x4a02('0x4')],'get':function(){return this[_0x4a02('0x5')](_0x4a02('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 021136f..538515f 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 _0x997f=['query','keys','filters','intersection','model','attributes','fields','length','limit','order','sort','where','pick','filter','merge','options','include','findAll','catch','show','params','includeAll','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CannedAnswers','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','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','sendStatus','status','end','offset','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','CannedAnswer','rawAttributes','type','key'];(function(_0x15e959,_0x48b37d){var _0xe54316=function(_0xebef87){while(--_0xebef87){_0x15e959['push'](_0x15e959['shift']());}};_0xe54316(++_0x48b37d);}(_0x997f,0xd2));var _0xf997=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x997f[_0x1abb09];return _0xea1c07;};'use strict';var pdf=require(_0xf997('0x0'));var emlformat=require(_0xf997('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf997('0x2'));var jsonpatch=require(_0xf997('0x3'));var rp=require(_0xf997('0x4'));var moment=require(_0xf997('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf997('0x6'));var util=require('util');var path=require('path');var sox=require(_0xf997('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf997('0x8'));var squel=require(_0xf997('0x9'));var crypto=require(_0xf997('0xa'));var jsforce=require(_0xf997('0xb'));var deskjs=require(_0xf997('0xc'));var toCsv=require(_0xf997('0xd'));var querystring=require(_0xf997('0xe'));var Papa=require(_0xf997('0xf'));var Redis=require('ioredis');var authService=require(_0xf997('0x10'));var qs=require(_0xf997('0x11'));var as=require(_0xf997('0x12'));var hardwareService=require(_0xf997('0x13'));var logger=require(_0xf997('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xf997('0x15'));var licenseUtil=require(_0xf997('0x16'));var db=require(_0xf997('0x17'))['db'];function respondWithStatusCode(_0x40da09,_0x464b40){_0x464b40=_0x464b40||0xcc;return function(_0x2def67){if(_0x2def67){return _0x40da09[_0xf997('0x18')](_0x464b40);}return _0x40da09[_0xf997('0x19')](_0x464b40)[_0xf997('0x1a')]();};}function respondWithResult(_0x294cba,_0x16aae3){_0x16aae3=_0x16aae3||0xc8;return function(_0x1ce36d){if(_0x1ce36d){return _0x294cba[_0xf997('0x19')](_0x16aae3)['json'](_0x1ce36d);}};}function respondWithFilteredResult(_0x4acd63,_0x552b33){return function(_0x5c278f){if(_0x5c278f){var _0xe76f69=_0x5c278f['count'],_0x58011c=_0x552b33[_0xf997('0x1b')],_0x3309e2=_0x552b33['offset']+_0x552b33['limit'],_0x325db8;if(_0x3309e2>=_0xe76f69){_0x3309e2=_0xe76f69;_0x325db8=0xc8;}else{_0x325db8=0xce;}_0x4acd63['status'](_0x325db8);return _0x4acd63['set'](_0xf997('0x1c'),_0x58011c+'-'+_0x3309e2+'/'+_0xe76f69)[_0xf997('0x1d')](_0x5c278f);}return null;};}function patchUpdates(_0x2bce9b){return function(_0x23d029){try{jsonpatch[_0xf997('0x1e')](_0x23d029,_0x2bce9b,!![]);}catch(_0xb061fb){return BPromise[_0xf997('0x1f')](_0xb061fb);}return _0x23d029[_0xf997('0x20')]();};}function saveUpdates(_0x4a1893,_0x349b73){return function(_0x3b7b34){if(_0x3b7b34){return _0x3b7b34[_0xf997('0x21')](_0x4a1893)[_0xf997('0x22')](function(_0x92e7aa){return _0x92e7aa;});}return null;};}function removeEntity(_0x2df47b,_0x2a7556){return function(_0x2eca66){if(_0x2eca66){return _0x2eca66[_0xf997('0x23')]()[_0xf997('0x22')](function(){var _0x9dac95=_0x2eca66[_0xf997('0x24')]({'plain':!![]});var _0x17fe0d='CannedAnswers';return db[_0xf997('0x25')]['destroy']({'where':{'type':_0x17fe0d,'resourceId':_0x9dac95['id']}})[_0xf997('0x22')](function(){return _0x2eca66;});})['then'](function(){_0x2df47b[_0xf997('0x19')](0xcc)[_0xf997('0x1a')]();});}};}function handleEntityNotFound(_0x3e2455,_0x200102){return function(_0x1c0c7e){if(!_0x1c0c7e){_0x3e2455['sendStatus'](0x194);}return _0x1c0c7e;};}function handleError(_0x3bbcde,_0x1ab73b){_0x1ab73b=_0x1ab73b||0x1f4;return function(_0x6d34c0){logger[_0xf997('0x26')](_0x6d34c0[_0xf997('0x27')]);if(_0x6d34c0[_0xf997('0x28')]){delete _0x6d34c0['name'];}_0x3bbcde[_0xf997('0x19')](_0x1ab73b)[_0xf997('0x29')](_0x6d34c0);};}exports[_0xf997('0x2a')]=function(_0x703cd1,_0x2187bb){var _0x118d09={},_0x32a33d={},_0x13fd3b={'count':0x0,'rows':[]};var _0xc814e=_[_0xf997('0x2b')](db[_0xf997('0x2c')][_0xf997('0x2d')],function(_0x39510d){return{'name':_0x39510d['fieldName'],'type':_0x39510d[_0xf997('0x2e')][_0xf997('0x2f')]};});_0x32a33d['model']=_['map'](_0xc814e,_0xf997('0x28'));_0x32a33d[_0xf997('0x30')]=_[_0xf997('0x31')](_0x703cd1[_0xf997('0x30')]);_0x32a33d[_0xf997('0x32')]=_[_0xf997('0x33')](_0x32a33d[_0xf997('0x34')],_0x32a33d[_0xf997('0x30')]);_0x118d09[_0xf997('0x35')]=_[_0xf997('0x33')](_0x32a33d[_0xf997('0x34')],qs[_0xf997('0x36')](_0x703cd1[_0xf997('0x30')]['fields']));_0x118d09[_0xf997('0x35')]=_0x118d09[_0xf997('0x35')][_0xf997('0x37')]?_0x118d09[_0xf997('0x35')]:_0x32a33d[_0xf997('0x34')];if(!_0x703cd1[_0xf997('0x30')]['hasOwnProperty']('nolimit')){_0x118d09[_0xf997('0x38')]=qs[_0xf997('0x38')](_0x703cd1['query']['limit']);_0x118d09[_0xf997('0x1b')]=qs[_0xf997('0x1b')](_0x703cd1['query'][_0xf997('0x1b')]);}_0x118d09[_0xf997('0x39')]=qs[_0xf997('0x3a')](_0x703cd1['query'][_0xf997('0x3a')]);_0x118d09[_0xf997('0x3b')]=qs[_0xf997('0x32')](_[_0xf997('0x3c')](_0x703cd1[_0xf997('0x30')],_0x32a33d['filters']),_0xc814e);if(_0x703cd1[_0xf997('0x30')][_0xf997('0x3d')]){_0x118d09[_0xf997('0x3b')]=_[_0xf997('0x3e')](_0x118d09[_0xf997('0x3b')],{'$or':_[_0xf997('0x2b')](_0xc814e,function(_0x854264){if(_0x854264[_0xf997('0x2e')]!=='VIRTUAL'){var _0x53d9fb={};_0x53d9fb[_0x854264[_0xf997('0x28')]]={'$like':'%'+_0x703cd1[_0xf997('0x30')][_0xf997('0x3d')]+'%'};return _0x53d9fb;}})});}_0x118d09=_['merge']({},_0x118d09,_0x703cd1[_0xf997('0x3f')]);var _0x1a1102={'where':_0x118d09['where']};return db[_0xf997('0x2c')]['count'](_0x1a1102)[_0xf997('0x22')](function(_0x3f5fcc){_0x13fd3b['count']=_0x3f5fcc;if(_0x703cd1[_0xf997('0x30')]['includeAll']){_0x118d09[_0xf997('0x40')]=[{'all':!![]}];}return db[_0xf997('0x2c')][_0xf997('0x41')](_0x118d09);})['then'](function(_0x14ccce){_0x13fd3b['rows']=_0x14ccce;return _0x13fd3b;})[_0xf997('0x22')](respondWithFilteredResult(_0x2187bb,_0x118d09))[_0xf997('0x42')](handleError(_0x2187bb,null));};exports[_0xf997('0x43')]=function(_0x2cba8d,_0x55bce4){var _0xc4e03b={'raw':!![],'where':{'id':_0x2cba8d[_0xf997('0x44')]['id']}},_0xeccb68={};_0xeccb68['model']=_[_0xf997('0x31')](db[_0xf997('0x2c')]['rawAttributes']);_0xeccb68[_0xf997('0x30')]=_[_0xf997('0x31')](_0x2cba8d[_0xf997('0x30')]);_0xeccb68[_0xf997('0x32')]=_[_0xf997('0x33')](_0xeccb68[_0xf997('0x34')],_0xeccb68[_0xf997('0x30')]);_0xc4e03b[_0xf997('0x35')]=_[_0xf997('0x33')](_0xeccb68[_0xf997('0x34')],qs['fields'](_0x2cba8d['query'][_0xf997('0x36')]));_0xc4e03b[_0xf997('0x35')]=_0xc4e03b[_0xf997('0x35')][_0xf997('0x37')]?_0xc4e03b[_0xf997('0x35')]:_0xeccb68['model'];if(_0x2cba8d[_0xf997('0x30')][_0xf997('0x45')]){_0xc4e03b['include']=[{'all':!![]}];}_0xc4e03b=_[_0xf997('0x3e')]({},_0xc4e03b,_0x2cba8d['options']);return db[_0xf997('0x2c')]['find'](_0xc4e03b)[_0xf997('0x22')](handleEntityNotFound(_0x55bce4,null))[_0xf997('0x22')](respondWithResult(_0x55bce4,null))['catch'](handleError(_0x55bce4,null));};exports[_0xf997('0x21')]=function(_0x1b7e6e,_0x3ea6b3){if(_0x1b7e6e[_0xf997('0x46')]['id']){delete _0x1b7e6e[_0xf997('0x46')]['id'];}return db[_0xf997('0x2c')]['find']({'where':{'id':_0x1b7e6e['params']['id']}})['then'](handleEntityNotFound(_0x3ea6b3,null))['then'](saveUpdates(_0x1b7e6e[_0xf997('0x46')],null))[_0xf997('0x22')](respondWithResult(_0x3ea6b3,null))['catch'](handleError(_0x3ea6b3,null));};exports[_0xf997('0x23')]=function(_0x14352a,_0x42260f){return db[_0xf997('0x2c')][_0xf997('0x47')]({'where':{'id':_0x14352a[_0xf997('0x44')]['id']}})['then'](handleEntityNotFound(_0x42260f,null))[_0xf997('0x22')](removeEntity(_0x42260f,null))[_0xf997('0x42')](handleError(_0x42260f,null));};exports[_0xf997('0x48')]=function(_0x4ec505,_0x12c72){var _0x5a3499={'key':_0x4ec505['body'][_0xf997('0x2f')]};if(_0x4ec505['body']['MailAccountId']){_0x5a3499[_0xf997('0x49')]=_0x4ec505[_0xf997('0x46')][_0xf997('0x49')];}else if(_0x4ec505[_0xf997('0x46')][_0xf997('0x4a')]){_0x5a3499[_0xf997('0x4a')]=_0x4ec505[_0xf997('0x46')][_0xf997('0x4a')];}else if(_0x4ec505[_0xf997('0x46')][_0xf997('0x4b')]){_0x5a3499['OpenchannelAccountId']=_0x4ec505[_0xf997('0x46')]['OpenchannelAccountId'];}else if(_0x4ec505['body'][_0xf997('0x4c')]){_0x5a3499[_0xf997('0x4c')]=_0x4ec505['body']['ChatWebsiteId'];}return db[_0xf997('0x2c')][_0xf997('0x47')]({'where':_0x5a3499})['then'](function(_0x23ee7e){if(_0x23ee7e){throw new db[(_0xf997('0x4d'))]['ValidationError'](_0xf997('0x4e'));}return db[_0xf997('0x2c')]['create'](_0x4ec505['body']);})[_0xf997('0x22')](function(_0x52fd5f){var _0x12b0e1=_0x4ec505[_0xf997('0x4f')][_0xf997('0x24')]({'plain':!![]});if(!_0x12b0e1)throw new Error(_0xf997('0x50'));if(_0x12b0e1[_0xf997('0x51')]===_0xf997('0x4f')){var _0x42cd48=_0x52fd5f['get']({'plain':!![]});return db['UserProfileSection'][_0xf997('0x47')]({'where':{'name':_0xf997('0x52'),'userProfileId':_0x12b0e1[_0xf997('0x53')]},'raw':!![]})[_0xf997('0x22')](function(_0x49a9a8){if(_0x49a9a8&&_0x49a9a8[_0xf997('0x54')]===0x0){return db[_0xf997('0x25')][_0xf997('0x48')]({'name':_0x42cd48[_0xf997('0x28')],'resourceId':_0x42cd48['id'],'type':_0x49a9a8[_0xf997('0x28')],'sectionId':_0x49a9a8['id']},{})[_0xf997('0x22')](function(){return _0x52fd5f;});}else{return _0x52fd5f;}})['catch'](function(_0x29204b){logger[_0xf997('0x26')](_0xf997('0x55'),_0x29204b);throw _0x29204b;});}return _0x52fd5f;})[_0xf997('0x22')](respondWithResult(_0x12c72,0xc9))[_0xf997('0x42')](handleError(_0x12c72,null));}; \ No newline at end of file +var _0xba5e=['VIRTUAL','filter','includeAll','include','rows','catch','show','params','options','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','path','ejs','fs-extra','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','UserProfileResource','stack','name','index','map','CannedAnswer','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','pick','merge','where'];(function(_0x1d2157,_0x48382d){var _0x41fa1f=function(_0x39cc04){while(--_0x39cc04){_0x1d2157['push'](_0x1d2157['shift']());}};_0x41fa1f(++_0x48382d);}(_0xba5e,0xc3));var _0xeba5=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xba5e[_0x46e363];return _0x3fb059;};'use strict';var pdf=require(_0xeba5('0x0'));var emlformat=require(_0xeba5('0x1'));var rimraf=require(_0xeba5('0x2'));var zipdir=require(_0xeba5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeba5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeba5('0x5'));var util=require('util');var path=require(_0xeba5('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeba5('0x7'));var fs=require('fs');var fs_extra=require(_0xeba5('0x8'));var _=require('lodash');var squel=require(_0xeba5('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xeba5('0xa'));var toCsv=require(_0xeba5('0xb'));var querystring=require(_0xeba5('0xc'));var Papa=require(_0xeba5('0xd'));var Redis=require('ioredis');var authService=require(_0xeba5('0xe'));var qs=require(_0xeba5('0xf'));var as=require(_0xeba5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xeba5('0x11'));var config=require(_0xeba5('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xeba5('0x13'))['db'];function respondWithStatusCode(_0x32176d,_0x5c280f){_0x5c280f=_0x5c280f||0xcc;return function(_0x134362){if(_0x134362){return _0x32176d[_0xeba5('0x14')](_0x5c280f);}return _0x32176d[_0xeba5('0x15')](_0x5c280f)[_0xeba5('0x16')]();};}function respondWithResult(_0x11998e,_0x1c5eab){_0x1c5eab=_0x1c5eab||0xc8;return function(_0x4c3558){if(_0x4c3558){return _0x11998e[_0xeba5('0x15')](_0x1c5eab)['json'](_0x4c3558);}};}function respondWithFilteredResult(_0x364380,_0x4f1f91){return function(_0x3d555d){if(_0x3d555d){var _0x3d4052=_0x3d555d[_0xeba5('0x17')],_0x5aff2a=_0x4f1f91[_0xeba5('0x18')],_0x5ddf1b=_0x4f1f91[_0xeba5('0x18')]+_0x4f1f91[_0xeba5('0x19')],_0x1cebaa;if(_0x5ddf1b>=_0x3d4052){_0x5ddf1b=_0x3d4052;_0x1cebaa=0xc8;}else{_0x1cebaa=0xce;}_0x364380[_0xeba5('0x15')](_0x1cebaa);return _0x364380[_0xeba5('0x1a')](_0xeba5('0x1b'),_0x5aff2a+'-'+_0x5ddf1b+'/'+_0x3d4052)[_0xeba5('0x1c')](_0x3d555d);}return null;};}function patchUpdates(_0x1c968b){return function(_0x29199d){try{jsonpatch['apply'](_0x29199d,_0x1c968b,!![]);}catch(_0x1e8dd2){return BPromise[_0xeba5('0x1d')](_0x1e8dd2);}return _0x29199d[_0xeba5('0x1e')]();};}function saveUpdates(_0x591ec8,_0x47cdcb){return function(_0x27aa5e){if(_0x27aa5e){return _0x27aa5e[_0xeba5('0x1f')](_0x591ec8)[_0xeba5('0x20')](function(_0x31e41d){return _0x31e41d;});}return null;};}function removeEntity(_0x4f1506,_0x53e69c){return function(_0x301548){if(_0x301548){return _0x301548[_0xeba5('0x21')]()[_0xeba5('0x20')](function(){var _0xa482ec=_0x301548['get']({'plain':!![]});var _0x4b50d9='CannedAnswers';return db[_0xeba5('0x22')][_0xeba5('0x21')]({'where':{'type':_0x4b50d9,'resourceId':_0xa482ec['id']}})['then'](function(){return _0x301548;});})[_0xeba5('0x20')](function(){_0x4f1506[_0xeba5('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55a580,_0x466cd8){return function(_0x28c65e){if(!_0x28c65e){_0x55a580[_0xeba5('0x14')](0x194);}return _0x28c65e;};}function handleError(_0x19b654,_0x3329b8){_0x3329b8=_0x3329b8||0x1f4;return function(_0x2efe01){logger['error'](_0x2efe01[_0xeba5('0x23')]);if(_0x2efe01[_0xeba5('0x24')]){delete _0x2efe01[_0xeba5('0x24')];}_0x19b654[_0xeba5('0x15')](_0x3329b8)['send'](_0x2efe01);};}exports[_0xeba5('0x25')]=function(_0x5a456e,_0x3fa613){var _0x3a2cc7={},_0x1299ae={},_0x3c7568={'count':0x0,'rows':[]};var _0x133462=_[_0xeba5('0x26')](db[_0xeba5('0x27')][_0xeba5('0x28')],function(_0x26c929){return{'name':_0x26c929['fieldName'],'type':_0x26c929[_0xeba5('0x29')][_0xeba5('0x2a')]};});_0x1299ae[_0xeba5('0x2b')]=_[_0xeba5('0x26')](_0x133462,_0xeba5('0x24'));_0x1299ae['query']=_[_0xeba5('0x2c')](_0x5a456e[_0xeba5('0x2d')]);_0x1299ae[_0xeba5('0x2e')]=_['intersection'](_0x1299ae['model'],_0x1299ae[_0xeba5('0x2d')]);_0x3a2cc7[_0xeba5('0x2f')]=_[_0xeba5('0x30')](_0x1299ae[_0xeba5('0x2b')],qs[_0xeba5('0x31')](_0x5a456e['query'][_0xeba5('0x31')]));_0x3a2cc7[_0xeba5('0x2f')]=_0x3a2cc7[_0xeba5('0x2f')][_0xeba5('0x32')]?_0x3a2cc7[_0xeba5('0x2f')]:_0x1299ae[_0xeba5('0x2b')];if(!_0x5a456e['query'][_0xeba5('0x33')](_0xeba5('0x34'))){_0x3a2cc7[_0xeba5('0x19')]=qs[_0xeba5('0x19')](_0x5a456e['query'][_0xeba5('0x19')]);_0x3a2cc7[_0xeba5('0x18')]=qs[_0xeba5('0x18')](_0x5a456e['query']['offset']);}_0x3a2cc7[_0xeba5('0x35')]=qs['sort'](_0x5a456e[_0xeba5('0x2d')]['sort']);_0x3a2cc7['where']=qs[_0xeba5('0x2e')](_[_0xeba5('0x36')](_0x5a456e[_0xeba5('0x2d')],_0x1299ae['filters']),_0x133462);if(_0x5a456e[_0xeba5('0x2d')]['filter']){_0x3a2cc7['where']=_[_0xeba5('0x37')](_0x3a2cc7[_0xeba5('0x38')],{'$or':_[_0xeba5('0x26')](_0x133462,function(_0x1a3615){if(_0x1a3615[_0xeba5('0x29')]!==_0xeba5('0x39')){var _0x2868b1={};_0x2868b1[_0x1a3615[_0xeba5('0x24')]]={'$like':'%'+_0x5a456e['query'][_0xeba5('0x3a')]+'%'};return _0x2868b1;}})});}_0x3a2cc7=_[_0xeba5('0x37')]({},_0x3a2cc7,_0x5a456e['options']);var _0x653119={'where':_0x3a2cc7[_0xeba5('0x38')]};return db[_0xeba5('0x27')][_0xeba5('0x17')](_0x653119)[_0xeba5('0x20')](function(_0x1d1ae6){_0x3c7568['count']=_0x1d1ae6;if(_0x5a456e[_0xeba5('0x2d')][_0xeba5('0x3b')]){_0x3a2cc7[_0xeba5('0x3c')]=[{'all':!![]}];}return db[_0xeba5('0x27')]['findAll'](_0x3a2cc7);})[_0xeba5('0x20')](function(_0x1ce066){_0x3c7568[_0xeba5('0x3d')]=_0x1ce066;return _0x3c7568;})[_0xeba5('0x20')](respondWithFilteredResult(_0x3fa613,_0x3a2cc7))[_0xeba5('0x3e')](handleError(_0x3fa613,null));};exports[_0xeba5('0x3f')]=function(_0x4b8bd8,_0x43e7c1){var _0x495b1e={'raw':!![],'where':{'id':_0x4b8bd8[_0xeba5('0x40')]['id']}},_0xf9c2bd={};_0xf9c2bd[_0xeba5('0x2b')]=_[_0xeba5('0x2c')](db['CannedAnswer']['rawAttributes']);_0xf9c2bd[_0xeba5('0x2d')]=_[_0xeba5('0x2c')](_0x4b8bd8[_0xeba5('0x2d')]);_0xf9c2bd[_0xeba5('0x2e')]=_[_0xeba5('0x30')](_0xf9c2bd[_0xeba5('0x2b')],_0xf9c2bd[_0xeba5('0x2d')]);_0x495b1e[_0xeba5('0x2f')]=_['intersection'](_0xf9c2bd[_0xeba5('0x2b')],qs[_0xeba5('0x31')](_0x4b8bd8[_0xeba5('0x2d')][_0xeba5('0x31')]));_0x495b1e['attributes']=_0x495b1e[_0xeba5('0x2f')][_0xeba5('0x32')]?_0x495b1e[_0xeba5('0x2f')]:_0xf9c2bd[_0xeba5('0x2b')];if(_0x4b8bd8[_0xeba5('0x2d')]['includeAll']){_0x495b1e[_0xeba5('0x3c')]=[{'all':!![]}];}_0x495b1e=_[_0xeba5('0x37')]({},_0x495b1e,_0x4b8bd8[_0xeba5('0x41')]);return db[_0xeba5('0x27')][_0xeba5('0x42')](_0x495b1e)['then'](handleEntityNotFound(_0x43e7c1,null))[_0xeba5('0x20')](respondWithResult(_0x43e7c1,null))[_0xeba5('0x3e')](handleError(_0x43e7c1,null));};exports['update']=function(_0x5b6805,_0x51d284){if(_0x5b6805[_0xeba5('0x43')]['id']){delete _0x5b6805[_0xeba5('0x43')]['id'];}return db[_0xeba5('0x27')][_0xeba5('0x42')]({'where':{'id':_0x5b6805['params']['id']}})[_0xeba5('0x20')](handleEntityNotFound(_0x51d284,null))['then'](saveUpdates(_0x5b6805[_0xeba5('0x43')],null))[_0xeba5('0x20')](respondWithResult(_0x51d284,null))[_0xeba5('0x3e')](handleError(_0x51d284,null));};exports['destroy']=function(_0x2e04da,_0x32e719){return db[_0xeba5('0x27')]['find']({'where':{'id':_0x2e04da[_0xeba5('0x40')]['id']}})[_0xeba5('0x20')](handleEntityNotFound(_0x32e719,null))[_0xeba5('0x20')](removeEntity(_0x32e719,null))[_0xeba5('0x3e')](handleError(_0x32e719,null));};exports['create']=function(_0x240d12,_0x305017){var _0x5118ce={'key':_0x240d12[_0xeba5('0x43')][_0xeba5('0x2a')]};if(_0x240d12[_0xeba5('0x43')]['MailAccountId']){_0x5118ce[_0xeba5('0x44')]=_0x240d12['body'][_0xeba5('0x44')];}else if(_0x240d12[_0xeba5('0x43')][_0xeba5('0x45')]){_0x5118ce[_0xeba5('0x45')]=_0x240d12[_0xeba5('0x43')]['SmsAccountId'];}else if(_0x240d12[_0xeba5('0x43')]['OpenchannelAccountId']){_0x5118ce['OpenchannelAccountId']=_0x240d12[_0xeba5('0x43')][_0xeba5('0x46')];}else if(_0x240d12[_0xeba5('0x43')][_0xeba5('0x47')]){_0x5118ce[_0xeba5('0x47')]=_0x240d12[_0xeba5('0x43')]['ChatWebsiteId'];}return db[_0xeba5('0x27')]['find']({'where':_0x5118ce})['then'](function(_0x1b1573){if(_0x1b1573){throw new db['Sequelize'][(_0xeba5('0x48'))](_0xeba5('0x49'));}return db[_0xeba5('0x27')][_0xeba5('0x4a')](_0x240d12[_0xeba5('0x43')]);})[_0xeba5('0x20')](function(_0x4ea253){var _0x9e91fe=_0x240d12[_0xeba5('0x4b')][_0xeba5('0x4c')]({'plain':!![]});if(!_0x9e91fe)throw new Error(_0xeba5('0x4d'));if(_0x9e91fe['role']===_0xeba5('0x4b')){var _0x5e1126=_0x4ea253[_0xeba5('0x4c')]({'plain':!![]});return db[_0xeba5('0x4e')][_0xeba5('0x42')]({'where':{'name':_0xeba5('0x4f'),'userProfileId':_0x9e91fe[_0xeba5('0x50')]},'raw':!![]})[_0xeba5('0x20')](function(_0x18691c){if(_0x18691c&&_0x18691c[_0xeba5('0x51')]===0x0){return db[_0xeba5('0x22')]['create']({'name':_0x5e1126[_0xeba5('0x24')],'resourceId':_0x5e1126['id'],'type':_0x18691c[_0xeba5('0x24')],'sectionId':_0x18691c['id']},{})[_0xeba5('0x20')](function(){return _0x4ea253;});}else{return _0x4ea253;}})['catch'](function(_0x409249){logger[_0xeba5('0x52')](_0xeba5('0x53'),_0x409249);throw _0x409249;});}return _0x4ea253;})['then'](respondWithResult(_0x305017,0xc9))[_0xeba5('0x3e')](handleError(_0x305017,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index c63faab..a76fba5 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 _0xfd65=['exports','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','api','moment','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes'];(function(_0x1a1310,_0x3c17eb){var _0x5b9a44=function(_0xd4622b){while(--_0xd4622b){_0x1a1310['push'](_0x1a1310['shift']());}};_0x5b9a44(++_0x3c17eb);}(_0xfd65,0x13d));var _0x5fd6=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xfd65[_0x255d5b];return _0x3e141a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x5fd6('0x0'));var moment=require(_0x5fd6('0x1'));var BPromise=require('bluebird');var rp=require(_0x5fd6('0x2'));var fs=require('fs');var path=require(_0x5fd6('0x3'));var rimraf=require(_0x5fd6('0x4'));var config=require(_0x5fd6('0x5'));var attributes=require(_0x5fd6('0x6'));module[_0x5fd6('0x7')]=function(_0x2daf43,_0x4865ee){return _0x2daf43['define'](_0x5fd6('0x8'),attributes,{'tableName':_0x5fd6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5fd6('0xa'),'collate':_0x5fd6('0xb')});}; \ No newline at end of file +var _0x44f4=['path','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird'];(function(_0x17575b,_0x1d7af7){var _0x5b6f87=function(_0x42e06){while(--_0x42e06){_0x17575b['push'](_0x17575b['shift']());}};_0x5b6f87(++_0x1d7af7);}(_0x44f4,0x140));var _0x444f=function(_0x416ea4,_0x54dd8b){_0x416ea4=_0x416ea4-0x0;var _0x15a849=_0x44f4[_0x416ea4];return _0x15a849;};'use strict';var _=require(_0x444f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x444f('0x1'));var moment=require(_0x444f('0x2'));var BPromise=require(_0x444f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x444f('0x4'));var rimraf=require('rimraf');var config=require(_0x444f('0x5'));var attributes=require(_0x444f('0x6'));module[_0x444f('0x7')]=function(_0x46dac6,_0x2588d9){return _0x46dac6[_0x444f('0x8')](_0x444f('0x9'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x444f('0xa'),'collate':_0x444f('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index bd94ede..1d1925f 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 _0x8510=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x21b36c,_0x543483){var _0x236627=function(_0x174f99){while(--_0x174f99){_0x21b36c['push'](_0x21b36c['shift']());}};_0x236627(++_0x543483);}(_0x8510,0x1c7));var _0x0851=function(_0x5db928,_0x113065){_0x5db928=_0x5db928-0x0;var _0x4b9e2c=_0x8510[_0x5db928];return _0x4b9e2c;};'use strict';var _=require(_0x0851('0x0'));var util=require(_0x0851('0x1'));var moment=require(_0x0851('0x2'));var BPromise=require(_0x0851('0x3'));var rs=require(_0x0851('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0851('0x5'));var logger=require(_0x0851('0x6'))('rpc');var config=require(_0x0851('0x7'));var jayson=require(_0x0851('0x8'));var client=jayson[_0x0851('0x9')][_0x0851('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xad5ba2,_0x5bf3ec,_0xca56d1){return new BPromise(function(_0x137ff2,_0x47dc2e){return client[_0x0851('0xb')](_0xad5ba2,_0xca56d1)[_0x0851('0xc')](function(_0xda092){logger[_0x0851('0xd')](_0x0851('0xe'),_0x5bf3ec,_0x0851('0xf'));logger[_0x0851('0x10')](_0x0851('0x11'),_0x5bf3ec,_0x0851('0xf'),JSON[_0x0851('0x12')](_0xda092));if(_0xda092[_0x0851('0x13')]){if(_0xda092[_0x0851('0x13')][_0x0851('0x14')]===0x1f4){logger[_0x0851('0x13')](_0x0851('0xe'),_0x5bf3ec,_0xda092['error']['message']);return _0x47dc2e(_0xda092['error']['message']);}logger[_0x0851('0x13')](_0x0851('0xe'),_0x5bf3ec,_0xda092[_0x0851('0x13')]['message']);return _0x137ff2(_0xda092[_0x0851('0x13')][_0x0851('0x15')]);}else{logger['info'](_0x0851('0xe'),_0x5bf3ec,_0x0851('0xf'));_0x137ff2(_0xda092[_0x0851('0x16')]['message']);}})[_0x0851('0x17')](function(_0x58d490){logger[_0x0851('0x13')](_0x0851('0xe'),_0x5bf3ec,_0x58d490);_0x47dc2e(_0x58d490);});});} \ No newline at end of file +var _0x8830=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x23ba2a,_0x516b14){var _0x3eca4a=function(_0x5df423){while(--_0x5df423){_0x23ba2a['push'](_0x23ba2a['shift']());}};_0x3eca4a(++_0x516b14);}(_0x8830,0x19f));var _0x0883=function(_0x4ff703,_0x184ccb){_0x4ff703=_0x4ff703-0x0;var _0x50b0c5=_0x8830[_0x4ff703];return _0x50b0c5;};'use strict';var _=require(_0x0883('0x0'));var util=require(_0x0883('0x1'));var moment=require(_0x0883('0x2'));var BPromise=require(_0x0883('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0883('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0883('0x5'));var logger=require(_0x0883('0x6'))(_0x0883('0x7'));var config=require(_0x0883('0x8'));var jayson=require(_0x0883('0x9'));var client=jayson[_0x0883('0xa')][_0x0883('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3cd98e,_0x495cf7,_0x2ecb7d){return new BPromise(function(_0x11dbb0,_0x1e4db9){return client['request'](_0x3cd98e,_0x2ecb7d)[_0x0883('0xc')](function(_0x5903e5){logger[_0x0883('0xd')](_0x0883('0xe'),_0x495cf7,_0x0883('0xf'));logger[_0x0883('0x10')]('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x495cf7,_0x0883('0xf'),JSON[_0x0883('0x11')](_0x5903e5));if(_0x5903e5[_0x0883('0x12')]){if(_0x5903e5[_0x0883('0x12')]['code']===0x1f4){logger['error']('CannedAnswer,\x20%s,\x20%s',_0x495cf7,_0x5903e5[_0x0883('0x12')][_0x0883('0x13')]);return _0x1e4db9(_0x5903e5[_0x0883('0x12')][_0x0883('0x13')]);}logger[_0x0883('0x12')](_0x0883('0xe'),_0x495cf7,_0x5903e5[_0x0883('0x12')][_0x0883('0x13')]);return _0x11dbb0(_0x5903e5[_0x0883('0x12')][_0x0883('0x13')]);}else{logger[_0x0883('0xd')](_0x0883('0xe'),_0x495cf7,_0x0883('0xf'));_0x11dbb0(_0x5903e5[_0x0883('0x14')][_0x0883('0x13')]);}})[_0x0883('0x15')](function(_0x50e151){logger[_0x0883('0x12')](_0x0883('0xe'),_0x495cf7,_0x50e151);_0x1e4db9(_0x50e151);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 7759901..e01d448 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 _0xf72a=['update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post'];(function(_0x2deac4,_0xc27a2b){var _0x1c0bda=function(_0x1deceb){while(--_0x1deceb){_0x2deac4['push'](_0x2deac4['shift']());}};_0x1c0bda(++_0xc27a2b);}(_0xf72a,0xcf));var _0xaf72=function(_0x4d51e0,_0xfebc68){_0x4d51e0=_0x4d51e0-0x0;var _0x63cd5f=_0xf72a[_0x4d51e0];return _0x63cd5f;};'use strict';var multer=require('multer');var util=require(_0xaf72('0x0'));var path=require(_0xaf72('0x1'));var timeout=require(_0xaf72('0x2'));var express=require(_0xaf72('0x3'));var router=express[_0xaf72('0x4')]();var fs_extra=require(_0xaf72('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xaf72('0x6'));var config=require(_0xaf72('0x7'));var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0xaf72('0x8')](),controller[_0xaf72('0x9')]);router[_0xaf72('0xa')](_0xaf72('0xb'),auth[_0xaf72('0x8')](),controller[_0xaf72('0xc')]);router[_0xaf72('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xaf72('0xe')]);router['delete'](_0xaf72('0xb'),auth[_0xaf72('0x8')](),controller[_0xaf72('0xf')]);module[_0xaf72('0x10')]=router; \ No newline at end of file +var _0xce30=['post','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xce30,0xb1));var _0x0ce3=function(_0x385b04,_0x2ce85e){_0x385b04=_0x385b04-0x0;var _0x21ec67=_0xce30[_0x385b04];return _0x21ec67;};'use strict';var multer=require(_0x0ce3('0x0'));var util=require(_0x0ce3('0x1'));var path=require(_0x0ce3('0x2'));var timeout=require(_0x0ce3('0x3'));var express=require('express');var router=express[_0x0ce3('0x4')]();var fs_extra=require(_0x0ce3('0x5'));var auth=require(_0x0ce3('0x6'));var interaction=require(_0x0ce3('0x7'));var config=require(_0x0ce3('0x8'));var controller=require(_0x0ce3('0x9'));router[_0x0ce3('0xa')]('/',auth[_0x0ce3('0xb')](),controller[_0x0ce3('0xc')]);router[_0x0ce3('0xa')]('/:id',auth[_0x0ce3('0xb')](),controller['show']);router[_0x0ce3('0xd')]('/',auth[_0x0ce3('0xb')](),controller['create']);router[_0x0ce3('0xe')](_0x0ce3('0xf'),auth[_0x0ce3('0xb')](),controller[_0x0ce3('0x10')]);router['delete']('/:id',auth[_0x0ce3('0xb')](),controller[_0x0ce3('0x11')]);module[_0x0ce3('0x12')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index cb05eb0..3c7705e 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 _0x4a4e=['STRING','INTEGER','sequelize','exports'];(function(_0x5188f9,_0x2aa889){var _0x332f7b=function(_0x285c46){while(--_0x285c46){_0x5188f9['push'](_0x5188f9['shift']());}};_0x332f7b(++_0x2aa889);}(_0x4a4e,0x82));var _0xe4a4=function(_0x8dc04d,_0xaa7559){_0x8dc04d=_0x8dc04d-0x0;var _0x2f5f28=_0x4a4e[_0x8dc04d];return _0x2f5f28;};'use strict';var Sequelize=require(_0xe4a4('0x0'));module[_0xe4a4('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xe4a4('0x2')]},'src':{'type':Sequelize[_0xe4a4('0x2')]},'dst':{'type':Sequelize[_0xe4a4('0x2')]},'dcontext':{'type':Sequelize[_0xe4a4('0x2')]},'channel':{'type':Sequelize[_0xe4a4('0x2')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0xe4a4('0x2')]},'lastdata':{'type':Sequelize[_0xe4a4('0x2')]},'duration':{'type':Sequelize[_0xe4a4('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xe4a4('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe4a4('0x2')]},'amaflags':{'type':Sequelize[_0xe4a4('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xe4a4('0x2')]},'userfield':{'type':Sequelize[_0xe4a4('0x2')]},'uniqueid':{'type':Sequelize[_0xe4a4('0x2')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xe4a4('0x2')]},'peeraccount':{'type':Sequelize[_0xe4a4('0x2')]},'type':{'type':Sequelize[_0xe4a4('0x2')]},'tag':{'type':Sequelize[_0xe4a4('0x2')]}}; \ No newline at end of file +var _0xe091=['INTEGER','sequelize','exports','1970-01-01\x2000:00:01','STRING'];(function(_0x32def5,_0x7b0168){var _0xd0c4e1=function(_0x9ac90){while(--_0x9ac90){_0x32def5['push'](_0x32def5['shift']());}};_0xd0c4e1(++_0x7b0168);}(_0xe091,0x119));var _0x1e09=function(_0x33c228,_0x5dd746){_0x33c228=_0x33c228-0x0;var _0x4cc4b8=_0xe091[_0x33c228];return _0x4cc4b8;};'use strict';var Sequelize=require(_0x1e09('0x0'));module[_0x1e09('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x1e09('0x2')},'clid':{'type':Sequelize[_0x1e09('0x3')]},'src':{'type':Sequelize[_0x1e09('0x3')]},'dst':{'type':Sequelize[_0x1e09('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x1e09('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x1e09('0x3')]},'lastdata':{'type':Sequelize[_0x1e09('0x3')]},'duration':{'type':Sequelize[_0x1e09('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x1e09('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x1e09('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x1e09('0x3')]},'linkedid':{'type':Sequelize[_0x1e09('0x3')]},'sequence':{'type':Sequelize[_0x1e09('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x1e09('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 93b0e06..171c2ea 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 _0x3a9d=['../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','set','apply','reject','save','update','destroy','then','error','name','send','rawAttributes','fieldName','key','model','query','filters','attributes','fields','hasOwnProperty','offset','order','sort','pick','where','merge','map','type','VIRTUAL','filter','Cdr','count','includeAll','include','findAll','rows','show','params','keys','intersection','length','options','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils'];(function(_0x328ad4,_0x2e9045){var _0x292ea6=function(_0x2b3125){while(--_0x2b3125){_0x328ad4['push'](_0x328ad4['shift']());}};_0x292ea6(++_0x2e9045);}(_0x3a9d,0x1a7));var _0xd3a9=function(_0x2d0c33,_0x2b22cf){_0x2d0c33=_0x2d0c33-0x0;var _0x50f706=_0x3a9d[_0x2d0c33];return _0x50f706;};'use strict';var pdf=require(_0xd3a9('0x0'));var emlformat=require(_0xd3a9('0x1'));var rimraf=require(_0xd3a9('0x2'));var zipdir=require(_0xd3a9('0x3'));var jsonpatch=require(_0xd3a9('0x4'));var rp=require('request-promise');var moment=require(_0xd3a9('0x5'));var BPromise=require(_0xd3a9('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd3a9('0x7'));var sox=require(_0xd3a9('0x8'));var csv=require('to-csv');var ejs=require(_0xd3a9('0x9'));var fs=require('fs');var fs_extra=require(_0xd3a9('0xa'));var _=require(_0xd3a9('0xb'));var squel=require(_0xd3a9('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd3a9('0xd'));var querystring=require('querystring');var Papa=require(_0xd3a9('0xe'));var Redis=require(_0xd3a9('0xf'));var authService=require(_0xd3a9('0x10'));var qs=require(_0xd3a9('0x11'));var as=require(_0xd3a9('0x12'));var hardwareService=require(_0xd3a9('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xd3a9('0x14'));var config=require(_0xd3a9('0x15'));var licenseUtil=require(_0xd3a9('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ba248,_0x5187b2){_0x5187b2=_0x5187b2||0xcc;return function(_0x2c2d92){if(_0x2c2d92){return _0x2ba248[_0xd3a9('0x17')](_0x5187b2);}return _0x2ba248[_0xd3a9('0x18')](_0x5187b2)[_0xd3a9('0x19')]();};}function respondWithResult(_0x500296,_0x3bdf5b){_0x3bdf5b=_0x3bdf5b||0xc8;return function(_0x1d0951){if(_0x1d0951){return _0x500296[_0xd3a9('0x18')](_0x3bdf5b)[_0xd3a9('0x1a')](_0x1d0951);}};}function respondWithFilteredResult(_0x2f4767,_0x44dc68){return function(_0xc81a9d){if(_0xc81a9d){var _0x503d0a=_0xc81a9d['count'],_0x4bb5b0=_0x44dc68['offset'],_0x21b795=_0x44dc68['offset']+_0x44dc68[_0xd3a9('0x1b')],_0xb582db;if(_0x21b795>=_0x503d0a){_0x21b795=_0x503d0a;_0xb582db=0xc8;}else{_0xb582db=0xce;}_0x2f4767[_0xd3a9('0x18')](_0xb582db);return _0x2f4767[_0xd3a9('0x1c')]('Content-Range',_0x4bb5b0+'-'+_0x21b795+'/'+_0x503d0a)['json'](_0xc81a9d);}return null;};}function patchUpdates(_0x504d0e){return function(_0x36461f){try{jsonpatch[_0xd3a9('0x1d')](_0x36461f,_0x504d0e,!![]);}catch(_0xcef32f){return BPromise[_0xd3a9('0x1e')](_0xcef32f);}return _0x36461f[_0xd3a9('0x1f')]();};}function saveUpdates(_0x2fce26,_0x3b1c44){return function(_0x11cb49){if(_0x11cb49){return _0x11cb49[_0xd3a9('0x20')](_0x2fce26)['then'](function(_0x34ff07){return _0x34ff07;});}return null;};}function removeEntity(_0xa97486,_0x4606ea){return function(_0x18bec4){if(_0x18bec4){return _0x18bec4[_0xd3a9('0x21')]()[_0xd3a9('0x22')](function(){_0xa97486[_0xd3a9('0x18')](0xcc)[_0xd3a9('0x19')]();});}};}function handleEntityNotFound(_0x24ab6e,_0x2f7dbf){return function(_0x2c1006){if(!_0x2c1006){_0x24ab6e[_0xd3a9('0x17')](0x194);}return _0x2c1006;};}function handleError(_0x472292,_0x735223){_0x735223=_0x735223||0x1f4;return function(_0x42e0cd){logger[_0xd3a9('0x23')](_0x42e0cd['stack']);if(_0x42e0cd[_0xd3a9('0x24')]){delete _0x42e0cd['name'];}_0x472292['status'](_0x735223)[_0xd3a9('0x25')](_0x42e0cd);};}exports['index']=function(_0x37851f,_0x3c3fa9){var _0x5c242b={},_0x4c7efa={},_0x384901={'count':0x0,'rows':[]};var _0x968bc1=_['map'](db['Cdr'][_0xd3a9('0x26')],function(_0x445878){return{'name':_0x445878[_0xd3a9('0x27')],'type':_0x445878['type'][_0xd3a9('0x28')]};});_0x4c7efa[_0xd3a9('0x29')]=_['map'](_0x968bc1,'name');_0x4c7efa[_0xd3a9('0x2a')]=_['keys'](_0x37851f[_0xd3a9('0x2a')]);_0x4c7efa[_0xd3a9('0x2b')]=_['intersection'](_0x4c7efa[_0xd3a9('0x29')],_0x4c7efa[_0xd3a9('0x2a')]);_0x5c242b[_0xd3a9('0x2c')]=_['intersection'](_0x4c7efa[_0xd3a9('0x29')],qs[_0xd3a9('0x2d')](_0x37851f[_0xd3a9('0x2a')]['fields']));_0x5c242b[_0xd3a9('0x2c')]=_0x5c242b[_0xd3a9('0x2c')]['length']?_0x5c242b[_0xd3a9('0x2c')]:_0x4c7efa['model'];if(!_0x37851f[_0xd3a9('0x2a')][_0xd3a9('0x2e')]('nolimit')){_0x5c242b[_0xd3a9('0x1b')]=qs['limit'](_0x37851f[_0xd3a9('0x2a')][_0xd3a9('0x1b')]);_0x5c242b[_0xd3a9('0x2f')]=qs[_0xd3a9('0x2f')](_0x37851f['query'][_0xd3a9('0x2f')]);}_0x5c242b[_0xd3a9('0x30')]=qs['sort'](_0x37851f[_0xd3a9('0x2a')][_0xd3a9('0x31')]);_0x5c242b['where']=qs[_0xd3a9('0x2b')](_[_0xd3a9('0x32')](_0x37851f['query'],_0x4c7efa['filters']),_0x968bc1);if(_0x37851f[_0xd3a9('0x2a')]['filter']){_0x5c242b[_0xd3a9('0x33')]=_[_0xd3a9('0x34')](_0x5c242b[_0xd3a9('0x33')],{'$or':_[_0xd3a9('0x35')](_0x968bc1,function(_0x5303ff){if(_0x5303ff[_0xd3a9('0x36')]!==_0xd3a9('0x37')){var _0x5584a2={};_0x5584a2[_0x5303ff[_0xd3a9('0x24')]]={'$like':'%'+_0x37851f[_0xd3a9('0x2a')][_0xd3a9('0x38')]+'%'};return _0x5584a2;}})});}_0x5c242b=_[_0xd3a9('0x34')]({},_0x5c242b,_0x37851f['options']);var _0x159adb={'where':_0x5c242b[_0xd3a9('0x33')]};return db[_0xd3a9('0x39')][_0xd3a9('0x3a')](_0x159adb)[_0xd3a9('0x22')](function(_0x267e2b){_0x384901['count']=_0x267e2b;if(_0x37851f[_0xd3a9('0x2a')][_0xd3a9('0x3b')]){_0x5c242b[_0xd3a9('0x3c')]=[{'all':!![]}];}return db[_0xd3a9('0x39')][_0xd3a9('0x3d')](_0x5c242b);})['then'](function(_0x4652cb){_0x384901[_0xd3a9('0x3e')]=_0x4652cb;return _0x384901;})['then'](respondWithFilteredResult(_0x3c3fa9,_0x5c242b))['catch'](handleError(_0x3c3fa9,null));};exports[_0xd3a9('0x3f')]=function(_0x29ca11,_0x51f704){var _0x5396f5={'raw':!![],'where':{'id':_0x29ca11[_0xd3a9('0x40')]['id']}},_0x2eb2c2={};_0x2eb2c2['model']=_['keys'](db[_0xd3a9('0x39')][_0xd3a9('0x26')]);_0x2eb2c2[_0xd3a9('0x2a')]=_[_0xd3a9('0x41')](_0x29ca11[_0xd3a9('0x2a')]);_0x2eb2c2[_0xd3a9('0x2b')]=_[_0xd3a9('0x42')](_0x2eb2c2[_0xd3a9('0x29')],_0x2eb2c2[_0xd3a9('0x2a')]);_0x5396f5['attributes']=_['intersection'](_0x2eb2c2[_0xd3a9('0x29')],qs[_0xd3a9('0x2d')](_0x29ca11[_0xd3a9('0x2a')]['fields']));_0x5396f5[_0xd3a9('0x2c')]=_0x5396f5[_0xd3a9('0x2c')][_0xd3a9('0x43')]?_0x5396f5['attributes']:_0x2eb2c2[_0xd3a9('0x29')];if(_0x29ca11[_0xd3a9('0x2a')]['includeAll']){_0x5396f5[_0xd3a9('0x3c')]=[{'all':!![]}];}_0x5396f5=_[_0xd3a9('0x34')]({},_0x5396f5,_0x29ca11[_0xd3a9('0x44')]);return db['Cdr'][_0xd3a9('0x45')](_0x5396f5)['then'](handleEntityNotFound(_0x51f704,null))[_0xd3a9('0x22')](respondWithResult(_0x51f704,null))[_0xd3a9('0x46')](handleError(_0x51f704,null));};exports['create']=function(_0x191c2f,_0x2068a2){return db[_0xd3a9('0x39')][_0xd3a9('0x47')](_0x191c2f[_0xd3a9('0x48')],{})[_0xd3a9('0x22')](respondWithResult(_0x2068a2,0xc9))[_0xd3a9('0x46')](handleError(_0x2068a2,null));};exports[_0xd3a9('0x20')]=function(_0x4a6ecf,_0x430f06){if(_0x4a6ecf[_0xd3a9('0x48')]['id']){delete _0x4a6ecf['body']['id'];}return db['Cdr'][_0xd3a9('0x45')]({'where':{'id':_0x4a6ecf[_0xd3a9('0x40')]['id']}})[_0xd3a9('0x22')](handleEntityNotFound(_0x430f06,null))[_0xd3a9('0x22')](saveUpdates(_0x4a6ecf[_0xd3a9('0x48')],null))[_0xd3a9('0x22')](respondWithResult(_0x430f06,null))[_0xd3a9('0x46')](handleError(_0x430f06,null));};exports[_0xd3a9('0x21')]=function(_0x23c23f,_0x272230){return db['Cdr'][_0xd3a9('0x45')]({'where':{'id':_0x23c23f['params']['id']}})[_0xd3a9('0x22')](handleEntityNotFound(_0x272230,null))[_0xd3a9('0x22')](removeEntity(_0x272230,null))[_0xd3a9('0x46')](handleError(_0x272230,null));};exports[_0xd3a9('0x49')]=function(_0x171997,_0x57f752){return db['Cdr'][_0xd3a9('0x49')]()[_0xd3a9('0x22')](respondWithResult(_0x57f752,null))[_0xd3a9('0x46')](handleError(_0x57f752,null));}; \ No newline at end of file +var _0x229a=['Content-Range','then','destroy','end','sendStatus','error','stack','name','send','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','Cdr','includeAll','rows','catch','show','create','body','update','find','params','describe','html-pdf','eml-format','zip-dir','request-promise','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set'];(function(_0x9e46a3,_0x3af63c){var _0x33cf58=function(_0x5e03d8){while(--_0x5e03d8){_0x9e46a3['push'](_0x9e46a3['shift']());}};_0x33cf58(++_0x3af63c);}(_0x229a,0x100));var _0xa229=function(_0x92624e,_0x3ad9e0){_0x92624e=_0x92624e-0x0;var _0x592713=_0x229a[_0x92624e];return _0x592713;};'use strict';var pdf=require(_0xa229('0x0'));var emlformat=require(_0xa229('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa229('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa229('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa229('0x4'));var path=require(_0xa229('0x5'));var sox=require(_0xa229('0x6'));var csv=require(_0xa229('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa229('0x8'));var _=require(_0xa229('0x9'));var squel=require(_0xa229('0xa'));var crypto=require(_0xa229('0xb'));var jsforce=require(_0xa229('0xc'));var deskjs=require(_0xa229('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa229('0xe'));var Papa=require(_0xa229('0xf'));var Redis=require(_0xa229('0x10'));var authService=require(_0xa229('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa229('0x12'));var hardwareService=require(_0xa229('0x13'));var logger=require(_0xa229('0x14'))(_0xa229('0x15'));var utils=require(_0xa229('0x16'));var config=require(_0xa229('0x17'));var licenseUtil=require(_0xa229('0x18'));var db=require(_0xa229('0x19'))['db'];function respondWithStatusCode(_0x9121f6,_0x3e2456){_0x3e2456=_0x3e2456||0xcc;return function(_0x5e01eb){if(_0x5e01eb){return _0x9121f6['sendStatus'](_0x3e2456);}return _0x9121f6[_0xa229('0x1a')](_0x3e2456)['end']();};}function respondWithResult(_0x36ff90,_0x123683){_0x123683=_0x123683||0xc8;return function(_0x3a5f7c){if(_0x3a5f7c){return _0x36ff90[_0xa229('0x1a')](_0x123683)[_0xa229('0x1b')](_0x3a5f7c);}};}function respondWithFilteredResult(_0x39a64b,_0x10251e){return function(_0x54b9be){if(_0x54b9be){var _0x1fd991=_0x54b9be[_0xa229('0x1c')],_0x1196a2=_0x10251e['offset'],_0x292695=_0x10251e[_0xa229('0x1d')]+_0x10251e[_0xa229('0x1e')],_0x26683c;if(_0x292695>=_0x1fd991){_0x292695=_0x1fd991;_0x26683c=0xc8;}else{_0x26683c=0xce;}_0x39a64b[_0xa229('0x1a')](_0x26683c);return _0x39a64b[_0xa229('0x1f')](_0xa229('0x20'),_0x1196a2+'-'+_0x292695+'/'+_0x1fd991)[_0xa229('0x1b')](_0x54b9be);}return null;};}function patchUpdates(_0xc466c){return function(_0x196f8c){try{jsonpatch['apply'](_0x196f8c,_0xc466c,!![]);}catch(_0x16063d){return BPromise['reject'](_0x16063d);}return _0x196f8c['save']();};}function saveUpdates(_0x5c15db,_0x492ac7){return function(_0x2b0b54){if(_0x2b0b54){return _0x2b0b54['update'](_0x5c15db)[_0xa229('0x21')](function(_0x58576e){return _0x58576e;});}return null;};}function removeEntity(_0x25cc12,_0xe2b5e5){return function(_0x326032){if(_0x326032){return _0x326032[_0xa229('0x22')]()[_0xa229('0x21')](function(){_0x25cc12[_0xa229('0x1a')](0xcc)[_0xa229('0x23')]();});}};}function handleEntityNotFound(_0xf4a33a,_0x51c784){return function(_0x2a63ae){if(!_0x2a63ae){_0xf4a33a[_0xa229('0x24')](0x194);}return _0x2a63ae;};}function handleError(_0x164e5a,_0x2e5720){_0x2e5720=_0x2e5720||0x1f4;return function(_0x55aeab){logger[_0xa229('0x25')](_0x55aeab[_0xa229('0x26')]);if(_0x55aeab[_0xa229('0x27')]){delete _0x55aeab[_0xa229('0x27')];}_0x164e5a[_0xa229('0x1a')](_0x2e5720)[_0xa229('0x28')](_0x55aeab);};}exports['index']=function(_0x561c22,_0x5eb528){var _0xedfa79={},_0x44a75b={},_0x235618={'count':0x0,'rows':[]};var _0x241478=_['map'](db['Cdr'][_0xa229('0x29')],function(_0x53bf97){return{'name':_0x53bf97[_0xa229('0x2a')],'type':_0x53bf97[_0xa229('0x2b')][_0xa229('0x2c')]};});_0x44a75b['model']=_['map'](_0x241478,'name');_0x44a75b[_0xa229('0x2d')]=_[_0xa229('0x2e')](_0x561c22[_0xa229('0x2d')]);_0x44a75b['filters']=_[_0xa229('0x2f')](_0x44a75b[_0xa229('0x30')],_0x44a75b['query']);_0xedfa79[_0xa229('0x31')]=_[_0xa229('0x2f')](_0x44a75b[_0xa229('0x30')],qs[_0xa229('0x32')](_0x561c22[_0xa229('0x2d')][_0xa229('0x32')]));_0xedfa79[_0xa229('0x31')]=_0xedfa79['attributes'][_0xa229('0x33')]?_0xedfa79[_0xa229('0x31')]:_0x44a75b[_0xa229('0x30')];if(!_0x561c22[_0xa229('0x2d')]['hasOwnProperty'](_0xa229('0x34'))){_0xedfa79[_0xa229('0x1e')]=qs[_0xa229('0x1e')](_0x561c22[_0xa229('0x2d')][_0xa229('0x1e')]);_0xedfa79[_0xa229('0x1d')]=qs[_0xa229('0x1d')](_0x561c22[_0xa229('0x2d')][_0xa229('0x1d')]);}_0xedfa79[_0xa229('0x35')]=qs['sort'](_0x561c22['query'][_0xa229('0x36')]);_0xedfa79['where']=qs[_0xa229('0x37')](_['pick'](_0x561c22['query'],_0x44a75b[_0xa229('0x37')]),_0x241478);if(_0x561c22[_0xa229('0x2d')][_0xa229('0x38')]){_0xedfa79[_0xa229('0x39')]=_[_0xa229('0x3a')](_0xedfa79[_0xa229('0x39')],{'$or':_['map'](_0x241478,function(_0x112953){if(_0x112953[_0xa229('0x2b')]!==_0xa229('0x3b')){var _0x3675a4={};_0x3675a4[_0x112953[_0xa229('0x27')]]={'$like':'%'+_0x561c22[_0xa229('0x2d')][_0xa229('0x38')]+'%'};return _0x3675a4;}})});}_0xedfa79=_[_0xa229('0x3a')]({},_0xedfa79,_0x561c22[_0xa229('0x3c')]);var _0x4576ea={'where':_0xedfa79[_0xa229('0x39')]};return db[_0xa229('0x3d')]['count'](_0x4576ea)[_0xa229('0x21')](function(_0x2d0e53){_0x235618[_0xa229('0x1c')]=_0x2d0e53;if(_0x561c22[_0xa229('0x2d')][_0xa229('0x3e')]){_0xedfa79['include']=[{'all':!![]}];}return db[_0xa229('0x3d')]['findAll'](_0xedfa79);})[_0xa229('0x21')](function(_0x1cbfb9){_0x235618[_0xa229('0x3f')]=_0x1cbfb9;return _0x235618;})[_0xa229('0x21')](respondWithFilteredResult(_0x5eb528,_0xedfa79))[_0xa229('0x40')](handleError(_0x5eb528,null));};exports[_0xa229('0x41')]=function(_0x5d0a58,_0x1e4e56){var _0x22dbe3={'raw':!![],'where':{'id':_0x5d0a58['params']['id']}},_0x73fb9f={};_0x73fb9f[_0xa229('0x30')]=_[_0xa229('0x2e')](db[_0xa229('0x3d')][_0xa229('0x29')]);_0x73fb9f['query']=_[_0xa229('0x2e')](_0x5d0a58[_0xa229('0x2d')]);_0x73fb9f[_0xa229('0x37')]=_[_0xa229('0x2f')](_0x73fb9f['model'],_0x73fb9f[_0xa229('0x2d')]);_0x22dbe3['attributes']=_[_0xa229('0x2f')](_0x73fb9f[_0xa229('0x30')],qs['fields'](_0x5d0a58[_0xa229('0x2d')][_0xa229('0x32')]));_0x22dbe3[_0xa229('0x31')]=_0x22dbe3[_0xa229('0x31')][_0xa229('0x33')]?_0x22dbe3[_0xa229('0x31')]:_0x73fb9f[_0xa229('0x30')];if(_0x5d0a58[_0xa229('0x2d')][_0xa229('0x3e')]){_0x22dbe3['include']=[{'all':!![]}];}_0x22dbe3=_[_0xa229('0x3a')]({},_0x22dbe3,_0x5d0a58[_0xa229('0x3c')]);return db[_0xa229('0x3d')]['find'](_0x22dbe3)[_0xa229('0x21')](handleEntityNotFound(_0x1e4e56,null))[_0xa229('0x21')](respondWithResult(_0x1e4e56,null))[_0xa229('0x40')](handleError(_0x1e4e56,null));};exports['create']=function(_0x5ede73,_0x237536){return db[_0xa229('0x3d')][_0xa229('0x42')](_0x5ede73[_0xa229('0x43')],{})['then'](respondWithResult(_0x237536,0xc9))[_0xa229('0x40')](handleError(_0x237536,null));};exports[_0xa229('0x44')]=function(_0x28c28f,_0x3994e2){if(_0x28c28f[_0xa229('0x43')]['id']){delete _0x28c28f[_0xa229('0x43')]['id'];}return db['Cdr'][_0xa229('0x45')]({'where':{'id':_0x28c28f[_0xa229('0x46')]['id']}})[_0xa229('0x21')](handleEntityNotFound(_0x3994e2,null))[_0xa229('0x21')](saveUpdates(_0x28c28f[_0xa229('0x43')],null))[_0xa229('0x21')](respondWithResult(_0x3994e2,null))[_0xa229('0x40')](handleError(_0x3994e2,null));};exports[_0xa229('0x22')]=function(_0x3bf2f5,_0x294829){return db[_0xa229('0x3d')][_0xa229('0x45')]({'where':{'id':_0x3bf2f5[_0xa229('0x46')]['id']}})[_0xa229('0x21')](handleEntityNotFound(_0x294829,null))[_0xa229('0x21')](removeEntity(_0x294829,null))[_0xa229('0x40')](handleError(_0x294829,null));};exports['describe']=function(_0xaa5cc3,_0x5163c6){return db[_0xa229('0x3d')][_0xa229('0x47')]()[_0xa229('0x21')](respondWithResult(_0x5163c6,null))[_0xa229('0x40')](handleError(_0x5163c6,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index f8ea56c..bc2c598 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 _0x01d9=['Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','define'];(function(_0x593d89,_0x45145f){var _0x4aa403=function(_0x21f674){while(--_0x21f674){_0x593d89['push'](_0x593d89['shift']());}};_0x4aa403(++_0x45145f);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));module[_0x901d('0xa')]=function(_0x4e7842,_0x1e5d7d){return _0x4e7842[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[{'name':_0x901d('0xe'),'fields':[_0x901d('0xe')]},{'name':_0x901d('0xf'),'fields':[_0x901d('0xf')]},{'name':_0x901d('0x10'),'fields':[_0x901d('0x10')]},{'name':_0x901d('0x11'),'fields':[_0x901d('0x11')]},{'name':_0x901d('0x12'),'fields':['src']},{'name':_0x901d('0x13'),'fields':['uniqueid']}],'timestamps':![]});}; \ No newline at end of file +var _0x6d38=['uniqueid','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./cdr.attributes','define','Cdr','accountcode','calldate','dst'];(function(_0x38be46,_0x524fe1){var _0x192474=function(_0x1ca022){while(--_0x1ca022){_0x38be46['push'](_0x38be46['shift']());}};_0x192474(++_0x524fe1);}(_0x6d38,0x1ef));var _0x86d3=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x6d38[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var logger=require(_0x86d3('0x1'))(_0x86d3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x86d3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var attributes=require(_0x86d3('0x6'));module['exports']=function(_0x2d8272,_0xfbbc15){return _0x2d8272[_0x86d3('0x7')](_0x86d3('0x8'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x86d3('0x9')]},{'name':_0x86d3('0xa'),'fields':[_0x86d3('0xa')]},{'name':'disposition','fields':['disposition']},{'name':_0x86d3('0xb'),'fields':[_0x86d3('0xb')]},{'name':'src','fields':['src']},{'name':_0x86d3('0xc'),'fields':[_0x86d3('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 1e36e9d..1fbda62 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 _0x86c1=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x1a133b,_0x14ae86){var _0x4565d1=function(_0xebf74e){while(--_0xebf74e){_0x1a133b['push'](_0x1a133b['shift']());}};_0x4565d1(++_0x14ae86);}(_0x86c1,0xcc));var _0x186c=function(_0x1c7088,_0x2d0c3d){_0x1c7088=_0x1c7088-0x0;var _0x2e5b05=_0x86c1[_0x1c7088];return _0x2e5b05;};'use strict';var _=require(_0x186c('0x0'));var util=require(_0x186c('0x1'));var moment=require(_0x186c('0x2'));var BPromise=require(_0x186c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x186c('0x4'));var db=require(_0x186c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x186c('0x6'))(_0x186c('0x7'));var config=require(_0x186c('0x8'));var jayson=require(_0x186c('0x9'));var client=jayson['client'][_0x186c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b74c1,_0x4b1325,_0x3fd5cf){return new BPromise(function(_0x3d6c9b,_0x4019d6){return client[_0x186c('0xb')](_0x1b74c1,_0x3fd5cf)[_0x186c('0xc')](function(_0x3efbf0){logger['info'](_0x186c('0xd'),_0x4b1325,_0x186c('0xe'));logger[_0x186c('0xf')](_0x186c('0x10'),_0x4b1325,_0x186c('0xe'),JSON['stringify'](_0x3efbf0));if(_0x3efbf0['error']){if(_0x3efbf0[_0x186c('0x11')][_0x186c('0x12')]===0x1f4){logger[_0x186c('0x11')](_0x186c('0xd'),_0x4b1325,_0x3efbf0[_0x186c('0x11')][_0x186c('0x13')]);return _0x4019d6(_0x3efbf0[_0x186c('0x11')][_0x186c('0x13')]);}logger[_0x186c('0x11')](_0x186c('0xd'),_0x4b1325,_0x3efbf0['error'][_0x186c('0x13')]);return _0x3d6c9b(_0x3efbf0[_0x186c('0x11')][_0x186c('0x13')]);}else{logger['info'](_0x186c('0xd'),_0x4b1325,_0x186c('0xe'));_0x3d6c9b(_0x3efbf0[_0x186c('0x14')]['message']);}})['catch'](function(_0x17332a){logger['error'](_0x186c('0xd'),_0x4b1325,_0x17332a);_0x4019d6(_0x17332a);});});} \ No newline at end of file +var _0xdca6=['rpc','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x23e6bb,_0x5c2d69){var _0x1e3b4c=function(_0x1afc46){while(--_0x1afc46){_0x23e6bb['push'](_0x23e6bb['shift']());}};_0x1e3b4c(++_0x5c2d69);}(_0xdca6,0x185));var _0x6dca=function(_0x2b1de3,_0x42bcc0){_0x2b1de3=_0x2b1de3-0x0;var _0x117643=_0xdca6[_0x2b1de3];return _0x117643;};'use strict';var _=require(_0x6dca('0x0'));var util=require(_0x6dca('0x1'));var moment=require(_0x6dca('0x2'));var BPromise=require(_0x6dca('0x3'));var rs=require(_0x6dca('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6dca('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6dca('0x6'))(_0x6dca('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6dca('0x8')][_0x6dca('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x248a33,_0x2c10ae,_0x5c2f2f){return new BPromise(function(_0x29547a,_0x145e85){return client[_0x6dca('0xa')](_0x248a33,_0x5c2f2f)[_0x6dca('0xb')](function(_0x281604){logger[_0x6dca('0xc')](_0x6dca('0xd'),_0x2c10ae,_0x6dca('0xe'));logger[_0x6dca('0xf')](_0x6dca('0x10'),_0x2c10ae,_0x6dca('0xe'),JSON[_0x6dca('0x11')](_0x281604));if(_0x281604[_0x6dca('0x12')]){if(_0x281604[_0x6dca('0x12')]['code']===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x2c10ae,_0x281604['error'][_0x6dca('0x13')]);return _0x145e85(_0x281604[_0x6dca('0x12')][_0x6dca('0x13')]);}logger['error'](_0x6dca('0xd'),_0x2c10ae,_0x281604[_0x6dca('0x12')][_0x6dca('0x13')]);return _0x29547a(_0x281604[_0x6dca('0x12')][_0x6dca('0x13')]);}else{logger[_0x6dca('0xc')](_0x6dca('0xd'),_0x2c10ae,_0x6dca('0xe'));_0x29547a(_0x281604[_0x6dca('0x14')][_0x6dca('0x13')]);}})[_0x6dca('0x15')](function(_0x3e061a){logger[_0x6dca('0x12')](_0x6dca('0xd'),_0x2c10ae,_0x3e061a);_0x145e85(_0x3e061a);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 9fd1d2b..c84ac81 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 _0x7242=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','multer'];(function(_0x24ca1f,_0x3d2164){var _0x5f4222=function(_0x37b651){while(--_0x37b651){_0x24ca1f['push'](_0x24ca1f['shift']());}};_0x5f4222(++_0x3d2164);}(_0x7242,0xdb));var _0x2724=function(_0x3cdfe2,_0x19c061){_0x3cdfe2=_0x3cdfe2-0x0;var _0x5ce0fa=_0x7242[_0x3cdfe2];return _0x5ce0fa;};'use strict';var multer=require(_0x2724('0x0'));var util=require(_0x2724('0x1'));var path=require(_0x2724('0x2'));var timeout=require(_0x2724('0x3'));var express=require(_0x2724('0x4'));var router=express[_0x2724('0x5')]();var fs_extra=require(_0x2724('0x6'));var auth=require(_0x2724('0x7'));var interaction=require(_0x2724('0x8'));var config=require(_0x2724('0x9'));var controller=require(_0x2724('0xa'));router[_0x2724('0xb')]('/',auth[_0x2724('0xc')](),controller['index']);router['get']('/describe',auth[_0x2724('0xc')](),controller[_0x2724('0xd')]);router[_0x2724('0xb')](_0x2724('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x2724('0xf')]('/',auth['isAuthenticated'](),controller[_0x2724('0x10')]);router[_0x2724('0x11')](_0x2724('0xe'),auth[_0x2724('0xc')](),controller[_0x2724('0x12')]);router[_0x2724('0x13')](_0x2724('0xe'),auth[_0x2724('0xc')](),controller[_0x2724('0x14')]);module[_0x2724('0x15')]=router; \ No newline at end of file +var _0x8fad=['update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cdr.controller','isAuthenticated','index','/describe','describe','get','show','post','create','put'];(function(_0x5389a9,_0x221b3f){var _0x4f435b=function(_0x33ff2d){while(--_0x33ff2d){_0x5389a9['push'](_0x5389a9['shift']());}};_0x4f435b(++_0x221b3f);}(_0x8fad,0x193));var _0xd8fa=function(_0x3ef97f,_0x14ab21){_0x3ef97f=_0x3ef97f-0x0;var _0x3cda91=_0x8fad[_0x3ef97f];return _0x3cda91;};'use strict';var multer=require(_0xd8fa('0x0'));var util=require(_0xd8fa('0x1'));var path=require('path');var timeout=require(_0xd8fa('0x2'));var express=require('express');var router=express[_0xd8fa('0x3')]();var fs_extra=require(_0xd8fa('0x4'));var auth=require(_0xd8fa('0x5'));var interaction=require(_0xd8fa('0x6'));var config=require('../../config/environment');var controller=require(_0xd8fa('0x7'));router['get']('/',auth[_0xd8fa('0x8')](),controller[_0xd8fa('0x9')]);router['get'](_0xd8fa('0xa'),auth[_0xd8fa('0x8')](),controller[_0xd8fa('0xb')]);router[_0xd8fa('0xc')]('/:id',auth[_0xd8fa('0x8')](),controller[_0xd8fa('0xd')]);router[_0xd8fa('0xe')]('/',auth[_0xd8fa('0x8')](),controller[_0xd8fa('0xf')]);router[_0xd8fa('0x10')]('/:id',auth[_0xd8fa('0x8')](),controller[_0xd8fa('0x11')]);router[_0xd8fa('0x12')]('/:id',auth[_0xd8fa('0x8')](),controller[_0xd8fa('0x13')]);module[_0xd8fa('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 0a65d28..6cfa230 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 _0x9b6b=['STRING','TEXT','*,*,*,*','INTEGER'];(function(_0x1602ef,_0x447aba){var _0x5870ee=function(_0x4d94e7){while(--_0x4d94e7){_0x1602ef['push'](_0x1602ef['shift']());}};_0x5870ee(++_0x447aba);}(_0x9b6b,0x19f));var _0xb9b6=function(_0x983a97,_0x14539d){_0x983a97=_0x983a97-0x0;var _0x533ddd=_0x9b6b[_0x983a97];return _0x533ddd;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xb9b6('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xb9b6('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb9b6('0x2')]()},'description':{'type':Sequelize[_0xb9b6('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xb9b6('0x3')}}; \ No newline at end of file +var _0x5d6f=['noop','TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x1e2c81,_0x3ef0e2){var _0x166936=function(_0x13c7dc){while(--_0x13c7dc){_0x1e2c81['push'](_0x1e2c81['shift']());}};_0x166936(++_0x3ef0e2);}(_0x5d6f,0x111));var _0xf5d6=function(_0x173452,_0x3aa870){_0x173452=_0x173452-0x0;var _0xee3fd0=_0x5d6f[_0x173452];return _0xee3fd0;};'use strict';var Sequelize=require(_0xf5d6('0x0'));module['exports']={'priority':{'type':Sequelize[_0xf5d6('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xf5d6('0x2')],'allowNull':![],'defaultValue':_0xf5d6('0x3')},'appdata':{'type':Sequelize[_0xf5d6('0x4')]()},'description':{'type':Sequelize[_0xf5d6('0x2')]},'interval':{'type':Sequelize[_0xf5d6('0x2')],'defaultValue':_0xf5d6('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 9263dbb..d1b112e 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 _0x7217=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','show','params','model','keys','ChatApplication','rawAttributes','query','filters','attributes','fields','length','includeAll','include','merge','find','body','catch','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7217,0x19e));var _0x7721=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7217[_0x5b644e];return _0x49c6bf;};'use strict';var pdf=require(_0x7721('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7721('0x1'));var zipdir=require(_0x7721('0x2'));var jsonpatch=require(_0x7721('0x3'));var rp=require(_0x7721('0x4'));var moment=require(_0x7721('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7721('0x6'));var path=require(_0x7721('0x7'));var sox=require(_0x7721('0x8'));var csv=require(_0x7721('0x9'));var ejs=require(_0x7721('0xa'));var fs=require('fs');var fs_extra=require(_0x7721('0xb'));var _=require(_0x7721('0xc'));var squel=require(_0x7721('0xd'));var crypto=require(_0x7721('0xe'));var jsforce=require(_0x7721('0xf'));var deskjs=require(_0x7721('0x10'));var toCsv=require(_0x7721('0x9'));var querystring=require(_0x7721('0x11'));var Papa=require(_0x7721('0x12'));var Redis=require(_0x7721('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7721('0x14'));var as=require(_0x7721('0x15'));var hardwareService=require(_0x7721('0x16'));var logger=require(_0x7721('0x17'))(_0x7721('0x18'));var utils=require(_0x7721('0x19'));var config=require(_0x7721('0x1a'));var licenseUtil=require(_0x7721('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2911ec,_0x199930){_0x199930=_0x199930||0xcc;return function(_0x57ff6d){if(_0x57ff6d){return _0x2911ec[_0x7721('0x1c')](_0x199930);}return _0x2911ec[_0x7721('0x1d')](_0x199930)[_0x7721('0x1e')]();};}function respondWithResult(_0x2e9752,_0x5069da){_0x5069da=_0x5069da||0xc8;return function(_0x3cbce8){if(_0x3cbce8){return _0x2e9752[_0x7721('0x1d')](_0x5069da)['json'](_0x3cbce8);}};}function respondWithFilteredResult(_0x4e199a,_0x4b183e){return function(_0x5ed54){if(_0x5ed54){var _0x25a628=_0x5ed54[_0x7721('0x1f')],_0x3cc909=_0x4b183e['offset'],_0x32550d=_0x4b183e[_0x7721('0x20')]+_0x4b183e['limit'],_0x5ed94b;if(_0x32550d>=_0x25a628){_0x32550d=_0x25a628;_0x5ed94b=0xc8;}else{_0x5ed94b=0xce;}_0x4e199a[_0x7721('0x1d')](_0x5ed94b);return _0x4e199a[_0x7721('0x21')](_0x7721('0x22'),_0x3cc909+'-'+_0x32550d+'/'+_0x25a628)[_0x7721('0x23')](_0x5ed54);}return null;};}function patchUpdates(_0x2286e5){return function(_0x40af90){try{jsonpatch[_0x7721('0x24')](_0x40af90,_0x2286e5,!![]);}catch(_0x413263){return BPromise[_0x7721('0x25')](_0x413263);}return _0x40af90[_0x7721('0x26')]();};}function saveUpdates(_0x4ce1db,_0x288f7e){return function(_0x2c1583){if(_0x2c1583){return _0x2c1583[_0x7721('0x27')](_0x4ce1db)[_0x7721('0x28')](function(_0x57140c){return _0x57140c;});}return null;};}function removeEntity(_0x28f5a6,_0x512f31){return function(_0xb9e9dd){if(_0xb9e9dd){return _0xb9e9dd[_0x7721('0x29')]()[_0x7721('0x28')](function(){_0x28f5a6[_0x7721('0x1d')](0xcc)[_0x7721('0x1e')]();});}};}function handleEntityNotFound(_0x395b15,_0x2c6b7b){return function(_0x5b4d74){if(!_0x5b4d74){_0x395b15[_0x7721('0x1c')](0x194);}return _0x5b4d74;};}function handleError(_0x1abedb,_0x125564){_0x125564=_0x125564||0x1f4;return function(_0x1f67c7){logger[_0x7721('0x2a')](_0x1f67c7[_0x7721('0x2b')]);if(_0x1f67c7[_0x7721('0x2c')]){delete _0x1f67c7[_0x7721('0x2c')];}_0x1abedb[_0x7721('0x1d')](_0x125564)['send'](_0x1f67c7);};}exports[_0x7721('0x2d')]=function(_0x5b0551,_0x499b87){var _0x315202={'raw':!![],'where':{'id':_0x5b0551[_0x7721('0x2e')]['id']}},_0x343c19={};_0x343c19[_0x7721('0x2f')]=_[_0x7721('0x30')](db[_0x7721('0x31')][_0x7721('0x32')]);_0x343c19[_0x7721('0x33')]=_['keys'](_0x5b0551[_0x7721('0x33')]);_0x343c19[_0x7721('0x34')]=_['intersection'](_0x343c19['model'],_0x343c19[_0x7721('0x33')]);_0x315202[_0x7721('0x35')]=_['intersection'](_0x343c19[_0x7721('0x2f')],qs[_0x7721('0x36')](_0x5b0551[_0x7721('0x33')]['fields']));_0x315202[_0x7721('0x35')]=_0x315202[_0x7721('0x35')][_0x7721('0x37')]?_0x315202[_0x7721('0x35')]:_0x343c19[_0x7721('0x2f')];if(_0x5b0551['query'][_0x7721('0x38')]){_0x315202[_0x7721('0x39')]=[{'all':!![]}];}_0x315202=_[_0x7721('0x3a')]({},_0x315202,_0x5b0551['options']);return db[_0x7721('0x31')][_0x7721('0x3b')](_0x315202)['then'](handleEntityNotFound(_0x499b87,null))[_0x7721('0x28')](respondWithResult(_0x499b87,null))['catch'](handleError(_0x499b87,null));};exports[_0x7721('0x27')]=function(_0x326c50,_0x19d082){if(_0x326c50[_0x7721('0x3c')]['id']){delete _0x326c50[_0x7721('0x3c')]['id'];}return db[_0x7721('0x31')][_0x7721('0x3b')]({'where':{'id':_0x326c50[_0x7721('0x2e')]['id']}})[_0x7721('0x28')](handleEntityNotFound(_0x19d082,null))[_0x7721('0x28')](saveUpdates(_0x326c50[_0x7721('0x3c')],null))['then'](respondWithResult(_0x19d082,null))[_0x7721('0x3d')](handleError(_0x19d082,null));};exports['destroy']=function(_0x212384,_0x35614c){return db[_0x7721('0x31')][_0x7721('0x3b')]({'where':{'id':_0x212384[_0x7721('0x2e')]['id']}})[_0x7721('0x28')](handleEntityNotFound(_0x35614c,null))['then'](removeEntity(_0x35614c,null))['catch'](handleError(_0x35614c,null));}; \ No newline at end of file +var _0x34e8=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','name','send','show','ChatApplication','rawAttributes','query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','catch','body','params','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto'];(function(_0x16d39b,_0x100769){var _0x1bf6da=function(_0x40e3e0){while(--_0x40e3e0){_0x16d39b['push'](_0x16d39b['shift']());}};_0x1bf6da(++_0x100769);}(_0x34e8,0x12c));var _0x834e=function(_0x3d1c87,_0x454ccf){_0x3d1c87=_0x3d1c87-0x0;var _0x543777=_0x34e8[_0x3d1c87];return _0x543777;};'use strict';var pdf=require(_0x834e('0x0'));var emlformat=require(_0x834e('0x1'));var rimraf=require(_0x834e('0x2'));var zipdir=require(_0x834e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x834e('0x4'));var moment=require(_0x834e('0x5'));var BPromise=require(_0x834e('0x6'));var Mustache=require(_0x834e('0x7'));var util=require(_0x834e('0x8'));var path=require(_0x834e('0x9'));var sox=require(_0x834e('0xa'));var csv=require('to-csv');var ejs=require(_0x834e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x834e('0xc'));var squel=require(_0x834e('0xd'));var crypto=require(_0x834e('0xe'));var jsforce=require(_0x834e('0xf'));var deskjs=require(_0x834e('0x10'));var toCsv=require(_0x834e('0x11'));var querystring=require(_0x834e('0x12'));var Papa=require(_0x834e('0x13'));var Redis=require(_0x834e('0x14'));var authService=require(_0x834e('0x15'));var qs=require(_0x834e('0x16'));var as=require(_0x834e('0x17'));var hardwareService=require(_0x834e('0x18'));var logger=require(_0x834e('0x19'))(_0x834e('0x1a'));var utils=require(_0x834e('0x1b'));var config=require(_0x834e('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0x834e('0x1d'))['db'];function respondWithStatusCode(_0x6cd9b9,_0x58a27e){_0x58a27e=_0x58a27e||0xcc;return function(_0x23848e){if(_0x23848e){return _0x6cd9b9[_0x834e('0x1e')](_0x58a27e);}return _0x6cd9b9[_0x834e('0x1f')](_0x58a27e)[_0x834e('0x20')]();};}function respondWithResult(_0x50e860,_0x43156c){_0x43156c=_0x43156c||0xc8;return function(_0x302cbd){if(_0x302cbd){return _0x50e860['status'](_0x43156c)[_0x834e('0x21')](_0x302cbd);}};}function respondWithFilteredResult(_0x4a9cdc,_0x38a8cd){return function(_0x36d443){if(_0x36d443){var _0x478afe=_0x36d443['count'],_0x43ac41=_0x38a8cd[_0x834e('0x22')],_0x22106e=_0x38a8cd[_0x834e('0x22')]+_0x38a8cd[_0x834e('0x23')],_0x370fb5;if(_0x22106e>=_0x478afe){_0x22106e=_0x478afe;_0x370fb5=0xc8;}else{_0x370fb5=0xce;}_0x4a9cdc[_0x834e('0x1f')](_0x370fb5);return _0x4a9cdc[_0x834e('0x24')](_0x834e('0x25'),_0x43ac41+'-'+_0x22106e+'/'+_0x478afe)[_0x834e('0x21')](_0x36d443);}return null;};}function patchUpdates(_0x595515){return function(_0x2545b4){try{jsonpatch[_0x834e('0x26')](_0x2545b4,_0x595515,!![]);}catch(_0x113ff4){return BPromise[_0x834e('0x27')](_0x113ff4);}return _0x2545b4['save']();};}function saveUpdates(_0x45a630,_0x62f8f1){return function(_0x5a05c0){if(_0x5a05c0){return _0x5a05c0[_0x834e('0x28')](_0x45a630)[_0x834e('0x29')](function(_0x8d406e){return _0x8d406e;});}return null;};}function removeEntity(_0x5c55ca,_0x4e3f48){return function(_0x231619){if(_0x231619){return _0x231619[_0x834e('0x2a')]()['then'](function(){_0x5c55ca[_0x834e('0x1f')](0xcc)[_0x834e('0x20')]();});}};}function handleEntityNotFound(_0x58f4fd,_0x3bc4f7){return function(_0x2e1983){if(!_0x2e1983){_0x58f4fd[_0x834e('0x1e')](0x194);}return _0x2e1983;};}function handleError(_0x561cd2,_0x24fcf7){_0x24fcf7=_0x24fcf7||0x1f4;return function(_0x3e310f){logger['error'](_0x3e310f['stack']);if(_0x3e310f[_0x834e('0x2b')]){delete _0x3e310f['name'];}_0x561cd2[_0x834e('0x1f')](_0x24fcf7)[_0x834e('0x2c')](_0x3e310f);};}exports[_0x834e('0x2d')]=function(_0x2cc2eb,_0x3cd928){var _0x130cc5={'raw':!![],'where':{'id':_0x2cc2eb['params']['id']}},_0x491919={};_0x491919['model']=_['keys'](db[_0x834e('0x2e')][_0x834e('0x2f')]);_0x491919[_0x834e('0x30')]=_['keys'](_0x2cc2eb[_0x834e('0x30')]);_0x491919[_0x834e('0x31')]=_[_0x834e('0x32')](_0x491919[_0x834e('0x33')],_0x491919[_0x834e('0x30')]);_0x130cc5[_0x834e('0x34')]=_[_0x834e('0x32')](_0x491919[_0x834e('0x33')],qs[_0x834e('0x35')](_0x2cc2eb['query'][_0x834e('0x35')]));_0x130cc5['attributes']=_0x130cc5[_0x834e('0x34')][_0x834e('0x36')]?_0x130cc5[_0x834e('0x34')]:_0x491919[_0x834e('0x33')];if(_0x2cc2eb[_0x834e('0x30')][_0x834e('0x37')]){_0x130cc5[_0x834e('0x38')]=[{'all':!![]}];}_0x130cc5=_[_0x834e('0x39')]({},_0x130cc5,_0x2cc2eb[_0x834e('0x3a')]);return db[_0x834e('0x2e')]['find'](_0x130cc5)[_0x834e('0x29')](handleEntityNotFound(_0x3cd928,null))[_0x834e('0x29')](respondWithResult(_0x3cd928,null))[_0x834e('0x3b')](handleError(_0x3cd928,null));};exports[_0x834e('0x28')]=function(_0x595cc0,_0x3f88ad){if(_0x595cc0[_0x834e('0x3c')]['id']){delete _0x595cc0['body']['id'];}return db['ChatApplication']['find']({'where':{'id':_0x595cc0[_0x834e('0x3d')]['id']}})[_0x834e('0x29')](handleEntityNotFound(_0x3f88ad,null))[_0x834e('0x29')](saveUpdates(_0x595cc0[_0x834e('0x3c')],null))[_0x834e('0x29')](respondWithResult(_0x3f88ad,null))[_0x834e('0x3b')](handleError(_0x3f88ad,null));};exports['destroy']=function(_0x2c2d94,_0x513f36){return db[_0x834e('0x2e')][_0x834e('0x3e')]({'where':{'id':_0x2c2d94['params']['id']}})[_0x834e('0x29')](handleEntityNotFound(_0x513f36,null))[_0x834e('0x29')](removeEntity(_0x513f36,null))['catch'](handleError(_0x513f36,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 7577b7f..a7b5fd9 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 _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 82a713a..987029d 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 _0x3998=['info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','code','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x23118b,_0x562da3){var _0x3636cf=function(_0x5dc55c){while(--_0x5dc55c){_0x23118b['push'](_0x23118b['shift']());}};_0x3636cf(++_0x562da3);}(_0x3998,0xe5));var _0x8399=function(_0xa65082,_0x178b81){_0xa65082=_0xa65082-0x0;var _0x37bd8f=_0x3998[_0xa65082];return _0x37bd8f;};'use strict';var _=require(_0x8399('0x0'));var util=require(_0x8399('0x1'));var moment=require(_0x8399('0x2'));var BPromise=require(_0x8399('0x3'));var rs=require(_0x8399('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8399('0x5'))['db'];var utils=require(_0x8399('0x6'));var logger=require('../../config/logger')(_0x8399('0x7'));var config=require(_0x8399('0x8'));var jayson=require(_0x8399('0x9'));var client=jayson[_0x8399('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27dee3,_0x21f663,_0x569591){return new BPromise(function(_0x8dcfb5,_0x537a69){return client[_0x8399('0xb')](_0x27dee3,_0x569591)[_0x8399('0xc')](function(_0x41c57e){logger[_0x8399('0xd')](_0x8399('0xe'),_0x21f663,_0x8399('0xf'));logger[_0x8399('0x10')](_0x8399('0x11'),_0x21f663,_0x8399('0xf'),JSON['stringify'](_0x41c57e));if(_0x41c57e['error']){if(_0x41c57e['error'][_0x8399('0x12')]===0x1f4){logger[_0x8399('0x13')](_0x8399('0xe'),_0x21f663,_0x41c57e['error'][_0x8399('0x14')]);return _0x537a69(_0x41c57e['error'][_0x8399('0x14')]);}logger[_0x8399('0x13')]('ChatApplication,\x20%s,\x20%s',_0x21f663,_0x41c57e[_0x8399('0x13')][_0x8399('0x14')]);return _0x8dcfb5(_0x41c57e['error'][_0x8399('0x14')]);}else{logger[_0x8399('0xd')](_0x8399('0xe'),_0x21f663,_0x8399('0xf'));_0x8dcfb5(_0x41c57e['result']['message']);}})[_0x8399('0x15')](function(_0x29e150){logger[_0x8399('0x13')](_0x8399('0xe'),_0x21f663,_0x29e150);_0x537a69(_0x29e150);});});} \ No newline at end of file +var _0x32b6=['client','http','info','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','ChatApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1794e6,_0x5b5676){var _0x1c1b66=function(_0x40082d){while(--_0x40082d){_0x1794e6['push'](_0x1794e6['shift']());}};_0x1c1b66(++_0x5b5676);}(_0x32b6,0x10f));var _0x632b=function(_0x18c560,_0x49c349){_0x18c560=_0x18c560-0x0;var _0x22f9e8=_0x32b6[_0x18c560];return _0x22f9e8;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var moment=require(_0x632b('0x2'));var BPromise=require('bluebird');var rs=require(_0x632b('0x3'));var fs=require('fs');var Redis=require(_0x632b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x632b('0x5'));var logger=require(_0x632b('0x6'))(_0x632b('0x7'));var config=require(_0x632b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x632b('0x9')][_0x632b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc7a3e,_0x162a4b,_0xdcde8d){return new BPromise(function(_0x7b6ab1,_0x3adc37){return client['request'](_0xc7a3e,_0xdcde8d)['then'](function(_0x465568){logger[_0x632b('0xb')]('ChatApplication,\x20%s,\x20%s',_0x162a4b,_0x632b('0xc'));logger['debug'](_0x632b('0xd'),_0x162a4b,'request\x20sent',JSON['stringify'](_0x465568));if(_0x465568[_0x632b('0xe')]){if(_0x465568['error'][_0x632b('0xf')]===0x1f4){logger[_0x632b('0xe')](_0x632b('0x10'),_0x162a4b,_0x465568[_0x632b('0xe')][_0x632b('0x11')]);return _0x3adc37(_0x465568[_0x632b('0xe')][_0x632b('0x11')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x162a4b,_0x465568[_0x632b('0xe')]['message']);return _0x7b6ab1(_0x465568[_0x632b('0xe')][_0x632b('0x11')]);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x162a4b,_0x632b('0xc'));_0x7b6ab1(_0x465568[_0x632b('0x12')][_0x632b('0x11')]);}})[_0x632b('0x13')](function(_0x4f4ab8){logger['error'](_0x632b('0x10'),_0x162a4b,_0x4f4ab8);_0x3adc37(_0x4f4ab8);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 1e04512..48f7d3d 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 _0x5981=['Router','fs-extra','../../components/interaction/service','../../config/environment','./chatApplication.controller','isAuthenticated','show','/:id','destroy','util','connect-timeout','express'];(function(_0x1652b7,_0xcd7dd5){var _0x54632e=function(_0x46b463){while(--_0x46b463){_0x1652b7['push'](_0x1652b7['shift']());}};_0x54632e(++_0xcd7dd5);}(_0x5981,0xbd));var _0x1598=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5981[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x1598('0x0'));var path=require('path');var timeout=require(_0x1598('0x1'));var express=require(_0x1598('0x2'));var router=express[_0x1598('0x3')]();var fs_extra=require(_0x1598('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1598('0x5'));var config=require(_0x1598('0x6'));var controller=require(_0x1598('0x7'));router['get']('/:id',auth[_0x1598('0x8')](),controller[_0x1598('0x9')]);router['put'](_0x1598('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x1598('0xa'),auth['isAuthenticated'](),controller[_0x1598('0xb')]);module['exports']=router; \ No newline at end of file +var _0xe4de=['./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4f67c6,_0x3ce1d3){var _0x2faa13=function(_0x293026){while(--_0x293026){_0x4f67c6['push'](_0x4f67c6['shift']());}};_0x2faa13(++_0x3ce1d3);}(_0xe4de,0xb3));var _0xee4d=function(_0x5c1f9b,_0x321904){_0x5c1f9b=_0x5c1f9b-0x0;var _0x587d4f=_0xe4de[_0x5c1f9b];return _0x587d4f;};'use strict';var multer=require(_0xee4d('0x0'));var util=require(_0xee4d('0x1'));var path=require(_0xee4d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xee4d('0x3')]();var fs_extra=require(_0xee4d('0x4'));var auth=require(_0xee4d('0x5'));var interaction=require(_0xee4d('0x6'));var config=require(_0xee4d('0x7'));var controller=require(_0xee4d('0x8'));router[_0xee4d('0x9')](_0xee4d('0xa'),auth[_0xee4d('0xb')](),controller[_0xee4d('0xc')]);router[_0xee4d('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xee4d('0xe')]);router[_0xee4d('0xf')](_0xee4d('0xa'),auth[_0xee4d('0xb')](),controller[_0xee4d('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index f055deb..0ab274f 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 _0x6bef=['STRING','BOOLEAN','sequelize','exports'];(function(_0x2d3797,_0x85752a){var _0x569d86=function(_0x1271a2){while(--_0x1271a2){_0x2d3797['push'](_0x2d3797['shift']());}};_0x569d86(++_0x85752a);}(_0x6bef,0x1ee));var _0xf6be=function(_0x4fe9ec,_0x4d9a77){_0x4fe9ec=_0x4fe9ec-0x0;var _0x3a85ac=_0x6bef[_0x4fe9ec];return _0x3a85ac;};'use strict';var Sequelize=require(_0xf6be('0x0'));module[_0xf6be('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xf6be('0x2')]},'write':{'type':Sequelize[_0xf6be('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x395d=['BOOLEAN','STRING'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x395d,0xb7));var _0xd395=function(_0xa9af82,_0x224229){_0xa9af82=_0xa9af82-0x0;var _0x2c355d=_0x395d[_0xa9af82];return _0x2c355d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd395('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xd395('0x0')]},'write':{'type':Sequelize[_0xd395('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index b490997..b5d3467 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 _0x9957=['nolimit','offset','order','sort','where','pick','filter','options','count','includeAll','include','findAll','rows','show','params','length','merge','create','body','find','destroy','describe','getUnread','ChatInternalMessage','user','toInteger','omit','ids','getMembers','findOne','User','hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatGroup.socket','register','jayson/promise','client','http','request','then','info','ChatGroup,\x20%s,\x20%s','ChatGroup,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','sendStatus','end','status','json','limit','set','Content-Range','save','update','name','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields'];(function(_0x47242d,_0x13f993){var _0x30273a=function(_0x322cd2){while(--_0x322cd2){_0x47242d['push'](_0x47242d['shift']());}};_0x30273a(++_0x13f993);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var fs_extra=require(_0x7995('0xc'));var _=require(_0x7995('0xd'));var squel=require('squel');var crypto=require(_0x7995('0xe'));var jsforce=require(_0x7995('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7995('0xa'));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('../../config/license/hardware');var logger=require(_0x7995('0x16'))(_0x7995('0x17'));var utils=require('../../config/utils');var config=require(_0x7995('0x18'));var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];config[_0x7995('0x1b')]=_[_0x7995('0x1c')](config[_0x7995('0x1b')],{'host':_0x7995('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7995('0x1e'))[_0x7995('0x1f')](socket);var jayson=require(_0x7995('0x20'));var client=jayson[_0x7995('0x21')][_0x7995('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x1a5310,_0x2202ce,_0x41cbf0,_0x5377e5){return new BPromise(function(_0x2eeacc,_0x565d97){var _0x2f832e=_0x5377e5||client;return _0x2f832e[_0x7995('0x23')](_0x1a5310,_0x41cbf0)[_0x7995('0x24')](function(_0x291317){logger[_0x7995('0x25')](_0x7995('0x26'),_0x2202ce,'request\x20sent');logger['debug'](_0x7995('0x27'),_0x2202ce,'request\x20sent',JSON['stringify'](_0x291317));if(_0x291317[_0x7995('0x28')]){if(_0x291317[_0x7995('0x28')]['code']===0x1f4){logger[_0x7995('0x28')]('ChatGroup,\x20%s,\x20%s',_0x2202ce,_0x291317['error'][_0x7995('0x29')]);return _0x565d97(_0x291317[_0x7995('0x28')][_0x7995('0x29')]);}logger[_0x7995('0x28')](_0x7995('0x26'),_0x2202ce,_0x291317[_0x7995('0x28')]['message']);return _0x2eeacc(_0x291317[_0x7995('0x28')][_0x7995('0x29')]);}else{logger[_0x7995('0x25')](_0x7995('0x26'),_0x2202ce,_0x7995('0x2a'));_0x2eeacc(_0x291317[_0x7995('0x2b')][_0x7995('0x29')]);}})[_0x7995('0x2c')](function(_0x59405a){logger[_0x7995('0x28')](_0x7995('0x26'),_0x2202ce,_0x59405a);_0x565d97(_0x59405a);});});}function respondWithStatusCode(_0x401dc3,_0x268ce7){_0x268ce7=_0x268ce7||0xcc;return function(_0x3a3fcf){if(_0x3a3fcf){return _0x401dc3[_0x7995('0x2d')](_0x268ce7);}return _0x401dc3['status'](_0x268ce7)[_0x7995('0x2e')]();};}function respondWithResult(_0x5911c3,_0x229742){_0x229742=_0x229742||0xc8;return function(_0x49bc7e){if(_0x49bc7e){return _0x5911c3[_0x7995('0x2f')](_0x229742)[_0x7995('0x30')](_0x49bc7e);}};}function respondWithFilteredResult(_0x11c1eb,_0x4b6f99){return function(_0x9b2a15){if(_0x9b2a15){var _0x514445=_0x9b2a15['count'],_0x456a28=_0x4b6f99['offset'],_0x3250e0=_0x4b6f99['offset']+_0x4b6f99[_0x7995('0x31')],_0x4253e5;if(_0x3250e0>=_0x514445){_0x3250e0=_0x514445;_0x4253e5=0xc8;}else{_0x4253e5=0xce;}_0x11c1eb[_0x7995('0x2f')](_0x4253e5);return _0x11c1eb[_0x7995('0x32')](_0x7995('0x33'),_0x456a28+'-'+_0x3250e0+'/'+_0x514445)[_0x7995('0x30')](_0x9b2a15);}return null;};}function patchUpdates(_0x1ca460){return function(_0x538841){try{jsonpatch['apply'](_0x538841,_0x1ca460,!![]);}catch(_0xfa8f15){return BPromise['reject'](_0xfa8f15);}return _0x538841[_0x7995('0x34')]();};}function saveUpdates(_0x3eb566,_0x29fac5){return function(_0x1e9fa4){if(_0x1e9fa4){return _0x1e9fa4[_0x7995('0x35')](_0x3eb566)['then'](function(_0x44309d){return _0x44309d;});}return null;};}function removeEntity(_0x33e24e,_0x5dd802){return function(_0x48db25){if(_0x48db25){return _0x48db25['destroy']()[_0x7995('0x24')](function(){_0x33e24e[_0x7995('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e7020,_0x51b95d){return function(_0x37917b){if(!_0x37917b){_0x3e7020[_0x7995('0x2d')](0x194);}return _0x37917b;};}function handleError(_0x177cb4,_0x5014d2){_0x5014d2=_0x5014d2||0x1f4;return function(_0x52d76d){logger[_0x7995('0x28')](_0x52d76d['stack']);if(_0x52d76d['name']){delete _0x52d76d[_0x7995('0x36')];}_0x177cb4[_0x7995('0x2f')](_0x5014d2)['send'](_0x52d76d);};}exports[_0x7995('0x37')]=function(_0x1922b4,_0x2b772f){var _0x18667c={},_0x1e3dbf={},_0x53002a={'count':0x0,'rows':[]};var _0x2d4285=_[_0x7995('0x38')](db[_0x7995('0x39')][_0x7995('0x3a')],function(_0x4b1541){return{'name':_0x4b1541[_0x7995('0x3b')],'type':_0x4b1541[_0x7995('0x3c')][_0x7995('0x3d')]};});_0x1e3dbf[_0x7995('0x3e')]=_[_0x7995('0x38')](_0x2d4285,_0x7995('0x36'));_0x1e3dbf['query']=_[_0x7995('0x3f')](_0x1922b4[_0x7995('0x40')]);_0x1e3dbf[_0x7995('0x41')]=_[_0x7995('0x42')](_0x1e3dbf[_0x7995('0x3e')],_0x1e3dbf[_0x7995('0x40')]);_0x18667c[_0x7995('0x43')]=_[_0x7995('0x42')](_0x1e3dbf[_0x7995('0x3e')],qs[_0x7995('0x44')](_0x1922b4[_0x7995('0x40')][_0x7995('0x44')]));_0x18667c[_0x7995('0x43')]=_0x18667c['attributes']['length']?_0x18667c[_0x7995('0x43')]:_0x1e3dbf[_0x7995('0x3e')];if(!_0x1922b4['query']['hasOwnProperty'](_0x7995('0x45'))){_0x18667c['limit']=qs['limit'](_0x1922b4[_0x7995('0x40')][_0x7995('0x31')]);_0x18667c[_0x7995('0x46')]=qs['offset'](_0x1922b4[_0x7995('0x40')]['offset']);}_0x18667c[_0x7995('0x47')]=qs['sort'](_0x1922b4['query'][_0x7995('0x48')]);_0x18667c[_0x7995('0x49')]=qs[_0x7995('0x41')](_[_0x7995('0x4a')](_0x1922b4['query'],_0x1e3dbf[_0x7995('0x41')]),_0x2d4285);if(_0x1922b4[_0x7995('0x40')][_0x7995('0x4b')]){_0x18667c[_0x7995('0x49')]=_['merge'](_0x18667c['where'],{'$or':_[_0x7995('0x38')](_0x2d4285,function(_0x55791b){if(_0x55791b[_0x7995('0x3c')]!=='VIRTUAL'){var _0x2f435e={};_0x2f435e[_0x55791b['name']]={'$like':'%'+_0x1922b4[_0x7995('0x40')][_0x7995('0x4b')]+'%'};return _0x2f435e;}})});}_0x18667c=_['merge']({},_0x18667c,_0x1922b4[_0x7995('0x4c')]);var _0x336ff2={'where':_0x18667c[_0x7995('0x49')]};return db[_0x7995('0x39')]['count'](_0x336ff2)[_0x7995('0x24')](function(_0x3e787d){_0x53002a[_0x7995('0x4d')]=_0x3e787d;if(_0x1922b4['query'][_0x7995('0x4e')]){_0x18667c[_0x7995('0x4f')]=[{'all':!![]}];}return db[_0x7995('0x39')][_0x7995('0x50')](_0x18667c);})[_0x7995('0x24')](function(_0x51934b){_0x53002a[_0x7995('0x51')]=_0x51934b;return _0x53002a;})[_0x7995('0x24')](respondWithFilteredResult(_0x2b772f,_0x18667c))['catch'](handleError(_0x2b772f,null));};exports[_0x7995('0x52')]=function(_0x5843ba,_0x1d87f9){var _0x187735={'raw':!![],'where':{'id':_0x5843ba[_0x7995('0x53')]['id']}},_0x1afab4={};_0x1afab4[_0x7995('0x3e')]=_[_0x7995('0x3f')](db[_0x7995('0x39')]['rawAttributes']);_0x1afab4[_0x7995('0x40')]=_[_0x7995('0x3f')](_0x5843ba[_0x7995('0x40')]);_0x1afab4['filters']=_[_0x7995('0x42')](_0x1afab4[_0x7995('0x3e')],_0x1afab4[_0x7995('0x40')]);_0x187735['attributes']=_['intersection'](_0x1afab4['model'],qs[_0x7995('0x44')](_0x5843ba[_0x7995('0x40')]['fields']));_0x187735[_0x7995('0x43')]=_0x187735[_0x7995('0x43')][_0x7995('0x54')]?_0x187735[_0x7995('0x43')]:_0x1afab4[_0x7995('0x3e')];if(_0x5843ba['query'][_0x7995('0x4e')]){_0x187735['include']=[{'all':!![]}];}_0x187735=_[_0x7995('0x55')]({},_0x187735,_0x5843ba[_0x7995('0x4c')]);return db[_0x7995('0x39')]['find'](_0x187735)['then'](handleEntityNotFound(_0x1d87f9,null))['then'](respondWithResult(_0x1d87f9,null))['catch'](handleError(_0x1d87f9,null));};exports[_0x7995('0x56')]=function(_0x3709de,_0x1a861c){return db[_0x7995('0x39')][_0x7995('0x56')](_0x3709de[_0x7995('0x57')],{})[_0x7995('0x24')](respondWithResult(_0x1a861c,0xc9))[_0x7995('0x2c')](handleError(_0x1a861c,null));};exports[_0x7995('0x35')]=function(_0x17ecd3,_0xa7af8c){if(_0x17ecd3[_0x7995('0x57')]['id']){delete _0x17ecd3[_0x7995('0x57')]['id'];}return db[_0x7995('0x39')][_0x7995('0x58')]({'where':{'id':_0x17ecd3[_0x7995('0x53')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0xa7af8c,null))[_0x7995('0x24')](saveUpdates(_0x17ecd3[_0x7995('0x57')],null))['then'](respondWithResult(_0xa7af8c,null))[_0x7995('0x2c')](handleError(_0xa7af8c,null));};exports[_0x7995('0x59')]=function(_0x3b8a54,_0x32c0d3){return db['ChatGroup']['find']({'where':{'id':_0x3b8a54[_0x7995('0x53')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x32c0d3,null))[_0x7995('0x24')](removeEntity(_0x32c0d3,null))[_0x7995('0x2c')](handleError(_0x32c0d3,null));};exports['describe']=function(_0x13cd7b,_0x74ff38){return db[_0x7995('0x39')][_0x7995('0x5a')]()['then'](respondWithResult(_0x74ff38,null))['catch'](handleError(_0x74ff38,null));};exports[_0x7995('0x5b')]=function(_0x398fac,_0x6c0221,_0x1d69ce){return db[_0x7995('0x5c')][_0x7995('0x4d')]({'where':{'ChatGroupId':_0x398fac[_0x7995('0x53')]['id'],'ToId':_0x398fac[_0x7995('0x5d')]['id'],'read':![]}})[_0x7995('0x24')](function(_0x50caf5){return{'id':_[_0x7995('0x5e')](_0x398fac[_0x7995('0x53')]['id']),'count':_0x50caf5};})[_0x7995('0x24')](respondWithResult(_0x6c0221,null))[_0x7995('0x2c')](handleError(_0x6c0221,null));};exports['addMembers']=function(_0x51bf6a,_0x3053fd,_0xebb5c8){return db['ChatGroup'][_0x7995('0x58')]({'where':{'id':_0x51bf6a[_0x7995('0x53')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x3053fd,null))[_0x7995('0x24')](function(_0x32cb04){if(_0x32cb04){return _0x32cb04['addMembers'](_0x51bf6a[_0x7995('0x57')]['ids'],_[_0x7995('0x5f')](_0x51bf6a[_0x7995('0x57')],[_0x7995('0x60'),'id'])||{});}})[_0x7995('0x24')](respondWithResult(_0x3053fd,null))[_0x7995('0x2c')](handleError(_0x3053fd,null));};exports[_0x7995('0x61')]=function(_0x2b3c1d,_0x44372a,_0x10f012){var _0x3f2bde={};var _0x2618c4={};var _0x234d8d;var _0x56eb85;return db[_0x7995('0x39')][_0x7995('0x62')]({'where':{'id':_0x2b3c1d[_0x7995('0x53')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x44372a,null))[_0x7995('0x24')](function(_0x54a2e0){if(_0x54a2e0){_0x234d8d=_0x54a2e0;_0x2618c4['model']=_[_0x7995('0x3f')](db[_0x7995('0x63')][_0x7995('0x3a')]);_0x2618c4[_0x7995('0x40')]=_['keys'](_0x2b3c1d[_0x7995('0x40')]);_0x2618c4['filters']=_['intersection'](_0x2618c4[_0x7995('0x3e')],_0x2618c4[_0x7995('0x40')]);_0x3f2bde[_0x7995('0x43')]=_[_0x7995('0x42')](_0x2618c4[_0x7995('0x3e')],qs[_0x7995('0x44')](_0x2b3c1d[_0x7995('0x40')][_0x7995('0x44')]));_0x3f2bde[_0x7995('0x43')]=_0x3f2bde[_0x7995('0x43')]['length']?_0x3f2bde[_0x7995('0x43')]:_0x2618c4[_0x7995('0x3e')];_0x3f2bde[_0x7995('0x47')]=qs['sort'](_0x2b3c1d[_0x7995('0x40')][_0x7995('0x48')]);_0x3f2bde[_0x7995('0x49')]=qs[_0x7995('0x41')](_[_0x7995('0x4a')](_0x2b3c1d[_0x7995('0x40')],_0x2618c4[_0x7995('0x41')]));if(_0x2b3c1d[_0x7995('0x40')][_0x7995('0x4b')]){_0x3f2bde[_0x7995('0x49')]=_[_0x7995('0x55')](_0x3f2bde['where'],{'$or':_['map'](_0x3f2bde[_0x7995('0x43')],function(_0xfe1105){var _0x39ebb6={};_0x39ebb6[_0xfe1105]={'$like':'%'+_0x2b3c1d[_0x7995('0x40')]['filter']+'%'};return _0x39ebb6;})});}_0x3f2bde=_[_0x7995('0x55')]({},_0x3f2bde,_0x2b3c1d[_0x7995('0x4c')]);return _0x234d8d['getMembers'](_0x3f2bde);}})['then'](function(_0x3253b5){if(_0x3253b5){_0x56eb85=_0x3253b5[_0x7995('0x54')];if(!_0x2b3c1d['query'][_0x7995('0x64')]('nolimit')){_0x3f2bde[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x2b3c1d['query']['limit']);_0x3f2bde[_0x7995('0x46')]=qs['offset'](_0x2b3c1d[_0x7995('0x40')][_0x7995('0x46')]);}return _0x234d8d[_0x7995('0x61')](_0x3f2bde);}})[_0x7995('0x24')](function(_0x1a1873){if(_0x1a1873){return _0x1a1873?{'count':_0x56eb85,'rows':_0x1a1873}:null;}})[_0x7995('0x24')](respondWithResult(_0x44372a,null))[_0x7995('0x2c')](handleError(_0x44372a,null));};exports[_0x7995('0x65')]=function(_0x29e0ee,_0x117317,_0x1ab590){return db[_0x7995('0x39')][_0x7995('0x58')]({'where':{'id':_0x29e0ee[_0x7995('0x53')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x117317,null))[_0x7995('0x24')](function(_0x6ad274){if(_0x6ad274){return _0x6ad274[_0x7995('0x65')](_0x29e0ee[_0x7995('0x40')][_0x7995('0x60')]);}})[_0x7995('0x24')](respondWithStatusCode(_0x117317,null))[_0x7995('0x2c')](handleError(_0x117317,null));};exports[_0x7995('0x66')]=function(_0x280fbb,_0x260ef1,_0x33479a){if(_0x280fbb[_0x7995('0x57')]['id']){delete _0x280fbb[_0x7995('0x57')]['id'];}return db['ChatGroup'][_0x7995('0x58')]({'where':{'id':_0x280fbb[_0x7995('0x53')]['id']}})['then'](handleEntityNotFound(_0x260ef1,null))['then'](function(_0x15e8d1){if(_0x15e8d1){_0x280fbb[_0x7995('0x57')][_0x7995('0x67')]=_0x15e8d1['id'];return db[_0x7995('0x5c')][_0x7995('0x56')](_0x280fbb[_0x7995('0x57')]);}})['then'](respondWithResult(_0x260ef1,null))[_0x7995('0x2c')](handleError(_0x260ef1,null));};exports[_0x7995('0x68')]=function(_0x3fea6a,_0x77b03f,_0x7d9c6e){var _0x3f0bff={};var _0x151d99={};var _0xc93dcb;var _0x560095;return db[_0x7995('0x39')][_0x7995('0x62')]({'where':{'id':_0x3fea6a['params']['id']}})['then'](handleEntityNotFound(_0x77b03f,null))[_0x7995('0x24')](function(_0xf8c2ed){if(_0xf8c2ed){_0xc93dcb=_0xf8c2ed;_0x151d99[_0x7995('0x3e')]=_[_0x7995('0x3f')](db[_0x7995('0x5c')]['rawAttributes']);_0x151d99[_0x7995('0x40')]=_[_0x7995('0x3f')](_0x3fea6a['query']);_0x151d99[_0x7995('0x41')]=_[_0x7995('0x42')](_0x151d99['model'],_0x151d99[_0x7995('0x40')]);_0x3f0bff['attributes']=_[_0x7995('0x42')](_0x151d99[_0x7995('0x3e')],qs[_0x7995('0x44')](_0x3fea6a[_0x7995('0x40')][_0x7995('0x44')]));_0x3f0bff['attributes']=_0x3f0bff[_0x7995('0x43')][_0x7995('0x54')]?_0x3f0bff[_0x7995('0x43')]:_0x151d99['model'];_0x3f0bff[_0x7995('0x47')]=qs[_0x7995('0x48')](_0x3fea6a[_0x7995('0x40')][_0x7995('0x48')]);_0x3f0bff['where']=qs[_0x7995('0x41')](_[_0x7995('0x4a')](_0x3fea6a[_0x7995('0x40')],_0x151d99['filters']));if(_0x3fea6a['query'][_0x7995('0x4b')]){_0x3f0bff[_0x7995('0x49')]=_['merge'](_0x3f0bff['where'],{'$or':_[_0x7995('0x38')](_0x3f0bff[_0x7995('0x43')],function(_0xcdbd2a){var _0x2384c1={};_0x2384c1[_0xcdbd2a]={'$like':'%'+_0x3fea6a[_0x7995('0x40')]['filter']+'%'};return _0x2384c1;})});}if(_0x3fea6a['query'][_0x7995('0x69')]){var _0x54fad4=_0x3fea6a['query'][_0x7995('0x69')][_0x7995('0x6a')](',');var _0x3192b8={};_0x3192b8[_0x54fad4[0x0]]={'$gte':moment(_0x54fad4[0x1])['format'](_0x7995('0x6b'))};_0x3f0bff[_0x7995('0x49')]=_[_0x7995('0x55')](_0x3f0bff[_0x7995('0x49')],_0x3192b8);}_0x3f0bff=_[_0x7995('0x55')]({},_0x3f0bff,_0x3fea6a['options']);return _0xc93dcb[_0x7995('0x68')](_0x3f0bff);}})[_0x7995('0x24')](function(_0x1a2d6a){if(_0x1a2d6a){_0x560095=_0x1a2d6a[_0x7995('0x54')];if(!_0x3fea6a['query'][_0x7995('0x64')](_0x7995('0x45'))){_0x3f0bff['limit']=qs[_0x7995('0x31')](_0x3fea6a[_0x7995('0x40')]['limit']);_0x3f0bff[_0x7995('0x46')]=qs['offset'](_0x3fea6a[_0x7995('0x40')]['offset']);}return _0xc93dcb[_0x7995('0x68')](_0x3f0bff);}})['then'](function(_0xa97c08){if(_0xa97c08){return _0xa97c08?{'count':_0x560095,'rows':_0xa97c08}:null;}})[_0x7995('0x24')](respondWithResult(_0x77b03f,null))['catch'](handleError(_0x77b03f,null));}; \ No newline at end of file +var _0xa9e0=['socket.io-emitter','./chatGroup.socket','register','jayson/promise','client','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','then','end','stack','name','index','ChatGroup','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','include','findAll','rows','show','params','find','create','body','update','describe','getUnread','ChatInternalMessage','user','addMembers','ids','getMembers','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x3c8499,_0x1e052e){var _0x51d346=function(_0x311729){while(--_0x311729){_0x3c8499['push'](_0x3c8499['shift']());}};_0x51d346(++_0x1e052e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var fs_extra=require(_0x0a9e('0xa'));var _=require(_0x0a9e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0a9e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0a9e('0xd'));var Papa=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var licenseUtil=require(_0x0a9e('0x14'));var db=require(_0x0a9e('0x15'))['db'];config[_0x0a9e('0x16')]=_[_0x0a9e('0x17')](config[_0x0a9e('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0x18'))(new Redis(config[_0x0a9e('0x16')]));require(_0x0a9e('0x19'))[_0x0a9e('0x1a')](socket);var jayson=require(_0x0a9e('0x1b'));var client=jayson[_0x0a9e('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22dccb,_0x5d0880,_0x1985b6,_0x519dfd){return new BPromise(function(_0x16033c,_0x12066b){var _0x48f32d=_0x519dfd||client;return _0x48f32d[_0x0a9e('0x1d')](_0x22dccb,_0x1985b6)['then'](function(_0x459eb1){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x5d0880,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x5d0880,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x459eb1));if(_0x459eb1[_0x0a9e('0x24')]){if(_0x459eb1[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger[_0x0a9e('0x24')]('ChatGroup,\x20%s,\x20%s',_0x5d0880,_0x459eb1[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x12066b(_0x459eb1['error'][_0x0a9e('0x26')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x5d0880,_0x459eb1[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x16033c(_0x459eb1[_0x0a9e('0x24')][_0x0a9e('0x26')]);}else{logger['info'](_0x0a9e('0x1f'),_0x5d0880,_0x0a9e('0x20'));_0x16033c(_0x459eb1[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x42ac8f){logger[_0x0a9e('0x24')]('ChatGroup,\x20%s,\x20%s',_0x5d0880,_0x42ac8f);_0x12066b(_0x42ac8f);});});}function respondWithStatusCode(_0x59181e,_0x197ec0){_0x197ec0=_0x197ec0||0xcc;return function(_0x3a8e58){if(_0x3a8e58){return _0x59181e[_0x0a9e('0x29')](_0x197ec0);}return _0x59181e[_0x0a9e('0x2a')](_0x197ec0)['end']();};}function respondWithResult(_0x384319,_0x479bc4){_0x479bc4=_0x479bc4||0xc8;return function(_0x45a1e7){if(_0x45a1e7){return _0x384319['status'](_0x479bc4)[_0x0a9e('0x2b')](_0x45a1e7);}};}function respondWithFilteredResult(_0x34dc65,_0x25fba9){return function(_0x14433c){if(_0x14433c){var _0x140511=_0x14433c['count'],_0x1538a4=_0x25fba9[_0x0a9e('0x2c')],_0x11c3b6=_0x25fba9[_0x0a9e('0x2c')]+_0x25fba9[_0x0a9e('0x2d')],_0x14de77;if(_0x11c3b6>=_0x140511){_0x11c3b6=_0x140511;_0x14de77=0xc8;}else{_0x14de77=0xce;}_0x34dc65[_0x0a9e('0x2a')](_0x14de77);return _0x34dc65['set'](_0x0a9e('0x2e'),_0x1538a4+'-'+_0x11c3b6+'/'+_0x140511)[_0x0a9e('0x2b')](_0x14433c);}return null;};}function patchUpdates(_0x1843b2){return function(_0x824a4f){try{jsonpatch[_0x0a9e('0x2f')](_0x824a4f,_0x1843b2,!![]);}catch(_0x563b45){return BPromise[_0x0a9e('0x30')](_0x563b45);}return _0x824a4f[_0x0a9e('0x31')]();};}function saveUpdates(_0x1dbde2,_0x540530){return function(_0x426950){if(_0x426950){return _0x426950['update'](_0x1dbde2)[_0x0a9e('0x32')](function(_0x3ae878){return _0x3ae878;});}return null;};}function removeEntity(_0x1122db,_0x33bdb7){return function(_0x25ce3a){if(_0x25ce3a){return _0x25ce3a['destroy']()[_0x0a9e('0x32')](function(){_0x1122db[_0x0a9e('0x2a')](0xcc)[_0x0a9e('0x33')]();});}};}function handleEntityNotFound(_0x2da5c0,_0x2b45ea){return function(_0x409319){if(!_0x409319){_0x2da5c0[_0x0a9e('0x29')](0x194);}return _0x409319;};}function handleError(_0x39e565,_0x5583a4){_0x5583a4=_0x5583a4||0x1f4;return function(_0x44295a){logger['error'](_0x44295a[_0x0a9e('0x34')]);if(_0x44295a[_0x0a9e('0x35')]){delete _0x44295a[_0x0a9e('0x35')];}_0x39e565[_0x0a9e('0x2a')](_0x5583a4)['send'](_0x44295a);};}exports[_0x0a9e('0x36')]=function(_0xd1836d,_0x1fa90d){var _0x15de0e={},_0x4853b1={},_0x54135e={'count':0x0,'rows':[]};var _0x1e8694=_['map'](db[_0x0a9e('0x37')][_0x0a9e('0x38')],function(_0x381c37){return{'name':_0x381c37[_0x0a9e('0x39')],'type':_0x381c37['type'][_0x0a9e('0x3a')]};});_0x4853b1[_0x0a9e('0x3b')]=_[_0x0a9e('0x3c')](_0x1e8694,'name');_0x4853b1[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](_0xd1836d[_0x0a9e('0x3d')]);_0x4853b1['filters']=_['intersection'](_0x4853b1[_0x0a9e('0x3b')],_0x4853b1[_0x0a9e('0x3d')]);_0x15de0e['attributes']=_[_0x0a9e('0x3f')](_0x4853b1[_0x0a9e('0x3b')],qs[_0x0a9e('0x40')](_0xd1836d[_0x0a9e('0x3d')]['fields']));_0x15de0e['attributes']=_0x15de0e[_0x0a9e('0x41')][_0x0a9e('0x42')]?_0x15de0e['attributes']:_0x4853b1[_0x0a9e('0x3b')];if(!_0xd1836d[_0x0a9e('0x3d')][_0x0a9e('0x43')]('nolimit')){_0x15de0e[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0xd1836d[_0x0a9e('0x3d')][_0x0a9e('0x2d')]);_0x15de0e[_0x0a9e('0x2c')]=qs[_0x0a9e('0x2c')](_0xd1836d[_0x0a9e('0x3d')][_0x0a9e('0x2c')]);}_0x15de0e[_0x0a9e('0x44')]=qs[_0x0a9e('0x45')](_0xd1836d[_0x0a9e('0x3d')][_0x0a9e('0x45')]);_0x15de0e[_0x0a9e('0x46')]=qs[_0x0a9e('0x47')](_[_0x0a9e('0x48')](_0xd1836d['query'],_0x4853b1['filters']),_0x1e8694);if(_0xd1836d[_0x0a9e('0x3d')][_0x0a9e('0x49')]){_0x15de0e[_0x0a9e('0x46')]=_[_0x0a9e('0x4a')](_0x15de0e[_0x0a9e('0x46')],{'$or':_[_0x0a9e('0x3c')](_0x1e8694,function(_0x10b040){if(_0x10b040[_0x0a9e('0x4b')]!==_0x0a9e('0x4c')){var _0x25c6e6={};_0x25c6e6[_0x10b040[_0x0a9e('0x35')]]={'$like':'%'+_0xd1836d[_0x0a9e('0x3d')]['filter']+'%'};return _0x25c6e6;}})});}_0x15de0e=_[_0x0a9e('0x4a')]({},_0x15de0e,_0xd1836d[_0x0a9e('0x4d')]);var _0xdd268f={'where':_0x15de0e[_0x0a9e('0x46')]};return db[_0x0a9e('0x37')][_0x0a9e('0x4e')](_0xdd268f)[_0x0a9e('0x32')](function(_0x44dd99){_0x54135e['count']=_0x44dd99;if(_0xd1836d[_0x0a9e('0x3d')]['includeAll']){_0x15de0e[_0x0a9e('0x4f')]=[{'all':!![]}];}return db[_0x0a9e('0x37')][_0x0a9e('0x50')](_0x15de0e);})['then'](function(_0x14bec2){_0x54135e[_0x0a9e('0x51')]=_0x14bec2;return _0x54135e;})[_0x0a9e('0x32')](respondWithFilteredResult(_0x1fa90d,_0x15de0e))[_0x0a9e('0x28')](handleError(_0x1fa90d,null));};exports[_0x0a9e('0x52')]=function(_0x37be73,_0x45bf7f){var _0x5bbcde={'raw':!![],'where':{'id':_0x37be73[_0x0a9e('0x53')]['id']}},_0x13f44d={};_0x13f44d[_0x0a9e('0x3b')]=_[_0x0a9e('0x3e')](db[_0x0a9e('0x37')][_0x0a9e('0x38')]);_0x13f44d[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](_0x37be73[_0x0a9e('0x3d')]);_0x13f44d['filters']=_[_0x0a9e('0x3f')](_0x13f44d[_0x0a9e('0x3b')],_0x13f44d['query']);_0x5bbcde['attributes']=_['intersection'](_0x13f44d[_0x0a9e('0x3b')],qs[_0x0a9e('0x40')](_0x37be73[_0x0a9e('0x3d')][_0x0a9e('0x40')]));_0x5bbcde[_0x0a9e('0x41')]=_0x5bbcde[_0x0a9e('0x41')][_0x0a9e('0x42')]?_0x5bbcde[_0x0a9e('0x41')]:_0x13f44d['model'];if(_0x37be73['query']['includeAll']){_0x5bbcde[_0x0a9e('0x4f')]=[{'all':!![]}];}_0x5bbcde=_[_0x0a9e('0x4a')]({},_0x5bbcde,_0x37be73[_0x0a9e('0x4d')]);return db['ChatGroup'][_0x0a9e('0x54')](_0x5bbcde)[_0x0a9e('0x32')](handleEntityNotFound(_0x45bf7f,null))['then'](respondWithResult(_0x45bf7f,null))['catch'](handleError(_0x45bf7f,null));};exports[_0x0a9e('0x55')]=function(_0x59c6ff,_0x443e72){return db['ChatGroup'][_0x0a9e('0x55')](_0x59c6ff[_0x0a9e('0x56')],{})[_0x0a9e('0x32')](respondWithResult(_0x443e72,0xc9))['catch'](handleError(_0x443e72,null));};exports[_0x0a9e('0x57')]=function(_0x1bf38a,_0x508b47){if(_0x1bf38a['body']['id']){delete _0x1bf38a[_0x0a9e('0x56')]['id'];}return db[_0x0a9e('0x37')]['find']({'where':{'id':_0x1bf38a[_0x0a9e('0x53')]['id']}})['then'](handleEntityNotFound(_0x508b47,null))[_0x0a9e('0x32')](saveUpdates(_0x1bf38a['body'],null))[_0x0a9e('0x32')](respondWithResult(_0x508b47,null))['catch'](handleError(_0x508b47,null));};exports['destroy']=function(_0x5df0ad,_0x2da03c){return db['ChatGroup'][_0x0a9e('0x54')]({'where':{'id':_0x5df0ad[_0x0a9e('0x53')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x2da03c,null))[_0x0a9e('0x32')](removeEntity(_0x2da03c,null))[_0x0a9e('0x28')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x58')]=function(_0xd10662,_0x28d814){return db['ChatGroup'][_0x0a9e('0x58')]()[_0x0a9e('0x32')](respondWithResult(_0x28d814,null))[_0x0a9e('0x28')](handleError(_0x28d814,null));};exports[_0x0a9e('0x59')]=function(_0xb83dfd,_0x156662,_0x5d86e9){return db[_0x0a9e('0x5a')][_0x0a9e('0x4e')]({'where':{'ChatGroupId':_0xb83dfd['params']['id'],'ToId':_0xb83dfd[_0x0a9e('0x5b')]['id'],'read':![]}})['then'](function(_0x20c668){return{'id':_['toInteger'](_0xb83dfd['params']['id']),'count':_0x20c668};})['then'](respondWithResult(_0x156662,null))[_0x0a9e('0x28')](handleError(_0x156662,null));};exports['addMembers']=function(_0x2244d6,_0x1fc70e,_0x261adb){return db[_0x0a9e('0x37')][_0x0a9e('0x54')]({'where':{'id':_0x2244d6[_0x0a9e('0x53')]['id']}})['then'](handleEntityNotFound(_0x1fc70e,null))[_0x0a9e('0x32')](function(_0x5854cc){if(_0x5854cc){return _0x5854cc[_0x0a9e('0x5c')](_0x2244d6[_0x0a9e('0x56')][_0x0a9e('0x5d')],_['omit'](_0x2244d6[_0x0a9e('0x56')],[_0x0a9e('0x5d'),'id'])||{});}})[_0x0a9e('0x32')](respondWithResult(_0x1fc70e,null))[_0x0a9e('0x28')](handleError(_0x1fc70e,null));};exports['getMembers']=function(_0x1d0dc8,_0xe05a5a,_0x54327c){var _0x797b45={};var _0x17e88c={};var _0x88dcbf;var _0x409b29;return db[_0x0a9e('0x37')]['findOne']({'where':{'id':_0x1d0dc8[_0x0a9e('0x53')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0xe05a5a,null))[_0x0a9e('0x32')](function(_0x47bb43){if(_0x47bb43){_0x88dcbf=_0x47bb43;_0x17e88c[_0x0a9e('0x3b')]=_['keys'](db['User'][_0x0a9e('0x38')]);_0x17e88c[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](_0x1d0dc8[_0x0a9e('0x3d')]);_0x17e88c[_0x0a9e('0x47')]=_[_0x0a9e('0x3f')](_0x17e88c[_0x0a9e('0x3b')],_0x17e88c[_0x0a9e('0x3d')]);_0x797b45[_0x0a9e('0x41')]=_[_0x0a9e('0x3f')](_0x17e88c[_0x0a9e('0x3b')],qs[_0x0a9e('0x40')](_0x1d0dc8[_0x0a9e('0x3d')][_0x0a9e('0x40')]));_0x797b45[_0x0a9e('0x41')]=_0x797b45[_0x0a9e('0x41')][_0x0a9e('0x42')]?_0x797b45[_0x0a9e('0x41')]:_0x17e88c['model'];_0x797b45[_0x0a9e('0x44')]=qs[_0x0a9e('0x45')](_0x1d0dc8[_0x0a9e('0x3d')]['sort']);_0x797b45[_0x0a9e('0x46')]=qs[_0x0a9e('0x47')](_['pick'](_0x1d0dc8[_0x0a9e('0x3d')],_0x17e88c[_0x0a9e('0x47')]));if(_0x1d0dc8[_0x0a9e('0x3d')][_0x0a9e('0x49')]){_0x797b45[_0x0a9e('0x46')]=_['merge'](_0x797b45['where'],{'$or':_['map'](_0x797b45[_0x0a9e('0x41')],function(_0x18bf5d){var _0x1104ad={};_0x1104ad[_0x18bf5d]={'$like':'%'+_0x1d0dc8[_0x0a9e('0x3d')][_0x0a9e('0x49')]+'%'};return _0x1104ad;})});}_0x797b45=_[_0x0a9e('0x4a')]({},_0x797b45,_0x1d0dc8[_0x0a9e('0x4d')]);return _0x88dcbf[_0x0a9e('0x5e')](_0x797b45);}})['then'](function(_0x235f8f){if(_0x235f8f){_0x409b29=_0x235f8f[_0x0a9e('0x42')];if(!_0x1d0dc8[_0x0a9e('0x3d')]['hasOwnProperty'](_0x0a9e('0x5f'))){_0x797b45['limit']=qs[_0x0a9e('0x2d')](_0x1d0dc8[_0x0a9e('0x3d')]['limit']);_0x797b45[_0x0a9e('0x2c')]=qs[_0x0a9e('0x2c')](_0x1d0dc8[_0x0a9e('0x3d')][_0x0a9e('0x2c')]);}return _0x88dcbf['getMembers'](_0x797b45);}})[_0x0a9e('0x32')](function(_0x2e9552){if(_0x2e9552){return _0x2e9552?{'count':_0x409b29,'rows':_0x2e9552}:null;}})[_0x0a9e('0x32')](respondWithResult(_0xe05a5a,null))[_0x0a9e('0x28')](handleError(_0xe05a5a,null));};exports['removeMembers']=function(_0x109ccb,_0x3d91db,_0x2d5506){return db[_0x0a9e('0x37')]['find']({'where':{'id':_0x109ccb[_0x0a9e('0x53')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x3d91db,null))[_0x0a9e('0x32')](function(_0xf410e5){if(_0xf410e5){return _0xf410e5[_0x0a9e('0x60')](_0x109ccb[_0x0a9e('0x3d')][_0x0a9e('0x5d')]);}})[_0x0a9e('0x32')](respondWithStatusCode(_0x3d91db,null))[_0x0a9e('0x28')](handleError(_0x3d91db,null));};exports[_0x0a9e('0x61')]=function(_0xc4c230,_0x1f10ef,_0x25744a){if(_0xc4c230[_0x0a9e('0x56')]['id']){delete _0xc4c230['body']['id'];}return db[_0x0a9e('0x37')][_0x0a9e('0x54')]({'where':{'id':_0xc4c230[_0x0a9e('0x53')]['id']}})['then'](handleEntityNotFound(_0x1f10ef,null))[_0x0a9e('0x32')](function(_0x33dda0){if(_0x33dda0){_0xc4c230[_0x0a9e('0x56')][_0x0a9e('0x62')]=_0x33dda0['id'];return db['ChatInternalMessage']['create'](_0xc4c230[_0x0a9e('0x56')]);}})[_0x0a9e('0x32')](respondWithResult(_0x1f10ef,null))['catch'](handleError(_0x1f10ef,null));};exports[_0x0a9e('0x63')]=function(_0x53a6a1,_0x260f4b,_0x8ebf02){var _0x5637a1={};var _0x28a942={};var _0x41cf12;var _0x2d2286;return db[_0x0a9e('0x37')][_0x0a9e('0x64')]({'where':{'id':_0x53a6a1[_0x0a9e('0x53')]['id']}})[_0x0a9e('0x32')](handleEntityNotFound(_0x260f4b,null))['then'](function(_0x2973d3){if(_0x2973d3){_0x41cf12=_0x2973d3;_0x28a942[_0x0a9e('0x3b')]=_[_0x0a9e('0x3e')](db[_0x0a9e('0x5a')]['rawAttributes']);_0x28a942[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](_0x53a6a1['query']);_0x28a942[_0x0a9e('0x47')]=_['intersection'](_0x28a942[_0x0a9e('0x3b')],_0x28a942[_0x0a9e('0x3d')]);_0x5637a1[_0x0a9e('0x41')]=_[_0x0a9e('0x3f')](_0x28a942['model'],qs['fields'](_0x53a6a1[_0x0a9e('0x3d')][_0x0a9e('0x40')]));_0x5637a1[_0x0a9e('0x41')]=_0x5637a1['attributes'][_0x0a9e('0x42')]?_0x5637a1[_0x0a9e('0x41')]:_0x28a942['model'];_0x5637a1['order']=qs[_0x0a9e('0x45')](_0x53a6a1['query']['sort']);_0x5637a1['where']=qs[_0x0a9e('0x47')](_[_0x0a9e('0x48')](_0x53a6a1[_0x0a9e('0x3d')],_0x28a942[_0x0a9e('0x47')]));if(_0x53a6a1[_0x0a9e('0x3d')][_0x0a9e('0x49')]){_0x5637a1['where']=_[_0x0a9e('0x4a')](_0x5637a1['where'],{'$or':_[_0x0a9e('0x3c')](_0x5637a1[_0x0a9e('0x41')],function(_0x18ad56){var _0x4566b0={};_0x4566b0[_0x18ad56]={'$like':'%'+_0x53a6a1['query'][_0x0a9e('0x49')]+'%'};return _0x4566b0;})});}if(_0x53a6a1[_0x0a9e('0x3d')][_0x0a9e('0x65')]){var _0x5b74c3=_0x53a6a1[_0x0a9e('0x3d')][_0x0a9e('0x65')][_0x0a9e('0x66')](',');var _0x22063c={};_0x22063c[_0x5b74c3[0x0]]={'$gte':moment(_0x5b74c3[0x1])[_0x0a9e('0x67')](_0x0a9e('0x68'))};_0x5637a1[_0x0a9e('0x46')]=_[_0x0a9e('0x4a')](_0x5637a1['where'],_0x22063c);}_0x5637a1=_[_0x0a9e('0x4a')]({},_0x5637a1,_0x53a6a1[_0x0a9e('0x4d')]);return _0x41cf12['getMessages'](_0x5637a1);}})[_0x0a9e('0x32')](function(_0x982340){if(_0x982340){_0x2d2286=_0x982340[_0x0a9e('0x42')];if(!_0x53a6a1['query'][_0x0a9e('0x43')]('nolimit')){_0x5637a1[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x53a6a1[_0x0a9e('0x3d')][_0x0a9e('0x2d')]);_0x5637a1[_0x0a9e('0x2c')]=qs[_0x0a9e('0x2c')](_0x53a6a1[_0x0a9e('0x3d')][_0x0a9e('0x2c')]);}return _0x41cf12['getMessages'](_0x5637a1);}})[_0x0a9e('0x32')](function(_0x31d25a){if(_0x31d25a){return _0x31d25a?{'count':_0x2d2286,'rows':_0x31d25a}:null;}})[_0x0a9e('0x32')](respondWithResult(_0x260f4b,null))[_0x0a9e('0x28')](handleError(_0x260f4b,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 752a94c..f7698c5 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 _0xdb28=['ChatGroup','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x2c5b59,_0x4901d7){var _0x5f2dc6=function(_0x43a6e0){while(--_0x43a6e0){_0x2c5b59['push'](_0x2c5b59['shift']());}};_0x5f2dc6(++_0x4901d7);}(_0xdb28,0x106));var _0x8db2=function(_0x40bf0f,_0x1691a7){_0x40bf0f=_0x40bf0f-0x0;var _0x3d29c6=_0xdb28[_0x40bf0f];return _0x3d29c6;};'use strict';var EventEmitter=require(_0x8db2('0x0'));var ChatGroup=require(_0x8db2('0x1'))['db'][_0x8db2('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x8db2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8db2('0x4'),'afterDestroy':_0x8db2('0x5')};function emitEvent(_0xfcf49f){return function(_0x4426fe,_0x11109e,_0x52bf99){ChatGroupEvents[_0x8db2('0x6')](_0xfcf49f+':'+_0x4426fe['id'],_0x4426fe);ChatGroupEvents[_0x8db2('0x6')](_0xfcf49f,_0x4426fe);_0x52bf99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x8db2('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x38d243,_0x3f2062){var _0x347634=function(_0x342e3f){while(--_0x342e3f){_0x38d243['push'](_0x38d243['shift']());}};_0x347634(++_0x3f2062);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5f66[_0x2b4411];return _0x8e41ef;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x65f6('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){ChatGroupEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);ChatGroupEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index c3f902e..836dc77 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 _0xe002=['request-promise','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','lodash','util','../../config/logger','moment','bluebird'];(function(_0x42177d,_0x1a5934){var _0x464915=function(_0x5c7abd){while(--_0x5c7abd){_0x42177d['push'](_0x42177d['shift']());}};_0x464915(++_0x1a5934);}(_0xe002,0xf7));var _0x2e00=function(_0x529abc,_0x17b97e){_0x529abc=_0x529abc-0x0;var _0x453afa=_0xe002[_0x529abc];return _0x453afa;};'use strict';var _=require(_0x2e00('0x0'));var util=require(_0x2e00('0x1'));var logger=require(_0x2e00('0x2'))('api');var moment=require(_0x2e00('0x3'));var BPromise=require(_0x2e00('0x4'));var rp=require(_0x2e00('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e00('0x6'));var config=require(_0x2e00('0x7'));var attributes=require(_0x2e00('0x8'));module[_0x2e00('0x9')]=function(_0x3cd8e8,_0x120155){return _0x3cd8e8[_0x2e00('0xa')](_0x2e00('0xb'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeedf=['exports','define','chat_groups','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xeedf,0x12c));var _0xfeed=function(_0x3d5b2c,_0x181a6c){_0x3d5b2c=_0x3d5b2c-0x0;var _0x1b4d86=_0xeedf[_0x3d5b2c];return _0x1b4d86;};'use strict';var _=require(_0xfeed('0x0'));var util=require(_0xfeed('0x1'));var logger=require(_0xfeed('0x2'))('api');var moment=require(_0xfeed('0x3'));var BPromise=require('bluebird');var rp=require(_0xfeed('0x4'));var fs=require('fs');var path=require(_0xfeed('0x5'));var rimraf=require(_0xfeed('0x6'));var config=require(_0xfeed('0x7'));var attributes=require('./chatGroup.attributes');module[_0xfeed('0x8')]=function(_0x2c211d,_0x5df4fe){return _0x2c211d[_0xfeed('0x9')]('ChatGroup',attributes,{'tableName':_0xfeed('0xa'),'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 a195717..c995601 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 _0x2d34=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x442c22,_0x596fa5){var _0xf233e5=function(_0x527435){while(--_0x527435){_0x442c22['push'](_0x442c22['shift']());}};_0xf233e5(++_0x596fa5);}(_0x2d34,0x66));var _0x42d3=function(_0x520635,_0x193d6e){_0x520635=_0x520635-0x0;var _0xc0344d=_0x2d34[_0x520635];return _0xc0344d;};'use strict';var _=require(_0x42d3('0x0'));var util=require(_0x42d3('0x1'));var moment=require(_0x42d3('0x2'));var BPromise=require(_0x42d3('0x3'));var rs=require(_0x42d3('0x4'));var fs=require('fs');var Redis=require(_0x42d3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x42d3('0x6'));var logger=require(_0x42d3('0x7'))(_0x42d3('0x8'));var config=require(_0x42d3('0x9'));var jayson=require(_0x42d3('0xa'));var client=jayson[_0x42d3('0xb')][_0x42d3('0xc')]({'port':0x232a});config[_0x42d3('0xd')]=_[_0x42d3('0xe')](config[_0x42d3('0xd')],{'host':_0x42d3('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x42d3('0xd')]));require('./chatGroup.socket')[_0x42d3('0x10')](socket);function respondWithRpcPromise(_0x20b50b,_0x39248f,_0x103ae8){return new BPromise(function(_0x20842f,_0x3100d8){return client['request'](_0x20b50b,_0x103ae8)['then'](function(_0x5a2096){logger[_0x42d3('0x11')](_0x42d3('0x12'),_0x39248f,'request\x20sent');logger[_0x42d3('0x13')](_0x42d3('0x14'),_0x39248f,'request\x20sent',JSON[_0x42d3('0x15')](_0x5a2096));if(_0x5a2096['error']){if(_0x5a2096[_0x42d3('0x16')][_0x42d3('0x17')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x39248f,_0x5a2096['error'][_0x42d3('0x18')]);return _0x3100d8(_0x5a2096[_0x42d3('0x16')]['message']);}logger['error'](_0x42d3('0x12'),_0x39248f,_0x5a2096['error'][_0x42d3('0x18')]);return _0x20842f(_0x5a2096[_0x42d3('0x16')][_0x42d3('0x18')]);}else{logger[_0x42d3('0x11')](_0x42d3('0x12'),_0x39248f,_0x42d3('0x19'));_0x20842f(_0x5a2096['result']['message']);}})[_0x42d3('0x1a')](function(_0x3cf830){logger[_0x42d3('0x16')]('ChatGroup,\x20%s,\x20%s',_0x39248f,_0x3cf830);_0x3100d8(_0x3cf830);});});} \ No newline at end of file +var _0x7e25=['socket.io-emitter','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','localhost'];(function(_0x5dfbd0,_0x201eb2){var _0x57cb5c=function(_0x36a5c0){while(--_0x36a5c0){_0x5dfbd0['push'](_0x5dfbd0['shift']());}};_0x57cb5c(++_0x201eb2);}(_0x7e25,0x1ef));var _0x57e2=function(_0x10791d,_0x2562b6){_0x10791d=_0x10791d-0x0;var _0x1b4f9c=_0x7e25[_0x10791d];return _0x1b4f9c;};'use strict';var _=require('lodash');var util=require(_0x57e2('0x0'));var moment=require(_0x57e2('0x1'));var BPromise=require(_0x57e2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x57e2('0x3'));var db=require(_0x57e2('0x4'))['db'];var utils=require(_0x57e2('0x5'));var logger=require(_0x57e2('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x57e2('0x7')][_0x57e2('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x57e2('0x9')],{'host':_0x57e2('0xa'),'port':0x18eb});var socket=require(_0x57e2('0xb'))(new Redis(config[_0x57e2('0x9')]));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0xb73b33,_0x3b1725,_0x56ae80){return new BPromise(function(_0x1e09e6,_0x5cc832){return client[_0x57e2('0xc')](_0xb73b33,_0x56ae80)[_0x57e2('0xd')](function(_0x1ad638){logger[_0x57e2('0xe')](_0x57e2('0xf'),_0x3b1725,_0x57e2('0x10'));logger[_0x57e2('0x11')](_0x57e2('0x12'),_0x3b1725,_0x57e2('0x10'),JSON[_0x57e2('0x13')](_0x1ad638));if(_0x1ad638[_0x57e2('0x14')]){if(_0x1ad638['error']['code']===0x1f4){logger[_0x57e2('0x14')]('ChatGroup,\x20%s,\x20%s',_0x3b1725,_0x1ad638[_0x57e2('0x14')][_0x57e2('0x15')]);return _0x5cc832(_0x1ad638['error'][_0x57e2('0x15')]);}logger[_0x57e2('0x14')](_0x57e2('0xf'),_0x3b1725,_0x1ad638[_0x57e2('0x14')][_0x57e2('0x15')]);return _0x1e09e6(_0x1ad638[_0x57e2('0x14')]['message']);}else{logger[_0x57e2('0xe')](_0x57e2('0xf'),_0x3b1725,'request\x20sent');_0x1e09e6(_0x1ad638[_0x57e2('0x16')][_0x57e2('0x15')]);}})['catch'](function(_0x262289){logger[_0x57e2('0x14')]('ChatGroup,\x20%s,\x20%s',_0x3b1725,_0x262289);_0x5cc832(_0x262289);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 6a123f7..fbdd224 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 _0x8a56=['register','chatGroup:','./chatGroup.events','save','remove','emit','removeListener'];(function(_0x1922d2,_0x224ada){var _0x268072=function(_0x2838f9){while(--_0x2838f9){_0x1922d2['push'](_0x1922d2['shift']());}};_0x268072(++_0x224ada);}(_0x8a56,0x9c));var _0x68a5=function(_0x1778e1,_0x3e1727){_0x1778e1=_0x1778e1-0x0;var _0x2bc4c6=_0x8a56[_0x1778e1];return _0x2bc4c6;};'use strict';var ChatGroupEvents=require(_0x68a5('0x0'));var events=[_0x68a5('0x1'),_0x68a5('0x2'),'update'];function createListener(_0x3d3f08,_0x5089e6){return function(_0x2f4c0b){_0x5089e6[_0x68a5('0x3')](_0x3d3f08,_0x2f4c0b);};}function removeListener(_0x32f770,_0x35f98c){return function(){ChatGroupEvents[_0x68a5('0x4')](_0x32f770,_0x35f98c);};}exports[_0x68a5('0x5')]=function(_0x409395){for(var _0x1785e5=0x0,_0x796852=events['length'];_0x1785e5<_0x796852;_0x1785e5++){var _0x3ad0c5=events[_0x1785e5];var _0x4eca2a=createListener(_0x68a5('0x6')+_0x3ad0c5,_0x409395);ChatGroupEvents['on'](_0x3ad0c5,_0x4eca2a);}}; \ No newline at end of file +var _0x20ad=['chatGroup:','save','update','emit','removeListener','register','length'];(function(_0x4191dc,_0x486474){var _0x37707d=function(_0x305a2c){while(--_0x305a2c){_0x4191dc['push'](_0x4191dc['shift']());}};_0x37707d(++_0x486474);}(_0x20ad,0x94));var _0xd20a=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x20ad[_0x381589];return _0x2a075d;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xd20a('0x0'),'remove',_0xd20a('0x1')];function createListener(_0x1c9ac5,_0x2820fe){return function(_0x116f4b){_0x2820fe[_0xd20a('0x2')](_0x1c9ac5,_0x116f4b);};}function removeListener(_0x4d4b61,_0x528c20){return function(){ChatGroupEvents[_0xd20a('0x3')](_0x4d4b61,_0x528c20);};}exports[_0xd20a('0x4')]=function(_0x3fc820){for(var _0x53e1f7=0x0,_0x3d49b2=events[_0xd20a('0x5')];_0x53e1f7<_0x3d49b2;_0x53e1f7++){var _0x5819e8=events[_0x53e1f7];var _0x5303bd=createListener(_0xd20a('0x6')+_0x5819e8,_0x3fc820);ChatGroupEvents['on'](_0x5819e8,_0x5303bd);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 7183d65..04d39ea 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 _0xa046=['/describe','/:id','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','addMembers','post','addMessage','update','delete','destroy','removeMembers','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index'];(function(_0x142ec2,_0x5bb03d){var _0x45ef4e=function(_0x4bc513){while(--_0x4bc513){_0x142ec2['push'](_0x142ec2['shift']());}};_0x45ef4e(++_0x5bb03d);}(_0xa046,0xab));var _0x6a04=function(_0x1cb64f,_0x575045){_0x1cb64f=_0x1cb64f-0x0;var _0x2ef3a2=_0xa046[_0x1cb64f];return _0x2ef3a2;};'use strict';var multer=require(_0x6a04('0x0'));var util=require(_0x6a04('0x1'));var path=require(_0x6a04('0x2'));var timeout=require('connect-timeout');var express=require(_0x6a04('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6a04('0x4'));var interaction=require(_0x6a04('0x5'));var config=require(_0x6a04('0x6'));var controller=require(_0x6a04('0x7'));router[_0x6a04('0x8')]('/',auth[_0x6a04('0x9')](),controller[_0x6a04('0xa')]);router[_0x6a04('0x8')](_0x6a04('0xb'),auth[_0x6a04('0x9')](),controller['describe']);router[_0x6a04('0x8')](_0x6a04('0xc'),auth[_0x6a04('0x9')](),controller['show']);router[_0x6a04('0x8')](_0x6a04('0xd'),auth['isAuthenticated'](),controller[_0x6a04('0xe')]);router[_0x6a04('0x8')](_0x6a04('0xf'),auth[_0x6a04('0x9')](),controller[_0x6a04('0x10')]);router[_0x6a04('0x8')](_0x6a04('0x11'),auth[_0x6a04('0x9')](),controller[_0x6a04('0x12')]);router['post']('/',auth[_0x6a04('0x9')](),controller['create']);router['post'](_0x6a04('0xf'),auth['isAuthenticated'](),controller[_0x6a04('0x13')]);router[_0x6a04('0x14')](_0x6a04('0x11'),auth[_0x6a04('0x9')](),controller[_0x6a04('0x15')]);router['put'](_0x6a04('0xc'),auth[_0x6a04('0x9')](),controller[_0x6a04('0x16')]);router[_0x6a04('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x6a04('0x18')]);router[_0x6a04('0x17')](_0x6a04('0xf'),auth['isAuthenticated'](),controller[_0x6a04('0x19')]);module['exports']=router; \ No newline at end of file +var _0xe6b6=['/:id/members','addMembers','update','delete','removeMembers','exports','util','path','express','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','/:id','show','getUnread','getMembers','/:id/messages','getMessages','post','create'];(function(_0x2c2beb,_0x51d1af){var _0x5f392f=function(_0x1fa03e){while(--_0x1fa03e){_0x2c2beb['push'](_0x2c2beb['shift']());}};_0x5f392f(++_0x51d1af);}(_0xe6b6,0x150));var _0x6e6b=function(_0x4343ba,_0x1922e0){_0x4343ba=_0x4343ba-0x0;var _0x8d6f0e=_0xe6b6[_0x4343ba];return _0x8d6f0e;};'use strict';var multer=require('multer');var util=require(_0x6e6b('0x0'));var path=require(_0x6e6b('0x1'));var timeout=require('connect-timeout');var express=require(_0x6e6b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6e6b('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6e6b('0x4'));var controller=require(_0x6e6b('0x5'));router[_0x6e6b('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6e6b('0x6')]('/describe',auth[_0x6e6b('0x7')](),controller['describe']);router['get'](_0x6e6b('0x8'),auth[_0x6e6b('0x7')](),controller[_0x6e6b('0x9')]);router[_0x6e6b('0x6')]('/:id/unread',auth[_0x6e6b('0x7')](),controller[_0x6e6b('0xa')]);router['get']('/:id/members',auth[_0x6e6b('0x7')](),controller[_0x6e6b('0xb')]);router['get'](_0x6e6b('0xc'),auth[_0x6e6b('0x7')](),controller[_0x6e6b('0xd')]);router[_0x6e6b('0xe')]('/',auth[_0x6e6b('0x7')](),controller[_0x6e6b('0xf')]);router[_0x6e6b('0xe')](_0x6e6b('0x10'),auth['isAuthenticated'](),controller[_0x6e6b('0x11')]);router[_0x6e6b('0xe')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router['put'](_0x6e6b('0x8'),auth['isAuthenticated'](),controller[_0x6e6b('0x12')]);router[_0x6e6b('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x6e6b('0x13')](_0x6e6b('0x10'),auth[_0x6e6b('0x7')](),controller[_0x6e6b('0x14')]);module[_0x6e6b('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index acb00d5..edcf43e 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 _0x89c1=['long','DATE','out','exports','BOOLEAN','INTEGER','ENUM','thumb','star','TEXT','STRING'];(function(_0x5982cd,_0x52091b){var _0x107a28=function(_0x535e9b){while(--_0x535e9b){_0x5982cd['push'](_0x5982cd['shift']());}};_0x107a28(++_0x52091b);}(_0x89c1,0x10b));var _0x189c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x89c1[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x189c('0x0')]={'closed':{'type':Sequelize[_0x189c('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x189c('0x2')]},'ratingType':{'type':Sequelize[_0x189c('0x3')]('star',_0x189c('0x4')),'defaultValue':_0x189c('0x5')},'ratingMessage':{'type':Sequelize[_0x189c('0x6')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x189c('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x189c('0x7')]},'secondDisposition':{'type':Sequelize[_0x189c('0x7')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x189c('0x7')]},'browserVersion':{'type':Sequelize[_0x189c('0x7')]},'osName':{'type':Sequelize[_0x189c('0x7')]},'osVersion':{'type':Sequelize[_0x189c('0x7')]},'deviceModel':{'type':Sequelize[_0x189c('0x7')]},'deviceVendor':{'type':Sequelize[_0x189c('0x7')]},'deviceType':{'type':Sequelize[_0x189c('0x7')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x189c('0x7')]},'formData':{'type':Sequelize[_0x189c('0x6')](_0x189c('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x189c('0x9')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x189c('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x189c('0x7')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x189c('0x6')]}}; \ No newline at end of file +var _0xe459=['long','DATE','out','sequelize','exports','BOOLEAN','INTEGER','thumb','TEXT','STRING'];(function(_0x56f736,_0x521360){var _0x47b49e=function(_0x5707d4){while(--_0x5707d4){_0x56f736['push'](_0x56f736['shift']());}};_0x47b49e(++_0x521360);}(_0xe459,0x1cf));var _0x9e45=function(_0x372200,_0x5c484f){_0x372200=_0x372200-0x0;var _0x4de067=_0xe459[_0x372200];return _0x4de067;};'use strict';var Sequelize=require(_0x9e45('0x0'));module[_0x9e45('0x1')]={'closed':{'type':Sequelize[_0x9e45('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x9e45('0x3')]},'ratingType':{'type':Sequelize['ENUM']('star',_0x9e45('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x9e45('0x5')]},'pathTranscript':{'type':Sequelize[_0x9e45('0x5')]},'mailTranscript':{'type':Sequelize[_0x9e45('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x9e45('0x6')]},'secondDisposition':{'type':Sequelize[_0x9e45('0x6')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x9e45('0x6')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x9e45('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x9e45('0x6')]},'deviceModel':{'type':Sequelize[_0x9e45('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x9e45('0x6')]},'referer':{'type':Sequelize[_0x9e45('0x5')]},'customerIp':{'type':Sequelize[_0x9e45('0x6')]},'formData':{'type':Sequelize[_0x9e45('0x5')](_0x9e45('0x7'))},'read1stAt':{'type':Sequelize[_0x9e45('0x8')]},'lastMsgAt':{'type':Sequelize[_0x9e45('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x9e45('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x9e45('0x6')]},'customerPort':{'type':Sequelize[_0x9e45('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x9e45('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 445896a..2d71d6e 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 _0x9fe7=['ChatWebsiteId','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','agent','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.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','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','sequelize','groupBy','ChatInteractionId','push','all','rows','show','params','rawAttributes','fields','includeAll','merge','create','update','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','basename','filename','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','offline-chat/','download','close','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','now','Messages','ChatWebsite','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','direction','secret','MailAccount','MailServerOut','Smtp','service','host','secure','authentication','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','addMessage','ids','omit','getMessages','pick','options','include','findAll','includeAgent','addTags','setTags','spread','Tag','chatInteractionTags:save','removeTags','unix','server','tmp','files','attachments','transcript-%d-%s.zip','firstName','Attachment','Account','Owner','get','mkdirSync','10px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','createWriteStream','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','destroy','stack','name','send','Users','map','fullname','Tags','TagIds','split','forEach','catch','ChatInteraction','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','select','field','color','u.id','u.fullname','from','user_has_chat_interactions','left_join','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','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','start','end','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','text','body','some','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','contactName','DESC','resolve'];(function(_0x418b75,_0x306f93){var _0x8f9d36=function(_0x23d2b2){while(--_0x23d2b2){_0x418b75['push'](_0x418b75['shift']());}};_0x8f9d36(++_0x306f93);}(_0x9fe7,0x1df));var _0x79fe=function(_0x3ecc62,_0x260cf2){_0x3ecc62=_0x3ecc62-0x0;var _0x3a5028=_0x9fe7[_0x3ecc62];return _0x3a5028;};'use strict';var pdf=require(_0x79fe('0x0'));var emlformat=require(_0x79fe('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x79fe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x79fe('0x3'));var moment=require(_0x79fe('0x4'));var BPromise=require(_0x79fe('0x5'));var Mustache=require('mustache');var util=require(_0x79fe('0x6'));var path=require(_0x79fe('0x7'));var sox=require(_0x79fe('0x8'));var csv=require('to-csv');var ejs=require(_0x79fe('0x9'));var fs=require('fs');var fs_extra=require(_0x79fe('0xa'));var _=require(_0x79fe('0xb'));var squel=require('squel');var crypto=require(_0x79fe('0xc'));var jsforce=require(_0x79fe('0xd'));var deskjs=require(_0x79fe('0xe'));var toCsv=require(_0x79fe('0xf'));var querystring=require(_0x79fe('0x10'));var Papa=require('papaparse');var Redis=require(_0x79fe('0x11'));var authService=require(_0x79fe('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x79fe('0x13'));var hardwareService=require(_0x79fe('0x14'));var logger=require(_0x79fe('0x15'))(_0x79fe('0x16'));var utils=require('../../config/utils');var config=require(_0x79fe('0x17'));var licenseUtil=require(_0x79fe('0x18'));var db=require(_0x79fe('0x19'))['db'];config[_0x79fe('0x1a')]=_[_0x79fe('0x1b')](config[_0x79fe('0x1a')],{'host':_0x79fe('0x1c'),'port':0x18eb});var socket=require(_0x79fe('0x1d'))(new Redis(config['redis']));require(_0x79fe('0x1e'))[_0x79fe('0x1f')](socket);var jayson=require(_0x79fe('0x20'));var client=jayson[_0x79fe('0x21')][_0x79fe('0x22')]({'port':0x232b});var client9004=jayson[_0x79fe('0x21')]['http']({'port':0x232c});function respondWithRpcPromise(_0x127ec4,_0xb1955f,_0xcae4ff,_0x5f0af3){return new BPromise(function(_0x5eadbf,_0x416b5b){var _0x16f93a=_0x5f0af3||client;return _0x16f93a[_0x79fe('0x23')](_0x127ec4,_0xcae4ff)[_0x79fe('0x24')](function(_0x536641){logger['info'](_0x79fe('0x25'),_0xb1955f,_0x79fe('0x26'));logger[_0x79fe('0x27')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0xb1955f,_0x79fe('0x26'),JSON[_0x79fe('0x28')](_0x536641));if(_0x536641[_0x79fe('0x29')]){if(_0x536641['error'][_0x79fe('0x2a')]===0x1f4){logger['error'](_0x79fe('0x25'),_0xb1955f,_0x536641[_0x79fe('0x29')][_0x79fe('0x2b')]);return _0x416b5b(_0x536641[_0x79fe('0x29')][_0x79fe('0x2b')]);}logger[_0x79fe('0x29')]('ChatInteraction,\x20%s,\x20%s',_0xb1955f,_0x536641['error'][_0x79fe('0x2b')]);return _0x5eadbf(_0x536641['error'][_0x79fe('0x2b')]);}else{logger[_0x79fe('0x2c')]('ChatInteraction,\x20%s,\x20%s',_0xb1955f,'request\x20sent');_0x5eadbf(_0x536641[_0x79fe('0x2d')][_0x79fe('0x2b')]);}})['catch'](function(_0x46d93d){logger[_0x79fe('0x29')]('ChatInteraction,\x20%s,\x20%s',_0xb1955f,_0x46d93d);_0x416b5b(_0x46d93d);});});}function respondWithStatusCode(_0x4d60e8,_0x4ea368){_0x4ea368=_0x4ea368||0xcc;return function(_0x3720fa){if(_0x3720fa){return _0x4d60e8[_0x79fe('0x2e')](_0x4ea368);}return _0x4d60e8[_0x79fe('0x2f')](_0x4ea368)['end']();};}function respondWithResult(_0x47786f,_0x43782e){_0x43782e=_0x43782e||0xc8;return function(_0x3bc5bc){if(_0x3bc5bc){return _0x47786f['status'](_0x43782e)['json'](_0x3bc5bc);}};}function respondWithFilteredResult(_0x14e055,_0x51200f){return function(_0x196215){if(_0x196215){var _0x5cbb87=_0x196215[_0x79fe('0x30')],_0x4d1a9a=_0x51200f[_0x79fe('0x31')],_0x5b4835=_0x51200f['offset']+_0x51200f[_0x79fe('0x32')],_0x59b44d;if(_0x5b4835>=_0x5cbb87){_0x5b4835=_0x5cbb87;_0x59b44d=0xc8;}else{_0x59b44d=0xce;}_0x14e055['status'](_0x59b44d);return _0x14e055[_0x79fe('0x33')](_0x79fe('0x34'),_0x4d1a9a+'-'+_0x5b4835+'/'+_0x5cbb87)[_0x79fe('0x35')](_0x196215);}return null;};}function patchUpdates(_0x3558f2){return function(_0x128ca3){try{jsonpatch['apply'](_0x128ca3,_0x3558f2,!![]);}catch(_0x436279){return BPromise[_0x79fe('0x36')](_0x436279);}return _0x128ca3[_0x79fe('0x37')]();};}function saveUpdates(_0x190202,_0x445db9){return function(_0x4034b8){if(_0x4034b8){return _0x4034b8['update'](_0x190202)[_0x79fe('0x24')](function(_0x125226){return _0x125226;});}return null;};}function removeEntity(_0x8ddef3,_0x9d93c1){return function(_0xb87efd){if(_0xb87efd){return _0xb87efd[_0x79fe('0x38')]()['then'](function(){_0x8ddef3[_0x79fe('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bdf83,_0x4c9f60){return function(_0x2a533b){if(!_0x2a533b){_0x2bdf83['sendStatus'](0x194);}return _0x2a533b;};}function handleError(_0x1ee275,_0x16c7b8){_0x16c7b8=_0x16c7b8||0x1f4;return function(_0x41177d){logger['error'](_0x41177d[_0x79fe('0x39')]);if(_0x41177d[_0x79fe('0x3a')]){delete _0x41177d[_0x79fe('0x3a')];}_0x1ee275[_0x79fe('0x2f')](_0x16c7b8)[_0x79fe('0x3b')](_0x41177d);};}function getInteractionUsers(_0x5b15bb,_0x53957b){return new BPromise(function(_0x28439a,_0x4a8336){try{if(_0x53957b[_0x5b15bb['id']]){_0x5b15bb[_0x79fe('0x3c')]=_[_0x79fe('0x3d')](_0x53957b[_0x5b15bb['id']],function(_0x497a02){return{'id':_0x497a02['id'],'fullname':_0x497a02[_0x79fe('0x3e')]};});}}catch(_0x46da71){_0x4a8336(_0x46da71);}_0x28439a(_0x5b15bb);});}function getInteractionTags(_0xfa1cc,_0xc3f7ac){return new BPromise(function(_0x43d8b6,_0x4696f4){try{if(_0xfa1cc['TagIds']){_0xfa1cc[_0x79fe('0x3f')]=[];_0xfa1cc[_0x79fe('0x40')][_0x79fe('0x41')](',')[_0x79fe('0x42')](function(_0x4eada4){_0xfa1cc[_0x79fe('0x3f')]['push'](_0xc3f7ac[_0x4eada4]);});}delete _0xfa1cc[_0x79fe('0x40')];}catch(_0x5e29b5){_0x4696f4(_0x5e29b5);}_0x43d8b6(_0xfa1cc);});}function updateChatInteraction(_0x400a36,_0x4ab42e,_0x83737e){return new BPromise(function(_0x132662,_0x577341){return getInteractionUsers(_0x400a36,_0x83737e)['then'](function(_0x4137a3){return getInteractionTags(_0x4137a3,_0x4ab42e);})[_0x79fe('0x24')](function(_0x69ae72){_0x132662(_0x69ae72);})[_0x79fe('0x43')](function(_0x522241){_0x577341(_0x522241);});});}exports['index']=function(_0x37c37b,_0x31b15e){var _0x440ff1={},_0x365b69={},_0x2e0a27={'count':0x0,'rows':[]};var _0x3feb46=_[_0x79fe('0x3d')](db[_0x79fe('0x44')]['rawAttributes'],function(_0x2d13fb){return{'name':_0x2d13fb[_0x79fe('0x45')],'type':_0x2d13fb[_0x79fe('0x46')][_0x79fe('0x47')]};});_0x365b69[_0x79fe('0x48')]=_[_0x79fe('0x3d')](_0x3feb46,'name');_0x365b69[_0x79fe('0x49')]=_[_0x79fe('0x4a')](_0x37c37b[_0x79fe('0x49')]);_0x365b69[_0x79fe('0x4b')]=_[_0x79fe('0x4c')](_0x365b69[_0x79fe('0x48')],_0x365b69['query']);_0x440ff1[_0x79fe('0x4d')]=_[_0x79fe('0x4c')](_0x365b69[_0x79fe('0x48')],qs['fields'](_0x37c37b[_0x79fe('0x49')]['fields']));_0x440ff1['attributes']=_0x440ff1[_0x79fe('0x4d')][_0x79fe('0x4e')]?_0x440ff1[_0x79fe('0x4d')]:_0x365b69['model'];if(!_0x37c37b[_0x79fe('0x49')][_0x79fe('0x4f')](_0x79fe('0x50'))){_0x440ff1['limit']=qs['limit'](_0x37c37b[_0x79fe('0x49')][_0x79fe('0x32')]);_0x440ff1[_0x79fe('0x31')]=qs[_0x79fe('0x31')](_0x37c37b[_0x79fe('0x49')][_0x79fe('0x31')]);}_0x440ff1[_0x79fe('0x51')]=qs[_0x79fe('0x52')](_0x37c37b[_0x79fe('0x49')]['sort']);_0x440ff1[_0x79fe('0x53')]=qs[_0x79fe('0x4b')](_['pick'](_0x37c37b[_0x79fe('0x49')],_0x365b69['filters']),_0x3feb46);var _0x2909d0=[];var _0x204700=squel[_0x79fe('0x54')]()[_0x79fe('0x55')]('id')['field'](_0x79fe('0x3a'))[_0x79fe('0x55')](_0x79fe('0x56'))['from']('tools_tags');var _0x22e221=squel[_0x79fe('0x54')]()['field'](_0x79fe('0x57'))[_0x79fe('0x55')](_0x79fe('0x58'))[_0x79fe('0x55')]('ui.ChatInteractionId')[_0x79fe('0x59')](_0x79fe('0x5a'),'ui')[_0x79fe('0x5b')]('users','u','u.id\x20=\x20ui.UserId');var _0x4dc50e=squel['select']()['from'](_0x79fe('0x5c'),'i')[_0x79fe('0x5b')]('cm_contacts','c',_0x79fe('0x5d'))[_0x79fe('0x5b')](_0x79fe('0x5e'),'o','o.id\x20=\x20i.UserId')['left_join']('chat_websites','a',_0x79fe('0x5f'))['left_join'](_0x79fe('0x60'),'me',_0x79fe('0x61'))[_0x79fe('0x5b')](_0x79fe('0x62'),'it',_0x79fe('0x63'))[_0x79fe('0x5b')](_0x79fe('0x64'),'t',_0x79fe('0x65'));var _0x230ed9=squel[_0x79fe('0x66')]();var _0x20ff3a=[];var _0x4a6885=squel[_0x79fe('0x66')]();var _0x397e40;if(_0x37c37b['query'][_0x79fe('0x67')]){_0x397e40=as['parseSearch'](_0x37c37b[_0x79fe('0x49')][_0x79fe('0x67')]);var _0x523bf8=_0x397e40[_0x79fe('0x68')];for(var _0x5d60d3=0x0;_0x5d60d3<_0x397e40[_0x79fe('0x69')]['length'];_0x5d60d3++){var _0x5ef724=_0x397e40['conditions'][_0x5d60d3];var _0x9728b9='i';var _0x272272=_[_0x79fe('0x6a')](_0x3feb46,[_0x79fe('0x3a'),_0x5ef724[_0x79fe('0x55')]]);if(!_0x272272){switch(_0x5ef724[_0x79fe('0x55')]){case _0x79fe('0x6b'):if(_0x5ef724[_0x79fe('0x6c')]==0x1){_0x4dc50e[_0x79fe('0x6d')]('`'+_0x5ef724['field']+_0x79fe('0x6e'));}else{_0x4dc50e[_0x79fe('0x6d')]('`'+_0x5ef724[_0x79fe('0x55')]+_0x79fe('0x6f'));}break;case'Contact':if(_0x5ef724[_0x79fe('0x70')]==='$substring'){if(_0x5ef724[_0x79fe('0x6c')]['split']('\x20')[_0x79fe('0x4e')]>0x1){_0x230ed9[_0x523bf8](_0x79fe('0x71'),qs[_0x79fe('0x72')](_0x5ef724[_0x79fe('0x6c')]),null);}else{var _0x4e5a50='%'+_0x5ef724[_0x79fe('0x6c')]+'%';_0x230ed9[_0x523bf8](_0x79fe('0x73'),_0x4e5a50,_0x4e5a50,_0x4e5a50);}}else{_0x272272=_[_0x79fe('0x6a')](_0x3feb46,[_0x79fe('0x3a'),'ContactId']);_0x5ef724[_0x79fe('0x55')]=_0x79fe('0x74');_0xbb92d5=as['buildExpression'](_0x9728b9,_0x272272[_0x79fe('0x46')],_0x5ef724);_0x230ed9[_0x523bf8](_0xbb92d5['text'],_0xbb92d5['value'][_0x79fe('0x75')],_0xbb92d5[_0x79fe('0x6c')][_0x79fe('0x76')]);}break;case'Tag':var _0x58adb7=_0x5ef724[_0x79fe('0x6c')]['split'](',')['map'](function(_0x47780b){return Number(_0x47780b);});_0x58adb7[_0x79fe('0x42')](function(_0x45a70f){_0x4a6885['or'](_0x79fe('0x77'),'%,'+_0x45a70f+',%');});_0x20ff3a=_[_0x79fe('0x78')](_0x20ff3a,_0x58adb7);break;case _0x79fe('0x79'):if(_0x5ef724[_0x79fe('0x70')]===_0x79fe('0x7a')){_0x230ed9[_0x523bf8](_0x79fe('0x7b'),'%'+_0x5ef724['value']+'%',null);}else{_0x272272=_[_0x79fe('0x6a')](_0x3feb46,[_0x79fe('0x3a'),'UserId']);_0x5ef724[_0x79fe('0x55')]=_0x79fe('0x7c');_0xbb92d5=as[_0x79fe('0x7d')](_0x9728b9,_0x272272[_0x79fe('0x46')],_0x5ef724);_0x230ed9[_0x523bf8](_0xbb92d5[_0x79fe('0x7e')],_0xbb92d5[_0x79fe('0x6c')][_0x79fe('0x75')],_0xbb92d5[_0x79fe('0x6c')][_0x79fe('0x76')]);}break;case _0x79fe('0x7f'):_0xbb92d5=as[_0x79fe('0x7d')]('me',null,_0x5ef724);_0x230ed9[_0x523bf8](_0xbb92d5['text'],_0xbb92d5[_0x79fe('0x6c')][_0x79fe('0x75')],_0xbb92d5[_0x79fe('0x6c')][_0x79fe('0x76')]);break;}}else{var _0xbb92d5=as[_0x79fe('0x7d')](_0x9728b9,_0x272272[_0x79fe('0x46')],_0x5ef724);_0x230ed9[_0x523bf8](_0xbb92d5['text'],_0xbb92d5[_0x79fe('0x6c')][_0x79fe('0x75')],_0xbb92d5[_0x79fe('0x6c')]['end']);}}}else{var _0x4e7bdc=_(_0x37c37b['query'])['keys']()[_0x79fe('0x3d')](function(_0x485b00){return _[_0x79fe('0x80')](_0x3feb46,[_0x79fe('0x3a'),_0x485b00])?_0x485b00:undefined;})[_0x79fe('0x81')]()[_0x79fe('0x6c')]();if(!_[_0x79fe('0x82')](_0x4e7bdc)){_0x4e7bdc['forEach'](function(_0x426c6d){if(_0x426c6d==='ChatWebsiteId'){_0x4dc50e[_0x79fe('0x53')](_0x79fe('0x83'),[][_0x79fe('0x84')](_0x37c37b[_0x79fe('0x49')][_0x426c6d]));}else if(_0x426c6d===_0x79fe('0x85')){var _0xa0b17f=JSON[_0x79fe('0x86')](_0x37c37b['query'][_0x426c6d])[_0x79fe('0x87')];var _0x50c361=JSON[_0x79fe('0x86')](_0x37c37b[_0x79fe('0x49')][_0x426c6d])[_0x79fe('0x88')];_0x4dc50e['where'](_0x79fe('0x89'),_0xa0b17f,_0x50c361);}else{if(_0x37c37b[_0x79fe('0x49')][_0x426c6d]===_0x79fe('0x8a')){_0x4dc50e[_0x79fe('0x53')]('i.'+_0x426c6d+'\x20IS\x20NULL');}else{_0x4dc50e[_0x79fe('0x53')]('i.'+_0x426c6d+_0x79fe('0x8b'),_0x37c37b[_0x79fe('0x49')][_0x426c6d]);}}});}if(_0x37c37b['query'][_0x79fe('0x8c')]){if(_0x37c37b[_0x79fe('0x49')][_0x79fe('0x8c')]==0x1){_0x4dc50e[_0x79fe('0x6d')](_0x79fe('0x8d'));}else{_0x4dc50e[_0x79fe('0x6d')](_0x79fe('0x8e'));}}if(_0x37c37b[_0x79fe('0x49')][_0x79fe('0x8f')]){_0x20ff3a=_['isArray'](_0x37c37b[_0x79fe('0x49')]['tag'])?_0x37c37b[_0x79fe('0x49')][_0x79fe('0x8f')]:new Array(_0x37c37b[_0x79fe('0x49')][_0x79fe('0x8f')]);_0x20ff3a[_0x79fe('0x42')](function(_0x5d6035){_0x4a6885['or'](_0x79fe('0x77'),'%,'+_0x5d6035+',%');});}if(_0x37c37b['query'][_0x79fe('0x90')]){var _0x136706=_0x37c37b['query'][_0x79fe('0x90')][_0x79fe('0x91')]('\x5c','\x5c\x5c')[_0x79fe('0x91')](/'/g,'\x27\x27');if(qs[_0x79fe('0x92')](_0x136706)){_0x230ed9['or'](_0x79fe('0x93'),_0x136706+'%');}else{_0x230ed9['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x79fe('0x72')](_0x136706))['or'](_0x79fe('0x94'),_0x136706+'%');}}}_0x4dc50e[_0x79fe('0x53')](_0x230ed9);_0x4dc50e[_0x79fe('0x95')](_0x79fe('0x96'));var _0x2f16d1={'type':db[_0x79fe('0x97')][_0x79fe('0x98')][_0x79fe('0x99')],'raw':!![]};var _0x202107=_0x4dc50e['clone']();_0x202107[_0x79fe('0x55')]('i.id');_0x202107[_0x79fe('0x55')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x79fe('0x6b'));if(_0x440ff1[_0x79fe('0x51')]){_0x440ff1[_0x79fe('0x51')][_0x79fe('0x42')](function(_0x34a296){var _0x4dc8cd=_0x34a296[0x0]===_0x79fe('0x9a')?_0x34a296[0x0]:'i.'+_0x34a296[0x0];_0x4dc50e[_0x79fe('0x51')](_0x4dc8cd,_0x34a296[0x1]===_0x79fe('0x9b')?![]:!![]);});}if(!_[_0x79fe('0x82')](_0x20ff3a)){_0x4dc50e['having'](_0x4a6885);_0x202107[_0x79fe('0x53')]('t.id\x20IN\x20?',_0x20ff3a);}BPromise[_0x79fe('0x9c')]()[_0x79fe('0x24')](function(){if(!_0x397e40){if(_0x37c37b[_0x79fe('0x49')][_0x79fe('0x9d')])return;_0x202107[_0x79fe('0x53')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x4dc50e[_0x79fe('0x53')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x37c37b[_0x79fe('0x9e')][_0x79fe('0x9f')]!=='agent')return;return _0x37c37b[_0x79fe('0x9e')][_0x79fe('0xa0')]({'attributes':['id'],'raw':!![]})[_0x79fe('0x24')](function(_0x3aa36b){if(_[_0x79fe('0x82')](_0x3aa36b)){_0x202107[_0x79fe('0x53')]('i.ChatWebsiteId\x20IS\x20NULL');_0x4dc50e['where'](_0x79fe('0xa1'));}else{_0x202107[_0x79fe('0x53')](_0x79fe('0x83'),_['map'](_0x3aa36b,'id'));_0x4dc50e[_0x79fe('0x53')](_0x79fe('0x83'),_[_0x79fe('0x3d')](_0x3aa36b,'id'));}});})[_0x79fe('0x24')](function(){if(_0x37c37b[_0x79fe('0x9e')]['role']===_0x79fe('0xa2')&&!_0x397e40&&!_0x37c37b[_0x79fe('0x49')][_0x79fe('0x9d')])return[];return db['sequelize'][_0x79fe('0x49')](_0x202107[_0x79fe('0xa3')](),_0x2f16d1);})[_0x79fe('0x24')](function(_0x175ee6){_0x2e0a27['count']=_0x175ee6[_0x79fe('0x4e')];if(_0x2e0a27[_0x79fe('0x30')]===0x0)return[];return db['sequelize'][_0x79fe('0x49')](_0x204700[_0x79fe('0xa3')](),_0x2f16d1)[_0x79fe('0x24')](function(_0x6786a1){_0x2909d0=_[_0x79fe('0xa4')](_0x6786a1,'id');_0x2f16d1=_['merge'](_0x2f16d1,{'model':db[_0x79fe('0x44')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x37c37b[_0x79fe('0x49')]['fields']){_0x440ff1['attributes']['forEach'](function(_0x381d08){_0x4dc50e[_0x79fe('0x55')]('i.'+_0x381d08);});}else{_0x4dc50e[_0x79fe('0x55')](_0x79fe('0xa5'),_0x79fe('0x6b'));_0x4dc50e['field'](_0x79fe('0xa6'),_0x79fe('0xa7'));_0x4dc50e['field'](_0x79fe('0xa8'),'Account.mandatoryDisposition');_0x4dc50e['field'](_0x79fe('0xa9'),_0x79fe('0x9a'));_0x4dc50e[_0x79fe('0x55')](_0x79fe('0xaa'));_0x4dc50e[_0x79fe('0x55')](_0x79fe('0xab'),_0x79fe('0xac'));_0x4dc50e[_0x79fe('0x55')](_0x79fe('0xad'),_0x79fe('0xae'));_0x4dc50e[_0x79fe('0x55')]('c.email',_0x79fe('0xaf'));_0x4dc50e[_0x79fe('0x55')](_0x79fe('0xb0'),_0x79fe('0xb1'));_0x4dc50e[_0x79fe('0x55')](_0x79fe('0xb2'),_0x79fe('0xb3'));_0x4dc50e[_0x79fe('0x55')](_0x79fe('0xb4'),'Contact.fax');_0x4dc50e[_0x79fe('0x55')](_0x79fe('0xb5'),_0x79fe('0xb6'));_0x4dc50e[_0x79fe('0x55')]('o.internal',_0x79fe('0xb7'));_0x4dc50e['field'](_0x79fe('0xb8'),'TagIds');}if(_0x440ff1[_0x79fe('0x32')])_0x4dc50e[_0x79fe('0x32')](_0x440ff1[_0x79fe('0x32')]);if(_0x440ff1[_0x79fe('0x31')])_0x4dc50e[_0x79fe('0x31')](_0x440ff1[_0x79fe('0x31')]);return db['sequelize']['query'](_0x4dc50e[_0x79fe('0xa3')](),_0x2f16d1);})[_0x79fe('0x24')](function(_0x2300ba){_0x22e221[_0x79fe('0x53')](_0x79fe('0xb9'),_['map'](_0x2300ba,'id'));return db[_0x79fe('0xba')]['query'](_0x22e221['toString'](),_0x2f16d1)[_0x79fe('0x24')](function(_0x517c85){var _0x3a65d9=_[_0x79fe('0xbb')](_0x517c85,_0x79fe('0xbc'));var _0x1dcf6f=[];_0x2300ba[_0x79fe('0x42')](function(_0x454eb0){_0x1dcf6f[_0x79fe('0xbd')](updateChatInteraction(_0x454eb0,_0x2909d0,_0x3a65d9));});return BPromise[_0x79fe('0xbe')](_0x1dcf6f);});});})['then'](function(_0xebcf05){_0x2e0a27[_0x79fe('0xbf')]=_0xebcf05;return _0x2e0a27;})['then'](respondWithFilteredResult(_0x31b15e,_0x440ff1))[_0x79fe('0x43')](handleError(_0x31b15e,null));};exports[_0x79fe('0xc0')]=function(_0x1fd585,_0x24a505){var _0x57e10f={'raw':![],'where':{'id':_0x1fd585[_0x79fe('0xc1')]['id']}},_0x48e12d={};_0x48e12d['model']=_[_0x79fe('0x4a')](db[_0x79fe('0x44')][_0x79fe('0xc2')]);_0x48e12d['query']=_[_0x79fe('0x4a')](_0x1fd585[_0x79fe('0x49')]);_0x48e12d[_0x79fe('0x4b')]=_[_0x79fe('0x4c')](_0x48e12d[_0x79fe('0x48')],_0x48e12d[_0x79fe('0x49')]);_0x57e10f['attributes']=_['intersection'](_0x48e12d[_0x79fe('0x48')],qs['fields'](_0x1fd585[_0x79fe('0x49')][_0x79fe('0xc3')]));_0x57e10f[_0x79fe('0x4d')]=_0x57e10f[_0x79fe('0x4d')]['length']?_0x57e10f[_0x79fe('0x4d')]:_0x48e12d[_0x79fe('0x48')];if(_0x1fd585[_0x79fe('0x49')][_0x79fe('0xc4')]){_0x57e10f['include']=[{'all':!![]}];}_0x57e10f=_[_0x79fe('0xc5')]({},_0x57e10f,_0x1fd585['options']);return db[_0x79fe('0x44')]['find'](_0x57e10f)[_0x79fe('0x24')](handleEntityNotFound(_0x24a505,null))[_0x79fe('0x24')](respondWithResult(_0x24a505,null))[_0x79fe('0x43')](handleError(_0x24a505,null));};exports[_0x79fe('0xc6')]=function(_0x1061f4,_0x1c5f4c){return db['ChatInteraction'][_0x79fe('0xc6')](_0x1061f4['body'],{})[_0x79fe('0x24')](respondWithResult(_0x1c5f4c,0xc9))[_0x79fe('0x43')](handleError(_0x1c5f4c,null));};exports[_0x79fe('0xc7')]=function(_0x4122d1,_0x2b03ee){if(_0x4122d1[_0x79fe('0x7f')]['id']){delete _0x4122d1[_0x79fe('0x7f')]['id'];}return db[_0x79fe('0x44')][_0x79fe('0x6a')]({'where':{'id':_0x4122d1[_0x79fe('0xc1')]['id']}})[_0x79fe('0x24')](handleEntityNotFound(_0x2b03ee,null))[_0x79fe('0x24')](saveUpdates(_0x4122d1[_0x79fe('0x7f')],null))[_0x79fe('0x24')](respondWithResult(_0x2b03ee,null))['catch'](handleError(_0x2b03ee,null));};exports['destroy']=function(_0x797422,_0x304d1e){return db[_0x79fe('0x44')][_0x79fe('0x6a')]({'where':{'id':_0x797422[_0x79fe('0xc1')]['id']}})[_0x79fe('0x24')](handleEntityNotFound(_0x304d1e,null))[_0x79fe('0x24')](removeEntity(_0x304d1e,null))[_0x79fe('0x43')](handleError(_0x304d1e,null));};exports['describe']=function(_0x32c2ed,_0x241b06){return db[_0x79fe('0x44')]['describe']()[_0x79fe('0x24')](respondWithResult(_0x241b06,null))[_0x79fe('0x43')](handleError(_0x241b06,null));};exports[_0x79fe('0xc8')]=function(_0x12b2b8,_0x750fb6){var _0x2f4d34=_0x12b2b8[_0x79fe('0xc1')]['id'];var _0x2a470b;var _0x163679;var _0x53b354;return db[_0x79fe('0x44')]['findOne']({'where':{'id':_0x2f4d34}})['then'](function(_0x585aa9){_0x2a470b=_0x585aa9;return db['ChatWebsite'][_0x79fe('0xc9')]({'where':{'id':_0x585aa9[_0x79fe('0x9d')]},'attributes':['id',_0x79fe('0xca'),_0x79fe('0xcb')],'raw':!![]});})[_0x79fe('0x24')](function(_0xfcc72a){if(_0xfcc72a&&_0xfcc72a['vidaooApiKey']&&_0xfcc72a['vidaooEscalation']){_0x163679=_0xfcc72a;var _0x370814={'rejectUnauthorized':![],'method':_0x79fe('0xcc'),'uri':_0x79fe('0xcd'),'headers':{'X-APIKEY':_0xfcc72a[_0x79fe('0xca')]},'body':{'name':'MotionCWB:'+_0x2f4d34},'redirect':_0x79fe('0xce'),'json':!![]};return rp(_0x370814);}else{throw new db['Sequelize'][(_0x79fe('0xcf'))](_0x79fe('0xd0'));}})[_0x79fe('0x24')](function(_0x2992e0){_0x53b354=_0x2992e0;if(_0x53b354['id']){var _0x540077={'body':_0x53b354[_0x79fe('0xd1')],'ChatWebsiteId':_0x163679['id'],'ChatInteractionId':_0x2a470b['id'],'direction':_0x79fe('0xd2'),'UserId':_0x12b2b8['user']['id']};return db[_0x79fe('0xd3')][_0x79fe('0xc6')](_0x540077,{});}else{throw new db['Sequelize'][(_0x79fe('0xcf'))](_0x79fe('0xd4'));}})[_0x79fe('0x24')](function(){return _0x2a470b[_0x79fe('0xd5')]({'vidaooSessionId':_0x53b354['id']});})[_0x79fe('0x24')](respondWithResult(_0x750fb6,null))['catch'](handleError(_0x750fb6,null));};exports[_0x79fe('0xd6')]=function(_0xcf0b7d,_0x1c0548){if(_0xcf0b7d[_0x79fe('0x7f')]['id']){delete _0xcf0b7d['body']['id'];}return db[_0x79fe('0x44')][_0x79fe('0x6a')]({'where':{'id':_0xcf0b7d[_0x79fe('0xc1')]['id']},'include':[{'model':db[_0x79fe('0xd7')],'as':_0x79fe('0xd8')}]})[_0x79fe('0x24')](handleEntityNotFound(_0x1c0548,null))[_0x79fe('0x24')](saveUpdates(_0xcf0b7d[_0x79fe('0x7f')],null))['then'](respondWithResult(_0x1c0548,null))[_0x79fe('0x43')](handleError(_0x1c0548,null));};exports['abandon']=function(_0xa21494,_0x461b0a,_0x1566d6){if(_0xa21494[_0x79fe('0x7f')]['id']){delete _0xa21494['body']['id'];}return db[_0x79fe('0x44')][_0x79fe('0x6a')]({'where':{'id':_0xa21494[_0x79fe('0xc1')]['id']}})[_0x79fe('0x24')](function(_0xa2b309){if(!_0xa2b309){logger[_0x79fe('0x29')](_0x79fe('0xd9'),_0x79fe('0xda'),0x194,_0x79fe('0xdb'));_0x461b0a[_0x79fe('0x2e')](0x194);}else{if(_0xa2b309['UserId']){throw new db[(_0x79fe('0x97'))][(_0x79fe('0xcf'))](_0x79fe('0xdc'));}}return _0xa2b309;})[_0x79fe('0x24')](function(_0x168d04){if(_0x168d04){return _0x168d04[_0x79fe('0xc7')]({'closed':_0xa21494[_0x79fe('0x7f')][_0x79fe('0xdd')],'disposition':_0xa21494[_0x79fe('0x7f')][_0x79fe('0xde')]})[_0x79fe('0x24')](function(_0x1f889f){return _0x1f889f;});}})[_0x79fe('0x24')](function(_0x6aadaf){return respondWithRpcPromise(_0x79fe('0xdf'),_0x79fe('0xda'),_0xa21494[_0x79fe('0x7f')],client9004);})['then'](respondWithResult(_0x461b0a,null))['catch'](handleError(_0x461b0a,null));};exports[_0x79fe('0xe0')]=function(_0x35da8a,_0x4ed0cd,_0x269e58){_0x35da8a[_0x79fe('0x7f')]['name']=_0x35da8a[_0x79fe('0xe1')]['originalname'];_0x35da8a[_0x79fe('0x7f')][_0x79fe('0xe2')]=_0x35da8a[_0x79fe('0xe1')][_0x79fe('0xe3')];_0x35da8a[_0x79fe('0x7f')][_0x79fe('0x46')]=_0x35da8a['file']['mimetype'];return db['Attachment'][_0x79fe('0xc6')](_0x35da8a[_0x79fe('0x7f')])[_0x79fe('0x24')](respondWithResult(_0x4ed0cd,0xc9))[_0x79fe('0x43')](handleError(_0x4ed0cd,null));};exports[_0x79fe('0xe4')]=function(_0x56c728,_0x715361,_0x22250a){return db['ChatInteraction'][_0x79fe('0xc9')]({'where':{'id':_0x56c728[_0x79fe('0xc1')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x715361,null))[_0x79fe('0x24')](function(_0x5545c9){if(_0x5545c9){if(_0x5545c9[_0x79fe('0xdd')]){return _0x715361[_0x79fe('0x2f')](0x193)[_0x79fe('0x35')]({'status':0x193,'message':_0x79fe('0xe5')});}return db['Attachment'][_0x79fe('0xc9')]({'where':{'id':_0x56c728['query'][_0x79fe('0xe6')]},'raw':!![]})[_0x79fe('0x24')](handleEntityNotFound(_0x715361,null));}})['then'](function(_0x203c08){if(_0x203c08){var _0x25c44f=_0x203c08[_0x79fe('0xe7')]!==null;var _0xdcb410=path[_0x79fe('0xe8')](config['root'],'server/files/attachments/');if(_0x25c44f){_0xdcb410=path[_0x79fe('0xe8')](_0xdcb410,_0x79fe('0xe9'));}var _0x16a311=path[_0x79fe('0xe8')](_0xdcb410,_0x203c08[_0x79fe('0xe2')]);return _0x715361[_0x79fe('0xea')](_0x16a311);}})['catch'](handleError(_0x715361,null));};exports[_0x79fe('0xeb')]=function(_0x4b1449,_0x58d48e){var _0x5c4f52=null;var _0x4f83a1=null;var _0x1397a5=null;var _0xe4a431=null;if(_0x4b1449[_0x79fe('0x7f')]['id']){delete _0x4b1449[_0x79fe('0x7f')]['id'];}if(_0x4b1449[_0x79fe('0x7f')][_0x79fe('0xec')]){_0xe4a431=path[_0x79fe('0xe8')](config[_0x79fe('0xed')],_0x79fe('0xee'),util[_0x79fe('0xef')](_0x79fe('0xf0'),Date[_0x79fe('0xf1')]()));_0x4b1449[_0x79fe('0x7f')]['pathTranscript']=_0xe4a431;}return db[_0x79fe('0x44')][_0x79fe('0x6a')]({'where':{'id':_0x4b1449['params']['id']},'include':[{'model':db[_0x79fe('0xd3')],'as':_0x79fe('0xf2'),'include':[{'model':db[_0x79fe('0x79')],'as':_0x79fe('0x79')}]}]})['then'](handleEntityNotFound(_0x58d48e,null))[_0x79fe('0x24')](saveUpdates(_0x4b1449[_0x79fe('0x7f')],null))[_0x79fe('0x24')](function(_0x150a8a){if(_0x150a8a){_0x5c4f52=_0x150a8a;return db[_0x79fe('0xf3')][_0x79fe('0x6a')]({'where':{'id':_0x5c4f52[_0x79fe('0x9d')]}});}})['then'](function(_0x2a732f){if(_0x2a732f){_0x1397a5=_0x2a732f;return db[_0x79fe('0xd7')][_0x79fe('0x6a')]({'where':{'id':_0x5c4f52[_0x79fe('0x74')]}});}})[_0x79fe('0x24')](function(_0x2f8a70){if(_0x2f8a70){_0x4f83a1=_0x2f8a70;if(_0xe4a431){var _0x3a4be4=null;for(var _0x42d5ea=0x1;_0x42d5ea<_0x5c4f52[_0x79fe('0xf2')][_0x79fe('0x4e')];++_0x42d5ea){_0x3a4be4=_0x5c4f52[_0x79fe('0xf2')][_0x42d5ea];var _0x140e73=_0x3a4be4[_0x79fe('0x7c')]?util[_0x79fe('0xef')](_0x79fe('0xf4'),_0x1397a5[_0x79fe('0xf5')],_0x3a4be4[_0x79fe('0x7c')]):_0x79fe('0xf6');var _0x2320cd=_0x4b1449[_0x79fe('0x7f')][_0x79fe('0xf7')]||util[_0x79fe('0xef')](_0x79fe('0xf4'),_0x79fe('0xf8'),_0x3a4be4[_0x79fe('0x74')]);switch(_0x1397a5[_0x79fe('0xf9')]){case'website_alias':_0x140e73=_0x3a4be4['UserId']?util[_0x79fe('0xef')](_0x79fe('0xf4'),_0x1397a5['agentAlias'],_0x3a4be4[_0x79fe('0x7c')]):_0x79fe('0xf6');break;case _0x79fe('0xfa'):_0x140e73=_0x3a4be4[_0x79fe('0x7c')]?_0x3a4be4[_0x79fe('0x79')][_0x79fe('0xfb')]||_0x3a4be4[_0x79fe('0x79')][_0x79fe('0x3e')]:_0x79fe('0xf6');break;case _0x79fe('0xfc'):_0x140e73=_0x3a4be4[_0x79fe('0x7c')]?_0x3a4be4[_0x79fe('0x79')][_0x79fe('0x3e')]:_0x79fe('0xf6');break;default:_0x140e73=_0x3a4be4[_0x79fe('0x7c')]?util[_0x79fe('0xef')](_0x79fe('0xf4'),_0x1397a5['agentAlias'],_0x3a4be4[_0x79fe('0x7c')]):_0x79fe('0xf6');}var _0x2521a0=util[_0x79fe('0xef')](_0x79fe('0xfd'),moment(_0x3a4be4['createdAt'])[_0x79fe('0xef')]('MM/DD/YYYY\x20HH:mm:ss'),_0x3a4be4[_0x79fe('0xfe')]==='in'?_0x2320cd:_0x140e73,_0x3a4be4['body']);if(!_0x3a4be4[_0x79fe('0xff')]){fs['appendFileSync'](_0xe4a431,_0x2521a0);}}return db[_0x79fe('0x100')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x79fe('0x101')],'as':_0x79fe('0x102'),'raw':!![]}]});}}})['then'](function(_0x32d99f){if(_0x32d99f&&_0x32d99f['Smtp']&&_0x4b1449['body']){var _0x1d17f1={'tls':{'rejectUnauthorized':![]}};if(_0x32d99f[_0x79fe('0x102')][_0x79fe('0x103')]){_0x1d17f1[_0x79fe('0x103')]=_0x32d99f[_0x79fe('0x102')][_0x79fe('0x103')];}else{_0x1d17f1['host']=_0x32d99f[_0x79fe('0x102')][_0x79fe('0x104')];_0x1d17f1['port']=_0x32d99f['Smtp']['port'];_0x1d17f1[_0x79fe('0x105')]=_0x32d99f[_0x79fe('0x102')][_0x79fe('0x105')];}if(_0x32d99f[_0x79fe('0x102')][_0x79fe('0x106')]){_0x1d17f1['auth']={'user':_0x32d99f[_0x79fe('0x102')][_0x79fe('0x9e')],'pass':_0x32d99f[_0x79fe('0x102')][_0x79fe('0x107')]};}return respondWithRpcPromise(_0x79fe('0x108'),_0x79fe('0x109'),{'account':_0x1d17f1,'message':{'from':util['format'](_0x79fe('0x10a'),_0x32d99f[_0x79fe('0x3a')],_0x32d99f['email']||_0x32d99f['Smtp']['user']),'to':_0x4b1449[_0x79fe('0x7f')][_0x79fe('0xec')],'subject':'Mail\x20Transcript','text':util[_0x79fe('0xef')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x4b1449[_0x79fe('0x7f')][_0x79fe('0xec')]),'attachments':[{'path':_0xe4a431}]}})[_0x79fe('0x24')](function(){return _0x5c4f52;})[_0x79fe('0x43')](function(_0x13939e){console[_0x79fe('0x29')](_0x13939e);});}else{return _0x5c4f52;}})['then'](respondWithStatusCode(_0x58d48e,0xc8))[_0x79fe('0x43')](handleError(_0x58d48e,null));};exports[_0x79fe('0x10b')]=function(_0x9dfdf9,_0xce1c53,_0x4c96a3){return db[_0x79fe('0xd3')][_0x79fe('0x6a')]({'where':{'id':_0x9dfdf9[_0x79fe('0xc1')]['id']}})['then'](handleEntityNotFound(_0xce1c53,null))[_0x79fe('0x24')](function(_0x427306){if(_0x427306){return _0x427306[_0x79fe('0x10b')](_0x9dfdf9[_0x79fe('0x7f')][_0x79fe('0x10c')],_[_0x79fe('0x10d')](_0x9dfdf9[_0x79fe('0x7f')],[_0x79fe('0x10c'),'id'])||{});}})[_0x79fe('0x24')](respondWithResult(_0xce1c53,null))[_0x79fe('0x43')](handleError(_0xce1c53,null));};exports[_0x79fe('0x10e')]=function(_0x3aaf16,_0x1743f3,_0x47dc2c){var _0x36e55f={'raw':![],'where':{}};var _0x3ea297={};var _0x26e078={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x3aaf16[_0x79fe('0xc1')]['id']}})[_0x79fe('0x24')](handleEntityNotFound(_0x1743f3,null))[_0x79fe('0x24')](function(_0x206f77){if(_0x206f77){_0x3ea297['model']=_[_0x79fe('0x4a')](db[_0x79fe('0xd3')][_0x79fe('0xc2')]);_0x3ea297[_0x79fe('0x49')]=_[_0x79fe('0x4a')](_0x3aaf16['query']);_0x3ea297[_0x79fe('0x4b')]=_[_0x79fe('0x4c')](_0x3ea297['model'],_0x3ea297[_0x79fe('0x49')]);_0x36e55f['attributes']=_[_0x79fe('0x4c')](_0x3ea297['model'],qs[_0x79fe('0xc3')](_0x3aaf16['query'][_0x79fe('0xc3')]));_0x36e55f[_0x79fe('0x4d')]=_0x36e55f[_0x79fe('0x4d')][_0x79fe('0x4e')]?_0x36e55f['attributes']:_0x3ea297[_0x79fe('0x48')];if(!_0x3aaf16['query']['hasOwnProperty'](_0x79fe('0x50'))){_0x36e55f[_0x79fe('0x32')]=qs[_0x79fe('0x32')](_0x3aaf16[_0x79fe('0x49')][_0x79fe('0x32')]);_0x36e55f[_0x79fe('0x31')]=qs[_0x79fe('0x31')](_0x3aaf16['query'][_0x79fe('0x31')]);}_0x36e55f[_0x79fe('0x51')]=qs[_0x79fe('0x52')](_0x3aaf16[_0x79fe('0x49')][_0x79fe('0x52')]);_0x36e55f['where']=qs[_0x79fe('0x4b')](_[_0x79fe('0x10f')](_0x3aaf16[_0x79fe('0x49')],_0x3ea297[_0x79fe('0x4b')]));_0x36e55f[_0x79fe('0x53')][_0x79fe('0xbc')]=_0x206f77['id'];if(_0x3aaf16['query'][_0x79fe('0x90')]){_0x36e55f[_0x79fe('0x53')]=_[_0x79fe('0xc5')](_0x36e55f[_0x79fe('0x53')],{'$or':_['map'](_0x36e55f['attributes'],function(_0x2c7bc6){var _0x1709db={};_0x1709db[_0x2c7bc6]={'$like':'%'+_0x3aaf16[_0x79fe('0x49')][_0x79fe('0x90')]+'%'};return _0x1709db;})});}if(_0x3aaf16[_0x79fe('0x49')]['$gte']){var _0x3e043c=_0x3aaf16[_0x79fe('0x49')][_0x79fe('0x87')][_0x79fe('0x41')](',');var _0x180e58={};_0x180e58[_0x3e043c[0x0]]={'$gte':moment(_0x3e043c[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x36e55f[_0x79fe('0x53')]=_[_0x79fe('0xc5')](_0x36e55f[_0x79fe('0x53')],_0x180e58);}_0x36e55f=_[_0x79fe('0xc5')]({},_0x36e55f,_0x3aaf16[_0x79fe('0x110')]);return db['ChatMessage'][_0x79fe('0x30')]({'where':_0x36e55f[_0x79fe('0x53')]})[_0x79fe('0x24')](function(_0x25a7d9){_0x26e078['count']=_0x25a7d9;if(_0x3aaf16[_0x79fe('0x49')][_0x79fe('0xc4')]){_0x36e55f[_0x79fe('0x111')]=[{'all':!![]}];}return db[_0x79fe('0xd3')][_0x79fe('0x112')](_0x36e55f);})[_0x79fe('0x24')](function(_0xdcf88b){_0x26e078[_0x79fe('0xbf')]=_0xdcf88b;return _0x26e078;});}})[_0x79fe('0x24')](respondWithFilteredResult(_0x1743f3,_0x36e55f))[_0x79fe('0x43')](handleError(_0x1743f3,null));};exports['getMyMessages']=function(_0x44f81b,_0x24150d,_0x5e25f8){var _0x9dcedb={'where':{}},_0x5ac5b3={},_0x751461={'count':0x0,'rows':[]};return db[_0x79fe('0x44')][_0x79fe('0xc9')]({'where':{'id':_0x44f81b[_0x79fe('0xc1')]['id']}})['then'](handleEntityNotFound(_0x24150d,null))['then'](function(_0x221a6f){if(_0x221a6f){_0x5ac5b3[_0x79fe('0x48')]=_[_0x79fe('0x4a')](db[_0x79fe('0xd3')][_0x79fe('0xc2')]);_0x5ac5b3[_0x79fe('0x49')]=_[_0x79fe('0x4a')](_0x44f81b['query']);_0x5ac5b3['filters']=_[_0x79fe('0x4c')](_0x5ac5b3[_0x79fe('0x48')],_0x5ac5b3[_0x79fe('0x49')]);_0x9dcedb[_0x79fe('0x4d')]=_[_0x79fe('0x4c')](_0x5ac5b3[_0x79fe('0x48')],qs[_0x79fe('0xc3')](_0x44f81b[_0x79fe('0x49')][_0x79fe('0xc3')]));_0x9dcedb[_0x79fe('0x4d')]=_0x9dcedb[_0x79fe('0x4d')][_0x79fe('0x4e')]?_0x9dcedb['attributes']:_0x5ac5b3[_0x79fe('0x48')];if(!_0x44f81b[_0x79fe('0x49')][_0x79fe('0x4f')](_0x79fe('0x50'))){_0x9dcedb['limit']=qs[_0x79fe('0x32')](_0x44f81b['query'][_0x79fe('0x32')]);_0x9dcedb[_0x79fe('0x31')]=qs[_0x79fe('0x31')](_0x44f81b[_0x79fe('0x49')][_0x79fe('0x31')]);}_0x9dcedb[_0x79fe('0x51')]=qs[_0x79fe('0x52')](_0x44f81b['query']['sort']);_0x9dcedb['where']=qs['filters'](_['pick'](_0x44f81b[_0x79fe('0x49')],_0x5ac5b3['filters']));_0x9dcedb[_0x79fe('0x53')][_0x79fe('0xbc')]=_0x221a6f['id'];if(_0x44f81b[_0x79fe('0x49')][_0x79fe('0x90')]){_0x9dcedb[_0x79fe('0x53')]=_[_0x79fe('0xc5')](_0x9dcedb[_0x79fe('0x53')],{'$or':_[_0x79fe('0x3d')](_0x9dcedb[_0x79fe('0x4d')],function(_0x201267){var _0x2e1334={};_0x2e1334[_0x201267]={'$like':'%'+_0x44f81b[_0x79fe('0x49')][_0x79fe('0x90')]+'%'};return _0x2e1334;})});}_0x9dcedb['where']['secret']=![];if(_0x44f81b[_0x79fe('0x49')]['id']){_0x9dcedb[_0x79fe('0x53')]['id']={'$gt':_0x44f81b[_0x79fe('0x49')]['id']};}_0x9dcedb=_[_0x79fe('0xc5')]({},_0x9dcedb,_0x44f81b[_0x79fe('0x110')]);return db[_0x79fe('0xd3')][_0x79fe('0x30')]({'where':_0x9dcedb[_0x79fe('0x53')]})[_0x79fe('0x24')](function(_0x52ae79){_0x751461[_0x79fe('0x30')]=_0x52ae79;_0x9dcedb[_0x79fe('0x111')]=[];if(_0x44f81b[_0x79fe('0x49')][_0x79fe('0x113')]){_0x9dcedb[_0x79fe('0x111')]['push']({'model':db[_0x79fe('0x79')],'as':_0x79fe('0x79'),'attributes':['id',_0x79fe('0x3e'),_0x79fe('0xfb')]});}if(_0x44f81b[_0x79fe('0x49')]['includeAll']){_0x9dcedb[_0x79fe('0x111')]=[{'all':!![]}];}return db[_0x79fe('0xd3')][_0x79fe('0x112')](_0x9dcedb);})['then'](function(_0x30a2e1){_0x751461[_0x79fe('0xbf')]=_0x30a2e1;return _0x751461;});}})[_0x79fe('0x24')](respondWithFilteredResult(_0x24150d,_0x9dcedb))[_0x79fe('0x43')](handleError(_0x24150d,null));};exports[_0x79fe('0x114')]=function(_0x2ba7b8,_0x3d2214,_0x217da0){return db['ChatInteraction'][_0x79fe('0x6a')]({'where':{'id':_0x2ba7b8['params']['id']}})[_0x79fe('0x24')](handleEntityNotFound(_0x3d2214,null))[_0x79fe('0x24')](function(_0x2386cb){if(_0x2386cb){return _0x2386cb[_0x79fe('0x115')](_0x2ba7b8[_0x79fe('0x7f')][_0x79fe('0x10c')],_[_0x79fe('0x10d')](_0x2ba7b8['body'],[_0x79fe('0x10c'),'id'])||{})[_0x79fe('0x116')](function(){return db[_0x79fe('0x117')][_0x79fe('0x112')]({'attributes':['id',_0x79fe('0x3a'),'color'],'where':{'id':_0x2ba7b8[_0x79fe('0x7f')][_0x79fe('0x10c')]}});})[_0x79fe('0x24')](function(_0xc7c07d){socket['emit'](_0x79fe('0x118'),{'id':Number(_0x2ba7b8[_0x79fe('0xc1')]['id']),'tags':_0xc7c07d||[]});return{'id':Number(_0x2ba7b8[_0x79fe('0xc1')]['id']),'tags':_0xc7c07d||[]};});}})[_0x79fe('0x24')](respondWithResult(_0x3d2214,null))[_0x79fe('0x43')](handleError(_0x3d2214,null));};exports[_0x79fe('0x119')]=function(_0x160895,_0x3a6f19,_0x551a6c){return db[_0x79fe('0x44')][_0x79fe('0x6a')]({'where':{'id':_0x160895[_0x79fe('0xc1')]['id']}})[_0x79fe('0x24')](handleEntityNotFound(_0x3a6f19,null))[_0x79fe('0x24')](function(_0x470043){if(_0x470043){return _0x470043[_0x79fe('0x119')](_0x160895['query'][_0x79fe('0x10c')]);}})['then'](respondWithStatusCode(_0x3a6f19,null))[_0x79fe('0x43')](handleError(_0x3a6f19,null));};exports['download']=function(_0x1c9308,_0x1599fd){var _0x427c2b=moment()[_0x79fe('0x11a')]()[_0x79fe('0xa3')]();var _0x5b0588=path[_0x79fe('0xe8')](config[_0x79fe('0xed')],_0x79fe('0x11b'),'files',_0x79fe('0x11c'));var _0x1810a3=path['join'](config[_0x79fe('0xed')],_0x79fe('0x11b'),_0x79fe('0x11d'),_0x79fe('0x11e'));var _0x322623=path[_0x79fe('0xe8')](_0x5b0588,_0x427c2b);var _0x12e9b7=util[_0x79fe('0xef')](_0x79fe('0x11f'),_0x1c9308['params']['id'],_0x427c2b);var _0x809ad4=path[_0x79fe('0xe8')](_0x5b0588,_0x12e9b7);var _0x4686b8=[];_0x4686b8['push']({'model':db['User'],'as':_0x79fe('0x79'),'attributes':['id',_0x79fe('0x3e')],'raw':!![]});_0x4686b8['push']({'model':db[_0x79fe('0xd7')],'as':_0x79fe('0xd8'),'attributes':['id',_0x79fe('0x120'),'lastName'],'raw':!![]});if(_0x1c9308['query'][_0x79fe('0x11e')]){_0x4686b8[_0x79fe('0xbd')]({'model':db[_0x79fe('0x121')],'as':_0x79fe('0x121'),'raw':!![]});}var _0x51887d=[{'model':db[_0x79fe('0xd3')],'as':_0x79fe('0xf2'),'attributes':['id',_0x79fe('0x7f'),_0x79fe('0x85'),_0x79fe('0xfe'),_0x79fe('0xff'),'read'],'include':_0x4686b8}];_0x51887d[_0x79fe('0xbd')]({'model':db['ChatWebsite'],'as':_0x79fe('0x122'),'attributes':['id','name']});_0x51887d[_0x79fe('0xbd')]({'model':db[_0x79fe('0x79')],'as':_0x79fe('0x123'),'attributes':['id',_0x79fe('0x3e')]});return db[_0x79fe('0x44')]['find']({'where':{'id':_0x1c9308[_0x79fe('0xc1')]['id']},'include':_0x51887d})[_0x79fe('0x24')](handleEntityNotFound(_0x1599fd,null))['then'](function(_0xbde545){if(_0xbde545){var _0x50afe0=_0xbde545[_0x79fe('0x124')]({'plain':!![]});fs[_0x79fe('0x125')](_0x322623);var _0x155bc9={'format':'A4','border':_0x79fe('0x126'),'header':{'height':'40px','contents':{'first':_0x79fe('0x127')}},'footer':{'height':'30px','contents':{'default':util[_0x79fe('0xef')](_0x79fe('0x128'),util['format'](_0x79fe('0x129'),_0x79fe('0x12a'),_0x50afe0['id']),moment()[_0x79fe('0xef')](_0x79fe('0x12b'))['toString']())}}};var _0x1d1a01={'channel':'Chat','account':_0x50afe0['Account']['name'],'agent':_0x50afe0[_0x79fe('0x123')]?_0x50afe0[_0x79fe('0x123')][_0x79fe('0x3e')]:_0x79fe('0x12c'),'createdAt':moment(_0x50afe0['createdAt'])['format'](_0x79fe('0x12d'))[_0x79fe('0xa3')](),'closedAt':_0x50afe0['closed']?moment(_0x50afe0['closedAt'])['format'](_0x79fe('0x12d'))[_0x79fe('0xa3')]():'','disposition':_0x50afe0[_0x79fe('0xde')],'chatInfo':{'browser':_0x50afe0[_0x79fe('0x12e')],'os':_0x50afe0[_0x79fe('0x12f')],'referer':_0x50afe0[_0x79fe('0x130')],'customerIp':_0x50afe0[_0x79fe('0x131')],'customerPort':_0x50afe0[_0x79fe('0x132')]?_0x50afe0['customerPort']:_0x79fe('0x12c')},'messages':_(_0x50afe0[_0x79fe('0xf2')])[_0x79fe('0x133')]()[_0x79fe('0x90')]({'secret':![]})[_0x79fe('0x3d')](function(_0x53d73f){if(_0x53d73f[_0x79fe('0x121')]){var _0xe941a9=path[_0x79fe('0xe8')](_0x1810a3,_0x53d73f['Attachment'][_0x79fe('0xe2')]);if(fs[_0x79fe('0x134')](_0xe941a9)){fs[_0x79fe('0x135')](_0xe941a9)['pipe'](fs[_0x79fe('0x136')](path[_0x79fe('0xe8')](_0x322623,_0x53d73f[_0x79fe('0x121')][_0x79fe('0xe2')])));}}return{'date':moment(_0x53d73f[_0x79fe('0x85')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x53d73f[_0x79fe('0xfe')]===_0x79fe('0xd2')?_0x53d73f['User']?_0x53d73f[_0x79fe('0x79')][_0x79fe('0x3e')]:'System':_0x53d73f[_0x79fe('0xd8')][_0x79fe('0x120')]+(_0x53d73f[_0x79fe('0xd8')]['lastName']?'\x20'+_0x53d73f[_0x79fe('0xd8')]['lastName']:''),'body':_0x53d73f[_0x79fe('0x121')]?_0x53d73f[_0x79fe('0x121')][_0x79fe('0xe2')]:_0x53d73f[_0x79fe('0x7f')],'direction':_0x53d73f[_0x79fe('0xfe')]===_0x79fe('0xd2')?'A':'C','secret':_0x53d73f['secret'],'read':_0x53d73f['read'],'attachment':_0x53d73f[_0x79fe('0x121')]};})[_0x79fe('0x6c')]()};return ejs['renderFile'](path[_0x79fe('0xe8')](config[_0x79fe('0xed')],_0x79fe('0x11b'),_0x79fe('0x137'),_0x79fe('0x138')),{'interaction':_0x1d1a01})[_0x79fe('0x24')](function(_0x220ae0){return new BPromise(function(_0x1e9349,_0x42b22b){pdf[_0x79fe('0xc6')](_0x220ae0,_0x155bc9)[_0x79fe('0x139')](path['join'](_0x322623,_0x79fe('0x13a')+_0x50afe0['id']+'-'+_0x427c2b+_0x79fe('0x13b')),function(_0x45ada8,_0xb4bc27){if(_0x45ada8)return _0x42b22b(_0x45ada8);_0x1e9349(_0xb4bc27);});});})[_0x79fe('0x24')](function(){return new BPromise(function(_0x1154e8,_0x271538){zipdir(_0x322623,{'saveTo':_0x809ad4},function(_0x51b737,_0x12428c){if(_0x51b737)return _0x271538(_0x51b737);return _0x1154e8(_0x12428c);});})[_0x79fe('0x24')](function(){return new BPromise(function(_0x20c503,_0x26813e){rimraf(_0x322623,function(_0x4079f6){if(_0x4079f6)_0x26813e(_0x4079f6);return _0x20c503();});});})[_0x79fe('0x24')](function(){return _0x1599fd[_0x79fe('0xea')](_0x809ad4,_0x12e9b7,function(_0x809c5b){if(_0x809c5b){console[_0x79fe('0x13c')](_0x79fe('0x13d'),_0x809c5b);}else{fs['unlinkSync'](_0x809ad4);}});});});}else{return _0x1599fd['sendStatus'](0xc8);}})['catch'](handleError(_0x1599fd,null));}; \ No newline at end of file +var _0xe978=['describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','updateAttributes','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','Attachment','attachmentDownload','closed','attachId','ChatOfflineMessageId','join','root','offline-chat/','download','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','ChatWebsite','%s%d','agentAlias','customer','agentIdentifier','website_alias','System','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','nolimit','options','findAll','getMyMessages','secret','color','emit','chatInteractionTags:save','removeTags','unix','files','tmp','attachments','transcript-%d-%s.zip','Contact','firstName','Account','Owner','get','mkdirSync','40px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Chat','YYYY-MM-DD','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','referer','customerPort','N.A.','tail','existsSync','createReadStream','createWriteStream','direction','lastName','renderFile','views','downloadInteraction.html','toFile','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','client','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','fullname','TagIds','split','Tags','push','map','ChatInteraction','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','select','field','from','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','forEach','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','isEmpty','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','role','sequelize','toString','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.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','show','params','keys','rawAttributes','includeAll','include','merge','create'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xe978,0x70));var _0x8e97=function(_0x94c2c3,_0x3c551d){_0x94c2c3=_0x94c2c3-0x0;var _0x50661d=_0xe978[_0x94c2c3];return _0x50661d;};'use strict';var pdf=require(_0x8e97('0x0'));var emlformat=require(_0x8e97('0x1'));var rimraf=require(_0x8e97('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8e97('0x3'));var moment=require(_0x8e97('0x4'));var BPromise=require(_0x8e97('0x5'));var Mustache=require(_0x8e97('0x6'));var util=require(_0x8e97('0x7'));var path=require('path');var sox=require(_0x8e97('0x8'));var csv=require(_0x8e97('0x9'));var ejs=require(_0x8e97('0xa'));var fs=require('fs');var fs_extra=require(_0x8e97('0xb'));var _=require(_0x8e97('0xc'));var squel=require('squel');var crypto=require(_0x8e97('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8e97('0xe'));var toCsv=require(_0x8e97('0x9'));var querystring=require(_0x8e97('0xf'));var Papa=require('papaparse');var Redis=require(_0x8e97('0x10'));var authService=require(_0x8e97('0x11'));var qs=require(_0x8e97('0x12'));var as=require(_0x8e97('0x13'));var hardwareService=require(_0x8e97('0x14'));var logger=require(_0x8e97('0x15'))(_0x8e97('0x16'));var utils=require(_0x8e97('0x17'));var config=require(_0x8e97('0x18'));var licenseUtil=require(_0x8e97('0x19'));var db=require(_0x8e97('0x1a'))['db'];config['redis']=_[_0x8e97('0x1b')](config[_0x8e97('0x1c')],{'host':_0x8e97('0x1d'),'port':0x18eb});var socket=require(_0x8e97('0x1e'))(new Redis(config['redis']));require('./chatInteraction.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});var client9004=jayson[_0x8e97('0x1f')]['http']({'port':0x232c});function respondWithRpcPromise(_0x33b6b3,_0x3bb176,_0x4943c1,_0x4efaa3){return new BPromise(function(_0x185a04,_0x3f3738){var _0xb779ed=_0x4efaa3||client;return _0xb779ed[_0x8e97('0x20')](_0x33b6b3,_0x4943c1)[_0x8e97('0x21')](function(_0x2b823e){logger[_0x8e97('0x22')](_0x8e97('0x23'),_0x3bb176,_0x8e97('0x24'));logger['debug'](_0x8e97('0x25'),_0x3bb176,_0x8e97('0x24'),JSON[_0x8e97('0x26')](_0x2b823e));if(_0x2b823e[_0x8e97('0x27')]){if(_0x2b823e[_0x8e97('0x27')][_0x8e97('0x28')]===0x1f4){logger[_0x8e97('0x27')]('ChatInteraction,\x20%s,\x20%s',_0x3bb176,_0x2b823e[_0x8e97('0x27')][_0x8e97('0x29')]);return _0x3f3738(_0x2b823e[_0x8e97('0x27')][_0x8e97('0x29')]);}logger[_0x8e97('0x27')](_0x8e97('0x23'),_0x3bb176,_0x2b823e[_0x8e97('0x27')][_0x8e97('0x29')]);return _0x185a04(_0x2b823e[_0x8e97('0x27')][_0x8e97('0x29')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x3bb176,'request\x20sent');_0x185a04(_0x2b823e[_0x8e97('0x2a')][_0x8e97('0x29')]);}})[_0x8e97('0x2b')](function(_0xcee009){logger[_0x8e97('0x27')](_0x8e97('0x23'),_0x3bb176,_0xcee009);_0x3f3738(_0xcee009);});});}function respondWithStatusCode(_0x8ffc5b,_0xc48542){_0xc48542=_0xc48542||0xcc;return function(_0x5cc6fc){if(_0x5cc6fc){return _0x8ffc5b[_0x8e97('0x2c')](_0xc48542);}return _0x8ffc5b[_0x8e97('0x2d')](_0xc48542)[_0x8e97('0x2e')]();};}function respondWithResult(_0x5bb338,_0x1ba074){_0x1ba074=_0x1ba074||0xc8;return function(_0x4ef232){if(_0x4ef232){return _0x5bb338[_0x8e97('0x2d')](_0x1ba074)[_0x8e97('0x2f')](_0x4ef232);}};}function respondWithFilteredResult(_0xa5b3de,_0x2f7919){return function(_0xb1ce05){if(_0xb1ce05){var _0x65a7b5=_0xb1ce05[_0x8e97('0x30')],_0x180b9d=_0x2f7919[_0x8e97('0x31')],_0x5b0c76=_0x2f7919[_0x8e97('0x31')]+_0x2f7919[_0x8e97('0x32')],_0x4b7003;if(_0x5b0c76>=_0x65a7b5){_0x5b0c76=_0x65a7b5;_0x4b7003=0xc8;}else{_0x4b7003=0xce;}_0xa5b3de['status'](_0x4b7003);return _0xa5b3de[_0x8e97('0x33')](_0x8e97('0x34'),_0x180b9d+'-'+_0x5b0c76+'/'+_0x65a7b5)[_0x8e97('0x2f')](_0xb1ce05);}return null;};}function patchUpdates(_0x2bab42){return function(_0x46ddaa){try{jsonpatch['apply'](_0x46ddaa,_0x2bab42,!![]);}catch(_0x1a79de){return BPromise[_0x8e97('0x35')](_0x1a79de);}return _0x46ddaa[_0x8e97('0x36')]();};}function saveUpdates(_0x105bc1,_0x1dd009){return function(_0x54356c){if(_0x54356c){return _0x54356c[_0x8e97('0x37')](_0x105bc1)['then'](function(_0x270ce6){return _0x270ce6;});}return null;};}function removeEntity(_0x117971,_0x2da570){return function(_0x2224e0){if(_0x2224e0){return _0x2224e0[_0x8e97('0x38')]()['then'](function(){_0x117971[_0x8e97('0x2d')](0xcc)[_0x8e97('0x2e')]();});}};}function handleEntityNotFound(_0x5420ac,_0x5349ed){return function(_0x30a009){if(!_0x30a009){_0x5420ac[_0x8e97('0x2c')](0x194);}return _0x30a009;};}function handleError(_0x27533d,_0x4d0f88){_0x4d0f88=_0x4d0f88||0x1f4;return function(_0x213883){logger[_0x8e97('0x27')](_0x213883[_0x8e97('0x39')]);if(_0x213883[_0x8e97('0x3a')]){delete _0x213883[_0x8e97('0x3a')];}_0x27533d['status'](_0x4d0f88)[_0x8e97('0x3b')](_0x213883);};}function getInteractionUsers(_0x5302ee,_0x21ea34){return new BPromise(function(_0x374543,_0x2441a1){try{if(_0x21ea34[_0x5302ee['id']]){_0x5302ee['Users']=_['map'](_0x21ea34[_0x5302ee['id']],function(_0x3b8fae){return{'id':_0x3b8fae['id'],'fullname':_0x3b8fae[_0x8e97('0x3c')]};});}}catch(_0x171c06){_0x2441a1(_0x171c06);}_0x374543(_0x5302ee);});}function getInteractionTags(_0x5bf0f8,_0x5b870a){return new BPromise(function(_0x423237,_0x200772){try{if(_0x5bf0f8[_0x8e97('0x3d')]){_0x5bf0f8['Tags']=[];_0x5bf0f8['TagIds'][_0x8e97('0x3e')](',')['forEach'](function(_0x1b05a9){_0x5bf0f8[_0x8e97('0x3f')][_0x8e97('0x40')](_0x5b870a[_0x1b05a9]);});}delete _0x5bf0f8[_0x8e97('0x3d')];}catch(_0x1b5bf2){_0x200772(_0x1b5bf2);}_0x423237(_0x5bf0f8);});}function updateChatInteraction(_0x13d73b,_0x41e925,_0x55d71f){return new BPromise(function(_0x305eae,_0x52f639){return getInteractionUsers(_0x13d73b,_0x55d71f)[_0x8e97('0x21')](function(_0x27185b){return getInteractionTags(_0x27185b,_0x41e925);})[_0x8e97('0x21')](function(_0x3e0e33){_0x305eae(_0x3e0e33);})[_0x8e97('0x2b')](function(_0x3287b0){_0x52f639(_0x3287b0);});});}exports['index']=function(_0xa88699,_0xf79867){var _0x8dd265={},_0x4ba89c={},_0x8e9af1={'count':0x0,'rows':[]};var _0x4e5355=_[_0x8e97('0x41')](db[_0x8e97('0x42')]['rawAttributes'],function(_0x500077){return{'name':_0x500077[_0x8e97('0x43')],'type':_0x500077[_0x8e97('0x44')][_0x8e97('0x45')]};});_0x4ba89c[_0x8e97('0x46')]=_[_0x8e97('0x41')](_0x4e5355,_0x8e97('0x3a'));_0x4ba89c[_0x8e97('0x47')]=_['keys'](_0xa88699[_0x8e97('0x47')]);_0x4ba89c[_0x8e97('0x48')]=_[_0x8e97('0x49')](_0x4ba89c[_0x8e97('0x46')],_0x4ba89c[_0x8e97('0x47')]);_0x8dd265[_0x8e97('0x4a')]=_['intersection'](_0x4ba89c[_0x8e97('0x46')],qs[_0x8e97('0x4b')](_0xa88699[_0x8e97('0x47')]['fields']));_0x8dd265['attributes']=_0x8dd265[_0x8e97('0x4a')][_0x8e97('0x4c')]?_0x8dd265[_0x8e97('0x4a')]:_0x4ba89c[_0x8e97('0x46')];if(!_0xa88699[_0x8e97('0x47')][_0x8e97('0x4d')]('nolimit')){_0x8dd265[_0x8e97('0x32')]=qs[_0x8e97('0x32')](_0xa88699[_0x8e97('0x47')][_0x8e97('0x32')]);_0x8dd265['offset']=qs[_0x8e97('0x31')](_0xa88699['query']['offset']);}_0x8dd265[_0x8e97('0x4e')]=qs[_0x8e97('0x4f')](_0xa88699[_0x8e97('0x47')][_0x8e97('0x4f')]);_0x8dd265[_0x8e97('0x50')]=qs[_0x8e97('0x48')](_[_0x8e97('0x51')](_0xa88699[_0x8e97('0x47')],_0x4ba89c[_0x8e97('0x48')]),_0x4e5355);var _0x1e3b6a=[];var _0x3efbd9=squel[_0x8e97('0x52')]()['field']('id')['field'](_0x8e97('0x3a'))[_0x8e97('0x53')]('color')[_0x8e97('0x54')]('tools_tags');var _0x291ab9=squel['select']()['field'](_0x8e97('0x55'))[_0x8e97('0x53')](_0x8e97('0x56'))[_0x8e97('0x53')](_0x8e97('0x57'))[_0x8e97('0x54')](_0x8e97('0x58'),'ui')[_0x8e97('0x59')](_0x8e97('0x5a'),'u','u.id\x20=\x20ui.UserId');var _0x4a9d99=squel[_0x8e97('0x52')]()[_0x8e97('0x54')](_0x8e97('0x5b'),'i')[_0x8e97('0x59')]('cm_contacts','c',_0x8e97('0x5c'))['left_join']('users','o',_0x8e97('0x5d'))[_0x8e97('0x59')](_0x8e97('0x5e'),'a',_0x8e97('0x5f'))['left_join'](_0x8e97('0x60'),'me','me.ChatInteractionId\x20=\x20i.id')[_0x8e97('0x59')](_0x8e97('0x61'),'it',_0x8e97('0x62'))[_0x8e97('0x59')](_0x8e97('0x63'),'t','t.id\x20=\x20it.TagId');var _0x21c076=squel['expr']();var _0x1e49db=[];var _0x3b6512=squel['expr']();var _0x235df3;if(_0xa88699[_0x8e97('0x47')][_0x8e97('0x64')]){_0x235df3=as[_0x8e97('0x65')](_0xa88699[_0x8e97('0x47')][_0x8e97('0x64')]);var _0x1eb7a6=_0x235df3[_0x8e97('0x66')];for(var _0x1a626b=0x0;_0x1a626b<_0x235df3['conditions'][_0x8e97('0x4c')];_0x1a626b++){var _0x156517=_0x235df3[_0x8e97('0x67')][_0x1a626b];var _0x39b493='i';var _0x4db11a=_[_0x8e97('0x68')](_0x4e5355,[_0x8e97('0x3a'),_0x156517[_0x8e97('0x53')]]);if(!_0x4db11a){switch(_0x156517[_0x8e97('0x53')]){case _0x8e97('0x69'):if(_0x156517[_0x8e97('0x6a')]==0x1){_0x4a9d99[_0x8e97('0x6b')]('`'+_0x156517['field']+'`\x20=\x200');}else{_0x4a9d99['having']('`'+_0x156517[_0x8e97('0x53')]+'`\x20>\x200');}break;case'Contact':if(_0x156517[_0x8e97('0x6c')]===_0x8e97('0x6d')){if(_0x156517[_0x8e97('0x6a')][_0x8e97('0x3e')]('\x20')[_0x8e97('0x4c')]>0x1){_0x21c076[_0x1eb7a6]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8e97('0x6e')](_0x156517[_0x8e97('0x6a')]),null);}else{var _0x3bba0b='%'+_0x156517[_0x8e97('0x6a')]+'%';_0x21c076[_0x1eb7a6](_0x8e97('0x6f'),_0x3bba0b,_0x3bba0b,_0x3bba0b);}}else{_0x4db11a=_[_0x8e97('0x68')](_0x4e5355,['name',_0x8e97('0x70')]);_0x156517[_0x8e97('0x53')]=_0x8e97('0x70');_0xef2acb=as[_0x8e97('0x71')](_0x39b493,_0x4db11a[_0x8e97('0x44')],_0x156517);_0x21c076[_0x1eb7a6](_0xef2acb['text'],_0xef2acb[_0x8e97('0x6a')][_0x8e97('0x72')],_0xef2acb['value'][_0x8e97('0x2e')]);}break;case _0x8e97('0x73'):var _0x33c579=_0x156517['value']['split'](',')[_0x8e97('0x41')](function(_0x5ec6d5){return Number(_0x5ec6d5);});_0x33c579[_0x8e97('0x74')](function(_0x7424f4){_0x3b6512['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x7424f4+',%');});_0x1e49db=_[_0x8e97('0x75')](_0x1e49db,_0x33c579);break;case _0x8e97('0x76'):if(_0x156517[_0x8e97('0x6c')]===_0x8e97('0x6d')){_0x21c076[_0x1eb7a6](_0x8e97('0x77'),'%'+_0x156517[_0x8e97('0x6a')]+'%',null);}else{_0x4db11a=_[_0x8e97('0x68')](_0x4e5355,[_0x8e97('0x3a'),_0x8e97('0x78')]);_0x156517[_0x8e97('0x53')]=_0x8e97('0x78');_0xef2acb=as[_0x8e97('0x71')](_0x39b493,_0x4db11a[_0x8e97('0x44')],_0x156517);_0x21c076[_0x1eb7a6](_0xef2acb[_0x8e97('0x79')],_0xef2acb['value'][_0x8e97('0x72')],_0xef2acb[_0x8e97('0x6a')]['end']);}break;case _0x8e97('0x7a'):_0xef2acb=as['buildExpression']('me',null,_0x156517);_0x21c076[_0x1eb7a6](_0xef2acb[_0x8e97('0x79')],_0xef2acb['value'][_0x8e97('0x72')],_0xef2acb[_0x8e97('0x6a')]['end']);break;}}else{var _0xef2acb=as['buildExpression'](_0x39b493,_0x4db11a[_0x8e97('0x44')],_0x156517);_0x21c076[_0x1eb7a6](_0xef2acb[_0x8e97('0x79')],_0xef2acb['value']['start'],_0xef2acb[_0x8e97('0x6a')][_0x8e97('0x2e')]);}}}else{var _0x434adc=_(_0xa88699[_0x8e97('0x47')])['keys']()[_0x8e97('0x41')](function(_0x2055f3){return _['some'](_0x4e5355,[_0x8e97('0x3a'),_0x2055f3])?_0x2055f3:undefined;})['compact']()[_0x8e97('0x6a')]();if(!_[_0x8e97('0x7b')](_0x434adc)){_0x434adc[_0x8e97('0x74')](function(_0x59f47a){if(_0x59f47a==='ChatWebsiteId'){_0x4a9d99[_0x8e97('0x50')]('i.ChatWebsiteId\x20IN\x20?',[][_0x8e97('0x7c')](_0xa88699[_0x8e97('0x47')][_0x59f47a]));}else if(_0x59f47a===_0x8e97('0x7d')){var _0x2553ec=JSON[_0x8e97('0x7e')](_0xa88699[_0x8e97('0x47')][_0x59f47a])[_0x8e97('0x7f')];var _0x3bb03c=JSON[_0x8e97('0x7e')](_0xa88699[_0x8e97('0x47')][_0x59f47a])['$lte'];_0x4a9d99[_0x8e97('0x50')](_0x8e97('0x80'),_0x2553ec,_0x3bb03c);}else{if(_0xa88699[_0x8e97('0x47')][_0x59f47a]===_0x8e97('0x81')){_0x4a9d99[_0x8e97('0x50')]('i.'+_0x59f47a+_0x8e97('0x82'));}else{_0x4a9d99[_0x8e97('0x50')]('i.'+_0x59f47a+_0x8e97('0x83'),_0xa88699[_0x8e97('0x47')][_0x59f47a]);}}});}if(_0xa88699['query']['read']){if(_0xa88699['query'][_0x8e97('0x84')]==0x1){_0x4a9d99[_0x8e97('0x6b')](_0x8e97('0x85'));}else{_0x4a9d99[_0x8e97('0x6b')](_0x8e97('0x86'));}}if(_0xa88699[_0x8e97('0x47')][_0x8e97('0x87')]){_0x1e49db=_[_0x8e97('0x88')](_0xa88699['query'][_0x8e97('0x87')])?_0xa88699[_0x8e97('0x47')][_0x8e97('0x87')]:new Array(_0xa88699[_0x8e97('0x47')][_0x8e97('0x87')]);_0x1e49db[_0x8e97('0x74')](function(_0x154ad0){_0x3b6512['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x154ad0+',%');});}if(_0xa88699[_0x8e97('0x47')][_0x8e97('0x89')]){var _0x451b5e=_0xa88699[_0x8e97('0x47')][_0x8e97('0x89')][_0x8e97('0x8a')]('\x5c','\x5c\x5c')[_0x8e97('0x8a')](/'/g,'\x27\x27');if(qs[_0x8e97('0x8b')](_0x451b5e)){_0x21c076['or'](_0x8e97('0x8c'),_0x451b5e+'%');}else{_0x21c076['or'](_0x8e97('0x8d'),qs[_0x8e97('0x6e')](_0x451b5e))['or'](_0x8e97('0x8e'),_0x451b5e+'%');}}}_0x4a9d99[_0x8e97('0x50')](_0x21c076);_0x4a9d99['group'](_0x8e97('0x8f'));var _0x293540={'type':db['Sequelize'][_0x8e97('0x90')][_0x8e97('0x91')],'raw':!![]};var _0x33b548=_0x4a9d99[_0x8e97('0x92')]();_0x33b548[_0x8e97('0x53')]('i.id');_0x33b548[_0x8e97('0x53')](_0x8e97('0x93'),'unreadMessages');if(_0x8dd265[_0x8e97('0x4e')]){_0x8dd265[_0x8e97('0x4e')][_0x8e97('0x74')](function(_0x10171a){var _0x5c2f1a=_0x10171a[0x0]===_0x8e97('0x94')?_0x10171a[0x0]:'i.'+_0x10171a[0x0];_0x4a9d99[_0x8e97('0x4e')](_0x5c2f1a,_0x10171a[0x1]===_0x8e97('0x95')?![]:!![]);});}if(!_[_0x8e97('0x7b')](_0x1e49db)){_0x4a9d99[_0x8e97('0x6b')](_0x3b6512);_0x33b548[_0x8e97('0x50')](_0x8e97('0x96'),_0x1e49db);}BPromise[_0x8e97('0x97')]()[_0x8e97('0x21')](function(){if(!_0x235df3){if(_0xa88699['query'][_0x8e97('0x98')])return;_0x33b548[_0x8e97('0x50')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x4a9d99[_0x8e97('0x50')](_0x8e97('0x99'));return;}if(_0xa88699[_0x8e97('0x9a')]['role']!=='agent')return;return _0xa88699[_0x8e97('0x9a')]['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0x8e97('0x21')](function(_0x308655){if(_[_0x8e97('0x7b')](_0x308655)){_0x33b548[_0x8e97('0x50')](_0x8e97('0x9b'));_0x4a9d99['where']('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x33b548['where'](_0x8e97('0x9c'),_[_0x8e97('0x41')](_0x308655,'id'));_0x4a9d99[_0x8e97('0x50')](_0x8e97('0x9c'),_[_0x8e97('0x41')](_0x308655,'id'));}});})[_0x8e97('0x21')](function(){if(_0xa88699[_0x8e97('0x9a')][_0x8e97('0x9d')]==='agent'&&!_0x235df3&&!_0xa88699[_0x8e97('0x47')][_0x8e97('0x98')])return[];return db[_0x8e97('0x9e')]['query'](_0x33b548[_0x8e97('0x9f')](),_0x293540);})[_0x8e97('0x21')](function(_0x190c26){_0x8e9af1[_0x8e97('0x30')]=_0x190c26[_0x8e97('0x4c')];if(_0x8e9af1['count']===0x0)return[];return db[_0x8e97('0x9e')][_0x8e97('0x47')](_0x3efbd9['toString'](),_0x293540)[_0x8e97('0x21')](function(_0x330ec7){_0x1e3b6a=_['keyBy'](_0x330ec7,'id');_0x293540=_['merge'](_0x293540,{'model':db[_0x8e97('0x42')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xa88699[_0x8e97('0x47')][_0x8e97('0x4b')]){_0x8dd265[_0x8e97('0x4a')][_0x8e97('0x74')](function(_0x281080){_0x4a9d99[_0x8e97('0x53')]('i.'+_0x281080);});}else{_0x4a9d99[_0x8e97('0x53')](_0x8e97('0x93'),_0x8e97('0x69'));_0x4a9d99['field'](_0x8e97('0xa0'),_0x8e97('0xa1'));_0x4a9d99['field'](_0x8e97('0xa2'),_0x8e97('0xa3'));_0x4a9d99['field'](_0x8e97('0xa4'),_0x8e97('0x94'));_0x4a9d99[_0x8e97('0x53')](_0x8e97('0xa5'));_0x4a9d99[_0x8e97('0x53')]('c.firstName','Contact.firstName');_0x4a9d99[_0x8e97('0x53')](_0x8e97('0xa6'),_0x8e97('0xa7'));_0x4a9d99[_0x8e97('0x53')](_0x8e97('0xa8'),_0x8e97('0xa9'));_0x4a9d99['field'](_0x8e97('0xaa'),_0x8e97('0xab'));_0x4a9d99[_0x8e97('0x53')](_0x8e97('0xac'),_0x8e97('0xad'));_0x4a9d99[_0x8e97('0x53')]('c.fax',_0x8e97('0xae'));_0x4a9d99[_0x8e97('0x53')](_0x8e97('0xaf'),_0x8e97('0xb0'));_0x4a9d99[_0x8e97('0x53')](_0x8e97('0xb1'),_0x8e97('0xb2'));_0x4a9d99[_0x8e97('0x53')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x8e97('0x3d'));}if(_0x8dd265[_0x8e97('0x32')])_0x4a9d99[_0x8e97('0x32')](_0x8dd265[_0x8e97('0x32')]);if(_0x8dd265[_0x8e97('0x31')])_0x4a9d99[_0x8e97('0x31')](_0x8dd265[_0x8e97('0x31')]);return db[_0x8e97('0x9e')][_0x8e97('0x47')](_0x4a9d99[_0x8e97('0x9f')](),_0x293540);})['then'](function(_0xe32575){_0x291ab9[_0x8e97('0x50')](_0x8e97('0xb3'),_[_0x8e97('0x41')](_0xe32575,'id'));return db['sequelize']['query'](_0x291ab9[_0x8e97('0x9f')](),_0x293540)[_0x8e97('0x21')](function(_0x404e3a){var _0x15c09a=_[_0x8e97('0xb4')](_0x404e3a,_0x8e97('0xb5'));var _0x50ab21=[];_0xe32575[_0x8e97('0x74')](function(_0x3c778c){_0x50ab21[_0x8e97('0x40')](updateChatInteraction(_0x3c778c,_0x1e3b6a,_0x15c09a));});return BPromise[_0x8e97('0xb6')](_0x50ab21);});});})[_0x8e97('0x21')](function(_0x2ce282){_0x8e9af1[_0x8e97('0xb7')]=_0x2ce282;return _0x8e9af1;})['then'](respondWithFilteredResult(_0xf79867,_0x8dd265))[_0x8e97('0x2b')](handleError(_0xf79867,null));};exports[_0x8e97('0xb8')]=function(_0x34ab23,_0x2acea4){var _0x8a2d7a={'raw':![],'where':{'id':_0x34ab23[_0x8e97('0xb9')]['id']}},_0x314818={};_0x314818['model']=_[_0x8e97('0xba')](db[_0x8e97('0x42')][_0x8e97('0xbb')]);_0x314818[_0x8e97('0x47')]=_[_0x8e97('0xba')](_0x34ab23['query']);_0x314818['filters']=_['intersection'](_0x314818[_0x8e97('0x46')],_0x314818[_0x8e97('0x47')]);_0x8a2d7a[_0x8e97('0x4a')]=_[_0x8e97('0x49')](_0x314818[_0x8e97('0x46')],qs[_0x8e97('0x4b')](_0x34ab23['query'][_0x8e97('0x4b')]));_0x8a2d7a[_0x8e97('0x4a')]=_0x8a2d7a[_0x8e97('0x4a')]['length']?_0x8a2d7a['attributes']:_0x314818['model'];if(_0x34ab23[_0x8e97('0x47')][_0x8e97('0xbc')]){_0x8a2d7a[_0x8e97('0xbd')]=[{'all':!![]}];}_0x8a2d7a=_[_0x8e97('0xbe')]({},_0x8a2d7a,_0x34ab23['options']);return db['ChatInteraction'][_0x8e97('0x68')](_0x8a2d7a)['then'](handleEntityNotFound(_0x2acea4,null))['then'](respondWithResult(_0x2acea4,null))[_0x8e97('0x2b')](handleError(_0x2acea4,null));};exports['create']=function(_0x4f19a7,_0x31b973){return db[_0x8e97('0x42')][_0x8e97('0xbf')](_0x4f19a7[_0x8e97('0x7a')],{})[_0x8e97('0x21')](respondWithResult(_0x31b973,0xc9))[_0x8e97('0x2b')](handleError(_0x31b973,null));};exports['update']=function(_0x4a04e0,_0x2ca907){if(_0x4a04e0[_0x8e97('0x7a')]['id']){delete _0x4a04e0['body']['id'];}return db[_0x8e97('0x42')][_0x8e97('0x68')]({'where':{'id':_0x4a04e0[_0x8e97('0xb9')]['id']}})[_0x8e97('0x21')](handleEntityNotFound(_0x2ca907,null))[_0x8e97('0x21')](saveUpdates(_0x4a04e0[_0x8e97('0x7a')],null))[_0x8e97('0x21')](respondWithResult(_0x2ca907,null))[_0x8e97('0x2b')](handleError(_0x2ca907,null));};exports[_0x8e97('0x38')]=function(_0x2912d3,_0x202c58){return db['ChatInteraction'][_0x8e97('0x68')]({'where':{'id':_0x2912d3[_0x8e97('0xb9')]['id']}})[_0x8e97('0x21')](handleEntityNotFound(_0x202c58,null))[_0x8e97('0x21')](removeEntity(_0x202c58,null))[_0x8e97('0x2b')](handleError(_0x202c58,null));};exports[_0x8e97('0xc0')]=function(_0x21f902,_0x5bba1b){return db[_0x8e97('0x42')][_0x8e97('0xc0')]()[_0x8e97('0x21')](respondWithResult(_0x5bba1b,null))['catch'](handleError(_0x5bba1b,null));};exports[_0x8e97('0xc1')]=function(_0x5c14c1,_0x250ee4){var _0x44bfcf=_0x5c14c1[_0x8e97('0xb9')]['id'];var _0x6ae782;var _0x1bd2e9;var _0x2e9954;return db['ChatInteraction'][_0x8e97('0xc2')]({'where':{'id':_0x44bfcf}})['then'](function(_0x1e533d){_0x6ae782=_0x1e533d;return db['ChatWebsite'][_0x8e97('0xc2')]({'where':{'id':_0x1e533d[_0x8e97('0x98')]},'attributes':['id',_0x8e97('0xc3'),'vidaooEscalation'],'raw':!![]});})[_0x8e97('0x21')](function(_0x1a3512){if(_0x1a3512&&_0x1a3512[_0x8e97('0xc3')]&&_0x1a3512[_0x8e97('0xc4')]){_0x1bd2e9=_0x1a3512;var _0x1c9c9c={'rejectUnauthorized':![],'method':'POST','uri':'https://api-vidaoo.xcally.com/api/v1/sessions','headers':{'X-APIKEY':_0x1a3512[_0x8e97('0xc3')]},'body':{'name':'MotionCWB:'+_0x44bfcf},'redirect':'follow','json':!![]};return rp(_0x1c9c9c);}else{throw new db[(_0x8e97('0xc5'))][(_0x8e97('0xc6'))](_0x8e97('0xc7'));}})[_0x8e97('0x21')](function(_0x235dcc){_0x2e9954=_0x235dcc;if(_0x2e9954['id']){var _0x1a9d6b={'body':_0x2e9954['join_url'],'ChatWebsiteId':_0x1bd2e9['id'],'ChatInteractionId':_0x6ae782['id'],'direction':_0x8e97('0xc8'),'UserId':_0x5c14c1[_0x8e97('0x9a')]['id']};return db[_0x8e97('0xc9')][_0x8e97('0xbf')](_0x1a9d6b,{});}else{throw new db[(_0x8e97('0xc5'))][(_0x8e97('0xc6'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x8e97('0x21')](function(){return _0x6ae782[_0x8e97('0xca')]({'vidaooSessionId':_0x2e9954['id']});})[_0x8e97('0x21')](respondWithResult(_0x250ee4,null))[_0x8e97('0x2b')](handleError(_0x250ee4,null));};exports['customUpdate']=function(_0x58a5a8,_0x5e8180){if(_0x58a5a8[_0x8e97('0x7a')]['id']){delete _0x58a5a8[_0x8e97('0x7a')]['id'];}return db[_0x8e97('0x42')][_0x8e97('0x68')]({'where':{'id':_0x58a5a8['params']['id']},'include':[{'model':db[_0x8e97('0xcb')],'as':'Contact'}]})[_0x8e97('0x21')](handleEntityNotFound(_0x5e8180,null))[_0x8e97('0x21')](saveUpdates(_0x58a5a8[_0x8e97('0x7a')],null))[_0x8e97('0x21')](respondWithResult(_0x5e8180,null))[_0x8e97('0x2b')](handleError(_0x5e8180,null));};exports[_0x8e97('0xcc')]=function(_0x207e63,_0x30ced0,_0x534bd6){if(_0x207e63[_0x8e97('0x7a')]['id']){delete _0x207e63[_0x8e97('0x7a')]['id'];}return db[_0x8e97('0x42')][_0x8e97('0x68')]({'where':{'id':_0x207e63['params']['id']}})[_0x8e97('0x21')](function(_0x457ca5){if(!_0x457ca5){logger[_0x8e97('0x27')](_0x8e97('0xcd'),_0x8e97('0xcc'),0x194,_0x8e97('0xce'));_0x30ced0[_0x8e97('0x2c')](0x194);}else{if(_0x457ca5['UserId']){throw new db[(_0x8e97('0xc5'))][(_0x8e97('0xc6'))]('Interaction\x20already\x20assigned');}}return _0x457ca5;})[_0x8e97('0x21')](function(_0x33e13a){if(_0x33e13a){return _0x33e13a[_0x8e97('0x37')]({'closed':_0x207e63[_0x8e97('0x7a')]['closed'],'disposition':_0x207e63[_0x8e97('0x7a')][_0x8e97('0xcf')]})[_0x8e97('0x21')](function(_0x5188c6){return _0x5188c6;});}})['then'](function(_0x263369){return respondWithRpcPromise(_0x8e97('0xd0'),_0x8e97('0xcc'),_0x207e63['body'],client9004);})[_0x8e97('0x21')](respondWithResult(_0x30ced0,null))[_0x8e97('0x2b')](handleError(_0x30ced0,null));};exports[_0x8e97('0xd1')]=function(_0x1573b7,_0x1855c0,_0x58338d){_0x1573b7[_0x8e97('0x7a')][_0x8e97('0x3a')]=_0x1573b7[_0x8e97('0xd2')][_0x8e97('0xd3')];_0x1573b7[_0x8e97('0x7a')][_0x8e97('0xd4')]=_0x1573b7[_0x8e97('0xd2')]['filename'];_0x1573b7[_0x8e97('0x7a')]['type']=_0x1573b7[_0x8e97('0xd2')]['mimetype'];return db[_0x8e97('0xd5')][_0x8e97('0xbf')](_0x1573b7['body'])[_0x8e97('0x21')](respondWithResult(_0x1855c0,0xc9))[_0x8e97('0x2b')](handleError(_0x1855c0,null));};exports[_0x8e97('0xd6')]=function(_0x11e68d,_0x4d2c50,_0x1f40e0){return db['ChatInteraction']['findOne']({'where':{'id':_0x11e68d[_0x8e97('0xb9')]['id']},'raw':!![]})[_0x8e97('0x21')](handleEntityNotFound(_0x4d2c50,null))[_0x8e97('0x21')](function(_0x5d5ce4){if(_0x5d5ce4){if(_0x5d5ce4[_0x8e97('0xd7')]){return _0x4d2c50['status'](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0x8e97('0xd5')]['findOne']({'where':{'id':_0x11e68d[_0x8e97('0x47')][_0x8e97('0xd8')]},'raw':!![]})['then'](handleEntityNotFound(_0x4d2c50,null));}})['then'](function(_0x5b3d5d){if(_0x5b3d5d){var _0x1046db=_0x5b3d5d[_0x8e97('0xd9')]!==null;var _0x317a74=path[_0x8e97('0xda')](config[_0x8e97('0xdb')],'server/files/attachments/');if(_0x1046db){_0x317a74=path[_0x8e97('0xda')](_0x317a74,_0x8e97('0xdc'));}var _0x2b5408=path[_0x8e97('0xda')](_0x317a74,_0x5b3d5d[_0x8e97('0xd4')]);return _0x4d2c50[_0x8e97('0xdd')](_0x2b5408);}})[_0x8e97('0x2b')](handleError(_0x4d2c50,null));};exports['close']=function(_0x3e110c,_0x444117){var _0x165e28=null;var _0x155472=null;var _0x53de12=null;var _0x3567c2=null;if(_0x3e110c['body']['id']){delete _0x3e110c[_0x8e97('0x7a')]['id'];}if(_0x3e110c[_0x8e97('0x7a')][_0x8e97('0xde')]){_0x3567c2=path[_0x8e97('0xda')](config[_0x8e97('0xdb')],_0x8e97('0xdf'),util[_0x8e97('0xe0')](_0x8e97('0xe1'),Date[_0x8e97('0xe2')]()));_0x3e110c[_0x8e97('0x7a')][_0x8e97('0xe3')]=_0x3567c2;}return db[_0x8e97('0x42')]['find']({'where':{'id':_0x3e110c['params']['id']},'include':[{'model':db[_0x8e97('0xc9')],'as':_0x8e97('0xe4'),'include':[{'model':db[_0x8e97('0x76')],'as':_0x8e97('0x76')}]}]})['then'](handleEntityNotFound(_0x444117,null))[_0x8e97('0x21')](saveUpdates(_0x3e110c[_0x8e97('0x7a')],null))[_0x8e97('0x21')](function(_0x106636){if(_0x106636){_0x165e28=_0x106636;return db[_0x8e97('0xe5')][_0x8e97('0x68')]({'where':{'id':_0x165e28[_0x8e97('0x98')]}});}})[_0x8e97('0x21')](function(_0x330268){if(_0x330268){_0x53de12=_0x330268;return db[_0x8e97('0xcb')]['find']({'where':{'id':_0x165e28[_0x8e97('0x70')]}});}})[_0x8e97('0x21')](function(_0x1ed2e3){if(_0x1ed2e3){_0x155472=_0x1ed2e3;if(_0x3567c2){var _0x3ff82a=null;for(var _0x5673ea=0x1;_0x5673ea<_0x165e28[_0x8e97('0xe4')][_0x8e97('0x4c')];++_0x5673ea){_0x3ff82a=_0x165e28[_0x8e97('0xe4')][_0x5673ea];var _0x3a4f3a=_0x3ff82a['UserId']?util[_0x8e97('0xe0')](_0x8e97('0xe6'),_0x53de12[_0x8e97('0xe7')],_0x3ff82a[_0x8e97('0x78')]):'System';var _0x311153=_0x3e110c['body'][_0x8e97('0xe8')]||util['format'](_0x8e97('0xe6'),'Visitor',_0x3ff82a[_0x8e97('0x70')]);switch(_0x53de12[_0x8e97('0xe9')]){case _0x8e97('0xea'):_0x3a4f3a=_0x3ff82a['UserId']?util[_0x8e97('0xe0')](_0x8e97('0xe6'),_0x53de12[_0x8e97('0xe7')],_0x3ff82a[_0x8e97('0x78')]):_0x8e97('0xeb');break;case _0x8e97('0xec'):_0x3a4f3a=_0x3ff82a[_0x8e97('0x78')]?_0x3ff82a['User']['alias']||_0x3ff82a[_0x8e97('0x76')][_0x8e97('0x3c')]:'System';break;case _0x8e97('0xed'):_0x3a4f3a=_0x3ff82a[_0x8e97('0x78')]?_0x3ff82a[_0x8e97('0x76')][_0x8e97('0x3c')]:_0x8e97('0xeb');break;default:_0x3a4f3a=_0x3ff82a['UserId']?util[_0x8e97('0xe0')](_0x8e97('0xe6'),_0x53de12['agentAlias'],_0x3ff82a[_0x8e97('0x78')]):_0x8e97('0xeb');}var _0xdeef48=util['format'](_0x8e97('0xee'),moment(_0x3ff82a[_0x8e97('0x7d')])[_0x8e97('0xe0')]('MM/DD/YYYY\x20HH:mm:ss'),_0x3ff82a['direction']==='in'?_0x311153:_0x3a4f3a,_0x3ff82a['body']);if(!_0x3ff82a['secret']){fs[_0x8e97('0xef')](_0x3567c2,_0xdeef48);}}return db[_0x8e97('0xf0')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x8e97('0xf1')],'as':'Smtp','raw':!![]}]});}}})[_0x8e97('0x21')](function(_0x1378ab){if(_0x1378ab&&_0x1378ab['Smtp']&&_0x3e110c[_0x8e97('0x7a')]){var _0x418836={'tls':{'rejectUnauthorized':![]}};if(_0x1378ab[_0x8e97('0xf2')][_0x8e97('0xf3')]){_0x418836[_0x8e97('0xf3')]=_0x1378ab['Smtp'][_0x8e97('0xf3')];}else{_0x418836[_0x8e97('0xf4')]=_0x1378ab[_0x8e97('0xf2')][_0x8e97('0xf4')];_0x418836[_0x8e97('0xf5')]=_0x1378ab['Smtp']['port'];_0x418836[_0x8e97('0xf6')]=_0x1378ab[_0x8e97('0xf2')][_0x8e97('0xf6')];}if(_0x1378ab[_0x8e97('0xf2')][_0x8e97('0xf7')]){_0x418836['auth']={'user':_0x1378ab['Smtp']['user'],'pass':_0x1378ab[_0x8e97('0xf2')][_0x8e97('0xf8')]};}return respondWithRpcPromise(_0x8e97('0xf9'),_0x8e97('0xfa'),{'account':_0x418836,'message':{'from':util[_0x8e97('0xe0')](_0x8e97('0xfb'),_0x1378ab[_0x8e97('0x3a')],_0x1378ab[_0x8e97('0xfc')]||_0x1378ab[_0x8e97('0xf2')][_0x8e97('0x9a')]),'to':_0x3e110c['body'][_0x8e97('0xde')],'subject':'Mail\x20Transcript','text':util[_0x8e97('0xe0')](_0x8e97('0xfd'),_0x3e110c[_0x8e97('0x7a')][_0x8e97('0xde')]),'attachments':[{'path':_0x3567c2}]}})[_0x8e97('0x21')](function(){return _0x165e28;})[_0x8e97('0x2b')](function(_0x407469){console[_0x8e97('0x27')](_0x407469);});}else{return _0x165e28;}})[_0x8e97('0x21')](respondWithStatusCode(_0x444117,0xc8))[_0x8e97('0x2b')](handleError(_0x444117,null));};exports['addMessage']=function(_0x3bd311,_0x1c3a91,_0x1227c6){return db[_0x8e97('0xc9')][_0x8e97('0x68')]({'where':{'id':_0x3bd311[_0x8e97('0xb9')]['id']}})['then'](handleEntityNotFound(_0x1c3a91,null))[_0x8e97('0x21')](function(_0x122e75){if(_0x122e75){return _0x122e75[_0x8e97('0xfe')](_0x3bd311['body'][_0x8e97('0xff')],_[_0x8e97('0x100')](_0x3bd311[_0x8e97('0x7a')],['ids','id'])||{});}})[_0x8e97('0x21')](respondWithResult(_0x1c3a91,null))['catch'](handleError(_0x1c3a91,null));};exports[_0x8e97('0x101')]=function(_0x1859ae,_0x5b2097,_0x34fd9b){var _0x142345={'raw':![],'where':{}};var _0x1d0377={};var _0x388e7d={'count':0x0,'rows':[]};return db[_0x8e97('0x42')]['findOne']({'where':{'id':_0x1859ae[_0x8e97('0xb9')]['id']}})[_0x8e97('0x21')](handleEntityNotFound(_0x5b2097,null))['then'](function(_0x58e934){if(_0x58e934){_0x1d0377['model']=_[_0x8e97('0xba')](db[_0x8e97('0xc9')][_0x8e97('0xbb')]);_0x1d0377[_0x8e97('0x47')]=_['keys'](_0x1859ae[_0x8e97('0x47')]);_0x1d0377[_0x8e97('0x48')]=_[_0x8e97('0x49')](_0x1d0377[_0x8e97('0x46')],_0x1d0377[_0x8e97('0x47')]);_0x142345[_0x8e97('0x4a')]=_[_0x8e97('0x49')](_0x1d0377[_0x8e97('0x46')],qs['fields'](_0x1859ae[_0x8e97('0x47')]['fields']));_0x142345[_0x8e97('0x4a')]=_0x142345[_0x8e97('0x4a')][_0x8e97('0x4c')]?_0x142345['attributes']:_0x1d0377['model'];if(!_0x1859ae[_0x8e97('0x47')]['hasOwnProperty'](_0x8e97('0x102'))){_0x142345['limit']=qs[_0x8e97('0x32')](_0x1859ae[_0x8e97('0x47')]['limit']);_0x142345[_0x8e97('0x31')]=qs[_0x8e97('0x31')](_0x1859ae[_0x8e97('0x47')][_0x8e97('0x31')]);}_0x142345['order']=qs[_0x8e97('0x4f')](_0x1859ae['query'][_0x8e97('0x4f')]);_0x142345['where']=qs[_0x8e97('0x48')](_[_0x8e97('0x51')](_0x1859ae['query'],_0x1d0377[_0x8e97('0x48')]));_0x142345['where']['ChatInteractionId']=_0x58e934['id'];if(_0x1859ae[_0x8e97('0x47')][_0x8e97('0x89')]){_0x142345[_0x8e97('0x50')]=_[_0x8e97('0xbe')](_0x142345['where'],{'$or':_[_0x8e97('0x41')](_0x142345['attributes'],function(_0x470d28){var _0xef901c={};_0xef901c[_0x470d28]={'$like':'%'+_0x1859ae['query'][_0x8e97('0x89')]+'%'};return _0xef901c;})});}if(_0x1859ae[_0x8e97('0x47')]['$gte']){var _0x1ac748=_0x1859ae[_0x8e97('0x47')][_0x8e97('0x7f')][_0x8e97('0x3e')](',');var _0x1a6ae7={};_0x1a6ae7[_0x1ac748[0x0]]={'$gte':moment(_0x1ac748[0x1])[_0x8e97('0xe0')]('YYYY-MM-DD\x20HH:mm:ss')};_0x142345[_0x8e97('0x50')]=_[_0x8e97('0xbe')](_0x142345[_0x8e97('0x50')],_0x1a6ae7);}_0x142345=_[_0x8e97('0xbe')]({},_0x142345,_0x1859ae[_0x8e97('0x103')]);return db[_0x8e97('0xc9')]['count']({'where':_0x142345['where']})[_0x8e97('0x21')](function(_0x2dc66b){_0x388e7d[_0x8e97('0x30')]=_0x2dc66b;if(_0x1859ae[_0x8e97('0x47')][_0x8e97('0xbc')]){_0x142345[_0x8e97('0xbd')]=[{'all':!![]}];}return db[_0x8e97('0xc9')][_0x8e97('0x104')](_0x142345);})[_0x8e97('0x21')](function(_0x51847f){_0x388e7d[_0x8e97('0xb7')]=_0x51847f;return _0x388e7d;});}})[_0x8e97('0x21')](respondWithFilteredResult(_0x5b2097,_0x142345))[_0x8e97('0x2b')](handleError(_0x5b2097,null));};exports[_0x8e97('0x105')]=function(_0x5a9826,_0x2dfa5b,_0x3dcec8){var _0x20cb6e={'where':{}},_0x264641={},_0xdfa037={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x8e97('0xc2')]({'where':{'id':_0x5a9826[_0x8e97('0xb9')]['id']}})[_0x8e97('0x21')](handleEntityNotFound(_0x2dfa5b,null))[_0x8e97('0x21')](function(_0x5021c8){if(_0x5021c8){_0x264641[_0x8e97('0x46')]=_[_0x8e97('0xba')](db[_0x8e97('0xc9')][_0x8e97('0xbb')]);_0x264641['query']=_[_0x8e97('0xba')](_0x5a9826[_0x8e97('0x47')]);_0x264641[_0x8e97('0x48')]=_[_0x8e97('0x49')](_0x264641['model'],_0x264641['query']);_0x20cb6e['attributes']=_[_0x8e97('0x49')](_0x264641[_0x8e97('0x46')],qs[_0x8e97('0x4b')](_0x5a9826['query'][_0x8e97('0x4b')]));_0x20cb6e['attributes']=_0x20cb6e[_0x8e97('0x4a')][_0x8e97('0x4c')]?_0x20cb6e[_0x8e97('0x4a')]:_0x264641['model'];if(!_0x5a9826['query'][_0x8e97('0x4d')](_0x8e97('0x102'))){_0x20cb6e['limit']=qs[_0x8e97('0x32')](_0x5a9826[_0x8e97('0x47')][_0x8e97('0x32')]);_0x20cb6e[_0x8e97('0x31')]=qs[_0x8e97('0x31')](_0x5a9826[_0x8e97('0x47')]['offset']);}_0x20cb6e['order']=qs[_0x8e97('0x4f')](_0x5a9826[_0x8e97('0x47')][_0x8e97('0x4f')]);_0x20cb6e[_0x8e97('0x50')]=qs[_0x8e97('0x48')](_[_0x8e97('0x51')](_0x5a9826['query'],_0x264641[_0x8e97('0x48')]));_0x20cb6e[_0x8e97('0x50')][_0x8e97('0xb5')]=_0x5021c8['id'];if(_0x5a9826[_0x8e97('0x47')][_0x8e97('0x89')]){_0x20cb6e['where']=_['merge'](_0x20cb6e['where'],{'$or':_[_0x8e97('0x41')](_0x20cb6e[_0x8e97('0x4a')],function(_0x1bf398){var _0x3cf2f9={};_0x3cf2f9[_0x1bf398]={'$like':'%'+_0x5a9826[_0x8e97('0x47')][_0x8e97('0x89')]+'%'};return _0x3cf2f9;})});}_0x20cb6e[_0x8e97('0x50')][_0x8e97('0x106')]=![];if(_0x5a9826[_0x8e97('0x47')]['id']){_0x20cb6e[_0x8e97('0x50')]['id']={'$gt':_0x5a9826['query']['id']};}_0x20cb6e=_['merge']({},_0x20cb6e,_0x5a9826['options']);return db[_0x8e97('0xc9')]['count']({'where':_0x20cb6e[_0x8e97('0x50')]})[_0x8e97('0x21')](function(_0x85f110){_0xdfa037['count']=_0x85f110;_0x20cb6e[_0x8e97('0xbd')]=[];if(_0x5a9826[_0x8e97('0x47')]['includeAgent']){_0x20cb6e[_0x8e97('0xbd')][_0x8e97('0x40')]({'model':db[_0x8e97('0x76')],'as':_0x8e97('0x76'),'attributes':['id',_0x8e97('0x3c'),'alias']});}if(_0x5a9826[_0x8e97('0x47')][_0x8e97('0xbc')]){_0x20cb6e[_0x8e97('0xbd')]=[{'all':!![]}];}return db[_0x8e97('0xc9')][_0x8e97('0x104')](_0x20cb6e);})[_0x8e97('0x21')](function(_0x2d4710){_0xdfa037['rows']=_0x2d4710;return _0xdfa037;});}})['then'](respondWithFilteredResult(_0x2dfa5b,_0x20cb6e))[_0x8e97('0x2b')](handleError(_0x2dfa5b,null));};exports['addTags']=function(_0x43a0dd,_0x37abb1,_0xfd5409){return db[_0x8e97('0x42')]['find']({'where':{'id':_0x43a0dd[_0x8e97('0xb9')]['id']}})[_0x8e97('0x21')](handleEntityNotFound(_0x37abb1,null))['then'](function(_0x511d7a){if(_0x511d7a){return _0x511d7a['setTags'](_0x43a0dd[_0x8e97('0x7a')][_0x8e97('0xff')],_[_0x8e97('0x100')](_0x43a0dd[_0x8e97('0x7a')],[_0x8e97('0xff'),'id'])||{})['spread'](function(){return db[_0x8e97('0x73')][_0x8e97('0x104')]({'attributes':['id',_0x8e97('0x3a'),_0x8e97('0x107')],'where':{'id':_0x43a0dd[_0x8e97('0x7a')]['ids']}});})[_0x8e97('0x21')](function(_0x1c6d50){socket[_0x8e97('0x108')](_0x8e97('0x109'),{'id':Number(_0x43a0dd[_0x8e97('0xb9')]['id']),'tags':_0x1c6d50||[]});return{'id':Number(_0x43a0dd[_0x8e97('0xb9')]['id']),'tags':_0x1c6d50||[]};});}})[_0x8e97('0x21')](respondWithResult(_0x37abb1,null))[_0x8e97('0x2b')](handleError(_0x37abb1,null));};exports['removeTags']=function(_0x5e8887,_0x33d83e,_0x48f0aa){return db[_0x8e97('0x42')][_0x8e97('0x68')]({'where':{'id':_0x5e8887['params']['id']}})[_0x8e97('0x21')](handleEntityNotFound(_0x33d83e,null))[_0x8e97('0x21')](function(_0x61bccf){if(_0x61bccf){return _0x61bccf[_0x8e97('0x10a')](_0x5e8887[_0x8e97('0x47')][_0x8e97('0xff')]);}})['then'](respondWithStatusCode(_0x33d83e,null))[_0x8e97('0x2b')](handleError(_0x33d83e,null));};exports[_0x8e97('0xdd')]=function(_0x2a1ccb,_0x121e65){var _0x322ec7=moment()[_0x8e97('0x10b')]()[_0x8e97('0x9f')]();var _0x1eb175=path[_0x8e97('0xda')](config['root'],'server',_0x8e97('0x10c'),_0x8e97('0x10d'));var _0x160d67=path[_0x8e97('0xda')](config['root'],'server',_0x8e97('0x10c'),_0x8e97('0x10e'));var _0x356fa9=path['join'](_0x1eb175,_0x322ec7);var _0x32dfac=util[_0x8e97('0xe0')](_0x8e97('0x10f'),_0x2a1ccb[_0x8e97('0xb9')]['id'],_0x322ec7);var _0x11836e=path[_0x8e97('0xda')](_0x1eb175,_0x32dfac);var _0x3d3b36=[];_0x3d3b36[_0x8e97('0x40')]({'model':db[_0x8e97('0x76')],'as':_0x8e97('0x76'),'attributes':['id',_0x8e97('0x3c')],'raw':!![]});_0x3d3b36[_0x8e97('0x40')]({'model':db[_0x8e97('0xcb')],'as':_0x8e97('0x110'),'attributes':['id',_0x8e97('0x111'),'lastName'],'raw':!![]});if(_0x2a1ccb[_0x8e97('0x47')][_0x8e97('0x10e')]){_0x3d3b36[_0x8e97('0x40')]({'model':db[_0x8e97('0xd5')],'as':'Attachment','raw':!![]});}var _0x5d64e9=[{'model':db[_0x8e97('0xc9')],'as':_0x8e97('0xe4'),'attributes':['id',_0x8e97('0x7a'),'createdAt','direction',_0x8e97('0x106'),_0x8e97('0x84')],'include':_0x3d3b36}];_0x5d64e9[_0x8e97('0x40')]({'model':db[_0x8e97('0xe5')],'as':_0x8e97('0x112'),'attributes':['id',_0x8e97('0x3a')]});_0x5d64e9['push']({'model':db[_0x8e97('0x76')],'as':_0x8e97('0x113'),'attributes':['id',_0x8e97('0x3c')]});return db[_0x8e97('0x42')][_0x8e97('0x68')]({'where':{'id':_0x2a1ccb['params']['id']},'include':_0x5d64e9})[_0x8e97('0x21')](handleEntityNotFound(_0x121e65,null))['then'](function(_0x54e7a4){if(_0x54e7a4){var _0x1a0aca=_0x54e7a4[_0x8e97('0x114')]({'plain':!![]});fs[_0x8e97('0x115')](_0x356fa9);var _0x37d2e1={'format':'A4','border':'10px','header':{'height':_0x8e97('0x116'),'contents':{'first':_0x8e97('0x117')}},'footer':{'height':_0x8e97('0x118'),'contents':{'default':util[_0x8e97('0xe0')](_0x8e97('0x119'),util['format']('%s\x20#%d',_0x8e97('0x11a'),_0x1a0aca['id']),moment()['format'](_0x8e97('0x11b'))['toString']())}}};var _0x3c73d7={'channel':'Chat','account':_0x1a0aca[_0x8e97('0x112')][_0x8e97('0x3a')],'agent':_0x1a0aca[_0x8e97('0x113')]?_0x1a0aca[_0x8e97('0x113')][_0x8e97('0x3c')]:'N.A.','createdAt':moment(_0x1a0aca[_0x8e97('0x7d')])[_0x8e97('0xe0')](_0x8e97('0x11c'))[_0x8e97('0x9f')](),'closedAt':_0x1a0aca[_0x8e97('0xd7')]?moment(_0x1a0aca[_0x8e97('0x11d')])[_0x8e97('0xe0')](_0x8e97('0x11c'))[_0x8e97('0x9f')]():'','disposition':_0x1a0aca[_0x8e97('0xcf')],'chatInfo':{'browser':_0x1a0aca[_0x8e97('0x11e')],'os':_0x1a0aca['osName'],'referer':_0x1a0aca[_0x8e97('0x11f')],'customerIp':_0x1a0aca['customerIp'],'customerPort':_0x1a0aca['customerPort']?_0x1a0aca[_0x8e97('0x120')]:_0x8e97('0x121')},'messages':_(_0x1a0aca[_0x8e97('0xe4')])[_0x8e97('0x122')]()['filter']({'secret':![]})[_0x8e97('0x41')](function(_0x3abbc9){if(_0x3abbc9[_0x8e97('0xd5')]){var _0x526ae4=path[_0x8e97('0xda')](_0x160d67,_0x3abbc9[_0x8e97('0xd5')][_0x8e97('0xd4')]);if(fs[_0x8e97('0x123')](_0x526ae4)){fs[_0x8e97('0x124')](_0x526ae4)['pipe'](fs[_0x8e97('0x125')](path[_0x8e97('0xda')](_0x356fa9,_0x3abbc9[_0x8e97('0xd5')]['basename'])));}}return{'date':moment(_0x3abbc9['createdAt'])['format'](_0x8e97('0x11c'))[_0x8e97('0x9f')](),'sender':_0x3abbc9[_0x8e97('0x126')]===_0x8e97('0xc8')?_0x3abbc9['User']?_0x3abbc9['User'][_0x8e97('0x3c')]:'System':_0x3abbc9[_0x8e97('0x110')]['firstName']+(_0x3abbc9[_0x8e97('0x110')][_0x8e97('0x127')]?'\x20'+_0x3abbc9[_0x8e97('0x110')][_0x8e97('0x127')]:''),'body':_0x3abbc9[_0x8e97('0xd5')]?_0x3abbc9['Attachment']['basename']:_0x3abbc9[_0x8e97('0x7a')],'direction':_0x3abbc9[_0x8e97('0x126')]===_0x8e97('0xc8')?'A':'C','secret':_0x3abbc9[_0x8e97('0x106')],'read':_0x3abbc9[_0x8e97('0x84')],'attachment':_0x3abbc9['Attachment']};})[_0x8e97('0x6a')]()};return ejs[_0x8e97('0x128')](path['join'](config['root'],'server',_0x8e97('0x129'),_0x8e97('0x12a')),{'interaction':_0x3c73d7})[_0x8e97('0x21')](function(_0x167085){return new BPromise(function(_0x92b706,_0x391fee){pdf[_0x8e97('0xbf')](_0x167085,_0x37d2e1)[_0x8e97('0x12b')](path[_0x8e97('0xda')](_0x356fa9,'transcript-'+_0x1a0aca['id']+'-'+_0x322ec7+_0x8e97('0x12c')),function(_0x4c2465,_0x13a0d6){if(_0x4c2465)return _0x391fee(_0x4c2465);_0x92b706(_0x13a0d6);});});})['then'](function(){return new BPromise(function(_0x2e7226,_0x2fe24e){zipdir(_0x356fa9,{'saveTo':_0x11836e},function(_0x3863ea,_0x2cd8e7){if(_0x3863ea)return _0x2fe24e(_0x3863ea);return _0x2e7226(_0x2cd8e7);});})['then'](function(){return new BPromise(function(_0x52f748,_0x189084){rimraf(_0x356fa9,function(_0x2e381e){if(_0x2e381e)_0x189084(_0x2e381e);return _0x52f748();});});})[_0x8e97('0x21')](function(){return _0x121e65[_0x8e97('0xdd')](_0x11836e,_0x32dfac,function(_0x5c2c15){if(_0x5c2c15){console[_0x8e97('0x12d')](_0x8e97('0x12e'),_0x5c2c15);}else{fs[_0x8e97('0x12f')](_0x11836e);}});});});}else{return _0x121e65[_0x8e97('0x2c')](0xc8);}})[_0x8e97('0x2b')](handleError(_0x121e65,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index e223963..b4b96f4 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 _0xcac3=['emit','catch','hasOwnProperty','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','findAll','length'];(function(_0x5184fd,_0x5d85ba){var _0x10a794=function(_0x153d9b){while(--_0x153d9b){_0x5184fd['push'](_0x5184fd['shift']());}};_0x10a794(++_0x5d85ba);}(_0xcac3,0x193));var _0x3cac=function(_0x119b4b,_0x322a87){_0x119b4b=_0x119b4b-0x0;var _0x2ca4d5=_0xcac3[_0x119b4b];return _0x2ca4d5;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x3cac('0x0'))['db'][_0x3cac('0x1')];var ChatMessage=require(_0x3cac('0x0'))['db'][_0x3cac('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x3cac('0x3')](0x0);var events={'afterCreate':_0x3cac('0x4'),'afterUpdate':_0x3cac('0x5'),'afterDestroy':_0x3cac('0x6')};function emitEvent(_0x2d7790){return function(_0x346c24,_0x725139,_0x2c5e16){_0x346c24[_0x3cac('0x7')]({'attributes':['id'],'raw':!![]})[_0x3cac('0x8')](function(_0x14562c){_0x346c24[_0x3cac('0x9')](_0x3cac('0xa'),_0x14562c['map'](function(_0x3cbf8d){return{'id':_0x3cbf8d['id']};}));return ChatMessage[_0x3cac('0xb')]({'where':{'ChatInteractionId':_0x346c24['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3cac('0x8')](function(_0x306664){_0x346c24[_0x3cac('0x9')]('unreadMessages',_0x306664[_0x3cac('0xc')]);ChatInteractionEvents[_0x3cac('0xd')](_0x2d7790+':'+_0x346c24['id'],_0x346c24);ChatInteractionEvents[_0x3cac('0xd')](_0x2d7790,_0x346c24);_0x2c5e16(null);})[_0x3cac('0xe')](_0x2c5e16(null));};}for(var e in events){if(events[_0x3cac('0xf')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x2ace=['setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook','../../mysqldb','ChatInteraction'];(function(_0x1dfcae,_0x495fc1){var _0x508c60=function(_0x48b127){while(--_0x48b127){_0x1dfcae['push'](_0x1dfcae['shift']());}};_0x508c60(++_0x495fc1);}(_0x2ace,0x17e));var _0xe2ac=function(_0x14bf63,_0xdbd373){_0x14bf63=_0x14bf63-0x0;var _0x410d22=_0x2ace[_0x14bf63];return _0x410d22;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xe2ac('0x0'))['db'][_0xe2ac('0x1')];var ChatMessage=require(_0xe2ac('0x0'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xe2ac('0x2')](0x0);var events={'afterCreate':_0xe2ac('0x3'),'afterUpdate':'update','afterDestroy':_0xe2ac('0x4')};function emitEvent(_0x464ec4){return function(_0x240663,_0x2d2241,_0x386b18){_0x240663[_0xe2ac('0x5')]({'attributes':['id'],'raw':!![]})[_0xe2ac('0x6')](function(_0x391f96){_0x240663[_0xe2ac('0x7')](_0xe2ac('0x8'),_0x391f96[_0xe2ac('0x9')](function(_0x3ae734){return{'id':_0x3ae734['id']};}));return ChatMessage[_0xe2ac('0xa')]({'where':{'ChatInteractionId':_0x240663['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5e6678){_0x240663[_0xe2ac('0x7')]('unreadMessages',_0x5e6678[_0xe2ac('0xb')]);ChatInteractionEvents[_0xe2ac('0xc')](_0x464ec4+':'+_0x240663['id'],_0x240663);ChatInteractionEvents['emit'](_0x464ec4,_0x240663);_0x386b18(null);})[_0xe2ac('0xd')](_0x386b18(null));};}for(var e in events){if(events[_0xe2ac('0xe')](e)){var event=events[e];ChatInteraction[_0xe2ac('0xf')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index fb92c99..1b62001 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 _0x8288=['request-promise','path','../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment'];(function(_0x208569,_0x4d4049){var _0x1e0ee3=function(_0x4403ee){while(--_0x4403ee){_0x208569['push'](_0x208569['shift']());}};_0x1e0ee3(++_0x4d4049);}(_0x8288,0x10c));var _0x8828=function(_0x20533e,_0x5061d3){_0x20533e=_0x20533e-0x0;var _0x4fe339=_0x8288[_0x20533e];return _0x4fe339;};'use strict';var _=require(_0x8828('0x0'));var util=require(_0x8828('0x1'));var logger=require(_0x8828('0x2'))('api');var moment=require(_0x8828('0x3'));var BPromise=require('bluebird');var rp=require(_0x8828('0x4'));var fs=require('fs');var path=require(_0x8828('0x5'));var rimraf=require('rimraf');var config=require(_0x8828('0x6'));var attributes=require(_0x8828('0x7'));module[_0x8828('0x8')]=function(_0x250b9e,_0x12d479){return _0x250b9e['define'](_0x8828('0x9'),attributes,{'tableName':_0x8828('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x21e762,_0x5f4f6c,_0xcafe57){if(_0x21e762[_0x8828('0xb')](_0x8828('0xc'))){_0x21e762[_0x8828('0xd')]=moment()['format'](_0x8828('0xe'));}_0xcafe57(null,_0x21e762);}},'charset':_0x8828('0xf'),'collate':_0x8828('0x10')});}; \ No newline at end of file +var _0xa14b=['format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','request-promise','path','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closedAt'];(function(_0x1a7413,_0x3e7da0){var _0x254221=function(_0x2a29b9){while(--_0x2a29b9){_0x1a7413['push'](_0x1a7413['shift']());}};_0x254221(++_0x3e7da0);}(_0xa14b,0xf2));var _0xba14=function(_0x12c6a5,_0xccbb68){_0x12c6a5=_0x12c6a5-0x0;var _0x82618f=_0xa14b[_0x12c6a5];return _0x82618f;};'use strict';var _=require(_0xba14('0x0'));var util=require(_0xba14('0x1'));var logger=require(_0xba14('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xba14('0x3'));var fs=require('fs');var path=require(_0xba14('0x4'));var rimraf=require('rimraf');var config=require(_0xba14('0x5'));var attributes=require(_0xba14('0x6'));module[_0xba14('0x7')]=function(_0x54d805,_0x50bdbb){return _0x54d805[_0xba14('0x8')](_0xba14('0x9'),attributes,{'tableName':_0xba14('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x20de8d,_0x443ae2,_0x54e9a0){if(_0x20de8d[_0xba14('0xb')]('closed')){_0x20de8d[_0xba14('0xc')]=moment()[_0xba14('0xd')](_0xba14('0xe'));}_0x54e9a0(null,_0x20de8d);}},'charset':_0xba14('0xf'),'collate':_0xba14('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 89ffc42..8aac3df 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 _0x30f0=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','update','body','options','attributes','limit','UpdateChatInteraction','ChatInteraction','find','where','addTags','ids','spread','AddTags','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5df081,_0x222330){var _0x3da1c0=function(_0x367c08){while(--_0x367c08){_0x5df081['push'](_0x5df081['shift']());}};_0x3da1c0(++_0x222330);}(_0x30f0,0x11b));var _0x030f=function(_0x2dfca5,_0x4b9215){_0x2dfca5=_0x2dfca5-0x0;var _0x359508=_0x30f0[_0x2dfca5];return _0x359508;};'use strict';var _=require(_0x030f('0x0'));var util=require(_0x030f('0x1'));var moment=require(_0x030f('0x2'));var BPromise=require(_0x030f('0x3'));var rs=require(_0x030f('0x4'));var fs=require('fs');var Redis=require(_0x030f('0x5'));var db=require(_0x030f('0x6'))['db'];var utils=require(_0x030f('0x7'));var logger=require(_0x030f('0x8'))(_0x030f('0x9'));var config=require(_0x030f('0xa'));var jayson=require(_0x030f('0xb'));var client=jayson['client'][_0x030f('0xc')]({'port':0x232a});config[_0x030f('0xd')]=_[_0x030f('0xe')](config[_0x030f('0xd')],{'host':_0x030f('0xf'),'port':0x18eb});var socket=require(_0x030f('0x10'))(new Redis(config[_0x030f('0xd')]));require(_0x030f('0x11'))[_0x030f('0x12')](socket);function respondWithRpcPromise(_0x31c376,_0x2e981b,_0xc5c648){return new BPromise(function(_0x5a8758,_0x2a2a71){return client['request'](_0x31c376,_0xc5c648)[_0x030f('0x13')](function(_0x53b38c){logger[_0x030f('0x14')](_0x030f('0x15'),_0x2e981b,_0x030f('0x16'));logger[_0x030f('0x17')](_0x030f('0x18'),_0x2e981b,_0x030f('0x16'),JSON[_0x030f('0x19')](_0x53b38c));if(_0x53b38c[_0x030f('0x1a')]){if(_0x53b38c[_0x030f('0x1a')]['code']===0x1f4){logger[_0x030f('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x2e981b,_0x53b38c[_0x030f('0x1a')][_0x030f('0x1b')]);return _0x2a2a71(_0x53b38c[_0x030f('0x1a')][_0x030f('0x1b')]);}logger[_0x030f('0x1a')](_0x030f('0x15'),_0x2e981b,_0x53b38c['error'][_0x030f('0x1b')]);return _0x5a8758(_0x53b38c[_0x030f('0x1a')][_0x030f('0x1b')]);}else{logger[_0x030f('0x14')](_0x030f('0x15'),_0x2e981b,_0x030f('0x16'));_0x5a8758(_0x53b38c['result'][_0x030f('0x1b')]);}})['catch'](function(_0x1b7cb5){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x2e981b,_0x1b7cb5);_0x2a2a71(_0x1b7cb5);});});}exports['UpdateChatInteraction']=function(_0x20fd2d){var _0x4c5390=this;return new Promise(function(_0x579c30,_0x3aed2e){return db['ChatInteraction'][_0x030f('0x1c')](_0x20fd2d[_0x030f('0x1d')],{'raw':_0x20fd2d['options']?_0x20fd2d[_0x030f('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20fd2d[_0x030f('0x1e')]?_0x20fd2d[_0x030f('0x1e')]['where']||null:null,'attributes':_0x20fd2d[_0x030f('0x1e')]?_0x20fd2d[_0x030f('0x1e')][_0x030f('0x1f')]||null:null,'limit':_0x20fd2d[_0x030f('0x1e')]?_0x20fd2d[_0x030f('0x1e')][_0x030f('0x20')]||null:null})[_0x030f('0x13')](function(_0x2f27c3){logger['info'](_0x030f('0x21'),_0x20fd2d);logger[_0x030f('0x17')]('UpdateChatInteraction',_0x20fd2d,JSON[_0x030f('0x19')](_0x2f27c3));_0x579c30(_0x2f27c3);})['catch'](function(_0x12a41b){logger['error'](_0x030f('0x21'),_0x12a41b['message'],_0x20fd2d);_0x3aed2e(_0x4c5390['error'](0x1f4,_0x12a41b[_0x030f('0x1b')]));});});};exports['AddTagsToChatInteraction']=function(_0x12ba04){return new Promise(function(_0x4c7adc,_0x3a1f03){return db[_0x030f('0x22')][_0x030f('0x23')]({'where':_0x12ba04[_0x030f('0x1e')]?_0x12ba04['options'][_0x030f('0x24')]||null:null})[_0x030f('0x13')](function(_0x1f56e0){if(_0x1f56e0){return _0x1f56e0[_0x030f('0x25')](_0x12ba04[_0x030f('0x1d')][_0x030f('0x26')],_['omit'](_0x12ba04['body'],[_0x030f('0x26'),'id'])||{});}})[_0x030f('0x27')](function(_0x42c5c6){logger[_0x030f('0x14')](_0x030f('0x28'),_0x12ba04);logger[_0x030f('0x17')]('AddTags',_0x12ba04,JSON['stringify'](_0x42c5c6));_0x4c7adc(_0x42c5c6);})[_0x030f('0x29')](function(_0x4d3431){logger[_0x030f('0x1a')](_0x030f('0x28'),_0x4d3431[_0x030f('0x1b')],_0x12ba04);_0x3a1f03(_this['error'](0x1f4,_0x4d3431['message']));});});}; \ No newline at end of file +var _0xab43=['UpdateChatInteraction','ChatInteraction','options','raw','attributes','limit','then','debug','stringify','AddTagsToChatInteraction','where','body','ids','spread','info','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','request','ChatInteraction,\x20%s,\x20%s','request\x20sent','error','code','message','catch'];(function(_0xc0a186,_0x31b7fa){var _0x453c1b=function(_0x48373e){while(--_0x48373e){_0xc0a186['push'](_0xc0a186['shift']());}};_0x453c1b(++_0x31b7fa);}(_0xab43,0x85));var _0x3ab4=function(_0x30b7b0,_0x5255cf){_0x30b7b0=_0x30b7b0-0x0;var _0x5024ef=_0xab43[_0x30b7b0];return _0x5024ef;};'use strict';var _=require(_0x3ab4('0x0'));var util=require('util');var moment=require(_0x3ab4('0x1'));var BPromise=require(_0x3ab4('0x2'));var rs=require(_0x3ab4('0x3'));var fs=require('fs');var Redis=require(_0x3ab4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3ab4('0x5'));var logger=require(_0x3ab4('0x6'))(_0x3ab4('0x7'));var config=require(_0x3ab4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3ab4('0x9')][_0x3ab4('0xa')]({'port':0x232a});config['redis']=_[_0x3ab4('0xb')](config[_0x3ab4('0xc')],{'host':_0x3ab4('0xd'),'port':0x18eb});var socket=require(_0x3ab4('0xe'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0x3ab4('0xf')](socket);function respondWithRpcPromise(_0x60d6b4,_0x54dea0,_0x62bb17){return new BPromise(function(_0x1d3913,_0x138e4b){return client[_0x3ab4('0x10')](_0x60d6b4,_0x62bb17)['then'](function(_0x478b92){logger['info'](_0x3ab4('0x11'),_0x54dea0,_0x3ab4('0x12'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x54dea0,'request\x20sent',JSON['stringify'](_0x478b92));if(_0x478b92[_0x3ab4('0x13')]){if(_0x478b92[_0x3ab4('0x13')][_0x3ab4('0x14')]===0x1f4){logger[_0x3ab4('0x13')](_0x3ab4('0x11'),_0x54dea0,_0x478b92[_0x3ab4('0x13')][_0x3ab4('0x15')]);return _0x138e4b(_0x478b92['error'][_0x3ab4('0x15')]);}logger[_0x3ab4('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x54dea0,_0x478b92['error']['message']);return _0x1d3913(_0x478b92[_0x3ab4('0x13')][_0x3ab4('0x15')]);}else{logger['info'](_0x3ab4('0x11'),_0x54dea0,'request\x20sent');_0x1d3913(_0x478b92['result'][_0x3ab4('0x15')]);}})[_0x3ab4('0x16')](function(_0x42b071){logger['error'](_0x3ab4('0x11'),_0x54dea0,_0x42b071);_0x138e4b(_0x42b071);});});}exports[_0x3ab4('0x17')]=function(_0x1d67dd){var _0xfa8c42=this;return new Promise(function(_0x5baf9e,_0x2bb8fa){return db[_0x3ab4('0x18')]['update'](_0x1d67dd['body'],{'raw':_0x1d67dd[_0x3ab4('0x19')]?_0x1d67dd[_0x3ab4('0x19')][_0x3ab4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d67dd[_0x3ab4('0x19')]?_0x1d67dd['options']['where']||null:null,'attributes':_0x1d67dd[_0x3ab4('0x19')]?_0x1d67dd[_0x3ab4('0x19')][_0x3ab4('0x1b')]||null:null,'limit':_0x1d67dd[_0x3ab4('0x19')]?_0x1d67dd['options'][_0x3ab4('0x1c')]||null:null})[_0x3ab4('0x1d')](function(_0x3e7bb5){logger['info'](_0x3ab4('0x17'),_0x1d67dd);logger[_0x3ab4('0x1e')]('UpdateChatInteraction',_0x1d67dd,JSON[_0x3ab4('0x1f')](_0x3e7bb5));_0x5baf9e(_0x3e7bb5);})['catch'](function(_0x4c7119){logger[_0x3ab4('0x13')](_0x3ab4('0x17'),_0x4c7119[_0x3ab4('0x15')],_0x1d67dd);_0x2bb8fa(_0xfa8c42[_0x3ab4('0x13')](0x1f4,_0x4c7119['message']));});});};exports[_0x3ab4('0x20')]=function(_0x1622c3){return new Promise(function(_0x19c62e,_0x35d4dd){return db[_0x3ab4('0x18')]['find']({'where':_0x1622c3[_0x3ab4('0x19')]?_0x1622c3['options'][_0x3ab4('0x21')]||null:null})['then'](function(_0x3a4f96){if(_0x3a4f96){return _0x3a4f96['addTags'](_0x1622c3[_0x3ab4('0x22')][_0x3ab4('0x23')],_['omit'](_0x1622c3[_0x3ab4('0x22')],['ids','id'])||{});}})[_0x3ab4('0x24')](function(_0x51ab6f){logger[_0x3ab4('0x25')](_0x3ab4('0x26'),_0x1622c3);logger['debug'](_0x3ab4('0x26'),_0x1622c3,JSON[_0x3ab4('0x1f')](_0x51ab6f));_0x19c62e(_0x51ab6f);})[_0x3ab4('0x16')](function(_0x4ccaaa){logger[_0x3ab4('0x13')](_0x3ab4('0x26'),_0x4ccaaa[_0x3ab4('0x15')],_0x1622c3);_0x35d4dd(_this[_0x3ab4('0x13')](0x1f4,_0x4ccaaa['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index b1706f6..e4ffe2a 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 _0x6825=['remove','update','emit','removeListener','length','chatInteraction:','save'];(function(_0x2d7335,_0x52ffd1){var _0xbf6c1c=function(_0x4e0459){while(--_0x4e0459){_0x2d7335['push'](_0x2d7335['shift']());}};_0xbf6c1c(++_0x52ffd1);}(_0x6825,0x1e2));var _0x5682=function(_0x53bf28,_0x93c0e9){_0x53bf28=_0x53bf28-0x0;var _0x2ac000=_0x6825[_0x53bf28];return _0x2ac000;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x5682('0x0'),_0x5682('0x1'),_0x5682('0x2')];function createListener(_0x2234c4,_0x432215){return function(_0x806011){_0x432215[_0x5682('0x3')](_0x2234c4,_0x806011);};}function removeListener(_0x24330b,_0x5c66a6){return function(){ChatInteractionEvents[_0x5682('0x4')](_0x24330b,_0x5c66a6);};}exports['register']=function(_0x120b06){for(var _0x6ebdac=0x0,_0x508bd5=events[_0x5682('0x5')];_0x6ebdac<_0x508bd5;_0x6ebdac++){var _0x515ec9=events[_0x6ebdac];var _0x52c2bf=createListener(_0x5682('0x6')+_0x515ec9,_0x120b06);ChatInteractionEvents['on'](_0x515ec9,_0x52c2bf);}}; \ No newline at end of file +var _0x36b4=['length','save','update','emit','removeListener'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x36b4,0x1be));var _0x436b=function(_0x4d4e8a,_0x162fd7){_0x4d4e8a=_0x4d4e8a-0x0;var _0x2e304d=_0x36b4[_0x4d4e8a];return _0x2e304d;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x436b('0x0'),'remove',_0x436b('0x1')];function createListener(_0x30d10e,_0x27bdb8){return function(_0x33dee7){_0x27bdb8[_0x436b('0x2')](_0x30d10e,_0x33dee7);};}function removeListener(_0x3db80c,_0x2d6b79){return function(){ChatInteractionEvents[_0x436b('0x3')](_0x3db80c,_0x2d6b79);};}exports['register']=function(_0x3dd835){for(var _0x547d29=0x0,_0x5f10d5=events[_0x436b('0x4')];_0x547d29<_0x5f10d5;_0x547d29++){var _0x5b1c82=events[_0x547d29];var _0x37e3b8=createListener('chatInteraction:'+_0x5b1c82,_0x3dd835);ChatInteractionEvents['on'](_0x5b1c82,_0x37e3b8);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 34ab4dc..9a425ce 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 _0xb3b8=['join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','close','destroy','delete','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','isChatInteractionAuthorized','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession'];(function(_0x4bf20,_0x44ba0c){var _0x594bb3=function(_0x24c687){while(--_0x24c687){_0x4bf20['push'](_0x4bf20['shift']());}};_0x594bb3(++_0x44ba0c);}(_0xb3b8,0xe1));var _0x8b3b=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0xb3b8[_0xb24a3e];return _0x4038d7;};'use strict';var multer=require('multer');var util=require(_0x8b3b('0x0'));var path=require(_0x8b3b('0x1'));var timeout=require(_0x8b3b('0x2'));var express=require(_0x8b3b('0x3'));var router=express[_0x8b3b('0x4')]();var fs_extra=require(_0x8b3b('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8b3b('0x6'));var controller=require(_0x8b3b('0x7'));router['get']('/',auth[_0x8b3b('0x8')](),controller[_0x8b3b('0x9')]);router[_0x8b3b('0xa')](_0x8b3b('0xb'),auth['isAuthenticated'](),controller[_0x8b3b('0xc')]);router[_0x8b3b('0xa')](_0x8b3b('0xd'),auth[_0x8b3b('0xe')](),controller['show']);router['get']('/:id/attachment_download',auth[_0x8b3b('0xe')](),controller['attachmentDownload']);router[_0x8b3b('0xa')](_0x8b3b('0xf'),auth[_0x8b3b('0x8')](),controller[_0x8b3b('0x10')]);router['get'](_0x8b3b('0x11'),auth[_0x8b3b('0xe')](),controller[_0x8b3b('0x12')]);router['get'](_0x8b3b('0x13'),auth[_0x8b3b('0x8')](),controller[_0x8b3b('0x14')]);router[_0x8b3b('0x15')]('/',auth[_0x8b3b('0x8')](),controller[_0x8b3b('0x16')]);router[_0x8b3b('0x15')](_0x8b3b('0x17'),auth['isAuthenticated'](),controller[_0x8b3b('0x18')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4b1f9b,_0x51cbd3,_0x1182e0){_0x1182e0(null,path[_0x8b3b('0x19')](config[_0x8b3b('0x1a')],_0x8b3b('0x1b')));},'filename':function(_0x3c70f8,_0x2483d6,_0x4cd8de){_0x4cd8de(null,util[_0x8b3b('0x1c')](_0x8b3b('0x1d'),Date[_0x8b3b('0x1e')](),_0x2483d6[_0x8b3b('0x1f')][_0x8b3b('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8b3b('0x15')](_0x8b3b('0x21'),upload['single']('file'),controller['attachmentUpload']);router[_0x8b3b('0x15')](_0x8b3b('0xf'),auth[_0x8b3b('0xe')](),controller[_0x8b3b('0x22')]);router[_0x8b3b('0x15')](_0x8b3b('0x23'),auth[_0x8b3b('0x8')](),interaction[_0x8b3b('0x24')](_0x8b3b('0x25'),_0x8b3b('0x26')),controller[_0x8b3b('0x27')]);router[_0x8b3b('0x28')]('/:id',auth[_0x8b3b('0x8')](),interaction[_0x8b3b('0x24')]('chat','chatinteraction:update'),controller['update']);router[_0x8b3b('0x28')](_0x8b3b('0x29'),controller[_0x8b3b('0x2a')]);router['put'](_0x8b3b('0x2b'),auth[_0x8b3b('0xe')](),controller['abandon']);router[_0x8b3b('0x28')](_0x8b3b('0x2c'),controller[_0x8b3b('0x2d')]);router['delete'](_0x8b3b('0xd'),auth[_0x8b3b('0x8')](),interaction[_0x8b3b('0x24')](_0x8b3b('0x25'),'chatinteraction:destroy'),controller[_0x8b3b('0x2e')]);router[_0x8b3b('0x2f')](_0x8b3b('0x23'),auth[_0x8b3b('0x8')](),controller[_0x8b3b('0x30')]);module[_0x8b3b('0x31')]=router; \ No newline at end of file +var _0x7cfe=['tracked','chatinteraction:addtags','addTags','put','/:id','chat','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','getMessages','/:id/download','download','post','create','/:id/vidaoo','diskStorage','root','server/files/attachments/','%s-%s','now','originalname','replace','single','file','attachmentUpload','/:id/messages','/:id/tags'];(function(_0x561af6,_0x214a22){var _0x3d6789=function(_0x41ff9a){while(--_0x41ff9a){_0x561af6['push'](_0x561af6['shift']());}};_0x3d6789(++_0x214a22);}(_0x7cfe,0xd9));var _0xe7cf=function(_0x450860,_0x196a04){_0x450860=_0x450860-0x0;var _0x110c2a=_0x7cfe[_0x450860];return _0x110c2a;};'use strict';var multer=require(_0xe7cf('0x0'));var util=require(_0xe7cf('0x1'));var path=require(_0xe7cf('0x2'));var timeout=require('connect-timeout');var express=require(_0xe7cf('0x3'));var router=express[_0xe7cf('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe7cf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe7cf('0x6'));var controller=require('./chatInteraction.controller');router[_0xe7cf('0x7')]('/',auth[_0xe7cf('0x8')](),controller[_0xe7cf('0x9')]);router[_0xe7cf('0x7')](_0xe7cf('0xa'),auth[_0xe7cf('0x8')](),controller[_0xe7cf('0xb')]);router[_0xe7cf('0x7')]('/:id',auth[_0xe7cf('0xc')](),controller['show']);router[_0xe7cf('0x7')](_0xe7cf('0xd'),auth['isChatInteractionAuthorized'](),controller[_0xe7cf('0xe')]);router[_0xe7cf('0x7')]('/:id/messages',auth[_0xe7cf('0x8')](),controller[_0xe7cf('0xf')]);router[_0xe7cf('0x7')]('/:id/my_messages',auth[_0xe7cf('0xc')](),controller['getMyMessages']);router['get'](_0xe7cf('0x10'),auth[_0xe7cf('0x8')](),controller[_0xe7cf('0x11')]);router[_0xe7cf('0x12')]('/',auth['isAuthenticated'](),controller[_0xe7cf('0x13')]);router['post'](_0xe7cf('0x14'),auth[_0xe7cf('0x8')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xe7cf('0x15')]({'destination':function(_0xbb52c8,_0x2e34a5,_0x311696){_0x311696(null,path['join'](config[_0xe7cf('0x16')],_0xe7cf('0x17')));},'filename':function(_0xc4f835,_0x57721c,_0x4e8914){_0x4e8914(null,util['format'](_0xe7cf('0x18'),Date[_0xe7cf('0x19')](),_0x57721c[_0xe7cf('0x1a')][_0xe7cf('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe7cf('0x12')]('/:id/attachment_upload',upload[_0xe7cf('0x1c')](_0xe7cf('0x1d')),controller[_0xe7cf('0x1e')]);router['post'](_0xe7cf('0x1f'),auth[_0xe7cf('0xc')](),controller['addMessage']);router[_0xe7cf('0x12')](_0xe7cf('0x20'),auth[_0xe7cf('0x8')](),interaction[_0xe7cf('0x21')]('chat',_0xe7cf('0x22')),controller[_0xe7cf('0x23')]);router[_0xe7cf('0x24')](_0xe7cf('0x25'),auth[_0xe7cf('0x8')](),interaction['tracked'](_0xe7cf('0x26'),'chatinteraction:update'),controller[_0xe7cf('0x27')]);router[_0xe7cf('0x24')](_0xe7cf('0x28'),controller[_0xe7cf('0x29')]);router['put'](_0xe7cf('0x2a'),auth[_0xe7cf('0xc')](),controller[_0xe7cf('0x2b')]);router['put'](_0xe7cf('0x2c'),controller['close']);router[_0xe7cf('0x2d')](_0xe7cf('0x25'),auth['isAuthenticated'](),interaction[_0xe7cf('0x21')]('chat',_0xe7cf('0x2e')),controller[_0xe7cf('0x2f')]);router[_0xe7cf('0x2d')](_0xe7cf('0x20'),auth[_0xe7cf('0x8')](),controller[_0xe7cf('0x30')]);module[_0xe7cf('0x31')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index ee8b132..aa8bd03 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 _0x5f66=['exports','medium','BOOLEAN','INTEGER'];(function(_0x348043,_0x2ba294){var _0x392e48=function(_0x4dbc97){while(--_0x4dbc97){_0x348043['push'](_0x348043['shift']());}};_0x392e48(++_0x2ba294);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x65f6('0x3')]}}; \ No newline at end of file +var _0x5f2f=['INTEGER','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x3f04d0,_0x19fe04){var _0x3562e7=function(_0x2bdbaa){while(--_0x2bdbaa){_0x3f04d0['push'](_0x3f04d0['shift']());}};_0x3562e7(++_0x19fe04);}(_0x5f2f,0x73));var _0xf5f2=function(_0x36e22b,_0x12fdc9){_0x36e22b=_0x36e22b-0x0;var _0x41bc3d=_0x5f2f[_0x36e22b];return _0x41bc3d;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf5f2('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xf5f2('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index c5a17f0..c5abf13 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 _0x0fe6=['messages','ToId','read','-createdAt','all','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','send','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','VIRTUAL','options','ChatInternalMessage','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','update','get','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','user','fullname','role','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','push'];(function(_0x34217f,_0x4954d9){var _0x533721=function(_0x5ea689){while(--_0x5ea689){_0x34217f['push'](_0x34217f['shift']());}};_0x533721(++_0x4954d9);}(_0x0fe6,0x6f));var _0x60fe=function(_0x42bad3,_0x5c5001){_0x42bad3=_0x42bad3-0x0;var _0x35ce77=_0x0fe6[_0x42bad3];return _0x35ce77;};'use strict';var pdf=require(_0x60fe('0x0'));var emlformat=require(_0x60fe('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x60fe('0x2'));var jsonpatch=require(_0x60fe('0x3'));var rp=require(_0x60fe('0x4'));var moment=require(_0x60fe('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x60fe('0x6'));var path=require(_0x60fe('0x7'));var sox=require(_0x60fe('0x8'));var csv=require(_0x60fe('0x9'));var ejs=require(_0x60fe('0xa'));var fs=require('fs');var fs_extra=require(_0x60fe('0xb'));var _=require(_0x60fe('0xc'));var squel=require(_0x60fe('0xd'));var crypto=require(_0x60fe('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x60fe('0xf'));var toCsv=require(_0x60fe('0x9'));var querystring=require(_0x60fe('0x10'));var Papa=require(_0x60fe('0x11'));var Redis=require('ioredis');var authService=require(_0x60fe('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x60fe('0x13'));var hardwareService=require(_0x60fe('0x14'));var logger=require(_0x60fe('0x15'))(_0x60fe('0x16'));var utils=require(_0x60fe('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x60fe('0x18'));var db=require(_0x60fe('0x19'))['db'];config[_0x60fe('0x1a')]=_['defaults'](config[_0x60fe('0x1a')],{'host':_0x60fe('0x1b'),'port':0x18eb});var socket=require(_0x60fe('0x1c'))(new Redis(config[_0x60fe('0x1a')]));require('./chatInternalMessage.socket')[_0x60fe('0x1d')](socket);function respondWithStatusCode(_0xa6e29f,_0x93732c){_0x93732c=_0x93732c||0xcc;return function(_0x255332){if(_0x255332){return _0xa6e29f[_0x60fe('0x1e')](_0x93732c);}return _0xa6e29f[_0x60fe('0x1f')](_0x93732c)[_0x60fe('0x20')]();};}function respondWithResult(_0x225c3e,_0x55e897){_0x55e897=_0x55e897||0xc8;return function(_0x537b0e){if(_0x537b0e){return _0x225c3e[_0x60fe('0x1f')](_0x55e897)['json'](_0x537b0e);}};}function respondWithFilteredResult(_0x1c0b26,_0x13e080){return function(_0x265358){if(_0x265358){var _0x295511=_0x265358[_0x60fe('0x21')],_0x32773a=_0x13e080['offset'],_0xc1e173=_0x13e080[_0x60fe('0x22')]+_0x13e080[_0x60fe('0x23')],_0x149712;if(_0xc1e173>=_0x295511){_0xc1e173=_0x295511;_0x149712=0xc8;}else{_0x149712=0xce;}_0x1c0b26[_0x60fe('0x1f')](_0x149712);return _0x1c0b26[_0x60fe('0x24')]('Content-Range',_0x32773a+'-'+_0xc1e173+'/'+_0x295511)[_0x60fe('0x25')](_0x265358);}return null;};}function patchUpdates(_0x42dedd){return function(_0x493c74){try{jsonpatch[_0x60fe('0x26')](_0x493c74,_0x42dedd,!![]);}catch(_0x4b7461){return BPromise[_0x60fe('0x27')](_0x4b7461);}return _0x493c74[_0x60fe('0x28')]();};}function saveUpdates(_0x4e2b67,_0x2848f9){return function(_0x5ef07a){if(_0x5ef07a){return _0x5ef07a['update'](_0x4e2b67)[_0x60fe('0x29')](function(_0x364c55){return _0x364c55;});}return null;};}function removeEntity(_0x137108,_0x28f50e){return function(_0x2b9b61){if(_0x2b9b61){return _0x2b9b61[_0x60fe('0x2a')]()['then'](function(){_0x137108[_0x60fe('0x1f')](0xcc)[_0x60fe('0x20')]();});}};}function handleEntityNotFound(_0x2dfd1c,_0x3f6a18){return function(_0x16552a){if(!_0x16552a){_0x2dfd1c[_0x60fe('0x1e')](0x194);}return _0x16552a;};}function handleError(_0x5812ca,_0x2026e1){_0x2026e1=_0x2026e1||0x1f4;return function(_0x33c612){logger[_0x60fe('0x2b')](_0x33c612[_0x60fe('0x2c')]);if(_0x33c612[_0x60fe('0x2d')]){delete _0x33c612['name'];}_0x5812ca[_0x60fe('0x1f')](_0x2026e1)[_0x60fe('0x2e')](_0x33c612);};}exports['index']=function(_0x1ede12,_0x23537b){var _0x333c0c={},_0x325ab4={},_0x22e73c={'count':0x0,'rows':[]};var _0x3049bc=_['map'](db['ChatInternalMessage']['rawAttributes'],function(_0x33280a){return{'name':_0x33280a['fieldName'],'type':_0x33280a[_0x60fe('0x2f')][_0x60fe('0x30')]};});_0x325ab4[_0x60fe('0x31')]=_[_0x60fe('0x32')](_0x3049bc,_0x60fe('0x2d'));_0x325ab4[_0x60fe('0x33')]=_[_0x60fe('0x34')](_0x1ede12[_0x60fe('0x33')]);_0x325ab4[_0x60fe('0x35')]=_[_0x60fe('0x36')](_0x325ab4[_0x60fe('0x31')],_0x325ab4[_0x60fe('0x33')]);_0x333c0c['attributes']=_[_0x60fe('0x36')](_0x325ab4['model'],qs['fields'](_0x1ede12[_0x60fe('0x33')][_0x60fe('0x37')]));_0x333c0c['attributes']=_0x333c0c[_0x60fe('0x38')][_0x60fe('0x39')]?_0x333c0c[_0x60fe('0x38')]:_0x325ab4[_0x60fe('0x31')];if(!_0x1ede12[_0x60fe('0x33')]['hasOwnProperty'](_0x60fe('0x3a'))){_0x333c0c['limit']=qs['limit'](_0x1ede12[_0x60fe('0x33')]['limit']);_0x333c0c[_0x60fe('0x22')]=qs[_0x60fe('0x22')](_0x1ede12[_0x60fe('0x33')][_0x60fe('0x22')]);}_0x333c0c[_0x60fe('0x3b')]=qs[_0x60fe('0x3c')](_0x1ede12[_0x60fe('0x33')][_0x60fe('0x3c')]);_0x333c0c['where']=qs[_0x60fe('0x35')](_[_0x60fe('0x3d')](_0x1ede12[_0x60fe('0x33')],_0x325ab4['filters']),_0x3049bc);if(_0x1ede12['query'][_0x60fe('0x3e')]){_0x333c0c[_0x60fe('0x3f')]=_['merge'](_0x333c0c[_0x60fe('0x3f')],{'$or':_[_0x60fe('0x32')](_0x3049bc,function(_0x36196e){if(_0x36196e[_0x60fe('0x2f')]!==_0x60fe('0x40')){var _0x44d2b1={};_0x44d2b1[_0x36196e[_0x60fe('0x2d')]]={'$like':'%'+_0x1ede12[_0x60fe('0x33')][_0x60fe('0x3e')]+'%'};return _0x44d2b1;}})});}_0x333c0c=_['merge']({},_0x333c0c,_0x1ede12[_0x60fe('0x41')]);var _0x50ea40={'where':_0x333c0c['where']};return db[_0x60fe('0x42')][_0x60fe('0x21')](_0x50ea40)[_0x60fe('0x29')](function(_0x190aa8){_0x22e73c['count']=_0x190aa8;if(_0x1ede12[_0x60fe('0x33')][_0x60fe('0x43')]){_0x333c0c[_0x60fe('0x44')]=[{'all':!![]}];}return db[_0x60fe('0x42')][_0x60fe('0x45')](_0x333c0c);})[_0x60fe('0x29')](function(_0xfd7256){_0x22e73c['rows']=_0xfd7256;return _0x22e73c;})[_0x60fe('0x29')](respondWithFilteredResult(_0x23537b,_0x333c0c))['catch'](handleError(_0x23537b,null));};exports[_0x60fe('0x46')]=function(_0x31e132,_0x5bf308){var _0x31ad4b={'raw':!![],'where':{'id':_0x31e132[_0x60fe('0x47')]['id']}},_0x2819bc={};_0x2819bc[_0x60fe('0x31')]=_['keys'](db['ChatInternalMessage'][_0x60fe('0x48')]);_0x2819bc[_0x60fe('0x33')]=_[_0x60fe('0x34')](_0x31e132[_0x60fe('0x33')]);_0x2819bc[_0x60fe('0x35')]=_[_0x60fe('0x36')](_0x2819bc[_0x60fe('0x31')],_0x2819bc['query']);_0x31ad4b[_0x60fe('0x38')]=_[_0x60fe('0x36')](_0x2819bc[_0x60fe('0x31')],qs[_0x60fe('0x37')](_0x31e132[_0x60fe('0x33')][_0x60fe('0x37')]));_0x31ad4b[_0x60fe('0x38')]=_0x31ad4b[_0x60fe('0x38')][_0x60fe('0x39')]?_0x31ad4b[_0x60fe('0x38')]:_0x2819bc[_0x60fe('0x31')];if(_0x31e132[_0x60fe('0x33')][_0x60fe('0x43')]){_0x31ad4b['include']=[{'all':!![]}];}_0x31ad4b=_['merge']({},_0x31ad4b,_0x31e132[_0x60fe('0x41')]);return db[_0x60fe('0x42')][_0x60fe('0x49')](_0x31ad4b)['then'](handleEntityNotFound(_0x5bf308,null))[_0x60fe('0x29')](respondWithResult(_0x5bf308,null))[_0x60fe('0x4a')](handleError(_0x5bf308,null));};exports['create']=function(_0x4d1cac,_0x4361b0){return db[_0x60fe('0x42')][_0x60fe('0x4b')](_0x4d1cac[_0x60fe('0x4c')],{})[_0x60fe('0x29')](respondWithResult(_0x4361b0,0xc9))['catch'](handleError(_0x4361b0,null));};exports[_0x60fe('0x4d')]=function(_0x5491bd,_0x40ac6a){if(_0x5491bd[_0x60fe('0x4c')]['id']){delete _0x5491bd[_0x60fe('0x4c')]['id'];}return db[_0x60fe('0x42')]['find']({'where':{'id':_0x5491bd[_0x60fe('0x47')]['id']}})[_0x60fe('0x29')](handleEntityNotFound(_0x40ac6a,null))['then'](saveUpdates(_0x5491bd[_0x60fe('0x4c')],null))[_0x60fe('0x29')](respondWithResult(_0x40ac6a,null))[_0x60fe('0x4a')](handleError(_0x40ac6a,null));};exports[_0x60fe('0x2a')]=function(_0x46dc73,_0x59a13a){return db[_0x60fe('0x42')][_0x60fe('0x49')]({'where':{'id':_0x46dc73[_0x60fe('0x47')]['id']}})['then'](handleEntityNotFound(_0x59a13a,null))['then'](removeEntity(_0x59a13a,null))[_0x60fe('0x4a')](handleError(_0x59a13a,null));};exports['describe']=function(_0x47e1f0,_0x398ffe){return db['ChatInternalMessage']['describe']()[_0x60fe('0x29')](respondWithResult(_0x398ffe,null))[_0x60fe('0x4a')](handleError(_0x398ffe,null));};function wrapUser(_0x2ed69d){return function(_0x17cdd0){var _0x5c1653=_0x2ed69d[_0x60fe('0x4e')]({'plain':!![]});_0x5c1653['messages']=[];if(_0x17cdd0){_0x5c1653[_0x60fe('0x4f')]=_0x17cdd0[_0x60fe('0x50')];_0x5c1653[_0x60fe('0x51')]=_0x17cdd0;}else{_0x5c1653[_0x60fe('0x4f')]=moment(0x0)['format'](_0x60fe('0x52'));_0x5c1653[_0x60fe('0x51')]={};}return _0x5c1653;};}exports[_0x60fe('0x53')]=function(_0x561f93,_0x5693e0,_0x468aca){var _0x157717=[];return db['User']['findAll']({'where':{'role':['agent','admin',_0x60fe('0x54')]},'attributes':['id',_0x60fe('0x55'),'name',_0x60fe('0x56'),'userpic','internal','online',_0x60fe('0x57'),_0x60fe('0x58'),_0x60fe('0x59')],'order':qs[_0x60fe('0x3c')](_0x60fe('0x5a')),'include':[{'model':db[_0x60fe('0x5b')],'as':'VoiceQueues','attributes':['id',_0x60fe('0x2d'),_0x60fe('0x2f')],'through':{'attributes':[]}}]})[_0x60fe('0x29')](function(_0x24f9e9){if(_0x24f9e9){var _0x541ff7=_0x561f93['user'][_0x60fe('0x4e')]({'plain':!![]});if(!_0x541ff7)throw new Error(_0x60fe('0x5c'));if(_0x541ff7[_0x60fe('0x56')]===_0x60fe('0x54')){return db['UserProfileSection'][_0x60fe('0x49')]({'where':{'name':_0x60fe('0x5d'),'userProfileId':_0x541ff7[_0x60fe('0x5e')]},'raw':!![]})[_0x60fe('0x29')](function(_0x266d02){if(_0x266d02){if(_0x266d02[_0x60fe('0x5f')]===0x0){return db[_0x60fe('0x60')][_0x60fe('0x45')]({'where':{'sectionId':_0x266d02['id']},'raw':!![]})['then'](function(_0x56d095){var _0x373a37=[];if(_[_0x60fe('0x61')](_0x56d095)){_0x373a37=_[_0x60fe('0x3e')](_0x24f9e9,function(_0x3e134d){if(_0x3e134d[_0x60fe('0x56')]!==_0x60fe('0x62')){return _0x3e134d;}});return _0x373a37;}else{for(var _0x500a1d=0x0;_0x500a1d<_0x24f9e9[_0x60fe('0x39')];_0x500a1d++){var _0x3ebe2e=_0x24f9e9[_0x500a1d];if(_0x3ebe2e[_0x60fe('0x56')]===_0x60fe('0x62')){var _0x1c4bcc=_[_0x60fe('0x49')](_0x56d095,function(_0x1acf5c){return _0x1acf5c[_0x60fe('0x63')]===_0x3ebe2e['id'];});if(_0x1c4bcc)_0x373a37[_0x60fe('0x64')](_0x3ebe2e);}else{_0x373a37[_0x60fe('0x64')](_0x3ebe2e);}}return _0x373a37;}});}else{return _0x24f9e9;}}else{var _0x19fbfa=_[_0x60fe('0x3e')](_0x24f9e9,function(_0x105fee){if(_0x105fee[_0x60fe('0x56')]!==_0x60fe('0x62')){return _0x105fee;}});return _0x19fbfa;}});}else{return _0x24f9e9;}}})[_0x60fe('0x29')](function(_0x3df009){var _0x1e3d81=[];if(_0x3df009){_0x157717=_0x3df009;for(var _0x4f1840=0x0;_0x4f1840<_0x3df009[_0x60fe('0x39')];_0x4f1840+=0x1){_0x157717[_0x4f1840][_0x60fe('0x65')]=[];_0x1e3d81['push'](db[_0x60fe('0x42')]['find']({'where':{'FromId':[_0x561f93['user']['id'],_0x3df009[_0x4f1840]['id']],'ToId':[_0x561f93[_0x60fe('0x54')]['id'],_0x3df009[_0x4f1840]['id']],'ChatGroupId':null},'attributes':['id',_0x60fe('0x50'),'FromId',_0x60fe('0x66'),_0x60fe('0x67'),_0x60fe('0x4c')],'order':qs[_0x60fe('0x3c')](_0x60fe('0x68')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x60fe('0x29')](wrapUser(_0x3df009[_0x4f1840])));}return BPromise[_0x60fe('0x69')](_0x1e3d81);}return[];})['then'](function(_0x67ad76){return{'rows':_0x67ad76,'count':_0x67ad76[_0x60fe('0x39')]};})[_0x60fe('0x29')](respondWithResult(_0x5693e0,null))['catch'](handleError(_0x5693e0,null));}; \ No newline at end of file +var _0x6c7b=['params','create','body','find','describe','get','messages','lastMessageAt','createdAt','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueues','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','resourceId','push','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','end','status','json','count','offset','limit','set','apply','save','update','stack','name','index','map','ChatInternalMessage','rawAttributes','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show'];(function(_0x4f9981,_0xacd7ab){var _0x1a93ee=function(_0x32455c){while(--_0x32455c){_0x4f9981['push'](_0x4f9981['shift']());}};_0x1a93ee(++_0xacd7ab);}(_0x6c7b,0x8d));var _0xb6c7=function(_0x5e6589,_0x3e261e){_0x5e6589=_0x5e6589-0x0;var _0x5769df=_0x6c7b[_0x5e6589];return _0x5769df;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb6c7('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb6c7('0x1'));var moment=require(_0xb6c7('0x2'));var BPromise=require(_0xb6c7('0x3'));var Mustache=require(_0xb6c7('0x4'));var util=require(_0xb6c7('0x5'));var path=require(_0xb6c7('0x6'));var sox=require(_0xb6c7('0x7'));var csv=require(_0xb6c7('0x8'));var ejs=require(_0xb6c7('0x9'));var fs=require('fs');var fs_extra=require(_0xb6c7('0xa'));var _=require(_0xb6c7('0xb'));var squel=require(_0xb6c7('0xc'));var crypto=require(_0xb6c7('0xd'));var jsforce=require(_0xb6c7('0xe'));var deskjs=require(_0xb6c7('0xf'));var toCsv=require(_0xb6c7('0x8'));var querystring=require(_0xb6c7('0x10'));var Papa=require(_0xb6c7('0x11'));var Redis=require(_0xb6c7('0x12'));var authService=require(_0xb6c7('0x13'));var qs=require(_0xb6c7('0x14'));var as=require(_0xb6c7('0x15'));var hardwareService=require(_0xb6c7('0x16'));var logger=require(_0xb6c7('0x17'))(_0xb6c7('0x18'));var utils=require(_0xb6c7('0x19'));var config=require(_0xb6c7('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xb6c7('0x1b'))['db'];config[_0xb6c7('0x1c')]=_[_0xb6c7('0x1d')](config[_0xb6c7('0x1c')],{'host':_0xb6c7('0x1e'),'port':0x18eb});var socket=require(_0xb6c7('0x1f'))(new Redis(config['redis']));require(_0xb6c7('0x20'))[_0xb6c7('0x21')](socket);function respondWithStatusCode(_0x505e3b,_0xc5805b){_0xc5805b=_0xc5805b||0xcc;return function(_0x26828e){if(_0x26828e){return _0x505e3b[_0xb6c7('0x22')](_0xc5805b);}return _0x505e3b['status'](_0xc5805b)[_0xb6c7('0x23')]();};}function respondWithResult(_0x4d188f,_0x403ac7){_0x403ac7=_0x403ac7||0xc8;return function(_0x4f2ee6){if(_0x4f2ee6){return _0x4d188f[_0xb6c7('0x24')](_0x403ac7)[_0xb6c7('0x25')](_0x4f2ee6);}};}function respondWithFilteredResult(_0x57d42f,_0x27d910){return function(_0xe4b95d){if(_0xe4b95d){var _0x3f04af=_0xe4b95d[_0xb6c7('0x26')],_0x2d9561=_0x27d910[_0xb6c7('0x27')],_0x7a1148=_0x27d910['offset']+_0x27d910[_0xb6c7('0x28')],_0x4c4388;if(_0x7a1148>=_0x3f04af){_0x7a1148=_0x3f04af;_0x4c4388=0xc8;}else{_0x4c4388=0xce;}_0x57d42f[_0xb6c7('0x24')](_0x4c4388);return _0x57d42f[_0xb6c7('0x29')]('Content-Range',_0x2d9561+'-'+_0x7a1148+'/'+_0x3f04af)[_0xb6c7('0x25')](_0xe4b95d);}return null;};}function patchUpdates(_0x23cce2){return function(_0x189e50){try{jsonpatch[_0xb6c7('0x2a')](_0x189e50,_0x23cce2,!![]);}catch(_0x1ce53f){return BPromise['reject'](_0x1ce53f);}return _0x189e50[_0xb6c7('0x2b')]();};}function saveUpdates(_0x4693b8,_0x59e6d3){return function(_0x5cfb7e){if(_0x5cfb7e){return _0x5cfb7e[_0xb6c7('0x2c')](_0x4693b8)['then'](function(_0xa5c863){return _0xa5c863;});}return null;};}function removeEntity(_0x32f6d4,_0x4ff334){return function(_0x5ebc05){if(_0x5ebc05){return _0x5ebc05['destroy']()['then'](function(){_0x32f6d4['status'](0xcc)[_0xb6c7('0x23')]();});}};}function handleEntityNotFound(_0x1a0003,_0x79a0ba){return function(_0x4f861d){if(!_0x4f861d){_0x1a0003[_0xb6c7('0x22')](0x194);}return _0x4f861d;};}function handleError(_0x2a51be,_0x72e41a){_0x72e41a=_0x72e41a||0x1f4;return function(_0x501aa8){logger['error'](_0x501aa8[_0xb6c7('0x2d')]);if(_0x501aa8[_0xb6c7('0x2e')]){delete _0x501aa8[_0xb6c7('0x2e')];}_0x2a51be[_0xb6c7('0x24')](_0x72e41a)['send'](_0x501aa8);};}exports[_0xb6c7('0x2f')]=function(_0x402a61,_0x43a36a){var _0x38ce36={},_0x6641f5={},_0x5cb96b={'count':0x0,'rows':[]};var _0x581ae4=_[_0xb6c7('0x30')](db[_0xb6c7('0x31')][_0xb6c7('0x32')],function(_0x67ab3b){return{'name':_0x67ab3b['fieldName'],'type':_0x67ab3b[_0xb6c7('0x33')][_0xb6c7('0x34')]};});_0x6641f5['model']=_['map'](_0x581ae4,'name');_0x6641f5['query']=_[_0xb6c7('0x35')](_0x402a61[_0xb6c7('0x36')]);_0x6641f5[_0xb6c7('0x37')]=_[_0xb6c7('0x38')](_0x6641f5['model'],_0x6641f5[_0xb6c7('0x36')]);_0x38ce36[_0xb6c7('0x39')]=_[_0xb6c7('0x38')](_0x6641f5[_0xb6c7('0x3a')],qs['fields'](_0x402a61[_0xb6c7('0x36')][_0xb6c7('0x3b')]));_0x38ce36[_0xb6c7('0x39')]=_0x38ce36[_0xb6c7('0x39')][_0xb6c7('0x3c')]?_0x38ce36['attributes']:_0x6641f5[_0xb6c7('0x3a')];if(!_0x402a61['query'][_0xb6c7('0x3d')]('nolimit')){_0x38ce36['limit']=qs[_0xb6c7('0x28')](_0x402a61[_0xb6c7('0x36')][_0xb6c7('0x28')]);_0x38ce36['offset']=qs[_0xb6c7('0x27')](_0x402a61[_0xb6c7('0x36')]['offset']);}_0x38ce36[_0xb6c7('0x3e')]=qs[_0xb6c7('0x3f')](_0x402a61[_0xb6c7('0x36')][_0xb6c7('0x3f')]);_0x38ce36[_0xb6c7('0x40')]=qs[_0xb6c7('0x37')](_[_0xb6c7('0x41')](_0x402a61[_0xb6c7('0x36')],_0x6641f5['filters']),_0x581ae4);if(_0x402a61['query'][_0xb6c7('0x42')]){_0x38ce36[_0xb6c7('0x40')]=_[_0xb6c7('0x43')](_0x38ce36[_0xb6c7('0x40')],{'$or':_[_0xb6c7('0x30')](_0x581ae4,function(_0x508974){if(_0x508974[_0xb6c7('0x33')]!==_0xb6c7('0x44')){var _0x3395b2={};_0x3395b2[_0x508974[_0xb6c7('0x2e')]]={'$like':'%'+_0x402a61[_0xb6c7('0x36')]['filter']+'%'};return _0x3395b2;}})});}_0x38ce36=_['merge']({},_0x38ce36,_0x402a61[_0xb6c7('0x45')]);var _0x47fe44={'where':_0x38ce36[_0xb6c7('0x40')]};return db['ChatInternalMessage'][_0xb6c7('0x26')](_0x47fe44)[_0xb6c7('0x46')](function(_0x3ba679){_0x5cb96b[_0xb6c7('0x26')]=_0x3ba679;if(_0x402a61[_0xb6c7('0x36')][_0xb6c7('0x47')]){_0x38ce36[_0xb6c7('0x48')]=[{'all':!![]}];}return db[_0xb6c7('0x31')][_0xb6c7('0x49')](_0x38ce36);})[_0xb6c7('0x46')](function(_0x934431){_0x5cb96b[_0xb6c7('0x4a')]=_0x934431;return _0x5cb96b;})[_0xb6c7('0x46')](respondWithFilteredResult(_0x43a36a,_0x38ce36))[_0xb6c7('0x4b')](handleError(_0x43a36a,null));};exports[_0xb6c7('0x4c')]=function(_0x4f2544,_0x5ea4f8){var _0x2d7a82={'raw':!![],'where':{'id':_0x4f2544[_0xb6c7('0x4d')]['id']}},_0x5ab142={};_0x5ab142[_0xb6c7('0x3a')]=_['keys'](db['ChatInternalMessage'][_0xb6c7('0x32')]);_0x5ab142['query']=_[_0xb6c7('0x35')](_0x4f2544['query']);_0x5ab142[_0xb6c7('0x37')]=_[_0xb6c7('0x38')](_0x5ab142['model'],_0x5ab142[_0xb6c7('0x36')]);_0x2d7a82['attributes']=_[_0xb6c7('0x38')](_0x5ab142[_0xb6c7('0x3a')],qs[_0xb6c7('0x3b')](_0x4f2544[_0xb6c7('0x36')][_0xb6c7('0x3b')]));_0x2d7a82[_0xb6c7('0x39')]=_0x2d7a82['attributes'][_0xb6c7('0x3c')]?_0x2d7a82['attributes']:_0x5ab142[_0xb6c7('0x3a')];if(_0x4f2544[_0xb6c7('0x36')][_0xb6c7('0x47')]){_0x2d7a82[_0xb6c7('0x48')]=[{'all':!![]}];}_0x2d7a82=_['merge']({},_0x2d7a82,_0x4f2544['options']);return db[_0xb6c7('0x31')]['find'](_0x2d7a82)[_0xb6c7('0x46')](handleEntityNotFound(_0x5ea4f8,null))[_0xb6c7('0x46')](respondWithResult(_0x5ea4f8,null))['catch'](handleError(_0x5ea4f8,null));};exports[_0xb6c7('0x4e')]=function(_0x3d0189,_0x4c2b7b){return db[_0xb6c7('0x31')][_0xb6c7('0x4e')](_0x3d0189['body'],{})['then'](respondWithResult(_0x4c2b7b,0xc9))[_0xb6c7('0x4b')](handleError(_0x4c2b7b,null));};exports[_0xb6c7('0x2c')]=function(_0x894387,_0x298405){if(_0x894387['body']['id']){delete _0x894387[_0xb6c7('0x4f')]['id'];}return db[_0xb6c7('0x31')][_0xb6c7('0x50')]({'where':{'id':_0x894387[_0xb6c7('0x4d')]['id']}})[_0xb6c7('0x46')](handleEntityNotFound(_0x298405,null))['then'](saveUpdates(_0x894387[_0xb6c7('0x4f')],null))[_0xb6c7('0x46')](respondWithResult(_0x298405,null))[_0xb6c7('0x4b')](handleError(_0x298405,null));};exports['destroy']=function(_0x25d65b,_0x22c5b4){return db[_0xb6c7('0x31')][_0xb6c7('0x50')]({'where':{'id':_0x25d65b['params']['id']}})[_0xb6c7('0x46')](handleEntityNotFound(_0x22c5b4,null))[_0xb6c7('0x46')](removeEntity(_0x22c5b4,null))[_0xb6c7('0x4b')](handleError(_0x22c5b4,null));};exports[_0xb6c7('0x51')]=function(_0x1aa32d,_0x4aa479){return db[_0xb6c7('0x31')]['describe']()[_0xb6c7('0x46')](respondWithResult(_0x4aa479,null))['catch'](handleError(_0x4aa479,null));};function wrapUser(_0x33f981){return function(_0x3d09c4){var _0x1c8b91=_0x33f981[_0xb6c7('0x52')]({'plain':!![]});_0x1c8b91[_0xb6c7('0x53')]=[];if(_0x3d09c4){_0x1c8b91[_0xb6c7('0x54')]=_0x3d09c4[_0xb6c7('0x55')];_0x1c8b91['lastMessage']=_0x3d09c4;}else{_0x1c8b91[_0xb6c7('0x54')]=moment(0x0)['format'](_0xb6c7('0x56'));_0x1c8b91[_0xb6c7('0x57')]={};}return _0x1c8b91;};}exports[_0xb6c7('0x58')]=function(_0x5494cf,_0x2b8684,_0x547fec){var _0x11524e=[];return db[_0xb6c7('0x59')][_0xb6c7('0x49')]({'where':{'role':[_0xb6c7('0x5a'),_0xb6c7('0x5b'),_0xb6c7('0x5c')]},'attributes':['id',_0xb6c7('0x5d'),_0xb6c7('0x2e'),_0xb6c7('0x5e'),_0xb6c7('0x5f'),_0xb6c7('0x60'),_0xb6c7('0x61'),_0xb6c7('0x62'),_0xb6c7('0x63'),_0xb6c7('0x64')],'order':qs[_0xb6c7('0x3f')]('-online'),'include':[{'model':db['VoiceQueue'],'as':_0xb6c7('0x65'),'attributes':['id',_0xb6c7('0x2e'),_0xb6c7('0x33')],'through':{'attributes':[]}}]})[_0xb6c7('0x46')](function(_0x12dd4f){if(_0x12dd4f){var _0x4f4f93=_0x5494cf['user']['get']({'plain':!![]});if(!_0x4f4f93)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f4f93['role']===_0xb6c7('0x5c')){return db[_0xb6c7('0x66')][_0xb6c7('0x50')]({'where':{'name':_0xb6c7('0x67'),'userProfileId':_0x4f4f93[_0xb6c7('0x68')]},'raw':!![]})[_0xb6c7('0x46')](function(_0x31cc5b){if(_0x31cc5b){if(_0x31cc5b[_0xb6c7('0x69')]===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x31cc5b['id']},'raw':!![]})[_0xb6c7('0x46')](function(_0xaf4e0b){var _0x2674f=[];if(_[_0xb6c7('0x6a')](_0xaf4e0b)){_0x2674f=_[_0xb6c7('0x42')](_0x12dd4f,function(_0x1aa2f0){if(_0x1aa2f0[_0xb6c7('0x5e')]!==_0xb6c7('0x5a')){return _0x1aa2f0;}});return _0x2674f;}else{for(var _0x2804bc=0x0;_0x2804bc<_0x12dd4f[_0xb6c7('0x3c')];_0x2804bc++){var _0x213533=_0x12dd4f[_0x2804bc];if(_0x213533['role']===_0xb6c7('0x5a')){var _0x121161=_['find'](_0xaf4e0b,function(_0x10e459){return _0x10e459[_0xb6c7('0x6b')]===_0x213533['id'];});if(_0x121161)_0x2674f['push'](_0x213533);}else{_0x2674f[_0xb6c7('0x6c')](_0x213533);}}return _0x2674f;}});}else{return _0x12dd4f;}}else{var _0x4ff436=_['filter'](_0x12dd4f,function(_0x20fcc0){if(_0x20fcc0[_0xb6c7('0x5e')]!==_0xb6c7('0x5a')){return _0x20fcc0;}});return _0x4ff436;}});}else{return _0x12dd4f;}}})[_0xb6c7('0x46')](function(_0x3ce748){var _0x453100=[];if(_0x3ce748){_0x11524e=_0x3ce748;for(var _0x1d5a02=0x0;_0x1d5a02<_0x3ce748['length'];_0x1d5a02+=0x1){_0x11524e[_0x1d5a02][_0xb6c7('0x53')]=[];_0x453100[_0xb6c7('0x6c')](db[_0xb6c7('0x31')][_0xb6c7('0x50')]({'where':{'FromId':[_0x5494cf[_0xb6c7('0x5c')]['id'],_0x3ce748[_0x1d5a02]['id']],'ToId':[_0x5494cf[_0xb6c7('0x5c')]['id'],_0x3ce748[_0x1d5a02]['id']],'ChatGroupId':null},'attributes':['id',_0xb6c7('0x55'),'FromId','ToId','read',_0xb6c7('0x4f')],'order':qs[_0xb6c7('0x3f')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xb6c7('0x46')](wrapUser(_0x3ce748[_0x1d5a02])));}return BPromise['all'](_0x453100);}return[];})[_0xb6c7('0x46')](function(_0x4f78f4){return{'rows':_0x4f78f4,'count':_0x4f78f4['length']};})[_0xb6c7('0x46')](respondWithResult(_0x2b8684,null))['catch'](handleError(_0x2b8684,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 3bdb56a..991e381 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 _0xaf40=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_0x4624c4,_0x2620c9){var _0x3c0d60=function(_0x18abbe){while(--_0x18abbe){_0x4624c4['push'](_0x4624c4['shift']());}};_0x3c0d60(++_0x2620c9);}(_0xaf40,0x75));var _0x0af4=function(_0x182e7b,_0x4f6d8b){_0x182e7b=_0x182e7b-0x0;var _0x2f39db=_0xaf40[_0x182e7b];return _0x2f39db;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x0af4('0x0'))['db'][_0x0af4('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x0af4('0x2')](0x0);var events={'afterCreate':_0x0af4('0x3'),'afterUpdate':_0x0af4('0x4'),'afterDestroy':_0x0af4('0x5')};function emitEvent(_0x2e367a){return function(_0x35be09,_0x18ca82,_0x2b432d){ChatInternalMessageEvents[_0x0af4('0x6')](_0x2e367a+':'+_0x35be09['id'],_0x35be09);ChatInternalMessageEvents[_0x0af4('0x6')](_0x2e367a,_0x35be09);_0x2b432d(null);};}for(var e in events){if(events[_0x0af4('0x7')](e)){var event=events[e];ChatInternalMessage[_0x0af4('0x8')](e,emitEvent(event));}}module[_0x0af4('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x27a8=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','ChatInternalMessage'];(function(_0x71db89,_0x57632){var _0x181bc5=function(_0x5a4faa){while(--_0x5a4faa){_0x71db89['push'](_0x71db89['shift']());}};_0x181bc5(++_0x57632);}(_0x27a8,0x170));var _0x827a=function(_0x48c2f4,_0x531033){_0x48c2f4=_0x48c2f4-0x0;var _0x258e2a=_0x27a8[_0x48c2f4];return _0x258e2a;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require('../../mysqldb')['db'][_0x827a('0x0')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x827a('0x1')](0x0);var events={'afterCreate':_0x827a('0x2'),'afterUpdate':_0x827a('0x3'),'afterDestroy':_0x827a('0x4')};function emitEvent(_0x300907){return function(_0x18cf5e,_0x215b35,_0x2b3486){ChatInternalMessageEvents[_0x827a('0x5')](_0x300907+':'+_0x18cf5e['id'],_0x18cf5e);ChatInternalMessageEvents[_0x827a('0x5')](_0x300907,_0x18cf5e);_0x2b3486(null);};}for(var e in events){if(events[_0x827a('0x6')](e)){var event=events[e];ChatInternalMessage[_0x827a('0x7')](e,emitEvent(event));}}module[_0x827a('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index a9ddbef..533de05 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 _0xbaf0=['define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports'];(function(_0x354df8,_0x3d996e){var _0x5cf17b=function(_0x482ac9){while(--_0x482ac9){_0x354df8['push'](_0x354df8['shift']());}};_0x5cf17b(++_0x3d996e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0baf('0xd')});}; \ No newline at end of file +var _0xaa88=['chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','ChatInternalMessage'];(function(_0x43357f,_0x305c29){var _0x464c70=function(_0x408c20){while(--_0x408c20){_0x43357f['push'](_0x43357f['shift']());}};_0x464c70(++_0x305c29);}(_0xaa88,0x137));var _0x8aa8=function(_0x5c2a2b,_0x22c94e){_0x5c2a2b=_0x5c2a2b-0x0;var _0x19921f=_0xaa88[_0x5c2a2b];return _0x19921f;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8aa8('0xc'),'collate':_0x8aa8('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index eba6e1d..6d908b3 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 _0x8f09=['client','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','request','then','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','info','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x2124e0,_0x165568){var _0xde3e29=function(_0x30ad4f){while(--_0x30ad4f){_0x2124e0['push'](_0x2124e0['shift']());}};_0xde3e29(++_0x165568);}(_0x8f09,0x9a));var _0x98f0=function(_0x10bb03,_0xd0e5e8){_0x10bb03=_0x10bb03-0x0;var _0x54bf21=_0x8f09[_0x10bb03];return _0x54bf21;};'use strict';var _=require(_0x98f0('0x0'));var util=require('util');var moment=require(_0x98f0('0x1'));var BPromise=require(_0x98f0('0x2'));var rs=require(_0x98f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x98f0('0x4'))['db'];var utils=require(_0x98f0('0x5'));var logger=require(_0x98f0('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x98f0('0x7'));var client=jayson[_0x98f0('0x8')][_0x98f0('0x9')]({'port':0x232a});config[_0x98f0('0xa')]=_[_0x98f0('0xb')](config[_0x98f0('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x98f0('0xc'))(new Redis(config['redis']));require(_0x98f0('0xd'))[_0x98f0('0xe')](socket);function respondWithRpcPromise(_0x261890,_0x372f4f,_0x18ea09){return new BPromise(function(_0x1d7716,_0x327633){return client[_0x98f0('0xf')](_0x261890,_0x18ea09)[_0x98f0('0x10')](function(_0x470a8f){logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x372f4f,'request\x20sent');logger[_0x98f0('0x11')](_0x98f0('0x12'),_0x372f4f,_0x98f0('0x13'),JSON[_0x98f0('0x14')](_0x470a8f));if(_0x470a8f[_0x98f0('0x15')]){if(_0x470a8f[_0x98f0('0x15')][_0x98f0('0x16')]===0x1f4){logger[_0x98f0('0x15')](_0x98f0('0x17'),_0x372f4f,_0x470a8f[_0x98f0('0x15')][_0x98f0('0x18')]);return _0x327633(_0x470a8f[_0x98f0('0x15')][_0x98f0('0x18')]);}logger[_0x98f0('0x15')](_0x98f0('0x17'),_0x372f4f,_0x470a8f[_0x98f0('0x15')][_0x98f0('0x18')]);return _0x1d7716(_0x470a8f[_0x98f0('0x15')]['message']);}else{logger[_0x98f0('0x19')](_0x98f0('0x17'),_0x372f4f,_0x98f0('0x13'));_0x1d7716(_0x470a8f[_0x98f0('0x1a')][_0x98f0('0x18')]);}})['catch'](function(_0x4f4f2c){logger[_0x98f0('0x15')](_0x98f0('0x17'),_0x372f4f,_0x4f4f2c);_0x327633(_0x4f4f2c);});});} \ No newline at end of file +var _0xebb2=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0xb26ec4,_0x34f43d){var _0x572b66=function(_0x3eeab2){while(--_0x3eeab2){_0xb26ec4['push'](_0xb26ec4['shift']());}};_0x572b66(++_0x34f43d);}(_0xebb2,0x19d));var _0x2ebb=function(_0x30b816,_0x2f4650){_0x30b816=_0x30b816-0x0;var _0x14e76c=_0xebb2[_0x30b816];return _0x14e76c;};'use strict';var _=require(_0x2ebb('0x0'));var util=require(_0x2ebb('0x1'));var moment=require(_0x2ebb('0x2'));var BPromise=require(_0x2ebb('0x3'));var rs=require(_0x2ebb('0x4'));var fs=require('fs');var Redis=require(_0x2ebb('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ebb('0x6'));var logger=require(_0x2ebb('0x7'))('rpc');var config=require(_0x2ebb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2ebb('0x9')]['http']({'port':0x232a});config[_0x2ebb('0xa')]=_[_0x2ebb('0xb')](config[_0x2ebb('0xa')],{'host':_0x2ebb('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2ebb('0xd'))['register'](socket);function respondWithRpcPromise(_0x40efbf,_0x5e6aff,_0x1011c6){return new BPromise(function(_0x41bb01,_0x34b0ab){return client[_0x2ebb('0xe')](_0x40efbf,_0x1011c6)[_0x2ebb('0xf')](function(_0x26ef15){logger[_0x2ebb('0x10')](_0x2ebb('0x11'),_0x5e6aff,_0x2ebb('0x12'));logger[_0x2ebb('0x13')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x5e6aff,'request\x20sent',JSON[_0x2ebb('0x14')](_0x26ef15));if(_0x26ef15['error']){if(_0x26ef15[_0x2ebb('0x15')][_0x2ebb('0x16')]===0x1f4){logger[_0x2ebb('0x15')](_0x2ebb('0x11'),_0x5e6aff,_0x26ef15[_0x2ebb('0x15')][_0x2ebb('0x17')]);return _0x34b0ab(_0x26ef15[_0x2ebb('0x15')][_0x2ebb('0x17')]);}logger[_0x2ebb('0x15')](_0x2ebb('0x11'),_0x5e6aff,_0x26ef15[_0x2ebb('0x15')]['message']);return _0x41bb01(_0x26ef15[_0x2ebb('0x15')][_0x2ebb('0x17')]);}else{logger[_0x2ebb('0x10')](_0x2ebb('0x11'),_0x5e6aff,_0x2ebb('0x12'));_0x41bb01(_0x26ef15[_0x2ebb('0x18')][_0x2ebb('0x17')]);}})[_0x2ebb('0x19')](function(_0x3a827e){logger[_0x2ebb('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x5e6aff,_0x3a827e);_0x34b0ab(_0x3a827e);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 7d96f24..d7f05da 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 _0xd2ce=['length','save','update','emit','register'];(function(_0x1ad9b4,_0x5df9ed){var _0xbbee74=function(_0x39c75f){while(--_0x39c75f){_0x1ad9b4['push'](_0x1ad9b4['shift']());}};_0xbbee74(++_0x5df9ed);}(_0xd2ce,0x13c));var _0xed2c=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xd2ce[_0x4baae2];return _0x1a2285;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xed2c('0x0'),'remove',_0xed2c('0x1')];function createListener(_0x271df9,_0x100271){return function(_0x1e3c07){_0x100271[_0xed2c('0x2')](_0x271df9,_0x1e3c07);};}function removeListener(_0x2fe29b,_0x418d1c){return function(){ChatInternalMessageEvents['removeListener'](_0x2fe29b,_0x418d1c);};}exports[_0xed2c('0x3')]=function(_0x5b6ccb){for(var _0x38aa25=0x0,_0x24cd4f=events[_0xed2c('0x4')];_0x38aa25<_0x24cd4f;_0x38aa25++){var _0x523fb0=events[_0x38aa25];var _0x255320=createListener('chatInternalMessage:'+_0x523fb0,_0x5b6ccb);ChatInternalMessageEvents['on'](_0x523fb0,_0x255320);}}; \ No newline at end of file +var _0xbc17=['./chatInternalMessage.events','save','update','emit','removeListener','length','chatInternalMessage:'];(function(_0x36a907,_0x53da75){var _0x2f0962=function(_0x464677){while(--_0x464677){_0x36a907['push'](_0x36a907['shift']());}};_0x2f0962(++_0x53da75);}(_0xbc17,0x1ab));var _0x7bc1=function(_0x578a80,_0x412698){_0x578a80=_0x578a80-0x0;var _0x4b4ba8=_0xbc17[_0x578a80];return _0x4b4ba8;};'use strict';var ChatInternalMessageEvents=require(_0x7bc1('0x0'));var events=[_0x7bc1('0x1'),'remove',_0x7bc1('0x2')];function createListener(_0xa0421d,_0x5185e7){return function(_0x4b1479){_0x5185e7[_0x7bc1('0x3')](_0xa0421d,_0x4b1479);};}function removeListener(_0x7aa41e,_0x5dfaa8){return function(){ChatInternalMessageEvents[_0x7bc1('0x4')](_0x7aa41e,_0x5dfaa8);};}exports['register']=function(_0xba4fa8){for(var _0xcecb62=0x0,_0x1b720f=events[_0x7bc1('0x5')];_0xcecb62<_0x1b720f;_0xcecb62++){var _0x3fdce7=events[_0xcecb62];var _0x351340=createListener(_0x7bc1('0x6')+_0x3fdce7,_0xba4fa8);ChatInternalMessageEvents['on'](_0x3fdce7,_0x351340);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 3c32ba4..7be5efa 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 _0xacd6=['get','index','/describe','isAuthenticated','describe','/users','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller'];(function(_0x5a5cfb,_0x37ed01){var _0x334936=function(_0x344895){while(--_0x344895){_0x5a5cfb['push'](_0x5a5cfb['shift']());}};_0x334936(++_0x37ed01);}(_0xacd6,0xef));var _0x6acd=function(_0x680821,_0x23e67f){_0x680821=_0x680821-0x0;var _0x3f132c=_0xacd6[_0x680821];return _0x3f132c;};'use strict';var multer=require(_0x6acd('0x0'));var util=require(_0x6acd('0x1'));var path=require(_0x6acd('0x2'));var timeout=require(_0x6acd('0x3'));var express=require(_0x6acd('0x4'));var router=express[_0x6acd('0x5')]();var fs_extra=require(_0x6acd('0x6'));var auth=require(_0x6acd('0x7'));var interaction=require(_0x6acd('0x8'));var config=require(_0x6acd('0x9'));var controller=require(_0x6acd('0xa'));router[_0x6acd('0xb')]('/',auth['isAuthenticated'](),controller[_0x6acd('0xc')]);router[_0x6acd('0xb')](_0x6acd('0xd'),auth[_0x6acd('0xe')](),controller[_0x6acd('0xf')]);router[_0x6acd('0xb')](_0x6acd('0x10'),auth[_0x6acd('0xe')](),controller['getUsers']);router[_0x6acd('0xb')](_0x6acd('0x11'),auth[_0x6acd('0xe')](),controller[_0x6acd('0x12')]);router[_0x6acd('0x13')]('/',auth[_0x6acd('0xe')](),controller[_0x6acd('0x14')]);router['put']('/:id',controller[_0x6acd('0x15')]);router[_0x6acd('0x16')](_0x6acd('0x11'),auth['isAuthenticated'](),controller[_0x6acd('0x17')]);module[_0x6acd('0x18')]=router; \ No newline at end of file +var _0xbce7=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','index','get','isAuthenticated','/users','getUsers','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x441c2b,_0x55b78d){var _0x2ec518=function(_0x343917){while(--_0x343917){_0x441c2b['push'](_0x441c2b['shift']());}};_0x2ec518(++_0x55b78d);}(_0xbce7,0x163));var _0x7bce=function(_0x20255b,_0x52aa07){_0x20255b=_0x20255b-0x0;var _0x81fe0a=_0xbce7[_0x20255b];return _0x81fe0a;};'use strict';var multer=require(_0x7bce('0x0'));var util=require(_0x7bce('0x1'));var path=require('path');var timeout=require(_0x7bce('0x2'));var express=require('express');var router=express[_0x7bce('0x3')]();var fs_extra=require(_0x7bce('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7bce('0x5'));var config=require(_0x7bce('0x6'));var controller=require(_0x7bce('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x7bce('0x8')]);router[_0x7bce('0x9')]('/describe',auth[_0x7bce('0xa')](),controller['describe']);router[_0x7bce('0x9')](_0x7bce('0xb'),auth['isAuthenticated'](),controller[_0x7bce('0xc')]);router[_0x7bce('0x9')](_0x7bce('0xd'),auth[_0x7bce('0xa')](),controller[_0x7bce('0xe')]);router[_0x7bce('0xf')]('/',auth[_0x7bce('0xa')](),controller[_0x7bce('0x10')]);router[_0x7bce('0x11')]('/:id',controller[_0x7bce('0x12')]);router[_0x7bce('0x13')](_0x7bce('0xd'),auth[_0x7bce('0xa')](),controller[_0x7bce('0x14')]);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 6ef6b3f..eb6d6a4 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 _0xcd53=['out','DATE','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0xb68772,_0x5253ac){var _0x4189bb=function(_0x1b0cf3){while(--_0x1b0cf3){_0xb68772['push'](_0xb68772['shift']());}};_0x4189bb(++_0x5253ac);}(_0xcd53,0x6b));var _0x3cd5=function(_0x30cc1a,_0x162bbc){_0x30cc1a=_0x30cc1a-0x0;var _0xb3f18f=_0xcd53[_0x30cc1a];return _0xb3f18f;};'use strict';var Sequelize=require('sequelize');module[_0x3cd5('0x0')]={'body':{'type':Sequelize[_0x3cd5('0x1')](_0x3cd5('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x3cd5('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3cd5('0x4')]('in',_0x3cd5('0x5')),'defaultValue':_0x3cd5('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x3cd5('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x9772=['TEXT','medium','BOOLEAN','ENUM','out','DATE','exports'];(function(_0x2726ad,_0x5073b1){var _0xd87993=function(_0x1cb35b){while(--_0x1cb35b){_0x2726ad['push'](_0x2726ad['shift']());}};_0xd87993(++_0x5073b1);}(_0x9772,0xbc));var _0x2977=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x9772[_0x4ae6ef];return _0x3cbb4e;};'use strict';var Sequelize=require('sequelize');module[_0x2977('0x0')]={'body':{'type':Sequelize[_0x2977('0x1')](_0x2977('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x2977('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x2977('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2977('0x4')]('in','out'),'defaultValue':_0x2977('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x2977('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index fd4e95f..8c866be 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 _0x84be=['hasOwnProperty','nolimit','limit','offset','order','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','length','find','create','body','describe','../../config/logger','chat-interactions','accept','chat','read','format','UserId','user','agent','CmContact','Contact','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','role','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','formData','reject','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SIP/%s','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','http','client','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','set','Content-Range','json','apply','save','update','then','destroy','stack','name','send','map','ChatMessage','fieldName','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x4ad762,_0x3e7464){var _0x56f931=function(_0x1a6c40){while(--_0x1a6c40){_0x4ad762['push'](_0x4ad762['shift']());}};_0x56f931(++_0x3e7464);}(_0x84be,0x138));var _0xe84b=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x84be[_0x4fc9e6];return _0x551d28;};'use strict';var pdf=require(_0xe84b('0x0'));var emlformat=require(_0xe84b('0x1'));var rimraf=require(_0xe84b('0x2'));var zipdir=require(_0xe84b('0x3'));var jsonpatch=require(_0xe84b('0x4'));var rp=require(_0xe84b('0x5'));var moment=require(_0xe84b('0x6'));var BPromise=require(_0xe84b('0x7'));var Mustache=require('mustache');var util=require(_0xe84b('0x8'));var path=require(_0xe84b('0x9'));var sox=require('sox');var csv=require(_0xe84b('0xa'));var ejs=require(_0xe84b('0xb'));var fs=require('fs');var fs_extra=require(_0xe84b('0xc'));var _=require('lodash');var squel=require(_0xe84b('0xd'));var crypto=require('crypto');var jsforce=require(_0xe84b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe84b('0xa'));var querystring=require(_0xe84b('0xf'));var Papa=require(_0xe84b('0x10'));var Redis=require(_0xe84b('0x11'));var authService=require(_0xe84b('0x12'));var qs=require(_0xe84b('0x13'));var as=require(_0xe84b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe84b('0x15'));var utils=require(_0xe84b('0x16'));var config=require(_0xe84b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe84b('0x18'))['db'];config[_0xe84b('0x19')]=_[_0xe84b('0x1a')](config['redis'],{'host':_0xe84b('0x1b'),'port':0x18eb});var socket=require(_0xe84b('0x1c'))(new Redis(config[_0xe84b('0x19')]));require(_0xe84b('0x1d'))[_0xe84b('0x1e')](socket);var jayson=require(_0xe84b('0x1f'));var client=jayson['client'][_0xe84b('0x20')]({'port':0x232c});var client9002=jayson[_0xe84b('0x21')][_0xe84b('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1804bd,_0xc534c7,_0x2e33e2,_0x37c0a6){return new BPromise(function(_0x51f35d,_0x3b61f2){var _0xe585b6=_0x37c0a6||client;return _0xe585b6[_0xe84b('0x22')](_0x1804bd,_0x2e33e2)['then'](function(_0x17cd7a){logger[_0xe84b('0x23')](_0xe84b('0x24'),_0xc534c7,_0xe84b('0x25'));logger[_0xe84b('0x26')](_0xe84b('0x27'),_0xc534c7,_0xe84b('0x25'),JSON[_0xe84b('0x28')](_0x17cd7a));if(_0x17cd7a[_0xe84b('0x29')]){if(_0x17cd7a[_0xe84b('0x29')][_0xe84b('0x2a')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0xc534c7,_0x17cd7a[_0xe84b('0x29')][_0xe84b('0x2b')]);return _0x3b61f2(_0x17cd7a[_0xe84b('0x29')][_0xe84b('0x2b')]);}logger[_0xe84b('0x29')](_0xe84b('0x24'),_0xc534c7,_0x17cd7a[_0xe84b('0x29')][_0xe84b('0x2b')]);return _0x51f35d(_0x17cd7a['error'][_0xe84b('0x2b')]);}else{logger['info'](_0xe84b('0x24'),_0xc534c7,_0xe84b('0x25'));_0x51f35d(_0x17cd7a[_0xe84b('0x2c')][_0xe84b('0x2b')]);}})[_0xe84b('0x2d')](function(_0x32e382){logger[_0xe84b('0x29')](_0xe84b('0x24'),_0xc534c7,_0x32e382);_0x3b61f2(_0x32e382);});});}function respondWithStatusCode(_0x3199c9,_0x16e065){_0x16e065=_0x16e065||0xcc;return function(_0x247cc6){if(_0x247cc6){return _0x3199c9[_0xe84b('0x2e')](_0x16e065);}return _0x3199c9[_0xe84b('0x2f')](_0x16e065)[_0xe84b('0x30')]();};}function respondWithResult(_0x754507,_0x168526){_0x168526=_0x168526||0xc8;return function(_0x239693){if(_0x239693){return _0x754507['status'](_0x168526)['json'](_0x239693);}};}function respondWithFilteredResult(_0x160502,_0x5c056c){return function(_0x5ea94d){if(_0x5ea94d){var _0x2c13fe=_0x5ea94d[_0xe84b('0x31')],_0x2b3cbb=_0x5c056c['offset'],_0x46fa5c=_0x5c056c['offset']+_0x5c056c['limit'],_0x41ae44;if(_0x46fa5c>=_0x2c13fe){_0x46fa5c=_0x2c13fe;_0x41ae44=0xc8;}else{_0x41ae44=0xce;}_0x160502[_0xe84b('0x2f')](_0x41ae44);return _0x160502[_0xe84b('0x32')](_0xe84b('0x33'),_0x2b3cbb+'-'+_0x46fa5c+'/'+_0x2c13fe)[_0xe84b('0x34')](_0x5ea94d);}return null;};}function patchUpdates(_0x4a5f54){return function(_0x412966){try{jsonpatch[_0xe84b('0x35')](_0x412966,_0x4a5f54,!![]);}catch(_0xf8c427){return BPromise['reject'](_0xf8c427);}return _0x412966[_0xe84b('0x36')]();};}function saveUpdates(_0x499e03,_0x12a68c){return function(_0x1e5187){if(_0x1e5187){return _0x1e5187[_0xe84b('0x37')](_0x499e03)[_0xe84b('0x38')](function(_0x3c1b12){return _0x3c1b12;});}return null;};}function removeEntity(_0x26f79f,_0x4aca82){return function(_0x236059){if(_0x236059){return _0x236059[_0xe84b('0x39')]()[_0xe84b('0x38')](function(){_0x26f79f[_0xe84b('0x2f')](0xcc)[_0xe84b('0x30')]();});}};}function handleEntityNotFound(_0x58840c,_0xb2804f){return function(_0x248676){if(!_0x248676){_0x58840c[_0xe84b('0x2e')](0x194);}return _0x248676;};}function handleError(_0x2f8db2,_0x24a516){_0x24a516=_0x24a516||0x1f4;return function(_0x5bddf6){logger['error'](_0x5bddf6[_0xe84b('0x3a')]);if(_0x5bddf6[_0xe84b('0x3b')]){delete _0x5bddf6['name'];}_0x2f8db2[_0xe84b('0x2f')](_0x24a516)[_0xe84b('0x3c')](_0x5bddf6);};}exports['index']=function(_0x21c632,_0x5e8475){var _0x4c4d41={},_0x26899f={},_0x42dbc7={'count':0x0,'rows':[]};var _0xb20acc=_[_0xe84b('0x3d')](db[_0xe84b('0x3e')]['rawAttributes'],function(_0x232ce1){return{'name':_0x232ce1[_0xe84b('0x3f')],'type':_0x232ce1['type'][_0xe84b('0x40')]};});_0x26899f[_0xe84b('0x41')]=_[_0xe84b('0x3d')](_0xb20acc,_0xe84b('0x3b'));_0x26899f[_0xe84b('0x42')]=_[_0xe84b('0x43')](_0x21c632[_0xe84b('0x42')]);_0x26899f[_0xe84b('0x44')]=_[_0xe84b('0x45')](_0x26899f[_0xe84b('0x41')],_0x26899f[_0xe84b('0x42')]);_0x4c4d41[_0xe84b('0x46')]=_[_0xe84b('0x45')](_0x26899f[_0xe84b('0x41')],qs[_0xe84b('0x47')](_0x21c632['query']['fields']));_0x4c4d41[_0xe84b('0x46')]=_0x4c4d41['attributes']['length']?_0x4c4d41['attributes']:_0x26899f[_0xe84b('0x41')];if(!_0x21c632[_0xe84b('0x42')][_0xe84b('0x48')](_0xe84b('0x49'))){_0x4c4d41[_0xe84b('0x4a')]=qs[_0xe84b('0x4a')](_0x21c632[_0xe84b('0x42')][_0xe84b('0x4a')]);_0x4c4d41[_0xe84b('0x4b')]=qs[_0xe84b('0x4b')](_0x21c632[_0xe84b('0x42')][_0xe84b('0x4b')]);}_0x4c4d41[_0xe84b('0x4c')]=qs['sort'](_0x21c632[_0xe84b('0x42')]['sort']);_0x4c4d41['where']=qs[_0xe84b('0x44')](_[_0xe84b('0x4d')](_0x21c632['query'],_0x26899f[_0xe84b('0x44')]),_0xb20acc);if(_0x21c632[_0xe84b('0x42')]['filter']){_0x4c4d41[_0xe84b('0x4e')]=_[_0xe84b('0x4f')](_0x4c4d41[_0xe84b('0x4e')],{'$or':_['map'](_0xb20acc,function(_0x4de72f){if(_0x4de72f[_0xe84b('0x50')]!==_0xe84b('0x51')){var _0x57f10b={};_0x57f10b[_0x4de72f[_0xe84b('0x3b')]]={'$like':'%'+_0x21c632[_0xe84b('0x42')][_0xe84b('0x52')]+'%'};return _0x57f10b;}})});}_0x4c4d41=_['merge']({},_0x4c4d41,_0x21c632[_0xe84b('0x53')]);var _0x46ef4f={'where':_0x4c4d41[_0xe84b('0x4e')]};return db['ChatMessage'][_0xe84b('0x31')](_0x46ef4f)[_0xe84b('0x38')](function(_0x56b468){_0x42dbc7[_0xe84b('0x31')]=_0x56b468;if(_0x21c632[_0xe84b('0x42')][_0xe84b('0x54')]){_0x4c4d41[_0xe84b('0x55')]=[{'all':!![]}];}return db['ChatMessage'][_0xe84b('0x56')](_0x4c4d41);})['then'](function(_0x21a9b3){_0x42dbc7[_0xe84b('0x57')]=_0x21a9b3;return _0x42dbc7;})['then'](respondWithFilteredResult(_0x5e8475,_0x4c4d41))['catch'](handleError(_0x5e8475,null));};exports['show']=function(_0x947d97,_0x598a8e){var _0x2a2a6b={'raw':!![],'where':{'id':_0x947d97[_0xe84b('0x58')]['id']}},_0x3b8efb={};_0x3b8efb[_0xe84b('0x41')]=_[_0xe84b('0x43')](db[_0xe84b('0x3e')]['rawAttributes']);_0x3b8efb['query']=_['keys'](_0x947d97[_0xe84b('0x42')]);_0x3b8efb['filters']=_[_0xe84b('0x45')](_0x3b8efb['model'],_0x3b8efb[_0xe84b('0x42')]);_0x2a2a6b[_0xe84b('0x46')]=_['intersection'](_0x3b8efb[_0xe84b('0x41')],qs[_0xe84b('0x47')](_0x947d97['query']['fields']));_0x2a2a6b['attributes']=_0x2a2a6b['attributes'][_0xe84b('0x59')]?_0x2a2a6b[_0xe84b('0x46')]:_0x3b8efb[_0xe84b('0x41')];if(_0x947d97[_0xe84b('0x42')][_0xe84b('0x54')]){_0x2a2a6b[_0xe84b('0x55')]=[{'all':!![]}];}_0x2a2a6b=_[_0xe84b('0x4f')]({},_0x2a2a6b,_0x947d97[_0xe84b('0x53')]);return db[_0xe84b('0x3e')][_0xe84b('0x5a')](_0x2a2a6b)['then'](handleEntityNotFound(_0x598a8e,null))[_0xe84b('0x38')](respondWithResult(_0x598a8e,null))[_0xe84b('0x2d')](handleError(_0x598a8e,null));};exports[_0xe84b('0x5b')]=function(_0x516e58,_0x28df3b){return db['ChatMessage'][_0xe84b('0x5b')](_0x516e58['body'],{})[_0xe84b('0x38')](respondWithResult(_0x28df3b,0xc9))[_0xe84b('0x2d')](handleError(_0x28df3b,null));};exports[_0xe84b('0x37')]=function(_0x426970,_0x228598){if(_0x426970[_0xe84b('0x5c')]['id']){delete _0x426970[_0xe84b('0x5c')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x426970[_0xe84b('0x58')]['id']}})['then'](handleEntityNotFound(_0x228598,null))[_0xe84b('0x38')](saveUpdates(_0x426970['body'],null))['then'](respondWithResult(_0x228598,null))[_0xe84b('0x2d')](handleError(_0x228598,null));};exports['destroy']=function(_0x36b9e2,_0x124491){return db[_0xe84b('0x3e')][_0xe84b('0x5a')]({'where':{'id':_0x36b9e2[_0xe84b('0x58')]['id']}})[_0xe84b('0x38')](handleEntityNotFound(_0x124491,null))[_0xe84b('0x38')](removeEntity(_0x124491,null))[_0xe84b('0x2d')](handleError(_0x124491,null));};exports[_0xe84b('0x5d')]=function(_0x5b8b7d,_0x503191){return db[_0xe84b('0x3e')][_0xe84b('0x5d')]()[_0xe84b('0x38')](respondWithResult(_0x503191,null))[_0xe84b('0x2d')](handleError(_0x503191,null));};var interaction_log=require(_0xe84b('0x5e'))(_0xe84b('0x5f'));exports[_0xe84b('0x60')]=function(_0x1499af,_0x3e2fdb,_0x347c2c){var _0x905217={'agent':{},'channel':_0xe84b('0x61')};if(_0x1499af[_0xe84b('0x5c')]['id']){delete _0x1499af['body']['id'];}_0x1499af[_0xe84b('0x5c')][_0xe84b('0x62')]=!![];_0x1499af['body']['readAt']=moment()[_0xe84b('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x1499af[_0xe84b('0x5c')][_0xe84b('0x64')]=_0x1499af[_0xe84b('0x5c')][_0xe84b('0x64')]||_0x1499af[_0xe84b('0x65')]['id'];_0x905217[_0xe84b('0x66')]['id']=_0x1499af[_0xe84b('0x5c')][_0xe84b('0x64')];return db[_0xe84b('0x3e')][_0xe84b('0x5a')]({'where':{'id':_0x1499af[_0xe84b('0x58')]['id'],'UserId':null},'include':[{'model':db[_0xe84b('0x67')],'as':_0xe84b('0x68')}]})[_0xe84b('0x38')](handleEntityNotFound(_0x3e2fdb,null))['then'](saveUpdates(_0x1499af['body'],null))[_0xe84b('0x38')](function(_0x120d5d){if(_0x120d5d){_0x905217[_0xe84b('0x2b')]=_0x120d5d[_0xe84b('0x69')]({'plain':!![]});return db[_0xe84b('0x6a')]['find']({'where':{'id':_0x120d5d[_0xe84b('0x6b')]}});}return null;})[_0xe84b('0x38')](handleEntityNotFound(_0x3e2fdb,null))[_0xe84b('0x38')](function(_0x43159f){if(_0x43159f){return _0x43159f['update']({'UserId':_0x1499af['body'][_0xe84b('0x64')],'read1stAt':_[_0xe84b('0x6c')](_0x43159f[_0xe84b('0x6d')])?moment()[_0xe84b('0x63')](_0xe84b('0x6e')):undefined});}return null;})[_0xe84b('0x38')](function(_0x28fc1c){if(_0x28fc1c){_0x905217[_0xe84b('0x6f')]=_0x28fc1c[_0xe84b('0x69')]({'plain':!![]});interaction_log[_0xe84b('0x23')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1499af[_0xe84b('0x65')]['id'],_0x1499af[_0xe84b('0x65')][_0xe84b('0x3b')],_0x1499af['user'][_0xe84b('0x70')],_0x905217[_0xe84b('0x6f')]['id'],_0x1499af[_0xe84b('0x5c')]?JSON[_0xe84b('0x28')](_0x1499af[_0xe84b('0x5c')]):'null');return respondWithRpcPromise('AcceptMessage',_0xe84b('0x71'),_0x905217);}return null;})[_0xe84b('0x38')](function(_0x312e9){if(_0x312e9){if(_0x1499af[_0xe84b('0x5c')][_0xe84b('0x72')]){_0x905217['message'][_0xe84b('0x73')]=util[_0xe84b('0x63')]('SIP/%s',_0x1499af[_0xe84b('0x65')]['name']);_0x905217[_0xe84b('0x2b')][_0xe84b('0x74')]=_0x905217[_0xe84b('0x74')];_0x905217[_0xe84b('0x2b')][_0xe84b('0x75')]=_0xe84b('0x60');return respondWithRpcPromise(_0xe84b('0x76'),_0xe84b('0x76'),{'event':_0xe84b('0x77'),'message':_['merge'](_0x905217['message'],JSON['parse'](_0x905217[_0xe84b('0x6f')][_0xe84b('0x78')]))},client9002)['then'](function(){return _0x905217;});}return _0x905217;}return null;})[_0xe84b('0x38')](respondWithResult(_0x3e2fdb,null))[_0xe84b('0x2d')](handleError(_0x3e2fdb,null));};var interaction_log=require('../../config/logger')(_0xe84b('0x5f'));exports[_0xe84b('0x79')]=function(_0x1d406a,_0x31cf2d,_0x2b6ac6){var _0x1b9432={'agent':{},'channel':'chat'};if(_0x1d406a[_0xe84b('0x5c')]['id']){delete _0x1d406a[_0xe84b('0x5c')]['id'];}_0x1d406a['body'][_0xe84b('0x64')]=_0x1d406a[_0xe84b('0x5c')][_0xe84b('0x64')]||_0x1d406a[_0xe84b('0x65')]['id'];_0x1b9432[_0xe84b('0x66')]['id']=_0x1d406a[_0xe84b('0x5c')][_0xe84b('0x64')];return db[_0xe84b('0x3e')][_0xe84b('0x5a')]({'where':{'id':_0x1d406a[_0xe84b('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x31cf2d,null))['then'](function(_0x157fa5){if(_0x157fa5){_0x1b9432[_0xe84b('0x2b')]=_0x157fa5[_0xe84b('0x69')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x157fa5[_0xe84b('0x6b')]}});}return null;})[_0xe84b('0x38')](handleEntityNotFound(_0x31cf2d,null))[_0xe84b('0x38')](function(_0x4f3405){if(_0x4f3405){_0x1b9432[_0xe84b('0x6f')]=_0x4f3405[_0xe84b('0x69')]({'plain':!![]});interaction_log['info'](_0xe84b('0x7a'),_0x1d406a[_0xe84b('0x65')]['id'],_0x1d406a[_0xe84b('0x65')][_0xe84b('0x3b')],_0x1d406a[_0xe84b('0x65')]['role'],_0x1b9432[_0xe84b('0x6f')]['id'],_0x1d406a[_0xe84b('0x5c')]?JSON['stringify'](_0x1d406a['body']):_0xe84b('0x7b'));return respondWithRpcPromise(_0xe84b('0x7c'),_0xe84b('0x7d'),_0x1b9432);}return null;})[_0xe84b('0x38')](function(_0x1f87ac){if(_0x1f87ac){_0x1f87ac[_0xe84b('0x2b')]['interface']=util[_0xe84b('0x63')](_0xe84b('0x7e'),_0x1d406a[_0xe84b('0x65')]['name']);_0x1f87ac[_0xe84b('0x2b')][_0xe84b('0x74')]=_0x1b9432['channel'];_0x1f87ac[_0xe84b('0x2b')][_0xe84b('0x75')]=_0xe84b('0x79');respondWithRpcPromise(_0xe84b('0x76'),_0xe84b('0x76'),{'event':_0xe84b('0x7f'),'message':_0x1f87ac[_0xe84b('0x2b')]},client9002);return _0x1b9432;}return null;})[_0xe84b('0x38')](respondWithResult(_0x31cf2d,null))[_0xe84b('0x2d')](handleError(_0x31cf2d,null));}; \ No newline at end of file +var _0xf6ef=['find','create','body','params','destroy','describe','chat-interactions','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','ChatInteractionId','isNil','read1stAt','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','status','json','count','set','Content-Range','apply','reject','save','update','end','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','offset','order','sort','where','pick','type','VIRTUAL','merge','options','ChatMessage','includeAll','include','rows','show','rawAttributes'];(function(_0x25955a,_0x1383b3){var _0x2a6aca=function(_0x555130){while(--_0x555130){_0x25955a['push'](_0x25955a['shift']());}};_0x2a6aca(++_0x1383b3);}(_0xf6ef,0x117));var _0xff6e=function(_0x363dee,_0x4d1a44){_0x363dee=_0x363dee-0x0;var _0x31ae44=_0xf6ef[_0x363dee];return _0x31ae44;};'use strict';var pdf=require(_0xff6e('0x0'));var emlformat=require(_0xff6e('0x1'));var rimraf=require(_0xff6e('0x2'));var zipdir=require(_0xff6e('0x3'));var jsonpatch=require(_0xff6e('0x4'));var rp=require(_0xff6e('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xff6e('0x6'));var util=require(_0xff6e('0x7'));var path=require(_0xff6e('0x8'));var sox=require(_0xff6e('0x9'));var csv=require(_0xff6e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xff6e('0xb'));var _=require('lodash');var squel=require(_0xff6e('0xc'));var crypto=require('crypto');var jsforce=require(_0xff6e('0xd'));var deskjs=require(_0xff6e('0xe'));var toCsv=require('to-csv');var querystring=require(_0xff6e('0xf'));var Papa=require('papaparse');var Redis=require(_0xff6e('0x10'));var authService=require(_0xff6e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xff6e('0x12'));var hardwareService=require(_0xff6e('0x13'));var logger=require(_0xff6e('0x14'))(_0xff6e('0x15'));var utils=require(_0xff6e('0x16'));var config=require(_0xff6e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xff6e('0x18'))['db'];config[_0xff6e('0x19')]=_[_0xff6e('0x1a')](config[_0xff6e('0x19')],{'host':_0xff6e('0x1b'),'port':0x18eb});var socket=require(_0xff6e('0x1c'))(new Redis(config[_0xff6e('0x19')]));require(_0xff6e('0x1d'))[_0xff6e('0x1e')](socket);var jayson=require(_0xff6e('0x1f'));var client=jayson[_0xff6e('0x20')][_0xff6e('0x21')]({'port':0x232c});var client9002=jayson[_0xff6e('0x20')][_0xff6e('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x5402f5,_0x534668,_0x74e08a,_0x427094){return new BPromise(function(_0x944ba6,_0x6d211a){var _0x9469be=_0x427094||client;return _0x9469be[_0xff6e('0x22')](_0x5402f5,_0x74e08a)[_0xff6e('0x23')](function(_0x249755){logger[_0xff6e('0x24')](_0xff6e('0x25'),_0x534668,'request\x20sent');logger[_0xff6e('0x26')](_0xff6e('0x27'),_0x534668,_0xff6e('0x28'),JSON['stringify'](_0x249755));if(_0x249755[_0xff6e('0x29')]){if(_0x249755[_0xff6e('0x29')]['code']===0x1f4){logger[_0xff6e('0x29')](_0xff6e('0x25'),_0x534668,_0x249755[_0xff6e('0x29')][_0xff6e('0x2a')]);return _0x6d211a(_0x249755[_0xff6e('0x29')][_0xff6e('0x2a')]);}logger[_0xff6e('0x29')]('ChatMessage,\x20%s,\x20%s',_0x534668,_0x249755[_0xff6e('0x29')][_0xff6e('0x2a')]);return _0x944ba6(_0x249755[_0xff6e('0x29')][_0xff6e('0x2a')]);}else{logger[_0xff6e('0x24')](_0xff6e('0x25'),_0x534668,_0xff6e('0x28'));_0x944ba6(_0x249755[_0xff6e('0x2b')][_0xff6e('0x2a')]);}})[_0xff6e('0x2c')](function(_0x3d0515){logger[_0xff6e('0x29')](_0xff6e('0x25'),_0x534668,_0x3d0515);_0x6d211a(_0x3d0515);});});}function respondWithStatusCode(_0x1d818e,_0x4ab195){_0x4ab195=_0x4ab195||0xcc;return function(_0x373efe){if(_0x373efe){return _0x1d818e[_0xff6e('0x2d')](_0x4ab195);}return _0x1d818e[_0xff6e('0x2e')](_0x4ab195)['end']();};}function respondWithResult(_0xdf7c1f,_0x5e3e56){_0x5e3e56=_0x5e3e56||0xc8;return function(_0x1b0b04){if(_0x1b0b04){return _0xdf7c1f[_0xff6e('0x2e')](_0x5e3e56)[_0xff6e('0x2f')](_0x1b0b04);}};}function respondWithFilteredResult(_0x47ef4c,_0x24a339){return function(_0x57829f){if(_0x57829f){var _0x3d148c=_0x57829f[_0xff6e('0x30')],_0x2dd7bf=_0x24a339['offset'],_0x4df50b=_0x24a339['offset']+_0x24a339['limit'],_0x1043f4;if(_0x4df50b>=_0x3d148c){_0x4df50b=_0x3d148c;_0x1043f4=0xc8;}else{_0x1043f4=0xce;}_0x47ef4c[_0xff6e('0x2e')](_0x1043f4);return _0x47ef4c[_0xff6e('0x31')](_0xff6e('0x32'),_0x2dd7bf+'-'+_0x4df50b+'/'+_0x3d148c)[_0xff6e('0x2f')](_0x57829f);}return null;};}function patchUpdates(_0x2be4e6){return function(_0x4c050e){try{jsonpatch[_0xff6e('0x33')](_0x4c050e,_0x2be4e6,!![]);}catch(_0x5bc304){return BPromise[_0xff6e('0x34')](_0x5bc304);}return _0x4c050e[_0xff6e('0x35')]();};}function saveUpdates(_0x50fdca,_0x17c717){return function(_0x150a08){if(_0x150a08){return _0x150a08[_0xff6e('0x36')](_0x50fdca)[_0xff6e('0x23')](function(_0x534260){return _0x534260;});}return null;};}function removeEntity(_0x4b7b23,_0x31a48b){return function(_0x476bcc){if(_0x476bcc){return _0x476bcc['destroy']()[_0xff6e('0x23')](function(){_0x4b7b23[_0xff6e('0x2e')](0xcc)[_0xff6e('0x37')]();});}};}function handleEntityNotFound(_0x2f1b50,_0x209378){return function(_0x1449f7){if(!_0x1449f7){_0x2f1b50[_0xff6e('0x2d')](0x194);}return _0x1449f7;};}function handleError(_0x5cdeb0,_0x212534){_0x212534=_0x212534||0x1f4;return function(_0x19c1e0){logger['error'](_0x19c1e0[_0xff6e('0x38')]);if(_0x19c1e0[_0xff6e('0x39')]){delete _0x19c1e0[_0xff6e('0x39')];}_0x5cdeb0[_0xff6e('0x2e')](_0x212534)[_0xff6e('0x3a')](_0x19c1e0);};}exports[_0xff6e('0x3b')]=function(_0x426d9a,_0x5648e6){var _0x13b04a={},_0x2466ee={},_0x807d73={'count':0x0,'rows':[]};var _0x52ec12=_[_0xff6e('0x3c')](db['ChatMessage']['rawAttributes'],function(_0x240a64){return{'name':_0x240a64[_0xff6e('0x3d')],'type':_0x240a64['type'][_0xff6e('0x3e')]};});_0x2466ee[_0xff6e('0x3f')]=_[_0xff6e('0x3c')](_0x52ec12,_0xff6e('0x39'));_0x2466ee[_0xff6e('0x40')]=_[_0xff6e('0x41')](_0x426d9a[_0xff6e('0x40')]);_0x2466ee[_0xff6e('0x42')]=_[_0xff6e('0x43')](_0x2466ee['model'],_0x2466ee[_0xff6e('0x40')]);_0x13b04a['attributes']=_[_0xff6e('0x43')](_0x2466ee[_0xff6e('0x3f')],qs['fields'](_0x426d9a[_0xff6e('0x40')][_0xff6e('0x44')]));_0x13b04a['attributes']=_0x13b04a[_0xff6e('0x45')][_0xff6e('0x46')]?_0x13b04a[_0xff6e('0x45')]:_0x2466ee['model'];if(!_0x426d9a['query'][_0xff6e('0x47')]('nolimit')){_0x13b04a['limit']=qs['limit'](_0x426d9a[_0xff6e('0x40')]['limit']);_0x13b04a[_0xff6e('0x48')]=qs[_0xff6e('0x48')](_0x426d9a['query'][_0xff6e('0x48')]);}_0x13b04a[_0xff6e('0x49')]=qs['sort'](_0x426d9a['query'][_0xff6e('0x4a')]);_0x13b04a[_0xff6e('0x4b')]=qs[_0xff6e('0x42')](_[_0xff6e('0x4c')](_0x426d9a[_0xff6e('0x40')],_0x2466ee['filters']),_0x52ec12);if(_0x426d9a[_0xff6e('0x40')]['filter']){_0x13b04a[_0xff6e('0x4b')]=_['merge'](_0x13b04a[_0xff6e('0x4b')],{'$or':_[_0xff6e('0x3c')](_0x52ec12,function(_0x558985){if(_0x558985[_0xff6e('0x4d')]!==_0xff6e('0x4e')){var _0x563c10={};_0x563c10[_0x558985[_0xff6e('0x39')]]={'$like':'%'+_0x426d9a[_0xff6e('0x40')]['filter']+'%'};return _0x563c10;}})});}_0x13b04a=_[_0xff6e('0x4f')]({},_0x13b04a,_0x426d9a[_0xff6e('0x50')]);var _0xe738ac={'where':_0x13b04a['where']};return db[_0xff6e('0x51')][_0xff6e('0x30')](_0xe738ac)[_0xff6e('0x23')](function(_0x32ce63){_0x807d73['count']=_0x32ce63;if(_0x426d9a[_0xff6e('0x40')][_0xff6e('0x52')]){_0x13b04a[_0xff6e('0x53')]=[{'all':!![]}];}return db[_0xff6e('0x51')]['findAll'](_0x13b04a);})['then'](function(_0x1559b0){_0x807d73[_0xff6e('0x54')]=_0x1559b0;return _0x807d73;})[_0xff6e('0x23')](respondWithFilteredResult(_0x5648e6,_0x13b04a))[_0xff6e('0x2c')](handleError(_0x5648e6,null));};exports[_0xff6e('0x55')]=function(_0x322bf1,_0x5d96c6){var _0x52111b={'raw':!![],'where':{'id':_0x322bf1['params']['id']}},_0x5efc87={};_0x5efc87[_0xff6e('0x3f')]=_[_0xff6e('0x41')](db['ChatMessage'][_0xff6e('0x56')]);_0x5efc87[_0xff6e('0x40')]=_['keys'](_0x322bf1[_0xff6e('0x40')]);_0x5efc87[_0xff6e('0x42')]=_[_0xff6e('0x43')](_0x5efc87[_0xff6e('0x3f')],_0x5efc87[_0xff6e('0x40')]);_0x52111b[_0xff6e('0x45')]=_[_0xff6e('0x43')](_0x5efc87[_0xff6e('0x3f')],qs[_0xff6e('0x44')](_0x322bf1[_0xff6e('0x40')][_0xff6e('0x44')]));_0x52111b['attributes']=_0x52111b['attributes'][_0xff6e('0x46')]?_0x52111b[_0xff6e('0x45')]:_0x5efc87[_0xff6e('0x3f')];if(_0x322bf1[_0xff6e('0x40')][_0xff6e('0x52')]){_0x52111b[_0xff6e('0x53')]=[{'all':!![]}];}_0x52111b=_[_0xff6e('0x4f')]({},_0x52111b,_0x322bf1['options']);return db['ChatMessage'][_0xff6e('0x57')](_0x52111b)['then'](handleEntityNotFound(_0x5d96c6,null))[_0xff6e('0x23')](respondWithResult(_0x5d96c6,null))['catch'](handleError(_0x5d96c6,null));};exports[_0xff6e('0x58')]=function(_0x157d52,_0x25191c){return db[_0xff6e('0x51')][_0xff6e('0x58')](_0x157d52[_0xff6e('0x59')],{})['then'](respondWithResult(_0x25191c,0xc9))[_0xff6e('0x2c')](handleError(_0x25191c,null));};exports[_0xff6e('0x36')]=function(_0x16cafa,_0x9035c1){if(_0x16cafa['body']['id']){delete _0x16cafa[_0xff6e('0x59')]['id'];}return db['ChatMessage'][_0xff6e('0x57')]({'where':{'id':_0x16cafa[_0xff6e('0x5a')]['id']}})[_0xff6e('0x23')](handleEntityNotFound(_0x9035c1,null))[_0xff6e('0x23')](saveUpdates(_0x16cafa['body'],null))[_0xff6e('0x23')](respondWithResult(_0x9035c1,null))[_0xff6e('0x2c')](handleError(_0x9035c1,null));};exports[_0xff6e('0x5b')]=function(_0x4c9c4f,_0x2bda50){return db['ChatMessage']['find']({'where':{'id':_0x4c9c4f[_0xff6e('0x5a')]['id']}})[_0xff6e('0x23')](handleEntityNotFound(_0x2bda50,null))[_0xff6e('0x23')](removeEntity(_0x2bda50,null))[_0xff6e('0x2c')](handleError(_0x2bda50,null));};exports[_0xff6e('0x5c')]=function(_0x34a85a,_0x76ac30){return db[_0xff6e('0x51')][_0xff6e('0x5c')]()[_0xff6e('0x23')](respondWithResult(_0x76ac30,null))[_0xff6e('0x2c')](handleError(_0x76ac30,null));};var interaction_log=require('../../config/logger')(_0xff6e('0x5d'));exports['accept']=function(_0x4db775,_0x4c2dc4,_0x4b6920){var _0x3a55fd={'agent':{},'channel':_0xff6e('0x5e')};if(_0x4db775[_0xff6e('0x59')]['id']){delete _0x4db775[_0xff6e('0x59')]['id'];}_0x4db775['body']['read']=!![];_0x4db775[_0xff6e('0x59')][_0xff6e('0x5f')]=moment()[_0xff6e('0x60')](_0xff6e('0x61'));_0x4db775[_0xff6e('0x59')][_0xff6e('0x62')]=_0x4db775['body']['UserId']||_0x4db775[_0xff6e('0x63')]['id'];_0x3a55fd[_0xff6e('0x64')]['id']=_0x4db775[_0xff6e('0x59')][_0xff6e('0x62')];return db[_0xff6e('0x51')][_0xff6e('0x57')]({'where':{'id':_0x4db775[_0xff6e('0x5a')]['id'],'UserId':null},'include':[{'model':db[_0xff6e('0x65')],'as':_0xff6e('0x66')}]})[_0xff6e('0x23')](handleEntityNotFound(_0x4c2dc4,null))[_0xff6e('0x23')](saveUpdates(_0x4db775['body'],null))['then'](function(_0x4bbea3){if(_0x4bbea3){_0x3a55fd[_0xff6e('0x2a')]=_0x4bbea3['get']({'plain':!![]});return db['ChatInteraction'][_0xff6e('0x57')]({'where':{'id':_0x4bbea3[_0xff6e('0x67')]}});}return null;})[_0xff6e('0x23')](handleEntityNotFound(_0x4c2dc4,null))['then'](function(_0x1399c4){if(_0x1399c4){return _0x1399c4[_0xff6e('0x36')]({'UserId':_0x4db775[_0xff6e('0x59')][_0xff6e('0x62')],'read1stAt':_[_0xff6e('0x68')](_0x1399c4[_0xff6e('0x69')])?moment()[_0xff6e('0x60')](_0xff6e('0x61')):undefined});}return null;})['then'](function(_0x4399cb){if(_0x4399cb){_0x3a55fd[_0xff6e('0x6a')]=_0x4399cb[_0xff6e('0x6b')]({'plain':!![]});interaction_log[_0xff6e('0x24')](_0xff6e('0x6c'),_0x4db775[_0xff6e('0x63')]['id'],_0x4db775['user'][_0xff6e('0x39')],_0x4db775[_0xff6e('0x63')][_0xff6e('0x6d')],_0x3a55fd[_0xff6e('0x6a')]['id'],_0x4db775[_0xff6e('0x59')]?JSON[_0xff6e('0x6e')](_0x4db775[_0xff6e('0x59')]):_0xff6e('0x6f'));return respondWithRpcPromise(_0xff6e('0x70'),_0xff6e('0x71'),_0x3a55fd);}return null;})[_0xff6e('0x23')](function(_0x28894c){if(_0x28894c){if(_0x4db775[_0xff6e('0x59')][_0xff6e('0x72')]){_0x3a55fd[_0xff6e('0x2a')][_0xff6e('0x73')]=util[_0xff6e('0x60')](_0xff6e('0x74'),_0x4db775[_0xff6e('0x63')][_0xff6e('0x39')]);_0x3a55fd[_0xff6e('0x2a')][_0xff6e('0x75')]=_0x3a55fd['channel'];_0x3a55fd[_0xff6e('0x2a')]['event']='accept';return respondWithRpcPromise(_0xff6e('0x76'),_0xff6e('0x76'),{'event':_0xff6e('0x77'),'message':_[_0xff6e('0x4f')](_0x3a55fd[_0xff6e('0x2a')],JSON['parse'](_0x3a55fd['interaction']['formData']))},client9002)['then'](function(){return _0x3a55fd;});}return _0x3a55fd;}return null;})[_0xff6e('0x23')](respondWithResult(_0x4c2dc4,null))[_0xff6e('0x2c')](handleError(_0x4c2dc4,null));};var interaction_log=require('../../config/logger')(_0xff6e('0x5d'));exports[_0xff6e('0x34')]=function(_0x22b435,_0x45ad88,_0x398c78){var _0x1c071b={'agent':{},'channel':_0xff6e('0x5e')};if(_0x22b435[_0xff6e('0x59')]['id']){delete _0x22b435['body']['id'];}_0x22b435[_0xff6e('0x59')][_0xff6e('0x62')]=_0x22b435[_0xff6e('0x59')][_0xff6e('0x62')]||_0x22b435[_0xff6e('0x63')]['id'];_0x1c071b[_0xff6e('0x64')]['id']=_0x22b435[_0xff6e('0x59')][_0xff6e('0x62')];return db[_0xff6e('0x51')][_0xff6e('0x57')]({'where':{'id':_0x22b435[_0xff6e('0x5a')]['id'],'UserId':null}})[_0xff6e('0x23')](handleEntityNotFound(_0x45ad88,null))[_0xff6e('0x23')](function(_0xe5acdb){if(_0xe5acdb){_0x1c071b[_0xff6e('0x2a')]=_0xe5acdb[_0xff6e('0x6b')]({'plain':!![]});return db['ChatInteraction'][_0xff6e('0x57')]({'where':{'id':_0xe5acdb['ChatInteractionId']}});}return null;})[_0xff6e('0x23')](handleEntityNotFound(_0x45ad88,null))[_0xff6e('0x23')](function(_0x2f5a67){if(_0x2f5a67){_0x1c071b[_0xff6e('0x6a')]=_0x2f5a67['get']({'plain':!![]});interaction_log[_0xff6e('0x24')](_0xff6e('0x78'),_0x22b435[_0xff6e('0x63')]['id'],_0x22b435[_0xff6e('0x63')]['name'],_0x22b435[_0xff6e('0x63')]['role'],_0x1c071b[_0xff6e('0x6a')]['id'],_0x22b435[_0xff6e('0x59')]?JSON[_0xff6e('0x6e')](_0x22b435[_0xff6e('0x59')]):_0xff6e('0x6f'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x1c071b);}return null;})[_0xff6e('0x23')](function(_0x33cf2e){if(_0x33cf2e){_0x33cf2e['message'][_0xff6e('0x73')]=util[_0xff6e('0x60')](_0xff6e('0x74'),_0x22b435[_0xff6e('0x63')]['name']);_0x33cf2e[_0xff6e('0x2a')][_0xff6e('0x75')]=_0x1c071b[_0xff6e('0x75')];_0x33cf2e[_0xff6e('0x2a')]['event']=_0xff6e('0x34');respondWithRpcPromise(_0xff6e('0x76'),_0xff6e('0x76'),{'event':_0xff6e('0x79'),'message':_0x33cf2e[_0xff6e('0x2a')]},client9002);return _0x1c071b;}return null;})['then'](respondWithResult(_0x45ad88,null))[_0xff6e('0x2c')](handleError(_0x45ad88,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 134122d..92db6d8 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 _0x617a=['../../mysqldb','ChatMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x617a,0x1d5));var _0xa617=function(_0x57056c,_0x12c8a1){_0x57056c=_0x57056c-0x0;var _0xb624a2=_0x617a[_0x57056c];return _0xb624a2;};'use strict';var EventEmitter=require(_0xa617('0x0'));var ChatMessage=require(_0xa617('0x1'))['db'][_0xa617('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xa617('0x3')](0x0);var events={'afterCreate':_0xa617('0x4'),'afterUpdate':_0xa617('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2ef7f6){return function(_0x50c14e,_0x1ea186,_0xe6a50e){ChatMessageEvents[_0xa617('0x6')](_0x2ef7f6+':'+_0x50c14e['id'],_0x50c14e);ChatMessageEvents[_0xa617('0x6')](_0x2ef7f6,_0x50c14e);_0xe6a50e(null);};}for(var e in events){if(events[_0xa617('0x7')](e)){var event=events[e];ChatMessage[_0xa617('0x8')](e,emitEvent(event));}}module[_0xa617('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0x3405=['exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x39450b,_0x529781){var _0x143a51=function(_0x183343){while(--_0x183343){_0x39450b['push'](_0x39450b['shift']());}};_0x143a51(++_0x529781);}(_0x3405,0x6f));var _0x5340=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x3405[_0x45d3f0];return _0x314b79;};'use strict';var EventEmitter=require(_0x5340('0x0'));var ChatMessage=require(_0x5340('0x1'))['db'][_0x5340('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x5340('0x3')](0x0);var events={'afterCreate':_0x5340('0x4'),'afterUpdate':'update','afterDestroy':_0x5340('0x5')};function emitEvent(_0x262236){return function(_0x5f4a3f,_0x5ed5d0,_0x90ba79){ChatMessageEvents[_0x5340('0x6')](_0x262236+':'+_0x5f4a3f['id'],_0x5f4a3f);ChatMessageEvents[_0x5340('0x6')](_0x262236,_0x5f4a3f);_0x90ba79(null);};}for(var e in events){if(events[_0x5340('0x7')](e)){var event=events[e];ChatMessage[_0x5340('0x8')](e,emitEvent(event));}}module[_0x5340('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 8f5f04c..6fe2d24 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 _0x6e26=['secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','rimraf','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','get','direction','toLowerCase','out'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6e26,0x1e8));var _0x66e2=function(_0xfb3207,_0x35029b){_0xfb3207=_0xfb3207-0x0;var _0x1d3a4b=_0x6e26[_0xfb3207];return _0x1d3a4b;};'use strict';var _=require('lodash');var util=require(_0x66e2('0x0'));var logger=require('../../config/logger')(_0x66e2('0x1'));var moment=require(_0x66e2('0x2'));var BPromise=require(_0x66e2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x66e2('0x4'));var config=require('../../config/environment');var attributes=require(_0x66e2('0x5'));module[_0x66e2('0x6')]=function(_0x4f5e61,_0x2cca4c){return _0x4f5e61[_0x66e2('0x7')](_0x66e2('0x8'),attributes,{'tableName':_0x66e2('0x9'),'paranoid':![],'indexes':[{'name':_0x66e2('0xa'),'fields':['body'],'type':_0x66e2('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x382fe7,_0x252702,_0x7a5b80){var _0x37592b=_0x4f5e61['models'];var _0x4f2dd8=_0x382fe7[_0x66e2('0xc')]({'plain':!![]});if(_0x4f2dd8[_0x66e2('0xd')][_0x66e2('0xe')]()==='in'||_0x4f2dd8['direction'][_0x66e2('0xe')]()===_0x66e2('0xf')&&!_0x4f2dd8[_0x66e2('0x10')]&&!_[_0x66e2('0x11')](_0x4f2dd8[_0x66e2('0x12')])){_0x37592b[_0x66e2('0x13')][_0x66e2('0x14')]({'where':{'id':_0x4f2dd8[_0x66e2('0x15')]}})[_0x66e2('0x16')](function(_0x353882){if(_0x353882){_0x353882[_0x66e2('0x17')]({'lastMsgAt':_0x4f2dd8['createdAt'],'lastMsgDirection':_0x4f2dd8[_0x66e2('0xd')][_0x66e2('0xe')]()});}})[_0x66e2('0x18')](function(_0x375ba2){console[_0x66e2('0x19')](_0x375ba2);});}_0x7a5b80();}},'charset':_0x66e2('0x1a'),'collate':_0x66e2('0x1b')});}; \ No newline at end of file +var _0x482c=['exports','ChatMessage','chat_messages','fti_chat_messages','models','get','toLowerCase','direction','out','isNil','ChatInteractionId','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','./chatMessage.attributes'];(function(_0x16987d,_0x566f27){var _0x48b8a4=function(_0x396cad){while(--_0x396cad){_0x16987d['push'](_0x16987d['shift']());}};_0x48b8a4(++_0x566f27);}(_0x482c,0x10c));var _0xc482=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x482c[_0x3054be];return _0x3df150;};'use strict';var _=require(_0xc482('0x0'));var util=require(_0xc482('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc482('0x2'));var BPromise=require(_0xc482('0x3'));var rp=require(_0xc482('0x4'));var fs=require('fs');var path=require(_0xc482('0x5'));var rimraf=require(_0xc482('0x6'));var config=require('../../config/environment');var attributes=require(_0xc482('0x7'));module[_0xc482('0x8')]=function(_0xa773f1,_0x271dd9){return _0xa773f1['define'](_0xc482('0x9'),attributes,{'tableName':_0xc482('0xa'),'paranoid':![],'indexes':[{'name':_0xc482('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x342b76,_0x1ac7a7,_0x1fcfaa){var _0x16ed5c=_0xa773f1[_0xc482('0xc')];var _0x29a7e4=_0x342b76[_0xc482('0xd')]({'plain':!![]});if(_0x29a7e4['direction'][_0xc482('0xe')]()==='in'||_0x29a7e4[_0xc482('0xf')]['toLowerCase']()===_0xc482('0x10')&&!_0x29a7e4['secret']&&!_[_0xc482('0x11')](_0x29a7e4['UserId'])){_0x16ed5c['ChatInteraction']['findOne']({'where':{'id':_0x29a7e4[_0xc482('0x12')]}})['then'](function(_0x280a96){if(_0x280a96){_0x280a96[_0xc482('0x13')]({'lastMsgAt':_0x29a7e4['createdAt'],'lastMsgDirection':_0x29a7e4[_0xc482('0xf')][_0xc482('0xe')]()});}})[_0xc482('0x14')](function(_0x5c95e8){console['error'](_0x5c95e8);});}_0x1fcfaa();}},'charset':_0xc482('0x15'),'collate':_0xc482('0x16')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 7c3de6f..9f151c1 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 _0x876e=['stringify','error','code','message','ChatMessage,\x20%s,\x20%s','catch','create','body','options','raw','CreateChatMessage','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','./chatMessage.socket','register','then','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s'];(function(_0x1da608,_0x52ac77){var _0x50194a=function(_0x1f3a60){while(--_0x1f3a60){_0x1da608['push'](_0x1da608['shift']());}};_0x50194a(++_0x52ac77);}(_0x876e,0x14f));var _0xe876=function(_0x33ac03,_0x482fd3){_0x33ac03=_0x33ac03-0x0;var _0x37f7c1=_0x876e[_0x33ac03];return _0x37f7c1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe876('0x0'));var rs=require(_0xe876('0x1'));var fs=require('fs');var Redis=require(_0xe876('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe876('0x3'));var logger=require(_0xe876('0x4'))('rpc');var config=require(_0xe876('0x5'));var jayson=require(_0xe876('0x6'));var client=jayson[_0xe876('0x7')]['http']({'port':0x232a});config[_0xe876('0x8')]=_['defaults'](config[_0xe876('0x8')],{'host':_0xe876('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe876('0xa'))[_0xe876('0xb')](socket);function respondWithRpcPromise(_0x4021a3,_0x44aae1,_0x1ff938){return new BPromise(function(_0x4e4d09,_0x37721b){return client['request'](_0x4021a3,_0x1ff938)[_0xe876('0xc')](function(_0x49afbd){logger['info']('ChatMessage,\x20%s,\x20%s',_0x44aae1,_0xe876('0xd'));logger[_0xe876('0xe')](_0xe876('0xf'),_0x44aae1,_0xe876('0xd'),JSON[_0xe876('0x10')](_0x49afbd));if(_0x49afbd[_0xe876('0x11')]){if(_0x49afbd[_0xe876('0x11')][_0xe876('0x12')]===0x1f4){logger[_0xe876('0x11')]('ChatMessage,\x20%s,\x20%s',_0x44aae1,_0x49afbd[_0xe876('0x11')][_0xe876('0x13')]);return _0x37721b(_0x49afbd[_0xe876('0x11')][_0xe876('0x13')]);}logger[_0xe876('0x11')](_0xe876('0x14'),_0x44aae1,_0x49afbd['error']['message']);return _0x4e4d09(_0x49afbd[_0xe876('0x11')]['message']);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x44aae1,_0xe876('0xd'));_0x4e4d09(_0x49afbd['result']['message']);}})[_0xe876('0x15')](function(_0x39822a){logger['error']('ChatMessage,\x20%s,\x20%s',_0x44aae1,_0x39822a);_0x37721b(_0x39822a);});});}exports['CreateChatMessage']=function(_0x197a24){var _0x43d924=this;return new Promise(function(_0x3a6b93,_0x20553e){return db['ChatMessage'][_0xe876('0x16')](_0x197a24[_0xe876('0x17')],{'raw':_0x197a24[_0xe876('0x18')]?_0x197a24['options'][_0xe876('0x19')]===undefined?!![]:![]:!![]})[_0xe876('0xc')](function(_0x524dfd){logger['info'](_0xe876('0x1a'),_0x197a24);logger[_0xe876('0xe')](_0xe876('0x1a'),_0x197a24,JSON[_0xe876('0x10')](_0x524dfd));_0x3a6b93(_0x524dfd);})[_0xe876('0x15')](function(_0x30bb2e){logger[_0xe876('0x11')](_0xe876('0x1a'),_0x30bb2e[_0xe876('0x13')],_0x197a24);_0x20553e(_0x43d924['error'](0x1f4,_0x30bb2e[_0xe876('0x13')]));});});}; \ No newline at end of file +var _0x6625=['jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6625,0x107));var _0x5662=function(_0x3cc60f,_0x3411fe){_0x3cc60f=_0x3cc60f-0x0;var _0x283455=_0x6625[_0x3cc60f];return _0x283455;};'use strict';var _=require(_0x5662('0x0'));var util=require(_0x5662('0x1'));var moment=require(_0x5662('0x2'));var BPromise=require(_0x5662('0x3'));var rs=require(_0x5662('0x4'));var fs=require('fs');var Redis=require(_0x5662('0x5'));var db=require(_0x5662('0x6'))['db'];var utils=require(_0x5662('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x5662('0x8'));var jayson=require(_0x5662('0x9'));var client=jayson[_0x5662('0xa')][_0x5662('0xb')]({'port':0x232a});config[_0x5662('0xc')]=_[_0x5662('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5662('0xe'))(new Redis(config[_0x5662('0xc')]));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x4a6d16,_0x37ff4d,_0x4a0ea7){return new BPromise(function(_0x47e1ef,_0x568065){return client[_0x5662('0xf')](_0x4a6d16,_0x4a0ea7)[_0x5662('0x10')](function(_0xaa0c4){logger['info'](_0x5662('0x11'),_0x37ff4d,_0x5662('0x12'));logger[_0x5662('0x13')](_0x5662('0x14'),_0x37ff4d,_0x5662('0x12'),JSON['stringify'](_0xaa0c4));if(_0xaa0c4[_0x5662('0x15')]){if(_0xaa0c4['error'][_0x5662('0x16')]===0x1f4){logger['error'](_0x5662('0x11'),_0x37ff4d,_0xaa0c4[_0x5662('0x15')]['message']);return _0x568065(_0xaa0c4[_0x5662('0x15')][_0x5662('0x17')]);}logger[_0x5662('0x15')](_0x5662('0x11'),_0x37ff4d,_0xaa0c4[_0x5662('0x15')][_0x5662('0x17')]);return _0x47e1ef(_0xaa0c4[_0x5662('0x15')][_0x5662('0x17')]);}else{logger[_0x5662('0x18')](_0x5662('0x11'),_0x37ff4d,_0x5662('0x12'));_0x47e1ef(_0xaa0c4[_0x5662('0x19')]['message']);}})[_0x5662('0x1a')](function(_0x2974fe){logger[_0x5662('0x15')](_0x5662('0x11'),_0x37ff4d,_0x2974fe);_0x568065(_0x2974fe);});});}exports[_0x5662('0x1b')]=function(_0x462a3d){var _0x207b96=this;return new Promise(function(_0x3cc976,_0x2e82cb){return db[_0x5662('0x1c')][_0x5662('0x1d')](_0x462a3d[_0x5662('0x1e')],{'raw':_0x462a3d[_0x5662('0x1f')]?_0x462a3d[_0x5662('0x1f')][_0x5662('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x351dcb){logger[_0x5662('0x18')]('CreateChatMessage',_0x462a3d);logger[_0x5662('0x13')](_0x5662('0x1b'),_0x462a3d,JSON[_0x5662('0x21')](_0x351dcb));_0x3cc976(_0x351dcb);})['catch'](function(_0x103ad1){logger[_0x5662('0x15')](_0x5662('0x1b'),_0x103ad1[_0x5662('0x17')],_0x462a3d);_0x2e82cb(_0x207b96[_0x5662('0x15')](0x1f4,_0x103ad1[_0x5662('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 43064cf..e83a1f0 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 _0xacf4=['removeListener','register','length','remove','update','emit'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xacf4,0xe7));var _0x4acf=function(_0xbf99dd,_0x255ca3){_0xbf99dd=_0xbf99dd-0x0;var _0x3f173d=_0xacf4[_0xbf99dd];return _0x3f173d;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0x4acf('0x0'),_0x4acf('0x1')];function createListener(_0x1e2413,_0x21fb75){return function(_0x25709c){_0x21fb75[_0x4acf('0x2')](_0x1e2413,_0x25709c);};}function removeListener(_0x145264,_0x5cf22d){return function(){ChatMessageEvents[_0x4acf('0x3')](_0x145264,_0x5cf22d);};}exports[_0x4acf('0x4')]=function(_0x4e0c43){for(var _0x24bf24=0x0,_0x2ba08a=events[_0x4acf('0x5')];_0x24bf24<_0x2ba08a;_0x24bf24++){var _0x45a5a4=events[_0x24bf24];var _0x25d345=createListener('chatMessage:'+_0x45a5a4,_0x4e0c43);ChatMessageEvents['on'](_0x45a5a4,_0x25d345);}}; \ No newline at end of file +var _0xc1c6=['length','chatMessage:','./chatMessage.events','save','remove','emit','register'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x88ce76,_0x4dd709){_0x88ce76=_0x88ce76-0x0;var _0x46ad36=_0xc1c6[_0x88ce76];return _0x46ad36;};'use strict';var ChatMessageEvents=require(_0x6c1c('0x0'));var events=[_0x6c1c('0x1'),_0x6c1c('0x2'),'update'];function createListener(_0x114c93,_0x4c33ca){return function(_0x426398){_0x4c33ca[_0x6c1c('0x3')](_0x114c93,_0x426398);};}function removeListener(_0x265d2c,_0x59f799){return function(){ChatMessageEvents['removeListener'](_0x265d2c,_0x59f799);};}exports[_0x6c1c('0x4')]=function(_0x524a6b){for(var _0x50c1bb=0x0,_0x582bec=events[_0x6c1c('0x5')];_0x50c1bb<_0x582bec;_0x50c1bb++){var _0x2eb1ba=events[_0x50c1bb];var _0x38369d=createListener(_0x6c1c('0x6')+_0x2eb1ba,_0x524a6b);ChatMessageEvents['on'](_0x2eb1ba,_0x38369d);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index ba4bdd9..fe2eeba 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 _0x1152=['isAuthenticated','/:id','post','chat','chatmessage:create','create','put','/:id/accept','accept','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x550071,_0x9ba498){var _0x3c7b4c=function(_0x1e6cec){while(--_0x1e6cec){_0x550071['push'](_0x550071['shift']());}};_0x3c7b4c(++_0x9ba498);}(_0x1152,0x182));var _0x2115=function(_0x2af29a,_0x4f44bc){_0x2af29a=_0x2af29a-0x0;var _0x5ef02f=_0x1152[_0x2af29a];return _0x5ef02f;};'use strict';var multer=require(_0x2115('0x0'));var util=require(_0x2115('0x1'));var path=require(_0x2115('0x2'));var timeout=require(_0x2115('0x3'));var express=require(_0x2115('0x4'));var router=express[_0x2115('0x5')]();var fs_extra=require(_0x2115('0x6'));var auth=require(_0x2115('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2115('0x8'));var controller=require('./chatMessage.controller');router[_0x2115('0x9')]('/',auth[_0x2115('0xa')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x2115('0x9')](_0x2115('0xb'),auth[_0x2115('0xa')](),controller['show']);router[_0x2115('0xc')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x2115('0xd'),_0x2115('0xe')),controller[_0x2115('0xf')]);router['put'](_0x2115('0xb'),controller['update']);router[_0x2115('0x10')](_0x2115('0x11'),auth[_0x2115('0xa')](),controller[_0x2115('0x12')]);router[_0x2115('0x10')]('/:id/reject',auth[_0x2115('0xa')](),controller['reject']);router[_0x2115('0x13')](_0x2115('0xb'),auth[_0x2115('0xa')](),controller[_0x2115('0x14')]);module[_0x2115('0x15')]=router; \ No newline at end of file +var _0x55ea=['../../components/interaction/service','./chatMessage.controller','/describe','isAuthenticated','describe','get','/:id','show','post','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4527a0,_0x20bdc1){var _0x4505cf=function(_0x139636){while(--_0x139636){_0x4527a0['push'](_0x4527a0['shift']());}};_0x4505cf(++_0x20bdc1);}(_0x55ea,0xc9));var _0xa55e=function(_0x1300e0,_0x5a1300){_0x1300e0=_0x1300e0-0x0;var _0x2e1ca5=_0x55ea[_0x1300e0];return _0x2e1ca5;};'use strict';var multer=require(_0xa55e('0x0'));var util=require(_0xa55e('0x1'));var path=require(_0xa55e('0x2'));var timeout=require('connect-timeout');var express=require(_0xa55e('0x3'));var router=express[_0xa55e('0x4')]();var fs_extra=require(_0xa55e('0x5'));var auth=require(_0xa55e('0x6'));var interaction=require(_0xa55e('0x7'));var config=require('../../config/environment');var controller=require(_0xa55e('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa55e('0x9'),auth[_0xa55e('0xa')](),controller[_0xa55e('0xb')]);router[_0xa55e('0xc')](_0xa55e('0xd'),auth[_0xa55e('0xa')](),controller[_0xa55e('0xe')]);router[_0xa55e('0xf')]('/',auth[_0xa55e('0xa')](),interaction['tracked']('chat',_0xa55e('0x10')),controller[_0xa55e('0x11')]);router[_0xa55e('0x12')](_0xa55e('0xd'),controller[_0xa55e('0x13')]);router['put'](_0xa55e('0x14'),auth['isAuthenticated'](),controller[_0xa55e('0x15')]);router[_0xa55e('0x12')](_0xa55e('0x16'),auth[_0xa55e('0xa')](),controller[_0xa55e('0x17')]);router[_0xa55e('0x18')](_0xa55e('0xd'),auth[_0xa55e('0xa')](),controller[_0xa55e('0x19')]);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 703cd7b..99348bb 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 _0xcf09=['TEXT','medium','sequelize','exports'];(function(_0x223bbd,_0x2f8c30){var _0x11e852=function(_0x5c03ab){while(--_0x5c03ab){_0x223bbd['push'](_0x223bbd['shift']());}};_0x11e852(++_0x2f8c30);}(_0xcf09,0x1c2));var _0x9cf0=function(_0x1ea569,_0x4e8312){_0x1ea569=_0x1ea569-0x0;var _0x552451=_0xcf09[_0x1ea569];return _0x552451;};'use strict';var Sequelize=require(_0x9cf0('0x0'));module[_0x9cf0('0x1')]={'body':{'type':Sequelize[_0x9cf0('0x2')](_0x9cf0('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0xb758=['medium','exports','TEXT'];(function(_0x56e6b6,_0x41dbce){var _0x1b1f93=function(_0x2db1f1){while(--_0x2db1f1){_0x56e6b6['push'](_0x56e6b6['shift']());}};_0x1b1f93(++_0x41dbce);}(_0xb758,0xb5));var _0x8b75=function(_0x301c34,_0x15701e){_0x301c34=_0x301c34-0x0;var _0x1a8c5a=_0xb758[_0x301c34];return _0x1a8c5a;};'use strict';var Sequelize=require('sequelize');module[_0x8b75('0x0')]={'body':{'type':Sequelize[_0x8b75('0x1')](_0x8b75('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 8b22d81..70a0a21 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 _0x7081=['json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','ChatOfflineMessage','includeAll','include','findAll','rows','show','params','rawAttributes','create','body','catch','find','Attachment','forEach','root','files','attachments','basename','existsSync','remove','describe','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x4e1269,_0x197395){var _0x293b6a=function(_0x5ac937){while(--_0x5ac937){_0x4e1269['push'](_0x4e1269['shift']());}};_0x293b6a(++_0x197395);}(_0x7081,0x8c));var _0x1708=function(_0x156d1b,_0x756c49){_0x156d1b=_0x156d1b-0x0;var _0x4b20ad=_0x7081[_0x156d1b];return _0x4b20ad;};'use strict';var pdf=require(_0x1708('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1708('0x1'));var zipdir=require(_0x1708('0x2'));var jsonpatch=require(_0x1708('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1708('0x4'));var Mustache=require(_0x1708('0x5'));var util=require(_0x1708('0x6'));var path=require(_0x1708('0x7'));var sox=require(_0x1708('0x8'));var csv=require(_0x1708('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1708('0xa'));var squel=require('squel');var crypto=require(_0x1708('0xb'));var jsforce=require(_0x1708('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1708('0x9'));var querystring=require(_0x1708('0xd'));var Papa=require(_0x1708('0xe'));var Redis=require(_0x1708('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1708('0x10'));var as=require(_0x1708('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1708('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1708('0x13'));var db=require(_0x1708('0x14'))['db'];function respondWithStatusCode(_0x499321,_0x582322){_0x582322=_0x582322||0xcc;return function(_0x44872c){if(_0x44872c){return _0x499321[_0x1708('0x15')](_0x582322);}return _0x499321[_0x1708('0x16')](_0x582322)[_0x1708('0x17')]();};}function respondWithResult(_0x4a9a04,_0x219047){_0x219047=_0x219047||0xc8;return function(_0x2b0082){if(_0x2b0082){return _0x4a9a04[_0x1708('0x16')](_0x219047)[_0x1708('0x18')](_0x2b0082);}};}function respondWithFilteredResult(_0x4ce844,_0x4babaa){return function(_0x2619e3){if(_0x2619e3){var _0x38137d=_0x2619e3[_0x1708('0x19')],_0x1ee518=_0x4babaa[_0x1708('0x1a')],_0x440ab0=_0x4babaa[_0x1708('0x1a')]+_0x4babaa[_0x1708('0x1b')],_0x5a00ee;if(_0x440ab0>=_0x38137d){_0x440ab0=_0x38137d;_0x5a00ee=0xc8;}else{_0x5a00ee=0xce;}_0x4ce844['status'](_0x5a00ee);return _0x4ce844[_0x1708('0x1c')](_0x1708('0x1d'),_0x1ee518+'-'+_0x440ab0+'/'+_0x38137d)[_0x1708('0x18')](_0x2619e3);}return null;};}function patchUpdates(_0x269bf3){return function(_0xadadd5){try{jsonpatch[_0x1708('0x1e')](_0xadadd5,_0x269bf3,!![]);}catch(_0x1663d8){return BPromise[_0x1708('0x1f')](_0x1663d8);}return _0xadadd5[_0x1708('0x20')]();};}function saveUpdates(_0x59956b,_0x1ef894){return function(_0x20daff){if(_0x20daff){return _0x20daff[_0x1708('0x21')](_0x59956b)[_0x1708('0x22')](function(_0x4a00c4){return _0x4a00c4;});}return null;};}function removeEntity(_0x1dccff,_0x55f95c){return function(_0x2f859b){if(_0x2f859b){return _0x2f859b[_0x1708('0x23')]()[_0x1708('0x22')](function(){_0x1dccff[_0x1708('0x16')](0xcc)[_0x1708('0x17')]();});}};}function handleEntityNotFound(_0x147c20,_0x58c0c9){return function(_0x1fe4c3){if(!_0x1fe4c3){_0x147c20[_0x1708('0x15')](0x194);}return _0x1fe4c3;};}function handleError(_0x21334f,_0x47859b){_0x47859b=_0x47859b||0x1f4;return function(_0x3768b1){logger[_0x1708('0x24')](_0x3768b1[_0x1708('0x25')]);if(_0x3768b1['name']){delete _0x3768b1[_0x1708('0x26')];}_0x21334f['status'](_0x47859b)['send'](_0x3768b1);};}exports[_0x1708('0x27')]=function(_0x5da7d1,_0x2d662b){var _0x5497b7={},_0x44576c={},_0x494160={'count':0x0,'rows':[]};var _0x5366f9=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x1b179c){return{'name':_0x1b179c[_0x1708('0x28')],'type':_0x1b179c[_0x1708('0x29')][_0x1708('0x2a')]};});_0x44576c[_0x1708('0x2b')]=_[_0x1708('0x2c')](_0x5366f9,_0x1708('0x26'));_0x44576c[_0x1708('0x2d')]=_[_0x1708('0x2e')](_0x5da7d1['query']);_0x44576c[_0x1708('0x2f')]=_['intersection'](_0x44576c[_0x1708('0x2b')],_0x44576c[_0x1708('0x2d')]);_0x5497b7[_0x1708('0x30')]=_[_0x1708('0x31')](_0x44576c[_0x1708('0x2b')],qs['fields'](_0x5da7d1[_0x1708('0x2d')][_0x1708('0x32')]));_0x5497b7[_0x1708('0x30')]=_0x5497b7['attributes'][_0x1708('0x33')]?_0x5497b7[_0x1708('0x30')]:_0x44576c[_0x1708('0x2b')];if(!_0x5da7d1[_0x1708('0x2d')][_0x1708('0x34')]('nolimit')){_0x5497b7[_0x1708('0x1b')]=qs[_0x1708('0x1b')](_0x5da7d1[_0x1708('0x2d')][_0x1708('0x1b')]);_0x5497b7[_0x1708('0x1a')]=qs[_0x1708('0x1a')](_0x5da7d1[_0x1708('0x2d')][_0x1708('0x1a')]);}_0x5497b7[_0x1708('0x35')]=qs['sort'](_0x5da7d1['query'][_0x1708('0x36')]);_0x5497b7['where']=qs[_0x1708('0x2f')](_[_0x1708('0x37')](_0x5da7d1[_0x1708('0x2d')],_0x44576c[_0x1708('0x2f')]),_0x5366f9);if(_0x5da7d1['query'][_0x1708('0x38')]){_0x5497b7[_0x1708('0x39')]=_[_0x1708('0x3a')](_0x5497b7[_0x1708('0x39')],{'$or':_['map'](_0x5366f9,function(_0x1b4368){if(_0x1b4368[_0x1708('0x29')]!==_0x1708('0x3b')){var _0x58df77={};_0x58df77[_0x1b4368[_0x1708('0x26')]]={'$like':'%'+_0x5da7d1['query'][_0x1708('0x38')]+'%'};return _0x58df77;}})});}_0x5497b7=_[_0x1708('0x3a')]({},_0x5497b7,_0x5da7d1[_0x1708('0x3c')]);var _0x15ef19={'where':_0x5497b7[_0x1708('0x39')]};return db[_0x1708('0x3d')]['count'](_0x15ef19)[_0x1708('0x22')](function(_0x43ab9b){_0x494160[_0x1708('0x19')]=_0x43ab9b;if(_0x5da7d1[_0x1708('0x2d')][_0x1708('0x3e')]){_0x5497b7[_0x1708('0x3f')]=[{'all':!![]}];}return db[_0x1708('0x3d')][_0x1708('0x40')](_0x5497b7);})['then'](function(_0x2cdf84){_0x494160[_0x1708('0x41')]=_0x2cdf84;return _0x494160;})[_0x1708('0x22')](respondWithFilteredResult(_0x2d662b,_0x5497b7))['catch'](handleError(_0x2d662b,null));};exports[_0x1708('0x42')]=function(_0x7abc4d,_0x4766f7){var _0x393a57={'raw':!![],'where':{'id':_0x7abc4d[_0x1708('0x43')]['id']}},_0x3ded11={};_0x3ded11[_0x1708('0x2b')]=_[_0x1708('0x2e')](db['ChatOfflineMessage'][_0x1708('0x44')]);_0x3ded11['query']=_[_0x1708('0x2e')](_0x7abc4d[_0x1708('0x2d')]);_0x3ded11['filters']=_[_0x1708('0x31')](_0x3ded11['model'],_0x3ded11[_0x1708('0x2d')]);_0x393a57[_0x1708('0x30')]=_['intersection'](_0x3ded11[_0x1708('0x2b')],qs[_0x1708('0x32')](_0x7abc4d[_0x1708('0x2d')][_0x1708('0x32')]));_0x393a57[_0x1708('0x30')]=_0x393a57['attributes']['length']?_0x393a57[_0x1708('0x30')]:_0x3ded11[_0x1708('0x2b')];if(_0x7abc4d[_0x1708('0x2d')][_0x1708('0x3e')]){_0x393a57['include']=[{'all':!![]}];}_0x393a57=_[_0x1708('0x3a')]({},_0x393a57,_0x7abc4d['options']);return db[_0x1708('0x3d')]['find'](_0x393a57)[_0x1708('0x22')](handleEntityNotFound(_0x4766f7,null))[_0x1708('0x22')](respondWithResult(_0x4766f7,null))['catch'](handleError(_0x4766f7,null));};exports[_0x1708('0x45')]=function(_0x1fc42c,_0x71c247){return db[_0x1708('0x3d')]['create'](_0x1fc42c[_0x1708('0x46')],{})[_0x1708('0x22')](respondWithResult(_0x71c247,0xc9))[_0x1708('0x47')](handleError(_0x71c247,null));};exports['update']=function(_0x10d101,_0x3457e6){if(_0x10d101[_0x1708('0x46')]['id']){delete _0x10d101[_0x1708('0x46')]['id'];}return db['ChatOfflineMessage'][_0x1708('0x48')]({'where':{'id':_0x10d101[_0x1708('0x43')]['id']}})[_0x1708('0x22')](handleEntityNotFound(_0x3457e6,null))[_0x1708('0x22')](saveUpdates(_0x10d101[_0x1708('0x46')],null))[_0x1708('0x22')](respondWithResult(_0x3457e6,null))['catch'](handleError(_0x3457e6,null));};exports[_0x1708('0x23')]=function(_0x205e60,_0x31e8ca){return db[_0x1708('0x49')][_0x1708('0x40')]({'where':{'ChatOfflineMessageId':eq[_0x1708('0x43')]['id']},'raw':!![]})[_0x1708('0x22')](function(_0x46e032){_0x46e032[_0x1708('0x4a')](function(_0x42753a){var _0x5dc60c=path['join'](config[_0x1708('0x4b')],'server',_0x1708('0x4c'),_0x1708('0x4d'),'offline-chat',_0x42753a[_0x1708('0x4e')]);var _0x2ee3a5=fs[_0x1708('0x4f')](_0x5dc60c);if(_0x2ee3a5)fs_extra[_0x1708('0x50')](_0x5dc60c);});})[_0x1708('0x22')](function(){return db[_0x1708('0x3d')][_0x1708('0x48')]({'where':{'id':_0x205e60[_0x1708('0x43')]['id']},'individualHooks':!![]});})[_0x1708('0x22')](handleEntityNotFound(_0x31e8ca,null))[_0x1708('0x22')](removeEntity(_0x31e8ca,null))[_0x1708('0x47')](handleError(_0x31e8ca,null));};exports[_0x1708('0x51')]=function(_0x9f49c4,_0x506c58){return db[_0x1708('0x3d')][_0x1708('0x51')]()[_0x1708('0x22')](respondWithResult(_0x506c58,null))[_0x1708('0x47')](handleError(_0x506c58,null));}; \ No newline at end of file +var _0xc24b=['name','send','map','ChatOfflineMessage','fieldName','type','key','model','query','attributes','intersection','fields','length','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','show','keys','includeAll','include','find','catch','create','body','params','forEach','server','files','attachments','offline-chat','basename','existsSync','describe','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','limit','set','apply','reject','save','update','then','destroy','end','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc24b,0x117));var _0xbc24=function(_0x34d346,_0x4c6502){_0x34d346=_0x34d346-0x0;var _0x122d76=_0xc24b[_0x34d346];return _0x122d76;};'use strict';var pdf=require(_0xbc24('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbc24('0x1'));var zipdir=require(_0xbc24('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbc24('0x3'));var moment=require(_0xbc24('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbc24('0x5'));var util=require(_0xbc24('0x6'));var path=require(_0xbc24('0x7'));var sox=require(_0xbc24('0x8'));var csv=require(_0xbc24('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbc24('0xa'));var _=require('lodash');var squel=require(_0xbc24('0xb'));var crypto=require('crypto');var jsforce=require(_0xbc24('0xc'));var deskjs=require(_0xbc24('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbc24('0xe'));var Papa=require('papaparse');var Redis=require(_0xbc24('0xf'));var authService=require(_0xbc24('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbc24('0x11'));var logger=require(_0xbc24('0x12'))(_0xbc24('0x13'));var utils=require('../../config/utils');var config=require(_0xbc24('0x14'));var licenseUtil=require(_0xbc24('0x15'));var db=require(_0xbc24('0x16'))['db'];function respondWithStatusCode(_0xc7cc05,_0x4c80eb){_0x4c80eb=_0x4c80eb||0xcc;return function(_0x4080bc){if(_0x4080bc){return _0xc7cc05[_0xbc24('0x17')](_0x4c80eb);}return _0xc7cc05[_0xbc24('0x18')](_0x4c80eb)['end']();};}function respondWithResult(_0x99c159,_0x50be57){_0x50be57=_0x50be57||0xc8;return function(_0x2ce826){if(_0x2ce826){return _0x99c159[_0xbc24('0x18')](_0x50be57)[_0xbc24('0x19')](_0x2ce826);}};}function respondWithFilteredResult(_0x1a96a0,_0x4cbdf4){return function(_0x50951f){if(_0x50951f){var _0x5c24c8=_0x50951f[_0xbc24('0x1a')],_0x220ae9=_0x4cbdf4['offset'],_0x41d32b=_0x4cbdf4['offset']+_0x4cbdf4[_0xbc24('0x1b')],_0x2bc7b0;if(_0x41d32b>=_0x5c24c8){_0x41d32b=_0x5c24c8;_0x2bc7b0=0xc8;}else{_0x2bc7b0=0xce;}_0x1a96a0[_0xbc24('0x18')](_0x2bc7b0);return _0x1a96a0[_0xbc24('0x1c')]('Content-Range',_0x220ae9+'-'+_0x41d32b+'/'+_0x5c24c8)['json'](_0x50951f);}return null;};}function patchUpdates(_0x539ee0){return function(_0x45c630){try{jsonpatch[_0xbc24('0x1d')](_0x45c630,_0x539ee0,!![]);}catch(_0x514535){return BPromise[_0xbc24('0x1e')](_0x514535);}return _0x45c630[_0xbc24('0x1f')]();};}function saveUpdates(_0x329a54,_0x118d04){return function(_0x44e246){if(_0x44e246){return _0x44e246[_0xbc24('0x20')](_0x329a54)[_0xbc24('0x21')](function(_0x4c6217){return _0x4c6217;});}return null;};}function removeEntity(_0x18d23e,_0x2d76f8){return function(_0x4526e3){if(_0x4526e3){return _0x4526e3[_0xbc24('0x22')]()[_0xbc24('0x21')](function(){_0x18d23e[_0xbc24('0x18')](0xcc)[_0xbc24('0x23')]();});}};}function handleEntityNotFound(_0xacf80,_0x366d1d){return function(_0x3f8b35){if(!_0x3f8b35){_0xacf80[_0xbc24('0x17')](0x194);}return _0x3f8b35;};}function handleError(_0x2a1424,_0x4b1e43){_0x4b1e43=_0x4b1e43||0x1f4;return function(_0x4c4b64){logger[_0xbc24('0x24')](_0x4c4b64['stack']);if(_0x4c4b64[_0xbc24('0x25')]){delete _0x4c4b64[_0xbc24('0x25')];}_0x2a1424['status'](_0x4b1e43)[_0xbc24('0x26')](_0x4c4b64);};}exports['index']=function(_0x59ecc3,_0xdb3e88){var _0x3732cb={},_0x25fd45={},_0x2f7eef={'count':0x0,'rows':[]};var _0x5e16aa=_[_0xbc24('0x27')](db[_0xbc24('0x28')]['rawAttributes'],function(_0x1dac7a){return{'name':_0x1dac7a[_0xbc24('0x29')],'type':_0x1dac7a[_0xbc24('0x2a')][_0xbc24('0x2b')]};});_0x25fd45[_0xbc24('0x2c')]=_['map'](_0x5e16aa,_0xbc24('0x25'));_0x25fd45['query']=_['keys'](_0x59ecc3[_0xbc24('0x2d')]);_0x25fd45['filters']=_['intersection'](_0x25fd45[_0xbc24('0x2c')],_0x25fd45['query']);_0x3732cb[_0xbc24('0x2e')]=_[_0xbc24('0x2f')](_0x25fd45[_0xbc24('0x2c')],qs[_0xbc24('0x30')](_0x59ecc3[_0xbc24('0x2d')][_0xbc24('0x30')]));_0x3732cb[_0xbc24('0x2e')]=_0x3732cb[_0xbc24('0x2e')][_0xbc24('0x31')]?_0x3732cb['attributes']:_0x25fd45['model'];if(!_0x59ecc3[_0xbc24('0x2d')]['hasOwnProperty']('nolimit')){_0x3732cb['limit']=qs['limit'](_0x59ecc3[_0xbc24('0x2d')]['limit']);_0x3732cb['offset']=qs[_0xbc24('0x32')](_0x59ecc3['query'][_0xbc24('0x32')]);}_0x3732cb[_0xbc24('0x33')]=qs[_0xbc24('0x34')](_0x59ecc3[_0xbc24('0x2d')][_0xbc24('0x34')]);_0x3732cb[_0xbc24('0x35')]=qs[_0xbc24('0x36')](_[_0xbc24('0x37')](_0x59ecc3['query'],_0x25fd45[_0xbc24('0x36')]),_0x5e16aa);if(_0x59ecc3[_0xbc24('0x2d')][_0xbc24('0x38')]){_0x3732cb[_0xbc24('0x35')]=_[_0xbc24('0x39')](_0x3732cb[_0xbc24('0x35')],{'$or':_[_0xbc24('0x27')](_0x5e16aa,function(_0x1c69ea){if(_0x1c69ea[_0xbc24('0x2a')]!==_0xbc24('0x3a')){var _0x14b83a={};_0x14b83a[_0x1c69ea['name']]={'$like':'%'+_0x59ecc3[_0xbc24('0x2d')][_0xbc24('0x38')]+'%'};return _0x14b83a;}})});}_0x3732cb=_['merge']({},_0x3732cb,_0x59ecc3[_0xbc24('0x3b')]);var _0x41ffd9={'where':_0x3732cb[_0xbc24('0x35')]};return db[_0xbc24('0x28')][_0xbc24('0x1a')](_0x41ffd9)[_0xbc24('0x21')](function(_0x46a986){_0x2f7eef[_0xbc24('0x1a')]=_0x46a986;if(_0x59ecc3[_0xbc24('0x2d')]['includeAll']){_0x3732cb['include']=[{'all':!![]}];}return db['ChatOfflineMessage'][_0xbc24('0x3c')](_0x3732cb);})[_0xbc24('0x21')](function(_0x22a010){_0x2f7eef[_0xbc24('0x3d')]=_0x22a010;return _0x2f7eef;})[_0xbc24('0x21')](respondWithFilteredResult(_0xdb3e88,_0x3732cb))['catch'](handleError(_0xdb3e88,null));};exports[_0xbc24('0x3e')]=function(_0x3aa9ed,_0x15c8fb){var _0x269250={'raw':!![],'where':{'id':_0x3aa9ed['params']['id']}},_0x539282={};_0x539282[_0xbc24('0x2c')]=_[_0xbc24('0x3f')](db[_0xbc24('0x28')]['rawAttributes']);_0x539282[_0xbc24('0x2d')]=_['keys'](_0x3aa9ed[_0xbc24('0x2d')]);_0x539282['filters']=_['intersection'](_0x539282['model'],_0x539282['query']);_0x269250['attributes']=_[_0xbc24('0x2f')](_0x539282['model'],qs[_0xbc24('0x30')](_0x3aa9ed[_0xbc24('0x2d')][_0xbc24('0x30')]));_0x269250[_0xbc24('0x2e')]=_0x269250[_0xbc24('0x2e')][_0xbc24('0x31')]?_0x269250['attributes']:_0x539282['model'];if(_0x3aa9ed[_0xbc24('0x2d')][_0xbc24('0x40')]){_0x269250[_0xbc24('0x41')]=[{'all':!![]}];}_0x269250=_[_0xbc24('0x39')]({},_0x269250,_0x3aa9ed[_0xbc24('0x3b')]);return db['ChatOfflineMessage'][_0xbc24('0x42')](_0x269250)[_0xbc24('0x21')](handleEntityNotFound(_0x15c8fb,null))[_0xbc24('0x21')](respondWithResult(_0x15c8fb,null))[_0xbc24('0x43')](handleError(_0x15c8fb,null));};exports[_0xbc24('0x44')]=function(_0x47f80d,_0x4fcbc7){return db['ChatOfflineMessage'][_0xbc24('0x44')](_0x47f80d[_0xbc24('0x45')],{})[_0xbc24('0x21')](respondWithResult(_0x4fcbc7,0xc9))[_0xbc24('0x43')](handleError(_0x4fcbc7,null));};exports[_0xbc24('0x20')]=function(_0x21dae4,_0xc6b02b){if(_0x21dae4[_0xbc24('0x45')]['id']){delete _0x21dae4[_0xbc24('0x45')]['id'];}return db[_0xbc24('0x28')][_0xbc24('0x42')]({'where':{'id':_0x21dae4[_0xbc24('0x46')]['id']}})['then'](handleEntityNotFound(_0xc6b02b,null))[_0xbc24('0x21')](saveUpdates(_0x21dae4[_0xbc24('0x45')],null))[_0xbc24('0x21')](respondWithResult(_0xc6b02b,null))[_0xbc24('0x43')](handleError(_0xc6b02b,null));};exports[_0xbc24('0x22')]=function(_0x3f444b,_0xdd73bf){return db['Attachment'][_0xbc24('0x3c')]({'where':{'ChatOfflineMessageId':eq[_0xbc24('0x46')]['id']},'raw':!![]})[_0xbc24('0x21')](function(_0x1d006d){_0x1d006d[_0xbc24('0x47')](function(_0xd92d20){var _0x571862=path['join'](config['root'],_0xbc24('0x48'),_0xbc24('0x49'),_0xbc24('0x4a'),_0xbc24('0x4b'),_0xd92d20[_0xbc24('0x4c')]);var _0x3d2711=fs[_0xbc24('0x4d')](_0x571862);if(_0x3d2711)fs_extra['remove'](_0x571862);});})['then'](function(){return db[_0xbc24('0x28')][_0xbc24('0x42')]({'where':{'id':_0x3f444b['params']['id']},'individualHooks':!![]});})[_0xbc24('0x21')](handleEntityNotFound(_0xdd73bf,null))[_0xbc24('0x21')](removeEntity(_0xdd73bf,null))['catch'](handleError(_0xdd73bf,null));};exports[_0xbc24('0x4e')]=function(_0x1845b9,_0x4b7400){return db['ChatOfflineMessage'][_0xbc24('0x4e')]()[_0xbc24('0x21')](respondWithResult(_0x4b7400,null))['catch'](handleError(_0x4b7400,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 6c1d82c..ba4049d 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 _0x5636=['bluebird','request-promise','path','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0xa95e7f,_0x486d8b){var _0x3620e8=function(_0x56a1df){while(--_0x56a1df){_0xa95e7f['push'](_0xa95e7f['shift']());}};_0x3620e8(++_0x486d8b);}(_0x5636,0x102));var _0x6563=function(_0x2cd871,_0x73c920){_0x2cd871=_0x2cd871-0x0;var _0x3ee90=_0x5636[_0x2cd871];return _0x3ee90;};'use strict';var _=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6563('0x2'));var rp=require(_0x6563('0x3'));var fs=require('fs');var path=require(_0x6563('0x4'));var rimraf=require('rimraf');var config=require(_0x6563('0x5'));var attributes=require(_0x6563('0x6'));module[_0x6563('0x7')]=function(_0x39792f,_0x29f687){return _0x39792f[_0x6563('0x8')](_0x6563('0x9'),attributes,{'tableName':_0x6563('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6563('0xb'),'collate':_0x6563('0xc')});}; \ No newline at end of file +var _0x9b9b=['path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','util','moment','bluebird','request-promise'];(function(_0x49b56e,_0x448f22){var _0x565d51=function(_0x5dd77c){while(--_0x5dd77c){_0x49b56e['push'](_0x49b56e['shift']());}};_0x565d51(++_0x448f22);}(_0x9b9b,0x114));var _0xb9b9=function(_0x4f89fa,_0x39546d){_0x4f89fa=_0x4f89fa-0x0;var _0x338542=_0x9b9b[_0x4f89fa];return _0x338542;};'use strict';var _=require('lodash');var util=require(_0xb9b9('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb9b9('0x1'));var BPromise=require(_0xb9b9('0x2'));var rp=require(_0xb9b9('0x3'));var fs=require('fs');var path=require(_0xb9b9('0x4'));var rimraf=require(_0xb9b9('0x5'));var config=require(_0xb9b9('0x6'));var attributes=require(_0xb9b9('0x7'));module[_0xb9b9('0x8')]=function(_0x79dd,_0x3d1a95){return _0x79dd[_0xb9b9('0x9')](_0xb9b9('0xa'),attributes,{'tableName':_0xb9b9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb9b9('0xc'),'collate':_0xb9b9('0xd')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index bbc6f12..4b0bbb2 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 _0x9689=['../../config/environment','jayson/promise','client','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x32cb5d,_0xe97c1d){var _0x563adf=function(_0x12250a){while(--_0x12250a){_0x32cb5d['push'](_0x32cb5d['shift']());}};_0x563adf(++_0xe97c1d);}(_0x9689,0x1db));var _0x9968=function(_0x25db8b,_0x17e07d){_0x25db8b=_0x25db8b-0x0;var _0x5156cf=_0x9689[_0x25db8b];return _0x5156cf;};'use strict';var _=require(_0x9968('0x0'));var util=require(_0x9968('0x1'));var moment=require(_0x9968('0x2'));var BPromise=require(_0x9968('0x3'));var rs=require(_0x9968('0x4'));var fs=require('fs');var Redis=require(_0x9968('0x5'));var db=require(_0x9968('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9968('0x7'))('rpc');var config=require(_0x9968('0x8'));var jayson=require(_0x9968('0x9'));var client=jayson[_0x9968('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1daaea,_0x333748,_0xdd3c10){return new BPromise(function(_0x2c3704,_0x16d4cd){return client[_0x9968('0xb')](_0x1daaea,_0xdd3c10)[_0x9968('0xc')](function(_0x196ffe){logger[_0x9968('0xd')](_0x9968('0xe'),_0x333748,_0x9968('0xf'));logger['debug'](_0x9968('0x10'),_0x333748,_0x9968('0xf'),JSON['stringify'](_0x196ffe));if(_0x196ffe[_0x9968('0x11')]){if(_0x196ffe['error'][_0x9968('0x12')]===0x1f4){logger[_0x9968('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x333748,_0x196ffe[_0x9968('0x11')]['message']);return _0x16d4cd(_0x196ffe[_0x9968('0x11')]['message']);}logger[_0x9968('0x11')](_0x9968('0xe'),_0x333748,_0x196ffe[_0x9968('0x11')]['message']);return _0x2c3704(_0x196ffe['error'][_0x9968('0x13')]);}else{logger[_0x9968('0xd')](_0x9968('0xe'),_0x333748,'request\x20sent');_0x2c3704(_0x196ffe['result'][_0x9968('0x13')]);}})[_0x9968('0x14')](function(_0x2f7229){logger[_0x9968('0x11')](_0x9968('0xe'),_0x333748,_0x2f7229);_0x16d4cd(_0x2f7229);});});} \ No newline at end of file +var _0x51cb=['catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x4532e7,_0x2f125c){var _0x3d2d5e=function(_0x17b509){while(--_0x17b509){_0x4532e7['push'](_0x4532e7['shift']());}};_0x3d2d5e(++_0x2f125c);}(_0x51cb,0x1cd));var _0xb51c=function(_0x48e04f,_0x2e1ef9){_0x48e04f=_0x48e04f-0x0;var _0x1b36e5=_0x51cb[_0x48e04f];return _0x1b36e5;};'use strict';var _=require(_0xb51c('0x0'));var util=require(_0xb51c('0x1'));var moment=require(_0xb51c('0x2'));var BPromise=require(_0xb51c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb51c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb51c('0x5'));var logger=require(_0xb51c('0x6'))(_0xb51c('0x7'));var config=require('../../config/environment');var jayson=require(_0xb51c('0x8'));var client=jayson[_0xb51c('0x9')][_0xb51c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4decaa,_0x3125dc,_0x5f41b2){return new BPromise(function(_0x15c544,_0xfa18f7){return client[_0xb51c('0xb')](_0x4decaa,_0x5f41b2)['then'](function(_0x58f87b){logger['info'](_0xb51c('0xc'),_0x3125dc,_0xb51c('0xd'));logger[_0xb51c('0xe')](_0xb51c('0xf'),_0x3125dc,_0xb51c('0xd'),JSON[_0xb51c('0x10')](_0x58f87b));if(_0x58f87b['error']){if(_0x58f87b[_0xb51c('0x11')][_0xb51c('0x12')]===0x1f4){logger[_0xb51c('0x11')](_0xb51c('0xc'),_0x3125dc,_0x58f87b['error'][_0xb51c('0x13')]);return _0xfa18f7(_0x58f87b[_0xb51c('0x11')]['message']);}logger[_0xb51c('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3125dc,_0x58f87b[_0xb51c('0x11')][_0xb51c('0x13')]);return _0x15c544(_0x58f87b[_0xb51c('0x11')][_0xb51c('0x13')]);}else{logger[_0xb51c('0x14')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3125dc,_0xb51c('0xd'));_0x15c544(_0x58f87b[_0xb51c('0x15')][_0xb51c('0x13')]);}})[_0xb51c('0x16')](function(_0x5ae595){logger['error'](_0xb51c('0xc'),_0x3125dc,_0x5ae595);_0xfa18f7(_0x5ae595);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index e91ebd4..bc48245 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 _0xde43=['create','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','get','describe','/:id','show','post'];(function(_0x381d54,_0x1d3a82){var _0x2bc0be=function(_0x34570e){while(--_0x34570e){_0x381d54['push'](_0x381d54['shift']());}};_0x2bc0be(++_0x1d3a82);}(_0xde43,0xab));var _0x3de4=function(_0x5347f1,_0x1122ab){_0x5347f1=_0x5347f1-0x0;var _0x31216d=_0xde43[_0x5347f1];return _0x31216d;};'use strict';var multer=require(_0x3de4('0x0'));var util=require(_0x3de4('0x1'));var path=require(_0x3de4('0x2'));var timeout=require(_0x3de4('0x3'));var express=require(_0x3de4('0x4'));var router=express[_0x3de4('0x5')]();var fs_extra=require(_0x3de4('0x6'));var auth=require(_0x3de4('0x7'));var interaction=require(_0x3de4('0x8'));var config=require(_0x3de4('0x9'));var controller=require(_0x3de4('0xa'));router['get']('/',auth[_0x3de4('0xb')](),controller[_0x3de4('0xc')]);router[_0x3de4('0xd')]('/describe',auth[_0x3de4('0xb')](),controller[_0x3de4('0xe')]);router['get'](_0x3de4('0xf'),auth[_0x3de4('0xb')](),controller[_0x3de4('0x10')]);router[_0x3de4('0x11')]('/',auth[_0x3de4('0xb')](),controller[_0x3de4('0x12')]);router[_0x3de4('0x13')]('/:id',auth[_0x3de4('0xb')](),controller[_0x3de4('0x14')]);router['delete']('/:id',auth[_0x3de4('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7b7c=['index','/describe','describe','show','post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','fs-extra','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated'];(function(_0x2a06f1,_0x5d71e0){var _0x5c43b1=function(_0x20abbc){while(--_0x20abbc){_0x2a06f1['push'](_0x2a06f1['shift']());}};_0x5c43b1(++_0x5d71e0);}(_0x7b7c,0x161));var _0xc7b7=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x7b7c[_0x4154a6];return _0x3b2786;};'use strict';var multer=require('multer');var util=require(_0xc7b7('0x0'));var path=require(_0xc7b7('0x1'));var timeout=require(_0xc7b7('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc7b7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xc7b7('0x4'));var config=require('../../config/environment');var controller=require(_0xc7b7('0x5'));router[_0xc7b7('0x6')]('/',auth[_0xc7b7('0x7')](),controller[_0xc7b7('0x8')]);router[_0xc7b7('0x6')](_0xc7b7('0x9'),auth[_0xc7b7('0x7')](),controller[_0xc7b7('0xa')]);router['get']('/:id',auth[_0xc7b7('0x7')](),controller[_0xc7b7('0xb')]);router[_0xc7b7('0xc')]('/',auth[_0xc7b7('0x7')](),controller[_0xc7b7('0xd')]);router[_0xc7b7('0xe')](_0xc7b7('0xf'),auth[_0xc7b7('0x7')](),controller[_0xc7b7('0x10')]);router[_0xc7b7('0x11')](_0xc7b7('0xf'),auth[_0xc7b7('0x7')](),controller[_0xc7b7('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 84c459c..307efc4 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 _0x3d21=['INTEGER','sequelize','mouseOver','timeout','STRING'];(function(_0x42902b,_0x3d4954){var _0xb69b90=function(_0x2fd92b){while(--_0x2fd92b){_0x42902b['push'](_0x42902b['shift']());}};_0xb69b90(++_0x3d4954);}(_0x3d21,0x1c8));var _0x13d2=function(_0x92f9,_0x38fee2){_0x92f9=_0x92f9-0x0;var _0x783918=_0x3d21[_0x92f9];return _0x783918;};'use strict';var Sequelize=require(_0x13d2('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x13d2('0x1'),_0x13d2('0x2')),'defaultValue':_0x13d2('0x1')},'selector':{'type':Sequelize[_0x13d2('0x3')]},'timeout':{'type':Sequelize[_0x13d2('0x4')]}}; \ No newline at end of file +var _0xf3e1=['exports','STRING','ENUM','mouseOver','INTEGER'];(function(_0x62cbcd,_0x1e61c7){var _0x16d7ac=function(_0x547124){while(--_0x547124){_0x62cbcd['push'](_0x62cbcd['shift']());}};_0x16d7ac(++_0x1e61c7);}(_0xf3e1,0x18b));var _0x1f3e=function(_0x43316d,_0x5ebd8f){_0x43316d=_0x43316d-0x0;var _0x52d343=_0xf3e1[_0x43316d];return _0x52d343;};'use strict';var Sequelize=require('sequelize');module[_0x1f3e('0x0')]={'name':{'type':Sequelize[_0x1f3e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1f3e('0x2')](_0x1f3e('0x3'),'timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x1f3e('0x1')]},'timeout':{'type':Sequelize[_0x1f3e('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 06d761e..9c6f00d 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 _0xe5fc=['send','show','keys','ChatProactiveAction','rawAttributes','query','intersection','attributes','fields','length','model','includeAll','options','find','catch','create','body','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','end','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name'];(function(_0x9a93d,_0x40e73d){var _0xba8315=function(_0x4a6ba0){while(--_0x4a6ba0){_0x9a93d['push'](_0x9a93d['shift']());}};_0xba8315(++_0x40e73d);}(_0xe5fc,0x12f));var _0xce5f=function(_0x2cce37,_0xcb6d43){_0x2cce37=_0x2cce37-0x0;var _0x446c30=_0xe5fc[_0x2cce37];return _0x446c30;};'use strict';var pdf=require(_0xce5f('0x0'));var emlformat=require(_0xce5f('0x1'));var rimraf=require(_0xce5f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xce5f('0x3'));var rp=require(_0xce5f('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xce5f('0x5'));var util=require('util');var path=require(_0xce5f('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xce5f('0x7'));var fs=require('fs');var fs_extra=require(_0xce5f('0x8'));var _=require(_0xce5f('0x9'));var squel=require(_0xce5f('0xa'));var crypto=require(_0xce5f('0xb'));var jsforce=require(_0xce5f('0xc'));var deskjs=require(_0xce5f('0xd'));var toCsv=require(_0xce5f('0xe'));var querystring=require(_0xce5f('0xf'));var Papa=require(_0xce5f('0x10'));var Redis=require('ioredis');var authService=require(_0xce5f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xce5f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xce5f('0x13'))('api');var utils=require(_0xce5f('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xce5f('0x15'))['db'];function respondWithStatusCode(_0x3a8737,_0x5e953){_0x5e953=_0x5e953||0xcc;return function(_0x1140d2){if(_0x1140d2){return _0x3a8737['sendStatus'](_0x5e953);}return _0x3a8737['status'](_0x5e953)[_0xce5f('0x16')]();};}function respondWithResult(_0x3adab7,_0x4d170c){_0x4d170c=_0x4d170c||0xc8;return function(_0x403425){if(_0x403425){return _0x3adab7[_0xce5f('0x17')](_0x4d170c)['json'](_0x403425);}};}function respondWithFilteredResult(_0x49b8ed,_0x5565ef){return function(_0x384c89){if(_0x384c89){var _0x5d72bc=_0x384c89['count'],_0x7a0cbf=_0x5565ef[_0xce5f('0x18')],_0x49962c=_0x5565ef[_0xce5f('0x18')]+_0x5565ef[_0xce5f('0x19')],_0x3da4da;if(_0x49962c>=_0x5d72bc){_0x49962c=_0x5d72bc;_0x3da4da=0xc8;}else{_0x3da4da=0xce;}_0x49b8ed[_0xce5f('0x17')](_0x3da4da);return _0x49b8ed[_0xce5f('0x1a')](_0xce5f('0x1b'),_0x7a0cbf+'-'+_0x49962c+'/'+_0x5d72bc)[_0xce5f('0x1c')](_0x384c89);}return null;};}function patchUpdates(_0x327923){return function(_0x132204){try{jsonpatch[_0xce5f('0x1d')](_0x132204,_0x327923,!![]);}catch(_0x30469d){return BPromise[_0xce5f('0x1e')](_0x30469d);}return _0x132204[_0xce5f('0x1f')]();};}function saveUpdates(_0x22e64d,_0x2850bd){return function(_0xd88232){if(_0xd88232){return _0xd88232[_0xce5f('0x20')](_0x22e64d)[_0xce5f('0x21')](function(_0x1605f0){return _0x1605f0;});}return null;};}function removeEntity(_0x2e0b4f,_0x10f09b){return function(_0x1eeee0){if(_0x1eeee0){return _0x1eeee0[_0xce5f('0x22')]()['then'](function(){_0x2e0b4f['status'](0xcc)[_0xce5f('0x16')]();});}};}function handleEntityNotFound(_0x146c06,_0x4ae57d){return function(_0x31d4b2){if(!_0x31d4b2){_0x146c06[_0xce5f('0x23')](0x194);}return _0x31d4b2;};}function handleError(_0x20b2c0,_0x95c1ee){_0x95c1ee=_0x95c1ee||0x1f4;return function(_0x4841fd){logger[_0xce5f('0x24')](_0x4841fd[_0xce5f('0x25')]);if(_0x4841fd['name']){delete _0x4841fd[_0xce5f('0x26')];}_0x20b2c0['status'](_0x95c1ee)[_0xce5f('0x27')](_0x4841fd);};}exports[_0xce5f('0x28')]=function(_0x36a941,_0x367911){var _0x1fddd9={'raw':!![],'where':{'id':_0x36a941['params']['id']}},_0x2c971d={};_0x2c971d['model']=_[_0xce5f('0x29')](db[_0xce5f('0x2a')][_0xce5f('0x2b')]);_0x2c971d[_0xce5f('0x2c')]=_[_0xce5f('0x29')](_0x36a941[_0xce5f('0x2c')]);_0x2c971d['filters']=_[_0xce5f('0x2d')](_0x2c971d['model'],_0x2c971d[_0xce5f('0x2c')]);_0x1fddd9[_0xce5f('0x2e')]=_[_0xce5f('0x2d')](_0x2c971d['model'],qs['fields'](_0x36a941[_0xce5f('0x2c')][_0xce5f('0x2f')]));_0x1fddd9[_0xce5f('0x2e')]=_0x1fddd9[_0xce5f('0x2e')][_0xce5f('0x30')]?_0x1fddd9['attributes']:_0x2c971d[_0xce5f('0x31')];if(_0x36a941[_0xce5f('0x2c')][_0xce5f('0x32')]){_0x1fddd9['include']=[{'all':!![]}];}_0x1fddd9=_['merge']({},_0x1fddd9,_0x36a941[_0xce5f('0x33')]);return db[_0xce5f('0x2a')][_0xce5f('0x34')](_0x1fddd9)[_0xce5f('0x21')](handleEntityNotFound(_0x367911,null))[_0xce5f('0x21')](respondWithResult(_0x367911,null))[_0xce5f('0x35')](handleError(_0x367911,null));};exports['create']=function(_0x4988e6,_0x417c2c){return db[_0xce5f('0x2a')][_0xce5f('0x36')](_0x4988e6[_0xce5f('0x37')],{})[_0xce5f('0x21')](respondWithResult(_0x417c2c,0xc9))[_0xce5f('0x35')](handleError(_0x417c2c,null));};exports[_0xce5f('0x20')]=function(_0x324e0a,_0x7cfb40){if(_0x324e0a[_0xce5f('0x37')]['id']){delete _0x324e0a[_0xce5f('0x37')]['id'];}return db[_0xce5f('0x2a')][_0xce5f('0x34')]({'where':{'id':_0x324e0a[_0xce5f('0x38')]['id']}})[_0xce5f('0x21')](handleEntityNotFound(_0x7cfb40,null))[_0xce5f('0x21')](saveUpdates(_0x324e0a[_0xce5f('0x37')],null))[_0xce5f('0x21')](respondWithResult(_0x7cfb40,null))['catch'](handleError(_0x7cfb40,null));};exports[_0xce5f('0x22')]=function(_0x306f99,_0x3d69fe){return db['ChatProactiveAction'][_0xce5f('0x34')]({'where':{'id':_0x306f99[_0xce5f('0x38')]['id']}})[_0xce5f('0x21')](handleEntityNotFound(_0x3d69fe,null))[_0xce5f('0x21')](removeEntity(_0x3d69fe,null))[_0xce5f('0x35')](handleError(_0x3d69fe,null));}; \ No newline at end of file +var _0xceab=['catch','create','body','destroy','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','status','offset','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','show','model','rawAttributes','query','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','options','ChatProactiveAction','find'];(function(_0xc850f8,_0x2f9080){var _0x56ca2d=function(_0x49b320){while(--_0x49b320){_0xc850f8['push'](_0xc850f8['shift']());}};_0x56ca2d(++_0x2f9080);}(_0xceab,0x83));var _0xbcea=function(_0x3b637e,_0x25dc7e){_0x3b637e=_0x3b637e-0x0;var _0x56ec54=_0xceab[_0x3b637e];return _0x56ec54;};'use strict';var pdf=require(_0xbcea('0x0'));var emlformat=require(_0xbcea('0x1'));var rimraf=require(_0xbcea('0x2'));var zipdir=require(_0xbcea('0x3'));var jsonpatch=require(_0xbcea('0x4'));var rp=require(_0xbcea('0x5'));var moment=require(_0xbcea('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xbcea('0x7'));var util=require(_0xbcea('0x8'));var path=require(_0xbcea('0x9'));var sox=require(_0xbcea('0xa'));var csv=require(_0xbcea('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbcea('0xc'));var _=require(_0xbcea('0xd'));var squel=require('squel');var crypto=require(_0xbcea('0xe'));var jsforce=require(_0xbcea('0xf'));var deskjs=require(_0xbcea('0x10'));var toCsv=require(_0xbcea('0xb'));var querystring=require(_0xbcea('0x11'));var Papa=require(_0xbcea('0x12'));var Redis=require(_0xbcea('0x13'));var authService=require(_0xbcea('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xbcea('0x15'));var hardwareService=require(_0xbcea('0x16'));var logger=require('../../config/logger')(_0xbcea('0x17'));var utils=require(_0xbcea('0x18'));var config=require(_0xbcea('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x478fd7,_0x20a74e){_0x20a74e=_0x20a74e||0xcc;return function(_0x2c8421){if(_0x2c8421){return _0x478fd7[_0xbcea('0x1a')](_0x20a74e);}return _0x478fd7['status'](_0x20a74e)[_0xbcea('0x1b')]();};}function respondWithResult(_0x256140,_0x21c404){_0x21c404=_0x21c404||0xc8;return function(_0x291001){if(_0x291001){return _0x256140[_0xbcea('0x1c')](_0x21c404)['json'](_0x291001);}};}function respondWithFilteredResult(_0x58fb15,_0x466ce2){return function(_0xbd13f5){if(_0xbd13f5){var _0x337cf7=_0xbd13f5['count'],_0x497adc=_0x466ce2[_0xbcea('0x1d')],_0x4f19a0=_0x466ce2[_0xbcea('0x1d')]+_0x466ce2['limit'],_0x3b3bda;if(_0x4f19a0>=_0x337cf7){_0x4f19a0=_0x337cf7;_0x3b3bda=0xc8;}else{_0x3b3bda=0xce;}_0x58fb15[_0xbcea('0x1c')](_0x3b3bda);return _0x58fb15[_0xbcea('0x1e')](_0xbcea('0x1f'),_0x497adc+'-'+_0x4f19a0+'/'+_0x337cf7)[_0xbcea('0x20')](_0xbd13f5);}return null;};}function patchUpdates(_0x461693){return function(_0x5069d7){try{jsonpatch[_0xbcea('0x21')](_0x5069d7,_0x461693,!![]);}catch(_0x15ce2f){return BPromise[_0xbcea('0x22')](_0x15ce2f);}return _0x5069d7[_0xbcea('0x23')]();};}function saveUpdates(_0x45d9de,_0x4c73cc){return function(_0x17bfa4){if(_0x17bfa4){return _0x17bfa4[_0xbcea('0x24')](_0x45d9de)[_0xbcea('0x25')](function(_0x59a298){return _0x59a298;});}return null;};}function removeEntity(_0x2ba26a,_0x1d1d69){return function(_0x4c5d9a){if(_0x4c5d9a){return _0x4c5d9a['destroy']()['then'](function(){_0x2ba26a[_0xbcea('0x1c')](0xcc)[_0xbcea('0x1b')]();});}};}function handleEntityNotFound(_0x50c4a3,_0x2fc1d7){return function(_0xee7074){if(!_0xee7074){_0x50c4a3[_0xbcea('0x1a')](0x194);}return _0xee7074;};}function handleError(_0x5c20d2,_0x1db21c){_0x1db21c=_0x1db21c||0x1f4;return function(_0x55867d){logger[_0xbcea('0x26')](_0x55867d[_0xbcea('0x27')]);if(_0x55867d[_0xbcea('0x28')]){delete _0x55867d[_0xbcea('0x28')];}_0x5c20d2[_0xbcea('0x1c')](_0x1db21c)[_0xbcea('0x29')](_0x55867d);};}exports[_0xbcea('0x2a')]=function(_0x630501,_0x3cc1d8){var _0x2692a6={'raw':!![],'where':{'id':_0x630501['params']['id']}},_0x28e2c1={};_0x28e2c1[_0xbcea('0x2b')]=_['keys'](db['ChatProactiveAction'][_0xbcea('0x2c')]);_0x28e2c1[_0xbcea('0x2d')]=_[_0xbcea('0x2e')](_0x630501[_0xbcea('0x2d')]);_0x28e2c1[_0xbcea('0x2f')]=_[_0xbcea('0x30')](_0x28e2c1[_0xbcea('0x2b')],_0x28e2c1['query']);_0x2692a6['attributes']=_['intersection'](_0x28e2c1[_0xbcea('0x2b')],qs[_0xbcea('0x31')](_0x630501['query'][_0xbcea('0x31')]));_0x2692a6[_0xbcea('0x32')]=_0x2692a6[_0xbcea('0x32')][_0xbcea('0x33')]?_0x2692a6[_0xbcea('0x32')]:_0x28e2c1[_0xbcea('0x2b')];if(_0x630501[_0xbcea('0x2d')][_0xbcea('0x34')]){_0x2692a6[_0xbcea('0x35')]=[{'all':!![]}];}_0x2692a6=_[_0xbcea('0x36')]({},_0x2692a6,_0x630501[_0xbcea('0x37')]);return db[_0xbcea('0x38')][_0xbcea('0x39')](_0x2692a6)[_0xbcea('0x25')](handleEntityNotFound(_0x3cc1d8,null))[_0xbcea('0x25')](respondWithResult(_0x3cc1d8,null))[_0xbcea('0x3a')](handleError(_0x3cc1d8,null));};exports[_0xbcea('0x3b')]=function(_0x54976a,_0xbdca56){return db[_0xbcea('0x38')]['create'](_0x54976a[_0xbcea('0x3c')],{})[_0xbcea('0x25')](respondWithResult(_0xbdca56,0xc9))[_0xbcea('0x3a')](handleError(_0xbdca56,null));};exports['update']=function(_0x2caca2,_0x5d9e23){if(_0x2caca2[_0xbcea('0x3c')]['id']){delete _0x2caca2[_0xbcea('0x3c')]['id'];}return db[_0xbcea('0x38')][_0xbcea('0x39')]({'where':{'id':_0x2caca2['params']['id']}})['then'](handleEntityNotFound(_0x5d9e23,null))[_0xbcea('0x25')](saveUpdates(_0x2caca2['body'],null))[_0xbcea('0x25')](respondWithResult(_0x5d9e23,null))[_0xbcea('0x3a')](handleError(_0x5d9e23,null));};exports[_0xbcea('0x3d')]=function(_0x5d2ead,_0x4b95b0){return db[_0xbcea('0x38')][_0xbcea('0x39')]({'where':{'id':_0x5d2ead[_0xbcea('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4b95b0,null))[_0xbcea('0x25')](removeEntity(_0x4b95b0,null))[_0xbcea('0x3a')](handleError(_0x4b95b0,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 8962522..ed72d63 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 _0xaed4=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','ChatProactiveAction','chat_proactive_actions','lodash'];(function(_0x3c7df7,_0x348a7e){var _0x4b0495=function(_0x5951bf){while(--_0x5951bf){_0x3c7df7['push'](_0x3c7df7['shift']());}};_0x4b0495(++_0x348a7e);}(_0xaed4,0x107));var _0x4aed=function(_0x1222fa,_0x39a7b9){_0x1222fa=_0x1222fa-0x0;var _0x1dcd74=_0xaed4[_0x1222fa];return _0x1dcd74;};'use strict';var _=require(_0x4aed('0x0'));var util=require(_0x4aed('0x1'));var logger=require('../../config/logger')(_0x4aed('0x2'));var moment=require(_0x4aed('0x3'));var BPromise=require(_0x4aed('0x4'));var rp=require(_0x4aed('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4aed('0x6'));var config=require(_0x4aed('0x7'));var attributes=require('./chatProactiveAction.attributes');module[_0x4aed('0x8')]=function(_0xa790dc,_0xf6c793){return _0xa790dc[_0x4aed('0x9')](_0x4aed('0xa'),attributes,{'tableName':_0x4aed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x780c=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','ChatProactiveAction','chat_proactive_actions'];(function(_0x15f972,_0x4a1fc7){var _0x3d916e=function(_0x4efd86){while(--_0x4efd86){_0x15f972['push'](_0x15f972['shift']());}};_0x3d916e(++_0x4a1fc7);}(_0x780c,0x1d4));var _0xc780=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x780c[_0x12f688];return _0x59c3de;};'use strict';var _=require(_0xc780('0x0'));var util=require(_0xc780('0x1'));var logger=require(_0xc780('0x2'))(_0xc780('0x3'));var moment=require(_0xc780('0x4'));var BPromise=require(_0xc780('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc780('0x6'));var rimraf=require(_0xc780('0x7'));var config=require(_0xc780('0x8'));var attributes=require('./chatProactiveAction.attributes');module[_0xc780('0x9')]=function(_0x386312,_0x447a02){return _0x386312[_0xc780('0xa')](_0xc780('0xb'),attributes,{'tableName':_0xc780('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index c47fc59..6bb681b 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 _0x0dd0=['client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x514317,_0xee82c9){var _0x13805a=function(_0x38a89f){while(--_0x38a89f){_0x514317['push'](_0x514317['shift']());}};_0x13805a(++_0xee82c9);}(_0x0dd0,0x161));var _0x00dd=function(_0x2178c7,_0x1e0d3c){_0x2178c7=_0x2178c7-0x0;var _0x178a47=_0x0dd0[_0x2178c7];return _0x178a47;};'use strict';var _=require(_0x00dd('0x0'));var util=require(_0x00dd('0x1'));var moment=require(_0x00dd('0x2'));var BPromise=require(_0x00dd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x00dd('0x4'));var db=require(_0x00dd('0x5'))['db'];var utils=require(_0x00dd('0x6'));var logger=require(_0x00dd('0x7'))(_0x00dd('0x8'));var config=require(_0x00dd('0x9'));var jayson=require(_0x00dd('0xa'));var client=jayson[_0x00dd('0xb')][_0x00dd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1fef5f,_0x1cb701,_0x3c3312){return new BPromise(function(_0x1af189,_0x46fac5){return client[_0x00dd('0xd')](_0x1fef5f,_0x3c3312)[_0x00dd('0xe')](function(_0x502f5c){logger[_0x00dd('0xf')](_0x00dd('0x10'),_0x1cb701,'request\x20sent');logger[_0x00dd('0x11')](_0x00dd('0x12'),_0x1cb701,'request\x20sent',JSON[_0x00dd('0x13')](_0x502f5c));if(_0x502f5c[_0x00dd('0x14')]){if(_0x502f5c[_0x00dd('0x14')][_0x00dd('0x15')]===0x1f4){logger['error'](_0x00dd('0x10'),_0x1cb701,_0x502f5c[_0x00dd('0x14')][_0x00dd('0x16')]);return _0x46fac5(_0x502f5c['error'][_0x00dd('0x16')]);}logger[_0x00dd('0x14')]('ChatProactiveAction,\x20%s,\x20%s',_0x1cb701,_0x502f5c['error'][_0x00dd('0x16')]);return _0x1af189(_0x502f5c[_0x00dd('0x14')][_0x00dd('0x16')]);}else{logger[_0x00dd('0xf')](_0x00dd('0x10'),_0x1cb701,_0x00dd('0x17'));_0x1af189(_0x502f5c[_0x00dd('0x18')][_0x00dd('0x16')]);}})[_0x00dd('0x19')](function(_0x9a3fa8){logger[_0x00dd('0x14')](_0x00dd('0x10'),_0x1cb701,_0x9a3fa8);_0x46fac5(_0x9a3fa8);});});} \ No newline at end of file +var _0xd0b9=['then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x53e9c6,_0x460d70){var _0x23ef39=function(_0x3004d5){while(--_0x3004d5){_0x53e9c6['push'](_0x53e9c6['shift']());}};_0x23ef39(++_0x460d70);}(_0xd0b9,0x6f));var _0x9d0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0b9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9d0b('0x0'));var util=require(_0x9d0b('0x1'));var moment=require(_0x9d0b('0x2'));var BPromise=require(_0x9d0b('0x3'));var rs=require(_0x9d0b('0x4'));var fs=require('fs');var Redis=require(_0x9d0b('0x5'));var db=require(_0x9d0b('0x6'))['db'];var utils=require(_0x9d0b('0x7'));var logger=require(_0x9d0b('0x8'))('rpc');var config=require(_0x9d0b('0x9'));var jayson=require(_0x9d0b('0xa'));var client=jayson[_0x9d0b('0xb')][_0x9d0b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14d76f,_0x3fce59,_0x2ee830){return new BPromise(function(_0x312fac,_0xbac113){return client[_0x9d0b('0xd')](_0x14d76f,_0x2ee830)[_0x9d0b('0xe')](function(_0xaf0dd2){logger[_0x9d0b('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x3fce59,_0x9d0b('0x10'));logger[_0x9d0b('0x11')](_0x9d0b('0x12'),_0x3fce59,'request\x20sent',JSON[_0x9d0b('0x13')](_0xaf0dd2));if(_0xaf0dd2[_0x9d0b('0x14')]){if(_0xaf0dd2[_0x9d0b('0x14')]['code']===0x1f4){logger[_0x9d0b('0x14')](_0x9d0b('0x15'),_0x3fce59,_0xaf0dd2[_0x9d0b('0x14')][_0x9d0b('0x16')]);return _0xbac113(_0xaf0dd2[_0x9d0b('0x14')][_0x9d0b('0x16')]);}logger['error'](_0x9d0b('0x15'),_0x3fce59,_0xaf0dd2[_0x9d0b('0x14')][_0x9d0b('0x16')]);return _0x312fac(_0xaf0dd2['error'][_0x9d0b('0x16')]);}else{logger[_0x9d0b('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x3fce59,'request\x20sent');_0x312fac(_0xaf0dd2[_0x9d0b('0x17')][_0x9d0b('0x16')]);}})[_0x9d0b('0x18')](function(_0x384061){logger[_0x9d0b('0x14')](_0x9d0b('0x15'),_0x3fce59,_0x384061);_0xbac113(_0x384061);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index a00f96c..6151272 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 _0xd19d=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports'];(function(_0xa30766,_0x6f613e){var _0x24e780=function(_0x3d58fb){while(--_0x3d58fb){_0xa30766['push'](_0xa30766['shift']());}};_0x24e780(++_0x6f613e);}(_0xd19d,0x156));var _0xdd19=function(_0x2d6604,_0x5c52a6){_0x2d6604=_0x2d6604-0x0;var _0x27d5ea=_0xd19d[_0x2d6604];return _0x27d5ea;};'use strict';var multer=require('multer');var util=require(_0xdd19('0x0'));var path=require(_0xdd19('0x1'));var timeout=require(_0xdd19('0x2'));var express=require(_0xdd19('0x3'));var router=express[_0xdd19('0x4')]();var fs_extra=require(_0xdd19('0x5'));var auth=require(_0xdd19('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdd19('0x7'));router[_0xdd19('0x8')](_0xdd19('0x9'),auth[_0xdd19('0xa')](),controller[_0xdd19('0xb')]);router[_0xdd19('0xc')]('/',auth[_0xdd19('0xa')](),controller[_0xdd19('0xd')]);router[_0xdd19('0xe')](_0xdd19('0x9'),auth['isAuthenticated'](),controller[_0xdd19('0xf')]);router[_0xdd19('0x10')](_0xdd19('0x9'),auth[_0xdd19('0xa')](),controller[_0xdd19('0x11')]);module[_0xdd19('0x12')]=router; \ No newline at end of file +var _0xc669=['show','post','create','isAuthenticated','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./chatProactiveAction.controller','/:id'];(function(_0x53b443,_0x1669f7){var _0x32b461=function(_0x347057){while(--_0x347057){_0x53b443['push'](_0x53b443['shift']());}};_0x32b461(++_0x1669f7);}(_0xc669,0xc7));var _0x9c66=function(_0x395104,_0x5de270){_0x395104=_0x395104-0x0;var _0x4360bb=_0xc669[_0x395104];return _0x4360bb;};'use strict';var multer=require(_0x9c66('0x0'));var util=require(_0x9c66('0x1'));var path=require(_0x9c66('0x2'));var timeout=require(_0x9c66('0x3'));var express=require(_0x9c66('0x4'));var router=express['Router']();var fs_extra=require(_0x9c66('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9c66('0x6'));var config=require('../../config/environment');var controller=require(_0x9c66('0x7'));router['get'](_0x9c66('0x8'),auth['isAuthenticated'](),controller[_0x9c66('0x9')]);router[_0x9c66('0xa')]('/',auth['isAuthenticated'](),controller[_0x9c66('0xb')]);router['put'](_0x9c66('0x8'),auth[_0x9c66('0xc')](),controller[_0x9c66('0xd')]);router[_0x9c66('0xe')]('/:id',auth[_0x9c66('0xc')](),controller['destroy']);module[_0x9c66('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 3c63c6f..78b9a72 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 _0x41bd=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x5ea1b3,_0x7050cd){var _0x12c7ab=function(_0x4b3094){while(--_0x4b3094){_0x5ea1b3['push'](_0x5ea1b3['shift']());}};_0x12c7ab(++_0x7050cd);}(_0x41bd,0x14e));var _0xd41b=function(_0x417583,_0x1a9a17){_0x417583=_0x417583-0x0;var _0x35bb9f=_0x41bd[_0x417583];return _0x35bb9f;};'use strict';var Sequelize=require(_0xd41b('0x0'));module[_0xd41b('0x1')]={'name':{'type':Sequelize[_0xd41b('0x2')],'unique':_0xd41b('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd41b('0x2')]},'timeout':{'type':Sequelize[_0xd41b('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd41b('0x5')](_0xd41b('0x6'),_0xd41b('0x7'),_0xd41b('0x8'))}}; \ No newline at end of file +var _0x1bdd=['name','INTEGER','rrmemory','roundrobin','sequelize','exports','STRING'];(function(_0x12d6de,_0xccc040){var _0x32923b=function(_0x1b150f){while(--_0x1b150f){_0x12d6de['push'](_0x12d6de['shift']());}};_0x32923b(++_0xccc040);}(_0x1bdd,0x10e));var _0xd1bd=function(_0x3e762f,_0x52155f){_0x3e762f=_0x3e762f-0x0;var _0x5277a3=_0x1bdd[_0x3e762f];return _0x5277a3;};'use strict';var Sequelize=require(_0xd1bd('0x0'));module[_0xd1bd('0x1')]={'name':{'type':Sequelize[_0xd1bd('0x2')],'unique':_0xd1bd('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd1bd('0x2')]},'timeout':{'type':Sequelize[_0xd1bd('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xd1bd('0x5'),'beepall',_0xd1bd('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 206f181..f7ed889 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 _0xef8a=['filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','order','ChatQueueId','User','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','each','UserChatQueue','forEach','emit','userChatQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_chat_queues','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT','TeamId','value','transaction','isEmpty','userChatQueue:remove','addAgents','omit','removeAgents','isArray','getAgents','html-pdf','eml-format','rimraf','moment','bluebird','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','register','jayson/promise','client','http','request','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','ChatQueues','UserProfileResource','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','key','keys'];(function(_0x1b672b,_0x384132){var _0x31f42e=function(_0x2f2604){while(--_0x2f2604){_0x1b672b['push'](_0x1b672b['shift']());}};_0x31f42e(++_0x384132);}(_0xef8a,0xed));var _0xaef8=function(_0x51ec61,_0xf9d1e3){_0x51ec61=_0x51ec61-0x0;var _0x223200=_0xef8a[_0x51ec61];return _0x223200;};'use strict';var pdf=require(_0xaef8('0x0'));var emlformat=require(_0xaef8('0x1'));var rimraf=require(_0xaef8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xaef8('0x3'));var BPromise=require(_0xaef8('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xaef8('0x5'));var sox=require(_0xaef8('0x6'));var csv=require(_0xaef8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaef8('0x8'));var _=require(_0xaef8('0x9'));var squel=require('squel');var crypto=require(_0xaef8('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xaef8('0xb'));var toCsv=require(_0xaef8('0x7'));var querystring=require(_0xaef8('0xc'));var Papa=require(_0xaef8('0xd'));var Redis=require(_0xaef8('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xaef8('0xf'));var as=require(_0xaef8('0x10'));var hardwareService=require(_0xaef8('0x11'));var logger=require(_0xaef8('0x12'))(_0xaef8('0x13'));var utils=require(_0xaef8('0x14'));var config=require(_0xaef8('0x15'));var licenseUtil=require(_0xaef8('0x16'));var db=require(_0xaef8('0x17'))['db'];config['redis']=_[_0xaef8('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xaef8('0x19'))(new Redis(config[_0xaef8('0x1a')]));require('./chatQueue.socket')[_0xaef8('0x1b')](socket);var jayson=require(_0xaef8('0x1c'));var client=jayson[_0xaef8('0x1d')][_0xaef8('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x53d6d5,_0x5e9967,_0x30d4ba,_0x30557a){return new BPromise(function(_0x2aba76,_0x197d2b){var _0x3a033a=_0x30557a||client;return _0x3a033a[_0xaef8('0x1f')](_0x53d6d5,_0x30d4ba)['then'](function(_0x5f0ba9){logger[_0xaef8('0x20')](_0xaef8('0x21'),_0x5e9967,'request\x20sent');logger[_0xaef8('0x22')](_0xaef8('0x23'),_0x5e9967,_0xaef8('0x24'),JSON[_0xaef8('0x25')](_0x5f0ba9));if(_0x5f0ba9['error']){if(_0x5f0ba9[_0xaef8('0x26')][_0xaef8('0x27')]===0x1f4){logger[_0xaef8('0x26')](_0xaef8('0x21'),_0x5e9967,_0x5f0ba9[_0xaef8('0x26')]['message']);return _0x197d2b(_0x5f0ba9['error'][_0xaef8('0x28')]);}logger[_0xaef8('0x26')](_0xaef8('0x21'),_0x5e9967,_0x5f0ba9[_0xaef8('0x26')][_0xaef8('0x28')]);return _0x2aba76(_0x5f0ba9[_0xaef8('0x26')]['message']);}else{logger[_0xaef8('0x20')](_0xaef8('0x21'),_0x5e9967,_0xaef8('0x24'));_0x2aba76(_0x5f0ba9[_0xaef8('0x29')][_0xaef8('0x28')]);}})['catch'](function(_0x563aa9){logger[_0xaef8('0x26')](_0xaef8('0x21'),_0x5e9967,_0x563aa9);_0x197d2b(_0x563aa9);});});}function respondWithStatusCode(_0x399396,_0x31cc46){_0x31cc46=_0x31cc46||0xcc;return function(_0x340a00){if(_0x340a00){return _0x399396[_0xaef8('0x2a')](_0x31cc46);}return _0x399396[_0xaef8('0x2b')](_0x31cc46)[_0xaef8('0x2c')]();};}function respondWithResult(_0x2cd37d,_0x25c425){_0x25c425=_0x25c425||0xc8;return function(_0x2c0920){if(_0x2c0920){return _0x2cd37d[_0xaef8('0x2b')](_0x25c425)[_0xaef8('0x2d')](_0x2c0920);}};}function respondWithFilteredResult(_0x35ad74,_0x51defd){return function(_0x260c9f){if(_0x260c9f){var _0x1d90c9=_0x260c9f[_0xaef8('0x2e')],_0x50cbb4=_0x51defd[_0xaef8('0x2f')],_0x58cabc=_0x51defd[_0xaef8('0x2f')]+_0x51defd[_0xaef8('0x30')],_0x58e590;if(_0x58cabc>=_0x1d90c9){_0x58cabc=_0x1d90c9;_0x58e590=0xc8;}else{_0x58e590=0xce;}_0x35ad74['status'](_0x58e590);return _0x35ad74[_0xaef8('0x31')](_0xaef8('0x32'),_0x50cbb4+'-'+_0x58cabc+'/'+_0x1d90c9)['json'](_0x260c9f);}return null;};}function patchUpdates(_0x4329f1){return function(_0x77b59){try{jsonpatch['apply'](_0x77b59,_0x4329f1,!![]);}catch(_0x4d4566){return BPromise[_0xaef8('0x33')](_0x4d4566);}return _0x77b59[_0xaef8('0x34')]();};}function saveUpdates(_0x5c4108,_0x5acec4){return function(_0x3c8a9c){if(_0x3c8a9c){return _0x3c8a9c[_0xaef8('0x35')](_0x5c4108)[_0xaef8('0x36')](function(_0x3bc99a){return _0x3bc99a;});}return null;};}function removeEntity(_0x477b0a,_0x5595b1){return function(_0x57494c){if(_0x57494c){return _0x57494c[_0xaef8('0x37')]()[_0xaef8('0x36')](function(){var _0x3097ee=_0x57494c[_0xaef8('0x38')]({'plain':!![]});var _0x541804=_0xaef8('0x39');return db[_0xaef8('0x3a')][_0xaef8('0x37')]({'where':{'type':_0x541804,'resourceId':_0x3097ee['id']}})[_0xaef8('0x36')](function(){return _0x57494c;});})[_0xaef8('0x36')](function(){_0x477b0a[_0xaef8('0x2b')](0xcc)[_0xaef8('0x2c')]();});}};}function handleEntityNotFound(_0xcfe93,_0x80dbe1){return function(_0x37a7fb){if(!_0x37a7fb){_0xcfe93[_0xaef8('0x2a')](0x194);}return _0x37a7fb;};}function handleError(_0x3ca673,_0xcd2b3e){_0xcd2b3e=_0xcd2b3e||0x1f4;return function(_0x37ca4e){logger[_0xaef8('0x26')](_0x37ca4e[_0xaef8('0x3b')]);if(_0x37ca4e[_0xaef8('0x3c')]){delete _0x37ca4e[_0xaef8('0x3c')];}_0x3ca673[_0xaef8('0x2b')](_0xcd2b3e)[_0xaef8('0x3d')](_0x37ca4e);};}exports[_0xaef8('0x3e')]=function(_0x5530eb,_0x29ed10){var _0x301480={},_0x5179b9={},_0xe5969f={'count':0x0,'rows':[]};var _0x518f46=_[_0xaef8('0x3f')](db[_0xaef8('0x40')][_0xaef8('0x41')],function(_0x507634){return{'name':_0x507634[_0xaef8('0x42')],'type':_0x507634['type'][_0xaef8('0x43')]};});_0x5179b9['model']=_[_0xaef8('0x3f')](_0x518f46,_0xaef8('0x3c'));_0x5179b9['query']=_[_0xaef8('0x44')](_0x5530eb['query']);_0x5179b9[_0xaef8('0x45')]=_[_0xaef8('0x46')](_0x5179b9[_0xaef8('0x47')],_0x5179b9[_0xaef8('0x48')]);_0x301480[_0xaef8('0x49')]=_[_0xaef8('0x46')](_0x5179b9['model'],qs[_0xaef8('0x4a')](_0x5530eb[_0xaef8('0x48')][_0xaef8('0x4a')]));_0x301480['attributes']=_0x301480[_0xaef8('0x49')][_0xaef8('0x4b')]?_0x301480[_0xaef8('0x49')]:_0x5179b9[_0xaef8('0x47')];if(!_0x5530eb[_0xaef8('0x48')][_0xaef8('0x4c')](_0xaef8('0x4d'))){_0x301480['limit']=qs[_0xaef8('0x30')](_0x5530eb[_0xaef8('0x48')]['limit']);_0x301480['offset']=qs[_0xaef8('0x2f')](_0x5530eb[_0xaef8('0x48')]['offset']);}_0x301480['order']=qs[_0xaef8('0x4e')](_0x5530eb[_0xaef8('0x48')][_0xaef8('0x4e')]);_0x301480[_0xaef8('0x4f')]=qs['filters'](_[_0xaef8('0x50')](_0x5530eb['query'],_0x5179b9[_0xaef8('0x45')]),_0x518f46);if(_0x5530eb[_0xaef8('0x48')]['filter']){_0x301480['where']=_[_0xaef8('0x51')](_0x301480[_0xaef8('0x4f')],{'$or':_['map'](_0x518f46,function(_0x45043f){if(_0x45043f['type']!==_0xaef8('0x52')){var _0x4c81c9={};_0x4c81c9[_0x45043f['name']]={'$like':'%'+_0x5530eb['query'][_0xaef8('0x53')]+'%'};return _0x4c81c9;}})});}_0x301480=_[_0xaef8('0x51')]({},_0x301480,_0x5530eb[_0xaef8('0x54')]);var _0x1b3ab6={'where':_0x301480[_0xaef8('0x4f')]};return db['ChatQueue'][_0xaef8('0x2e')](_0x1b3ab6)[_0xaef8('0x36')](function(_0x16ebea){_0xe5969f[_0xaef8('0x2e')]=_0x16ebea;if(_0x5530eb[_0xaef8('0x48')]['includeAll']){_0x301480[_0xaef8('0x55')]=[{'all':!![]}];}return db[_0xaef8('0x40')][_0xaef8('0x56')](_0x301480);})[_0xaef8('0x36')](function(_0x1e9d06){_0xe5969f[_0xaef8('0x57')]=_0x1e9d06;return _0xe5969f;})[_0xaef8('0x36')](respondWithFilteredResult(_0x29ed10,_0x301480))[_0xaef8('0x58')](handleError(_0x29ed10,null));};exports[_0xaef8('0x59')]=function(_0x514ad7,_0x238b46){var _0x3e1380={'raw':!![],'where':{'id':_0x514ad7[_0xaef8('0x5a')]['id']}},_0x57cc1a={};_0x57cc1a[_0xaef8('0x47')]=_[_0xaef8('0x44')](db[_0xaef8('0x40')][_0xaef8('0x41')]);_0x57cc1a[_0xaef8('0x48')]=_[_0xaef8('0x44')](_0x514ad7[_0xaef8('0x48')]);_0x57cc1a[_0xaef8('0x45')]=_[_0xaef8('0x46')](_0x57cc1a[_0xaef8('0x47')],_0x57cc1a[_0xaef8('0x48')]);_0x3e1380[_0xaef8('0x49')]=_[_0xaef8('0x46')](_0x57cc1a[_0xaef8('0x47')],qs[_0xaef8('0x4a')](_0x514ad7['query'][_0xaef8('0x4a')]));_0x3e1380[_0xaef8('0x49')]=_0x3e1380[_0xaef8('0x49')][_0xaef8('0x4b')]?_0x3e1380[_0xaef8('0x49')]:_0x57cc1a[_0xaef8('0x47')];if(_0x514ad7['query'][_0xaef8('0x5b')]){_0x3e1380[_0xaef8('0x55')]=[{'all':!![]}];}_0x3e1380=_[_0xaef8('0x51')]({},_0x3e1380,_0x514ad7[_0xaef8('0x54')]);return db[_0xaef8('0x40')]['find'](_0x3e1380)[_0xaef8('0x36')](handleEntityNotFound(_0x238b46,null))['then'](respondWithResult(_0x238b46,null))['catch'](handleError(_0x238b46,null));};exports[_0xaef8('0x5c')]=function(_0x2c3bbd,_0x5d335d){return db[_0xaef8('0x40')][_0xaef8('0x5c')](_0x2c3bbd[_0xaef8('0x5d')],{})['then'](function(_0x46e076){var _0x47270d=_0x2c3bbd[_0xaef8('0x5e')]['get']({'plain':!![]});if(!_0x47270d)throw new Error(_0xaef8('0x5f'));if(_0x47270d[_0xaef8('0x60')]===_0xaef8('0x5e')){var _0x5cac78=_0x46e076['get']({'plain':!![]});var _0x138381='ChatQueues';return db[_0xaef8('0x61')][_0xaef8('0x62')]({'where':{'name':_0x138381,'userProfileId':_0x47270d[_0xaef8('0x63')]},'raw':!![]})[_0xaef8('0x36')](function(_0x1035d6){if(_0x1035d6&&_0x1035d6[_0xaef8('0x64')]===0x0){return db[_0xaef8('0x3a')][_0xaef8('0x5c')]({'name':_0x5cac78['name'],'resourceId':_0x5cac78['id'],'type':_0x1035d6['name'],'sectionId':_0x1035d6['id']},{})[_0xaef8('0x36')](function(){return _0x46e076;});}else{return _0x46e076;}})[_0xaef8('0x58')](function(_0x1df2cd){logger['error'](_0xaef8('0x65'),_0x1df2cd);throw _0x1df2cd;});}return _0x46e076;})['then'](respondWithResult(_0x5d335d,0xc9))[_0xaef8('0x58')](handleError(_0x5d335d,null));};exports[_0xaef8('0x35')]=function(_0x14cada,_0x500571){if(_0x14cada[_0xaef8('0x5d')]['id']){delete _0x14cada[_0xaef8('0x5d')]['id'];}return db[_0xaef8('0x40')][_0xaef8('0x62')]({'where':{'id':_0x14cada[_0xaef8('0x5a')]['id']}})[_0xaef8('0x36')](handleEntityNotFound(_0x500571,null))[_0xaef8('0x36')](saveUpdates(_0x14cada[_0xaef8('0x5d')],null))[_0xaef8('0x36')](respondWithResult(_0x500571,null))[_0xaef8('0x58')](handleError(_0x500571,null));};exports[_0xaef8('0x37')]=function(_0x1f1141,_0x40d483){return db[_0xaef8('0x40')][_0xaef8('0x62')]({'where':{'id':_0x1f1141['params']['id']}})[_0xaef8('0x36')](handleEntityNotFound(_0x40d483,null))[_0xaef8('0x36')](removeEntity(_0x40d483,null))[_0xaef8('0x58')](handleError(_0x40d483,null));};exports[_0xaef8('0x66')]=function(_0x9effdb,_0x2c6d40){return db[_0xaef8('0x40')][_0xaef8('0x66')]()['then'](respondWithResult(_0x2c6d40,null))[_0xaef8('0x58')](handleError(_0x2c6d40,null));};exports[_0xaef8('0x67')]=function(_0x119560,_0x2e4b5d,_0x540c88){var _0x7cd8c8={'raw':!![],'where':{}},_0x22ce57={},_0x45386c;return db['ChatQueue'][_0xaef8('0x68')]({'where':{'id':_0x119560['params']['id']}})[_0xaef8('0x36')](handleEntityNotFound(_0x2e4b5d,null))[_0xaef8('0x36')](function(_0x27b467){if(_0x27b467){_0x45386c=_0x27b467[_0xaef8('0x38')]({'plain':!![]});_0x22ce57['model']=_[_0xaef8('0x44')](db['UserChatQueue'][_0xaef8('0x41')]);_0x22ce57[_0xaef8('0x48')]=_['keys'](_0x119560[_0xaef8('0x48')]);_0x22ce57['filters']=_[_0xaef8('0x46')](_0x22ce57[_0xaef8('0x47')],_0x22ce57['query']);_0x7cd8c8[_0xaef8('0x49')]=_['intersection'](_0x22ce57[_0xaef8('0x47')],qs[_0xaef8('0x4a')](_0x119560[_0xaef8('0x48')][_0xaef8('0x4a')]));_0x7cd8c8[_0xaef8('0x49')]=_0x7cd8c8[_0xaef8('0x49')][_0xaef8('0x4b')]?_0x7cd8c8[_0xaef8('0x49')]:_0x22ce57[_0xaef8('0x47')];if(!_0x119560['query']['hasOwnProperty'](_0xaef8('0x4d'))){_0x7cd8c8['limit']=qs[_0xaef8('0x30')](_0x119560[_0xaef8('0x48')][_0xaef8('0x30')]);_0x7cd8c8[_0xaef8('0x2f')]=qs['offset'](_0x119560['query'][_0xaef8('0x2f')]);}_0x7cd8c8[_0xaef8('0x69')]=qs['sort'](_0x119560[_0xaef8('0x48')]['sort']);_0x7cd8c8['where']=qs[_0xaef8('0x45')](_[_0xaef8('0x50')](_0x119560[_0xaef8('0x48')],_0x22ce57[_0xaef8('0x45')]));_0x7cd8c8[_0xaef8('0x4f')][_0xaef8('0x6a')]=_0x27b467['id'];if(_0x119560['query'][_0xaef8('0x53')]){_0x7cd8c8['where']=_[_0xaef8('0x51')](_0x7cd8c8[_0xaef8('0x4f')],{'$or':_[_0xaef8('0x3f')](_0x7cd8c8[_0xaef8('0x49')],function(_0x576d96){var _0x53783a={};_0x53783a[_0x576d96]={'$like':'%'+_0x119560[_0xaef8('0x48')][_0xaef8('0x53')]+'%'};return _0x53783a;})});}_0x7cd8c8=_[_0xaef8('0x51')]({},_0x7cd8c8,_0x119560[_0xaef8('0x54')]);return db['UserChatQueue'][_0xaef8('0x56')](_0x7cd8c8);}})[_0xaef8('0x36')](function(_0x5012f3){if(_0x5012f3){return db[_0xaef8('0x6b')]['findAndCountAll']({'where':{'id':_[_0xaef8('0x3f')](_0x5012f3,_0xaef8('0x6c')),'role':_0xaef8('0x6d')},'attributes':['id',_0xaef8('0x3c'),_0xaef8('0x6e'),_0xaef8('0x6f'),_0xaef8('0x70')]});}})['then'](function(_0x204d03){if(_0x204d03){return{'count':_0x204d03[_0xaef8('0x2e')],'rows':_[_0xaef8('0x3f')](_0x204d03[_0xaef8('0x57')],function(_0x434ea7){return{'membername':_0x434ea7['name'],'UserId':_0x434ea7['id'],'queue_name':_0x45386c['name'],'ChatQueueId':_0x45386c['id'],'interface':util[_0xaef8('0x71')](_0xaef8('0x72'),_0xaef8('0x73'),_0x434ea7[_0xaef8('0x3c')]),'penalty':0x0,'paused':_0x434ea7[_0xaef8('0x6e')],'createdAt':_0x434ea7[_0xaef8('0x70')],'updatedAt':_0x434ea7[_0xaef8('0x6f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xaef8('0x36')](respondWithFilteredResult(_0x2e4b5d,_0x7cd8c8))[_0xaef8('0x58')](handleError(_0x2e4b5d,null));};exports[_0xaef8('0x74')]=function(_0x38300b,_0x42be7f,_0x426af3){var _0x4722b6={};var _0x43bd9f={};var _0x383ca2;var _0x2360d0;return db[_0xaef8('0x40')]['findOne']({'where':{'id':_0x38300b[_0xaef8('0x5a')]['id']}})[_0xaef8('0x36')](handleEntityNotFound(_0x42be7f,null))['then'](function(_0x3666b6){if(_0x3666b6){_0x383ca2=_0x3666b6;_0x43bd9f[_0xaef8('0x47')]=_[_0xaef8('0x44')](db[_0xaef8('0x75')][_0xaef8('0x41')]);_0x43bd9f['query']=_[_0xaef8('0x44')](_0x38300b[_0xaef8('0x48')]);_0x43bd9f[_0xaef8('0x45')]=_[_0xaef8('0x46')](_0x43bd9f[_0xaef8('0x47')],_0x43bd9f[_0xaef8('0x48')]);_0x4722b6['attributes']=_['intersection'](_0x43bd9f[_0xaef8('0x47')],qs[_0xaef8('0x4a')](_0x38300b[_0xaef8('0x48')][_0xaef8('0x4a')]));_0x4722b6[_0xaef8('0x49')]=_0x4722b6[_0xaef8('0x49')][_0xaef8('0x4b')]?_0x4722b6[_0xaef8('0x49')]:_0x43bd9f[_0xaef8('0x47')];_0x4722b6[_0xaef8('0x69')]=qs[_0xaef8('0x4e')](_0x38300b['query'][_0xaef8('0x4e')]);_0x4722b6['where']=qs['filters'](_[_0xaef8('0x50')](_0x38300b[_0xaef8('0x48')],_0x43bd9f['filters']));if(_0x38300b[_0xaef8('0x48')]['filter']){_0x4722b6[_0xaef8('0x4f')]=_[_0xaef8('0x51')](_0x4722b6[_0xaef8('0x4f')],{'$or':_[_0xaef8('0x3f')](_0x4722b6[_0xaef8('0x49')],function(_0x164e8c){var _0x90bab8={};_0x90bab8[_0x164e8c]={'$like':'%'+_0x38300b[_0xaef8('0x48')]['filter']+'%'};return _0x90bab8;})});}_0x4722b6=_[_0xaef8('0x51')]({},_0x4722b6,_0x38300b[_0xaef8('0x54')]);return _0x383ca2['getTeams'](_0x4722b6);}})[_0xaef8('0x36')](function(_0x180fab){if(_0x180fab){_0x2360d0=_0x180fab[_0xaef8('0x4b')];if(!_0x38300b[_0xaef8('0x48')][_0xaef8('0x4c')](_0xaef8('0x4d'))){_0x4722b6[_0xaef8('0x30')]=qs['limit'](_0x38300b[_0xaef8('0x48')]['limit']);_0x4722b6[_0xaef8('0x2f')]=qs['offset'](_0x38300b[_0xaef8('0x48')][_0xaef8('0x2f')]);}return _0x383ca2['getTeams'](_0x4722b6);}})['then'](function(_0x204247){if(_0x204247){return _0x204247?{'count':_0x2360d0,'rows':_0x204247}:null;}})['then'](respondWithResult(_0x42be7f,null))[_0xaef8('0x58')](handleError(_0x42be7f,null));};exports[_0xaef8('0x76')]=function(_0xacb2bb,_0x4a13cf,_0x157e82){var _0x1ee743=_0xacb2bb[_0xaef8('0x5d')]['ids'];return db[_0xaef8('0x75')][_0xaef8('0x56')]({'where':{'id':_0x1ee743},'attributes':['id'],'include':[{'model':db[_0xaef8('0x6b')],'as':_0xaef8('0x77'),'attributes':['id',_0xaef8('0x3c'),_0xaef8('0x78'),_0xaef8('0x79'),_0xaef8('0x7a')],'raw':!![]}]})[_0xaef8('0x36')](function(_0x26e97c){if(_0x26e97c){var _0x120575=_[_0xaef8('0x7b')](_0x26e97c,function(_0x5ee2ff){var _0x3204b7=_0x5ee2ff[_0xaef8('0x38')]({'plain':!![]});return _0x3204b7[_0xaef8('0x77')];});return db[_0xaef8('0x40')][_0xaef8('0x62')]({'where':{'id':_0xacb2bb[_0xaef8('0x5a')]['id']}})[_0xaef8('0x36')](function(_0x4b3654){return db[_0xaef8('0x7c')]['transaction'](function(_0x4c89da){return _0x4b3654['addTeams'](_0x1ee743,{'transaction':_0x4c89da})[_0xaef8('0x36')](function(){return BPromise[_0xaef8('0x7d')](_0x120575,function(_0x13c986){return db[_0xaef8('0x7e')]['findOrCreate']({'where':{'UserId':_0x13c986['id'],'ChatQueueId':_0xacb2bb[_0xaef8('0x5a')]['id']},'transaction':_0x4c89da});});})[_0xaef8('0x36')](function(){_0x120575[_0xaef8('0x7f')](function(_0x400ae3){socket[_0xaef8('0x80')](_0xaef8('0x81'),{'UserId':_0x400ae3['id'],'ChatQueueId':_0x4b3654['id']});});});});});}})['then'](respondWithStatusCode(_0x4a13cf,null))[_0xaef8('0x58')](handleError(_0x4a13cf,null));};exports[_0xaef8('0x82')]=function(_0x316b8f,_0x37304f,_0x9a7a63){return db[_0xaef8('0x75')][_0xaef8('0x56')]({'where':{'id':_0x316b8f['query'][_0xaef8('0x83')]},'attributes':['id'],'include':[{'model':db[_0xaef8('0x6b')],'as':_0xaef8('0x77'),'attributes':['id'],'raw':!![]}]})[_0xaef8('0x36')](handleEntityNotFound(_0x37304f,null))[_0xaef8('0x36')](function(_0x4e6b4a){var _0xd85d2a=_[_0xaef8('0x3f')](_0x4e6b4a,'id');var _0x1e1b4a=[];var _0xb622a9=[];var _0x42df26=squel[_0xaef8('0x84')]();_0x42df26[_0xaef8('0x85')](_0xaef8('0x86'))[_0xaef8('0x87')](_0xaef8('0x88'),'tq')['join']('user_has_teams','ut',_0xaef8('0x89'))[_0xaef8('0x4f')](_0xaef8('0x8a'),_0x316b8f[_0xaef8('0x5a')]['id']);for(var _0x558afd=0x0;_0x558afd<_0x4e6b4a[_0xaef8('0x4b')];_0x558afd+=0x1){let _0x576074=_0x4e6b4a[_0x558afd];for(var _0x86a2ca=0x0;_0x86a2ca<_0x576074['Agents'][_0xaef8('0x4b')];_0x86a2ca+=0x1){let _0x1e2dd8=_0x576074['Agents'][_0x86a2ca];var _0x30ca08=_0x42df26[_0xaef8('0x8b')]();_0x30ca08['where'](_0xaef8('0x8c'),_0x1e2dd8['id']);_0xb622a9[_0xaef8('0x8d')](db[_0xaef8('0x7c')][_0xaef8('0x48')](_0x30ca08['toString'](),{'type':db[_0xaef8('0x7c')]['QueryTypes'][_0xaef8('0x8e')]})['then'](function(_0x120096){if(_0x120096[_0xaef8('0x4b')]===0x1){return _0x1e2dd8['id'];}else{var _0x1076e7=_['every'](_[_0xaef8('0x3f')](_0x120096,_0xaef8('0x8f')),function(_0x48c341){return _['includes'](_0xd85d2a,_0x48c341);});if(_0x1076e7){return _0x1e2dd8['id'];}}}));}}return BPromise['all'](_0xb622a9)[_0xaef8('0x36')](function(_0x4674b5){_0x1e1b4a=_(_0x1e1b4a)['union'](_0x4674b5)['compact']()[_0xaef8('0x90')]();return db[_0xaef8('0x40')][_0xaef8('0x62')]({'where':{'id':_0x316b8f['params']['id']}})[_0xaef8('0x36')](function(_0x51abb5){return db[_0xaef8('0x7c')][_0xaef8('0x91')](function(_0x1bd5e2){return _0x51abb5['removeTeams'](_0x316b8f[_0xaef8('0x48')][_0xaef8('0x83')],{'transaction':_0x1bd5e2})[_0xaef8('0x36')](function(){if(!_[_0xaef8('0x92')](_0x1e1b4a)){return _0x51abb5['removeAgents'](_0x1e1b4a,{'transaction':_0x1bd5e2});}})[_0xaef8('0x36')](function(){_0x1e1b4a[_0xaef8('0x7f')](function(_0x2397c9){socket['emit'](_0xaef8('0x93'),{'UserId':_0x2397c9,'ChatQueueId':_0x51abb5['id']});});});});});});})[_0xaef8('0x36')](respondWithStatusCode(_0x37304f,null))[_0xaef8('0x58')](handleError(_0x37304f,null));};exports[_0xaef8('0x94')]=function(_0x515fe9,_0x1054b7,_0x57cfa0){return db[_0xaef8('0x40')][_0xaef8('0x62')]({'where':{'id':_0x515fe9[_0xaef8('0x5a')]['id']}})[_0xaef8('0x36')](handleEntityNotFound(_0x1054b7,null))[_0xaef8('0x36')](function(_0x206288){if(_0x206288){return _0x206288[_0xaef8('0x94')](_0x515fe9[_0xaef8('0x5d')][_0xaef8('0x83')],_[_0xaef8('0x95')](_0x515fe9[_0xaef8('0x5d')],['ids','id'])||{})['spread'](function(_0xfe42bc){for(var _0x453f76=0x0;_0x453f76<_0x515fe9['body']['ids'][_0xaef8('0x4b')];_0x453f76+=0x1){socket[_0xaef8('0x80')]('userChatQueue:save',{'UserId':_0x515fe9[_0xaef8('0x5d')]['ids'][_0x453f76],'ChatQueueId':_0x515fe9[_0xaef8('0x5a')]['id']});}return _0xfe42bc;});}})[_0xaef8('0x36')](respondWithResult(_0x1054b7,null))[_0xaef8('0x58')](handleError(_0x1054b7,null));};exports[_0xaef8('0x96')]=function(_0x398218,_0x476076,_0x389a1b){return db[_0xaef8('0x40')][_0xaef8('0x62')]({'where':{'id':_0x398218[_0xaef8('0x5a')]['id']}})['then'](handleEntityNotFound(_0x476076,null))['then'](function(_0x10c9f6){if(_0x10c9f6){return _0x10c9f6[_0xaef8('0x96')](_0x398218[_0xaef8('0x48')][_0xaef8('0x83')])['then'](function(){if(_[_0xaef8('0x97')](_0x398218[_0xaef8('0x48')]['ids'])){for(var _0x35e08e=0x0;_0x35e08e<_0x398218[_0xaef8('0x48')][_0xaef8('0x83')][_0xaef8('0x4b')];_0x35e08e+=0x1){socket['emit'](_0xaef8('0x93'),{'UserId':Number(_0x398218[_0xaef8('0x48')][_0xaef8('0x83')][_0x35e08e]),'ChatQueueId':Number(_0x398218[_0xaef8('0x5a')]['id'])});}}else{socket[_0xaef8('0x80')](_0xaef8('0x93'),{'UserId':Number(_0x398218['query']['ids']),'ChatQueueId':Number(_0x398218['params']['id'])});}});}})[_0xaef8('0x36')](respondWithStatusCode(_0x476076,null))[_0xaef8('0x58')](handleError(_0x476076,null));};exports[_0xaef8('0x98')]=function(_0x5df913,_0x1d26e4,_0x4975d3){var _0x68879c={};var _0x489b87={};var _0x1d2fa6;var _0x571dfb;return db[_0xaef8('0x40')]['findOne']({'where':{'id':_0x5df913[_0xaef8('0x5a')]['id']}})[_0xaef8('0x36')](handleEntityNotFound(_0x1d26e4,null))[_0xaef8('0x36')](function(_0x154cb5){if(_0x154cb5){_0x1d2fa6=_0x154cb5;_0x489b87[_0xaef8('0x47')]=_[_0xaef8('0x44')](db[_0xaef8('0x6b')][_0xaef8('0x41')]);_0x489b87[_0xaef8('0x48')]=_[_0xaef8('0x44')](_0x5df913['query']);_0x489b87[_0xaef8('0x45')]=_['intersection'](_0x489b87[_0xaef8('0x47')],_0x489b87[_0xaef8('0x48')]);_0x68879c[_0xaef8('0x49')]=_[_0xaef8('0x46')](_0x489b87[_0xaef8('0x47')],qs[_0xaef8('0x4a')](_0x5df913[_0xaef8('0x48')][_0xaef8('0x4a')]));_0x68879c[_0xaef8('0x49')]=_0x68879c['attributes'][_0xaef8('0x4b')]?_0x68879c['attributes']:_0x489b87[_0xaef8('0x47')];_0x68879c['order']=qs[_0xaef8('0x4e')](_0x5df913[_0xaef8('0x48')]['sort']);_0x68879c[_0xaef8('0x4f')]=qs[_0xaef8('0x45')](_[_0xaef8('0x50')](_0x5df913['query'],_0x489b87[_0xaef8('0x45')]));if(_0x5df913[_0xaef8('0x48')][_0xaef8('0x53')]){_0x68879c[_0xaef8('0x4f')]=_[_0xaef8('0x51')](_0x68879c[_0xaef8('0x4f')],{'$or':_[_0xaef8('0x3f')](_0x68879c[_0xaef8('0x49')],function(_0x9a6432){var _0x535103={};_0x535103[_0x9a6432]={'$like':'%'+_0x5df913[_0xaef8('0x48')][_0xaef8('0x53')]+'%'};return _0x535103;})});}_0x68879c=_[_0xaef8('0x51')]({},_0x68879c,_0x5df913[_0xaef8('0x54')]);return _0x1d2fa6['getAgents'](_0x68879c);}})[_0xaef8('0x36')](function(_0x565722){if(_0x565722){_0x571dfb=_0x565722[_0xaef8('0x4b')];if(!_0x5df913['query'][_0xaef8('0x4c')]('nolimit')){_0x68879c[_0xaef8('0x30')]=qs['limit'](_0x5df913[_0xaef8('0x48')]['limit']);_0x68879c[_0xaef8('0x2f')]=qs[_0xaef8('0x2f')](_0x5df913[_0xaef8('0x48')]['offset']);}return _0x1d2fa6[_0xaef8('0x98')](_0x68879c);}})[_0xaef8('0x36')](function(_0x280d55){if(_0x280d55){return _0x280d55?{'count':_0x571dfb,'rows':_0x280d55}:null;}})[_0xaef8('0x36')](respondWithResult(_0x1d26e4,null))[_0xaef8('0x58')](handleError(_0x1d26e4,null));}; \ No newline at end of file +var _0x6dec=['localhost','socket.io-emitter','./chatQueue.socket','jayson/promise','client','http','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','ChatQueues','UserProfileResource','end','stack','name','send','index','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','include','ChatQueue','findAll','rows','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','params','describe','getMembers','findOne','UserChatQueue','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','getTeams','rawAttributes','hasOwnProperty','addTeams','ids','Team','Agents','online','flatMap','sequelize','transaction','findOrCreate','forEach','userChatQueue:save','removeTeams','select','tq.TeamId','from','team_has_chat_queues','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','includes','compact','isEmpty','omit','spread','removeAgents','isArray','emit','userChatQueue:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults'];(function(_0xa9eaa0,_0x4ba2b4){var _0x30897a=function(_0x2caa01){while(--_0x2caa01){_0xa9eaa0['push'](_0xa9eaa0['shift']());}};_0x30897a(++_0x4ba2b4);}(_0x6dec,0x10e));var _0xc6de=function(_0x53706d,_0x2fd138){_0x53706d=_0x53706d-0x0;var _0x214e8b=_0x6dec[_0x53706d];return _0x214e8b;};'use strict';var pdf=require(_0xc6de('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc6de('0x1'));var zipdir=require(_0xc6de('0x2'));var jsonpatch=require(_0xc6de('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc6de('0x4'));var Mustache=require(_0xc6de('0x5'));var util=require(_0xc6de('0x6'));var path=require(_0xc6de('0x7'));var sox=require(_0xc6de('0x8'));var csv=require(_0xc6de('0x9'));var ejs=require(_0xc6de('0xa'));var fs=require('fs');var fs_extra=require(_0xc6de('0xb'));var _=require(_0xc6de('0xc'));var squel=require(_0xc6de('0xd'));var crypto=require(_0xc6de('0xe'));var jsforce=require(_0xc6de('0xf'));var deskjs=require(_0xc6de('0x10'));var toCsv=require(_0xc6de('0x9'));var querystring=require(_0xc6de('0x11'));var Papa=require(_0xc6de('0x12'));var Redis=require(_0xc6de('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xc6de('0x14'));var as=require(_0xc6de('0x15'));var hardwareService=require(_0xc6de('0x16'));var logger=require(_0xc6de('0x17'))(_0xc6de('0x18'));var utils=require('../../config/utils');var config=require(_0xc6de('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xc6de('0x1a')]=_[_0xc6de('0x1b')](config[_0xc6de('0x1a')],{'host':_0xc6de('0x1c'),'port':0x18eb});var socket=require(_0xc6de('0x1d'))(new Redis(config[_0xc6de('0x1a')]));require(_0xc6de('0x1e'))['register'](socket);var jayson=require(_0xc6de('0x1f'));var client=jayson[_0xc6de('0x20')][_0xc6de('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x2d3109,_0x53fba0,_0x290cee,_0x133117){return new BPromise(function(_0x2ec7eb,_0x3173c5){var _0x547f01=_0x133117||client;return _0x547f01['request'](_0x2d3109,_0x290cee)['then'](function(_0x5a3a05){logger[_0xc6de('0x22')](_0xc6de('0x23'),_0x53fba0,_0xc6de('0x24'));logger[_0xc6de('0x25')](_0xc6de('0x26'),_0x53fba0,_0xc6de('0x24'),JSON['stringify'](_0x5a3a05));if(_0x5a3a05[_0xc6de('0x27')]){if(_0x5a3a05[_0xc6de('0x27')][_0xc6de('0x28')]===0x1f4){logger['error'](_0xc6de('0x23'),_0x53fba0,_0x5a3a05[_0xc6de('0x27')]['message']);return _0x3173c5(_0x5a3a05[_0xc6de('0x27')][_0xc6de('0x29')]);}logger[_0xc6de('0x27')]('ChatQueue,\x20%s,\x20%s',_0x53fba0,_0x5a3a05[_0xc6de('0x27')][_0xc6de('0x29')]);return _0x2ec7eb(_0x5a3a05['error']['message']);}else{logger[_0xc6de('0x22')](_0xc6de('0x23'),_0x53fba0,'request\x20sent');_0x2ec7eb(_0x5a3a05[_0xc6de('0x2a')][_0xc6de('0x29')]);}})[_0xc6de('0x2b')](function(_0x4cec2e){logger[_0xc6de('0x27')]('ChatQueue,\x20%s,\x20%s',_0x53fba0,_0x4cec2e);_0x3173c5(_0x4cec2e);});});}function respondWithStatusCode(_0x318947,_0x39a5a7){_0x39a5a7=_0x39a5a7||0xcc;return function(_0x2c1d86){if(_0x2c1d86){return _0x318947[_0xc6de('0x2c')](_0x39a5a7);}return _0x318947[_0xc6de('0x2d')](_0x39a5a7)['end']();};}function respondWithResult(_0x125648,_0x3c737f){_0x3c737f=_0x3c737f||0xc8;return function(_0x3cdc43){if(_0x3cdc43){return _0x125648[_0xc6de('0x2d')](_0x3c737f)[_0xc6de('0x2e')](_0x3cdc43);}};}function respondWithFilteredResult(_0x4dbc32,_0x44399b){return function(_0x251465){if(_0x251465){var _0x3fb811=_0x251465[_0xc6de('0x2f')],_0x33d132=_0x44399b['offset'],_0x422c2d=_0x44399b[_0xc6de('0x30')]+_0x44399b[_0xc6de('0x31')],_0x1e8617;if(_0x422c2d>=_0x3fb811){_0x422c2d=_0x3fb811;_0x1e8617=0xc8;}else{_0x1e8617=0xce;}_0x4dbc32[_0xc6de('0x2d')](_0x1e8617);return _0x4dbc32[_0xc6de('0x32')]('Content-Range',_0x33d132+'-'+_0x422c2d+'/'+_0x3fb811)[_0xc6de('0x2e')](_0x251465);}return null;};}function patchUpdates(_0x3c7f3d){return function(_0x3fa838){try{jsonpatch[_0xc6de('0x33')](_0x3fa838,_0x3c7f3d,!![]);}catch(_0x21e6e0){return BPromise[_0xc6de('0x34')](_0x21e6e0);}return _0x3fa838[_0xc6de('0x35')]();};}function saveUpdates(_0x388ec7,_0x2e1210){return function(_0x294977){if(_0x294977){return _0x294977[_0xc6de('0x36')](_0x388ec7)[_0xc6de('0x37')](function(_0x544683){return _0x544683;});}return null;};}function removeEntity(_0x4b2561,_0x2b8bb3){return function(_0x5555e4){if(_0x5555e4){return _0x5555e4[_0xc6de('0x38')]()[_0xc6de('0x37')](function(){var _0x2b6a42=_0x5555e4[_0xc6de('0x39')]({'plain':!![]});var _0x58079a=_0xc6de('0x3a');return db[_0xc6de('0x3b')][_0xc6de('0x38')]({'where':{'type':_0x58079a,'resourceId':_0x2b6a42['id']}})['then'](function(){return _0x5555e4;});})[_0xc6de('0x37')](function(){_0x4b2561[_0xc6de('0x2d')](0xcc)[_0xc6de('0x3c')]();});}};}function handleEntityNotFound(_0x2702a3,_0x2393d3){return function(_0x569c09){if(!_0x569c09){_0x2702a3[_0xc6de('0x2c')](0x194);}return _0x569c09;};}function handleError(_0x5a9205,_0x3893a6){_0x3893a6=_0x3893a6||0x1f4;return function(_0x17cf2b){logger[_0xc6de('0x27')](_0x17cf2b[_0xc6de('0x3d')]);if(_0x17cf2b['name']){delete _0x17cf2b[_0xc6de('0x3e')];}_0x5a9205[_0xc6de('0x2d')](_0x3893a6)[_0xc6de('0x3f')](_0x17cf2b);};}exports[_0xc6de('0x40')]=function(_0xc8c262,_0x11f157){var _0x260fd0={},_0x1e6bf5={},_0x234acd={'count':0x0,'rows':[]};var _0x463876=_['map'](db['ChatQueue']['rawAttributes'],function(_0x25b20c){return{'name':_0x25b20c[_0xc6de('0x41')],'type':_0x25b20c[_0xc6de('0x42')][_0xc6de('0x43')]};});_0x1e6bf5[_0xc6de('0x44')]=_[_0xc6de('0x45')](_0x463876,'name');_0x1e6bf5['query']=_[_0xc6de('0x46')](_0xc8c262[_0xc6de('0x47')]);_0x1e6bf5[_0xc6de('0x48')]=_[_0xc6de('0x49')](_0x1e6bf5[_0xc6de('0x44')],_0x1e6bf5[_0xc6de('0x47')]);_0x260fd0[_0xc6de('0x4a')]=_[_0xc6de('0x49')](_0x1e6bf5['model'],qs[_0xc6de('0x4b')](_0xc8c262['query'][_0xc6de('0x4b')]));_0x260fd0[_0xc6de('0x4a')]=_0x260fd0[_0xc6de('0x4a')][_0xc6de('0x4c')]?_0x260fd0['attributes']:_0x1e6bf5[_0xc6de('0x44')];if(!_0xc8c262[_0xc6de('0x47')]['hasOwnProperty'](_0xc6de('0x4d'))){_0x260fd0[_0xc6de('0x31')]=qs[_0xc6de('0x31')](_0xc8c262['query']['limit']);_0x260fd0['offset']=qs['offset'](_0xc8c262[_0xc6de('0x47')][_0xc6de('0x30')]);}_0x260fd0[_0xc6de('0x4e')]=qs[_0xc6de('0x4f')](_0xc8c262['query']['sort']);_0x260fd0['where']=qs[_0xc6de('0x48')](_[_0xc6de('0x50')](_0xc8c262[_0xc6de('0x47')],_0x1e6bf5[_0xc6de('0x48')]),_0x463876);if(_0xc8c262[_0xc6de('0x47')][_0xc6de('0x51')]){_0x260fd0[_0xc6de('0x52')]=_[_0xc6de('0x53')](_0x260fd0[_0xc6de('0x52')],{'$or':_[_0xc6de('0x45')](_0x463876,function(_0x487597){if(_0x487597['type']!=='VIRTUAL'){var _0x404448={};_0x404448[_0x487597['name']]={'$like':'%'+_0xc8c262[_0xc6de('0x47')][_0xc6de('0x51')]+'%'};return _0x404448;}})});}_0x260fd0=_[_0xc6de('0x53')]({},_0x260fd0,_0xc8c262[_0xc6de('0x54')]);var _0x1010a8={'where':_0x260fd0[_0xc6de('0x52')]};return db['ChatQueue']['count'](_0x1010a8)[_0xc6de('0x37')](function(_0x4b1ce7){_0x234acd[_0xc6de('0x2f')]=_0x4b1ce7;if(_0xc8c262['query']['includeAll']){_0x260fd0[_0xc6de('0x55')]=[{'all':!![]}];}return db[_0xc6de('0x56')][_0xc6de('0x57')](_0x260fd0);})['then'](function(_0x3a6a95){_0x234acd[_0xc6de('0x58')]=_0x3a6a95;return _0x234acd;})[_0xc6de('0x37')](respondWithFilteredResult(_0x11f157,_0x260fd0))['catch'](handleError(_0x11f157,null));};exports[_0xc6de('0x59')]=function(_0xa82802,_0x1c7b43){var _0x42a1b2={'raw':!![],'where':{'id':_0xa82802['params']['id']}},_0x204cfd={};_0x204cfd['model']=_[_0xc6de('0x46')](db['ChatQueue']['rawAttributes']);_0x204cfd[_0xc6de('0x47')]=_[_0xc6de('0x46')](_0xa82802[_0xc6de('0x47')]);_0x204cfd[_0xc6de('0x48')]=_[_0xc6de('0x49')](_0x204cfd[_0xc6de('0x44')],_0x204cfd[_0xc6de('0x47')]);_0x42a1b2[_0xc6de('0x4a')]=_[_0xc6de('0x49')](_0x204cfd[_0xc6de('0x44')],qs[_0xc6de('0x4b')](_0xa82802['query'][_0xc6de('0x4b')]));_0x42a1b2[_0xc6de('0x4a')]=_0x42a1b2['attributes'][_0xc6de('0x4c')]?_0x42a1b2[_0xc6de('0x4a')]:_0x204cfd[_0xc6de('0x44')];if(_0xa82802['query'][_0xc6de('0x5a')]){_0x42a1b2[_0xc6de('0x55')]=[{'all':!![]}];}_0x42a1b2=_['merge']({},_0x42a1b2,_0xa82802[_0xc6de('0x54')]);return db[_0xc6de('0x56')][_0xc6de('0x5b')](_0x42a1b2)[_0xc6de('0x37')](handleEntityNotFound(_0x1c7b43,null))[_0xc6de('0x37')](respondWithResult(_0x1c7b43,null))['catch'](handleError(_0x1c7b43,null));};exports[_0xc6de('0x5c')]=function(_0x33f6a2,_0x591e3a){return db[_0xc6de('0x56')][_0xc6de('0x5c')](_0x33f6a2[_0xc6de('0x5d')],{})[_0xc6de('0x37')](function(_0x2c99e6){var _0x582225=_0x33f6a2[_0xc6de('0x5e')][_0xc6de('0x39')]({'plain':!![]});if(!_0x582225)throw new Error(_0xc6de('0x5f'));if(_0x582225[_0xc6de('0x60')]===_0xc6de('0x5e')){var _0x5170f6=_0x2c99e6[_0xc6de('0x39')]({'plain':!![]});var _0x49ba9b=_0xc6de('0x3a');return db[_0xc6de('0x61')][_0xc6de('0x5b')]({'where':{'name':_0x49ba9b,'userProfileId':_0x582225['userProfileId']},'raw':!![]})['then'](function(_0xedaa22){if(_0xedaa22&&_0xedaa22['autoAssociation']===0x0){return db[_0xc6de('0x3b')]['create']({'name':_0x5170f6['name'],'resourceId':_0x5170f6['id'],'type':_0xedaa22[_0xc6de('0x3e')],'sectionId':_0xedaa22['id']},{})[_0xc6de('0x37')](function(){return _0x2c99e6;});}else{return _0x2c99e6;}})[_0xc6de('0x2b')](function(_0x502f46){logger[_0xc6de('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x502f46);throw _0x502f46;});}return _0x2c99e6;})[_0xc6de('0x37')](respondWithResult(_0x591e3a,0xc9))['catch'](handleError(_0x591e3a,null));};exports['update']=function(_0x10443e,_0x45ee36){if(_0x10443e[_0xc6de('0x5d')]['id']){delete _0x10443e[_0xc6de('0x5d')]['id'];}return db[_0xc6de('0x56')]['find']({'where':{'id':_0x10443e[_0xc6de('0x62')]['id']}})[_0xc6de('0x37')](handleEntityNotFound(_0x45ee36,null))[_0xc6de('0x37')](saveUpdates(_0x10443e[_0xc6de('0x5d')],null))[_0xc6de('0x37')](respondWithResult(_0x45ee36,null))['catch'](handleError(_0x45ee36,null));};exports[_0xc6de('0x38')]=function(_0x3e758d,_0x496e04){return db[_0xc6de('0x56')][_0xc6de('0x5b')]({'where':{'id':_0x3e758d['params']['id']}})['then'](handleEntityNotFound(_0x496e04,null))['then'](removeEntity(_0x496e04,null))['catch'](handleError(_0x496e04,null));};exports[_0xc6de('0x63')]=function(_0x5d2ef5,_0x23b167){return db[_0xc6de('0x56')][_0xc6de('0x63')]()[_0xc6de('0x37')](respondWithResult(_0x23b167,null))['catch'](handleError(_0x23b167,null));};exports[_0xc6de('0x64')]=function(_0x4f4e9d,_0x19eb34,_0x41de09){var _0x3d88d1={'raw':!![],'where':{}},_0x187ca9={},_0x40ea51;return db[_0xc6de('0x56')][_0xc6de('0x65')]({'where':{'id':_0x4f4e9d[_0xc6de('0x62')]['id']}})[_0xc6de('0x37')](handleEntityNotFound(_0x19eb34,null))['then'](function(_0xb75ec3){if(_0xb75ec3){_0x40ea51=_0xb75ec3[_0xc6de('0x39')]({'plain':!![]});_0x187ca9[_0xc6de('0x44')]=_[_0xc6de('0x46')](db[_0xc6de('0x66')]['rawAttributes']);_0x187ca9['query']=_[_0xc6de('0x46')](_0x4f4e9d[_0xc6de('0x47')]);_0x187ca9[_0xc6de('0x48')]=_[_0xc6de('0x49')](_0x187ca9['model'],_0x187ca9[_0xc6de('0x47')]);_0x3d88d1[_0xc6de('0x4a')]=_[_0xc6de('0x49')](_0x187ca9[_0xc6de('0x44')],qs['fields'](_0x4f4e9d[_0xc6de('0x47')]['fields']));_0x3d88d1[_0xc6de('0x4a')]=_0x3d88d1[_0xc6de('0x4a')][_0xc6de('0x4c')]?_0x3d88d1['attributes']:_0x187ca9[_0xc6de('0x44')];if(!_0x4f4e9d[_0xc6de('0x47')]['hasOwnProperty'](_0xc6de('0x4d'))){_0x3d88d1[_0xc6de('0x31')]=qs['limit'](_0x4f4e9d[_0xc6de('0x47')][_0xc6de('0x31')]);_0x3d88d1[_0xc6de('0x30')]=qs[_0xc6de('0x30')](_0x4f4e9d[_0xc6de('0x47')][_0xc6de('0x30')]);}_0x3d88d1[_0xc6de('0x4e')]=qs[_0xc6de('0x4f')](_0x4f4e9d[_0xc6de('0x47')][_0xc6de('0x4f')]);_0x3d88d1[_0xc6de('0x52')]=qs['filters'](_[_0xc6de('0x50')](_0x4f4e9d[_0xc6de('0x47')],_0x187ca9[_0xc6de('0x48')]));_0x3d88d1[_0xc6de('0x52')][_0xc6de('0x67')]=_0xb75ec3['id'];if(_0x4f4e9d[_0xc6de('0x47')][_0xc6de('0x51')]){_0x3d88d1[_0xc6de('0x52')]=_['merge'](_0x3d88d1[_0xc6de('0x52')],{'$or':_[_0xc6de('0x45')](_0x3d88d1[_0xc6de('0x4a')],function(_0x35470d){var _0x2bbd22={};_0x2bbd22[_0x35470d]={'$like':'%'+_0x4f4e9d['query']['filter']+'%'};return _0x2bbd22;})});}_0x3d88d1=_[_0xc6de('0x53')]({},_0x3d88d1,_0x4f4e9d[_0xc6de('0x54')]);return db[_0xc6de('0x66')][_0xc6de('0x57')](_0x3d88d1);}})['then'](function(_0x4bc060){if(_0x4bc060){return db[_0xc6de('0x68')][_0xc6de('0x69')]({'where':{'id':_[_0xc6de('0x45')](_0x4bc060,_0xc6de('0x6a')),'role':_0xc6de('0x6b')},'attributes':['id',_0xc6de('0x3e'),_0xc6de('0x6c'),_0xc6de('0x6d'),_0xc6de('0x6e')]});}})[_0xc6de('0x37')](function(_0x2ae5ee){if(_0x2ae5ee){return{'count':_0x2ae5ee[_0xc6de('0x2f')],'rows':_[_0xc6de('0x45')](_0x2ae5ee[_0xc6de('0x58')],function(_0x216ab6){return{'membername':_0x216ab6[_0xc6de('0x3e')],'UserId':_0x216ab6['id'],'queue_name':_0x40ea51['name'],'ChatQueueId':_0x40ea51['id'],'interface':util['format'](_0xc6de('0x6f'),_0xc6de('0x70'),_0x216ab6[_0xc6de('0x3e')]),'penalty':0x0,'paused':_0x216ab6[_0xc6de('0x6c')],'createdAt':_0x216ab6['createdAt'],'updatedAt':_0x216ab6[_0xc6de('0x6d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x19eb34,_0x3d88d1))[_0xc6de('0x2b')](handleError(_0x19eb34,null));};exports[_0xc6de('0x71')]=function(_0x2a4912,_0x2a277e,_0x55a597){var _0x146748={};var _0x34e292={};var _0x29df39;var _0x581313;return db[_0xc6de('0x56')][_0xc6de('0x65')]({'where':{'id':_0x2a4912[_0xc6de('0x62')]['id']}})[_0xc6de('0x37')](handleEntityNotFound(_0x2a277e,null))[_0xc6de('0x37')](function(_0x29b926){if(_0x29b926){_0x29df39=_0x29b926;_0x34e292[_0xc6de('0x44')]=_['keys'](db['Team'][_0xc6de('0x72')]);_0x34e292[_0xc6de('0x47')]=_[_0xc6de('0x46')](_0x2a4912[_0xc6de('0x47')]);_0x34e292['filters']=_[_0xc6de('0x49')](_0x34e292['model'],_0x34e292[_0xc6de('0x47')]);_0x146748['attributes']=_['intersection'](_0x34e292['model'],qs[_0xc6de('0x4b')](_0x2a4912[_0xc6de('0x47')][_0xc6de('0x4b')]));_0x146748[_0xc6de('0x4a')]=_0x146748['attributes'][_0xc6de('0x4c')]?_0x146748['attributes']:_0x34e292[_0xc6de('0x44')];_0x146748['order']=qs['sort'](_0x2a4912[_0xc6de('0x47')]['sort']);_0x146748[_0xc6de('0x52')]=qs[_0xc6de('0x48')](_['pick'](_0x2a4912[_0xc6de('0x47')],_0x34e292['filters']));if(_0x2a4912[_0xc6de('0x47')]['filter']){_0x146748['where']=_[_0xc6de('0x53')](_0x146748[_0xc6de('0x52')],{'$or':_[_0xc6de('0x45')](_0x146748[_0xc6de('0x4a')],function(_0x21408d){var _0x308779={};_0x308779[_0x21408d]={'$like':'%'+_0x2a4912[_0xc6de('0x47')][_0xc6de('0x51')]+'%'};return _0x308779;})});}_0x146748=_[_0xc6de('0x53')]({},_0x146748,_0x2a4912[_0xc6de('0x54')]);return _0x29df39[_0xc6de('0x71')](_0x146748);}})['then'](function(_0x4fd4f2){if(_0x4fd4f2){_0x581313=_0x4fd4f2[_0xc6de('0x4c')];if(!_0x2a4912['query'][_0xc6de('0x73')]('nolimit')){_0x146748[_0xc6de('0x31')]=qs['limit'](_0x2a4912[_0xc6de('0x47')][_0xc6de('0x31')]);_0x146748[_0xc6de('0x30')]=qs['offset'](_0x2a4912['query'][_0xc6de('0x30')]);}return _0x29df39[_0xc6de('0x71')](_0x146748);}})['then'](function(_0x204f17){if(_0x204f17){return _0x204f17?{'count':_0x581313,'rows':_0x204f17}:null;}})[_0xc6de('0x37')](respondWithResult(_0x2a277e,null))[_0xc6de('0x2b')](handleError(_0x2a277e,null));};exports[_0xc6de('0x74')]=function(_0x491955,_0x15ab0f,_0x5cd883){var _0x400440=_0x491955['body'][_0xc6de('0x75')];return db[_0xc6de('0x76')]['findAll']({'where':{'id':_0x400440},'attributes':['id'],'include':[{'model':db[_0xc6de('0x68')],'as':_0xc6de('0x77'),'attributes':['id',_0xc6de('0x3e'),_0xc6de('0x78'),'voicePause','interface'],'raw':!![]}]})[_0xc6de('0x37')](function(_0x34eb91){if(_0x34eb91){var _0x521874=_[_0xc6de('0x79')](_0x34eb91,function(_0x46fbec){var _0x162d92=_0x46fbec[_0xc6de('0x39')]({'plain':!![]});return _0x162d92[_0xc6de('0x77')];});return db['ChatQueue'][_0xc6de('0x5b')]({'where':{'id':_0x491955[_0xc6de('0x62')]['id']}})['then'](function(_0x2d4bc9){return db[_0xc6de('0x7a')][_0xc6de('0x7b')](function(_0x177558){return _0x2d4bc9[_0xc6de('0x74')](_0x400440,{'transaction':_0x177558})[_0xc6de('0x37')](function(){return BPromise['each'](_0x521874,function(_0x28bbe7){return db[_0xc6de('0x66')][_0xc6de('0x7c')]({'where':{'UserId':_0x28bbe7['id'],'ChatQueueId':_0x491955[_0xc6de('0x62')]['id']},'transaction':_0x177558});});})['then'](function(){_0x521874[_0xc6de('0x7d')](function(_0x3d12b2){socket['emit'](_0xc6de('0x7e'),{'UserId':_0x3d12b2['id'],'ChatQueueId':_0x2d4bc9['id']});});});});});}})[_0xc6de('0x37')](respondWithStatusCode(_0x15ab0f,null))[_0xc6de('0x2b')](handleError(_0x15ab0f,null));};exports[_0xc6de('0x7f')]=function(_0x183c40,_0x2f2934,_0x5da176){return db['Team'][_0xc6de('0x57')]({'where':{'id':_0x183c40[_0xc6de('0x47')][_0xc6de('0x75')]},'attributes':['id'],'include':[{'model':db[_0xc6de('0x68')],'as':_0xc6de('0x77'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2f2934,null))['then'](function(_0x5181cb){var _0xb52123=_[_0xc6de('0x45')](_0x5181cb,'id');var _0x21e211=[];var _0x2d2617=[];var _0x30163c=squel[_0xc6de('0x80')]();_0x30163c['field'](_0xc6de('0x81'))[_0xc6de('0x82')](_0xc6de('0x83'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xc6de('0x52')](_0xc6de('0x84'),_0x183c40['params']['id']);for(var _0x1d4378=0x0;_0x1d4378<_0x5181cb[_0xc6de('0x4c')];_0x1d4378+=0x1){let _0x328238=_0x5181cb[_0x1d4378];for(var _0x307b8a=0x0;_0x307b8a<_0x328238['Agents'][_0xc6de('0x4c')];_0x307b8a+=0x1){let _0x491b60=_0x328238[_0xc6de('0x77')][_0x307b8a];var _0x49b957=_0x30163c[_0xc6de('0x85')]();_0x49b957[_0xc6de('0x52')](_0xc6de('0x86'),_0x491b60['id']);_0x2d2617[_0xc6de('0x87')](db[_0xc6de('0x7a')]['query'](_0x49b957['toString'](),{'type':db[_0xc6de('0x7a')][_0xc6de('0x88')][_0xc6de('0x89')]})[_0xc6de('0x37')](function(_0x5b454b){if(_0x5b454b[_0xc6de('0x4c')]===0x1){return _0x491b60['id'];}else{var _0x1acb17=_['every'](_[_0xc6de('0x45')](_0x5b454b,_0xc6de('0x8a')),function(_0x2b05c3){return _[_0xc6de('0x8b')](_0xb52123,_0x2b05c3);});if(_0x1acb17){return _0x491b60['id'];}}}));}}return BPromise['all'](_0x2d2617)['then'](function(_0x3e4557){_0x21e211=_(_0x21e211)['union'](_0x3e4557)[_0xc6de('0x8c')]()['value']();return db[_0xc6de('0x56')]['find']({'where':{'id':_0x183c40[_0xc6de('0x62')]['id']}})[_0xc6de('0x37')](function(_0x28ad1a){return db[_0xc6de('0x7a')][_0xc6de('0x7b')](function(_0x1edf57){return _0x28ad1a[_0xc6de('0x7f')](_0x183c40['query'][_0xc6de('0x75')],{'transaction':_0x1edf57})[_0xc6de('0x37')](function(){if(!_[_0xc6de('0x8d')](_0x21e211)){return _0x28ad1a['removeAgents'](_0x21e211,{'transaction':_0x1edf57});}})['then'](function(){_0x21e211[_0xc6de('0x7d')](function(_0x186d18){socket['emit']('userChatQueue:remove',{'UserId':_0x186d18,'ChatQueueId':_0x28ad1a['id']});});});});});});})[_0xc6de('0x37')](respondWithStatusCode(_0x2f2934,null))['catch'](handleError(_0x2f2934,null));};exports['addAgents']=function(_0x225659,_0x44e37a,_0x268615){return db[_0xc6de('0x56')]['find']({'where':{'id':_0x225659[_0xc6de('0x62')]['id']}})[_0xc6de('0x37')](handleEntityNotFound(_0x44e37a,null))[_0xc6de('0x37')](function(_0x51da7b){if(_0x51da7b){return _0x51da7b['addAgents'](_0x225659[_0xc6de('0x5d')][_0xc6de('0x75')],_[_0xc6de('0x8e')](_0x225659[_0xc6de('0x5d')],[_0xc6de('0x75'),'id'])||{})[_0xc6de('0x8f')](function(_0x5f450b){for(var _0x4dca38=0x0;_0x4dca38<_0x225659[_0xc6de('0x5d')][_0xc6de('0x75')]['length'];_0x4dca38+=0x1){socket['emit']('userChatQueue:save',{'UserId':_0x225659['body'][_0xc6de('0x75')][_0x4dca38],'ChatQueueId':_0x225659[_0xc6de('0x62')]['id']});}return _0x5f450b;});}})['then'](respondWithResult(_0x44e37a,null))[_0xc6de('0x2b')](handleError(_0x44e37a,null));};exports[_0xc6de('0x90')]=function(_0x502d7e,_0x38098c,_0x66f7dc){return db[_0xc6de('0x56')][_0xc6de('0x5b')]({'where':{'id':_0x502d7e[_0xc6de('0x62')]['id']}})['then'](handleEntityNotFound(_0x38098c,null))['then'](function(_0x1e88aa){if(_0x1e88aa){return _0x1e88aa['removeAgents'](_0x502d7e['query']['ids'])['then'](function(){if(_[_0xc6de('0x91')](_0x502d7e[_0xc6de('0x47')][_0xc6de('0x75')])){for(var _0x16826d=0x0;_0x16826d<_0x502d7e[_0xc6de('0x47')][_0xc6de('0x75')][_0xc6de('0x4c')];_0x16826d+=0x1){socket[_0xc6de('0x92')](_0xc6de('0x93'),{'UserId':Number(_0x502d7e['query'][_0xc6de('0x75')][_0x16826d]),'ChatQueueId':Number(_0x502d7e[_0xc6de('0x62')]['id'])});}}else{socket['emit'](_0xc6de('0x93'),{'UserId':Number(_0x502d7e[_0xc6de('0x47')][_0xc6de('0x75')]),'ChatQueueId':Number(_0x502d7e[_0xc6de('0x62')]['id'])});}});}})[_0xc6de('0x37')](respondWithStatusCode(_0x38098c,null))[_0xc6de('0x2b')](handleError(_0x38098c,null));};exports[_0xc6de('0x94')]=function(_0x4a8e6a,_0x3555d3,_0x4c3f4a){var _0x3ba1fe={};var _0x36793a={};var _0x4743f2;var _0x4e34dd;return db['ChatQueue'][_0xc6de('0x65')]({'where':{'id':_0x4a8e6a['params']['id']}})[_0xc6de('0x37')](handleEntityNotFound(_0x3555d3,null))[_0xc6de('0x37')](function(_0x43cb3c){if(_0x43cb3c){_0x4743f2=_0x43cb3c;_0x36793a[_0xc6de('0x44')]=_[_0xc6de('0x46')](db[_0xc6de('0x68')][_0xc6de('0x72')]);_0x36793a[_0xc6de('0x47')]=_[_0xc6de('0x46')](_0x4a8e6a['query']);_0x36793a[_0xc6de('0x48')]=_[_0xc6de('0x49')](_0x36793a['model'],_0x36793a[_0xc6de('0x47')]);_0x3ba1fe[_0xc6de('0x4a')]=_[_0xc6de('0x49')](_0x36793a[_0xc6de('0x44')],qs[_0xc6de('0x4b')](_0x4a8e6a[_0xc6de('0x47')][_0xc6de('0x4b')]));_0x3ba1fe[_0xc6de('0x4a')]=_0x3ba1fe[_0xc6de('0x4a')][_0xc6de('0x4c')]?_0x3ba1fe['attributes']:_0x36793a[_0xc6de('0x44')];_0x3ba1fe[_0xc6de('0x4e')]=qs[_0xc6de('0x4f')](_0x4a8e6a[_0xc6de('0x47')][_0xc6de('0x4f')]);_0x3ba1fe[_0xc6de('0x52')]=qs['filters'](_[_0xc6de('0x50')](_0x4a8e6a[_0xc6de('0x47')],_0x36793a[_0xc6de('0x48')]));if(_0x4a8e6a[_0xc6de('0x47')][_0xc6de('0x51')]){_0x3ba1fe['where']=_[_0xc6de('0x53')](_0x3ba1fe[_0xc6de('0x52')],{'$or':_[_0xc6de('0x45')](_0x3ba1fe[_0xc6de('0x4a')],function(_0x48499e){var _0x48537c={};_0x48537c[_0x48499e]={'$like':'%'+_0x4a8e6a[_0xc6de('0x47')]['filter']+'%'};return _0x48537c;})});}_0x3ba1fe=_[_0xc6de('0x53')]({},_0x3ba1fe,_0x4a8e6a[_0xc6de('0x54')]);return _0x4743f2[_0xc6de('0x94')](_0x3ba1fe);}})[_0xc6de('0x37')](function(_0x177e62){if(_0x177e62){_0x4e34dd=_0x177e62[_0xc6de('0x4c')];if(!_0x4a8e6a[_0xc6de('0x47')]['hasOwnProperty'](_0xc6de('0x4d'))){_0x3ba1fe[_0xc6de('0x31')]=qs[_0xc6de('0x31')](_0x4a8e6a['query'][_0xc6de('0x31')]);_0x3ba1fe[_0xc6de('0x30')]=qs[_0xc6de('0x30')](_0x4a8e6a[_0xc6de('0x47')][_0xc6de('0x30')]);}return _0x4743f2[_0xc6de('0x94')](_0x3ba1fe);}})[_0xc6de('0x37')](function(_0x27925d){if(_0x27925d){return _0x27925d?{'count':_0x4e34dd,'rows':_0x27925d}:null;}})[_0xc6de('0x37')](respondWithResult(_0x3555d3,null))['catch'](handleError(_0x3555d3,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 7094dfb..ec07a5f 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 _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x134f9f,_0x382ca5){var _0x2c1a8f=function(_0x12af7d){while(--_0x12af7d){_0x134f9f['push'](_0x134f9f['shift']());}};_0x2c1a8f(++_0x382ca5);}(_0xb10b,0x12a));var _0xbb10=function(_0xcbb8db,_0x1f0a12){_0xcbb8db=_0xcbb8db-0x0;var _0x2fdcac=_0xb10b[_0xcbb8db];return _0x2fdcac;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x59bed0,_0x252817){var _0x592459=function(_0x1ee1a0){while(--_0x1ee1a0){_0x59bed0['push'](_0x59bed0['shift']());}};_0x592459(++_0x252817);}(_0x5f2f,0x73));var _0xf5f2=function(_0x34f9e3,_0x2f74aa){_0x34f9e3=_0x34f9e3-0x0;var _0x7dfdeb=_0x5f2f[_0x34f9e3];return _0x7dfdeb;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatQueue=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatQueueEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatQueueEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatQueue[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index aae6b66..a26c8b2 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 _0xd4bd=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','define','ChatQueue','chat_queues'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xd4bd,0x186));var _0xdd4b=function(_0x57c872,_0x63a1fa){_0x57c872=_0x57c872-0x0;var _0x3ce770=_0xd4bd[_0x57c872];return _0x3ce770;};'use strict';var _=require(_0xdd4b('0x0'));var util=require(_0xdd4b('0x1'));var logger=require('../../config/logger')(_0xdd4b('0x2'));var moment=require(_0xdd4b('0x3'));var BPromise=require(_0xdd4b('0x4'));var rp=require(_0xdd4b('0x5'));var fs=require('fs');var path=require(_0xdd4b('0x6'));var rimraf=require(_0xdd4b('0x7'));var config=require(_0xdd4b('0x8'));var attributes=require(_0xdd4b('0x9'));module['exports']=function(_0x5a8683,_0x4f856a){return _0x5a8683[_0xdd4b('0xa')](_0xdd4b('0xb'),attributes,{'tableName':_0xdd4b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b9e=['util','moment','bluebird','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash'];(function(_0x51df35,_0x3a530d){var _0x225e66=function(_0x180515){while(--_0x180515){_0x51df35['push'](_0x51df35['shift']());}};_0x225e66(++_0x3a530d);}(_0x0b9e,0x1bb));var _0xe0b9=function(_0xba811f,_0x1f316f){_0xba811f=_0xba811f-0x0;var _0x41aaea=_0x0b9e[_0xba811f];return _0x41aaea;};'use strict';var _=require(_0xe0b9('0x0'));var util=require(_0xe0b9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe0b9('0x2'));var BPromise=require(_0xe0b9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe0b9('0x4'));var rimraf=require(_0xe0b9('0x5'));var config=require(_0xe0b9('0x6'));var attributes=require(_0xe0b9('0x7'));module[_0xe0b9('0x8')]=function(_0x52e07b,_0x2ca46a){return _0x52e07b[_0xe0b9('0x9')](_0xe0b9('0xa'),attributes,{'tableName':_0xe0b9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 8048ed6..f7c9222 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 _0x6ea1=['where','options','attributes','limit','map','include','model','ChatQueue','find','ShowChatQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','findAll','raw'];(function(_0xe77127,_0x38c24c){var _0x34a56a=function(_0x1798fc){while(--_0x1798fc){_0xe77127['push'](_0xe77127['shift']());}};_0x34a56a(++_0x38c24c);}(_0x6ea1,0x1c2));var _0x16ea=function(_0x422fd0,_0x5984e9){_0x422fd0=_0x422fd0-0x0;var _0x19ea4e=_0x6ea1[_0x422fd0];return _0x19ea4e;};'use strict';var _=require(_0x16ea('0x0'));var util=require(_0x16ea('0x1'));var moment=require(_0x16ea('0x2'));var BPromise=require(_0x16ea('0x3'));var rs=require(_0x16ea('0x4'));var fs=require('fs');var Redis=require(_0x16ea('0x5'));var db=require(_0x16ea('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x16ea('0x7'));var config=require(_0x16ea('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x16ea('0x9')][_0x16ea('0xa')]({'port':0x232a});config[_0x16ea('0xb')]=_[_0x16ea('0xc')](config[_0x16ea('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x16ea('0xd'))(new Redis(config[_0x16ea('0xb')]));require('./chatQueue.socket')['register'](socket);function respondWithRpcPromise(_0x2dad38,_0x42bcd8,_0x1525a9){return new BPromise(function(_0x12753e,_0x4b80ab){return client[_0x16ea('0xe')](_0x2dad38,_0x1525a9)[_0x16ea('0xf')](function(_0x504015){logger[_0x16ea('0x10')]('ChatQueue,\x20%s,\x20%s',_0x42bcd8,_0x16ea('0x11'));logger[_0x16ea('0x12')](_0x16ea('0x13'),_0x42bcd8,_0x16ea('0x11'),JSON[_0x16ea('0x14')](_0x504015));if(_0x504015[_0x16ea('0x15')]){if(_0x504015[_0x16ea('0x15')][_0x16ea('0x16')]===0x1f4){logger[_0x16ea('0x15')](_0x16ea('0x17'),_0x42bcd8,_0x504015['error'][_0x16ea('0x18')]);return _0x4b80ab(_0x504015[_0x16ea('0x15')][_0x16ea('0x18')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x42bcd8,_0x504015[_0x16ea('0x15')][_0x16ea('0x18')]);return _0x12753e(_0x504015['error'][_0x16ea('0x18')]);}else{logger[_0x16ea('0x10')](_0x16ea('0x17'),_0x42bcd8,_0x16ea('0x11'));_0x12753e(_0x504015[_0x16ea('0x19')][_0x16ea('0x18')]);}})[_0x16ea('0x1a')](function(_0x32ab64){logger[_0x16ea('0x15')](_0x16ea('0x17'),_0x42bcd8,_0x32ab64);_0x4b80ab(_0x32ab64);});});}exports[_0x16ea('0x1b')]=function(_0x7b6758){var _0x208dad=this;return new Promise(function(_0x583d6d,_0x3842f6){return db['ChatQueue'][_0x16ea('0x1c')]({'raw':_0x7b6758['options']?_0x7b6758['options'][_0x16ea('0x1d')]===undefined?!![]:![]:!![],'where':_0x7b6758['options']?_0x7b6758['options'][_0x16ea('0x1e')]||null:null,'attributes':_0x7b6758[_0x16ea('0x1f')]?_0x7b6758[_0x16ea('0x1f')][_0x16ea('0x20')]||null:null,'limit':_0x7b6758[_0x16ea('0x1f')]?_0x7b6758[_0x16ea('0x1f')][_0x16ea('0x21')]||null:null,'include':_0x7b6758['options']?_0x7b6758[_0x16ea('0x1f')]['include']?_[_0x16ea('0x22')](_0x7b6758[_0x16ea('0x1f')][_0x16ea('0x23')],function(_0x27723f){return{'model':db[_0x27723f[_0x16ea('0x24')]],'as':_0x27723f['as'],'attributes':_0x27723f[_0x16ea('0x20')],'include':_0x27723f['include']?_[_0x16ea('0x22')](_0x27723f[_0x16ea('0x23')],function(_0x350431){return{'model':db[_0x350431[_0x16ea('0x24')]],'as':_0x350431['as'],'attributes':_0x350431[_0x16ea('0x20')],'include':_0x350431[_0x16ea('0x23')]?_[_0x16ea('0x22')](_0x350431[_0x16ea('0x23')],function(_0x350cf7){return{'model':db[_0x350cf7[_0x16ea('0x24')]],'as':_0x350cf7['as'],'attributes':_0x350cf7['attributes']};}):[]};}):[]};}):[]:[]})[_0x16ea('0xf')](function(_0x460677){logger[_0x16ea('0x10')]('GetChatQueue',_0x7b6758);logger[_0x16ea('0x12')]('GetChatQueue',_0x7b6758,JSON[_0x16ea('0x14')](_0x460677));_0x583d6d(_0x460677);})[_0x16ea('0x1a')](function(_0x14d973){logger[_0x16ea('0x15')]('GetChatQueue',_0x14d973[_0x16ea('0x18')],_0x7b6758);_0x3842f6(_0x208dad[_0x16ea('0x15')](0x1f4,_0x14d973['message']));});});};exports['ShowChatQueue']=function(_0x579265){var _0x52eca2=this;return new Promise(function(_0x67505b,_0x36a69c){return db[_0x16ea('0x25')][_0x16ea('0x26')]({'raw':_0x579265['options']?_0x579265[_0x16ea('0x1f')][_0x16ea('0x1d')]===undefined?!![]:![]:!![],'where':_0x579265[_0x16ea('0x1f')]?_0x579265[_0x16ea('0x1f')][_0x16ea('0x1e')]||null:null,'attributes':_0x579265[_0x16ea('0x1f')]?_0x579265[_0x16ea('0x1f')][_0x16ea('0x20')]||null:null,'include':_0x579265[_0x16ea('0x1f')]?_0x579265[_0x16ea('0x1f')][_0x16ea('0x23')]?_[_0x16ea('0x22')](_0x579265[_0x16ea('0x1f')][_0x16ea('0x23')],function(_0x4decd8){return{'model':db[_0x4decd8['model']],'as':_0x4decd8['as'],'attributes':_0x4decd8[_0x16ea('0x20')],'include':_0x4decd8[_0x16ea('0x23')]?_[_0x16ea('0x22')](_0x4decd8[_0x16ea('0x23')],function(_0x116d31){return{'model':db[_0x116d31['model']],'as':_0x116d31['as'],'attributes':_0x116d31[_0x16ea('0x20')],'include':_0x116d31[_0x16ea('0x23')]?_[_0x16ea('0x22')](_0x116d31['include'],function(_0x3d0578){return{'model':db[_0x3d0578[_0x16ea('0x24')]],'as':_0x3d0578['as'],'attributes':_0x3d0578[_0x16ea('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52ca66){logger[_0x16ea('0x10')]('ShowChatQueue',_0x579265);logger[_0x16ea('0x12')](_0x16ea('0x27'),_0x579265,JSON[_0x16ea('0x14')](_0x52ca66));_0x67505b(_0x52ca66);})[_0x16ea('0x1a')](function(_0x3f0f94){logger[_0x16ea('0x15')](_0x16ea('0x27'),_0x3f0f94[_0x16ea('0x18')],_0x579265);_0x36a69c(_0x52eca2[_0x16ea('0x15')](0x1f4,_0x3f0f94['message']));});});}; \ No newline at end of file +var _0xbcae=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ChatQueue','findAll','options','raw','where','limit','include','map','model','attributes','GetChatQueue','find','ShowChatQueue','lodash','util','moment'];(function(_0x4d7559,_0x139f3e){var _0x40341c=function(_0x361c68){while(--_0x361c68){_0x4d7559['push'](_0x4d7559['shift']());}};_0x40341c(++_0x139f3e);}(_0xbcae,0xa9));var _0xebca=function(_0x26a31f,_0xb97bc5){_0x26a31f=_0x26a31f-0x0;var _0x39e397=_0xbcae[_0x26a31f];return _0x39e397;};'use strict';var _=require(_0xebca('0x0'));var util=require(_0xebca('0x1'));var moment=require(_0xebca('0x2'));var BPromise=require(_0xebca('0x3'));var rs=require(_0xebca('0x4'));var fs=require('fs');var Redis=require(_0xebca('0x5'));var db=require(_0xebca('0x6'))['db'];var utils=require(_0xebca('0x7'));var logger=require(_0xebca('0x8'))(_0xebca('0x9'));var config=require('../../config/environment');var jayson=require(_0xebca('0xa'));var client=jayson[_0xebca('0xb')]['http']({'port':0x232a});config[_0xebca('0xc')]=_[_0xebca('0xd')](config[_0xebca('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xebca('0xe'))(new Redis(config[_0xebca('0xc')]));require(_0xebca('0xf'))[_0xebca('0x10')](socket);function respondWithRpcPromise(_0x198c66,_0x3c0b2a,_0x4e63b0){return new BPromise(function(_0x525679,_0x5d8909){return client[_0xebca('0x11')](_0x198c66,_0x4e63b0)[_0xebca('0x12')](function(_0x31c3a1){logger[_0xebca('0x13')](_0xebca('0x14'),_0x3c0b2a,'request\x20sent');logger[_0xebca('0x15')](_0xebca('0x16'),_0x3c0b2a,_0xebca('0x17'),JSON[_0xebca('0x18')](_0x31c3a1));if(_0x31c3a1[_0xebca('0x19')]){if(_0x31c3a1[_0xebca('0x19')][_0xebca('0x1a')]===0x1f4){logger[_0xebca('0x19')]('ChatQueue,\x20%s,\x20%s',_0x3c0b2a,_0x31c3a1['error'][_0xebca('0x1b')]);return _0x5d8909(_0x31c3a1['error'][_0xebca('0x1b')]);}logger[_0xebca('0x19')](_0xebca('0x14'),_0x3c0b2a,_0x31c3a1[_0xebca('0x19')]['message']);return _0x525679(_0x31c3a1[_0xebca('0x19')][_0xebca('0x1b')]);}else{logger[_0xebca('0x13')](_0xebca('0x14'),_0x3c0b2a,'request\x20sent');_0x525679(_0x31c3a1[_0xebca('0x1c')][_0xebca('0x1b')]);}})[_0xebca('0x1d')](function(_0x4b1b1e){logger[_0xebca('0x19')](_0xebca('0x14'),_0x3c0b2a,_0x4b1b1e);_0x5d8909(_0x4b1b1e);});});}exports['GetChatQueue']=function(_0x2c0546){var _0x1a7cc0=this;return new Promise(function(_0x37b271,_0x337ebb){return db[_0xebca('0x1e')][_0xebca('0x1f')]({'raw':_0x2c0546[_0xebca('0x20')]?_0x2c0546[_0xebca('0x20')][_0xebca('0x21')]===undefined?!![]:![]:!![],'where':_0x2c0546[_0xebca('0x20')]?_0x2c0546[_0xebca('0x20')][_0xebca('0x22')]||null:null,'attributes':_0x2c0546[_0xebca('0x20')]?_0x2c0546[_0xebca('0x20')]['attributes']||null:null,'limit':_0x2c0546[_0xebca('0x20')]?_0x2c0546[_0xebca('0x20')][_0xebca('0x23')]||null:null,'include':_0x2c0546['options']?_0x2c0546['options'][_0xebca('0x24')]?_[_0xebca('0x25')](_0x2c0546['options'][_0xebca('0x24')],function(_0x163478){return{'model':db[_0x163478[_0xebca('0x26')]],'as':_0x163478['as'],'attributes':_0x163478['attributes'],'include':_0x163478[_0xebca('0x24')]?_[_0xebca('0x25')](_0x163478[_0xebca('0x24')],function(_0x2234af){return{'model':db[_0x2234af[_0xebca('0x26')]],'as':_0x2234af['as'],'attributes':_0x2234af[_0xebca('0x27')],'include':_0x2234af[_0xebca('0x24')]?_[_0xebca('0x25')](_0x2234af[_0xebca('0x24')],function(_0x98b94a){return{'model':db[_0x98b94a[_0xebca('0x26')]],'as':_0x98b94a['as'],'attributes':_0x98b94a[_0xebca('0x27')]};}):[]};}):[]};}):[]:[]})[_0xebca('0x12')](function(_0x3a49ba){logger[_0xebca('0x13')](_0xebca('0x28'),_0x2c0546);logger[_0xebca('0x15')](_0xebca('0x28'),_0x2c0546,JSON[_0xebca('0x18')](_0x3a49ba));_0x37b271(_0x3a49ba);})[_0xebca('0x1d')](function(_0x217398){logger[_0xebca('0x19')](_0xebca('0x28'),_0x217398[_0xebca('0x1b')],_0x2c0546);_0x337ebb(_0x1a7cc0[_0xebca('0x19')](0x1f4,_0x217398[_0xebca('0x1b')]));});});};exports['ShowChatQueue']=function(_0x1bdbbe){var _0xece17d=this;return new Promise(function(_0x4da32b,_0x594fbe){return db['ChatQueue'][_0xebca('0x29')]({'raw':_0x1bdbbe[_0xebca('0x20')]?_0x1bdbbe[_0xebca('0x20')][_0xebca('0x21')]===undefined?!![]:![]:!![],'where':_0x1bdbbe[_0xebca('0x20')]?_0x1bdbbe[_0xebca('0x20')][_0xebca('0x22')]||null:null,'attributes':_0x1bdbbe[_0xebca('0x20')]?_0x1bdbbe[_0xebca('0x20')][_0xebca('0x27')]||null:null,'include':_0x1bdbbe['options']?_0x1bdbbe[_0xebca('0x20')][_0xebca('0x24')]?_[_0xebca('0x25')](_0x1bdbbe[_0xebca('0x20')]['include'],function(_0x3c8eb3){return{'model':db[_0x3c8eb3[_0xebca('0x26')]],'as':_0x3c8eb3['as'],'attributes':_0x3c8eb3[_0xebca('0x27')],'include':_0x3c8eb3[_0xebca('0x24')]?_[_0xebca('0x25')](_0x3c8eb3[_0xebca('0x24')],function(_0x26c28f){return{'model':db[_0x26c28f[_0xebca('0x26')]],'as':_0x26c28f['as'],'attributes':_0x26c28f[_0xebca('0x27')],'include':_0x26c28f[_0xebca('0x24')]?_[_0xebca('0x25')](_0x26c28f[_0xebca('0x24')],function(_0x1c4a68){return{'model':db[_0x1c4a68[_0xebca('0x26')]],'as':_0x1c4a68['as'],'attributes':_0x1c4a68[_0xebca('0x27')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x176782){logger['info'](_0xebca('0x2a'),_0x1bdbbe);logger[_0xebca('0x15')]('ShowChatQueue',_0x1bdbbe,JSON[_0xebca('0x18')](_0x176782));_0x4da32b(_0x176782);})[_0xebca('0x1d')](function(_0x552fa1){logger[_0xebca('0x19')](_0xebca('0x2a'),_0x552fa1[_0xebca('0x1b')],_0x1bdbbe);_0x594fbe(_0xece17d['error'](0x1f4,_0x552fa1[_0xebca('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 24ae56d..e8bbb47 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 _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x14fd54,_0x139fed){var _0x25eb06=function(_0x31e0a7){while(--_0x31e0a7){_0x14fd54['push'](_0x14fd54['shift']());}};_0x25eb06(++_0x139fed);}(_0x5f2f,0x73));var _0xf5f2=function(_0x186500,_0x599e52){_0x186500=_0x186500-0x0;var _0x3cd160=_0x5f2f[_0x186500];return _0x3cd160;};'use strict';var ChatQueueEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatQueueEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatQueueEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0xadb5=['update','emit','register','length','chatQueue:','save'];(function(_0x20e991,_0x126d53){var _0xbe4e1f=function(_0x402109){while(--_0x402109){_0x20e991['push'](_0x20e991['shift']());}};_0xbe4e1f(++_0x126d53);}(_0xadb5,0xad));var _0x5adb=function(_0x124345,_0x2fbdbd){_0x124345=_0x124345-0x0;var _0xb5778d=_0xadb5[_0x124345];return _0xb5778d;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x5adb('0x0'),'remove',_0x5adb('0x1')];function createListener(_0x38f67f,_0x3129c3){return function(_0x4aecec){_0x3129c3[_0x5adb('0x2')](_0x38f67f,_0x4aecec);};}function removeListener(_0x31457,_0x2e3ef4){return function(){ChatQueueEvents['removeListener'](_0x31457,_0x2e3ef4);};}exports[_0x5adb('0x3')]=function(_0x168d89){for(var _0x3e2555=0x0,_0x3213e8=events[_0x5adb('0x4')];_0x3e2555<_0x3213e8;_0x3e2555++){var _0x353885=events[_0x3e2555];var _0x47228a=createListener(_0x5adb('0x5')+_0x353885,_0x168d89);ChatQueueEvents['on'](_0x353885,_0x47228a);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 1f574c6..f712bc6 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 _0x6e9c=['removeTeams','multer','util','path','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','update','delete','destroy','/:id/teams'];(function(_0x520cd9,_0x48a7d2){var _0xb14a5a=function(_0x10f179){while(--_0x10f179){_0x520cd9['push'](_0x520cd9['shift']());}};_0xb14a5a(++_0x48a7d2);}(_0x6e9c,0x153));var _0xc6e9=function(_0x200736,_0x3efef9){_0x200736=_0x200736-0x0;var _0x38e9f7=_0x6e9c[_0x200736];return _0x38e9f7;};'use strict';var multer=require(_0xc6e9('0x0'));var util=require(_0xc6e9('0x1'));var path=require(_0xc6e9('0x2'));var timeout=require('connect-timeout');var express=require(_0xc6e9('0x3'));var router=express[_0xc6e9('0x4')]();var fs_extra=require(_0xc6e9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc6e9('0x6'));var config=require('../../config/environment');var controller=require('./chatQueue.controller');router['get']('/',auth[_0xc6e9('0x7')](),controller[_0xc6e9('0x8')]);router[_0xc6e9('0x9')](_0xc6e9('0xa'),auth['isAuthenticated'](),controller[_0xc6e9('0xb')]);router[_0xc6e9('0x9')](_0xc6e9('0xc'),auth[_0xc6e9('0x7')](),controller[_0xc6e9('0xd')]);router[_0xc6e9('0x9')](_0xc6e9('0xe'),auth[_0xc6e9('0x7')](),controller[_0xc6e9('0xf')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller[_0xc6e9('0x10')]);router['get'](_0xc6e9('0x11'),auth[_0xc6e9('0x7')](),controller[_0xc6e9('0x12')]);router[_0xc6e9('0x13')]('/',auth[_0xc6e9('0x7')](),controller[_0xc6e9('0x14')]);router[_0xc6e9('0x13')]('/:id/teams',auth[_0xc6e9('0x7')](),controller['addTeams']);router[_0xc6e9('0x13')](_0xc6e9('0x11'),auth[_0xc6e9('0x7')](),controller['addAgents']);router['put']('/:id',auth[_0xc6e9('0x7')](),controller[_0xc6e9('0x15')]);router[_0xc6e9('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xc6e9('0x17')]);router[_0xc6e9('0x16')](_0xc6e9('0x18'),auth[_0xc6e9('0x7')](),controller[_0xc6e9('0x19')]);router['delete'](_0xc6e9('0x11'),auth[_0xc6e9('0x7')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x953d=['getTeams','/:id/users','getAgents','post','create','addAgents','put','update','destroy','delete','/:id/teams','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','isAuthenticated','get','/:id','show','/:id/members','getMembers'];(function(_0x55b6d1,_0xdaa810){var _0x2b04db=function(_0xe6219c){while(--_0xe6219c){_0x55b6d1['push'](_0x55b6d1['shift']());}};_0x2b04db(++_0xdaa810);}(_0x953d,0x93));var _0xd953=function(_0x92724b,_0x18e7d6){_0x92724b=_0x92724b-0x0;var _0x12e4f5=_0x953d[_0x92724b];return _0x12e4f5;};'use strict';var multer=require('multer');var util=require(_0xd953('0x0'));var path=require(_0xd953('0x1'));var timeout=require(_0xd953('0x2'));var express=require('express');var router=express[_0xd953('0x3')]();var fs_extra=require(_0xd953('0x4'));var auth=require(_0xd953('0x5'));var interaction=require(_0xd953('0x6'));var config=require(_0xd953('0x7'));var controller=require(_0xd953('0x8'));router['get']('/',auth[_0xd953('0x9')](),controller['index']);router[_0xd953('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xd953('0xb'),auth['isAuthenticated'](),controller[_0xd953('0xc')]);router[_0xd953('0xa')](_0xd953('0xd'),auth[_0xd953('0x9')](),controller[_0xd953('0xe')]);router[_0xd953('0xa')]('/:id/teams',auth[_0xd953('0x9')](),controller[_0xd953('0xf')]);router[_0xd953('0xa')](_0xd953('0x10'),auth[_0xd953('0x9')](),controller[_0xd953('0x11')]);router[_0xd953('0x12')]('/',auth[_0xd953('0x9')](),controller[_0xd953('0x13')]);router[_0xd953('0x12')]('/:id/teams',auth[_0xd953('0x9')](),controller['addTeams']);router[_0xd953('0x12')](_0xd953('0x10'),auth['isAuthenticated'](),controller[_0xd953('0x14')]);router[_0xd953('0x15')](_0xd953('0xb'),auth[_0xd953('0x9')](),controller[_0xd953('0x16')]);router['delete']('/:id',auth[_0xd953('0x9')](),controller[_0xd953('0x17')]);router[_0xd953('0x18')](_0xd953('0x19'),auth[_0xd953('0x9')](),controller['removeTeams']);router['delete'](_0xd953('0x10'),auth[_0xd953('0x9')](),controller['removeAgents']);module[_0xd953('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index ce273a2..3295193 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 _0x656c=['DATE','sequelize','exports','STRING'];(function(_0x25069b,_0x982036){var _0x1998c2=function(_0x4d9407){while(--_0x4d9407){_0x25069b['push'](_0x25069b['shift']());}};_0x1998c2(++_0x982036);}(_0x656c,0xc1));var _0xc656=function(_0x517639,_0xf163c3){_0x517639=_0x517639-0x0;var _0x5c05c2=_0x656c[_0x517639];return _0x5c05c2;};'use strict';var moment=require('moment');var Sequelize=require(_0xc656('0x0'));module[_0xc656('0x1')]={'uniqueid':{'type':Sequelize[_0xc656('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xc656('0x2')]},'joinAt':{'type':Sequelize[_0xc656('0x3')]},'leaveAt':{'type':Sequelize[_0xc656('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xc656('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xed0d=['DATE','moment','sequelize','exports','STRING'];(function(_0x35d06e,_0x2e3503){var _0x9e9053=function(_0x1546d3){while(--_0x1546d3){_0x35d06e['push'](_0x35d06e['shift']());}};_0x9e9053(++_0x2e3503);}(_0xed0d,0xc4));var _0xded0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xed0d[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xded0('0x0'));var Sequelize=require(_0xded0('0x1'));module[_0xded0('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xded0('0x3')]},'joinAt':{'type':Sequelize[_0xded0('0x4')]},'leaveAt':{'type':Sequelize[_0xded0('0x4')]},'acceptAt':{'type':Sequelize[_0xded0('0x4')]},'exitAt':{'type':Sequelize[_0xded0('0x4')]},'reason':{'type':Sequelize[_0xded0('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index fc6bbe6..96b6aa1 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 _0x6322=['fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','ChatQueueReport','rawAttributes'];(function(_0x10c51f,_0x11270f){var _0x56a0cd=function(_0x563ac6){while(--_0x563ac6){_0x10c51f['push'](_0x10c51f['shift']());}};_0x56a0cd(++_0x11270f);}(_0x6322,0x1c6));var _0x2632=function(_0x1fa097,_0x1e9453){_0x1fa097=_0x1fa097-0x0;var _0x4318db=_0x6322[_0x1fa097];return _0x4318db;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2632('0x0'));var rimraf=require(_0x2632('0x1'));var zipdir=require(_0x2632('0x2'));var jsonpatch=require(_0x2632('0x3'));var rp=require('request-promise');var moment=require(_0x2632('0x4'));var BPromise=require(_0x2632('0x5'));var Mustache=require('mustache');var util=require(_0x2632('0x6'));var path=require(_0x2632('0x7'));var sox=require(_0x2632('0x8'));var csv=require(_0x2632('0x9'));var ejs=require(_0x2632('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2632('0xb'));var crypto=require(_0x2632('0xc'));var jsforce=require(_0x2632('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2632('0x9'));var querystring=require('querystring');var Papa=require(_0x2632('0xe'));var Redis=require(_0x2632('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2632('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2632('0x11'));var logger=require('../../config/logger')(_0x2632('0x12'));var utils=require(_0x2632('0x13'));var config=require(_0x2632('0x14'));var licenseUtil=require(_0x2632('0x15'));var db=require(_0x2632('0x16'))['db'];function respondWithStatusCode(_0x440f63,_0x644c3a){_0x644c3a=_0x644c3a||0xcc;return function(_0x1441b1){if(_0x1441b1){return _0x440f63[_0x2632('0x17')](_0x644c3a);}return _0x440f63[_0x2632('0x18')](_0x644c3a)[_0x2632('0x19')]();};}function respondWithResult(_0x2012ab,_0x549816){_0x549816=_0x549816||0xc8;return function(_0x4a2826){if(_0x4a2826){return _0x2012ab[_0x2632('0x18')](_0x549816)['json'](_0x4a2826);}};}function respondWithFilteredResult(_0x9ce996,_0x28e052){return function(_0x21abc8){if(_0x21abc8){var _0x58f215=_0x21abc8[_0x2632('0x1a')],_0xf15bee=_0x28e052[_0x2632('0x1b')],_0x211ce1=_0x28e052['offset']+_0x28e052[_0x2632('0x1c')],_0x1d67a3;if(_0x211ce1>=_0x58f215){_0x211ce1=_0x58f215;_0x1d67a3=0xc8;}else{_0x1d67a3=0xce;}_0x9ce996[_0x2632('0x18')](_0x1d67a3);return _0x9ce996['set'](_0x2632('0x1d'),_0xf15bee+'-'+_0x211ce1+'/'+_0x58f215)['json'](_0x21abc8);}return null;};}function patchUpdates(_0x3b1235){return function(_0x46a581){try{jsonpatch[_0x2632('0x1e')](_0x46a581,_0x3b1235,!![]);}catch(_0xfaa5d5){return BPromise['reject'](_0xfaa5d5);}return _0x46a581[_0x2632('0x1f')]();};}function saveUpdates(_0x2f3375,_0x14387d){return function(_0x76e03b){if(_0x76e03b){return _0x76e03b[_0x2632('0x20')](_0x2f3375)['then'](function(_0x54e9d0){return _0x54e9d0;});}return null;};}function removeEntity(_0x217f75,_0x3967e9){return function(_0x254e48){if(_0x254e48){return _0x254e48[_0x2632('0x21')]()[_0x2632('0x22')](function(){_0x217f75['status'](0xcc)[_0x2632('0x19')]();});}};}function handleEntityNotFound(_0xc09244,_0x4920ce){return function(_0x1ee5b6){if(!_0x1ee5b6){_0xc09244[_0x2632('0x17')](0x194);}return _0x1ee5b6;};}function handleError(_0x4f8bc2,_0x27d263){_0x27d263=_0x27d263||0x1f4;return function(_0x352308){logger[_0x2632('0x23')](_0x352308[_0x2632('0x24')]);if(_0x352308[_0x2632('0x25')]){delete _0x352308[_0x2632('0x25')];}_0x4f8bc2[_0x2632('0x18')](_0x27d263)[_0x2632('0x26')](_0x352308);};}exports[_0x2632('0x27')]=function(_0x486d19,_0x513302){var _0x19e0be={},_0x1b8717={},_0x299a8e={'count':0x0,'rows':[]};var _0x1dfec1=_[_0x2632('0x28')](db[_0x2632('0x29')][_0x2632('0x2a')],function(_0x3a3387){return{'name':_0x3a3387[_0x2632('0x2b')],'type':_0x3a3387[_0x2632('0x2c')][_0x2632('0x2d')]};});_0x1b8717[_0x2632('0x2e')]=_[_0x2632('0x28')](_0x1dfec1,_0x2632('0x25'));_0x1b8717['query']=_[_0x2632('0x2f')](_0x486d19[_0x2632('0x30')]);_0x1b8717[_0x2632('0x31')]=_[_0x2632('0x32')](_0x1b8717[_0x2632('0x2e')],_0x1b8717[_0x2632('0x30')]);_0x19e0be[_0x2632('0x33')]=_[_0x2632('0x32')](_0x1b8717[_0x2632('0x2e')],qs[_0x2632('0x34')](_0x486d19['query'][_0x2632('0x34')]));_0x19e0be[_0x2632('0x33')]=_0x19e0be[_0x2632('0x33')][_0x2632('0x35')]?_0x19e0be[_0x2632('0x33')]:_0x1b8717[_0x2632('0x2e')];if(!_0x486d19['query']['hasOwnProperty']('nolimit')){_0x19e0be[_0x2632('0x1c')]=qs[_0x2632('0x1c')](_0x486d19[_0x2632('0x30')][_0x2632('0x1c')]);_0x19e0be[_0x2632('0x1b')]=qs['offset'](_0x486d19[_0x2632('0x30')][_0x2632('0x1b')]);}_0x19e0be[_0x2632('0x36')]=qs[_0x2632('0x37')](_0x486d19[_0x2632('0x30')][_0x2632('0x37')]);_0x19e0be[_0x2632('0x38')]=qs[_0x2632('0x31')](_['pick'](_0x486d19[_0x2632('0x30')],_0x1b8717[_0x2632('0x31')]),_0x1dfec1);if(_0x486d19['query'][_0x2632('0x39')]){_0x19e0be[_0x2632('0x38')]=_[_0x2632('0x3a')](_0x19e0be[_0x2632('0x38')],{'$or':_[_0x2632('0x28')](_0x1dfec1,function(_0x344941){if(_0x344941[_0x2632('0x2c')]!=='VIRTUAL'){var _0x4a0039={};_0x4a0039[_0x344941['name']]={'$like':'%'+_0x486d19[_0x2632('0x30')][_0x2632('0x39')]+'%'};return _0x4a0039;}})});}_0x19e0be=_['merge']({},_0x19e0be,_0x486d19[_0x2632('0x3b')]);var _0x2a6b44={'where':_0x19e0be[_0x2632('0x38')]};return db[_0x2632('0x29')][_0x2632('0x1a')](_0x2a6b44)[_0x2632('0x22')](function(_0x4aec2b){_0x299a8e['count']=_0x4aec2b;if(_0x486d19[_0x2632('0x30')]['includeAll']){_0x19e0be[_0x2632('0x3c')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x2632('0x3d')](_0x19e0be);})[_0x2632('0x22')](function(_0x47d9a8){_0x299a8e[_0x2632('0x3e')]=_0x47d9a8;return _0x299a8e;})[_0x2632('0x22')](respondWithFilteredResult(_0x513302,_0x19e0be))[_0x2632('0x3f')](handleError(_0x513302,null));};exports[_0x2632('0x40')]=function(_0x3c7708,_0x41fa5e){var _0x10bf7b={'raw':!![],'where':{'id':_0x3c7708[_0x2632('0x41')]['id']}},_0x10735d={};_0x10735d['model']=_[_0x2632('0x2f')](db[_0x2632('0x29')][_0x2632('0x2a')]);_0x10735d[_0x2632('0x30')]=_[_0x2632('0x2f')](_0x3c7708['query']);_0x10735d[_0x2632('0x31')]=_['intersection'](_0x10735d[_0x2632('0x2e')],_0x10735d[_0x2632('0x30')]);_0x10bf7b['attributes']=_[_0x2632('0x32')](_0x10735d[_0x2632('0x2e')],qs[_0x2632('0x34')](_0x3c7708['query']['fields']));_0x10bf7b[_0x2632('0x33')]=_0x10bf7b['attributes'][_0x2632('0x35')]?_0x10bf7b[_0x2632('0x33')]:_0x10735d['model'];if(_0x3c7708['query'][_0x2632('0x42')]){_0x10bf7b[_0x2632('0x3c')]=[{'all':!![]}];}_0x10bf7b=_[_0x2632('0x3a')]({},_0x10bf7b,_0x3c7708['options']);return db[_0x2632('0x29')][_0x2632('0x43')](_0x10bf7b)[_0x2632('0x22')](handleEntityNotFound(_0x41fa5e,null))[_0x2632('0x22')](respondWithResult(_0x41fa5e,null))[_0x2632('0x3f')](handleError(_0x41fa5e,null));};exports[_0x2632('0x44')]=function(_0x28ed69,_0x4e0c6e){return db['ChatQueueReport'][_0x2632('0x44')](_0x28ed69[_0x2632('0x45')],{})['then'](respondWithResult(_0x4e0c6e,0xc9))[_0x2632('0x3f')](handleError(_0x4e0c6e,null));};exports[_0x2632('0x20')]=function(_0x5283b0,_0x1f9deb){if(_0x5283b0[_0x2632('0x45')]['id']){delete _0x5283b0[_0x2632('0x45')]['id'];}return db['ChatQueueReport'][_0x2632('0x43')]({'where':{'id':_0x5283b0[_0x2632('0x41')]['id']}})[_0x2632('0x22')](handleEntityNotFound(_0x1f9deb,null))[_0x2632('0x22')](saveUpdates(_0x5283b0[_0x2632('0x45')],null))[_0x2632('0x22')](respondWithResult(_0x1f9deb,null))[_0x2632('0x3f')](handleError(_0x1f9deb,null));};exports[_0x2632('0x21')]=function(_0xb82ef0,_0x6940c0){return db[_0x2632('0x29')][_0x2632('0x43')]({'where':{'id':_0xb82ef0['params']['id']}})[_0x2632('0x22')](handleEntityNotFound(_0x6940c0,null))[_0x2632('0x22')](removeEntity(_0x6940c0,null))[_0x2632('0x3f')](handleError(_0x6940c0,null));};exports[_0x2632('0x46')]=function(_0x4392b1,_0x347fbb){return db[_0x2632('0x29')][_0x2632('0x46')]()[_0x2632('0x22')](respondWithResult(_0x347fbb,null))[_0x2632('0x3f')](handleError(_0x347fbb,null));}; \ No newline at end of file +var _0xdeeb=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','keys','query','filters','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','find','catch','create','body','params','describe','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5e5c4c,_0x21abba){var _0x176148=function(_0x59522a){while(--_0x59522a){_0x5e5c4c['push'](_0x5e5c4c['shift']());}};_0x176148(++_0x21abba);}(_0xdeeb,0x1b4));var _0xbdee=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0xdeeb[_0x1ae5ab];return _0x1ce001;};'use strict';var pdf=require(_0xbdee('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbdee('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbdee('0x2'));var rp=require(_0xbdee('0x3'));var moment=require('moment');var BPromise=require(_0xbdee('0x4'));var Mustache=require(_0xbdee('0x5'));var util=require(_0xbdee('0x6'));var path=require(_0xbdee('0x7'));var sox=require(_0xbdee('0x8'));var csv=require(_0xbdee('0x9'));var ejs=require(_0xbdee('0xa'));var fs=require('fs');var fs_extra=require(_0xbdee('0xb'));var _=require('lodash');var squel=require(_0xbdee('0xc'));var crypto=require('crypto');var jsforce=require(_0xbdee('0xd'));var deskjs=require(_0xbdee('0xe'));var toCsv=require(_0xbdee('0x9'));var querystring=require('querystring');var Papa=require(_0xbdee('0xf'));var Redis=require(_0xbdee('0x10'));var authService=require(_0xbdee('0x11'));var qs=require(_0xbdee('0x12'));var as=require(_0xbdee('0x13'));var hardwareService=require(_0xbdee('0x14'));var logger=require(_0xbdee('0x15'))(_0xbdee('0x16'));var utils=require(_0xbdee('0x17'));var config=require(_0xbdee('0x18'));var licenseUtil=require(_0xbdee('0x19'));var db=require(_0xbdee('0x1a'))['db'];function respondWithStatusCode(_0x99fe04,_0x26e035){_0x26e035=_0x26e035||0xcc;return function(_0x355b9e){if(_0x355b9e){return _0x99fe04['sendStatus'](_0x26e035);}return _0x99fe04[_0xbdee('0x1b')](_0x26e035)[_0xbdee('0x1c')]();};}function respondWithResult(_0x47521b,_0x560bf3){_0x560bf3=_0x560bf3||0xc8;return function(_0x297d33){if(_0x297d33){return _0x47521b[_0xbdee('0x1b')](_0x560bf3)[_0xbdee('0x1d')](_0x297d33);}};}function respondWithFilteredResult(_0x449c6c,_0x1e5e5a){return function(_0x5d9434){if(_0x5d9434){var _0x4ea595=_0x5d9434[_0xbdee('0x1e')],_0x41a6d1=_0x1e5e5a[_0xbdee('0x1f')],_0x190471=_0x1e5e5a[_0xbdee('0x1f')]+_0x1e5e5a[_0xbdee('0x20')],_0x48640e;if(_0x190471>=_0x4ea595){_0x190471=_0x4ea595;_0x48640e=0xc8;}else{_0x48640e=0xce;}_0x449c6c[_0xbdee('0x1b')](_0x48640e);return _0x449c6c[_0xbdee('0x21')](_0xbdee('0x22'),_0x41a6d1+'-'+_0x190471+'/'+_0x4ea595)['json'](_0x5d9434);}return null;};}function patchUpdates(_0x399441){return function(_0x50700d){try{jsonpatch[_0xbdee('0x23')](_0x50700d,_0x399441,!![]);}catch(_0x27dde5){return BPromise[_0xbdee('0x24')](_0x27dde5);}return _0x50700d['save']();};}function saveUpdates(_0x49fb1e,_0x2ef9d5){return function(_0x1e2e84){if(_0x1e2e84){return _0x1e2e84[_0xbdee('0x25')](_0x49fb1e)[_0xbdee('0x26')](function(_0x3800f5){return _0x3800f5;});}return null;};}function removeEntity(_0x286c34,_0x1bdf2e){return function(_0xba1ad6){if(_0xba1ad6){return _0xba1ad6[_0xbdee('0x27')]()['then'](function(){_0x286c34['status'](0xcc)[_0xbdee('0x1c')]();});}};}function handleEntityNotFound(_0x58f21d,_0x569dfb){return function(_0x2c89ee){if(!_0x2c89ee){_0x58f21d[_0xbdee('0x28')](0x194);}return _0x2c89ee;};}function handleError(_0x5898a9,_0x3707fd){_0x3707fd=_0x3707fd||0x1f4;return function(_0x41f3ff){logger[_0xbdee('0x29')](_0x41f3ff[_0xbdee('0x2a')]);if(_0x41f3ff[_0xbdee('0x2b')]){delete _0x41f3ff['name'];}_0x5898a9['status'](_0x3707fd)[_0xbdee('0x2c')](_0x41f3ff);};}exports[_0xbdee('0x2d')]=function(_0x2dbd6a,_0x17ac42){var _0x47d783={},_0x57c17c={},_0x4e4f39={'count':0x0,'rows':[]};var _0x1de45e=_[_0xbdee('0x2e')](db[_0xbdee('0x2f')][_0xbdee('0x30')],function(_0x46f805){return{'name':_0x46f805[_0xbdee('0x31')],'type':_0x46f805['type']['key']};});_0x57c17c['model']=_[_0xbdee('0x2e')](_0x1de45e,_0xbdee('0x2b'));_0x57c17c['query']=_[_0xbdee('0x32')](_0x2dbd6a[_0xbdee('0x33')]);_0x57c17c[_0xbdee('0x34')]=_['intersection'](_0x57c17c[_0xbdee('0x35')],_0x57c17c[_0xbdee('0x33')]);_0x47d783[_0xbdee('0x36')]=_['intersection'](_0x57c17c[_0xbdee('0x35')],qs[_0xbdee('0x37')](_0x2dbd6a['query'][_0xbdee('0x37')]));_0x47d783[_0xbdee('0x36')]=_0x47d783[_0xbdee('0x36')][_0xbdee('0x38')]?_0x47d783[_0xbdee('0x36')]:_0x57c17c[_0xbdee('0x35')];if(!_0x2dbd6a[_0xbdee('0x33')]['hasOwnProperty'](_0xbdee('0x39'))){_0x47d783[_0xbdee('0x20')]=qs[_0xbdee('0x20')](_0x2dbd6a[_0xbdee('0x33')][_0xbdee('0x20')]);_0x47d783[_0xbdee('0x1f')]=qs[_0xbdee('0x1f')](_0x2dbd6a[_0xbdee('0x33')][_0xbdee('0x1f')]);}_0x47d783[_0xbdee('0x3a')]=qs[_0xbdee('0x3b')](_0x2dbd6a[_0xbdee('0x33')][_0xbdee('0x3b')]);_0x47d783['where']=qs[_0xbdee('0x34')](_[_0xbdee('0x3c')](_0x2dbd6a[_0xbdee('0x33')],_0x57c17c[_0xbdee('0x34')]),_0x1de45e);if(_0x2dbd6a['query'][_0xbdee('0x3d')]){_0x47d783[_0xbdee('0x3e')]=_[_0xbdee('0x3f')](_0x47d783[_0xbdee('0x3e')],{'$or':_[_0xbdee('0x2e')](_0x1de45e,function(_0x31edd6){if(_0x31edd6[_0xbdee('0x40')]!==_0xbdee('0x41')){var _0x29b9e5={};_0x29b9e5[_0x31edd6[_0xbdee('0x2b')]]={'$like':'%'+_0x2dbd6a[_0xbdee('0x33')][_0xbdee('0x3d')]+'%'};return _0x29b9e5;}})});}_0x47d783=_[_0xbdee('0x3f')]({},_0x47d783,_0x2dbd6a[_0xbdee('0x42')]);var _0x183713={'where':_0x47d783[_0xbdee('0x3e')]};return db[_0xbdee('0x2f')][_0xbdee('0x1e')](_0x183713)['then'](function(_0x41c1bc){_0x4e4f39[_0xbdee('0x1e')]=_0x41c1bc;if(_0x2dbd6a[_0xbdee('0x33')][_0xbdee('0x43')]){_0x47d783[_0xbdee('0x44')]=[{'all':!![]}];}return db['ChatQueueReport'][_0xbdee('0x45')](_0x47d783);})['then'](function(_0x385931){_0x4e4f39['rows']=_0x385931;return _0x4e4f39;})['then'](respondWithFilteredResult(_0x17ac42,_0x47d783))['catch'](handleError(_0x17ac42,null));};exports['show']=function(_0x3875f2,_0x2f67cf){var _0x5a2715={'raw':!![],'where':{'id':_0x3875f2['params']['id']}},_0x493634={};_0x493634[_0xbdee('0x35')]=_[_0xbdee('0x32')](db[_0xbdee('0x2f')][_0xbdee('0x30')]);_0x493634[_0xbdee('0x33')]=_[_0xbdee('0x32')](_0x3875f2[_0xbdee('0x33')]);_0x493634[_0xbdee('0x34')]=_['intersection'](_0x493634[_0xbdee('0x35')],_0x493634[_0xbdee('0x33')]);_0x5a2715[_0xbdee('0x36')]=_['intersection'](_0x493634[_0xbdee('0x35')],qs['fields'](_0x3875f2[_0xbdee('0x33')][_0xbdee('0x37')]));_0x5a2715['attributes']=_0x5a2715[_0xbdee('0x36')]['length']?_0x5a2715[_0xbdee('0x36')]:_0x493634['model'];if(_0x3875f2['query'][_0xbdee('0x43')]){_0x5a2715[_0xbdee('0x44')]=[{'all':!![]}];}_0x5a2715=_[_0xbdee('0x3f')]({},_0x5a2715,_0x3875f2[_0xbdee('0x42')]);return db[_0xbdee('0x2f')][_0xbdee('0x46')](_0x5a2715)[_0xbdee('0x26')](handleEntityNotFound(_0x2f67cf,null))['then'](respondWithResult(_0x2f67cf,null))[_0xbdee('0x47')](handleError(_0x2f67cf,null));};exports[_0xbdee('0x48')]=function(_0x459f0c,_0x2f3076){return db[_0xbdee('0x2f')][_0xbdee('0x48')](_0x459f0c[_0xbdee('0x49')],{})[_0xbdee('0x26')](respondWithResult(_0x2f3076,0xc9))[_0xbdee('0x47')](handleError(_0x2f3076,null));};exports[_0xbdee('0x25')]=function(_0x8266f0,_0x397d2e){if(_0x8266f0[_0xbdee('0x49')]['id']){delete _0x8266f0[_0xbdee('0x49')]['id'];}return db['ChatQueueReport'][_0xbdee('0x46')]({'where':{'id':_0x8266f0[_0xbdee('0x4a')]['id']}})[_0xbdee('0x26')](handleEntityNotFound(_0x397d2e,null))[_0xbdee('0x26')](saveUpdates(_0x8266f0[_0xbdee('0x49')],null))[_0xbdee('0x26')](respondWithResult(_0x397d2e,null))['catch'](handleError(_0x397d2e,null));};exports['destroy']=function(_0x40d52f,_0x3f8bbd){return db[_0xbdee('0x2f')][_0xbdee('0x46')]({'where':{'id':_0x40d52f['params']['id']}})['then'](handleEntityNotFound(_0x3f8bbd,null))[_0xbdee('0x26')](removeEntity(_0x3f8bbd,null))['catch'](handleError(_0x3f8bbd,null));};exports[_0xbdee('0x4b')]=function(_0x4c9b6e,_0x25ab35){return db[_0xbdee('0x2f')][_0xbdee('0x4b')]()[_0xbdee('0x26')](respondWithResult(_0x25ab35,null))[_0xbdee('0x47')](handleError(_0x25ab35,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index bf443ad..2ff6109 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 _0xdc47=['uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','./chatQueueReport.attributes','ChatQueueReport','report_chat_queue'];(function(_0x5666ba,_0x8533c2){var _0x2954a5=function(_0x206aa2){while(--_0x206aa2){_0x5666ba['push'](_0x5666ba['shift']());}};_0x2954a5(++_0x8533c2);}(_0xdc47,0xa1));var _0x7dc4=function(_0x3d2d6f,_0x368872){_0x3d2d6f=_0x3d2d6f-0x0;var _0x5c0022=_0xdc47[_0x3d2d6f];return _0x5c0022;};'use strict';var _=require(_0x7dc4('0x0'));var util=require(_0x7dc4('0x1'));var logger=require(_0x7dc4('0x2'))(_0x7dc4('0x3'));var moment=require('moment');var BPromise=require(_0x7dc4('0x4'));var rp=require(_0x7dc4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7dc4('0x6'));module['exports']=function(_0x4b91ce,_0x57a7cd){return _0x4b91ce['define'](_0x7dc4('0x7'),attributes,{'tableName':_0x7dc4('0x8'),'paranoid':![],'indexes':[{'name':_0x7dc4('0x9'),'fields':[_0x7dc4('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xada5=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue'];(function(_0x4116fe,_0x1d04ad){var _0xc7ba30=function(_0x58e560){while(--_0x58e560){_0x4116fe['push'](_0x4116fe['shift']());}};_0xc7ba30(++_0x1d04ad);}(_0xada5,0x196));var _0x5ada=function(_0x2fed61,_0x4a6726){_0x2fed61=_0x2fed61-0x0;var _0x5a1924=_0xada5[_0x2fed61];return _0x5a1924;};'use strict';var _=require(_0x5ada('0x0'));var util=require(_0x5ada('0x1'));var logger=require(_0x5ada('0x2'))('api');var moment=require(_0x5ada('0x3'));var BPromise=require(_0x5ada('0x4'));var rp=require(_0x5ada('0x5'));var fs=require('fs');var path=require(_0x5ada('0x6'));var rimraf=require(_0x5ada('0x7'));var config=require(_0x5ada('0x8'));var attributes=require(_0x5ada('0x9'));module[_0x5ada('0xa')]=function(_0x361d0f,_0x186dfd){return _0x361d0f[_0x5ada('0xb')](_0x5ada('0xc'),attributes,{'tableName':_0x5ada('0xd'),'paranoid':![],'indexes':[{'name':_0x5ada('0xe'),'fields':[_0x5ada('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 786e1c0..c014d38 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 _0x33e2=['update','where','attributes','limit','UpdateChatQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','info','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','catch','ChatQueueReport','create','options','raw','then','CreateChatQueueReport','debug','stringify'];(function(_0x104b47,_0x491eff){var _0x34a3f1=function(_0x467a15){while(--_0x467a15){_0x104b47['push'](_0x104b47['shift']());}};_0x34a3f1(++_0x491eff);}(_0x33e2,0x19d));var _0x233e=function(_0x531a19,_0x43e019){_0x531a19=_0x531a19-0x0;var _0x4845d2=_0x33e2[_0x531a19];return _0x4845d2;};'use strict';var _=require(_0x233e('0x0'));var util=require(_0x233e('0x1'));var moment=require(_0x233e('0x2'));var BPromise=require(_0x233e('0x3'));var rs=require(_0x233e('0x4'));var fs=require('fs');var Redis=require(_0x233e('0x5'));var db=require(_0x233e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x233e('0x7'))(_0x233e('0x8'));var config=require('../../config/environment');var jayson=require(_0x233e('0x9'));var client=jayson['client'][_0x233e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x343179,_0x5bb573,_0x2a5de8){return new BPromise(function(_0x400025,_0x13b313){return client[_0x233e('0xb')](_0x343179,_0x2a5de8)['then'](function(_0x2adc18){logger[_0x233e('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x5bb573,'request\x20sent');logger['debug'](_0x233e('0xd'),_0x5bb573,_0x233e('0xe'),JSON['stringify'](_0x2adc18));if(_0x2adc18[_0x233e('0xf')]){if(_0x2adc18[_0x233e('0xf')][_0x233e('0x10')]===0x1f4){logger[_0x233e('0xf')](_0x233e('0x11'),_0x5bb573,_0x2adc18[_0x233e('0xf')][_0x233e('0x12')]);return _0x13b313(_0x2adc18[_0x233e('0xf')][_0x233e('0x12')]);}logger['error'](_0x233e('0x11'),_0x5bb573,_0x2adc18[_0x233e('0xf')][_0x233e('0x12')]);return _0x400025(_0x2adc18[_0x233e('0xf')][_0x233e('0x12')]);}else{logger[_0x233e('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x5bb573,_0x233e('0xe'));_0x400025(_0x2adc18[_0x233e('0x13')][_0x233e('0x12')]);}})[_0x233e('0x14')](function(_0x258969){logger[_0x233e('0xf')](_0x233e('0x11'),_0x5bb573,_0x258969);_0x13b313(_0x258969);});});}exports['CreateChatQueueReport']=function(_0x5226d5){var _0x4af3f1=this;return new Promise(function(_0x2c32e7,_0x4990c3){return db[_0x233e('0x15')][_0x233e('0x16')](_0x5226d5['body'],{'raw':_0x5226d5[_0x233e('0x17')]?_0x5226d5[_0x233e('0x17')][_0x233e('0x18')]===undefined?!![]:![]:!![]})[_0x233e('0x19')](function(_0x5f0f5b){logger[_0x233e('0xc')](_0x233e('0x1a'),_0x5226d5);logger[_0x233e('0x1b')]('CreateChatQueueReport',_0x5226d5,JSON[_0x233e('0x1c')](_0x5f0f5b));_0x2c32e7(_0x5f0f5b);})[_0x233e('0x14')](function(_0x2c6632){logger[_0x233e('0xf')](_0x233e('0x1a'),_0x2c6632[_0x233e('0x12')],_0x5226d5);_0x4990c3(_0x4af3f1[_0x233e('0xf')](0x1f4,_0x2c6632[_0x233e('0x12')]));});});};exports['UpdateChatQueueReport']=function(_0x1f93db){var _0xaceabf=this;return new Promise(function(_0x958d96,_0x4e0025){return db['ChatQueueReport'][_0x233e('0x1d')](_0x1f93db['body'],{'raw':_0x1f93db[_0x233e('0x17')]?_0x1f93db[_0x233e('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f93db[_0x233e('0x17')]?_0x1f93db[_0x233e('0x17')][_0x233e('0x1e')]||null:null,'attributes':_0x1f93db[_0x233e('0x17')]?_0x1f93db[_0x233e('0x17')][_0x233e('0x1f')]||null:null,'limit':_0x1f93db['options']?_0x1f93db['options'][_0x233e('0x20')]||null:null})[_0x233e('0x19')](function(_0x26f18c){logger['info'](_0x233e('0x21'),_0x1f93db);logger[_0x233e('0x1b')](_0x233e('0x21'),_0x1f93db,JSON[_0x233e('0x1c')](_0x26f18c));_0x958d96(_0x26f18c);})[_0x233e('0x14')](function(_0x5ea241){logger[_0x233e('0xf')](_0x233e('0x21'),_0x5ea241['message'],_0x1f93db);_0x4e0025(_0xaceabf['error'](0x1f4,_0x5ea241['message']));});});}; \ No newline at end of file +var _0x6111=['UpdateChatQueueReport','update','body','raw','attributes','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','options','debug'];(function(_0x132c72,_0x45663f){var _0x12007d=function(_0xb3314b){while(--_0xb3314b){_0x132c72['push'](_0x132c72['shift']());}};_0x12007d(++_0x45663f);}(_0x6111,0x113));var _0x1611=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6111[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x1611('0x0'));var moment=require(_0x1611('0x1'));var BPromise=require(_0x1611('0x2'));var rs=require(_0x1611('0x3'));var fs=require('fs');var Redis=require(_0x1611('0x4'));var db=require(_0x1611('0x5'))['db'];var utils=require(_0x1611('0x6'));var logger=require(_0x1611('0x7'))(_0x1611('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1611('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31a919,_0x589559,_0x35b5b7){return new BPromise(function(_0x5a38ae,_0x393c94){return client['request'](_0x31a919,_0x35b5b7)[_0x1611('0xa')](function(_0x5bb1a8){logger[_0x1611('0xb')](_0x1611('0xc'),_0x589559,_0x1611('0xd'));logger['debug'](_0x1611('0xe'),_0x589559,'request\x20sent',JSON[_0x1611('0xf')](_0x5bb1a8));if(_0x5bb1a8[_0x1611('0x10')]){if(_0x5bb1a8['error'][_0x1611('0x11')]===0x1f4){logger[_0x1611('0x10')](_0x1611('0xc'),_0x589559,_0x5bb1a8[_0x1611('0x10')][_0x1611('0x12')]);return _0x393c94(_0x5bb1a8[_0x1611('0x10')][_0x1611('0x12')]);}logger[_0x1611('0x10')](_0x1611('0xc'),_0x589559,_0x5bb1a8[_0x1611('0x10')][_0x1611('0x12')]);return _0x5a38ae(_0x5bb1a8['error'][_0x1611('0x12')]);}else{logger[_0x1611('0xb')](_0x1611('0xc'),_0x589559,_0x1611('0xd'));_0x5a38ae(_0x5bb1a8[_0x1611('0x13')][_0x1611('0x12')]);}})[_0x1611('0x14')](function(_0x1e979c){logger[_0x1611('0x10')](_0x1611('0xc'),_0x589559,_0x1e979c);_0x393c94(_0x1e979c);});});}exports[_0x1611('0x15')]=function(_0x5b3df0){var _0x220ddb=this;return new Promise(function(_0x115f27,_0x67cb0){return db[_0x1611('0x16')]['create'](_0x5b3df0['body'],{'raw':_0x5b3df0[_0x1611('0x17')]?_0x5b3df0[_0x1611('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x1611('0xa')](function(_0x9b0ec3){logger[_0x1611('0xb')](_0x1611('0x15'),_0x5b3df0);logger[_0x1611('0x18')](_0x1611('0x15'),_0x5b3df0,JSON[_0x1611('0xf')](_0x9b0ec3));_0x115f27(_0x9b0ec3);})[_0x1611('0x14')](function(_0x315657){logger[_0x1611('0x10')](_0x1611('0x15'),_0x315657[_0x1611('0x12')],_0x5b3df0);_0x67cb0(_0x220ddb[_0x1611('0x10')](0x1f4,_0x315657[_0x1611('0x12')]));});});};exports[_0x1611('0x19')]=function(_0x176b80){var _0x31ab44=this;return new Promise(function(_0x4afe10,_0x3d1216){return db[_0x1611('0x16')][_0x1611('0x1a')](_0x176b80[_0x1611('0x1b')],{'raw':_0x176b80[_0x1611('0x17')]?_0x176b80[_0x1611('0x17')][_0x1611('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x176b80[_0x1611('0x17')]?_0x176b80[_0x1611('0x17')]['where']||null:null,'attributes':_0x176b80[_0x1611('0x17')]?_0x176b80[_0x1611('0x17')][_0x1611('0x1d')]||null:null,'limit':_0x176b80[_0x1611('0x17')]?_0x176b80[_0x1611('0x17')]['limit']||null:null})[_0x1611('0xa')](function(_0x3f5d78){logger[_0x1611('0xb')](_0x1611('0x19'),_0x176b80);logger[_0x1611('0x18')]('UpdateChatQueueReport',_0x176b80,JSON['stringify'](_0x3f5d78));_0x4afe10(_0x3f5d78);})[_0x1611('0x14')](function(_0x61f45){logger[_0x1611('0x10')](_0x1611('0x19'),_0x61f45[_0x1611('0x12')],_0x176b80);_0x3d1216(_0x31ab44[_0x1611('0x10')](0x1f4,_0x61f45[_0x1611('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 2b9392e..139d4ac 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 _0x7a54=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','index','/describe','isAuthenticated','post','put','update','delete','/:id'];(function(_0x567709,_0x1f3c4e){var _0x57aa55=function(_0xc477ab){while(--_0xc477ab){_0x567709['push'](_0x567709['shift']());}};_0x57aa55(++_0x1f3c4e);}(_0x7a54,0x106));var _0x47a5=function(_0x5a97b5,_0x4dbb00){_0x5a97b5=_0x5a97b5-0x0;var _0x4658d6=_0x7a54[_0x5a97b5];return _0x4658d6;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0x11'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);module[_0x47a5('0x13')]=router; \ No newline at end of file +var _0x7a54=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','index','/describe','isAuthenticated','post','put','update','delete','/:id'];(function(_0x505191,_0x67997){var _0x4feed8=function(_0x3f928c){while(--_0x3f928c){_0x505191['push'](_0x505191['shift']());}};_0x4feed8(++_0x67997);}(_0x7a54,0x106));var _0x47a5=function(_0x3c3dc7,_0x4c82e9){_0x3c3dc7=_0x3c3dc7-0x0;var _0x211aa7=_0x7a54[_0x3c3dc7];return _0x211aa7;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0x11'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);module[_0x47a5('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index d303c05..6e17ca7 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 _0x3cd9=['exports','account','agent','queue','DATE','NOW','moment','sequelize'];(function(_0x2f6584,_0x1f3d14){var _0x3e2d55=function(_0x408bf8){while(--_0x408bf8){_0x2f6584['push'](_0x2f6584['shift']());}};_0x3e2d55(++_0x1f3d14);}(_0x3cd9,0x6e));var _0x93cd=function(_0x295314,_0x17b250){_0x295314=_0x295314-0x0;var _0x584b0c=_0x3cd9[_0x295314];return _0x584b0c;};'use strict';var moment=require(_0x93cd('0x0'));var Sequelize=require(_0x93cd('0x1'));module[_0x93cd('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x93cd('0x3'),_0x93cd('0x4'),_0x93cd('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x93cd('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x93cd('0x7')]}}; \ No newline at end of file +var _0xdc5f=['moment','sequelize','exports','STRING','account','agent','queue','DATE','NOW'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xdc5f,0xfc));var _0xfdc5=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xdc5f[_0x297fd3];return _0x2af381;};'use strict';var moment=require(_0xfdc5('0x0'));var Sequelize=require(_0xfdc5('0x1'));module[_0xfdc5('0x2')]={'uniqueid':{'type':Sequelize[_0xfdc5('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xfdc5('0x4'),_0xfdc5('0x5'),_0xfdc5('0x6')),'allowNull':![],'defaultValue':_0xfdc5('0x6')},'transferredAt':{'type':Sequelize[_0xfdc5('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xfdc5('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index bad797a..37cbc3e 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 _0xb1de=['count','offset','Content-Range','json','reject','then','sendStatus','error','stack','name','index','map','fieldName','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','limit','sort','where','pick','filter','type','VIRTUAL','merge','options','ChatTransferReport','includeAll','findAll','rows','catch','show','params','fields','include','find','create','update','body','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','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','status','end'];(function(_0x2b153a,_0x1998a3){var _0x476907=function(_0x4b34a5){while(--_0x4b34a5){_0x2b153a['push'](_0x2b153a['shift']());}};_0x476907(++_0x1998a3);}(_0xb1de,0x1a0));var _0xeb1d=function(_0x38f884,_0x32e448){_0x38f884=_0x38f884-0x0;var _0x150f32=_0xb1de[_0x38f884];return _0x150f32;};'use strict';var pdf=require(_0xeb1d('0x0'));var emlformat=require(_0xeb1d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xeb1d('0x2'));var jsonpatch=require(_0xeb1d('0x3'));var rp=require(_0xeb1d('0x4'));var moment=require(_0xeb1d('0x5'));var BPromise=require(_0xeb1d('0x6'));var Mustache=require(_0xeb1d('0x7'));var util=require(_0xeb1d('0x8'));var path=require('path');var sox=require(_0xeb1d('0x9'));var csv=require('to-csv');var ejs=require(_0xeb1d('0xa'));var fs=require('fs');var fs_extra=require(_0xeb1d('0xb'));var _=require(_0xeb1d('0xc'));var squel=require(_0xeb1d('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xeb1d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xeb1d('0xf'));var Papa=require(_0xeb1d('0x10'));var Redis=require(_0xeb1d('0x11'));var authService=require(_0xeb1d('0x12'));var qs=require(_0xeb1d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb1d('0x14'));var logger=require(_0xeb1d('0x15'))(_0xeb1d('0x16'));var utils=require(_0xeb1d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xeb1d('0x18'));var db=require(_0xeb1d('0x19'))['db'];function respondWithStatusCode(_0x3a3988,_0x3bdf6a){_0x3bdf6a=_0x3bdf6a||0xcc;return function(_0x3f4501){if(_0x3f4501){return _0x3a3988['sendStatus'](_0x3bdf6a);}return _0x3a3988[_0xeb1d('0x1a')](_0x3bdf6a)[_0xeb1d('0x1b')]();};}function respondWithResult(_0x578cb5,_0x496098){_0x496098=_0x496098||0xc8;return function(_0x571e23){if(_0x571e23){return _0x578cb5[_0xeb1d('0x1a')](_0x496098)['json'](_0x571e23);}};}function respondWithFilteredResult(_0x181c34,_0x43bf16){return function(_0x538cf6){if(_0x538cf6){var _0x3975cf=_0x538cf6[_0xeb1d('0x1c')],_0x3a7cef=_0x43bf16[_0xeb1d('0x1d')],_0x5e2e7c=_0x43bf16[_0xeb1d('0x1d')]+_0x43bf16['limit'],_0x532f64;if(_0x5e2e7c>=_0x3975cf){_0x5e2e7c=_0x3975cf;_0x532f64=0xc8;}else{_0x532f64=0xce;}_0x181c34[_0xeb1d('0x1a')](_0x532f64);return _0x181c34['set'](_0xeb1d('0x1e'),_0x3a7cef+'-'+_0x5e2e7c+'/'+_0x3975cf)[_0xeb1d('0x1f')](_0x538cf6);}return null;};}function patchUpdates(_0x902ebc){return function(_0x4e2834){try{jsonpatch['apply'](_0x4e2834,_0x902ebc,!![]);}catch(_0x548da4){return BPromise[_0xeb1d('0x20')](_0x548da4);}return _0x4e2834['save']();};}function saveUpdates(_0x5bcd7d,_0x2cea93){return function(_0x476385){if(_0x476385){return _0x476385['update'](_0x5bcd7d)[_0xeb1d('0x21')](function(_0x13d71a){return _0x13d71a;});}return null;};}function removeEntity(_0x4f03b5,_0x316a26){return function(_0xa1f85e){if(_0xa1f85e){return _0xa1f85e['destroy']()['then'](function(){_0x4f03b5[_0xeb1d('0x1a')](0xcc)[_0xeb1d('0x1b')]();});}};}function handleEntityNotFound(_0x1d58d6,_0x56533d){return function(_0x4f8e09){if(!_0x4f8e09){_0x1d58d6[_0xeb1d('0x22')](0x194);}return _0x4f8e09;};}function handleError(_0xef9a0c,_0x86e479){_0x86e479=_0x86e479||0x1f4;return function(_0x1828f7){logger[_0xeb1d('0x23')](_0x1828f7[_0xeb1d('0x24')]);if(_0x1828f7[_0xeb1d('0x25')]){delete _0x1828f7[_0xeb1d('0x25')];}_0xef9a0c[_0xeb1d('0x1a')](_0x86e479)['send'](_0x1828f7);};}exports[_0xeb1d('0x26')]=function(_0x146a21,_0x2adccf){var _0x2c54df={},_0x359e84={},_0x5f0fe3={'count':0x0,'rows':[]};var _0x5cc82=_[_0xeb1d('0x27')](db['ChatTransferReport']['rawAttributes'],function(_0x2ff85c){return{'name':_0x2ff85c[_0xeb1d('0x28')],'type':_0x2ff85c['type'][_0xeb1d('0x29')]};});_0x359e84[_0xeb1d('0x2a')]=_['map'](_0x5cc82,'name');_0x359e84['query']=_[_0xeb1d('0x2b')](_0x146a21[_0xeb1d('0x2c')]);_0x359e84[_0xeb1d('0x2d')]=_[_0xeb1d('0x2e')](_0x359e84[_0xeb1d('0x2a')],_0x359e84[_0xeb1d('0x2c')]);_0x2c54df[_0xeb1d('0x2f')]=_[_0xeb1d('0x2e')](_0x359e84['model'],qs['fields'](_0x146a21['query']['fields']));_0x2c54df[_0xeb1d('0x2f')]=_0x2c54df['attributes'][_0xeb1d('0x30')]?_0x2c54df[_0xeb1d('0x2f')]:_0x359e84[_0xeb1d('0x2a')];if(!_0x146a21[_0xeb1d('0x2c')][_0xeb1d('0x31')]('nolimit')){_0x2c54df['limit']=qs[_0xeb1d('0x32')](_0x146a21[_0xeb1d('0x2c')]['limit']);_0x2c54df[_0xeb1d('0x1d')]=qs[_0xeb1d('0x1d')](_0x146a21[_0xeb1d('0x2c')][_0xeb1d('0x1d')]);}_0x2c54df['order']=qs[_0xeb1d('0x33')](_0x146a21[_0xeb1d('0x2c')]['sort']);_0x2c54df[_0xeb1d('0x34')]=qs['filters'](_[_0xeb1d('0x35')](_0x146a21[_0xeb1d('0x2c')],_0x359e84[_0xeb1d('0x2d')]),_0x5cc82);if(_0x146a21['query'][_0xeb1d('0x36')]){_0x2c54df[_0xeb1d('0x34')]=_['merge'](_0x2c54df[_0xeb1d('0x34')],{'$or':_[_0xeb1d('0x27')](_0x5cc82,function(_0x21f098){if(_0x21f098[_0xeb1d('0x37')]!==_0xeb1d('0x38')){var _0x4bf177={};_0x4bf177[_0x21f098['name']]={'$like':'%'+_0x146a21[_0xeb1d('0x2c')]['filter']+'%'};return _0x4bf177;}})});}_0x2c54df=_[_0xeb1d('0x39')]({},_0x2c54df,_0x146a21[_0xeb1d('0x3a')]);var _0x127a39={'where':_0x2c54df[_0xeb1d('0x34')]};return db[_0xeb1d('0x3b')][_0xeb1d('0x1c')](_0x127a39)[_0xeb1d('0x21')](function(_0x2152b9){_0x5f0fe3[_0xeb1d('0x1c')]=_0x2152b9;if(_0x146a21[_0xeb1d('0x2c')][_0xeb1d('0x3c')]){_0x2c54df['include']=[{'all':!![]}];}return db[_0xeb1d('0x3b')][_0xeb1d('0x3d')](_0x2c54df);})['then'](function(_0x2ff1bc){_0x5f0fe3[_0xeb1d('0x3e')]=_0x2ff1bc;return _0x5f0fe3;})[_0xeb1d('0x21')](respondWithFilteredResult(_0x2adccf,_0x2c54df))[_0xeb1d('0x3f')](handleError(_0x2adccf,null));};exports[_0xeb1d('0x40')]=function(_0x451390,_0x137434){var _0x5328b1={'raw':!![],'where':{'id':_0x451390[_0xeb1d('0x41')]['id']}},_0x1004d4={};_0x1004d4[_0xeb1d('0x2a')]=_[_0xeb1d('0x2b')](db[_0xeb1d('0x3b')]['rawAttributes']);_0x1004d4[_0xeb1d('0x2c')]=_['keys'](_0x451390[_0xeb1d('0x2c')]);_0x1004d4[_0xeb1d('0x2d')]=_[_0xeb1d('0x2e')](_0x1004d4['model'],_0x1004d4['query']);_0x5328b1[_0xeb1d('0x2f')]=_[_0xeb1d('0x2e')](_0x1004d4[_0xeb1d('0x2a')],qs[_0xeb1d('0x42')](_0x451390['query']['fields']));_0x5328b1[_0xeb1d('0x2f')]=_0x5328b1[_0xeb1d('0x2f')][_0xeb1d('0x30')]?_0x5328b1['attributes']:_0x1004d4['model'];if(_0x451390[_0xeb1d('0x2c')][_0xeb1d('0x3c')]){_0x5328b1[_0xeb1d('0x43')]=[{'all':!![]}];}_0x5328b1=_[_0xeb1d('0x39')]({},_0x5328b1,_0x451390[_0xeb1d('0x3a')]);return db[_0xeb1d('0x3b')][_0xeb1d('0x44')](_0x5328b1)[_0xeb1d('0x21')](handleEntityNotFound(_0x137434,null))[_0xeb1d('0x21')](respondWithResult(_0x137434,null))[_0xeb1d('0x3f')](handleError(_0x137434,null));};exports[_0xeb1d('0x45')]=function(_0x2994b6,_0x4b3238){return db[_0xeb1d('0x3b')]['create'](_0x2994b6['body'],{})[_0xeb1d('0x21')](respondWithResult(_0x4b3238,0xc9))['catch'](handleError(_0x4b3238,null));};exports[_0xeb1d('0x46')]=function(_0x2f5f98,_0x3b1cec){if(_0x2f5f98[_0xeb1d('0x47')]['id']){delete _0x2f5f98['body']['id'];}return db['ChatTransferReport'][_0xeb1d('0x44')]({'where':{'id':_0x2f5f98[_0xeb1d('0x41')]['id']}})[_0xeb1d('0x21')](handleEntityNotFound(_0x3b1cec,null))[_0xeb1d('0x21')](saveUpdates(_0x2f5f98[_0xeb1d('0x47')],null))[_0xeb1d('0x21')](respondWithResult(_0x3b1cec,null))[_0xeb1d('0x3f')](handleError(_0x3b1cec,null));};exports[_0xeb1d('0x48')]=function(_0x5a12eb,_0x4c78b6){return db[_0xeb1d('0x3b')][_0xeb1d('0x44')]({'where':{'id':_0x5a12eb['params']['id']}})[_0xeb1d('0x21')](handleEntityNotFound(_0x4c78b6,null))[_0xeb1d('0x21')](removeEntity(_0x4c78b6,null))[_0xeb1d('0x3f')](handleError(_0x4c78b6,null));};exports[_0xeb1d('0x49')]=function(_0x5c5eec,_0x1f1664){return db['ChatTransferReport'][_0xeb1d('0x49')]()[_0xeb1d('0x21')](respondWithResult(_0x1f1664,null))['catch'](handleError(_0x1f1664,null));}; \ No newline at end of file +var _0xd23e=['includeAll','rows','catch','show','include','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','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','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','map','ChatTransferReport','fieldName','key','model','keys','filters','intersection','fields','query','attributes','length','order','sort','where','type','VIRTUAL'];(function(_0xd064b3,_0x53b2ed){var _0x1df7be=function(_0x33523c){while(--_0x33523c){_0xd064b3['push'](_0xd064b3['shift']());}};_0x1df7be(++_0x53b2ed);}(_0xd23e,0x99));var _0xed23=function(_0x2ceb31,_0x40ecf1){_0x2ceb31=_0x2ceb31-0x0;var _0x168859=_0xd23e[_0x2ceb31];return _0x168859;};'use strict';var pdf=require(_0xed23('0x0'));var emlformat=require(_0xed23('0x1'));var rimraf=require(_0xed23('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xed23('0x3'));var moment=require(_0xed23('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xed23('0x5'));var util=require(_0xed23('0x6'));var path=require(_0xed23('0x7'));var sox=require('sox');var csv=require(_0xed23('0x8'));var ejs=require(_0xed23('0x9'));var fs=require('fs');var fs_extra=require(_0xed23('0xa'));var _=require(_0xed23('0xb'));var squel=require(_0xed23('0xc'));var crypto=require(_0xed23('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xed23('0xe'));var Papa=require(_0xed23('0xf'));var Redis=require(_0xed23('0x10'));var authService=require(_0xed23('0x11'));var qs=require(_0xed23('0x12'));var as=require(_0xed23('0x13'));var hardwareService=require(_0xed23('0x14'));var logger=require(_0xed23('0x15'))(_0xed23('0x16'));var utils=require(_0xed23('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xed23('0x18'));var db=require(_0xed23('0x19'))['db'];function respondWithStatusCode(_0xf07d6,_0x2fabaf){_0x2fabaf=_0x2fabaf||0xcc;return function(_0x38594a){if(_0x38594a){return _0xf07d6[_0xed23('0x1a')](_0x2fabaf);}return _0xf07d6[_0xed23('0x1b')](_0x2fabaf)[_0xed23('0x1c')]();};}function respondWithResult(_0x5a8530,_0x377e17){_0x377e17=_0x377e17||0xc8;return function(_0x13f358){if(_0x13f358){return _0x5a8530[_0xed23('0x1b')](_0x377e17)[_0xed23('0x1d')](_0x13f358);}};}function respondWithFilteredResult(_0x2fec16,_0x4d0bae){return function(_0x36dfb2){if(_0x36dfb2){var _0x4060e6=_0x36dfb2[_0xed23('0x1e')],_0xabd182=_0x4d0bae[_0xed23('0x1f')],_0x18589a=_0x4d0bae[_0xed23('0x1f')]+_0x4d0bae[_0xed23('0x20')],_0x37568a;if(_0x18589a>=_0x4060e6){_0x18589a=_0x4060e6;_0x37568a=0xc8;}else{_0x37568a=0xce;}_0x2fec16[_0xed23('0x1b')](_0x37568a);return _0x2fec16[_0xed23('0x21')](_0xed23('0x22'),_0xabd182+'-'+_0x18589a+'/'+_0x4060e6)['json'](_0x36dfb2);}return null;};}function patchUpdates(_0x5b6848){return function(_0x234365){try{jsonpatch[_0xed23('0x23')](_0x234365,_0x5b6848,!![]);}catch(_0x50bc22){return BPromise[_0xed23('0x24')](_0x50bc22);}return _0x234365['save']();};}function saveUpdates(_0x5d4c50,_0x46405c){return function(_0x21ac70){if(_0x21ac70){return _0x21ac70[_0xed23('0x25')](_0x5d4c50)[_0xed23('0x26')](function(_0x21abe0){return _0x21abe0;});}return null;};}function removeEntity(_0x195457,_0x94ed09){return function(_0x489b2b){if(_0x489b2b){return _0x489b2b[_0xed23('0x27')]()[_0xed23('0x26')](function(){_0x195457[_0xed23('0x1b')](0xcc)[_0xed23('0x1c')]();});}};}function handleEntityNotFound(_0x4b230a,_0x1af35a){return function(_0x3ffef7){if(!_0x3ffef7){_0x4b230a['sendStatus'](0x194);}return _0x3ffef7;};}function handleError(_0x2753ae,_0x2f65c0){_0x2f65c0=_0x2f65c0||0x1f4;return function(_0xf616f7){logger[_0xed23('0x28')](_0xf616f7[_0xed23('0x29')]);if(_0xf616f7[_0xed23('0x2a')]){delete _0xf616f7['name'];}_0x2753ae[_0xed23('0x1b')](_0x2f65c0)['send'](_0xf616f7);};}exports['index']=function(_0x233934,_0x5e5796){var _0x569859={},_0x1e2b74={},_0x4d3284={'count':0x0,'rows':[]};var _0x22dd31=_[_0xed23('0x2b')](db[_0xed23('0x2c')]['rawAttributes'],function(_0x164a17){return{'name':_0x164a17[_0xed23('0x2d')],'type':_0x164a17['type'][_0xed23('0x2e')]};});_0x1e2b74[_0xed23('0x2f')]=_['map'](_0x22dd31,_0xed23('0x2a'));_0x1e2b74['query']=_[_0xed23('0x30')](_0x233934['query']);_0x1e2b74[_0xed23('0x31')]=_[_0xed23('0x32')](_0x1e2b74[_0xed23('0x2f')],_0x1e2b74['query']);_0x569859['attributes']=_[_0xed23('0x32')](_0x1e2b74[_0xed23('0x2f')],qs[_0xed23('0x33')](_0x233934[_0xed23('0x34')][_0xed23('0x33')]));_0x569859[_0xed23('0x35')]=_0x569859[_0xed23('0x35')][_0xed23('0x36')]?_0x569859[_0xed23('0x35')]:_0x1e2b74['model'];if(!_0x233934[_0xed23('0x34')]['hasOwnProperty']('nolimit')){_0x569859['limit']=qs[_0xed23('0x20')](_0x233934[_0xed23('0x34')][_0xed23('0x20')]);_0x569859[_0xed23('0x1f')]=qs['offset'](_0x233934[_0xed23('0x34')][_0xed23('0x1f')]);}_0x569859[_0xed23('0x37')]=qs[_0xed23('0x38')](_0x233934[_0xed23('0x34')]['sort']);_0x569859[_0xed23('0x39')]=qs[_0xed23('0x31')](_['pick'](_0x233934['query'],_0x1e2b74[_0xed23('0x31')]),_0x22dd31);if(_0x233934['query']['filter']){_0x569859['where']=_['merge'](_0x569859[_0xed23('0x39')],{'$or':_[_0xed23('0x2b')](_0x22dd31,function(_0x4212db){if(_0x4212db[_0xed23('0x3a')]!==_0xed23('0x3b')){var _0x35df53={};_0x35df53[_0x4212db['name']]={'$like':'%'+_0x233934[_0xed23('0x34')]['filter']+'%'};return _0x35df53;}})});}_0x569859=_['merge']({},_0x569859,_0x233934['options']);var _0x1efacb={'where':_0x569859[_0xed23('0x39')]};return db[_0xed23('0x2c')][_0xed23('0x1e')](_0x1efacb)['then'](function(_0x1fc2df){_0x4d3284[_0xed23('0x1e')]=_0x1fc2df;if(_0x233934[_0xed23('0x34')][_0xed23('0x3c')]){_0x569859['include']=[{'all':!![]}];}return db['ChatTransferReport']['findAll'](_0x569859);})[_0xed23('0x26')](function(_0x11f3c3){_0x4d3284[_0xed23('0x3d')]=_0x11f3c3;return _0x4d3284;})[_0xed23('0x26')](respondWithFilteredResult(_0x5e5796,_0x569859))[_0xed23('0x3e')](handleError(_0x5e5796,null));};exports[_0xed23('0x3f')]=function(_0x1ac0d2,_0x2f68dc){var _0x1f1bce={'raw':!![],'where':{'id':_0x1ac0d2['params']['id']}},_0x4b6bdc={};_0x4b6bdc[_0xed23('0x2f')]=_[_0xed23('0x30')](db[_0xed23('0x2c')]['rawAttributes']);_0x4b6bdc[_0xed23('0x34')]=_['keys'](_0x1ac0d2[_0xed23('0x34')]);_0x4b6bdc[_0xed23('0x31')]=_['intersection'](_0x4b6bdc[_0xed23('0x2f')],_0x4b6bdc[_0xed23('0x34')]);_0x1f1bce[_0xed23('0x35')]=_[_0xed23('0x32')](_0x4b6bdc[_0xed23('0x2f')],qs[_0xed23('0x33')](_0x1ac0d2[_0xed23('0x34')]['fields']));_0x1f1bce[_0xed23('0x35')]=_0x1f1bce[_0xed23('0x35')][_0xed23('0x36')]?_0x1f1bce[_0xed23('0x35')]:_0x4b6bdc[_0xed23('0x2f')];if(_0x1ac0d2[_0xed23('0x34')]['includeAll']){_0x1f1bce[_0xed23('0x40')]=[{'all':!![]}];}_0x1f1bce=_['merge']({},_0x1f1bce,_0x1ac0d2[_0xed23('0x41')]);return db['ChatTransferReport'][_0xed23('0x42')](_0x1f1bce)[_0xed23('0x26')](handleEntityNotFound(_0x2f68dc,null))['then'](respondWithResult(_0x2f68dc,null))[_0xed23('0x3e')](handleError(_0x2f68dc,null));};exports[_0xed23('0x43')]=function(_0x2e8bd7,_0x974b35){return db[_0xed23('0x2c')][_0xed23('0x43')](_0x2e8bd7[_0xed23('0x44')],{})['then'](respondWithResult(_0x974b35,0xc9))['catch'](handleError(_0x974b35,null));};exports['update']=function(_0x2b50cc,_0xfd2fd9){if(_0x2b50cc[_0xed23('0x44')]['id']){delete _0x2b50cc['body']['id'];}return db['ChatTransferReport'][_0xed23('0x42')]({'where':{'id':_0x2b50cc['params']['id']}})[_0xed23('0x26')](handleEntityNotFound(_0xfd2fd9,null))[_0xed23('0x26')](saveUpdates(_0x2b50cc[_0xed23('0x44')],null))['then'](respondWithResult(_0xfd2fd9,null))['catch'](handleError(_0xfd2fd9,null));};exports[_0xed23('0x27')]=function(_0x4ea197,_0x4379c4){return db[_0xed23('0x2c')][_0xed23('0x42')]({'where':{'id':_0x4ea197[_0xed23('0x45')]['id']}})[_0xed23('0x26')](handleEntityNotFound(_0x4379c4,null))[_0xed23('0x26')](removeEntity(_0x4379c4,null))['catch'](handleError(_0x4379c4,null));};exports[_0xed23('0x46')]=function(_0x66c169,_0x2f2af1){return db['ChatTransferReport'][_0xed23('0x46')]()[_0xed23('0x26')](respondWithResult(_0x2f2af1,null))[_0xed23('0x3e')](handleError(_0x2f2af1,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 83a15b7..a9f2a8a 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 _0x2622=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatTransferReport.attributes','exports','define','report_chat_transfer','uniqueid'];(function(_0x1cf7b0,_0x2324f7){var _0x355ee2=function(_0x57de10){while(--_0x57de10){_0x1cf7b0['push'](_0x1cf7b0['shift']());}};_0x355ee2(++_0x2324f7);}(_0x2622,0x179));var _0x2262=function(_0x3d2ac1,_0x55f734){_0x3d2ac1=_0x3d2ac1-0x0;var _0x2d0d1e=_0x2622[_0x3d2ac1];return _0x2d0d1e;};'use strict';var _=require(_0x2262('0x0'));var util=require('util');var logger=require(_0x2262('0x1'))(_0x2262('0x2'));var moment=require(_0x2262('0x3'));var BPromise=require(_0x2262('0x4'));var rp=require(_0x2262('0x5'));var fs=require('fs');var path=require(_0x2262('0x6'));var rimraf=require(_0x2262('0x7'));var config=require('../../config/environment');var attributes=require(_0x2262('0x8'));module[_0x2262('0x9')]=function(_0x4105ae,_0x3c0031){return _0x4105ae[_0x2262('0xa')]('ChatTransferReport',attributes,{'tableName':_0x2262('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2262('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9180=['api','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','util','../../config/logger'];(function(_0x1d7206,_0x551236){var _0x86f66=function(_0x1c82a0){while(--_0x1c82a0){_0x1d7206['push'](_0x1d7206['shift']());}};_0x86f66(++_0x551236);}(_0x9180,0xf5));var _0x0918=function(_0x5d5e85,_0x3e5533){_0x5d5e85=_0x5d5e85-0x0;var _0x119f3a=_0x9180[_0x5d5e85];return _0x119f3a;};'use strict';var _=require('lodash');var util=require(_0x0918('0x0'));var logger=require(_0x0918('0x1'))(_0x0918('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0918('0x3'));var fs=require('fs');var path=require(_0x0918('0x4'));var rimraf=require(_0x0918('0x5'));var config=require(_0x0918('0x6'));var attributes=require(_0x0918('0x7'));module[_0x0918('0x8')]=function(_0x23bf14,_0x4571d9){return _0x23bf14[_0x0918('0x9')](_0x0918('0xa'),attributes,{'tableName':_0x0918('0xb'),'paranoid':![],'indexes':[{'name':_0x0918('0xc'),'fields':[_0x0918('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 13079d5..f0157a8 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 _0xe5e9=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','ChatTransferReport,\x20%s,\x20%s','message','result','catch'];(function(_0x7cb56c,_0x2ba54d){var _0x1b737e=function(_0x406edf){while(--_0x406edf){_0x7cb56c['push'](_0x7cb56c['shift']());}};_0x1b737e(++_0x2ba54d);}(_0xe5e9,0x1e4));var _0x9e5e=function(_0x5bb4e8,_0x44b756){_0x5bb4e8=_0x5bb4e8-0x0;var _0x2a86f2=_0xe5e9[_0x5bb4e8];return _0x2a86f2;};'use strict';var _=require(_0x9e5e('0x0'));var util=require(_0x9e5e('0x1'));var moment=require(_0x9e5e('0x2'));var BPromise=require(_0x9e5e('0x3'));var rs=require(_0x9e5e('0x4'));var fs=require('fs');var Redis=require(_0x9e5e('0x5'));var db=require(_0x9e5e('0x6'))['db'];var utils=require(_0x9e5e('0x7'));var logger=require(_0x9e5e('0x8'))(_0x9e5e('0x9'));var config=require(_0x9e5e('0xa'));var jayson=require(_0x9e5e('0xb'));var client=jayson['client'][_0x9e5e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x46a8f8,_0xcbf45a,_0x27e56c){return new BPromise(function(_0x54d2a6,_0x5eb525){return client[_0x9e5e('0xd')](_0x46a8f8,_0x27e56c)['then'](function(_0x2a4240){logger[_0x9e5e('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0xcbf45a,_0x9e5e('0xf'));logger['debug'](_0x9e5e('0x10'),_0xcbf45a,_0x9e5e('0xf'),JSON['stringify'](_0x2a4240));if(_0x2a4240[_0x9e5e('0x11')]){if(_0x2a4240[_0x9e5e('0x11')]['code']===0x1f4){logger['error'](_0x9e5e('0x12'),_0xcbf45a,_0x2a4240[_0x9e5e('0x11')]['message']);return _0x5eb525(_0x2a4240[_0x9e5e('0x11')][_0x9e5e('0x13')]);}logger[_0x9e5e('0x11')](_0x9e5e('0x12'),_0xcbf45a,_0x2a4240['error']['message']);return _0x54d2a6(_0x2a4240[_0x9e5e('0x11')][_0x9e5e('0x13')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0xcbf45a,_0x9e5e('0xf'));_0x54d2a6(_0x2a4240[_0x9e5e('0x14')]['message']);}})[_0x9e5e('0x15')](function(_0x6f8ccd){logger[_0x9e5e('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0xcbf45a,_0x6f8ccd);_0x5eb525(_0x6f8ccd);});});} \ No newline at end of file +var _0x41bb=['jayson/promise','client','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x5d9bca,_0x28d26f){var _0x22b41b=function(_0x425566){while(--_0x425566){_0x5d9bca['push'](_0x5d9bca['shift']());}};_0x22b41b(++_0x28d26f);}(_0x41bb,0x149));var _0xb41b=function(_0x3390c4,_0x4a23ca){_0x3390c4=_0x3390c4-0x0;var _0x214582=_0x41bb[_0x3390c4];return _0x214582;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var moment=require(_0xb41b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb41b('0x3'));var fs=require('fs');var Redis=require(_0xb41b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb41b('0x5'));var logger=require(_0xb41b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb41b('0x7'));var client=jayson[_0xb41b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a7c51,_0x23ca62,_0x3bcb4c){return new BPromise(function(_0x41e732,_0x4aabc4){return client['request'](_0x1a7c51,_0x3bcb4c)[_0xb41b('0x9')](function(_0x58f4ae){logger[_0xb41b('0xa')](_0xb41b('0xb'),_0x23ca62,_0xb41b('0xc'));logger[_0xb41b('0xd')](_0xb41b('0xe'),_0x23ca62,_0xb41b('0xc'),JSON[_0xb41b('0xf')](_0x58f4ae));if(_0x58f4ae['error']){if(_0x58f4ae[_0xb41b('0x10')][_0xb41b('0x11')]===0x1f4){logger[_0xb41b('0x10')](_0xb41b('0xb'),_0x23ca62,_0x58f4ae[_0xb41b('0x10')][_0xb41b('0x12')]);return _0x4aabc4(_0x58f4ae[_0xb41b('0x10')][_0xb41b('0x12')]);}logger[_0xb41b('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x23ca62,_0x58f4ae[_0xb41b('0x10')][_0xb41b('0x12')]);return _0x41e732(_0x58f4ae[_0xb41b('0x10')]['message']);}else{logger[_0xb41b('0xa')](_0xb41b('0xb'),_0x23ca62,'request\x20sent');_0x41e732(_0x58f4ae[_0xb41b('0x13')][_0xb41b('0x12')]);}})[_0xb41b('0x14')](function(_0x613948){logger['error'](_0xb41b('0xb'),_0x23ca62,_0x613948);_0x4aabc4(_0x613948);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index af69dc5..0021237 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 _0x5a97=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','destroy','exports'];(function(_0x2798cc,_0x234beb){var _0x5a8d45=function(_0x2617d3){while(--_0x2617d3){_0x2798cc['push'](_0x2798cc['shift']());}};_0x5a8d45(++_0x234beb);}(_0x5a97,0x69));var _0x75a9=function(_0x5682e2,_0x566d91){_0x5682e2=_0x5682e2-0x0;var _0x179d69=_0x5a97[_0x5682e2];return _0x179d69;};'use strict';var multer=require(_0x75a9('0x0'));var util=require(_0x75a9('0x1'));var path=require('path');var timeout=require(_0x75a9('0x2'));var express=require(_0x75a9('0x3'));var router=express[_0x75a9('0x4')]();var fs_extra=require(_0x75a9('0x5'));var auth=require(_0x75a9('0x6'));var interaction=require(_0x75a9('0x7'));var config=require(_0x75a9('0x8'));var controller=require(_0x75a9('0x9'));router[_0x75a9('0xa')]('/',auth[_0x75a9('0xb')](),controller[_0x75a9('0xc')]);router[_0x75a9('0xa')](_0x75a9('0xd'),auth[_0x75a9('0xb')](),controller[_0x75a9('0xe')]);router[_0x75a9('0xa')](_0x75a9('0xf'),auth[_0x75a9('0xb')](),controller[_0x75a9('0x10')]);router[_0x75a9('0x11')]('/',auth[_0x75a9('0xb')](),controller['create']);router[_0x75a9('0x12')](_0x75a9('0xf'),auth[_0x75a9('0xb')](),controller['update']);router['delete'](_0x75a9('0xf'),auth[_0x75a9('0xb')](),controller[_0x75a9('0x13')]);module[_0x75a9('0x14')]=router; \ No newline at end of file +var _0x6790=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','get','isAuthenticated','index','describe','/:id','post','create','update','exports'];(function(_0x14f115,_0x13bf19){var _0x312445=function(_0x5dd850){while(--_0x5dd850){_0x14f115['push'](_0x14f115['shift']());}};_0x312445(++_0x13bf19);}(_0x6790,0x1ed));var _0x0679=function(_0x5a0408,_0x2084ce){_0x5a0408=_0x5a0408-0x0;var _0x410d6e=_0x6790[_0x5a0408];return _0x410d6e;};'use strict';var multer=require('multer');var util=require(_0x0679('0x0'));var path=require(_0x0679('0x1'));var timeout=require(_0x0679('0x2'));var express=require('express');var router=express[_0x0679('0x3')]();var fs_extra=require(_0x0679('0x4'));var auth=require(_0x0679('0x5'));var interaction=require(_0x0679('0x6'));var config=require('../../config/environment');var controller=require(_0x0679('0x7'));router[_0x0679('0x8')]('/',auth[_0x0679('0x9')](),controller[_0x0679('0xa')]);router[_0x0679('0x8')]('/describe',auth[_0x0679('0x9')](),controller[_0x0679('0xb')]);router[_0x0679('0x8')](_0x0679('0xc'),auth[_0x0679('0x9')](),controller['show']);router[_0x0679('0xd')]('/',auth[_0x0679('0x9')](),controller[_0x0679('0xe')]);router['put']('/:id',auth[_0x0679('0x9')](),controller[_0x0679('0xf')]);router['delete']('/:id',auth[_0x0679('0x9')](),controller['destroy']);module[_0x0679('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index dc2df6b..7a67d22 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 _0xf677=['star','INTEGER','stringify','name','getDataValue','setDataValue','onlineForm','input','textarea','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','BOOLEAN','ENUM','rounded','squared','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Skip','Feedback','thumb'];(function(_0xa770b3,_0x2178c8){var _0x157cb2=function(_0x5965cf){while(--_0x5965cf){_0xa770b3['push'](_0xa770b3['shift']());}};_0x157cb2(++_0x2178c8);}(_0xf677,0x19a));var _0x7f67=function(_0x1de7d3,_0x50fb04){_0x1de7d3=_0x1de7d3-0x0;var _0x10de57=_0xf677[_0x1de7d3];return _0x10de57;};'use strict';var Sequelize=require(_0x7f67('0x0'));var rs=require(_0x7f67('0x1'));module[_0x7f67('0x2')]={'name':{'type':Sequelize[_0x7f67('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x7f67('0x3')],'allowNull':![],'unique':_0x7f67('0x4')},'description':{'type':Sequelize[_0x7f67('0x3')]},'mapKey':{'type':Sequelize[_0x7f67('0x3')],'defaultValue':_0x7f67('0x5')},'mapKeyOffline':{'type':Sequelize[_0x7f67('0x3')],'defaultValue':_0x7f67('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x7f67('0x3')],'defaultValue':_0x7f67('0x6')},'customerAlias':{'type':Sequelize[_0x7f67('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x7f67('0x3')],'allowNull':![],'defaultValue':_0x7f67('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x7f67('0x3')],'allowNull':![],'defaultValue':_0x7f67('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x7f67('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x7f67('0x3')]},'animation':{'type':Sequelize[_0x7f67('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x7f67('0x9')](_0x7f67('0xa'),_0x7f67('0xb')),'defaultValue':_0x7f67('0xa')},'header_online':{'type':Sequelize[_0x7f67('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x7f67('0x3')],'defaultValue':_0x7f67('0xc')},'offline_chat_button':{'type':Sequelize[_0x7f67('0x3')],'defaultValue':_0x7f67('0xd')},'header_offline':{'type':Sequelize[_0x7f67('0x3')],'defaultValue':_0x7f67('0xe')},'download_transcript':{'type':Sequelize[_0x7f67('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x7f67('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x7f67('0xf')]},'closingQuestion':{'type':Sequelize[_0x7f67('0x3')],'defaultValue':_0x7f67('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x7f67('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x7f67('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x7f67('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x7f67('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x7f67('0x3')],'defaultValue':_0x7f67('0xd')},'skipMessageButton':{'type':Sequelize[_0x7f67('0x3')],'defaultValue':_0x7f67('0x11')},'conditionAgreement':{'type':Sequelize[_0x7f67('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x7f67('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x7f67('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x7f67('0x3')],'defaultValue':_0x7f67('0x12')},'ratingType':{'type':Sequelize['ENUM']('star',_0x7f67('0x13')),'defaultValue':_0x7f67('0x14')},'ratingStarsNumber':{'type':Sequelize[_0x7f67('0x15')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x7f67('0xf')],'defaultValue':function(){return JSON[_0x7f67('0x16')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x7f67('0x17'),'type':'text','required':!![]},'props':{'title':_0x7f67('0x17'),'helpText':''}},{'type':'input','props':{'title':_0x7f67('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x7f67('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x7f67('0x18')]('onlineForm')?JSON['parse'](this[_0x7f67('0x18')]('onlineForm')):{};},'set':function(_0xac80bc){return this[_0x7f67('0x19')](_0x7f67('0x1a'),JSON[_0x7f67('0x16')](_0xac80bc));}},'offlineForm':{'type':Sequelize[_0x7f67('0xf')],'defaultValue':function(){return JSON[_0x7f67('0x16')]({'items':[{'type':_0x7f67('0x1b'),'props':{'title':_0x7f67('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x7f67('0x5'),'type':_0x7f67('0x5')},'variable':null},{'type':_0x7f67('0x1c'),'config':{'placeholder':'Comments'},'props':{'title':_0x7f67('0x1d'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x7f67('0x18')](_0x7f67('0x1e'))?JSON['parse'](this['getDataValue']('offlineForm')):{};},'set':function(_0xb23d99){return this[_0x7f67('0x19')](_0x7f67('0x1e'),JSON['stringify'](_0xb23d99));}},'token':{'type':Sequelize[_0x7f67('0x3')],'defaultValue':function(){return rs[_0x7f67('0x1f')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x7f67('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x7f67('0x3')]},'forwardOffline':{'type':Sequelize[_0x7f67('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x7f67('0x3')]},'waitingTitle':{'type':Sequelize[_0x7f67('0x3')],'defaultValue':_0x7f67('0x20')},'waitingMessage':{'type':Sequelize[_0x7f67('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x7f67('0x3')],'defaultValue':_0x7f67('0x21')},'offlineMessageBody':{'type':Sequelize[_0x7f67('0x3')],'defaultValue':_0x7f67('0x22')},'enableUnmanagedNote':{'type':Sequelize[_0x7f67('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x7f67('0x11')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x7f67('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x7f67('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x7f67('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x7f67('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x7f67('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x7f67('0x3')]},'notificationTemplate':{'type':Sequelize[_0x7f67('0xf')],'defaultValue':function(){return _0x7f67('0x23');}},'notificationSound':{'type':Sequelize[_0x7f67('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x7f67('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x7f67('0x3')],'defaultValue':_0x7f67('0x24')},'waitForTheAssignedAgent':{'type':Sequelize[_0x7f67('0x15')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x7f67('0x15')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x7f67('0x25')},'defaultTitle':{'type':Sequelize[_0x7f67('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x7f67('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x7f67('0x3')],'allowNull':![],'defaultValue':_0x7f67('0x26'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7f67('0x15')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x7f67('0x3')],'defaultValue':_0x7f67('0x27')},'systemAvatar':{'type':Sequelize[_0x7f67('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x7f67('0x28')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x7f67('0x29'),'set':function(_0x44bbb8){if(!_0x44bbb8)this[_0x7f67('0x19')](_0x7f67('0x2a'),null);this[_0x7f67('0x19')]('mandatoryDisposition',_0x44bbb8);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x7f67('0x3')],'defaultValue':![]},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]}}; \ No newline at end of file +var _0xee30=['parse','onlineForm','setDataValue','stringify','textarea','Comments','Leave\x20your\x20comments','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','INTEGER','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Skip','Feedback','ENUM','thumb','star','input','name','text','getDataValue'];(function(_0x4b40ae,_0x2fc392){var _0x18c09e=function(_0x431060){while(--_0x431060){_0x4b40ae['push'](_0x4b40ae['shift']());}};_0x18c09e(++_0x2fc392);}(_0xee30,0xaa));var _0x0ee3=function(_0x49c539,_0x244204){_0x49c539=_0x49c539-0x0;var _0x3ab059=_0xee30[_0x49c539];return _0x3ab059;};'use strict';var Sequelize=require(_0x0ee3('0x0'));var rs=require(_0x0ee3('0x1'));module[_0x0ee3('0x2')]={'name':{'type':Sequelize[_0x0ee3('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x0ee3('0x3')],'allowNull':![],'unique':_0x0ee3('0x4')},'description':{'type':Sequelize[_0x0ee3('0x3')]},'mapKey':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':_0x0ee3('0x5')},'mapKeyOffline':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':_0x0ee3('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':_0x0ee3('0x6')},'customerAlias':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0ee3('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x0ee3('0x3')],'allowNull':![],'defaultValue':_0x0ee3('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x0ee3('0x3')],'allowNull':![],'defaultValue':_0x0ee3('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x0ee3('0xa'),_0x0ee3('0xb')),'defaultValue':_0x0ee3('0xa')},'header_online':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':_0x0ee3('0xc')},'start_chat_button':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x0ee3('0xd')},'header_offline':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':_0x0ee3('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x0ee3('0xf')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x0ee3('0x10')]},'closingQuestion':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':_0x0ee3('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':_0x0ee3('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':_0x0ee3('0x13')},'noteTitle':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0ee3('0x14')},'closingMessage':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':_0x0ee3('0xd')},'skipMessageButton':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':_0x0ee3('0x15')},'conditionAgreement':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x0ee3('0x16')},'ratingType':{'type':Sequelize[_0x0ee3('0x17')]('star',_0x0ee3('0x18')),'defaultValue':_0x0ee3('0x19')},'ratingStarsNumber':{'type':Sequelize[_0x0ee3('0xf')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x0ee3('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x0ee3('0x1a'),'variable':null,'config':{'placeholder':_0x0ee3('0x1b'),'type':_0x0ee3('0x1c'),'required':!![]},'props':{'title':_0x0ee3('0x1b'),'helpText':''}},{'type':_0x0ee3('0x1a'),'props':{'title':_0x0ee3('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x0ee3('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x0ee3('0x1d')]('onlineForm')?JSON[_0x0ee3('0x1e')](this[_0x0ee3('0x1d')](_0x0ee3('0x1f'))):{};},'set':function(_0xbf5d47){return this[_0x0ee3('0x20')](_0x0ee3('0x1f'),JSON[_0x0ee3('0x21')](_0xbf5d47));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x0ee3('0x21')]({'items':[{'type':_0x0ee3('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x0ee3('0x5'),'type':_0x0ee3('0x5')},'variable':null},{'type':_0x0ee3('0x22'),'config':{'placeholder':_0x0ee3('0x23')},'props':{'title':'Comments','helpText':_0x0ee3('0x24')}}],'fromKey':0x0});},'get':function(){return this['getDataValue']('offlineForm')?JSON[_0x0ee3('0x1e')](this['getDataValue']('offlineForm')):{};},'set':function(_0x41df05){return this[_0x0ee3('0x20')]('offlineForm',JSON['stringify'](_0x41df05));}},'token':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x0ee3('0x3')]},'forwardOffline':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x0ee3('0x3')]},'waitingTitle':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':_0x0ee3('0x25')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0ee3('0x26')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x0ee3('0x27')},'offlineMessageBody':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':_0x0ee3('0x28')},'skipUnmanaged':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':_0x0ee3('0x15')},'sendUnmanaged':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x0ee3('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x0ee3('0x3')]},'notificationTemplate':{'type':Sequelize[_0x0ee3('0x10')],'defaultValue':function(){return _0x0ee3('0x29');}},'notificationSound':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x0ee3('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':_0x0ee3('0x2a')},'verticalAlignment':{'type':Sequelize[_0x0ee3('0xf')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':_0x0ee3('0x2b')},'defaultTitle':{'type':Sequelize[_0x0ee3('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x0ee3('0xf')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0ee3('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0ee3('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x0ee3('0x2d')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0ee3('0xf')],'comment':_0x0ee3('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':![],'comment':_0x0ee3('0x2f'),'set':function(_0x2954df){if(!_0x2954df)this['setDataValue'](_0x0ee3('0x30'),null);this[_0x0ee3('0x20')](_0x0ee3('0x31'),_0x2954df);}},'vidaooEscalation':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x0ee3('0x3')],'defaultValue':![]},'openNewInteraction':{'type':Sequelize[_0x0ee3('0x9')],'defaultValue':![],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index f7fd61a..fd40e34 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 _0x1b1d=['offline-chat','remove','addInteraction','omit','Owner','fullname','internal','Tag','color','tag','timezone','iftime\x20%s','interval','indexOf','true','ONLINE','OFFLINE','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','chatLicenseExceeded','all','some','remote','connection','replace','alignment','verticalAlignment','textColor','backgroundColor','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Contact','Attachments','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','User','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','UserProfileResource','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','ChatWebsite','findAll','rows','show','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ChatWebsiteId','Disposition','getDispositions','length','nolimit','removeDispositions','ids','addAnswer','findOne','CannedAnswer','removeAnswers','sitepic','addAvatar','file','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','isNil','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','notify','user-agent-parser','setUA','user-agent','getResult','CmContact','no\x20available\x20attributes','createdAt','updatedAt','ListId','from','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','ChatApplication','Applications','List','applications','list','orderBy','priority','asc','account','contact','customerIp','headers','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','version','format','%s\x20%s','browser','unknown','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','difference','email','Comments','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','mimetype','Attachment','$promise','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','offlineMessageSubject','MailAccountId','Chat','NotifyMailAccount','notifyMail'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x1b1d,0x16d));var _0xd1b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1b1d[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xd1b1('0x0'));var emlformat=require(_0xd1b1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd1b1('0x2'));var jsonpatch=require(_0xd1b1('0x3'));var rp=require('request-promise');var moment=require(_0xd1b1('0x4'));var BPromise=require(_0xd1b1('0x5'));var Mustache=require(_0xd1b1('0x6'));var util=require(_0xd1b1('0x7'));var path=require(_0xd1b1('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd1b1('0x9'));var fs=require('fs');var fs_extra=require(_0xd1b1('0xa'));var _=require(_0xd1b1('0xb'));var squel=require(_0xd1b1('0xc'));var crypto=require(_0xd1b1('0xd'));var jsforce=require(_0xd1b1('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd1b1('0xf'));var Papa=require(_0xd1b1('0x10'));var Redis=require('ioredis');var authService=require(_0xd1b1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd1b1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd1b1('0x13'))(_0xd1b1('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd1b1('0x15'));var db=require(_0xd1b1('0x16'))['db'];config[_0xd1b1('0x17')]=_[_0xd1b1('0x18')](config[_0xd1b1('0x17')],{'host':_0xd1b1('0x19'),'port':0x18eb});var socket=require(_0xd1b1('0x1a'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0xd1b1('0x1b')](socket);var jayson=require(_0xd1b1('0x1c'));var client=jayson[_0xd1b1('0x1d')][_0xd1b1('0x1e')]({'port':0x232c});var client9002=jayson[_0xd1b1('0x1d')]['http']({'port':0x232a});var client9003=jayson[_0xd1b1('0x1d')][_0xd1b1('0x1e')]({'port':0x232b});var client9001=jayson['client'][_0xd1b1('0x1e')]({'port':0x2329});function respondWithRpcPromise(_0x96e123,_0x102ff2,_0x9148e3,_0x3fb4ad){return new BPromise(function(_0x440d0a,_0x2af5f1){var _0x10f7dc=_0x3fb4ad||client;return _0x10f7dc[_0xd1b1('0x1f')](_0x96e123,_0x9148e3)[_0xd1b1('0x20')](function(_0x477a34){logger[_0xd1b1('0x21')](_0xd1b1('0x22'),_0x102ff2,_0xd1b1('0x23'));logger[_0xd1b1('0x24')](_0xd1b1('0x25'),_0x102ff2,_0xd1b1('0x23'),JSON[_0xd1b1('0x26')](_0x477a34));if(_0x477a34[_0xd1b1('0x27')]){if(_0x477a34[_0xd1b1('0x27')]['code']===0x1f4){logger[_0xd1b1('0x27')](_0xd1b1('0x22'),_0x102ff2,_0x477a34[_0xd1b1('0x27')][_0xd1b1('0x28')]);return _0x2af5f1(_0x477a34[_0xd1b1('0x27')][_0xd1b1('0x28')]);}logger['error'](_0xd1b1('0x22'),_0x102ff2,_0x477a34['error'][_0xd1b1('0x28')]);return _0x440d0a(_0x477a34[_0xd1b1('0x27')][_0xd1b1('0x28')]);}else{logger[_0xd1b1('0x21')]('ChatWebsite,\x20%s,\x20%s',_0x102ff2,_0xd1b1('0x23'));_0x440d0a(_0x477a34[_0xd1b1('0x29')]['message']);}})[_0xd1b1('0x2a')](function(_0x5ed0a8){logger[_0xd1b1('0x27')](_0xd1b1('0x22'),_0x102ff2,_0x5ed0a8);_0x2af5f1(_0x5ed0a8);});});}function respondWithStatusCode(_0x4a4045,_0x1fab53){_0x1fab53=_0x1fab53||0xcc;return function(_0x2f7b92){if(_0x2f7b92){return _0x4a4045['sendStatus'](_0x1fab53);}return _0x4a4045['status'](_0x1fab53)[_0xd1b1('0x2b')]();};}function respondWithResult(_0x193473,_0x232e83){_0x232e83=_0x232e83||0xc8;return function(_0x64ea23){if(_0x64ea23){return _0x193473[_0xd1b1('0x2c')](_0x232e83)[_0xd1b1('0x2d')](_0x64ea23);}};}function respondWithFilteredResult(_0x2ecbe0,_0x7917fe){return function(_0x3e05ef){if(_0x3e05ef){var _0xc8a36d=_0x3e05ef[_0xd1b1('0x2e')],_0x1aa611=_0x7917fe[_0xd1b1('0x2f')],_0x4f7a74=_0x7917fe[_0xd1b1('0x2f')]+_0x7917fe[_0xd1b1('0x30')],_0x367980;if(_0x4f7a74>=_0xc8a36d){_0x4f7a74=_0xc8a36d;_0x367980=0xc8;}else{_0x367980=0xce;}_0x2ecbe0['status'](_0x367980);return _0x2ecbe0[_0xd1b1('0x31')](_0xd1b1('0x32'),_0x1aa611+'-'+_0x4f7a74+'/'+_0xc8a36d)['json'](_0x3e05ef);}return null;};}function patchUpdates(_0x4035cc){return function(_0x226ec8){try{jsonpatch[_0xd1b1('0x33')](_0x226ec8,_0x4035cc,!![]);}catch(_0x2e136c){return BPromise[_0xd1b1('0x34')](_0x2e136c);}return _0x226ec8[_0xd1b1('0x35')]();};}function saveUpdates(_0x22a3bc,_0x36264f){return function(_0x3fc984){if(_0x3fc984){return _0x3fc984['update'](_0x22a3bc)[_0xd1b1('0x20')](function(_0x458d41){return _0x458d41;});}return null;};}function removeEntity(_0x6a89f6,_0x421c9c){return function(_0x4eea54){if(_0x4eea54){return _0x4eea54[_0xd1b1('0x36')]()['then'](function(){var _0xaaa675=_0x4eea54['get']({'plain':!![]});var _0x2bbd13='ChatWebsites';return db[_0xd1b1('0x37')]['destroy']({'where':{'type':_0x2bbd13,'resourceId':_0xaaa675['id']}})[_0xd1b1('0x20')](function(){return _0x4eea54;});})[_0xd1b1('0x20')](function(){_0x6a89f6[_0xd1b1('0x2c')](0xcc)[_0xd1b1('0x2b')]();});}};}function handleEntityNotFound(_0xe088a,_0x725483){return function(_0x347d62){if(!_0x347d62){_0xe088a['sendStatus'](0x194);}return _0x347d62;};}function handleError(_0x1c80d0,_0x2f1fb4){_0x2f1fb4=_0x2f1fb4||0x1f4;return function(_0x349343){logger['error'](_0x349343['stack']);if(_0x349343[_0xd1b1('0x38')]){delete _0x349343['name'];}_0x1c80d0[_0xd1b1('0x2c')](_0x2f1fb4)[_0xd1b1('0x39')](_0x349343);};}exports['index']=function(_0x58819f,_0x3b230b){var _0x5e178b={'include':[{'model':db[_0xd1b1('0x3a')],'as':_0xd1b1('0x3b')}]},_0x2cc4f3={},_0x15daac={'count':0x0,'rows':[]};var _0x5e5c47=_[_0xd1b1('0x3c')](db['ChatWebsite'][_0xd1b1('0x3d')],function(_0x39bbe4){return{'name':_0x39bbe4[_0xd1b1('0x3e')],'type':_0x39bbe4[_0xd1b1('0x3f')][_0xd1b1('0x40')]};});_0x2cc4f3[_0xd1b1('0x41')]=_[_0xd1b1('0x3c')](_0x5e5c47,_0xd1b1('0x38'));_0x2cc4f3[_0xd1b1('0x42')]=_[_0xd1b1('0x43')](_0x58819f[_0xd1b1('0x42')]);_0x2cc4f3[_0xd1b1('0x44')]=_['intersection'](_0x2cc4f3[_0xd1b1('0x41')],_0x2cc4f3[_0xd1b1('0x42')]);_0x5e178b[_0xd1b1('0x45')]=_[_0xd1b1('0x46')](_0x2cc4f3[_0xd1b1('0x41')],qs[_0xd1b1('0x47')](_0x58819f[_0xd1b1('0x42')][_0xd1b1('0x47')]));_0x5e178b[_0xd1b1('0x45')]=_0x5e178b[_0xd1b1('0x45')]['length']?_0x5e178b[_0xd1b1('0x45')]:_0x2cc4f3[_0xd1b1('0x41')];if(!_0x58819f['query'][_0xd1b1('0x48')]('nolimit')){_0x5e178b[_0xd1b1('0x30')]=qs[_0xd1b1('0x30')](_0x58819f[_0xd1b1('0x42')]['limit']);_0x5e178b[_0xd1b1('0x2f')]=qs[_0xd1b1('0x2f')](_0x58819f[_0xd1b1('0x42')][_0xd1b1('0x2f')]);}_0x5e178b[_0xd1b1('0x49')]=qs['sort'](_0x58819f[_0xd1b1('0x42')][_0xd1b1('0x4a')]);_0x5e178b[_0xd1b1('0x4b')]=qs[_0xd1b1('0x44')](_[_0xd1b1('0x4c')](_0x58819f[_0xd1b1('0x42')],_0x2cc4f3[_0xd1b1('0x44')]),_0x5e5c47);if(_0x58819f[_0xd1b1('0x42')][_0xd1b1('0x4d')]){_0x5e178b[_0xd1b1('0x4b')]=_[_0xd1b1('0x4e')](_0x5e178b[_0xd1b1('0x4b')],{'$or':_['map'](_0x5e5c47,function(_0xe32e62){if(_0xe32e62[_0xd1b1('0x3f')]!==_0xd1b1('0x4f')){var _0x703f85={};_0x703f85[_0xe32e62['name']]={'$like':'%'+_0x58819f[_0xd1b1('0x42')][_0xd1b1('0x4d')]+'%'};return _0x703f85;}})});}_0x5e178b=_['merge']({},_0x5e178b,_0x58819f[_0xd1b1('0x50')]);var _0x45b585={'where':_0x5e178b[_0xd1b1('0x4b')]};return db['ChatWebsite'][_0xd1b1('0x2e')](_0x45b585)[_0xd1b1('0x20')](function(_0x144a9e){_0x15daac['count']=_0x144a9e;if(_0x58819f['query']['includeAll']){_0x5e178b[_0xd1b1('0x51')]=[{'all':!![]}];}return db[_0xd1b1('0x52')][_0xd1b1('0x53')](_0x5e178b);})['then'](function(_0x20b832){_0x15daac[_0xd1b1('0x54')]=_0x20b832;return _0x15daac;})['then'](respondWithFilteredResult(_0x3b230b,_0x5e178b))[_0xd1b1('0x2a')](handleError(_0x3b230b,null));};exports[_0xd1b1('0x55')]=function(_0x5ed22e,_0x103bf4){var _0x29a5f2={'raw':![],'where':{'id':_0x5ed22e[_0xd1b1('0x56')]['id']},'include':[{'model':db[_0xd1b1('0x3a')],'as':_0xd1b1('0x3b')}]},_0x1a3c75={};_0x1a3c75[_0xd1b1('0x41')]=_[_0xd1b1('0x43')](db['ChatWebsite'][_0xd1b1('0x3d')]);_0x1a3c75[_0xd1b1('0x42')]=_[_0xd1b1('0x43')](_0x5ed22e['query']);_0x1a3c75[_0xd1b1('0x44')]=_[_0xd1b1('0x46')](_0x1a3c75[_0xd1b1('0x41')],_0x1a3c75[_0xd1b1('0x42')]);_0x29a5f2[_0xd1b1('0x45')]=_[_0xd1b1('0x46')](_0x1a3c75[_0xd1b1('0x41')],qs[_0xd1b1('0x47')](_0x5ed22e[_0xd1b1('0x42')][_0xd1b1('0x47')]));_0x29a5f2[_0xd1b1('0x45')]=_0x29a5f2[_0xd1b1('0x45')]['length']?_0x29a5f2[_0xd1b1('0x45')]:_0x1a3c75[_0xd1b1('0x41')];if(_0x5ed22e['query'][_0xd1b1('0x57')]){_0x29a5f2[_0xd1b1('0x51')]=[{'all':!![]}];}_0x29a5f2=_['merge']({},_0x29a5f2,_0x5ed22e[_0xd1b1('0x50')]);return db[_0xd1b1('0x52')][_0xd1b1('0x58')](_0x29a5f2)[_0xd1b1('0x20')](handleEntityNotFound(_0x103bf4,null))[_0xd1b1('0x20')](respondWithResult(_0x103bf4,null))['catch'](handleError(_0x103bf4,null));};exports[_0xd1b1('0x59')]=function(_0x5d7590,_0x5cc76b){return db[_0xd1b1('0x52')][_0xd1b1('0x59')](_0x5d7590[_0xd1b1('0x5a')],{})[_0xd1b1('0x20')](function(_0x108c66){var _0x21a5fb=_0x5d7590[_0xd1b1('0x5b')][_0xd1b1('0x5c')]({'plain':!![]});if(!_0x21a5fb)throw new Error(_0xd1b1('0x5d'));if(_0x21a5fb['role']==='user'){var _0x40baf9=_0x108c66[_0xd1b1('0x5c')]({'plain':!![]});var _0x15a727='ChatWebsites';return db[_0xd1b1('0x5e')][_0xd1b1('0x58')]({'where':{'name':_0x15a727,'userProfileId':_0x21a5fb['userProfileId']},'raw':!![]})[_0xd1b1('0x20')](function(_0x3670d9){if(_0x3670d9&&_0x3670d9[_0xd1b1('0x5f')]===0x0){return db[_0xd1b1('0x37')]['create']({'name':_0x40baf9['name'],'resourceId':_0x40baf9['id'],'type':_0x3670d9[_0xd1b1('0x38')],'sectionId':_0x3670d9['id']},{})[_0xd1b1('0x20')](function(){return _0x108c66;});}else{return _0x108c66;}})['catch'](function(_0x242820){logger[_0xd1b1('0x27')](_0xd1b1('0x60'),_0x242820);throw _0x242820;});}return _0x108c66;})[_0xd1b1('0x20')](respondWithResult(_0x5cc76b,0xc9))['catch'](handleError(_0x5cc76b,null));};exports['update']=function(_0x392355,_0x2f90d2){if(_0x392355[_0xd1b1('0x5a')]['id']){delete _0x392355[_0xd1b1('0x5a')]['id'];}return db[_0xd1b1('0x52')][_0xd1b1('0x58')]({'where':{'id':_0x392355[_0xd1b1('0x56')]['id']},'include':[{'model':db[_0xd1b1('0x3a')],'as':_0xd1b1('0x3b')}]})[_0xd1b1('0x20')](handleEntityNotFound(_0x2f90d2,null))[_0xd1b1('0x20')](saveUpdates(_0x392355['body'],null))[_0xd1b1('0x20')](respondWithResult(_0x2f90d2,null))[_0xd1b1('0x2a')](handleError(_0x2f90d2,null));};exports['destroy']=function(_0x4effe2,_0x447796){return db[_0xd1b1('0x52')][_0xd1b1('0x58')]({'where':{'id':_0x4effe2[_0xd1b1('0x56')]['id']}})[_0xd1b1('0x20')](handleEntityNotFound(_0x447796,null))['then'](removeEntity(_0x447796,null))['catch'](handleError(_0x447796,null));};exports[_0xd1b1('0x61')]=function(_0x3a5d33,_0x37321e){return db['ChatWebsite'][_0xd1b1('0x61')]()[_0xd1b1('0x20')](respondWithResult(_0x37321e,null))[_0xd1b1('0x2a')](handleError(_0x37321e,null));};exports['addDisposition']=function(_0x331f2b,_0x27f318,_0x512a7a){if(_0x331f2b[_0xd1b1('0x5a')]['id']){delete _0x331f2b[_0xd1b1('0x5a')]['id'];}return db[_0xd1b1('0x52')]['find']({'where':{'id':_0x331f2b[_0xd1b1('0x56')]['id']}})['then'](handleEntityNotFound(_0x27f318,null))[_0xd1b1('0x20')](function(_0x359537){if(_0x359537){_0x331f2b['body'][_0xd1b1('0x62')]=_0x359537['id'];return db[_0xd1b1('0x63')]['create'](_0x331f2b[_0xd1b1('0x5a')]);}})[_0xd1b1('0x20')](respondWithResult(_0x27f318,null))['catch'](handleError(_0x27f318,null));};exports[_0xd1b1('0x64')]=function(_0x2f8f37,_0x10ab72,_0x6e042b){var _0x52f9cc={'raw':![],'where':{}};var _0xcd638e={};var _0x36605d={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x2f8f37[_0xd1b1('0x56')]['id']}})[_0xd1b1('0x20')](handleEntityNotFound(_0x10ab72,null))[_0xd1b1('0x20')](function(_0x97becc){if(_0x97becc){_0xcd638e[_0xd1b1('0x41')]=_['keys'](db[_0xd1b1('0x63')]['rawAttributes']);_0xcd638e[_0xd1b1('0x42')]=_['keys'](_0x2f8f37['query']);_0xcd638e['filters']=_[_0xd1b1('0x46')](_0xcd638e[_0xd1b1('0x41')],_0xcd638e[_0xd1b1('0x42')]);_0x52f9cc[_0xd1b1('0x45')]=_['intersection'](_0xcd638e['model'],qs[_0xd1b1('0x47')](_0x2f8f37['query']['fields']));_0x52f9cc[_0xd1b1('0x45')]=_0x52f9cc['attributes'][_0xd1b1('0x65')]?_0x52f9cc[_0xd1b1('0x45')]:_0xcd638e['model'];if(!_0x2f8f37['query'][_0xd1b1('0x48')](_0xd1b1('0x66'))){_0x52f9cc['limit']=qs[_0xd1b1('0x30')](_0x2f8f37[_0xd1b1('0x42')][_0xd1b1('0x30')]);_0x52f9cc['offset']=qs[_0xd1b1('0x2f')](_0x2f8f37[_0xd1b1('0x42')][_0xd1b1('0x2f')]);}_0x52f9cc['order']=qs[_0xd1b1('0x4a')](_0x2f8f37[_0xd1b1('0x42')][_0xd1b1('0x4a')]);_0x52f9cc[_0xd1b1('0x4b')]=qs['filters'](_['pick'](_0x2f8f37[_0xd1b1('0x42')],_0xcd638e['filters']));_0x52f9cc[_0xd1b1('0x4b')]['ChatWebsiteId']=_0x97becc['id'];if(_0x2f8f37['query']['filter']){_0x52f9cc['where']=_['merge'](_0x52f9cc[_0xd1b1('0x4b')],{'$or':_[_0xd1b1('0x3c')](_0x52f9cc[_0xd1b1('0x45')],function(_0x5d93f7){var _0x5f0df7={};_0x5f0df7[_0x5d93f7]={'$like':'%'+_0x2f8f37[_0xd1b1('0x42')][_0xd1b1('0x4d')]+'%'};return _0x5f0df7;})});}_0x52f9cc=_[_0xd1b1('0x4e')]({},_0x52f9cc,_0x2f8f37[_0xd1b1('0x50')]);return db['Disposition'][_0xd1b1('0x2e')]({'where':_0x52f9cc[_0xd1b1('0x4b')]})[_0xd1b1('0x20')](function(_0x37d23e){_0x36605d[_0xd1b1('0x2e')]=_0x37d23e;if(_0x2f8f37[_0xd1b1('0x42')][_0xd1b1('0x57')]){_0x52f9cc['include']=[{'all':!![]}];}return db[_0xd1b1('0x63')][_0xd1b1('0x53')](_0x52f9cc);})[_0xd1b1('0x20')](function(_0x303580){_0x36605d[_0xd1b1('0x54')]=_0x303580;return _0x36605d;});}})[_0xd1b1('0x20')](respondWithFilteredResult(_0x10ab72,_0x52f9cc))[_0xd1b1('0x2a')](handleError(_0x10ab72,null));};exports['removeDispositions']=function(_0x2bf041,_0x1306da,_0x507f1c){return db[_0xd1b1('0x52')][_0xd1b1('0x58')]({'where':{'id':_0x2bf041[_0xd1b1('0x56')]['id']}})[_0xd1b1('0x20')](handleEntityNotFound(_0x1306da,null))[_0xd1b1('0x20')](function(_0xbc2934){if(_0xbc2934){return _0xbc2934[_0xd1b1('0x67')](_0x2bf041[_0xd1b1('0x42')][_0xd1b1('0x68')]);}})[_0xd1b1('0x20')](respondWithStatusCode(_0x1306da,null))[_0xd1b1('0x2a')](handleError(_0x1306da,null));};exports[_0xd1b1('0x69')]=function(_0xd8c13d,_0x236846,_0x2279ae){if(_0xd8c13d[_0xd1b1('0x5a')]['id']){delete _0xd8c13d[_0xd1b1('0x5a')]['id'];}return db[_0xd1b1('0x52')][_0xd1b1('0x58')]({'where':{'id':_0xd8c13d[_0xd1b1('0x56')]['id']}})[_0xd1b1('0x20')](handleEntityNotFound(_0x236846,null))[_0xd1b1('0x20')](function(_0x5ed443){if(_0x5ed443){_0xd8c13d[_0xd1b1('0x5a')][_0xd1b1('0x62')]=_0x5ed443['id'];return db['CannedAnswer'][_0xd1b1('0x59')](_0xd8c13d['body']);}})[_0xd1b1('0x20')](respondWithResult(_0x236846,null))[_0xd1b1('0x2a')](handleError(_0x236846,null));};exports['getAnswers']=function(_0x2d964f,_0x6ce041,_0x29f2b6){var _0x574281={'raw':![],'where':{}};var _0x247ae8={};var _0x17d7c1={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xd1b1('0x6a')]({'where':{'id':_0x2d964f['params']['id']}})[_0xd1b1('0x20')](handleEntityNotFound(_0x6ce041,null))['then'](function(_0x169f8c){if(_0x169f8c){_0x247ae8['model']=_[_0xd1b1('0x43')](db[_0xd1b1('0x6b')][_0xd1b1('0x3d')]);_0x247ae8[_0xd1b1('0x42')]=_['keys'](_0x2d964f[_0xd1b1('0x42')]);_0x247ae8['filters']=_['intersection'](_0x247ae8[_0xd1b1('0x41')],_0x247ae8[_0xd1b1('0x42')]);_0x574281[_0xd1b1('0x45')]=_['intersection'](_0x247ae8[_0xd1b1('0x41')],qs['fields'](_0x2d964f[_0xd1b1('0x42')][_0xd1b1('0x47')]));_0x574281[_0xd1b1('0x45')]=_0x574281[_0xd1b1('0x45')][_0xd1b1('0x65')]?_0x574281['attributes']:_0x247ae8['model'];if(!_0x2d964f[_0xd1b1('0x42')]['hasOwnProperty'](_0xd1b1('0x66'))){_0x574281['limit']=qs[_0xd1b1('0x30')](_0x2d964f[_0xd1b1('0x42')][_0xd1b1('0x30')]);_0x574281[_0xd1b1('0x2f')]=qs['offset'](_0x2d964f[_0xd1b1('0x42')]['offset']);}_0x574281['order']=qs[_0xd1b1('0x4a')](_0x2d964f[_0xd1b1('0x42')][_0xd1b1('0x4a')]);_0x574281['where']=qs['filters'](_[_0xd1b1('0x4c')](_0x2d964f['query'],_0x247ae8[_0xd1b1('0x44')]));_0x574281['where'][_0xd1b1('0x62')]=_0x169f8c['id'];if(_0x2d964f[_0xd1b1('0x42')][_0xd1b1('0x4d')]){_0x574281['where']=_[_0xd1b1('0x4e')](_0x574281[_0xd1b1('0x4b')],{'$or':_[_0xd1b1('0x3c')](_0x574281['attributes'],function(_0x58bf90){var _0x99c455={};_0x99c455[_0x58bf90]={'$like':'%'+_0x2d964f[_0xd1b1('0x42')][_0xd1b1('0x4d')]+'%'};return _0x99c455;})});}_0x574281=_[_0xd1b1('0x4e')]({},_0x574281,_0x2d964f[_0xd1b1('0x50')]);return db[_0xd1b1('0x6b')][_0xd1b1('0x2e')]({'where':_0x574281['where']})[_0xd1b1('0x20')](function(_0x521850){_0x17d7c1[_0xd1b1('0x2e')]=_0x521850;if(_0x2d964f['query']['includeAll']){_0x574281[_0xd1b1('0x51')]=[{'all':!![]}];}return db[_0xd1b1('0x6b')][_0xd1b1('0x53')](_0x574281);})[_0xd1b1('0x20')](function(_0x321a68){_0x17d7c1[_0xd1b1('0x54')]=_0x321a68;return _0x17d7c1;});}})['then'](respondWithFilteredResult(_0x6ce041,_0x574281))[_0xd1b1('0x2a')](handleError(_0x6ce041,null));};exports[_0xd1b1('0x6c')]=function(_0x58a16a,_0xe5d586,_0xa6457a){return db[_0xd1b1('0x52')]['find']({'where':{'id':_0x58a16a[_0xd1b1('0x56')]['id']}})[_0xd1b1('0x20')](handleEntityNotFound(_0xe5d586,null))[_0xd1b1('0x20')](function(_0x170d8f){if(_0x170d8f){return _0x170d8f['removeAnswers'](_0x58a16a[_0xd1b1('0x42')][_0xd1b1('0x68')]);}})[_0xd1b1('0x20')](respondWithStatusCode(_0xe5d586,null))['catch'](handleError(_0xe5d586,null));};exports['addLogo']=function(_0x261694,_0x5e7a4f,_0x19834e){_0x261694[_0xd1b1('0x5a')][_0xd1b1('0x6d')]=_0x261694['file']['filename'];return db[_0xd1b1('0x52')][_0xd1b1('0x58')]({'where':{'id':_0x261694[_0xd1b1('0x56')]['id']}})[_0xd1b1('0x20')](handleEntityNotFound(_0x5e7a4f,null))[_0xd1b1('0x20')](saveUpdates(_0x261694[_0xd1b1('0x5a')],null))['then'](respondWithResult(_0x5e7a4f,null))[_0xd1b1('0x2a')](handleError(_0x5e7a4f,null));};exports[_0xd1b1('0x6e')]=function(_0x19c00d,_0x516815,_0x496fc0){_0x19c00d['body']['agentAvatar']=_0x19c00d[_0xd1b1('0x6f')][_0xd1b1('0x70')];return db['ChatWebsite'][_0xd1b1('0x58')]({'where':{'id':_0x19c00d[_0xd1b1('0x56')]['id']}})[_0xd1b1('0x20')](handleEntityNotFound(_0x516815,null))['then'](saveUpdates(_0x19c00d[_0xd1b1('0x5a')],null))[_0xd1b1('0x20')](respondWithResult(_0x516815,null))[_0xd1b1('0x2a')](handleError(_0x516815,null));};exports[_0xd1b1('0x71')]=function(_0x4a99e2,_0x5b6e66,_0x22aedd){_0x4a99e2['body'][_0xd1b1('0x72')]=_0x4a99e2[_0xd1b1('0x6f')][_0xd1b1('0x70')];return db[_0xd1b1('0x52')][_0xd1b1('0x58')]({'where':{'id':_0x4a99e2['params']['id']}})['then'](handleEntityNotFound(_0x5b6e66,null))[_0xd1b1('0x20')](saveUpdates(_0x4a99e2[_0xd1b1('0x5a')],null))['then'](respondWithResult(_0x5b6e66,null))[_0xd1b1('0x2a')](handleError(_0x5b6e66,null));};exports[_0xd1b1('0x73')]=function(_0x3157e7,_0x2de870,_0x14c941){_0x3157e7[_0xd1b1('0x5a')][_0xd1b1('0x74')]=_0x3157e7[_0xd1b1('0x6f')][_0xd1b1('0x70')];return db[_0xd1b1('0x52')][_0xd1b1('0x58')]({'where':{'id':_0x3157e7[_0xd1b1('0x56')]['id']}})[_0xd1b1('0x20')](handleEntityNotFound(_0x2de870,null))[_0xd1b1('0x20')](saveUpdates(_0x3157e7[_0xd1b1('0x5a')],null))[_0xd1b1('0x20')](respondWithResult(_0x2de870,null))[_0xd1b1('0x2a')](handleError(_0x2de870,null));};exports[_0xd1b1('0x75')]=function(_0x2e5639,_0x3d3c2f,_0x16d3ea){var _0x3fd62b=path[_0xd1b1('0x76')](config[_0xd1b1('0x77')],_0xd1b1('0x78'));var _0x1bb5b8={'where':{'id':_0x2e5639[_0xd1b1('0x56')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x5be29f=![];return require(_0xd1b1('0x15'))[_0xd1b1('0x79')]()[_0xd1b1('0x20')](function(_0x19552f){if(_0x19552f){_0x5be29f=_0x19552f[_0xd1b1('0x7a')];}})[_0xd1b1('0x20')](function(){return db[_0xd1b1('0x52')][_0xd1b1('0x58')](_0x1bb5b8);})[_0xd1b1('0x20')](handleEntityNotFound(_0x3d3c2f,null))[_0xd1b1('0x20')](function(_0x12e158){if(_0x12e158){if(!_['isNil'](_0x12e158['sitepic'])){if(fs['existsSync'](path[_0xd1b1('0x76')](config[_0xd1b1('0x77')],_0xd1b1('0x7b'),_0x12e158['sitepic']))&&_0x5be29f){_0x3fd62b=path['join'](config[_0xd1b1('0x77')],_0xd1b1('0x7b'),_0x12e158[_0xd1b1('0x6d')]);}}return _0x3d3c2f[_0xd1b1('0x7c')](_0x3fd62b);}})['catch'](handleError(_0x3d3c2f,null));};exports[_0xd1b1('0x7d')]=function(_0x33707c,_0x28856c,_0x2dc72f){var _0x36c655=path[_0xd1b1('0x76')](config[_0xd1b1('0x77')],_0xd1b1('0x7e'));var _0x4a3040={'where':{'id':_0x33707c['params']['id']},'attributes':['id',_0xd1b1('0x7f')],'raw':!![]};return db[_0xd1b1('0x52')][_0xd1b1('0x58')](_0x4a3040)[_0xd1b1('0x20')](handleEntityNotFound(_0x28856c,null))[_0xd1b1('0x20')](function(_0x280594){if(_0x280594){if(!_[_0xd1b1('0x80')](_0x280594[_0xd1b1('0x7f')])){if(fs[_0xd1b1('0x81')](path[_0xd1b1('0x76')](config[_0xd1b1('0x77')],'server/files/images/avatars/',_0x280594[_0xd1b1('0x7f')]))){_0x36c655=path[_0xd1b1('0x76')](config[_0xd1b1('0x77')],_0xd1b1('0x82'),_0x280594[_0xd1b1('0x7f')]);}}return _0x28856c[_0xd1b1('0x7c')](_0x36c655);}})[_0xd1b1('0x2a')](handleError(_0x28856c,null));};exports[_0xd1b1('0x83')]=function(_0x54608b,_0x2f1311,_0x46ad39){var _0xfcf20e=path[_0xd1b1('0x76')](config[_0xd1b1('0x77')],_0xd1b1('0x84'));var _0x3a9740={'where':{'id':_0x54608b[_0xd1b1('0x56')]['id']},'attributes':['id',_0xd1b1('0x72'),_0xd1b1('0x85')],'raw':!![]};return db[_0xd1b1('0x52')][_0xd1b1('0x58')](_0x3a9740)[_0xd1b1('0x20')](handleEntityNotFound(_0x2f1311,null))[_0xd1b1('0x20')](function(_0x5b15fb){if(_0x5b15fb){if(!_[_0xd1b1('0x80')](_0x5b15fb['customerAvatar'])){if(fs[_0xd1b1('0x81')](path[_0xd1b1('0x76')](config[_0xd1b1('0x77')],_0xd1b1('0x82'),_0x5b15fb[_0xd1b1('0x72')]))&&_0x5b15fb[_0xd1b1('0x85')]){_0xfcf20e=path[_0xd1b1('0x76')](config[_0xd1b1('0x77')],_0xd1b1('0x82'),_0x5b15fb['customerAvatar']);}}return _0x2f1311[_0xd1b1('0x7c')](_0xfcf20e);}})[_0xd1b1('0x2a')](handleError(_0x2f1311,null));};exports[_0xd1b1('0x86')]=function(_0x1e82a2,_0xd47e7,_0x31cfd3){var _0x184910=path[_0xd1b1('0x76')](config['root'],'server/files/images/avatars/system_avatar.png');var _0x3b0212={'where':{'id':_0x1e82a2[_0xd1b1('0x56')]['id']},'attributes':['id',_0xd1b1('0x74')],'raw':!![]};return db[_0xd1b1('0x52')][_0xd1b1('0x58')](_0x3b0212)[_0xd1b1('0x20')](handleEntityNotFound(_0xd47e7,null))[_0xd1b1('0x20')](function(_0x5232d6){if(_0x5232d6){if(!_[_0xd1b1('0x80')](_0x5232d6[_0xd1b1('0x74')])){if(fs[_0xd1b1('0x81')](path[_0xd1b1('0x76')](config[_0xd1b1('0x77')],_0xd1b1('0x82'),_0x5232d6[_0xd1b1('0x74')]))){_0x184910=path[_0xd1b1('0x76')](config[_0xd1b1('0x77')],_0xd1b1('0x82'),_0x5232d6['systemAvatar']);}}return _0xd47e7['download'](_0x184910);}})[_0xd1b1('0x2a')](handleError(_0xd47e7,null));};exports[_0xd1b1('0x87')]=function(_0x2fc0e9,_0x4569db,_0x441ee1){var _0xc8cec9=require(_0xd1b1('0x88'));var _0x3143f6=new _0xc8cec9();var _0x752f57=_0x3143f6[_0xd1b1('0x89')](_0x2fc0e9['headers'][_0xd1b1('0x8a')])[_0xd1b1('0x8b')]();var _0x2bf1a0={'body':_0x2fc0e9[_0xd1b1('0x5a')],'channel':'chat'};var _0x29672a=[];var _0x42cd8c=[];var _0x25c63f={};var _0x3136b9=![];return db[_0xd1b1('0x8c')][_0xd1b1('0x61')]()[_0xd1b1('0x20')](function(_0x2cb682){if(!_0x2cb682){throw new db['Sequelize']['ValidationError'](_0xd1b1('0x8d'));}_0x29672a=_['difference'](_['keys'](_0x2cb682),[_0xd1b1('0x8e'),_0xd1b1('0x8f')]);_0x42cd8c=_['difference'](_[_0xd1b1('0x43')](_0x2cb682),[_0xd1b1('0x8e'),_0xd1b1('0x8f'),'CompanyId',_0xd1b1('0x90')]);if(_0x2fc0e9[_0xd1b1('0x5a')]['id']){delete _0x2fc0e9['body']['id'];}if(_[_0xd1b1('0x80')](_0x2fc0e9['body'][_0xd1b1('0x91')])){throw new db[(_0xd1b1('0x92'))][(_0xd1b1('0x93'))](_0xd1b1('0x94'));}if(_[_0xd1b1('0x80')](_0x2fc0e9[_0xd1b1('0x5a')]['body'])||_0x2fc0e9[_0xd1b1('0x5a')][_0xd1b1('0x5a')]===''){throw new db[(_0xd1b1('0x92'))][(_0xd1b1('0x93'))](_0xd1b1('0x95'));}if(_[_0xd1b1('0x80')](_0x2fc0e9[_0xd1b1('0x5a')][_0xd1b1('0x96')])){throw new db[(_0xd1b1('0x92'))][(_0xd1b1('0x93'))](_0xd1b1('0x97')+_0x42cd8c);}if(!_[_0xd1b1('0x98')](_0x42cd8c,_0x2fc0e9[_0xd1b1('0x5a')]['mapKey'])){throw new db[(_0xd1b1('0x92'))][(_0xd1b1('0x93'))](_0xd1b1('0x99')+_0x42cd8c);}_0x25c63f[_0x2fc0e9[_0xd1b1('0x5a')][_0xd1b1('0x96')]]=_0x2fc0e9[_0xd1b1('0x5a')]['from'];})['then'](function(){return db[_0xd1b1('0x52')][_0xd1b1('0x58')]({'where':{'id':_0x2fc0e9[_0xd1b1('0x56')]['id']},'include':[{'model':db[_0xd1b1('0x9a')],'as':'List','include':[{'model':db[_0xd1b1('0x8c')],'as':_0xd1b1('0x9b'),'where':_0x25c63f,'limit':0x1,'order':[['updatedAt',_0xd1b1('0x9c')]]}]},{'model':db[_0xd1b1('0x9d')],'as':_0xd1b1('0x9e')}]});})[_0xd1b1('0x20')](handleEntityNotFound(_0x4569db,null))[_0xd1b1('0x20')](function(_0x278a88){if(_0x278a88&&_0x278a88[_0xd1b1('0x9f')]){_0x2bf1a0['account']=_0x278a88;_0x2bf1a0[_0xd1b1('0xa0')]=_0x278a88['Applications'];_0x2bf1a0[_0xd1b1('0xa1')]=_0x278a88[_0xd1b1('0x9f')];_0x2bf1a0[_0xd1b1('0xa0')]=_[_0xd1b1('0xa2')](_0x2bf1a0['applications'],[_0xd1b1('0xa3')],[_0xd1b1('0xa4')]);if(_0x2bf1a0[_0xd1b1('0xa5')]['Applications']){delete _0x2bf1a0[_0xd1b1('0xa5')][_0xd1b1('0x9e')];}if(_0x2bf1a0[_0xd1b1('0xa5')][_0xd1b1('0x9f')]&&_0x2bf1a0[_0xd1b1('0xa5')][_0xd1b1('0x9f')][_0xd1b1('0x9b')][_0xd1b1('0x65')]){return _0x2bf1a0['account']['List'][_0xd1b1('0x9b')][0x0];}var _0x37ca2a=_[_0xd1b1('0x18')](_0x2fc0e9[_0xd1b1('0x5a')],{'firstName':_0x2fc0e9[_0xd1b1('0x5a')][_0xd1b1('0x91')],'ListId':_0x278a88[_0xd1b1('0x90')]});_0x37ca2a[_0x2fc0e9['body'][_0xd1b1('0x96')]]=_0x2fc0e9['body'][_0xd1b1('0x91')];return db[_0xd1b1('0x8c')][_0xd1b1('0x59')](_0x37ca2a,{'fields':_0x29672a,'raw':!![]});}})[_0xd1b1('0x20')](handleEntityNotFound(_0x4569db,null))['then'](function(_0x4bdc65){_0x2bf1a0[_0xd1b1('0xa6')]=_0x4bdc65;var _0x5bd77b=_0x2fc0e9[_0xd1b1('0x5a')][_0xd1b1('0xa7')];if(_0x2fc0e9[_0xd1b1('0xa8')][_0xd1b1('0xa9')]){_0x5bd77b=_0x2fc0e9['headers'][_0xd1b1('0xa9')];}else if(_0x2fc0e9[_0xd1b1('0xa8')][_0xd1b1('0xaa')]){_0x5bd77b=_[_0xd1b1('0xab')](_0x2fc0e9[_0xd1b1('0xa8')][_0xd1b1('0xaa')][_0xd1b1('0xac')](','));}if(_0x4bdc65){var _0x3eed99={'ContactId':_0x4bdc65['id'],'ChatWebsiteId':_0x2fc0e9[_0xd1b1('0x56')]['id'],'from':(_0x4bdc65[_0xd1b1('0xad')]||'')+'\x20'+(_0x4bdc65[_0xd1b1('0xae')]||''),'customerIp':_0x5bd77b,'customerPort':_0x2fc0e9[_0xd1b1('0xa8')][_0xd1b1('0xaf')]?_0x2fc0e9['headers']['x-real-port']:null,'referer':_0x2fc0e9[_0xd1b1('0x5a')][_0xd1b1('0xb0')],'browserName':_0x752f57['browser']['name']&&_0x752f57['browser'][_0xd1b1('0xb1')]?util[_0xd1b1('0xb2')](_0xd1b1('0xb3'),_0x752f57[_0xd1b1('0xb4')][_0xd1b1('0x38')],_0x752f57[_0xd1b1('0xb4')][_0xd1b1('0xb1')]):_0xd1b1('0xb5'),'browserVersion':_0x752f57[_0xd1b1('0xb4')]['version']||'unknown','osName':util[_0xd1b1('0xb2')](_0xd1b1('0xb3'),_0x752f57['os'][_0xd1b1('0x38')],_0x752f57['os'][_0xd1b1('0xb1')]),'osVersion':_0x752f57['os'][_0xd1b1('0xb1')],'deviceModel':_0x752f57['device'][_0xd1b1('0x41')]&&_0x752f57[_0xd1b1('0xb6')]['vendor']?util[_0xd1b1('0xb2')](_0xd1b1('0xb7'),_0x752f57['device']['model'],_0x752f57[_0xd1b1('0xb6')]['vendor'],_0x752f57[_0xd1b1('0xb6')][_0xd1b1('0x3f')]):null,'deviceVendor':_0x752f57[_0xd1b1('0xb6')][_0xd1b1('0xb8')],'deviceType':_0x752f57[_0xd1b1('0xb6')][_0xd1b1('0x3f')],'formData':JSON[_0xd1b1('0x26')](_0x2fc0e9['body'])};var _0x2d17e8={'ChatWebsiteId':_0x2fc0e9[_0xd1b1('0x56')]['id'],'closed':![]};if(_0x2fc0e9['body'][_0xd1b1('0xb9')]){_0x2d17e8[_0xd1b1('0xb9')]=_0x2fc0e9[_0xd1b1('0x5a')]['threadId'];return db[_0xd1b1('0xba')][_0xd1b1('0x58')]({'where':_0x2d17e8})[_0xd1b1('0x20')](function(_0x152f9c){if(_0x152f9c){return[_0x152f9c,![]];}_0x3eed99[_0xd1b1('0xb9')]=_0x2fc0e9['body'][_0xd1b1('0xb9')];_0x3eed99[_0xd1b1('0xbb')]=_0x2fc0e9[_0xd1b1('0x5a')][_0xd1b1('0xbb')];return db[_0xd1b1('0xba')][_0xd1b1('0x59')](_0x3eed99)[_0xd1b1('0x20')](function(_0x22e116){return[_0x22e116,!![]];});});}_0x2d17e8[_0xd1b1('0xbc')]=_0x4bdc65['id'];if(_0x2fc0e9[_0xd1b1('0x5a')][_0xd1b1('0xbd')]&&_0x2fc0e9[_0xd1b1('0x5a')][_0xd1b1('0xbd')]['id']){_0x2d17e8['id']=_0x2fc0e9[_0xd1b1('0x5a')][_0xd1b1('0xbd')]['id'];return db[_0xd1b1('0xba')][_0xd1b1('0x58')]({'where':_0x2d17e8})[_0xd1b1('0x20')](function(_0x13bea8){if(_0x13bea8){return[_0x13bea8,![]];}return db[_0xd1b1('0xba')][_0xd1b1('0x59')](_0x3eed99)[_0xd1b1('0x20')](function(_0x3fe67d){return[_0x3fe67d,!![]];});});}return db[_0xd1b1('0xba')][_0xd1b1('0x59')](_0x3eed99)[_0xd1b1('0x20')](function(_0x33fbe0){return[_0x33fbe0,!![]];});}})[_0xd1b1('0xbe')](function(_0x2f2579,_0x127278){if(_0x2f2579){_0x3136b9=_0x127278;if(!_0x127278){var _0x7559c5={'from':(_0x2bf1a0[_0xd1b1('0xa6')][_0xd1b1('0xad')]||'')+'\x20'+(_0x2bf1a0[_0xd1b1('0xa6')]['lastName']||'')};if(_0x2fc0e9[_0xd1b1('0x5a')][_0xd1b1('0xb9')]&&_0x2fc0e9[_0xd1b1('0x5a')][_0xd1b1('0xbf')]&&_0x2fc0e9[_0xd1b1('0x5a')][_0xd1b1('0xb9')]!=_0x2fc0e9[_0xd1b1('0x5a')]['messageId']){_0x7559c5[_0xd1b1('0xb9')]=_0x2fc0e9[_0xd1b1('0x5a')][_0xd1b1('0xbf')];}return _0x2f2579['update'](_0x7559c5);}else{return _0x2f2579;}}})['then'](function(_0x42842f){_0x2bf1a0[_0xd1b1('0xbd')]=_0x42842f[_0xd1b1('0x5c')]({'plain':!![]});_0x2bf1a0['interaction']['created']=_0x3136b9;if(_0x2bf1a0[_0xd1b1('0xbd')][_0xd1b1('0xc0')]){if(_0x2bf1a0['account'][_0xd1b1('0xc1')]){_0x2bf1a0[_0xd1b1('0xa0')]['push']({'id':0x0,'priority':_0x2bf1a0[_0xd1b1('0xa0')][_0xd1b1('0x65')]+0x1,'app':_0xd1b1('0xc2'),'appdata':_0xd1b1('0xc3'),'interval':_0xd1b1('0xc4')});}}return db[_0xd1b1('0xc5')]['create']({'body':_0x2fc0e9[_0xd1b1('0x5a')]['body'],'ChatWebsiteId':_0x2fc0e9[_0xd1b1('0x56')]['id'],'ChatInteractionId':_0x42842f['id'],'direction':'in','ContactId':_0x2bf1a0['contact']['id'],'AttachmentId':_0x2fc0e9[_0xd1b1('0x5a')][_0xd1b1('0xc6')]});})[_0xd1b1('0x20')](function(_0x3aa1bb){_0x2bf1a0['message']=_0x3aa1bb;if(_0x2bf1a0[_0xd1b1('0xbd')][_0xd1b1('0xc7')]){return db['User'][_0xd1b1('0x58')]({'attributes':['id',_0xd1b1('0x38')],'where':{'id':_0x2bf1a0[_0xd1b1('0xbd')][_0xd1b1('0xc7')]}})[_0xd1b1('0x20')](function(_0x29f148){if(_0x29f148){_0x2bf1a0[_0xd1b1('0xa0')][_0xd1b1('0xc8')]({'id':0x0,'priority':0x0,'app':_0xd1b1('0xc9'),'appdata':_0x29f148['name']+','+(_0x2bf1a0[_0xd1b1('0xa5')][_0xd1b1('0xca')]||0xa),'interval':_0xd1b1('0xc4')});_0x2bf1a0[_0xd1b1('0xcb')]=!![];}return respondWithRpcPromise(_0xd1b1('0xcc'),_0xd1b1('0xcd'),_0x2bf1a0);});}return respondWithRpcPromise('Start','startRouting',_0x2bf1a0);})[_0xd1b1('0x20')](function(_0x2e6b3a){respondWithRpcPromise(_0xd1b1('0xce'),_0xd1b1('0xce'),{'event':_0xd1b1('0x87'),'message':_0x2e6b3a},client9002);return _0x2e6b3a;})[_0xd1b1('0x20')](respondWithResult(_0x4569db,null))[_0xd1b1('0x2a')](handleError(_0x4569db,null));};exports[_0xd1b1('0xcf')]=function(_0x3be591,_0x56759d,_0x2f4823){var _0x55dd03,_0x32dc7c,_0x11de27;var _0x1124d3=[];var _0x4aff4f=[];var _0x6351f={};var _0x318ee7=_0x3be591[_0xd1b1('0xd0')]||[];return db[_0xd1b1('0x8c')][_0xd1b1('0x61')]()[_0xd1b1('0x20')](function(_0x2a1c4b){if(!_0x2a1c4b){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x4aff4f=_['difference'](_['keys'](_0x2a1c4b),[_0xd1b1('0x8e'),_0xd1b1('0x8f')]);_0x1124d3=_[_0xd1b1('0xd1')](_[_0xd1b1('0x43')](_0x2a1c4b),[_0xd1b1('0x8e'),_0xd1b1('0x8f'),'CompanyId',_0xd1b1('0x90')]);if(_0x3be591[_0xd1b1('0x5a')]['id']){delete _0x3be591['body']['id'];}if(_[_0xd1b1('0x80')](_0x3be591[_0xd1b1('0x5a')][_0xd1b1('0x91')])||_[_0xd1b1('0x80')](_0x3be591[_0xd1b1('0x5a')]['body'][_0xd1b1('0xd2')])){throw _0x56759d[_0xd1b1('0x2c')](0x1f4)[_0xd1b1('0x39')](new db[(_0xd1b1('0x92'))][(_0xd1b1('0x93'))](_0xd1b1('0x94')));}if(_[_0xd1b1('0x80')](_0x3be591[_0xd1b1('0x5a')]['body'])||_0x3be591[_0xd1b1('0x5a')][_0xd1b1('0x5a')]===''||(_[_0xd1b1('0x80')](_0x3be591[_0xd1b1('0x5a')][_0xd1b1('0x5a')][_0xd1b1('0xd3')])||_0x3be591[_0xd1b1('0x5a')][_0xd1b1('0x5a')][_0xd1b1('0xd3')]==='')){throw _0x56759d[_0xd1b1('0x2c')](0x1f4)[_0xd1b1('0x39')](new db[(_0xd1b1('0x92'))][(_0xd1b1('0x93'))](_0xd1b1('0x95')));}if(_[_0xd1b1('0x80')](_0x3be591[_0xd1b1('0x5a')]['mapKeyOffline'])){throw _0x56759d[_0xd1b1('0x2c')](0x1f4)[_0xd1b1('0x39')](new db[(_0xd1b1('0x92'))][(_0xd1b1('0x93'))](_0xd1b1('0xd4')+_0x1124d3));}if(!_['includes'](_0x1124d3,_0x3be591[_0xd1b1('0x5a')][_0xd1b1('0xd5')])){throw _0x56759d['status'](0x1f4)[_0xd1b1('0x39')](new db[(_0xd1b1('0x92'))][(_0xd1b1('0x93'))](_0xd1b1('0xd6')+_0x1124d3));}_0x6351f[_0x3be591['body'][_0xd1b1('0xd5')]]=_0x3be591['body'][_0xd1b1('0x91')];})[_0xd1b1('0x20')](function(){return db[_0xd1b1('0x52')][_0xd1b1('0x58')]({'where':{'id':_0x3be591[_0xd1b1('0x56')]['id']},'include':[{'model':db[_0xd1b1('0x9a')],'as':_0xd1b1('0x9f')},{'model':db[_0xd1b1('0xd7')],'as':'MailAccount'}]});})[_0xd1b1('0x20')](handleEntityNotFound(_0x56759d,null))[_0xd1b1('0x20')](function(_0x39ef1f){if(_0x39ef1f&&_0x39ef1f['List']){_0x32dc7c=_0x39ef1f;var _0xdaeb58=_[_0xd1b1('0x18')](_0x3be591[_0xd1b1('0x5a')],{'firstName':_0x3be591[_0xd1b1('0x5a')][_0xd1b1('0x91')],'phone':_0x3be591[_0xd1b1('0x5a')][_0xd1b1('0x91')],'ListId':_0x39ef1f[_0xd1b1('0x90')]});_0xdaeb58[_0x3be591[_0xd1b1('0x5a')][_0xd1b1('0xd5')]]=_0x3be591[_0xd1b1('0x5a')][_0xd1b1('0x91')];return db[_0xd1b1('0x8c')][_0xd1b1('0xd8')]({'where':_0x6351f,'defaults':_0xdaeb58});}})[_0xd1b1('0xbe')](function(_0x1337b0){if(_0x1337b0){_0x11de27=_0x1337b0;var _0x1c816e=fs[_0xd1b1('0xd9')](path['join'](config[_0xd1b1('0x77')],_0xd1b1('0xda')),_0xd1b1('0xdb'));var _0xaa71ff=ejs[_0xd1b1('0xdc')](_0x1c816e,{'body':_[_0xd1b1('0xdd')](_0x3be591[_0xd1b1('0x5a')][_0xd1b1('0x5a')]),'bodyTitle':_0x32dc7c[_0xd1b1('0xde')]});return db['ChatOfflineMessage'][_0xd1b1('0x59')]({'body':_0xaa71ff,'ContactId':_0x1337b0['id'],'ChatWebsiteId':_0x32dc7c['id']});}})[_0xd1b1('0x20')](function(_0x2ddcce){if(!_[_0xd1b1('0x80')](_0x3be591[_0xd1b1('0xd0')])){var _0x2ebdb6=_0x318ee7['map'](function(_0x402dcb){return{'name':_0x402dcb['originalname'],'basename':_0x402dcb['filename'],'type':_0x402dcb[_0xd1b1('0xdf')],'ChatOfflineMessageId':_0x2ddcce['id']};});db[_0xd1b1('0xe0')]['bulkCreate'](_0x2ebdb6)[_0xd1b1('0xe1')];}return _0x2ddcce;})[_0xd1b1('0x20')](function(_0x9edfea){if(_0x9edfea){_0x55dd03=_0x9edfea;return db[_0xd1b1('0xd7')][_0xd1b1('0x6a')]({'where':{'service':!![]},'include':[{'model':db[_0xd1b1('0xe2')],'as':_0xd1b1('0xe3'),'raw':!![]}]});}})[_0xd1b1('0x20')](function(_0x55de30){if(_0x55de30&&_0x55de30['Smtp']&&_0x32dc7c[_0xd1b1('0xe4')]&&_0x32dc7c[_0xd1b1('0xe5')]){var _0x20a459={'tls':{'rejectUnauthorized':![]}};if(_0x55de30[_0xd1b1('0xe3')]['service']){_0x20a459[_0xd1b1('0xe6')]=_0x55de30[_0xd1b1('0xe3')][_0xd1b1('0xe6')];}else{_0x20a459['host']=_0x55de30[_0xd1b1('0xe3')][_0xd1b1('0xe7')];_0x20a459[_0xd1b1('0xe8')]=_0x55de30[_0xd1b1('0xe3')][_0xd1b1('0xe8')];_0x20a459['secure']=_0x55de30[_0xd1b1('0xe3')][_0xd1b1('0xe9')];}if(_0x55de30[_0xd1b1('0xe3')][_0xd1b1('0xea')]){_0x20a459[_0xd1b1('0xeb')]={'user':_0x55de30[_0xd1b1('0xe3')][_0xd1b1('0x5b')],'pass':_0x55de30['Smtp'][_0xd1b1('0xec')]};}return respondWithRpcPromise(_0xd1b1('0xed'),'sendMail',{'account':_0x20a459,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x55de30[_0xd1b1('0x38')],_0x55de30['email']||_0x55de30[_0xd1b1('0xe3')][_0xd1b1('0x5b')]),'to':_0x32dc7c[_0xd1b1('0xe5')],'subject':_0x32dc7c[_0xd1b1('0xee')],'text':_0x55dd03['body'],'attachments':!_[_0xd1b1('0x80')](_0x3be591[_0xd1b1('0xd0')])?_0x318ee7:[]}},client9003)[_0xd1b1('0x20')](function(){return _0x55dd03;})[_0xd1b1('0x2a')](function(_0x513279){console['error'](_0x513279);});}})[_0xd1b1('0x20')](function(){if(_0x32dc7c&&_0x32dc7c['openNewInteraction']&&_0x32dc7c[_0xd1b1('0xef')]){var _0x5be1bc={'from':_0x11de27[_0xd1b1('0xd2')],'firstName':_0x11de27[_0xd1b1('0xad')],'lastName':_0x11de27[_0xd1b1('0xae')],'mapKey':_0xd1b1('0xd2'),'message':{'from':_0x11de27[_0xd1b1('0xd2')],'to':_0x32dc7c[_0xd1b1('0xd7')]['email'],'cc':'','subject':_0x32dc7c[_0xd1b1('0xee')],'messageId':'','sentAt':new Date(),'attach':!_['isNil'](_0x3be591[_0xd1b1('0xd0')]),'attachments':!_[_0xd1b1('0x80')](_0x3be591[_0xd1b1('0xd0')])?_0x318ee7:[],'originChannel':_0xd1b1('0xf0'),'ChatWebsiteId':_0x32dc7c['id'],'ChatOfflineMessageId':_0x55dd03['id'],'originTo':_0x32dc7c[_0xd1b1('0xd7')][_0xd1b1('0xd2')]},'body':_0x55dd03[_0xd1b1('0x5a')]};var _0x1995db={'account':{'id':_0x32dc7c['MailAccountId']},'body':_0x5be1bc,'log':_0xd1b1('0xf1')};return respondWithRpcPromise(_0xd1b1('0xf1'),_0xd1b1('0xf2'),_0x1995db,client9001)['then'](function(){return _0x55dd03;})['catch'](function(_0xc1ba59){console[_0xd1b1('0x27')](_0xc1ba59);});}return;})[_0xd1b1('0x20')](function(){if(_0x55dd03){return _0x55dd03;}})[_0xd1b1('0x20')](respondWithResult(_0x56759d,null))['catch'](function(_0x3e9888){console[_0xd1b1('0x27')](_0xd1b1('0x2a'),_0x3e9888);for(var _0x3edac8 of _0x318ee7){var _0x4e15f8=path['join'](config[_0xd1b1('0x77')],_0xd1b1('0xd0'),'attachments',_0xd1b1('0xf3'),_0x3edac8[_0xd1b1('0x70')]);fs_extra[_0xd1b1('0xf4')](_0x4e15f8)[_0xd1b1('0x2a')](function(_0x67d8e){console[_0xd1b1('0x27')]('Could\x20not\x20remove\x20attachment\x20file',_0x4e15f8,_0x67d8e);});}});};exports['addInteraction']=function(_0xec64b1,_0x25e5a4,_0x4fc7e7){return db[_0xd1b1('0xba')][_0xd1b1('0x58')]({'where':{'id':_0xec64b1[_0xd1b1('0x56')]['id']}})[_0xd1b1('0x20')](handleEntityNotFound(_0x25e5a4,null))[_0xd1b1('0x20')](function(_0x3c436d){if(_0x3c436d){return _0x3c436d[_0xd1b1('0xf5')](_0xec64b1[_0xd1b1('0x5a')][_0xd1b1('0x68')],_[_0xd1b1('0xf6')](_0xec64b1[_0xd1b1('0x5a')],[_0xd1b1('0x68'),'id'])||{});}})[_0xd1b1('0x20')](respondWithResult(_0x25e5a4,null))['catch'](handleError(_0x25e5a4,null));};exports['getInteractions']=function(_0xca6184,_0xc4cf08,_0x57ea9c){var _0x2e9869={'raw':![],'where':{}};var _0x337672={};var _0x2f285b={'count':0x0,'rows':[]};return db[_0xd1b1('0x52')]['findOne']({'where':{'id':_0xca6184[_0xd1b1('0x56')]['id']}})[_0xd1b1('0x20')](handleEntityNotFound(_0xc4cf08,null))[_0xd1b1('0x20')](function(_0x229647){if(_0x229647){_0x337672['model']=_['keys'](db[_0xd1b1('0xba')][_0xd1b1('0x3d')]);_0x337672[_0xd1b1('0x42')]=_['keys'](_0xca6184[_0xd1b1('0x42')]);_0x337672['filters']=_[_0xd1b1('0x46')](_0x337672[_0xd1b1('0x41')],_0x337672[_0xd1b1('0x42')]);_0x2e9869['attributes']=_[_0xd1b1('0x46')](_0x337672[_0xd1b1('0x41')],qs[_0xd1b1('0x47')](_0xca6184[_0xd1b1('0x42')][_0xd1b1('0x47')]));_0x2e9869['attributes']=_0x2e9869[_0xd1b1('0x45')][_0xd1b1('0x65')]?_0x2e9869['attributes']:_0x337672[_0xd1b1('0x41')];if(!_0xca6184[_0xd1b1('0x42')]['hasOwnProperty']('nolimit')){_0x2e9869[_0xd1b1('0x30')]=qs[_0xd1b1('0x30')](_0xca6184[_0xd1b1('0x42')][_0xd1b1('0x30')]);_0x2e9869[_0xd1b1('0x2f')]=qs['offset'](_0xca6184[_0xd1b1('0x42')][_0xd1b1('0x2f')]);}_0x2e9869[_0xd1b1('0x49')]=qs[_0xd1b1('0x4a')](_0xca6184[_0xd1b1('0x42')]['sort']);_0x2e9869[_0xd1b1('0x4b')]=qs[_0xd1b1('0x44')](_[_0xd1b1('0x4c')](_0xca6184['query'],_0x337672[_0xd1b1('0x44')]));_0x2e9869[_0xd1b1('0x4b')]['ChatWebsiteId']=_0x229647['id'];if(_0xca6184[_0xd1b1('0x42')][_0xd1b1('0x4d')]){_0x2e9869[_0xd1b1('0x4b')]=_[_0xd1b1('0x4e')](_0x2e9869['where'],{'$or':_[_0xd1b1('0x3c')](_0x2e9869[_0xd1b1('0x45')],function(_0x2fb62c){var _0x25f3d9={};_0x25f3d9[_0x2fb62c]={'$like':'%'+_0xca6184['query']['filter']+'%'};return _0x25f3d9;})});}_0x2e9869=_[_0xd1b1('0x4e')]({},_0x2e9869,_0xca6184[_0xd1b1('0x50')]);return db['ChatInteraction'][_0xd1b1('0x2e')]({'where':_0x2e9869['where']})[_0xd1b1('0x20')](function(_0x2c134c){_0x2f285b[_0xd1b1('0x2e')]=_0x2c134c;if(_0xca6184[_0xd1b1('0x42')]['includeAll']){_0x2e9869[_0xd1b1('0x51')]=[{'model':db[_0xd1b1('0x8c')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xd1b1('0xf7'),'attributes':[_0xd1b1('0x38'),_0xd1b1('0xf8'),_0xd1b1('0xf9')],'required':![]},{'model':db[_0xd1b1('0xfa')],'as':'Tags','attributes':['id',_0xd1b1('0x38'),_0xd1b1('0xfb')],'where':_0xca6184[_0xd1b1('0x42')][_0xd1b1('0xfc')]?{'id':_0xca6184[_0xd1b1('0x42')]['tag']}:undefined,'required':_0xca6184[_0xd1b1('0x42')][_0xd1b1('0xfc')]?!![]:![]}];}return db[_0xd1b1('0xba')][_0xd1b1('0x53')](_0x2e9869);})[_0xd1b1('0x20')](function(_0x269536){_0x2f285b[_0xd1b1('0x54')]=_0x269536;return _0x2f285b;});}})[_0xd1b1('0x20')](respondWithFilteredResult(_0xc4cf08,_0x2e9869))[_0xd1b1('0x2a')](handleError(_0xc4cf08,null));};function iftimePromise(_0x4edcc5,_0x355cca){return respondWithRpcPromise('Command','getSnippet',{'command':_0x355cca[_0xd1b1('0xfd')]?util[_0xd1b1('0xb2')]('iftime\x20%s,%s',_0x4edcc5['interval'],_0x355cca['timezone']):util[_0xd1b1('0xb2')](_0xd1b1('0xfe'),_0x4edcc5[_0xd1b1('0xff')])},client9002)['then'](function(_0x471411){var _0x353617=_0x471411&&_0x471411[_0xd1b1('0x100')](_0xd1b1('0x101'))>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x355cca['id'],_0x4edcc5['id'],_0x4edcc5['interval'],_0x353617?_0xd1b1('0x102'):_0xd1b1('0x103'),_0x355cca['timezone']?_0x355cca['timezone']:'No\x20timezone');return _0x353617;})[_0xd1b1('0x2a')](function(_0x4aaf65){logger[_0xd1b1('0x27')](_0xd1b1('0x104'),_0x355cca['id'],_0x4edcc5['id'],_0x4edcc5['interval'],util[_0xd1b1('0x105')](_0x4aaf65,{'showHidden':![],'depth':null}),_0x355cca['timezone']?_0x355cca['timezone']:_0xd1b1('0x106'));return![];});}exports['getSnippet']=function(_0x1ed091,_0x2912c2,_0x44ae26){var _0x20abcb=0x0;var _0x3e8e4b=0x0;var _0x2347bd=![];var _0x150ecc;var _0x5cb4dd;return db['ChatWebsite'][_0xd1b1('0x58')]({'where':{'id':_0x1ed091[_0xd1b1('0x56')]['id']},'include':[{'model':db['Interval'],'as':_0xd1b1('0x107'),'include':[{'model':db['Interval'],'as':_0xd1b1('0x108'),'attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x2912c2,null))['then'](function(_0x4d4a8b){if(_0x4d4a8b){_0x150ecc=_0x4d4a8b;return _0x4d4a8b[_0xd1b1('0x109')]({'raw':!![]});}})[_0xd1b1('0x20')](function(_0x286d8d){if(_0x150ecc){if(_0x286d8d){_0x5cb4dd=_0x286d8d;}}return require(_0xd1b1('0x15'))[_0xd1b1('0x79')]();})[_0xd1b1('0x20')](function(_0x4f2dc7){if(_0x4f2dc7){_0x3e8e4b=_0x4f2dc7[_0xd1b1('0x10a')];_0x2347bd=_0x4f2dc7[_0xd1b1('0x7a')];}})['then'](function(){return db['ChatInteraction'][_0xd1b1('0x2e')]({'where':{'closed':![]}});})[_0xd1b1('0x20')](function(_0x2544e7){_0x20abcb=_0x2544e7;if(_0x3e8e4b&&_0x2544e7>_0x3e8e4b){return db['License'][_0xd1b1('0x6a')]({'where':{'id':0x1}})['then'](function(_0x22822b){if(_0x22822b){_0x22822b['increment'](_0xd1b1('0x10b'));}});}})[_0xd1b1('0x20')](function(){if(_0x150ecc[_0xd1b1('0x107')]&&_0x150ecc[_0xd1b1('0x107')][_0xd1b1('0x108')]){var _0x5a8f6c=[];for(var _0x573826=0x0;_0x573826<_0x150ecc[_0xd1b1('0x107')][_0xd1b1('0x108')][_0xd1b1('0x65')];_0x573826++){var _0x228f17=_0x150ecc[_0xd1b1('0x107')][_0xd1b1('0x108')][_0x573826][_0xd1b1('0x5c')]({'plain':!![]});_0x5a8f6c['push'](iftimePromise(_0x228f17,_0x150ecc));}return BPromise[_0xd1b1('0x10c')](_0x5a8f6c)[_0xd1b1('0x20')](function(_0x145824){return _[_0xd1b1('0x10d')](_0x145824);});}else{return!![];}})[_0xd1b1('0x20')](function(_0x65c46e){var _0x48f23a=fs[_0xd1b1('0xd9')](path['join'](config[_0xd1b1('0x77')],'server/files/chat/iframe.js'),_0xd1b1('0xdb'));var _0x5289dc={'remote':_0x150ecc[_0xd1b1('0x10e')],'query':querystring[_0xd1b1('0x26')](_['merge'](_0x150ecc['get']({'plain':!![]}),{'customerIp':_0x1ed091[_0xd1b1('0xa8')][_0xd1b1('0xaa')]||_0x1ed091[_0xd1b1('0xa8')]['x-real-ip']||_0x1ed091[_0xd1b1('0x10f')]['remoteAddress']||_0x1ed091['ip'],'referer':_0x1ed091['headers'][_0xd1b1('0xb0')],'openedInteractions':_0x20abcb,'maxInteractions':_0x3e8e4b,'virtual':_0x2347bd['virtual'],'online':_0x65c46e,'custom':_0x2347bd}))[_0xd1b1('0x110')](/'/g,'\x5c\x27')};_0x2912c2['send'](ejs[_0xd1b1('0xdc')](Mustache[_0xd1b1('0xdc')](_0x48f23a,_0x5289dc),{'proactiveActions':_0x5cb4dd,'alignment':_0x150ecc[_0xd1b1('0x111')],'verticalAlignment':_0x150ecc[_0xd1b1('0x112')],'div_color':_0x150ecc[_0xd1b1('0xfb')],'text_color':_0x150ecc[_0xd1b1('0x113')],'button_color':_0x150ecc['color_button'],'background_color':_0x150ecc[_0xd1b1('0x114')]}));})['catch'](handleError(_0x2912c2,null));};exports[_0xd1b1('0x115')]=function(_0x2c8abf,_0x47bab8,_0x15cb14){return db[_0xd1b1('0x52')][_0xd1b1('0x6a')]({'where':{'id':_0x2c8abf[_0xd1b1('0x56')]['id']}})[_0xd1b1('0x20')](handleEntityNotFound(_0x47bab8,null))['then'](function(_0xa5e34e){if(_0xa5e34e){return db[_0xd1b1('0x116')][_0xd1b1('0x117')](function(_0x288ecd){return db[_0xd1b1('0x9d')]['destroy']({'where':{'ChatWebsiteId':_0x2c8abf[_0xd1b1('0x56')]['id']},'transaction':_0x288ecd})['then'](function(_0x167937){var _0x4b3a86=_[_0xd1b1('0x3c')](_0x2c8abf[_0xd1b1('0x5a')],function(_0xf4c058){_0xf4c058[_0xd1b1('0x62')]=_0x2c8abf[_0xd1b1('0x56')]['id'];return _0xf4c058;});return db['ChatApplication'][_0xd1b1('0x118')](_0x4b3a86,{'transaction':_0x288ecd});});})['then'](function(){return db['ChatApplication'][_0xd1b1('0x119')]({'where':{'ChatWebsiteId':_0x2c8abf[_0xd1b1('0x56')]['id']},'order':_0xd1b1('0xa3')});});}})['then'](respondWithResult(_0x47bab8,null))[_0xd1b1('0x2a')](handleError(_0x47bab8,null));};exports[_0xd1b1('0x11a')]=function(_0x1783b3,_0x46a7f2,_0x486a4b){var _0x3d8e5d={};var _0x34918b={};var _0x22b518;var _0x2029f8;return db[_0xd1b1('0x52')][_0xd1b1('0x6a')]({'where':{'id':_0x1783b3['params']['id']}})['then'](handleEntityNotFound(_0x46a7f2,null))[_0xd1b1('0x20')](function(_0x99f13b){if(_0x99f13b){_0x22b518=_0x99f13b;_0x34918b[_0xd1b1('0x41')]=_[_0xd1b1('0x43')](db[_0xd1b1('0x9d')][_0xd1b1('0x3d')]);_0x34918b['query']=_[_0xd1b1('0x43')](_0x1783b3[_0xd1b1('0x42')]);_0x34918b[_0xd1b1('0x44')]=_[_0xd1b1('0x46')](_0x34918b[_0xd1b1('0x41')],_0x34918b[_0xd1b1('0x42')]);_0x3d8e5d[_0xd1b1('0x45')]=_['intersection'](_0x34918b['model'],qs[_0xd1b1('0x47')](_0x1783b3['query']['fields']));_0x3d8e5d[_0xd1b1('0x45')]=_0x3d8e5d[_0xd1b1('0x45')][_0xd1b1('0x65')]?_0x3d8e5d['attributes']:_0x34918b[_0xd1b1('0x41')];_0x3d8e5d[_0xd1b1('0x49')]=qs[_0xd1b1('0x4a')](_0x1783b3[_0xd1b1('0x42')][_0xd1b1('0x4a')]);_0x3d8e5d[_0xd1b1('0x4b')]=qs[_0xd1b1('0x44')](_[_0xd1b1('0x4c')](_0x1783b3[_0xd1b1('0x42')],_0x34918b[_0xd1b1('0x44')]));if(_0x1783b3[_0xd1b1('0x42')]['filter']){_0x3d8e5d[_0xd1b1('0x4b')]=_[_0xd1b1('0x4e')](_0x3d8e5d[_0xd1b1('0x4b')],{'$or':_[_0xd1b1('0x3c')](_0x3d8e5d['attributes'],function(_0x1005d7){var _0xff7cfa={};_0xff7cfa[_0x1005d7]={'$like':'%'+_0x1783b3['query']['filter']+'%'};return _0xff7cfa;})});}_0x3d8e5d=_[_0xd1b1('0x4e')]({},_0x3d8e5d,_0x1783b3[_0xd1b1('0x50')]);return _0x22b518['getApplications'](_0x3d8e5d);}})[_0xd1b1('0x20')](function(_0x4fb1b5){if(_0x4fb1b5){_0x2029f8=_0x4fb1b5[_0xd1b1('0x65')];if(!_0x1783b3['query'][_0xd1b1('0x48')]('nolimit')){_0x3d8e5d[_0xd1b1('0x30')]=qs['limit'](_0x1783b3['query'][_0xd1b1('0x30')]);_0x3d8e5d[_0xd1b1('0x2f')]=qs[_0xd1b1('0x2f')](_0x1783b3[_0xd1b1('0x42')][_0xd1b1('0x2f')]);}return _0x22b518[_0xd1b1('0x11a')](_0x3d8e5d);}})[_0xd1b1('0x20')](function(_0x46054a){if(_0x46054a){return _0x46054a?{'count':_0x2029f8,'rows':_0x46054a}:null;}})['then'](respondWithResult(_0x46a7f2,null))['catch'](handleError(_0x46a7f2,null));};exports[_0xd1b1('0x11b')]=function(_0x2bcfb2,_0x3b0178,_0x30f0ba){return db[_0xd1b1('0x11c')][_0xd1b1('0x58')]({'where':{'id':_0x2bcfb2[_0xd1b1('0x56')]['id']}})[_0xd1b1('0x20')](handleEntityNotFound(_0x3b0178,null))[_0xd1b1('0x20')](function(_0x3c596a){if(_0x3c596a){return _0x3c596a[_0xd1b1('0x11b')](_0x2bcfb2[_0xd1b1('0x5a')]['ids'],_[_0xd1b1('0xf6')](_0x2bcfb2[_0xd1b1('0x5a')],['ids','id'])||{});}})[_0xd1b1('0x20')](respondWithResult(_0x3b0178,null))[_0xd1b1('0x2a')](handleError(_0x3b0178,null));};exports[_0xd1b1('0x109')]=function(_0x488c59,_0x59d507,_0xc3f2f0){var _0x17ef0a={};var _0xdcc113={};var _0x3fa7e9;var _0xcf991e;return db[_0xd1b1('0x52')][_0xd1b1('0x6a')]({'where':{'id':_0x488c59['params']['id']}})['then'](handleEntityNotFound(_0x59d507,null))[_0xd1b1('0x20')](function(_0x11e5a9){if(_0x11e5a9){_0x3fa7e9=_0x11e5a9;_0xdcc113[_0xd1b1('0x41')]=_[_0xd1b1('0x43')](db[_0xd1b1('0x11d')][_0xd1b1('0x3d')]);_0xdcc113['query']=_[_0xd1b1('0x43')](_0x488c59[_0xd1b1('0x42')]);_0xdcc113['filters']=_['intersection'](_0xdcc113[_0xd1b1('0x41')],_0xdcc113[_0xd1b1('0x42')]);_0x17ef0a['attributes']=_[_0xd1b1('0x46')](_0xdcc113[_0xd1b1('0x41')],qs['fields'](_0x488c59['query'][_0xd1b1('0x47')]));_0x17ef0a[_0xd1b1('0x45')]=_0x17ef0a['attributes'][_0xd1b1('0x65')]?_0x17ef0a['attributes']:_0xdcc113[_0xd1b1('0x41')];_0x17ef0a[_0xd1b1('0x49')]=qs[_0xd1b1('0x4a')](_0x488c59[_0xd1b1('0x42')]['sort']);_0x17ef0a['where']=qs['filters'](_[_0xd1b1('0x4c')](_0x488c59[_0xd1b1('0x42')],_0xdcc113[_0xd1b1('0x44')]));if(_0x488c59[_0xd1b1('0x42')]['filter']){_0x17ef0a['where']=_[_0xd1b1('0x4e')](_0x17ef0a[_0xd1b1('0x4b')],{'$or':_['map'](_0x17ef0a[_0xd1b1('0x45')],function(_0x274252){var _0x14ccad={};_0x14ccad[_0x274252]={'$like':'%'+_0x488c59['query'][_0xd1b1('0x4d')]+'%'};return _0x14ccad;})});}_0x17ef0a=_[_0xd1b1('0x4e')]({},_0x17ef0a,_0x488c59[_0xd1b1('0x50')]);return _0x3fa7e9[_0xd1b1('0x109')](_0x17ef0a);}})[_0xd1b1('0x20')](function(_0x44d6ec){if(_0x44d6ec){_0xcf991e=_0x44d6ec[_0xd1b1('0x65')];if(!_0x488c59['query'][_0xd1b1('0x48')](_0xd1b1('0x66'))){_0x17ef0a[_0xd1b1('0x30')]=qs['limit'](_0x488c59[_0xd1b1('0x42')]['limit']);_0x17ef0a[_0xd1b1('0x2f')]=qs[_0xd1b1('0x2f')](_0x488c59[_0xd1b1('0x42')][_0xd1b1('0x2f')]);}return _0x3fa7e9[_0xd1b1('0x109')](_0x17ef0a);}})[_0xd1b1('0x20')](function(_0xa6fe8){if(_0xa6fe8){return _0xa6fe8?{'count':_0xcf991e,'rows':_0xa6fe8}:null;}})[_0xd1b1('0x20')](respondWithResult(_0x59d507,null))[_0xd1b1('0x2a')](handleError(_0x59d507,null));};exports[_0xd1b1('0x11e')]=function(_0x7ec0c,_0x3195e8,_0x78571c){var _0x87b434=_0x7ec0c[_0xd1b1('0x42')][_0xd1b1('0x11f')]===_0xd1b1('0x120')?_0xd1b1('0x121'):_0xd1b1('0x122');return db['ChatWebsite'][_0xd1b1('0x58')]({'attributes':['id',_0x87b434],'where':{'id':_0x7ec0c[_0xd1b1('0x56')]['id']}})['then'](handleEntityNotFound(_0x3195e8,null))[_0xd1b1('0x20')](function(_0x2b1426){if(_0x2b1426){var _0x1b6d66=_0x2b1426[_0x87b434];var _0x5aca91=_0x1b6d66&&_0x1b6d66[_0xd1b1('0x123')]?_0x1b6d66[_0xd1b1('0x123')]:[];_0x3195e8[_0xd1b1('0x39')]({'fromKey':_[_0xd1b1('0x80')](_0x1b6d66['fromKey'])?undefined:_0x1b6d66[_0xd1b1('0x124')],'count':_0x5aca91['length'],'rows':_0x5aca91});}})['catch'](handleError(_0x3195e8,null));};exports[_0xd1b1('0x125')]=function(_0x58b572,_0x9b8968,_0x442802){var _0xaac376={'raw':![],'where':{}};var _0x1aebc8={};var _0x33d8c6={'count':0x0,'rows':[]};return db[_0xd1b1('0x52')][_0xd1b1('0x6a')]({'where':{'id':_0x58b572[_0xd1b1('0x56')]['id']}})[_0xd1b1('0x20')](handleEntityNotFound(_0x9b8968,null))[_0xd1b1('0x20')](function(_0x402d8b){if(_0x402d8b){_0x1aebc8[_0xd1b1('0x41')]=_[_0xd1b1('0x43')](db['ChatOfflineMessage'][_0xd1b1('0x3d')]);_0x1aebc8[_0xd1b1('0x42')]=_[_0xd1b1('0x43')](_0x58b572['query']);_0x1aebc8[_0xd1b1('0x44')]=_[_0xd1b1('0x46')](_0x1aebc8[_0xd1b1('0x41')],_0x1aebc8[_0xd1b1('0x42')]);_0xaac376[_0xd1b1('0x45')]=_['intersection'](_0x1aebc8['model'],qs[_0xd1b1('0x47')](_0x58b572[_0xd1b1('0x42')]['fields']));_0xaac376[_0xd1b1('0x45')]=_0xaac376[_0xd1b1('0x45')][_0xd1b1('0x65')]?_0xaac376[_0xd1b1('0x45')]:_0x1aebc8[_0xd1b1('0x41')];if(!_0x58b572[_0xd1b1('0x42')]['hasOwnProperty'](_0xd1b1('0x66'))){_0xaac376[_0xd1b1('0x30')]=qs['limit'](_0x58b572['query'][_0xd1b1('0x30')]);_0xaac376[_0xd1b1('0x2f')]=qs[_0xd1b1('0x2f')](_0x58b572[_0xd1b1('0x42')]['offset']);}_0xaac376[_0xd1b1('0x49')]=qs[_0xd1b1('0x4a')](_0x58b572[_0xd1b1('0x42')][_0xd1b1('0x4a')]);_0xaac376[_0xd1b1('0x4b')]=qs[_0xd1b1('0x44')](_[_0xd1b1('0x4c')](_0x58b572[_0xd1b1('0x42')],_0x1aebc8[_0xd1b1('0x44')]));_0xaac376[_0xd1b1('0x4b')][_0xd1b1('0x62')]=_0x402d8b['id'];if(_0x58b572['query'][_0xd1b1('0x4d')]){_0xaac376[_0xd1b1('0x4b')]=_[_0xd1b1('0x4e')](_0xaac376[_0xd1b1('0x4b')],{'$or':_[_0xd1b1('0x3c')](_0xaac376[_0xd1b1('0x45')],function(_0x3fb7cd){var _0x6d89e={};_0x6d89e[_0x3fb7cd]={'$like':'%'+_0x58b572[_0xd1b1('0x42')][_0xd1b1('0x4d')]+'%'};return _0x6d89e;})});}_0xaac376=_[_0xd1b1('0x4e')]({},_0xaac376,_0x58b572[_0xd1b1('0x50')]);return db[_0xd1b1('0x126')][_0xd1b1('0x2e')]({'where':_0xaac376['where']})[_0xd1b1('0x20')](function(_0x4ecfb1){_0x33d8c6['count']=_0x4ecfb1;if(_0x58b572[_0xd1b1('0x42')]['includeAll']){_0xaac376[_0xd1b1('0x51')]=[{'all':!![]}];}else{_0xaac376[_0xd1b1('0x51')]=[{'model':db[_0xd1b1('0x8c')],'as':_0xd1b1('0x127'),'required':![]},{'model':db[_0xd1b1('0xe0')],'as':_0xd1b1('0x128'),'required':![]}];}return db['ChatOfflineMessage'][_0xd1b1('0x53')](_0xaac376);})[_0xd1b1('0x20')](function(_0x27aa42){_0x33d8c6['rows']=_0x27aa42;return _0x33d8c6;});}})[_0xd1b1('0x20')](respondWithFilteredResult(_0x9b8968,_0xaac376))[_0xd1b1('0x2a')](handleError(_0x9b8968,null));};exports['addAgents']=function(_0x95e3b8,_0x538d04,_0x3f0ffa){return db[_0xd1b1('0x52')]['find']({'where':{'id':_0x95e3b8[_0xd1b1('0x56')]['id']}})[_0xd1b1('0x20')](handleEntityNotFound(_0x538d04,null))[_0xd1b1('0x20')](function(_0x1b777d){if(_0x1b777d){return _0x1b777d[_0xd1b1('0x129')](_0x95e3b8[_0xd1b1('0x5a')][_0xd1b1('0x68')],_[_0xd1b1('0xf6')](_0x95e3b8['body'],[_0xd1b1('0x68'),'id'])||{})[_0xd1b1('0xbe')](function(_0x125dfd){for(var _0x36dcb9=0x0;_0x36dcb9<_0x95e3b8[_0xd1b1('0x5a')][_0xd1b1('0x68')]['length'];_0x36dcb9+=0x1){socket[_0xd1b1('0x12a')]('userChatWebsite:save',{'UserId':_0x95e3b8['body'][_0xd1b1('0x68')][_0x36dcb9],'ChatWebsiteId':_0x95e3b8['params']['id']});}return _0x125dfd;});}})[_0xd1b1('0x20')](respondWithResult(_0x538d04,null))[_0xd1b1('0x2a')](handleError(_0x538d04,null));};exports[_0xd1b1('0x12b')]=function(_0x5ca31f,_0x126258,_0x305726){return db[_0xd1b1('0x52')][_0xd1b1('0x58')]({'where':{'id':_0x5ca31f[_0xd1b1('0x56')]['id']}})[_0xd1b1('0x20')](handleEntityNotFound(_0x126258,null))[_0xd1b1('0x20')](function(_0x33c5fc){if(_0x33c5fc){return _0x33c5fc['removeAgents'](_0x5ca31f[_0xd1b1('0x42')]['ids'])[_0xd1b1('0x20')](function(){if(_[_0xd1b1('0x12c')](_0x5ca31f[_0xd1b1('0x42')]['ids'])){for(var _0x42f120=0x0;_0x42f120<_0x5ca31f[_0xd1b1('0x42')][_0xd1b1('0x68')][_0xd1b1('0x65')];_0x42f120+=0x1){socket[_0xd1b1('0x12a')]('userChatWebsite:remove',{'UserId':Number(_0x5ca31f['query'][_0xd1b1('0x68')][_0x42f120]),'ChatWebsiteId':Number(_0x5ca31f['params']['id'])});}}else{socket[_0xd1b1('0x12a')](_0xd1b1('0x12d'),{'UserId':Number(_0x5ca31f[_0xd1b1('0x42')][_0xd1b1('0x68')]),'ChatWebsiteId':Number(_0x5ca31f[_0xd1b1('0x56')]['id'])});}});}})[_0xd1b1('0x20')](respondWithStatusCode(_0x126258,null))['catch'](handleError(_0x126258,null));};exports[_0xd1b1('0x12e')]=function(_0x120c89,_0xe5c156,_0xaafcde){var _0x387c78={};var _0x4736d2={};var _0x11d0cc;var _0x3b26bc;return db[_0xd1b1('0x52')][_0xd1b1('0x6a')]({'where':{'id':_0x120c89['params']['id']}})[_0xd1b1('0x20')](handleEntityNotFound(_0xe5c156,null))[_0xd1b1('0x20')](function(_0xfea844){if(_0xfea844){_0x11d0cc=_0xfea844;_0x4736d2[_0xd1b1('0x41')]=_['keys'](db[_0xd1b1('0x12f')][_0xd1b1('0x3d')]);_0x4736d2[_0xd1b1('0x42')]=_[_0xd1b1('0x43')](_0x120c89['query']);_0x4736d2[_0xd1b1('0x44')]=_[_0xd1b1('0x46')](_0x4736d2['model'],_0x4736d2['query']);_0x387c78[_0xd1b1('0x45')]=_[_0xd1b1('0x46')](_0x4736d2[_0xd1b1('0x41')],qs[_0xd1b1('0x47')](_0x120c89[_0xd1b1('0x42')][_0xd1b1('0x47')]));_0x387c78['attributes']=_0x387c78[_0xd1b1('0x45')][_0xd1b1('0x65')]?_0x387c78['attributes']:_0x4736d2['model'];_0x387c78[_0xd1b1('0x49')]=qs[_0xd1b1('0x4a')](_0x120c89[_0xd1b1('0x42')][_0xd1b1('0x4a')]);_0x387c78[_0xd1b1('0x4b')]=qs[_0xd1b1('0x44')](_[_0xd1b1('0x4c')](_0x120c89[_0xd1b1('0x42')],_0x4736d2[_0xd1b1('0x44')]));if(_0x120c89[_0xd1b1('0x42')][_0xd1b1('0x4d')]){_0x387c78[_0xd1b1('0x4b')]=_['merge'](_0x387c78[_0xd1b1('0x4b')],{'$or':_[_0xd1b1('0x3c')](_0x387c78[_0xd1b1('0x45')],function(_0x2148c9){var _0x4b2ee4={};_0x4b2ee4[_0x2148c9]={'$like':'%'+_0x120c89[_0xd1b1('0x42')][_0xd1b1('0x4d')]+'%'};return _0x4b2ee4;})});}_0x387c78=_[_0xd1b1('0x4e')]({},_0x387c78,_0x120c89[_0xd1b1('0x50')]);return _0x11d0cc['getAgents'](_0x387c78);}})[_0xd1b1('0x20')](function(_0x229124){if(_0x229124){_0x3b26bc=_0x229124[_0xd1b1('0x65')];if(!_0x120c89['query'][_0xd1b1('0x48')](_0xd1b1('0x66'))){_0x387c78[_0xd1b1('0x30')]=qs[_0xd1b1('0x30')](_0x120c89[_0xd1b1('0x42')][_0xd1b1('0x30')]);_0x387c78[_0xd1b1('0x2f')]=qs[_0xd1b1('0x2f')](_0x120c89[_0xd1b1('0x42')]['offset']);}return _0x11d0cc[_0xd1b1('0x12e')](_0x387c78);}})[_0xd1b1('0x20')](function(_0x520f16){if(_0x520f16){return _0x520f16?{'count':_0x3b26bc,'rows':_0x520f16}:null;}})[_0xd1b1('0x20')](respondWithResult(_0xe5c156,null))[_0xd1b1('0x2a')](handleError(_0xe5c156,null));}; \ No newline at end of file +var _0xfb21=['map','ChatWebsite','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','find','create','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','describe','ChatWebsiteId','Disposition','getDispositions','findOne','rawAttributes','order','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','sitepic','addAvatar','agentAvatar','file','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','setUA','headers','getResult','chat','CmContact','Sequelize','ValidationError','difference','updatedAt','createdAt','CompanyId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','List','Contacts','Applications','account','applications','list','orderBy','asc','defaults','ListId','customerIp','cf-connecting-ip','x-forwarded-for','first','split','x-real-port','browser','version','format','%s\x20%s','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','contact','firstName','lastName','messageId','created','autoclose','push','close','unmanaged','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','offline','files','email','from\x20is\x20mandatory','Comments','mapKeyOffline','CmList','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','bulkCreate','$promise','MailServerOut','service','host','Smtp','port','secure','authentication','SendMail','sendMail','forwardOfflineAddress','offlineMessageSubject','MailAccountId','Chat','NotifyMailAccount','notifyMail','attachments','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','fullname','internal','Tag','Tags','color','tag','getSnippet','timezone','interval','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','Interval','../../config/license/util','chatLicenseExceeded','Intervals','all','some','server/files/chat/iframe.js','remote','connection','remoteAddress','referer','replace','alignment','color_button','addApplications','sequelize','ChatApplication','findAndCountAll','priority','getApplications','addProactiveActions','getProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','Contact','Attachment','Attachments','rows','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','User','getAgents','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','ChatWebsite,\x20%s,\x20%s','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','save','get','ChatWebsites','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause'];(function(_0x1d9ad5,_0xbb151a){var _0x318aa2=function(_0xd54381){while(--_0xd54381){_0x1d9ad5['push'](_0x1d9ad5['shift']());}};_0x318aa2(++_0xbb151a);}(_0xfb21,0xeb));var _0x1fb2=function(_0x362a1d,_0x5bd04f){_0x362a1d=_0x362a1d-0x0;var _0x53137f=_0xfb21[_0x362a1d];return _0x53137f;};'use strict';var pdf=require(_0x1fb2('0x0'));var emlformat=require(_0x1fb2('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1fb2('0x2'));var rp=require(_0x1fb2('0x3'));var moment=require('moment');var BPromise=require(_0x1fb2('0x4'));var Mustache=require(_0x1fb2('0x5'));var util=require(_0x1fb2('0x6'));var path=require('path');var sox=require(_0x1fb2('0x7'));var csv=require('to-csv');var ejs=require(_0x1fb2('0x8'));var fs=require('fs');var fs_extra=require(_0x1fb2('0x9'));var _=require('lodash');var squel=require(_0x1fb2('0xa'));var crypto=require(_0x1fb2('0xb'));var jsforce=require(_0x1fb2('0xc'));var deskjs=require(_0x1fb2('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1fb2('0xe'));var Papa=require(_0x1fb2('0xf'));var Redis=require('ioredis');var authService=require(_0x1fb2('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1fb2('0x11'))(_0x1fb2('0x12'));var utils=require('../../config/utils');var config=require(_0x1fb2('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x1fb2('0x14'))['db'];config[_0x1fb2('0x15')]=_['defaults'](config[_0x1fb2('0x15')],{'host':_0x1fb2('0x16'),'port':0x18eb});var socket=require(_0x1fb2('0x17'))(new Redis(config[_0x1fb2('0x15')]));require(_0x1fb2('0x18'))['register'](socket);var jayson=require(_0x1fb2('0x19'));var client=jayson[_0x1fb2('0x1a')][_0x1fb2('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0x1fb2('0x1b')]({'port':0x232a});var client9003=jayson[_0x1fb2('0x1a')][_0x1fb2('0x1b')]({'port':0x232b});var client9001=jayson[_0x1fb2('0x1a')]['http']({'port':0x2329});function respondWithRpcPromise(_0x35e5fc,_0x12b7bb,_0x16b683,_0x6a1152){return new BPromise(function(_0xafdb8d,_0x4fd194){var _0x406349=_0x6a1152||client;return _0x406349[_0x1fb2('0x1c')](_0x35e5fc,_0x16b683)[_0x1fb2('0x1d')](function(_0xbd7c14){logger[_0x1fb2('0x1e')]('ChatWebsite,\x20%s,\x20%s',_0x12b7bb,_0x1fb2('0x1f'));logger[_0x1fb2('0x20')](_0x1fb2('0x21'),_0x12b7bb,_0x1fb2('0x1f'),JSON['stringify'](_0xbd7c14));if(_0xbd7c14[_0x1fb2('0x22')]){if(_0xbd7c14[_0x1fb2('0x22')]['code']===0x1f4){logger[_0x1fb2('0x22')]('ChatWebsite,\x20%s,\x20%s',_0x12b7bb,_0xbd7c14[_0x1fb2('0x22')][_0x1fb2('0x23')]);return _0x4fd194(_0xbd7c14['error'][_0x1fb2('0x23')]);}logger[_0x1fb2('0x22')](_0x1fb2('0x24'),_0x12b7bb,_0xbd7c14[_0x1fb2('0x22')][_0x1fb2('0x23')]);return _0xafdb8d(_0xbd7c14['error'][_0x1fb2('0x23')]);}else{logger['info'](_0x1fb2('0x24'),_0x12b7bb,_0x1fb2('0x1f'));_0xafdb8d(_0xbd7c14[_0x1fb2('0x25')][_0x1fb2('0x23')]);}})[_0x1fb2('0x26')](function(_0x1c9df1){logger['error'](_0x1fb2('0x24'),_0x12b7bb,_0x1c9df1);_0x4fd194(_0x1c9df1);});});}function respondWithStatusCode(_0x351dd6,_0x1b9e5c){_0x1b9e5c=_0x1b9e5c||0xcc;return function(_0x464296){if(_0x464296){return _0x351dd6['sendStatus'](_0x1b9e5c);}return _0x351dd6[_0x1fb2('0x27')](_0x1b9e5c)[_0x1fb2('0x28')]();};}function respondWithResult(_0x44b82d,_0x4d7fde){_0x4d7fde=_0x4d7fde||0xc8;return function(_0x33ebdd){if(_0x33ebdd){return _0x44b82d['status'](_0x4d7fde)[_0x1fb2('0x29')](_0x33ebdd);}};}function respondWithFilteredResult(_0x181d9e,_0x34cc13){return function(_0x32f4a2){if(_0x32f4a2){var _0x1c730b=_0x32f4a2[_0x1fb2('0x2a')],_0xc2a70f=_0x34cc13[_0x1fb2('0x2b')],_0xb466ff=_0x34cc13['offset']+_0x34cc13[_0x1fb2('0x2c')],_0x437ac2;if(_0xb466ff>=_0x1c730b){_0xb466ff=_0x1c730b;_0x437ac2=0xc8;}else{_0x437ac2=0xce;}_0x181d9e[_0x1fb2('0x27')](_0x437ac2);return _0x181d9e[_0x1fb2('0x2d')](_0x1fb2('0x2e'),_0xc2a70f+'-'+_0xb466ff+'/'+_0x1c730b)[_0x1fb2('0x29')](_0x32f4a2);}return null;};}function patchUpdates(_0x8a6c11){return function(_0x5251d5){try{jsonpatch[_0x1fb2('0x2f')](_0x5251d5,_0x8a6c11,!![]);}catch(_0x1fb94a){return BPromise['reject'](_0x1fb94a);}return _0x5251d5[_0x1fb2('0x30')]();};}function saveUpdates(_0xb9951f,_0x1cfa51){return function(_0x3f787f){if(_0x3f787f){return _0x3f787f['update'](_0xb9951f)[_0x1fb2('0x1d')](function(_0x5639e0){return _0x5639e0;});}return null;};}function removeEntity(_0x46f533,_0x46bd22){return function(_0x37fad4){if(_0x37fad4){return _0x37fad4['destroy']()[_0x1fb2('0x1d')](function(){var _0x5442c1=_0x37fad4[_0x1fb2('0x31')]({'plain':!![]});var _0x535da7=_0x1fb2('0x32');return db[_0x1fb2('0x33')]['destroy']({'where':{'type':_0x535da7,'resourceId':_0x5442c1['id']}})[_0x1fb2('0x1d')](function(){return _0x37fad4;});})[_0x1fb2('0x1d')](function(){_0x46f533[_0x1fb2('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8c18cf,_0x3131fb){return function(_0x1a6ab8){if(!_0x1a6ab8){_0x8c18cf[_0x1fb2('0x34')](0x194);}return _0x1a6ab8;};}function handleError(_0x4bd31b,_0x46ad62){_0x46ad62=_0x46ad62||0x1f4;return function(_0x334634){logger['error'](_0x334634[_0x1fb2('0x35')]);if(_0x334634[_0x1fb2('0x36')]){delete _0x334634[_0x1fb2('0x36')];}_0x4bd31b[_0x1fb2('0x27')](_0x46ad62)[_0x1fb2('0x37')](_0x334634);};}exports[_0x1fb2('0x38')]=function(_0x268b97,_0x14ec87){var _0xcb8268={'include':[{'model':db[_0x1fb2('0x39')],'as':_0x1fb2('0x3a')}]},_0x4e8029={},_0x45ae98={'count':0x0,'rows':[]};var _0x260558=_[_0x1fb2('0x3b')](db[_0x1fb2('0x3c')]['rawAttributes'],function(_0x1d4ffd){return{'name':_0x1d4ffd[_0x1fb2('0x3d')],'type':_0x1d4ffd[_0x1fb2('0x3e')][_0x1fb2('0x3f')]};});_0x4e8029[_0x1fb2('0x40')]=_['map'](_0x260558,'name');_0x4e8029[_0x1fb2('0x41')]=_[_0x1fb2('0x42')](_0x268b97['query']);_0x4e8029[_0x1fb2('0x43')]=_[_0x1fb2('0x44')](_0x4e8029[_0x1fb2('0x40')],_0x4e8029['query']);_0xcb8268[_0x1fb2('0x45')]=_[_0x1fb2('0x44')](_0x4e8029[_0x1fb2('0x40')],qs[_0x1fb2('0x46')](_0x268b97[_0x1fb2('0x41')][_0x1fb2('0x46')]));_0xcb8268['attributes']=_0xcb8268['attributes'][_0x1fb2('0x47')]?_0xcb8268['attributes']:_0x4e8029['model'];if(!_0x268b97[_0x1fb2('0x41')][_0x1fb2('0x48')](_0x1fb2('0x49'))){_0xcb8268[_0x1fb2('0x2c')]=qs['limit'](_0x268b97['query'][_0x1fb2('0x2c')]);_0xcb8268[_0x1fb2('0x2b')]=qs[_0x1fb2('0x2b')](_0x268b97['query']['offset']);}_0xcb8268['order']=qs[_0x1fb2('0x4a')](_0x268b97[_0x1fb2('0x41')][_0x1fb2('0x4a')]);_0xcb8268[_0x1fb2('0x4b')]=qs[_0x1fb2('0x43')](_[_0x1fb2('0x4c')](_0x268b97[_0x1fb2('0x41')],_0x4e8029['filters']),_0x260558);if(_0x268b97[_0x1fb2('0x41')][_0x1fb2('0x4d')]){_0xcb8268[_0x1fb2('0x4b')]=_[_0x1fb2('0x4e')](_0xcb8268[_0x1fb2('0x4b')],{'$or':_[_0x1fb2('0x3b')](_0x260558,function(_0x5daae4){if(_0x5daae4['type']!=='VIRTUAL'){var _0x300b87={};_0x300b87[_0x5daae4[_0x1fb2('0x36')]]={'$like':'%'+_0x268b97['query']['filter']+'%'};return _0x300b87;}})});}_0xcb8268=_['merge']({},_0xcb8268,_0x268b97[_0x1fb2('0x4f')]);var _0x48635a={'where':_0xcb8268[_0x1fb2('0x4b')]};return db['ChatWebsite'][_0x1fb2('0x2a')](_0x48635a)[_0x1fb2('0x1d')](function(_0x5d5d6e){_0x45ae98[_0x1fb2('0x2a')]=_0x5d5d6e;if(_0x268b97[_0x1fb2('0x41')][_0x1fb2('0x50')]){_0xcb8268[_0x1fb2('0x51')]=[{'all':!![]}];}return db['ChatWebsite'][_0x1fb2('0x52')](_0xcb8268);})[_0x1fb2('0x1d')](function(_0x21189a){_0x45ae98['rows']=_0x21189a;return _0x45ae98;})[_0x1fb2('0x1d')](respondWithFilteredResult(_0x14ec87,_0xcb8268))[_0x1fb2('0x26')](handleError(_0x14ec87,null));};exports[_0x1fb2('0x53')]=function(_0x3e9e95,_0x3f56a5){var _0x1a7b26={'raw':![],'where':{'id':_0x3e9e95[_0x1fb2('0x54')]['id']},'include':[{'model':db[_0x1fb2('0x39')],'as':_0x1fb2('0x3a')}]},_0x3d5577={};_0x3d5577['model']=_[_0x1fb2('0x42')](db['ChatWebsite']['rawAttributes']);_0x3d5577[_0x1fb2('0x41')]=_['keys'](_0x3e9e95[_0x1fb2('0x41')]);_0x3d5577[_0x1fb2('0x43')]=_[_0x1fb2('0x44')](_0x3d5577[_0x1fb2('0x40')],_0x3d5577[_0x1fb2('0x41')]);_0x1a7b26['attributes']=_[_0x1fb2('0x44')](_0x3d5577[_0x1fb2('0x40')],qs[_0x1fb2('0x46')](_0x3e9e95[_0x1fb2('0x41')]['fields']));_0x1a7b26[_0x1fb2('0x45')]=_0x1a7b26[_0x1fb2('0x45')][_0x1fb2('0x47')]?_0x1a7b26[_0x1fb2('0x45')]:_0x3d5577['model'];if(_0x3e9e95[_0x1fb2('0x41')]['includeAll']){_0x1a7b26[_0x1fb2('0x51')]=[{'all':!![]}];}_0x1a7b26=_[_0x1fb2('0x4e')]({},_0x1a7b26,_0x3e9e95[_0x1fb2('0x4f')]);return db[_0x1fb2('0x3c')][_0x1fb2('0x55')](_0x1a7b26)[_0x1fb2('0x1d')](handleEntityNotFound(_0x3f56a5,null))[_0x1fb2('0x1d')](respondWithResult(_0x3f56a5,null))[_0x1fb2('0x26')](handleError(_0x3f56a5,null));};exports['create']=function(_0x26cfea,_0x1b4cfd){return db[_0x1fb2('0x3c')][_0x1fb2('0x56')](_0x26cfea['body'],{})[_0x1fb2('0x1d')](function(_0x4a018f){var _0x25fd97=_0x26cfea[_0x1fb2('0x57')][_0x1fb2('0x31')]({'plain':!![]});if(!_0x25fd97)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25fd97['role']===_0x1fb2('0x57')){var _0x57b83e=_0x4a018f[_0x1fb2('0x31')]({'plain':!![]});var _0x5af7c6=_0x1fb2('0x32');return db[_0x1fb2('0x58')][_0x1fb2('0x55')]({'where':{'name':_0x5af7c6,'userProfileId':_0x25fd97[_0x1fb2('0x59')]},'raw':!![]})[_0x1fb2('0x1d')](function(_0x27841b){if(_0x27841b&&_0x27841b['autoAssociation']===0x0){return db['UserProfileResource'][_0x1fb2('0x56')]({'name':_0x57b83e[_0x1fb2('0x36')],'resourceId':_0x57b83e['id'],'type':_0x27841b[_0x1fb2('0x36')],'sectionId':_0x27841b['id']},{})[_0x1fb2('0x1d')](function(){return _0x4a018f;});}else{return _0x4a018f;}})[_0x1fb2('0x26')](function(_0x4bf417){logger[_0x1fb2('0x22')](_0x1fb2('0x5a'),_0x4bf417);throw _0x4bf417;});}return _0x4a018f;})[_0x1fb2('0x1d')](respondWithResult(_0x1b4cfd,0xc9))[_0x1fb2('0x26')](handleError(_0x1b4cfd,null));};exports[_0x1fb2('0x5b')]=function(_0x1d8239,_0x3b1830){if(_0x1d8239[_0x1fb2('0x5c')]['id']){delete _0x1d8239[_0x1fb2('0x5c')]['id'];}return db[_0x1fb2('0x3c')][_0x1fb2('0x55')]({'where':{'id':_0x1d8239[_0x1fb2('0x54')]['id']},'include':[{'model':db[_0x1fb2('0x39')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x3b1830,null))['then'](saveUpdates(_0x1d8239[_0x1fb2('0x5c')],null))[_0x1fb2('0x1d')](respondWithResult(_0x3b1830,null))[_0x1fb2('0x26')](handleError(_0x3b1830,null));};exports[_0x1fb2('0x5d')]=function(_0x4f02f2,_0x2ef98b){return db[_0x1fb2('0x3c')][_0x1fb2('0x55')]({'where':{'id':_0x4f02f2[_0x1fb2('0x54')]['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x2ef98b,null))[_0x1fb2('0x1d')](removeEntity(_0x2ef98b,null))['catch'](handleError(_0x2ef98b,null));};exports[_0x1fb2('0x5e')]=function(_0x4cd054,_0x4e23cf){return db[_0x1fb2('0x3c')][_0x1fb2('0x5e')]()[_0x1fb2('0x1d')](respondWithResult(_0x4e23cf,null))[_0x1fb2('0x26')](handleError(_0x4e23cf,null));};exports['addDisposition']=function(_0x39389a,_0x5e661a,_0x42e6fb){if(_0x39389a[_0x1fb2('0x5c')]['id']){delete _0x39389a['body']['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x39389a['params']['id']}})['then'](handleEntityNotFound(_0x5e661a,null))['then'](function(_0x2f1a7b){if(_0x2f1a7b){_0x39389a[_0x1fb2('0x5c')][_0x1fb2('0x5f')]=_0x2f1a7b['id'];return db[_0x1fb2('0x60')][_0x1fb2('0x56')](_0x39389a[_0x1fb2('0x5c')]);}})[_0x1fb2('0x1d')](respondWithResult(_0x5e661a,null))['catch'](handleError(_0x5e661a,null));};exports[_0x1fb2('0x61')]=function(_0x587045,_0x3d1229,_0x4790b7){var _0x13822d={'raw':![],'where':{}};var _0x168646={};var _0xdcfdf2={'count':0x0,'rows':[]};return db[_0x1fb2('0x3c')][_0x1fb2('0x62')]({'where':{'id':_0x587045['params']['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x3d1229,null))[_0x1fb2('0x1d')](function(_0x5d6dd2){if(_0x5d6dd2){_0x168646[_0x1fb2('0x40')]=_['keys'](db[_0x1fb2('0x60')][_0x1fb2('0x63')]);_0x168646[_0x1fb2('0x41')]=_[_0x1fb2('0x42')](_0x587045[_0x1fb2('0x41')]);_0x168646[_0x1fb2('0x43')]=_['intersection'](_0x168646[_0x1fb2('0x40')],_0x168646[_0x1fb2('0x41')]);_0x13822d['attributes']=_[_0x1fb2('0x44')](_0x168646['model'],qs[_0x1fb2('0x46')](_0x587045[_0x1fb2('0x41')][_0x1fb2('0x46')]));_0x13822d[_0x1fb2('0x45')]=_0x13822d[_0x1fb2('0x45')][_0x1fb2('0x47')]?_0x13822d[_0x1fb2('0x45')]:_0x168646[_0x1fb2('0x40')];if(!_0x587045['query'][_0x1fb2('0x48')](_0x1fb2('0x49'))){_0x13822d[_0x1fb2('0x2c')]=qs[_0x1fb2('0x2c')](_0x587045[_0x1fb2('0x41')][_0x1fb2('0x2c')]);_0x13822d[_0x1fb2('0x2b')]=qs[_0x1fb2('0x2b')](_0x587045[_0x1fb2('0x41')][_0x1fb2('0x2b')]);}_0x13822d[_0x1fb2('0x64')]=qs[_0x1fb2('0x4a')](_0x587045[_0x1fb2('0x41')]['sort']);_0x13822d[_0x1fb2('0x4b')]=qs[_0x1fb2('0x43')](_['pick'](_0x587045[_0x1fb2('0x41')],_0x168646['filters']));_0x13822d[_0x1fb2('0x4b')][_0x1fb2('0x5f')]=_0x5d6dd2['id'];if(_0x587045[_0x1fb2('0x41')][_0x1fb2('0x4d')]){_0x13822d[_0x1fb2('0x4b')]=_[_0x1fb2('0x4e')](_0x13822d[_0x1fb2('0x4b')],{'$or':_[_0x1fb2('0x3b')](_0x13822d['attributes'],function(_0x4e6fac){var _0x54f9b3={};_0x54f9b3[_0x4e6fac]={'$like':'%'+_0x587045[_0x1fb2('0x41')][_0x1fb2('0x4d')]+'%'};return _0x54f9b3;})});}_0x13822d=_[_0x1fb2('0x4e')]({},_0x13822d,_0x587045[_0x1fb2('0x4f')]);return db[_0x1fb2('0x60')][_0x1fb2('0x2a')]({'where':_0x13822d[_0x1fb2('0x4b')]})['then'](function(_0x303e6f){_0xdcfdf2[_0x1fb2('0x2a')]=_0x303e6f;if(_0x587045[_0x1fb2('0x41')]['includeAll']){_0x13822d[_0x1fb2('0x51')]=[{'all':!![]}];}return db['Disposition'][_0x1fb2('0x52')](_0x13822d);})[_0x1fb2('0x1d')](function(_0x3380e2){_0xdcfdf2['rows']=_0x3380e2;return _0xdcfdf2;});}})[_0x1fb2('0x1d')](respondWithFilteredResult(_0x3d1229,_0x13822d))[_0x1fb2('0x26')](handleError(_0x3d1229,null));};exports['removeDispositions']=function(_0x182fd7,_0x1a2b7d,_0x4b7e23){return db[_0x1fb2('0x3c')]['find']({'where':{'id':_0x182fd7[_0x1fb2('0x54')]['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x1a2b7d,null))[_0x1fb2('0x1d')](function(_0x2cdfd0){if(_0x2cdfd0){return _0x2cdfd0[_0x1fb2('0x65')](_0x182fd7[_0x1fb2('0x41')][_0x1fb2('0x66')]);}})[_0x1fb2('0x1d')](respondWithStatusCode(_0x1a2b7d,null))[_0x1fb2('0x26')](handleError(_0x1a2b7d,null));};exports[_0x1fb2('0x67')]=function(_0x59cf80,_0x1e39ba,_0x4da4aa){if(_0x59cf80[_0x1fb2('0x5c')]['id']){delete _0x59cf80[_0x1fb2('0x5c')]['id'];}return db['ChatWebsite'][_0x1fb2('0x55')]({'where':{'id':_0x59cf80[_0x1fb2('0x54')]['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x1e39ba,null))[_0x1fb2('0x1d')](function(_0x15c1a6){if(_0x15c1a6){_0x59cf80[_0x1fb2('0x5c')]['ChatWebsiteId']=_0x15c1a6['id'];return db['CannedAnswer'][_0x1fb2('0x56')](_0x59cf80['body']);}})[_0x1fb2('0x1d')](respondWithResult(_0x1e39ba,null))[_0x1fb2('0x26')](handleError(_0x1e39ba,null));};exports['getAnswers']=function(_0x17ea86,_0x3059b8,_0x4479f0){var _0x216662={'raw':![],'where':{}};var _0x50148b={};var _0x1baecb={'count':0x0,'rows':[]};return db[_0x1fb2('0x3c')]['findOne']({'where':{'id':_0x17ea86[_0x1fb2('0x54')]['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x3059b8,null))[_0x1fb2('0x1d')](function(_0x5bb4fc){if(_0x5bb4fc){_0x50148b[_0x1fb2('0x40')]=_['keys'](db['CannedAnswer'][_0x1fb2('0x63')]);_0x50148b[_0x1fb2('0x41')]=_[_0x1fb2('0x42')](_0x17ea86[_0x1fb2('0x41')]);_0x50148b[_0x1fb2('0x43')]=_[_0x1fb2('0x44')](_0x50148b[_0x1fb2('0x40')],_0x50148b['query']);_0x216662['attributes']=_[_0x1fb2('0x44')](_0x50148b['model'],qs['fields'](_0x17ea86[_0x1fb2('0x41')][_0x1fb2('0x46')]));_0x216662[_0x1fb2('0x45')]=_0x216662['attributes'][_0x1fb2('0x47')]?_0x216662[_0x1fb2('0x45')]:_0x50148b[_0x1fb2('0x40')];if(!_0x17ea86['query'][_0x1fb2('0x48')]('nolimit')){_0x216662[_0x1fb2('0x2c')]=qs[_0x1fb2('0x2c')](_0x17ea86[_0x1fb2('0x41')][_0x1fb2('0x2c')]);_0x216662[_0x1fb2('0x2b')]=qs[_0x1fb2('0x2b')](_0x17ea86['query'][_0x1fb2('0x2b')]);}_0x216662[_0x1fb2('0x64')]=qs['sort'](_0x17ea86['query'][_0x1fb2('0x4a')]);_0x216662[_0x1fb2('0x4b')]=qs[_0x1fb2('0x43')](_[_0x1fb2('0x4c')](_0x17ea86[_0x1fb2('0x41')],_0x50148b['filters']));_0x216662['where']['ChatWebsiteId']=_0x5bb4fc['id'];if(_0x17ea86[_0x1fb2('0x41')]['filter']){_0x216662['where']=_[_0x1fb2('0x4e')](_0x216662[_0x1fb2('0x4b')],{'$or':_[_0x1fb2('0x3b')](_0x216662[_0x1fb2('0x45')],function(_0x4d8976){var _0x4a3369={};_0x4a3369[_0x4d8976]={'$like':'%'+_0x17ea86[_0x1fb2('0x41')]['filter']+'%'};return _0x4a3369;})});}_0x216662=_['merge']({},_0x216662,_0x17ea86[_0x1fb2('0x4f')]);return db[_0x1fb2('0x68')]['count']({'where':_0x216662[_0x1fb2('0x4b')]})[_0x1fb2('0x1d')](function(_0x1e4bcc){_0x1baecb[_0x1fb2('0x2a')]=_0x1e4bcc;if(_0x17ea86['query'][_0x1fb2('0x50')]){_0x216662['include']=[{'all':!![]}];}return db[_0x1fb2('0x68')][_0x1fb2('0x52')](_0x216662);})[_0x1fb2('0x1d')](function(_0x1e3430){_0x1baecb['rows']=_0x1e3430;return _0x1baecb;});}})[_0x1fb2('0x1d')](respondWithFilteredResult(_0x3059b8,_0x216662))[_0x1fb2('0x26')](handleError(_0x3059b8,null));};exports[_0x1fb2('0x69')]=function(_0x336426,_0x38fe30,_0x5a6df5){return db[_0x1fb2('0x3c')][_0x1fb2('0x55')]({'where':{'id':_0x336426[_0x1fb2('0x54')]['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x38fe30,null))[_0x1fb2('0x1d')](function(_0x155987){if(_0x155987){return _0x155987[_0x1fb2('0x69')](_0x336426[_0x1fb2('0x41')][_0x1fb2('0x66')]);}})['then'](respondWithStatusCode(_0x38fe30,null))[_0x1fb2('0x26')](handleError(_0x38fe30,null));};exports['addLogo']=function(_0x5314c2,_0x4546ce,_0x502163){_0x5314c2[_0x1fb2('0x5c')][_0x1fb2('0x6a')]=_0x5314c2['file']['filename'];return db[_0x1fb2('0x3c')][_0x1fb2('0x55')]({'where':{'id':_0x5314c2['params']['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x4546ce,null))[_0x1fb2('0x1d')](saveUpdates(_0x5314c2[_0x1fb2('0x5c')],null))[_0x1fb2('0x1d')](respondWithResult(_0x4546ce,null))[_0x1fb2('0x26')](handleError(_0x4546ce,null));};exports[_0x1fb2('0x6b')]=function(_0x59136d,_0x3235a7,_0x481d1b){_0x59136d[_0x1fb2('0x5c')][_0x1fb2('0x6c')]=_0x59136d[_0x1fb2('0x6d')][_0x1fb2('0x6e')];return db['ChatWebsite']['find']({'where':{'id':_0x59136d[_0x1fb2('0x54')]['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x3235a7,null))[_0x1fb2('0x1d')](saveUpdates(_0x59136d[_0x1fb2('0x5c')],null))['then'](respondWithResult(_0x3235a7,null))[_0x1fb2('0x26')](handleError(_0x3235a7,null));};exports[_0x1fb2('0x6f')]=function(_0x370690,_0x1d227f,_0xaaf33a){_0x370690[_0x1fb2('0x5c')][_0x1fb2('0x70')]=_0x370690[_0x1fb2('0x6d')][_0x1fb2('0x6e')];return db[_0x1fb2('0x3c')][_0x1fb2('0x55')]({'where':{'id':_0x370690[_0x1fb2('0x54')]['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x1d227f,null))[_0x1fb2('0x1d')](saveUpdates(_0x370690[_0x1fb2('0x5c')],null))['then'](respondWithResult(_0x1d227f,null))['catch'](handleError(_0x1d227f,null));};exports[_0x1fb2('0x71')]=function(_0x2da8c4,_0x41a4c6,_0x2d3df5){_0x2da8c4[_0x1fb2('0x5c')][_0x1fb2('0x72')]=_0x2da8c4[_0x1fb2('0x6d')]['filename'];return db[_0x1fb2('0x3c')][_0x1fb2('0x55')]({'where':{'id':_0x2da8c4[_0x1fb2('0x54')]['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x41a4c6,null))[_0x1fb2('0x1d')](saveUpdates(_0x2da8c4[_0x1fb2('0x5c')],null))['then'](respondWithResult(_0x41a4c6,null))[_0x1fb2('0x26')](handleError(_0x41a4c6,null));};exports['getLogo']=function(_0x55393f,_0x371dd0,_0x59b917){var _0x27318c=path[_0x1fb2('0x73')](config[_0x1fb2('0x74')],_0x1fb2('0x75'));var _0x4aae93={'where':{'id':_0x55393f[_0x1fb2('0x54')]['id']},'attributes':['id',_0x1fb2('0x6a')],'raw':!![]};var _0x2fa8f5=![];return require('../../config/license/util')[_0x1fb2('0x76')]()[_0x1fb2('0x1d')](function(_0x282d81){if(_0x282d81){_0x2fa8f5=_0x282d81[_0x1fb2('0x77')];}})[_0x1fb2('0x1d')](function(){return db['ChatWebsite'][_0x1fb2('0x55')](_0x4aae93);})[_0x1fb2('0x1d')](handleEntityNotFound(_0x371dd0,null))['then'](function(_0x44f4e3){if(_0x44f4e3){if(!_[_0x1fb2('0x78')](_0x44f4e3['sitepic'])){if(fs[_0x1fb2('0x79')](path[_0x1fb2('0x73')](config['root'],_0x1fb2('0x7a'),_0x44f4e3[_0x1fb2('0x6a')]))&&_0x2fa8f5){_0x27318c=path[_0x1fb2('0x73')](config['root'],_0x1fb2('0x7a'),_0x44f4e3[_0x1fb2('0x6a')]);}}return _0x371dd0[_0x1fb2('0x7b')](_0x27318c);}})[_0x1fb2('0x26')](handleError(_0x371dd0,null));};exports[_0x1fb2('0x7c')]=function(_0xc77443,_0x1dcf83,_0x363c67){var _0xb0cf5a=path[_0x1fb2('0x73')](config[_0x1fb2('0x74')],_0x1fb2('0x7d'));var _0x4506a8={'where':{'id':_0xc77443[_0x1fb2('0x54')]['id']},'attributes':['id',_0x1fb2('0x6c')],'raw':!![]};return db[_0x1fb2('0x3c')][_0x1fb2('0x55')](_0x4506a8)[_0x1fb2('0x1d')](handleEntityNotFound(_0x1dcf83,null))[_0x1fb2('0x1d')](function(_0x4d668c){if(_0x4d668c){if(!_['isNil'](_0x4d668c[_0x1fb2('0x6c')])){if(fs[_0x1fb2('0x79')](path[_0x1fb2('0x73')](config[_0x1fb2('0x74')],_0x1fb2('0x7e'),_0x4d668c[_0x1fb2('0x6c')]))){_0xb0cf5a=path[_0x1fb2('0x73')](config[_0x1fb2('0x74')],_0x1fb2('0x7e'),_0x4d668c[_0x1fb2('0x6c')]);}}return _0x1dcf83[_0x1fb2('0x7b')](_0xb0cf5a);}})[_0x1fb2('0x26')](handleError(_0x1dcf83,null));};exports[_0x1fb2('0x7f')]=function(_0x2fd748,_0x5c1434,_0x57b591){var _0x2f1536=path[_0x1fb2('0x73')](config[_0x1fb2('0x74')],_0x1fb2('0x80'));var _0xb38df0={'where':{'id':_0x2fd748[_0x1fb2('0x54')]['id']},'attributes':['id',_0x1fb2('0x70'),_0x1fb2('0x81')],'raw':!![]};return db[_0x1fb2('0x3c')][_0x1fb2('0x55')](_0xb38df0)[_0x1fb2('0x1d')](handleEntityNotFound(_0x5c1434,null))[_0x1fb2('0x1d')](function(_0x261e4e){if(_0x261e4e){if(!_['isNil'](_0x261e4e[_0x1fb2('0x70')])){if(fs[_0x1fb2('0x79')](path[_0x1fb2('0x73')](config[_0x1fb2('0x74')],_0x1fb2('0x7e'),_0x261e4e['customerAvatar']))&&_0x261e4e[_0x1fb2('0x81')]){_0x2f1536=path[_0x1fb2('0x73')](config[_0x1fb2('0x74')],'server/files/images/avatars/',_0x261e4e[_0x1fb2('0x70')]);}}return _0x5c1434[_0x1fb2('0x7b')](_0x2f1536);}})[_0x1fb2('0x26')](handleError(_0x5c1434,null));};exports['getSystemAvatar']=function(_0x499339,_0x525fe3,_0x5e7b2f){var _0x3cb561=path[_0x1fb2('0x73')](config['root'],_0x1fb2('0x82'));var _0xd30334={'where':{'id':_0x499339['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x1fb2('0x3c')][_0x1fb2('0x55')](_0xd30334)[_0x1fb2('0x1d')](handleEntityNotFound(_0x525fe3,null))[_0x1fb2('0x1d')](function(_0x2941d5){if(_0x2941d5){if(!_[_0x1fb2('0x78')](_0x2941d5[_0x1fb2('0x72')])){if(fs[_0x1fb2('0x79')](path[_0x1fb2('0x73')](config[_0x1fb2('0x74')],_0x1fb2('0x7e'),_0x2941d5[_0x1fb2('0x72')]))){_0x3cb561=path[_0x1fb2('0x73')](config[_0x1fb2('0x74')],_0x1fb2('0x7e'),_0x2941d5['systemAvatar']);}}return _0x525fe3[_0x1fb2('0x7b')](_0x3cb561);}})[_0x1fb2('0x26')](handleError(_0x525fe3,null));};exports[_0x1fb2('0x83')]=function(_0x164826,_0x3fa432,_0x43431a){var _0x5adddc=require('user-agent-parser');var _0x332017=new _0x5adddc();var _0x59ffe4=_0x332017[_0x1fb2('0x84')](_0x164826[_0x1fb2('0x85')]['user-agent'])[_0x1fb2('0x86')]();var _0x514026={'body':_0x164826[_0x1fb2('0x5c')],'channel':_0x1fb2('0x87')};var _0xe5daac=[];var _0x21c818=[];var _0x1c7138={};var _0x30d14d=![];return db[_0x1fb2('0x88')][_0x1fb2('0x5e')]()[_0x1fb2('0x1d')](function(_0xa38a92){if(!_0xa38a92){throw new db[(_0x1fb2('0x89'))][(_0x1fb2('0x8a'))]('no\x20available\x20attributes');}_0xe5daac=_[_0x1fb2('0x8b')](_['keys'](_0xa38a92),['createdAt',_0x1fb2('0x8c')]);_0x21c818=_[_0x1fb2('0x8b')](_[_0x1fb2('0x42')](_0xa38a92),[_0x1fb2('0x8d'),_0x1fb2('0x8c'),_0x1fb2('0x8e'),'ListId']);if(_0x164826[_0x1fb2('0x5c')]['id']){delete _0x164826[_0x1fb2('0x5c')]['id'];}if(_['isNil'](_0x164826[_0x1fb2('0x5c')][_0x1fb2('0x8f')])){throw new db['Sequelize'][(_0x1fb2('0x8a'))]('from\x20is\x20mandatory');}if(_[_0x1fb2('0x78')](_0x164826[_0x1fb2('0x5c')][_0x1fb2('0x5c')])||_0x164826['body']['body']===''){throw new db[(_0x1fb2('0x89'))][(_0x1fb2('0x8a'))](_0x1fb2('0x90'));}if(_[_0x1fb2('0x78')](_0x164826[_0x1fb2('0x5c')][_0x1fb2('0x91')])){throw new db['Sequelize'][(_0x1fb2('0x8a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x21c818);}if(!_[_0x1fb2('0x92')](_0x21c818,_0x164826['body'][_0x1fb2('0x91')])){throw new db[(_0x1fb2('0x89'))][(_0x1fb2('0x8a'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x21c818);}_0x1c7138[_0x164826[_0x1fb2('0x5c')][_0x1fb2('0x91')]]=_0x164826[_0x1fb2('0x5c')][_0x1fb2('0x8f')];})[_0x1fb2('0x1d')](function(){return db['ChatWebsite'][_0x1fb2('0x55')]({'where':{'id':_0x164826[_0x1fb2('0x54')]['id']},'include':[{'model':db['CmList'],'as':_0x1fb2('0x93'),'include':[{'model':db[_0x1fb2('0x88')],'as':_0x1fb2('0x94'),'where':_0x1c7138,'limit':0x1,'order':[[_0x1fb2('0x8c'),'DESC']]}]},{'model':db['ChatApplication'],'as':_0x1fb2('0x95')}]});})[_0x1fb2('0x1d')](handleEntityNotFound(_0x3fa432,null))[_0x1fb2('0x1d')](function(_0x2eb6c1){if(_0x2eb6c1&&_0x2eb6c1[_0x1fb2('0x93')]){_0x514026[_0x1fb2('0x96')]=_0x2eb6c1;_0x514026[_0x1fb2('0x97')]=_0x2eb6c1[_0x1fb2('0x95')];_0x514026[_0x1fb2('0x98')]=_0x2eb6c1[_0x1fb2('0x93')];_0x514026[_0x1fb2('0x97')]=_[_0x1fb2('0x99')](_0x514026[_0x1fb2('0x97')],['priority'],[_0x1fb2('0x9a')]);if(_0x514026[_0x1fb2('0x96')][_0x1fb2('0x95')]){delete _0x514026[_0x1fb2('0x96')]['Applications'];}if(_0x514026['account'][_0x1fb2('0x93')]&&_0x514026[_0x1fb2('0x96')]['List'][_0x1fb2('0x94')][_0x1fb2('0x47')]){return _0x514026[_0x1fb2('0x96')][_0x1fb2('0x93')]['Contacts'][0x0];}var _0x326fa7=_[_0x1fb2('0x9b')](_0x164826[_0x1fb2('0x5c')],{'firstName':_0x164826['body']['from'],'ListId':_0x2eb6c1[_0x1fb2('0x9c')]});_0x326fa7[_0x164826[_0x1fb2('0x5c')][_0x1fb2('0x91')]]=_0x164826[_0x1fb2('0x5c')]['from'];return db[_0x1fb2('0x88')][_0x1fb2('0x56')](_0x326fa7,{'fields':_0xe5daac,'raw':!![]});}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x3fa432,null))[_0x1fb2('0x1d')](function(_0x20e482){_0x514026['contact']=_0x20e482;var _0x5811f6=_0x164826[_0x1fb2('0x5c')][_0x1fb2('0x9d')];if(_0x164826[_0x1fb2('0x85')][_0x1fb2('0x9e')]){_0x5811f6=_0x164826[_0x1fb2('0x85')][_0x1fb2('0x9e')];}else if(_0x164826['headers'][_0x1fb2('0x9f')]){_0x5811f6=_[_0x1fb2('0xa0')](_0x164826[_0x1fb2('0x85')]['x-forwarded-for'][_0x1fb2('0xa1')](','));}if(_0x20e482){var _0x29d2c3={'ContactId':_0x20e482['id'],'ChatWebsiteId':_0x164826[_0x1fb2('0x54')]['id'],'from':(_0x20e482['firstName']||'')+'\x20'+(_0x20e482['lastName']||''),'customerIp':_0x5811f6,'customerPort':_0x164826['headers'][_0x1fb2('0xa2')]?_0x164826[_0x1fb2('0x85')][_0x1fb2('0xa2')]:null,'referer':_0x164826[_0x1fb2('0x5c')]['referer'],'browserName':_0x59ffe4[_0x1fb2('0xa3')][_0x1fb2('0x36')]&&_0x59ffe4[_0x1fb2('0xa3')][_0x1fb2('0xa4')]?util[_0x1fb2('0xa5')](_0x1fb2('0xa6'),_0x59ffe4[_0x1fb2('0xa3')][_0x1fb2('0x36')],_0x59ffe4[_0x1fb2('0xa3')]['version']):'unknown','browserVersion':_0x59ffe4[_0x1fb2('0xa3')][_0x1fb2('0xa4')]||'unknown','osName':util[_0x1fb2('0xa5')]('%s\x20%s',_0x59ffe4['os'][_0x1fb2('0x36')],_0x59ffe4['os'][_0x1fb2('0xa4')]),'osVersion':_0x59ffe4['os'][_0x1fb2('0xa4')],'deviceModel':_0x59ffe4[_0x1fb2('0xa7')][_0x1fb2('0x40')]&&_0x59ffe4[_0x1fb2('0xa7')][_0x1fb2('0xa8')]?util[_0x1fb2('0xa5')](_0x1fb2('0xa9'),_0x59ffe4['device'][_0x1fb2('0x40')],_0x59ffe4[_0x1fb2('0xa7')][_0x1fb2('0xa8')],_0x59ffe4[_0x1fb2('0xa7')][_0x1fb2('0x3e')]):null,'deviceVendor':_0x59ffe4['device'][_0x1fb2('0xa8')],'deviceType':_0x59ffe4[_0x1fb2('0xa7')][_0x1fb2('0x3e')],'formData':JSON[_0x1fb2('0xaa')](_0x164826[_0x1fb2('0x5c')])};var _0x2c6a2e={'ChatWebsiteId':_0x164826[_0x1fb2('0x54')]['id'],'closed':![]};if(_0x164826[_0x1fb2('0x5c')][_0x1fb2('0xab')]){_0x2c6a2e[_0x1fb2('0xab')]=_0x164826[_0x1fb2('0x5c')]['threadId'];return db[_0x1fb2('0xac')][_0x1fb2('0x55')]({'where':_0x2c6a2e})[_0x1fb2('0x1d')](function(_0x44db34){if(_0x44db34){return[_0x44db34,![]];}_0x29d2c3[_0x1fb2('0xab')]=_0x164826[_0x1fb2('0x5c')][_0x1fb2('0xab')];_0x29d2c3[_0x1fb2('0xad')]=_0x164826['body']['externalUrl'];return db[_0x1fb2('0xac')]['create'](_0x29d2c3)['then'](function(_0x3ceb47){return[_0x3ceb47,!![]];});});}_0x2c6a2e[_0x1fb2('0xae')]=_0x20e482['id'];if(_0x164826[_0x1fb2('0x5c')][_0x1fb2('0xaf')]&&_0x164826['body'][_0x1fb2('0xaf')]['id']){_0x2c6a2e['id']=_0x164826[_0x1fb2('0x5c')][_0x1fb2('0xaf')]['id'];return db[_0x1fb2('0xac')]['find']({'where':_0x2c6a2e})['then'](function(_0x4c2a9d){if(_0x4c2a9d){return[_0x4c2a9d,![]];}return db[_0x1fb2('0xac')]['create'](_0x29d2c3)[_0x1fb2('0x1d')](function(_0x4e008f){return[_0x4e008f,!![]];});});}return db[_0x1fb2('0xac')]['create'](_0x29d2c3)[_0x1fb2('0x1d')](function(_0x32cd21){return[_0x32cd21,!![]];});}})[_0x1fb2('0xb0')](function(_0x3dd789,_0x13a872){if(_0x3dd789){_0x30d14d=_0x13a872;if(!_0x13a872){var _0x526f41={'from':(_0x514026[_0x1fb2('0xb1')][_0x1fb2('0xb2')]||'')+'\x20'+(_0x514026[_0x1fb2('0xb1')][_0x1fb2('0xb3')]||'')};if(_0x164826[_0x1fb2('0x5c')][_0x1fb2('0xab')]&&_0x164826[_0x1fb2('0x5c')][_0x1fb2('0xb4')]&&_0x164826[_0x1fb2('0x5c')][_0x1fb2('0xab')]!=_0x164826[_0x1fb2('0x5c')][_0x1fb2('0xb4')]){_0x526f41[_0x1fb2('0xab')]=_0x164826[_0x1fb2('0x5c')]['messageId'];}return _0x3dd789[_0x1fb2('0x5b')](_0x526f41);}else{return _0x3dd789;}}})[_0x1fb2('0x1d')](function(_0x3f36ee){_0x514026[_0x1fb2('0xaf')]=_0x3f36ee[_0x1fb2('0x31')]({'plain':!![]});_0x514026[_0x1fb2('0xaf')]['created']=_0x30d14d;if(_0x514026[_0x1fb2('0xaf')][_0x1fb2('0xb5')]){if(_0x514026['account'][_0x1fb2('0xb6')]){_0x514026['applications'][_0x1fb2('0xb7')]({'id':0x0,'priority':_0x514026[_0x1fb2('0x97')][_0x1fb2('0x47')]+0x1,'app':_0x1fb2('0xb8'),'appdata':_0x1fb2('0xb9'),'interval':'*,*,*,*'});}}return db[_0x1fb2('0xba')][_0x1fb2('0x56')]({'body':_0x164826[_0x1fb2('0x5c')][_0x1fb2('0x5c')],'ChatWebsiteId':_0x164826[_0x1fb2('0x54')]['id'],'ChatInteractionId':_0x3f36ee['id'],'direction':'in','ContactId':_0x514026[_0x1fb2('0xb1')]['id'],'AttachmentId':_0x164826[_0x1fb2('0x5c')][_0x1fb2('0xbb')]});})[_0x1fb2('0x1d')](function(_0x6c3006){_0x514026[_0x1fb2('0x23')]=_0x6c3006;if(_0x514026[_0x1fb2('0xaf')]['UserId']){return db['User'][_0x1fb2('0x55')]({'attributes':['id',_0x1fb2('0x36')],'where':{'id':_0x514026[_0x1fb2('0xaf')][_0x1fb2('0xbc')]}})[_0x1fb2('0x1d')](function(_0x1e5216){if(_0x1e5216){_0x514026[_0x1fb2('0x97')][_0x1fb2('0xbd')]({'id':0x0,'priority':0x0,'app':_0x1fb2('0xbe'),'appdata':_0x1e5216[_0x1fb2('0x36')]+','+(_0x514026[_0x1fb2('0x96')][_0x1fb2('0xbf')]||0xa),'interval':_0x1fb2('0xc0')});_0x514026[_0x1fb2('0xc1')]=!![];}return respondWithRpcPromise(_0x1fb2('0xc2'),_0x1fb2('0xc3'),_0x514026);});}return respondWithRpcPromise('Start',_0x1fb2('0xc3'),_0x514026);})[_0x1fb2('0x1d')](function(_0x3f4a87){respondWithRpcPromise(_0x1fb2('0xc4'),_0x1fb2('0xc4'),{'event':_0x1fb2('0x83'),'message':_0x3f4a87},client9002);return _0x3f4a87;})[_0x1fb2('0x1d')](respondWithResult(_0x3fa432,null))[_0x1fb2('0x26')](handleError(_0x3fa432,null));};exports[_0x1fb2('0xc5')]=function(_0x5424ea,_0x56401e,_0x2f3276){var _0x4f8082,_0x14a439,_0x430e7c;var _0x106898=[];var _0x34b234=[];var _0x348c70={};var _0x18bf7c=_0x5424ea[_0x1fb2('0xc6')]||[];return db[_0x1fb2('0x88')][_0x1fb2('0x5e')]()[_0x1fb2('0x1d')](function(_0x3ed7c8){if(!_0x3ed7c8){throw new db[(_0x1fb2('0x89'))][(_0x1fb2('0x8a'))]('no\x20available\x20attributes');}_0x34b234=_['difference'](_['keys'](_0x3ed7c8),[_0x1fb2('0x8d'),_0x1fb2('0x8c')]);_0x106898=_[_0x1fb2('0x8b')](_[_0x1fb2('0x42')](_0x3ed7c8),[_0x1fb2('0x8d'),'updatedAt',_0x1fb2('0x8e'),_0x1fb2('0x9c')]);if(_0x5424ea[_0x1fb2('0x5c')]['id']){delete _0x5424ea['body']['id'];}if(_['isNil'](_0x5424ea['body'][_0x1fb2('0x8f')])||_[_0x1fb2('0x78')](_0x5424ea['body'][_0x1fb2('0x5c')][_0x1fb2('0xc7')])){throw _0x56401e[_0x1fb2('0x27')](0x1f4)[_0x1fb2('0x37')](new db[(_0x1fb2('0x89'))][(_0x1fb2('0x8a'))](_0x1fb2('0xc8')));}if(_['isNil'](_0x5424ea[_0x1fb2('0x5c')]['body'])||_0x5424ea[_0x1fb2('0x5c')]['body']===''||(_['isNil'](_0x5424ea[_0x1fb2('0x5c')][_0x1fb2('0x5c')][_0x1fb2('0xc9')])||_0x5424ea[_0x1fb2('0x5c')][_0x1fb2('0x5c')][_0x1fb2('0xc9')]==='')){throw _0x56401e[_0x1fb2('0x27')](0x1f4)[_0x1fb2('0x37')](new db[(_0x1fb2('0x89'))][(_0x1fb2('0x8a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x1fb2('0x78')](_0x5424ea[_0x1fb2('0x5c')][_0x1fb2('0xca')])){throw _0x56401e[_0x1fb2('0x27')](0x1f4)[_0x1fb2('0x37')](new db['Sequelize'][(_0x1fb2('0x8a'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x106898));}if(!_[_0x1fb2('0x92')](_0x106898,_0x5424ea[_0x1fb2('0x5c')]['mapKeyOffline'])){throw _0x56401e[_0x1fb2('0x27')](0x1f4)[_0x1fb2('0x37')](new db[(_0x1fb2('0x89'))][(_0x1fb2('0x8a'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x106898));}_0x348c70[_0x5424ea[_0x1fb2('0x5c')][_0x1fb2('0xca')]]=_0x5424ea['body'][_0x1fb2('0x8f')];})['then'](function(){return db[_0x1fb2('0x3c')][_0x1fb2('0x55')]({'where':{'id':_0x5424ea[_0x1fb2('0x54')]['id']},'include':[{'model':db[_0x1fb2('0xcb')],'as':_0x1fb2('0x93')},{'model':db['MailAccount'],'as':_0x1fb2('0xcc')}]});})[_0x1fb2('0x1d')](handleEntityNotFound(_0x56401e,null))[_0x1fb2('0x1d')](function(_0x31fa41){if(_0x31fa41&&_0x31fa41[_0x1fb2('0x93')]){_0x14a439=_0x31fa41;var _0x3c51d1=_['defaults'](_0x5424ea['body'],{'firstName':_0x5424ea[_0x1fb2('0x5c')][_0x1fb2('0x8f')],'phone':_0x5424ea['body'][_0x1fb2('0x8f')],'ListId':_0x31fa41[_0x1fb2('0x9c')]});_0x3c51d1[_0x5424ea['body']['mapKeyOffline']]=_0x5424ea[_0x1fb2('0x5c')][_0x1fb2('0x8f')];return db[_0x1fb2('0x88')][_0x1fb2('0xcd')]({'where':_0x348c70,'defaults':_0x3c51d1});}})[_0x1fb2('0xb0')](function(_0x1b4bde){if(_0x1b4bde){_0x430e7c=_0x1b4bde;var _0x3fed69=fs[_0x1fb2('0xce')](path[_0x1fb2('0x73')](config['root'],_0x1fb2('0xcf')),_0x1fb2('0xd0'));var _0x2b29a1=ejs[_0x1fb2('0xd1')](_0x3fed69,{'body':_[_0x1fb2('0xd2')](_0x5424ea[_0x1fb2('0x5c')][_0x1fb2('0x5c')]),'bodyTitle':_0x14a439[_0x1fb2('0xd3')]});return db[_0x1fb2('0xd4')][_0x1fb2('0x56')]({'body':_0x2b29a1,'ContactId':_0x1b4bde['id'],'ChatWebsiteId':_0x14a439['id']});}})['then'](function(_0x56120d){if(!_[_0x1fb2('0x78')](_0x5424ea[_0x1fb2('0xc6')])){var _0x4c190d=_0x18bf7c['map'](function(_0xb283d5){return{'name':_0xb283d5[_0x1fb2('0xd5')],'basename':_0xb283d5['filename'],'type':_0xb283d5[_0x1fb2('0xd6')],'ChatOfflineMessageId':_0x56120d['id']};});db['Attachment'][_0x1fb2('0xd7')](_0x4c190d)[_0x1fb2('0xd8')];}return _0x56120d;})[_0x1fb2('0x1d')](function(_0x2903be){if(_0x2903be){_0x4f8082=_0x2903be;return db[_0x1fb2('0xcc')][_0x1fb2('0x62')]({'where':{'service':!![]},'include':[{'model':db[_0x1fb2('0xd9')],'as':'Smtp','raw':!![]}]});}})[_0x1fb2('0x1d')](function(_0x2aa924){if(_0x2aa924&&_0x2aa924['Smtp']&&_0x14a439['forwardOffline']&&_0x14a439['forwardOfflineAddress']){var _0x38ee9d={'tls':{'rejectUnauthorized':![]}};if(_0x2aa924['Smtp'][_0x1fb2('0xda')]){_0x38ee9d['service']=_0x2aa924['Smtp']['service'];}else{_0x38ee9d[_0x1fb2('0xdb')]=_0x2aa924[_0x1fb2('0xdc')]['host'];_0x38ee9d[_0x1fb2('0xdd')]=_0x2aa924['Smtp']['port'];_0x38ee9d[_0x1fb2('0xde')]=_0x2aa924[_0x1fb2('0xdc')]['secure'];}if(_0x2aa924[_0x1fb2('0xdc')][_0x1fb2('0xdf')]){_0x38ee9d['auth']={'user':_0x2aa924[_0x1fb2('0xdc')]['user'],'pass':_0x2aa924[_0x1fb2('0xdc')]['pass']};}return respondWithRpcPromise(_0x1fb2('0xe0'),_0x1fb2('0xe1'),{'account':_0x38ee9d,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x2aa924[_0x1fb2('0x36')],_0x2aa924[_0x1fb2('0xc7')]||_0x2aa924[_0x1fb2('0xdc')][_0x1fb2('0x57')]),'to':_0x14a439[_0x1fb2('0xe2')],'subject':_0x14a439[_0x1fb2('0xe3')],'text':_0x4f8082[_0x1fb2('0x5c')],'attachments':!_[_0x1fb2('0x78')](_0x5424ea[_0x1fb2('0xc6')])?_0x18bf7c:[]}},client9003)[_0x1fb2('0x1d')](function(){return _0x4f8082;})[_0x1fb2('0x26')](function(_0x2a8552){console[_0x1fb2('0x22')](_0x2a8552);});}})[_0x1fb2('0x1d')](function(){if(_0x14a439&&_0x14a439['openNewInteraction']&&_0x14a439[_0x1fb2('0xe4')]){var _0x49f366={'from':_0x430e7c['email'],'firstName':_0x430e7c[_0x1fb2('0xb2')],'lastName':_0x430e7c[_0x1fb2('0xb3')],'mapKey':_0x1fb2('0xc7'),'message':{'from':_0x430e7c['email'],'to':_0x14a439[_0x1fb2('0xcc')][_0x1fb2('0xc7')],'cc':'','subject':_0x14a439[_0x1fb2('0xe3')],'messageId':'','sentAt':new Date(),'attach':!_[_0x1fb2('0x78')](_0x5424ea[_0x1fb2('0xc6')]),'attachments':!_['isNil'](_0x5424ea[_0x1fb2('0xc6')])?_0x18bf7c:[],'originChannel':_0x1fb2('0xe5'),'ChatWebsiteId':_0x14a439['id'],'ChatOfflineMessageId':_0x4f8082['id'],'originTo':_0x14a439[_0x1fb2('0xcc')][_0x1fb2('0xc7')]},'body':_0x4f8082[_0x1fb2('0x5c')]};var _0x418b1e={'account':{'id':_0x14a439['MailAccountId']},'body':_0x49f366,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x1fb2('0xe6'),_0x1fb2('0xe7'),_0x418b1e,client9001)['then'](function(){return _0x4f8082;})[_0x1fb2('0x26')](function(_0x3b5e31){console[_0x1fb2('0x22')](_0x3b5e31);});}return;})[_0x1fb2('0x1d')](function(){if(_0x4f8082){return _0x4f8082;}})[_0x1fb2('0x1d')](respondWithResult(_0x56401e,null))[_0x1fb2('0x26')](function(_0x38664c){console[_0x1fb2('0x22')]('catch',_0x38664c);for(var _0x30a070 of _0x18bf7c){var _0x11c684=path[_0x1fb2('0x73')](config['root'],_0x1fb2('0xc6'),_0x1fb2('0xe8'),_0x1fb2('0xe9'),_0x30a070['filename']);fs_extra[_0x1fb2('0xea')](_0x11c684)[_0x1fb2('0x26')](function(_0x2cfbfe){console[_0x1fb2('0x22')](_0x1fb2('0xeb'),_0x11c684,_0x2cfbfe);});}});};exports[_0x1fb2('0xec')]=function(_0x5906d6,_0x256500,_0x33e809){return db['ChatInteraction'][_0x1fb2('0x55')]({'where':{'id':_0x5906d6[_0x1fb2('0x54')]['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x256500,null))[_0x1fb2('0x1d')](function(_0x3709dc){if(_0x3709dc){return _0x3709dc[_0x1fb2('0xec')](_0x5906d6[_0x1fb2('0x5c')][_0x1fb2('0x66')],_[_0x1fb2('0xed')](_0x5906d6[_0x1fb2('0x5c')],[_0x1fb2('0x66'),'id'])||{});}})[_0x1fb2('0x1d')](respondWithResult(_0x256500,null))['catch'](handleError(_0x256500,null));};exports['getInteractions']=function(_0x16ba05,_0x4cc19d,_0xd9672d){var _0x45dd45={'raw':![],'where':{}};var _0x3826a9={};var _0x4e828d={'count':0x0,'rows':[]};return db[_0x1fb2('0x3c')][_0x1fb2('0x62')]({'where':{'id':_0x16ba05['params']['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x4cc19d,null))[_0x1fb2('0x1d')](function(_0x6d7ef2){if(_0x6d7ef2){_0x3826a9[_0x1fb2('0x40')]=_[_0x1fb2('0x42')](db['ChatInteraction'][_0x1fb2('0x63')]);_0x3826a9['query']=_[_0x1fb2('0x42')](_0x16ba05['query']);_0x3826a9['filters']=_[_0x1fb2('0x44')](_0x3826a9[_0x1fb2('0x40')],_0x3826a9[_0x1fb2('0x41')]);_0x45dd45['attributes']=_[_0x1fb2('0x44')](_0x3826a9['model'],qs[_0x1fb2('0x46')](_0x16ba05[_0x1fb2('0x41')][_0x1fb2('0x46')]));_0x45dd45[_0x1fb2('0x45')]=_0x45dd45[_0x1fb2('0x45')][_0x1fb2('0x47')]?_0x45dd45[_0x1fb2('0x45')]:_0x3826a9[_0x1fb2('0x40')];if(!_0x16ba05[_0x1fb2('0x41')][_0x1fb2('0x48')](_0x1fb2('0x49'))){_0x45dd45[_0x1fb2('0x2c')]=qs['limit'](_0x16ba05[_0x1fb2('0x41')][_0x1fb2('0x2c')]);_0x45dd45[_0x1fb2('0x2b')]=qs[_0x1fb2('0x2b')](_0x16ba05[_0x1fb2('0x41')]['offset']);}_0x45dd45[_0x1fb2('0x64')]=qs[_0x1fb2('0x4a')](_0x16ba05[_0x1fb2('0x41')][_0x1fb2('0x4a')]);_0x45dd45[_0x1fb2('0x4b')]=qs[_0x1fb2('0x43')](_[_0x1fb2('0x4c')](_0x16ba05[_0x1fb2('0x41')],_0x3826a9[_0x1fb2('0x43')]));_0x45dd45['where']['ChatWebsiteId']=_0x6d7ef2['id'];if(_0x16ba05[_0x1fb2('0x41')][_0x1fb2('0x4d')]){_0x45dd45[_0x1fb2('0x4b')]=_[_0x1fb2('0x4e')](_0x45dd45[_0x1fb2('0x4b')],{'$or':_[_0x1fb2('0x3b')](_0x45dd45['attributes'],function(_0x1f2cab){var _0x30ef2e={};_0x30ef2e[_0x1f2cab]={'$like':'%'+_0x16ba05[_0x1fb2('0x41')]['filter']+'%'};return _0x30ef2e;})});}_0x45dd45=_[_0x1fb2('0x4e')]({},_0x45dd45,_0x16ba05['options']);return db['ChatInteraction'][_0x1fb2('0x2a')]({'where':_0x45dd45[_0x1fb2('0x4b')]})['then'](function(_0x5493fb){_0x4e828d[_0x1fb2('0x2a')]=_0x5493fb;if(_0x16ba05['query'][_0x1fb2('0x50')]){_0x45dd45['include']=[{'model':db[_0x1fb2('0x88')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x1fb2('0x36'),_0x1fb2('0xee'),_0x1fb2('0xef')],'required':![]},{'model':db[_0x1fb2('0xf0')],'as':_0x1fb2('0xf1'),'attributes':['id','name',_0x1fb2('0xf2')],'where':_0x16ba05['query'][_0x1fb2('0xf3')]?{'id':_0x16ba05[_0x1fb2('0x41')][_0x1fb2('0xf3')]}:undefined,'required':_0x16ba05[_0x1fb2('0x41')][_0x1fb2('0xf3')]?!![]:![]}];}return db[_0x1fb2('0xac')][_0x1fb2('0x52')](_0x45dd45);})[_0x1fb2('0x1d')](function(_0x9cee5c){_0x4e828d['rows']=_0x9cee5c;return _0x4e828d;});}})[_0x1fb2('0x1d')](respondWithFilteredResult(_0x4cc19d,_0x45dd45))[_0x1fb2('0x26')](handleError(_0x4cc19d,null));};function iftimePromise(_0x774cb5,_0x11f3d2){return respondWithRpcPromise('Command',_0x1fb2('0xf4'),{'command':_0x11f3d2[_0x1fb2('0xf5')]?util['format']('iftime\x20%s,%s',_0x774cb5[_0x1fb2('0xf6')],_0x11f3d2[_0x1fb2('0xf5')]):util[_0x1fb2('0xa5')](_0x1fb2('0xf7'),_0x774cb5['interval'])},client9002)['then'](function(_0x2c1401){var _0x14490e=_0x2c1401&&_0x2c1401['indexOf'](_0x1fb2('0xf8'))>=0x0?!![]:![];logger[_0x1fb2('0x1e')](_0x1fb2('0xf9'),_0x11f3d2['id'],_0x774cb5['id'],_0x774cb5['interval'],_0x14490e?_0x1fb2('0xfa'):'OFFLINE',_0x11f3d2[_0x1fb2('0xf5')]?_0x11f3d2['timezone']:_0x1fb2('0xfb'));return _0x14490e;})['catch'](function(_0x4c41eb){logger['error']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x11f3d2['id'],_0x774cb5['id'],_0x774cb5[_0x1fb2('0xf6')],util['inspect'](_0x4c41eb,{'showHidden':![],'depth':null}),_0x11f3d2['timezone']?_0x11f3d2['timezone']:_0x1fb2('0xfb'));return![];});}exports[_0x1fb2('0xf4')]=function(_0x4427f3,_0x51c20c,_0x5e52d4){var _0x453bc1=0x0;var _0x47cc31=0x0;var _0x40ce22=![];var _0x2a4fe5;var _0x27994c;return db[_0x1fb2('0x3c')][_0x1fb2('0x55')]({'where':{'id':_0x4427f3[_0x1fb2('0x54')]['id']},'include':[{'model':db['Interval'],'as':_0x1fb2('0xfc'),'include':[{'model':db[_0x1fb2('0xfc')],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})[_0x1fb2('0x1d')](handleEntityNotFound(_0x51c20c,null))[_0x1fb2('0x1d')](function(_0x4147c8){if(_0x4147c8){_0x2a4fe5=_0x4147c8;return _0x4147c8['getProactiveActions']({'raw':!![]});}})[_0x1fb2('0x1d')](function(_0x5f4bfb){if(_0x2a4fe5){if(_0x5f4bfb){_0x27994c=_0x5f4bfb;}}return require(_0x1fb2('0xfd'))['getLicense']();})[_0x1fb2('0x1d')](function(_0x4116f9){if(_0x4116f9){_0x47cc31=_0x4116f9['virtual'];_0x40ce22=_0x4116f9[_0x1fb2('0x77')];}})[_0x1fb2('0x1d')](function(){return db[_0x1fb2('0xac')][_0x1fb2('0x2a')]({'where':{'closed':![]}});})[_0x1fb2('0x1d')](function(_0x364b2d){_0x453bc1=_0x364b2d;if(_0x47cc31&&_0x364b2d>_0x47cc31){return db['License'][_0x1fb2('0x62')]({'where':{'id':0x1}})[_0x1fb2('0x1d')](function(_0x196129){if(_0x196129){_0x196129['increment'](_0x1fb2('0xfe'));}});}})[_0x1fb2('0x1d')](function(){if(_0x2a4fe5[_0x1fb2('0xfc')]&&_0x2a4fe5[_0x1fb2('0xfc')][_0x1fb2('0xff')]){var _0x150069=[];for(var _0xaae17b=0x0;_0xaae17b<_0x2a4fe5[_0x1fb2('0xfc')][_0x1fb2('0xff')]['length'];_0xaae17b++){var _0x4e8bb1=_0x2a4fe5[_0x1fb2('0xfc')][_0x1fb2('0xff')][_0xaae17b][_0x1fb2('0x31')]({'plain':!![]});_0x150069['push'](iftimePromise(_0x4e8bb1,_0x2a4fe5));}return BPromise[_0x1fb2('0x100')](_0x150069)[_0x1fb2('0x1d')](function(_0x41e1a2){return _[_0x1fb2('0x101')](_0x41e1a2);});}else{return!![];}})[_0x1fb2('0x1d')](function(_0x3d72bf){var _0x4e4d06=fs[_0x1fb2('0xce')](path[_0x1fb2('0x73')](config[_0x1fb2('0x74')],_0x1fb2('0x102')),'utf8');var _0x254c76={'remote':_0x2a4fe5[_0x1fb2('0x103')],'query':querystring['stringify'](_[_0x1fb2('0x4e')](_0x2a4fe5[_0x1fb2('0x31')]({'plain':!![]}),{'customerIp':_0x4427f3[_0x1fb2('0x85')][_0x1fb2('0x9f')]||_0x4427f3[_0x1fb2('0x85')]['x-real-ip']||_0x4427f3[_0x1fb2('0x104')][_0x1fb2('0x105')]||_0x4427f3['ip'],'referer':_0x4427f3[_0x1fb2('0x85')][_0x1fb2('0x106')],'openedInteractions':_0x453bc1,'maxInteractions':_0x47cc31,'virtual':_0x40ce22['virtual'],'online':_0x3d72bf,'custom':_0x40ce22}))[_0x1fb2('0x107')](/'/g,'\x5c\x27')};_0x51c20c[_0x1fb2('0x37')](ejs[_0x1fb2('0xd1')](Mustache[_0x1fb2('0xd1')](_0x4e4d06,_0x254c76),{'proactiveActions':_0x27994c,'alignment':_0x2a4fe5[_0x1fb2('0x108')],'verticalAlignment':_0x2a4fe5['verticalAlignment'],'div_color':_0x2a4fe5[_0x1fb2('0xf2')],'text_color':_0x2a4fe5['textColor'],'button_color':_0x2a4fe5[_0x1fb2('0x109')],'background_color':_0x2a4fe5['backgroundColor']}));})[_0x1fb2('0x26')](handleError(_0x51c20c,null));};exports[_0x1fb2('0x10a')]=function(_0x5ba168,_0x430435,_0x15c6ae){return db[_0x1fb2('0x3c')][_0x1fb2('0x62')]({'where':{'id':_0x5ba168[_0x1fb2('0x54')]['id']}})['then'](handleEntityNotFound(_0x430435,null))[_0x1fb2('0x1d')](function(_0x168e8a){if(_0x168e8a){return db[_0x1fb2('0x10b')]['transaction'](function(_0xc84ddb){return db['ChatApplication'][_0x1fb2('0x5d')]({'where':{'ChatWebsiteId':_0x5ba168[_0x1fb2('0x54')]['id']},'transaction':_0xc84ddb})[_0x1fb2('0x1d')](function(_0x2e7267){var _0x480a18=_[_0x1fb2('0x3b')](_0x5ba168['body'],function(_0x34c981){_0x34c981[_0x1fb2('0x5f')]=_0x5ba168[_0x1fb2('0x54')]['id'];return _0x34c981;});return db[_0x1fb2('0x10c')][_0x1fb2('0xd7')](_0x480a18,{'transaction':_0xc84ddb});});})[_0x1fb2('0x1d')](function(){return db['ChatApplication'][_0x1fb2('0x10d')]({'where':{'ChatWebsiteId':_0x5ba168[_0x1fb2('0x54')]['id']},'order':_0x1fb2('0x10e')});});}})[_0x1fb2('0x1d')](respondWithResult(_0x430435,null))['catch'](handleError(_0x430435,null));};exports[_0x1fb2('0x10f')]=function(_0x509f2d,_0x2724b7,_0x30d4f8){var _0x2e543c={};var _0x77675e={};var _0x33c134;var _0x416bec;return db[_0x1fb2('0x3c')][_0x1fb2('0x62')]({'where':{'id':_0x509f2d[_0x1fb2('0x54')]['id']}})['then'](handleEntityNotFound(_0x2724b7,null))['then'](function(_0x104cda){if(_0x104cda){_0x33c134=_0x104cda;_0x77675e[_0x1fb2('0x40')]=_[_0x1fb2('0x42')](db[_0x1fb2('0x10c')]['rawAttributes']);_0x77675e['query']=_[_0x1fb2('0x42')](_0x509f2d[_0x1fb2('0x41')]);_0x77675e[_0x1fb2('0x43')]=_[_0x1fb2('0x44')](_0x77675e[_0x1fb2('0x40')],_0x77675e[_0x1fb2('0x41')]);_0x2e543c[_0x1fb2('0x45')]=_[_0x1fb2('0x44')](_0x77675e[_0x1fb2('0x40')],qs['fields'](_0x509f2d[_0x1fb2('0x41')][_0x1fb2('0x46')]));_0x2e543c[_0x1fb2('0x45')]=_0x2e543c[_0x1fb2('0x45')][_0x1fb2('0x47')]?_0x2e543c[_0x1fb2('0x45')]:_0x77675e[_0x1fb2('0x40')];_0x2e543c[_0x1fb2('0x64')]=qs[_0x1fb2('0x4a')](_0x509f2d['query'][_0x1fb2('0x4a')]);_0x2e543c[_0x1fb2('0x4b')]=qs[_0x1fb2('0x43')](_[_0x1fb2('0x4c')](_0x509f2d[_0x1fb2('0x41')],_0x77675e['filters']));if(_0x509f2d[_0x1fb2('0x41')][_0x1fb2('0x4d')]){_0x2e543c[_0x1fb2('0x4b')]=_[_0x1fb2('0x4e')](_0x2e543c['where'],{'$or':_[_0x1fb2('0x3b')](_0x2e543c[_0x1fb2('0x45')],function(_0x26e8ce){var _0x5cefc2={};_0x5cefc2[_0x26e8ce]={'$like':'%'+_0x509f2d[_0x1fb2('0x41')][_0x1fb2('0x4d')]+'%'};return _0x5cefc2;})});}_0x2e543c=_[_0x1fb2('0x4e')]({},_0x2e543c,_0x509f2d[_0x1fb2('0x4f')]);return _0x33c134[_0x1fb2('0x10f')](_0x2e543c);}})['then'](function(_0x392821){if(_0x392821){_0x416bec=_0x392821['length'];if(!_0x509f2d[_0x1fb2('0x41')][_0x1fb2('0x48')](_0x1fb2('0x49'))){_0x2e543c[_0x1fb2('0x2c')]=qs[_0x1fb2('0x2c')](_0x509f2d['query'][_0x1fb2('0x2c')]);_0x2e543c[_0x1fb2('0x2b')]=qs[_0x1fb2('0x2b')](_0x509f2d[_0x1fb2('0x41')][_0x1fb2('0x2b')]);}return _0x33c134[_0x1fb2('0x10f')](_0x2e543c);}})[_0x1fb2('0x1d')](function(_0x2e298b){if(_0x2e298b){return _0x2e298b?{'count':_0x416bec,'rows':_0x2e298b}:null;}})['then'](respondWithResult(_0x2724b7,null))[_0x1fb2('0x26')](handleError(_0x2724b7,null));};exports[_0x1fb2('0x110')]=function(_0x140dd4,_0xe371b8,_0x477171){return db['chatProactiveAction'][_0x1fb2('0x55')]({'where':{'id':_0x140dd4[_0x1fb2('0x54')]['id']}})['then'](handleEntityNotFound(_0xe371b8,null))[_0x1fb2('0x1d')](function(_0x3d078d){if(_0x3d078d){return _0x3d078d['addProactiveActions'](_0x140dd4[_0x1fb2('0x5c')][_0x1fb2('0x66')],_[_0x1fb2('0xed')](_0x140dd4[_0x1fb2('0x5c')],[_0x1fb2('0x66'),'id'])||{});}})[_0x1fb2('0x1d')](respondWithResult(_0xe371b8,null))[_0x1fb2('0x26')](handleError(_0xe371b8,null));};exports[_0x1fb2('0x111')]=function(_0x258c8c,_0x458ced,_0x2336c0){var _0x197e15={};var _0x13a1ec={};var _0xe5a3f7;var _0x4af29b;return db[_0x1fb2('0x3c')][_0x1fb2('0x62')]({'where':{'id':_0x258c8c[_0x1fb2('0x54')]['id']}})['then'](handleEntityNotFound(_0x458ced,null))[_0x1fb2('0x1d')](function(_0x106f57){if(_0x106f57){_0xe5a3f7=_0x106f57;_0x13a1ec[_0x1fb2('0x40')]=_[_0x1fb2('0x42')](db[_0x1fb2('0x112')][_0x1fb2('0x63')]);_0x13a1ec[_0x1fb2('0x41')]=_[_0x1fb2('0x42')](_0x258c8c[_0x1fb2('0x41')]);_0x13a1ec[_0x1fb2('0x43')]=_['intersection'](_0x13a1ec[_0x1fb2('0x40')],_0x13a1ec['query']);_0x197e15['attributes']=_[_0x1fb2('0x44')](_0x13a1ec[_0x1fb2('0x40')],qs[_0x1fb2('0x46')](_0x258c8c[_0x1fb2('0x41')][_0x1fb2('0x46')]));_0x197e15[_0x1fb2('0x45')]=_0x197e15[_0x1fb2('0x45')][_0x1fb2('0x47')]?_0x197e15[_0x1fb2('0x45')]:_0x13a1ec[_0x1fb2('0x40')];_0x197e15[_0x1fb2('0x64')]=qs[_0x1fb2('0x4a')](_0x258c8c[_0x1fb2('0x41')][_0x1fb2('0x4a')]);_0x197e15[_0x1fb2('0x4b')]=qs['filters'](_['pick'](_0x258c8c[_0x1fb2('0x41')],_0x13a1ec[_0x1fb2('0x43')]));if(_0x258c8c[_0x1fb2('0x41')]['filter']){_0x197e15[_0x1fb2('0x4b')]=_['merge'](_0x197e15[_0x1fb2('0x4b')],{'$or':_[_0x1fb2('0x3b')](_0x197e15['attributes'],function(_0x4e4518){var _0x1bd12c={};_0x1bd12c[_0x4e4518]={'$like':'%'+_0x258c8c[_0x1fb2('0x41')]['filter']+'%'};return _0x1bd12c;})});}_0x197e15=_[_0x1fb2('0x4e')]({},_0x197e15,_0x258c8c[_0x1fb2('0x4f')]);return _0xe5a3f7[_0x1fb2('0x111')](_0x197e15);}})[_0x1fb2('0x1d')](function(_0x4da589){if(_0x4da589){_0x4af29b=_0x4da589[_0x1fb2('0x47')];if(!_0x258c8c[_0x1fb2('0x41')][_0x1fb2('0x48')](_0x1fb2('0x49'))){_0x197e15[_0x1fb2('0x2c')]=qs[_0x1fb2('0x2c')](_0x258c8c[_0x1fb2('0x41')][_0x1fb2('0x2c')]);_0x197e15[_0x1fb2('0x2b')]=qs[_0x1fb2('0x2b')](_0x258c8c[_0x1fb2('0x41')]['offset']);}return _0xe5a3f7['getProactiveActions'](_0x197e15);}})[_0x1fb2('0x1d')](function(_0x10ca9d){if(_0x10ca9d){return _0x10ca9d?{'count':_0x4af29b,'rows':_0x10ca9d}:null;}})['then'](respondWithResult(_0x458ced,null))['catch'](handleError(_0x458ced,null));};exports[_0x1fb2('0x113')]=function(_0x39348c,_0xdc270,_0x4e1239){var _0x3848b3=_0x39348c[_0x1fb2('0x41')][_0x1fb2('0x114')]===_0x1fb2('0x115')?_0x1fb2('0x116'):_0x1fb2('0x117');return db[_0x1fb2('0x3c')]['find']({'attributes':['id',_0x3848b3],'where':{'id':_0x39348c[_0x1fb2('0x54')]['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0xdc270,null))[_0x1fb2('0x1d')](function(_0xc80913){if(_0xc80913){var _0x29bff5=_0xc80913[_0x3848b3];var _0x13559d=_0x29bff5&&_0x29bff5[_0x1fb2('0x118')]?_0x29bff5[_0x1fb2('0x118')]:[];_0xdc270[_0x1fb2('0x37')]({'fromKey':_[_0x1fb2('0x78')](_0x29bff5[_0x1fb2('0x119')])?undefined:_0x29bff5[_0x1fb2('0x119')],'count':_0x13559d['length'],'rows':_0x13559d});}})['catch'](handleError(_0xdc270,null));};exports['getOfflineMessages']=function(_0x47f4a5,_0x268b93,_0x564c54){var _0x42c351={'raw':![],'where':{}};var _0x4e6f98={};var _0x3bcc11={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x47f4a5[_0x1fb2('0x54')]['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x268b93,null))[_0x1fb2('0x1d')](function(_0x3499b0){if(_0x3499b0){_0x4e6f98['model']=_[_0x1fb2('0x42')](db[_0x1fb2('0xd4')][_0x1fb2('0x63')]);_0x4e6f98[_0x1fb2('0x41')]=_[_0x1fb2('0x42')](_0x47f4a5[_0x1fb2('0x41')]);_0x4e6f98[_0x1fb2('0x43')]=_[_0x1fb2('0x44')](_0x4e6f98['model'],_0x4e6f98['query']);_0x42c351[_0x1fb2('0x45')]=_['intersection'](_0x4e6f98[_0x1fb2('0x40')],qs['fields'](_0x47f4a5[_0x1fb2('0x41')][_0x1fb2('0x46')]));_0x42c351[_0x1fb2('0x45')]=_0x42c351[_0x1fb2('0x45')][_0x1fb2('0x47')]?_0x42c351[_0x1fb2('0x45')]:_0x4e6f98[_0x1fb2('0x40')];if(!_0x47f4a5[_0x1fb2('0x41')][_0x1fb2('0x48')](_0x1fb2('0x49'))){_0x42c351[_0x1fb2('0x2c')]=qs['limit'](_0x47f4a5['query'][_0x1fb2('0x2c')]);_0x42c351[_0x1fb2('0x2b')]=qs[_0x1fb2('0x2b')](_0x47f4a5[_0x1fb2('0x41')][_0x1fb2('0x2b')]);}_0x42c351[_0x1fb2('0x64')]=qs[_0x1fb2('0x4a')](_0x47f4a5[_0x1fb2('0x41')][_0x1fb2('0x4a')]);_0x42c351[_0x1fb2('0x4b')]=qs[_0x1fb2('0x43')](_['pick'](_0x47f4a5['query'],_0x4e6f98[_0x1fb2('0x43')]));_0x42c351[_0x1fb2('0x4b')][_0x1fb2('0x5f')]=_0x3499b0['id'];if(_0x47f4a5[_0x1fb2('0x41')][_0x1fb2('0x4d')]){_0x42c351['where']=_[_0x1fb2('0x4e')](_0x42c351[_0x1fb2('0x4b')],{'$or':_[_0x1fb2('0x3b')](_0x42c351[_0x1fb2('0x45')],function(_0x4a7523){var _0x58c8f6={};_0x58c8f6[_0x4a7523]={'$like':'%'+_0x47f4a5[_0x1fb2('0x41')][_0x1fb2('0x4d')]+'%'};return _0x58c8f6;})});}_0x42c351=_[_0x1fb2('0x4e')]({},_0x42c351,_0x47f4a5[_0x1fb2('0x4f')]);return db[_0x1fb2('0xd4')][_0x1fb2('0x2a')]({'where':_0x42c351[_0x1fb2('0x4b')]})['then'](function(_0x37fb91){_0x3bcc11[_0x1fb2('0x2a')]=_0x37fb91;if(_0x47f4a5[_0x1fb2('0x41')][_0x1fb2('0x50')]){_0x42c351[_0x1fb2('0x51')]=[{'all':!![]}];}else{_0x42c351[_0x1fb2('0x51')]=[{'model':db[_0x1fb2('0x88')],'as':_0x1fb2('0x11a'),'required':![]},{'model':db[_0x1fb2('0x11b')],'as':_0x1fb2('0x11c'),'required':![]}];}return db[_0x1fb2('0xd4')][_0x1fb2('0x52')](_0x42c351);})[_0x1fb2('0x1d')](function(_0x22fe56){_0x3bcc11[_0x1fb2('0x11d')]=_0x22fe56;return _0x3bcc11;});}})[_0x1fb2('0x1d')](respondWithFilteredResult(_0x268b93,_0x42c351))['catch'](handleError(_0x268b93,null));};exports['addAgents']=function(_0x2b0d82,_0x111a98,_0x5368e4){return db[_0x1fb2('0x3c')][_0x1fb2('0x55')]({'where':{'id':_0x2b0d82[_0x1fb2('0x54')]['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x111a98,null))[_0x1fb2('0x1d')](function(_0x5e3e6c){if(_0x5e3e6c){return _0x5e3e6c[_0x1fb2('0x11e')](_0x2b0d82[_0x1fb2('0x5c')]['ids'],_[_0x1fb2('0xed')](_0x2b0d82['body'],[_0x1fb2('0x66'),'id'])||{})[_0x1fb2('0xb0')](function(_0x157a56){for(var _0x5c3492=0x0;_0x5c3492<_0x2b0d82['body'][_0x1fb2('0x66')][_0x1fb2('0x47')];_0x5c3492+=0x1){socket[_0x1fb2('0x11f')](_0x1fb2('0x120'),{'UserId':_0x2b0d82[_0x1fb2('0x5c')][_0x1fb2('0x66')][_0x5c3492],'ChatWebsiteId':_0x2b0d82[_0x1fb2('0x54')]['id']});}return _0x157a56;});}})[_0x1fb2('0x1d')](respondWithResult(_0x111a98,null))[_0x1fb2('0x26')](handleError(_0x111a98,null));};exports[_0x1fb2('0x121')]=function(_0x42eecb,_0x4c3613,_0xc83ae9){return db[_0x1fb2('0x3c')]['find']({'where':{'id':_0x42eecb[_0x1fb2('0x54')]['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x4c3613,null))[_0x1fb2('0x1d')](function(_0x1a5653){if(_0x1a5653){return _0x1a5653[_0x1fb2('0x121')](_0x42eecb[_0x1fb2('0x41')][_0x1fb2('0x66')])[_0x1fb2('0x1d')](function(){if(_[_0x1fb2('0x122')](_0x42eecb[_0x1fb2('0x41')][_0x1fb2('0x66')])){for(var _0x5d0b21=0x0;_0x5d0b21<_0x42eecb['query']['ids'][_0x1fb2('0x47')];_0x5d0b21+=0x1){socket['emit'](_0x1fb2('0x123'),{'UserId':Number(_0x42eecb[_0x1fb2('0x41')][_0x1fb2('0x66')][_0x5d0b21]),'ChatWebsiteId':Number(_0x42eecb[_0x1fb2('0x54')]['id'])});}}else{socket[_0x1fb2('0x11f')](_0x1fb2('0x123'),{'UserId':Number(_0x42eecb[_0x1fb2('0x41')][_0x1fb2('0x66')]),'ChatWebsiteId':Number(_0x42eecb[_0x1fb2('0x54')]['id'])});}});}})[_0x1fb2('0x1d')](respondWithStatusCode(_0x4c3613,null))[_0x1fb2('0x26')](handleError(_0x4c3613,null));};exports['getAgents']=function(_0x429d4c,_0x479566,_0x599abe){var _0x3ea25f={};var _0x4028f4={};var _0x9ae01b;var _0x2af4cb;return db[_0x1fb2('0x3c')][_0x1fb2('0x62')]({'where':{'id':_0x429d4c[_0x1fb2('0x54')]['id']}})[_0x1fb2('0x1d')](handleEntityNotFound(_0x479566,null))[_0x1fb2('0x1d')](function(_0x2bdf2e){if(_0x2bdf2e){_0x9ae01b=_0x2bdf2e;_0x4028f4[_0x1fb2('0x40')]=_[_0x1fb2('0x42')](db[_0x1fb2('0x124')][_0x1fb2('0x63')]);_0x4028f4[_0x1fb2('0x41')]=_[_0x1fb2('0x42')](_0x429d4c['query']);_0x4028f4[_0x1fb2('0x43')]=_['intersection'](_0x4028f4['model'],_0x4028f4['query']);_0x3ea25f[_0x1fb2('0x45')]=_['intersection'](_0x4028f4[_0x1fb2('0x40')],qs['fields'](_0x429d4c[_0x1fb2('0x41')]['fields']));_0x3ea25f[_0x1fb2('0x45')]=_0x3ea25f[_0x1fb2('0x45')][_0x1fb2('0x47')]?_0x3ea25f[_0x1fb2('0x45')]:_0x4028f4[_0x1fb2('0x40')];_0x3ea25f[_0x1fb2('0x64')]=qs[_0x1fb2('0x4a')](_0x429d4c[_0x1fb2('0x41')][_0x1fb2('0x4a')]);_0x3ea25f[_0x1fb2('0x4b')]=qs[_0x1fb2('0x43')](_[_0x1fb2('0x4c')](_0x429d4c[_0x1fb2('0x41')],_0x4028f4[_0x1fb2('0x43')]));if(_0x429d4c[_0x1fb2('0x41')]['filter']){_0x3ea25f[_0x1fb2('0x4b')]=_['merge'](_0x3ea25f[_0x1fb2('0x4b')],{'$or':_[_0x1fb2('0x3b')](_0x3ea25f[_0x1fb2('0x45')],function(_0x4f1bd4){var _0x2132d3={};_0x2132d3[_0x4f1bd4]={'$like':'%'+_0x429d4c[_0x1fb2('0x41')][_0x1fb2('0x4d')]+'%'};return _0x2132d3;})});}_0x3ea25f=_[_0x1fb2('0x4e')]({},_0x3ea25f,_0x429d4c[_0x1fb2('0x4f')]);return _0x9ae01b[_0x1fb2('0x125')](_0x3ea25f);}})[_0x1fb2('0x1d')](function(_0x5ddedc){if(_0x5ddedc){_0x2af4cb=_0x5ddedc[_0x1fb2('0x47')];if(!_0x429d4c['query'][_0x1fb2('0x48')](_0x1fb2('0x49'))){_0x3ea25f['limit']=qs[_0x1fb2('0x2c')](_0x429d4c[_0x1fb2('0x41')][_0x1fb2('0x2c')]);_0x3ea25f[_0x1fb2('0x2b')]=qs[_0x1fb2('0x2b')](_0x429d4c['query'][_0x1fb2('0x2b')]);}return _0x9ae01b[_0x1fb2('0x125')](_0x3ea25f);}})['then'](function(_0xaf6a72){if(_0xaf6a72){return _0xaf6a72?{'count':_0x2af4cb,'rows':_0xaf6a72}:null;}})['then'](respondWithResult(_0x479566,null))[_0x1fb2('0x26')](handleError(_0x479566,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index bc69cd5..32ed2d0 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 _0x6666=['remove','emit','hasOwnProperty','hook','exports','events','update'];(function(_0x510520,_0x4c3134){var _0x17cff0=function(_0x2d3325){while(--_0x2d3325){_0x510520['push'](_0x510520['shift']());}};_0x17cff0(++_0x4c3134);}(_0x6666,0x6e));var _0x6666=function(_0x120123,_0x4eff59){_0x120123=_0x120123-0x0;var _0x3bec4c=_0x6666[_0x120123];return _0x3bec4c;};'use strict';var EventEmitter=require(_0x6666('0x0'));var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6666('0x1'),'afterDestroy':_0x6666('0x2')};function emitEvent(_0x589a1e){return function(_0x5ad3be,_0x3ecd6f,_0x1428db){ChatWebsiteEvents[_0x6666('0x3')](_0x589a1e+':'+_0x5ad3be['id'],_0x5ad3be);ChatWebsiteEvents[_0x6666('0x3')](_0x589a1e,_0x5ad3be);_0x1428db(null);};}for(var e in events){if(events[_0x6666('0x4')](e)){var event=events[e];ChatWebsite[_0x6666('0x5')](e,emitEvent(event));}}module[_0x6666('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0xc576=['hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','emit'];(function(_0x3a9e6e,_0x2d4a75){var _0x7b4ead=function(_0x544e02){while(--_0x544e02){_0x3a9e6e['push'](_0x3a9e6e['shift']());}};_0x7b4ead(++_0x2d4a75);}(_0xc576,0x1ea));var _0x6c57=function(_0x30cc1a,_0x162bbc){_0x30cc1a=_0x30cc1a-0x0;var _0xb3f18f=_0xc576[_0x30cc1a];return _0xb3f18f;};'use strict';var EventEmitter=require(_0x6c57('0x0'));var ChatWebsite=require(_0x6c57('0x1'))['db'][_0x6c57('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x6c57('0x3')](0x0);var events={'afterCreate':_0x6c57('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x10a252){return function(_0x4e5df7,_0x31ab9f,_0x23861f){ChatWebsiteEvents['emit'](_0x10a252+':'+_0x4e5df7['id'],_0x4e5df7);ChatWebsiteEvents[_0x6c57('0x5')](_0x10a252,_0x4e5df7);_0x23861f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x6c57('0x6')](e,emitEvent(event));}}module[_0x6c57('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 36dd7c8..9beb3b8 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 _0x93e6=['api','bluebird','path','rimraf','../../config/environment','exports','lodash'];(function(_0x1eaacc,_0x3ee3f8){var _0x119d75=function(_0x3fea8e){while(--_0x3fea8e){_0x1eaacc['push'](_0x1eaacc['shift']());}};_0x119d75(++_0x3ee3f8);}(_0x93e6,0x11e));var _0x693e=function(_0xf6bb70,_0x3b21a1){_0xf6bb70=_0xf6bb70-0x0;var _0x46ed1d=_0x93e6[_0xf6bb70];return _0x46ed1d;};'use strict';var _=require(_0x693e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x693e('0x1'));var moment=require('moment');var BPromise=require(_0x693e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x693e('0x3'));var rimraf=require(_0x693e('0x4'));var config=require(_0x693e('0x5'));var attributes=require('./chatWebsite.attributes');module[_0x693e('0x6')]=function(_0x388eb6,_0x2569a4){return _0x388eb6['define']('ChatWebsite',attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd3d1=['../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x295a92,_0x7d70dc){var _0x3f5dac=function(_0x47b9e8){while(--_0x47b9e8){_0x295a92['push'](_0x295a92['shift']());}};_0x3f5dac(++_0x7d70dc);}(_0xd3d1,0x172));var _0x1d3d=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xd3d1[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0x1d3d('0x0'));var util=require(_0x1d3d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1d3d('0x2'));var BPromise=require(_0x1d3d('0x3'));var rp=require(_0x1d3d('0x4'));var fs=require('fs');var path=require(_0x1d3d('0x5'));var rimraf=require(_0x1d3d('0x6'));var config=require(_0x1d3d('0x7'));var attributes=require(_0x1d3d('0x8'));module[_0x1d3d('0x9')]=function(_0x1cbe06,_0x449475){return _0x1cbe06[_0x1d3d('0xa')](_0x1d3d('0xb'),attributes,{'tableName':_0x1d3d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 2061c7c..d36dddf 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 _0xd943=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','localhost','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x4bacde,_0x410a91){var _0x40cfc7=function(_0x2e0213){while(--_0x2e0213){_0x4bacde['push'](_0x4bacde['shift']());}};_0x40cfc7(++_0x410a91);}(_0xd943,0x15d));var _0x3d94=function(_0x2240ca,_0x3e3146){_0x2240ca=_0x2240ca-0x0;var _0x169dfa=_0xd943[_0x2240ca];return _0x169dfa;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x3d94('0xa')],{'host':_0x3d94('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3d94('0xc'))[_0x3d94('0xd')](socket);function respondWithRpcPromise(_0x1cc58c,_0x5908a7,_0x182066){return new BPromise(function(_0x4ac968,_0x39e2fa){return client[_0x3d94('0xe')](_0x1cc58c,_0x182066)['then'](function(_0x1897de){logger[_0x3d94('0xf')](_0x3d94('0x10'),_0x5908a7,_0x3d94('0x11'));logger[_0x3d94('0x12')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x5908a7,_0x3d94('0x11'),JSON[_0x3d94('0x13')](_0x1897de));if(_0x1897de[_0x3d94('0x14')]){if(_0x1897de['error'][_0x3d94('0x15')]===0x1f4){logger[_0x3d94('0x14')](_0x3d94('0x10'),_0x5908a7,_0x1897de['error'][_0x3d94('0x16')]);return _0x39e2fa(_0x1897de[_0x3d94('0x14')][_0x3d94('0x16')]);}logger[_0x3d94('0x14')](_0x3d94('0x10'),_0x5908a7,_0x1897de[_0x3d94('0x14')][_0x3d94('0x16')]);return _0x4ac968(_0x1897de[_0x3d94('0x14')]['message']);}else{logger[_0x3d94('0xf')](_0x3d94('0x10'),_0x5908a7,_0x3d94('0x11'));_0x4ac968(_0x1897de[_0x3d94('0x17')][_0x3d94('0x16')]);}})[_0x3d94('0x18')](function(_0xef8b3){logger['error'](_0x3d94('0x10'),_0x5908a7,_0xef8b3);_0x39e2fa(_0xef8b3);});});} \ No newline at end of file +var _0x896e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x52bff2,_0x2ea2a8){var _0x25574e=function(_0x3dc63b){while(--_0x3dc63b){_0x52bff2['push'](_0x52bff2['shift']());}};_0x25574e(++_0x2ea2a8);}(_0x896e,0x1e9));var _0xe896=function(_0x301a6b,_0x48274b){_0x301a6b=_0x301a6b-0x0;var _0x11d969=_0x896e[_0x301a6b];return _0x11d969;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});config[_0xe896('0xd')]=_[_0xe896('0xe')](config[_0xe896('0xd')],{'host':_0xe896('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe896('0xd')]));require(_0xe896('0x10'))[_0xe896('0x11')](socket);function respondWithRpcPromise(_0x4afd3f,_0x305616,_0x48251e){return new BPromise(function(_0x45b15b,_0x5be679){return client[_0xe896('0x12')](_0x4afd3f,_0x48251e)[_0xe896('0x13')](function(_0xa00ae9){logger['info'](_0xe896('0x14'),_0x305616,_0xe896('0x15'));logger[_0xe896('0x16')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x305616,_0xe896('0x15'),JSON[_0xe896('0x17')](_0xa00ae9));if(_0xa00ae9[_0xe896('0x18')]){if(_0xa00ae9['error'][_0xe896('0x19')]===0x1f4){logger[_0xe896('0x18')](_0xe896('0x14'),_0x305616,_0xa00ae9['error']['message']);return _0x5be679(_0xa00ae9[_0xe896('0x18')][_0xe896('0x1a')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x305616,_0xa00ae9[_0xe896('0x18')][_0xe896('0x1a')]);return _0x45b15b(_0xa00ae9['error'][_0xe896('0x1a')]);}else{logger['info'](_0xe896('0x14'),_0x305616,_0xe896('0x15'));_0x45b15b(_0xa00ae9[_0xe896('0x1b')]['message']);}})[_0xe896('0x1c')](function(_0x9714f1){logger[_0xe896('0x18')](_0xe896('0x14'),_0x305616,_0x9714f1);_0x5be679(_0x9714f1);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 6486a08..aefc0af 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 _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0xb10b,0x12a));var _0xbb10=function(_0x4c7c4a,_0x520920){_0x4c7c4a=_0x4c7c4a-0x0;var _0x4d78ae=_0xb10b[_0x4c7c4a];return _0x4d78ae;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0x7a54=['remove','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0xc0c89a,_0x1a93ce){var _0x2de380=function(_0x429851){while(--_0x429851){_0xc0c89a['push'](_0xc0c89a['shift']());}};_0x2de380(++_0x1a93ce);}(_0x7a54,0x106));var _0x47a5=function(_0x18347b,_0xb0e425){_0x18347b=_0x18347b-0x0;var _0x5646a0=_0x7a54[_0x18347b];return _0x5646a0;};'use strict';var ChatWebsiteEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){ChatWebsiteEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);ChatWebsiteEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 257e9bb..28d0c5e 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 _0x1f92=['getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','post','create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','addLogo','server/files/images/avatars/','single','file','addAvatar','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','offline-chat','ensureDir','replace','extname','/:id/offline','offline','addInteraction','addApplications','addProactiveActions','put','update','delete','destroy','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions'];(function(_0x7083a2,_0x5cc787){var _0x3d42aa=function(_0x1f691d){while(--_0x1f691d){_0x7083a2['push'](_0x7083a2['shift']());}};_0x3d42aa(++_0x5cc787);}(_0x1f92,0x1ad));var _0x21f9=function(_0x5510f8,_0x5be0f3){_0x5510f8=_0x5510f8-0x0;var _0x43637e=_0x1f92[_0x5510f8];return _0x43637e;};'use strict';var multer=require(_0x21f9('0x0'));var util=require('util');var path=require(_0x21f9('0x1'));var timeout=require(_0x21f9('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x21f9('0x3'));var auth=require(_0x21f9('0x4'));var interaction=require(_0x21f9('0x5'));var config=require(_0x21f9('0x6'));var controller=require(_0x21f9('0x7'));router[_0x21f9('0x8')]('/',auth[_0x21f9('0x9')](),controller[_0x21f9('0xa')]);router[_0x21f9('0x8')](_0x21f9('0xb'),auth[_0x21f9('0x9')](),controller[_0x21f9('0xc')]);router['get'](_0x21f9('0xd'),auth[_0x21f9('0x9')](),controller[_0x21f9('0xe')]);router['get']('/:id/dispositions',auth[_0x21f9('0x9')](),controller[_0x21f9('0xf')]);router['get'](_0x21f9('0x10'),auth[_0x21f9('0x9')](),controller[_0x21f9('0x11')]);router[_0x21f9('0x8')](_0x21f9('0x12'),controller[_0x21f9('0x13')]);router[_0x21f9('0x8')](_0x21f9('0x14'),controller[_0x21f9('0x15')]);router['get']('/:id/customer_avatar',controller[_0x21f9('0x16')]);router['get'](_0x21f9('0x17'),controller[_0x21f9('0x18')]);router[_0x21f9('0x8')](_0x21f9('0x19'),auth[_0x21f9('0x9')](),controller[_0x21f9('0x1a')]);router[_0x21f9('0x8')]('/:id/snippet',controller[_0x21f9('0x1b')]);router[_0x21f9('0x8')](_0x21f9('0x1c'),auth[_0x21f9('0x9')](),controller[_0x21f9('0x1d')]);router[_0x21f9('0x8')](_0x21f9('0x1e'),auth[_0x21f9('0x9')](),controller[_0x21f9('0x1f')]);router[_0x21f9('0x8')](_0x21f9('0x20'),controller[_0x21f9('0x21')]);router[_0x21f9('0x8')](_0x21f9('0x22'),auth[_0x21f9('0x9')](),controller[_0x21f9('0x23')]);router[_0x21f9('0x8')](_0x21f9('0x24'),auth[_0x21f9('0x9')](),controller['getAgents']);router[_0x21f9('0x25')]('/',auth[_0x21f9('0x9')](),controller[_0x21f9('0x26')]);router['post']('/:id/dispositions',auth[_0x21f9('0x9')](),controller[_0x21f9('0x27')]);router[_0x21f9('0x25')]('/:id/canned_answers',auth[_0x21f9('0x9')](),controller[_0x21f9('0x28')]);var upload=multer({'storage':multer[_0x21f9('0x29')]({'destination':function(_0x4fab42,_0x3af2f9,_0x3d8104){_0x3d8104(null,path[_0x21f9('0x2a')](config[_0x21f9('0x2b')],_0x21f9('0x2c')));},'filename':function(_0x3bff9d,_0x48d725,_0x18e259){_0x18e259(null,util[_0x21f9('0x2d')](_0x21f9('0x2e'),Date[_0x21f9('0x2f')](),_0x48d725[_0x21f9('0x30')]));}})});router[_0x21f9('0x25')](_0x21f9('0x12'),upload['single']('file'),controller[_0x21f9('0x31')]);var upload=multer({'storage':multer[_0x21f9('0x29')]({'destination':function(_0x4a451b,_0x5a2767,_0x4527e4){_0x4527e4(null,path[_0x21f9('0x2a')](config[_0x21f9('0x2b')],_0x21f9('0x32')));},'filename':function(_0x59ccec,_0x45e579,_0x5f4b31){_0x5f4b31(null,util[_0x21f9('0x2d')](_0x21f9('0x2e'),Date[_0x21f9('0x2f')](),_0x45e579[_0x21f9('0x30')]));}})});router[_0x21f9('0x25')](_0x21f9('0x14'),upload[_0x21f9('0x33')](_0x21f9('0x34')),controller[_0x21f9('0x35')]);var upload=multer({'storage':multer[_0x21f9('0x29')]({'destination':function(_0x5b2471,_0x538d1c,_0x28eadc){_0x28eadc(null,path[_0x21f9('0x2a')](config[_0x21f9('0x2b')],_0x21f9('0x32')));},'filename':function(_0x44b97c,_0x568e9f,_0x4f19cc){_0x4f19cc(null,util[_0x21f9('0x2d')]('%s-%s',Date[_0x21f9('0x2f')](),_0x568e9f[_0x21f9('0x30')]));}})});router['post'](_0x21f9('0x36'),upload[_0x21f9('0x33')]('file'),controller[_0x21f9('0x37')]);var upload=multer({'storage':multer[_0x21f9('0x29')]({'destination':function(_0x468947,_0x308a3f,_0x10a44c){_0x10a44c(null,path[_0x21f9('0x2a')](config['root'],_0x21f9('0x32')));},'filename':function(_0x508a4c,_0xd31bee,_0x53474b){_0x53474b(null,util[_0x21f9('0x2d')]('%s-%s',Date[_0x21f9('0x2f')](),_0xd31bee[_0x21f9('0x30')]));}})});router[_0x21f9('0x25')](_0x21f9('0x17'),upload[_0x21f9('0x33')](_0x21f9('0x34')),controller[_0x21f9('0x38')]);router[_0x21f9('0x25')](_0x21f9('0x39'),controller[_0x21f9('0x3a')]);const offlineUploadMulter=multer({'storage':multer[_0x21f9('0x29')]({'destination':function(_0x5d5e78,_0x1fcce8,_0x3303ad){const _0x327f18=path['join'](config[_0x21f9('0x2b')],'server/files','attachments',_0x21f9('0x3b'));fs_extra[_0x21f9('0x3c')](_0x327f18,function(){_0x3303ad(null,_0x327f18);});},'filename':function(_0x1463d9,_0x267523,_0x33173e){const _0x2275d4=_0x267523['originalname'][_0x21f9('0x3d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x4a8e07=path[_0x21f9('0x3e')](_0x2275d4);const _0xe9d3e4=Date[_0x21f9('0x2f')]()+'-'+_0x2275d4['replace'](_0x4a8e07,'')+_0x4a8e07;_0x33173e(null,_0xe9d3e4);}})});router[_0x21f9('0x25')](_0x21f9('0x3f'),offlineUploadMulter['any'](),controller[_0x21f9('0x40')]);router[_0x21f9('0x25')](_0x21f9('0x19'),auth[_0x21f9('0x9')](),controller[_0x21f9('0x41')]);router[_0x21f9('0x25')](_0x21f9('0x1c'),auth[_0x21f9('0x9')](),controller[_0x21f9('0x42')]);router[_0x21f9('0x25')]('/:id/proactive_actions',auth[_0x21f9('0x9')](),controller[_0x21f9('0x43')]);router['post'](_0x21f9('0x24'),auth['isAuthenticated'](),controller['addAgents']);router[_0x21f9('0x44')](_0x21f9('0xd'),auth[_0x21f9('0x9')](),controller[_0x21f9('0x45')]);router[_0x21f9('0x46')](_0x21f9('0xd'),auth[_0x21f9('0x9')](),controller[_0x21f9('0x47')]);router[_0x21f9('0x46')](_0x21f9('0x48'),auth[_0x21f9('0x9')](),controller[_0x21f9('0x49')]);router[_0x21f9('0x46')](_0x21f9('0x10'),auth[_0x21f9('0x9')](),controller[_0x21f9('0x4a')]);router[_0x21f9('0x46')](_0x21f9('0x24'),auth['isAuthenticated'](),controller[_0x21f9('0x4b')]);module['exports']=router; \ No newline at end of file +var _0xd117=['./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/logo','/:id/avatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getOfflineMessages','/:id/users','getAgents','post','/:id/canned_answers','addAnswer','diskStorage','root','%s-%s','now','originalname','single','file','format','addAvatar','server/files/images/avatars/','notify','join','server/files','offline-chat','replace','/:id/offline','any','offline','addInteraction','addApplications','addAgents','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xd117,0x182));var _0x7d11=function(_0xcfcbaa,_0x369d95){_0xcfcbaa=_0xcfcbaa-0x0;var _0x157ed0=_0xd117[_0xcfcbaa];return _0x157ed0;};'use strict';var multer=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var path=require(_0x7d11('0x2'));var timeout=require(_0x7d11('0x3'));var express=require(_0x7d11('0x4'));var router=express[_0x7d11('0x5')]();var fs_extra=require(_0x7d11('0x6'));var auth=require(_0x7d11('0x7'));var interaction=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var controller=require(_0x7d11('0xa'));router[_0x7d11('0xb')]('/',auth[_0x7d11('0xc')](),controller[_0x7d11('0xd')]);router[_0x7d11('0xb')](_0x7d11('0xe'),auth['isAuthenticated'](),controller[_0x7d11('0xf')]);router[_0x7d11('0xb')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x11')]);router[_0x7d11('0xb')](_0x7d11('0x12'),auth['isAuthenticated'](),controller[_0x7d11('0x13')]);router['get']('/:id/canned_answers',auth[_0x7d11('0xc')](),controller['getAnswers']);router['get'](_0x7d11('0x14'),controller['getLogo']);router[_0x7d11('0xb')](_0x7d11('0x15'),controller['getAvatar']);router[_0x7d11('0xb')](_0x7d11('0x16'),controller['getCustomerAvatar']);router[_0x7d11('0xb')](_0x7d11('0x17'),controller[_0x7d11('0x18')]);router[_0x7d11('0xb')](_0x7d11('0x19'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x1a')]);router[_0x7d11('0xb')]('/:id/snippet',controller[_0x7d11('0x1b')]);router[_0x7d11('0xb')](_0x7d11('0x1c'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x1d')]);router['get'](_0x7d11('0x1e'),auth[_0x7d11('0xc')](),controller['getProactiveActions']);router['get'](_0x7d11('0x1f'),controller['getFields']);router[_0x7d11('0xb')]('/:id/offline_messages',auth[_0x7d11('0xc')](),controller[_0x7d11('0x20')]);router[_0x7d11('0xb')](_0x7d11('0x21'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x22')]);router[_0x7d11('0x23')]('/',auth[_0x7d11('0xc')](),controller['create']);router[_0x7d11('0x23')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0x7d11('0x23')](_0x7d11('0x24'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x25')]);var upload=multer({'storage':multer[_0x7d11('0x26')]({'destination':function(_0xd938df,_0x282e5c,_0x1c1edd){_0x1c1edd(null,path['join'](config[_0x7d11('0x27')],'server/files/images/logos/'));},'filename':function(_0x4bfa76,_0x5126cf,_0x3ba092){_0x3ba092(null,util['format'](_0x7d11('0x28'),Date[_0x7d11('0x29')](),_0x5126cf[_0x7d11('0x2a')]));}})});router['post'](_0x7d11('0x14'),upload[_0x7d11('0x2b')](_0x7d11('0x2c')),controller['addLogo']);var upload=multer({'storage':multer[_0x7d11('0x26')]({'destination':function(_0x35a789,_0x18c049,_0x38f1be){_0x38f1be(null,path['join'](config[_0x7d11('0x27')],'server/files/images/avatars/'));},'filename':function(_0x1bc218,_0x509164,_0x31866d){_0x31866d(null,util[_0x7d11('0x2d')](_0x7d11('0x28'),Date['now'](),_0x509164['originalname']));}})});router[_0x7d11('0x23')](_0x7d11('0x15'),upload['single'](_0x7d11('0x2c')),controller[_0x7d11('0x2e')]);var upload=multer({'storage':multer[_0x7d11('0x26')]({'destination':function(_0x53ec4c,_0x9c6609,_0x553117){_0x553117(null,path['join'](config[_0x7d11('0x27')],'server/files/images/avatars/'));},'filename':function(_0x1d5d4e,_0x38fbd3,_0x34f3b6){_0x34f3b6(null,util[_0x7d11('0x2d')]('%s-%s',Date[_0x7d11('0x29')](),_0x38fbd3[_0x7d11('0x2a')]));}})});router['post']('/:id/customer_avatar',upload[_0x7d11('0x2b')](_0x7d11('0x2c')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x7d11('0x26')]({'destination':function(_0x5ac591,_0x5c0113,_0x1286d6){_0x1286d6(null,path['join'](config['root'],_0x7d11('0x2f')));},'filename':function(_0x30e2fa,_0x1b96d8,_0x2e426b){_0x2e426b(null,util[_0x7d11('0x2d')](_0x7d11('0x28'),Date[_0x7d11('0x29')](),_0x1b96d8[_0x7d11('0x2a')]));}})});router[_0x7d11('0x23')](_0x7d11('0x17'),upload[_0x7d11('0x2b')](_0x7d11('0x2c')),controller['addSystemAvatar']);router[_0x7d11('0x23')]('/:id/notify',controller[_0x7d11('0x30')]);const offlineUploadMulter=multer({'storage':multer[_0x7d11('0x26')]({'destination':function(_0x36be62,_0xa37410,_0x4f8fd2){const _0xd36cd3=path[_0x7d11('0x31')](config[_0x7d11('0x27')],_0x7d11('0x32'),'attachments',_0x7d11('0x33'));fs_extra['ensureDir'](_0xd36cd3,function(){_0x4f8fd2(null,_0xd36cd3);});},'filename':function(_0x2e05e8,_0x4d89c3,_0xede1cc){const _0x622725=_0x4d89c3[_0x7d11('0x2a')][_0x7d11('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x52c28b=path['extname'](_0x622725);const _0x1b24af=Date[_0x7d11('0x29')]()+'-'+_0x622725['replace'](_0x52c28b,'')+_0x52c28b;_0xede1cc(null,_0x1b24af);}})});router[_0x7d11('0x23')](_0x7d11('0x35'),offlineUploadMulter[_0x7d11('0x36')](),controller[_0x7d11('0x37')]);router[_0x7d11('0x23')](_0x7d11('0x19'),auth['isAuthenticated'](),controller[_0x7d11('0x38')]);router['post'](_0x7d11('0x1c'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x39')]);router[_0x7d11('0x23')](_0x7d11('0x1e'),auth[_0x7d11('0xc')](),controller['addProactiveActions']);router['post']('/:id/users',auth[_0x7d11('0xc')](),controller[_0x7d11('0x3a')]);router[_0x7d11('0x3b')](_0x7d11('0x10'),auth[_0x7d11('0xc')](),controller['update']);router[_0x7d11('0x3c')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x3d')]);router[_0x7d11('0x3c')](_0x7d11('0x12'),auth['isAuthenticated'](),controller[_0x7d11('0x3e')]);router[_0x7d11('0x3c')](_0x7d11('0x24'),auth['isAuthenticated'](),controller[_0x7d11('0x3f')]);router['delete'](_0x7d11('0x21'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x40')]);module[_0x7d11('0x41')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index b2a9c9b..1038231 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 _0xdedd=['ENUM','AmazonAWS','sequelize','exports','STRING'];(function(_0x5f18b8,_0x4f28f0){var _0x5b2fd6=function(_0x134030){while(--_0x134030){_0x5f18b8['push'](_0x5f18b8['shift']());}};_0x5b2fd6(++_0x4f28f0);}(_0xdedd,0x197));var _0xdded=function(_0x4def11,_0x1cb80d){_0x4def11=_0x4def11-0x0;var _0x1ebe6d=_0xdedd[_0x4def11];return _0x1ebe6d;};'use strict';var Sequelize=require(_0xdded('0x0'));module[_0xdded('0x1')]={'name':{'type':Sequelize[_0xdded('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xdded('0x3')](_0xdded('0x4'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xdded('0x2')]},'data2':{'type':Sequelize[_0xdded('0x2')]}}; \ No newline at end of file +var _0xca84=['sequelize','exports','STRING','AmazonAWS','Google'];(function(_0x427b29,_0x248470){var _0x346eb1=function(_0xe0985){while(--_0xe0985){_0x427b29['push'](_0x427b29['shift']());}};_0x346eb1(++_0x248470);}(_0xca84,0xf5));var _0x4ca8=function(_0x57fd67,_0x4a14ba){_0x57fd67=_0x57fd67-0x0;var _0x4a45d1=_0xca84[_0x57fd67];return _0x4a45d1;};'use strict';var Sequelize=require(_0x4ca8('0x0'));module[_0x4ca8('0x1')]={'name':{'type':Sequelize[_0x4ca8('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x4ca8('0x3'),_0x4ca8('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x4ca8('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index dcce7c0..ce022fc 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 _0xb258=['sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','count','offset','limit','status','set','apply','reject','update','then','name','send','map','CloudProvider','rawAttributes','fieldName','type','key','filters','intersection','model','attributes','fields','query','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb258,0x19c));var _0x8b25=function(_0x5bc24a,_0x25bef2){_0x5bc24a=_0x5bc24a-0x0;var _0x147623=_0xb258[_0x5bc24a];return _0x147623;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8b25('0x0'));var rimraf=require(_0x8b25('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8b25('0x2'));var rp=require(_0x8b25('0x3'));var moment=require(_0x8b25('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8b25('0x5'));var util=require(_0x8b25('0x6'));var path=require(_0x8b25('0x7'));var sox=require(_0x8b25('0x8'));var csv=require(_0x8b25('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b25('0xa'));var _=require('lodash');var squel=require(_0x8b25('0xb'));var crypto=require(_0x8b25('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8b25('0xd'));var toCsv=require(_0x8b25('0x9'));var querystring=require(_0x8b25('0xe'));var Papa=require('papaparse');var Redis=require(_0x8b25('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8b25('0x10'));var as=require(_0x8b25('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b25('0x12'))(_0x8b25('0x13'));var utils=require(_0x8b25('0x14'));var config=require(_0x8b25('0x15'));var licenseUtil=require(_0x8b25('0x16'));var db=require(_0x8b25('0x17'))['db'];function respondWithStatusCode(_0x1d0950,_0x552239){_0x552239=_0x552239||0xcc;return function(_0x57ac17){if(_0x57ac17){return _0x1d0950[_0x8b25('0x18')](_0x552239);}return _0x1d0950['status'](_0x552239)[_0x8b25('0x19')]();};}function respondWithResult(_0x1dd2dd,_0x2f7e69){_0x2f7e69=_0x2f7e69||0xc8;return function(_0x25e804){if(_0x25e804){return _0x1dd2dd['status'](_0x2f7e69)['json'](_0x25e804);}};}function respondWithFilteredResult(_0x168296,_0x348a39){return function(_0x17f065){if(_0x17f065){var _0xa8e76a=_0x17f065[_0x8b25('0x1a')],_0x18386b=_0x348a39[_0x8b25('0x1b')],_0x218c4e=_0x348a39[_0x8b25('0x1b')]+_0x348a39[_0x8b25('0x1c')],_0x34de9f;if(_0x218c4e>=_0xa8e76a){_0x218c4e=_0xa8e76a;_0x34de9f=0xc8;}else{_0x34de9f=0xce;}_0x168296[_0x8b25('0x1d')](_0x34de9f);return _0x168296[_0x8b25('0x1e')]('Content-Range',_0x18386b+'-'+_0x218c4e+'/'+_0xa8e76a)['json'](_0x17f065);}return null;};}function patchUpdates(_0x10518d){return function(_0x1558a9){try{jsonpatch[_0x8b25('0x1f')](_0x1558a9,_0x10518d,!![]);}catch(_0x3f79f2){return BPromise[_0x8b25('0x20')](_0x3f79f2);}return _0x1558a9['save']();};}function saveUpdates(_0x5370cf,_0x3ef206){return function(_0x134e72){if(_0x134e72){return _0x134e72[_0x8b25('0x21')](_0x5370cf)['then'](function(_0xb91883){return _0xb91883;});}return null;};}function removeEntity(_0x49de9d,_0x44b5db){return function(_0x172799){if(_0x172799){return _0x172799['destroy']()[_0x8b25('0x22')](function(){_0x49de9d['status'](0xcc)[_0x8b25('0x19')]();});}};}function handleEntityNotFound(_0x45c272,_0x3d314e){return function(_0x13bede){if(!_0x13bede){_0x45c272[_0x8b25('0x18')](0x194);}return _0x13bede;};}function handleError(_0x14bc16,_0x47dd67){_0x47dd67=_0x47dd67||0x1f4;return function(_0x59dc2e){logger['error'](_0x59dc2e['stack']);if(_0x59dc2e[_0x8b25('0x23')]){delete _0x59dc2e[_0x8b25('0x23')];}_0x14bc16[_0x8b25('0x1d')](_0x47dd67)[_0x8b25('0x24')](_0x59dc2e);};}exports['index']=function(_0x427561,_0x1c8a22){var _0x459239={},_0x1dcb12={},_0x2b4814={'count':0x0,'rows':[]};var _0x40abaa=_[_0x8b25('0x25')](db[_0x8b25('0x26')][_0x8b25('0x27')],function(_0x5a706e){return{'name':_0x5a706e[_0x8b25('0x28')],'type':_0x5a706e[_0x8b25('0x29')][_0x8b25('0x2a')]};});_0x1dcb12['model']=_[_0x8b25('0x25')](_0x40abaa,_0x8b25('0x23'));_0x1dcb12['query']=_['keys'](_0x427561['query']);_0x1dcb12[_0x8b25('0x2b')]=_[_0x8b25('0x2c')](_0x1dcb12[_0x8b25('0x2d')],_0x1dcb12['query']);_0x459239[_0x8b25('0x2e')]=_[_0x8b25('0x2c')](_0x1dcb12['model'],qs[_0x8b25('0x2f')](_0x427561[_0x8b25('0x30')][_0x8b25('0x2f')]));_0x459239[_0x8b25('0x2e')]=_0x459239[_0x8b25('0x2e')][_0x8b25('0x31')]?_0x459239[_0x8b25('0x2e')]:_0x1dcb12[_0x8b25('0x2d')];if(!_0x427561[_0x8b25('0x30')][_0x8b25('0x32')](_0x8b25('0x33'))){_0x459239['limit']=qs[_0x8b25('0x1c')](_0x427561[_0x8b25('0x30')][_0x8b25('0x1c')]);_0x459239[_0x8b25('0x1b')]=qs['offset'](_0x427561['query'][_0x8b25('0x1b')]);}_0x459239['order']=qs['sort'](_0x427561[_0x8b25('0x30')][_0x8b25('0x34')]);_0x459239[_0x8b25('0x35')]=qs[_0x8b25('0x2b')](_[_0x8b25('0x36')](_0x427561['query'],_0x1dcb12[_0x8b25('0x2b')]),_0x40abaa);if(_0x427561[_0x8b25('0x30')]['filter']){_0x459239[_0x8b25('0x35')]=_[_0x8b25('0x37')](_0x459239['where'],{'$or':_[_0x8b25('0x25')](_0x40abaa,function(_0x38d269){if(_0x38d269['type']!==_0x8b25('0x38')){var _0x47d1f4={};_0x47d1f4[_0x38d269[_0x8b25('0x23')]]={'$like':'%'+_0x427561[_0x8b25('0x30')][_0x8b25('0x39')]+'%'};return _0x47d1f4;}})});}_0x459239=_[_0x8b25('0x37')]({},_0x459239,_0x427561[_0x8b25('0x3a')]);var _0x394ab0={'where':_0x459239[_0x8b25('0x35')]};return db[_0x8b25('0x26')][_0x8b25('0x1a')](_0x394ab0)['then'](function(_0x384cc7){_0x2b4814['count']=_0x384cc7;if(_0x427561[_0x8b25('0x30')]['includeAll']){_0x459239[_0x8b25('0x3b')]=[{'all':!![]}];}return db[_0x8b25('0x26')][_0x8b25('0x3c')](_0x459239);})[_0x8b25('0x22')](function(_0x5c3afe){_0x2b4814[_0x8b25('0x3d')]=_0x5c3afe;return _0x2b4814;})[_0x8b25('0x22')](respondWithFilteredResult(_0x1c8a22,_0x459239))[_0x8b25('0x3e')](handleError(_0x1c8a22,null));};exports[_0x8b25('0x3f')]=function(_0x4df496,_0x4662f2){var _0x44c8ac={'raw':!![],'where':{'id':_0x4df496[_0x8b25('0x40')]['id']}},_0x255e2f={};_0x255e2f[_0x8b25('0x2d')]=_[_0x8b25('0x41')](db['CloudProvider'][_0x8b25('0x27')]);_0x255e2f['query']=_['keys'](_0x4df496[_0x8b25('0x30')]);_0x255e2f['filters']=_[_0x8b25('0x2c')](_0x255e2f['model'],_0x255e2f['query']);_0x44c8ac[_0x8b25('0x2e')]=_[_0x8b25('0x2c')](_0x255e2f['model'],qs[_0x8b25('0x2f')](_0x4df496[_0x8b25('0x30')][_0x8b25('0x2f')]));_0x44c8ac['attributes']=_0x44c8ac[_0x8b25('0x2e')][_0x8b25('0x31')]?_0x44c8ac['attributes']:_0x255e2f[_0x8b25('0x2d')];if(_0x4df496[_0x8b25('0x30')][_0x8b25('0x42')]){_0x44c8ac[_0x8b25('0x3b')]=[{'all':!![]}];}_0x44c8ac=_[_0x8b25('0x37')]({},_0x44c8ac,_0x4df496[_0x8b25('0x3a')]);return db['CloudProvider'][_0x8b25('0x43')](_0x44c8ac)[_0x8b25('0x22')](handleEntityNotFound(_0x4662f2,null))['then'](respondWithResult(_0x4662f2,null))['catch'](handleError(_0x4662f2,null));};exports[_0x8b25('0x44')]=function(_0x486141,_0x32c711){return db['CloudProvider'][_0x8b25('0x44')](_0x486141[_0x8b25('0x45')],{})['then'](respondWithResult(_0x32c711,0xc9))[_0x8b25('0x3e')](handleError(_0x32c711,null));};exports[_0x8b25('0x21')]=function(_0x15f1a6,_0x592e60){if(_0x15f1a6['body']['id']){delete _0x15f1a6[_0x8b25('0x45')]['id'];}return db[_0x8b25('0x26')][_0x8b25('0x43')]({'where':{'id':_0x15f1a6['params']['id']}})[_0x8b25('0x22')](handleEntityNotFound(_0x592e60,null))['then'](saveUpdates(_0x15f1a6[_0x8b25('0x45')],null))[_0x8b25('0x22')](respondWithResult(_0x592e60,null))[_0x8b25('0x3e')](handleError(_0x592e60,null));};exports['destroy']=function(_0x3e0739,_0x6adae3){return db[_0x8b25('0x26')][_0x8b25('0x43')]({'where':{'id':_0x3e0739[_0x8b25('0x40')]['id']}})[_0x8b25('0x22')](handleEntityNotFound(_0x6adae3,null))[_0x8b25('0x22')](removeEntity(_0x6adae3,null))[_0x8b25('0x3e')](handleError(_0x6adae3,null));}; \ No newline at end of file +var _0x1f52=['json','count','offset','limit','set','Content-Range','apply','reject','save','then','name','send','index','map','CloudProvider','rawAttributes','fieldName','model','keys','filters','intersection','attributes','fields','query','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','destroy','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0xfece2c,_0x351bf8){var _0x27c70c=function(_0x57c5c1){while(--_0x57c5c1){_0xfece2c['push'](_0xfece2c['shift']());}};_0x27c70c(++_0x351bf8);}(_0x1f52,0x74));var _0x21f5=function(_0x6088d5,_0xfaf001){_0x6088d5=_0x6088d5-0x0;var _0x57160b=_0x1f52[_0x6088d5];return _0x57160b;};'use strict';var pdf=require(_0x21f5('0x0'));var emlformat=require(_0x21f5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x21f5('0x2'));var jsonpatch=require(_0x21f5('0x3'));var rp=require(_0x21f5('0x4'));var moment=require('moment');var BPromise=require(_0x21f5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x21f5('0x6'));var csv=require(_0x21f5('0x7'));var ejs=require(_0x21f5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x21f5('0x9'));var squel=require('squel');var crypto=require(_0x21f5('0xa'));var jsforce=require(_0x21f5('0xb'));var deskjs=require(_0x21f5('0xc'));var toCsv=require(_0x21f5('0x7'));var querystring=require(_0x21f5('0xd'));var Papa=require(_0x21f5('0xe'));var Redis=require(_0x21f5('0xf'));var authService=require(_0x21f5('0x10'));var qs=require(_0x21f5('0x11'));var as=require(_0x21f5('0x12'));var hardwareService=require(_0x21f5('0x13'));var logger=require('../../config/logger')(_0x21f5('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x21f5('0x15'));var db=require(_0x21f5('0x16'))['db'];function respondWithStatusCode(_0x43fb75,_0x113d6d){_0x113d6d=_0x113d6d||0xcc;return function(_0x9716c3){if(_0x9716c3){return _0x43fb75[_0x21f5('0x17')](_0x113d6d);}return _0x43fb75[_0x21f5('0x18')](_0x113d6d)[_0x21f5('0x19')]();};}function respondWithResult(_0x4bb48e,_0x4493cf){_0x4493cf=_0x4493cf||0xc8;return function(_0x111338){if(_0x111338){return _0x4bb48e[_0x21f5('0x18')](_0x4493cf)[_0x21f5('0x1a')](_0x111338);}};}function respondWithFilteredResult(_0x40f713,_0x43074c){return function(_0x492cec){if(_0x492cec){var _0x7860cf=_0x492cec[_0x21f5('0x1b')],_0x5c2d9d=_0x43074c[_0x21f5('0x1c')],_0x213d6c=_0x43074c[_0x21f5('0x1c')]+_0x43074c[_0x21f5('0x1d')],_0x4fda91;if(_0x213d6c>=_0x7860cf){_0x213d6c=_0x7860cf;_0x4fda91=0xc8;}else{_0x4fda91=0xce;}_0x40f713['status'](_0x4fda91);return _0x40f713[_0x21f5('0x1e')](_0x21f5('0x1f'),_0x5c2d9d+'-'+_0x213d6c+'/'+_0x7860cf)[_0x21f5('0x1a')](_0x492cec);}return null;};}function patchUpdates(_0x5c8e47){return function(_0x1b9bf7){try{jsonpatch[_0x21f5('0x20')](_0x1b9bf7,_0x5c8e47,!![]);}catch(_0x4a24ff){return BPromise[_0x21f5('0x21')](_0x4a24ff);}return _0x1b9bf7[_0x21f5('0x22')]();};}function saveUpdates(_0x1549e4,_0x338218){return function(_0x3b4466){if(_0x3b4466){return _0x3b4466['update'](_0x1549e4)[_0x21f5('0x23')](function(_0x14deb0){return _0x14deb0;});}return null;};}function removeEntity(_0x4feefd,_0x14cc66){return function(_0x4309cf){if(_0x4309cf){return _0x4309cf['destroy']()[_0x21f5('0x23')](function(){_0x4feefd[_0x21f5('0x18')](0xcc)[_0x21f5('0x19')]();});}};}function handleEntityNotFound(_0x9ef1a6,_0x7337d8){return function(_0x102f56){if(!_0x102f56){_0x9ef1a6['sendStatus'](0x194);}return _0x102f56;};}function handleError(_0x2815db,_0x4b8757){_0x4b8757=_0x4b8757||0x1f4;return function(_0x2badc3){logger['error'](_0x2badc3['stack']);if(_0x2badc3[_0x21f5('0x24')]){delete _0x2badc3[_0x21f5('0x24')];}_0x2815db[_0x21f5('0x18')](_0x4b8757)[_0x21f5('0x25')](_0x2badc3);};}exports[_0x21f5('0x26')]=function(_0x5abeea,_0x50776a){var _0x3f4738={},_0x5c2e65={},_0x423362={'count':0x0,'rows':[]};var _0x38288b=_[_0x21f5('0x27')](db[_0x21f5('0x28')][_0x21f5('0x29')],function(_0x4d5348){return{'name':_0x4d5348[_0x21f5('0x2a')],'type':_0x4d5348['type']['key']};});_0x5c2e65[_0x21f5('0x2b')]=_[_0x21f5('0x27')](_0x38288b,_0x21f5('0x24'));_0x5c2e65['query']=_[_0x21f5('0x2c')](_0x5abeea['query']);_0x5c2e65[_0x21f5('0x2d')]=_[_0x21f5('0x2e')](_0x5c2e65[_0x21f5('0x2b')],_0x5c2e65['query']);_0x3f4738[_0x21f5('0x2f')]=_['intersection'](_0x5c2e65[_0x21f5('0x2b')],qs[_0x21f5('0x30')](_0x5abeea[_0x21f5('0x31')][_0x21f5('0x30')]));_0x3f4738[_0x21f5('0x2f')]=_0x3f4738['attributes'][_0x21f5('0x32')]?_0x3f4738[_0x21f5('0x2f')]:_0x5c2e65['model'];if(!_0x5abeea[_0x21f5('0x31')]['hasOwnProperty'](_0x21f5('0x33'))){_0x3f4738[_0x21f5('0x1d')]=qs[_0x21f5('0x1d')](_0x5abeea['query'][_0x21f5('0x1d')]);_0x3f4738[_0x21f5('0x1c')]=qs[_0x21f5('0x1c')](_0x5abeea['query'][_0x21f5('0x1c')]);}_0x3f4738[_0x21f5('0x34')]=qs[_0x21f5('0x35')](_0x5abeea['query'][_0x21f5('0x35')]);_0x3f4738[_0x21f5('0x36')]=qs['filters'](_[_0x21f5('0x37')](_0x5abeea['query'],_0x5c2e65[_0x21f5('0x2d')]),_0x38288b);if(_0x5abeea['query'][_0x21f5('0x38')]){_0x3f4738['where']=_[_0x21f5('0x39')](_0x3f4738[_0x21f5('0x36')],{'$or':_[_0x21f5('0x27')](_0x38288b,function(_0x843571){if(_0x843571[_0x21f5('0x3a')]!==_0x21f5('0x3b')){var _0x22c3eb={};_0x22c3eb[_0x843571[_0x21f5('0x24')]]={'$like':'%'+_0x5abeea[_0x21f5('0x31')][_0x21f5('0x38')]+'%'};return _0x22c3eb;}})});}_0x3f4738=_[_0x21f5('0x39')]({},_0x3f4738,_0x5abeea[_0x21f5('0x3c')]);var _0x284fdb={'where':_0x3f4738[_0x21f5('0x36')]};return db[_0x21f5('0x28')][_0x21f5('0x1b')](_0x284fdb)[_0x21f5('0x23')](function(_0x126d37){_0x423362[_0x21f5('0x1b')]=_0x126d37;if(_0x5abeea[_0x21f5('0x31')][_0x21f5('0x3d')]){_0x3f4738[_0x21f5('0x3e')]=[{'all':!![]}];}return db['CloudProvider'][_0x21f5('0x3f')](_0x3f4738);})[_0x21f5('0x23')](function(_0xc9d00b){_0x423362[_0x21f5('0x40')]=_0xc9d00b;return _0x423362;})['then'](respondWithFilteredResult(_0x50776a,_0x3f4738))[_0x21f5('0x41')](handleError(_0x50776a,null));};exports['show']=function(_0x90ef4,_0x42590a){var _0x11271a={'raw':!![],'where':{'id':_0x90ef4['params']['id']}},_0x13cdff={};_0x13cdff[_0x21f5('0x2b')]=_[_0x21f5('0x2c')](db[_0x21f5('0x28')][_0x21f5('0x29')]);_0x13cdff[_0x21f5('0x31')]=_[_0x21f5('0x2c')](_0x90ef4['query']);_0x13cdff[_0x21f5('0x2d')]=_[_0x21f5('0x2e')](_0x13cdff[_0x21f5('0x2b')],_0x13cdff[_0x21f5('0x31')]);_0x11271a[_0x21f5('0x2f')]=_[_0x21f5('0x2e')](_0x13cdff[_0x21f5('0x2b')],qs[_0x21f5('0x30')](_0x90ef4[_0x21f5('0x31')][_0x21f5('0x30')]));_0x11271a[_0x21f5('0x2f')]=_0x11271a['attributes']['length']?_0x11271a['attributes']:_0x13cdff[_0x21f5('0x2b')];if(_0x90ef4[_0x21f5('0x31')][_0x21f5('0x3d')]){_0x11271a[_0x21f5('0x3e')]=[{'all':!![]}];}_0x11271a=_[_0x21f5('0x39')]({},_0x11271a,_0x90ef4[_0x21f5('0x3c')]);return db[_0x21f5('0x28')][_0x21f5('0x42')](_0x11271a)[_0x21f5('0x23')](handleEntityNotFound(_0x42590a,null))[_0x21f5('0x23')](respondWithResult(_0x42590a,null))[_0x21f5('0x41')](handleError(_0x42590a,null));};exports[_0x21f5('0x43')]=function(_0x2f80c7,_0xa30139){return db['CloudProvider']['create'](_0x2f80c7[_0x21f5('0x44')],{})[_0x21f5('0x23')](respondWithResult(_0xa30139,0xc9))[_0x21f5('0x41')](handleError(_0xa30139,null));};exports['update']=function(_0x44c0d5,_0x4a4693){if(_0x44c0d5[_0x21f5('0x44')]['id']){delete _0x44c0d5['body']['id'];}return db[_0x21f5('0x28')][_0x21f5('0x42')]({'where':{'id':_0x44c0d5['params']['id']}})[_0x21f5('0x23')](handleEntityNotFound(_0x4a4693,null))[_0x21f5('0x23')](saveUpdates(_0x44c0d5[_0x21f5('0x44')],null))[_0x21f5('0x23')](respondWithResult(_0x4a4693,null))[_0x21f5('0x41')](handleError(_0x4a4693,null));};exports[_0x21f5('0x45')]=function(_0x4af98d,_0x41484c){return db['CloudProvider']['find']({'where':{'id':_0x4af98d[_0x21f5('0x46')]['id']}})[_0x21f5('0x23')](handleEntityNotFound(_0x41484c,null))['then'](removeEntity(_0x41484c,null))['catch'](handleError(_0x41484c,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 7913678..55916f3 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 _0x4f54=['../../config/environment','./cloudProvider.attributes','exports','define','cloud_providers','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1a3e8f,_0x8b9906){var _0x314ee8=function(_0x51ceb4){while(--_0x51ceb4){_0x1a3e8f['push'](_0x1a3e8f['shift']());}};_0x314ee8(++_0x8b9906);}(_0x4f54,0x18b));var _0x44f5=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x4f54[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x44f5('0x0'));var util=require(_0x44f5('0x1'));var logger=require('../../config/logger')(_0x44f5('0x2'));var moment=require(_0x44f5('0x3'));var BPromise=require(_0x44f5('0x4'));var rp=require(_0x44f5('0x5'));var fs=require('fs');var path=require(_0x44f5('0x6'));var rimraf=require(_0x44f5('0x7'));var config=require(_0x44f5('0x8'));var attributes=require(_0x44f5('0x9'));module[_0x44f5('0xa')]=function(_0x5bc0be,_0x2cf6ad){return _0x5bc0be[_0x44f5('0xb')]('CloudProvider',attributes,{'tableName':_0x44f5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf8a7=['exports','define','CloudProvider','util','api','moment','request-promise','rimraf','./cloudProvider.attributes'];(function(_0x227b64,_0x1c6f72){var _0xc84cb5=function(_0x12e690){while(--_0x12e690){_0x227b64['push'](_0x227b64['shift']());}};_0xc84cb5(++_0x1c6f72);}(_0xf8a7,0x147));var _0x7f8a=function(_0x6b09f6,_0x869c74){_0x6b09f6=_0x6b09f6-0x0;var _0x29903b=_0xf8a7[_0x6b09f6];return _0x29903b;};'use strict';var _=require('lodash');var util=require(_0x7f8a('0x0'));var logger=require('../../config/logger')(_0x7f8a('0x1'));var moment=require(_0x7f8a('0x2'));var BPromise=require('bluebird');var rp=require(_0x7f8a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7f8a('0x4'));var config=require('../../config/environment');var attributes=require(_0x7f8a('0x5'));module[_0x7f8a('0x6')]=function(_0x5de62e,_0x1b8ca9){return _0x5de62e[_0x7f8a('0x7')](_0x7f8a('0x8'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 325975e..ba5a734 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 _0x7aa8=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','CloudProvider,\x20%s,\x20%s','message','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3e78f8,_0xe3a862){var _0x13e073=function(_0x1b4e0c){while(--_0x1b4e0c){_0x3e78f8['push'](_0x3e78f8['shift']());}};_0x13e073(++_0xe3a862);}(_0x7aa8,0x1c7));var _0x87aa=function(_0x6d485d,_0x2c9596){_0x6d485d=_0x6d485d-0x0;var _0x2700fe=_0x7aa8[_0x6d485d];return _0x2700fe;};'use strict';var _=require(_0x87aa('0x0'));var util=require(_0x87aa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x87aa('0x2'));var db=require(_0x87aa('0x3'))['db'];var utils=require(_0x87aa('0x4'));var logger=require(_0x87aa('0x5'))(_0x87aa('0x6'));var config=require(_0x87aa('0x7'));var jayson=require(_0x87aa('0x8'));var client=jayson[_0x87aa('0x9')][_0x87aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a1bef,_0x1acca9,_0x353920){return new BPromise(function(_0x524da4,_0x3514ee){return client[_0x87aa('0xb')](_0x1a1bef,_0x353920)[_0x87aa('0xc')](function(_0x5c1eda){logger[_0x87aa('0xd')]('CloudProvider,\x20%s,\x20%s',_0x1acca9,_0x87aa('0xe'));logger[_0x87aa('0xf')](_0x87aa('0x10'),_0x1acca9,_0x87aa('0xe'),JSON['stringify'](_0x5c1eda));if(_0x5c1eda['error']){if(_0x5c1eda[_0x87aa('0x11')][_0x87aa('0x12')]===0x1f4){logger['error'](_0x87aa('0x13'),_0x1acca9,_0x5c1eda[_0x87aa('0x11')][_0x87aa('0x14')]);return _0x3514ee(_0x5c1eda[_0x87aa('0x11')][_0x87aa('0x14')]);}logger[_0x87aa('0x11')](_0x87aa('0x13'),_0x1acca9,_0x5c1eda['error']['message']);return _0x524da4(_0x5c1eda['error'][_0x87aa('0x14')]);}else{logger[_0x87aa('0xd')](_0x87aa('0x13'),_0x1acca9,'request\x20sent');_0x524da4(_0x5c1eda['result'][_0x87aa('0x14')]);}})[_0x87aa('0x15')](function(_0x19f1d1){logger[_0x87aa('0x11')](_0x87aa('0x13'),_0x1acca9,_0x19f1d1);_0x3514ee(_0x19f1d1);});});} \ No newline at end of file +var _0x31d2=['info','CloudProvider,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x3e3c7a,_0x381151){var _0x25436a=function(_0x44f95c){while(--_0x44f95c){_0x3e3c7a['push'](_0x3e3c7a['shift']());}};_0x25436a(++_0x381151);}(_0x31d2,0xe5));var _0x231d=function(_0x25b558,_0x18c669){_0x25b558=_0x25b558-0x0;var _0x3c2769=_0x31d2[_0x25b558];return _0x3c2769;};'use strict';var _=require('lodash');var util=require(_0x231d('0x0'));var moment=require('moment');var BPromise=require(_0x231d('0x1'));var rs=require(_0x231d('0x2'));var fs=require('fs');var Redis=require(_0x231d('0x3'));var db=require(_0x231d('0x4'))['db'];var utils=require(_0x231d('0x5'));var logger=require('../../config/logger')(_0x231d('0x6'));var config=require(_0x231d('0x7'));var jayson=require(_0x231d('0x8'));var client=jayson[_0x231d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f13be,_0x250ed5,_0x295b05){return new BPromise(function(_0x4a543f,_0x2f9190){return client[_0x231d('0xa')](_0x3f13be,_0x295b05)['then'](function(_0x174256){logger[_0x231d('0xb')](_0x231d('0xc'),_0x250ed5,_0x231d('0xd'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x250ed5,_0x231d('0xd'),JSON[_0x231d('0xe')](_0x174256));if(_0x174256['error']){if(_0x174256[_0x231d('0xf')][_0x231d('0x10')]===0x1f4){logger[_0x231d('0xf')](_0x231d('0xc'),_0x250ed5,_0x174256[_0x231d('0xf')][_0x231d('0x11')]);return _0x2f9190(_0x174256[_0x231d('0xf')][_0x231d('0x11')]);}logger[_0x231d('0xf')](_0x231d('0xc'),_0x250ed5,_0x174256['error'][_0x231d('0x11')]);return _0x4a543f(_0x174256[_0x231d('0xf')][_0x231d('0x11')]);}else{logger[_0x231d('0xb')](_0x231d('0xc'),_0x250ed5,_0x231d('0xd'));_0x4a543f(_0x174256[_0x231d('0x12')][_0x231d('0x11')]);}})[_0x231d('0x13')](function(_0x213710){logger[_0x231d('0xf')]('CloudProvider,\x20%s,\x20%s',_0x250ed5,_0x213710);_0x2f9190(_0x213710);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 53dc35b..7b279d7 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 _0x426a=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x426a,0x6b));var _0xa426=function(_0x497871,_0x3b4377){_0x497871=_0x497871-0x0;var _0x317904=_0x426a[_0x497871];return _0x317904;};'use strict';var multer=require(_0xa426('0x0'));var util=require(_0xa426('0x1'));var path=require(_0xa426('0x2'));var timeout=require(_0xa426('0x3'));var express=require(_0xa426('0x4'));var router=express['Router']();var fs_extra=require(_0xa426('0x5'));var auth=require(_0xa426('0x6'));var interaction=require(_0xa426('0x7'));var config=require(_0xa426('0x8'));var controller=require(_0xa426('0x9'));router[_0xa426('0xa')]('/',auth[_0xa426('0xb')](),controller[_0xa426('0xc')]);router[_0xa426('0xa')](_0xa426('0xd'),auth[_0xa426('0xb')](),controller[_0xa426('0xe')]);router[_0xa426('0xf')]('/',auth[_0xa426('0xb')](),controller[_0xa426('0x10')]);router[_0xa426('0x11')](_0xa426('0xd'),auth[_0xa426('0xb')](),controller[_0xa426('0x12')]);router[_0xa426('0x13')](_0xa426('0xd'),auth[_0xa426('0xb')](),controller[_0xa426('0x14')]);module[_0xa426('0x15')]=router; \ No newline at end of file +var _0x49a1=['multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','create','put','/:id','update','destroy','exports'];(function(_0x149155,_0x4668d9){var _0x154d7a=function(_0xa1a287){while(--_0xa1a287){_0x149155['push'](_0x149155['shift']());}};_0x154d7a(++_0x4668d9);}(_0x49a1,0x190));var _0x149a=function(_0x4ac58f,_0x4c18f7){_0x4ac58f=_0x4ac58f-0x0;var _0x5c9a88=_0x49a1[_0x4ac58f];return _0x5c9a88;};'use strict';var multer=require(_0x149a('0x0'));var util=require(_0x149a('0x1'));var path=require(_0x149a('0x2'));var timeout=require(_0x149a('0x3'));var express=require(_0x149a('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x149a('0x5'));var config=require(_0x149a('0x6'));var controller=require('./cloudProvider.controller');router[_0x149a('0x7')]('/',auth[_0x149a('0x8')](),controller['index']);router[_0x149a('0x7')]('/:id',auth[_0x149a('0x8')](),controller[_0x149a('0x9')]);router['post']('/',auth[_0x149a('0x8')](),controller[_0x149a('0xa')]);router[_0x149a('0xb')](_0x149a('0xc'),auth[_0x149a('0x8')](),controller[_0x149a('0xd')]);router['delete']('/:id',auth[_0x149a('0x8')](),controller[_0x149a('0xe')]);module[_0x149a('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 470dd12..651d890 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 _0xc516=['sequelize','exports','STRING'];(function(_0x241c50,_0x1083b4){var _0x542512=function(_0xdbd7a8){while(--_0xdbd7a8){_0x241c50['push'](_0x241c50['shift']());}};_0x542512(++_0x1083b4);}(_0xc516,0x8a));var _0x6c51=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0xc516[_0xbeb808];return _0x5d6909;};'use strict';var Sequelize=require(_0x6c51('0x0'));module[_0x6c51('0x1')]={'name':{'type':Sequelize[_0x6c51('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x6c51('0x2')]},'companyId':{'type':Sequelize[_0x6c51('0x2')]},'website':{'type':Sequelize[_0x6c51('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x6c51('0x2')]},'type':{'type':Sequelize[_0x6c51('0x2')]},'street':{'type':Sequelize[_0x6c51('0x2')]},'postalCode':{'type':Sequelize[_0x6c51('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x6c51('0x2')]},'email':{'type':Sequelize[_0x6c51('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x6c51('0x2')]},'sPostalCode':{'type':Sequelize[_0x6c51('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x6c51('0x2')]},'description':{'type':Sequelize[_0x6c51('0x2')]}}; \ No newline at end of file +var _0xfb6c=['name','STRING','sequelize'];(function(_0x15fce8,_0x7612b7){var _0x3f54aa=function(_0x4c1752){while(--_0x4c1752){_0x15fce8['push'](_0x15fce8['shift']());}};_0x3f54aa(++_0x7612b7);}(_0xfb6c,0x152));var _0xcfb6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfb6c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xcfb6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xcfb6('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0xcfb6('0x2')]},'website':{'type':Sequelize[_0xcfb6('0x2')]},'phone':{'type':Sequelize[_0xcfb6('0x2')]},'fax':{'type':Sequelize[_0xcfb6('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xcfb6('0x2')]},'postalCode':{'type':Sequelize[_0xcfb6('0x2')]},'city':{'type':Sequelize[_0xcfb6('0x2')]},'country':{'type':Sequelize[_0xcfb6('0x2')]},'email':{'type':Sequelize[_0xcfb6('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xcfb6('0x2')]},'sStreet':{'type':Sequelize[_0xcfb6('0x2')]},'sPostalCode':{'type':Sequelize[_0xcfb6('0x2')]},'sCity':{'type':Sequelize[_0xcfb6('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 39c37de..4afa02a 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 _0x9ee6=['sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','Companies','destroy','stack','name','send','index','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','options','CmCompany','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addContacts','CmContact','ids','findOne','sort','map','eml-format','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9ee6,0x94));var _0x69ee=function(_0x4bacb6,_0x2b299d){_0x4bacb6=_0x4bacb6-0x0;var _0x58c029=_0x9ee6[_0x4bacb6];return _0x58c029;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x69ee('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x69ee('0x1'));var rp=require('request-promise');var moment=require(_0x69ee('0x2'));var BPromise=require(_0x69ee('0x3'));var Mustache=require(_0x69ee('0x4'));var util=require(_0x69ee('0x5'));var path=require(_0x69ee('0x6'));var sox=require('sox');var csv=require(_0x69ee('0x7'));var ejs=require(_0x69ee('0x8'));var fs=require('fs');var fs_extra=require(_0x69ee('0x9'));var _=require(_0x69ee('0xa'));var squel=require(_0x69ee('0xb'));var crypto=require(_0x69ee('0xc'));var jsforce=require(_0x69ee('0xd'));var deskjs=require(_0x69ee('0xe'));var toCsv=require(_0x69ee('0x7'));var querystring=require(_0x69ee('0xf'));var Papa=require(_0x69ee('0x10'));var Redis=require(_0x69ee('0x11'));var authService=require(_0x69ee('0x12'));var qs=require(_0x69ee('0x13'));var as=require(_0x69ee('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x69ee('0x15'))('api');var utils=require(_0x69ee('0x16'));var config=require(_0x69ee('0x17'));var licenseUtil=require(_0x69ee('0x18'));var db=require(_0x69ee('0x19'))['db'];function respondWithStatusCode(_0x72b6c5,_0x3d19a5){_0x3d19a5=_0x3d19a5||0xcc;return function(_0x5b9c94){if(_0x5b9c94){return _0x72b6c5[_0x69ee('0x1a')](_0x3d19a5);}return _0x72b6c5[_0x69ee('0x1b')](_0x3d19a5)[_0x69ee('0x1c')]();};}function respondWithResult(_0x5bae3f,_0x4b6902){_0x4b6902=_0x4b6902||0xc8;return function(_0x57da68){if(_0x57da68){return _0x5bae3f[_0x69ee('0x1b')](_0x4b6902)[_0x69ee('0x1d')](_0x57da68);}};}function respondWithFilteredResult(_0x4e39a7,_0x263a4a){return function(_0x4cc1b4){if(_0x4cc1b4){var _0x4b8c8a=_0x4cc1b4[_0x69ee('0x1e')],_0x5c4aed=_0x263a4a[_0x69ee('0x1f')],_0x2685ca=_0x263a4a['offset']+_0x263a4a[_0x69ee('0x20')],_0xde4cf6;if(_0x2685ca>=_0x4b8c8a){_0x2685ca=_0x4b8c8a;_0xde4cf6=0xc8;}else{_0xde4cf6=0xce;}_0x4e39a7[_0x69ee('0x1b')](_0xde4cf6);return _0x4e39a7[_0x69ee('0x21')](_0x69ee('0x22'),_0x5c4aed+'-'+_0x2685ca+'/'+_0x4b8c8a)[_0x69ee('0x1d')](_0x4cc1b4);}return null;};}function patchUpdates(_0x583bd0){return function(_0x3d86e1){try{jsonpatch[_0x69ee('0x23')](_0x3d86e1,_0x583bd0,!![]);}catch(_0x219a1a){return BPromise[_0x69ee('0x24')](_0x219a1a);}return _0x3d86e1[_0x69ee('0x25')]();};}function saveUpdates(_0x183d76,_0x6b3a52){return function(_0x47782a){if(_0x47782a){return _0x47782a[_0x69ee('0x26')](_0x183d76)[_0x69ee('0x27')](function(_0x4b62bc){return _0x4b62bc;});}return null;};}function removeEntity(_0x5a17a5,_0x185e9b){return function(_0x5b8a9f){if(_0x5b8a9f){return _0x5b8a9f['destroy']()[_0x69ee('0x27')](function(){var _0x319428=_0x5b8a9f[_0x69ee('0x28')]({'plain':!![]});var _0x4465ae=_0x69ee('0x29');return db['UserProfileResource'][_0x69ee('0x2a')]({'where':{'type':_0x4465ae,'resourceId':_0x319428['id']}})[_0x69ee('0x27')](function(){return _0x5b8a9f;});})[_0x69ee('0x27')](function(){_0x5a17a5[_0x69ee('0x1b')](0xcc)[_0x69ee('0x1c')]();});}};}function handleEntityNotFound(_0x2aeb1e,_0x759b4f){return function(_0xcabf09){if(!_0xcabf09){_0x2aeb1e[_0x69ee('0x1a')](0x194);}return _0xcabf09;};}function handleError(_0x3c34f7,_0x160151){_0x160151=_0x160151||0x1f4;return function(_0x3e7280){logger['error'](_0x3e7280[_0x69ee('0x2b')]);if(_0x3e7280[_0x69ee('0x2c')]){delete _0x3e7280[_0x69ee('0x2c')];}_0x3c34f7[_0x69ee('0x1b')](_0x160151)[_0x69ee('0x2d')](_0x3e7280);};}exports[_0x69ee('0x2e')]=function(_0x5ceaf8,_0x4a757c){var _0x33ffd8={},_0x48d291={},_0x484698={'count':0x0,'rows':[]};return db['CmCompany'][_0x69ee('0x2f')]()[_0x69ee('0x27')](function(_0x524f1a){_0x48d291[_0x69ee('0x30')]=_[_0x69ee('0x31')](_0x524f1a);_0x48d291['query']=_[_0x69ee('0x31')](_0x5ceaf8[_0x69ee('0x32')]);_0x48d291[_0x69ee('0x33')]=_[_0x69ee('0x34')](_0x48d291[_0x69ee('0x30')],_0x48d291[_0x69ee('0x32')]);_0x33ffd8[_0x69ee('0x35')]=_[_0x69ee('0x34')](_0x48d291[_0x69ee('0x30')],qs[_0x69ee('0x36')](_0x5ceaf8[_0x69ee('0x32')]['fields']));_0x33ffd8[_0x69ee('0x35')]=_0x33ffd8[_0x69ee('0x35')][_0x69ee('0x37')]?_0x33ffd8[_0x69ee('0x35')]:_0x48d291[_0x69ee('0x30')];if(!_0x5ceaf8[_0x69ee('0x32')][_0x69ee('0x38')](_0x69ee('0x39'))){_0x33ffd8[_0x69ee('0x20')]=qs[_0x69ee('0x20')](_0x5ceaf8[_0x69ee('0x32')]['limit']);_0x33ffd8[_0x69ee('0x1f')]=qs[_0x69ee('0x1f')](_0x5ceaf8[_0x69ee('0x32')][_0x69ee('0x1f')]);}_0x33ffd8[_0x69ee('0x3a')]=qs['sort'](_0x5ceaf8['query']['sort']);_0x33ffd8['where']=qs[_0x69ee('0x33')](_[_0x69ee('0x3b')](_0x5ceaf8[_0x69ee('0x32')],_0x48d291[_0x69ee('0x33')]),_0x524f1a);if(_0x5ceaf8['query'][_0x69ee('0x3c')]){_0x33ffd8[_0x69ee('0x3d')]=_['merge'](_0x33ffd8[_0x69ee('0x3d')],{'$or':_['map'](_0x33ffd8[_0x69ee('0x35')],function(_0x2d0c33){var _0x955e6={};_0x955e6[_0x2d0c33]={'$like':'%'+_0x5ceaf8['query'][_0x69ee('0x3c')]+'%'};return _0x955e6;})});}_0x33ffd8=_[_0x69ee('0x3e')]({},_0x33ffd8,_0x5ceaf8[_0x69ee('0x3f')]);var _0xcc99b={'where':_0x33ffd8[_0x69ee('0x3d')]};return db[_0x69ee('0x40')][_0x69ee('0x1e')](_0xcc99b)[_0x69ee('0x27')](function(_0x5be400){_0x484698[_0x69ee('0x1e')]=_0x5be400;if(_0x5ceaf8['query'][_0x69ee('0x41')]){_0x33ffd8['include']=[{'all':!![]}];}return db[_0x69ee('0x40')][_0x69ee('0x42')](_0x33ffd8);})[_0x69ee('0x27')](function(_0x11e64d){_0x484698[_0x69ee('0x43')]=_0x11e64d;return _0x484698;})['then'](respondWithFilteredResult(_0x4a757c,_0x33ffd8))[_0x69ee('0x44')](handleError(_0x4a757c,null));})['catch'](handleError(_0x4a757c,null));};exports[_0x69ee('0x45')]=function(_0x4a3150,_0x536106){var _0x535a54={'raw':![],'where':{'id':_0x4a3150['params']['id']}},_0x132f4a={};_0x132f4a[_0x69ee('0x30')]=_[_0x69ee('0x31')](db[_0x69ee('0x40')][_0x69ee('0x46')]);_0x132f4a['query']=_['keys'](_0x4a3150[_0x69ee('0x32')]);_0x132f4a[_0x69ee('0x33')]=_[_0x69ee('0x34')](_0x132f4a['model'],_0x132f4a[_0x69ee('0x32')]);_0x535a54[_0x69ee('0x35')]=_['intersection'](_0x132f4a[_0x69ee('0x30')],qs['fields'](_0x4a3150[_0x69ee('0x32')][_0x69ee('0x36')]));_0x535a54[_0x69ee('0x35')]=_0x535a54[_0x69ee('0x35')]['length']?_0x535a54[_0x69ee('0x35')]:_0x132f4a[_0x69ee('0x30')];if(_0x4a3150[_0x69ee('0x32')][_0x69ee('0x41')]){_0x535a54[_0x69ee('0x47')]=[{'all':!![]}];}_0x535a54=_[_0x69ee('0x3e')]({},_0x535a54,_0x4a3150[_0x69ee('0x3f')]);return db[_0x69ee('0x40')][_0x69ee('0x48')](_0x535a54)[_0x69ee('0x27')](handleEntityNotFound(_0x536106,null))[_0x69ee('0x27')](respondWithResult(_0x536106,null))['catch'](handleError(_0x536106,null));};exports[_0x69ee('0x49')]=function(_0x36324a,_0x346401){return db[_0x69ee('0x40')][_0x69ee('0x49')](_0x36324a['body'],{})[_0x69ee('0x27')](function(_0x23276e){var _0x3aef3e=_0x36324a['user'][_0x69ee('0x28')]({'plain':!![]});if(!_0x3aef3e)throw new Error(_0x69ee('0x4a'));if(_0x3aef3e['role']==='user'){var _0x1e9af5=_0x23276e[_0x69ee('0x28')]({'plain':!![]});var _0x177cec=_0x69ee('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x177cec,'userProfileId':_0x3aef3e[_0x69ee('0x4b')]},'raw':!![]})[_0x69ee('0x27')](function(_0x3bc183){if(_0x3bc183&&_0x3bc183['autoAssociation']===0x0){return db[_0x69ee('0x4c')]['create']({'name':_0x1e9af5[_0x69ee('0x2c')],'resourceId':_0x1e9af5['id'],'type':_0x3bc183[_0x69ee('0x2c')],'sectionId':_0x3bc183['id']},{})[_0x69ee('0x27')](function(){return _0x23276e;});}else{return _0x23276e;}})[_0x69ee('0x44')](function(_0x3c98c4){logger[_0x69ee('0x4d')](_0x69ee('0x4e'),_0x3c98c4);throw _0x3c98c4;});}return _0x23276e;})[_0x69ee('0x27')](respondWithResult(_0x346401,0xc9))[_0x69ee('0x44')](handleError(_0x346401,null));};exports[_0x69ee('0x26')]=function(_0xf6f7ce,_0x58861a){if(_0xf6f7ce['body']['id']){delete _0xf6f7ce[_0x69ee('0x4f')]['id'];}return db[_0x69ee('0x40')][_0x69ee('0x48')]({'where':{'id':_0xf6f7ce[_0x69ee('0x50')]['id']}})[_0x69ee('0x27')](handleEntityNotFound(_0x58861a,null))[_0x69ee('0x27')](saveUpdates(_0xf6f7ce[_0x69ee('0x4f')],null))['then'](respondWithResult(_0x58861a,null))[_0x69ee('0x44')](handleError(_0x58861a,null));};exports['destroy']=function(_0x22a90b,_0x461904){return db[_0x69ee('0x40')][_0x69ee('0x48')]({'where':{'id':_0x22a90b[_0x69ee('0x50')]['id']}})[_0x69ee('0x27')](handleEntityNotFound(_0x461904,null))['then'](removeEntity(_0x461904,null))['catch'](handleError(_0x461904,null));};exports['describe']=function(_0x5e062c,_0x23aaf7){return db[_0x69ee('0x40')][_0x69ee('0x2f')]()[_0x69ee('0x27')](respondWithResult(_0x23aaf7,null))[_0x69ee('0x44')](handleError(_0x23aaf7,null));};exports[_0x69ee('0x51')]=function(_0xb58faa,_0x35472b,_0x2bc38f){return db[_0x69ee('0x52')][_0x69ee('0x48')]({'where':{'id':_0xb58faa[_0x69ee('0x50')]['id']}})['then'](handleEntityNotFound(_0x35472b,null))[_0x69ee('0x27')](function(_0x2a1ae9){if(_0x2a1ae9){return _0x2a1ae9['addContacts'](_0xb58faa[_0x69ee('0x4f')][_0x69ee('0x53')],_['omit'](_0xb58faa[_0x69ee('0x4f')],['ids','id'])||{});}})[_0x69ee('0x27')](respondWithResult(_0x35472b,null))[_0x69ee('0x44')](handleError(_0x35472b,null));};exports['getContacts']=function(_0x42b2a0,_0x46fa14,_0x49bf2a){var _0x5a55d4={};var _0x360235={};var _0x20ef17;var _0x3308d3;return db['CmCompany'][_0x69ee('0x54')]({'where':{'id':_0x42b2a0['params']['id']}})[_0x69ee('0x27')](handleEntityNotFound(_0x46fa14,null))[_0x69ee('0x27')](function(_0x516eba){if(_0x516eba){_0x20ef17=_0x516eba;_0x360235['model']=_['keys'](db['CmContact'][_0x69ee('0x46')]);_0x360235['query']=_[_0x69ee('0x31')](_0x42b2a0[_0x69ee('0x32')]);_0x360235[_0x69ee('0x33')]=_['intersection'](_0x360235['model'],_0x360235['query']);_0x5a55d4['attributes']=_[_0x69ee('0x34')](_0x360235[_0x69ee('0x30')],qs[_0x69ee('0x36')](_0x42b2a0[_0x69ee('0x32')]['fields']));_0x5a55d4[_0x69ee('0x35')]=_0x5a55d4[_0x69ee('0x35')][_0x69ee('0x37')]?_0x5a55d4[_0x69ee('0x35')]:_0x360235[_0x69ee('0x30')];_0x5a55d4[_0x69ee('0x3a')]=qs[_0x69ee('0x55')](_0x42b2a0[_0x69ee('0x32')]['sort']);_0x5a55d4[_0x69ee('0x3d')]=qs[_0x69ee('0x33')](_['pick'](_0x42b2a0['query'],_0x360235[_0x69ee('0x33')]));if(_0x42b2a0[_0x69ee('0x32')][_0x69ee('0x3c')]){_0x5a55d4[_0x69ee('0x3d')]=_[_0x69ee('0x3e')](_0x5a55d4[_0x69ee('0x3d')],{'$or':_[_0x69ee('0x56')](_0x5a55d4[_0x69ee('0x35')],function(_0xb55596){var _0x511de1={};_0x511de1[_0xb55596]={'$like':'%'+_0x42b2a0['query'][_0x69ee('0x3c')]+'%'};return _0x511de1;})});}_0x5a55d4=_[_0x69ee('0x3e')]({},_0x5a55d4,_0x42b2a0[_0x69ee('0x3f')]);return _0x20ef17['getContacts'](_0x5a55d4);}})[_0x69ee('0x27')](function(_0x35f464){if(_0x35f464){_0x3308d3=_0x35f464[_0x69ee('0x37')];if(!_0x42b2a0[_0x69ee('0x32')][_0x69ee('0x38')](_0x69ee('0x39'))){_0x5a55d4['limit']=qs['limit'](_0x42b2a0[_0x69ee('0x32')][_0x69ee('0x20')]);_0x5a55d4[_0x69ee('0x1f')]=qs[_0x69ee('0x1f')](_0x42b2a0[_0x69ee('0x32')]['offset']);}return _0x20ef17['getContacts'](_0x5a55d4);}})[_0x69ee('0x27')](function(_0xe9a3ab){if(_0xe9a3ab){return _0xe9a3ab?{'count':_0x3308d3,'rows':_0xe9a3ab}:null;}})['then'](respondWithResult(_0x46fa14,null))[_0x69ee('0x44')](handleError(_0x46fa14,null));}; \ No newline at end of file +var _0x1a8f=['json','apply','save','destroy','get','Companies','UserProfileResource','then','error','stack','name','CmCompany','describe','model','query','keys','filters','intersection','attributes','fields','order','sort','merge','map','filter','options','where','include','findAll','rows','catch','show','params','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','CmContact','addContacts','ids','getContacts','pick','hasOwnProperty','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range'];(function(_0x152256,_0x28772e){var _0x2ebc99=function(_0x28c063){while(--_0x28c063){_0x152256['push'](_0x152256['shift']());}};_0x2ebc99(++_0x28772e);}(_0x1a8f,0x88));var _0xf1a8=function(_0x1df378,_0x2c4af3){_0x1df378=_0x1df378-0x0;var _0x2cb9fe=_0x1a8f[_0x1df378];return _0x2cb9fe;};'use strict';var pdf=require(_0xf1a8('0x0'));var emlformat=require(_0xf1a8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf1a8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf1a8('0x3'));var moment=require(_0xf1a8('0x4'));var BPromise=require(_0xf1a8('0x5'));var Mustache=require('mustache');var util=require(_0xf1a8('0x6'));var path=require(_0xf1a8('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf1a8('0x8'));var fs=require('fs');var fs_extra=require(_0xf1a8('0x9'));var _=require(_0xf1a8('0xa'));var squel=require(_0xf1a8('0xb'));var crypto=require(_0xf1a8('0xc'));var jsforce=require(_0xf1a8('0xd'));var deskjs=require(_0xf1a8('0xe'));var toCsv=require(_0xf1a8('0xf'));var querystring=require(_0xf1a8('0x10'));var Papa=require(_0xf1a8('0x11'));var Redis=require(_0xf1a8('0x12'));var authService=require(_0xf1a8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xf1a8('0x14'));var hardwareService=require(_0xf1a8('0x15'));var logger=require(_0xf1a8('0x16'))(_0xf1a8('0x17'));var utils=require(_0xf1a8('0x18'));var config=require(_0xf1a8('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32b22b,_0x2151ab){_0x2151ab=_0x2151ab||0xcc;return function(_0x5e28f0){if(_0x5e28f0){return _0x32b22b[_0xf1a8('0x1a')](_0x2151ab);}return _0x32b22b[_0xf1a8('0x1b')](_0x2151ab)[_0xf1a8('0x1c')]();};}function respondWithResult(_0x1fedf3,_0x110e06){_0x110e06=_0x110e06||0xc8;return function(_0x78b03a){if(_0x78b03a){return _0x1fedf3[_0xf1a8('0x1b')](_0x110e06)['json'](_0x78b03a);}};}function respondWithFilteredResult(_0x2d9440,_0x28aca3){return function(_0x35285c){if(_0x35285c){var _0x2f18cc=_0x35285c[_0xf1a8('0x1d')],_0x405c58=_0x28aca3[_0xf1a8('0x1e')],_0x8fd875=_0x28aca3[_0xf1a8('0x1e')]+_0x28aca3[_0xf1a8('0x1f')],_0x47e5d0;if(_0x8fd875>=_0x2f18cc){_0x8fd875=_0x2f18cc;_0x47e5d0=0xc8;}else{_0x47e5d0=0xce;}_0x2d9440[_0xf1a8('0x1b')](_0x47e5d0);return _0x2d9440[_0xf1a8('0x20')](_0xf1a8('0x21'),_0x405c58+'-'+_0x8fd875+'/'+_0x2f18cc)[_0xf1a8('0x22')](_0x35285c);}return null;};}function patchUpdates(_0x392a0d){return function(_0x3fb17d){try{jsonpatch[_0xf1a8('0x23')](_0x3fb17d,_0x392a0d,!![]);}catch(_0x10adb7){return BPromise['reject'](_0x10adb7);}return _0x3fb17d[_0xf1a8('0x24')]();};}function saveUpdates(_0x5ce5c5,_0x562383){return function(_0x102483){if(_0x102483){return _0x102483['update'](_0x5ce5c5)['then'](function(_0x26a707){return _0x26a707;});}return null;};}function removeEntity(_0xae686e,_0x45d6cb){return function(_0x154ac6){if(_0x154ac6){return _0x154ac6[_0xf1a8('0x25')]()['then'](function(){var _0x2feec7=_0x154ac6[_0xf1a8('0x26')]({'plain':!![]});var _0x41a502=_0xf1a8('0x27');return db[_0xf1a8('0x28')]['destroy']({'where':{'type':_0x41a502,'resourceId':_0x2feec7['id']}})['then'](function(){return _0x154ac6;});})[_0xf1a8('0x29')](function(){_0xae686e[_0xf1a8('0x1b')](0xcc)[_0xf1a8('0x1c')]();});}};}function handleEntityNotFound(_0x11b828,_0x2781cd){return function(_0x49fe35){if(!_0x49fe35){_0x11b828['sendStatus'](0x194);}return _0x49fe35;};}function handleError(_0x3ceaba,_0x1d700f){_0x1d700f=_0x1d700f||0x1f4;return function(_0x2e1268){logger[_0xf1a8('0x2a')](_0x2e1268[_0xf1a8('0x2b')]);if(_0x2e1268['name']){delete _0x2e1268[_0xf1a8('0x2c')];}_0x3ceaba[_0xf1a8('0x1b')](_0x1d700f)['send'](_0x2e1268);};}exports['index']=function(_0x5df91a,_0x376d62){var _0x1c0c50={},_0x42d729={},_0x1c711a={'count':0x0,'rows':[]};return db[_0xf1a8('0x2d')][_0xf1a8('0x2e')]()[_0xf1a8('0x29')](function(_0x2c8fa2){_0x42d729[_0xf1a8('0x2f')]=_['keys'](_0x2c8fa2);_0x42d729[_0xf1a8('0x30')]=_[_0xf1a8('0x31')](_0x5df91a[_0xf1a8('0x30')]);_0x42d729[_0xf1a8('0x32')]=_[_0xf1a8('0x33')](_0x42d729[_0xf1a8('0x2f')],_0x42d729[_0xf1a8('0x30')]);_0x1c0c50[_0xf1a8('0x34')]=_[_0xf1a8('0x33')](_0x42d729['model'],qs[_0xf1a8('0x35')](_0x5df91a[_0xf1a8('0x30')][_0xf1a8('0x35')]));_0x1c0c50[_0xf1a8('0x34')]=_0x1c0c50[_0xf1a8('0x34')]['length']?_0x1c0c50[_0xf1a8('0x34')]:_0x42d729[_0xf1a8('0x2f')];if(!_0x5df91a['query']['hasOwnProperty']('nolimit')){_0x1c0c50[_0xf1a8('0x1f')]=qs['limit'](_0x5df91a[_0xf1a8('0x30')][_0xf1a8('0x1f')]);_0x1c0c50['offset']=qs[_0xf1a8('0x1e')](_0x5df91a[_0xf1a8('0x30')][_0xf1a8('0x1e')]);}_0x1c0c50[_0xf1a8('0x36')]=qs[_0xf1a8('0x37')](_0x5df91a[_0xf1a8('0x30')]['sort']);_0x1c0c50['where']=qs[_0xf1a8('0x32')](_['pick'](_0x5df91a[_0xf1a8('0x30')],_0x42d729[_0xf1a8('0x32')]),_0x2c8fa2);if(_0x5df91a[_0xf1a8('0x30')]['filter']){_0x1c0c50['where']=_[_0xf1a8('0x38')](_0x1c0c50['where'],{'$or':_[_0xf1a8('0x39')](_0x1c0c50[_0xf1a8('0x34')],function(_0xa9e11c){var _0x25ba3f={};_0x25ba3f[_0xa9e11c]={'$like':'%'+_0x5df91a['query'][_0xf1a8('0x3a')]+'%'};return _0x25ba3f;})});}_0x1c0c50=_['merge']({},_0x1c0c50,_0x5df91a[_0xf1a8('0x3b')]);var _0x5d56d4={'where':_0x1c0c50[_0xf1a8('0x3c')]};return db['CmCompany']['count'](_0x5d56d4)[_0xf1a8('0x29')](function(_0xb55113){_0x1c711a[_0xf1a8('0x1d')]=_0xb55113;if(_0x5df91a[_0xf1a8('0x30')]['includeAll']){_0x1c0c50[_0xf1a8('0x3d')]=[{'all':!![]}];}return db[_0xf1a8('0x2d')][_0xf1a8('0x3e')](_0x1c0c50);})[_0xf1a8('0x29')](function(_0x2482b0){_0x1c711a[_0xf1a8('0x3f')]=_0x2482b0;return _0x1c711a;})[_0xf1a8('0x29')](respondWithFilteredResult(_0x376d62,_0x1c0c50))[_0xf1a8('0x40')](handleError(_0x376d62,null));})[_0xf1a8('0x40')](handleError(_0x376d62,null));};exports[_0xf1a8('0x41')]=function(_0x5dd4e4,_0x524bb9){var _0x22366f={'raw':![],'where':{'id':_0x5dd4e4[_0xf1a8('0x42')]['id']}},_0x90d98e={};_0x90d98e[_0xf1a8('0x2f')]=_[_0xf1a8('0x31')](db[_0xf1a8('0x2d')]['rawAttributes']);_0x90d98e['query']=_[_0xf1a8('0x31')](_0x5dd4e4['query']);_0x90d98e[_0xf1a8('0x32')]=_[_0xf1a8('0x33')](_0x90d98e[_0xf1a8('0x2f')],_0x90d98e[_0xf1a8('0x30')]);_0x22366f[_0xf1a8('0x34')]=_['intersection'](_0x90d98e['model'],qs['fields'](_0x5dd4e4['query'][_0xf1a8('0x35')]));_0x22366f[_0xf1a8('0x34')]=_0x22366f[_0xf1a8('0x34')][_0xf1a8('0x43')]?_0x22366f[_0xf1a8('0x34')]:_0x90d98e[_0xf1a8('0x2f')];if(_0x5dd4e4[_0xf1a8('0x30')][_0xf1a8('0x44')]){_0x22366f[_0xf1a8('0x3d')]=[{'all':!![]}];}_0x22366f=_[_0xf1a8('0x38')]({},_0x22366f,_0x5dd4e4[_0xf1a8('0x3b')]);return db[_0xf1a8('0x2d')][_0xf1a8('0x45')](_0x22366f)[_0xf1a8('0x29')](handleEntityNotFound(_0x524bb9,null))[_0xf1a8('0x29')](respondWithResult(_0x524bb9,null))[_0xf1a8('0x40')](handleError(_0x524bb9,null));};exports[_0xf1a8('0x46')]=function(_0x4a50a7,_0x5722bc){return db[_0xf1a8('0x2d')][_0xf1a8('0x46')](_0x4a50a7['body'],{})[_0xf1a8('0x29')](function(_0x138185){var _0x2e12aa=_0x4a50a7[_0xf1a8('0x47')][_0xf1a8('0x26')]({'plain':!![]});if(!_0x2e12aa)throw new Error(_0xf1a8('0x48'));if(_0x2e12aa[_0xf1a8('0x49')]===_0xf1a8('0x47')){var _0x1d5757=_0x138185[_0xf1a8('0x26')]({'plain':!![]});var _0x17440c=_0xf1a8('0x27');return db[_0xf1a8('0x4a')][_0xf1a8('0x45')]({'where':{'name':_0x17440c,'userProfileId':_0x2e12aa[_0xf1a8('0x4b')]},'raw':!![]})[_0xf1a8('0x29')](function(_0x7119c){if(_0x7119c&&_0x7119c['autoAssociation']===0x0){return db[_0xf1a8('0x28')][_0xf1a8('0x46')]({'name':_0x1d5757['name'],'resourceId':_0x1d5757['id'],'type':_0x7119c[_0xf1a8('0x2c')],'sectionId':_0x7119c['id']},{})[_0xf1a8('0x29')](function(){return _0x138185;});}else{return _0x138185;}})[_0xf1a8('0x40')](function(_0x16d155){logger[_0xf1a8('0x2a')](_0xf1a8('0x4c'),_0x16d155);throw _0x16d155;});}return _0x138185;})['then'](respondWithResult(_0x5722bc,0xc9))[_0xf1a8('0x40')](handleError(_0x5722bc,null));};exports[_0xf1a8('0x4d')]=function(_0x523a21,_0x3ec70a){if(_0x523a21[_0xf1a8('0x4e')]['id']){delete _0x523a21['body']['id'];}return db[_0xf1a8('0x2d')][_0xf1a8('0x45')]({'where':{'id':_0x523a21[_0xf1a8('0x42')]['id']}})[_0xf1a8('0x29')](handleEntityNotFound(_0x3ec70a,null))[_0xf1a8('0x29')](saveUpdates(_0x523a21[_0xf1a8('0x4e')],null))[_0xf1a8('0x29')](respondWithResult(_0x3ec70a,null))['catch'](handleError(_0x3ec70a,null));};exports[_0xf1a8('0x25')]=function(_0x27b2e6,_0x3cee8e){return db[_0xf1a8('0x2d')][_0xf1a8('0x45')]({'where':{'id':_0x27b2e6[_0xf1a8('0x42')]['id']}})[_0xf1a8('0x29')](handleEntityNotFound(_0x3cee8e,null))[_0xf1a8('0x29')](removeEntity(_0x3cee8e,null))[_0xf1a8('0x40')](handleError(_0x3cee8e,null));};exports[_0xf1a8('0x2e')]=function(_0x2cbe8b,_0x24cb5f){return db[_0xf1a8('0x2d')][_0xf1a8('0x2e')]()[_0xf1a8('0x29')](respondWithResult(_0x24cb5f,null))[_0xf1a8('0x40')](handleError(_0x24cb5f,null));};exports['addContacts']=function(_0x4bfc55,_0x215742,_0x5dafc8){return db[_0xf1a8('0x4f')][_0xf1a8('0x45')]({'where':{'id':_0x4bfc55['params']['id']}})[_0xf1a8('0x29')](handleEntityNotFound(_0x215742,null))[_0xf1a8('0x29')](function(_0x47276e){if(_0x47276e){return _0x47276e[_0xf1a8('0x50')](_0x4bfc55[_0xf1a8('0x4e')]['ids'],_['omit'](_0x4bfc55[_0xf1a8('0x4e')],[_0xf1a8('0x51'),'id'])||{});}})['then'](respondWithResult(_0x215742,null))[_0xf1a8('0x40')](handleError(_0x215742,null));};exports[_0xf1a8('0x52')]=function(_0x20d670,_0x67ce85,_0x3d4ae4){var _0x47c92d={};var _0x5247b2={};var _0x4c68fa;var _0x4c761c;return db[_0xf1a8('0x2d')]['findOne']({'where':{'id':_0x20d670[_0xf1a8('0x42')]['id']}})[_0xf1a8('0x29')](handleEntityNotFound(_0x67ce85,null))[_0xf1a8('0x29')](function(_0x19811d){if(_0x19811d){_0x4c68fa=_0x19811d;_0x5247b2[_0xf1a8('0x2f')]=_[_0xf1a8('0x31')](db[_0xf1a8('0x4f')]['rawAttributes']);_0x5247b2[_0xf1a8('0x30')]=_[_0xf1a8('0x31')](_0x20d670[_0xf1a8('0x30')]);_0x5247b2[_0xf1a8('0x32')]=_['intersection'](_0x5247b2['model'],_0x5247b2['query']);_0x47c92d[_0xf1a8('0x34')]=_[_0xf1a8('0x33')](_0x5247b2[_0xf1a8('0x2f')],qs[_0xf1a8('0x35')](_0x20d670['query'][_0xf1a8('0x35')]));_0x47c92d['attributes']=_0x47c92d[_0xf1a8('0x34')][_0xf1a8('0x43')]?_0x47c92d[_0xf1a8('0x34')]:_0x5247b2[_0xf1a8('0x2f')];_0x47c92d['order']=qs[_0xf1a8('0x37')](_0x20d670['query'][_0xf1a8('0x37')]);_0x47c92d[_0xf1a8('0x3c')]=qs[_0xf1a8('0x32')](_[_0xf1a8('0x53')](_0x20d670[_0xf1a8('0x30')],_0x5247b2[_0xf1a8('0x32')]));if(_0x20d670[_0xf1a8('0x30')][_0xf1a8('0x3a')]){_0x47c92d[_0xf1a8('0x3c')]=_[_0xf1a8('0x38')](_0x47c92d['where'],{'$or':_[_0xf1a8('0x39')](_0x47c92d[_0xf1a8('0x34')],function(_0x4e69a8){var _0x24df03={};_0x24df03[_0x4e69a8]={'$like':'%'+_0x20d670[_0xf1a8('0x30')][_0xf1a8('0x3a')]+'%'};return _0x24df03;})});}_0x47c92d=_[_0xf1a8('0x38')]({},_0x47c92d,_0x20d670[_0xf1a8('0x3b')]);return _0x4c68fa[_0xf1a8('0x52')](_0x47c92d);}})[_0xf1a8('0x29')](function(_0x26fedc){if(_0x26fedc){_0x4c761c=_0x26fedc[_0xf1a8('0x43')];if(!_0x20d670['query'][_0xf1a8('0x54')]('nolimit')){_0x47c92d[_0xf1a8('0x1f')]=qs[_0xf1a8('0x1f')](_0x20d670[_0xf1a8('0x30')]['limit']);_0x47c92d[_0xf1a8('0x1e')]=qs[_0xf1a8('0x1e')](_0x20d670[_0xf1a8('0x30')][_0xf1a8('0x1e')]);}return _0x4c68fa[_0xf1a8('0x52')](_0x47c92d);}})[_0xf1a8('0x29')](function(_0x1cbca8){if(_0x1cbca8){return _0x1cbca8?{'count':_0x4c761c,'rows':_0x1cbca8}:null;}})[_0xf1a8('0x29')](respondWithResult(_0x67ce85,null))[_0xf1a8('0x40')](handleError(_0x67ce85,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index bbe2370..f62823b 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 _0xea89=['CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./cmCompany.attributes','exports','define'];(function(_0x5d2df8,_0x34f53e){var _0xa9ffed=function(_0x2fcc8c){while(--_0x2fcc8c){_0x5d2df8['push'](_0x5d2df8['shift']());}};_0xa9ffed(++_0x34f53e);}(_0xea89,0x1e2));var _0x9ea8=function(_0x1dc9fe,_0x244b6a){_0x1dc9fe=_0x1dc9fe-0x0;var _0x5bf8fd=_0xea89[_0x1dc9fe];return _0x5bf8fd;};'use strict';var _=require(_0x9ea8('0x0'));var util=require(_0x9ea8('0x1'));var logger=require(_0x9ea8('0x2'))(_0x9ea8('0x3'));var moment=require(_0x9ea8('0x4'));var BPromise=require('bluebird');var rp=require(_0x9ea8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ea8('0x6'));var config=require('../../config/environment');var attributes=require(_0x9ea8('0x7'));module[_0x9ea8('0x8')]=function(_0x2c6e50,_0x184f38){return _0x2c6e50[_0x9ea8('0x9')](_0x9ea8('0xa'),attributes,{'tableName':_0x9ea8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1501=['bluebird','request-promise','path','rimraf','./cmCompany.attributes','define','CmCompany','cm_companies','util','../../config/logger','api'];(function(_0x404c49,_0x17c931){var _0x5969ae=function(_0x2e6f4b){while(--_0x2e6f4b){_0x404c49['push'](_0x404c49['shift']());}};_0x5969ae(++_0x17c931);}(_0x1501,0x126));var _0x1150=function(_0x2b2514,_0x25e672){_0x2b2514=_0x2b2514-0x0;var _0x542e61=_0x1501[_0x2b2514];return _0x542e61;};'use strict';var _=require('lodash');var util=require(_0x1150('0x0'));var logger=require(_0x1150('0x1'))(_0x1150('0x2'));var moment=require('moment');var BPromise=require(_0x1150('0x3'));var rp=require(_0x1150('0x4'));var fs=require('fs');var path=require(_0x1150('0x5'));var rimraf=require(_0x1150('0x6'));var config=require('../../config/environment');var attributes=require(_0x1150('0x7'));module['exports']=function(_0x63c724,_0x316a7d){return _0x63c724[_0x1150('0x8')](_0x1150('0x9'),attributes,{'tableName':_0x1150('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index d614db7..80bc6a4 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 _0x344b=['code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2f7270,_0x307af1){var _0xe1d89a=function(_0x1ba203){while(--_0x1ba203){_0x2f7270['push'](_0x2f7270['shift']());}};_0xe1d89a(++_0x307af1);}(_0x344b,0x1b7));var _0xb344=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x344b[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0xb344('0x0'));var util=require(_0xb344('0x1'));var moment=require(_0xb344('0x2'));var BPromise=require(_0xb344('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb344('0x4'));var db=require(_0xb344('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb344('0x6'))(_0xb344('0x7'));var config=require(_0xb344('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb344('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6fc1bf,_0x28ec6b,_0x2926e9){return new BPromise(function(_0x3de87d,_0x157f82){return client['request'](_0x6fc1bf,_0x2926e9)[_0xb344('0xa')](function(_0x31958d){logger[_0xb344('0xb')](_0xb344('0xc'),_0x28ec6b,_0xb344('0xd'));logger['debug'](_0xb344('0xe'),_0x28ec6b,'request\x20sent',JSON[_0xb344('0xf')](_0x31958d));if(_0x31958d[_0xb344('0x10')]){if(_0x31958d[_0xb344('0x10')][_0xb344('0x11')]===0x1f4){logger[_0xb344('0x10')](_0xb344('0xc'),_0x28ec6b,_0x31958d[_0xb344('0x10')][_0xb344('0x12')]);return _0x157f82(_0x31958d[_0xb344('0x10')][_0xb344('0x12')]);}logger[_0xb344('0x10')]('CmCompany,\x20%s,\x20%s',_0x28ec6b,_0x31958d[_0xb344('0x10')][_0xb344('0x12')]);return _0x3de87d(_0x31958d[_0xb344('0x10')][_0xb344('0x12')]);}else{logger[_0xb344('0xb')]('CmCompany,\x20%s,\x20%s',_0x28ec6b,'request\x20sent');_0x3de87d(_0x31958d['result']['message']);}})['catch'](function(_0x3edacf){logger['error'](_0xb344('0xc'),_0x28ec6b,_0x3edacf);_0x157f82(_0x3edacf);});});} \ No newline at end of file +var _0xd7bf=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','CmCompany,\x20%s,\x20%s','message','catch','util','moment'];(function(_0x1a0303,_0x6508d3){var _0x4f9bee=function(_0x6d0f04){while(--_0x6d0f04){_0x1a0303['push'](_0x1a0303['shift']());}};_0x4f9bee(++_0x6508d3);}(_0xd7bf,0xb2));var _0xfd7b=function(_0x40a38e,_0x56a98e){_0x40a38e=_0x40a38e-0x0;var _0x186105=_0xd7bf[_0x40a38e];return _0x186105;};'use strict';var _=require('lodash');var util=require(_0xfd7b('0x0'));var moment=require(_0xfd7b('0x1'));var BPromise=require(_0xfd7b('0x2'));var rs=require(_0xfd7b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd7b('0x4'))['db'];var utils=require(_0xfd7b('0x5'));var logger=require(_0xfd7b('0x6'))('rpc');var config=require(_0xfd7b('0x7'));var jayson=require(_0xfd7b('0x8'));var client=jayson[_0xfd7b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x364dc7,_0x4d1aad,_0x5bca22){return new BPromise(function(_0x348580,_0x2d9241){return client[_0xfd7b('0xa')](_0x364dc7,_0x5bca22)['then'](function(_0x284e33){logger[_0xfd7b('0xb')]('CmCompany,\x20%s,\x20%s',_0x4d1aad,_0xfd7b('0xc'));logger[_0xfd7b('0xd')](_0xfd7b('0xe'),_0x4d1aad,_0xfd7b('0xc'),JSON[_0xfd7b('0xf')](_0x284e33));if(_0x284e33[_0xfd7b('0x10')]){if(_0x284e33[_0xfd7b('0x10')]['code']===0x1f4){logger[_0xfd7b('0x10')](_0xfd7b('0x11'),_0x4d1aad,_0x284e33[_0xfd7b('0x10')][_0xfd7b('0x12')]);return _0x2d9241(_0x284e33['error']['message']);}logger['error']('CmCompany,\x20%s,\x20%s',_0x4d1aad,_0x284e33['error'][_0xfd7b('0x12')]);return _0x348580(_0x284e33[_0xfd7b('0x10')]['message']);}else{logger[_0xfd7b('0xb')]('CmCompany,\x20%s,\x20%s',_0x4d1aad,_0xfd7b('0xc'));_0x348580(_0x284e33['result'][_0xfd7b('0x12')]);}})[_0xfd7b('0x13')](function(_0x839463){logger[_0xfd7b('0x10')](_0xfd7b('0x11'),_0x4d1aad,_0x839463);_0x2d9241(_0x839463);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index e36e412..8a46d5c 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 _0x1948=['./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts','post','addContacts','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x2f25c5,_0x364ba9){var _0x205258=function(_0x2302f9){while(--_0x2302f9){_0x2f25c5['push'](_0x2f25c5['shift']());}};_0x205258(++_0x364ba9);}(_0x1948,0x6b));var _0x8194=function(_0x14babd,_0x213243){_0x14babd=_0x14babd-0x0;var _0x155505=_0x1948[_0x14babd];return _0x155505;};'use strict';var multer=require(_0x8194('0x0'));var util=require(_0x8194('0x1'));var path=require(_0x8194('0x2'));var timeout=require('connect-timeout');var express=require(_0x8194('0x3'));var router=express[_0x8194('0x4')]();var fs_extra=require(_0x8194('0x5'));var auth=require(_0x8194('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8194('0x7'));var controller=require(_0x8194('0x8'));router[_0x8194('0x9')]('/',auth[_0x8194('0xa')](),controller[_0x8194('0xb')]);router[_0x8194('0x9')](_0x8194('0xc'),auth[_0x8194('0xa')](),controller[_0x8194('0xd')]);router['get'](_0x8194('0xe'),auth[_0x8194('0xa')](),controller[_0x8194('0xf')]);router[_0x8194('0x9')](_0x8194('0x10'),auth[_0x8194('0xa')](),controller['getContacts']);router[_0x8194('0x11')]('/',auth[_0x8194('0xa')](),controller['create']);router[_0x8194('0x11')](_0x8194('0x10'),auth[_0x8194('0xa')](),controller[_0x8194('0x12')]);router['put'](_0x8194('0xe'),auth['isAuthenticated'](),controller[_0x8194('0x13')]);router[_0x8194('0x14')](_0x8194('0xe'),auth[_0x8194('0xa')](),controller[_0x8194('0x15')]);module[_0x8194('0x16')]=router; \ No newline at end of file +var _0xfa6f=['/:id','post','create','addContacts','put','update','exports','util','Router','fs-extra','../../components/interaction/service','./cmCompany.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x38c699,_0x56fea7){var _0x3b1ded=function(_0x100851){while(--_0x100851){_0x38c699['push'](_0x38c699['shift']());}};_0x3b1ded(++_0x56fea7);}(_0xfa6f,0x15b));var _0xffa6=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xfa6f[_0x341e0f];return _0x59555a;};'use strict';var multer=require('multer');var util=require(_0xffa6('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xffa6('0x1')]();var fs_extra=require(_0xffa6('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xffa6('0x3'));var config=require('../../config/environment');var controller=require(_0xffa6('0x4'));router['get']('/',auth[_0xffa6('0x5')](),controller[_0xffa6('0x6')]);router[_0xffa6('0x7')](_0xffa6('0x8'),auth[_0xffa6('0x5')](),controller[_0xffa6('0x9')]);router['get'](_0xffa6('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xffa6('0x7')]('/:id/contacts',auth['isAuthenticated'](),controller['getContacts']);router[_0xffa6('0xb')]('/',auth['isAuthenticated'](),controller[_0xffa6('0xc')]);router[_0xffa6('0xb')]('/:id/contacts',auth[_0xffa6('0x5')](),controller[_0xffa6('0xd')]);router[_0xffa6('0xe')](_0xffa6('0xa'),auth[_0xffa6('0x5')](),controller[_0xffa6('0xf')]);router['delete'](_0xffa6('0xa'),auth[_0xffa6('0x5')](),controller['destroy']);module[_0xffa6('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 1b35cdc..4067f96 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 _0x8433=['sequelize','STRING','UNSIGNED','DATE','NOW'];(function(_0xf44d98,_0x12a472){var _0x5ebb04=function(_0x930c33){while(--_0x930c33){_0xf44d98['push'](_0xf44d98['shift']());}};_0x5ebb04(++_0x12a472);}(_0x8433,0x186));var _0x3843=function(_0x1030ce,_0xbe3f74){_0x1030ce=_0x1030ce-0x0;var _0x3367fd=_0x8433[_0x1030ce];return _0x3367fd;};'use strict';var _=require('lodash');var Sequelize=require(_0x3843('0x0'));module['exports']={'firstName':{'type':Sequelize[_0x3843('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0x3843('0x1')]},'street':{'type':Sequelize[_0x3843('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x3843('0x1')]},'country':{'type':Sequelize[_0x3843('0x1')]},'dateOfBirth':{'type':Sequelize[_0x3843('0x1')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x3843('0x1')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x3843('0x1')]},'email':{'type':Sequelize[_0x3843('0x1')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x3843('0x1')]},'twitter':{'type':Sequelize[_0x3843('0x1')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x3843('0x1')]},'viber':{'type':Sequelize[_0x3843('0x1')]},'line':{'type':Sequelize[_0x3843('0x1')]},'wechat':{'type':Sequelize[_0x3843('0x1')]},'telegram':{'type':Sequelize[_0x3843('0x1')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x3843('0x2')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x3843('0x3')],'defaultValue':Sequelize[_0x3843('0x4')]}}; \ No newline at end of file +var _0x121e=['sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x212a78,_0x5a5afa){var _0x5685cf=function(_0x59c99f){while(--_0x59c99f){_0x212a78['push'](_0x212a78['shift']());}};_0x5685cf(++_0x5a5afa);}(_0x121e,0x198));var _0xe121=function(_0xf93b6d,_0x2cc413){_0xf93b6d=_0xf93b6d-0x0;var _0x2e83db=_0x121e[_0xf93b6d];return _0x2e83db;};'use strict';var _=require('lodash');var Sequelize=require(_0xe121('0x0'));module[_0xe121('0x1')]={'firstName':{'type':Sequelize[_0xe121('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xe121('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xe121('0x2')]},'country':{'type':Sequelize[_0xe121('0x2')]},'dateOfBirth':{'type':Sequelize[_0xe121('0x2')]},'description':{'type':Sequelize[_0xe121('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xe121('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xe121('0x2')]},'facebook':{'type':Sequelize[_0xe121('0x2')]},'fb_data':{'type':Sequelize[_0xe121('0x2')]},'twitter':{'type':Sequelize[_0xe121('0x2')]},'skype':{'type':Sequelize[_0xe121('0x2')]},'teams':{'type':Sequelize[_0xe121('0x2')]},'viber':{'type':Sequelize[_0xe121('0x2')]},'line':{'type':Sequelize[_0xe121('0x2')]},'wechat':{'type':Sequelize[_0xe121('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xe121('0x4')]},'priority':{'type':Sequelize[_0xe121('0x4')](0x2)[_0xe121('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 7464734..0201edf 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 _0x483f=['No\x20phone\x20column\x20specified','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','child_process','fork','stringify','exit','error\x20child\x20process','getJourney','mail','chat','sms','openchannel','fax','whatsapp','-createdAt','resolve','channel','includes','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','fullname','startCase','Website','Account','disposition','secondDisposition','thirdDisposition','key','browserName','customerPort','deviceModel','ratingMessage','ratingType','ratingValue','substatus','threadId','Interaction','Owner','sortBy','reverse','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','register','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','CmContact','describe','keys','length','startsWith','cf_','push','CmCustomField','findOne','trimStart','all','fieldType','type','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','tools_tags','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','find','value','split','map','forEach','union','User','and','uc.UserId\x20=\x20?','datetime','castTo','DATE','text','start','filter','isNil','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','concat','tag','isArray','replace','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.id','QueryTypes','SELECT','DESC','t.id\x20IN\x20?','user','role','getLists','c.ListId\x20IS\x20NULL','sequelize','toString','keyBy','merge','c.firstName','c.lastName','c.phone','c.mobile','c.fax','c.email','c.createdAt','c.deletedAt','c.CompanyId','TagIds','Tags','rows','catch','tags','columnName','findAll','displayName','alias','values','body','get','mergeWith','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','MailInteraction','MailMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','join','each','duplicates','$or','spread','show','params','Tag','$and','omit','format','cf_%d','pickBy','table','id\x20=\x20?','toParam','phone','getTags','rawAttributes','options','setTags','ids','getHoppers','ContactId','includeAll','getHopperHistories','getHopperFinals','include','uploadCsv','binding_values','socket_timestamp','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','No\x20firstName\x20column\x20specified','server/files/tmp','file','filename','chmodSync','CompanyId','File\x20uploaded\x20correctly!','pid','upload','path','meta','agent','binding'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x483f,0x14a));var _0xf483=function(_0x5029b1,_0x260bf1){_0x5029b1=_0x5029b1-0x0;var _0x317e63=_0x483f[_0x5029b1];return _0x317e63;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf483('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf483('0x1'));var jsonpatch=require(_0xf483('0x2'));var rp=require(_0xf483('0x3'));var moment=require(_0xf483('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf483('0x5'));var util=require(_0xf483('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf483('0x7'));var _=require(_0xf483('0x8'));var squel=require(_0xf483('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf483('0xa'));var toCsv=require(_0xf483('0xb'));var querystring=require(_0xf483('0xc'));var Papa=require(_0xf483('0xd'));var Redis=require(_0xf483('0xe'));var authService=require(_0xf483('0xf'));var qs=require(_0xf483('0x10'));var as=require(_0xf483('0x11'));var hardwareService=require(_0xf483('0x12'));var logger=require('../../config/logger')(_0xf483('0x13'));var utils=require(_0xf483('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf483('0x15'));var db=require(_0xf483('0x16'))['db'];config[_0xf483('0x17')]=_['defaults'](config[_0xf483('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf483('0x17')]));require('./cmContact.socket')[_0xf483('0x18')](socket);function respondWithStatusCode(_0x5455b1,_0x3a315f){_0x3a315f=_0x3a315f||0xcc;return function(_0x47aa6d){if(_0x47aa6d){return _0x5455b1[_0xf483('0x19')](_0x3a315f);}return _0x5455b1['status'](_0x3a315f)[_0xf483('0x1a')]();};}function respondWithResult(_0x1b6b6e,_0x5120bc){_0x5120bc=_0x5120bc||0xc8;return function(_0x821a4b){if(_0x821a4b){return _0x1b6b6e[_0xf483('0x1b')](_0x5120bc)['json'](_0x821a4b);}};}function respondWithFilteredResult(_0x3c1468,_0x5db244){return function(_0x2c3ee0){if(_0x2c3ee0){var _0x4e7480=_0x2c3ee0[_0xf483('0x1c')],_0x1f8849=_0x5db244['offset'],_0x25b936=_0x5db244[_0xf483('0x1d')]+_0x5db244[_0xf483('0x1e')],_0x7f3670;if(_0x25b936>=_0x4e7480){_0x25b936=_0x4e7480;_0x7f3670=0xc8;}else{_0x7f3670=0xce;}_0x3c1468[_0xf483('0x1b')](_0x7f3670);return _0x3c1468[_0xf483('0x1f')](_0xf483('0x20'),_0x1f8849+'-'+_0x25b936+'/'+_0x4e7480)[_0xf483('0x21')](_0x2c3ee0);}return null;};}function patchUpdates(_0x55d672){return function(_0x36a7a9){try{jsonpatch[_0xf483('0x22')](_0x36a7a9,_0x55d672,!![]);}catch(_0x14d6bc){return BPromise['reject'](_0x14d6bc);}return _0x36a7a9[_0xf483('0x23')]();};}function saveUpdates(_0x1df467,_0x28c6ce){return function(_0x87eec8){if(_0x87eec8){return _0x87eec8[_0xf483('0x24')](_0x1df467)[_0xf483('0x25')](function(_0x57c049){return _0x57c049;});}return null;};}function removeEntity(_0xf67a4f,_0x30855d){return function(_0x1249a7){if(_0x1249a7){return _0x1249a7[_0xf483('0x26')]()[_0xf483('0x25')](function(){_0xf67a4f[_0xf483('0x1b')](0xcc)[_0xf483('0x1a')]();});}};}function handleEntityNotFound(_0x9b1ffc,_0x15f5ab){return function(_0x516da0){if(!_0x516da0){_0x9b1ffc[_0xf483('0x19')](0x194);}return _0x516da0;};}function handleError(_0x3eb618,_0x5449de){_0x5449de=_0x5449de||0x1f4;return function(_0x17665b){logger[_0xf483('0x27')](_0x17665b[_0xf483('0x28')]);if(_0x17665b['name']){delete _0x17665b[_0xf483('0x29')];}_0x3eb618['status'](_0x5449de)[_0xf483('0x2a')](_0x17665b);};}exports[_0xf483('0x2b')]=function(_0x49bf89,_0x41ce06){var _0x3e1dd6={},_0x498b9c={},_0x25ab64={'count':0x0,'rows':[]};return db[_0xf483('0x2c')][_0xf483('0x2d')]()[_0xf483('0x25')](function(_0x2f298e){var _0xb7cee3=[];for(var _0x25444e=0x0;_0x25444e0x1){_0x54cc43['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xf483('0x6c')](_0x1107e8),null);}else{if(qs['isNumeric'](_0x1107e8)){_0x54cc43['or'](_0xf483('0x6d'),_0x1107e8+'%');_0x54cc43['or'](_0xf483('0x6e'),_0x1107e8+'%');_0x54cc43['or'](_0xf483('0x6f'),_0x1107e8+'%');_0x54cc43['or'](_0xf483('0x70'),_0x1107e8+'%');}else if(qs[_0xf483('0x71')](_0x1107e8)){_0x54cc43['or'](_0xf483('0x72'),_0x1107e8+'%');}else{_0x54cc43['or'](_0xf483('0x73'),'%'+_0x1107e8+'%');_0x54cc43['or']('c.lastName\x20LIKE\x20?','%'+_0x1107e8+'%');_0x54cc43['or'](_0xf483('0x72'),'%'+_0x1107e8+'%');}}}}_0x216cab[_0xf483('0x43')](_0x54cc43);_0x216cab['group'](_0xf483('0x74'));var _0x59863a={'type':db['Sequelize'][_0xf483('0x75')][_0xf483('0x76')],'raw':!![]};var _0x3cb0bd=_0x216cab['clone']()['field']('c.id');if(_0x3e1dd6[_0xf483('0x41')]){_0x3e1dd6[_0xf483('0x41')][_0xf483('0x58')](function(_0x32df08){_0x216cab[_0xf483('0x41')]('c.'+_0x32df08[0x0],_0x32df08[0x1]===_0xf483('0x77')?![]:!![]);});}if(!_[_0xf483('0x65')](_0xa084cd)){_0x216cab['having'](_0x1ab447);_0x3cb0bd['where'](_0xf483('0x78'),_0xa084cd);}BPromise['resolve']()[_0xf483('0x25')](function(){if(!_0xd9aef5)return;if(_0x49bf89[_0xf483('0x79')][_0xf483('0x7a')]!=='agent')return;if(!_['some'](_0xd9aef5[_0xf483('0x53')],[_0xf483('0x45'),'User'])){return _0x49bf89[_0xf483('0x79')][_0xf483('0x7b')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2e8f5e){if(_[_0xf483('0x65')](_0x2e8f5e)){_0x3cb0bd[_0xf483('0x43')](_0xf483('0x7c'));_0x216cab[_0xf483('0x43')](_0xf483('0x7c'));}else{_0x3cb0bd[_0xf483('0x43')]('c.ListId\x20IN\x20?',_['map'](_0x2e8f5e,'id'));_0x216cab[_0xf483('0x43')](_0xf483('0x67'),_[_0xf483('0x57')](_0x2e8f5e,'id'));}});}})['then'](function(){if(_0x49bf89[_0xf483('0x79')][_0xf483('0x7a')]==='agent'&&!_0xd9aef5&&!_0x49bf89['query'][_0xf483('0x66')])return[];return db[_0xf483('0x7d')][_0xf483('0x39')](_0x3cb0bd[_0xf483('0x7e')](),_0x59863a);})[_0xf483('0x25')](function(_0x5bb75c){_0x25ab64['count']=_0x5bb75c[_0xf483('0x2f')];if(_0x25ab64['count']===0x0)return[];return db['sequelize']['query'](_0xf2adf6[_0xf483('0x7e')](),_0x59863a)['then'](function(_0x441ba1){_0x4e9974=_[_0xf483('0x7f')](_0x441ba1,'id');_0x59863a=_[_0xf483('0x80')](_0x59863a,{'model':db[_0xf483('0x2c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x49bf89['query'][_0xf483('0x3e')]){_0x3e1dd6['attributes'][_0xf483('0x58')](function(_0x46b39c){_0x216cab['field']('c.'+_0x46b39c);});}else{_0x216cab[_0xf483('0x45')](_0xf483('0x74'));_0x216cab[_0xf483('0x45')](_0xf483('0x81'));_0x216cab[_0xf483('0x45')](_0xf483('0x82'));_0x216cab[_0xf483('0x45')](_0xf483('0x83'));_0x216cab[_0xf483('0x45')](_0xf483('0x84'));_0x216cab[_0xf483('0x45')](_0xf483('0x85'));_0x216cab[_0xf483('0x45')](_0xf483('0x86'));_0x216cab[_0xf483('0x45')]('c.ListId');_0x216cab[_0xf483('0x45')](_0xf483('0x87'));_0x216cab[_0xf483('0x45')](_0xf483('0x88'));_0x216cab[_0xf483('0x45')](_0xf483('0x89'));_0x216cab['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xf483('0x8a'));}if(_0x3e1dd6['limit'])_0x216cab[_0xf483('0x1e')](_0x3e1dd6[_0xf483('0x1e')]);if(_0x3e1dd6[_0xf483('0x1d')])_0x216cab[_0xf483('0x1d')](_0x3e1dd6[_0xf483('0x1d')]);return db[_0xf483('0x7d')]['query'](_0x216cab[_0xf483('0x7e')](),_0x59863a);});})['then'](function(_0x548558){_0x548558[_0xf483('0x58')](function(_0xb8a5ee){if(_0xb8a5ee[_0xf483('0x8a')]){_0xb8a5ee['Tags']=[];_0xb8a5ee['TagIds']['split'](',')[_0xf483('0x58')](function(_0x2cb38a){_0xb8a5ee[_0xf483('0x8b')][_0xf483('0x32')](_0x4e9974[_0x2cb38a]);});}delete _0xb8a5ee['TagIds'];});_0x25ab64[_0xf483('0x8c')]=_0x548558;return _0x25ab64;})['then'](respondWithFilteredResult(_0x41ce06,_0x3e1dd6));})[_0xf483('0x8d')](handleError(_0x41ce06,null));};exports[_0xf483('0x26')]=function(_0x4032a5,_0x5a2c6c){return db[_0xf483('0x2c')]['find']({'where':{'id':_0x4032a5['params']['id']}})[_0xf483('0x25')](handleEntityNotFound(_0x5a2c6c,null))[_0xf483('0x25')](removeEntity(_0x5a2c6c,null))[_0xf483('0x8d')](handleError(_0x5a2c6c,null));};exports[_0xf483('0x2d')]=function(_0x3e55cb,_0x5d14c9){return db['CmContact'][_0xf483('0x2d')]()[_0xf483('0x25')](function(_0x1171b6){delete _0x1171b6[_0xf483('0x8e')];for(var _0x19b6be=0x0;_0x19b6be=_0xf0f4ac){_0x53106a=_0xf0f4ac;_0x48f29c=0xc8;}else{_0x48f29c=0xce;}_0x511b7a[_0x2620('0x23')](_0x48f29c);return _0x511b7a['set'](_0x2620('0x26'),_0x53b252+'-'+_0x53106a+'/'+_0xf0f4ac)[_0x2620('0x27')](_0x3edcb9);}return null;};}function patchUpdates(_0x585f1e){return function(_0x308d26){try{jsonpatch[_0x2620('0x28')](_0x308d26,_0x585f1e,!![]);}catch(_0x33a904){return BPromise['reject'](_0x33a904);}return _0x308d26[_0x2620('0x29')]();};}function saveUpdates(_0x5219d8,_0x72fd09){return function(_0x2d6fd1){if(_0x2d6fd1){return _0x2d6fd1['update'](_0x5219d8)[_0x2620('0x2a')](function(_0x444edd){return _0x444edd;});}return null;};}function removeEntity(_0x471206,_0x55f14e){return function(_0x2d4c1a){if(_0x2d4c1a){return _0x2d4c1a[_0x2620('0x2b')]()[_0x2620('0x2a')](function(){_0x471206[_0x2620('0x23')](0xcc)[_0x2620('0x22')]();});}};}function handleEntityNotFound(_0x2d5a1d,_0x5703a3){return function(_0x3436ca){if(!_0x3436ca){_0x2d5a1d[_0x2620('0x21')](0x194);}return _0x3436ca;};}function handleError(_0x3e9828,_0x4060d1){_0x4060d1=_0x4060d1||0x1f4;return function(_0x4e11f5){logger[_0x2620('0x2c')](_0x4e11f5[_0x2620('0x2d')]);if(_0x4e11f5[_0x2620('0x2e')]){delete _0x4e11f5[_0x2620('0x2e')];}_0x3e9828['status'](_0x4060d1)['send'](_0x4e11f5);};}exports[_0x2620('0x2f')]=function(_0x3f66ae,_0x431e89){var _0x13b085={},_0x5d0ec4={},_0x2424b8={'count':0x0,'rows':[]};return db[_0x2620('0x30')]['describe']()[_0x2620('0x2a')](function(_0x28e97a){var _0xe13572=[];for(var _0x105ca0=0x0;_0x105ca00x1){_0x202061['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2620('0x6d')](_0x3139aa),null);}else{if(qs['isNumeric'](_0x3139aa)){_0x202061['or'](_0x2620('0x6e'),_0x3139aa+'%');_0x202061['or']('c.phone\x20LIKE\x20?',_0x3139aa+'%');_0x202061['or']('c.mobile\x20LIKE\x20?',_0x3139aa+'%');_0x202061['or']('c.fax\x20LIKE\x20?',_0x3139aa+'%');}else if(qs[_0x2620('0x6f')](_0x3139aa)){_0x202061['or'](_0x2620('0x70'),_0x3139aa+'%');}else{_0x202061['or'](_0x2620('0x71'),'%'+_0x3139aa+'%');_0x202061['or']('c.lastName\x20LIKE\x20?','%'+_0x3139aa+'%');_0x202061['or']('c.email\x20LIKE\x20?','%'+_0x3139aa+'%');}}}}_0x8b832a[_0x2620('0x45')](_0x202061);_0x8b832a[_0x2620('0x72')](_0x2620('0x73'));var _0x28e214={'type':db[_0x2620('0x74')][_0x2620('0x75')][_0x2620('0x76')],'raw':!![]};var _0x3b8f7e=_0x8b832a[_0x2620('0x77')]()[_0x2620('0x48')]('c.id');if(_0x13b085[_0x2620('0x43')]){_0x13b085[_0x2620('0x43')][_0x2620('0x58')](function(_0xceada8){_0x8b832a[_0x2620('0x43')]('c.'+_0xceada8[0x0],_0xceada8[0x1]==='DESC'?![]:!![]);});}if(!_[_0x2620('0x78')](_0x5d0ca9)){_0x8b832a[_0x2620('0x79')](_0x2fd04a);_0x3b8f7e[_0x2620('0x45')](_0x2620('0x7a'),_0x5d0ca9);}BPromise[_0x2620('0x7b')]()[_0x2620('0x2a')](function(){if(!_0x53afc6)return;if(_0x3f66ae[_0x2620('0x7c')][_0x2620('0x7d')]!==_0x2620('0x7e'))return;if(!_['some'](_0x53afc6[_0x2620('0x52')],[_0x2620('0x48'),_0x2620('0x5b')])){return _0x3f66ae[_0x2620('0x7c')]['getLists']({'attributes':['id'],'raw':!![]})['then'](function(_0x56dec9){if(_[_0x2620('0x78')](_0x56dec9)){_0x3b8f7e[_0x2620('0x45')](_0x2620('0x7f'));_0x8b832a[_0x2620('0x45')](_0x2620('0x7f'));}else{_0x3b8f7e['where'](_0x2620('0x67'),_[_0x2620('0x57')](_0x56dec9,'id'));_0x8b832a[_0x2620('0x45')](_0x2620('0x67'),_[_0x2620('0x57')](_0x56dec9,'id'));}});}})[_0x2620('0x2a')](function(){if(_0x3f66ae[_0x2620('0x7c')][_0x2620('0x7d')]==='agent'&&!_0x53afc6&&!_0x3f66ae[_0x2620('0x3c')][_0x2620('0x66')])return[];return db[_0x2620('0x80')][_0x2620('0x3c')](_0x3b8f7e[_0x2620('0x81')](),_0x28e214);})[_0x2620('0x2a')](function(_0x2c4cdc){_0x2424b8['count']=_0x2c4cdc[_0x2620('0x38')];if(_0x2424b8[_0x2620('0x24')]===0x0)return[];return db['sequelize'][_0x2620('0x3c')](_0x299d60[_0x2620('0x81')](),_0x28e214)[_0x2620('0x2a')](function(_0x48131e){_0x148bc5=_[_0x2620('0x82')](_0x48131e,'id');_0x28e214=_[_0x2620('0x83')](_0x28e214,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3f66ae[_0x2620('0x3c')][_0x2620('0x40')]){_0x13b085[_0x2620('0x3f')][_0x2620('0x58')](function(_0x467e97){_0x8b832a[_0x2620('0x48')]('c.'+_0x467e97);});}else{_0x8b832a[_0x2620('0x48')](_0x2620('0x73'));_0x8b832a[_0x2620('0x48')](_0x2620('0x84'));_0x8b832a[_0x2620('0x48')](_0x2620('0x85'));_0x8b832a[_0x2620('0x48')](_0x2620('0x86'));_0x8b832a[_0x2620('0x48')](_0x2620('0x87'));_0x8b832a['field']('c.fax');_0x8b832a[_0x2620('0x48')]('c.email');_0x8b832a['field'](_0x2620('0x88'));_0x8b832a[_0x2620('0x48')]('c.createdAt');_0x8b832a[_0x2620('0x48')]('c.deletedAt');_0x8b832a[_0x2620('0x48')]('c.CompanyId');_0x8b832a[_0x2620('0x48')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x2620('0x89'));}if(_0x13b085[_0x2620('0x42')])_0x8b832a[_0x2620('0x42')](_0x13b085[_0x2620('0x42')]);if(_0x13b085['offset'])_0x8b832a[_0x2620('0x25')](_0x13b085[_0x2620('0x25')]);return db[_0x2620('0x80')]['query'](_0x8b832a[_0x2620('0x81')](),_0x28e214);});})['then'](function(_0x3b156f){_0x3b156f['forEach'](function(_0xd02512){if(_0xd02512['TagIds']){_0xd02512[_0x2620('0x8a')]=[];_0xd02512[_0x2620('0x89')][_0x2620('0x56')](',')[_0x2620('0x58')](function(_0x4ae486){_0xd02512['Tags'][_0x2620('0x8b')](_0x148bc5[_0x4ae486]);});}delete _0xd02512['TagIds'];});_0x2424b8['rows']=_0x3b156f;return _0x2424b8;})[_0x2620('0x2a')](respondWithFilteredResult(_0x431e89,_0x13b085));})[_0x2620('0x8c')](handleError(_0x431e89,null));};exports[_0x2620('0x2b')]=function(_0x3a980d,_0x4c9935){return db['CmContact']['find']({'where':{'id':_0x3a980d['params']['id']}})['then'](handleEntityNotFound(_0x4c9935,null))[_0x2620('0x2a')](removeEntity(_0x4c9935,null))[_0x2620('0x8c')](handleError(_0x4c9935,null));};exports[_0x2620('0x8d')]=function(_0x360002,_0xc9c87a){return db['CmContact'][_0x2620('0x8d')]()[_0x2620('0x2a')](function(_0xb21069){delete _0xb21069[_0x2620('0x8e')];for(var _0x439efc=0x0;_0x439efc{}\s\\|]/g,'-');_0x3d3f56(null,util['format'](_0xa037('0x24'),path[_0xa037('0x25')](_0x43fd20['originalname'],path[_0xa037('0x26')](_0x43fd20['originalname'])),Date[_0xa037('0x27')](),path[_0xa037('0x26')](_0x43fd20[_0xa037('0x22')])));}})});router[_0xa037('0x19')](_0xa037('0x28'),upload[_0xa037('0x29')]('file'),controller[_0xa037('0x2a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5bf85d,_0x27b963,_0xae147){_0xae147(null,path[_0xa037('0x1f')](config[_0xa037('0x20')],_0xa037('0x21')));},'filename':function(_0x314037,_0x501f48,_0xd2a0ca){_0x501f48[_0xa037('0x22')]=_0x501f48[_0xa037('0x22')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xd2a0ca(null,util[_0xa037('0x2b')]('%s-%s%s',path[_0xa037('0x25')](_0x501f48[_0xa037('0x22')],path[_0xa037('0x26')](_0x501f48[_0xa037('0x22')])),Date[_0xa037('0x27')](),path[_0xa037('0x26')](_0x501f48[_0xa037('0x22')])));}})});router[_0xa037('0x19')](_0xa037('0x2c'),upload['single']('file'),controller['upload']);router[_0xa037('0x19')](_0xa037('0x2d'),auth[_0xa037('0x9')](),controller[_0xa037('0x2e')]);router['put'](_0xa037('0xd'),auth['isAuthenticated'](),controller[_0xa037('0x2f')]);router[_0xa037('0x30')]('/:id',auth[_0xa037('0x9')](),controller[_0xa037('0x31')]);module[_0xa037('0x32')]=router; \ No newline at end of file +var _0xcc29=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','getJscriptySessions','/:id/journey','getJourney','post','/merge','merge','/create_many','bulkCreate','diskStorage','root','originalname','replace','%s-%s%s','basename','extname','now','/csv','single','file','uploadCsv','join','server/files/tmp','/upload','import'];(function(_0x1c208e,_0x2a0a5b){var _0x5104ff=function(_0x3ca41f){while(--_0x3ca41f){_0x1c208e['push'](_0x1c208e['shift']());}};_0x5104ff(++_0x2a0a5b);}(_0xcc29,0xa4));var _0x9cc2=function(_0x730e78,_0x292471){_0x730e78=_0x730e78-0x0;var _0xed0333=_0xcc29[_0x730e78];return _0xed0333;};'use strict';var multer=require(_0x9cc2('0x0'));var util=require(_0x9cc2('0x1'));var path=require(_0x9cc2('0x2'));var timeout=require(_0x9cc2('0x3'));var express=require(_0x9cc2('0x4'));var router=express[_0x9cc2('0x5')]();var fs_extra=require(_0x9cc2('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9cc2('0x7'));var config=require(_0x9cc2('0x8'));var controller=require(_0x9cc2('0x9'));router[_0x9cc2('0xa')]('/',auth[_0x9cc2('0xb')](),controller[_0x9cc2('0xc')]);router[_0x9cc2('0xa')](_0x9cc2('0xd'),auth[_0x9cc2('0xb')](),controller[_0x9cc2('0xe')]);router[_0x9cc2('0xa')](_0x9cc2('0xf'),auth[_0x9cc2('0xb')](),controller[_0x9cc2('0x10')]);router[_0x9cc2('0xa')](_0x9cc2('0x11'),auth[_0x9cc2('0xb')](),controller[_0x9cc2('0x12')]);router[_0x9cc2('0xa')](_0x9cc2('0x13'),auth[_0x9cc2('0xb')](),controller[_0x9cc2('0x14')]);router[_0x9cc2('0xa')](_0x9cc2('0x15'),auth[_0x9cc2('0xb')](),controller[_0x9cc2('0x16')]);router[_0x9cc2('0xa')]('/:id/hopper_finals',auth[_0x9cc2('0xb')](),controller[_0x9cc2('0x17')]);router[_0x9cc2('0xa')]('/:id/jscripty_sessions',auth['isAuthenticated'](),controller[_0x9cc2('0x18')]);router[_0x9cc2('0xa')](_0x9cc2('0x19'),auth['isAuthenticated'](),controller[_0x9cc2('0x1a')]);router[_0x9cc2('0x1b')](_0x9cc2('0x1c'),auth[_0x9cc2('0xb')](),controller[_0x9cc2('0x1d')]);router[_0x9cc2('0x1b')]('/',auth[_0x9cc2('0xb')](),controller['create']);router[_0x9cc2('0x1b')](_0x9cc2('0x1e'),auth['isAuthenticated'](),controller[_0x9cc2('0x1f')]);router[_0x9cc2('0x1b')](_0x9cc2('0x11'),auth['isAuthenticated'](),controller['setTags']);var upload=multer({'storage':multer[_0x9cc2('0x20')]({'destination':function(_0xdd024e,_0x30b690,_0x241164){_0x241164(null,path['join'](config[_0x9cc2('0x21')],'server/files/tmp'));},'filename':function(_0x266cf3,_0x5d882f,_0x33883c){_0x5d882f[_0x9cc2('0x22')]=_0x5d882f[_0x9cc2('0x22')][_0x9cc2('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x33883c(null,util['format'](_0x9cc2('0x24'),path[_0x9cc2('0x25')](_0x5d882f[_0x9cc2('0x22')],path[_0x9cc2('0x26')](_0x5d882f[_0x9cc2('0x22')])),Date[_0x9cc2('0x27')](),path['extname'](_0x5d882f[_0x9cc2('0x22')])));}})});router[_0x9cc2('0x1b')](_0x9cc2('0x28'),upload[_0x9cc2('0x29')](_0x9cc2('0x2a')),controller[_0x9cc2('0x2b')]);var upload=multer({'storage':multer[_0x9cc2('0x20')]({'destination':function(_0x24b5e6,_0x2a0070,_0x4de8d5){_0x4de8d5(null,path[_0x9cc2('0x2c')](config[_0x9cc2('0x21')],_0x9cc2('0x2d')));},'filename':function(_0x48d0ac,_0x579a44,_0x5268ae){_0x579a44[_0x9cc2('0x22')]=_0x579a44['originalname'][_0x9cc2('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5268ae(null,util['format'](_0x9cc2('0x24'),path[_0x9cc2('0x25')](_0x579a44[_0x9cc2('0x22')],path['extname'](_0x579a44['originalname'])),Date['now'](),path[_0x9cc2('0x26')](_0x579a44[_0x9cc2('0x22')])));}})});router[_0x9cc2('0x1b')](_0x9cc2('0x2e'),upload[_0x9cc2('0x29')](_0x9cc2('0x2a')),controller['upload']);router[_0x9cc2('0x1b')]('/upload/:id',auth[_0x9cc2('0xb')](),controller[_0x9cc2('0x2f')]);router[_0x9cc2('0x30')](_0x9cc2('0xf'),auth[_0x9cc2('0xb')](),controller[_0x9cc2('0x31')]);router[_0x9cc2('0x32')](_0x9cc2('0xf'),auth[_0x9cc2('0xb')](),controller[_0x9cc2('0x33')]);module[_0x9cc2('0x34')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 2d58eee..fb2d3c3 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 _0x5089=['STRING','setDataValue','name','long','select','parse','values','isArray','stringify','BOOLEAN','ENUM','sequelize','lodash','VIRTUAL','getDataValue','alias'];(function(_0x50d73b,_0x1a89df){var _0x2b8c1d=function(_0x482efc){while(--_0x482efc){_0x50d73b['push'](_0x50d73b['shift']());}};_0x2b8c1d(++_0x1a89df);}(_0x5089,0x1bb));var _0x9508=function(_0x344adc,_0x183c37){_0x344adc=_0x344adc-0x0;var _0x4014b2=_0x5089[_0x344adc];return _0x4014b2;};'use strict';var Sequelize=require(_0x9508('0x0'));var _=require(_0x9508('0x1'));module['exports']={'name':{'type':Sequelize[_0x9508('0x2')],'get':function(_0x35878a){return this[_0x9508('0x3')](_0x9508('0x4'));}},'alias':{'type':Sequelize[_0x9508('0x5')],'allowNull':![],'set':function(_0x59d3ee){this[_0x9508('0x6')]('alias',_0x59d3ee?_0x59d3ee:this[_0x9508('0x3')](_0x9508('0x7')));}},'type':{'type':Sequelize[_0x9508('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x9508('0x8')),'get':function(){if(this[_0x9508('0x3')]('type')===_0x9508('0x9')){return JSON[_0x9508('0xa')](this['getDataValue'](_0x9508('0xb')));}else{return this['getDataValue'](_0x9508('0xb'));}},'set':function(_0x26cc8a){if(Array[_0x9508('0xc')](_0x26cc8a)){this[_0x9508('0x6')](_0x9508('0xb'),JSON[_0x9508('0xd')](_0x26cc8a));}else{this['setDataValue'](_0x9508('0xb'),_0x26cc8a);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x9508('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x9508('0xf')]('voice')}}; \ No newline at end of file +var _0x5301=['stringify','BOOLEAN','voice','lodash','exports','VIRTUAL','getDataValue','STRING','setDataValue','alias','name','TEXT','type','select','parse','values','isArray'];(function(_0x5671b7,_0x144a67){var _0x49e7b0=function(_0x3f87e8){while(--_0x3f87e8){_0x5671b7['push'](_0x5671b7['shift']());}};_0x49e7b0(++_0x144a67);}(_0x5301,0x157));var _0x1530=function(_0x1b038a,_0x3ab0d4){_0x1b038a=_0x1b038a-0x0;var _0x367904=_0x5301[_0x1b038a];return _0x367904;};'use strict';var Sequelize=require('sequelize');var _=require(_0x1530('0x0'));module[_0x1530('0x1')]={'name':{'type':Sequelize[_0x1530('0x2')],'get':function(_0x126400){return this[_0x1530('0x3')]('alias');}},'alias':{'type':Sequelize[_0x1530('0x4')],'allowNull':![],'set':function(_0x639c58){this[_0x1530('0x5')](_0x1530('0x6'),_0x639c58?_0x639c58:this['getDataValue'](_0x1530('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x1530('0x8')]('long'),'get':function(){if(this[_0x1530('0x3')](_0x1530('0x9'))===_0x1530('0xa')){return JSON[_0x1530('0xb')](this[_0x1530('0x3')]('values'));}else{return this['getDataValue'](_0x1530('0xc'));}},'set':function(_0x46fc58){if(Array[_0x1530('0xd')](_0x46fc58)){this[_0x1530('0x5')]('values',JSON[_0x1530('0xe')](_0x46fc58));}else{this[_0x1530('0x5')](_0x1530('0xc'),_0x46fc58);}}},'required':{'type':Sequelize[_0x1530('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x1530('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index d603e07..bfdc033 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 _0x7586=['where','pick','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','body','sequelize','transaction','create','TEXT','text','number','Sequelize','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%d','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmCustomField','rawAttributes','type','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort'];(function(_0x4dfbb4,_0x444380){var _0x5a9eee=function(_0x4a9229){while(--_0x4a9229){_0x4dfbb4['push'](_0x4dfbb4['shift']());}};_0x5a9eee(++_0x444380);}(_0x7586,0xbe));var _0x6758=function(_0x5cc556,_0x158710){_0x5cc556=_0x5cc556-0x0;var _0x12103b=_0x7586[_0x5cc556];return _0x12103b;};'use strict';var pdf=require(_0x6758('0x0'));var emlformat=require(_0x6758('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6758('0x2'));var jsonpatch=require(_0x6758('0x3'));var rp=require('request-promise');var moment=require(_0x6758('0x4'));var BPromise=require(_0x6758('0x5'));var Mustache=require(_0x6758('0x6'));var util=require('util');var path=require(_0x6758('0x7'));var sox=require(_0x6758('0x8'));var csv=require(_0x6758('0x9'));var ejs=require(_0x6758('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6758('0xb'));var crypto=require(_0x6758('0xc'));var jsforce=require(_0x6758('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6758('0xe'));var Redis=require(_0x6758('0xf'));var authService=require(_0x6758('0x10'));var qs=require(_0x6758('0x11'));var as=require(_0x6758('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6758('0x13'));var utils=require(_0x6758('0x14'));var config=require(_0x6758('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x544f04,_0x1cd098){_0x1cd098=_0x1cd098||0xcc;return function(_0x180a80){if(_0x180a80){return _0x544f04['sendStatus'](_0x1cd098);}return _0x544f04[_0x6758('0x16')](_0x1cd098)[_0x6758('0x17')]();};}function respondWithResult(_0x115d3f,_0x48fd5a){_0x48fd5a=_0x48fd5a||0xc8;return function(_0x8636ad){if(_0x8636ad){return _0x115d3f[_0x6758('0x16')](_0x48fd5a)['json'](_0x8636ad);}};}function respondWithFilteredResult(_0x59823a,_0x35ae3f){return function(_0x4688f7){if(_0x4688f7){var _0x1d0e59=_0x4688f7[_0x6758('0x18')],_0x2b4cde=_0x35ae3f[_0x6758('0x19')],_0x18cd63=_0x35ae3f[_0x6758('0x19')]+_0x35ae3f[_0x6758('0x1a')],_0x1f14da;if(_0x18cd63>=_0x1d0e59){_0x18cd63=_0x1d0e59;_0x1f14da=0xc8;}else{_0x1f14da=0xce;}_0x59823a[_0x6758('0x16')](_0x1f14da);return _0x59823a[_0x6758('0x1b')](_0x6758('0x1c'),_0x2b4cde+'-'+_0x18cd63+'/'+_0x1d0e59)[_0x6758('0x1d')](_0x4688f7);}return null;};}function patchUpdates(_0x2fbe3a){return function(_0x532513){try{jsonpatch[_0x6758('0x1e')](_0x532513,_0x2fbe3a,!![]);}catch(_0x5c7a5c){return BPromise['reject'](_0x5c7a5c);}return _0x532513[_0x6758('0x1f')]();};}function saveUpdates(_0x35c185,_0x3fc07f){return function(_0x5bb863){if(_0x5bb863){return _0x5bb863[_0x6758('0x20')](_0x35c185)[_0x6758('0x21')](function(_0x5993f5){return _0x5993f5;});}return null;};}function removeEntity(_0x238f40,_0x256fc5){return function(_0x266090){if(_0x266090){return _0x266090[_0x6758('0x22')]()['then'](function(){_0x238f40[_0x6758('0x16')](0xcc)[_0x6758('0x17')]();});}};}function handleEntityNotFound(_0x176ce5,_0x49d973){return function(_0x5c4701){if(!_0x5c4701){_0x176ce5[_0x6758('0x23')](0x194);}return _0x5c4701;};}function handleError(_0x32c9ed,_0x4cbd0c){_0x4cbd0c=_0x4cbd0c||0x1f4;return function(_0x584919){logger[_0x6758('0x24')](_0x584919[_0x6758('0x25')]);if(_0x584919[_0x6758('0x26')]){delete _0x584919['name'];}_0x32c9ed[_0x6758('0x16')](_0x4cbd0c)[_0x6758('0x27')](_0x584919);};}exports[_0x6758('0x28')]=function(_0x155c2a,_0x32e42b){var _0x54b4be={},_0x2bc451={},_0x30ce11={'count':0x0,'rows':[]};var _0x245e0d=_[_0x6758('0x29')](db[_0x6758('0x2a')][_0x6758('0x2b')],function(_0x3b3926){return{'name':_0x3b3926['fieldName'],'type':_0x3b3926[_0x6758('0x2c')]['key']};});_0x2bc451[_0x6758('0x2d')]=_[_0x6758('0x2e')](_['map'](_0x245e0d,'name'),[_0x6758('0x26')]);_0x2bc451[_0x6758('0x2f')]=_[_0x6758('0x30')](_0x155c2a[_0x6758('0x2f')]);_0x2bc451[_0x6758('0x31')]=_[_0x6758('0x32')](_0x2bc451[_0x6758('0x2d')],_0x2bc451[_0x6758('0x2f')]);_0x54b4be[_0x6758('0x33')]=_[_0x6758('0x32')](_0x2bc451['model'],qs[_0x6758('0x34')](_0x155c2a[_0x6758('0x2f')][_0x6758('0x34')]));_0x54b4be[_0x6758('0x33')]=_0x54b4be[_0x6758('0x33')][_0x6758('0x35')]?_0x54b4be[_0x6758('0x33')]:_0x2bc451['model'];if(!_0x155c2a[_0x6758('0x2f')][_0x6758('0x36')]('nolimit')){_0x54b4be[_0x6758('0x1a')]=qs['limit'](_0x155c2a['query'][_0x6758('0x1a')]);_0x54b4be['offset']=qs[_0x6758('0x19')](_0x155c2a[_0x6758('0x2f')][_0x6758('0x19')]);}_0x54b4be['order']=qs[_0x6758('0x37')](_0x155c2a[_0x6758('0x2f')][_0x6758('0x37')]);_0x54b4be[_0x6758('0x38')]=qs[_0x6758('0x31')](_[_0x6758('0x39')](_0x155c2a[_0x6758('0x2f')],_0x2bc451['filters']),_0x245e0d);if(_0x155c2a[_0x6758('0x2f')]['filter']){_0x54b4be[_0x6758('0x38')]=_[_0x6758('0x3a')](_0x54b4be[_0x6758('0x38')],{'$or':_[_0x6758('0x29')](_0x245e0d,function(_0x3303c9){if(_0x3303c9['type']!==_0x6758('0x3b')){var _0x40e920={};_0x40e920[_0x3303c9['name']]={'$like':'%'+_0x155c2a['query']['filter']+'%'};return _0x40e920;}})});}_0x54b4be=_[_0x6758('0x3a')]({},_0x54b4be,_0x155c2a[_0x6758('0x3c')]);var _0x33cb3c={'where':_0x54b4be[_0x6758('0x38')]};return db[_0x6758('0x2a')][_0x6758('0x18')](_0x33cb3c)['then'](function(_0x1c7796){_0x30ce11[_0x6758('0x18')]=_0x1c7796;if(_0x155c2a[_0x6758('0x2f')][_0x6758('0x3d')]){_0x54b4be['include']=[{'all':!![]}];}return db[_0x6758('0x2a')]['findAll'](_0x54b4be);})['then'](function(_0x49d0ba){_0x30ce11[_0x6758('0x3e')]=_0x49d0ba;return _0x30ce11;})[_0x6758('0x21')](respondWithFilteredResult(_0x32e42b,_0x54b4be))[_0x6758('0x3f')](handleError(_0x32e42b,null));};exports[_0x6758('0x40')]=function(_0x16aa80,_0x2a13b4){var _0x548010={'raw':!![],'where':{'id':_0x16aa80[_0x6758('0x41')]['id']}},_0xf2ebdf={};_0xf2ebdf[_0x6758('0x2d')]=_[_0x6758('0x30')](db[_0x6758('0x2a')]['rawAttributes']);_0xf2ebdf[_0x6758('0x2f')]=_[_0x6758('0x30')](_0x16aa80[_0x6758('0x2f')]);_0xf2ebdf[_0x6758('0x31')]=_[_0x6758('0x32')](_0xf2ebdf[_0x6758('0x2d')],_0xf2ebdf[_0x6758('0x2f')]);_0x548010[_0x6758('0x33')]=_['intersection'](_0xf2ebdf[_0x6758('0x2d')],qs[_0x6758('0x34')](_0x16aa80[_0x6758('0x2f')]['fields']));_0x548010[_0x6758('0x33')]=_0x548010['attributes']['length']?_0x548010['attributes']:_0xf2ebdf[_0x6758('0x2d')];if(_0x16aa80[_0x6758('0x2f')]['includeAll']){_0x548010[_0x6758('0x42')]=[{'all':!![]}];}_0x548010=_[_0x6758('0x3a')]({},_0x548010,_0x16aa80[_0x6758('0x3c')]);return db[_0x6758('0x2a')][_0x6758('0x43')](_0x548010)[_0x6758('0x21')](handleEntityNotFound(_0x2a13b4,null))[_0x6758('0x21')](respondWithResult(_0x2a13b4,null))[_0x6758('0x3f')](handleError(_0x2a13b4,null));};exports[_0x6758('0x20')]=function(_0x22ca91,_0x924eb3){if(_0x22ca91['body']['id']){delete _0x22ca91[_0x6758('0x44')]['id'];}return db[_0x6758('0x2a')][_0x6758('0x43')]({'where':{'id':_0x22ca91[_0x6758('0x41')]['id']}})['then'](handleEntityNotFound(_0x924eb3,null))[_0x6758('0x21')](saveUpdates(_0x22ca91[_0x6758('0x44')],null))['then'](respondWithResult(_0x924eb3,null))[_0x6758('0x3f')](handleError(_0x924eb3,null));};exports['destroy']=function(_0x2848c4,_0x30389b){return db[_0x6758('0x2a')][_0x6758('0x43')]({'where':{'id':_0x2848c4[_0x6758('0x41')]['id']}})[_0x6758('0x21')](handleEntityNotFound(_0x30389b,null))[_0x6758('0x21')](removeEntity(_0x30389b,null))[_0x6758('0x3f')](handleError(_0x30389b,null));};exports['create']=function(_0x1b1568,_0x112730){var _0x1e1044;return db[_0x6758('0x45')][_0x6758('0x46')](function(_0x4ff665){return db[_0x6758('0x2a')][_0x6758('0x47')](_0x1b1568[_0x6758('0x44')],{'transaction':_0x4ff665})[_0x6758('0x21')](function(_0xdbda59){_0x1e1044=_0xdbda59;var _0x3e7932={'type':db['Sequelize'][_0x6758('0x48')],'transaction':_0x4ff665};switch(_0x1b1568[_0x6758('0x44')][_0x6758('0x2c')]){case _0x6758('0x49'):_0x3e7932[_0x6758('0x2c')]=db['Sequelize'][_0x6758('0x48')];break;case _0x6758('0x4a'):_0x3e7932[_0x6758('0x2c')]=db[_0x6758('0x4b')]['INTEGER'];break;case'switch':_0x3e7932[_0x6758('0x2c')]=db['Sequelize'][_0x6758('0x4c')];_0x3e7932[_0x6758('0x4d')]=![];break;default:}return db[_0x6758('0x45')][_0x6758('0x4e')][_0x6758('0x4f')](_0x6758('0x50'),util['format'](_0x6758('0x51'),_0x1e1044['id']),_0x3e7932);})[_0x6758('0x21')](function(){return _0x1e1044;});})[_0x6758('0x21')](respondWithResult(_0x112730,0xc9))[_0x6758('0x3f')](handleError(_0x112730,null));}; \ No newline at end of file +var _0x27e8=['status','end','json','limit','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','merge','VIRTUAL','filter','count','includeAll','include','findAll','catch','params','keys','find','body','create','transaction','Sequelize','TEXT','switch','BOOLEAN','sequelize','queryInterface','addColumn','cm_contacts','cf_%d','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x5bce6d,_0x3d3b72){var _0x4ee73c=function(_0x23dc99){while(--_0x23dc99){_0x5bce6d['push'](_0x5bce6d['shift']());}};_0x4ee73c(++_0x3d3b72);}(_0x27e8,0x8d));var _0x827e=function(_0x387c30,_0x4c2cea){_0x387c30=_0x387c30-0x0;var _0x48754e=_0x27e8[_0x387c30];return _0x48754e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x827e('0x0'));var zipdir=require(_0x827e('0x1'));var jsonpatch=require(_0x827e('0x2'));var rp=require(_0x827e('0x3'));var moment=require(_0x827e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x827e('0x5'));var util=require(_0x827e('0x6'));var path=require('path');var sox=require(_0x827e('0x7'));var csv=require('to-csv');var ejs=require(_0x827e('0x8'));var fs=require('fs');var fs_extra=require(_0x827e('0x9'));var _=require(_0x827e('0xa'));var squel=require(_0x827e('0xb'));var crypto=require(_0x827e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x827e('0xd'));var toCsv=require(_0x827e('0xe'));var querystring=require(_0x827e('0xf'));var Papa=require(_0x827e('0x10'));var Redis=require(_0x827e('0x11'));var authService=require(_0x827e('0x12'));var qs=require(_0x827e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x827e('0x14'));var logger=require('../../config/logger')(_0x827e('0x15'));var utils=require(_0x827e('0x16'));var config=require(_0x827e('0x17'));var licenseUtil=require(_0x827e('0x18'));var db=require(_0x827e('0x19'))['db'];function respondWithStatusCode(_0x392fbe,_0x28e398){_0x28e398=_0x28e398||0xcc;return function(_0x4a5c66){if(_0x4a5c66){return _0x392fbe[_0x827e('0x1a')](_0x28e398);}return _0x392fbe[_0x827e('0x1b')](_0x28e398)[_0x827e('0x1c')]();};}function respondWithResult(_0x3b2bf1,_0x25622b){_0x25622b=_0x25622b||0xc8;return function(_0x40982d){if(_0x40982d){return _0x3b2bf1['status'](_0x25622b)[_0x827e('0x1d')](_0x40982d);}};}function respondWithFilteredResult(_0x199f3c,_0x3eaa8c){return function(_0x2612c6){if(_0x2612c6){var _0x18957c=_0x2612c6['count'],_0x344c51=_0x3eaa8c['offset'],_0x18ad00=_0x3eaa8c['offset']+_0x3eaa8c[_0x827e('0x1e')],_0x1dc947;if(_0x18ad00>=_0x18957c){_0x18ad00=_0x18957c;_0x1dc947=0xc8;}else{_0x1dc947=0xce;}_0x199f3c[_0x827e('0x1b')](_0x1dc947);return _0x199f3c['set']('Content-Range',_0x344c51+'-'+_0x18ad00+'/'+_0x18957c)[_0x827e('0x1d')](_0x2612c6);}return null;};}function patchUpdates(_0x1ee87e){return function(_0x4163e7){try{jsonpatch[_0x827e('0x1f')](_0x4163e7,_0x1ee87e,!![]);}catch(_0x553335){return BPromise[_0x827e('0x20')](_0x553335);}return _0x4163e7[_0x827e('0x21')]();};}function saveUpdates(_0x1efe5b,_0x5df986){return function(_0x266418){if(_0x266418){return _0x266418[_0x827e('0x22')](_0x1efe5b)[_0x827e('0x23')](function(_0x668c){return _0x668c;});}return null;};}function removeEntity(_0xd1220a,_0x5e7442){return function(_0x16ddbd){if(_0x16ddbd){return _0x16ddbd[_0x827e('0x24')]()[_0x827e('0x23')](function(){_0xd1220a[_0x827e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28ca2c,_0x29889e){return function(_0x5d07c8){if(!_0x5d07c8){_0x28ca2c[_0x827e('0x1a')](0x194);}return _0x5d07c8;};}function handleError(_0x208547,_0x294c05){_0x294c05=_0x294c05||0x1f4;return function(_0x30bd30){logger[_0x827e('0x25')](_0x30bd30[_0x827e('0x26')]);if(_0x30bd30[_0x827e('0x27')]){delete _0x30bd30[_0x827e('0x27')];}_0x208547[_0x827e('0x1b')](_0x294c05)[_0x827e('0x28')](_0x30bd30);};}exports[_0x827e('0x29')]=function(_0x435685,_0x193783){var _0x346a41={},_0x12dd9b={},_0x36fca4={'count':0x0,'rows':[]};var _0x5ebf8b=_[_0x827e('0x2a')](db[_0x827e('0x2b')][_0x827e('0x2c')],function(_0x34669c){return{'name':_0x34669c[_0x827e('0x2d')],'type':_0x34669c[_0x827e('0x2e')][_0x827e('0x2f')]};});_0x12dd9b[_0x827e('0x30')]=_['differenceBy'](_['map'](_0x5ebf8b,_0x827e('0x27')),[_0x827e('0x27')]);_0x12dd9b[_0x827e('0x31')]=_['keys'](_0x435685['query']);_0x12dd9b[_0x827e('0x32')]=_[_0x827e('0x33')](_0x12dd9b[_0x827e('0x30')],_0x12dd9b[_0x827e('0x31')]);_0x346a41[_0x827e('0x34')]=_[_0x827e('0x33')](_0x12dd9b[_0x827e('0x30')],qs[_0x827e('0x35')](_0x435685[_0x827e('0x31')][_0x827e('0x35')]));_0x346a41[_0x827e('0x34')]=_0x346a41['attributes'][_0x827e('0x36')]?_0x346a41[_0x827e('0x34')]:_0x12dd9b[_0x827e('0x30')];if(!_0x435685[_0x827e('0x31')][_0x827e('0x37')]('nolimit')){_0x346a41['limit']=qs['limit'](_0x435685[_0x827e('0x31')][_0x827e('0x1e')]);_0x346a41[_0x827e('0x38')]=qs[_0x827e('0x38')](_0x435685[_0x827e('0x31')][_0x827e('0x38')]);}_0x346a41[_0x827e('0x39')]=qs[_0x827e('0x3a')](_0x435685[_0x827e('0x31')][_0x827e('0x3a')]);_0x346a41[_0x827e('0x3b')]=qs['filters'](_[_0x827e('0x3c')](_0x435685[_0x827e('0x31')],_0x12dd9b[_0x827e('0x32')]),_0x5ebf8b);if(_0x435685[_0x827e('0x31')]['filter']){_0x346a41[_0x827e('0x3b')]=_[_0x827e('0x3d')](_0x346a41['where'],{'$or':_[_0x827e('0x2a')](_0x5ebf8b,function(_0x4548e5){if(_0x4548e5[_0x827e('0x2e')]!==_0x827e('0x3e')){var _0x359d58={};_0x359d58[_0x4548e5[_0x827e('0x27')]]={'$like':'%'+_0x435685[_0x827e('0x31')][_0x827e('0x3f')]+'%'};return _0x359d58;}})});}_0x346a41=_['merge']({},_0x346a41,_0x435685['options']);var _0x3ada0b={'where':_0x346a41[_0x827e('0x3b')]};return db[_0x827e('0x2b')]['count'](_0x3ada0b)[_0x827e('0x23')](function(_0x1b77b7){_0x36fca4[_0x827e('0x40')]=_0x1b77b7;if(_0x435685['query'][_0x827e('0x41')]){_0x346a41[_0x827e('0x42')]=[{'all':!![]}];}return db[_0x827e('0x2b')][_0x827e('0x43')](_0x346a41);})['then'](function(_0x3b34b6){_0x36fca4['rows']=_0x3b34b6;return _0x36fca4;})[_0x827e('0x23')](respondWithFilteredResult(_0x193783,_0x346a41))[_0x827e('0x44')](handleError(_0x193783,null));};exports['show']=function(_0x16606d,_0x4d9f9a){var _0xe40fcd={'raw':!![],'where':{'id':_0x16606d[_0x827e('0x45')]['id']}},_0x7b4eac={};_0x7b4eac[_0x827e('0x30')]=_[_0x827e('0x46')](db[_0x827e('0x2b')]['rawAttributes']);_0x7b4eac[_0x827e('0x31')]=_['keys'](_0x16606d[_0x827e('0x31')]);_0x7b4eac[_0x827e('0x32')]=_[_0x827e('0x33')](_0x7b4eac[_0x827e('0x30')],_0x7b4eac[_0x827e('0x31')]);_0xe40fcd[_0x827e('0x34')]=_[_0x827e('0x33')](_0x7b4eac['model'],qs[_0x827e('0x35')](_0x16606d[_0x827e('0x31')][_0x827e('0x35')]));_0xe40fcd[_0x827e('0x34')]=_0xe40fcd['attributes'][_0x827e('0x36')]?_0xe40fcd[_0x827e('0x34')]:_0x7b4eac[_0x827e('0x30')];if(_0x16606d[_0x827e('0x31')][_0x827e('0x41')]){_0xe40fcd[_0x827e('0x42')]=[{'all':!![]}];}_0xe40fcd=_[_0x827e('0x3d')]({},_0xe40fcd,_0x16606d['options']);return db[_0x827e('0x2b')][_0x827e('0x47')](_0xe40fcd)['then'](handleEntityNotFound(_0x4d9f9a,null))[_0x827e('0x23')](respondWithResult(_0x4d9f9a,null))[_0x827e('0x44')](handleError(_0x4d9f9a,null));};exports[_0x827e('0x22')]=function(_0x1cf9e0,_0x51971d){if(_0x1cf9e0['body']['id']){delete _0x1cf9e0[_0x827e('0x48')]['id'];}return db[_0x827e('0x2b')][_0x827e('0x47')]({'where':{'id':_0x1cf9e0[_0x827e('0x45')]['id']}})['then'](handleEntityNotFound(_0x51971d,null))[_0x827e('0x23')](saveUpdates(_0x1cf9e0[_0x827e('0x48')],null))[_0x827e('0x23')](respondWithResult(_0x51971d,null))[_0x827e('0x44')](handleError(_0x51971d,null));};exports['destroy']=function(_0x115db6,_0x65e0b2){return db[_0x827e('0x2b')][_0x827e('0x47')]({'where':{'id':_0x115db6[_0x827e('0x45')]['id']}})['then'](handleEntityNotFound(_0x65e0b2,null))['then'](removeEntity(_0x65e0b2,null))['catch'](handleError(_0x65e0b2,null));};exports[_0x827e('0x49')]=function(_0x452d39,_0x340567){var _0x2f2947;return db['sequelize'][_0x827e('0x4a')](function(_0x1f5e4b){return db[_0x827e('0x2b')][_0x827e('0x49')](_0x452d39[_0x827e('0x48')],{'transaction':_0x1f5e4b})['then'](function(_0x36e80b){_0x2f2947=_0x36e80b;var _0x3498a1={'type':db[_0x827e('0x4b')][_0x827e('0x4c')],'transaction':_0x1f5e4b};switch(_0x452d39[_0x827e('0x48')]['type']){case'text':_0x3498a1[_0x827e('0x2e')]=db[_0x827e('0x4b')][_0x827e('0x4c')];break;case'number':_0x3498a1[_0x827e('0x2e')]=db[_0x827e('0x4b')]['INTEGER'];break;case _0x827e('0x4d'):_0x3498a1[_0x827e('0x2e')]=db[_0x827e('0x4b')][_0x827e('0x4e')];_0x3498a1['defaultValue']=![];break;default:}return db[_0x827e('0x4f')][_0x827e('0x50')][_0x827e('0x51')](_0x827e('0x52'),util['format'](_0x827e('0x53'),_0x2f2947['id']),_0x3498a1);})['then'](function(){return _0x2f2947;});})[_0x827e('0x23')](respondWithResult(_0x340567,0xc9))['catch'](handleError(_0x340567,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index d74fc86..8f69a87 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 _0xd3f3=['rimraf','../../config/environment','exports','define','CmCustomField','cm_custom_fields','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2e3ebb,_0x5afc59){var _0x8f027f=function(_0x29b2f3){while(--_0x29b2f3){_0x2e3ebb['push'](_0x2e3ebb['shift']());}};_0x8f027f(++_0x5afc59);}(_0xd3f3,0xf0));var _0x3d3f=function(_0x34cbaf,_0x4ce9f9){_0x34cbaf=_0x34cbaf-0x0;var _0x122bdc=_0xd3f3[_0x34cbaf];return _0x122bdc;};'use strict';var _=require(_0x3d3f('0x0'));var util=require('util');var logger=require(_0x3d3f('0x1'))(_0x3d3f('0x2'));var moment=require(_0x3d3f('0x3'));var BPromise=require(_0x3d3f('0x4'));var rp=require(_0x3d3f('0x5'));var fs=require('fs');var path=require(_0x3d3f('0x6'));var rimraf=require(_0x3d3f('0x7'));var config=require(_0x3d3f('0x8'));var attributes=require('./cmCustomField.attributes');module[_0x3d3f('0x9')]=function(_0x985409,_0x3bb05d){return _0x985409[_0x3d3f('0xa')](_0x3d3f('0xb'),attributes,{'tableName':_0x3d3f('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f9d=['../../config/logger','moment','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash'];(function(_0x462999,_0x24d200){var _0x4b1366=function(_0x1fa353){while(--_0x1fa353){_0x462999['push'](_0x462999['shift']());}};_0x4b1366(++_0x24d200);}(_0x9f9d,0x1c2));var _0xd9f9=function(_0x41535b,_0x2082d3){_0x41535b=_0x41535b-0x0;var _0x525357=_0x9f9d[_0x41535b];return _0x525357;};'use strict';var _=require(_0xd9f9('0x0'));var util=require('util');var logger=require(_0xd9f9('0x1'))('api');var moment=require(_0xd9f9('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd9f9('0x3'));var rimraf=require(_0xd9f9('0x4'));var config=require(_0xd9f9('0x5'));var attributes=require(_0xd9f9('0x6'));module[_0xd9f9('0x7')]=function(_0x1dec53,_0x3c3aa2){return _0x1dec53[_0xd9f9('0x8')](_0xd9f9('0x9'),attributes,{'tableName':_0xd9f9('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 9b066bb..e60d519 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 _0xdace=['request\x20sent','debug','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0xbc4560,_0x4020b8){var _0x298cfb=function(_0x254423){while(--_0x254423){_0xbc4560['push'](_0xbc4560['shift']());}};_0x298cfb(++_0x4020b8);}(_0xdace,0xc5));var _0xedac=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xdace[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var moment=require(_0xedac('0x1'));var BPromise=require(_0xedac('0x2'));var rs=require(_0xedac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedac('0x4'))['db'];var utils=require(_0xedac('0x5'));var logger=require(_0xedac('0x6'))(_0xedac('0x7'));var config=require('../../config/environment');var jayson=require(_0xedac('0x8'));var client=jayson[_0xedac('0x9')][_0xedac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ecbd3,_0x4081c6,_0x21440e){return new BPromise(function(_0x162eea,_0x53fa43){return client[_0xedac('0xb')](_0x5ecbd3,_0x21440e)[_0xedac('0xc')](function(_0xc98887){logger['info']('CmCustomField,\x20%s,\x20%s',_0x4081c6,_0xedac('0xd'));logger[_0xedac('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x4081c6,'request\x20sent',JSON[_0xedac('0xf')](_0xc98887));if(_0xc98887[_0xedac('0x10')]){if(_0xc98887['error'][_0xedac('0x11')]===0x1f4){logger['error'](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);return _0x53fa43(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')]['message']);return _0x162eea(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}else{logger[_0xedac('0x14')](_0xedac('0x12'),_0x4081c6,_0xedac('0xd'));_0x162eea(_0xc98887['result'][_0xedac('0x13')]);}})['catch'](function(_0xddc7b8){logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xddc7b8);_0x53fa43(_0xddc7b8);});});} \ No newline at end of file +var _0x0a9a=['CmCustomField,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x39194a,_0x10366c){var _0x21af77=function(_0x6e421b){while(--_0x6e421b){_0x39194a['push'](_0x39194a['shift']());}};_0x21af77(++_0x10366c);}(_0x0a9a,0x183));var _0xa0a9=function(_0xf55335,_0x498bdf){_0xf55335=_0xf55335-0x0;var _0x37a947=_0x0a9a[_0xf55335];return _0x37a947;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var moment=require('moment');var BPromise=require(_0xa0a9('0x1'));var rs=require(_0xa0a9('0x2'));var fs=require('fs');var Redis=require(_0xa0a9('0x3'));var db=require(_0xa0a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0a9('0x7'));var client=jayson[_0xa0a9('0x8')][_0xa0a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31d689,_0x499a29,_0x2b2eb4){return new BPromise(function(_0x520f42,_0x10aa8a){return client[_0xa0a9('0xa')](_0x31d689,_0x2b2eb4)[_0xa0a9('0xb')](function(_0x2d6ac0){logger['info'](_0xa0a9('0xc'),_0x499a29,_0xa0a9('0xd'));logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x499a29,_0xa0a9('0xd'),JSON[_0xa0a9('0xe')](_0x2d6ac0));if(_0x2d6ac0['error']){if(_0x2d6ac0[_0xa0a9('0xf')]['code']===0x1f4){logger[_0xa0a9('0xf')]('CmCustomField,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x10aa8a(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}logger[_0xa0a9('0xf')]('CmCustomField,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x520f42(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}else{logger[_0xa0a9('0x11')](_0xa0a9('0xc'),_0x499a29,'request\x20sent');_0x520f42(_0x2d6ac0[_0xa0a9('0x12')]['message']);}})['catch'](function(_0x347092){logger[_0xa0a9('0xf')](_0xa0a9('0xc'),_0x499a29,_0x347092);_0x10aa8a(_0x347092);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 25c0785..91f4ac4 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 _0x55a2=['create','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./cmCustomField.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0x45c48f,_0x4aa891){var _0xaf5037=function(_0x3e3c1f){while(--_0x3e3c1f){_0x45c48f['push'](_0x45c48f['shift']());}};_0xaf5037(++_0x4aa891);}(_0x55a2,0x148));var _0x255a=function(_0x3e25c1,_0x1d15f9){_0x3e25c1=_0x3e25c1-0x0;var _0x52e7f2=_0x55a2[_0x3e25c1];return _0x52e7f2;};'use strict';var multer=require(_0x255a('0x0'));var util=require('util');var path=require(_0x255a('0x1'));var timeout=require(_0x255a('0x2'));var express=require(_0x255a('0x3'));var router=express[_0x255a('0x4')]();var fs_extra=require(_0x255a('0x5'));var auth=require(_0x255a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x255a('0x7'));router[_0x255a('0x8')]('/',auth['isAuthenticated'](),controller[_0x255a('0x9')]);router[_0x255a('0x8')](_0x255a('0xa'),auth[_0x255a('0xb')](),controller[_0x255a('0xc')]);router[_0x255a('0xd')]('/',auth[_0x255a('0xb')](),controller[_0x255a('0xe')]);router['put'](_0x255a('0xa'),auth[_0x255a('0xb')](),controller['update']);router[_0x255a('0xf')](_0x255a('0xa'),auth[_0x255a('0xb')](),controller[_0x255a('0x10')]);module[_0x255a('0x11')]=router; \ No newline at end of file +var _0x9f13=['isAuthenticated','index','post','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCustomField.controller','get'];(function(_0x1bd26e,_0x3f93bc){var _0x536979=function(_0x4b061f){while(--_0x4b061f){_0x1bd26e['push'](_0x1bd26e['shift']());}};_0x536979(++_0x3f93bc);}(_0x9f13,0x117));var _0x39f1=function(_0x38cb44,_0x2cfb6a){_0x38cb44=_0x38cb44-0x0;var _0x2d08ab=_0x9f13[_0x38cb44];return _0x2d08ab;};'use strict';var multer=require(_0x39f1('0x0'));var util=require(_0x39f1('0x1'));var path=require(_0x39f1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x39f1('0x3')]();var fs_extra=require(_0x39f1('0x4'));var auth=require(_0x39f1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x39f1('0x6'));var controller=require(_0x39f1('0x7'));router[_0x39f1('0x8')]('/',auth[_0x39f1('0x9')](),controller[_0x39f1('0xa')]);router['get']('/:id',auth[_0x39f1('0x9')](),controller['show']);router[_0x39f1('0xb')]('/',auth[_0x39f1('0x9')](),controller[_0x39f1('0xc')]);router[_0x39f1('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x39f1('0xe')]);router[_0x39f1('0xf')]('/:id',auth[_0x39f1('0x9')](),controller[_0x39f1('0x10')]);module[_0x39f1('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 63018d6..bdcd29b 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 _0xd0bb=['format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','DATE','UNSIGNED','contactListQueue','moment','sequelize','exports','BOOLEAN'];(function(_0x2dcb17,_0x14f72c){var _0x20f3fc=function(_0x4f01bf){while(--_0x4f01bf){_0x2dcb17['push'](_0x2dcb17['shift']());}};_0x20f3fc(++_0x14f72c);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0xb9c2da,_0x5e481a){_0xb9c2da=_0xb9c2da-0x0;var _0x195d1d=_0xd0bb[_0xb9c2da];return _0x195d1d;};'use strict';var moment=require(_0xbd0b('0x0'));var Sequelize=require(_0xbd0b('0x1'));module[_0xbd0b('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xbd0b('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xbd0b('0x4')](_0xbd0b('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbd0b('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xbd0b('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xbd0b('0x7')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbd0b('0x8')]},'priority':{'type':Sequelize[_0xbd0b('0x6')](0x2)[_0xbd0b('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xbd0b('0x6')],'unique':_0xbd0b('0xa')},'ListId':{'type':Sequelize[_0xbd0b('0x6')],'unique':_0xbd0b('0xa')},'UserId':{'type':Sequelize[_0xbd0b('0x6')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xbd0b('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xbd0b('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbd0b('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbd0b('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x826a=['BOOLEAN','UNSIGNED','contactListQueue','sequelize','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x575ba8,_0x8e6048){var _0x487763=function(_0x3f6292){while(--_0x3f6292){_0x575ba8['push'](_0x575ba8['shift']());}};_0x487763(++_0x8e6048);}(_0x826a,0x1aa));var _0xa826=function(_0x1688ef,_0x250113){_0x1688ef=_0x1688ef-0x0;var _0x512784=_0x826a[_0x1688ef];return _0x512784;};'use strict';var moment=require('moment');var Sequelize=require(_0xa826('0x0'));module['exports']={'phone':{'type':Sequelize[_0xa826('0x1')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xa826('0x2')],'defaultValue':moment()[_0xa826('0x3')](_0xa826('0x4'))},'countbusyretry':{'type':Sequelize[_0xa826('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa826('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xa826('0x6')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa826('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa826('0x2')]},'priority':{'type':Sequelize[_0xa826('0x5')](0x2)[_0xa826('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xa826('0x6')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa826('0x5')],'unique':_0xa826('0x8')},'ListId':{'type':Sequelize[_0xa826('0x5')],'unique':_0xa826('0x8')},'UserId':{'type':Sequelize[_0xa826('0x5')]},'VoiceQueueId':{'type':Sequelize[_0xa826('0x5')],'unique':_0xa826('0x8')},'CampaignId':{'type':Sequelize[_0xa826('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xa826('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa826('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa826('0x5')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index ca49e2c..e41b5be 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 _0xdb70=['CmCompany','Company','CmList','List','Queue','dialActive','getOpenContacts','isNumber','error','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','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','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','send','index','map','CmHopper','rawAttributes','fieldName','key','model','name','keys','filters','intersection','concat','$or','$gt','$gte','$ne','$eq','$not','$notBetween','$in','$notIn','$like','$iLike','$contains','$contained','$any','fields','query','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','length','find','create','body','params','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','campaign','membername','UserId','user','deleted','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','transaction','format','direction','prev','isEmpty','hopperIds','priority','ASC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact'];(function(_0x21fde2,_0x47ddc5){var _0x435f15=function(_0x51b038){while(--_0x51b038){_0x21fde2['push'](_0x21fde2['shift']());}};_0x435f15(++_0x47ddc5);}(_0xdb70,0xa0));var _0x0db7=function(_0x176585,_0x960a00){_0x176585=_0x176585-0x0;var _0xc78d13=_0xdb70[_0x176585];return _0xc78d13;};'use strict';var pdf=require(_0x0db7('0x0'));var emlformat=require(_0x0db7('0x1'));var rimraf=require(_0x0db7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0db7('0x3'));var rp=require(_0x0db7('0x4'));var moment=require(_0x0db7('0x5'));var BPromise=require(_0x0db7('0x6'));var Mustache=require(_0x0db7('0x7'));var util=require(_0x0db7('0x8'));var path=require(_0x0db7('0x9'));var sox=require(_0x0db7('0xa'));var csv=require(_0x0db7('0xb'));var ejs=require(_0x0db7('0xc'));var fs=require('fs');var fs_extra=require(_0x0db7('0xd'));var _=require('lodash');var squel=require(_0x0db7('0xe'));var crypto=require(_0x0db7('0xf'));var jsforce=require(_0x0db7('0x10'));var deskjs=require(_0x0db7('0x11'));var toCsv=require(_0x0db7('0xb'));var querystring=require(_0x0db7('0x12'));var Papa=require('papaparse');var Redis=require(_0x0db7('0x13'));var authService=require(_0x0db7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x0db7('0x15'));var hardwareService=require(_0x0db7('0x16'));var logger=require(_0x0db7('0x17'))(_0x0db7('0x18'));var utils=require('../../config/utils');var config=require(_0x0db7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x0db7('0x1a'))['db'];function respondWithStatusCode(_0x2959a2,_0x33ec07){_0x33ec07=_0x33ec07||0xcc;return function(_0x404322){if(_0x404322){return _0x2959a2[_0x0db7('0x1b')](_0x33ec07);}return _0x2959a2['status'](_0x33ec07)[_0x0db7('0x1c')]();};}function respondWithResult(_0x195556,_0x45f594){_0x45f594=_0x45f594||0xc8;return function(_0x27137d){if(_0x27137d){return _0x195556[_0x0db7('0x1d')](_0x45f594)[_0x0db7('0x1e')](_0x27137d);}};}function respondWithFilteredResult(_0x41b2b3,_0x2edbe9){return function(_0xb9127d){if(_0xb9127d){var _0x34f136=_0xb9127d[_0x0db7('0x1f')],_0x4c7746=_0x2edbe9[_0x0db7('0x20')],_0x21cd17=_0x2edbe9[_0x0db7('0x20')]+_0x2edbe9[_0x0db7('0x21')],_0x389925;if(_0x21cd17>=_0x34f136){_0x21cd17=_0x34f136;_0x389925=0xc8;}else{_0x389925=0xce;}_0x41b2b3['status'](_0x389925);return _0x41b2b3['set'](_0x0db7('0x22'),_0x4c7746+'-'+_0x21cd17+'/'+_0x34f136)[_0x0db7('0x1e')](_0xb9127d);}return null;};}function patchUpdates(_0xe9a55d){return function(_0x4c3d50){try{jsonpatch[_0x0db7('0x23')](_0x4c3d50,_0xe9a55d,!![]);}catch(_0x140721){return BPromise[_0x0db7('0x24')](_0x140721);}return _0x4c3d50[_0x0db7('0x25')]();};}function saveUpdates(_0x5a0b04,_0xd88751){return function(_0x48feb2){if(_0x48feb2){return _0x48feb2[_0x0db7('0x26')](_0x5a0b04)['then'](function(_0x59b7e4){return _0x59b7e4;});}return null;};}function removeEntity(_0x135429,_0x156aaa){return function(_0x472132){if(_0x472132){return _0x472132[_0x0db7('0x27')]()[_0x0db7('0x28')](function(){_0x135429[_0x0db7('0x1d')](0xcc)[_0x0db7('0x1c')]();});}};}function handleEntityNotFound(_0x274bf1,_0x298c12){return function(_0x1baea7){if(!_0x1baea7){_0x274bf1[_0x0db7('0x1b')](0x194);}return _0x1baea7;};}function handleError(_0x456746,_0x299c22){_0x299c22=_0x299c22||0x1f4;return function(_0x55f339){logger['error'](_0x55f339['stack']);if(_0x55f339['name']){delete _0x55f339['name'];}_0x456746['status'](_0x299c22)[_0x0db7('0x29')](_0x55f339);};}exports[_0x0db7('0x2a')]=function(_0x5ea1dc,_0x55637e){var _0x5d3091={},_0x3279b5={},_0x9d20d2={'count':0x0,'rows':[]};var _0x3f2169=_[_0x0db7('0x2b')](db[_0x0db7('0x2c')][_0x0db7('0x2d')],function(_0x4ca418){return{'name':_0x4ca418[_0x0db7('0x2e')],'type':_0x4ca418['type'][_0x0db7('0x2f')]};});_0x3279b5[_0x0db7('0x30')]=_[_0x0db7('0x2b')](_0x3f2169,_0x0db7('0x31'));_0x3279b5['query']=_[_0x0db7('0x32')](_0x5ea1dc['query']);_0x3279b5[_0x0db7('0x33')]=_[_0x0db7('0x34')](_0x3279b5[_0x0db7('0x30')],_0x3279b5['query']);_0x3279b5[_0x0db7('0x33')]=_[_0x0db7('0x35')](_0x3279b5['filters'],['$and',_0x0db7('0x36'),_0x0db7('0x37'),_0x0db7('0x38'),'$lt','$lte',_0x0db7('0x39'),_0x0db7('0x3a'),_0x0db7('0x3b'),'$between',_0x0db7('0x3c'),_0x0db7('0x3d'),_0x0db7('0x3e'),_0x0db7('0x3f'),'$notLike',_0x0db7('0x40'),'$notILike',_0x0db7('0x3f'),'$overlap',_0x0db7('0x41'),_0x0db7('0x42'),_0x0db7('0x43')]);_0x5d3091['attributes']=_['intersection'](_0x3279b5[_0x0db7('0x30')],qs[_0x0db7('0x44')](_0x5ea1dc[_0x0db7('0x45')][_0x0db7('0x44')]));_0x5d3091[_0x0db7('0x46')]=_0x5d3091[_0x0db7('0x46')]['length']?_0x5d3091[_0x0db7('0x46')]:_0x3279b5[_0x0db7('0x30')];if(!_0x5ea1dc['query'][_0x0db7('0x47')]('nolimit')){_0x5d3091[_0x0db7('0x21')]=qs['limit'](_0x5ea1dc[_0x0db7('0x45')][_0x0db7('0x21')]);_0x5d3091['offset']=qs[_0x0db7('0x20')](_0x5ea1dc[_0x0db7('0x45')]['offset']);}_0x5d3091[_0x0db7('0x48')]=qs['sort'](_0x5ea1dc[_0x0db7('0x45')][_0x0db7('0x49')]);_0x5d3091[_0x0db7('0x4a')]=qs[_0x0db7('0x33')](_[_0x0db7('0x4b')](_0x5ea1dc['query'],_0x3279b5[_0x0db7('0x33')]),_0x3f2169);if(_0x5ea1dc[_0x0db7('0x45')][_0x0db7('0x4c')]){_0x5d3091[_0x0db7('0x4a')]=_[_0x0db7('0x4d')](_0x5d3091[_0x0db7('0x4a')],{'$or':_[_0x0db7('0x2b')](_0x3f2169,function(_0x3699a1){if(_0x3699a1[_0x0db7('0x4e')]!==_0x0db7('0x4f')){var _0x27e541={};_0x27e541[_0x3699a1[_0x0db7('0x31')]]={'$like':'%'+_0x5ea1dc['query'][_0x0db7('0x4c')]+'%'};return _0x27e541;}})});}_0x5d3091=_['merge']({},_0x5d3091,_0x5ea1dc[_0x0db7('0x50')]);var _0x150936={'where':_0x5d3091['where']};return db[_0x0db7('0x2c')]['count'](_0x150936)[_0x0db7('0x28')](function(_0x40189f){_0x9d20d2[_0x0db7('0x1f')]=_0x40189f;if(_0x5ea1dc[_0x0db7('0x45')][_0x0db7('0x51')]){_0x5d3091[_0x0db7('0x52')]=[{'all':!![]}];}return db[_0x0db7('0x2c')][_0x0db7('0x53')](_0x5d3091);})[_0x0db7('0x28')](function(_0x594046){_0x9d20d2['rows']=_0x594046;return _0x9d20d2;})['then'](respondWithFilteredResult(_0x55637e,_0x5d3091))[_0x0db7('0x54')](handleError(_0x55637e,null));};exports[_0x0db7('0x55')]=function(_0x45e68c,_0x3750ed){var _0x1badb1={'raw':!![],'where':{'id':_0x45e68c['params']['id']}},_0x2a420b={};_0x2a420b[_0x0db7('0x30')]=_[_0x0db7('0x32')](db['CmHopper'][_0x0db7('0x2d')]);_0x2a420b[_0x0db7('0x45')]=_[_0x0db7('0x32')](_0x45e68c['query']);_0x2a420b[_0x0db7('0x33')]=_[_0x0db7('0x34')](_0x2a420b[_0x0db7('0x30')],_0x2a420b[_0x0db7('0x45')]);_0x1badb1[_0x0db7('0x46')]=_['intersection'](_0x2a420b[_0x0db7('0x30')],qs[_0x0db7('0x44')](_0x45e68c[_0x0db7('0x45')][_0x0db7('0x44')]));_0x1badb1['attributes']=_0x1badb1['attributes'][_0x0db7('0x56')]?_0x1badb1['attributes']:_0x2a420b['model'];if(_0x45e68c[_0x0db7('0x45')][_0x0db7('0x51')]){_0x1badb1['include']=[{'all':!![]}];}_0x1badb1=_[_0x0db7('0x4d')]({},_0x1badb1,_0x45e68c[_0x0db7('0x50')]);return db[_0x0db7('0x2c')][_0x0db7('0x57')](_0x1badb1)['then'](handleEntityNotFound(_0x3750ed,null))['then'](respondWithResult(_0x3750ed,null))['catch'](handleError(_0x3750ed,null));};exports[_0x0db7('0x58')]=function(_0x342596,_0x1ac5df){return db[_0x0db7('0x2c')]['create'](_0x342596[_0x0db7('0x59')],{})['then'](respondWithResult(_0x1ac5df,0xc9))['catch'](handleError(_0x1ac5df,null));};exports['update']=function(_0x3f2ac9,_0x4398b4){if(_0x3f2ac9[_0x0db7('0x59')]['id']){delete _0x3f2ac9[_0x0db7('0x59')]['id'];}return db[_0x0db7('0x2c')]['find']({'where':{'id':_0x3f2ac9[_0x0db7('0x5a')]['id']}})[_0x0db7('0x28')](handleEntityNotFound(_0x4398b4,null))[_0x0db7('0x28')](saveUpdates(_0x3f2ac9['body'],null))[_0x0db7('0x28')](respondWithResult(_0x4398b4,null))[_0x0db7('0x54')](handleError(_0x4398b4,null));};exports['describe']=function(_0x4c2833,_0x5cb5cb){return db[_0x0db7('0x2c')][_0x0db7('0x5b')]()[_0x0db7('0x28')](respondWithResult(_0x5cb5cb,null))[_0x0db7('0x54')](handleError(_0x5cb5cb,null));};exports['destroy']=function(_0x174e0c,_0x2ce383){var _0x266679;return db[_0x0db7('0x2c')]['find']({'where':{'id':_0x174e0c['params']['id']}})['then'](handleEntityNotFound(_0x2ce383,null))[_0x0db7('0x28')](function(_0x5c999a){if(_0x5c999a){return _0x5c999a[_0x0db7('0x27')]()[_0x0db7('0x28')](function(_0x54f32a){return _0x54f32a;});}})[_0x0db7('0x28')](function(_0x16b5f4){_0x266679=_0x16b5f4;if(_0x16b5f4){if(_0x16b5f4[_0x0db7('0x5c')]||_0x16b5f4[_0x0db7('0x5d')]){return db[_0x16b5f4[_0x0db7('0x5c')]?_0x0db7('0x5e'):_0x0db7('0x5f')][_0x0db7('0x57')]({'where':{'id':_0x16b5f4['VoiceQueueId']?_0x16b5f4[_0x0db7('0x5c')]:_0x16b5f4[_0x0db7('0x5d')]},'attributes':['id','name'],'raw':!![]});}}})[_0x0db7('0x28')](function(_0x5ca033){var _0x4172a5={};if(_0x5ca033){_['merge'](_0x4172a5,_[_0x0db7('0x60')](_0x266679[_0x0db7('0x61')],[_0x0db7('0x62'),_0x0db7('0x63'),'id']));_0x4172a5[_0x0db7('0x64')]=0x15;_0x4172a5[_0x0db7('0x65')]='deleted';_0x4172a5[_0x0db7('0x66')]=_0x5ca033[_0x0db7('0x31')];_0x4172a5[_0x0db7('0x67')]=_0x174e0c['user'][_0x0db7('0x31')];_0x4172a5[_0x0db7('0x68')]=_0x174e0c[_0x0db7('0x69')]['id'];_0x4172a5[_0x0db7('0x6a')]=!![];_0x4172a5['deletedat']=moment()['format'](_0x0db7('0x6b'));_0x4172a5['calleridnum']=_0x266679[_0x0db7('0x6c')];_0x4172a5[_0x0db7('0x6d')]=_0x266679['VoiceQueueId']?_0x0db7('0x6e'):'ivr';return db[_0x0db7('0x6f')][_0x0db7('0x57')]({'where':{'id':_0x4172a5[_0x0db7('0x70')]},'attributes':[_0x0db7('0x71'),_0x0db7('0x72')]})[_0x0db7('0x28')](function(_0x5b9904){if(!_[_0x0db7('0x73')](_0x2ce383)&&!_[_0x0db7('0x73')](_0x5b9904[_0x0db7('0x71')])){_0x4172a5[_0x0db7('0x74')]=_0x5b9904[_0x0db7('0x71')];if(!_[_0x0db7('0x73')](_0x5b9904[_0x0db7('0x72')])){_0x4172a5[_0x0db7('0x74')]+='\x20'+_0x5b9904[_0x0db7('0x72')];}}})[_0x0db7('0x75')](function(){return db[_0x0db7('0x76')][_0x0db7('0x58')](_0x4172a5);});}})[_0x0db7('0x28')](function(){return _0x2ce383[_0x0db7('0x1d')](0xcc)[_0x0db7('0x1c')]();})[_0x0db7('0x54')](handleError(_0x2ce383,null));};exports[_0x0db7('0x77')]=function(_0x2bf449,_0x2d375a,_0x5111ac){var _0x1b44a9=[];return db['CmContact'][_0x0db7('0x5b')]()[_0x0db7('0x28')](function(_0x1a90e5){_0x1b44a9=_[_0x0db7('0x32')](_0x1a90e5);return _0x2bf449[_0x0db7('0x69')][_0x0db7('0x78')]({'where':{'type':_0x0db7('0x79'),'dialActive':!![],'dialMethod':_0x0db7('0x7a')},'attributes':['id',_0x0db7('0x7b')],'raw':!![]});})[_0x0db7('0x28')](function(_0x45a5bf){if(_0x45a5bf&&_0x45a5bf[_0x0db7('0x56')]){return db['sequelize'][_0x0db7('0x7c')](function(_0x8bbe43){var _0x42f9f8={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x0db7('0x7d')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x0db7('0x2b')](_0x45a5bf,'id')},'$or':[{'UserId':null},{'UserId':_0x2bf449[_0x0db7('0x69')]['id']}]};var _0x5c96c9=[];if(_0x2bf449[_0x0db7('0x59')][_0x0db7('0x7e')]&&_0x2bf449['body']['direction']===_0x0db7('0x7f')){if(!_[_0x0db7('0x80')](_0x2bf449['body'][_0x0db7('0x81')])){_0x42f9f8['id']={'$in':_0x2bf449[_0x0db7('0x59')][_0x0db7('0x81')]};}_0x5c96c9=[[_0x0db7('0x82'),'ASC'],['scheduledAt',_0x45a5bf[0x0][_0x0db7('0x7b')]===_0x0db7('0x83')?'DESC':_0x0db7('0x83')],db[_0x0db7('0x84')][_0x0db7('0x85')](_0x0db7('0x86')),['id',_0x0db7('0x87')]];}else{if(!_['isEmpty'](_0x2bf449[_0x0db7('0x59')][_0x0db7('0x81')])){_0x42f9f8['id']={'$notIn':_0x2bf449[_0x0db7('0x59')]['hopperIds']};}_0x5c96c9=[[_0x0db7('0x82'),_0x0db7('0x87')],['scheduledAt',_0x45a5bf[0x0]['dialOrderByScheduledAt']],db['sequelize'][_0x0db7('0x85')](_0x0db7('0x88')),['id',_0x0db7('0x83')]];}return db[_0x0db7('0x2c')][_0x0db7('0x89')]({'attributes':['id',_0x0db7('0x8a')],'where':_0x42f9f8,'order':_0x5c96c9,'transaction':_0x8bbe43,'lock':_0x8bbe43[_0x0db7('0x8b')][_0x0db7('0x8c')],'include':[{'model':db[_0x0db7('0x6f')],'as':_0x0db7('0x8d'),'attributes':_0x1b44a9,'include':[{'model':db[_0x0db7('0x8e')],'as':_0x0db7('0x8f'),'attributes':['id',_0x0db7('0x31')]}]},{'model':db[_0x0db7('0x90')],'as':_0x0db7('0x91'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0x0db7('0x92'),'attributes':['id',_0x0db7('0x31'),_0x0db7('0x93')]}]})[_0x0db7('0x28')](function(_0x6edf53){if(_0x6edf53){return _0x6edf53[_0x0db7('0x26')]({'UserId':_0x2bf449[_0x0db7('0x69')]['id']},{'transaction':_0x8bbe43});}});});}})[_0x0db7('0x28')](handleEntityNotFound(_0x2d375a,null))['then'](respondWithResult(_0x2d375a,null))[_0x0db7('0x54')](handleError(_0x2d375a,null));};exports[_0x0db7('0x94')]=function(_0x4cdfec,_0x2340f7,_0x2666d8){return _0x4cdfec[_0x0db7('0x69')][_0x0db7('0x78')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x0db7('0x7a')},'attributes':['id'],'raw':!![]})['then'](function(_0x4a9bf8){if(_0x4a9bf8&&_0x4a9bf8['length']){return db['CmHopper'][_0x0db7('0x1f')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x0db7('0x7d')](_0x0db7('0x6b'))},'VoiceQueueId':{'$in':_[_0x0db7('0x2b')](_0x4a9bf8,'id')},'$or':[{'UserId':null},{'UserId':_0x4cdfec[_0x0db7('0x69')]['id']}]}});}return 0x0;})[_0x0db7('0x28')](function(_0x4690c8){if(!_['isNil'](_0x4690c8)&&_[_0x0db7('0x95')](_0x4690c8)){return _0x2340f7[_0x0db7('0x1d')](0xc8)[_0x0db7('0x1e')]({'contacts':_0x4690c8});}else{logger[_0x0db7('0x96')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x0db7('0x94'),0x194,'entity\x20not\x20found');_0x2340f7[_0x0db7('0x1b')](0x194);}})['catch'](handleError(_0x2340f7,null));}; \ No newline at end of file +var _0x6455=['html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','then','name','send','index','map','CmHopper','rawAttributes','fieldName','type','model','query','keys','filters','intersection','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$notBetween','$notIn','$notLike','$notILike','$like','$overlap','$contains','$contained','$any','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','update','body','params','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','format','prev','hopperIds','priority','ASC','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','scheduledAt','sequelize','literal','findOne','LOCK','Contact','CmCompany','Company','CmList','List','Queue','dialActive','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found'];(function(_0x3b51cb,_0x1871ee){var _0x1ca685=function(_0x1c9442){while(--_0x1c9442){_0x3b51cb['push'](_0x3b51cb['shift']());}};_0x1ca685(++_0x1871ee);}(_0x6455,0x97));var _0x5645=function(_0x1bc57e,_0xe62fd8){_0x1bc57e=_0x1bc57e-0x0;var _0x51621d=_0x6455[_0x1bc57e];return _0x51621d;};'use strict';var pdf=require(_0x5645('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5645('0x1'));var zipdir=require(_0x5645('0x2'));var jsonpatch=require(_0x5645('0x3'));var rp=require(_0x5645('0x4'));var moment=require(_0x5645('0x5'));var BPromise=require(_0x5645('0x6'));var Mustache=require('mustache');var util=require(_0x5645('0x7'));var path=require(_0x5645('0x8'));var sox=require(_0x5645('0x9'));var csv=require(_0x5645('0xa'));var ejs=require(_0x5645('0xb'));var fs=require('fs');var fs_extra=require(_0x5645('0xc'));var _=require(_0x5645('0xd'));var squel=require(_0x5645('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5645('0xf'));var toCsv=require(_0x5645('0xa'));var querystring=require(_0x5645('0x10'));var Papa=require(_0x5645('0x11'));var Redis=require(_0x5645('0x12'));var authService=require(_0x5645('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5645('0x14'));var hardwareService=require(_0x5645('0x15'));var logger=require(_0x5645('0x16'))(_0x5645('0x17'));var utils=require('../../config/utils');var config=require(_0x5645('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5645('0x19'))['db'];function respondWithStatusCode(_0x4014c5,_0x42b0b0){_0x42b0b0=_0x42b0b0||0xcc;return function(_0x21b018){if(_0x21b018){return _0x4014c5[_0x5645('0x1a')](_0x42b0b0);}return _0x4014c5[_0x5645('0x1b')](_0x42b0b0)[_0x5645('0x1c')]();};}function respondWithResult(_0x2270a1,_0x50449c){_0x50449c=_0x50449c||0xc8;return function(_0x2da9c5){if(_0x2da9c5){return _0x2270a1[_0x5645('0x1b')](_0x50449c)[_0x5645('0x1d')](_0x2da9c5);}};}function respondWithFilteredResult(_0x4cbd46,_0x4b3be6){return function(_0x439b55){if(_0x439b55){var _0x361cfd=_0x439b55[_0x5645('0x1e')],_0x511aed=_0x4b3be6['offset'],_0x35e0c7=_0x4b3be6[_0x5645('0x1f')]+_0x4b3be6[_0x5645('0x20')],_0x3fe599;if(_0x35e0c7>=_0x361cfd){_0x35e0c7=_0x361cfd;_0x3fe599=0xc8;}else{_0x3fe599=0xce;}_0x4cbd46[_0x5645('0x1b')](_0x3fe599);return _0x4cbd46[_0x5645('0x21')]('Content-Range',_0x511aed+'-'+_0x35e0c7+'/'+_0x361cfd)[_0x5645('0x1d')](_0x439b55);}return null;};}function patchUpdates(_0x52ac46){return function(_0x557ad2){try{jsonpatch[_0x5645('0x22')](_0x557ad2,_0x52ac46,!![]);}catch(_0x1e2cba){return BPromise[_0x5645('0x23')](_0x1e2cba);}return _0x557ad2['save']();};}function saveUpdates(_0x35a672,_0x50ed38){return function(_0x2b8cc8){if(_0x2b8cc8){return _0x2b8cc8['update'](_0x35a672)['then'](function(_0x1ee2fb){return _0x1ee2fb;});}return null;};}function removeEntity(_0x53d763,_0x465a01){return function(_0x379cbd){if(_0x379cbd){return _0x379cbd['destroy']()[_0x5645('0x24')](function(){_0x53d763[_0x5645('0x1b')](0xcc)[_0x5645('0x1c')]();});}};}function handleEntityNotFound(_0x50fa82,_0x1e70ad){return function(_0xc38038){if(!_0xc38038){_0x50fa82[_0x5645('0x1a')](0x194);}return _0xc38038;};}function handleError(_0x46b33a,_0x568fd6){_0x568fd6=_0x568fd6||0x1f4;return function(_0x4bc484){logger['error'](_0x4bc484['stack']);if(_0x4bc484[_0x5645('0x25')]){delete _0x4bc484['name'];}_0x46b33a['status'](_0x568fd6)[_0x5645('0x26')](_0x4bc484);};}exports[_0x5645('0x27')]=function(_0x357388,_0x308991){var _0x3a5c61={},_0x351cbb={},_0x3b9d8e={'count':0x0,'rows':[]};var _0xc585f3=_[_0x5645('0x28')](db[_0x5645('0x29')][_0x5645('0x2a')],function(_0x2154a7){return{'name':_0x2154a7[_0x5645('0x2b')],'type':_0x2154a7[_0x5645('0x2c')]['key']};});_0x351cbb[_0x5645('0x2d')]=_['map'](_0xc585f3,_0x5645('0x25'));_0x351cbb[_0x5645('0x2e')]=_[_0x5645('0x2f')](_0x357388[_0x5645('0x2e')]);_0x351cbb[_0x5645('0x30')]=_[_0x5645('0x31')](_0x351cbb['model'],_0x351cbb['query']);_0x351cbb[_0x5645('0x30')]=_[_0x5645('0x32')](_0x351cbb[_0x5645('0x30')],[_0x5645('0x33'),_0x5645('0x34'),_0x5645('0x35'),_0x5645('0x36'),_0x5645('0x37'),_0x5645('0x38'),_0x5645('0x39'),_0x5645('0x3a'),'$not','$between',_0x5645('0x3b'),'$in',_0x5645('0x3c'),'$like',_0x5645('0x3d'),'$iLike',_0x5645('0x3e'),_0x5645('0x3f'),_0x5645('0x40'),_0x5645('0x41'),_0x5645('0x42'),_0x5645('0x43')]);_0x3a5c61['attributes']=_[_0x5645('0x31')](_0x351cbb[_0x5645('0x2d')],qs[_0x5645('0x44')](_0x357388[_0x5645('0x2e')][_0x5645('0x44')]));_0x3a5c61[_0x5645('0x45')]=_0x3a5c61[_0x5645('0x45')][_0x5645('0x46')]?_0x3a5c61['attributes']:_0x351cbb[_0x5645('0x2d')];if(!_0x357388['query'][_0x5645('0x47')](_0x5645('0x48'))){_0x3a5c61[_0x5645('0x20')]=qs[_0x5645('0x20')](_0x357388[_0x5645('0x2e')]['limit']);_0x3a5c61[_0x5645('0x1f')]=qs[_0x5645('0x1f')](_0x357388[_0x5645('0x2e')][_0x5645('0x1f')]);}_0x3a5c61[_0x5645('0x49')]=qs[_0x5645('0x4a')](_0x357388[_0x5645('0x2e')][_0x5645('0x4a')]);_0x3a5c61[_0x5645('0x4b')]=qs[_0x5645('0x30')](_[_0x5645('0x4c')](_0x357388[_0x5645('0x2e')],_0x351cbb[_0x5645('0x30')]),_0xc585f3);if(_0x357388[_0x5645('0x2e')][_0x5645('0x4d')]){_0x3a5c61[_0x5645('0x4b')]=_['merge'](_0x3a5c61[_0x5645('0x4b')],{'$or':_[_0x5645('0x28')](_0xc585f3,function(_0x488a72){if(_0x488a72[_0x5645('0x2c')]!==_0x5645('0x4e')){var _0x5e841a={};_0x5e841a[_0x488a72[_0x5645('0x25')]]={'$like':'%'+_0x357388[_0x5645('0x2e')][_0x5645('0x4d')]+'%'};return _0x5e841a;}})});}_0x3a5c61=_[_0x5645('0x4f')]({},_0x3a5c61,_0x357388[_0x5645('0x50')]);var _0x2a72c8={'where':_0x3a5c61[_0x5645('0x4b')]};return db['CmHopper']['count'](_0x2a72c8)[_0x5645('0x24')](function(_0x1ffbd4){_0x3b9d8e[_0x5645('0x1e')]=_0x1ffbd4;if(_0x357388[_0x5645('0x2e')][_0x5645('0x51')]){_0x3a5c61[_0x5645('0x52')]=[{'all':!![]}];}return db[_0x5645('0x29')][_0x5645('0x53')](_0x3a5c61);})[_0x5645('0x24')](function(_0x240d42){_0x3b9d8e[_0x5645('0x54')]=_0x240d42;return _0x3b9d8e;})[_0x5645('0x24')](respondWithFilteredResult(_0x308991,_0x3a5c61))[_0x5645('0x55')](handleError(_0x308991,null));};exports[_0x5645('0x56')]=function(_0x47227f,_0x2a94af){var _0x3c83cf={'raw':!![],'where':{'id':_0x47227f['params']['id']}},_0x56d7e9={};_0x56d7e9['model']=_['keys'](db[_0x5645('0x29')][_0x5645('0x2a')]);_0x56d7e9[_0x5645('0x2e')]=_[_0x5645('0x2f')](_0x47227f[_0x5645('0x2e')]);_0x56d7e9['filters']=_[_0x5645('0x31')](_0x56d7e9[_0x5645('0x2d')],_0x56d7e9[_0x5645('0x2e')]);_0x3c83cf[_0x5645('0x45')]=_[_0x5645('0x31')](_0x56d7e9['model'],qs[_0x5645('0x44')](_0x47227f[_0x5645('0x2e')][_0x5645('0x44')]));_0x3c83cf[_0x5645('0x45')]=_0x3c83cf[_0x5645('0x45')][_0x5645('0x46')]?_0x3c83cf[_0x5645('0x45')]:_0x56d7e9[_0x5645('0x2d')];if(_0x47227f['query']['includeAll']){_0x3c83cf[_0x5645('0x52')]=[{'all':!![]}];}_0x3c83cf=_[_0x5645('0x4f')]({},_0x3c83cf,_0x47227f['options']);return db['CmHopper'][_0x5645('0x57')](_0x3c83cf)['then'](handleEntityNotFound(_0x2a94af,null))[_0x5645('0x24')](respondWithResult(_0x2a94af,null))[_0x5645('0x55')](handleError(_0x2a94af,null));};exports[_0x5645('0x58')]=function(_0x3e282d,_0x1aaa46){return db['CmHopper'][_0x5645('0x58')](_0x3e282d['body'],{})['then'](respondWithResult(_0x1aaa46,0xc9))[_0x5645('0x55')](handleError(_0x1aaa46,null));};exports[_0x5645('0x59')]=function(_0x275a6f,_0x46637f){if(_0x275a6f[_0x5645('0x5a')]['id']){delete _0x275a6f[_0x5645('0x5a')]['id'];}return db[_0x5645('0x29')][_0x5645('0x57')]({'where':{'id':_0x275a6f[_0x5645('0x5b')]['id']}})[_0x5645('0x24')](handleEntityNotFound(_0x46637f,null))[_0x5645('0x24')](saveUpdates(_0x275a6f[_0x5645('0x5a')],null))['then'](respondWithResult(_0x46637f,null))['catch'](handleError(_0x46637f,null));};exports[_0x5645('0x5c')]=function(_0x4b159c,_0x14f55e){return db[_0x5645('0x29')][_0x5645('0x5c')]()['then'](respondWithResult(_0x14f55e,null))[_0x5645('0x55')](handleError(_0x14f55e,null));};exports[_0x5645('0x5d')]=function(_0x4d7050,_0x341f37){var _0x12a577;return db[_0x5645('0x29')][_0x5645('0x57')]({'where':{'id':_0x4d7050[_0x5645('0x5b')]['id']}})['then'](handleEntityNotFound(_0x341f37,null))[_0x5645('0x24')](function(_0xd1f0b){if(_0xd1f0b){return _0xd1f0b[_0x5645('0x5d')]()[_0x5645('0x24')](function(_0x5c9d57){return _0x5c9d57;});}})[_0x5645('0x24')](function(_0x1ab204){_0x12a577=_0x1ab204;if(_0x1ab204){if(_0x1ab204[_0x5645('0x5e')]||_0x1ab204[_0x5645('0x5f')]){return db[_0x1ab204[_0x5645('0x5e')]?_0x5645('0x60'):_0x5645('0x61')][_0x5645('0x57')]({'where':{'id':_0x1ab204[_0x5645('0x5e')]?_0x1ab204['VoiceQueueId']:_0x1ab204[_0x5645('0x5f')]},'attributes':['id',_0x5645('0x25')],'raw':!![]});}}})['then'](function(_0x5d90a6){var _0x457b4d={};if(_0x5d90a6){_['merge'](_0x457b4d,_[_0x5645('0x62')](_0x12a577[_0x5645('0x63')],[_0x5645('0x64'),_0x5645('0x65'),'id']));_0x457b4d[_0x5645('0x66')]=0x15;_0x457b4d[_0x5645('0x67')]=_0x5645('0x68');_0x457b4d['campaign']=_0x5d90a6[_0x5645('0x25')];_0x457b4d[_0x5645('0x69')]=_0x4d7050[_0x5645('0x6a')][_0x5645('0x25')];_0x457b4d[_0x5645('0x6b')]=_0x4d7050[_0x5645('0x6a')]['id'];_0x457b4d[_0x5645('0x68')]=!![];_0x457b4d[_0x5645('0x6c')]=moment()['format'](_0x5645('0x6d'));_0x457b4d[_0x5645('0x6e')]=_0x12a577[_0x5645('0x6f')];_0x457b4d[_0x5645('0x70')]=_0x12a577['VoiceQueueId']?_0x5645('0x71'):_0x5645('0x72');return db[_0x5645('0x73')][_0x5645('0x57')]({'where':{'id':_0x457b4d[_0x5645('0x74')]},'attributes':[_0x5645('0x75'),_0x5645('0x76')]})[_0x5645('0x24')](function(_0x498acc){if(!_[_0x5645('0x77')](_0x341f37)&&!_[_0x5645('0x77')](_0x498acc[_0x5645('0x75')])){_0x457b4d[_0x5645('0x78')]=_0x498acc[_0x5645('0x75')];if(!_[_0x5645('0x77')](_0x498acc['lastName'])){_0x457b4d[_0x5645('0x78')]+='\x20'+_0x498acc[_0x5645('0x76')];}}})[_0x5645('0x79')](function(){return db[_0x5645('0x7a')]['create'](_0x457b4d);});}})['then'](function(){return _0x341f37[_0x5645('0x1b')](0xcc)[_0x5645('0x1c')]();})[_0x5645('0x55')](handleError(_0x341f37,null));};exports['getPreview']=function(_0xa322de,_0x254650,_0x253d87){var _0x6da5f9=[];return db[_0x5645('0x73')][_0x5645('0x5c')]()[_0x5645('0x24')](function(_0x1772dc){_0x6da5f9=_['keys'](_0x1772dc);return _0xa322de[_0x5645('0x6a')][_0x5645('0x7b')]({'where':{'type':_0x5645('0x7c'),'dialActive':!![],'dialMethod':_0x5645('0x7d')},'attributes':['id',_0x5645('0x7e')],'raw':!![]});})['then'](function(_0x595c78){if(_0x595c78&&_0x595c78[_0x5645('0x46')]){return db['sequelize']['transaction'](function(_0x5cf90c){var _0x2dcf56={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5645('0x7f')](_0x5645('0x6d'))},'VoiceQueueId':{'$in':_[_0x5645('0x28')](_0x595c78,'id')},'$or':[{'UserId':null},{'UserId':_0xa322de[_0x5645('0x6a')]['id']}]};var _0x4f34bd=[];if(_0xa322de[_0x5645('0x5a')]['direction']&&_0xa322de[_0x5645('0x5a')]['direction']===_0x5645('0x80')){if(!_['isEmpty'](_0xa322de['body'][_0x5645('0x81')])){_0x2dcf56['id']={'$in':_0xa322de['body'][_0x5645('0x81')]};}_0x4f34bd=[[_0x5645('0x82'),_0x5645('0x83')],['scheduledAt',_0x595c78[0x0][_0x5645('0x7e')]===_0x5645('0x83')?'DESC':'ASC'],db['sequelize']['literal'](_0x5645('0x84')),['id',_0x5645('0x85')]];}else{if(!_['isEmpty'](_0xa322de[_0x5645('0x5a')][_0x5645('0x81')])){_0x2dcf56['id']={'$notIn':_0xa322de[_0x5645('0x5a')][_0x5645('0x81')]};}_0x4f34bd=[[_0x5645('0x82'),_0x5645('0x85')],[_0x5645('0x86'),_0x595c78[0x0][_0x5645('0x7e')]],db[_0x5645('0x87')][_0x5645('0x88')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x5645('0x83')]];}return db['CmHopper'][_0x5645('0x89')]({'attributes':['id','scheduledat'],'where':_0x2dcf56,'order':_0x4f34bd,'transaction':_0x5cf90c,'lock':_0x5cf90c[_0x5645('0x8a')]['UPDATE'],'include':[{'model':db[_0x5645('0x73')],'as':_0x5645('0x8b'),'attributes':_0x6da5f9,'include':[{'model':db[_0x5645('0x8c')],'as':_0x5645('0x8d'),'attributes':['id',_0x5645('0x25')]}]},{'model':db[_0x5645('0x8e')],'as':_0x5645('0x8f'),'attributes':['id',_0x5645('0x25')]},{'model':db[_0x5645('0x60')],'as':_0x5645('0x90'),'attributes':['id',_0x5645('0x25'),_0x5645('0x91')]}]})[_0x5645('0x24')](function(_0x12475e){if(_0x12475e){return _0x12475e['update']({'UserId':_0xa322de[_0x5645('0x6a')]['id']},{'transaction':_0x5cf90c});}});});}})[_0x5645('0x24')](handleEntityNotFound(_0x254650,null))[_0x5645('0x24')](respondWithResult(_0x254650,null))['catch'](handleError(_0x254650,null));};exports['getOpenContacts']=function(_0x38cfb2,_0x57d7d2,_0x5a1009){return _0x38cfb2[_0x5645('0x6a')][_0x5645('0x7b')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x5645('0x7d')},'attributes':['id'],'raw':!![]})[_0x5645('0x24')](function(_0x7726d3){if(_0x7726d3&&_0x7726d3[_0x5645('0x46')]){return db[_0x5645('0x29')][_0x5645('0x1e')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5645('0x7f')](_0x5645('0x6d'))},'VoiceQueueId':{'$in':_[_0x5645('0x28')](_0x7726d3,'id')},'$or':[{'UserId':null},{'UserId':_0x38cfb2[_0x5645('0x6a')]['id']}]}});}return 0x0;})[_0x5645('0x24')](function(_0x101e9a){if(!_['isNil'](_0x101e9a)&&_[_0x5645('0x92')](_0x101e9a)){return _0x57d7d2[_0x5645('0x1b')](0xc8)['json']({'contacts':_0x101e9a});}else{logger[_0x5645('0x93')](_0x5645('0x94'),_0x5645('0x95'),0x194,_0x5645('0x96'));_0x57d7d2['sendStatus'](0x194);}})['catch'](handleError(_0x57d7d2,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index acf713e..dc9588f 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 _0xf41c=['cm_hopper','scheduledat','phone','priority','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper'];(function(_0x359dd5,_0x331560){var _0x1a3dd4=function(_0x4baace){while(--_0x4baace){_0x359dd5['push'](_0x359dd5['shift']());}};_0x1a3dd4(++_0x331560);}(_0xf41c,0x94));var _0xcf41=function(_0x3569a6,_0x217db8){_0x3569a6=_0x3569a6-0x0;var _0x4e4e1c=_0xf41c[_0x3569a6];return _0x4e4e1c;};'use strict';var _=require('lodash');var util=require(_0xcf41('0x0'));var logger=require(_0xcf41('0x1'))('api');var moment=require(_0xcf41('0x2'));var BPromise=require(_0xcf41('0x3'));var rp=require(_0xcf41('0x4'));var fs=require('fs');var path=require(_0xcf41('0x5'));var rimraf=require(_0xcf41('0x6'));var config=require(_0xcf41('0x7'));var attributes=require(_0xcf41('0x8'));module[_0xcf41('0x9')]=function(_0x555500,_0x4901fd){return _0x555500[_0xcf41('0xa')](_0xcf41('0xb'),attributes,{'tableName':_0xcf41('0xc'),'paranoid':![],'indexes':[{'name':_0xcf41('0xd'),'fields':[_0xcf41('0xd')]},{'name':_0xcf41('0xe'),'fields':[_0xcf41('0xe')]},{'name':_0xcf41('0xf'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe292=['priority','api','moment','bluebird','request-promise','rimraf','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone'];(function(_0x39ccaf,_0x1ea3d4){var _0x41285a=function(_0xfd942a){while(--_0xfd942a){_0x39ccaf['push'](_0x39ccaf['shift']());}};_0x41285a(++_0x1ea3d4);}(_0xe292,0x115));var _0x2e29=function(_0x1ba212,_0x5a91cf){_0x1ba212=_0x1ba212-0x0;var _0x1b1b97=_0xe292[_0x1ba212];return _0x1b1b97;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2e29('0x0'));var moment=require(_0x2e29('0x1'));var BPromise=require(_0x2e29('0x2'));var rp=require(_0x2e29('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e29('0x4'));var config=require('../../config/environment');var attributes=require(_0x2e29('0x5'));module[_0x2e29('0x6')]=function(_0x4665de,_0x382bb0){return _0x4665de[_0x2e29('0x7')](_0x2e29('0x8'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x2e29('0x9')]},{'name':_0x2e29('0xa'),'fields':[_0x2e29('0xa')]},{'name':'priority','fields':[_0x2e29('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index fb9ac4f..f95e404 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 _0x5a14=['CreateCmHopper','create','body','UpdateCmHopper','update','limit','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','findAll','order','UPDATE','Contact','keys','User','Agent','name','voicePause','includes','UserId','push','all','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','LOCK','length','GetCmHopperPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetCmHopper','CmHopper','options','raw','where','attributes','include','map','model','debug','ShowCmHopper','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a14,0x159));var _0x45a1=function(_0x39d70f,_0x1f4f75){_0x39d70f=_0x39d70f-0x0;var _0x3ca1a2=_0x5a14[_0x39d70f];return _0x3ca1a2;};'use strict';var _=require(_0x45a1('0x0'));var util=require(_0x45a1('0x1'));var moment=require(_0x45a1('0x2'));var BPromise=require(_0x45a1('0x3'));var rs=require(_0x45a1('0x4'));var fs=require('fs');var Redis=require(_0x45a1('0x5'));var db=require(_0x45a1('0x6'))['db'];var utils=require(_0x45a1('0x7'));var logger=require(_0x45a1('0x8'))('rpc');var config=require(_0x45a1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x45a1('0xa')][_0x45a1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf9d29b,_0x95a73b,_0x2fe4b3){return new BPromise(function(_0x4cfad7,_0x400085){return client['request'](_0xf9d29b,_0x2fe4b3)[_0x45a1('0xc')](function(_0x125d95){logger['info'](_0x45a1('0xd'),_0x95a73b,_0x45a1('0xe'));logger['debug'](_0x45a1('0xf'),_0x95a73b,'request\x20sent',JSON[_0x45a1('0x10')](_0x125d95));if(_0x125d95['error']){if(_0x125d95[_0x45a1('0x11')][_0x45a1('0x12')]===0x1f4){logger[_0x45a1('0x11')](_0x45a1('0xd'),_0x95a73b,_0x125d95['error'][_0x45a1('0x13')]);return _0x400085(_0x125d95[_0x45a1('0x11')][_0x45a1('0x13')]);}logger['error'](_0x45a1('0xd'),_0x95a73b,_0x125d95[_0x45a1('0x11')]['message']);return _0x4cfad7(_0x125d95[_0x45a1('0x11')][_0x45a1('0x13')]);}else{logger[_0x45a1('0x14')](_0x45a1('0xd'),_0x95a73b,'request\x20sent');_0x4cfad7(_0x125d95[_0x45a1('0x15')]['message']);}})[_0x45a1('0x16')](function(_0x2a6b7b){logger[_0x45a1('0x11')](_0x45a1('0xd'),_0x95a73b,_0x2a6b7b);_0x400085(_0x2a6b7b);});});}exports[_0x45a1('0x17')]=function(_0x2795e8){var _0x455439=this;return new Promise(function(_0x4f0123,_0x5ecf3a){return db[_0x45a1('0x18')]['findAll']({'raw':_0x2795e8[_0x45a1('0x19')]?_0x2795e8[_0x45a1('0x19')][_0x45a1('0x1a')]===undefined?!![]:![]:!![],'where':_0x2795e8['options']?_0x2795e8[_0x45a1('0x19')][_0x45a1('0x1b')]||null:null,'attributes':_0x2795e8['options']?_0x2795e8[_0x45a1('0x19')][_0x45a1('0x1c')]||null:null,'limit':_0x2795e8[_0x45a1('0x19')]?_0x2795e8[_0x45a1('0x19')]['limit']||null:null,'include':_0x2795e8[_0x45a1('0x19')]?_0x2795e8[_0x45a1('0x19')][_0x45a1('0x1d')]?_[_0x45a1('0x1e')](_0x2795e8[_0x45a1('0x19')][_0x45a1('0x1d')],function(_0x47fd31){return{'model':db[_0x47fd31['model']],'as':_0x47fd31['as'],'attributes':_0x47fd31[_0x45a1('0x1c')],'include':_0x47fd31[_0x45a1('0x1d')]?_['map'](_0x47fd31[_0x45a1('0x1d')],function(_0x224b8f){return{'model':db[_0x224b8f[_0x45a1('0x1f')]],'as':_0x224b8f['as'],'attributes':_0x224b8f[_0x45a1('0x1c')],'include':_0x224b8f[_0x45a1('0x1d')]?_[_0x45a1('0x1e')](_0x224b8f[_0x45a1('0x1d')],function(_0x5727e8){return{'model':db[_0x5727e8[_0x45a1('0x1f')]],'as':_0x5727e8['as'],'attributes':_0x5727e8[_0x45a1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x45a1('0xc')](function(_0x52959c){logger[_0x45a1('0x14')](_0x45a1('0x17'),_0x2795e8);logger[_0x45a1('0x20')](_0x45a1('0x17'),_0x2795e8,JSON[_0x45a1('0x10')](_0x52959c));_0x4f0123(_0x52959c);})[_0x45a1('0x16')](function(_0x2ce500){logger[_0x45a1('0x11')](_0x45a1('0x17'),_0x2ce500[_0x45a1('0x13')],_0x2795e8);_0x5ecf3a(_0x455439[_0x45a1('0x11')](0x1f4,_0x2ce500['message']));});});};exports[_0x45a1('0x21')]=function(_0x4c1a5f){var _0x3fa42e=this;return new Promise(function(_0x2fcc4c,_0x476de7){return db['CmHopper'][_0x45a1('0x22')]({'raw':_0x4c1a5f['options']?_0x4c1a5f['options'][_0x45a1('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c1a5f['options']?_0x4c1a5f[_0x45a1('0x19')][_0x45a1('0x1b')]||null:null,'attributes':_0x4c1a5f[_0x45a1('0x19')]?_0x4c1a5f['options'][_0x45a1('0x1c')]||null:null,'include':_0x4c1a5f[_0x45a1('0x19')]?_0x4c1a5f['options']['include']?_[_0x45a1('0x1e')](_0x4c1a5f[_0x45a1('0x19')]['include'],function(_0xfa9fdf){return{'model':db[_0xfa9fdf['model']],'as':_0xfa9fdf['as'],'attributes':_0xfa9fdf[_0x45a1('0x1c')],'include':_0xfa9fdf[_0x45a1('0x1d')]?_['map'](_0xfa9fdf['include'],function(_0x3eda0c){return{'model':db[_0x3eda0c['model']],'as':_0x3eda0c['as'],'attributes':_0x3eda0c[_0x45a1('0x1c')],'include':_0x3eda0c['include']?_['map'](_0x3eda0c[_0x45a1('0x1d')],function(_0x482285){return{'model':db[_0x482285[_0x45a1('0x1f')]],'as':_0x482285['as'],'attributes':_0x482285['attributes']};}):[]};}):[]};}):[]:[]})[_0x45a1('0xc')](function(_0x5259ae){logger['info'](_0x45a1('0x21'),_0x4c1a5f);logger[_0x45a1('0x20')](_0x45a1('0x21'),_0x4c1a5f,JSON[_0x45a1('0x10')](_0x5259ae));_0x2fcc4c(_0x5259ae);})[_0x45a1('0x16')](function(_0x29ebf7){logger['error'](_0x45a1('0x21'),_0x29ebf7['message'],_0x4c1a5f);_0x476de7(_0x3fa42e[_0x45a1('0x11')](0x1f4,_0x29ebf7['message']));});});};exports[_0x45a1('0x23')]=function(_0x2dbca5){var _0x3dee47=this;return new Promise(function(_0x4b8d73,_0x116f63){return db['CmHopper'][_0x45a1('0x24')](_0x2dbca5[_0x45a1('0x25')],{'raw':_0x2dbca5[_0x45a1('0x19')]?_0x2dbca5[_0x45a1('0x19')][_0x45a1('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5b0bdb){logger['info'](_0x45a1('0x23'),_0x2dbca5);logger[_0x45a1('0x20')]('CreateCmHopper',_0x2dbca5,JSON[_0x45a1('0x10')](_0x5b0bdb));_0x4b8d73(_0x5b0bdb);})[_0x45a1('0x16')](function(_0x452b62){logger[_0x45a1('0x11')]('CreateCmHopper',_0x452b62[_0x45a1('0x13')],_0x2dbca5);_0x116f63(_0x3dee47[_0x45a1('0x11')](0x1f4,_0x452b62['message']));});});};exports[_0x45a1('0x26')]=function(_0x3c7286){var _0x4ffb94=this;return new Promise(function(_0x56bbb3,_0x2a6e91){return db['CmHopper'][_0x45a1('0x27')](_0x3c7286[_0x45a1('0x25')],{'raw':_0x3c7286['options']?_0x3c7286[_0x45a1('0x19')][_0x45a1('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c7286[_0x45a1('0x19')]?_0x3c7286[_0x45a1('0x19')][_0x45a1('0x1b')]||null:null,'attributes':_0x3c7286['options']?_0x3c7286[_0x45a1('0x19')][_0x45a1('0x1c')]||null:null,'limit':_0x3c7286['options']?_0x3c7286['options'][_0x45a1('0x28')]||null:null})[_0x45a1('0xc')](function(_0x5bc0c0){logger[_0x45a1('0x14')](_0x45a1('0x26'),_0x3c7286);logger[_0x45a1('0x20')](_0x45a1('0x26'),_0x3c7286,JSON[_0x45a1('0x10')](_0x5bc0c0));_0x56bbb3(_0x5bc0c0);})['catch'](function(_0x5ebd4c){logger[_0x45a1('0x11')](_0x45a1('0x26'),_0x5ebd4c['message'],_0x3c7286);_0x2a6e91(_0x4ffb94[_0x45a1('0x11')](0x1f4,_0x5ebd4c[_0x45a1('0x13')]));});});};exports[_0x45a1('0x29')]=function(_0x2b4ff4){var _0x12bcd9=this;return new Promise(function(_0xb3dafd,_0x1474a5){return db[_0x45a1('0x18')][_0x45a1('0x2a')]({'where':_0x2b4ff4[_0x45a1('0x19')]?_0x2b4ff4[_0x45a1('0x19')]['where']||null:null})['then'](function(_0x4f7f03){logger['info']('DestroyCmHopper',_0x2b4ff4);logger['debug'](_0x45a1('0x29'),_0x2b4ff4,JSON[_0x45a1('0x10')](_0x4f7f03));_0xb3dafd(_0x4f7f03);})['catch'](function(_0x20d0f8){logger[_0x45a1('0x11')](_0x45a1('0x29'),_0x20d0f8[_0x45a1('0x13')],_0x2b4ff4);_0x1474a5(_0x12bcd9[_0x45a1('0x11')](0x1f4,_0x20d0f8[_0x45a1('0x13')]));});});};exports[_0x45a1('0x2b')]=function(_0x47db91){var _0x22028b=this;return new Promise(function(_0x2ca493,_0x4a87eb){return db[_0x45a1('0x2c')][_0x45a1('0x2d')]()['then'](function(_0x22402f){return db[_0x45a1('0x2e')][_0x45a1('0x2f')](function(_0x286fc1){return db[_0x45a1('0x18')][_0x45a1('0x30')]({'where':_0x47db91[_0x45a1('0x19')]?_0x47db91[_0x45a1('0x19')][_0x45a1('0x1b')]||null:null,'attributes':_0x47db91[_0x45a1('0x19')]?_0x47db91['options'][_0x45a1('0x1c')]||null:null,'limit':_0x47db91[_0x45a1('0x19')]?_0x47db91[_0x45a1('0x19')][_0x45a1('0x28')]||null:null,'order':_0x47db91['options']?_0x47db91[_0x45a1('0x19')][_0x45a1('0x31')]||null:null,'transaction':_0x286fc1,'lock':_0x286fc1['LOCK'][_0x45a1('0x32')],'include':[{'model':db[_0x45a1('0x2c')],'as':_0x45a1('0x33'),'attributes':_[_0x45a1('0x34')](_0x22402f)},{'model':db[_0x45a1('0x35')],'as':_0x45a1('0x36'),'attributes':['id',_0x45a1('0x37'),_0x45a1('0x38')]}]})[_0x45a1('0xc')](function(_0x17e426){var _0x4de4e9=[];var _0xaaedad=[];for(var _0x49f64e=0x0;_0x49f64e<_0x17e426['length'];_0x49f64e+=0x1){if(!_0xaaedad[_0x45a1('0x39')](_0x17e426[_0x49f64e][_0x45a1('0x3a')])){_0xaaedad[_0x45a1('0x3b')](_0x17e426[_0x49f64e][_0x45a1('0x3a')]);_0x4de4e9[_0x45a1('0x3b')](_0x17e426[_0x49f64e]['update'](_0x47db91[_0x45a1('0x25')],{'transaction':_0x286fc1}));}}return BPromise[_0x45a1('0x3c')](_0x4de4e9);});})['then'](function(_0x10d687){logger[_0x45a1('0x14')](_0x45a1('0x2b'),_0x47db91);logger['debug']('GetContactDialer',_0x47db91,JSON['stringify'](_0x10d687));_0x2ca493(_0x10d687);})[_0x45a1('0x16')](function(_0x5989b6){logger[_0x45a1('0x11')](_0x45a1('0x2b'),_0x5989b6[_0x45a1('0x13')],_0x47db91);_0x4a87eb(_0x22028b[_0x45a1('0x11')](0x1f4,_0x5989b6[_0x45a1('0x13')]));});});});};exports[_0x45a1('0x3d')]=function(_0x3bd841){var _0x5f6b65=this;return new Promise(function(_0x1dfeac,_0x2674ca){return db[_0x45a1('0x2e')][_0x45a1('0x2f')](function(_0x4ebffe){return db[_0x45a1('0x3e')][_0x45a1('0x24')](_0x3bd841['body'],{'raw':_0x3bd841[_0x45a1('0x19')]?_0x3bd841[_0x45a1('0x19')][_0x45a1('0x1a')]===undefined?!![]:![]:!![],'transaction':_0x4ebffe})[_0x45a1('0xc')](function(){return db[_0x45a1('0x18')][_0x45a1('0x2a')]({'where':_0x3bd841[_0x45a1('0x19')]?_0x3bd841[_0x45a1('0x19')][_0x45a1('0x1b')]||null:null,'transaction':_0x4ebffe});});})['then'](function(_0xf9943d){logger[_0x45a1('0x14')](_0x45a1('0x3d'),_0x3bd841);logger[_0x45a1('0x20')]('MoveContactManagedDialer',_0x3bd841,JSON['stringify'](_0xf9943d));_0x1dfeac(_0xf9943d);})[_0x45a1('0x16')](function(_0x5b8b6e){logger['error'](_0x45a1('0x3d'),_0x5b8b6e[_0x45a1('0x13')],_0x3bd841);_0x2674ca(_0x5f6b65[_0x45a1('0x11')](0x1f4,_0x5b8b6e[_0x45a1('0x13')]));});});};exports[_0x45a1('0x3f')]=function(_0x4891d9){var _0x1efe7e=this;return new Promise(function(_0x1e8e64,_0x306ae3){return db['CmHopper'][_0x45a1('0x30')]({'raw':_0x4891d9['options']?_0x4891d9[_0x45a1('0x19')][_0x45a1('0x1a')]===undefined?!![]:![]:!![],'where':_0x4891d9[_0x45a1('0x19')]?_0x4891d9[_0x45a1('0x19')][_0x45a1('0x1b')]||null:null,'attributes':[[db[_0x45a1('0x2e')]['fn'](_0x45a1('0x40'),db[_0x45a1('0x2e')]['fn']('IF',db['sequelize'][_0x45a1('0x41')](_0x45a1('0x42')+util['format'](_0x45a1('0x43'),moment()[_0x45a1('0x44')](_0x45a1('0x45')))+_0x45a1('0x46')))),_0x45a1('0x47')]]})['then'](function(_0x4ecb75){logger[_0x45a1('0x14')](_0x45a1('0x3f'),_0x4891d9);logger[_0x45a1('0x20')](_0x45a1('0x3f'),_0x4891d9,JSON[_0x45a1('0x10')](_0x4ecb75));_0x1e8e64(_0x4ecb75);})['catch'](function(_0x3ca364){logger['error'](_0x45a1('0x3f'),_0x3ca364[_0x45a1('0x13')],_0x4891d9);_0x306ae3(_0x1efe7e['error'](0x1f4,_0x3ca364[_0x45a1('0x13')]));});});};exports[_0x45a1('0x48')]=function(_0xbb4bd1){var _0x3a24d0=this;return new Promise(function(_0xee553c,_0x4476cf){return db[_0x45a1('0x2c')][_0x45a1('0x2d')]()[_0x45a1('0xc')](function(_0x50e505){return db[_0x45a1('0x2e')]['transaction'](function(_0x105979){return db[_0x45a1('0x18')]['findAll']({'where':_0xbb4bd1[_0x45a1('0x19')]?_0xbb4bd1['options']['where']||null:null,'attributes':_0xbb4bd1[_0x45a1('0x19')]?_0xbb4bd1[_0x45a1('0x19')][_0x45a1('0x1c')]||null:null,'limit':0x1,'order':_0xbb4bd1[_0x45a1('0x19')]?_0xbb4bd1[_0x45a1('0x19')]['order']||null:null,'group':db[_0x45a1('0x18')]['UserId'],'transaction':_0x105979,'lock':_0x105979[_0x45a1('0x49')][_0x45a1('0x32')],'include':_0xbb4bd1[_0x45a1('0x19')]?_0xbb4bd1[_0x45a1('0x19')][_0x45a1('0x1d')]?_['map'](_0xbb4bd1[_0x45a1('0x19')][_0x45a1('0x1d')],function(_0x22e2fa){return{'model':db[_0x22e2fa[_0x45a1('0x1f')]],'as':_0x22e2fa['as'],'attributes':_0x22e2fa[_0x45a1('0x1c')],'include':_0x22e2fa['include']?_[_0x45a1('0x1e')](_0x22e2fa[_0x45a1('0x1d')],function(_0xb2b381){return{'model':db[_0xb2b381[_0x45a1('0x1f')]],'as':_0xb2b381['as'],'attributes':_0xb2b381[_0x45a1('0x1c')],'include':_0xb2b381[_0x45a1('0x1d')]?_['map'](_0xb2b381[_0x45a1('0x1d')],function(_0x3ca092){return{'model':db[_0x3ca092['model']],'as':_0x3ca092['as'],'attributes':_0x3ca092[_0x45a1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x45a1('0xc')](function(_0x1fb4c7){var _0x2ca57e=[];for(var _0x31da10=0x0;_0x31da10<_0x1fb4c7[_0x45a1('0x4a')];_0x31da10+=0x1){_0x2ca57e[_0x45a1('0x3b')](_0x1fb4c7[_0x31da10][_0x45a1('0x27')](_0xbb4bd1['body'],{'transaction':_0x105979}));}return BPromise['all'](_0x2ca57e);});})['then'](function(_0x25424a){logger[_0x45a1('0x14')](_0x45a1('0x48'),_0xbb4bd1);logger[_0x45a1('0x20')](_0x45a1('0x48'),_0xbb4bd1,JSON['stringify'](_0x25424a));_0xee553c(_0x25424a);})['catch'](function(_0xae3fab){logger[_0x45a1('0x11')]('GetContactRecallMe',_0xae3fab['message'],_0xbb4bd1);_0x4476cf(_0x3a24d0['error'](0x1f4,_0xae3fab[_0x45a1('0x13')]));});});});};exports[_0x45a1('0x4b')]=function(_0x11862a){var _0x31b40c=this;return new Promise(function(_0x46548b,_0x133b11){db['CmContact'][_0x45a1('0x2d')]()[_0x45a1('0xc')](function(_0x4646db){return db[_0x45a1('0x18')][_0x45a1('0x30')]({'raw':_0x11862a[_0x45a1('0x19')]?_0x11862a[_0x45a1('0x19')][_0x45a1('0x1a')]===undefined?!![]:![]:!![],'where':_0x11862a[_0x45a1('0x19')]?_0x11862a[_0x45a1('0x19')][_0x45a1('0x1b')]||null:null,'attributes':_0x11862a[_0x45a1('0x19')]?_0x11862a[_0x45a1('0x19')]['attributes']||null:null,'limit':_0x11862a[_0x45a1('0x19')]?_0x11862a[_0x45a1('0x19')][_0x45a1('0x28')]||null:null,'include':_0x11862a[_0x45a1('0x19')]?_0x11862a[_0x45a1('0x19')]['include']?_[_0x45a1('0x1e')](_0x11862a[_0x45a1('0x19')]['include'],function(_0x5a06a2){return{'model':db[_0x5a06a2[_0x45a1('0x1f')]],'as':_0x5a06a2['as'],'attributes':_0x5a06a2['as']==='Contact'?_[_0x45a1('0x34')](_0x4646db):_0x5a06a2[_0x45a1('0x1c')],'include':_0x5a06a2[_0x45a1('0x1d')]?_['map'](_0x5a06a2[_0x45a1('0x1d')],function(_0x3e1eb7){return{'model':db[_0x3e1eb7[_0x45a1('0x1f')]],'as':_0x3e1eb7['as'],'attributes':_0x3e1eb7[_0x45a1('0x1c')],'include':_0x3e1eb7[_0x45a1('0x1d')]?_[_0x45a1('0x1e')](_0x3e1eb7['include'],function(_0x2721){return{'model':db[_0x2721['model']],'as':_0x2721['as'],'attributes':_0x2721[_0x45a1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x45a1('0xc')](function(_0x1bbe4f){logger[_0x45a1('0x14')](_0x45a1('0x17'),_0x11862a);logger[_0x45a1('0x20')](_0x45a1('0x17'),_0x11862a,JSON[_0x45a1('0x10')](_0x1bbe4f));_0x46548b(_0x1bbe4f);})[_0x45a1('0x16')](function(_0x1e2c86){logger[_0x45a1('0x11')](_0x45a1('0x17'),_0x1e2c86[_0x45a1('0x13')],_0x11862a);_0x133b11(_0x31b40c[_0x45a1('0x11')](0x1f4,_0x1e2c86[_0x45a1('0x13')]));});});});}; \ No newline at end of file +var _0x288b=['model','debug','ShowCmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','limit','DestroyCmHopper','destroy','GetContactDialer','describe','transaction','LOCK','UPDATE','Contact','keys','name','voicePause','length','includes','push','UserId','update','all','MoveContactManagedDialer','sequelize','CmHopperFinal','literal','`scheduledat`\x20>=\x20','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','CmContact','order','GetContactRecallMe','GetCmHopper','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CmHopper','findAll','options','raw','where','include','map','attributes'];(function(_0x584a33,_0x560caf){var _0x53ded7=function(_0x16ba1b){while(--_0x16ba1b){_0x584a33['push'](_0x584a33['shift']());}};_0x53ded7(++_0x560caf);}(_0x288b,0x18b));var _0xb288=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x288b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xb288('0x0'));var moment=require(_0xb288('0x1'));var BPromise=require(_0xb288('0x2'));var rs=require(_0xb288('0x3'));var fs=require('fs');var Redis=require(_0xb288('0x4'));var db=require(_0xb288('0x5'))['db'];var utils=require(_0xb288('0x6'));var logger=require(_0xb288('0x7'))(_0xb288('0x8'));var config=require(_0xb288('0x9'));var jayson=require(_0xb288('0xa'));var client=jayson[_0xb288('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2cd75e,_0x2ad463,_0x1de6f2){return new BPromise(function(_0x2685e8,_0x513a63){return client[_0xb288('0xc')](_0x2cd75e,_0x1de6f2)[_0xb288('0xd')](function(_0x57fc54){logger[_0xb288('0xe')](_0xb288('0xf'),_0x2ad463,_0xb288('0x10'));logger['debug'](_0xb288('0x11'),_0x2ad463,_0xb288('0x10'),JSON[_0xb288('0x12')](_0x57fc54));if(_0x57fc54[_0xb288('0x13')]){if(_0x57fc54[_0xb288('0x13')][_0xb288('0x14')]===0x1f4){logger[_0xb288('0x13')]('CmHopper,\x20%s,\x20%s',_0x2ad463,_0x57fc54['error']['message']);return _0x513a63(_0x57fc54[_0xb288('0x13')][_0xb288('0x15')]);}logger['error'](_0xb288('0xf'),_0x2ad463,_0x57fc54[_0xb288('0x13')]['message']);return _0x2685e8(_0x57fc54[_0xb288('0x13')][_0xb288('0x15')]);}else{logger[_0xb288('0xe')]('CmHopper,\x20%s,\x20%s',_0x2ad463,_0xb288('0x10'));_0x2685e8(_0x57fc54['result'][_0xb288('0x15')]);}})[_0xb288('0x16')](function(_0x55d5ef){logger['error'](_0xb288('0xf'),_0x2ad463,_0x55d5ef);_0x513a63(_0x55d5ef);});});}exports['GetCmHopper']=function(_0x3fb0f6){var _0x36b305=this;return new Promise(function(_0x192c62,_0x5280c1){return db[_0xb288('0x17')][_0xb288('0x18')]({'raw':_0x3fb0f6['options']?_0x3fb0f6[_0xb288('0x19')][_0xb288('0x1a')]===undefined?!![]:![]:!![],'where':_0x3fb0f6['options']?_0x3fb0f6['options'][_0xb288('0x1b')]||null:null,'attributes':_0x3fb0f6[_0xb288('0x19')]?_0x3fb0f6['options']['attributes']||null:null,'limit':_0x3fb0f6[_0xb288('0x19')]?_0x3fb0f6[_0xb288('0x19')]['limit']||null:null,'include':_0x3fb0f6[_0xb288('0x19')]?_0x3fb0f6['options'][_0xb288('0x1c')]?_[_0xb288('0x1d')](_0x3fb0f6['options'][_0xb288('0x1c')],function(_0x4bc636){return{'model':db[_0x4bc636['model']],'as':_0x4bc636['as'],'attributes':_0x4bc636[_0xb288('0x1e')],'include':_0x4bc636['include']?_[_0xb288('0x1d')](_0x4bc636[_0xb288('0x1c')],function(_0x19c539){return{'model':db[_0x19c539[_0xb288('0x1f')]],'as':_0x19c539['as'],'attributes':_0x19c539[_0xb288('0x1e')],'include':_0x19c539[_0xb288('0x1c')]?_[_0xb288('0x1d')](_0x19c539[_0xb288('0x1c')],function(_0x4dff6b){return{'model':db[_0x4dff6b['model']],'as':_0x4dff6b['as'],'attributes':_0x4dff6b[_0xb288('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14b53a){logger[_0xb288('0xe')]('GetCmHopper',_0x3fb0f6);logger[_0xb288('0x20')]('GetCmHopper',_0x3fb0f6,JSON[_0xb288('0x12')](_0x14b53a));_0x192c62(_0x14b53a);})[_0xb288('0x16')](function(_0x928dd9){logger[_0xb288('0x13')]('GetCmHopper',_0x928dd9[_0xb288('0x15')],_0x3fb0f6);_0x5280c1(_0x36b305['error'](0x1f4,_0x928dd9['message']));});});};exports[_0xb288('0x21')]=function(_0x54c46e){var _0x5e9642=this;return new Promise(function(_0x3ec3eb,_0x451bb9){return db['CmHopper'][_0xb288('0x22')]({'raw':_0x54c46e[_0xb288('0x19')]?_0x54c46e[_0xb288('0x19')][_0xb288('0x1a')]===undefined?!![]:![]:!![],'where':_0x54c46e['options']?_0x54c46e[_0xb288('0x19')]['where']||null:null,'attributes':_0x54c46e[_0xb288('0x19')]?_0x54c46e['options'][_0xb288('0x1e')]||null:null,'include':_0x54c46e[_0xb288('0x19')]?_0x54c46e[_0xb288('0x19')][_0xb288('0x1c')]?_['map'](_0x54c46e[_0xb288('0x19')][_0xb288('0x1c')],function(_0x17d23f){return{'model':db[_0x17d23f['model']],'as':_0x17d23f['as'],'attributes':_0x17d23f[_0xb288('0x1e')],'include':_0x17d23f[_0xb288('0x1c')]?_[_0xb288('0x1d')](_0x17d23f['include'],function(_0x2231cc){return{'model':db[_0x2231cc[_0xb288('0x1f')]],'as':_0x2231cc['as'],'attributes':_0x2231cc['attributes'],'include':_0x2231cc['include']?_[_0xb288('0x1d')](_0x2231cc[_0xb288('0x1c')],function(_0x1a3744){return{'model':db[_0x1a3744[_0xb288('0x1f')]],'as':_0x1a3744['as'],'attributes':_0x1a3744[_0xb288('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17fc43){logger[_0xb288('0xe')](_0xb288('0x21'),_0x54c46e);logger['debug'](_0xb288('0x21'),_0x54c46e,JSON[_0xb288('0x12')](_0x17fc43));_0x3ec3eb(_0x17fc43);})['catch'](function(_0x6af638){logger['error'](_0xb288('0x21'),_0x6af638[_0xb288('0x15')],_0x54c46e);_0x451bb9(_0x5e9642[_0xb288('0x13')](0x1f4,_0x6af638[_0xb288('0x15')]));});});};exports[_0xb288('0x23')]=function(_0x5b6118){var _0x432992=this;return new Promise(function(_0x228030,_0x281b1d){return db[_0xb288('0x17')][_0xb288('0x24')](_0x5b6118[_0xb288('0x25')],{'raw':_0x5b6118['options']?_0x5b6118[_0xb288('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x219dd9){logger[_0xb288('0xe')]('CreateCmHopper',_0x5b6118);logger['debug'](_0xb288('0x23'),_0x5b6118,JSON[_0xb288('0x12')](_0x219dd9));_0x228030(_0x219dd9);})[_0xb288('0x16')](function(_0x5c72a7){logger[_0xb288('0x13')](_0xb288('0x23'),_0x5c72a7[_0xb288('0x15')],_0x5b6118);_0x281b1d(_0x432992['error'](0x1f4,_0x5c72a7[_0xb288('0x15')]));});});};exports[_0xb288('0x26')]=function(_0x381276){var _0x2d86e2=this;return new Promise(function(_0x132759,_0x5f26b9){return db['CmHopper']['update'](_0x381276[_0xb288('0x25')],{'raw':_0x381276[_0xb288('0x19')]?_0x381276['options'][_0xb288('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x381276[_0xb288('0x19')]?_0x381276[_0xb288('0x19')][_0xb288('0x1b')]||null:null,'attributes':_0x381276[_0xb288('0x19')]?_0x381276[_0xb288('0x19')]['attributes']||null:null,'limit':_0x381276[_0xb288('0x19')]?_0x381276[_0xb288('0x19')][_0xb288('0x27')]||null:null})[_0xb288('0xd')](function(_0x2f9504){logger['info'](_0xb288('0x26'),_0x381276);logger['debug']('UpdateCmHopper',_0x381276,JSON[_0xb288('0x12')](_0x2f9504));_0x132759(_0x2f9504);})[_0xb288('0x16')](function(_0x5f4640){logger['error'](_0xb288('0x26'),_0x5f4640[_0xb288('0x15')],_0x381276);_0x5f26b9(_0x2d86e2[_0xb288('0x13')](0x1f4,_0x5f4640['message']));});});};exports[_0xb288('0x28')]=function(_0x13ff73){var _0x3574a2=this;return new Promise(function(_0x2777e1,_0x100ce9){return db['CmHopper'][_0xb288('0x29')]({'where':_0x13ff73[_0xb288('0x19')]?_0x13ff73['options'][_0xb288('0x1b')]||null:null})['then'](function(_0xde8f59){logger[_0xb288('0xe')](_0xb288('0x28'),_0x13ff73);logger[_0xb288('0x20')]('DestroyCmHopper',_0x13ff73,JSON['stringify'](_0xde8f59));_0x2777e1(_0xde8f59);})[_0xb288('0x16')](function(_0x4bfdc6){logger[_0xb288('0x13')](_0xb288('0x28'),_0x4bfdc6['message'],_0x13ff73);_0x100ce9(_0x3574a2['error'](0x1f4,_0x4bfdc6['message']));});});};exports[_0xb288('0x2a')]=function(_0x5c0380){var _0x50a798=this;return new Promise(function(_0x440b17,_0x548d20){return db['CmContact'][_0xb288('0x2b')]()[_0xb288('0xd')](function(_0x360b8){return db['sequelize'][_0xb288('0x2c')](function(_0x1b3dfb){return db[_0xb288('0x17')]['findAll']({'where':_0x5c0380[_0xb288('0x19')]?_0x5c0380['options'][_0xb288('0x1b')]||null:null,'attributes':_0x5c0380['options']?_0x5c0380['options'][_0xb288('0x1e')]||null:null,'limit':_0x5c0380[_0xb288('0x19')]?_0x5c0380[_0xb288('0x19')][_0xb288('0x27')]||null:null,'order':_0x5c0380[_0xb288('0x19')]?_0x5c0380[_0xb288('0x19')]['order']||null:null,'transaction':_0x1b3dfb,'lock':_0x1b3dfb[_0xb288('0x2d')][_0xb288('0x2e')],'include':[{'model':db['CmContact'],'as':_0xb288('0x2f'),'attributes':_[_0xb288('0x30')](_0x360b8)},{'model':db['User'],'as':'Agent','attributes':['id',_0xb288('0x31'),_0xb288('0x32')]}]})[_0xb288('0xd')](function(_0x17a7ef){var _0x510400=[];var _0x43046d=[];for(var _0x3ffbda=0x0;_0x3ffbda<_0x17a7ef[_0xb288('0x33')];_0x3ffbda+=0x1){if(!_0x43046d[_0xb288('0x34')](_0x17a7ef[_0x3ffbda]['UserId'])){_0x43046d[_0xb288('0x35')](_0x17a7ef[_0x3ffbda][_0xb288('0x36')]);_0x510400['push'](_0x17a7ef[_0x3ffbda][_0xb288('0x37')](_0x5c0380['body'],{'transaction':_0x1b3dfb}));}}return BPromise[_0xb288('0x38')](_0x510400);});})[_0xb288('0xd')](function(_0x41310a){logger['info']('GetContactDialer',_0x5c0380);logger[_0xb288('0x20')](_0xb288('0x2a'),_0x5c0380,JSON['stringify'](_0x41310a));_0x440b17(_0x41310a);})[_0xb288('0x16')](function(_0x213d46){logger['error'](_0xb288('0x2a'),_0x213d46[_0xb288('0x15')],_0x5c0380);_0x548d20(_0x50a798[_0xb288('0x13')](0x1f4,_0x213d46[_0xb288('0x15')]));});});});};exports[_0xb288('0x39')]=function(_0x38418b){var _0xf96e63=this;return new Promise(function(_0x39b43b,_0x136950){return db[_0xb288('0x3a')]['transaction'](function(_0x2103f8){return db[_0xb288('0x3b')][_0xb288('0x24')](_0x38418b[_0xb288('0x25')],{'raw':_0x38418b[_0xb288('0x19')]?_0x38418b[_0xb288('0x19')]['raw']===undefined?!![]:![]:!![],'transaction':_0x2103f8})[_0xb288('0xd')](function(){return db[_0xb288('0x17')][_0xb288('0x29')]({'where':_0x38418b['options']?_0x38418b[_0xb288('0x19')][_0xb288('0x1b')]||null:null,'transaction':_0x2103f8});});})[_0xb288('0xd')](function(_0x2c4509){logger[_0xb288('0xe')](_0xb288('0x39'),_0x38418b);logger[_0xb288('0x20')](_0xb288('0x39'),_0x38418b,JSON['stringify'](_0x2c4509));_0x39b43b(_0x2c4509);})[_0xb288('0x16')](function(_0x473204){logger[_0xb288('0x13')](_0xb288('0x39'),_0x473204[_0xb288('0x15')],_0x38418b);_0x136950(_0xf96e63['error'](0x1f4,_0x473204[_0xb288('0x15')]));});});};exports['CountReScheduled']=function(_0x58cf28){var _0x3cd632=this;return new Promise(function(_0x2560c3,_0xd41320){return db[_0xb288('0x17')]['findAll']({'raw':_0x58cf28['options']?_0x58cf28[_0xb288('0x19')][_0xb288('0x1a')]===undefined?!![]:![]:!![],'where':_0x58cf28[_0xb288('0x19')]?_0x58cf28['options'][_0xb288('0x1b')]||null:null,'attributes':[[db[_0xb288('0x3a')]['fn']('COUNT',db[_0xb288('0x3a')]['fn']('IF',db[_0xb288('0x3a')][_0xb288('0x3c')](_0xb288('0x3d')+util['format'](_0xb288('0x3e'),moment()['format'](_0xb288('0x3f')))+_0xb288('0x40')))),_0xb288('0x41')]]})[_0xb288('0xd')](function(_0x3e59d1){logger[_0xb288('0xe')]('CountReScheduled',_0x58cf28);logger[_0xb288('0x20')](_0xb288('0x42'),_0x58cf28,JSON[_0xb288('0x12')](_0x3e59d1));_0x2560c3(_0x3e59d1);})[_0xb288('0x16')](function(_0x3282bb){logger[_0xb288('0x13')]('CountReScheduled',_0x3282bb[_0xb288('0x15')],_0x58cf28);_0xd41320(_0x3cd632[_0xb288('0x13')](0x1f4,_0x3282bb[_0xb288('0x15')]));});});};exports['GetContactRecallMe']=function(_0x51df07){var _0x6ba5f1=this;return new Promise(function(_0x39d5e4,_0x57a865){return db[_0xb288('0x43')]['describe']()[_0xb288('0xd')](function(_0x46720a){return db[_0xb288('0x3a')]['transaction'](function(_0x4b0058){return db[_0xb288('0x17')][_0xb288('0x18')]({'where':_0x51df07[_0xb288('0x19')]?_0x51df07[_0xb288('0x19')][_0xb288('0x1b')]||null:null,'attributes':_0x51df07[_0xb288('0x19')]?_0x51df07[_0xb288('0x19')][_0xb288('0x1e')]||null:null,'limit':0x1,'order':_0x51df07['options']?_0x51df07[_0xb288('0x19')][_0xb288('0x44')]||null:null,'group':db[_0xb288('0x17')][_0xb288('0x36')],'transaction':_0x4b0058,'lock':_0x4b0058[_0xb288('0x2d')][_0xb288('0x2e')],'include':_0x51df07[_0xb288('0x19')]?_0x51df07[_0xb288('0x19')]['include']?_[_0xb288('0x1d')](_0x51df07[_0xb288('0x19')][_0xb288('0x1c')],function(_0x8d39b1){return{'model':db[_0x8d39b1[_0xb288('0x1f')]],'as':_0x8d39b1['as'],'attributes':_0x8d39b1['attributes'],'include':_0x8d39b1[_0xb288('0x1c')]?_[_0xb288('0x1d')](_0x8d39b1['include'],function(_0x10f947){return{'model':db[_0x10f947[_0xb288('0x1f')]],'as':_0x10f947['as'],'attributes':_0x10f947[_0xb288('0x1e')],'include':_0x10f947[_0xb288('0x1c')]?_[_0xb288('0x1d')](_0x10f947['include'],function(_0x17b706){return{'model':db[_0x17b706[_0xb288('0x1f')]],'as':_0x17b706['as'],'attributes':_0x17b706[_0xb288('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d29df){var _0x1e074d=[];for(var _0x11367c=0x0;_0x11367c<_0x4d29df['length'];_0x11367c+=0x1){_0x1e074d[_0xb288('0x35')](_0x4d29df[_0x11367c][_0xb288('0x37')](_0x51df07[_0xb288('0x25')],{'transaction':_0x4b0058}));}return BPromise[_0xb288('0x38')](_0x1e074d);});})[_0xb288('0xd')](function(_0x17fc0c){logger['info'](_0xb288('0x45'),_0x51df07);logger[_0xb288('0x20')](_0xb288('0x45'),_0x51df07,JSON[_0xb288('0x12')](_0x17fc0c));_0x39d5e4(_0x17fc0c);})[_0xb288('0x16')](function(_0x27990d){logger['error'](_0xb288('0x45'),_0x27990d['message'],_0x51df07);_0x57a865(_0x6ba5f1['error'](0x1f4,_0x27990d[_0xb288('0x15')]));});});});};exports['GetCmHopperPreview']=function(_0x545455){var _0x422386=this;return new Promise(function(_0x4c0403,_0x18ea74){db[_0xb288('0x43')]['describe']()[_0xb288('0xd')](function(_0x609b85){return db[_0xb288('0x17')][_0xb288('0x18')]({'raw':_0x545455[_0xb288('0x19')]?_0x545455[_0xb288('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x545455['options']?_0x545455[_0xb288('0x19')]['where']||null:null,'attributes':_0x545455['options']?_0x545455[_0xb288('0x19')][_0xb288('0x1e')]||null:null,'limit':_0x545455[_0xb288('0x19')]?_0x545455[_0xb288('0x19')]['limit']||null:null,'include':_0x545455[_0xb288('0x19')]?_0x545455[_0xb288('0x19')][_0xb288('0x1c')]?_[_0xb288('0x1d')](_0x545455['options'][_0xb288('0x1c')],function(_0x3f1bb1){return{'model':db[_0x3f1bb1[_0xb288('0x1f')]],'as':_0x3f1bb1['as'],'attributes':_0x3f1bb1['as']==='Contact'?_[_0xb288('0x30')](_0x609b85):_0x3f1bb1[_0xb288('0x1e')],'include':_0x3f1bb1[_0xb288('0x1c')]?_['map'](_0x3f1bb1[_0xb288('0x1c')],function(_0x261112){return{'model':db[_0x261112[_0xb288('0x1f')]],'as':_0x261112['as'],'attributes':_0x261112['attributes'],'include':_0x261112[_0xb288('0x1c')]?_[_0xb288('0x1d')](_0x261112[_0xb288('0x1c')],function(_0x313c31){return{'model':db[_0x313c31['model']],'as':_0x313c31['as'],'attributes':_0x313c31[_0xb288('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb288('0xd')](function(_0x5f57e8){logger[_0xb288('0xe')]('GetCmHopper',_0x545455);logger[_0xb288('0x20')](_0xb288('0x46'),_0x545455,JSON[_0xb288('0x12')](_0x5f57e8));_0x4c0403(_0x5f57e8);})[_0xb288('0x16')](function(_0x5a7584){logger[_0xb288('0x13')]('GetCmHopper',_0x5a7584[_0xb288('0x15')],_0x545455);_0x18ea74(_0x422386[_0xb288('0x13')](0x1f4,_0x5a7584[_0xb288('0x15')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index afc4961..508846a 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 _0xaf93=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','/preview','getPreview','put','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller'];(function(_0x4c8f86,_0x5cfb80){var _0x59a513=function(_0x382b79){while(--_0x382b79){_0x4c8f86['push'](_0x4c8f86['shift']());}};_0x59a513(++_0x5cfb80);}(_0xaf93,0x151));var _0x3af9=function(_0x2302a1,_0x4bc33d){_0x2302a1=_0x2302a1-0x0;var _0x413cae=_0xaf93[_0x2302a1];return _0x413cae;};'use strict';var multer=require(_0x3af9('0x0'));var util=require(_0x3af9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3af9('0x2'));var router=express[_0x3af9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3af9('0x4'));var interaction=require(_0x3af9('0x5'));var config=require(_0x3af9('0x6'));var controller=require(_0x3af9('0x7'));router[_0x3af9('0x8')]('/',auth[_0x3af9('0x9')](),controller[_0x3af9('0xa')]);router['get'](_0x3af9('0xb'),auth['isAuthenticated'](),controller[_0x3af9('0xc')]);router['get']('/opencontacts',auth[_0x3af9('0x9')](),controller['getOpenContacts']);router['get'](_0x3af9('0xd'),auth[_0x3af9('0x9')](),controller[_0x3af9('0xe')]);router[_0x3af9('0xf')]('/',auth['isAuthenticated'](),controller[_0x3af9('0x10')]);router[_0x3af9('0xf')](_0x3af9('0x11'),auth[_0x3af9('0x9')](),controller[_0x3af9('0x12')]);router[_0x3af9('0x13')](_0x3af9('0xd'),auth[_0x3af9('0x9')](),controller['update']);router[_0x3af9('0x14')]('/:id',auth[_0x3af9('0x9')](),controller[_0x3af9('0x15')]);module[_0x3af9('0x16')]=router; \ No newline at end of file +var _0xb2ff=['describe','/opencontacts','post','create','/preview','getPreview','put','/:id','update','delete','exports','multer','util','connect-timeout','../../components/auth/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','/describe'];(function(_0x3d7fb5,_0x16eb5c){var _0x3a9642=function(_0x3f5b2a){while(--_0x3f5b2a){_0x3d7fb5['push'](_0x3d7fb5['shift']());}};_0x3a9642(++_0x16eb5c);}(_0xb2ff,0x123));var _0xfb2f=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb2ff[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0xfb2f('0x0'));var util=require(_0xfb2f('0x1'));var path=require('path');var timeout=require(_0xfb2f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfb2f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xfb2f('0x4'));var controller=require(_0xfb2f('0x5'));router[_0xfb2f('0x6')]('/',auth[_0xfb2f('0x7')](),controller['index']);router['get'](_0xfb2f('0x8'),auth['isAuthenticated'](),controller[_0xfb2f('0x9')]);router[_0xfb2f('0x6')](_0xfb2f('0xa'),auth[_0xfb2f('0x7')](),controller['getOpenContacts']);router[_0xfb2f('0x6')]('/:id',auth[_0xfb2f('0x7')](),controller['show']);router[_0xfb2f('0xb')]('/',auth[_0xfb2f('0x7')](),controller[_0xfb2f('0xc')]);router[_0xfb2f('0xb')](_0xfb2f('0xd'),auth['isAuthenticated'](),controller[_0xfb2f('0xe')]);router[_0xfb2f('0xf')](_0xfb2f('0x10'),auth[_0xfb2f('0x7')](),controller[_0xfb2f('0x11')]);router[_0xfb2f('0x12')](_0xfb2f('0x10'),auth[_0xfb2f('0x7')](),controller['destroy']);module[_0xfb2f('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 311bf6c..f1d8127 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 _0xe4ff=['sequelize','exports','INTEGER','contactListQueue','moment'];(function(_0x1c510a,_0x1413a9){var _0x23cedd=function(_0x3f3e43){while(--_0x3f3e43){_0x1c510a['push'](_0x1c510a['shift']());}};_0x23cedd(++_0x1413a9);}(_0xe4ff,0x130));var _0xfe4f=function(_0x119880,_0x4f291f){_0x119880=_0x119880-0x0;var _0x4a1707=_0xe4ff[_0x119880];return _0x4a1707;};'use strict';var moment=require(_0xfe4f('0x0'));var Sequelize=require(_0xfe4f('0x1'));module[_0xfe4f('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xfe4f('0x3')],'unique':_0xfe4f('0x4')},'ListId':{'type':Sequelize[_0xfe4f('0x3')],'unique':_0xfe4f('0x4')},'VoiceQueueId':{'type':Sequelize[_0xfe4f('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0xc99a=['exports','INTEGER','contactListQueue','moment','sequelize'];(function(_0x5d0e2c,_0x31b210){var _0x1d17f3=function(_0x4d18e9){while(--_0x4d18e9){_0x5d0e2c['push'](_0x5d0e2c['shift']());}};_0x1d17f3(++_0x31b210);}(_0xc99a,0x94));var _0xac99=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc99a[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xac99('0x0'));var Sequelize=require(_0xac99('0x1'));module[_0xac99('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xac99('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xac99('0x3')],'unique':_0xac99('0x4')},'VoiceQueueId':{'type':Sequelize[_0xac99('0x3')],'unique':_0xac99('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 594928b..5747da0 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 _0x1318=['nolimit','order','sort','where','pick','filters','merge','type','VIRTUAL','filter','includeAll','include','findAll','catch','params','options','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','query','keys','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x237f8b,_0xc5eddb){var _0x423f94=function(_0x1f18f9){while(--_0x1f18f9){_0x237f8b['push'](_0x237f8b['shift']());}};_0x423f94(++_0xc5eddb);}(_0x1318,0xab));var _0x8131=function(_0x35bb51,_0x47fad7){_0x35bb51=_0x35bb51-0x0;var _0x36478a=_0x1318[_0x35bb51];return _0x36478a;};'use strict';var pdf=require(_0x8131('0x0'));var emlformat=require(_0x8131('0x1'));var rimraf=require(_0x8131('0x2'));var zipdir=require(_0x8131('0x3'));var jsonpatch=require(_0x8131('0x4'));var rp=require(_0x8131('0x5'));var moment=require(_0x8131('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x8131('0x7'));var util=require(_0x8131('0x8'));var path=require('path');var sox=require(_0x8131('0x9'));var csv=require(_0x8131('0xa'));var ejs=require(_0x8131('0xb'));var fs=require('fs');var fs_extra=require(_0x8131('0xc'));var _=require(_0x8131('0xd'));var squel=require(_0x8131('0xe'));var crypto=require(_0x8131('0xf'));var jsforce=require(_0x8131('0x10'));var deskjs=require(_0x8131('0x11'));var toCsv=require(_0x8131('0xa'));var querystring=require(_0x8131('0x12'));var Papa=require(_0x8131('0x13'));var Redis=require(_0x8131('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8131('0x15'));var logger=require(_0x8131('0x16'))(_0x8131('0x17'));var utils=require('../../config/utils');var config=require(_0x8131('0x18'));var licenseUtil=require(_0x8131('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23d8c8,_0x505b83){_0x505b83=_0x505b83||0xcc;return function(_0x41776a){if(_0x41776a){return _0x23d8c8['sendStatus'](_0x505b83);}return _0x23d8c8[_0x8131('0x1a')](_0x505b83)[_0x8131('0x1b')]();};}function respondWithResult(_0x1ea853,_0x4c61c2){_0x4c61c2=_0x4c61c2||0xc8;return function(_0x20f403){if(_0x20f403){return _0x1ea853[_0x8131('0x1a')](_0x4c61c2)[_0x8131('0x1c')](_0x20f403);}};}function respondWithFilteredResult(_0x3ca7f2,_0x3f7960){return function(_0x3ebce9){if(_0x3ebce9){var _0x26ab4f=_0x3ebce9[_0x8131('0x1d')],_0x36d047=_0x3f7960[_0x8131('0x1e')],_0x16bc23=_0x3f7960['offset']+_0x3f7960[_0x8131('0x1f')],_0x3ddb9d;if(_0x16bc23>=_0x26ab4f){_0x16bc23=_0x26ab4f;_0x3ddb9d=0xc8;}else{_0x3ddb9d=0xce;}_0x3ca7f2[_0x8131('0x1a')](_0x3ddb9d);return _0x3ca7f2[_0x8131('0x20')](_0x8131('0x21'),_0x36d047+'-'+_0x16bc23+'/'+_0x26ab4f)[_0x8131('0x1c')](_0x3ebce9);}return null;};}function patchUpdates(_0x4a6dab){return function(_0x47428f){try{jsonpatch['apply'](_0x47428f,_0x4a6dab,!![]);}catch(_0x2f2723){return BPromise[_0x8131('0x22')](_0x2f2723);}return _0x47428f[_0x8131('0x23')]();};}function saveUpdates(_0x529a12,_0x22367f){return function(_0x4e77b4){if(_0x4e77b4){return _0x4e77b4[_0x8131('0x24')](_0x529a12)[_0x8131('0x25')](function(_0x51b8e0){return _0x51b8e0;});}return null;};}function removeEntity(_0x26845d,_0x28d04d){return function(_0xb79057){if(_0xb79057){return _0xb79057[_0x8131('0x26')]()[_0x8131('0x25')](function(){_0x26845d[_0x8131('0x1a')](0xcc)[_0x8131('0x1b')]();});}};}function handleEntityNotFound(_0x1796b7,_0x4b770d){return function(_0x60f31b){if(!_0x60f31b){_0x1796b7[_0x8131('0x27')](0x194);}return _0x60f31b;};}function handleError(_0x3783e7,_0x37b1df){_0x37b1df=_0x37b1df||0x1f4;return function(_0x2f7447){logger[_0x8131('0x28')](_0x2f7447[_0x8131('0x29')]);if(_0x2f7447['name']){delete _0x2f7447[_0x8131('0x2a')];}_0x3783e7[_0x8131('0x1a')](_0x37b1df)[_0x8131('0x2b')](_0x2f7447);};}exports[_0x8131('0x2c')]=function(_0x22ab07,_0x1e0fa2){var _0x5ab44b={},_0x30f794={},_0x2c9db6={'count':0x0,'rows':[]};var _0x2ab219=_[_0x8131('0x2d')](db[_0x8131('0x2e')][_0x8131('0x2f')],function(_0x550dc3){return{'name':_0x550dc3[_0x8131('0x30')],'type':_0x550dc3['type']['key']};});_0x30f794['model']=_['map'](_0x2ab219,_0x8131('0x2a'));_0x30f794[_0x8131('0x31')]=_[_0x8131('0x32')](_0x22ab07[_0x8131('0x31')]);_0x30f794['filters']=_[_0x8131('0x33')](_0x30f794[_0x8131('0x34')],_0x30f794['query']);_0x5ab44b[_0x8131('0x35')]=_[_0x8131('0x33')](_0x30f794[_0x8131('0x34')],qs[_0x8131('0x36')](_0x22ab07[_0x8131('0x31')][_0x8131('0x36')]));_0x5ab44b[_0x8131('0x35')]=_0x5ab44b[_0x8131('0x35')][_0x8131('0x37')]?_0x5ab44b[_0x8131('0x35')]:_0x30f794['model'];if(!_0x22ab07[_0x8131('0x31')][_0x8131('0x38')](_0x8131('0x39'))){_0x5ab44b[_0x8131('0x1f')]=qs['limit'](_0x22ab07[_0x8131('0x31')][_0x8131('0x1f')]);_0x5ab44b[_0x8131('0x1e')]=qs[_0x8131('0x1e')](_0x22ab07[_0x8131('0x31')][_0x8131('0x1e')]);}_0x5ab44b[_0x8131('0x3a')]=qs[_0x8131('0x3b')](_0x22ab07[_0x8131('0x31')]['sort']);_0x5ab44b[_0x8131('0x3c')]=qs['filters'](_[_0x8131('0x3d')](_0x22ab07['query'],_0x30f794[_0x8131('0x3e')]),_0x2ab219);if(_0x22ab07['query']['filter']){_0x5ab44b[_0x8131('0x3c')]=_[_0x8131('0x3f')](_0x5ab44b[_0x8131('0x3c')],{'$or':_[_0x8131('0x2d')](_0x2ab219,function(_0x412074){if(_0x412074[_0x8131('0x40')]!==_0x8131('0x41')){var _0x4eca18={};_0x4eca18[_0x412074['name']]={'$like':'%'+_0x22ab07[_0x8131('0x31')][_0x8131('0x42')]+'%'};return _0x4eca18;}})});}_0x5ab44b=_[_0x8131('0x3f')]({},_0x5ab44b,_0x22ab07['options']);var _0x118dda={'where':_0x5ab44b[_0x8131('0x3c')]};return db['CmHopperBlack'][_0x8131('0x1d')](_0x118dda)[_0x8131('0x25')](function(_0x2b66f5){_0x2c9db6[_0x8131('0x1d')]=_0x2b66f5;if(_0x22ab07[_0x8131('0x31')][_0x8131('0x43')]){_0x5ab44b[_0x8131('0x44')]=[{'all':!![]}];}return db[_0x8131('0x2e')][_0x8131('0x45')](_0x5ab44b);})[_0x8131('0x25')](function(_0x575f5e){_0x2c9db6['rows']=_0x575f5e;return _0x2c9db6;})['then'](respondWithFilteredResult(_0x1e0fa2,_0x5ab44b))[_0x8131('0x46')](handleError(_0x1e0fa2,null));};exports['show']=function(_0x31be89,_0x3524a5){var _0x4d42ec={'raw':!![],'where':{'id':_0x31be89[_0x8131('0x47')]['id']}},_0x399ba8={};_0x399ba8[_0x8131('0x34')]=_[_0x8131('0x32')](db['CmHopperBlack']['rawAttributes']);_0x399ba8[_0x8131('0x31')]=_[_0x8131('0x32')](_0x31be89[_0x8131('0x31')]);_0x399ba8[_0x8131('0x3e')]=_[_0x8131('0x33')](_0x399ba8[_0x8131('0x34')],_0x399ba8[_0x8131('0x31')]);_0x4d42ec[_0x8131('0x35')]=_[_0x8131('0x33')](_0x399ba8['model'],qs[_0x8131('0x36')](_0x31be89[_0x8131('0x31')][_0x8131('0x36')]));_0x4d42ec[_0x8131('0x35')]=_0x4d42ec[_0x8131('0x35')][_0x8131('0x37')]?_0x4d42ec[_0x8131('0x35')]:_0x399ba8[_0x8131('0x34')];if(_0x31be89[_0x8131('0x31')]['includeAll']){_0x4d42ec[_0x8131('0x44')]=[{'all':!![]}];}_0x4d42ec=_[_0x8131('0x3f')]({},_0x4d42ec,_0x31be89[_0x8131('0x48')]);return db['CmHopperBlack']['find'](_0x4d42ec)['then'](handleEntityNotFound(_0x3524a5,null))[_0x8131('0x25')](respondWithResult(_0x3524a5,null))[_0x8131('0x46')](handleError(_0x3524a5,null));};exports[_0x8131('0x24')]=function(_0x3db04e,_0x46ff93){if(_0x3db04e[_0x8131('0x49')]['id']){delete _0x3db04e[_0x8131('0x49')]['id'];}return db[_0x8131('0x2e')][_0x8131('0x4a')]({'where':{'id':_0x3db04e[_0x8131('0x47')]['id']}})[_0x8131('0x25')](handleEntityNotFound(_0x46ff93,null))[_0x8131('0x25')](saveUpdates(_0x3db04e[_0x8131('0x49')],null))['then'](respondWithResult(_0x46ff93,null))[_0x8131('0x46')](handleError(_0x46ff93,null));};exports[_0x8131('0x26')]=function(_0x5964e4,_0xa595b9){return db['CmHopperBlack']['find']({'where':{'id':_0x5964e4[_0x8131('0x47')]['id']}})['then'](handleEntityNotFound(_0xa595b9,null))[_0x8131('0x25')](removeEntity(_0xa595b9,null))[_0x8131('0x46')](handleError(_0xa595b9,null));};exports[_0x8131('0x4b')]=function(_0x347281,_0x15815b){return db['CmHopperBlack'][_0x8131('0x4b')]()['then'](respondWithResult(_0x15815b,null))[_0x8131('0x46')](handleError(_0x15815b,null));}; \ No newline at end of file +var _0x84d7=['include','find','body','describe','zip-dir','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','save','update','then','destroy','error','stack','name','send','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','params'];(function(_0x5a1cb1,_0x3aefc7){var _0x526a4e=function(_0x128487){while(--_0x128487){_0x5a1cb1['push'](_0x5a1cb1['shift']());}};_0x526a4e(++_0x3aefc7);}(_0x84d7,0x1c0));var _0x784d=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x84d7[_0x55abd9];return _0x3e5669;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x784d('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x784d('0x1'));var moment=require(_0x784d('0x2'));var BPromise=require(_0x784d('0x3'));var Mustache=require(_0x784d('0x4'));var util=require('util');var path=require(_0x784d('0x5'));var sox=require(_0x784d('0x6'));var csv=require(_0x784d('0x7'));var ejs=require(_0x784d('0x8'));var fs=require('fs');var fs_extra=require(_0x784d('0x9'));var _=require(_0x784d('0xa'));var squel=require(_0x784d('0xb'));var crypto=require(_0x784d('0xc'));var jsforce=require(_0x784d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x784d('0x7'));var querystring=require(_0x784d('0xe'));var Papa=require(_0x784d('0xf'));var Redis=require(_0x784d('0x10'));var authService=require(_0x784d('0x11'));var qs=require(_0x784d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x784d('0x13'));var utils=require(_0x784d('0x14'));var config=require(_0x784d('0x15'));var licenseUtil=require(_0x784d('0x16'));var db=require(_0x784d('0x17'))['db'];function respondWithStatusCode(_0x49db31,_0x10ca49){_0x10ca49=_0x10ca49||0xcc;return function(_0x4c6f19){if(_0x4c6f19){return _0x49db31[_0x784d('0x18')](_0x10ca49);}return _0x49db31[_0x784d('0x19')](_0x10ca49)[_0x784d('0x1a')]();};}function respondWithResult(_0x43a71a,_0xf7d093){_0xf7d093=_0xf7d093||0xc8;return function(_0xac096){if(_0xac096){return _0x43a71a['status'](_0xf7d093)[_0x784d('0x1b')](_0xac096);}};}function respondWithFilteredResult(_0xf6591b,_0x4fd26c){return function(_0x1bca1e){if(_0x1bca1e){var _0x10d091=_0x1bca1e['count'],_0x19bd52=_0x4fd26c[_0x784d('0x1c')],_0x3e5da2=_0x4fd26c[_0x784d('0x1c')]+_0x4fd26c[_0x784d('0x1d')],_0x2994f9;if(_0x3e5da2>=_0x10d091){_0x3e5da2=_0x10d091;_0x2994f9=0xc8;}else{_0x2994f9=0xce;}_0xf6591b[_0x784d('0x19')](_0x2994f9);return _0xf6591b[_0x784d('0x1e')]('Content-Range',_0x19bd52+'-'+_0x3e5da2+'/'+_0x10d091)[_0x784d('0x1b')](_0x1bca1e);}return null;};}function patchUpdates(_0x155110){return function(_0x3df34b){try{jsonpatch[_0x784d('0x1f')](_0x3df34b,_0x155110,!![]);}catch(_0x6aceb){return BPromise['reject'](_0x6aceb);}return _0x3df34b[_0x784d('0x20')]();};}function saveUpdates(_0x42c55a,_0x33f30f){return function(_0x39ee82){if(_0x39ee82){return _0x39ee82[_0x784d('0x21')](_0x42c55a)[_0x784d('0x22')](function(_0x240caf){return _0x240caf;});}return null;};}function removeEntity(_0x1550c1,_0x467e44){return function(_0xe9ff2e){if(_0xe9ff2e){return _0xe9ff2e[_0x784d('0x23')]()[_0x784d('0x22')](function(){_0x1550c1[_0x784d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x390ac7,_0x21edcf){return function(_0x112e39){if(!_0x112e39){_0x390ac7[_0x784d('0x18')](0x194);}return _0x112e39;};}function handleError(_0x171481,_0x38ac40){_0x38ac40=_0x38ac40||0x1f4;return function(_0x15ff0d){logger[_0x784d('0x24')](_0x15ff0d[_0x784d('0x25')]);if(_0x15ff0d[_0x784d('0x26')]){delete _0x15ff0d['name'];}_0x171481[_0x784d('0x19')](_0x38ac40)[_0x784d('0x27')](_0x15ff0d);};}exports['index']=function(_0x358efd,_0x18029a){var _0x5df20a={},_0x597d11={},_0x2b6c5f={'count':0x0,'rows':[]};var _0x104560=_[_0x784d('0x28')](db[_0x784d('0x29')][_0x784d('0x2a')],function(_0xecdef4){return{'name':_0xecdef4[_0x784d('0x2b')],'type':_0xecdef4[_0x784d('0x2c')][_0x784d('0x2d')]};});_0x597d11[_0x784d('0x2e')]=_['map'](_0x104560,_0x784d('0x26'));_0x597d11[_0x784d('0x2f')]=_[_0x784d('0x30')](_0x358efd[_0x784d('0x2f')]);_0x597d11[_0x784d('0x31')]=_[_0x784d('0x32')](_0x597d11[_0x784d('0x2e')],_0x597d11[_0x784d('0x2f')]);_0x5df20a[_0x784d('0x33')]=_[_0x784d('0x32')](_0x597d11['model'],qs['fields'](_0x358efd[_0x784d('0x2f')][_0x784d('0x34')]));_0x5df20a[_0x784d('0x33')]=_0x5df20a['attributes'][_0x784d('0x35')]?_0x5df20a[_0x784d('0x33')]:_0x597d11[_0x784d('0x2e')];if(!_0x358efd[_0x784d('0x2f')][_0x784d('0x36')](_0x784d('0x37'))){_0x5df20a[_0x784d('0x1d')]=qs[_0x784d('0x1d')](_0x358efd['query'][_0x784d('0x1d')]);_0x5df20a['offset']=qs['offset'](_0x358efd[_0x784d('0x2f')][_0x784d('0x1c')]);}_0x5df20a[_0x784d('0x38')]=qs[_0x784d('0x39')](_0x358efd[_0x784d('0x2f')][_0x784d('0x39')]);_0x5df20a[_0x784d('0x3a')]=qs[_0x784d('0x31')](_[_0x784d('0x3b')](_0x358efd['query'],_0x597d11['filters']),_0x104560);if(_0x358efd['query'][_0x784d('0x3c')]){_0x5df20a[_0x784d('0x3a')]=_[_0x784d('0x3d')](_0x5df20a[_0x784d('0x3a')],{'$or':_[_0x784d('0x28')](_0x104560,function(_0xb5252){if(_0xb5252[_0x784d('0x2c')]!==_0x784d('0x3e')){var _0x1e63d0={};_0x1e63d0[_0xb5252['name']]={'$like':'%'+_0x358efd[_0x784d('0x2f')][_0x784d('0x3c')]+'%'};return _0x1e63d0;}})});}_0x5df20a=_['merge']({},_0x5df20a,_0x358efd[_0x784d('0x3f')]);var _0x3d1bbf={'where':_0x5df20a[_0x784d('0x3a')]};return db[_0x784d('0x29')][_0x784d('0x40')](_0x3d1bbf)[_0x784d('0x22')](function(_0x168437){_0x2b6c5f[_0x784d('0x40')]=_0x168437;if(_0x358efd[_0x784d('0x2f')][_0x784d('0x41')]){_0x5df20a['include']=[{'all':!![]}];}return db[_0x784d('0x29')][_0x784d('0x42')](_0x5df20a);})[_0x784d('0x22')](function(_0x43086d){_0x2b6c5f[_0x784d('0x43')]=_0x43086d;return _0x2b6c5f;})[_0x784d('0x22')](respondWithFilteredResult(_0x18029a,_0x5df20a))[_0x784d('0x44')](handleError(_0x18029a,null));};exports['show']=function(_0x12b3d5,_0x42aac7){var _0x2f4bb1={'raw':!![],'where':{'id':_0x12b3d5[_0x784d('0x45')]['id']}},_0x1b53d5={};_0x1b53d5[_0x784d('0x2e')]=_[_0x784d('0x30')](db['CmHopperBlack'][_0x784d('0x2a')]);_0x1b53d5[_0x784d('0x2f')]=_['keys'](_0x12b3d5['query']);_0x1b53d5[_0x784d('0x31')]=_[_0x784d('0x32')](_0x1b53d5[_0x784d('0x2e')],_0x1b53d5['query']);_0x2f4bb1[_0x784d('0x33')]=_[_0x784d('0x32')](_0x1b53d5[_0x784d('0x2e')],qs[_0x784d('0x34')](_0x12b3d5[_0x784d('0x2f')][_0x784d('0x34')]));_0x2f4bb1[_0x784d('0x33')]=_0x2f4bb1['attributes']['length']?_0x2f4bb1['attributes']:_0x1b53d5[_0x784d('0x2e')];if(_0x12b3d5['query'][_0x784d('0x41')]){_0x2f4bb1[_0x784d('0x46')]=[{'all':!![]}];}_0x2f4bb1=_[_0x784d('0x3d')]({},_0x2f4bb1,_0x12b3d5['options']);return db[_0x784d('0x29')][_0x784d('0x47')](_0x2f4bb1)[_0x784d('0x22')](handleEntityNotFound(_0x42aac7,null))[_0x784d('0x22')](respondWithResult(_0x42aac7,null))['catch'](handleError(_0x42aac7,null));};exports[_0x784d('0x21')]=function(_0x3f60eb,_0x3b9b48){if(_0x3f60eb['body']['id']){delete _0x3f60eb['body']['id'];}return db['CmHopperBlack'][_0x784d('0x47')]({'where':{'id':_0x3f60eb[_0x784d('0x45')]['id']}})[_0x784d('0x22')](handleEntityNotFound(_0x3b9b48,null))[_0x784d('0x22')](saveUpdates(_0x3f60eb[_0x784d('0x48')],null))[_0x784d('0x22')](respondWithResult(_0x3b9b48,null))[_0x784d('0x44')](handleError(_0x3b9b48,null));};exports[_0x784d('0x23')]=function(_0x45e32d,_0x16a41a){return db['CmHopperBlack'][_0x784d('0x47')]({'where':{'id':_0x45e32d[_0x784d('0x45')]['id']}})[_0x784d('0x22')](handleEntityNotFound(_0x16a41a,null))['then'](removeEntity(_0x16a41a,null))[_0x784d('0x44')](handleError(_0x16a41a,null));};exports[_0x784d('0x49')]=function(_0x263e90,_0x5bfa00){return db[_0x784d('0x29')][_0x784d('0x49')]()['then'](respondWithResult(_0x5bfa00,null))[_0x784d('0x44')](handleError(_0x5bfa00,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 107e0b9..846fa53 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 _0xcf28=['request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','cm_hopper_black','lodash','api','moment','bluebird'];(function(_0x250fdd,_0x59e1c2){var _0x32e48f=function(_0x4d5961){while(--_0x4d5961){_0x250fdd['push'](_0x250fdd['shift']());}};_0x32e48f(++_0x59e1c2);}(_0xcf28,0x10f));var _0x8cf2=function(_0x4bfa1d,_0x1f3392){_0x4bfa1d=_0x4bfa1d-0x0;var _0x247979=_0xcf28[_0x4bfa1d];return _0x247979;};'use strict';var _=require(_0x8cf2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8cf2('0x1'));var moment=require(_0x8cf2('0x2'));var BPromise=require(_0x8cf2('0x3'));var rp=require(_0x8cf2('0x4'));var fs=require('fs');var path=require(_0x8cf2('0x5'));var rimraf=require(_0x8cf2('0x6'));var config=require(_0x8cf2('0x7'));var attributes=require(_0x8cf2('0x8'));module[_0x8cf2('0x9')]=function(_0x50a207,_0x7df4f1){return _0x50a207['define']('CmHopperBlack',attributes,{'tableName':_0x8cf2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6fe=['../../config/environment','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','api','bluebird','request-promise','path'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xb6fe,0xb5));var _0xeb6f=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0xb6fe[_0x2ca9d4];return _0x258956;};'use strict';var _=require(_0xeb6f('0x0'));var util=require(_0xeb6f('0x1'));var logger=require('../../config/logger')(_0xeb6f('0x2'));var moment=require('moment');var BPromise=require(_0xeb6f('0x3'));var rp=require(_0xeb6f('0x4'));var fs=require('fs');var path=require(_0xeb6f('0x5'));var rimraf=require('rimraf');var config=require(_0xeb6f('0x6'));var attributes=require('./cmHopperBlack.attributes');module[_0xeb6f('0x7')]=function(_0x3ec811,_0x2f1424){return _0x3ec811[_0xeb6f('0x8')](_0xeb6f('0x9'),attributes,{'tableName':_0xeb6f('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 4246f09..3d4ae76 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 _0x5a8a=['catch','CmHopperBlack','findAll','options','raw','limit','include','map','attributes','model','info','GetCmHopperBlack','UpdateCmHopperBlack','body','where','DestroyCmHopperBlack','destroy','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x42f687,_0x558724){var _0x108838=function(_0x725814){while(--_0x725814){_0x42f687['push'](_0x42f687['shift']());}};_0x108838(++_0x558724);}(_0x5a8a,0x1e5));var _0xa5a8=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5a8a[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xa5a8('0x0'));var util=require(_0xa5a8('0x1'));var moment=require('moment');var BPromise=require(_0xa5a8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa5a8('0x3'));var db=require(_0xa5a8('0x4'))['db'];var utils=require(_0xa5a8('0x5'));var logger=require(_0xa5a8('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa5a8('0x7')][_0xa5a8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c5c9b,_0x5df033,_0x50260a){return new BPromise(function(_0x42a673,_0x39174c){return client['request'](_0x4c5c9b,_0x50260a)[_0xa5a8('0x9')](function(_0x272a28){logger['info'](_0xa5a8('0xa'),_0x5df033,_0xa5a8('0xb'));logger[_0xa5a8('0xc')](_0xa5a8('0xd'),_0x5df033,'request\x20sent',JSON[_0xa5a8('0xe')](_0x272a28));if(_0x272a28[_0xa5a8('0xf')]){if(_0x272a28[_0xa5a8('0xf')][_0xa5a8('0x10')]===0x1f4){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x5df033,_0x272a28['error'][_0xa5a8('0x11')]);return _0x39174c(_0x272a28[_0xa5a8('0xf')][_0xa5a8('0x11')]);}logger['error'](_0xa5a8('0xa'),_0x5df033,_0x272a28[_0xa5a8('0xf')][_0xa5a8('0x11')]);return _0x42a673(_0x272a28['error']['message']);}else{logger['info'](_0xa5a8('0xa'),_0x5df033,'request\x20sent');_0x42a673(_0x272a28[_0xa5a8('0x12')][_0xa5a8('0x11')]);}})[_0xa5a8('0x13')](function(_0x3c9ac2){logger[_0xa5a8('0xf')](_0xa5a8('0xa'),_0x5df033,_0x3c9ac2);_0x39174c(_0x3c9ac2);});});}exports['GetCmHopperBlack']=function(_0x3fe92f){var _0x490812=this;return new Promise(function(_0x248fc2,_0x241a2b){return db[_0xa5a8('0x14')][_0xa5a8('0x15')]({'raw':_0x3fe92f[_0xa5a8('0x16')]?_0x3fe92f[_0xa5a8('0x16')][_0xa5a8('0x17')]===undefined?!![]:![]:!![],'where':_0x3fe92f[_0xa5a8('0x16')]?_0x3fe92f['options']['where']||null:null,'attributes':_0x3fe92f[_0xa5a8('0x16')]?_0x3fe92f[_0xa5a8('0x16')]['attributes']||null:null,'limit':_0x3fe92f[_0xa5a8('0x16')]?_0x3fe92f[_0xa5a8('0x16')][_0xa5a8('0x18')]||null:null,'include':_0x3fe92f['options']?_0x3fe92f[_0xa5a8('0x16')][_0xa5a8('0x19')]?_[_0xa5a8('0x1a')](_0x3fe92f[_0xa5a8('0x16')][_0xa5a8('0x19')],function(_0x535336){return{'model':db[_0x535336['model']],'as':_0x535336['as'],'attributes':_0x535336[_0xa5a8('0x1b')],'include':_0x535336[_0xa5a8('0x19')]?_[_0xa5a8('0x1a')](_0x535336[_0xa5a8('0x19')],function(_0x4561b4){return{'model':db[_0x4561b4[_0xa5a8('0x1c')]],'as':_0x4561b4['as'],'attributes':_0x4561b4[_0xa5a8('0x1b')],'include':_0x4561b4[_0xa5a8('0x19')]?_['map'](_0x4561b4['include'],function(_0x256905){return{'model':db[_0x256905[_0xa5a8('0x1c')]],'as':_0x256905['as'],'attributes':_0x256905[_0xa5a8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa5a8('0x9')](function(_0x9a9d31){logger[_0xa5a8('0x1d')](_0xa5a8('0x1e'),_0x3fe92f);logger[_0xa5a8('0xc')](_0xa5a8('0x1e'),_0x3fe92f,JSON['stringify'](_0x9a9d31));_0x248fc2(_0x9a9d31);})[_0xa5a8('0x13')](function(_0x45ce33){logger[_0xa5a8('0xf')]('GetCmHopperBlack',_0x45ce33['message'],_0x3fe92f);_0x241a2b(_0x490812[_0xa5a8('0xf')](0x1f4,_0x45ce33[_0xa5a8('0x11')]));});});};exports[_0xa5a8('0x1f')]=function(_0x3053a9){var _0x4c972d=this;return new Promise(function(_0x9e3098,_0x5e21ee){return db[_0xa5a8('0x14')]['update'](_0x3053a9[_0xa5a8('0x20')],{'raw':_0x3053a9['options']?_0x3053a9['options'][_0xa5a8('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3053a9['options']?_0x3053a9[_0xa5a8('0x16')][_0xa5a8('0x21')]||null:null,'attributes':_0x3053a9[_0xa5a8('0x16')]?_0x3053a9[_0xa5a8('0x16')][_0xa5a8('0x1b')]||null:null,'limit':_0x3053a9[_0xa5a8('0x16')]?_0x3053a9[_0xa5a8('0x16')][_0xa5a8('0x18')]||null:null})[_0xa5a8('0x9')](function(_0x38addc){logger[_0xa5a8('0x1d')]('UpdateCmHopperBlack',_0x3053a9);logger[_0xa5a8('0xc')](_0xa5a8('0x1f'),_0x3053a9,JSON[_0xa5a8('0xe')](_0x38addc));_0x9e3098(_0x38addc);})['catch'](function(_0x37128e){logger[_0xa5a8('0xf')](_0xa5a8('0x1f'),_0x37128e[_0xa5a8('0x11')],_0x3053a9);_0x5e21ee(_0x4c972d['error'](0x1f4,_0x37128e[_0xa5a8('0x11')]));});});};exports[_0xa5a8('0x22')]=function(_0x28a2d6){var _0x49293c=this;return new Promise(function(_0x18b5ce,_0x663ba){return db[_0xa5a8('0x14')][_0xa5a8('0x23')]({'where':_0x28a2d6['options']?_0x28a2d6['options']['where']||null:null})[_0xa5a8('0x9')](function(_0x1872e8){logger[_0xa5a8('0x1d')](_0xa5a8('0x22'),_0x28a2d6);logger['debug'](_0xa5a8('0x22'),_0x28a2d6,JSON['stringify'](_0x1872e8));_0x18b5ce(_0x1872e8);})[_0xa5a8('0x13')](function(_0x27f813){logger['error'](_0xa5a8('0x22'),_0x27f813['message'],_0x28a2d6);_0x663ba(_0x49293c[_0xa5a8('0xf')](0x1f4,_0x27f813[_0xa5a8('0x11')]));});});}; \ No newline at end of file +var _0xf5b1=['GetCmHopperBlack','CmHopperBlack','findAll','raw','options','attributes','limit','include','map','model','catch','UpdateCmHopperBlack','update','body','destroy','where','DestroyCmHopperBlack','lodash','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','info','CmHopperBlack,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf5b1,0x19d));var _0x1f5b=function(_0xd5f9db,_0x688103){_0xd5f9db=_0xd5f9db-0x0;var _0x1228b0=_0xf5b1[_0xd5f9db];return _0x1228b0;};'use strict';var _=require(_0x1f5b('0x0'));var util=require('util');var moment=require(_0x1f5b('0x1'));var BPromise=require(_0x1f5b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f5b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1f5b('0x4'))(_0x1f5b('0x5'));var config=require(_0x1f5b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1f5b('0x7')][_0x1f5b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xce7575,_0x4f5016,_0x5bf144){return new BPromise(function(_0x4f11ad,_0x48fe45){return client['request'](_0xce7575,_0x5bf144)[_0x1f5b('0x9')](function(_0x22561b){logger[_0x1f5b('0xa')](_0x1f5b('0xb'),_0x4f5016,'request\x20sent');logger[_0x1f5b('0xc')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x4f5016,_0x1f5b('0xd'),JSON[_0x1f5b('0xe')](_0x22561b));if(_0x22561b['error']){if(_0x22561b[_0x1f5b('0xf')][_0x1f5b('0x10')]===0x1f4){logger[_0x1f5b('0xf')](_0x1f5b('0xb'),_0x4f5016,_0x22561b['error'][_0x1f5b('0x11')]);return _0x48fe45(_0x22561b[_0x1f5b('0xf')][_0x1f5b('0x11')]);}logger['error'](_0x1f5b('0xb'),_0x4f5016,_0x22561b[_0x1f5b('0xf')][_0x1f5b('0x11')]);return _0x4f11ad(_0x22561b[_0x1f5b('0xf')][_0x1f5b('0x11')]);}else{logger[_0x1f5b('0xa')](_0x1f5b('0xb'),_0x4f5016,_0x1f5b('0xd'));_0x4f11ad(_0x22561b[_0x1f5b('0x12')][_0x1f5b('0x11')]);}})['catch'](function(_0x4b9f5e){logger[_0x1f5b('0xf')](_0x1f5b('0xb'),_0x4f5016,_0x4b9f5e);_0x48fe45(_0x4b9f5e);});});}exports[_0x1f5b('0x13')]=function(_0x43aa88){var _0xb97322=this;return new Promise(function(_0x229168,_0x491852){return db[_0x1f5b('0x14')][_0x1f5b('0x15')]({'raw':_0x43aa88['options']?_0x43aa88['options'][_0x1f5b('0x16')]===undefined?!![]:![]:!![],'where':_0x43aa88[_0x1f5b('0x17')]?_0x43aa88['options']['where']||null:null,'attributes':_0x43aa88[_0x1f5b('0x17')]?_0x43aa88[_0x1f5b('0x17')][_0x1f5b('0x18')]||null:null,'limit':_0x43aa88[_0x1f5b('0x17')]?_0x43aa88[_0x1f5b('0x17')][_0x1f5b('0x19')]||null:null,'include':_0x43aa88[_0x1f5b('0x17')]?_0x43aa88[_0x1f5b('0x17')][_0x1f5b('0x1a')]?_[_0x1f5b('0x1b')](_0x43aa88[_0x1f5b('0x17')][_0x1f5b('0x1a')],function(_0xb50f58){return{'model':db[_0xb50f58['model']],'as':_0xb50f58['as'],'attributes':_0xb50f58['attributes'],'include':_0xb50f58['include']?_['map'](_0xb50f58[_0x1f5b('0x1a')],function(_0x20b036){return{'model':db[_0x20b036[_0x1f5b('0x1c')]],'as':_0x20b036['as'],'attributes':_0x20b036[_0x1f5b('0x18')],'include':_0x20b036[_0x1f5b('0x1a')]?_[_0x1f5b('0x1b')](_0x20b036[_0x1f5b('0x1a')],function(_0x3d1214){return{'model':db[_0x3d1214['model']],'as':_0x3d1214['as'],'attributes':_0x3d1214['attributes']};}):[]};}):[]};}):[]:[]})[_0x1f5b('0x9')](function(_0x5be674){logger[_0x1f5b('0xa')](_0x1f5b('0x13'),_0x43aa88);logger[_0x1f5b('0xc')]('GetCmHopperBlack',_0x43aa88,JSON[_0x1f5b('0xe')](_0x5be674));_0x229168(_0x5be674);})[_0x1f5b('0x1d')](function(_0x4cdd7d){logger[_0x1f5b('0xf')](_0x1f5b('0x13'),_0x4cdd7d[_0x1f5b('0x11')],_0x43aa88);_0x491852(_0xb97322[_0x1f5b('0xf')](0x1f4,_0x4cdd7d[_0x1f5b('0x11')]));});});};exports[_0x1f5b('0x1e')]=function(_0x3bef45){var _0x3c12a2=this;return new Promise(function(_0x25525f,_0x4d19e0){return db[_0x1f5b('0x14')][_0x1f5b('0x1f')](_0x3bef45[_0x1f5b('0x20')],{'raw':_0x3bef45['options']?_0x3bef45[_0x1f5b('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bef45[_0x1f5b('0x17')]?_0x3bef45['options']['where']||null:null,'attributes':_0x3bef45[_0x1f5b('0x17')]?_0x3bef45[_0x1f5b('0x17')]['attributes']||null:null,'limit':_0x3bef45[_0x1f5b('0x17')]?_0x3bef45[_0x1f5b('0x17')][_0x1f5b('0x19')]||null:null})[_0x1f5b('0x9')](function(_0x949a9e){logger[_0x1f5b('0xa')](_0x1f5b('0x1e'),_0x3bef45);logger[_0x1f5b('0xc')](_0x1f5b('0x1e'),_0x3bef45,JSON[_0x1f5b('0xe')](_0x949a9e));_0x25525f(_0x949a9e);})[_0x1f5b('0x1d')](function(_0x2c2e22){logger['error'](_0x1f5b('0x1e'),_0x2c2e22['message'],_0x3bef45);_0x4d19e0(_0x3c12a2['error'](0x1f4,_0x2c2e22[_0x1f5b('0x11')]));});});};exports['DestroyCmHopperBlack']=function(_0x1d7b94){var _0x3f03fd=this;return new Promise(function(_0x242d55,_0x4cc35f){return db[_0x1f5b('0x14')][_0x1f5b('0x21')]({'where':_0x1d7b94[_0x1f5b('0x17')]?_0x1d7b94['options'][_0x1f5b('0x22')]||null:null})[_0x1f5b('0x9')](function(_0x532bd1){logger[_0x1f5b('0xa')](_0x1f5b('0x23'),_0x1d7b94);logger[_0x1f5b('0xc')]('DestroyCmHopperBlack',_0x1d7b94,JSON['stringify'](_0x532bd1));_0x242d55(_0x532bd1);})[_0x1f5b('0x1d')](function(_0x46d0d6){logger[_0x1f5b('0xf')](_0x1f5b('0x23'),_0x46d0d6[_0x1f5b('0x11')],_0x1d7b94);_0x4cc35f(_0x3f03fd[_0x1f5b('0xf')](0x1f4,_0x46d0d6['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 64ae457..4cc1915 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 _0x292c=['../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x14c723,_0x20fe79){var _0x2531b5=function(_0x466ad6){while(--_0x466ad6){_0x14c723['push'](_0x14c723['shift']());}};_0x2531b5(++_0x20fe79);}(_0x292c,0x66));var _0xc292=function(_0x1dd532,_0x36e81c){_0x1dd532=_0x1dd532-0x0;var _0x3732aa=_0x292c[_0x1dd532];return _0x3732aa;};'use strict';var multer=require(_0xc292('0x0'));var util=require('util');var path=require(_0xc292('0x1'));var timeout=require(_0xc292('0x2'));var express=require(_0xc292('0x3'));var router=express[_0xc292('0x4')]();var fs_extra=require(_0xc292('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc292('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router[_0xc292('0x7')]('/',auth[_0xc292('0x8')](),controller[_0xc292('0x9')]);router[_0xc292('0x7')](_0xc292('0xa'),auth[_0xc292('0x8')](),controller[_0xc292('0xb')]);router[_0xc292('0x7')](_0xc292('0xc'),auth[_0xc292('0x8')](),controller['show']);router[_0xc292('0xd')](_0xc292('0xc'),auth[_0xc292('0x8')](),controller[_0xc292('0xe')]);router[_0xc292('0xf')]('/:id',auth[_0xc292('0x8')](),controller[_0xc292('0x10')]);module[_0xc292('0x11')]=router; \ No newline at end of file +var _0xc6ac=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x163b61,_0x17d248){_0x163b61=_0x163b61-0x0;var _0x48b542=_0xc6ac[_0x163b61];return _0x48b542;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var fs_extra=require(_0xcc6a('0x6'));var auth=require(_0xcc6a('0x7'));var interaction=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var controller=require(_0xcc6a('0xa'));router[_0xcc6a('0xb')]('/',auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xd')]);router['get'](_0xcc6a('0xe'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xf')]);router['get'](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x11')]);router[_0xcc6a('0x12')](_0xcc6a('0x10'),auth['isAuthenticated'](),controller[_0xcc6a('0x13')]);router[_0xcc6a('0x14')](_0xcc6a('0x10'),auth['isAuthenticated'](),controller[_0xcc6a('0x15')]);module[_0xcc6a('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 4276ea4..48a747d 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 _0xd7ed=['getDataValue','endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','moment','exports','INTEGER','STRING','DATE'];(function(_0x35b2b2,_0x17b7ea){var _0x2ccff0=function(_0x7f4669){while(--_0x7f4669){_0x35b2b2['push'](_0x35b2b2['shift']());}};_0x2ccff0(++_0x17b7ea);}(_0xd7ed,0x1a8));var _0xdd7e=function(_0x2becba,_0x4ea656){_0x2becba=_0x2becba-0x0;var _0x90b5dd=_0xd7ed[_0x2becba];return _0x90b5dd;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xdd7e('0x0'));module[_0xdd7e('0x1')]={'state':{'type':Sequelize[_0xdd7e('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xdd7e('0x3')]},'scheduledat':{'type':Sequelize[_0xdd7e('0x4')]},'countbusyretry':{'type':Sequelize[_0xdd7e('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xdd7e('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xdd7e('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xdd7e('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xdd7e('0x3')]},'originatecalleridname':{'type':Sequelize[_0xdd7e('0x3')]},'calleridnum':{'type':Sequelize[_0xdd7e('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xdd7e('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xdd7e('0x4')]},'droptime':{'type':Sequelize[_0xdd7e('0x4')]},'endtime':{'type':Sequelize[_0xdd7e('0x4')]},'ringtime':{'type':Sequelize[_0xdd7e('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xdd7e('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xdd7e('0x3')]},'campaign':{'type':Sequelize[_0xdd7e('0x3')]},'campaigntype':{'type':Sequelize[_0xdd7e('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xdd7e('0x3')]},'disposition':{'type':Sequelize[_0xdd7e('0x3')]},'secondDisposition':{'type':Sequelize[_0xdd7e('0x3')]},'thirdDisposition':{'type':Sequelize[_0xdd7e('0x3')]},'dispositionat':{'type':Sequelize[_0xdd7e('0x4')],'set':function(_0x3d0d7c){var _0x5637e6=this[_0xdd7e('0x5')](_0xdd7e('0x6'));if(_0x5637e6&&_0x3d0d7c){this[_0xdd7e('0x7')](_0xdd7e('0x8'),moment(_0x3d0d7c)[_0xdd7e('0x9')](moment(_0x5637e6),_0xdd7e('0xa')));}return this[_0xdd7e('0x7')](_0xdd7e('0xb'),_0x3d0d7c);}},'amd':{'type':Sequelize[_0xdd7e('0xc')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xdd7e('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xdd7e('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xdd7e('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xdd7e('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xdd7e('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xdd7e('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xdd7e('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xdd7e('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e3=['seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff'];(function(_0x16fe01,_0x5039e1){var _0x56c48a=function(_0x419884){while(--_0x419884){_0x16fe01['push'](_0x16fe01['shift']());}};_0x56c48a(++_0x5039e1);}(_0xa9e3,0x113));var _0x3a9e=function(_0x36ff20,_0x2f79b4){_0x36ff20=_0x36ff20-0x0;var _0x18a001=_0xa9e3[_0x36ff20];return _0x18a001;};'use strict';var Sequelize=require(_0x3a9e('0x0'));var moment=require(_0x3a9e('0x1'));module[_0x3a9e('0x2')]={'state':{'type':Sequelize[_0x3a9e('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x3a9e('0x4')]},'scheduledat':{'type':Sequelize[_0x3a9e('0x5')]},'countbusyretry':{'type':Sequelize[_0x3a9e('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3a9e('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x3a9e('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x3a9e('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3a9e('0x4')]},'calleridname':{'type':Sequelize[_0x3a9e('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x3a9e('0x5')]},'answertime':{'type':Sequelize[_0x3a9e('0x5')]},'droptime':{'type':Sequelize[_0x3a9e('0x5')]},'endtime':{'type':Sequelize[_0x3a9e('0x5')]},'ringtime':{'type':Sequelize[_0x3a9e('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x3a9e('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x3a9e('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x3a9e('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x3a9e('0x4')]},'campaign':{'type':Sequelize[_0x3a9e('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x3a9e('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x3a9e('0x4')]},'secondDisposition':{'type':Sequelize[_0x3a9e('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x3a9e('0x5')],'set':function(_0x29e109){var _0x3f86d9=this[_0x3a9e('0x6')](_0x3a9e('0x7'));if(_0x3f86d9&&_0x29e109){this[_0x3a9e('0x8')](_0x3a9e('0x9'),moment(_0x29e109)[_0x3a9e('0xa')](moment(_0x3f86d9),_0x3a9e('0xb')));}return this[_0x3a9e('0x8')]('dispositionat',_0x29e109);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x3a9e('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x3a9e('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x3a9e('0x5')]},'callback':{'type':Sequelize[_0x3a9e('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3a9e('0x5')]},'deleted':{'type':Sequelize[_0x3a9e('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x3a9e('0x5')]},'recallme':{'type':Sequelize[_0x3a9e('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x3a9e('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3a9e('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3a9e('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3a9e('0x3')],'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 cb9faaf..2f1371b 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 _0xf039=['catch','show','keys','find','describe','body','uniqueid','params','countContactsQueueCampaignHopperFinal','findAll','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','from','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','into','ListId','CampaignId','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','then','includeAll','include','rows'];(function(_0x3c22b2,_0x3b2ffa){var _0x2d9150=function(_0x473d7f){while(--_0x473d7f){_0x3c22b2['push'](_0x3c22b2['shift']());}};_0x2d9150(++_0x3b2ffa);}(_0xf039,0x1d6));var _0x9f03=function(_0x3628f4,_0x93661e){_0x3628f4=_0x3628f4-0x0;var _0x23758c=_0xf039[_0x3628f4];return _0x23758c;};'use strict';var pdf=require(_0x9f03('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9f03('0x1'));var zipdir=require(_0x9f03('0x2'));var jsonpatch=require(_0x9f03('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9f03('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9f03('0x5'));var csv=require(_0x9f03('0x6'));var ejs=require(_0x9f03('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9f03('0x8'));var squel=require(_0x9f03('0x9'));var crypto=require(_0x9f03('0xa'));var jsforce=require(_0x9f03('0xb'));var deskjs=require(_0x9f03('0xc'));var toCsv=require(_0x9f03('0x6'));var querystring=require(_0x9f03('0xd'));var Papa=require(_0x9f03('0xe'));var Redis=require(_0x9f03('0xf'));var authService=require(_0x9f03('0x10'));var qs=require(_0x9f03('0x11'));var as=require(_0x9f03('0x12'));var hardwareService=require(_0x9f03('0x13'));var logger=require(_0x9f03('0x14'))(_0x9f03('0x15'));var utils=require(_0x9f03('0x16'));var config=require(_0x9f03('0x17'));var licenseUtil=require(_0x9f03('0x18'));var db=require(_0x9f03('0x19'))['db'];function respondWithStatusCode(_0x7aed8a,_0x1256d4){_0x1256d4=_0x1256d4||0xcc;return function(_0x138576){if(_0x138576){return _0x7aed8a[_0x9f03('0x1a')](_0x1256d4);}return _0x7aed8a[_0x9f03('0x1b')](_0x1256d4)[_0x9f03('0x1c')]();};}function respondWithResult(_0x130a07,_0x3ff12d){_0x3ff12d=_0x3ff12d||0xc8;return function(_0x10a398){if(_0x10a398){return _0x130a07[_0x9f03('0x1b')](_0x3ff12d)[_0x9f03('0x1d')](_0x10a398);}};}function respondWithFilteredResult(_0x4bff36,_0x7011c5){return function(_0x523c6b){if(_0x523c6b){var _0x33207e=_0x523c6b[_0x9f03('0x1e')],_0x31a716=_0x7011c5[_0x9f03('0x1f')],_0x42fb64=_0x7011c5[_0x9f03('0x1f')]+_0x7011c5[_0x9f03('0x20')],_0x1afb05;if(_0x42fb64>=_0x33207e){_0x42fb64=_0x33207e;_0x1afb05=0xc8;}else{_0x1afb05=0xce;}_0x4bff36[_0x9f03('0x1b')](_0x1afb05);return _0x4bff36[_0x9f03('0x21')](_0x9f03('0x22'),_0x31a716+'-'+_0x42fb64+'/'+_0x33207e)[_0x9f03('0x1d')](_0x523c6b);}return null;};}function patchUpdates(_0x1354f3){return function(_0x3c4dc9){try{jsonpatch[_0x9f03('0x23')](_0x3c4dc9,_0x1354f3,!![]);}catch(_0x33b2dd){return BPromise['reject'](_0x33b2dd);}return _0x3c4dc9['save']();};}function saveUpdates(_0xef3fdf,_0x304c08){return function(_0xbdd246){if(_0xbdd246){return _0xbdd246[_0x9f03('0x24')](_0xef3fdf)['then'](function(_0x94a1a4){return _0x94a1a4;});}return null;};}function removeEntity(_0x2a9123,_0x4990ac){return function(_0x54d03b){if(_0x54d03b){return _0x54d03b['destroy']()['then'](function(){_0x2a9123[_0x9f03('0x1b')](0xcc)[_0x9f03('0x1c')]();});}};}function handleEntityNotFound(_0x694709,_0x4106e5){return function(_0x3b10c3){if(!_0x3b10c3){_0x694709[_0x9f03('0x1a')](0x194);}return _0x3b10c3;};}function handleError(_0x5debdb,_0x36a195){_0x36a195=_0x36a195||0x1f4;return function(_0x4f00f3){logger[_0x9f03('0x25')](_0x4f00f3[_0x9f03('0x26')]);if(_0x4f00f3['name']){delete _0x4f00f3[_0x9f03('0x27')];}_0x5debdb[_0x9f03('0x1b')](_0x36a195)[_0x9f03('0x28')](_0x4f00f3);};}exports[_0x9f03('0x29')]=function(_0x4c3660,_0x51d600){var _0x3bb6c2={},_0x4196c9={},_0x4a0891={'count':0x0,'rows':[]};var _0xb80895=_[_0x9f03('0x2a')](db[_0x9f03('0x2b')][_0x9f03('0x2c')],function(_0x4f0f35){return{'name':_0x4f0f35[_0x9f03('0x2d')],'type':_0x4f0f35[_0x9f03('0x2e')]['key']};});_0x4196c9['model']=_[_0x9f03('0x2a')](_0xb80895,'name');_0x4196c9['query']=_['keys'](_0x4c3660[_0x9f03('0x2f')]);_0x4196c9[_0x9f03('0x30')]=_['intersection'](_0x4196c9[_0x9f03('0x31')],_0x4196c9[_0x9f03('0x2f')]);_0x3bb6c2[_0x9f03('0x32')]=_[_0x9f03('0x33')](_0x4196c9[_0x9f03('0x31')],qs[_0x9f03('0x34')](_0x4c3660[_0x9f03('0x2f')][_0x9f03('0x34')]));_0x3bb6c2[_0x9f03('0x32')]=_0x3bb6c2['attributes'][_0x9f03('0x35')]?_0x3bb6c2[_0x9f03('0x32')]:_0x4196c9[_0x9f03('0x31')];if(!_0x4c3660[_0x9f03('0x2f')][_0x9f03('0x36')](_0x9f03('0x37'))){_0x3bb6c2[_0x9f03('0x20')]=qs['limit'](_0x4c3660['query'][_0x9f03('0x20')]);_0x3bb6c2[_0x9f03('0x1f')]=qs[_0x9f03('0x1f')](_0x4c3660['query']['offset']);}_0x3bb6c2['order']=qs[_0x9f03('0x38')](_0x4c3660[_0x9f03('0x2f')][_0x9f03('0x38')]);_0x3bb6c2['where']=qs[_0x9f03('0x30')](_[_0x9f03('0x39')](_0x4c3660[_0x9f03('0x2f')],_0x4196c9[_0x9f03('0x30')]),_0xb80895);if(_0x4c3660[_0x9f03('0x2f')][_0x9f03('0x3a')]){_0x3bb6c2[_0x9f03('0x3b')]=_['merge'](_0x3bb6c2['where'],{'$or':_[_0x9f03('0x2a')](_0xb80895,function(_0x507415){if(_0x507415[_0x9f03('0x2e')]!=='VIRTUAL'){var _0x378226={};_0x378226[_0x507415['name']]={'$like':'%'+_0x4c3660[_0x9f03('0x2f')][_0x9f03('0x3a')]+'%'};return _0x378226;}})});}_0x3bb6c2=_[_0x9f03('0x3c')]({},_0x3bb6c2,_0x4c3660[_0x9f03('0x3d')]);var _0x4dd8e4={'where':_0x3bb6c2[_0x9f03('0x3b')]};return db[_0x9f03('0x2b')][_0x9f03('0x1e')](_0x4dd8e4)[_0x9f03('0x3e')](function(_0x26c48e){_0x4a0891['count']=_0x26c48e;if(_0x4c3660[_0x9f03('0x2f')][_0x9f03('0x3f')]){_0x3bb6c2[_0x9f03('0x40')]=[{'all':!![]}];}return db[_0x9f03('0x2b')]['findAll'](_0x3bb6c2);})['then'](function(_0x5dcc71){_0x4a0891[_0x9f03('0x41')]=_0x5dcc71;return _0x4a0891;})['then'](respondWithFilteredResult(_0x51d600,_0x3bb6c2))[_0x9f03('0x42')](handleError(_0x51d600,null));};exports[_0x9f03('0x43')]=function(_0xa22be9,_0x3ebe13){var _0x2c5b06={'raw':!![],'where':{'id':_0xa22be9['params']['id']}},_0x33367c={};_0x33367c[_0x9f03('0x31')]=_[_0x9f03('0x44')](db[_0x9f03('0x2b')][_0x9f03('0x2c')]);_0x33367c[_0x9f03('0x2f')]=_[_0x9f03('0x44')](_0xa22be9[_0x9f03('0x2f')]);_0x33367c[_0x9f03('0x30')]=_[_0x9f03('0x33')](_0x33367c[_0x9f03('0x31')],_0x33367c['query']);_0x2c5b06[_0x9f03('0x32')]=_[_0x9f03('0x33')](_0x33367c[_0x9f03('0x31')],qs[_0x9f03('0x34')](_0xa22be9[_0x9f03('0x2f')][_0x9f03('0x34')]));_0x2c5b06[_0x9f03('0x32')]=_0x2c5b06['attributes'][_0x9f03('0x35')]?_0x2c5b06[_0x9f03('0x32')]:_0x33367c['model'];if(_0xa22be9['query'][_0x9f03('0x3f')]){_0x2c5b06['include']=[{'all':!![]}];}_0x2c5b06=_['merge']({},_0x2c5b06,_0xa22be9[_0x9f03('0x3d')]);return db[_0x9f03('0x2b')][_0x9f03('0x45')](_0x2c5b06)[_0x9f03('0x3e')](handleEntityNotFound(_0x3ebe13,null))[_0x9f03('0x3e')](respondWithResult(_0x3ebe13,null))[_0x9f03('0x42')](handleError(_0x3ebe13,null));};exports['describe']=function(_0x5f39c7,_0x24bdbd){return db['CmHopperFinal'][_0x9f03('0x46')]()[_0x9f03('0x3e')](respondWithResult(_0x24bdbd,null))['catch'](handleError(_0x24bdbd,null));};exports[_0x9f03('0x24')]=function(_0x989512,_0x21f3ba){if(_0x989512[_0x9f03('0x47')][_0x9f03('0x48')]){delete _0x989512['body'][_0x9f03('0x48')];}return db[_0x9f03('0x2b')]['find']({'where':{'uniqueid':_0x989512[_0x9f03('0x49')]['id']}})[_0x9f03('0x3e')](handleEntityNotFound(_0x21f3ba,null))[_0x9f03('0x3e')](saveUpdates(_0x989512['body'],null))[_0x9f03('0x3e')](respondWithResult(_0x21f3ba,null))[_0x9f03('0x42')](handleError(_0x21f3ba,null));};exports[_0x9f03('0x4a')]=function(_0x1e79b0,_0x3f39fa,_0xd1aa86){return db['CmHopperFinal'][_0x9f03('0x4b')]({'raw':![],'where':{'VoiceQueueId':_0x1e79b0[_0x9f03('0x49')]['id']},'attributes':[[db[_0x9f03('0x4c')]['fn']('COUNT',db[_0x9f03('0x4c')]['fn']('IF',db['sequelize'][_0x9f03('0x4d')](_0x9f03('0x4e')))),_0x9f03('0x4f')],[db[_0x9f03('0x4c')]['fn'](_0x9f03('0x50'),db[_0x9f03('0x4c')]['fn']('IF',db['sequelize']['literal'](_0x9f03('0x51')))),_0x9f03('0x52')],[db[_0x9f03('0x4c')]['fn'](_0x9f03('0x50'),db[_0x9f03('0x4c')]['fn']('IF',db[_0x9f03('0x4c')][_0x9f03('0x4d')](_0x9f03('0x53')))),_0x9f03('0x54')],[db[_0x9f03('0x4c')]['fn']('COUNT',db[_0x9f03('0x4c')]['fn']('IF',db['sequelize'][_0x9f03('0x4d')](_0x9f03('0x55')))),_0x9f03('0x56')],[db[_0x9f03('0x4c')]['fn']('COUNT',db[_0x9f03('0x4c')]['fn']('IF',db[_0x9f03('0x4c')][_0x9f03('0x4d')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x9f03('0x57')],[db['sequelize']['fn'](_0x9f03('0x50'),db[_0x9f03('0x4c')]['fn']('IF',db[_0x9f03('0x4c')]['literal'](_0x9f03('0x58')))),_0x9f03('0x59')],[db['sequelize']['fn'](_0x9f03('0x50'),db[_0x9f03('0x4c')]['fn']('IF',db[_0x9f03('0x4c')]['literal'](_0x9f03('0x5a')))),_0x9f03('0x5b')],[db[_0x9f03('0x4c')]['fn'](_0x9f03('0x50'),db[_0x9f03('0x4c')]['fn']('IF',db['sequelize']['literal'](_0x9f03('0x5c')))),_0x9f03('0x5d')]]})['then'](handleEntityNotFound(_0x3f39fa,null))[_0x9f03('0x3e')](respondWithResult(_0x3f39fa,null))['catch'](handleError(_0x3f39fa,null));};exports[_0x9f03('0x5e')]=function(_0x236c48,_0x56d1f3,_0x195f68){return db['CmHopperFinal'][_0x9f03('0x4b')]({'raw':![],'where':{'CampaignId':_0x236c48['params']['id']},'attributes':[[db[_0x9f03('0x4c')]['fn'](_0x9f03('0x50'),db[_0x9f03('0x4c')]['fn']('IF',db[_0x9f03('0x4c')]['literal'](_0x9f03('0x4e')))),_0x9f03('0x4f')],[db[_0x9f03('0x4c')]['fn'](_0x9f03('0x50'),db[_0x9f03('0x4c')]['fn']('IF',db[_0x9f03('0x4c')][_0x9f03('0x4d')](_0x9f03('0x51')))),'noAnswerContacts'],[db[_0x9f03('0x4c')]['fn']('COUNT',db[_0x9f03('0x4c')]['fn']('IF',db[_0x9f03('0x4c')][_0x9f03('0x4d')](_0x9f03('0x53')))),_0x9f03('0x54')],[db[_0x9f03('0x4c')]['fn'](_0x9f03('0x50'),db[_0x9f03('0x4c')]['fn']('IF',db[_0x9f03('0x4c')][_0x9f03('0x4d')](_0x9f03('0x55')))),'congestionContacts'],[db[_0x9f03('0x4c')]['fn'](_0x9f03('0x50'),db[_0x9f03('0x4c')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x9f03('0x57')],[db[_0x9f03('0x4c')]['fn'](_0x9f03('0x50'),db[_0x9f03('0x4c')]['fn']('IF',db[_0x9f03('0x4c')][_0x9f03('0x4d')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x9f03('0x59')],[db[_0x9f03('0x4c')]['fn'](_0x9f03('0x50'),db[_0x9f03('0x4c')]['fn']('IF',db['sequelize'][_0x9f03('0x4d')](_0x9f03('0x5a')))),_0x9f03('0x5b')],[db[_0x9f03('0x4c')]['fn'](_0x9f03('0x50'),db[_0x9f03('0x4c')]['fn']('IF',db['sequelize'][_0x9f03('0x4d')](_0x9f03('0x5c')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x56d1f3,null))[_0x9f03('0x3e')](respondWithResult(_0x56d1f3,null))['catch'](handleError(_0x56d1f3,null));};exports[_0x9f03('0x5f')]=function(_0x31d4f4,_0x19c4f1,_0x3d338d){return db[_0x9f03('0x60')][_0x9f03('0x45')]({'where':{'id':_0x31d4f4[_0x9f03('0x49')]['id']}})[_0x9f03('0x3e')](handleEntityNotFound(_0x19c4f1,null))[_0x9f03('0x3e')](function(_0xae108a){var _0x5da634;if(_0xae108a){_0x5da634=squel[_0x9f03('0x61')]()['into'](_0x9f03('0x62'))[_0x9f03('0x63')]([_0x9f03('0x64'),_0x9f03('0x65'),_0x9f03('0x66'),'ListId',_0x9f03('0x67'),_0x9f03('0x68'),_0x9f03('0x69')],squel[_0x9f03('0x6a')]()[_0x9f03('0x6b')](_0x9f03('0x6c'),'phone')['field'](_0x9f03('0x6d'),'scheduledAt')['field'](_0x9f03('0x6e'),_0x9f03('0x66'))[_0x9f03('0x6b')]('ANY_VALUE(ListId)','ListId')[_0x9f03('0x6b')](_0x9f03('0x6f'),_0x9f03('0x67'))[_0x9f03('0x6b')](_0x9f03('0x6d'),_0x9f03('0x68'))['field'](_0x9f03('0x6d'),'updatedAt')[_0x9f03('0x70')]('cm_hopper_final')[_0x9f03('0x3b')](_0x9f03('0x71'),_0x31d4f4[_0x9f03('0x49')]['id'][_0x9f03('0x72')]())[_0x9f03('0x3b')](_0x9f03('0x73'),_0x31d4f4['body'][_0x9f03('0x74')][_0x9f03('0x72')]())[_0x9f03('0x3b')](_0x9f03('0x75'))[_0x9f03('0x3b')](_0x9f03('0x76'),squel['select']()[_0x9f03('0x6b')](_0x9f03('0x64'))[_0x9f03('0x70')](_0x9f03('0x62'))[_0x9f03('0x3b')](_0x9f03('0x71'),_0x31d4f4[_0x9f03('0x49')]['id'][_0x9f03('0x72')]()))[_0x9f03('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x9f03('0x6a')]()['field'](_0x9f03('0x77'))[_0x9f03('0x70')](_0x9f03('0x78'))[_0x9f03('0x3b')](_0x9f03('0x71'),_0x31d4f4[_0x9f03('0x49')]['id']['toString']())['where'](_0x9f03('0x79')))[_0x9f03('0x7a')](_0x9f03('0x66')))['toString']();return db[_0x9f03('0x4c')]['query'](_0x5da634);}return[];})[_0x9f03('0x3e')](respondWithResult(_0x19c4f1,null))[_0x9f03('0x42')](handleError(_0x19c4f1,null));};exports[_0x9f03('0x7b')]=function(_0x4b6a4a,_0x104712,_0x4c473e){return db[_0x9f03('0x7c')][_0x9f03('0x45')]({'where':{'id':_0x4b6a4a['params']['id']}})[_0x9f03('0x3e')](handleEntityNotFound(_0x104712,null))[_0x9f03('0x3e')](function(_0x1a77a0){var _0x266267;if(_0x1a77a0){_0x266267=squel[_0x9f03('0x61')]()[_0x9f03('0x7d')](_0x9f03('0x62'))[_0x9f03('0x63')]([_0x9f03('0x64'),_0x9f03('0x65'),_0x9f03('0x66'),_0x9f03('0x7e'),_0x9f03('0x7f'),'createdAt',_0x9f03('0x69')],squel[_0x9f03('0x6a')]()[_0x9f03('0x6b')](_0x9f03('0x6c'),_0x9f03('0x64'))['field']('NOW()',_0x9f03('0x65'))[_0x9f03('0x6b')]('ANY_VALUE(ContactId)','ContactId')[_0x9f03('0x6b')](_0x9f03('0x80'),'ListId')['field'](_0x9f03('0x81'),_0x9f03('0x7f'))[_0x9f03('0x6b')](_0x9f03('0x6d'),_0x9f03('0x68'))[_0x9f03('0x6b')](_0x9f03('0x6d'),_0x9f03('0x69'))[_0x9f03('0x70')]('cm_hopper_final')['where']('CampaignId\x20=\x20?',_0x4b6a4a['params']['id'][_0x9f03('0x72')]())['where'](_0x9f03('0x73'),_0x4b6a4a['body'][_0x9f03('0x74')]['toString']())['where'](_0x9f03('0x75'))[_0x9f03('0x3b')](_0x9f03('0x76'),squel[_0x9f03('0x6a')]()[_0x9f03('0x6b')](_0x9f03('0x64'))[_0x9f03('0x70')](_0x9f03('0x62'))[_0x9f03('0x3b')]('CampaignId\x20=\x20?',_0x4b6a4a[_0x9f03('0x49')]['id'][_0x9f03('0x72')]()))[_0x9f03('0x3b')](_0x9f03('0x76'),squel[_0x9f03('0x6a')]()[_0x9f03('0x6b')](_0x9f03('0x77'))[_0x9f03('0x70')]('cm_hopper_final')[_0x9f03('0x3b')](_0x9f03('0x82'),_0x4b6a4a['params']['id'][_0x9f03('0x72')]())[_0x9f03('0x3b')](_0x9f03('0x79')))[_0x9f03('0x7a')](_0x9f03('0x66')))[_0x9f03('0x72')]();return db['sequelize'][_0x9f03('0x2f')](_0x266267);}return[];})[_0x9f03('0x3e')](respondWithResult(_0x104712,null))[_0x9f03('0x42')](handleError(_0x104712,null));};exports[_0x9f03('0x83')]=function(_0x6613eb,_0x1fe315,_0x42494b){return db[_0x9f03('0x84')][_0x9f03('0x85')]({'where':{'VoiceQueueId':_0x6613eb[_0x9f03('0x47')][_0x9f03('0x67')],'CampaignId':_0x6613eb['body']['CampaignId'],'ContactId':_0x6613eb[_0x9f03('0x47')][_0x9f03('0x66')]}})[_0x9f03('0x3e')](handleEntityNotFound(_0x1fe315,null))[_0x9f03('0x3e')](function(_0x224056){if(_0x224056){return _0x224056;}return null;})[_0x9f03('0x3e')](respondWithResult(_0x1fe315,null))[_0x9f03('0x42')](handleError(_0x1fe315,null));}; \ No newline at end of file +var _0xf65a=['ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','phone','VoiceQueueId\x20=\x20?','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','ListId','NOW()','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','send','map','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','includeAll','CmHopperFinal','rows','catch','show','keys','length','find','describe','body','uniqueid','params','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','`state`\x20=\x208,\x201,\x20null','congestionContacts','abandonedContacts','`state`\x20=\x2019,\x201,\x20null','VoiceQueue','insert','into','cm_hopper','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)'];(function(_0xa0ac05,_0x4a7da8){var _0x6ea8b4=function(_0x501c8d){while(--_0x501c8d){_0xa0ac05['push'](_0xa0ac05['shift']());}};_0x6ea8b4(++_0x4a7da8);}(_0xf65a,0x19b));var _0xaf65=function(_0x1f879f,_0x2b5702){_0x1f879f=_0x1f879f-0x0;var _0x1a2a0d=_0xf65a[_0x1f879f];return _0x1a2a0d;};'use strict';var pdf=require(_0xaf65('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xaf65('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaf65('0x2'));var rp=require(_0xaf65('0x3'));var moment=require(_0xaf65('0x4'));var BPromise=require(_0xaf65('0x5'));var Mustache=require(_0xaf65('0x6'));var util=require(_0xaf65('0x7'));var path=require('path');var sox=require(_0xaf65('0x8'));var csv=require(_0xaf65('0x9'));var ejs=require(_0xaf65('0xa'));var fs=require('fs');var fs_extra=require(_0xaf65('0xb'));var _=require('lodash');var squel=require(_0xaf65('0xc'));var crypto=require(_0xaf65('0xd'));var jsforce=require(_0xaf65('0xe'));var deskjs=require(_0xaf65('0xf'));var toCsv=require(_0xaf65('0x9'));var querystring=require(_0xaf65('0x10'));var Papa=require(_0xaf65('0x11'));var Redis=require(_0xaf65('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xaf65('0x13'));var as=require(_0xaf65('0x14'));var hardwareService=require(_0xaf65('0x15'));var logger=require('../../config/logger')(_0xaf65('0x16'));var utils=require(_0xaf65('0x17'));var config=require(_0xaf65('0x18'));var licenseUtil=require(_0xaf65('0x19'));var db=require(_0xaf65('0x1a'))['db'];function respondWithStatusCode(_0x1cdc1a,_0x321db3){_0x321db3=_0x321db3||0xcc;return function(_0x412b26){if(_0x412b26){return _0x1cdc1a[_0xaf65('0x1b')](_0x321db3);}return _0x1cdc1a[_0xaf65('0x1c')](_0x321db3)[_0xaf65('0x1d')]();};}function respondWithResult(_0x2e6729,_0xb4aef1){_0xb4aef1=_0xb4aef1||0xc8;return function(_0x400dde){if(_0x400dde){return _0x2e6729[_0xaf65('0x1c')](_0xb4aef1)[_0xaf65('0x1e')](_0x400dde);}};}function respondWithFilteredResult(_0x95518f,_0x258897){return function(_0x56973f){if(_0x56973f){var _0x5592b9=_0x56973f[_0xaf65('0x1f')],_0x57f9bf=_0x258897[_0xaf65('0x20')],_0x4a7405=_0x258897[_0xaf65('0x20')]+_0x258897[_0xaf65('0x21')],_0x5593d0;if(_0x4a7405>=_0x5592b9){_0x4a7405=_0x5592b9;_0x5593d0=0xc8;}else{_0x5593d0=0xce;}_0x95518f[_0xaf65('0x1c')](_0x5593d0);return _0x95518f[_0xaf65('0x22')](_0xaf65('0x23'),_0x57f9bf+'-'+_0x4a7405+'/'+_0x5592b9)[_0xaf65('0x1e')](_0x56973f);}return null;};}function patchUpdates(_0x235789){return function(_0x1898e7){try{jsonpatch[_0xaf65('0x24')](_0x1898e7,_0x235789,!![]);}catch(_0x317115){return BPromise['reject'](_0x317115);}return _0x1898e7['save']();};}function saveUpdates(_0x2d0d9d,_0xaa7f0b){return function(_0x1b7ea0){if(_0x1b7ea0){return _0x1b7ea0[_0xaf65('0x25')](_0x2d0d9d)[_0xaf65('0x26')](function(_0x295edd){return _0x295edd;});}return null;};}function removeEntity(_0x5b9e9c,_0x4fa75b){return function(_0x1cb231){if(_0x1cb231){return _0x1cb231[_0xaf65('0x27')]()[_0xaf65('0x26')](function(){_0x5b9e9c[_0xaf65('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x71af65,_0x469d5c){return function(_0x39c474){if(!_0x39c474){_0x71af65[_0xaf65('0x1b')](0x194);}return _0x39c474;};}function handleError(_0x2462df,_0xd718ac){_0xd718ac=_0xd718ac||0x1f4;return function(_0x18c6fc){logger[_0xaf65('0x28')](_0x18c6fc[_0xaf65('0x29')]);if(_0x18c6fc[_0xaf65('0x2a')]){delete _0x18c6fc[_0xaf65('0x2a')];}_0x2462df[_0xaf65('0x1c')](_0xd718ac)[_0xaf65('0x2b')](_0x18c6fc);};}exports['index']=function(_0x7bea85,_0x56b143){var _0x47f557={},_0x106ea3={},_0x4083fe={'count':0x0,'rows':[]};var _0x4c1d10=_[_0xaf65('0x2c')](db['CmHopperFinal'][_0xaf65('0x2d')],function(_0x363db5){return{'name':_0x363db5['fieldName'],'type':_0x363db5[_0xaf65('0x2e')][_0xaf65('0x2f')]};});_0x106ea3[_0xaf65('0x30')]=_['map'](_0x4c1d10,_0xaf65('0x2a'));_0x106ea3[_0xaf65('0x31')]=_['keys'](_0x7bea85[_0xaf65('0x31')]);_0x106ea3[_0xaf65('0x32')]=_['intersection'](_0x106ea3[_0xaf65('0x30')],_0x106ea3[_0xaf65('0x31')]);_0x47f557['attributes']=_[_0xaf65('0x33')](_0x106ea3['model'],qs[_0xaf65('0x34')](_0x7bea85['query'][_0xaf65('0x34')]));_0x47f557[_0xaf65('0x35')]=_0x47f557[_0xaf65('0x35')]['length']?_0x47f557['attributes']:_0x106ea3[_0xaf65('0x30')];if(!_0x7bea85[_0xaf65('0x31')][_0xaf65('0x36')]('nolimit')){_0x47f557[_0xaf65('0x21')]=qs[_0xaf65('0x21')](_0x7bea85[_0xaf65('0x31')]['limit']);_0x47f557[_0xaf65('0x20')]=qs[_0xaf65('0x20')](_0x7bea85[_0xaf65('0x31')][_0xaf65('0x20')]);}_0x47f557[_0xaf65('0x37')]=qs['sort'](_0x7bea85['query'][_0xaf65('0x38')]);_0x47f557[_0xaf65('0x39')]=qs[_0xaf65('0x32')](_['pick'](_0x7bea85['query'],_0x106ea3[_0xaf65('0x32')]),_0x4c1d10);if(_0x7bea85['query']['filter']){_0x47f557[_0xaf65('0x39')]=_['merge'](_0x47f557['where'],{'$or':_[_0xaf65('0x2c')](_0x4c1d10,function(_0x93926d){if(_0x93926d['type']!=='VIRTUAL'){var _0xa85ab3={};_0xa85ab3[_0x93926d['name']]={'$like':'%'+_0x7bea85['query'][_0xaf65('0x3a')]+'%'};return _0xa85ab3;}})});}_0x47f557=_[_0xaf65('0x3b')]({},_0x47f557,_0x7bea85['options']);var _0x3e92cf={'where':_0x47f557['where']};return db['CmHopperFinal'][_0xaf65('0x1f')](_0x3e92cf)[_0xaf65('0x26')](function(_0x3e8bc6){_0x4083fe[_0xaf65('0x1f')]=_0x3e8bc6;if(_0x7bea85[_0xaf65('0x31')][_0xaf65('0x3c')]){_0x47f557['include']=[{'all':!![]}];}return db[_0xaf65('0x3d')]['findAll'](_0x47f557);})[_0xaf65('0x26')](function(_0x4d9015){_0x4083fe[_0xaf65('0x3e')]=_0x4d9015;return _0x4083fe;})['then'](respondWithFilteredResult(_0x56b143,_0x47f557))[_0xaf65('0x3f')](handleError(_0x56b143,null));};exports[_0xaf65('0x40')]=function(_0x5f390f,_0x3d3f5a){var _0xc98ae3={'raw':!![],'where':{'id':_0x5f390f['params']['id']}},_0x4e0f76={};_0x4e0f76[_0xaf65('0x30')]=_['keys'](db[_0xaf65('0x3d')]['rawAttributes']);_0x4e0f76[_0xaf65('0x31')]=_[_0xaf65('0x41')](_0x5f390f[_0xaf65('0x31')]);_0x4e0f76[_0xaf65('0x32')]=_[_0xaf65('0x33')](_0x4e0f76[_0xaf65('0x30')],_0x4e0f76[_0xaf65('0x31')]);_0xc98ae3[_0xaf65('0x35')]=_[_0xaf65('0x33')](_0x4e0f76['model'],qs['fields'](_0x5f390f[_0xaf65('0x31')]['fields']));_0xc98ae3[_0xaf65('0x35')]=_0xc98ae3[_0xaf65('0x35')][_0xaf65('0x42')]?_0xc98ae3[_0xaf65('0x35')]:_0x4e0f76[_0xaf65('0x30')];if(_0x5f390f['query'][_0xaf65('0x3c')]){_0xc98ae3['include']=[{'all':!![]}];}_0xc98ae3=_['merge']({},_0xc98ae3,_0x5f390f['options']);return db[_0xaf65('0x3d')][_0xaf65('0x43')](_0xc98ae3)[_0xaf65('0x26')](handleEntityNotFound(_0x3d3f5a,null))[_0xaf65('0x26')](respondWithResult(_0x3d3f5a,null))[_0xaf65('0x3f')](handleError(_0x3d3f5a,null));};exports[_0xaf65('0x44')]=function(_0x1da796,_0x57577b){return db[_0xaf65('0x3d')][_0xaf65('0x44')]()[_0xaf65('0x26')](respondWithResult(_0x57577b,null))[_0xaf65('0x3f')](handleError(_0x57577b,null));};exports['update']=function(_0x23635b,_0x4371f5){if(_0x23635b[_0xaf65('0x45')][_0xaf65('0x46')]){delete _0x23635b['body'][_0xaf65('0x46')];}return db[_0xaf65('0x3d')][_0xaf65('0x43')]({'where':{'uniqueid':_0x23635b[_0xaf65('0x47')]['id']}})[_0xaf65('0x26')](handleEntityNotFound(_0x4371f5,null))[_0xaf65('0x26')](saveUpdates(_0x23635b[_0xaf65('0x45')],null))[_0xaf65('0x26')](respondWithResult(_0x4371f5,null))[_0xaf65('0x3f')](handleError(_0x4371f5,null));};exports[_0xaf65('0x48')]=function(_0x156924,_0x557a93,_0x25fa94){return db['CmHopperFinal'][_0xaf65('0x49')]({'raw':![],'where':{'VoiceQueueId':_0x156924[_0xaf65('0x47')]['id']},'attributes':[[db[_0xaf65('0x4a')]['fn'](_0xaf65('0x4b'),db[_0xaf65('0x4a')]['fn']('IF',db[_0xaf65('0x4a')][_0xaf65('0x4c')](_0xaf65('0x4d')))),'noSuchContacts'],[db['sequelize']['fn'](_0xaf65('0x4b'),db[_0xaf65('0x4a')]['fn']('IF',db[_0xaf65('0x4a')][_0xaf65('0x4c')](_0xaf65('0x4e')))),_0xaf65('0x4f')],[db[_0xaf65('0x4a')]['fn'](_0xaf65('0x4b'),db['sequelize']['fn']('IF',db[_0xaf65('0x4a')]['literal'](_0xaf65('0x50')))),_0xaf65('0x51')],[db[_0xaf65('0x4a')]['fn'](_0xaf65('0x4b'),db[_0xaf65('0x4a')]['fn']('IF',db[_0xaf65('0x4a')][_0xaf65('0x4c')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db['sequelize']['fn'](_0xaf65('0x4b'),db[_0xaf65('0x4a')]['fn']('IF',db[_0xaf65('0x4a')][_0xaf65('0x4c')](_0xaf65('0x52')))),_0xaf65('0x53')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xaf65('0x4a')][_0xaf65('0x4c')](_0xaf65('0x54')))),'abandonedContacts'],[db[_0xaf65('0x4a')]['fn'](_0xaf65('0x4b'),db[_0xaf65('0x4a')]['fn']('IF',db[_0xaf65('0x4a')][_0xaf65('0x4c')](_0xaf65('0x55')))),_0xaf65('0x56')],[db[_0xaf65('0x4a')]['fn'](_0xaf65('0x4b'),db[_0xaf65('0x4a')]['fn']('IF',db['sequelize'][_0xaf65('0x4c')]('`state`\x20=\x2019,\x201,\x20null'))),_0xaf65('0x57')]]})[_0xaf65('0x26')](handleEntityNotFound(_0x557a93,null))['then'](respondWithResult(_0x557a93,null))[_0xaf65('0x3f')](handleError(_0x557a93,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x493985,_0x8e3ed0,_0xaea82e){return db[_0xaf65('0x3d')][_0xaf65('0x49')]({'raw':![],'where':{'CampaignId':_0x493985[_0xaf65('0x47')]['id']},'attributes':[[db[_0xaf65('0x4a')]['fn'](_0xaf65('0x4b'),db[_0xaf65('0x4a')]['fn']('IF',db[_0xaf65('0x4a')][_0xaf65('0x4c')](_0xaf65('0x4d')))),'noSuchContacts'],[db[_0xaf65('0x4a')]['fn'](_0xaf65('0x4b'),db[_0xaf65('0x4a')]['fn']('IF',db[_0xaf65('0x4a')]['literal'](_0xaf65('0x4e')))),_0xaf65('0x4f')],[db[_0xaf65('0x4a')]['fn'](_0xaf65('0x4b'),db[_0xaf65('0x4a')]['fn']('IF',db['sequelize'][_0xaf65('0x4c')](_0xaf65('0x50')))),_0xaf65('0x51')],[db[_0xaf65('0x4a')]['fn'](_0xaf65('0x4b'),db['sequelize']['fn']('IF',db[_0xaf65('0x4a')][_0xaf65('0x4c')](_0xaf65('0x58')))),_0xaf65('0x59')],[db[_0xaf65('0x4a')]['fn'](_0xaf65('0x4b'),db[_0xaf65('0x4a')]['fn']('IF',db[_0xaf65('0x4a')]['literal'](_0xaf65('0x52')))),_0xaf65('0x53')],[db[_0xaf65('0x4a')]['fn'](_0xaf65('0x4b'),db[_0xaf65('0x4a')]['fn']('IF',db['sequelize'][_0xaf65('0x4c')](_0xaf65('0x54')))),_0xaf65('0x5a')],[db[_0xaf65('0x4a')]['fn'](_0xaf65('0x4b'),db[_0xaf65('0x4a')]['fn']('IF',db[_0xaf65('0x4a')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0xaf65('0x4a')]['fn'](_0xaf65('0x4b'),db['sequelize']['fn']('IF',db[_0xaf65('0x4a')][_0xaf65('0x4c')](_0xaf65('0x5b')))),_0xaf65('0x57')]]})['then'](handleEntityNotFound(_0x8e3ed0,null))[_0xaf65('0x26')](respondWithResult(_0x8e3ed0,null))[_0xaf65('0x3f')](handleError(_0x8e3ed0,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x2036de,_0x2a7f11,_0x51e704){return db[_0xaf65('0x5c')]['find']({'where':{'id':_0x2036de[_0xaf65('0x47')]['id']}})[_0xaf65('0x26')](handleEntityNotFound(_0x2a7f11,null))[_0xaf65('0x26')](function(_0xd345fa){var _0x5d1b39;if(_0xd345fa){_0x5d1b39=squel[_0xaf65('0x5d')]()[_0xaf65('0x5e')](_0xaf65('0x5f'))['fromQuery'](['phone',_0xaf65('0x60'),_0xaf65('0x61'),'ListId',_0xaf65('0x62'),_0xaf65('0x63'),_0xaf65('0x64')],squel[_0xaf65('0x65')]()[_0xaf65('0x66')](_0xaf65('0x67'),'phone')['field']('NOW()',_0xaf65('0x60'))[_0xaf65('0x66')](_0xaf65('0x68'),'ContactId')['field'](_0xaf65('0x69'),'ListId')[_0xaf65('0x66')](_0xaf65('0x6a'),_0xaf65('0x62'))[_0xaf65('0x66')]('NOW()',_0xaf65('0x63'))[_0xaf65('0x66')]('NOW()',_0xaf65('0x64'))[_0xaf65('0x6b')](_0xaf65('0x6c'))['where']('VoiceQueueId\x20=\x20?',_0x2036de[_0xaf65('0x47')]['id']['toString']())[_0xaf65('0x39')](_0xaf65('0x6d'),_0x2036de['body'][_0xaf65('0x6e')][_0xaf65('0x6f')]())[_0xaf65('0x39')](_0xaf65('0x70'))[_0xaf65('0x39')](_0xaf65('0x71'),squel[_0xaf65('0x65')]()['field'](_0xaf65('0x72'))[_0xaf65('0x6b')](_0xaf65('0x5f'))['where'](_0xaf65('0x73'),_0x2036de[_0xaf65('0x47')]['id'][_0xaf65('0x6f')]()))[_0xaf65('0x39')](_0xaf65('0x71'),squel['select']()['field'](_0xaf65('0x74'))[_0xaf65('0x6b')](_0xaf65('0x6c'))[_0xaf65('0x39')]('VoiceQueueId\x20=\x20?',_0x2036de[_0xaf65('0x47')]['id'][_0xaf65('0x6f')]())[_0xaf65('0x39')](_0xaf65('0x75')))[_0xaf65('0x76')]('ContactId'))[_0xaf65('0x6f')]();return db['sequelize']['query'](_0x5d1b39);}return[];})[_0xaf65('0x26')](respondWithResult(_0x2a7f11,null))[_0xaf65('0x3f')](handleError(_0x2a7f11,null));};exports[_0xaf65('0x77')]=function(_0x5a4e7c,_0x2eba14,_0x1b3d39){return db[_0xaf65('0x78')][_0xaf65('0x43')]({'where':{'id':_0x5a4e7c['params']['id']}})[_0xaf65('0x26')](handleEntityNotFound(_0x2eba14,null))[_0xaf65('0x26')](function(_0x16e3cc){var _0x22aad1;if(_0x16e3cc){_0x22aad1=squel[_0xaf65('0x5d')]()['into'](_0xaf65('0x5f'))['fromQuery']([_0xaf65('0x72'),_0xaf65('0x60'),'ContactId',_0xaf65('0x79'),'CampaignId','createdAt',_0xaf65('0x64')],squel['select']()[_0xaf65('0x66')]('ANY_VALUE(calleridnum)','phone')[_0xaf65('0x66')](_0xaf65('0x7a'),'scheduledAt')[_0xaf65('0x66')](_0xaf65('0x68'),_0xaf65('0x61'))[_0xaf65('0x66')](_0xaf65('0x69'),'ListId')[_0xaf65('0x66')](_0xaf65('0x7b'),_0xaf65('0x7c'))[_0xaf65('0x66')](_0xaf65('0x7a'),_0xaf65('0x63'))[_0xaf65('0x66')](_0xaf65('0x7a'),_0xaf65('0x64'))[_0xaf65('0x6b')](_0xaf65('0x6c'))[_0xaf65('0x39')](_0xaf65('0x7d'),_0x5a4e7c['params']['id'][_0xaf65('0x6f')]())[_0xaf65('0x39')](_0xaf65('0x6d'),_0x5a4e7c[_0xaf65('0x45')][_0xaf65('0x6e')][_0xaf65('0x6f')]())['where'](_0xaf65('0x70'))[_0xaf65('0x39')](_0xaf65('0x71'),squel[_0xaf65('0x65')]()['field']('phone')['from'](_0xaf65('0x5f'))[_0xaf65('0x39')](_0xaf65('0x7d'),_0x5a4e7c[_0xaf65('0x47')]['id'][_0xaf65('0x6f')]()))['where'](_0xaf65('0x71'),squel['select']()[_0xaf65('0x66')](_0xaf65('0x74'))[_0xaf65('0x6b')](_0xaf65('0x6c'))[_0xaf65('0x39')]('CampaignId\x20=\x20?',_0x5a4e7c[_0xaf65('0x47')]['id']['toString']())[_0xaf65('0x39')]('state\x20=\x204'))[_0xaf65('0x76')]('ContactId'))['toString']();return db['sequelize'][_0xaf65('0x31')](_0x22aad1);}return[];})[_0xaf65('0x26')](respondWithResult(_0x2eba14,null))[_0xaf65('0x3f')](handleError(_0x2eba14,null));};exports[_0xaf65('0x7e')]=function(_0x21f33d,_0x4acd4b,_0x1ca824){return db[_0xaf65('0x7f')][_0xaf65('0x80')]({'where':{'VoiceQueueId':_0x21f33d['body']['VoiceQueueId'],'CampaignId':_0x21f33d[_0xaf65('0x45')][_0xaf65('0x7c')],'ContactId':_0x21f33d[_0xaf65('0x45')]['ContactId']}})[_0xaf65('0x26')](handleEntityNotFound(_0x4acd4b,null))['then'](function(_0x4f1c5f){if(_0x4f1c5f){return _0x4f1c5f;}return null;})[_0xaf65('0x26')](respondWithResult(_0x4acd4b,null))['catch'](handleError(_0x4acd4b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 7cb6fde..6ebdb5f 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 _0xbfa8=['CmHopperFinal','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','define'];(function(_0x5543cb,_0x1b4211){var _0x1fdefa=function(_0x5b260c){while(--_0x5b260c){_0x5543cb['push'](_0x5543cb['shift']());}};_0x1fdefa(++_0x1b4211);}(_0xbfa8,0x129));var _0x8bfa=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xbfa8[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x8bfa('0x0'));var util=require(_0x8bfa('0x1'));var logger=require(_0x8bfa('0x2'))(_0x8bfa('0x3'));var moment=require(_0x8bfa('0x4'));var BPromise=require('bluebird');var rp=require(_0x8bfa('0x5'));var fs=require('fs');var path=require(_0x8bfa('0x6'));var rimraf=require(_0x8bfa('0x7'));var config=require(_0x8bfa('0x8'));var attributes=require(_0x8bfa('0x9'));module['exports']=function(_0x5d6338,_0x3cc3d4){return _0x5d6338[_0x8bfa('0xa')](_0x8bfa('0xb'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x8bfa('0xc'),'fields':[_0x8bfa('0xc')]},{'name':_0x8bfa('0xd'),'fields':[_0x8bfa('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2782=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','calleridnum','uniqueid','lodash','util'];(function(_0x251b2f,_0x1d8eb7){var _0xffe34c=function(_0x387c72){while(--_0x387c72){_0x251b2f['push'](_0x251b2f['shift']());}};_0xffe34c(++_0x1d8eb7);}(_0x2782,0xee));var _0x2278=function(_0x695b76,_0x551526){_0x695b76=_0x695b76-0x0;var _0x1dc21f=_0x2782[_0x695b76];return _0x1dc21f;};'use strict';var _=require(_0x2278('0x0'));var util=require(_0x2278('0x1'));var logger=require(_0x2278('0x2'))(_0x2278('0x3'));var moment=require('moment');var BPromise=require(_0x2278('0x4'));var rp=require(_0x2278('0x5'));var fs=require('fs');var path=require(_0x2278('0x6'));var rimraf=require(_0x2278('0x7'));var config=require(_0x2278('0x8'));var attributes=require(_0x2278('0x9'));module[_0x2278('0xa')]=function(_0x349013,_0x400796){return _0x349013[_0x2278('0xb')](_0x2278('0xc'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x2278('0xd'),'fields':[_0x2278('0xd')]},{'name':_0x2278('0xe'),'fields':[_0x2278('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 1ad1a71..2620926 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 _0x020d=['CmHopperFinal','create','body','options','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateCmHopperFinal'];(function(_0x241072,_0x531c89){var _0x26e770=function(_0x3c6b6b){while(--_0x3c6b6b){_0x241072['push'](_0x241072['shift']());}};_0x26e770(++_0x531c89);}(_0x020d,0x79));var _0xd020=function(_0x3d2dbc,_0x376327){_0x3d2dbc=_0x3d2dbc-0x0;var _0x56f043=_0x020d[_0x3d2dbc];return _0x56f043;};'use strict';var _=require(_0xd020('0x0'));var util=require('util');var moment=require(_0xd020('0x1'));var BPromise=require(_0xd020('0x2'));var rs=require(_0xd020('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd020('0x4'))['db'];var utils=require(_0xd020('0x5'));var logger=require(_0xd020('0x6'))(_0xd020('0x7'));var config=require(_0xd020('0x8'));var jayson=require(_0xd020('0x9'));var client=jayson[_0xd020('0xa')][_0xd020('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x567bc2,_0x4a91f2,_0x1ba933){return new BPromise(function(_0x1e7157,_0x3071b7){return client['request'](_0x567bc2,_0x1ba933)[_0xd020('0xc')](function(_0x539fb3){logger[_0xd020('0xd')](_0xd020('0xe'),_0x4a91f2,_0xd020('0xf'));logger[_0xd020('0x10')](_0xd020('0x11'),_0x4a91f2,_0xd020('0xf'),JSON[_0xd020('0x12')](_0x539fb3));if(_0x539fb3[_0xd020('0x13')]){if(_0x539fb3[_0xd020('0x13')]['code']===0x1f4){logger[_0xd020('0x13')](_0xd020('0xe'),_0x4a91f2,_0x539fb3[_0xd020('0x13')][_0xd020('0x14')]);return _0x3071b7(_0x539fb3[_0xd020('0x13')]['message']);}logger[_0xd020('0x13')](_0xd020('0xe'),_0x4a91f2,_0x539fb3['error'][_0xd020('0x14')]);return _0x1e7157(_0x539fb3[_0xd020('0x13')][_0xd020('0x14')]);}else{logger[_0xd020('0xd')](_0xd020('0xe'),_0x4a91f2,_0xd020('0xf'));_0x1e7157(_0x539fb3[_0xd020('0x15')][_0xd020('0x14')]);}})[_0xd020('0x16')](function(_0x3917d2){logger[_0xd020('0x13')](_0xd020('0xe'),_0x4a91f2,_0x3917d2);_0x3071b7(_0x3917d2);});});}exports[_0xd020('0x17')]=function(_0x482544){var _0x5102f7=this;return new Promise(function(_0x3ffb43,_0x2d0111){return db[_0xd020('0x18')][_0xd020('0x19')](_0x482544[_0xd020('0x1a')],{'raw':_0x482544[_0xd020('0x1b')]?_0x482544['options'][_0xd020('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4549e3){logger[_0xd020('0xd')](_0xd020('0x17'),_0x482544);logger['debug'](_0xd020('0x17'),_0x482544,JSON[_0xd020('0x12')](_0x4549e3));_0x3ffb43(_0x4549e3);})['catch'](function(_0x2874ff){logger['error'](_0xd020('0x17'),_0x2874ff[_0xd020('0x14')],_0x482544);_0x2d0111(_0x5102f7[_0xd020('0x13')](0x1f4,_0x2874ff['message']));});});}; \ No newline at end of file +var _0x85f5=['error','code','message','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','raw','stringify','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s'];(function(_0xe9b70f,_0x5cd0f9){var _0x57aab9=function(_0xe4ddc3){while(--_0xe4ddc3){_0xe9b70f['push'](_0xe9b70f['shift']());}};_0x57aab9(++_0x5cd0f9);}(_0x85f5,0x167));var _0x585f=function(_0x26658e,_0x1bb1a9){_0x26658e=_0x26658e-0x0;var _0x572802=_0x85f5[_0x26658e];return _0x572802;};'use strict';var _=require(_0x585f('0x0'));var util=require('util');var moment=require(_0x585f('0x1'));var BPromise=require(_0x585f('0x2'));var rs=require(_0x585f('0x3'));var fs=require('fs');var Redis=require(_0x585f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x585f('0x5'));var logger=require(_0x585f('0x6'))(_0x585f('0x7'));var config=require(_0x585f('0x8'));var jayson=require(_0x585f('0x9'));var client=jayson['client'][_0x585f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11a16f,_0x550ad5,_0x35f1ce){return new BPromise(function(_0x4b6a63,_0x48a8e4){return client[_0x585f('0xb')](_0x11a16f,_0x35f1ce)[_0x585f('0xc')](function(_0x2d602d){logger[_0x585f('0xd')](_0x585f('0xe'),_0x550ad5,_0x585f('0xf'));logger[_0x585f('0x10')](_0x585f('0x11'),_0x550ad5,'request\x20sent',JSON['stringify'](_0x2d602d));if(_0x2d602d[_0x585f('0x12')]){if(_0x2d602d['error'][_0x585f('0x13')]===0x1f4){logger[_0x585f('0x12')](_0x585f('0xe'),_0x550ad5,_0x2d602d[_0x585f('0x12')][_0x585f('0x14')]);return _0x48a8e4(_0x2d602d[_0x585f('0x12')][_0x585f('0x14')]);}logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x550ad5,_0x2d602d[_0x585f('0x12')]['message']);return _0x4b6a63(_0x2d602d[_0x585f('0x12')][_0x585f('0x14')]);}else{logger[_0x585f('0xd')](_0x585f('0xe'),_0x550ad5,_0x585f('0xf'));_0x4b6a63(_0x2d602d['result'][_0x585f('0x14')]);}})[_0x585f('0x15')](function(_0x3686a4){logger[_0x585f('0x12')]('CmHopperFinal,\x20%s,\x20%s',_0x550ad5,_0x3686a4);_0x48a8e4(_0x3686a4);});});}exports[_0x585f('0x16')]=function(_0x72f935){var _0x771416=this;return new Promise(function(_0x9fef18,_0x1e8824){return db[_0x585f('0x17')][_0x585f('0x18')](_0x72f935[_0x585f('0x19')],{'raw':_0x72f935[_0x585f('0x1a')]?_0x72f935[_0x585f('0x1a')][_0x585f('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x466b46){logger['info'](_0x585f('0x16'),_0x72f935);logger[_0x585f('0x10')]('CreateCmHopperFinal',_0x72f935,JSON[_0x585f('0x1c')](_0x466b46));_0x9fef18(_0x466b46);})[_0x585f('0x15')](function(_0x5477f9){logger[_0x585f('0x12')](_0x585f('0x16'),_0x5477f9['message'],_0x72f935);_0x1e8824(_0x771416['error'](0x1f4,_0x5477f9['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 2e51234..727c6b0 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 _0x845d=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','index','get','/describe','isAuthenticated','/:id','show','/voice/queue/countAttributes/:id','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports'];(function(_0x3627ad,_0x42fd76){var _0x15a65d=function(_0xfa3d7f){while(--_0xfa3d7f){_0x3627ad['push'](_0x3627ad['shift']());}};_0x15a65d(++_0x42fd76);}(_0x845d,0x1db));var _0xd845=function(_0xb64eab,_0x3a654d){_0xb64eab=_0xb64eab-0x0;var _0x526d31=_0x845d[_0xb64eab];return _0x526d31;};'use strict';var multer=require('multer');var util=require(_0xd845('0x0'));var path=require(_0xd845('0x1'));var timeout=require(_0xd845('0x2'));var express=require(_0xd845('0x3'));var router=express[_0xd845('0x4')]();var fs_extra=require(_0xd845('0x5'));var auth=require(_0xd845('0x6'));var interaction=require(_0xd845('0x7'));var config=require('../../config/environment');var controller=require(_0xd845('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xd845('0x9')]);router[_0xd845('0xa')](_0xd845('0xb'),auth[_0xd845('0xc')](),controller['describe']);router[_0xd845('0xa')](_0xd845('0xd'),auth['isAuthenticated'](),controller[_0xd845('0xe')]);router['get'](_0xd845('0xf'),auth['isAuthenticated'](),controller['countContactsQueueCampaignHopperFinal']);router[_0xd845('0xa')]('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router[_0xd845('0x10')]('/voice/queue/moveContacts/:id',auth[_0xd845('0xc')](),controller[_0xd845('0x11')]);router[_0xd845('0x10')](_0xd845('0x12'),auth[_0xd845('0xc')](),controller[_0xd845('0x13')]);router[_0xd845('0x10')](_0xd845('0x14'),auth[_0xd845('0xc')](),controller[_0xd845('0x15')]);router[_0xd845('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xd845('0x17')]);module[_0xd845('0x18')]=router; \ No newline at end of file +var _0xd106=['../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','/describe','describe','/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x2d1f7a,_0x454291){var _0x37d187=function(_0x5b4784){while(--_0x5b4784){_0x2d1f7a['push'](_0x2d1f7a['shift']());}};_0x37d187(++_0x454291);}(_0xd106,0x181));var _0x6d10=function(_0x487c58,_0x2b5552){_0x487c58=_0x487c58-0x0;var _0x23b47b=_0xd106[_0x487c58];return _0x23b47b;};'use strict';var multer=require(_0x6d10('0x0'));var util=require('util');var path=require(_0x6d10('0x1'));var timeout=require(_0x6d10('0x2'));var express=require('express');var router=express[_0x6d10('0x3')]();var fs_extra=require(_0x6d10('0x4'));var auth=require(_0x6d10('0x5'));var interaction=require(_0x6d10('0x6'));var config=require(_0x6d10('0x7'));var controller=require(_0x6d10('0x8'));router[_0x6d10('0x9')]('/',auth[_0x6d10('0xa')](),controller['index']);router[_0x6d10('0x9')](_0x6d10('0xb'),auth[_0x6d10('0xa')](),controller[_0x6d10('0xc')]);router[_0x6d10('0x9')](_0x6d10('0xd'),auth[_0x6d10('0xa')](),controller['show']);router[_0x6d10('0x9')]('/voice/queue/countAttributes/:id',auth[_0x6d10('0xa')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x6d10('0x9')]('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller[_0x6d10('0xe')]);router[_0x6d10('0xf')](_0x6d10('0x10'),auth['isAuthenticated'](),controller[_0x6d10('0x11')]);router[_0x6d10('0xf')](_0x6d10('0x12'),auth[_0x6d10('0xa')](),controller[_0x6d10('0x13')]);router[_0x6d10('0xf')](_0x6d10('0x14'),auth[_0x6d10('0xa')](),controller['checkContactHopper']);router[_0x6d10('0x15')](_0x6d10('0xd'),auth[_0x6d10('0xa')](),controller['update']);module[_0x6d10('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index f3031b6..c0229a4 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 _0x8cc0=['INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8cc0,0x121));var _0x08cc=function(_0x2c0d1e,_0x3fb368){_0x2c0d1e=_0x2c0d1e-0x0;var _0x58254d=_0x8cc0[_0x2c0d1e];return _0x58254d;};'use strict';var Sequelize=require(_0x08cc('0x0'));module['exports']={'state':{'type':Sequelize[_0x08cc('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x08cc('0x2')]},'scheduledat':{'type':Sequelize[_0x08cc('0x3')]},'countbusyretry':{'type':Sequelize[_0x08cc('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x08cc('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x08cc('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x08cc('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x08cc('0x2')]},'originatecalleridname':{'type':Sequelize[_0x08cc('0x2')]},'calleridnum':{'type':Sequelize[_0x08cc('0x2')]},'calleridname':{'type':Sequelize[_0x08cc('0x2')]},'starttime':{'type':Sequelize[_0x08cc('0x3')]},'responsetime':{'type':Sequelize[_0x08cc('0x3')]},'answertime':{'type':Sequelize[_0x08cc('0x3')]},'droptime':{'type':Sequelize[_0x08cc('0x3')]},'endtime':{'type':Sequelize[_0x08cc('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x08cc('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x08cc('0x2')]},'campaign':{'type':Sequelize[_0x08cc('0x2')]},'campaigntype':{'type':Sequelize[_0x08cc('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x08cc('0x2')]},'amd':{'type':Sequelize[_0x08cc('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x08cc('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x08cc('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x08cc('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x08cc('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x08cc('0x3')]},'edited':{'type':Sequelize[_0x08cc('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x08cc('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x08cc('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x08cc('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x08cc('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x08cc('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b7=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x1b1f04,_0xc66e12){var _0x1c0109=function(_0x3306e2){while(--_0x3306e2){_0x1b1f04['push'](_0x1b1f04['shift']());}};_0x1c0109(++_0xc66e12);}(_0xd8b7,0x97));var _0x7d8b=function(_0x6c49c6,_0x1b6f3a){_0x6c49c6=_0x6c49c6-0x0;var _0x241b46=_0xd8b7[_0x6c49c6];return _0x241b46;};'use strict';var Sequelize=require(_0x7d8b('0x0'));module[_0x7d8b('0x1')]={'state':{'type':Sequelize[_0x7d8b('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x7d8b('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x7d8b('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7d8b('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x7d8b('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x7d8b('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7d8b('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x7d8b('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x7d8b('0x4')]},'endtime':{'type':Sequelize[_0x7d8b('0x4')]},'ringtime':{'type':Sequelize[_0x7d8b('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x7d8b('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x7d8b('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x7d8b('0x3')]},'campaign':{'type':Sequelize[_0x7d8b('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x7d8b('0x3')]},'reason':{'type':Sequelize[_0x7d8b('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x7d8b('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7d8b('0x4')]},'recallme':{'type':Sequelize[_0x7d8b('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x7d8b('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x7d8b('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7d8b('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7d8b('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7d8b('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 4e5b6d6..d18baac 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 _0x020b=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','options','CmHopperHistory','then','includeAll','include','rows','show','params','rawAttributes','catch','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','error','stack','name','map','type','key','model','query'];(function(_0x568d05,_0x16d235){var _0x595b99=function(_0x4be03e){while(--_0x4be03e){_0x568d05['push'](_0x568d05['shift']());}};_0x595b99(++_0x16d235);}(_0x020b,0xee));var _0xb020=function(_0x3bd5e4,_0x1eaed3){_0x3bd5e4=_0x3bd5e4-0x0;var _0x2c5813=_0x020b[_0x3bd5e4];return _0x2c5813;};'use strict';var pdf=require(_0xb020('0x0'));var emlformat=require(_0xb020('0x1'));var rimraf=require(_0xb020('0x2'));var zipdir=require(_0xb020('0x3'));var jsonpatch=require(_0xb020('0x4'));var rp=require('request-promise');var moment=require(_0xb020('0x5'));var BPromise=require(_0xb020('0x6'));var Mustache=require(_0xb020('0x7'));var util=require(_0xb020('0x8'));var path=require(_0xb020('0x9'));var sox=require(_0xb020('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb020('0xb'));var _=require(_0xb020('0xc'));var squel=require(_0xb020('0xd'));var crypto=require(_0xb020('0xe'));var jsforce=require(_0xb020('0xf'));var deskjs=require(_0xb020('0x10'));var toCsv=require(_0xb020('0x11'));var querystring=require(_0xb020('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb020('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb020('0x14'));var hardwareService=require(_0xb020('0x15'));var logger=require('../../config/logger')(_0xb020('0x16'));var utils=require(_0xb020('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb020('0x18'))['db'];function respondWithStatusCode(_0x412597,_0x2a63db){_0x2a63db=_0x2a63db||0xcc;return function(_0x275d4a){if(_0x275d4a){return _0x412597[_0xb020('0x19')](_0x2a63db);}return _0x412597[_0xb020('0x1a')](_0x2a63db)[_0xb020('0x1b')]();};}function respondWithResult(_0x5453ab,_0x5a6587){_0x5a6587=_0x5a6587||0xc8;return function(_0x3ddbc8){if(_0x3ddbc8){return _0x5453ab[_0xb020('0x1a')](_0x5a6587)[_0xb020('0x1c')](_0x3ddbc8);}};}function respondWithFilteredResult(_0xbecc64,_0x3e7098){return function(_0x23321c){if(_0x23321c){var _0x20fdb1=_0x23321c[_0xb020('0x1d')],_0x4e0fa1=_0x3e7098[_0xb020('0x1e')],_0xd9daac=_0x3e7098[_0xb020('0x1e')]+_0x3e7098[_0xb020('0x1f')],_0x1d3576;if(_0xd9daac>=_0x20fdb1){_0xd9daac=_0x20fdb1;_0x1d3576=0xc8;}else{_0x1d3576=0xce;}_0xbecc64[_0xb020('0x1a')](_0x1d3576);return _0xbecc64[_0xb020('0x20')]('Content-Range',_0x4e0fa1+'-'+_0xd9daac+'/'+_0x20fdb1)['json'](_0x23321c);}return null;};}function patchUpdates(_0x4d11fd){return function(_0x533ec9){try{jsonpatch[_0xb020('0x21')](_0x533ec9,_0x4d11fd,!![]);}catch(_0x3dec31){return BPromise[_0xb020('0x22')](_0x3dec31);}return _0x533ec9[_0xb020('0x23')]();};}function saveUpdates(_0xa22357,_0xed9160){return function(_0x1c4c8a){if(_0x1c4c8a){return _0x1c4c8a[_0xb020('0x24')](_0xa22357)['then'](function(_0x44911f){return _0x44911f;});}return null;};}function removeEntity(_0x19259f,_0x491378){return function(_0x26472f){if(_0x26472f){return _0x26472f[_0xb020('0x25')]()['then'](function(){_0x19259f[_0xb020('0x1a')](0xcc)[_0xb020('0x1b')]();});}};}function handleEntityNotFound(_0x440d0e,_0x57e263){return function(_0x5d4de7){if(!_0x5d4de7){_0x440d0e['sendStatus'](0x194);}return _0x5d4de7;};}function handleError(_0x50d639,_0x31d6c8){_0x31d6c8=_0x31d6c8||0x1f4;return function(_0x58ee58){logger[_0xb020('0x26')](_0x58ee58[_0xb020('0x27')]);if(_0x58ee58['name']){delete _0x58ee58[_0xb020('0x28')];}_0x50d639[_0xb020('0x1a')](_0x31d6c8)['send'](_0x58ee58);};}exports['index']=function(_0x27cd28,_0x392149){var _0x3c9563={},_0x2a4104={},_0x3fa546={'count':0x0,'rows':[]};var _0x4755d8=_[_0xb020('0x29')](db['CmHopperHistory']['rawAttributes'],function(_0xc0d7a0){return{'name':_0xc0d7a0['fieldName'],'type':_0xc0d7a0[_0xb020('0x2a')][_0xb020('0x2b')]};});_0x2a4104[_0xb020('0x2c')]=_[_0xb020('0x29')](_0x4755d8,_0xb020('0x28'));_0x2a4104[_0xb020('0x2d')]=_[_0xb020('0x2e')](_0x27cd28['query']);_0x2a4104[_0xb020('0x2f')]=_[_0xb020('0x30')](_0x2a4104['model'],_0x2a4104[_0xb020('0x2d')]);_0x3c9563[_0xb020('0x31')]=_['intersection'](_0x2a4104[_0xb020('0x2c')],qs[_0xb020('0x32')](_0x27cd28['query']['fields']));_0x3c9563['attributes']=_0x3c9563[_0xb020('0x31')][_0xb020('0x33')]?_0x3c9563[_0xb020('0x31')]:_0x2a4104['model'];if(!_0x27cd28['query'][_0xb020('0x34')](_0xb020('0x35'))){_0x3c9563[_0xb020('0x1f')]=qs['limit'](_0x27cd28[_0xb020('0x2d')][_0xb020('0x1f')]);_0x3c9563['offset']=qs[_0xb020('0x1e')](_0x27cd28[_0xb020('0x2d')][_0xb020('0x1e')]);}_0x3c9563['order']=qs['sort'](_0x27cd28[_0xb020('0x2d')][_0xb020('0x36')]);_0x3c9563['where']=qs[_0xb020('0x2f')](_['pick'](_0x27cd28['query'],_0x2a4104['filters']),_0x4755d8);if(_0x27cd28[_0xb020('0x2d')][_0xb020('0x37')]){_0x3c9563[_0xb020('0x38')]=_[_0xb020('0x39')](_0x3c9563[_0xb020('0x38')],{'$or':_['map'](_0x4755d8,function(_0x179743){if(_0x179743[_0xb020('0x2a')]!=='VIRTUAL'){var _0x3014a9={};_0x3014a9[_0x179743[_0xb020('0x28')]]={'$like':'%'+_0x27cd28[_0xb020('0x2d')][_0xb020('0x37')]+'%'};return _0x3014a9;}})});}_0x3c9563=_[_0xb020('0x39')]({},_0x3c9563,_0x27cd28[_0xb020('0x3a')]);var _0x44702e={'where':_0x3c9563['where']};return db[_0xb020('0x3b')]['count'](_0x44702e)[_0xb020('0x3c')](function(_0x2f690b){_0x3fa546[_0xb020('0x1d')]=_0x2f690b;if(_0x27cd28[_0xb020('0x2d')][_0xb020('0x3d')]){_0x3c9563[_0xb020('0x3e')]=[{'all':!![]}];}return db[_0xb020('0x3b')]['findAll'](_0x3c9563);})[_0xb020('0x3c')](function(_0x2ac387){_0x3fa546[_0xb020('0x3f')]=_0x2ac387;return _0x3fa546;})[_0xb020('0x3c')](respondWithFilteredResult(_0x392149,_0x3c9563))['catch'](handleError(_0x392149,null));};exports[_0xb020('0x40')]=function(_0x3f9eb3,_0x1f527f){var _0x22415a={'raw':!![],'where':{'id':_0x3f9eb3[_0xb020('0x41')]['id']}},_0x1cc618={};_0x1cc618[_0xb020('0x2c')]=_[_0xb020('0x2e')](db[_0xb020('0x3b')][_0xb020('0x42')]);_0x1cc618[_0xb020('0x2d')]=_[_0xb020('0x2e')](_0x3f9eb3[_0xb020('0x2d')]);_0x1cc618[_0xb020('0x2f')]=_[_0xb020('0x30')](_0x1cc618[_0xb020('0x2c')],_0x1cc618[_0xb020('0x2d')]);_0x22415a[_0xb020('0x31')]=_['intersection'](_0x1cc618[_0xb020('0x2c')],qs[_0xb020('0x32')](_0x3f9eb3[_0xb020('0x2d')][_0xb020('0x32')]));_0x22415a['attributes']=_0x22415a[_0xb020('0x31')]['length']?_0x22415a[_0xb020('0x31')]:_0x1cc618['model'];if(_0x3f9eb3[_0xb020('0x2d')][_0xb020('0x3d')]){_0x22415a[_0xb020('0x3e')]=[{'all':!![]}];}_0x22415a=_[_0xb020('0x39')]({},_0x22415a,_0x3f9eb3['options']);return db[_0xb020('0x3b')]['find'](_0x22415a)[_0xb020('0x3c')](handleEntityNotFound(_0x1f527f,null))[_0xb020('0x3c')](respondWithResult(_0x1f527f,null))[_0xb020('0x43')](handleError(_0x1f527f,null));};exports[_0xb020('0x44')]=function(_0x4ed962,_0x550bda){return db[_0xb020('0x3b')][_0xb020('0x44')](_0x4ed962[_0xb020('0x45')],{})[_0xb020('0x3c')](respondWithResult(_0x550bda,0xc9))[_0xb020('0x43')](handleError(_0x550bda,null));};exports['describe']=function(_0x407f16,_0x1626cb){return db[_0xb020('0x3b')]['describe']()[_0xb020('0x3c')](respondWithResult(_0x1626cb,null))[_0xb020('0x43')](handleError(_0x1626cb,null));};exports[_0xb020('0x24')]=function(_0x515439,_0x4de3d5){if(_0x515439['body']['uniqueid']){delete _0x515439['body']['uniqueid'];}return db[_0xb020('0x3b')][_0xb020('0x46')]({'where':{'uniqueid':_0x515439[_0xb020('0x41')]['id']}})['then'](handleEntityNotFound(_0x4de3d5,null))['then'](saveUpdates(_0x515439[_0xb020('0x45')],null))[_0xb020('0x3c')](respondWithResult(_0x4de3d5,null))[_0xb020('0x43')](handleError(_0x4de3d5,null));}; \ No newline at end of file +var _0x4165=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','send','index','map','CmHopperHistory','fieldName','key','name','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','length','includeAll','find','create','update','body','uniqueid','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis'];(function(_0x3aa106,_0x33e4f0){var _0x47561d=function(_0x23278c){while(--_0x23278c){_0x3aa106['push'](_0x3aa106['shift']());}};_0x47561d(++_0x33e4f0);}(_0x4165,0x16e));var _0x5416=function(_0x3be874,_0x580bc2){_0x3be874=_0x3be874-0x0;var _0x40772a=_0x4165[_0x3be874];return _0x40772a;};'use strict';var pdf=require(_0x5416('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5416('0x1'));var zipdir=require(_0x5416('0x2'));var jsonpatch=require(_0x5416('0x3'));var rp=require(_0x5416('0x4'));var moment=require(_0x5416('0x5'));var BPromise=require(_0x5416('0x6'));var Mustache=require(_0x5416('0x7'));var util=require(_0x5416('0x8'));var path=require(_0x5416('0x9'));var sox=require(_0x5416('0xa'));var csv=require(_0x5416('0xb'));var ejs=require(_0x5416('0xc'));var fs=require('fs');var fs_extra=require(_0x5416('0xd'));var _=require('lodash');var squel=require(_0x5416('0xe'));var crypto=require(_0x5416('0xf'));var jsforce=require(_0x5416('0x10'));var deskjs=require(_0x5416('0x11'));var toCsv=require(_0x5416('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5416('0x12'));var authService=require(_0x5416('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5416('0x14'));var hardwareService=require(_0x5416('0x15'));var logger=require('../../config/logger')(_0x5416('0x16'));var utils=require(_0x5416('0x17'));var config=require(_0x5416('0x18'));var licenseUtil=require(_0x5416('0x19'));var db=require(_0x5416('0x1a'))['db'];function respondWithStatusCode(_0x5b469f,_0x46f4c2){_0x46f4c2=_0x46f4c2||0xcc;return function(_0x212128){if(_0x212128){return _0x5b469f[_0x5416('0x1b')](_0x46f4c2);}return _0x5b469f['status'](_0x46f4c2)['end']();};}function respondWithResult(_0x10c995,_0x551ee5){_0x551ee5=_0x551ee5||0xc8;return function(_0x34cf8e){if(_0x34cf8e){return _0x10c995[_0x5416('0x1c')](_0x551ee5)[_0x5416('0x1d')](_0x34cf8e);}};}function respondWithFilteredResult(_0x46aae0,_0x40b99a){return function(_0x3f4c0f){if(_0x3f4c0f){var _0x56bd18=_0x3f4c0f[_0x5416('0x1e')],_0x2f866b=_0x40b99a[_0x5416('0x1f')],_0x419a7d=_0x40b99a[_0x5416('0x1f')]+_0x40b99a[_0x5416('0x20')],_0x212040;if(_0x419a7d>=_0x56bd18){_0x419a7d=_0x56bd18;_0x212040=0xc8;}else{_0x212040=0xce;}_0x46aae0[_0x5416('0x1c')](_0x212040);return _0x46aae0[_0x5416('0x21')](_0x5416('0x22'),_0x2f866b+'-'+_0x419a7d+'/'+_0x56bd18)[_0x5416('0x1d')](_0x3f4c0f);}return null;};}function patchUpdates(_0x2b9c97){return function(_0x2a465){try{jsonpatch[_0x5416('0x23')](_0x2a465,_0x2b9c97,!![]);}catch(_0x33fcea){return BPromise[_0x5416('0x24')](_0x33fcea);}return _0x2a465[_0x5416('0x25')]();};}function saveUpdates(_0x2fcf0c,_0x3015eb){return function(_0x7d1626){if(_0x7d1626){return _0x7d1626['update'](_0x2fcf0c)[_0x5416('0x26')](function(_0x530d6f){return _0x530d6f;});}return null;};}function removeEntity(_0x4de5a8,_0xa1678b){return function(_0x53f384){if(_0x53f384){return _0x53f384[_0x5416('0x27')]()[_0x5416('0x26')](function(){_0x4de5a8[_0x5416('0x1c')](0xcc)[_0x5416('0x28')]();});}};}function handleEntityNotFound(_0x419fa9,_0x1307ba){return function(_0x48fd64){if(!_0x48fd64){_0x419fa9[_0x5416('0x1b')](0x194);}return _0x48fd64;};}function handleError(_0x1cde64,_0x572c36){_0x572c36=_0x572c36||0x1f4;return function(_0x2101f9){logger['error'](_0x2101f9['stack']);if(_0x2101f9['name']){delete _0x2101f9['name'];}_0x1cde64['status'](_0x572c36)[_0x5416('0x29')](_0x2101f9);};}exports[_0x5416('0x2a')]=function(_0x2c507d,_0xe89dff){var _0x3b6ae6={},_0x3d2b8e={},_0xe7f592={'count':0x0,'rows':[]};var _0x27b6f0=_[_0x5416('0x2b')](db[_0x5416('0x2c')]['rawAttributes'],function(_0x502d3d){return{'name':_0x502d3d[_0x5416('0x2d')],'type':_0x502d3d['type'][_0x5416('0x2e')]};});_0x3d2b8e['model']=_[_0x5416('0x2b')](_0x27b6f0,_0x5416('0x2f'));_0x3d2b8e[_0x5416('0x30')]=_[_0x5416('0x31')](_0x2c507d[_0x5416('0x30')]);_0x3d2b8e[_0x5416('0x32')]=_[_0x5416('0x33')](_0x3d2b8e[_0x5416('0x34')],_0x3d2b8e['query']);_0x3b6ae6[_0x5416('0x35')]=_[_0x5416('0x33')](_0x3d2b8e[_0x5416('0x34')],qs[_0x5416('0x36')](_0x2c507d['query']['fields']));_0x3b6ae6['attributes']=_0x3b6ae6[_0x5416('0x35')]['length']?_0x3b6ae6[_0x5416('0x35')]:_0x3d2b8e[_0x5416('0x34')];if(!_0x2c507d[_0x5416('0x30')]['hasOwnProperty'](_0x5416('0x37'))){_0x3b6ae6[_0x5416('0x20')]=qs[_0x5416('0x20')](_0x2c507d['query'][_0x5416('0x20')]);_0x3b6ae6[_0x5416('0x1f')]=qs[_0x5416('0x1f')](_0x2c507d[_0x5416('0x30')][_0x5416('0x1f')]);}_0x3b6ae6[_0x5416('0x38')]=qs[_0x5416('0x39')](_0x2c507d['query']['sort']);_0x3b6ae6[_0x5416('0x3a')]=qs[_0x5416('0x32')](_['pick'](_0x2c507d['query'],_0x3d2b8e[_0x5416('0x32')]),_0x27b6f0);if(_0x2c507d[_0x5416('0x30')][_0x5416('0x3b')]){_0x3b6ae6[_0x5416('0x3a')]=_[_0x5416('0x3c')](_0x3b6ae6[_0x5416('0x3a')],{'$or':_[_0x5416('0x2b')](_0x27b6f0,function(_0x2d4075){if(_0x2d4075[_0x5416('0x3d')]!==_0x5416('0x3e')){var _0x331b7f={};_0x331b7f[_0x2d4075[_0x5416('0x2f')]]={'$like':'%'+_0x2c507d[_0x5416('0x30')][_0x5416('0x3b')]+'%'};return _0x331b7f;}})});}_0x3b6ae6=_[_0x5416('0x3c')]({},_0x3b6ae6,_0x2c507d[_0x5416('0x3f')]);var _0x18e4d0={'where':_0x3b6ae6[_0x5416('0x3a')]};return db[_0x5416('0x2c')]['count'](_0x18e4d0)[_0x5416('0x26')](function(_0xf7fae6){_0xe7f592[_0x5416('0x1e')]=_0xf7fae6;if(_0x2c507d['query']['includeAll']){_0x3b6ae6[_0x5416('0x40')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x5416('0x41')](_0x3b6ae6);})[_0x5416('0x26')](function(_0x49644d){_0xe7f592[_0x5416('0x42')]=_0x49644d;return _0xe7f592;})['then'](respondWithFilteredResult(_0xe89dff,_0x3b6ae6))[_0x5416('0x43')](handleError(_0xe89dff,null));};exports[_0x5416('0x44')]=function(_0x1740c5,_0x4e71d4){var _0x14d6cf={'raw':!![],'where':{'id':_0x1740c5['params']['id']}},_0x1b99aa={};_0x1b99aa[_0x5416('0x34')]=_[_0x5416('0x31')](db[_0x5416('0x2c')]['rawAttributes']);_0x1b99aa[_0x5416('0x30')]=_[_0x5416('0x31')](_0x1740c5['query']);_0x1b99aa[_0x5416('0x32')]=_[_0x5416('0x33')](_0x1b99aa[_0x5416('0x34')],_0x1b99aa[_0x5416('0x30')]);_0x14d6cf[_0x5416('0x35')]=_['intersection'](_0x1b99aa[_0x5416('0x34')],qs[_0x5416('0x36')](_0x1740c5[_0x5416('0x30')][_0x5416('0x36')]));_0x14d6cf[_0x5416('0x35')]=_0x14d6cf[_0x5416('0x35')][_0x5416('0x45')]?_0x14d6cf[_0x5416('0x35')]:_0x1b99aa['model'];if(_0x1740c5[_0x5416('0x30')][_0x5416('0x46')]){_0x14d6cf['include']=[{'all':!![]}];}_0x14d6cf=_[_0x5416('0x3c')]({},_0x14d6cf,_0x1740c5[_0x5416('0x3f')]);return db[_0x5416('0x2c')][_0x5416('0x47')](_0x14d6cf)['then'](handleEntityNotFound(_0x4e71d4,null))[_0x5416('0x26')](respondWithResult(_0x4e71d4,null))[_0x5416('0x43')](handleError(_0x4e71d4,null));};exports[_0x5416('0x48')]=function(_0x447600,_0x39cf50){return db[_0x5416('0x2c')][_0x5416('0x48')](_0x447600['body'],{})['then'](respondWithResult(_0x39cf50,0xc9))[_0x5416('0x43')](handleError(_0x39cf50,null));};exports['describe']=function(_0xba5633,_0x2021f2){return db[_0x5416('0x2c')]['describe']()[_0x5416('0x26')](respondWithResult(_0x2021f2,null))['catch'](handleError(_0x2021f2,null));};exports[_0x5416('0x49')]=function(_0x564d3b,_0xc2755){if(_0x564d3b[_0x5416('0x4a')][_0x5416('0x4b')]){delete _0x564d3b['body'][_0x5416('0x4b')];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x564d3b[_0x5416('0x4c')]['id']}})[_0x5416('0x26')](handleEntityNotFound(_0xc2755,null))[_0x5416('0x26')](saveUpdates(_0x564d3b[_0x5416('0x4a')],null))[_0x5416('0x26')](respondWithResult(_0xc2755,null))['catch'](handleError(_0xc2755,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 862d902..449c2e6 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 _0x6516=['cm_hopper_history','endtime','util','api','moment','bluebird','path','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory'];(function(_0x5aad9c,_0x30646e){var _0x434cce=function(_0x3b8b4b){while(--_0x3b8b4b){_0x5aad9c['push'](_0x5aad9c['shift']());}};_0x434cce(++_0x30646e);}(_0x6516,0x1c5));var _0x6651=function(_0x308b4e,_0xee583f){_0x308b4e=_0x308b4e-0x0;var _0x53b412=_0x6516[_0x308b4e];return _0x53b412;};'use strict';var _=require('lodash');var util=require(_0x6651('0x0'));var logger=require('../../config/logger')(_0x6651('0x1'));var moment=require(_0x6651('0x2'));var BPromise=require(_0x6651('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6651('0x4'));var rimraf=require('rimraf');var config=require(_0x6651('0x5'));var attributes=require(_0x6651('0x6'));module['exports']=function(_0x7aae1b,_0x2176a1){return _0x7aae1b[_0x6651('0x7')](_0x6651('0x8'),attributes,{'tableName':_0x6651('0x9'),'paranoid':![],'indexes':[{'name':_0x6651('0xa'),'fields':[_0x6651('0xa')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe9db=['define','endtime','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x326361,_0xdec62c){var _0x3dc681=function(_0x241199){while(--_0x241199){_0x326361['push'](_0x326361['shift']());}};_0x3dc681(++_0xdec62c);}(_0xe9db,0x1f1));var _0xbe9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9db[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbe9d('0x0'));var util=require(_0xbe9d('0x1'));var logger=require(_0xbe9d('0x2'))(_0xbe9d('0x3'));var moment=require(_0xbe9d('0x4'));var BPromise=require(_0xbe9d('0x5'));var rp=require(_0xbe9d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbe9d('0x7'));var config=require(_0xbe9d('0x8'));var attributes=require('./cmHopperHistory.attributes');module[_0xbe9d('0x9')]=function(_0x5876ba,_0x3ac87c){return _0x5876ba[_0xbe9d('0xa')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xbe9d('0xb'),'fields':[_0xbe9d('0xb')]},{'name':_0xbe9d('0xc'),'fields':[_0xbe9d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index b8bfd85..7ff5664 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 _0xb747=['campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','stringify','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','raw'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xb747,0x16f));var _0x7b74=function(_0x18162d,_0x4efb88){_0x18162d=_0x18162d-0x0;var _0x480dbe=_0xb747[_0x18162d];return _0x480dbe;};'use strict';var _=require(_0x7b74('0x0'));var util=require(_0x7b74('0x1'));var moment=require('moment');var BPromise=require(_0x7b74('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b74('0x3'));var db=require(_0x7b74('0x4'))['db'];var utils=require(_0x7b74('0x5'));var logger=require(_0x7b74('0x6'))(_0x7b74('0x7'));var config=require(_0x7b74('0x8'));var jayson=require(_0x7b74('0x9'));var client=jayson['client'][_0x7b74('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ede68,_0x522f3c,_0x494ae2){return new BPromise(function(_0x5b1053,_0x363858){return client[_0x7b74('0xb')](_0x3ede68,_0x494ae2)[_0x7b74('0xc')](function(_0x471f72){logger[_0x7b74('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x522f3c,_0x7b74('0xe'));logger[_0x7b74('0xf')](_0x7b74('0x10'),_0x522f3c,_0x7b74('0xe'),JSON['stringify'](_0x471f72));if(_0x471f72[_0x7b74('0x11')]){if(_0x471f72[_0x7b74('0x11')][_0x7b74('0x12')]===0x1f4){logger[_0x7b74('0x11')](_0x7b74('0x13'),_0x522f3c,_0x471f72[_0x7b74('0x11')]['message']);return _0x363858(_0x471f72[_0x7b74('0x11')]['message']);}logger['error'](_0x7b74('0x13'),_0x522f3c,_0x471f72[_0x7b74('0x11')][_0x7b74('0x14')]);return _0x5b1053(_0x471f72[_0x7b74('0x11')][_0x7b74('0x14')]);}else{logger[_0x7b74('0xd')](_0x7b74('0x13'),_0x522f3c,_0x7b74('0xe'));_0x5b1053(_0x471f72[_0x7b74('0x15')]['message']);}})[_0x7b74('0x16')](function(_0x455ebd){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x522f3c,_0x455ebd);_0x363858(_0x455ebd);});});}exports[_0x7b74('0x17')]=function(_0x512bd2){var _0x15cd31=this;return new Promise(function(_0x289f7b,_0x260c5e){return db[_0x7b74('0x18')]['create'](_0x512bd2[_0x7b74('0x19')],{'raw':_0x512bd2[_0x7b74('0x1a')]?_0x512bd2[_0x7b74('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x7b74('0xc')](function(_0x35c6de){logger[_0x7b74('0xd')](_0x7b74('0x17'),_0x512bd2);logger[_0x7b74('0xf')](_0x7b74('0x17'),_0x512bd2,JSON[_0x7b74('0x1b')](_0x35c6de));_0x289f7b(_0x35c6de);})[_0x7b74('0x16')](function(_0x5870d8){logger[_0x7b74('0x11')](_0x7b74('0x17'),_0x5870d8[_0x7b74('0x14')],_0x512bd2);_0x260c5e(_0x15cd31[_0x7b74('0x11')](0x1f4,_0x5870d8[_0x7b74('0x14')]));});});};exports[_0x7b74('0x1c')]=function(_0x266d91){var _0x506b57=this;return new Promise(function(_0x303fe1,_0x7b32e4){return db[_0x7b74('0x18')][_0x7b74('0x1d')]({'raw':_0x266d91[_0x7b74('0x1a')]?_0x266d91['options']['raw']===undefined?!![]:![]:!![],'where':_0x266d91[_0x7b74('0x1a')]?_0x266d91[_0x7b74('0x1a')][_0x7b74('0x1e')]||null:null,'attributes':[[db[_0x7b74('0x1f')]['fn'](_0x7b74('0x20'),db[_0x7b74('0x1f')][_0x7b74('0x21')]('id')),_0x7b74('0x22')],[db['sequelize']['fn'](_0x7b74('0x20'),db[_0x7b74('0x1f')]['fn']('IF',db[_0x7b74('0x1f')][_0x7b74('0x23')](_0x7b74('0x24')))),_0x7b74('0x25')],[db['sequelize']['fn'](_0x7b74('0x20'),db[_0x7b74('0x1f')]['fn']('IF',db['sequelize'][_0x7b74('0x23')](_0x7b74('0x26')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x7b74('0x1f')]['fn']('COUNT',db[_0x7b74('0x1f')]['fn']('IF',db[_0x7b74('0x1f')][_0x7b74('0x23')](_0x7b74('0x27')))),_0x7b74('0x28')],[db['sequelize']['fn']('AVG',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x7b74('0x29')))),_0x7b74('0x2a')],[db['sequelize']['fn']('AVG',db[_0x7b74('0x1f')]['fn']('IF',db[_0x7b74('0x1f')][_0x7b74('0x23')](_0x7b74('0x2b')))),_0x7b74('0x2c')]]})[_0x7b74('0xc')](function(_0x2d1387){logger[_0x7b74('0xd')]('AvgHandleTime',_0x266d91);logger[_0x7b74('0xf')](_0x7b74('0x1c'),_0x266d91,JSON[_0x7b74('0x1b')](_0x2d1387));_0x303fe1(_0x2d1387);})[_0x7b74('0x16')](function(_0x15497d){logger[_0x7b74('0x11')](_0x7b74('0x1c'),_0x15497d[_0x7b74('0x14')],_0x266d91);_0x7b32e4(_0x506b57[_0x7b74('0x11')](0x1f4,_0x15497d['message']));});});};exports[_0x7b74('0x2d')]=function(_0x2d9d21){var _0x5f4322=this;return new Promise(function(_0x42038c,_0x24ceed){return db[_0x7b74('0x18')][_0x7b74('0x1d')]({'raw':_0x2d9d21['options']?_0x2d9d21[_0x7b74('0x1a')][_0x7b74('0x2e')]===undefined?!![]:![]:!![],'where':_0x2d9d21[_0x7b74('0x1a')]?_0x2d9d21[_0x7b74('0x1a')][_0x7b74('0x1e')]||null:null,'attributes':[[_0x7b74('0x2f'),_0x7b74('0x30')],[db[_0x7b74('0x1f')]['fn'](_0x7b74('0x20'),db[_0x7b74('0x1f')]['fn']('IF',db['sequelize'][_0x7b74('0x23')](_0x7b74('0x31')))),'outboundNoSuchCallsDay'],[db[_0x7b74('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x7b74('0x1f')][_0x7b74('0x23')](_0x7b74('0x32')))),_0x7b74('0x33')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x7b74('0x24')))),_0x7b74('0x34')],[db[_0x7b74('0x1f')]['fn'](_0x7b74('0x20'),db[_0x7b74('0x1f')]['fn']('IF',db[_0x7b74('0x1f')][_0x7b74('0x23')](_0x7b74('0x35')))),_0x7b74('0x36')],[db[_0x7b74('0x1f')]['fn'](_0x7b74('0x20'),db[_0x7b74('0x1f')]['fn']('IF',db[_0x7b74('0x1f')]['literal'](_0x7b74('0x37')))),'outboundCongestionCallsDay'],[db[_0x7b74('0x1f')]['fn'](_0x7b74('0x20'),db[_0x7b74('0x1f')]['fn']('IF',db[_0x7b74('0x1f')][_0x7b74('0x23')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x7b74('0x38')],[db[_0x7b74('0x1f')]['fn']('COUNT',db[_0x7b74('0x1f')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x7b74('0x39')],[db['sequelize']['fn'](_0x7b74('0x20'),db[_0x7b74('0x1f')]['fn']('IF',db[_0x7b74('0x1f')]['literal'](_0x7b74('0x3a')))),'outboundUnknownCallsDay'],[db[_0x7b74('0x1f')]['fn'](_0x7b74('0x20'),db['sequelize']['fn']('IF',db[_0x7b74('0x1f')][_0x7b74('0x23')](_0x7b74('0x3b')))),'outboundBlacklistCallsDay'],[db[_0x7b74('0x1f')]['fn'](_0x7b74('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x7b74('0x23')](_0x7b74('0x3c')))),_0x7b74('0x3d')],[db[_0x7b74('0x1f')]['fn'](_0x7b74('0x20'),db[_0x7b74('0x1f')]['fn']('IF',db[_0x7b74('0x1f')]['literal'](_0x7b74('0x3e')))),_0x7b74('0x3f')],[db['sequelize']['fn'](_0x7b74('0x20'),db[_0x7b74('0x1f')]['fn']('IF',db[_0x7b74('0x1f')]['literal'](_0x7b74('0x40')))),_0x7b74('0x41')],[db[_0x7b74('0x1f')]['fn'](_0x7b74('0x20'),db[_0x7b74('0x1f')]['fn']('IF',db[_0x7b74('0x1f')][_0x7b74('0x23')](_0x7b74('0x42')))),_0x7b74('0x3f')],[db[_0x7b74('0x1f')]['fn']('COUNT',db[_0x7b74('0x1f')]['fn']('IF',db[_0x7b74('0x1f')]['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x7b74('0x43')]],'group':['campaign']})['then'](function(_0xe9b319){logger[_0x7b74('0xd')](_0x7b74('0x2d'),_0x2d9d21);logger['debug']('GetVoiceQueueHopperHistory',_0x2d9d21,JSON['stringify'](_0xe9b319));_0x42038c(_0xe9b319);})[_0x7b74('0x16')](function(_0x16d084){logger[_0x7b74('0x11')](_0x7b74('0x2d'),_0x16d084[_0x7b74('0x14')],_0x2d9d21);_0x24ceed(_0x5f4322[_0x7b74('0x11')](0x1f4,_0x16d084['message']));});});};exports[_0x7b74('0x44')]=function(_0x4fbc80){var _0xa7d705=this;return new Promise(function(_0x2847dd,_0x29dc1b){return db['CmHopperHistory'][_0x7b74('0x1d')]({'raw':_0x4fbc80[_0x7b74('0x1a')]?_0x4fbc80[_0x7b74('0x1a')][_0x7b74('0x2e')]===undefined?!![]:![]:!![],'where':_0x4fbc80[_0x7b74('0x1a')]?_0x4fbc80[_0x7b74('0x1a')]['where']||null:null,'attributes':[[_0x7b74('0x2f'),_0x7b74('0x30')],[db['sequelize']['fn'](_0x7b74('0x20'),db[_0x7b74('0x1f')][_0x7b74('0x21')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0x7b74('0x20'),db[_0x7b74('0x1f')]['fn']('IF',db['sequelize'][_0x7b74('0x23')](_0x7b74('0x24')))),'ivrAnswerCallsDay']],'group':['campaign']})[_0x7b74('0xc')](function(_0x44d09f){logger[_0x7b74('0xd')](_0x7b74('0x44'),_0x4fbc80);logger[_0x7b74('0xf')](_0x7b74('0x44'),_0x4fbc80,JSON[_0x7b74('0x1b')](_0x44d09f));_0x2847dd(_0x44d09f);})[_0x7b74('0x16')](function(_0x582177){logger[_0x7b74('0x11')](_0x7b74('0x44'),_0x582177[_0x7b74('0x14')],_0x4fbc80);_0x29dc1b(_0xa7d705[_0x7b74('0x11')](0x1f4,_0x582177[_0x7b74('0x14')]));});});}; \ No newline at end of file +var _0xe717=['literal','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','message','result','catch','CmHopperHistory','body','options','raw','then','info','CreateCmHopperHistory','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls'];(function(_0x49f051,_0x298ebe){var _0x5588e6=function(_0x3ff791){while(--_0x3ff791){_0x49f051['push'](_0x49f051['shift']());}};_0x5588e6(++_0x298ebe);}(_0xe717,0xf9));var _0x7e71=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe717[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7e71('0x0'));var util=require(_0x7e71('0x1'));var moment=require(_0x7e71('0x2'));var BPromise=require(_0x7e71('0x3'));var rs=require(_0x7e71('0x4'));var fs=require('fs');var Redis=require(_0x7e71('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e71('0x6'));var logger=require(_0x7e71('0x7'))(_0x7e71('0x8'));var config=require(_0x7e71('0x9'));var jayson=require(_0x7e71('0xa'));var client=jayson['client'][_0x7e71('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b2d56,_0x2e9b36,_0x4e0171){return new BPromise(function(_0x5e0a99,_0x3d3160){return client[_0x7e71('0xc')](_0x5b2d56,_0x4e0171)['then'](function(_0xddabea){logger['info'](_0x7e71('0xd'),_0x2e9b36,_0x7e71('0xe'));logger[_0x7e71('0xf')](_0x7e71('0x10'),_0x2e9b36,_0x7e71('0xe'),JSON['stringify'](_0xddabea));if(_0xddabea['error']){if(_0xddabea[_0x7e71('0x11')]['code']===0x1f4){logger[_0x7e71('0x11')](_0x7e71('0xd'),_0x2e9b36,_0xddabea[_0x7e71('0x11')]['message']);return _0x3d3160(_0xddabea[_0x7e71('0x11')][_0x7e71('0x12')]);}logger[_0x7e71('0x11')](_0x7e71('0xd'),_0x2e9b36,_0xddabea[_0x7e71('0x11')][_0x7e71('0x12')]);return _0x5e0a99(_0xddabea['error']['message']);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x2e9b36,_0x7e71('0xe'));_0x5e0a99(_0xddabea[_0x7e71('0x13')][_0x7e71('0x12')]);}})[_0x7e71('0x14')](function(_0x1fc5b6){logger[_0x7e71('0x11')](_0x7e71('0xd'),_0x2e9b36,_0x1fc5b6);_0x3d3160(_0x1fc5b6);});});}exports['CreateCmHopperHistory']=function(_0x5334f6){var _0x1ce36e=this;return new Promise(function(_0x3f3f4c,_0x214b61){return db[_0x7e71('0x15')]['create'](_0x5334f6[_0x7e71('0x16')],{'raw':_0x5334f6[_0x7e71('0x17')]?_0x5334f6[_0x7e71('0x17')][_0x7e71('0x18')]===undefined?!![]:![]:!![]})[_0x7e71('0x19')](function(_0x5d884b){logger[_0x7e71('0x1a')](_0x7e71('0x1b'),_0x5334f6);logger[_0x7e71('0xf')]('CreateCmHopperHistory',_0x5334f6,JSON['stringify'](_0x5d884b));_0x3f3f4c(_0x5d884b);})['catch'](function(_0x50ce8f){logger[_0x7e71('0x11')](_0x7e71('0x1b'),_0x50ce8f[_0x7e71('0x12')],_0x5334f6);_0x214b61(_0x1ce36e[_0x7e71('0x11')](0x1f4,_0x50ce8f['message']));});});};exports[_0x7e71('0x1c')]=function(_0x47b03c){var _0x1efb37=this;return new Promise(function(_0x561148,_0x43f944){return db['CmHopperHistory'][_0x7e71('0x1d')]({'raw':_0x47b03c[_0x7e71('0x17')]?_0x47b03c[_0x7e71('0x17')][_0x7e71('0x18')]===undefined?!![]:![]:!![],'where':_0x47b03c[_0x7e71('0x17')]?_0x47b03c['options'][_0x7e71('0x1e')]||null:null,'attributes':[[db[_0x7e71('0x1f')]['fn'](_0x7e71('0x20'),db[_0x7e71('0x1f')][_0x7e71('0x21')]('id')),_0x7e71('0x22')],[db['sequelize']['fn'](_0x7e71('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x7e71('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0x7e71('0x24')],[db[_0x7e71('0x1f')]['fn'](_0x7e71('0x20'),db[_0x7e71('0x1f')]['fn']('IF',db[_0x7e71('0x1f')][_0x7e71('0x23')]('`state`\x20=\x2010,\x201,\x20null'))),_0x7e71('0x25')],[db['sequelize']['fn'](_0x7e71('0x20'),db[_0x7e71('0x1f')]['fn']('IF',db[_0x7e71('0x1f')][_0x7e71('0x23')]('`state`\x20=\x2011,\x201,\x20null'))),_0x7e71('0x26')],[db[_0x7e71('0x1f')]['fn']('AVG',db[_0x7e71('0x1f')]['fn']('IF',db['sequelize'][_0x7e71('0x23')](_0x7e71('0x27')))),'predictiveIntervalAvgHoldtime'],[db[_0x7e71('0x1f')]['fn'](_0x7e71('0x28'),db['sequelize']['fn']('IF',db['sequelize'][_0x7e71('0x23')](_0x7e71('0x29')))),_0x7e71('0x2a')]]})[_0x7e71('0x19')](function(_0x3fd086){logger[_0x7e71('0x1a')](_0x7e71('0x1c'),_0x47b03c);logger[_0x7e71('0xf')](_0x7e71('0x1c'),_0x47b03c,JSON['stringify'](_0x3fd086));_0x561148(_0x3fd086);})[_0x7e71('0x14')](function(_0x55a519){logger[_0x7e71('0x11')](_0x7e71('0x1c'),_0x55a519[_0x7e71('0x12')],_0x47b03c);_0x43f944(_0x1efb37[_0x7e71('0x11')](0x1f4,_0x55a519[_0x7e71('0x12')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x4ef768){var _0x14fc9d=this;return new Promise(function(_0x414ab9,_0x5d2a54){return db[_0x7e71('0x15')][_0x7e71('0x1d')]({'raw':_0x4ef768[_0x7e71('0x17')]?_0x4ef768[_0x7e71('0x17')][_0x7e71('0x18')]===undefined?!![]:![]:!![],'where':_0x4ef768[_0x7e71('0x17')]?_0x4ef768[_0x7e71('0x17')][_0x7e71('0x1e')]||null:null,'attributes':[[_0x7e71('0x2b'),'name'],[db[_0x7e71('0x1f')]['fn'](_0x7e71('0x20'),db[_0x7e71('0x1f')]['fn']('IF',db[_0x7e71('0x1f')][_0x7e71('0x23')](_0x7e71('0x2c')))),_0x7e71('0x2d')],[db[_0x7e71('0x1f')]['fn'](_0x7e71('0x20'),db[_0x7e71('0x1f')]['fn']('IF',db[_0x7e71('0x1f')][_0x7e71('0x23')]('`state`\x20=\x203,\x201,\x20null'))),_0x7e71('0x2e')],[db['sequelize']['fn'](_0x7e71('0x20'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x7e71('0x2f')))),_0x7e71('0x30')],[db[_0x7e71('0x1f')]['fn'](_0x7e71('0x20'),db[_0x7e71('0x1f')]['fn']('IF',db[_0x7e71('0x1f')][_0x7e71('0x23')](_0x7e71('0x31')))),_0x7e71('0x32')],[db[_0x7e71('0x1f')]['fn']('COUNT',db[_0x7e71('0x1f')]['fn']('IF',db[_0x7e71('0x1f')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x7e71('0x33')],[db[_0x7e71('0x1f')]['fn'](_0x7e71('0x20'),db[_0x7e71('0x1f')]['fn']('IF',db[_0x7e71('0x1f')][_0x7e71('0x23')](_0x7e71('0x34')))),_0x7e71('0x35')],[db['sequelize']['fn']('COUNT',db[_0x7e71('0x1f')]['fn']('IF',db['sequelize'][_0x7e71('0x23')](_0x7e71('0x36')))),_0x7e71('0x37')],[db[_0x7e71('0x1f')]['fn'](_0x7e71('0x20'),db[_0x7e71('0x1f')]['fn']('IF',db[_0x7e71('0x1f')][_0x7e71('0x23')](_0x7e71('0x38')))),_0x7e71('0x39')],[db[_0x7e71('0x1f')]['fn'](_0x7e71('0x20'),db[_0x7e71('0x1f')]['fn']('IF',db[_0x7e71('0x1f')][_0x7e71('0x23')](_0x7e71('0x3a')))),'outboundBlacklistCallsDay'],[db[_0x7e71('0x1f')]['fn'](_0x7e71('0x20'),db[_0x7e71('0x1f')]['fn']('IF',db[_0x7e71('0x1f')][_0x7e71('0x23')]('`state`\x20=\x2014,\x201,\x20null'))),_0x7e71('0x3b')],[db[_0x7e71('0x1f')]['fn'](_0x7e71('0x20'),db['sequelize']['fn']('IF',db[_0x7e71('0x1f')][_0x7e71('0x23')]('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x7e71('0x20'),db[_0x7e71('0x1f')]['fn']('IF',db['sequelize'][_0x7e71('0x23')](_0x7e71('0x3c')))),_0x7e71('0x3d')],[db['sequelize']['fn'](_0x7e71('0x20'),db[_0x7e71('0x1f')]['fn']('IF',db[_0x7e71('0x1f')][_0x7e71('0x23')](_0x7e71('0x3e')))),'outboundRejectCallsDay'],[db[_0x7e71('0x1f')]['fn'](_0x7e71('0x20'),db['sequelize']['fn']('IF',db[_0x7e71('0x1f')]['literal'](_0x7e71('0x3f')))),_0x7e71('0x40')]],'group':[_0x7e71('0x2b')]})[_0x7e71('0x19')](function(_0x16a0b0){logger['info'](_0x7e71('0x41'),_0x4ef768);logger['debug'](_0x7e71('0x41'),_0x4ef768,JSON['stringify'](_0x16a0b0));_0x414ab9(_0x16a0b0);})[_0x7e71('0x14')](function(_0x13f109){logger[_0x7e71('0x11')](_0x7e71('0x41'),_0x13f109[_0x7e71('0x12')],_0x4ef768);_0x5d2a54(_0x14fc9d[_0x7e71('0x11')](0x1f4,_0x13f109[_0x7e71('0x12')]));});});};exports[_0x7e71('0x42')]=function(_0x3394f5){var _0x2fac9f=this;return new Promise(function(_0x42c6ad,_0x340875){return db[_0x7e71('0x15')][_0x7e71('0x1d')]({'raw':_0x3394f5['options']?_0x3394f5[_0x7e71('0x17')][_0x7e71('0x18')]===undefined?!![]:![]:!![],'where':_0x3394f5[_0x7e71('0x17')]?_0x3394f5['options'][_0x7e71('0x1e')]||null:null,'attributes':[[_0x7e71('0x2b'),_0x7e71('0x43')],[db[_0x7e71('0x1f')]['fn']('COUNT',db[_0x7e71('0x1f')][_0x7e71('0x21')]('id')),_0x7e71('0x44')],[db[_0x7e71('0x1f')]['fn'](_0x7e71('0x20'),db[_0x7e71('0x1f')]['fn']('IF',db[_0x7e71('0x1f')][_0x7e71('0x23')](_0x7e71('0x2f')))),_0x7e71('0x45')]],'group':[_0x7e71('0x2b')]})['then'](function(_0x5f3fb1){logger['info']('GetCampaignHopperHistory',_0x3394f5);logger[_0x7e71('0xf')]('GetCampaignHopperHistory',_0x3394f5,JSON[_0x7e71('0x46')](_0x5f3fb1));_0x42c6ad(_0x5f3fb1);})[_0x7e71('0x14')](function(_0x74771d){logger[_0x7e71('0x11')]('GetCampaignHopperHistory',_0x74771d[_0x7e71('0x12')],_0x3394f5);_0x340875(_0x2fac9f['error'](0x1f4,_0x74771d[_0x7e71('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 4e7b47c..e362fc4 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 _0x0f44=['exports','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','index','/describe','describe','isAuthenticated','show','post','put','/:id','update'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x0f44,0x17b));var _0x40f4=function(_0x1de01d,_0xeb122c){_0x1de01d=_0x1de01d-0x0;var _0x2865ef=_0x0f44[_0x1de01d];return _0x2865ef;};'use strict';var multer=require('multer');var util=require(_0x40f4('0x0'));var path=require(_0x40f4('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x40f4('0x2')]();var fs_extra=require(_0x40f4('0x3'));var auth=require(_0x40f4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x40f4('0x5'));var controller=require(_0x40f4('0x6'));router[_0x40f4('0x7')]('/',auth['isAuthenticated'](),controller[_0x40f4('0x8')]);router[_0x40f4('0x7')](_0x40f4('0x9'),auth['isAuthenticated'](),controller[_0x40f4('0xa')]);router['get']('/:id',auth[_0x40f4('0xb')](),controller[_0x40f4('0xc')]);router[_0x40f4('0xd')]('/',auth[_0x40f4('0xb')](),controller['create']);router[_0x40f4('0xe')](_0x40f4('0xf'),auth[_0x40f4('0xb')](),controller[_0x40f4('0x10')]);module[_0x40f4('0x11')]=router; \ No newline at end of file +var _0xaf10=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','exports','multer','path','connect-timeout','Router'];(function(_0x5083f9,_0x5b94f2){var _0x5de96e=function(_0x32c245){while(--_0x32c245){_0x5083f9['push'](_0x5083f9['shift']());}};_0x5de96e(++_0x5b94f2);}(_0xaf10,0xd8));var _0x0af1=function(_0x1cdcfd,_0x35421c){_0x1cdcfd=_0x1cdcfd-0x0;var _0x1c05dd=_0xaf10[_0x1cdcfd];return _0x1c05dd;};'use strict';var multer=require(_0x0af1('0x0'));var util=require('util');var path=require(_0x0af1('0x1'));var timeout=require(_0x0af1('0x2'));var express=require('express');var router=express[_0x0af1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0af1('0x4'));var interaction=require(_0x0af1('0x5'));var config=require(_0x0af1('0x6'));var controller=require(_0x0af1('0x7'));router['get']('/',auth[_0x0af1('0x8')](),controller[_0x0af1('0x9')]);router[_0x0af1('0xa')](_0x0af1('0xb'),auth[_0x0af1('0x8')](),controller[_0x0af1('0xc')]);router['get'](_0x0af1('0xd'),auth[_0x0af1('0x8')](),controller[_0x0af1('0xe')]);router[_0x0af1('0xf')]('/',auth['isAuthenticated'](),controller[_0x0af1('0x10')]);router[_0x0af1('0x11')](_0x0af1('0xd'),auth[_0x0af1('0x8')](),controller[_0x0af1('0x12')]);module[_0x0af1('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index dd15e88..edde96b 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 _0x0786=['name','sequelize','exports','STRING'];(function(_0xd7141,_0x1c4adf){var _0x21dee8=function(_0x1d9661){while(--_0x1d9661){_0xd7141['push'](_0xd7141['shift']());}};_0x21dee8(++_0x1c4adf);}(_0x0786,0x17d));var _0x6078=function(_0x3dff8c,_0x5bf28a){_0x3dff8c=_0x3dff8c-0x0;var _0x1199cf=_0x0786[_0x3dff8c];return _0x1199cf;};'use strict';var Sequelize=require(_0x6078('0x0'));module[_0x6078('0x1')]={'name':{'type':Sequelize[_0x6078('0x2')],'unique':_0x6078('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6078('0x2')]},'dialPrefix':{'type':Sequelize[_0x6078('0x2')]}}; \ No newline at end of file +var _0xad31=['exports','STRING','sequelize'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xad31,0x1dc));var _0x1ad3=function(_0x396d2c,_0x35123d){_0x396d2c=_0x396d2c-0x0;var _0x2864a5=_0xad31[_0x396d2c];return _0x2864a5;};'use strict';var Sequelize=require(_0x1ad3('0x0'));module[_0x1ad3('0x1')]={'name':{'type':Sequelize[_0x1ad3('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1ad3('0x2')]},'dialPrefix':{'type':Sequelize[_0x1ad3('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 845e16f..d3699f2 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 _0x99dc=['request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','update','then','Lists','UserProfileResource','destroy','error','stack','name','send','map','CmList','rawAttributes','type','model','keys','filters','intersection','query','fields','length','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','catch','params','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ListId','Disposition','findOne','hasOwnProperty','findAll','removeDispositions','ids','addContacts','tags','join','isArray','push','each','CmContact','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','download','sequelize','addCustomFields','Sequelize','TEXT','text','switch','BOOLEAN','cm_contacts','getCustomFields','findAndCountAll','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','html-pdf','eml-format','fast-json-patch'];(function(_0x577d1c,_0x924851){var _0x5a5725=function(_0x24bc3b){while(--_0x24bc3b){_0x577d1c['push'](_0x577d1c['shift']());}};_0x5a5725(++_0x924851);}(_0x99dc,0x88));var _0xc99d=function(_0x4b1665,_0xb0c095){_0x4b1665=_0x4b1665-0x0;var _0x5850c0=_0x99dc[_0x4b1665];return _0x5850c0;};'use strict';var pdf=require(_0xc99d('0x0'));var emlformat=require(_0xc99d('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc99d('0x2'));var rp=require(_0xc99d('0x3'));var moment=require(_0xc99d('0x4'));var BPromise=require(_0xc99d('0x5'));var Mustache=require(_0xc99d('0x6'));var util=require(_0xc99d('0x7'));var path=require(_0xc99d('0x8'));var sox=require('sox');var csv=require(_0xc99d('0x9'));var ejs=require(_0xc99d('0xa'));var fs=require('fs');var fs_extra=require(_0xc99d('0xb'));var _=require(_0xc99d('0xc'));var squel=require(_0xc99d('0xd'));var crypto=require(_0xc99d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc99d('0xf'));var toCsv=require(_0xc99d('0x9'));var querystring=require(_0xc99d('0x10'));var Papa=require(_0xc99d('0x11'));var Redis=require(_0xc99d('0x12'));var authService=require(_0xc99d('0x13'));var qs=require(_0xc99d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc99d('0x15'));var logger=require('../../config/logger')(_0xc99d('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc99d('0x17'));var db=require(_0xc99d('0x18'))['db'];config[_0xc99d('0x19')]=_[_0xc99d('0x1a')](config[_0xc99d('0x19')],{'host':_0xc99d('0x1b'),'port':0x18eb});var socket=require(_0xc99d('0x1c'))(new Redis(config[_0xc99d('0x19')]));require(_0xc99d('0x1d'))[_0xc99d('0x1e')](socket);function respondWithStatusCode(_0x2151bb,_0x83b032){_0x83b032=_0x83b032||0xcc;return function(_0x5ea6b0){if(_0x5ea6b0){return _0x2151bb[_0xc99d('0x1f')](_0x83b032);}return _0x2151bb[_0xc99d('0x20')](_0x83b032)[_0xc99d('0x21')]();};}function respondWithResult(_0x242b5b,_0xf2156){_0xf2156=_0xf2156||0xc8;return function(_0x24303f){if(_0x24303f){return _0x242b5b[_0xc99d('0x20')](_0xf2156)[_0xc99d('0x22')](_0x24303f);}};}function respondWithFilteredResult(_0x126355,_0xb1e777){return function(_0xb62fc7){if(_0xb62fc7){var _0x174a56=_0xb62fc7[_0xc99d('0x23')],_0x4a5459=_0xb1e777[_0xc99d('0x24')],_0x392878=_0xb1e777[_0xc99d('0x24')]+_0xb1e777[_0xc99d('0x25')],_0x151a0f;if(_0x392878>=_0x174a56){_0x392878=_0x174a56;_0x151a0f=0xc8;}else{_0x151a0f=0xce;}_0x126355[_0xc99d('0x20')](_0x151a0f);return _0x126355[_0xc99d('0x26')]('Content-Range',_0x4a5459+'-'+_0x392878+'/'+_0x174a56)['json'](_0xb62fc7);}return null;};}function patchUpdates(_0x59c401){return function(_0x119c08){try{jsonpatch[_0xc99d('0x27')](_0x119c08,_0x59c401,!![]);}catch(_0x370df0){return BPromise['reject'](_0x370df0);}return _0x119c08['save']();};}function saveUpdates(_0x425c8a,_0x6755c1){return function(_0x3c961b){if(_0x3c961b){return _0x3c961b[_0xc99d('0x28')](_0x425c8a)[_0xc99d('0x29')](function(_0x17d4a0){return _0x17d4a0;});}return null;};}function removeEntity(_0x3cb0c0,_0x501000){return function(_0x314ab6){if(_0x314ab6){return _0x314ab6['destroy']()[_0xc99d('0x29')](function(){var _0x59c9ac=_0x314ab6['get']({'plain':!![]});var _0x2321c4=_0xc99d('0x2a');return db[_0xc99d('0x2b')][_0xc99d('0x2c')]({'where':{'type':_0x2321c4,'resourceId':_0x59c9ac['id']}})[_0xc99d('0x29')](function(){return _0x314ab6;});})['then'](function(){_0x3cb0c0[_0xc99d('0x20')](0xcc)[_0xc99d('0x21')]();});}};}function handleEntityNotFound(_0x2bed02,_0x30ef97){return function(_0x930100){if(!_0x930100){_0x2bed02['sendStatus'](0x194);}return _0x930100;};}function handleError(_0x2c1d07,_0x26f3c7){_0x26f3c7=_0x26f3c7||0x1f4;return function(_0x2e02d3){logger[_0xc99d('0x2d')](_0x2e02d3[_0xc99d('0x2e')]);if(_0x2e02d3[_0xc99d('0x2f')]){delete _0x2e02d3['name'];}_0x2c1d07['status'](_0x26f3c7)[_0xc99d('0x30')](_0x2e02d3);};}exports['index']=function(_0x54f42a,_0x3c4fb9){var _0x27bbf6={},_0xa3710d={},_0x40b46c={'count':0x0,'rows':[]};var _0x4a1ab5=_[_0xc99d('0x31')](db[_0xc99d('0x32')][_0xc99d('0x33')],function(_0x258692){return{'name':_0x258692['fieldName'],'type':_0x258692[_0xc99d('0x34')]['key']};});_0xa3710d[_0xc99d('0x35')]=_[_0xc99d('0x31')](_0x4a1ab5,_0xc99d('0x2f'));_0xa3710d['query']=_[_0xc99d('0x36')](_0x54f42a['query']);_0xa3710d[_0xc99d('0x37')]=_[_0xc99d('0x38')](_0xa3710d[_0xc99d('0x35')],_0xa3710d[_0xc99d('0x39')]);_0x27bbf6['attributes']=_['intersection'](_0xa3710d[_0xc99d('0x35')],qs[_0xc99d('0x3a')](_0x54f42a[_0xc99d('0x39')][_0xc99d('0x3a')]));_0x27bbf6['attributes']=_0x27bbf6['attributes'][_0xc99d('0x3b')]?_0x27bbf6[_0xc99d('0x3c')]:_0xa3710d[_0xc99d('0x35')];if(!_0x54f42a[_0xc99d('0x39')]['hasOwnProperty'](_0xc99d('0x3d'))){_0x27bbf6[_0xc99d('0x25')]=qs[_0xc99d('0x25')](_0x54f42a[_0xc99d('0x39')][_0xc99d('0x25')]);_0x27bbf6[_0xc99d('0x24')]=qs[_0xc99d('0x24')](_0x54f42a['query']['offset']);}_0x27bbf6[_0xc99d('0x3e')]=qs['sort'](_0x54f42a[_0xc99d('0x39')][_0xc99d('0x3f')]);_0x27bbf6[_0xc99d('0x40')]=qs['filters'](_[_0xc99d('0x41')](_0x54f42a[_0xc99d('0x39')],_0xa3710d[_0xc99d('0x37')]),_0x4a1ab5);if(_0x54f42a['query']['filter']){_0x27bbf6[_0xc99d('0x40')]=_[_0xc99d('0x42')](_0x27bbf6['where'],{'$or':_[_0xc99d('0x31')](_0x4a1ab5,function(_0x46fb89){if(_0x46fb89[_0xc99d('0x34')]!==_0xc99d('0x43')){var _0x20dc7b={};_0x20dc7b[_0x46fb89[_0xc99d('0x2f')]]={'$like':'%'+_0x54f42a[_0xc99d('0x39')][_0xc99d('0x44')]+'%'};return _0x20dc7b;}})});}_0x27bbf6=_[_0xc99d('0x42')]({},_0x27bbf6,_0x54f42a[_0xc99d('0x45')]);var _0x2883c9={'where':_0x27bbf6[_0xc99d('0x40')]};return db[_0xc99d('0x32')][_0xc99d('0x23')](_0x2883c9)['then'](function(_0x22e93f){_0x40b46c['count']=_0x22e93f;if(_0x54f42a[_0xc99d('0x39')]['includeAll']){_0x27bbf6[_0xc99d('0x46')]=[{'all':!![]}];}return db[_0xc99d('0x32')]['findAll'](_0x27bbf6);})[_0xc99d('0x29')](function(_0x1e910c){_0x40b46c[_0xc99d('0x47')]=_0x1e910c;return _0x40b46c;})['then'](respondWithFilteredResult(_0x3c4fb9,_0x27bbf6))[_0xc99d('0x48')](handleError(_0x3c4fb9,null));};exports['show']=function(_0x45de26,_0x48415e){var _0x1a7253={'raw':![],'where':{'id':_0x45de26[_0xc99d('0x49')]['id']}},_0x3a5e6f={};_0x3a5e6f['model']=_['keys'](db['CmList']['rawAttributes']);_0x3a5e6f['query']=_[_0xc99d('0x36')](_0x45de26[_0xc99d('0x39')]);_0x3a5e6f[_0xc99d('0x37')]=_[_0xc99d('0x38')](_0x3a5e6f[_0xc99d('0x35')],_0x3a5e6f['query']);_0x1a7253[_0xc99d('0x3c')]=_[_0xc99d('0x38')](_0x3a5e6f[_0xc99d('0x35')],qs[_0xc99d('0x3a')](_0x45de26[_0xc99d('0x39')][_0xc99d('0x3a')]));_0x1a7253['attributes']=_0x1a7253[_0xc99d('0x3c')][_0xc99d('0x3b')]?_0x1a7253[_0xc99d('0x3c')]:_0x3a5e6f[_0xc99d('0x35')];if(_0x45de26[_0xc99d('0x39')][_0xc99d('0x4a')]){_0x1a7253['include']=[{'all':!![]}];}_0x1a7253=_[_0xc99d('0x42')]({},_0x1a7253,_0x45de26[_0xc99d('0x45')]);return db[_0xc99d('0x32')][_0xc99d('0x4b')](_0x1a7253)['then'](handleEntityNotFound(_0x48415e,null))[_0xc99d('0x29')](respondWithResult(_0x48415e,null))['catch'](handleError(_0x48415e,null));};exports[_0xc99d('0x4c')]=function(_0x13b662,_0x2e9e8c){return db[_0xc99d('0x32')][_0xc99d('0x4c')](_0x13b662['body'],{})[_0xc99d('0x29')](function(_0x1ce769){var _0x362dfa=_0x13b662[_0xc99d('0x4d')][_0xc99d('0x4e')]({'plain':!![]});if(!_0x362dfa)throw new Error(_0xc99d('0x4f'));if(_0x362dfa['role']===_0xc99d('0x4d')){var _0x4df11c=_0x1ce769[_0xc99d('0x4e')]({'plain':!![]});var _0x1cd75c='Lists';return db['UserProfileSection']['find']({'where':{'name':_0x1cd75c,'userProfileId':_0x362dfa[_0xc99d('0x50')]},'raw':!![]})['then'](function(_0x2354d1){if(_0x2354d1&&_0x2354d1['autoAssociation']===0x0){return db[_0xc99d('0x2b')]['create']({'name':_0x4df11c['name'],'resourceId':_0x4df11c['id'],'type':_0x2354d1[_0xc99d('0x2f')],'sectionId':_0x2354d1['id']},{})['then'](function(){return _0x1ce769;});}else{return _0x1ce769;}})['catch'](function(_0x2f0ebe){logger['error'](_0xc99d('0x51'),_0x2f0ebe);throw _0x2f0ebe;});}return _0x1ce769;})[_0xc99d('0x29')](respondWithResult(_0x2e9e8c,0xc9))[_0xc99d('0x48')](handleError(_0x2e9e8c,null));};exports['update']=function(_0x5742d2,_0x5a8bf9){if(_0x5742d2[_0xc99d('0x52')]['id']){delete _0x5742d2[_0xc99d('0x52')]['id'];}return db[_0xc99d('0x32')][_0xc99d('0x4b')]({'where':{'id':_0x5742d2[_0xc99d('0x49')]['id']}})[_0xc99d('0x29')](handleEntityNotFound(_0x5a8bf9,null))['then'](saveUpdates(_0x5742d2['body'],null))[_0xc99d('0x29')](respondWithResult(_0x5a8bf9,null))['catch'](handleError(_0x5a8bf9,null));};exports[_0xc99d('0x2c')]=function(_0x1c0f20,_0x32ed10){return db[_0xc99d('0x32')]['find']({'where':{'id':_0x1c0f20['params']['id']}})[_0xc99d('0x29')](handleEntityNotFound(_0x32ed10,null))[_0xc99d('0x29')](removeEntity(_0x32ed10,null))[_0xc99d('0x48')](handleError(_0x32ed10,null));};exports[_0xc99d('0x53')]=function(_0x1690b9,_0x5748a5){return db['CmList'][_0xc99d('0x53')]()[_0xc99d('0x29')](respondWithResult(_0x5748a5,null))['catch'](handleError(_0x5748a5,null));};exports[_0xc99d('0x54')]=function(_0x1be8a6,_0x27d0af,_0x23a116){if(_0x1be8a6[_0xc99d('0x52')]['id']){delete _0x1be8a6['body']['id'];}return db[_0xc99d('0x32')][_0xc99d('0x4b')]({'where':{'id':_0x1be8a6[_0xc99d('0x49')]['id']}})['then'](handleEntityNotFound(_0x27d0af,null))[_0xc99d('0x29')](function(_0x48d88d){if(_0x48d88d){_0x1be8a6[_0xc99d('0x52')][_0xc99d('0x55')]=_0x48d88d['id'];return db[_0xc99d('0x56')][_0xc99d('0x4c')](_0x1be8a6[_0xc99d('0x52')]);}})[_0xc99d('0x29')](respondWithResult(_0x27d0af,null))['catch'](handleError(_0x27d0af,null));};exports['getDispositions']=function(_0x3e715f,_0x374f62,_0x3b5036){var _0x240705={'raw':![],'where':{}};var _0xcc8054={};var _0x368ce5={'count':0x0,'rows':[]};return db[_0xc99d('0x32')][_0xc99d('0x57')]({'where':{'id':_0x3e715f[_0xc99d('0x49')]['id']}})[_0xc99d('0x29')](handleEntityNotFound(_0x374f62,null))['then'](function(_0x1a6290){if(_0x1a6290){_0xcc8054[_0xc99d('0x35')]=_[_0xc99d('0x36')](db[_0xc99d('0x56')][_0xc99d('0x33')]);_0xcc8054[_0xc99d('0x39')]=_[_0xc99d('0x36')](_0x3e715f[_0xc99d('0x39')]);_0xcc8054[_0xc99d('0x37')]=_[_0xc99d('0x38')](_0xcc8054['model'],_0xcc8054[_0xc99d('0x39')]);_0x240705[_0xc99d('0x3c')]=_[_0xc99d('0x38')](_0xcc8054[_0xc99d('0x35')],qs[_0xc99d('0x3a')](_0x3e715f[_0xc99d('0x39')][_0xc99d('0x3a')]));_0x240705[_0xc99d('0x3c')]=_0x240705[_0xc99d('0x3c')][_0xc99d('0x3b')]?_0x240705[_0xc99d('0x3c')]:_0xcc8054['model'];if(!_0x3e715f[_0xc99d('0x39')][_0xc99d('0x58')](_0xc99d('0x3d'))){_0x240705[_0xc99d('0x25')]=qs[_0xc99d('0x25')](_0x3e715f[_0xc99d('0x39')][_0xc99d('0x25')]);_0x240705['offset']=qs[_0xc99d('0x24')](_0x3e715f[_0xc99d('0x39')]['offset']);}_0x240705['order']=qs[_0xc99d('0x3f')](_0x3e715f[_0xc99d('0x39')][_0xc99d('0x3f')]);_0x240705['where']=qs[_0xc99d('0x37')](_[_0xc99d('0x41')](_0x3e715f[_0xc99d('0x39')],_0xcc8054['filters']));_0x240705[_0xc99d('0x40')][_0xc99d('0x55')]=_0x1a6290['id'];if(_0x3e715f[_0xc99d('0x39')]['filter']){_0x240705['where']=_[_0xc99d('0x42')](_0x240705[_0xc99d('0x40')],{'$or':_[_0xc99d('0x31')](_0x240705[_0xc99d('0x3c')],function(_0x30de5d){var _0x131ff4={};_0x131ff4[_0x30de5d]={'$like':'%'+_0x3e715f[_0xc99d('0x39')][_0xc99d('0x44')]+'%'};return _0x131ff4;})});}_0x240705=_[_0xc99d('0x42')]({},_0x240705,_0x3e715f[_0xc99d('0x45')]);return db[_0xc99d('0x56')][_0xc99d('0x23')]({'where':_0x240705[_0xc99d('0x40')]})[_0xc99d('0x29')](function(_0x12b8f2){_0x368ce5['count']=_0x12b8f2;if(_0x3e715f['query'][_0xc99d('0x4a')]){_0x240705[_0xc99d('0x46')]=[{'all':!![]}];}return db[_0xc99d('0x56')][_0xc99d('0x59')](_0x240705);})[_0xc99d('0x29')](function(_0x74f7d8){_0x368ce5['rows']=_0x74f7d8;return _0x368ce5;});}})[_0xc99d('0x29')](respondWithFilteredResult(_0x374f62,_0x240705))[_0xc99d('0x48')](handleError(_0x374f62,null));};exports['removeDispositions']=function(_0x23a2bd,_0x345de5,_0x36a826){return db[_0xc99d('0x32')][_0xc99d('0x4b')]({'where':{'id':_0x23a2bd[_0xc99d('0x49')]['id']}})['then'](handleEntityNotFound(_0x345de5,null))[_0xc99d('0x29')](function(_0x3b86f4){if(_0x3b86f4){return _0x3b86f4[_0xc99d('0x5a')](_0x23a2bd[_0xc99d('0x39')][_0xc99d('0x5b')]);}})[_0xc99d('0x29')](respondWithStatusCode(_0x345de5,null))[_0xc99d('0x48')](handleError(_0x345de5,null));};exports[_0xc99d('0x5c')]=function(_0x167998,_0x302873,_0x21855e){return db[_0xc99d('0x32')][_0xc99d('0x4b')]({'where':{'id':_0x167998[_0xc99d('0x49')]['id']}})['then'](handleEntityNotFound(_0x302873,null))[_0xc99d('0x29')](function(_0x29ec5e){if(_0x29ec5e){var _0x332a9c=[];var _0x164e52={'success':[],'errors':[]};return db['CmContact']['describe']()[_0xc99d('0x29')](function(_0x28ea61){if(_0x167998[_0xc99d('0x52')][_0xc99d('0x5d')]&&_['isArray'](_0x167998[_0xc99d('0x52')][_0xc99d('0x5d')])){if(_0x167998[_0xc99d('0x52')]['tags'][_0xc99d('0x3b')]){_0x167998[_0xc99d('0x52')][_0xc99d('0x5d')]=_0x167998[_0xc99d('0x52')][_0xc99d('0x5d')][_0xc99d('0x5e')](';')+';';}else{_0x167998[_0xc99d('0x52')][_0xc99d('0x5d')]=null;}}else{_0x167998[_0xc99d('0x52')][_0xc99d('0x5d')]=null;}if(_0x167998['body']&&_[_0xc99d('0x5f')](_0x167998[_0xc99d('0x52')])){for(var _0x4fb375=0x0;_0x4fb375<_0x167998[_0xc99d('0x52')][_0xc99d('0x3b')];_0x4fb375+=0x1){_0x167998['body'][_0x4fb375][_0xc99d('0x55')]=_0x167998[_0xc99d('0x49')]['id'];_0x332a9c[_0xc99d('0x60')](_0x167998[_0xc99d('0x52')][_0x4fb375]);}return BPromise[_0xc99d('0x61')](_0x332a9c,function(_0x4b8609){return db[_0xc99d('0x62')][_0xc99d('0x4c')](_[_0xc99d('0x63')](_0x4b8609,['ids','id'])||{},{'fields':_['keys'](_0x28ea61),'raw':!![]})[_0xc99d('0x29')](function(_0x3399d5){_0x164e52[_0xc99d('0x64')][_0xc99d('0x60')](_0x3399d5[_0xc99d('0x65')]);})[_0xc99d('0x48')](function(_0x27f139){_0x164e52[_0xc99d('0x66')][_0xc99d('0x60')]({'data':_0x4b8609,'error':_0x27f139[_0xc99d('0x67')]});});})[_0xc99d('0x29')](function(_0x1d3f14){return _0x164e52;})[_0xc99d('0x48')](function(_0x11dd8d){return _0x11dd8d;});}else{_0x302873[_0xc99d('0x20')](0x190)[_0xc99d('0x22')]({'message':_0xc99d('0x68')});}});}})[_0xc99d('0x29')](respondWithResult(_0x302873,null))[_0xc99d('0x48')](handleError(_0x302873,null));};exports[_0xc99d('0x69')]=function(_0x3a6182,_0x38b56d,_0x247416){var _0x1a8c97;return db[_0xc99d('0x32')]['find']({'where':{'id':_0x3a6182[_0xc99d('0x49')]['id']},'include':[{'model':db[_0xc99d('0x6a')],'as':_0xc99d('0x6b')}]})['then'](handleEntityNotFound(_0x38b56d,null))[_0xc99d('0x29')](function(_0x117853){if(_0x117853){_0x1a8c97=_0x117853;return db[_0xc99d('0x62')]['rawAttributes'];}})[_0xc99d('0x29')](function(_0x1ddc7e){if(_0x1ddc7e){var _0x5d858d={};var _0x597001={};_0x597001[_0xc99d('0x35')]=_[_0xc99d('0x6c')](_[_0xc99d('0x36')](_0x1ddc7e),_[_0xc99d('0x31')](_0x1a8c97[_0xc99d('0x6b')],function(_0xf3b5da){return util[_0xc99d('0x6d')](_0xc99d('0x6e'),_0xf3b5da['id']);}));_0x597001['query']=_[_0xc99d('0x36')](_0x3a6182[_0xc99d('0x39')]);_0x597001[_0xc99d('0x37')]=_[_0xc99d('0x38')](_0x597001[_0xc99d('0x35')],_0x597001[_0xc99d('0x39')]);_0x5d858d[_0xc99d('0x3c')]=_['intersection'](_0x597001['model'],qs[_0xc99d('0x3a')](_0x3a6182[_0xc99d('0x39')][_0xc99d('0x3a')]));_0x5d858d['attributes']=_0x5d858d[_0xc99d('0x3c')][_0xc99d('0x3b')]?_0x5d858d[_0xc99d('0x3c')]:_0x597001[_0xc99d('0x35')];if(!_0x3a6182[_0xc99d('0x39')][_0xc99d('0x58')](_0xc99d('0x3d'))){_0x5d858d[_0xc99d('0x25')]=qs['limit'](_0x3a6182[_0xc99d('0x39')][_0xc99d('0x25')]);_0x5d858d[_0xc99d('0x24')]=qs[_0xc99d('0x24')](_0x3a6182[_0xc99d('0x39')]['offset']);}_0x5d858d[_0xc99d('0x3e')]=qs[_0xc99d('0x3f')](_0x3a6182['query'][_0xc99d('0x3f')]);_0x5d858d['where']=qs[_0xc99d('0x37')](_[_0xc99d('0x41')](_0x3a6182[_0xc99d('0x39')],_0x597001[_0xc99d('0x37')]));_0x5d858d[_0xc99d('0x6f')]=!![];if(_0x3a6182[_0xc99d('0x39')][_0xc99d('0x44')]){_0x5d858d[_0xc99d('0x40')]=_[_0xc99d('0x42')](_0x5d858d['where'],{'$or':_['map'](_0x5d858d['attributes'],function(_0x3161c7){var _0xe7fcf2={};_0xe7fcf2[_0x3161c7]={'$like':'%'+_0x3a6182['query'][_0xc99d('0x44')]+'%'};return _0xe7fcf2;})});}_0x5d858d=_['merge']({},_0x5d858d,_0x3a6182['options']);return _0x1a8c97['getContacts'](_0x5d858d);}})[_0xc99d('0x29')](respondWithResult(_0x38b56d,null))[_0xc99d('0x48')](handleError(_0x38b56d,null));};exports[_0xc99d('0x70')]=function(_0x59d2f8,_0x15b6c9,_0x1c158a){var _0x92b30e;return db['CmList']['find']({'where':{'id':_0x59d2f8[_0xc99d('0x49')]['id']},'include':[{'model':db[_0xc99d('0x6a')],'as':_0xc99d('0x6b')}]})[_0xc99d('0x29')](handleEntityNotFound(_0x15b6c9,null))['then'](function(_0x8ce892){if(_0x8ce892){_0x92b30e=_0x8ce892;return db[_0xc99d('0x62')][_0xc99d('0x33')];}})[_0xc99d('0x29')](function(_0x275b12){if(_0x275b12){var _0xffbac1={};var _0x569b6b={};_0x569b6b[_0xc99d('0x35')]=_[_0xc99d('0x6c')](_['keys'](_0x275b12),_[_0xc99d('0x31')](_0x92b30e[_0xc99d('0x6b')],function(_0x50c659){return util['format'](_0xc99d('0x6e'),_0x50c659['id']);}));_0x569b6b['query']=_[_0xc99d('0x36')](_0x59d2f8[_0xc99d('0x39')]);_0x569b6b[_0xc99d('0x37')]=_[_0xc99d('0x38')](_0x569b6b[_0xc99d('0x35')],_0x569b6b[_0xc99d('0x39')]);_0xffbac1[_0xc99d('0x3c')]=_[_0xc99d('0x38')](_0x569b6b[_0xc99d('0x35')],qs[_0xc99d('0x3a')](_0x59d2f8['query']['fields']));_0xffbac1['attributes']=_0xffbac1[_0xc99d('0x3c')][_0xc99d('0x3b')]?_0xffbac1[_0xc99d('0x3c')]:_0x569b6b[_0xc99d('0x35')];if(!_0x59d2f8['query'][_0xc99d('0x58')](_0xc99d('0x3d'))){_0xffbac1[_0xc99d('0x25')]=qs['limit'](_0x59d2f8['query'][_0xc99d('0x25')]);_0xffbac1[_0xc99d('0x24')]=qs[_0xc99d('0x24')](_0x59d2f8[_0xc99d('0x39')][_0xc99d('0x24')]);}_0xffbac1['order']=qs[_0xc99d('0x3f')](_0x59d2f8['query'][_0xc99d('0x3f')]);_0xffbac1[_0xc99d('0x40')]=qs[_0xc99d('0x37')](_[_0xc99d('0x41')](_0x59d2f8[_0xc99d('0x39')],_0x569b6b[_0xc99d('0x37')]));_0xffbac1[_0xc99d('0x6f')]=!![];if(_0x59d2f8[_0xc99d('0x39')][_0xc99d('0x44')]){_0xffbac1[_0xc99d('0x40')]=_[_0xc99d('0x42')](_0xffbac1['where'],{'$or':_[_0xc99d('0x31')](_0xffbac1['attributes'],function(_0x1912b4){var _0x52e5e7={};_0x52e5e7[_0x1912b4]={'$like':'%'+_0x59d2f8[_0xc99d('0x39')][_0xc99d('0x44')]+'%'};return _0x52e5e7;})});}_0xffbac1=_[_0xc99d('0x42')]({},_0xffbac1,_0x59d2f8[_0xc99d('0x45')]);return _0x92b30e['getContacts'](_0xffbac1);}})[_0xc99d('0x29')](function(_0x4828ee){if(!_[_0xc99d('0x71')](_0x4828ee)){var _0x15e87a=toCsv(_0x4828ee);var _0x34f110=Date[_0xc99d('0x72')]();fs[_0xc99d('0x73')](util[_0xc99d('0x6d')](_0xc99d('0x74'),_0x92b30e['id'],_0x34f110),_0x15e87a);_0x15b6c9[_0xc99d('0x75')](_0xc99d('0x76'),_0xc99d('0x77')+util[_0xc99d('0x6d')](_0xc99d('0x78'),_0x92b30e['id'],_0x34f110));_0x15b6c9[_0xc99d('0x75')]('Content-type',_0xc99d('0x79'));return _0x15b6c9[_0xc99d('0x7a')](util['format'](_0xc99d('0x74'),_0x92b30e['id'],_0x34f110));}else{return _0x15b6c9['sendStatus'](0xcc);}})[_0xc99d('0x48')](handleError(_0x15b6c9,null));};exports['addCustomField']=function(_0x506561,_0x23e587,_0xd6ef48){var _0x341981;delete _0x506561['body']['id'];return db['CmList'][_0xc99d('0x57')]({'where':{'id':_0x506561[_0xc99d('0x49')]['id']}})[_0xc99d('0x29')](handleEntityNotFound(_0x23e587,null))[_0xc99d('0x29')](function(_0x3cb1f2){if(_0x3cb1f2){return db[_0xc99d('0x7b')]['transaction'](function(_0x4290f2){return db[_0xc99d('0x6a')][_0xc99d('0x4c')](_0x506561[_0xc99d('0x52')],{'transaction':_0x4290f2})[_0xc99d('0x29')](function(_0x2ed90f){_0x341981=_0x2ed90f;return _0x3cb1f2[_0xc99d('0x7c')](_0x2ed90f,{'transaction':_0x4290f2});})[_0xc99d('0x29')](function(){var _0x18bd47={'type':db[_0xc99d('0x7d')][_0xc99d('0x7e')],'transaction':_0x4290f2};switch(_0x506561['body']['type']){case _0xc99d('0x7f'):_0x18bd47[_0xc99d('0x34')]=db[_0xc99d('0x7d')][_0xc99d('0x7e')];break;case'number':_0x18bd47[_0xc99d('0x34')]=db[_0xc99d('0x7d')]['INTEGER'];break;case _0xc99d('0x80'):_0x18bd47[_0xc99d('0x34')]=db[_0xc99d('0x7d')][_0xc99d('0x81')];_0x18bd47['defaultValue']=![];break;default:}return db[_0xc99d('0x7b')]['queryInterface']['addColumn'](_0xc99d('0x82'),util['format']('cf_%s',_0x341981['id']),_0x18bd47);})[_0xc99d('0x29')](function(){return _0x341981;});});}})[_0xc99d('0x29')](respondWithResult(_0x23e587,null))[_0xc99d('0x48')](handleError(_0x23e587,null));};exports[_0xc99d('0x83')]=function(_0x27227b,_0x2bcbdf,_0x218c9b){var _0x26651f={};var _0x26735d={};var _0x42890e;var _0x2145fc;return db[_0xc99d('0x32')][_0xc99d('0x57')]({'where':{'id':_0x27227b[_0xc99d('0x49')]['id']}})[_0xc99d('0x29')](handleEntityNotFound(_0x2bcbdf,null))[_0xc99d('0x29')](function(_0x1e3cb3){if(_0x1e3cb3){_0x42890e=_0x1e3cb3;_0x26735d[_0xc99d('0x35')]=_[_0xc99d('0x36')](db[_0xc99d('0x6a')][_0xc99d('0x33')]);_0x26735d[_0xc99d('0x39')]=_[_0xc99d('0x36')](_0x27227b[_0xc99d('0x39')]);_0x26735d[_0xc99d('0x37')]=_['intersection'](_0x26735d[_0xc99d('0x35')],_0x26735d[_0xc99d('0x39')]);_0x26651f[_0xc99d('0x3c')]=_[_0xc99d('0x38')](_0x26735d[_0xc99d('0x35')],qs['fields'](_0x27227b[_0xc99d('0x39')]['fields']));_0x26651f[_0xc99d('0x3c')]=_0x26651f[_0xc99d('0x3c')][_0xc99d('0x3b')]?_0x26651f[_0xc99d('0x3c')]:_0x26735d[_0xc99d('0x35')];_0x26651f['order']=qs[_0xc99d('0x3f')](_0x27227b[_0xc99d('0x39')][_0xc99d('0x3f')]);_0x26651f['where']=qs[_0xc99d('0x37')](_[_0xc99d('0x41')](_0x27227b[_0xc99d('0x39')],_0x26735d[_0xc99d('0x37')]));_0x26651f[_0xc99d('0x40')]=_[_0xc99d('0x42')](_0x26651f[_0xc99d('0x40')],{'$or':[{'ListId':_0x1e3cb3['id']},{'ListId':null}]});if(_0x27227b[_0xc99d('0x39')][_0xc99d('0x44')]){_0x26651f[_0xc99d('0x40')]=_[_0xc99d('0x42')](_0x26651f[_0xc99d('0x40')],{'$or':_[_0xc99d('0x31')](_0x26651f[_0xc99d('0x3c')],function(_0x4d16e1){var _0x170646={};_0x170646[_0x4d16e1]={'$like':'%'+_0x27227b[_0xc99d('0x39')][_0xc99d('0x44')]+'%'};return _0x170646;})});}_0x26651f=_[_0xc99d('0x42')]({},_0x26651f,_0x27227b['options']);return db[_0xc99d('0x6a')][_0xc99d('0x84')](_0x26651f);}})[_0xc99d('0x29')](respondWithResult(_0x2bcbdf,null))[_0xc99d('0x48')](handleError(_0x2bcbdf,null));};exports[_0xc99d('0x85')]=function(_0x50d809,_0x5cadcb,_0x246309){return db[_0xc99d('0x32')][_0xc99d('0x4b')]({'where':{'id':_0x50d809[_0xc99d('0x49')]['id']}})['then'](handleEntityNotFound(_0x5cadcb,null))[_0xc99d('0x29')](function(_0x183092){if(_0x183092){return _0x183092['addAgents'](_0x50d809[_0xc99d('0x52')][_0xc99d('0x5b')],_[_0xc99d('0x63')](_0x50d809[_0xc99d('0x52')],[_0xc99d('0x5b'),'id'])||{})['spread'](function(_0x288017){for(var _0x4eb1b7=0x0;_0x4eb1b7<_0x50d809[_0xc99d('0x52')]['ids'][_0xc99d('0x3b')];_0x4eb1b7+=0x1){socket[_0xc99d('0x86')](_0xc99d('0x87'),{'UserId':_0x50d809[_0xc99d('0x52')][_0xc99d('0x5b')][_0x4eb1b7],'CmListId':_0x50d809[_0xc99d('0x49')]['id']});}return _0x288017;});}})[_0xc99d('0x29')](respondWithResult(_0x5cadcb,null))['catch'](handleError(_0x5cadcb,null));};exports[_0xc99d('0x88')]=function(_0x84df92,_0x26830e,_0x5688f0){return db[_0xc99d('0x32')][_0xc99d('0x4b')]({'where':{'id':_0x84df92[_0xc99d('0x49')]['id']}})[_0xc99d('0x29')](handleEntityNotFound(_0x26830e,null))['then'](function(_0x54b403){if(_0x54b403){return _0x54b403[_0xc99d('0x88')](_0x84df92[_0xc99d('0x39')][_0xc99d('0x5b')])['then'](function(){if(_[_0xc99d('0x5f')](_0x84df92['query'][_0xc99d('0x5b')])){for(var _0x31d805=0x0;_0x31d805<_0x84df92[_0xc99d('0x39')][_0xc99d('0x5b')][_0xc99d('0x3b')];_0x31d805+=0x1){socket[_0xc99d('0x86')]('userCmList:remove',{'UserId':Number(_0x84df92[_0xc99d('0x39')][_0xc99d('0x5b')][_0x31d805]),'CmListId':Number(_0x84df92[_0xc99d('0x49')]['id'])});}}else{socket['emit'](_0xc99d('0x89'),{'UserId':Number(_0x84df92[_0xc99d('0x39')][_0xc99d('0x5b')]),'CmListId':Number(_0x84df92[_0xc99d('0x49')]['id'])});}});}})[_0xc99d('0x29')](respondWithStatusCode(_0x26830e,null))[_0xc99d('0x48')](handleError(_0x26830e,null));};exports[_0xc99d('0x8a')]=function(_0x3ac293,_0x5ab1d8,_0x3e2ab4){var _0x2b8f92={};var _0x10ed82={};var _0x3015ca;var _0xb1df81;return db[_0xc99d('0x32')][_0xc99d('0x57')]({'where':{'id':_0x3ac293['params']['id']}})[_0xc99d('0x29')](handleEntityNotFound(_0x5ab1d8,null))[_0xc99d('0x29')](function(_0x172cd4){if(_0x172cd4){_0x3015ca=_0x172cd4;_0x10ed82[_0xc99d('0x35')]=_['keys'](db['User'][_0xc99d('0x33')]);_0x10ed82[_0xc99d('0x39')]=_[_0xc99d('0x36')](_0x3ac293[_0xc99d('0x39')]);_0x10ed82[_0xc99d('0x37')]=_['intersection'](_0x10ed82[_0xc99d('0x35')],_0x10ed82[_0xc99d('0x39')]);_0x2b8f92[_0xc99d('0x3c')]=_[_0xc99d('0x38')](_0x10ed82['model'],qs[_0xc99d('0x3a')](_0x3ac293['query']['fields']));_0x2b8f92[_0xc99d('0x3c')]=_0x2b8f92[_0xc99d('0x3c')][_0xc99d('0x3b')]?_0x2b8f92[_0xc99d('0x3c')]:_0x10ed82[_0xc99d('0x35')];_0x2b8f92[_0xc99d('0x3e')]=qs[_0xc99d('0x3f')](_0x3ac293[_0xc99d('0x39')][_0xc99d('0x3f')]);_0x2b8f92[_0xc99d('0x40')]=qs[_0xc99d('0x37')](_[_0xc99d('0x41')](_0x3ac293['query'],_0x10ed82[_0xc99d('0x37')]));if(_0x3ac293[_0xc99d('0x39')]['filter']){_0x2b8f92[_0xc99d('0x40')]=_['merge'](_0x2b8f92[_0xc99d('0x40')],{'$or':_[_0xc99d('0x31')](_0x2b8f92[_0xc99d('0x3c')],function(_0x736643){var _0x287a7a={};_0x287a7a[_0x736643]={'$like':'%'+_0x3ac293['query']['filter']+'%'};return _0x287a7a;})});}_0x2b8f92=_[_0xc99d('0x42')]({},_0x2b8f92,_0x3ac293[_0xc99d('0x45')]);return _0x3015ca[_0xc99d('0x8a')](_0x2b8f92);}})[_0xc99d('0x29')](function(_0x43d105){if(_0x43d105){_0xb1df81=_0x43d105['length'];if(!_0x3ac293[_0xc99d('0x39')][_0xc99d('0x58')](_0xc99d('0x3d'))){_0x2b8f92['limit']=qs['limit'](_0x3ac293[_0xc99d('0x39')][_0xc99d('0x25')]);_0x2b8f92['offset']=qs['offset'](_0x3ac293[_0xc99d('0x39')][_0xc99d('0x24')]);}return _0x3015ca[_0xc99d('0x8a')](_0x2b8f92);}})[_0xc99d('0x29')](function(_0x138798){if(_0x138798){return _0x138798?{'count':_0xb1df81,'rows':_0x138798}:null;}})[_0xc99d('0x29')](respondWithResult(_0x5ab1d8,null))['catch'](handleError(_0x5ab1d8,null));}; \ No newline at end of file +var _0x9e1c=['filters','pick','filter','map','VIRTUAL','options','params','length','includeAll','find','create','body','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','ListId','Disposition','getDispositions','findOne','hasOwnProperty','merge','findAll','rows','removeDispositions','ids','addContacts','CmContact','describe','isArray','tags','join','push','each','omit','success','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','format','cf_%d','raw','getContactsCsv','concat','isEmpty','now','setHeader','attachment;\x20filename=','Content-type','text/csv','download','addCustomField','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:remove','User','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','register','status','json','count','offset','limit','set','Content-Range','save','update','then','destroy','get','Lists','UserProfileResource','end','sendStatus','error','stack','name','index','CmList','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','nolimit','order','sort','where'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x9e1c,0x168));var _0xc9e1=function(_0x135543,_0x214cee){_0x135543=_0x135543-0x0;var _0x43e003=_0x9e1c[_0x135543];return _0x43e003;};'use strict';var pdf=require(_0xc9e1('0x0'));var emlformat=require(_0xc9e1('0x1'));var rimraf=require(_0xc9e1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc9e1('0x3'));var rp=require(_0xc9e1('0x4'));var moment=require('moment');var BPromise=require(_0xc9e1('0x5'));var Mustache=require(_0xc9e1('0x6'));var util=require('util');var path=require(_0xc9e1('0x7'));var sox=require(_0xc9e1('0x8'));var csv=require('to-csv');var ejs=require(_0xc9e1('0x9'));var fs=require('fs');var fs_extra=require(_0xc9e1('0xa'));var _=require(_0xc9e1('0xb'));var squel=require('squel');var crypto=require(_0xc9e1('0xc'));var jsforce=require(_0xc9e1('0xd'));var deskjs=require(_0xc9e1('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc9e1('0xf'));var qs=require(_0xc9e1('0x10'));var as=require(_0xc9e1('0x11'));var hardwareService=require(_0xc9e1('0x12'));var logger=require(_0xc9e1('0x13'))(_0xc9e1('0x14'));var utils=require(_0xc9e1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc9e1('0x16'))['db'];config[_0xc9e1('0x17')]=_['defaults'](config[_0xc9e1('0x17')],{'host':_0xc9e1('0x18'),'port':0x18eb});var socket=require(_0xc9e1('0x19'))(new Redis(config[_0xc9e1('0x17')]));require(_0xc9e1('0x1a'))[_0xc9e1('0x1b')](socket);function respondWithStatusCode(_0x1845c5,_0x3c9105){_0x3c9105=_0x3c9105||0xcc;return function(_0x6f6c2f){if(_0x6f6c2f){return _0x1845c5['sendStatus'](_0x3c9105);}return _0x1845c5[_0xc9e1('0x1c')](_0x3c9105)['end']();};}function respondWithResult(_0x3ca426,_0x222fe3){_0x222fe3=_0x222fe3||0xc8;return function(_0x48afc1){if(_0x48afc1){return _0x3ca426[_0xc9e1('0x1c')](_0x222fe3)[_0xc9e1('0x1d')](_0x48afc1);}};}function respondWithFilteredResult(_0x3a2b13,_0x196d6a){return function(_0x98d285){if(_0x98d285){var _0xb1efef=_0x98d285[_0xc9e1('0x1e')],_0x528c92=_0x196d6a[_0xc9e1('0x1f')],_0x278ee9=_0x196d6a[_0xc9e1('0x1f')]+_0x196d6a[_0xc9e1('0x20')],_0x47c309;if(_0x278ee9>=_0xb1efef){_0x278ee9=_0xb1efef;_0x47c309=0xc8;}else{_0x47c309=0xce;}_0x3a2b13[_0xc9e1('0x1c')](_0x47c309);return _0x3a2b13[_0xc9e1('0x21')](_0xc9e1('0x22'),_0x528c92+'-'+_0x278ee9+'/'+_0xb1efef)[_0xc9e1('0x1d')](_0x98d285);}return null;};}function patchUpdates(_0x41451b){return function(_0x2d2dbe){try{jsonpatch['apply'](_0x2d2dbe,_0x41451b,!![]);}catch(_0x5ca4d8){return BPromise['reject'](_0x5ca4d8);}return _0x2d2dbe[_0xc9e1('0x23')]();};}function saveUpdates(_0x254f15,_0x1d8a15){return function(_0x4dd74f){if(_0x4dd74f){return _0x4dd74f[_0xc9e1('0x24')](_0x254f15)[_0xc9e1('0x25')](function(_0x2b55f1){return _0x2b55f1;});}return null;};}function removeEntity(_0x1106b5,_0x1e7f10){return function(_0x25d77f){if(_0x25d77f){return _0x25d77f[_0xc9e1('0x26')]()[_0xc9e1('0x25')](function(){var _0x29aaa1=_0x25d77f[_0xc9e1('0x27')]({'plain':!![]});var _0x517f93=_0xc9e1('0x28');return db[_0xc9e1('0x29')][_0xc9e1('0x26')]({'where':{'type':_0x517f93,'resourceId':_0x29aaa1['id']}})[_0xc9e1('0x25')](function(){return _0x25d77f;});})['then'](function(){_0x1106b5[_0xc9e1('0x1c')](0xcc)[_0xc9e1('0x2a')]();});}};}function handleEntityNotFound(_0x57cede,_0x144a9a){return function(_0x12894d){if(!_0x12894d){_0x57cede[_0xc9e1('0x2b')](0x194);}return _0x12894d;};}function handleError(_0x3cd0fc,_0x49fb07){_0x49fb07=_0x49fb07||0x1f4;return function(_0x5387c1){logger[_0xc9e1('0x2c')](_0x5387c1[_0xc9e1('0x2d')]);if(_0x5387c1[_0xc9e1('0x2e')]){delete _0x5387c1[_0xc9e1('0x2e')];}_0x3cd0fc[_0xc9e1('0x1c')](_0x49fb07)['send'](_0x5387c1);};}exports[_0xc9e1('0x2f')]=function(_0x44ae01,_0x1eb6e9){var _0x469b9c={},_0x5412d5={},_0x26cd34={'count':0x0,'rows':[]};var _0x597fd7=_['map'](db[_0xc9e1('0x30')][_0xc9e1('0x31')],function(_0x27b286){return{'name':_0x27b286[_0xc9e1('0x32')],'type':_0x27b286[_0xc9e1('0x33')][_0xc9e1('0x34')]};});_0x5412d5['model']=_['map'](_0x597fd7,'name');_0x5412d5[_0xc9e1('0x35')]=_[_0xc9e1('0x36')](_0x44ae01[_0xc9e1('0x35')]);_0x5412d5['filters']=_['intersection'](_0x5412d5[_0xc9e1('0x37')],_0x5412d5['query']);_0x469b9c[_0xc9e1('0x38')]=_[_0xc9e1('0x39')](_0x5412d5['model'],qs[_0xc9e1('0x3a')](_0x44ae01['query'][_0xc9e1('0x3a')]));_0x469b9c[_0xc9e1('0x38')]=_0x469b9c[_0xc9e1('0x38')]['length']?_0x469b9c[_0xc9e1('0x38')]:_0x5412d5['model'];if(!_0x44ae01[_0xc9e1('0x35')]['hasOwnProperty'](_0xc9e1('0x3b'))){_0x469b9c[_0xc9e1('0x20')]=qs[_0xc9e1('0x20')](_0x44ae01['query']['limit']);_0x469b9c[_0xc9e1('0x1f')]=qs[_0xc9e1('0x1f')](_0x44ae01[_0xc9e1('0x35')][_0xc9e1('0x1f')]);}_0x469b9c[_0xc9e1('0x3c')]=qs[_0xc9e1('0x3d')](_0x44ae01['query'][_0xc9e1('0x3d')]);_0x469b9c[_0xc9e1('0x3e')]=qs[_0xc9e1('0x3f')](_[_0xc9e1('0x40')](_0x44ae01[_0xc9e1('0x35')],_0x5412d5[_0xc9e1('0x3f')]),_0x597fd7);if(_0x44ae01['query'][_0xc9e1('0x41')]){_0x469b9c[_0xc9e1('0x3e')]=_['merge'](_0x469b9c['where'],{'$or':_[_0xc9e1('0x42')](_0x597fd7,function(_0x40a977){if(_0x40a977[_0xc9e1('0x33')]!==_0xc9e1('0x43')){var _0x5dadf2={};_0x5dadf2[_0x40a977[_0xc9e1('0x2e')]]={'$like':'%'+_0x44ae01['query'][_0xc9e1('0x41')]+'%'};return _0x5dadf2;}})});}_0x469b9c=_['merge']({},_0x469b9c,_0x44ae01[_0xc9e1('0x44')]);var _0x113056={'where':_0x469b9c[_0xc9e1('0x3e')]};return db[_0xc9e1('0x30')]['count'](_0x113056)[_0xc9e1('0x25')](function(_0x485dfe){_0x26cd34['count']=_0x485dfe;if(_0x44ae01[_0xc9e1('0x35')]['includeAll']){_0x469b9c['include']=[{'all':!![]}];}return db[_0xc9e1('0x30')]['findAll'](_0x469b9c);})[_0xc9e1('0x25')](function(_0x4fdba6){_0x26cd34['rows']=_0x4fdba6;return _0x26cd34;})[_0xc9e1('0x25')](respondWithFilteredResult(_0x1eb6e9,_0x469b9c))['catch'](handleError(_0x1eb6e9,null));};exports['show']=function(_0x35c0f4,_0x414606){var _0x56d1b6={'raw':![],'where':{'id':_0x35c0f4[_0xc9e1('0x45')]['id']}},_0x5387ce={};_0x5387ce['model']=_[_0xc9e1('0x36')](db[_0xc9e1('0x30')][_0xc9e1('0x31')]);_0x5387ce['query']=_['keys'](_0x35c0f4[_0xc9e1('0x35')]);_0x5387ce[_0xc9e1('0x3f')]=_[_0xc9e1('0x39')](_0x5387ce[_0xc9e1('0x37')],_0x5387ce[_0xc9e1('0x35')]);_0x56d1b6[_0xc9e1('0x38')]=_[_0xc9e1('0x39')](_0x5387ce['model'],qs[_0xc9e1('0x3a')](_0x35c0f4['query'][_0xc9e1('0x3a')]));_0x56d1b6['attributes']=_0x56d1b6[_0xc9e1('0x38')][_0xc9e1('0x46')]?_0x56d1b6['attributes']:_0x5387ce[_0xc9e1('0x37')];if(_0x35c0f4[_0xc9e1('0x35')][_0xc9e1('0x47')]){_0x56d1b6['include']=[{'all':!![]}];}_0x56d1b6=_['merge']({},_0x56d1b6,_0x35c0f4[_0xc9e1('0x44')]);return db[_0xc9e1('0x30')][_0xc9e1('0x48')](_0x56d1b6)['then'](handleEntityNotFound(_0x414606,null))[_0xc9e1('0x25')](respondWithResult(_0x414606,null))['catch'](handleError(_0x414606,null));};exports[_0xc9e1('0x49')]=function(_0x113521,_0x9d533d){return db[_0xc9e1('0x30')]['create'](_0x113521[_0xc9e1('0x4a')],{})[_0xc9e1('0x25')](function(_0x34502b){var _0x562dd9=_0x113521['user'][_0xc9e1('0x27')]({'plain':!![]});if(!_0x562dd9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x562dd9[_0xc9e1('0x4b')]===_0xc9e1('0x4c')){var _0x46e32b=_0x34502b['get']({'plain':!![]});var _0x5ab51d=_0xc9e1('0x28');return db[_0xc9e1('0x4d')][_0xc9e1('0x48')]({'where':{'name':_0x5ab51d,'userProfileId':_0x562dd9[_0xc9e1('0x4e')]},'raw':!![]})[_0xc9e1('0x25')](function(_0x4e2d08){if(_0x4e2d08&&_0x4e2d08['autoAssociation']===0x0){return db[_0xc9e1('0x29')][_0xc9e1('0x49')]({'name':_0x46e32b[_0xc9e1('0x2e')],'resourceId':_0x46e32b['id'],'type':_0x4e2d08[_0xc9e1('0x2e')],'sectionId':_0x4e2d08['id']},{})['then'](function(){return _0x34502b;});}else{return _0x34502b;}})['catch'](function(_0x504d8d){logger[_0xc9e1('0x2c')](_0xc9e1('0x4f'),_0x504d8d);throw _0x504d8d;});}return _0x34502b;})[_0xc9e1('0x25')](respondWithResult(_0x9d533d,0xc9))[_0xc9e1('0x50')](handleError(_0x9d533d,null));};exports[_0xc9e1('0x24')]=function(_0x52f98d,_0x3800d6){if(_0x52f98d[_0xc9e1('0x4a')]['id']){delete _0x52f98d[_0xc9e1('0x4a')]['id'];}return db[_0xc9e1('0x30')][_0xc9e1('0x48')]({'where':{'id':_0x52f98d[_0xc9e1('0x45')]['id']}})['then'](handleEntityNotFound(_0x3800d6,null))[_0xc9e1('0x25')](saveUpdates(_0x52f98d['body'],null))[_0xc9e1('0x25')](respondWithResult(_0x3800d6,null))[_0xc9e1('0x50')](handleError(_0x3800d6,null));};exports['destroy']=function(_0x469420,_0x63dc0c){return db[_0xc9e1('0x30')][_0xc9e1('0x48')]({'where':{'id':_0x469420[_0xc9e1('0x45')]['id']}})[_0xc9e1('0x25')](handleEntityNotFound(_0x63dc0c,null))[_0xc9e1('0x25')](removeEntity(_0x63dc0c,null))[_0xc9e1('0x50')](handleError(_0x63dc0c,null));};exports['describe']=function(_0x36ec30,_0x1d54a7){return db[_0xc9e1('0x30')]['describe']()['then'](respondWithResult(_0x1d54a7,null))[_0xc9e1('0x50')](handleError(_0x1d54a7,null));};exports['addDisposition']=function(_0x5d62aa,_0x1d1368,_0x25065c){if(_0x5d62aa['body']['id']){delete _0x5d62aa['body']['id'];}return db[_0xc9e1('0x30')][_0xc9e1('0x48')]({'where':{'id':_0x5d62aa[_0xc9e1('0x45')]['id']}})[_0xc9e1('0x25')](handleEntityNotFound(_0x1d1368,null))[_0xc9e1('0x25')](function(_0xc07a21){if(_0xc07a21){_0x5d62aa[_0xc9e1('0x4a')][_0xc9e1('0x51')]=_0xc07a21['id'];return db[_0xc9e1('0x52')]['create'](_0x5d62aa[_0xc9e1('0x4a')]);}})['then'](respondWithResult(_0x1d1368,null))[_0xc9e1('0x50')](handleError(_0x1d1368,null));};exports[_0xc9e1('0x53')]=function(_0x1466e6,_0x4c42de,_0x454fa9){var _0x587adb={'raw':![],'where':{}};var _0x32c130={};var _0x457222={'count':0x0,'rows':[]};return db['CmList'][_0xc9e1('0x54')]({'where':{'id':_0x1466e6[_0xc9e1('0x45')]['id']}})[_0xc9e1('0x25')](handleEntityNotFound(_0x4c42de,null))[_0xc9e1('0x25')](function(_0x2531d7){if(_0x2531d7){_0x32c130[_0xc9e1('0x37')]=_[_0xc9e1('0x36')](db['Disposition'][_0xc9e1('0x31')]);_0x32c130['query']=_[_0xc9e1('0x36')](_0x1466e6['query']);_0x32c130['filters']=_['intersection'](_0x32c130[_0xc9e1('0x37')],_0x32c130[_0xc9e1('0x35')]);_0x587adb[_0xc9e1('0x38')]=_[_0xc9e1('0x39')](_0x32c130[_0xc9e1('0x37')],qs[_0xc9e1('0x3a')](_0x1466e6[_0xc9e1('0x35')][_0xc9e1('0x3a')]));_0x587adb[_0xc9e1('0x38')]=_0x587adb[_0xc9e1('0x38')][_0xc9e1('0x46')]?_0x587adb['attributes']:_0x32c130[_0xc9e1('0x37')];if(!_0x1466e6['query'][_0xc9e1('0x55')](_0xc9e1('0x3b'))){_0x587adb['limit']=qs[_0xc9e1('0x20')](_0x1466e6[_0xc9e1('0x35')][_0xc9e1('0x20')]);_0x587adb[_0xc9e1('0x1f')]=qs[_0xc9e1('0x1f')](_0x1466e6['query'][_0xc9e1('0x1f')]);}_0x587adb['order']=qs[_0xc9e1('0x3d')](_0x1466e6[_0xc9e1('0x35')]['sort']);_0x587adb[_0xc9e1('0x3e')]=qs['filters'](_[_0xc9e1('0x40')](_0x1466e6[_0xc9e1('0x35')],_0x32c130[_0xc9e1('0x3f')]));_0x587adb['where'][_0xc9e1('0x51')]=_0x2531d7['id'];if(_0x1466e6['query'][_0xc9e1('0x41')]){_0x587adb[_0xc9e1('0x3e')]=_[_0xc9e1('0x56')](_0x587adb['where'],{'$or':_['map'](_0x587adb[_0xc9e1('0x38')],function(_0x5cbd0d){var _0x5d4dd3={};_0x5d4dd3[_0x5cbd0d]={'$like':'%'+_0x1466e6[_0xc9e1('0x35')]['filter']+'%'};return _0x5d4dd3;})});}_0x587adb=_['merge']({},_0x587adb,_0x1466e6['options']);return db[_0xc9e1('0x52')][_0xc9e1('0x1e')]({'where':_0x587adb[_0xc9e1('0x3e')]})[_0xc9e1('0x25')](function(_0x248dc7){_0x457222[_0xc9e1('0x1e')]=_0x248dc7;if(_0x1466e6[_0xc9e1('0x35')]['includeAll']){_0x587adb['include']=[{'all':!![]}];}return db[_0xc9e1('0x52')][_0xc9e1('0x57')](_0x587adb);})[_0xc9e1('0x25')](function(_0x388002){_0x457222[_0xc9e1('0x58')]=_0x388002;return _0x457222;});}})[_0xc9e1('0x25')](respondWithFilteredResult(_0x4c42de,_0x587adb))[_0xc9e1('0x50')](handleError(_0x4c42de,null));};exports[_0xc9e1('0x59')]=function(_0x3192d3,_0x4416a0,_0x52e279){return db[_0xc9e1('0x30')]['find']({'where':{'id':_0x3192d3[_0xc9e1('0x45')]['id']}})[_0xc9e1('0x25')](handleEntityNotFound(_0x4416a0,null))[_0xc9e1('0x25')](function(_0x4d1901){if(_0x4d1901){return _0x4d1901['removeDispositions'](_0x3192d3[_0xc9e1('0x35')][_0xc9e1('0x5a')]);}})[_0xc9e1('0x25')](respondWithStatusCode(_0x4416a0,null))[_0xc9e1('0x50')](handleError(_0x4416a0,null));};exports[_0xc9e1('0x5b')]=function(_0xef22a5,_0x4c84f9,_0xf6efb3){return db[_0xc9e1('0x30')]['find']({'where':{'id':_0xef22a5[_0xc9e1('0x45')]['id']}})['then'](handleEntityNotFound(_0x4c84f9,null))['then'](function(_0x51c39f){if(_0x51c39f){var _0x3673f0=[];var _0x5129e2={'success':[],'errors':[]};return db[_0xc9e1('0x5c')][_0xc9e1('0x5d')]()[_0xc9e1('0x25')](function(_0x3fb709){if(_0xef22a5[_0xc9e1('0x4a')]['tags']&&_[_0xc9e1('0x5e')](_0xef22a5['body']['tags'])){if(_0xef22a5['body'][_0xc9e1('0x5f')][_0xc9e1('0x46')]){_0xef22a5[_0xc9e1('0x4a')][_0xc9e1('0x5f')]=_0xef22a5[_0xc9e1('0x4a')][_0xc9e1('0x5f')][_0xc9e1('0x60')](';')+';';}else{_0xef22a5['body']['tags']=null;}}else{_0xef22a5['body'][_0xc9e1('0x5f')]=null;}if(_0xef22a5[_0xc9e1('0x4a')]&&_[_0xc9e1('0x5e')](_0xef22a5[_0xc9e1('0x4a')])){for(var _0x550e9a=0x0;_0x550e9a<_0xef22a5[_0xc9e1('0x4a')][_0xc9e1('0x46')];_0x550e9a+=0x1){_0xef22a5['body'][_0x550e9a][_0xc9e1('0x51')]=_0xef22a5[_0xc9e1('0x45')]['id'];_0x3673f0[_0xc9e1('0x61')](_0xef22a5[_0xc9e1('0x4a')][_0x550e9a]);}return BPromise[_0xc9e1('0x62')](_0x3673f0,function(_0x1af863){return db[_0xc9e1('0x5c')][_0xc9e1('0x49')](_[_0xc9e1('0x63')](_0x1af863,['ids','id'])||{},{'fields':_[_0xc9e1('0x36')](_0x3fb709),'raw':!![]})['then'](function(_0x5263c4){_0x5129e2[_0xc9e1('0x64')][_0xc9e1('0x61')](_0x5263c4[_0xc9e1('0x65')]);})[_0xc9e1('0x50')](function(_0x2a20b2){_0x5129e2[_0xc9e1('0x66')][_0xc9e1('0x61')]({'data':_0x1af863,'error':_0x2a20b2['message']});});})['then'](function(_0x3eee7d){return _0x5129e2;})['catch'](function(_0x2f270b){return _0x2f270b;});}else{_0x4c84f9['status'](0x190)['json']({'message':_0xc9e1('0x67')});}});}})[_0xc9e1('0x25')](respondWithResult(_0x4c84f9,null))[_0xc9e1('0x50')](handleError(_0x4c84f9,null));};exports[_0xc9e1('0x68')]=function(_0x35e0b0,_0xd39c32,_0x4d39c3){var _0x1c010e;return db[_0xc9e1('0x30')][_0xc9e1('0x48')]({'where':{'id':_0x35e0b0[_0xc9e1('0x45')]['id']},'include':[{'model':db[_0xc9e1('0x69')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0xd39c32,null))[_0xc9e1('0x25')](function(_0x22459f){if(_0x22459f){_0x1c010e=_0x22459f;return db[_0xc9e1('0x5c')][_0xc9e1('0x31')];}})[_0xc9e1('0x25')](function(_0x2456a6){if(_0x2456a6){var _0x364212={};var _0x291413={};_0x291413[_0xc9e1('0x37')]=_['concat'](_[_0xc9e1('0x36')](_0x2456a6),_[_0xc9e1('0x42')](_0x1c010e[_0xc9e1('0x6a')],function(_0x46b082){return util[_0xc9e1('0x6b')](_0xc9e1('0x6c'),_0x46b082['id']);}));_0x291413[_0xc9e1('0x35')]=_[_0xc9e1('0x36')](_0x35e0b0[_0xc9e1('0x35')]);_0x291413[_0xc9e1('0x3f')]=_[_0xc9e1('0x39')](_0x291413['model'],_0x291413[_0xc9e1('0x35')]);_0x364212[_0xc9e1('0x38')]=_[_0xc9e1('0x39')](_0x291413[_0xc9e1('0x37')],qs[_0xc9e1('0x3a')](_0x35e0b0[_0xc9e1('0x35')][_0xc9e1('0x3a')]));_0x364212[_0xc9e1('0x38')]=_0x364212[_0xc9e1('0x38')][_0xc9e1('0x46')]?_0x364212['attributes']:_0x291413[_0xc9e1('0x37')];if(!_0x35e0b0['query']['hasOwnProperty']('nolimit')){_0x364212['limit']=qs[_0xc9e1('0x20')](_0x35e0b0[_0xc9e1('0x35')][_0xc9e1('0x20')]);_0x364212[_0xc9e1('0x1f')]=qs['offset'](_0x35e0b0[_0xc9e1('0x35')]['offset']);}_0x364212['order']=qs[_0xc9e1('0x3d')](_0x35e0b0[_0xc9e1('0x35')][_0xc9e1('0x3d')]);_0x364212['where']=qs[_0xc9e1('0x3f')](_[_0xc9e1('0x40')](_0x35e0b0['query'],_0x291413['filters']));_0x364212[_0xc9e1('0x6d')]=!![];if(_0x35e0b0['query'][_0xc9e1('0x41')]){_0x364212['where']=_[_0xc9e1('0x56')](_0x364212[_0xc9e1('0x3e')],{'$or':_[_0xc9e1('0x42')](_0x364212[_0xc9e1('0x38')],function(_0x4cf36f){var _0x3d3d9b={};_0x3d3d9b[_0x4cf36f]={'$like':'%'+_0x35e0b0[_0xc9e1('0x35')]['filter']+'%'};return _0x3d3d9b;})});}_0x364212=_[_0xc9e1('0x56')]({},_0x364212,_0x35e0b0[_0xc9e1('0x44')]);return _0x1c010e['getContacts'](_0x364212);}})[_0xc9e1('0x25')](respondWithResult(_0xd39c32,null))[_0xc9e1('0x50')](handleError(_0xd39c32,null));};exports[_0xc9e1('0x6e')]=function(_0x38b56a,_0x16e25f,_0x2e0e93){var _0x60cefd;return db['CmList']['find']({'where':{'id':_0x38b56a['params']['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x16e25f,null))[_0xc9e1('0x25')](function(_0xf4f2d3){if(_0xf4f2d3){_0x60cefd=_0xf4f2d3;return db[_0xc9e1('0x5c')][_0xc9e1('0x31')];}})[_0xc9e1('0x25')](function(_0xdfeb73){if(_0xdfeb73){var _0x5c9f56={};var _0x22d84d={};_0x22d84d[_0xc9e1('0x37')]=_[_0xc9e1('0x6f')](_['keys'](_0xdfeb73),_[_0xc9e1('0x42')](_0x60cefd[_0xc9e1('0x6a')],function(_0x3ef78a){return util[_0xc9e1('0x6b')](_0xc9e1('0x6c'),_0x3ef78a['id']);}));_0x22d84d['query']=_[_0xc9e1('0x36')](_0x38b56a[_0xc9e1('0x35')]);_0x22d84d['filters']=_[_0xc9e1('0x39')](_0x22d84d['model'],_0x22d84d[_0xc9e1('0x35')]);_0x5c9f56[_0xc9e1('0x38')]=_[_0xc9e1('0x39')](_0x22d84d[_0xc9e1('0x37')],qs[_0xc9e1('0x3a')](_0x38b56a[_0xc9e1('0x35')][_0xc9e1('0x3a')]));_0x5c9f56[_0xc9e1('0x38')]=_0x5c9f56[_0xc9e1('0x38')][_0xc9e1('0x46')]?_0x5c9f56[_0xc9e1('0x38')]:_0x22d84d['model'];if(!_0x38b56a['query'][_0xc9e1('0x55')](_0xc9e1('0x3b'))){_0x5c9f56[_0xc9e1('0x20')]=qs[_0xc9e1('0x20')](_0x38b56a['query'][_0xc9e1('0x20')]);_0x5c9f56[_0xc9e1('0x1f')]=qs['offset'](_0x38b56a['query']['offset']);}_0x5c9f56[_0xc9e1('0x3c')]=qs[_0xc9e1('0x3d')](_0x38b56a['query'][_0xc9e1('0x3d')]);_0x5c9f56['where']=qs[_0xc9e1('0x3f')](_[_0xc9e1('0x40')](_0x38b56a[_0xc9e1('0x35')],_0x22d84d[_0xc9e1('0x3f')]));_0x5c9f56['raw']=!![];if(_0x38b56a['query'][_0xc9e1('0x41')]){_0x5c9f56[_0xc9e1('0x3e')]=_['merge'](_0x5c9f56['where'],{'$or':_[_0xc9e1('0x42')](_0x5c9f56['attributes'],function(_0x5048e7){var _0x3f6fad={};_0x3f6fad[_0x5048e7]={'$like':'%'+_0x38b56a[_0xc9e1('0x35')]['filter']+'%'};return _0x3f6fad;})});}_0x5c9f56=_[_0xc9e1('0x56')]({},_0x5c9f56,_0x38b56a[_0xc9e1('0x44')]);return _0x60cefd['getContacts'](_0x5c9f56);}})[_0xc9e1('0x25')](function(_0x38a969){if(!_[_0xc9e1('0x70')](_0x38a969)){var _0x459a29=toCsv(_0x38a969);var _0x271525=Date[_0xc9e1('0x71')]();fs['writeFileSync'](util[_0xc9e1('0x6b')]('/tmp/list_%d_%s.csv',_0x60cefd['id'],_0x271525),_0x459a29);_0x16e25f[_0xc9e1('0x72')]('Content-disposition',_0xc9e1('0x73')+util[_0xc9e1('0x6b')]('list_%d_%s.csv',_0x60cefd['id'],_0x271525));_0x16e25f[_0xc9e1('0x72')](_0xc9e1('0x74'),_0xc9e1('0x75'));return _0x16e25f[_0xc9e1('0x76')](util[_0xc9e1('0x6b')]('/tmp/list_%d_%s.csv',_0x60cefd['id'],_0x271525));}else{return _0x16e25f[_0xc9e1('0x2b')](0xcc);}})['catch'](handleError(_0x16e25f,null));};exports[_0xc9e1('0x77')]=function(_0x3dfd52,_0x5bf400,_0x401de0){var _0x3ec58d;delete _0x3dfd52[_0xc9e1('0x4a')]['id'];return db[_0xc9e1('0x30')][_0xc9e1('0x54')]({'where':{'id':_0x3dfd52['params']['id']}})[_0xc9e1('0x25')](handleEntityNotFound(_0x5bf400,null))[_0xc9e1('0x25')](function(_0x33c06d){if(_0x33c06d){return db['sequelize'][_0xc9e1('0x78')](function(_0xd53f1f){return db[_0xc9e1('0x69')]['create'](_0x3dfd52['body'],{'transaction':_0xd53f1f})['then'](function(_0x3a785c){_0x3ec58d=_0x3a785c;return _0x33c06d['addCustomFields'](_0x3a785c,{'transaction':_0xd53f1f});})[_0xc9e1('0x25')](function(){var _0x2b0c3c={'type':db[_0xc9e1('0x79')][_0xc9e1('0x7a')],'transaction':_0xd53f1f};switch(_0x3dfd52['body'][_0xc9e1('0x33')]){case'text':_0x2b0c3c[_0xc9e1('0x33')]=db[_0xc9e1('0x79')]['TEXT'];break;case _0xc9e1('0x7b'):_0x2b0c3c['type']=db['Sequelize'][_0xc9e1('0x7c')];break;case _0xc9e1('0x7d'):_0x2b0c3c[_0xc9e1('0x33')]=db[_0xc9e1('0x79')][_0xc9e1('0x7e')];_0x2b0c3c[_0xc9e1('0x7f')]=![];break;default:}return db[_0xc9e1('0x80')][_0xc9e1('0x81')][_0xc9e1('0x82')](_0xc9e1('0x83'),util[_0xc9e1('0x6b')](_0xc9e1('0x84'),_0x3ec58d['id']),_0x2b0c3c);})[_0xc9e1('0x25')](function(){return _0x3ec58d;});});}})[_0xc9e1('0x25')](respondWithResult(_0x5bf400,null))['catch'](handleError(_0x5bf400,null));};exports[_0xc9e1('0x85')]=function(_0x1c70df,_0x1db259,_0x441a91){var _0x39953a={};var _0x18bd20={};var _0x21c1a1;var _0x790939;return db[_0xc9e1('0x30')][_0xc9e1('0x54')]({'where':{'id':_0x1c70df[_0xc9e1('0x45')]['id']}})[_0xc9e1('0x25')](handleEntityNotFound(_0x1db259,null))[_0xc9e1('0x25')](function(_0x395c50){if(_0x395c50){_0x21c1a1=_0x395c50;_0x18bd20[_0xc9e1('0x37')]=_[_0xc9e1('0x36')](db[_0xc9e1('0x69')]['rawAttributes']);_0x18bd20['query']=_['keys'](_0x1c70df['query']);_0x18bd20[_0xc9e1('0x3f')]=_[_0xc9e1('0x39')](_0x18bd20[_0xc9e1('0x37')],_0x18bd20[_0xc9e1('0x35')]);_0x39953a['attributes']=_[_0xc9e1('0x39')](_0x18bd20['model'],qs['fields'](_0x1c70df['query']['fields']));_0x39953a[_0xc9e1('0x38')]=_0x39953a[_0xc9e1('0x38')][_0xc9e1('0x46')]?_0x39953a[_0xc9e1('0x38')]:_0x18bd20['model'];_0x39953a[_0xc9e1('0x3c')]=qs[_0xc9e1('0x3d')](_0x1c70df[_0xc9e1('0x35')][_0xc9e1('0x3d')]);_0x39953a[_0xc9e1('0x3e')]=qs[_0xc9e1('0x3f')](_[_0xc9e1('0x40')](_0x1c70df[_0xc9e1('0x35')],_0x18bd20['filters']));_0x39953a[_0xc9e1('0x3e')]=_[_0xc9e1('0x56')](_0x39953a[_0xc9e1('0x3e')],{'$or':[{'ListId':_0x395c50['id']},{'ListId':null}]});if(_0x1c70df[_0xc9e1('0x35')][_0xc9e1('0x41')]){_0x39953a[_0xc9e1('0x3e')]=_[_0xc9e1('0x56')](_0x39953a[_0xc9e1('0x3e')],{'$or':_['map'](_0x39953a[_0xc9e1('0x38')],function(_0x1a6d6d){var _0x198ae2={};_0x198ae2[_0x1a6d6d]={'$like':'%'+_0x1c70df['query'][_0xc9e1('0x41')]+'%'};return _0x198ae2;})});}_0x39953a=_[_0xc9e1('0x56')]({},_0x39953a,_0x1c70df[_0xc9e1('0x44')]);return db[_0xc9e1('0x69')][_0xc9e1('0x86')](_0x39953a);}})[_0xc9e1('0x25')](respondWithResult(_0x1db259,null))[_0xc9e1('0x50')](handleError(_0x1db259,null));};exports[_0xc9e1('0x87')]=function(_0x460fa4,_0x475904,_0x5a6577){return db[_0xc9e1('0x30')]['find']({'where':{'id':_0x460fa4[_0xc9e1('0x45')]['id']}})[_0xc9e1('0x25')](handleEntityNotFound(_0x475904,null))[_0xc9e1('0x25')](function(_0x2e0e91){if(_0x2e0e91){return _0x2e0e91['addAgents'](_0x460fa4[_0xc9e1('0x4a')][_0xc9e1('0x5a')],_['omit'](_0x460fa4[_0xc9e1('0x4a')],[_0xc9e1('0x5a'),'id'])||{})[_0xc9e1('0x88')](function(_0x4020fc){for(var _0x5c631d=0x0;_0x5c631d<_0x460fa4[_0xc9e1('0x4a')][_0xc9e1('0x5a')][_0xc9e1('0x46')];_0x5c631d+=0x1){socket[_0xc9e1('0x89')]('userCmList:save',{'UserId':_0x460fa4[_0xc9e1('0x4a')]['ids'][_0x5c631d],'CmListId':_0x460fa4[_0xc9e1('0x45')]['id']});}return _0x4020fc;});}})[_0xc9e1('0x25')](respondWithResult(_0x475904,null))[_0xc9e1('0x50')](handleError(_0x475904,null));};exports['removeAgents']=function(_0x15f867,_0x4320af,_0x321d58){return db[_0xc9e1('0x30')][_0xc9e1('0x48')]({'where':{'id':_0x15f867[_0xc9e1('0x45')]['id']}})[_0xc9e1('0x25')](handleEntityNotFound(_0x4320af,null))[_0xc9e1('0x25')](function(_0x14edf7){if(_0x14edf7){return _0x14edf7['removeAgents'](_0x15f867[_0xc9e1('0x35')][_0xc9e1('0x5a')])[_0xc9e1('0x25')](function(){if(_[_0xc9e1('0x5e')](_0x15f867['query'][_0xc9e1('0x5a')])){for(var _0x2e023a=0x0;_0x2e023a<_0x15f867[_0xc9e1('0x35')][_0xc9e1('0x5a')][_0xc9e1('0x46')];_0x2e023a+=0x1){socket[_0xc9e1('0x89')](_0xc9e1('0x8a'),{'UserId':Number(_0x15f867[_0xc9e1('0x35')][_0xc9e1('0x5a')][_0x2e023a]),'CmListId':Number(_0x15f867['params']['id'])});}}else{socket[_0xc9e1('0x89')](_0xc9e1('0x8a'),{'UserId':Number(_0x15f867[_0xc9e1('0x35')]['ids']),'CmListId':Number(_0x15f867[_0xc9e1('0x45')]['id'])});}});}})['then'](respondWithStatusCode(_0x4320af,null))[_0xc9e1('0x50')](handleError(_0x4320af,null));};exports['getAgents']=function(_0x578d57,_0x3f968d,_0x476ef8){var _0x5b3513={};var _0x405b9e={};var _0x561cb7;var _0x13c292;return db[_0xc9e1('0x30')]['findOne']({'where':{'id':_0x578d57[_0xc9e1('0x45')]['id']}})[_0xc9e1('0x25')](handleEntityNotFound(_0x3f968d,null))[_0xc9e1('0x25')](function(_0x9d7ef3){if(_0x9d7ef3){_0x561cb7=_0x9d7ef3;_0x405b9e['model']=_[_0xc9e1('0x36')](db[_0xc9e1('0x8b')][_0xc9e1('0x31')]);_0x405b9e[_0xc9e1('0x35')]=_[_0xc9e1('0x36')](_0x578d57[_0xc9e1('0x35')]);_0x405b9e[_0xc9e1('0x3f')]=_[_0xc9e1('0x39')](_0x405b9e['model'],_0x405b9e['query']);_0x5b3513[_0xc9e1('0x38')]=_[_0xc9e1('0x39')](_0x405b9e[_0xc9e1('0x37')],qs[_0xc9e1('0x3a')](_0x578d57[_0xc9e1('0x35')][_0xc9e1('0x3a')]));_0x5b3513[_0xc9e1('0x38')]=_0x5b3513[_0xc9e1('0x38')][_0xc9e1('0x46')]?_0x5b3513[_0xc9e1('0x38')]:_0x405b9e[_0xc9e1('0x37')];_0x5b3513[_0xc9e1('0x3c')]=qs[_0xc9e1('0x3d')](_0x578d57[_0xc9e1('0x35')][_0xc9e1('0x3d')]);_0x5b3513[_0xc9e1('0x3e')]=qs[_0xc9e1('0x3f')](_['pick'](_0x578d57['query'],_0x405b9e['filters']));if(_0x578d57[_0xc9e1('0x35')][_0xc9e1('0x41')]){_0x5b3513[_0xc9e1('0x3e')]=_[_0xc9e1('0x56')](_0x5b3513['where'],{'$or':_[_0xc9e1('0x42')](_0x5b3513['attributes'],function(_0x3dd975){var _0x332873={};_0x332873[_0x3dd975]={'$like':'%'+_0x578d57[_0xc9e1('0x35')][_0xc9e1('0x41')]+'%'};return _0x332873;})});}_0x5b3513=_[_0xc9e1('0x56')]({},_0x5b3513,_0x578d57[_0xc9e1('0x44')]);return _0x561cb7['getAgents'](_0x5b3513);}})[_0xc9e1('0x25')](function(_0x11fd10){if(_0x11fd10){_0x13c292=_0x11fd10[_0xc9e1('0x46')];if(!_0x578d57[_0xc9e1('0x35')][_0xc9e1('0x55')]('nolimit')){_0x5b3513[_0xc9e1('0x20')]=qs[_0xc9e1('0x20')](_0x578d57[_0xc9e1('0x35')][_0xc9e1('0x20')]);_0x5b3513['offset']=qs['offset'](_0x578d57[_0xc9e1('0x35')][_0xc9e1('0x1f')]);}return _0x561cb7[_0xc9e1('0x8c')](_0x5b3513);}})[_0xc9e1('0x25')](function(_0x4cda91){if(_0x4cda91){return _0x4cda91?{'count':_0x13c292,'rows':_0x4cda91}:null;}})[_0xc9e1('0x25')](respondWithResult(_0x3f968d,null))['catch'](handleError(_0x3f968d,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 7241fc3..895ece9 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 _0x19ad=['setMaxListeners','save','update','remove','emit','hook','events'];(function(_0xceddda,_0x75180b){var _0x49dbe8=function(_0x990b7d){while(--_0x990b7d){_0xceddda['push'](_0xceddda['shift']());}};_0x49dbe8(++_0x75180b);}(_0x19ad,0x1e9));var _0xd19a=function(_0x5351d4,_0x9fad72){_0x5351d4=_0x5351d4-0x0;var _0x158dd6=_0x19ad[_0x5351d4];return _0x158dd6;};'use strict';var EventEmitter=require(_0xd19a('0x0'));var CmList=require('../../mysqldb')['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0xd19a('0x1')](0x0);var events={'afterCreate':_0xd19a('0x2'),'afterUpdate':_0xd19a('0x3'),'afterDestroy':_0xd19a('0x4')};function emitEvent(_0x14a9f3){return function(_0x28a391,_0x3c4581,_0x5b451f){CmListEvents[_0xd19a('0x5')](_0x14a9f3+':'+_0x28a391['id'],_0x28a391);CmListEvents[_0xd19a('0x5')](_0x14a9f3,_0x28a391);_0x5b451f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xd19a('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0xa578=['exports','../../mysqldb','CmList','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x46af65,_0x3f0001){var _0x553b4e=function(_0x313e14){while(--_0x313e14){_0x46af65['push'](_0x46af65['shift']());}};_0x553b4e(++_0x3f0001);}(_0xa578,0xe1));var _0x8a57=function(_0x4a17d8,_0xd43f37){_0x4a17d8=_0x4a17d8-0x0;var _0x13a7df=_0xa578[_0x4a17d8];return _0x13a7df;};'use strict';var EventEmitter=require('events');var CmList=require(_0x8a57('0x0'))['db'][_0x8a57('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x8a57('0x2')](0x0);var events={'afterCreate':_0x8a57('0x3'),'afterUpdate':'update','afterDestroy':_0x8a57('0x4')};function emitEvent(_0x3ac6cf){return function(_0x3c7802,_0x3a6c38,_0x1ca9aa){CmListEvents[_0x8a57('0x5')](_0x3ac6cf+':'+_0x3c7802['id'],_0x3c7802);CmListEvents[_0x8a57('0x5')](_0x3ac6cf,_0x3c7802);_0x1ca9aa(null);};}for(var e in events){if(events[_0x8a57('0x6')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x8a57('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index bab478d..5620ad5 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 _0xfa10=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','define','CmList','cm_lists','lodash','util','../../config/logger','api'];(function(_0x5f11b8,_0x1074da){var _0x2a4a40=function(_0x52c0c1){while(--_0x52c0c1){_0x5f11b8['push'](_0x5f11b8['shift']());}};_0x2a4a40(++_0x1074da);}(_0xfa10,0x122));var _0x0fa1=function(_0x1c1bbb,_0x38a0b8){_0x1c1bbb=_0x1c1bbb-0x0;var _0x2e667c=_0xfa10[_0x1c1bbb];return _0x2e667c;};'use strict';var _=require(_0x0fa1('0x0'));var util=require(_0x0fa1('0x1'));var logger=require(_0x0fa1('0x2'))(_0x0fa1('0x3'));var moment=require(_0x0fa1('0x4'));var BPromise=require(_0x0fa1('0x5'));var rp=require(_0x0fa1('0x6'));var fs=require('fs');var path=require(_0x0fa1('0x7'));var rimraf=require(_0x0fa1('0x8'));var config=require(_0x0fa1('0x9'));var attributes=require(_0x0fa1('0xa'));module['exports']=function(_0x540240,_0x2b9449){return _0x540240[_0x0fa1('0xb')](_0x0fa1('0xc'),attributes,{'tableName':_0x0fa1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa1bb=['rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x25ae6c,_0x16af0e){var _0x42f510=function(_0x1a84b8){while(--_0x1a84b8){_0x25ae6c['push'](_0x25ae6c['shift']());}};_0x42f510(++_0x16af0e);}(_0xa1bb,0x162));var _0xba1b=function(_0x4b1c9c,_0x5f3098){_0x4b1c9c=_0x4b1c9c-0x0;var _0x865a10=_0xa1bb[_0x4b1c9c];return _0x865a10;};'use strict';var _=require(_0xba1b('0x0'));var util=require(_0xba1b('0x1'));var logger=require(_0xba1b('0x2'))(_0xba1b('0x3'));var moment=require(_0xba1b('0x4'));var BPromise=require('bluebird');var rp=require(_0xba1b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba1b('0x6'));var config=require(_0xba1b('0x7'));var attributes=require(_0xba1b('0x8'));module[_0xba1b('0x9')]=function(_0x595111,_0x2e31a1){return _0x595111[_0xba1b('0xa')](_0xba1b('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 27e2e3a..a5953c9 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 _0x5b9e=['../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3c719e,_0x19719d){var _0x2d09af=function(_0x5b1e8a){while(--_0x5b1e8a){_0x3c719e['push'](_0x3c719e['shift']());}};_0x2d09af(++_0x19719d);}(_0x5b9e,0x111));var _0xe5b9=function(_0x1ff1eb,_0x3acd5d){_0x1ff1eb=_0x1ff1eb-0x0;var _0x1df937=_0x5b9e[_0x1ff1eb];return _0x1df937;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe5b9('0x0'));var rs=require(_0xe5b9('0x1'));var fs=require('fs');var Redis=require(_0xe5b9('0x2'));var db=require(_0xe5b9('0x3'))['db'];var utils=require(_0xe5b9('0x4'));var logger=require(_0xe5b9('0x5'))(_0xe5b9('0x6'));var config=require(_0xe5b9('0x7'));var jayson=require(_0xe5b9('0x8'));var client=jayson[_0xe5b9('0x9')][_0xe5b9('0xa')]({'port':0x232a});config[_0xe5b9('0xb')]=_[_0xe5b9('0xc')](config[_0xe5b9('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xe5b9('0xd'))(new Redis(config[_0xe5b9('0xb')]));require(_0xe5b9('0xe'))[_0xe5b9('0xf')](socket);function respondWithRpcPromise(_0x267b7f,_0xc354ee,_0x50abf1){return new BPromise(function(_0x43c90f,_0x30af37){return client[_0xe5b9('0x10')](_0x267b7f,_0x50abf1)[_0xe5b9('0x11')](function(_0x4b80f0){logger[_0xe5b9('0x12')](_0xe5b9('0x13'),_0xc354ee,_0xe5b9('0x14'));logger[_0xe5b9('0x15')](_0xe5b9('0x16'),_0xc354ee,'request\x20sent',JSON[_0xe5b9('0x17')](_0x4b80f0));if(_0x4b80f0[_0xe5b9('0x18')]){if(_0x4b80f0[_0xe5b9('0x18')][_0xe5b9('0x19')]===0x1f4){logger[_0xe5b9('0x18')]('CmList,\x20%s,\x20%s',_0xc354ee,_0x4b80f0['error']['message']);return _0x30af37(_0x4b80f0[_0xe5b9('0x18')][_0xe5b9('0x1a')]);}logger[_0xe5b9('0x18')](_0xe5b9('0x13'),_0xc354ee,_0x4b80f0[_0xe5b9('0x18')][_0xe5b9('0x1a')]);return _0x43c90f(_0x4b80f0[_0xe5b9('0x18')]['message']);}else{logger[_0xe5b9('0x12')]('CmList,\x20%s,\x20%s',_0xc354ee,'request\x20sent');_0x43c90f(_0x4b80f0['result'][_0xe5b9('0x1a')]);}})[_0xe5b9('0x1b')](function(_0x2f3693){logger['error'](_0xe5b9('0x13'),_0xc354ee,_0x2f3693);_0x30af37(_0x2f3693);});});} \ No newline at end of file +var _0x8b66=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','register','request','then','info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch'];(function(_0x4e86f7,_0x1650a1){var _0x3886d8=function(_0x5dae93){while(--_0x5dae93){_0x4e86f7['push'](_0x4e86f7['shift']());}};_0x3886d8(++_0x1650a1);}(_0x8b66,0x91));var _0x68b6=function(_0x385669,_0x43d386){_0x385669=_0x385669-0x0;var _0x11e2d2=_0x8b66[_0x385669];return _0x11e2d2;};'use strict';var _=require(_0x68b6('0x0'));var util=require(_0x68b6('0x1'));var moment=require(_0x68b6('0x2'));var BPromise=require(_0x68b6('0x3'));var rs=require(_0x68b6('0x4'));var fs=require('fs');var Redis=require(_0x68b6('0x5'));var db=require(_0x68b6('0x6'))['db'];var utils=require(_0x68b6('0x7'));var logger=require(_0x68b6('0x8'))(_0x68b6('0x9'));var config=require('../../config/environment');var jayson=require(_0x68b6('0xa'));var client=jayson[_0x68b6('0xb')][_0x68b6('0xc')]({'port':0x232a});config['redis']=_[_0x68b6('0xd')](config[_0x68b6('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x68b6('0xf'))(new Redis(config[_0x68b6('0xe')]));require('./cmList.socket')[_0x68b6('0x10')](socket);function respondWithRpcPromise(_0x141e17,_0x20764c,_0x3fac95){return new BPromise(function(_0x4fc595,_0x294775){return client[_0x68b6('0x11')](_0x141e17,_0x3fac95)[_0x68b6('0x12')](function(_0x5920a1){logger[_0x68b6('0x13')](_0x68b6('0x14'),_0x20764c,'request\x20sent');logger[_0x68b6('0x15')](_0x68b6('0x16'),_0x20764c,'request\x20sent',JSON[_0x68b6('0x17')](_0x5920a1));if(_0x5920a1[_0x68b6('0x18')]){if(_0x5920a1[_0x68b6('0x18')][_0x68b6('0x19')]===0x1f4){logger['error'](_0x68b6('0x14'),_0x20764c,_0x5920a1['error']['message']);return _0x294775(_0x5920a1['error']['message']);}logger['error'](_0x68b6('0x14'),_0x20764c,_0x5920a1['error']['message']);return _0x4fc595(_0x5920a1['error'][_0x68b6('0x1a')]);}else{logger['info'](_0x68b6('0x14'),_0x20764c,_0x68b6('0x1b'));_0x4fc595(_0x5920a1['result']['message']);}})[_0x68b6('0x1c')](function(_0xccb5be){logger[_0x68b6('0x18')]('CmList,\x20%s,\x20%s',_0x20764c,_0xccb5be);_0x294775(_0xccb5be);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 888fbaf..f424a81 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 _0x9a5a=['emit','removeListener','register','length','./cmList.events','save','remove','update'];(function(_0x330f6c,_0x36ae3e){var _0x21311a=function(_0x214458){while(--_0x214458){_0x330f6c['push'](_0x330f6c['shift']());}};_0x21311a(++_0x36ae3e);}(_0x9a5a,0x194));var _0xa9a5=function(_0x54f9dc,_0x46467b){_0x54f9dc=_0x54f9dc-0x0;var _0x278be5=_0x9a5a[_0x54f9dc];return _0x278be5;};'use strict';var CmListEvents=require(_0xa9a5('0x0'));var events=[_0xa9a5('0x1'),_0xa9a5('0x2'),_0xa9a5('0x3')];function createListener(_0x198d2a,_0x500287){return function(_0x28e2b3){_0x500287[_0xa9a5('0x4')](_0x198d2a,_0x28e2b3);};}function removeListener(_0x230710,_0x1080a9){return function(){CmListEvents[_0xa9a5('0x5')](_0x230710,_0x1080a9);};}exports[_0xa9a5('0x6')]=function(_0x4a73f4){for(var _0xb0ccd9=0x0,_0x37e93b=events[_0xa9a5('0x7')];_0xb0ccd9<_0x37e93b;_0xb0ccd9++){var _0x1eafa6=events[_0xb0ccd9];var _0x24e1bd=createListener('cmList:'+_0x1eafa6,_0x4a73f4);CmListEvents['on'](_0x1eafa6,_0x24e1bd);}}; \ No newline at end of file +var _0xf072=['save','remove','emit','removeListener','register','length','cmList:','./cmList.events'];(function(_0x3aae07,_0x36cecf){var _0x530551=function(_0x39169f){while(--_0x39169f){_0x3aae07['push'](_0x3aae07['shift']());}};_0x530551(++_0x36cecf);}(_0xf072,0x1cf));var _0x2f07=function(_0x5cdb8d,_0xad2c83){_0x5cdb8d=_0x5cdb8d-0x0;var _0x596af4=_0xf072[_0x5cdb8d];return _0x596af4;};'use strict';var CmListEvents=require(_0x2f07('0x0'));var events=[_0x2f07('0x1'),_0x2f07('0x2'),'update'];function createListener(_0x3c1c25,_0x5f20e3){return function(_0x19cbb9){_0x5f20e3[_0x2f07('0x3')](_0x3c1c25,_0x19cbb9);};}function removeListener(_0x1536c3,_0x48d7b6){return function(){CmListEvents[_0x2f07('0x4')](_0x1536c3,_0x48d7b6);};}exports[_0x2f07('0x5')]=function(_0x3643bb){for(var _0x2e6422=0x0,_0x235418=events[_0x2f07('0x6')];_0x2e6422<_0x235418;_0x2e6422++){var _0x33b99c=events[_0x2e6422];var _0x379b2e=createListener(_0x2f07('0x7')+_0x33b99c,_0x3643bb);CmListEvents['on'](_0x33b99c,_0x379b2e);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 14a1b43..b15912d 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 _0xace3=['../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','describe','/:id','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','delete','/:id/dispositions','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x542fc9,_0x19be0f){var _0x14f212=function(_0x13fa7a){while(--_0x13fa7a){_0x542fc9['push'](_0x542fc9['shift']());}};_0x14f212(++_0x19be0f);}(_0xace3,0xac));var _0x3ace=function(_0x4ca387,_0x37d426){_0x4ca387=_0x4ca387-0x0;var _0x2c60d9=_0xace3[_0x4ca387];return _0x2c60d9;};'use strict';var multer=require(_0x3ace('0x0'));var util=require(_0x3ace('0x1'));var path=require(_0x3ace('0x2'));var timeout=require(_0x3ace('0x3'));var express=require(_0x3ace('0x4'));var router=express[_0x3ace('0x5')]();var fs_extra=require(_0x3ace('0x6'));var auth=require(_0x3ace('0x7'));var interaction=require(_0x3ace('0x8'));var config=require(_0x3ace('0x9'));var controller=require(_0x3ace('0xa'));router[_0x3ace('0xb')]('/',auth[_0x3ace('0xc')](),controller[_0x3ace('0xd')]);router[_0x3ace('0xb')]('/describe',auth[_0x3ace('0xc')](),controller[_0x3ace('0xe')]);router[_0x3ace('0xb')](_0x3ace('0xf'),auth[_0x3ace('0xc')](),controller[_0x3ace('0x10')]);router[_0x3ace('0xb')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x3ace('0x11')]);router['get'](_0x3ace('0x12'),auth[_0x3ace('0xc')](),controller[_0x3ace('0x13')]);router[_0x3ace('0xb')](_0x3ace('0x14'),auth[_0x3ace('0xc')](),controller[_0x3ace('0x15')]);router['get'](_0x3ace('0x16'),auth['isAuthenticated'](),controller[_0x3ace('0x17')]);router[_0x3ace('0xb')](_0x3ace('0x18'),auth['isAuthenticated'](),controller[_0x3ace('0x19')]);router[_0x3ace('0x1a')]('/',auth[_0x3ace('0xc')](),controller[_0x3ace('0x1b')]);router[_0x3ace('0x1a')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x3ace('0x1c')]);router[_0x3ace('0x1a')](_0x3ace('0x12'),auth['isAuthenticated'](),controller['addContacts']);router['post'](_0x3ace('0x16'),auth[_0x3ace('0xc')](),controller[_0x3ace('0x1d')]);router[_0x3ace('0x1a')](_0x3ace('0x18'),auth['isAuthenticated'](),controller[_0x3ace('0x1e')]);router[_0x3ace('0x1f')](_0x3ace('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x3ace('0x20')](_0x3ace('0xf'),auth[_0x3ace('0xc')](),controller['destroy']);router[_0x3ace('0x20')](_0x3ace('0x21'),auth[_0x3ace('0xc')](),controller[_0x3ace('0x22')]);router[_0x3ace('0x20')](_0x3ace('0x18'),auth[_0x3ace('0xc')](),controller['removeAgents']);module[_0x3ace('0x23')]=router; \ No newline at end of file +var _0x91b3=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','isAuthenticated','index','/describe','describe','/:id','getDispositions','/:id/contacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','post','/:id/dispositions','addDisposition','addContacts','addCustomField','addAgents','update','delete','destroy','removeDispositions','removeAgents'];(function(_0x588f1e,_0x239528){var _0x2bcf27=function(_0x505371){while(--_0x505371){_0x588f1e['push'](_0x588f1e['shift']());}};_0x2bcf27(++_0x239528);}(_0x91b3,0x1e1));var _0x391b=function(_0x54a003,_0x182386){_0x54a003=_0x54a003-0x0;var _0x481012=_0x91b3[_0x54a003];return _0x481012;};'use strict';var multer=require(_0x391b('0x0'));var util=require(_0x391b('0x1'));var path=require('path');var timeout=require(_0x391b('0x2'));var express=require(_0x391b('0x3'));var router=express[_0x391b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x391b('0x5'));var interaction=require(_0x391b('0x6'));var config=require('../../config/environment');var controller=require(_0x391b('0x7'));router[_0x391b('0x8')]('/',auth[_0x391b('0x9')](),controller[_0x391b('0xa')]);router[_0x391b('0x8')](_0x391b('0xb'),auth[_0x391b('0x9')](),controller[_0x391b('0xc')]);router[_0x391b('0x8')](_0x391b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x391b('0x8')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x391b('0xe')]);router[_0x391b('0x8')](_0x391b('0xf'),auth['isAuthenticated'](),controller['getContacts']);router[_0x391b('0x8')](_0x391b('0x10'),auth['isAuthenticated'](),controller['getContactsCsv']);router[_0x391b('0x8')](_0x391b('0x11'),auth[_0x391b('0x9')](),controller[_0x391b('0x12')]);router[_0x391b('0x8')](_0x391b('0x13'),auth[_0x391b('0x9')](),controller['getAgents']);router[_0x391b('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x391b('0x14')](_0x391b('0x15'),auth[_0x391b('0x9')](),controller[_0x391b('0x16')]);router[_0x391b('0x14')](_0x391b('0xf'),auth['isAuthenticated'](),controller[_0x391b('0x17')]);router[_0x391b('0x14')](_0x391b('0x11'),auth[_0x391b('0x9')](),controller[_0x391b('0x18')]);router[_0x391b('0x14')](_0x391b('0x13'),auth[_0x391b('0x9')](),controller[_0x391b('0x19')]);router['put'](_0x391b('0xd'),auth[_0x391b('0x9')](),controller[_0x391b('0x1a')]);router[_0x391b('0x1b')](_0x391b('0xd'),auth[_0x391b('0x9')](),controller[_0x391b('0x1c')]);router[_0x391b('0x1b')](_0x391b('0x15'),auth[_0x391b('0x9')](),controller[_0x391b('0x1d')]);router[_0x391b('0x1b')](_0x391b('0x13'),auth[_0x391b('0x9')](),controller[_0x391b('0x1e')]);module[_0x391b('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 4f5df0b..be4756d 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 _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x519a89,_0x3c58d6){var _0x4b7c10=function(_0x316bdc){while(--_0x316bdc){_0x519a89['push'](_0x519a89['shift']());}};_0x4b7c10(++_0x3c58d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x342f88,_0x31a678){var _0xfa8bb3=function(_0x549303){while(--_0x549303){_0x342f88['push'](_0x342f88['shift']());}};_0xfa8bb3(++_0x31a678);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('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 1e7b14c..946fcbd 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 _0x1b8e=['destroy','error','stack','name','body','Condition','find','params','catch','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','reject','save','update','then'];(function(_0x5bb077,_0x314590){var _0x487afc=function(_0x1293b3){while(--_0x1293b3){_0x5bb077['push'](_0x5bb077['shift']());}};_0x487afc(++_0x314590);}(_0x1b8e,0x14b));var _0xe1b8=function(_0x139862,_0x6f693f){_0x139862=_0x139862-0x0;var _0x254d52=_0x1b8e[_0x139862];return _0x254d52;};'use strict';var pdf=require(_0xe1b8('0x0'));var emlformat=require(_0xe1b8('0x1'));var rimraf=require(_0xe1b8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe1b8('0x3'));var rp=require('request-promise');var moment=require(_0xe1b8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe1b8('0x5'));var util=require('util');var path=require(_0xe1b8('0x6'));var sox=require(_0xe1b8('0x7'));var csv=require('to-csv');var ejs=require(_0xe1b8('0x8'));var fs=require('fs');var fs_extra=require(_0xe1b8('0x9'));var _=require(_0xe1b8('0xa'));var squel=require(_0xe1b8('0xb'));var crypto=require(_0xe1b8('0xc'));var jsforce=require(_0xe1b8('0xd'));var deskjs=require(_0xe1b8('0xe'));var toCsv=require(_0xe1b8('0xf'));var querystring=require(_0xe1b8('0x10'));var Papa=require(_0xe1b8('0x11'));var Redis=require('ioredis');var authService=require(_0xe1b8('0x12'));var qs=require(_0xe1b8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe1b8('0x14'));var logger=require('../../config/logger')(_0xe1b8('0x15'));var utils=require('../../config/utils');var config=require(_0xe1b8('0x16'));var licenseUtil=require(_0xe1b8('0x17'));var db=require(_0xe1b8('0x18'))['db'];function respondWithStatusCode(_0x2fa9e1,_0x466e8d){_0x466e8d=_0x466e8d||0xcc;return function(_0xd3ed9e){if(_0xd3ed9e){return _0x2fa9e1[_0xe1b8('0x19')](_0x466e8d);}return _0x2fa9e1['status'](_0x466e8d)[_0xe1b8('0x1a')]();};}function respondWithResult(_0x259948,_0x45268c){_0x45268c=_0x45268c||0xc8;return function(_0xf8bfb7){if(_0xf8bfb7){return _0x259948[_0xe1b8('0x1b')](_0x45268c)[_0xe1b8('0x1c')](_0xf8bfb7);}};}function respondWithFilteredResult(_0x3d3f23,_0x57459a){return function(_0x1ba0b9){if(_0x1ba0b9){var _0x3f7b2f=_0x1ba0b9['count'],_0x581914=_0x57459a[_0xe1b8('0x1d')],_0x557ec8=_0x57459a[_0xe1b8('0x1d')]+_0x57459a[_0xe1b8('0x1e')],_0x8da92f;if(_0x557ec8>=_0x3f7b2f){_0x557ec8=_0x3f7b2f;_0x8da92f=0xc8;}else{_0x8da92f=0xce;}_0x3d3f23[_0xe1b8('0x1b')](_0x8da92f);return _0x3d3f23[_0xe1b8('0x1f')](_0xe1b8('0x20'),_0x581914+'-'+_0x557ec8+'/'+_0x3f7b2f)[_0xe1b8('0x1c')](_0x1ba0b9);}return null;};}function patchUpdates(_0x2d680b){return function(_0x8e0ec0){try{jsonpatch['apply'](_0x8e0ec0,_0x2d680b,!![]);}catch(_0x589dbf){return BPromise[_0xe1b8('0x21')](_0x589dbf);}return _0x8e0ec0[_0xe1b8('0x22')]();};}function saveUpdates(_0x230fb2,_0x36dfa9){return function(_0x48d3e8){if(_0x48d3e8){return _0x48d3e8[_0xe1b8('0x23')](_0x230fb2)[_0xe1b8('0x24')](function(_0x1b7223){return _0x1b7223;});}return null;};}function removeEntity(_0x42588e,_0x35ae12){return function(_0x2c96e7){if(_0x2c96e7){return _0x2c96e7[_0xe1b8('0x25')]()['then'](function(){_0x42588e[_0xe1b8('0x1b')](0xcc)[_0xe1b8('0x1a')]();});}};}function handleEntityNotFound(_0x539305,_0x30e6d0){return function(_0x1306e9){if(!_0x1306e9){_0x539305[_0xe1b8('0x19')](0x194);}return _0x1306e9;};}function handleError(_0x4517ab,_0x491e55){_0x491e55=_0x491e55||0x1f4;return function(_0x4761c8){logger[_0xe1b8('0x26')](_0x4761c8[_0xe1b8('0x27')]);if(_0x4761c8[_0xe1b8('0x28')]){delete _0x4761c8[_0xe1b8('0x28')];}_0x4517ab[_0xe1b8('0x1b')](_0x491e55)['send'](_0x4761c8);};}exports[_0xe1b8('0x23')]=function(_0x207991,_0x50d6e2){if(_0x207991[_0xe1b8('0x29')]['id']){delete _0x207991[_0xe1b8('0x29')]['id'];}return db[_0xe1b8('0x2a')][_0xe1b8('0x2b')]({'where':{'id':_0x207991[_0xe1b8('0x2c')]['id']}})[_0xe1b8('0x24')](handleEntityNotFound(_0x50d6e2,null))[_0xe1b8('0x24')](saveUpdates(_0x207991[_0xe1b8('0x29')],null))['then'](respondWithResult(_0x50d6e2,null))[_0xe1b8('0x2d')](handleError(_0x50d6e2,null));};exports[_0xe1b8('0x25')]=function(_0x25e2e6,_0x55fe72){return db[_0xe1b8('0x2a')][_0xe1b8('0x2b')]({'where':{'id':_0x25e2e6[_0xe1b8('0x2c')]['id']}})['then'](handleEntityNotFound(_0x55fe72,null))[_0xe1b8('0x24')](removeEntity(_0x55fe72,null))[_0xe1b8('0x2d')](handleError(_0x55fe72,null));}; \ No newline at end of file +var _0x2ce0=['catch','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','Content-Range','apply','save','update','then','destroy','end','stack','name','send','body','Condition','find','params'];(function(_0x10eb6b,_0x3fe155){var _0x3a3ab1=function(_0x467f24){while(--_0x467f24){_0x10eb6b['push'](_0x10eb6b['shift']());}};_0x3a3ab1(++_0x3fe155);}(_0x2ce0,0x82));var _0x02ce=function(_0x450c60,_0x3888b0){_0x450c60=_0x450c60-0x0;var _0xf8a601=_0x2ce0[_0x450c60];return _0xf8a601;};'use strict';var pdf=require(_0x02ce('0x0'));var emlformat=require(_0x02ce('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x02ce('0x2'));var jsonpatch=require(_0x02ce('0x3'));var rp=require(_0x02ce('0x4'));var moment=require(_0x02ce('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x02ce('0x6'));var util=require(_0x02ce('0x7'));var path=require(_0x02ce('0x8'));var sox=require(_0x02ce('0x9'));var csv=require(_0x02ce('0xa'));var ejs=require(_0x02ce('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x02ce('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x02ce('0xd'));var deskjs=require(_0x02ce('0xe'));var toCsv=require('to-csv');var querystring=require(_0x02ce('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x02ce('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x02ce('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x02ce('0x12'))(_0x02ce('0x13'));var utils=require(_0x02ce('0x14'));var config=require(_0x02ce('0x15'));var licenseUtil=require(_0x02ce('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f609d,_0x1607c8){_0x1607c8=_0x1607c8||0xcc;return function(_0x1095d9){if(_0x1095d9){return _0x1f609d[_0x02ce('0x17')](_0x1607c8);}return _0x1f609d[_0x02ce('0x18')](_0x1607c8)['end']();};}function respondWithResult(_0x6a5390,_0x18bc55){_0x18bc55=_0x18bc55||0xc8;return function(_0x48244f){if(_0x48244f){return _0x6a5390[_0x02ce('0x18')](_0x18bc55)[_0x02ce('0x19')](_0x48244f);}};}function respondWithFilteredResult(_0x4008c0,_0x411b59){return function(_0x198f25){if(_0x198f25){var _0x7939e7=_0x198f25[_0x02ce('0x1a')],_0x36c132=_0x411b59[_0x02ce('0x1b')],_0x302c54=_0x411b59[_0x02ce('0x1b')]+_0x411b59['limit'],_0x52d074;if(_0x302c54>=_0x7939e7){_0x302c54=_0x7939e7;_0x52d074=0xc8;}else{_0x52d074=0xce;}_0x4008c0['status'](_0x52d074);return _0x4008c0['set'](_0x02ce('0x1c'),_0x36c132+'-'+_0x302c54+'/'+_0x7939e7)[_0x02ce('0x19')](_0x198f25);}return null;};}function patchUpdates(_0x4a0e1c){return function(_0x55f9b0){try{jsonpatch[_0x02ce('0x1d')](_0x55f9b0,_0x4a0e1c,!![]);}catch(_0x544f1f){return BPromise['reject'](_0x544f1f);}return _0x55f9b0[_0x02ce('0x1e')]();};}function saveUpdates(_0x3df87e,_0x155835){return function(_0x2e59ec){if(_0x2e59ec){return _0x2e59ec[_0x02ce('0x1f')](_0x3df87e)[_0x02ce('0x20')](function(_0x20cb09){return _0x20cb09;});}return null;};}function removeEntity(_0x4933b7,_0x2ac14a){return function(_0x22d937){if(_0x22d937){return _0x22d937[_0x02ce('0x21')]()['then'](function(){_0x4933b7[_0x02ce('0x18')](0xcc)[_0x02ce('0x22')]();});}};}function handleEntityNotFound(_0x1fb4c9,_0x16a178){return function(_0x58d1b5){if(!_0x58d1b5){_0x1fb4c9['sendStatus'](0x194);}return _0x58d1b5;};}function handleError(_0x55535c,_0x120fb7){_0x120fb7=_0x120fb7||0x1f4;return function(_0x3f266f){logger['error'](_0x3f266f[_0x02ce('0x23')]);if(_0x3f266f[_0x02ce('0x24')]){delete _0x3f266f[_0x02ce('0x24')];}_0x55535c['status'](_0x120fb7)[_0x02ce('0x25')](_0x3f266f);};}exports[_0x02ce('0x1f')]=function(_0x39f1b1,_0x4ef67b){if(_0x39f1b1[_0x02ce('0x26')]['id']){delete _0x39f1b1[_0x02ce('0x26')]['id'];}return db[_0x02ce('0x27')][_0x02ce('0x28')]({'where':{'id':_0x39f1b1[_0x02ce('0x29')]['id']}})[_0x02ce('0x20')](handleEntityNotFound(_0x4ef67b,null))[_0x02ce('0x20')](saveUpdates(_0x39f1b1[_0x02ce('0x26')],null))['then'](respondWithResult(_0x4ef67b,null))[_0x02ce('0x2a')](handleError(_0x4ef67b,null));};exports[_0x02ce('0x21')]=function(_0x2831ca,_0x28cfe9){return db[_0x02ce('0x27')][_0x02ce('0x28')]({'where':{'id':_0x2831ca[_0x02ce('0x29')]['id']}})[_0x02ce('0x20')](handleEntityNotFound(_0x28cfe9,null))['then'](removeEntity(_0x28cfe9,null))[_0x02ce('0x2a')](handleError(_0x28cfe9,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 1d2e070..d06406a 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 _0x9e8e=['define','Condition','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes'];(function(_0xf1b134,_0xb399dd){var _0x139dbb=function(_0xe7a88d){while(--_0xe7a88d){_0xf1b134['push'](_0xf1b134['shift']());}};_0x139dbb(++_0xb399dd);}(_0x9e8e,0x13a));var _0xe9e8=function(_0x4094e2,_0x26d283){_0x4094e2=_0x4094e2-0x0;var _0x272039=_0x9e8e[_0x4094e2];return _0x272039;};'use strict';var _=require(_0xe9e8('0x0'));var util=require(_0xe9e8('0x1'));var logger=require(_0xe9e8('0x2'))('api');var moment=require(_0xe9e8('0x3'));var BPromise=require(_0xe9e8('0x4'));var rp=require(_0xe9e8('0x5'));var fs=require('fs');var path=require(_0xe9e8('0x6'));var rimraf=require(_0xe9e8('0x7'));var config=require(_0xe9e8('0x8'));var attributes=require(_0xe9e8('0x9'));module['exports']=function(_0x1ee832,_0x1a249a){return _0x1ee832[_0xe9e8('0xa')](_0xe9e8('0xb'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf881=['moment','bluebird','../../config/environment','exports','define','Condition','util','../../config/logger'];(function(_0x47169b,_0x4bc0d1){var _0x11a275=function(_0x3eea55){while(--_0x3eea55){_0x47169b['push'](_0x47169b['shift']());}};_0x11a275(++_0x4bc0d1);}(_0xf881,0xde));var _0x1f88=function(_0x27bed4,_0xf17e71){_0x27bed4=_0x27bed4-0x0;var _0x412e9d=_0xf881[_0x27bed4];return _0x412e9d;};'use strict';var _=require('lodash');var util=require(_0x1f88('0x0'));var logger=require(_0x1f88('0x1'))('api');var moment=require(_0x1f88('0x2'));var BPromise=require(_0x1f88('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1f88('0x4'));var attributes=require('./condition.attributes');module[_0x1f88('0x5')]=function(_0x5e09c6,_0x1f694b){return _0x5e09c6[_0x1f88('0x6')](_0x1f88('0x7'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index aebac3e..aad8788 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 _0x38f2=['then','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x3445cb,_0x592767){var _0x1fb70b=function(_0x58d14e){while(--_0x58d14e){_0x3445cb['push'](_0x3445cb['shift']());}};_0x1fb70b(++_0x592767);}(_0x38f2,0x1d8));var _0x238f=function(_0x1f3b9f,_0x3326eb){_0x1f3b9f=_0x1f3b9f-0x0;var _0xfbf050=_0x38f2[_0x1f3b9f];return _0xfbf050;};'use strict';var _=require(_0x238f('0x0'));var util=require(_0x238f('0x1'));var moment=require(_0x238f('0x2'));var BPromise=require('bluebird');var rs=require(_0x238f('0x3'));var fs=require('fs');var Redis=require(_0x238f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x238f('0x5'));var logger=require('../../config/logger')(_0x238f('0x6'));var config=require(_0x238f('0x7'));var jayson=require(_0x238f('0x8'));var client=jayson[_0x238f('0x9')][_0x238f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x140ddb,_0x429168,_0x2f612e){return new BPromise(function(_0x50d6ce,_0x9ad975){return client[_0x238f('0xb')](_0x140ddb,_0x2f612e)[_0x238f('0xc')](function(_0x84b69b){logger['info'](_0x238f('0xd'),_0x429168,_0x238f('0xe'));logger[_0x238f('0xf')]('Condition,\x20%s,\x20%s,\x20%s',_0x429168,_0x238f('0xe'),JSON[_0x238f('0x10')](_0x84b69b));if(_0x84b69b[_0x238f('0x11')]){if(_0x84b69b[_0x238f('0x11')][_0x238f('0x12')]===0x1f4){logger[_0x238f('0x11')](_0x238f('0xd'),_0x429168,_0x84b69b['error'][_0x238f('0x13')]);return _0x9ad975(_0x84b69b[_0x238f('0x11')][_0x238f('0x13')]);}logger[_0x238f('0x11')](_0x238f('0xd'),_0x429168,_0x84b69b[_0x238f('0x11')]['message']);return _0x50d6ce(_0x84b69b['error'][_0x238f('0x13')]);}else{logger[_0x238f('0x14')]('Condition,\x20%s,\x20%s',_0x429168,'request\x20sent');_0x50d6ce(_0x84b69b[_0x238f('0x15')][_0x238f('0x13')]);}})['catch'](function(_0x580c2e){logger[_0x238f('0x11')](_0x238f('0xd'),_0x429168,_0x580c2e);_0x9ad975(_0x580c2e);});});} \ No newline at end of file +var _0x259e=['message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error'];(function(_0x1fa759,_0x4ecdce){var _0x2da9f4=function(_0x463e2a){while(--_0x463e2a){_0x1fa759['push'](_0x1fa759['shift']());}};_0x2da9f4(++_0x4ecdce);}(_0x259e,0x1de));var _0xe259=function(_0x2389ab,_0x5ac976){_0x2389ab=_0x2389ab-0x0;var _0x101346=_0x259e[_0x2389ab];return _0x101346;};'use strict';var _=require(_0xe259('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe259('0x1'));var rs=require(_0xe259('0x2'));var fs=require('fs');var Redis=require(_0xe259('0x3'));var db=require(_0xe259('0x4'))['db'];var utils=require(_0xe259('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe259('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe259('0x7')][_0xe259('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5040d6,_0x16c068,_0x4fe214){return new BPromise(function(_0x413150,_0x710bd8){return client[_0xe259('0x9')](_0x5040d6,_0x4fe214)['then'](function(_0x583aa7){logger[_0xe259('0xa')](_0xe259('0xb'),_0x16c068,_0xe259('0xc'));logger[_0xe259('0xd')](_0xe259('0xe'),_0x16c068,'request\x20sent',JSON['stringify'](_0x583aa7));if(_0x583aa7['error']){if(_0x583aa7['error']['code']===0x1f4){logger[_0xe259('0xf')]('Condition,\x20%s,\x20%s',_0x16c068,_0x583aa7['error']['message']);return _0x710bd8(_0x583aa7[_0xe259('0xf')][_0xe259('0x10')]);}logger['error']('Condition,\x20%s,\x20%s',_0x16c068,_0x583aa7[_0xe259('0xf')][_0xe259('0x10')]);return _0x413150(_0x583aa7[_0xe259('0xf')][_0xe259('0x10')]);}else{logger[_0xe259('0xa')](_0xe259('0xb'),_0x16c068,'request\x20sent');_0x413150(_0x583aa7[_0xe259('0x11')][_0xe259('0x10')]);}})[_0xe259('0x12')](function(_0x5ca36f){logger[_0xe259('0xf')]('Condition,\x20%s,\x20%s',_0x16c068,_0x5ca36f);_0x710bd8(_0x5ca36f);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index e105324..0e9aaa0 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 _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','multer','util','path'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')](_0x7995('0xa'),auth[_0x7995('0xb')](),controller[_0x7995('0xc')]);router[_0x7995('0xd')]('/:id',auth[_0x7995('0xb')](),controller[_0x7995('0xe')]);module['exports']=router; \ No newline at end of file +var _0x7a54=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated','delete','/:id','destroy','multer','util','path','express'];(function(_0xc054d2,_0x32143b){var _0x41dab1=function(_0x3494ef){while(--_0x3494ef){_0xc054d2['push'](_0xc054d2['shift']());}};_0x41dab1(++_0x32143b);}(_0x7a54,0x106));var _0x47a5=function(_0x29aa7e,_0x4aeb15){_0x29aa7e=_0x29aa7e-0x0;var _0x37b1d9=_0x7a54[_0x29aa7e];return _0x37b1d9;};'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')]('/:id',auth[_0x47a5('0xa')](),controller['update']);router[_0x47a5('0xb')](_0x47a5('0xc'),auth['isAuthenticated'](),controller[_0x47a5('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 132b2ae..87ed0e6 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 _0x88b0=['sequelize','exports','STRING'];(function(_0xf166de,_0x335fa7){var _0x4434f7=function(_0x1c5121){while(--_0x1c5121){_0xf166de['push'](_0xf166de['shift']());}};_0x4434f7(++_0x335fa7);}(_0x88b0,0x1cb));var _0x088b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x88b0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x088b('0x0'));module[_0x088b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x088b('0x2')]}}; \ No newline at end of file +var _0x046e=['sequelize','STRING'];(function(_0x12651a,_0x31a09c){var _0x556667=function(_0x5b7056){while(--_0x5b7056){_0x12651a['push'](_0x12651a['shift']());}};_0x556667(++_0x31a09c);}(_0x046e,0x1b4));var _0xe046=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x046e[_0x4baae2];return _0x1a2285;};'use strict';var Sequelize=require(_0xe046('0x0'));module['exports']={'name':{'type':Sequelize[_0xe046('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0xe046('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index c16915e..4b296ba 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 _0x0ea9=['socket.io-emitter','./dashboard.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','then','destroy','get','CustomDashboards','error','stack','name','send','index','map','Dashboard','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','omit','createdAt','updatedAt','body','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','stringify','addItem','DashboardId','DashboardItem','filter','getItems','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','defaults'];(function(_0x163a01,_0x573026){var _0x24d1d8=function(_0x59cfc5){while(--_0x59cfc5){_0x163a01['push'](_0x163a01['shift']());}};_0x24d1d8(++_0x573026);}(_0x0ea9,0x132));var _0x90ea=function(_0x5916d1,_0x2180fa){_0x5916d1=_0x5916d1-0x0;var _0xd30a64=_0x0ea9[_0x5916d1];return _0xd30a64;};'use strict';var pdf=require(_0x90ea('0x0'));var emlformat=require(_0x90ea('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x90ea('0x2'));var jsonpatch=require(_0x90ea('0x3'));var rp=require(_0x90ea('0x4'));var moment=require(_0x90ea('0x5'));var BPromise=require(_0x90ea('0x6'));var Mustache=require('mustache');var util=require(_0x90ea('0x7'));var path=require(_0x90ea('0x8'));var sox=require('sox');var csv=require(_0x90ea('0x9'));var ejs=require(_0x90ea('0xa'));var fs=require('fs');var fs_extra=require(_0x90ea('0xb'));var _=require(_0x90ea('0xc'));var squel=require('squel');var crypto=require(_0x90ea('0xd'));var jsforce=require(_0x90ea('0xe'));var deskjs=require(_0x90ea('0xf'));var toCsv=require(_0x90ea('0x9'));var querystring=require('querystring');var Papa=require(_0x90ea('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x90ea('0x11'));var as=require(_0x90ea('0x12'));var hardwareService=require(_0x90ea('0x13'));var logger=require('../../config/logger')(_0x90ea('0x14'));var utils=require(_0x90ea('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x90ea('0x16')]=_[_0x90ea('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x90ea('0x18'))(new Redis(config['redis']));require(_0x90ea('0x19'))[_0x90ea('0x1a')](socket);function respondWithStatusCode(_0x3f7681,_0x43dc89){_0x43dc89=_0x43dc89||0xcc;return function(_0x5934d3){if(_0x5934d3){return _0x3f7681[_0x90ea('0x1b')](_0x43dc89);}return _0x3f7681['status'](_0x43dc89)[_0x90ea('0x1c')]();};}function respondWithResult(_0x4f34fa,_0x4bd452){_0x4bd452=_0x4bd452||0xc8;return function(_0x160ffa){if(_0x160ffa){return _0x4f34fa[_0x90ea('0x1d')](_0x4bd452)['json'](_0x160ffa);}};}function respondWithFilteredResult(_0x36612d,_0x27ab80){return function(_0x46bcee){if(_0x46bcee){var _0x4a87bf=_0x46bcee[_0x90ea('0x1e')],_0xb4e3cb=_0x27ab80[_0x90ea('0x1f')],_0x9a6c62=_0x27ab80[_0x90ea('0x1f')]+_0x27ab80[_0x90ea('0x20')],_0x20fbff;if(_0x9a6c62>=_0x4a87bf){_0x9a6c62=_0x4a87bf;_0x20fbff=0xc8;}else{_0x20fbff=0xce;}_0x36612d[_0x90ea('0x1d')](_0x20fbff);return _0x36612d[_0x90ea('0x21')]('Content-Range',_0xb4e3cb+'-'+_0x9a6c62+'/'+_0x4a87bf)[_0x90ea('0x22')](_0x46bcee);}return null;};}function patchUpdates(_0x4b813b){return function(_0x46ba36){try{jsonpatch[_0x90ea('0x23')](_0x46ba36,_0x4b813b,!![]);}catch(_0x188e13){return BPromise[_0x90ea('0x24')](_0x188e13);}return _0x46ba36['save']();};}function saveUpdates(_0x3b10c5,_0x334462){return function(_0x4fb0d5){if(_0x4fb0d5){return _0x4fb0d5['update'](_0x3b10c5)[_0x90ea('0x25')](function(_0x24a211){return _0x24a211;});}return null;};}function removeEntity(_0x45053f,_0x3c506f){return function(_0x368998){if(_0x368998){return _0x368998[_0x90ea('0x26')]()[_0x90ea('0x25')](function(){var _0x21ddbf=_0x368998[_0x90ea('0x27')]({'plain':!![]});var _0x2e27e7=_0x90ea('0x28');return db['UserProfileResource'][_0x90ea('0x26')]({'where':{'type':_0x2e27e7,'resourceId':_0x21ddbf['id']}})[_0x90ea('0x25')](function(){return _0x368998;});})[_0x90ea('0x25')](function(){_0x45053f[_0x90ea('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x493eee,_0x5e9266){return function(_0x14ef4d){if(!_0x14ef4d){_0x493eee['sendStatus'](0x194);}return _0x14ef4d;};}function handleError(_0x1859a7,_0x56eee8){_0x56eee8=_0x56eee8||0x1f4;return function(_0x3894e8){logger[_0x90ea('0x29')](_0x3894e8[_0x90ea('0x2a')]);if(_0x3894e8[_0x90ea('0x2b')]){delete _0x3894e8[_0x90ea('0x2b')];}_0x1859a7[_0x90ea('0x1d')](_0x56eee8)[_0x90ea('0x2c')](_0x3894e8);};}exports[_0x90ea('0x2d')]=function(_0xb8873b,_0x403035){var _0x3d4779={},_0x5ef2ae={},_0x43bd0e={'count':0x0,'rows':[]};var _0x4cc9f3=_[_0x90ea('0x2e')](db[_0x90ea('0x2f')][_0x90ea('0x30')],function(_0x38b531){return{'name':_0x38b531['fieldName'],'type':_0x38b531[_0x90ea('0x31')][_0x90ea('0x32')]};});_0x5ef2ae['model']=_[_0x90ea('0x2e')](_0x4cc9f3,'name');_0x5ef2ae[_0x90ea('0x33')]=_[_0x90ea('0x34')](_0xb8873b[_0x90ea('0x33')]);_0x5ef2ae[_0x90ea('0x35')]=_[_0x90ea('0x36')](_0x5ef2ae[_0x90ea('0x37')],_0x5ef2ae['query']);_0x3d4779['attributes']=_[_0x90ea('0x36')](_0x5ef2ae[_0x90ea('0x37')],qs[_0x90ea('0x38')](_0xb8873b[_0x90ea('0x33')]['fields']));_0x3d4779[_0x90ea('0x39')]=_0x3d4779[_0x90ea('0x39')]['length']?_0x3d4779['attributes']:_0x5ef2ae[_0x90ea('0x37')];if(!_0xb8873b[_0x90ea('0x33')][_0x90ea('0x3a')]('nolimit')){_0x3d4779[_0x90ea('0x20')]=qs[_0x90ea('0x20')](_0xb8873b[_0x90ea('0x33')][_0x90ea('0x20')]);_0x3d4779[_0x90ea('0x1f')]=qs[_0x90ea('0x1f')](_0xb8873b[_0x90ea('0x33')]['offset']);}_0x3d4779[_0x90ea('0x3b')]=qs['sort'](_0xb8873b[_0x90ea('0x33')][_0x90ea('0x3c')]);_0x3d4779['where']=qs[_0x90ea('0x35')](_[_0x90ea('0x3d')](_0xb8873b['query'],_0x5ef2ae[_0x90ea('0x35')]),_0x4cc9f3);if(_0xb8873b[_0x90ea('0x33')]['filter']){_0x3d4779[_0x90ea('0x3e')]=_[_0x90ea('0x3f')](_0x3d4779[_0x90ea('0x3e')],{'$or':_['map'](_0x4cc9f3,function(_0x27c5b9){if(_0x27c5b9['type']!==_0x90ea('0x40')){var _0x4af5aa={};_0x4af5aa[_0x27c5b9[_0x90ea('0x2b')]]={'$like':'%'+_0xb8873b[_0x90ea('0x33')]['filter']+'%'};return _0x4af5aa;}})});}_0x3d4779=_['merge']({},_0x3d4779,_0xb8873b[_0x90ea('0x41')]);var _0x11c8e0={'where':_0x3d4779[_0x90ea('0x3e')]};return db[_0x90ea('0x2f')][_0x90ea('0x1e')](_0x11c8e0)[_0x90ea('0x25')](function(_0x42a694){_0x43bd0e[_0x90ea('0x1e')]=_0x42a694;if(_0xb8873b[_0x90ea('0x33')][_0x90ea('0x42')]){_0x3d4779[_0x90ea('0x43')]=[{'all':!![]}];}return db[_0x90ea('0x2f')]['findAll'](_0x3d4779);})['then'](function(_0x26f9a0){_0x43bd0e[_0x90ea('0x44')]=_0x26f9a0;return _0x43bd0e;})[_0x90ea('0x25')](respondWithFilteredResult(_0x403035,_0x3d4779))[_0x90ea('0x45')](handleError(_0x403035,null));};exports['show']=function(_0x3542ab,_0x217170){var _0x1aaa73={'raw':![],'where':{'id':_0x3542ab[_0x90ea('0x46')]['id']}},_0x25bb96={};_0x25bb96[_0x90ea('0x37')]=_['keys'](db['Dashboard']['rawAttributes']);_0x25bb96[_0x90ea('0x33')]=_[_0x90ea('0x34')](_0x3542ab[_0x90ea('0x33')]);_0x25bb96['filters']=_[_0x90ea('0x36')](_0x25bb96[_0x90ea('0x37')],_0x25bb96[_0x90ea('0x33')]);_0x1aaa73[_0x90ea('0x39')]=_[_0x90ea('0x36')](_0x25bb96[_0x90ea('0x37')],qs['fields'](_0x3542ab['query']['fields']));_0x1aaa73[_0x90ea('0x39')]=_0x1aaa73[_0x90ea('0x39')][_0x90ea('0x47')]?_0x1aaa73['attributes']:_0x25bb96[_0x90ea('0x37')];if(_0x3542ab[_0x90ea('0x33')][_0x90ea('0x42')]){_0x1aaa73[_0x90ea('0x43')]=[{'all':!![]}];}_0x1aaa73=_[_0x90ea('0x3f')]({},_0x1aaa73,_0x3542ab[_0x90ea('0x41')]);return db[_0x90ea('0x2f')][_0x90ea('0x48')](_0x1aaa73)[_0x90ea('0x25')](handleEntityNotFound(_0x217170,null))[_0x90ea('0x25')](respondWithResult(_0x217170,null))[_0x90ea('0x45')](handleError(_0x217170,null));};exports[_0x90ea('0x49')]=function(_0x5e1895,_0x9ea96d){return db[_0x90ea('0x2f')]['create'](_0x5e1895['body'],{})[_0x90ea('0x25')](function(_0x3539e6){var _0x613dc5=_0x5e1895[_0x90ea('0x4a')][_0x90ea('0x27')]({'plain':!![]});if(!_0x613dc5)throw new Error(_0x90ea('0x4b'));if(_0x613dc5['role']===_0x90ea('0x4a')){var _0x3d3462=_0x3539e6[_0x90ea('0x27')]({'plain':!![]});var _0x3db0df=_0x90ea('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x3db0df,'userProfileId':_0x613dc5['userProfileId']},'raw':!![]})[_0x90ea('0x25')](function(_0x536a6a){if(_0x536a6a&&_0x536a6a[_0x90ea('0x4c')]===0x0){return db[_0x90ea('0x4d')][_0x90ea('0x49')]({'name':_0x3d3462[_0x90ea('0x2b')],'resourceId':_0x3d3462['id'],'type':_0x536a6a[_0x90ea('0x2b')],'sectionId':_0x536a6a['id']},{})[_0x90ea('0x25')](function(){return _0x3539e6;});}else{return _0x3539e6;}})[_0x90ea('0x45')](function(_0x585547){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x585547);throw _0x585547;});}return _0x3539e6;})[_0x90ea('0x25')](respondWithResult(_0x9ea96d,0xc9))[_0x90ea('0x45')](handleError(_0x9ea96d,null));};exports['clone']=function(_0x3e145b,_0x218223){var _0x49f788={'where':{'id':_0x3e145b[_0x90ea('0x46')]['id']}},_0x6f14bd={};_0x6f14bd[_0x90ea('0x37')]=_[_0x90ea('0x34')](db[_0x90ea('0x2f')]['rawAttributes']);_0x49f788[_0x90ea('0x39')]=_[_0x90ea('0x36')](_0x6f14bd[_0x90ea('0x37')],qs['fields'](_0x3e145b[_0x90ea('0x33')][_0x90ea('0x38')]));_0x49f788[_0x90ea('0x39')]=_0x49f788['attributes']['length']?_0x49f788[_0x90ea('0x39')]:_0x6f14bd[_0x90ea('0x37')];if(_0x3e145b['query'][_0x90ea('0x42')]){_0x49f788[_0x90ea('0x43')]=[{'all':!![]}];}_0x49f788=_[_0x90ea('0x3f')]({},_0x49f788,_0x3e145b[_0x90ea('0x41')]);return db[_0x90ea('0x2f')][_0x90ea('0x48')](_0x49f788)['then'](handleEntityNotFound(_0x218223,null))[_0x90ea('0x25')](function(_0x3a2096){if(_0x3a2096){var _0x2750a0=_0x3a2096[_0x90ea('0x27')]({'plain':!![]});_0x2750a0=qs[_0x90ea('0x4e')](_0x2750a0,['id',_0x90ea('0x4f'),_0x90ea('0x50')]);_0x3e145b['body']=_[_0x90ea('0x4e')](_0x3e145b['body'],['id',_0x90ea('0x4f'),'updatedAt']);return db[_0x90ea('0x2f')]['create'](_[_0x90ea('0x3f')](_0x2750a0,_0x3e145b[_0x90ea('0x51')]),{'include':_0x3e145b[_0x90ea('0x33')][_0x90ea('0x42')]?[{'all':!![]}]:undefined})[_0x90ea('0x25')](function(_0x43200d){var _0x1b6725=_0x3e145b[_0x90ea('0x4a')]['get']({'plain':!![]});if(!_0x1b6725)throw new Error(_0x90ea('0x4b'));if(_0x1b6725['role']===_0x90ea('0x4a')){var _0x5dd9af=_0x43200d[_0x90ea('0x27')]({'plain':!![]});var _0x5bedb2=_0x90ea('0x28');return db['UserProfileSection'][_0x90ea('0x48')]({'where':{'name':_0x5bedb2,'userProfileId':_0x1b6725['userProfileId']},'raw':!![]})[_0x90ea('0x25')](function(_0x46b80d){if(_0x46b80d&&_0x46b80d['autoAssociation']===0x0){return db[_0x90ea('0x4d')][_0x90ea('0x49')]({'name':_0x5dd9af['name'],'resourceId':_0x5dd9af['id'],'type':_0x46b80d[_0x90ea('0x2b')],'sectionId':_0x46b80d['id']},{})[_0x90ea('0x25')](function(){return _0x43200d;});}else{return _0x43200d;}})[_0x90ea('0x45')](function(_0x336910){logger[_0x90ea('0x29')](_0x90ea('0x52'),_0x336910);throw _0x336910;});}return _0x43200d;});}})[_0x90ea('0x25')](respondWithResult(_0x218223,0xc9))[_0x90ea('0x45')](handleError(_0x218223,null));};exports[_0x90ea('0x53')]=function(_0x22ca48,_0x4c5011){if(_0x22ca48[_0x90ea('0x51')]['id']){delete _0x22ca48[_0x90ea('0x51')]['id'];}return db['Dashboard'][_0x90ea('0x48')]({'where':{'id':_0x22ca48['params']['id']}})['then'](handleEntityNotFound(_0x4c5011,null))[_0x90ea('0x25')](saveUpdates(_0x22ca48[_0x90ea('0x51')],null))[_0x90ea('0x25')](respondWithResult(_0x4c5011,null))[_0x90ea('0x45')](handleError(_0x4c5011,null));};exports[_0x90ea('0x26')]=function(_0xc8be53,_0x7ac37c){return db['Dashboard'][_0x90ea('0x48')]({'where':{'id':_0xc8be53['params']['id']}})[_0x90ea('0x25')](handleEntityNotFound(_0x7ac37c,null))[_0x90ea('0x25')](removeEntity(_0x7ac37c,null))[_0x90ea('0x45')](handleError(_0x7ac37c,null));};function widgetAttributes(_0x1922a1){try{switch(_0x1922a1[_0x90ea('0x31')]){case'iframe':return[{'name':'attrUrl','value':_0x1922a1[_0x90ea('0x54')]||(_0x1922a1[_0x90ea('0x55')]&&_0x1922a1['attrs'][0x0]?_0x1922a1[_0x90ea('0x55')][0x0][_0x90ea('0x56')]:undefined)||_0x90ea('0x57')}];case _0x90ea('0x58'):return[{'name':_0x90ea('0x59'),'value':_0x1922a1['attrPath']||(_0x1922a1[_0x90ea('0x55')]&&_0x1922a1['attrs'][0x0]?_0x1922a1[_0x90ea('0x55')][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0x90ea('0x5a'),'value':_0x1922a1[_0x90ea('0x5a')]||(_0x1922a1[_0x90ea('0x55')]&&_0x1922a1[_0x90ea('0x55')][0x0]?_0x1922a1[_0x90ea('0x55')][0x0][_0x90ea('0x56')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x1922a1['attrTimezone']||(_0x1922a1[_0x90ea('0x55')]&&_0x1922a1[_0x90ea('0x55')][0x1]?_0x1922a1[_0x90ea('0x55')][0x1][_0x90ea('0x56')]:undefined)||_0x90ea('0x5b')},{'name':_0x90ea('0x5c'),'value':_0x1922a1[_0x90ea('0x5c')]||(_0x1922a1[_0x90ea('0x55')]&&_0x1922a1['attrs'][0x2]?_0x1922a1[_0x90ea('0x55')][0x2][_0x90ea('0x56')]:undefined)||0xc}];case _0x90ea('0x5d'):return[{'name':_0x90ea('0x5e'),'value':_0x1922a1[_0x90ea('0x5e')]||(_0x1922a1[_0x90ea('0x55')]&&_0x1922a1[_0x90ea('0x55')][0x0]?_0x1922a1[_0x90ea('0x55')][0x0]['value']:undefined)||_0x90ea('0x5f')},{'name':_0x90ea('0x60'),'value':_0x1922a1[_0x90ea('0x60')]||(_0x1922a1[_0x90ea('0x55')]&&_0x1922a1[_0x90ea('0x55')][0x1]?_0x1922a1[_0x90ea('0x55')][0x1][_0x90ea('0x56')]:undefined)||[]},{'name':_0x90ea('0x5c'),'value':_0x1922a1[_0x90ea('0x5c')]||(_0x1922a1[_0x90ea('0x55')]&&_0x1922a1[_0x90ea('0x55')][0x2]?_0x1922a1[_0x90ea('0x55')][0x2][_0x90ea('0x56')]:undefined)||0x14}];case'multibar-chart':case _0x90ea('0x61'):return[{'name':_0x90ea('0x62'),'value':_0x1922a1['attrSerie1']||(_0x1922a1[_0x90ea('0x55')]&&_0x1922a1[_0x90ea('0x55')][0x0]?_0x1922a1[_0x90ea('0x55')][0x0][_0x90ea('0x56')]:undefined)||_0x90ea('0x5f')},{'name':_0x90ea('0x63'),'value':_0x1922a1[_0x90ea('0x63')]||(_0x1922a1[_0x90ea('0x55')]&&_0x1922a1[_0x90ea('0x55')][0x1]?_0x1922a1[_0x90ea('0x55')][0x1]['value']:undefined)||null},{'name':_0x90ea('0x64'),'value':_0x1922a1['attrSerie3']||(_0x1922a1[_0x90ea('0x55')]&&_0x1922a1['attrs'][0x2]?_0x1922a1[_0x90ea('0x55')][0x2][_0x90ea('0x56')]:undefined)||null},{'name':_0x90ea('0x60'),'value':_0x1922a1['attrVoiceQueues']||(_0x1922a1['attrs']&&_0x1922a1['attrs'][0x3]?_0x1922a1[_0x90ea('0x55')][0x3][_0x90ea('0x56')]:undefined)||[]}];case'web-report':return[{'name':_0x90ea('0x65'),'type':_0x1922a1[_0x90ea('0x66')]||(_0x1922a1['attrs']&&_0x1922a1['attrs'][0x0]?_0x1922a1[_0x90ea('0x55')][0x0]['type']:undefined)||null,'value':_0x1922a1[_0x90ea('0x65')]||(_0x1922a1[_0x90ea('0x55')]&&_0x1922a1[_0x90ea('0x55')][0x0]?_0x1922a1[_0x90ea('0x55')][0x0]['value']:undefined)||null},{'name':_0x90ea('0x67'),'value':_0x1922a1[_0x90ea('0x67')]||(_0x1922a1[_0x90ea('0x55')]&&_0x1922a1[_0x90ea('0x55')][0x1]?_0x1922a1['attrs'][0x1][_0x90ea('0x56')]:undefined)||0x0}];default:return[];}}catch(_0x20a4a5){logger[_0x90ea('0x29')]('widgetAttributes:\x20%s',JSON[_0x90ea('0x68')](_0x20a4a5));return[];}}exports[_0x90ea('0x69')]=function(_0x9b3839,_0x16ab39,_0x89a43a){if(_0x9b3839['body']['id']){delete _0x9b3839[_0x90ea('0x51')]['id'];}return db[_0x90ea('0x2f')]['find']({'where':{'id':_0x9b3839['params']['id']}})[_0x90ea('0x25')](handleEntityNotFound(_0x16ab39,null))[_0x90ea('0x25')](function(_0x59e69f){if(_0x59e69f){_0x9b3839[_0x90ea('0x51')][_0x90ea('0x6a')]=_0x59e69f['id'];_0x9b3839['body'][_0x90ea('0x55')]=widgetAttributes(_0x9b3839[_0x90ea('0x51')]);return db[_0x90ea('0x6b')][_0x90ea('0x49')](_0x9b3839[_0x90ea('0x51')]);}})[_0x90ea('0x25')](respondWithResult(_0x16ab39,null))[_0x90ea('0x45')](handleError(_0x16ab39,null));};exports['getItems']=function(_0x15ec97,_0x372691,_0x221b4e){var _0x5280ce={};var _0x14d9d5={};var _0x3966f0;var _0x3480f4;return db[_0x90ea('0x2f')]['findOne']({'where':{'id':_0x15ec97[_0x90ea('0x46')]['id']}})[_0x90ea('0x25')](handleEntityNotFound(_0x372691,null))['then'](function(_0x8e8b4c){if(_0x8e8b4c){_0x3966f0=_0x8e8b4c;_0x14d9d5['model']=_[_0x90ea('0x34')](db[_0x90ea('0x6b')]['rawAttributes']);_0x14d9d5[_0x90ea('0x33')]=_['keys'](_0x15ec97[_0x90ea('0x33')]);_0x14d9d5['filters']=_['intersection'](_0x14d9d5['model'],_0x14d9d5['query']);_0x5280ce[_0x90ea('0x39')]=_[_0x90ea('0x36')](_0x14d9d5[_0x90ea('0x37')],qs[_0x90ea('0x38')](_0x15ec97[_0x90ea('0x33')][_0x90ea('0x38')]));_0x5280ce['attributes']=_0x5280ce[_0x90ea('0x39')]['length']?_0x5280ce['attributes']:_0x14d9d5['model'];_0x5280ce[_0x90ea('0x3b')]=qs[_0x90ea('0x3c')](_0x15ec97[_0x90ea('0x33')][_0x90ea('0x3c')]);_0x5280ce['where']=qs[_0x90ea('0x35')](_['pick'](_0x15ec97[_0x90ea('0x33')],_0x14d9d5['filters']));if(_0x15ec97[_0x90ea('0x33')]['filter']){_0x5280ce[_0x90ea('0x3e')]=_['merge'](_0x5280ce[_0x90ea('0x3e')],{'$or':_[_0x90ea('0x2e')](_0x5280ce[_0x90ea('0x39')],function(_0x39f5fe){var _0x3926a9={};_0x3926a9[_0x39f5fe]={'$like':'%'+_0x15ec97['query'][_0x90ea('0x6c')]+'%'};return _0x3926a9;})});}_0x5280ce=_['merge']({},_0x5280ce,_0x15ec97['options']);return _0x3966f0[_0x90ea('0x6d')](_0x5280ce);}})['then'](function(_0x4bb3d2){if(_0x4bb3d2){_0x3480f4=_0x4bb3d2[_0x90ea('0x47')];if(!_0x15ec97[_0x90ea('0x33')][_0x90ea('0x3a')]('nolimit')){_0x5280ce[_0x90ea('0x20')]=qs[_0x90ea('0x20')](_0x15ec97[_0x90ea('0x33')][_0x90ea('0x20')]);_0x5280ce[_0x90ea('0x1f')]=qs[_0x90ea('0x1f')](_0x15ec97[_0x90ea('0x33')][_0x90ea('0x1f')]);}return _0x3966f0[_0x90ea('0x6d')](_0x5280ce);}})[_0x90ea('0x25')](function(_0x32c688){if(_0x32c688){return _0x32c688?{'count':_0x3480f4,'rows':_0x32c688}:null;}})[_0x90ea('0x25')](respondWithResult(_0x372691,null))[_0x90ea('0x45')](handleError(_0x372691,null));}; \ No newline at end of file +var _0x4cc4=['createdAt','updatedAt','type','iframe','attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','findOne','DashboardItem','getItems','nolimit','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','./dashboard.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','end','stack','name','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','Dashboard','includeAll','include','rows','catch','keys','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','omit'];(function(_0x22a570,_0x41643a){var _0x3f9172=function(_0x33846c){while(--_0x33846c){_0x22a570['push'](_0x22a570['shift']());}};_0x3f9172(++_0x41643a);}(_0x4cc4,0x96));var _0x44cc=function(_0x1627a5,_0x1794e6){_0x1627a5=_0x1627a5-0x0;var _0x1d2718=_0x4cc4[_0x1627a5];return _0x1d2718;};'use strict';var pdf=require(_0x44cc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x44cc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x44cc('0x2'));var rp=require(_0x44cc('0x3'));var moment=require(_0x44cc('0x4'));var BPromise=require(_0x44cc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x44cc('0x6'));var sox=require(_0x44cc('0x7'));var csv=require('to-csv');var ejs=require(_0x44cc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x44cc('0x9'));var squel=require(_0x44cc('0xa'));var crypto=require(_0x44cc('0xb'));var jsforce=require(_0x44cc('0xc'));var deskjs=require(_0x44cc('0xd'));var toCsv=require(_0x44cc('0xe'));var querystring=require(_0x44cc('0xf'));var Papa=require('papaparse');var Redis=require(_0x44cc('0x10'));var authService=require(_0x44cc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x44cc('0x12'));var hardwareService=require(_0x44cc('0x13'));var logger=require('../../config/logger')(_0x44cc('0x14'));var utils=require('../../config/utils');var config=require(_0x44cc('0x15'));var licenseUtil=require(_0x44cc('0x16'));var db=require(_0x44cc('0x17'))['db'];config[_0x44cc('0x18')]=_['defaults'](config[_0x44cc('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x44cc('0x18')]));require(_0x44cc('0x19'))[_0x44cc('0x1a')](socket);function respondWithStatusCode(_0x1998e1,_0x37cbd5){_0x37cbd5=_0x37cbd5||0xcc;return function(_0x3caf7c){if(_0x3caf7c){return _0x1998e1[_0x44cc('0x1b')](_0x37cbd5);}return _0x1998e1[_0x44cc('0x1c')](_0x37cbd5)['end']();};}function respondWithResult(_0x39f9d3,_0x22d467){_0x22d467=_0x22d467||0xc8;return function(_0x9d458f){if(_0x9d458f){return _0x39f9d3[_0x44cc('0x1c')](_0x22d467)[_0x44cc('0x1d')](_0x9d458f);}};}function respondWithFilteredResult(_0x1b2f88,_0x3f366f){return function(_0xcf7509){if(_0xcf7509){var _0x3230a8=_0xcf7509[_0x44cc('0x1e')],_0x567a9e=_0x3f366f['offset'],_0x946d13=_0x3f366f[_0x44cc('0x1f')]+_0x3f366f[_0x44cc('0x20')],_0x571ad8;if(_0x946d13>=_0x3230a8){_0x946d13=_0x3230a8;_0x571ad8=0xc8;}else{_0x571ad8=0xce;}_0x1b2f88[_0x44cc('0x1c')](_0x571ad8);return _0x1b2f88[_0x44cc('0x21')](_0x44cc('0x22'),_0x567a9e+'-'+_0x946d13+'/'+_0x3230a8)['json'](_0xcf7509);}return null;};}function patchUpdates(_0x5e589e){return function(_0x1b8ff5){try{jsonpatch['apply'](_0x1b8ff5,_0x5e589e,!![]);}catch(_0x25d62e){return BPromise[_0x44cc('0x23')](_0x25d62e);}return _0x1b8ff5[_0x44cc('0x24')]();};}function saveUpdates(_0x2318b7,_0x5139fe){return function(_0x7b76ed){if(_0x7b76ed){return _0x7b76ed[_0x44cc('0x25')](_0x2318b7)[_0x44cc('0x26')](function(_0xab705a){return _0xab705a;});}return null;};}function removeEntity(_0x11d281,_0x21247b){return function(_0x5c3e71){if(_0x5c3e71){return _0x5c3e71[_0x44cc('0x27')]()['then'](function(){var _0x5e5b65=_0x5c3e71[_0x44cc('0x28')]({'plain':!![]});var _0x1759a8=_0x44cc('0x29');return db[_0x44cc('0x2a')][_0x44cc('0x27')]({'where':{'type':_0x1759a8,'resourceId':_0x5e5b65['id']}})['then'](function(){return _0x5c3e71;});})[_0x44cc('0x26')](function(){_0x11d281['status'](0xcc)[_0x44cc('0x2b')]();});}};}function handleEntityNotFound(_0x522dd1,_0xe3b06c){return function(_0x225a8a){if(!_0x225a8a){_0x522dd1[_0x44cc('0x1b')](0x194);}return _0x225a8a;};}function handleError(_0x50cb24,_0x47bde2){_0x47bde2=_0x47bde2||0x1f4;return function(_0x50e0f6){logger['error'](_0x50e0f6[_0x44cc('0x2c')]);if(_0x50e0f6[_0x44cc('0x2d')]){delete _0x50e0f6[_0x44cc('0x2d')];}_0x50cb24[_0x44cc('0x1c')](_0x47bde2)['send'](_0x50e0f6);};}exports[_0x44cc('0x2e')]=function(_0x595782,_0x2948e8){var _0x1b716f={},_0x38ff9b={},_0x182df4={'count':0x0,'rows':[]};var _0x187408=_[_0x44cc('0x2f')](db['Dashboard'][_0x44cc('0x30')],function(_0xa8b33d){return{'name':_0xa8b33d[_0x44cc('0x31')],'type':_0xa8b33d['type'][_0x44cc('0x32')]};});_0x38ff9b[_0x44cc('0x33')]=_[_0x44cc('0x2f')](_0x187408,_0x44cc('0x2d'));_0x38ff9b[_0x44cc('0x34')]=_['keys'](_0x595782[_0x44cc('0x34')]);_0x38ff9b[_0x44cc('0x35')]=_['intersection'](_0x38ff9b[_0x44cc('0x33')],_0x38ff9b[_0x44cc('0x34')]);_0x1b716f[_0x44cc('0x36')]=_[_0x44cc('0x37')](_0x38ff9b[_0x44cc('0x33')],qs[_0x44cc('0x38')](_0x595782[_0x44cc('0x34')][_0x44cc('0x38')]));_0x1b716f['attributes']=_0x1b716f[_0x44cc('0x36')][_0x44cc('0x39')]?_0x1b716f['attributes']:_0x38ff9b[_0x44cc('0x33')];if(!_0x595782[_0x44cc('0x34')][_0x44cc('0x3a')]('nolimit')){_0x1b716f[_0x44cc('0x20')]=qs[_0x44cc('0x20')](_0x595782[_0x44cc('0x34')]['limit']);_0x1b716f['offset']=qs[_0x44cc('0x1f')](_0x595782['query'][_0x44cc('0x1f')]);}_0x1b716f[_0x44cc('0x3b')]=qs[_0x44cc('0x3c')](_0x595782[_0x44cc('0x34')]['sort']);_0x1b716f[_0x44cc('0x3d')]=qs['filters'](_[_0x44cc('0x3e')](_0x595782[_0x44cc('0x34')],_0x38ff9b[_0x44cc('0x35')]),_0x187408);if(_0x595782['query']['filter']){_0x1b716f[_0x44cc('0x3d')]=_[_0x44cc('0x3f')](_0x1b716f[_0x44cc('0x3d')],{'$or':_[_0x44cc('0x2f')](_0x187408,function(_0x4c2685){if(_0x4c2685['type']!==_0x44cc('0x40')){var _0x392979={};_0x392979[_0x4c2685[_0x44cc('0x2d')]]={'$like':'%'+_0x595782[_0x44cc('0x34')][_0x44cc('0x41')]+'%'};return _0x392979;}})});}_0x1b716f=_[_0x44cc('0x3f')]({},_0x1b716f,_0x595782['options']);var _0x14364f={'where':_0x1b716f['where']};return db[_0x44cc('0x42')]['count'](_0x14364f)[_0x44cc('0x26')](function(_0x403f61){_0x182df4[_0x44cc('0x1e')]=_0x403f61;if(_0x595782[_0x44cc('0x34')][_0x44cc('0x43')]){_0x1b716f[_0x44cc('0x44')]=[{'all':!![]}];}return db[_0x44cc('0x42')]['findAll'](_0x1b716f);})[_0x44cc('0x26')](function(_0x484880){_0x182df4[_0x44cc('0x45')]=_0x484880;return _0x182df4;})[_0x44cc('0x26')](respondWithFilteredResult(_0x2948e8,_0x1b716f))[_0x44cc('0x46')](handleError(_0x2948e8,null));};exports['show']=function(_0x22e6b3,_0x5755e2){var _0x4a93be={'raw':![],'where':{'id':_0x22e6b3['params']['id']}},_0xeeeedc={};_0xeeeedc[_0x44cc('0x33')]=_[_0x44cc('0x47')](db['Dashboard'][_0x44cc('0x30')]);_0xeeeedc[_0x44cc('0x34')]=_[_0x44cc('0x47')](_0x22e6b3[_0x44cc('0x34')]);_0xeeeedc[_0x44cc('0x35')]=_['intersection'](_0xeeeedc['model'],_0xeeeedc['query']);_0x4a93be[_0x44cc('0x36')]=_['intersection'](_0xeeeedc[_0x44cc('0x33')],qs[_0x44cc('0x38')](_0x22e6b3[_0x44cc('0x34')]['fields']));_0x4a93be[_0x44cc('0x36')]=_0x4a93be['attributes'][_0x44cc('0x39')]?_0x4a93be[_0x44cc('0x36')]:_0xeeeedc[_0x44cc('0x33')];if(_0x22e6b3['query'][_0x44cc('0x43')]){_0x4a93be[_0x44cc('0x44')]=[{'all':!![]}];}_0x4a93be=_['merge']({},_0x4a93be,_0x22e6b3[_0x44cc('0x48')]);return db[_0x44cc('0x42')]['find'](_0x4a93be)[_0x44cc('0x26')](handleEntityNotFound(_0x5755e2,null))[_0x44cc('0x26')](respondWithResult(_0x5755e2,null))['catch'](handleError(_0x5755e2,null));};exports[_0x44cc('0x49')]=function(_0x5c167d,_0x3039d3){return db[_0x44cc('0x42')]['create'](_0x5c167d[_0x44cc('0x4a')],{})['then'](function(_0x46cd69){var _0x15107d=_0x5c167d[_0x44cc('0x4b')]['get']({'plain':!![]});if(!_0x15107d)throw new Error(_0x44cc('0x4c'));if(_0x15107d[_0x44cc('0x4d')]===_0x44cc('0x4b')){var _0xd9b9bb=_0x46cd69['get']({'plain':!![]});var _0x4d0c33=_0x44cc('0x29');return db[_0x44cc('0x4e')][_0x44cc('0x4f')]({'where':{'name':_0x4d0c33,'userProfileId':_0x15107d[_0x44cc('0x50')]},'raw':!![]})['then'](function(_0x203bcb){if(_0x203bcb&&_0x203bcb[_0x44cc('0x51')]===0x0){return db[_0x44cc('0x2a')]['create']({'name':_0xd9b9bb[_0x44cc('0x2d')],'resourceId':_0xd9b9bb['id'],'type':_0x203bcb[_0x44cc('0x2d')],'sectionId':_0x203bcb['id']},{})[_0x44cc('0x26')](function(){return _0x46cd69;});}else{return _0x46cd69;}})[_0x44cc('0x46')](function(_0xa043af){logger[_0x44cc('0x52')](_0x44cc('0x53'),_0xa043af);throw _0xa043af;});}return _0x46cd69;})[_0x44cc('0x26')](respondWithResult(_0x3039d3,0xc9))['catch'](handleError(_0x3039d3,null));};exports['clone']=function(_0x3769da,_0x328ac6){var _0x25a7f8={'where':{'id':_0x3769da[_0x44cc('0x54')]['id']}},_0x22ffbf={};_0x22ffbf[_0x44cc('0x33')]=_[_0x44cc('0x47')](db['Dashboard']['rawAttributes']);_0x25a7f8[_0x44cc('0x36')]=_[_0x44cc('0x37')](_0x22ffbf['model'],qs[_0x44cc('0x38')](_0x3769da[_0x44cc('0x34')]['fields']));_0x25a7f8[_0x44cc('0x36')]=_0x25a7f8['attributes']['length']?_0x25a7f8[_0x44cc('0x36')]:_0x22ffbf[_0x44cc('0x33')];if(_0x3769da[_0x44cc('0x34')][_0x44cc('0x43')]){_0x25a7f8['include']=[{'all':!![]}];}_0x25a7f8=_[_0x44cc('0x3f')]({},_0x25a7f8,_0x3769da['options']);return db[_0x44cc('0x42')]['find'](_0x25a7f8)['then'](handleEntityNotFound(_0x328ac6,null))[_0x44cc('0x26')](function(_0x3dd1ae){if(_0x3dd1ae){var _0x260a6d=_0x3dd1ae[_0x44cc('0x28')]({'plain':!![]});_0x260a6d=qs[_0x44cc('0x55')](_0x260a6d,['id',_0x44cc('0x56'),'updatedAt']);_0x3769da[_0x44cc('0x4a')]=_[_0x44cc('0x55')](_0x3769da[_0x44cc('0x4a')],['id','createdAt',_0x44cc('0x57')]);return db[_0x44cc('0x42')][_0x44cc('0x49')](_[_0x44cc('0x3f')](_0x260a6d,_0x3769da['body']),{'include':_0x3769da[_0x44cc('0x34')][_0x44cc('0x43')]?[{'all':!![]}]:undefined})['then'](function(_0x48b10d){var _0x183da1=_0x3769da[_0x44cc('0x4b')]['get']({'plain':!![]});if(!_0x183da1)throw new Error(_0x44cc('0x4c'));if(_0x183da1[_0x44cc('0x4d')]===_0x44cc('0x4b')){var _0x2c99b4=_0x48b10d[_0x44cc('0x28')]({'plain':!![]});var _0x330e50=_0x44cc('0x29');return db[_0x44cc('0x4e')][_0x44cc('0x4f')]({'where':{'name':_0x330e50,'userProfileId':_0x183da1[_0x44cc('0x50')]},'raw':!![]})[_0x44cc('0x26')](function(_0x3b297b){if(_0x3b297b&&_0x3b297b[_0x44cc('0x51')]===0x0){return db[_0x44cc('0x2a')][_0x44cc('0x49')]({'name':_0x2c99b4['name'],'resourceId':_0x2c99b4['id'],'type':_0x3b297b[_0x44cc('0x2d')],'sectionId':_0x3b297b['id']},{})[_0x44cc('0x26')](function(){return _0x48b10d;});}else{return _0x48b10d;}})[_0x44cc('0x46')](function(_0x1d7c0f){logger[_0x44cc('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1d7c0f);throw _0x1d7c0f;});}return _0x48b10d;});}})[_0x44cc('0x26')](respondWithResult(_0x328ac6,0xc9))[_0x44cc('0x46')](handleError(_0x328ac6,null));};exports[_0x44cc('0x25')]=function(_0x16e583,_0x42c2b2){if(_0x16e583[_0x44cc('0x4a')]['id']){delete _0x16e583[_0x44cc('0x4a')]['id'];}return db[_0x44cc('0x42')]['find']({'where':{'id':_0x16e583[_0x44cc('0x54')]['id']}})[_0x44cc('0x26')](handleEntityNotFound(_0x42c2b2,null))[_0x44cc('0x26')](saveUpdates(_0x16e583['body'],null))[_0x44cc('0x26')](respondWithResult(_0x42c2b2,null))[_0x44cc('0x46')](handleError(_0x42c2b2,null));};exports['destroy']=function(_0x491242,_0x5b52ba){return db[_0x44cc('0x42')][_0x44cc('0x4f')]({'where':{'id':_0x491242['params']['id']}})[_0x44cc('0x26')](handleEntityNotFound(_0x5b52ba,null))['then'](removeEntity(_0x5b52ba,null))[_0x44cc('0x46')](handleError(_0x5b52ba,null));};function widgetAttributes(_0x29ddd6){try{switch(_0x29ddd6[_0x44cc('0x58')]){case _0x44cc('0x59'):return[{'name':_0x44cc('0x5a'),'value':_0x29ddd6[_0x44cc('0x5a')]||(_0x29ddd6[_0x44cc('0x5b')]&&_0x29ddd6[_0x44cc('0x5b')][0x0]?_0x29ddd6[_0x44cc('0x5b')][0x0]['value']:undefined)||'https://'}];case _0x44cc('0x5c'):return[{'name':_0x44cc('0x5d'),'value':_0x29ddd6['attrPath']||(_0x29ddd6[_0x44cc('0x5b')]&&_0x29ddd6['attrs'][0x0]?_0x29ddd6['attrs'][0x0][_0x44cc('0x5e')]:undefined)||''}];case _0x44cc('0x5f'):return[{'name':'attrHourFormat','value':_0x29ddd6[_0x44cc('0x60')]||(_0x29ddd6['attrs']&&_0x29ddd6['attrs'][0x0]?_0x29ddd6[_0x44cc('0x5b')][0x0][_0x44cc('0x5e')]:undefined)||_0x44cc('0x61')},{'name':_0x44cc('0x62'),'value':_0x29ddd6[_0x44cc('0x62')]||(_0x29ddd6['attrs']&&_0x29ddd6['attrs'][0x1]?_0x29ddd6[_0x44cc('0x5b')][0x1][_0x44cc('0x5e')]:undefined)||_0x44cc('0x63')},{'name':_0x44cc('0x64'),'value':_0x29ddd6[_0x44cc('0x64')]||(_0x29ddd6['attrs']&&_0x29ddd6[_0x44cc('0x5b')][0x2]?_0x29ddd6[_0x44cc('0x5b')][0x2][_0x44cc('0x5e')]:undefined)||0xc}];case _0x44cc('0x65'):return[{'name':_0x44cc('0x66'),'value':_0x29ddd6['attrMetric']||(_0x29ddd6[_0x44cc('0x5b')]&&_0x29ddd6[_0x44cc('0x5b')][0x0]?_0x29ddd6[_0x44cc('0x5b')][0x0][_0x44cc('0x5e')]:undefined)||_0x44cc('0x67')},{'name':'attrVoiceQueues','value':_0x29ddd6[_0x44cc('0x68')]||(_0x29ddd6['attrs']&&_0x29ddd6['attrs'][0x1]?_0x29ddd6[_0x44cc('0x5b')][0x1]['value']:undefined)||[]},{'name':_0x44cc('0x64'),'value':_0x29ddd6[_0x44cc('0x64')]||(_0x29ddd6['attrs']&&_0x29ddd6[_0x44cc('0x5b')][0x2]?_0x29ddd6['attrs'][0x2][_0x44cc('0x5e')]:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':'attrSerie1','value':_0x29ddd6[_0x44cc('0x69')]||(_0x29ddd6[_0x44cc('0x5b')]&&_0x29ddd6[_0x44cc('0x5b')][0x0]?_0x29ddd6[_0x44cc('0x5b')][0x0][_0x44cc('0x5e')]:undefined)||_0x44cc('0x67')},{'name':_0x44cc('0x6a'),'value':_0x29ddd6[_0x44cc('0x6a')]||(_0x29ddd6[_0x44cc('0x5b')]&&_0x29ddd6['attrs'][0x1]?_0x29ddd6[_0x44cc('0x5b')][0x1][_0x44cc('0x5e')]:undefined)||null},{'name':_0x44cc('0x6b'),'value':_0x29ddd6[_0x44cc('0x6b')]||(_0x29ddd6['attrs']&&_0x29ddd6['attrs'][0x2]?_0x29ddd6[_0x44cc('0x5b')][0x2][_0x44cc('0x5e')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x29ddd6[_0x44cc('0x68')]||(_0x29ddd6['attrs']&&_0x29ddd6['attrs'][0x3]?_0x29ddd6['attrs'][0x3]['value']:undefined)||[]}];case _0x44cc('0x6c'):return[{'name':_0x44cc('0x6d'),'type':_0x29ddd6['reportType']||(_0x29ddd6['attrs']&&_0x29ddd6[_0x44cc('0x5b')][0x0]?_0x29ddd6[_0x44cc('0x5b')][0x0]['type']:undefined)||null,'value':_0x29ddd6[_0x44cc('0x6d')]||(_0x29ddd6['attrs']&&_0x29ddd6[_0x44cc('0x5b')][0x0]?_0x29ddd6[_0x44cc('0x5b')][0x0]['value']:undefined)||null},{'name':_0x44cc('0x6e'),'value':_0x29ddd6[_0x44cc('0x6e')]||(_0x29ddd6[_0x44cc('0x5b')]&&_0x29ddd6[_0x44cc('0x5b')][0x1]?_0x29ddd6[_0x44cc('0x5b')][0x1][_0x44cc('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x2b92cc){logger[_0x44cc('0x52')](_0x44cc('0x6f'),JSON[_0x44cc('0x70')](_0x2b92cc));return[];}}exports[_0x44cc('0x71')]=function(_0x401370,_0x3278df,_0x352923){if(_0x401370['body']['id']){delete _0x401370[_0x44cc('0x4a')]['id'];}return db[_0x44cc('0x42')][_0x44cc('0x4f')]({'where':{'id':_0x401370['params']['id']}})['then'](handleEntityNotFound(_0x3278df,null))['then'](function(_0x5e209f){if(_0x5e209f){_0x401370[_0x44cc('0x4a')]['DashboardId']=_0x5e209f['id'];_0x401370[_0x44cc('0x4a')]['attrs']=widgetAttributes(_0x401370[_0x44cc('0x4a')]);return db['DashboardItem'][_0x44cc('0x49')](_0x401370['body']);}})[_0x44cc('0x26')](respondWithResult(_0x3278df,null))[_0x44cc('0x46')](handleError(_0x3278df,null));};exports['getItems']=function(_0x95fbed,_0x139e9f,_0x31f11e){var _0x439b45={};var _0x3333bb={};var _0x17c710;var _0x321281;return db[_0x44cc('0x42')][_0x44cc('0x72')]({'where':{'id':_0x95fbed[_0x44cc('0x54')]['id']}})[_0x44cc('0x26')](handleEntityNotFound(_0x139e9f,null))[_0x44cc('0x26')](function(_0x595e68){if(_0x595e68){_0x17c710=_0x595e68;_0x3333bb['model']=_['keys'](db[_0x44cc('0x73')]['rawAttributes']);_0x3333bb[_0x44cc('0x34')]=_[_0x44cc('0x47')](_0x95fbed[_0x44cc('0x34')]);_0x3333bb[_0x44cc('0x35')]=_[_0x44cc('0x37')](_0x3333bb['model'],_0x3333bb[_0x44cc('0x34')]);_0x439b45[_0x44cc('0x36')]=_['intersection'](_0x3333bb[_0x44cc('0x33')],qs['fields'](_0x95fbed[_0x44cc('0x34')][_0x44cc('0x38')]));_0x439b45['attributes']=_0x439b45[_0x44cc('0x36')][_0x44cc('0x39')]?_0x439b45[_0x44cc('0x36')]:_0x3333bb[_0x44cc('0x33')];_0x439b45[_0x44cc('0x3b')]=qs[_0x44cc('0x3c')](_0x95fbed['query'][_0x44cc('0x3c')]);_0x439b45[_0x44cc('0x3d')]=qs[_0x44cc('0x35')](_['pick'](_0x95fbed['query'],_0x3333bb['filters']));if(_0x95fbed[_0x44cc('0x34')]['filter']){_0x439b45[_0x44cc('0x3d')]=_[_0x44cc('0x3f')](_0x439b45[_0x44cc('0x3d')],{'$or':_[_0x44cc('0x2f')](_0x439b45[_0x44cc('0x36')],function(_0x35bd89){var _0x336956={};_0x336956[_0x35bd89]={'$like':'%'+_0x95fbed['query'][_0x44cc('0x41')]+'%'};return _0x336956;})});}_0x439b45=_['merge']({},_0x439b45,_0x95fbed[_0x44cc('0x48')]);return _0x17c710[_0x44cc('0x74')](_0x439b45);}})['then'](function(_0x196151){if(_0x196151){_0x321281=_0x196151['length'];if(!_0x95fbed[_0x44cc('0x34')][_0x44cc('0x3a')](_0x44cc('0x75'))){_0x439b45['limit']=qs[_0x44cc('0x20')](_0x95fbed['query'][_0x44cc('0x20')]);_0x439b45[_0x44cc('0x1f')]=qs[_0x44cc('0x1f')](_0x95fbed[_0x44cc('0x34')]['offset']);}return _0x17c710['getItems'](_0x439b45);}})[_0x44cc('0x26')](function(_0x276aad){if(_0x276aad){return _0x276aad?{'count':_0x321281,'rows':_0x276aad}:null;}})[_0x44cc('0x26')](respondWithResult(_0x139e9f,null))[_0x44cc('0x46')](handleError(_0x139e9f,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 88d1131..2810d54 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 _0x07ef=['hook','exports','events','Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3b7058,_0x33b8f9){var _0x48f04f=function(_0x4f9f28){while(--_0x4f9f28){_0x3b7058['push'](_0x3b7058['shift']());}};_0x48f04f(++_0x33b8f9);}(_0x07ef,0xe8));var _0xf07e=function(_0x5cebc3,_0x3f0d41){_0x5cebc3=_0x5cebc3-0x0;var _0x595fa5=_0x07ef[_0x5cebc3];return _0x595fa5;};'use strict';var EventEmitter=require(_0xf07e('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xf07e('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xf07e('0x2')](0x0);var events={'afterCreate':_0xf07e('0x3'),'afterUpdate':_0xf07e('0x4'),'afterDestroy':_0xf07e('0x5')};function emitEvent(_0x3da1c4){return function(_0x7073a6,_0x398620,_0x3ba183){DashboardEvents[_0xf07e('0x6')](_0x3da1c4+':'+_0x7073a6['id'],_0x7073a6);DashboardEvents[_0xf07e('0x6')](_0x3da1c4,_0x7073a6);_0x3ba183(null);};}for(var e in events){if(events[_0xf07e('0x7')](e)){var event=events[e];Dashboard[_0xf07e('0x8')](e,emitEvent(event));}}module[_0xf07e('0x9')]=DashboardEvents; \ No newline at end of file +var _0xadee=['../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4c0671,_0x438300){var _0x360a25=function(_0x12cfdc){while(--_0x12cfdc){_0x4c0671['push'](_0x4c0671['shift']());}};_0x360a25(++_0x438300);}(_0xadee,0xfc));var _0xeade=function(_0x5d8c83,_0x25226d){_0x5d8c83=_0x5d8c83-0x0;var _0x161056=_0xadee[_0x5d8c83];return _0x161056;};'use strict';var EventEmitter=require(_0xeade('0x0'));var Dashboard=require(_0xeade('0x1'))['db'][_0xeade('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xeade('0x3')](0x0);var events={'afterCreate':_0xeade('0x4'),'afterUpdate':_0xeade('0x5'),'afterDestroy':_0xeade('0x6')};function emitEvent(_0x18f828){return function(_0x30bf91,_0x391058,_0x4b2ea9){DashboardEvents[_0xeade('0x7')](_0x18f828+':'+_0x30bf91['id'],_0x30bf91);DashboardEvents['emit'](_0x18f828,_0x30bf91);_0x4b2ea9(null);};}for(var e in events){if(events[_0xeade('0x8')](e)){var event=events[e];Dashboard[_0xeade('0x9')](e,emitEvent(event));}}module[_0xeade('0xa')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 51f5af1..8e4d1f4 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 _0x407a=['bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','define','dashboards','lodash','util','../../config/logger','api','moment'];(function(_0x399269,_0x38c1ee){var _0xa90608=function(_0x25af32){while(--_0x25af32){_0x399269['push'](_0x399269['shift']());}};_0xa90608(++_0x38c1ee);}(_0x407a,0x133));var _0xa407=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x407a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa407('0x0'));var util=require(_0xa407('0x1'));var logger=require(_0xa407('0x2'))(_0xa407('0x3'));var moment=require(_0xa407('0x4'));var BPromise=require(_0xa407('0x5'));var rp=require(_0xa407('0x6'));var fs=require('fs');var path=require(_0xa407('0x7'));var rimraf=require(_0xa407('0x8'));var config=require(_0xa407('0x9'));var attributes=require(_0xa407('0xa'));module['exports']=function(_0xa62014,_0x111985){return _0xa62014[_0xa407('0xb')]('Dashboard',attributes,{'tableName':_0xa407('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x912a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash'];(function(_0x37308e,_0xbfbcd5){var _0x5a02fe=function(_0x4cab11){while(--_0x4cab11){_0x37308e['push'](_0x37308e['shift']());}};_0x5a02fe(++_0xbfbcd5);}(_0x912a,0x125));var _0xa912=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0x912a[_0x1e3671];return _0x48d5f5;};'use strict';var _=require(_0xa912('0x0'));var util=require('util');var logger=require(_0xa912('0x1'))(_0xa912('0x2'));var moment=require(_0xa912('0x3'));var BPromise=require(_0xa912('0x4'));var rp=require(_0xa912('0x5'));var fs=require('fs');var path=require(_0xa912('0x6'));var rimraf=require(_0xa912('0x7'));var config=require(_0xa912('0x8'));var attributes=require(_0xa912('0x9'));module[_0xa912('0xa')]=function(_0x3aba18,_0x4a943a){return _0x3aba18[_0xa912('0xb')](_0xa912('0xc'),attributes,{'tableName':_0xa912('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 7d7c599..50783a3 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 _0x4ade=['../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x335dc3,_0x349fe3){var _0x5ddcc6=function(_0x940123){while(--_0x940123){_0x335dc3['push'](_0x335dc3['shift']());}};_0x5ddcc6(++_0x349fe3);}(_0x4ade,0x149));var _0xe4ad=function(_0x420903,_0x2b07eb){_0x420903=_0x420903-0x0;var _0x5b4d13=_0x4ade[_0x420903];return _0x5b4d13;};'use strict';var _=require(_0xe4ad('0x0'));var util=require(_0xe4ad('0x1'));var moment=require(_0xe4ad('0x2'));var BPromise=require(_0xe4ad('0x3'));var rs=require(_0xe4ad('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4ad('0x5'))['db'];var utils=require(_0xe4ad('0x6'));var logger=require(_0xe4ad('0x7'))(_0xe4ad('0x8'));var config=require(_0xe4ad('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe4ad('0xa')]['http']({'port':0x232a});config[_0xe4ad('0xb')]=_[_0xe4ad('0xc')](config[_0xe4ad('0xb')],{'host':_0xe4ad('0xd'),'port':0x18eb});var socket=require(_0xe4ad('0xe'))(new Redis(config[_0xe4ad('0xb')]));require('./dashboard.socket')[_0xe4ad('0xf')](socket);function respondWithRpcPromise(_0xe0d7d7,_0x32edec,_0x64280b){return new BPromise(function(_0x13596f,_0x34d0ec){return client[_0xe4ad('0x10')](_0xe0d7d7,_0x64280b)[_0xe4ad('0x11')](function(_0x4b1c92){logger[_0xe4ad('0x12')](_0xe4ad('0x13'),_0x32edec,_0xe4ad('0x14'));logger['debug'](_0xe4ad('0x15'),_0x32edec,_0xe4ad('0x14'),JSON[_0xe4ad('0x16')](_0x4b1c92));if(_0x4b1c92[_0xe4ad('0x17')]){if(_0x4b1c92[_0xe4ad('0x17')][_0xe4ad('0x18')]===0x1f4){logger[_0xe4ad('0x17')](_0xe4ad('0x13'),_0x32edec,_0x4b1c92[_0xe4ad('0x17')][_0xe4ad('0x19')]);return _0x34d0ec(_0x4b1c92['error'][_0xe4ad('0x19')]);}logger[_0xe4ad('0x17')]('Dashboard,\x20%s,\x20%s',_0x32edec,_0x4b1c92[_0xe4ad('0x17')][_0xe4ad('0x19')]);return _0x13596f(_0x4b1c92[_0xe4ad('0x17')]['message']);}else{logger[_0xe4ad('0x12')](_0xe4ad('0x13'),_0x32edec,_0xe4ad('0x14'));_0x13596f(_0x4b1c92['result']['message']);}})['catch'](function(_0x5d6148){logger[_0xe4ad('0x17')](_0xe4ad('0x13'),_0x32edec,_0x5d6148);_0x34d0ec(_0x5d6148);});});} \ No newline at end of file +var _0xb8ab=['Dashboard,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboard.socket','then','info'];(function(_0x1afabf,_0x56fdcc){var _0x497ff1=function(_0x2f6104){while(--_0x2f6104){_0x1afabf['push'](_0x1afabf['shift']());}};_0x497ff1(++_0x56fdcc);}(_0xb8ab,0x1ea));var _0xbb8a=function(_0x2d0efc,_0x513420){_0x2d0efc=_0x2d0efc-0x0;var _0xcef0f0=_0xb8ab[_0x2d0efc];return _0xcef0f0;};'use strict';var _=require(_0xbb8a('0x0'));var util=require('util');var moment=require(_0xbb8a('0x1'));var BPromise=require('bluebird');var rs=require(_0xbb8a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb8a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb8a('0x4'))(_0xbb8a('0x5'));var config=require(_0xbb8a('0x6'));var jayson=require(_0xbb8a('0x7'));var client=jayson[_0xbb8a('0x8')][_0xbb8a('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xbb8a('0xa')],{'host':_0xbb8a('0xb'),'port':0x18eb});var socket=require(_0xbb8a('0xc'))(new Redis(config[_0xbb8a('0xa')]));require(_0xbb8a('0xd'))['register'](socket);function respondWithRpcPromise(_0xbcdd6e,_0x6a7048,_0x3ca139){return new BPromise(function(_0x3a4909,_0x5b8ce4){return client['request'](_0xbcdd6e,_0x3ca139)[_0xbb8a('0xe')](function(_0x394f84){logger[_0xbb8a('0xf')](_0xbb8a('0x10'),_0x6a7048,_0xbb8a('0x11'));logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x6a7048,_0xbb8a('0x11'),JSON[_0xbb8a('0x12')](_0x394f84));if(_0x394f84[_0xbb8a('0x13')]){if(_0x394f84[_0xbb8a('0x13')]['code']===0x1f4){logger[_0xbb8a('0x13')](_0xbb8a('0x10'),_0x6a7048,_0x394f84[_0xbb8a('0x13')][_0xbb8a('0x14')]);return _0x5b8ce4(_0x394f84[_0xbb8a('0x13')]['message']);}logger[_0xbb8a('0x13')](_0xbb8a('0x10'),_0x6a7048,_0x394f84[_0xbb8a('0x13')][_0xbb8a('0x14')]);return _0x3a4909(_0x394f84[_0xbb8a('0x13')][_0xbb8a('0x14')]);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x6a7048,_0xbb8a('0x11'));_0x3a4909(_0x394f84[_0xbb8a('0x15')]['message']);}})['catch'](function(_0x585c50){logger[_0xbb8a('0x13')](_0xbb8a('0x10'),_0x6a7048,_0x585c50);_0x5b8ce4(_0x585c50);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 45cd911..5c8f1e6 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 _0xc30b=['removeListener','dashboard:','remove','update','emit'];(function(_0x470b0a,_0x2889d6){var _0x4463f6=function(_0x2b5f0e){while(--_0x2b5f0e){_0x470b0a['push'](_0x470b0a['shift']());}};_0x4463f6(++_0x2889d6);}(_0xc30b,0x10b));var _0xbc30=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0xc30b[_0x576170];return _0x397c70;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save',_0xbc30('0x0'),_0xbc30('0x1')];function createListener(_0x150835,_0x419339){return function(_0x3243db){_0x419339[_0xbc30('0x2')](_0x150835,_0x3243db);};}function removeListener(_0x363a05,_0x8a20){return function(){DashboardEvents[_0xbc30('0x3')](_0x363a05,_0x8a20);};}exports['register']=function(_0x4eaa7b){for(var _0x162748=0x0,_0x57d75f=events['length'];_0x162748<_0x57d75f;_0x162748++){var _0x2111ce=events[_0x162748];var _0x4b289b=createListener(_0xbc30('0x4')+_0x2111ce,_0x4eaa7b);DashboardEvents['on'](_0x2111ce,_0x4b289b);}}; \ No newline at end of file +var _0xbf35=['./dashboard.events','save','update','removeListener','register','length','dashboard:'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xbf35,0xfc));var _0x5bf3=function(_0x3c0387,_0x122f61){_0x3c0387=_0x3c0387-0x0;var _0x350727=_0xbf35[_0x3c0387];return _0x350727;};'use strict';var DashboardEvents=require(_0x5bf3('0x0'));var events=[_0x5bf3('0x1'),'remove',_0x5bf3('0x2')];function createListener(_0x223100,_0x237d35){return function(_0x497432){_0x237d35['emit'](_0x223100,_0x497432);};}function removeListener(_0x2e10f6,_0x364017){return function(){DashboardEvents[_0x5bf3('0x3')](_0x2e10f6,_0x364017);};}exports[_0x5bf3('0x4')]=function(_0x965017){for(var _0x18c7af=0x0,_0x6ef85d=events[_0x5bf3('0x5')];_0x18c7af<_0x6ef85d;_0x18c7af++){var _0x4aa084=events[_0x18c7af];var _0x266d61=createListener(_0x5bf3('0x6')+_0x4aa084,_0x965017);DashboardEvents['on'](_0x4aa084,_0x266d61);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 367d95d..2420f0e 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 _0x2dae=['update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller','get','index','/:id','isAuthenticated','show','/:id/items','getItems','create','post','/:id/clone','clone','addItem'];(function(_0x334dd6,_0x33f834){var _0x562376=function(_0x37d1f8){while(--_0x37d1f8){_0x334dd6['push'](_0x334dd6['shift']());}};_0x562376(++_0x33f834);}(_0x2dae,0xc3));var _0xe2da=function(_0x274dd7,_0x2e6051){_0x274dd7=_0x274dd7-0x0;var _0x148829=_0x2dae[_0x274dd7];return _0x148829;};'use strict';var multer=require(_0xe2da('0x0'));var util=require('util');var path=require(_0xe2da('0x1'));var timeout=require(_0xe2da('0x2'));var express=require(_0xe2da('0x3'));var router=express[_0xe2da('0x4')]();var fs_extra=require(_0xe2da('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe2da('0x6'));var config=require(_0xe2da('0x7'));var controller=require(_0xe2da('0x8'));router[_0xe2da('0x9')]('/',auth['isAuthenticated'](),controller[_0xe2da('0xa')]);router[_0xe2da('0x9')](_0xe2da('0xb'),auth[_0xe2da('0xc')](),controller[_0xe2da('0xd')]);router[_0xe2da('0x9')](_0xe2da('0xe'),auth[_0xe2da('0xc')](),controller[_0xe2da('0xf')]);router['post']('/',auth[_0xe2da('0xc')](),controller[_0xe2da('0x10')]);router[_0xe2da('0x11')](_0xe2da('0x12'),auth[_0xe2da('0xc')](),controller[_0xe2da('0x13')]);router[_0xe2da('0x11')](_0xe2da('0xe'),auth['isAuthenticated'](),controller[_0xe2da('0x14')]);router['put'](_0xe2da('0xb'),auth[_0xe2da('0xc')](),controller[_0xe2da('0x15')]);router[_0xe2da('0x16')](_0xe2da('0xb'),auth[_0xe2da('0xc')](),controller[_0xe2da('0x17')]);module['exports']=router; \ No newline at end of file +var _0x008c=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','getItems','post','/:id/clone','/:id/items','addItem','put','/:id','destroy','exports','multer','util','path','connect-timeout'];(function(_0x579668,_0x2731b4){var _0x7428e3=function(_0x7c7b5){while(--_0x7c7b5){_0x579668['push'](_0x579668['shift']());}};_0x7428e3(++_0x2731b4);}(_0x008c,0x188));var _0xc008=function(_0x287aba,_0x2b05a3){_0x287aba=_0x287aba-0x0;var _0x25d2ea=_0x008c[_0x287aba];return _0x25d2ea;};'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/items',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['clone']);router[_0xc008('0xe')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')](_0xc008('0x13'),auth[_0xc008('0xb')](),controller['update']);router['delete'](_0xc008('0x13'),auth['isAuthenticated'](),controller[_0xc008('0x14')]);module[_0xc008('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index fc3d079..e272883 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 _0x5d7b=['parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#2196f3','sequelize','squel','exports','STRING','long'];(function(_0x3ba03b,_0xba0afa){var _0x3968a8=function(_0x479f5a){while(--_0x479f5a){_0x3ba03b['push'](_0x3ba03b['shift']());}};_0x3968a8(++_0xba0afa);}(_0x5d7b,0xaf));var _0xb5d7=function(_0x2d3bf8,_0x544a00){_0x2d3bf8=_0x2d3bf8-0x0;var _0x37ec29=_0x5d7b[_0x2d3bf8];return _0x37ec29;};'use strict';var Sequelize=require(_0xb5d7('0x0'));var squel=require(_0xb5d7('0x1'));var _=require('lodash');module[_0xb5d7('0x2')]={'title':{'type':Sequelize[_0xb5d7('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xb5d7('0x4')),'get':function(){try{return JSON[_0xb5d7('0x5')](this[_0xb5d7('0x6')](_0xb5d7('0x7')));}catch(_0x149b8e){return[];}},'set':function(_0x77779){try{this[_0xb5d7('0x8')](_0xb5d7('0x7'),JSON[_0xb5d7('0x9')](_0x77779));}catch(_0x4fd3d9){this[_0xb5d7('0x8')](_0xb5d7('0x7'),JSON[_0xb5d7('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xb5d7('0xa')]},'col':{'type':Sequelize[_0xb5d7('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb5d7('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0xd957=['parse','attrs','setDataValue','INTEGER','sequelize','exports','STRING','TEXT','long'];(function(_0x38b643,_0x14dc0d){var _0x23cf24=function(_0x39e013){while(--_0x39e013){_0x38b643['push'](_0x38b643['shift']());}};_0x23cf24(++_0x14dc0d);}(_0xd957,0x17e));var _0x7d95=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd957[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x7d95('0x0'));var squel=require('squel');var _=require('lodash');module[_0x7d95('0x1')]={'title':{'type':Sequelize[_0x7d95('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7d95('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x7d95('0x3')](_0x7d95('0x4')),'get':function(){try{return JSON[_0x7d95('0x5')](this['getDataValue'](_0x7d95('0x6')));}catch(_0x5c3511){return[];}},'set':function(_0x1c66b5){try{this[_0x7d95('0x7')](_0x7d95('0x6'),JSON['stringify'](_0x1c66b5));}catch(_0x4be2e0){this[_0x7d95('0x7')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x7d95('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x7d95('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x7d95('0x8')]},'col':{'type':Sequelize[_0x7d95('0x8')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x7d95('0x2')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x7d95('0x2')]},'titleFontSize':{'type':Sequelize[_0x7d95('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 0eceea4..bd005ec 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 _0x2160=['show','params','model','DashboardItem','rawAttributes','query','keys','filters','intersection','fields','attributes','includeAll','include','options','find','catch','type','attrUrl','attrs','https://','custom','attrPath','attrHourFormat','value','attrFontSize','counter','attrMetric','total','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send'];(function(_0x3250f7,_0x1c2afc){var _0xdb6ac4=function(_0x5a23f8){while(--_0x5a23f8){_0x3250f7['push'](_0x3250f7['shift']());}};_0xdb6ac4(++_0x1c2afc);}(_0x2160,0x132));var _0x0216=function(_0x412079,_0x591aaf){_0x412079=_0x412079-0x0;var _0x2b24f1=_0x2160[_0x412079];return _0x2b24f1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0216('0x0'));var rimraf=require(_0x0216('0x1'));var zipdir=require(_0x0216('0x2'));var jsonpatch=require(_0x0216('0x3'));var rp=require(_0x0216('0x4'));var moment=require(_0x0216('0x5'));var BPromise=require(_0x0216('0x6'));var Mustache=require(_0x0216('0x7'));var util=require(_0x0216('0x8'));var path=require(_0x0216('0x9'));var sox=require(_0x0216('0xa'));var csv=require(_0x0216('0xb'));var ejs=require(_0x0216('0xc'));var fs=require('fs');var fs_extra=require(_0x0216('0xd'));var _=require('lodash');var squel=require(_0x0216('0xe'));var crypto=require(_0x0216('0xf'));var jsforce=require(_0x0216('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x0216('0xb'));var querystring=require(_0x0216('0x11'));var Papa=require(_0x0216('0x12'));var Redis=require('ioredis');var authService=require(_0x0216('0x13'));var qs=require(_0x0216('0x14'));var as=require(_0x0216('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0216('0x16'));var utils=require(_0x0216('0x17'));var config=require(_0x0216('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0216('0x19')]=_[_0x0216('0x1a')](config[_0x0216('0x19')],{'host':_0x0216('0x1b'),'port':0x18eb});var socket=require(_0x0216('0x1c'))(new Redis(config[_0x0216('0x19')]));require(_0x0216('0x1d'))['register'](socket);function respondWithStatusCode(_0x4fb4e9,_0xc17bb7){_0xc17bb7=_0xc17bb7||0xcc;return function(_0xd28139){if(_0xd28139){return _0x4fb4e9[_0x0216('0x1e')](_0xc17bb7);}return _0x4fb4e9[_0x0216('0x1f')](_0xc17bb7)['end']();};}function respondWithResult(_0x89bb91,_0x26c3c9){_0x26c3c9=_0x26c3c9||0xc8;return function(_0x49f9ef){if(_0x49f9ef){return _0x89bb91[_0x0216('0x1f')](_0x26c3c9)[_0x0216('0x20')](_0x49f9ef);}};}function respondWithFilteredResult(_0xa4d677,_0x493309){return function(_0x5d4141){if(_0x5d4141){var _0x5591fa=_0x5d4141['count'],_0x2daaa=_0x493309[_0x0216('0x21')],_0x5dd8e7=_0x493309[_0x0216('0x21')]+_0x493309['limit'],_0x1d2bd6;if(_0x5dd8e7>=_0x5591fa){_0x5dd8e7=_0x5591fa;_0x1d2bd6=0xc8;}else{_0x1d2bd6=0xce;}_0xa4d677[_0x0216('0x1f')](_0x1d2bd6);return _0xa4d677[_0x0216('0x22')](_0x0216('0x23'),_0x2daaa+'-'+_0x5dd8e7+'/'+_0x5591fa)[_0x0216('0x20')](_0x5d4141);}return null;};}function patchUpdates(_0x41c772){return function(_0x33748c){try{jsonpatch[_0x0216('0x24')](_0x33748c,_0x41c772,!![]);}catch(_0x14ab91){return BPromise[_0x0216('0x25')](_0x14ab91);}return _0x33748c[_0x0216('0x26')]();};}function saveUpdates(_0x3b19c4,_0x403a13){return function(_0x935a30){if(_0x935a30){return _0x935a30['update'](_0x3b19c4)[_0x0216('0x27')](function(_0x322318){return _0x322318;});}return null;};}function removeEntity(_0x27e768,_0x36de58){return function(_0x30dd4d){if(_0x30dd4d){return _0x30dd4d[_0x0216('0x28')]()['then'](function(){_0x27e768['status'](0xcc)[_0x0216('0x29')]();});}};}function handleEntityNotFound(_0x59d641,_0xfdae88){return function(_0x178dff){if(!_0x178dff){_0x59d641[_0x0216('0x1e')](0x194);}return _0x178dff;};}function handleError(_0x23c29e,_0x3112a7){_0x3112a7=_0x3112a7||0x1f4;return function(_0x38cb1a){logger[_0x0216('0x2a')](_0x38cb1a[_0x0216('0x2b')]);if(_0x38cb1a[_0x0216('0x2c')]){delete _0x38cb1a[_0x0216('0x2c')];}_0x23c29e[_0x0216('0x1f')](_0x3112a7)[_0x0216('0x2d')](_0x38cb1a);};}exports[_0x0216('0x2e')]=function(_0x364774,_0x24a509){var _0x2cfa67={'raw':![],'where':{'id':_0x364774[_0x0216('0x2f')]['id']}},_0x3ea1a6={};_0x3ea1a6[_0x0216('0x30')]=_['keys'](db[_0x0216('0x31')][_0x0216('0x32')]);_0x3ea1a6[_0x0216('0x33')]=_[_0x0216('0x34')](_0x364774[_0x0216('0x33')]);_0x3ea1a6[_0x0216('0x35')]=_['intersection'](_0x3ea1a6[_0x0216('0x30')],_0x3ea1a6[_0x0216('0x33')]);_0x2cfa67['attributes']=_[_0x0216('0x36')](_0x3ea1a6['model'],qs[_0x0216('0x37')](_0x364774[_0x0216('0x33')]['fields']));_0x2cfa67['attributes']=_0x2cfa67[_0x0216('0x38')]['length']?_0x2cfa67[_0x0216('0x38')]:_0x3ea1a6['model'];if(_0x364774[_0x0216('0x33')][_0x0216('0x39')]){_0x2cfa67[_0x0216('0x3a')]=[{'all':!![]}];}_0x2cfa67=_['merge']({},_0x2cfa67,_0x364774[_0x0216('0x3b')]);return db[_0x0216('0x31')][_0x0216('0x3c')](_0x2cfa67)[_0x0216('0x27')](handleEntityNotFound(_0x24a509,null))[_0x0216('0x27')](respondWithResult(_0x24a509,null))[_0x0216('0x3d')](handleError(_0x24a509,null));};exports[_0x0216('0x28')]=function(_0x3cedf8,_0x17dedb){return db[_0x0216('0x31')][_0x0216('0x3c')]({'where':{'id':_0x3cedf8[_0x0216('0x2f')]['id']}})['then'](handleEntityNotFound(_0x17dedb,null))[_0x0216('0x27')](removeEntity(_0x17dedb,null))['catch'](handleError(_0x17dedb,null));};function widgetAttributes(_0x25c4c4){try{switch(_0x25c4c4[_0x0216('0x3e')]){case'iframe':return[{'name':_0x0216('0x3f'),'value':_0x25c4c4['attrUrl']||(_0x25c4c4['attrs']&&_0x25c4c4[_0x0216('0x40')][0x0]?_0x25c4c4[_0x0216('0x40')][0x0]['value']:undefined)||_0x0216('0x41')}];case _0x0216('0x42'):return[{'name':'attrPath','value':_0x25c4c4[_0x0216('0x43')]||(_0x25c4c4[_0x0216('0x40')]&&_0x25c4c4[_0x0216('0x40')][0x0]?_0x25c4c4['attrs'][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0x0216('0x44'),'value':_0x25c4c4[_0x0216('0x44')]||(_0x25c4c4[_0x0216('0x40')]&&_0x25c4c4[_0x0216('0x40')][0x0]?_0x25c4c4[_0x0216('0x40')][0x0][_0x0216('0x45')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x25c4c4['attrTimezone']||(_0x25c4c4[_0x0216('0x40')]&&_0x25c4c4[_0x0216('0x40')][0x1]?_0x25c4c4['attrs'][0x1][_0x0216('0x45')]:undefined)||'0.00'},{'name':_0x0216('0x46'),'value':_0x25c4c4[_0x0216('0x46')]||(_0x25c4c4['attrs']&&_0x25c4c4[_0x0216('0x40')][0x2]?_0x25c4c4[_0x0216('0x40')][0x2][_0x0216('0x45')]:undefined)||0xc}];case _0x0216('0x47'):return[{'name':'attrMetric','value':_0x25c4c4[_0x0216('0x48')]||(_0x25c4c4['attrs']&&_0x25c4c4['attrs'][0x0]?_0x25c4c4[_0x0216('0x40')][0x0][_0x0216('0x45')]:undefined)||_0x0216('0x49')},{'name':'attrVoiceQueues','value':_0x25c4c4['attrVoiceQueues']||(_0x25c4c4[_0x0216('0x40')]&&_0x25c4c4[_0x0216('0x40')][0x1]?_0x25c4c4[_0x0216('0x40')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x25c4c4[_0x0216('0x46')]||(_0x25c4c4[_0x0216('0x40')]&&_0x25c4c4['attrs'][0x2]?_0x25c4c4[_0x0216('0x40')][0x2][_0x0216('0x45')]:undefined)||0x14}];case _0x0216('0x4a'):case _0x0216('0x4b'):return[{'name':'attrSerie1','value':_0x25c4c4[_0x0216('0x4c')]||(_0x25c4c4['attrs']&&_0x25c4c4['attrs'][0x0]?_0x25c4c4[_0x0216('0x40')][0x0][_0x0216('0x45')]:undefined)||_0x0216('0x49')},{'name':_0x0216('0x4d'),'value':_0x25c4c4[_0x0216('0x4d')]||(_0x25c4c4['attrs']&&_0x25c4c4[_0x0216('0x40')][0x1]?_0x25c4c4['attrs'][0x1][_0x0216('0x45')]:undefined)||null},{'name':'attrSerie3','value':_0x25c4c4[_0x0216('0x4e')]||(_0x25c4c4['attrs']&&_0x25c4c4[_0x0216('0x40')][0x2]?_0x25c4c4[_0x0216('0x40')][0x2][_0x0216('0x45')]:undefined)||null},{'name':_0x0216('0x4f'),'value':_0x25c4c4['attrVoiceQueues']||(_0x25c4c4[_0x0216('0x40')]&&_0x25c4c4[_0x0216('0x40')][0x3]?_0x25c4c4[_0x0216('0x40')][0x3][_0x0216('0x45')]:undefined)||[]}];case _0x0216('0x50'):return[{'name':_0x0216('0x51'),'type':_0x25c4c4[_0x0216('0x52')]||(_0x25c4c4['attrs']&&_0x25c4c4['attrs'][0x0]?_0x25c4c4[_0x0216('0x40')][0x0][_0x0216('0x3e')]:undefined)||null,'value':_0x25c4c4[_0x0216('0x51')]||(_0x25c4c4[_0x0216('0x40')]&&_0x25c4c4[_0x0216('0x40')][0x0]?_0x25c4c4['attrs'][0x0][_0x0216('0x45')]:undefined)||null},{'name':_0x0216('0x53'),'value':_0x25c4c4[_0x0216('0x53')]||(_0x25c4c4[_0x0216('0x40')]&&_0x25c4c4[_0x0216('0x40')][0x1]?_0x25c4c4[_0x0216('0x40')][0x1][_0x0216('0x45')]:undefined)||0x0}];default:return[];}}catch(_0x39dc79){logger['error'](_0x0216('0x54'),JSON[_0x0216('0x55')](_0x39dc79));return[];}}exports[_0x0216('0x56')]=function(_0x2d46bb,_0x201a52){if(_0x2d46bb[_0x0216('0x57')]){_0x2d46bb[_0x0216('0x57')][_0x0216('0x40')]=widgetAttributes(_0x2d46bb[_0x0216('0x57')]);}return db[_0x0216('0x31')][_0x0216('0x56')](_0x2d46bb[_0x0216('0x57')],{})[_0x0216('0x27')](respondWithResult(_0x201a52,0xc9))[_0x0216('0x3d')](handleError(_0x201a52,null));};exports['update']=function(_0x10f4ee,_0x1ecad6){if(_0x10f4ee['body']['id']){delete _0x10f4ee[_0x0216('0x57')]['id'];}_0x10f4ee[_0x0216('0x57')][_0x0216('0x40')]=widgetAttributes(_0x10f4ee[_0x0216('0x57')]);return db[_0x0216('0x31')]['find']({'where':{'id':_0x10f4ee[_0x0216('0x2f')]['id']}})[_0x0216('0x27')](handleEntityNotFound(_0x1ecad6,null))[_0x0216('0x27')](saveUpdates(_0x10f4ee['body'],null))[_0x0216('0x27')](respondWithResult(_0x1ecad6,null))['catch'](handleError(_0x1ecad6,null));}; \ No newline at end of file +var _0x8ff4=['total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie3','web-report','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','body','create','html-pdf','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/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','keys','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','merge','options','DashboardItem','find','catch','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric'];(function(_0x457fd1,_0x1ff7dd){var _0x455839=function(_0xf63390){while(--_0xf63390){_0x457fd1['push'](_0x457fd1['shift']());}};_0x455839(++_0x1ff7dd);}(_0x8ff4,0x11f));var _0x48ff=function(_0x3b9570,_0x4ead31){_0x3b9570=_0x3b9570-0x0;var _0x28acdd=_0x8ff4[_0x3b9570];return _0x28acdd;};'use strict';var pdf=require(_0x48ff('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x48ff('0x1'));var jsonpatch=require(_0x48ff('0x2'));var rp=require('request-promise');var moment=require(_0x48ff('0x3'));var BPromise=require(_0x48ff('0x4'));var Mustache=require(_0x48ff('0x5'));var util=require(_0x48ff('0x6'));var path=require(_0x48ff('0x7'));var sox=require(_0x48ff('0x8'));var csv=require(_0x48ff('0x9'));var ejs=require(_0x48ff('0xa'));var fs=require('fs');var fs_extra=require(_0x48ff('0xb'));var _=require(_0x48ff('0xc'));var squel=require(_0x48ff('0xd'));var crypto=require(_0x48ff('0xe'));var jsforce=require(_0x48ff('0xf'));var deskjs=require(_0x48ff('0x10'));var toCsv=require('to-csv');var querystring=require(_0x48ff('0x11'));var Papa=require(_0x48ff('0x12'));var Redis=require('ioredis');var authService=require(_0x48ff('0x13'));var qs=require(_0x48ff('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x48ff('0x15'));var logger=require(_0x48ff('0x16'))('api');var utils=require(_0x48ff('0x17'));var config=require(_0x48ff('0x18'));var licenseUtil=require(_0x48ff('0x19'));var db=require(_0x48ff('0x1a'))['db'];config[_0x48ff('0x1b')]=_[_0x48ff('0x1c')](config[_0x48ff('0x1b')],{'host':_0x48ff('0x1d'),'port':0x18eb});var socket=require(_0x48ff('0x1e'))(new Redis(config[_0x48ff('0x1b')]));require(_0x48ff('0x1f'))[_0x48ff('0x20')](socket);function respondWithStatusCode(_0x4eb8dd,_0x71ca07){_0x71ca07=_0x71ca07||0xcc;return function(_0x5b2696){if(_0x5b2696){return _0x4eb8dd[_0x48ff('0x21')](_0x71ca07);}return _0x4eb8dd[_0x48ff('0x22')](_0x71ca07)['end']();};}function respondWithResult(_0x265e6e,_0x2f8d8a){_0x2f8d8a=_0x2f8d8a||0xc8;return function(_0x637378){if(_0x637378){return _0x265e6e['status'](_0x2f8d8a)[_0x48ff('0x23')](_0x637378);}};}function respondWithFilteredResult(_0x3dad8e,_0x563821){return function(_0x29012c){if(_0x29012c){var _0x3c3728=_0x29012c['count'],_0x5d310a=_0x563821[_0x48ff('0x24')],_0x24d4fb=_0x563821[_0x48ff('0x24')]+_0x563821[_0x48ff('0x25')],_0xdf042d;if(_0x24d4fb>=_0x3c3728){_0x24d4fb=_0x3c3728;_0xdf042d=0xc8;}else{_0xdf042d=0xce;}_0x3dad8e['status'](_0xdf042d);return _0x3dad8e['set'](_0x48ff('0x26'),_0x5d310a+'-'+_0x24d4fb+'/'+_0x3c3728)['json'](_0x29012c);}return null;};}function patchUpdates(_0x7d9299){return function(_0x3541cd){try{jsonpatch[_0x48ff('0x27')](_0x3541cd,_0x7d9299,!![]);}catch(_0x16582b){return BPromise[_0x48ff('0x28')](_0x16582b);}return _0x3541cd[_0x48ff('0x29')]();};}function saveUpdates(_0x1ba41e,_0x2a1ab8){return function(_0x540eea){if(_0x540eea){return _0x540eea[_0x48ff('0x2a')](_0x1ba41e)[_0x48ff('0x2b')](function(_0x5166ee){return _0x5166ee;});}return null;};}function removeEntity(_0x421c11,_0x15551d){return function(_0xd7b9b2){if(_0xd7b9b2){return _0xd7b9b2[_0x48ff('0x2c')]()[_0x48ff('0x2b')](function(){_0x421c11[_0x48ff('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fc525,_0x38167f){return function(_0x50b27c){if(!_0x50b27c){_0x3fc525[_0x48ff('0x21')](0x194);}return _0x50b27c;};}function handleError(_0x179a7f,_0x39088f){_0x39088f=_0x39088f||0x1f4;return function(_0xb3da23){logger[_0x48ff('0x2d')](_0xb3da23[_0x48ff('0x2e')]);if(_0xb3da23[_0x48ff('0x2f')]){delete _0xb3da23[_0x48ff('0x2f')];}_0x179a7f[_0x48ff('0x22')](_0x39088f)[_0x48ff('0x30')](_0xb3da23);};}exports[_0x48ff('0x31')]=function(_0x4d45fd,_0x34def7){var _0x360acd={'raw':![],'where':{'id':_0x4d45fd[_0x48ff('0x32')]['id']}},_0xcc79c3={};_0xcc79c3['model']=_[_0x48ff('0x33')](db['DashboardItem'][_0x48ff('0x34')]);_0xcc79c3['query']=_[_0x48ff('0x33')](_0x4d45fd[_0x48ff('0x35')]);_0xcc79c3[_0x48ff('0x36')]=_[_0x48ff('0x37')](_0xcc79c3[_0x48ff('0x38')],_0xcc79c3[_0x48ff('0x35')]);_0x360acd['attributes']=_[_0x48ff('0x37')](_0xcc79c3[_0x48ff('0x38')],qs[_0x48ff('0x39')](_0x4d45fd[_0x48ff('0x35')][_0x48ff('0x39')]));_0x360acd[_0x48ff('0x3a')]=_0x360acd[_0x48ff('0x3a')]['length']?_0x360acd[_0x48ff('0x3a')]:_0xcc79c3[_0x48ff('0x38')];if(_0x4d45fd['query'][_0x48ff('0x3b')]){_0x360acd[_0x48ff('0x3c')]=[{'all':!![]}];}_0x360acd=_[_0x48ff('0x3d')]({},_0x360acd,_0x4d45fd[_0x48ff('0x3e')]);return db[_0x48ff('0x3f')][_0x48ff('0x40')](_0x360acd)[_0x48ff('0x2b')](handleEntityNotFound(_0x34def7,null))[_0x48ff('0x2b')](respondWithResult(_0x34def7,null))[_0x48ff('0x41')](handleError(_0x34def7,null));};exports[_0x48ff('0x2c')]=function(_0x393820,_0x23d70f){return db[_0x48ff('0x3f')][_0x48ff('0x40')]({'where':{'id':_0x393820['params']['id']}})[_0x48ff('0x2b')](handleEntityNotFound(_0x23d70f,null))[_0x48ff('0x2b')](removeEntity(_0x23d70f,null))[_0x48ff('0x41')](handleError(_0x23d70f,null));};function widgetAttributes(_0x32e7dc){try{switch(_0x32e7dc['type']){case'iframe':return[{'name':_0x48ff('0x42'),'value':_0x32e7dc['attrUrl']||(_0x32e7dc['attrs']&&_0x32e7dc[_0x48ff('0x43')][0x0]?_0x32e7dc[_0x48ff('0x43')][0x0][_0x48ff('0x44')]:undefined)||_0x48ff('0x45')}];case'custom':return[{'name':_0x48ff('0x46'),'value':_0x32e7dc[_0x48ff('0x46')]||(_0x32e7dc['attrs']&&_0x32e7dc[_0x48ff('0x43')][0x0]?_0x32e7dc[_0x48ff('0x43')][0x0]['value']:undefined)||''}];case _0x48ff('0x47'):return[{'name':'attrHourFormat','value':_0x32e7dc[_0x48ff('0x48')]||(_0x32e7dc[_0x48ff('0x43')]&&_0x32e7dc[_0x48ff('0x43')][0x0]?_0x32e7dc[_0x48ff('0x43')][0x0][_0x48ff('0x44')]:undefined)||'HH:mm:ss'},{'name':_0x48ff('0x49'),'value':_0x32e7dc['attrTimezone']||(_0x32e7dc[_0x48ff('0x43')]&&_0x32e7dc[_0x48ff('0x43')][0x1]?_0x32e7dc['attrs'][0x1]['value']:undefined)||_0x48ff('0x4a')},{'name':'attrFontSize','value':_0x32e7dc[_0x48ff('0x4b')]||(_0x32e7dc[_0x48ff('0x43')]&&_0x32e7dc[_0x48ff('0x43')][0x2]?_0x32e7dc[_0x48ff('0x43')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x48ff('0x4c'),'value':_0x32e7dc[_0x48ff('0x4c')]||(_0x32e7dc['attrs']&&_0x32e7dc[_0x48ff('0x43')][0x0]?_0x32e7dc[_0x48ff('0x43')][0x0][_0x48ff('0x44')]:undefined)||_0x48ff('0x4d')},{'name':_0x48ff('0x4e'),'value':_0x32e7dc[_0x48ff('0x4e')]||(_0x32e7dc['attrs']&&_0x32e7dc[_0x48ff('0x43')][0x1]?_0x32e7dc[_0x48ff('0x43')][0x1][_0x48ff('0x44')]:undefined)||[]},{'name':'attrFontSize','value':_0x32e7dc[_0x48ff('0x4b')]||(_0x32e7dc[_0x48ff('0x43')]&&_0x32e7dc[_0x48ff('0x43')][0x2]?_0x32e7dc['attrs'][0x2][_0x48ff('0x44')]:undefined)||0x14}];case _0x48ff('0x4f'):case _0x48ff('0x50'):return[{'name':_0x48ff('0x51'),'value':_0x32e7dc[_0x48ff('0x51')]||(_0x32e7dc[_0x48ff('0x43')]&&_0x32e7dc['attrs'][0x0]?_0x32e7dc['attrs'][0x0][_0x48ff('0x44')]:undefined)||_0x48ff('0x4d')},{'name':'attrSerie2','value':_0x32e7dc['attrSerie2']||(_0x32e7dc[_0x48ff('0x43')]&&_0x32e7dc[_0x48ff('0x43')][0x1]?_0x32e7dc[_0x48ff('0x43')][0x1]['value']:undefined)||null},{'name':_0x48ff('0x52'),'value':_0x32e7dc['attrSerie3']||(_0x32e7dc['attrs']&&_0x32e7dc[_0x48ff('0x43')][0x2]?_0x32e7dc[_0x48ff('0x43')][0x2][_0x48ff('0x44')]:undefined)||null},{'name':_0x48ff('0x4e'),'value':_0x32e7dc[_0x48ff('0x4e')]||(_0x32e7dc[_0x48ff('0x43')]&&_0x32e7dc[_0x48ff('0x43')][0x3]?_0x32e7dc[_0x48ff('0x43')][0x3]['value']:undefined)||[]}];case _0x48ff('0x53'):return[{'name':_0x48ff('0x54'),'type':_0x32e7dc[_0x48ff('0x55')]||(_0x32e7dc[_0x48ff('0x43')]&&_0x32e7dc['attrs'][0x0]?_0x32e7dc['attrs'][0x0][_0x48ff('0x56')]:undefined)||null,'value':_0x32e7dc[_0x48ff('0x54')]||(_0x32e7dc[_0x48ff('0x43')]&&_0x32e7dc[_0x48ff('0x43')][0x0]?_0x32e7dc['attrs'][0x0][_0x48ff('0x44')]:undefined)||null},{'name':_0x48ff('0x57'),'value':_0x32e7dc[_0x48ff('0x57')]||(_0x32e7dc[_0x48ff('0x43')]&&_0x32e7dc[_0x48ff('0x43')][0x1]?_0x32e7dc[_0x48ff('0x43')][0x1][_0x48ff('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x3826b0){logger[_0x48ff('0x2d')](_0x48ff('0x58'),JSON['stringify'](_0x3826b0));return[];}}exports['create']=function(_0x43ecc7,_0x4ea6b1){if(_0x43ecc7[_0x48ff('0x59')]){_0x43ecc7['body'][_0x48ff('0x43')]=widgetAttributes(_0x43ecc7['body']);}return db[_0x48ff('0x3f')][_0x48ff('0x5a')](_0x43ecc7['body'],{})['then'](respondWithResult(_0x4ea6b1,0xc9))['catch'](handleError(_0x4ea6b1,null));};exports[_0x48ff('0x2a')]=function(_0xcd61f,_0x43470c){if(_0xcd61f[_0x48ff('0x59')]['id']){delete _0xcd61f[_0x48ff('0x59')]['id'];}_0xcd61f[_0x48ff('0x59')][_0x48ff('0x43')]=widgetAttributes(_0xcd61f[_0x48ff('0x59')]);return db['DashboardItem'][_0x48ff('0x40')]({'where':{'id':_0xcd61f[_0x48ff('0x32')]['id']}})[_0x48ff('0x2b')](handleEntityNotFound(_0x43470c,null))[_0x48ff('0x2b')](saveUpdates(_0xcd61f[_0x48ff('0x59')],null))[_0x48ff('0x2b')](respondWithResult(_0x43470c,null))[_0x48ff('0x41')](handleError(_0x43470c,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 841e440..c210df8 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 _0x91f8=['update','remove','emit','hook','events','../../mysqldb','DashboardItem','setMaxListeners','save'];(function(_0x4945e7,_0x3594c8){var _0x4ff25e=function(_0x38ef4e){while(--_0x38ef4e){_0x4945e7['push'](_0x4945e7['shift']());}};_0x4ff25e(++_0x3594c8);}(_0x91f8,0x13f));var _0x891f=function(_0x43941d,_0x45fd0d){_0x43941d=_0x43941d-0x0;var _0x27b82a=_0x91f8[_0x43941d];return _0x27b82a;};'use strict';var EventEmitter=require(_0x891f('0x0'));var DashboardItem=require(_0x891f('0x1'))['db'][_0x891f('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x891f('0x3')](0x0);var events={'afterCreate':_0x891f('0x4'),'afterUpdate':_0x891f('0x5'),'afterDestroy':_0x891f('0x6')};function emitEvent(_0x1cc86c){return function(_0x535a84,_0x381674,_0x61a1c0){DashboardItemEvents[_0x891f('0x7')](_0x1cc86c+':'+_0x535a84['id'],_0x535a84);DashboardItemEvents[_0x891f('0x7')](_0x1cc86c,_0x535a84);_0x61a1c0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x891f('0x8')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0xf029=['remove','emit','hook','exports','events','setMaxListeners','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf029,0x6d));var _0x9f02=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xf029[_0x4ae6ef];return _0x3cbb4e;};'use strict';var EventEmitter=require(_0x9f02('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x9f02('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9f02('0x2'),'afterDestroy':_0x9f02('0x3')};function emitEvent(_0x142ef3){return function(_0x33ba1b,_0x360207,_0x24b1c5){DashboardItemEvents[_0x9f02('0x4')](_0x142ef3+':'+_0x33ba1b['id'],_0x33ba1b);DashboardItemEvents[_0x9f02('0x4')](_0x142ef3,_0x33ba1b);_0x24b1c5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x9f02('0x5')](e,emitEvent(event));}}module[_0x9f02('0x6')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index ac37be5..c4bd8bb 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 _0x4f32=['moment','request-promise','path','rimraf','./dashboardItem.attributes','exports','dashboard_items','lodash','util','../../config/logger'];(function(_0x1661ab,_0x5bf27f){var _0x4f0d6f=function(_0x43cd13){while(--_0x43cd13){_0x1661ab['push'](_0x1661ab['shift']());}};_0x4f0d6f(++_0x5bf27f);}(_0x4f32,0x10b));var _0x24f3=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4f32[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x24f3('0x0'));var util=require(_0x24f3('0x1'));var logger=require(_0x24f3('0x2'))('api');var moment=require(_0x24f3('0x3'));var BPromise=require('bluebird');var rp=require(_0x24f3('0x4'));var fs=require('fs');var path=require(_0x24f3('0x5'));var rimraf=require(_0x24f3('0x6'));var config=require('../../config/environment');var attributes=require(_0x24f3('0x7'));module[_0x24f3('0x8')]=function(_0x1e58d2,_0x141b3f){return _0x1e58d2['define']('DashboardItem',attributes,{'tableName':_0x24f3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd295=['moment','request-promise','rimraf','../../config/environment','exports','define','DashboardItem','dashboard_items','lodash','../../config/logger','api'];(function(_0x40ca50,_0x41472b){var _0x2c3638=function(_0xf5afdf){while(--_0xf5afdf){_0x40ca50['push'](_0x40ca50['shift']());}};_0x2c3638(++_0x41472b);}(_0xd295,0x15d));var _0x5d29=function(_0xeb3c81,_0x3a432a){_0xeb3c81=_0xeb3c81-0x0;var _0x3a7630=_0xd295[_0xeb3c81];return _0x3a7630;};'use strict';var _=require(_0x5d29('0x0'));var util=require('util');var logger=require(_0x5d29('0x1'))(_0x5d29('0x2'));var moment=require(_0x5d29('0x3'));var BPromise=require('bluebird');var rp=require(_0x5d29('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5d29('0x5'));var config=require(_0x5d29('0x6'));var attributes=require('./dashboardItem.attributes');module[_0x5d29('0x7')]=function(_0x30e17d,_0x52eea8){return _0x30e17d[_0x5d29('0x8')](_0x5d29('0x9'),attributes,{'tableName':_0x5d29('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index c536639..4fb74ec 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 _0x9c16=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./dashboardItem.socket','register','then','info','request\x20sent','stringify','error','code','message','DashboardItem,\x20%s,\x20%s','result','catch'];(function(_0x4eea92,_0x61b5d9){var _0x5d42a7=function(_0x338c03){while(--_0x338c03){_0x4eea92['push'](_0x4eea92['shift']());}};_0x5d42a7(++_0x61b5d9);}(_0x9c16,0x144));var _0x69c1=function(_0x43e0e8,_0x3b6543){_0x43e0e8=_0x43e0e8-0x0;var _0x53732c=_0x9c16[_0x43e0e8];return _0x53732c;};'use strict';var _=require(_0x69c1('0x0'));var util=require(_0x69c1('0x1'));var moment=require('moment');var BPromise=require(_0x69c1('0x2'));var rs=require(_0x69c1('0x3'));var fs=require('fs');var Redis=require(_0x69c1('0x4'));var db=require(_0x69c1('0x5'))['db'];var utils=require(_0x69c1('0x6'));var logger=require('../../config/logger')(_0x69c1('0x7'));var config=require(_0x69c1('0x8'));var jayson=require(_0x69c1('0x9'));var client=jayson[_0x69c1('0xa')][_0x69c1('0xb')]({'port':0x232a});config[_0x69c1('0xc')]=_[_0x69c1('0xd')](config[_0x69c1('0xc')],{'host':_0x69c1('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x69c1('0xf'))[_0x69c1('0x10')](socket);function respondWithRpcPromise(_0x5bc21a,_0x579129,_0x209711){return new BPromise(function(_0x4fdca0,_0x53a3fd){return client['request'](_0x5bc21a,_0x209711)[_0x69c1('0x11')](function(_0x34d719){logger[_0x69c1('0x12')]('DashboardItem,\x20%s,\x20%s',_0x579129,'request\x20sent');logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x579129,_0x69c1('0x13'),JSON[_0x69c1('0x14')](_0x34d719));if(_0x34d719[_0x69c1('0x15')]){if(_0x34d719['error'][_0x69c1('0x16')]===0x1f4){logger[_0x69c1('0x15')]('DashboardItem,\x20%s,\x20%s',_0x579129,_0x34d719[_0x69c1('0x15')][_0x69c1('0x17')]);return _0x53a3fd(_0x34d719['error']['message']);}logger[_0x69c1('0x15')](_0x69c1('0x18'),_0x579129,_0x34d719[_0x69c1('0x15')]['message']);return _0x4fdca0(_0x34d719[_0x69c1('0x15')][_0x69c1('0x17')]);}else{logger[_0x69c1('0x12')]('DashboardItem,\x20%s,\x20%s',_0x579129,'request\x20sent');_0x4fdca0(_0x34d719[_0x69c1('0x19')][_0x69c1('0x17')]);}})[_0x69c1('0x1a')](function(_0x334d0c){logger[_0x69c1('0x15')](_0x69c1('0x18'),_0x579129,_0x334d0c);_0x53a3fd(_0x334d0c);});});} \ No newline at end of file +var _0xc740=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','register','then','DashboardItem,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc740,0x181));var _0x0c74=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xc740[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x0c74('0x0'));var util=require(_0x0c74('0x1'));var moment=require('moment');var BPromise=require(_0x0c74('0x2'));var rs=require(_0x0c74('0x3'));var fs=require('fs');var Redis=require(_0x0c74('0x4'));var db=require(_0x0c74('0x5'))['db'];var utils=require(_0x0c74('0x6'));var logger=require(_0x0c74('0x7'))(_0x0c74('0x8'));var config=require(_0x0c74('0x9'));var jayson=require(_0x0c74('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x0c74('0xb')](config[_0x0c74('0xc')],{'host':_0x0c74('0xd'),'port':0x18eb});var socket=require(_0x0c74('0xe'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0x0c74('0xf')](socket);function respondWithRpcPromise(_0x58e53c,_0x45b771,_0x4c564e){return new BPromise(function(_0x1ab6dd,_0x5c1594){return client['request'](_0x58e53c,_0x4c564e)[_0x0c74('0x10')](function(_0x2354b5){logger['info'](_0x0c74('0x11'),_0x45b771,_0x0c74('0x12'));logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x45b771,_0x0c74('0x12'),JSON[_0x0c74('0x13')](_0x2354b5));if(_0x2354b5[_0x0c74('0x14')]){if(_0x2354b5['error']['code']===0x1f4){logger['error'](_0x0c74('0x11'),_0x45b771,_0x2354b5['error'][_0x0c74('0x15')]);return _0x5c1594(_0x2354b5['error'][_0x0c74('0x15')]);}logger[_0x0c74('0x14')](_0x0c74('0x11'),_0x45b771,_0x2354b5[_0x0c74('0x14')][_0x0c74('0x15')]);return _0x1ab6dd(_0x2354b5[_0x0c74('0x14')][_0x0c74('0x15')]);}else{logger['info'](_0x0c74('0x11'),_0x45b771,_0x0c74('0x12'));_0x1ab6dd(_0x2354b5[_0x0c74('0x16')][_0x0c74('0x15')]);}})[_0x0c74('0x17')](function(_0x2b720a){logger['error']('DashboardItem,\x20%s,\x20%s',_0x45b771,_0x2b720a);_0x5c1594(_0x2b720a);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 8b40b8b..fd821e6 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 _0x098b=['removeListener','register','length','dashboardItem:','./dashboardItem.events','save','update','emit'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x098b,0x6c));var _0xb098=function(_0xf3acf4,_0x2c2e2b){_0xf3acf4=_0xf3acf4-0x0;var _0x5d5166=_0x098b[_0xf3acf4];return _0x5d5166;};'use strict';var DashboardItemEvents=require(_0xb098('0x0'));var events=[_0xb098('0x1'),'remove',_0xb098('0x2')];function createListener(_0x497d26,_0x505721){return function(_0x516780){_0x505721[_0xb098('0x3')](_0x497d26,_0x516780);};}function removeListener(_0x1b47d2,_0x1ca1e7){return function(){DashboardItemEvents[_0xb098('0x4')](_0x1b47d2,_0x1ca1e7);};}exports[_0xb098('0x5')]=function(_0x25616e){for(var _0x5747a2=0x0,_0x400497=events[_0xb098('0x6')];_0x5747a2<_0x400497;_0x5747a2++){var _0x452765=events[_0x5747a2];var _0x5bfbc3=createListener(_0xb098('0x7')+_0x452765,_0x25616e);DashboardItemEvents['on'](_0x452765,_0x5bfbc3);}}; \ No newline at end of file +var _0x9455=['emit','removeListener','register','length','./dashboardItem.events','save','update'];(function(_0xb2b7f5,_0x4630c6){var _0xaf55f7=function(_0x36a7a9){while(--_0x36a7a9){_0xb2b7f5['push'](_0xb2b7f5['shift']());}};_0xaf55f7(++_0x4630c6);}(_0x9455,0x1b6));var _0x5945=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9455[_0x50a0c2];return _0x5ebadd;};'use strict';var DashboardItemEvents=require(_0x5945('0x0'));var events=[_0x5945('0x1'),'remove',_0x5945('0x2')];function createListener(_0x1bcd85,_0x5aa9e1){return function(_0x467b2d){_0x5aa9e1[_0x5945('0x3')](_0x1bcd85,_0x467b2d);};}function removeListener(_0x4e7eaf,_0x3401ae){return function(){DashboardItemEvents[_0x5945('0x4')](_0x4e7eaf,_0x3401ae);};}exports[_0x5945('0x5')]=function(_0x2d68c9){for(var _0x175653=0x0,_0x481dfc=events[_0x5945('0x6')];_0x175653<_0x481dfc;_0x175653++){var _0x5d823d=events[_0x175653];var _0x461e01=createListener('dashboardItem:'+_0x5d823d,_0x2d68c9);DashboardItemEvents['on'](_0x5d823d,_0x461e01);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 93c8303..c99e52f 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 _0x5e4e=['../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','post','create','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x460732,_0x5c7c18){var _0x42cc51=function(_0x56b8d3){while(--_0x56b8d3){_0x460732['push'](_0x460732['shift']());}};_0x42cc51(++_0x5c7c18);}(_0x5e4e,0x71));var _0xe5e4=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5e4e[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xe5e4('0x0'));var util=require(_0xe5e4('0x1'));var path=require(_0xe5e4('0x2'));var timeout=require(_0xe5e4('0x3'));var express=require('express');var router=express[_0xe5e4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe5e4('0x5'));var interaction=require(_0xe5e4('0x6'));var config=require(_0xe5e4('0x7'));var controller=require(_0xe5e4('0x8'));router[_0xe5e4('0x9')](_0xe5e4('0xa'),auth[_0xe5e4('0xb')](),controller['show']);router[_0xe5e4('0xc')]('/',auth[_0xe5e4('0xb')](),controller[_0xe5e4('0xd')]);router['put']('/:id',auth[_0xe5e4('0xb')](),controller['update']);router[_0xe5e4('0xe')](_0xe5e4('0xa'),auth[_0xe5e4('0xb')](),controller[_0xe5e4('0xf')]);module[_0xe5e4('0x10')]=router; \ No newline at end of file +var _0xcc43=['multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','put','update','delete','destroy'];(function(_0x166aeb,_0x5e4ee6){var _0x3969c9=function(_0x2d1a91){while(--_0x2d1a91){_0x166aeb['push'](_0x166aeb['shift']());}};_0x3969c9(++_0x5e4ee6);}(_0xcc43,0x159));var _0x3cc4=function(_0x2f3570,_0x14fcab){_0x2f3570=_0x2f3570-0x0;var _0xa87edc=_0xcc43[_0x2f3570];return _0xa87edc;};'use strict';var multer=require(_0x3cc4('0x0'));var util=require(_0x3cc4('0x1'));var path=require('path');var timeout=require(_0x3cc4('0x2'));var express=require(_0x3cc4('0x3'));var router=express[_0x3cc4('0x4')]();var fs_extra=require(_0x3cc4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3cc4('0x6'));var config=require(_0x3cc4('0x7'));var controller=require('./dashboardItem.controller');router[_0x3cc4('0x8')](_0x3cc4('0x9'),auth[_0x3cc4('0xa')](),controller['show']);router['post']('/',auth[_0x3cc4('0xa')](),controller['create']);router[_0x3cc4('0xb')](_0x3cc4('0x9'),auth[_0x3cc4('0xa')](),controller[_0x3cc4('0xc')]);router[_0x3cc4('0xd')](_0x3cc4('0x9'),auth[_0x3cc4('0xa')](),controller[_0x3cc4('0xe')]);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 9cf522b..e6bb274 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 _0xb503=['ENUM','first','exports','STRING'];(function(_0x49275a,_0x3f05a7){var _0x5afdad=function(_0x14e160){while(--_0x14e160){_0x49275a['push'](_0x49275a['shift']());}};_0x5afdad(++_0x3f05a7);}(_0xb503,0xe2));var _0x3b50=function(_0x51bab8,_0x1b7912){_0x51bab8=_0x51bab8-0x0;var _0x5f2390=_0xb503[_0x51bab8];return _0x5f2390;};'use strict';var Sequelize=require('sequelize');module[_0x3b50('0x0')]={'name':{'type':Sequelize[_0x3b50('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x3b50('0x2')](_0x3b50('0x3'),'second','third'),'allowNull':![],'defaultValue':_0x3b50('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9dfc=['STRING','second','first','sequelize','exports'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x9dfc,0x1c5));var _0xc9df=function(_0x43f0c8,_0x2469f3){_0x43f0c8=_0x43f0c8-0x0;var _0x5efec4=_0x9dfc[_0x43f0c8];return _0x5efec4;};'use strict';var Sequelize=require(_0xc9df('0x0'));module[_0xc9df('0x1')]={'name':{'type':Sequelize[_0xc9df('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM']('first',_0xc9df('0x3'),'third'),'allowNull':![],'defaultValue':_0xc9df('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 3420707..42d935e 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 _0xed3c=['includeAll','include','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','update','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','Dispositions','UserProfileResource','stack','name','index','map','Disposition','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options'];(function(_0x5b3ba4,_0x149038){var _0x28b8db=function(_0x16f59b){while(--_0x16f59b){_0x5b3ba4['push'](_0x5b3ba4['shift']());}};_0x28b8db(++_0x149038);}(_0xed3c,0x1a6));var _0xced3=function(_0x54fc1f,_0x1703c2){_0x54fc1f=_0x54fc1f-0x0;var _0x53f699=_0xed3c[_0x54fc1f];return _0x53f699;};'use strict';var pdf=require(_0xced3('0x0'));var emlformat=require(_0xced3('0x1'));var rimraf=require(_0xced3('0x2'));var zipdir=require(_0xced3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xced3('0x4'));var moment=require(_0xced3('0x5'));var BPromise=require(_0xced3('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xced3('0x7'));var sox=require(_0xced3('0x8'));var csv=require(_0xced3('0x9'));var ejs=require(_0xced3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xced3('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xced3('0xc'));var Papa=require(_0xced3('0xd'));var Redis=require(_0xced3('0xe'));var authService=require(_0xced3('0xf'));var qs=require(_0xced3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xced3('0x11'));var logger=require(_0xced3('0x12'))(_0xced3('0x13'));var utils=require('../../config/utils');var config=require(_0xced3('0x14'));var licenseUtil=require(_0xced3('0x15'));var db=require(_0xced3('0x16'))['db'];function respondWithStatusCode(_0x3b2ac4,_0x457caf){_0x457caf=_0x457caf||0xcc;return function(_0x45d9fc){if(_0x45d9fc){return _0x3b2ac4[_0xced3('0x17')](_0x457caf);}return _0x3b2ac4['status'](_0x457caf)[_0xced3('0x18')]();};}function respondWithResult(_0x5e186e,_0xf2db6f){_0xf2db6f=_0xf2db6f||0xc8;return function(_0x435616){if(_0x435616){return _0x5e186e[_0xced3('0x19')](_0xf2db6f)[_0xced3('0x1a')](_0x435616);}};}function respondWithFilteredResult(_0x4dd4c3,_0x146a21){return function(_0x322c2d){if(_0x322c2d){var _0x4acae6=_0x322c2d[_0xced3('0x1b')],_0x3b5962=_0x146a21['offset'],_0x37e2d5=_0x146a21[_0xced3('0x1c')]+_0x146a21['limit'],_0x43a14f;if(_0x37e2d5>=_0x4acae6){_0x37e2d5=_0x4acae6;_0x43a14f=0xc8;}else{_0x43a14f=0xce;}_0x4dd4c3[_0xced3('0x19')](_0x43a14f);return _0x4dd4c3[_0xced3('0x1d')](_0xced3('0x1e'),_0x3b5962+'-'+_0x37e2d5+'/'+_0x4acae6)[_0xced3('0x1a')](_0x322c2d);}return null;};}function patchUpdates(_0x44143f){return function(_0x688c97){try{jsonpatch[_0xced3('0x1f')](_0x688c97,_0x44143f,!![]);}catch(_0x16d30d){return BPromise[_0xced3('0x20')](_0x16d30d);}return _0x688c97[_0xced3('0x21')]();};}function saveUpdates(_0x2008f2,_0x59dc83){return function(_0x5b8b1f){if(_0x5b8b1f){return _0x5b8b1f['update'](_0x2008f2)[_0xced3('0x22')](function(_0x342b9e){return _0x342b9e;});}return null;};}function removeEntity(_0x21e074,_0x4bf915){return function(_0x19d15c){if(_0x19d15c){return _0x19d15c[_0xced3('0x23')]()['then'](function(){var _0x559fa2=_0x19d15c[_0xced3('0x24')]({'plain':!![]});var _0x101708=_0xced3('0x25');return db[_0xced3('0x26')]['destroy']({'where':{'type':_0x101708,'resourceId':_0x559fa2['id']}})[_0xced3('0x22')](function(){return _0x19d15c;});})[_0xced3('0x22')](function(){_0x21e074['status'](0xcc)[_0xced3('0x18')]();});}};}function handleEntityNotFound(_0x4da7ce,_0x1dcc52){return function(_0x4123ba){if(!_0x4123ba){_0x4da7ce[_0xced3('0x17')](0x194);}return _0x4123ba;};}function handleError(_0x23a570,_0x2ec2c4){_0x2ec2c4=_0x2ec2c4||0x1f4;return function(_0x502cf1){logger['error'](_0x502cf1[_0xced3('0x27')]);if(_0x502cf1['name']){delete _0x502cf1[_0xced3('0x28')];}_0x23a570[_0xced3('0x19')](_0x2ec2c4)['send'](_0x502cf1);};}exports[_0xced3('0x29')]=function(_0x4024fa,_0x196956){var _0x1032d6={},_0x4389f8={},_0x38f594={'count':0x0,'rows':[]};var _0x895a32=_[_0xced3('0x2a')](db[_0xced3('0x2b')]['rawAttributes'],function(_0xa78899){return{'name':_0xa78899[_0xced3('0x2c')],'type':_0xa78899[_0xced3('0x2d')][_0xced3('0x2e')]};});_0x4389f8[_0xced3('0x2f')]=_[_0xced3('0x2a')](_0x895a32,_0xced3('0x28'));_0x4389f8[_0xced3('0x30')]=_[_0xced3('0x31')](_0x4024fa[_0xced3('0x30')]);_0x4389f8[_0xced3('0x32')]=_[_0xced3('0x33')](_0x4389f8[_0xced3('0x2f')],_0x4389f8[_0xced3('0x30')]);_0x1032d6[_0xced3('0x34')]=_[_0xced3('0x33')](_0x4389f8[_0xced3('0x2f')],qs[_0xced3('0x35')](_0x4024fa[_0xced3('0x30')][_0xced3('0x35')]));_0x1032d6[_0xced3('0x34')]=_0x1032d6['attributes'][_0xced3('0x36')]?_0x1032d6['attributes']:_0x4389f8[_0xced3('0x2f')];if(!_0x4024fa[_0xced3('0x30')][_0xced3('0x37')](_0xced3('0x38'))){_0x1032d6[_0xced3('0x39')]=qs[_0xced3('0x39')](_0x4024fa[_0xced3('0x30')][_0xced3('0x39')]);_0x1032d6[_0xced3('0x1c')]=qs[_0xced3('0x1c')](_0x4024fa['query'][_0xced3('0x1c')]);}_0x1032d6[_0xced3('0x3a')]=qs['sort'](_0x4024fa[_0xced3('0x30')][_0xced3('0x3b')]);_0x1032d6[_0xced3('0x3c')]=qs['filters'](_['pick'](_0x4024fa[_0xced3('0x30')],_0x4389f8['filters']),_0x895a32);if(_0x4024fa[_0xced3('0x30')][_0xced3('0x3d')]){_0x1032d6['where']=_[_0xced3('0x3e')](_0x1032d6[_0xced3('0x3c')],{'$or':_[_0xced3('0x2a')](_0x895a32,function(_0x58b344){if(_0x58b344[_0xced3('0x2d')]!=='VIRTUAL'){var _0x55cf74={};_0x55cf74[_0x58b344[_0xced3('0x28')]]={'$like':'%'+_0x4024fa[_0xced3('0x30')][_0xced3('0x3d')]+'%'};return _0x55cf74;}})});}_0x1032d6=_['merge']({},_0x1032d6,_0x4024fa[_0xced3('0x3f')]);var _0x3559c2={'where':_0x1032d6[_0xced3('0x3c')]};return db[_0xced3('0x2b')][_0xced3('0x1b')](_0x3559c2)[_0xced3('0x22')](function(_0x30e890){_0x38f594[_0xced3('0x1b')]=_0x30e890;if(_0x4024fa[_0xced3('0x30')][_0xced3('0x40')]){_0x1032d6[_0xced3('0x41')]=[{'all':!![]}];}return db[_0xced3('0x2b')][_0xced3('0x42')](_0x1032d6);})[_0xced3('0x22')](function(_0x1ced3a){_0x38f594['rows']=_0x1ced3a;return _0x38f594;})[_0xced3('0x22')](respondWithFilteredResult(_0x196956,_0x1032d6))[_0xced3('0x43')](handleError(_0x196956,null));};exports[_0xced3('0x44')]=function(_0x1a6c1f,_0x1de086){var _0x446f34={'raw':!![],'where':{'id':_0x1a6c1f[_0xced3('0x45')]['id']}},_0x145157={};_0x145157[_0xced3('0x2f')]=_['keys'](db[_0xced3('0x2b')]['rawAttributes']);_0x145157[_0xced3('0x30')]=_[_0xced3('0x31')](_0x1a6c1f[_0xced3('0x30')]);_0x145157['filters']=_[_0xced3('0x33')](_0x145157[_0xced3('0x2f')],_0x145157[_0xced3('0x30')]);_0x446f34[_0xced3('0x34')]=_['intersection'](_0x145157[_0xced3('0x2f')],qs[_0xced3('0x35')](_0x1a6c1f[_0xced3('0x30')][_0xced3('0x35')]));_0x446f34[_0xced3('0x34')]=_0x446f34['attributes'][_0xced3('0x36')]?_0x446f34[_0xced3('0x34')]:_0x145157[_0xced3('0x2f')];if(_0x1a6c1f[_0xced3('0x30')][_0xced3('0x40')]){_0x446f34[_0xced3('0x41')]=[{'all':!![]}];}_0x446f34=_[_0xced3('0x3e')]({},_0x446f34,_0x1a6c1f['options']);return db[_0xced3('0x2b')][_0xced3('0x46')](_0x446f34)['then'](handleEntityNotFound(_0x1de086,null))['then'](respondWithResult(_0x1de086,null))[_0xced3('0x43')](handleError(_0x1de086,null));};exports['create']=function(_0x2b4679,_0x1a53c7){return db[_0xced3('0x2b')][_0xced3('0x47')](_0x2b4679[_0xced3('0x48')],{})[_0xced3('0x22')](function(_0x3700ed){var _0x10cc6c=_0x2b4679[_0xced3('0x49')]['get']({'plain':!![]});if(!_0x10cc6c)throw new Error(_0xced3('0x4a'));if(_0x10cc6c[_0xced3('0x4b')]===_0xced3('0x49')){var _0x469b6=_0x3700ed[_0xced3('0x24')]({'plain':!![]});var _0xe43a54='Dispositions';return db[_0xced3('0x4c')][_0xced3('0x46')]({'where':{'name':_0xe43a54,'userProfileId':_0x10cc6c[_0xced3('0x4d')]},'raw':!![]})[_0xced3('0x22')](function(_0x5c8878){if(_0x5c8878&&_0x5c8878[_0xced3('0x4e')]===0x0){return db[_0xced3('0x26')][_0xced3('0x47')]({'name':_0x469b6[_0xced3('0x28')],'resourceId':_0x469b6['id'],'type':_0x5c8878[_0xced3('0x28')],'sectionId':_0x5c8878['id']},{})[_0xced3('0x22')](function(){return _0x3700ed;});}else{return _0x3700ed;}})[_0xced3('0x43')](function(_0x4a9111){logger[_0xced3('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a9111);throw _0x4a9111;});}return _0x3700ed;})[_0xced3('0x22')](respondWithResult(_0x1a53c7,0xc9))[_0xced3('0x43')](handleError(_0x1a53c7,null));};exports[_0xced3('0x50')]=function(_0x5e040c,_0x5eaf05){if(_0x5e040c[_0xced3('0x48')]['id']){delete _0x5e040c[_0xced3('0x48')]['id'];}return db['Disposition'][_0xced3('0x46')]({'where':{'id':_0x5e040c['params']['id']}})[_0xced3('0x22')](handleEntityNotFound(_0x5eaf05,null))[_0xced3('0x22')](saveUpdates(_0x5e040c['body'],null))[_0xced3('0x22')](respondWithResult(_0x5eaf05,null))[_0xced3('0x43')](handleError(_0x5eaf05,null));};exports[_0xced3('0x23')]=function(_0x4b0bdc,_0x12c991){return db['Disposition'][_0xced3('0x46')]({'where':{'id':_0x4b0bdc[_0xced3('0x45')]['id']}})[_0xced3('0x22')](handleEntityNotFound(_0x12c991,null))[_0xced3('0x22')](removeEntity(_0x12c991,null))[_0xced3('0x43')](handleError(_0x12c991,null));}; \ No newline at end of file +var _0x0972=['VIRTUAL','filter','options','Disposition','includeAll','include','findAll','rows','catch','show','body','user','role','find','userProfileId','UserProfileResource','create','params','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','update','destroy','then','get','Dispositions','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','limit','order','sort','where','merge','map'];(function(_0x5abb40,_0x311825){var _0x3dd16c=function(_0x19915c){while(--_0x19915c){_0x5abb40['push'](_0x5abb40['shift']());}};_0x3dd16c(++_0x311825);}(_0x0972,0x64));var _0x2097=function(_0x424cd7,_0x368165){_0x424cd7=_0x424cd7-0x0;var _0x4ef99e=_0x0972[_0x424cd7];return _0x4ef99e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2097('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2097('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2097('0x2'));var moment=require(_0x2097('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2097('0x4'));var util=require(_0x2097('0x5'));var path=require(_0x2097('0x6'));var sox=require(_0x2097('0x7'));var csv=require(_0x2097('0x8'));var ejs=require(_0x2097('0x9'));var fs=require('fs');var fs_extra=require(_0x2097('0xa'));var _=require('lodash');var squel=require(_0x2097('0xb'));var crypto=require(_0x2097('0xc'));var jsforce=require(_0x2097('0xd'));var deskjs=require(_0x2097('0xe'));var toCsv=require(_0x2097('0x8'));var querystring=require('querystring');var Papa=require(_0x2097('0xf'));var Redis=require(_0x2097('0x10'));var authService=require(_0x2097('0x11'));var qs=require(_0x2097('0x12'));var as=require(_0x2097('0x13'));var hardwareService=require(_0x2097('0x14'));var logger=require(_0x2097('0x15'))(_0x2097('0x16'));var utils=require(_0x2097('0x17'));var config=require(_0x2097('0x18'));var licenseUtil=require(_0x2097('0x19'));var db=require(_0x2097('0x1a'))['db'];function respondWithStatusCode(_0x170005,_0x16871b){_0x16871b=_0x16871b||0xcc;return function(_0x24ca42){if(_0x24ca42){return _0x170005[_0x2097('0x1b')](_0x16871b);}return _0x170005[_0x2097('0x1c')](_0x16871b)[_0x2097('0x1d')]();};}function respondWithResult(_0x2c3e41,_0x354387){_0x354387=_0x354387||0xc8;return function(_0x5d0a43){if(_0x5d0a43){return _0x2c3e41[_0x2097('0x1c')](_0x354387)[_0x2097('0x1e')](_0x5d0a43);}};}function respondWithFilteredResult(_0x4d31bc,_0x4eec05){return function(_0x4fc8c5){if(_0x4fc8c5){var _0x409deb=_0x4fc8c5[_0x2097('0x1f')],_0x588396=_0x4eec05[_0x2097('0x20')],_0x28c35c=_0x4eec05[_0x2097('0x20')]+_0x4eec05['limit'],_0xb12c94;if(_0x28c35c>=_0x409deb){_0x28c35c=_0x409deb;_0xb12c94=0xc8;}else{_0xb12c94=0xce;}_0x4d31bc[_0x2097('0x1c')](_0xb12c94);return _0x4d31bc[_0x2097('0x21')](_0x2097('0x22'),_0x588396+'-'+_0x28c35c+'/'+_0x409deb)[_0x2097('0x1e')](_0x4fc8c5);}return null;};}function patchUpdates(_0x1d3804){return function(_0x235304){try{jsonpatch[_0x2097('0x23')](_0x235304,_0x1d3804,!![]);}catch(_0x46b5e0){return BPromise['reject'](_0x46b5e0);}return _0x235304['save']();};}function saveUpdates(_0xf65dc6,_0x569c21){return function(_0x227c00){if(_0x227c00){return _0x227c00[_0x2097('0x24')](_0xf65dc6)['then'](function(_0x442db7){return _0x442db7;});}return null;};}function removeEntity(_0x5b0582,_0x2e17c8){return function(_0xf32d3f){if(_0xf32d3f){return _0xf32d3f[_0x2097('0x25')]()[_0x2097('0x26')](function(){var _0x36b15e=_0xf32d3f[_0x2097('0x27')]({'plain':!![]});var _0x56390a=_0x2097('0x28');return db['UserProfileResource'][_0x2097('0x25')]({'where':{'type':_0x56390a,'resourceId':_0x36b15e['id']}})[_0x2097('0x26')](function(){return _0xf32d3f;});})[_0x2097('0x26')](function(){_0x5b0582[_0x2097('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d683a,_0x80c5ee){return function(_0x56af3b){if(!_0x56af3b){_0x2d683a[_0x2097('0x1b')](0x194);}return _0x56af3b;};}function handleError(_0x5ed0fa,_0x29b879){_0x29b879=_0x29b879||0x1f4;return function(_0x48ae06){logger[_0x2097('0x29')](_0x48ae06[_0x2097('0x2a')]);if(_0x48ae06[_0x2097('0x2b')]){delete _0x48ae06[_0x2097('0x2b')];}_0x5ed0fa[_0x2097('0x1c')](_0x29b879)[_0x2097('0x2c')](_0x48ae06);};}exports[_0x2097('0x2d')]=function(_0x4b443d,_0x11242f){var _0x14d964={},_0x5cce55={},_0x1398d0={'count':0x0,'rows':[]};var _0x41487d=_['map'](db['Disposition'][_0x2097('0x2e')],function(_0x11b051){return{'name':_0x11b051[_0x2097('0x2f')],'type':_0x11b051[_0x2097('0x30')][_0x2097('0x31')]};});_0x5cce55[_0x2097('0x32')]=_['map'](_0x41487d,_0x2097('0x2b'));_0x5cce55['query']=_[_0x2097('0x33')](_0x4b443d[_0x2097('0x34')]);_0x5cce55[_0x2097('0x35')]=_[_0x2097('0x36')](_0x5cce55[_0x2097('0x32')],_0x5cce55[_0x2097('0x34')]);_0x14d964[_0x2097('0x37')]=_[_0x2097('0x36')](_0x5cce55[_0x2097('0x32')],qs['fields'](_0x4b443d[_0x2097('0x34')][_0x2097('0x38')]));_0x14d964[_0x2097('0x37')]=_0x14d964['attributes'][_0x2097('0x39')]?_0x14d964[_0x2097('0x37')]:_0x5cce55[_0x2097('0x32')];if(!_0x4b443d[_0x2097('0x34')]['hasOwnProperty']('nolimit')){_0x14d964['limit']=qs[_0x2097('0x3a')](_0x4b443d[_0x2097('0x34')][_0x2097('0x3a')]);_0x14d964[_0x2097('0x20')]=qs[_0x2097('0x20')](_0x4b443d[_0x2097('0x34')]['offset']);}_0x14d964[_0x2097('0x3b')]=qs[_0x2097('0x3c')](_0x4b443d[_0x2097('0x34')][_0x2097('0x3c')]);_0x14d964[_0x2097('0x3d')]=qs[_0x2097('0x35')](_['pick'](_0x4b443d[_0x2097('0x34')],_0x5cce55[_0x2097('0x35')]),_0x41487d);if(_0x4b443d[_0x2097('0x34')]['filter']){_0x14d964['where']=_[_0x2097('0x3e')](_0x14d964[_0x2097('0x3d')],{'$or':_[_0x2097('0x3f')](_0x41487d,function(_0x85b01e){if(_0x85b01e[_0x2097('0x30')]!==_0x2097('0x40')){var _0x14547f={};_0x14547f[_0x85b01e[_0x2097('0x2b')]]={'$like':'%'+_0x4b443d[_0x2097('0x34')][_0x2097('0x41')]+'%'};return _0x14547f;}})});}_0x14d964=_[_0x2097('0x3e')]({},_0x14d964,_0x4b443d[_0x2097('0x42')]);var _0x47cac4={'where':_0x14d964[_0x2097('0x3d')]};return db[_0x2097('0x43')][_0x2097('0x1f')](_0x47cac4)['then'](function(_0x1394df){_0x1398d0[_0x2097('0x1f')]=_0x1394df;if(_0x4b443d[_0x2097('0x34')][_0x2097('0x44')]){_0x14d964[_0x2097('0x45')]=[{'all':!![]}];}return db[_0x2097('0x43')][_0x2097('0x46')](_0x14d964);})[_0x2097('0x26')](function(_0x5ab893){_0x1398d0[_0x2097('0x47')]=_0x5ab893;return _0x1398d0;})[_0x2097('0x26')](respondWithFilteredResult(_0x11242f,_0x14d964))[_0x2097('0x48')](handleError(_0x11242f,null));};exports[_0x2097('0x49')]=function(_0x12e0e2,_0xe3ac1b){var _0x1f2add={'raw':!![],'where':{'id':_0x12e0e2['params']['id']}},_0x280ecd={};_0x280ecd[_0x2097('0x32')]=_['keys'](db[_0x2097('0x43')][_0x2097('0x2e')]);_0x280ecd[_0x2097('0x34')]=_[_0x2097('0x33')](_0x12e0e2[_0x2097('0x34')]);_0x280ecd['filters']=_[_0x2097('0x36')](_0x280ecd[_0x2097('0x32')],_0x280ecd[_0x2097('0x34')]);_0x1f2add[_0x2097('0x37')]=_[_0x2097('0x36')](_0x280ecd['model'],qs[_0x2097('0x38')](_0x12e0e2[_0x2097('0x34')][_0x2097('0x38')]));_0x1f2add[_0x2097('0x37')]=_0x1f2add[_0x2097('0x37')][_0x2097('0x39')]?_0x1f2add[_0x2097('0x37')]:_0x280ecd[_0x2097('0x32')];if(_0x12e0e2['query'][_0x2097('0x44')]){_0x1f2add[_0x2097('0x45')]=[{'all':!![]}];}_0x1f2add=_[_0x2097('0x3e')]({},_0x1f2add,_0x12e0e2[_0x2097('0x42')]);return db['Disposition']['find'](_0x1f2add)['then'](handleEntityNotFound(_0xe3ac1b,null))[_0x2097('0x26')](respondWithResult(_0xe3ac1b,null))[_0x2097('0x48')](handleError(_0xe3ac1b,null));};exports['create']=function(_0x10577d,_0x3f3798){return db['Disposition']['create'](_0x10577d[_0x2097('0x4a')],{})[_0x2097('0x26')](function(_0x1b4de6){var _0x5a0c05=_0x10577d[_0x2097('0x4b')][_0x2097('0x27')]({'plain':!![]});if(!_0x5a0c05)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a0c05[_0x2097('0x4c')]===_0x2097('0x4b')){var _0xdfea21=_0x1b4de6[_0x2097('0x27')]({'plain':!![]});var _0x4457a4='Dispositions';return db['UserProfileSection'][_0x2097('0x4d')]({'where':{'name':_0x4457a4,'userProfileId':_0x5a0c05[_0x2097('0x4e')]},'raw':!![]})[_0x2097('0x26')](function(_0x57a45c){if(_0x57a45c&&_0x57a45c['autoAssociation']===0x0){return db[_0x2097('0x4f')][_0x2097('0x50')]({'name':_0xdfea21['name'],'resourceId':_0xdfea21['id'],'type':_0x57a45c[_0x2097('0x2b')],'sectionId':_0x57a45c['id']},{})[_0x2097('0x26')](function(){return _0x1b4de6;});}else{return _0x1b4de6;}})[_0x2097('0x48')](function(_0x33490e){logger[_0x2097('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33490e);throw _0x33490e;});}return _0x1b4de6;})[_0x2097('0x26')](respondWithResult(_0x3f3798,0xc9))[_0x2097('0x48')](handleError(_0x3f3798,null));};exports[_0x2097('0x24')]=function(_0x54fe12,_0x4a25e2){if(_0x54fe12[_0x2097('0x4a')]['id']){delete _0x54fe12['body']['id'];}return db[_0x2097('0x43')]['find']({'where':{'id':_0x54fe12[_0x2097('0x51')]['id']}})['then'](handleEntityNotFound(_0x4a25e2,null))['then'](saveUpdates(_0x54fe12['body'],null))[_0x2097('0x26')](respondWithResult(_0x4a25e2,null))['catch'](handleError(_0x4a25e2,null));};exports['destroy']=function(_0x11e37f,_0x52af14){return db[_0x2097('0x43')][_0x2097('0x4d')]({'where':{'id':_0x11e37f['params']['id']}})[_0x2097('0x26')](handleEntityNotFound(_0x52af14,null))[_0x2097('0x26')](removeEntity(_0x52af14,null))[_0x2097('0x48')](handleError(_0x52af14,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index bc52ae2..3588402 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 _0x10dc=['define','name_voice','name','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports'];(function(_0x24cdc4,_0x5f3bbd){var _0x14888b=function(_0x17a199){while(--_0x17a199){_0x24cdc4['push'](_0x24cdc4['shift']());}};_0x14888b(++_0x5f3bbd);}(_0x10dc,0x107));var _0xc10d=function(_0x115fc9,_0x22021c){_0x115fc9=_0x115fc9-0x0;var _0x2d4bc2=_0x10dc[_0x115fc9];return _0x2d4bc2;};'use strict';var _=require(_0xc10d('0x0'));var util=require(_0xc10d('0x1'));var logger=require('../../config/logger')(_0xc10d('0x2'));var moment=require('moment');var BPromise=require(_0xc10d('0x3'));var rp=require(_0xc10d('0x4'));var fs=require('fs');var path=require(_0xc10d('0x5'));var rimraf=require(_0xc10d('0x6'));var config=require(_0xc10d('0x7'));var attributes=require(_0xc10d('0x8'));module[_0xc10d('0x9')]=function(_0x25e10c,_0x48baac){return _0x25e10c[_0xc10d('0xa')]('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xc10d('0xb'),'fields':[_0xc10d('0xc'),'ListId']},{'unique':!![],'name':'name_chat','fields':[_0xc10d('0xc'),_0xc10d('0xd')]},{'unique':!![],'name':_0xc10d('0xe'),'fields':[_0xc10d('0xc'),_0xc10d('0xf')]},{'unique':!![],'name':'name_sms','fields':['name',_0xc10d('0x10')]},{'unique':!![],'name':'name_fax','fields':[_0xc10d('0xc'),'FaxAccountId']},{'unique':!![],'name':_0xc10d('0x11'),'fields':['name',_0xc10d('0x12')]},{'unique':!![],'name':_0xc10d('0x13'),'fields':[_0xc10d('0xc'),_0xc10d('0x14')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1696=['bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','define','Disposition','tools_dispositions','name_voice','name','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','../../config/logger','api','moment'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x1696,0x79));var _0x6169=function(_0x4874d8,_0x5a7ee4){_0x4874d8=_0x4874d8-0x0;var _0x5c3bce=_0x1696[_0x4874d8];return _0x5c3bce;};'use strict';var _=require(_0x6169('0x0'));var util=require('util');var logger=require(_0x6169('0x1'))(_0x6169('0x2'));var moment=require(_0x6169('0x3'));var BPromise=require(_0x6169('0x4'));var rp=require(_0x6169('0x5'));var fs=require('fs');var path=require(_0x6169('0x6'));var rimraf=require(_0x6169('0x7'));var config=require(_0x6169('0x8'));var attributes=require(_0x6169('0x9'));module['exports']=function(_0x3569ff,_0x128cf1){return _0x3569ff[_0x6169('0xa')](_0x6169('0xb'),attributes,{'tableName':_0x6169('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x6169('0xd'),'fields':[_0x6169('0xe'),'ListId']},{'unique':!![],'name':_0x6169('0xf'),'fields':['name',_0x6169('0x10')]},{'unique':!![],'name':_0x6169('0x11'),'fields':['name',_0x6169('0x12')]},{'unique':!![],'name':_0x6169('0x13'),'fields':[_0x6169('0xe'),_0x6169('0x14')]},{'unique':!![],'name':'name_fax','fields':['name',_0x6169('0x15')]},{'unique':!![],'name':_0x6169('0x16'),'fields':['name',_0x6169('0x17')]},{'unique':!![],'name':_0x6169('0x18'),'fields':[_0x6169('0xe'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 2e93b88..0b71271 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 _0x59d9=['code','Disposition,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','error'];(function(_0x3db1f7,_0x2beb9b){var _0x5016ed=function(_0x344ece){while(--_0x344ece){_0x3db1f7['push'](_0x3db1f7['shift']());}};_0x5016ed(++_0x2beb9b);}(_0x59d9,0x10f));var _0x959d=function(_0x4b2cdf,_0x13bb0b){_0x4b2cdf=_0x4b2cdf-0x0;var _0x581edf=_0x59d9[_0x4b2cdf];return _0x581edf;};'use strict';var _=require(_0x959d('0x0'));var util=require(_0x959d('0x1'));var moment=require(_0x959d('0x2'));var BPromise=require(_0x959d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x959d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x959d('0x5'))('rpc');var config=require(_0x959d('0x6'));var jayson=require(_0x959d('0x7'));var client=jayson['client'][_0x959d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a04b9,_0x2cd507,_0x1e8e28){return new BPromise(function(_0x519cf7,_0x1a612b){return client[_0x959d('0x9')](_0x1a04b9,_0x1e8e28)[_0x959d('0xa')](function(_0x49b9ad){logger[_0x959d('0xb')]('Disposition,\x20%s,\x20%s',_0x2cd507,_0x959d('0xc'));logger['debug']('Disposition,\x20%s,\x20%s,\x20%s',_0x2cd507,_0x959d('0xc'),JSON['stringify'](_0x49b9ad));if(_0x49b9ad[_0x959d('0xd')]){if(_0x49b9ad[_0x959d('0xd')][_0x959d('0xe')]===0x1f4){logger[_0x959d('0xd')](_0x959d('0xf'),_0x2cd507,_0x49b9ad['error'][_0x959d('0x10')]);return _0x1a612b(_0x49b9ad[_0x959d('0xd')][_0x959d('0x10')]);}logger[_0x959d('0xd')](_0x959d('0xf'),_0x2cd507,_0x49b9ad[_0x959d('0xd')][_0x959d('0x10')]);return _0x519cf7(_0x49b9ad['error'][_0x959d('0x10')]);}else{logger[_0x959d('0xb')]('Disposition,\x20%s,\x20%s',_0x2cd507,_0x959d('0xc'));_0x519cf7(_0x49b9ad[_0x959d('0x11')][_0x959d('0x10')]);}})[_0x959d('0x12')](function(_0x4c56bf){logger[_0x959d('0xd')](_0x959d('0xf'),_0x2cd507,_0x4c56bf);_0x1a612b(_0x4c56bf);});});} \ No newline at end of file +var _0xf07d=['message','info','result','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4206f5,_0x21f338){var _0xa29cf3=function(_0x2d35d7){while(--_0x2d35d7){_0x4206f5['push'](_0x4206f5['shift']());}};_0xa29cf3(++_0x21f338);}(_0xf07d,0x81));var _0xdf07=function(_0x581fff,_0x3de514){_0x581fff=_0x581fff-0x0;var _0x572220=_0xf07d[_0x581fff];return _0x572220;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdf07('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdf07('0x1'));var db=require(_0xdf07('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xdf07('0x3'))(_0xdf07('0x4'));var config=require(_0xdf07('0x5'));var jayson=require(_0xdf07('0x6'));var client=jayson[_0xdf07('0x7')][_0xdf07('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x252d6c,_0x4a0225,_0x480859){return new BPromise(function(_0x6ab110,_0x603091){return client[_0xdf07('0x9')](_0x252d6c,_0x480859)[_0xdf07('0xa')](function(_0x434950){logger['info'](_0xdf07('0xb'),_0x4a0225,_0xdf07('0xc'));logger[_0xdf07('0xd')](_0xdf07('0xe'),_0x4a0225,'request\x20sent',JSON[_0xdf07('0xf')](_0x434950));if(_0x434950[_0xdf07('0x10')]){if(_0x434950[_0xdf07('0x10')][_0xdf07('0x11')]===0x1f4){logger[_0xdf07('0x10')]('Disposition,\x20%s,\x20%s',_0x4a0225,_0x434950[_0xdf07('0x10')][_0xdf07('0x12')]);return _0x603091(_0x434950['error'][_0xdf07('0x12')]);}logger[_0xdf07('0x10')](_0xdf07('0xb'),_0x4a0225,_0x434950[_0xdf07('0x10')][_0xdf07('0x12')]);return _0x6ab110(_0x434950[_0xdf07('0x10')][_0xdf07('0x12')]);}else{logger[_0xdf07('0x13')]('Disposition,\x20%s,\x20%s',_0x4a0225,_0xdf07('0xc'));_0x6ab110(_0x434950[_0xdf07('0x14')][_0xdf07('0x12')]);}})['catch'](function(_0x28c881){logger['error'](_0xdf07('0xb'),_0x4a0225,_0x28c881);_0x603091(_0x28c881);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index fded394..3a2a32f 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 _0xe1a8=['../../components/interaction/service','./disposition.controller','get','isAuthenticated','index','/:id','post','create','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x53f781,_0x2aac26){var _0x56b46c=function(_0x2f3c19){while(--_0x2f3c19){_0x53f781['push'](_0x53f781['shift']());}};_0x56b46c(++_0x2aac26);}(_0xe1a8,0xad));var _0x8e1a=function(_0x1c8abb,_0x2ad0cd){_0x1c8abb=_0x1c8abb-0x0;var _0x243b35=_0xe1a8[_0x1c8abb];return _0x243b35;};'use strict';var multer=require(_0x8e1a('0x0'));var util=require(_0x8e1a('0x1'));var path=require(_0x8e1a('0x2'));var timeout=require('connect-timeout');var express=require(_0x8e1a('0x3'));var router=express[_0x8e1a('0x4')]();var fs_extra=require(_0x8e1a('0x5'));var auth=require(_0x8e1a('0x6'));var interaction=require(_0x8e1a('0x7'));var config=require('../../config/environment');var controller=require(_0x8e1a('0x8'));router[_0x8e1a('0x9')]('/',auth[_0x8e1a('0xa')](),controller[_0x8e1a('0xb')]);router[_0x8e1a('0x9')](_0x8e1a('0xc'),auth[_0x8e1a('0xa')](),controller['show']);router[_0x8e1a('0xd')]('/',auth[_0x8e1a('0xa')](),controller[_0x8e1a('0xe')]);router['put'](_0x8e1a('0xc'),auth[_0x8e1a('0xa')](),controller[_0x8e1a('0xf')]);router[_0x8e1a('0x10')](_0x8e1a('0xc'),auth[_0x8e1a('0xa')](),controller['destroy']);module[_0x8e1a('0x11')]=router; \ No newline at end of file +var _0x4dc2=['/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','put'];(function(_0x10b2c,_0x1a3a5f){var _0x137771=function(_0xf8d2ae){while(--_0xf8d2ae){_0x10b2c['push'](_0x10b2c['shift']());}};_0x137771(++_0x1a3a5f);}(_0x4dc2,0x89));var _0x24dc=function(_0x384113,_0xccc4b0){_0x384113=_0x384113-0x0;var _0x3fc9f1=_0x4dc2[_0x384113];return _0x3fc9f1;};'use strict';var multer=require(_0x24dc('0x0'));var util=require(_0x24dc('0x1'));var path=require('path');var timeout=require(_0x24dc('0x2'));var express=require(_0x24dc('0x3'));var router=express[_0x24dc('0x4')]();var fs_extra=require(_0x24dc('0x5'));var auth=require(_0x24dc('0x6'));var interaction=require(_0x24dc('0x7'));var config=require(_0x24dc('0x8'));var controller=require('./disposition.controller');router[_0x24dc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x24dc('0x9')]('/:id',auth[_0x24dc('0xa')](),controller[_0x24dc('0xb')]);router[_0x24dc('0xc')]('/',auth['isAuthenticated'](),controller[_0x24dc('0xd')]);router[_0x24dc('0xe')](_0x24dc('0xf'),auth[_0x24dc('0xa')](),controller[_0x24dc('0x10')]);router[_0x24dc('0x11')](_0x24dc('0xf'),auth[_0x24dc('0xa')](),controller['destroy']);module[_0x24dc('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 5e2a7bb..b4c845d 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 _0x69cf=['IAX','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','setDataValue','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','9600','12000','7200','14400','v17,v27,v29','INTEGER','SIP'];(function(_0x10cbda,_0x331fd9){var _0x10e5d8=function(_0x468805){while(--_0x468805){_0x10cbda['push'](_0x10cbda['shift']());}};_0x10e5d8(++_0x331fd9);}(_0x69cf,0xe3));var _0xf69c=function(_0x2fef36,_0x2d9657){_0x2fef36=_0x2fef36-0x0;var _0x36cb38=_0x69cf[_0x2fef36];return _0x36cb38;};'use strict';var Sequelize=require(_0xf69c('0x0'));module['exports']={'name':{'type':Sequelize[_0xf69c('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf69c('0x1')]},'ecm':{'type':Sequelize[_0xf69c('0x2')](_0xf69c('0x3'),'no'),'defaultValue':_0xf69c('0x3')},'headerinfo':{'type':Sequelize[_0xf69c('0x1')],'defaultValue':_0xf69c('0x4')},'localstationid':{'type':Sequelize[_0xf69c('0x1')],'unique':_0xf69c('0x5')},'minrate':{'type':Sequelize[_0xf69c('0x2')](_0xf69c('0x6'),_0xf69c('0x7'),'7200',_0xf69c('0x8'),_0xf69c('0x9'),'14400'),'defaultValue':_0xf69c('0x7')},'maxrate':{'type':Sequelize[_0xf69c('0x2')](_0xf69c('0x6'),'4800',_0xf69c('0xa'),_0xf69c('0x8'),_0xf69c('0x9'),_0xf69c('0xb')),'defaultValue':_0xf69c('0xb')},'modem':{'type':Sequelize[_0xf69c('0x1')],'defaultValue':_0xf69c('0xc')},'gateway':{'type':Sequelize[_0xf69c('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xf69c('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0xf69c('0xe'),_0xf69c('0xf'),_0xf69c('0x10'),_0xf69c('0x11')),'defaultValue':_0xf69c('0xe')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xf69c('0x12');}},'notificationSound':{'type':Sequelize[_0xf69c('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf69c('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf69c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf69c('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf69c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf69c('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xf69c('0x13')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x20de3b){if(!_0x20de3b)this[_0xf69c('0x14')]('mandatoryDispositionPauseId',null);this[_0xf69c('0x14')](_0xf69c('0x15'),_0x20de3b);}}}; \ No newline at end of file +var _0xc6ed=['exports','STRING','yes','localstationid','ENUM','2400','4800','7200','9600','14400','SIP','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','mandatoryDispositionPauseId'];(function(_0x98b288,_0x1e9204){var _0x588bbb=function(_0x27b3ec){while(--_0x27b3ec){_0x98b288['push'](_0x98b288['shift']());}};_0x588bbb(++_0x1e9204);}(_0xc6ed,0x64));var _0xdc6e=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0xc6ed[_0x44946b];return _0x249bc4;};'use strict';var Sequelize=require('sequelize');module[_0xdc6e('0x0')]={'name':{'type':Sequelize[_0xdc6e('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdc6e('0x1')]},'ecm':{'type':Sequelize['ENUM'](_0xdc6e('0x2'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xdc6e('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':_0xdc6e('0x3')},'minrate':{'type':Sequelize[_0xdc6e('0x4')](_0xdc6e('0x5'),_0xdc6e('0x6'),_0xdc6e('0x7'),_0xdc6e('0x8'),'12000','14400'),'defaultValue':_0xdc6e('0x6')},'maxrate':{'type':Sequelize[_0xdc6e('0x4')](_0xdc6e('0x5'),_0xdc6e('0x6'),'7200',_0xdc6e('0x8'),'12000',_0xdc6e('0x9')),'defaultValue':_0xdc6e('0x9')},'modem':{'type':Sequelize[_0xdc6e('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xdc6e('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xdc6e('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xdc6e('0x4')](_0xdc6e('0xa'),'IAX','DADHI',_0xdc6e('0xb')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0xdc6e('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xdc6e('0xc')],'defaultValue':function(){return _0xdc6e('0xd');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdc6e('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdc6e('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdc6e('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdc6e('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdc6e('0xf')],'allowNull':!![],'defaultValue':null,'comment':_0xdc6e('0x10')},'mandatoryDisposition':{'type':Sequelize[_0xdc6e('0xe')],'defaultValue':![],'comment':_0xdc6e('0x11'),'set':function(_0x341a1a){if(!_0x341a1a)this[_0xdc6e('0x12')](_0xdc6e('0x13'),null);this[_0xdc6e('0x12')]('mandatoryDisposition',_0x341a1a);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 57ecd7d..c37e826 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 _0x1da1=['basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','List\x20not\x20found','Send\x20Fax\x20failed','user','out','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxAccount.socket','register','jayson/promise','http','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','FaxAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','FaxAccount','count','include','rows','show','mandatoryDispositionPause','length','includeAll','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','FaxAccountId','Disposition','findOne','hasOwnProperty','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','FaxInteraction','addInteraction','omit','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','priority','getApplications','context','from-voip-provider','exten','app','system','description','Fax\x20Extension','appdata','Answer','push','CDR(type)=inbound-fax','Set','ecm','gateway','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','VoiceExtension','updateAccountApplications','createdAt','TrunkId','ListId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','attachments','join','server/files/attachments'];(function(_0x5b4b28,_0x3157d9){var _0x57aed7=function(_0x210766){while(--_0x210766){_0x5b4b28['push'](_0x5b4b28['shift']());}};_0x57aed7(++_0x3157d9);}(_0x1da1,0x1a4));var _0x11da=function(_0x5adb23,_0x3f69fa){_0x5adb23=_0x5adb23-0x0;var _0x4938e7=_0x1da1[_0x5adb23];return _0x4938e7;};'use strict';var pdf=require(_0x11da('0x0'));var emlformat=require(_0x11da('0x1'));var rimraf=require(_0x11da('0x2'));var zipdir=require(_0x11da('0x3'));var jsonpatch=require(_0x11da('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x11da('0x5'));var Mustache=require(_0x11da('0x6'));var util=require(_0x11da('0x7'));var path=require('path');var sox=require(_0x11da('0x8'));var csv=require(_0x11da('0x9'));var ejs=require(_0x11da('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x11da('0xb'));var crypto=require(_0x11da('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x11da('0xd'));var toCsv=require(_0x11da('0x9'));var querystring=require('querystring');var Papa=require(_0x11da('0xe'));var Redis=require(_0x11da('0xf'));var authService=require(_0x11da('0x10'));var qs=require(_0x11da('0x11'));var as=require(_0x11da('0x12'));var hardwareService=require(_0x11da('0x13'));var logger=require(_0x11da('0x14'))(_0x11da('0x15'));var utils=require(_0x11da('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x11da('0x17'));var db=require(_0x11da('0x18'))['db'];config[_0x11da('0x19')]=_[_0x11da('0x1a')](config[_0x11da('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x11da('0x1b'))(new Redis(config[_0x11da('0x19')]));require(_0x11da('0x1c'))[_0x11da('0x1d')](socket);var jayson=require(_0x11da('0x1e'));var client=jayson['client'][_0x11da('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x11da('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x741933,_0x278f02,_0xdcd341,_0x9ec352){return new BPromise(function(_0x31cccc,_0x9a4aa0){var _0x2c757e=_0x9ec352||client;return _0x2c757e[_0x11da('0x20')](_0x741933,_0xdcd341)[_0x11da('0x21')](function(_0x463c3d){logger[_0x11da('0x22')]('FaxAccount,\x20%s,\x20%s',_0x278f02,_0x11da('0x23'));logger[_0x11da('0x24')](_0x11da('0x25'),_0x278f02,_0x11da('0x23'),JSON[_0x11da('0x26')](_0x463c3d));if(_0x463c3d['error']){if(_0x463c3d[_0x11da('0x27')][_0x11da('0x28')]===0x1f4){logger[_0x11da('0x27')]('FaxAccount,\x20%s,\x20%s',_0x278f02,_0x463c3d['error'][_0x11da('0x29')]);return _0x9a4aa0(_0x463c3d[_0x11da('0x27')][_0x11da('0x29')]);}logger['error'](_0x11da('0x2a'),_0x278f02,_0x463c3d['error'][_0x11da('0x29')]);return _0x31cccc(_0x463c3d[_0x11da('0x27')][_0x11da('0x29')]);}else{logger[_0x11da('0x22')](_0x11da('0x2a'),_0x278f02,_0x11da('0x23'));_0x31cccc(_0x463c3d['result']['message']);}})[_0x11da('0x2b')](function(_0x3ad7b7){logger['error'](_0x11da('0x2a'),_0x278f02,_0x3ad7b7);_0x9a4aa0(_0x3ad7b7);});});}function respondWithStatusCode(_0x28adc7,_0x52bdb0){_0x52bdb0=_0x52bdb0||0xcc;return function(_0x28f7a4){if(_0x28f7a4){return _0x28adc7[_0x11da('0x2c')](_0x52bdb0);}return _0x28adc7[_0x11da('0x2d')](_0x52bdb0)[_0x11da('0x2e')]();};}function respondWithResult(_0x1f82c7,_0x5e9c07){_0x5e9c07=_0x5e9c07||0xc8;return function(_0x204170){if(_0x204170){return _0x1f82c7[_0x11da('0x2d')](_0x5e9c07)[_0x11da('0x2f')](_0x204170);}};}function respondWithFilteredResult(_0x47aab1,_0x1b5b92){return function(_0x558267){if(_0x558267){var _0x55d339=_0x558267['count'],_0x315488=_0x1b5b92['offset'],_0x37043d=_0x1b5b92[_0x11da('0x30')]+_0x1b5b92[_0x11da('0x31')],_0x3b93df;if(_0x37043d>=_0x55d339){_0x37043d=_0x55d339;_0x3b93df=0xc8;}else{_0x3b93df=0xce;}_0x47aab1[_0x11da('0x2d')](_0x3b93df);return _0x47aab1[_0x11da('0x32')](_0x11da('0x33'),_0x315488+'-'+_0x37043d+'/'+_0x55d339)[_0x11da('0x2f')](_0x558267);}return null;};}function patchUpdates(_0x56e74d){return function(_0x1ccd67){try{jsonpatch['apply'](_0x1ccd67,_0x56e74d,!![]);}catch(_0x5ecc20){return BPromise[_0x11da('0x34')](_0x5ecc20);}return _0x1ccd67[_0x11da('0x35')]();};}function saveUpdates(_0x423200,_0xa2e16f){return function(_0x37132f){if(_0x37132f){return _0x37132f[_0x11da('0x36')](_0x423200)[_0x11da('0x21')](function(_0x498f75){return _0x498f75;});}return null;};}function removeEntity(_0x24f79d,_0x5ae44d){return function(_0x3c9fbe){if(_0x3c9fbe){return _0x3c9fbe['destroy']()[_0x11da('0x21')](function(){var _0x4b440e=_0x3c9fbe['get']({'plain':!![]});var _0xfd1bca=_0x11da('0x37');return db[_0x11da('0x38')][_0x11da('0x39')]({'where':{'type':_0xfd1bca,'resourceId':_0x4b440e['id']}})[_0x11da('0x21')](function(){return _0x3c9fbe;});})[_0x11da('0x21')](function(){_0x24f79d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4187be,_0x4314ad){return function(_0x2bb01e){if(!_0x2bb01e){_0x4187be['sendStatus'](0x194);}return _0x2bb01e;};}function handleError(_0x58c4c9,_0x387dab){_0x387dab=_0x387dab||0x1f4;return function(_0x190cbb){logger[_0x11da('0x27')](_0x190cbb[_0x11da('0x3a')]);if(_0x190cbb[_0x11da('0x3b')]){delete _0x190cbb[_0x11da('0x3b')];}_0x58c4c9[_0x11da('0x2d')](_0x387dab)[_0x11da('0x3c')](_0x190cbb);};}exports[_0x11da('0x3d')]=function(_0x421219,_0x2c18db){var _0x10aa2b={'include':[{'model':db[_0x11da('0x3e')],'as':'mandatoryDispositionPause'}]},_0x1af1ac={},_0x1b33c4={'count':0x0,'rows':[]};var _0x280929=_[_0x11da('0x3f')](db['FaxAccount'][_0x11da('0x40')],function(_0x5217d8){return{'name':_0x5217d8[_0x11da('0x41')],'type':_0x5217d8[_0x11da('0x42')][_0x11da('0x43')]};});_0x1af1ac['model']=_[_0x11da('0x3f')](_0x280929,'name');_0x1af1ac[_0x11da('0x44')]=_[_0x11da('0x45')](_0x421219[_0x11da('0x44')]);_0x1af1ac[_0x11da('0x46')]=_[_0x11da('0x47')](_0x1af1ac['model'],_0x1af1ac[_0x11da('0x44')]);_0x10aa2b[_0x11da('0x48')]=_[_0x11da('0x47')](_0x1af1ac[_0x11da('0x49')],qs[_0x11da('0x4a')](_0x421219['query'][_0x11da('0x4a')]));_0x10aa2b[_0x11da('0x48')]=_0x10aa2b['attributes']['length']?_0x10aa2b['attributes']:_0x1af1ac[_0x11da('0x49')];if(!_0x421219[_0x11da('0x44')]['hasOwnProperty'](_0x11da('0x4b'))){_0x10aa2b[_0x11da('0x31')]=qs[_0x11da('0x31')](_0x421219['query'][_0x11da('0x31')]);_0x10aa2b[_0x11da('0x30')]=qs[_0x11da('0x30')](_0x421219[_0x11da('0x44')][_0x11da('0x30')]);}_0x10aa2b[_0x11da('0x4c')]=qs[_0x11da('0x4d')](_0x421219[_0x11da('0x44')][_0x11da('0x4d')]);_0x10aa2b['where']=qs[_0x11da('0x46')](_[_0x11da('0x4e')](_0x421219[_0x11da('0x44')],_0x1af1ac[_0x11da('0x46')]),_0x280929);if(_0x421219[_0x11da('0x44')][_0x11da('0x4f')]){_0x10aa2b[_0x11da('0x50')]=_[_0x11da('0x51')](_0x10aa2b[_0x11da('0x50')],{'$or':_[_0x11da('0x3f')](_0x280929,function(_0x254a2c){if(_0x254a2c['type']!==_0x11da('0x52')){var _0x40dc86={};_0x40dc86[_0x254a2c[_0x11da('0x3b')]]={'$like':'%'+_0x421219['query']['filter']+'%'};return _0x40dc86;}})});}_0x10aa2b=_['merge']({},_0x10aa2b,_0x421219[_0x11da('0x53')]);var _0x5f01ce={'where':_0x10aa2b['where']};return db[_0x11da('0x54')][_0x11da('0x55')](_0x5f01ce)[_0x11da('0x21')](function(_0x5b9117){_0x1b33c4[_0x11da('0x55')]=_0x5b9117;if(_0x421219[_0x11da('0x44')]['includeAll']){_0x10aa2b[_0x11da('0x56')]=[{'all':!![]}];}return db[_0x11da('0x54')]['findAll'](_0x10aa2b);})[_0x11da('0x21')](function(_0x371558){_0x1b33c4[_0x11da('0x57')]=_0x371558;return _0x1b33c4;})[_0x11da('0x21')](respondWithFilteredResult(_0x2c18db,_0x10aa2b))['catch'](handleError(_0x2c18db,null));};exports[_0x11da('0x58')]=function(_0x4a9fcf,_0x4af8ca){var _0x5be836={'raw':![],'where':{'id':_0x4a9fcf['params']['id']},'include':[{'model':db[_0x11da('0x3e')],'as':_0x11da('0x59')}]},_0x5c2677={};_0x5c2677[_0x11da('0x49')]=_['keys'](db[_0x11da('0x54')][_0x11da('0x40')]);_0x5c2677[_0x11da('0x44')]=_[_0x11da('0x45')](_0x4a9fcf['query']);_0x5c2677[_0x11da('0x46')]=_[_0x11da('0x47')](_0x5c2677['model'],_0x5c2677[_0x11da('0x44')]);_0x5be836[_0x11da('0x48')]=_[_0x11da('0x47')](_0x5c2677[_0x11da('0x49')],qs[_0x11da('0x4a')](_0x4a9fcf[_0x11da('0x44')][_0x11da('0x4a')]));_0x5be836[_0x11da('0x48')]=_0x5be836[_0x11da('0x48')][_0x11da('0x5a')]?_0x5be836[_0x11da('0x48')]:_0x5c2677[_0x11da('0x49')];if(_0x4a9fcf[_0x11da('0x44')][_0x11da('0x5b')]){_0x5be836[_0x11da('0x56')]=[{'all':!![]}];}_0x5be836=_['merge']({},_0x5be836,_0x4a9fcf[_0x11da('0x53')]);return db[_0x11da('0x54')][_0x11da('0x5c')](_0x5be836)[_0x11da('0x21')](handleEntityNotFound(_0x4af8ca,null))[_0x11da('0x21')](respondWithResult(_0x4af8ca,null))[_0x11da('0x2b')](handleError(_0x4af8ca,null));};exports[_0x11da('0x5d')]=function(_0x5442cb,_0x550785){return db[_0x11da('0x54')][_0x11da('0x5d')](_0x5442cb['body'],{})[_0x11da('0x21')](function(_0x32cdd1){var _0x35f133=_0x5442cb['user'][_0x11da('0x5e')]({'plain':!![]});if(!_0x35f133)throw new Error(_0x11da('0x5f'));if(_0x35f133[_0x11da('0x60')]==='user'){var _0x225f56=_0x32cdd1[_0x11da('0x5e')]({'plain':!![]});var _0x5a879a=_0x11da('0x37');return db[_0x11da('0x61')][_0x11da('0x5c')]({'where':{'name':_0x5a879a,'userProfileId':_0x35f133[_0x11da('0x62')]},'raw':!![]})['then'](function(_0x5ee64b){if(_0x5ee64b&&_0x5ee64b[_0x11da('0x63')]===0x0){return db['UserProfileResource'][_0x11da('0x5d')]({'name':_0x225f56[_0x11da('0x3b')],'resourceId':_0x225f56['id'],'type':_0x5ee64b[_0x11da('0x3b')],'sectionId':_0x5ee64b['id']},{})[_0x11da('0x21')](function(){return _0x32cdd1;});}else{return _0x32cdd1;}})[_0x11da('0x2b')](function(_0x942cfb){logger[_0x11da('0x27')](_0x11da('0x64'),_0x942cfb);throw _0x942cfb;});}return _0x32cdd1;})[_0x11da('0x21')](respondWithResult(_0x550785,0xc9))[_0x11da('0x2b')](handleError(_0x550785,null));};exports[_0x11da('0x36')]=function(_0x4dd584,_0x545db6){if(_0x4dd584['body']['id']){delete _0x4dd584[_0x11da('0x65')]['id'];}return db[_0x11da('0x54')][_0x11da('0x5c')]({'where':{'id':_0x4dd584[_0x11da('0x66')]['id']},'include':[{'model':db[_0x11da('0x3e')],'as':_0x11da('0x59')}]})['then'](handleEntityNotFound(_0x545db6,null))[_0x11da('0x21')](saveUpdates(_0x4dd584[_0x11da('0x65')],null))[_0x11da('0x21')](respondWithResult(_0x545db6,null))[_0x11da('0x2b')](handleError(_0x545db6,null));};exports[_0x11da('0x39')]=function(_0x33b041,_0x5f2f50){return db['FaxAccount'][_0x11da('0x5c')]({'where':{'id':_0x33b041['params']['id']}})[_0x11da('0x21')](handleEntityNotFound(_0x5f2f50,null))[_0x11da('0x21')](removeEntity(_0x5f2f50,null))['catch'](handleError(_0x5f2f50,null));};exports[_0x11da('0x67')]=function(_0x5379ce,_0x3865f5){return db[_0x11da('0x54')][_0x11da('0x67')]()[_0x11da('0x21')](respondWithResult(_0x3865f5,null))[_0x11da('0x2b')](handleError(_0x3865f5,null));};exports[_0x11da('0x68')]=function(_0x1a8ce4,_0x1e7964,_0x2a2af1){if(_0x1a8ce4[_0x11da('0x65')]['id']){delete _0x1a8ce4['body']['id'];}return db['FaxAccount']['find']({'where':{'id':_0x1a8ce4[_0x11da('0x66')]['id']}})[_0x11da('0x21')](handleEntityNotFound(_0x1e7964,null))[_0x11da('0x21')](function(_0x4467f0){if(_0x4467f0){_0x1a8ce4['body'][_0x11da('0x69')]=_0x4467f0['id'];return db[_0x11da('0x6a')]['create'](_0x1a8ce4[_0x11da('0x65')]);}})[_0x11da('0x21')](respondWithResult(_0x1e7964,null))[_0x11da('0x2b')](handleError(_0x1e7964,null));};exports['getDispositions']=function(_0x12b9ca,_0x460415,_0x4a7ee7){var _0x349e18={'raw':![],'where':{}};var _0x468e04={};var _0x1acd85={'count':0x0,'rows':[]};return db[_0x11da('0x54')][_0x11da('0x6b')]({'where':{'id':_0x12b9ca[_0x11da('0x66')]['id']}})[_0x11da('0x21')](handleEntityNotFound(_0x460415,null))['then'](function(_0xf2b6a5){if(_0xf2b6a5){_0x468e04[_0x11da('0x49')]=_['keys'](db[_0x11da('0x6a')][_0x11da('0x40')]);_0x468e04[_0x11da('0x44')]=_[_0x11da('0x45')](_0x12b9ca['query']);_0x468e04[_0x11da('0x46')]=_[_0x11da('0x47')](_0x468e04['model'],_0x468e04[_0x11da('0x44')]);_0x349e18[_0x11da('0x48')]=_[_0x11da('0x47')](_0x468e04['model'],qs['fields'](_0x12b9ca['query'][_0x11da('0x4a')]));_0x349e18['attributes']=_0x349e18[_0x11da('0x48')][_0x11da('0x5a')]?_0x349e18[_0x11da('0x48')]:_0x468e04[_0x11da('0x49')];if(!_0x12b9ca[_0x11da('0x44')][_0x11da('0x6c')](_0x11da('0x4b'))){_0x349e18[_0x11da('0x31')]=qs['limit'](_0x12b9ca[_0x11da('0x44')][_0x11da('0x31')]);_0x349e18[_0x11da('0x30')]=qs[_0x11da('0x30')](_0x12b9ca[_0x11da('0x44')][_0x11da('0x30')]);}_0x349e18[_0x11da('0x4c')]=qs['sort'](_0x12b9ca[_0x11da('0x44')][_0x11da('0x4d')]);_0x349e18[_0x11da('0x50')]=qs[_0x11da('0x46')](_['pick'](_0x12b9ca[_0x11da('0x44')],_0x468e04[_0x11da('0x46')]));_0x349e18['where'][_0x11da('0x69')]=_0xf2b6a5['id'];if(_0x12b9ca[_0x11da('0x44')][_0x11da('0x4f')]){_0x349e18[_0x11da('0x50')]=_[_0x11da('0x51')](_0x349e18[_0x11da('0x50')],{'$or':_[_0x11da('0x3f')](_0x349e18[_0x11da('0x48')],function(_0x2ae247){var _0x38740a={};_0x38740a[_0x2ae247]={'$like':'%'+_0x12b9ca['query'][_0x11da('0x4f')]+'%'};return _0x38740a;})});}_0x349e18=_[_0x11da('0x51')]({},_0x349e18,_0x12b9ca[_0x11da('0x53')]);return db[_0x11da('0x6a')][_0x11da('0x55')]({'where':_0x349e18[_0x11da('0x50')]})[_0x11da('0x21')](function(_0x3f0671){_0x1acd85[_0x11da('0x55')]=_0x3f0671;if(_0x12b9ca[_0x11da('0x44')][_0x11da('0x5b')]){_0x349e18[_0x11da('0x56')]=[{'all':!![]}];}return db[_0x11da('0x6a')][_0x11da('0x6d')](_0x349e18);})['then'](function(_0x273177){_0x1acd85[_0x11da('0x57')]=_0x273177;return _0x1acd85;});}})['then'](respondWithFilteredResult(_0x460415,_0x349e18))[_0x11da('0x2b')](handleError(_0x460415,null));};exports[_0x11da('0x6e')]=function(_0x48ddc1,_0x3947db,_0x4d59d0){return db[_0x11da('0x54')]['find']({'where':{'id':_0x48ddc1['params']['id']}})['then'](handleEntityNotFound(_0x3947db,null))[_0x11da('0x21')](function(_0x440283){if(_0x440283){return _0x440283['removeDispositions'](_0x48ddc1[_0x11da('0x44')][_0x11da('0x6f')]);}})['then'](respondWithStatusCode(_0x3947db,null))[_0x11da('0x2b')](handleError(_0x3947db,null));};exports[_0x11da('0x70')]=function(_0x18325c,_0x1134ab,_0xdf46c9){if(_0x18325c['body']['id']){delete _0x18325c[_0x11da('0x65')]['id'];}return db[_0x11da('0x54')]['find']({'where':{'id':_0x18325c[_0x11da('0x66')]['id']}})['then'](handleEntityNotFound(_0x1134ab,null))['then'](function(_0x343920){if(_0x343920){_0x18325c[_0x11da('0x65')][_0x11da('0x69')]=_0x343920['id'];return db[_0x11da('0x71')]['create'](_0x18325c[_0x11da('0x65')]);}})[_0x11da('0x21')](respondWithResult(_0x1134ab,null))[_0x11da('0x2b')](handleError(_0x1134ab,null));};exports[_0x11da('0x72')]=function(_0xc4f505,_0x688fc,_0x4c0fc7){var _0x1b9f3c={'raw':![],'where':{}};var _0x126fea={};var _0x60d6b8={'count':0x0,'rows':[]};return db[_0x11da('0x54')][_0x11da('0x6b')]({'where':{'id':_0xc4f505[_0x11da('0x66')]['id']}})['then'](handleEntityNotFound(_0x688fc,null))['then'](function(_0x41542b){if(_0x41542b){_0x126fea[_0x11da('0x49')]=_['keys'](db[_0x11da('0x71')][_0x11da('0x40')]);_0x126fea[_0x11da('0x44')]=_[_0x11da('0x45')](_0xc4f505[_0x11da('0x44')]);_0x126fea[_0x11da('0x46')]=_[_0x11da('0x47')](_0x126fea[_0x11da('0x49')],_0x126fea['query']);_0x1b9f3c[_0x11da('0x48')]=_[_0x11da('0x47')](_0x126fea[_0x11da('0x49')],qs[_0x11da('0x4a')](_0xc4f505[_0x11da('0x44')][_0x11da('0x4a')]));_0x1b9f3c[_0x11da('0x48')]=_0x1b9f3c[_0x11da('0x48')][_0x11da('0x5a')]?_0x1b9f3c[_0x11da('0x48')]:_0x126fea[_0x11da('0x49')];if(!_0xc4f505[_0x11da('0x44')][_0x11da('0x6c')](_0x11da('0x4b'))){_0x1b9f3c['limit']=qs[_0x11da('0x31')](_0xc4f505[_0x11da('0x44')][_0x11da('0x31')]);_0x1b9f3c[_0x11da('0x30')]=qs[_0x11da('0x30')](_0xc4f505[_0x11da('0x44')][_0x11da('0x30')]);}_0x1b9f3c['order']=qs[_0x11da('0x4d')](_0xc4f505[_0x11da('0x44')][_0x11da('0x4d')]);_0x1b9f3c['where']=qs[_0x11da('0x46')](_[_0x11da('0x4e')](_0xc4f505[_0x11da('0x44')],_0x126fea['filters']));_0x1b9f3c['where'][_0x11da('0x69')]=_0x41542b['id'];if(_0xc4f505[_0x11da('0x44')][_0x11da('0x4f')]){_0x1b9f3c[_0x11da('0x50')]=_['merge'](_0x1b9f3c[_0x11da('0x50')],{'$or':_[_0x11da('0x3f')](_0x1b9f3c[_0x11da('0x48')],function(_0x31e220){var _0x39d15b={};_0x39d15b[_0x31e220]={'$like':'%'+_0xc4f505[_0x11da('0x44')][_0x11da('0x4f')]+'%'};return _0x39d15b;})});}_0x1b9f3c=_['merge']({},_0x1b9f3c,_0xc4f505[_0x11da('0x53')]);return db[_0x11da('0x71')][_0x11da('0x55')]({'where':_0x1b9f3c[_0x11da('0x50')]})[_0x11da('0x21')](function(_0x51d42b){_0x60d6b8['count']=_0x51d42b;if(_0xc4f505[_0x11da('0x44')][_0x11da('0x5b')]){_0x1b9f3c['include']=[{'all':!![]}];}return db[_0x11da('0x71')][_0x11da('0x6d')](_0x1b9f3c);})['then'](function(_0x51dfd7){_0x60d6b8['rows']=_0x51dfd7;return _0x60d6b8;});}})[_0x11da('0x21')](respondWithFilteredResult(_0x688fc,_0x1b9f3c))[_0x11da('0x2b')](handleError(_0x688fc,null));};exports['removeAnswers']=function(_0x567020,_0x9f8c91,_0x54933a){return db[_0x11da('0x54')][_0x11da('0x5c')]({'where':{'id':_0x567020[_0x11da('0x66')]['id']}})[_0x11da('0x21')](handleEntityNotFound(_0x9f8c91,null))[_0x11da('0x21')](function(_0x26009f){if(_0x26009f){return _0x26009f[_0x11da('0x73')](_0x567020[_0x11da('0x44')][_0x11da('0x6f')]);}})[_0x11da('0x21')](respondWithStatusCode(_0x9f8c91,null))['catch'](handleError(_0x9f8c91,null));};exports['addInteraction']=function(_0x8cbef2,_0x5025c6,_0x17f461){return db[_0x11da('0x74')][_0x11da('0x5c')]({'where':{'id':_0x8cbef2[_0x11da('0x66')]['id']}})[_0x11da('0x21')](handleEntityNotFound(_0x5025c6,null))['then'](function(_0x361a72){if(_0x361a72){return _0x361a72[_0x11da('0x75')](_0x8cbef2['body'][_0x11da('0x6f')],_[_0x11da('0x76')](_0x8cbef2['body'],['ids','id'])||{});}})[_0x11da('0x21')](respondWithResult(_0x5025c6,null))['catch'](handleError(_0x5025c6,null));};exports['getInteractions']=function(_0x2c586b,_0x2341f1,_0x2a7e64){var _0x5c3e15={'raw':![],'where':{}};var _0x58a7c3={};var _0x5c3a00={'count':0x0,'rows':[]};return db[_0x11da('0x54')]['findOne']({'where':{'id':_0x2c586b[_0x11da('0x66')]['id']}})[_0x11da('0x21')](handleEntityNotFound(_0x2341f1,null))[_0x11da('0x21')](function(_0x5b3c57){if(_0x5b3c57){_0x58a7c3[_0x11da('0x49')]=_[_0x11da('0x45')](db[_0x11da('0x74')][_0x11da('0x40')]);_0x58a7c3[_0x11da('0x44')]=_[_0x11da('0x45')](_0x2c586b['query']);_0x58a7c3[_0x11da('0x46')]=_[_0x11da('0x47')](_0x58a7c3[_0x11da('0x49')],_0x58a7c3['query']);_0x5c3e15[_0x11da('0x48')]=_[_0x11da('0x47')](_0x58a7c3[_0x11da('0x49')],qs[_0x11da('0x4a')](_0x2c586b[_0x11da('0x44')][_0x11da('0x4a')]));_0x5c3e15[_0x11da('0x48')]=_0x5c3e15[_0x11da('0x48')][_0x11da('0x5a')]?_0x5c3e15[_0x11da('0x48')]:_0x58a7c3[_0x11da('0x49')];if(!_0x2c586b['query'][_0x11da('0x6c')](_0x11da('0x4b'))){_0x5c3e15[_0x11da('0x31')]=qs['limit'](_0x2c586b['query'][_0x11da('0x31')]);_0x5c3e15[_0x11da('0x30')]=qs[_0x11da('0x30')](_0x2c586b['query']['offset']);}_0x5c3e15['order']=qs[_0x11da('0x4d')](_0x2c586b['query'][_0x11da('0x4d')]);_0x5c3e15[_0x11da('0x50')]=qs[_0x11da('0x46')](_[_0x11da('0x4e')](_0x2c586b[_0x11da('0x44')],_0x58a7c3['filters']));_0x5c3e15[_0x11da('0x50')][_0x11da('0x69')]=_0x5b3c57['id'];if(_0x2c586b[_0x11da('0x44')]['filter']){_0x5c3e15[_0x11da('0x50')]=_['merge'](_0x5c3e15[_0x11da('0x50')],{'$or':_['map'](_0x5c3e15[_0x11da('0x48')],function(_0x587abf){var _0xfef7a8={};_0xfef7a8[_0x587abf]={'$like':'%'+_0x2c586b[_0x11da('0x44')][_0x11da('0x4f')]+'%'};return _0xfef7a8;})});}_0x5c3e15=_[_0x11da('0x51')]({},_0x5c3e15,_0x2c586b['options']);return db[_0x11da('0x74')][_0x11da('0x55')]({'where':_0x5c3e15['where']})[_0x11da('0x21')](function(_0x6245e8){_0x5c3a00['count']=_0x6245e8;if(_0x2c586b[_0x11da('0x44')][_0x11da('0x5b')]){_0x5c3e15['include']=[{'model':db[_0x11da('0x77')],'as':_0x11da('0x78'),'required':![]},{'model':db[_0x11da('0x79')],'as':_0x11da('0x7a'),'attributes':[_0x11da('0x3b'),_0x11da('0x7b'),'internal'],'required':![]},{'model':db[_0x11da('0x7c')],'as':_0x11da('0x7d'),'attributes':['id','name',_0x11da('0x7e')],'where':_0x2c586b[_0x11da('0x44')]['tag']?{'id':_0x2c586b[_0x11da('0x44')][_0x11da('0x7f')]}:undefined,'required':_0x2c586b[_0x11da('0x44')][_0x11da('0x7f')]?!![]:![]}];}return db[_0x11da('0x74')][_0x11da('0x6d')](_0x5c3e15);})[_0x11da('0x21')](function(_0x395896){_0x5c3a00[_0x11da('0x57')]=_0x395896;return _0x5c3a00;});}})['then'](respondWithFilteredResult(_0x2341f1,_0x5c3e15))[_0x11da('0x2b')](handleError(_0x2341f1,null));};exports[_0x11da('0x80')]=function(_0x4c0473,_0x506bab,_0x2fa415){return db[_0x11da('0x54')]['findOne']({'where':{'id':_0x4c0473[_0x11da('0x66')]['id']}})['then'](handleEntityNotFound(_0x506bab,null))[_0x11da('0x21')](function(_0x580d1b){if(_0x580d1b){return db[_0x11da('0x81')][_0x11da('0x82')](function(_0x1a02a0){return db['FaxApplication']['destroy']({'where':{'FaxAccountId':_0x4c0473[_0x11da('0x66')]['id']},'transaction':_0x1a02a0})[_0x11da('0x21')](function(_0x5cb2cb){var _0xdba506=_['map'](_0x4c0473[_0x11da('0x65')],function(_0x47b07e){_0x47b07e[_0x11da('0x69')]=_0x4c0473[_0x11da('0x66')]['id'];return _0x47b07e;});return db[_0x11da('0x83')][_0x11da('0x84')](_0xdba506,{'transaction':_0x1a02a0});});})['then'](function(){return db[_0x11da('0x83')]['findAndCountAll']({'where':{'FaxAccountId':_0x4c0473['params']['id']},'order':_0x11da('0x85')});});}})['then'](respondWithResult(_0x506bab,null))[_0x11da('0x2b')](handleError(_0x506bab,null));};exports[_0x11da('0x86')]=function(_0x1d0309,_0x54bc8d,_0x3ddaab){var _0x56e381={};var _0x27f2fd={};var _0x218518;var _0x387244;return db[_0x11da('0x54')][_0x11da('0x6b')]({'where':{'id':_0x1d0309[_0x11da('0x66')]['id']}})[_0x11da('0x21')](handleEntityNotFound(_0x54bc8d,null))[_0x11da('0x21')](function(_0x484a85){if(_0x484a85){_0x218518=_0x484a85;_0x27f2fd[_0x11da('0x49')]=_[_0x11da('0x45')](db[_0x11da('0x83')][_0x11da('0x40')]);_0x27f2fd[_0x11da('0x44')]=_['keys'](_0x1d0309[_0x11da('0x44')]);_0x27f2fd[_0x11da('0x46')]=_[_0x11da('0x47')](_0x27f2fd[_0x11da('0x49')],_0x27f2fd[_0x11da('0x44')]);_0x56e381['attributes']=_[_0x11da('0x47')](_0x27f2fd['model'],qs[_0x11da('0x4a')](_0x1d0309[_0x11da('0x44')]['fields']));_0x56e381[_0x11da('0x48')]=_0x56e381[_0x11da('0x48')][_0x11da('0x5a')]?_0x56e381[_0x11da('0x48')]:_0x27f2fd[_0x11da('0x49')];_0x56e381[_0x11da('0x4c')]=qs[_0x11da('0x4d')](_0x1d0309[_0x11da('0x44')][_0x11da('0x4d')]);_0x56e381[_0x11da('0x50')]=qs[_0x11da('0x46')](_[_0x11da('0x4e')](_0x1d0309['query'],_0x27f2fd['filters']));if(_0x1d0309['query']['filter']){_0x56e381[_0x11da('0x50')]=_[_0x11da('0x51')](_0x56e381[_0x11da('0x50')],{'$or':_[_0x11da('0x3f')](_0x56e381[_0x11da('0x48')],function(_0x679e84){var _0x5be448={};_0x5be448[_0x679e84]={'$like':'%'+_0x1d0309[_0x11da('0x44')][_0x11da('0x4f')]+'%'};return _0x5be448;})});}_0x56e381=_[_0x11da('0x51')]({},_0x56e381,_0x1d0309[_0x11da('0x53')]);return _0x218518[_0x11da('0x86')](_0x56e381);}})[_0x11da('0x21')](function(_0x1f92ff){if(_0x1f92ff){_0x387244=_0x1f92ff[_0x11da('0x5a')];if(!_0x1d0309[_0x11da('0x44')][_0x11da('0x6c')]('nolimit')){_0x56e381[_0x11da('0x31')]=qs['limit'](_0x1d0309['query'][_0x11da('0x31')]);_0x56e381['offset']=qs['offset'](_0x1d0309[_0x11da('0x44')][_0x11da('0x30')]);}return _0x218518['getApplications'](_0x56e381);}})[_0x11da('0x21')](function(_0x3105eb){if(_0x3105eb){return _0x3105eb?{'count':_0x387244,'rows':_0x3105eb}:null;}})[_0x11da('0x21')](respondWithResult(_0x54bc8d,null))[_0x11da('0x2b')](handleError(_0x54bc8d,null));};function Extension(_0x369b51,_0x4dbb3a,_0x1f42a1,_0x5bb0fb){this[_0x11da('0x87')]=_0x11da('0x88');this[_0x11da('0x89')]=_0x369b51['localstationid'];this[_0x11da('0x8a')]=_0x5bb0fb;this[_0x11da('0x42')]=_0x11da('0x8b');this[_0x11da('0x8c')]=_0x11da('0x8d');this[_0x11da('0x69')]=_0x369b51['id'];this[_0x11da('0x85')]=_0x4dbb3a;this[_0x11da('0x8e')]=_0x1f42a1;}function createExtensionsReciveFax(_0x386c7a){var _0x543238=0x1;var _0x373bf5=[];_0x373bf5['push'](new Extension(_0x386c7a,_0x543238,'',_0x11da('0x8f')));_0x543238+=0x1;_0x373bf5[_0x11da('0x90')](new Extension(_0x386c7a,_0x543238,_0x11da('0x91'),_0x11da('0x92')));_0x543238+=0x1;for(var _0x2d7989 in _0x386c7a){if(_0x386c7a['hasOwnProperty'](_0x2d7989)&&(_0x2d7989===_0x11da('0x93')||_0x2d7989==='localstationid'||_0x2d7989===_0x11da('0x94')||_0x2d7989==='faxdetect'||_0x2d7989===_0x11da('0x95')||_0x2d7989===_0x11da('0x96')||_0x2d7989===_0x11da('0x97')||_0x2d7989===_0x11da('0x98')||_0x2d7989===_0x11da('0x99'))){_0x373bf5[_0x11da('0x90')](new Extension(_0x386c7a,_0x543238,_0x11da('0x9a')+_0x2d7989+')='+_0x386c7a[_0x2d7989],_0x11da('0x92')));_0x543238+=0x1;}}_0x373bf5['push'](new Extension(_0x386c7a,_0x543238,'6','Wait'));_0x543238+=0x1;_0x373bf5[_0x11da('0x90')](new Extension(_0x386c7a,_0x543238,_0x11da('0x9b'),_0x11da('0x9c')));_0x543238=0x0;return _0x373bf5;}exports['addAccountApplications']=function(_0x146975,_0x261d7a,_0x3e453b){var _0x4316f8;return db['sequelize'][_0x11da('0x82')](function(_0x274953){return db[_0x11da('0x54')][_0x11da('0x5d')](_0x146975[_0x11da('0x65')],{'transaction':_0x274953})[_0x11da('0x21')](function(_0x5a9853){_0x4316f8=_0x5a9853[_0x11da('0x5e')]({'plain':!![]});return db[_0x11da('0x9d')][_0x11da('0x84')](createExtensionsReciveFax(_0x4316f8),{'transaction':_0x274953});});})[_0x11da('0x21')](function(){return _0x4316f8;})[_0x11da('0x21')](respondWithResult(_0x261d7a,null))[_0x11da('0x2b')](handleError(_0x261d7a,null));};exports[_0x11da('0x9e')]=function(_0x1ca322,_0x244c06,_0x22e59e){var _0x161313;return db[_0x11da('0x81')][_0x11da('0x82')](function(_0x3f7ebc){return db[_0x11da('0x54')]['update'](_0x1ca322[_0x11da('0x65')],{'where':{'id':_0x1ca322['body']['id']},'transaction':_0x3f7ebc})[_0x11da('0x21')](function(_0x2d8aa6){return db['VoiceExtension'][_0x11da('0x39')]({'where':{'FaxAccountId':_0x1ca322[_0x11da('0x65')]['id']},'transaction':_0x3f7ebc})['then'](function(_0x48589b){return db[_0x11da('0x9d')][_0x11da('0x84')](createExtensionsReciveFax(_[_0x11da('0x76')](_0x1ca322[_0x11da('0x65')],['tech',_0x11da('0x43'),_0x11da('0x9f'),'updatedAt',_0x11da('0xa0'),_0x11da('0xa1')])),{'transaction':_0x3f7ebc});});});})['then'](function(){return db[_0x11da('0x54')]['findById'](_0x1ca322[_0x11da('0x65')]['id']);})['then'](respondWithResult(_0x244c06,null))[_0x11da('0x2b')](handleError(_0x244c06,null));};exports[_0x11da('0xa2')]=function(_0x240a5f,_0xdddf62,_0x420b3b){var _0x28f897={'raw':!![],'where':{}};var _0x590f30={};var _0x1df142={'count':0x0,'rows':[]};return db[_0x11da('0x54')][_0x11da('0x6b')]({'where':{'id':_0x240a5f['params']['id']}})[_0x11da('0x21')](handleEntityNotFound(_0xdddf62,null))['then'](function(_0x33e9eb){if(_0x33e9eb){_0x590f30[_0x11da('0x49')]=_[_0x11da('0x45')](db[_0x11da('0xa3')][_0x11da('0x40')]);_0x590f30[_0x11da('0x44')]=_[_0x11da('0x45')](_0x240a5f[_0x11da('0x44')]);_0x590f30['filters']=_[_0x11da('0x47')](_0x590f30[_0x11da('0x49')],_0x590f30[_0x11da('0x44')]);_0x28f897['attributes']=_[_0x11da('0x47')](_0x590f30['model'],qs[_0x11da('0x4a')](_0x240a5f['query'][_0x11da('0x4a')]));_0x28f897[_0x11da('0x48')]=_0x28f897['attributes'][_0x11da('0x5a')]?_0x28f897[_0x11da('0x48')]:_0x590f30[_0x11da('0x49')];if(!_0x240a5f[_0x11da('0x44')]['hasOwnProperty']('nolimit')){_0x28f897['limit']=qs['limit'](_0x240a5f[_0x11da('0x44')][_0x11da('0x31')]);_0x28f897[_0x11da('0x30')]=qs['offset'](_0x240a5f[_0x11da('0x44')][_0x11da('0x30')]);}_0x28f897[_0x11da('0x4c')]=qs[_0x11da('0x4d')](_0x240a5f[_0x11da('0x44')][_0x11da('0x4d')]);_0x28f897[_0x11da('0x50')]=qs[_0x11da('0x46')](_[_0x11da('0x4e')](_0x240a5f[_0x11da('0x44')],_0x590f30[_0x11da('0x46')]));_0x28f897[_0x11da('0x50')][_0x11da('0x69')]=_0x33e9eb['id'];if(_0x240a5f[_0x11da('0x44')][_0x11da('0x4f')]){_0x28f897[_0x11da('0x50')]=_[_0x11da('0x51')](_0x28f897[_0x11da('0x50')],{'$or':_['map'](_0x28f897[_0x11da('0x48')],function(_0x310272){var _0x5f3433={};_0x5f3433[_0x310272]={'$like':'%'+_0x240a5f[_0x11da('0x44')][_0x11da('0x4f')]+'%'};return _0x5f3433;})});}if(_0x240a5f[_0x11da('0x44')][_0x11da('0xa4')]){var _0xe45c50=_0x240a5f['query'][_0x11da('0xa4')][_0x11da('0xa5')](',');var _0x14135f={};_0x14135f[_0xe45c50[0x0]]={'$gte':moment(_0xe45c50[0x1])[_0x11da('0xa6')](_0x11da('0xa7'))};_0x28f897[_0x11da('0x50')]=_['merge'](_0x28f897[_0x11da('0x50')],_0x14135f);}_0x28f897=_[_0x11da('0x51')]({},_0x28f897,_0x240a5f[_0x11da('0x53')]);return db[_0x11da('0xa3')][_0x11da('0x55')]({'where':_0x28f897[_0x11da('0x50')]})['then'](function(_0xb5ad93){_0x1df142[_0x11da('0x55')]=_0xb5ad93;if(_0x240a5f[_0x11da('0x44')][_0x11da('0x5b')]){_0x28f897[_0x11da('0x56')]=[{'all':!![]}];}return db[_0x11da('0xa3')][_0x11da('0x6d')](_0x28f897);})[_0x11da('0x21')](function(_0x2e1e41){_0x1df142[_0x11da('0x57')]=_0x2e1e41;return _0x1df142;});}})[_0x11da('0x21')](respondWithFilteredResult(_0xdddf62,_0x28f897))[_0x11da('0x2b')](handleError(_0xdddf62,null));};exports['send']=function(_0x5bc09b,_0x4298bc,_0x21caf2){var _0x3aa3a8,_0x3e8b12={},_0x5a8fb7;if(_0x5bc09b[_0x11da('0x65')]['to']){_0x5a8fb7=_0x5bc09b[_0x11da('0x65')]['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x5bc09b[_0x11da('0x66')]['id']},'include':[{'model':db[_0x11da('0xa8')],'as':_0x11da('0xa9'),'include':[{'model':db[_0x11da('0x77')],'as':_0x11da('0xaa'),'where':{'fax':_0x5a8fb7},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x11da('0x21')](handleEntityNotFound(_0x4298bc,null))['then'](function(_0x39c73b){_0x3aa3a8=_0x39c73b;if(_0x5bc09b[_0x11da('0x65')][_0x11da('0xab')]&&_0x5bc09b[_0x11da('0x65')][_0x11da('0xab')]['length']){for(var _0x3af4cb=0x0;_0x3af4cb<_0x5bc09b[_0x11da('0x65')][_0x11da('0xab')][_0x11da('0x5a')];_0x3af4cb+=0x1){_0x5bc09b['body'][_0x11da('0xab')][_0x3af4cb]={'filename':_0x5bc09b[_0x11da('0x65')]['attachments'][_0x3af4cb][_0x11da('0x3b')],'id':_0x5bc09b[_0x11da('0x65')]['attachments'][_0x3af4cb]['id'],'path':path[_0x11da('0xac')](config['root'],_0x11da('0xad'),_0x5bc09b['body'][_0x11da('0xab')][_0x3af4cb][_0x11da('0xae')])};}}return respondWithRpcPromise(_0x11da('0xaf'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x5bc09b[_0x11da('0x66')]['id'])?undefined:_0x5bc09b[_0x11da('0x66')]['id'],'path':_[_0x11da('0xb0')](_0x5bc09b[_0x11da('0x65')][_0x11da('0xab')][0x0][_0x11da('0xb1')])?undefined:_0x5bc09b[_0x11da('0x65')][_0x11da('0xab')][0x0][_0x11da('0xb1')],'fax':_[_0x11da('0xb0')](_0x5bc09b[_0x11da('0x65')]['to'][0x0])?undefined:_0x5bc09b['body']['to'][0x0]},client9002);})[_0x11da('0x21')](function(){if(_0x3aa3a8){if(_[_0x11da('0xb0')](_0x5bc09b[_0x11da('0x65')]['from'])){_0x5bc09b['body'][_0x11da('0xb2')]=util[_0x11da('0xa6')](_0x11da('0xb3'),_0x3aa3a8['name'],_0x3aa3a8['fax']);}if(_0x3aa3a8['List']){if(_0x3aa3a8[_0x11da('0xa9')]['Contacts'][_0x11da('0x5a')]){return _0x3aa3a8[_0x11da('0xa9')][_0x11da('0xaa')][0x0];}else{return db[_0x11da('0x77')]['create'](_[_0x11da('0x1a')](_0x5bc09b['body'],{'firstName':_0x5bc09b['body']['to'][0x0],'phone':_0x5bc09b['body']['to'][0x0],'fax':_0x5bc09b['body']['to'][0x0],'ListId':_0x3aa3a8[_0x11da('0xa1')]}));}}else{throw new Error(_0x11da('0xb4'));}}else{throw new Error(_0x11da('0xb5'));}})[_0x11da('0x21')](function(_0x495a09){if(_0x495a09){return db[_0x11da('0x74')]['find']({'where':{'ContactId':_0x495a09['id'],'closed':![],'FaxAccountId':_0x3aa3a8['id']}})[_0x11da('0x21')](function(_0x83cd0e){if(_0x83cd0e){return[_0x83cd0e,![]];}return db[_0x11da('0x74')]['create']({'UserId':_0x5bc09b[_0x11da('0xb6')]['id'],'ContactId':_0x495a09['id'],'FaxAccountId':_0x3aa3a8['id'],'fax':_0x5bc09b[_0x11da('0x65')]['to'][0x0],'firstMsgDirection':_0x11da('0xb7'),'Messages':[_['merge'](_0x5bc09b[_0x11da('0x65')],{'read':![],'body':_0x5bc09b[_0x11da('0x65')][_0x11da('0xab')][0x0][_0x11da('0xb8')],'FaxAccountId':_0x3aa3a8['id'],'UserId':_0x5bc09b[_0x11da('0xb6')]['id'],'ContactId':_0x495a09['id'],'AttachmentId':_0x5bc09b[_0x11da('0x65')][_0x11da('0xab')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x11da('0xb9')}]})[_0x11da('0x21')](function(_0x287582){return[_0x287582,!![]];});});}else{throw new Error(_0x11da('0xba'));}})[_0x11da('0xbb')](function(_0x237330,_0x193f16){if(_0x193f16){return _0x237330;}return db[_0x11da('0xa3')]['create']({'direction':_0x11da('0xb7'),'read':![],'body':_0x5bc09b[_0x11da('0x65')]['attachments'][0x0][_0x11da('0xb8')],'FaxAccountId':_0x3aa3a8['id'],'FaxInteractionId':_0x237330['id'],'UserId':_0x5bc09b[_0x11da('0xb6')]['id'],'ContactId':_0x237330['ContactId'],'AttachmentId':_0x5bc09b['body']['attachments'][0x0]['id']})[_0x11da('0x21')](function(_0x2908b3){_0x237330[_0x11da('0xbc')][_0x11da('0xb9')]=[];_0x237330['dataValues'][_0x11da('0xb9')][_0x11da('0x90')](_0x2908b3[_0x11da('0xbc')]);return _0x237330;});})['then'](function(_0x214bd5){respondWithRpcPromise(_0x11da('0xbd'),'SendFax',{'FaxAccountId':_[_0x11da('0xb0')](_0x5bc09b['params']['id'])?undefined:_0x5bc09b[_0x11da('0x66')]['id'],'path':_[_0x11da('0xb0')](_0x5bc09b[_0x11da('0x65')][_0x11da('0xab')][0x0]['path'])?undefined:_0x5bc09b[_0x11da('0x65')][_0x11da('0xab')][0x0][_0x11da('0xb1')],'fax':_['isNil'](_0x5bc09b[_0x11da('0x65')]['to'][0x0])?undefined:_0x5bc09b['body']['to'][0x0],'AttachmentId':_0x5bc09b['body']['attachments'][0x0]['id']},client9002)[_0x11da('0x21')](function(_0x5a606c){logger[_0x11da('0x22')](_0x11da('0xbe'),_0x5a606c);})['catch'](function(_0x101907){logger[_0x11da('0x22')](_0x11da('0xbe'),_0x101907);});return _0x214bd5;})[_0x11da('0x21')](respondWithResult(_0x4298bc,null))[_0x11da('0x2b')](handleError(_0x4298bc,null));};exports[_0x11da('0xbf')]=function(_0x376a51,_0x1d558d,_0x21a7d2){return db[_0x11da('0x54')][_0x11da('0x5c')]({'where':{'id':_0x376a51[_0x11da('0x66')]['id']}})[_0x11da('0x21')](handleEntityNotFound(_0x1d558d,null))[_0x11da('0x21')](function(_0x249214){if(_0x249214){return _0x249214[_0x11da('0xbf')](_0x376a51['body'][_0x11da('0x6f')],_['omit'](_0x376a51[_0x11da('0x65')],[_0x11da('0x6f'),'id'])||{})[_0x11da('0xbb')](function(_0x309684){for(var _0x335561=0x0;_0x335561<_0x376a51[_0x11da('0x65')][_0x11da('0x6f')]['length'];_0x335561+=0x1){socket[_0x11da('0xc0')](_0x11da('0xc1'),{'UserId':_0x376a51[_0x11da('0x65')][_0x11da('0x6f')][_0x335561],'FaxAccountId':_0x376a51[_0x11da('0x66')]['id']});}return _0x309684;});}})['then'](respondWithResult(_0x1d558d,null))[_0x11da('0x2b')](handleError(_0x1d558d,null));};exports[_0x11da('0xc2')]=function(_0x192ee6,_0x344ebe,_0x2c0d71){return db[_0x11da('0x54')][_0x11da('0x5c')]({'where':{'id':_0x192ee6[_0x11da('0x66')]['id']}})[_0x11da('0x21')](handleEntityNotFound(_0x344ebe,null))['then'](function(_0x40824c){if(_0x40824c){return _0x40824c[_0x11da('0xc2')](_0x192ee6[_0x11da('0x44')][_0x11da('0x6f')])[_0x11da('0x21')](function(){if(_[_0x11da('0xc3')](_0x192ee6[_0x11da('0x44')][_0x11da('0x6f')])){for(var _0x26f61e=0x0;_0x26f61e<_0x192ee6[_0x11da('0x44')][_0x11da('0x6f')]['length'];_0x26f61e+=0x1){socket['emit'](_0x11da('0xc4'),{'UserId':Number(_0x192ee6[_0x11da('0x44')][_0x11da('0x6f')][_0x26f61e]),'FaxAccountId':Number(_0x192ee6['params']['id'])});}}else{socket[_0x11da('0xc0')](_0x11da('0xc4'),{'UserId':Number(_0x192ee6[_0x11da('0x44')]['ids']),'FaxAccountId':Number(_0x192ee6[_0x11da('0x66')]['id'])});}});}})[_0x11da('0x21')](respondWithStatusCode(_0x344ebe,null))[_0x11da('0x2b')](handleError(_0x344ebe,null));};exports['getAgents']=function(_0x17717c,_0x43a226,_0x5162a5){var _0x5799af={};var _0x41dade={};var _0x1a8067;var _0x12243d;return db[_0x11da('0x54')][_0x11da('0x6b')]({'where':{'id':_0x17717c['params']['id']}})[_0x11da('0x21')](handleEntityNotFound(_0x43a226,null))['then'](function(_0x8d6a45){if(_0x8d6a45){_0x1a8067=_0x8d6a45;_0x41dade['model']=_[_0x11da('0x45')](db[_0x11da('0x79')][_0x11da('0x40')]);_0x41dade[_0x11da('0x44')]=_[_0x11da('0x45')](_0x17717c[_0x11da('0x44')]);_0x41dade[_0x11da('0x46')]=_[_0x11da('0x47')](_0x41dade[_0x11da('0x49')],_0x41dade['query']);_0x5799af['attributes']=_[_0x11da('0x47')](_0x41dade[_0x11da('0x49')],qs[_0x11da('0x4a')](_0x17717c[_0x11da('0x44')][_0x11da('0x4a')]));_0x5799af['attributes']=_0x5799af[_0x11da('0x48')]['length']?_0x5799af[_0x11da('0x48')]:_0x41dade[_0x11da('0x49')];_0x5799af[_0x11da('0x4c')]=qs[_0x11da('0x4d')](_0x17717c['query']['sort']);_0x5799af['where']=qs[_0x11da('0x46')](_['pick'](_0x17717c['query'],_0x41dade['filters']));if(_0x17717c['query'][_0x11da('0x4f')]){_0x5799af[_0x11da('0x50')]=_['merge'](_0x5799af[_0x11da('0x50')],{'$or':_[_0x11da('0x3f')](_0x5799af[_0x11da('0x48')],function(_0x4f614c){var _0x13df1d={};_0x13df1d[_0x4f614c]={'$like':'%'+_0x17717c['query'][_0x11da('0x4f')]+'%'};return _0x13df1d;})});}_0x5799af=_['merge']({},_0x5799af,_0x17717c[_0x11da('0x53')]);return _0x1a8067[_0x11da('0xc5')](_0x5799af);}})['then'](function(_0x4492b8){if(_0x4492b8){_0x12243d=_0x4492b8[_0x11da('0x5a')];if(!_0x17717c[_0x11da('0x44')][_0x11da('0x6c')](_0x11da('0x4b'))){_0x5799af['limit']=qs[_0x11da('0x31')](_0x17717c[_0x11da('0x44')]['limit']);_0x5799af[_0x11da('0x30')]=qs[_0x11da('0x30')](_0x17717c['query'][_0x11da('0x30')]);}return _0x1a8067['getAgents'](_0x5799af);}})[_0x11da('0x21')](function(_0x538ccd){if(_0x538ccd){return _0x538ccd?{'count':_0x12243d,'rows':_0x538ccd}:null;}})[_0x11da('0x21')](respondWithResult(_0x43a226,null))[_0x11da('0x2b')](handleError(_0x43a226,null));}; \ No newline at end of file +var _0x1bb2=['update','FaxAccounts','UserProfileResource','destroy','name','send','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','limit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','user','get','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','FaxAccountId','Disposition','getDispositions','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','nolimit','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','appdata','push','CDR(type)=inbound-fax','Set','ecm','faxdetect','headerinfo','minrate','modem','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','getMessages','FaxMessage','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','Contacts','DESC','attachments','root','server/files/attachments','CheckAfterSend','isNil','from','fax','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','userFaxAccount:save','removeAgents','emit','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./faxAccount.socket','register','jayson/promise','http','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','Content-Range','reject'];(function(_0xe629c4,_0x55c318){var _0x510bbf=function(_0x535074){while(--_0x535074){_0xe629c4['push'](_0xe629c4['shift']());}};_0x510bbf(++_0x55c318);}(_0x1bb2,0x152));var _0x21bb=function(_0x1b07ba,_0x5a71ef){_0x1b07ba=_0x1b07ba-0x0;var _0x51b969=_0x1bb2[_0x1b07ba];return _0x51b969;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x21bb('0x0'));var rimraf=require(_0x21bb('0x1'));var zipdir=require(_0x21bb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x21bb('0x3'));var BPromise=require(_0x21bb('0x4'));var Mustache=require(_0x21bb('0x5'));var util=require(_0x21bb('0x6'));var path=require(_0x21bb('0x7'));var sox=require(_0x21bb('0x8'));var csv=require(_0x21bb('0x9'));var ejs=require(_0x21bb('0xa'));var fs=require('fs');var fs_extra=require(_0x21bb('0xb'));var _=require(_0x21bb('0xc'));var squel=require(_0x21bb('0xd'));var crypto=require(_0x21bb('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x21bb('0xf'));var toCsv=require('to-csv');var querystring=require(_0x21bb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x21bb('0x11'));var qs=require(_0x21bb('0x12'));var as=require(_0x21bb('0x13'));var hardwareService=require(_0x21bb('0x14'));var logger=require(_0x21bb('0x15'))(_0x21bb('0x16'));var utils=require(_0x21bb('0x17'));var config=require(_0x21bb('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x21bb('0x19'))['db'];config[_0x21bb('0x1a')]=_['defaults'](config[_0x21bb('0x1a')],{'host':_0x21bb('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x21bb('0x1a')]));require(_0x21bb('0x1c'))[_0x21bb('0x1d')](socket);var jayson=require(_0x21bb('0x1e'));var client=jayson['client'][_0x21bb('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x18daa7,_0x1ef9a5,_0x2a8656,_0x465f5e){return new BPromise(function(_0x29991a,_0x412d50){var _0x3497cf=_0x465f5e||client;return _0x3497cf[_0x21bb('0x20')](_0x18daa7,_0x2a8656)[_0x21bb('0x21')](function(_0x17ee1d){logger[_0x21bb('0x22')]('FaxAccount,\x20%s,\x20%s',_0x1ef9a5,_0x21bb('0x23'));logger[_0x21bb('0x24')](_0x21bb('0x25'),_0x1ef9a5,'request\x20sent',JSON[_0x21bb('0x26')](_0x17ee1d));if(_0x17ee1d[_0x21bb('0x27')]){if(_0x17ee1d[_0x21bb('0x27')][_0x21bb('0x28')]===0x1f4){logger[_0x21bb('0x27')](_0x21bb('0x29'),_0x1ef9a5,_0x17ee1d[_0x21bb('0x27')][_0x21bb('0x2a')]);return _0x412d50(_0x17ee1d[_0x21bb('0x27')][_0x21bb('0x2a')]);}logger[_0x21bb('0x27')](_0x21bb('0x29'),_0x1ef9a5,_0x17ee1d['error'][_0x21bb('0x2a')]);return _0x29991a(_0x17ee1d[_0x21bb('0x27')][_0x21bb('0x2a')]);}else{logger['info'](_0x21bb('0x29'),_0x1ef9a5,_0x21bb('0x23'));_0x29991a(_0x17ee1d[_0x21bb('0x2b')][_0x21bb('0x2a')]);}})[_0x21bb('0x2c')](function(_0x3239e2){logger[_0x21bb('0x27')](_0x21bb('0x29'),_0x1ef9a5,_0x3239e2);_0x412d50(_0x3239e2);});});}function respondWithStatusCode(_0x4db3ad,_0x22a467){_0x22a467=_0x22a467||0xcc;return function(_0xed3ab2){if(_0xed3ab2){return _0x4db3ad[_0x21bb('0x2d')](_0x22a467);}return _0x4db3ad[_0x21bb('0x2e')](_0x22a467)['end']();};}function respondWithResult(_0x44d720,_0x26c46a){_0x26c46a=_0x26c46a||0xc8;return function(_0x22a91f){if(_0x22a91f){return _0x44d720[_0x21bb('0x2e')](_0x26c46a)[_0x21bb('0x2f')](_0x22a91f);}};}function respondWithFilteredResult(_0x2c09d6,_0x20de34){return function(_0x256974){if(_0x256974){var _0x5c5cae=_0x256974[_0x21bb('0x30')],_0x301aac=_0x20de34[_0x21bb('0x31')],_0xfd3327=_0x20de34[_0x21bb('0x31')]+_0x20de34['limit'],_0x4fc34d;if(_0xfd3327>=_0x5c5cae){_0xfd3327=_0x5c5cae;_0x4fc34d=0xc8;}else{_0x4fc34d=0xce;}_0x2c09d6[_0x21bb('0x2e')](_0x4fc34d);return _0x2c09d6['set'](_0x21bb('0x32'),_0x301aac+'-'+_0xfd3327+'/'+_0x5c5cae)[_0x21bb('0x2f')](_0x256974);}return null;};}function patchUpdates(_0xa113b0){return function(_0x3c58d5){try{jsonpatch['apply'](_0x3c58d5,_0xa113b0,!![]);}catch(_0x32b374){return BPromise[_0x21bb('0x33')](_0x32b374);}return _0x3c58d5['save']();};}function saveUpdates(_0x34f27a,_0x14d6fe){return function(_0x78133b){if(_0x78133b){return _0x78133b[_0x21bb('0x34')](_0x34f27a)[_0x21bb('0x21')](function(_0x2e8d63){return _0x2e8d63;});}return null;};}function removeEntity(_0x57e6a4,_0x4166a5){return function(_0x2bf5bc){if(_0x2bf5bc){return _0x2bf5bc['destroy']()[_0x21bb('0x21')](function(){var _0x68cbd5=_0x2bf5bc['get']({'plain':!![]});var _0xe74f9a=_0x21bb('0x35');return db[_0x21bb('0x36')][_0x21bb('0x37')]({'where':{'type':_0xe74f9a,'resourceId':_0x68cbd5['id']}})['then'](function(){return _0x2bf5bc;});})['then'](function(){_0x57e6a4[_0x21bb('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41a772,_0x59aedf){return function(_0x2a50d7){if(!_0x2a50d7){_0x41a772[_0x21bb('0x2d')](0x194);}return _0x2a50d7;};}function handleError(_0x420495,_0x7a0ab8){_0x7a0ab8=_0x7a0ab8||0x1f4;return function(_0x3049ea){logger['error'](_0x3049ea['stack']);if(_0x3049ea[_0x21bb('0x38')]){delete _0x3049ea[_0x21bb('0x38')];}_0x420495[_0x21bb('0x2e')](_0x7a0ab8)[_0x21bb('0x39')](_0x3049ea);};}exports[_0x21bb('0x3a')]=function(_0x5a6bc7,_0x59a47a){var _0x46e228={'include':[{'model':db['Pause'],'as':_0x21bb('0x3b')}]},_0x6a9981={},_0x16022e={'count':0x0,'rows':[]};var _0x540ac8=_[_0x21bb('0x3c')](db[_0x21bb('0x3d')][_0x21bb('0x3e')],function(_0x55fa1f){return{'name':_0x55fa1f['fieldName'],'type':_0x55fa1f[_0x21bb('0x3f')][_0x21bb('0x40')]};});_0x6a9981[_0x21bb('0x41')]=_[_0x21bb('0x3c')](_0x540ac8,'name');_0x6a9981[_0x21bb('0x42')]=_[_0x21bb('0x43')](_0x5a6bc7['query']);_0x6a9981['filters']=_['intersection'](_0x6a9981[_0x21bb('0x41')],_0x6a9981[_0x21bb('0x42')]);_0x46e228[_0x21bb('0x44')]=_[_0x21bb('0x45')](_0x6a9981[_0x21bb('0x41')],qs[_0x21bb('0x46')](_0x5a6bc7[_0x21bb('0x42')][_0x21bb('0x46')]));_0x46e228[_0x21bb('0x44')]=_0x46e228['attributes'][_0x21bb('0x47')]?_0x46e228[_0x21bb('0x44')]:_0x6a9981[_0x21bb('0x41')];if(!_0x5a6bc7['query']['hasOwnProperty']('nolimit')){_0x46e228[_0x21bb('0x48')]=qs['limit'](_0x5a6bc7[_0x21bb('0x42')][_0x21bb('0x48')]);_0x46e228[_0x21bb('0x31')]=qs['offset'](_0x5a6bc7[_0x21bb('0x42')]['offset']);}_0x46e228[_0x21bb('0x49')]=qs[_0x21bb('0x4a')](_0x5a6bc7['query'][_0x21bb('0x4a')]);_0x46e228[_0x21bb('0x4b')]=qs[_0x21bb('0x4c')](_[_0x21bb('0x4d')](_0x5a6bc7[_0x21bb('0x42')],_0x6a9981[_0x21bb('0x4c')]),_0x540ac8);if(_0x5a6bc7[_0x21bb('0x42')]['filter']){_0x46e228[_0x21bb('0x4b')]=_['merge'](_0x46e228['where'],{'$or':_['map'](_0x540ac8,function(_0x2bec5d){if(_0x2bec5d[_0x21bb('0x3f')]!==_0x21bb('0x4e')){var _0x10dbf7={};_0x10dbf7[_0x2bec5d[_0x21bb('0x38')]]={'$like':'%'+_0x5a6bc7[_0x21bb('0x42')][_0x21bb('0x4f')]+'%'};return _0x10dbf7;}})});}_0x46e228=_[_0x21bb('0x50')]({},_0x46e228,_0x5a6bc7[_0x21bb('0x51')]);var _0x42e1e4={'where':_0x46e228[_0x21bb('0x4b')]};return db['FaxAccount'][_0x21bb('0x30')](_0x42e1e4)[_0x21bb('0x21')](function(_0x280106){_0x16022e[_0x21bb('0x30')]=_0x280106;if(_0x5a6bc7[_0x21bb('0x42')][_0x21bb('0x52')]){_0x46e228[_0x21bb('0x53')]=[{'all':!![]}];}return db['FaxAccount'][_0x21bb('0x54')](_0x46e228);})[_0x21bb('0x21')](function(_0x2c7e54){_0x16022e[_0x21bb('0x55')]=_0x2c7e54;return _0x16022e;})[_0x21bb('0x21')](respondWithFilteredResult(_0x59a47a,_0x46e228))['catch'](handleError(_0x59a47a,null));};exports[_0x21bb('0x56')]=function(_0x3fad82,_0x2f40ba){var _0x348c42={'raw':![],'where':{'id':_0x3fad82[_0x21bb('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x21bb('0x3b')}]},_0x503edc={};_0x503edc[_0x21bb('0x41')]=_[_0x21bb('0x43')](db[_0x21bb('0x3d')][_0x21bb('0x3e')]);_0x503edc['query']=_['keys'](_0x3fad82[_0x21bb('0x42')]);_0x503edc[_0x21bb('0x4c')]=_[_0x21bb('0x45')](_0x503edc[_0x21bb('0x41')],_0x503edc[_0x21bb('0x42')]);_0x348c42[_0x21bb('0x44')]=_[_0x21bb('0x45')](_0x503edc[_0x21bb('0x41')],qs[_0x21bb('0x46')](_0x3fad82[_0x21bb('0x42')][_0x21bb('0x46')]));_0x348c42['attributes']=_0x348c42[_0x21bb('0x44')][_0x21bb('0x47')]?_0x348c42[_0x21bb('0x44')]:_0x503edc[_0x21bb('0x41')];if(_0x3fad82[_0x21bb('0x42')][_0x21bb('0x52')]){_0x348c42['include']=[{'all':!![]}];}_0x348c42=_[_0x21bb('0x50')]({},_0x348c42,_0x3fad82[_0x21bb('0x51')]);return db['FaxAccount'][_0x21bb('0x58')](_0x348c42)['then'](handleEntityNotFound(_0x2f40ba,null))[_0x21bb('0x21')](respondWithResult(_0x2f40ba,null))[_0x21bb('0x2c')](handleError(_0x2f40ba,null));};exports[_0x21bb('0x59')]=function(_0x56f59c,_0x707925){return db[_0x21bb('0x3d')][_0x21bb('0x59')](_0x56f59c[_0x21bb('0x5a')],{})[_0x21bb('0x21')](function(_0x3d0e21){var _0x238a8e=_0x56f59c[_0x21bb('0x5b')][_0x21bb('0x5c')]({'plain':!![]});if(!_0x238a8e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x238a8e[_0x21bb('0x5d')]===_0x21bb('0x5b')){var _0x217030=_0x3d0e21[_0x21bb('0x5c')]({'plain':!![]});var _0x29555c=_0x21bb('0x35');return db['UserProfileSection']['find']({'where':{'name':_0x29555c,'userProfileId':_0x238a8e[_0x21bb('0x5e')]},'raw':!![]})[_0x21bb('0x21')](function(_0x1d83d5){if(_0x1d83d5&&_0x1d83d5[_0x21bb('0x5f')]===0x0){return db['UserProfileResource']['create']({'name':_0x217030[_0x21bb('0x38')],'resourceId':_0x217030['id'],'type':_0x1d83d5['name'],'sectionId':_0x1d83d5['id']},{})['then'](function(){return _0x3d0e21;});}else{return _0x3d0e21;}})[_0x21bb('0x2c')](function(_0x27f7ae){logger[_0x21bb('0x27')](_0x21bb('0x60'),_0x27f7ae);throw _0x27f7ae;});}return _0x3d0e21;})[_0x21bb('0x21')](respondWithResult(_0x707925,0xc9))[_0x21bb('0x2c')](handleError(_0x707925,null));};exports[_0x21bb('0x34')]=function(_0x521623,_0x1ee986){if(_0x521623[_0x21bb('0x5a')]['id']){delete _0x521623[_0x21bb('0x5a')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x521623[_0x21bb('0x57')]['id']},'include':[{'model':db[_0x21bb('0x61')],'as':_0x21bb('0x3b')}]})[_0x21bb('0x21')](handleEntityNotFound(_0x1ee986,null))['then'](saveUpdates(_0x521623[_0x21bb('0x5a')],null))['then'](respondWithResult(_0x1ee986,null))['catch'](handleError(_0x1ee986,null));};exports[_0x21bb('0x37')]=function(_0xe791eb,_0x4ee4b1){return db[_0x21bb('0x3d')]['find']({'where':{'id':_0xe791eb[_0x21bb('0x57')]['id']}})['then'](handleEntityNotFound(_0x4ee4b1,null))[_0x21bb('0x21')](removeEntity(_0x4ee4b1,null))[_0x21bb('0x2c')](handleError(_0x4ee4b1,null));};exports[_0x21bb('0x62')]=function(_0x1cf029,_0x1de11d){return db[_0x21bb('0x3d')][_0x21bb('0x62')]()[_0x21bb('0x21')](respondWithResult(_0x1de11d,null))['catch'](handleError(_0x1de11d,null));};exports[_0x21bb('0x63')]=function(_0x20a495,_0x2819e4,_0x4fd2ae){if(_0x20a495[_0x21bb('0x5a')]['id']){delete _0x20a495['body']['id'];}return db[_0x21bb('0x3d')][_0x21bb('0x58')]({'where':{'id':_0x20a495[_0x21bb('0x57')]['id']}})['then'](handleEntityNotFound(_0x2819e4,null))[_0x21bb('0x21')](function(_0x2b4724){if(_0x2b4724){_0x20a495[_0x21bb('0x5a')][_0x21bb('0x64')]=_0x2b4724['id'];return db[_0x21bb('0x65')]['create'](_0x20a495['body']);}})[_0x21bb('0x21')](respondWithResult(_0x2819e4,null))[_0x21bb('0x2c')](handleError(_0x2819e4,null));};exports[_0x21bb('0x66')]=function(_0x3b27bb,_0x3c3eb5,_0x5d495b){var _0x3a60b9={'raw':![],'where':{}};var _0x1a7a33={};var _0x12babf={'count':0x0,'rows':[]};return db[_0x21bb('0x3d')]['findOne']({'where':{'id':_0x3b27bb[_0x21bb('0x57')]['id']}})[_0x21bb('0x21')](handleEntityNotFound(_0x3c3eb5,null))[_0x21bb('0x21')](function(_0x1f070d){if(_0x1f070d){_0x1a7a33['model']=_['keys'](db[_0x21bb('0x65')][_0x21bb('0x3e')]);_0x1a7a33[_0x21bb('0x42')]=_['keys'](_0x3b27bb[_0x21bb('0x42')]);_0x1a7a33[_0x21bb('0x4c')]=_[_0x21bb('0x45')](_0x1a7a33[_0x21bb('0x41')],_0x1a7a33[_0x21bb('0x42')]);_0x3a60b9['attributes']=_[_0x21bb('0x45')](_0x1a7a33['model'],qs['fields'](_0x3b27bb[_0x21bb('0x42')][_0x21bb('0x46')]));_0x3a60b9[_0x21bb('0x44')]=_0x3a60b9[_0x21bb('0x44')]['length']?_0x3a60b9[_0x21bb('0x44')]:_0x1a7a33['model'];if(!_0x3b27bb[_0x21bb('0x42')][_0x21bb('0x67')]('nolimit')){_0x3a60b9[_0x21bb('0x48')]=qs[_0x21bb('0x48')](_0x3b27bb['query'][_0x21bb('0x48')]);_0x3a60b9['offset']=qs[_0x21bb('0x31')](_0x3b27bb[_0x21bb('0x42')][_0x21bb('0x31')]);}_0x3a60b9[_0x21bb('0x49')]=qs[_0x21bb('0x4a')](_0x3b27bb[_0x21bb('0x42')]['sort']);_0x3a60b9[_0x21bb('0x4b')]=qs['filters'](_['pick'](_0x3b27bb[_0x21bb('0x42')],_0x1a7a33['filters']));_0x3a60b9[_0x21bb('0x4b')][_0x21bb('0x64')]=_0x1f070d['id'];if(_0x3b27bb[_0x21bb('0x42')][_0x21bb('0x4f')]){_0x3a60b9[_0x21bb('0x4b')]=_[_0x21bb('0x50')](_0x3a60b9[_0x21bb('0x4b')],{'$or':_[_0x21bb('0x3c')](_0x3a60b9[_0x21bb('0x44')],function(_0x35c614){var _0x45a0fe={};_0x45a0fe[_0x35c614]={'$like':'%'+_0x3b27bb[_0x21bb('0x42')][_0x21bb('0x4f')]+'%'};return _0x45a0fe;})});}_0x3a60b9=_[_0x21bb('0x50')]({},_0x3a60b9,_0x3b27bb['options']);return db[_0x21bb('0x65')][_0x21bb('0x30')]({'where':_0x3a60b9['where']})[_0x21bb('0x21')](function(_0x239669){_0x12babf[_0x21bb('0x30')]=_0x239669;if(_0x3b27bb[_0x21bb('0x42')][_0x21bb('0x52')]){_0x3a60b9[_0x21bb('0x53')]=[{'all':!![]}];}return db[_0x21bb('0x65')]['findAll'](_0x3a60b9);})[_0x21bb('0x21')](function(_0x45eb11){_0x12babf[_0x21bb('0x55')]=_0x45eb11;return _0x12babf;});}})[_0x21bb('0x21')](respondWithFilteredResult(_0x3c3eb5,_0x3a60b9))[_0x21bb('0x2c')](handleError(_0x3c3eb5,null));};exports['removeDispositions']=function(_0x4aaae6,_0x5f3de3,_0x460987){return db[_0x21bb('0x3d')]['find']({'where':{'id':_0x4aaae6[_0x21bb('0x57')]['id']}})['then'](handleEntityNotFound(_0x5f3de3,null))[_0x21bb('0x21')](function(_0x480864){if(_0x480864){return _0x480864[_0x21bb('0x68')](_0x4aaae6[_0x21bb('0x42')][_0x21bb('0x69')]);}})[_0x21bb('0x21')](respondWithStatusCode(_0x5f3de3,null))[_0x21bb('0x2c')](handleError(_0x5f3de3,null));};exports[_0x21bb('0x6a')]=function(_0x513590,_0x15e85f,_0x2adde5){if(_0x513590[_0x21bb('0x5a')]['id']){delete _0x513590[_0x21bb('0x5a')]['id'];}return db[_0x21bb('0x3d')][_0x21bb('0x58')]({'where':{'id':_0x513590[_0x21bb('0x57')]['id']}})['then'](handleEntityNotFound(_0x15e85f,null))[_0x21bb('0x21')](function(_0x496966){if(_0x496966){_0x513590['body']['FaxAccountId']=_0x496966['id'];return db[_0x21bb('0x6b')][_0x21bb('0x59')](_0x513590['body']);}})[_0x21bb('0x21')](respondWithResult(_0x15e85f,null))[_0x21bb('0x2c')](handleError(_0x15e85f,null));};exports[_0x21bb('0x6c')]=function(_0x1a41ce,_0x16fb0f,_0x3cb5fd){var _0x26fa9a={'raw':![],'where':{}};var _0x3b83c0={};var _0x43e204={'count':0x0,'rows':[]};return db['FaxAccount'][_0x21bb('0x6d')]({'where':{'id':_0x1a41ce[_0x21bb('0x57')]['id']}})[_0x21bb('0x21')](handleEntityNotFound(_0x16fb0f,null))[_0x21bb('0x21')](function(_0x38f305){if(_0x38f305){_0x3b83c0[_0x21bb('0x41')]=_['keys'](db[_0x21bb('0x6b')]['rawAttributes']);_0x3b83c0[_0x21bb('0x42')]=_[_0x21bb('0x43')](_0x1a41ce['query']);_0x3b83c0[_0x21bb('0x4c')]=_[_0x21bb('0x45')](_0x3b83c0[_0x21bb('0x41')],_0x3b83c0[_0x21bb('0x42')]);_0x26fa9a['attributes']=_[_0x21bb('0x45')](_0x3b83c0['model'],qs['fields'](_0x1a41ce[_0x21bb('0x42')]['fields']));_0x26fa9a[_0x21bb('0x44')]=_0x26fa9a[_0x21bb('0x44')]['length']?_0x26fa9a[_0x21bb('0x44')]:_0x3b83c0[_0x21bb('0x41')];if(!_0x1a41ce[_0x21bb('0x42')][_0x21bb('0x67')](_0x21bb('0x6e'))){_0x26fa9a[_0x21bb('0x48')]=qs[_0x21bb('0x48')](_0x1a41ce[_0x21bb('0x42')][_0x21bb('0x48')]);_0x26fa9a[_0x21bb('0x31')]=qs[_0x21bb('0x31')](_0x1a41ce[_0x21bb('0x42')][_0x21bb('0x31')]);}_0x26fa9a[_0x21bb('0x49')]=qs['sort'](_0x1a41ce[_0x21bb('0x42')][_0x21bb('0x4a')]);_0x26fa9a[_0x21bb('0x4b')]=qs['filters'](_[_0x21bb('0x4d')](_0x1a41ce[_0x21bb('0x42')],_0x3b83c0['filters']));_0x26fa9a[_0x21bb('0x4b')][_0x21bb('0x64')]=_0x38f305['id'];if(_0x1a41ce[_0x21bb('0x42')][_0x21bb('0x4f')]){_0x26fa9a[_0x21bb('0x4b')]=_[_0x21bb('0x50')](_0x26fa9a['where'],{'$or':_[_0x21bb('0x3c')](_0x26fa9a[_0x21bb('0x44')],function(_0xc4f3f0){var _0x2822c9={};_0x2822c9[_0xc4f3f0]={'$like':'%'+_0x1a41ce[_0x21bb('0x42')][_0x21bb('0x4f')]+'%'};return _0x2822c9;})});}_0x26fa9a=_['merge']({},_0x26fa9a,_0x1a41ce[_0x21bb('0x51')]);return db[_0x21bb('0x6b')][_0x21bb('0x30')]({'where':_0x26fa9a[_0x21bb('0x4b')]})[_0x21bb('0x21')](function(_0x5aa874){_0x43e204[_0x21bb('0x30')]=_0x5aa874;if(_0x1a41ce[_0x21bb('0x42')][_0x21bb('0x52')]){_0x26fa9a[_0x21bb('0x53')]=[{'all':!![]}];}return db['CannedAnswer'][_0x21bb('0x54')](_0x26fa9a);})[_0x21bb('0x21')](function(_0x4d5da0){_0x43e204[_0x21bb('0x55')]=_0x4d5da0;return _0x43e204;});}})[_0x21bb('0x21')](respondWithFilteredResult(_0x16fb0f,_0x26fa9a))[_0x21bb('0x2c')](handleError(_0x16fb0f,null));};exports[_0x21bb('0x6f')]=function(_0x1ec6f3,_0xdce08c,_0x15e306){return db[_0x21bb('0x3d')][_0x21bb('0x58')]({'where':{'id':_0x1ec6f3[_0x21bb('0x57')]['id']}})['then'](handleEntityNotFound(_0xdce08c,null))[_0x21bb('0x21')](function(_0x4e2d4f){if(_0x4e2d4f){return _0x4e2d4f['removeAnswers'](_0x1ec6f3[_0x21bb('0x42')][_0x21bb('0x69')]);}})['then'](respondWithStatusCode(_0xdce08c,null))[_0x21bb('0x2c')](handleError(_0xdce08c,null));};exports[_0x21bb('0x70')]=function(_0x173191,_0x47edb9,_0x34d240){return db[_0x21bb('0x71')][_0x21bb('0x58')]({'where':{'id':_0x173191['params']['id']}})[_0x21bb('0x21')](handleEntityNotFound(_0x47edb9,null))[_0x21bb('0x21')](function(_0x30493f){if(_0x30493f){return _0x30493f[_0x21bb('0x70')](_0x173191[_0x21bb('0x5a')][_0x21bb('0x69')],_[_0x21bb('0x72')](_0x173191[_0x21bb('0x5a')],[_0x21bb('0x69'),'id'])||{});}})[_0x21bb('0x21')](respondWithResult(_0x47edb9,null))[_0x21bb('0x2c')](handleError(_0x47edb9,null));};exports[_0x21bb('0x73')]=function(_0x6da778,_0x3d416f,_0x287a8f){var _0xb518a8={'raw':![],'where':{}};var _0x2dc7c6={};var _0x1890bc={'count':0x0,'rows':[]};return db[_0x21bb('0x3d')][_0x21bb('0x6d')]({'where':{'id':_0x6da778['params']['id']}})[_0x21bb('0x21')](handleEntityNotFound(_0x3d416f,null))[_0x21bb('0x21')](function(_0x4ac496){if(_0x4ac496){_0x2dc7c6[_0x21bb('0x41')]=_['keys'](db[_0x21bb('0x71')][_0x21bb('0x3e')]);_0x2dc7c6[_0x21bb('0x42')]=_[_0x21bb('0x43')](_0x6da778[_0x21bb('0x42')]);_0x2dc7c6['filters']=_['intersection'](_0x2dc7c6[_0x21bb('0x41')],_0x2dc7c6[_0x21bb('0x42')]);_0xb518a8[_0x21bb('0x44')]=_[_0x21bb('0x45')](_0x2dc7c6[_0x21bb('0x41')],qs['fields'](_0x6da778[_0x21bb('0x42')][_0x21bb('0x46')]));_0xb518a8[_0x21bb('0x44')]=_0xb518a8[_0x21bb('0x44')][_0x21bb('0x47')]?_0xb518a8[_0x21bb('0x44')]:_0x2dc7c6[_0x21bb('0x41')];if(!_0x6da778[_0x21bb('0x42')][_0x21bb('0x67')](_0x21bb('0x6e'))){_0xb518a8[_0x21bb('0x48')]=qs['limit'](_0x6da778[_0x21bb('0x42')][_0x21bb('0x48')]);_0xb518a8[_0x21bb('0x31')]=qs[_0x21bb('0x31')](_0x6da778[_0x21bb('0x42')]['offset']);}_0xb518a8[_0x21bb('0x49')]=qs[_0x21bb('0x4a')](_0x6da778[_0x21bb('0x42')]['sort']);_0xb518a8[_0x21bb('0x4b')]=qs[_0x21bb('0x4c')](_[_0x21bb('0x4d')](_0x6da778[_0x21bb('0x42')],_0x2dc7c6[_0x21bb('0x4c')]));_0xb518a8['where'][_0x21bb('0x64')]=_0x4ac496['id'];if(_0x6da778['query'][_0x21bb('0x4f')]){_0xb518a8[_0x21bb('0x4b')]=_['merge'](_0xb518a8[_0x21bb('0x4b')],{'$or':_['map'](_0xb518a8[_0x21bb('0x44')],function(_0xe71316){var _0x207264={};_0x207264[_0xe71316]={'$like':'%'+_0x6da778[_0x21bb('0x42')][_0x21bb('0x4f')]+'%'};return _0x207264;})});}_0xb518a8=_[_0x21bb('0x50')]({},_0xb518a8,_0x6da778[_0x21bb('0x51')]);return db[_0x21bb('0x71')]['count']({'where':_0xb518a8[_0x21bb('0x4b')]})[_0x21bb('0x21')](function(_0x58163b){_0x1890bc['count']=_0x58163b;if(_0x6da778[_0x21bb('0x42')][_0x21bb('0x52')]){_0xb518a8[_0x21bb('0x53')]=[{'model':db['CmContact'],'as':_0x21bb('0x74'),'required':![]},{'model':db[_0x21bb('0x75')],'as':_0x21bb('0x76'),'attributes':[_0x21bb('0x38'),_0x21bb('0x77'),_0x21bb('0x78')],'required':![]},{'model':db[_0x21bb('0x79')],'as':_0x21bb('0x7a'),'attributes':['id',_0x21bb('0x38'),_0x21bb('0x7b')],'where':_0x6da778[_0x21bb('0x42')][_0x21bb('0x7c')]?{'id':_0x6da778[_0x21bb('0x42')]['tag']}:undefined,'required':_0x6da778['query'][_0x21bb('0x7c')]?!![]:![]}];}return db[_0x21bb('0x71')][_0x21bb('0x54')](_0xb518a8);})[_0x21bb('0x21')](function(_0x41529a){_0x1890bc[_0x21bb('0x55')]=_0x41529a;return _0x1890bc;});}})[_0x21bb('0x21')](respondWithFilteredResult(_0x3d416f,_0xb518a8))[_0x21bb('0x2c')](handleError(_0x3d416f,null));};exports[_0x21bb('0x7d')]=function(_0x40fb8,_0x3b95ac,_0x8d73fe){return db[_0x21bb('0x3d')][_0x21bb('0x6d')]({'where':{'id':_0x40fb8[_0x21bb('0x57')]['id']}})['then'](handleEntityNotFound(_0x3b95ac,null))[_0x21bb('0x21')](function(_0x2765f1){if(_0x2765f1){return db[_0x21bb('0x7e')][_0x21bb('0x7f')](function(_0x477106){return db[_0x21bb('0x80')]['destroy']({'where':{'FaxAccountId':_0x40fb8[_0x21bb('0x57')]['id']},'transaction':_0x477106})['then'](function(_0x594c8f){var _0x492781=_['map'](_0x40fb8[_0x21bb('0x5a')],function(_0xfde673){_0xfde673[_0x21bb('0x64')]=_0x40fb8[_0x21bb('0x57')]['id'];return _0xfde673;});return db[_0x21bb('0x80')][_0x21bb('0x81')](_0x492781,{'transaction':_0x477106});});})[_0x21bb('0x21')](function(){return db[_0x21bb('0x80')][_0x21bb('0x82')]({'where':{'FaxAccountId':_0x40fb8[_0x21bb('0x57')]['id']},'order':_0x21bb('0x83')});});}})[_0x21bb('0x21')](respondWithResult(_0x3b95ac,null))[_0x21bb('0x2c')](handleError(_0x3b95ac,null));};exports[_0x21bb('0x84')]=function(_0x24fa6c,_0x1b26c2,_0x137170){var _0x2c6df6={};var _0x3c132d={};var _0x538c43;var _0x1ca3c6;return db['FaxAccount'][_0x21bb('0x6d')]({'where':{'id':_0x24fa6c[_0x21bb('0x57')]['id']}})[_0x21bb('0x21')](handleEntityNotFound(_0x1b26c2,null))[_0x21bb('0x21')](function(_0x257738){if(_0x257738){_0x538c43=_0x257738;_0x3c132d['model']=_[_0x21bb('0x43')](db[_0x21bb('0x80')][_0x21bb('0x3e')]);_0x3c132d[_0x21bb('0x42')]=_['keys'](_0x24fa6c[_0x21bb('0x42')]);_0x3c132d['filters']=_[_0x21bb('0x45')](_0x3c132d[_0x21bb('0x41')],_0x3c132d[_0x21bb('0x42')]);_0x2c6df6[_0x21bb('0x44')]=_[_0x21bb('0x45')](_0x3c132d[_0x21bb('0x41')],qs[_0x21bb('0x46')](_0x24fa6c[_0x21bb('0x42')][_0x21bb('0x46')]));_0x2c6df6[_0x21bb('0x44')]=_0x2c6df6[_0x21bb('0x44')][_0x21bb('0x47')]?_0x2c6df6['attributes']:_0x3c132d[_0x21bb('0x41')];_0x2c6df6[_0x21bb('0x49')]=qs[_0x21bb('0x4a')](_0x24fa6c[_0x21bb('0x42')]['sort']);_0x2c6df6[_0x21bb('0x4b')]=qs[_0x21bb('0x4c')](_[_0x21bb('0x4d')](_0x24fa6c[_0x21bb('0x42')],_0x3c132d[_0x21bb('0x4c')]));if(_0x24fa6c[_0x21bb('0x42')]['filter']){_0x2c6df6[_0x21bb('0x4b')]=_[_0x21bb('0x50')](_0x2c6df6['where'],{'$or':_[_0x21bb('0x3c')](_0x2c6df6[_0x21bb('0x44')],function(_0x2b9a4b){var _0x21421d={};_0x21421d[_0x2b9a4b]={'$like':'%'+_0x24fa6c[_0x21bb('0x42')]['filter']+'%'};return _0x21421d;})});}_0x2c6df6=_[_0x21bb('0x50')]({},_0x2c6df6,_0x24fa6c[_0x21bb('0x51')]);return _0x538c43[_0x21bb('0x84')](_0x2c6df6);}})['then'](function(_0x3b374f){if(_0x3b374f){_0x1ca3c6=_0x3b374f['length'];if(!_0x24fa6c['query']['hasOwnProperty'](_0x21bb('0x6e'))){_0x2c6df6[_0x21bb('0x48')]=qs['limit'](_0x24fa6c['query'][_0x21bb('0x48')]);_0x2c6df6['offset']=qs[_0x21bb('0x31')](_0x24fa6c[_0x21bb('0x42')][_0x21bb('0x31')]);}return _0x538c43['getApplications'](_0x2c6df6);}})[_0x21bb('0x21')](function(_0x479b0b){if(_0x479b0b){return _0x479b0b?{'count':_0x1ca3c6,'rows':_0x479b0b}:null;}})['then'](respondWithResult(_0x1b26c2,null))[_0x21bb('0x2c')](handleError(_0x1b26c2,null));};function Extension(_0x36c666,_0x3ad209,_0x534219,_0x496b02){this[_0x21bb('0x85')]=_0x21bb('0x86');this[_0x21bb('0x87')]=_0x36c666[_0x21bb('0x88')];this[_0x21bb('0x89')]=_0x496b02;this['type']=_0x21bb('0x8a');this[_0x21bb('0x8b')]='Fax\x20Extension';this[_0x21bb('0x64')]=_0x36c666['id'];this['priority']=_0x3ad209;this[_0x21bb('0x8c')]=_0x534219;}function createExtensionsReciveFax(_0x41043b){var _0x11f98d=0x1;var _0x1b47dd=[];_0x1b47dd[_0x21bb('0x8d')](new Extension(_0x41043b,_0x11f98d,'','Answer'));_0x11f98d+=0x1;_0x1b47dd['push'](new Extension(_0x41043b,_0x11f98d,_0x21bb('0x8e'),_0x21bb('0x8f')));_0x11f98d+=0x1;for(var _0x5af769 in _0x41043b){if(_0x41043b[_0x21bb('0x67')](_0x5af769)&&(_0x5af769===_0x21bb('0x90')||_0x5af769===_0x21bb('0x88')||_0x5af769==='gateway'||_0x5af769===_0x21bb('0x91')||_0x5af769===_0x21bb('0x92')||_0x5af769==='maxrate'||_0x5af769===_0x21bb('0x93')||_0x5af769===_0x21bb('0x94')||_0x5af769==='t38timeout')){_0x1b47dd[_0x21bb('0x8d')](new Extension(_0x41043b,_0x11f98d,_0x21bb('0x95')+_0x5af769+')='+_0x41043b[_0x5af769],_0x21bb('0x8f')));_0x11f98d+=0x1;}}_0x1b47dd[_0x21bb('0x8d')](new Extension(_0x41043b,_0x11f98d,'6',_0x21bb('0x96')));_0x11f98d+=0x1;_0x1b47dd[_0x21bb('0x8d')](new Extension(_0x41043b,_0x11f98d,_0x21bb('0x97'),_0x21bb('0x98')));_0x11f98d=0x0;return _0x1b47dd;}exports[_0x21bb('0x99')]=function(_0x1d5144,_0x17bd49,_0x5be2f4){var _0x202518;return db[_0x21bb('0x7e')][_0x21bb('0x7f')](function(_0x54054b){return db[_0x21bb('0x3d')]['create'](_0x1d5144[_0x21bb('0x5a')],{'transaction':_0x54054b})['then'](function(_0x245e11){_0x202518=_0x245e11[_0x21bb('0x5c')]({'plain':!![]});return db[_0x21bb('0x9a')][_0x21bb('0x81')](createExtensionsReciveFax(_0x202518),{'transaction':_0x54054b});});})[_0x21bb('0x21')](function(){return _0x202518;})[_0x21bb('0x21')](respondWithResult(_0x17bd49,null))[_0x21bb('0x2c')](handleError(_0x17bd49,null));};exports[_0x21bb('0x9b')]=function(_0x369a78,_0x336db,_0x5ac94b){var _0x14a24b;return db[_0x21bb('0x7e')][_0x21bb('0x7f')](function(_0x26460e){return db[_0x21bb('0x3d')][_0x21bb('0x34')](_0x369a78['body'],{'where':{'id':_0x369a78[_0x21bb('0x5a')]['id']},'transaction':_0x26460e})[_0x21bb('0x21')](function(_0x39497f){return db[_0x21bb('0x9a')][_0x21bb('0x37')]({'where':{'FaxAccountId':_0x369a78[_0x21bb('0x5a')]['id']},'transaction':_0x26460e})[_0x21bb('0x21')](function(_0xa2874d){return db[_0x21bb('0x9a')][_0x21bb('0x81')](createExtensionsReciveFax(_[_0x21bb('0x72')](_0x369a78[_0x21bb('0x5a')],[_0x21bb('0x9c'),_0x21bb('0x40'),_0x21bb('0x9d'),_0x21bb('0x9e'),_0x21bb('0x9f'),_0x21bb('0xa0')])),{'transaction':_0x26460e});});});})[_0x21bb('0x21')](function(){return db[_0x21bb('0x3d')]['findById'](_0x369a78[_0x21bb('0x5a')]['id']);})['then'](respondWithResult(_0x336db,null))[_0x21bb('0x2c')](handleError(_0x336db,null));};exports[_0x21bb('0xa1')]=function(_0x54a869,_0x26bf9d,_0x3b8747){var _0x2b7d4f={'raw':!![],'where':{}};var _0xf86067={};var _0x43969c={'count':0x0,'rows':[]};return db['FaxAccount'][_0x21bb('0x6d')]({'where':{'id':_0x54a869[_0x21bb('0x57')]['id']}})[_0x21bb('0x21')](handleEntityNotFound(_0x26bf9d,null))[_0x21bb('0x21')](function(_0x10d97a){if(_0x10d97a){_0xf86067[_0x21bb('0x41')]=_['keys'](db[_0x21bb('0xa2')][_0x21bb('0x3e')]);_0xf86067['query']=_[_0x21bb('0x43')](_0x54a869['query']);_0xf86067['filters']=_['intersection'](_0xf86067['model'],_0xf86067[_0x21bb('0x42')]);_0x2b7d4f['attributes']=_['intersection'](_0xf86067['model'],qs[_0x21bb('0x46')](_0x54a869['query'][_0x21bb('0x46')]));_0x2b7d4f[_0x21bb('0x44')]=_0x2b7d4f[_0x21bb('0x44')][_0x21bb('0x47')]?_0x2b7d4f[_0x21bb('0x44')]:_0xf86067[_0x21bb('0x41')];if(!_0x54a869[_0x21bb('0x42')][_0x21bb('0x67')](_0x21bb('0x6e'))){_0x2b7d4f[_0x21bb('0x48')]=qs[_0x21bb('0x48')](_0x54a869[_0x21bb('0x42')]['limit']);_0x2b7d4f['offset']=qs[_0x21bb('0x31')](_0x54a869['query']['offset']);}_0x2b7d4f[_0x21bb('0x49')]=qs[_0x21bb('0x4a')](_0x54a869[_0x21bb('0x42')][_0x21bb('0x4a')]);_0x2b7d4f['where']=qs[_0x21bb('0x4c')](_[_0x21bb('0x4d')](_0x54a869[_0x21bb('0x42')],_0xf86067[_0x21bb('0x4c')]));_0x2b7d4f['where'][_0x21bb('0x64')]=_0x10d97a['id'];if(_0x54a869[_0x21bb('0x42')][_0x21bb('0x4f')]){_0x2b7d4f['where']=_[_0x21bb('0x50')](_0x2b7d4f[_0x21bb('0x4b')],{'$or':_[_0x21bb('0x3c')](_0x2b7d4f['attributes'],function(_0x5ca9cc){var _0x38b886={};_0x38b886[_0x5ca9cc]={'$like':'%'+_0x54a869[_0x21bb('0x42')][_0x21bb('0x4f')]+'%'};return _0x38b886;})});}if(_0x54a869[_0x21bb('0x42')]['$gte']){var _0x10429e=_0x54a869[_0x21bb('0x42')]['$gte'][_0x21bb('0xa3')](',');var _0x525fb0={};_0x525fb0[_0x10429e[0x0]]={'$gte':moment(_0x10429e[0x1])[_0x21bb('0xa4')](_0x21bb('0xa5'))};_0x2b7d4f[_0x21bb('0x4b')]=_['merge'](_0x2b7d4f['where'],_0x525fb0);}_0x2b7d4f=_[_0x21bb('0x50')]({},_0x2b7d4f,_0x54a869[_0x21bb('0x51')]);return db[_0x21bb('0xa2')][_0x21bb('0x30')]({'where':_0x2b7d4f[_0x21bb('0x4b')]})[_0x21bb('0x21')](function(_0x21102a){_0x43969c['count']=_0x21102a;if(_0x54a869[_0x21bb('0x42')][_0x21bb('0x52')]){_0x2b7d4f[_0x21bb('0x53')]=[{'all':!![]}];}return db[_0x21bb('0xa2')][_0x21bb('0x54')](_0x2b7d4f);})[_0x21bb('0x21')](function(_0x39a398){_0x43969c[_0x21bb('0x55')]=_0x39a398;return _0x43969c;});}})[_0x21bb('0x21')](respondWithFilteredResult(_0x26bf9d,_0x2b7d4f))[_0x21bb('0x2c')](handleError(_0x26bf9d,null));};exports[_0x21bb('0x39')]=function(_0x796652,_0x32d012,_0x4a5db9){var _0x98d9c,_0x13a0de={},_0x1f61e9;if(_0x796652[_0x21bb('0x5a')]['to']){_0x1f61e9=_0x796652[_0x21bb('0x5a')]['to'][0x0];}return db[_0x21bb('0x3d')][_0x21bb('0x58')]({'where':{'id':_0x796652[_0x21bb('0x57')]['id']},'include':[{'model':db[_0x21bb('0xa6')],'as':_0x21bb('0xa7'),'include':[{'model':db[_0x21bb('0xa8')],'as':_0x21bb('0xa9'),'where':{'fax':_0x1f61e9},'limit':0x1,'order':[[_0x21bb('0x9e'),_0x21bb('0xaa')]]}]}]})['then'](handleEntityNotFound(_0x32d012,null))[_0x21bb('0x21')](function(_0x2bcb56){_0x98d9c=_0x2bcb56;if(_0x796652[_0x21bb('0x5a')]['attachments']&&_0x796652[_0x21bb('0x5a')][_0x21bb('0xab')][_0x21bb('0x47')]){for(var _0x43477a=0x0;_0x43477a<_0x796652['body'][_0x21bb('0xab')][_0x21bb('0x47')];_0x43477a+=0x1){_0x796652[_0x21bb('0x5a')][_0x21bb('0xab')][_0x43477a]={'filename':_0x796652[_0x21bb('0x5a')]['attachments'][_0x43477a][_0x21bb('0x38')],'id':_0x796652[_0x21bb('0x5a')][_0x21bb('0xab')][_0x43477a]['id'],'path':path['join'](config[_0x21bb('0xac')],_0x21bb('0xad'),_0x796652[_0x21bb('0x5a')]['attachments'][_0x43477a]['basename'])};}}return respondWithRpcPromise(_0x21bb('0xae'),'CheckAfterSend',{'FaxAccountId':_[_0x21bb('0xaf')](_0x796652[_0x21bb('0x57')]['id'])?undefined:_0x796652[_0x21bb('0x57')]['id'],'path':_[_0x21bb('0xaf')](_0x796652[_0x21bb('0x5a')][_0x21bb('0xab')][0x0][_0x21bb('0x7')])?undefined:_0x796652['body'][_0x21bb('0xab')][0x0][_0x21bb('0x7')],'fax':_[_0x21bb('0xaf')](_0x796652[_0x21bb('0x5a')]['to'][0x0])?undefined:_0x796652[_0x21bb('0x5a')]['to'][0x0]},client9002);})[_0x21bb('0x21')](function(){if(_0x98d9c){if(_[_0x21bb('0xaf')](_0x796652[_0x21bb('0x5a')][_0x21bb('0xb0')])){_0x796652[_0x21bb('0x5a')][_0x21bb('0xb0')]=util[_0x21bb('0xa4')]('\x22%s\x22\x20<%s>',_0x98d9c[_0x21bb('0x38')],_0x98d9c[_0x21bb('0xb1')]);}if(_0x98d9c[_0x21bb('0xa7')]){if(_0x98d9c['List'][_0x21bb('0xa9')][_0x21bb('0x47')]){return _0x98d9c[_0x21bb('0xa7')][_0x21bb('0xa9')][0x0];}else{return db[_0x21bb('0xa8')][_0x21bb('0x59')](_[_0x21bb('0xb2')](_0x796652[_0x21bb('0x5a')],{'firstName':_0x796652[_0x21bb('0x5a')]['to'][0x0],'phone':_0x796652[_0x21bb('0x5a')]['to'][0x0],'fax':_0x796652['body']['to'][0x0],'ListId':_0x98d9c[_0x21bb('0xa0')]}));}}else{throw new Error(_0x21bb('0xb3'));}}else{throw new Error(_0x21bb('0xb4'));}})['then'](function(_0x36c224){if(_0x36c224){return db[_0x21bb('0x71')][_0x21bb('0x58')]({'where':{'ContactId':_0x36c224['id'],'closed':![],'FaxAccountId':_0x98d9c['id']}})[_0x21bb('0x21')](function(_0x283fcb){if(_0x283fcb){return[_0x283fcb,![]];}return db[_0x21bb('0x71')][_0x21bb('0x59')]({'UserId':_0x796652['user']['id'],'ContactId':_0x36c224['id'],'FaxAccountId':_0x98d9c['id'],'fax':_0x796652[_0x21bb('0x5a')]['to'][0x0],'firstMsgDirection':_0x21bb('0xb5'),'Messages':[_[_0x21bb('0x50')](_0x796652[_0x21bb('0x5a')],{'read':![],'body':_0x796652[_0x21bb('0x5a')]['attachments'][0x0][_0x21bb('0xb6')],'FaxAccountId':_0x98d9c['id'],'UserId':_0x796652[_0x21bb('0x5b')]['id'],'ContactId':_0x36c224['id'],'AttachmentId':_0x796652[_0x21bb('0x5a')][_0x21bb('0xab')][0x0]['id']})]},{'include':[{'model':db[_0x21bb('0xa2')],'as':'Messages'}]})[_0x21bb('0x21')](function(_0x286f5e){return[_0x286f5e,!![]];});});}else{throw new Error(_0x21bb('0xb7'));}})['spread'](function(_0x71da22,_0x524c21){if(_0x524c21){return _0x71da22;}return db[_0x21bb('0xa2')][_0x21bb('0x59')]({'direction':_0x21bb('0xb5'),'read':![],'body':_0x796652[_0x21bb('0x5a')][_0x21bb('0xab')][0x0]['filename'],'FaxAccountId':_0x98d9c['id'],'FaxInteractionId':_0x71da22['id'],'UserId':_0x796652[_0x21bb('0x5b')]['id'],'ContactId':_0x71da22[_0x21bb('0xb8')],'AttachmentId':_0x796652[_0x21bb('0x5a')][_0x21bb('0xab')][0x0]['id']})[_0x21bb('0x21')](function(_0xa15077){_0x71da22['dataValues']['Messages']=[];_0x71da22['dataValues']['Messages']['push'](_0xa15077[_0x21bb('0xb9')]);return _0x71da22;});})[_0x21bb('0x21')](function(_0x17db78){respondWithRpcPromise('SendFax',_0x21bb('0xba'),{'FaxAccountId':_['isNil'](_0x796652[_0x21bb('0x57')]['id'])?undefined:_0x796652[_0x21bb('0x57')]['id'],'path':_[_0x21bb('0xaf')](_0x796652[_0x21bb('0x5a')][_0x21bb('0xab')][0x0]['path'])?undefined:_0x796652[_0x21bb('0x5a')][_0x21bb('0xab')][0x0]['path'],'fax':_[_0x21bb('0xaf')](_0x796652[_0x21bb('0x5a')]['to'][0x0])?undefined:_0x796652[_0x21bb('0x5a')]['to'][0x0],'AttachmentId':_0x796652[_0x21bb('0x5a')][_0x21bb('0xab')][0x0]['id']},client9002)[_0x21bb('0x21')](function(_0x2f1d64){logger[_0x21bb('0x22')]('SendFaxRpc,\x20%s',_0x2f1d64);})[_0x21bb('0x2c')](function(_0x247253){logger[_0x21bb('0x22')](_0x21bb('0xbb'),_0x247253);});return _0x17db78;})[_0x21bb('0x21')](respondWithResult(_0x32d012,null))[_0x21bb('0x2c')](handleError(_0x32d012,null));};exports[_0x21bb('0xbc')]=function(_0x400245,_0x3e4bea,_0x51fad8){return db[_0x21bb('0x3d')]['find']({'where':{'id':_0x400245[_0x21bb('0x57')]['id']}})['then'](handleEntityNotFound(_0x3e4bea,null))[_0x21bb('0x21')](function(_0x18c1d4){if(_0x18c1d4){return _0x18c1d4[_0x21bb('0xbc')](_0x400245[_0x21bb('0x5a')][_0x21bb('0x69')],_[_0x21bb('0x72')](_0x400245['body'],[_0x21bb('0x69'),'id'])||{})[_0x21bb('0xbd')](function(_0x49cd90){for(var _0x10aaa0=0x0;_0x10aaa0<_0x400245['body'][_0x21bb('0x69')][_0x21bb('0x47')];_0x10aaa0+=0x1){socket['emit'](_0x21bb('0xbe'),{'UserId':_0x400245['body'][_0x21bb('0x69')][_0x10aaa0],'FaxAccountId':_0x400245[_0x21bb('0x57')]['id']});}return _0x49cd90;});}})[_0x21bb('0x21')](respondWithResult(_0x3e4bea,null))[_0x21bb('0x2c')](handleError(_0x3e4bea,null));};exports['removeAgents']=function(_0x4cd0dc,_0x4d2608,_0x18d33e){return db[_0x21bb('0x3d')]['find']({'where':{'id':_0x4cd0dc[_0x21bb('0x57')]['id']}})[_0x21bb('0x21')](handleEntityNotFound(_0x4d2608,null))[_0x21bb('0x21')](function(_0x1365f7){if(_0x1365f7){return _0x1365f7[_0x21bb('0xbf')](_0x4cd0dc[_0x21bb('0x42')][_0x21bb('0x69')])[_0x21bb('0x21')](function(){if(_['isArray'](_0x4cd0dc[_0x21bb('0x42')][_0x21bb('0x69')])){for(var _0x45a0a9=0x0;_0x45a0a9<_0x4cd0dc[_0x21bb('0x42')][_0x21bb('0x69')][_0x21bb('0x47')];_0x45a0a9+=0x1){socket[_0x21bb('0xc0')](_0x21bb('0xc1'),{'UserId':Number(_0x4cd0dc['query'][_0x21bb('0x69')][_0x45a0a9]),'FaxAccountId':Number(_0x4cd0dc['params']['id'])});}}else{socket[_0x21bb('0xc0')](_0x21bb('0xc1'),{'UserId':Number(_0x4cd0dc[_0x21bb('0x42')][_0x21bb('0x69')]),'FaxAccountId':Number(_0x4cd0dc[_0x21bb('0x57')]['id'])});}});}})[_0x21bb('0x21')](respondWithStatusCode(_0x4d2608,null))[_0x21bb('0x2c')](handleError(_0x4d2608,null));};exports[_0x21bb('0xc2')]=function(_0xd02aab,_0x1b9eb4,_0x1000c3){var _0xd0fe1c={};var _0x15b315={};var _0x5dbeee;var _0x27cc7a;return db[_0x21bb('0x3d')]['findOne']({'where':{'id':_0xd02aab[_0x21bb('0x57')]['id']}})[_0x21bb('0x21')](handleEntityNotFound(_0x1b9eb4,null))[_0x21bb('0x21')](function(_0x3970c7){if(_0x3970c7){_0x5dbeee=_0x3970c7;_0x15b315[_0x21bb('0x41')]=_[_0x21bb('0x43')](db[_0x21bb('0x75')][_0x21bb('0x3e')]);_0x15b315[_0x21bb('0x42')]=_[_0x21bb('0x43')](_0xd02aab[_0x21bb('0x42')]);_0x15b315['filters']=_['intersection'](_0x15b315[_0x21bb('0x41')],_0x15b315['query']);_0xd0fe1c[_0x21bb('0x44')]=_[_0x21bb('0x45')](_0x15b315['model'],qs[_0x21bb('0x46')](_0xd02aab['query']['fields']));_0xd0fe1c[_0x21bb('0x44')]=_0xd0fe1c['attributes'][_0x21bb('0x47')]?_0xd0fe1c[_0x21bb('0x44')]:_0x15b315['model'];_0xd0fe1c[_0x21bb('0x49')]=qs[_0x21bb('0x4a')](_0xd02aab[_0x21bb('0x42')][_0x21bb('0x4a')]);_0xd0fe1c[_0x21bb('0x4b')]=qs[_0x21bb('0x4c')](_['pick'](_0xd02aab[_0x21bb('0x42')],_0x15b315[_0x21bb('0x4c')]));if(_0xd02aab['query'][_0x21bb('0x4f')]){_0xd0fe1c[_0x21bb('0x4b')]=_['merge'](_0xd0fe1c[_0x21bb('0x4b')],{'$or':_['map'](_0xd0fe1c[_0x21bb('0x44')],function(_0x203795){var _0x38c9cd={};_0x38c9cd[_0x203795]={'$like':'%'+_0xd02aab[_0x21bb('0x42')][_0x21bb('0x4f')]+'%'};return _0x38c9cd;})});}_0xd0fe1c=_['merge']({},_0xd0fe1c,_0xd02aab['options']);return _0x5dbeee[_0x21bb('0xc2')](_0xd0fe1c);}})['then'](function(_0x394281){if(_0x394281){_0x27cc7a=_0x394281[_0x21bb('0x47')];if(!_0xd02aab['query'][_0x21bb('0x67')]('nolimit')){_0xd0fe1c[_0x21bb('0x48')]=qs[_0x21bb('0x48')](_0xd02aab['query'][_0x21bb('0x48')]);_0xd0fe1c[_0x21bb('0x31')]=qs[_0x21bb('0x31')](_0xd02aab[_0x21bb('0x42')][_0x21bb('0x31')]);}return _0x5dbeee[_0x21bb('0xc2')](_0xd0fe1c);}})[_0x21bb('0x21')](function(_0x10c157){if(_0x10c157){return _0x10c157?{'count':_0x27cc7a,'rows':_0x10c157}:null;}})[_0x21bb('0x21')](respondWithResult(_0x1b9eb4,null))['catch'](handleError(_0x1b9eb4,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index e0f0eab..d252897 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 _0xf6a9=['update','remove','emit','hasOwnProperty','events','../../mysqldb','FaxAccount','setMaxListeners'];(function(_0x2187b0,_0x10504c){var _0x341dc1=function(_0x56d0b4){while(--_0x56d0b4){_0x2187b0['push'](_0x2187b0['shift']());}};_0x341dc1(++_0x10504c);}(_0xf6a9,0x16c));var _0x9f6a=function(_0x193843,_0x3db976){_0x193843=_0x193843-0x0;var _0x128811=_0xf6a9[_0x193843];return _0x128811;};'use strict';var EventEmitter=require(_0x9f6a('0x0'));var FaxAccount=require(_0x9f6a('0x1'))['db'][_0x9f6a('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x9f6a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9f6a('0x4'),'afterDestroy':_0x9f6a('0x5')};function emitEvent(_0x1b148f){return function(_0x415884,_0x1febb9,_0x2e07af){FaxAccountEvents[_0x9f6a('0x6')](_0x1b148f+':'+_0x415884['id'],_0x415884);FaxAccountEvents['emit'](_0x1b148f,_0x415884);_0x2e07af(null);};}for(var e in events){if(events[_0x9f6a('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x8388=['emit','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove'];(function(_0x27c478,_0x17925d){var _0x36b19c=function(_0x20b9ea){while(--_0x20b9ea){_0x27c478['push'](_0x27c478['shift']());}};_0x36b19c(++_0x17925d);}(_0x8388,0x110));var _0x8838=function(_0x87239,_0x38c793){_0x87239=_0x87239-0x0;var _0x53af1e=_0x8388[_0x87239];return _0x53af1e;};'use strict';var EventEmitter=require(_0x8838('0x0'));var FaxAccount=require(_0x8838('0x1'))['db'][_0x8838('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x8838('0x3')](0x0);var events={'afterCreate':_0x8838('0x4'),'afterUpdate':_0x8838('0x5'),'afterDestroy':_0x8838('0x6')};function emitEvent(_0x31742e){return function(_0x496d10,_0x4c52e9,_0x2ea456){FaxAccountEvents[_0x8838('0x7')](_0x31742e+':'+_0x496d10['id'],_0x496d10);FaxAccountEvents[_0x8838('0x7')](_0x31742e,_0x496d10);_0x2ea456(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x8838('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 48299c5..a9eb6fa 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 _0x4dd9=['path','rimraf','../../config/environment','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x390e2a,_0x33fc64){var _0x217343=function(_0x9a023a){while(--_0x9a023a){_0x390e2a['push'](_0x390e2a['shift']());}};_0x217343(++_0x33fc64);}(_0x4dd9,0x150));var _0x94dd=function(_0x3382e5,_0x4bfaa8){_0x3382e5=_0x3382e5-0x0;var _0x5efe1a=_0x4dd9[_0x3382e5];return _0x5efe1a;};'use strict';var _=require(_0x94dd('0x0'));var util=require(_0x94dd('0x1'));var logger=require(_0x94dd('0x2'))('api');var moment=require(_0x94dd('0x3'));var BPromise=require(_0x94dd('0x4'));var rp=require(_0x94dd('0x5'));var fs=require('fs');var path=require(_0x94dd('0x6'));var rimraf=require(_0x94dd('0x7'));var config=require(_0x94dd('0x8'));var attributes=require('./faxAccount.attributes');module['exports']=function(_0x3eb885,_0x1a3093){return _0x3eb885['define']('FaxAccount',attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe8a3=['path','../../config/environment','./faxAccount.attributes','exports','define','fax_accounts','lodash','../../config/logger','api','moment'];(function(_0x499f6f,_0x3bf9f4){var _0x56abe1=function(_0x655d86){while(--_0x655d86){_0x499f6f['push'](_0x499f6f['shift']());}};_0x56abe1(++_0x3bf9f4);}(_0xe8a3,0x182));var _0x3e8a=function(_0x31752d,_0x2efff8){_0x31752d=_0x31752d-0x0;var _0x29da67=_0xe8a3[_0x31752d];return _0x29da67;};'use strict';var _=require(_0x3e8a('0x0'));var util=require('util');var logger=require(_0x3e8a('0x1'))(_0x3e8a('0x2'));var moment=require(_0x3e8a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e8a('0x4'));var rimraf=require('rimraf');var config=require(_0x3e8a('0x5'));var attributes=require(_0x3e8a('0x6'));module[_0x3e8a('0x7')]=function(_0x47d2a9,_0x4af06e){return _0x47d2a9[_0x3e8a('0x8')]('FaxAccount',attributes,{'tableName':_0x3e8a('0x9'),'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 b0f1d18..362949e 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 _0xd451=['ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','Contacts','DESC','FaxApplication','get','Applications','list','orderBy','applications','priority','List','length','create','contact','fax','FaxInteraction','Contact\x20not\x20found','autoclose','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','unshift','agent','name','waitForTheAssignedAgent','startRouting','Start','util','moment','../../mysqldb','../../config/logger','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','NotifyFaxAccount','body','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt'];(function(_0x1fd2d0,_0x2f2471){var _0x3beb94=function(_0xc989ab){while(--_0xc989ab){_0x1fd2d0['push'](_0x1fd2d0['shift']());}};_0x3beb94(++_0x2f2471);}(_0xd451,0xde));var _0x1d45=function(_0x245861,_0x4f9ad5){_0x245861=_0x245861-0x0;var _0x1c2fd5=_0xd451[_0x245861];return _0x1c2fd5;};'use strict';var _=require('lodash');var util=require(_0x1d45('0x0'));var moment=require(_0x1d45('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d45('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x1d45('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1d45('0x4'));var client=jayson['client'][_0x1d45('0x5')]({'port':0x232c});config[_0x1d45('0x6')]=_[_0x1d45('0x7')](config[_0x1d45('0x6')],{'host':_0x1d45('0x8'),'port':0x18eb});var socket=require(_0x1d45('0x9'))(new Redis(config[_0x1d45('0x6')]));require(_0x1d45('0xa'))[_0x1d45('0xb')](socket);function respondWithRpcPromise(_0x249b1a,_0x312ad1,_0xee33cd){return new BPromise(function(_0xcb2881,_0x35490b){return client[_0x1d45('0xc')](_0x249b1a,_0xee33cd)[_0x1d45('0xd')](function(_0x468748){logger['info'](_0x1d45('0xe'),_0x312ad1,_0x1d45('0xf'));logger[_0x1d45('0x10')](_0x1d45('0x11'),_0x312ad1,_0x1d45('0xf'),JSON[_0x1d45('0x12')](_0x468748));if(_0x468748[_0x1d45('0x13')]){if(_0x468748[_0x1d45('0x13')][_0x1d45('0x14')]===0x1f4){logger[_0x1d45('0x13')]('FaxAccount,\x20%s,\x20%s',_0x312ad1,_0x468748[_0x1d45('0x13')][_0x1d45('0x15')]);return _0x35490b(_0x468748[_0x1d45('0x13')][_0x1d45('0x15')]);}logger['error'](_0x1d45('0xe'),_0x312ad1,_0x468748[_0x1d45('0x13')][_0x1d45('0x15')]);return _0xcb2881(_0x468748[_0x1d45('0x13')][_0x1d45('0x15')]);}else{logger[_0x1d45('0x16')](_0x1d45('0xe'),_0x312ad1,'request\x20sent');_0xcb2881(_0x468748['result'][_0x1d45('0x15')]);}})[_0x1d45('0x17')](function(_0x4a1a3d){logger[_0x1d45('0x13')](_0x1d45('0xe'),_0x312ad1,_0x4a1a3d);_0x35490b(_0x4a1a3d);});});}exports[_0x1d45('0x18')]=function(_0x302f80){var _0x375f40=this;return new Promise(function(_0x16be40,_0x289686){return db[_0x1d45('0x19')][_0x1d45('0x1a')]({'raw':_0x302f80[_0x1d45('0x1b')]?_0x302f80['options'][_0x1d45('0x1c')]===undefined?!![]:![]:!![],'where':_0x302f80[_0x1d45('0x1b')]?_0x302f80['options'][_0x1d45('0x1d')]||null:null,'attributes':_0x302f80[_0x1d45('0x1b')]?_0x302f80[_0x1d45('0x1b')][_0x1d45('0x1e')]||null:null,'limit':_0x302f80[_0x1d45('0x1b')]?_0x302f80[_0x1d45('0x1b')][_0x1d45('0x1f')]||null:null,'include':_0x302f80['options']?_0x302f80[_0x1d45('0x1b')][_0x1d45('0x20')]?_[_0x1d45('0x21')](_0x302f80['options'][_0x1d45('0x20')],function(_0x31be4c){return{'model':db[_0x31be4c[_0x1d45('0x22')]],'as':_0x31be4c['as'],'attributes':_0x31be4c['attributes'],'include':_0x31be4c[_0x1d45('0x20')]?_[_0x1d45('0x21')](_0x31be4c[_0x1d45('0x20')],function(_0x1be10a){return{'model':db[_0x1be10a['model']],'as':_0x1be10a['as'],'attributes':_0x1be10a[_0x1d45('0x1e')],'include':_0x1be10a[_0x1d45('0x20')]?_['map'](_0x1be10a[_0x1d45('0x20')],function(_0x750966){return{'model':db[_0x750966['model']],'as':_0x750966['as'],'attributes':_0x750966[_0x1d45('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1d45('0xd')](function(_0x379aef){logger['info'](_0x1d45('0x18'),_0x302f80);logger[_0x1d45('0x10')](_0x1d45('0x18'),_0x302f80,JSON[_0x1d45('0x12')](_0x379aef));_0x16be40(_0x379aef);})[_0x1d45('0x17')](function(_0x5eb11c){logger['error'](_0x1d45('0x18'),_0x5eb11c[_0x1d45('0x15')],_0x302f80);_0x289686(_0x375f40['error'](0x1f4,_0x5eb11c[_0x1d45('0x15')]));});});};exports[_0x1d45('0x23')]=function(_0x345ce8,_0x43c03d,_0x1dea01){var _0x102bf6=this;return new Promise(function(_0x30df52,_0x1c5e57){var _0x2d29b7={'body':_0x345ce8[_0x1d45('0x24')],'channel':'fax'};var _0x4f6525=[];var _0x4e3806=[];var _0x32e461={};return db[_0x1d45('0x25')][_0x1d45('0x26')]()[_0x1d45('0xd')](function(_0x21d81e){if(!_0x21d81e){throw new db['Sequelize'][(_0x1d45('0x27'))](_0x1d45('0x28'));}_0x4f6525=_[_0x1d45('0x29')](_[_0x1d45('0x2a')](_0x21d81e),[_0x1d45('0x2b'),_0x1d45('0x2c')]);_0x4e3806=_[_0x1d45('0x29')](_[_0x1d45('0x2a')](_0x21d81e),[_0x1d45('0x2b'),'updatedAt','CompanyId',_0x1d45('0x2d')]);if(_0x345ce8[_0x1d45('0x24')]['id']){delete _0x345ce8[_0x1d45('0x24')]['id'];}if(_[_0x1d45('0x2e')](_0x345ce8['body'][_0x1d45('0x2f')])){throw new db['Sequelize'][(_0x1d45('0x27'))](_0x1d45('0x30'));}if(_[_0x1d45('0x2e')](_0x345ce8['body']['body'])||_0x345ce8[_0x1d45('0x24')]['body']===''){throw new db['Sequelize'][(_0x1d45('0x27'))](_0x1d45('0x31'));}if(_[_0x1d45('0x2e')](_0x345ce8[_0x1d45('0x24')][_0x1d45('0x32')])){throw new db[(_0x1d45('0x33'))][(_0x1d45('0x27'))](_0x1d45('0x34')+_0x4e3806);}if(!_['includes'](_0x4e3806,_0x345ce8[_0x1d45('0x24')][_0x1d45('0x32')])){throw new db[(_0x1d45('0x33'))][(_0x1d45('0x27'))](_0x1d45('0x35')+_0x4e3806);}_0x32e461[_0x345ce8[_0x1d45('0x24')][_0x1d45('0x32')]]=_0x345ce8[_0x1d45('0x24')][_0x1d45('0x2f')];})[_0x1d45('0xd')](function(){return db[_0x1d45('0x19')][_0x1d45('0x36')]({'where':{'id':_0x345ce8[_0x1d45('0x37')]['id']},'include':[{'model':db[_0x1d45('0x38')],'as':'List','include':[{'model':db['CmContact'],'as':_0x1d45('0x39'),'where':_0x32e461,'limit':0x1,'order':[[_0x1d45('0x2c'),_0x1d45('0x3a')]]}]},{'model':db[_0x1d45('0x3b')],'as':'Applications'}]});})[_0x1d45('0xd')](function(_0x120891){if(_0x120891&&_0x120891['List']){var _0x3f069d=_0x120891[_0x1d45('0x3c')]({'plain':!![]});_0x2d29b7[_0x1d45('0x37')]=_0x3f069d;_0x2d29b7['applications']=_0x3f069d[_0x1d45('0x3d')];_0x2d29b7[_0x1d45('0x3e')]=_0x3f069d['List'];_0x2d29b7['applications']=_[_0x1d45('0x3f')](_0x2d29b7[_0x1d45('0x40')],[_0x1d45('0x41')],['asc']);if(_0x2d29b7[_0x1d45('0x37')][_0x1d45('0x3d')]){delete _0x2d29b7[_0x1d45('0x37')][_0x1d45('0x3d')];}if(_0x2d29b7[_0x1d45('0x37')][_0x1d45('0x42')]&&_0x2d29b7[_0x1d45('0x37')][_0x1d45('0x42')][_0x1d45('0x39')][_0x1d45('0x43')]){return _0x2d29b7[_0x1d45('0x37')][_0x1d45('0x42')][_0x1d45('0x39')][0x0];}var _0x10a522=_['defaults'](_0x345ce8[_0x1d45('0x24')],{'firstName':_0x345ce8['body'][_0x1d45('0x2f')],'ListId':_0x3f069d[_0x1d45('0x2d')]});_0x10a522[_0x345ce8[_0x1d45('0x24')][_0x1d45('0x32')]]=_0x345ce8[_0x1d45('0x24')][_0x1d45('0x2f')];return db[_0x1d45('0x25')][_0x1d45('0x44')](_0x10a522,{'fields':_0x4f6525,'raw':!![]});}})[_0x1d45('0xd')](function(_0x255adf){_0x2d29b7[_0x1d45('0x45')]=_0x255adf;if(_0x255adf){var _0x1f0ef6={'ContactId':_0x255adf['id'],'FaxAccountId':_0x345ce8[_0x1d45('0x37')]['id'],'fax':_0x255adf[_0x1d45('0x46')]};return db['FaxInteraction']['find']({'where':{'ContactId':_0x255adf['id'],'closed':![],'FaxAccountId':_0x345ce8[_0x1d45('0x37')]['id']}})[_0x1d45('0xd')](function(_0x470646){if(_0x470646){return[_0x470646,![]];}return db[_0x1d45('0x47')][_0x1d45('0x44')](_0x1f0ef6)[_0x1d45('0xd')](function(_0x266ab6){return[_0x266ab6,!![]];});});}else{throw new Error(_0x1d45('0x48'));}})['spread'](function(_0x49f303,_0x120ef8){var _0x17b0fc=_0x49f303[_0x1d45('0x3c')]({'plain':!![]});if(_0x120ef8){if(_0x2d29b7[_0x1d45('0x37')][_0x1d45('0x49')]){_0x2d29b7['applications']['push']({'id':0x0,'priority':_0x2d29b7['applications'][_0x1d45('0x43')]+0x1,'app':_0x1d45('0x4a'),'appdata':_0x1d45('0x4b'),'interval':_0x1d45('0x4c')});}_0x17b0fc[_0x1d45('0x4d')]=!![];}else{_0x17b0fc[_0x1d45('0x4d')]=![];}_0x2d29b7[_0x1d45('0x4e')]=_0x17b0fc;return db[_0x1d45('0x4f')][_0x1d45('0x44')]({'body':_0x345ce8[_0x1d45('0x24')][_0x1d45('0x24')],'FaxAccountId':_0x345ce8[_0x1d45('0x37')]['id'],'FaxInteractionId':_0x49f303['id'],'direction':'in','ContactId':_0x49f303[_0x1d45('0x50')],'AttachmentId':_0x345ce8[_0x1d45('0x24')][_0x1d45('0x51')]});})['then'](function(_0x556451){_0x2d29b7['message']=_0x556451;if(_0x2d29b7[_0x1d45('0x4e')][_0x1d45('0x52')]){return db['User'][_0x1d45('0x36')]({'attributes':['id','name'],'where':{'id':_0x2d29b7[_0x1d45('0x4e')]['UserId']}})[_0x1d45('0xd')](function(_0x46534a){if(_0x46534a){_0x2d29b7[_0x1d45('0x40')][_0x1d45('0x53')]({'id':0x0,'priority':0x0,'app':_0x1d45('0x54'),'appdata':_0x46534a[_0x1d45('0x55')]+','+(_0x2d29b7[_0x1d45('0x37')][_0x1d45('0x56')]||0xa),'interval':_0x1d45('0x4c')});}return respondWithRpcPromise('Start',_0x1d45('0x57'),_0x2d29b7);});}return respondWithRpcPromise(_0x1d45('0x58'),_0x1d45('0x57'),_0x2d29b7);})[_0x1d45('0xd')](function(_0x291f93){_0x30df52(_0x291f93);})[_0x1d45('0x17')](function(_0x2ad5b8){_0x1c5e57(_0x102bf6[_0x1d45('0x13')](0x1f4,_0x2ad5b8[_0x1d45('0x15')]));});});}; \ No newline at end of file +var _0x0cdc=['difference','keys','createdAt','updatedAt','CompanyId','ListId','body','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','from','find','account','CmList','List','DESC','FaxApplication','Applications','get','applications','list','priority','asc','Contacts','length','create','fax','FaxInteraction','Contact\x20not\x20found','spread','autoclose','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','UserId','unshift','agent','name','Start','startRouting','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','map','model','include','catch','CmContact','describe','Sequelize','ValidationError'];(function(_0x4018cb,_0x550827){var _0x17a239=function(_0x574986){while(--_0x574986){_0x4018cb['push'](_0x4018cb['shift']());}};_0x17a239(++_0x550827);}(_0x0cdc,0x1e7));var _0xc0cd=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x0cdc[_0x2df507];return _0x1f7167;};'use strict';var _=require('lodash');var util=require(_0xc0cd('0x0'));var moment=require('moment');var BPromise=require(_0xc0cd('0x1'));var rs=require(_0xc0cd('0x2'));var fs=require('fs');var Redis=require(_0xc0cd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc0cd('0x4'));var logger=require('../../config/logger')(_0xc0cd('0x5'));var config=require(_0xc0cd('0x6'));var jayson=require(_0xc0cd('0x7'));var client=jayson[_0xc0cd('0x8')][_0xc0cd('0x9')]({'port':0x232c});config['redis']=_[_0xc0cd('0xa')](config[_0xc0cd('0xb')],{'host':_0xc0cd('0xc'),'port':0x18eb});var socket=require(_0xc0cd('0xd'))(new Redis(config[_0xc0cd('0xb')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x36313c,_0x2f40e4,_0x36497b){return new BPromise(function(_0x53252a,_0x4a867e){return client[_0xc0cd('0xe')](_0x36313c,_0x36497b)[_0xc0cd('0xf')](function(_0x39db94){logger[_0xc0cd('0x10')](_0xc0cd('0x11'),_0x2f40e4,_0xc0cd('0x12'));logger[_0xc0cd('0x13')](_0xc0cd('0x14'),_0x2f40e4,_0xc0cd('0x12'),JSON[_0xc0cd('0x15')](_0x39db94));if(_0x39db94[_0xc0cd('0x16')]){if(_0x39db94[_0xc0cd('0x16')][_0xc0cd('0x17')]===0x1f4){logger[_0xc0cd('0x16')](_0xc0cd('0x11'),_0x2f40e4,_0x39db94[_0xc0cd('0x16')][_0xc0cd('0x18')]);return _0x4a867e(_0x39db94[_0xc0cd('0x16')][_0xc0cd('0x18')]);}logger[_0xc0cd('0x16')](_0xc0cd('0x11'),_0x2f40e4,_0x39db94[_0xc0cd('0x16')][_0xc0cd('0x18')]);return _0x53252a(_0x39db94['error']['message']);}else{logger[_0xc0cd('0x10')](_0xc0cd('0x11'),_0x2f40e4,'request\x20sent');_0x53252a(_0x39db94[_0xc0cd('0x19')]['message']);}})['catch'](function(_0x47b2d8){logger[_0xc0cd('0x16')](_0xc0cd('0x11'),_0x2f40e4,_0x47b2d8);_0x4a867e(_0x47b2d8);});});}exports[_0xc0cd('0x1a')]=function(_0x31b3f2){var _0x40e66e=this;return new Promise(function(_0x4538f4,_0x587a50){return db[_0xc0cd('0x1b')][_0xc0cd('0x1c')]({'raw':_0x31b3f2[_0xc0cd('0x1d')]?_0x31b3f2[_0xc0cd('0x1d')][_0xc0cd('0x1e')]===undefined?!![]:![]:!![],'where':_0x31b3f2[_0xc0cd('0x1d')]?_0x31b3f2[_0xc0cd('0x1d')]['where']||null:null,'attributes':_0x31b3f2[_0xc0cd('0x1d')]?_0x31b3f2[_0xc0cd('0x1d')][_0xc0cd('0x1f')]||null:null,'limit':_0x31b3f2[_0xc0cd('0x1d')]?_0x31b3f2[_0xc0cd('0x1d')][_0xc0cd('0x20')]||null:null,'include':_0x31b3f2[_0xc0cd('0x1d')]?_0x31b3f2[_0xc0cd('0x1d')]['include']?_[_0xc0cd('0x21')](_0x31b3f2[_0xc0cd('0x1d')]['include'],function(_0x363b19){return{'model':db[_0x363b19[_0xc0cd('0x22')]],'as':_0x363b19['as'],'attributes':_0x363b19[_0xc0cd('0x1f')],'include':_0x363b19['include']?_[_0xc0cd('0x21')](_0x363b19['include'],function(_0x461b62){return{'model':db[_0x461b62[_0xc0cd('0x22')]],'as':_0x461b62['as'],'attributes':_0x461b62['attributes'],'include':_0x461b62[_0xc0cd('0x23')]?_['map'](_0x461b62[_0xc0cd('0x23')],function(_0x2e467f){return{'model':db[_0x2e467f[_0xc0cd('0x22')]],'as':_0x2e467f['as'],'attributes':_0x2e467f[_0xc0cd('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc0cd('0xf')](function(_0x349e6d){logger['info'](_0xc0cd('0x1a'),_0x31b3f2);logger['debug'](_0xc0cd('0x1a'),_0x31b3f2,JSON[_0xc0cd('0x15')](_0x349e6d));_0x4538f4(_0x349e6d);})[_0xc0cd('0x24')](function(_0x4ad073){logger[_0xc0cd('0x16')](_0xc0cd('0x1a'),_0x4ad073[_0xc0cd('0x18')],_0x31b3f2);_0x587a50(_0x40e66e[_0xc0cd('0x16')](0x1f4,_0x4ad073[_0xc0cd('0x18')]));});});};exports['NotifyFaxAccount']=function(_0x2dbe0e,_0x45a403,_0xed72e4){var _0x3fc665=this;return new Promise(function(_0x44bc94,_0x2a966e){var _0x1aa4fa={'body':_0x2dbe0e['body'],'channel':'fax'};var _0xde77e2=[];var _0x365241=[];var _0x4ed042={};return db[_0xc0cd('0x25')][_0xc0cd('0x26')]()[_0xc0cd('0xf')](function(_0x5d10d8){if(!_0x5d10d8){throw new db[(_0xc0cd('0x27'))][(_0xc0cd('0x28'))]('no\x20available\x20attributes');}_0xde77e2=_[_0xc0cd('0x29')](_[_0xc0cd('0x2a')](_0x5d10d8),[_0xc0cd('0x2b'),_0xc0cd('0x2c')]);_0x365241=_[_0xc0cd('0x29')](_[_0xc0cd('0x2a')](_0x5d10d8),[_0xc0cd('0x2b'),_0xc0cd('0x2c'),_0xc0cd('0x2d'),_0xc0cd('0x2e')]);if(_0x2dbe0e['body']['id']){delete _0x2dbe0e[_0xc0cd('0x2f')]['id'];}if(_[_0xc0cd('0x30')](_0x2dbe0e[_0xc0cd('0x2f')]['from'])){throw new db[(_0xc0cd('0x27'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x2dbe0e[_0xc0cd('0x2f')][_0xc0cd('0x2f')])||_0x2dbe0e[_0xc0cd('0x2f')][_0xc0cd('0x2f')]===''){throw new db['Sequelize'][(_0xc0cd('0x28'))](_0xc0cd('0x31'));}if(_[_0xc0cd('0x30')](_0x2dbe0e['body'][_0xc0cd('0x32')])){throw new db[(_0xc0cd('0x27'))][(_0xc0cd('0x28'))](_0xc0cd('0x33')+_0x365241);}if(!_[_0xc0cd('0x34')](_0x365241,_0x2dbe0e[_0xc0cd('0x2f')][_0xc0cd('0x32')])){throw new db[(_0xc0cd('0x27'))][(_0xc0cd('0x28'))](_0xc0cd('0x35')+_0x365241);}_0x4ed042[_0x2dbe0e['body']['mapKey']]=_0x2dbe0e[_0xc0cd('0x2f')][_0xc0cd('0x36')];})[_0xc0cd('0xf')](function(){return db['FaxAccount'][_0xc0cd('0x37')]({'where':{'id':_0x2dbe0e[_0xc0cd('0x38')]['id']},'include':[{'model':db[_0xc0cd('0x39')],'as':_0xc0cd('0x3a'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x4ed042,'limit':0x1,'order':[['updatedAt',_0xc0cd('0x3b')]]}]},{'model':db[_0xc0cd('0x3c')],'as':_0xc0cd('0x3d')}]});})[_0xc0cd('0xf')](function(_0x1dfa18){if(_0x1dfa18&&_0x1dfa18['List']){var _0x47dbd5=_0x1dfa18[_0xc0cd('0x3e')]({'plain':!![]});_0x1aa4fa[_0xc0cd('0x38')]=_0x47dbd5;_0x1aa4fa[_0xc0cd('0x3f')]=_0x47dbd5[_0xc0cd('0x3d')];_0x1aa4fa[_0xc0cd('0x40')]=_0x47dbd5[_0xc0cd('0x3a')];_0x1aa4fa['applications']=_['orderBy'](_0x1aa4fa[_0xc0cd('0x3f')],[_0xc0cd('0x41')],[_0xc0cd('0x42')]);if(_0x1aa4fa[_0xc0cd('0x38')][_0xc0cd('0x3d')]){delete _0x1aa4fa['account'][_0xc0cd('0x3d')];}if(_0x1aa4fa[_0xc0cd('0x38')][_0xc0cd('0x3a')]&&_0x1aa4fa['account']['List'][_0xc0cd('0x43')][_0xc0cd('0x44')]){return _0x1aa4fa[_0xc0cd('0x38')][_0xc0cd('0x3a')][_0xc0cd('0x43')][0x0];}var _0x1b8546=_[_0xc0cd('0xa')](_0x2dbe0e[_0xc0cd('0x2f')],{'firstName':_0x2dbe0e[_0xc0cd('0x2f')][_0xc0cd('0x36')],'ListId':_0x47dbd5['ListId']});_0x1b8546[_0x2dbe0e[_0xc0cd('0x2f')][_0xc0cd('0x32')]]=_0x2dbe0e['body'][_0xc0cd('0x36')];return db['CmContact'][_0xc0cd('0x45')](_0x1b8546,{'fields':_0xde77e2,'raw':!![]});}})['then'](function(_0x103139){_0x1aa4fa['contact']=_0x103139;if(_0x103139){var _0x587493={'ContactId':_0x103139['id'],'FaxAccountId':_0x2dbe0e[_0xc0cd('0x38')]['id'],'fax':_0x103139[_0xc0cd('0x46')]};return db[_0xc0cd('0x47')]['find']({'where':{'ContactId':_0x103139['id'],'closed':![],'FaxAccountId':_0x2dbe0e[_0xc0cd('0x38')]['id']}})[_0xc0cd('0xf')](function(_0x1b1b79){if(_0x1b1b79){return[_0x1b1b79,![]];}return db['FaxInteraction']['create'](_0x587493)[_0xc0cd('0xf')](function(_0x18e67e){return[_0x18e67e,!![]];});});}else{throw new Error(_0xc0cd('0x48'));}})[_0xc0cd('0x49')](function(_0x42d55b,_0x2622b0){var _0x1f1f25=_0x42d55b[_0xc0cd('0x3e')]({'plain':!![]});if(_0x2622b0){if(_0x1aa4fa['account'][_0xc0cd('0x4a')]){_0x1aa4fa[_0xc0cd('0x3f')]['push']({'id':0x0,'priority':_0x1aa4fa['applications'][_0xc0cd('0x44')]+0x1,'app':_0xc0cd('0x4b'),'appdata':_0xc0cd('0x4c'),'interval':_0xc0cd('0x4d')});}_0x1f1f25[_0xc0cd('0x4e')]=!![];}else{_0x1f1f25[_0xc0cd('0x4e')]=![];}_0x1aa4fa[_0xc0cd('0x4f')]=_0x1f1f25;return db[_0xc0cd('0x50')]['create']({'body':_0x2dbe0e[_0xc0cd('0x2f')][_0xc0cd('0x2f')],'FaxAccountId':_0x2dbe0e[_0xc0cd('0x38')]['id'],'FaxInteractionId':_0x42d55b['id'],'direction':'in','ContactId':_0x42d55b[_0xc0cd('0x51')],'AttachmentId':_0x2dbe0e[_0xc0cd('0x2f')]['AttachmentId']});})[_0xc0cd('0xf')](function(_0x25ce68){_0x1aa4fa['message']=_0x25ce68;if(_0x1aa4fa[_0xc0cd('0x4f')][_0xc0cd('0x52')]){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x1aa4fa[_0xc0cd('0x4f')][_0xc0cd('0x52')]}})['then'](function(_0x5e201d){if(_0x5e201d){_0x1aa4fa[_0xc0cd('0x3f')][_0xc0cd('0x53')]({'id':0x0,'priority':0x0,'app':_0xc0cd('0x54'),'appdata':_0x5e201d[_0xc0cd('0x55')]+','+(_0x1aa4fa[_0xc0cd('0x38')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xc0cd('0x56'),_0xc0cd('0x57'),_0x1aa4fa);});}return respondWithRpcPromise(_0xc0cd('0x56'),_0xc0cd('0x57'),_0x1aa4fa);})[_0xc0cd('0xf')](function(_0x169c7a){_0x44bc94(_0x169c7a);})['catch'](function(_0x226264){_0x2a966e(_0x3fc665['error'](0x1f4,_0x226264[_0xc0cd('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index d6c48b5..8c5fa58 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 _0x4c60=['faxAccount:','./faxAccount.events','save','remove','update','removeListener','register','length'];(function(_0x1a6961,_0x33a754){var _0x4f3fce=function(_0x16253a){while(--_0x16253a){_0x1a6961['push'](_0x1a6961['shift']());}};_0x4f3fce(++_0x33a754);}(_0x4c60,0xc1));var _0x04c6=function(_0x51f8e0,_0x49726c){_0x51f8e0=_0x51f8e0-0x0;var _0x1d15f7=_0x4c60[_0x51f8e0];return _0x1d15f7;};'use strict';var FaxAccountEvents=require(_0x04c6('0x0'));var events=[_0x04c6('0x1'),_0x04c6('0x2'),_0x04c6('0x3')];function createListener(_0x5ba768,_0x2a1d36){return function(_0x5d9fa3){_0x2a1d36['emit'](_0x5ba768,_0x5d9fa3);};}function removeListener(_0x4ad4f1,_0x53ca7a){return function(){FaxAccountEvents[_0x04c6('0x4')](_0x4ad4f1,_0x53ca7a);};}exports[_0x04c6('0x5')]=function(_0x2054da){for(var _0x12bd5d=0x0,_0x2b9041=events[_0x04c6('0x6')];_0x12bd5d<_0x2b9041;_0x12bd5d++){var _0x8f9b13=events[_0x12bd5d];var _0x530a48=createListener(_0x04c6('0x7')+_0x8f9b13,_0x2054da);FaxAccountEvents['on'](_0x8f9b13,_0x530a48);}}; \ No newline at end of file +var _0xa46e=['./faxAccount.events','save','update','emit','register','faxAccount:'];(function(_0x26356f,_0x1a118c){var _0x1908db=function(_0x305b43){while(--_0x305b43){_0x26356f['push'](_0x26356f['shift']());}};_0x1908db(++_0x1a118c);}(_0xa46e,0x8a));var _0xea46=function(_0x160248,_0x2a57e6){_0x160248=_0x160248-0x0;var _0x4e589d=_0xa46e[_0x160248];return _0x4e589d;};'use strict';var FaxAccountEvents=require(_0xea46('0x0'));var events=[_0xea46('0x1'),'remove',_0xea46('0x2')];function createListener(_0x2f69cc,_0x12deba){return function(_0x4cc9a2){_0x12deba[_0xea46('0x3')](_0x2f69cc,_0x4cc9a2);};}function removeListener(_0x4b6e4a,_0x3a2209){return function(){FaxAccountEvents['removeListener'](_0x4b6e4a,_0x3a2209);};}exports[_0xea46('0x4')]=function(_0x528404){for(var _0x10bee5=0x0,_0x3dc26f=events['length'];_0x10bee5<_0x3dc26f;_0x10bee5++){var _0x2d1b30=events[_0x10bee5];var _0x42771a=createListener(_0xea46('0x5')+_0x2d1b30,_0x528404);FaxAccountEvents['on'](_0x2d1b30,_0x42771a);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index b1d3fe4..4823590 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 _0x9a54=['get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/interactions','/:id/applications','getApplications','getMessages','/:id/users','getAgents','post','addDisposition','addInteraction','addApplications','/addaccountapplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','update','delete','removeDispositions','removeAnswers','removeAgents','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./faxAccount.controller'];(function(_0x28681f,_0x3352ef){var _0x28ec4b=function(_0x1c40ff){while(--_0x1c40ff){_0x28681f['push'](_0x28681f['shift']());}};_0x28ec4b(++_0x3352ef);}(_0x9a54,0x1b5));var _0x49a5=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x9a54[_0x35da42];return _0x370035;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49a5('0x0'));var timeout=require(_0x49a5('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x49a5('0x2'));var interaction=require(_0x49a5('0x3'));var config=require('../../config/environment');var controller=require(_0x49a5('0x4'));router[_0x49a5('0x5')]('/',auth[_0x49a5('0x6')](),controller[_0x49a5('0x7')]);router[_0x49a5('0x5')](_0x49a5('0x8'),auth['isAuthenticated'](),controller[_0x49a5('0x9')]);router['get'](_0x49a5('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x49a5('0x5')](_0x49a5('0xb'),auth[_0x49a5('0x6')](),controller['getDispositions']);router[_0x49a5('0x5')](_0x49a5('0xc'),auth[_0x49a5('0x6')](),controller[_0x49a5('0xd')]);router[_0x49a5('0x5')](_0x49a5('0xe'),auth[_0x49a5('0x6')](),controller['getInteractions']);router[_0x49a5('0x5')](_0x49a5('0xf'),auth[_0x49a5('0x6')](),controller[_0x49a5('0x10')]);router[_0x49a5('0x5')]('/:id/messages',auth[_0x49a5('0x6')](),controller[_0x49a5('0x11')]);router[_0x49a5('0x5')](_0x49a5('0x12'),auth[_0x49a5('0x6')](),controller[_0x49a5('0x13')]);router[_0x49a5('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x49a5('0x14')](_0x49a5('0xb'),auth['isAuthenticated'](),controller[_0x49a5('0x15')]);router[_0x49a5('0x14')](_0x49a5('0xc'),auth[_0x49a5('0x6')](),controller['addAnswer']);router[_0x49a5('0x14')](_0x49a5('0xe'),auth['isAuthenticated'](),controller[_0x49a5('0x16')]);router[_0x49a5('0x14')](_0x49a5('0xf'),auth['isAuthenticated'](),controller[_0x49a5('0x17')]);router[_0x49a5('0x14')](_0x49a5('0x18'),auth[_0x49a5('0x6')](),controller['addAccountApplications']);router[_0x49a5('0x14')](_0x49a5('0x19'),auth[_0x49a5('0x6')](),controller[_0x49a5('0x1a')]);router[_0x49a5('0x14')](_0x49a5('0x1b'),auth[_0x49a5('0x6')](),controller[_0x49a5('0x1c')]);router[_0x49a5('0x14')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x49a5('0x1d')]);router[_0x49a5('0x1e')](_0x49a5('0xa'),auth[_0x49a5('0x6')](),controller['destroy']);router['delete'](_0x49a5('0xb'),auth[_0x49a5('0x6')](),controller[_0x49a5('0x1f')]);router[_0x49a5('0x1e')]('/:id/canned_answers',auth[_0x49a5('0x6')](),controller[_0x49a5('0x20')]);router['delete']('/:id/users',auth[_0x49a5('0x6')](),controller[_0x49a5('0x21')]);module['exports']=router; \ No newline at end of file +var _0xd5e5=['/describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','addInteraction','/:id/send','send','addAgents','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xd5e5,0x1df));var _0x5d5e=function(_0x539feb,_0x250bc9){_0x539feb=_0x539feb-0x0;var _0x3ec2e5=_0xd5e5[_0x539feb];return _0x3ec2e5;};'use strict';var multer=require(_0x5d5e('0x0'));var util=require(_0x5d5e('0x1'));var path=require(_0x5d5e('0x2'));var timeout=require(_0x5d5e('0x3'));var express=require(_0x5d5e('0x4'));var router=express[_0x5d5e('0x5')]();var fs_extra=require(_0x5d5e('0x6'));var auth=require(_0x5d5e('0x7'));var interaction=require(_0x5d5e('0x8'));var config=require(_0x5d5e('0x9'));var controller=require('./faxAccount.controller');router[_0x5d5e('0xa')]('/',auth[_0x5d5e('0xb')](),controller[_0x5d5e('0xc')]);router[_0x5d5e('0xa')](_0x5d5e('0xd'),auth[_0x5d5e('0xb')](),controller['describe']);router[_0x5d5e('0xa')](_0x5d5e('0xe'),auth['isAuthenticated'](),controller[_0x5d5e('0xf')]);router[_0x5d5e('0xa')](_0x5d5e('0x10'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x5d5e('0xa')](_0x5d5e('0x11'),auth[_0x5d5e('0xb')](),controller[_0x5d5e('0x12')]);router[_0x5d5e('0xa')](_0x5d5e('0x13'),auth['isAuthenticated'](),controller[_0x5d5e('0x14')]);router[_0x5d5e('0xa')](_0x5d5e('0x15'),auth['isAuthenticated'](),controller[_0x5d5e('0x16')]);router[_0x5d5e('0xa')](_0x5d5e('0x17'),auth[_0x5d5e('0xb')](),controller[_0x5d5e('0x18')]);router[_0x5d5e('0xa')](_0x5d5e('0x19'),auth[_0x5d5e('0xb')](),controller[_0x5d5e('0x1a')]);router[_0x5d5e('0x1b')]('/',auth['isAuthenticated'](),controller[_0x5d5e('0x1c')]);router['post']('/:id/dispositions',auth[_0x5d5e('0xb')](),controller[_0x5d5e('0x1d')]);router[_0x5d5e('0x1b')](_0x5d5e('0x11'),auth[_0x5d5e('0xb')](),controller[_0x5d5e('0x1e')]);router['post']('/:id/interactions',auth[_0x5d5e('0xb')](),controller[_0x5d5e('0x1f')]);router[_0x5d5e('0x1b')](_0x5d5e('0x15'),auth[_0x5d5e('0xb')](),controller['addApplications']);router[_0x5d5e('0x1b')]('/addaccountapplications',auth[_0x5d5e('0xb')](),controller['addAccountApplications']);router[_0x5d5e('0x1b')]('/updateaccountapplications',auth[_0x5d5e('0xb')](),controller['updateAccountApplications']);router[_0x5d5e('0x1b')](_0x5d5e('0x20'),auth[_0x5d5e('0xb')](),controller[_0x5d5e('0x21')]);router[_0x5d5e('0x1b')](_0x5d5e('0x19'),auth[_0x5d5e('0xb')](),controller[_0x5d5e('0x22')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x5d5e('0x23')]);router[_0x5d5e('0x24')](_0x5d5e('0xe'),auth[_0x5d5e('0xb')](),controller[_0x5d5e('0x25')]);router['delete'](_0x5d5e('0x10'),auth[_0x5d5e('0xb')](),controller[_0x5d5e('0x26')]);router[_0x5d5e('0x24')](_0x5d5e('0x11'),auth[_0x5d5e('0xb')](),controller['removeAnswers']);router[_0x5d5e('0x24')]('/:id/users',auth['isAuthenticated'](),controller[_0x5d5e('0x27')]);module[_0x5d5e('0x28')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index ba61d37..6104b6e 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 _0x4cb5=['exports','INTEGER','STRING','TEXT','*,*,*,*','sequelize'];(function(_0xbcfd06,_0x2286f0){var _0x2ecc28=function(_0x50f7fc){while(--_0x50f7fc){_0xbcfd06['push'](_0xbcfd06['shift']());}};_0x2ecc28(++_0x2286f0);}(_0x4cb5,0x8f));var _0x54cb=function(_0x3b420b,_0x1881f4){_0x3b420b=_0x3b420b-0x0;var _0x13ec33=_0x4cb5[_0x3b420b];return _0x13ec33;};'use strict';var Sequelize=require(_0x54cb('0x0'));module[_0x54cb('0x1')]={'priority':{'type':Sequelize[_0x54cb('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x54cb('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x54cb('0x4')]()},'description':{'type':Sequelize[_0x54cb('0x3')]},'interval':{'type':Sequelize[_0x54cb('0x3')],'defaultValue':_0x54cb('0x5')}}; \ No newline at end of file +var _0x5853=['exports','INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x540620,_0x2b6fe0){var _0x22b894=function(_0x18fd25){while(--_0x18fd25){_0x540620['push'](_0x540620['shift']());}};_0x22b894(++_0x2b6fe0);}(_0x5853,0x113));var _0x3585=function(_0x507056,_0xe16b72){_0x507056=_0x507056-0x0;var _0x4eaecc=_0x5853[_0x507056];return _0x4eaecc;};'use strict';var Sequelize=require(_0x3585('0x0'));module[_0x3585('0x1')]={'priority':{'type':Sequelize[_0x3585('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3585('0x3')],'allowNull':![],'defaultValue':_0x3585('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x3585('0x3')]},'interval':{'type':Sequelize[_0x3585('0x3')],'defaultValue':_0x3585('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 6c8772f..5592404 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 _0xd590=['VIRTUAL','includeAll','findAll','catch','show','params','keys','rawAttributes','include','find','body','update','html-pdf','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','map','FaxApplication','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xd590,0x1b0));var _0x0d59=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd590[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x0d59('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0d59('0x1'));var zipdir=require(_0x0d59('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0d59('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0d59('0x4'));var util=require(_0x0d59('0x5'));var path=require(_0x0d59('0x6'));var sox=require(_0x0d59('0x7'));var csv=require(_0x0d59('0x8'));var ejs=require(_0x0d59('0x9'));var fs=require('fs');var fs_extra=require(_0x0d59('0xa'));var _=require(_0x0d59('0xb'));var squel=require(_0x0d59('0xc'));var crypto=require(_0x0d59('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0d59('0x8'));var querystring=require(_0x0d59('0xe'));var Papa=require(_0x0d59('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0d59('0x10'));var as=require(_0x0d59('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x0d59('0x12'));var config=require(_0x0d59('0x13'));var licenseUtil=require(_0x0d59('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20167f,_0x1caa1f){_0x1caa1f=_0x1caa1f||0xcc;return function(_0x1bc0e3){if(_0x1bc0e3){return _0x20167f['sendStatus'](_0x1caa1f);}return _0x20167f['status'](_0x1caa1f)['end']();};}function respondWithResult(_0x429f80,_0x4cd966){_0x4cd966=_0x4cd966||0xc8;return function(_0x25a872){if(_0x25a872){return _0x429f80[_0x0d59('0x15')](_0x4cd966)[_0x0d59('0x16')](_0x25a872);}};}function respondWithFilteredResult(_0x5432ae,_0x806fdb){return function(_0x277401){if(_0x277401){var _0x1c68d7=_0x277401[_0x0d59('0x17')],_0x336e70=_0x806fdb[_0x0d59('0x18')],_0x333e45=_0x806fdb['offset']+_0x806fdb[_0x0d59('0x19')],_0x3f2fee;if(_0x333e45>=_0x1c68d7){_0x333e45=_0x1c68d7;_0x3f2fee=0xc8;}else{_0x3f2fee=0xce;}_0x5432ae[_0x0d59('0x15')](_0x3f2fee);return _0x5432ae[_0x0d59('0x1a')](_0x0d59('0x1b'),_0x336e70+'-'+_0x333e45+'/'+_0x1c68d7)[_0x0d59('0x16')](_0x277401);}return null;};}function patchUpdates(_0x4e5650){return function(_0x263eba){try{jsonpatch[_0x0d59('0x1c')](_0x263eba,_0x4e5650,!![]);}catch(_0x267ed0){return BPromise[_0x0d59('0x1d')](_0x267ed0);}return _0x263eba[_0x0d59('0x1e')]();};}function saveUpdates(_0x5af3ff,_0x3a7215){return function(_0x37ed4f){if(_0x37ed4f){return _0x37ed4f['update'](_0x5af3ff)[_0x0d59('0x1f')](function(_0xf022d2){return _0xf022d2;});}return null;};}function removeEntity(_0x357672,_0x437524){return function(_0x478267){if(_0x478267){return _0x478267[_0x0d59('0x20')]()['then'](function(){_0x357672['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x144ba3,_0x41186f){return function(_0x259230){if(!_0x259230){_0x144ba3[_0x0d59('0x21')](0x194);}return _0x259230;};}function handleError(_0x4c8508,_0x1b58e5){_0x1b58e5=_0x1b58e5||0x1f4;return function(_0x661f26){logger['error'](_0x661f26[_0x0d59('0x22')]);if(_0x661f26[_0x0d59('0x23')]){delete _0x661f26[_0x0d59('0x23')];}_0x4c8508[_0x0d59('0x15')](_0x1b58e5)[_0x0d59('0x24')](_0x661f26);};}exports[_0x0d59('0x25')]=function(_0x5ac876,_0x347c0c){var _0x725789={},_0x58fe2b={},_0x42f3ef={'count':0x0,'rows':[]};var _0x4fbc61=_[_0x0d59('0x26')](db[_0x0d59('0x27')]['rawAttributes'],function(_0x51c31b){return{'name':_0x51c31b[_0x0d59('0x28')],'type':_0x51c31b['type'][_0x0d59('0x29')]};});_0x58fe2b[_0x0d59('0x2a')]=_[_0x0d59('0x26')](_0x4fbc61,_0x0d59('0x23'));_0x58fe2b[_0x0d59('0x2b')]=_['keys'](_0x5ac876['query']);_0x58fe2b[_0x0d59('0x2c')]=_[_0x0d59('0x2d')](_0x58fe2b[_0x0d59('0x2a')],_0x58fe2b['query']);_0x725789[_0x0d59('0x2e')]=_[_0x0d59('0x2d')](_0x58fe2b[_0x0d59('0x2a')],qs[_0x0d59('0x2f')](_0x5ac876[_0x0d59('0x2b')][_0x0d59('0x2f')]));_0x725789['attributes']=_0x725789[_0x0d59('0x2e')][_0x0d59('0x30')]?_0x725789[_0x0d59('0x2e')]:_0x58fe2b[_0x0d59('0x2a')];if(!_0x5ac876[_0x0d59('0x2b')][_0x0d59('0x31')](_0x0d59('0x32'))){_0x725789['limit']=qs[_0x0d59('0x19')](_0x5ac876[_0x0d59('0x2b')][_0x0d59('0x19')]);_0x725789[_0x0d59('0x18')]=qs['offset'](_0x5ac876[_0x0d59('0x2b')][_0x0d59('0x18')]);}_0x725789[_0x0d59('0x33')]=qs[_0x0d59('0x34')](_0x5ac876['query'][_0x0d59('0x34')]);_0x725789[_0x0d59('0x35')]=qs[_0x0d59('0x2c')](_[_0x0d59('0x36')](_0x5ac876[_0x0d59('0x2b')],_0x58fe2b[_0x0d59('0x2c')]),_0x4fbc61);if(_0x5ac876[_0x0d59('0x2b')][_0x0d59('0x37')]){_0x725789['where']=_[_0x0d59('0x38')](_0x725789['where'],{'$or':_[_0x0d59('0x26')](_0x4fbc61,function(_0x420c09){if(_0x420c09[_0x0d59('0x39')]!==_0x0d59('0x3a')){var _0x4430f1={};_0x4430f1[_0x420c09[_0x0d59('0x23')]]={'$like':'%'+_0x5ac876[_0x0d59('0x2b')][_0x0d59('0x37')]+'%'};return _0x4430f1;}})});}_0x725789=_[_0x0d59('0x38')]({},_0x725789,_0x5ac876['options']);var _0x3e9531={'where':_0x725789[_0x0d59('0x35')]};return db[_0x0d59('0x27')][_0x0d59('0x17')](_0x3e9531)[_0x0d59('0x1f')](function(_0x1d812f){_0x42f3ef[_0x0d59('0x17')]=_0x1d812f;if(_0x5ac876[_0x0d59('0x2b')][_0x0d59('0x3b')]){_0x725789['include']=[{'all':!![]}];}return db['FaxApplication'][_0x0d59('0x3c')](_0x725789);})[_0x0d59('0x1f')](function(_0x2a5ed5){_0x42f3ef['rows']=_0x2a5ed5;return _0x42f3ef;})[_0x0d59('0x1f')](respondWithFilteredResult(_0x347c0c,_0x725789))[_0x0d59('0x3d')](handleError(_0x347c0c,null));};exports[_0x0d59('0x3e')]=function(_0x1d4588,_0x276e85){var _0x22dd81={'raw':!![],'where':{'id':_0x1d4588[_0x0d59('0x3f')]['id']}},_0x58181a={};_0x58181a[_0x0d59('0x2a')]=_[_0x0d59('0x40')](db[_0x0d59('0x27')][_0x0d59('0x41')]);_0x58181a[_0x0d59('0x2b')]=_[_0x0d59('0x40')](_0x1d4588['query']);_0x58181a[_0x0d59('0x2c')]=_[_0x0d59('0x2d')](_0x58181a[_0x0d59('0x2a')],_0x58181a['query']);_0x22dd81[_0x0d59('0x2e')]=_[_0x0d59('0x2d')](_0x58181a[_0x0d59('0x2a')],qs[_0x0d59('0x2f')](_0x1d4588[_0x0d59('0x2b')][_0x0d59('0x2f')]));_0x22dd81[_0x0d59('0x2e')]=_0x22dd81['attributes'][_0x0d59('0x30')]?_0x22dd81[_0x0d59('0x2e')]:_0x58181a[_0x0d59('0x2a')];if(_0x1d4588[_0x0d59('0x2b')]['includeAll']){_0x22dd81[_0x0d59('0x42')]=[{'all':!![]}];}_0x22dd81=_[_0x0d59('0x38')]({},_0x22dd81,_0x1d4588['options']);return db[_0x0d59('0x27')][_0x0d59('0x43')](_0x22dd81)[_0x0d59('0x1f')](handleEntityNotFound(_0x276e85,null))[_0x0d59('0x1f')](respondWithResult(_0x276e85,null))[_0x0d59('0x3d')](handleError(_0x276e85,null));};exports['create']=function(_0x59b505,_0x2a139c){return db['FaxApplication']['create'](_0x59b505[_0x0d59('0x44')],{})[_0x0d59('0x1f')](respondWithResult(_0x2a139c,0xc9))[_0x0d59('0x3d')](handleError(_0x2a139c,null));};exports[_0x0d59('0x45')]=function(_0x2fb282,_0xef653b){if(_0x2fb282[_0x0d59('0x44')]['id']){delete _0x2fb282[_0x0d59('0x44')]['id'];}return db[_0x0d59('0x27')][_0x0d59('0x43')]({'where':{'id':_0x2fb282[_0x0d59('0x3f')]['id']}})[_0x0d59('0x1f')](handleEntityNotFound(_0xef653b,null))[_0x0d59('0x1f')](saveUpdates(_0x2fb282[_0x0d59('0x44')],null))['then'](respondWithResult(_0xef653b,null))[_0x0d59('0x3d')](handleError(_0xef653b,null));};exports['destroy']=function(_0x22c7b2,_0x4af22c){return db[_0x0d59('0x27')][_0x0d59('0x43')]({'where':{'id':_0x22c7b2[_0x0d59('0x3f')]['id']}})[_0x0d59('0x1f')](handleEntityNotFound(_0x4af22c,null))[_0x0d59('0x1f')](removeEntity(_0x4af22c,null))[_0x0d59('0x3d')](handleError(_0x4af22c,null));}; \ No newline at end of file +var _0xb21f=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','set','reject','then','error','stack','send','map','FaxApplication','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','limit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','show','params','keys','rawAttributes','catch','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger'];(function(_0x52715d,_0x28927d){var _0x344e39=function(_0x2d9fb5){while(--_0x2d9fb5){_0x52715d['push'](_0x52715d['shift']());}};_0x344e39(++_0x28927d);}(_0xb21f,0xf9));var _0xfb21=function(_0x24875d,_0x4fb24d){_0x24875d=_0x24875d-0x0;var _0x181471=_0xb21f[_0x24875d];return _0x181471;};'use strict';var pdf=require(_0xfb21('0x0'));var emlformat=require(_0xfb21('0x1'));var rimraf=require(_0xfb21('0x2'));var zipdir=require(_0xfb21('0x3'));var jsonpatch=require(_0xfb21('0x4'));var rp=require('request-promise');var moment=require(_0xfb21('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xfb21('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfb21('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfb21('0x8'));var squel=require(_0xfb21('0x9'));var crypto=require('crypto');var jsforce=require(_0xfb21('0xa'));var deskjs=require(_0xfb21('0xb'));var toCsv=require(_0xfb21('0xc'));var querystring=require(_0xfb21('0xd'));var Papa=require(_0xfb21('0xe'));var Redis=require(_0xfb21('0xf'));var authService=require(_0xfb21('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb21('0x11'));var logger=require(_0xfb21('0x12'))(_0xfb21('0x13'));var utils=require(_0xfb21('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xfb21('0x15'));var db=require(_0xfb21('0x16'))['db'];function respondWithStatusCode(_0x43e594,_0x159908){_0x159908=_0x159908||0xcc;return function(_0x2fb1a8){if(_0x2fb1a8){return _0x43e594[_0xfb21('0x17')](_0x159908);}return _0x43e594['status'](_0x159908)[_0xfb21('0x18')]();};}function respondWithResult(_0x1c0ed9,_0x1605ef){_0x1605ef=_0x1605ef||0xc8;return function(_0x243a40){if(_0x243a40){return _0x1c0ed9[_0xfb21('0x19')](_0x1605ef)[_0xfb21('0x1a')](_0x243a40);}};}function respondWithFilteredResult(_0x132ab0,_0x3ced28){return function(_0x373190){if(_0x373190){var _0x478818=_0x373190[_0xfb21('0x1b')],_0x4f95c7=_0x3ced28['offset'],_0x88f34f=_0x3ced28['offset']+_0x3ced28['limit'],_0x3c67c7;if(_0x88f34f>=_0x478818){_0x88f34f=_0x478818;_0x3c67c7=0xc8;}else{_0x3c67c7=0xce;}_0x132ab0[_0xfb21('0x19')](_0x3c67c7);return _0x132ab0[_0xfb21('0x1c')]('Content-Range',_0x4f95c7+'-'+_0x88f34f+'/'+_0x478818)[_0xfb21('0x1a')](_0x373190);}return null;};}function patchUpdates(_0x58f16d){return function(_0x2de891){try{jsonpatch['apply'](_0x2de891,_0x58f16d,!![]);}catch(_0x52ae83){return BPromise[_0xfb21('0x1d')](_0x52ae83);}return _0x2de891['save']();};}function saveUpdates(_0x51d3d8,_0x5ef6c0){return function(_0x4d663b){if(_0x4d663b){return _0x4d663b['update'](_0x51d3d8)['then'](function(_0x54ff39){return _0x54ff39;});}return null;};}function removeEntity(_0x49aa08,_0x4e0f61){return function(_0x30d0bd){if(_0x30d0bd){return _0x30d0bd['destroy']()[_0xfb21('0x1e')](function(){_0x49aa08[_0xfb21('0x19')](0xcc)[_0xfb21('0x18')]();});}};}function handleEntityNotFound(_0x276825,_0x317abe){return function(_0x554786){if(!_0x554786){_0x276825[_0xfb21('0x17')](0x194);}return _0x554786;};}function handleError(_0x4fc63f,_0x106ae4){_0x106ae4=_0x106ae4||0x1f4;return function(_0x578eb6){logger[_0xfb21('0x1f')](_0x578eb6[_0xfb21('0x20')]);if(_0x578eb6['name']){delete _0x578eb6['name'];}_0x4fc63f[_0xfb21('0x19')](_0x106ae4)[_0xfb21('0x21')](_0x578eb6);};}exports['index']=function(_0x2e173c,_0x6afd2){var _0x3fd4c7={},_0x311c83={},_0x8073c7={'count':0x0,'rows':[]};var _0x558159=_[_0xfb21('0x22')](db[_0xfb21('0x23')]['rawAttributes'],function(_0x58617e){return{'name':_0x58617e[_0xfb21('0x24')],'type':_0x58617e[_0xfb21('0x25')][_0xfb21('0x26')]};});_0x311c83[_0xfb21('0x27')]=_[_0xfb21('0x22')](_0x558159,'name');_0x311c83['query']=_['keys'](_0x2e173c[_0xfb21('0x28')]);_0x311c83['filters']=_[_0xfb21('0x29')](_0x311c83[_0xfb21('0x27')],_0x311c83['query']);_0x3fd4c7[_0xfb21('0x2a')]=_[_0xfb21('0x29')](_0x311c83[_0xfb21('0x27')],qs['fields'](_0x2e173c['query'][_0xfb21('0x2b')]));_0x3fd4c7[_0xfb21('0x2a')]=_0x3fd4c7[_0xfb21('0x2a')][_0xfb21('0x2c')]?_0x3fd4c7[_0xfb21('0x2a')]:_0x311c83['model'];if(!_0x2e173c[_0xfb21('0x28')]['hasOwnProperty'](_0xfb21('0x2d'))){_0x3fd4c7[_0xfb21('0x2e')]=qs[_0xfb21('0x2e')](_0x2e173c[_0xfb21('0x28')][_0xfb21('0x2e')]);_0x3fd4c7['offset']=qs[_0xfb21('0x2f')](_0x2e173c['query'][_0xfb21('0x2f')]);}_0x3fd4c7[_0xfb21('0x30')]=qs[_0xfb21('0x31')](_0x2e173c[_0xfb21('0x28')][_0xfb21('0x31')]);_0x3fd4c7[_0xfb21('0x32')]=qs[_0xfb21('0x33')](_[_0xfb21('0x34')](_0x2e173c[_0xfb21('0x28')],_0x311c83[_0xfb21('0x33')]),_0x558159);if(_0x2e173c['query'][_0xfb21('0x35')]){_0x3fd4c7[_0xfb21('0x32')]=_[_0xfb21('0x36')](_0x3fd4c7[_0xfb21('0x32')],{'$or':_[_0xfb21('0x22')](_0x558159,function(_0x3e3358){if(_0x3e3358[_0xfb21('0x25')]!==_0xfb21('0x37')){var _0x515150={};_0x515150[_0x3e3358['name']]={'$like':'%'+_0x2e173c[_0xfb21('0x28')][_0xfb21('0x35')]+'%'};return _0x515150;}})});}_0x3fd4c7=_[_0xfb21('0x36')]({},_0x3fd4c7,_0x2e173c[_0xfb21('0x38')]);var _0x5a65f9={'where':_0x3fd4c7['where']};return db[_0xfb21('0x23')][_0xfb21('0x1b')](_0x5a65f9)[_0xfb21('0x1e')](function(_0x3bfca1){_0x8073c7[_0xfb21('0x1b')]=_0x3bfca1;if(_0x2e173c[_0xfb21('0x28')][_0xfb21('0x39')]){_0x3fd4c7[_0xfb21('0x3a')]=[{'all':!![]}];}return db[_0xfb21('0x23')]['findAll'](_0x3fd4c7);})['then'](function(_0x2db3d8){_0x8073c7['rows']=_0x2db3d8;return _0x8073c7;})['then'](respondWithFilteredResult(_0x6afd2,_0x3fd4c7))['catch'](handleError(_0x6afd2,null));};exports[_0xfb21('0x3b')]=function(_0x57b01c,_0x32a38f){var _0x291494={'raw':!![],'where':{'id':_0x57b01c[_0xfb21('0x3c')]['id']}},_0x3729b2={};_0x3729b2[_0xfb21('0x27')]=_[_0xfb21('0x3d')](db[_0xfb21('0x23')][_0xfb21('0x3e')]);_0x3729b2[_0xfb21('0x28')]=_['keys'](_0x57b01c[_0xfb21('0x28')]);_0x3729b2[_0xfb21('0x33')]=_[_0xfb21('0x29')](_0x3729b2[_0xfb21('0x27')],_0x3729b2[_0xfb21('0x28')]);_0x291494[_0xfb21('0x2a')]=_[_0xfb21('0x29')](_0x3729b2[_0xfb21('0x27')],qs[_0xfb21('0x2b')](_0x57b01c[_0xfb21('0x28')][_0xfb21('0x2b')]));_0x291494[_0xfb21('0x2a')]=_0x291494[_0xfb21('0x2a')][_0xfb21('0x2c')]?_0x291494[_0xfb21('0x2a')]:_0x3729b2[_0xfb21('0x27')];if(_0x57b01c[_0xfb21('0x28')]['includeAll']){_0x291494['include']=[{'all':!![]}];}_0x291494=_[_0xfb21('0x36')]({},_0x291494,_0x57b01c[_0xfb21('0x38')]);return db[_0xfb21('0x23')]['find'](_0x291494)['then'](handleEntityNotFound(_0x32a38f,null))[_0xfb21('0x1e')](respondWithResult(_0x32a38f,null))[_0xfb21('0x3f')](handleError(_0x32a38f,null));};exports[_0xfb21('0x40')]=function(_0x39ae3f,_0x173144){return db[_0xfb21('0x23')][_0xfb21('0x40')](_0x39ae3f[_0xfb21('0x41')],{})[_0xfb21('0x1e')](respondWithResult(_0x173144,0xc9))[_0xfb21('0x3f')](handleError(_0x173144,null));};exports['update']=function(_0x202f0b,_0x3b0ccd){if(_0x202f0b[_0xfb21('0x41')]['id']){delete _0x202f0b[_0xfb21('0x41')]['id'];}return db[_0xfb21('0x23')][_0xfb21('0x42')]({'where':{'id':_0x202f0b[_0xfb21('0x3c')]['id']}})[_0xfb21('0x1e')](handleEntityNotFound(_0x3b0ccd,null))['then'](saveUpdates(_0x202f0b['body'],null))['then'](respondWithResult(_0x3b0ccd,null))['catch'](handleError(_0x3b0ccd,null));};exports['destroy']=function(_0xfca196,_0x3f9942){return db[_0xfb21('0x23')]['find']({'where':{'id':_0xfca196[_0xfb21('0x3c')]['id']}})[_0xfb21('0x1e')](handleEntityNotFound(_0x3f9942,null))[_0xfb21('0x1e')](removeEntity(_0x3f9942,null))[_0xfb21('0x3f')](handleError(_0x3f9942,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 2baf302..9b535d4 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 _0x1105=['FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define'];(function(_0xdefbc3,_0x1ea49a){var _0x367798=function(_0x594678){while(--_0x594678){_0xdefbc3['push'](_0xdefbc3['shift']());}};_0x367798(++_0x1ea49a);}(_0x1105,0x84));var _0x5110=function(_0x345f77,_0xdea2bf){_0x345f77=_0x345f77-0x0;var _0x2e9435=_0x1105[_0x345f77];return _0x2e9435;};'use strict';var _=require('lodash');var util=require(_0x5110('0x0'));var logger=require(_0x5110('0x1'))(_0x5110('0x2'));var moment=require(_0x5110('0x3'));var BPromise=require(_0x5110('0x4'));var rp=require(_0x5110('0x5'));var fs=require('fs');var path=require(_0x5110('0x6'));var rimraf=require(_0x5110('0x7'));var config=require(_0x5110('0x8'));var attributes=require(_0x5110('0x9'));module[_0x5110('0xa')]=function(_0x500b78,_0x29d56a){return _0x500b78[_0x5110('0xb')](_0x5110('0xc'),attributes,{'tableName':_0x5110('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5110('0xe'),'collate':_0x5110('0xf')});}; \ No newline at end of file +var _0xa2c3=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','FaxApplication','fax_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0xb3fe4b,_0x1bde5c){var _0x42027f=function(_0x25edf5){while(--_0x25edf5){_0xb3fe4b['push'](_0xb3fe4b['shift']());}};_0x42027f(++_0x1bde5c);}(_0xa2c3,0xcf));var _0x3a2c=function(_0x1db72a,_0x22f6bc){_0x1db72a=_0x1db72a-0x0;var _0x1c7ee7=_0xa2c3[_0x1db72a];return _0x1c7ee7;};'use strict';var _=require(_0x3a2c('0x0'));var util=require(_0x3a2c('0x1'));var logger=require(_0x3a2c('0x2'))(_0x3a2c('0x3'));var moment=require(_0x3a2c('0x4'));var BPromise=require(_0x3a2c('0x5'));var rp=require(_0x3a2c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3a2c('0x7'));var config=require(_0x3a2c('0x8'));var attributes=require('./faxApplication.attributes');module[_0x3a2c('0x9')]=function(_0x18aed2,_0x2764d3){return _0x18aed2[_0x3a2c('0xa')](_0x3a2c('0xb'),attributes,{'tableName':_0x3a2c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3a2c('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index d6f36b5..7888ab8 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 _0x414c=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','FaxApplication','update','options','raw','where','attributes','limit','UpdateFaxApplication','lodash','util','moment','bluebird','randomstring'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x414c,0x124));var _0xc414=function(_0x219940,_0x30bac9){_0x219940=_0x219940-0x0;var _0x195da8=_0x414c[_0x219940];return _0x195da8;};'use strict';var _=require(_0xc414('0x0'));var util=require(_0xc414('0x1'));var moment=require(_0xc414('0x2'));var BPromise=require(_0xc414('0x3'));var rs=require(_0xc414('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc414('0x5'))['db'];var utils=require(_0xc414('0x6'));var logger=require(_0xc414('0x7'))(_0xc414('0x8'));var config=require('../../config/environment');var jayson=require(_0xc414('0x9'));var client=jayson[_0xc414('0xa')][_0xc414('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4bb0ab,_0xa02ca0,_0x3edd3e){return new BPromise(function(_0x5ca756,_0x2d764a){return client[_0xc414('0xc')](_0x4bb0ab,_0x3edd3e)[_0xc414('0xd')](function(_0xb93189){logger['info'](_0xc414('0xe'),_0xa02ca0,_0xc414('0xf'));logger[_0xc414('0x10')](_0xc414('0x11'),_0xa02ca0,_0xc414('0xf'),JSON[_0xc414('0x12')](_0xb93189));if(_0xb93189[_0xc414('0x13')]){if(_0xb93189[_0xc414('0x13')][_0xc414('0x14')]===0x1f4){logger['error'](_0xc414('0xe'),_0xa02ca0,_0xb93189[_0xc414('0x13')]['message']);return _0x2d764a(_0xb93189['error']['message']);}logger['error'](_0xc414('0xe'),_0xa02ca0,_0xb93189['error'][_0xc414('0x15')]);return _0x5ca756(_0xb93189['error']['message']);}else{logger[_0xc414('0x16')]('FaxApplication,\x20%s,\x20%s',_0xa02ca0,_0xc414('0xf'));_0x5ca756(_0xb93189[_0xc414('0x17')][_0xc414('0x15')]);}})[_0xc414('0x18')](function(_0x51b113){logger[_0xc414('0x13')](_0xc414('0xe'),_0xa02ca0,_0x51b113);_0x2d764a(_0x51b113);});});}exports['UpdateFaxApplication']=function(_0x33b62b){var _0x19b612=this;return new Promise(function(_0x1804de,_0x2b917f){return db[_0xc414('0x19')][_0xc414('0x1a')](_0x33b62b['body'],{'raw':_0x33b62b[_0xc414('0x1b')]?_0x33b62b[_0xc414('0x1b')][_0xc414('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33b62b[_0xc414('0x1b')]?_0x33b62b['options'][_0xc414('0x1d')]||null:null,'attributes':_0x33b62b[_0xc414('0x1b')]?_0x33b62b[_0xc414('0x1b')][_0xc414('0x1e')]||null:null,'limit':_0x33b62b['options']?_0x33b62b[_0xc414('0x1b')][_0xc414('0x1f')]||null:null})['then'](function(_0x12b1f7){logger['info']('UpdateFaxApplication',_0x33b62b);logger[_0xc414('0x10')]('UpdateFaxApplication',_0x33b62b,JSON[_0xc414('0x12')](_0x12b1f7));_0x1804de(_0x12b1f7);})['catch'](function(_0x4fc564){logger[_0xc414('0x13')](_0xc414('0x20'),_0x4fc564['message'],_0x33b62b);_0x2b917f(_0x19b612[_0xc414('0x13')](0x1f4,_0x4fc564[_0xc414('0x15')]));});});}; \ No newline at end of file +var _0xca9f=['limit','debug','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxApplication','update','body','options','raw','where','attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xca9f,0x15e));var _0xfca9=function(_0x5cb139,_0x1a5f77){_0x5cb139=_0x5cb139-0x0;var _0x816e2b=_0xca9f[_0x5cb139];return _0x816e2b;};'use strict';var _=require(_0xfca9('0x0'));var util=require(_0xfca9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfca9('0x2'));var fs=require('fs');var Redis=require(_0xfca9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfca9('0x4'));var logger=require(_0xfca9('0x5'))('rpc');var config=require(_0xfca9('0x6'));var jayson=require(_0xfca9('0x7'));var client=jayson['client'][_0xfca9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d200d,_0x2ff57b,_0x524d0e){return new BPromise(function(_0x338caf,_0x255caf){return client[_0xfca9('0x9')](_0x5d200d,_0x524d0e)[_0xfca9('0xa')](function(_0x40b28d){logger[_0xfca9('0xb')](_0xfca9('0xc'),_0x2ff57b,_0xfca9('0xd'));logger['debug'](_0xfca9('0xe'),_0x2ff57b,_0xfca9('0xd'),JSON[_0xfca9('0xf')](_0x40b28d));if(_0x40b28d['error']){if(_0x40b28d[_0xfca9('0x10')]['code']===0x1f4){logger[_0xfca9('0x10')]('FaxApplication,\x20%s,\x20%s',_0x2ff57b,_0x40b28d[_0xfca9('0x10')][_0xfca9('0x11')]);return _0x255caf(_0x40b28d[_0xfca9('0x10')]['message']);}logger['error'](_0xfca9('0xc'),_0x2ff57b,_0x40b28d[_0xfca9('0x10')][_0xfca9('0x11')]);return _0x338caf(_0x40b28d[_0xfca9('0x10')][_0xfca9('0x11')]);}else{logger[_0xfca9('0xb')](_0xfca9('0xc'),_0x2ff57b,_0xfca9('0xd'));_0x338caf(_0x40b28d[_0xfca9('0x12')][_0xfca9('0x11')]);}})[_0xfca9('0x13')](function(_0x19145c){logger[_0xfca9('0x10')](_0xfca9('0xc'),_0x2ff57b,_0x19145c);_0x255caf(_0x19145c);});});}exports[_0xfca9('0x14')]=function(_0x13141b){var _0x571fd2=this;return new Promise(function(_0x4a9958,_0x5e0f10){return db['FaxApplication'][_0xfca9('0x15')](_0x13141b[_0xfca9('0x16')],{'raw':_0x13141b[_0xfca9('0x17')]?_0x13141b[_0xfca9('0x17')][_0xfca9('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13141b[_0xfca9('0x17')]?_0x13141b[_0xfca9('0x17')][_0xfca9('0x19')]||null:null,'attributes':_0x13141b['options']?_0x13141b['options'][_0xfca9('0x1a')]||null:null,'limit':_0x13141b[_0xfca9('0x17')]?_0x13141b[_0xfca9('0x17')][_0xfca9('0x1b')]||null:null})[_0xfca9('0xa')](function(_0x1af107){logger[_0xfca9('0xb')]('UpdateFaxApplication',_0x13141b);logger[_0xfca9('0x1c')](_0xfca9('0x14'),_0x13141b,JSON['stringify'](_0x1af107));_0x4a9958(_0x1af107);})[_0xfca9('0x13')](function(_0x4814f0){logger[_0xfca9('0x10')](_0xfca9('0x14'),_0x4814f0['message'],_0x13141b);_0x5e0f10(_0x571fd2[_0xfca9('0x10')](0x1f4,_0x4814f0['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 15f2a2c..bda0c6b 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 _0x0b2e=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','get','post','create','put','/:id','update','delete','exports','multer'];(function(_0x15cecf,_0x2404cd){var _0x3661a1=function(_0x234adb){while(--_0x234adb){_0x15cecf['push'](_0x15cecf['shift']());}};_0x3661a1(++_0x2404cd);}(_0x0b2e,0x1b4));var _0xe0b2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b2e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe0b2('0x0'));var util=require(_0xe0b2('0x1'));var path=require(_0xe0b2('0x2'));var timeout=require(_0xe0b2('0x3'));var express=require(_0xe0b2('0x4'));var router=express[_0xe0b2('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe0b2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe0b2('0x7'));var controller=require(_0xe0b2('0x8'));router['get']('/',auth[_0xe0b2('0x9')](),controller[_0xe0b2('0xa')]);router[_0xe0b2('0xb')]('/:id',auth[_0xe0b2('0x9')](),controller['show']);router[_0xe0b2('0xc')]('/',auth[_0xe0b2('0x9')](),controller[_0xe0b2('0xd')]);router[_0xe0b2('0xe')](_0xe0b2('0xf'),auth[_0xe0b2('0x9')](),controller[_0xe0b2('0x10')]);router[_0xe0b2('0x11')](_0xe0b2('0xf'),auth[_0xe0b2('0x9')](),controller['destroy']);module[_0xe0b2('0x12')]=router; \ No newline at end of file +var _0x931c=['fs-extra','../../components/auth/service','./faxApplication.controller','index','/:id','isAuthenticated','post','create','put','update','delete','destroy','multer','path','connect-timeout','Router'];(function(_0x52bbc9,_0xb342e0){var _0x5909d0=function(_0x24370d){while(--_0x24370d){_0x52bbc9['push'](_0x52bbc9['shift']());}};_0x5909d0(++_0xb342e0);}(_0x931c,0x1bc));var _0xc931=function(_0x1cb246,_0x5b3a30){_0x1cb246=_0x1cb246-0x0;var _0x492130=_0x931c[_0x1cb246];return _0x492130;};'use strict';var multer=require(_0xc931('0x0'));var util=require('util');var path=require(_0xc931('0x1'));var timeout=require(_0xc931('0x2'));var express=require('express');var router=express[_0xc931('0x3')]();var fs_extra=require(_0xc931('0x4'));var auth=require(_0xc931('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc931('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xc931('0x7')]);router['get'](_0xc931('0x8'),auth[_0xc931('0x9')](),controller['show']);router[_0xc931('0xa')]('/',auth[_0xc931('0x9')](),controller[_0xc931('0xb')]);router[_0xc931('0xc')](_0xc931('0x8'),auth[_0xc931('0x9')](),controller[_0xc931('0xd')]);router[_0xc931('0xe')](_0xc931('0x8'),auth[_0xc931('0x9')](),controller[_0xc931('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 6221390..1fd0e2d 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 _0xb2ff=['STRING','ENUM','out','sequelize','exports','DATE'];(function(_0x485bad,_0x21c418){var _0x523c91=function(_0x7393a4){while(--_0x7393a4){_0x485bad['push'](_0x485bad['shift']());}};_0x523c91(++_0x21c418);}(_0xb2ff,0x123));var _0xfb2f=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb2ff[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0xfb2f('0x0'));module[_0xfb2f('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfb2f('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xfb2f('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xfb2f('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xfb2f('0x4')]('in',_0xfb2f('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfb2f('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xf69d=['out','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x3bd86e,_0x49e4e0){var _0x1ef3c3=function(_0x4becf3){while(--_0x4becf3){_0x3bd86e['push'](_0x3bd86e['shift']());}};_0x1ef3c3(++_0x49e4e0);}(_0xf69d,0xd3));var _0xdf69=function(_0x25d921,_0x5398d2){_0x25d921=_0x25d921-0x0;var _0x106736=_0xf69d[_0x25d921];return _0x106736;};'use strict';var Sequelize=require(_0xdf69('0x0'));module[_0xdf69('0x1')]={'closed':{'type':Sequelize[_0xdf69('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xdf69('0x3')]},'disposition':{'type':Sequelize[_0xdf69('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xdf69('0x4')]},'note':{'type':Sequelize[_0xdf69('0x4')]},'read1stAt':{'type':Sequelize[_0xdf69('0x3')]},'fax':{'type':Sequelize[_0xdf69('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xdf69('0x5')]('in',_0xdf69('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xdf69('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xdf69('0x5')]('in',_0xdf69('0x6')),'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 6ab3548..a89b010 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 _0x3713=['attachments','format','transcript-%d-%s.zip','Attachment','Messages','mkdirSync','basename','pipe','createWriteStream','resolve','log','err','unlinkSync','sendStatus','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','end','json','count','limit','set','apply','reject','update','then','destroy','error','stack','send','map','fullname','TagIds','Tags','split','forEach','catch','index','rawAttributes','fieldName','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','select','field','from','tools_tags','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','users','fax_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','concat','createdAt','$gte','parse','$lte','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','FaxAccountId','sequelize','toString','keyBy','merge','FaxInteraction','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.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','FaxInteractionId','push','all','rows','show','keys','includeAll','include','options','create','body','params','describe','addMessage','ids','omit','getMessages','FaxMessage','nolimit','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','color','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp'];(function(_0x1d8167,_0x2927af){var _0xee0ee=function(_0x51df8f){while(--_0x51df8f){_0x1d8167['push'](_0x1d8167['shift']());}};_0xee0ee(++_0x2927af);}(_0x3713,0xe7));var _0x3371=function(_0x4fb810,_0x441071){_0x4fb810=_0x4fb810-0x0;var _0x5c646c=_0x3713[_0x4fb810];return _0x5c646c;};'use strict';var pdf=require(_0x3371('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3371('0x1'));var zipdir=require(_0x3371('0x2'));var jsonpatch=require(_0x3371('0x3'));var rp=require(_0x3371('0x4'));var moment=require('moment');var BPromise=require(_0x3371('0x5'));var Mustache=require(_0x3371('0x6'));var util=require('util');var path=require(_0x3371('0x7'));var sox=require(_0x3371('0x8'));var csv=require(_0x3371('0x9'));var ejs=require(_0x3371('0xa'));var fs=require('fs');var fs_extra=require(_0x3371('0xb'));var _=require(_0x3371('0xc'));var squel=require(_0x3371('0xd'));var crypto=require(_0x3371('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3371('0xf'));var toCsv=require(_0x3371('0x9'));var querystring=require(_0x3371('0x10'));var Papa=require(_0x3371('0x11'));var Redis=require(_0x3371('0x12'));var authService=require(_0x3371('0x13'));var qs=require(_0x3371('0x14'));var as=require(_0x3371('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3371('0x16'))(_0x3371('0x17'));var utils=require(_0x3371('0x18'));var config=require(_0x3371('0x19'));var licenseUtil=require(_0x3371('0x1a'));var db=require(_0x3371('0x1b'))['db'];config[_0x3371('0x1c')]=_[_0x3371('0x1d')](config[_0x3371('0x1c')],{'host':_0x3371('0x1e'),'port':0x18eb});var socket=require(_0x3371('0x1f'))(new Redis(config[_0x3371('0x1c')]));require('./faxInteraction.socket')['register'](socket);function respondWithStatusCode(_0x40a302,_0x2eee2c){_0x2eee2c=_0x2eee2c||0xcc;return function(_0x2d9452){if(_0x2d9452){return _0x40a302['sendStatus'](_0x2eee2c);}return _0x40a302[_0x3371('0x20')](_0x2eee2c)[_0x3371('0x21')]();};}function respondWithResult(_0x5c2896,_0x44e51f){_0x44e51f=_0x44e51f||0xc8;return function(_0x1b3ce7){if(_0x1b3ce7){return _0x5c2896[_0x3371('0x20')](_0x44e51f)[_0x3371('0x22')](_0x1b3ce7);}};}function respondWithFilteredResult(_0x101226,_0x710953){return function(_0x431551){if(_0x431551){var _0x3beda3=_0x431551[_0x3371('0x23')],_0x27d0c2=_0x710953['offset'],_0x128004=_0x710953['offset']+_0x710953[_0x3371('0x24')],_0x1ac30a;if(_0x128004>=_0x3beda3){_0x128004=_0x3beda3;_0x1ac30a=0xc8;}else{_0x1ac30a=0xce;}_0x101226['status'](_0x1ac30a);return _0x101226[_0x3371('0x25')]('Content-Range',_0x27d0c2+'-'+_0x128004+'/'+_0x3beda3)[_0x3371('0x22')](_0x431551);}return null;};}function patchUpdates(_0xbd468f){return function(_0x19811f){try{jsonpatch[_0x3371('0x26')](_0x19811f,_0xbd468f,!![]);}catch(_0x49ea22){return BPromise[_0x3371('0x27')](_0x49ea22);}return _0x19811f['save']();};}function saveUpdates(_0x5dfd65,_0x171827){return function(_0x11a247){if(_0x11a247){return _0x11a247[_0x3371('0x28')](_0x5dfd65)[_0x3371('0x29')](function(_0x2bed2f){return _0x2bed2f;});}return null;};}function removeEntity(_0x3ac3a2,_0x29e1ce){return function(_0x32abd5){if(_0x32abd5){return _0x32abd5[_0x3371('0x2a')]()[_0x3371('0x29')](function(){_0x3ac3a2[_0x3371('0x20')](0xcc)[_0x3371('0x21')]();});}};}function handleEntityNotFound(_0x44dff3,_0x5490db){return function(_0x45bc93){if(!_0x45bc93){_0x44dff3['sendStatus'](0x194);}return _0x45bc93;};}function handleError(_0x150706,_0x798b4e){_0x798b4e=_0x798b4e||0x1f4;return function(_0x3d5ee2){logger[_0x3371('0x2b')](_0x3d5ee2[_0x3371('0x2c')]);if(_0x3d5ee2['name']){delete _0x3d5ee2['name'];}_0x150706['status'](_0x798b4e)[_0x3371('0x2d')](_0x3d5ee2);};}function getInteractionUsers(_0x240e43,_0x200b8b){return new BPromise(function(_0x5440db,_0x370e87){try{if(_0x200b8b[_0x240e43['id']]){_0x240e43['Users']=_[_0x3371('0x2e')](_0x200b8b[_0x240e43['id']],function(_0x5a0905){return{'id':_0x5a0905['id'],'fullname':_0x5a0905[_0x3371('0x2f')]};});}}catch(_0x4fe616){_0x370e87(_0x4fe616);}_0x5440db(_0x240e43);});}function getInteractionTags(_0x4dbbd0,_0x5d700e){return new BPromise(function(_0x2c962f,_0x36e5c0){try{if(_0x4dbbd0[_0x3371('0x30')]){_0x4dbbd0[_0x3371('0x31')]=[];_0x4dbbd0[_0x3371('0x30')][_0x3371('0x32')](',')[_0x3371('0x33')](function(_0x393781){_0x4dbbd0[_0x3371('0x31')]['push'](_0x5d700e[_0x393781]);});}delete _0x4dbbd0[_0x3371('0x30')];}catch(_0x347c9d){_0x36e5c0(_0x347c9d);}_0x2c962f(_0x4dbbd0);});}function updateFaxInteraction(_0x3ebf4a,_0x2ffa7e,_0x3375c3){return new BPromise(function(_0x1641c5,_0xb8ae87){return getInteractionUsers(_0x3ebf4a,_0x3375c3)[_0x3371('0x29')](function(_0xddc4e5){return getInteractionTags(_0xddc4e5,_0x2ffa7e);})[_0x3371('0x29')](function(_0x464c91){_0x1641c5(_0x464c91);})[_0x3371('0x34')](function(_0x7b8590){_0xb8ae87(_0x7b8590);});});}exports[_0x3371('0x35')]=function(_0x33cdcf,_0x5b658b){var _0x50007a={},_0x12bade={},_0x2ce05b={'count':0x0,'rows':[]};var _0x288419=_[_0x3371('0x2e')](db['FaxInteraction'][_0x3371('0x36')],function(_0x87c2f0){return{'name':_0x87c2f0[_0x3371('0x37')],'type':_0x87c2f0['type'][_0x3371('0x38')]};});_0x12bade[_0x3371('0x39')]=_[_0x3371('0x2e')](_0x288419,_0x3371('0x3a'));_0x12bade['query']=_['keys'](_0x33cdcf[_0x3371('0x3b')]);_0x12bade[_0x3371('0x3c')]=_[_0x3371('0x3d')](_0x12bade[_0x3371('0x39')],_0x12bade[_0x3371('0x3b')]);_0x50007a[_0x3371('0x3e')]=_[_0x3371('0x3d')](_0x12bade['model'],qs[_0x3371('0x3f')](_0x33cdcf[_0x3371('0x3b')][_0x3371('0x3f')]));_0x50007a['attributes']=_0x50007a[_0x3371('0x3e')][_0x3371('0x40')]?_0x50007a['attributes']:_0x12bade[_0x3371('0x39')];if(!_0x33cdcf[_0x3371('0x3b')][_0x3371('0x41')]('nolimit')){_0x50007a['limit']=qs[_0x3371('0x24')](_0x33cdcf[_0x3371('0x3b')][_0x3371('0x24')]);_0x50007a[_0x3371('0x42')]=qs[_0x3371('0x42')](_0x33cdcf[_0x3371('0x3b')][_0x3371('0x42')]);}_0x50007a[_0x3371('0x43')]=qs[_0x3371('0x44')](_0x33cdcf[_0x3371('0x3b')][_0x3371('0x44')]);_0x50007a[_0x3371('0x45')]=qs[_0x3371('0x3c')](_[_0x3371('0x46')](_0x33cdcf['query'],_0x12bade['filters']),_0x288419);var _0x3b7ace=[];var _0x1c9898=squel[_0x3371('0x47')]()['field']('id')[_0x3371('0x48')](_0x3371('0x3a'))[_0x3371('0x48')]('color')[_0x3371('0x49')](_0x3371('0x4a'));var _0x53969f=squel[_0x3371('0x47')]()[_0x3371('0x48')]('u.id')[_0x3371('0x48')](_0x3371('0x4b'))[_0x3371('0x48')](_0x3371('0x4c'))['from'](_0x3371('0x4d'),'ui')['left_join'](_0x3371('0x4e'),'u','u.id\x20=\x20ui.UserId');var _0x515735=squel[_0x3371('0x47')]()[_0x3371('0x49')](_0x3371('0x4f'),'i')[_0x3371('0x50')](_0x3371('0x51'),'c',_0x3371('0x52'))[_0x3371('0x50')](_0x3371('0x4e'),'o',_0x3371('0x53'))[_0x3371('0x50')](_0x3371('0x54'),'a',_0x3371('0x55'))['left_join'](_0x3371('0x56'),'me',_0x3371('0x57'))[_0x3371('0x50')]('fax_interaction_has_tags','it',_0x3371('0x58'))[_0x3371('0x50')](_0x3371('0x4a'),'t',_0x3371('0x59'));var _0x386581=squel[_0x3371('0x5a')]();var _0x219994=[];var _0x5c3aed=squel[_0x3371('0x5a')]();var _0x3a3928;if(_0x33cdcf[_0x3371('0x3b')][_0x3371('0x5b')]){_0x3a3928=as[_0x3371('0x5c')](_0x33cdcf[_0x3371('0x3b')][_0x3371('0x5b')]);var _0x3e522c=_0x3a3928[_0x3371('0x5d')];for(var _0x5b0854=0x0;_0x5b0854<_0x3a3928[_0x3371('0x5e')][_0x3371('0x40')];_0x5b0854++){var _0x470dad=_0x3a3928[_0x3371('0x5e')][_0x5b0854];var _0x4158b6='i';var _0xc6e5=_[_0x3371('0x5f')](_0x288419,[_0x3371('0x3a'),_0x470dad[_0x3371('0x48')]]);if(!_0xc6e5){switch(_0x470dad['field']){case _0x3371('0x60'):if(_0x470dad[_0x3371('0x61')]==0x1){_0x515735[_0x3371('0x62')]('`'+_0x470dad[_0x3371('0x48')]+'`\x20=\x200');}else{_0x515735[_0x3371('0x62')]('`'+_0x470dad[_0x3371('0x48')]+_0x3371('0x63'));}break;case _0x3371('0x64'):if(_0x470dad[_0x3371('0x65')]===_0x3371('0x66')){if(_0x470dad['value'][_0x3371('0x32')]('\x20')[_0x3371('0x40')]>0x1){_0x386581[_0x3e522c](_0x3371('0x67'),qs[_0x3371('0x68')](_0x470dad[_0x3371('0x61')]),null);}else{var _0x40f660='%'+_0x470dad[_0x3371('0x61')]+'%';_0x386581[_0x3e522c]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x40f660,_0x40f660,_0x40f660);}}else{_0xc6e5=_['find'](_0x288419,[_0x3371('0x3a'),_0x3371('0x69')]);_0x470dad[_0x3371('0x48')]='ContactId';_0x41f1cf=as[_0x3371('0x6a')](_0x4158b6,_0xc6e5['type'],_0x470dad);_0x386581[_0x3e522c](_0x41f1cf[_0x3371('0x6b')],_0x41f1cf[_0x3371('0x61')][_0x3371('0x6c')],_0x41f1cf['value']['end']);}break;case _0x3371('0x6d'):var _0x10aeeb=_0x470dad[_0x3371('0x61')]['split'](',')[_0x3371('0x2e')](function(_0x599b75){return Number(_0x599b75);});_0x10aeeb[_0x3371('0x33')](function(_0x59113f){_0x5c3aed['or'](_0x3371('0x6e'),'%,'+_0x59113f+',%');});_0x219994=_[_0x3371('0x6f')](_0x219994,_0x10aeeb);break;case _0x3371('0x70'):if(_0x470dad[_0x3371('0x65')]==='$substring'){_0x386581[_0x3e522c](_0x3371('0x71'),'%'+_0x470dad[_0x3371('0x61')]+'%',null);}else{_0xc6e5=_[_0x3371('0x5f')](_0x288419,[_0x3371('0x3a'),'UserId']);_0x470dad[_0x3371('0x48')]=_0x3371('0x72');_0x41f1cf=as[_0x3371('0x6a')](_0x4158b6,_0xc6e5['type'],_0x470dad);_0x386581[_0x3e522c](_0x41f1cf[_0x3371('0x6b')],_0x41f1cf[_0x3371('0x61')][_0x3371('0x6c')],_0x41f1cf[_0x3371('0x61')][_0x3371('0x21')]);}break;case'body':_0x41f1cf=as[_0x3371('0x6a')]('me',null,_0x470dad);_0x386581[_0x3e522c](_0x41f1cf[_0x3371('0x6b')],_0x41f1cf['value']['start'],_0x41f1cf[_0x3371('0x61')][_0x3371('0x21')]);break;}}else{var _0x41f1cf=as[_0x3371('0x6a')](_0x4158b6,_0xc6e5['type'],_0x470dad);_0x386581[_0x3e522c](_0x41f1cf[_0x3371('0x6b')],_0x41f1cf[_0x3371('0x61')][_0x3371('0x6c')],_0x41f1cf[_0x3371('0x61')][_0x3371('0x21')]);}}}else{var _0x3abe53=_(_0x33cdcf['query'])['keys']()[_0x3371('0x2e')](function(_0x2ad6fa){return _[_0x3371('0x73')](_0x288419,[_0x3371('0x3a'),_0x2ad6fa])?_0x2ad6fa:undefined;})[_0x3371('0x74')]()[_0x3371('0x61')]();if(!_[_0x3371('0x75')](_0x3abe53)){_0x3abe53['forEach'](function(_0x387a38){if(_0x387a38==='FaxAccountId'){_0x515735['where']('i.FaxAccountId\x20IN\x20?',[][_0x3371('0x76')](_0x33cdcf[_0x3371('0x3b')][_0x387a38]));}else if(_0x387a38===_0x3371('0x77')){var _0x3150fa=JSON['parse'](_0x33cdcf[_0x3371('0x3b')][_0x387a38])[_0x3371('0x78')];var _0x15e82f=JSON[_0x3371('0x79')](_0x33cdcf['query'][_0x387a38])[_0x3371('0x7a')];_0x515735[_0x3371('0x45')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3150fa,_0x15e82f);}else{if(_0x33cdcf['query'][_0x387a38]==='null'){_0x515735[_0x3371('0x45')]('i.'+_0x387a38+_0x3371('0x7b'));}else{_0x515735['where']('i.'+_0x387a38+_0x3371('0x7c'),_0x33cdcf[_0x3371('0x3b')][_0x387a38]);}}});}if(_0x33cdcf[_0x3371('0x3b')]['read']){if(_0x33cdcf['query']['read']==0x1){_0x515735[_0x3371('0x62')]('`unreadMessages`\x20=\x200');}else{_0x515735[_0x3371('0x62')](_0x3371('0x7d'));}}if(_0x33cdcf[_0x3371('0x3b')]['tag']){_0x219994=_[_0x3371('0x7e')](_0x33cdcf[_0x3371('0x3b')]['tag'])?_0x33cdcf[_0x3371('0x3b')][_0x3371('0x7f')]:new Array(_0x33cdcf['query']['tag']);_0x219994[_0x3371('0x33')](function(_0x129b0b){_0x5c3aed['or'](_0x3371('0x6e'),'%,'+_0x129b0b+',%');});}if(_0x33cdcf['query']['filter']){var _0x16dd8e=_0x33cdcf['query'][_0x3371('0x80')][_0x3371('0x81')]('\x5c','\x5c\x5c')[_0x3371('0x81')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x16dd8e)){_0x386581['or'](_0x3371('0x82'),_0x16dd8e+'%')['or'](_0x3371('0x83'),_0x16dd8e+'%');}_0x386581['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x16dd8e+'%');}}_0x515735[_0x3371('0x45')](_0x386581);_0x515735[_0x3371('0x84')](_0x3371('0x85'));var _0x5cb58a={'type':db[_0x3371('0x86')][_0x3371('0x87')][_0x3371('0x88')],'raw':!![]};var _0x4053ca=_0x515735['clone']();_0x4053ca[_0x3371('0x48')](_0x3371('0x85'));_0x4053ca[_0x3371('0x48')](_0x3371('0x89'),'unreadMessages');if(_0x50007a[_0x3371('0x43')]){_0x50007a[_0x3371('0x43')][_0x3371('0x33')](function(_0x5a3b1b){var _0xe631a8=_0x5a3b1b[0x0]===_0x3371('0x8a')?_0x5a3b1b[0x0]:'i.'+_0x5a3b1b[0x0];_0x515735['order'](_0xe631a8,_0x5a3b1b[0x1]===_0x3371('0x8b')?![]:!![]);});}if(!_['isEmpty'](_0x219994)){_0x515735['having'](_0x5c3aed);_0x4053ca[_0x3371('0x45')]('t.id\x20IN\x20?',_0x219994);}BPromise['resolve']()[_0x3371('0x29')](function(){if(!_0x3a3928){if(_0x33cdcf['query']['FaxAccountId'])return;_0x4053ca['where'](_0x3371('0x8c'));_0x515735[_0x3371('0x45')](_0x3371('0x8c'));return;}if(_0x33cdcf[_0x3371('0x8d')][_0x3371('0x8e')]!==_0x3371('0x8f'))return;return _0x33cdcf['user']['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x3371('0x29')](function(_0x1c71b8){if(_['isEmpty'](_0x1c71b8)){_0x4053ca['where'](_0x3371('0x90'));_0x515735[_0x3371('0x45')](_0x3371('0x90'));}else{_0x4053ca['where'](_0x3371('0x91'),_['map'](_0x1c71b8,'id'));_0x515735[_0x3371('0x45')]('i.FaxAccountId\x20IN\x20?',_[_0x3371('0x2e')](_0x1c71b8,'id'));}});})[_0x3371('0x29')](function(){if(_0x33cdcf[_0x3371('0x8d')][_0x3371('0x8e')]===_0x3371('0x8f')&&!_0x3a3928&&!_0x33cdcf[_0x3371('0x3b')][_0x3371('0x92')])return[];return db[_0x3371('0x93')][_0x3371('0x3b')](_0x4053ca[_0x3371('0x94')](),_0x5cb58a);})[_0x3371('0x29')](function(_0x4c406b){_0x2ce05b[_0x3371('0x23')]=_0x4c406b[_0x3371('0x40')];if(_0x2ce05b['count']===0x0)return[];return db[_0x3371('0x93')][_0x3371('0x3b')](_0x1c9898[_0x3371('0x94')](),_0x5cb58a)[_0x3371('0x29')](function(_0x11b664){_0x3b7ace=_[_0x3371('0x95')](_0x11b664,'id');_0x5cb58a=_[_0x3371('0x96')](_0x5cb58a,{'model':db[_0x3371('0x97')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x33cdcf[_0x3371('0x3b')]['fields']){_0x50007a[_0x3371('0x3e')]['forEach'](function(_0x597a32){_0x515735['field']('i.'+_0x597a32);});}else{_0x515735[_0x3371('0x48')](_0x3371('0x89'),_0x3371('0x60'));_0x515735[_0x3371('0x48')](_0x3371('0x98'),'Account.key');_0x515735[_0x3371('0x48')](_0x3371('0x99'),_0x3371('0x9a'));_0x515735[_0x3371('0x48')](_0x3371('0x9b'),_0x3371('0x8a'));_0x515735['field'](_0x3371('0x9c'));_0x515735[_0x3371('0x48')](_0x3371('0x9d'),_0x3371('0x9e'));_0x515735[_0x3371('0x48')](_0x3371('0x9f'),_0x3371('0xa0'));_0x515735['field'](_0x3371('0xa1'),_0x3371('0xa2'));_0x515735[_0x3371('0x48')](_0x3371('0xa3'),_0x3371('0xa4'));_0x515735['field']('c.mobile','Contact.mobile');_0x515735[_0x3371('0x48')](_0x3371('0xa5'),'Contact.fax');_0x515735[_0x3371('0x48')]('o.fullname',_0x3371('0xa6'));_0x515735[_0x3371('0x48')]('o.internal',_0x3371('0xa7'));_0x515735[_0x3371('0x48')](_0x3371('0xa8'),'TagIds');}if(_0x50007a[_0x3371('0x24')])_0x515735[_0x3371('0x24')](_0x50007a[_0x3371('0x24')]);if(_0x50007a['offset'])_0x515735[_0x3371('0x42')](_0x50007a[_0x3371('0x42')]);return db[_0x3371('0x93')][_0x3371('0x3b')](_0x515735[_0x3371('0x94')](),_0x5cb58a);})[_0x3371('0x29')](function(_0x525a2f){_0x53969f[_0x3371('0x45')]('ui.FaxInteractionId\x20IN\x20?',_['map'](_0x525a2f,'id'));return db[_0x3371('0x93')]['query'](_0x53969f['toString'](),_0x5cb58a)[_0x3371('0x29')](function(_0x3dd9dc){var _0x247c07=_[_0x3371('0xa9')](_0x3dd9dc,_0x3371('0xaa'));var _0x1a573f=[];_0x525a2f[_0x3371('0x33')](function(_0x5112cb){_0x1a573f[_0x3371('0xab')](updateFaxInteraction(_0x5112cb,_0x3b7ace,_0x247c07));});return BPromise[_0x3371('0xac')](_0x1a573f);});});})[_0x3371('0x29')](function(_0x540fdc){_0x2ce05b[_0x3371('0xad')]=_0x540fdc;return _0x2ce05b;})[_0x3371('0x29')](respondWithFilteredResult(_0x5b658b,_0x50007a))[_0x3371('0x34')](handleError(_0x5b658b,null));};exports[_0x3371('0xae')]=function(_0xee3dc0,_0x4becaf){var _0x584776={'raw':![],'where':{'id':_0xee3dc0['params']['id']}},_0x4c282f={};_0x4c282f['model']=_[_0x3371('0xaf')](db[_0x3371('0x97')][_0x3371('0x36')]);_0x4c282f['query']=_[_0x3371('0xaf')](_0xee3dc0[_0x3371('0x3b')]);_0x4c282f[_0x3371('0x3c')]=_[_0x3371('0x3d')](_0x4c282f[_0x3371('0x39')],_0x4c282f[_0x3371('0x3b')]);_0x584776[_0x3371('0x3e')]=_['intersection'](_0x4c282f[_0x3371('0x39')],qs[_0x3371('0x3f')](_0xee3dc0['query']['fields']));_0x584776[_0x3371('0x3e')]=_0x584776[_0x3371('0x3e')][_0x3371('0x40')]?_0x584776[_0x3371('0x3e')]:_0x4c282f['model'];if(_0xee3dc0[_0x3371('0x3b')][_0x3371('0xb0')]){_0x584776[_0x3371('0xb1')]=[{'all':!![]}];}_0x584776=_[_0x3371('0x96')]({},_0x584776,_0xee3dc0[_0x3371('0xb2')]);return db[_0x3371('0x97')][_0x3371('0x5f')](_0x584776)[_0x3371('0x29')](handleEntityNotFound(_0x4becaf,null))[_0x3371('0x29')](respondWithResult(_0x4becaf,null))[_0x3371('0x34')](handleError(_0x4becaf,null));};exports[_0x3371('0xb3')]=function(_0x36aa36,_0x78b6ad){return db[_0x3371('0x97')][_0x3371('0xb3')](_0x36aa36[_0x3371('0xb4')],{})['then'](respondWithResult(_0x78b6ad,0xc9))[_0x3371('0x34')](handleError(_0x78b6ad,null));};exports[_0x3371('0x28')]=function(_0x53e72a,_0x2b571b){if(_0x53e72a['body']['id']){delete _0x53e72a['body']['id'];}return db[_0x3371('0x97')][_0x3371('0x5f')]({'where':{'id':_0x53e72a[_0x3371('0xb5')]['id']}})[_0x3371('0x29')](handleEntityNotFound(_0x2b571b,null))[_0x3371('0x29')](saveUpdates(_0x53e72a[_0x3371('0xb4')],null))[_0x3371('0x29')](respondWithResult(_0x2b571b,null))[_0x3371('0x34')](handleError(_0x2b571b,null));};exports['destroy']=function(_0x3a3dbf,_0x598165){return db[_0x3371('0x97')][_0x3371('0x5f')]({'where':{'id':_0x3a3dbf[_0x3371('0xb5')]['id']}})[_0x3371('0x29')](handleEntityNotFound(_0x598165,null))[_0x3371('0x29')](removeEntity(_0x598165,null))[_0x3371('0x34')](handleError(_0x598165,null));};exports[_0x3371('0xb6')]=function(_0x5b8adf,_0x240d1f){return db[_0x3371('0x97')][_0x3371('0xb6')]()[_0x3371('0x29')](respondWithResult(_0x240d1f,null))[_0x3371('0x34')](handleError(_0x240d1f,null));};exports['addMessage']=function(_0x211ff8,_0xb1bc01,_0x409fba){return db['FaxMessage'][_0x3371('0x5f')]({'where':{'id':_0x211ff8[_0x3371('0xb5')]['id']}})['then'](handleEntityNotFound(_0xb1bc01,null))[_0x3371('0x29')](function(_0x57ff6f){if(_0x57ff6f){return _0x57ff6f[_0x3371('0xb7')](_0x211ff8[_0x3371('0xb4')][_0x3371('0xb8')],_[_0x3371('0xb9')](_0x211ff8[_0x3371('0xb4')],[_0x3371('0xb8'),'id'])||{});}})[_0x3371('0x29')](respondWithResult(_0xb1bc01,null))['catch'](handleError(_0xb1bc01,null));};exports[_0x3371('0xba')]=function(_0x434341,_0x19d891,_0x31fd1e){var _0x4e1e8a={'raw':![],'where':{}};var _0x50c67a={};var _0x48619f={'count':0x0,'rows':[]};return db[_0x3371('0x97')]['findOne']({'where':{'id':_0x434341[_0x3371('0xb5')]['id']}})['then'](handleEntityNotFound(_0x19d891,null))[_0x3371('0x29')](function(_0x2c1fa5){if(_0x2c1fa5){_0x50c67a[_0x3371('0x39')]=_[_0x3371('0xaf')](db[_0x3371('0xbb')]['rawAttributes']);_0x50c67a[_0x3371('0x3b')]=_[_0x3371('0xaf')](_0x434341['query']);_0x50c67a[_0x3371('0x3c')]=_[_0x3371('0x3d')](_0x50c67a['model'],_0x50c67a[_0x3371('0x3b')]);_0x4e1e8a['attributes']=_[_0x3371('0x3d')](_0x50c67a[_0x3371('0x39')],qs[_0x3371('0x3f')](_0x434341[_0x3371('0x3b')]['fields']));_0x4e1e8a['attributes']=_0x4e1e8a[_0x3371('0x3e')]['length']?_0x4e1e8a[_0x3371('0x3e')]:_0x50c67a[_0x3371('0x39')];if(!_0x434341[_0x3371('0x3b')]['hasOwnProperty'](_0x3371('0xbc'))){_0x4e1e8a['limit']=qs['limit'](_0x434341[_0x3371('0x3b')][_0x3371('0x24')]);_0x4e1e8a[_0x3371('0x42')]=qs[_0x3371('0x42')](_0x434341[_0x3371('0x3b')]['offset']);}_0x4e1e8a[_0x3371('0x43')]=qs[_0x3371('0x44')](_0x434341['query'][_0x3371('0x44')]);_0x4e1e8a[_0x3371('0x45')]=qs[_0x3371('0x3c')](_['pick'](_0x434341[_0x3371('0x3b')],_0x50c67a[_0x3371('0x3c')]));_0x4e1e8a[_0x3371('0x45')][_0x3371('0xaa')]=_0x2c1fa5['id'];if(_0x434341['query']['filter']){_0x4e1e8a[_0x3371('0x45')]=_[_0x3371('0x96')](_0x4e1e8a[_0x3371('0x45')],{'$or':_[_0x3371('0x2e')](_0x4e1e8a['attributes'],function(_0x514932){var _0x3f2a13={};_0x3f2a13[_0x514932]={'$like':'%'+_0x434341[_0x3371('0x3b')][_0x3371('0x80')]+'%'};return _0x3f2a13;})});}if(_0x434341[_0x3371('0x3b')][_0x3371('0x78')]){var _0x10b32a=_0x434341[_0x3371('0x3b')][_0x3371('0x78')][_0x3371('0x32')](',');var _0xd1eee0={};_0xd1eee0[_0x10b32a[0x0]]={'$gte':moment(_0x10b32a[0x1])['format'](_0x3371('0xbd'))};_0x4e1e8a[_0x3371('0x45')]=_[_0x3371('0x96')](_0x4e1e8a['where'],_0xd1eee0);}_0x4e1e8a=_[_0x3371('0x96')]({},_0x4e1e8a,_0x434341[_0x3371('0xb2')]);return db['FaxMessage'][_0x3371('0x23')]({'where':_0x4e1e8a[_0x3371('0x45')]})['then'](function(_0x230e8e){_0x48619f[_0x3371('0x23')]=_0x230e8e;if(_0x434341[_0x3371('0x3b')]['includeAll']){_0x4e1e8a[_0x3371('0xb1')]=[{'all':!![]}];}return db['FaxMessage'][_0x3371('0xbe')](_0x4e1e8a);})[_0x3371('0x29')](function(_0x28715d){_0x48619f[_0x3371('0xad')]=_0x28715d;return _0x48619f;});}})[_0x3371('0x29')](respondWithFilteredResult(_0x19d891,_0x4e1e8a))[_0x3371('0x34')](handleError(_0x19d891,null));};exports[_0x3371('0xbf')]=function(_0x2ab6b8,_0xab9b0e,_0x95aad2){return db['FaxInteraction'][_0x3371('0x5f')]({'where':{'id':_0x2ab6b8[_0x3371('0xb5')]['id']}})[_0x3371('0x29')](handleEntityNotFound(_0xab9b0e,null))[_0x3371('0x29')](function(_0x294a8a){if(_0x294a8a){return _0x294a8a[_0x3371('0xc0')](_0x2ab6b8[_0x3371('0xb4')][_0x3371('0xb8')],_[_0x3371('0xb9')](_0x2ab6b8[_0x3371('0xb4')],[_0x3371('0xb8'),'id'])||{})['spread'](function(){return db[_0x3371('0x6d')][_0x3371('0xbe')]({'attributes':['id',_0x3371('0x3a'),_0x3371('0xc1')],'where':{'id':_0x2ab6b8[_0x3371('0xb4')][_0x3371('0xb8')]}});})[_0x3371('0x29')](function(_0x28b55c){socket['emit'](_0x3371('0xc2'),{'id':Number(_0x2ab6b8[_0x3371('0xb5')]['id']),'tags':_0x28b55c||[]});return{'id':Number(_0x2ab6b8[_0x3371('0xb5')]['id']),'tags':_0x28b55c||[]};});}})[_0x3371('0x29')](respondWithResult(_0xab9b0e,null))[_0x3371('0x34')](handleError(_0xab9b0e,null));};exports[_0x3371('0xc3')]=function(_0x224909,_0x308739,_0x5a6727){return db[_0x3371('0x97')][_0x3371('0x5f')]({'where':{'id':_0x224909[_0x3371('0xb5')]['id']}})[_0x3371('0x29')](handleEntityNotFound(_0x308739,null))[_0x3371('0x29')](function(_0x19ee9d){if(_0x19ee9d){return _0x19ee9d[_0x3371('0xc3')](_0x224909['query'][_0x3371('0xb8')]);}})[_0x3371('0x29')](respondWithStatusCode(_0x308739,null))[_0x3371('0x34')](handleError(_0x308739,null));};exports[_0x3371('0xc4')]=function(_0x1329c6,_0x1da367){var _0x358077=moment()[_0x3371('0xc5')]()['toString']();var _0xf5b6f8=path[_0x3371('0xc6')](config[_0x3371('0xc7')],_0x3371('0xc8'),_0x3371('0xc9'),_0x3371('0xca'));var _0x1917ce=path[_0x3371('0xc6')](config[_0x3371('0xc7')],_0x3371('0xc8'),_0x3371('0xc9'),_0x3371('0xcb'));var _0x375277=path[_0x3371('0xc6')](_0xf5b6f8,_0x358077);var _0x22c345=util[_0x3371('0xcc')](_0x3371('0xcd'),_0x1329c6[_0x3371('0xb5')]['id'],_0x358077);var _0x39172d=path['join'](_0xf5b6f8,_0x22c345);var _0x9539d3=[];_0x9539d3[_0x3371('0xab')]({'model':db['Attachment'],'as':_0x3371('0xce'),'raw':!![]});var _0x4ef77d=[{'model':db[_0x3371('0xbb')],'as':_0x3371('0xcf'),'attributes':['id',_0x3371('0xb4'),_0x3371('0x77')],'include':_0x9539d3}];return db[_0x3371('0x97')]['find']({'where':{'id':_0x1329c6[_0x3371('0xb5')]['id']},'include':_0x4ef77d})[_0x3371('0x29')](handleEntityNotFound(_0x1da367,null))[_0x3371('0x29')](function(_0x23449e){if(_0x23449e&&_0x23449e[_0x3371('0xcf')]){var _0x268ae0=_0x23449e['get']({'plain':!![]});fs[_0x3371('0xd0')](_0x375277);for(var _0x54ca36=0x0;_0x54ca36<_0x268ae0[_0x3371('0xcf')]['length'];_0x54ca36++){var _0x428360=_0x268ae0[_0x3371('0xcf')][_0x54ca36][_0x3371('0xce')];if(_0x428360){var _0x1719e4=path['join'](_0x1917ce,_0x428360[_0x3371('0xd1')]);if(fs['existsSync'](_0x1719e4)){fs['createReadStream'](_0x1719e4)[_0x3371('0xd2')](fs[_0x3371('0xd3')](path[_0x3371('0xc6')](_0x375277,_0x428360[_0x3371('0xd1')])));}}}return BPromise[_0x3371('0xd4')]()[_0x3371('0x29')](function(){return new BPromise(function(_0x247edf,_0x458745){zipdir(_0x375277,{'saveTo':_0x39172d},function(_0x670a5e,_0x3d0ed4){if(_0x670a5e)return _0x458745(_0x670a5e);return _0x247edf(_0x3d0ed4);});})[_0x3371('0x29')](function(){return new BPromise(function(_0x27820d,_0x44621b){rimraf(_0x375277,function(_0x316cc6){if(_0x316cc6)_0x44621b(_0x316cc6);return _0x27820d();});});})[_0x3371('0x29')](function(){return _0x1da367[_0x3371('0xc4')](_0x39172d,_0x22c345,function(_0x56c131){if(_0x56c131){console[_0x3371('0xd5')](_0x3371('0xd6'),_0x56c131);}else{fs[_0x3371('0xd7')](_0x39172d);}});});});}else{return _0x1da367[_0x3371('0xd8')](0xc8);}})['catch'](handleError(_0x1da367,null));}; \ No newline at end of file +var _0x8185=['send','fullname','TagIds','Tags','split','forEach','push','catch','map','FaxInteraction','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','select','tools_tags','u.id','field','ui.FaxInteractionId','from','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','fax_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','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','buildExpression','type','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','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)','order','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','unreadMessages','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','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','rows','options','create','params','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','findAll','addTags','spread','color','emit','faxInteractionTags:save','removeTags','download','unix','server','files','tmp','join','root','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','createReadStream','log','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','socket.io-emitter','./faxInteraction.socket','register','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','stack','name'];(function(_0x1867d9,_0x5605a9){var _0x18fcd3=function(_0x4e8cba){while(--_0x4e8cba){_0x1867d9['push'](_0x1867d9['shift']());}};_0x18fcd3(++_0x5605a9);}(_0x8185,0x188));var _0x5818=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x8185[_0x4b055c];return _0x4b62bb;};'use strict';var pdf=require(_0x5818('0x0'));var emlformat=require(_0x5818('0x1'));var rimraf=require(_0x5818('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5818('0x3'));var rp=require(_0x5818('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5818('0x5'));var util=require(_0x5818('0x6'));var path=require('path');var sox=require(_0x5818('0x7'));var csv=require(_0x5818('0x8'));var ejs=require(_0x5818('0x9'));var fs=require('fs');var fs_extra=require(_0x5818('0xa'));var _=require(_0x5818('0xb'));var squel=require(_0x5818('0xc'));var crypto=require(_0x5818('0xd'));var jsforce=require(_0x5818('0xe'));var deskjs=require(_0x5818('0xf'));var toCsv=require(_0x5818('0x8'));var querystring=require(_0x5818('0x10'));var Papa=require(_0x5818('0x11'));var Redis=require(_0x5818('0x12'));var authService=require(_0x5818('0x13'));var qs=require(_0x5818('0x14'));var as=require(_0x5818('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5818('0x16'))(_0x5818('0x17'));var utils=require('../../config/utils');var config=require(_0x5818('0x18'));var licenseUtil=require(_0x5818('0x19'));var db=require('../../mysqldb')['db'];config[_0x5818('0x1a')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5818('0x1b'))(new Redis(config['redis']));require(_0x5818('0x1c'))[_0x5818('0x1d')](socket);function respondWithStatusCode(_0x3562a0,_0x3f5b25){_0x3f5b25=_0x3f5b25||0xcc;return function(_0x47f349){if(_0x47f349){return _0x3562a0['sendStatus'](_0x3f5b25);}return _0x3562a0['status'](_0x3f5b25)['end']();};}function respondWithResult(_0x382135,_0x30f623){_0x30f623=_0x30f623||0xc8;return function(_0x2b4f83){if(_0x2b4f83){return _0x382135[_0x5818('0x1e')](_0x30f623)[_0x5818('0x1f')](_0x2b4f83);}};}function respondWithFilteredResult(_0x30c7cf,_0x2e013b){return function(_0x484a45){if(_0x484a45){var _0x125ac5=_0x484a45[_0x5818('0x20')],_0xdfd964=_0x2e013b[_0x5818('0x21')],_0x4b48da=_0x2e013b[_0x5818('0x21')]+_0x2e013b['limit'],_0x1c40bc;if(_0x4b48da>=_0x125ac5){_0x4b48da=_0x125ac5;_0x1c40bc=0xc8;}else{_0x1c40bc=0xce;}_0x30c7cf[_0x5818('0x1e')](_0x1c40bc);return _0x30c7cf[_0x5818('0x22')](_0x5818('0x23'),_0xdfd964+'-'+_0x4b48da+'/'+_0x125ac5)['json'](_0x484a45);}return null;};}function patchUpdates(_0x48a48d){return function(_0x5d31cf){try{jsonpatch[_0x5818('0x24')](_0x5d31cf,_0x48a48d,!![]);}catch(_0x335800){return BPromise[_0x5818('0x25')](_0x335800);}return _0x5d31cf[_0x5818('0x26')]();};}function saveUpdates(_0x3d39df,_0x3107f9){return function(_0x357400){if(_0x357400){return _0x357400[_0x5818('0x27')](_0x3d39df)['then'](function(_0x491b79){return _0x491b79;});}return null;};}function removeEntity(_0x2c6199,_0x258b50){return function(_0x58c937){if(_0x58c937){return _0x58c937[_0x5818('0x28')]()[_0x5818('0x29')](function(){_0x2c6199[_0x5818('0x1e')](0xcc)[_0x5818('0x2a')]();});}};}function handleEntityNotFound(_0x54c395,_0x19a91d){return function(_0x2b39e2){if(!_0x2b39e2){_0x54c395[_0x5818('0x2b')](0x194);}return _0x2b39e2;};}function handleError(_0x4e876b,_0x1c57e9){_0x1c57e9=_0x1c57e9||0x1f4;return function(_0x12b1bc){logger['error'](_0x12b1bc[_0x5818('0x2c')]);if(_0x12b1bc['name']){delete _0x12b1bc[_0x5818('0x2d')];}_0x4e876b[_0x5818('0x1e')](_0x1c57e9)[_0x5818('0x2e')](_0x12b1bc);};}function getInteractionUsers(_0x58746f,_0x2dcbd6){return new BPromise(function(_0x5e2e59,_0x37131d){try{if(_0x2dcbd6[_0x58746f['id']]){_0x58746f['Users']=_['map'](_0x2dcbd6[_0x58746f['id']],function(_0x424593){return{'id':_0x424593['id'],'fullname':_0x424593[_0x5818('0x2f')]};});}}catch(_0x3ef78c){_0x37131d(_0x3ef78c);}_0x5e2e59(_0x58746f);});}function getInteractionTags(_0x422bfe,_0x2cc28b){return new BPromise(function(_0x31cacd,_0x801dd0){try{if(_0x422bfe[_0x5818('0x30')]){_0x422bfe[_0x5818('0x31')]=[];_0x422bfe[_0x5818('0x30')][_0x5818('0x32')](',')[_0x5818('0x33')](function(_0x2d2d02){_0x422bfe[_0x5818('0x31')][_0x5818('0x34')](_0x2cc28b[_0x2d2d02]);});}delete _0x422bfe[_0x5818('0x30')];}catch(_0x34ecd3){_0x801dd0(_0x34ecd3);}_0x31cacd(_0x422bfe);});}function updateFaxInteraction(_0x5780a4,_0x3ec8ad,_0x21b143){return new BPromise(function(_0x275818,_0xc58643){return getInteractionUsers(_0x5780a4,_0x21b143)[_0x5818('0x29')](function(_0x583809){return getInteractionTags(_0x583809,_0x3ec8ad);})[_0x5818('0x29')](function(_0x25552f){_0x275818(_0x25552f);})[_0x5818('0x35')](function(_0xe2e2b4){_0xc58643(_0xe2e2b4);});});}exports['index']=function(_0x3faca0,_0x436c34){var _0x9eaf20={},_0x57b66d={},_0x581087={'count':0x0,'rows':[]};var _0x54f522=_[_0x5818('0x36')](db[_0x5818('0x37')][_0x5818('0x38')],function(_0x302dae){return{'name':_0x302dae['fieldName'],'type':_0x302dae['type'][_0x5818('0x39')]};});_0x57b66d[_0x5818('0x3a')]=_[_0x5818('0x36')](_0x54f522,_0x5818('0x2d'));_0x57b66d[_0x5818('0x3b')]=_[_0x5818('0x3c')](_0x3faca0[_0x5818('0x3b')]);_0x57b66d[_0x5818('0x3d')]=_[_0x5818('0x3e')](_0x57b66d['model'],_0x57b66d[_0x5818('0x3b')]);_0x9eaf20[_0x5818('0x3f')]=_['intersection'](_0x57b66d[_0x5818('0x3a')],qs['fields'](_0x3faca0[_0x5818('0x3b')][_0x5818('0x40')]));_0x9eaf20['attributes']=_0x9eaf20[_0x5818('0x3f')][_0x5818('0x41')]?_0x9eaf20[_0x5818('0x3f')]:_0x57b66d[_0x5818('0x3a')];if(!_0x3faca0[_0x5818('0x3b')][_0x5818('0x42')](_0x5818('0x43'))){_0x9eaf20[_0x5818('0x44')]=qs[_0x5818('0x44')](_0x3faca0[_0x5818('0x3b')][_0x5818('0x44')]);_0x9eaf20[_0x5818('0x21')]=qs[_0x5818('0x21')](_0x3faca0[_0x5818('0x3b')]['offset']);}_0x9eaf20['order']=qs['sort'](_0x3faca0[_0x5818('0x3b')][_0x5818('0x45')]);_0x9eaf20[_0x5818('0x46')]=qs[_0x5818('0x3d')](_[_0x5818('0x47')](_0x3faca0[_0x5818('0x3b')],_0x57b66d['filters']),_0x54f522);var _0x3064fe=[];var _0x59dd75=squel[_0x5818('0x48')]()['field']('id')['field'](_0x5818('0x2d'))['field']('color')['from'](_0x5818('0x49'));var _0x1d2274=squel['select']()['field'](_0x5818('0x4a'))['field']('u.fullname')[_0x5818('0x4b')](_0x5818('0x4c'))[_0x5818('0x4d')](_0x5818('0x4e'),'ui')['left_join'](_0x5818('0x4f'),'u',_0x5818('0x50'));var _0x2db8c5=squel['select']()[_0x5818('0x4d')](_0x5818('0x51'),'i')[_0x5818('0x52')]('cm_contacts','c',_0x5818('0x53'))['left_join'](_0x5818('0x4f'),'o',_0x5818('0x54'))['left_join'](_0x5818('0x55'),'a',_0x5818('0x56'))[_0x5818('0x52')](_0x5818('0x57'),'me','me.FaxInteractionId\x20=\x20i.id')[_0x5818('0x52')]('fax_interaction_has_tags','it',_0x5818('0x58'))[_0x5818('0x52')](_0x5818('0x49'),'t',_0x5818('0x59'));var _0x1cc029=squel[_0x5818('0x5a')]();var _0x4c6921=[];var _0x70a4d7=squel['expr']();var _0x3e6565;if(_0x3faca0['query']['search']){_0x3e6565=as[_0x5818('0x5b')](_0x3faca0[_0x5818('0x3b')][_0x5818('0x5c')]);var _0x16b1a4=_0x3e6565[_0x5818('0x5d')];for(var _0x1292de=0x0;_0x1292de<_0x3e6565[_0x5818('0x5e')]['length'];_0x1292de++){var _0x70723d=_0x3e6565[_0x5818('0x5e')][_0x1292de];var _0x5c39ce='i';var _0x5a7769=_[_0x5818('0x5f')](_0x54f522,[_0x5818('0x2d'),_0x70723d['field']]);if(!_0x5a7769){switch(_0x70723d[_0x5818('0x4b')]){case'unreadMessages':if(_0x70723d['value']==0x1){_0x2db8c5['having']('`'+_0x70723d[_0x5818('0x4b')]+_0x5818('0x60'));}else{_0x2db8c5[_0x5818('0x61')]('`'+_0x70723d['field']+_0x5818('0x62'));}break;case _0x5818('0x63'):if(_0x70723d[_0x5818('0x64')]===_0x5818('0x65')){if(_0x70723d[_0x5818('0x66')][_0x5818('0x32')]('\x20')[_0x5818('0x41')]>0x1){_0x1cc029[_0x16b1a4](_0x5818('0x67'),qs[_0x5818('0x68')](_0x70723d[_0x5818('0x66')]),null);}else{var _0xc6c7b2='%'+_0x70723d['value']+'%';_0x1cc029[_0x16b1a4](_0x5818('0x69'),_0xc6c7b2,_0xc6c7b2,_0xc6c7b2);}}else{_0x5a7769=_[_0x5818('0x5f')](_0x54f522,[_0x5818('0x2d'),_0x5818('0x6a')]);_0x70723d[_0x5818('0x4b')]=_0x5818('0x6a');_0x42244f=as[_0x5818('0x6b')](_0x5c39ce,_0x5a7769[_0x5818('0x6c')],_0x70723d);_0x1cc029[_0x16b1a4](_0x42244f['text'],_0x42244f[_0x5818('0x66')][_0x5818('0x6d')],_0x42244f['value']['end']);}break;case _0x5818('0x6e'):var _0x512fe9=_0x70723d['value'][_0x5818('0x32')](',')[_0x5818('0x36')](function(_0x2c5544){return Number(_0x2c5544);});_0x512fe9[_0x5818('0x33')](function(_0x571012){_0x70a4d7['or'](_0x5818('0x6f'),'%,'+_0x571012+',%');});_0x4c6921=_[_0x5818('0x70')](_0x4c6921,_0x512fe9);break;case _0x5818('0x71'):if(_0x70723d[_0x5818('0x64')]===_0x5818('0x65')){_0x1cc029[_0x16b1a4](_0x5818('0x72'),'%'+_0x70723d['value']+'%',null);}else{_0x5a7769=_[_0x5818('0x5f')](_0x54f522,['name','UserId']);_0x70723d[_0x5818('0x4b')]=_0x5818('0x73');_0x42244f=as[_0x5818('0x6b')](_0x5c39ce,_0x5a7769['type'],_0x70723d);_0x1cc029[_0x16b1a4](_0x42244f[_0x5818('0x74')],_0x42244f[_0x5818('0x66')]['start'],_0x42244f[_0x5818('0x66')][_0x5818('0x2a')]);}break;case _0x5818('0x75'):_0x42244f=as[_0x5818('0x6b')]('me',null,_0x70723d);_0x1cc029[_0x16b1a4](_0x42244f[_0x5818('0x74')],_0x42244f['value'][_0x5818('0x6d')],_0x42244f[_0x5818('0x66')][_0x5818('0x2a')]);break;}}else{var _0x42244f=as[_0x5818('0x6b')](_0x5c39ce,_0x5a7769[_0x5818('0x6c')],_0x70723d);_0x1cc029[_0x16b1a4](_0x42244f[_0x5818('0x74')],_0x42244f[_0x5818('0x66')][_0x5818('0x6d')],_0x42244f[_0x5818('0x66')][_0x5818('0x2a')]);}}}else{var _0x5101ba=_(_0x3faca0[_0x5818('0x3b')])[_0x5818('0x3c')]()['map'](function(_0x4c9322){return _['some'](_0x54f522,[_0x5818('0x2d'),_0x4c9322])?_0x4c9322:undefined;})['compact']()[_0x5818('0x66')]();if(!_[_0x5818('0x76')](_0x5101ba)){_0x5101ba[_0x5818('0x33')](function(_0x400a36){if(_0x400a36===_0x5818('0x77')){_0x2db8c5[_0x5818('0x46')](_0x5818('0x78'),[][_0x5818('0x79')](_0x3faca0[_0x5818('0x3b')][_0x400a36]));}else if(_0x400a36===_0x5818('0x7a')){var _0x35e1cb=JSON['parse'](_0x3faca0[_0x5818('0x3b')][_0x400a36])[_0x5818('0x7b')];var _0x412daa=JSON[_0x5818('0x7c')](_0x3faca0[_0x5818('0x3b')][_0x400a36])[_0x5818('0x7d')];_0x2db8c5[_0x5818('0x46')](_0x5818('0x7e'),_0x35e1cb,_0x412daa);}else{if(_0x3faca0[_0x5818('0x3b')][_0x400a36]===_0x5818('0x7f')){_0x2db8c5['where']('i.'+_0x400a36+'\x20IS\x20NULL');}else{_0x2db8c5[_0x5818('0x46')]('i.'+_0x400a36+_0x5818('0x80'),_0x3faca0[_0x5818('0x3b')][_0x400a36]);}}});}if(_0x3faca0[_0x5818('0x3b')][_0x5818('0x81')]){if(_0x3faca0[_0x5818('0x3b')]['read']==0x1){_0x2db8c5[_0x5818('0x61')](_0x5818('0x82'));}else{_0x2db8c5['having'](_0x5818('0x83'));}}if(_0x3faca0[_0x5818('0x3b')][_0x5818('0x84')]){_0x4c6921=_[_0x5818('0x85')](_0x3faca0[_0x5818('0x3b')][_0x5818('0x84')])?_0x3faca0[_0x5818('0x3b')][_0x5818('0x84')]:new Array(_0x3faca0[_0x5818('0x3b')]['tag']);_0x4c6921[_0x5818('0x33')](function(_0x51c830){_0x70a4d7['or'](_0x5818('0x6f'),'%,'+_0x51c830+',%');});}if(_0x3faca0[_0x5818('0x3b')]['filter']){var _0x4475e2=_0x3faca0[_0x5818('0x3b')][_0x5818('0x86')][_0x5818('0x87')]('\x5c','\x5c\x5c')[_0x5818('0x87')](/'/g,'\x27\x27');if(qs[_0x5818('0x88')](_0x4475e2)){_0x1cc029['or'](_0x5818('0x89'),_0x4475e2+'%')['or'](_0x5818('0x8a'),_0x4475e2+'%');}_0x1cc029['or'](_0x5818('0x8b'),_0x4475e2+'%');}}_0x2db8c5[_0x5818('0x46')](_0x1cc029);_0x2db8c5[_0x5818('0x8c')](_0x5818('0x8d'));var _0x21e28d={'type':db['Sequelize'][_0x5818('0x8e')][_0x5818('0x8f')],'raw':!![]};var _0x4a3b3b=_0x2db8c5[_0x5818('0x90')]();_0x4a3b3b[_0x5818('0x4b')](_0x5818('0x8d'));_0x4a3b3b[_0x5818('0x4b')](_0x5818('0x91'),'unreadMessages');if(_0x9eaf20['order']){_0x9eaf20['order'][_0x5818('0x33')](function(_0x550704){var _0x1beb88=_0x550704[0x0]==='contactName'?_0x550704[0x0]:'i.'+_0x550704[0x0];_0x2db8c5[_0x5818('0x92')](_0x1beb88,_0x550704[0x1]===_0x5818('0x93')?![]:!![]);});}if(!_[_0x5818('0x76')](_0x4c6921)){_0x2db8c5[_0x5818('0x61')](_0x70a4d7);_0x4a3b3b[_0x5818('0x46')](_0x5818('0x94'),_0x4c6921);}BPromise[_0x5818('0x95')]()[_0x5818('0x29')](function(){if(!_0x3e6565){if(_0x3faca0[_0x5818('0x3b')][_0x5818('0x77')])return;_0x4a3b3b[_0x5818('0x46')](_0x5818('0x96'));_0x2db8c5[_0x5818('0x46')](_0x5818('0x96'));return;}if(_0x3faca0['user'][_0x5818('0x97')]!==_0x5818('0x98'))return;return _0x3faca0['user'][_0x5818('0x99')]({'attributes':['id'],'raw':!![]})['then'](function(_0xb3c549){if(_[_0x5818('0x76')](_0xb3c549)){_0x4a3b3b[_0x5818('0x46')](_0x5818('0x9a'));_0x2db8c5[_0x5818('0x46')](_0x5818('0x9a'));}else{_0x4a3b3b[_0x5818('0x46')](_0x5818('0x78'),_[_0x5818('0x36')](_0xb3c549,'id'));_0x2db8c5[_0x5818('0x46')]('i.FaxAccountId\x20IN\x20?',_[_0x5818('0x36')](_0xb3c549,'id'));}});})['then'](function(){if(_0x3faca0['user'][_0x5818('0x97')]===_0x5818('0x98')&&!_0x3e6565&&!_0x3faca0[_0x5818('0x3b')][_0x5818('0x77')])return[];return db[_0x5818('0x9b')]['query'](_0x4a3b3b[_0x5818('0x9c')](),_0x21e28d);})[_0x5818('0x29')](function(_0x4fdfd7){_0x581087[_0x5818('0x20')]=_0x4fdfd7[_0x5818('0x41')];if(_0x581087[_0x5818('0x20')]===0x0)return[];return db[_0x5818('0x9b')]['query'](_0x59dd75[_0x5818('0x9c')](),_0x21e28d)[_0x5818('0x29')](function(_0x25e8ea){_0x3064fe=_[_0x5818('0x9d')](_0x25e8ea,'id');_0x21e28d=_[_0x5818('0x9e')](_0x21e28d,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3faca0[_0x5818('0x3b')]['fields']){_0x9eaf20[_0x5818('0x3f')][_0x5818('0x33')](function(_0x2cab79){_0x2db8c5[_0x5818('0x4b')]('i.'+_0x2cab79);});}else{_0x2db8c5['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5818('0x9f'));_0x2db8c5['field']('a.key',_0x5818('0xa0'));_0x2db8c5[_0x5818('0x4b')]('a.mandatoryDisposition',_0x5818('0xa1'));_0x2db8c5[_0x5818('0x4b')](_0x5818('0xa2'),_0x5818('0xa3'));_0x2db8c5[_0x5818('0x4b')](_0x5818('0xa4'));_0x2db8c5[_0x5818('0x4b')](_0x5818('0xa5'),_0x5818('0xa6'));_0x2db8c5[_0x5818('0x4b')](_0x5818('0xa7'),_0x5818('0xa8'));_0x2db8c5['field'](_0x5818('0xa9'),_0x5818('0xaa'));_0x2db8c5[_0x5818('0x4b')]('c.phone','Contact.phone');_0x2db8c5['field'](_0x5818('0xab'),_0x5818('0xac'));_0x2db8c5[_0x5818('0x4b')](_0x5818('0xad'),'Contact.fax');_0x2db8c5[_0x5818('0x4b')](_0x5818('0xae'),'Owner.fullname');_0x2db8c5['field'](_0x5818('0xaf'),_0x5818('0xb0'));_0x2db8c5[_0x5818('0x4b')](_0x5818('0xb1'),_0x5818('0x30'));}if(_0x9eaf20[_0x5818('0x44')])_0x2db8c5[_0x5818('0x44')](_0x9eaf20['limit']);if(_0x9eaf20['offset'])_0x2db8c5[_0x5818('0x21')](_0x9eaf20[_0x5818('0x21')]);return db[_0x5818('0x9b')][_0x5818('0x3b')](_0x2db8c5['toString'](),_0x21e28d);})[_0x5818('0x29')](function(_0x4e5db6){_0x1d2274[_0x5818('0x46')](_0x5818('0xb2'),_[_0x5818('0x36')](_0x4e5db6,'id'));return db[_0x5818('0x9b')]['query'](_0x1d2274['toString'](),_0x21e28d)[_0x5818('0x29')](function(_0x4c4739){var _0x4ce393=_['groupBy'](_0x4c4739,_0x5818('0xb3'));var _0x1ba922=[];_0x4e5db6[_0x5818('0x33')](function(_0x4dd315){_0x1ba922[_0x5818('0x34')](updateFaxInteraction(_0x4dd315,_0x3064fe,_0x4ce393));});return BPromise['all'](_0x1ba922);});});})['then'](function(_0x449233){_0x581087[_0x5818('0xb4')]=_0x449233;return _0x581087;})['then'](respondWithFilteredResult(_0x436c34,_0x9eaf20))[_0x5818('0x35')](handleError(_0x436c34,null));};exports['show']=function(_0x188be4,_0x45fcb1){var _0x289a45={'raw':![],'where':{'id':_0x188be4['params']['id']}},_0x1ed23a={};_0x1ed23a['model']=_[_0x5818('0x3c')](db[_0x5818('0x37')][_0x5818('0x38')]);_0x1ed23a['query']=_[_0x5818('0x3c')](_0x188be4[_0x5818('0x3b')]);_0x1ed23a['filters']=_[_0x5818('0x3e')](_0x1ed23a[_0x5818('0x3a')],_0x1ed23a[_0x5818('0x3b')]);_0x289a45[_0x5818('0x3f')]=_['intersection'](_0x1ed23a[_0x5818('0x3a')],qs[_0x5818('0x40')](_0x188be4['query'][_0x5818('0x40')]));_0x289a45['attributes']=_0x289a45[_0x5818('0x3f')]['length']?_0x289a45[_0x5818('0x3f')]:_0x1ed23a['model'];if(_0x188be4['query']['includeAll']){_0x289a45['include']=[{'all':!![]}];}_0x289a45=_['merge']({},_0x289a45,_0x188be4[_0x5818('0xb5')]);return db[_0x5818('0x37')][_0x5818('0x5f')](_0x289a45)['then'](handleEntityNotFound(_0x45fcb1,null))[_0x5818('0x29')](respondWithResult(_0x45fcb1,null))[_0x5818('0x35')](handleError(_0x45fcb1,null));};exports[_0x5818('0xb6')]=function(_0x359b1c,_0x196819){return db['FaxInteraction'][_0x5818('0xb6')](_0x359b1c[_0x5818('0x75')],{})['then'](respondWithResult(_0x196819,0xc9))[_0x5818('0x35')](handleError(_0x196819,null));};exports['update']=function(_0x3e3512,_0x372a5b){if(_0x3e3512[_0x5818('0x75')]['id']){delete _0x3e3512['body']['id'];}return db[_0x5818('0x37')][_0x5818('0x5f')]({'where':{'id':_0x3e3512[_0x5818('0xb7')]['id']}})['then'](handleEntityNotFound(_0x372a5b,null))['then'](saveUpdates(_0x3e3512[_0x5818('0x75')],null))[_0x5818('0x29')](respondWithResult(_0x372a5b,null))[_0x5818('0x35')](handleError(_0x372a5b,null));};exports[_0x5818('0x28')]=function(_0x33d4fe,_0xae2f3){return db[_0x5818('0x37')][_0x5818('0x5f')]({'where':{'id':_0x33d4fe['params']['id']}})['then'](handleEntityNotFound(_0xae2f3,null))[_0x5818('0x29')](removeEntity(_0xae2f3,null))[_0x5818('0x35')](handleError(_0xae2f3,null));};exports[_0x5818('0xb8')]=function(_0x2a315e,_0x47d91a){return db[_0x5818('0x37')][_0x5818('0xb8')]()[_0x5818('0x29')](respondWithResult(_0x47d91a,null))['catch'](handleError(_0x47d91a,null));};exports[_0x5818('0xb9')]=function(_0x592b2d,_0x288700,_0x378571){return db[_0x5818('0xba')][_0x5818('0x5f')]({'where':{'id':_0x592b2d['params']['id']}})[_0x5818('0x29')](handleEntityNotFound(_0x288700,null))['then'](function(_0x3e26df){if(_0x3e26df){return _0x3e26df['addMessage'](_0x592b2d[_0x5818('0x75')][_0x5818('0xbb')],_[_0x5818('0xbc')](_0x592b2d[_0x5818('0x75')],[_0x5818('0xbb'),'id'])||{});}})[_0x5818('0x29')](respondWithResult(_0x288700,null))[_0x5818('0x35')](handleError(_0x288700,null));};exports[_0x5818('0xbd')]=function(_0x196060,_0x188da6,_0x4d05b1){var _0x716182={'raw':![],'where':{}};var _0x1f6f66={};var _0x3f4479={'count':0x0,'rows':[]};return db[_0x5818('0x37')][_0x5818('0xbe')]({'where':{'id':_0x196060['params']['id']}})[_0x5818('0x29')](handleEntityNotFound(_0x188da6,null))[_0x5818('0x29')](function(_0x57e19a){if(_0x57e19a){_0x1f6f66[_0x5818('0x3a')]=_[_0x5818('0x3c')](db[_0x5818('0xba')][_0x5818('0x38')]);_0x1f6f66[_0x5818('0x3b')]=_[_0x5818('0x3c')](_0x196060[_0x5818('0x3b')]);_0x1f6f66[_0x5818('0x3d')]=_[_0x5818('0x3e')](_0x1f6f66[_0x5818('0x3a')],_0x1f6f66['query']);_0x716182[_0x5818('0x3f')]=_[_0x5818('0x3e')](_0x1f6f66[_0x5818('0x3a')],qs[_0x5818('0x40')](_0x196060[_0x5818('0x3b')][_0x5818('0x40')]));_0x716182[_0x5818('0x3f')]=_0x716182[_0x5818('0x3f')][_0x5818('0x41')]?_0x716182[_0x5818('0x3f')]:_0x1f6f66[_0x5818('0x3a')];if(!_0x196060[_0x5818('0x3b')][_0x5818('0x42')](_0x5818('0x43'))){_0x716182['limit']=qs['limit'](_0x196060[_0x5818('0x3b')][_0x5818('0x44')]);_0x716182[_0x5818('0x21')]=qs['offset'](_0x196060[_0x5818('0x3b')][_0x5818('0x21')]);}_0x716182['order']=qs[_0x5818('0x45')](_0x196060[_0x5818('0x3b')][_0x5818('0x45')]);_0x716182[_0x5818('0x46')]=qs[_0x5818('0x3d')](_['pick'](_0x196060[_0x5818('0x3b')],_0x1f6f66['filters']));_0x716182[_0x5818('0x46')][_0x5818('0xb3')]=_0x57e19a['id'];if(_0x196060[_0x5818('0x3b')][_0x5818('0x86')]){_0x716182[_0x5818('0x46')]=_[_0x5818('0x9e')](_0x716182[_0x5818('0x46')],{'$or':_['map'](_0x716182[_0x5818('0x3f')],function(_0x4a2728){var _0x47faee={};_0x47faee[_0x4a2728]={'$like':'%'+_0x196060[_0x5818('0x3b')]['filter']+'%'};return _0x47faee;})});}if(_0x196060[_0x5818('0x3b')][_0x5818('0x7b')]){var _0x578932=_0x196060[_0x5818('0x3b')][_0x5818('0x7b')]['split'](',');var _0x1e41d7={};_0x1e41d7[_0x578932[0x0]]={'$gte':moment(_0x578932[0x1])[_0x5818('0xbf')](_0x5818('0xc0'))};_0x716182['where']=_['merge'](_0x716182['where'],_0x1e41d7);}_0x716182=_[_0x5818('0x9e')]({},_0x716182,_0x196060[_0x5818('0xb5')]);return db[_0x5818('0xba')][_0x5818('0x20')]({'where':_0x716182[_0x5818('0x46')]})[_0x5818('0x29')](function(_0x55418b){_0x3f4479['count']=_0x55418b;if(_0x196060['query'][_0x5818('0xc1')]){_0x716182[_0x5818('0xc2')]=[{'all':!![]}];}return db[_0x5818('0xba')][_0x5818('0xc3')](_0x716182);})['then'](function(_0x2b1ecc){_0x3f4479[_0x5818('0xb4')]=_0x2b1ecc;return _0x3f4479;});}})[_0x5818('0x29')](respondWithFilteredResult(_0x188da6,_0x716182))[_0x5818('0x35')](handleError(_0x188da6,null));};exports[_0x5818('0xc4')]=function(_0x184ab3,_0x5f4df4,_0x5e0753){return db['FaxInteraction']['find']({'where':{'id':_0x184ab3[_0x5818('0xb7')]['id']}})[_0x5818('0x29')](handleEntityNotFound(_0x5f4df4,null))['then'](function(_0x4db2ed){if(_0x4db2ed){return _0x4db2ed['setTags'](_0x184ab3[_0x5818('0x75')][_0x5818('0xbb')],_[_0x5818('0xbc')](_0x184ab3[_0x5818('0x75')],[_0x5818('0xbb'),'id'])||{})[_0x5818('0xc5')](function(){return db[_0x5818('0x6e')]['findAll']({'attributes':['id','name',_0x5818('0xc6')],'where':{'id':_0x184ab3['body']['ids']}});})[_0x5818('0x29')](function(_0x3b89e7){socket[_0x5818('0xc7')](_0x5818('0xc8'),{'id':Number(_0x184ab3[_0x5818('0xb7')]['id']),'tags':_0x3b89e7||[]});return{'id':Number(_0x184ab3[_0x5818('0xb7')]['id']),'tags':_0x3b89e7||[]};});}})[_0x5818('0x29')](respondWithResult(_0x5f4df4,null))[_0x5818('0x35')](handleError(_0x5f4df4,null));};exports[_0x5818('0xc9')]=function(_0x46dff1,_0x4b6fbd,_0x3a264f){return db[_0x5818('0x37')][_0x5818('0x5f')]({'where':{'id':_0x46dff1['params']['id']}})[_0x5818('0x29')](handleEntityNotFound(_0x4b6fbd,null))[_0x5818('0x29')](function(_0x172752){if(_0x172752){return _0x172752[_0x5818('0xc9')](_0x46dff1[_0x5818('0x3b')][_0x5818('0xbb')]);}})[_0x5818('0x29')](respondWithStatusCode(_0x4b6fbd,null))['catch'](handleError(_0x4b6fbd,null));};exports[_0x5818('0xca')]=function(_0x268694,_0x2376a2){var _0x3dbf14=moment()[_0x5818('0xcb')]()[_0x5818('0x9c')]();var _0x1c69e9=path['join'](config['root'],_0x5818('0xcc'),_0x5818('0xcd'),_0x5818('0xce'));var _0x4e5c6a=path[_0x5818('0xcf')](config[_0x5818('0xd0')],_0x5818('0xcc'),_0x5818('0xcd'),_0x5818('0xd1'));var _0x3dcff4=path['join'](_0x1c69e9,_0x3dbf14);var _0x5dc816=util[_0x5818('0xbf')](_0x5818('0xd2'),_0x268694['params']['id'],_0x3dbf14);var _0xe077c9=path['join'](_0x1c69e9,_0x5dc816);var _0x6cc455=[];_0x6cc455[_0x5818('0x34')]({'model':db[_0x5818('0xd3')],'as':_0x5818('0xd3'),'raw':!![]});var _0x3dc8af=[{'model':db[_0x5818('0xba')],'as':'Messages','attributes':['id',_0x5818('0x75'),'createdAt'],'include':_0x6cc455}];return db['FaxInteraction'][_0x5818('0x5f')]({'where':{'id':_0x268694['params']['id']},'include':_0x3dc8af})[_0x5818('0x29')](handleEntityNotFound(_0x2376a2,null))['then'](function(_0x5277b1){if(_0x5277b1&&_0x5277b1[_0x5818('0xd4')]){var _0x174811=_0x5277b1[_0x5818('0xd5')]({'plain':!![]});fs[_0x5818('0xd6')](_0x3dcff4);for(var _0x1f25ee=0x0;_0x1f25ee<_0x174811[_0x5818('0xd4')]['length'];_0x1f25ee++){var _0x558be8=_0x174811[_0x5818('0xd4')][_0x1f25ee][_0x5818('0xd3')];if(_0x558be8){var _0x25009f=path['join'](_0x4e5c6a,_0x558be8[_0x5818('0xd7')]);if(fs['existsSync'](_0x25009f)){fs[_0x5818('0xd8')](_0x25009f)['pipe'](fs['createWriteStream'](path[_0x5818('0xcf')](_0x3dcff4,_0x558be8[_0x5818('0xd7')])));}}}return BPromise['resolve']()[_0x5818('0x29')](function(){return new BPromise(function(_0x2050d2,_0x25c46a){zipdir(_0x3dcff4,{'saveTo':_0xe077c9},function(_0x169a52,_0x4a86c6){if(_0x169a52)return _0x25c46a(_0x169a52);return _0x2050d2(_0x4a86c6);});})['then'](function(){return new BPromise(function(_0x2fd569,_0xb0cbdf){rimraf(_0x3dcff4,function(_0x1ac86a){if(_0x1ac86a)_0xb0cbdf(_0x1ac86a);return _0x2fd569();});});})[_0x5818('0x29')](function(){return _0x2376a2[_0x5818('0xca')](_0xe077c9,_0x5dc816,function(_0x40a52e){if(_0x40a52e){console[_0x5818('0xd9')]('err',_0x40a52e);}else{fs[_0x5818('0xda')](_0xe077c9);}});});});}else{return _0x2376a2['sendStatus'](0xc8);}})['catch'](handleError(_0x2376a2,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 81f4fdf..e44b017 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 _0x814b=['then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove'];(function(_0x3a711b,_0x2123f2){var _0xbdbe7d=function(_0x300b8e){while(--_0x300b8e){_0x3a711b['push'](_0x3a711b['shift']());}};_0xbdbe7d(++_0x2123f2);}(_0x814b,0x1a2));var _0xb814=function(_0x35c12c,_0x378ba0){_0x35c12c=_0x35c12c-0x0;var _0x2bab3a=_0x814b[_0x35c12c];return _0x2bab3a;};'use strict';var EventEmitter=require(_0xb814('0x0'));var FaxInteraction=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var FaxMessage=require(_0xb814('0x1'))['db'][_0xb814('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb814('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb814('0x5'),'afterDestroy':_0xb814('0x6')};function emitEvent(_0x258866){return function(_0x4237bc,_0x44931c,_0x322a70){_0x4237bc['getUsers']({'attributes':['id'],'raw':!![]})[_0xb814('0x7')](function(_0x2e6272){_0x4237bc['setDataValue'](_0xb814('0x8'),_0x2e6272[_0xb814('0x9')](function(_0x186d5a){return{'id':_0x186d5a['id']};}));return FaxMessage[_0xb814('0xa')]({'where':{'FaxInteractionId':_0x4237bc['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb814('0x7')](function(_0x21d4a5){_0x4237bc[_0xb814('0xb')](_0xb814('0xc'),_0x21d4a5[_0xb814('0xd')]);FaxInteractionEvents[_0xb814('0xe')](_0x258866+':'+_0x4237bc['id'],_0x4237bc);FaxInteractionEvents[_0xb814('0xe')](_0x258866,_0x4237bc);_0x322a70(null);})['catch'](_0x322a70(null));};}for(var e in events){if(events[_0xb814('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xb814('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0xadb5=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x5228cf,_0x10dfab){var _0x425485=function(_0x14b7e4){while(--_0x14b7e4){_0x5228cf['push'](_0x5228cf['shift']());}};_0x425485(++_0x10dfab);}(_0xadb5,0xad));var _0x5adb=function(_0x45c37e,_0x262a2a){_0x45c37e=_0x45c37e-0x0;var _0x345f8a=_0xadb5[_0x45c37e];return _0x345f8a;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x5adb('0x0'))['db']['FaxInteraction'];var FaxMessage=require(_0x5adb('0x0'))['db'][_0x5adb('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x5adb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5adb('0x3'),'afterDestroy':_0x5adb('0x4')};function emitEvent(_0x2e3ef4){return function(_0x4cb1d1,_0x35a5d3,_0x168d89){_0x4cb1d1[_0x5adb('0x5')]({'attributes':['id'],'raw':!![]})[_0x5adb('0x6')](function(_0xdf3776){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0x8'),_0xdf3776[_0x5adb('0x9')](function(_0x41261c){return{'id':_0x41261c['id']};}));return FaxMessage[_0x5adb('0xa')]({'where':{'FaxInteractionId':_0x4cb1d1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5adb('0x6')](function(_0x336bad){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0xb'),_0x336bad['length']);FaxInteractionEvents['emit'](_0x2e3ef4+':'+_0x4cb1d1['id'],_0x4cb1d1);FaxInteractionEvents[_0x5adb('0xc')](_0x2e3ef4,_0x4cb1d1);_0x168d89(null);})[_0x5adb('0xd')](_0x168d89(null));};}for(var e in events){if(events[_0x5adb('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x5adb('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 0171f68..665566f 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 _0xb20e=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./faxInteraction.attributes','exports','define','fax_interactions'];(function(_0x1cef0a,_0x503db5){var _0x2df62f=function(_0x2055aa){while(--_0x2055aa){_0x1cef0a['push'](_0x1cef0a['shift']());}};_0x2df62f(++_0x503db5);}(_0xb20e,0x1c5));var _0xeb20=function(_0x4cb809,_0x5e5682){_0x4cb809=_0x4cb809-0x0;var _0x397264=_0xb20e[_0x4cb809];return _0x397264;};'use strict';var _=require(_0xeb20('0x0'));var util=require('util');var logger=require(_0xeb20('0x1'))(_0xeb20('0x2'));var moment=require(_0xeb20('0x3'));var BPromise=require(_0xeb20('0x4'));var rp=require(_0xeb20('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeb20('0x6'));var config=require('../../config/environment');var attributes=require(_0xeb20('0x7'));module[_0xeb20('0x8')]=function(_0x52af65,_0x502c8e){return _0x52af65[_0xeb20('0x9')]('FaxInteraction',attributes,{'tableName':_0xeb20('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xa435bc,_0x13eab2,_0x36ba12){if(_0xa435bc[_0xeb20('0xb')](_0xeb20('0xc'))){_0xa435bc[_0xeb20('0xd')]=moment()[_0xeb20('0xe')](_0xeb20('0xf'));}_0x36ba12(null,_0xa435bc);}}});}; \ No newline at end of file +var _0xe83f=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./faxInteraction.attributes','define','FaxInteraction','fax_interactions','closed','format','lodash'];(function(_0x58eec7,_0x2353db){var _0x25c5d3=function(_0x1ae895){while(--_0x1ae895){_0x58eec7['push'](_0x58eec7['shift']());}};_0x25c5d3(++_0x2353db);}(_0xe83f,0x1e9));var _0xfe83=function(_0x4cd5bb,_0x5d1d80){_0x4cd5bb=_0x4cd5bb-0x0;var _0x23e03a=_0xe83f[_0x4cd5bb];return _0x23e03a;};'use strict';var _=require(_0xfe83('0x0'));var util=require(_0xfe83('0x1'));var logger=require(_0xfe83('0x2'))(_0xfe83('0x3'));var moment=require('moment');var BPromise=require(_0xfe83('0x4'));var rp=require(_0xfe83('0x5'));var fs=require('fs');var path=require(_0xfe83('0x6'));var rimraf=require(_0xfe83('0x7'));var config=require('../../config/environment');var attributes=require(_0xfe83('0x8'));module['exports']=function(_0xaf11c5,_0x1769c3){return _0xaf11c5[_0xfe83('0x9')](_0xfe83('0xa'),attributes,{'tableName':_0xfe83('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3929f3,_0x41cdaf,_0x4f6538){if(_0x3929f3['changed'](_0xfe83('0xc'))){_0x3929f3['closedAt']=moment()[_0xfe83('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4f6538(null,_0x3929f3);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 7857c6b..30f4d37 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 _0x9f4c=['../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxInteraction.socket','request','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateFaxInteraction','body','options','raw','where','attributes','limit','stringify','AddTagsToFaxInteraction','FaxInteraction','addTags','omit','spread','AddTags','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2607a6,_0x1d46f9){var _0x3829c5=function(_0x2d3b66){while(--_0x2d3b66){_0x2607a6['push'](_0x2607a6['shift']());}};_0x3829c5(++_0x1d46f9);}(_0x9f4c,0x11d));var _0xc9f4=function(_0x24abc9,_0x54053f){_0x24abc9=_0x24abc9-0x0;var _0x4b5b61=_0x9f4c[_0x24abc9];return _0x4b5b61;};'use strict';var _=require(_0xc9f4('0x0'));var util=require('util');var moment=require(_0xc9f4('0x1'));var BPromise=require(_0xc9f4('0x2'));var rs=require(_0xc9f4('0x3'));var fs=require('fs');var Redis=require(_0xc9f4('0x4'));var db=require(_0xc9f4('0x5'))['db'];var utils=require(_0xc9f4('0x6'));var logger=require(_0xc9f4('0x7'))(_0xc9f4('0x8'));var config=require(_0xc9f4('0x9'));var jayson=require(_0xc9f4('0xa'));var client=jayson[_0xc9f4('0xb')][_0xc9f4('0xc')]({'port':0x232a});config[_0xc9f4('0xd')]=_[_0xc9f4('0xe')](config[_0xc9f4('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xc9f4('0xf'))(new Redis(config[_0xc9f4('0xd')]));require(_0xc9f4('0x10'))['register'](socket);function respondWithRpcPromise(_0x4c39ee,_0x75be35,_0xe8c9df){return new BPromise(function(_0x2084c0,_0x1ca0ad){return client[_0xc9f4('0x11')](_0x4c39ee,_0xe8c9df)['then'](function(_0x4178e9){logger[_0xc9f4('0x12')](_0xc9f4('0x13'),_0x75be35,_0xc9f4('0x14'));logger[_0xc9f4('0x15')](_0xc9f4('0x16'),_0x75be35,'request\x20sent',JSON['stringify'](_0x4178e9));if(_0x4178e9[_0xc9f4('0x17')]){if(_0x4178e9[_0xc9f4('0x17')][_0xc9f4('0x18')]===0x1f4){logger[_0xc9f4('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x75be35,_0x4178e9[_0xc9f4('0x17')][_0xc9f4('0x19')]);return _0x1ca0ad(_0x4178e9[_0xc9f4('0x17')][_0xc9f4('0x19')]);}logger[_0xc9f4('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x75be35,_0x4178e9[_0xc9f4('0x17')][_0xc9f4('0x19')]);return _0x2084c0(_0x4178e9[_0xc9f4('0x17')][_0xc9f4('0x19')]);}else{logger[_0xc9f4('0x12')](_0xc9f4('0x13'),_0x75be35,'request\x20sent');_0x2084c0(_0x4178e9[_0xc9f4('0x1a')]['message']);}})['catch'](function(_0x60f78b){logger[_0xc9f4('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x75be35,_0x60f78b);_0x1ca0ad(_0x60f78b);});});}exports[_0xc9f4('0x1b')]=function(_0x2bca46){var _0x4de57e=this;return new Promise(function(_0x200bed,_0x46f694){return db['FaxInteraction']['update'](_0x2bca46[_0xc9f4('0x1c')],{'raw':_0x2bca46[_0xc9f4('0x1d')]?_0x2bca46[_0xc9f4('0x1d')][_0xc9f4('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bca46[_0xc9f4('0x1d')]?_0x2bca46[_0xc9f4('0x1d')][_0xc9f4('0x1f')]||null:null,'attributes':_0x2bca46['options']?_0x2bca46['options'][_0xc9f4('0x20')]||null:null,'limit':_0x2bca46[_0xc9f4('0x1d')]?_0x2bca46[_0xc9f4('0x1d')][_0xc9f4('0x21')]||null:null})['then'](function(_0x5c69b3){logger[_0xc9f4('0x12')](_0xc9f4('0x1b'),_0x2bca46);logger[_0xc9f4('0x15')](_0xc9f4('0x1b'),_0x2bca46,JSON[_0xc9f4('0x22')](_0x5c69b3));_0x200bed(_0x5c69b3);})['catch'](function(_0x2e48db){logger[_0xc9f4('0x17')](_0xc9f4('0x1b'),_0x2e48db[_0xc9f4('0x19')],_0x2bca46);_0x46f694(_0x4de57e['error'](0x1f4,_0x2e48db['message']));});});};exports[_0xc9f4('0x23')]=function(_0x43cdab){return new Promise(function(_0x545741,_0x378f54){return db[_0xc9f4('0x24')]['find']({'where':_0x43cdab[_0xc9f4('0x1d')]?_0x43cdab[_0xc9f4('0x1d')]['where']||null:null})['then'](function(_0x5abddb){if(_0x5abddb){return _0x5abddb[_0xc9f4('0x25')](_0x43cdab[_0xc9f4('0x1c')]['ids'],_[_0xc9f4('0x26')](_0x43cdab[_0xc9f4('0x1c')],['ids','id'])||{});}})[_0xc9f4('0x27')](function(_0xb63e8){logger[_0xc9f4('0x12')](_0xc9f4('0x28'),_0x43cdab);logger['debug'](_0xc9f4('0x28'),_0x43cdab,JSON[_0xc9f4('0x22')](_0xb63e8));_0x545741(_0xb63e8);})[_0xc9f4('0x29')](function(_0x1f1901){logger[_0xc9f4('0x17')](_0xc9f4('0x28'),_0x1f1901['message'],_0x43cdab);_0x378f54(_this[_0xc9f4('0x17')](0x1f4,_0x1f1901[_0xc9f4('0x19')]));});});}; \ No newline at end of file +var _0x1b94=['stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','attributes','limit','find','addTags','omit','ids','debug','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3bc022,_0x398082){var _0x4a19c6=function(_0x1e3281){while(--_0x1e3281){_0x3bc022['push'](_0x3bc022['shift']());}};_0x4a19c6(++_0x398082);}(_0x1b94,0x110));var _0x41b9=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x1b94[_0x556bb1];return _0x45455f;};'use strict';var _=require(_0x41b9('0x0'));var util=require(_0x41b9('0x1'));var moment=require(_0x41b9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x41b9('0x3'));var db=require(_0x41b9('0x4'))['db'];var utils=require(_0x41b9('0x5'));var logger=require(_0x41b9('0x6'))(_0x41b9('0x7'));var config=require(_0x41b9('0x8'));var jayson=require(_0x41b9('0x9'));var client=jayson[_0x41b9('0xa')][_0x41b9('0xb')]({'port':0x232a});config[_0x41b9('0xc')]=_[_0x41b9('0xd')](config[_0x41b9('0xc')],{'host':_0x41b9('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x41b9('0xc')]));require(_0x41b9('0xf'))[_0x41b9('0x10')](socket);function respondWithRpcPromise(_0x590e0c,_0x1eb94d,_0x578441){return new BPromise(function(_0x1bf437,_0x328996){return client['request'](_0x590e0c,_0x578441)[_0x41b9('0x11')](function(_0x585f1e){logger[_0x41b9('0x12')](_0x41b9('0x13'),_0x1eb94d,'request\x20sent');logger['debug'](_0x41b9('0x14'),_0x1eb94d,_0x41b9('0x15'),JSON[_0x41b9('0x16')](_0x585f1e));if(_0x585f1e[_0x41b9('0x17')]){if(_0x585f1e[_0x41b9('0x17')][_0x41b9('0x18')]===0x1f4){logger[_0x41b9('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x1eb94d,_0x585f1e[_0x41b9('0x17')][_0x41b9('0x19')]);return _0x328996(_0x585f1e[_0x41b9('0x17')]['message']);}logger['error'](_0x41b9('0x13'),_0x1eb94d,_0x585f1e[_0x41b9('0x17')][_0x41b9('0x19')]);return _0x1bf437(_0x585f1e[_0x41b9('0x17')][_0x41b9('0x19')]);}else{logger['info'](_0x41b9('0x13'),_0x1eb94d,'request\x20sent');_0x1bf437(_0x585f1e[_0x41b9('0x1a')][_0x41b9('0x19')]);}})[_0x41b9('0x1b')](function(_0x4a21a4){logger['error'](_0x41b9('0x13'),_0x1eb94d,_0x4a21a4);_0x328996(_0x4a21a4);});});}exports[_0x41b9('0x1c')]=function(_0x2a3924){var _0xb34149=this;return new Promise(function(_0x5ee66f,_0x594773){return db[_0x41b9('0x1d')][_0x41b9('0x1e')](_0x2a3924[_0x41b9('0x1f')],{'raw':_0x2a3924['options']?_0x2a3924[_0x41b9('0x20')][_0x41b9('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a3924[_0x41b9('0x20')]?_0x2a3924[_0x41b9('0x20')]['where']||null:null,'attributes':_0x2a3924[_0x41b9('0x20')]?_0x2a3924['options'][_0x41b9('0x22')]||null:null,'limit':_0x2a3924['options']?_0x2a3924[_0x41b9('0x20')][_0x41b9('0x23')]||null:null})[_0x41b9('0x11')](function(_0x20935b){logger[_0x41b9('0x12')](_0x41b9('0x1c'),_0x2a3924);logger['debug'](_0x41b9('0x1c'),_0x2a3924,JSON[_0x41b9('0x16')](_0x20935b));_0x5ee66f(_0x20935b);})[_0x41b9('0x1b')](function(_0x15ebf5){logger[_0x41b9('0x17')]('UpdateFaxInteraction',_0x15ebf5[_0x41b9('0x19')],_0x2a3924);_0x594773(_0xb34149[_0x41b9('0x17')](0x1f4,_0x15ebf5[_0x41b9('0x19')]));});});};exports['AddTagsToFaxInteraction']=function(_0x61e228){return new Promise(function(_0x232ae8,_0x53b53a){return db[_0x41b9('0x1d')][_0x41b9('0x24')]({'where':_0x61e228[_0x41b9('0x20')]?_0x61e228[_0x41b9('0x20')]['where']||null:null})['then'](function(_0x2d76ea){if(_0x2d76ea){return _0x2d76ea[_0x41b9('0x25')](_0x61e228['body']['ids'],_[_0x41b9('0x26')](_0x61e228['body'],[_0x41b9('0x27'),'id'])||{});}})['spread'](function(_0x13515c){logger[_0x41b9('0x12')]('AddTags',_0x61e228);logger[_0x41b9('0x28')](_0x41b9('0x29'),_0x61e228,JSON[_0x41b9('0x16')](_0x13515c));_0x232ae8(_0x13515c);})[_0x41b9('0x1b')](function(_0x1f1884){logger[_0x41b9('0x17')](_0x41b9('0x29'),_0x1f1884[_0x41b9('0x19')],_0x61e228);_0x53b53a(_this['error'](0x1f4,_0x1f1884[_0x41b9('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index d237b0c..6053d23 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 _0xeb8b=['remove','update','emit','register','save'];(function(_0x5c2c7c,_0xa7d3b1){var _0xea7ffe=function(_0x471f17){while(--_0x471f17){_0x5c2c7c['push'](_0x5c2c7c['shift']());}};_0xea7ffe(++_0xa7d3b1);}(_0xeb8b,0x199));var _0xbeb8=function(_0x101e2d,_0x3833a6){_0x101e2d=_0x101e2d-0x0;var _0x3258f0=_0xeb8b[_0x101e2d];return _0x3258f0;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xbeb8('0x0'),_0xbeb8('0x1'),_0xbeb8('0x2')];function createListener(_0x5e1869,_0x564c74){return function(_0xbf988c){_0x564c74[_0xbeb8('0x3')](_0x5e1869,_0xbf988c);};}function removeListener(_0x35bc51,_0x50125a){return function(){FaxInteractionEvents['removeListener'](_0x35bc51,_0x50125a);};}exports[_0xbeb8('0x4')]=function(_0x1b021f){for(var _0x29f75d=0x0,_0x4ddfa7=events['length'];_0x29f75d<_0x4ddfa7;_0x29f75d++){var _0x584701=events[_0x29f75d];var _0x2ef7fc=createListener('faxInteraction:'+_0x584701,_0x1b021f);FaxInteractionEvents['on'](_0x584701,_0x2ef7fc);}}; \ No newline at end of file +var _0xd978=['length','./faxInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x103678,_0x1154e1){var _0x455829=function(_0x31ad31){while(--_0x31ad31){_0x103678['push'](_0x103678['shift']());}};_0x455829(++_0x1154e1);}(_0xd978,0x141));var _0x8d97=function(_0x9be508,_0x10c8ba){_0x9be508=_0x9be508-0x0;var _0x16f3c3=_0xd978[_0x9be508];return _0x16f3c3;};'use strict';var FaxInteractionEvents=require(_0x8d97('0x0'));var events=[_0x8d97('0x1'),_0x8d97('0x2'),_0x8d97('0x3')];function createListener(_0xe910c1,_0x400777){return function(_0x4aadbe){_0x400777[_0x8d97('0x4')](_0xe910c1,_0x4aadbe);};}function removeListener(_0x4d0649,_0x3d1a01){return function(){FaxInteractionEvents[_0x8d97('0x5')](_0x4d0649,_0x3d1a01);};}exports[_0x8d97('0x6')]=function(_0x9e0bf0){for(var _0x568a41=0x0,_0x378a8=events[_0x8d97('0x7')];_0x568a41<_0x378a8;_0x568a41++){var _0x5d6e43=events[_0x568a41];var _0x4d7e24=createListener('faxInteraction:'+_0x5d6e43,_0x9e0bf0);FaxInteractionEvents['on'](_0x5d6e43,_0x4d7e24);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 980655c..4eeb1fb 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 _0x7118=['isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','put','fax','update','delete','faxinteraction:destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x2e7dd4,_0x3a6ce9){var _0xc49c22=function(_0x4daeaa){while(--_0x4daeaa){_0x2e7dd4['push'](_0x2e7dd4['shift']());}};_0xc49c22(++_0x3a6ce9);}(_0x7118,0x88));var _0x8711=function(_0x57607f,_0x2912ea){_0x57607f=_0x57607f-0x0;var _0x1f917c=_0x7118[_0x57607f];return _0x1f917c;};'use strict';var multer=require(_0x8711('0x0'));var util=require(_0x8711('0x1'));var path=require('path');var timeout=require(_0x8711('0x2'));var express=require(_0x8711('0x3'));var router=express[_0x8711('0x4')]();var fs_extra=require(_0x8711('0x5'));var auth=require(_0x8711('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8711('0x7'));var controller=require('./faxInteraction.controller');router[_0x8711('0x8')]('/',auth[_0x8711('0x9')](),controller[_0x8711('0xa')]);router[_0x8711('0x8')](_0x8711('0xb'),auth[_0x8711('0x9')](),controller[_0x8711('0xc')]);router['get'](_0x8711('0xd'),auth[_0x8711('0x9')](),controller[_0x8711('0xe')]);router['get'](_0x8711('0xf'),auth[_0x8711('0x9')](),controller[_0x8711('0x10')]);router[_0x8711('0x8')](_0x8711('0x11'),auth[_0x8711('0x9')](),controller['download']);router[_0x8711('0x12')]('/',auth[_0x8711('0x9')](),controller['create']);router[_0x8711('0x12')](_0x8711('0xf'),auth[_0x8711('0x9')](),controller[_0x8711('0x13')]);router['post'](_0x8711('0x14'),auth['isAuthenticated'](),interaction[_0x8711('0x15')]('fax','faxinteraction:addtags'),controller['addTags']);router[_0x8711('0x16')](_0x8711('0xd'),auth[_0x8711('0x9')](),interaction['tracked'](_0x8711('0x17'),'faxinteraction:update'),controller[_0x8711('0x18')]);router[_0x8711('0x19')]('/:id',auth[_0x8711('0x9')](),interaction[_0x8711('0x15')](_0x8711('0x17'),_0x8711('0x1a')),controller['destroy']);router[_0x8711('0x19')]('/:id/tags',auth['isAuthenticated'](),controller[_0x8711('0x1b')]);module[_0x8711('0x1c')]=router; \ No newline at end of file +var _0x9f5b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','fax','faxinteraction:addtags','addTags','put','tracked','update','faxinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1740df,_0x27069c){var _0x4c45d0=function(_0x3da545){while(--_0x3da545){_0x1740df['push'](_0x1740df['shift']());}};_0x4c45d0(++_0x27069c);}(_0x9f5b,0xcb));var _0xb9f5=function(_0x5f2ed0,_0xaf721b){_0x5f2ed0=_0x5f2ed0-0x0;var _0x4f2eed=_0x9f5b[_0x5f2ed0];return _0x4f2eed;};'use strict';var multer=require(_0xb9f5('0x0'));var util=require(_0xb9f5('0x1'));var path=require(_0xb9f5('0x2'));var timeout=require(_0xb9f5('0x3'));var express=require(_0xb9f5('0x4'));var router=express[_0xb9f5('0x5')]();var fs_extra=require(_0xb9f5('0x6'));var auth=require(_0xb9f5('0x7'));var interaction=require(_0xb9f5('0x8'));var config=require(_0xb9f5('0x9'));var controller=require(_0xb9f5('0xa'));router[_0xb9f5('0xb')]('/',auth[_0xb9f5('0xc')](),controller['index']);router[_0xb9f5('0xb')]('/describe',auth[_0xb9f5('0xc')](),controller[_0xb9f5('0xd')]);router[_0xb9f5('0xb')](_0xb9f5('0xe'),auth[_0xb9f5('0xc')](),controller[_0xb9f5('0xf')]);router[_0xb9f5('0xb')](_0xb9f5('0x10'),auth[_0xb9f5('0xc')](),controller[_0xb9f5('0x11')]);router[_0xb9f5('0xb')](_0xb9f5('0x12'),auth[_0xb9f5('0xc')](),controller[_0xb9f5('0x13')]);router[_0xb9f5('0x14')]('/',auth['isAuthenticated'](),controller[_0xb9f5('0x15')]);router[_0xb9f5('0x14')](_0xb9f5('0x10'),auth[_0xb9f5('0xc')](),controller[_0xb9f5('0x16')]);router['post']('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0xb9f5('0x17'),_0xb9f5('0x18')),controller[_0xb9f5('0x19')]);router[_0xb9f5('0x1a')](_0xb9f5('0xe'),auth[_0xb9f5('0xc')](),interaction[_0xb9f5('0x1b')]('fax','faxinteraction:update'),controller[_0xb9f5('0x1c')]);router['delete'](_0xb9f5('0xe'),auth[_0xb9f5('0xc')](),interaction['tracked'](_0xb9f5('0x17'),_0xb9f5('0x1d')),controller[_0xb9f5('0x1e')]);router[_0xb9f5('0x1f')](_0xb9f5('0x20'),auth[_0xb9f5('0xc')](),controller[_0xb9f5('0x21')]);module[_0xb9f5('0x22')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 7a4ee29..1425d1e 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 _0xc036=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0x50eab9,_0x1a6d00){var _0x102a2f=function(_0x5af23c){while(--_0x5af23c){_0x50eab9['push'](_0x50eab9['shift']());}};_0x102a2f(++_0x1a6d00);}(_0xc036,0x1e4));var _0x6c03=function(_0x12fb2c,_0xad4eb9){_0x12fb2c=_0x12fb2c-0x0;var _0x1431cf=_0xc036[_0x12fb2c];return _0x1431cf;};'use strict';var Sequelize=require(_0x6c03('0x0'));module[_0x6c03('0x1')]={'body':{'type':Sequelize[_0x6c03('0x2')](_0x6c03('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x6c03('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x6c03('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x6c03('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x6c03('0x6')]}}; \ No newline at end of file +var _0x53fc=['out','TEXT','DATE','ENUM'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x53fc,0xa3));var _0xc53f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x53fc[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xc53f('0x0')]('in',_0xc53f('0x1')),'defaultValue':_0xc53f('0x1'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xc53f('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xc53f('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 53880d5..a99365a 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 _0xb247=['rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','http','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','include','rows','show','params','includeAll','options','body','describe','fax-interactions','accept','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','CmContact','Contact','get','FaxInteraction','find','FaxInteractionId','isNil','user','interaction','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','fax','role','null','format','rejectmessage','create','findOne','ContactId','AttachmentId','SendFax','basename','server','files','attachments','Attachment','join','html-pdf','eml-format'];(function(_0x19d423,_0x56ee41){var _0x5f43d9=function(_0x587ba7){while(--_0x587ba7){_0x19d423['push'](_0x19d423['shift']());}};_0x5f43d9(++_0x56ee41);}(_0xb247,0x17e));var _0x7b24=function(_0xf71d98,_0x51e619){_0xf71d98=_0xf71d98-0x0;var _0x3fec71=_0xb247[_0xf71d98];return _0x3fec71;};'use strict';var pdf=require(_0x7b24('0x0'));var emlformat=require(_0x7b24('0x1'));var rimraf=require(_0x7b24('0x2'));var zipdir=require(_0x7b24('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b24('0x4'));var moment=require('moment');var BPromise=require(_0x7b24('0x5'));var Mustache=require(_0x7b24('0x6'));var util=require(_0x7b24('0x7'));var path=require(_0x7b24('0x8'));var sox=require(_0x7b24('0x9'));var csv=require(_0x7b24('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b24('0xb'));var _=require(_0x7b24('0xc'));var squel=require(_0x7b24('0xd'));var crypto=require('crypto');var jsforce=require(_0x7b24('0xe'));var deskjs=require(_0x7b24('0xf'));var toCsv=require(_0x7b24('0xa'));var querystring=require(_0x7b24('0x10'));var Papa=require(_0x7b24('0x11'));var Redis=require(_0x7b24('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7b24('0x13'));var as=require(_0x7b24('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b24('0x15'))(_0x7b24('0x16'));var utils=require(_0x7b24('0x17'));var config=require(_0x7b24('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x7b24('0x19')](config[_0x7b24('0x1a')],{'host':_0x7b24('0x1b'),'port':0x18eb});var socket=require(_0x7b24('0x1c'))(new Redis(config['redis']));require(_0x7b24('0x1d'))[_0x7b24('0x1e')](socket);var jayson=require(_0x7b24('0x1f'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0x7b24('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x284b8b,_0x3b5a72,_0x3ec751,_0xdbbf8b){return new BPromise(function(_0x3a1f8d,_0x131827){var _0x3430ec=_0xdbbf8b||client;return _0x3430ec['request'](_0x284b8b,_0x3ec751)[_0x7b24('0x21')](function(_0x59fe27){logger[_0x7b24('0x22')](_0x7b24('0x23'),_0x3b5a72,_0x7b24('0x24'));logger[_0x7b24('0x25')](_0x7b24('0x26'),_0x3b5a72,_0x7b24('0x24'),JSON[_0x7b24('0x27')](_0x59fe27));if(_0x59fe27['error']){if(_0x59fe27[_0x7b24('0x28')][_0x7b24('0x29')]===0x1f4){logger[_0x7b24('0x28')](_0x7b24('0x23'),_0x3b5a72,_0x59fe27[_0x7b24('0x28')][_0x7b24('0x2a')]);return _0x131827(_0x59fe27[_0x7b24('0x28')][_0x7b24('0x2a')]);}logger[_0x7b24('0x28')](_0x7b24('0x23'),_0x3b5a72,_0x59fe27[_0x7b24('0x28')]['message']);return _0x3a1f8d(_0x59fe27[_0x7b24('0x28')][_0x7b24('0x2a')]);}else{logger[_0x7b24('0x22')](_0x7b24('0x23'),_0x3b5a72,_0x7b24('0x24'));_0x3a1f8d(_0x59fe27[_0x7b24('0x2b')][_0x7b24('0x2a')]);}})[_0x7b24('0x2c')](function(_0x1a0421){logger[_0x7b24('0x28')](_0x7b24('0x23'),_0x3b5a72,_0x1a0421);_0x131827(_0x1a0421);});});}function respondWithStatusCode(_0x26e978,_0x1d76a3){_0x1d76a3=_0x1d76a3||0xcc;return function(_0x372996){if(_0x372996){return _0x26e978[_0x7b24('0x2d')](_0x1d76a3);}return _0x26e978[_0x7b24('0x2e')](_0x1d76a3)['end']();};}function respondWithResult(_0x2b8eac,_0x11a89b){_0x11a89b=_0x11a89b||0xc8;return function(_0x55349d){if(_0x55349d){return _0x2b8eac[_0x7b24('0x2e')](_0x11a89b)[_0x7b24('0x2f')](_0x55349d);}};}function respondWithFilteredResult(_0x309734,_0x10cc76){return function(_0x1c426e){if(_0x1c426e){var _0x3ecc42=_0x1c426e[_0x7b24('0x30')],_0x29eab8=_0x10cc76[_0x7b24('0x31')],_0x3333a8=_0x10cc76[_0x7b24('0x31')]+_0x10cc76[_0x7b24('0x32')],_0x5ab7fc;if(_0x3333a8>=_0x3ecc42){_0x3333a8=_0x3ecc42;_0x5ab7fc=0xc8;}else{_0x5ab7fc=0xce;}_0x309734[_0x7b24('0x2e')](_0x5ab7fc);return _0x309734[_0x7b24('0x33')](_0x7b24('0x34'),_0x29eab8+'-'+_0x3333a8+'/'+_0x3ecc42)[_0x7b24('0x2f')](_0x1c426e);}return null;};}function patchUpdates(_0x420d53){return function(_0x266000){try{jsonpatch[_0x7b24('0x35')](_0x266000,_0x420d53,!![]);}catch(_0x45ad32){return BPromise[_0x7b24('0x36')](_0x45ad32);}return _0x266000[_0x7b24('0x37')]();};}function saveUpdates(_0x30f1f7,_0x4cc0ea){return function(_0x51efae){if(_0x51efae){return _0x51efae[_0x7b24('0x38')](_0x30f1f7)['then'](function(_0x267871){return _0x267871;});}return null;};}function removeEntity(_0x4ce394,_0x1da671){return function(_0x4c0b28){if(_0x4c0b28){return _0x4c0b28[_0x7b24('0x39')]()['then'](function(){_0x4ce394[_0x7b24('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e3479,_0x591b91){return function(_0x3ea961){if(!_0x3ea961){_0x1e3479[_0x7b24('0x2d')](0x194);}return _0x3ea961;};}function handleError(_0x2f76f6,_0x5bf939){_0x5bf939=_0x5bf939||0x1f4;return function(_0x334910){logger[_0x7b24('0x28')](_0x334910[_0x7b24('0x3a')]);if(_0x334910[_0x7b24('0x3b')]){delete _0x334910[_0x7b24('0x3b')];}_0x2f76f6['status'](_0x5bf939)['send'](_0x334910);};}exports['index']=function(_0x20803d,_0x462d20){var _0x1a62e8={},_0x3a3728={},_0xf31b47={'count':0x0,'rows':[]};var _0x5513cb=_[_0x7b24('0x3c')](db[_0x7b24('0x3d')][_0x7b24('0x3e')],function(_0x34caf3){return{'name':_0x34caf3[_0x7b24('0x3f')],'type':_0x34caf3[_0x7b24('0x40')][_0x7b24('0x41')]};});_0x3a3728[_0x7b24('0x42')]=_[_0x7b24('0x3c')](_0x5513cb,_0x7b24('0x3b'));_0x3a3728[_0x7b24('0x43')]=_[_0x7b24('0x44')](_0x20803d[_0x7b24('0x43')]);_0x3a3728[_0x7b24('0x45')]=_[_0x7b24('0x46')](_0x3a3728[_0x7b24('0x42')],_0x3a3728['query']);_0x1a62e8[_0x7b24('0x47')]=_['intersection'](_0x3a3728[_0x7b24('0x42')],qs[_0x7b24('0x48')](_0x20803d[_0x7b24('0x43')][_0x7b24('0x48')]));_0x1a62e8[_0x7b24('0x47')]=_0x1a62e8[_0x7b24('0x47')][_0x7b24('0x49')]?_0x1a62e8[_0x7b24('0x47')]:_0x3a3728[_0x7b24('0x42')];if(!_0x20803d['query']['hasOwnProperty'](_0x7b24('0x4a'))){_0x1a62e8[_0x7b24('0x32')]=qs[_0x7b24('0x32')](_0x20803d[_0x7b24('0x43')][_0x7b24('0x32')]);_0x1a62e8['offset']=qs[_0x7b24('0x31')](_0x20803d['query'][_0x7b24('0x31')]);}_0x1a62e8[_0x7b24('0x4b')]=qs[_0x7b24('0x4c')](_0x20803d['query']['sort']);_0x1a62e8[_0x7b24('0x4d')]=qs['filters'](_[_0x7b24('0x4e')](_0x20803d['query'],_0x3a3728[_0x7b24('0x45')]),_0x5513cb);if(_0x20803d['query'][_0x7b24('0x4f')]){_0x1a62e8[_0x7b24('0x4d')]=_['merge'](_0x1a62e8[_0x7b24('0x4d')],{'$or':_[_0x7b24('0x3c')](_0x5513cb,function(_0x320ca6){if(_0x320ca6[_0x7b24('0x40')]!=='VIRTUAL'){var _0xfb3d61={};_0xfb3d61[_0x320ca6[_0x7b24('0x3b')]]={'$like':'%'+_0x20803d['query'][_0x7b24('0x4f')]+'%'};return _0xfb3d61;}})});}_0x1a62e8=_[_0x7b24('0x50')]({},_0x1a62e8,_0x20803d['options']);var _0x43daa8={'where':_0x1a62e8['where']};return db[_0x7b24('0x3d')][_0x7b24('0x30')](_0x43daa8)[_0x7b24('0x21')](function(_0x59689e){_0xf31b47[_0x7b24('0x30')]=_0x59689e;if(_0x20803d['query']['includeAll']){_0x1a62e8[_0x7b24('0x51')]=[{'all':!![]}];}return db[_0x7b24('0x3d')]['findAll'](_0x1a62e8);})[_0x7b24('0x21')](function(_0xa8de4){_0xf31b47[_0x7b24('0x52')]=_0xa8de4;return _0xf31b47;})[_0x7b24('0x21')](respondWithFilteredResult(_0x462d20,_0x1a62e8))[_0x7b24('0x2c')](handleError(_0x462d20,null));};exports[_0x7b24('0x53')]=function(_0x20d9fa,_0x517fa5){var _0x573f1d={'raw':!![],'where':{'id':_0x20d9fa[_0x7b24('0x54')]['id']}},_0x1ce47a={};_0x1ce47a[_0x7b24('0x42')]=_[_0x7b24('0x44')](db[_0x7b24('0x3d')][_0x7b24('0x3e')]);_0x1ce47a[_0x7b24('0x43')]=_[_0x7b24('0x44')](_0x20d9fa['query']);_0x1ce47a[_0x7b24('0x45')]=_[_0x7b24('0x46')](_0x1ce47a['model'],_0x1ce47a[_0x7b24('0x43')]);_0x573f1d[_0x7b24('0x47')]=_[_0x7b24('0x46')](_0x1ce47a['model'],qs['fields'](_0x20d9fa['query'][_0x7b24('0x48')]));_0x573f1d['attributes']=_0x573f1d[_0x7b24('0x47')][_0x7b24('0x49')]?_0x573f1d[_0x7b24('0x47')]:_0x1ce47a['model'];if(_0x20d9fa['query'][_0x7b24('0x55')]){_0x573f1d[_0x7b24('0x51')]=[{'all':!![]}];}_0x573f1d=_[_0x7b24('0x50')]({},_0x573f1d,_0x20d9fa[_0x7b24('0x56')]);return db[_0x7b24('0x3d')]['find'](_0x573f1d)[_0x7b24('0x21')](handleEntityNotFound(_0x517fa5,null))[_0x7b24('0x21')](respondWithResult(_0x517fa5,null))[_0x7b24('0x2c')](handleError(_0x517fa5,null));};exports[_0x7b24('0x38')]=function(_0x1fc3f1,_0x49e517){if(_0x1fc3f1[_0x7b24('0x57')]['id']){delete _0x1fc3f1['body']['id'];}return db[_0x7b24('0x3d')]['find']({'where':{'id':_0x1fc3f1[_0x7b24('0x54')]['id']}})[_0x7b24('0x21')](handleEntityNotFound(_0x49e517,null))[_0x7b24('0x21')](saveUpdates(_0x1fc3f1[_0x7b24('0x57')],null))['then'](respondWithResult(_0x49e517,null))['catch'](handleError(_0x49e517,null));};exports[_0x7b24('0x39')]=function(_0x5de22f,_0x53a24c){return db[_0x7b24('0x3d')]['find']({'where':{'id':_0x5de22f[_0x7b24('0x54')]['id']}})['then'](handleEntityNotFound(_0x53a24c,null))['then'](removeEntity(_0x53a24c,null))[_0x7b24('0x2c')](handleError(_0x53a24c,null));};exports['describe']=function(_0x2ea4f4,_0x50ba9b){return db[_0x7b24('0x3d')][_0x7b24('0x58')]()['then'](respondWithResult(_0x50ba9b,null))['catch'](handleError(_0x50ba9b,null));};var interaction_log=require(_0x7b24('0x15'))(_0x7b24('0x59'));exports[_0x7b24('0x5a')]=function(_0x2b7ee0,_0x4d3f0d,_0xe7ca0a){var _0x1e0fe1={'agent':{},'channel':'fax'};if(_0x2b7ee0[_0x7b24('0x57')]['id']){delete _0x2b7ee0['body']['id'];}_0x2b7ee0[_0x7b24('0x57')]['read']=!![];_0x2b7ee0[_0x7b24('0x57')][_0x7b24('0x5b')]=moment()['format'](_0x7b24('0x5c'));_0x2b7ee0[_0x7b24('0x57')][_0x7b24('0x5d')]=_0x2b7ee0[_0x7b24('0x57')]['UserId']||_0x2b7ee0['user']['id'];_0x1e0fe1[_0x7b24('0x5e')]['id']=_0x2b7ee0[_0x7b24('0x57')][_0x7b24('0x5d')];return db[_0x7b24('0x3d')]['find']({'where':{'id':_0x2b7ee0[_0x7b24('0x54')]['id'],'UserId':null},'include':[{'model':db[_0x7b24('0x5f')],'as':_0x7b24('0x60')}]})[_0x7b24('0x21')](handleEntityNotFound(_0x4d3f0d,null))['then'](saveUpdates(_0x2b7ee0[_0x7b24('0x57')],null))[_0x7b24('0x21')](function(_0x4981a5){if(_0x4981a5){_0x1e0fe1[_0x7b24('0x2a')]=_0x4981a5[_0x7b24('0x61')]({'plain':!![]});return db[_0x7b24('0x62')][_0x7b24('0x63')]({'where':{'id':_0x4981a5[_0x7b24('0x64')]}});}return null;})[_0x7b24('0x21')](handleEntityNotFound(_0x4d3f0d,null))[_0x7b24('0x21')](function(_0x47e45f){if(_0x47e45f){return _0x47e45f[_0x7b24('0x38')]({'UserId':_0x2b7ee0[_0x7b24('0x57')][_0x7b24('0x5d')],'read1stAt':_[_0x7b24('0x65')](_0x47e45f['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x7b24('0x21')](function(_0x265768){if(_0x265768){_0x1e0fe1['interaction']=_0x265768[_0x7b24('0x61')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2b7ee0[_0x7b24('0x66')]['id'],_0x2b7ee0[_0x7b24('0x66')][_0x7b24('0x3b')],_0x2b7ee0[_0x7b24('0x66')]['role'],_0x1e0fe1[_0x7b24('0x67')]['id'],_0x2b7ee0[_0x7b24('0x57')]?JSON[_0x7b24('0x27')](_0x2b7ee0[_0x7b24('0x57')]):'null');return respondWithRpcPromise('AcceptMessage',_0x7b24('0x68'),_0x1e0fe1);}return null;})['then'](function(_0x476ef1){if(_0x476ef1){if(_0x2b7ee0[_0x7b24('0x57')][_0x7b24('0x69')]){_0x1e0fe1['message'][_0x7b24('0x6a')]=util['format'](_0x7b24('0x6b'),_0x2b7ee0[_0x7b24('0x66')][_0x7b24('0x3b')]);_0x1e0fe1[_0x7b24('0x2a')][_0x7b24('0x6c')]=_0x1e0fe1[_0x7b24('0x6c')];_0x1e0fe1[_0x7b24('0x2a')][_0x7b24('0x6d')]=_0x7b24('0x5a');return respondWithRpcPromise(_0x7b24('0x6e'),_0x7b24('0x6e'),{'event':_0x7b24('0x6f'),'message':_0x1e0fe1[_0x7b24('0x2a')]},client9002)[_0x7b24('0x21')](function(){return _0x1e0fe1;});}return _0x1e0fe1;}return null;})[_0x7b24('0x21')](respondWithResult(_0x4d3f0d,null))['catch'](handleError(_0x4d3f0d,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x7b24('0x36')]=function(_0x4d1f70,_0x18e139,_0x4de710){var _0x1a5e24={'agent':{},'channel':_0x7b24('0x70')};if(_0x4d1f70[_0x7b24('0x57')]['id']){delete _0x4d1f70[_0x7b24('0x57')]['id'];}_0x4d1f70[_0x7b24('0x57')]['UserId']=_0x4d1f70[_0x7b24('0x57')][_0x7b24('0x5d')]||_0x4d1f70[_0x7b24('0x66')]['id'];_0x1a5e24[_0x7b24('0x5e')]['id']=_0x4d1f70[_0x7b24('0x57')][_0x7b24('0x5d')];return db[_0x7b24('0x3d')][_0x7b24('0x63')]({'where':{'id':_0x4d1f70[_0x7b24('0x54')]['id'],'UserId':null}})[_0x7b24('0x21')](handleEntityNotFound(_0x18e139,null))[_0x7b24('0x21')](function(_0xd5c612){if(_0xd5c612){_0x1a5e24[_0x7b24('0x2a')]=_0xd5c612[_0x7b24('0x61')]({'plain':!![]});return db['FaxInteraction'][_0x7b24('0x63')]({'where':{'id':_0xd5c612[_0x7b24('0x64')]}});}return null;})[_0x7b24('0x21')](handleEntityNotFound(_0x18e139,null))['then'](function(_0x4bd2cb){if(_0x4bd2cb){_0x1a5e24['interaction']=_0x4bd2cb[_0x7b24('0x61')]({'plain':!![]});interaction_log[_0x7b24('0x22')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4d1f70['user']['id'],_0x4d1f70[_0x7b24('0x66')]['name'],_0x4d1f70[_0x7b24('0x66')][_0x7b24('0x71')],_0x1a5e24[_0x7b24('0x67')]['id'],_0x4d1f70['body']?JSON[_0x7b24('0x27')](_0x4d1f70[_0x7b24('0x57')]):_0x7b24('0x72'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x1a5e24);}return null;})[_0x7b24('0x21')](function(_0x2a78d4){if(_0x2a78d4){_0x2a78d4[_0x7b24('0x2a')][_0x7b24('0x6a')]=util[_0x7b24('0x73')](_0x7b24('0x6b'),_0x4d1f70[_0x7b24('0x66')][_0x7b24('0x3b')]);_0x2a78d4['message'][_0x7b24('0x6c')]=_0x1a5e24[_0x7b24('0x6c')];_0x2a78d4[_0x7b24('0x2a')]['event']='reject';respondWithRpcPromise(_0x7b24('0x6e'),_0x7b24('0x6e'),{'event':_0x7b24('0x74'),'message':_0x2a78d4[_0x7b24('0x2a')]},client9002);return _0x1a5e24;}return null;})[_0x7b24('0x21')](respondWithResult(_0x18e139,null))['catch'](handleError(_0x18e139,null));};exports['create']=function(_0x248f7a,_0x4277fe){var _0x338c2a;return db[_0x7b24('0x3d')][_0x7b24('0x75')](_0x248f7a[_0x7b24('0x57')],{})[_0x7b24('0x21')](function(_0x1601ca){_0x338c2a=_0x1601ca;return db[_0x7b24('0x5f')][_0x7b24('0x76')]({'where':{'id':_0x338c2a[_0x7b24('0x77')]}});})[_0x7b24('0x21')](function(_0x4a6cb9){if(_['isNil'](_0x4a6cb9)){return;}else{_0x338c2a[_0x7b24('0x70')]=_0x4a6cb9[_0x7b24('0x70')];return db['Attachment']['findOne']({'where':{'id':_0x338c2a[_0x7b24('0x78')]}});}})[_0x7b24('0x21')](function(_0x4f3ed2){return respondWithRpcPromise(_0x7b24('0x79'),_0x7b24('0x79'),{'FaxAccountId':_['isNil'](_0x248f7a[_0x7b24('0x57')])?undefined:_0x248f7a[_0x7b24('0x57')]['FaxAccountId'],'path':_[_0x7b24('0x65')](_0x4f3ed2)?undefined:util[_0x7b24('0x73')]('/var/opt/motion2/server/files/attachments/%s',_0x4f3ed2[_0x7b24('0x7a')]),'fax':_[_0x7b24('0x65')](_0x338c2a[_0x7b24('0x70')])?undefined:_0x338c2a[_0x7b24('0x70')],'AttachmentId':_0x338c2a[_0x7b24('0x78')]},client9002);})[_0x7b24('0x21')](respondWithResult(_0x4277fe,0xc9))[_0x7b24('0x2c')](handleError(_0x4277fe,null));};exports['download']=function(_0x2248ad,_0x92e822){var _0x1438e4=path['join'](config['root'],_0x7b24('0x7b'),_0x7b24('0x7c'),_0x7b24('0x7d'));return db[_0x7b24('0x3d')][_0x7b24('0x63')]({'where':{'id':_0x2248ad[_0x7b24('0x54')]['id']},'include':[{'model':db[_0x7b24('0x7e')],'as':_0x7b24('0x7e')}]})[_0x7b24('0x21')](handleEntityNotFound(_0x92e822,null))[_0x7b24('0x21')](function(_0xe0998c){if(_0xe0998c){return _0x92e822['download'](path[_0x7b24('0x7f')](_0x1438e4,_0xe0998c['Attachment']['basename']));}})[_0x7b24('0x2c')](handleError(_0x92e822,null));}; \ No newline at end of file +var _0xb51c=['acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','get','role','rejectmessage','create','findOne','ContactId','Attachment','AttachmentId','SendFax','isNil','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','root','server','files','attachments','join','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','register','jayson/promise','client','http','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','attributes','intersection','fields','query','nolimit','order','sort','where','pick','merge','VIRTUAL','name','filter','options','FaxMessage','include','findAll','rows','show','params','includeAll','find','body','describe','fax-interactions','accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','FaxInteraction','FaxInteractionId','format','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','AcceptMessage'];(function(_0x1de41b,_0x1ddfe9){var _0x58d016=function(_0x5bdd66){while(--_0x5bdd66){_0x1de41b['push'](_0x1de41b['shift']());}};_0x58d016(++_0x1ddfe9);}(_0xb51c,0x12a));var _0xcb51=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xb51c[_0x5c351c];return _0x26f3b3;};'use strict';var pdf=require(_0xcb51('0x0'));var emlformat=require(_0xcb51('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xcb51('0x2'));var jsonpatch=require(_0xcb51('0x3'));var rp=require(_0xcb51('0x4'));var moment=require('moment');var BPromise=require(_0xcb51('0x5'));var Mustache=require(_0xcb51('0x6'));var util=require(_0xcb51('0x7'));var path=require(_0xcb51('0x8'));var sox=require(_0xcb51('0x9'));var csv=require(_0xcb51('0xa'));var ejs=require(_0xcb51('0xb'));var fs=require('fs');var fs_extra=require(_0xcb51('0xc'));var _=require(_0xcb51('0xd'));var squel=require(_0xcb51('0xe'));var crypto=require('crypto');var jsforce=require(_0xcb51('0xf'));var deskjs=require(_0xcb51('0x10'));var toCsv=require(_0xcb51('0xa'));var querystring=require(_0xcb51('0x11'));var Papa=require(_0xcb51('0x12'));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(_0xcb51('0x13'));var logger=require(_0xcb51('0x14'))(_0xcb51('0x15'));var utils=require('../../config/utils');var config=require(_0xcb51('0x16'));var licenseUtil=require(_0xcb51('0x17'));var db=require(_0xcb51('0x18'))['db'];config['redis']=_[_0xcb51('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcb51('0x1a'))(new Redis(config['redis']));require('./faxMessage.socket')[_0xcb51('0x1b')](socket);var jayson=require(_0xcb51('0x1c'));var client=jayson[_0xcb51('0x1d')][_0xcb51('0x1e')]({'port':0x232c});var client9002=jayson[_0xcb51('0x1d')][_0xcb51('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3cb3e0,_0x3cd88b,_0x395031,_0x3d1ded){return new BPromise(function(_0x1bb968,_0x4f8269){var _0x440538=_0x3d1ded||client;return _0x440538['request'](_0x3cb3e0,_0x395031)['then'](function(_0x249815){logger[_0xcb51('0x1f')](_0xcb51('0x20'),_0x3cd88b,_0xcb51('0x21'));logger[_0xcb51('0x22')](_0xcb51('0x23'),_0x3cd88b,_0xcb51('0x21'),JSON[_0xcb51('0x24')](_0x249815));if(_0x249815[_0xcb51('0x25')]){if(_0x249815[_0xcb51('0x25')][_0xcb51('0x26')]===0x1f4){logger[_0xcb51('0x25')](_0xcb51('0x20'),_0x3cd88b,_0x249815['error']['message']);return _0x4f8269(_0x249815[_0xcb51('0x25')][_0xcb51('0x27')]);}logger[_0xcb51('0x25')]('FaxMessage,\x20%s,\x20%s',_0x3cd88b,_0x249815[_0xcb51('0x25')][_0xcb51('0x27')]);return _0x1bb968(_0x249815[_0xcb51('0x25')]['message']);}else{logger[_0xcb51('0x1f')](_0xcb51('0x20'),_0x3cd88b,'request\x20sent');_0x1bb968(_0x249815['result'][_0xcb51('0x27')]);}})[_0xcb51('0x28')](function(_0x3167fa){logger['error']('FaxMessage,\x20%s,\x20%s',_0x3cd88b,_0x3167fa);_0x4f8269(_0x3167fa);});});}function respondWithStatusCode(_0x39c59d,_0x20b4a0){_0x20b4a0=_0x20b4a0||0xcc;return function(_0x31353c){if(_0x31353c){return _0x39c59d['sendStatus'](_0x20b4a0);}return _0x39c59d[_0xcb51('0x29')](_0x20b4a0)[_0xcb51('0x2a')]();};}function respondWithResult(_0x17e63f,_0x2b9cfe){_0x2b9cfe=_0x2b9cfe||0xc8;return function(_0x50623a){if(_0x50623a){return _0x17e63f[_0xcb51('0x29')](_0x2b9cfe)[_0xcb51('0x2b')](_0x50623a);}};}function respondWithFilteredResult(_0x30a803,_0x18ec1f){return function(_0x42e2e9){if(_0x42e2e9){var _0x20b4bb=_0x42e2e9[_0xcb51('0x2c')],_0x30dc96=_0x18ec1f[_0xcb51('0x2d')],_0x9bd3de=_0x18ec1f[_0xcb51('0x2d')]+_0x18ec1f[_0xcb51('0x2e')],_0x548eb5;if(_0x9bd3de>=_0x20b4bb){_0x9bd3de=_0x20b4bb;_0x548eb5=0xc8;}else{_0x548eb5=0xce;}_0x30a803[_0xcb51('0x29')](_0x548eb5);return _0x30a803[_0xcb51('0x2f')](_0xcb51('0x30'),_0x30dc96+'-'+_0x9bd3de+'/'+_0x20b4bb)['json'](_0x42e2e9);}return null;};}function patchUpdates(_0x1f7371){return function(_0x532a54){try{jsonpatch[_0xcb51('0x31')](_0x532a54,_0x1f7371,!![]);}catch(_0x3a4fc8){return BPromise[_0xcb51('0x32')](_0x3a4fc8);}return _0x532a54[_0xcb51('0x33')]();};}function saveUpdates(_0x16e1a2,_0x33c907){return function(_0x32423b){if(_0x32423b){return _0x32423b[_0xcb51('0x34')](_0x16e1a2)[_0xcb51('0x35')](function(_0x1eda07){return _0x1eda07;});}return null;};}function removeEntity(_0x47a33d,_0x40cef0){return function(_0x1e3086){if(_0x1e3086){return _0x1e3086[_0xcb51('0x36')]()[_0xcb51('0x35')](function(){_0x47a33d[_0xcb51('0x29')](0xcc)[_0xcb51('0x2a')]();});}};}function handleEntityNotFound(_0x257d48,_0x32b52c){return function(_0x4eefbc){if(!_0x4eefbc){_0x257d48[_0xcb51('0x37')](0x194);}return _0x4eefbc;};}function handleError(_0x1e2556,_0x1f1c18){_0x1f1c18=_0x1f1c18||0x1f4;return function(_0x510b0b){logger[_0xcb51('0x25')](_0x510b0b['stack']);if(_0x510b0b['name']){delete _0x510b0b['name'];}_0x1e2556['status'](_0x1f1c18)[_0xcb51('0x38')](_0x510b0b);};}exports[_0xcb51('0x39')]=function(_0x5573b2,_0x21784){var _0x3257ee={},_0x371fe5={},_0x5ea12c={'count':0x0,'rows':[]};var _0x4d81f4=_[_0xcb51('0x3a')](db['FaxMessage'][_0xcb51('0x3b')],function(_0xb51cbf){return{'name':_0xb51cbf[_0xcb51('0x3c')],'type':_0xb51cbf[_0xcb51('0x3d')][_0xcb51('0x3e')]};});_0x371fe5[_0xcb51('0x3f')]=_[_0xcb51('0x3a')](_0x4d81f4,'name');_0x371fe5['query']=_[_0xcb51('0x40')](_0x5573b2['query']);_0x371fe5[_0xcb51('0x41')]=_['intersection'](_0x371fe5[_0xcb51('0x3f')],_0x371fe5['query']);_0x3257ee[_0xcb51('0x42')]=_[_0xcb51('0x43')](_0x371fe5[_0xcb51('0x3f')],qs[_0xcb51('0x44')](_0x5573b2[_0xcb51('0x45')][_0xcb51('0x44')]));_0x3257ee[_0xcb51('0x42')]=_0x3257ee[_0xcb51('0x42')]['length']?_0x3257ee[_0xcb51('0x42')]:_0x371fe5['model'];if(!_0x5573b2[_0xcb51('0x45')]['hasOwnProperty'](_0xcb51('0x46'))){_0x3257ee[_0xcb51('0x2e')]=qs[_0xcb51('0x2e')](_0x5573b2[_0xcb51('0x45')][_0xcb51('0x2e')]);_0x3257ee[_0xcb51('0x2d')]=qs[_0xcb51('0x2d')](_0x5573b2['query']['offset']);}_0x3257ee[_0xcb51('0x47')]=qs[_0xcb51('0x48')](_0x5573b2[_0xcb51('0x45')][_0xcb51('0x48')]);_0x3257ee[_0xcb51('0x49')]=qs['filters'](_[_0xcb51('0x4a')](_0x5573b2[_0xcb51('0x45')],_0x371fe5[_0xcb51('0x41')]),_0x4d81f4);if(_0x5573b2[_0xcb51('0x45')]['filter']){_0x3257ee['where']=_[_0xcb51('0x4b')](_0x3257ee['where'],{'$or':_[_0xcb51('0x3a')](_0x4d81f4,function(_0x2331d6){if(_0x2331d6[_0xcb51('0x3d')]!==_0xcb51('0x4c')){var _0x282831={};_0x282831[_0x2331d6[_0xcb51('0x4d')]]={'$like':'%'+_0x5573b2[_0xcb51('0x45')][_0xcb51('0x4e')]+'%'};return _0x282831;}})});}_0x3257ee=_[_0xcb51('0x4b')]({},_0x3257ee,_0x5573b2[_0xcb51('0x4f')]);var _0x50da5a={'where':_0x3257ee[_0xcb51('0x49')]};return db[_0xcb51('0x50')]['count'](_0x50da5a)[_0xcb51('0x35')](function(_0x9244d4){_0x5ea12c[_0xcb51('0x2c')]=_0x9244d4;if(_0x5573b2[_0xcb51('0x45')]['includeAll']){_0x3257ee[_0xcb51('0x51')]=[{'all':!![]}];}return db[_0xcb51('0x50')][_0xcb51('0x52')](_0x3257ee);})[_0xcb51('0x35')](function(_0x1b0661){_0x5ea12c[_0xcb51('0x53')]=_0x1b0661;return _0x5ea12c;})[_0xcb51('0x35')](respondWithFilteredResult(_0x21784,_0x3257ee))[_0xcb51('0x28')](handleError(_0x21784,null));};exports[_0xcb51('0x54')]=function(_0x1840f8,_0x2fb8e3){var _0x17160e={'raw':!![],'where':{'id':_0x1840f8[_0xcb51('0x55')]['id']}},_0x370d1d={};_0x370d1d[_0xcb51('0x3f')]=_[_0xcb51('0x40')](db['FaxMessage'][_0xcb51('0x3b')]);_0x370d1d['query']=_[_0xcb51('0x40')](_0x1840f8['query']);_0x370d1d[_0xcb51('0x41')]=_[_0xcb51('0x43')](_0x370d1d[_0xcb51('0x3f')],_0x370d1d[_0xcb51('0x45')]);_0x17160e[_0xcb51('0x42')]=_['intersection'](_0x370d1d[_0xcb51('0x3f')],qs['fields'](_0x1840f8[_0xcb51('0x45')]['fields']));_0x17160e['attributes']=_0x17160e[_0xcb51('0x42')]['length']?_0x17160e[_0xcb51('0x42')]:_0x370d1d[_0xcb51('0x3f')];if(_0x1840f8[_0xcb51('0x45')][_0xcb51('0x56')]){_0x17160e[_0xcb51('0x51')]=[{'all':!![]}];}_0x17160e=_['merge']({},_0x17160e,_0x1840f8['options']);return db[_0xcb51('0x50')][_0xcb51('0x57')](_0x17160e)[_0xcb51('0x35')](handleEntityNotFound(_0x2fb8e3,null))[_0xcb51('0x35')](respondWithResult(_0x2fb8e3,null))[_0xcb51('0x28')](handleError(_0x2fb8e3,null));};exports['update']=function(_0x331e8a,_0x505e50){if(_0x331e8a[_0xcb51('0x58')]['id']){delete _0x331e8a[_0xcb51('0x58')]['id'];}return db[_0xcb51('0x50')][_0xcb51('0x57')]({'where':{'id':_0x331e8a[_0xcb51('0x55')]['id']}})[_0xcb51('0x35')](handleEntityNotFound(_0x505e50,null))[_0xcb51('0x35')](saveUpdates(_0x331e8a[_0xcb51('0x58')],null))[_0xcb51('0x35')](respondWithResult(_0x505e50,null))[_0xcb51('0x28')](handleError(_0x505e50,null));};exports[_0xcb51('0x36')]=function(_0x407dd0,_0x15e78f){return db['FaxMessage'][_0xcb51('0x57')]({'where':{'id':_0x407dd0['params']['id']}})['then'](handleEntityNotFound(_0x15e78f,null))[_0xcb51('0x35')](removeEntity(_0x15e78f,null))['catch'](handleError(_0x15e78f,null));};exports[_0xcb51('0x59')]=function(_0x1d63fc,_0x4306ce){return db[_0xcb51('0x50')]['describe']()[_0xcb51('0x35')](respondWithResult(_0x4306ce,null))[_0xcb51('0x28')](handleError(_0x4306ce,null));};var interaction_log=require(_0xcb51('0x14'))(_0xcb51('0x5a'));exports[_0xcb51('0x5b')]=function(_0x467b23,_0x4832c5,_0x4cda28){var _0x21a6ce={'agent':{},'channel':_0xcb51('0x5c')};if(_0x467b23['body']['id']){delete _0x467b23[_0xcb51('0x58')]['id'];}_0x467b23[_0xcb51('0x58')][_0xcb51('0x5d')]=!![];_0x467b23[_0xcb51('0x58')][_0xcb51('0x5e')]=moment()['format'](_0xcb51('0x5f'));_0x467b23[_0xcb51('0x58')][_0xcb51('0x60')]=_0x467b23[_0xcb51('0x58')]['UserId']||_0x467b23[_0xcb51('0x61')]['id'];_0x21a6ce['agent']['id']=_0x467b23[_0xcb51('0x58')][_0xcb51('0x60')];return db[_0xcb51('0x50')][_0xcb51('0x57')]({'where':{'id':_0x467b23[_0xcb51('0x55')]['id'],'UserId':null},'include':[{'model':db[_0xcb51('0x62')],'as':_0xcb51('0x63')}]})[_0xcb51('0x35')](handleEntityNotFound(_0x4832c5,null))[_0xcb51('0x35')](saveUpdates(_0x467b23[_0xcb51('0x58')],null))[_0xcb51('0x35')](function(_0x564a84){if(_0x564a84){_0x21a6ce['message']=_0x564a84['get']({'plain':!![]});return db[_0xcb51('0x64')][_0xcb51('0x57')]({'where':{'id':_0x564a84[_0xcb51('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x4832c5,null))[_0xcb51('0x35')](function(_0x5e075b){if(_0x5e075b){return _0x5e075b['update']({'UserId':_0x467b23[_0xcb51('0x58')][_0xcb51('0x60')],'read1stAt':_['isNil'](_0x5e075b['read1stAt'])?moment()[_0xcb51('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xcb51('0x35')](function(_0x51c559){if(_0x51c559){_0x21a6ce['interaction']=_0x51c559['get']({'plain':!![]});interaction_log[_0xcb51('0x1f')](_0xcb51('0x67'),_0x467b23['user']['id'],_0x467b23['user'][_0xcb51('0x4d')],_0x467b23[_0xcb51('0x61')]['role'],_0x21a6ce[_0xcb51('0x68')]['id'],_0x467b23[_0xcb51('0x58')]?JSON[_0xcb51('0x24')](_0x467b23[_0xcb51('0x58')]):_0xcb51('0x69'));return respondWithRpcPromise(_0xcb51('0x6a'),_0xcb51('0x6b'),_0x21a6ce);}return null;})['then'](function(_0x15cb2f){if(_0x15cb2f){if(_0x467b23['body'][_0xcb51('0x6c')]){_0x21a6ce[_0xcb51('0x27')][_0xcb51('0x6d')]=util[_0xcb51('0x66')](_0xcb51('0x6e'),_0x467b23[_0xcb51('0x61')][_0xcb51('0x4d')]);_0x21a6ce[_0xcb51('0x27')][_0xcb51('0x6f')]=_0x21a6ce[_0xcb51('0x6f')];_0x21a6ce[_0xcb51('0x27')][_0xcb51('0x70')]=_0xcb51('0x5b');return respondWithRpcPromise(_0xcb51('0x71'),'EventManager',{'event':_0xcb51('0x72'),'message':_0x21a6ce[_0xcb51('0x27')]},client9002)[_0xcb51('0x35')](function(){return _0x21a6ce;});}return _0x21a6ce;}return null;})['then'](respondWithResult(_0x4832c5,null))[_0xcb51('0x28')](handleError(_0x4832c5,null));};var interaction_log=require('../../config/logger')(_0xcb51('0x5a'));exports[_0xcb51('0x32')]=function(_0x4e83ed,_0x348700,_0xa450b9){var _0x348a21={'agent':{},'channel':_0xcb51('0x5c')};if(_0x4e83ed[_0xcb51('0x58')]['id']){delete _0x4e83ed[_0xcb51('0x58')]['id'];}_0x4e83ed[_0xcb51('0x58')]['UserId']=_0x4e83ed[_0xcb51('0x58')][_0xcb51('0x60')]||_0x4e83ed[_0xcb51('0x61')]['id'];_0x348a21[_0xcb51('0x73')]['id']=_0x4e83ed['body'][_0xcb51('0x60')];return db[_0xcb51('0x50')]['find']({'where':{'id':_0x4e83ed['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x348700,null))[_0xcb51('0x35')](function(_0x8743aa){if(_0x8743aa){_0x348a21[_0xcb51('0x27')]=_0x8743aa[_0xcb51('0x74')]({'plain':!![]});return db[_0xcb51('0x64')]['find']({'where':{'id':_0x8743aa[_0xcb51('0x65')]}});}return null;})[_0xcb51('0x35')](handleEntityNotFound(_0x348700,null))['then'](function(_0x45b597){if(_0x45b597){_0x348a21['interaction']=_0x45b597['get']({'plain':!![]});interaction_log[_0xcb51('0x1f')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4e83ed['user']['id'],_0x4e83ed[_0xcb51('0x61')][_0xcb51('0x4d')],_0x4e83ed[_0xcb51('0x61')][_0xcb51('0x75')],_0x348a21[_0xcb51('0x68')]['id'],_0x4e83ed['body']?JSON[_0xcb51('0x24')](_0x4e83ed[_0xcb51('0x58')]):_0xcb51('0x69'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x348a21);}return null;})[_0xcb51('0x35')](function(_0x1b5908){if(_0x1b5908){_0x1b5908['message'][_0xcb51('0x6d')]=util['format'](_0xcb51('0x6e'),_0x4e83ed['user'][_0xcb51('0x4d')]);_0x1b5908['message'][_0xcb51('0x6f')]=_0x348a21['channel'];_0x1b5908[_0xcb51('0x27')]['event']='reject';respondWithRpcPromise(_0xcb51('0x71'),_0xcb51('0x71'),{'event':_0xcb51('0x76'),'message':_0x1b5908['message']},client9002);return _0x348a21;}return null;})[_0xcb51('0x35')](respondWithResult(_0x348700,null))['catch'](handleError(_0x348700,null));};exports[_0xcb51('0x77')]=function(_0x262d49,_0x33f18f){var _0x3db9a5;return db['FaxMessage'][_0xcb51('0x77')](_0x262d49[_0xcb51('0x58')],{})[_0xcb51('0x35')](function(_0x20fd77){_0x3db9a5=_0x20fd77;return db[_0xcb51('0x62')][_0xcb51('0x78')]({'where':{'id':_0x3db9a5[_0xcb51('0x79')]}});})[_0xcb51('0x35')](function(_0x41e399){if(_['isNil'](_0x41e399)){return;}else{_0x3db9a5[_0xcb51('0x5c')]=_0x41e399[_0xcb51('0x5c')];return db[_0xcb51('0x7a')][_0xcb51('0x78')]({'where':{'id':_0x3db9a5[_0xcb51('0x7b')]}});}})[_0xcb51('0x35')](function(_0x461fe4){return respondWithRpcPromise(_0xcb51('0x7c'),_0xcb51('0x7c'),{'FaxAccountId':_[_0xcb51('0x7d')](_0x262d49[_0xcb51('0x58')])?undefined:_0x262d49[_0xcb51('0x58')][_0xcb51('0x7e')],'path':_[_0xcb51('0x7d')](_0x461fe4)?undefined:util[_0xcb51('0x66')](_0xcb51('0x7f'),_0x461fe4[_0xcb51('0x80')]),'fax':_['isNil'](_0x3db9a5[_0xcb51('0x5c')])?undefined:_0x3db9a5[_0xcb51('0x5c')],'AttachmentId':_0x3db9a5[_0xcb51('0x7b')]},client9002);})[_0xcb51('0x35')](respondWithResult(_0x33f18f,0xc9))['catch'](handleError(_0x33f18f,null));};exports[_0xcb51('0x81')]=function(_0x2040d7,_0x14a27b){var _0x27ddeb=path['join'](config[_0xcb51('0x82')],_0xcb51('0x83'),_0xcb51('0x84'),_0xcb51('0x85'));return db[_0xcb51('0x50')]['find']({'where':{'id':_0x2040d7[_0xcb51('0x55')]['id']},'include':[{'model':db[_0xcb51('0x7a')],'as':_0xcb51('0x7a')}]})[_0xcb51('0x35')](handleEntityNotFound(_0x14a27b,null))[_0xcb51('0x35')](function(_0x4fc95f){if(_0x4fc95f){return _0x14a27b[_0xcb51('0x81')](path[_0xcb51('0x86')](_0x27ddeb,_0x4fc95f[_0xcb51('0x7a')][_0xcb51('0x80')]));}})[_0xcb51('0x28')](handleError(_0x14a27b,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 5db7f32..5424366 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 _0x7217=['emit','hasOwnProperty','hook','exports','events','FaxMessage','setMaxListeners','save','update','remove'];(function(_0x4fe7bb,_0x1bdd1c){var _0x5659cc=function(_0x425c86){while(--_0x425c86){_0x4fe7bb['push'](_0x4fe7bb['shift']());}};_0x5659cc(++_0x1bdd1c);}(_0x7217,0x19e));var _0x7721=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x7217[_0x47a7d0];return _0xb9bd08;};'use strict';var EventEmitter=require(_0x7721('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x7721('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){FaxMessageEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);FaxMessageEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];FaxMessage[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x3e74=['hasOwnProperty','exports','events','FaxMessage','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x4a1b3f,_0x4f28d5){_0x4a1b3f=_0x4a1b3f-0x0;var _0x50c860=_0x3e74[_0x4a1b3f];return _0x50c860;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x43e7('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){FaxMessageEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);FaxMessageEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 4c1d4fc..32f577d 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 _0xf46b=['get','direction','toLowerCase','out','secret','UserId','FaxInteraction','findOne','FaxInteractionId','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxMessage','fti_fax_messages','models'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xf46b,0xc4));var _0xbf46=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xf46b[_0x45d3f0];return _0x314b79;};'use strict';var _=require(_0xbf46('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xbf46('0x1'));var BPromise=require(_0xbf46('0x2'));var rp=require(_0xbf46('0x3'));var fs=require('fs');var path=require(_0xbf46('0x4'));var rimraf=require(_0xbf46('0x5'));var config=require(_0xbf46('0x6'));var attributes=require('./faxMessage.attributes');module[_0xbf46('0x7')]=function(_0xcb42e5,_0x70d09d){return _0xcb42e5[_0xbf46('0x8')](_0xbf46('0x9'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xbf46('0xa'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x8158e,_0x991182,_0x243fd9){var _0x56cb36=_0xcb42e5[_0xbf46('0xb')];var _0xbc2093=_0x8158e[_0xbf46('0xc')]({'plain':!![]});if(_0xbc2093[_0xbf46('0xd')][_0xbf46('0xe')]()==='in'||_0xbc2093[_0xbf46('0xd')]['toLowerCase']()===_0xbf46('0xf')&&!_0xbc2093[_0xbf46('0x10')]&&!_['isNil'](_0xbc2093[_0xbf46('0x11')])){_0x56cb36[_0xbf46('0x12')][_0xbf46('0x13')]({'where':{'id':_0xbc2093[_0xbf46('0x14')]}})['then'](function(_0x580859){if(_0x580859){_0x580859[_0xbf46('0x15')]({'lastMsgAt':_0xbc2093[_0xbf46('0x16')],'lastMsgDirection':_0xbc2093[_0xbf46('0xd')]['toLowerCase']()});}})[_0xbf46('0x17')](function(_0x463839){console[_0xbf46('0x18')](_0x463839);});}_0x243fd9();}},'charset':'utf8mb4','collate':_0xbf46('0x19')});}; \ No newline at end of file +var _0x43e0=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','define','FaxMessage','fti_fax_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','UserId','findOne','FaxInteractionId','then','update','catch','error','utf8mb4_unicode_ci','lodash'];(function(_0x1bfe44,_0x4e410e){var _0x1103cb=function(_0x1e850e){while(--_0x1e850e){_0x1bfe44['push'](_0x1bfe44['shift']());}};_0x1103cb(++_0x4e410e);}(_0x43e0,0x16b));var _0x043e=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x43e0[_0x1b6186];return _0x186121;};'use strict';var _=require(_0x043e('0x0'));var util=require(_0x043e('0x1'));var logger=require(_0x043e('0x2'))(_0x043e('0x3'));var moment=require(_0x043e('0x4'));var BPromise=require(_0x043e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x043e('0x6'));var rimraf=require('rimraf');var config=require(_0x043e('0x7'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0xd22665,_0x45e08e){return _0xd22665[_0x043e('0x8')](_0x043e('0x9'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x043e('0xa'),'fields':[_0x043e('0xb')],'type':_0x043e('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x52764f,_0x514451,_0x7a70a7){var _0x41ea38=_0xd22665['models'];var _0x81bb54=_0x52764f[_0x043e('0xd')]({'plain':!![]});if(_0x81bb54[_0x043e('0xe')][_0x043e('0xf')]()==='in'||_0x81bb54['direction'][_0x043e('0xf')]()===_0x043e('0x10')&&!_0x81bb54[_0x043e('0x11')]&&!_['isNil'](_0x81bb54[_0x043e('0x12')])){_0x41ea38['FaxInteraction'][_0x043e('0x13')]({'where':{'id':_0x81bb54[_0x043e('0x14')]}})[_0x043e('0x15')](function(_0x13c06c){if(_0x13c06c){_0x13c06c[_0x043e('0x16')]({'lastMsgAt':_0x81bb54['createdAt'],'lastMsgDirection':_0x81bb54[_0x043e('0xe')][_0x043e('0xf')]()});}})[_0x043e('0x17')](function(_0x45ef11){console[_0x043e('0x18')](_0x45ef11);});}_0x7a70a7();}},'charset':'utf8mb4','collate':_0x043e('0x19')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 4f0850b..23d37a4 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 _0x3579=['message','result','catch','CreateFaxMessage','create','body','options','debug','stringify','UpdateFaxMessage','FaxMessage','update','where','attributes','limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x5de0c3,_0x3c4052){var _0x4ce27d=function(_0x30e9c7){while(--_0x30e9c7){_0x5de0c3['push'](_0x5de0c3['shift']());}};_0x4ce27d(++_0x3c4052);}(_0x3579,0xa3));var _0x9357=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x3579[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x9357('0x0'));var util=require('util');var moment=require(_0x9357('0x1'));var BPromise=require('bluebird');var rs=require(_0x9357('0x2'));var fs=require('fs');var Redis=require(_0x9357('0x3'));var db=require(_0x9357('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9357('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x9357('0x6')][_0x9357('0x7')]({'port':0x232a});config[_0x9357('0x8')]=_[_0x9357('0x9')](config[_0x9357('0x8')],{'host':_0x9357('0xa'),'port':0x18eb});var socket=require(_0x9357('0xb'))(new Redis(config[_0x9357('0x8')]));require(_0x9357('0xc'))[_0x9357('0xd')](socket);function respondWithRpcPromise(_0x7ec28e,_0x1a9c32,_0x38b840){return new BPromise(function(_0x17f1ff,_0x3f60d3){return client[_0x9357('0xe')](_0x7ec28e,_0x38b840)[_0x9357('0xf')](function(_0x6f2105){logger[_0x9357('0x10')](_0x9357('0x11'),_0x1a9c32,'request\x20sent');logger['debug'](_0x9357('0x12'),_0x1a9c32,_0x9357('0x13'),JSON['stringify'](_0x6f2105));if(_0x6f2105['error']){if(_0x6f2105[_0x9357('0x14')][_0x9357('0x15')]===0x1f4){logger[_0x9357('0x14')](_0x9357('0x11'),_0x1a9c32,_0x6f2105[_0x9357('0x14')]['message']);return _0x3f60d3(_0x6f2105[_0x9357('0x14')][_0x9357('0x16')]);}logger[_0x9357('0x14')](_0x9357('0x11'),_0x1a9c32,_0x6f2105[_0x9357('0x14')][_0x9357('0x16')]);return _0x17f1ff(_0x6f2105[_0x9357('0x14')][_0x9357('0x16')]);}else{logger['info'](_0x9357('0x11'),_0x1a9c32,_0x9357('0x13'));_0x17f1ff(_0x6f2105[_0x9357('0x17')]['message']);}})[_0x9357('0x18')](function(_0x5b159b){logger[_0x9357('0x14')](_0x9357('0x11'),_0x1a9c32,_0x5b159b);_0x3f60d3(_0x5b159b);});});}exports[_0x9357('0x19')]=function(_0x57d53e){var _0x2ecb7a=this;return new Promise(function(_0x1d087d,_0x528f69){return db['FaxMessage'][_0x9357('0x1a')](_0x57d53e[_0x9357('0x1b')],{'raw':_0x57d53e[_0x9357('0x1c')]?_0x57d53e[_0x9357('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x9357('0xf')](function(_0x2bb055){logger[_0x9357('0x10')]('CreateFaxMessage',_0x57d53e);logger[_0x9357('0x1d')]('CreateFaxMessage',_0x57d53e,JSON[_0x9357('0x1e')](_0x2bb055));_0x1d087d(_0x2bb055);})[_0x9357('0x18')](function(_0x4f4331){logger['error'](_0x9357('0x19'),_0x4f4331['message'],_0x57d53e);_0x528f69(_0x2ecb7a[_0x9357('0x14')](0x1f4,_0x4f4331['message']));});});};exports[_0x9357('0x1f')]=function(_0x5f21c2){var _0x21a19c=this;return new Promise(function(_0x24653d,_0x56afd2){return db[_0x9357('0x20')][_0x9357('0x21')](_0x5f21c2[_0x9357('0x1b')],{'raw':_0x5f21c2[_0x9357('0x1c')]?_0x5f21c2[_0x9357('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f21c2[_0x9357('0x1c')]?_0x5f21c2[_0x9357('0x1c')][_0x9357('0x22')]||null:null,'attributes':_0x5f21c2[_0x9357('0x1c')]?_0x5f21c2['options'][_0x9357('0x23')]||null:null,'limit':_0x5f21c2[_0x9357('0x1c')]?_0x5f21c2[_0x9357('0x1c')][_0x9357('0x24')]||null:null})[_0x9357('0xf')](function(_0x15301e){logger[_0x9357('0x10')](_0x9357('0x1f'),_0x5f21c2);logger[_0x9357('0x1d')](_0x9357('0x1f'),_0x5f21c2,JSON['stringify'](_0x15301e));_0x24653d(_0x15301e);})[_0x9357('0x18')](function(_0x32cc99){logger[_0x9357('0x14')](_0x9357('0x1f'),_0x32cc99[_0x9357('0x16')],_0x5f21c2);_0x56afd2(_0x21a19c[_0x9357('0x14')](0x1f4,_0x32cc99[_0x9357('0x16')]));});});}; \ No newline at end of file +var _0x24d1=['localhost','./faxMessage.socket','register','then','FaxMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','create','options','raw','UpdateFaxMessage','body','where','attributes','limit','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','redis','defaults'];(function(_0x18201c,_0x24399f){var _0xdcbc4=function(_0x48046c){while(--_0x48046c){_0x18201c['push'](_0x18201c['shift']());}};_0xdcbc4(++_0x24399f);}(_0x24d1,0x141));var _0x124d=function(_0x4e8440,_0x561ab4){_0x4e8440=_0x4e8440-0x0;var _0x21fcf2=_0x24d1[_0x4e8440];return _0x21fcf2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x124d('0x0'));var BPromise=require(_0x124d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x124d('0x2'));var db=require(_0x124d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x124d('0x4'));var config=require('../../config/environment');var jayson=require(_0x124d('0x5'));var client=jayson[_0x124d('0x6')]['http']({'port':0x232a});config[_0x124d('0x7')]=_[_0x124d('0x8')](config[_0x124d('0x7')],{'host':_0x124d('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x124d('0xa'))[_0x124d('0xb')](socket);function respondWithRpcPromise(_0x175ddb,_0x5b1ddb,_0x154cbb){return new BPromise(function(_0x21fc14,_0x5f325c){return client['request'](_0x175ddb,_0x154cbb)[_0x124d('0xc')](function(_0x55121d){logger['info'](_0x124d('0xd'),_0x5b1ddb,'request\x20sent');logger[_0x124d('0xe')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x5b1ddb,_0x124d('0xf'),JSON[_0x124d('0x10')](_0x55121d));if(_0x55121d[_0x124d('0x11')]){if(_0x55121d[_0x124d('0x11')][_0x124d('0x12')]===0x1f4){logger[_0x124d('0x11')](_0x124d('0xd'),_0x5b1ddb,_0x55121d[_0x124d('0x11')][_0x124d('0x13')]);return _0x5f325c(_0x55121d[_0x124d('0x11')][_0x124d('0x13')]);}logger[_0x124d('0x11')](_0x124d('0xd'),_0x5b1ddb,_0x55121d[_0x124d('0x11')][_0x124d('0x13')]);return _0x21fc14(_0x55121d[_0x124d('0x11')][_0x124d('0x13')]);}else{logger[_0x124d('0x14')](_0x124d('0xd'),_0x5b1ddb,_0x124d('0xf'));_0x21fc14(_0x55121d[_0x124d('0x15')]['message']);}})[_0x124d('0x16')](function(_0xac0428){logger[_0x124d('0x11')](_0x124d('0xd'),_0x5b1ddb,_0xac0428);_0x5f325c(_0xac0428);});});}exports[_0x124d('0x17')]=function(_0x36e7fb){var _0xbdff4=this;return new Promise(function(_0x5c37d2,_0x5578a1){return db[_0x124d('0x18')][_0x124d('0x19')](_0x36e7fb['body'],{'raw':_0x36e7fb[_0x124d('0x1a')]?_0x36e7fb[_0x124d('0x1a')][_0x124d('0x1b')]===undefined?!![]:![]:!![]})[_0x124d('0xc')](function(_0x584165){logger[_0x124d('0x14')](_0x124d('0x17'),_0x36e7fb);logger[_0x124d('0xe')](_0x124d('0x17'),_0x36e7fb,JSON['stringify'](_0x584165));_0x5c37d2(_0x584165);})[_0x124d('0x16')](function(_0x45e558){logger[_0x124d('0x11')](_0x124d('0x17'),_0x45e558[_0x124d('0x13')],_0x36e7fb);_0x5578a1(_0xbdff4[_0x124d('0x11')](0x1f4,_0x45e558[_0x124d('0x13')]));});});};exports[_0x124d('0x1c')]=function(_0x1fe1e3){var _0x1cd9aa=this;return new Promise(function(_0x2514f7,_0x4e0048){return db['FaxMessage']['update'](_0x1fe1e3[_0x124d('0x1d')],{'raw':_0x1fe1e3['options']?_0x1fe1e3[_0x124d('0x1a')][_0x124d('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fe1e3[_0x124d('0x1a')]?_0x1fe1e3['options'][_0x124d('0x1e')]||null:null,'attributes':_0x1fe1e3[_0x124d('0x1a')]?_0x1fe1e3[_0x124d('0x1a')][_0x124d('0x1f')]||null:null,'limit':_0x1fe1e3[_0x124d('0x1a')]?_0x1fe1e3[_0x124d('0x1a')][_0x124d('0x20')]||null:null})[_0x124d('0xc')](function(_0x22ad40){logger[_0x124d('0x14')]('UpdateFaxMessage',_0x1fe1e3);logger[_0x124d('0xe')](_0x124d('0x1c'),_0x1fe1e3,JSON[_0x124d('0x10')](_0x22ad40));_0x2514f7(_0x22ad40);})['catch'](function(_0x2496df){logger[_0x124d('0x11')]('UpdateFaxMessage',_0x2496df['message'],_0x1fe1e3);_0x4e0048(_0x1cd9aa[_0x124d('0x11')](0x1f4,_0x2496df['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 91bb5e5..b92e411 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 _0xa9e0=['register','length','faxMessage:','./faxMessage.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(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var FaxMessageEvents=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(){FaxMessageEvents[_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);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','faxMessage:','./faxMessage.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(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var FaxMessageEvents=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(){FaxMessageEvents[_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);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 61c8fef..ad6aed1 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 _0xabc5=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','download','tracked','faxmessage:create','create','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x433d79,_0x119481){var _0x12cbe2=function(_0x12ba23){while(--_0x12ba23){_0x433d79['push'](_0x433d79['shift']());}};_0x12cbe2(++_0x119481);}(_0xabc5,0x1db));var _0x5abc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xabc5[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x5abc('0x0'));var util=require(_0x5abc('0x1'));var path=require(_0x5abc('0x2'));var timeout=require(_0x5abc('0x3'));var express=require(_0x5abc('0x4'));var router=express[_0x5abc('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5abc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5abc('0x7'));var controller=require('./faxMessage.controller');router[_0x5abc('0x8')]('/',auth[_0x5abc('0x9')](),controller[_0x5abc('0xa')]);router[_0x5abc('0x8')](_0x5abc('0xb'),auth[_0x5abc('0x9')](),controller['describe']);router[_0x5abc('0x8')](_0x5abc('0xc'),auth[_0x5abc('0x9')](),controller['show']);router[_0x5abc('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x5abc('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x5abc('0xe')]('fax',_0x5abc('0xf')),controller[_0x5abc('0x10')]);router[_0x5abc('0x11')](_0x5abc('0xc'),auth[_0x5abc('0x9')](),controller[_0x5abc('0x12')]);router[_0x5abc('0x11')](_0x5abc('0x13'),auth['isAuthenticated'](),controller['accept']);router[_0x5abc('0x11')](_0x5abc('0x14'),auth[_0x5abc('0x9')](),controller[_0x5abc('0x15')]);router[_0x5abc('0x16')](_0x5abc('0xc'),auth[_0x5abc('0x9')](),controller[_0x5abc('0x17')]);module[_0x5abc('0x18')]=router; \ No newline at end of file +var _0xa600=['show','/:id/download','download','post','tracked','faxmessage:create','update','put','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa600,0xa9));var _0x0a60=function(_0x13cab0,_0x14d825){_0x13cab0=_0x13cab0-0x0;var _0x38804f=_0xa600[_0x13cab0];return _0x38804f;};'use strict';var multer=require(_0x0a60('0x0'));var util=require(_0x0a60('0x1'));var path=require(_0x0a60('0x2'));var timeout=require(_0x0a60('0x3'));var express=require(_0x0a60('0x4'));var router=express[_0x0a60('0x5')]();var fs_extra=require(_0x0a60('0x6'));var auth=require(_0x0a60('0x7'));var interaction=require(_0x0a60('0x8'));var config=require(_0x0a60('0x9'));var controller=require(_0x0a60('0xa'));router[_0x0a60('0xb')]('/',auth[_0x0a60('0xc')](),controller[_0x0a60('0xd')]);router[_0x0a60('0xb')](_0x0a60('0xe'),auth[_0x0a60('0xc')](),controller[_0x0a60('0xf')]);router['get'](_0x0a60('0x10'),auth['isAuthenticated'](),controller[_0x0a60('0x11')]);router[_0x0a60('0xb')](_0x0a60('0x12'),auth[_0x0a60('0xc')](),controller[_0x0a60('0x13')]);router[_0x0a60('0x14')]('/',auth['isAuthenticated'](),interaction[_0x0a60('0x15')]('fax',_0x0a60('0x16')),controller['create']);router['put']('/:id',auth[_0x0a60('0xc')](),controller[_0x0a60('0x17')]);router[_0x0a60('0x18')](_0x0a60('0x19'),auth[_0x0a60('0xc')](),controller[_0x0a60('0x1a')]);router[_0x0a60('0x18')](_0x0a60('0x1b'),auth[_0x0a60('0xc')](),controller[_0x0a60('0x1c')]);router[_0x0a60('0x1d')]('/:id',auth[_0x0a60('0xc')](),controller['destroy']);module[_0x0a60('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index fab9098..a264e85 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 _0x7cc0=['beepall','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x1055d3,_0x5dce87){var _0x55b24a=function(_0x559f0a){while(--_0x559f0a){_0x1055d3['push'](_0x1055d3['shift']());}};_0x55b24a(++_0x5dce87);}(_0x7cc0,0x1a5));var _0x07cc=function(_0x583453,_0x1ce51c){_0x583453=_0x583453-0x0;var _0x4169de=_0x7cc0[_0x583453];return _0x4169de;};'use strict';var Sequelize=require('sequelize');module[_0x07cc('0x0')]={'name':{'type':Sequelize[_0x07cc('0x1')],'unique':_0x07cc('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x07cc('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x07cc('0x4')](_0x07cc('0x5'),_0x07cc('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x07cc('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa68b=['roundrobin','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x31c44d,_0x4d5b35){var _0x871f2a=function(_0x25fb1d){while(--_0x25fb1d){_0x31c44d['push'](_0x31c44d['shift']());}};_0x871f2a(++_0x4d5b35);}(_0xa68b,0xf6));var _0xba68=function(_0x292423,_0x1759b7){_0x292423=_0x292423-0x0;var _0x2801cb=_0xa68b[_0x292423];return _0x2801cb;};'use strict';var Sequelize=require('sequelize');module[_0xba68('0x0')]={'name':{'type':Sequelize[_0xba68('0x1')],'unique':_0xba68('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xba68('0x1')]},'timeout':{'type':Sequelize[_0xba68('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xba68('0x4')](_0xba68('0x5'),'beepall',_0xba68('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xba68('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 5fa1dc2..05f372a 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 _0xcfac=['socket.io-emitter','./faxQueue.socket','register','status','end','json','count','offset','set','reject','save','update','destroy','get','FaxQueues','UserProfileResource','then','sendStatus','error','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','query','keys','filters','attributes','length','model','hasOwnProperty','nolimit','limit','sort','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','intersection','fields','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','getMembers','findOne','UserFaxQueue','order','pick','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','addTeams','ids','online','interface','sequelize','each','findOrCreate','forEach','emit','removeTeams','Team','User','Agents','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','includes','all','union','compact','transaction','isEmpty','userFaxQueue:remove','addAgents','omit','userFaxQueue:save','removeAgents','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost'];(function(_0x16eb81,_0x25e808){var _0x5a8b46=function(_0x454b9d){while(--_0x454b9d){_0x16eb81['push'](_0x16eb81['shift']());}};_0x5a8b46(++_0x25e808);}(_0xcfac,0x105));var _0xccfa=function(_0x2581ea,_0x268448){_0x2581ea=_0x2581ea-0x0;var _0x5d0535=_0xcfac[_0x2581ea];return _0x5d0535;};'use strict';var pdf=require(_0xccfa('0x0'));var emlformat=require(_0xccfa('0x1'));var rimraf=require(_0xccfa('0x2'));var zipdir=require(_0xccfa('0x3'));var jsonpatch=require(_0xccfa('0x4'));var rp=require(_0xccfa('0x5'));var moment=require(_0xccfa('0x6'));var BPromise=require(_0xccfa('0x7'));var Mustache=require(_0xccfa('0x8'));var util=require('util');var path=require(_0xccfa('0x9'));var sox=require(_0xccfa('0xa'));var csv=require(_0xccfa('0xb'));var ejs=require(_0xccfa('0xc'));var fs=require('fs');var fs_extra=require(_0xccfa('0xd'));var _=require(_0xccfa('0xe'));var squel=require(_0xccfa('0xf'));var crypto=require('crypto');var jsforce=require(_0xccfa('0x10'));var deskjs=require(_0xccfa('0x11'));var toCsv=require(_0xccfa('0xb'));var querystring=require(_0xccfa('0x12'));var Papa=require(_0xccfa('0x13'));var Redis=require('ioredis');var authService=require(_0xccfa('0x14'));var qs=require(_0xccfa('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xccfa('0x16'));var logger=require(_0xccfa('0x17'))(_0xccfa('0x18'));var utils=require(_0xccfa('0x19'));var config=require(_0xccfa('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xccfa('0x1b'))['db'];config[_0xccfa('0x1c')]=_[_0xccfa('0x1d')](config[_0xccfa('0x1c')],{'host':_0xccfa('0x1e'),'port':0x18eb});var socket=require(_0xccfa('0x1f'))(new Redis(config[_0xccfa('0x1c')]));require(_0xccfa('0x20'))[_0xccfa('0x21')](socket);function respondWithStatusCode(_0x4d921,_0x24a7ec){_0x24a7ec=_0x24a7ec||0xcc;return function(_0x2bcf8e){if(_0x2bcf8e){return _0x4d921['sendStatus'](_0x24a7ec);}return _0x4d921[_0xccfa('0x22')](_0x24a7ec)[_0xccfa('0x23')]();};}function respondWithResult(_0x53416b,_0x513e25){_0x513e25=_0x513e25||0xc8;return function(_0x475607){if(_0x475607){return _0x53416b['status'](_0x513e25)[_0xccfa('0x24')](_0x475607);}};}function respondWithFilteredResult(_0x40c926,_0x59c660){return function(_0x4adaab){if(_0x4adaab){var _0xa3658=_0x4adaab[_0xccfa('0x25')],_0x26d90b=_0x59c660[_0xccfa('0x26')],_0x13d933=_0x59c660['offset']+_0x59c660['limit'],_0x14171e;if(_0x13d933>=_0xa3658){_0x13d933=_0xa3658;_0x14171e=0xc8;}else{_0x14171e=0xce;}_0x40c926['status'](_0x14171e);return _0x40c926[_0xccfa('0x27')]('Content-Range',_0x26d90b+'-'+_0x13d933+'/'+_0xa3658)['json'](_0x4adaab);}return null;};}function patchUpdates(_0x4ff928){return function(_0x29eb36){try{jsonpatch['apply'](_0x29eb36,_0x4ff928,!![]);}catch(_0x5abfb6){return BPromise[_0xccfa('0x28')](_0x5abfb6);}return _0x29eb36[_0xccfa('0x29')]();};}function saveUpdates(_0x3ba121,_0x222429){return function(_0x56b53c){if(_0x56b53c){return _0x56b53c[_0xccfa('0x2a')](_0x3ba121)['then'](function(_0x58cc2c){return _0x58cc2c;});}return null;};}function removeEntity(_0x4b8714,_0x3a1c05){return function(_0x2b4a96){if(_0x2b4a96){return _0x2b4a96[_0xccfa('0x2b')]()['then'](function(){var _0x30aeb0=_0x2b4a96[_0xccfa('0x2c')]({'plain':!![]});var _0x29a1fb=_0xccfa('0x2d');return db[_0xccfa('0x2e')][_0xccfa('0x2b')]({'where':{'type':_0x29a1fb,'resourceId':_0x30aeb0['id']}})[_0xccfa('0x2f')](function(){return _0x2b4a96;});})[_0xccfa('0x2f')](function(){_0x4b8714['status'](0xcc)[_0xccfa('0x23')]();});}};}function handleEntityNotFound(_0x2a5d63,_0x18dccb){return function(_0xae8934){if(!_0xae8934){_0x2a5d63[_0xccfa('0x30')](0x194);}return _0xae8934;};}function handleError(_0xe94e90,_0x32c849){_0x32c849=_0x32c849||0x1f4;return function(_0x3e8a05){logger[_0xccfa('0x31')](_0x3e8a05['stack']);if(_0x3e8a05[_0xccfa('0x32')]){delete _0x3e8a05[_0xccfa('0x32')];}_0xe94e90[_0xccfa('0x22')](_0x32c849)[_0xccfa('0x33')](_0x3e8a05);};}exports[_0xccfa('0x34')]=function(_0x29327b,_0xb6d80a){var _0x1c140c={},_0x1ab983={},_0x44b8b9={'count':0x0,'rows':[]};var _0x30a140=_[_0xccfa('0x35')](db[_0xccfa('0x36')][_0xccfa('0x37')],function(_0x354561){return{'name':_0x354561[_0xccfa('0x38')],'type':_0x354561[_0xccfa('0x39')][_0xccfa('0x3a')]};});_0x1ab983['model']=_['map'](_0x30a140,'name');_0x1ab983[_0xccfa('0x3b')]=_[_0xccfa('0x3c')](_0x29327b[_0xccfa('0x3b')]);_0x1ab983[_0xccfa('0x3d')]=_['intersection'](_0x1ab983['model'],_0x1ab983[_0xccfa('0x3b')]);_0x1c140c[_0xccfa('0x3e')]=_['intersection'](_0x1ab983['model'],qs['fields'](_0x29327b[_0xccfa('0x3b')]['fields']));_0x1c140c['attributes']=_0x1c140c[_0xccfa('0x3e')][_0xccfa('0x3f')]?_0x1c140c[_0xccfa('0x3e')]:_0x1ab983[_0xccfa('0x40')];if(!_0x29327b[_0xccfa('0x3b')][_0xccfa('0x41')](_0xccfa('0x42'))){_0x1c140c[_0xccfa('0x43')]=qs[_0xccfa('0x43')](_0x29327b[_0xccfa('0x3b')][_0xccfa('0x43')]);_0x1c140c['offset']=qs[_0xccfa('0x26')](_0x29327b['query']['offset']);}_0x1c140c['order']=qs[_0xccfa('0x44')](_0x29327b[_0xccfa('0x3b')][_0xccfa('0x44')]);_0x1c140c['where']=qs['filters'](_['pick'](_0x29327b[_0xccfa('0x3b')],_0x1ab983[_0xccfa('0x3d')]),_0x30a140);if(_0x29327b[_0xccfa('0x3b')][_0xccfa('0x45')]){_0x1c140c[_0xccfa('0x46')]=_[_0xccfa('0x47')](_0x1c140c[_0xccfa('0x46')],{'$or':_[_0xccfa('0x35')](_0x30a140,function(_0xc51cc6){if(_0xc51cc6[_0xccfa('0x39')]!==_0xccfa('0x48')){var _0x506abc={};_0x506abc[_0xc51cc6['name']]={'$like':'%'+_0x29327b['query'][_0xccfa('0x45')]+'%'};return _0x506abc;}})});}_0x1c140c=_[_0xccfa('0x47')]({},_0x1c140c,_0x29327b[_0xccfa('0x49')]);var _0x1ff96b={'where':_0x1c140c[_0xccfa('0x46')]};return db['FaxQueue'][_0xccfa('0x25')](_0x1ff96b)[_0xccfa('0x2f')](function(_0x26caf3){_0x44b8b9[_0xccfa('0x25')]=_0x26caf3;if(_0x29327b['query']['includeAll']){_0x1c140c[_0xccfa('0x4a')]=[{'all':!![]}];}return db[_0xccfa('0x36')][_0xccfa('0x4b')](_0x1c140c);})[_0xccfa('0x2f')](function(_0x154790){_0x44b8b9['rows']=_0x154790;return _0x44b8b9;})[_0xccfa('0x2f')](respondWithFilteredResult(_0xb6d80a,_0x1c140c))[_0xccfa('0x4c')](handleError(_0xb6d80a,null));};exports[_0xccfa('0x4d')]=function(_0x492366,_0x2e01ec){var _0x5c57d6={'raw':!![],'where':{'id':_0x492366[_0xccfa('0x4e')]['id']}},_0x505502={};_0x505502[_0xccfa('0x40')]=_[_0xccfa('0x3c')](db[_0xccfa('0x36')][_0xccfa('0x37')]);_0x505502[_0xccfa('0x3b')]=_['keys'](_0x492366[_0xccfa('0x3b')]);_0x505502['filters']=_['intersection'](_0x505502[_0xccfa('0x40')],_0x505502[_0xccfa('0x3b')]);_0x5c57d6[_0xccfa('0x3e')]=_[_0xccfa('0x4f')](_0x505502[_0xccfa('0x40')],qs[_0xccfa('0x50')](_0x492366[_0xccfa('0x3b')][_0xccfa('0x50')]));_0x5c57d6[_0xccfa('0x3e')]=_0x5c57d6[_0xccfa('0x3e')][_0xccfa('0x3f')]?_0x5c57d6[_0xccfa('0x3e')]:_0x505502[_0xccfa('0x40')];if(_0x492366[_0xccfa('0x3b')]['includeAll']){_0x5c57d6[_0xccfa('0x4a')]=[{'all':!![]}];}_0x5c57d6=_[_0xccfa('0x47')]({},_0x5c57d6,_0x492366[_0xccfa('0x49')]);return db['FaxQueue']['find'](_0x5c57d6)[_0xccfa('0x2f')](handleEntityNotFound(_0x2e01ec,null))[_0xccfa('0x2f')](respondWithResult(_0x2e01ec,null))[_0xccfa('0x4c')](handleError(_0x2e01ec,null));};exports['create']=function(_0x4b5b89,_0x2cd5c2){return db['FaxQueue'][_0xccfa('0x51')](_0x4b5b89['body'],{})[_0xccfa('0x2f')](function(_0x573c45){var _0x3eb18c=_0x4b5b89[_0xccfa('0x52')][_0xccfa('0x2c')]({'plain':!![]});if(!_0x3eb18c)throw new Error(_0xccfa('0x53'));if(_0x3eb18c[_0xccfa('0x54')]===_0xccfa('0x52')){var _0x2428e7=_0x573c45[_0xccfa('0x2c')]({'plain':!![]});var _0x5d7d1d=_0xccfa('0x2d');return db[_0xccfa('0x55')]['find']({'where':{'name':_0x5d7d1d,'userProfileId':_0x3eb18c[_0xccfa('0x56')]},'raw':!![]})[_0xccfa('0x2f')](function(_0x208b04){if(_0x208b04&&_0x208b04[_0xccfa('0x57')]===0x0){return db[_0xccfa('0x2e')][_0xccfa('0x51')]({'name':_0x2428e7[_0xccfa('0x32')],'resourceId':_0x2428e7['id'],'type':_0x208b04[_0xccfa('0x32')],'sectionId':_0x208b04['id']},{})['then'](function(){return _0x573c45;});}else{return _0x573c45;}})[_0xccfa('0x4c')](function(_0x25498e){logger['error'](_0xccfa('0x58'),_0x25498e);throw _0x25498e;});}return _0x573c45;})[_0xccfa('0x2f')](respondWithResult(_0x2cd5c2,0xc9))[_0xccfa('0x4c')](handleError(_0x2cd5c2,null));};exports[_0xccfa('0x2a')]=function(_0x24f5f6,_0x58af1f){if(_0x24f5f6['body']['id']){delete _0x24f5f6[_0xccfa('0x59')]['id'];}return db[_0xccfa('0x36')][_0xccfa('0x5a')]({'where':{'id':_0x24f5f6['params']['id']}})[_0xccfa('0x2f')](handleEntityNotFound(_0x58af1f,null))[_0xccfa('0x2f')](saveUpdates(_0x24f5f6['body'],null))[_0xccfa('0x2f')](respondWithResult(_0x58af1f,null))['catch'](handleError(_0x58af1f,null));};exports['destroy']=function(_0x1d7c64,_0x4ffe10){return db[_0xccfa('0x36')][_0xccfa('0x5a')]({'where':{'id':_0x1d7c64[_0xccfa('0x4e')]['id']}})[_0xccfa('0x2f')](handleEntityNotFound(_0x4ffe10,null))[_0xccfa('0x2f')](removeEntity(_0x4ffe10,null))[_0xccfa('0x4c')](handleError(_0x4ffe10,null));};exports['describe']=function(_0x160cff,_0x32fc71){return db[_0xccfa('0x36')]['describe']()[_0xccfa('0x2f')](respondWithResult(_0x32fc71,null))[_0xccfa('0x4c')](handleError(_0x32fc71,null));};exports[_0xccfa('0x5b')]=function(_0x209990,_0x3b7aea,_0x4608f8){var _0x3218bb={'raw':!![],'where':{}},_0x57dc84={},_0x402bee;return db[_0xccfa('0x36')][_0xccfa('0x5c')]({'where':{'id':_0x209990[_0xccfa('0x4e')]['id']}})[_0xccfa('0x2f')](handleEntityNotFound(_0x3b7aea,null))[_0xccfa('0x2f')](function(_0x2d43bd){if(_0x2d43bd){_0x402bee=_0x2d43bd[_0xccfa('0x2c')]({'plain':!![]});_0x57dc84[_0xccfa('0x40')]=_[_0xccfa('0x3c')](db[_0xccfa('0x5d')][_0xccfa('0x37')]);_0x57dc84[_0xccfa('0x3b')]=_[_0xccfa('0x3c')](_0x209990[_0xccfa('0x3b')]);_0x57dc84[_0xccfa('0x3d')]=_[_0xccfa('0x4f')](_0x57dc84[_0xccfa('0x40')],_0x57dc84['query']);_0x3218bb[_0xccfa('0x3e')]=_[_0xccfa('0x4f')](_0x57dc84[_0xccfa('0x40')],qs[_0xccfa('0x50')](_0x209990[_0xccfa('0x3b')][_0xccfa('0x50')]));_0x3218bb[_0xccfa('0x3e')]=_0x3218bb[_0xccfa('0x3e')][_0xccfa('0x3f')]?_0x3218bb[_0xccfa('0x3e')]:_0x57dc84[_0xccfa('0x40')];if(!_0x209990['query'][_0xccfa('0x41')](_0xccfa('0x42'))){_0x3218bb[_0xccfa('0x43')]=qs[_0xccfa('0x43')](_0x209990[_0xccfa('0x3b')][_0xccfa('0x43')]);_0x3218bb[_0xccfa('0x26')]=qs[_0xccfa('0x26')](_0x209990[_0xccfa('0x3b')]['offset']);}_0x3218bb[_0xccfa('0x5e')]=qs[_0xccfa('0x44')](_0x209990[_0xccfa('0x3b')]['sort']);_0x3218bb['where']=qs[_0xccfa('0x3d')](_[_0xccfa('0x5f')](_0x209990['query'],_0x57dc84[_0xccfa('0x3d')]));_0x3218bb[_0xccfa('0x46')]['FaxQueueId']=_0x2d43bd['id'];if(_0x209990[_0xccfa('0x3b')][_0xccfa('0x45')]){_0x3218bb[_0xccfa('0x46')]=_[_0xccfa('0x47')](_0x3218bb['where'],{'$or':_[_0xccfa('0x35')](_0x3218bb[_0xccfa('0x3e')],function(_0x327367){var _0x539137={};_0x539137[_0x327367]={'$like':'%'+_0x209990[_0xccfa('0x3b')][_0xccfa('0x45')]+'%'};return _0x539137;})});}_0x3218bb=_['merge']({},_0x3218bb,_0x209990[_0xccfa('0x49')]);return db[_0xccfa('0x5d')][_0xccfa('0x4b')](_0x3218bb);}})['then'](function(_0x3b7772){if(_0x3b7772){return db['User'][_0xccfa('0x60')]({'where':{'id':_[_0xccfa('0x35')](_0x3b7772,_0xccfa('0x61')),'role':_0xccfa('0x62')},'attributes':['id',_0xccfa('0x32'),_0xccfa('0x63'),_0xccfa('0x64'),_0xccfa('0x65')]});}})[_0xccfa('0x2f')](function(_0x658b82){if(_0x658b82){return{'count':_0x658b82['count'],'rows':_[_0xccfa('0x35')](_0x658b82[_0xccfa('0x66')],function(_0x5d436a){return{'membername':_0x5d436a['name'],'UserId':_0x5d436a['id'],'queue_name':_0x402bee[_0xccfa('0x32')],'FaxQueueId':_0x402bee['id'],'interface':util[_0xccfa('0x67')](_0xccfa('0x68'),_0xccfa('0x69'),_0x5d436a[_0xccfa('0x32')]),'penalty':0x0,'paused':_0x5d436a[_0xccfa('0x63')],'createdAt':_0x5d436a[_0xccfa('0x65')],'updatedAt':_0x5d436a[_0xccfa('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3b7aea,_0x3218bb))['catch'](handleError(_0x3b7aea,null));};exports[_0xccfa('0x6a')]=function(_0x73ae1e,_0x3dd159,_0x365bd9){var _0x4ab9b7={};var _0x468da5={};var _0x5206e0;var _0x5c72d3;return db[_0xccfa('0x36')][_0xccfa('0x5c')]({'where':{'id':_0x73ae1e[_0xccfa('0x4e')]['id']}})[_0xccfa('0x2f')](handleEntityNotFound(_0x3dd159,null))['then'](function(_0x25cce5){if(_0x25cce5){_0x5206e0=_0x25cce5;_0x468da5[_0xccfa('0x40')]=_['keys'](db['Team']['rawAttributes']);_0x468da5[_0xccfa('0x3b')]=_['keys'](_0x73ae1e['query']);_0x468da5[_0xccfa('0x3d')]=_[_0xccfa('0x4f')](_0x468da5[_0xccfa('0x40')],_0x468da5[_0xccfa('0x3b')]);_0x4ab9b7['attributes']=_[_0xccfa('0x4f')](_0x468da5['model'],qs[_0xccfa('0x50')](_0x73ae1e[_0xccfa('0x3b')][_0xccfa('0x50')]));_0x4ab9b7[_0xccfa('0x3e')]=_0x4ab9b7[_0xccfa('0x3e')][_0xccfa('0x3f')]?_0x4ab9b7[_0xccfa('0x3e')]:_0x468da5['model'];_0x4ab9b7[_0xccfa('0x5e')]=qs[_0xccfa('0x44')](_0x73ae1e[_0xccfa('0x3b')][_0xccfa('0x44')]);_0x4ab9b7[_0xccfa('0x46')]=qs['filters'](_[_0xccfa('0x5f')](_0x73ae1e[_0xccfa('0x3b')],_0x468da5[_0xccfa('0x3d')]));if(_0x73ae1e[_0xccfa('0x3b')]['filter']){_0x4ab9b7['where']=_['merge'](_0x4ab9b7[_0xccfa('0x46')],{'$or':_[_0xccfa('0x35')](_0x4ab9b7['attributes'],function(_0x180341){var _0x39c773={};_0x39c773[_0x180341]={'$like':'%'+_0x73ae1e['query'][_0xccfa('0x45')]+'%'};return _0x39c773;})});}_0x4ab9b7=_[_0xccfa('0x47')]({},_0x4ab9b7,_0x73ae1e['options']);return _0x5206e0['getTeams'](_0x4ab9b7);}})[_0xccfa('0x2f')](function(_0x4e4ac6){if(_0x4e4ac6){_0x5c72d3=_0x4e4ac6[_0xccfa('0x3f')];if(!_0x73ae1e[_0xccfa('0x3b')][_0xccfa('0x41')](_0xccfa('0x42'))){_0x4ab9b7[_0xccfa('0x43')]=qs['limit'](_0x73ae1e['query']['limit']);_0x4ab9b7[_0xccfa('0x26')]=qs[_0xccfa('0x26')](_0x73ae1e[_0xccfa('0x3b')][_0xccfa('0x26')]);}return _0x5206e0[_0xccfa('0x6a')](_0x4ab9b7);}})[_0xccfa('0x2f')](function(_0x5a923f){if(_0x5a923f){return _0x5a923f?{'count':_0x5c72d3,'rows':_0x5a923f}:null;}})[_0xccfa('0x2f')](respondWithResult(_0x3dd159,null))[_0xccfa('0x4c')](handleError(_0x3dd159,null));};exports[_0xccfa('0x6b')]=function(_0x82e1a3,_0x3ebeff,_0x54c1cf){var _0x4ac293=_0x82e1a3[_0xccfa('0x59')][_0xccfa('0x6c')];return db['Team'][_0xccfa('0x4b')]({'where':{'id':_0x4ac293},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0xccfa('0x6d'),'voicePause',_0xccfa('0x6e')],'raw':!![]}]})['then'](function(_0x556541){if(_0x556541){var _0x5add56=_['flatMap'](_0x556541,function(_0x2adaa7){var _0x2cf5dd=_0x2adaa7[_0xccfa('0x2c')]({'plain':!![]});return _0x2cf5dd['Agents'];});return db[_0xccfa('0x36')]['find']({'where':{'id':_0x82e1a3[_0xccfa('0x4e')]['id']}})[_0xccfa('0x2f')](function(_0x30298b){return db[_0xccfa('0x6f')]['transaction'](function(_0x50f764){return _0x30298b[_0xccfa('0x6b')](_0x4ac293,{'transaction':_0x50f764})['then'](function(){return BPromise[_0xccfa('0x70')](_0x5add56,function(_0x282aaf){return db['UserFaxQueue'][_0xccfa('0x71')]({'where':{'UserId':_0x282aaf['id'],'FaxQueueId':_0x82e1a3[_0xccfa('0x4e')]['id']},'transaction':_0x50f764});});})[_0xccfa('0x2f')](function(){_0x5add56[_0xccfa('0x72')](function(_0xfb9d3d){socket[_0xccfa('0x73')]('userFaxQueue:save',{'UserId':_0xfb9d3d['id'],'FaxQueueId':_0x30298b['id']});});});});});}})[_0xccfa('0x2f')](respondWithStatusCode(_0x3ebeff,null))[_0xccfa('0x4c')](handleError(_0x3ebeff,null));};exports[_0xccfa('0x74')]=function(_0x35ff41,_0x4533ab,_0x31ed96){return db[_0xccfa('0x75')]['findAll']({'where':{'id':_0x35ff41[_0xccfa('0x3b')][_0xccfa('0x6c')]},'attributes':['id'],'include':[{'model':db[_0xccfa('0x76')],'as':_0xccfa('0x77'),'attributes':['id'],'raw':!![]}]})[_0xccfa('0x2f')](handleEntityNotFound(_0x4533ab,null))[_0xccfa('0x2f')](function(_0xf8f456){var _0x83a9e7=_[_0xccfa('0x35')](_0xf8f456,'id');var _0x11acd2=[];var _0x400fa5=[];var _0x581af9=squel[_0xccfa('0x78')]();_0x581af9[_0xccfa('0x79')](_0xccfa('0x7a'))[_0xccfa('0x7b')](_0xccfa('0x7c'),'tq')[_0xccfa('0x7d')](_0xccfa('0x7e'),'ut',_0xccfa('0x7f'))[_0xccfa('0x46')](_0xccfa('0x80'),_0x35ff41['params']['id']);for(var _0x1b44e4=0x0;_0x1b44e4<_0xf8f456['length'];_0x1b44e4+=0x1){let _0x24f019=_0xf8f456[_0x1b44e4];for(var _0x4ad76b=0x0;_0x4ad76b<_0x24f019[_0xccfa('0x77')]['length'];_0x4ad76b+=0x1){let _0x4b7935=_0x24f019['Agents'][_0x4ad76b];var _0x9ff771=_0x581af9[_0xccfa('0x81')]();_0x9ff771[_0xccfa('0x46')](_0xccfa('0x82'),_0x4b7935['id']);_0x400fa5['push'](db[_0xccfa('0x6f')][_0xccfa('0x3b')](_0x9ff771[_0xccfa('0x83')](),{'type':db[_0xccfa('0x6f')]['QueryTypes'][_0xccfa('0x84')]})[_0xccfa('0x2f')](function(_0x38160b){if(_0x38160b[_0xccfa('0x3f')]===0x1){return _0x4b7935['id'];}else{var _0x25e7e8=_['every'](_[_0xccfa('0x35')](_0x38160b,'TeamId'),function(_0x4670d2){return _[_0xccfa('0x85')](_0x83a9e7,_0x4670d2);});if(_0x25e7e8){return _0x4b7935['id'];}}}));}}return BPromise[_0xccfa('0x86')](_0x400fa5)[_0xccfa('0x2f')](function(_0x24aaf9){_0x11acd2=_(_0x11acd2)[_0xccfa('0x87')](_0x24aaf9)[_0xccfa('0x88')]()['value']();return db['FaxQueue'][_0xccfa('0x5a')]({'where':{'id':_0x35ff41[_0xccfa('0x4e')]['id']}})[_0xccfa('0x2f')](function(_0x21be4b){return db[_0xccfa('0x6f')][_0xccfa('0x89')](function(_0x34821f){return _0x21be4b['removeTeams'](_0x35ff41[_0xccfa('0x3b')]['ids'],{'transaction':_0x34821f})['then'](function(){if(!_[_0xccfa('0x8a')](_0x11acd2)){return _0x21be4b['removeAgents'](_0x11acd2,{'transaction':_0x34821f});}})[_0xccfa('0x2f')](function(){_0x11acd2[_0xccfa('0x72')](function(_0xbe8ab9){socket[_0xccfa('0x73')](_0xccfa('0x8b'),{'UserId':_0xbe8ab9,'FaxQueueId':_0x21be4b['id']});});});});});});})[_0xccfa('0x2f')](respondWithStatusCode(_0x4533ab,null))[_0xccfa('0x4c')](handleError(_0x4533ab,null));};exports[_0xccfa('0x8c')]=function(_0x46902b,_0xa9b5d8,_0x525166){return db[_0xccfa('0x36')][_0xccfa('0x5a')]({'where':{'id':_0x46902b[_0xccfa('0x4e')]['id']}})[_0xccfa('0x2f')](handleEntityNotFound(_0xa9b5d8,null))[_0xccfa('0x2f')](function(_0x1996ea){if(_0x1996ea){return _0x1996ea[_0xccfa('0x8c')](_0x46902b[_0xccfa('0x59')][_0xccfa('0x6c')],_[_0xccfa('0x8d')](_0x46902b[_0xccfa('0x59')],[_0xccfa('0x6c'),'id'])||{})['spread'](function(_0xd3475b){for(var _0x4af0cd=0x0;_0x4af0cd<_0x46902b['body'][_0xccfa('0x6c')][_0xccfa('0x3f')];_0x4af0cd+=0x1){socket[_0xccfa('0x73')](_0xccfa('0x8e'),{'UserId':_0x46902b[_0xccfa('0x59')][_0xccfa('0x6c')][_0x4af0cd],'FaxQueueId':_0x46902b[_0xccfa('0x4e')]['id']});}return _0xd3475b;});}})[_0xccfa('0x2f')](respondWithResult(_0xa9b5d8,null))['catch'](handleError(_0xa9b5d8,null));};exports['removeAgents']=function(_0x4d7b20,_0x43fcdf,_0x56f443){return db[_0xccfa('0x36')][_0xccfa('0x5a')]({'where':{'id':_0x4d7b20['params']['id']}})[_0xccfa('0x2f')](handleEntityNotFound(_0x43fcdf,null))[_0xccfa('0x2f')](function(_0x144cda){if(_0x144cda){return _0x144cda[_0xccfa('0x8f')](_0x4d7b20[_0xccfa('0x3b')]['ids'])[_0xccfa('0x2f')](function(){if(_[_0xccfa('0x90')](_0x4d7b20[_0xccfa('0x3b')][_0xccfa('0x6c')])){for(var _0x5977bc=0x0;_0x5977bc<_0x4d7b20[_0xccfa('0x3b')][_0xccfa('0x6c')][_0xccfa('0x3f')];_0x5977bc+=0x1){socket[_0xccfa('0x73')](_0xccfa('0x8b'),{'UserId':Number(_0x4d7b20[_0xccfa('0x3b')][_0xccfa('0x6c')][_0x5977bc]),'FaxQueueId':Number(_0x4d7b20[_0xccfa('0x4e')]['id'])});}}else{socket['emit'](_0xccfa('0x8b'),{'UserId':Number(_0x4d7b20[_0xccfa('0x3b')]['ids']),'FaxQueueId':Number(_0x4d7b20[_0xccfa('0x4e')]['id'])});}});}})[_0xccfa('0x2f')](respondWithStatusCode(_0x43fcdf,null))[_0xccfa('0x4c')](handleError(_0x43fcdf,null));};exports[_0xccfa('0x91')]=function(_0x5f52c1,_0x36b189,_0xf7e562){var _0x399a0e={};var _0x18992b={};var _0x14766c;var _0x398ebe;return db[_0xccfa('0x36')][_0xccfa('0x5c')]({'where':{'id':_0x5f52c1[_0xccfa('0x4e')]['id']}})[_0xccfa('0x2f')](handleEntityNotFound(_0x36b189,null))[_0xccfa('0x2f')](function(_0xb879e3){if(_0xb879e3){_0x14766c=_0xb879e3;_0x18992b[_0xccfa('0x40')]=_[_0xccfa('0x3c')](db['User'][_0xccfa('0x37')]);_0x18992b[_0xccfa('0x3b')]=_[_0xccfa('0x3c')](_0x5f52c1['query']);_0x18992b[_0xccfa('0x3d')]=_[_0xccfa('0x4f')](_0x18992b['model'],_0x18992b[_0xccfa('0x3b')]);_0x399a0e[_0xccfa('0x3e')]=_[_0xccfa('0x4f')](_0x18992b['model'],qs[_0xccfa('0x50')](_0x5f52c1['query'][_0xccfa('0x50')]));_0x399a0e[_0xccfa('0x3e')]=_0x399a0e[_0xccfa('0x3e')][_0xccfa('0x3f')]?_0x399a0e[_0xccfa('0x3e')]:_0x18992b[_0xccfa('0x40')];_0x399a0e[_0xccfa('0x5e')]=qs[_0xccfa('0x44')](_0x5f52c1[_0xccfa('0x3b')][_0xccfa('0x44')]);_0x399a0e[_0xccfa('0x46')]=qs[_0xccfa('0x3d')](_['pick'](_0x5f52c1['query'],_0x18992b['filters']));if(_0x5f52c1[_0xccfa('0x3b')][_0xccfa('0x45')]){_0x399a0e[_0xccfa('0x46')]=_[_0xccfa('0x47')](_0x399a0e[_0xccfa('0x46')],{'$or':_[_0xccfa('0x35')](_0x399a0e[_0xccfa('0x3e')],function(_0x39cee8){var _0x308ca8={};_0x308ca8[_0x39cee8]={'$like':'%'+_0x5f52c1[_0xccfa('0x3b')][_0xccfa('0x45')]+'%'};return _0x308ca8;})});}_0x399a0e=_[_0xccfa('0x47')]({},_0x399a0e,_0x5f52c1['options']);return _0x14766c[_0xccfa('0x91')](_0x399a0e);}})[_0xccfa('0x2f')](function(_0x43ddca){if(_0x43ddca){_0x398ebe=_0x43ddca[_0xccfa('0x3f')];if(!_0x5f52c1[_0xccfa('0x3b')][_0xccfa('0x41')](_0xccfa('0x42'))){_0x399a0e[_0xccfa('0x43')]=qs[_0xccfa('0x43')](_0x5f52c1[_0xccfa('0x3b')][_0xccfa('0x43')]);_0x399a0e['offset']=qs[_0xccfa('0x26')](_0x5f52c1[_0xccfa('0x3b')][_0xccfa('0x26')]);}return _0x14766c[_0xccfa('0x91')](_0x399a0e);}})[_0xccfa('0x2f')](function(_0x1d0970){if(_0x1d0970){return _0x1d0970?{'count':_0x398ebe,'rows':_0x1d0970}:null;}})['then'](respondWithResult(_0x36b189,null))[_0xccfa('0x4c')](handleError(_0x36b189,null));}; \ No newline at end of file +var _0x3fec=['removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','nolimit','FaxQueueId','User','findAndCountAll','agent','faxPause','updatedAt','rows','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','select','field','tq.TeamId','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','every','TeamId','includes','all','union','compact','removeTeams','isEmpty'];(function(_0x226dce,_0x5ca412){var _0x2f0ff6=function(_0x3acb16){while(--_0x3acb16){_0x226dce['push'](_0x226dce['shift']());}};_0x2f0ff6(++_0x5ca412);}(_0x3fec,0x1ba));var _0xc3fe=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3fec[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xc3fe('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc3fe('0x1'));var jsonpatch=require(_0xc3fe('0x2'));var rp=require('request-promise');var moment=require(_0xc3fe('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc3fe('0x4'));var path=require('path');var sox=require(_0xc3fe('0x5'));var csv=require(_0xc3fe('0x6'));var ejs=require(_0xc3fe('0x7'));var fs=require('fs');var fs_extra=require(_0xc3fe('0x8'));var _=require(_0xc3fe('0x9'));var squel=require(_0xc3fe('0xa'));var crypto=require(_0xc3fe('0xb'));var jsforce=require(_0xc3fe('0xc'));var deskjs=require(_0xc3fe('0xd'));var toCsv=require(_0xc3fe('0x6'));var querystring=require(_0xc3fe('0xe'));var Papa=require(_0xc3fe('0xf'));var Redis=require(_0xc3fe('0x10'));var authService=require(_0xc3fe('0x11'));var qs=require(_0xc3fe('0x12'));var as=require(_0xc3fe('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc3fe('0x14'))(_0xc3fe('0x15'));var utils=require('../../config/utils');var config=require(_0xc3fe('0x16'));var licenseUtil=require(_0xc3fe('0x17'));var db=require(_0xc3fe('0x18'))['db'];config[_0xc3fe('0x19')]=_[_0xc3fe('0x1a')](config[_0xc3fe('0x19')],{'host':_0xc3fe('0x1b'),'port':0x18eb});var socket=require(_0xc3fe('0x1c'))(new Redis(config[_0xc3fe('0x19')]));require(_0xc3fe('0x1d'))['register'](socket);function respondWithStatusCode(_0x400476,_0x531fa5){_0x531fa5=_0x531fa5||0xcc;return function(_0x10091c){if(_0x10091c){return _0x400476[_0xc3fe('0x1e')](_0x531fa5);}return _0x400476[_0xc3fe('0x1f')](_0x531fa5)[_0xc3fe('0x20')]();};}function respondWithResult(_0x17edb6,_0x39705c){_0x39705c=_0x39705c||0xc8;return function(_0x1e291f){if(_0x1e291f){return _0x17edb6[_0xc3fe('0x1f')](_0x39705c)[_0xc3fe('0x21')](_0x1e291f);}};}function respondWithFilteredResult(_0x8d0835,_0x376fff){return function(_0x442fbd){if(_0x442fbd){var _0x423447=_0x442fbd[_0xc3fe('0x22')],_0x31d639=_0x376fff[_0xc3fe('0x23')],_0x3a86f2=_0x376fff[_0xc3fe('0x23')]+_0x376fff['limit'],_0x5ea00d;if(_0x3a86f2>=_0x423447){_0x3a86f2=_0x423447;_0x5ea00d=0xc8;}else{_0x5ea00d=0xce;}_0x8d0835[_0xc3fe('0x1f')](_0x5ea00d);return _0x8d0835[_0xc3fe('0x24')]('Content-Range',_0x31d639+'-'+_0x3a86f2+'/'+_0x423447)['json'](_0x442fbd);}return null;};}function patchUpdates(_0x3333ad){return function(_0x434eb8){try{jsonpatch[_0xc3fe('0x25')](_0x434eb8,_0x3333ad,!![]);}catch(_0x574efd){return BPromise[_0xc3fe('0x26')](_0x574efd);}return _0x434eb8[_0xc3fe('0x27')]();};}function saveUpdates(_0x3f9418,_0x3c0ac4){return function(_0x2a6635){if(_0x2a6635){return _0x2a6635[_0xc3fe('0x28')](_0x3f9418)[_0xc3fe('0x29')](function(_0x6b57a6){return _0x6b57a6;});}return null;};}function removeEntity(_0x2c4727,_0x30657f){return function(_0x3b4423){if(_0x3b4423){return _0x3b4423[_0xc3fe('0x2a')]()['then'](function(){var _0x3220e7=_0x3b4423[_0xc3fe('0x2b')]({'plain':!![]});var _0x1d3c16=_0xc3fe('0x2c');return db[_0xc3fe('0x2d')]['destroy']({'where':{'type':_0x1d3c16,'resourceId':_0x3220e7['id']}})[_0xc3fe('0x29')](function(){return _0x3b4423;});})[_0xc3fe('0x29')](function(){_0x2c4727[_0xc3fe('0x1f')](0xcc)[_0xc3fe('0x20')]();});}};}function handleEntityNotFound(_0x820b7f,_0xaa64ad){return function(_0x2dac90){if(!_0x2dac90){_0x820b7f[_0xc3fe('0x1e')](0x194);}return _0x2dac90;};}function handleError(_0xa74edf,_0xd2b14d){_0xd2b14d=_0xd2b14d||0x1f4;return function(_0x391167){logger[_0xc3fe('0x2e')](_0x391167[_0xc3fe('0x2f')]);if(_0x391167[_0xc3fe('0x30')]){delete _0x391167[_0xc3fe('0x30')];}_0xa74edf[_0xc3fe('0x1f')](_0xd2b14d)[_0xc3fe('0x31')](_0x391167);};}exports[_0xc3fe('0x32')]=function(_0x5ac845,_0x1e8a38){var _0x19d353={},_0x4658c5={},_0x246621={'count':0x0,'rows':[]};var _0x11a44e=_[_0xc3fe('0x33')](db[_0xc3fe('0x34')][_0xc3fe('0x35')],function(_0x6fe063){return{'name':_0x6fe063[_0xc3fe('0x36')],'type':_0x6fe063[_0xc3fe('0x37')]['key']};});_0x4658c5['model']=_['map'](_0x11a44e,_0xc3fe('0x30'));_0x4658c5[_0xc3fe('0x38')]=_['keys'](_0x5ac845[_0xc3fe('0x38')]);_0x4658c5[_0xc3fe('0x39')]=_['intersection'](_0x4658c5['model'],_0x4658c5[_0xc3fe('0x38')]);_0x19d353[_0xc3fe('0x3a')]=_[_0xc3fe('0x3b')](_0x4658c5[_0xc3fe('0x3c')],qs['fields'](_0x5ac845['query'][_0xc3fe('0x3d')]));_0x19d353[_0xc3fe('0x3a')]=_0x19d353[_0xc3fe('0x3a')][_0xc3fe('0x3e')]?_0x19d353['attributes']:_0x4658c5[_0xc3fe('0x3c')];if(!_0x5ac845['query'][_0xc3fe('0x3f')]('nolimit')){_0x19d353[_0xc3fe('0x40')]=qs[_0xc3fe('0x40')](_0x5ac845['query'][_0xc3fe('0x40')]);_0x19d353[_0xc3fe('0x23')]=qs['offset'](_0x5ac845[_0xc3fe('0x38')]['offset']);}_0x19d353[_0xc3fe('0x41')]=qs[_0xc3fe('0x42')](_0x5ac845[_0xc3fe('0x38')][_0xc3fe('0x42')]);_0x19d353[_0xc3fe('0x43')]=qs['filters'](_[_0xc3fe('0x44')](_0x5ac845[_0xc3fe('0x38')],_0x4658c5[_0xc3fe('0x39')]),_0x11a44e);if(_0x5ac845[_0xc3fe('0x38')][_0xc3fe('0x45')]){_0x19d353[_0xc3fe('0x43')]=_[_0xc3fe('0x46')](_0x19d353['where'],{'$or':_[_0xc3fe('0x33')](_0x11a44e,function(_0xfc37e3){if(_0xfc37e3[_0xc3fe('0x37')]!==_0xc3fe('0x47')){var _0x587c96={};_0x587c96[_0xfc37e3[_0xc3fe('0x30')]]={'$like':'%'+_0x5ac845[_0xc3fe('0x38')]['filter']+'%'};return _0x587c96;}})});}_0x19d353=_['merge']({},_0x19d353,_0x5ac845[_0xc3fe('0x48')]);var _0x59c596={'where':_0x19d353['where']};return db[_0xc3fe('0x34')][_0xc3fe('0x22')](_0x59c596)[_0xc3fe('0x29')](function(_0x16f11b){_0x246621['count']=_0x16f11b;if(_0x5ac845[_0xc3fe('0x38')][_0xc3fe('0x49')]){_0x19d353[_0xc3fe('0x4a')]=[{'all':!![]}];}return db['FaxQueue'][_0xc3fe('0x4b')](_0x19d353);})[_0xc3fe('0x29')](function(_0x2f8117){_0x246621['rows']=_0x2f8117;return _0x246621;})['then'](respondWithFilteredResult(_0x1e8a38,_0x19d353))['catch'](handleError(_0x1e8a38,null));};exports[_0xc3fe('0x4c')]=function(_0x1530ff,_0xb0777){var _0x271a4a={'raw':!![],'where':{'id':_0x1530ff[_0xc3fe('0x4d')]['id']}},_0x159148={};_0x159148[_0xc3fe('0x3c')]=_['keys'](db[_0xc3fe('0x34')][_0xc3fe('0x35')]);_0x159148[_0xc3fe('0x38')]=_[_0xc3fe('0x4e')](_0x1530ff[_0xc3fe('0x38')]);_0x159148[_0xc3fe('0x39')]=_['intersection'](_0x159148[_0xc3fe('0x3c')],_0x159148[_0xc3fe('0x38')]);_0x271a4a[_0xc3fe('0x3a')]=_[_0xc3fe('0x3b')](_0x159148[_0xc3fe('0x3c')],qs[_0xc3fe('0x3d')](_0x1530ff[_0xc3fe('0x38')][_0xc3fe('0x3d')]));_0x271a4a[_0xc3fe('0x3a')]=_0x271a4a[_0xc3fe('0x3a')]['length']?_0x271a4a[_0xc3fe('0x3a')]:_0x159148[_0xc3fe('0x3c')];if(_0x1530ff[_0xc3fe('0x38')][_0xc3fe('0x49')]){_0x271a4a[_0xc3fe('0x4a')]=[{'all':!![]}];}_0x271a4a=_[_0xc3fe('0x46')]({},_0x271a4a,_0x1530ff[_0xc3fe('0x48')]);return db[_0xc3fe('0x34')][_0xc3fe('0x4f')](_0x271a4a)[_0xc3fe('0x29')](handleEntityNotFound(_0xb0777,null))[_0xc3fe('0x29')](respondWithResult(_0xb0777,null))[_0xc3fe('0x50')](handleError(_0xb0777,null));};exports[_0xc3fe('0x51')]=function(_0x91221e,_0x5cee33){return db[_0xc3fe('0x34')][_0xc3fe('0x51')](_0x91221e[_0xc3fe('0x52')],{})['then'](function(_0x1700e9){var _0x1b3e53=_0x91221e[_0xc3fe('0x53')][_0xc3fe('0x2b')]({'plain':!![]});if(!_0x1b3e53)throw new Error(_0xc3fe('0x54'));if(_0x1b3e53['role']==='user'){var _0x25eef3=_0x1700e9[_0xc3fe('0x2b')]({'plain':!![]});var _0x5efdba=_0xc3fe('0x2c');return db[_0xc3fe('0x55')]['find']({'where':{'name':_0x5efdba,'userProfileId':_0x1b3e53[_0xc3fe('0x56')]},'raw':!![]})[_0xc3fe('0x29')](function(_0x109911){if(_0x109911&&_0x109911[_0xc3fe('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x25eef3[_0xc3fe('0x30')],'resourceId':_0x25eef3['id'],'type':_0x109911[_0xc3fe('0x30')],'sectionId':_0x109911['id']},{})[_0xc3fe('0x29')](function(){return _0x1700e9;});}else{return _0x1700e9;}})['catch'](function(_0x1a491b){logger[_0xc3fe('0x2e')](_0xc3fe('0x58'),_0x1a491b);throw _0x1a491b;});}return _0x1700e9;})['then'](respondWithResult(_0x5cee33,0xc9))[_0xc3fe('0x50')](handleError(_0x5cee33,null));};exports[_0xc3fe('0x28')]=function(_0x5caf49,_0x228482){if(_0x5caf49[_0xc3fe('0x52')]['id']){delete _0x5caf49[_0xc3fe('0x52')]['id'];}return db[_0xc3fe('0x34')][_0xc3fe('0x4f')]({'where':{'id':_0x5caf49[_0xc3fe('0x4d')]['id']}})[_0xc3fe('0x29')](handleEntityNotFound(_0x228482,null))[_0xc3fe('0x29')](saveUpdates(_0x5caf49[_0xc3fe('0x52')],null))['then'](respondWithResult(_0x228482,null))[_0xc3fe('0x50')](handleError(_0x228482,null));};exports['destroy']=function(_0x3d6045,_0x2f6e28){return db['FaxQueue'][_0xc3fe('0x4f')]({'where':{'id':_0x3d6045[_0xc3fe('0x4d')]['id']}})[_0xc3fe('0x29')](handleEntityNotFound(_0x2f6e28,null))['then'](removeEntity(_0x2f6e28,null))[_0xc3fe('0x50')](handleError(_0x2f6e28,null));};exports[_0xc3fe('0x59')]=function(_0x13dc16,_0x591007){return db[_0xc3fe('0x34')][_0xc3fe('0x59')]()[_0xc3fe('0x29')](respondWithResult(_0x591007,null))[_0xc3fe('0x50')](handleError(_0x591007,null));};exports[_0xc3fe('0x5a')]=function(_0x398edb,_0x35f07a,_0x5caf99){var _0x11e5bf={'raw':!![],'where':{}},_0x224d97={},_0x1ab9c8;return db[_0xc3fe('0x34')][_0xc3fe('0x5b')]({'where':{'id':_0x398edb[_0xc3fe('0x4d')]['id']}})[_0xc3fe('0x29')](handleEntityNotFound(_0x35f07a,null))[_0xc3fe('0x29')](function(_0x43adb4){if(_0x43adb4){_0x1ab9c8=_0x43adb4[_0xc3fe('0x2b')]({'plain':!![]});_0x224d97[_0xc3fe('0x3c')]=_['keys'](db[_0xc3fe('0x5c')][_0xc3fe('0x35')]);_0x224d97['query']=_[_0xc3fe('0x4e')](_0x398edb['query']);_0x224d97[_0xc3fe('0x39')]=_[_0xc3fe('0x3b')](_0x224d97[_0xc3fe('0x3c')],_0x224d97[_0xc3fe('0x38')]);_0x11e5bf[_0xc3fe('0x3a')]=_['intersection'](_0x224d97[_0xc3fe('0x3c')],qs['fields'](_0x398edb[_0xc3fe('0x38')]['fields']));_0x11e5bf[_0xc3fe('0x3a')]=_0x11e5bf[_0xc3fe('0x3a')]['length']?_0x11e5bf[_0xc3fe('0x3a')]:_0x224d97[_0xc3fe('0x3c')];if(!_0x398edb[_0xc3fe('0x38')][_0xc3fe('0x3f')](_0xc3fe('0x5d'))){_0x11e5bf[_0xc3fe('0x40')]=qs[_0xc3fe('0x40')](_0x398edb[_0xc3fe('0x38')]['limit']);_0x11e5bf[_0xc3fe('0x23')]=qs[_0xc3fe('0x23')](_0x398edb[_0xc3fe('0x38')][_0xc3fe('0x23')]);}_0x11e5bf['order']=qs['sort'](_0x398edb[_0xc3fe('0x38')][_0xc3fe('0x42')]);_0x11e5bf[_0xc3fe('0x43')]=qs[_0xc3fe('0x39')](_[_0xc3fe('0x44')](_0x398edb[_0xc3fe('0x38')],_0x224d97[_0xc3fe('0x39')]));_0x11e5bf[_0xc3fe('0x43')][_0xc3fe('0x5e')]=_0x43adb4['id'];if(_0x398edb['query'][_0xc3fe('0x45')]){_0x11e5bf[_0xc3fe('0x43')]=_[_0xc3fe('0x46')](_0x11e5bf['where'],{'$or':_[_0xc3fe('0x33')](_0x11e5bf[_0xc3fe('0x3a')],function(_0x22e05f){var _0x1ffcdf={};_0x1ffcdf[_0x22e05f]={'$like':'%'+_0x398edb[_0xc3fe('0x38')][_0xc3fe('0x45')]+'%'};return _0x1ffcdf;})});}_0x11e5bf=_[_0xc3fe('0x46')]({},_0x11e5bf,_0x398edb[_0xc3fe('0x48')]);return db[_0xc3fe('0x5c')][_0xc3fe('0x4b')](_0x11e5bf);}})[_0xc3fe('0x29')](function(_0x432e09){if(_0x432e09){return db[_0xc3fe('0x5f')][_0xc3fe('0x60')]({'where':{'id':_['map'](_0x432e09,'UserId'),'role':_0xc3fe('0x61')},'attributes':['id','name',_0xc3fe('0x62'),_0xc3fe('0x63'),'createdAt']});}})[_0xc3fe('0x29')](function(_0x48abcb){if(_0x48abcb){return{'count':_0x48abcb[_0xc3fe('0x22')],'rows':_['map'](_0x48abcb[_0xc3fe('0x64')],function(_0x13f3c4){return{'membername':_0x13f3c4['name'],'UserId':_0x13f3c4['id'],'queue_name':_0x1ab9c8[_0xc3fe('0x30')],'FaxQueueId':_0x1ab9c8['id'],'interface':util[_0xc3fe('0x65')](_0xc3fe('0x66'),_0xc3fe('0x67'),_0x13f3c4['name']),'penalty':0x0,'paused':_0x13f3c4[_0xc3fe('0x62')],'createdAt':_0x13f3c4['createdAt'],'updatedAt':_0x13f3c4[_0xc3fe('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc3fe('0x29')](respondWithFilteredResult(_0x35f07a,_0x11e5bf))['catch'](handleError(_0x35f07a,null));};exports[_0xc3fe('0x68')]=function(_0x365e1a,_0x4969f3,_0x2a8f70){var _0xbf8386={};var _0x37c877={};var _0x2ea2b6;var _0x3e8f0;return db['FaxQueue'][_0xc3fe('0x5b')]({'where':{'id':_0x365e1a[_0xc3fe('0x4d')]['id']}})[_0xc3fe('0x29')](handleEntityNotFound(_0x4969f3,null))['then'](function(_0xf2fe30){if(_0xf2fe30){_0x2ea2b6=_0xf2fe30;_0x37c877['model']=_[_0xc3fe('0x4e')](db['Team']['rawAttributes']);_0x37c877['query']=_['keys'](_0x365e1a['query']);_0x37c877[_0xc3fe('0x39')]=_[_0xc3fe('0x3b')](_0x37c877[_0xc3fe('0x3c')],_0x37c877[_0xc3fe('0x38')]);_0xbf8386['attributes']=_['intersection'](_0x37c877[_0xc3fe('0x3c')],qs[_0xc3fe('0x3d')](_0x365e1a[_0xc3fe('0x38')][_0xc3fe('0x3d')]));_0xbf8386[_0xc3fe('0x3a')]=_0xbf8386[_0xc3fe('0x3a')][_0xc3fe('0x3e')]?_0xbf8386[_0xc3fe('0x3a')]:_0x37c877[_0xc3fe('0x3c')];_0xbf8386['order']=qs[_0xc3fe('0x42')](_0x365e1a[_0xc3fe('0x38')][_0xc3fe('0x42')]);_0xbf8386['where']=qs[_0xc3fe('0x39')](_[_0xc3fe('0x44')](_0x365e1a[_0xc3fe('0x38')],_0x37c877[_0xc3fe('0x39')]));if(_0x365e1a['query'][_0xc3fe('0x45')]){_0xbf8386[_0xc3fe('0x43')]=_['merge'](_0xbf8386['where'],{'$or':_[_0xc3fe('0x33')](_0xbf8386['attributes'],function(_0x3d33c3){var _0x5b1c65={};_0x5b1c65[_0x3d33c3]={'$like':'%'+_0x365e1a[_0xc3fe('0x38')]['filter']+'%'};return _0x5b1c65;})});}_0xbf8386=_[_0xc3fe('0x46')]({},_0xbf8386,_0x365e1a[_0xc3fe('0x48')]);return _0x2ea2b6[_0xc3fe('0x68')](_0xbf8386);}})[_0xc3fe('0x29')](function(_0x65d2c){if(_0x65d2c){_0x3e8f0=_0x65d2c['length'];if(!_0x365e1a[_0xc3fe('0x38')]['hasOwnProperty']('nolimit')){_0xbf8386['limit']=qs['limit'](_0x365e1a['query'][_0xc3fe('0x40')]);_0xbf8386[_0xc3fe('0x23')]=qs[_0xc3fe('0x23')](_0x365e1a[_0xc3fe('0x38')][_0xc3fe('0x23')]);}return _0x2ea2b6[_0xc3fe('0x68')](_0xbf8386);}})[_0xc3fe('0x29')](function(_0xede06a){if(_0xede06a){return _0xede06a?{'count':_0x3e8f0,'rows':_0xede06a}:null;}})['then'](respondWithResult(_0x4969f3,null))[_0xc3fe('0x50')](handleError(_0x4969f3,null));};exports[_0xc3fe('0x69')]=function(_0xbdb269,_0x594ca0,_0x76befc){var _0x3174bb=_0xbdb269[_0xc3fe('0x52')][_0xc3fe('0x6a')];return db[_0xc3fe('0x6b')]['findAll']({'where':{'id':_0x3174bb},'attributes':['id'],'include':[{'model':db[_0xc3fe('0x5f')],'as':_0xc3fe('0x6c'),'attributes':['id',_0xc3fe('0x30'),_0xc3fe('0x6d'),_0xc3fe('0x6e'),_0xc3fe('0x6f')],'raw':!![]}]})['then'](function(_0x365503){if(_0x365503){var _0x5c33de=_['flatMap'](_0x365503,function(_0x12a482){var _0x1bba5f=_0x12a482[_0xc3fe('0x2b')]({'plain':!![]});return _0x1bba5f['Agents'];});return db[_0xc3fe('0x34')]['find']({'where':{'id':_0xbdb269[_0xc3fe('0x4d')]['id']}})[_0xc3fe('0x29')](function(_0x442c41){return db['sequelize'][_0xc3fe('0x70')](function(_0x2d24b5){return _0x442c41[_0xc3fe('0x69')](_0x3174bb,{'transaction':_0x2d24b5})['then'](function(){return BPromise[_0xc3fe('0x71')](_0x5c33de,function(_0x381edb){return db['UserFaxQueue'][_0xc3fe('0x72')]({'where':{'UserId':_0x381edb['id'],'FaxQueueId':_0xbdb269[_0xc3fe('0x4d')]['id']},'transaction':_0x2d24b5});});})['then'](function(){_0x5c33de[_0xc3fe('0x73')](function(_0xf65acb){socket[_0xc3fe('0x74')](_0xc3fe('0x75'),{'UserId':_0xf65acb['id'],'FaxQueueId':_0x442c41['id']});});});});});}})[_0xc3fe('0x29')](respondWithStatusCode(_0x594ca0,null))[_0xc3fe('0x50')](handleError(_0x594ca0,null));};exports['removeTeams']=function(_0x267e54,_0x149ea6,_0x37161d){return db[_0xc3fe('0x6b')][_0xc3fe('0x4b')]({'where':{'id':_0x267e54[_0xc3fe('0x38')][_0xc3fe('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xc3fe('0x5f')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc3fe('0x29')](handleEntityNotFound(_0x149ea6,null))[_0xc3fe('0x29')](function(_0x53dd2d){var _0x10c297=_[_0xc3fe('0x33')](_0x53dd2d,'id');var _0x4e1b78=[];var _0x15f1f5=[];var _0x18fa65=squel[_0xc3fe('0x76')]();_0x18fa65[_0xc3fe('0x77')](_0xc3fe('0x78'))['from'](_0xc3fe('0x79'),'tq')[_0xc3fe('0x7a')](_0xc3fe('0x7b'),'ut',_0xc3fe('0x7c'))[_0xc3fe('0x43')](_0xc3fe('0x7d'),_0x267e54['params']['id']);for(var _0x408569=0x0;_0x408569<_0x53dd2d['length'];_0x408569+=0x1){let _0x535b2d=_0x53dd2d[_0x408569];for(var _0x50180d=0x0;_0x50180d<_0x535b2d[_0xc3fe('0x6c')][_0xc3fe('0x3e')];_0x50180d+=0x1){let _0x4fef1c=_0x535b2d[_0xc3fe('0x6c')][_0x50180d];var _0xb17034=_0x18fa65['clone']();_0xb17034[_0xc3fe('0x43')](_0xc3fe('0x7e'),_0x4fef1c['id']);_0x15f1f5[_0xc3fe('0x7f')](db[_0xc3fe('0x80')][_0xc3fe('0x38')](_0xb17034[_0xc3fe('0x81')](),{'type':db[_0xc3fe('0x80')]['QueryTypes']['SELECT']})[_0xc3fe('0x29')](function(_0x52bbaa){if(_0x52bbaa[_0xc3fe('0x3e')]===0x1){return _0x4fef1c['id'];}else{var _0x255164=_[_0xc3fe('0x82')](_[_0xc3fe('0x33')](_0x52bbaa,_0xc3fe('0x83')),function(_0x5d1c47){return _[_0xc3fe('0x84')](_0x10c297,_0x5d1c47);});if(_0x255164){return _0x4fef1c['id'];}}}));}}return BPromise[_0xc3fe('0x85')](_0x15f1f5)[_0xc3fe('0x29')](function(_0x2b482b){_0x4e1b78=_(_0x4e1b78)[_0xc3fe('0x86')](_0x2b482b)[_0xc3fe('0x87')]()['value']();return db[_0xc3fe('0x34')][_0xc3fe('0x4f')]({'where':{'id':_0x267e54[_0xc3fe('0x4d')]['id']}})[_0xc3fe('0x29')](function(_0x1f01b7){return db[_0xc3fe('0x80')][_0xc3fe('0x70')](function(_0x1d1a6c){return _0x1f01b7[_0xc3fe('0x88')](_0x267e54[_0xc3fe('0x38')]['ids'],{'transaction':_0x1d1a6c})['then'](function(){if(!_[_0xc3fe('0x89')](_0x4e1b78)){return _0x1f01b7[_0xc3fe('0x8a')](_0x4e1b78,{'transaction':_0x1d1a6c});}})[_0xc3fe('0x29')](function(){_0x4e1b78[_0xc3fe('0x73')](function(_0xa5f641){socket['emit'](_0xc3fe('0x8b'),{'UserId':_0xa5f641,'FaxQueueId':_0x1f01b7['id']});});});});});});})[_0xc3fe('0x29')](respondWithStatusCode(_0x149ea6,null))[_0xc3fe('0x50')](handleError(_0x149ea6,null));};exports[_0xc3fe('0x8c')]=function(_0x26bfff,_0x4cf865,_0x9c1439){return db[_0xc3fe('0x34')]['find']({'where':{'id':_0x26bfff['params']['id']}})[_0xc3fe('0x29')](handleEntityNotFound(_0x4cf865,null))[_0xc3fe('0x29')](function(_0x5f2de0){if(_0x5f2de0){return _0x5f2de0[_0xc3fe('0x8c')](_0x26bfff[_0xc3fe('0x52')][_0xc3fe('0x6a')],_[_0xc3fe('0x8d')](_0x26bfff[_0xc3fe('0x52')],[_0xc3fe('0x6a'),'id'])||{})[_0xc3fe('0x8e')](function(_0x10ce79){for(var _0x339e6a=0x0;_0x339e6a<_0x26bfff[_0xc3fe('0x52')]['ids']['length'];_0x339e6a+=0x1){socket['emit']('userFaxQueue:save',{'UserId':_0x26bfff[_0xc3fe('0x52')][_0xc3fe('0x6a')][_0x339e6a],'FaxQueueId':_0x26bfff[_0xc3fe('0x4d')]['id']});}return _0x10ce79;});}})[_0xc3fe('0x29')](respondWithResult(_0x4cf865,null))[_0xc3fe('0x50')](handleError(_0x4cf865,null));};exports['removeAgents']=function(_0x21ebeb,_0x12c82c,_0x56f819){return db[_0xc3fe('0x34')][_0xc3fe('0x4f')]({'where':{'id':_0x21ebeb[_0xc3fe('0x4d')]['id']}})[_0xc3fe('0x29')](handleEntityNotFound(_0x12c82c,null))[_0xc3fe('0x29')](function(_0x44eaa8){if(_0x44eaa8){return _0x44eaa8[_0xc3fe('0x8a')](_0x21ebeb['query'][_0xc3fe('0x6a')])['then'](function(){if(_[_0xc3fe('0x8f')](_0x21ebeb['query'][_0xc3fe('0x6a')])){for(var _0x48faac=0x0;_0x48faac<_0x21ebeb[_0xc3fe('0x38')][_0xc3fe('0x6a')][_0xc3fe('0x3e')];_0x48faac+=0x1){socket[_0xc3fe('0x74')](_0xc3fe('0x8b'),{'UserId':Number(_0x21ebeb[_0xc3fe('0x38')]['ids'][_0x48faac]),'FaxQueueId':Number(_0x21ebeb['params']['id'])});}}else{socket[_0xc3fe('0x74')](_0xc3fe('0x8b'),{'UserId':Number(_0x21ebeb[_0xc3fe('0x38')][_0xc3fe('0x6a')]),'FaxQueueId':Number(_0x21ebeb[_0xc3fe('0x4d')]['id'])});}});}})[_0xc3fe('0x29')](respondWithStatusCode(_0x12c82c,null))[_0xc3fe('0x50')](handleError(_0x12c82c,null));};exports['getAgents']=function(_0x1048ba,_0x30791f,_0x138967){var _0x565e26={};var _0x49514c={};var _0xbc717;var _0x5cf48a;return db[_0xc3fe('0x34')][_0xc3fe('0x5b')]({'where':{'id':_0x1048ba[_0xc3fe('0x4d')]['id']}})[_0xc3fe('0x29')](handleEntityNotFound(_0x30791f,null))[_0xc3fe('0x29')](function(_0x465f49){if(_0x465f49){_0xbc717=_0x465f49;_0x49514c['model']=_[_0xc3fe('0x4e')](db[_0xc3fe('0x5f')][_0xc3fe('0x35')]);_0x49514c[_0xc3fe('0x38')]=_['keys'](_0x1048ba['query']);_0x49514c[_0xc3fe('0x39')]=_[_0xc3fe('0x3b')](_0x49514c[_0xc3fe('0x3c')],_0x49514c[_0xc3fe('0x38')]);_0x565e26[_0xc3fe('0x3a')]=_[_0xc3fe('0x3b')](_0x49514c['model'],qs['fields'](_0x1048ba[_0xc3fe('0x38')]['fields']));_0x565e26[_0xc3fe('0x3a')]=_0x565e26[_0xc3fe('0x3a')][_0xc3fe('0x3e')]?_0x565e26[_0xc3fe('0x3a')]:_0x49514c[_0xc3fe('0x3c')];_0x565e26['order']=qs[_0xc3fe('0x42')](_0x1048ba[_0xc3fe('0x38')][_0xc3fe('0x42')]);_0x565e26[_0xc3fe('0x43')]=qs[_0xc3fe('0x39')](_[_0xc3fe('0x44')](_0x1048ba['query'],_0x49514c[_0xc3fe('0x39')]));if(_0x1048ba[_0xc3fe('0x38')][_0xc3fe('0x45')]){_0x565e26[_0xc3fe('0x43')]=_[_0xc3fe('0x46')](_0x565e26[_0xc3fe('0x43')],{'$or':_[_0xc3fe('0x33')](_0x565e26['attributes'],function(_0x27a964){var _0x75d97b={};_0x75d97b[_0x27a964]={'$like':'%'+_0x1048ba['query']['filter']+'%'};return _0x75d97b;})});}_0x565e26=_['merge']({},_0x565e26,_0x1048ba['options']);return _0xbc717[_0xc3fe('0x90')](_0x565e26);}})[_0xc3fe('0x29')](function(_0x361e01){if(_0x361e01){_0x5cf48a=_0x361e01[_0xc3fe('0x3e')];if(!_0x1048ba[_0xc3fe('0x38')][_0xc3fe('0x3f')]('nolimit')){_0x565e26[_0xc3fe('0x40')]=qs[_0xc3fe('0x40')](_0x1048ba[_0xc3fe('0x38')][_0xc3fe('0x40')]);_0x565e26[_0xc3fe('0x23')]=qs['offset'](_0x1048ba[_0xc3fe('0x38')]['offset']);}return _0xbc717['getAgents'](_0x565e26);}})[_0xc3fe('0x29')](function(_0x5a4d05){if(_0x5a4d05){return _0x5a4d05?{'count':_0x5cf48a,'rows':_0x5a4d05}:null;}})['then'](respondWithResult(_0x30791f,null))['catch'](handleError(_0x30791f,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 825f721..5314eb5 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 _0x0346=['events','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x41dba2,_0x4c19ee){var _0x270cf6=function(_0x1f9888){while(--_0x1f9888){_0x41dba2['push'](_0x41dba2['shift']());}};_0x270cf6(++_0x4c19ee);}(_0x0346,0x99));var _0x6034=function(_0x2499de,_0x5eb00c){_0x2499de=_0x2499de-0x0;var _0x5a09a1=_0x0346[_0x2499de];return _0x5a09a1;};'use strict';var EventEmitter=require(_0x6034('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x6034('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x6034('0x2')](0x0);var events={'afterCreate':_0x6034('0x3'),'afterUpdate':_0x6034('0x4'),'afterDestroy':_0x6034('0x5')};function emitEvent(_0x53bf10){return function(_0x55ed49,_0x3dc83a,_0x3198fe){FaxQueueEvents['emit'](_0x53bf10+':'+_0x55ed49['id'],_0x55ed49);FaxQueueEvents[_0x6034('0x6')](_0x53bf10,_0x55ed49);_0x3198fe(null);};}for(var e in events){if(events[_0x6034('0x7')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x6034('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x3cd4=['hook','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x1fe48b,_0x276862){var _0x827be2=function(_0x30b372){while(--_0x30b372){_0x1fe48b['push'](_0x1fe48b['shift']());}};_0x827be2(++_0x276862);}(_0x3cd4,0xeb));var _0x43cd=function(_0x4136c6,_0x2ed2fe){_0x4136c6=_0x4136c6-0x0;var _0x305aa1=_0x3cd4[_0x4136c6];return _0x305aa1;};'use strict';var EventEmitter=require(_0x43cd('0x0'));var FaxQueue=require(_0x43cd('0x1'))['db'][_0x43cd('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x43cd('0x3')](0x0);var events={'afterCreate':_0x43cd('0x4'),'afterUpdate':_0x43cd('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3bd316){return function(_0x41529b,_0x51443c,_0x1fde12){FaxQueueEvents[_0x43cd('0x6')](_0x3bd316+':'+_0x41529b['id'],_0x41529b);FaxQueueEvents['emit'](_0x3bd316,_0x41529b);_0x1fde12(null);};}for(var e in events){if(events[_0x43cd('0x7')](e)){var event=events[e];FaxQueue[_0x43cd('0x8')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 3237306..752a7f7 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 _0x4901=['exports','define','FaxQueue','fax_queues','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./faxQueue.attributes'];(function(_0x537eae,_0x14104c){var _0x304883=function(_0x48666d){while(--_0x48666d){_0x537eae['push'](_0x537eae['shift']());}};_0x304883(++_0x14104c);}(_0x4901,0xd0));var _0x1490=function(_0x363ad5,_0x237ece){_0x363ad5=_0x363ad5-0x0;var _0x2221d9=_0x4901[_0x363ad5];return _0x2221d9;};'use strict';var _=require('lodash');var util=require(_0x1490('0x0'));var logger=require(_0x1490('0x1'))(_0x1490('0x2'));var moment=require(_0x1490('0x3'));var BPromise=require(_0x1490('0x4'));var rp=require(_0x1490('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1490('0x6'));var attributes=require(_0x1490('0x7'));module[_0x1490('0x8')]=function(_0x45cd88,_0x2b6486){return _0x45cd88[_0x1490('0x9')](_0x1490('0xa'),attributes,{'tableName':_0x1490('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xced9=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','FaxQueue','fax_queues','util','../../config/logger'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xced9,0x106));var _0x9ced=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xced9[_0x279d37];return _0x530173;};'use strict';var _=require('lodash');var util=require(_0x9ced('0x0'));var logger=require(_0x9ced('0x1'))(_0x9ced('0x2'));var moment=require(_0x9ced('0x3'));var BPromise=require(_0x9ced('0x4'));var rp=require(_0x9ced('0x5'));var fs=require('fs');var path=require(_0x9ced('0x6'));var rimraf=require(_0x9ced('0x7'));var config=require(_0x9ced('0x8'));var attributes=require('./faxQueue.attributes');module[_0x9ced('0x9')]=function(_0x1d64f3,_0x4a87ab){return _0x1d64f3['define'](_0x9ced('0xa'),attributes,{'tableName':_0x9ced('0xb'),'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 49cf5b1..b56a8c1 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 _0xfe44=['message','result','GetFaxQueue','FaxQueue','options','raw','where','limit','include','map','attributes','model','catch','ShowFaxQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4d6666,_0x51a949){var _0x22bd1f=function(_0x178649){while(--_0x178649){_0x4d6666['push'](_0x4d6666['shift']());}};_0x22bd1f(++_0x51a949);}(_0xfe44,0x180));var _0x4fe4=function(_0x10c48f,_0x25990b){_0x10c48f=_0x10c48f-0x0;var _0x2e0083=_0xfe44[_0x10c48f];return _0x2e0083;};'use strict';var _=require(_0x4fe4('0x0'));var util=require(_0x4fe4('0x1'));var moment=require(_0x4fe4('0x2'));var BPromise=require('bluebird');var rs=require(_0x4fe4('0x3'));var fs=require('fs');var Redis=require(_0x4fe4('0x4'));var db=require(_0x4fe4('0x5'))['db'];var utils=require(_0x4fe4('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x4fe4('0x7')]=_[_0x4fe4('0x8')](config[_0x4fe4('0x7')],{'host':_0x4fe4('0x9'),'port':0x18eb});var socket=require(_0x4fe4('0xa'))(new Redis(config['redis']));require(_0x4fe4('0xb'))[_0x4fe4('0xc')](socket);function respondWithRpcPromise(_0x4ddb48,_0x4a3c98,_0x39ad16){return new BPromise(function(_0x1b00fb,_0x60c9dd){return client[_0x4fe4('0xd')](_0x4ddb48,_0x39ad16)[_0x4fe4('0xe')](function(_0x5b5bb9){logger[_0x4fe4('0xf')](_0x4fe4('0x10'),_0x4a3c98,_0x4fe4('0x11'));logger[_0x4fe4('0x12')](_0x4fe4('0x13'),_0x4a3c98,'request\x20sent',JSON[_0x4fe4('0x14')](_0x5b5bb9));if(_0x5b5bb9[_0x4fe4('0x15')]){if(_0x5b5bb9['error'][_0x4fe4('0x16')]===0x1f4){logger[_0x4fe4('0x15')]('FaxQueue,\x20%s,\x20%s',_0x4a3c98,_0x5b5bb9[_0x4fe4('0x15')][_0x4fe4('0x17')]);return _0x60c9dd(_0x5b5bb9[_0x4fe4('0x15')]['message']);}logger[_0x4fe4('0x15')](_0x4fe4('0x10'),_0x4a3c98,_0x5b5bb9[_0x4fe4('0x15')]['message']);return _0x1b00fb(_0x5b5bb9[_0x4fe4('0x15')][_0x4fe4('0x17')]);}else{logger[_0x4fe4('0xf')](_0x4fe4('0x10'),_0x4a3c98,'request\x20sent');_0x1b00fb(_0x5b5bb9[_0x4fe4('0x18')][_0x4fe4('0x17')]);}})['catch'](function(_0x2119a8){logger[_0x4fe4('0x15')]('FaxQueue,\x20%s,\x20%s',_0x4a3c98,_0x2119a8);_0x60c9dd(_0x2119a8);});});}exports[_0x4fe4('0x19')]=function(_0x568a9a){var _0x1bd655=this;return new Promise(function(_0x35beae,_0x4a2837){return db[_0x4fe4('0x1a')]['findAll']({'raw':_0x568a9a[_0x4fe4('0x1b')]?_0x568a9a['options'][_0x4fe4('0x1c')]===undefined?!![]:![]:!![],'where':_0x568a9a['options']?_0x568a9a['options'][_0x4fe4('0x1d')]||null:null,'attributes':_0x568a9a['options']?_0x568a9a[_0x4fe4('0x1b')]['attributes']||null:null,'limit':_0x568a9a[_0x4fe4('0x1b')]?_0x568a9a[_0x4fe4('0x1b')][_0x4fe4('0x1e')]||null:null,'include':_0x568a9a[_0x4fe4('0x1b')]?_0x568a9a[_0x4fe4('0x1b')][_0x4fe4('0x1f')]?_[_0x4fe4('0x20')](_0x568a9a[_0x4fe4('0x1b')][_0x4fe4('0x1f')],function(_0x168bb9){return{'model':db[_0x168bb9['model']],'as':_0x168bb9['as'],'attributes':_0x168bb9[_0x4fe4('0x21')],'include':_0x168bb9['include']?_['map'](_0x168bb9[_0x4fe4('0x1f')],function(_0x553167){return{'model':db[_0x553167[_0x4fe4('0x22')]],'as':_0x553167['as'],'attributes':_0x553167[_0x4fe4('0x21')],'include':_0x553167[_0x4fe4('0x1f')]?_[_0x4fe4('0x20')](_0x553167['include'],function(_0x2a6853){return{'model':db[_0x2a6853[_0x4fe4('0x22')]],'as':_0x2a6853['as'],'attributes':_0x2a6853[_0x4fe4('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a4e04){logger[_0x4fe4('0xf')]('GetFaxQueue',_0x568a9a);logger[_0x4fe4('0x12')](_0x4fe4('0x19'),_0x568a9a,JSON[_0x4fe4('0x14')](_0x3a4e04));_0x35beae(_0x3a4e04);})[_0x4fe4('0x23')](function(_0x1eb7c7){logger[_0x4fe4('0x15')](_0x4fe4('0x19'),_0x1eb7c7[_0x4fe4('0x17')],_0x568a9a);_0x4a2837(_0x1bd655[_0x4fe4('0x15')](0x1f4,_0x1eb7c7[_0x4fe4('0x17')]));});});};exports[_0x4fe4('0x24')]=function(_0x398dc){var _0x146cf6=this;return new Promise(function(_0x3e0035,_0x40f4e1){return db[_0x4fe4('0x1a')]['find']({'raw':_0x398dc[_0x4fe4('0x1b')]?_0x398dc[_0x4fe4('0x1b')][_0x4fe4('0x1c')]===undefined?!![]:![]:!![],'where':_0x398dc[_0x4fe4('0x1b')]?_0x398dc[_0x4fe4('0x1b')][_0x4fe4('0x1d')]||null:null,'attributes':_0x398dc[_0x4fe4('0x1b')]?_0x398dc[_0x4fe4('0x1b')]['attributes']||null:null,'include':_0x398dc[_0x4fe4('0x1b')]?_0x398dc[_0x4fe4('0x1b')]['include']?_[_0x4fe4('0x20')](_0x398dc[_0x4fe4('0x1b')][_0x4fe4('0x1f')],function(_0x42b35f){return{'model':db[_0x42b35f['model']],'as':_0x42b35f['as'],'attributes':_0x42b35f['attributes'],'include':_0x42b35f['include']?_[_0x4fe4('0x20')](_0x42b35f[_0x4fe4('0x1f')],function(_0x548457){return{'model':db[_0x548457[_0x4fe4('0x22')]],'as':_0x548457['as'],'attributes':_0x548457[_0x4fe4('0x21')],'include':_0x548457[_0x4fe4('0x1f')]?_[_0x4fe4('0x20')](_0x548457[_0x4fe4('0x1f')],function(_0x51d8a1){return{'model':db[_0x51d8a1['model']],'as':_0x51d8a1['as'],'attributes':_0x51d8a1['attributes']};}):[]};}):[]};}):[]:[]})[_0x4fe4('0xe')](function(_0x27b36f){logger[_0x4fe4('0xf')]('ShowFaxQueue',_0x398dc);logger[_0x4fe4('0x12')]('ShowFaxQueue',_0x398dc,JSON[_0x4fe4('0x14')](_0x27b36f));_0x3e0035(_0x27b36f);})['catch'](function(_0x298a65){logger[_0x4fe4('0x15')](_0x4fe4('0x24'),_0x298a65[_0x4fe4('0x17')],_0x398dc);_0x40f4e1(_0x146cf6[_0x4fe4('0x15')](0x1f4,_0x298a65[_0x4fe4('0x17')]));});});}; \ No newline at end of file +var _0x3b0b=['FaxQueue','findAll','options','attributes','limit','include','map','model','GetFaxQueue','debug','find','raw','where','ShowFaxQueue','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','localhost','socket.io-emitter','redis','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0xcc4aed,_0x229370){var _0x53d96e=function(_0x3bb6c8){while(--_0x3bb6c8){_0xcc4aed['push'](_0xcc4aed['shift']());}};_0x53d96e(++_0x229370);}(_0x3b0b,0x19e));var _0xb3b0=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x3b0b[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require(_0xb3b0('0x0'));var util=require(_0xb3b0('0x1'));var moment=require('moment');var BPromise=require(_0xb3b0('0x2'));var rs=require(_0xb3b0('0x3'));var fs=require('fs');var Redis=require(_0xb3b0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb3b0('0x5'));var logger=require(_0xb3b0('0x6'))('rpc');var config=require(_0xb3b0('0x7'));var jayson=require(_0xb3b0('0x8'));var client=jayson[_0xb3b0('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xb3b0('0xa'),'port':0x18eb});var socket=require(_0xb3b0('0xb'))(new Redis(config[_0xb3b0('0xc')]));require(_0xb3b0('0xd'))[_0xb3b0('0xe')](socket);function respondWithRpcPromise(_0x169268,_0x28c62b,_0x36ec98){return new BPromise(function(_0x2888a8,_0x323840){return client[_0xb3b0('0xf')](_0x169268,_0x36ec98)[_0xb3b0('0x10')](function(_0x5bf3ae){logger[_0xb3b0('0x11')](_0xb3b0('0x12'),_0x28c62b,_0xb3b0('0x13'));logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x28c62b,_0xb3b0('0x13'),JSON[_0xb3b0('0x14')](_0x5bf3ae));if(_0x5bf3ae[_0xb3b0('0x15')]){if(_0x5bf3ae['error'][_0xb3b0('0x16')]===0x1f4){logger['error'](_0xb3b0('0x12'),_0x28c62b,_0x5bf3ae[_0xb3b0('0x15')][_0xb3b0('0x17')]);return _0x323840(_0x5bf3ae[_0xb3b0('0x15')][_0xb3b0('0x17')]);}logger[_0xb3b0('0x15')]('FaxQueue,\x20%s,\x20%s',_0x28c62b,_0x5bf3ae[_0xb3b0('0x15')][_0xb3b0('0x17')]);return _0x2888a8(_0x5bf3ae['error'][_0xb3b0('0x17')]);}else{logger[_0xb3b0('0x11')](_0xb3b0('0x12'),_0x28c62b,'request\x20sent');_0x2888a8(_0x5bf3ae[_0xb3b0('0x18')][_0xb3b0('0x17')]);}})[_0xb3b0('0x19')](function(_0x5590c8){logger[_0xb3b0('0x15')](_0xb3b0('0x12'),_0x28c62b,_0x5590c8);_0x323840(_0x5590c8);});});}exports['GetFaxQueue']=function(_0x4bce17){var _0x93ccea=this;return new Promise(function(_0x30d726,_0x4355fd){return db[_0xb3b0('0x1a')][_0xb3b0('0x1b')]({'raw':_0x4bce17['options']?_0x4bce17[_0xb3b0('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4bce17['options']?_0x4bce17[_0xb3b0('0x1c')]['where']||null:null,'attributes':_0x4bce17[_0xb3b0('0x1c')]?_0x4bce17[_0xb3b0('0x1c')][_0xb3b0('0x1d')]||null:null,'limit':_0x4bce17[_0xb3b0('0x1c')]?_0x4bce17['options'][_0xb3b0('0x1e')]||null:null,'include':_0x4bce17['options']?_0x4bce17[_0xb3b0('0x1c')][_0xb3b0('0x1f')]?_[_0xb3b0('0x20')](_0x4bce17[_0xb3b0('0x1c')][_0xb3b0('0x1f')],function(_0x23a9a6){return{'model':db[_0x23a9a6[_0xb3b0('0x21')]],'as':_0x23a9a6['as'],'attributes':_0x23a9a6[_0xb3b0('0x1d')],'include':_0x23a9a6[_0xb3b0('0x1f')]?_[_0xb3b0('0x20')](_0x23a9a6['include'],function(_0x541c7c){return{'model':db[_0x541c7c[_0xb3b0('0x21')]],'as':_0x541c7c['as'],'attributes':_0x541c7c[_0xb3b0('0x1d')],'include':_0x541c7c[_0xb3b0('0x1f')]?_['map'](_0x541c7c[_0xb3b0('0x1f')],function(_0x1b339a){return{'model':db[_0x1b339a[_0xb3b0('0x21')]],'as':_0x1b339a['as'],'attributes':_0x1b339a[_0xb3b0('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29b460){logger[_0xb3b0('0x11')](_0xb3b0('0x22'),_0x4bce17);logger[_0xb3b0('0x23')](_0xb3b0('0x22'),_0x4bce17,JSON[_0xb3b0('0x14')](_0x29b460));_0x30d726(_0x29b460);})['catch'](function(_0x30ce6b){logger[_0xb3b0('0x15')](_0xb3b0('0x22'),_0x30ce6b['message'],_0x4bce17);_0x4355fd(_0x93ccea[_0xb3b0('0x15')](0x1f4,_0x30ce6b[_0xb3b0('0x17')]));});});};exports['ShowFaxQueue']=function(_0x18ed47){var _0x556c47=this;return new Promise(function(_0x569df2,_0x3a83cd){return db['FaxQueue'][_0xb3b0('0x24')]({'raw':_0x18ed47[_0xb3b0('0x1c')]?_0x18ed47[_0xb3b0('0x1c')][_0xb3b0('0x25')]===undefined?!![]:![]:!![],'where':_0x18ed47[_0xb3b0('0x1c')]?_0x18ed47[_0xb3b0('0x1c')][_0xb3b0('0x26')]||null:null,'attributes':_0x18ed47['options']?_0x18ed47['options']['attributes']||null:null,'include':_0x18ed47[_0xb3b0('0x1c')]?_0x18ed47['options']['include']?_[_0xb3b0('0x20')](_0x18ed47['options'][_0xb3b0('0x1f')],function(_0x5f2727){return{'model':db[_0x5f2727[_0xb3b0('0x21')]],'as':_0x5f2727['as'],'attributes':_0x5f2727['attributes'],'include':_0x5f2727['include']?_[_0xb3b0('0x20')](_0x5f2727['include'],function(_0x2c0fc0){return{'model':db[_0x2c0fc0[_0xb3b0('0x21')]],'as':_0x2c0fc0['as'],'attributes':_0x2c0fc0[_0xb3b0('0x1d')],'include':_0x2c0fc0[_0xb3b0('0x1f')]?_[_0xb3b0('0x20')](_0x2c0fc0['include'],function(_0x19da2e){return{'model':db[_0x19da2e[_0xb3b0('0x21')]],'as':_0x19da2e['as'],'attributes':_0x19da2e[_0xb3b0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb3b0('0x10')](function(_0x5456ed){logger['info'](_0xb3b0('0x27'),_0x18ed47);logger[_0xb3b0('0x23')](_0xb3b0('0x27'),_0x18ed47,JSON['stringify'](_0x5456ed));_0x569df2(_0x5456ed);})[_0xb3b0('0x19')](function(_0x4f8503){logger[_0xb3b0('0x15')](_0xb3b0('0x27'),_0x4f8503[_0xb3b0('0x17')],_0x18ed47);_0x3a83cd(_0x556c47['error'](0x1f4,_0x4f8503[_0xb3b0('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 1393dcc..d1394ab 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 _0x404a=['removeListener','register','length','faxQueue:','./faxQueue.events','save','update','emit'];(function(_0x12cf70,_0x5b6124){var _0x4d5322=function(_0x2200e5){while(--_0x2200e5){_0x12cf70['push'](_0x12cf70['shift']());}};_0x4d5322(++_0x5b6124);}(_0x404a,0x10c));var _0xa404=function(_0x287e90,_0x568ebe){_0x287e90=_0x287e90-0x0;var _0x45738d=_0x404a[_0x287e90];return _0x45738d;};'use strict';var FaxQueueEvents=require(_0xa404('0x0'));var events=[_0xa404('0x1'),'remove',_0xa404('0x2')];function createListener(_0x4245c1,_0x5e26d2){return function(_0x41011c){_0x5e26d2[_0xa404('0x3')](_0x4245c1,_0x41011c);};}function removeListener(_0x343cf3,_0x2583f0){return function(){FaxQueueEvents[_0xa404('0x4')](_0x343cf3,_0x2583f0);};}exports[_0xa404('0x5')]=function(_0x53d138){for(var _0x3c1b58=0x0,_0x269ddb=events[_0xa404('0x6')];_0x3c1b58<_0x269ddb;_0x3c1b58++){var _0x798f86=events[_0x3c1b58];var _0x4ba503=createListener(_0xa404('0x7')+_0x798f86,_0x53d138);FaxQueueEvents['on'](_0x798f86,_0x4ba503);}}; \ No newline at end of file +var _0x1a31=['register','faxQueue:','update','emit'];(function(_0x4016d8,_0x207c7f){var _0x63d7e1=function(_0x493cda){while(--_0x493cda){_0x4016d8['push'](_0x4016d8['shift']());}};_0x63d7e1(++_0x207c7f);}(_0x1a31,0xca));var _0x11a3=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x1a31[_0x4e676e];return _0x336a3c;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save','remove',_0x11a3('0x0')];function createListener(_0x5d45cd,_0x3ab1ab){return function(_0x46eed4){_0x3ab1ab[_0x11a3('0x1')](_0x5d45cd,_0x46eed4);};}function removeListener(_0xba22ce,_0x2b2168){return function(){FaxQueueEvents['removeListener'](_0xba22ce,_0x2b2168);};}exports[_0x11a3('0x2')]=function(_0x3849a6){for(var _0x3ed527=0x0,_0x2ab9fd=events['length'];_0x3ed527<_0x2ab9fd;_0x3ed527++){var _0xe26ee4=events[_0x3ed527];var _0x407e6b=createListener(_0x11a3('0x3')+_0xe26ee4,_0x3849a6);FaxQueueEvents['on'](_0xe26ee4,_0x407e6b);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 1c45df5..4e403f9 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 _0x364f=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','show','getMembers','/:id/teams','getTeams','/:id/users','create','post','addTeams','update','/:id','destroy','delete','removeTeams'];(function(_0x3c8c63,_0x5530ea){var _0x872537=function(_0x10236e){while(--_0x10236e){_0x3c8c63['push'](_0x3c8c63['shift']());}};_0x872537(++_0x5530ea);}(_0x364f,0x19e));var _0xf364=function(_0x28f922,_0x1302f8){_0x28f922=_0x28f922-0x0;var _0x4eceac=_0x364f[_0x28f922];return _0x4eceac;};'use strict';var multer=require('multer');var util=require(_0xf364('0x0'));var path=require(_0xf364('0x1'));var timeout=require('connect-timeout');var express=require(_0xf364('0x2'));var router=express[_0xf364('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf364('0x4'));var interaction=require(_0xf364('0x5'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0xf364('0x6')]('/',auth[_0xf364('0x7')](),controller[_0xf364('0x8')]);router[_0xf364('0x6')]('/describe',auth[_0xf364('0x7')](),controller[_0xf364('0x9')]);router[_0xf364('0x6')]('/:id',auth[_0xf364('0x7')](),controller[_0xf364('0xa')]);router[_0xf364('0x6')]('/:id/members',auth['isAuthenticated'](),controller[_0xf364('0xb')]);router['get'](_0xf364('0xc'),auth[_0xf364('0x7')](),controller[_0xf364('0xd')]);router[_0xf364('0x6')](_0xf364('0xe'),auth[_0xf364('0x7')](),controller['getAgents']);router['post']('/',auth[_0xf364('0x7')](),controller[_0xf364('0xf')]);router[_0xf364('0x10')](_0xf364('0xc'),auth[_0xf364('0x7')](),controller[_0xf364('0x11')]);router[_0xf364('0x10')](_0xf364('0xe'),auth[_0xf364('0x7')](),controller['addAgents']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xf364('0x12')]);router['delete'](_0xf364('0x13'),auth[_0xf364('0x7')](),controller[_0xf364('0x14')]);router[_0xf364('0x15')](_0xf364('0xc'),auth['isAuthenticated'](),controller[_0xf364('0x16')]);router[_0xf364('0x15')]('/:id/users',auth[_0xf364('0x7')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xfc2c=['post','/:id/users','addAgents','put','/:id','update','delete','removeTeams','removeAgents','util','connect-timeout','Router','fs-extra','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','create','addTeams'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xfc2c,0x13d));var _0xcfc2=function(_0x377d73,_0x1faa82){_0x377d73=_0x377d73-0x0;var _0x110966=_0xfc2c[_0x377d73];return _0x110966;};'use strict';var multer=require('multer');var util=require(_0xcfc2('0x0'));var path=require('path');var timeout=require(_0xcfc2('0x1'));var express=require('express');var router=express[_0xcfc2('0x2')]();var fs_extra=require(_0xcfc2('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xcfc2('0x4'));var config=require('../../config/environment');var controller=require(_0xcfc2('0x5'));router[_0xcfc2('0x6')]('/',auth[_0xcfc2('0x7')](),controller[_0xcfc2('0x8')]);router['get'](_0xcfc2('0x9'),auth[_0xcfc2('0x7')](),controller[_0xcfc2('0xa')]);router['get']('/:id',auth[_0xcfc2('0x7')](),controller[_0xcfc2('0xb')]);router[_0xcfc2('0x6')](_0xcfc2('0xc'),auth[_0xcfc2('0x7')](),controller[_0xcfc2('0xd')]);router[_0xcfc2('0x6')](_0xcfc2('0xe'),auth[_0xcfc2('0x7')](),controller[_0xcfc2('0xf')]);router[_0xcfc2('0x6')]('/:id/users',auth[_0xcfc2('0x7')](),controller[_0xcfc2('0x10')]);router['post']('/',auth[_0xcfc2('0x7')](),controller[_0xcfc2('0x11')]);router['post'](_0xcfc2('0xe'),auth[_0xcfc2('0x7')](),controller[_0xcfc2('0x12')]);router[_0xcfc2('0x13')](_0xcfc2('0x14'),auth['isAuthenticated'](),controller[_0xcfc2('0x15')]);router[_0xcfc2('0x16')](_0xcfc2('0x17'),auth['isAuthenticated'](),controller[_0xcfc2('0x18')]);router[_0xcfc2('0x19')](_0xcfc2('0x17'),auth[_0xcfc2('0x7')](),controller['destroy']);router[_0xcfc2('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xcfc2('0x1a')]);router[_0xcfc2('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0xcfc2('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 1f14e1f..9a592de 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 _0xbc34=['STRING','DATE','moment'];(function(_0x225ac3,_0x2743e7){var _0x2ca420=function(_0x1f5830){while(--_0x1f5830){_0x225ac3['push'](_0x225ac3['shift']());}};_0x2ca420(++_0x2743e7);}(_0xbc34,0xb6));var _0x4bc3=function(_0x56d9a0,_0x3a1bef){_0x56d9a0=_0x56d9a0-0x0;var _0x2b422f=_0xbc34[_0x56d9a0];return _0x2b422f;};'use strict';var moment=require(_0x4bc3('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x4bc3('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x4bc3('0x1')]},'joinAt':{'type':Sequelize[_0x4bc3('0x2')]},'leaveAt':{'type':Sequelize[_0x4bc3('0x2')]},'acceptAt':{'type':Sequelize[_0x4bc3('0x2')]},'exitAt':{'type':Sequelize[_0x4bc3('0x2')]},'reason':{'type':Sequelize[_0x4bc3('0x1')]}}; \ No newline at end of file +var _0xb5de=['sequelize','STRING','DATE','moment'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0xb5de,0x1e3));var _0xeb5d=function(_0x29a9c0,_0xa4858b){_0x29a9c0=_0x29a9c0-0x0;var _0x4b8dd3=_0xb5de[_0x29a9c0];return _0x4b8dd3;};'use strict';var moment=require(_0xeb5d('0x0'));var Sequelize=require(_0xeb5d('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xeb5d('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xeb5d('0x3')]},'leaveAt':{'type':Sequelize[_0xeb5d('0x3')]},'acceptAt':{'type':Sequelize[_0xeb5d('0x3')]},'exitAt':{'type':Sequelize[_0xeb5d('0x3')]},'reason':{'type':Sequelize[_0xeb5d('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index e5b4d11..2b61369 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 _0xd8c6=['key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','status','set','Content-Range','reject','save','update','destroy','error','stack','name','index','FaxQueueReport','rawAttributes','fieldName','type'];(function(_0x274e84,_0x306f4e){var _0x3591b0=function(_0x59f1eb){while(--_0x59f1eb){_0x274e84['push'](_0x274e84['shift']());}};_0x3591b0(++_0x306f4e);}(_0xd8c6,0x19c));var _0x6d8c=function(_0x4ded65,_0xc8d7c1){_0x4ded65=_0x4ded65-0x0;var _0x5864fb=_0xd8c6[_0x4ded65];return _0x5864fb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6d8c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6d8c('0x1'));var rp=require(_0x6d8c('0x2'));var moment=require('moment');var BPromise=require(_0x6d8c('0x3'));var Mustache=require(_0x6d8c('0x4'));var util=require(_0x6d8c('0x5'));var path=require(_0x6d8c('0x6'));var sox=require(_0x6d8c('0x7'));var csv=require(_0x6d8c('0x8'));var ejs=require(_0x6d8c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6d8c('0xa'));var crypto=require(_0x6d8c('0xb'));var jsforce=require(_0x6d8c('0xc'));var deskjs=require(_0x6d8c('0xd'));var toCsv=require(_0x6d8c('0x8'));var querystring=require(_0x6d8c('0xe'));var Papa=require(_0x6d8c('0xf'));var Redis=require(_0x6d8c('0x10'));var authService=require(_0x6d8c('0x11'));var qs=require(_0x6d8c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6d8c('0x13'))(_0x6d8c('0x14'));var utils=require(_0x6d8c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6d8c('0x16'));var db=require(_0x6d8c('0x17'))['db'];function respondWithStatusCode(_0x2f7640,_0x460737){_0x460737=_0x460737||0xcc;return function(_0x521b19){if(_0x521b19){return _0x2f7640[_0x6d8c('0x18')](_0x460737);}return _0x2f7640['status'](_0x460737)[_0x6d8c('0x19')]();};}function respondWithResult(_0x5656cb,_0x1f505a){_0x1f505a=_0x1f505a||0xc8;return function(_0x2c6465){if(_0x2c6465){return _0x5656cb['status'](_0x1f505a)[_0x6d8c('0x1a')](_0x2c6465);}};}function respondWithFilteredResult(_0x5302ef,_0x562937){return function(_0x48b053){if(_0x48b053){var _0x27bee3=_0x48b053[_0x6d8c('0x1b')],_0x482be1=_0x562937[_0x6d8c('0x1c')],_0x1863d8=_0x562937[_0x6d8c('0x1c')]+_0x562937['limit'],_0x1bb202;if(_0x1863d8>=_0x27bee3){_0x1863d8=_0x27bee3;_0x1bb202=0xc8;}else{_0x1bb202=0xce;}_0x5302ef[_0x6d8c('0x1d')](_0x1bb202);return _0x5302ef[_0x6d8c('0x1e')](_0x6d8c('0x1f'),_0x482be1+'-'+_0x1863d8+'/'+_0x27bee3)['json'](_0x48b053);}return null;};}function patchUpdates(_0x5ef436){return function(_0x3eafc4){try{jsonpatch['apply'](_0x3eafc4,_0x5ef436,!![]);}catch(_0x550642){return BPromise[_0x6d8c('0x20')](_0x550642);}return _0x3eafc4[_0x6d8c('0x21')]();};}function saveUpdates(_0x55f673,_0x26d341){return function(_0x272aba){if(_0x272aba){return _0x272aba[_0x6d8c('0x22')](_0x55f673)['then'](function(_0x2580c6){return _0x2580c6;});}return null;};}function removeEntity(_0x1c68c1,_0x1b383e){return function(_0x8ba842){if(_0x8ba842){return _0x8ba842[_0x6d8c('0x23')]()['then'](function(){_0x1c68c1[_0x6d8c('0x1d')](0xcc)[_0x6d8c('0x19')]();});}};}function handleEntityNotFound(_0x509eb2,_0x249f3c){return function(_0x1669c8){if(!_0x1669c8){_0x509eb2[_0x6d8c('0x18')](0x194);}return _0x1669c8;};}function handleError(_0x5e8867,_0x2c9cc1){_0x2c9cc1=_0x2c9cc1||0x1f4;return function(_0x36e82a){logger[_0x6d8c('0x24')](_0x36e82a[_0x6d8c('0x25')]);if(_0x36e82a[_0x6d8c('0x26')]){delete _0x36e82a[_0x6d8c('0x26')];}_0x5e8867[_0x6d8c('0x1d')](_0x2c9cc1)['send'](_0x36e82a);};}exports[_0x6d8c('0x27')]=function(_0x5ea406,_0x57979a){var _0x32f9bb={},_0x2f8c3b={},_0x1b01b3={'count':0x0,'rows':[]};var _0x3aeb40=_['map'](db[_0x6d8c('0x28')][_0x6d8c('0x29')],function(_0x2b0028){return{'name':_0x2b0028[_0x6d8c('0x2a')],'type':_0x2b0028[_0x6d8c('0x2b')][_0x6d8c('0x2c')]};});_0x2f8c3b['model']=_[_0x6d8c('0x2d')](_0x3aeb40,'name');_0x2f8c3b[_0x6d8c('0x2e')]=_[_0x6d8c('0x2f')](_0x5ea406['query']);_0x2f8c3b[_0x6d8c('0x30')]=_[_0x6d8c('0x31')](_0x2f8c3b[_0x6d8c('0x32')],_0x2f8c3b[_0x6d8c('0x2e')]);_0x32f9bb['attributes']=_[_0x6d8c('0x31')](_0x2f8c3b[_0x6d8c('0x32')],qs[_0x6d8c('0x33')](_0x5ea406['query']['fields']));_0x32f9bb[_0x6d8c('0x34')]=_0x32f9bb['attributes'][_0x6d8c('0x35')]?_0x32f9bb[_0x6d8c('0x34')]:_0x2f8c3b['model'];if(!_0x5ea406['query'][_0x6d8c('0x36')](_0x6d8c('0x37'))){_0x32f9bb[_0x6d8c('0x38')]=qs['limit'](_0x5ea406[_0x6d8c('0x2e')][_0x6d8c('0x38')]);_0x32f9bb['offset']=qs[_0x6d8c('0x1c')](_0x5ea406[_0x6d8c('0x2e')][_0x6d8c('0x1c')]);}_0x32f9bb[_0x6d8c('0x39')]=qs[_0x6d8c('0x3a')](_0x5ea406[_0x6d8c('0x2e')][_0x6d8c('0x3a')]);_0x32f9bb['where']=qs[_0x6d8c('0x30')](_[_0x6d8c('0x3b')](_0x5ea406[_0x6d8c('0x2e')],_0x2f8c3b[_0x6d8c('0x30')]),_0x3aeb40);if(_0x5ea406[_0x6d8c('0x2e')][_0x6d8c('0x3c')]){_0x32f9bb[_0x6d8c('0x3d')]=_[_0x6d8c('0x3e')](_0x32f9bb[_0x6d8c('0x3d')],{'$or':_[_0x6d8c('0x2d')](_0x3aeb40,function(_0x4964a9){if(_0x4964a9[_0x6d8c('0x2b')]!==_0x6d8c('0x3f')){var _0x5a5a39={};_0x5a5a39[_0x4964a9[_0x6d8c('0x26')]]={'$like':'%'+_0x5ea406['query'][_0x6d8c('0x3c')]+'%'};return _0x5a5a39;}})});}_0x32f9bb=_['merge']({},_0x32f9bb,_0x5ea406[_0x6d8c('0x40')]);var _0x43d026={'where':_0x32f9bb['where']};return db[_0x6d8c('0x28')][_0x6d8c('0x1b')](_0x43d026)[_0x6d8c('0x41')](function(_0x35253e){_0x1b01b3[_0x6d8c('0x1b')]=_0x35253e;if(_0x5ea406['query'][_0x6d8c('0x42')]){_0x32f9bb[_0x6d8c('0x43')]=[{'all':!![]}];}return db[_0x6d8c('0x28')][_0x6d8c('0x44')](_0x32f9bb);})['then'](function(_0x5c59aa){_0x1b01b3[_0x6d8c('0x45')]=_0x5c59aa;return _0x1b01b3;})['then'](respondWithFilteredResult(_0x57979a,_0x32f9bb))[_0x6d8c('0x46')](handleError(_0x57979a,null));};exports['show']=function(_0x2461c0,_0x396c35){var _0x58f80b={'raw':!![],'where':{'id':_0x2461c0[_0x6d8c('0x47')]['id']}},_0x440d3a={};_0x440d3a[_0x6d8c('0x32')]=_[_0x6d8c('0x2f')](db['FaxQueueReport'][_0x6d8c('0x29')]);_0x440d3a[_0x6d8c('0x2e')]=_[_0x6d8c('0x2f')](_0x2461c0[_0x6d8c('0x2e')]);_0x440d3a[_0x6d8c('0x30')]=_['intersection'](_0x440d3a[_0x6d8c('0x32')],_0x440d3a[_0x6d8c('0x2e')]);_0x58f80b[_0x6d8c('0x34')]=_['intersection'](_0x440d3a[_0x6d8c('0x32')],qs[_0x6d8c('0x33')](_0x2461c0[_0x6d8c('0x2e')][_0x6d8c('0x33')]));_0x58f80b['attributes']=_0x58f80b[_0x6d8c('0x34')][_0x6d8c('0x35')]?_0x58f80b[_0x6d8c('0x34')]:_0x440d3a['model'];if(_0x2461c0[_0x6d8c('0x2e')][_0x6d8c('0x42')]){_0x58f80b[_0x6d8c('0x43')]=[{'all':!![]}];}_0x58f80b=_[_0x6d8c('0x3e')]({},_0x58f80b,_0x2461c0['options']);return db[_0x6d8c('0x28')][_0x6d8c('0x48')](_0x58f80b)['then'](handleEntityNotFound(_0x396c35,null))['then'](respondWithResult(_0x396c35,null))['catch'](handleError(_0x396c35,null));};exports['create']=function(_0x5490b6,_0x352851){return db[_0x6d8c('0x28')][_0x6d8c('0x49')](_0x5490b6[_0x6d8c('0x4a')],{})[_0x6d8c('0x41')](respondWithResult(_0x352851,0xc9))[_0x6d8c('0x46')](handleError(_0x352851,null));};exports[_0x6d8c('0x22')]=function(_0x21608c,_0x466ccd){if(_0x21608c[_0x6d8c('0x4a')]['id']){delete _0x21608c[_0x6d8c('0x4a')]['id'];}return db['FaxQueueReport'][_0x6d8c('0x48')]({'where':{'id':_0x21608c[_0x6d8c('0x47')]['id']}})[_0x6d8c('0x41')](handleEntityNotFound(_0x466ccd,null))[_0x6d8c('0x41')](saveUpdates(_0x21608c[_0x6d8c('0x4a')],null))[_0x6d8c('0x41')](respondWithResult(_0x466ccd,null))[_0x6d8c('0x46')](handleError(_0x466ccd,null));};exports['destroy']=function(_0x39ceff,_0x526082){return db[_0x6d8c('0x28')][_0x6d8c('0x48')]({'where':{'id':_0x39ceff[_0x6d8c('0x47')]['id']}})[_0x6d8c('0x41')](handleEntityNotFound(_0x526082,null))['then'](removeEntity(_0x526082,null))[_0x6d8c('0x46')](handleError(_0x526082,null));};exports[_0x6d8c('0x4b')]=function(_0x23cb36,_0x4a63f1){return db[_0x6d8c('0x28')][_0x6d8c('0x4b')]()[_0x6d8c('0x41')](respondWithResult(_0x4a63f1,null))[_0x6d8c('0x46')](handleError(_0x4a63f1,null));}; \ No newline at end of file +var _0x9f67=['mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','nolimit','limit','order','pick','filter','where','merge','includeAll','findAll','catch','show','params','length','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x3a1f7e,_0x9449c4){var _0x3f1742=function(_0x52f333){while(--_0x52f333){_0x3a1f7e['push'](_0x3a1f7e['shift']());}};_0x3f1742(++_0x9449c4);}(_0x9f67,0xcd));var _0x79f6=function(_0xb6b2c1,_0x140d6b){_0xb6b2c1=_0xb6b2c1-0x0;var _0x297888=_0x9f67[_0xb6b2c1];return _0x297888;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x79f6('0x0'));var zipdir=require(_0x79f6('0x1'));var jsonpatch=require(_0x79f6('0x2'));var rp=require(_0x79f6('0x3'));var moment=require('moment');var BPromise=require(_0x79f6('0x4'));var Mustache=require(_0x79f6('0x5'));var util=require(_0x79f6('0x6'));var path=require('path');var sox=require(_0x79f6('0x7'));var csv=require(_0x79f6('0x8'));var ejs=require(_0x79f6('0x9'));var fs=require('fs');var fs_extra=require(_0x79f6('0xa'));var _=require('lodash');var squel=require(_0x79f6('0xb'));var crypto=require(_0x79f6('0xc'));var jsforce=require(_0x79f6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x79f6('0x8'));var querystring=require(_0x79f6('0xe'));var Papa=require(_0x79f6('0xf'));var Redis=require(_0x79f6('0x10'));var authService=require(_0x79f6('0x11'));var qs=require(_0x79f6('0x12'));var as=require(_0x79f6('0x13'));var hardwareService=require(_0x79f6('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x79f6('0x15'));var config=require(_0x79f6('0x16'));var licenseUtil=require(_0x79f6('0x17'));var db=require(_0x79f6('0x18'))['db'];function respondWithStatusCode(_0x2a6b6f,_0x37e538){_0x37e538=_0x37e538||0xcc;return function(_0x4ca2d8){if(_0x4ca2d8){return _0x2a6b6f[_0x79f6('0x19')](_0x37e538);}return _0x2a6b6f[_0x79f6('0x1a')](_0x37e538)[_0x79f6('0x1b')]();};}function respondWithResult(_0x5acc02,_0x43b0e2){_0x43b0e2=_0x43b0e2||0xc8;return function(_0x2976ec){if(_0x2976ec){return _0x5acc02['status'](_0x43b0e2)[_0x79f6('0x1c')](_0x2976ec);}};}function respondWithFilteredResult(_0x116d08,_0x3c1236){return function(_0x45b2f5){if(_0x45b2f5){var _0x4bc3ef=_0x45b2f5[_0x79f6('0x1d')],_0x1314bf=_0x3c1236[_0x79f6('0x1e')],_0x47c66b=_0x3c1236['offset']+_0x3c1236['limit'],_0x57bad0;if(_0x47c66b>=_0x4bc3ef){_0x47c66b=_0x4bc3ef;_0x57bad0=0xc8;}else{_0x57bad0=0xce;}_0x116d08[_0x79f6('0x1a')](_0x57bad0);return _0x116d08['set'](_0x79f6('0x1f'),_0x1314bf+'-'+_0x47c66b+'/'+_0x4bc3ef)[_0x79f6('0x1c')](_0x45b2f5);}return null;};}function patchUpdates(_0x223dd3){return function(_0x2e7e26){try{jsonpatch[_0x79f6('0x20')](_0x2e7e26,_0x223dd3,!![]);}catch(_0x8c7548){return BPromise[_0x79f6('0x21')](_0x8c7548);}return _0x2e7e26[_0x79f6('0x22')]();};}function saveUpdates(_0x5469d7,_0x577253){return function(_0x38380e){if(_0x38380e){return _0x38380e[_0x79f6('0x23')](_0x5469d7)[_0x79f6('0x24')](function(_0x2ce0da){return _0x2ce0da;});}return null;};}function removeEntity(_0xadf737,_0x17829c){return function(_0x5a1c95){if(_0x5a1c95){return _0x5a1c95[_0x79f6('0x25')]()[_0x79f6('0x24')](function(){_0xadf737[_0x79f6('0x1a')](0xcc)[_0x79f6('0x1b')]();});}};}function handleEntityNotFound(_0x52cded,_0x10536c){return function(_0x40062d){if(!_0x40062d){_0x52cded[_0x79f6('0x19')](0x194);}return _0x40062d;};}function handleError(_0x402662,_0x581132){_0x581132=_0x581132||0x1f4;return function(_0x48e12d){logger['error'](_0x48e12d['stack']);if(_0x48e12d['name']){delete _0x48e12d[_0x79f6('0x26')];}_0x402662[_0x79f6('0x1a')](_0x581132)[_0x79f6('0x27')](_0x48e12d);};}exports[_0x79f6('0x28')]=function(_0x265d06,_0x367854){var _0x36caf3={},_0x3b12c6={},_0x206142={'count':0x0,'rows':[]};var _0x245dc3=_[_0x79f6('0x29')](db[_0x79f6('0x2a')][_0x79f6('0x2b')],function(_0x10a8a4){return{'name':_0x10a8a4[_0x79f6('0x2c')],'type':_0x10a8a4[_0x79f6('0x2d')][_0x79f6('0x2e')]};});_0x3b12c6['model']=_[_0x79f6('0x29')](_0x245dc3,_0x79f6('0x26'));_0x3b12c6[_0x79f6('0x2f')]=_[_0x79f6('0x30')](_0x265d06[_0x79f6('0x2f')]);_0x3b12c6[_0x79f6('0x31')]=_['intersection'](_0x3b12c6[_0x79f6('0x32')],_0x3b12c6[_0x79f6('0x2f')]);_0x36caf3[_0x79f6('0x33')]=_['intersection'](_0x3b12c6['model'],qs['fields'](_0x265d06[_0x79f6('0x2f')][_0x79f6('0x34')]));_0x36caf3['attributes']=_0x36caf3[_0x79f6('0x33')]['length']?_0x36caf3['attributes']:_0x3b12c6['model'];if(!_0x265d06[_0x79f6('0x2f')]['hasOwnProperty'](_0x79f6('0x35'))){_0x36caf3[_0x79f6('0x36')]=qs[_0x79f6('0x36')](_0x265d06[_0x79f6('0x2f')][_0x79f6('0x36')]);_0x36caf3[_0x79f6('0x1e')]=qs['offset'](_0x265d06['query'][_0x79f6('0x1e')]);}_0x36caf3[_0x79f6('0x37')]=qs['sort'](_0x265d06[_0x79f6('0x2f')]['sort']);_0x36caf3['where']=qs[_0x79f6('0x31')](_[_0x79f6('0x38')](_0x265d06['query'],_0x3b12c6[_0x79f6('0x31')]),_0x245dc3);if(_0x265d06[_0x79f6('0x2f')][_0x79f6('0x39')]){_0x36caf3[_0x79f6('0x3a')]=_[_0x79f6('0x3b')](_0x36caf3[_0x79f6('0x3a')],{'$or':_['map'](_0x245dc3,function(_0x598af2){if(_0x598af2[_0x79f6('0x2d')]!=='VIRTUAL'){var _0x168254={};_0x168254[_0x598af2[_0x79f6('0x26')]]={'$like':'%'+_0x265d06[_0x79f6('0x2f')]['filter']+'%'};return _0x168254;}})});}_0x36caf3=_['merge']({},_0x36caf3,_0x265d06['options']);var _0x389cf3={'where':_0x36caf3[_0x79f6('0x3a')]};return db[_0x79f6('0x2a')][_0x79f6('0x1d')](_0x389cf3)[_0x79f6('0x24')](function(_0x73bff7){_0x206142['count']=_0x73bff7;if(_0x265d06['query'][_0x79f6('0x3c')]){_0x36caf3['include']=[{'all':!![]}];}return db['FaxQueueReport'][_0x79f6('0x3d')](_0x36caf3);})['then'](function(_0x513875){_0x206142['rows']=_0x513875;return _0x206142;})[_0x79f6('0x24')](respondWithFilteredResult(_0x367854,_0x36caf3))[_0x79f6('0x3e')](handleError(_0x367854,null));};exports[_0x79f6('0x3f')]=function(_0xdcd751,_0x23d48a){var _0x1ca2fe={'raw':!![],'where':{'id':_0xdcd751[_0x79f6('0x40')]['id']}},_0x112bd7={};_0x112bd7[_0x79f6('0x32')]=_[_0x79f6('0x30')](db[_0x79f6('0x2a')][_0x79f6('0x2b')]);_0x112bd7[_0x79f6('0x2f')]=_[_0x79f6('0x30')](_0xdcd751['query']);_0x112bd7[_0x79f6('0x31')]=_['intersection'](_0x112bd7[_0x79f6('0x32')],_0x112bd7[_0x79f6('0x2f')]);_0x1ca2fe[_0x79f6('0x33')]=_['intersection'](_0x112bd7[_0x79f6('0x32')],qs[_0x79f6('0x34')](_0xdcd751[_0x79f6('0x2f')][_0x79f6('0x34')]));_0x1ca2fe[_0x79f6('0x33')]=_0x1ca2fe[_0x79f6('0x33')][_0x79f6('0x41')]?_0x1ca2fe['attributes']:_0x112bd7[_0x79f6('0x32')];if(_0xdcd751[_0x79f6('0x2f')][_0x79f6('0x3c')]){_0x1ca2fe['include']=[{'all':!![]}];}_0x1ca2fe=_[_0x79f6('0x3b')]({},_0x1ca2fe,_0xdcd751['options']);return db[_0x79f6('0x2a')][_0x79f6('0x42')](_0x1ca2fe)[_0x79f6('0x24')](handleEntityNotFound(_0x23d48a,null))[_0x79f6('0x24')](respondWithResult(_0x23d48a,null))[_0x79f6('0x3e')](handleError(_0x23d48a,null));};exports[_0x79f6('0x43')]=function(_0x39cb50,_0x562bda){return db[_0x79f6('0x2a')][_0x79f6('0x43')](_0x39cb50[_0x79f6('0x44')],{})['then'](respondWithResult(_0x562bda,0xc9))[_0x79f6('0x3e')](handleError(_0x562bda,null));};exports[_0x79f6('0x23')]=function(_0x170e7f,_0x12c4a4){if(_0x170e7f[_0x79f6('0x44')]['id']){delete _0x170e7f[_0x79f6('0x44')]['id'];}return db[_0x79f6('0x2a')]['find']({'where':{'id':_0x170e7f['params']['id']}})['then'](handleEntityNotFound(_0x12c4a4,null))['then'](saveUpdates(_0x170e7f[_0x79f6('0x44')],null))[_0x79f6('0x24')](respondWithResult(_0x12c4a4,null))[_0x79f6('0x3e')](handleError(_0x12c4a4,null));};exports[_0x79f6('0x25')]=function(_0x1f0d0b,_0x3ceab3){return db['FaxQueueReport']['find']({'where':{'id':_0x1f0d0b[_0x79f6('0x40')]['id']}})['then'](handleEntityNotFound(_0x3ceab3,null))[_0x79f6('0x24')](removeEntity(_0x3ceab3,null))[_0x79f6('0x3e')](handleError(_0x3ceab3,null));};exports[_0x79f6('0x45')]=function(_0xf77a70,_0x2da22e){return db[_0x79f6('0x2a')]['describe']()[_0x79f6('0x24')](respondWithResult(_0x2da22e,null))[_0x79f6('0x3e')](handleError(_0x2da22e,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index a6bef6e..e7e0ad7 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 _0x6406=['../../config/environment','./faxQueueReport.attributes','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6406,0x1de));var _0x6640=function(_0xe6e78c,_0x582369){_0xe6e78c=_0xe6e78c-0x0;var _0x2a09c8=_0x6406[_0xe6e78c];return _0x2a09c8;};'use strict';var _=require(_0x6640('0x0'));var util=require('util');var logger=require(_0x6640('0x1'))('api');var moment=require(_0x6640('0x2'));var BPromise=require(_0x6640('0x3'));var rp=require(_0x6640('0x4'));var fs=require('fs');var path=require(_0x6640('0x5'));var rimraf=require('rimraf');var config=require(_0x6640('0x6'));var attributes=require(_0x6640('0x7'));module['exports']=function(_0x4b031b,_0x2c85a9){return _0x4b031b['define'](_0x6640('0x8'),attributes,{'tableName':_0x6640('0x9'),'paranoid':![],'indexes':[{'name':_0x6640('0xa'),'fields':[_0x6640('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb09c=['api','moment','bluebird','request-promise','path','define','FaxQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x4079c0,_0x2eda63){var _0x591474=function(_0x373bb4){while(--_0x373bb4){_0x4079c0['push'](_0x4079c0['shift']());}};_0x591474(++_0x2eda63);}(_0xb09c,0x148));var _0xcb09=function(_0x3a09fe,_0x2c7078){_0x3a09fe=_0x3a09fe-0x0;var _0x38f47f=_0xb09c[_0x3a09fe];return _0x38f47f;};'use strict';var _=require(_0xcb09('0x0'));var util=require('util');var logger=require(_0xcb09('0x1'))(_0xcb09('0x2'));var moment=require(_0xcb09('0x3'));var BPromise=require(_0xcb09('0x4'));var rp=require(_0xcb09('0x5'));var fs=require('fs');var path=require(_0xcb09('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxQueueReport.attributes');module['exports']=function(_0x309990,_0x33b1c0){return _0x309990[_0xcb09('0x7')](_0xcb09('0x8'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xcb09('0x9'),'fields':[_0xcb09('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 51a5b85..229dcb2 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 _0x4341=['lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','body','attributes','limit','UpdateFaxQueueReport','stringify'];(function(_0x4b4889,_0x41cc03){var _0x38aac9=function(_0x514501){while(--_0x514501){_0x4b4889['push'](_0x4b4889['shift']());}};_0x38aac9(++_0x41cc03);}(_0x4341,0xb4));var _0x1434=function(_0x121195,_0x2cd8b8){_0x121195=_0x121195-0x0;var _0x363aea=_0x4341[_0x121195];return _0x363aea;};'use strict';var _=require(_0x1434('0x0'));var util=require(_0x1434('0x1'));var moment=require(_0x1434('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1434('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1434('0x4'))(_0x1434('0x5'));var config=require(_0x1434('0x6'));var jayson=require(_0x1434('0x7'));var client=jayson[_0x1434('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x80ff8,_0x1b2277,_0x2454d6){return new BPromise(function(_0x5a35d9,_0xf00298){return client[_0x1434('0x9')](_0x80ff8,_0x2454d6)[_0x1434('0xa')](function(_0x23653f){logger[_0x1434('0xb')](_0x1434('0xc'),_0x1b2277,_0x1434('0xd'));logger[_0x1434('0xe')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x1b2277,_0x1434('0xd'),JSON['stringify'](_0x23653f));if(_0x23653f[_0x1434('0xf')]){if(_0x23653f[_0x1434('0xf')][_0x1434('0x10')]===0x1f4){logger[_0x1434('0xf')](_0x1434('0xc'),_0x1b2277,_0x23653f[_0x1434('0xf')][_0x1434('0x11')]);return _0xf00298(_0x23653f[_0x1434('0xf')][_0x1434('0x11')]);}logger[_0x1434('0xf')](_0x1434('0xc'),_0x1b2277,_0x23653f['error']['message']);return _0x5a35d9(_0x23653f[_0x1434('0xf')][_0x1434('0x11')]);}else{logger[_0x1434('0xb')](_0x1434('0xc'),_0x1b2277,_0x1434('0xd'));_0x5a35d9(_0x23653f[_0x1434('0x12')][_0x1434('0x11')]);}})[_0x1434('0x13')](function(_0x12f0d2){logger['error'](_0x1434('0xc'),_0x1b2277,_0x12f0d2);_0xf00298(_0x12f0d2);});});}exports[_0x1434('0x14')]=function(_0x2b7300){var _0x516060=this;return new Promise(function(_0x4c6ab9,_0x544e93){return db[_0x1434('0x15')][_0x1434('0x16')](_0x2b7300['body'],{'raw':_0x2b7300[_0x1434('0x17')]?_0x2b7300['options'][_0x1434('0x18')]===undefined?!![]:![]:!![]})[_0x1434('0xa')](function(_0x545dad){logger[_0x1434('0xb')](_0x1434('0x14'),_0x2b7300);logger[_0x1434('0xe')](_0x1434('0x14'),_0x2b7300,JSON['stringify'](_0x545dad));_0x4c6ab9(_0x545dad);})[_0x1434('0x13')](function(_0x16dde4){logger['error'](_0x1434('0x14'),_0x16dde4[_0x1434('0x11')],_0x2b7300);_0x544e93(_0x516060['error'](0x1f4,_0x16dde4['message']));});});};exports['UpdateFaxQueueReport']=function(_0x2c53e6){var _0x4eb742=this;return new Promise(function(_0x4dac12,_0x51616b){return db[_0x1434('0x15')]['update'](_0x2c53e6[_0x1434('0x19')],{'raw':_0x2c53e6['options']?_0x2c53e6[_0x1434('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c53e6[_0x1434('0x17')]?_0x2c53e6[_0x1434('0x17')]['where']||null:null,'attributes':_0x2c53e6[_0x1434('0x17')]?_0x2c53e6['options'][_0x1434('0x1a')]||null:null,'limit':_0x2c53e6[_0x1434('0x17')]?_0x2c53e6['options'][_0x1434('0x1b')]||null:null})[_0x1434('0xa')](function(_0x4cb75c){logger[_0x1434('0xb')](_0x1434('0x1c'),_0x2c53e6);logger[_0x1434('0xe')](_0x1434('0x1c'),_0x2c53e6,JSON[_0x1434('0x1d')](_0x4cb75c));_0x4dac12(_0x4cb75c);})[_0x1434('0x13')](function(_0x35d7b5){logger[_0x1434('0xf')](_0x1434('0x1c'),_0x35d7b5[_0x1434('0x11')],_0x2c53e6);_0x51616b(_0x4eb742['error'](0x1f4,_0x35d7b5[_0x1434('0x11')]));});});}; \ No newline at end of file +var _0xea02=['rpc','../../config/environment','client','http','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateFaxQueueReport','FaxQueueReport','create','body','raw','update','options','where','limit','UpdateFaxQueueReport','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1d3fdc,_0x2b5c54){var _0x128bb0=function(_0x3b7184){while(--_0x3b7184){_0x1d3fdc['push'](_0x1d3fdc['shift']());}};_0x128bb0(++_0x2b5c54);}(_0xea02,0x110));var _0x2ea0=function(_0x1f02c7,_0x53ffa1){_0x1f02c7=_0x1f02c7-0x0;var _0x3f76d2=_0xea02[_0x1f02c7];return _0x3f76d2;};'use strict';var _=require(_0x2ea0('0x0'));var util=require(_0x2ea0('0x1'));var moment=require(_0x2ea0('0x2'));var BPromise=require(_0x2ea0('0x3'));var rs=require(_0x2ea0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ea0('0x5'))['db'];var utils=require(_0x2ea0('0x6'));var logger=require(_0x2ea0('0x7'))(_0x2ea0('0x8'));var config=require(_0x2ea0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2ea0('0xa')][_0x2ea0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bc35a,_0x4d6f52,_0xf6ed0c){return new BPromise(function(_0x420366,_0x343985){return client[_0x2ea0('0xc')](_0x3bc35a,_0xf6ed0c)[_0x2ea0('0xd')](function(_0x3570e3){logger['info'](_0x2ea0('0xe'),_0x4d6f52,_0x2ea0('0xf'));logger[_0x2ea0('0x10')](_0x2ea0('0x11'),_0x4d6f52,_0x2ea0('0xf'),JSON[_0x2ea0('0x12')](_0x3570e3));if(_0x3570e3[_0x2ea0('0x13')]){if(_0x3570e3[_0x2ea0('0x13')][_0x2ea0('0x14')]===0x1f4){logger[_0x2ea0('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x4d6f52,_0x3570e3['error']['message']);return _0x343985(_0x3570e3[_0x2ea0('0x13')][_0x2ea0('0x15')]);}logger['error'](_0x2ea0('0xe'),_0x4d6f52,_0x3570e3[_0x2ea0('0x13')][_0x2ea0('0x15')]);return _0x420366(_0x3570e3[_0x2ea0('0x13')][_0x2ea0('0x15')]);}else{logger[_0x2ea0('0x16')]('FaxQueueReport,\x20%s,\x20%s',_0x4d6f52,_0x2ea0('0xf'));_0x420366(_0x3570e3[_0x2ea0('0x17')][_0x2ea0('0x15')]);}})['catch'](function(_0x4eacfd){logger[_0x2ea0('0x13')](_0x2ea0('0xe'),_0x4d6f52,_0x4eacfd);_0x343985(_0x4eacfd);});});}exports[_0x2ea0('0x18')]=function(_0x5dccbb){var _0x3e0efb=this;return new Promise(function(_0x1431da,_0x331b6a){return db[_0x2ea0('0x19')][_0x2ea0('0x1a')](_0x5dccbb[_0x2ea0('0x1b')],{'raw':_0x5dccbb['options']?_0x5dccbb['options'][_0x2ea0('0x1c')]===undefined?!![]:![]:!![]})[_0x2ea0('0xd')](function(_0x26ab85){logger[_0x2ea0('0x16')]('CreateFaxQueueReport',_0x5dccbb);logger[_0x2ea0('0x10')]('CreateFaxQueueReport',_0x5dccbb,JSON[_0x2ea0('0x12')](_0x26ab85));_0x1431da(_0x26ab85);})['catch'](function(_0x112efc){logger[_0x2ea0('0x13')]('CreateFaxQueueReport',_0x112efc['message'],_0x5dccbb);_0x331b6a(_0x3e0efb[_0x2ea0('0x13')](0x1f4,_0x112efc['message']));});});};exports['UpdateFaxQueueReport']=function(_0x207065){var _0x3b3ae4=this;return new Promise(function(_0x20511f,_0x22c9c4){return db[_0x2ea0('0x19')][_0x2ea0('0x1d')](_0x207065[_0x2ea0('0x1b')],{'raw':_0x207065[_0x2ea0('0x1e')]?_0x207065[_0x2ea0('0x1e')][_0x2ea0('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x207065[_0x2ea0('0x1e')]?_0x207065[_0x2ea0('0x1e')][_0x2ea0('0x1f')]||null:null,'attributes':_0x207065['options']?_0x207065[_0x2ea0('0x1e')]['attributes']||null:null,'limit':_0x207065['options']?_0x207065[_0x2ea0('0x1e')][_0x2ea0('0x20')]||null:null})[_0x2ea0('0xd')](function(_0x23c85c){logger['info'](_0x2ea0('0x21'),_0x207065);logger[_0x2ea0('0x10')](_0x2ea0('0x21'),_0x207065,JSON[_0x2ea0('0x12')](_0x23c85c));_0x20511f(_0x23c85c);})[_0x2ea0('0x22')](function(_0xa5c65a){logger[_0x2ea0('0x13')]('UpdateFaxQueueReport',_0xa5c65a[_0x2ea0('0x15')],_0x207065);_0x22c9c4(_0x3b3ae4[_0x2ea0('0x13')](0x1f4,_0xa5c65a['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index ffe4500..5eb5bf3 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 _0x8d70=['index','describe','get','/:id','show','post','create','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxQueueReport.controller','isAuthenticated'];(function(_0x3b0b39,_0x37f803){var _0x17b968=function(_0x12f038){while(--_0x12f038){_0x3b0b39['push'](_0x3b0b39['shift']());}};_0x17b968(++_0x37f803);}(_0x8d70,0x195));var _0x08d7=function(_0x53da9a,_0x3c54a3){_0x53da9a=_0x53da9a-0x0;var _0x4b5642=_0x8d70[_0x53da9a];return _0x4b5642;};'use strict';var multer=require('multer');var util=require(_0x08d7('0x0'));var path=require(_0x08d7('0x1'));var timeout=require(_0x08d7('0x2'));var express=require(_0x08d7('0x3'));var router=express['Router']();var fs_extra=require(_0x08d7('0x4'));var auth=require(_0x08d7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x08d7('0x6'));var controller=require(_0x08d7('0x7'));router['get']('/',auth[_0x08d7('0x8')](),controller[_0x08d7('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x08d7('0xa')]);router[_0x08d7('0xb')](_0x08d7('0xc'),auth[_0x08d7('0x8')](),controller[_0x08d7('0xd')]);router[_0x08d7('0xe')]('/',auth['isAuthenticated'](),controller[_0x08d7('0xf')]);router['put'](_0x08d7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x08d7('0x10')](_0x08d7('0xc'),auth[_0x08d7('0x8')](),controller['destroy']);module[_0x08d7('0x11')]=router; \ No newline at end of file +var _0x8f69=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','index','get','/describe','isAuthenticated','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3bb3e1,_0xf69c2a){var _0x59f298=function(_0x3b08c0){while(--_0x3b08c0){_0x3bb3e1['push'](_0x3bb3e1['shift']());}};_0x59f298(++_0xf69c2a);}(_0x8f69,0x1ca));var _0x98f6=function(_0x1d8119,_0xc98f17){_0x1d8119=_0x1d8119-0x0;var _0x3e30f6=_0x8f69[_0x1d8119];return _0x3e30f6;};'use strict';var multer=require(_0x98f6('0x0'));var util=require(_0x98f6('0x1'));var path=require(_0x98f6('0x2'));var timeout=require(_0x98f6('0x3'));var express=require('express');var router=express[_0x98f6('0x4')]();var fs_extra=require(_0x98f6('0x5'));var auth=require(_0x98f6('0x6'));var interaction=require(_0x98f6('0x7'));var config=require(_0x98f6('0x8'));var controller=require(_0x98f6('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x98f6('0xa')]);router[_0x98f6('0xb')](_0x98f6('0xc'),auth[_0x98f6('0xd')](),controller['describe']);router['get']('/:id',auth[_0x98f6('0xd')](),controller['show']);router['post']('/',auth[_0x98f6('0xd')](),controller[_0x98f6('0xe')]);router[_0x98f6('0xf')](_0x98f6('0x10'),auth[_0x98f6('0xd')](),controller[_0x98f6('0x11')]);router[_0x98f6('0x12')](_0x98f6('0x10'),auth[_0x98f6('0xd')](),controller[_0x98f6('0x13')]);module[_0x98f6('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index eebd02e..a446e36 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 _0xc74a=['agent','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x4ac4bf,_0x4ccf69){var _0x15ba40=function(_0x275a8a){while(--_0x275a8a){_0x4ac4bf['push'](_0x4ac4bf['shift']());}};_0x15ba40(++_0x4ccf69);}(_0xc74a,0x80));var _0xac74=function(_0x513a8e,_0x9921d1){_0x513a8e=_0x513a8e-0x0;var _0x4979ab=_0xc74a[_0x513a8e];return _0x4979ab;};'use strict';var moment=require(_0xac74('0x0'));var Sequelize=require(_0xac74('0x1'));module[_0xac74('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xac74('0x3')](_0xac74('0x4'),_0xac74('0x5'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xac74('0x6')]}}; \ No newline at end of file +var _0xdf5e=['account','queue','DATE','sequelize','ENUM'];(function(_0x3dddc5,_0x31effa){var _0x3fa8cc=function(_0x538643){while(--_0x538643){_0x3dddc5['push'](_0x3dddc5['shift']());}};_0x3fa8cc(++_0x31effa);}(_0xdf5e,0x17f));var _0xedf5=function(_0x4b9978,_0x58eb71){_0x4b9978=_0x4b9978-0x0;var _0x42f0e5=_0xdf5e[_0x4b9978];return _0x42f0e5;};'use strict';var moment=require('moment');var Sequelize=require(_0xedf5('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xedf5('0x1')](_0xedf5('0x2'),'agent','queue'),'allowNull':![],'defaultValue':_0xedf5('0x3')},'transferredAt':{'type':Sequelize[_0xedf5('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 1651480..7759b23 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 _0xd8b0=['length','hasOwnProperty','order','sort','filters','pick','merge','type','VIRTUAL','options','where','FaxTransferReport','includeAll','include','findAll','rows','catch','show','params','keys','create','body','update','find','describe','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','map','rawAttributes','fieldName','key','query','intersection','model','fields','attributes'];(function(_0x46afaf,_0x42f1ac){var _0x4f0d63=function(_0x5c9c19){while(--_0x5c9c19){_0x46afaf['push'](_0x46afaf['shift']());}};_0x4f0d63(++_0x42f1ac);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x9'));var _=require('lodash');var squel=require(_0x0d8b('0xa'));var crypto=require(_0x0d8b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0d8b('0xc'));var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d8b('0x13'))('api');var utils=require(_0x0d8b('0x14'));var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];function respondWithStatusCode(_0x35a07b,_0x32bb1a){_0x32bb1a=_0x32bb1a||0xcc;return function(_0x15dd0f){if(_0x15dd0f){return _0x35a07b[_0x0d8b('0x18')](_0x32bb1a);}return _0x35a07b[_0x0d8b('0x19')](_0x32bb1a)[_0x0d8b('0x1a')]();};}function respondWithResult(_0x5ad086,_0xe65334){_0xe65334=_0xe65334||0xc8;return function(_0x1567ce){if(_0x1567ce){return _0x5ad086[_0x0d8b('0x19')](_0xe65334)['json'](_0x1567ce);}};}function respondWithFilteredResult(_0x23eb7b,_0xa86349){return function(_0x17f7df){if(_0x17f7df){var _0xe2e167=_0x17f7df[_0x0d8b('0x1b')],_0x2cb03c=_0xa86349[_0x0d8b('0x1c')],_0x5cd485=_0xa86349[_0x0d8b('0x1c')]+_0xa86349[_0x0d8b('0x1d')],_0x106a01;if(_0x5cd485>=_0xe2e167){_0x5cd485=_0xe2e167;_0x106a01=0xc8;}else{_0x106a01=0xce;}_0x23eb7b[_0x0d8b('0x19')](_0x106a01);return _0x23eb7b[_0x0d8b('0x1e')](_0x0d8b('0x1f'),_0x2cb03c+'-'+_0x5cd485+'/'+_0xe2e167)['json'](_0x17f7df);}return null;};}function patchUpdates(_0x27512e){return function(_0x23d58f){try{jsonpatch[_0x0d8b('0x20')](_0x23d58f,_0x27512e,!![]);}catch(_0x143372){return BPromise[_0x0d8b('0x21')](_0x143372);}return _0x23d58f[_0x0d8b('0x22')]();};}function saveUpdates(_0x393beb,_0x352c17){return function(_0x50ec1e){if(_0x50ec1e){return _0x50ec1e['update'](_0x393beb)[_0x0d8b('0x23')](function(_0x54a9a7){return _0x54a9a7;});}return null;};}function removeEntity(_0x56c729,_0x5527d8){return function(_0x238728){if(_0x238728){return _0x238728[_0x0d8b('0x24')]()[_0x0d8b('0x23')](function(){_0x56c729[_0x0d8b('0x19')](0xcc)[_0x0d8b('0x1a')]();});}};}function handleEntityNotFound(_0x2c64e2,_0x30980c){return function(_0x4562cb){if(!_0x4562cb){_0x2c64e2[_0x0d8b('0x18')](0x194);}return _0x4562cb;};}function handleError(_0x5e5bc3,_0xe8bbee){_0xe8bbee=_0xe8bbee||0x1f4;return function(_0x4463ee){logger['error'](_0x4463ee[_0x0d8b('0x25')]);if(_0x4463ee['name']){delete _0x4463ee[_0x0d8b('0x26')];}_0x5e5bc3[_0x0d8b('0x19')](_0xe8bbee)[_0x0d8b('0x27')](_0x4463ee);};}exports['index']=function(_0x59a905,_0x28f639){var _0x3ef745={},_0x4c05ee={},_0xcbc4ac={'count':0x0,'rows':[]};var _0x59aa83=_[_0x0d8b('0x28')](db['FaxTransferReport'][_0x0d8b('0x29')],function(_0x48f24f){return{'name':_0x48f24f[_0x0d8b('0x2a')],'type':_0x48f24f['type'][_0x0d8b('0x2b')]};});_0x4c05ee['model']=_[_0x0d8b('0x28')](_0x59aa83,_0x0d8b('0x26'));_0x4c05ee[_0x0d8b('0x2c')]=_['keys'](_0x59a905['query']);_0x4c05ee['filters']=_[_0x0d8b('0x2d')](_0x4c05ee['model'],_0x4c05ee[_0x0d8b('0x2c')]);_0x3ef745['attributes']=_['intersection'](_0x4c05ee[_0x0d8b('0x2e')],qs[_0x0d8b('0x2f')](_0x59a905[_0x0d8b('0x2c')][_0x0d8b('0x2f')]));_0x3ef745[_0x0d8b('0x30')]=_0x3ef745[_0x0d8b('0x30')][_0x0d8b('0x31')]?_0x3ef745[_0x0d8b('0x30')]:_0x4c05ee['model'];if(!_0x59a905[_0x0d8b('0x2c')][_0x0d8b('0x32')]('nolimit')){_0x3ef745[_0x0d8b('0x1d')]=qs[_0x0d8b('0x1d')](_0x59a905[_0x0d8b('0x2c')]['limit']);_0x3ef745[_0x0d8b('0x1c')]=qs[_0x0d8b('0x1c')](_0x59a905[_0x0d8b('0x2c')][_0x0d8b('0x1c')]);}_0x3ef745[_0x0d8b('0x33')]=qs['sort'](_0x59a905[_0x0d8b('0x2c')][_0x0d8b('0x34')]);_0x3ef745['where']=qs[_0x0d8b('0x35')](_[_0x0d8b('0x36')](_0x59a905[_0x0d8b('0x2c')],_0x4c05ee[_0x0d8b('0x35')]),_0x59aa83);if(_0x59a905[_0x0d8b('0x2c')]['filter']){_0x3ef745['where']=_[_0x0d8b('0x37')](_0x3ef745['where'],{'$or':_['map'](_0x59aa83,function(_0xc179bd){if(_0xc179bd[_0x0d8b('0x38')]!==_0x0d8b('0x39')){var _0x1388b1={};_0x1388b1[_0xc179bd[_0x0d8b('0x26')]]={'$like':'%'+_0x59a905[_0x0d8b('0x2c')]['filter']+'%'};return _0x1388b1;}})});}_0x3ef745=_[_0x0d8b('0x37')]({},_0x3ef745,_0x59a905[_0x0d8b('0x3a')]);var _0x28fd82={'where':_0x3ef745[_0x0d8b('0x3b')]};return db[_0x0d8b('0x3c')][_0x0d8b('0x1b')](_0x28fd82)[_0x0d8b('0x23')](function(_0x5c980b){_0xcbc4ac[_0x0d8b('0x1b')]=_0x5c980b;if(_0x59a905[_0x0d8b('0x2c')][_0x0d8b('0x3d')]){_0x3ef745[_0x0d8b('0x3e')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x0d8b('0x3f')](_0x3ef745);})['then'](function(_0x37b26c){_0xcbc4ac[_0x0d8b('0x40')]=_0x37b26c;return _0xcbc4ac;})[_0x0d8b('0x23')](respondWithFilteredResult(_0x28f639,_0x3ef745))[_0x0d8b('0x41')](handleError(_0x28f639,null));};exports[_0x0d8b('0x42')]=function(_0x3e632e,_0x1ff17d){var _0x373f69={'raw':!![],'where':{'id':_0x3e632e[_0x0d8b('0x43')]['id']}},_0x89ab0d={};_0x89ab0d['model']=_['keys'](db['FaxTransferReport']['rawAttributes']);_0x89ab0d['query']=_[_0x0d8b('0x44')](_0x3e632e[_0x0d8b('0x2c')]);_0x89ab0d[_0x0d8b('0x35')]=_['intersection'](_0x89ab0d['model'],_0x89ab0d[_0x0d8b('0x2c')]);_0x373f69[_0x0d8b('0x30')]=_[_0x0d8b('0x2d')](_0x89ab0d['model'],qs[_0x0d8b('0x2f')](_0x3e632e[_0x0d8b('0x2c')]['fields']));_0x373f69['attributes']=_0x373f69[_0x0d8b('0x30')]['length']?_0x373f69[_0x0d8b('0x30')]:_0x89ab0d['model'];if(_0x3e632e['query'][_0x0d8b('0x3d')]){_0x373f69[_0x0d8b('0x3e')]=[{'all':!![]}];}_0x373f69=_['merge']({},_0x373f69,_0x3e632e['options']);return db['FaxTransferReport']['find'](_0x373f69)[_0x0d8b('0x23')](handleEntityNotFound(_0x1ff17d,null))[_0x0d8b('0x23')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0x41')](handleError(_0x1ff17d,null));};exports['create']=function(_0xb0910e,_0x1afe8a){return db[_0x0d8b('0x3c')][_0x0d8b('0x45')](_0xb0910e[_0x0d8b('0x46')],{})[_0x0d8b('0x23')](respondWithResult(_0x1afe8a,0xc9))[_0x0d8b('0x41')](handleError(_0x1afe8a,null));};exports[_0x0d8b('0x47')]=function(_0x384a5e,_0x1f2077){if(_0x384a5e[_0x0d8b('0x46')]['id']){delete _0x384a5e[_0x0d8b('0x46')]['id'];}return db[_0x0d8b('0x3c')][_0x0d8b('0x48')]({'where':{'id':_0x384a5e[_0x0d8b('0x43')]['id']}})[_0x0d8b('0x23')](handleEntityNotFound(_0x1f2077,null))[_0x0d8b('0x23')](saveUpdates(_0x384a5e[_0x0d8b('0x46')],null))[_0x0d8b('0x23')](respondWithResult(_0x1f2077,null))['catch'](handleError(_0x1f2077,null));};exports[_0x0d8b('0x24')]=function(_0x4d8850,_0x5d29ab){return db[_0x0d8b('0x3c')][_0x0d8b('0x48')]({'where':{'id':_0x4d8850[_0x0d8b('0x43')]['id']}})[_0x0d8b('0x23')](handleEntityNotFound(_0x5d29ab,null))['then'](removeEntity(_0x5d29ab,null))[_0x0d8b('0x41')](handleError(_0x5d29ab,null));};exports[_0x0d8b('0x49')]=function(_0x386074,_0x241587){return db[_0x0d8b('0x3c')]['describe']()['then'](respondWithResult(_0x241587,null))['catch'](handleError(_0x241587,null));}; \ No newline at end of file +var _0x0b0e=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','map','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','keys','find','create','body','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','limit','apply','reject','update','then','destroy','sendStatus','error','name','send','index','FaxTransferReport','rawAttributes','fieldName','type','key','model','query'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2e655a,_0x6d5799){_0x2e655a=_0x2e655a-0x0;var _0x26f13b=_0x0b0e[_0x2e655a];return _0x26f13b;};'use strict';var pdf=require(_0xe0b0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe0b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0b0('0x2'));var rp=require(_0xe0b0('0x3'));var moment=require(_0xe0b0('0x4'));var BPromise=require(_0xe0b0('0x5'));var Mustache=require(_0xe0b0('0x6'));var util=require(_0xe0b0('0x7'));var path=require(_0xe0b0('0x8'));var sox=require(_0xe0b0('0x9'));var csv=require(_0xe0b0('0xa'));var ejs=require(_0xe0b0('0xb'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe0b0('0xd'));var jsforce=require(_0xe0b0('0xe'));var deskjs=require(_0xe0b0('0xf'));var toCsv=require(_0xe0b0('0xa'));var querystring=require('querystring');var Papa=require(_0xe0b0('0x10'));var Redis=require(_0xe0b0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe0b0('0x12'));var as=require(_0xe0b0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe0b0('0x14'))(_0xe0b0('0x15'));var utils=require(_0xe0b0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe0b0('0x17'));var db=require(_0xe0b0('0x18'))['db'];function respondWithStatusCode(_0x3cc19a,_0x45f914){_0x45f914=_0x45f914||0xcc;return function(_0x34fed4){if(_0x34fed4){return _0x3cc19a['sendStatus'](_0x45f914);}return _0x3cc19a[_0xe0b0('0x19')](_0x45f914)[_0xe0b0('0x1a')]();};}function respondWithResult(_0x743318,_0x24babd){_0x24babd=_0x24babd||0xc8;return function(_0x177c24){if(_0x177c24){return _0x743318['status'](_0x24babd)[_0xe0b0('0x1b')](_0x177c24);}};}function respondWithFilteredResult(_0x5adb01,_0x35cb40){return function(_0xadee6e){if(_0xadee6e){var _0x519ae8=_0xadee6e[_0xe0b0('0x1c')],_0x11fdca=_0x35cb40['offset'],_0x4a4cc0=_0x35cb40['offset']+_0x35cb40[_0xe0b0('0x1d')],_0x2d6fb6;if(_0x4a4cc0>=_0x519ae8){_0x4a4cc0=_0x519ae8;_0x2d6fb6=0xc8;}else{_0x2d6fb6=0xce;}_0x5adb01['status'](_0x2d6fb6);return _0x5adb01['set']('Content-Range',_0x11fdca+'-'+_0x4a4cc0+'/'+_0x519ae8)[_0xe0b0('0x1b')](_0xadee6e);}return null;};}function patchUpdates(_0x50fa4a){return function(_0x52598b){try{jsonpatch[_0xe0b0('0x1e')](_0x52598b,_0x50fa4a,!![]);}catch(_0x59dff5){return BPromise[_0xe0b0('0x1f')](_0x59dff5);}return _0x52598b['save']();};}function saveUpdates(_0x2c84cc,_0x1cd7c4){return function(_0x3e10b3){if(_0x3e10b3){return _0x3e10b3[_0xe0b0('0x20')](_0x2c84cc)[_0xe0b0('0x21')](function(_0x58b804){return _0x58b804;});}return null;};}function removeEntity(_0x4cae54,_0x2fa820){return function(_0x5512bb){if(_0x5512bb){return _0x5512bb[_0xe0b0('0x22')]()[_0xe0b0('0x21')](function(){_0x4cae54['status'](0xcc)[_0xe0b0('0x1a')]();});}};}function handleEntityNotFound(_0x503883,_0x2208d0){return function(_0x49a727){if(!_0x49a727){_0x503883[_0xe0b0('0x23')](0x194);}return _0x49a727;};}function handleError(_0x576352,_0x3e5c88){_0x3e5c88=_0x3e5c88||0x1f4;return function(_0x4de537){logger[_0xe0b0('0x24')](_0x4de537['stack']);if(_0x4de537[_0xe0b0('0x25')]){delete _0x4de537['name'];}_0x576352[_0xe0b0('0x19')](_0x3e5c88)[_0xe0b0('0x26')](_0x4de537);};}exports[_0xe0b0('0x27')]=function(_0x1d91ad,_0x3ec2){var _0x10745d={},_0x5200a6={},_0x1444b9={'count':0x0,'rows':[]};var _0x1b8aa8=_['map'](db[_0xe0b0('0x28')][_0xe0b0('0x29')],function(_0x36d137){return{'name':_0x36d137[_0xe0b0('0x2a')],'type':_0x36d137[_0xe0b0('0x2b')][_0xe0b0('0x2c')]};});_0x5200a6[_0xe0b0('0x2d')]=_['map'](_0x1b8aa8,_0xe0b0('0x25'));_0x5200a6[_0xe0b0('0x2e')]=_['keys'](_0x1d91ad['query']);_0x5200a6[_0xe0b0('0x2f')]=_[_0xe0b0('0x30')](_0x5200a6[_0xe0b0('0x2d')],_0x5200a6[_0xe0b0('0x2e')]);_0x10745d[_0xe0b0('0x31')]=_['intersection'](_0x5200a6[_0xe0b0('0x2d')],qs[_0xe0b0('0x32')](_0x1d91ad[_0xe0b0('0x2e')][_0xe0b0('0x32')]));_0x10745d[_0xe0b0('0x31')]=_0x10745d['attributes'][_0xe0b0('0x33')]?_0x10745d[_0xe0b0('0x31')]:_0x5200a6[_0xe0b0('0x2d')];if(!_0x1d91ad[_0xe0b0('0x2e')][_0xe0b0('0x34')](_0xe0b0('0x35'))){_0x10745d[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1d91ad[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x10745d[_0xe0b0('0x36')]=qs[_0xe0b0('0x36')](_0x1d91ad[_0xe0b0('0x2e')][_0xe0b0('0x36')]);}_0x10745d[_0xe0b0('0x37')]=qs['sort'](_0x1d91ad[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x10745d[_0xe0b0('0x39')]=qs[_0xe0b0('0x2f')](_[_0xe0b0('0x3a')](_0x1d91ad[_0xe0b0('0x2e')],_0x5200a6[_0xe0b0('0x2f')]),_0x1b8aa8);if(_0x1d91ad['query']['filter']){_0x10745d['where']=_['merge'](_0x10745d[_0xe0b0('0x39')],{'$or':_[_0xe0b0('0x3b')](_0x1b8aa8,function(_0xe6f635){if(_0xe6f635['type']!==_0xe0b0('0x3c')){var _0x352c09={};_0x352c09[_0xe6f635[_0xe0b0('0x25')]]={'$like':'%'+_0x1d91ad[_0xe0b0('0x2e')]['filter']+'%'};return _0x352c09;}})});}_0x10745d=_[_0xe0b0('0x3d')]({},_0x10745d,_0x1d91ad[_0xe0b0('0x3e')]);var _0x43d352={'where':_0x10745d[_0xe0b0('0x39')]};return db[_0xe0b0('0x28')][_0xe0b0('0x1c')](_0x43d352)[_0xe0b0('0x21')](function(_0x115a69){_0x1444b9[_0xe0b0('0x1c')]=_0x115a69;if(_0x1d91ad['query'][_0xe0b0('0x3f')]){_0x10745d['include']=[{'all':!![]}];}return db[_0xe0b0('0x28')][_0xe0b0('0x40')](_0x10745d);})[_0xe0b0('0x21')](function(_0x74f3fa){_0x1444b9['rows']=_0x74f3fa;return _0x1444b9;})[_0xe0b0('0x21')](respondWithFilteredResult(_0x3ec2,_0x10745d))[_0xe0b0('0x41')](handleError(_0x3ec2,null));};exports[_0xe0b0('0x42')]=function(_0x402a0e,_0x19c80e){var _0x1c12bd={'raw':!![],'where':{'id':_0x402a0e[_0xe0b0('0x43')]['id']}},_0x3ad564={};_0x3ad564['model']=_[_0xe0b0('0x44')](db[_0xe0b0('0x28')]['rawAttributes']);_0x3ad564['query']=_[_0xe0b0('0x44')](_0x402a0e[_0xe0b0('0x2e')]);_0x3ad564['filters']=_[_0xe0b0('0x30')](_0x3ad564[_0xe0b0('0x2d')],_0x3ad564[_0xe0b0('0x2e')]);_0x1c12bd[_0xe0b0('0x31')]=_[_0xe0b0('0x30')](_0x3ad564['model'],qs['fields'](_0x402a0e['query'][_0xe0b0('0x32')]));_0x1c12bd[_0xe0b0('0x31')]=_0x1c12bd['attributes'][_0xe0b0('0x33')]?_0x1c12bd[_0xe0b0('0x31')]:_0x3ad564[_0xe0b0('0x2d')];if(_0x402a0e[_0xe0b0('0x2e')][_0xe0b0('0x3f')]){_0x1c12bd['include']=[{'all':!![]}];}_0x1c12bd=_['merge']({},_0x1c12bd,_0x402a0e[_0xe0b0('0x3e')]);return db[_0xe0b0('0x28')][_0xe0b0('0x45')](_0x1c12bd)[_0xe0b0('0x21')](handleEntityNotFound(_0x19c80e,null))[_0xe0b0('0x21')](respondWithResult(_0x19c80e,null))['catch'](handleError(_0x19c80e,null));};exports[_0xe0b0('0x46')]=function(_0x11d4fd,_0x534340){return db['FaxTransferReport']['create'](_0x11d4fd[_0xe0b0('0x47')],{})[_0xe0b0('0x21')](respondWithResult(_0x534340,0xc9))[_0xe0b0('0x41')](handleError(_0x534340,null));};exports[_0xe0b0('0x20')]=function(_0x5b1756,_0x2e2b10){if(_0x5b1756[_0xe0b0('0x47')]['id']){delete _0x5b1756['body']['id'];}return db['FaxTransferReport'][_0xe0b0('0x45')]({'where':{'id':_0x5b1756[_0xe0b0('0x43')]['id']}})['then'](handleEntityNotFound(_0x2e2b10,null))[_0xe0b0('0x21')](saveUpdates(_0x5b1756[_0xe0b0('0x47')],null))['then'](respondWithResult(_0x2e2b10,null))['catch'](handleError(_0x2e2b10,null));};exports[_0xe0b0('0x22')]=function(_0x511679,_0x165dc8){return db[_0xe0b0('0x28')][_0xe0b0('0x45')]({'where':{'id':_0x511679[_0xe0b0('0x43')]['id']}})[_0xe0b0('0x21')](handleEntityNotFound(_0x165dc8,null))[_0xe0b0('0x21')](removeEntity(_0x165dc8,null))['catch'](handleError(_0x165dc8,null));};exports['describe']=function(_0x2ef908,_0x5d380a){return db['FaxTransferReport'][_0xe0b0('0x48')]()[_0xe0b0('0x21')](respondWithResult(_0x5d380a,null))['catch'](handleError(_0x5d380a,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 9c42973..82c5ef5 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 _0x3c40=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define'];(function(_0x93d717,_0x3bd492){var _0x353805=function(_0x2f401a){while(--_0x2f401a){_0x93d717['push'](_0x93d717['shift']());}};_0x353805(++_0x3bd492);}(_0x3c40,0x90));var _0x03c4=function(_0x550eb7,_0x465856){_0x550eb7=_0x550eb7-0x0;var _0x33bffe=_0x3c40[_0x550eb7];return _0x33bffe;};'use strict';var _=require('lodash');var util=require(_0x03c4('0x0'));var logger=require(_0x03c4('0x1'))(_0x03c4('0x2'));var moment=require(_0x03c4('0x3'));var BPromise=require(_0x03c4('0x4'));var rp=require(_0x03c4('0x5'));var fs=require('fs');var path=require(_0x03c4('0x6'));var rimraf=require(_0x03c4('0x7'));var config=require(_0x03c4('0x8'));var attributes=require(_0x03c4('0x9'));module[_0x03c4('0xa')]=function(_0x45f9a0,_0x431a33){return _0x45f9a0[_0x03c4('0xb')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb666=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','define','report_fax_transfer','uniqueid','lodash'];(function(_0x1bf04d,_0x44cc80){var _0x4857dd=function(_0x4788be){while(--_0x4788be){_0x1bf04d['push'](_0x1bf04d['shift']());}};_0x4857dd(++_0x44cc80);}(_0xb666,0x1e3));var _0x6b66=function(_0x226212,_0x3471a3){_0x226212=_0x226212-0x0;var _0x37e7bf=_0xb666[_0x226212];return _0x37e7bf;};'use strict';var _=require(_0x6b66('0x0'));var util=require(_0x6b66('0x1'));var logger=require(_0x6b66('0x2'))(_0x6b66('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6b66('0x4'));var fs=require('fs');var path=require(_0x6b66('0x5'));var rimraf=require(_0x6b66('0x6'));var config=require(_0x6b66('0x7'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x4c92bf,_0x10cd52){return _0x4c92bf[_0x6b66('0x8')]('FaxTransferReport',attributes,{'tableName':_0x6b66('0x9'),'paranoid':![],'indexes':[{'name':_0x6b66('0xa'),'fields':[_0x6b66('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index e92c196..2a3638f 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 _0x3a1b=['util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x20daa3,_0x2fd784){var _0x4edf5f=function(_0x247d0e){while(--_0x247d0e){_0x20daa3['push'](_0x20daa3['shift']());}};_0x4edf5f(++_0x2fd784);}(_0x3a1b,0x141));var _0xb3a1=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x3a1b[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0xb3a1('0x0'));var util=require(_0xb3a1('0x1'));var moment=require(_0xb3a1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb3a1('0x3'));var db=require(_0xb3a1('0x4'))['db'];var utils=require(_0xb3a1('0x5'));var logger=require(_0xb3a1('0x6'))(_0xb3a1('0x7'));var config=require(_0xb3a1('0x8'));var jayson=require(_0xb3a1('0x9'));var client=jayson[_0xb3a1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ef2b9,_0x6aa508,_0x1f922d){return new BPromise(function(_0x17f142,_0x28a03c){return client['request'](_0x4ef2b9,_0x1f922d)[_0xb3a1('0xb')](function(_0xcff484){logger[_0xb3a1('0xc')](_0xb3a1('0xd'),_0x6aa508,_0xb3a1('0xe'));logger[_0xb3a1('0xf')](_0xb3a1('0x10'),_0x6aa508,'request\x20sent',JSON[_0xb3a1('0x11')](_0xcff484));if(_0xcff484[_0xb3a1('0x12')]){if(_0xcff484[_0xb3a1('0x12')][_0xb3a1('0x13')]===0x1f4){logger[_0xb3a1('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x6aa508,_0xcff484['error'][_0xb3a1('0x14')]);return _0x28a03c(_0xcff484[_0xb3a1('0x12')][_0xb3a1('0x14')]);}logger['error'](_0xb3a1('0xd'),_0x6aa508,_0xcff484[_0xb3a1('0x12')][_0xb3a1('0x14')]);return _0x17f142(_0xcff484['error'][_0xb3a1('0x14')]);}else{logger[_0xb3a1('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x6aa508,_0xb3a1('0xe'));_0x17f142(_0xcff484[_0xb3a1('0x15')]['message']);}})[_0xb3a1('0x16')](function(_0xd60827){logger[_0xb3a1('0x12')](_0xb3a1('0xd'),_0x6aa508,_0xd60827);_0x28a03c(_0xd60827);});});} \ No newline at end of file +var _0x3a94=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxTransferReport,\x20%s,\x20%s','stringify','code','error','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird'];(function(_0x933e38,_0x2cd6cf){var _0x4fba2c=function(_0x3052f7){while(--_0x3052f7){_0x933e38['push'](_0x933e38['shift']());}};_0x4fba2c(++_0x2cd6cf);}(_0x3a94,0x14c));var _0x43a9=function(_0x201fe0,_0x29a776){_0x201fe0=_0x201fe0-0x0;var _0x2eeb30=_0x3a94[_0x201fe0];return _0x2eeb30;};'use strict';var _=require(_0x43a9('0x0'));var util=require(_0x43a9('0x1'));var moment=require(_0x43a9('0x2'));var BPromise=require(_0x43a9('0x3'));var rs=require(_0x43a9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43a9('0x5'))['db'];var utils=require(_0x43a9('0x6'));var logger=require(_0x43a9('0x7'))(_0x43a9('0x8'));var config=require(_0x43a9('0x9'));var jayson=require(_0x43a9('0xa'));var client=jayson[_0x43a9('0xb')][_0x43a9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3eeb15,_0x1fea75,_0x50fa34){return new BPromise(function(_0x15ad52,_0x96eb6){return client[_0x43a9('0xd')](_0x3eeb15,_0x50fa34)[_0x43a9('0xe')](function(_0x58ade4){logger['info'](_0x43a9('0xf'),_0x1fea75,'request\x20sent');logger['debug']('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x1fea75,'request\x20sent',JSON[_0x43a9('0x10')](_0x58ade4));if(_0x58ade4['error']){if(_0x58ade4['error'][_0x43a9('0x11')]===0x1f4){logger[_0x43a9('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x1fea75,_0x58ade4[_0x43a9('0x12')][_0x43a9('0x13')]);return _0x96eb6(_0x58ade4[_0x43a9('0x12')][_0x43a9('0x13')]);}logger[_0x43a9('0x12')](_0x43a9('0xf'),_0x1fea75,_0x58ade4['error'][_0x43a9('0x13')]);return _0x15ad52(_0x58ade4[_0x43a9('0x12')][_0x43a9('0x13')]);}else{logger[_0x43a9('0x14')]('FaxTransferReport,\x20%s,\x20%s',_0x1fea75,_0x43a9('0x15'));_0x15ad52(_0x58ade4[_0x43a9('0x16')][_0x43a9('0x13')]);}})[_0x43a9('0x17')](function(_0xe7bd48){logger[_0x43a9('0x12')](_0x43a9('0xf'),_0x1fea75,_0xe7bd48);_0x96eb6(_0xe7bd48);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index a1acfc3..214d1ae 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 _0xc423=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxTransferReport.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x30f264,_0x266f79){var _0x3e9ae6=function(_0x5c34ac){while(--_0x5c34ac){_0x30f264['push'](_0x30f264['shift']());}};_0x3e9ae6(++_0x266f79);}(_0xc423,0x1d5));var _0x3c42=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc423[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x3c42('0x0'));var util=require(_0x3c42('0x1'));var path=require(_0x3c42('0x2'));var timeout=require(_0x3c42('0x3'));var express=require(_0x3c42('0x4'));var router=express['Router']();var fs_extra=require(_0x3c42('0x5'));var auth=require(_0x3c42('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3c42('0x7'));var controller=require(_0x3c42('0x8'));router[_0x3c42('0x9')]('/',auth['isAuthenticated'](),controller[_0x3c42('0xa')]);router['get'](_0x3c42('0xb'),auth[_0x3c42('0xc')](),controller[_0x3c42('0xd')]);router['get'](_0x3c42('0xe'),auth[_0x3c42('0xc')](),controller[_0x3c42('0xf')]);router[_0x3c42('0x10')]('/',auth['isAuthenticated'](),controller[_0x3c42('0x11')]);router[_0x3c42('0x12')](_0x3c42('0xe'),auth['isAuthenticated'](),controller[_0x3c42('0x13')]);router[_0x3c42('0x14')](_0x3c42('0xe'),auth[_0x3c42('0xc')](),controller[_0x3c42('0x15')]);module[_0x3c42('0x16')]=router; \ No newline at end of file +var _0x6e3c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','isAuthenticated','/:id','show','post','destroy','exports','util','path','connect-timeout','Router','fs-extra'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x6e3c,0x182));var _0xc6e3=function(_0x342ba6,_0x3ffa29){_0x342ba6=_0x342ba6-0x0;var _0x3d77d6=_0x6e3c[_0x342ba6];return _0x3d77d6;};'use strict';var multer=require('multer');var util=require(_0xc6e3('0x0'));var path=require(_0xc6e3('0x1'));var timeout=require(_0xc6e3('0x2'));var express=require('express');var router=express[_0xc6e3('0x3')]();var fs_extra=require(_0xc6e3('0x4'));var auth=require(_0xc6e3('0x5'));var interaction=require(_0xc6e3('0x6'));var config=require(_0xc6e3('0x7'));var controller=require(_0xc6e3('0x8'));router[_0xc6e3('0x9')]('/',auth['isAuthenticated'](),controller[_0xc6e3('0xa')]);router['get']('/describe',auth[_0xc6e3('0xb')](),controller['describe']);router[_0xc6e3('0x9')](_0xc6e3('0xc'),auth[_0xc6e3('0xb')](),controller[_0xc6e3('0xd')]);router[_0xc6e3('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xc6e3('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc6e3('0xc'),auth['isAuthenticated'](),controller[_0xc6e3('0xf')]);module[_0xc6e3('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 5aacf63..4aeee94 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 _0x4f38=['post','addConfiguration','update','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','create'];(function(_0x26d75b,_0x519faf){var _0x1d53df=function(_0x50c021){while(--_0x50c021){_0x26d75b['push'](_0x26d75b['shift']());}};_0x1d53df(++_0x519faf);}(_0x4f38,0x180));var _0x84f3=function(_0x2065d4,_0x2e512b){_0x2065d4=_0x2065d4-0x0;var _0x4db08b=_0x4f38[_0x2065d4];return _0x4db08b;};'use strict';var multer=require('multer');var util=require(_0x84f3('0x0'));var path=require(_0x84f3('0x1'));var timeout=require('connect-timeout');var express=require(_0x84f3('0x2'));var router=express['Router']();var fs_extra=require(_0x84f3('0x3'));var auth=require(_0x84f3('0x4'));var interaction=require(_0x84f3('0x5'));var config=require('../../config/environment');var controller=require(_0x84f3('0x6'));router[_0x84f3('0x7')]('/',auth[_0x84f3('0x8')](),controller[_0x84f3('0x9')]);router[_0x84f3('0x7')](_0x84f3('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x84f3('0x7')](_0x84f3('0xb'),auth[_0x84f3('0x8')](),controller[_0x84f3('0xc')]);router[_0x84f3('0x7')](_0x84f3('0xd'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0x84f3('0x8')](),controller[_0x84f3('0xe')]);router[_0x84f3('0xf')](_0x84f3('0xb'),auth[_0x84f3('0x8')](),controller[_0x84f3('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x84f3('0x11')]);router['delete'](_0x84f3('0xa'),auth[_0x84f3('0x8')](),controller['destroy']);module[_0x84f3('0x12')]=router; \ No newline at end of file +var _0x8cd8=['put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','post','create'];(function(_0x2067e9,_0x5e6a97){var _0x280ce4=function(_0x2eca23){while(--_0x2eca23){_0x2067e9['push'](_0x2067e9['shift']());}};_0x280ce4(++_0x5e6a97);}(_0x8cd8,0x100));var _0x88cd=function(_0x4acae1,_0x1389f4){_0x4acae1=_0x4acae1-0x0;var _0x37120f=_0x8cd8[_0x4acae1];return _0x37120f;};'use strict';var multer=require(_0x88cd('0x0'));var util=require(_0x88cd('0x1'));var path=require(_0x88cd('0x2'));var timeout=require(_0x88cd('0x3'));var express=require(_0x88cd('0x4'));var router=express[_0x88cd('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x88cd('0x6'));var interaction=require(_0x88cd('0x7'));var config=require('../../config/environment');var controller=require(_0x88cd('0x8'));router[_0x88cd('0x9')]('/',auth[_0x88cd('0xa')](),controller[_0x88cd('0xb')]);router['get'](_0x88cd('0xc'),auth[_0x88cd('0xa')](),controller['show']);router[_0x88cd('0x9')](_0x88cd('0xd'),auth[_0x88cd('0xa')](),controller['getConfigurations']);router[_0x88cd('0x9')](_0x88cd('0xe'),auth[_0x88cd('0xa')](),controller['getFields']);router[_0x88cd('0xf')]('/',auth[_0x88cd('0xa')](),controller[_0x88cd('0x10')]);router[_0x88cd('0xf')]('/:id/configurations',auth[_0x88cd('0xa')](),controller['addConfiguration']);router[_0x88cd('0x11')]('/:id',auth[_0x88cd('0xa')](),controller[_0x88cd('0x12')]);router[_0x88cd('0x13')](_0x88cd('0xc'),auth[_0x88cd('0xa')](),controller[_0x88cd('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index cc85e7e..3888654 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 _0x253d=['basic','newTab','integrationTab','sequelize','STRING','ENUM'];(function(_0x1cb5d1,_0x336fa0){var _0x476169=function(_0x8c0f){while(--_0x8c0f){_0x1cb5d1['push'](_0x1cb5d1['shift']());}};_0x476169(++_0x336fa0);}(_0x253d,0x1b3));var _0xd253=function(_0x2ba62f,_0x5e6a5a){_0x2ba62f=_0x2ba62f-0x0;var _0x359773=_0x253d[_0x2ba62f];return _0x359773;};'use strict';var Sequelize=require(_0xd253('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xd253('0x1')]},'authType':{'type':Sequelize[_0xd253('0x2')](_0xd253('0x3')),'defaultValue':_0xd253('0x3')},'password':{'type':Sequelize[_0xd253('0x1')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xd253('0x1')]},'token':{'type':Sequelize[_0xd253('0x1')]},'tokenSecret':{'type':Sequelize[_0xd253('0x1')]},'serverUrl':{'type':Sequelize[_0xd253('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xd253('0x2')]('integrationTab',_0xd253('0x4')),'defaultValue':_0xd253('0x5')}}; \ No newline at end of file +var _0xa0a3=['exports','STRING','ENUM','basic','integrationTab'];(function(_0x3ba577,_0x4c3ea0){var _0x583dfa=function(_0x20f929){while(--_0x20f929){_0x3ba577['push'](_0x3ba577['shift']());}};_0x583dfa(++_0x4c3ea0);}(_0xa0a3,0x1e0));var _0x3a0a=function(_0xb471d2,_0x5b6a4a){_0xb471d2=_0xb471d2-0x0;var _0x50f608=_0xa0a3[_0xb471d2];return _0x50f608;};'use strict';var Sequelize=require('sequelize');module[_0x3a0a('0x0')]={'name':{'type':Sequelize[_0x3a0a('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3a0a('0x1')]},'remoteUri':{'type':Sequelize[_0x3a0a('0x1')]},'authType':{'type':Sequelize[_0x3a0a('0x2')](_0x3a0a('0x3')),'defaultValue':_0x3a0a('0x3')},'password':{'type':Sequelize[_0x3a0a('0x1')]},'consumerKey':{'type':Sequelize[_0x3a0a('0x1')]},'consumerSecret':{'type':Sequelize[_0x3a0a('0x1')]},'token':{'type':Sequelize[_0x3a0a('0x1')]},'tokenSecret':{'type':Sequelize[_0x3a0a('0x1')]},'serverUrl':{'type':Sequelize[_0x3a0a('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x3a0a('0x2')](_0x3a0a('0x4'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 5eb6fc5..ab21ec6 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 _0x6f7c=['key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','options','DeskAccount','count','include','findAll','rows','catch','show','keys','includeAll','create','body','params','find','getConfigurations','DeskConfiguration','length','addConfiguration','AccountId','getSubjects','channel','Descriptions','DeskField','Subjects','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','slice','substring','format','%s/custom_fields','application/json','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','active','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','sendStatus','status','json','offset','set','Content-Range','reject','end','name','index','map','rawAttributes','fieldName','type'];(function(_0x4b3172,_0x470bd5){var _0x3d67c3=function(_0x1fa0f3){while(--_0x1fa0f3){_0x4b3172['push'](_0x4b3172['shift']());}};_0x3d67c3(++_0x470bd5);}(_0x6f7c,0xb7));var _0xc6f7=function(_0x4a93e9,_0x5b569f){_0x4a93e9=_0x4a93e9-0x0;var _0x4b3ba7=_0x6f7c[_0x4a93e9];return _0x4b3ba7;};'use strict';var pdf=require(_0xc6f7('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc6f7('0x1'));var jsonpatch=require(_0xc6f7('0x2'));var rp=require(_0xc6f7('0x3'));var moment=require('moment');var BPromise=require(_0xc6f7('0x4'));var Mustache=require(_0xc6f7('0x5'));var util=require(_0xc6f7('0x6'));var path=require('path');var sox=require(_0xc6f7('0x7'));var csv=require(_0xc6f7('0x8'));var ejs=require(_0xc6f7('0x9'));var fs=require('fs');var fs_extra=require(_0xc6f7('0xa'));var _=require(_0xc6f7('0xb'));var squel=require(_0xc6f7('0xc'));var crypto=require(_0xc6f7('0xd'));var jsforce=require(_0xc6f7('0xe'));var deskjs=require(_0xc6f7('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc6f7('0x10'));var Papa=require(_0xc6f7('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc6f7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc6f7('0x13'))('api');var utils=require(_0xc6f7('0x14'));var config=require(_0xc6f7('0x15'));var licenseUtil=require(_0xc6f7('0x16'));var db=require(_0xc6f7('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xc6f7('0x18'));var client=jayson[_0xc6f7('0x19')][_0xc6f7('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x805bc2,_0x59ea14,_0x13e48d,_0x3fd73e){return new BPromise(function(_0x317472,_0x10dd6e){var _0x523ae5=_0x3fd73e||client;return _0x523ae5[_0xc6f7('0x1b')](_0x805bc2,_0x13e48d)[_0xc6f7('0x1c')](function(_0x11ee32){logger[_0xc6f7('0x1d')]('DeskAccount,\x20%s,\x20%s',_0x59ea14,_0xc6f7('0x1e'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x59ea14,_0xc6f7('0x1e'),JSON[_0xc6f7('0x1f')](_0x11ee32));if(_0x11ee32[_0xc6f7('0x20')]){if(_0x11ee32[_0xc6f7('0x20')][_0xc6f7('0x21')]===0x1f4){logger[_0xc6f7('0x20')](_0xc6f7('0x22'),_0x59ea14,_0x11ee32[_0xc6f7('0x20')][_0xc6f7('0x23')]);return _0x10dd6e(_0x11ee32['error'][_0xc6f7('0x23')]);}logger[_0xc6f7('0x20')](_0xc6f7('0x22'),_0x59ea14,_0x11ee32[_0xc6f7('0x20')]['message']);return _0x317472(_0x11ee32['error'][_0xc6f7('0x23')]);}else{logger[_0xc6f7('0x1d')](_0xc6f7('0x22'),_0x59ea14,'request\x20sent');_0x317472(_0x11ee32[_0xc6f7('0x24')][_0xc6f7('0x23')]);}})['catch'](function(_0x3d2a6a){logger[_0xc6f7('0x20')](_0xc6f7('0x22'),_0x59ea14,_0x3d2a6a);_0x10dd6e(_0x3d2a6a);});});}function respondWithStatusCode(_0x56f84f,_0x68f26d){_0x68f26d=_0x68f26d||0xcc;return function(_0x4c2ec8){if(_0x4c2ec8){return _0x56f84f[_0xc6f7('0x25')](_0x68f26d);}return _0x56f84f[_0xc6f7('0x26')](_0x68f26d)['end']();};}function respondWithResult(_0x1bba2f,_0x220f22){_0x220f22=_0x220f22||0xc8;return function(_0x269e60){if(_0x269e60){return _0x1bba2f[_0xc6f7('0x26')](_0x220f22)[_0xc6f7('0x27')](_0x269e60);}};}function respondWithFilteredResult(_0x1d3a77,_0x36933d){return function(_0x246041){if(_0x246041){var _0x2fc2b8=_0x246041['count'],_0x4b4955=_0x36933d[_0xc6f7('0x28')],_0x51556b=_0x36933d[_0xc6f7('0x28')]+_0x36933d['limit'],_0x1908d8;if(_0x51556b>=_0x2fc2b8){_0x51556b=_0x2fc2b8;_0x1908d8=0xc8;}else{_0x1908d8=0xce;}_0x1d3a77[_0xc6f7('0x26')](_0x1908d8);return _0x1d3a77[_0xc6f7('0x29')](_0xc6f7('0x2a'),_0x4b4955+'-'+_0x51556b+'/'+_0x2fc2b8)['json'](_0x246041);}return null;};}function patchUpdates(_0x4a3000){return function(_0x4c4dc1){try{jsonpatch['apply'](_0x4c4dc1,_0x4a3000,!![]);}catch(_0x4637e4){return BPromise[_0xc6f7('0x2b')](_0x4637e4);}return _0x4c4dc1['save']();};}function saveUpdates(_0x343fe9,_0x301250){return function(_0x2c3808){if(_0x2c3808){return _0x2c3808['update'](_0x343fe9)['then'](function(_0x4d035b){return _0x4d035b;});}return null;};}function removeEntity(_0x10f881,_0x3870d5){return function(_0x47a6ad){if(_0x47a6ad){return _0x47a6ad['destroy']()['then'](function(){_0x10f881[_0xc6f7('0x26')](0xcc)[_0xc6f7('0x2c')]();});}};}function handleEntityNotFound(_0x3c9457,_0x44fe2d){return function(_0x3d3b42){if(!_0x3d3b42){_0x3c9457[_0xc6f7('0x25')](0x194);}return _0x3d3b42;};}function handleError(_0x3a4366,_0x5d3bde){_0x5d3bde=_0x5d3bde||0x1f4;return function(_0xe2a644){logger[_0xc6f7('0x20')](_0xe2a644['stack']);if(_0xe2a644[_0xc6f7('0x2d')]){delete _0xe2a644[_0xc6f7('0x2d')];}_0x3a4366[_0xc6f7('0x26')](_0x5d3bde)['send'](_0xe2a644);};}exports[_0xc6f7('0x2e')]=function(_0x126b5b,_0x3c0e4b){var _0x4ea8a1={},_0x3e3ce3={},_0x3f14ef={'count':0x0,'rows':[]};var _0x2b3a7d=_[_0xc6f7('0x2f')](db['DeskAccount'][_0xc6f7('0x30')],function(_0x59e65d){return{'name':_0x59e65d[_0xc6f7('0x31')],'type':_0x59e65d[_0xc6f7('0x32')][_0xc6f7('0x33')]};});_0x3e3ce3[_0xc6f7('0x34')]=_['map'](_0x2b3a7d,_0xc6f7('0x2d'));_0x3e3ce3['query']=_['keys'](_0x126b5b[_0xc6f7('0x35')]);_0x3e3ce3[_0xc6f7('0x36')]=_[_0xc6f7('0x37')](_0x3e3ce3[_0xc6f7('0x34')],_0x3e3ce3[_0xc6f7('0x35')]);_0x4ea8a1[_0xc6f7('0x38')]=_[_0xc6f7('0x37')](_0x3e3ce3[_0xc6f7('0x34')],qs[_0xc6f7('0x39')](_0x126b5b['query'][_0xc6f7('0x39')]));_0x4ea8a1[_0xc6f7('0x38')]=_0x4ea8a1[_0xc6f7('0x38')]['length']?_0x4ea8a1[_0xc6f7('0x38')]:_0x3e3ce3[_0xc6f7('0x34')];if(!_0x126b5b[_0xc6f7('0x35')][_0xc6f7('0x3a')](_0xc6f7('0x3b'))){_0x4ea8a1[_0xc6f7('0x3c')]=qs[_0xc6f7('0x3c')](_0x126b5b[_0xc6f7('0x35')][_0xc6f7('0x3c')]);_0x4ea8a1[_0xc6f7('0x28')]=qs[_0xc6f7('0x28')](_0x126b5b[_0xc6f7('0x35')][_0xc6f7('0x28')]);}_0x4ea8a1['order']=qs[_0xc6f7('0x3d')](_0x126b5b[_0xc6f7('0x35')][_0xc6f7('0x3d')]);_0x4ea8a1['where']=qs[_0xc6f7('0x36')](_[_0xc6f7('0x3e')](_0x126b5b[_0xc6f7('0x35')],_0x3e3ce3[_0xc6f7('0x36')]),_0x2b3a7d);if(_0x126b5b['query'][_0xc6f7('0x3f')]){_0x4ea8a1[_0xc6f7('0x40')]=_[_0xc6f7('0x41')](_0x4ea8a1[_0xc6f7('0x40')],{'$or':_[_0xc6f7('0x2f')](_0x2b3a7d,function(_0x1d0700){if(_0x1d0700[_0xc6f7('0x32')]!==_0xc6f7('0x42')){var _0x4fdb4a={};_0x4fdb4a[_0x1d0700[_0xc6f7('0x2d')]]={'$like':'%'+_0x126b5b['query'][_0xc6f7('0x3f')]+'%'};return _0x4fdb4a;}})});}_0x4ea8a1=_[_0xc6f7('0x41')]({},_0x4ea8a1,_0x126b5b[_0xc6f7('0x43')]);var _0x1581f4={'where':_0x4ea8a1[_0xc6f7('0x40')]};return db[_0xc6f7('0x44')][_0xc6f7('0x45')](_0x1581f4)[_0xc6f7('0x1c')](function(_0x265840){_0x3f14ef[_0xc6f7('0x45')]=_0x265840;if(_0x126b5b[_0xc6f7('0x35')]['includeAll']){_0x4ea8a1[_0xc6f7('0x46')]=[{'all':!![]}];}return db['DeskAccount'][_0xc6f7('0x47')](_0x4ea8a1);})[_0xc6f7('0x1c')](function(_0x5eee27){_0x3f14ef[_0xc6f7('0x48')]=_0x5eee27;return _0x3f14ef;})[_0xc6f7('0x1c')](respondWithFilteredResult(_0x3c0e4b,_0x4ea8a1))[_0xc6f7('0x49')](handleError(_0x3c0e4b,null));};exports[_0xc6f7('0x4a')]=function(_0x4d2f77,_0x568026){var _0x21ccb7={'raw':![],'where':{'id':_0x4d2f77['params']['id']}},_0x354d8a={};_0x354d8a['model']=_[_0xc6f7('0x4b')](db['DeskAccount'][_0xc6f7('0x30')]);_0x354d8a[_0xc6f7('0x35')]=_['keys'](_0x4d2f77['query']);_0x354d8a[_0xc6f7('0x36')]=_[_0xc6f7('0x37')](_0x354d8a[_0xc6f7('0x34')],_0x354d8a[_0xc6f7('0x35')]);_0x21ccb7[_0xc6f7('0x38')]=_['intersection'](_0x354d8a[_0xc6f7('0x34')],qs[_0xc6f7('0x39')](_0x4d2f77[_0xc6f7('0x35')]['fields']));_0x21ccb7[_0xc6f7('0x38')]=_0x21ccb7[_0xc6f7('0x38')]['length']?_0x21ccb7[_0xc6f7('0x38')]:_0x354d8a[_0xc6f7('0x34')];if(_0x4d2f77[_0xc6f7('0x35')][_0xc6f7('0x4c')]){_0x21ccb7[_0xc6f7('0x46')]=[{'all':!![]}];}_0x21ccb7=_[_0xc6f7('0x41')]({},_0x21ccb7,_0x4d2f77['options']);return db[_0xc6f7('0x44')]['find'](_0x21ccb7)[_0xc6f7('0x1c')](handleEntityNotFound(_0x568026,null))['then'](respondWithResult(_0x568026,null))[_0xc6f7('0x49')](handleError(_0x568026,null));};exports[_0xc6f7('0x4d')]=function(_0x4c31c9,_0x53c84b){return db[_0xc6f7('0x44')][_0xc6f7('0x4d')](_0x4c31c9[_0xc6f7('0x4e')],{})[_0xc6f7('0x1c')](respondWithResult(_0x53c84b,0xc9))[_0xc6f7('0x49')](handleError(_0x53c84b,null));};exports['update']=function(_0x3d8652,_0x4dc039){if(_0x3d8652[_0xc6f7('0x4e')]['id']){delete _0x3d8652[_0xc6f7('0x4e')]['id'];}return db[_0xc6f7('0x44')]['find']({'where':{'id':_0x3d8652[_0xc6f7('0x4f')]['id']}})[_0xc6f7('0x1c')](handleEntityNotFound(_0x4dc039,null))[_0xc6f7('0x1c')](saveUpdates(_0x3d8652[_0xc6f7('0x4e')],null))[_0xc6f7('0x1c')](respondWithResult(_0x4dc039,null))[_0xc6f7('0x49')](handleError(_0x4dc039,null));};exports['destroy']=function(_0x3632e7,_0x12b273){return db[_0xc6f7('0x44')][_0xc6f7('0x50')]({'where':{'id':_0x3632e7[_0xc6f7('0x4f')]['id']}})[_0xc6f7('0x1c')](handleEntityNotFound(_0x12b273,null))[_0xc6f7('0x1c')](removeEntity(_0x12b273,null))[_0xc6f7('0x49')](handleError(_0x12b273,null));};exports[_0xc6f7('0x51')]=function(_0x549a63,_0x2fa218,_0x29ece1){var _0x3d33a7={};var _0x968979={};var _0x16cc6f;var _0x30e757;return db[_0xc6f7('0x44')]['findOne']({'where':{'id':_0x549a63[_0xc6f7('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2fa218,null))[_0xc6f7('0x1c')](function(_0x18e5bc){if(_0x18e5bc){_0x16cc6f=_0x18e5bc;_0x968979['model']=_[_0xc6f7('0x4b')](db[_0xc6f7('0x52')][_0xc6f7('0x30')]);_0x968979[_0xc6f7('0x35')]=_[_0xc6f7('0x4b')](_0x549a63[_0xc6f7('0x35')]);_0x968979[_0xc6f7('0x36')]=_[_0xc6f7('0x37')](_0x968979[_0xc6f7('0x34')],_0x968979[_0xc6f7('0x35')]);_0x3d33a7[_0xc6f7('0x38')]=_['intersection'](_0x968979[_0xc6f7('0x34')],qs[_0xc6f7('0x39')](_0x549a63['query'][_0xc6f7('0x39')]));_0x3d33a7[_0xc6f7('0x38')]=_0x3d33a7[_0xc6f7('0x38')][_0xc6f7('0x53')]?_0x3d33a7[_0xc6f7('0x38')]:_0x968979['model'];_0x3d33a7['order']=qs[_0xc6f7('0x3d')](_0x549a63['query'][_0xc6f7('0x3d')]);_0x3d33a7[_0xc6f7('0x40')]=qs[_0xc6f7('0x36')](_[_0xc6f7('0x3e')](_0x549a63['query'],_0x968979[_0xc6f7('0x36')]));if(_0x549a63['query'][_0xc6f7('0x3f')]){_0x3d33a7['where']=_[_0xc6f7('0x41')](_0x3d33a7[_0xc6f7('0x40')],{'$or':_[_0xc6f7('0x2f')](_0x3d33a7[_0xc6f7('0x38')],function(_0x5e4170){var _0x3ee2b0={};_0x3ee2b0[_0x5e4170]={'$like':'%'+_0x549a63[_0xc6f7('0x35')][_0xc6f7('0x3f')]+'%'};return _0x3ee2b0;})});}_0x3d33a7=_[_0xc6f7('0x41')]({},_0x3d33a7,_0x549a63[_0xc6f7('0x43')]);return _0x16cc6f['getConfigurations'](_0x3d33a7);}})[_0xc6f7('0x1c')](function(_0x1ad8da){if(_0x1ad8da){_0x30e757=_0x1ad8da['length'];if(!_0x549a63[_0xc6f7('0x35')][_0xc6f7('0x3a')](_0xc6f7('0x3b'))){_0x3d33a7['limit']=qs[_0xc6f7('0x3c')](_0x549a63['query'][_0xc6f7('0x3c')]);_0x3d33a7[_0xc6f7('0x28')]=qs[_0xc6f7('0x28')](_0x549a63[_0xc6f7('0x35')][_0xc6f7('0x28')]);}return _0x16cc6f[_0xc6f7('0x51')](_0x3d33a7);}})['then'](function(_0x5c35b7){if(_0x5c35b7){return _0x5c35b7?{'count':_0x30e757,'rows':_0x5c35b7}:null;}})[_0xc6f7('0x1c')](respondWithResult(_0x2fa218,null))['catch'](handleError(_0x2fa218,null));};exports[_0xc6f7('0x54')]=function(_0x34be83,_0x1c97c3,_0x24e6a2){if(_0x34be83[_0xc6f7('0x4e')]['id']){delete _0x34be83[_0xc6f7('0x4e')]['id'];}return db[_0xc6f7('0x44')]['findOne']({'where':{'id':_0x34be83[_0xc6f7('0x4f')]['id']}})[_0xc6f7('0x1c')](handleEntityNotFound(_0x1c97c3,null))[_0xc6f7('0x1c')](function(_0x17814b){if(_0x17814b){_0x34be83['body'][_0xc6f7('0x55')]=_0x17814b['id'];_0x34be83['body']['Subjects']=integrations[_0xc6f7('0x56')](_0x34be83[_0xc6f7('0x4e')][_0xc6f7('0x57')],_0x34be83[_0xc6f7('0x4e')][_0xc6f7('0x32')]);_0x34be83[_0xc6f7('0x4e')][_0xc6f7('0x58')]=integrations['getDescriptions'](_0x34be83[_0xc6f7('0x4e')][_0xc6f7('0x57')],_0x34be83[_0xc6f7('0x4e')]['type']);return db[_0xc6f7('0x52')]['create'](_0x34be83[_0xc6f7('0x4e')],{'include':[{'model':db[_0xc6f7('0x59')],'as':_0xc6f7('0x5a')},{'model':db['DeskField'],'as':_0xc6f7('0x58')}]});}return null;})[_0xc6f7('0x1c')](respondWithResult(_0x1c97c3,null))[_0xc6f7('0x49')](handleError(_0x1c97c3,null));};exports[_0xc6f7('0x5b')]=function(_0x5ea842,_0x1723c0,_0x1ec42e){var _0x159a5a=[{'name':'priority','label':_0xc6f7('0x5c'),'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 _0x33bab0='';return db['DeskAccount']['findOne']({'where':{'id':_0x5ea842[_0xc6f7('0x4f')]['id']},'attributes':['id',_0xc6f7('0x5d'),_0xc6f7('0x5e'),_0xc6f7('0x5f'),_0xc6f7('0x60'),_0xc6f7('0x61'),_0xc6f7('0x62'),'token','tokenSecret']})['then'](handleEntityNotFound(_0x1723c0,null))['then'](function(_0x4aee91){if(_0x4aee91){_0x33bab0=_0x4aee91['remoteUri'];var _0x32e417=_0x33bab0[_0xc6f7('0x63')](-0x1);if(_0x32e417==='/'){_0x33bab0=_0x33bab0[_0xc6f7('0x64')](0x0,_0x33bab0['lastIndexOf'](_0x32e417));}var _0x537e16={'method':'GET','uri':util[_0xc6f7('0x65')](_0xc6f7('0x66'),_0x33bab0),'headers':{'Content-Type':_0xc6f7('0x67'),'Accept':_0xc6f7('0x67')},'json':!![]};if(_0x4aee91['authType']==='basic'){_0x537e16[_0xc6f7('0x68')][_0xc6f7('0x69')]=util[_0xc6f7('0x65')](_0xc6f7('0x6a'),new Buffer(util[_0xc6f7('0x65')](_0xc6f7('0x6b'),_0x4aee91['username'],_0x4aee91[_0xc6f7('0x60')]))[_0xc6f7('0x6c')](_0xc6f7('0x6d')));}return rp(_0x537e16)['then'](function(_0x1606a7){return _0x159a5a[_0xc6f7('0x6e')](_[_0xc6f7('0x2f')](_0x1606a7[_0xc6f7('0x6f')]['entries'],function(_0x56f90c){return{'id':_0x56f90c['name'],'name':_0x56f90c[_0xc6f7('0x2d')],'type':_0x56f90c['type'],'active':_0x56f90c[_0xc6f7('0x70')],'label':_0x56f90c['label'],'custom':!![]};}));});}})[_0xc6f7('0x1c')](function(_0x48e072){return{'count':_0x48e072[_0xc6f7('0x53')],'rows':_0x48e072};})[_0xc6f7('0x1c')](respondWithResult(_0x1723c0,null))[_0xc6f7('0x49')](function(_0x293bbd){var _0x2f4787=_0x5ea842[_0xc6f7('0x35')]['test']?0x1f4:_0x293bbd[_0xc6f7('0x71')]||0x1f4;logger[_0xc6f7('0x20')](_0xc6f7('0x72'),'getFields',_0x2f4787,JSON[_0xc6f7('0x1f')](_0x293bbd));delete _0x293bbd[_0xc6f7('0x2d')];if(_0x2f4787===0x191){_0x2f4787=0x190;}_0x1723c0[_0xc6f7('0x26')](_0x2f4787)[_0xc6f7('0x73')](_0x5ea842[_0xc6f7('0x35')][_0xc6f7('0x74')]?{'message':'Wrong\x20credentials','statusCode':_0x293bbd[_0xc6f7('0x71')]}:_0x293bbd);});}; \ No newline at end of file +var _0x5ce3=['fields','attributes','length','order','where','pick','filter','VIRTUAL','options','include','rows','params','includeAll','find','body','getConfigurations','findOne','DeskConfiguration','sort','merge','nolimit','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','create','DeskField','Descriptions','getFields','priority','remoteUri','authType','consumerKey','consumerSecret','token','tokenSecret','lastIndexOf','format','%s/custom_fields','application/json','headers','Basic\x20%s','%s:%s','username','password','toString','base64','concat','_embedded','entries','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','rimraf','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','destroy','stack','name','send','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x5ce3,0x19d));var _0x35ce=function(_0x2c93e2,_0x4fb5e2){_0x2c93e2=_0x2c93e2-0x0;var _0x57264e=_0x5ce3[_0x2c93e2];return _0x57264e;};'use strict';var pdf=require(_0x35ce('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x35ce('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35ce('0x2'));var rp=require('request-promise');var moment=require(_0x35ce('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x35ce('0x4'));var util=require(_0x35ce('0x5'));var path=require(_0x35ce('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x35ce('0x7'));var fs=require('fs');var fs_extra=require(_0x35ce('0x8'));var _=require('lodash');var squel=require(_0x35ce('0x9'));var crypto=require(_0x35ce('0xa'));var jsforce=require(_0x35ce('0xb'));var deskjs=require(_0x35ce('0xc'));var toCsv=require(_0x35ce('0xd'));var querystring=require(_0x35ce('0xe'));var Papa=require('papaparse');var Redis=require(_0x35ce('0xf'));var authService=require(_0x35ce('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x35ce('0x11'));var hardwareService=require(_0x35ce('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x35ce('0x13'));var config=require(_0x35ce('0x14'));var licenseUtil=require(_0x35ce('0x15'));var db=require(_0x35ce('0x16'))['db'];var integrations=require(_0x35ce('0x17'));var jayson=require(_0x35ce('0x18'));var client=jayson[_0x35ce('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x297984,_0x3929d8,_0x189ef1,_0x49f81a){return new BPromise(function(_0x5099b5,_0x5bf562){var _0x37ab18=_0x49f81a||client;return _0x37ab18['request'](_0x297984,_0x189ef1)[_0x35ce('0x1a')](function(_0x27046b){logger[_0x35ce('0x1b')](_0x35ce('0x1c'),_0x3929d8,_0x35ce('0x1d'));logger[_0x35ce('0x1e')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x3929d8,'request\x20sent',JSON[_0x35ce('0x1f')](_0x27046b));if(_0x27046b['error']){if(_0x27046b[_0x35ce('0x20')][_0x35ce('0x21')]===0x1f4){logger[_0x35ce('0x20')](_0x35ce('0x1c'),_0x3929d8,_0x27046b[_0x35ce('0x20')][_0x35ce('0x22')]);return _0x5bf562(_0x27046b[_0x35ce('0x20')][_0x35ce('0x22')]);}logger[_0x35ce('0x20')]('DeskAccount,\x20%s,\x20%s',_0x3929d8,_0x27046b[_0x35ce('0x20')]['message']);return _0x5099b5(_0x27046b[_0x35ce('0x20')][_0x35ce('0x22')]);}else{logger['info'](_0x35ce('0x1c'),_0x3929d8,'request\x20sent');_0x5099b5(_0x27046b[_0x35ce('0x23')][_0x35ce('0x22')]);}})[_0x35ce('0x24')](function(_0x2f88c4){logger[_0x35ce('0x20')](_0x35ce('0x1c'),_0x3929d8,_0x2f88c4);_0x5bf562(_0x2f88c4);});});}function respondWithStatusCode(_0x4057ce,_0x4c265e){_0x4c265e=_0x4c265e||0xcc;return function(_0x646985){if(_0x646985){return _0x4057ce[_0x35ce('0x25')](_0x4c265e);}return _0x4057ce[_0x35ce('0x26')](_0x4c265e)[_0x35ce('0x27')]();};}function respondWithResult(_0x3238cc,_0x409724){_0x409724=_0x409724||0xc8;return function(_0xfb7a28){if(_0xfb7a28){return _0x3238cc[_0x35ce('0x26')](_0x409724)[_0x35ce('0x28')](_0xfb7a28);}};}function respondWithFilteredResult(_0x2658a9,_0x59407b){return function(_0x525130){if(_0x525130){var _0x16120d=_0x525130[_0x35ce('0x29')],_0x2fad14=_0x59407b['offset'],_0x3365ce=_0x59407b[_0x35ce('0x2a')]+_0x59407b[_0x35ce('0x2b')],_0x358e07;if(_0x3365ce>=_0x16120d){_0x3365ce=_0x16120d;_0x358e07=0xc8;}else{_0x358e07=0xce;}_0x2658a9[_0x35ce('0x26')](_0x358e07);return _0x2658a9['set']('Content-Range',_0x2fad14+'-'+_0x3365ce+'/'+_0x16120d)['json'](_0x525130);}return null;};}function patchUpdates(_0x1760a6){return function(_0x88f5d2){try{jsonpatch[_0x35ce('0x2c')](_0x88f5d2,_0x1760a6,!![]);}catch(_0x595a35){return BPromise[_0x35ce('0x2d')](_0x595a35);}return _0x88f5d2[_0x35ce('0x2e')]();};}function saveUpdates(_0x517883,_0x2d13f8){return function(_0x154eab){if(_0x154eab){return _0x154eab[_0x35ce('0x2f')](_0x517883)[_0x35ce('0x1a')](function(_0x23146a){return _0x23146a;});}return null;};}function removeEntity(_0xc2474e,_0x274d03){return function(_0x32b4f5){if(_0x32b4f5){return _0x32b4f5[_0x35ce('0x30')]()['then'](function(){_0xc2474e[_0x35ce('0x26')](0xcc)[_0x35ce('0x27')]();});}};}function handleEntityNotFound(_0x43ebbb,_0x1d5d3f){return function(_0x508db1){if(!_0x508db1){_0x43ebbb['sendStatus'](0x194);}return _0x508db1;};}function handleError(_0x2dbe6d,_0x6643aa){_0x6643aa=_0x6643aa||0x1f4;return function(_0x50f59b){logger[_0x35ce('0x20')](_0x50f59b[_0x35ce('0x31')]);if(_0x50f59b[_0x35ce('0x32')]){delete _0x50f59b[_0x35ce('0x32')];}_0x2dbe6d[_0x35ce('0x26')](_0x6643aa)[_0x35ce('0x33')](_0x50f59b);};}exports['index']=function(_0x23e965,_0xd0d69c){var _0x34a2a2={},_0x2c4694={},_0x57f6de={'count':0x0,'rows':[]};var _0x501b3e=_[_0x35ce('0x34')](db[_0x35ce('0x35')][_0x35ce('0x36')],function(_0x4b0b43){return{'name':_0x4b0b43[_0x35ce('0x37')],'type':_0x4b0b43[_0x35ce('0x38')][_0x35ce('0x39')]};});_0x2c4694[_0x35ce('0x3a')]=_[_0x35ce('0x34')](_0x501b3e,_0x35ce('0x32'));_0x2c4694[_0x35ce('0x3b')]=_[_0x35ce('0x3c')](_0x23e965[_0x35ce('0x3b')]);_0x2c4694[_0x35ce('0x3d')]=_['intersection'](_0x2c4694[_0x35ce('0x3a')],_0x2c4694['query']);_0x34a2a2['attributes']=_[_0x35ce('0x3e')](_0x2c4694[_0x35ce('0x3a')],qs[_0x35ce('0x3f')](_0x23e965[_0x35ce('0x3b')]['fields']));_0x34a2a2['attributes']=_0x34a2a2[_0x35ce('0x40')][_0x35ce('0x41')]?_0x34a2a2[_0x35ce('0x40')]:_0x2c4694[_0x35ce('0x3a')];if(!_0x23e965['query']['hasOwnProperty']('nolimit')){_0x34a2a2[_0x35ce('0x2b')]=qs['limit'](_0x23e965[_0x35ce('0x3b')][_0x35ce('0x2b')]);_0x34a2a2[_0x35ce('0x2a')]=qs['offset'](_0x23e965[_0x35ce('0x3b')][_0x35ce('0x2a')]);}_0x34a2a2[_0x35ce('0x42')]=qs['sort'](_0x23e965[_0x35ce('0x3b')]['sort']);_0x34a2a2[_0x35ce('0x43')]=qs[_0x35ce('0x3d')](_[_0x35ce('0x44')](_0x23e965[_0x35ce('0x3b')],_0x2c4694[_0x35ce('0x3d')]),_0x501b3e);if(_0x23e965[_0x35ce('0x3b')][_0x35ce('0x45')]){_0x34a2a2[_0x35ce('0x43')]=_['merge'](_0x34a2a2[_0x35ce('0x43')],{'$or':_['map'](_0x501b3e,function(_0x35efb9){if(_0x35efb9[_0x35ce('0x38')]!==_0x35ce('0x46')){var _0x357c2e={};_0x357c2e[_0x35efb9[_0x35ce('0x32')]]={'$like':'%'+_0x23e965[_0x35ce('0x3b')]['filter']+'%'};return _0x357c2e;}})});}_0x34a2a2=_['merge']({},_0x34a2a2,_0x23e965[_0x35ce('0x47')]);var _0x4540ae={'where':_0x34a2a2[_0x35ce('0x43')]};return db[_0x35ce('0x35')][_0x35ce('0x29')](_0x4540ae)[_0x35ce('0x1a')](function(_0x859cc){_0x57f6de['count']=_0x859cc;if(_0x23e965['query']['includeAll']){_0x34a2a2[_0x35ce('0x48')]=[{'all':!![]}];}return db[_0x35ce('0x35')]['findAll'](_0x34a2a2);})[_0x35ce('0x1a')](function(_0xc450c7){_0x57f6de[_0x35ce('0x49')]=_0xc450c7;return _0x57f6de;})[_0x35ce('0x1a')](respondWithFilteredResult(_0xd0d69c,_0x34a2a2))[_0x35ce('0x24')](handleError(_0xd0d69c,null));};exports['show']=function(_0x11572c,_0x1d0378){var _0x35ff01={'raw':![],'where':{'id':_0x11572c[_0x35ce('0x4a')]['id']}},_0x5ce698={};_0x5ce698[_0x35ce('0x3a')]=_[_0x35ce('0x3c')](db[_0x35ce('0x35')]['rawAttributes']);_0x5ce698['query']=_['keys'](_0x11572c[_0x35ce('0x3b')]);_0x5ce698[_0x35ce('0x3d')]=_['intersection'](_0x5ce698[_0x35ce('0x3a')],_0x5ce698[_0x35ce('0x3b')]);_0x35ff01[_0x35ce('0x40')]=_[_0x35ce('0x3e')](_0x5ce698[_0x35ce('0x3a')],qs[_0x35ce('0x3f')](_0x11572c[_0x35ce('0x3b')][_0x35ce('0x3f')]));_0x35ff01['attributes']=_0x35ff01[_0x35ce('0x40')][_0x35ce('0x41')]?_0x35ff01[_0x35ce('0x40')]:_0x5ce698[_0x35ce('0x3a')];if(_0x11572c[_0x35ce('0x3b')][_0x35ce('0x4b')]){_0x35ff01[_0x35ce('0x48')]=[{'all':!![]}];}_0x35ff01=_['merge']({},_0x35ff01,_0x11572c['options']);return db[_0x35ce('0x35')][_0x35ce('0x4c')](_0x35ff01)[_0x35ce('0x1a')](handleEntityNotFound(_0x1d0378,null))[_0x35ce('0x1a')](respondWithResult(_0x1d0378,null))[_0x35ce('0x24')](handleError(_0x1d0378,null));};exports['create']=function(_0x3479fe,_0x3cff41){return db[_0x35ce('0x35')]['create'](_0x3479fe[_0x35ce('0x4d')],{})[_0x35ce('0x1a')](respondWithResult(_0x3cff41,0xc9))[_0x35ce('0x24')](handleError(_0x3cff41,null));};exports['update']=function(_0x309239,_0xe5bcd3){if(_0x309239[_0x35ce('0x4d')]['id']){delete _0x309239[_0x35ce('0x4d')]['id'];}return db['DeskAccount'][_0x35ce('0x4c')]({'where':{'id':_0x309239['params']['id']}})['then'](handleEntityNotFound(_0xe5bcd3,null))[_0x35ce('0x1a')](saveUpdates(_0x309239[_0x35ce('0x4d')],null))[_0x35ce('0x1a')](respondWithResult(_0xe5bcd3,null))[_0x35ce('0x24')](handleError(_0xe5bcd3,null));};exports[_0x35ce('0x30')]=function(_0x2cc59b,_0x4e2592){return db[_0x35ce('0x35')][_0x35ce('0x4c')]({'where':{'id':_0x2cc59b['params']['id']}})[_0x35ce('0x1a')](handleEntityNotFound(_0x4e2592,null))[_0x35ce('0x1a')](removeEntity(_0x4e2592,null))[_0x35ce('0x24')](handleError(_0x4e2592,null));};exports[_0x35ce('0x4e')]=function(_0x437621,_0x2a7b02,_0x2b794b){var _0xe99b7d={};var _0x4fbb62={};var _0x3b0296;var _0x168f41;return db[_0x35ce('0x35')][_0x35ce('0x4f')]({'where':{'id':_0x437621[_0x35ce('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2a7b02,null))['then'](function(_0x2070f4){if(_0x2070f4){_0x3b0296=_0x2070f4;_0x4fbb62[_0x35ce('0x3a')]=_['keys'](db[_0x35ce('0x50')][_0x35ce('0x36')]);_0x4fbb62[_0x35ce('0x3b')]=_['keys'](_0x437621[_0x35ce('0x3b')]);_0x4fbb62[_0x35ce('0x3d')]=_['intersection'](_0x4fbb62[_0x35ce('0x3a')],_0x4fbb62[_0x35ce('0x3b')]);_0xe99b7d[_0x35ce('0x40')]=_['intersection'](_0x4fbb62[_0x35ce('0x3a')],qs[_0x35ce('0x3f')](_0x437621['query'][_0x35ce('0x3f')]));_0xe99b7d[_0x35ce('0x40')]=_0xe99b7d['attributes'][_0x35ce('0x41')]?_0xe99b7d[_0x35ce('0x40')]:_0x4fbb62[_0x35ce('0x3a')];_0xe99b7d[_0x35ce('0x42')]=qs[_0x35ce('0x51')](_0x437621['query']['sort']);_0xe99b7d[_0x35ce('0x43')]=qs['filters'](_['pick'](_0x437621[_0x35ce('0x3b')],_0x4fbb62[_0x35ce('0x3d')]));if(_0x437621[_0x35ce('0x3b')][_0x35ce('0x45')]){_0xe99b7d[_0x35ce('0x43')]=_[_0x35ce('0x52')](_0xe99b7d['where'],{'$or':_[_0x35ce('0x34')](_0xe99b7d[_0x35ce('0x40')],function(_0x335003){var _0x105017={};_0x105017[_0x335003]={'$like':'%'+_0x437621[_0x35ce('0x3b')]['filter']+'%'};return _0x105017;})});}_0xe99b7d=_['merge']({},_0xe99b7d,_0x437621[_0x35ce('0x47')]);return _0x3b0296[_0x35ce('0x4e')](_0xe99b7d);}})[_0x35ce('0x1a')](function(_0x44682b){if(_0x44682b){_0x168f41=_0x44682b[_0x35ce('0x41')];if(!_0x437621[_0x35ce('0x3b')]['hasOwnProperty'](_0x35ce('0x53'))){_0xe99b7d[_0x35ce('0x2b')]=qs[_0x35ce('0x2b')](_0x437621['query'][_0x35ce('0x2b')]);_0xe99b7d[_0x35ce('0x2a')]=qs['offset'](_0x437621[_0x35ce('0x3b')][_0x35ce('0x2a')]);}return _0x3b0296[_0x35ce('0x4e')](_0xe99b7d);}})[_0x35ce('0x1a')](function(_0x5229c1){if(_0x5229c1){return _0x5229c1?{'count':_0x168f41,'rows':_0x5229c1}:null;}})[_0x35ce('0x1a')](respondWithResult(_0x2a7b02,null))[_0x35ce('0x24')](handleError(_0x2a7b02,null));};exports[_0x35ce('0x54')]=function(_0x41884b,_0x3cc29b,_0x425a6f){if(_0x41884b[_0x35ce('0x4d')]['id']){delete _0x41884b[_0x35ce('0x4d')]['id'];}return db['DeskAccount'][_0x35ce('0x4f')]({'where':{'id':_0x41884b[_0x35ce('0x4a')]['id']}})[_0x35ce('0x1a')](handleEntityNotFound(_0x3cc29b,null))['then'](function(_0x226890){if(_0x226890){_0x41884b['body'][_0x35ce('0x55')]=_0x226890['id'];_0x41884b[_0x35ce('0x4d')][_0x35ce('0x56')]=integrations[_0x35ce('0x57')](_0x41884b[_0x35ce('0x4d')]['channel'],_0x41884b[_0x35ce('0x4d')]['type']);_0x41884b['body']['Descriptions']=integrations[_0x35ce('0x58')](_0x41884b[_0x35ce('0x4d')][_0x35ce('0x59')],_0x41884b[_0x35ce('0x4d')]['type']);return db[_0x35ce('0x50')][_0x35ce('0x5a')](_0x41884b['body'],{'include':[{'model':db[_0x35ce('0x5b')],'as':_0x35ce('0x56')},{'model':db['DeskField'],'as':_0x35ce('0x5c')}]});}return null;})['then'](respondWithResult(_0x3cc29b,null))[_0x35ce('0x24')](handleError(_0x3cc29b,null));};exports[_0x35ce('0x5d')]=function(_0x4217e6,_0x3dec0,_0x5e265d){var _0x565221=[{'name':_0x35ce('0x5e'),'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 _0x2adce7='';return db[_0x35ce('0x35')][_0x35ce('0x4f')]({'where':{'id':_0x4217e6[_0x35ce('0x4a')]['id']},'attributes':['id',_0x35ce('0x5f'),_0x35ce('0x60'),'username','password',_0x35ce('0x61'),_0x35ce('0x62'),_0x35ce('0x63'),_0x35ce('0x64')]})[_0x35ce('0x1a')](handleEntityNotFound(_0x3dec0,null))[_0x35ce('0x1a')](function(_0x47d212){if(_0x47d212){_0x2adce7=_0x47d212[_0x35ce('0x5f')];var _0xcad3cc=_0x2adce7['slice'](-0x1);if(_0xcad3cc==='/'){_0x2adce7=_0x2adce7['substring'](0x0,_0x2adce7[_0x35ce('0x65')](_0xcad3cc));}var _0x23f2ba={'method':'GET','uri':util[_0x35ce('0x66')](_0x35ce('0x67'),_0x2adce7),'headers':{'Content-Type':_0x35ce('0x68'),'Accept':_0x35ce('0x68')},'json':!![]};if(_0x47d212[_0x35ce('0x60')]==='basic'){_0x23f2ba[_0x35ce('0x69')]['Authorization']=util[_0x35ce('0x66')](_0x35ce('0x6a'),new Buffer(util[_0x35ce('0x66')](_0x35ce('0x6b'),_0x47d212[_0x35ce('0x6c')],_0x47d212[_0x35ce('0x6d')]))[_0x35ce('0x6e')](_0x35ce('0x6f')));}return rp(_0x23f2ba)[_0x35ce('0x1a')](function(_0x3ba48b){return _0x565221[_0x35ce('0x70')](_[_0x35ce('0x34')](_0x3ba48b[_0x35ce('0x71')][_0x35ce('0x72')],function(_0x5abb02){return{'id':_0x5abb02[_0x35ce('0x32')],'name':_0x5abb02['name'],'type':_0x5abb02[_0x35ce('0x38')],'active':_0x5abb02['active'],'label':_0x5abb02[_0x35ce('0x73')],'custom':!![]};}));});}})['then'](function(_0x11a29b){return{'count':_0x11a29b[_0x35ce('0x41')],'rows':_0x11a29b};})[_0x35ce('0x1a')](respondWithResult(_0x3dec0,null))['catch'](function(_0x3322b5){var _0x2e0b5b=_0x4217e6[_0x35ce('0x3b')][_0x35ce('0x74')]?0x1f4:_0x3322b5[_0x35ce('0x75')]||0x1f4;logger[_0x35ce('0x20')](_0x35ce('0x76'),_0x35ce('0x5d'),_0x2e0b5b,JSON[_0x35ce('0x1f')](_0x3322b5));delete _0x3322b5[_0x35ce('0x32')];if(_0x2e0b5b===0x191){_0x2e0b5b=0x190;}_0x3dec0[_0x35ce('0x26')](_0x2e0b5b)['send'](_0x4217e6[_0x35ce('0x3b')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x3322b5[_0x35ce('0x75')]}:_0x3322b5);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 04ed1d7..2c27466 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 _0xdb05=['../../config/environment','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xdb05,0x16d));var _0x5db0=function(_0x2820b2,_0x283c16){_0x2820b2=_0x2820b2-0x0;var _0x52c515=_0xdb05[_0x2820b2];return _0x52c515;};'use strict';var _=require('lodash');var util=require(_0x5db0('0x0'));var logger=require(_0x5db0('0x1'))(_0x5db0('0x2'));var moment=require(_0x5db0('0x3'));var BPromise=require('bluebird');var rp=require(_0x5db0('0x4'));var fs=require('fs');var path=require(_0x5db0('0x5'));var rimraf=require(_0x5db0('0x6'));var config=require(_0x5db0('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x5db0('0x8'));module['exports']=function(_0x2da2ba,_0x89a096){return _0x2da2ba[_0x5db0('0x9')](_0x5db0('0xa'),attributes,{'tableName':_0x5db0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x375d=['int_desk_accounts','util','api','moment','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount'];(function(_0x32ee50,_0x564493){var _0x12a1b3=function(_0x3d6bc8){while(--_0x3d6bc8){_0x32ee50['push'](_0x32ee50['shift']());}};_0x12a1b3(++_0x564493);}(_0x375d,0xd3));var _0xd375=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x375d[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xd375('0x0'));var logger=require('../../config/logger')(_0xd375('0x1'));var moment=require(_0xd375('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd375('0x3'));var config=require(_0xd375('0x4'));var attributes=require(_0xd375('0x5'));var integrations=require(_0xd375('0x6'));module[_0xd375('0x7')]=function(_0x2a3b52,_0x6e9b95){return _0x2a3b52['define'](_0xd375('0x8'),attributes,{'tableName':_0xd375('0x9'),'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 1a621fe..62f8082 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 _0x93db=['map','model','debug','ShowDeskAccount','find','raw','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','catch','GetDeskAccount','DeskAccount','options','where','attributes','limit','include'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x93db,0x1e6));var _0xb93d=function(_0x313ca6,_0x599c86){_0x313ca6=_0x313ca6-0x0;var _0x3697cb=_0x93db[_0x313ca6];return _0x3697cb;};'use strict';var _=require('lodash');var util=require(_0xb93d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb93d('0x1'));var fs=require('fs');var Redis=require(_0xb93d('0x2'));var db=require(_0xb93d('0x3'))['db'];var utils=require(_0xb93d('0x4'));var logger=require('../../config/logger')(_0xb93d('0x5'));var config=require(_0xb93d('0x6'));var jayson=require(_0xb93d('0x7'));var client=jayson['client'][_0xb93d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12f0b9,_0x564d75,_0x1dd818){return new BPromise(function(_0x3b118e,_0xaee0c2){return client[_0xb93d('0x9')](_0x12f0b9,_0x1dd818)[_0xb93d('0xa')](function(_0x3de57d){logger[_0xb93d('0xb')]('DeskAccount,\x20%s,\x20%s',_0x564d75,_0xb93d('0xc'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x564d75,'request\x20sent',JSON[_0xb93d('0xd')](_0x3de57d));if(_0x3de57d[_0xb93d('0xe')]){if(_0x3de57d['error'][_0xb93d('0xf')]===0x1f4){logger[_0xb93d('0xe')](_0xb93d('0x10'),_0x564d75,_0x3de57d[_0xb93d('0xe')]['message']);return _0xaee0c2(_0x3de57d[_0xb93d('0xe')][_0xb93d('0x11')]);}logger[_0xb93d('0xe')]('DeskAccount,\x20%s,\x20%s',_0x564d75,_0x3de57d[_0xb93d('0xe')][_0xb93d('0x11')]);return _0x3b118e(_0x3de57d['error'][_0xb93d('0x11')]);}else{logger[_0xb93d('0xb')](_0xb93d('0x10'),_0x564d75,_0xb93d('0xc'));_0x3b118e(_0x3de57d['result'][_0xb93d('0x11')]);}})[_0xb93d('0x12')](function(_0x5004ce){logger[_0xb93d('0xe')](_0xb93d('0x10'),_0x564d75,_0x5004ce);_0xaee0c2(_0x5004ce);});});}exports[_0xb93d('0x13')]=function(_0x43636a){var _0x2ff54a=this;return new Promise(function(_0x477627,_0x5bc3ab){return db[_0xb93d('0x14')]['findAll']({'raw':_0x43636a[_0xb93d('0x15')]?_0x43636a[_0xb93d('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x43636a[_0xb93d('0x15')]?_0x43636a[_0xb93d('0x15')][_0xb93d('0x16')]||null:null,'attributes':_0x43636a['options']?_0x43636a[_0xb93d('0x15')][_0xb93d('0x17')]||null:null,'limit':_0x43636a[_0xb93d('0x15')]?_0x43636a['options'][_0xb93d('0x18')]||null:null,'include':_0x43636a[_0xb93d('0x15')]?_0x43636a[_0xb93d('0x15')][_0xb93d('0x19')]?_[_0xb93d('0x1a')](_0x43636a[_0xb93d('0x15')][_0xb93d('0x19')],function(_0x7f350){return{'model':db[_0x7f350[_0xb93d('0x1b')]],'as':_0x7f350['as'],'attributes':_0x7f350[_0xb93d('0x17')],'include':_0x7f350['include']?_[_0xb93d('0x1a')](_0x7f350[_0xb93d('0x19')],function(_0x1cf04b){return{'model':db[_0x1cf04b['model']],'as':_0x1cf04b['as'],'attributes':_0x1cf04b[_0xb93d('0x17')],'include':_0x1cf04b[_0xb93d('0x19')]?_[_0xb93d('0x1a')](_0x1cf04b['include'],function(_0x486ca1){return{'model':db[_0x486ca1[_0xb93d('0x1b')]],'as':_0x486ca1['as'],'attributes':_0x486ca1[_0xb93d('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf91147){logger[_0xb93d('0xb')](_0xb93d('0x13'),_0x43636a);logger[_0xb93d('0x1c')](_0xb93d('0x13'),_0x43636a,JSON['stringify'](_0xf91147));_0x477627(_0xf91147);})[_0xb93d('0x12')](function(_0x3d3ddb){logger[_0xb93d('0xe')](_0xb93d('0x13'),_0x3d3ddb[_0xb93d('0x11')],_0x43636a);_0x5bc3ab(_0x2ff54a[_0xb93d('0xe')](0x1f4,_0x3d3ddb[_0xb93d('0x11')]));});});};exports[_0xb93d('0x1d')]=function(_0xdcccbc){var _0x2c1a74=this;return new Promise(function(_0x1e4d1c,_0x4d6983){return db[_0xb93d('0x14')][_0xb93d('0x1e')]({'raw':_0xdcccbc[_0xb93d('0x15')]?_0xdcccbc[_0xb93d('0x15')][_0xb93d('0x1f')]===undefined?!![]:![]:!![],'where':_0xdcccbc['options']?_0xdcccbc[_0xb93d('0x15')][_0xb93d('0x16')]||null:null,'attributes':_0xdcccbc['options']?_0xdcccbc[_0xb93d('0x15')][_0xb93d('0x17')]||null:null,'include':_0xdcccbc['options']?_0xdcccbc[_0xb93d('0x15')][_0xb93d('0x19')]?_[_0xb93d('0x1a')](_0xdcccbc[_0xb93d('0x15')][_0xb93d('0x19')],function(_0xb5c06c){return{'model':db[_0xb5c06c[_0xb93d('0x1b')]],'as':_0xb5c06c['as'],'attributes':_0xb5c06c[_0xb93d('0x17')],'include':_0xb5c06c[_0xb93d('0x19')]?_[_0xb93d('0x1a')](_0xb5c06c[_0xb93d('0x19')],function(_0x449570){return{'model':db[_0x449570['model']],'as':_0x449570['as'],'attributes':_0x449570['attributes'],'include':_0x449570[_0xb93d('0x19')]?_['map'](_0x449570['include'],function(_0xbb52f7){return{'model':db[_0xbb52f7[_0xb93d('0x1b')]],'as':_0xbb52f7['as'],'attributes':_0xbb52f7['attributes']};}):[]};}):[]};}):[]:[]})[_0xb93d('0xa')](function(_0x4abadb){logger[_0xb93d('0xb')](_0xb93d('0x1d'),_0xdcccbc);logger[_0xb93d('0x1c')](_0xb93d('0x1d'),_0xdcccbc,JSON[_0xb93d('0xd')](_0x4abadb));_0x1e4d1c(_0x4abadb);})['catch'](function(_0xa19795){logger[_0xb93d('0xe')](_0xb93d('0x1d'),_0xa19795[_0xb93d('0x11')],_0xdcccbc);_0x4d6983(_0x2c1a74[_0xb93d('0xe')](0x1f4,_0xa19795['message']));});});}; \ No newline at end of file +var _0xe73d=['DeskAccount','find','where','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetDeskAccount','options','raw','attributes','limit','include','map','model','ShowDeskAccount'];(function(_0x581b3e,_0x222e35){var _0x457586=function(_0xd1d8a3){while(--_0xd1d8a3){_0x581b3e['push'](_0x581b3e['shift']());}};_0x457586(++_0x222e35);}(_0xe73d,0x19b));var _0xde73=function(_0x5b3ef8,_0x5f32df){_0x5b3ef8=_0x5b3ef8-0x0;var _0xd4ef43=_0xe73d[_0x5b3ef8];return _0xd4ef43;};'use strict';var _=require(_0xde73('0x0'));var util=require('util');var moment=require(_0xde73('0x1'));var BPromise=require('bluebird');var rs=require(_0xde73('0x2'));var fs=require('fs');var Redis=require(_0xde73('0x3'));var db=require(_0xde73('0x4'))['db'];var utils=require(_0xde73('0x5'));var logger=require('../../config/logger')(_0xde73('0x6'));var config=require(_0xde73('0x7'));var jayson=require(_0xde73('0x8'));var client=jayson['client'][_0xde73('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ab85f,_0x2ee144,_0x40cded){return new BPromise(function(_0x2660b6,_0x16185c){return client[_0xde73('0xa')](_0x1ab85f,_0x40cded)[_0xde73('0xb')](function(_0x44c55f){logger[_0xde73('0xc')](_0xde73('0xd'),_0x2ee144,_0xde73('0xe'));logger[_0xde73('0xf')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x2ee144,_0xde73('0xe'),JSON[_0xde73('0x10')](_0x44c55f));if(_0x44c55f[_0xde73('0x11')]){if(_0x44c55f[_0xde73('0x11')][_0xde73('0x12')]===0x1f4){logger[_0xde73('0x11')]('DeskAccount,\x20%s,\x20%s',_0x2ee144,_0x44c55f[_0xde73('0x11')][_0xde73('0x13')]);return _0x16185c(_0x44c55f[_0xde73('0x11')][_0xde73('0x13')]);}logger[_0xde73('0x11')](_0xde73('0xd'),_0x2ee144,_0x44c55f[_0xde73('0x11')][_0xde73('0x13')]);return _0x2660b6(_0x44c55f['error']['message']);}else{logger['info'](_0xde73('0xd'),_0x2ee144,'request\x20sent');_0x2660b6(_0x44c55f[_0xde73('0x14')]['message']);}})[_0xde73('0x15')](function(_0x1c84e3){logger[_0xde73('0x11')](_0xde73('0xd'),_0x2ee144,_0x1c84e3);_0x16185c(_0x1c84e3);});});}exports[_0xde73('0x16')]=function(_0x13fde6){var _0x505980=this;return new Promise(function(_0x59fc61,_0x374dd2){return db['DeskAccount']['findAll']({'raw':_0x13fde6[_0xde73('0x17')]?_0x13fde6[_0xde73('0x17')][_0xde73('0x18')]===undefined?!![]:![]:!![],'where':_0x13fde6[_0xde73('0x17')]?_0x13fde6[_0xde73('0x17')]['where']||null:null,'attributes':_0x13fde6[_0xde73('0x17')]?_0x13fde6[_0xde73('0x17')][_0xde73('0x19')]||null:null,'limit':_0x13fde6[_0xde73('0x17')]?_0x13fde6['options'][_0xde73('0x1a')]||null:null,'include':_0x13fde6[_0xde73('0x17')]?_0x13fde6[_0xde73('0x17')][_0xde73('0x1b')]?_[_0xde73('0x1c')](_0x13fde6['options'][_0xde73('0x1b')],function(_0x291b3a){return{'model':db[_0x291b3a[_0xde73('0x1d')]],'as':_0x291b3a['as'],'attributes':_0x291b3a['attributes'],'include':_0x291b3a[_0xde73('0x1b')]?_[_0xde73('0x1c')](_0x291b3a['include'],function(_0x2788a0){return{'model':db[_0x2788a0[_0xde73('0x1d')]],'as':_0x2788a0['as'],'attributes':_0x2788a0[_0xde73('0x19')],'include':_0x2788a0[_0xde73('0x1b')]?_[_0xde73('0x1c')](_0x2788a0[_0xde73('0x1b')],function(_0x2d6c0a){return{'model':db[_0x2d6c0a['model']],'as':_0x2d6c0a['as'],'attributes':_0x2d6c0a[_0xde73('0x19')]};}):[]};}):[]};}):[]:[]})[_0xde73('0xb')](function(_0x2f25d1){logger[_0xde73('0xc')](_0xde73('0x16'),_0x13fde6);logger[_0xde73('0xf')](_0xde73('0x16'),_0x13fde6,JSON['stringify'](_0x2f25d1));_0x59fc61(_0x2f25d1);})[_0xde73('0x15')](function(_0x1ded39){logger[_0xde73('0x11')](_0xde73('0x16'),_0x1ded39[_0xde73('0x13')],_0x13fde6);_0x374dd2(_0x505980[_0xde73('0x11')](0x1f4,_0x1ded39['message']));});});};exports[_0xde73('0x1e')]=function(_0x3888e4){var _0x48d32c=this;return new Promise(function(_0x1d8fb9,_0x4db3b0){return db[_0xde73('0x1f')][_0xde73('0x20')]({'raw':_0x3888e4['options']?_0x3888e4[_0xde73('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3888e4['options']?_0x3888e4[_0xde73('0x17')][_0xde73('0x21')]||null:null,'attributes':_0x3888e4[_0xde73('0x17')]?_0x3888e4[_0xde73('0x17')]['attributes']||null:null,'include':_0x3888e4[_0xde73('0x17')]?_0x3888e4['options'][_0xde73('0x1b')]?_[_0xde73('0x1c')](_0x3888e4[_0xde73('0x17')][_0xde73('0x1b')],function(_0x5bff01){return{'model':db[_0x5bff01['model']],'as':_0x5bff01['as'],'attributes':_0x5bff01[_0xde73('0x19')],'include':_0x5bff01[_0xde73('0x1b')]?_[_0xde73('0x1c')](_0x5bff01[_0xde73('0x1b')],function(_0x1f4dfc){return{'model':db[_0x1f4dfc[_0xde73('0x1d')]],'as':_0x1f4dfc['as'],'attributes':_0x1f4dfc[_0xde73('0x19')],'include':_0x1f4dfc['include']?_[_0xde73('0x1c')](_0x1f4dfc[_0xde73('0x1b')],function(_0xf1843d){return{'model':db[_0xf1843d[_0xde73('0x1d')]],'as':_0xf1843d['as'],'attributes':_0xf1843d[_0xde73('0x19')]};}):[]};}):[]};}):[]:[]})[_0xde73('0xb')](function(_0x7116dc){logger[_0xde73('0xc')](_0xde73('0x1e'),_0x3888e4);logger['debug'](_0xde73('0x1e'),_0x3888e4,JSON[_0xde73('0x10')](_0x7116dc));_0x1d8fb9(_0x7116dc);})[_0xde73('0x15')](function(_0x31b21d){logger[_0xde73('0x11')]('ShowDeskAccount',_0x31b21d[_0xde73('0x13')],_0x3888e4);_0x4db3b0(_0x48d32c[_0xde73('0x11')](0x1f4,_0x31b21d['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 7447d8b..0d00e88 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 _0x9a3b=['getFields','/:id/subjects','/:id/descriptions','/:id/tags','post','create','setTags','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show'];(function(_0x40ddc0,_0x41c082){var _0x1aebf1=function(_0x3ba1f6){while(--_0x3ba1f6){_0x40ddc0['push'](_0x40ddc0['shift']());}};_0x1aebf1(++_0x41c082);}(_0x9a3b,0xbb));var _0xb9a3=function(_0x583b3b,_0x31271d){_0x583b3b=_0x583b3b-0x0;var _0xcdb6d0=_0x9a3b[_0x583b3b];return _0xcdb6d0;};'use strict';var multer=require(_0xb9a3('0x0'));var util=require(_0xb9a3('0x1'));var path=require(_0xb9a3('0x2'));var timeout=require('connect-timeout');var express=require(_0xb9a3('0x3'));var router=express[_0xb9a3('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb9a3('0x5'));var config=require(_0xb9a3('0x6'));var controller=require(_0xb9a3('0x7'));router[_0xb9a3('0x8')]('/',auth[_0xb9a3('0x9')](),controller[_0xb9a3('0xa')]);router['get'](_0xb9a3('0xb'),auth['isAuthenticated'](),controller[_0xb9a3('0xc')]);router[_0xb9a3('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xb9a3('0xd')]);router['get'](_0xb9a3('0xe'),auth[_0xb9a3('0x9')](),controller['getSubjects']);router[_0xb9a3('0x8')](_0xb9a3('0xf'),auth[_0xb9a3('0x9')](),controller['getDescriptions']);router[_0xb9a3('0x8')](_0xb9a3('0x10'),auth[_0xb9a3('0x9')](),controller['getTags']);router[_0xb9a3('0x11')]('/',auth['isAuthenticated'](),controller[_0xb9a3('0x12')]);router[_0xb9a3('0x11')]('/:id/tags',auth['isAuthenticated'](),controller[_0xb9a3('0x13')]);router[_0xb9a3('0x14')](_0xb9a3('0xb'),auth[_0xb9a3('0x9')](),controller[_0xb9a3('0x15')]);router[_0xb9a3('0x16')](_0xb9a3('0xb'),auth[_0xb9a3('0x9')](),controller[_0xb9a3('0x17')]);module[_0xb9a3('0x18')]=router; \ No newline at end of file +var _0x6008=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','multer','util','path','Router'];(function(_0x2cfced,_0x133626){var _0x55aa1f=function(_0x4d6a06){while(--_0x4d6a06){_0x2cfced['push'](_0x2cfced['shift']());}};_0x55aa1f(++_0x133626);}(_0x6008,0x125));var _0x8600=function(_0x4a1e27,_0x4fa470){_0x4a1e27=_0x4a1e27-0x0;var _0x126b66=_0x6008[_0x4a1e27];return _0x126b66;};'use strict';var multer=require(_0x8600('0x0'));var util=require(_0x8600('0x1'));var path=require(_0x8600('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8600('0x3')]();var fs_extra=require(_0x8600('0x4'));var auth=require(_0x8600('0x5'));var interaction=require(_0x8600('0x6'));var config=require('../../config/environment');var controller=require('./intDeskConfiguration.controller');router[_0x8600('0x7')]('/',auth[_0x8600('0x8')](),controller[_0x8600('0x9')]);router['get'](_0x8600('0xa'),auth[_0x8600('0x8')](),controller[_0x8600('0xb')]);router[_0x8600('0x7')](_0x8600('0xc'),auth[_0x8600('0x8')](),controller['getFields']);router[_0x8600('0x7')](_0x8600('0xd'),auth['isAuthenticated'](),controller[_0x8600('0xe')]);router[_0x8600('0x7')](_0x8600('0xf'),auth[_0x8600('0x8')](),controller[_0x8600('0x10')]);router[_0x8600('0x7')]('/:id/tags',auth[_0x8600('0x8')](),controller[_0x8600('0x11')]);router[_0x8600('0x12')]('/',auth[_0x8600('0x8')](),controller[_0x8600('0x13')]);router[_0x8600('0x12')](_0x8600('0x14'),auth[_0x8600('0x8')](),controller[_0x8600('0x15')]);router[_0x8600('0x16')]('/:id',auth[_0x8600('0x8')](),controller[_0x8600('0x17')]);router[_0x8600('0x18')](_0x8600('0xa'),auth[_0x8600('0x8')](),controller[_0x8600('0x19')]);module[_0x8600('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 590415f..e266136 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 _0xbbde=['exports'];(function(_0x443c1e,_0x3f76ea){var _0xb9fd20=function(_0x5ef40e){while(--_0x5ef40e){_0x443c1e['push'](_0x443c1e['shift']());}};_0xb9fd20(++_0x3f76ea);}(_0xbbde,0x1d5));var _0xebbd=function(_0x42e4d7,_0x4bd202){_0x42e4d7=_0x42e4d7-0x0;var _0x346cd8=_0xbbde[_0x42e4d7];return _0x346cd8;};'use strict';var Sequelize=require('sequelize');module[_0xebbd('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x005e=['STRING'];(function(_0x4e9d95,_0x40784d){var _0x1654f7=function(_0x34f7fc){while(--_0x34f7fc){_0x4e9d95['push'](_0x4e9d95['shift']());}};_0x1654f7(++_0x40784d);}(_0x005e,0x11f));var _0xe005=function(_0x3bab09,_0x217c29){_0x3bab09=_0x3bab09-0x0;var _0x164376=_0x005e[_0x3bab09];return _0x164376;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe005('0x0')]},'description':{'type':Sequelize[_0xe005('0x0')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 280eee1..2db0697 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 _0x1cff=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','end','status','json','count','offset','limit','set','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','DeskConfiguration','findAll','rows','show','keys','includeAll','include','find','create','body','params','getFields','pick','getSubjects','DeskField','getDescriptions','findOne','getTags','Tag','setTags','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x1cff,0x117));var _0xf1cf=function(_0x5cc47a,_0x3f204a){_0x5cc47a=_0x5cc47a-0x0;var _0x16d211=_0x1cff[_0x5cc47a];return _0x16d211;};'use strict';var pdf=require(_0xf1cf('0x0'));var emlformat=require(_0xf1cf('0x1'));var rimraf=require(_0xf1cf('0x2'));var zipdir=require(_0xf1cf('0x3'));var jsonpatch=require(_0xf1cf('0x4'));var rp=require('request-promise');var moment=require(_0xf1cf('0x5'));var BPromise=require(_0xf1cf('0x6'));var Mustache=require(_0xf1cf('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xf1cf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf1cf('0x9'));var _=require(_0xf1cf('0xa'));var squel=require(_0xf1cf('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf1cf('0xc'));var toCsv=require(_0xf1cf('0x8'));var querystring=require(_0xf1cf('0xd'));var Papa=require(_0xf1cf('0xe'));var Redis=require(_0xf1cf('0xf'));var authService=require(_0xf1cf('0x10'));var qs=require(_0xf1cf('0x11'));var as=require(_0xf1cf('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf1cf('0x13'))(_0xf1cf('0x14'));var utils=require('../../config/utils');var config=require(_0xf1cf('0x15'));var licenseUtil=require(_0xf1cf('0x16'));var db=require(_0xf1cf('0x17'))['db'];var jayson=require(_0xf1cf('0x18'));var client=jayson[_0xf1cf('0x19')][_0xf1cf('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xb34c5f,_0x27f89b,_0x3e09f2,_0x22f128){return new BPromise(function(_0x5a069b,_0x5b4de5){var _0xb90efe=_0x22f128||client;return _0xb90efe[_0xf1cf('0x1b')](_0xb34c5f,_0x3e09f2)[_0xf1cf('0x1c')](function(_0x4073d2){logger[_0xf1cf('0x1d')](_0xf1cf('0x1e'),_0x27f89b,'request\x20sent');logger[_0xf1cf('0x1f')](_0xf1cf('0x20'),_0x27f89b,_0xf1cf('0x21'),JSON[_0xf1cf('0x22')](_0x4073d2));if(_0x4073d2[_0xf1cf('0x23')]){if(_0x4073d2[_0xf1cf('0x23')][_0xf1cf('0x24')]===0x1f4){logger[_0xf1cf('0x23')](_0xf1cf('0x1e'),_0x27f89b,_0x4073d2['error'][_0xf1cf('0x25')]);return _0x5b4de5(_0x4073d2[_0xf1cf('0x23')][_0xf1cf('0x25')]);}logger[_0xf1cf('0x23')](_0xf1cf('0x1e'),_0x27f89b,_0x4073d2[_0xf1cf('0x23')][_0xf1cf('0x25')]);return _0x5a069b(_0x4073d2[_0xf1cf('0x23')][_0xf1cf('0x25')]);}else{logger['info'](_0xf1cf('0x1e'),_0x27f89b,'request\x20sent');_0x5a069b(_0x4073d2[_0xf1cf('0x26')][_0xf1cf('0x25')]);}})[_0xf1cf('0x27')](function(_0x49d4a8){logger['error'](_0xf1cf('0x1e'),_0x27f89b,_0x49d4a8);_0x5b4de5(_0x49d4a8);});});}function respondWithStatusCode(_0x234ca2,_0x1542d2){_0x1542d2=_0x1542d2||0xcc;return function(_0x1d66d2){if(_0x1d66d2){return _0x234ca2['sendStatus'](_0x1542d2);}return _0x234ca2['status'](_0x1542d2)[_0xf1cf('0x28')]();};}function respondWithResult(_0x591284,_0x582a04){_0x582a04=_0x582a04||0xc8;return function(_0x51b063){if(_0x51b063){return _0x591284[_0xf1cf('0x29')](_0x582a04)[_0xf1cf('0x2a')](_0x51b063);}};}function respondWithFilteredResult(_0x2afd68,_0x36febd){return function(_0x58c349){if(_0x58c349){var _0x4b5162=_0x58c349[_0xf1cf('0x2b')],_0x5b1c9b=_0x36febd[_0xf1cf('0x2c')],_0x1a02df=_0x36febd['offset']+_0x36febd[_0xf1cf('0x2d')],_0x20e236;if(_0x1a02df>=_0x4b5162){_0x1a02df=_0x4b5162;_0x20e236=0xc8;}else{_0x20e236=0xce;}_0x2afd68[_0xf1cf('0x29')](_0x20e236);return _0x2afd68[_0xf1cf('0x2e')]('Content-Range',_0x5b1c9b+'-'+_0x1a02df+'/'+_0x4b5162)['json'](_0x58c349);}return null;};}function patchUpdates(_0x3baa1f){return function(_0x19f5ab){try{jsonpatch[_0xf1cf('0x2f')](_0x19f5ab,_0x3baa1f,!![]);}catch(_0x315d27){return BPromise[_0xf1cf('0x30')](_0x315d27);}return _0x19f5ab[_0xf1cf('0x31')]();};}function saveUpdates(_0x2eab76,_0x2a53fe){return function(_0x2356da){if(_0x2356da){return _0x2356da[_0xf1cf('0x32')](_0x2eab76)[_0xf1cf('0x1c')](function(_0x29da4a){return _0x29da4a;});}return null;};}function removeEntity(_0x494abd,_0x513e94){return function(_0x4ac3a0){if(_0x4ac3a0){return _0x4ac3a0[_0xf1cf('0x33')]()['then'](function(){_0x494abd[_0xf1cf('0x29')](0xcc)[_0xf1cf('0x28')]();});}};}function handleEntityNotFound(_0x396f0f,_0x5aee3e){return function(_0x4b806e){if(!_0x4b806e){_0x396f0f[_0xf1cf('0x34')](0x194);}return _0x4b806e;};}function handleError(_0x5505,_0x439cba){_0x439cba=_0x439cba||0x1f4;return function(_0x24c17c){logger[_0xf1cf('0x23')](_0x24c17c[_0xf1cf('0x35')]);if(_0x24c17c[_0xf1cf('0x36')]){delete _0x24c17c[_0xf1cf('0x36')];}_0x5505['status'](_0x439cba)[_0xf1cf('0x37')](_0x24c17c);};}exports[_0xf1cf('0x38')]=function(_0x9d8ba7,_0x1477da){var _0x19e520={},_0x189c2f={},_0x5f4f9a={'count':0x0,'rows':[]};var _0x19726e=_['map'](db['DeskConfiguration'][_0xf1cf('0x39')],function(_0x231853){return{'name':_0x231853[_0xf1cf('0x3a')],'type':_0x231853[_0xf1cf('0x3b')][_0xf1cf('0x3c')]};});_0x189c2f['model']=_[_0xf1cf('0x3d')](_0x19726e,'name');_0x189c2f[_0xf1cf('0x3e')]=_['keys'](_0x9d8ba7[_0xf1cf('0x3e')]);_0x189c2f[_0xf1cf('0x3f')]=_[_0xf1cf('0x40')](_0x189c2f['model'],_0x189c2f[_0xf1cf('0x3e')]);_0x19e520[_0xf1cf('0x41')]=_[_0xf1cf('0x40')](_0x189c2f[_0xf1cf('0x42')],qs[_0xf1cf('0x43')](_0x9d8ba7[_0xf1cf('0x3e')][_0xf1cf('0x43')]));_0x19e520['attributes']=_0x19e520['attributes'][_0xf1cf('0x44')]?_0x19e520[_0xf1cf('0x41')]:_0x189c2f['model'];if(!_0x9d8ba7[_0xf1cf('0x3e')][_0xf1cf('0x45')](_0xf1cf('0x46'))){_0x19e520['limit']=qs[_0xf1cf('0x2d')](_0x9d8ba7[_0xf1cf('0x3e')][_0xf1cf('0x2d')]);_0x19e520[_0xf1cf('0x2c')]=qs['offset'](_0x9d8ba7['query'][_0xf1cf('0x2c')]);}_0x19e520[_0xf1cf('0x47')]=qs['sort'](_0x9d8ba7[_0xf1cf('0x3e')][_0xf1cf('0x48')]);_0x19e520[_0xf1cf('0x49')]=qs[_0xf1cf('0x3f')](_['pick'](_0x9d8ba7['query'],_0x189c2f[_0xf1cf('0x3f')]),_0x19726e);if(_0x9d8ba7[_0xf1cf('0x3e')][_0xf1cf('0x4a')]){_0x19e520['where']=_['merge'](_0x19e520[_0xf1cf('0x49')],{'$or':_[_0xf1cf('0x3d')](_0x19726e,function(_0x6b2aa1){if(_0x6b2aa1[_0xf1cf('0x3b')]!==_0xf1cf('0x4b')){var _0x429cf0={};_0x429cf0[_0x6b2aa1[_0xf1cf('0x36')]]={'$like':'%'+_0x9d8ba7['query']['filter']+'%'};return _0x429cf0;}})});}_0x19e520=_[_0xf1cf('0x4c')]({},_0x19e520,_0x9d8ba7[_0xf1cf('0x4d')]);var _0x216641={'where':_0x19e520[_0xf1cf('0x49')]};return db[_0xf1cf('0x4e')]['count'](_0x216641)[_0xf1cf('0x1c')](function(_0x4717df){_0x5f4f9a[_0xf1cf('0x2b')]=_0x4717df;if(_0x9d8ba7['query']['includeAll']){_0x19e520['include']=[{'all':!![]}];}return db[_0xf1cf('0x4e')][_0xf1cf('0x4f')](_0x19e520);})[_0xf1cf('0x1c')](function(_0x123a3b){_0x5f4f9a[_0xf1cf('0x50')]=_0x123a3b;return _0x5f4f9a;})['then'](respondWithFilteredResult(_0x1477da,_0x19e520))['catch'](handleError(_0x1477da,null));};exports[_0xf1cf('0x51')]=function(_0x4d29ed,_0x353b7a){var _0x136e5c={'raw':![],'where':{'id':_0x4d29ed['params']['id']}},_0x20798f={};_0x20798f[_0xf1cf('0x42')]=_[_0xf1cf('0x52')](db[_0xf1cf('0x4e')]['rawAttributes']);_0x20798f[_0xf1cf('0x3e')]=_[_0xf1cf('0x52')](_0x4d29ed[_0xf1cf('0x3e')]);_0x20798f['filters']=_[_0xf1cf('0x40')](_0x20798f[_0xf1cf('0x42')],_0x20798f[_0xf1cf('0x3e')]);_0x136e5c[_0xf1cf('0x41')]=_[_0xf1cf('0x40')](_0x20798f[_0xf1cf('0x42')],qs[_0xf1cf('0x43')](_0x4d29ed['query']['fields']));_0x136e5c['attributes']=_0x136e5c['attributes'][_0xf1cf('0x44')]?_0x136e5c[_0xf1cf('0x41')]:_0x20798f['model'];if(_0x4d29ed[_0xf1cf('0x3e')][_0xf1cf('0x53')]){_0x136e5c[_0xf1cf('0x54')]=[{'all':!![]}];}_0x136e5c=_['merge']({},_0x136e5c,_0x4d29ed[_0xf1cf('0x4d')]);return db[_0xf1cf('0x4e')][_0xf1cf('0x55')](_0x136e5c)[_0xf1cf('0x1c')](handleEntityNotFound(_0x353b7a,null))[_0xf1cf('0x1c')](respondWithResult(_0x353b7a,null))[_0xf1cf('0x27')](handleError(_0x353b7a,null));};exports[_0xf1cf('0x56')]=function(_0x1ca4f7,_0x253085){return db[_0xf1cf('0x4e')][_0xf1cf('0x56')](_0x1ca4f7['body'],{})[_0xf1cf('0x1c')](respondWithResult(_0x253085,0xc9))[_0xf1cf('0x27')](handleError(_0x253085,null));};exports['update']=function(_0x1ec202,_0x35c350){if(_0x1ec202['body']['id']){delete _0x1ec202[_0xf1cf('0x57')]['id'];}return db[_0xf1cf('0x4e')][_0xf1cf('0x55')]({'where':{'id':_0x1ec202[_0xf1cf('0x58')]['id']}})[_0xf1cf('0x1c')](handleEntityNotFound(_0x35c350,null))[_0xf1cf('0x1c')](saveUpdates(_0x1ec202[_0xf1cf('0x57')],null))[_0xf1cf('0x1c')](respondWithResult(_0x35c350,null))['catch'](handleError(_0x35c350,null));};exports[_0xf1cf('0x33')]=function(_0x115481,_0x16a80f){return db[_0xf1cf('0x4e')][_0xf1cf('0x55')]({'where':{'id':_0x115481[_0xf1cf('0x58')]['id']}})['then'](handleEntityNotFound(_0x16a80f,null))['then'](removeEntity(_0x16a80f,null))['catch'](handleError(_0x16a80f,null));};exports[_0xf1cf('0x59')]=function(_0x56568c,_0x21be92,_0x5b5dc6){var _0x3b74aa={};var _0x53204a={};var _0x381be0;var _0x537f35;return db[_0xf1cf('0x4e')]['findOne']({'where':{'id':_0x56568c[_0xf1cf('0x58')]['id']}})[_0xf1cf('0x1c')](handleEntityNotFound(_0x21be92,null))[_0xf1cf('0x1c')](function(_0x2c4405){if(_0x2c4405){_0x381be0=_0x2c4405;_0x53204a[_0xf1cf('0x42')]=_[_0xf1cf('0x52')](db['DeskField']['rawAttributes']);_0x53204a['query']=_[_0xf1cf('0x52')](_0x56568c[_0xf1cf('0x3e')]);_0x53204a[_0xf1cf('0x3f')]=_['intersection'](_0x53204a[_0xf1cf('0x42')],_0x53204a[_0xf1cf('0x3e')]);_0x3b74aa['attributes']=_[_0xf1cf('0x40')](_0x53204a['model'],qs[_0xf1cf('0x43')](_0x56568c[_0xf1cf('0x3e')]['fields']));_0x3b74aa[_0xf1cf('0x41')]=_0x3b74aa[_0xf1cf('0x41')][_0xf1cf('0x44')]?_0x3b74aa[_0xf1cf('0x41')]:_0x53204a[_0xf1cf('0x42')];_0x3b74aa[_0xf1cf('0x47')]=qs[_0xf1cf('0x48')](_0x56568c[_0xf1cf('0x3e')][_0xf1cf('0x48')]);_0x3b74aa['where']=qs['filters'](_[_0xf1cf('0x5a')](_0x56568c[_0xf1cf('0x3e')],_0x53204a['filters']));if(_0x56568c['query'][_0xf1cf('0x4a')]){_0x3b74aa[_0xf1cf('0x49')]=_[_0xf1cf('0x4c')](_0x3b74aa[_0xf1cf('0x49')],{'$or':_['map'](_0x3b74aa[_0xf1cf('0x41')],function(_0x3ea7ae){var _0x4f4be2={};_0x4f4be2[_0x3ea7ae]={'$like':'%'+_0x56568c['query'][_0xf1cf('0x4a')]+'%'};return _0x4f4be2;})});}_0x3b74aa=_[_0xf1cf('0x4c')]({},_0x3b74aa,_0x56568c['options']);return _0x381be0[_0xf1cf('0x59')](_0x3b74aa);}})[_0xf1cf('0x1c')](function(_0xae336b){if(_0xae336b){_0x537f35=_0xae336b[_0xf1cf('0x44')];if(!_0x56568c[_0xf1cf('0x3e')]['hasOwnProperty'](_0xf1cf('0x46'))){_0x3b74aa[_0xf1cf('0x2d')]=qs[_0xf1cf('0x2d')](_0x56568c[_0xf1cf('0x3e')][_0xf1cf('0x2d')]);_0x3b74aa[_0xf1cf('0x2c')]=qs[_0xf1cf('0x2c')](_0x56568c[_0xf1cf('0x3e')][_0xf1cf('0x2c')]);}return _0x381be0[_0xf1cf('0x59')](_0x3b74aa);}})[_0xf1cf('0x1c')](function(_0x1411da){if(_0x1411da){return _0x1411da?{'count':_0x537f35,'rows':_0x1411da}:null;}})[_0xf1cf('0x1c')](respondWithResult(_0x21be92,null))['catch'](handleError(_0x21be92,null));};exports[_0xf1cf('0x5b')]=function(_0x4d8af8,_0x1a7a3b,_0x54f6e7){var _0x28948a={};var _0x168257={};var _0x4d63f7;var _0x3e7433;return db[_0xf1cf('0x4e')]['findOne']({'where':{'id':_0x4d8af8[_0xf1cf('0x58')]['id']}})[_0xf1cf('0x1c')](handleEntityNotFound(_0x1a7a3b,null))['then'](function(_0x4b544f){if(_0x4b544f){_0x4d63f7=_0x4b544f;_0x168257[_0xf1cf('0x42')]=_[_0xf1cf('0x52')](db[_0xf1cf('0x5c')]['rawAttributes']);_0x168257['query']=_[_0xf1cf('0x52')](_0x4d8af8[_0xf1cf('0x3e')]);_0x168257[_0xf1cf('0x3f')]=_['intersection'](_0x168257[_0xf1cf('0x42')],_0x168257[_0xf1cf('0x3e')]);_0x28948a[_0xf1cf('0x41')]=_[_0xf1cf('0x40')](_0x168257[_0xf1cf('0x42')],qs['fields'](_0x4d8af8[_0xf1cf('0x3e')][_0xf1cf('0x43')]));_0x28948a[_0xf1cf('0x41')]=_0x28948a[_0xf1cf('0x41')][_0xf1cf('0x44')]?_0x28948a[_0xf1cf('0x41')]:_0x168257[_0xf1cf('0x42')];_0x28948a['order']=qs[_0xf1cf('0x48')](_0x4d8af8[_0xf1cf('0x3e')][_0xf1cf('0x48')]);_0x28948a[_0xf1cf('0x49')]=qs['filters'](_['pick'](_0x4d8af8['query'],_0x168257[_0xf1cf('0x3f')]));if(_0x4d8af8['query'][_0xf1cf('0x4a')]){_0x28948a[_0xf1cf('0x49')]=_[_0xf1cf('0x4c')](_0x28948a[_0xf1cf('0x49')],{'$or':_[_0xf1cf('0x3d')](_0x28948a['attributes'],function(_0x5dfa4){var _0xa6154b={};_0xa6154b[_0x5dfa4]={'$like':'%'+_0x4d8af8[_0xf1cf('0x3e')][_0xf1cf('0x4a')]+'%'};return _0xa6154b;})});}_0x28948a=_['merge']({},_0x28948a,_0x4d8af8[_0xf1cf('0x4d')]);return _0x4d63f7[_0xf1cf('0x5b')](_0x28948a);}})['then'](function(_0x29887b){if(_0x29887b){_0x3e7433=_0x29887b[_0xf1cf('0x44')];if(!_0x4d8af8[_0xf1cf('0x3e')][_0xf1cf('0x45')](_0xf1cf('0x46'))){_0x28948a[_0xf1cf('0x2d')]=qs[_0xf1cf('0x2d')](_0x4d8af8[_0xf1cf('0x3e')][_0xf1cf('0x2d')]);_0x28948a[_0xf1cf('0x2c')]=qs['offset'](_0x4d8af8['query']['offset']);}return _0x4d63f7[_0xf1cf('0x5b')](_0x28948a);}})['then'](function(_0x46264f){if(_0x46264f){return _0x46264f?{'count':_0x3e7433,'rows':_0x46264f}:null;}})[_0xf1cf('0x1c')](respondWithResult(_0x1a7a3b,null))[_0xf1cf('0x27')](handleError(_0x1a7a3b,null));};exports[_0xf1cf('0x5d')]=function(_0x36e58e,_0x28ed1b,_0x5f270d){var _0x2c9bc6={};var _0x378e7f={};var _0x50274b;var _0x375d25;return db[_0xf1cf('0x4e')][_0xf1cf('0x5e')]({'where':{'id':_0x36e58e[_0xf1cf('0x58')]['id']}})[_0xf1cf('0x1c')](handleEntityNotFound(_0x28ed1b,null))[_0xf1cf('0x1c')](function(_0x14842d){if(_0x14842d){_0x50274b=_0x14842d;_0x378e7f[_0xf1cf('0x42')]=_['keys'](db['DeskField'][_0xf1cf('0x39')]);_0x378e7f['query']=_['keys'](_0x36e58e[_0xf1cf('0x3e')]);_0x378e7f['filters']=_[_0xf1cf('0x40')](_0x378e7f[_0xf1cf('0x42')],_0x378e7f[_0xf1cf('0x3e')]);_0x2c9bc6['attributes']=_[_0xf1cf('0x40')](_0x378e7f[_0xf1cf('0x42')],qs['fields'](_0x36e58e[_0xf1cf('0x3e')][_0xf1cf('0x43')]));_0x2c9bc6['attributes']=_0x2c9bc6['attributes'][_0xf1cf('0x44')]?_0x2c9bc6[_0xf1cf('0x41')]:_0x378e7f['model'];_0x2c9bc6[_0xf1cf('0x47')]=qs[_0xf1cf('0x48')](_0x36e58e[_0xf1cf('0x3e')][_0xf1cf('0x48')]);_0x2c9bc6[_0xf1cf('0x49')]=qs[_0xf1cf('0x3f')](_[_0xf1cf('0x5a')](_0x36e58e[_0xf1cf('0x3e')],_0x378e7f[_0xf1cf('0x3f')]));if(_0x36e58e[_0xf1cf('0x3e')]['filter']){_0x2c9bc6[_0xf1cf('0x49')]=_[_0xf1cf('0x4c')](_0x2c9bc6[_0xf1cf('0x49')],{'$or':_[_0xf1cf('0x3d')](_0x2c9bc6['attributes'],function(_0x366d79){var _0xeb7137={};_0xeb7137[_0x366d79]={'$like':'%'+_0x36e58e[_0xf1cf('0x3e')][_0xf1cf('0x4a')]+'%'};return _0xeb7137;})});}_0x2c9bc6=_[_0xf1cf('0x4c')]({},_0x2c9bc6,_0x36e58e[_0xf1cf('0x4d')]);return _0x50274b['getDescriptions'](_0x2c9bc6);}})[_0xf1cf('0x1c')](function(_0x6a2bc4){if(_0x6a2bc4){_0x375d25=_0x6a2bc4[_0xf1cf('0x44')];if(!_0x36e58e[_0xf1cf('0x3e')]['hasOwnProperty'](_0xf1cf('0x46'))){_0x2c9bc6[_0xf1cf('0x2d')]=qs[_0xf1cf('0x2d')](_0x36e58e[_0xf1cf('0x3e')]['limit']);_0x2c9bc6[_0xf1cf('0x2c')]=qs[_0xf1cf('0x2c')](_0x36e58e[_0xf1cf('0x3e')]['offset']);}return _0x50274b[_0xf1cf('0x5d')](_0x2c9bc6);}})[_0xf1cf('0x1c')](function(_0x47a62a){if(_0x47a62a){return _0x47a62a?{'count':_0x375d25,'rows':_0x47a62a}:null;}})[_0xf1cf('0x1c')](respondWithResult(_0x28ed1b,null))[_0xf1cf('0x27')](handleError(_0x28ed1b,null));};exports[_0xf1cf('0x5f')]=function(_0x4a2e37,_0x21b553,_0x2828be){var _0x42c747={};var _0x3f733e={};var _0x3b67e8;var _0x1d9fe4;return db[_0xf1cf('0x4e')][_0xf1cf('0x5e')]({'where':{'id':_0x4a2e37[_0xf1cf('0x58')]['id']}})[_0xf1cf('0x1c')](handleEntityNotFound(_0x21b553,null))[_0xf1cf('0x1c')](function(_0x469443){if(_0x469443){_0x3b67e8=_0x469443;_0x3f733e[_0xf1cf('0x42')]=_[_0xf1cf('0x52')](db[_0xf1cf('0x60')][_0xf1cf('0x39')]);_0x3f733e['query']=_[_0xf1cf('0x52')](_0x4a2e37[_0xf1cf('0x3e')]);_0x3f733e['filters']=_[_0xf1cf('0x40')](_0x3f733e[_0xf1cf('0x42')],_0x3f733e[_0xf1cf('0x3e')]);_0x42c747[_0xf1cf('0x41')]=_['intersection'](_0x3f733e['model'],qs[_0xf1cf('0x43')](_0x4a2e37[_0xf1cf('0x3e')][_0xf1cf('0x43')]));_0x42c747['attributes']=_0x42c747['attributes'][_0xf1cf('0x44')]?_0x42c747['attributes']:_0x3f733e[_0xf1cf('0x42')];_0x42c747[_0xf1cf('0x47')]=qs[_0xf1cf('0x48')](_0x4a2e37['query'][_0xf1cf('0x48')]);_0x42c747[_0xf1cf('0x49')]=qs['filters'](_[_0xf1cf('0x5a')](_0x4a2e37[_0xf1cf('0x3e')],_0x3f733e[_0xf1cf('0x3f')]));if(_0x4a2e37['query'][_0xf1cf('0x4a')]){_0x42c747['where']=_[_0xf1cf('0x4c')](_0x42c747[_0xf1cf('0x49')],{'$or':_['map'](_0x42c747[_0xf1cf('0x41')],function(_0x27c266){var _0x5304a3={};_0x5304a3[_0x27c266]={'$like':'%'+_0x4a2e37[_0xf1cf('0x3e')][_0xf1cf('0x4a')]+'%'};return _0x5304a3;})});}_0x42c747=_[_0xf1cf('0x4c')]({},_0x42c747,_0x4a2e37[_0xf1cf('0x4d')]);return _0x3b67e8[_0xf1cf('0x5f')](_0x42c747);}})['then'](function(_0x3af0ec){if(_0x3af0ec){_0x1d9fe4=_0x3af0ec[_0xf1cf('0x44')];if(!_0x4a2e37[_0xf1cf('0x3e')][_0xf1cf('0x45')](_0xf1cf('0x46'))){_0x42c747[_0xf1cf('0x2d')]=qs[_0xf1cf('0x2d')](_0x4a2e37[_0xf1cf('0x3e')][_0xf1cf('0x2d')]);_0x42c747[_0xf1cf('0x2c')]=qs[_0xf1cf('0x2c')](_0x4a2e37[_0xf1cf('0x3e')]['offset']);}return _0x3b67e8[_0xf1cf('0x5f')](_0x42c747);}})[_0xf1cf('0x1c')](function(_0x272f77){if(_0x272f77){return _0x272f77?{'count':_0x1d9fe4,'rows':_0x272f77}:null;}})[_0xf1cf('0x1c')](respondWithResult(_0x21b553,null))[_0xf1cf('0x27')](handleError(_0x21b553,null));};exports[_0xf1cf('0x61')]=function(_0x49bf56,_0xb312d0,_0x1409de){if(_0x49bf56[_0xf1cf('0x57')]['id']){delete _0x49bf56[_0xf1cf('0x57')]['id'];}return db[_0xf1cf('0x4e')][_0xf1cf('0x5e')]({'where':{'id':_0x49bf56[_0xf1cf('0x58')]['id']}})[_0xf1cf('0x1c')](handleEntityNotFound(_0xb312d0,null))['then'](function(_0x271679){if(_0x271679){return _0x271679['setTags'](_0x49bf56[_0xf1cf('0x57')]['ids']||[]);}return null;})['then'](respondWithResult(_0xb312d0,null))['catch'](handleError(_0xb312d0,null));}; \ No newline at end of file +var _0xd8f3=['then','destroy','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','filter','merge','options','DeskConfiguration','includeAll','params','keys','include','find','create','body','DeskField','length','order','getFields','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update'];(function(_0x1cb0b4,_0x1fd48d){var _0x525b60=function(_0x1efccc){while(--_0x1efccc){_0x1cb0b4['push'](_0x1cb0b4['shift']());}};_0x525b60(++_0x1fd48d);}(_0xd8f3,0x88));var _0x3d8f=function(_0x1ca22e,_0x561ca6){_0x1ca22e=_0x1ca22e-0x0;var _0x5c53b3=_0xd8f3[_0x1ca22e];return _0x5c53b3;};'use strict';var pdf=require(_0x3d8f('0x0'));var emlformat=require(_0x3d8f('0x1'));var rimraf=require(_0x3d8f('0x2'));var zipdir=require(_0x3d8f('0x3'));var jsonpatch=require(_0x3d8f('0x4'));var rp=require(_0x3d8f('0x5'));var moment=require(_0x3d8f('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x3d8f('0x7'));var util=require('util');var path=require(_0x3d8f('0x8'));var sox=require('sox');var csv=require(_0x3d8f('0x9'));var ejs=require(_0x3d8f('0xa'));var fs=require('fs');var fs_extra=require(_0x3d8f('0xb'));var _=require(_0x3d8f('0xc'));var squel=require(_0x3d8f('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3d8f('0x9'));var querystring=require(_0x3d8f('0xe'));var Papa=require('papaparse');var Redis=require(_0x3d8f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3d8f('0x10'));var as=require(_0x3d8f('0x11'));var hardwareService=require(_0x3d8f('0x12'));var logger=require(_0x3d8f('0x13'))(_0x3d8f('0x14'));var utils=require(_0x3d8f('0x15'));var config=require(_0x3d8f('0x16'));var licenseUtil=require(_0x3d8f('0x17'));var db=require(_0x3d8f('0x18'))['db'];var jayson=require(_0x3d8f('0x19'));var client=jayson['client'][_0x3d8f('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x41d263,_0x4f776c,_0x1afd1c,_0x12a181){return new BPromise(function(_0x4f1ede,_0x223e55){var _0x2d27c0=_0x12a181||client;return _0x2d27c0[_0x3d8f('0x1b')](_0x41d263,_0x1afd1c)['then'](function(_0x515f80){logger[_0x3d8f('0x1c')](_0x3d8f('0x1d'),_0x4f776c,_0x3d8f('0x1e'));logger[_0x3d8f('0x1f')](_0x3d8f('0x20'),_0x4f776c,'request\x20sent',JSON[_0x3d8f('0x21')](_0x515f80));if(_0x515f80[_0x3d8f('0x22')]){if(_0x515f80[_0x3d8f('0x22')][_0x3d8f('0x23')]===0x1f4){logger[_0x3d8f('0x22')](_0x3d8f('0x1d'),_0x4f776c,_0x515f80[_0x3d8f('0x22')][_0x3d8f('0x24')]);return _0x223e55(_0x515f80[_0x3d8f('0x22')][_0x3d8f('0x24')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x4f776c,_0x515f80[_0x3d8f('0x22')][_0x3d8f('0x24')]);return _0x4f1ede(_0x515f80[_0x3d8f('0x22')]['message']);}else{logger[_0x3d8f('0x1c')](_0x3d8f('0x1d'),_0x4f776c,_0x3d8f('0x1e'));_0x4f1ede(_0x515f80[_0x3d8f('0x25')]['message']);}})[_0x3d8f('0x26')](function(_0x41d388){logger[_0x3d8f('0x22')](_0x3d8f('0x1d'),_0x4f776c,_0x41d388);_0x223e55(_0x41d388);});});}function respondWithStatusCode(_0x2b6491,_0x8b06f6){_0x8b06f6=_0x8b06f6||0xcc;return function(_0x14aac6){if(_0x14aac6){return _0x2b6491[_0x3d8f('0x27')](_0x8b06f6);}return _0x2b6491[_0x3d8f('0x28')](_0x8b06f6)[_0x3d8f('0x29')]();};}function respondWithResult(_0x36f9db,_0x1dca31){_0x1dca31=_0x1dca31||0xc8;return function(_0x2d562e){if(_0x2d562e){return _0x36f9db['status'](_0x1dca31)['json'](_0x2d562e);}};}function respondWithFilteredResult(_0x283d4f,_0x72cbab){return function(_0x496fc5){if(_0x496fc5){var _0x246d8d=_0x496fc5[_0x3d8f('0x2a')],_0x3b1d3d=_0x72cbab[_0x3d8f('0x2b')],_0x2a07ca=_0x72cbab[_0x3d8f('0x2b')]+_0x72cbab[_0x3d8f('0x2c')],_0x5b32c7;if(_0x2a07ca>=_0x246d8d){_0x2a07ca=_0x246d8d;_0x5b32c7=0xc8;}else{_0x5b32c7=0xce;}_0x283d4f[_0x3d8f('0x28')](_0x5b32c7);return _0x283d4f[_0x3d8f('0x2d')](_0x3d8f('0x2e'),_0x3b1d3d+'-'+_0x2a07ca+'/'+_0x246d8d)[_0x3d8f('0x2f')](_0x496fc5);}return null;};}function patchUpdates(_0x1b6267){return function(_0x3c1d1c){try{jsonpatch[_0x3d8f('0x30')](_0x3c1d1c,_0x1b6267,!![]);}catch(_0x7e7ce6){return BPromise[_0x3d8f('0x31')](_0x7e7ce6);}return _0x3c1d1c[_0x3d8f('0x32')]();};}function saveUpdates(_0x33385d,_0x1a95f4){return function(_0x5e61ed){if(_0x5e61ed){return _0x5e61ed[_0x3d8f('0x33')](_0x33385d)[_0x3d8f('0x34')](function(_0x448649){return _0x448649;});}return null;};}function removeEntity(_0x572224,_0x489d2d){return function(_0x99a7f3){if(_0x99a7f3){return _0x99a7f3[_0x3d8f('0x35')]()[_0x3d8f('0x34')](function(){_0x572224[_0x3d8f('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e5782,_0x4af51d){return function(_0x261896){if(!_0x261896){_0x4e5782[_0x3d8f('0x27')](0x194);}return _0x261896;};}function handleError(_0x3ab812,_0x1d32d4){_0x1d32d4=_0x1d32d4||0x1f4;return function(_0x3c6767){logger[_0x3d8f('0x22')](_0x3c6767['stack']);if(_0x3c6767[_0x3d8f('0x36')]){delete _0x3c6767[_0x3d8f('0x36')];}_0x3ab812['status'](_0x1d32d4)[_0x3d8f('0x37')](_0x3c6767);};}exports[_0x3d8f('0x38')]=function(_0x434323,_0x1763ea){var _0x2d180f={},_0x3ede87={},_0x36027e={'count':0x0,'rows':[]};var _0x243728=_[_0x3d8f('0x39')](db['DeskConfiguration'][_0x3d8f('0x3a')],function(_0x412545){return{'name':_0x412545[_0x3d8f('0x3b')],'type':_0x412545[_0x3d8f('0x3c')]['key']};});_0x3ede87[_0x3d8f('0x3d')]=_[_0x3d8f('0x39')](_0x243728,_0x3d8f('0x36'));_0x3ede87[_0x3d8f('0x3e')]=_['keys'](_0x434323[_0x3d8f('0x3e')]);_0x3ede87[_0x3d8f('0x3f')]=_[_0x3d8f('0x40')](_0x3ede87['model'],_0x3ede87[_0x3d8f('0x3e')]);_0x2d180f[_0x3d8f('0x41')]=_['intersection'](_0x3ede87['model'],qs[_0x3d8f('0x42')](_0x434323[_0x3d8f('0x3e')][_0x3d8f('0x42')]));_0x2d180f[_0x3d8f('0x41')]=_0x2d180f[_0x3d8f('0x41')]['length']?_0x2d180f[_0x3d8f('0x41')]:_0x3ede87[_0x3d8f('0x3d')];if(!_0x434323[_0x3d8f('0x3e')][_0x3d8f('0x43')](_0x3d8f('0x44'))){_0x2d180f[_0x3d8f('0x2c')]=qs[_0x3d8f('0x2c')](_0x434323[_0x3d8f('0x3e')]['limit']);_0x2d180f[_0x3d8f('0x2b')]=qs[_0x3d8f('0x2b')](_0x434323[_0x3d8f('0x3e')][_0x3d8f('0x2b')]);}_0x2d180f['order']=qs[_0x3d8f('0x45')](_0x434323[_0x3d8f('0x3e')]['sort']);_0x2d180f['where']=qs[_0x3d8f('0x3f')](_[_0x3d8f('0x46')](_0x434323[_0x3d8f('0x3e')],_0x3ede87[_0x3d8f('0x3f')]),_0x243728);if(_0x434323[_0x3d8f('0x3e')]['filter']){_0x2d180f[_0x3d8f('0x47')]=_['merge'](_0x2d180f[_0x3d8f('0x47')],{'$or':_[_0x3d8f('0x39')](_0x243728,function(_0x55a41e){if(_0x55a41e[_0x3d8f('0x3c')]!==_0x3d8f('0x48')){var _0x4f733e={};_0x4f733e[_0x55a41e[_0x3d8f('0x36')]]={'$like':'%'+_0x434323[_0x3d8f('0x3e')][_0x3d8f('0x49')]+'%'};return _0x4f733e;}})});}_0x2d180f=_[_0x3d8f('0x4a')]({},_0x2d180f,_0x434323[_0x3d8f('0x4b')]);var _0x1309b6={'where':_0x2d180f[_0x3d8f('0x47')]};return db[_0x3d8f('0x4c')][_0x3d8f('0x2a')](_0x1309b6)['then'](function(_0x19d35d){_0x36027e[_0x3d8f('0x2a')]=_0x19d35d;if(_0x434323[_0x3d8f('0x3e')][_0x3d8f('0x4d')]){_0x2d180f['include']=[{'all':!![]}];}return db[_0x3d8f('0x4c')]['findAll'](_0x2d180f);})[_0x3d8f('0x34')](function(_0x4cade6){_0x36027e['rows']=_0x4cade6;return _0x36027e;})['then'](respondWithFilteredResult(_0x1763ea,_0x2d180f))[_0x3d8f('0x26')](handleError(_0x1763ea,null));};exports['show']=function(_0x137039,_0x54533b){var _0x2471b1={'raw':![],'where':{'id':_0x137039[_0x3d8f('0x4e')]['id']}},_0x316b42={};_0x316b42[_0x3d8f('0x3d')]=_[_0x3d8f('0x4f')](db[_0x3d8f('0x4c')][_0x3d8f('0x3a')]);_0x316b42[_0x3d8f('0x3e')]=_[_0x3d8f('0x4f')](_0x137039[_0x3d8f('0x3e')]);_0x316b42['filters']=_[_0x3d8f('0x40')](_0x316b42[_0x3d8f('0x3d')],_0x316b42['query']);_0x2471b1[_0x3d8f('0x41')]=_[_0x3d8f('0x40')](_0x316b42[_0x3d8f('0x3d')],qs[_0x3d8f('0x42')](_0x137039[_0x3d8f('0x3e')][_0x3d8f('0x42')]));_0x2471b1['attributes']=_0x2471b1['attributes']['length']?_0x2471b1[_0x3d8f('0x41')]:_0x316b42[_0x3d8f('0x3d')];if(_0x137039[_0x3d8f('0x3e')]['includeAll']){_0x2471b1[_0x3d8f('0x50')]=[{'all':!![]}];}_0x2471b1=_['merge']({},_0x2471b1,_0x137039['options']);return db[_0x3d8f('0x4c')][_0x3d8f('0x51')](_0x2471b1)['then'](handleEntityNotFound(_0x54533b,null))[_0x3d8f('0x34')](respondWithResult(_0x54533b,null))[_0x3d8f('0x26')](handleError(_0x54533b,null));};exports['create']=function(_0xc76e3,_0x610046){return db['DeskConfiguration'][_0x3d8f('0x52')](_0xc76e3['body'],{})[_0x3d8f('0x34')](respondWithResult(_0x610046,0xc9))[_0x3d8f('0x26')](handleError(_0x610046,null));};exports[_0x3d8f('0x33')]=function(_0x52d1ae,_0x3dd4cc){if(_0x52d1ae[_0x3d8f('0x53')]['id']){delete _0x52d1ae[_0x3d8f('0x53')]['id'];}return db['DeskConfiguration'][_0x3d8f('0x51')]({'where':{'id':_0x52d1ae['params']['id']}})['then'](handleEntityNotFound(_0x3dd4cc,null))['then'](saveUpdates(_0x52d1ae['body'],null))[_0x3d8f('0x34')](respondWithResult(_0x3dd4cc,null))[_0x3d8f('0x26')](handleError(_0x3dd4cc,null));};exports[_0x3d8f('0x35')]=function(_0x28018c,_0x1adb6d){return db[_0x3d8f('0x4c')][_0x3d8f('0x51')]({'where':{'id':_0x28018c[_0x3d8f('0x4e')]['id']}})[_0x3d8f('0x34')](handleEntityNotFound(_0x1adb6d,null))['then'](removeEntity(_0x1adb6d,null))[_0x3d8f('0x26')](handleError(_0x1adb6d,null));};exports['getFields']=function(_0x1f9551,_0x57ef45,_0x238375){var _0x541b8d={};var _0x58eeb2={};var _0xcaf922;var _0x5578d4;return db['DeskConfiguration']['findOne']({'where':{'id':_0x1f9551[_0x3d8f('0x4e')]['id']}})[_0x3d8f('0x34')](handleEntityNotFound(_0x57ef45,null))[_0x3d8f('0x34')](function(_0x14380e){if(_0x14380e){_0xcaf922=_0x14380e;_0x58eeb2[_0x3d8f('0x3d')]=_[_0x3d8f('0x4f')](db[_0x3d8f('0x54')]['rawAttributes']);_0x58eeb2['query']=_[_0x3d8f('0x4f')](_0x1f9551[_0x3d8f('0x3e')]);_0x58eeb2['filters']=_[_0x3d8f('0x40')](_0x58eeb2[_0x3d8f('0x3d')],_0x58eeb2[_0x3d8f('0x3e')]);_0x541b8d['attributes']=_[_0x3d8f('0x40')](_0x58eeb2[_0x3d8f('0x3d')],qs[_0x3d8f('0x42')](_0x1f9551[_0x3d8f('0x3e')][_0x3d8f('0x42')]));_0x541b8d['attributes']=_0x541b8d[_0x3d8f('0x41')][_0x3d8f('0x55')]?_0x541b8d[_0x3d8f('0x41')]:_0x58eeb2[_0x3d8f('0x3d')];_0x541b8d[_0x3d8f('0x56')]=qs[_0x3d8f('0x45')](_0x1f9551[_0x3d8f('0x3e')]['sort']);_0x541b8d[_0x3d8f('0x47')]=qs[_0x3d8f('0x3f')](_[_0x3d8f('0x46')](_0x1f9551[_0x3d8f('0x3e')],_0x58eeb2[_0x3d8f('0x3f')]));if(_0x1f9551[_0x3d8f('0x3e')]['filter']){_0x541b8d[_0x3d8f('0x47')]=_[_0x3d8f('0x4a')](_0x541b8d[_0x3d8f('0x47')],{'$or':_['map'](_0x541b8d[_0x3d8f('0x41')],function(_0x1af0cd){var _0x55c12a={};_0x55c12a[_0x1af0cd]={'$like':'%'+_0x1f9551['query'][_0x3d8f('0x49')]+'%'};return _0x55c12a;})});}_0x541b8d=_[_0x3d8f('0x4a')]({},_0x541b8d,_0x1f9551['options']);return _0xcaf922[_0x3d8f('0x57')](_0x541b8d);}})['then'](function(_0x494e05){if(_0x494e05){_0x5578d4=_0x494e05[_0x3d8f('0x55')];if(!_0x1f9551['query'][_0x3d8f('0x43')](_0x3d8f('0x44'))){_0x541b8d[_0x3d8f('0x2c')]=qs[_0x3d8f('0x2c')](_0x1f9551[_0x3d8f('0x3e')][_0x3d8f('0x2c')]);_0x541b8d[_0x3d8f('0x2b')]=qs['offset'](_0x1f9551[_0x3d8f('0x3e')][_0x3d8f('0x2b')]);}return _0xcaf922[_0x3d8f('0x57')](_0x541b8d);}})[_0x3d8f('0x34')](function(_0x343e00){if(_0x343e00){return _0x343e00?{'count':_0x5578d4,'rows':_0x343e00}:null;}})[_0x3d8f('0x34')](respondWithResult(_0x57ef45,null))[_0x3d8f('0x26')](handleError(_0x57ef45,null));};exports[_0x3d8f('0x58')]=function(_0xf684e5,_0x179fcb,_0x259d17){var _0x56c731={};var _0x7a327b={};var _0x20b88;var _0xe41444;return db[_0x3d8f('0x4c')][_0x3d8f('0x59')]({'where':{'id':_0xf684e5[_0x3d8f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x179fcb,null))[_0x3d8f('0x34')](function(_0x82b11){if(_0x82b11){_0x20b88=_0x82b11;_0x7a327b[_0x3d8f('0x3d')]=_[_0x3d8f('0x4f')](db[_0x3d8f('0x54')][_0x3d8f('0x3a')]);_0x7a327b[_0x3d8f('0x3e')]=_['keys'](_0xf684e5[_0x3d8f('0x3e')]);_0x7a327b[_0x3d8f('0x3f')]=_[_0x3d8f('0x40')](_0x7a327b['model'],_0x7a327b[_0x3d8f('0x3e')]);_0x56c731[_0x3d8f('0x41')]=_['intersection'](_0x7a327b[_0x3d8f('0x3d')],qs[_0x3d8f('0x42')](_0xf684e5[_0x3d8f('0x3e')][_0x3d8f('0x42')]));_0x56c731[_0x3d8f('0x41')]=_0x56c731['attributes'][_0x3d8f('0x55')]?_0x56c731[_0x3d8f('0x41')]:_0x7a327b[_0x3d8f('0x3d')];_0x56c731[_0x3d8f('0x56')]=qs[_0x3d8f('0x45')](_0xf684e5['query'][_0x3d8f('0x45')]);_0x56c731[_0x3d8f('0x47')]=qs[_0x3d8f('0x3f')](_[_0x3d8f('0x46')](_0xf684e5[_0x3d8f('0x3e')],_0x7a327b[_0x3d8f('0x3f')]));if(_0xf684e5[_0x3d8f('0x3e')][_0x3d8f('0x49')]){_0x56c731[_0x3d8f('0x47')]=_[_0x3d8f('0x4a')](_0x56c731[_0x3d8f('0x47')],{'$or':_['map'](_0x56c731['attributes'],function(_0x586ebe){var _0x2df1e7={};_0x2df1e7[_0x586ebe]={'$like':'%'+_0xf684e5[_0x3d8f('0x3e')][_0x3d8f('0x49')]+'%'};return _0x2df1e7;})});}_0x56c731=_[_0x3d8f('0x4a')]({},_0x56c731,_0xf684e5[_0x3d8f('0x4b')]);return _0x20b88[_0x3d8f('0x58')](_0x56c731);}})[_0x3d8f('0x34')](function(_0x385e77){if(_0x385e77){_0xe41444=_0x385e77[_0x3d8f('0x55')];if(!_0xf684e5[_0x3d8f('0x3e')][_0x3d8f('0x43')](_0x3d8f('0x44'))){_0x56c731['limit']=qs[_0x3d8f('0x2c')](_0xf684e5[_0x3d8f('0x3e')]['limit']);_0x56c731[_0x3d8f('0x2b')]=qs[_0x3d8f('0x2b')](_0xf684e5['query'][_0x3d8f('0x2b')]);}return _0x20b88['getSubjects'](_0x56c731);}})[_0x3d8f('0x34')](function(_0xbb46){if(_0xbb46){return _0xbb46?{'count':_0xe41444,'rows':_0xbb46}:null;}})['then'](respondWithResult(_0x179fcb,null))[_0x3d8f('0x26')](handleError(_0x179fcb,null));};exports['getDescriptions']=function(_0x3e53f4,_0x1c3b3f,_0x323aa4){var _0x6fc693={};var _0x55d1dd={};var _0x7ab573;var _0x409648;return db['DeskConfiguration'][_0x3d8f('0x59')]({'where':{'id':_0x3e53f4['params']['id']}})[_0x3d8f('0x34')](handleEntityNotFound(_0x1c3b3f,null))[_0x3d8f('0x34')](function(_0x480ae2){if(_0x480ae2){_0x7ab573=_0x480ae2;_0x55d1dd[_0x3d8f('0x3d')]=_[_0x3d8f('0x4f')](db[_0x3d8f('0x54')][_0x3d8f('0x3a')]);_0x55d1dd['query']=_[_0x3d8f('0x4f')](_0x3e53f4[_0x3d8f('0x3e')]);_0x55d1dd[_0x3d8f('0x3f')]=_[_0x3d8f('0x40')](_0x55d1dd[_0x3d8f('0x3d')],_0x55d1dd[_0x3d8f('0x3e')]);_0x6fc693[_0x3d8f('0x41')]=_[_0x3d8f('0x40')](_0x55d1dd[_0x3d8f('0x3d')],qs[_0x3d8f('0x42')](_0x3e53f4[_0x3d8f('0x3e')]['fields']));_0x6fc693[_0x3d8f('0x41')]=_0x6fc693['attributes'][_0x3d8f('0x55')]?_0x6fc693[_0x3d8f('0x41')]:_0x55d1dd[_0x3d8f('0x3d')];_0x6fc693['order']=qs[_0x3d8f('0x45')](_0x3e53f4['query']['sort']);_0x6fc693[_0x3d8f('0x47')]=qs['filters'](_[_0x3d8f('0x46')](_0x3e53f4[_0x3d8f('0x3e')],_0x55d1dd[_0x3d8f('0x3f')]));if(_0x3e53f4[_0x3d8f('0x3e')][_0x3d8f('0x49')]){_0x6fc693['where']=_[_0x3d8f('0x4a')](_0x6fc693[_0x3d8f('0x47')],{'$or':_[_0x3d8f('0x39')](_0x6fc693[_0x3d8f('0x41')],function(_0x51450e){var _0x4422ed={};_0x4422ed[_0x51450e]={'$like':'%'+_0x3e53f4[_0x3d8f('0x3e')][_0x3d8f('0x49')]+'%'};return _0x4422ed;})});}_0x6fc693=_['merge']({},_0x6fc693,_0x3e53f4[_0x3d8f('0x4b')]);return _0x7ab573[_0x3d8f('0x5a')](_0x6fc693);}})[_0x3d8f('0x34')](function(_0x3e7817){if(_0x3e7817){_0x409648=_0x3e7817[_0x3d8f('0x55')];if(!_0x3e53f4[_0x3d8f('0x3e')][_0x3d8f('0x43')](_0x3d8f('0x44'))){_0x6fc693[_0x3d8f('0x2c')]=qs[_0x3d8f('0x2c')](_0x3e53f4[_0x3d8f('0x3e')][_0x3d8f('0x2c')]);_0x6fc693[_0x3d8f('0x2b')]=qs[_0x3d8f('0x2b')](_0x3e53f4[_0x3d8f('0x3e')][_0x3d8f('0x2b')]);}return _0x7ab573[_0x3d8f('0x5a')](_0x6fc693);}})['then'](function(_0x4967d6){if(_0x4967d6){return _0x4967d6?{'count':_0x409648,'rows':_0x4967d6}:null;}})[_0x3d8f('0x34')](respondWithResult(_0x1c3b3f,null))[_0x3d8f('0x26')](handleError(_0x1c3b3f,null));};exports[_0x3d8f('0x5b')]=function(_0x136a96,_0x470151,_0x1ca606){var _0x44c5b4={};var _0x2e45fe={};var _0x14d65d;var _0x250dd8;return db[_0x3d8f('0x4c')][_0x3d8f('0x59')]({'where':{'id':_0x136a96['params']['id']}})[_0x3d8f('0x34')](handleEntityNotFound(_0x470151,null))[_0x3d8f('0x34')](function(_0x2b81df){if(_0x2b81df){_0x14d65d=_0x2b81df;_0x2e45fe[_0x3d8f('0x3d')]=_['keys'](db[_0x3d8f('0x5c')][_0x3d8f('0x3a')]);_0x2e45fe['query']=_[_0x3d8f('0x4f')](_0x136a96['query']);_0x2e45fe[_0x3d8f('0x3f')]=_['intersection'](_0x2e45fe[_0x3d8f('0x3d')],_0x2e45fe[_0x3d8f('0x3e')]);_0x44c5b4['attributes']=_[_0x3d8f('0x40')](_0x2e45fe[_0x3d8f('0x3d')],qs[_0x3d8f('0x42')](_0x136a96[_0x3d8f('0x3e')]['fields']));_0x44c5b4[_0x3d8f('0x41')]=_0x44c5b4['attributes'][_0x3d8f('0x55')]?_0x44c5b4[_0x3d8f('0x41')]:_0x2e45fe[_0x3d8f('0x3d')];_0x44c5b4['order']=qs[_0x3d8f('0x45')](_0x136a96[_0x3d8f('0x3e')][_0x3d8f('0x45')]);_0x44c5b4[_0x3d8f('0x47')]=qs[_0x3d8f('0x3f')](_[_0x3d8f('0x46')](_0x136a96[_0x3d8f('0x3e')],_0x2e45fe[_0x3d8f('0x3f')]));if(_0x136a96[_0x3d8f('0x3e')]['filter']){_0x44c5b4['where']=_[_0x3d8f('0x4a')](_0x44c5b4[_0x3d8f('0x47')],{'$or':_[_0x3d8f('0x39')](_0x44c5b4[_0x3d8f('0x41')],function(_0x2e637f){var _0xc49693={};_0xc49693[_0x2e637f]={'$like':'%'+_0x136a96['query'][_0x3d8f('0x49')]+'%'};return _0xc49693;})});}_0x44c5b4=_['merge']({},_0x44c5b4,_0x136a96[_0x3d8f('0x4b')]);return _0x14d65d['getTags'](_0x44c5b4);}})[_0x3d8f('0x34')](function(_0x55c134){if(_0x55c134){_0x250dd8=_0x55c134[_0x3d8f('0x55')];if(!_0x136a96['query']['hasOwnProperty'](_0x3d8f('0x44'))){_0x44c5b4[_0x3d8f('0x2c')]=qs[_0x3d8f('0x2c')](_0x136a96[_0x3d8f('0x3e')][_0x3d8f('0x2c')]);_0x44c5b4[_0x3d8f('0x2b')]=qs['offset'](_0x136a96[_0x3d8f('0x3e')][_0x3d8f('0x2b')]);}return _0x14d65d[_0x3d8f('0x5b')](_0x44c5b4);}})[_0x3d8f('0x34')](function(_0x5c3890){if(_0x5c3890){return _0x5c3890?{'count':_0x250dd8,'rows':_0x5c3890}:null;}})['then'](respondWithResult(_0x470151,null))[_0x3d8f('0x26')](handleError(_0x470151,null));};exports[_0x3d8f('0x5d')]=function(_0x4553fa,_0xf83d14,_0x4c8ee6){if(_0x4553fa['body']['id']){delete _0x4553fa[_0x3d8f('0x53')]['id'];}return db[_0x3d8f('0x4c')][_0x3d8f('0x59')]({'where':{'id':_0x4553fa[_0x3d8f('0x4e')]['id']}})[_0x3d8f('0x34')](handleEntityNotFound(_0xf83d14,null))[_0x3d8f('0x34')](function(_0x33da2d){if(_0x33da2d){return _0x33da2d[_0x3d8f('0x5d')](_0x4553fa[_0x3d8f('0x53')]['ids']||[]);}return null;})['then'](respondWithResult(_0xf83d14,null))['catch'](handleError(_0xf83d14,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 011388c..83475c7 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 _0xa3b4=['exports','define','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x12dfda,_0x3db00e){var _0x45882b=function(_0x265152){while(--_0x265152){_0x12dfda['push'](_0x12dfda['shift']());}};_0x45882b(++_0x3db00e);}(_0xa3b4,0x1cd));var _0x4a3b=function(_0x45d3cb,_0x292b90){_0x45d3cb=_0x45d3cb-0x0;var _0x25bc5b=_0xa3b4[_0x45d3cb];return _0x25bc5b;};'use strict';var _=require(_0x4a3b('0x0'));var util=require(_0x4a3b('0x1'));var logger=require('../../config/logger')(_0x4a3b('0x2'));var moment=require('moment');var BPromise=require(_0x4a3b('0x3'));var rp=require(_0x4a3b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4a3b('0x5'));var config=require(_0x4a3b('0x6'));var attributes=require('./intDeskConfiguration.attributes');module[_0x4a3b('0x7')]=function(_0xa64db,_0x10ad5b){return _0xa64db[_0x4a3b('0x8')]('DeskConfiguration',attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb26=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','lodash','util','../../config/logger'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xbb26,0x1e1));var _0x6bb2=function(_0x399436,_0x526646){_0x399436=_0x399436-0x0;var _0x3ce959=_0xbb26[_0x399436];return _0x3ce959;};'use strict';var _=require(_0x6bb2('0x0'));var util=require(_0x6bb2('0x1'));var logger=require(_0x6bb2('0x2'))(_0x6bb2('0x3'));var moment=require(_0x6bb2('0x4'));var BPromise=require(_0x6bb2('0x5'));var rp=require(_0x6bb2('0x6'));var fs=require('fs');var path=require(_0x6bb2('0x7'));var rimraf=require('rimraf');var config=require(_0x6bb2('0x8'));var attributes=require('./intDeskConfiguration.attributes');module[_0x6bb2('0x9')]=function(_0xb43603,_0x2c319d){return _0xb43603[_0x6bb2('0xa')]('DeskConfiguration',attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index dc093f9..7fef495 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 _0x7229=['../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x43b584,_0x20a6bd){var _0x48f27b=function(_0x1eeb77){while(--_0x1eeb77){_0x43b584['push'](_0x43b584['shift']());}};_0x48f27b(++_0x20a6bd);}(_0x7229,0x76));var _0x9722=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x7229[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x9722('0x0'));var util=require(_0x9722('0x1'));var moment=require(_0x9722('0x2'));var BPromise=require(_0x9722('0x3'));var rs=require(_0x9722('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9722('0x5'));var logger=require(_0x9722('0x6'))(_0x9722('0x7'));var config=require(_0x9722('0x8'));var jayson=require(_0x9722('0x9'));var client=jayson[_0x9722('0xa')][_0x9722('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x541b0c,_0x161765,_0x5a5bd1){return new BPromise(function(_0x237c3e,_0x2c65f5){return client[_0x9722('0xc')](_0x541b0c,_0x5a5bd1)[_0x9722('0xd')](function(_0x13b156){logger[_0x9722('0xe')](_0x9722('0xf'),_0x161765,_0x9722('0x10'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x161765,_0x9722('0x10'),JSON[_0x9722('0x11')](_0x13b156));if(_0x13b156[_0x9722('0x12')]){if(_0x13b156[_0x9722('0x12')]['code']===0x1f4){logger[_0x9722('0x12')](_0x9722('0xf'),_0x161765,_0x13b156[_0x9722('0x12')][_0x9722('0x13')]);return _0x2c65f5(_0x13b156['error'][_0x9722('0x13')]);}logger[_0x9722('0x12')](_0x9722('0xf'),_0x161765,_0x13b156[_0x9722('0x12')][_0x9722('0x13')]);return _0x237c3e(_0x13b156['error'][_0x9722('0x13')]);}else{logger[_0x9722('0xe')](_0x9722('0xf'),_0x161765,'request\x20sent');_0x237c3e(_0x13b156[_0x9722('0x14')][_0x9722('0x13')]);}})['catch'](function(_0x20ec6f){logger[_0x9722('0x12')](_0x9722('0xf'),_0x161765,_0x20ec6f);_0x2c65f5(_0x20ec6f);});});} \ No newline at end of file +var _0xf089=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','DeskConfiguration,\x20%s,\x20%s','message','util','moment','randomstring','ioredis'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0xf089,0xba));var _0x9f08=function(_0x4fb283,_0x15dbfb){_0x4fb283=_0x4fb283-0x0;var _0x2e4b47=_0xf089[_0x4fb283];return _0x2e4b47;};'use strict';var _=require('lodash');var util=require(_0x9f08('0x0'));var moment=require(_0x9f08('0x1'));var BPromise=require('bluebird');var rs=require(_0x9f08('0x2'));var fs=require('fs');var Redis=require(_0x9f08('0x3'));var db=require(_0x9f08('0x4'))['db'];var utils=require(_0x9f08('0x5'));var logger=require('../../config/logger')(_0x9f08('0x6'));var config=require(_0x9f08('0x7'));var jayson=require(_0x9f08('0x8'));var client=jayson[_0x9f08('0x9')][_0x9f08('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39abe2,_0x5341c9,_0x9cfade){return new BPromise(function(_0x4b37fc,_0x39e238){return client['request'](_0x39abe2,_0x9cfade)[_0x9f08('0xb')](function(_0x286809){logger[_0x9f08('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x5341c9,_0x9f08('0xd'));logger[_0x9f08('0xe')](_0x9f08('0xf'),_0x5341c9,'request\x20sent',JSON['stringify'](_0x286809));if(_0x286809[_0x9f08('0x10')]){if(_0x286809[_0x9f08('0x10')]['code']===0x1f4){logger[_0x9f08('0x10')](_0x9f08('0x11'),_0x5341c9,_0x286809[_0x9f08('0x10')]['message']);return _0x39e238(_0x286809['error'][_0x9f08('0x12')]);}logger[_0x9f08('0x10')](_0x9f08('0x11'),_0x5341c9,_0x286809[_0x9f08('0x10')]['message']);return _0x4b37fc(_0x286809[_0x9f08('0x10')][_0x9f08('0x12')]);}else{logger[_0x9f08('0xc')](_0x9f08('0x11'),_0x5341c9,_0x9f08('0xd'));_0x4b37fc(_0x286809['result'][_0x9f08('0x12')]);}})['catch'](function(_0x5a562c){logger[_0x9f08('0x10')](_0x9f08('0x11'),_0x5341c9,_0x5a562c);_0x39e238(_0x5a562c);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index bd29eb4..4207078 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 _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7a54,0x106));var _0x47a5=function(_0x809495,_0x34ba2d){_0x809495=_0x809495-0x0;var _0x116a2e=_0x7a54[_0x809495];return _0x116a2e;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x7a54,0x106));var _0x47a5=function(_0x1afdbc,_0x130a0b){_0x1afdbc=_0x1afdbc-0x0;var _0x1c9b52=_0x7a54[_0x1afdbc];return _0x1c9b52;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index c438876..733cbd4 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 _0xf63b=['picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue'];(function(_0x45cbcf,_0xfbdbc2){var _0x52ece8=function(_0x498579){while(--_0x498579){_0x45cbcf['push'](_0x45cbcf['shift']());}};_0x52ece8(++_0xfbdbc2);}(_0xf63b,0x194));var _0xbf63=function(_0xd57bf1,_0x1e33c5){_0xd57bf1=_0xd57bf1-0x0;var _0x23e146=_0xf63b[_0xd57bf1];return _0x23e146;};'use strict';var Sequelize=require(_0xbf63('0x0'));module[_0xbf63('0x1')]={'type':{'type':Sequelize[_0xbf63('0x2')](_0xbf63('0x3'),_0xbf63('0x4'),'customVariable',_0xbf63('0x5'),_0xbf63('0x6')),'defaultValue':_0xbf63('0x3')},'content':{'type':Sequelize[_0xbf63('0x7')]},'key':{'type':Sequelize[_0xbf63('0x7')]},'keyType':{'type':Sequelize[_0xbf63('0x2')](_0xbf63('0x3'),_0xbf63('0x4'),_0xbf63('0x8'))},'keyContent':{'type':Sequelize[_0xbf63('0x7')]},'idField':{'type':Sequelize[_0xbf63('0x7')]},'nameField':{'type':Sequelize[_0xbf63('0x7')]},'customField':{'type':Sequelize[_0xbf63('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbf63('0x7')]}}; \ No newline at end of file +var _0x77c3=['picklist','STRING','sequelize','ENUM','string','variable','customVariable','keyValue'];(function(_0x26a7d1,_0x2df4ad){var _0x4c60bd=function(_0x592412){while(--_0x592412){_0x26a7d1['push'](_0x26a7d1['shift']());}};_0x4c60bd(++_0x2df4ad);}(_0x77c3,0x152));var _0x377c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x77c3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x377c('0x0'));module['exports']={'type':{'type':Sequelize[_0x377c('0x1')](_0x377c('0x2'),_0x377c('0x3'),_0x377c('0x4'),_0x377c('0x5'),_0x377c('0x6')),'defaultValue':_0x377c('0x2')},'content':{'type':Sequelize[_0x377c('0x7')]},'key':{'type':Sequelize[_0x377c('0x7')]},'keyType':{'type':Sequelize[_0x377c('0x1')]('string','variable',_0x377c('0x4'))},'keyContent':{'type':Sequelize[_0x377c('0x7')]},'idField':{'type':Sequelize[_0x377c('0x7')]},'nameField':{'type':Sequelize[_0x377c('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x377c('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 1408071..bb78553 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 _0x471b=['name','send','index','DeskField','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','findAll','show','params','include','find','catch','create','body','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','crypto','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','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack'];(function(_0xb7e035,_0x29ebea){var _0x1510d8=function(_0x5b466e){while(--_0x5b466e){_0xb7e035['push'](_0xb7e035['shift']());}};_0x1510d8(++_0x29ebea);}(_0x471b,0x6a));var _0xb471=function(_0xb92558,_0x20d5e9){_0xb92558=_0xb92558-0x0;var _0x2381e4=_0x471b[_0xb92558];return _0x2381e4;};'use strict';var pdf=require(_0xb471('0x0'));var emlformat=require(_0xb471('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb471('0x2'));var rp=require('request-promise');var moment=require(_0xb471('0x3'));var BPromise=require(_0xb471('0x4'));var Mustache=require(_0xb471('0x5'));var util=require(_0xb471('0x6'));var path=require('path');var sox=require(_0xb471('0x7'));var csv=require('to-csv');var ejs=require(_0xb471('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb471('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xb471('0xa'));var toCsv=require(_0xb471('0xb'));var querystring=require(_0xb471('0xc'));var Papa=require(_0xb471('0xd'));var Redis=require(_0xb471('0xe'));var authService=require(_0xb471('0xf'));var qs=require(_0xb471('0x10'));var as=require(_0xb471('0x11'));var hardwareService=require(_0xb471('0x12'));var logger=require(_0xb471('0x13'))('api');var utils=require(_0xb471('0x14'));var config=require(_0xb471('0x15'));var licenseUtil=require(_0xb471('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f5bf6,_0x587e32){_0x587e32=_0x587e32||0xcc;return function(_0x3edd25){if(_0x3edd25){return _0x5f5bf6[_0xb471('0x17')](_0x587e32);}return _0x5f5bf6['status'](_0x587e32)['end']();};}function respondWithResult(_0x456368,_0x43a829){_0x43a829=_0x43a829||0xc8;return function(_0x484847){if(_0x484847){return _0x456368[_0xb471('0x18')](_0x43a829)[_0xb471('0x19')](_0x484847);}};}function respondWithFilteredResult(_0x2cf387,_0x24e22f){return function(_0x181633){if(_0x181633){var _0x1a4304=_0x181633[_0xb471('0x1a')],_0x43e95c=_0x24e22f[_0xb471('0x1b')],_0x44cabf=_0x24e22f['offset']+_0x24e22f[_0xb471('0x1c')],_0x59cff9;if(_0x44cabf>=_0x1a4304){_0x44cabf=_0x1a4304;_0x59cff9=0xc8;}else{_0x59cff9=0xce;}_0x2cf387[_0xb471('0x18')](_0x59cff9);return _0x2cf387['set'](_0xb471('0x1d'),_0x43e95c+'-'+_0x44cabf+'/'+_0x1a4304)['json'](_0x181633);}return null;};}function patchUpdates(_0x146331){return function(_0x42205a){try{jsonpatch[_0xb471('0x1e')](_0x42205a,_0x146331,!![]);}catch(_0x36ad09){return BPromise[_0xb471('0x1f')](_0x36ad09);}return _0x42205a[_0xb471('0x20')]();};}function saveUpdates(_0x5662fd,_0x420e49){return function(_0x23d814){if(_0x23d814){return _0x23d814[_0xb471('0x21')](_0x5662fd)[_0xb471('0x22')](function(_0x25eba9){return _0x25eba9;});}return null;};}function removeEntity(_0x456d9a,_0x3deba6){return function(_0x2e46de){if(_0x2e46de){return _0x2e46de[_0xb471('0x23')]()[_0xb471('0x22')](function(){_0x456d9a[_0xb471('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21859f,_0x4b46e0){return function(_0x197e55){if(!_0x197e55){_0x21859f[_0xb471('0x17')](0x194);}return _0x197e55;};}function handleError(_0x385da7,_0x1ebeb0){_0x1ebeb0=_0x1ebeb0||0x1f4;return function(_0x5c8f95){logger[_0xb471('0x24')](_0x5c8f95[_0xb471('0x25')]);if(_0x5c8f95[_0xb471('0x26')]){delete _0x5c8f95[_0xb471('0x26')];}_0x385da7['status'](_0x1ebeb0)[_0xb471('0x27')](_0x5c8f95);};}exports[_0xb471('0x28')]=function(_0x31e4df,_0xe823e4){var _0x460637={},_0x15d7a1={},_0x50c7cb={'count':0x0,'rows':[]};var _0x104db2=_['map'](db[_0xb471('0x29')][_0xb471('0x2a')],function(_0x8b7ace){return{'name':_0x8b7ace['fieldName'],'type':_0x8b7ace[_0xb471('0x2b')][_0xb471('0x2c')]};});_0x15d7a1[_0xb471('0x2d')]=_[_0xb471('0x2e')](_0x104db2,_0xb471('0x26'));_0x15d7a1[_0xb471('0x2f')]=_[_0xb471('0x30')](_0x31e4df[_0xb471('0x2f')]);_0x15d7a1[_0xb471('0x31')]=_[_0xb471('0x32')](_0x15d7a1['model'],_0x15d7a1[_0xb471('0x2f')]);_0x460637[_0xb471('0x33')]=_[_0xb471('0x32')](_0x15d7a1[_0xb471('0x2d')],qs[_0xb471('0x34')](_0x31e4df['query'][_0xb471('0x34')]));_0x460637[_0xb471('0x33')]=_0x460637[_0xb471('0x33')][_0xb471('0x35')]?_0x460637[_0xb471('0x33')]:_0x15d7a1[_0xb471('0x2d')];if(!_0x31e4df[_0xb471('0x2f')][_0xb471('0x36')](_0xb471('0x37'))){_0x460637[_0xb471('0x1c')]=qs[_0xb471('0x1c')](_0x31e4df[_0xb471('0x2f')][_0xb471('0x1c')]);_0x460637[_0xb471('0x1b')]=qs[_0xb471('0x1b')](_0x31e4df['query']['offset']);}_0x460637[_0xb471('0x38')]=qs[_0xb471('0x39')](_0x31e4df[_0xb471('0x2f')][_0xb471('0x39')]);_0x460637['where']=qs[_0xb471('0x31')](_[_0xb471('0x3a')](_0x31e4df[_0xb471('0x2f')],_0x15d7a1[_0xb471('0x31')]),_0x104db2);if(_0x31e4df[_0xb471('0x2f')][_0xb471('0x3b')]){_0x460637[_0xb471('0x3c')]=_['merge'](_0x460637[_0xb471('0x3c')],{'$or':_[_0xb471('0x2e')](_0x104db2,function(_0xa6cc5){if(_0xa6cc5['type']!==_0xb471('0x3d')){var _0x2996e0={};_0x2996e0[_0xa6cc5[_0xb471('0x26')]]={'$like':'%'+_0x31e4df[_0xb471('0x2f')][_0xb471('0x3b')]+'%'};return _0x2996e0;}})});}_0x460637=_[_0xb471('0x3e')]({},_0x460637,_0x31e4df[_0xb471('0x3f')]);var _0x2f86a3={'where':_0x460637['where']};return db['DeskField']['count'](_0x2f86a3)[_0xb471('0x22')](function(_0x34ba8f){_0x50c7cb['count']=_0x34ba8f;if(_0x31e4df[_0xb471('0x2f')]['includeAll']){_0x460637['include']=[{'all':!![]}];}return db['DeskField'][_0xb471('0x40')](_0x460637);})['then'](function(_0x3f60d4){_0x50c7cb['rows']=_0x3f60d4;return _0x50c7cb;})[_0xb471('0x22')](respondWithFilteredResult(_0xe823e4,_0x460637))['catch'](handleError(_0xe823e4,null));};exports[_0xb471('0x41')]=function(_0x8984c0,_0x68a383){var _0x14ec29={'raw':!![],'where':{'id':_0x8984c0[_0xb471('0x42')]['id']}},_0x2e5d33={};_0x2e5d33[_0xb471('0x2d')]=_['keys'](db[_0xb471('0x29')]['rawAttributes']);_0x2e5d33[_0xb471('0x2f')]=_[_0xb471('0x30')](_0x8984c0['query']);_0x2e5d33[_0xb471('0x31')]=_[_0xb471('0x32')](_0x2e5d33[_0xb471('0x2d')],_0x2e5d33[_0xb471('0x2f')]);_0x14ec29[_0xb471('0x33')]=_[_0xb471('0x32')](_0x2e5d33['model'],qs[_0xb471('0x34')](_0x8984c0['query'][_0xb471('0x34')]));_0x14ec29[_0xb471('0x33')]=_0x14ec29[_0xb471('0x33')][_0xb471('0x35')]?_0x14ec29[_0xb471('0x33')]:_0x2e5d33['model'];if(_0x8984c0[_0xb471('0x2f')]['includeAll']){_0x14ec29[_0xb471('0x43')]=[{'all':!![]}];}_0x14ec29=_[_0xb471('0x3e')]({},_0x14ec29,_0x8984c0[_0xb471('0x3f')]);return db[_0xb471('0x29')][_0xb471('0x44')](_0x14ec29)['then'](handleEntityNotFound(_0x68a383,null))[_0xb471('0x22')](respondWithResult(_0x68a383,null))[_0xb471('0x45')](handleError(_0x68a383,null));};exports[_0xb471('0x46')]=function(_0x39a5f1,_0x4154c1){return db[_0xb471('0x29')][_0xb471('0x46')](_0x39a5f1[_0xb471('0x47')],{})[_0xb471('0x22')](respondWithResult(_0x4154c1,0xc9))[_0xb471('0x45')](handleError(_0x4154c1,null));};exports[_0xb471('0x21')]=function(_0x26cc94,_0x4cd23c){if(_0x26cc94[_0xb471('0x47')]['id']){delete _0x26cc94[_0xb471('0x47')]['id'];}return db[_0xb471('0x29')][_0xb471('0x44')]({'where':{'id':_0x26cc94['params']['id']}})[_0xb471('0x22')](handleEntityNotFound(_0x4cd23c,null))['then'](saveUpdates(_0x26cc94[_0xb471('0x47')],null))[_0xb471('0x22')](respondWithResult(_0x4cd23c,null))['catch'](handleError(_0x4cd23c,null));};exports[_0xb471('0x23')]=function(_0x271936,_0x534706){return db[_0xb471('0x29')][_0xb471('0x44')]({'where':{'id':_0x271936[_0xb471('0x42')]['id']}})[_0xb471('0x22')](handleEntityNotFound(_0x534706,null))[_0xb471('0x22')](removeEntity(_0x534706,null))['catch'](handleError(_0x534706,null));}; \ No newline at end of file +var _0x101e=['query','attributes','intersection','model','fields','length','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','findAll','rows','catch','params','keys','includeAll','include','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','DeskField','rawAttributes','type','key'];(function(_0x45a25e,_0x57838f){var _0x187960=function(_0x247f1a){while(--_0x247f1a){_0x45a25e['push'](_0x45a25e['shift']());}};_0x187960(++_0x57838f);}(_0x101e,0xa5));var _0xe101=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x101e[_0xbca1b1];return _0x4e1686;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe101('0x0'));var rimraf=require(_0xe101('0x1'));var zipdir=require(_0xe101('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe101('0x3'));var moment=require('moment');var BPromise=require(_0xe101('0x4'));var Mustache=require(_0xe101('0x5'));var util=require(_0xe101('0x6'));var path=require(_0xe101('0x7'));var sox=require(_0xe101('0x8'));var csv=require(_0xe101('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe101('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe101('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe101('0xc'));var toCsv=require(_0xe101('0x9'));var querystring=require(_0xe101('0xd'));var Papa=require(_0xe101('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe101('0xf'));var as=require(_0xe101('0x10'));var hardwareService=require(_0xe101('0x11'));var logger=require(_0xe101('0x12'))(_0xe101('0x13'));var utils=require('../../config/utils');var config=require(_0xe101('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe101('0x15'))['db'];function respondWithStatusCode(_0x4e4f17,_0x2ccc0e){_0x2ccc0e=_0x2ccc0e||0xcc;return function(_0x1ebf25){if(_0x1ebf25){return _0x4e4f17[_0xe101('0x16')](_0x2ccc0e);}return _0x4e4f17[_0xe101('0x17')](_0x2ccc0e)[_0xe101('0x18')]();};}function respondWithResult(_0xc746ce,_0x55f71d){_0x55f71d=_0x55f71d||0xc8;return function(_0x8185c9){if(_0x8185c9){return _0xc746ce[_0xe101('0x17')](_0x55f71d)[_0xe101('0x19')](_0x8185c9);}};}function respondWithFilteredResult(_0x5d4ae7,_0x3f4d41){return function(_0x10c193){if(_0x10c193){var _0x578b08=_0x10c193[_0xe101('0x1a')],_0x20dbe6=_0x3f4d41[_0xe101('0x1b')],_0x22d698=_0x3f4d41['offset']+_0x3f4d41[_0xe101('0x1c')],_0x37b736;if(_0x22d698>=_0x578b08){_0x22d698=_0x578b08;_0x37b736=0xc8;}else{_0x37b736=0xce;}_0x5d4ae7[_0xe101('0x17')](_0x37b736);return _0x5d4ae7['set'](_0xe101('0x1d'),_0x20dbe6+'-'+_0x22d698+'/'+_0x578b08)['json'](_0x10c193);}return null;};}function patchUpdates(_0x40a212){return function(_0x13c1ab){try{jsonpatch[_0xe101('0x1e')](_0x13c1ab,_0x40a212,!![]);}catch(_0x1e2ee8){return BPromise[_0xe101('0x1f')](_0x1e2ee8);}return _0x13c1ab[_0xe101('0x20')]();};}function saveUpdates(_0x597fde,_0x592811){return function(_0xccdd8){if(_0xccdd8){return _0xccdd8[_0xe101('0x21')](_0x597fde)[_0xe101('0x22')](function(_0x4a7478){return _0x4a7478;});}return null;};}function removeEntity(_0x5775cc,_0x576685){return function(_0x1315d5){if(_0x1315d5){return _0x1315d5[_0xe101('0x23')]()['then'](function(){_0x5775cc[_0xe101('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16c43b,_0x527bb4){return function(_0x1f9392){if(!_0x1f9392){_0x16c43b[_0xe101('0x16')](0x194);}return _0x1f9392;};}function handleError(_0xab4b2,_0x393c6b){_0x393c6b=_0x393c6b||0x1f4;return function(_0x4b2fd1){logger[_0xe101('0x24')](_0x4b2fd1['stack']);if(_0x4b2fd1['name']){delete _0x4b2fd1[_0xe101('0x25')];}_0xab4b2['status'](_0x393c6b)[_0xe101('0x26')](_0x4b2fd1);};}exports[_0xe101('0x27')]=function(_0x125d9a,_0x515039){var _0x1e5dba={},_0x1beb22={},_0x1db4cf={'count':0x0,'rows':[]};var _0x3c7eda=_[_0xe101('0x28')](db[_0xe101('0x29')][_0xe101('0x2a')],function(_0x1f637a){return{'name':_0x1f637a['fieldName'],'type':_0x1f637a[_0xe101('0x2b')][_0xe101('0x2c')]};});_0x1beb22['model']=_[_0xe101('0x28')](_0x3c7eda,'name');_0x1beb22[_0xe101('0x2d')]=_['keys'](_0x125d9a['query']);_0x1beb22['filters']=_['intersection'](_0x1beb22['model'],_0x1beb22[_0xe101('0x2d')]);_0x1e5dba[_0xe101('0x2e')]=_[_0xe101('0x2f')](_0x1beb22[_0xe101('0x30')],qs[_0xe101('0x31')](_0x125d9a[_0xe101('0x2d')][_0xe101('0x31')]));_0x1e5dba[_0xe101('0x2e')]=_0x1e5dba[_0xe101('0x2e')][_0xe101('0x32')]?_0x1e5dba[_0xe101('0x2e')]:_0x1beb22[_0xe101('0x30')];if(!_0x125d9a[_0xe101('0x2d')]['hasOwnProperty'](_0xe101('0x33'))){_0x1e5dba[_0xe101('0x1c')]=qs['limit'](_0x125d9a[_0xe101('0x2d')]['limit']);_0x1e5dba[_0xe101('0x1b')]=qs[_0xe101('0x1b')](_0x125d9a[_0xe101('0x2d')][_0xe101('0x1b')]);}_0x1e5dba[_0xe101('0x34')]=qs[_0xe101('0x35')](_0x125d9a[_0xe101('0x2d')][_0xe101('0x35')]);_0x1e5dba[_0xe101('0x36')]=qs[_0xe101('0x37')](_['pick'](_0x125d9a[_0xe101('0x2d')],_0x1beb22['filters']),_0x3c7eda);if(_0x125d9a[_0xe101('0x2d')]['filter']){_0x1e5dba['where']=_[_0xe101('0x38')](_0x1e5dba['where'],{'$or':_['map'](_0x3c7eda,function(_0x4b04a7){if(_0x4b04a7[_0xe101('0x2b')]!==_0xe101('0x39')){var _0x7e466a={};_0x7e466a[_0x4b04a7[_0xe101('0x25')]]={'$like':'%'+_0x125d9a[_0xe101('0x2d')][_0xe101('0x3a')]+'%'};return _0x7e466a;}})});}_0x1e5dba=_[_0xe101('0x38')]({},_0x1e5dba,_0x125d9a[_0xe101('0x3b')]);var _0xbaef5b={'where':_0x1e5dba['where']};return db[_0xe101('0x29')][_0xe101('0x1a')](_0xbaef5b)[_0xe101('0x22')](function(_0x3806b0){_0x1db4cf[_0xe101('0x1a')]=_0x3806b0;if(_0x125d9a[_0xe101('0x2d')]['includeAll']){_0x1e5dba['include']=[{'all':!![]}];}return db[_0xe101('0x29')][_0xe101('0x3c')](_0x1e5dba);})[_0xe101('0x22')](function(_0x173c3d){_0x1db4cf[_0xe101('0x3d')]=_0x173c3d;return _0x1db4cf;})[_0xe101('0x22')](respondWithFilteredResult(_0x515039,_0x1e5dba))[_0xe101('0x3e')](handleError(_0x515039,null));};exports['show']=function(_0x20af2b,_0x5d6ec7){var _0x188d16={'raw':!![],'where':{'id':_0x20af2b[_0xe101('0x3f')]['id']}},_0x2736d5={};_0x2736d5['model']=_[_0xe101('0x40')](db[_0xe101('0x29')][_0xe101('0x2a')]);_0x2736d5['query']=_[_0xe101('0x40')](_0x20af2b[_0xe101('0x2d')]);_0x2736d5[_0xe101('0x37')]=_[_0xe101('0x2f')](_0x2736d5['model'],_0x2736d5[_0xe101('0x2d')]);_0x188d16[_0xe101('0x2e')]=_[_0xe101('0x2f')](_0x2736d5[_0xe101('0x30')],qs[_0xe101('0x31')](_0x20af2b[_0xe101('0x2d')][_0xe101('0x31')]));_0x188d16['attributes']=_0x188d16[_0xe101('0x2e')]['length']?_0x188d16['attributes']:_0x2736d5[_0xe101('0x30')];if(_0x20af2b[_0xe101('0x2d')][_0xe101('0x41')]){_0x188d16[_0xe101('0x42')]=[{'all':!![]}];}_0x188d16=_[_0xe101('0x38')]({},_0x188d16,_0x20af2b[_0xe101('0x3b')]);return db[_0xe101('0x29')][_0xe101('0x43')](_0x188d16)[_0xe101('0x22')](handleEntityNotFound(_0x5d6ec7,null))[_0xe101('0x22')](respondWithResult(_0x5d6ec7,null))[_0xe101('0x3e')](handleError(_0x5d6ec7,null));};exports['create']=function(_0x8c22af,_0x284847){return db[_0xe101('0x29')][_0xe101('0x44')](_0x8c22af[_0xe101('0x45')],{})[_0xe101('0x22')](respondWithResult(_0x284847,0xc9))['catch'](handleError(_0x284847,null));};exports[_0xe101('0x21')]=function(_0xb5839b,_0x27d1d8){if(_0xb5839b[_0xe101('0x45')]['id']){delete _0xb5839b['body']['id'];}return db['DeskField'][_0xe101('0x43')]({'where':{'id':_0xb5839b[_0xe101('0x3f')]['id']}})[_0xe101('0x22')](handleEntityNotFound(_0x27d1d8,null))[_0xe101('0x22')](saveUpdates(_0xb5839b[_0xe101('0x45')],null))[_0xe101('0x22')](respondWithResult(_0x27d1d8,null))[_0xe101('0x3e')](handleError(_0x27d1d8,null));};exports[_0xe101('0x23')]=function(_0x443fc7,_0x1c4884){return db[_0xe101('0x29')][_0xe101('0x43')]({'where':{'id':_0x443fc7['params']['id']}})['then'](handleEntityNotFound(_0x1c4884,null))[_0xe101('0x22')](removeEntity(_0x1c4884,null))[_0xe101('0x3e')](handleError(_0x1c4884,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index cde9855..da89051 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 _0x212c=['../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','../../config/logger','api','path','rimraf'];(function(_0x298040,_0x309f61){var _0x1e21a7=function(_0x45b0cb){while(--_0x45b0cb){_0x298040['push'](_0x298040['shift']());}};_0x1e21a7(++_0x309f61);}(_0x212c,0xf7));var _0xc212=function(_0x391375,_0x18241b){_0x391375=_0x391375-0x0;var _0x56e2cf=_0x212c[_0x391375];return _0x56e2cf;};'use strict';var _=require(_0xc212('0x0'));var util=require('util');var logger=require(_0xc212('0x1'))(_0xc212('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc212('0x3'));var rimraf=require(_0xc212('0x4'));var config=require(_0xc212('0x5'));var attributes=require(_0xc212('0x6'));module[_0xc212('0x7')]=function(_0x4bdcf9,_0x41093f){return _0x4bdcf9[_0xc212('0x8')](_0xc212('0x9'),attributes,{'tableName':_0xc212('0xa'),'paranoid':![],'indexes':[{'name':_0xc212('0xb'),'fields':[_0xc212('0xc'),_0xc212('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x14b3=['desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','DeskField','int_desk_fields'];(function(_0x435ced,_0x516581){var _0x16e19f=function(_0x5a85d3){while(--_0x5a85d3){_0x435ced['push'](_0x435ced['shift']());}};_0x16e19f(++_0x516581);}(_0x14b3,0x6c));var _0x314b=function(_0x279b1a,_0x2bb6df){_0x279b1a=_0x279b1a-0x0;var _0x316364=_0x14b3[_0x279b1a];return _0x316364;};'use strict';var _=require(_0x314b('0x0'));var util=require(_0x314b('0x1'));var logger=require(_0x314b('0x2'))(_0x314b('0x3'));var moment=require('moment');var BPromise=require(_0x314b('0x4'));var rp=require(_0x314b('0x5'));var fs=require('fs');var path=require(_0x314b('0x6'));var rimraf=require(_0x314b('0x7'));var config=require(_0x314b('0x8'));var attributes=require('./intDeskField.attributes');module[_0x314b('0x9')]=function(_0x3b5cc4,_0x4f2ce7){return _0x3b5cc4['define'](_0x314b('0xa'),attributes,{'tableName':_0x314b('0xb'),'paranoid':![],'indexes':[{'name':_0x314b('0xc'),'fields':[_0x314b('0xd'),_0x314b('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 4d0128d..2a86706 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 _0x0b39=['http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x38241f,_0x17ec6e){var _0xda04f5=function(_0x4bbdad){while(--_0x4bbdad){_0x38241f['push'](_0x38241f['shift']());}};_0xda04f5(++_0x17ec6e);}(_0x0b39,0xfd));var _0x90b3=function(_0x50e255,_0x1fc7b7){_0x50e255=_0x50e255-0x0;var _0x597181=_0x0b39[_0x50e255];return _0x597181;};'use strict';var _=require(_0x90b3('0x0'));var util=require(_0x90b3('0x1'));var moment=require(_0x90b3('0x2'));var BPromise=require('bluebird');var rs=require(_0x90b3('0x3'));var fs=require('fs');var Redis=require(_0x90b3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x90b3('0x5'));var logger=require(_0x90b3('0x6'))(_0x90b3('0x7'));var config=require(_0x90b3('0x8'));var jayson=require(_0x90b3('0x9'));var client=jayson[_0x90b3('0xa')][_0x90b3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8fa77b,_0x456426,_0x1b9221){return new BPromise(function(_0x514062,_0x145837){return client[_0x90b3('0xc')](_0x8fa77b,_0x1b9221)[_0x90b3('0xd')](function(_0xe1937c){logger[_0x90b3('0xe')](_0x90b3('0xf'),_0x456426,_0x90b3('0x10'));logger['debug'](_0x90b3('0x11'),_0x456426,_0x90b3('0x10'),JSON[_0x90b3('0x12')](_0xe1937c));if(_0xe1937c[_0x90b3('0x13')]){if(_0xe1937c[_0x90b3('0x13')][_0x90b3('0x14')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x456426,_0xe1937c['error']['message']);return _0x145837(_0xe1937c[_0x90b3('0x13')][_0x90b3('0x15')]);}logger[_0x90b3('0x13')]('DeskField,\x20%s,\x20%s',_0x456426,_0xe1937c[_0x90b3('0x13')][_0x90b3('0x15')]);return _0x514062(_0xe1937c[_0x90b3('0x13')][_0x90b3('0x15')]);}else{logger[_0x90b3('0xe')](_0x90b3('0xf'),_0x456426,_0x90b3('0x10'));_0x514062(_0xe1937c[_0x90b3('0x16')][_0x90b3('0x15')]);}})[_0x90b3('0x17')](function(_0x16a82c){logger[_0x90b3('0x13')]('DeskField,\x20%s,\x20%s',_0x456426,_0x16a82c);_0x145837(_0x16a82c);});});} \ No newline at end of file +var _0x2b7c=['result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskField,\x20%s,\x20%s'];(function(_0x5c9008,_0x4bb3a6){var _0x31a5e0=function(_0x3f7f1d){while(--_0x3f7f1d){_0x5c9008['push'](_0x5c9008['shift']());}};_0x31a5e0(++_0x4bb3a6);}(_0x2b7c,0x1ab));var _0xc2b7=function(_0x223e99,_0x2b1f3b){_0x223e99=_0x223e99-0x0;var _0x22db24=_0x2b7c[_0x223e99];return _0x22db24;};'use strict';var _=require(_0xc2b7('0x0'));var util=require(_0xc2b7('0x1'));var moment=require(_0xc2b7('0x2'));var BPromise=require(_0xc2b7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc2b7('0x4'))['db'];var utils=require(_0xc2b7('0x5'));var logger=require(_0xc2b7('0x6'))(_0xc2b7('0x7'));var config=require(_0xc2b7('0x8'));var jayson=require(_0xc2b7('0x9'));var client=jayson[_0xc2b7('0xa')][_0xc2b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b2cd9,_0x23c1fc,_0x5c5505){return new BPromise(function(_0x3f53b8,_0x5ae16e){return client[_0xc2b7('0xc')](_0x4b2cd9,_0x5c5505)[_0xc2b7('0xd')](function(_0x1090d4){logger[_0xc2b7('0xe')]('DeskField,\x20%s,\x20%s',_0x23c1fc,_0xc2b7('0xf'));logger[_0xc2b7('0x10')](_0xc2b7('0x11'),_0x23c1fc,'request\x20sent',JSON[_0xc2b7('0x12')](_0x1090d4));if(_0x1090d4['error']){if(_0x1090d4[_0xc2b7('0x13')][_0xc2b7('0x14')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x23c1fc,_0x1090d4[_0xc2b7('0x13')]['message']);return _0x5ae16e(_0x1090d4['error'][_0xc2b7('0x15')]);}logger[_0xc2b7('0x13')](_0xc2b7('0x16'),_0x23c1fc,_0x1090d4[_0xc2b7('0x13')][_0xc2b7('0x15')]);return _0x3f53b8(_0x1090d4['error'][_0xc2b7('0x15')]);}else{logger[_0xc2b7('0xe')](_0xc2b7('0x16'),_0x23c1fc,_0xc2b7('0xf'));_0x3f53b8(_0x1090d4[_0xc2b7('0x17')][_0xc2b7('0x15')]);}})[_0xc2b7('0x18')](function(_0x246df9){logger[_0xc2b7('0x13')](_0xc2b7('0x16'),_0x23c1fc,_0x246df9);_0x5ae16e(_0x246df9);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 0663f0a..64aa2d4 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 _0xb698=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','exports','multer','util','path'];(function(_0x34e14d,_0x5dea39){var _0x3d8e08=function(_0x134769){while(--_0x134769){_0x34e14d['push'](_0x34e14d['shift']());}};_0x3d8e08(++_0x5dea39);}(_0xb698,0x195));var _0x8b69=function(_0x3cd201,_0x2dc1d5){_0x3cd201=_0x3cd201-0x0;var _0x4b7456=_0xb698[_0x3cd201];return _0x4b7456;};'use strict';var multer=require(_0x8b69('0x0'));var util=require(_0x8b69('0x1'));var path=require(_0x8b69('0x2'));var timeout=require('connect-timeout');var express=require(_0x8b69('0x3'));var router=express[_0x8b69('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8b69('0x5'));var interaction=require(_0x8b69('0x6'));var config=require(_0x8b69('0x7'));var controller=require(_0x8b69('0x8'));router['get']('/',auth[_0x8b69('0x9')](),controller[_0x8b69('0xa')]);router[_0x8b69('0xb')](_0x8b69('0xc'),auth[_0x8b69('0x9')](),controller[_0x8b69('0xd')]);router[_0x8b69('0xb')](_0x8b69('0xe'),auth['isAuthenticated'](),controller[_0x8b69('0xf')]);router[_0x8b69('0xb')](_0x8b69('0x10'),auth[_0x8b69('0x9')](),controller['getFields']);router[_0x8b69('0x11')]('/',auth[_0x8b69('0x9')](),controller[_0x8b69('0x12')]);router[_0x8b69('0x11')](_0x8b69('0xe'),auth[_0x8b69('0x9')](),controller[_0x8b69('0x13')]);router[_0x8b69('0x14')]('/:id',auth[_0x8b69('0x9')](),controller[_0x8b69('0x15')]);router[_0x8b69('0x16')](_0x8b69('0xc'),auth[_0x8b69('0x9')](),controller['destroy']);module[_0x8b69('0x17')]=router; \ No newline at end of file +var _0xa2c4=['exports','multer','util','path','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','index','/:id','isAuthenticated','getConfigurations','/:id/fields','post','create','put','update','delete','destroy'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xa2c4,0x1a5));var _0x4a2c=function(_0x34ca8d,_0x1b9c33){_0x34ca8d=_0x34ca8d-0x0;var _0x58f8c1=_0xa2c4[_0x34ca8d];return _0x58f8c1;};'use strict';var multer=require(_0x4a2c('0x0'));var util=require(_0x4a2c('0x1'));var path=require(_0x4a2c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x4a2c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4a2c('0x4'));var config=require(_0x4a2c('0x5'));var controller=require(_0x4a2c('0x6'));router[_0x4a2c('0x7')]('/',auth['isAuthenticated'](),controller[_0x4a2c('0x8')]);router['get'](_0x4a2c('0x9'),auth[_0x4a2c('0xa')](),controller['show']);router[_0x4a2c('0x7')]('/:id/configurations',auth[_0x4a2c('0xa')](),controller[_0x4a2c('0xb')]);router[_0x4a2c('0x7')](_0x4a2c('0xc'),auth[_0x4a2c('0xa')](),controller['getFields']);router[_0x4a2c('0xd')]('/',auth[_0x4a2c('0xa')](),controller[_0x4a2c('0xe')]);router['post']('/:id/configurations',auth[_0x4a2c('0xa')](),controller['addConfiguration']);router[_0x4a2c('0xf')](_0x4a2c('0x9'),auth[_0x4a2c('0xa')](),controller[_0x4a2c('0x10')]);router[_0x4a2c('0x11')](_0x4a2c('0x9'),auth[_0x4a2c('0xa')](),controller[_0x4a2c('0x12')]);module[_0x4a2c('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 8bd06b8..e5268b6 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 _0xaf5a=['exports','STRING','sequelize'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xaf5a,0x17f));var _0xaaf5=function(_0x1ca882,_0x14f6e6){_0x1ca882=_0x1ca882-0x0;var _0x357d7e=_0xaf5a[_0x1ca882];return _0x357d7e;};'use strict';var Sequelize=require(_0xaaf5('0x0'));module[_0xaaf5('0x1')]={'name':{'type':Sequelize[_0xaaf5('0x2')]},'username':{'type':Sequelize[_0xaaf5('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xaaf5('0x2')]},'clientId':{'type':Sequelize[_0xaaf5('0x2')]},'clientSecret':{'type':Sequelize[_0xaaf5('0x2')]},'serverUrl':{'type':Sequelize[_0xaaf5('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xaaf5('0x2')]}}; \ No newline at end of file +var _0xc939=['STRING'];(function(_0x317ee8,_0x97ac10){var _0x43dbe5=function(_0x5c1511){while(--_0x5c1511){_0x317ee8['push'](_0x317ee8['shift']());}};_0x43dbe5(++_0x97ac10);}(_0xc939,0xb2));var _0x9c93=function(_0x30a54f,_0x20a0f4){_0x30a54f=_0x30a54f-0x0;var _0x547099=_0xc939[_0x30a54f];return _0x547099;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9c93('0x0')]},'username':{'type':Sequelize[_0x9c93('0x0')]},'password':{'type':Sequelize[_0x9c93('0x0')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x9c93('0x0')]},'clientId':{'type':Sequelize[_0x9c93('0x0')]},'clientSecret':{'type':Sequelize[_0x9c93('0x0')]},'serverUrl':{'type':Sequelize[_0x9c93('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x9c93('0x0')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 4fd7026..d94ed77 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 _0x1dfa=['../../mysqldb','../../components/integrations/configuration','client','http','request','info','request\x20sent','debug','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','status','end','offset','limit','Content-Range','json','save','update','then','destroy','sendStatus','stack','name','send','map','Dynamics365Account','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','nolimit','order','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','fields','find','body','getConfigurations','Dynamics365Configuration','sort','hasOwnProperty','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','create','Dynamics365Field','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','phonenumber','directioncode','phonecall_activity_parties','actualserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','parentcaseidname','primarycontactidname','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','4.0','Attributes','remove','includes','LogicalName','@odata.type','PicklistAttributeMetadata','push','MetadataId','all','forEach','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials','EntityDefinitions(',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','UserLocalizedLabel','Label','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x1a8532,_0x3830f5){var _0x12b61d=function(_0x3c2ddf){while(--_0x3c2ddf){_0x1a8532['push'](_0x1a8532['shift']());}};_0x12b61d(++_0x3830f5);}(_0x1dfa,0x18f));var _0xa1df=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x1dfa[_0xe66cf2];return _0x2d84e7;};'use strict';var pdf=require(_0xa1df('0x0'));var emlformat=require(_0xa1df('0x1'));var rimraf=require(_0xa1df('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa1df('0x3'));var rp=require(_0xa1df('0x4'));var moment=require(_0xa1df('0x5'));var BPromise=require(_0xa1df('0x6'));var Mustache=require('mustache');var util=require(_0xa1df('0x7'));var path=require('path');var sox=require(_0xa1df('0x8'));var csv=require(_0xa1df('0x9'));var ejs=require(_0xa1df('0xa'));var fs=require('fs');var fs_extra=require(_0xa1df('0xb'));var _=require(_0xa1df('0xc'));var squel=require(_0xa1df('0xd'));var crypto=require('crypto');var jsforce=require(_0xa1df('0xe'));var deskjs=require(_0xa1df('0xf'));var toCsv=require(_0xa1df('0x9'));var querystring=require(_0xa1df('0x10'));var Papa=require(_0xa1df('0x11'));var Redis=require(_0xa1df('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1df('0x13'));var logger=require(_0xa1df('0x14'))(_0xa1df('0x15'));var utils=require(_0xa1df('0x16'));var config=require(_0xa1df('0x17'));var licenseUtil=require(_0xa1df('0x18'));var db=require(_0xa1df('0x19'))['db'];var integrations=require(_0xa1df('0x1a'));var jayson=require('jayson/promise');var client=jayson[_0xa1df('0x1b')][_0xa1df('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x32baa8,_0x3d5f79,_0x49bb77,_0x21f627){return new BPromise(function(_0x26a868,_0x5e3284){var _0x4960de=_0x21f627||client;return _0x4960de[_0xa1df('0x1d')](_0x32baa8,_0x49bb77)['then'](function(_0x4587c4){logger[_0xa1df('0x1e')]('Dynamics365Account,\x20%s,\x20%s',_0x3d5f79,_0xa1df('0x1f'));logger[_0xa1df('0x20')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x3d5f79,_0xa1df('0x1f'),JSON[_0xa1df('0x21')](_0x4587c4));if(_0x4587c4[_0xa1df('0x22')]){if(_0x4587c4[_0xa1df('0x22')][_0xa1df('0x23')]===0x1f4){logger[_0xa1df('0x22')](_0xa1df('0x24'),_0x3d5f79,_0x4587c4[_0xa1df('0x22')][_0xa1df('0x25')]);return _0x5e3284(_0x4587c4[_0xa1df('0x22')][_0xa1df('0x25')]);}logger[_0xa1df('0x22')](_0xa1df('0x24'),_0x3d5f79,_0x4587c4[_0xa1df('0x22')][_0xa1df('0x25')]);return _0x26a868(_0x4587c4['error'][_0xa1df('0x25')]);}else{logger[_0xa1df('0x1e')]('Dynamics365Account,\x20%s,\x20%s',_0x3d5f79,_0xa1df('0x1f'));_0x26a868(_0x4587c4[_0xa1df('0x26')][_0xa1df('0x25')]);}})[_0xa1df('0x27')](function(_0x46c58e){logger[_0xa1df('0x22')](_0xa1df('0x24'),_0x3d5f79,_0x46c58e);_0x5e3284(_0x46c58e);});});}function respondWithStatusCode(_0xcb9855,_0x41003d){_0x41003d=_0x41003d||0xcc;return function(_0x3bc62b){if(_0x3bc62b){return _0xcb9855['sendStatus'](_0x41003d);}return _0xcb9855[_0xa1df('0x28')](_0x41003d)[_0xa1df('0x29')]();};}function respondWithResult(_0x19fe9d,_0x4be1de){_0x4be1de=_0x4be1de||0xc8;return function(_0x5e6cd4){if(_0x5e6cd4){return _0x19fe9d[_0xa1df('0x28')](_0x4be1de)['json'](_0x5e6cd4);}};}function respondWithFilteredResult(_0x26ce6e,_0x4aedac){return function(_0x13f82e){if(_0x13f82e){var _0x553af8=_0x13f82e['count'],_0x41b4ec=_0x4aedac[_0xa1df('0x2a')],_0x3c7f9c=_0x4aedac[_0xa1df('0x2a')]+_0x4aedac[_0xa1df('0x2b')],_0x3c0f77;if(_0x3c7f9c>=_0x553af8){_0x3c7f9c=_0x553af8;_0x3c0f77=0xc8;}else{_0x3c0f77=0xce;}_0x26ce6e[_0xa1df('0x28')](_0x3c0f77);return _0x26ce6e['set'](_0xa1df('0x2c'),_0x41b4ec+'-'+_0x3c7f9c+'/'+_0x553af8)[_0xa1df('0x2d')](_0x13f82e);}return null;};}function patchUpdates(_0x31956d){return function(_0x18d39e){try{jsonpatch['apply'](_0x18d39e,_0x31956d,!![]);}catch(_0x30ed84){return BPromise['reject'](_0x30ed84);}return _0x18d39e[_0xa1df('0x2e')]();};}function saveUpdates(_0x5cbbcc,_0x1b2870){return function(_0x5019e5){if(_0x5019e5){return _0x5019e5[_0xa1df('0x2f')](_0x5cbbcc)[_0xa1df('0x30')](function(_0x2ddb1d){return _0x2ddb1d;});}return null;};}function removeEntity(_0x1d5e3b,_0x58abff){return function(_0x43e145){if(_0x43e145){return _0x43e145[_0xa1df('0x31')]()['then'](function(){_0x1d5e3b[_0xa1df('0x28')](0xcc)[_0xa1df('0x29')]();});}};}function handleEntityNotFound(_0x4188ed,_0x27362b){return function(_0x4fb0e0){if(!_0x4fb0e0){_0x4188ed[_0xa1df('0x32')](0x194);}return _0x4fb0e0;};}function handleError(_0x3a6c9c,_0xd00cfb){_0xd00cfb=_0xd00cfb||0x1f4;return function(_0x1f73c2){logger[_0xa1df('0x22')](_0x1f73c2[_0xa1df('0x33')]);if(_0x1f73c2[_0xa1df('0x34')]){delete _0x1f73c2['name'];}_0x3a6c9c[_0xa1df('0x28')](_0xd00cfb)[_0xa1df('0x35')](_0x1f73c2);};}exports['index']=function(_0xb06bc,_0x4f5b07){var _0x35b838={},_0x34c2a8={},_0x3caf8f={'count':0x0,'rows':[]};var _0x392e80=_[_0xa1df('0x36')](db[_0xa1df('0x37')][_0xa1df('0x38')],function(_0x4ff5f6){return{'name':_0x4ff5f6[_0xa1df('0x39')],'type':_0x4ff5f6[_0xa1df('0x3a')]['key']};});_0x34c2a8[_0xa1df('0x3b')]=_[_0xa1df('0x36')](_0x392e80,_0xa1df('0x34'));_0x34c2a8[_0xa1df('0x3c')]=_[_0xa1df('0x3d')](_0xb06bc[_0xa1df('0x3c')]);_0x34c2a8[_0xa1df('0x3e')]=_[_0xa1df('0x3f')](_0x34c2a8[_0xa1df('0x3b')],_0x34c2a8['query']);_0x35b838[_0xa1df('0x40')]=_['intersection'](_0x34c2a8['model'],qs['fields'](_0xb06bc['query']['fields']));_0x35b838[_0xa1df('0x40')]=_0x35b838[_0xa1df('0x40')][_0xa1df('0x41')]?_0x35b838[_0xa1df('0x40')]:_0x34c2a8[_0xa1df('0x3b')];if(!_0xb06bc[_0xa1df('0x3c')]['hasOwnProperty'](_0xa1df('0x42'))){_0x35b838[_0xa1df('0x2b')]=qs[_0xa1df('0x2b')](_0xb06bc['query'][_0xa1df('0x2b')]);_0x35b838[_0xa1df('0x2a')]=qs[_0xa1df('0x2a')](_0xb06bc[_0xa1df('0x3c')][_0xa1df('0x2a')]);}_0x35b838[_0xa1df('0x43')]=qs['sort'](_0xb06bc[_0xa1df('0x3c')]['sort']);_0x35b838[_0xa1df('0x44')]=qs[_0xa1df('0x3e')](_[_0xa1df('0x45')](_0xb06bc[_0xa1df('0x3c')],_0x34c2a8[_0xa1df('0x3e')]),_0x392e80);if(_0xb06bc['query'][_0xa1df('0x46')]){_0x35b838['where']=_[_0xa1df('0x47')](_0x35b838[_0xa1df('0x44')],{'$or':_[_0xa1df('0x36')](_0x392e80,function(_0x392acb){if(_0x392acb[_0xa1df('0x3a')]!==_0xa1df('0x48')){var _0x34eda8={};_0x34eda8[_0x392acb['name']]={'$like':'%'+_0xb06bc[_0xa1df('0x3c')][_0xa1df('0x46')]+'%'};return _0x34eda8;}})});}_0x35b838=_[_0xa1df('0x47')]({},_0x35b838,_0xb06bc[_0xa1df('0x49')]);var _0x4336d9={'where':_0x35b838[_0xa1df('0x44')]};return db[_0xa1df('0x37')][_0xa1df('0x4a')](_0x4336d9)[_0xa1df('0x30')](function(_0x1ceb78){_0x3caf8f['count']=_0x1ceb78;if(_0xb06bc[_0xa1df('0x3c')][_0xa1df('0x4b')]){_0x35b838[_0xa1df('0x4c')]=[{'all':!![]}];}return db[_0xa1df('0x37')][_0xa1df('0x4d')](_0x35b838);})['then'](function(_0x2390cf){_0x3caf8f[_0xa1df('0x4e')]=_0x2390cf;return _0x3caf8f;})[_0xa1df('0x30')](respondWithFilteredResult(_0x4f5b07,_0x35b838))[_0xa1df('0x27')](handleError(_0x4f5b07,null));};exports[_0xa1df('0x4f')]=function(_0xaaba4c,_0x4f526b){var _0x544b5d={'raw':![],'where':{'id':_0xaaba4c[_0xa1df('0x50')]['id']}},_0x6462d1={};_0x6462d1['model']=_[_0xa1df('0x3d')](db[_0xa1df('0x37')][_0xa1df('0x38')]);_0x6462d1[_0xa1df('0x3c')]=_[_0xa1df('0x3d')](_0xaaba4c[_0xa1df('0x3c')]);_0x6462d1[_0xa1df('0x3e')]=_[_0xa1df('0x3f')](_0x6462d1[_0xa1df('0x3b')],_0x6462d1[_0xa1df('0x3c')]);_0x544b5d['attributes']=_[_0xa1df('0x3f')](_0x6462d1[_0xa1df('0x3b')],qs[_0xa1df('0x51')](_0xaaba4c[_0xa1df('0x3c')][_0xa1df('0x51')]));_0x544b5d['attributes']=_0x544b5d[_0xa1df('0x40')]['length']?_0x544b5d[_0xa1df('0x40')]:_0x6462d1[_0xa1df('0x3b')];if(_0xaaba4c[_0xa1df('0x3c')][_0xa1df('0x4b')]){_0x544b5d[_0xa1df('0x4c')]=[{'all':!![]}];}_0x544b5d=_['merge']({},_0x544b5d,_0xaaba4c['options']);return db[_0xa1df('0x37')][_0xa1df('0x52')](_0x544b5d)[_0xa1df('0x30')](handleEntityNotFound(_0x4f526b,null))['then'](respondWithResult(_0x4f526b,null))['catch'](handleError(_0x4f526b,null));};exports['create']=function(_0x5b75d2,_0x111484){return db[_0xa1df('0x37')]['create'](_0x5b75d2[_0xa1df('0x53')],{})['then'](respondWithResult(_0x111484,0xc9))[_0xa1df('0x27')](handleError(_0x111484,null));};exports[_0xa1df('0x2f')]=function(_0x310875,_0x254704){if(_0x310875[_0xa1df('0x53')]['id']){delete _0x310875[_0xa1df('0x53')]['id'];}return db[_0xa1df('0x37')][_0xa1df('0x52')]({'where':{'id':_0x310875[_0xa1df('0x50')]['id']}})[_0xa1df('0x30')](handleEntityNotFound(_0x254704,null))[_0xa1df('0x30')](saveUpdates(_0x310875['body'],null))[_0xa1df('0x30')](respondWithResult(_0x254704,null))[_0xa1df('0x27')](handleError(_0x254704,null));};exports[_0xa1df('0x31')]=function(_0x1f97f6,_0x3f360b){return db[_0xa1df('0x37')][_0xa1df('0x52')]({'where':{'id':_0x1f97f6['params']['id']}})[_0xa1df('0x30')](handleEntityNotFound(_0x3f360b,null))[_0xa1df('0x30')](removeEntity(_0x3f360b,null))[_0xa1df('0x27')](handleError(_0x3f360b,null));};exports[_0xa1df('0x54')]=function(_0x5908fd,_0x48ed07,_0x5d035b){var _0x4cf322={};var _0x4d1d1c={};var _0x48c910;var _0x49d3e6;return db[_0xa1df('0x37')]['findOne']({'where':{'id':_0x5908fd[_0xa1df('0x50')]['id']}})[_0xa1df('0x30')](handleEntityNotFound(_0x48ed07,null))[_0xa1df('0x30')](function(_0x17dea3){if(_0x17dea3){_0x48c910=_0x17dea3;_0x4d1d1c[_0xa1df('0x3b')]=_[_0xa1df('0x3d')](db[_0xa1df('0x55')]['rawAttributes']);_0x4d1d1c[_0xa1df('0x3c')]=_[_0xa1df('0x3d')](_0x5908fd[_0xa1df('0x3c')]);_0x4d1d1c[_0xa1df('0x3e')]=_[_0xa1df('0x3f')](_0x4d1d1c[_0xa1df('0x3b')],_0x4d1d1c[_0xa1df('0x3c')]);_0x4cf322[_0xa1df('0x40')]=_[_0xa1df('0x3f')](_0x4d1d1c[_0xa1df('0x3b')],qs[_0xa1df('0x51')](_0x5908fd['query'][_0xa1df('0x51')]));_0x4cf322[_0xa1df('0x40')]=_0x4cf322['attributes'][_0xa1df('0x41')]?_0x4cf322['attributes']:_0x4d1d1c['model'];_0x4cf322[_0xa1df('0x43')]=qs[_0xa1df('0x56')](_0x5908fd[_0xa1df('0x3c')][_0xa1df('0x56')]);_0x4cf322[_0xa1df('0x44')]=qs[_0xa1df('0x3e')](_[_0xa1df('0x45')](_0x5908fd[_0xa1df('0x3c')],_0x4d1d1c[_0xa1df('0x3e')]));if(_0x5908fd['query'][_0xa1df('0x46')]){_0x4cf322[_0xa1df('0x44')]=_['merge'](_0x4cf322['where'],{'$or':_[_0xa1df('0x36')](_0x4cf322[_0xa1df('0x40')],function(_0x4f1f62){var _0x479ebc={};_0x479ebc[_0x4f1f62]={'$like':'%'+_0x5908fd[_0xa1df('0x3c')][_0xa1df('0x46')]+'%'};return _0x479ebc;})});}_0x4cf322=_['merge']({},_0x4cf322,_0x5908fd['options']);return _0x48c910[_0xa1df('0x54')](_0x4cf322);}})[_0xa1df('0x30')](function(_0x48894a){if(_0x48894a){_0x49d3e6=_0x48894a[_0xa1df('0x41')];if(!_0x5908fd['query'][_0xa1df('0x57')](_0xa1df('0x42'))){_0x4cf322['limit']=qs[_0xa1df('0x2b')](_0x5908fd[_0xa1df('0x3c')]['limit']);_0x4cf322[_0xa1df('0x2a')]=qs[_0xa1df('0x2a')](_0x5908fd[_0xa1df('0x3c')]['offset']);}return _0x48c910[_0xa1df('0x54')](_0x4cf322);}})[_0xa1df('0x30')](function(_0x1564be){if(_0x1564be){return _0x1564be?{'count':_0x49d3e6,'rows':_0x1564be}:null;}})[_0xa1df('0x30')](respondWithResult(_0x48ed07,null))[_0xa1df('0x27')](handleError(_0x48ed07,null));};exports[_0xa1df('0x58')]=function(_0x19f7fc,_0x72e464,_0x4e33f6){if(_0x19f7fc[_0xa1df('0x53')]['id']){delete _0x19f7fc[_0xa1df('0x53')]['id'];}return db[_0xa1df('0x37')][_0xa1df('0x59')]({'where':{'id':_0x19f7fc[_0xa1df('0x50')]['id']}})[_0xa1df('0x30')](handleEntityNotFound(_0x72e464,null))[_0xa1df('0x30')](function(_0x348751){if(_0x348751){_0x19f7fc['body'][_0xa1df('0x5a')]=_0x348751['id'];_0x19f7fc['body']['Subjects']=integrations[_0xa1df('0x5b')](_0x19f7fc['body'][_0xa1df('0x5c')],_0x19f7fc[_0xa1df('0x53')][_0xa1df('0x3a')]);_0x19f7fc['body'][_0xa1df('0x5d')]=integrations['getDescriptions'](_0x19f7fc[_0xa1df('0x53')][_0xa1df('0x5c')],_0x19f7fc[_0xa1df('0x53')]['type']);return db[_0xa1df('0x55')][_0xa1df('0x5e')](_0x19f7fc['body'],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db[_0xa1df('0x5f')],'as':_0xa1df('0x5d')}]});}return null;})[_0xa1df('0x30')](respondWithResult(_0x72e464,null))[_0xa1df('0x27')](handleError(_0x72e464,null));};exports['getFields']=function(_0x30fd82,_0x4032c7,_0x2914a1){var _0x35c52b=_0x30fd82[_0xa1df('0x3c')][_0xa1df('0x60')];var _0x6bd969=_0x35c52b===_0xa1df('0x61')?_0xa1df('0x62'):_0xa1df('0x63');var _0x9ceb1a='';var _0x42902b='';var _0x49f505='';var _0xa2782c='';var _0x54bfdd='';var _0x2c4f4c='';var _0x150c03='';var _0x5ba41d='';var _0x58ccc7=[_0xa1df('0x64'),_0xa1df('0x65'),_0xa1df('0x66'),_0xa1df('0x67'),'caseorigincode','subject',_0xa1df('0x68'),'regardingobjectid',_0xa1df('0x69'),_0xa1df('0x6a')];var _0x36f1e2=['accountidname','accountidyominame',_0xa1df('0x6b'),'billedserviceunits',_0xa1df('0x6c'),_0xa1df('0x6d'),_0xa1df('0x6e'),'contractidname',_0xa1df('0x6f'),'createdbyexternalpartyyominame','createdbyname','createdbyyominame',_0xa1df('0x70'),_0xa1df('0x71'),_0xa1df('0x72'),_0xa1df('0x73'),'customeridtype',_0xa1df('0x74'),_0xa1df('0x75'),_0xa1df('0x76'),'entityimage_timestamp',_0xa1df('0x77'),'escalatedon',_0xa1df('0x78'),_0xa1df('0x79'),_0xa1df('0x7a'),_0xa1df('0x7b'),'influencescore',_0xa1df('0x7c'),_0xa1df('0x7d'),'masteridname',_0xa1df('0x7e'),'modifiedbyexternalpartyyominame','modifiedbyname',_0xa1df('0x7f'),_0xa1df('0x80'),'modifiedonbehalfbyname',_0xa1df('0x81'),_0xa1df('0x82'),_0xa1df('0x83'),_0xa1df('0x84'),_0xa1df('0x85'),'overriddencreatedon',_0xa1df('0x86'),_0xa1df('0x87'),'owneridyominame',_0xa1df('0x88'),_0xa1df('0x89'),'primarycontactidyominame',_0xa1df('0x8a'),_0xa1df('0x8b'),_0xa1df('0x8c'),_0xa1df('0x8d'),_0xa1df('0x8e'),_0xa1df('0x8f'),_0xa1df('0x90'),_0xa1df('0x91'),_0xa1df('0x92'),_0xa1df('0x93'),_0xa1df('0x94'),_0xa1df('0x95'),'statecode',_0xa1df('0x96'),_0xa1df('0x97'),_0xa1df('0x98'),_0xa1df('0x99'),_0xa1df('0x9a'),_0xa1df('0x9b'),'utcconversiontimezonecode',_0xa1df('0x9c')];var _0x510928=_0x58ccc7[_0xa1df('0x9d')](_0x36f1e2);return db[_0xa1df('0x37')]['findOne']({'where':{'id':_0x30fd82[_0xa1df('0x50')]['id']},'attributes':['id',_0xa1df('0x9e'),_0xa1df('0x9f'),_0xa1df('0xa0'),_0xa1df('0xa1'),_0xa1df('0xa2'),_0xa1df('0xa3')]})['then'](handleEntityNotFound(_0x4032c7,null))[_0xa1df('0x30')](function(_0x228188){if(_0x228188){_0x5ba41d=_0x228188[_0xa1df('0xa0')];var _0x1ddc69=_0x5ba41d[_0xa1df('0xa4')](-0x1);if(_0x1ddc69==='/'){_0x5ba41d=_0x5ba41d[_0xa1df('0xa5')](0x0,_0x5ba41d[_0xa1df('0xa6')](_0x1ddc69));}_0x150c03=util[_0xa1df('0xa7')](_0xa1df('0xa8'),_0x5ba41d);var _0xb804f0={'method':_0xa1df('0xa9'),'uri':_0xa1df('0xaa')+_0x228188[_0xa1df('0xa1')]+_0xa1df('0xab'),'form':{'client_id':_0x228188[_0xa1df('0xa2')],'resource':_0x5ba41d,'username':_0x228188[_0xa1df('0x9e')],'password':_0x228188[_0xa1df('0x9f')],'grant_type':_0xa1df('0x9f'),'client_secret':_0x228188[_0xa1df('0xa3')]},'json':!![]};return rp(_0xb804f0);}})[_0xa1df('0x30')](function(_0x117f93){_0x2c4f4c=_0x117f93['access_token'];var _0x52c3a3={'method':_0xa1df('0xac'),'uri':encodeURI(_0x150c03+_0xa1df('0xad')+_0x6bd969+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x2c4f4c,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x52c3a3);})[_0xa1df('0x30')](function(_0x52ee80){var _0x3f4735=_0x52ee80['value'][0x0];var _0x527001=_0x3f4735['MetadataId'];var _0xfa944={'method':_0xa1df('0xac'),'uri':_0x150c03+'EntityDefinitions('+_0x527001+_0xa1df('0xae'),'headers':{'Authorization':_0xa1df('0xaf')+_0x2c4f4c,'If-None-Match':null,'OData-Version':_0xa1df('0xb0')},'json':!![]};return rp(_0xfa944);})[_0xa1df('0x30')](function(_0x57661d){_0x9ceb1a=_0x57661d;_0x42902b=_0x9ceb1a[_0xa1df('0xb1')];_0x42902b=_[_0xa1df('0xb2')](_0x42902b,function(_0x18792e){return!_0x510928[_0xa1df('0xb3')](_0x18792e[_0xa1df('0xb4')]);});var _0x33df7b=[];var _0x88d475=[];_0x42902b['forEach'](function(_0x3d9056){if(_0x3d9056[_0xa1df('0xb5')]){var _0x157c94=_0x3d9056[_0xa1df('0xb5')][_0xa1df('0xa5')](_0x3d9056[_0xa1df('0xb5')][_0xa1df('0xa6')]('.')+0x1);if(_0x157c94===_0xa1df('0xb6')){_0x33df7b[_0xa1df('0xb7')](getSelectList(_0x150c03,_0x35c52b,_0x88d475,_0x9ceb1a[_0xa1df('0xb8')],_0x3d9056[_0xa1df('0xb8')],_0x2c4f4c));}}});return Promise[_0xa1df('0xb9')](_0x33df7b);})['then'](function(_0x1bb81c){_0x49f505=_0x1bb81c[0x0];var _0x54ceab=[];var _0x14b78a=[];_0x42902b[_0xa1df('0xba')](function(_0x1308be){if(!_[_0xa1df('0xbb')](_0x1308be[_0xa1df('0xb5')])){var _0xa325a0=_0x1308be[_0xa1df('0xb5')][_0xa1df('0xa5')](_0x1308be[_0xa1df('0xb5')][_0xa1df('0xa6')]('.')+0x1);if(_0xa325a0===_0xa1df('0xbc')){_0x54ceab['push'](getBooleanList(_0x150c03,_0x35c52b,_0x14b78a,_0x9ceb1a['MetadataId'],_0x1308be[_0xa1df('0xb8')],_0x2c4f4c));}}});return Promise['all'](_0x54ceab);})['then'](function(_0x98f45f){_0xa2782c=_0x98f45f[0x0];var _0x140560=[];var _0x2ab795=[];_0x42902b[_0xa1df('0xba')](function(_0x3b0690){if(_0x3b0690['@odata.type']){var _0x5e2e8c=_0x3b0690['@odata.type'][_0xa1df('0xa5')](_0x3b0690[_0xa1df('0xb5')]['lastIndexOf']('.')+0x1);if(_0x5e2e8c==='StringAttributeMetadata'||_0x5e2e8c===_0xa1df('0xbd')||_0x5e2e8c==='BigIntAttributeMetadata'||_0x5e2e8c===_0xa1df('0xbe')||_0x5e2e8c===_0xa1df('0xbf')||_0x5e2e8c===_0xa1df('0xc0')||_0x5e2e8c===_0xa1df('0xc1')||_0x5e2e8c===_0xa1df('0xc2')||_0x5e2e8c==='StateAttributeMetadata'||_0x5e2e8c===_0xa1df('0xc3')){_0x140560['push'](getInputList(_0x150c03,_0x35c52b,_0x5e2e8c,_0x2ab795,_0x9ceb1a[_0xa1df('0xb8')],_0x3b0690[_0xa1df('0xb8')],_0x2c4f4c));}}});return Promise[_0xa1df('0xb9')](_0x140560);})[_0xa1df('0x30')](function(_0x3c6f83){_0x54bfdd=_0x3c6f83[0x0];var _0x20db37=_0x49f505['concat'](_0xa2782c)[_0xa1df('0x9d')](_0x54bfdd);var _0x20c753={'count':_0x20db37[_0xa1df('0x41')],'rows':_0x20db37};return _0x20c753;})[_0xa1df('0x30')](respondWithResult(_0x4032c7,null))['catch'](function(_0x49d504){var _0x4aec91=_0x30fd82[_0xa1df('0x3c')][_0xa1df('0xc4')]?0x1f4:_0x49d504[_0xa1df('0xc5')]||0x1f4;logger[_0xa1df('0x22')](_0x49d504[_0xa1df('0x33')]);delete _0x49d504[_0xa1df('0x34')];if(_0x4aec91===0x191){_0x4aec91=0x190;}_0x4032c7[_0xa1df('0x28')](_0x4aec91)[_0xa1df('0x35')](_0x30fd82[_0xa1df('0x3c')][_0xa1df('0xc4')]?{'message':_0xa1df('0xc6'),'statusCode':_0x49d504[_0xa1df('0xc5')]}:_0x49d504);});};function getSelectList(_0x4ba6a0,_0x2c8f16,_0x21ef65,_0xdb402a,_0x36eed2,_0x157d61){var _0x3237c6={'method':_0xa1df('0xac'),'uri':_0x4ba6a0+_0xa1df('0xc7')+_0xdb402a+_0xa1df('0xc8')+_0x36eed2+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xa1df('0xc9'),'headers':{'Authorization':_0xa1df('0xaf')+_0x157d61,'If-None-Match':null,'OData-Version':_0xa1df('0xb0')},'json':!![]};return rp(_0x3237c6)[_0xa1df('0x30')](function(_0x2f74a){var _0x525923=[];var _0x3f6a2f=_0x2f74a['OptionSet']['Options'];_0x3f6a2f[_0xa1df('0xba')](function(_0x28cc9f){_0x525923[_0xa1df('0xb7')]({'name':_0x28cc9f['Label'][_0xa1df('0xca')][_0xa1df('0xcb')],'value':String(_0x28cc9f['Value'])});});var _0x3615e2={'id':_0x2c8f16+'_'+_0x2f74a['LogicalName'],'name':_0x2f74a[_0xa1df('0xcc')][_0xa1df('0xca')]['Label'],'custom':![],'options':_0x525923};_0x21ef65[_0xa1df('0xb7')](_0x3615e2);return _0x21ef65;});}function getBooleanList(_0x46678f,_0x54d261,_0x33a26c,_0x1a3d10,_0x363ef3,_0x396538){var _0x107439={'method':_0xa1df('0xac'),'uri':_0x46678f+'EntityDefinitions('+_0x1a3d10+_0xa1df('0xc8')+_0x363ef3+_0xa1df('0xcd'),'headers':{'Authorization':'Bearer\x20'+_0x396538,'If-None-Match':null,'OData-Version':_0xa1df('0xb0')},'json':!![]};return rp(_0x107439)[_0xa1df('0x30')](function(_0x336408){var _0x2b405b=[];_0x2b405b[_0xa1df('0xb7')]({'name':_0x336408[_0xa1df('0xce')]['TrueOption'][_0xa1df('0xcb')][_0xa1df('0xca')][_0xa1df('0xcb')],'value':_0xa1df('0xcf')},{'name':_0x336408[_0xa1df('0xce')][_0xa1df('0xd0')][_0xa1df('0xcb')][_0xa1df('0xca')][_0xa1df('0xcb')],'value':_0xa1df('0xd1')});var _0x4a1355={'id':_0x54d261+'_'+_0x336408[_0xa1df('0xb4')],'name':_0x336408['DisplayName']['UserLocalizedLabel'][_0xa1df('0xcb')],'custom':![],'options':_0x2b405b};_0x33a26c[_0xa1df('0xb7')](_0x4a1355);return _0x33a26c;});}function getInputList(_0x2669f9,_0x825af0,_0x3538fb,_0x321872,_0x196b36,_0x572aff,_0x3475d0){var _0x5a6abf={'method':'GET','uri':_0x2669f9+_0xa1df('0xc7')+_0x196b36+')/Attributes('+_0x572aff+_0xa1df('0xd2')+_0x3538fb+_0xa1df('0xd3'),'headers':{'Authorization':_0xa1df('0xaf')+_0x3475d0,'If-None-Match':null,'OData-Version':_0xa1df('0xb0')},'json':!![]};return rp(_0x5a6abf)['then'](function(_0x3aea57){var _0x5c6f07={'id':_0x825af0+'_'+_0x3aea57[_0xa1df('0xb4')],'name':_0x3aea57[_0xa1df('0xcc')]['UserLocalizedLabel']?_0x3aea57[_0xa1df('0xcc')][_0xa1df('0xca')]['Label']:_0x3aea57[_0xa1df('0xb4')],'custom':![],'options':[]};_0x321872[_0xa1df('0xb7')](_0x5c6f07);return _0x321872;});} \ No newline at end of file +var _0x3c9f=['subject','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyyominame','createdbyyominame','createdon','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productidname','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','statuscode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','https://login.microsoftonline.com/','/oauth2/token','clientId','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','@odata.type','PicklistAttributeMetadata','push','all','forEach','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName','DisplayName',')/Attributes(','true','FalseOption',')/Microsoft.Dynamics.CRM.','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','destroy','name','send','Dynamics365Account','rawAttributes','fieldName','type','model','map','keys','query','attributes','fields','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','filters','intersection','length','catch','create','body','find','getConfigurations','findOne','Dynamics365Configuration','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','getDescriptions','Subjects','Descriptions','getFields','ticketType','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode'];(function(_0x481af3,_0x483fac){var _0x3354ea=function(_0x2e3de5){while(--_0x2e3de5){_0x481af3['push'](_0x481af3['shift']());}};_0x3354ea(++_0x483fac);}(_0x3c9f,0x148));var _0xf3c9=function(_0x4506b9,_0x254d36){_0x4506b9=_0x4506b9-0x0;var _0x1e91b7=_0x3c9f[_0x4506b9];return _0x1e91b7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf3c9('0x0'));var rimraf=require(_0xf3c9('0x1'));var zipdir=require(_0xf3c9('0x2'));var jsonpatch=require(_0xf3c9('0x3'));var rp=require(_0xf3c9('0x4'));var moment=require(_0xf3c9('0x5'));var BPromise=require(_0xf3c9('0x6'));var Mustache=require('mustache');var util=require(_0xf3c9('0x7'));var path=require(_0xf3c9('0x8'));var sox=require(_0xf3c9('0x9'));var csv=require(_0xf3c9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf3c9('0xb'));var _=require('lodash');var squel=require(_0xf3c9('0xc'));var crypto=require(_0xf3c9('0xd'));var jsforce=require(_0xf3c9('0xe'));var deskjs=require(_0xf3c9('0xf'));var toCsv=require(_0xf3c9('0xa'));var querystring=require(_0xf3c9('0x10'));var Papa=require(_0xf3c9('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf3c9('0x12'));var as=require(_0xf3c9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf3c9('0x14'))(_0xf3c9('0x15'));var utils=require(_0xf3c9('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf3c9('0x17'));var db=require(_0xf3c9('0x18'))['db'];var integrations=require(_0xf3c9('0x19'));var jayson=require(_0xf3c9('0x1a'));var client=jayson[_0xf3c9('0x1b')][_0xf3c9('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x546f8f,_0x5c03dd,_0x131e2d,_0x4a98ea){return new BPromise(function(_0x4164b4,_0x1d0084){var _0x1f26d4=_0x4a98ea||client;return _0x1f26d4['request'](_0x546f8f,_0x131e2d)[_0xf3c9('0x1d')](function(_0x5b2dcc){logger[_0xf3c9('0x1e')](_0xf3c9('0x1f'),_0x5c03dd,_0xf3c9('0x20'));logger[_0xf3c9('0x21')](_0xf3c9('0x22'),_0x5c03dd,_0xf3c9('0x20'),JSON['stringify'](_0x5b2dcc));if(_0x5b2dcc[_0xf3c9('0x23')]){if(_0x5b2dcc[_0xf3c9('0x23')][_0xf3c9('0x24')]===0x1f4){logger[_0xf3c9('0x23')]('Dynamics365Account,\x20%s,\x20%s',_0x5c03dd,_0x5b2dcc['error'][_0xf3c9('0x25')]);return _0x1d0084(_0x5b2dcc[_0xf3c9('0x23')][_0xf3c9('0x25')]);}logger[_0xf3c9('0x23')]('Dynamics365Account,\x20%s,\x20%s',_0x5c03dd,_0x5b2dcc['error'][_0xf3c9('0x25')]);return _0x4164b4(_0x5b2dcc[_0xf3c9('0x23')][_0xf3c9('0x25')]);}else{logger['info'](_0xf3c9('0x1f'),_0x5c03dd,'request\x20sent');_0x4164b4(_0x5b2dcc[_0xf3c9('0x26')]['message']);}})['catch'](function(_0x4e55dd){logger[_0xf3c9('0x23')](_0xf3c9('0x1f'),_0x5c03dd,_0x4e55dd);_0x1d0084(_0x4e55dd);});});}function respondWithStatusCode(_0x59f725,_0x3b42c3){_0x3b42c3=_0x3b42c3||0xcc;return function(_0x18b49f){if(_0x18b49f){return _0x59f725[_0xf3c9('0x27')](_0x3b42c3);}return _0x59f725[_0xf3c9('0x28')](_0x3b42c3)[_0xf3c9('0x29')]();};}function respondWithResult(_0x49f93a,_0x37725b){_0x37725b=_0x37725b||0xc8;return function(_0x542f60){if(_0x542f60){return _0x49f93a[_0xf3c9('0x28')](_0x37725b)[_0xf3c9('0x2a')](_0x542f60);}};}function respondWithFilteredResult(_0xad8afb,_0x2aa3cd){return function(_0x324122){if(_0x324122){var _0xcc4cbd=_0x324122[_0xf3c9('0x2b')],_0x3a6052=_0x2aa3cd['offset'],_0x4fd342=_0x2aa3cd[_0xf3c9('0x2c')]+_0x2aa3cd['limit'],_0xd7a817;if(_0x4fd342>=_0xcc4cbd){_0x4fd342=_0xcc4cbd;_0xd7a817=0xc8;}else{_0xd7a817=0xce;}_0xad8afb[_0xf3c9('0x28')](_0xd7a817);return _0xad8afb[_0xf3c9('0x2d')](_0xf3c9('0x2e'),_0x3a6052+'-'+_0x4fd342+'/'+_0xcc4cbd)['json'](_0x324122);}return null;};}function patchUpdates(_0x2ccdbd){return function(_0x5dcd6c){try{jsonpatch[_0xf3c9('0x2f')](_0x5dcd6c,_0x2ccdbd,!![]);}catch(_0x190b28){return BPromise['reject'](_0x190b28);}return _0x5dcd6c[_0xf3c9('0x30')]();};}function saveUpdates(_0x283c68,_0x38365b){return function(_0x5912ab){if(_0x5912ab){return _0x5912ab[_0xf3c9('0x31')](_0x283c68)['then'](function(_0x491f96){return _0x491f96;});}return null;};}function removeEntity(_0x52d3b7,_0x5773e3){return function(_0x1d5b7a){if(_0x1d5b7a){return _0x1d5b7a[_0xf3c9('0x32')]()[_0xf3c9('0x1d')](function(){_0x52d3b7[_0xf3c9('0x28')](0xcc)[_0xf3c9('0x29')]();});}};}function handleEntityNotFound(_0x56a0ed,_0x388697){return function(_0x39a6fc){if(!_0x39a6fc){_0x56a0ed['sendStatus'](0x194);}return _0x39a6fc;};}function handleError(_0x49b93c,_0x333011){_0x333011=_0x333011||0x1f4;return function(_0x40867e){logger[_0xf3c9('0x23')](_0x40867e['stack']);if(_0x40867e[_0xf3c9('0x33')]){delete _0x40867e[_0xf3c9('0x33')];}_0x49b93c[_0xf3c9('0x28')](_0x333011)[_0xf3c9('0x34')](_0x40867e);};}exports['index']=function(_0x23bc38,_0x55c887){var _0x44cb75={},_0x4e4df4={},_0x15b76d={'count':0x0,'rows':[]};var _0xb13206=_['map'](db[_0xf3c9('0x35')][_0xf3c9('0x36')],function(_0x5b0fdc){return{'name':_0x5b0fdc[_0xf3c9('0x37')],'type':_0x5b0fdc[_0xf3c9('0x38')]['key']};});_0x4e4df4[_0xf3c9('0x39')]=_[_0xf3c9('0x3a')](_0xb13206,_0xf3c9('0x33'));_0x4e4df4['query']=_[_0xf3c9('0x3b')](_0x23bc38[_0xf3c9('0x3c')]);_0x4e4df4['filters']=_['intersection'](_0x4e4df4[_0xf3c9('0x39')],_0x4e4df4['query']);_0x44cb75[_0xf3c9('0x3d')]=_['intersection'](_0x4e4df4['model'],qs[_0xf3c9('0x3e')](_0x23bc38['query']['fields']));_0x44cb75['attributes']=_0x44cb75['attributes']['length']?_0x44cb75[_0xf3c9('0x3d')]:_0x4e4df4[_0xf3c9('0x39')];if(!_0x23bc38[_0xf3c9('0x3c')]['hasOwnProperty'](_0xf3c9('0x3f'))){_0x44cb75[_0xf3c9('0x40')]=qs['limit'](_0x23bc38['query'][_0xf3c9('0x40')]);_0x44cb75[_0xf3c9('0x2c')]=qs[_0xf3c9('0x2c')](_0x23bc38[_0xf3c9('0x3c')][_0xf3c9('0x2c')]);}_0x44cb75[_0xf3c9('0x41')]=qs['sort'](_0x23bc38['query'][_0xf3c9('0x42')]);_0x44cb75[_0xf3c9('0x43')]=qs['filters'](_[_0xf3c9('0x44')](_0x23bc38[_0xf3c9('0x3c')],_0x4e4df4['filters']),_0xb13206);if(_0x23bc38['query'][_0xf3c9('0x45')]){_0x44cb75['where']=_[_0xf3c9('0x46')](_0x44cb75[_0xf3c9('0x43')],{'$or':_[_0xf3c9('0x3a')](_0xb13206,function(_0x494007){if(_0x494007[_0xf3c9('0x38')]!==_0xf3c9('0x47')){var _0x3c2b14={};_0x3c2b14[_0x494007[_0xf3c9('0x33')]]={'$like':'%'+_0x23bc38[_0xf3c9('0x3c')]['filter']+'%'};return _0x3c2b14;}})});}_0x44cb75=_[_0xf3c9('0x46')]({},_0x44cb75,_0x23bc38[_0xf3c9('0x48')]);var _0x31071e={'where':_0x44cb75[_0xf3c9('0x43')]};return db['Dynamics365Account'][_0xf3c9('0x2b')](_0x31071e)[_0xf3c9('0x1d')](function(_0x1274ae){_0x15b76d[_0xf3c9('0x2b')]=_0x1274ae;if(_0x23bc38[_0xf3c9('0x3c')][_0xf3c9('0x49')]){_0x44cb75['include']=[{'all':!![]}];}return db[_0xf3c9('0x35')][_0xf3c9('0x4a')](_0x44cb75);})['then'](function(_0x25c7bb){_0x15b76d['rows']=_0x25c7bb;return _0x15b76d;})[_0xf3c9('0x1d')](respondWithFilteredResult(_0x55c887,_0x44cb75))['catch'](handleError(_0x55c887,null));};exports[_0xf3c9('0x4b')]=function(_0x2e35cc,_0x5bd7a9){var _0x2de3f9={'raw':![],'where':{'id':_0x2e35cc[_0xf3c9('0x4c')]['id']}},_0x2c1b7f={};_0x2c1b7f[_0xf3c9('0x39')]=_[_0xf3c9('0x3b')](db[_0xf3c9('0x35')][_0xf3c9('0x36')]);_0x2c1b7f['query']=_['keys'](_0x2e35cc[_0xf3c9('0x3c')]);_0x2c1b7f[_0xf3c9('0x4d')]=_[_0xf3c9('0x4e')](_0x2c1b7f[_0xf3c9('0x39')],_0x2c1b7f[_0xf3c9('0x3c')]);_0x2de3f9[_0xf3c9('0x3d')]=_[_0xf3c9('0x4e')](_0x2c1b7f[_0xf3c9('0x39')],qs[_0xf3c9('0x3e')](_0x2e35cc[_0xf3c9('0x3c')][_0xf3c9('0x3e')]));_0x2de3f9[_0xf3c9('0x3d')]=_0x2de3f9[_0xf3c9('0x3d')][_0xf3c9('0x4f')]?_0x2de3f9['attributes']:_0x2c1b7f[_0xf3c9('0x39')];if(_0x2e35cc[_0xf3c9('0x3c')][_0xf3c9('0x49')]){_0x2de3f9['include']=[{'all':!![]}];}_0x2de3f9=_[_0xf3c9('0x46')]({},_0x2de3f9,_0x2e35cc[_0xf3c9('0x48')]);return db['Dynamics365Account']['find'](_0x2de3f9)[_0xf3c9('0x1d')](handleEntityNotFound(_0x5bd7a9,null))['then'](respondWithResult(_0x5bd7a9,null))[_0xf3c9('0x50')](handleError(_0x5bd7a9,null));};exports[_0xf3c9('0x51')]=function(_0x1af130,_0x563b27){return db[_0xf3c9('0x35')]['create'](_0x1af130[_0xf3c9('0x52')],{})['then'](respondWithResult(_0x563b27,0xc9))['catch'](handleError(_0x563b27,null));};exports[_0xf3c9('0x31')]=function(_0x167138,_0x2c7b0c){if(_0x167138[_0xf3c9('0x52')]['id']){delete _0x167138[_0xf3c9('0x52')]['id'];}return db['Dynamics365Account'][_0xf3c9('0x53')]({'where':{'id':_0x167138[_0xf3c9('0x4c')]['id']}})[_0xf3c9('0x1d')](handleEntityNotFound(_0x2c7b0c,null))[_0xf3c9('0x1d')](saveUpdates(_0x167138[_0xf3c9('0x52')],null))[_0xf3c9('0x1d')](respondWithResult(_0x2c7b0c,null))[_0xf3c9('0x50')](handleError(_0x2c7b0c,null));};exports[_0xf3c9('0x32')]=function(_0x30374a,_0x230cc9){return db[_0xf3c9('0x35')][_0xf3c9('0x53')]({'where':{'id':_0x30374a['params']['id']}})[_0xf3c9('0x1d')](handleEntityNotFound(_0x230cc9,null))[_0xf3c9('0x1d')](removeEntity(_0x230cc9,null))[_0xf3c9('0x50')](handleError(_0x230cc9,null));};exports[_0xf3c9('0x54')]=function(_0x4a3485,_0x42d138,_0x45a30d){var _0x27b39e={};var _0x5f844c={};var _0x5753ef;var _0x4c492b;return db[_0xf3c9('0x35')][_0xf3c9('0x55')]({'where':{'id':_0x4a3485[_0xf3c9('0x4c')]['id']}})[_0xf3c9('0x1d')](handleEntityNotFound(_0x42d138,null))[_0xf3c9('0x1d')](function(_0xf2d243){if(_0xf2d243){_0x5753ef=_0xf2d243;_0x5f844c[_0xf3c9('0x39')]=_[_0xf3c9('0x3b')](db[_0xf3c9('0x56')][_0xf3c9('0x36')]);_0x5f844c[_0xf3c9('0x3c')]=_[_0xf3c9('0x3b')](_0x4a3485[_0xf3c9('0x3c')]);_0x5f844c['filters']=_[_0xf3c9('0x4e')](_0x5f844c[_0xf3c9('0x39')],_0x5f844c['query']);_0x27b39e[_0xf3c9('0x3d')]=_[_0xf3c9('0x4e')](_0x5f844c[_0xf3c9('0x39')],qs[_0xf3c9('0x3e')](_0x4a3485[_0xf3c9('0x3c')][_0xf3c9('0x3e')]));_0x27b39e[_0xf3c9('0x3d')]=_0x27b39e[_0xf3c9('0x3d')][_0xf3c9('0x4f')]?_0x27b39e[_0xf3c9('0x3d')]:_0x5f844c[_0xf3c9('0x39')];_0x27b39e[_0xf3c9('0x41')]=qs[_0xf3c9('0x42')](_0x4a3485['query'][_0xf3c9('0x42')]);_0x27b39e[_0xf3c9('0x43')]=qs['filters'](_['pick'](_0x4a3485[_0xf3c9('0x3c')],_0x5f844c[_0xf3c9('0x4d')]));if(_0x4a3485[_0xf3c9('0x3c')]['filter']){_0x27b39e[_0xf3c9('0x43')]=_[_0xf3c9('0x46')](_0x27b39e['where'],{'$or':_[_0xf3c9('0x3a')](_0x27b39e['attributes'],function(_0x1a5157){var _0x2baca9={};_0x2baca9[_0x1a5157]={'$like':'%'+_0x4a3485[_0xf3c9('0x3c')][_0xf3c9('0x45')]+'%'};return _0x2baca9;})});}_0x27b39e=_['merge']({},_0x27b39e,_0x4a3485[_0xf3c9('0x48')]);return _0x5753ef[_0xf3c9('0x54')](_0x27b39e);}})[_0xf3c9('0x1d')](function(_0x56be8c){if(_0x56be8c){_0x4c492b=_0x56be8c['length'];if(!_0x4a3485[_0xf3c9('0x3c')][_0xf3c9('0x57')](_0xf3c9('0x3f'))){_0x27b39e[_0xf3c9('0x40')]=qs['limit'](_0x4a3485['query'][_0xf3c9('0x40')]);_0x27b39e[_0xf3c9('0x2c')]=qs['offset'](_0x4a3485[_0xf3c9('0x3c')][_0xf3c9('0x2c')]);}return _0x5753ef['getConfigurations'](_0x27b39e);}})['then'](function(_0x432b42){if(_0x432b42){return _0x432b42?{'count':_0x4c492b,'rows':_0x432b42}:null;}})[_0xf3c9('0x1d')](respondWithResult(_0x42d138,null))[_0xf3c9('0x50')](handleError(_0x42d138,null));};exports[_0xf3c9('0x58')]=function(_0x4319b1,_0x1cd4bd,_0x2f357b){if(_0x4319b1['body']['id']){delete _0x4319b1['body']['id'];}return db[_0xf3c9('0x35')][_0xf3c9('0x55')]({'where':{'id':_0x4319b1[_0xf3c9('0x4c')]['id']}})[_0xf3c9('0x1d')](handleEntityNotFound(_0x1cd4bd,null))[_0xf3c9('0x1d')](function(_0x4f4b6c){if(_0x4f4b6c){_0x4319b1[_0xf3c9('0x52')][_0xf3c9('0x59')]=_0x4f4b6c['id'];_0x4319b1[_0xf3c9('0x52')]['Subjects']=integrations[_0xf3c9('0x5a')](_0x4319b1[_0xf3c9('0x52')][_0xf3c9('0x5b')],_0x4319b1[_0xf3c9('0x52')]['type']);_0x4319b1[_0xf3c9('0x52')]['Descriptions']=integrations[_0xf3c9('0x5c')](_0x4319b1['body'][_0xf3c9('0x5b')],_0x4319b1[_0xf3c9('0x52')][_0xf3c9('0x38')]);return db[_0xf3c9('0x56')][_0xf3c9('0x51')](_0x4319b1['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0xf3c9('0x5d')},{'model':db['Dynamics365Field'],'as':_0xf3c9('0x5e')}]});}return null;})[_0xf3c9('0x1d')](respondWithResult(_0x1cd4bd,null))['catch'](handleError(_0x1cd4bd,null));};exports[_0xf3c9('0x5f')]=function(_0x4ce750,_0x577868,_0x34d400){var _0x5e8a61=_0x4ce750['query'][_0xf3c9('0x60')];var _0xcba346=_0x5e8a61==='incident'?_0xf3c9('0x61'):_0xf3c9('0x62');var _0x512a7f='';var _0x1fd705='';var _0x371934='';var _0x5703d2='';var _0x5a1494='';var _0x4e9355='';var _0x487f44='';var _0x5c35d5='';var _0x576619=[_0xf3c9('0x63'),_0xf3c9('0x64'),_0xf3c9('0x65'),_0xf3c9('0x66'),_0xf3c9('0x67'),_0xf3c9('0x68'),'phonenumber','regardingobjectid','directioncode',_0xf3c9('0x69')];var _0xd0d20b=['accountidname',_0xf3c9('0x6a'),_0xf3c9('0x6b'),_0xf3c9('0x6c'),_0xf3c9('0x6d'),_0xf3c9('0x6e'),'contractdetailidname',_0xf3c9('0x6f'),'createdbyexternalpartyname',_0xf3c9('0x70'),'createdbyname',_0xf3c9('0x71'),_0xf3c9('0x72'),'createdonbehalfbyname','createdonbehalfbyyominame',_0xf3c9('0x73'),'customeridtype',_0xf3c9('0x74'),_0xf3c9('0x75'),_0xf3c9('0x76'),_0xf3c9('0x77'),_0xf3c9('0x78'),_0xf3c9('0x79'),'exchangerate',_0xf3c9('0x7a'),_0xf3c9('0x7b'),_0xf3c9('0x7c'),'influencescore',_0xf3c9('0x7d'),_0xf3c9('0x7e'),_0xf3c9('0x7f'),_0xf3c9('0x80'),_0xf3c9('0x81'),_0xf3c9('0x82'),_0xf3c9('0x83'),_0xf3c9('0x84'),_0xf3c9('0x85'),_0xf3c9('0x86'),_0xf3c9('0x87'),_0xf3c9('0x88'),_0xf3c9('0x89'),_0xf3c9('0x8a'),_0xf3c9('0x8b'),_0xf3c9('0x8c'),_0xf3c9('0x8d'),_0xf3c9('0x8e'),_0xf3c9('0x8f'),_0xf3c9('0x90'),'primarycontactidyominame',_0xf3c9('0x91'),_0xf3c9('0x92'),'productserialnumber',_0xf3c9('0x93'),'resolvebykpiidname',_0xf3c9('0x94'),_0xf3c9('0x95'),_0xf3c9('0x96'),'sentimentvalue',_0xf3c9('0x97'),'slaname','socialprofileidname','statecode',_0xf3c9('0x98'),_0xf3c9('0x99'),_0xf3c9('0x9a'),'timezoneruleversionnumber',_0xf3c9('0x9b'),_0xf3c9('0x9c'),_0xf3c9('0x9d'),_0xf3c9('0x9e')];var _0xdc64dc=_0x576619[_0xf3c9('0x9f')](_0xd0d20b);return db[_0xf3c9('0x35')]['findOne']({'where':{'id':_0x4ce750[_0xf3c9('0x4c')]['id']},'attributes':['id',_0xf3c9('0xa0'),_0xf3c9('0xa1'),_0xf3c9('0xa2'),'tenantId','clientId',_0xf3c9('0xa3')]})[_0xf3c9('0x1d')](handleEntityNotFound(_0x577868,null))[_0xf3c9('0x1d')](function(_0x4770a8){if(_0x4770a8){_0x5c35d5=_0x4770a8[_0xf3c9('0xa2')];var _0x53b3a8=_0x5c35d5[_0xf3c9('0xa4')](-0x1);if(_0x53b3a8==='/'){_0x5c35d5=_0x5c35d5[_0xf3c9('0xa5')](0x0,_0x5c35d5[_0xf3c9('0xa6')](_0x53b3a8));}_0x487f44=util[_0xf3c9('0xa7')](_0xf3c9('0xa8'),_0x5c35d5);var _0x14c447={'method':'POST','uri':_0xf3c9('0xa9')+_0x4770a8['tenantId']+_0xf3c9('0xaa'),'form':{'client_id':_0x4770a8[_0xf3c9('0xab')],'resource':_0x5c35d5,'username':_0x4770a8[_0xf3c9('0xa0')],'password':_0x4770a8[_0xf3c9('0xa1')],'grant_type':_0xf3c9('0xa1'),'client_secret':_0x4770a8[_0xf3c9('0xa3')]},'json':!![]};return rp(_0x14c447);}})[_0xf3c9('0x1d')](function(_0x36fcd8){_0x4e9355=_0x36fcd8[_0xf3c9('0xac')];var _0x1dc2ae={'method':_0xf3c9('0xad'),'uri':encodeURI(_0x487f44+_0xf3c9('0xae')+_0xcba346+'\x27'),'headers':{'Authorization':_0xf3c9('0xaf')+_0x4e9355,'If-None-Match':null,'OData-Version':_0xf3c9('0xb0')},'json':!![]};return rp(_0x1dc2ae);})[_0xf3c9('0x1d')](function(_0x37e835){var _0x4e599c=_0x37e835[_0xf3c9('0xb1')][0x0];var _0x4f9b48=_0x4e599c[_0xf3c9('0xb2')];var _0x2e3bf8={'method':'GET','uri':_0x487f44+_0xf3c9('0xb3')+_0x4f9b48+_0xf3c9('0xb4'),'headers':{'Authorization':_0xf3c9('0xaf')+_0x4e9355,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2e3bf8);})[_0xf3c9('0x1d')](function(_0x297d7c){_0x512a7f=_0x297d7c;_0x1fd705=_0x512a7f[_0xf3c9('0xb5')];_0x1fd705=_[_0xf3c9('0xb6')](_0x1fd705,function(_0x566ec0){return!_0xdc64dc[_0xf3c9('0xb7')](_0x566ec0['LogicalName']);});var _0x1f933d=[];var _0x2a6a18=[];_0x1fd705['forEach'](function(_0x17873e){if(_0x17873e['@odata.type']){var _0x1c6e88=_0x17873e[_0xf3c9('0xb8')][_0xf3c9('0xa5')](_0x17873e['@odata.type'][_0xf3c9('0xa6')]('.')+0x1);if(_0x1c6e88===_0xf3c9('0xb9')){_0x1f933d[_0xf3c9('0xba')](getSelectList(_0x487f44,_0x5e8a61,_0x2a6a18,_0x512a7f[_0xf3c9('0xb2')],_0x17873e[_0xf3c9('0xb2')],_0x4e9355));}}});return Promise[_0xf3c9('0xbb')](_0x1f933d);})[_0xf3c9('0x1d')](function(_0x3f392b){_0x371934=_0x3f392b[0x0];var _0x500117=[];var _0x183dc5=[];_0x1fd705[_0xf3c9('0xbc')](function(_0x3649e0){if(!_[_0xf3c9('0xbd')](_0x3649e0[_0xf3c9('0xb8')])){var _0x6195d1=_0x3649e0['@odata.type']['substring'](_0x3649e0[_0xf3c9('0xb8')]['lastIndexOf']('.')+0x1);if(_0x6195d1===_0xf3c9('0xbe')){_0x500117[_0xf3c9('0xba')](getBooleanList(_0x487f44,_0x5e8a61,_0x183dc5,_0x512a7f[_0xf3c9('0xb2')],_0x3649e0[_0xf3c9('0xb2')],_0x4e9355));}}});return Promise[_0xf3c9('0xbb')](_0x500117);})[_0xf3c9('0x1d')](function(_0x19ef50){_0x5703d2=_0x19ef50[0x0];var _0x307993=[];var _0x538c57=[];_0x1fd705['forEach'](function(_0x4a1264){if(_0x4a1264[_0xf3c9('0xb8')]){var _0x341f33=_0x4a1264['@odata.type']['substring'](_0x4a1264['@odata.type'][_0xf3c9('0xa6')]('.')+0x1);if(_0x341f33===_0xf3c9('0xbf')||_0x341f33===_0xf3c9('0xc0')||_0x341f33===_0xf3c9('0xc1')||_0x341f33==='IntegerAttributeMetadata'||_0x341f33===_0xf3c9('0xc2')||_0x341f33===_0xf3c9('0xc3')||_0x341f33===_0xf3c9('0xc4')||_0x341f33===_0xf3c9('0xc5')||_0x341f33===_0xf3c9('0xc6')||_0x341f33===_0xf3c9('0xc7')){_0x307993[_0xf3c9('0xba')](getInputList(_0x487f44,_0x5e8a61,_0x341f33,_0x538c57,_0x512a7f[_0xf3c9('0xb2')],_0x4a1264[_0xf3c9('0xb2')],_0x4e9355));}}});return Promise['all'](_0x307993);})[_0xf3c9('0x1d')](function(_0x559370){_0x5a1494=_0x559370[0x0];var _0x4502a8=_0x371934[_0xf3c9('0x9f')](_0x5703d2)[_0xf3c9('0x9f')](_0x5a1494);var _0x1db2d2={'count':_0x4502a8[_0xf3c9('0x4f')],'rows':_0x4502a8};return _0x1db2d2;})['then'](respondWithResult(_0x577868,null))[_0xf3c9('0x50')](function(_0x1d099b){var _0x413993=_0x4ce750['query'][_0xf3c9('0xc8')]?0x1f4:_0x1d099b[_0xf3c9('0xc9')]||0x1f4;logger[_0xf3c9('0x23')](_0x1d099b['stack']);delete _0x1d099b['name'];if(_0x413993===0x191){_0x413993=0x190;}_0x577868[_0xf3c9('0x28')](_0x413993)[_0xf3c9('0x34')](_0x4ce750[_0xf3c9('0x3c')][_0xf3c9('0xc8')]?{'message':_0xf3c9('0xca'),'statusCode':_0x1d099b[_0xf3c9('0xc9')]}:_0x1d099b);});};function getSelectList(_0x161bed,_0x311cfd,_0x42c738,_0x8a2714,_0x17b5c3,_0x547312){var _0x5248c5={'method':'GET','uri':_0x161bed+_0xf3c9('0xb3')+_0x8a2714+')/Attributes('+_0x17b5c3+_0xf3c9('0xcb')+_0xf3c9('0xcc'),'headers':{'Authorization':_0xf3c9('0xaf')+_0x547312,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5248c5)[_0xf3c9('0x1d')](function(_0x35116a){var _0x88d01e=[];var _0x36dbc4=_0x35116a[_0xf3c9('0xcd')][_0xf3c9('0xce')];_0x36dbc4[_0xf3c9('0xbc')](function(_0x2244a0){_0x88d01e[_0xf3c9('0xba')]({'name':_0x2244a0[_0xf3c9('0xcf')][_0xf3c9('0xd0')]['Label'],'value':String(_0x2244a0[_0xf3c9('0xd1')])});});var _0x5d5142={'id':_0x311cfd+'_'+_0x35116a[_0xf3c9('0xd2')],'name':_0x35116a[_0xf3c9('0xd3')][_0xf3c9('0xd0')][_0xf3c9('0xcf')],'custom':![],'options':_0x88d01e};_0x42c738[_0xf3c9('0xba')](_0x5d5142);return _0x42c738;});}function getBooleanList(_0x4abaf2,_0x2e1159,_0x343b65,_0x1b0dc7,_0x2b670e,_0x206087){var _0x36c835={'method':'GET','uri':_0x4abaf2+_0xf3c9('0xb3')+_0x1b0dc7+_0xf3c9('0xd4')+_0x2b670e+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x206087,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x36c835)[_0xf3c9('0x1d')](function(_0x5e29b1){var _0xbbc21=[];_0xbbc21[_0xf3c9('0xba')]({'name':_0x5e29b1[_0xf3c9('0xcd')]['TrueOption'][_0xf3c9('0xcf')][_0xf3c9('0xd0')][_0xf3c9('0xcf')],'value':_0xf3c9('0xd5')},{'name':_0x5e29b1[_0xf3c9('0xcd')][_0xf3c9('0xd6')]['Label'][_0xf3c9('0xd0')][_0xf3c9('0xcf')],'value':'false'});var _0x3b67eb={'id':_0x2e1159+'_'+_0x5e29b1[_0xf3c9('0xd2')],'name':_0x5e29b1[_0xf3c9('0xd3')][_0xf3c9('0xd0')][_0xf3c9('0xcf')],'custom':![],'options':_0xbbc21};_0x343b65[_0xf3c9('0xba')](_0x3b67eb);return _0x343b65;});}function getInputList(_0x1d9396,_0x1d2525,_0x4f63eb,_0x5f2b51,_0x2bf121,_0x2cd993,_0x4759ef){var _0x2b2da1={'method':_0xf3c9('0xad'),'uri':_0x1d9396+_0xf3c9('0xb3')+_0x2bf121+')/Attributes('+_0x2cd993+_0xf3c9('0xd7')+_0x4f63eb+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x4759ef,'If-None-Match':null,'OData-Version':_0xf3c9('0xb0')},'json':!![]};return rp(_0x2b2da1)[_0xf3c9('0x1d')](function(_0x18d17a){var _0x21ef1e={'id':_0x1d2525+'_'+_0x18d17a[_0xf3c9('0xd2')],'name':_0x18d17a[_0xf3c9('0xd3')][_0xf3c9('0xd0')]?_0x18d17a[_0xf3c9('0xd3')][_0xf3c9('0xd0')]['Label']:_0x18d17a[_0xf3c9('0xd2')],'custom':![],'options':[]};_0x5f2b51[_0xf3c9('0xba')](_0x21ef1e);return _0x5f2b51;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 3cbfd5f..1b192ad 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 _0x51ba=['int_dynamics365_accounts','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','define','Dynamics365Account'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x51ba,0x175));var _0xa51b=function(_0x52943e,_0x29e8ff){_0x52943e=_0x52943e-0x0;var _0x1de0e5=_0x51ba[_0x52943e];return _0x1de0e5;};'use strict';var _=require(_0xa51b('0x0'));var util=require('util');var logger=require(_0xa51b('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa51b('0x2'));var rp=require(_0xa51b('0x3'));var fs=require('fs');var path=require(_0xa51b('0x4'));var rimraf=require(_0xa51b('0x5'));var config=require(_0xa51b('0x6'));var attributes=require(_0xa51b('0x7'));var integrations=require(_0xa51b('0x8'));module['exports']=function(_0x11ef1a,_0x47902d){return _0x11ef1a[_0xa51b('0x9')](_0xa51b('0xa'),attributes,{'tableName':_0xa51b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38ca=['./intDynamics365Account.attributes','../../components/integrations/configuration','exports','Dynamics365Account','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x3b554d,_0x4f4ad1){var _0x5c8925=function(_0x48c8aa){while(--_0x48c8aa){_0x3b554d['push'](_0x3b554d['shift']());}};_0x5c8925(++_0x4f4ad1);}(_0x38ca,0x16c));var _0xa38c=function(_0x455279,_0xa2a66a){_0x455279=_0x455279-0x0;var _0x103cdf=_0x38ca[_0x455279];return _0x103cdf;};'use strict';var _=require(_0xa38c('0x0'));var util=require(_0xa38c('0x1'));var logger=require(_0xa38c('0x2'))(_0xa38c('0x3'));var moment=require('moment');var BPromise=require(_0xa38c('0x4'));var rp=require(_0xa38c('0x5'));var fs=require('fs');var path=require(_0xa38c('0x6'));var rimraf=require('rimraf');var config=require(_0xa38c('0x7'));var attributes=require(_0xa38c('0x8'));var integrations=require(_0xa38c('0x9'));module[_0xa38c('0xa')]=function(_0x198a66,_0x3bb910){return _0x198a66['define'](_0xa38c('0xb'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 85ff217..3fa188c 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 _0xa381=['Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','GetDynamics365Account','Dynamics365Account','options','raw','where','attributes','limit','include','map','model','catch','ShowDynamics365Account','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x18a3b4,_0xad70ec){var _0x54214c=function(_0x1e2b8d){while(--_0x1e2b8d){_0x18a3b4['push'](_0x18a3b4['shift']());}};_0x54214c(++_0xad70ec);}(_0xa381,0x79));var _0x1a38=function(_0x2df864,_0x1e1504){_0x2df864=_0x2df864-0x0;var _0x17a34b=_0xa381[_0x2df864];return _0x17a34b;};'use strict';var _=require(_0x1a38('0x0'));var util=require(_0x1a38('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1a38('0x2'));var fs=require('fs');var Redis=require(_0x1a38('0x3'));var db=require(_0x1a38('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1a38('0x5'))(_0x1a38('0x6'));var config=require(_0x1a38('0x7'));var jayson=require(_0x1a38('0x8'));var client=jayson['client'][_0x1a38('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x569e9f,_0x5c8ab1,_0x3d12f8){return new BPromise(function(_0x4df1db,_0x46e61d){return client[_0x1a38('0xa')](_0x569e9f,_0x3d12f8)[_0x1a38('0xb')](function(_0x4676ff){logger['info'](_0x1a38('0xc'),_0x5c8ab1,_0x1a38('0xd'));logger[_0x1a38('0xe')](_0x1a38('0xf'),_0x5c8ab1,_0x1a38('0xd'),JSON[_0x1a38('0x10')](_0x4676ff));if(_0x4676ff[_0x1a38('0x11')]){if(_0x4676ff[_0x1a38('0x11')][_0x1a38('0x12')]===0x1f4){logger[_0x1a38('0x11')](_0x1a38('0xc'),_0x5c8ab1,_0x4676ff[_0x1a38('0x11')][_0x1a38('0x13')]);return _0x46e61d(_0x4676ff[_0x1a38('0x11')][_0x1a38('0x13')]);}logger[_0x1a38('0x11')](_0x1a38('0xc'),_0x5c8ab1,_0x4676ff[_0x1a38('0x11')][_0x1a38('0x13')]);return _0x4df1db(_0x4676ff[_0x1a38('0x11')][_0x1a38('0x13')]);}else{logger[_0x1a38('0x14')](_0x1a38('0xc'),_0x5c8ab1,'request\x20sent');_0x4df1db(_0x4676ff['result'][_0x1a38('0x13')]);}})['catch'](function(_0x424d27){logger[_0x1a38('0x11')](_0x1a38('0xc'),_0x5c8ab1,_0x424d27);_0x46e61d(_0x424d27);});});}exports[_0x1a38('0x15')]=function(_0x25ebb0){var _0x22ac36=this;return new Promise(function(_0x408e8f,_0x2aef00){return db[_0x1a38('0x16')]['findAll']({'raw':_0x25ebb0[_0x1a38('0x17')]?_0x25ebb0['options'][_0x1a38('0x18')]===undefined?!![]:![]:!![],'where':_0x25ebb0[_0x1a38('0x17')]?_0x25ebb0['options'][_0x1a38('0x19')]||null:null,'attributes':_0x25ebb0['options']?_0x25ebb0['options'][_0x1a38('0x1a')]||null:null,'limit':_0x25ebb0[_0x1a38('0x17')]?_0x25ebb0[_0x1a38('0x17')][_0x1a38('0x1b')]||null:null,'include':_0x25ebb0['options']?_0x25ebb0[_0x1a38('0x17')][_0x1a38('0x1c')]?_[_0x1a38('0x1d')](_0x25ebb0['options'][_0x1a38('0x1c')],function(_0x214228){return{'model':db[_0x214228[_0x1a38('0x1e')]],'as':_0x214228['as'],'attributes':_0x214228[_0x1a38('0x1a')],'include':_0x214228[_0x1a38('0x1c')]?_[_0x1a38('0x1d')](_0x214228[_0x1a38('0x1c')],function(_0x160ac1){return{'model':db[_0x160ac1[_0x1a38('0x1e')]],'as':_0x160ac1['as'],'attributes':_0x160ac1[_0x1a38('0x1a')],'include':_0x160ac1['include']?_[_0x1a38('0x1d')](_0x160ac1['include'],function(_0x398827){return{'model':db[_0x398827[_0x1a38('0x1e')]],'as':_0x398827['as'],'attributes':_0x398827['attributes']};}):[]};}):[]};}):[]:[]})[_0x1a38('0xb')](function(_0x571533){logger[_0x1a38('0x14')](_0x1a38('0x15'),_0x25ebb0);logger[_0x1a38('0xe')]('GetDynamics365Account',_0x25ebb0,JSON['stringify'](_0x571533));_0x408e8f(_0x571533);})[_0x1a38('0x1f')](function(_0x2a4027){logger[_0x1a38('0x11')](_0x1a38('0x15'),_0x2a4027[_0x1a38('0x13')],_0x25ebb0);_0x2aef00(_0x22ac36[_0x1a38('0x11')](0x1f4,_0x2a4027[_0x1a38('0x13')]));});});};exports[_0x1a38('0x20')]=function(_0x50011f){var _0x5680bd=this;return new Promise(function(_0x1c940c,_0x464f0b){return db[_0x1a38('0x16')][_0x1a38('0x21')]({'raw':_0x50011f[_0x1a38('0x17')]?_0x50011f[_0x1a38('0x17')][_0x1a38('0x18')]===undefined?!![]:![]:!![],'where':_0x50011f['options']?_0x50011f[_0x1a38('0x17')]['where']||null:null,'attributes':_0x50011f[_0x1a38('0x17')]?_0x50011f[_0x1a38('0x17')][_0x1a38('0x1a')]||null:null,'include':_0x50011f[_0x1a38('0x17')]?_0x50011f[_0x1a38('0x17')]['include']?_[_0x1a38('0x1d')](_0x50011f[_0x1a38('0x17')][_0x1a38('0x1c')],function(_0x2255fc){return{'model':db[_0x2255fc[_0x1a38('0x1e')]],'as':_0x2255fc['as'],'attributes':_0x2255fc[_0x1a38('0x1a')],'include':_0x2255fc['include']?_[_0x1a38('0x1d')](_0x2255fc[_0x1a38('0x1c')],function(_0xe5cff5){return{'model':db[_0xe5cff5['model']],'as':_0xe5cff5['as'],'attributes':_0xe5cff5[_0x1a38('0x1a')],'include':_0xe5cff5[_0x1a38('0x1c')]?_['map'](_0xe5cff5['include'],function(_0x5fa5a9){return{'model':db[_0x5fa5a9[_0x1a38('0x1e')]],'as':_0x5fa5a9['as'],'attributes':_0x5fa5a9[_0x1a38('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1a38('0xb')](function(_0x490ab4){logger['info'](_0x1a38('0x20'),_0x50011f);logger[_0x1a38('0xe')](_0x1a38('0x20'),_0x50011f,JSON[_0x1a38('0x10')](_0x490ab4));_0x1c940c(_0x490ab4);})[_0x1a38('0x1f')](function(_0x3b3f27){logger[_0x1a38('0x11')](_0x1a38('0x20'),_0x3b3f27[_0x1a38('0x13')],_0x50011f);_0x464f0b(_0x5680bd[_0x1a38('0x11')](0x1f4,_0x3b3f27[_0x1a38('0x13')]));});});}; \ No newline at end of file +var _0x4ca4=['jayson/promise','client','http','request','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','code','error','message','Dynamics365Account,\x20%s,\x20%s','info','result','GetDynamics365Account','Dynamics365Account','options','raw','where','attributes','limit','map','include','model','then','find','ShowDynamics365Account','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4ca4,0x100));var _0x44ca=function(_0x2c5fb9,_0x25613a){_0x2c5fb9=_0x2c5fb9-0x0;var _0x4e12e6=_0x4ca4[_0x2c5fb9];return _0x4e12e6;};'use strict';var _=require(_0x44ca('0x0'));var util=require(_0x44ca('0x1'));var moment=require(_0x44ca('0x2'));var BPromise=require(_0x44ca('0x3'));var rs=require(_0x44ca('0x4'));var fs=require('fs');var Redis=require(_0x44ca('0x5'));var db=require(_0x44ca('0x6'))['db'];var utils=require(_0x44ca('0x7'));var logger=require('../../config/logger')(_0x44ca('0x8'));var config=require(_0x44ca('0x9'));var jayson=require(_0x44ca('0xa'));var client=jayson[_0x44ca('0xb')][_0x44ca('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x32097f,_0x4ce88d,_0x5d7a35){return new BPromise(function(_0x5c1475,_0x140f00){return client[_0x44ca('0xd')](_0x32097f,_0x5d7a35)['then'](function(_0x3c0999){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x4ce88d,_0x44ca('0xe'));logger[_0x44ca('0xf')](_0x44ca('0x10'),_0x4ce88d,_0x44ca('0xe'),JSON[_0x44ca('0x11')](_0x3c0999));if(_0x3c0999['error']){if(_0x3c0999['error'][_0x44ca('0x12')]===0x1f4){logger[_0x44ca('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x4ce88d,_0x3c0999['error'][_0x44ca('0x14')]);return _0x140f00(_0x3c0999[_0x44ca('0x13')][_0x44ca('0x14')]);}logger[_0x44ca('0x13')](_0x44ca('0x15'),_0x4ce88d,_0x3c0999[_0x44ca('0x13')][_0x44ca('0x14')]);return _0x5c1475(_0x3c0999[_0x44ca('0x13')]['message']);}else{logger[_0x44ca('0x16')](_0x44ca('0x15'),_0x4ce88d,'request\x20sent');_0x5c1475(_0x3c0999[_0x44ca('0x17')][_0x44ca('0x14')]);}})['catch'](function(_0x1248a4){logger[_0x44ca('0x13')](_0x44ca('0x15'),_0x4ce88d,_0x1248a4);_0x140f00(_0x1248a4);});});}exports[_0x44ca('0x18')]=function(_0x3bea76){var _0x3b4626=this;return new Promise(function(_0x1fe960,_0x342a08){return db[_0x44ca('0x19')]['findAll']({'raw':_0x3bea76[_0x44ca('0x1a')]?_0x3bea76[_0x44ca('0x1a')][_0x44ca('0x1b')]===undefined?!![]:![]:!![],'where':_0x3bea76[_0x44ca('0x1a')]?_0x3bea76['options'][_0x44ca('0x1c')]||null:null,'attributes':_0x3bea76['options']?_0x3bea76[_0x44ca('0x1a')][_0x44ca('0x1d')]||null:null,'limit':_0x3bea76['options']?_0x3bea76[_0x44ca('0x1a')][_0x44ca('0x1e')]||null:null,'include':_0x3bea76[_0x44ca('0x1a')]?_0x3bea76[_0x44ca('0x1a')]['include']?_[_0x44ca('0x1f')](_0x3bea76['options'][_0x44ca('0x20')],function(_0x36c49e){return{'model':db[_0x36c49e['model']],'as':_0x36c49e['as'],'attributes':_0x36c49e['attributes'],'include':_0x36c49e['include']?_['map'](_0x36c49e[_0x44ca('0x20')],function(_0x15c454){return{'model':db[_0x15c454['model']],'as':_0x15c454['as'],'attributes':_0x15c454[_0x44ca('0x1d')],'include':_0x15c454[_0x44ca('0x20')]?_[_0x44ca('0x1f')](_0x15c454[_0x44ca('0x20')],function(_0x43008b){return{'model':db[_0x43008b[_0x44ca('0x21')]],'as':_0x43008b['as'],'attributes':_0x43008b[_0x44ca('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x44ca('0x22')](function(_0x70635b){logger[_0x44ca('0x16')](_0x44ca('0x18'),_0x3bea76);logger[_0x44ca('0xf')]('GetDynamics365Account',_0x3bea76,JSON[_0x44ca('0x11')](_0x70635b));_0x1fe960(_0x70635b);})['catch'](function(_0x38187b){logger['error'](_0x44ca('0x18'),_0x38187b[_0x44ca('0x14')],_0x3bea76);_0x342a08(_0x3b4626['error'](0x1f4,_0x38187b[_0x44ca('0x14')]));});});};exports['ShowDynamics365Account']=function(_0x4e0a2b){var _0x2c7283=this;return new Promise(function(_0x4e0669,_0x1567e2){return db[_0x44ca('0x19')][_0x44ca('0x23')]({'raw':_0x4e0a2b['options']?_0x4e0a2b['options']['raw']===undefined?!![]:![]:!![],'where':_0x4e0a2b[_0x44ca('0x1a')]?_0x4e0a2b[_0x44ca('0x1a')]['where']||null:null,'attributes':_0x4e0a2b[_0x44ca('0x1a')]?_0x4e0a2b['options'][_0x44ca('0x1d')]||null:null,'include':_0x4e0a2b[_0x44ca('0x1a')]?_0x4e0a2b[_0x44ca('0x1a')][_0x44ca('0x20')]?_[_0x44ca('0x1f')](_0x4e0a2b[_0x44ca('0x1a')][_0x44ca('0x20')],function(_0x29b75d){return{'model':db[_0x29b75d[_0x44ca('0x21')]],'as':_0x29b75d['as'],'attributes':_0x29b75d[_0x44ca('0x1d')],'include':_0x29b75d[_0x44ca('0x20')]?_[_0x44ca('0x1f')](_0x29b75d[_0x44ca('0x20')],function(_0x41f02e){return{'model':db[_0x41f02e['model']],'as':_0x41f02e['as'],'attributes':_0x41f02e['attributes'],'include':_0x41f02e[_0x44ca('0x20')]?_['map'](_0x41f02e[_0x44ca('0x20')],function(_0x4b70bd){return{'model':db[_0x4b70bd[_0x44ca('0x21')]],'as':_0x4b70bd['as'],'attributes':_0x4b70bd[_0x44ca('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x44ca('0x22')](function(_0x43e217){logger[_0x44ca('0x16')](_0x44ca('0x24'),_0x4e0a2b);logger[_0x44ca('0xf')](_0x44ca('0x24'),_0x4e0a2b,JSON[_0x44ca('0x11')](_0x43e217));_0x4e0669(_0x43e217);})[_0x44ca('0x25')](function(_0x142154){logger[_0x44ca('0x13')](_0x44ca('0x24'),_0x142154[_0x44ca('0x14')],_0x4e0a2b);_0x1567e2(_0x2c7283[_0x44ca('0x13')](0x1f4,_0x142154[_0x44ca('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index ed3e5a0..0b50944 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 _0x03e2=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','/:id','isAuthenticated','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy','multer'];(function(_0xdae179,_0x6a9d6){var _0xf44849=function(_0x5626f8){while(--_0x5626f8){_0xdae179['push'](_0xdae179['shift']());}};_0xf44849(++_0x6a9d6);}(_0x03e2,0x1af));var _0x203e=function(_0x4a7bbd,_0x3956ae){_0x4a7bbd=_0x4a7bbd-0x0;var _0xbf59f6=_0x03e2[_0x4a7bbd];return _0xbf59f6;};'use strict';var multer=require(_0x203e('0x0'));var util=require(_0x203e('0x1'));var path=require(_0x203e('0x2'));var timeout=require('connect-timeout');var express=require(_0x203e('0x3'));var router=express[_0x203e('0x4')]();var fs_extra=require(_0x203e('0x5'));var auth=require(_0x203e('0x6'));var interaction=require(_0x203e('0x7'));var config=require(_0x203e('0x8'));var controller=require(_0x203e('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x203e('0xa'),auth[_0x203e('0xb')](),controller['show']);router[_0x203e('0xc')](_0x203e('0xd'),auth[_0x203e('0xb')](),controller[_0x203e('0xe')]);router['get'](_0x203e('0xf'),auth[_0x203e('0xb')](),controller[_0x203e('0x10')]);router['get'](_0x203e('0x11'),auth[_0x203e('0xb')](),controller['getDescriptions']);router[_0x203e('0x12')]('/',auth[_0x203e('0xb')](),controller[_0x203e('0x13')]);router[_0x203e('0x14')](_0x203e('0xa'),auth[_0x203e('0xb')](),controller[_0x203e('0x15')]);router[_0x203e('0x16')](_0x203e('0xa'),auth['isAuthenticated'](),controller[_0x203e('0x17')]);module['exports']=router; \ No newline at end of file +var _0x2aee=['show','get','getSubjects','/:id/descriptions','getDescriptions','create','put','/:id','update','delete','destroy','exports','multer','path','express','Router','fs-extra','./intDynamics365Configuration.controller','isAuthenticated','index'];(function(_0x369fc4,_0x5e94f9){var _0x1fb362=function(_0x5451f4){while(--_0x5451f4){_0x369fc4['push'](_0x369fc4['shift']());}};_0x1fb362(++_0x5e94f9);}(_0x2aee,0x124));var _0xe2ae=function(_0x35a140,_0x3aeac6){_0x35a140=_0x35a140-0x0;var _0x30ab82=_0x2aee[_0x35a140];return _0x30ab82;};'use strict';var multer=require(_0xe2ae('0x0'));var util=require('util');var path=require(_0xe2ae('0x1'));var timeout=require('connect-timeout');var express=require(_0xe2ae('0x2'));var router=express[_0xe2ae('0x3')]();var fs_extra=require(_0xe2ae('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe2ae('0x5'));router['get']('/',auth[_0xe2ae('0x6')](),controller[_0xe2ae('0x7')]);router['get']('/:id',auth[_0xe2ae('0x6')](),controller[_0xe2ae('0x8')]);router[_0xe2ae('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xe2ae('0x9')]('/:id/subjects',auth[_0xe2ae('0x6')](),controller[_0xe2ae('0xa')]);router[_0xe2ae('0x9')](_0xe2ae('0xb'),auth[_0xe2ae('0x6')](),controller[_0xe2ae('0xc')]);router['post']('/',auth[_0xe2ae('0x6')](),controller[_0xe2ae('0xd')]);router[_0xe2ae('0xe')](_0xe2ae('0xf'),auth['isAuthenticated'](),controller[_0xe2ae('0x10')]);router[_0xe2ae('0x11')](_0xe2ae('0xf'),auth['isAuthenticated'](),controller[_0xe2ae('0x12')]);module[_0xe2ae('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 00bbb16..337ec66 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 _0xf0c8=['exports','STRING','incident','phonecall','sequelize'];(function(_0x28c65a,_0x622faf){var _0x9d64d=function(_0x1d212a){while(--_0x1d212a){_0x28c65a['push'](_0x28c65a['shift']());}};_0x9d64d(++_0x622faf);}(_0xf0c8,0x126));var _0x8f0c=function(_0xc55d64,_0x133f2d){_0xc55d64=_0xc55d64-0x0;var _0x4194f6=_0xf0c8[_0xc55d64];return _0x4194f6;};'use strict';var Sequelize=require(_0x8f0c('0x0'));module[_0x8f0c('0x1')]={'name':{'type':Sequelize[_0x8f0c('0x2')]},'description':{'type':Sequelize[_0x8f0c('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x8f0c('0x3'),_0x8f0c('0x4')),'defaultValue':_0x8f0c('0x3')}}; \ No newline at end of file +var _0x8f13=['phonecall','sequelize','exports','STRING','ENUM','incident'];(function(_0xc77eb5,_0x2d1c34){var _0x13ec09=function(_0xe02000){while(--_0xe02000){_0xc77eb5['push'](_0xc77eb5['shift']());}};_0x13ec09(++_0x2d1c34);}(_0x8f13,0x163));var _0x38f1=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x8f13[_0x34bf97];return _0x292719;};'use strict';var Sequelize=require(_0x38f1('0x0'));module[_0x38f1('0x1')]={'name':{'type':Sequelize[_0x38f1('0x2')]},'description':{'type':Sequelize[_0x38f1('0x2')]},'ticketType':{'type':Sequelize[_0x38f1('0x3')](_0x38f1('0x4'),_0x38f1('0x5')),'defaultValue':_0x38f1('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 45c4925..a054e45 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 _0x6474=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','sort','pick','filter','where','merge','includeAll','include','findAll','rows','params','keys','fields','options','find','create','body','getFields','findOne','length','order','hasOwnProperty','getSubjects','Dynamics365Field','getDescriptions','nolimit','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5ff6cb,_0x9200a6){var _0x62114=function(_0xc8cd0c){while(--_0xc8cd0c){_0x5ff6cb['push'](_0x5ff6cb['shift']());}};_0x62114(++_0x9200a6);}(_0x6474,0x103));var _0x4647=function(_0x51885b,_0x310685){_0x51885b=_0x51885b-0x0;var _0x4efee6=_0x6474[_0x51885b];return _0x4efee6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4647('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4647('0x1'));var rp=require(_0x4647('0x2'));var moment=require(_0x4647('0x3'));var BPromise=require(_0x4647('0x4'));var Mustache=require(_0x4647('0x5'));var util=require(_0x4647('0x6'));var path=require(_0x4647('0x7'));var sox=require(_0x4647('0x8'));var csv=require(_0x4647('0x9'));var ejs=require(_0x4647('0xa'));var fs=require('fs');var fs_extra=require(_0x4647('0xb'));var _=require(_0x4647('0xc'));var squel=require(_0x4647('0xd'));var crypto=require(_0x4647('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4647('0xf'));var toCsv=require(_0x4647('0x9'));var querystring=require('querystring');var Papa=require(_0x4647('0x10'));var Redis=require(_0x4647('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4647('0x12'));var as=require(_0x4647('0x13'));var hardwareService=require(_0x4647('0x14'));var logger=require(_0x4647('0x15'))(_0x4647('0x16'));var utils=require(_0x4647('0x17'));var config=require(_0x4647('0x18'));var licenseUtil=require(_0x4647('0x19'));var db=require(_0x4647('0x1a'))['db'];var jayson=require(_0x4647('0x1b'));var client=jayson['client'][_0x4647('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4f788a,_0x589708,_0x17cc65,_0x3eef80){return new BPromise(function(_0x307d46,_0x438fdf){var _0x2f9022=_0x3eef80||client;return _0x2f9022['request'](_0x4f788a,_0x17cc65)['then'](function(_0x2ce20b){logger['info'](_0x4647('0x1d'),_0x589708,_0x4647('0x1e'));logger[_0x4647('0x1f')](_0x4647('0x20'),_0x589708,_0x4647('0x1e'),JSON[_0x4647('0x21')](_0x2ce20b));if(_0x2ce20b[_0x4647('0x22')]){if(_0x2ce20b[_0x4647('0x22')][_0x4647('0x23')]===0x1f4){logger[_0x4647('0x22')](_0x4647('0x1d'),_0x589708,_0x2ce20b[_0x4647('0x22')][_0x4647('0x24')]);return _0x438fdf(_0x2ce20b[_0x4647('0x22')][_0x4647('0x24')]);}logger[_0x4647('0x22')](_0x4647('0x1d'),_0x589708,_0x2ce20b[_0x4647('0x22')]['message']);return _0x307d46(_0x2ce20b[_0x4647('0x22')][_0x4647('0x24')]);}else{logger['info'](_0x4647('0x1d'),_0x589708,'request\x20sent');_0x307d46(_0x2ce20b[_0x4647('0x25')][_0x4647('0x24')]);}})[_0x4647('0x26')](function(_0x14dbdc){logger[_0x4647('0x22')](_0x4647('0x1d'),_0x589708,_0x14dbdc);_0x438fdf(_0x14dbdc);});});}function respondWithStatusCode(_0xfd6b2a,_0x39fc0b){_0x39fc0b=_0x39fc0b||0xcc;return function(_0x4fbf36){if(_0x4fbf36){return _0xfd6b2a[_0x4647('0x27')](_0x39fc0b);}return _0xfd6b2a[_0x4647('0x28')](_0x39fc0b)[_0x4647('0x29')]();};}function respondWithResult(_0x3c5ea6,_0x49b621){_0x49b621=_0x49b621||0xc8;return function(_0x442a23){if(_0x442a23){return _0x3c5ea6[_0x4647('0x28')](_0x49b621)[_0x4647('0x2a')](_0x442a23);}};}function respondWithFilteredResult(_0x39a790,_0x555837){return function(_0xf2ed82){if(_0xf2ed82){var _0x5ef065=_0xf2ed82[_0x4647('0x2b')],_0x5b6c55=_0x555837[_0x4647('0x2c')],_0x44004e=_0x555837[_0x4647('0x2c')]+_0x555837[_0x4647('0x2d')],_0x1131a1;if(_0x44004e>=_0x5ef065){_0x44004e=_0x5ef065;_0x1131a1=0xc8;}else{_0x1131a1=0xce;}_0x39a790['status'](_0x1131a1);return _0x39a790['set'](_0x4647('0x2e'),_0x5b6c55+'-'+_0x44004e+'/'+_0x5ef065)['json'](_0xf2ed82);}return null;};}function patchUpdates(_0x310131){return function(_0x5bdf0a){try{jsonpatch[_0x4647('0x2f')](_0x5bdf0a,_0x310131,!![]);}catch(_0x4c2e9a){return BPromise[_0x4647('0x30')](_0x4c2e9a);}return _0x5bdf0a[_0x4647('0x31')]();};}function saveUpdates(_0x5bd3b6,_0x4ecc7a){return function(_0x596e73){if(_0x596e73){return _0x596e73[_0x4647('0x32')](_0x5bd3b6)[_0x4647('0x33')](function(_0x2db04a){return _0x2db04a;});}return null;};}function removeEntity(_0x5c644b,_0x154b93){return function(_0x190a6d){if(_0x190a6d){return _0x190a6d[_0x4647('0x34')]()['then'](function(){_0x5c644b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46909c,_0x578df8){return function(_0x531358){if(!_0x531358){_0x46909c[_0x4647('0x27')](0x194);}return _0x531358;};}function handleError(_0x58d6d6,_0xb17e07){_0xb17e07=_0xb17e07||0x1f4;return function(_0x5dd51c){logger[_0x4647('0x22')](_0x5dd51c[_0x4647('0x35')]);if(_0x5dd51c[_0x4647('0x36')]){delete _0x5dd51c[_0x4647('0x36')];}_0x58d6d6[_0x4647('0x28')](_0xb17e07)[_0x4647('0x37')](_0x5dd51c);};}exports[_0x4647('0x38')]=function(_0x39f929,_0x54ab36){var _0x7fb96c={},_0x2695ea={},_0x31f2af={'count':0x0,'rows':[]};var _0x459743=_['map'](db[_0x4647('0x39')][_0x4647('0x3a')],function(_0x314382){return{'name':_0x314382[_0x4647('0x3b')],'type':_0x314382[_0x4647('0x3c')][_0x4647('0x3d')]};});_0x2695ea[_0x4647('0x3e')]=_[_0x4647('0x3f')](_0x459743,_0x4647('0x36'));_0x2695ea[_0x4647('0x40')]=_['keys'](_0x39f929[_0x4647('0x40')]);_0x2695ea[_0x4647('0x41')]=_[_0x4647('0x42')](_0x2695ea[_0x4647('0x3e')],_0x2695ea[_0x4647('0x40')]);_0x7fb96c[_0x4647('0x43')]=_[_0x4647('0x42')](_0x2695ea[_0x4647('0x3e')],qs['fields'](_0x39f929['query']['fields']));_0x7fb96c[_0x4647('0x43')]=_0x7fb96c[_0x4647('0x43')]['length']?_0x7fb96c[_0x4647('0x43')]:_0x2695ea[_0x4647('0x3e')];if(!_0x39f929['query']['hasOwnProperty']('nolimit')){_0x7fb96c[_0x4647('0x2d')]=qs['limit'](_0x39f929[_0x4647('0x40')][_0x4647('0x2d')]);_0x7fb96c['offset']=qs[_0x4647('0x2c')](_0x39f929[_0x4647('0x40')][_0x4647('0x2c')]);}_0x7fb96c['order']=qs[_0x4647('0x44')](_0x39f929[_0x4647('0x40')][_0x4647('0x44')]);_0x7fb96c['where']=qs[_0x4647('0x41')](_[_0x4647('0x45')](_0x39f929[_0x4647('0x40')],_0x2695ea[_0x4647('0x41')]),_0x459743);if(_0x39f929[_0x4647('0x40')][_0x4647('0x46')]){_0x7fb96c[_0x4647('0x47')]=_['merge'](_0x7fb96c[_0x4647('0x47')],{'$or':_[_0x4647('0x3f')](_0x459743,function(_0x1b48c4){if(_0x1b48c4['type']!=='VIRTUAL'){var _0x23f42b={};_0x23f42b[_0x1b48c4['name']]={'$like':'%'+_0x39f929['query']['filter']+'%'};return _0x23f42b;}})});}_0x7fb96c=_[_0x4647('0x48')]({},_0x7fb96c,_0x39f929['options']);var _0x5a416c={'where':_0x7fb96c[_0x4647('0x47')]};return db[_0x4647('0x39')][_0x4647('0x2b')](_0x5a416c)[_0x4647('0x33')](function(_0x112d11){_0x31f2af[_0x4647('0x2b')]=_0x112d11;if(_0x39f929[_0x4647('0x40')][_0x4647('0x49')]){_0x7fb96c[_0x4647('0x4a')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x4647('0x4b')](_0x7fb96c);})['then'](function(_0x3a82b5){_0x31f2af[_0x4647('0x4c')]=_0x3a82b5;return _0x31f2af;})[_0x4647('0x33')](respondWithFilteredResult(_0x54ab36,_0x7fb96c))[_0x4647('0x26')](handleError(_0x54ab36,null));};exports['show']=function(_0x26d6e3,_0x428210){var _0x5c2af3={'raw':![],'where':{'id':_0x26d6e3[_0x4647('0x4d')]['id']}},_0x4a3f45={};_0x4a3f45[_0x4647('0x3e')]=_[_0x4647('0x4e')](db[_0x4647('0x39')]['rawAttributes']);_0x4a3f45['query']=_[_0x4647('0x4e')](_0x26d6e3[_0x4647('0x40')]);_0x4a3f45[_0x4647('0x41')]=_[_0x4647('0x42')](_0x4a3f45['model'],_0x4a3f45['query']);_0x5c2af3[_0x4647('0x43')]=_[_0x4647('0x42')](_0x4a3f45[_0x4647('0x3e')],qs[_0x4647('0x4f')](_0x26d6e3[_0x4647('0x40')][_0x4647('0x4f')]));_0x5c2af3[_0x4647('0x43')]=_0x5c2af3['attributes']['length']?_0x5c2af3[_0x4647('0x43')]:_0x4a3f45[_0x4647('0x3e')];if(_0x26d6e3[_0x4647('0x40')][_0x4647('0x49')]){_0x5c2af3[_0x4647('0x4a')]=[{'all':!![]}];}_0x5c2af3=_[_0x4647('0x48')]({},_0x5c2af3,_0x26d6e3[_0x4647('0x50')]);return db[_0x4647('0x39')][_0x4647('0x51')](_0x5c2af3)[_0x4647('0x33')](handleEntityNotFound(_0x428210,null))['then'](respondWithResult(_0x428210,null))[_0x4647('0x26')](handleError(_0x428210,null));};exports[_0x4647('0x52')]=function(_0x5964ed,_0x514854){return db[_0x4647('0x39')][_0x4647('0x52')](_0x5964ed['body'],{})[_0x4647('0x33')](respondWithResult(_0x514854,0xc9))['catch'](handleError(_0x514854,null));};exports['update']=function(_0x28a09c,_0x3d4677){if(_0x28a09c[_0x4647('0x53')]['id']){delete _0x28a09c['body']['id'];}return db[_0x4647('0x39')][_0x4647('0x51')]({'where':{'id':_0x28a09c[_0x4647('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3d4677,null))[_0x4647('0x33')](saveUpdates(_0x28a09c[_0x4647('0x53')],null))[_0x4647('0x33')](respondWithResult(_0x3d4677,null))[_0x4647('0x26')](handleError(_0x3d4677,null));};exports[_0x4647('0x34')]=function(_0x108b5c,_0x400450){return db['Dynamics365Configuration'][_0x4647('0x51')]({'where':{'id':_0x108b5c['params']['id']}})['then'](handleEntityNotFound(_0x400450,null))[_0x4647('0x33')](removeEntity(_0x400450,null))[_0x4647('0x26')](handleError(_0x400450,null));};exports[_0x4647('0x54')]=function(_0x557e86,_0x5ae081,_0x206c38){var _0x1d2946={};var _0x335661={};var _0x26400e;var _0x317e2f;return db[_0x4647('0x39')][_0x4647('0x55')]({'where':{'id':_0x557e86[_0x4647('0x4d')]['id']}})[_0x4647('0x33')](handleEntityNotFound(_0x5ae081,null))['then'](function(_0x5bb1d0){if(_0x5bb1d0){_0x26400e=_0x5bb1d0;_0x335661[_0x4647('0x3e')]=_[_0x4647('0x4e')](db['Dynamics365Field']['rawAttributes']);_0x335661[_0x4647('0x40')]=_[_0x4647('0x4e')](_0x557e86[_0x4647('0x40')]);_0x335661['filters']=_[_0x4647('0x42')](_0x335661[_0x4647('0x3e')],_0x335661[_0x4647('0x40')]);_0x1d2946[_0x4647('0x43')]=_['intersection'](_0x335661[_0x4647('0x3e')],qs[_0x4647('0x4f')](_0x557e86['query'][_0x4647('0x4f')]));_0x1d2946['attributes']=_0x1d2946[_0x4647('0x43')][_0x4647('0x56')]?_0x1d2946['attributes']:_0x335661[_0x4647('0x3e')];_0x1d2946[_0x4647('0x57')]=qs[_0x4647('0x44')](_0x557e86[_0x4647('0x40')][_0x4647('0x44')]);_0x1d2946[_0x4647('0x47')]=qs[_0x4647('0x41')](_[_0x4647('0x45')](_0x557e86[_0x4647('0x40')],_0x335661[_0x4647('0x41')]));if(_0x557e86[_0x4647('0x40')]['filter']){_0x1d2946[_0x4647('0x47')]=_[_0x4647('0x48')](_0x1d2946[_0x4647('0x47')],{'$or':_[_0x4647('0x3f')](_0x1d2946['attributes'],function(_0x4d3fe5){var _0x5675f4={};_0x5675f4[_0x4d3fe5]={'$like':'%'+_0x557e86[_0x4647('0x40')][_0x4647('0x46')]+'%'};return _0x5675f4;})});}_0x1d2946=_['merge']({},_0x1d2946,_0x557e86[_0x4647('0x50')]);return _0x26400e['getFields'](_0x1d2946);}})[_0x4647('0x33')](function(_0x4e2785){if(_0x4e2785){_0x317e2f=_0x4e2785['length'];if(!_0x557e86[_0x4647('0x40')][_0x4647('0x58')]('nolimit')){_0x1d2946['limit']=qs[_0x4647('0x2d')](_0x557e86[_0x4647('0x40')][_0x4647('0x2d')]);_0x1d2946['offset']=qs[_0x4647('0x2c')](_0x557e86[_0x4647('0x40')]['offset']);}return _0x26400e['getFields'](_0x1d2946);}})[_0x4647('0x33')](function(_0x376d39){if(_0x376d39){return _0x376d39?{'count':_0x317e2f,'rows':_0x376d39}:null;}})[_0x4647('0x33')](respondWithResult(_0x5ae081,null))['catch'](handleError(_0x5ae081,null));};exports[_0x4647('0x59')]=function(_0x30d542,_0xccacca,_0x48e0ac){var _0x262484={};var _0x1a2112={};var _0x222051;var _0x2f6bfb;return db[_0x4647('0x39')][_0x4647('0x55')]({'where':{'id':_0x30d542[_0x4647('0x4d')]['id']}})['then'](handleEntityNotFound(_0xccacca,null))[_0x4647('0x33')](function(_0x355d5b){if(_0x355d5b){_0x222051=_0x355d5b;_0x1a2112[_0x4647('0x3e')]=_[_0x4647('0x4e')](db[_0x4647('0x5a')]['rawAttributes']);_0x1a2112[_0x4647('0x40')]=_['keys'](_0x30d542['query']);_0x1a2112['filters']=_[_0x4647('0x42')](_0x1a2112[_0x4647('0x3e')],_0x1a2112[_0x4647('0x40')]);_0x262484[_0x4647('0x43')]=_[_0x4647('0x42')](_0x1a2112[_0x4647('0x3e')],qs[_0x4647('0x4f')](_0x30d542['query'][_0x4647('0x4f')]));_0x262484['attributes']=_0x262484[_0x4647('0x43')][_0x4647('0x56')]?_0x262484[_0x4647('0x43')]:_0x1a2112[_0x4647('0x3e')];_0x262484[_0x4647('0x57')]=qs['sort'](_0x30d542[_0x4647('0x40')]['sort']);_0x262484[_0x4647('0x47')]=qs[_0x4647('0x41')](_['pick'](_0x30d542[_0x4647('0x40')],_0x1a2112[_0x4647('0x41')]));if(_0x30d542['query'][_0x4647('0x46')]){_0x262484[_0x4647('0x47')]=_[_0x4647('0x48')](_0x262484[_0x4647('0x47')],{'$or':_[_0x4647('0x3f')](_0x262484[_0x4647('0x43')],function(_0x7e285){var _0x1a7aa9={};_0x1a7aa9[_0x7e285]={'$like':'%'+_0x30d542['query'][_0x4647('0x46')]+'%'};return _0x1a7aa9;})});}_0x262484=_['merge']({},_0x262484,_0x30d542[_0x4647('0x50')]);return _0x222051[_0x4647('0x59')](_0x262484);}})['then'](function(_0x288f77){if(_0x288f77){_0x2f6bfb=_0x288f77[_0x4647('0x56')];if(!_0x30d542[_0x4647('0x40')]['hasOwnProperty']('nolimit')){_0x262484[_0x4647('0x2d')]=qs['limit'](_0x30d542[_0x4647('0x40')][_0x4647('0x2d')]);_0x262484[_0x4647('0x2c')]=qs['offset'](_0x30d542['query']['offset']);}return _0x222051[_0x4647('0x59')](_0x262484);}})[_0x4647('0x33')](function(_0x5c4ab1){if(_0x5c4ab1){return _0x5c4ab1?{'count':_0x2f6bfb,'rows':_0x5c4ab1}:null;}})[_0x4647('0x33')](respondWithResult(_0xccacca,null))[_0x4647('0x26')](handleError(_0xccacca,null));};exports['getDescriptions']=function(_0x4cbd27,_0x558f45,_0x1580a3){var _0x114deb={};var _0x4af97f={};var _0x4d21ee;var _0x37522f;return db['Dynamics365Configuration'][_0x4647('0x55')]({'where':{'id':_0x4cbd27['params']['id']}})[_0x4647('0x33')](handleEntityNotFound(_0x558f45,null))[_0x4647('0x33')](function(_0x3ce75e){if(_0x3ce75e){_0x4d21ee=_0x3ce75e;_0x4af97f['model']=_['keys'](db[_0x4647('0x5a')][_0x4647('0x3a')]);_0x4af97f['query']=_[_0x4647('0x4e')](_0x4cbd27[_0x4647('0x40')]);_0x4af97f[_0x4647('0x41')]=_['intersection'](_0x4af97f[_0x4647('0x3e')],_0x4af97f[_0x4647('0x40')]);_0x114deb['attributes']=_[_0x4647('0x42')](_0x4af97f[_0x4647('0x3e')],qs['fields'](_0x4cbd27['query']['fields']));_0x114deb['attributes']=_0x114deb[_0x4647('0x43')]['length']?_0x114deb[_0x4647('0x43')]:_0x4af97f[_0x4647('0x3e')];_0x114deb[_0x4647('0x57')]=qs[_0x4647('0x44')](_0x4cbd27[_0x4647('0x40')]['sort']);_0x114deb[_0x4647('0x47')]=qs['filters'](_[_0x4647('0x45')](_0x4cbd27[_0x4647('0x40')],_0x4af97f[_0x4647('0x41')]));if(_0x4cbd27[_0x4647('0x40')][_0x4647('0x46')]){_0x114deb[_0x4647('0x47')]=_[_0x4647('0x48')](_0x114deb['where'],{'$or':_[_0x4647('0x3f')](_0x114deb['attributes'],function(_0x4d732d){var _0x1d23bc={};_0x1d23bc[_0x4d732d]={'$like':'%'+_0x4cbd27[_0x4647('0x40')][_0x4647('0x46')]+'%'};return _0x1d23bc;})});}_0x114deb=_['merge']({},_0x114deb,_0x4cbd27[_0x4647('0x50')]);return _0x4d21ee[_0x4647('0x5b')](_0x114deb);}})[_0x4647('0x33')](function(_0xd64d6a){if(_0xd64d6a){_0x37522f=_0xd64d6a[_0x4647('0x56')];if(!_0x4cbd27[_0x4647('0x40')][_0x4647('0x58')](_0x4647('0x5c'))){_0x114deb[_0x4647('0x2d')]=qs['limit'](_0x4cbd27[_0x4647('0x40')][_0x4647('0x2d')]);_0x114deb[_0x4647('0x2c')]=qs[_0x4647('0x2c')](_0x4cbd27[_0x4647('0x40')][_0x4647('0x2c')]);}return _0x4d21ee['getDescriptions'](_0x114deb);}})['then'](function(_0x1feb47){if(_0x1feb47){return _0x1feb47?{'count':_0x37522f,'rows':_0x1feb47}:null;}})[_0x4647('0x33')](respondWithResult(_0x558f45,null))[_0x4647('0x26')](handleError(_0x558f45,null));}; \ No newline at end of file +var _0x8875=['rows','show','options','create','body','update','find','params','getFields','Dynamics365Field','getSubjects','getDescriptions','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','http','request','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','Dynamics365Configuration,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','key','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','include'];(function(_0x324d02,_0x6d9c0b){var _0x3d4f59=function(_0x279f6b){while(--_0x279f6b){_0x324d02['push'](_0x324d02['shift']());}};_0x3d4f59(++_0x6d9c0b);}(_0x8875,0x67));var _0x5887=function(_0x563b8d,_0x31f0cd){_0x563b8d=_0x563b8d-0x0;var _0x258753=_0x8875[_0x563b8d];return _0x258753;};'use strict';var pdf=require(_0x5887('0x0'));var emlformat=require(_0x5887('0x1'));var rimraf=require(_0x5887('0x2'));var zipdir=require(_0x5887('0x3'));var jsonpatch=require(_0x5887('0x4'));var rp=require(_0x5887('0x5'));var moment=require(_0x5887('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x5887('0x7'));var util=require(_0x5887('0x8'));var path=require('path');var sox=require(_0x5887('0x9'));var csv=require(_0x5887('0xa'));var ejs=require(_0x5887('0xb'));var fs=require('fs');var fs_extra=require(_0x5887('0xc'));var _=require('lodash');var squel=require(_0x5887('0xd'));var crypto=require('crypto');var jsforce=require(_0x5887('0xe'));var deskjs=require(_0x5887('0xf'));var toCsv=require(_0x5887('0xa'));var querystring=require('querystring');var Papa=require(_0x5887('0x10'));var Redis=require(_0x5887('0x11'));var authService=require(_0x5887('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5887('0x13'));var logger=require(_0x5887('0x14'))(_0x5887('0x15'));var utils=require(_0x5887('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5887('0x17'));var db=require(_0x5887('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x5887('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x29cf4d,_0x3f13af,_0x1d2755,_0x5c8747){return new BPromise(function(_0xb6d150,_0x52c0a9){var _0x58826c=_0x5c8747||client;return _0x58826c[_0x5887('0x1a')](_0x29cf4d,_0x1d2755)[_0x5887('0x1b')](function(_0x1cd00f){logger[_0x5887('0x1c')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3f13af,_0x5887('0x1d'));logger[_0x5887('0x1e')](_0x5887('0x1f'),_0x3f13af,_0x5887('0x1d'),JSON[_0x5887('0x20')](_0x1cd00f));if(_0x1cd00f['error']){if(_0x1cd00f[_0x5887('0x21')]['code']===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x3f13af,_0x1cd00f[_0x5887('0x21')][_0x5887('0x22')]);return _0x52c0a9(_0x1cd00f[_0x5887('0x21')][_0x5887('0x22')]);}logger['error'](_0x5887('0x23'),_0x3f13af,_0x1cd00f[_0x5887('0x21')][_0x5887('0x22')]);return _0xb6d150(_0x1cd00f[_0x5887('0x21')]['message']);}else{logger[_0x5887('0x1c')](_0x5887('0x23'),_0x3f13af,'request\x20sent');_0xb6d150(_0x1cd00f[_0x5887('0x24')][_0x5887('0x22')]);}})[_0x5887('0x25')](function(_0x506ea1){logger[_0x5887('0x21')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3f13af,_0x506ea1);_0x52c0a9(_0x506ea1);});});}function respondWithStatusCode(_0x5bd46f,_0x36dd53){_0x36dd53=_0x36dd53||0xcc;return function(_0x3d9883){if(_0x3d9883){return _0x5bd46f[_0x5887('0x26')](_0x36dd53);}return _0x5bd46f[_0x5887('0x27')](_0x36dd53)[_0x5887('0x28')]();};}function respondWithResult(_0x58fbf6,_0x23cb77){_0x23cb77=_0x23cb77||0xc8;return function(_0x1afd84){if(_0x1afd84){return _0x58fbf6[_0x5887('0x27')](_0x23cb77)[_0x5887('0x29')](_0x1afd84);}};}function respondWithFilteredResult(_0x497e3e,_0x2a4bae){return function(_0x37707c){if(_0x37707c){var _0x4bcf33=_0x37707c[_0x5887('0x2a')],_0x3a84c6=_0x2a4bae[_0x5887('0x2b')],_0x1ef057=_0x2a4bae[_0x5887('0x2b')]+_0x2a4bae[_0x5887('0x2c')],_0x78e81f;if(_0x1ef057>=_0x4bcf33){_0x1ef057=_0x4bcf33;_0x78e81f=0xc8;}else{_0x78e81f=0xce;}_0x497e3e['status'](_0x78e81f);return _0x497e3e['set'](_0x5887('0x2d'),_0x3a84c6+'-'+_0x1ef057+'/'+_0x4bcf33)['json'](_0x37707c);}return null;};}function patchUpdates(_0x51f79a){return function(_0x3218b0){try{jsonpatch[_0x5887('0x2e')](_0x3218b0,_0x51f79a,!![]);}catch(_0x5e5280){return BPromise[_0x5887('0x2f')](_0x5e5280);}return _0x3218b0[_0x5887('0x30')]();};}function saveUpdates(_0x2fe748,_0x5e3bde){return function(_0x28680a){if(_0x28680a){return _0x28680a['update'](_0x2fe748)['then'](function(_0x3160ca){return _0x3160ca;});}return null;};}function removeEntity(_0x31bf72,_0x107e5f){return function(_0x167109){if(_0x167109){return _0x167109['destroy']()[_0x5887('0x1b')](function(){_0x31bf72[_0x5887('0x27')](0xcc)[_0x5887('0x28')]();});}};}function handleEntityNotFound(_0x28828e,_0x474b94){return function(_0x3dc09c){if(!_0x3dc09c){_0x28828e['sendStatus'](0x194);}return _0x3dc09c;};}function handleError(_0x4e2857,_0x4cee56){_0x4cee56=_0x4cee56||0x1f4;return function(_0x3c7ff4){logger[_0x5887('0x21')](_0x3c7ff4[_0x5887('0x31')]);if(_0x3c7ff4[_0x5887('0x32')]){delete _0x3c7ff4[_0x5887('0x32')];}_0x4e2857['status'](_0x4cee56)[_0x5887('0x33')](_0x3c7ff4);};}exports[_0x5887('0x34')]=function(_0x127599,_0xd138d0){var _0x4d47f6={},_0x3c6a99={},_0x406f17={'count':0x0,'rows':[]};var _0x48a92e=_[_0x5887('0x35')](db[_0x5887('0x36')][_0x5887('0x37')],function(_0x284ebc){return{'name':_0x284ebc[_0x5887('0x38')],'type':_0x284ebc['type'][_0x5887('0x39')]};});_0x3c6a99['model']=_[_0x5887('0x35')](_0x48a92e,_0x5887('0x32'));_0x3c6a99['query']=_[_0x5887('0x3a')](_0x127599[_0x5887('0x3b')]);_0x3c6a99[_0x5887('0x3c')]=_['intersection'](_0x3c6a99[_0x5887('0x3d')],_0x3c6a99[_0x5887('0x3b')]);_0x4d47f6['attributes']=_[_0x5887('0x3e')](_0x3c6a99[_0x5887('0x3d')],qs[_0x5887('0x3f')](_0x127599[_0x5887('0x3b')][_0x5887('0x3f')]));_0x4d47f6[_0x5887('0x40')]=_0x4d47f6['attributes'][_0x5887('0x41')]?_0x4d47f6[_0x5887('0x40')]:_0x3c6a99[_0x5887('0x3d')];if(!_0x127599['query'][_0x5887('0x42')](_0x5887('0x43'))){_0x4d47f6[_0x5887('0x2c')]=qs[_0x5887('0x2c')](_0x127599[_0x5887('0x3b')]['limit']);_0x4d47f6[_0x5887('0x2b')]=qs[_0x5887('0x2b')](_0x127599[_0x5887('0x3b')][_0x5887('0x2b')]);}_0x4d47f6[_0x5887('0x44')]=qs[_0x5887('0x45')](_0x127599[_0x5887('0x3b')][_0x5887('0x45')]);_0x4d47f6[_0x5887('0x46')]=qs[_0x5887('0x3c')](_[_0x5887('0x47')](_0x127599[_0x5887('0x3b')],_0x3c6a99[_0x5887('0x3c')]),_0x48a92e);if(_0x127599[_0x5887('0x3b')][_0x5887('0x48')]){_0x4d47f6['where']=_[_0x5887('0x49')](_0x4d47f6['where'],{'$or':_[_0x5887('0x35')](_0x48a92e,function(_0x23400c){if(_0x23400c[_0x5887('0x4a')]!==_0x5887('0x4b')){var _0x2d85ff={};_0x2d85ff[_0x23400c[_0x5887('0x32')]]={'$like':'%'+_0x127599[_0x5887('0x3b')]['filter']+'%'};return _0x2d85ff;}})});}_0x4d47f6=_[_0x5887('0x49')]({},_0x4d47f6,_0x127599['options']);var _0x1d7a32={'where':_0x4d47f6['where']};return db[_0x5887('0x36')]['count'](_0x1d7a32)[_0x5887('0x1b')](function(_0x13d983){_0x406f17[_0x5887('0x2a')]=_0x13d983;if(_0x127599[_0x5887('0x3b')]['includeAll']){_0x4d47f6[_0x5887('0x4c')]=[{'all':!![]}];}return db[_0x5887('0x36')]['findAll'](_0x4d47f6);})[_0x5887('0x1b')](function(_0xcd4e68){_0x406f17[_0x5887('0x4d')]=_0xcd4e68;return _0x406f17;})[_0x5887('0x1b')](respondWithFilteredResult(_0xd138d0,_0x4d47f6))[_0x5887('0x25')](handleError(_0xd138d0,null));};exports[_0x5887('0x4e')]=function(_0x411d04,_0x593796){var _0x195dcb={'raw':![],'where':{'id':_0x411d04['params']['id']}},_0x2f8e00={};_0x2f8e00['model']=_[_0x5887('0x3a')](db[_0x5887('0x36')][_0x5887('0x37')]);_0x2f8e00[_0x5887('0x3b')]=_[_0x5887('0x3a')](_0x411d04[_0x5887('0x3b')]);_0x2f8e00[_0x5887('0x3c')]=_['intersection'](_0x2f8e00[_0x5887('0x3d')],_0x2f8e00[_0x5887('0x3b')]);_0x195dcb['attributes']=_[_0x5887('0x3e')](_0x2f8e00[_0x5887('0x3d')],qs[_0x5887('0x3f')](_0x411d04['query'][_0x5887('0x3f')]));_0x195dcb[_0x5887('0x40')]=_0x195dcb[_0x5887('0x40')][_0x5887('0x41')]?_0x195dcb[_0x5887('0x40')]:_0x2f8e00[_0x5887('0x3d')];if(_0x411d04[_0x5887('0x3b')]['includeAll']){_0x195dcb['include']=[{'all':!![]}];}_0x195dcb=_[_0x5887('0x49')]({},_0x195dcb,_0x411d04[_0x5887('0x4f')]);return db[_0x5887('0x36')]['find'](_0x195dcb)[_0x5887('0x1b')](handleEntityNotFound(_0x593796,null))[_0x5887('0x1b')](respondWithResult(_0x593796,null))['catch'](handleError(_0x593796,null));};exports[_0x5887('0x50')]=function(_0x256182,_0x260d27){return db[_0x5887('0x36')]['create'](_0x256182[_0x5887('0x51')],{})['then'](respondWithResult(_0x260d27,0xc9))[_0x5887('0x25')](handleError(_0x260d27,null));};exports[_0x5887('0x52')]=function(_0x4f0771,_0x1dec46){if(_0x4f0771['body']['id']){delete _0x4f0771['body']['id'];}return db['Dynamics365Configuration'][_0x5887('0x53')]({'where':{'id':_0x4f0771[_0x5887('0x54')]['id']}})[_0x5887('0x1b')](handleEntityNotFound(_0x1dec46,null))['then'](saveUpdates(_0x4f0771[_0x5887('0x51')],null))[_0x5887('0x1b')](respondWithResult(_0x1dec46,null))[_0x5887('0x25')](handleError(_0x1dec46,null));};exports['destroy']=function(_0x22f18a,_0x3a5762){return db[_0x5887('0x36')]['find']({'where':{'id':_0x22f18a['params']['id']}})[_0x5887('0x1b')](handleEntityNotFound(_0x3a5762,null))['then'](removeEntity(_0x3a5762,null))['catch'](handleError(_0x3a5762,null));};exports[_0x5887('0x55')]=function(_0x580de0,_0x12a01d,_0x399f85){var _0x170e9f={};var _0x544a55={};var _0xbf9876;var _0x587351;return db[_0x5887('0x36')]['findOne']({'where':{'id':_0x580de0['params']['id']}})[_0x5887('0x1b')](handleEntityNotFound(_0x12a01d,null))[_0x5887('0x1b')](function(_0x2118c6){if(_0x2118c6){_0xbf9876=_0x2118c6;_0x544a55['model']=_[_0x5887('0x3a')](db[_0x5887('0x56')][_0x5887('0x37')]);_0x544a55[_0x5887('0x3b')]=_[_0x5887('0x3a')](_0x580de0[_0x5887('0x3b')]);_0x544a55[_0x5887('0x3c')]=_['intersection'](_0x544a55[_0x5887('0x3d')],_0x544a55['query']);_0x170e9f[_0x5887('0x40')]=_['intersection'](_0x544a55[_0x5887('0x3d')],qs[_0x5887('0x3f')](_0x580de0[_0x5887('0x3b')][_0x5887('0x3f')]));_0x170e9f[_0x5887('0x40')]=_0x170e9f[_0x5887('0x40')][_0x5887('0x41')]?_0x170e9f[_0x5887('0x40')]:_0x544a55[_0x5887('0x3d')];_0x170e9f[_0x5887('0x44')]=qs[_0x5887('0x45')](_0x580de0[_0x5887('0x3b')]['sort']);_0x170e9f[_0x5887('0x46')]=qs[_0x5887('0x3c')](_[_0x5887('0x47')](_0x580de0[_0x5887('0x3b')],_0x544a55[_0x5887('0x3c')]));if(_0x580de0['query'][_0x5887('0x48')]){_0x170e9f['where']=_[_0x5887('0x49')](_0x170e9f[_0x5887('0x46')],{'$or':_[_0x5887('0x35')](_0x170e9f[_0x5887('0x40')],function(_0x52b549){var _0x7b9011={};_0x7b9011[_0x52b549]={'$like':'%'+_0x580de0['query'][_0x5887('0x48')]+'%'};return _0x7b9011;})});}_0x170e9f=_[_0x5887('0x49')]({},_0x170e9f,_0x580de0['options']);return _0xbf9876[_0x5887('0x55')](_0x170e9f);}})['then'](function(_0x3b55f2){if(_0x3b55f2){_0x587351=_0x3b55f2['length'];if(!_0x580de0[_0x5887('0x3b')][_0x5887('0x42')]('nolimit')){_0x170e9f[_0x5887('0x2c')]=qs[_0x5887('0x2c')](_0x580de0[_0x5887('0x3b')]['limit']);_0x170e9f['offset']=qs[_0x5887('0x2b')](_0x580de0[_0x5887('0x3b')][_0x5887('0x2b')]);}return _0xbf9876[_0x5887('0x55')](_0x170e9f);}})[_0x5887('0x1b')](function(_0x341ff9){if(_0x341ff9){return _0x341ff9?{'count':_0x587351,'rows':_0x341ff9}:null;}})[_0x5887('0x1b')](respondWithResult(_0x12a01d,null))[_0x5887('0x25')](handleError(_0x12a01d,null));};exports[_0x5887('0x57')]=function(_0x265e48,_0x351bce,_0x57cfd5){var _0x3a4004={};var _0x23eb11={};var _0xaf95a1;var _0x57a77f;return db[_0x5887('0x36')]['findOne']({'where':{'id':_0x265e48[_0x5887('0x54')]['id']}})[_0x5887('0x1b')](handleEntityNotFound(_0x351bce,null))[_0x5887('0x1b')](function(_0x2bc895){if(_0x2bc895){_0xaf95a1=_0x2bc895;_0x23eb11[_0x5887('0x3d')]=_[_0x5887('0x3a')](db[_0x5887('0x56')][_0x5887('0x37')]);_0x23eb11[_0x5887('0x3b')]=_[_0x5887('0x3a')](_0x265e48[_0x5887('0x3b')]);_0x23eb11['filters']=_['intersection'](_0x23eb11['model'],_0x23eb11['query']);_0x3a4004[_0x5887('0x40')]=_[_0x5887('0x3e')](_0x23eb11['model'],qs[_0x5887('0x3f')](_0x265e48[_0x5887('0x3b')][_0x5887('0x3f')]));_0x3a4004['attributes']=_0x3a4004[_0x5887('0x40')]['length']?_0x3a4004[_0x5887('0x40')]:_0x23eb11[_0x5887('0x3d')];_0x3a4004[_0x5887('0x44')]=qs['sort'](_0x265e48[_0x5887('0x3b')][_0x5887('0x45')]);_0x3a4004[_0x5887('0x46')]=qs[_0x5887('0x3c')](_[_0x5887('0x47')](_0x265e48['query'],_0x23eb11[_0x5887('0x3c')]));if(_0x265e48[_0x5887('0x3b')][_0x5887('0x48')]){_0x3a4004[_0x5887('0x46')]=_[_0x5887('0x49')](_0x3a4004[_0x5887('0x46')],{'$or':_[_0x5887('0x35')](_0x3a4004[_0x5887('0x40')],function(_0x5c07e7){var _0x5c3387={};_0x5c3387[_0x5c07e7]={'$like':'%'+_0x265e48[_0x5887('0x3b')][_0x5887('0x48')]+'%'};return _0x5c3387;})});}_0x3a4004=_['merge']({},_0x3a4004,_0x265e48[_0x5887('0x4f')]);return _0xaf95a1[_0x5887('0x57')](_0x3a4004);}})[_0x5887('0x1b')](function(_0x24115e){if(_0x24115e){_0x57a77f=_0x24115e['length'];if(!_0x265e48[_0x5887('0x3b')][_0x5887('0x42')](_0x5887('0x43'))){_0x3a4004[_0x5887('0x2c')]=qs[_0x5887('0x2c')](_0x265e48[_0x5887('0x3b')]['limit']);_0x3a4004['offset']=qs[_0x5887('0x2b')](_0x265e48[_0x5887('0x3b')][_0x5887('0x2b')]);}return _0xaf95a1[_0x5887('0x57')](_0x3a4004);}})[_0x5887('0x1b')](function(_0x476829){if(_0x476829){return _0x476829?{'count':_0x57a77f,'rows':_0x476829}:null;}})[_0x5887('0x1b')](respondWithResult(_0x351bce,null))[_0x5887('0x25')](handleError(_0x351bce,null));};exports[_0x5887('0x58')]=function(_0x47b7c5,_0x153349,_0x1e16fc){var _0x4ccfb8={};var _0x4419d0={};var _0x2a43e8;var _0x6cde50;return db[_0x5887('0x36')][_0x5887('0x59')]({'where':{'id':_0x47b7c5[_0x5887('0x54')]['id']}})[_0x5887('0x1b')](handleEntityNotFound(_0x153349,null))['then'](function(_0xd1be74){if(_0xd1be74){_0x2a43e8=_0xd1be74;_0x4419d0['model']=_['keys'](db[_0x5887('0x56')][_0x5887('0x37')]);_0x4419d0['query']=_[_0x5887('0x3a')](_0x47b7c5[_0x5887('0x3b')]);_0x4419d0[_0x5887('0x3c')]=_['intersection'](_0x4419d0['model'],_0x4419d0[_0x5887('0x3b')]);_0x4ccfb8['attributes']=_[_0x5887('0x3e')](_0x4419d0[_0x5887('0x3d')],qs[_0x5887('0x3f')](_0x47b7c5['query'][_0x5887('0x3f')]));_0x4ccfb8['attributes']=_0x4ccfb8[_0x5887('0x40')][_0x5887('0x41')]?_0x4ccfb8[_0x5887('0x40')]:_0x4419d0[_0x5887('0x3d')];_0x4ccfb8[_0x5887('0x44')]=qs[_0x5887('0x45')](_0x47b7c5[_0x5887('0x3b')][_0x5887('0x45')]);_0x4ccfb8[_0x5887('0x46')]=qs[_0x5887('0x3c')](_[_0x5887('0x47')](_0x47b7c5['query'],_0x4419d0['filters']));if(_0x47b7c5[_0x5887('0x3b')][_0x5887('0x48')]){_0x4ccfb8[_0x5887('0x46')]=_['merge'](_0x4ccfb8[_0x5887('0x46')],{'$or':_['map'](_0x4ccfb8[_0x5887('0x40')],function(_0x4ffc00){var _0x4d56c2={};_0x4d56c2[_0x4ffc00]={'$like':'%'+_0x47b7c5['query'][_0x5887('0x48')]+'%'};return _0x4d56c2;})});}_0x4ccfb8=_['merge']({},_0x4ccfb8,_0x47b7c5[_0x5887('0x4f')]);return _0x2a43e8[_0x5887('0x58')](_0x4ccfb8);}})['then'](function(_0x494fd7){if(_0x494fd7){_0x6cde50=_0x494fd7['length'];if(!_0x47b7c5[_0x5887('0x3b')][_0x5887('0x42')](_0x5887('0x43'))){_0x4ccfb8[_0x5887('0x2c')]=qs[_0x5887('0x2c')](_0x47b7c5[_0x5887('0x3b')]['limit']);_0x4ccfb8['offset']=qs[_0x5887('0x2b')](_0x47b7c5[_0x5887('0x3b')][_0x5887('0x2b')]);}return _0x2a43e8[_0x5887('0x58')](_0x4ccfb8);}})['then'](function(_0x543b52){if(_0x543b52){return _0x543b52?{'count':_0x6cde50,'rows':_0x543b52}:null;}})[_0x5887('0x1b')](respondWithResult(_0x153349,null))['catch'](handleError(_0x153349,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index a280ba1..9a5ac1c 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 _0xc0b0=['exports','Dynamics365Configuration','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes'];(function(_0x1991b5,_0x3ae379){var _0x374f6d=function(_0x4b5763){while(--_0x4b5763){_0x1991b5['push'](_0x1991b5['shift']());}};_0x374f6d(++_0x3ae379);}(_0xc0b0,0x19a));var _0x0c0b=function(_0x9fefd0,_0x22ea30){_0x9fefd0=_0x9fefd0-0x0;var _0x57ec55=_0xc0b0[_0x9fefd0];return _0x57ec55;};'use strict';var _=require(_0x0c0b('0x0'));var util=require(_0x0c0b('0x1'));var logger=require(_0x0c0b('0x2'))(_0x0c0b('0x3'));var moment=require(_0x0c0b('0x4'));var BPromise=require('bluebird');var rp=require(_0x0c0b('0x5'));var fs=require('fs');var path=require(_0x0c0b('0x6'));var rimraf=require(_0x0c0b('0x7'));var config=require(_0x0c0b('0x8'));var attributes=require(_0x0c0b('0x9'));module[_0x0c0b('0xa')]=function(_0x1742c9,_0x13dc83){return _0x1742c9['define'](_0x0c0b('0xb'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa69f=['define','int_dynamics365_configurations','lodash','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x58b087,_0x81ed6d){var _0x5bdd81=function(_0x23b360){while(--_0x23b360){_0x58b087['push'](_0x58b087['shift']());}};_0x5bdd81(++_0x81ed6d);}(_0xa69f,0x182));var _0xfa69=function(_0x43cac7,_0x33fe31){_0x43cac7=_0x43cac7-0x0;var _0x375885=_0xa69f[_0x43cac7];return _0x375885;};'use strict';var _=require(_0xfa69('0x0'));var util=require('util');var logger=require(_0xfa69('0x1'))(_0xfa69('0x2'));var moment=require('moment');var BPromise=require(_0xfa69('0x3'));var rp=require(_0xfa69('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfa69('0x5'));var config=require('../../config/environment');var attributes=require('./intDynamics365Configuration.attributes');module['exports']=function(_0x1f3f4c,_0x2c283e){return _0x1f3f4c[_0xfa69('0x6')]('Dynamics365Configuration',attributes,{'tableName':_0xfa69('0x7'),'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 1eac78f..f144d32 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 _0xcdea=['lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0xcdea,0x99));var _0xacde=function(_0x9edfd5,_0x286486){_0x9edfd5=_0x9edfd5-0x0;var _0x330738=_0xcdea[_0x9edfd5];return _0x330738;};'use strict';var _=require(_0xacde('0x0'));var util=require('util');var moment=require(_0xacde('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xacde('0x2'));var db=require(_0xacde('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xacde('0x4'))(_0xacde('0x5'));var config=require(_0xacde('0x6'));var jayson=require(_0xacde('0x7'));var client=jayson[_0xacde('0x8')][_0xacde('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x478125,_0x530486,_0x1eff9e){return new BPromise(function(_0x13b94d,_0x2247a2){return client['request'](_0x478125,_0x1eff9e)['then'](function(_0x2629a6){logger[_0xacde('0xa')](_0xacde('0xb'),_0x530486,_0xacde('0xc'));logger[_0xacde('0xd')](_0xacde('0xe'),_0x530486,_0xacde('0xc'),JSON['stringify'](_0x2629a6));if(_0x2629a6[_0xacde('0xf')]){if(_0x2629a6[_0xacde('0xf')]['code']===0x1f4){logger['error'](_0xacde('0xb'),_0x530486,_0x2629a6[_0xacde('0xf')][_0xacde('0x10')]);return _0x2247a2(_0x2629a6[_0xacde('0xf')][_0xacde('0x10')]);}logger[_0xacde('0xf')](_0xacde('0xb'),_0x530486,_0x2629a6[_0xacde('0xf')][_0xacde('0x10')]);return _0x13b94d(_0x2629a6[_0xacde('0xf')][_0xacde('0x10')]);}else{logger[_0xacde('0xa')](_0xacde('0xb'),_0x530486,_0xacde('0xc'));_0x13b94d(_0x2629a6['result'][_0xacde('0x10')]);}})['catch'](function(_0x3ad45d){logger[_0xacde('0xf')](_0xacde('0xb'),_0x530486,_0x3ad45d);_0x2247a2(_0x3ad45d);});});} \ No newline at end of file +var _0xa650=['request\x20sent','debug','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Dynamics365Configuration,\x20%s,\x20%s'];(function(_0x4294c0,_0x19dab2){var _0x488559=function(_0x1dda90){while(--_0x1dda90){_0x4294c0['push'](_0x4294c0['shift']());}};_0x488559(++_0x19dab2);}(_0xa650,0x117));var _0x0a65=function(_0x5003a9,_0x450f86){_0x5003a9=_0x5003a9-0x0;var _0x567049=_0xa650[_0x5003a9];return _0x567049;};'use strict';var _=require(_0x0a65('0x0'));var util=require(_0x0a65('0x1'));var moment=require(_0x0a65('0x2'));var BPromise=require(_0x0a65('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a65('0x4'));var db=require(_0x0a65('0x5'))['db'];var utils=require(_0x0a65('0x6'));var logger=require(_0x0a65('0x7'))(_0x0a65('0x8'));var config=require(_0x0a65('0x9'));var jayson=require(_0x0a65('0xa'));var client=jayson['client'][_0x0a65('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bc783,_0x1cbacd,_0x5794b7){return new BPromise(function(_0x56c8f0,_0x5bb032){return client[_0x0a65('0xc')](_0x3bc783,_0x5794b7)['then'](function(_0x33269e){logger[_0x0a65('0xd')](_0x0a65('0xe'),_0x1cbacd,_0x0a65('0xf'));logger[_0x0a65('0x10')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x1cbacd,_0x0a65('0xf'),JSON['stringify'](_0x33269e));if(_0x33269e[_0x0a65('0x11')]){if(_0x33269e[_0x0a65('0x11')][_0x0a65('0x12')]===0x1f4){logger['error'](_0x0a65('0xe'),_0x1cbacd,_0x33269e[_0x0a65('0x11')][_0x0a65('0x13')]);return _0x5bb032(_0x33269e[_0x0a65('0x11')][_0x0a65('0x13')]);}logger[_0x0a65('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1cbacd,_0x33269e['error'][_0x0a65('0x13')]);return _0x56c8f0(_0x33269e[_0x0a65('0x11')][_0x0a65('0x13')]);}else{logger[_0x0a65('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1cbacd,_0x0a65('0xf'));_0x56c8f0(_0x33269e[_0x0a65('0x14')][_0x0a65('0x13')]);}})['catch'](function(_0x254a17){logger[_0x0a65('0x11')](_0x0a65('0xe'),_0x1cbacd,_0x254a17);_0x5bb032(_0x254a17);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 20d3945..6f711d4 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 _0xad68=['create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','index','show','post','isAuthenticated'];(function(_0x1df64b,_0x323c28){var _0x262e3b=function(_0x47ea15){while(--_0x47ea15){_0x1df64b['push'](_0x1df64b['shift']());}};_0x262e3b(++_0x323c28);}(_0xad68,0x102));var _0x8ad6=function(_0x23f3fe,_0x37a19c){_0x23f3fe=_0x23f3fe-0x0;var _0x1b1cb1=_0xad68[_0x23f3fe];return _0x1b1cb1;};'use strict';var multer=require(_0x8ad6('0x0'));var util=require(_0x8ad6('0x1'));var path=require(_0x8ad6('0x2'));var timeout=require(_0x8ad6('0x3'));var express=require('express');var router=express[_0x8ad6('0x4')]();var fs_extra=require(_0x8ad6('0x5'));var auth=require(_0x8ad6('0x6'));var interaction=require(_0x8ad6('0x7'));var config=require(_0x8ad6('0x8'));var controller=require(_0x8ad6('0x9'));router[_0x8ad6('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ad6('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8ad6('0xc')]);router[_0x8ad6('0xd')]('/',auth[_0x8ad6('0xe')](),controller[_0x8ad6('0xf')]);router[_0x8ad6('0x10')](_0x8ad6('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x8ad6('0x12')](_0x8ad6('0x11'),auth['isAuthenticated'](),controller[_0x8ad6('0x13')]);module[_0x8ad6('0x14')]=router; \ No newline at end of file +var _0x477a=['create','exports','multer','path','connect-timeout','Router','fs-extra','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0x386f48,_0x5a23e9){var _0x2a5fad=function(_0x5a84ab){while(--_0x5a84ab){_0x386f48['push'](_0x386f48['shift']());}};_0x2a5fad(++_0x5a23e9);}(_0x477a,0x1e2));var _0xa477=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x477a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa477('0x0'));var util=require('util');var path=require(_0xa477('0x1'));var timeout=require(_0xa477('0x2'));var express=require('express');var router=express[_0xa477('0x3')]();var fs_extra=require(_0xa477('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa477('0x5'));var controller=require(_0xa477('0x6'));router['get']('/',auth[_0xa477('0x7')](),controller[_0xa477('0x8')]);router[_0xa477('0x9')](_0xa477('0xa'),auth[_0xa477('0x7')](),controller[_0xa477('0xb')]);router[_0xa477('0xc')]('/',auth[_0xa477('0x7')](),controller[_0xa477('0xd')]);router['put'](_0xa477('0xa'),auth[_0xa477('0x7')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xa477('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 1225b88..b2764cd 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 _0xabce=['ENUM','string','variable','picklist','STRING','customVariable','BOOLEAN','sequelize','exports'];(function(_0x233a8b,_0x209ddb){var _0x3438e0=function(_0x1fa452){while(--_0x1fa452){_0x233a8b['push'](_0x233a8b['shift']());}};_0x3438e0(++_0x209ddb);}(_0xabce,0x103));var _0xeabc=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xabce[_0x2df507];return _0x1f7167;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'type':{'type':Sequelize[_0xeabc('0x2')](_0xeabc('0x3'),_0xeabc('0x4'),'customVariable','keyValue',_0xeabc('0x5')),'defaultValue':_0xeabc('0x3')},'content':{'type':Sequelize[_0xeabc('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xeabc('0x3'),'variable',_0xeabc('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xeabc('0x6')]},'nameField':{'type':Sequelize[_0xeabc('0x6')]},'customField':{'type':Sequelize[_0xeabc('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6334=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','picklist'];(function(_0x32d414,_0x4d23da){var _0x4e0bca=function(_0x15d397){while(--_0x15d397){_0x32d414['push'](_0x32d414['shift']());}};_0x4e0bca(++_0x4d23da);}(_0x6334,0x119));var _0x4633=function(_0x10f68e,_0xf198ea){_0x10f68e=_0x10f68e-0x0;var _0x4c8372=_0x6334[_0x10f68e];return _0x4c8372;};'use strict';var Sequelize=require(_0x4633('0x0'));module[_0x4633('0x1')]={'type':{'type':Sequelize[_0x4633('0x2')](_0x4633('0x3'),_0x4633('0x4'),_0x4633('0x5'),'keyValue',_0x4633('0x6')),'defaultValue':_0x4633('0x3')},'content':{'type':Sequelize[_0x4633('0x7')]},'key':{'type':Sequelize[_0x4633('0x7')]},'keyType':{'type':Sequelize[_0x4633('0x2')](_0x4633('0x3'),_0x4633('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x4633('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4633('0x7')]},'customField':{'type':Sequelize[_0x4633('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 6586bf8..b2f40a0 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 _0x238e=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','destroy','sendStatus','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','show','keys','length','find','catch','create','update','body','params','html-pdf','fast-json-patch','request-promise','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x238e,0x1e1));var _0xe238=function(_0x3f3476,_0x15ab48){_0x3f3476=_0x3f3476-0x0;var _0x5a03b3=_0x238e[_0x3f3476];return _0x5a03b3;};'use strict';var pdf=require(_0xe238('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe238('0x1'));var rp=require(_0xe238('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe238('0x3'));var util=require('util');var path=require(_0xe238('0x4'));var sox=require(_0xe238('0x5'));var csv=require(_0xe238('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe238('0x7'));var _=require(_0xe238('0x8'));var squel=require(_0xe238('0x9'));var crypto=require(_0xe238('0xa'));var jsforce=require(_0xe238('0xb'));var deskjs=require(_0xe238('0xc'));var toCsv=require(_0xe238('0x6'));var querystring=require(_0xe238('0xd'));var Papa=require('papaparse');var Redis=require(_0xe238('0xe'));var authService=require(_0xe238('0xf'));var qs=require(_0xe238('0x10'));var as=require(_0xe238('0x11'));var hardwareService=require(_0xe238('0x12'));var logger=require(_0xe238('0x13'))(_0xe238('0x14'));var utils=require(_0xe238('0x15'));var config=require(_0xe238('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe238('0x17'))['db'];function respondWithStatusCode(_0x33182b,_0x12b8c1){_0x12b8c1=_0x12b8c1||0xcc;return function(_0x1a5570){if(_0x1a5570){return _0x33182b['sendStatus'](_0x12b8c1);}return _0x33182b[_0xe238('0x18')](_0x12b8c1)[_0xe238('0x19')]();};}function respondWithResult(_0x745b07,_0x39eda4){_0x39eda4=_0x39eda4||0xc8;return function(_0x1d4f7f){if(_0x1d4f7f){return _0x745b07[_0xe238('0x18')](_0x39eda4)[_0xe238('0x1a')](_0x1d4f7f);}};}function respondWithFilteredResult(_0x2579e6,_0x11c9b9){return function(_0x32222e){if(_0x32222e){var _0x19f57d=_0x32222e[_0xe238('0x1b')],_0x39c64f=_0x11c9b9['offset'],_0x4a3e34=_0x11c9b9[_0xe238('0x1c')]+_0x11c9b9[_0xe238('0x1d')],_0x2c9ff8;if(_0x4a3e34>=_0x19f57d){_0x4a3e34=_0x19f57d;_0x2c9ff8=0xc8;}else{_0x2c9ff8=0xce;}_0x2579e6[_0xe238('0x18')](_0x2c9ff8);return _0x2579e6['set']('Content-Range',_0x39c64f+'-'+_0x4a3e34+'/'+_0x19f57d)['json'](_0x32222e);}return null;};}function patchUpdates(_0x5a6988){return function(_0x482bcc){try{jsonpatch[_0xe238('0x1e')](_0x482bcc,_0x5a6988,!![]);}catch(_0x627100){return BPromise[_0xe238('0x1f')](_0x627100);}return _0x482bcc[_0xe238('0x20')]();};}function saveUpdates(_0x599b61,_0x32d952){return function(_0x47ef93){if(_0x47ef93){return _0x47ef93['update'](_0x599b61)['then'](function(_0x49e509){return _0x49e509;});}return null;};}function removeEntity(_0x1168c9,_0x82b10a){return function(_0xdd423){if(_0xdd423){return _0xdd423[_0xe238('0x21')]()['then'](function(){_0x1168c9[_0xe238('0x18')](0xcc)[_0xe238('0x19')]();});}};}function handleEntityNotFound(_0x5160a3,_0x44dba2){return function(_0x422482){if(!_0x422482){_0x5160a3[_0xe238('0x22')](0x194);}return _0x422482;};}function handleError(_0x1d0312,_0x13337e){_0x13337e=_0x13337e||0x1f4;return function(_0x481677){logger[_0xe238('0x23')](_0x481677[_0xe238('0x24')]);if(_0x481677[_0xe238('0x25')]){delete _0x481677[_0xe238('0x25')];}_0x1d0312[_0xe238('0x18')](_0x13337e)[_0xe238('0x26')](_0x481677);};}exports[_0xe238('0x27')]=function(_0x300d30,_0x24c0eb){var _0x32a2cb={},_0x157861={},_0x106405={'count':0x0,'rows':[]};var _0x1c4482=_[_0xe238('0x28')](db[_0xe238('0x29')][_0xe238('0x2a')],function(_0x43ab11){return{'name':_0x43ab11[_0xe238('0x2b')],'type':_0x43ab11[_0xe238('0x2c')]['key']};});_0x157861[_0xe238('0x2d')]=_['map'](_0x1c4482,_0xe238('0x25'));_0x157861[_0xe238('0x2e')]=_['keys'](_0x300d30[_0xe238('0x2e')]);_0x157861[_0xe238('0x2f')]=_['intersection'](_0x157861[_0xe238('0x2d')],_0x157861[_0xe238('0x2e')]);_0x32a2cb['attributes']=_[_0xe238('0x30')](_0x157861[_0xe238('0x2d')],qs[_0xe238('0x31')](_0x300d30['query'][_0xe238('0x31')]));_0x32a2cb['attributes']=_0x32a2cb[_0xe238('0x32')]['length']?_0x32a2cb['attributes']:_0x157861[_0xe238('0x2d')];if(!_0x300d30[_0xe238('0x2e')]['hasOwnProperty']('nolimit')){_0x32a2cb[_0xe238('0x1d')]=qs['limit'](_0x300d30[_0xe238('0x2e')][_0xe238('0x1d')]);_0x32a2cb[_0xe238('0x1c')]=qs[_0xe238('0x1c')](_0x300d30[_0xe238('0x2e')][_0xe238('0x1c')]);}_0x32a2cb['order']=qs[_0xe238('0x33')](_0x300d30[_0xe238('0x2e')][_0xe238('0x33')]);_0x32a2cb[_0xe238('0x34')]=qs[_0xe238('0x2f')](_[_0xe238('0x35')](_0x300d30[_0xe238('0x2e')],_0x157861[_0xe238('0x2f')]),_0x1c4482);if(_0x300d30['query'][_0xe238('0x36')]){_0x32a2cb[_0xe238('0x34')]=_[_0xe238('0x37')](_0x32a2cb[_0xe238('0x34')],{'$or':_[_0xe238('0x28')](_0x1c4482,function(_0x4b62d8){if(_0x4b62d8[_0xe238('0x2c')]!==_0xe238('0x38')){var _0x679e25={};_0x679e25[_0x4b62d8[_0xe238('0x25')]]={'$like':'%'+_0x300d30[_0xe238('0x2e')][_0xe238('0x36')]+'%'};return _0x679e25;}})});}_0x32a2cb=_[_0xe238('0x37')]({},_0x32a2cb,_0x300d30[_0xe238('0x39')]);var _0x5776e6={'where':_0x32a2cb[_0xe238('0x34')]};return db[_0xe238('0x29')][_0xe238('0x1b')](_0x5776e6)[_0xe238('0x3a')](function(_0x51eaf5){_0x106405[_0xe238('0x1b')]=_0x51eaf5;if(_0x300d30[_0xe238('0x2e')][_0xe238('0x3b')]){_0x32a2cb[_0xe238('0x3c')]=[{'all':!![]}];}return db[_0xe238('0x29')][_0xe238('0x3d')](_0x32a2cb);})[_0xe238('0x3a')](function(_0x4af42c){_0x106405['rows']=_0x4af42c;return _0x106405;})[_0xe238('0x3a')](respondWithFilteredResult(_0x24c0eb,_0x32a2cb))['catch'](handleError(_0x24c0eb,null));};exports[_0xe238('0x3e')]=function(_0x43c7e0,_0x3a63cc){var _0x28b354={'raw':!![],'where':{'id':_0x43c7e0['params']['id']}},_0x1da5c3={};_0x1da5c3[_0xe238('0x2d')]=_[_0xe238('0x3f')](db[_0xe238('0x29')][_0xe238('0x2a')]);_0x1da5c3[_0xe238('0x2e')]=_[_0xe238('0x3f')](_0x43c7e0[_0xe238('0x2e')]);_0x1da5c3[_0xe238('0x2f')]=_[_0xe238('0x30')](_0x1da5c3[_0xe238('0x2d')],_0x1da5c3['query']);_0x28b354[_0xe238('0x32')]=_[_0xe238('0x30')](_0x1da5c3[_0xe238('0x2d')],qs[_0xe238('0x31')](_0x43c7e0[_0xe238('0x2e')][_0xe238('0x31')]));_0x28b354[_0xe238('0x32')]=_0x28b354['attributes'][_0xe238('0x40')]?_0x28b354[_0xe238('0x32')]:_0x1da5c3[_0xe238('0x2d')];if(_0x43c7e0[_0xe238('0x2e')][_0xe238('0x3b')]){_0x28b354['include']=[{'all':!![]}];}_0x28b354=_['merge']({},_0x28b354,_0x43c7e0['options']);return db[_0xe238('0x29')][_0xe238('0x41')](_0x28b354)[_0xe238('0x3a')](handleEntityNotFound(_0x3a63cc,null))[_0xe238('0x3a')](respondWithResult(_0x3a63cc,null))[_0xe238('0x42')](handleError(_0x3a63cc,null));};exports[_0xe238('0x43')]=function(_0x222511,_0x166e58){return db[_0xe238('0x29')][_0xe238('0x43')](_0x222511['body'],{})[_0xe238('0x3a')](respondWithResult(_0x166e58,0xc9))[_0xe238('0x42')](handleError(_0x166e58,null));};exports[_0xe238('0x44')]=function(_0x362cb8,_0x4d685b){if(_0x362cb8[_0xe238('0x45')]['id']){delete _0x362cb8[_0xe238('0x45')]['id'];}return db[_0xe238('0x29')]['find']({'where':{'id':_0x362cb8[_0xe238('0x46')]['id']}})['then'](handleEntityNotFound(_0x4d685b,null))[_0xe238('0x3a')](saveUpdates(_0x362cb8[_0xe238('0x45')],null))['then'](respondWithResult(_0x4d685b,null))[_0xe238('0x42')](handleError(_0x4d685b,null));};exports[_0xe238('0x21')]=function(_0xb6ebeb,_0x5123cb){return db[_0xe238('0x29')][_0xe238('0x41')]({'where':{'id':_0xb6ebeb[_0xe238('0x46')]['id']}})[_0xe238('0x3a')](handleEntityNotFound(_0x5123cb,null))[_0xe238('0x3a')](removeEntity(_0x5123cb,null))[_0xe238('0x42')](handleError(_0x5123cb,null));}; \ No newline at end of file +var _0x08b8=['save','update','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Dynamics365Field','includeAll','findAll','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','count','offset','limit','set','apply','reject'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x08b8,0x150));var _0x808b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x08b8[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x808b('0x0'));var emlformat=require(_0x808b('0x1'));var rimraf=require(_0x808b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x808b('0x3'));var rp=require(_0x808b('0x4'));var moment=require(_0x808b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x808b('0x6'));var util=require(_0x808b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x808b('0x8'));var ejs=require(_0x808b('0x9'));var fs=require('fs');var fs_extra=require(_0x808b('0xa'));var _=require('lodash');var squel=require(_0x808b('0xb'));var crypto=require(_0x808b('0xc'));var jsforce=require(_0x808b('0xd'));var deskjs=require(_0x808b('0xe'));var toCsv=require(_0x808b('0x8'));var querystring=require(_0x808b('0xf'));var Papa=require(_0x808b('0x10'));var Redis=require(_0x808b('0x11'));var authService=require(_0x808b('0x12'));var qs=require(_0x808b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x808b('0x14'));var logger=require(_0x808b('0x15'))(_0x808b('0x16'));var utils=require(_0x808b('0x17'));var config=require(_0x808b('0x18'));var licenseUtil=require(_0x808b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f595f,_0x447fe0){_0x447fe0=_0x447fe0||0xcc;return function(_0x2da52a){if(_0x2da52a){return _0x2f595f[_0x808b('0x1a')](_0x447fe0);}return _0x2f595f['status'](_0x447fe0)['end']();};}function respondWithResult(_0x4d4e98,_0x49d2e9){_0x49d2e9=_0x49d2e9||0xc8;return function(_0x508c97){if(_0x508c97){return _0x4d4e98[_0x808b('0x1b')](_0x49d2e9)['json'](_0x508c97);}};}function respondWithFilteredResult(_0x5d2751,_0x57bf70){return function(_0x433132){if(_0x433132){var _0x1458d5=_0x433132[_0x808b('0x1c')],_0x54d732=_0x57bf70[_0x808b('0x1d')],_0x26c414=_0x57bf70[_0x808b('0x1d')]+_0x57bf70[_0x808b('0x1e')],_0x13398c;if(_0x26c414>=_0x1458d5){_0x26c414=_0x1458d5;_0x13398c=0xc8;}else{_0x13398c=0xce;}_0x5d2751[_0x808b('0x1b')](_0x13398c);return _0x5d2751[_0x808b('0x1f')]('Content-Range',_0x54d732+'-'+_0x26c414+'/'+_0x1458d5)['json'](_0x433132);}return null;};}function patchUpdates(_0x45cbc8){return function(_0x523784){try{jsonpatch[_0x808b('0x20')](_0x523784,_0x45cbc8,!![]);}catch(_0x56962e){return BPromise[_0x808b('0x21')](_0x56962e);}return _0x523784[_0x808b('0x22')]();};}function saveUpdates(_0x544bd9,_0x22e3a0){return function(_0x1d2c6b){if(_0x1d2c6b){return _0x1d2c6b[_0x808b('0x23')](_0x544bd9)[_0x808b('0x24')](function(_0x278159){return _0x278159;});}return null;};}function removeEntity(_0x3eb514,_0x537cf9){return function(_0x4c396c){if(_0x4c396c){return _0x4c396c[_0x808b('0x25')]()[_0x808b('0x24')](function(){_0x3eb514[_0x808b('0x1b')](0xcc)[_0x808b('0x26')]();});}};}function handleEntityNotFound(_0x2b88e9,_0x1fa3da){return function(_0x553aec){if(!_0x553aec){_0x2b88e9[_0x808b('0x1a')](0x194);}return _0x553aec;};}function handleError(_0x1ed487,_0x4f2958){_0x4f2958=_0x4f2958||0x1f4;return function(_0x33e8f1){logger[_0x808b('0x27')](_0x33e8f1[_0x808b('0x28')]);if(_0x33e8f1[_0x808b('0x29')]){delete _0x33e8f1['name'];}_0x1ed487[_0x808b('0x1b')](_0x4f2958)[_0x808b('0x2a')](_0x33e8f1);};}exports['index']=function(_0x450e1f,_0x403d92){var _0x45560e={},_0x3a55fa={},_0x46d951={'count':0x0,'rows':[]};var _0x5a4648=_[_0x808b('0x2b')](db['Dynamics365Field'][_0x808b('0x2c')],function(_0x5ec3a2){return{'name':_0x5ec3a2[_0x808b('0x2d')],'type':_0x5ec3a2[_0x808b('0x2e')][_0x808b('0x2f')]};});_0x3a55fa[_0x808b('0x30')]=_[_0x808b('0x2b')](_0x5a4648,_0x808b('0x29'));_0x3a55fa[_0x808b('0x31')]=_[_0x808b('0x32')](_0x450e1f[_0x808b('0x31')]);_0x3a55fa[_0x808b('0x33')]=_[_0x808b('0x34')](_0x3a55fa[_0x808b('0x30')],_0x3a55fa[_0x808b('0x31')]);_0x45560e[_0x808b('0x35')]=_[_0x808b('0x34')](_0x3a55fa[_0x808b('0x30')],qs[_0x808b('0x36')](_0x450e1f[_0x808b('0x31')]['fields']));_0x45560e[_0x808b('0x35')]=_0x45560e[_0x808b('0x35')][_0x808b('0x37')]?_0x45560e['attributes']:_0x3a55fa[_0x808b('0x30')];if(!_0x450e1f['query'][_0x808b('0x38')](_0x808b('0x39'))){_0x45560e[_0x808b('0x1e')]=qs['limit'](_0x450e1f['query']['limit']);_0x45560e[_0x808b('0x1d')]=qs[_0x808b('0x1d')](_0x450e1f[_0x808b('0x31')][_0x808b('0x1d')]);}_0x45560e[_0x808b('0x3a')]=qs['sort'](_0x450e1f[_0x808b('0x31')][_0x808b('0x3b')]);_0x45560e[_0x808b('0x3c')]=qs['filters'](_[_0x808b('0x3d')](_0x450e1f[_0x808b('0x31')],_0x3a55fa[_0x808b('0x33')]),_0x5a4648);if(_0x450e1f[_0x808b('0x31')][_0x808b('0x3e')]){_0x45560e['where']=_['merge'](_0x45560e['where'],{'$or':_[_0x808b('0x2b')](_0x5a4648,function(_0x4fd2a3){if(_0x4fd2a3[_0x808b('0x2e')]!=='VIRTUAL'){var _0x1b093c={};_0x1b093c[_0x4fd2a3['name']]={'$like':'%'+_0x450e1f[_0x808b('0x31')][_0x808b('0x3e')]+'%'};return _0x1b093c;}})});}_0x45560e=_[_0x808b('0x3f')]({},_0x45560e,_0x450e1f[_0x808b('0x40')]);var _0x5b8a6a={'where':_0x45560e[_0x808b('0x3c')]};return db[_0x808b('0x41')]['count'](_0x5b8a6a)[_0x808b('0x24')](function(_0x250d9a){_0x46d951[_0x808b('0x1c')]=_0x250d9a;if(_0x450e1f[_0x808b('0x31')][_0x808b('0x42')]){_0x45560e['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0x808b('0x43')](_0x45560e);})[_0x808b('0x24')](function(_0x28f223){_0x46d951['rows']=_0x28f223;return _0x46d951;})[_0x808b('0x24')](respondWithFilteredResult(_0x403d92,_0x45560e))[_0x808b('0x44')](handleError(_0x403d92,null));};exports[_0x808b('0x45')]=function(_0x5c0eda,_0x2f8f71){var _0x2166ab={'raw':!![],'where':{'id':_0x5c0eda[_0x808b('0x46')]['id']}},_0xe1ba8a={};_0xe1ba8a[_0x808b('0x30')]=_['keys'](db['Dynamics365Field'][_0x808b('0x2c')]);_0xe1ba8a[_0x808b('0x31')]=_[_0x808b('0x32')](_0x5c0eda[_0x808b('0x31')]);_0xe1ba8a[_0x808b('0x33')]=_[_0x808b('0x34')](_0xe1ba8a['model'],_0xe1ba8a[_0x808b('0x31')]);_0x2166ab[_0x808b('0x35')]=_[_0x808b('0x34')](_0xe1ba8a[_0x808b('0x30')],qs[_0x808b('0x36')](_0x5c0eda[_0x808b('0x31')][_0x808b('0x36')]));_0x2166ab[_0x808b('0x35')]=_0x2166ab[_0x808b('0x35')][_0x808b('0x37')]?_0x2166ab[_0x808b('0x35')]:_0xe1ba8a[_0x808b('0x30')];if(_0x5c0eda[_0x808b('0x31')][_0x808b('0x42')]){_0x2166ab['include']=[{'all':!![]}];}_0x2166ab=_[_0x808b('0x3f')]({},_0x2166ab,_0x5c0eda['options']);return db[_0x808b('0x41')][_0x808b('0x47')](_0x2166ab)[_0x808b('0x24')](handleEntityNotFound(_0x2f8f71,null))[_0x808b('0x24')](respondWithResult(_0x2f8f71,null))['catch'](handleError(_0x2f8f71,null));};exports[_0x808b('0x48')]=function(_0x153dcf,_0x481a60){return db[_0x808b('0x41')]['create'](_0x153dcf[_0x808b('0x49')],{})[_0x808b('0x24')](respondWithResult(_0x481a60,0xc9))[_0x808b('0x44')](handleError(_0x481a60,null));};exports[_0x808b('0x23')]=function(_0x35ae74,_0xf5d0e7){if(_0x35ae74['body']['id']){delete _0x35ae74['body']['id'];}return db[_0x808b('0x41')]['find']({'where':{'id':_0x35ae74['params']['id']}})[_0x808b('0x24')](handleEntityNotFound(_0xf5d0e7,null))[_0x808b('0x24')](saveUpdates(_0x35ae74['body'],null))[_0x808b('0x24')](respondWithResult(_0xf5d0e7,null))[_0x808b('0x44')](handleError(_0xf5d0e7,null));};exports['destroy']=function(_0x142ae4,_0x190150){return db[_0x808b('0x41')][_0x808b('0x47')]({'where':{'id':_0x142ae4['params']['id']}})['then'](handleEntityNotFound(_0x190150,null))['then'](removeEntity(_0x190150,null))[_0x808b('0x44')](handleError(_0x190150,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 5d8bb31..fc01075 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 _0x179e=['define','Dynamics365Field','int_dynamics365_fields','idField','FieldId','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','exports'];(function(_0x5d5400,_0xc25f5e){var _0x1c25ac=function(_0x4d588e){while(--_0x4d588e){_0x5d5400['push'](_0x5d5400['shift']());}};_0x1c25ac(++_0xc25f5e);}(_0x179e,0x11d));var _0xe179=function(_0x510972,_0x2dc4b6){_0x510972=_0x510972-0x0;var _0x119d33=_0x179e[_0x510972];return _0x119d33;};'use strict';var _=require(_0xe179('0x0'));var util=require('util');var logger=require(_0xe179('0x1'))(_0xe179('0x2'));var moment=require('moment');var BPromise=require(_0xe179('0x3'));var rp=require(_0xe179('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe179('0x5'));var config=require(_0xe179('0x6'));var attributes=require(_0xe179('0x7'));module[_0xe179('0x8')]=function(_0xbced89,_0x38163f){return _0xbced89[_0xe179('0x9')](_0xe179('0xa'),attributes,{'tableName':_0xe179('0xb'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0xe179('0xc'),_0xe179('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4485=['util','../../config/logger','api','moment','bluebird','path','rimraf','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','FieldId','lodash'];(function(_0x242a24,_0x42fa1c){var _0x516d91=function(_0xb53ffc){while(--_0xb53ffc){_0x242a24['push'](_0x242a24['shift']());}};_0x516d91(++_0x42fa1c);}(_0x4485,0x1e9));var _0x5448=function(_0x3bb859,_0x589816){_0x3bb859=_0x3bb859-0x0;var _0x3bf534=_0x4485[_0x3bb859];return _0x3bf534;};'use strict';var _=require(_0x5448('0x0'));var util=require(_0x5448('0x1'));var logger=require(_0x5448('0x2'))(_0x5448('0x3'));var moment=require(_0x5448('0x4'));var BPromise=require(_0x5448('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5448('0x6'));var rimraf=require(_0x5448('0x7'));var config=require('../../config/environment');var attributes=require(_0x5448('0x8'));module[_0x5448('0x9')]=function(_0x28970a,_0x170119){return _0x28970a['define'](_0x5448('0xa'),attributes,{'tableName':_0x5448('0xb'),'paranoid':![],'indexes':[{'name':_0x5448('0xc'),'fields':['idField',_0x5448('0xd')],'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 646b96d..9119a86 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 _0x4813=['code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','Dynamics365Field,\x20%s,\x20%s','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5a09f3,_0x9ce907){var _0x3665c2=function(_0x3a8581){while(--_0x3a8581){_0x5a09f3['push'](_0x5a09f3['shift']());}};_0x3665c2(++_0x9ce907);}(_0x4813,0x14e));var _0x3481=function(_0x2999cb,_0x1ea71e){_0x2999cb=_0x2999cb-0x0;var _0x381773=_0x4813[_0x2999cb];return _0x381773;};'use strict';var _=require(_0x3481('0x0'));var util=require(_0x3481('0x1'));var moment=require(_0x3481('0x2'));var BPromise=require(_0x3481('0x3'));var rs=require(_0x3481('0x4'));var fs=require('fs');var Redis=require(_0x3481('0x5'));var db=require(_0x3481('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3481('0x7'))(_0x3481('0x8'));var config=require(_0x3481('0x9'));var jayson=require(_0x3481('0xa'));var client=jayson[_0x3481('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e58ba,_0x3f5015,_0x59eda6){return new BPromise(function(_0x41fb39,_0x1a65d7){return client[_0x3481('0xc')](_0x5e58ba,_0x59eda6)['then'](function(_0x56cf19){logger['info'](_0x3481('0xd'),_0x3f5015,'request\x20sent');logger['debug'](_0x3481('0xe'),_0x3f5015,_0x3481('0xf'),JSON[_0x3481('0x10')](_0x56cf19));if(_0x56cf19[_0x3481('0x11')]){if(_0x56cf19[_0x3481('0x11')][_0x3481('0x12')]===0x1f4){logger[_0x3481('0x11')](_0x3481('0xd'),_0x3f5015,_0x56cf19[_0x3481('0x11')][_0x3481('0x13')]);return _0x1a65d7(_0x56cf19[_0x3481('0x11')][_0x3481('0x13')]);}logger['error'](_0x3481('0xd'),_0x3f5015,_0x56cf19[_0x3481('0x11')][_0x3481('0x13')]);return _0x41fb39(_0x56cf19[_0x3481('0x11')][_0x3481('0x13')]);}else{logger[_0x3481('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0x3f5015,_0x3481('0xf'));_0x41fb39(_0x56cf19[_0x3481('0x15')]['message']);}})['catch'](function(_0x4f6f45){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x3f5015,_0x4f6f45);_0x1a65d7(_0x4f6f45);});});} \ No newline at end of file +var _0x2d72=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','code','Dynamics365Field,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x57a400,_0x499033){var _0x5ae512=function(_0x16e01d){while(--_0x16e01d){_0x57a400['push'](_0x57a400['shift']());}};_0x5ae512(++_0x499033);}(_0x2d72,0xa8));var _0x22d7=function(_0x3a9bda,_0x3eb9be){_0x3a9bda=_0x3a9bda-0x0;var _0x36e1ce=_0x2d72[_0x3a9bda];return _0x36e1ce;};'use strict';var _=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var moment=require(_0x22d7('0x2'));var BPromise=require(_0x22d7('0x3'));var rs=require(_0x22d7('0x4'));var fs=require('fs');var Redis=require(_0x22d7('0x5'));var db=require(_0x22d7('0x6'))['db'];var utils=require(_0x22d7('0x7'));var logger=require(_0x22d7('0x8'))(_0x22d7('0x9'));var config=require(_0x22d7('0xa'));var jayson=require(_0x22d7('0xb'));var client=jayson[_0x22d7('0xc')][_0x22d7('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x52a3e3,_0x23a731,_0x3791d6){return new BPromise(function(_0x492ca8,_0x3b12cd){return client[_0x22d7('0xe')](_0x52a3e3,_0x3791d6)[_0x22d7('0xf')](function(_0x3c694f){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x23a731,_0x22d7('0x10'));logger[_0x22d7('0x11')](_0x22d7('0x12'),_0x23a731,_0x22d7('0x10'),JSON[_0x22d7('0x13')](_0x3c694f));if(_0x3c694f['error']){if(_0x3c694f['error'][_0x22d7('0x14')]===0x1f4){logger['error'](_0x22d7('0x15'),_0x23a731,_0x3c694f[_0x22d7('0x16')]['message']);return _0x3b12cd(_0x3c694f[_0x22d7('0x16')][_0x22d7('0x17')]);}logger[_0x22d7('0x16')](_0x22d7('0x15'),_0x23a731,_0x3c694f[_0x22d7('0x16')][_0x22d7('0x17')]);return _0x492ca8(_0x3c694f[_0x22d7('0x16')][_0x22d7('0x17')]);}else{logger['info'](_0x22d7('0x15'),_0x23a731,_0x22d7('0x10'));_0x492ca8(_0x3c694f[_0x22d7('0x18')]['message']);}})['catch'](function(_0x52b21c){logger[_0x22d7('0x16')](_0x22d7('0x15'),_0x23a731,_0x52b21c);_0x3b12cd(_0x52b21c);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 5e4b35e..30dca07 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 _0x5b1f=['put','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','/:id','/:id/configurations','isAuthenticated','getConfigurations','create','post','addConfiguration'];(function(_0x110dc0,_0x3a6615){var _0x39aeb1=function(_0x46fa33){while(--_0x46fa33){_0x110dc0['push'](_0x110dc0['shift']());}};_0x39aeb1(++_0x3a6615);}(_0x5b1f,0x136));var _0xf5b1=function(_0x5e3291,_0xc5350f){_0x5e3291=_0x5e3291-0x0;var _0x56b2f1=_0x5b1f[_0x5e3291];return _0x56b2f1;};'use strict';var multer=require(_0xf5b1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf5b1('0x1'));var express=require(_0xf5b1('0x2'));var router=express[_0xf5b1('0x3')]();var fs_extra=require(_0xf5b1('0x4'));var auth=require(_0xf5b1('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0xf5b1('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf5b1('0x7'),auth['isAuthenticated'](),controller['show']);router[_0xf5b1('0x6')](_0xf5b1('0x8'),auth[_0xf5b1('0x9')](),controller[_0xf5b1('0xa')]);router[_0xf5b1('0x6')]('/:id/fields',auth[_0xf5b1('0x9')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0xf5b1('0xb')]);router[_0xf5b1('0xc')](_0xf5b1('0x8'),auth[_0xf5b1('0x9')](),controller[_0xf5b1('0xd')]);router[_0xf5b1('0xe')](_0xf5b1('0x7'),auth['isAuthenticated'](),controller[_0xf5b1('0xf')]);router['delete']('/:id',auth[_0xf5b1('0x9')](),controller[_0xf5b1('0x10')]);module[_0xf5b1('0x11')]=router; \ No newline at end of file +var _0x2a35=['/:id','update','delete','destroy','exports','multer','Router','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x56b2f6,_0x3f87fd){var _0x31b484=function(_0x3f1136){while(--_0x3f1136){_0x56b2f6['push'](_0x56b2f6['shift']());}};_0x31b484(++_0x3f87fd);}(_0x2a35,0x16d));var _0x52a3=function(_0x594c47,_0x27c0c3){_0x594c47=_0x594c47-0x0;var _0x44c9fd=_0x2a35[_0x594c47];return _0x44c9fd;};'use strict';var multer=require(_0x52a3('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x52a3('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x52a3('0x2'));var config=require('../../config/environment');var controller=require(_0x52a3('0x3'));router[_0x52a3('0x4')]('/',auth[_0x52a3('0x5')](),controller[_0x52a3('0x6')]);router[_0x52a3('0x4')]('/:id',auth['isAuthenticated'](),controller[_0x52a3('0x7')]);router[_0x52a3('0x4')](_0x52a3('0x8'),auth['isAuthenticated'](),controller[_0x52a3('0x9')]);router[_0x52a3('0x4')](_0x52a3('0xa'),auth[_0x52a3('0x5')](),controller[_0x52a3('0xb')]);router[_0x52a3('0xc')]('/',auth[_0x52a3('0x5')](),controller['create']);router[_0x52a3('0xc')](_0x52a3('0x8'),auth[_0x52a3('0x5')](),controller['addConfiguration']);router['put'](_0x52a3('0xd'),auth[_0x52a3('0x5')](),controller[_0x52a3('0xe')]);router[_0x52a3('0xf')](_0x52a3('0xd'),auth['isAuthenticated'](),controller[_0x52a3('0x10')]);module[_0x52a3('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 7a6edb1..def8d21 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 _0x5752=['exports','STRING','sequelize'];(function(_0x70cbfa,_0x190c2f){var _0x16e257=function(_0x25515d){while(--_0x25515d){_0x70cbfa['push'](_0x70cbfa['shift']());}};_0x16e257(++_0x190c2f);}(_0x5752,0x17f));var _0x2575=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x5752[_0x1969a7];return _0x3d665f;};'use strict';var Sequelize=require(_0x2575('0x0'));module[_0x2575('0x1')]={'name':{'type':Sequelize[_0x2575('0x2')]},'description':{'type':Sequelize[_0x2575('0x2')]},'username':{'type':Sequelize[_0x2575('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x2575('0x2')]},'remoteUri':{'type':Sequelize[_0x2575('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x61e4=['remoteUri','sequelize','exports','STRING'];(function(_0x292250,_0x59ef95){var _0x3424f8=function(_0xb4bb9a){while(--_0xb4bb9a){_0x292250['push'](_0x292250['shift']());}};_0x3424f8(++_0x59ef95);}(_0x61e4,0x71));var _0x461e=function(_0x37a902,_0x50579a){_0x37a902=_0x37a902-0x0;var _0x566d4f=_0x61e4[_0x37a902];return _0x566d4f;};'use strict';var Sequelize=require(_0x461e('0x0'));module[_0x461e('0x1')]={'name':{'type':Sequelize[_0x461e('0x2')]},'description':{'type':Sequelize[_0x461e('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize[_0x461e('0x2')]},'remoteUri':{'type':Sequelize[_0x461e('0x2')],'unique':_0x461e('0x3')},'serverUrl':{'type':Sequelize[_0x461e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 449d36a..8657681 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 _0x104f=['fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','intersection','find','create','params','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','apiKey','slice','GET','api/v2/ticket_fields','format','Basic\x20%s','%s:X','toString','subject','agent','priority','group','company','remove','default','custom_text','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','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/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskAccount,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes'];(function(_0x4a8cc2,_0x4eb59e){var _0x4416db=function(_0x301394){while(--_0x301394){_0x4a8cc2['push'](_0x4a8cc2['shift']());}};_0x4416db(++_0x4eb59e);}(_0x104f,0x1b5));var _0xf104=function(_0x17b5b2,_0x2ff7b1){_0x17b5b2=_0x17b5b2-0x0;var _0xdb97dc=_0x104f[_0x17b5b2];return _0xdb97dc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf104('0x0'));var rimraf=require(_0xf104('0x1'));var zipdir=require(_0xf104('0x2'));var jsonpatch=require(_0xf104('0x3'));var rp=require(_0xf104('0x4'));var moment=require(_0xf104('0x5'));var BPromise=require(_0xf104('0x6'));var Mustache=require('mustache');var util=require(_0xf104('0x7'));var path=require(_0xf104('0x8'));var sox=require(_0xf104('0x9'));var csv=require(_0xf104('0xa'));var ejs=require(_0xf104('0xb'));var fs=require('fs');var fs_extra=require(_0xf104('0xc'));var _=require(_0xf104('0xd'));var squel=require(_0xf104('0xe'));var crypto=require(_0xf104('0xf'));var jsforce=require(_0xf104('0x10'));var deskjs=require(_0xf104('0x11'));var toCsv=require(_0xf104('0xa'));var querystring=require(_0xf104('0x12'));var Papa=require(_0xf104('0x13'));var Redis=require(_0xf104('0x14'));var authService=require(_0xf104('0x15'));var qs=require(_0xf104('0x16'));var as=require(_0xf104('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf104('0x18'))(_0xf104('0x19'));var utils=require(_0xf104('0x1a'));var config=require(_0xf104('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xf104('0x1c'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xf104('0x1d'));var client=jayson[_0xf104('0x1e')][_0xf104('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3a1d71,_0x264d4e,_0x4a4a89,_0x4f418a){return new BPromise(function(_0x351aa7,_0x360450){var _0x43e518=_0x4f418a||client;return _0x43e518['request'](_0x3a1d71,_0x4a4a89)[_0xf104('0x20')](function(_0x4ac697){logger[_0xf104('0x21')]('FreshdeskAccount,\x20%s,\x20%s',_0x264d4e,_0xf104('0x22'));logger[_0xf104('0x23')](_0xf104('0x24'),_0x264d4e,'request\x20sent',JSON[_0xf104('0x25')](_0x4ac697));if(_0x4ac697[_0xf104('0x26')]){if(_0x4ac697['error'][_0xf104('0x27')]===0x1f4){logger[_0xf104('0x26')]('FreshdeskAccount,\x20%s,\x20%s',_0x264d4e,_0x4ac697[_0xf104('0x26')]['message']);return _0x360450(_0x4ac697[_0xf104('0x26')][_0xf104('0x28')]);}logger[_0xf104('0x26')](_0xf104('0x29'),_0x264d4e,_0x4ac697[_0xf104('0x26')][_0xf104('0x28')]);return _0x351aa7(_0x4ac697[_0xf104('0x26')][_0xf104('0x28')]);}else{logger[_0xf104('0x21')](_0xf104('0x29'),_0x264d4e,_0xf104('0x22'));_0x351aa7(_0x4ac697[_0xf104('0x2a')][_0xf104('0x28')]);}})[_0xf104('0x2b')](function(_0x2865ed){logger[_0xf104('0x26')]('FreshdeskAccount,\x20%s,\x20%s',_0x264d4e,_0x2865ed);_0x360450(_0x2865ed);});});}function respondWithStatusCode(_0xca272d,_0x2ee7f7){_0x2ee7f7=_0x2ee7f7||0xcc;return function(_0x6c49dd){if(_0x6c49dd){return _0xca272d[_0xf104('0x2c')](_0x2ee7f7);}return _0xca272d[_0xf104('0x2d')](_0x2ee7f7)[_0xf104('0x2e')]();};}function respondWithResult(_0x1cfa40,_0x1dc49b){_0x1dc49b=_0x1dc49b||0xc8;return function(_0x4e03e2){if(_0x4e03e2){return _0x1cfa40[_0xf104('0x2d')](_0x1dc49b)[_0xf104('0x2f')](_0x4e03e2);}};}function respondWithFilteredResult(_0x2316a0,_0x22bd88){return function(_0x19ce61){if(_0x19ce61){var _0x43e9b3=_0x19ce61[_0xf104('0x30')],_0x5ca262=_0x22bd88['offset'],_0xad1ee9=_0x22bd88[_0xf104('0x31')]+_0x22bd88['limit'],_0x1b2dba;if(_0xad1ee9>=_0x43e9b3){_0xad1ee9=_0x43e9b3;_0x1b2dba=0xc8;}else{_0x1b2dba=0xce;}_0x2316a0[_0xf104('0x2d')](_0x1b2dba);return _0x2316a0['set'](_0xf104('0x32'),_0x5ca262+'-'+_0xad1ee9+'/'+_0x43e9b3)[_0xf104('0x2f')](_0x19ce61);}return null;};}function patchUpdates(_0x92e28b){return function(_0x3dc643){try{jsonpatch[_0xf104('0x33')](_0x3dc643,_0x92e28b,!![]);}catch(_0x25b215){return BPromise[_0xf104('0x34')](_0x25b215);}return _0x3dc643[_0xf104('0x35')]();};}function saveUpdates(_0x55e4e1,_0x16e7f9){return function(_0x2119f){if(_0x2119f){return _0x2119f[_0xf104('0x36')](_0x55e4e1)[_0xf104('0x20')](function(_0x4f33a3){return _0x4f33a3;});}return null;};}function removeEntity(_0x279b8a,_0x410c51){return function(_0x2e01a4){if(_0x2e01a4){return _0x2e01a4[_0xf104('0x37')]()[_0xf104('0x20')](function(){_0x279b8a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1af51f,_0x5f3268){return function(_0x28ad69){if(!_0x28ad69){_0x1af51f[_0xf104('0x2c')](0x194);}return _0x28ad69;};}function handleError(_0x303682,_0x3b60c3){_0x3b60c3=_0x3b60c3||0x1f4;return function(_0x433cb3){logger[_0xf104('0x26')](_0x433cb3[_0xf104('0x38')]);if(_0x433cb3['name']){delete _0x433cb3[_0xf104('0x39')];}_0x303682[_0xf104('0x2d')](_0x3b60c3)[_0xf104('0x3a')](_0x433cb3);};}exports[_0xf104('0x3b')]=function(_0x15d7c5,_0x144495){var _0x6467e2={},_0x3205ea={},_0x20aac2={'count':0x0,'rows':[]};var _0x563567=_[_0xf104('0x3c')](db[_0xf104('0x3d')][_0xf104('0x3e')],function(_0x41b568){return{'name':_0x41b568[_0xf104('0x3f')],'type':_0x41b568[_0xf104('0x40')][_0xf104('0x41')]};});_0x3205ea[_0xf104('0x42')]=_[_0xf104('0x3c')](_0x563567,_0xf104('0x39'));_0x3205ea[_0xf104('0x43')]=_[_0xf104('0x44')](_0x15d7c5[_0xf104('0x43')]);_0x3205ea[_0xf104('0x45')]=_['intersection'](_0x3205ea[_0xf104('0x42')],_0x3205ea[_0xf104('0x43')]);_0x6467e2[_0xf104('0x46')]=_['intersection'](_0x3205ea[_0xf104('0x42')],qs[_0xf104('0x47')](_0x15d7c5[_0xf104('0x43')][_0xf104('0x47')]));_0x6467e2['attributes']=_0x6467e2[_0xf104('0x46')][_0xf104('0x48')]?_0x6467e2['attributes']:_0x3205ea[_0xf104('0x42')];if(!_0x15d7c5[_0xf104('0x43')][_0xf104('0x49')](_0xf104('0x4a'))){_0x6467e2[_0xf104('0x4b')]=qs[_0xf104('0x4b')](_0x15d7c5[_0xf104('0x43')]['limit']);_0x6467e2[_0xf104('0x31')]=qs['offset'](_0x15d7c5['query'][_0xf104('0x31')]);}_0x6467e2[_0xf104('0x4c')]=qs[_0xf104('0x4d')](_0x15d7c5[_0xf104('0x43')][_0xf104('0x4d')]);_0x6467e2[_0xf104('0x4e')]=qs['filters'](_[_0xf104('0x4f')](_0x15d7c5[_0xf104('0x43')],_0x3205ea[_0xf104('0x45')]),_0x563567);if(_0x15d7c5[_0xf104('0x43')][_0xf104('0x50')]){_0x6467e2['where']=_[_0xf104('0x51')](_0x6467e2['where'],{'$or':_['map'](_0x563567,function(_0x38f4d7){if(_0x38f4d7[_0xf104('0x40')]!=='VIRTUAL'){var _0x1eec58={};_0x1eec58[_0x38f4d7[_0xf104('0x39')]]={'$like':'%'+_0x15d7c5[_0xf104('0x43')][_0xf104('0x50')]+'%'};return _0x1eec58;}})});}_0x6467e2=_[_0xf104('0x51')]({},_0x6467e2,_0x15d7c5[_0xf104('0x52')]);var _0x47f86d={'where':_0x6467e2[_0xf104('0x4e')]};return db[_0xf104('0x3d')]['count'](_0x47f86d)[_0xf104('0x20')](function(_0x3d36a8){_0x20aac2['count']=_0x3d36a8;if(_0x15d7c5[_0xf104('0x43')][_0xf104('0x53')]){_0x6467e2[_0xf104('0x54')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0xf104('0x55')](_0x6467e2);})[_0xf104('0x20')](function(_0x221844){_0x20aac2[_0xf104('0x56')]=_0x221844;return _0x20aac2;})[_0xf104('0x20')](respondWithFilteredResult(_0x144495,_0x6467e2))[_0xf104('0x2b')](handleError(_0x144495,null));};exports[_0xf104('0x57')]=function(_0xe52ae1,_0x203be9){var _0x192f3f={'raw':![],'where':{'id':_0xe52ae1['params']['id']}},_0xe8c30e={};_0xe8c30e['model']=_[_0xf104('0x44')](db[_0xf104('0x3d')][_0xf104('0x3e')]);_0xe8c30e[_0xf104('0x43')]=_[_0xf104('0x44')](_0xe52ae1[_0xf104('0x43')]);_0xe8c30e[_0xf104('0x45')]=_[_0xf104('0x58')](_0xe8c30e[_0xf104('0x42')],_0xe8c30e['query']);_0x192f3f[_0xf104('0x46')]=_[_0xf104('0x58')](_0xe8c30e[_0xf104('0x42')],qs[_0xf104('0x47')](_0xe52ae1['query'][_0xf104('0x47')]));_0x192f3f[_0xf104('0x46')]=_0x192f3f[_0xf104('0x46')][_0xf104('0x48')]?_0x192f3f['attributes']:_0xe8c30e['model'];if(_0xe52ae1[_0xf104('0x43')]['includeAll']){_0x192f3f['include']=[{'all':!![]}];}_0x192f3f=_['merge']({},_0x192f3f,_0xe52ae1[_0xf104('0x52')]);return db[_0xf104('0x3d')][_0xf104('0x59')](_0x192f3f)['then'](handleEntityNotFound(_0x203be9,null))['then'](respondWithResult(_0x203be9,null))[_0xf104('0x2b')](handleError(_0x203be9,null));};exports[_0xf104('0x5a')]=function(_0x4039d8,_0x2398eb){return db[_0xf104('0x3d')][_0xf104('0x5a')](_0x4039d8['body'],{})[_0xf104('0x20')](respondWithResult(_0x2398eb,0xc9))[_0xf104('0x2b')](handleError(_0x2398eb,null));};exports[_0xf104('0x36')]=function(_0x3650d3,_0x152626){if(_0x3650d3['body']['id']){delete _0x3650d3['body']['id'];}return db['FreshdeskAccount'][_0xf104('0x59')]({'where':{'id':_0x3650d3[_0xf104('0x5b')]['id']}})[_0xf104('0x20')](handleEntityNotFound(_0x152626,null))['then'](saveUpdates(_0x3650d3[_0xf104('0x5c')],null))['then'](respondWithResult(_0x152626,null))[_0xf104('0x2b')](handleError(_0x152626,null));};exports[_0xf104('0x37')]=function(_0x22525a,_0x343dac){return db['FreshdeskAccount'][_0xf104('0x59')]({'where':{'id':_0x22525a[_0xf104('0x5b')]['id']}})[_0xf104('0x20')](handleEntityNotFound(_0x343dac,null))['then'](removeEntity(_0x343dac,null))['catch'](handleError(_0x343dac,null));};exports[_0xf104('0x5d')]=function(_0xf8a2c7,_0x47d734,_0x152fdc){var _0x3cc47e={};var _0x61653e={};var _0x543e6a;var _0x4d4e07;return db[_0xf104('0x3d')][_0xf104('0x5e')]({'where':{'id':_0xf8a2c7['params']['id']}})[_0xf104('0x20')](handleEntityNotFound(_0x47d734,null))['then'](function(_0x587a39){if(_0x587a39){_0x543e6a=_0x587a39;_0x61653e[_0xf104('0x42')]=_[_0xf104('0x44')](db['FreshdeskConfiguration'][_0xf104('0x3e')]);_0x61653e[_0xf104('0x43')]=_[_0xf104('0x44')](_0xf8a2c7['query']);_0x61653e[_0xf104('0x45')]=_['intersection'](_0x61653e[_0xf104('0x42')],_0x61653e[_0xf104('0x43')]);_0x3cc47e['attributes']=_[_0xf104('0x58')](_0x61653e[_0xf104('0x42')],qs[_0xf104('0x47')](_0xf8a2c7[_0xf104('0x43')][_0xf104('0x47')]));_0x3cc47e[_0xf104('0x46')]=_0x3cc47e['attributes'][_0xf104('0x48')]?_0x3cc47e['attributes']:_0x61653e[_0xf104('0x42')];_0x3cc47e[_0xf104('0x4c')]=qs['sort'](_0xf8a2c7[_0xf104('0x43')][_0xf104('0x4d')]);_0x3cc47e['where']=qs[_0xf104('0x45')](_['pick'](_0xf8a2c7['query'],_0x61653e[_0xf104('0x45')]));if(_0xf8a2c7['query'][_0xf104('0x50')]){_0x3cc47e[_0xf104('0x4e')]=_[_0xf104('0x51')](_0x3cc47e['where'],{'$or':_[_0xf104('0x3c')](_0x3cc47e[_0xf104('0x46')],function(_0x560712){var _0x2fbe55={};_0x2fbe55[_0x560712]={'$like':'%'+_0xf8a2c7[_0xf104('0x43')][_0xf104('0x50')]+'%'};return _0x2fbe55;})});}_0x3cc47e=_[_0xf104('0x51')]({},_0x3cc47e,_0xf8a2c7[_0xf104('0x52')]);return _0x543e6a[_0xf104('0x5d')](_0x3cc47e);}})[_0xf104('0x20')](function(_0x33ed5d){if(_0x33ed5d){_0x4d4e07=_0x33ed5d['length'];if(!_0xf8a2c7[_0xf104('0x43')][_0xf104('0x49')](_0xf104('0x4a'))){_0x3cc47e[_0xf104('0x4b')]=qs[_0xf104('0x4b')](_0xf8a2c7[_0xf104('0x43')]['limit']);_0x3cc47e[_0xf104('0x31')]=qs[_0xf104('0x31')](_0xf8a2c7[_0xf104('0x43')][_0xf104('0x31')]);}return _0x543e6a[_0xf104('0x5d')](_0x3cc47e);}})[_0xf104('0x20')](function(_0x1130b2){if(_0x1130b2){return _0x1130b2?{'count':_0x4d4e07,'rows':_0x1130b2}:null;}})[_0xf104('0x20')](respondWithResult(_0x47d734,null))[_0xf104('0x2b')](handleError(_0x47d734,null));};exports[_0xf104('0x5f')]=function(_0xb35452,_0xd0246f,_0x29d739){if(_0xb35452[_0xf104('0x5c')]['id']){delete _0xb35452[_0xf104('0x5c')]['id'];}return db[_0xf104('0x3d')][_0xf104('0x5e')]({'where':{'id':_0xb35452['params']['id']}})['then'](handleEntityNotFound(_0xd0246f,null))[_0xf104('0x20')](function(_0x493765){if(_0x493765){_0xb35452[_0xf104('0x5c')][_0xf104('0x60')]=_0x493765['id'];_0xb35452[_0xf104('0x5c')][_0xf104('0x61')]=integrations[_0xf104('0x62')](_0xb35452[_0xf104('0x5c')][_0xf104('0x63')],_0xb35452['body'][_0xf104('0x40')]);_0xb35452[_0xf104('0x5c')][_0xf104('0x64')]=integrations['getDescriptions'](_0xb35452['body'][_0xf104('0x63')],_0xb35452[_0xf104('0x5c')][_0xf104('0x40')]);return db[_0xf104('0x65')][_0xf104('0x5a')](_0xb35452[_0xf104('0x5c')],{'include':[{'model':db[_0xf104('0x66')],'as':_0xf104('0x61')},{'model':db[_0xf104('0x66')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0xd0246f,null))['catch'](handleError(_0xd0246f,null));};exports[_0xf104('0x67')]=function(_0x250eea,_0x5c3f9a,_0x572d56){var _0x47639b='';return db['FreshdeskAccount'][_0xf104('0x5e')]({'where':{'id':_0x250eea['params']['id']},'attributes':['id',_0xf104('0x68'),_0xf104('0x69')]})['then'](handleEntityNotFound(_0x5c3f9a,null))[_0xf104('0x20')](function(_0x5cd075){if(_0x5cd075){_0x47639b=_0x5cd075['remoteUri'];var _0xe68514=_0x47639b[_0xf104('0x6a')](-0x1);if(_0xe68514==='/'){_0x47639b=_0x47639b['substring'](0x0,_0x47639b['lastIndexOf'](_0xe68514));}return rp({'method':_0xf104('0x6b'),'uri':util['format']('%s/%s',_0x47639b,_0xf104('0x6c')),'headers':{'Authorization':util[_0xf104('0x6d')](_0xf104('0x6e'),new Buffer(util[_0xf104('0x6d')](_0xf104('0x6f'),_0x5cd075[_0xf104('0x69')]))[_0xf104('0x70')]('base64'))},'json':!![]});}})[_0xf104('0x20')](function(_0x1e5259){if(_0x1e5259){var _0x55eb12=['requester',_0xf104('0x71'),_0xf104('0x72'),'description',_0xf104('0x2d'),_0xf104('0x73'),_0xf104('0x74'),'source','ticket_type',_0xf104('0x74'),_0xf104('0x75')];_[_0xf104('0x76')](_0x1e5259,function(_0x1663ad){return _0x55eb12['includes'](_0x1663ad['name'])||!_0x1663ad[_0xf104('0x77')]&&_0x1663ad[_0xf104('0x40')]!==_0xf104('0x78')&&_0x1663ad[_0xf104('0x40')]!=='custom_dropdown';});return{'count':_0x1e5259[_0xf104('0x48')],'rows':_['map'](_0x1e5259,function(_0x4f4d97){return{'id':_0x4f4d97[_0xf104('0x39')],'name':_0x4f4d97[_0xf104('0x79')],'custom':!_0x4f4d97['default'],'options':_0x4f4d97[_0xf104('0x7a')]?_['map'](_0x4f4d97[_0xf104('0x7a')],function(_0x5ca5ab){return{'name':_[_0xf104('0x7b')](_0x5ca5ab),'value':_0x5ca5ab};}):[]};})};}})[_0xf104('0x20')](respondWithResult(_0x5c3f9a,null))['catch'](function(_0x3b74c2){var _0x5b4e93=_0x250eea[_0xf104('0x43')][_0xf104('0x7c')]?0x1f4:_0x3b74c2[_0xf104('0x7d')]||0x1f4;logger['error'](_0xf104('0x7e'),'getFields',_0x5b4e93,JSON['stringify'](_0x3b74c2));delete _0x3b74c2['name'];if(_0x5b4e93===0x191){_0x5b4e93=0x190;}_0x5c3f9a[_0xf104('0x2d')](_0x5b4e93)[_0xf104('0x3a')](_0x250eea[_0xf104('0x43')][_0xf104('0x7c')]?{'message':'Wrong\x20credentials','statusCode':_0x3b74c2[_0xf104('0x7d')]}:_0x3b74c2);});}; \ No newline at end of file +var _0x5e37=['stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','FreshdeskAccount','rawAttributes','type','key','model','map','query','keys','attributes','fields','length','nolimit','order','sort','filters','pick','merge','where','filter','options','count','includeAll','include','show','params','intersection','find','create','body','findOne','FreshdeskConfiguration','getConfigurations','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','remoteUri','slice','substring','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','%s:X','apiKey','toString','base64','requester','agent','group','source','ticket_type','includes','default','custom_dropdown','label','choices','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','moment','bluebird','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x53e225,_0x3d944c){var _0x2743e0=function(_0x58a64b){while(--_0x58a64b){_0x53e225['push'](_0x53e225['shift']());}};_0x2743e0(++_0x3d944c);}(_0x5e37,0x146));var _0x75e3=function(_0x246148,_0x1358ee){_0x246148=_0x246148-0x0;var _0x453d94=_0x5e37[_0x246148];return _0x453d94;};'use strict';var pdf=require(_0x75e3('0x0'));var emlformat=require(_0x75e3('0x1'));var rimraf=require(_0x75e3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x75e3('0x3'));var BPromise=require(_0x75e3('0x4'));var Mustache=require('mustache');var util=require(_0x75e3('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x75e3('0x6'));var ejs=require(_0x75e3('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x75e3('0x8'));var crypto=require(_0x75e3('0x9'));var jsforce=require(_0x75e3('0xa'));var deskjs=require(_0x75e3('0xb'));var toCsv=require('to-csv');var querystring=require(_0x75e3('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x75e3('0xd'));var qs=require(_0x75e3('0xe'));var as=require(_0x75e3('0xf'));var hardwareService=require(_0x75e3('0x10'));var logger=require('../../config/logger')(_0x75e3('0x11'));var utils=require(_0x75e3('0x12'));var config=require(_0x75e3('0x13'));var licenseUtil=require(_0x75e3('0x14'));var db=require(_0x75e3('0x15'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x75e3('0x16'));var client=jayson['client'][_0x75e3('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x3cf8ca,_0x330fd5,_0x23fdb4,_0x54fbcd){return new BPromise(function(_0x4eb250,_0x1dc710){var _0x1f2263=_0x54fbcd||client;return _0x1f2263[_0x75e3('0x18')](_0x3cf8ca,_0x23fdb4)[_0x75e3('0x19')](function(_0x2d760a){logger[_0x75e3('0x1a')](_0x75e3('0x1b'),_0x330fd5,_0x75e3('0x1c'));logger[_0x75e3('0x1d')](_0x75e3('0x1e'),_0x330fd5,_0x75e3('0x1c'),JSON[_0x75e3('0x1f')](_0x2d760a));if(_0x2d760a[_0x75e3('0x20')]){if(_0x2d760a[_0x75e3('0x20')][_0x75e3('0x21')]===0x1f4){logger['error'](_0x75e3('0x1b'),_0x330fd5,_0x2d760a['error'][_0x75e3('0x22')]);return _0x1dc710(_0x2d760a[_0x75e3('0x20')][_0x75e3('0x22')]);}logger['error'](_0x75e3('0x1b'),_0x330fd5,_0x2d760a[_0x75e3('0x20')][_0x75e3('0x22')]);return _0x4eb250(_0x2d760a[_0x75e3('0x20')][_0x75e3('0x22')]);}else{logger[_0x75e3('0x1a')](_0x75e3('0x1b'),_0x330fd5,_0x75e3('0x1c'));_0x4eb250(_0x2d760a[_0x75e3('0x23')][_0x75e3('0x22')]);}})[_0x75e3('0x24')](function(_0x569672){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x330fd5,_0x569672);_0x1dc710(_0x569672);});});}function respondWithStatusCode(_0x55f0a2,_0x1efff2){_0x1efff2=_0x1efff2||0xcc;return function(_0x1d6a43){if(_0x1d6a43){return _0x55f0a2[_0x75e3('0x25')](_0x1efff2);}return _0x55f0a2[_0x75e3('0x26')](_0x1efff2)['end']();};}function respondWithResult(_0x34077e,_0x55cc96){_0x55cc96=_0x55cc96||0xc8;return function(_0x49239c){if(_0x49239c){return _0x34077e[_0x75e3('0x26')](_0x55cc96)[_0x75e3('0x27')](_0x49239c);}};}function respondWithFilteredResult(_0x12429f,_0x597413){return function(_0x49584b){if(_0x49584b){var _0xb6ed87=_0x49584b['count'],_0x1fa092=_0x597413[_0x75e3('0x28')],_0xac7ee7=_0x597413['offset']+_0x597413[_0x75e3('0x29')],_0x224b38;if(_0xac7ee7>=_0xb6ed87){_0xac7ee7=_0xb6ed87;_0x224b38=0xc8;}else{_0x224b38=0xce;}_0x12429f[_0x75e3('0x26')](_0x224b38);return _0x12429f[_0x75e3('0x2a')](_0x75e3('0x2b'),_0x1fa092+'-'+_0xac7ee7+'/'+_0xb6ed87)[_0x75e3('0x27')](_0x49584b);}return null;};}function patchUpdates(_0x6471ca){return function(_0x49107b){try{jsonpatch[_0x75e3('0x2c')](_0x49107b,_0x6471ca,!![]);}catch(_0x28ee19){return BPromise[_0x75e3('0x2d')](_0x28ee19);}return _0x49107b[_0x75e3('0x2e')]();};}function saveUpdates(_0x2ad74b,_0x581b58){return function(_0x5ba02d){if(_0x5ba02d){return _0x5ba02d[_0x75e3('0x2f')](_0x2ad74b)[_0x75e3('0x19')](function(_0x2bb3e3){return _0x2bb3e3;});}return null;};}function removeEntity(_0x4de93e,_0x55dc5a){return function(_0x59aa07){if(_0x59aa07){return _0x59aa07[_0x75e3('0x30')]()[_0x75e3('0x19')](function(){_0x4de93e[_0x75e3('0x26')](0xcc)[_0x75e3('0x31')]();});}};}function handleEntityNotFound(_0x3e787b,_0x68832b){return function(_0x3442c0){if(!_0x3442c0){_0x3e787b[_0x75e3('0x25')](0x194);}return _0x3442c0;};}function handleError(_0x5b453e,_0x198b72){_0x198b72=_0x198b72||0x1f4;return function(_0x3597c8){logger[_0x75e3('0x20')](_0x3597c8[_0x75e3('0x32')]);if(_0x3597c8[_0x75e3('0x33')]){delete _0x3597c8['name'];}_0x5b453e['status'](_0x198b72)[_0x75e3('0x34')](_0x3597c8);};}exports['index']=function(_0x530bfe,_0x19ac25){var _0x398911={},_0x136c90={},_0x5b1c91={'count':0x0,'rows':[]};var _0x179339=_['map'](db[_0x75e3('0x35')][_0x75e3('0x36')],function(_0x20cf96){return{'name':_0x20cf96['fieldName'],'type':_0x20cf96[_0x75e3('0x37')][_0x75e3('0x38')]};});_0x136c90[_0x75e3('0x39')]=_[_0x75e3('0x3a')](_0x179339,_0x75e3('0x33'));_0x136c90[_0x75e3('0x3b')]=_[_0x75e3('0x3c')](_0x530bfe[_0x75e3('0x3b')]);_0x136c90['filters']=_['intersection'](_0x136c90[_0x75e3('0x39')],_0x136c90[_0x75e3('0x3b')]);_0x398911[_0x75e3('0x3d')]=_['intersection'](_0x136c90['model'],qs['fields'](_0x530bfe[_0x75e3('0x3b')][_0x75e3('0x3e')]));_0x398911[_0x75e3('0x3d')]=_0x398911['attributes'][_0x75e3('0x3f')]?_0x398911[_0x75e3('0x3d')]:_0x136c90[_0x75e3('0x39')];if(!_0x530bfe[_0x75e3('0x3b')]['hasOwnProperty'](_0x75e3('0x40'))){_0x398911[_0x75e3('0x29')]=qs[_0x75e3('0x29')](_0x530bfe[_0x75e3('0x3b')][_0x75e3('0x29')]);_0x398911[_0x75e3('0x28')]=qs[_0x75e3('0x28')](_0x530bfe[_0x75e3('0x3b')][_0x75e3('0x28')]);}_0x398911[_0x75e3('0x41')]=qs[_0x75e3('0x42')](_0x530bfe[_0x75e3('0x3b')][_0x75e3('0x42')]);_0x398911['where']=qs[_0x75e3('0x43')](_[_0x75e3('0x44')](_0x530bfe[_0x75e3('0x3b')],_0x136c90['filters']),_0x179339);if(_0x530bfe[_0x75e3('0x3b')]['filter']){_0x398911['where']=_[_0x75e3('0x45')](_0x398911[_0x75e3('0x46')],{'$or':_['map'](_0x179339,function(_0x4fe955){if(_0x4fe955[_0x75e3('0x37')]!=='VIRTUAL'){var _0x46630f={};_0x46630f[_0x4fe955[_0x75e3('0x33')]]={'$like':'%'+_0x530bfe['query'][_0x75e3('0x47')]+'%'};return _0x46630f;}})});}_0x398911=_[_0x75e3('0x45')]({},_0x398911,_0x530bfe[_0x75e3('0x48')]);var _0x548c09={'where':_0x398911[_0x75e3('0x46')]};return db[_0x75e3('0x35')][_0x75e3('0x49')](_0x548c09)['then'](function(_0x5528fd){_0x5b1c91['count']=_0x5528fd;if(_0x530bfe[_0x75e3('0x3b')][_0x75e3('0x4a')]){_0x398911[_0x75e3('0x4b')]=[{'all':!![]}];}return db[_0x75e3('0x35')]['findAll'](_0x398911);})['then'](function(_0x56a75e){_0x5b1c91['rows']=_0x56a75e;return _0x5b1c91;})[_0x75e3('0x19')](respondWithFilteredResult(_0x19ac25,_0x398911))[_0x75e3('0x24')](handleError(_0x19ac25,null));};exports[_0x75e3('0x4c')]=function(_0x5c9e32,_0x34a447){var _0x345e6a={'raw':![],'where':{'id':_0x5c9e32[_0x75e3('0x4d')]['id']}},_0xcdd9a4={};_0xcdd9a4[_0x75e3('0x39')]=_[_0x75e3('0x3c')](db[_0x75e3('0x35')][_0x75e3('0x36')]);_0xcdd9a4['query']=_[_0x75e3('0x3c')](_0x5c9e32['query']);_0xcdd9a4[_0x75e3('0x43')]=_[_0x75e3('0x4e')](_0xcdd9a4[_0x75e3('0x39')],_0xcdd9a4[_0x75e3('0x3b')]);_0x345e6a['attributes']=_['intersection'](_0xcdd9a4[_0x75e3('0x39')],qs['fields'](_0x5c9e32[_0x75e3('0x3b')][_0x75e3('0x3e')]));_0x345e6a['attributes']=_0x345e6a[_0x75e3('0x3d')][_0x75e3('0x3f')]?_0x345e6a[_0x75e3('0x3d')]:_0xcdd9a4['model'];if(_0x5c9e32[_0x75e3('0x3b')][_0x75e3('0x4a')]){_0x345e6a[_0x75e3('0x4b')]=[{'all':!![]}];}_0x345e6a=_[_0x75e3('0x45')]({},_0x345e6a,_0x5c9e32[_0x75e3('0x48')]);return db['FreshdeskAccount'][_0x75e3('0x4f')](_0x345e6a)[_0x75e3('0x19')](handleEntityNotFound(_0x34a447,null))[_0x75e3('0x19')](respondWithResult(_0x34a447,null))[_0x75e3('0x24')](handleError(_0x34a447,null));};exports['create']=function(_0x16ddcd,_0x120182){return db[_0x75e3('0x35')][_0x75e3('0x50')](_0x16ddcd['body'],{})[_0x75e3('0x19')](respondWithResult(_0x120182,0xc9))['catch'](handleError(_0x120182,null));};exports[_0x75e3('0x2f')]=function(_0x3767f3,_0x3f64f3){if(_0x3767f3[_0x75e3('0x51')]['id']){delete _0x3767f3[_0x75e3('0x51')]['id'];}return db['FreshdeskAccount'][_0x75e3('0x4f')]({'where':{'id':_0x3767f3[_0x75e3('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3f64f3,null))[_0x75e3('0x19')](saveUpdates(_0x3767f3['body'],null))['then'](respondWithResult(_0x3f64f3,null))[_0x75e3('0x24')](handleError(_0x3f64f3,null));};exports[_0x75e3('0x30')]=function(_0x2d7eaa,_0x10c4a0){return db[_0x75e3('0x35')]['find']({'where':{'id':_0x2d7eaa['params']['id']}})[_0x75e3('0x19')](handleEntityNotFound(_0x10c4a0,null))[_0x75e3('0x19')](removeEntity(_0x10c4a0,null))[_0x75e3('0x24')](handleError(_0x10c4a0,null));};exports['getConfigurations']=function(_0x120474,_0x179f59,_0x2b7632){var _0x2574ea={};var _0x3ef4c2={};var _0x1deacf;var _0x52e601;return db[_0x75e3('0x35')][_0x75e3('0x52')]({'where':{'id':_0x120474[_0x75e3('0x4d')]['id']}})[_0x75e3('0x19')](handleEntityNotFound(_0x179f59,null))[_0x75e3('0x19')](function(_0x572650){if(_0x572650){_0x1deacf=_0x572650;_0x3ef4c2[_0x75e3('0x39')]=_[_0x75e3('0x3c')](db[_0x75e3('0x53')]['rawAttributes']);_0x3ef4c2['query']=_[_0x75e3('0x3c')](_0x120474[_0x75e3('0x3b')]);_0x3ef4c2['filters']=_[_0x75e3('0x4e')](_0x3ef4c2[_0x75e3('0x39')],_0x3ef4c2[_0x75e3('0x3b')]);_0x2574ea[_0x75e3('0x3d')]=_[_0x75e3('0x4e')](_0x3ef4c2[_0x75e3('0x39')],qs[_0x75e3('0x3e')](_0x120474['query'][_0x75e3('0x3e')]));_0x2574ea[_0x75e3('0x3d')]=_0x2574ea[_0x75e3('0x3d')][_0x75e3('0x3f')]?_0x2574ea['attributes']:_0x3ef4c2[_0x75e3('0x39')];_0x2574ea[_0x75e3('0x41')]=qs[_0x75e3('0x42')](_0x120474[_0x75e3('0x3b')][_0x75e3('0x42')]);_0x2574ea[_0x75e3('0x46')]=qs[_0x75e3('0x43')](_[_0x75e3('0x44')](_0x120474['query'],_0x3ef4c2[_0x75e3('0x43')]));if(_0x120474[_0x75e3('0x3b')][_0x75e3('0x47')]){_0x2574ea[_0x75e3('0x46')]=_[_0x75e3('0x45')](_0x2574ea[_0x75e3('0x46')],{'$or':_[_0x75e3('0x3a')](_0x2574ea[_0x75e3('0x3d')],function(_0x545905){var _0x2ed72f={};_0x2ed72f[_0x545905]={'$like':'%'+_0x120474[_0x75e3('0x3b')][_0x75e3('0x47')]+'%'};return _0x2ed72f;})});}_0x2574ea=_['merge']({},_0x2574ea,_0x120474['options']);return _0x1deacf[_0x75e3('0x54')](_0x2574ea);}})[_0x75e3('0x19')](function(_0x19706f){if(_0x19706f){_0x52e601=_0x19706f['length'];if(!_0x120474[_0x75e3('0x3b')][_0x75e3('0x55')](_0x75e3('0x40'))){_0x2574ea[_0x75e3('0x29')]=qs['limit'](_0x120474[_0x75e3('0x3b')]['limit']);_0x2574ea[_0x75e3('0x28')]=qs[_0x75e3('0x28')](_0x120474[_0x75e3('0x3b')][_0x75e3('0x28')]);}return _0x1deacf[_0x75e3('0x54')](_0x2574ea);}})[_0x75e3('0x19')](function(_0x26f178){if(_0x26f178){return _0x26f178?{'count':_0x52e601,'rows':_0x26f178}:null;}})[_0x75e3('0x19')](respondWithResult(_0x179f59,null))[_0x75e3('0x24')](handleError(_0x179f59,null));};exports['addConfiguration']=function(_0x11c7a9,_0xaaf3a6,_0x57b7eb){if(_0x11c7a9['body']['id']){delete _0x11c7a9[_0x75e3('0x51')]['id'];}return db[_0x75e3('0x35')]['findOne']({'where':{'id':_0x11c7a9['params']['id']}})['then'](handleEntityNotFound(_0xaaf3a6,null))['then'](function(_0x1300d7){if(_0x1300d7){_0x11c7a9[_0x75e3('0x51')][_0x75e3('0x56')]=_0x1300d7['id'];_0x11c7a9[_0x75e3('0x51')][_0x75e3('0x57')]=integrations[_0x75e3('0x58')](_0x11c7a9[_0x75e3('0x51')][_0x75e3('0x59')],_0x11c7a9[_0x75e3('0x51')][_0x75e3('0x37')]);_0x11c7a9[_0x75e3('0x51')][_0x75e3('0x5a')]=integrations[_0x75e3('0x5b')](_0x11c7a9[_0x75e3('0x51')][_0x75e3('0x59')],_0x11c7a9[_0x75e3('0x51')][_0x75e3('0x37')]);return db[_0x75e3('0x53')][_0x75e3('0x50')](_0x11c7a9[_0x75e3('0x51')],{'include':[{'model':db[_0x75e3('0x5c')],'as':_0x75e3('0x57')},{'model':db[_0x75e3('0x5c')],'as':_0x75e3('0x5a')}]});}return null;})['then'](respondWithResult(_0xaaf3a6,null))[_0x75e3('0x24')](handleError(_0xaaf3a6,null));};exports['getFields']=function(_0x31b6ad,_0x171cb7,_0x575c4){var _0xee80bd='';return db['FreshdeskAccount'][_0x75e3('0x52')]({'where':{'id':_0x31b6ad['params']['id']},'attributes':['id',_0x75e3('0x5d'),'apiKey']})[_0x75e3('0x19')](handleEntityNotFound(_0x171cb7,null))[_0x75e3('0x19')](function(_0x48d22a){if(_0x48d22a){_0xee80bd=_0x48d22a[_0x75e3('0x5d')];var _0xa3d206=_0xee80bd[_0x75e3('0x5e')](-0x1);if(_0xa3d206==='/'){_0xee80bd=_0xee80bd[_0x75e3('0x5f')](0x0,_0xee80bd['lastIndexOf'](_0xa3d206));}return rp({'method':'GET','uri':util['format'](_0x75e3('0x60'),_0xee80bd,_0x75e3('0x61')),'headers':{'Authorization':util[_0x75e3('0x62')](_0x75e3('0x63'),new Buffer(util[_0x75e3('0x62')](_0x75e3('0x64'),_0x48d22a[_0x75e3('0x65')]))[_0x75e3('0x66')](_0x75e3('0x67')))},'json':!![]});}})[_0x75e3('0x19')](function(_0x558560){if(_0x558560){var _0x421329=[_0x75e3('0x68'),'subject',_0x75e3('0x69'),'description',_0x75e3('0x26'),'priority',_0x75e3('0x6a'),_0x75e3('0x6b'),_0x75e3('0x6c'),_0x75e3('0x6a'),'company'];_['remove'](_0x558560,function(_0x3b7479){return _0x421329[_0x75e3('0x6d')](_0x3b7479[_0x75e3('0x33')])||!_0x3b7479[_0x75e3('0x6e')]&&_0x3b7479[_0x75e3('0x37')]!=='custom_text'&&_0x3b7479[_0x75e3('0x37')]!==_0x75e3('0x6f');});return{'count':_0x558560[_0x75e3('0x3f')],'rows':_[_0x75e3('0x3a')](_0x558560,function(_0x555c96){return{'id':_0x555c96[_0x75e3('0x33')],'name':_0x555c96[_0x75e3('0x70')],'custom':!_0x555c96['default'],'options':_0x555c96[_0x75e3('0x71')]?_['map'](_0x555c96[_0x75e3('0x71')],function(_0x2a6cf1){return{'name':_['capitalize'](_0x2a6cf1),'value':_0x2a6cf1};}):[]};})};}})[_0x75e3('0x19')](respondWithResult(_0x171cb7,null))[_0x75e3('0x24')](function(_0x573cfd){var _0x587459=_0x31b6ad[_0x75e3('0x3b')]['test']?0x1f4:_0x573cfd[_0x75e3('0x72')]||0x1f4;logger[_0x75e3('0x20')](_0x75e3('0x73'),_0x75e3('0x74'),_0x587459,JSON['stringify'](_0x573cfd));delete _0x573cfd[_0x75e3('0x33')];if(_0x587459===0x191){_0x587459=0x190;}_0x171cb7[_0x75e3('0x26')](_0x587459)[_0x75e3('0x34')](_0x31b6ad[_0x75e3('0x3b')][_0x75e3('0x75')]?{'message':_0x75e3('0x76'),'statusCode':_0x573cfd[_0x75e3('0x72')]}:_0x573cfd);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index ef47f9f..c486e9b 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 _0xcc56=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','../../config/logger'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0xcc56,0x103));var _0x6cc5=function(_0x501336,_0x3dfa0e){_0x501336=_0x501336-0x0;var _0x1767c0=_0xcc56[_0x501336];return _0x1767c0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6cc5('0x0'))(_0x6cc5('0x1'));var moment=require(_0x6cc5('0x2'));var BPromise=require(_0x6cc5('0x3'));var rp=require(_0x6cc5('0x4'));var fs=require('fs');var path=require(_0x6cc5('0x5'));var rimraf=require(_0x6cc5('0x6'));var config=require(_0x6cc5('0x7'));var attributes=require(_0x6cc5('0x8'));var integrations=require(_0x6cc5('0x9'));module[_0x6cc5('0xa')]=function(_0x2e6af8,_0x59ffca){return _0x2e6af8[_0x6cc5('0xb')](_0x6cc5('0xc'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9433=['lodash','util','../../config/logger','moment','bluebird','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x1cb2b2,_0x4867a8){var _0x13e068=function(_0x5cc0a7){while(--_0x5cc0a7){_0x1cb2b2['push'](_0x1cb2b2['shift']());}};_0x13e068(++_0x4867a8);}(_0x9433,0x114));var _0x3943=function(_0x447b2b,_0x5bbcc5){_0x447b2b=_0x447b2b-0x0;var _0x471d98=_0x9433[_0x447b2b];return _0x471d98;};'use strict';var _=require(_0x3943('0x0'));var util=require(_0x3943('0x1'));var logger=require(_0x3943('0x2'))('api');var moment=require(_0x3943('0x3'));var BPromise=require(_0x3943('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3943('0x5'));var config=require('../../config/environment');var attributes=require(_0x3943('0x6'));var integrations=require(_0x3943('0x7'));module[_0x3943('0x8')]=function(_0x6a6161,_0x3f3511){return _0x6a6161[_0x3943('0x9')](_0x3943('0xa'),attributes,{'tableName':_0x3943('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 6981dc7..c2189f5 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 _0x848e=['stringify','error','code','message','result','catch','GetFreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshdeskAccount','FreshdeskAccount','find','info','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x1e54ba,_0x5873ed){var _0x50f2c6=function(_0x329af4){while(--_0x329af4){_0x1e54ba['push'](_0x1e54ba['shift']());}};_0x50f2c6(++_0x5873ed);}(_0x848e,0x1dc));var _0xe848=function(_0x30631b,_0x50799b){_0x30631b=_0x30631b-0x0;var _0x3d57c6=_0x848e[_0x30631b];return _0x3d57c6;};'use strict';var _=require('lodash');var util=require(_0xe848('0x0'));var moment=require(_0xe848('0x1'));var BPromise=require(_0xe848('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe848('0x3'));var db=require(_0xe848('0x4'))['db'];var utils=require(_0xe848('0x5'));var logger=require(_0xe848('0x6'))(_0xe848('0x7'));var config=require(_0xe848('0x8'));var jayson=require(_0xe848('0x9'));var client=jayson[_0xe848('0xa')][_0xe848('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4911bb,_0x1c60db,_0x1e8ce5){return new BPromise(function(_0xaba023,_0x1b80dc){return client[_0xe848('0xc')](_0x4911bb,_0x1e8ce5)[_0xe848('0xd')](function(_0x68cbf5){logger['info'](_0xe848('0xe'),_0x1c60db,_0xe848('0xf'));logger[_0xe848('0x10')](_0xe848('0x11'),_0x1c60db,'request\x20sent',JSON[_0xe848('0x12')](_0x68cbf5));if(_0x68cbf5[_0xe848('0x13')]){if(_0x68cbf5['error'][_0xe848('0x14')]===0x1f4){logger[_0xe848('0x13')](_0xe848('0xe'),_0x1c60db,_0x68cbf5[_0xe848('0x13')]['message']);return _0x1b80dc(_0x68cbf5[_0xe848('0x13')][_0xe848('0x15')]);}logger[_0xe848('0x13')](_0xe848('0xe'),_0x1c60db,_0x68cbf5[_0xe848('0x13')][_0xe848('0x15')]);return _0xaba023(_0x68cbf5[_0xe848('0x13')]['message']);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x1c60db,_0xe848('0xf'));_0xaba023(_0x68cbf5[_0xe848('0x16')][_0xe848('0x15')]);}})[_0xe848('0x17')](function(_0x1564d3){logger[_0xe848('0x13')](_0xe848('0xe'),_0x1c60db,_0x1564d3);_0x1b80dc(_0x1564d3);});});}exports[_0xe848('0x18')]=function(_0x1d3e7e){var _0x12ea0b=this;return new Promise(function(_0x2932c2,_0x430c45){return db['FreshdeskAccount'][_0xe848('0x19')]({'raw':_0x1d3e7e[_0xe848('0x1a')]?_0x1d3e7e[_0xe848('0x1a')][_0xe848('0x1b')]===undefined?!![]:![]:!![],'where':_0x1d3e7e['options']?_0x1d3e7e[_0xe848('0x1a')][_0xe848('0x1c')]||null:null,'attributes':_0x1d3e7e[_0xe848('0x1a')]?_0x1d3e7e[_0xe848('0x1a')][_0xe848('0x1d')]||null:null,'limit':_0x1d3e7e[_0xe848('0x1a')]?_0x1d3e7e['options'][_0xe848('0x1e')]||null:null,'include':_0x1d3e7e[_0xe848('0x1a')]?_0x1d3e7e[_0xe848('0x1a')][_0xe848('0x1f')]?_[_0xe848('0x20')](_0x1d3e7e[_0xe848('0x1a')][_0xe848('0x1f')],function(_0x3e8c39){return{'model':db[_0x3e8c39[_0xe848('0x21')]],'as':_0x3e8c39['as'],'attributes':_0x3e8c39[_0xe848('0x1d')],'include':_0x3e8c39[_0xe848('0x1f')]?_['map'](_0x3e8c39['include'],function(_0x455dcf){return{'model':db[_0x455dcf[_0xe848('0x21')]],'as':_0x455dcf['as'],'attributes':_0x455dcf['attributes'],'include':_0x455dcf[_0xe848('0x1f')]?_[_0xe848('0x20')](_0x455dcf[_0xe848('0x1f')],function(_0x1c1853){return{'model':db[_0x1c1853[_0xe848('0x21')]],'as':_0x1c1853['as'],'attributes':_0x1c1853[_0xe848('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3aa250){logger['info']('GetFreshdeskAccount',_0x1d3e7e);logger[_0xe848('0x10')](_0xe848('0x18'),_0x1d3e7e,JSON[_0xe848('0x12')](_0x3aa250));_0x2932c2(_0x3aa250);})['catch'](function(_0x2d2e24){logger[_0xe848('0x13')](_0xe848('0x18'),_0x2d2e24[_0xe848('0x15')],_0x1d3e7e);_0x430c45(_0x12ea0b[_0xe848('0x13')](0x1f4,_0x2d2e24['message']));});});};exports[_0xe848('0x22')]=function(_0x3eab9e){var _0x5710ef=this;return new Promise(function(_0x283eb0,_0x4e3309){return db[_0xe848('0x23')][_0xe848('0x24')]({'raw':_0x3eab9e[_0xe848('0x1a')]?_0x3eab9e[_0xe848('0x1a')][_0xe848('0x1b')]===undefined?!![]:![]:!![],'where':_0x3eab9e[_0xe848('0x1a')]?_0x3eab9e[_0xe848('0x1a')][_0xe848('0x1c')]||null:null,'attributes':_0x3eab9e['options']?_0x3eab9e[_0xe848('0x1a')][_0xe848('0x1d')]||null:null,'include':_0x3eab9e[_0xe848('0x1a')]?_0x3eab9e[_0xe848('0x1a')][_0xe848('0x1f')]?_[_0xe848('0x20')](_0x3eab9e[_0xe848('0x1a')][_0xe848('0x1f')],function(_0x4f3cdd){return{'model':db[_0x4f3cdd[_0xe848('0x21')]],'as':_0x4f3cdd['as'],'attributes':_0x4f3cdd[_0xe848('0x1d')],'include':_0x4f3cdd[_0xe848('0x1f')]?_['map'](_0x4f3cdd[_0xe848('0x1f')],function(_0x54fdf3){return{'model':db[_0x54fdf3[_0xe848('0x21')]],'as':_0x54fdf3['as'],'attributes':_0x54fdf3['attributes'],'include':_0x54fdf3[_0xe848('0x1f')]?_[_0xe848('0x20')](_0x54fdf3[_0xe848('0x1f')],function(_0x5ee847){return{'model':db[_0x5ee847['model']],'as':_0x5ee847['as'],'attributes':_0x5ee847['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x10b5ea){logger[_0xe848('0x25')]('ShowFreshdeskAccount',_0x3eab9e);logger['debug']('ShowFreshdeskAccount',_0x3eab9e,JSON['stringify'](_0x10b5ea));_0x283eb0(_0x10b5ea);})[_0xe848('0x17')](function(_0x35624c){logger['error']('ShowFreshdeskAccount',_0x35624c[_0xe848('0x15')],_0x3eab9e);_0x4e3309(_0x5710ef[_0xe848('0x13')](0x1f4,_0x35624c[_0xe848('0x15')]));});});}; \ No newline at end of file +var _0x0e2e=['result','GetFreshdeskAccount','FreshdeskAccount','options','where','limit','map','include','attributes','model','info','catch','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','FreshdeskAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x0e2e,0xed));var _0xe0e2=function(_0x40a53c,_0x44a52f){_0x40a53c=_0x40a53c-0x0;var _0x27a53b=_0x0e2e[_0x40a53c];return _0x27a53b;};'use strict';var _=require(_0xe0e2('0x0'));var util=require(_0xe0e2('0x1'));var moment=require(_0xe0e2('0x2'));var BPromise=require(_0xe0e2('0x3'));var rs=require(_0xe0e2('0x4'));var fs=require('fs');var Redis=require(_0xe0e2('0x5'));var db=require(_0xe0e2('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe0e2('0x7'));var config=require(_0xe0e2('0x8'));var jayson=require(_0xe0e2('0x9'));var client=jayson[_0xe0e2('0xa')][_0xe0e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25236c,_0x40c93f,_0x141a2d){return new BPromise(function(_0x2d4db8,_0x8e73e9){return client['request'](_0x25236c,_0x141a2d)[_0xe0e2('0xc')](function(_0x2048bd){logger['info'](_0xe0e2('0xd'),_0x40c93f,'request\x20sent');logger[_0xe0e2('0xe')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x40c93f,_0xe0e2('0xf'),JSON[_0xe0e2('0x10')](_0x2048bd));if(_0x2048bd[_0xe0e2('0x11')]){if(_0x2048bd[_0xe0e2('0x11')]['code']===0x1f4){logger[_0xe0e2('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x40c93f,_0x2048bd[_0xe0e2('0x11')][_0xe0e2('0x12')]);return _0x8e73e9(_0x2048bd[_0xe0e2('0x11')]['message']);}logger[_0xe0e2('0x11')](_0xe0e2('0xd'),_0x40c93f,_0x2048bd[_0xe0e2('0x11')]['message']);return _0x2d4db8(_0x2048bd[_0xe0e2('0x11')][_0xe0e2('0x12')]);}else{logger['info'](_0xe0e2('0xd'),_0x40c93f,_0xe0e2('0xf'));_0x2d4db8(_0x2048bd[_0xe0e2('0x13')][_0xe0e2('0x12')]);}})['catch'](function(_0x2cf288){logger[_0xe0e2('0x11')](_0xe0e2('0xd'),_0x40c93f,_0x2cf288);_0x8e73e9(_0x2cf288);});});}exports[_0xe0e2('0x14')]=function(_0x4ee11a){var _0x2a2a2b=this;return new Promise(function(_0x228cb5,_0x3bdfff){return db[_0xe0e2('0x15')]['findAll']({'raw':_0x4ee11a[_0xe0e2('0x16')]?_0x4ee11a['options']['raw']===undefined?!![]:![]:!![],'where':_0x4ee11a[_0xe0e2('0x16')]?_0x4ee11a[_0xe0e2('0x16')][_0xe0e2('0x17')]||null:null,'attributes':_0x4ee11a['options']?_0x4ee11a['options']['attributes']||null:null,'limit':_0x4ee11a[_0xe0e2('0x16')]?_0x4ee11a['options'][_0xe0e2('0x18')]||null:null,'include':_0x4ee11a['options']?_0x4ee11a[_0xe0e2('0x16')]['include']?_[_0xe0e2('0x19')](_0x4ee11a[_0xe0e2('0x16')][_0xe0e2('0x1a')],function(_0x2ce68a){return{'model':db[_0x2ce68a['model']],'as':_0x2ce68a['as'],'attributes':_0x2ce68a['attributes'],'include':_0x2ce68a[_0xe0e2('0x1a')]?_[_0xe0e2('0x19')](_0x2ce68a['include'],function(_0x38a657){return{'model':db[_0x38a657['model']],'as':_0x38a657['as'],'attributes':_0x38a657[_0xe0e2('0x1b')],'include':_0x38a657[_0xe0e2('0x1a')]?_['map'](_0x38a657[_0xe0e2('0x1a')],function(_0x476418){return{'model':db[_0x476418[_0xe0e2('0x1c')]],'as':_0x476418['as'],'attributes':_0x476418[_0xe0e2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe0e2('0xc')](function(_0x2ee98d){logger[_0xe0e2('0x1d')](_0xe0e2('0x14'),_0x4ee11a);logger[_0xe0e2('0xe')](_0xe0e2('0x14'),_0x4ee11a,JSON[_0xe0e2('0x10')](_0x2ee98d));_0x228cb5(_0x2ee98d);})[_0xe0e2('0x1e')](function(_0x392a35){logger['error'](_0xe0e2('0x14'),_0x392a35[_0xe0e2('0x12')],_0x4ee11a);_0x3bdfff(_0x2a2a2b['error'](0x1f4,_0x392a35[_0xe0e2('0x12')]));});});};exports[_0xe0e2('0x1f')]=function(_0x24a79a){var _0xa5965=this;return new Promise(function(_0x33c7f2,_0x5c4106){return db['FreshdeskAccount']['find']({'raw':_0x24a79a['options']?_0x24a79a[_0xe0e2('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x24a79a[_0xe0e2('0x16')]?_0x24a79a[_0xe0e2('0x16')]['where']||null:null,'attributes':_0x24a79a['options']?_0x24a79a[_0xe0e2('0x16')][_0xe0e2('0x1b')]||null:null,'include':_0x24a79a[_0xe0e2('0x16')]?_0x24a79a['options'][_0xe0e2('0x1a')]?_['map'](_0x24a79a[_0xe0e2('0x16')]['include'],function(_0x2243a5){return{'model':db[_0x2243a5[_0xe0e2('0x1c')]],'as':_0x2243a5['as'],'attributes':_0x2243a5[_0xe0e2('0x1b')],'include':_0x2243a5[_0xe0e2('0x1a')]?_['map'](_0x2243a5[_0xe0e2('0x1a')],function(_0x222b30){return{'model':db[_0x222b30[_0xe0e2('0x1c')]],'as':_0x222b30['as'],'attributes':_0x222b30[_0xe0e2('0x1b')],'include':_0x222b30[_0xe0e2('0x1a')]?_[_0xe0e2('0x19')](_0x222b30['include'],function(_0x59e4ee){return{'model':db[_0x59e4ee[_0xe0e2('0x1c')]],'as':_0x59e4ee['as'],'attributes':_0x59e4ee[_0xe0e2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe0e2('0xc')](function(_0x4c3370){logger[_0xe0e2('0x1d')]('ShowFreshdeskAccount',_0x24a79a);logger[_0xe0e2('0xe')](_0xe0e2('0x1f'),_0x24a79a,JSON[_0xe0e2('0x10')](_0x4c3370));_0x33c7f2(_0x4c3370);})[_0xe0e2('0x1e')](function(_0xd3e7be){logger[_0xe0e2('0x11')](_0xe0e2('0x1f'),_0xd3e7be[_0xe0e2('0x12')],_0x24a79a);_0x5c4106(_0xa5965[_0xe0e2('0x11')](0x1f4,_0xd3e7be[_0xe0e2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 128e13a..cc2d63c 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 _0xf87d=['express','Router','../../components/interaction/service','get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf87d,0x1cb));var _0xdf87=function(_0x43ab94,_0x23c61f){_0x43ab94=_0x43ab94-0x0;var _0x2192b8=_0xf87d[_0x43ab94];return _0x2192b8;};'use strict';var multer=require(_0xdf87('0x0'));var util=require(_0xdf87('0x1'));var path=require('path');var timeout=require(_0xdf87('0x2'));var express=require(_0xdf87('0x3'));var router=express[_0xdf87('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdf87('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0xdf87('0x6')]('/',auth[_0xdf87('0x7')](),controller['index']);router[_0xdf87('0x6')](_0xdf87('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xdf87('0x6')](_0xdf87('0x9'),auth['isAuthenticated'](),controller[_0xdf87('0xa')]);router[_0xdf87('0x6')](_0xdf87('0xb'),auth['isAuthenticated'](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0xdf87('0x7')](),controller[_0xdf87('0xc')]);router['get'](_0xdf87('0xd'),auth[_0xdf87('0x7')](),controller[_0xdf87('0xe')]);router[_0xdf87('0xf')]('/',auth[_0xdf87('0x7')](),controller[_0xdf87('0x10')]);router['post'](_0xdf87('0xd'),auth[_0xdf87('0x7')](),controller[_0xdf87('0x11')]);router[_0xdf87('0x12')]('/:id',auth[_0xdf87('0x7')](),controller['update']);router[_0xdf87('0x13')]('/:id',auth[_0xdf87('0x7')](),controller[_0xdf87('0x14')]);module[_0xdf87('0x15')]=router; \ No newline at end of file +var _0xa583=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','/:id/fields','getFields','/:id/subjects','getDescriptions','post','create','setTags','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa583,0xb4));var _0x3a58=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xa583[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x3a58('0x0'));var util=require(_0x3a58('0x1'));var path=require(_0x3a58('0x2'));var timeout=require(_0x3a58('0x3'));var express=require('express');var router=express[_0x3a58('0x4')]();var fs_extra=require(_0x3a58('0x5'));var auth=require(_0x3a58('0x6'));var interaction=require(_0x3a58('0x7'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0x3a58('0x8')](),controller[_0x3a58('0x9')]);router[_0x3a58('0xa')](_0x3a58('0xb'),auth[_0x3a58('0x8')](),controller['show']);router[_0x3a58('0xa')](_0x3a58('0xc'),auth['isAuthenticated'](),controller[_0x3a58('0xd')]);router[_0x3a58('0xa')](_0x3a58('0xe'),auth[_0x3a58('0x8')](),controller['getSubjects']);router[_0x3a58('0xa')]('/:id/descriptions',auth[_0x3a58('0x8')](),controller[_0x3a58('0xf')]);router[_0x3a58('0xa')]('/:id/tags',auth[_0x3a58('0x8')](),controller['getTags']);router[_0x3a58('0x10')]('/',auth[_0x3a58('0x8')](),controller[_0x3a58('0x11')]);router[_0x3a58('0x10')]('/:id/tags',auth['isAuthenticated'](),controller[_0x3a58('0x12')]);router[_0x3a58('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x3a58('0x14')]);router['delete'](_0x3a58('0xb'),auth[_0x3a58('0x8')](),controller[_0x3a58('0x15')]);module[_0x3a58('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 24b5de5..ced3920 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 _0x7d3b=['STRING','sequelize','exports'];(function(_0x46cbce,_0xf56893){var _0x3fd1b3=function(_0xf8e9ee){while(--_0xf8e9ee){_0x46cbce['push'](_0x46cbce['shift']());}};_0x3fd1b3(++_0xf56893);}(_0x7d3b,0x76));var _0xb7d3=function(_0x7f5cd5,_0x2984ff){_0x7f5cd5=_0x7f5cd5-0x0;var _0x4afb29=_0x7d3b[_0x7f5cd5];return _0x4afb29;};'use strict';var Sequelize=require(_0xb7d3('0x0'));module[_0xb7d3('0x1')]={'name':{'type':Sequelize[_0xb7d3('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3056=['sequelize','exports','STRING'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0x3056,0xb1));var _0x6305=function(_0x28b9d2,_0x56a019){_0x28b9d2=_0x28b9d2-0x0;var _0x55f4b8=_0x3056[_0x28b9d2];return _0x55f4b8;};'use strict';var Sequelize=require(_0x6305('0x0'));module[_0x6305('0x1')]={'name':{'type':Sequelize[_0x6305('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 6ab8cb7..cbce30d 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 _0x1c63=['filter','where','merge','VIRTUAL','options','count','includeAll','findAll','rows','show','params','rawAttributes','include','find','create','body','destroy','getFields','findOne','FreshdeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','info','result','catch','status','json','offset','limit','set','apply','reject','save','update','then','end','sendStatus','stack','name','send','index','map','FreshdeskConfiguration','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick'];(function(_0x571118,_0x201a59){var _0x5da3eb=function(_0x2e8bb1){while(--_0x2e8bb1){_0x571118['push'](_0x571118['shift']());}};_0x5da3eb(++_0x201a59);}(_0x1c63,0xdc));var _0x31c6=function(_0x7cb905,_0x5c2772){_0x7cb905=_0x7cb905-0x0;var _0x411552=_0x1c63[_0x7cb905];return _0x411552;};'use strict';var pdf=require(_0x31c6('0x0'));var emlformat=require(_0x31c6('0x1'));var rimraf=require(_0x31c6('0x2'));var zipdir=require(_0x31c6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x31c6('0x4'));var moment=require(_0x31c6('0x5'));var BPromise=require(_0x31c6('0x6'));var Mustache=require('mustache');var util=require(_0x31c6('0x7'));var path=require(_0x31c6('0x8'));var sox=require(_0x31c6('0x9'));var csv=require(_0x31c6('0xa'));var ejs=require(_0x31c6('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x31c6('0xc'));var crypto=require(_0x31c6('0xd'));var jsforce=require(_0x31c6('0xe'));var deskjs=require(_0x31c6('0xf'));var toCsv=require(_0x31c6('0xa'));var querystring=require('querystring');var Papa=require(_0x31c6('0x10'));var Redis=require(_0x31c6('0x11'));var authService=require(_0x31c6('0x12'));var qs=require(_0x31c6('0x13'));var as=require(_0x31c6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x31c6('0x15'))('api');var utils=require(_0x31c6('0x16'));var config=require(_0x31c6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x31c6('0x18'))['db'];var jayson=require(_0x31c6('0x19'));var client=jayson[_0x31c6('0x1a')][_0x31c6('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x175e9a,_0x318994,_0x4d1710,_0x11e6a4){return new BPromise(function(_0x3995cc,_0x42c611){var _0x28dbc9=_0x11e6a4||client;return _0x28dbc9[_0x31c6('0x1c')](_0x175e9a,_0x4d1710)['then'](function(_0x5f2c85){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x318994,_0x31c6('0x1d'));logger['debug'](_0x31c6('0x1e'),_0x318994,_0x31c6('0x1d'),JSON[_0x31c6('0x1f')](_0x5f2c85));if(_0x5f2c85[_0x31c6('0x20')]){if(_0x5f2c85[_0x31c6('0x20')][_0x31c6('0x21')]===0x1f4){logger[_0x31c6('0x20')](_0x31c6('0x22'),_0x318994,_0x5f2c85['error']['message']);return _0x42c611(_0x5f2c85['error'][_0x31c6('0x23')]);}logger[_0x31c6('0x20')](_0x31c6('0x22'),_0x318994,_0x5f2c85[_0x31c6('0x20')]['message']);return _0x3995cc(_0x5f2c85['error'][_0x31c6('0x23')]);}else{logger[_0x31c6('0x24')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x318994,_0x31c6('0x1d'));_0x3995cc(_0x5f2c85[_0x31c6('0x25')][_0x31c6('0x23')]);}})[_0x31c6('0x26')](function(_0x1f3255){logger['error'](_0x31c6('0x22'),_0x318994,_0x1f3255);_0x42c611(_0x1f3255);});});}function respondWithStatusCode(_0x536e57,_0x8773d4){_0x8773d4=_0x8773d4||0xcc;return function(_0x178973){if(_0x178973){return _0x536e57['sendStatus'](_0x8773d4);}return _0x536e57['status'](_0x8773d4)['end']();};}function respondWithResult(_0x412a8a,_0x250ab1){_0x250ab1=_0x250ab1||0xc8;return function(_0x551291){if(_0x551291){return _0x412a8a[_0x31c6('0x27')](_0x250ab1)[_0x31c6('0x28')](_0x551291);}};}function respondWithFilteredResult(_0x2c9d78,_0x2fb5f3){return function(_0x4828f3){if(_0x4828f3){var _0x542209=_0x4828f3['count'],_0x559f65=_0x2fb5f3['offset'],_0x53fa6c=_0x2fb5f3[_0x31c6('0x29')]+_0x2fb5f3[_0x31c6('0x2a')],_0x433cf8;if(_0x53fa6c>=_0x542209){_0x53fa6c=_0x542209;_0x433cf8=0xc8;}else{_0x433cf8=0xce;}_0x2c9d78['status'](_0x433cf8);return _0x2c9d78[_0x31c6('0x2b')]('Content-Range',_0x559f65+'-'+_0x53fa6c+'/'+_0x542209)[_0x31c6('0x28')](_0x4828f3);}return null;};}function patchUpdates(_0x3443d8){return function(_0x58089d){try{jsonpatch[_0x31c6('0x2c')](_0x58089d,_0x3443d8,!![]);}catch(_0x3840de){return BPromise[_0x31c6('0x2d')](_0x3840de);}return _0x58089d[_0x31c6('0x2e')]();};}function saveUpdates(_0x202f45,_0x35c366){return function(_0x59e2d7){if(_0x59e2d7){return _0x59e2d7[_0x31c6('0x2f')](_0x202f45)[_0x31c6('0x30')](function(_0x49fda2){return _0x49fda2;});}return null;};}function removeEntity(_0x3cdf2c,_0x2fe1fb){return function(_0x5a0f56){if(_0x5a0f56){return _0x5a0f56['destroy']()['then'](function(){_0x3cdf2c[_0x31c6('0x27')](0xcc)[_0x31c6('0x31')]();});}};}function handleEntityNotFound(_0x4fc40b,_0x26cd29){return function(_0x3f6353){if(!_0x3f6353){_0x4fc40b[_0x31c6('0x32')](0x194);}return _0x3f6353;};}function handleError(_0x427124,_0xc796fb){_0xc796fb=_0xc796fb||0x1f4;return function(_0x57143f){logger[_0x31c6('0x20')](_0x57143f[_0x31c6('0x33')]);if(_0x57143f[_0x31c6('0x34')]){delete _0x57143f[_0x31c6('0x34')];}_0x427124[_0x31c6('0x27')](_0xc796fb)[_0x31c6('0x35')](_0x57143f);};}exports[_0x31c6('0x36')]=function(_0x2d0fdf,_0xf6e542){var _0x4b76c1={},_0x3f901f={},_0x2cc3d1={'count':0x0,'rows':[]};var _0x55529e=_[_0x31c6('0x37')](db[_0x31c6('0x38')]['rawAttributes'],function(_0x1c8f02){return{'name':_0x1c8f02[_0x31c6('0x39')],'type':_0x1c8f02[_0x31c6('0x3a')]['key']};});_0x3f901f[_0x31c6('0x3b')]=_['map'](_0x55529e,_0x31c6('0x34'));_0x3f901f[_0x31c6('0x3c')]=_[_0x31c6('0x3d')](_0x2d0fdf['query']);_0x3f901f[_0x31c6('0x3e')]=_[_0x31c6('0x3f')](_0x3f901f[_0x31c6('0x3b')],_0x3f901f[_0x31c6('0x3c')]);_0x4b76c1['attributes']=_['intersection'](_0x3f901f[_0x31c6('0x3b')],qs[_0x31c6('0x40')](_0x2d0fdf[_0x31c6('0x3c')][_0x31c6('0x40')]));_0x4b76c1[_0x31c6('0x41')]=_0x4b76c1[_0x31c6('0x41')][_0x31c6('0x42')]?_0x4b76c1[_0x31c6('0x41')]:_0x3f901f[_0x31c6('0x3b')];if(!_0x2d0fdf[_0x31c6('0x3c')]['hasOwnProperty'](_0x31c6('0x43'))){_0x4b76c1[_0x31c6('0x2a')]=qs['limit'](_0x2d0fdf['query'][_0x31c6('0x2a')]);_0x4b76c1[_0x31c6('0x29')]=qs[_0x31c6('0x29')](_0x2d0fdf[_0x31c6('0x3c')][_0x31c6('0x29')]);}_0x4b76c1[_0x31c6('0x44')]=qs['sort'](_0x2d0fdf['query'][_0x31c6('0x45')]);_0x4b76c1['where']=qs[_0x31c6('0x3e')](_[_0x31c6('0x46')](_0x2d0fdf['query'],_0x3f901f[_0x31c6('0x3e')]),_0x55529e);if(_0x2d0fdf[_0x31c6('0x3c')][_0x31c6('0x47')]){_0x4b76c1[_0x31c6('0x48')]=_[_0x31c6('0x49')](_0x4b76c1[_0x31c6('0x48')],{'$or':_['map'](_0x55529e,function(_0x13fc6c){if(_0x13fc6c[_0x31c6('0x3a')]!==_0x31c6('0x4a')){var _0x1600b3={};_0x1600b3[_0x13fc6c[_0x31c6('0x34')]]={'$like':'%'+_0x2d0fdf['query'][_0x31c6('0x47')]+'%'};return _0x1600b3;}})});}_0x4b76c1=_[_0x31c6('0x49')]({},_0x4b76c1,_0x2d0fdf[_0x31c6('0x4b')]);var _0x4763b6={'where':_0x4b76c1['where']};return db[_0x31c6('0x38')]['count'](_0x4763b6)[_0x31c6('0x30')](function(_0x1f719d){_0x2cc3d1[_0x31c6('0x4c')]=_0x1f719d;if(_0x2d0fdf[_0x31c6('0x3c')][_0x31c6('0x4d')]){_0x4b76c1['include']=[{'all':!![]}];}return db[_0x31c6('0x38')][_0x31c6('0x4e')](_0x4b76c1);})[_0x31c6('0x30')](function(_0x337edd){_0x2cc3d1[_0x31c6('0x4f')]=_0x337edd;return _0x2cc3d1;})[_0x31c6('0x30')](respondWithFilteredResult(_0xf6e542,_0x4b76c1))['catch'](handleError(_0xf6e542,null));};exports[_0x31c6('0x50')]=function(_0x52d06d,_0x2b808a){var _0x543856={'raw':![],'where':{'id':_0x52d06d[_0x31c6('0x51')]['id']}},_0x48af2c={};_0x48af2c[_0x31c6('0x3b')]=_['keys'](db[_0x31c6('0x38')][_0x31c6('0x52')]);_0x48af2c[_0x31c6('0x3c')]=_['keys'](_0x52d06d['query']);_0x48af2c[_0x31c6('0x3e')]=_[_0x31c6('0x3f')](_0x48af2c[_0x31c6('0x3b')],_0x48af2c[_0x31c6('0x3c')]);_0x543856[_0x31c6('0x41')]=_[_0x31c6('0x3f')](_0x48af2c[_0x31c6('0x3b')],qs[_0x31c6('0x40')](_0x52d06d[_0x31c6('0x3c')][_0x31c6('0x40')]));_0x543856[_0x31c6('0x41')]=_0x543856[_0x31c6('0x41')]['length']?_0x543856['attributes']:_0x48af2c['model'];if(_0x52d06d[_0x31c6('0x3c')][_0x31c6('0x4d')]){_0x543856[_0x31c6('0x53')]=[{'all':!![]}];}_0x543856=_[_0x31c6('0x49')]({},_0x543856,_0x52d06d[_0x31c6('0x4b')]);return db[_0x31c6('0x38')][_0x31c6('0x54')](_0x543856)['then'](handleEntityNotFound(_0x2b808a,null))['then'](respondWithResult(_0x2b808a,null))[_0x31c6('0x26')](handleError(_0x2b808a,null));};exports[_0x31c6('0x55')]=function(_0xfa23a3,_0x28f181){return db['FreshdeskConfiguration'][_0x31c6('0x55')](_0xfa23a3[_0x31c6('0x56')],{})['then'](respondWithResult(_0x28f181,0xc9))['catch'](handleError(_0x28f181,null));};exports['update']=function(_0x332a5b,_0x3e9d82){if(_0x332a5b[_0x31c6('0x56')]['id']){delete _0x332a5b[_0x31c6('0x56')]['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0x332a5b[_0x31c6('0x51')]['id']}})[_0x31c6('0x30')](handleEntityNotFound(_0x3e9d82,null))['then'](saveUpdates(_0x332a5b['body'],null))[_0x31c6('0x30')](respondWithResult(_0x3e9d82,null))['catch'](handleError(_0x3e9d82,null));};exports[_0x31c6('0x57')]=function(_0xfccf5e,_0x13f958){return db['FreshdeskConfiguration']['find']({'where':{'id':_0xfccf5e['params']['id']}})['then'](handleEntityNotFound(_0x13f958,null))[_0x31c6('0x30')](removeEntity(_0x13f958,null))['catch'](handleError(_0x13f958,null));};exports[_0x31c6('0x58')]=function(_0x414bea,_0x1b1945,_0x2a660a){var _0x4de6e9={};var _0x1941b3={};var _0x4bc617;var _0x248c26;return db['FreshdeskConfiguration'][_0x31c6('0x59')]({'where':{'id':_0x414bea[_0x31c6('0x51')]['id']}})[_0x31c6('0x30')](handleEntityNotFound(_0x1b1945,null))['then'](function(_0x378c12){if(_0x378c12){_0x4bc617=_0x378c12;_0x1941b3[_0x31c6('0x3b')]=_[_0x31c6('0x3d')](db[_0x31c6('0x5a')][_0x31c6('0x52')]);_0x1941b3['query']=_[_0x31c6('0x3d')](_0x414bea[_0x31c6('0x3c')]);_0x1941b3['filters']=_['intersection'](_0x1941b3[_0x31c6('0x3b')],_0x1941b3[_0x31c6('0x3c')]);_0x4de6e9['attributes']=_['intersection'](_0x1941b3[_0x31c6('0x3b')],qs['fields'](_0x414bea[_0x31c6('0x3c')][_0x31c6('0x40')]));_0x4de6e9[_0x31c6('0x41')]=_0x4de6e9[_0x31c6('0x41')][_0x31c6('0x42')]?_0x4de6e9[_0x31c6('0x41')]:_0x1941b3[_0x31c6('0x3b')];_0x4de6e9[_0x31c6('0x44')]=qs[_0x31c6('0x45')](_0x414bea['query'][_0x31c6('0x45')]);_0x4de6e9[_0x31c6('0x48')]=qs['filters'](_[_0x31c6('0x46')](_0x414bea[_0x31c6('0x3c')],_0x1941b3[_0x31c6('0x3e')]));if(_0x414bea[_0x31c6('0x3c')][_0x31c6('0x47')]){_0x4de6e9[_0x31c6('0x48')]=_[_0x31c6('0x49')](_0x4de6e9[_0x31c6('0x48')],{'$or':_['map'](_0x4de6e9[_0x31c6('0x41')],function(_0x9f2fd3){var _0x3c5cbb={};_0x3c5cbb[_0x9f2fd3]={'$like':'%'+_0x414bea[_0x31c6('0x3c')][_0x31c6('0x47')]+'%'};return _0x3c5cbb;})});}_0x4de6e9=_[_0x31c6('0x49')]({},_0x4de6e9,_0x414bea['options']);return _0x4bc617[_0x31c6('0x58')](_0x4de6e9);}})[_0x31c6('0x30')](function(_0x4b8384){if(_0x4b8384){_0x248c26=_0x4b8384[_0x31c6('0x42')];if(!_0x414bea[_0x31c6('0x3c')][_0x31c6('0x5b')]('nolimit')){_0x4de6e9[_0x31c6('0x2a')]=qs[_0x31c6('0x2a')](_0x414bea['query'][_0x31c6('0x2a')]);_0x4de6e9[_0x31c6('0x29')]=qs['offset'](_0x414bea[_0x31c6('0x3c')][_0x31c6('0x29')]);}return _0x4bc617[_0x31c6('0x58')](_0x4de6e9);}})[_0x31c6('0x30')](function(_0x222b63){if(_0x222b63){return _0x222b63?{'count':_0x248c26,'rows':_0x222b63}:null;}})['then'](respondWithResult(_0x1b1945,null))[_0x31c6('0x26')](handleError(_0x1b1945,null));};exports[_0x31c6('0x5c')]=function(_0x4bb496,_0x540c45,_0x5a7712){var _0x3c08dc={};var _0x584b0f={};var _0x15b1f9;var _0x55d404;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x4bb496['params']['id']}})[_0x31c6('0x30')](handleEntityNotFound(_0x540c45,null))[_0x31c6('0x30')](function(_0x2ab897){if(_0x2ab897){_0x15b1f9=_0x2ab897;_0x584b0f[_0x31c6('0x3b')]=_[_0x31c6('0x3d')](db[_0x31c6('0x5a')]['rawAttributes']);_0x584b0f[_0x31c6('0x3c')]=_[_0x31c6('0x3d')](_0x4bb496[_0x31c6('0x3c')]);_0x584b0f[_0x31c6('0x3e')]=_[_0x31c6('0x3f')](_0x584b0f[_0x31c6('0x3b')],_0x584b0f['query']);_0x3c08dc[_0x31c6('0x41')]=_[_0x31c6('0x3f')](_0x584b0f[_0x31c6('0x3b')],qs['fields'](_0x4bb496[_0x31c6('0x3c')]['fields']));_0x3c08dc[_0x31c6('0x41')]=_0x3c08dc[_0x31c6('0x41')]['length']?_0x3c08dc[_0x31c6('0x41')]:_0x584b0f['model'];_0x3c08dc['order']=qs['sort'](_0x4bb496['query']['sort']);_0x3c08dc[_0x31c6('0x48')]=qs[_0x31c6('0x3e')](_['pick'](_0x4bb496[_0x31c6('0x3c')],_0x584b0f[_0x31c6('0x3e')]));if(_0x4bb496['query']['filter']){_0x3c08dc[_0x31c6('0x48')]=_[_0x31c6('0x49')](_0x3c08dc[_0x31c6('0x48')],{'$or':_[_0x31c6('0x37')](_0x3c08dc[_0x31c6('0x41')],function(_0x93ae11){var _0x197a6f={};_0x197a6f[_0x93ae11]={'$like':'%'+_0x4bb496[_0x31c6('0x3c')]['filter']+'%'};return _0x197a6f;})});}_0x3c08dc=_[_0x31c6('0x49')]({},_0x3c08dc,_0x4bb496['options']);return _0x15b1f9[_0x31c6('0x5c')](_0x3c08dc);}})[_0x31c6('0x30')](function(_0xd8c6d8){if(_0xd8c6d8){_0x55d404=_0xd8c6d8[_0x31c6('0x42')];if(!_0x4bb496[_0x31c6('0x3c')]['hasOwnProperty']('nolimit')){_0x3c08dc[_0x31c6('0x2a')]=qs['limit'](_0x4bb496[_0x31c6('0x3c')][_0x31c6('0x2a')]);_0x3c08dc[_0x31c6('0x29')]=qs['offset'](_0x4bb496[_0x31c6('0x3c')][_0x31c6('0x29')]);}return _0x15b1f9[_0x31c6('0x5c')](_0x3c08dc);}})[_0x31c6('0x30')](function(_0xf350de){if(_0xf350de){return _0xf350de?{'count':_0x55d404,'rows':_0xf350de}:null;}})[_0x31c6('0x30')](respondWithResult(_0x540c45,null))[_0x31c6('0x26')](handleError(_0x540c45,null));};exports[_0x31c6('0x5d')]=function(_0x20e8a3,_0x2dbb68,_0x2eabfd){var _0x43018c={};var _0x4de4aa={};var _0x376d91;var _0x273505;return db['FreshdeskConfiguration'][_0x31c6('0x59')]({'where':{'id':_0x20e8a3['params']['id']}})[_0x31c6('0x30')](handleEntityNotFound(_0x2dbb68,null))[_0x31c6('0x30')](function(_0x11a64b){if(_0x11a64b){_0x376d91=_0x11a64b;_0x4de4aa[_0x31c6('0x3b')]=_[_0x31c6('0x3d')](db[_0x31c6('0x5a')][_0x31c6('0x52')]);_0x4de4aa[_0x31c6('0x3c')]=_[_0x31c6('0x3d')](_0x20e8a3[_0x31c6('0x3c')]);_0x4de4aa[_0x31c6('0x3e')]=_[_0x31c6('0x3f')](_0x4de4aa[_0x31c6('0x3b')],_0x4de4aa[_0x31c6('0x3c')]);_0x43018c['attributes']=_[_0x31c6('0x3f')](_0x4de4aa[_0x31c6('0x3b')],qs[_0x31c6('0x40')](_0x20e8a3[_0x31c6('0x3c')]['fields']));_0x43018c[_0x31c6('0x41')]=_0x43018c[_0x31c6('0x41')][_0x31c6('0x42')]?_0x43018c['attributes']:_0x4de4aa[_0x31c6('0x3b')];_0x43018c[_0x31c6('0x44')]=qs[_0x31c6('0x45')](_0x20e8a3['query'][_0x31c6('0x45')]);_0x43018c[_0x31c6('0x48')]=qs[_0x31c6('0x3e')](_[_0x31c6('0x46')](_0x20e8a3[_0x31c6('0x3c')],_0x4de4aa[_0x31c6('0x3e')]));if(_0x20e8a3[_0x31c6('0x3c')][_0x31c6('0x47')]){_0x43018c[_0x31c6('0x48')]=_[_0x31c6('0x49')](_0x43018c['where'],{'$or':_[_0x31c6('0x37')](_0x43018c['attributes'],function(_0x3a6f2a){var _0x57e52d={};_0x57e52d[_0x3a6f2a]={'$like':'%'+_0x20e8a3[_0x31c6('0x3c')][_0x31c6('0x47')]+'%'};return _0x57e52d;})});}_0x43018c=_['merge']({},_0x43018c,_0x20e8a3[_0x31c6('0x4b')]);return _0x376d91[_0x31c6('0x5d')](_0x43018c);}})[_0x31c6('0x30')](function(_0x5a0a44){if(_0x5a0a44){_0x273505=_0x5a0a44[_0x31c6('0x42')];if(!_0x20e8a3[_0x31c6('0x3c')][_0x31c6('0x5b')](_0x31c6('0x43'))){_0x43018c['limit']=qs[_0x31c6('0x2a')](_0x20e8a3['query'][_0x31c6('0x2a')]);_0x43018c[_0x31c6('0x29')]=qs[_0x31c6('0x29')](_0x20e8a3[_0x31c6('0x3c')][_0x31c6('0x29')]);}return _0x376d91[_0x31c6('0x5d')](_0x43018c);}})[_0x31c6('0x30')](function(_0x3132c4){if(_0x3132c4){return _0x3132c4?{'count':_0x273505,'rows':_0x3132c4}:null;}})[_0x31c6('0x30')](respondWithResult(_0x2dbb68,null))[_0x31c6('0x26')](handleError(_0x2dbb68,null));};exports[_0x31c6('0x5e')]=function(_0x339108,_0x2a59d3,_0x150cee){var _0x40e8b1={};var _0x54f673={};var _0x2a9035;var _0x50d3e8;return db['FreshdeskConfiguration'][_0x31c6('0x59')]({'where':{'id':_0x339108[_0x31c6('0x51')]['id']}})['then'](handleEntityNotFound(_0x2a59d3,null))[_0x31c6('0x30')](function(_0x22c68c){if(_0x22c68c){_0x2a9035=_0x22c68c;_0x54f673[_0x31c6('0x3b')]=_[_0x31c6('0x3d')](db[_0x31c6('0x5f')][_0x31c6('0x52')]);_0x54f673[_0x31c6('0x3c')]=_[_0x31c6('0x3d')](_0x339108[_0x31c6('0x3c')]);_0x54f673[_0x31c6('0x3e')]=_[_0x31c6('0x3f')](_0x54f673[_0x31c6('0x3b')],_0x54f673['query']);_0x40e8b1[_0x31c6('0x41')]=_[_0x31c6('0x3f')](_0x54f673[_0x31c6('0x3b')],qs['fields'](_0x339108[_0x31c6('0x3c')][_0x31c6('0x40')]));_0x40e8b1[_0x31c6('0x41')]=_0x40e8b1['attributes'][_0x31c6('0x42')]?_0x40e8b1[_0x31c6('0x41')]:_0x54f673[_0x31c6('0x3b')];_0x40e8b1['order']=qs[_0x31c6('0x45')](_0x339108[_0x31c6('0x3c')][_0x31c6('0x45')]);_0x40e8b1['where']=qs[_0x31c6('0x3e')](_[_0x31c6('0x46')](_0x339108[_0x31c6('0x3c')],_0x54f673['filters']));if(_0x339108['query'][_0x31c6('0x47')]){_0x40e8b1[_0x31c6('0x48')]=_['merge'](_0x40e8b1['where'],{'$or':_[_0x31c6('0x37')](_0x40e8b1[_0x31c6('0x41')],function(_0x4da80d){var _0x41771={};_0x41771[_0x4da80d]={'$like':'%'+_0x339108['query'][_0x31c6('0x47')]+'%'};return _0x41771;})});}_0x40e8b1=_['merge']({},_0x40e8b1,_0x339108[_0x31c6('0x4b')]);return _0x2a9035[_0x31c6('0x5e')](_0x40e8b1);}})[_0x31c6('0x30')](function(_0x184408){if(_0x184408){_0x50d3e8=_0x184408[_0x31c6('0x42')];if(!_0x339108[_0x31c6('0x3c')][_0x31c6('0x5b')]('nolimit')){_0x40e8b1[_0x31c6('0x2a')]=qs[_0x31c6('0x2a')](_0x339108[_0x31c6('0x3c')][_0x31c6('0x2a')]);_0x40e8b1[_0x31c6('0x29')]=qs[_0x31c6('0x29')](_0x339108[_0x31c6('0x3c')][_0x31c6('0x29')]);}return _0x2a9035[_0x31c6('0x5e')](_0x40e8b1);}})[_0x31c6('0x30')](function(_0x215153){if(_0x215153){return _0x215153?{'count':_0x50d3e8,'rows':_0x215153}:null;}})[_0x31c6('0x30')](respondWithResult(_0x2a59d3,null))['catch'](handleError(_0x2a59d3,null));};exports[_0x31c6('0x60')]=function(_0x2deb45,_0x3e96bb,_0x1d881b){if(_0x2deb45[_0x31c6('0x56')]['id']){delete _0x2deb45['body']['id'];}return db[_0x31c6('0x38')][_0x31c6('0x59')]({'where':{'id':_0x2deb45[_0x31c6('0x51')]['id']}})[_0x31c6('0x30')](handleEntityNotFound(_0x3e96bb,null))[_0x31c6('0x30')](function(_0x34a594){if(_0x34a594){return _0x34a594[_0x31c6('0x60')](_0x2deb45['body']['ids']||[]);}return null;})[_0x31c6('0x30')](respondWithResult(_0x3e96bb,null))[_0x31c6('0x26')](handleError(_0x3e96bb,null));}; \ No newline at end of file +var _0x0764=['fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','reject','update','stack','name','map','FreshdeskConfiguration','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','getFields','findOne','FreshdeskField','pick','getSubjects','hasOwnProperty','getDescriptions','Tag','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir'];(function(_0xcbbf98,_0x1961ca){var _0x56dce4=function(_0x5eb5e0){while(--_0x5eb5e0){_0xcbbf98['push'](_0xcbbf98['shift']());}};_0x56dce4(++_0x1961ca);}(_0x0764,0x174));var _0x4076=function(_0xeff6d4,_0x686596){_0xeff6d4=_0xeff6d4-0x0;var _0x3f5223=_0x0764[_0xeff6d4];return _0x3f5223;};'use strict';var pdf=require(_0x4076('0x0'));var emlformat=require(_0x4076('0x1'));var rimraf=require(_0x4076('0x2'));var zipdir=require(_0x4076('0x3'));var jsonpatch=require(_0x4076('0x4'));var rp=require('request-promise');var moment=require(_0x4076('0x5'));var BPromise=require(_0x4076('0x6'));var Mustache=require(_0x4076('0x7'));var util=require(_0x4076('0x8'));var path=require(_0x4076('0x9'));var sox=require('sox');var csv=require(_0x4076('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4076('0xb'));var _=require(_0x4076('0xc'));var squel=require(_0x4076('0xd'));var crypto=require(_0x4076('0xe'));var jsforce=require(_0x4076('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4076('0xa'));var querystring=require(_0x4076('0x10'));var Papa=require('papaparse');var Redis=require(_0x4076('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4076('0x12'));var as=require(_0x4076('0x13'));var hardwareService=require(_0x4076('0x14'));var logger=require(_0x4076('0x15'))(_0x4076('0x16'));var utils=require(_0x4076('0x17'));var config=require(_0x4076('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x4076('0x19'));var client=jayson[_0x4076('0x1a')][_0x4076('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4d586f,_0x344477,_0x2c0e63,_0xfdd247){return new BPromise(function(_0x595721,_0x19de92){var _0x4b9577=_0xfdd247||client;return _0x4b9577[_0x4076('0x1c')](_0x4d586f,_0x2c0e63)[_0x4076('0x1d')](function(_0x10e848){logger[_0x4076('0x1e')](_0x4076('0x1f'),_0x344477,_0x4076('0x20'));logger[_0x4076('0x21')](_0x4076('0x22'),_0x344477,_0x4076('0x20'),JSON[_0x4076('0x23')](_0x10e848));if(_0x10e848[_0x4076('0x24')]){if(_0x10e848[_0x4076('0x24')][_0x4076('0x25')]===0x1f4){logger[_0x4076('0x24')](_0x4076('0x1f'),_0x344477,_0x10e848['error'][_0x4076('0x26')]);return _0x19de92(_0x10e848[_0x4076('0x24')][_0x4076('0x26')]);}logger['error'](_0x4076('0x1f'),_0x344477,_0x10e848[_0x4076('0x24')][_0x4076('0x26')]);return _0x595721(_0x10e848[_0x4076('0x24')][_0x4076('0x26')]);}else{logger[_0x4076('0x1e')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x344477,_0x4076('0x20'));_0x595721(_0x10e848[_0x4076('0x27')][_0x4076('0x26')]);}})['catch'](function(_0x37723a){logger[_0x4076('0x24')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x344477,_0x37723a);_0x19de92(_0x37723a);});});}function respondWithStatusCode(_0x7ee618,_0x11ed88){_0x11ed88=_0x11ed88||0xcc;return function(_0x54b684){if(_0x54b684){return _0x7ee618[_0x4076('0x28')](_0x11ed88);}return _0x7ee618[_0x4076('0x29')](_0x11ed88)[_0x4076('0x2a')]();};}function respondWithResult(_0x2e6ad9,_0x394670){_0x394670=_0x394670||0xc8;return function(_0x4b4911){if(_0x4b4911){return _0x2e6ad9['status'](_0x394670)[_0x4076('0x2b')](_0x4b4911);}};}function respondWithFilteredResult(_0x1bc29b,_0x1c9d45){return function(_0x2556c7){if(_0x2556c7){var _0x675d2=_0x2556c7[_0x4076('0x2c')],_0x58e5a5=_0x1c9d45[_0x4076('0x2d')],_0x937929=_0x1c9d45[_0x4076('0x2d')]+_0x1c9d45[_0x4076('0x2e')],_0x1c76bd;if(_0x937929>=_0x675d2){_0x937929=_0x675d2;_0x1c76bd=0xc8;}else{_0x1c76bd=0xce;}_0x1bc29b['status'](_0x1c76bd);return _0x1bc29b['set']('Content-Range',_0x58e5a5+'-'+_0x937929+'/'+_0x675d2)[_0x4076('0x2b')](_0x2556c7);}return null;};}function patchUpdates(_0x268134){return function(_0x4ba34d){try{jsonpatch['apply'](_0x4ba34d,_0x268134,!![]);}catch(_0x152156){return BPromise[_0x4076('0x2f')](_0x152156);}return _0x4ba34d['save']();};}function saveUpdates(_0x4ec9a2,_0x1afbc5){return function(_0xa5bb88){if(_0xa5bb88){return _0xa5bb88[_0x4076('0x30')](_0x4ec9a2)[_0x4076('0x1d')](function(_0x46c5ac){return _0x46c5ac;});}return null;};}function removeEntity(_0x2010eb,_0x5701f8){return function(_0x40ee16){if(_0x40ee16){return _0x40ee16['destroy']()[_0x4076('0x1d')](function(){_0x2010eb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x182c53,_0x49d99e){return function(_0x72bfac){if(!_0x72bfac){_0x182c53[_0x4076('0x28')](0x194);}return _0x72bfac;};}function handleError(_0x533a2d,_0x19328d){_0x19328d=_0x19328d||0x1f4;return function(_0x459a95){logger[_0x4076('0x24')](_0x459a95[_0x4076('0x31')]);if(_0x459a95[_0x4076('0x32')]){delete _0x459a95[_0x4076('0x32')];}_0x533a2d['status'](_0x19328d)['send'](_0x459a95);};}exports['index']=function(_0x12abd1,_0x2dfc17){var _0x202e3a={},_0x5ef0ac={},_0x55a0fb={'count':0x0,'rows':[]};var _0x45b6b9=_[_0x4076('0x33')](db[_0x4076('0x34')][_0x4076('0x35')],function(_0x3a4284){return{'name':_0x3a4284['fieldName'],'type':_0x3a4284[_0x4076('0x36')][_0x4076('0x37')]};});_0x5ef0ac[_0x4076('0x38')]=_['map'](_0x45b6b9,_0x4076('0x32'));_0x5ef0ac['query']=_[_0x4076('0x39')](_0x12abd1[_0x4076('0x3a')]);_0x5ef0ac['filters']=_['intersection'](_0x5ef0ac[_0x4076('0x38')],_0x5ef0ac[_0x4076('0x3a')]);_0x202e3a[_0x4076('0x3b')]=_[_0x4076('0x3c')](_0x5ef0ac[_0x4076('0x38')],qs[_0x4076('0x3d')](_0x12abd1[_0x4076('0x3a')][_0x4076('0x3d')]));_0x202e3a[_0x4076('0x3b')]=_0x202e3a[_0x4076('0x3b')][_0x4076('0x3e')]?_0x202e3a[_0x4076('0x3b')]:_0x5ef0ac[_0x4076('0x38')];if(!_0x12abd1[_0x4076('0x3a')]['hasOwnProperty'](_0x4076('0x3f'))){_0x202e3a['limit']=qs['limit'](_0x12abd1[_0x4076('0x3a')][_0x4076('0x2e')]);_0x202e3a[_0x4076('0x2d')]=qs[_0x4076('0x2d')](_0x12abd1[_0x4076('0x3a')][_0x4076('0x2d')]);}_0x202e3a[_0x4076('0x40')]=qs[_0x4076('0x41')](_0x12abd1['query'][_0x4076('0x41')]);_0x202e3a['where']=qs['filters'](_['pick'](_0x12abd1[_0x4076('0x3a')],_0x5ef0ac[_0x4076('0x42')]),_0x45b6b9);if(_0x12abd1[_0x4076('0x3a')][_0x4076('0x43')]){_0x202e3a[_0x4076('0x44')]=_['merge'](_0x202e3a[_0x4076('0x44')],{'$or':_[_0x4076('0x33')](_0x45b6b9,function(_0x53b739){if(_0x53b739[_0x4076('0x36')]!==_0x4076('0x45')){var _0x2dd4a1={};_0x2dd4a1[_0x53b739['name']]={'$like':'%'+_0x12abd1[_0x4076('0x3a')][_0x4076('0x43')]+'%'};return _0x2dd4a1;}})});}_0x202e3a=_[_0x4076('0x46')]({},_0x202e3a,_0x12abd1[_0x4076('0x47')]);var _0x58237d={'where':_0x202e3a[_0x4076('0x44')]};return db['FreshdeskConfiguration'][_0x4076('0x2c')](_0x58237d)[_0x4076('0x1d')](function(_0x22acba){_0x55a0fb[_0x4076('0x2c')]=_0x22acba;if(_0x12abd1[_0x4076('0x3a')][_0x4076('0x48')]){_0x202e3a[_0x4076('0x49')]=[{'all':!![]}];}return db[_0x4076('0x34')][_0x4076('0x4a')](_0x202e3a);})[_0x4076('0x1d')](function(_0x17d468){_0x55a0fb[_0x4076('0x4b')]=_0x17d468;return _0x55a0fb;})[_0x4076('0x1d')](respondWithFilteredResult(_0x2dfc17,_0x202e3a))[_0x4076('0x4c')](handleError(_0x2dfc17,null));};exports[_0x4076('0x4d')]=function(_0x51eb12,_0xcc4342){var _0x752783={'raw':![],'where':{'id':_0x51eb12[_0x4076('0x4e')]['id']}},_0x192aea={};_0x192aea[_0x4076('0x38')]=_[_0x4076('0x39')](db[_0x4076('0x34')][_0x4076('0x35')]);_0x192aea['query']=_['keys'](_0x51eb12[_0x4076('0x3a')]);_0x192aea[_0x4076('0x42')]=_['intersection'](_0x192aea['model'],_0x192aea[_0x4076('0x3a')]);_0x752783[_0x4076('0x3b')]=_[_0x4076('0x3c')](_0x192aea[_0x4076('0x38')],qs[_0x4076('0x3d')](_0x51eb12['query'][_0x4076('0x3d')]));_0x752783[_0x4076('0x3b')]=_0x752783[_0x4076('0x3b')]['length']?_0x752783['attributes']:_0x192aea[_0x4076('0x38')];if(_0x51eb12[_0x4076('0x3a')][_0x4076('0x48')]){_0x752783[_0x4076('0x49')]=[{'all':!![]}];}_0x752783=_[_0x4076('0x46')]({},_0x752783,_0x51eb12['options']);return db[_0x4076('0x34')][_0x4076('0x4f')](_0x752783)['then'](handleEntityNotFound(_0xcc4342,null))[_0x4076('0x1d')](respondWithResult(_0xcc4342,null))['catch'](handleError(_0xcc4342,null));};exports[_0x4076('0x50')]=function(_0x55e825,_0x4fa9a7){return db[_0x4076('0x34')][_0x4076('0x50')](_0x55e825[_0x4076('0x51')],{})['then'](respondWithResult(_0x4fa9a7,0xc9))['catch'](handleError(_0x4fa9a7,null));};exports[_0x4076('0x30')]=function(_0xe3752,_0x9b3408){if(_0xe3752[_0x4076('0x51')]['id']){delete _0xe3752[_0x4076('0x51')]['id'];}return db[_0x4076('0x34')]['find']({'where':{'id':_0xe3752[_0x4076('0x4e')]['id']}})['then'](handleEntityNotFound(_0x9b3408,null))[_0x4076('0x1d')](saveUpdates(_0xe3752[_0x4076('0x51')],null))['then'](respondWithResult(_0x9b3408,null))[_0x4076('0x4c')](handleError(_0x9b3408,null));};exports[_0x4076('0x52')]=function(_0x3c99b7,_0x3b6d12){return db['FreshdeskConfiguration'][_0x4076('0x4f')]({'where':{'id':_0x3c99b7[_0x4076('0x4e')]['id']}})[_0x4076('0x1d')](handleEntityNotFound(_0x3b6d12,null))[_0x4076('0x1d')](removeEntity(_0x3b6d12,null))[_0x4076('0x4c')](handleError(_0x3b6d12,null));};exports[_0x4076('0x53')]=function(_0x3f3f7a,_0x70eb1d,_0x40d8ff){var _0x39ca6a={};var _0x108ecd={};var _0x3ffe9f;var _0x2f9699;return db[_0x4076('0x34')][_0x4076('0x54')]({'where':{'id':_0x3f3f7a[_0x4076('0x4e')]['id']}})['then'](handleEntityNotFound(_0x70eb1d,null))[_0x4076('0x1d')](function(_0x101c86){if(_0x101c86){_0x3ffe9f=_0x101c86;_0x108ecd['model']=_[_0x4076('0x39')](db[_0x4076('0x55')][_0x4076('0x35')]);_0x108ecd[_0x4076('0x3a')]=_[_0x4076('0x39')](_0x3f3f7a[_0x4076('0x3a')]);_0x108ecd[_0x4076('0x42')]=_[_0x4076('0x3c')](_0x108ecd[_0x4076('0x38')],_0x108ecd['query']);_0x39ca6a[_0x4076('0x3b')]=_[_0x4076('0x3c')](_0x108ecd['model'],qs[_0x4076('0x3d')](_0x3f3f7a[_0x4076('0x3a')][_0x4076('0x3d')]));_0x39ca6a['attributes']=_0x39ca6a[_0x4076('0x3b')][_0x4076('0x3e')]?_0x39ca6a[_0x4076('0x3b')]:_0x108ecd[_0x4076('0x38')];_0x39ca6a[_0x4076('0x40')]=qs['sort'](_0x3f3f7a[_0x4076('0x3a')][_0x4076('0x41')]);_0x39ca6a[_0x4076('0x44')]=qs[_0x4076('0x42')](_[_0x4076('0x56')](_0x3f3f7a['query'],_0x108ecd[_0x4076('0x42')]));if(_0x3f3f7a[_0x4076('0x3a')][_0x4076('0x43')]){_0x39ca6a[_0x4076('0x44')]=_[_0x4076('0x46')](_0x39ca6a['where'],{'$or':_[_0x4076('0x33')](_0x39ca6a[_0x4076('0x3b')],function(_0x5b30a1){var _0x214b9d={};_0x214b9d[_0x5b30a1]={'$like':'%'+_0x3f3f7a['query'][_0x4076('0x43')]+'%'};return _0x214b9d;})});}_0x39ca6a=_[_0x4076('0x46')]({},_0x39ca6a,_0x3f3f7a[_0x4076('0x47')]);return _0x3ffe9f['getFields'](_0x39ca6a);}})[_0x4076('0x1d')](function(_0x46dabf){if(_0x46dabf){_0x2f9699=_0x46dabf['length'];if(!_0x3f3f7a[_0x4076('0x3a')]['hasOwnProperty'](_0x4076('0x3f'))){_0x39ca6a[_0x4076('0x2e')]=qs[_0x4076('0x2e')](_0x3f3f7a[_0x4076('0x3a')][_0x4076('0x2e')]);_0x39ca6a['offset']=qs[_0x4076('0x2d')](_0x3f3f7a[_0x4076('0x3a')][_0x4076('0x2d')]);}return _0x3ffe9f[_0x4076('0x53')](_0x39ca6a);}})[_0x4076('0x1d')](function(_0x5a98a6){if(_0x5a98a6){return _0x5a98a6?{'count':_0x2f9699,'rows':_0x5a98a6}:null;}})[_0x4076('0x1d')](respondWithResult(_0x70eb1d,null))[_0x4076('0x4c')](handleError(_0x70eb1d,null));};exports[_0x4076('0x57')]=function(_0x350f92,_0x3ff2ba,_0x61336){var _0x2d9eda={};var _0x370b1d={};var _0x3021b2;var _0x4b2340;return db[_0x4076('0x34')]['findOne']({'where':{'id':_0x350f92[_0x4076('0x4e')]['id']}})[_0x4076('0x1d')](handleEntityNotFound(_0x3ff2ba,null))[_0x4076('0x1d')](function(_0x3ef53c){if(_0x3ef53c){_0x3021b2=_0x3ef53c;_0x370b1d['model']=_[_0x4076('0x39')](db[_0x4076('0x55')][_0x4076('0x35')]);_0x370b1d['query']=_[_0x4076('0x39')](_0x350f92[_0x4076('0x3a')]);_0x370b1d['filters']=_['intersection'](_0x370b1d['model'],_0x370b1d[_0x4076('0x3a')]);_0x2d9eda[_0x4076('0x3b')]=_[_0x4076('0x3c')](_0x370b1d[_0x4076('0x38')],qs[_0x4076('0x3d')](_0x350f92[_0x4076('0x3a')][_0x4076('0x3d')]));_0x2d9eda[_0x4076('0x3b')]=_0x2d9eda[_0x4076('0x3b')][_0x4076('0x3e')]?_0x2d9eda[_0x4076('0x3b')]:_0x370b1d['model'];_0x2d9eda['order']=qs[_0x4076('0x41')](_0x350f92[_0x4076('0x3a')][_0x4076('0x41')]);_0x2d9eda[_0x4076('0x44')]=qs[_0x4076('0x42')](_['pick'](_0x350f92[_0x4076('0x3a')],_0x370b1d[_0x4076('0x42')]));if(_0x350f92[_0x4076('0x3a')][_0x4076('0x43')]){_0x2d9eda[_0x4076('0x44')]=_[_0x4076('0x46')](_0x2d9eda[_0x4076('0x44')],{'$or':_['map'](_0x2d9eda[_0x4076('0x3b')],function(_0xfe0a02){var _0x12739b={};_0x12739b[_0xfe0a02]={'$like':'%'+_0x350f92[_0x4076('0x3a')][_0x4076('0x43')]+'%'};return _0x12739b;})});}_0x2d9eda=_['merge']({},_0x2d9eda,_0x350f92[_0x4076('0x47')]);return _0x3021b2['getSubjects'](_0x2d9eda);}})['then'](function(_0x96fe3){if(_0x96fe3){_0x4b2340=_0x96fe3['length'];if(!_0x350f92[_0x4076('0x3a')][_0x4076('0x58')](_0x4076('0x3f'))){_0x2d9eda[_0x4076('0x2e')]=qs[_0x4076('0x2e')](_0x350f92[_0x4076('0x3a')][_0x4076('0x2e')]);_0x2d9eda[_0x4076('0x2d')]=qs[_0x4076('0x2d')](_0x350f92[_0x4076('0x3a')][_0x4076('0x2d')]);}return _0x3021b2[_0x4076('0x57')](_0x2d9eda);}})[_0x4076('0x1d')](function(_0x3847b0){if(_0x3847b0){return _0x3847b0?{'count':_0x4b2340,'rows':_0x3847b0}:null;}})[_0x4076('0x1d')](respondWithResult(_0x3ff2ba,null))[_0x4076('0x4c')](handleError(_0x3ff2ba,null));};exports[_0x4076('0x59')]=function(_0xff5e23,_0xf358d7,_0x2184e0){var _0x2c7604={};var _0xb223e4={};var _0x2b6fad;var _0x5adb6d;return db[_0x4076('0x34')][_0x4076('0x54')]({'where':{'id':_0xff5e23[_0x4076('0x4e')]['id']}})[_0x4076('0x1d')](handleEntityNotFound(_0xf358d7,null))['then'](function(_0x16c0f0){if(_0x16c0f0){_0x2b6fad=_0x16c0f0;_0xb223e4[_0x4076('0x38')]=_['keys'](db[_0x4076('0x55')]['rawAttributes']);_0xb223e4[_0x4076('0x3a')]=_['keys'](_0xff5e23[_0x4076('0x3a')]);_0xb223e4[_0x4076('0x42')]=_['intersection'](_0xb223e4['model'],_0xb223e4[_0x4076('0x3a')]);_0x2c7604[_0x4076('0x3b')]=_[_0x4076('0x3c')](_0xb223e4[_0x4076('0x38')],qs[_0x4076('0x3d')](_0xff5e23[_0x4076('0x3a')]['fields']));_0x2c7604['attributes']=_0x2c7604[_0x4076('0x3b')][_0x4076('0x3e')]?_0x2c7604[_0x4076('0x3b')]:_0xb223e4[_0x4076('0x38')];_0x2c7604[_0x4076('0x40')]=qs['sort'](_0xff5e23[_0x4076('0x3a')][_0x4076('0x41')]);_0x2c7604[_0x4076('0x44')]=qs[_0x4076('0x42')](_[_0x4076('0x56')](_0xff5e23[_0x4076('0x3a')],_0xb223e4[_0x4076('0x42')]));if(_0xff5e23[_0x4076('0x3a')]['filter']){_0x2c7604[_0x4076('0x44')]=_[_0x4076('0x46')](_0x2c7604[_0x4076('0x44')],{'$or':_['map'](_0x2c7604[_0x4076('0x3b')],function(_0x45618a){var _0x536f23={};_0x536f23[_0x45618a]={'$like':'%'+_0xff5e23['query']['filter']+'%'};return _0x536f23;})});}_0x2c7604=_['merge']({},_0x2c7604,_0xff5e23[_0x4076('0x47')]);return _0x2b6fad[_0x4076('0x59')](_0x2c7604);}})[_0x4076('0x1d')](function(_0x469190){if(_0x469190){_0x5adb6d=_0x469190[_0x4076('0x3e')];if(!_0xff5e23[_0x4076('0x3a')][_0x4076('0x58')]('nolimit')){_0x2c7604[_0x4076('0x2e')]=qs[_0x4076('0x2e')](_0xff5e23['query'][_0x4076('0x2e')]);_0x2c7604[_0x4076('0x2d')]=qs[_0x4076('0x2d')](_0xff5e23[_0x4076('0x3a')][_0x4076('0x2d')]);}return _0x2b6fad['getDescriptions'](_0x2c7604);}})[_0x4076('0x1d')](function(_0x44db86){if(_0x44db86){return _0x44db86?{'count':_0x5adb6d,'rows':_0x44db86}:null;}})[_0x4076('0x1d')](respondWithResult(_0xf358d7,null))[_0x4076('0x4c')](handleError(_0xf358d7,null));};exports['getTags']=function(_0x29c0bb,_0x694059,_0x3974a9){var _0x58cfb5={};var _0x1b0635={};var _0x13a5c3;var _0xb1e256;return db[_0x4076('0x34')]['findOne']({'where':{'id':_0x29c0bb[_0x4076('0x4e')]['id']}})[_0x4076('0x1d')](handleEntityNotFound(_0x694059,null))[_0x4076('0x1d')](function(_0x537160){if(_0x537160){_0x13a5c3=_0x537160;_0x1b0635[_0x4076('0x38')]=_['keys'](db[_0x4076('0x5a')][_0x4076('0x35')]);_0x1b0635[_0x4076('0x3a')]=_[_0x4076('0x39')](_0x29c0bb[_0x4076('0x3a')]);_0x1b0635[_0x4076('0x42')]=_[_0x4076('0x3c')](_0x1b0635[_0x4076('0x38')],_0x1b0635['query']);_0x58cfb5[_0x4076('0x3b')]=_[_0x4076('0x3c')](_0x1b0635['model'],qs['fields'](_0x29c0bb[_0x4076('0x3a')][_0x4076('0x3d')]));_0x58cfb5[_0x4076('0x3b')]=_0x58cfb5[_0x4076('0x3b')][_0x4076('0x3e')]?_0x58cfb5[_0x4076('0x3b')]:_0x1b0635[_0x4076('0x38')];_0x58cfb5[_0x4076('0x40')]=qs[_0x4076('0x41')](_0x29c0bb['query']['sort']);_0x58cfb5['where']=qs[_0x4076('0x42')](_[_0x4076('0x56')](_0x29c0bb['query'],_0x1b0635[_0x4076('0x42')]));if(_0x29c0bb['query'][_0x4076('0x43')]){_0x58cfb5[_0x4076('0x44')]=_['merge'](_0x58cfb5[_0x4076('0x44')],{'$or':_[_0x4076('0x33')](_0x58cfb5['attributes'],function(_0x22aa1b){var _0x156293={};_0x156293[_0x22aa1b]={'$like':'%'+_0x29c0bb[_0x4076('0x3a')][_0x4076('0x43')]+'%'};return _0x156293;})});}_0x58cfb5=_['merge']({},_0x58cfb5,_0x29c0bb[_0x4076('0x47')]);return _0x13a5c3[_0x4076('0x5b')](_0x58cfb5);}})[_0x4076('0x1d')](function(_0x4f2cc6){if(_0x4f2cc6){_0xb1e256=_0x4f2cc6['length'];if(!_0x29c0bb[_0x4076('0x3a')][_0x4076('0x58')](_0x4076('0x3f'))){_0x58cfb5[_0x4076('0x2e')]=qs[_0x4076('0x2e')](_0x29c0bb[_0x4076('0x3a')][_0x4076('0x2e')]);_0x58cfb5[_0x4076('0x2d')]=qs[_0x4076('0x2d')](_0x29c0bb[_0x4076('0x3a')][_0x4076('0x2d')]);}return _0x13a5c3['getTags'](_0x58cfb5);}})[_0x4076('0x1d')](function(_0x4a5da1){if(_0x4a5da1){return _0x4a5da1?{'count':_0xb1e256,'rows':_0x4a5da1}:null;}})['then'](respondWithResult(_0x694059,null))[_0x4076('0x4c')](handleError(_0x694059,null));};exports[_0x4076('0x5c')]=function(_0x2be357,_0x1e1d89,_0x29b9b6){if(_0x2be357[_0x4076('0x51')]['id']){delete _0x2be357['body']['id'];}return db[_0x4076('0x34')][_0x4076('0x54')]({'where':{'id':_0x2be357[_0x4076('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1e1d89,null))[_0x4076('0x1d')](function(_0x438211){if(_0x438211){return _0x438211['setTags'](_0x2be357[_0x4076('0x51')][_0x4076('0x5d')]||[]);}return null;})[_0x4076('0x1d')](respondWithResult(_0x1e1d89,null))[_0x4076('0x4c')](handleError(_0x1e1d89,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 1516650..edd88a1 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 _0x4c71=['bluebird','request-promise','rimraf','../../config/environment','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','moment'];(function(_0x2c1536,_0x21df61){var _0x5b7199=function(_0x4181c7){while(--_0x4181c7){_0x2c1536['push'](_0x2c1536['shift']());}};_0x5b7199(++_0x21df61);}(_0x4c71,0x11b));var _0x14c7=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x4c71[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x14c7('0x0'));var util=require('util');var logger=require(_0x14c7('0x1'))('api');var moment=require(_0x14c7('0x2'));var BPromise=require(_0x14c7('0x3'));var rp=require(_0x14c7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x14c7('0x5'));var config=require(_0x14c7('0x6'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x14c7('0x7')]=function(_0x289d22,_0x58e8f0){return _0x289d22[_0x14c7('0x8')](_0x14c7('0x9'),attributes,{'tableName':_0x14c7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6aaf=['./intFreshdeskConfiguration.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6aaf,0xe9));var _0xf6aa=function(_0x2dc96f,_0x459058){_0x2dc96f=_0x2dc96f-0x0;var _0xd012da=_0x6aaf[_0x2dc96f];return _0xd012da;};'use strict';var _=require(_0xf6aa('0x0'));var util=require(_0xf6aa('0x1'));var logger=require(_0xf6aa('0x2'))(_0xf6aa('0x3'));var moment=require(_0xf6aa('0x4'));var BPromise=require(_0xf6aa('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf6aa('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf6aa('0x7'));module[_0xf6aa('0x8')]=function(_0x469356,_0x5742dc){return _0x469356[_0xf6aa('0x9')]('FreshdeskConfiguration',attributes,{'tableName':'int_freshdesk_configurations','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 33eaa1e..e90ff18 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 _0x44a5=['jayson/promise','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x603c53,_0xf08acd){var _0x23734a=function(_0x32bc0f){while(--_0x32bc0f){_0x603c53['push'](_0x603c53['shift']());}};_0x23734a(++_0xf08acd);}(_0x44a5,0xbd));var _0x544a=function(_0x572df6,_0x316656){_0x572df6=_0x572df6-0x0;var _0x465da1=_0x44a5[_0x572df6];return _0x465da1;};'use strict';var _=require('lodash');var util=require(_0x544a('0x0'));var moment=require(_0x544a('0x1'));var BPromise=require(_0x544a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x544a('0x3'));var db=require(_0x544a('0x4'))['db'];var utils=require(_0x544a('0x5'));var logger=require(_0x544a('0x6'))(_0x544a('0x7'));var config=require(_0x544a('0x8'));var jayson=require(_0x544a('0x9'));var client=jayson['client'][_0x544a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3beffe,_0x4fe168,_0x410ddc){return new BPromise(function(_0xe9d61,_0x5f0396){return client[_0x544a('0xb')](_0x3beffe,_0x410ddc)[_0x544a('0xc')](function(_0x574d16){logger[_0x544a('0xd')](_0x544a('0xe'),_0x4fe168,_0x544a('0xf'));logger['debug'](_0x544a('0x10'),_0x4fe168,_0x544a('0xf'),JSON['stringify'](_0x574d16));if(_0x574d16[_0x544a('0x11')]){if(_0x574d16[_0x544a('0x11')][_0x544a('0x12')]===0x1f4){logger[_0x544a('0x11')](_0x544a('0xe'),_0x4fe168,_0x574d16[_0x544a('0x11')][_0x544a('0x13')]);return _0x5f0396(_0x574d16[_0x544a('0x11')][_0x544a('0x13')]);}logger['error'](_0x544a('0xe'),_0x4fe168,_0x574d16['error']['message']);return _0xe9d61(_0x574d16[_0x544a('0x11')][_0x544a('0x13')]);}else{logger[_0x544a('0xd')](_0x544a('0xe'),_0x4fe168,'request\x20sent');_0xe9d61(_0x574d16[_0x544a('0x14')][_0x544a('0x13')]);}})[_0x544a('0x15')](function(_0x31e121){logger[_0x544a('0x11')](_0x544a('0xe'),_0x4fe168,_0x31e121);_0x5f0396(_0x31e121);});});} \ No newline at end of file +var _0xce6f=['stringify','error','code','message','result','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xce6f,0x116));var _0xfce6=function(_0x224367,_0x21a31f){_0x224367=_0x224367-0x0;var _0x3bb6f8=_0xce6f[_0x224367];return _0x3bb6f8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xfce6('0x0'));var rs=require(_0xfce6('0x1'));var fs=require('fs');var Redis=require(_0xfce6('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfce6('0x3'));var logger=require(_0xfce6('0x4'))('rpc');var config=require(_0xfce6('0x5'));var jayson=require(_0xfce6('0x6'));var client=jayson[_0xfce6('0x7')][_0xfce6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b35ff,_0x2ffdfb,_0x5044a1){return new BPromise(function(_0x18320e,_0x5164ac){return client[_0xfce6('0x9')](_0x2b35ff,_0x5044a1)[_0xfce6('0xa')](function(_0x4344b4){logger[_0xfce6('0xb')](_0xfce6('0xc'),_0x2ffdfb,_0xfce6('0xd'));logger[_0xfce6('0xe')](_0xfce6('0xf'),_0x2ffdfb,_0xfce6('0xd'),JSON[_0xfce6('0x10')](_0x4344b4));if(_0x4344b4[_0xfce6('0x11')]){if(_0x4344b4[_0xfce6('0x11')][_0xfce6('0x12')]===0x1f4){logger[_0xfce6('0x11')](_0xfce6('0xc'),_0x2ffdfb,_0x4344b4[_0xfce6('0x11')][_0xfce6('0x13')]);return _0x5164ac(_0x4344b4[_0xfce6('0x11')]['message']);}logger[_0xfce6('0x11')](_0xfce6('0xc'),_0x2ffdfb,_0x4344b4[_0xfce6('0x11')]['message']);return _0x18320e(_0x4344b4['error'][_0xfce6('0x13')]);}else{logger[_0xfce6('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2ffdfb,'request\x20sent');_0x18320e(_0x4344b4[_0xfce6('0x14')]['message']);}})['catch'](function(_0xc7ac31){logger[_0xfce6('0x11')](_0xfce6('0xc'),_0x2ffdfb,_0xc7ac31);_0x5164ac(_0xc7ac31);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 3f9e9ae..314ce3a 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 _0xf91c=['isAuthenticated','show','post','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../config/environment','./intFreshdeskField.controller','get','/:id'];(function(_0x264545,_0x214037){var _0x114d10=function(_0x9e3461){while(--_0x9e3461){_0x264545['push'](_0x264545['shift']());}};_0x114d10(++_0x214037);}(_0xf91c,0x118));var _0xcf91=function(_0x52193e,_0x5191eb){_0x52193e=_0x52193e-0x0;var _0x2ff254=_0xf91c[_0x52193e];return _0x2ff254;};'use strict';var multer=require(_0xcf91('0x0'));var util=require('util');var path=require(_0xcf91('0x1'));var timeout=require(_0xcf91('0x2'));var express=require('express');var router=express[_0xcf91('0x3')]();var fs_extra=require(_0xcf91('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcf91('0x5'));var controller=require(_0xcf91('0x6'));router[_0xcf91('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xcf91('0x8'),auth[_0xcf91('0x9')](),controller[_0xcf91('0xa')]);router[_0xcf91('0xb')]('/',auth[_0xcf91('0x9')](),controller['create']);router[_0xcf91('0xc')](_0xcf91('0x8'),auth[_0xcf91('0x9')](),controller[_0xcf91('0xd')]);router[_0xcf91('0xe')](_0xcf91('0x8'),auth[_0xcf91('0x9')](),controller[_0xcf91('0xf')]);module[_0xcf91('0x10')]=router; \ No newline at end of file +var _0x6049=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','post','create'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x6049,0x7d));var _0x9604=function(_0x3dac7a,_0x10a776){_0x3dac7a=_0x3dac7a-0x0;var _0x5a1681=_0x6049[_0x3dac7a];return _0x5a1681;};'use strict';var multer=require(_0x9604('0x0'));var util=require('util');var path=require(_0x9604('0x1'));var timeout=require(_0x9604('0x2'));var express=require(_0x9604('0x3'));var router=express['Router']();var fs_extra=require(_0x9604('0x4'));var auth=require(_0x9604('0x5'));var interaction=require(_0x9604('0x6'));var config=require(_0x9604('0x7'));var controller=require(_0x9604('0x8'));router[_0x9604('0x9')]('/',auth[_0x9604('0xa')](),controller[_0x9604('0xb')]);router[_0x9604('0x9')](_0x9604('0xc'),auth[_0x9604('0xa')](),controller['show']);router[_0x9604('0xd')]('/',auth['isAuthenticated'](),controller[_0x9604('0xe')]);router[_0x9604('0xf')](_0x9604('0xc'),auth[_0x9604('0xa')](),controller[_0x9604('0x10')]);router[_0x9604('0x11')](_0x9604('0xc'),auth[_0x9604('0xa')](),controller[_0x9604('0x12')]);module[_0x9604('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index cf4e6b6..759c566 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 _0xb4e6=['customVariable','keyValue','picklist','STRING','sequelize','ENUM','string','variable'];(function(_0x32d99a,_0x36cfaf){var _0x36262b=function(_0x36a263){while(--_0x36a263){_0x32d99a['push'](_0x32d99a['shift']());}};_0x36262b(++_0x36cfaf);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x323419,_0x2a6172){_0x323419=_0x323419-0x0;var _0x4c0be7=_0xb4e6[_0x323419];return _0x4c0be7;};'use strict';var Sequelize=require(_0x6b4e('0x0'));module['exports']={'type':{'type':Sequelize[_0x6b4e('0x1')](_0x6b4e('0x2'),_0x6b4e('0x3'),_0x6b4e('0x4'),_0x6b4e('0x5'),_0x6b4e('0x6')),'defaultValue':_0x6b4e('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6b4e('0x7')]},'keyType':{'type':Sequelize[_0x6b4e('0x1')](_0x6b4e('0x2'),'variable',_0x6b4e('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6b4e('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4944=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x4e68c2,_0x322a2d){var _0x4ff4ff=function(_0x1f623f){while(--_0x1f623f){_0x4e68c2['push'](_0x4e68c2['shift']());}};_0x4ff4ff(++_0x322a2d);}(_0x4944,0x6d));var _0x4494=function(_0x2a34b4,_0x4e20d0){_0x2a34b4=_0x2a34b4-0x0;var _0x261e83=_0x4944[_0x2a34b4];return _0x261e83;};'use strict';var Sequelize=require(_0x4494('0x0'));module['exports']={'type':{'type':Sequelize[_0x4494('0x1')](_0x4494('0x2'),_0x4494('0x3'),_0x4494('0x4'),_0x4494('0x5'),'picklist'),'defaultValue':_0x4494('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4494('0x6')]},'keyType':{'type':Sequelize[_0x4494('0x1')](_0x4494('0x2'),_0x4494('0x3'),_0x4494('0x4'))},'keyContent':{'type':Sequelize[_0x4494('0x6')]},'idField':{'type':Sequelize[_0x4494('0x6')]},'nameField':{'type':Sequelize[_0x4494('0x6')]},'customField':{'type':Sequelize[_0x4494('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 556b192..366c1c8 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 _0xdc97=['send','map','FreshdeskField','rawAttributes','fieldName','type','intersection','model','query','attributes','length','hasOwnProperty','nolimit','limit','order','where','filters','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','show','keys','fields','find','catch','create','update','body','params','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','count','offset','set','apply','reject','save','destroy','stack','name'];(function(_0x3f5428,_0x555fd9){var _0x56fea4=function(_0x6443b2){while(--_0x6443b2){_0x3f5428['push'](_0x3f5428['shift']());}};_0x56fea4(++_0x555fd9);}(_0xdc97,0x13b));var _0x7dc9=function(_0x32df87,_0x4115c8){_0x32df87=_0x32df87-0x0;var _0x4953c6=_0xdc97[_0x32df87];return _0x4953c6;};'use strict';var pdf=require(_0x7dc9('0x0'));var emlformat=require(_0x7dc9('0x1'));var rimraf=require(_0x7dc9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7dc9('0x3'));var rp=require('request-promise');var moment=require(_0x7dc9('0x4'));var BPromise=require(_0x7dc9('0x5'));var Mustache=require('mustache');var util=require(_0x7dc9('0x6'));var path=require(_0x7dc9('0x7'));var sox=require(_0x7dc9('0x8'));var csv=require(_0x7dc9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7dc9('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7dc9('0xb'));var jsforce=require(_0x7dc9('0xc'));var deskjs=require(_0x7dc9('0xd'));var toCsv=require(_0x7dc9('0x9'));var querystring=require(_0x7dc9('0xe'));var Papa=require('papaparse');var Redis=require(_0x7dc9('0xf'));var authService=require(_0x7dc9('0x10'));var qs=require(_0x7dc9('0x11'));var as=require(_0x7dc9('0x12'));var hardwareService=require(_0x7dc9('0x13'));var logger=require(_0x7dc9('0x14'))(_0x7dc9('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x94c75a,_0x14e5db){_0x14e5db=_0x14e5db||0xcc;return function(_0x5c6ca5){if(_0x5c6ca5){return _0x94c75a[_0x7dc9('0x16')](_0x14e5db);}return _0x94c75a[_0x7dc9('0x17')](_0x14e5db)[_0x7dc9('0x18')]();};}function respondWithResult(_0xf37bc7,_0x31d43d){_0x31d43d=_0x31d43d||0xc8;return function(_0x11af93){if(_0x11af93){return _0xf37bc7['status'](_0x31d43d)[_0x7dc9('0x19')](_0x11af93);}};}function respondWithFilteredResult(_0x278191,_0x1b0aa1){return function(_0x442819){if(_0x442819){var _0x11606f=_0x442819[_0x7dc9('0x1a')],_0xbe0437=_0x1b0aa1['offset'],_0x45698c=_0x1b0aa1[_0x7dc9('0x1b')]+_0x1b0aa1['limit'],_0x389d36;if(_0x45698c>=_0x11606f){_0x45698c=_0x11606f;_0x389d36=0xc8;}else{_0x389d36=0xce;}_0x278191[_0x7dc9('0x17')](_0x389d36);return _0x278191[_0x7dc9('0x1c')]('Content-Range',_0xbe0437+'-'+_0x45698c+'/'+_0x11606f)[_0x7dc9('0x19')](_0x442819);}return null;};}function patchUpdates(_0x3b738a){return function(_0x12f08d){try{jsonpatch[_0x7dc9('0x1d')](_0x12f08d,_0x3b738a,!![]);}catch(_0x43ec33){return BPromise[_0x7dc9('0x1e')](_0x43ec33);}return _0x12f08d[_0x7dc9('0x1f')]();};}function saveUpdates(_0x2895f5,_0x155cc4){return function(_0x2b38d6){if(_0x2b38d6){return _0x2b38d6['update'](_0x2895f5)['then'](function(_0x12954f){return _0x12954f;});}return null;};}function removeEntity(_0x5981e2,_0x596e0f){return function(_0x349001){if(_0x349001){return _0x349001[_0x7dc9('0x20')]()['then'](function(){_0x5981e2[_0x7dc9('0x17')](0xcc)[_0x7dc9('0x18')]();});}};}function handleEntityNotFound(_0x41110a,_0x4906b1){return function(_0x424763){if(!_0x424763){_0x41110a[_0x7dc9('0x16')](0x194);}return _0x424763;};}function handleError(_0xf95336,_0x55a482){_0x55a482=_0x55a482||0x1f4;return function(_0x48c6bc){logger['error'](_0x48c6bc[_0x7dc9('0x21')]);if(_0x48c6bc[_0x7dc9('0x22')]){delete _0x48c6bc['name'];}_0xf95336['status'](_0x55a482)[_0x7dc9('0x23')](_0x48c6bc);};}exports['index']=function(_0x2d22eb,_0x1c690b){var _0x3a74a0={},_0x3e4102={},_0xa2aaa9={'count':0x0,'rows':[]};var _0x450124=_[_0x7dc9('0x24')](db[_0x7dc9('0x25')][_0x7dc9('0x26')],function(_0x3c4379){return{'name':_0x3c4379[_0x7dc9('0x27')],'type':_0x3c4379[_0x7dc9('0x28')]['key']};});_0x3e4102['model']=_['map'](_0x450124,'name');_0x3e4102['query']=_['keys'](_0x2d22eb['query']);_0x3e4102['filters']=_[_0x7dc9('0x29')](_0x3e4102[_0x7dc9('0x2a')],_0x3e4102[_0x7dc9('0x2b')]);_0x3a74a0[_0x7dc9('0x2c')]=_[_0x7dc9('0x29')](_0x3e4102[_0x7dc9('0x2a')],qs['fields'](_0x2d22eb['query']['fields']));_0x3a74a0[_0x7dc9('0x2c')]=_0x3a74a0['attributes'][_0x7dc9('0x2d')]?_0x3a74a0[_0x7dc9('0x2c')]:_0x3e4102[_0x7dc9('0x2a')];if(!_0x2d22eb[_0x7dc9('0x2b')][_0x7dc9('0x2e')](_0x7dc9('0x2f'))){_0x3a74a0[_0x7dc9('0x30')]=qs[_0x7dc9('0x30')](_0x2d22eb['query'][_0x7dc9('0x30')]);_0x3a74a0['offset']=qs[_0x7dc9('0x1b')](_0x2d22eb[_0x7dc9('0x2b')][_0x7dc9('0x1b')]);}_0x3a74a0[_0x7dc9('0x31')]=qs['sort'](_0x2d22eb[_0x7dc9('0x2b')]['sort']);_0x3a74a0[_0x7dc9('0x32')]=qs['filters'](_['pick'](_0x2d22eb[_0x7dc9('0x2b')],_0x3e4102[_0x7dc9('0x33')]),_0x450124);if(_0x2d22eb[_0x7dc9('0x2b')][_0x7dc9('0x34')]){_0x3a74a0['where']=_[_0x7dc9('0x35')](_0x3a74a0[_0x7dc9('0x32')],{'$or':_[_0x7dc9('0x24')](_0x450124,function(_0x437e6d){if(_0x437e6d[_0x7dc9('0x28')]!==_0x7dc9('0x36')){var _0x225a1c={};_0x225a1c[_0x437e6d[_0x7dc9('0x22')]]={'$like':'%'+_0x2d22eb[_0x7dc9('0x2b')][_0x7dc9('0x34')]+'%'};return _0x225a1c;}})});}_0x3a74a0=_[_0x7dc9('0x35')]({},_0x3a74a0,_0x2d22eb[_0x7dc9('0x37')]);var _0x5a94b5={'where':_0x3a74a0[_0x7dc9('0x32')]};return db[_0x7dc9('0x25')][_0x7dc9('0x1a')](_0x5a94b5)[_0x7dc9('0x38')](function(_0x4bcdce){_0xa2aaa9[_0x7dc9('0x1a')]=_0x4bcdce;if(_0x2d22eb[_0x7dc9('0x2b')][_0x7dc9('0x39')]){_0x3a74a0[_0x7dc9('0x3a')]=[{'all':!![]}];}return db[_0x7dc9('0x25')][_0x7dc9('0x3b')](_0x3a74a0);})['then'](function(_0x553230){_0xa2aaa9[_0x7dc9('0x3c')]=_0x553230;return _0xa2aaa9;})[_0x7dc9('0x38')](respondWithFilteredResult(_0x1c690b,_0x3a74a0))['catch'](handleError(_0x1c690b,null));};exports[_0x7dc9('0x3d')]=function(_0x4a37ec,_0x315d65){var _0x2a91fe={'raw':!![],'where':{'id':_0x4a37ec['params']['id']}},_0x3bca9c={};_0x3bca9c[_0x7dc9('0x2a')]=_[_0x7dc9('0x3e')](db[_0x7dc9('0x25')][_0x7dc9('0x26')]);_0x3bca9c[_0x7dc9('0x2b')]=_[_0x7dc9('0x3e')](_0x4a37ec[_0x7dc9('0x2b')]);_0x3bca9c['filters']=_[_0x7dc9('0x29')](_0x3bca9c['model'],_0x3bca9c['query']);_0x2a91fe[_0x7dc9('0x2c')]=_[_0x7dc9('0x29')](_0x3bca9c[_0x7dc9('0x2a')],qs[_0x7dc9('0x3f')](_0x4a37ec[_0x7dc9('0x2b')][_0x7dc9('0x3f')]));_0x2a91fe[_0x7dc9('0x2c')]=_0x2a91fe[_0x7dc9('0x2c')][_0x7dc9('0x2d')]?_0x2a91fe['attributes']:_0x3bca9c[_0x7dc9('0x2a')];if(_0x4a37ec[_0x7dc9('0x2b')][_0x7dc9('0x39')]){_0x2a91fe[_0x7dc9('0x3a')]=[{'all':!![]}];}_0x2a91fe=_[_0x7dc9('0x35')]({},_0x2a91fe,_0x4a37ec[_0x7dc9('0x37')]);return db['FreshdeskField'][_0x7dc9('0x40')](_0x2a91fe)[_0x7dc9('0x38')](handleEntityNotFound(_0x315d65,null))['then'](respondWithResult(_0x315d65,null))[_0x7dc9('0x41')](handleError(_0x315d65,null));};exports[_0x7dc9('0x42')]=function(_0x3c45b5,_0x5f0f97){return db[_0x7dc9('0x25')]['create'](_0x3c45b5['body'],{})[_0x7dc9('0x38')](respondWithResult(_0x5f0f97,0xc9))[_0x7dc9('0x41')](handleError(_0x5f0f97,null));};exports[_0x7dc9('0x43')]=function(_0x5e0dc5,_0x4aea89){if(_0x5e0dc5[_0x7dc9('0x44')]['id']){delete _0x5e0dc5['body']['id'];}return db[_0x7dc9('0x25')][_0x7dc9('0x40')]({'where':{'id':_0x5e0dc5['params']['id']}})[_0x7dc9('0x38')](handleEntityNotFound(_0x4aea89,null))[_0x7dc9('0x38')](saveUpdates(_0x5e0dc5[_0x7dc9('0x44')],null))[_0x7dc9('0x38')](respondWithResult(_0x4aea89,null))[_0x7dc9('0x41')](handleError(_0x4aea89,null));};exports[_0x7dc9('0x20')]=function(_0x86739f,_0x3a1102){return db[_0x7dc9('0x25')][_0x7dc9('0x40')]({'where':{'id':_0x86739f[_0x7dc9('0x45')]['id']}})[_0x7dc9('0x38')](handleEntityNotFound(_0x3a1102,null))[_0x7dc9('0x38')](removeEntity(_0x3a1102,null))['catch'](handleError(_0x3a1102,null));}; \ No newline at end of file +var _0xda19=['show','params','keys','options','find','create','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','status','error','stack','name','FreshdeskField','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','includeAll','include','catch'];(function(_0x2e07e9,_0xebe81f){var _0x35a43d=function(_0x40fe21){while(--_0x40fe21){_0x2e07e9['push'](_0x2e07e9['shift']());}};_0x35a43d(++_0xebe81f);}(_0xda19,0xd5));var _0x9da1=function(_0x352b6f,_0x55fab5){_0x352b6f=_0x352b6f-0x0;var _0x3f9e3c=_0xda19[_0x352b6f];return _0x3f9e3c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9da1('0x0'));var rimraf=require(_0x9da1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9da1('0x2'));var rp=require('request-promise');var moment=require(_0x9da1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9da1('0x4'));var util=require(_0x9da1('0x5'));var path=require(_0x9da1('0x6'));var sox=require(_0x9da1('0x7'));var csv=require(_0x9da1('0x8'));var ejs=require(_0x9da1('0x9'));var fs=require('fs');var fs_extra=require(_0x9da1('0xa'));var _=require(_0x9da1('0xb'));var squel=require(_0x9da1('0xc'));var crypto=require(_0x9da1('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9da1('0xe'));var Papa=require('papaparse');var Redis=require(_0x9da1('0xf'));var authService=require(_0x9da1('0x10'));var qs=require(_0x9da1('0x11'));var as=require(_0x9da1('0x12'));var hardwareService=require(_0x9da1('0x13'));var logger=require(_0x9da1('0x14'))(_0x9da1('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9da1('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4735c7,_0x1d93f8){_0x1d93f8=_0x1d93f8||0xcc;return function(_0xd2d225){if(_0xd2d225){return _0x4735c7[_0x9da1('0x17')](_0x1d93f8);}return _0x4735c7['status'](_0x1d93f8)[_0x9da1('0x18')]();};}function respondWithResult(_0x535a13,_0x4d17e1){_0x4d17e1=_0x4d17e1||0xc8;return function(_0x40ba9d){if(_0x40ba9d){return _0x535a13['status'](_0x4d17e1)[_0x9da1('0x19')](_0x40ba9d);}};}function respondWithFilteredResult(_0x43c093,_0x37653d){return function(_0x1a1a6b){if(_0x1a1a6b){var _0x7f1a64=_0x1a1a6b[_0x9da1('0x1a')],_0x514d8e=_0x37653d[_0x9da1('0x1b')],_0x16f75a=_0x37653d[_0x9da1('0x1b')]+_0x37653d[_0x9da1('0x1c')],_0x116a76;if(_0x16f75a>=_0x7f1a64){_0x16f75a=_0x7f1a64;_0x116a76=0xc8;}else{_0x116a76=0xce;}_0x43c093['status'](_0x116a76);return _0x43c093['set'](_0x9da1('0x1d'),_0x514d8e+'-'+_0x16f75a+'/'+_0x7f1a64)[_0x9da1('0x19')](_0x1a1a6b);}return null;};}function patchUpdates(_0x1b0e7f){return function(_0x41e555){try{jsonpatch[_0x9da1('0x1e')](_0x41e555,_0x1b0e7f,!![]);}catch(_0x3b1645){return BPromise[_0x9da1('0x1f')](_0x3b1645);}return _0x41e555['save']();};}function saveUpdates(_0x1a459c,_0x554845){return function(_0x9c3b37){if(_0x9c3b37){return _0x9c3b37[_0x9da1('0x20')](_0x1a459c)[_0x9da1('0x21')](function(_0x4e9d7d){return _0x4e9d7d;});}return null;};}function removeEntity(_0x5454d3,_0x14793b){return function(_0x3e6f85){if(_0x3e6f85){return _0x3e6f85[_0x9da1('0x22')]()[_0x9da1('0x21')](function(){_0x5454d3[_0x9da1('0x23')](0xcc)[_0x9da1('0x18')]();});}};}function handleEntityNotFound(_0x4c60aa,_0x2413fe){return function(_0x3bfa40){if(!_0x3bfa40){_0x4c60aa['sendStatus'](0x194);}return _0x3bfa40;};}function handleError(_0x45fcce,_0x3f5680){_0x3f5680=_0x3f5680||0x1f4;return function(_0x534210){logger[_0x9da1('0x24')](_0x534210[_0x9da1('0x25')]);if(_0x534210['name']){delete _0x534210[_0x9da1('0x26')];}_0x45fcce[_0x9da1('0x23')](_0x3f5680)['send'](_0x534210);};}exports['index']=function(_0x67dbc8,_0x47055e){var _0x5eca5b={},_0x27c6e2={},_0x5db5c2={'count':0x0,'rows':[]};var _0x5a6f2d=_['map'](db[_0x9da1('0x27')][_0x9da1('0x28')],function(_0x24c6d5){return{'name':_0x24c6d5[_0x9da1('0x29')],'type':_0x24c6d5[_0x9da1('0x2a')]['key']};});_0x27c6e2[_0x9da1('0x2b')]=_['map'](_0x5a6f2d,_0x9da1('0x26'));_0x27c6e2[_0x9da1('0x2c')]=_['keys'](_0x67dbc8[_0x9da1('0x2c')]);_0x27c6e2[_0x9da1('0x2d')]=_['intersection'](_0x27c6e2[_0x9da1('0x2b')],_0x27c6e2[_0x9da1('0x2c')]);_0x5eca5b[_0x9da1('0x2e')]=_[_0x9da1('0x2f')](_0x27c6e2['model'],qs['fields'](_0x67dbc8[_0x9da1('0x2c')][_0x9da1('0x30')]));_0x5eca5b[_0x9da1('0x2e')]=_0x5eca5b[_0x9da1('0x2e')][_0x9da1('0x31')]?_0x5eca5b['attributes']:_0x27c6e2[_0x9da1('0x2b')];if(!_0x67dbc8[_0x9da1('0x2c')][_0x9da1('0x32')](_0x9da1('0x33'))){_0x5eca5b[_0x9da1('0x1c')]=qs[_0x9da1('0x1c')](_0x67dbc8['query'][_0x9da1('0x1c')]);_0x5eca5b['offset']=qs['offset'](_0x67dbc8[_0x9da1('0x2c')]['offset']);}_0x5eca5b[_0x9da1('0x34')]=qs[_0x9da1('0x35')](_0x67dbc8[_0x9da1('0x2c')][_0x9da1('0x35')]);_0x5eca5b[_0x9da1('0x36')]=qs[_0x9da1('0x2d')](_[_0x9da1('0x37')](_0x67dbc8[_0x9da1('0x2c')],_0x27c6e2['filters']),_0x5a6f2d);if(_0x67dbc8[_0x9da1('0x2c')]['filter']){_0x5eca5b[_0x9da1('0x36')]=_['merge'](_0x5eca5b['where'],{'$or':_[_0x9da1('0x38')](_0x5a6f2d,function(_0x4d1d2e){if(_0x4d1d2e[_0x9da1('0x2a')]!==_0x9da1('0x39')){var _0x5dea20={};_0x5dea20[_0x4d1d2e[_0x9da1('0x26')]]={'$like':'%'+_0x67dbc8[_0x9da1('0x2c')][_0x9da1('0x3a')]+'%'};return _0x5dea20;}})});}_0x5eca5b=_[_0x9da1('0x3b')]({},_0x5eca5b,_0x67dbc8['options']);var _0x257c2e={'where':_0x5eca5b['where']};return db[_0x9da1('0x27')]['count'](_0x257c2e)[_0x9da1('0x21')](function(_0x46c176){_0x5db5c2['count']=_0x46c176;if(_0x67dbc8[_0x9da1('0x2c')][_0x9da1('0x3c')]){_0x5eca5b[_0x9da1('0x3d')]=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x5eca5b);})['then'](function(_0x27e78c){_0x5db5c2['rows']=_0x27e78c;return _0x5db5c2;})[_0x9da1('0x21')](respondWithFilteredResult(_0x47055e,_0x5eca5b))[_0x9da1('0x3e')](handleError(_0x47055e,null));};exports[_0x9da1('0x3f')]=function(_0x43c064,_0x54f188){var _0x42dbd8={'raw':!![],'where':{'id':_0x43c064[_0x9da1('0x40')]['id']}},_0x2e1b8b={};_0x2e1b8b[_0x9da1('0x2b')]=_[_0x9da1('0x41')](db[_0x9da1('0x27')][_0x9da1('0x28')]);_0x2e1b8b['query']=_[_0x9da1('0x41')](_0x43c064['query']);_0x2e1b8b[_0x9da1('0x2d')]=_['intersection'](_0x2e1b8b[_0x9da1('0x2b')],_0x2e1b8b[_0x9da1('0x2c')]);_0x42dbd8['attributes']=_[_0x9da1('0x2f')](_0x2e1b8b[_0x9da1('0x2b')],qs['fields'](_0x43c064[_0x9da1('0x2c')]['fields']));_0x42dbd8[_0x9da1('0x2e')]=_0x42dbd8[_0x9da1('0x2e')]['length']?_0x42dbd8['attributes']:_0x2e1b8b[_0x9da1('0x2b')];if(_0x43c064[_0x9da1('0x2c')][_0x9da1('0x3c')]){_0x42dbd8[_0x9da1('0x3d')]=[{'all':!![]}];}_0x42dbd8=_[_0x9da1('0x3b')]({},_0x42dbd8,_0x43c064[_0x9da1('0x42')]);return db[_0x9da1('0x27')][_0x9da1('0x43')](_0x42dbd8)['then'](handleEntityNotFound(_0x54f188,null))[_0x9da1('0x21')](respondWithResult(_0x54f188,null))[_0x9da1('0x3e')](handleError(_0x54f188,null));};exports[_0x9da1('0x44')]=function(_0x5cf7ef,_0xd5b3da){return db[_0x9da1('0x27')][_0x9da1('0x44')](_0x5cf7ef['body'],{})[_0x9da1('0x21')](respondWithResult(_0xd5b3da,0xc9))[_0x9da1('0x3e')](handleError(_0xd5b3da,null));};exports[_0x9da1('0x20')]=function(_0x516bdd,_0xd243a4){if(_0x516bdd['body']['id']){delete _0x516bdd['body']['id'];}return db[_0x9da1('0x27')][_0x9da1('0x43')]({'where':{'id':_0x516bdd['params']['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0xd243a4,null))[_0x9da1('0x21')](saveUpdates(_0x516bdd['body'],null))[_0x9da1('0x21')](respondWithResult(_0xd243a4,null))[_0x9da1('0x3e')](handleError(_0xd243a4,null));};exports[_0x9da1('0x22')]=function(_0x3a529d,_0x4780ca){return db[_0x9da1('0x27')][_0x9da1('0x43')]({'where':{'id':_0x3a529d[_0x9da1('0x40')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x4780ca,null))['then'](removeEntity(_0x4780ca,null))[_0x9da1('0x3e')](handleError(_0x4780ca,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 194af03..b077234 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 _0x0227=['lodash','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','int_freshdesk_fields','freshdesk_unique_index','idField'];(function(_0x577331,_0x9c0fa0){var _0x30d6e3=function(_0x2e082c){while(--_0x2e082c){_0x577331['push'](_0x577331['shift']());}};_0x30d6e3(++_0x9c0fa0);}(_0x0227,0x84));var _0x7022=function(_0x2fb29b,_0x46a5a3){_0x2fb29b=_0x2fb29b-0x0;var _0x10a8dd=_0x0227[_0x2fb29b];return _0x10a8dd;};'use strict';var _=require(_0x7022('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7022('0x1'));var moment=require('moment');var BPromise=require(_0x7022('0x2'));var rp=require(_0x7022('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7022('0x4'));var config=require(_0x7022('0x5'));var attributes=require('./intFreshdeskField.attributes');module[_0x7022('0x6')]=function(_0x4c0640,_0x588baa){return _0x4c0640[_0x7022('0x7')]('FreshdeskField',attributes,{'tableName':_0x7022('0x8'),'paranoid':![],'indexes':[{'name':_0x7022('0x9'),'fields':[_0x7022('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdee7=['exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x178e71,_0x5c6c7d){var _0x3eec6c=function(_0x406d3f){while(--_0x406d3f){_0x178e71['push'](_0x178e71['shift']());}};_0x3eec6c(++_0x5c6c7d);}(_0xdee7,0x17f));var _0x7dee=function(_0xc3d38f,_0x41df2c){_0xc3d38f=_0xc3d38f-0x0;var _0x2b6fab=_0xdee7[_0xc3d38f];return _0x2b6fab;};'use strict';var _=require(_0x7dee('0x0'));var util=require(_0x7dee('0x1'));var logger=require(_0x7dee('0x2'))(_0x7dee('0x3'));var moment=require('moment');var BPromise=require(_0x7dee('0x4'));var rp=require(_0x7dee('0x5'));var fs=require('fs');var path=require(_0x7dee('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshdeskField.attributes');module[_0x7dee('0x7')]=function(_0x5e25c6,_0x3fdf81){return _0x5e25c6[_0x7dee('0x8')](_0x7dee('0x9'),attributes,{'tableName':_0x7dee('0xa'),'paranoid':![],'indexes':[{'name':_0x7dee('0xb'),'fields':['idField',_0x7dee('0xc')],'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 e4fe43d..ea13a18 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 _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xb37805,_0x17cef4){var _0x3bd5ce=function(_0x926719){while(--_0x926719){_0xb37805['push'](_0xb37805['shift']());}};_0x3bd5ce(++_0x17cef4);}(_0xb10b,0x12a));var _0xbb10=function(_0x55d7c2,_0x4ce6fb){_0x55d7c2=_0x55d7c2-0x0;var _0x1755ef=_0xb10b[_0x55d7c2];return _0x1755ef;};'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);});});} \ No newline at end of file +var _0x7a54=['info','FreshdeskField,\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(_0x31e6fa,_0x4a8365){_0x31e6fa=_0x31e6fa-0x0;var _0x9148b1=_0x7a54[_0x31e6fa];return _0x9148b1;};'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')]('FreshdeskField,\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/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 6c5002e..49cd277 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 _0xe8a1=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','create','put','update','delete','destroy','exports','util'];(function(_0x236832,_0x12de78){var _0x453cc2=function(_0x25d163){while(--_0x25d163){_0x236832['push'](_0x236832['shift']());}};_0x453cc2(++_0x12de78);}(_0xe8a1,0x1f3));var _0x1e8a=function(_0x2eaaa4,_0x447854){_0x2eaaa4=_0x2eaaa4-0x0;var _0x5ab487=_0xe8a1[_0x2eaaa4];return _0x5ab487;};'use strict';var multer=require('multer');var util=require(_0x1e8a('0x0'));var path=require(_0x1e8a('0x1'));var timeout=require(_0x1e8a('0x2'));var express=require(_0x1e8a('0x3'));var router=express[_0x1e8a('0x4')]();var fs_extra=require(_0x1e8a('0x5'));var auth=require(_0x1e8a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshsalesAccount.controller');router[_0x1e8a('0x7')]('/',auth[_0x1e8a('0x8')](),controller[_0x1e8a('0x9')]);router[_0x1e8a('0x7')](_0x1e8a('0xa'),auth['isAuthenticated'](),controller[_0x1e8a('0xb')]);router['get'](_0x1e8a('0xc'),auth['isAuthenticated'](),controller[_0x1e8a('0xd')]);router[_0x1e8a('0x7')]('/:id/fields',auth[_0x1e8a('0x8')](),controller['getFields']);router['post']('/',auth[_0x1e8a('0x8')](),controller[_0x1e8a('0xe')]);router['post'](_0x1e8a('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x1e8a('0xf')](_0x1e8a('0xa'),auth[_0x1e8a('0x8')](),controller[_0x1e8a('0x10')]);router[_0x1e8a('0x11')](_0x1e8a('0xa'),auth[_0x1e8a('0x8')](),controller[_0x1e8a('0x12')]);module[_0x1e8a('0x13')]=router; \ No newline at end of file +var _0x17a0=['/:id','show','getConfigurations','/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','put','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','get','isAuthenticated','index'];(function(_0x4d351a,_0x3428e1){var _0x5f261e=function(_0x39b9d0){while(--_0x39b9d0){_0x4d351a['push'](_0x4d351a['shift']());}};_0x5f261e(++_0x3428e1);}(_0x17a0,0x165));var _0x017a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x17a0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x017a('0x0'));var path=require(_0x017a('0x1'));var timeout=require(_0x017a('0x2'));var express=require('express');var router=express[_0x017a('0x3')]();var fs_extra=require(_0x017a('0x4'));var auth=require(_0x017a('0x5'));var interaction=require(_0x017a('0x6'));var config=require('../../config/environment');var controller=require(_0x017a('0x7'));router[_0x017a('0x8')]('/',auth[_0x017a('0x9')](),controller[_0x017a('0xa')]);router[_0x017a('0x8')](_0x017a('0xb'),auth[_0x017a('0x9')](),controller[_0x017a('0xc')]);router[_0x017a('0x8')]('/:id/configurations',auth[_0x017a('0x9')](),controller[_0x017a('0xd')]);router['get'](_0x017a('0xe'),auth['isAuthenticated'](),controller[_0x017a('0xf')]);router['post']('/',auth[_0x017a('0x9')](),controller[_0x017a('0x10')]);router[_0x017a('0x11')](_0x017a('0x12'),auth[_0x017a('0x9')](),controller[_0x017a('0x13')]);router[_0x017a('0x14')](_0x017a('0xb'),auth[_0x017a('0x9')](),controller['update']);router[_0x017a('0x15')](_0x017a('0xb'),auth[_0x017a('0x9')](),controller[_0x017a('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 98d1d0b..437616b 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 _0x651a=['exports','STRING','username','remoteUri'];(function(_0x2338d8,_0x5ca1b3){var _0x1e19b7=function(_0x5a9254){while(--_0x5a9254){_0x2338d8['push'](_0x2338d8['shift']());}};_0x1e19b7(++_0x5ca1b3);}(_0x651a,0x17c));var _0xa651=function(_0x471268,_0x5ce885){_0x471268=_0x471268-0x0;var _0x1298f3=_0x651a[_0x471268];return _0x1298f3;};'use strict';var Sequelize=require('sequelize');module[_0xa651('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa651('0x1')]},'username':{'type':Sequelize[_0xa651('0x1')],'unique':_0xa651('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xa651('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xe9b3=['STRING','remoteUri','exports','username'];(function(_0x1ef5fb,_0x1b1bce){var _0x629ef2=function(_0x43c0b9){while(--_0x43c0b9){_0x1ef5fb['push'](_0x1ef5fb['shift']());}};_0x629ef2(++_0x1b1bce);}(_0xe9b3,0x72));var _0x3e9b=function(_0x4bba6f,_0x33716d){_0x4bba6f=_0x4bba6f-0x0;var _0x3cfa2d=_0xe9b3[_0x4bba6f];return _0x3cfa2d;};'use strict';var Sequelize=require('sequelize');module[_0x3e9b('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x3e9b('0x1')},'apiKey':{'type':Sequelize[_0x3e9b('0x2')]},'remoteUri':{'type':Sequelize[_0x3e9b('0x2')],'unique':_0x3e9b('0x3')},'serverUrl':{'type':Sequelize[_0x3e9b('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 87c2d95..aeba024 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 _0x3473=['sort','where','pick','filter','merge','VIRTUAL','options','FreshsalesAccount','count','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','FreshsalesField','username','remoteUri','slice','substring','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','apiKey','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields','send','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','offset','Content-Range','apply','reject','save','update','then','destroy','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit'];(function(_0x3ee1fe,_0x59f2a1){var _0x1ae57a=function(_0x1ef0c4){while(--_0x1ef0c4){_0x3ee1fe['push'](_0x3ee1fe['shift']());}};_0x1ae57a(++_0x59f2a1);}(_0x3473,0xa1));var _0x3347=function(_0x12314f,_0x2ac7ae){_0x12314f=_0x12314f-0x0;var _0x3b6e61=_0x3473[_0x12314f];return _0x3b6e61;};'use strict';var pdf=require(_0x3347('0x0'));var emlformat=require(_0x3347('0x1'));var rimraf=require(_0x3347('0x2'));var zipdir=require(_0x3347('0x3'));var jsonpatch=require(_0x3347('0x4'));var rp=require(_0x3347('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3347('0x6'));var util=require(_0x3347('0x7'));var path=require(_0x3347('0x8'));var sox=require(_0x3347('0x9'));var csv=require(_0x3347('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3347('0xb'));var _=require(_0x3347('0xc'));var squel=require(_0x3347('0xd'));var crypto=require(_0x3347('0xe'));var jsforce=require(_0x3347('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3347('0x10'));var Papa=require(_0x3347('0x11'));var Redis=require('ioredis');var authService=require(_0x3347('0x12'));var qs=require(_0x3347('0x13'));var as=require(_0x3347('0x14'));var hardwareService=require(_0x3347('0x15'));var logger=require('../../config/logger')(_0x3347('0x16'));var utils=require(_0x3347('0x17'));var config=require(_0x3347('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3347('0x19'))['db'];var integrations=require(_0x3347('0x1a'));var jayson=require(_0x3347('0x1b'));var client=jayson[_0x3347('0x1c')][_0x3347('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x2591c0,_0x5f1808,_0x3f3ae5,_0x59d042){return new BPromise(function(_0x40c13b,_0x1b834d){var _0x460630=_0x59d042||client;return _0x460630['request'](_0x2591c0,_0x3f3ae5)['then'](function(_0x22cff8){logger[_0x3347('0x1e')](_0x3347('0x1f'),_0x5f1808,_0x3347('0x20'));logger['debug'](_0x3347('0x21'),_0x5f1808,'request\x20sent',JSON[_0x3347('0x22')](_0x22cff8));if(_0x22cff8[_0x3347('0x23')]){if(_0x22cff8[_0x3347('0x23')]['code']===0x1f4){logger[_0x3347('0x23')](_0x3347('0x1f'),_0x5f1808,_0x22cff8[_0x3347('0x23')][_0x3347('0x24')]);return _0x1b834d(_0x22cff8[_0x3347('0x23')][_0x3347('0x24')]);}logger[_0x3347('0x23')](_0x3347('0x1f'),_0x5f1808,_0x22cff8[_0x3347('0x23')][_0x3347('0x24')]);return _0x40c13b(_0x22cff8['error'][_0x3347('0x24')]);}else{logger[_0x3347('0x1e')](_0x3347('0x1f'),_0x5f1808,_0x3347('0x20'));_0x40c13b(_0x22cff8[_0x3347('0x25')][_0x3347('0x24')]);}})['catch'](function(_0x475c11){logger[_0x3347('0x23')](_0x3347('0x1f'),_0x5f1808,_0x475c11);_0x1b834d(_0x475c11);});});}function respondWithStatusCode(_0x87ee47,_0x5d13b4){_0x5d13b4=_0x5d13b4||0xcc;return function(_0x5c7714){if(_0x5c7714){return _0x87ee47[_0x3347('0x26')](_0x5d13b4);}return _0x87ee47[_0x3347('0x27')](_0x5d13b4)[_0x3347('0x28')]();};}function respondWithResult(_0x5c1b79,_0x4aab8b){_0x4aab8b=_0x4aab8b||0xc8;return function(_0x53f17d){if(_0x53f17d){return _0x5c1b79[_0x3347('0x27')](_0x4aab8b)[_0x3347('0x29')](_0x53f17d);}};}function respondWithFilteredResult(_0x5afa5a,_0x16ea3f){return function(_0x16646f){if(_0x16646f){var _0xb9be9e=_0x16646f['count'],_0x27da2d=_0x16ea3f[_0x3347('0x2a')],_0x128981=_0x16ea3f[_0x3347('0x2a')]+_0x16ea3f['limit'],_0x4169e7;if(_0x128981>=_0xb9be9e){_0x128981=_0xb9be9e;_0x4169e7=0xc8;}else{_0x4169e7=0xce;}_0x5afa5a['status'](_0x4169e7);return _0x5afa5a['set'](_0x3347('0x2b'),_0x27da2d+'-'+_0x128981+'/'+_0xb9be9e)[_0x3347('0x29')](_0x16646f);}return null;};}function patchUpdates(_0x1af29e){return function(_0x5233ba){try{jsonpatch[_0x3347('0x2c')](_0x5233ba,_0x1af29e,!![]);}catch(_0x3fc21e){return BPromise[_0x3347('0x2d')](_0x3fc21e);}return _0x5233ba[_0x3347('0x2e')]();};}function saveUpdates(_0x19f3ba,_0x275939){return function(_0x1f50fc){if(_0x1f50fc){return _0x1f50fc[_0x3347('0x2f')](_0x19f3ba)[_0x3347('0x30')](function(_0x196d78){return _0x196d78;});}return null;};}function removeEntity(_0x13f63e,_0x511fe2){return function(_0x4e3d02){if(_0x4e3d02){return _0x4e3d02[_0x3347('0x31')]()[_0x3347('0x30')](function(){_0x13f63e[_0x3347('0x27')](0xcc)[_0x3347('0x28')]();});}};}function handleEntityNotFound(_0xbda097,_0x54627a){return function(_0x38a9f6){if(!_0x38a9f6){_0xbda097[_0x3347('0x26')](0x194);}return _0x38a9f6;};}function handleError(_0x36bcec,_0x244b95){_0x244b95=_0x244b95||0x1f4;return function(_0x577999){logger[_0x3347('0x23')](_0x577999[_0x3347('0x32')]);if(_0x577999[_0x3347('0x33')]){delete _0x577999[_0x3347('0x33')];}_0x36bcec[_0x3347('0x27')](_0x244b95)['send'](_0x577999);};}exports['index']=function(_0x55973e,_0x2fac1b){var _0x459c0e={},_0x1397d6={},_0x57446c={'count':0x0,'rows':[]};var _0x38e1c5=_[_0x3347('0x34')](db['FreshsalesAccount'][_0x3347('0x35')],function(_0x3f6d9f){return{'name':_0x3f6d9f[_0x3347('0x36')],'type':_0x3f6d9f[_0x3347('0x37')][_0x3347('0x38')]};});_0x1397d6[_0x3347('0x39')]=_['map'](_0x38e1c5,_0x3347('0x33'));_0x1397d6[_0x3347('0x3a')]=_[_0x3347('0x3b')](_0x55973e[_0x3347('0x3a')]);_0x1397d6[_0x3347('0x3c')]=_[_0x3347('0x3d')](_0x1397d6[_0x3347('0x39')],_0x1397d6[_0x3347('0x3a')]);_0x459c0e[_0x3347('0x3e')]=_[_0x3347('0x3d')](_0x1397d6['model'],qs[_0x3347('0x3f')](_0x55973e['query']['fields']));_0x459c0e['attributes']=_0x459c0e[_0x3347('0x3e')]['length']?_0x459c0e[_0x3347('0x3e')]:_0x1397d6[_0x3347('0x39')];if(!_0x55973e[_0x3347('0x3a')][_0x3347('0x40')](_0x3347('0x41'))){_0x459c0e[_0x3347('0x42')]=qs['limit'](_0x55973e[_0x3347('0x3a')][_0x3347('0x42')]);_0x459c0e[_0x3347('0x2a')]=qs['offset'](_0x55973e[_0x3347('0x3a')][_0x3347('0x2a')]);}_0x459c0e['order']=qs[_0x3347('0x43')](_0x55973e[_0x3347('0x3a')]['sort']);_0x459c0e[_0x3347('0x44')]=qs[_0x3347('0x3c')](_[_0x3347('0x45')](_0x55973e['query'],_0x1397d6[_0x3347('0x3c')]),_0x38e1c5);if(_0x55973e[_0x3347('0x3a')][_0x3347('0x46')]){_0x459c0e['where']=_[_0x3347('0x47')](_0x459c0e[_0x3347('0x44')],{'$or':_[_0x3347('0x34')](_0x38e1c5,function(_0x5ce53a){if(_0x5ce53a[_0x3347('0x37')]!==_0x3347('0x48')){var _0x394695={};_0x394695[_0x5ce53a[_0x3347('0x33')]]={'$like':'%'+_0x55973e[_0x3347('0x3a')][_0x3347('0x46')]+'%'};return _0x394695;}})});}_0x459c0e=_[_0x3347('0x47')]({},_0x459c0e,_0x55973e[_0x3347('0x49')]);var _0x4ad9fe={'where':_0x459c0e['where']};return db[_0x3347('0x4a')][_0x3347('0x4b')](_0x4ad9fe)[_0x3347('0x30')](function(_0x45849e){_0x57446c[_0x3347('0x4b')]=_0x45849e;if(_0x55973e[_0x3347('0x3a')][_0x3347('0x4c')]){_0x459c0e[_0x3347('0x4d')]=[{'all':!![]}];}return db[_0x3347('0x4a')][_0x3347('0x4e')](_0x459c0e);})[_0x3347('0x30')](function(_0x1d4bf6){_0x57446c[_0x3347('0x4f')]=_0x1d4bf6;return _0x57446c;})[_0x3347('0x30')](respondWithFilteredResult(_0x2fac1b,_0x459c0e))[_0x3347('0x50')](handleError(_0x2fac1b,null));};exports[_0x3347('0x51')]=function(_0x44606b,_0x1810dd){var _0x21b22d={'raw':![],'where':{'id':_0x44606b[_0x3347('0x52')]['id']}},_0x415b08={};_0x415b08[_0x3347('0x39')]=_[_0x3347('0x3b')](db['FreshsalesAccount'][_0x3347('0x35')]);_0x415b08[_0x3347('0x3a')]=_[_0x3347('0x3b')](_0x44606b[_0x3347('0x3a')]);_0x415b08[_0x3347('0x3c')]=_[_0x3347('0x3d')](_0x415b08['model'],_0x415b08['query']);_0x21b22d[_0x3347('0x3e')]=_[_0x3347('0x3d')](_0x415b08[_0x3347('0x39')],qs[_0x3347('0x3f')](_0x44606b[_0x3347('0x3a')][_0x3347('0x3f')]));_0x21b22d[_0x3347('0x3e')]=_0x21b22d[_0x3347('0x3e')][_0x3347('0x53')]?_0x21b22d[_0x3347('0x3e')]:_0x415b08[_0x3347('0x39')];if(_0x44606b['query'][_0x3347('0x4c')]){_0x21b22d[_0x3347('0x4d')]=[{'all':!![]}];}_0x21b22d=_[_0x3347('0x47')]({},_0x21b22d,_0x44606b['options']);return db[_0x3347('0x4a')]['find'](_0x21b22d)[_0x3347('0x30')](handleEntityNotFound(_0x1810dd,null))['then'](respondWithResult(_0x1810dd,null))[_0x3347('0x50')](handleError(_0x1810dd,null));};exports['create']=function(_0x548c39,_0x4439ed){return db[_0x3347('0x4a')][_0x3347('0x54')](_0x548c39[_0x3347('0x55')],{})[_0x3347('0x30')](respondWithResult(_0x4439ed,0xc9))[_0x3347('0x50')](handleError(_0x4439ed,null));};exports[_0x3347('0x2f')]=function(_0x211c95,_0x16ca39){if(_0x211c95[_0x3347('0x55')]['id']){delete _0x211c95[_0x3347('0x55')]['id'];}return db['FreshsalesAccount'][_0x3347('0x56')]({'where':{'id':_0x211c95[_0x3347('0x52')]['id']}})[_0x3347('0x30')](handleEntityNotFound(_0x16ca39,null))['then'](saveUpdates(_0x211c95[_0x3347('0x55')],null))[_0x3347('0x30')](respondWithResult(_0x16ca39,null))['catch'](handleError(_0x16ca39,null));};exports[_0x3347('0x31')]=function(_0x276bea,_0x3d66d8){return db[_0x3347('0x4a')][_0x3347('0x56')]({'where':{'id':_0x276bea[_0x3347('0x52')]['id']}})['then'](handleEntityNotFound(_0x3d66d8,null))[_0x3347('0x30')](removeEntity(_0x3d66d8,null))['catch'](handleError(_0x3d66d8,null));};exports[_0x3347('0x57')]=function(_0xcffc38,_0x290320,_0x47dd24){var _0x5a063d={};var _0x1bbdf7={};var _0x38c042;var _0x162da5;return db[_0x3347('0x4a')][_0x3347('0x58')]({'where':{'id':_0xcffc38['params']['id']}})[_0x3347('0x30')](handleEntityNotFound(_0x290320,null))[_0x3347('0x30')](function(_0x500abb){if(_0x500abb){_0x38c042=_0x500abb;_0x1bbdf7['model']=_[_0x3347('0x3b')](db[_0x3347('0x59')]['rawAttributes']);_0x1bbdf7['query']=_[_0x3347('0x3b')](_0xcffc38[_0x3347('0x3a')]);_0x1bbdf7[_0x3347('0x3c')]=_['intersection'](_0x1bbdf7[_0x3347('0x39')],_0x1bbdf7[_0x3347('0x3a')]);_0x5a063d[_0x3347('0x3e')]=_[_0x3347('0x3d')](_0x1bbdf7[_0x3347('0x39')],qs[_0x3347('0x3f')](_0xcffc38[_0x3347('0x3a')][_0x3347('0x3f')]));_0x5a063d[_0x3347('0x3e')]=_0x5a063d['attributes'][_0x3347('0x53')]?_0x5a063d[_0x3347('0x3e')]:_0x1bbdf7[_0x3347('0x39')];_0x5a063d['order']=qs[_0x3347('0x43')](_0xcffc38[_0x3347('0x3a')][_0x3347('0x43')]);_0x5a063d[_0x3347('0x44')]=qs[_0x3347('0x3c')](_['pick'](_0xcffc38[_0x3347('0x3a')],_0x1bbdf7[_0x3347('0x3c')]));if(_0xcffc38[_0x3347('0x3a')][_0x3347('0x46')]){_0x5a063d[_0x3347('0x44')]=_[_0x3347('0x47')](_0x5a063d[_0x3347('0x44')],{'$or':_[_0x3347('0x34')](_0x5a063d[_0x3347('0x3e')],function(_0x3c6226){var _0x419eae={};_0x419eae[_0x3c6226]={'$like':'%'+_0xcffc38[_0x3347('0x3a')][_0x3347('0x46')]+'%'};return _0x419eae;})});}_0x5a063d=_[_0x3347('0x47')]({},_0x5a063d,_0xcffc38['options']);return _0x38c042[_0x3347('0x57')](_0x5a063d);}})['then'](function(_0x24234a){if(_0x24234a){_0x162da5=_0x24234a[_0x3347('0x53')];if(!_0xcffc38[_0x3347('0x3a')][_0x3347('0x40')](_0x3347('0x41'))){_0x5a063d['limit']=qs['limit'](_0xcffc38[_0x3347('0x3a')][_0x3347('0x42')]);_0x5a063d[_0x3347('0x2a')]=qs[_0x3347('0x2a')](_0xcffc38['query']['offset']);}return _0x38c042[_0x3347('0x57')](_0x5a063d);}})[_0x3347('0x30')](function(_0x52477a){if(_0x52477a){return _0x52477a?{'count':_0x162da5,'rows':_0x52477a}:null;}})[_0x3347('0x30')](respondWithResult(_0x290320,null))[_0x3347('0x50')](handleError(_0x290320,null));};exports[_0x3347('0x5a')]=function(_0x3ab80a,_0x6a6c6b,_0x3057c9){if(_0x3ab80a[_0x3347('0x55')]['id']){delete _0x3ab80a[_0x3347('0x55')]['id'];}return db['FreshsalesAccount']['findOne']({'where':{'id':_0x3ab80a['params']['id']}})[_0x3347('0x30')](handleEntityNotFound(_0x6a6c6b,null))[_0x3347('0x30')](function(_0x36d158){if(_0x36d158){_0x3ab80a['body'][_0x3347('0x5b')]=_0x36d158['id'];_0x3ab80a[_0x3347('0x55')][_0x3347('0x5c')]=integrations[_0x3347('0x5d')](_0x3ab80a[_0x3347('0x55')][_0x3347('0x5e')],_0x3ab80a[_0x3347('0x55')]['type']);_0x3ab80a[_0x3347('0x55')]['Descriptions']=integrations['getDescriptions'](_0x3ab80a[_0x3347('0x55')][_0x3347('0x5e')],_0x3ab80a[_0x3347('0x55')]['type']);return db[_0x3347('0x59')][_0x3347('0x54')](_0x3ab80a[_0x3347('0x55')],{'include':[{'model':db[_0x3347('0x5f')],'as':_0x3347('0x5c')},{'model':db['FreshsalesField'],'as':'Descriptions'}]});}return null;})[_0x3347('0x30')](respondWithResult(_0x6a6c6b,null))['catch'](handleError(_0x6a6c6b,null));};exports['getFields']=function(_0x285ffd,_0x54af9d,_0x269574){var _0x1f497f='';var _0x337357='';return db[_0x3347('0x4a')]['findOne']({'where':{'id':_0x285ffd[_0x3347('0x52')]['id']},'attributes':['id',_0x3347('0x60'),'remoteUri','apiKey']})[_0x3347('0x30')](handleEntityNotFound(_0x54af9d,null))[_0x3347('0x30')](function(_0xd7f13c){if(_0xd7f13c){_0x337357=_0xd7f13c[_0x3347('0x60')];_0x1f497f=_0xd7f13c[_0x3347('0x61')];var _0x59474a=_0xd7f13c[_0x3347('0x61')][_0x3347('0x62')](-0x1);if(_0x59474a==='/'){_0x1f497f=_0x1f497f[_0x3347('0x63')](0x0,_0x1f497f[_0x3347('0x64')](_0x59474a));}return rp({'method':_0x3347('0x65'),'uri':util[_0x3347('0x66')]('%s%s',_0x1f497f,_0x3347('0x67')),'headers':{'Authorization':_0x3347('0x68')+_0xd7f13c[_0x3347('0x69')]},'json':!![]});}})[_0x3347('0x30')](function(_0x315ad8){if(_0x315ad8){var _0x5396d0=_0x315ad8[_0x3347('0x6a')];var _0x59843c=![];var _0x2533ce=null;for(_0x2533ce=0x0;_0x2533ce<_0x5396d0[_0x3347('0x53')];_0x2533ce++){if(_0x5396d0[_0x2533ce][_0x3347('0x6b')]===_0x337357){_0x59843c=!![];}}if(_0x59843c){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x3347('0x6c')});}}})[_0x3347('0x30')](respondWithResult(_0x54af9d,null))[_0x3347('0x50')](function(_0x1df3ed){var _0x3e6792=_0x285ffd[_0x3347('0x3a')]['test']?0x1f4:_0x1df3ed[_0x3347('0x6d')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x3347('0x6e'),_0x3e6792,JSON[_0x3347('0x22')](_0x1df3ed));delete _0x1df3ed[_0x3347('0x33')];if(_0x3e6792===0x191){_0x3e6792=0x190;}_0x54af9d[_0x3347('0x27')](_0x3e6792)[_0x3347('0x6f')](_0x285ffd['query'][_0x3347('0x70')]?{'message':_0x3347('0x71'),'statusCode':_0x1df3ed[_0x3347('0x6d')]}:_0x1df3ed);});}; \ No newline at end of file +var _0xc9a6=['findAll','rows','catch','show','params','find','create','body','getConfigurations','FreshsalesConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','%s%s','/api/selector/owners','users','Requested\x20Resource\x20not\x20Found','test','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x5d0f97,_0x25009f){var _0xc7236=function(_0xa7353f){while(--_0xa7353f){_0x5d0f97['push'](_0x5d0f97['shift']());}};_0xc7236(++_0x25009f);}(_0xc9a6,0x170));var _0x6c9a=function(_0x54867e,_0x122e1e){_0x54867e=_0x54867e-0x0;var _0x4182d4=_0xc9a6[_0x54867e];return _0x4182d4;};'use strict';var pdf=require(_0x6c9a('0x0'));var emlformat=require(_0x6c9a('0x1'));var rimraf=require(_0x6c9a('0x2'));var zipdir=require(_0x6c9a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c9a('0x4'));var moment=require(_0x6c9a('0x5'));var BPromise=require(_0x6c9a('0x6'));var Mustache=require(_0x6c9a('0x7'));var util=require('util');var path=require(_0x6c9a('0x8'));var sox=require('sox');var csv=require(_0x6c9a('0x9'));var ejs=require(_0x6c9a('0xa'));var fs=require('fs');var fs_extra=require(_0x6c9a('0xb'));var _=require(_0x6c9a('0xc'));var squel=require(_0x6c9a('0xd'));var crypto=require(_0x6c9a('0xe'));var jsforce=require(_0x6c9a('0xf'));var deskjs=require(_0x6c9a('0x10'));var toCsv=require('to-csv');var querystring=require(_0x6c9a('0x11'));var Papa=require('papaparse');var Redis=require(_0x6c9a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6c9a('0x13'));var as=require(_0x6c9a('0x14'));var hardwareService=require(_0x6c9a('0x15'));var logger=require('../../config/logger')(_0x6c9a('0x16'));var utils=require(_0x6c9a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6c9a('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6c9a('0x19'));var jayson=require('jayson/promise');var client=jayson[_0x6c9a('0x1a')][_0x6c9a('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x96a5b3,_0xcdb655,_0x88d174,_0x41f5cb){return new BPromise(function(_0x51e2d7,_0x3a5aba){var _0xd5efb=_0x41f5cb||client;return _0xd5efb[_0x6c9a('0x1c')](_0x96a5b3,_0x88d174)[_0x6c9a('0x1d')](function(_0x3e72c0){logger[_0x6c9a('0x1e')](_0x6c9a('0x1f'),_0xcdb655,'request\x20sent');logger['debug'](_0x6c9a('0x20'),_0xcdb655,'request\x20sent',JSON[_0x6c9a('0x21')](_0x3e72c0));if(_0x3e72c0['error']){if(_0x3e72c0[_0x6c9a('0x22')]['code']===0x1f4){logger[_0x6c9a('0x22')]('FreshsalesAccount,\x20%s,\x20%s',_0xcdb655,_0x3e72c0[_0x6c9a('0x22')][_0x6c9a('0x23')]);return _0x3a5aba(_0x3e72c0['error'][_0x6c9a('0x23')]);}logger[_0x6c9a('0x22')](_0x6c9a('0x1f'),_0xcdb655,_0x3e72c0[_0x6c9a('0x22')][_0x6c9a('0x23')]);return _0x51e2d7(_0x3e72c0['error'][_0x6c9a('0x23')]);}else{logger[_0x6c9a('0x1e')](_0x6c9a('0x1f'),_0xcdb655,_0x6c9a('0x24'));_0x51e2d7(_0x3e72c0[_0x6c9a('0x25')][_0x6c9a('0x23')]);}})['catch'](function(_0x27df13){logger[_0x6c9a('0x22')](_0x6c9a('0x1f'),_0xcdb655,_0x27df13);_0x3a5aba(_0x27df13);});});}function respondWithStatusCode(_0x3f6ec3,_0x9193b8){_0x9193b8=_0x9193b8||0xcc;return function(_0x3c28f5){if(_0x3c28f5){return _0x3f6ec3[_0x6c9a('0x26')](_0x9193b8);}return _0x3f6ec3[_0x6c9a('0x27')](_0x9193b8)['end']();};}function respondWithResult(_0x18f63f,_0x268e5c){_0x268e5c=_0x268e5c||0xc8;return function(_0x393469){if(_0x393469){return _0x18f63f[_0x6c9a('0x27')](_0x268e5c)[_0x6c9a('0x28')](_0x393469);}};}function respondWithFilteredResult(_0x49d089,_0x4504d1){return function(_0x5e9964){if(_0x5e9964){var _0xb8195c=_0x5e9964[_0x6c9a('0x29')],_0x60c06c=_0x4504d1['offset'],_0x39625c=_0x4504d1[_0x6c9a('0x2a')]+_0x4504d1[_0x6c9a('0x2b')],_0x5d67cf;if(_0x39625c>=_0xb8195c){_0x39625c=_0xb8195c;_0x5d67cf=0xc8;}else{_0x5d67cf=0xce;}_0x49d089[_0x6c9a('0x27')](_0x5d67cf);return _0x49d089[_0x6c9a('0x2c')]('Content-Range',_0x60c06c+'-'+_0x39625c+'/'+_0xb8195c)[_0x6c9a('0x28')](_0x5e9964);}return null;};}function patchUpdates(_0xf77226){return function(_0xbc99ef){try{jsonpatch[_0x6c9a('0x2d')](_0xbc99ef,_0xf77226,!![]);}catch(_0x1de9cd){return BPromise[_0x6c9a('0x2e')](_0x1de9cd);}return _0xbc99ef[_0x6c9a('0x2f')]();};}function saveUpdates(_0x35751d,_0x4a6cc4){return function(_0x29872f){if(_0x29872f){return _0x29872f[_0x6c9a('0x30')](_0x35751d)[_0x6c9a('0x1d')](function(_0xa2cdaf){return _0xa2cdaf;});}return null;};}function removeEntity(_0x15d292,_0x1eee05){return function(_0x33de65){if(_0x33de65){return _0x33de65[_0x6c9a('0x31')]()[_0x6c9a('0x1d')](function(){_0x15d292[_0x6c9a('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c68ee,_0x3ff4ff){return function(_0x4de342){if(!_0x4de342){_0x5c68ee[_0x6c9a('0x26')](0x194);}return _0x4de342;};}function handleError(_0x2d8a58,_0x5826bb){_0x5826bb=_0x5826bb||0x1f4;return function(_0x47c674){logger[_0x6c9a('0x22')](_0x47c674[_0x6c9a('0x32')]);if(_0x47c674[_0x6c9a('0x33')]){delete _0x47c674[_0x6c9a('0x33')];}_0x2d8a58['status'](_0x5826bb)[_0x6c9a('0x34')](_0x47c674);};}exports[_0x6c9a('0x35')]=function(_0xbc7732,_0x1faedb){var _0x3aefe8={},_0x20095d={},_0x8c4716={'count':0x0,'rows':[]};var _0x29a39c=_[_0x6c9a('0x36')](db[_0x6c9a('0x37')][_0x6c9a('0x38')],function(_0xfaf811){return{'name':_0xfaf811[_0x6c9a('0x39')],'type':_0xfaf811[_0x6c9a('0x3a')][_0x6c9a('0x3b')]};});_0x20095d[_0x6c9a('0x3c')]=_[_0x6c9a('0x36')](_0x29a39c,'name');_0x20095d['query']=_[_0x6c9a('0x3d')](_0xbc7732[_0x6c9a('0x3e')]);_0x20095d[_0x6c9a('0x3f')]=_['intersection'](_0x20095d[_0x6c9a('0x3c')],_0x20095d[_0x6c9a('0x3e')]);_0x3aefe8[_0x6c9a('0x40')]=_[_0x6c9a('0x41')](_0x20095d[_0x6c9a('0x3c')],qs[_0x6c9a('0x42')](_0xbc7732['query'][_0x6c9a('0x42')]));_0x3aefe8[_0x6c9a('0x40')]=_0x3aefe8['attributes'][_0x6c9a('0x43')]?_0x3aefe8[_0x6c9a('0x40')]:_0x20095d['model'];if(!_0xbc7732['query'][_0x6c9a('0x44')](_0x6c9a('0x45'))){_0x3aefe8[_0x6c9a('0x2b')]=qs[_0x6c9a('0x2b')](_0xbc7732[_0x6c9a('0x3e')][_0x6c9a('0x2b')]);_0x3aefe8[_0x6c9a('0x2a')]=qs['offset'](_0xbc7732[_0x6c9a('0x3e')][_0x6c9a('0x2a')]);}_0x3aefe8[_0x6c9a('0x46')]=qs[_0x6c9a('0x47')](_0xbc7732[_0x6c9a('0x3e')]['sort']);_0x3aefe8[_0x6c9a('0x48')]=qs[_0x6c9a('0x3f')](_[_0x6c9a('0x49')](_0xbc7732['query'],_0x20095d['filters']),_0x29a39c);if(_0xbc7732[_0x6c9a('0x3e')][_0x6c9a('0x4a')]){_0x3aefe8[_0x6c9a('0x48')]=_[_0x6c9a('0x4b')](_0x3aefe8[_0x6c9a('0x48')],{'$or':_['map'](_0x29a39c,function(_0x2752e2){if(_0x2752e2[_0x6c9a('0x3a')]!==_0x6c9a('0x4c')){var _0x1fa05c={};_0x1fa05c[_0x2752e2[_0x6c9a('0x33')]]={'$like':'%'+_0xbc7732[_0x6c9a('0x3e')][_0x6c9a('0x4a')]+'%'};return _0x1fa05c;}})});}_0x3aefe8=_[_0x6c9a('0x4b')]({},_0x3aefe8,_0xbc7732[_0x6c9a('0x4d')]);var _0x1a5508={'where':_0x3aefe8[_0x6c9a('0x48')]};return db[_0x6c9a('0x37')][_0x6c9a('0x29')](_0x1a5508)[_0x6c9a('0x1d')](function(_0x33b87a){_0x8c4716[_0x6c9a('0x29')]=_0x33b87a;if(_0xbc7732[_0x6c9a('0x3e')][_0x6c9a('0x4e')]){_0x3aefe8[_0x6c9a('0x4f')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x6c9a('0x50')](_0x3aefe8);})['then'](function(_0x3622ff){_0x8c4716[_0x6c9a('0x51')]=_0x3622ff;return _0x8c4716;})[_0x6c9a('0x1d')](respondWithFilteredResult(_0x1faedb,_0x3aefe8))[_0x6c9a('0x52')](handleError(_0x1faedb,null));};exports[_0x6c9a('0x53')]=function(_0x16ba08,_0x34a824){var _0x75def9={'raw':![],'where':{'id':_0x16ba08[_0x6c9a('0x54')]['id']}},_0x335200={};_0x335200[_0x6c9a('0x3c')]=_[_0x6c9a('0x3d')](db[_0x6c9a('0x37')][_0x6c9a('0x38')]);_0x335200['query']=_[_0x6c9a('0x3d')](_0x16ba08[_0x6c9a('0x3e')]);_0x335200[_0x6c9a('0x3f')]=_['intersection'](_0x335200['model'],_0x335200[_0x6c9a('0x3e')]);_0x75def9[_0x6c9a('0x40')]=_[_0x6c9a('0x41')](_0x335200[_0x6c9a('0x3c')],qs[_0x6c9a('0x42')](_0x16ba08[_0x6c9a('0x3e')]['fields']));_0x75def9[_0x6c9a('0x40')]=_0x75def9['attributes'][_0x6c9a('0x43')]?_0x75def9[_0x6c9a('0x40')]:_0x335200[_0x6c9a('0x3c')];if(_0x16ba08[_0x6c9a('0x3e')][_0x6c9a('0x4e')]){_0x75def9[_0x6c9a('0x4f')]=[{'all':!![]}];}_0x75def9=_['merge']({},_0x75def9,_0x16ba08[_0x6c9a('0x4d')]);return db[_0x6c9a('0x37')][_0x6c9a('0x55')](_0x75def9)[_0x6c9a('0x1d')](handleEntityNotFound(_0x34a824,null))[_0x6c9a('0x1d')](respondWithResult(_0x34a824,null))['catch'](handleError(_0x34a824,null));};exports[_0x6c9a('0x56')]=function(_0x33f2fd,_0xe35e8b){return db['FreshsalesAccount'][_0x6c9a('0x56')](_0x33f2fd[_0x6c9a('0x57')],{})[_0x6c9a('0x1d')](respondWithResult(_0xe35e8b,0xc9))[_0x6c9a('0x52')](handleError(_0xe35e8b,null));};exports['update']=function(_0x2a4f20,_0x407a6d){if(_0x2a4f20[_0x6c9a('0x57')]['id']){delete _0x2a4f20[_0x6c9a('0x57')]['id'];}return db[_0x6c9a('0x37')]['find']({'where':{'id':_0x2a4f20['params']['id']}})['then'](handleEntityNotFound(_0x407a6d,null))['then'](saveUpdates(_0x2a4f20[_0x6c9a('0x57')],null))['then'](respondWithResult(_0x407a6d,null))[_0x6c9a('0x52')](handleError(_0x407a6d,null));};exports['destroy']=function(_0x372ea4,_0x1ec5b0){return db['FreshsalesAccount'][_0x6c9a('0x55')]({'where':{'id':_0x372ea4[_0x6c9a('0x54')]['id']}})[_0x6c9a('0x1d')](handleEntityNotFound(_0x1ec5b0,null))['then'](removeEntity(_0x1ec5b0,null))[_0x6c9a('0x52')](handleError(_0x1ec5b0,null));};exports[_0x6c9a('0x58')]=function(_0x208f2b,_0x484c7a,_0xc41915){var _0x36876c={};var _0x4e90e1={};var _0x5b5c8e;var _0x2482ff;return db[_0x6c9a('0x37')]['findOne']({'where':{'id':_0x208f2b[_0x6c9a('0x54')]['id']}})['then'](handleEntityNotFound(_0x484c7a,null))[_0x6c9a('0x1d')](function(_0x3f41df){if(_0x3f41df){_0x5b5c8e=_0x3f41df;_0x4e90e1[_0x6c9a('0x3c')]=_[_0x6c9a('0x3d')](db[_0x6c9a('0x59')][_0x6c9a('0x38')]);_0x4e90e1[_0x6c9a('0x3e')]=_[_0x6c9a('0x3d')](_0x208f2b[_0x6c9a('0x3e')]);_0x4e90e1['filters']=_[_0x6c9a('0x41')](_0x4e90e1[_0x6c9a('0x3c')],_0x4e90e1[_0x6c9a('0x3e')]);_0x36876c['attributes']=_[_0x6c9a('0x41')](_0x4e90e1[_0x6c9a('0x3c')],qs[_0x6c9a('0x42')](_0x208f2b[_0x6c9a('0x3e')][_0x6c9a('0x42')]));_0x36876c['attributes']=_0x36876c[_0x6c9a('0x40')][_0x6c9a('0x43')]?_0x36876c[_0x6c9a('0x40')]:_0x4e90e1['model'];_0x36876c[_0x6c9a('0x46')]=qs[_0x6c9a('0x47')](_0x208f2b[_0x6c9a('0x3e')][_0x6c9a('0x47')]);_0x36876c[_0x6c9a('0x48')]=qs['filters'](_['pick'](_0x208f2b[_0x6c9a('0x3e')],_0x4e90e1[_0x6c9a('0x3f')]));if(_0x208f2b[_0x6c9a('0x3e')][_0x6c9a('0x4a')]){_0x36876c[_0x6c9a('0x48')]=_[_0x6c9a('0x4b')](_0x36876c[_0x6c9a('0x48')],{'$or':_['map'](_0x36876c[_0x6c9a('0x40')],function(_0x4cfbd8){var _0x4e1638={};_0x4e1638[_0x4cfbd8]={'$like':'%'+_0x208f2b[_0x6c9a('0x3e')][_0x6c9a('0x4a')]+'%'};return _0x4e1638;})});}_0x36876c=_[_0x6c9a('0x4b')]({},_0x36876c,_0x208f2b[_0x6c9a('0x4d')]);return _0x5b5c8e['getConfigurations'](_0x36876c);}})['then'](function(_0x2c329d){if(_0x2c329d){_0x2482ff=_0x2c329d[_0x6c9a('0x43')];if(!_0x208f2b[_0x6c9a('0x3e')][_0x6c9a('0x44')](_0x6c9a('0x45'))){_0x36876c[_0x6c9a('0x2b')]=qs[_0x6c9a('0x2b')](_0x208f2b[_0x6c9a('0x3e')][_0x6c9a('0x2b')]);_0x36876c[_0x6c9a('0x2a')]=qs['offset'](_0x208f2b['query']['offset']);}return _0x5b5c8e['getConfigurations'](_0x36876c);}})['then'](function(_0x55f051){if(_0x55f051){return _0x55f051?{'count':_0x2482ff,'rows':_0x55f051}:null;}})[_0x6c9a('0x1d')](respondWithResult(_0x484c7a,null))[_0x6c9a('0x52')](handleError(_0x484c7a,null));};exports[_0x6c9a('0x5a')]=function(_0x4ee8b6,_0x5c5cb2,_0x6df05){if(_0x4ee8b6['body']['id']){delete _0x4ee8b6[_0x6c9a('0x57')]['id'];}return db['FreshsalesAccount'][_0x6c9a('0x5b')]({'where':{'id':_0x4ee8b6['params']['id']}})['then'](handleEntityNotFound(_0x5c5cb2,null))[_0x6c9a('0x1d')](function(_0xc03d9a){if(_0xc03d9a){_0x4ee8b6[_0x6c9a('0x57')][_0x6c9a('0x5c')]=_0xc03d9a['id'];_0x4ee8b6[_0x6c9a('0x57')][_0x6c9a('0x5d')]=integrations[_0x6c9a('0x5e')](_0x4ee8b6[_0x6c9a('0x57')][_0x6c9a('0x5f')],_0x4ee8b6[_0x6c9a('0x57')][_0x6c9a('0x3a')]);_0x4ee8b6[_0x6c9a('0x57')][_0x6c9a('0x60')]=integrations['getDescriptions'](_0x4ee8b6['body'][_0x6c9a('0x5f')],_0x4ee8b6['body'][_0x6c9a('0x3a')]);return db[_0x6c9a('0x59')][_0x6c9a('0x56')](_0x4ee8b6[_0x6c9a('0x57')],{'include':[{'model':db[_0x6c9a('0x61')],'as':_0x6c9a('0x5d')},{'model':db[_0x6c9a('0x61')],'as':_0x6c9a('0x60')}]});}return null;})[_0x6c9a('0x1d')](respondWithResult(_0x5c5cb2,null))[_0x6c9a('0x52')](handleError(_0x5c5cb2,null));};exports[_0x6c9a('0x62')]=function(_0x4b4f0f,_0x261415,_0xf58ba6){var _0x38f115='';var _0x1b6398='';return db['FreshsalesAccount'][_0x6c9a('0x5b')]({'where':{'id':_0x4b4f0f[_0x6c9a('0x54')]['id']},'attributes':['id',_0x6c9a('0x63'),_0x6c9a('0x64'),_0x6c9a('0x65')]})[_0x6c9a('0x1d')](handleEntityNotFound(_0x261415,null))[_0x6c9a('0x1d')](function(_0x172a8d){if(_0x172a8d){_0x1b6398=_0x172a8d['username'];_0x38f115=_0x172a8d[_0x6c9a('0x64')];var _0x33ac0b=_0x172a8d[_0x6c9a('0x64')][_0x6c9a('0x66')](-0x1);if(_0x33ac0b==='/'){_0x38f115=_0x38f115[_0x6c9a('0x67')](0x0,_0x38f115[_0x6c9a('0x68')](_0x33ac0b));}return rp({'method':'GET','uri':util['format'](_0x6c9a('0x69'),_0x38f115,_0x6c9a('0x6a')),'headers':{'Authorization':'Token\x20token='+_0x172a8d[_0x6c9a('0x65')]},'json':!![]});}})[_0x6c9a('0x1d')](function(_0x43e6ff){if(_0x43e6ff){var _0xa694fa=_0x43e6ff[_0x6c9a('0x6b')];var _0x5d4030=![];var _0x5da27b=null;for(_0x5da27b=0x0;_0x5da27b<_0xa694fa[_0x6c9a('0x43')];_0x5da27b++){if(_0xa694fa[_0x5da27b]['email']===_0x1b6398){_0x5d4030=!![];}}if(_0x5d4030){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x6c9a('0x6c')});}}})[_0x6c9a('0x1d')](respondWithResult(_0x261415,null))[_0x6c9a('0x52')](function(_0x3a4071){var _0x2545b8=_0x4b4f0f[_0x6c9a('0x3e')][_0x6c9a('0x6d')]?0x1f4:_0x3a4071['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x2545b8,JSON[_0x6c9a('0x21')](_0x3a4071));delete _0x3a4071['name'];if(_0x2545b8===0x191){_0x2545b8=0x190;}_0x261415['status'](_0x2545b8)['send'](_0x4b4f0f[_0x6c9a('0x3e')][_0x6c9a('0x6d')]?{'message':_0x6c9a('0x6e'),'statusCode':_0x3a4071[_0x6c9a('0x6f')]}:_0x3a4071);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 82f4d68..57691f1 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 _0x91a0=['define','FreshsalesAccount','int_freshsales_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x20ebb9,_0x3535bb){var _0x1ec31d=function(_0x3afad1){while(--_0x3afad1){_0x20ebb9['push'](_0x20ebb9['shift']());}};_0x1ec31d(++_0x3535bb);}(_0x91a0,0x1df));var _0x091a=function(_0xd3bdab,_0x5d784a){_0xd3bdab=_0xd3bdab-0x0;var _0x1c3178=_0x91a0[_0xd3bdab];return _0x1c3178;};'use strict';var _=require(_0x091a('0x0'));var util=require('util');var logger=require(_0x091a('0x1'))(_0x091a('0x2'));var moment=require(_0x091a('0x3'));var BPromise=require(_0x091a('0x4'));var rp=require(_0x091a('0x5'));var fs=require('fs');var path=require(_0x091a('0x6'));var rimraf=require(_0x091a('0x7'));var config=require(_0x091a('0x8'));var attributes=require(_0x091a('0x9'));var integrations=require(_0x091a('0xa'));module['exports']=function(_0x456e69,_0x49dadf){return _0x456e69[_0x091a('0xb')](_0x091a('0xc'),attributes,{'tableName':_0x091a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31f5=['./intFreshsalesAccount.attributes','exports','FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x31f5,0x1a4));var _0x531f=function(_0x560638,_0x55cb9c){_0x560638=_0x560638-0x0;var _0x23b648=_0x31f5[_0x560638];return _0x23b648;};'use strict';var _=require('lodash');var util=require(_0x531f('0x0'));var logger=require(_0x531f('0x1'))(_0x531f('0x2'));var moment=require(_0x531f('0x3'));var BPromise=require(_0x531f('0x4'));var rp=require(_0x531f('0x5'));var fs=require('fs');var path=require(_0x531f('0x6'));var rimraf=require(_0x531f('0x7'));var config=require(_0x531f('0x8'));var attributes=require(_0x531f('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x531f('0xa')]=function(_0x1d82f0,_0x7e634c){return _0x1d82f0['define'](_0x531f('0xb'),attributes,{'tableName':_0x531f('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 6a0acc0..55830dc 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 _0xc4d8=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FreshsalesAccount,\x20%s,\x20%s','result','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','attributes','limit','include','map','model','find','ShowFreshsalesAccount','lodash','moment','bluebird','../../mysqldb'];(function(_0xa3fadc,_0xd1e16){var _0x23ecb8=function(_0x2c71f7){while(--_0x2c71f7){_0xa3fadc['push'](_0xa3fadc['shift']());}};_0x23ecb8(++_0xd1e16);}(_0xc4d8,0xa6));var _0x8c4d=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xc4d8[_0x18cd5b];return _0x5eaa52;};'use strict';var _=require(_0x8c4d('0x0'));var util=require('util');var moment=require(_0x8c4d('0x1'));var BPromise=require(_0x8c4d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c4d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8c4d('0x4'));var config=require(_0x8c4d('0x5'));var jayson=require(_0x8c4d('0x6'));var client=jayson[_0x8c4d('0x7')][_0x8c4d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x15da54,_0x19ac49,_0x75b3d6){return new BPromise(function(_0x3369b8,_0x521b76){return client[_0x8c4d('0x9')](_0x15da54,_0x75b3d6)[_0x8c4d('0xa')](function(_0x36b577){logger[_0x8c4d('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0x19ac49,'request\x20sent');logger[_0x8c4d('0xc')](_0x8c4d('0xd'),_0x19ac49,_0x8c4d('0xe'),JSON[_0x8c4d('0xf')](_0x36b577));if(_0x36b577[_0x8c4d('0x10')]){if(_0x36b577[_0x8c4d('0x10')][_0x8c4d('0x11')]===0x1f4){logger[_0x8c4d('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x19ac49,_0x36b577[_0x8c4d('0x10')][_0x8c4d('0x12')]);return _0x521b76(_0x36b577[_0x8c4d('0x10')][_0x8c4d('0x12')]);}logger[_0x8c4d('0x10')](_0x8c4d('0x13'),_0x19ac49,_0x36b577[_0x8c4d('0x10')][_0x8c4d('0x12')]);return _0x3369b8(_0x36b577['error']['message']);}else{logger[_0x8c4d('0xb')](_0x8c4d('0x13'),_0x19ac49,'request\x20sent');_0x3369b8(_0x36b577[_0x8c4d('0x14')][_0x8c4d('0x12')]);}})[_0x8c4d('0x15')](function(_0x4d8ded){logger[_0x8c4d('0x10')](_0x8c4d('0x13'),_0x19ac49,_0x4d8ded);_0x521b76(_0x4d8ded);});});}exports[_0x8c4d('0x16')]=function(_0x3a9321){var _0x443030=this;return new Promise(function(_0x59cc48,_0xac6a64){return db[_0x8c4d('0x17')]['findAll']({'raw':_0x3a9321[_0x8c4d('0x18')]?_0x3a9321[_0x8c4d('0x18')][_0x8c4d('0x19')]===undefined?!![]:![]:!![],'where':_0x3a9321[_0x8c4d('0x18')]?_0x3a9321[_0x8c4d('0x18')][_0x8c4d('0x1a')]||null:null,'attributes':_0x3a9321[_0x8c4d('0x18')]?_0x3a9321[_0x8c4d('0x18')][_0x8c4d('0x1b')]||null:null,'limit':_0x3a9321['options']?_0x3a9321[_0x8c4d('0x18')][_0x8c4d('0x1c')]||null:null,'include':_0x3a9321[_0x8c4d('0x18')]?_0x3a9321[_0x8c4d('0x18')][_0x8c4d('0x1d')]?_[_0x8c4d('0x1e')](_0x3a9321['options'][_0x8c4d('0x1d')],function(_0x10ea9b){return{'model':db[_0x10ea9b['model']],'as':_0x10ea9b['as'],'attributes':_0x10ea9b[_0x8c4d('0x1b')],'include':_0x10ea9b['include']?_[_0x8c4d('0x1e')](_0x10ea9b['include'],function(_0x2a0d83){return{'model':db[_0x2a0d83[_0x8c4d('0x1f')]],'as':_0x2a0d83['as'],'attributes':_0x2a0d83[_0x8c4d('0x1b')],'include':_0x2a0d83[_0x8c4d('0x1d')]?_[_0x8c4d('0x1e')](_0x2a0d83[_0x8c4d('0x1d')],function(_0x33d5f1){return{'model':db[_0x33d5f1['model']],'as':_0x33d5f1['as'],'attributes':_0x33d5f1['attributes']};}):[]};}):[]};}):[]:[]})[_0x8c4d('0xa')](function(_0x13e772){logger[_0x8c4d('0xb')]('GetFreshsalesAccount',_0x3a9321);logger[_0x8c4d('0xc')](_0x8c4d('0x16'),_0x3a9321,JSON[_0x8c4d('0xf')](_0x13e772));_0x59cc48(_0x13e772);})['catch'](function(_0x22f944){logger[_0x8c4d('0x10')](_0x8c4d('0x16'),_0x22f944[_0x8c4d('0x12')],_0x3a9321);_0xac6a64(_0x443030[_0x8c4d('0x10')](0x1f4,_0x22f944[_0x8c4d('0x12')]));});});};exports['ShowFreshsalesAccount']=function(_0x45a417){var _0x36f9fe=this;return new Promise(function(_0x50a353,_0x47ea16){return db['FreshsalesAccount'][_0x8c4d('0x20')]({'raw':_0x45a417[_0x8c4d('0x18')]?_0x45a417[_0x8c4d('0x18')][_0x8c4d('0x19')]===undefined?!![]:![]:!![],'where':_0x45a417[_0x8c4d('0x18')]?_0x45a417['options']['where']||null:null,'attributes':_0x45a417['options']?_0x45a417[_0x8c4d('0x18')][_0x8c4d('0x1b')]||null:null,'include':_0x45a417[_0x8c4d('0x18')]?_0x45a417['options'][_0x8c4d('0x1d')]?_['map'](_0x45a417[_0x8c4d('0x18')][_0x8c4d('0x1d')],function(_0x1ae0c5){return{'model':db[_0x1ae0c5[_0x8c4d('0x1f')]],'as':_0x1ae0c5['as'],'attributes':_0x1ae0c5['attributes'],'include':_0x1ae0c5[_0x8c4d('0x1d')]?_[_0x8c4d('0x1e')](_0x1ae0c5[_0x8c4d('0x1d')],function(_0x2b4e38){return{'model':db[_0x2b4e38[_0x8c4d('0x1f')]],'as':_0x2b4e38['as'],'attributes':_0x2b4e38[_0x8c4d('0x1b')],'include':_0x2b4e38[_0x8c4d('0x1d')]?_[_0x8c4d('0x1e')](_0x2b4e38['include'],function(_0x2d0c68){return{'model':db[_0x2d0c68['model']],'as':_0x2d0c68['as'],'attributes':_0x2d0c68[_0x8c4d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8c4d('0xa')](function(_0x38ca7f){logger[_0x8c4d('0xb')](_0x8c4d('0x21'),_0x45a417);logger['debug'](_0x8c4d('0x21'),_0x45a417,JSON[_0x8c4d('0xf')](_0x38ca7f));_0x50a353(_0x38ca7f);})[_0x8c4d('0x15')](function(_0x3aab84){logger[_0x8c4d('0x10')](_0x8c4d('0x21'),_0x3aab84[_0x8c4d('0x12')],_0x45a417);_0x47ea16(_0x36f9fe[_0x8c4d('0x10')](0x1f4,_0x3aab84[_0x8c4d('0x12')]));});});}; \ No newline at end of file +var _0x0c8d=['randomstring','ioredis','../../config/environment','jayson/promise','client','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetFreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshsalesAccount','find','util','moment','bluebird'];(function(_0x19ad66,_0x432764){var _0x696309=function(_0x420019){while(--_0x420019){_0x19ad66['push'](_0x19ad66['shift']());}};_0x696309(++_0x432764);}(_0x0c8d,0x79));var _0xd0c8=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x0c8d[_0x29d94e];return _0x106237;};'use strict';var _=require('lodash');var util=require(_0xd0c8('0x0'));var moment=require(_0xd0c8('0x1'));var BPromise=require(_0xd0c8('0x2'));var rs=require(_0xd0c8('0x3'));var fs=require('fs');var Redis=require(_0xd0c8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd0c8('0x5'));var jayson=require(_0xd0c8('0x6'));var client=jayson[_0xd0c8('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16d1c1,_0x5f0027,_0x415439){return new BPromise(function(_0x34e3d5,_0x2f6200){return client[_0xd0c8('0x8')](_0x16d1c1,_0x415439)[_0xd0c8('0x9')](function(_0x5678f9){logger[_0xd0c8('0xa')](_0xd0c8('0xb'),_0x5f0027,_0xd0c8('0xc'));logger[_0xd0c8('0xd')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x5f0027,'request\x20sent',JSON[_0xd0c8('0xe')](_0x5678f9));if(_0x5678f9[_0xd0c8('0xf')]){if(_0x5678f9['error']['code']===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x5f0027,_0x5678f9['error'][_0xd0c8('0x10')]);return _0x2f6200(_0x5678f9[_0xd0c8('0xf')]['message']);}logger[_0xd0c8('0xf')](_0xd0c8('0xb'),_0x5f0027,_0x5678f9[_0xd0c8('0xf')][_0xd0c8('0x10')]);return _0x34e3d5(_0x5678f9[_0xd0c8('0xf')][_0xd0c8('0x10')]);}else{logger[_0xd0c8('0xa')](_0xd0c8('0xb'),_0x5f0027,_0xd0c8('0xc'));_0x34e3d5(_0x5678f9[_0xd0c8('0x11')][_0xd0c8('0x10')]);}})[_0xd0c8('0x12')](function(_0x58c3e0){logger[_0xd0c8('0xf')](_0xd0c8('0xb'),_0x5f0027,_0x58c3e0);_0x2f6200(_0x58c3e0);});});}exports[_0xd0c8('0x13')]=function(_0x5d02a5){var _0x59b06f=this;return new Promise(function(_0x32e360,_0x4bca93){return db['FreshsalesAccount'][_0xd0c8('0x14')]({'raw':_0x5d02a5[_0xd0c8('0x15')]?_0x5d02a5['options'][_0xd0c8('0x16')]===undefined?!![]:![]:!![],'where':_0x5d02a5[_0xd0c8('0x15')]?_0x5d02a5['options'][_0xd0c8('0x17')]||null:null,'attributes':_0x5d02a5[_0xd0c8('0x15')]?_0x5d02a5[_0xd0c8('0x15')][_0xd0c8('0x18')]||null:null,'limit':_0x5d02a5[_0xd0c8('0x15')]?_0x5d02a5[_0xd0c8('0x15')][_0xd0c8('0x19')]||null:null,'include':_0x5d02a5[_0xd0c8('0x15')]?_0x5d02a5[_0xd0c8('0x15')][_0xd0c8('0x1a')]?_[_0xd0c8('0x1b')](_0x5d02a5[_0xd0c8('0x15')][_0xd0c8('0x1a')],function(_0x4100d2){return{'model':db[_0x4100d2[_0xd0c8('0x1c')]],'as':_0x4100d2['as'],'attributes':_0x4100d2[_0xd0c8('0x18')],'include':_0x4100d2[_0xd0c8('0x1a')]?_[_0xd0c8('0x1b')](_0x4100d2[_0xd0c8('0x1a')],function(_0x5dde87){return{'model':db[_0x5dde87['model']],'as':_0x5dde87['as'],'attributes':_0x5dde87[_0xd0c8('0x18')],'include':_0x5dde87[_0xd0c8('0x1a')]?_[_0xd0c8('0x1b')](_0x5dde87[_0xd0c8('0x1a')],function(_0x1c84e5){return{'model':db[_0x1c84e5[_0xd0c8('0x1c')]],'as':_0x1c84e5['as'],'attributes':_0x1c84e5[_0xd0c8('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd0c8('0x9')](function(_0xdc380c){logger['info'](_0xd0c8('0x13'),_0x5d02a5);logger[_0xd0c8('0xd')](_0xd0c8('0x13'),_0x5d02a5,JSON['stringify'](_0xdc380c));_0x32e360(_0xdc380c);})['catch'](function(_0x4fa819){logger[_0xd0c8('0xf')]('GetFreshsalesAccount',_0x4fa819[_0xd0c8('0x10')],_0x5d02a5);_0x4bca93(_0x59b06f['error'](0x1f4,_0x4fa819[_0xd0c8('0x10')]));});});};exports[_0xd0c8('0x1d')]=function(_0x4abb89){var _0x30336a=this;return new Promise(function(_0x35f033,_0x3ee706){return db['FreshsalesAccount'][_0xd0c8('0x1e')]({'raw':_0x4abb89[_0xd0c8('0x15')]?_0x4abb89[_0xd0c8('0x15')][_0xd0c8('0x16')]===undefined?!![]:![]:!![],'where':_0x4abb89[_0xd0c8('0x15')]?_0x4abb89[_0xd0c8('0x15')][_0xd0c8('0x17')]||null:null,'attributes':_0x4abb89[_0xd0c8('0x15')]?_0x4abb89[_0xd0c8('0x15')][_0xd0c8('0x18')]||null:null,'include':_0x4abb89['options']?_0x4abb89['options']['include']?_[_0xd0c8('0x1b')](_0x4abb89['options'][_0xd0c8('0x1a')],function(_0x54d8cf){return{'model':db[_0x54d8cf[_0xd0c8('0x1c')]],'as':_0x54d8cf['as'],'attributes':_0x54d8cf[_0xd0c8('0x18')],'include':_0x54d8cf[_0xd0c8('0x1a')]?_[_0xd0c8('0x1b')](_0x54d8cf[_0xd0c8('0x1a')],function(_0x2e94a6){return{'model':db[_0x2e94a6[_0xd0c8('0x1c')]],'as':_0x2e94a6['as'],'attributes':_0x2e94a6['attributes'],'include':_0x2e94a6[_0xd0c8('0x1a')]?_[_0xd0c8('0x1b')](_0x2e94a6['include'],function(_0x2ac901){return{'model':db[_0x2ac901[_0xd0c8('0x1c')]],'as':_0x2ac901['as'],'attributes':_0x2ac901[_0xd0c8('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd0c8('0x9')](function(_0x3916d2){logger[_0xd0c8('0xa')]('ShowFreshsalesAccount',_0x4abb89);logger[_0xd0c8('0xd')](_0xd0c8('0x1d'),_0x4abb89,JSON[_0xd0c8('0xe')](_0x3916d2));_0x35f033(_0x3916d2);})[_0xd0c8('0x12')](function(_0x109ebc){logger[_0xd0c8('0xf')](_0xd0c8('0x1d'),_0x109ebc['message'],_0x4abb89);_0x3ee706(_0x30336a[_0xd0c8('0xf')](0x1f4,_0x109ebc[_0xd0c8('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 95f8491..93b837d 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 _0x9a43=['/:id/subjects','getSubjects','/:id/descriptions','post','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./intFreshsalesConfiguration.controller','get','index','isAuthenticated','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a43,0x15a));var _0x39a4=function(_0x2ceedb,_0x3d4af3){_0x2ceedb=_0x2ceedb-0x0;var _0x1eef5c=_0x9a43[_0x2ceedb];return _0x1eef5c;};'use strict';var multer=require('multer');var util=require(_0x39a4('0x0'));var path=require(_0x39a4('0x1'));var timeout=require(_0x39a4('0x2'));var express=require(_0x39a4('0x3'));var router=express[_0x39a4('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x39a4('0x5'));var controller=require(_0x39a4('0x6'));router[_0x39a4('0x7')]('/',auth['isAuthenticated'](),controller[_0x39a4('0x8')]);router[_0x39a4('0x7')]('/:id',auth[_0x39a4('0x9')](),controller[_0x39a4('0xa')]);router[_0x39a4('0x7')](_0x39a4('0xb'),auth[_0x39a4('0x9')](),controller[_0x39a4('0xc')]);router[_0x39a4('0x7')](_0x39a4('0xd'),auth[_0x39a4('0x9')](),controller['getDescriptions']);router[_0x39a4('0x7')]('/:id/fields',auth[_0x39a4('0x9')](),controller['getFields']);router[_0x39a4('0xe')]('/',auth[_0x39a4('0x9')](),controller[_0x39a4('0xf')]);router['put'](_0x39a4('0x10'),auth['isAuthenticated'](),controller[_0x39a4('0x11')]);router[_0x39a4('0x12')](_0x39a4('0x10'),auth[_0x39a4('0x9')](),controller[_0x39a4('0x13')]);module[_0x39a4('0x14')]=router; \ No newline at end of file +var _0x7914=['../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x46ca42,_0x493798){var _0x36ffd8=function(_0x5eba6f){while(--_0x5eba6f){_0x46ca42['push'](_0x46ca42['shift']());}};_0x36ffd8(++_0x493798);}(_0x7914,0x107));var _0x4791=function(_0x1522b7,_0x490c09){_0x1522b7=_0x1522b7-0x0;var _0x41b57f=_0x7914[_0x1522b7];return _0x41b57f;};'use strict';var multer=require(_0x4791('0x0'));var util=require(_0x4791('0x1'));var path=require('path');var timeout=require(_0x4791('0x2'));var express=require(_0x4791('0x3'));var router=express[_0x4791('0x4')]();var fs_extra=require(_0x4791('0x5'));var auth=require(_0x4791('0x6'));var interaction=require(_0x4791('0x7'));var config=require(_0x4791('0x8'));var controller=require(_0x4791('0x9'));router[_0x4791('0xa')]('/',auth[_0x4791('0xb')](),controller['index']);router[_0x4791('0xa')]('/:id',auth[_0x4791('0xb')](),controller[_0x4791('0xc')]);router[_0x4791('0xa')](_0x4791('0xd'),auth[_0x4791('0xb')](),controller[_0x4791('0xe')]);router[_0x4791('0xa')](_0x4791('0xf'),auth['isAuthenticated'](),controller[_0x4791('0x10')]);router[_0x4791('0xa')](_0x4791('0x11'),auth[_0x4791('0xb')](),controller[_0x4791('0x12')]);router[_0x4791('0x13')]('/',auth['isAuthenticated'](),controller[_0x4791('0x14')]);router[_0x4791('0x15')]('/:id',auth[_0x4791('0xb')](),controller[_0x4791('0x16')]);router[_0x4791('0x17')](_0x4791('0x18'),auth[_0x4791('0xb')](),controller[_0x4791('0x19')]);module[_0x4791('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index f2b90c4..f811af9 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 _0x4670=['sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4670,0x7e));var _0x0467=function(_0x5e8acf,_0x1fe426){_0x5e8acf=_0x5e8acf-0x0;var _0xd7de81=_0x4670[_0x5e8acf];return _0xd7de81;};'use strict';var Sequelize=require(_0x0467('0x0'));module[_0x0467('0x1')]={'name':{'type':Sequelize[_0x0467('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8c57=['exports','sequelize'];(function(_0x2d643c,_0x5b9204){var _0x17d037=function(_0xf7194b){while(--_0xf7194b){_0x2d643c['push'](_0x2d643c['shift']());}};_0x17d037(++_0x5b9204);}(_0x8c57,0xe9));var _0x78c5=function(_0x29793d,_0x201df4){_0x29793d=_0x29793d-0x0;var _0x1e6ecb=_0x8c57[_0x29793d];return _0x1e6ecb;};'use strict';var Sequelize=require(_0x78c5('0x0'));module[_0x78c5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 8543086..7538e92 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 _0x5f2f=['merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','getSubjects','findOne','keys','FreshsalesField','length','getDescriptions','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','sendStatus','stack','name','index','FreshsalesConfiguration','rawAttributes','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where'];(function(_0x262eb8,_0x574c0b){var _0x30179c=function(_0x6db3a7){while(--_0x6db3a7){_0x262eb8['push'](_0x262eb8['shift']());}};_0x30179c(++_0x574c0b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x179477,_0x88be93){_0x179477=_0x179477-0x0;var _0x5d765c=_0x5f2f[_0x179477];return _0x5d765c;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xc'));var _=require(_0xf5f2('0xd'));var squel=require('squel');var crypto=require(_0xf5f2('0xe'));var jsforce=require(_0xf5f2('0xf'));var deskjs=require(_0xf5f2('0x10'));var toCsv=require('to-csv');var querystring=require(_0xf5f2('0x11'));var Papa=require(_0xf5f2('0x12'));var Redis=require(_0xf5f2('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xf5f2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf5f2('0x15'))(_0xf5f2('0x16'));var utils=require('../../config/utils');var config=require(_0xf5f2('0x17'));var licenseUtil=require(_0xf5f2('0x18'));var db=require(_0xf5f2('0x19'))['db'];var jayson=require(_0xf5f2('0x1a'));var client=jayson[_0xf5f2('0x1b')][_0xf5f2('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5c01b8,_0x5850f4,_0xea612c,_0x269909){return new BPromise(function(_0x1c1a5c,_0x422b55){var _0x4d97fc=_0x269909||client;return _0x4d97fc[_0xf5f2('0x1d')](_0x5c01b8,_0xea612c)[_0xf5f2('0x1e')](function(_0x17d656){logger[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x5850f4,_0xf5f2('0x21'));logger[_0xf5f2('0x22')](_0xf5f2('0x23'),_0x5850f4,_0xf5f2('0x21'),JSON[_0xf5f2('0x24')](_0x17d656));if(_0x17d656[_0xf5f2('0x25')]){if(_0x17d656[_0xf5f2('0x25')][_0xf5f2('0x26')]===0x1f4){logger[_0xf5f2('0x25')](_0xf5f2('0x20'),_0x5850f4,_0x17d656[_0xf5f2('0x25')][_0xf5f2('0x27')]);return _0x422b55(_0x17d656['error'][_0xf5f2('0x27')]);}logger[_0xf5f2('0x25')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5850f4,_0x17d656['error'][_0xf5f2('0x27')]);return _0x1c1a5c(_0x17d656[_0xf5f2('0x25')]['message']);}else{logger[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x5850f4,_0xf5f2('0x21'));_0x1c1a5c(_0x17d656[_0xf5f2('0x28')][_0xf5f2('0x27')]);}})['catch'](function(_0x21cd91){logger[_0xf5f2('0x25')](_0xf5f2('0x20'),_0x5850f4,_0x21cd91);_0x422b55(_0x21cd91);});});}function respondWithStatusCode(_0x2833fe,_0x287ad5){_0x287ad5=_0x287ad5||0xcc;return function(_0x5bdf4a){if(_0x5bdf4a){return _0x2833fe['sendStatus'](_0x287ad5);}return _0x2833fe[_0xf5f2('0x29')](_0x287ad5)[_0xf5f2('0x2a')]();};}function respondWithResult(_0x13da6f,_0x1a5bb3){_0x1a5bb3=_0x1a5bb3||0xc8;return function(_0xf6c58d){if(_0xf6c58d){return _0x13da6f[_0xf5f2('0x29')](_0x1a5bb3)[_0xf5f2('0x2b')](_0xf6c58d);}};}function respondWithFilteredResult(_0x281ec8,_0x294414){return function(_0x4ab014){if(_0x4ab014){var _0xaa2602=_0x4ab014[_0xf5f2('0x2c')],_0x102449=_0x294414[_0xf5f2('0x2d')],_0x375ca8=_0x294414['offset']+_0x294414['limit'],_0x31bfcb;if(_0x375ca8>=_0xaa2602){_0x375ca8=_0xaa2602;_0x31bfcb=0xc8;}else{_0x31bfcb=0xce;}_0x281ec8[_0xf5f2('0x29')](_0x31bfcb);return _0x281ec8[_0xf5f2('0x2e')](_0xf5f2('0x2f'),_0x102449+'-'+_0x375ca8+'/'+_0xaa2602)['json'](_0x4ab014);}return null;};}function patchUpdates(_0x5a2c7e){return function(_0x29571b){try{jsonpatch[_0xf5f2('0x30')](_0x29571b,_0x5a2c7e,!![]);}catch(_0x17394a){return BPromise[_0xf5f2('0x31')](_0x17394a);}return _0x29571b[_0xf5f2('0x32')]();};}function saveUpdates(_0x54c0c8,_0x52e959){return function(_0x2f4778){if(_0x2f4778){return _0x2f4778['update'](_0x54c0c8)[_0xf5f2('0x1e')](function(_0x58a4df){return _0x58a4df;});}return null;};}function removeEntity(_0x45b643,_0x31087c){return function(_0x7b6817){if(_0x7b6817){return _0x7b6817[_0xf5f2('0x33')]()[_0xf5f2('0x1e')](function(){_0x45b643[_0xf5f2('0x29')](0xcc)[_0xf5f2('0x2a')]();});}};}function handleEntityNotFound(_0x2c0e05,_0x5ca917){return function(_0x4149e6){if(!_0x4149e6){_0x2c0e05[_0xf5f2('0x34')](0x194);}return _0x4149e6;};}function handleError(_0x4590ec,_0x43c77d){_0x43c77d=_0x43c77d||0x1f4;return function(_0x1408b9){logger[_0xf5f2('0x25')](_0x1408b9[_0xf5f2('0x35')]);if(_0x1408b9['name']){delete _0x1408b9[_0xf5f2('0x36')];}_0x4590ec[_0xf5f2('0x29')](_0x43c77d)['send'](_0x1408b9);};}exports[_0xf5f2('0x37')]=function(_0x4b8c42,_0x18ae07){var _0x3930fb={},_0x2a2c31={},_0x2e3cca={'count':0x0,'rows':[]};var _0x59a6dd=_['map'](db[_0xf5f2('0x38')][_0xf5f2('0x39')],function(_0x20eb74){return{'name':_0x20eb74['fieldName'],'type':_0x20eb74[_0xf5f2('0x3a')]['key']};});_0x2a2c31[_0xf5f2('0x3b')]=_['map'](_0x59a6dd,_0xf5f2('0x36'));_0x2a2c31[_0xf5f2('0x3c')]=_['keys'](_0x4b8c42[_0xf5f2('0x3c')]);_0x2a2c31[_0xf5f2('0x3d')]=_[_0xf5f2('0x3e')](_0x2a2c31[_0xf5f2('0x3b')],_0x2a2c31['query']);_0x3930fb['attributes']=_[_0xf5f2('0x3e')](_0x2a2c31[_0xf5f2('0x3b')],qs[_0xf5f2('0x3f')](_0x4b8c42[_0xf5f2('0x3c')][_0xf5f2('0x3f')]));_0x3930fb[_0xf5f2('0x40')]=_0x3930fb[_0xf5f2('0x40')]['length']?_0x3930fb[_0xf5f2('0x40')]:_0x2a2c31[_0xf5f2('0x3b')];if(!_0x4b8c42['query'][_0xf5f2('0x41')](_0xf5f2('0x42'))){_0x3930fb[_0xf5f2('0x43')]=qs[_0xf5f2('0x43')](_0x4b8c42[_0xf5f2('0x3c')][_0xf5f2('0x43')]);_0x3930fb[_0xf5f2('0x2d')]=qs[_0xf5f2('0x2d')](_0x4b8c42['query'][_0xf5f2('0x2d')]);}_0x3930fb[_0xf5f2('0x44')]=qs[_0xf5f2('0x45')](_0x4b8c42['query']['sort']);_0x3930fb['where']=qs[_0xf5f2('0x3d')](_[_0xf5f2('0x46')](_0x4b8c42['query'],_0x2a2c31[_0xf5f2('0x3d')]),_0x59a6dd);if(_0x4b8c42[_0xf5f2('0x3c')][_0xf5f2('0x47')]){_0x3930fb[_0xf5f2('0x48')]=_[_0xf5f2('0x49')](_0x3930fb[_0xf5f2('0x48')],{'$or':_[_0xf5f2('0x4a')](_0x59a6dd,function(_0x212e90){if(_0x212e90[_0xf5f2('0x3a')]!==_0xf5f2('0x4b')){var _0x444317={};_0x444317[_0x212e90[_0xf5f2('0x36')]]={'$like':'%'+_0x4b8c42[_0xf5f2('0x3c')][_0xf5f2('0x47')]+'%'};return _0x444317;}})});}_0x3930fb=_['merge']({},_0x3930fb,_0x4b8c42[_0xf5f2('0x4c')]);var _0x578c93={'where':_0x3930fb[_0xf5f2('0x48')]};return db[_0xf5f2('0x38')][_0xf5f2('0x2c')](_0x578c93)[_0xf5f2('0x1e')](function(_0x31bf0e){_0x2e3cca[_0xf5f2('0x2c')]=_0x31bf0e;if(_0x4b8c42['query'][_0xf5f2('0x4d')]){_0x3930fb[_0xf5f2('0x4e')]=[{'all':!![]}];}return db[_0xf5f2('0x38')][_0xf5f2('0x4f')](_0x3930fb);})[_0xf5f2('0x1e')](function(_0x10753a){_0x2e3cca[_0xf5f2('0x50')]=_0x10753a;return _0x2e3cca;})[_0xf5f2('0x1e')](respondWithFilteredResult(_0x18ae07,_0x3930fb))['catch'](handleError(_0x18ae07,null));};exports[_0xf5f2('0x51')]=function(_0x33ec29,_0x45db9a){var _0x492eea={'raw':![],'where':{'id':_0x33ec29[_0xf5f2('0x52')]['id']}},_0x1177ba={};_0x1177ba[_0xf5f2('0x3b')]=_['keys'](db['FreshsalesConfiguration'][_0xf5f2('0x39')]);_0x1177ba[_0xf5f2('0x3c')]=_['keys'](_0x33ec29[_0xf5f2('0x3c')]);_0x1177ba['filters']=_[_0xf5f2('0x3e')](_0x1177ba['model'],_0x1177ba[_0xf5f2('0x3c')]);_0x492eea['attributes']=_[_0xf5f2('0x3e')](_0x1177ba[_0xf5f2('0x3b')],qs[_0xf5f2('0x3f')](_0x33ec29[_0xf5f2('0x3c')]['fields']));_0x492eea[_0xf5f2('0x40')]=_0x492eea[_0xf5f2('0x40')]['length']?_0x492eea['attributes']:_0x1177ba[_0xf5f2('0x3b')];if(_0x33ec29[_0xf5f2('0x3c')]['includeAll']){_0x492eea[_0xf5f2('0x4e')]=[{'all':!![]}];}_0x492eea=_[_0xf5f2('0x49')]({},_0x492eea,_0x33ec29[_0xf5f2('0x4c')]);return db[_0xf5f2('0x38')]['find'](_0x492eea)['then'](handleEntityNotFound(_0x45db9a,null))[_0xf5f2('0x1e')](respondWithResult(_0x45db9a,null))[_0xf5f2('0x53')](handleError(_0x45db9a,null));};exports['create']=function(_0x40eef,_0x43fc49){return db[_0xf5f2('0x38')][_0xf5f2('0x54')](_0x40eef[_0xf5f2('0x55')],{})[_0xf5f2('0x1e')](respondWithResult(_0x43fc49,0xc9))[_0xf5f2('0x53')](handleError(_0x43fc49,null));};exports['update']=function(_0x59e8ef,_0x330730){if(_0x59e8ef[_0xf5f2('0x55')]['id']){delete _0x59e8ef[_0xf5f2('0x55')]['id'];}return db[_0xf5f2('0x38')][_0xf5f2('0x56')]({'where':{'id':_0x59e8ef['params']['id']}})[_0xf5f2('0x1e')](handleEntityNotFound(_0x330730,null))[_0xf5f2('0x1e')](saveUpdates(_0x59e8ef[_0xf5f2('0x55')],null))['then'](respondWithResult(_0x330730,null))[_0xf5f2('0x53')](handleError(_0x330730,null));};exports['destroy']=function(_0x78f1d2,_0x1a8d33){return db[_0xf5f2('0x38')][_0xf5f2('0x56')]({'where':{'id':_0x78f1d2['params']['id']}})['then'](handleEntityNotFound(_0x1a8d33,null))[_0xf5f2('0x1e')](removeEntity(_0x1a8d33,null))['catch'](handleError(_0x1a8d33,null));};exports[_0xf5f2('0x57')]=function(_0x1f1916,_0x572ec1,_0x3f0579){var _0xa4c0be={};var _0x2a8f6d={};var _0x51ef09;var _0x397b99;return db[_0xf5f2('0x38')][_0xf5f2('0x58')]({'where':{'id':_0x1f1916[_0xf5f2('0x52')]['id']}})['then'](handleEntityNotFound(_0x572ec1,null))[_0xf5f2('0x1e')](function(_0x506fe5){if(_0x506fe5){_0x51ef09=_0x506fe5;_0x2a8f6d[_0xf5f2('0x3b')]=_[_0xf5f2('0x59')](db[_0xf5f2('0x5a')][_0xf5f2('0x39')]);_0x2a8f6d[_0xf5f2('0x3c')]=_['keys'](_0x1f1916[_0xf5f2('0x3c')]);_0x2a8f6d[_0xf5f2('0x3d')]=_[_0xf5f2('0x3e')](_0x2a8f6d[_0xf5f2('0x3b')],_0x2a8f6d[_0xf5f2('0x3c')]);_0xa4c0be['attributes']=_[_0xf5f2('0x3e')](_0x2a8f6d['model'],qs['fields'](_0x1f1916[_0xf5f2('0x3c')]['fields']));_0xa4c0be[_0xf5f2('0x40')]=_0xa4c0be[_0xf5f2('0x40')][_0xf5f2('0x5b')]?_0xa4c0be[_0xf5f2('0x40')]:_0x2a8f6d['model'];_0xa4c0be[_0xf5f2('0x44')]=qs[_0xf5f2('0x45')](_0x1f1916[_0xf5f2('0x3c')][_0xf5f2('0x45')]);_0xa4c0be[_0xf5f2('0x48')]=qs[_0xf5f2('0x3d')](_[_0xf5f2('0x46')](_0x1f1916['query'],_0x2a8f6d[_0xf5f2('0x3d')]));if(_0x1f1916[_0xf5f2('0x3c')][_0xf5f2('0x47')]){_0xa4c0be[_0xf5f2('0x48')]=_['merge'](_0xa4c0be[_0xf5f2('0x48')],{'$or':_['map'](_0xa4c0be[_0xf5f2('0x40')],function(_0x1c7f06){var _0x5588cf={};_0x5588cf[_0x1c7f06]={'$like':'%'+_0x1f1916[_0xf5f2('0x3c')][_0xf5f2('0x47')]+'%'};return _0x5588cf;})});}_0xa4c0be=_[_0xf5f2('0x49')]({},_0xa4c0be,_0x1f1916[_0xf5f2('0x4c')]);return _0x51ef09[_0xf5f2('0x57')](_0xa4c0be);}})['then'](function(_0x3e821c){if(_0x3e821c){_0x397b99=_0x3e821c[_0xf5f2('0x5b')];if(!_0x1f1916[_0xf5f2('0x3c')][_0xf5f2('0x41')](_0xf5f2('0x42'))){_0xa4c0be[_0xf5f2('0x43')]=qs['limit'](_0x1f1916[_0xf5f2('0x3c')][_0xf5f2('0x43')]);_0xa4c0be['offset']=qs[_0xf5f2('0x2d')](_0x1f1916[_0xf5f2('0x3c')][_0xf5f2('0x2d')]);}return _0x51ef09['getSubjects'](_0xa4c0be);}})['then'](function(_0x4f3df6){if(_0x4f3df6){return _0x4f3df6?{'count':_0x397b99,'rows':_0x4f3df6}:null;}})[_0xf5f2('0x1e')](respondWithResult(_0x572ec1,null))[_0xf5f2('0x53')](handleError(_0x572ec1,null));};exports[_0xf5f2('0x5c')]=function(_0x450691,_0x55da4d,_0x4d878e){var _0x278b76={};var _0x3a98b4={};var _0xc10cf3;var _0xe8a9b7;return db[_0xf5f2('0x38')][_0xf5f2('0x58')]({'where':{'id':_0x450691[_0xf5f2('0x52')]['id']}})[_0xf5f2('0x1e')](handleEntityNotFound(_0x55da4d,null))[_0xf5f2('0x1e')](function(_0x1f35ef){if(_0x1f35ef){_0xc10cf3=_0x1f35ef;_0x3a98b4[_0xf5f2('0x3b')]=_['keys'](db['FreshsalesField']['rawAttributes']);_0x3a98b4[_0xf5f2('0x3c')]=_[_0xf5f2('0x59')](_0x450691[_0xf5f2('0x3c')]);_0x3a98b4[_0xf5f2('0x3d')]=_[_0xf5f2('0x3e')](_0x3a98b4['model'],_0x3a98b4[_0xf5f2('0x3c')]);_0x278b76[_0xf5f2('0x40')]=_[_0xf5f2('0x3e')](_0x3a98b4[_0xf5f2('0x3b')],qs[_0xf5f2('0x3f')](_0x450691['query'][_0xf5f2('0x3f')]));_0x278b76[_0xf5f2('0x40')]=_0x278b76['attributes'][_0xf5f2('0x5b')]?_0x278b76[_0xf5f2('0x40')]:_0x3a98b4[_0xf5f2('0x3b')];_0x278b76[_0xf5f2('0x44')]=qs['sort'](_0x450691[_0xf5f2('0x3c')][_0xf5f2('0x45')]);_0x278b76[_0xf5f2('0x48')]=qs[_0xf5f2('0x3d')](_[_0xf5f2('0x46')](_0x450691['query'],_0x3a98b4['filters']));if(_0x450691[_0xf5f2('0x3c')][_0xf5f2('0x47')]){_0x278b76[_0xf5f2('0x48')]=_[_0xf5f2('0x49')](_0x278b76['where'],{'$or':_['map'](_0x278b76[_0xf5f2('0x40')],function(_0x4f2fcc){var _0x4c4420={};_0x4c4420[_0x4f2fcc]={'$like':'%'+_0x450691['query']['filter']+'%'};return _0x4c4420;})});}_0x278b76=_[_0xf5f2('0x49')]({},_0x278b76,_0x450691[_0xf5f2('0x4c')]);return _0xc10cf3[_0xf5f2('0x5c')](_0x278b76);}})[_0xf5f2('0x1e')](function(_0x3de508){if(_0x3de508){_0xe8a9b7=_0x3de508[_0xf5f2('0x5b')];if(!_0x450691[_0xf5f2('0x3c')][_0xf5f2('0x41')](_0xf5f2('0x42'))){_0x278b76[_0xf5f2('0x43')]=qs[_0xf5f2('0x43')](_0x450691[_0xf5f2('0x3c')][_0xf5f2('0x43')]);_0x278b76[_0xf5f2('0x2d')]=qs[_0xf5f2('0x2d')](_0x450691[_0xf5f2('0x3c')][_0xf5f2('0x2d')]);}return _0xc10cf3[_0xf5f2('0x5c')](_0x278b76);}})['then'](function(_0xe7ac8){if(_0xe7ac8){return _0xe7ac8?{'count':_0xe8a9b7,'rows':_0xe7ac8}:null;}})[_0xf5f2('0x1e')](respondWithResult(_0x55da4d,null))[_0xf5f2('0x53')](handleError(_0x55da4d,null));};exports[_0xf5f2('0x5d')]=function(_0x18c353,_0x308220,_0x16491c){var _0xcf48eb={};var _0x5bf8fe={};var _0x38675d;var _0x57b50f;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x18c353['params']['id']}})['then'](handleEntityNotFound(_0x308220,null))['then'](function(_0x161890){if(_0x161890){_0x38675d=_0x161890;_0x5bf8fe[_0xf5f2('0x3b')]=_[_0xf5f2('0x59')](db[_0xf5f2('0x5a')][_0xf5f2('0x39')]);_0x5bf8fe[_0xf5f2('0x3c')]=_['keys'](_0x18c353['query']);_0x5bf8fe[_0xf5f2('0x3d')]=_['intersection'](_0x5bf8fe[_0xf5f2('0x3b')],_0x5bf8fe[_0xf5f2('0x3c')]);_0xcf48eb['attributes']=_['intersection'](_0x5bf8fe[_0xf5f2('0x3b')],qs[_0xf5f2('0x3f')](_0x18c353['query'][_0xf5f2('0x3f')]));_0xcf48eb[_0xf5f2('0x40')]=_0xcf48eb['attributes'][_0xf5f2('0x5b')]?_0xcf48eb[_0xf5f2('0x40')]:_0x5bf8fe[_0xf5f2('0x3b')];_0xcf48eb['order']=qs[_0xf5f2('0x45')](_0x18c353[_0xf5f2('0x3c')][_0xf5f2('0x45')]);_0xcf48eb[_0xf5f2('0x48')]=qs[_0xf5f2('0x3d')](_[_0xf5f2('0x46')](_0x18c353[_0xf5f2('0x3c')],_0x5bf8fe[_0xf5f2('0x3d')]));if(_0x18c353[_0xf5f2('0x3c')][_0xf5f2('0x47')]){_0xcf48eb[_0xf5f2('0x48')]=_[_0xf5f2('0x49')](_0xcf48eb[_0xf5f2('0x48')],{'$or':_[_0xf5f2('0x4a')](_0xcf48eb[_0xf5f2('0x40')],function(_0x28b9cd){var _0x1902c6={};_0x1902c6[_0x28b9cd]={'$like':'%'+_0x18c353[_0xf5f2('0x3c')][_0xf5f2('0x47')]+'%'};return _0x1902c6;})});}_0xcf48eb=_[_0xf5f2('0x49')]({},_0xcf48eb,_0x18c353[_0xf5f2('0x4c')]);return _0x38675d['getFields'](_0xcf48eb);}})[_0xf5f2('0x1e')](function(_0x33c864){if(_0x33c864){_0x57b50f=_0x33c864['length'];if(!_0x18c353[_0xf5f2('0x3c')][_0xf5f2('0x41')]('nolimit')){_0xcf48eb[_0xf5f2('0x43')]=qs[_0xf5f2('0x43')](_0x18c353[_0xf5f2('0x3c')]['limit']);_0xcf48eb['offset']=qs[_0xf5f2('0x2d')](_0x18c353[_0xf5f2('0x3c')][_0xf5f2('0x2d')]);}return _0x38675d['getFields'](_0xcf48eb);}})['then'](function(_0x2572c0){if(_0x2572c0){return _0x2572c0?{'count':_0x57b50f,'rows':_0x2572c0}:null;}})[_0xf5f2('0x1e')](respondWithResult(_0x308220,null))[_0xf5f2('0x53')](handleError(_0x308220,null));}; \ No newline at end of file +var _0x5f2f=['merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','getSubjects','findOne','keys','FreshsalesField','length','getDescriptions','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','sendStatus','stack','name','index','FreshsalesConfiguration','rawAttributes','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where'];(function(_0x271c34,_0x266fa2){var _0x3d60d1=function(_0x3e6781){while(--_0x3e6781){_0x271c34['push'](_0x271c34['shift']());}};_0x3d60d1(++_0x266fa2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1d0e11,_0x3c0d89){_0x1d0e11=_0x1d0e11-0x0;var _0x511d6e=_0x5f2f[_0x1d0e11];return _0x511d6e;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xc'));var _=require(_0xf5f2('0xd'));var squel=require('squel');var crypto=require(_0xf5f2('0xe'));var jsforce=require(_0xf5f2('0xf'));var deskjs=require(_0xf5f2('0x10'));var toCsv=require('to-csv');var querystring=require(_0xf5f2('0x11'));var Papa=require(_0xf5f2('0x12'));var Redis=require(_0xf5f2('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xf5f2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf5f2('0x15'))(_0xf5f2('0x16'));var utils=require('../../config/utils');var config=require(_0xf5f2('0x17'));var licenseUtil=require(_0xf5f2('0x18'));var db=require(_0xf5f2('0x19'))['db'];var jayson=require(_0xf5f2('0x1a'));var client=jayson[_0xf5f2('0x1b')][_0xf5f2('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5c01b8,_0x5850f4,_0xea612c,_0x269909){return new BPromise(function(_0x1c1a5c,_0x422b55){var _0x4d97fc=_0x269909||client;return _0x4d97fc[_0xf5f2('0x1d')](_0x5c01b8,_0xea612c)[_0xf5f2('0x1e')](function(_0x17d656){logger[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x5850f4,_0xf5f2('0x21'));logger[_0xf5f2('0x22')](_0xf5f2('0x23'),_0x5850f4,_0xf5f2('0x21'),JSON[_0xf5f2('0x24')](_0x17d656));if(_0x17d656[_0xf5f2('0x25')]){if(_0x17d656[_0xf5f2('0x25')][_0xf5f2('0x26')]===0x1f4){logger[_0xf5f2('0x25')](_0xf5f2('0x20'),_0x5850f4,_0x17d656[_0xf5f2('0x25')][_0xf5f2('0x27')]);return _0x422b55(_0x17d656['error'][_0xf5f2('0x27')]);}logger[_0xf5f2('0x25')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5850f4,_0x17d656['error'][_0xf5f2('0x27')]);return _0x1c1a5c(_0x17d656[_0xf5f2('0x25')]['message']);}else{logger[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x5850f4,_0xf5f2('0x21'));_0x1c1a5c(_0x17d656[_0xf5f2('0x28')][_0xf5f2('0x27')]);}})['catch'](function(_0x21cd91){logger[_0xf5f2('0x25')](_0xf5f2('0x20'),_0x5850f4,_0x21cd91);_0x422b55(_0x21cd91);});});}function respondWithStatusCode(_0x2833fe,_0x287ad5){_0x287ad5=_0x287ad5||0xcc;return function(_0x5bdf4a){if(_0x5bdf4a){return _0x2833fe['sendStatus'](_0x287ad5);}return _0x2833fe[_0xf5f2('0x29')](_0x287ad5)[_0xf5f2('0x2a')]();};}function respondWithResult(_0x13da6f,_0x1a5bb3){_0x1a5bb3=_0x1a5bb3||0xc8;return function(_0xf6c58d){if(_0xf6c58d){return _0x13da6f[_0xf5f2('0x29')](_0x1a5bb3)[_0xf5f2('0x2b')](_0xf6c58d);}};}function respondWithFilteredResult(_0x281ec8,_0x294414){return function(_0x4ab014){if(_0x4ab014){var _0xaa2602=_0x4ab014[_0xf5f2('0x2c')],_0x102449=_0x294414[_0xf5f2('0x2d')],_0x375ca8=_0x294414['offset']+_0x294414['limit'],_0x31bfcb;if(_0x375ca8>=_0xaa2602){_0x375ca8=_0xaa2602;_0x31bfcb=0xc8;}else{_0x31bfcb=0xce;}_0x281ec8[_0xf5f2('0x29')](_0x31bfcb);return _0x281ec8[_0xf5f2('0x2e')](_0xf5f2('0x2f'),_0x102449+'-'+_0x375ca8+'/'+_0xaa2602)['json'](_0x4ab014);}return null;};}function patchUpdates(_0x5a2c7e){return function(_0x29571b){try{jsonpatch[_0xf5f2('0x30')](_0x29571b,_0x5a2c7e,!![]);}catch(_0x17394a){return BPromise[_0xf5f2('0x31')](_0x17394a);}return _0x29571b[_0xf5f2('0x32')]();};}function saveUpdates(_0x54c0c8,_0x52e959){return function(_0x2f4778){if(_0x2f4778){return _0x2f4778['update'](_0x54c0c8)[_0xf5f2('0x1e')](function(_0x58a4df){return _0x58a4df;});}return null;};}function removeEntity(_0x45b643,_0x31087c){return function(_0x7b6817){if(_0x7b6817){return _0x7b6817[_0xf5f2('0x33')]()[_0xf5f2('0x1e')](function(){_0x45b643[_0xf5f2('0x29')](0xcc)[_0xf5f2('0x2a')]();});}};}function handleEntityNotFound(_0x2c0e05,_0x5ca917){return function(_0x4149e6){if(!_0x4149e6){_0x2c0e05[_0xf5f2('0x34')](0x194);}return _0x4149e6;};}function handleError(_0x4590ec,_0x43c77d){_0x43c77d=_0x43c77d||0x1f4;return function(_0x1408b9){logger[_0xf5f2('0x25')](_0x1408b9[_0xf5f2('0x35')]);if(_0x1408b9['name']){delete _0x1408b9[_0xf5f2('0x36')];}_0x4590ec[_0xf5f2('0x29')](_0x43c77d)['send'](_0x1408b9);};}exports[_0xf5f2('0x37')]=function(_0x4b8c42,_0x18ae07){var _0x3930fb={},_0x2a2c31={},_0x2e3cca={'count':0x0,'rows':[]};var _0x59a6dd=_['map'](db[_0xf5f2('0x38')][_0xf5f2('0x39')],function(_0x20eb74){return{'name':_0x20eb74['fieldName'],'type':_0x20eb74[_0xf5f2('0x3a')]['key']};});_0x2a2c31[_0xf5f2('0x3b')]=_['map'](_0x59a6dd,_0xf5f2('0x36'));_0x2a2c31[_0xf5f2('0x3c')]=_['keys'](_0x4b8c42[_0xf5f2('0x3c')]);_0x2a2c31[_0xf5f2('0x3d')]=_[_0xf5f2('0x3e')](_0x2a2c31[_0xf5f2('0x3b')],_0x2a2c31['query']);_0x3930fb['attributes']=_[_0xf5f2('0x3e')](_0x2a2c31[_0xf5f2('0x3b')],qs[_0xf5f2('0x3f')](_0x4b8c42[_0xf5f2('0x3c')][_0xf5f2('0x3f')]));_0x3930fb[_0xf5f2('0x40')]=_0x3930fb[_0xf5f2('0x40')]['length']?_0x3930fb[_0xf5f2('0x40')]:_0x2a2c31[_0xf5f2('0x3b')];if(!_0x4b8c42['query'][_0xf5f2('0x41')](_0xf5f2('0x42'))){_0x3930fb[_0xf5f2('0x43')]=qs[_0xf5f2('0x43')](_0x4b8c42[_0xf5f2('0x3c')][_0xf5f2('0x43')]);_0x3930fb[_0xf5f2('0x2d')]=qs[_0xf5f2('0x2d')](_0x4b8c42['query'][_0xf5f2('0x2d')]);}_0x3930fb[_0xf5f2('0x44')]=qs[_0xf5f2('0x45')](_0x4b8c42['query']['sort']);_0x3930fb['where']=qs[_0xf5f2('0x3d')](_[_0xf5f2('0x46')](_0x4b8c42['query'],_0x2a2c31[_0xf5f2('0x3d')]),_0x59a6dd);if(_0x4b8c42[_0xf5f2('0x3c')][_0xf5f2('0x47')]){_0x3930fb[_0xf5f2('0x48')]=_[_0xf5f2('0x49')](_0x3930fb[_0xf5f2('0x48')],{'$or':_[_0xf5f2('0x4a')](_0x59a6dd,function(_0x212e90){if(_0x212e90[_0xf5f2('0x3a')]!==_0xf5f2('0x4b')){var _0x444317={};_0x444317[_0x212e90[_0xf5f2('0x36')]]={'$like':'%'+_0x4b8c42[_0xf5f2('0x3c')][_0xf5f2('0x47')]+'%'};return _0x444317;}})});}_0x3930fb=_['merge']({},_0x3930fb,_0x4b8c42[_0xf5f2('0x4c')]);var _0x578c93={'where':_0x3930fb[_0xf5f2('0x48')]};return db[_0xf5f2('0x38')][_0xf5f2('0x2c')](_0x578c93)[_0xf5f2('0x1e')](function(_0x31bf0e){_0x2e3cca[_0xf5f2('0x2c')]=_0x31bf0e;if(_0x4b8c42['query'][_0xf5f2('0x4d')]){_0x3930fb[_0xf5f2('0x4e')]=[{'all':!![]}];}return db[_0xf5f2('0x38')][_0xf5f2('0x4f')](_0x3930fb);})[_0xf5f2('0x1e')](function(_0x10753a){_0x2e3cca[_0xf5f2('0x50')]=_0x10753a;return _0x2e3cca;})[_0xf5f2('0x1e')](respondWithFilteredResult(_0x18ae07,_0x3930fb))['catch'](handleError(_0x18ae07,null));};exports[_0xf5f2('0x51')]=function(_0x33ec29,_0x45db9a){var _0x492eea={'raw':![],'where':{'id':_0x33ec29[_0xf5f2('0x52')]['id']}},_0x1177ba={};_0x1177ba[_0xf5f2('0x3b')]=_['keys'](db['FreshsalesConfiguration'][_0xf5f2('0x39')]);_0x1177ba[_0xf5f2('0x3c')]=_['keys'](_0x33ec29[_0xf5f2('0x3c')]);_0x1177ba['filters']=_[_0xf5f2('0x3e')](_0x1177ba['model'],_0x1177ba[_0xf5f2('0x3c')]);_0x492eea['attributes']=_[_0xf5f2('0x3e')](_0x1177ba[_0xf5f2('0x3b')],qs[_0xf5f2('0x3f')](_0x33ec29[_0xf5f2('0x3c')]['fields']));_0x492eea[_0xf5f2('0x40')]=_0x492eea[_0xf5f2('0x40')]['length']?_0x492eea['attributes']:_0x1177ba[_0xf5f2('0x3b')];if(_0x33ec29[_0xf5f2('0x3c')]['includeAll']){_0x492eea[_0xf5f2('0x4e')]=[{'all':!![]}];}_0x492eea=_[_0xf5f2('0x49')]({},_0x492eea,_0x33ec29[_0xf5f2('0x4c')]);return db[_0xf5f2('0x38')]['find'](_0x492eea)['then'](handleEntityNotFound(_0x45db9a,null))[_0xf5f2('0x1e')](respondWithResult(_0x45db9a,null))[_0xf5f2('0x53')](handleError(_0x45db9a,null));};exports['create']=function(_0x40eef,_0x43fc49){return db[_0xf5f2('0x38')][_0xf5f2('0x54')](_0x40eef[_0xf5f2('0x55')],{})[_0xf5f2('0x1e')](respondWithResult(_0x43fc49,0xc9))[_0xf5f2('0x53')](handleError(_0x43fc49,null));};exports['update']=function(_0x59e8ef,_0x330730){if(_0x59e8ef[_0xf5f2('0x55')]['id']){delete _0x59e8ef[_0xf5f2('0x55')]['id'];}return db[_0xf5f2('0x38')][_0xf5f2('0x56')]({'where':{'id':_0x59e8ef['params']['id']}})[_0xf5f2('0x1e')](handleEntityNotFound(_0x330730,null))[_0xf5f2('0x1e')](saveUpdates(_0x59e8ef[_0xf5f2('0x55')],null))['then'](respondWithResult(_0x330730,null))[_0xf5f2('0x53')](handleError(_0x330730,null));};exports['destroy']=function(_0x78f1d2,_0x1a8d33){return db[_0xf5f2('0x38')][_0xf5f2('0x56')]({'where':{'id':_0x78f1d2['params']['id']}})['then'](handleEntityNotFound(_0x1a8d33,null))[_0xf5f2('0x1e')](removeEntity(_0x1a8d33,null))['catch'](handleError(_0x1a8d33,null));};exports[_0xf5f2('0x57')]=function(_0x1f1916,_0x572ec1,_0x3f0579){var _0xa4c0be={};var _0x2a8f6d={};var _0x51ef09;var _0x397b99;return db[_0xf5f2('0x38')][_0xf5f2('0x58')]({'where':{'id':_0x1f1916[_0xf5f2('0x52')]['id']}})['then'](handleEntityNotFound(_0x572ec1,null))[_0xf5f2('0x1e')](function(_0x506fe5){if(_0x506fe5){_0x51ef09=_0x506fe5;_0x2a8f6d[_0xf5f2('0x3b')]=_[_0xf5f2('0x59')](db[_0xf5f2('0x5a')][_0xf5f2('0x39')]);_0x2a8f6d[_0xf5f2('0x3c')]=_['keys'](_0x1f1916[_0xf5f2('0x3c')]);_0x2a8f6d[_0xf5f2('0x3d')]=_[_0xf5f2('0x3e')](_0x2a8f6d[_0xf5f2('0x3b')],_0x2a8f6d[_0xf5f2('0x3c')]);_0xa4c0be['attributes']=_[_0xf5f2('0x3e')](_0x2a8f6d['model'],qs['fields'](_0x1f1916[_0xf5f2('0x3c')]['fields']));_0xa4c0be[_0xf5f2('0x40')]=_0xa4c0be[_0xf5f2('0x40')][_0xf5f2('0x5b')]?_0xa4c0be[_0xf5f2('0x40')]:_0x2a8f6d['model'];_0xa4c0be[_0xf5f2('0x44')]=qs[_0xf5f2('0x45')](_0x1f1916[_0xf5f2('0x3c')][_0xf5f2('0x45')]);_0xa4c0be[_0xf5f2('0x48')]=qs[_0xf5f2('0x3d')](_[_0xf5f2('0x46')](_0x1f1916['query'],_0x2a8f6d[_0xf5f2('0x3d')]));if(_0x1f1916[_0xf5f2('0x3c')][_0xf5f2('0x47')]){_0xa4c0be[_0xf5f2('0x48')]=_['merge'](_0xa4c0be[_0xf5f2('0x48')],{'$or':_['map'](_0xa4c0be[_0xf5f2('0x40')],function(_0x1c7f06){var _0x5588cf={};_0x5588cf[_0x1c7f06]={'$like':'%'+_0x1f1916[_0xf5f2('0x3c')][_0xf5f2('0x47')]+'%'};return _0x5588cf;})});}_0xa4c0be=_[_0xf5f2('0x49')]({},_0xa4c0be,_0x1f1916[_0xf5f2('0x4c')]);return _0x51ef09[_0xf5f2('0x57')](_0xa4c0be);}})['then'](function(_0x3e821c){if(_0x3e821c){_0x397b99=_0x3e821c[_0xf5f2('0x5b')];if(!_0x1f1916[_0xf5f2('0x3c')][_0xf5f2('0x41')](_0xf5f2('0x42'))){_0xa4c0be[_0xf5f2('0x43')]=qs['limit'](_0x1f1916[_0xf5f2('0x3c')][_0xf5f2('0x43')]);_0xa4c0be['offset']=qs[_0xf5f2('0x2d')](_0x1f1916[_0xf5f2('0x3c')][_0xf5f2('0x2d')]);}return _0x51ef09['getSubjects'](_0xa4c0be);}})['then'](function(_0x4f3df6){if(_0x4f3df6){return _0x4f3df6?{'count':_0x397b99,'rows':_0x4f3df6}:null;}})[_0xf5f2('0x1e')](respondWithResult(_0x572ec1,null))[_0xf5f2('0x53')](handleError(_0x572ec1,null));};exports[_0xf5f2('0x5c')]=function(_0x450691,_0x55da4d,_0x4d878e){var _0x278b76={};var _0x3a98b4={};var _0xc10cf3;var _0xe8a9b7;return db[_0xf5f2('0x38')][_0xf5f2('0x58')]({'where':{'id':_0x450691[_0xf5f2('0x52')]['id']}})[_0xf5f2('0x1e')](handleEntityNotFound(_0x55da4d,null))[_0xf5f2('0x1e')](function(_0x1f35ef){if(_0x1f35ef){_0xc10cf3=_0x1f35ef;_0x3a98b4[_0xf5f2('0x3b')]=_['keys'](db['FreshsalesField']['rawAttributes']);_0x3a98b4[_0xf5f2('0x3c')]=_[_0xf5f2('0x59')](_0x450691[_0xf5f2('0x3c')]);_0x3a98b4[_0xf5f2('0x3d')]=_[_0xf5f2('0x3e')](_0x3a98b4['model'],_0x3a98b4[_0xf5f2('0x3c')]);_0x278b76[_0xf5f2('0x40')]=_[_0xf5f2('0x3e')](_0x3a98b4[_0xf5f2('0x3b')],qs[_0xf5f2('0x3f')](_0x450691['query'][_0xf5f2('0x3f')]));_0x278b76[_0xf5f2('0x40')]=_0x278b76['attributes'][_0xf5f2('0x5b')]?_0x278b76[_0xf5f2('0x40')]:_0x3a98b4[_0xf5f2('0x3b')];_0x278b76[_0xf5f2('0x44')]=qs['sort'](_0x450691[_0xf5f2('0x3c')][_0xf5f2('0x45')]);_0x278b76[_0xf5f2('0x48')]=qs[_0xf5f2('0x3d')](_[_0xf5f2('0x46')](_0x450691['query'],_0x3a98b4['filters']));if(_0x450691[_0xf5f2('0x3c')][_0xf5f2('0x47')]){_0x278b76[_0xf5f2('0x48')]=_[_0xf5f2('0x49')](_0x278b76['where'],{'$or':_['map'](_0x278b76[_0xf5f2('0x40')],function(_0x4f2fcc){var _0x4c4420={};_0x4c4420[_0x4f2fcc]={'$like':'%'+_0x450691['query']['filter']+'%'};return _0x4c4420;})});}_0x278b76=_[_0xf5f2('0x49')]({},_0x278b76,_0x450691[_0xf5f2('0x4c')]);return _0xc10cf3[_0xf5f2('0x5c')](_0x278b76);}})[_0xf5f2('0x1e')](function(_0x3de508){if(_0x3de508){_0xe8a9b7=_0x3de508[_0xf5f2('0x5b')];if(!_0x450691[_0xf5f2('0x3c')][_0xf5f2('0x41')](_0xf5f2('0x42'))){_0x278b76[_0xf5f2('0x43')]=qs[_0xf5f2('0x43')](_0x450691[_0xf5f2('0x3c')][_0xf5f2('0x43')]);_0x278b76[_0xf5f2('0x2d')]=qs[_0xf5f2('0x2d')](_0x450691[_0xf5f2('0x3c')][_0xf5f2('0x2d')]);}return _0xc10cf3[_0xf5f2('0x5c')](_0x278b76);}})['then'](function(_0xe7ac8){if(_0xe7ac8){return _0xe7ac8?{'count':_0xe8a9b7,'rows':_0xe7ac8}:null;}})[_0xf5f2('0x1e')](respondWithResult(_0x55da4d,null))[_0xf5f2('0x53')](handleError(_0x55da4d,null));};exports[_0xf5f2('0x5d')]=function(_0x18c353,_0x308220,_0x16491c){var _0xcf48eb={};var _0x5bf8fe={};var _0x38675d;var _0x57b50f;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x18c353['params']['id']}})['then'](handleEntityNotFound(_0x308220,null))['then'](function(_0x161890){if(_0x161890){_0x38675d=_0x161890;_0x5bf8fe[_0xf5f2('0x3b')]=_[_0xf5f2('0x59')](db[_0xf5f2('0x5a')][_0xf5f2('0x39')]);_0x5bf8fe[_0xf5f2('0x3c')]=_['keys'](_0x18c353['query']);_0x5bf8fe[_0xf5f2('0x3d')]=_['intersection'](_0x5bf8fe[_0xf5f2('0x3b')],_0x5bf8fe[_0xf5f2('0x3c')]);_0xcf48eb['attributes']=_['intersection'](_0x5bf8fe[_0xf5f2('0x3b')],qs[_0xf5f2('0x3f')](_0x18c353['query'][_0xf5f2('0x3f')]));_0xcf48eb[_0xf5f2('0x40')]=_0xcf48eb['attributes'][_0xf5f2('0x5b')]?_0xcf48eb[_0xf5f2('0x40')]:_0x5bf8fe[_0xf5f2('0x3b')];_0xcf48eb['order']=qs[_0xf5f2('0x45')](_0x18c353[_0xf5f2('0x3c')][_0xf5f2('0x45')]);_0xcf48eb[_0xf5f2('0x48')]=qs[_0xf5f2('0x3d')](_[_0xf5f2('0x46')](_0x18c353[_0xf5f2('0x3c')],_0x5bf8fe[_0xf5f2('0x3d')]));if(_0x18c353[_0xf5f2('0x3c')][_0xf5f2('0x47')]){_0xcf48eb[_0xf5f2('0x48')]=_[_0xf5f2('0x49')](_0xcf48eb[_0xf5f2('0x48')],{'$or':_[_0xf5f2('0x4a')](_0xcf48eb[_0xf5f2('0x40')],function(_0x28b9cd){var _0x1902c6={};_0x1902c6[_0x28b9cd]={'$like':'%'+_0x18c353[_0xf5f2('0x3c')][_0xf5f2('0x47')]+'%'};return _0x1902c6;})});}_0xcf48eb=_[_0xf5f2('0x49')]({},_0xcf48eb,_0x18c353[_0xf5f2('0x4c')]);return _0x38675d['getFields'](_0xcf48eb);}})[_0xf5f2('0x1e')](function(_0x33c864){if(_0x33c864){_0x57b50f=_0x33c864['length'];if(!_0x18c353[_0xf5f2('0x3c')][_0xf5f2('0x41')]('nolimit')){_0xcf48eb[_0xf5f2('0x43')]=qs[_0xf5f2('0x43')](_0x18c353[_0xf5f2('0x3c')]['limit']);_0xcf48eb['offset']=qs[_0xf5f2('0x2d')](_0x18c353[_0xf5f2('0x3c')][_0xf5f2('0x2d')]);}return _0x38675d['getFields'](_0xcf48eb);}})['then'](function(_0x2572c0){if(_0x2572c0){return _0x2572c0?{'count':_0x57b50f,'rows':_0x2572c0}:null;}})[_0xf5f2('0x1e')](respondWithResult(_0x308220,null))[_0xf5f2('0x53')](handleError(_0x308220,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 20e1fb7..f019e0f 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 _0x4849=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','FreshsalesConfiguration'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x4849,0x181));var _0x9484=function(_0x340509,_0x35fc1d){_0x340509=_0x340509-0x0;var _0x147593=_0x4849[_0x340509];return _0x147593;};'use strict';var _=require('lodash');var util=require(_0x9484('0x0'));var logger=require(_0x9484('0x1'))(_0x9484('0x2'));var moment=require(_0x9484('0x3'));var BPromise=require(_0x9484('0x4'));var rp=require(_0x9484('0x5'));var fs=require('fs');var path=require(_0x9484('0x6'));var rimraf=require(_0x9484('0x7'));var config=require(_0x9484('0x8'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x9484('0x9')]=function(_0x555b70,_0x521217){return _0x555b70['define'](_0x9484('0xa'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x894f=['exports','define','FreshsalesConfiguration','lodash','util','../../config/logger','api','request-promise','path','./intFreshsalesConfiguration.attributes'];(function(_0x1743a9,_0xfd1e46){var _0x126e50=function(_0x11f0d4){while(--_0x11f0d4){_0x1743a9['push'](_0x1743a9['shift']());}};_0x126e50(++_0xfd1e46);}(_0x894f,0x14d));var _0xf894=function(_0x2851b7,_0x3bf406){_0x2851b7=_0x2851b7-0x0;var _0x4b69b4=_0x894f[_0x2851b7];return _0x4b69b4;};'use strict';var _=require(_0xf894('0x0'));var util=require(_0xf894('0x1'));var logger=require(_0xf894('0x2'))(_0xf894('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf894('0x4'));var fs=require('fs');var path=require(_0xf894('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf894('0x6'));module[_0xf894('0x7')]=function(_0x4e2af3,_0x5814d3){return _0x4e2af3[_0xf894('0x8')](_0xf894('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 e0eb89d..6ddc901 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 _0x4cdf=['request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x5751e6,_0x125e5e){var _0x4199e4=function(_0x559843){while(--_0x559843){_0x5751e6['push'](_0x5751e6['shift']());}};_0x4199e4(++_0x125e5e);}(_0x4cdf,0x180));var _0xf4cd=function(_0x2ad54c,_0xd6f6ab){_0x2ad54c=_0x2ad54c-0x0;var _0x3145c7=_0x4cdf[_0x2ad54c];return _0x3145c7;};'use strict';var _=require(_0xf4cd('0x0'));var util=require(_0xf4cd('0x1'));var moment=require(_0xf4cd('0x2'));var BPromise=require(_0xf4cd('0x3'));var rs=require(_0xf4cd('0x4'));var fs=require('fs');var Redis=require(_0xf4cd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf4cd('0x6'));var logger=require(_0xf4cd('0x7'))('rpc');var config=require(_0xf4cd('0x8'));var jayson=require(_0xf4cd('0x9'));var client=jayson[_0xf4cd('0xa')][_0xf4cd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x302089,_0x5373dd,_0xade55a){return new BPromise(function(_0x2abbbd,_0x20f7b7){return client[_0xf4cd('0xc')](_0x302089,_0xade55a)['then'](function(_0x87cad4){logger[_0xf4cd('0xd')](_0xf4cd('0xe'),_0x5373dd,_0xf4cd('0xf'));logger[_0xf4cd('0x10')](_0xf4cd('0x11'),_0x5373dd,_0xf4cd('0xf'),JSON['stringify'](_0x87cad4));if(_0x87cad4[_0xf4cd('0x12')]){if(_0x87cad4[_0xf4cd('0x12')][_0xf4cd('0x13')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x5373dd,_0x87cad4[_0xf4cd('0x12')][_0xf4cd('0x14')]);return _0x20f7b7(_0x87cad4[_0xf4cd('0x12')]['message']);}logger[_0xf4cd('0x12')](_0xf4cd('0xe'),_0x5373dd,_0x87cad4[_0xf4cd('0x12')][_0xf4cd('0x14')]);return _0x2abbbd(_0x87cad4[_0xf4cd('0x12')][_0xf4cd('0x14')]);}else{logger['info'](_0xf4cd('0xe'),_0x5373dd,_0xf4cd('0xf'));_0x2abbbd(_0x87cad4[_0xf4cd('0x15')][_0xf4cd('0x14')]);}})['catch'](function(_0x3a5e99){logger[_0xf4cd('0x12')](_0xf4cd('0xe'),_0x5373dd,_0x3a5e99);_0x20f7b7(_0x3a5e99);});});} \ No newline at end of file +var _0xab3a=['FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x43703c,_0x5538d0){var _0x452021=function(_0x5adf15){while(--_0x5adf15){_0x43703c['push'](_0x43703c['shift']());}};_0x452021(++_0x5538d0);}(_0xab3a,0x1d3));var _0xaab3=function(_0x4147e6,_0x57174e){_0x4147e6=_0x4147e6-0x0;var _0x3305ba=_0xab3a[_0x4147e6];return _0x3305ba;};'use strict';var _=require(_0xaab3('0x0'));var util=require(_0xaab3('0x1'));var moment=require(_0xaab3('0x2'));var BPromise=require(_0xaab3('0x3'));var rs=require(_0xaab3('0x4'));var fs=require('fs');var Redis=require(_0xaab3('0x5'));var db=require(_0xaab3('0x6'))['db'];var utils=require(_0xaab3('0x7'));var logger=require(_0xaab3('0x8'))(_0xaab3('0x9'));var config=require(_0xaab3('0xa'));var jayson=require(_0xaab3('0xb'));var client=jayson[_0xaab3('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5760e8,_0x501657,_0x1fd19f){return new BPromise(function(_0x146453,_0x21527a){return client[_0xaab3('0xd')](_0x5760e8,_0x1fd19f)[_0xaab3('0xe')](function(_0x15841e){logger[_0xaab3('0xf')](_0xaab3('0x10'),_0x501657,_0xaab3('0x11'));logger[_0xaab3('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x501657,'request\x20sent',JSON[_0xaab3('0x13')](_0x15841e));if(_0x15841e[_0xaab3('0x14')]){if(_0x15841e[_0xaab3('0x14')][_0xaab3('0x15')]===0x1f4){logger['error'](_0xaab3('0x10'),_0x501657,_0x15841e['error'][_0xaab3('0x16')]);return _0x21527a(_0x15841e['error'][_0xaab3('0x16')]);}logger[_0xaab3('0x14')](_0xaab3('0x10'),_0x501657,_0x15841e['error'][_0xaab3('0x16')]);return _0x146453(_0x15841e[_0xaab3('0x14')]['message']);}else{logger[_0xaab3('0xf')](_0xaab3('0x10'),_0x501657,_0xaab3('0x11'));_0x146453(_0x15841e['result']['message']);}})['catch'](function(_0x484dc5){logger[_0xaab3('0x14')](_0xaab3('0x10'),_0x501657,_0x484dc5);_0x21527a(_0x484dc5);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 7592770..654eb9c 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 _0x6f7a=['../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','post','create','put','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x3c64d4,_0x5bd3e9){_0x3c64d4=_0x3c64d4-0x0;var _0x571b6e=_0x6f7a[_0x3c64d4];return _0x571b6e;};'use strict';var multer=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var path=require(_0xa6f7('0x2'));var timeout=require(_0xa6f7('0x3'));var express=require('express');var router=express[_0xa6f7('0x4')]();var fs_extra=require(_0xa6f7('0x5'));var auth=require(_0xa6f7('0x6'));var interaction=require(_0xa6f7('0x7'));var config=require(_0xa6f7('0x8'));var controller=require(_0xa6f7('0x9'));router[_0xa6f7('0xa')]('/',auth[_0xa6f7('0xb')](),controller[_0xa6f7('0xc')]);router[_0xa6f7('0xa')](_0xa6f7('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xa6f7('0xe')]('/',auth[_0xa6f7('0xb')](),controller[_0xa6f7('0xf')]);router[_0xa6f7('0x10')](_0xa6f7('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xa6f7('0x11')](_0xa6f7('0xd'),auth['isAuthenticated'](),controller[_0xa6f7('0x12')]);module['exports']=router; \ No newline at end of file +var _0xac4a=['express','Router','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','get','show','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0xcd432,_0x4e7a7e){var _0x324ab4=function(_0x13554e){while(--_0x13554e){_0xcd432['push'](_0xcd432['shift']());}};_0x324ab4(++_0x4e7a7e);}(_0xac4a,0x13f));var _0xaac4=function(_0x23e1cf,_0x31bb4e){_0x23e1cf=_0x23e1cf-0x0;var _0x2db8ea=_0xac4a[_0x23e1cf];return _0x2db8ea;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router['put'](_0xaac4('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xaac4('0xe')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);module[_0xaac4('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 0e77191..114f0be 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 _0x4fb4=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x5646c1,_0x5f58e4){var _0x3ecd38=function(_0x424476){while(--_0x424476){_0x5646c1['push'](_0x5646c1['shift']());}};_0x3ecd38(++_0x5f58e4);}(_0x4fb4,0x190));var _0x44fb=function(_0x561100,_0x49ea12){_0x561100=_0x561100-0x0;var _0x3b33e8=_0x4fb4[_0x561100];return _0x3b33e8;};'use strict';var Sequelize=require('sequelize');module[_0x44fb('0x0')]={'type':{'type':Sequelize[_0x44fb('0x1')](_0x44fb('0x2'),_0x44fb('0x3'),_0x44fb('0x4'),_0x44fb('0x5'),'picklist'),'defaultValue':_0x44fb('0x2')},'content':{'type':Sequelize[_0x44fb('0x6')]},'key':{'type':Sequelize[_0x44fb('0x6')]},'keyType':{'type':Sequelize[_0x44fb('0x1')](_0x44fb('0x2'),_0x44fb('0x3'),_0x44fb('0x4'))},'keyContent':{'type':Sequelize[_0x44fb('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x44fb('0x6')]},'customField':{'type':Sequelize[_0x44fb('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1b20=['STRING','variable','BOOLEAN','exports','ENUM','customVariable','keyValue','picklist','string'];(function(_0x47708d,_0x4313c8){var _0x5b2c78=function(_0xe94693){while(--_0xe94693){_0x47708d['push'](_0x47708d['shift']());}};_0x5b2c78(++_0x4313c8);}(_0x1b20,0x66));var _0x01b2=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x1b20[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');module[_0x01b2('0x0')]={'type':{'type':Sequelize[_0x01b2('0x1')]('string','variable',_0x01b2('0x2'),_0x01b2('0x3'),_0x01b2('0x4')),'defaultValue':_0x01b2('0x5')},'content':{'type':Sequelize[_0x01b2('0x6')]},'key':{'type':Sequelize[_0x01b2('0x6')]},'keyType':{'type':Sequelize[_0x01b2('0x1')](_0x01b2('0x5'),_0x01b2('0x7'),_0x01b2('0x2'))},'keyContent':{'type':Sequelize[_0x01b2('0x6')]},'idField':{'type':Sequelize[_0x01b2('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x01b2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 8fb69f5..f765919 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 _0xa601=['find','create','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','Content-Range','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','FreshsalesField','count','includeAll','include','findAll','rows','catch','length'];(function(_0x5e3701,_0x596265){var _0x345dcf=function(_0x5eb12a){while(--_0x5eb12a){_0x5e3701['push'](_0x5e3701['shift']());}};_0x345dcf(++_0x596265);}(_0xa601,0x98));var _0x1a60=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0xa601[_0x1b6c6d];return _0x290d9d;};'use strict';var pdf=require(_0x1a60('0x0'));var emlformat=require(_0x1a60('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1a60('0x2'));var jsonpatch=require(_0x1a60('0x3'));var rp=require(_0x1a60('0x4'));var moment=require(_0x1a60('0x5'));var BPromise=require(_0x1a60('0x6'));var Mustache=require('mustache');var util=require(_0x1a60('0x7'));var path=require(_0x1a60('0x8'));var sox=require(_0x1a60('0x9'));var csv=require(_0x1a60('0xa'));var ejs=require(_0x1a60('0xb'));var fs=require('fs');var fs_extra=require(_0x1a60('0xc'));var _=require(_0x1a60('0xd'));var squel=require(_0x1a60('0xe'));var crypto=require(_0x1a60('0xf'));var jsforce=require(_0x1a60('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1a60('0x11'));var Papa=require(_0x1a60('0x12'));var Redis=require(_0x1a60('0x13'));var authService=require(_0x1a60('0x14'));var qs=require(_0x1a60('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1a60('0x16'))(_0x1a60('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1a60('0x18'));var db=require(_0x1a60('0x19'))['db'];function respondWithStatusCode(_0x23dd67,_0x15ccbb){_0x15ccbb=_0x15ccbb||0xcc;return function(_0x5750f2){if(_0x5750f2){return _0x23dd67[_0x1a60('0x1a')](_0x15ccbb);}return _0x23dd67[_0x1a60('0x1b')](_0x15ccbb)[_0x1a60('0x1c')]();};}function respondWithResult(_0x2744f6,_0x1cff28){_0x1cff28=_0x1cff28||0xc8;return function(_0x41b81c){if(_0x41b81c){return _0x2744f6[_0x1a60('0x1b')](_0x1cff28)[_0x1a60('0x1d')](_0x41b81c);}};}function respondWithFilteredResult(_0x4d340f,_0x5a931d){return function(_0x19afd8){if(_0x19afd8){var _0x29372e=_0x19afd8['count'],_0x43fd74=_0x5a931d[_0x1a60('0x1e')],_0x3171ba=_0x5a931d['offset']+_0x5a931d['limit'],_0x3b3eaf;if(_0x3171ba>=_0x29372e){_0x3171ba=_0x29372e;_0x3b3eaf=0xc8;}else{_0x3b3eaf=0xce;}_0x4d340f[_0x1a60('0x1b')](_0x3b3eaf);return _0x4d340f['set'](_0x1a60('0x1f'),_0x43fd74+'-'+_0x3171ba+'/'+_0x29372e)[_0x1a60('0x1d')](_0x19afd8);}return null;};}function patchUpdates(_0x52e0e3){return function(_0x16a559){try{jsonpatch[_0x1a60('0x20')](_0x16a559,_0x52e0e3,!![]);}catch(_0x272033){return BPromise['reject'](_0x272033);}return _0x16a559[_0x1a60('0x21')]();};}function saveUpdates(_0x358ff4,_0x49272d){return function(_0x31e13a){if(_0x31e13a){return _0x31e13a[_0x1a60('0x22')](_0x358ff4)[_0x1a60('0x23')](function(_0x56a397){return _0x56a397;});}return null;};}function removeEntity(_0x57dbad,_0x46c707){return function(_0x27b98f){if(_0x27b98f){return _0x27b98f['destroy']()[_0x1a60('0x23')](function(){_0x57dbad[_0x1a60('0x1b')](0xcc)[_0x1a60('0x1c')]();});}};}function handleEntityNotFound(_0x50960c,_0x2e716c){return function(_0x5c503a){if(!_0x5c503a){_0x50960c[_0x1a60('0x1a')](0x194);}return _0x5c503a;};}function handleError(_0x77b288,_0x3e95c1){_0x3e95c1=_0x3e95c1||0x1f4;return function(_0x501deb){logger[_0x1a60('0x24')](_0x501deb[_0x1a60('0x25')]);if(_0x501deb[_0x1a60('0x26')]){delete _0x501deb['name'];}_0x77b288[_0x1a60('0x1b')](_0x3e95c1)[_0x1a60('0x27')](_0x501deb);};}exports[_0x1a60('0x28')]=function(_0x2a663f,_0x2b823c){var _0x5d81e4={},_0x1b1ecd={},_0x103f16={'count':0x0,'rows':[]};var _0x5b80e1=_[_0x1a60('0x29')](db['FreshsalesField'][_0x1a60('0x2a')],function(_0x13389b){return{'name':_0x13389b[_0x1a60('0x2b')],'type':_0x13389b[_0x1a60('0x2c')][_0x1a60('0x2d')]};});_0x1b1ecd[_0x1a60('0x2e')]=_[_0x1a60('0x29')](_0x5b80e1,_0x1a60('0x26'));_0x1b1ecd[_0x1a60('0x2f')]=_[_0x1a60('0x30')](_0x2a663f[_0x1a60('0x2f')]);_0x1b1ecd[_0x1a60('0x31')]=_['intersection'](_0x1b1ecd['model'],_0x1b1ecd[_0x1a60('0x2f')]);_0x5d81e4[_0x1a60('0x32')]=_[_0x1a60('0x33')](_0x1b1ecd['model'],qs['fields'](_0x2a663f[_0x1a60('0x2f')][_0x1a60('0x34')]));_0x5d81e4[_0x1a60('0x32')]=_0x5d81e4[_0x1a60('0x32')]['length']?_0x5d81e4[_0x1a60('0x32')]:_0x1b1ecd['model'];if(!_0x2a663f['query'][_0x1a60('0x35')]('nolimit')){_0x5d81e4[_0x1a60('0x36')]=qs[_0x1a60('0x36')](_0x2a663f[_0x1a60('0x2f')]['limit']);_0x5d81e4['offset']=qs[_0x1a60('0x1e')](_0x2a663f['query'][_0x1a60('0x1e')]);}_0x5d81e4[_0x1a60('0x37')]=qs[_0x1a60('0x38')](_0x2a663f[_0x1a60('0x2f')][_0x1a60('0x38')]);_0x5d81e4[_0x1a60('0x39')]=qs[_0x1a60('0x31')](_['pick'](_0x2a663f['query'],_0x1b1ecd[_0x1a60('0x31')]),_0x5b80e1);if(_0x2a663f[_0x1a60('0x2f')][_0x1a60('0x3a')]){_0x5d81e4['where']=_[_0x1a60('0x3b')](_0x5d81e4['where'],{'$or':_[_0x1a60('0x29')](_0x5b80e1,function(_0x49a98f){if(_0x49a98f[_0x1a60('0x2c')]!==_0x1a60('0x3c')){var _0x347033={};_0x347033[_0x49a98f[_0x1a60('0x26')]]={'$like':'%'+_0x2a663f[_0x1a60('0x2f')][_0x1a60('0x3a')]+'%'};return _0x347033;}})});}_0x5d81e4=_[_0x1a60('0x3b')]({},_0x5d81e4,_0x2a663f[_0x1a60('0x3d')]);var _0x429e92={'where':_0x5d81e4[_0x1a60('0x39')]};return db[_0x1a60('0x3e')]['count'](_0x429e92)[_0x1a60('0x23')](function(_0x5826dc){_0x103f16[_0x1a60('0x3f')]=_0x5826dc;if(_0x2a663f[_0x1a60('0x2f')][_0x1a60('0x40')]){_0x5d81e4[_0x1a60('0x41')]=[{'all':!![]}];}return db[_0x1a60('0x3e')][_0x1a60('0x42')](_0x5d81e4);})[_0x1a60('0x23')](function(_0x39114c){_0x103f16[_0x1a60('0x43')]=_0x39114c;return _0x103f16;})['then'](respondWithFilteredResult(_0x2b823c,_0x5d81e4))[_0x1a60('0x44')](handleError(_0x2b823c,null));};exports['show']=function(_0x1b6a26,_0x39f982){var _0x4b6760={'raw':!![],'where':{'id':_0x1b6a26['params']['id']}},_0x3d2a12={};_0x3d2a12[_0x1a60('0x2e')]=_['keys'](db[_0x1a60('0x3e')][_0x1a60('0x2a')]);_0x3d2a12[_0x1a60('0x2f')]=_[_0x1a60('0x30')](_0x1b6a26[_0x1a60('0x2f')]);_0x3d2a12['filters']=_[_0x1a60('0x33')](_0x3d2a12[_0x1a60('0x2e')],_0x3d2a12[_0x1a60('0x2f')]);_0x4b6760[_0x1a60('0x32')]=_[_0x1a60('0x33')](_0x3d2a12[_0x1a60('0x2e')],qs[_0x1a60('0x34')](_0x1b6a26[_0x1a60('0x2f')][_0x1a60('0x34')]));_0x4b6760[_0x1a60('0x32')]=_0x4b6760[_0x1a60('0x32')][_0x1a60('0x45')]?_0x4b6760[_0x1a60('0x32')]:_0x3d2a12[_0x1a60('0x2e')];if(_0x1b6a26[_0x1a60('0x2f')][_0x1a60('0x40')]){_0x4b6760['include']=[{'all':!![]}];}_0x4b6760=_[_0x1a60('0x3b')]({},_0x4b6760,_0x1b6a26[_0x1a60('0x3d')]);return db[_0x1a60('0x3e')][_0x1a60('0x46')](_0x4b6760)[_0x1a60('0x23')](handleEntityNotFound(_0x39f982,null))[_0x1a60('0x23')](respondWithResult(_0x39f982,null))[_0x1a60('0x44')](handleError(_0x39f982,null));};exports[_0x1a60('0x47')]=function(_0xb97343,_0x3c236c){return db[_0x1a60('0x3e')]['create'](_0xb97343[_0x1a60('0x48')],{})[_0x1a60('0x23')](respondWithResult(_0x3c236c,0xc9))[_0x1a60('0x44')](handleError(_0x3c236c,null));};exports['update']=function(_0x53c37e,_0x37e13d){if(_0x53c37e[_0x1a60('0x48')]['id']){delete _0x53c37e[_0x1a60('0x48')]['id'];}return db['FreshsalesField'][_0x1a60('0x46')]({'where':{'id':_0x53c37e[_0x1a60('0x49')]['id']}})[_0x1a60('0x23')](handleEntityNotFound(_0x37e13d,null))[_0x1a60('0x23')](saveUpdates(_0x53c37e['body'],null))[_0x1a60('0x23')](respondWithResult(_0x37e13d,null))[_0x1a60('0x44')](handleError(_0x37e13d,null));};exports['destroy']=function(_0x117f91,_0x24660b){return db[_0x1a60('0x3e')]['find']({'where':{'id':_0x117f91[_0x1a60('0x49')]['id']}})[_0x1a60('0x23')](handleEntityNotFound(_0x24660b,null))['then'](removeEntity(_0x24660b,null))[_0x1a60('0x44')](handleError(_0x24660b,null));}; \ No newline at end of file +var _0x14a3=['fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','filter','options','include','findAll','params','merge','find','create','body','catch','update','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','set','json','save','destroy','then','error','stack','name','send','map','FreshsalesField','rawAttributes'];(function(_0x2164dd,_0x1a6e92){var _0x2d975f=function(_0x9a1761){while(--_0x9a1761){_0x2164dd['push'](_0x2164dd['shift']());}};_0x2d975f(++_0x1a6e92);}(_0x14a3,0x163));var _0x314a=function(_0x1bf8f5,_0x28f62c){_0x1bf8f5=_0x1bf8f5-0x0;var _0x36a54e=_0x14a3[_0x1bf8f5];return _0x36a54e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x314a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x314a('0x1'));var rp=require('request-promise');var moment=require(_0x314a('0x2'));var BPromise=require(_0x314a('0x3'));var Mustache=require(_0x314a('0x4'));var util=require(_0x314a('0x5'));var path=require(_0x314a('0x6'));var sox=require(_0x314a('0x7'));var csv=require('to-csv');var ejs=require(_0x314a('0x8'));var fs=require('fs');var fs_extra=require(_0x314a('0x9'));var _=require(_0x314a('0xa'));var squel=require(_0x314a('0xb'));var crypto=require(_0x314a('0xc'));var jsforce=require(_0x314a('0xd'));var deskjs=require(_0x314a('0xe'));var toCsv=require(_0x314a('0xf'));var querystring=require('querystring');var Papa=require(_0x314a('0x10'));var Redis=require(_0x314a('0x11'));var authService=require(_0x314a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x314a('0x13'));var hardwareService=require(_0x314a('0x14'));var logger=require('../../config/logger')(_0x314a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x314a('0x16'));var db=require(_0x314a('0x17'))['db'];function respondWithStatusCode(_0x209b25,_0x1ae7c0){_0x1ae7c0=_0x1ae7c0||0xcc;return function(_0x9b8a12){if(_0x9b8a12){return _0x209b25[_0x314a('0x18')](_0x1ae7c0);}return _0x209b25[_0x314a('0x19')](_0x1ae7c0)[_0x314a('0x1a')]();};}function respondWithResult(_0x389423,_0x48dd91){_0x48dd91=_0x48dd91||0xc8;return function(_0x3606cf){if(_0x3606cf){return _0x389423[_0x314a('0x19')](_0x48dd91)['json'](_0x3606cf);}};}function respondWithFilteredResult(_0x435a95,_0x57f732){return function(_0x2bae27){if(_0x2bae27){var _0xc680ae=_0x2bae27[_0x314a('0x1b')],_0x1fc59e=_0x57f732['offset'],_0x8acd94=_0x57f732[_0x314a('0x1c')]+_0x57f732['limit'],_0x1c4510;if(_0x8acd94>=_0xc680ae){_0x8acd94=_0xc680ae;_0x1c4510=0xc8;}else{_0x1c4510=0xce;}_0x435a95[_0x314a('0x19')](_0x1c4510);return _0x435a95[_0x314a('0x1d')]('Content-Range',_0x1fc59e+'-'+_0x8acd94+'/'+_0xc680ae)[_0x314a('0x1e')](_0x2bae27);}return null;};}function patchUpdates(_0x2f9e40){return function(_0x2fc14e){try{jsonpatch['apply'](_0x2fc14e,_0x2f9e40,!![]);}catch(_0x315540){return BPromise['reject'](_0x315540);}return _0x2fc14e[_0x314a('0x1f')]();};}function saveUpdates(_0x2ce7e0,_0x53200b){return function(_0x254556){if(_0x254556){return _0x254556['update'](_0x2ce7e0)['then'](function(_0x22338a){return _0x22338a;});}return null;};}function removeEntity(_0x436dba,_0x32311e){return function(_0x19144){if(_0x19144){return _0x19144[_0x314a('0x20')]()[_0x314a('0x21')](function(){_0x436dba[_0x314a('0x19')](0xcc)[_0x314a('0x1a')]();});}};}function handleEntityNotFound(_0x1c2756,_0x308579){return function(_0x3c1d51){if(!_0x3c1d51){_0x1c2756['sendStatus'](0x194);}return _0x3c1d51;};}function handleError(_0x11da1a,_0x38d0c2){_0x38d0c2=_0x38d0c2||0x1f4;return function(_0x53a387){logger[_0x314a('0x22')](_0x53a387[_0x314a('0x23')]);if(_0x53a387[_0x314a('0x24')]){delete _0x53a387[_0x314a('0x24')];}_0x11da1a[_0x314a('0x19')](_0x38d0c2)[_0x314a('0x25')](_0x53a387);};}exports['index']=function(_0x1a3df4,_0x3cb66e){var _0x10f88b={},_0x476c13={},_0x3ebd0e={'count':0x0,'rows':[]};var _0x43da5a=_[_0x314a('0x26')](db[_0x314a('0x27')][_0x314a('0x28')],function(_0x4de911){return{'name':_0x4de911[_0x314a('0x29')],'type':_0x4de911[_0x314a('0x2a')]['key']};});_0x476c13[_0x314a('0x2b')]=_['map'](_0x43da5a,_0x314a('0x24'));_0x476c13[_0x314a('0x2c')]=_[_0x314a('0x2d')](_0x1a3df4[_0x314a('0x2c')]);_0x476c13[_0x314a('0x2e')]=_[_0x314a('0x2f')](_0x476c13[_0x314a('0x2b')],_0x476c13['query']);_0x10f88b['attributes']=_[_0x314a('0x2f')](_0x476c13[_0x314a('0x2b')],qs[_0x314a('0x30')](_0x1a3df4['query'][_0x314a('0x30')]));_0x10f88b[_0x314a('0x31')]=_0x10f88b[_0x314a('0x31')][_0x314a('0x32')]?_0x10f88b[_0x314a('0x31')]:_0x476c13[_0x314a('0x2b')];if(!_0x1a3df4['query'][_0x314a('0x33')]('nolimit')){_0x10f88b[_0x314a('0x34')]=qs[_0x314a('0x34')](_0x1a3df4[_0x314a('0x2c')]['limit']);_0x10f88b[_0x314a('0x1c')]=qs[_0x314a('0x1c')](_0x1a3df4[_0x314a('0x2c')][_0x314a('0x1c')]);}_0x10f88b['order']=qs[_0x314a('0x35')](_0x1a3df4[_0x314a('0x2c')][_0x314a('0x35')]);_0x10f88b[_0x314a('0x36')]=qs['filters'](_['pick'](_0x1a3df4['query'],_0x476c13[_0x314a('0x2e')]),_0x43da5a);if(_0x1a3df4[_0x314a('0x2c')][_0x314a('0x37')]){_0x10f88b[_0x314a('0x36')]=_['merge'](_0x10f88b[_0x314a('0x36')],{'$or':_[_0x314a('0x26')](_0x43da5a,function(_0x29b069){if(_0x29b069['type']!=='VIRTUAL'){var _0x581dab={};_0x581dab[_0x29b069['name']]={'$like':'%'+_0x1a3df4[_0x314a('0x2c')][_0x314a('0x37')]+'%'};return _0x581dab;}})});}_0x10f88b=_['merge']({},_0x10f88b,_0x1a3df4[_0x314a('0x38')]);var _0x595b52={'where':_0x10f88b['where']};return db[_0x314a('0x27')][_0x314a('0x1b')](_0x595b52)[_0x314a('0x21')](function(_0x2386e7){_0x3ebd0e['count']=_0x2386e7;if(_0x1a3df4[_0x314a('0x2c')]['includeAll']){_0x10f88b[_0x314a('0x39')]=[{'all':!![]}];}return db['FreshsalesField'][_0x314a('0x3a')](_0x10f88b);})['then'](function(_0x3dd8b2){_0x3ebd0e['rows']=_0x3dd8b2;return _0x3ebd0e;})[_0x314a('0x21')](respondWithFilteredResult(_0x3cb66e,_0x10f88b))['catch'](handleError(_0x3cb66e,null));};exports['show']=function(_0x18c4f7,_0x174bbf){var _0x8a626d={'raw':!![],'where':{'id':_0x18c4f7[_0x314a('0x3b')]['id']}},_0x322ade={};_0x322ade[_0x314a('0x2b')]=_[_0x314a('0x2d')](db['FreshsalesField'][_0x314a('0x28')]);_0x322ade['query']=_[_0x314a('0x2d')](_0x18c4f7[_0x314a('0x2c')]);_0x322ade['filters']=_[_0x314a('0x2f')](_0x322ade[_0x314a('0x2b')],_0x322ade[_0x314a('0x2c')]);_0x8a626d[_0x314a('0x31')]=_['intersection'](_0x322ade[_0x314a('0x2b')],qs[_0x314a('0x30')](_0x18c4f7[_0x314a('0x2c')][_0x314a('0x30')]));_0x8a626d['attributes']=_0x8a626d['attributes'][_0x314a('0x32')]?_0x8a626d[_0x314a('0x31')]:_0x322ade[_0x314a('0x2b')];if(_0x18c4f7['query']['includeAll']){_0x8a626d[_0x314a('0x39')]=[{'all':!![]}];}_0x8a626d=_[_0x314a('0x3c')]({},_0x8a626d,_0x18c4f7['options']);return db[_0x314a('0x27')][_0x314a('0x3d')](_0x8a626d)[_0x314a('0x21')](handleEntityNotFound(_0x174bbf,null))['then'](respondWithResult(_0x174bbf,null))['catch'](handleError(_0x174bbf,null));};exports[_0x314a('0x3e')]=function(_0xf29718,_0x36f080){return db[_0x314a('0x27')][_0x314a('0x3e')](_0xf29718[_0x314a('0x3f')],{})['then'](respondWithResult(_0x36f080,0xc9))[_0x314a('0x40')](handleError(_0x36f080,null));};exports[_0x314a('0x41')]=function(_0x65a30d,_0x484874){if(_0x65a30d[_0x314a('0x3f')]['id']){delete _0x65a30d[_0x314a('0x3f')]['id'];}return db[_0x314a('0x27')][_0x314a('0x3d')]({'where':{'id':_0x65a30d[_0x314a('0x3b')]['id']}})['then'](handleEntityNotFound(_0x484874,null))[_0x314a('0x21')](saveUpdates(_0x65a30d[_0x314a('0x3f')],null))[_0x314a('0x21')](respondWithResult(_0x484874,null))['catch'](handleError(_0x484874,null));};exports['destroy']=function(_0x1d6636,_0x4ee7ed){return db[_0x314a('0x27')][_0x314a('0x3d')]({'where':{'id':_0x1d6636[_0x314a('0x3b')]['id']}})[_0x314a('0x21')](handleEntityNotFound(_0x4ee7ed,null))[_0x314a('0x21')](removeEntity(_0x4ee7ed,null))[_0x314a('0x40')](handleError(_0x4ee7ed,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 82a4009..78047e9 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 _0xa1dd=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId'];(function(_0x4081c6,_0x2ae2e6){var _0x6aad5a=function(_0x44932e){while(--_0x44932e){_0x4081c6['push'](_0x4081c6['shift']());}};_0x6aad5a(++_0x2ae2e6);}(_0xa1dd,0x108));var _0xda1d=function(_0x29707f,_0x50d42c){_0x29707f=_0x29707f-0x0;var _0x217284=_0xa1dd[_0x29707f];return _0x217284;};'use strict';var _=require('lodash');var util=require(_0xda1d('0x0'));var logger=require(_0xda1d('0x1'))(_0xda1d('0x2'));var moment=require(_0xda1d('0x3'));var BPromise=require('bluebird');var rp=require(_0xda1d('0x4'));var fs=require('fs');var path=require(_0xda1d('0x5'));var rimraf=require('rimraf');var config=require(_0xda1d('0x6'));var attributes=require('./intFreshsalesField.attributes');module[_0xda1d('0x7')]=function(_0x3de8b9,_0x3870aa){return _0x3de8b9['define'](_0xda1d('0x8'),attributes,{'tableName':_0xda1d('0x9'),'paranoid':![],'indexes':[{'name':_0xda1d('0xa'),'fields':['idField',_0xda1d('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe073=['FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define'];(function(_0x1764fd,_0x256895){var _0x13189e=function(_0x31d1a4){while(--_0x31d1a4){_0x1764fd['push'](_0x1764fd['shift']());}};_0x13189e(++_0x256895);}(_0xe073,0x1b6));var _0x3e07=function(_0x449b54,_0x3776f3){_0x449b54=_0x449b54-0x0;var _0x32d6b9=_0xe073[_0x449b54];return _0x32d6b9;};'use strict';var _=require(_0x3e07('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3e07('0x1'));var moment=require(_0x3e07('0x2'));var BPromise=require(_0x3e07('0x3'));var rp=require(_0x3e07('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e07('0x5'));var config=require(_0x3e07('0x6'));var attributes=require(_0x3e07('0x7'));module[_0x3e07('0x8')]=function(_0x3f8cfa,_0x35bc94){return _0x3f8cfa[_0x3e07('0x9')](_0x3e07('0xa'),attributes,{'tableName':_0x3e07('0xb'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x3e07('0xc'),_0x3e07('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 422c78e..5070622 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 _0x5686=['../../config/environment','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x477123,_0x15f58f){var _0x54daaf=function(_0x7f3bcf){while(--_0x7f3bcf){_0x477123['push'](_0x477123['shift']());}};_0x54daaf(++_0x15f58f);}(_0x5686,0x1be));var _0x6568=function(_0x4df1f5,_0x39c6d2){_0x4df1f5=_0x4df1f5-0x0;var _0x56585b=_0x5686[_0x4df1f5];return _0x56585b;};'use strict';var _=require(_0x6568('0x0'));var util=require(_0x6568('0x1'));var moment=require(_0x6568('0x2'));var BPromise=require(_0x6568('0x3'));var rs=require(_0x6568('0x4'));var fs=require('fs');var Redis=require(_0x6568('0x5'));var db=require(_0x6568('0x6'))['db'];var utils=require(_0x6568('0x7'));var logger=require(_0x6568('0x8'))(_0x6568('0x9'));var config=require(_0x6568('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x6568('0xb')][_0x6568('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1751f5,_0x3c06a7,_0x15c54b){return new BPromise(function(_0x120e9c,_0x31b658){return client[_0x6568('0xd')](_0x1751f5,_0x15c54b)[_0x6568('0xe')](function(_0x94265e){logger[_0x6568('0xf')](_0x6568('0x10'),_0x3c06a7,_0x6568('0x11'));logger[_0x6568('0x12')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x3c06a7,_0x6568('0x11'),JSON[_0x6568('0x13')](_0x94265e));if(_0x94265e[_0x6568('0x14')]){if(_0x94265e[_0x6568('0x14')][_0x6568('0x15')]===0x1f4){logger[_0x6568('0x14')](_0x6568('0x10'),_0x3c06a7,_0x94265e[_0x6568('0x14')][_0x6568('0x16')]);return _0x31b658(_0x94265e['error'][_0x6568('0x16')]);}logger['error'](_0x6568('0x10'),_0x3c06a7,_0x94265e[_0x6568('0x14')][_0x6568('0x16')]);return _0x120e9c(_0x94265e[_0x6568('0x14')]['message']);}else{logger['info'](_0x6568('0x10'),_0x3c06a7,_0x6568('0x11'));_0x120e9c(_0x94265e['result'][_0x6568('0x16')]);}})[_0x6568('0x17')](function(_0x42998a){logger['error'](_0x6568('0x10'),_0x3c06a7,_0x42998a);_0x31b658(_0x42998a);});});} \ No newline at end of file +var _0xa88f=['FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent'];(function(_0x12aaee,_0x5bf50c){var _0x37c350=function(_0x182775){while(--_0x182775){_0x12aaee['push'](_0x12aaee['shift']());}};_0x37c350(++_0x5bf50c);}(_0xa88f,0x182));var _0xfa88=function(_0x28a688,_0x2a904f){_0x28a688=_0x28a688-0x0;var _0x3fd41d=_0xa88f[_0x28a688];return _0x3fd41d;};'use strict';var _=require(_0xfa88('0x0'));var util=require(_0xfa88('0x1'));var moment=require(_0xfa88('0x2'));var BPromise=require(_0xfa88('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfa88('0x4'))['db'];var utils=require(_0xfa88('0x5'));var logger=require('../../config/logger')(_0xfa88('0x6'));var config=require(_0xfa88('0x7'));var jayson=require(_0xfa88('0x8'));var client=jayson[_0xfa88('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53d239,_0x53ca99,_0x34e576){return new BPromise(function(_0x2ea42f,_0x196c63){return client[_0xfa88('0xa')](_0x53d239,_0x34e576)['then'](function(_0x47d446){logger[_0xfa88('0xb')](_0xfa88('0xc'),_0x53ca99,_0xfa88('0xd'));logger['debug'](_0xfa88('0xe'),_0x53ca99,_0xfa88('0xd'),JSON['stringify'](_0x47d446));if(_0x47d446[_0xfa88('0xf')]){if(_0x47d446[_0xfa88('0xf')][_0xfa88('0x10')]===0x1f4){logger[_0xfa88('0xf')](_0xfa88('0xc'),_0x53ca99,_0x47d446[_0xfa88('0xf')]['message']);return _0x196c63(_0x47d446[_0xfa88('0xf')]['message']);}logger[_0xfa88('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x53ca99,_0x47d446[_0xfa88('0xf')][_0xfa88('0x11')]);return _0x2ea42f(_0x47d446['error'][_0xfa88('0x11')]);}else{logger[_0xfa88('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x53ca99,_0xfa88('0xd'));_0x2ea42f(_0x47d446[_0xfa88('0x12')][_0xfa88('0x11')]);}})[_0xfa88('0x13')](function(_0x506f6f){logger[_0xfa88('0xf')](_0xfa88('0xc'),_0x53ca99,_0x506f6f);_0x196c63(_0x506f6f);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index f184eeb..0219e27 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 _0xf3ce=['destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','post','create','put','update'];(function(_0x508c07,_0x33e0ad){var _0x2981d5=function(_0x877500){while(--_0x877500){_0x508c07['push'](_0x508c07['shift']());}};_0x2981d5(++_0x33e0ad);}(_0xf3ce,0xf3));var _0xef3c=function(_0x214185,_0x2d96bf){_0x214185=_0x214185-0x0;var _0x34abeb=_0xf3ce[_0x214185];return _0x34abeb;};'use strict';var multer=require(_0xef3c('0x0'));var util=require(_0xef3c('0x1'));var path=require(_0xef3c('0x2'));var timeout=require(_0xef3c('0x3'));var express=require('express');var router=express[_0xef3c('0x4')]();var fs_extra=require(_0xef3c('0x5'));var auth=require(_0xef3c('0x6'));var interaction=require(_0xef3c('0x7'));var config=require(_0xef3c('0x8'));var controller=require(_0xef3c('0x9'));router[_0xef3c('0xa')]('/',auth['isAuthenticated'](),controller[_0xef3c('0xb')]);router[_0xef3c('0xa')](_0xef3c('0xc'),auth[_0xef3c('0xd')](),controller['show']);router[_0xef3c('0xa')](_0xef3c('0xe'),auth[_0xef3c('0xd')](),controller[_0xef3c('0xf')]);router[_0xef3c('0xa')](_0xef3c('0x10'),auth[_0xef3c('0xd')](),controller['getFields']);router[_0xef3c('0x11')]('/',auth['isAuthenticated'](),controller[_0xef3c('0x12')]);router['post'](_0xef3c('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xef3c('0x13')](_0xef3c('0xc'),auth[_0xef3c('0xd')](),controller[_0xef3c('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xef3c('0x15')]);module['exports']=router; \ No newline at end of file +var _0x7755=['../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','isAuthenticated','get','/:id','show','getConfigurations','/:id/fields','post','create','/:id/configurations','addConfiguration','put','delete','destroy','util','path','connect-timeout','express','../../components/auth/service'];(function(_0xcf0faf,_0x103291){var _0x5d836e=function(_0x48a465){while(--_0x48a465){_0xcf0faf['push'](_0xcf0faf['shift']());}};_0x5d836e(++_0x103291);}(_0x7755,0x18a));var _0x5775=function(_0x9b7a64,_0x38d4a8){_0x9b7a64=_0x9b7a64-0x0;var _0x33fd98=_0x7755[_0x9b7a64];return _0x33fd98;};'use strict';var multer=require('multer');var util=require(_0x5775('0x0'));var path=require(_0x5775('0x1'));var timeout=require(_0x5775('0x2'));var express=require(_0x5775('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5775('0x4'));var interaction=require(_0x5775('0x5'));var config=require(_0x5775('0x6'));var controller=require(_0x5775('0x7'));router['get']('/',auth[_0x5775('0x8')](),controller['index']);router[_0x5775('0x9')](_0x5775('0xa'),auth[_0x5775('0x8')](),controller[_0x5775('0xb')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0x5775('0xc')]);router[_0x5775('0x9')](_0x5775('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x5775('0xe')]('/',auth[_0x5775('0x8')](),controller[_0x5775('0xf')]);router['post'](_0x5775('0x10'),auth[_0x5775('0x8')](),controller[_0x5775('0x11')]);router[_0x5775('0x12')]('/:id',auth[_0x5775('0x8')](),controller['update']);router[_0x5775('0x13')](_0x5775('0xa'),auth['isAuthenticated'](),controller[_0x5775('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 0809919..806d68a 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 _0x39ba=['STRING','integrationTab','newTab','sequelize'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x39ba,0x1f3));var _0xa39b=function(_0x3bf6d0,_0x279624){_0x3bf6d0=_0x3bf6d0-0x0;var _0x22c145=_0x39ba[_0x3bf6d0];return _0x22c145;};'use strict';var Sequelize=require(_0xa39b('0x0'));module['exports']={'name':{'type':Sequelize[_0xa39b('0x1')]},'description':{'type':Sequelize[_0xa39b('0x1')]},'username':{'type':Sequelize[_0xa39b('0x1')],'unique':'username'},'remoteUri':{'type':Sequelize[_0xa39b('0x1')]},'password':{'type':Sequelize[_0xa39b('0x1')]},'clientId':{'type':Sequelize[_0xa39b('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0xa39b('0x1')]},'serverUrl':{'type':Sequelize[_0xa39b('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa39b('0x2'),_0xa39b('0x3')),'defaultValue':_0xa39b('0x2')}}; \ No newline at end of file +var _0x628c=['ENUM','integrationTab','newTab','sequelize','exports','STRING','username'];(function(_0x43b487,_0x21893a){var _0x2f707a=function(_0x477ee0){while(--_0x477ee0){_0x43b487['push'](_0x43b487['shift']());}};_0x2f707a(++_0x21893a);}(_0x628c,0x11b));var _0xc628=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0x628c[_0x5311e8];return _0x582ad8;};'use strict';var Sequelize=require(_0xc628('0x0'));module[_0xc628('0x1')]={'name':{'type':Sequelize[_0xc628('0x2')]},'description':{'type':Sequelize[_0xc628('0x2')]},'username':{'type':Sequelize[_0xc628('0x2')],'unique':_0xc628('0x3')},'remoteUri':{'type':Sequelize[_0xc628('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xc628('0x2')]},'clientSecret':{'type':Sequelize[_0xc628('0x2')]},'securityToken':{'type':Sequelize[_0xc628('0x2')]},'serverUrl':{'type':Sequelize[_0xc628('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc628('0x4')](_0xc628('0x5'),_0xc628('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 1aff8a9..4cc7579 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 _0x8d0a=['debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','update','destroy','stack','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','SalesforceAccount','include','findAll','rows','show','params','includeAll','find','create','body','getConfigurations','findOne','SalesforceConfiguration','length','AccountId','getSubjects','channel','SalesforceField','Subjects','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','lastIndexOf','Connection','login','concat','isNil','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','picklist','email','textarea','phone','remove','name','picklistValues','value','boolean','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','then','info','SalesforceAccount,\x20%s,\x20%s'];(function(_0x4d1095,_0x10d0ec){var _0x326931=function(_0x3af668){while(--_0x3af668){_0x4d1095['push'](_0x4d1095['shift']());}};_0x326931(++_0x10d0ec);}(_0x8d0a,0x65));var _0xa8d0=function(_0x5ca24f,_0x444f1f){_0x5ca24f=_0x5ca24f-0x0;var _0x35c278=_0x8d0a[_0x5ca24f];return _0x35c278;};'use strict';var pdf=require(_0xa8d0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa8d0('0x1'));var zipdir=require(_0xa8d0('0x2'));var jsonpatch=require(_0xa8d0('0x3'));var rp=require(_0xa8d0('0x4'));var moment=require(_0xa8d0('0x5'));var BPromise=require(_0xa8d0('0x6'));var Mustache=require(_0xa8d0('0x7'));var util=require(_0xa8d0('0x8'));var path=require(_0xa8d0('0x9'));var sox=require('sox');var csv=require(_0xa8d0('0xa'));var ejs=require(_0xa8d0('0xb'));var fs=require('fs');var fs_extra=require(_0xa8d0('0xc'));var _=require(_0xa8d0('0xd'));var squel=require(_0xa8d0('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa8d0('0xf'));var toCsv=require(_0xa8d0('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa8d0('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa8d0('0x11'));var hardwareService=require(_0xa8d0('0x12'));var logger=require(_0xa8d0('0x13'))(_0xa8d0('0x14'));var utils=require(_0xa8d0('0x15'));var config=require(_0xa8d0('0x16'));var licenseUtil=require(_0xa8d0('0x17'));var db=require(_0xa8d0('0x18'))['db'];var integrations=require(_0xa8d0('0x19'));var jayson=require(_0xa8d0('0x1a'));var client=jayson[_0xa8d0('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x757540,_0x478f66,_0x5a9193,_0x32ea3e){return new BPromise(function(_0x2816d1,_0x523ec0){var _0x31da9f=_0x32ea3e||client;return _0x31da9f[_0xa8d0('0x1c')](_0x757540,_0x5a9193)[_0xa8d0('0x1d')](function(_0x44a48e){logger[_0xa8d0('0x1e')](_0xa8d0('0x1f'),_0x478f66,'request\x20sent');logger[_0xa8d0('0x20')](_0xa8d0('0x21'),_0x478f66,'request\x20sent',JSON[_0xa8d0('0x22')](_0x44a48e));if(_0x44a48e[_0xa8d0('0x23')]){if(_0x44a48e['error'][_0xa8d0('0x24')]===0x1f4){logger[_0xa8d0('0x23')]('SalesforceAccount,\x20%s,\x20%s',_0x478f66,_0x44a48e['error'][_0xa8d0('0x25')]);return _0x523ec0(_0x44a48e[_0xa8d0('0x23')]['message']);}logger[_0xa8d0('0x23')](_0xa8d0('0x1f'),_0x478f66,_0x44a48e[_0xa8d0('0x23')]['message']);return _0x2816d1(_0x44a48e[_0xa8d0('0x23')]['message']);}else{logger[_0xa8d0('0x1e')](_0xa8d0('0x1f'),_0x478f66,_0xa8d0('0x26'));_0x2816d1(_0x44a48e[_0xa8d0('0x27')][_0xa8d0('0x25')]);}})[_0xa8d0('0x28')](function(_0x41667d){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x478f66,_0x41667d);_0x523ec0(_0x41667d);});});}function respondWithStatusCode(_0x265dce,_0x486422){_0x486422=_0x486422||0xcc;return function(_0x3ec672){if(_0x3ec672){return _0x265dce[_0xa8d0('0x29')](_0x486422);}return _0x265dce[_0xa8d0('0x2a')](_0x486422)[_0xa8d0('0x2b')]();};}function respondWithResult(_0x17bdfc,_0x5b9560){_0x5b9560=_0x5b9560||0xc8;return function(_0x3eab24){if(_0x3eab24){return _0x17bdfc[_0xa8d0('0x2a')](_0x5b9560)[_0xa8d0('0x2c')](_0x3eab24);}};}function respondWithFilteredResult(_0x2f692d,_0x59904b){return function(_0x1adc0d){if(_0x1adc0d){var _0x80390d=_0x1adc0d[_0xa8d0('0x2d')],_0x28ba73=_0x59904b[_0xa8d0('0x2e')],_0x5127cb=_0x59904b[_0xa8d0('0x2e')]+_0x59904b[_0xa8d0('0x2f')],_0x195dae;if(_0x5127cb>=_0x80390d){_0x5127cb=_0x80390d;_0x195dae=0xc8;}else{_0x195dae=0xce;}_0x2f692d[_0xa8d0('0x2a')](_0x195dae);return _0x2f692d['set'](_0xa8d0('0x30'),_0x28ba73+'-'+_0x5127cb+'/'+_0x80390d)[_0xa8d0('0x2c')](_0x1adc0d);}return null;};}function patchUpdates(_0x151fb3){return function(_0x78777c){try{jsonpatch['apply'](_0x78777c,_0x151fb3,!![]);}catch(_0x2d3725){return BPromise[_0xa8d0('0x31')](_0x2d3725);}return _0x78777c['save']();};}function saveUpdates(_0x4ff35a,_0x55c66d){return function(_0x157de6){if(_0x157de6){return _0x157de6[_0xa8d0('0x32')](_0x4ff35a)[_0xa8d0('0x1d')](function(_0x2127ee){return _0x2127ee;});}return null;};}function removeEntity(_0x39912a,_0x165560){return function(_0xebcde5){if(_0xebcde5){return _0xebcde5[_0xa8d0('0x33')]()[_0xa8d0('0x1d')](function(){_0x39912a[_0xa8d0('0x2a')](0xcc)[_0xa8d0('0x2b')]();});}};}function handleEntityNotFound(_0x493e76,_0x4b0790){return function(_0x36e516){if(!_0x36e516){_0x493e76['sendStatus'](0x194);}return _0x36e516;};}function handleError(_0xedfa61,_0x405421){_0x405421=_0x405421||0x1f4;return function(_0x3ef3e1){logger[_0xa8d0('0x23')](_0x3ef3e1[_0xa8d0('0x34')]);if(_0x3ef3e1['name']){delete _0x3ef3e1['name'];}_0xedfa61[_0xa8d0('0x2a')](_0x405421)[_0xa8d0('0x35')](_0x3ef3e1);};}exports[_0xa8d0('0x36')]=function(_0x1352ed,_0x267f90){var _0x2fd537={},_0x5b2d5e={},_0x12fff6={'count':0x0,'rows':[]};var _0x2a046d=_[_0xa8d0('0x37')](db['SalesforceAccount'][_0xa8d0('0x38')],function(_0x4ac500){return{'name':_0x4ac500[_0xa8d0('0x39')],'type':_0x4ac500[_0xa8d0('0x3a')][_0xa8d0('0x3b')]};});_0x5b2d5e[_0xa8d0('0x3c')]=_[_0xa8d0('0x37')](_0x2a046d,'name');_0x5b2d5e[_0xa8d0('0x3d')]=_[_0xa8d0('0x3e')](_0x1352ed[_0xa8d0('0x3d')]);_0x5b2d5e[_0xa8d0('0x3f')]=_[_0xa8d0('0x40')](_0x5b2d5e[_0xa8d0('0x3c')],_0x5b2d5e['query']);_0x2fd537[_0xa8d0('0x41')]=_[_0xa8d0('0x40')](_0x5b2d5e[_0xa8d0('0x3c')],qs[_0xa8d0('0x42')](_0x1352ed[_0xa8d0('0x3d')][_0xa8d0('0x42')]));_0x2fd537[_0xa8d0('0x41')]=_0x2fd537[_0xa8d0('0x41')]['length']?_0x2fd537[_0xa8d0('0x41')]:_0x5b2d5e['model'];if(!_0x1352ed[_0xa8d0('0x3d')][_0xa8d0('0x43')](_0xa8d0('0x44'))){_0x2fd537[_0xa8d0('0x2f')]=qs[_0xa8d0('0x2f')](_0x1352ed[_0xa8d0('0x3d')][_0xa8d0('0x2f')]);_0x2fd537[_0xa8d0('0x2e')]=qs[_0xa8d0('0x2e')](_0x1352ed[_0xa8d0('0x3d')][_0xa8d0('0x2e')]);}_0x2fd537[_0xa8d0('0x45')]=qs['sort'](_0x1352ed[_0xa8d0('0x3d')][_0xa8d0('0x46')]);_0x2fd537[_0xa8d0('0x47')]=qs[_0xa8d0('0x3f')](_[_0xa8d0('0x48')](_0x1352ed[_0xa8d0('0x3d')],_0x5b2d5e['filters']),_0x2a046d);if(_0x1352ed[_0xa8d0('0x3d')][_0xa8d0('0x49')]){_0x2fd537[_0xa8d0('0x47')]=_[_0xa8d0('0x4a')](_0x2fd537[_0xa8d0('0x47')],{'$or':_[_0xa8d0('0x37')](_0x2a046d,function(_0x8f6504){if(_0x8f6504[_0xa8d0('0x3a')]!=='VIRTUAL'){var _0x16c31b={};_0x16c31b[_0x8f6504['name']]={'$like':'%'+_0x1352ed[_0xa8d0('0x3d')][_0xa8d0('0x49')]+'%'};return _0x16c31b;}})});}_0x2fd537=_[_0xa8d0('0x4a')]({},_0x2fd537,_0x1352ed[_0xa8d0('0x4b')]);var _0x479b67={'where':_0x2fd537[_0xa8d0('0x47')]};return db[_0xa8d0('0x4c')]['count'](_0x479b67)[_0xa8d0('0x1d')](function(_0x4b0d20){_0x12fff6[_0xa8d0('0x2d')]=_0x4b0d20;if(_0x1352ed['query']['includeAll']){_0x2fd537[_0xa8d0('0x4d')]=[{'all':!![]}];}return db[_0xa8d0('0x4c')][_0xa8d0('0x4e')](_0x2fd537);})[_0xa8d0('0x1d')](function(_0x50014c){_0x12fff6[_0xa8d0('0x4f')]=_0x50014c;return _0x12fff6;})[_0xa8d0('0x1d')](respondWithFilteredResult(_0x267f90,_0x2fd537))[_0xa8d0('0x28')](handleError(_0x267f90,null));};exports[_0xa8d0('0x50')]=function(_0x2258d1,_0x4eda65){var _0x1161bf={'raw':![],'where':{'id':_0x2258d1[_0xa8d0('0x51')]['id']}},_0x533680={};_0x533680[_0xa8d0('0x3c')]=_[_0xa8d0('0x3e')](db['SalesforceAccount'][_0xa8d0('0x38')]);_0x533680[_0xa8d0('0x3d')]=_[_0xa8d0('0x3e')](_0x2258d1[_0xa8d0('0x3d')]);_0x533680[_0xa8d0('0x3f')]=_['intersection'](_0x533680[_0xa8d0('0x3c')],_0x533680[_0xa8d0('0x3d')]);_0x1161bf['attributes']=_[_0xa8d0('0x40')](_0x533680[_0xa8d0('0x3c')],qs[_0xa8d0('0x42')](_0x2258d1[_0xa8d0('0x3d')][_0xa8d0('0x42')]));_0x1161bf[_0xa8d0('0x41')]=_0x1161bf[_0xa8d0('0x41')]['length']?_0x1161bf[_0xa8d0('0x41')]:_0x533680['model'];if(_0x2258d1['query'][_0xa8d0('0x52')]){_0x1161bf[_0xa8d0('0x4d')]=[{'all':!![]}];}_0x1161bf=_['merge']({},_0x1161bf,_0x2258d1[_0xa8d0('0x4b')]);return db[_0xa8d0('0x4c')][_0xa8d0('0x53')](_0x1161bf)[_0xa8d0('0x1d')](handleEntityNotFound(_0x4eda65,null))[_0xa8d0('0x1d')](respondWithResult(_0x4eda65,null))['catch'](handleError(_0x4eda65,null));};exports[_0xa8d0('0x54')]=function(_0x1ab6f1,_0x39e707){return db[_0xa8d0('0x4c')][_0xa8d0('0x54')](_0x1ab6f1[_0xa8d0('0x55')],{})['then'](respondWithResult(_0x39e707,0xc9))[_0xa8d0('0x28')](handleError(_0x39e707,null));};exports[_0xa8d0('0x32')]=function(_0x1c5e12,_0x4b25b4){if(_0x1c5e12[_0xa8d0('0x55')]['id']){delete _0x1c5e12[_0xa8d0('0x55')]['id'];}return db[_0xa8d0('0x4c')][_0xa8d0('0x53')]({'where':{'id':_0x1c5e12[_0xa8d0('0x51')]['id']}})[_0xa8d0('0x1d')](handleEntityNotFound(_0x4b25b4,null))[_0xa8d0('0x1d')](saveUpdates(_0x1c5e12[_0xa8d0('0x55')],null))[_0xa8d0('0x1d')](respondWithResult(_0x4b25b4,null))[_0xa8d0('0x28')](handleError(_0x4b25b4,null));};exports[_0xa8d0('0x33')]=function(_0x472a82,_0x3c455e){return db['SalesforceAccount'][_0xa8d0('0x53')]({'where':{'id':_0x472a82['params']['id']}})[_0xa8d0('0x1d')](handleEntityNotFound(_0x3c455e,null))['then'](removeEntity(_0x3c455e,null))['catch'](handleError(_0x3c455e,null));};exports[_0xa8d0('0x56')]=function(_0x37daf5,_0xe990f9,_0x4e6016){var _0x5e3608={};var _0x201053={};var _0x2af260;var _0x261935;return db['SalesforceAccount'][_0xa8d0('0x57')]({'where':{'id':_0x37daf5[_0xa8d0('0x51')]['id']}})[_0xa8d0('0x1d')](handleEntityNotFound(_0xe990f9,null))[_0xa8d0('0x1d')](function(_0x20d3fe){if(_0x20d3fe){_0x2af260=_0x20d3fe;_0x201053[_0xa8d0('0x3c')]=_['keys'](db[_0xa8d0('0x58')][_0xa8d0('0x38')]);_0x201053[_0xa8d0('0x3d')]=_[_0xa8d0('0x3e')](_0x37daf5[_0xa8d0('0x3d')]);_0x201053[_0xa8d0('0x3f')]=_[_0xa8d0('0x40')](_0x201053[_0xa8d0('0x3c')],_0x201053[_0xa8d0('0x3d')]);_0x5e3608[_0xa8d0('0x41')]=_['intersection'](_0x201053[_0xa8d0('0x3c')],qs[_0xa8d0('0x42')](_0x37daf5['query'][_0xa8d0('0x42')]));_0x5e3608['attributes']=_0x5e3608[_0xa8d0('0x41')][_0xa8d0('0x59')]?_0x5e3608[_0xa8d0('0x41')]:_0x201053[_0xa8d0('0x3c')];_0x5e3608['order']=qs['sort'](_0x37daf5[_0xa8d0('0x3d')][_0xa8d0('0x46')]);_0x5e3608[_0xa8d0('0x47')]=qs[_0xa8d0('0x3f')](_[_0xa8d0('0x48')](_0x37daf5[_0xa8d0('0x3d')],_0x201053[_0xa8d0('0x3f')]));if(_0x37daf5[_0xa8d0('0x3d')][_0xa8d0('0x49')]){_0x5e3608['where']=_[_0xa8d0('0x4a')](_0x5e3608[_0xa8d0('0x47')],{'$or':_[_0xa8d0('0x37')](_0x5e3608[_0xa8d0('0x41')],function(_0x5a2817){var _0x682412={};_0x682412[_0x5a2817]={'$like':'%'+_0x37daf5[_0xa8d0('0x3d')][_0xa8d0('0x49')]+'%'};return _0x682412;})});}_0x5e3608=_[_0xa8d0('0x4a')]({},_0x5e3608,_0x37daf5['options']);return _0x2af260[_0xa8d0('0x56')](_0x5e3608);}})[_0xa8d0('0x1d')](function(_0x363ff7){if(_0x363ff7){_0x261935=_0x363ff7['length'];if(!_0x37daf5[_0xa8d0('0x3d')][_0xa8d0('0x43')](_0xa8d0('0x44'))){_0x5e3608[_0xa8d0('0x2f')]=qs[_0xa8d0('0x2f')](_0x37daf5['query'][_0xa8d0('0x2f')]);_0x5e3608[_0xa8d0('0x2e')]=qs['offset'](_0x37daf5[_0xa8d0('0x3d')][_0xa8d0('0x2e')]);}return _0x2af260[_0xa8d0('0x56')](_0x5e3608);}})[_0xa8d0('0x1d')](function(_0x1a2f24){if(_0x1a2f24){return _0x1a2f24?{'count':_0x261935,'rows':_0x1a2f24}:null;}})[_0xa8d0('0x1d')](respondWithResult(_0xe990f9,null))[_0xa8d0('0x28')](handleError(_0xe990f9,null));};exports['addConfiguration']=function(_0x1760df,_0x38d420,_0x2307a1){if(_0x1760df[_0xa8d0('0x55')]['id']){delete _0x1760df[_0xa8d0('0x55')]['id'];}return db[_0xa8d0('0x4c')][_0xa8d0('0x57')]({'where':{'id':_0x1760df[_0xa8d0('0x51')]['id']}})['then'](handleEntityNotFound(_0x38d420,null))[_0xa8d0('0x1d')](function(_0x37a302){if(_0x37a302){_0x1760df[_0xa8d0('0x55')][_0xa8d0('0x5a')]=_0x37a302['id'];_0x1760df[_0xa8d0('0x55')]['Subjects']=integrations[_0xa8d0('0x5b')](_0x1760df[_0xa8d0('0x55')][_0xa8d0('0x5c')],_0x1760df[_0xa8d0('0x55')][_0xa8d0('0x3a')]);_0x1760df['body']['Descriptions']=integrations['getDescriptions'](_0x1760df[_0xa8d0('0x55')][_0xa8d0('0x5c')],_0x1760df[_0xa8d0('0x55')]['type']);return db[_0xa8d0('0x58')][_0xa8d0('0x54')](_0x1760df['body'],{'include':[{'model':db[_0xa8d0('0x5d')],'as':_0xa8d0('0x5e')},{'model':db[_0xa8d0('0x5d')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x38d420,null))['catch'](handleError(_0x38d420,null));};exports[_0xa8d0('0x5f')]=function(_0x5ea683,_0x1effc3,_0x29d2c1){var _0x185a62;var _0x167f21='';var _0x5c8ce5=_0xa8d0('0x60');return db[_0xa8d0('0x4c')][_0xa8d0('0x57')]({'where':{'id':_0x5ea683['params']['id']},'attributes':['id',_0xa8d0('0x61'),_0xa8d0('0x62'),_0xa8d0('0x63'),_0xa8d0('0x64'),_0xa8d0('0x65'),_0xa8d0('0x66')]})[_0xa8d0('0x1d')](handleEntityNotFound(_0x1effc3,null))[_0xa8d0('0x1d')](function(_0xddddd8){if(_0xddddd8){_0x167f21=_0xddddd8['remoteUri'];var _0x1079fc=_0x167f21['slice'](-0x1);if(_0x1079fc==='/'){_0x167f21=_0x167f21['substring'](0x0,_0x167f21[_0xa8d0('0x67')](_0x1079fc));}_0x185a62=new jsforce[(_0xa8d0('0x68'))]({'oauth2':{'loginUrl':_0x167f21,'clientId':_0xddddd8['clientId'],'clientSecret':_0xddddd8['clientSecret']}});return _0x185a62[_0xa8d0('0x69')](_0xddddd8[_0xa8d0('0x64')],_0xddddd8[_0xa8d0('0x65')][_0xa8d0('0x6a')](_0xddddd8[_0xa8d0('0x66')]));}})['then'](function(_0x51fccf){if(_0x51fccf){if(!_[_0xa8d0('0x6b')](_0x5ea683[_0xa8d0('0x3d')]['ticketType'])){_0x5c8ce5=_0x5ea683[_0xa8d0('0x3d')]['ticketType'];}return _0x185a62[_0xa8d0('0x6c')](_0x5c8ce5)[_0xa8d0('0x6d')]();}})[_0xa8d0('0x1d')](function(_0x4dad88){var _0x5ec65b=['OwnerId',_0xa8d0('0x6e'),_0xa8d0('0x6f'),_0xa8d0('0x70'),_0xa8d0('0x71'),_0xa8d0('0x72')];var _0x4180f3=[_0xa8d0('0x73'),'int',_0xa8d0('0x74'),'boolean',_0xa8d0('0x75'),_0xa8d0('0x76'),_0xa8d0('0x77')];if(_0x4dad88){_[_0xa8d0('0x78')](_0x4dad88[_0xa8d0('0x42')],function(_0x85bb67){return _0x5ec65b['includes'](_0x85bb67['name'])||!_0x4180f3['includes'](_0x85bb67[_0xa8d0('0x3a')]);});return{'count':_0x4dad88[_0xa8d0('0x42')][_0xa8d0('0x59')],'rows':_[_0xa8d0('0x37')](_0x4dad88[_0xa8d0('0x42')],function(_0x2e439b){return{'id':_0x2e439b[_0xa8d0('0x79')],'name':_0x2e439b['label'],'custom':_0x2e439b['custom'],'options':_0x2e439b[_0xa8d0('0x7a')][_0xa8d0('0x59')]>0x0?_['map'](_0x2e439b[_0xa8d0('0x7a')],function(_0x49e98e){return{'name':_0x49e98e['label'],'value':_0x49e98e[_0xa8d0('0x7b')]};}):_0x2e439b[_0xa8d0('0x3a')]==_0xa8d0('0x7c')?[{'name':_0xa8d0('0x7d'),'value':_0xa8d0('0x7e')},{'name':_0xa8d0('0x7f'),'value':_0xa8d0('0x80')}]:[]};})};}})[_0xa8d0('0x1d')](respondWithResult(_0x1effc3,null))['catch'](function(_0x24a5ec){var _0x51ec92=_0x5ea683[_0xa8d0('0x3d')][_0xa8d0('0x81')]?0x1f4:_0x24a5ec[_0xa8d0('0x82')]||0x1f4;logger[_0xa8d0('0x23')](_0xa8d0('0x83'),'getFields',_0x51ec92,JSON['stringify'](_0x24a5ec));delete _0x24a5ec[_0xa8d0('0x79')];if(_0x51ec92===0x191){_0x51ec92=0x190;}_0x1effc3[_0xa8d0('0x2a')](_0x51ec92)[_0xa8d0('0x35')](_0x5ea683[_0xa8d0('0x3d')][_0xa8d0('0x81')]?{'message':_0xa8d0('0x84'),'statusCode':_0x24a5ec[_0xa8d0('0x82')]}:_0x24a5ec);});}; \ No newline at end of file +var _0x8819=['isNil','ticketType','describe','OwnerId','ActivityDate','Subject','Description','string','int','picklist','boolean','textarea','remove','includes','label','custom','length','True','true','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','error','message','catch','sendStatus','end','status','json','offset','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','SalesforceAccount','count','includeAll','include','findAll','show','params','options','find','create','body','SalesforceConfiguration','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceField','getFields','Task','clientId','clientSecret','username','password','securityToken','slice','substring','Connection','login'];(function(_0x5503b8,_0x59b3be){var _0x463b9c=function(_0x4a9108){while(--_0x4a9108){_0x5503b8['push'](_0x5503b8['shift']());}};_0x463b9c(++_0x59b3be);}(_0x8819,0x94));var _0x9881=function(_0x298cfb,_0x112202){_0x298cfb=_0x298cfb-0x0;var _0x574c8b=_0x8819[_0x298cfb];return _0x574c8b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9881('0x0'));var zipdir=require(_0x9881('0x1'));var jsonpatch=require(_0x9881('0x2'));var rp=require(_0x9881('0x3'));var moment=require(_0x9881('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9881('0x5'));var util=require(_0x9881('0x6'));var path=require(_0x9881('0x7'));var sox=require(_0x9881('0x8'));var csv=require(_0x9881('0x9'));var ejs=require(_0x9881('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9881('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9881('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9881('0xd'));var Papa=require('papaparse');var Redis=require(_0x9881('0xe'));var authService=require(_0x9881('0xf'));var qs=require(_0x9881('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9881('0x11'));var logger=require(_0x9881('0x12'))(_0x9881('0x13'));var utils=require(_0x9881('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9881('0x15'));var db=require(_0x9881('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x9881('0x17'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x48cfe1,_0x58f526,_0x12794f,_0x3178d7){return new BPromise(function(_0x39f5fb,_0x1947e8){var _0x39d127=_0x3178d7||client;return _0x39d127[_0x9881('0x18')](_0x48cfe1,_0x12794f)['then'](function(_0x411513){logger[_0x9881('0x19')](_0x9881('0x1a'),_0x58f526,'request\x20sent');logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x58f526,_0x9881('0x1b'),JSON['stringify'](_0x411513));if(_0x411513[_0x9881('0x1c')]){if(_0x411513['error']['code']===0x1f4){logger[_0x9881('0x1c')](_0x9881('0x1a'),_0x58f526,_0x411513[_0x9881('0x1c')][_0x9881('0x1d')]);return _0x1947e8(_0x411513[_0x9881('0x1c')][_0x9881('0x1d')]);}logger[_0x9881('0x1c')](_0x9881('0x1a'),_0x58f526,_0x411513[_0x9881('0x1c')][_0x9881('0x1d')]);return _0x39f5fb(_0x411513[_0x9881('0x1c')][_0x9881('0x1d')]);}else{logger[_0x9881('0x19')](_0x9881('0x1a'),_0x58f526,_0x9881('0x1b'));_0x39f5fb(_0x411513['result']['message']);}})[_0x9881('0x1e')](function(_0x513545){logger['error'](_0x9881('0x1a'),_0x58f526,_0x513545);_0x1947e8(_0x513545);});});}function respondWithStatusCode(_0x30ed15,_0x55119c){_0x55119c=_0x55119c||0xcc;return function(_0x501343){if(_0x501343){return _0x30ed15[_0x9881('0x1f')](_0x55119c);}return _0x30ed15['status'](_0x55119c)[_0x9881('0x20')]();};}function respondWithResult(_0x161f8d,_0x16eeca){_0x16eeca=_0x16eeca||0xc8;return function(_0x418263){if(_0x418263){return _0x161f8d[_0x9881('0x21')](_0x16eeca)[_0x9881('0x22')](_0x418263);}};}function respondWithFilteredResult(_0x2f6b7c,_0x2d4452){return function(_0xc328b7){if(_0xc328b7){var _0x23727b=_0xc328b7['count'],_0x900eae=_0x2d4452[_0x9881('0x23')],_0x2bcdc3=_0x2d4452[_0x9881('0x23')]+_0x2d4452['limit'],_0x1f8fdd;if(_0x2bcdc3>=_0x23727b){_0x2bcdc3=_0x23727b;_0x1f8fdd=0xc8;}else{_0x1f8fdd=0xce;}_0x2f6b7c[_0x9881('0x21')](_0x1f8fdd);return _0x2f6b7c[_0x9881('0x24')]('Content-Range',_0x900eae+'-'+_0x2bcdc3+'/'+_0x23727b)[_0x9881('0x22')](_0xc328b7);}return null;};}function patchUpdates(_0x3b6c6f){return function(_0x217a1c){try{jsonpatch[_0x9881('0x25')](_0x217a1c,_0x3b6c6f,!![]);}catch(_0x3567dc){return BPromise[_0x9881('0x26')](_0x3567dc);}return _0x217a1c[_0x9881('0x27')]();};}function saveUpdates(_0x2d2b65,_0x4b203f){return function(_0x140ba8){if(_0x140ba8){return _0x140ba8[_0x9881('0x28')](_0x2d2b65)[_0x9881('0x29')](function(_0x4685a4){return _0x4685a4;});}return null;};}function removeEntity(_0xffc845,_0x237fce){return function(_0x495ee0){if(_0x495ee0){return _0x495ee0[_0x9881('0x2a')]()[_0x9881('0x29')](function(){_0xffc845['status'](0xcc)[_0x9881('0x20')]();});}};}function handleEntityNotFound(_0x46f9ee,_0x23537b){return function(_0x101e6e){if(!_0x101e6e){_0x46f9ee[_0x9881('0x1f')](0x194);}return _0x101e6e;};}function handleError(_0x48b39c,_0x3ed677){_0x3ed677=_0x3ed677||0x1f4;return function(_0x152abc){logger[_0x9881('0x1c')](_0x152abc[_0x9881('0x2b')]);if(_0x152abc[_0x9881('0x2c')]){delete _0x152abc[_0x9881('0x2c')];}_0x48b39c[_0x9881('0x21')](_0x3ed677)[_0x9881('0x2d')](_0x152abc);};}exports[_0x9881('0x2e')]=function(_0x26c829,_0x4694af){var _0x9bbbe8={},_0xfff6a5={},_0x136f9a={'count':0x0,'rows':[]};var _0x450ee9=_[_0x9881('0x2f')](db['SalesforceAccount'][_0x9881('0x30')],function(_0x5f14d5){return{'name':_0x5f14d5[_0x9881('0x31')],'type':_0x5f14d5['type'][_0x9881('0x32')]};});_0xfff6a5[_0x9881('0x33')]=_['map'](_0x450ee9,_0x9881('0x2c'));_0xfff6a5['query']=_[_0x9881('0x34')](_0x26c829[_0x9881('0x35')]);_0xfff6a5[_0x9881('0x36')]=_[_0x9881('0x37')](_0xfff6a5['model'],_0xfff6a5[_0x9881('0x35')]);_0x9bbbe8[_0x9881('0x38')]=_[_0x9881('0x37')](_0xfff6a5[_0x9881('0x33')],qs[_0x9881('0x39')](_0x26c829[_0x9881('0x35')][_0x9881('0x39')]));_0x9bbbe8['attributes']=_0x9bbbe8[_0x9881('0x38')]['length']?_0x9bbbe8[_0x9881('0x38')]:_0xfff6a5[_0x9881('0x33')];if(!_0x26c829[_0x9881('0x35')]['hasOwnProperty'](_0x9881('0x3a'))){_0x9bbbe8[_0x9881('0x3b')]=qs[_0x9881('0x3b')](_0x26c829['query'][_0x9881('0x3b')]);_0x9bbbe8[_0x9881('0x23')]=qs['offset'](_0x26c829[_0x9881('0x35')][_0x9881('0x23')]);}_0x9bbbe8[_0x9881('0x3c')]=qs[_0x9881('0x3d')](_0x26c829[_0x9881('0x35')][_0x9881('0x3d')]);_0x9bbbe8[_0x9881('0x3e')]=qs[_0x9881('0x36')](_[_0x9881('0x3f')](_0x26c829[_0x9881('0x35')],_0xfff6a5['filters']),_0x450ee9);if(_0x26c829[_0x9881('0x35')][_0x9881('0x40')]){_0x9bbbe8[_0x9881('0x3e')]=_[_0x9881('0x41')](_0x9bbbe8[_0x9881('0x3e')],{'$or':_['map'](_0x450ee9,function(_0x249391){if(_0x249391[_0x9881('0x42')]!==_0x9881('0x43')){var _0x3bd039={};_0x3bd039[_0x249391['name']]={'$like':'%'+_0x26c829[_0x9881('0x35')][_0x9881('0x40')]+'%'};return _0x3bd039;}})});}_0x9bbbe8=_[_0x9881('0x41')]({},_0x9bbbe8,_0x26c829['options']);var _0x249c07={'where':_0x9bbbe8[_0x9881('0x3e')]};return db[_0x9881('0x44')][_0x9881('0x45')](_0x249c07)[_0x9881('0x29')](function(_0x391777){_0x136f9a[_0x9881('0x45')]=_0x391777;if(_0x26c829[_0x9881('0x35')][_0x9881('0x46')]){_0x9bbbe8[_0x9881('0x47')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x9881('0x48')](_0x9bbbe8);})[_0x9881('0x29')](function(_0x3c9490){_0x136f9a['rows']=_0x3c9490;return _0x136f9a;})[_0x9881('0x29')](respondWithFilteredResult(_0x4694af,_0x9bbbe8))[_0x9881('0x1e')](handleError(_0x4694af,null));};exports[_0x9881('0x49')]=function(_0x573b4f,_0x52b7fd){var _0x319ea4={'raw':![],'where':{'id':_0x573b4f[_0x9881('0x4a')]['id']}},_0x3cb47d={};_0x3cb47d[_0x9881('0x33')]=_['keys'](db['SalesforceAccount'][_0x9881('0x30')]);_0x3cb47d[_0x9881('0x35')]=_[_0x9881('0x34')](_0x573b4f['query']);_0x3cb47d[_0x9881('0x36')]=_[_0x9881('0x37')](_0x3cb47d['model'],_0x3cb47d[_0x9881('0x35')]);_0x319ea4[_0x9881('0x38')]=_[_0x9881('0x37')](_0x3cb47d[_0x9881('0x33')],qs[_0x9881('0x39')](_0x573b4f[_0x9881('0x35')][_0x9881('0x39')]));_0x319ea4['attributes']=_0x319ea4[_0x9881('0x38')]['length']?_0x319ea4[_0x9881('0x38')]:_0x3cb47d[_0x9881('0x33')];if(_0x573b4f[_0x9881('0x35')][_0x9881('0x46')]){_0x319ea4['include']=[{'all':!![]}];}_0x319ea4=_['merge']({},_0x319ea4,_0x573b4f[_0x9881('0x4b')]);return db[_0x9881('0x44')][_0x9881('0x4c')](_0x319ea4)['then'](handleEntityNotFound(_0x52b7fd,null))[_0x9881('0x29')](respondWithResult(_0x52b7fd,null))[_0x9881('0x1e')](handleError(_0x52b7fd,null));};exports[_0x9881('0x4d')]=function(_0x4559a6,_0xa03650){return db[_0x9881('0x44')]['create'](_0x4559a6[_0x9881('0x4e')],{})[_0x9881('0x29')](respondWithResult(_0xa03650,0xc9))[_0x9881('0x1e')](handleError(_0xa03650,null));};exports[_0x9881('0x28')]=function(_0x154090,_0x52da22){if(_0x154090['body']['id']){delete _0x154090['body']['id'];}return db[_0x9881('0x44')][_0x9881('0x4c')]({'where':{'id':_0x154090[_0x9881('0x4a')]['id']}})[_0x9881('0x29')](handleEntityNotFound(_0x52da22,null))[_0x9881('0x29')](saveUpdates(_0x154090[_0x9881('0x4e')],null))['then'](respondWithResult(_0x52da22,null))['catch'](handleError(_0x52da22,null));};exports[_0x9881('0x2a')]=function(_0x4429a4,_0x5e53c8){return db[_0x9881('0x44')][_0x9881('0x4c')]({'where':{'id':_0x4429a4[_0x9881('0x4a')]['id']}})[_0x9881('0x29')](handleEntityNotFound(_0x5e53c8,null))['then'](removeEntity(_0x5e53c8,null))[_0x9881('0x1e')](handleError(_0x5e53c8,null));};exports['getConfigurations']=function(_0x2a7954,_0xbbdd7c,_0x4c11cb){var _0x506371={};var _0x594da8={};var _0x489fc0;var _0x3ae4fa;return db[_0x9881('0x44')]['findOne']({'where':{'id':_0x2a7954[_0x9881('0x4a')]['id']}})[_0x9881('0x29')](handleEntityNotFound(_0xbbdd7c,null))[_0x9881('0x29')](function(_0x165274){if(_0x165274){_0x489fc0=_0x165274;_0x594da8[_0x9881('0x33')]=_[_0x9881('0x34')](db[_0x9881('0x4f')][_0x9881('0x30')]);_0x594da8['query']=_['keys'](_0x2a7954[_0x9881('0x35')]);_0x594da8[_0x9881('0x36')]=_[_0x9881('0x37')](_0x594da8[_0x9881('0x33')],_0x594da8[_0x9881('0x35')]);_0x506371[_0x9881('0x38')]=_['intersection'](_0x594da8[_0x9881('0x33')],qs[_0x9881('0x39')](_0x2a7954[_0x9881('0x35')][_0x9881('0x39')]));_0x506371['attributes']=_0x506371[_0x9881('0x38')]['length']?_0x506371[_0x9881('0x38')]:_0x594da8[_0x9881('0x33')];_0x506371[_0x9881('0x3c')]=qs[_0x9881('0x3d')](_0x2a7954['query']['sort']);_0x506371[_0x9881('0x3e')]=qs['filters'](_['pick'](_0x2a7954[_0x9881('0x35')],_0x594da8[_0x9881('0x36')]));if(_0x2a7954[_0x9881('0x35')]['filter']){_0x506371[_0x9881('0x3e')]=_[_0x9881('0x41')](_0x506371['where'],{'$or':_[_0x9881('0x2f')](_0x506371[_0x9881('0x38')],function(_0x4d5ea0){var _0x21503c={};_0x21503c[_0x4d5ea0]={'$like':'%'+_0x2a7954['query'][_0x9881('0x40')]+'%'};return _0x21503c;})});}_0x506371=_[_0x9881('0x41')]({},_0x506371,_0x2a7954[_0x9881('0x4b')]);return _0x489fc0[_0x9881('0x50')](_0x506371);}})[_0x9881('0x29')](function(_0x2d4bc4){if(_0x2d4bc4){_0x3ae4fa=_0x2d4bc4['length'];if(!_0x2a7954[_0x9881('0x35')][_0x9881('0x51')](_0x9881('0x3a'))){_0x506371[_0x9881('0x3b')]=qs[_0x9881('0x3b')](_0x2a7954[_0x9881('0x35')][_0x9881('0x3b')]);_0x506371[_0x9881('0x23')]=qs[_0x9881('0x23')](_0x2a7954[_0x9881('0x35')][_0x9881('0x23')]);}return _0x489fc0['getConfigurations'](_0x506371);}})[_0x9881('0x29')](function(_0xd355c){if(_0xd355c){return _0xd355c?{'count':_0x3ae4fa,'rows':_0xd355c}:null;}})['then'](respondWithResult(_0xbbdd7c,null))[_0x9881('0x1e')](handleError(_0xbbdd7c,null));};exports[_0x9881('0x52')]=function(_0x55130d,_0xfb3ff1,_0x39dba7){if(_0x55130d[_0x9881('0x4e')]['id']){delete _0x55130d[_0x9881('0x4e')]['id'];}return db[_0x9881('0x44')]['findOne']({'where':{'id':_0x55130d[_0x9881('0x4a')]['id']}})[_0x9881('0x29')](handleEntityNotFound(_0xfb3ff1,null))[_0x9881('0x29')](function(_0x4a648f){if(_0x4a648f){_0x55130d[_0x9881('0x4e')][_0x9881('0x53')]=_0x4a648f['id'];_0x55130d[_0x9881('0x4e')][_0x9881('0x54')]=integrations[_0x9881('0x55')](_0x55130d['body'][_0x9881('0x56')],_0x55130d['body'][_0x9881('0x42')]);_0x55130d[_0x9881('0x4e')][_0x9881('0x57')]=integrations['getDescriptions'](_0x55130d[_0x9881('0x4e')][_0x9881('0x56')],_0x55130d['body'][_0x9881('0x42')]);return db[_0x9881('0x4f')][_0x9881('0x4d')](_0x55130d[_0x9881('0x4e')],{'include':[{'model':db[_0x9881('0x58')],'as':_0x9881('0x54')},{'model':db['SalesforceField'],'as':_0x9881('0x57')}]});}return null;})[_0x9881('0x29')](respondWithResult(_0xfb3ff1,null))[_0x9881('0x1e')](handleError(_0xfb3ff1,null));};exports[_0x9881('0x59')]=function(_0x578ac5,_0x1489cf,_0x30bd50){var _0x5125c1;var _0x142cfa='';var _0x30a343=_0x9881('0x5a');return db['SalesforceAccount']['findOne']({'where':{'id':_0x578ac5['params']['id']},'attributes':['id','remoteUri',_0x9881('0x5b'),_0x9881('0x5c'),_0x9881('0x5d'),_0x9881('0x5e'),_0x9881('0x5f')]})[_0x9881('0x29')](handleEntityNotFound(_0x1489cf,null))[_0x9881('0x29')](function(_0x455cc2){if(_0x455cc2){_0x142cfa=_0x455cc2['remoteUri'];var _0x21de06=_0x142cfa[_0x9881('0x60')](-0x1);if(_0x21de06==='/'){_0x142cfa=_0x142cfa[_0x9881('0x61')](0x0,_0x142cfa['lastIndexOf'](_0x21de06));}_0x5125c1=new jsforce[(_0x9881('0x62'))]({'oauth2':{'loginUrl':_0x142cfa,'clientId':_0x455cc2[_0x9881('0x5b')],'clientSecret':_0x455cc2[_0x9881('0x5c')]}});return _0x5125c1[_0x9881('0x63')](_0x455cc2[_0x9881('0x5d')],_0x455cc2[_0x9881('0x5e')]['concat'](_0x455cc2['securityToken']));}})[_0x9881('0x29')](function(_0x328d3e){if(_0x328d3e){if(!_[_0x9881('0x64')](_0x578ac5['query'][_0x9881('0x65')])){_0x30a343=_0x578ac5[_0x9881('0x35')][_0x9881('0x65')];}return _0x5125c1['sobject'](_0x30a343)[_0x9881('0x66')]();}})[_0x9881('0x29')](function(_0x2f654f){var _0x472ad1=[_0x9881('0x67'),_0x9881('0x68'),'IsReminderSet','IsRecurrence',_0x9881('0x69'),_0x9881('0x6a')];var _0x4c2acd=[_0x9881('0x6b'),_0x9881('0x6c'),_0x9881('0x6d'),_0x9881('0x6e'),'email',_0x9881('0x6f'),'phone'];if(_0x2f654f){_[_0x9881('0x70')](_0x2f654f[_0x9881('0x39')],function(_0xadf33){return _0x472ad1['includes'](_0xadf33['name'])||!_0x4c2acd[_0x9881('0x71')](_0xadf33[_0x9881('0x42')]);});return{'count':_0x2f654f[_0x9881('0x39')]['length'],'rows':_[_0x9881('0x2f')](_0x2f654f[_0x9881('0x39')],function(_0x942159){return{'id':_0x942159[_0x9881('0x2c')],'name':_0x942159[_0x9881('0x72')],'custom':_0x942159[_0x9881('0x73')],'options':_0x942159['picklistValues'][_0x9881('0x74')]>0x0?_['map'](_0x942159['picklistValues'],function(_0x38eeb0){return{'name':_0x38eeb0[_0x9881('0x72')],'value':_0x38eeb0['value']};}):_0x942159[_0x9881('0x42')]=='boolean'?[{'name':_0x9881('0x75'),'value':_0x9881('0x76')},{'name':_0x9881('0x77'),'value':'false'}]:[]};})};}})[_0x9881('0x29')](respondWithResult(_0x1489cf,null))['catch'](function(_0x17e7a8){var _0xa1d707=_0x578ac5[_0x9881('0x35')][_0x9881('0x78')]?0x1f4:_0x17e7a8[_0x9881('0x79')]||0x1f4;logger[_0x9881('0x1c')](_0x9881('0x7a'),_0x9881('0x59'),_0xa1d707,JSON['stringify'](_0x17e7a8));delete _0x17e7a8['name'];if(_0xa1d707===0x191){_0xa1d707=0x190;}_0x1489cf[_0x9881('0x21')](_0xa1d707)[_0x9881('0x2d')](_0x578ac5[_0x9881('0x35')][_0x9881('0x78')]?{'message':_0x9881('0x7b'),'statusCode':_0x17e7a8[_0x9881('0x79')]}:_0x17e7a8);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index d55b74f..1801833 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 _0x53c4=['./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','SalesforceAccount','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x182a57,_0x209d41){var _0x230f72=function(_0x4e4b49){while(--_0x4e4b49){_0x182a57['push'](_0x182a57['shift']());}};_0x230f72(++_0x209d41);}(_0x53c4,0x1d2));var _0x453c=function(_0xbb723c,_0x3d96e8){_0xbb723c=_0xbb723c-0x0;var _0x36025c=_0x53c4[_0xbb723c];return _0x36025c;};'use strict';var _=require(_0x453c('0x0'));var util=require(_0x453c('0x1'));var logger=require(_0x453c('0x2'))('api');var moment=require(_0x453c('0x3'));var BPromise=require(_0x453c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x453c('0x5'));var rimraf=require(_0x453c('0x6'));var config=require('../../config/environment');var attributes=require(_0x453c('0x7'));var integrations=require(_0x453c('0x8'));module[_0x453c('0x9')]=function(_0x3d8e7d,_0x20c86d){return _0x3d8e7d['define'](_0x453c('0xa'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7dae=['request-promise','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','int_salesforce_accounts','lodash','../../config/logger','api','bluebird'];(function(_0x515396,_0x4741b9){var _0x220f74=function(_0x4380f8){while(--_0x4380f8){_0x515396['push'](_0x515396['shift']());}};_0x220f74(++_0x4741b9);}(_0x7dae,0x11a));var _0xe7da=function(_0x522bcc,_0x10075a){_0x522bcc=_0x522bcc-0x0;var _0x49f8f9=_0x7dae[_0x522bcc];return _0x49f8f9;};'use strict';var _=require(_0xe7da('0x0'));var util=require('util');var logger=require(_0xe7da('0x1'))(_0xe7da('0x2'));var moment=require('moment');var BPromise=require(_0xe7da('0x3'));var rp=require(_0xe7da('0x4'));var fs=require('fs');var path=require(_0xe7da('0x5'));var rimraf=require('rimraf');var config=require(_0xe7da('0x6'));var attributes=require(_0xe7da('0x7'));var integrations=require(_0xe7da('0x8'));module[_0xe7da('0x9')]=function(_0x58734a,_0x17e9a4){return _0x58734a['define']('SalesforceAccount',attributes,{'tableName':_0xe7da('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 8237a0e..39e9288 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 _0xc6d8=['randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','findAll','options','raw','model','attributes','map','include','then','GetSalesforceAccount','ShowSalesforceAccount','SalesforceAccount','find','lodash','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x3e32b1,_0x487a75){_0x3e32b1=_0x3e32b1-0x0;var _0x419327=_0xc6d8[_0x3e32b1];return _0x419327;};'use strict';var _=require(_0x8c6d('0x0'));var util=require('util');var moment=require(_0x8c6d('0x1'));var BPromise=require('bluebird');var rs=require(_0x8c6d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c6d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8c6d('0x4'));var config=require(_0x8c6d('0x5'));var jayson=require(_0x8c6d('0x6'));var client=jayson[_0x8c6d('0x7')][_0x8c6d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2dbb52,_0x98cae4,_0x5529f1){return new BPromise(function(_0x1496ba,_0x75c49f){return client[_0x8c6d('0x9')](_0x2dbb52,_0x5529f1)['then'](function(_0x3cecc1){logger[_0x8c6d('0xa')](_0x8c6d('0xb'),_0x98cae4,_0x8c6d('0xc'));logger[_0x8c6d('0xd')](_0x8c6d('0xe'),_0x98cae4,_0x8c6d('0xc'),JSON[_0x8c6d('0xf')](_0x3cecc1));if(_0x3cecc1['error']){if(_0x3cecc1[_0x8c6d('0x10')]['code']===0x1f4){logger['error'](_0x8c6d('0xb'),_0x98cae4,_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);return _0x75c49f(_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);}logger[_0x8c6d('0x10')](_0x8c6d('0xb'),_0x98cae4,_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);return _0x1496ba(_0x3cecc1[_0x8c6d('0x10')]['message']);}else{logger[_0x8c6d('0xa')]('SalesforceAccount,\x20%s,\x20%s',_0x98cae4,_0x8c6d('0xc'));_0x1496ba(_0x3cecc1['result'][_0x8c6d('0x11')]);}})[_0x8c6d('0x12')](function(_0x52ed7b){logger[_0x8c6d('0x10')](_0x8c6d('0xb'),_0x98cae4,_0x52ed7b);_0x75c49f(_0x52ed7b);});});}exports['GetSalesforceAccount']=function(_0x3e5495){var _0x5a22de=this;return new Promise(function(_0x4c2f8d,_0x21b8ee){return db['SalesforceAccount'][_0x8c6d('0x13')]({'raw':_0x3e5495[_0x8c6d('0x14')]?_0x3e5495[_0x8c6d('0x14')][_0x8c6d('0x15')]===undefined?!![]:![]:!![],'where':_0x3e5495[_0x8c6d('0x14')]?_0x3e5495['options']['where']||null:null,'attributes':_0x3e5495['options']?_0x3e5495[_0x8c6d('0x14')]['attributes']||null:null,'limit':_0x3e5495[_0x8c6d('0x14')]?_0x3e5495['options']['limit']||null:null,'include':_0x3e5495[_0x8c6d('0x14')]?_0x3e5495[_0x8c6d('0x14')]['include']?_['map'](_0x3e5495['options']['include'],function(_0x2a85b5){return{'model':db[_0x2a85b5[_0x8c6d('0x16')]],'as':_0x2a85b5['as'],'attributes':_0x2a85b5[_0x8c6d('0x17')],'include':_0x2a85b5['include']?_[_0x8c6d('0x18')](_0x2a85b5['include'],function(_0x15a9c4){return{'model':db[_0x15a9c4['model']],'as':_0x15a9c4['as'],'attributes':_0x15a9c4[_0x8c6d('0x17')],'include':_0x15a9c4[_0x8c6d('0x19')]?_[_0x8c6d('0x18')](_0x15a9c4[_0x8c6d('0x19')],function(_0x1e6755){return{'model':db[_0x1e6755[_0x8c6d('0x16')]],'as':_0x1e6755['as'],'attributes':_0x1e6755[_0x8c6d('0x17')]};}):[]};}):[]};}):[]:[]})[_0x8c6d('0x1a')](function(_0x3eab38){logger['info']('GetSalesforceAccount',_0x3e5495);logger[_0x8c6d('0xd')](_0x8c6d('0x1b'),_0x3e5495,JSON[_0x8c6d('0xf')](_0x3eab38));_0x4c2f8d(_0x3eab38);})[_0x8c6d('0x12')](function(_0x370626){logger[_0x8c6d('0x10')](_0x8c6d('0x1b'),_0x370626[_0x8c6d('0x11')],_0x3e5495);_0x21b8ee(_0x5a22de[_0x8c6d('0x10')](0x1f4,_0x370626[_0x8c6d('0x11')]));});});};exports[_0x8c6d('0x1c')]=function(_0x15a508){var _0x4e5203=this;return new Promise(function(_0x3af625,_0x332f6a){return db[_0x8c6d('0x1d')][_0x8c6d('0x1e')]({'raw':_0x15a508[_0x8c6d('0x14')]?_0x15a508[_0x8c6d('0x14')][_0x8c6d('0x15')]===undefined?!![]:![]:!![],'where':_0x15a508[_0x8c6d('0x14')]?_0x15a508[_0x8c6d('0x14')]['where']||null:null,'attributes':_0x15a508[_0x8c6d('0x14')]?_0x15a508['options'][_0x8c6d('0x17')]||null:null,'include':_0x15a508[_0x8c6d('0x14')]?_0x15a508[_0x8c6d('0x14')][_0x8c6d('0x19')]?_[_0x8c6d('0x18')](_0x15a508[_0x8c6d('0x14')]['include'],function(_0x5ae56b){return{'model':db[_0x5ae56b[_0x8c6d('0x16')]],'as':_0x5ae56b['as'],'attributes':_0x5ae56b[_0x8c6d('0x17')],'include':_0x5ae56b[_0x8c6d('0x19')]?_[_0x8c6d('0x18')](_0x5ae56b['include'],function(_0x2818fa){return{'model':db[_0x2818fa[_0x8c6d('0x16')]],'as':_0x2818fa['as'],'attributes':_0x2818fa[_0x8c6d('0x17')],'include':_0x2818fa[_0x8c6d('0x19')]?_[_0x8c6d('0x18')](_0x2818fa[_0x8c6d('0x19')],function(_0x4a0fb3){return{'model':db[_0x4a0fb3[_0x8c6d('0x16')]],'as':_0x4a0fb3['as'],'attributes':_0x4a0fb3[_0x8c6d('0x17')]};}):[]};}):[]};}):[]:[]})[_0x8c6d('0x1a')](function(_0x2ef932){logger[_0x8c6d('0xa')](_0x8c6d('0x1c'),_0x15a508);logger[_0x8c6d('0xd')](_0x8c6d('0x1c'),_0x15a508,JSON[_0x8c6d('0xf')](_0x2ef932));_0x3af625(_0x2ef932);})[_0x8c6d('0x12')](function(_0x16b2cd){logger[_0x8c6d('0x10')]('ShowSalesforceAccount',_0x16b2cd[_0x8c6d('0x11')],_0x15a508);_0x332f6a(_0x4e5203[_0x8c6d('0x10')](0x1f4,_0x16b2cd[_0x8c6d('0x11')]));});});}; \ No newline at end of file +var _0xc788=['request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','message','SalesforceAccount,\x20%s,\x20%s','result','catch','GetSalesforceAccount','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowSalesforceAccount','SalesforceAccount','find','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x287b77,_0x58eada){var _0x5cf204=function(_0x4d0100){while(--_0x4d0100){_0x287b77['push'](_0x287b77['shift']());}};_0x5cf204(++_0x58eada);}(_0xc788,0xc4));var _0x8c78=function(_0x202939,_0x4a1063){_0x202939=_0x202939-0x0;var _0x243aec=_0xc788[_0x202939];return _0x243aec;};'use strict';var _=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var moment=require(_0x8c78('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c78('0x3'));var db=require(_0x8c78('0x4'))['db'];var utils=require(_0x8c78('0x5'));var logger=require(_0x8c78('0x6'))(_0x8c78('0x7'));var config=require('../../config/environment');var jayson=require(_0x8c78('0x8'));var client=jayson[_0x8c78('0x9')][_0x8c78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ac27f,_0x205cc1,_0x4d54a5){return new BPromise(function(_0x247188,_0x299d9d){return client[_0x8c78('0xb')](_0x1ac27f,_0x4d54a5)[_0x8c78('0xc')](function(_0xdb0c17){logger[_0x8c78('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x205cc1,_0x8c78('0xe'));logger['debug'](_0x8c78('0xf'),_0x205cc1,_0x8c78('0xe'),JSON['stringify'](_0xdb0c17));if(_0xdb0c17[_0x8c78('0x10')]){if(_0xdb0c17[_0x8c78('0x10')]['code']===0x1f4){logger[_0x8c78('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x205cc1,_0xdb0c17['error'][_0x8c78('0x11')]);return _0x299d9d(_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);}logger[_0x8c78('0x10')](_0x8c78('0x12'),_0x205cc1,_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);return _0x247188(_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);}else{logger[_0x8c78('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x205cc1,_0x8c78('0xe'));_0x247188(_0xdb0c17[_0x8c78('0x13')]['message']);}})[_0x8c78('0x14')](function(_0x554464){logger[_0x8c78('0x10')](_0x8c78('0x12'),_0x205cc1,_0x554464);_0x299d9d(_0x554464);});});}exports[_0x8c78('0x15')]=function(_0x461eff){var _0x54eafa=this;return new Promise(function(_0x4f7bf9,_0x339d04){return db['SalesforceAccount']['findAll']({'raw':_0x461eff[_0x8c78('0x16')]?_0x461eff['options'][_0x8c78('0x17')]===undefined?!![]:![]:!![],'where':_0x461eff[_0x8c78('0x16')]?_0x461eff['options'][_0x8c78('0x18')]||null:null,'attributes':_0x461eff['options']?_0x461eff[_0x8c78('0x16')][_0x8c78('0x19')]||null:null,'limit':_0x461eff['options']?_0x461eff[_0x8c78('0x16')][_0x8c78('0x1a')]||null:null,'include':_0x461eff['options']?_0x461eff[_0x8c78('0x16')][_0x8c78('0x1b')]?_[_0x8c78('0x1c')](_0x461eff[_0x8c78('0x16')][_0x8c78('0x1b')],function(_0x20f483){return{'model':db[_0x20f483[_0x8c78('0x1d')]],'as':_0x20f483['as'],'attributes':_0x20f483[_0x8c78('0x19')],'include':_0x20f483[_0x8c78('0x1b')]?_['map'](_0x20f483[_0x8c78('0x1b')],function(_0x458763){return{'model':db[_0x458763[_0x8c78('0x1d')]],'as':_0x458763['as'],'attributes':_0x458763['attributes'],'include':_0x458763[_0x8c78('0x1b')]?_['map'](_0x458763[_0x8c78('0x1b')],function(_0x24f9a7){return{'model':db[_0x24f9a7[_0x8c78('0x1d')]],'as':_0x24f9a7['as'],'attributes':_0x24f9a7['attributes']};}):[]};}):[]};}):[]:[]})[_0x8c78('0xc')](function(_0x2568d5){logger['info'](_0x8c78('0x15'),_0x461eff);logger[_0x8c78('0x1e')](_0x8c78('0x15'),_0x461eff,JSON[_0x8c78('0x1f')](_0x2568d5));_0x4f7bf9(_0x2568d5);})[_0x8c78('0x14')](function(_0x2ab5cc){logger['error'](_0x8c78('0x15'),_0x2ab5cc['message'],_0x461eff);_0x339d04(_0x54eafa[_0x8c78('0x10')](0x1f4,_0x2ab5cc[_0x8c78('0x11')]));});});};exports[_0x8c78('0x20')]=function(_0x4e764f){var _0x1f1a0c=this;return new Promise(function(_0x3816d2,_0x4f0005){return db[_0x8c78('0x21')][_0x8c78('0x22')]({'raw':_0x4e764f[_0x8c78('0x16')]?_0x4e764f['options'][_0x8c78('0x17')]===undefined?!![]:![]:!![],'where':_0x4e764f[_0x8c78('0x16')]?_0x4e764f[_0x8c78('0x16')]['where']||null:null,'attributes':_0x4e764f[_0x8c78('0x16')]?_0x4e764f[_0x8c78('0x16')]['attributes']||null:null,'include':_0x4e764f[_0x8c78('0x16')]?_0x4e764f[_0x8c78('0x16')][_0x8c78('0x1b')]?_[_0x8c78('0x1c')](_0x4e764f[_0x8c78('0x16')][_0x8c78('0x1b')],function(_0x1218f4){return{'model':db[_0x1218f4[_0x8c78('0x1d')]],'as':_0x1218f4['as'],'attributes':_0x1218f4[_0x8c78('0x19')],'include':_0x1218f4[_0x8c78('0x1b')]?_['map'](_0x1218f4[_0x8c78('0x1b')],function(_0x45e673){return{'model':db[_0x45e673[_0x8c78('0x1d')]],'as':_0x45e673['as'],'attributes':_0x45e673[_0x8c78('0x19')],'include':_0x45e673[_0x8c78('0x1b')]?_['map'](_0x45e673[_0x8c78('0x1b')],function(_0xc4d0cf){return{'model':db[_0xc4d0cf[_0x8c78('0x1d')]],'as':_0xc4d0cf['as'],'attributes':_0xc4d0cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x8c78('0xc')](function(_0x25ea2f){logger['info'](_0x8c78('0x20'),_0x4e764f);logger['debug'](_0x8c78('0x20'),_0x4e764f,JSON[_0x8c78('0x1f')](_0x25ea2f));_0x3816d2(_0x25ea2f);})[_0x8c78('0x14')](function(_0x157b81){logger['error'](_0x8c78('0x20'),_0x157b81['message'],_0x4e764f);_0x4f0005(_0x1f1a0c[_0x8c78('0x10')](0x1f4,_0x157b81[_0x8c78('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 280ecbc..af87d1f 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 _0xd14e=['connect-timeout','express','fs-extra','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','post','create','put','update','delete','destroy','multer','util','path'];(function(_0x504a92,_0x1dcdb){var _0x5aa5d6=function(_0x34b3ad){while(--_0x34b3ad){_0x504a92['push'](_0x504a92['shift']());}};_0x5aa5d6(++_0x1dcdb);}(_0xd14e,0x1e0));var _0xed14=function(_0x259860,_0xbb35e7){_0x259860=_0x259860-0x0;var _0x293a8c=_0xd14e[_0x259860];return _0x293a8c;};'use strict';var multer=require(_0xed14('0x0'));var util=require(_0xed14('0x1'));var path=require(_0xed14('0x2'));var timeout=require(_0xed14('0x3'));var express=require(_0xed14('0x4'));var router=express['Router']();var fs_extra=require(_0xed14('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xed14('0x6'));var config=require('../../config/environment');var controller=require('./intSalesforceConfiguration.controller');router[_0xed14('0x7')]('/',auth[_0xed14('0x8')](),controller['index']);router[_0xed14('0x7')](_0xed14('0x9'),auth[_0xed14('0x8')](),controller[_0xed14('0xa')]);router['get'](_0xed14('0xb'),auth[_0xed14('0x8')](),controller[_0xed14('0xc')]);router[_0xed14('0x7')](_0xed14('0xd'),auth[_0xed14('0x8')](),controller['getSubjects']);router[_0xed14('0x7')](_0xed14('0xe'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xed14('0xf')]('/',auth['isAuthenticated'](),controller[_0xed14('0x10')]);router[_0xed14('0x11')]('/:id',auth[_0xed14('0x8')](),controller[_0xed14('0x12')]);router[_0xed14('0x13')]('/:id',auth[_0xed14('0x8')](),controller[_0xed14('0x14')]);module['exports']=router; \ No newline at end of file +var _0xbf48=['/:id','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','getSubjects','post','put'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xbf48,0x1e7));var _0x8bf4=function(_0x367caa,_0x3bf1c2){_0x367caa=_0x367caa-0x0;var _0x521513=_0xbf48[_0x367caa];return _0x521513;};'use strict';var multer=require(_0x8bf4('0x0'));var util=require(_0x8bf4('0x1'));var path=require(_0x8bf4('0x2'));var timeout=require(_0x8bf4('0x3'));var express=require(_0x8bf4('0x4'));var router=express['Router']();var fs_extra=require(_0x8bf4('0x5'));var auth=require(_0x8bf4('0x6'));var interaction=require(_0x8bf4('0x7'));var config=require(_0x8bf4('0x8'));var controller=require(_0x8bf4('0x9'));router[_0x8bf4('0xa')]('/',auth[_0x8bf4('0xb')](),controller[_0x8bf4('0xc')]);router[_0x8bf4('0xa')]('/:id',auth[_0x8bf4('0xb')](),controller[_0x8bf4('0xd')]);router['get'](_0x8bf4('0xe'),auth[_0x8bf4('0xb')](),controller[_0x8bf4('0xf')]);router[_0x8bf4('0xa')]('/:id/subjects',auth[_0x8bf4('0xb')](),controller[_0x8bf4('0x10')]);router['get']('/:id/descriptions',auth[_0x8bf4('0xb')](),controller['getDescriptions']);router[_0x8bf4('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8bf4('0x12')](_0x8bf4('0x13'),auth[_0x8bf4('0xb')](),controller[_0x8bf4('0x14')]);router[_0x8bf4('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x8bf4('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index abd11a3..1e7f2c5 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 _0xeb6e=['lead','sequelize','exports','STRING','ENUM','Case','contact_lead','contact','nothing'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xeb6e,0xa3));var _0xeeb6=function(_0x7d4cde,_0x58b8d2){_0x7d4cde=_0x7d4cde-0x0;var _0x3e4f8b=_0xeb6e[_0x7d4cde];return _0x3e4f8b;};'use strict';var Sequelize=require(_0xeeb6('0x0'));module[_0xeeb6('0x1')]={'name':{'type':Sequelize[_0xeeb6('0x2')]},'description':{'type':Sequelize[_0xeeb6('0x2')]},'ticketType':{'type':Sequelize[_0xeeb6('0x3')]('Task',_0xeeb6('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xeeb6('0x3')](_0xeeb6('0x5'),_0xeeb6('0x6'),'lead'),'defaultValue':_0xeeb6('0x5')},'moduleCreate':{'type':Sequelize[_0xeeb6('0x3')](_0xeeb6('0x7'),_0xeeb6('0x6'),_0xeeb6('0x8')),'defaultValue':_0xeeb6('0x8')},'leadId':{'type':Sequelize[_0xeeb6('0x2')]}}; \ No newline at end of file +var _0x3124=['Case','contact_lead','contact','lead','nothing','STRING','ENUM','Task'];(function(_0x3d7444,_0xadd16e){var _0xb20c74=function(_0x37e764){while(--_0x37e764){_0x3d7444['push'](_0x3d7444['shift']());}};_0xb20c74(++_0xadd16e);}(_0x3124,0x15d));var _0x4312=function(_0x5b692c,_0x281ad7){_0x5b692c=_0x5b692c-0x0;var _0x347c25=_0x3124[_0x5b692c];return _0x347c25;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4312('0x0')]},'description':{'type':Sequelize[_0x4312('0x0')]},'ticketType':{'type':Sequelize[_0x4312('0x1')](_0x4312('0x2'),_0x4312('0x3')),'defaultValue':_0x4312('0x2')},'moduleSearch':{'type':Sequelize[_0x4312('0x1')](_0x4312('0x4'),_0x4312('0x5'),_0x4312('0x6')),'defaultValue':_0x4312('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0x4312('0x7'),_0x4312('0x5'),_0x4312('0x6')),'defaultValue':'lead'},'leadId':{'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 a34440a..f584f3c 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 _0x00fe=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','pick','filter','where','merge','type','VIRTUAL','options','SalesforceConfiguration','count','includeAll','include','params','find','create','body','getFields','findOne','SalesforceField','sort','hasOwnProperty','getSubjects','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x00fe,0x160));var _0xe00f=function(_0x124f88,_0x3ad501){_0x124f88=_0x124f88-0x0;var _0xed0e3b=_0x00fe[_0x124f88];return _0xed0e3b;};'use strict';var pdf=require(_0xe00f('0x0'));var emlformat=require(_0xe00f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe00f('0x2'));var jsonpatch=require(_0xe00f('0x3'));var rp=require('request-promise');var moment=require(_0xe00f('0x4'));var BPromise=require(_0xe00f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xe00f('0x6'));var csv=require(_0xe00f('0x7'));var ejs=require(_0xe00f('0x8'));var fs=require('fs');var fs_extra=require(_0xe00f('0x9'));var _=require('lodash');var squel=require(_0xe00f('0xa'));var crypto=require(_0xe00f('0xb'));var jsforce=require(_0xe00f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe00f('0x7'));var querystring=require(_0xe00f('0xd'));var Papa=require(_0xe00f('0xe'));var Redis=require(_0xe00f('0xf'));var authService=require(_0xe00f('0x10'));var qs=require(_0xe00f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe00f('0x12'));var logger=require(_0xe00f('0x13'))(_0xe00f('0x14'));var utils=require(_0xe00f('0x15'));var config=require(_0xe00f('0x16'));var licenseUtil=require(_0xe00f('0x17'));var db=require(_0xe00f('0x18'))['db'];var jayson=require(_0xe00f('0x19'));var client=jayson[_0xe00f('0x1a')][_0xe00f('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x36921e,_0x5a2000,_0x51b2e4,_0x5cc715){return new BPromise(function(_0x3e7d83,_0x4d1d18){var _0x2a345a=_0x5cc715||client;return _0x2a345a['request'](_0x36921e,_0x51b2e4)[_0xe00f('0x1c')](function(_0x1634f8){logger['info'](_0xe00f('0x1d'),_0x5a2000,_0xe00f('0x1e'));logger[_0xe00f('0x1f')](_0xe00f('0x20'),_0x5a2000,_0xe00f('0x1e'),JSON[_0xe00f('0x21')](_0x1634f8));if(_0x1634f8['error']){if(_0x1634f8[_0xe00f('0x22')][_0xe00f('0x23')]===0x1f4){logger[_0xe00f('0x22')](_0xe00f('0x1d'),_0x5a2000,_0x1634f8['error'][_0xe00f('0x24')]);return _0x4d1d18(_0x1634f8[_0xe00f('0x22')][_0xe00f('0x24')]);}logger[_0xe00f('0x22')](_0xe00f('0x1d'),_0x5a2000,_0x1634f8[_0xe00f('0x22')][_0xe00f('0x24')]);return _0x3e7d83(_0x1634f8['error']['message']);}else{logger['info'](_0xe00f('0x1d'),_0x5a2000,_0xe00f('0x1e'));_0x3e7d83(_0x1634f8[_0xe00f('0x25')][_0xe00f('0x24')]);}})[_0xe00f('0x26')](function(_0x458e93){logger[_0xe00f('0x22')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5a2000,_0x458e93);_0x4d1d18(_0x458e93);});});}function respondWithStatusCode(_0x937f36,_0x5d6a10){_0x5d6a10=_0x5d6a10||0xcc;return function(_0x3accee){if(_0x3accee){return _0x937f36[_0xe00f('0x27')](_0x5d6a10);}return _0x937f36[_0xe00f('0x28')](_0x5d6a10)[_0xe00f('0x29')]();};}function respondWithResult(_0x2c07a9,_0x58b393){_0x58b393=_0x58b393||0xc8;return function(_0x2f0070){if(_0x2f0070){return _0x2c07a9[_0xe00f('0x28')](_0x58b393)['json'](_0x2f0070);}};}function respondWithFilteredResult(_0x149293,_0x135f38){return function(_0x5d3fe7){if(_0x5d3fe7){var _0x4f88ea=_0x5d3fe7['count'],_0x13a5bb=_0x135f38[_0xe00f('0x2a')],_0x57d3bc=_0x135f38[_0xe00f('0x2a')]+_0x135f38[_0xe00f('0x2b')],_0x44c705;if(_0x57d3bc>=_0x4f88ea){_0x57d3bc=_0x4f88ea;_0x44c705=0xc8;}else{_0x44c705=0xce;}_0x149293[_0xe00f('0x28')](_0x44c705);return _0x149293[_0xe00f('0x2c')](_0xe00f('0x2d'),_0x13a5bb+'-'+_0x57d3bc+'/'+_0x4f88ea)[_0xe00f('0x2e')](_0x5d3fe7);}return null;};}function patchUpdates(_0x521217){return function(_0x339fdf){try{jsonpatch[_0xe00f('0x2f')](_0x339fdf,_0x521217,!![]);}catch(_0x2e4709){return BPromise[_0xe00f('0x30')](_0x2e4709);}return _0x339fdf[_0xe00f('0x31')]();};}function saveUpdates(_0x244ad2,_0x204cf4){return function(_0x13504d){if(_0x13504d){return _0x13504d[_0xe00f('0x32')](_0x244ad2)['then'](function(_0x29dfdb){return _0x29dfdb;});}return null;};}function removeEntity(_0x418b49,_0x392032){return function(_0x29acd8){if(_0x29acd8){return _0x29acd8[_0xe00f('0x33')]()[_0xe00f('0x1c')](function(){_0x418b49[_0xe00f('0x28')](0xcc)[_0xe00f('0x29')]();});}};}function handleEntityNotFound(_0x5a2ece,_0x2a70f3){return function(_0x3322cf){if(!_0x3322cf){_0x5a2ece[_0xe00f('0x27')](0x194);}return _0x3322cf;};}function handleError(_0x34acca,_0xaba243){_0xaba243=_0xaba243||0x1f4;return function(_0x128c30){logger['error'](_0x128c30[_0xe00f('0x34')]);if(_0x128c30[_0xe00f('0x35')]){delete _0x128c30[_0xe00f('0x35')];}_0x34acca[_0xe00f('0x28')](_0xaba243)[_0xe00f('0x36')](_0x128c30);};}exports[_0xe00f('0x37')]=function(_0x568456,_0x2ced66){var _0x8efcfa={},_0x4e62ee={},_0x108869={'count':0x0,'rows':[]};var _0xf55e07=_[_0xe00f('0x38')](db['SalesforceConfiguration'][_0xe00f('0x39')],function(_0x17ff27){return{'name':_0x17ff27[_0xe00f('0x3a')],'type':_0x17ff27['type'][_0xe00f('0x3b')]};});_0x4e62ee['model']=_[_0xe00f('0x38')](_0xf55e07,_0xe00f('0x35'));_0x4e62ee['query']=_[_0xe00f('0x3c')](_0x568456[_0xe00f('0x3d')]);_0x4e62ee[_0xe00f('0x3e')]=_[_0xe00f('0x3f')](_0x4e62ee[_0xe00f('0x40')],_0x4e62ee[_0xe00f('0x3d')]);_0x8efcfa[_0xe00f('0x41')]=_['intersection'](_0x4e62ee[_0xe00f('0x40')],qs[_0xe00f('0x42')](_0x568456[_0xe00f('0x3d')][_0xe00f('0x42')]));_0x8efcfa[_0xe00f('0x41')]=_0x8efcfa['attributes'][_0xe00f('0x43')]?_0x8efcfa[_0xe00f('0x41')]:_0x4e62ee[_0xe00f('0x40')];if(!_0x568456[_0xe00f('0x3d')]['hasOwnProperty'](_0xe00f('0x44'))){_0x8efcfa[_0xe00f('0x2b')]=qs['limit'](_0x568456[_0xe00f('0x3d')][_0xe00f('0x2b')]);_0x8efcfa[_0xe00f('0x2a')]=qs[_0xe00f('0x2a')](_0x568456[_0xe00f('0x3d')][_0xe00f('0x2a')]);}_0x8efcfa[_0xe00f('0x45')]=qs['sort'](_0x568456[_0xe00f('0x3d')]['sort']);_0x8efcfa['where']=qs['filters'](_[_0xe00f('0x46')](_0x568456[_0xe00f('0x3d')],_0x4e62ee[_0xe00f('0x3e')]),_0xf55e07);if(_0x568456[_0xe00f('0x3d')][_0xe00f('0x47')]){_0x8efcfa[_0xe00f('0x48')]=_[_0xe00f('0x49')](_0x8efcfa[_0xe00f('0x48')],{'$or':_[_0xe00f('0x38')](_0xf55e07,function(_0x2cdb74){if(_0x2cdb74[_0xe00f('0x4a')]!==_0xe00f('0x4b')){var _0x519ede={};_0x519ede[_0x2cdb74['name']]={'$like':'%'+_0x568456[_0xe00f('0x3d')][_0xe00f('0x47')]+'%'};return _0x519ede;}})});}_0x8efcfa=_[_0xe00f('0x49')]({},_0x8efcfa,_0x568456[_0xe00f('0x4c')]);var _0x3064dd={'where':_0x8efcfa[_0xe00f('0x48')]};return db[_0xe00f('0x4d')][_0xe00f('0x4e')](_0x3064dd)[_0xe00f('0x1c')](function(_0x100155){_0x108869[_0xe00f('0x4e')]=_0x100155;if(_0x568456[_0xe00f('0x3d')][_0xe00f('0x4f')]){_0x8efcfa[_0xe00f('0x50')]=[{'all':!![]}];}return db[_0xe00f('0x4d')]['findAll'](_0x8efcfa);})[_0xe00f('0x1c')](function(_0x3df14e){_0x108869['rows']=_0x3df14e;return _0x108869;})[_0xe00f('0x1c')](respondWithFilteredResult(_0x2ced66,_0x8efcfa))[_0xe00f('0x26')](handleError(_0x2ced66,null));};exports['show']=function(_0x40ea64,_0x136f32){var _0x533ab3={'raw':![],'where':{'id':_0x40ea64[_0xe00f('0x51')]['id']}},_0x57b7d9={};_0x57b7d9[_0xe00f('0x40')]=_[_0xe00f('0x3c')](db['SalesforceConfiguration'][_0xe00f('0x39')]);_0x57b7d9[_0xe00f('0x3d')]=_[_0xe00f('0x3c')](_0x40ea64[_0xe00f('0x3d')]);_0x57b7d9[_0xe00f('0x3e')]=_[_0xe00f('0x3f')](_0x57b7d9[_0xe00f('0x40')],_0x57b7d9['query']);_0x533ab3[_0xe00f('0x41')]=_[_0xe00f('0x3f')](_0x57b7d9['model'],qs['fields'](_0x40ea64[_0xe00f('0x3d')][_0xe00f('0x42')]));_0x533ab3[_0xe00f('0x41')]=_0x533ab3[_0xe00f('0x41')][_0xe00f('0x43')]?_0x533ab3['attributes']:_0x57b7d9['model'];if(_0x40ea64[_0xe00f('0x3d')]['includeAll']){_0x533ab3['include']=[{'all':!![]}];}_0x533ab3=_['merge']({},_0x533ab3,_0x40ea64['options']);return db[_0xe00f('0x4d')][_0xe00f('0x52')](_0x533ab3)[_0xe00f('0x1c')](handleEntityNotFound(_0x136f32,null))[_0xe00f('0x1c')](respondWithResult(_0x136f32,null))[_0xe00f('0x26')](handleError(_0x136f32,null));};exports[_0xe00f('0x53')]=function(_0x44787a,_0x7906a2){return db[_0xe00f('0x4d')][_0xe00f('0x53')](_0x44787a[_0xe00f('0x54')],{})['then'](respondWithResult(_0x7906a2,0xc9))['catch'](handleError(_0x7906a2,null));};exports[_0xe00f('0x32')]=function(_0x221e32,_0x5ded9c){if(_0x221e32[_0xe00f('0x54')]['id']){delete _0x221e32[_0xe00f('0x54')]['id'];}return db[_0xe00f('0x4d')][_0xe00f('0x52')]({'where':{'id':_0x221e32[_0xe00f('0x51')]['id']}})[_0xe00f('0x1c')](handleEntityNotFound(_0x5ded9c,null))[_0xe00f('0x1c')](saveUpdates(_0x221e32[_0xe00f('0x54')],null))[_0xe00f('0x1c')](respondWithResult(_0x5ded9c,null))[_0xe00f('0x26')](handleError(_0x5ded9c,null));};exports[_0xe00f('0x33')]=function(_0x46e0d0,_0x283de5){return db[_0xe00f('0x4d')][_0xe00f('0x52')]({'where':{'id':_0x46e0d0[_0xe00f('0x51')]['id']}})[_0xe00f('0x1c')](handleEntityNotFound(_0x283de5,null))['then'](removeEntity(_0x283de5,null))[_0xe00f('0x26')](handleError(_0x283de5,null));};exports[_0xe00f('0x55')]=function(_0x2939de,_0x234809,_0x3f274c){var _0x3f2d42={};var _0x47f41c={};var _0x357bef;var _0x1b6cce;return db['SalesforceConfiguration'][_0xe00f('0x56')]({'where':{'id':_0x2939de['params']['id']}})[_0xe00f('0x1c')](handleEntityNotFound(_0x234809,null))[_0xe00f('0x1c')](function(_0x50b518){if(_0x50b518){_0x357bef=_0x50b518;_0x47f41c[_0xe00f('0x40')]=_[_0xe00f('0x3c')](db[_0xe00f('0x57')][_0xe00f('0x39')]);_0x47f41c[_0xe00f('0x3d')]=_[_0xe00f('0x3c')](_0x2939de[_0xe00f('0x3d')]);_0x47f41c[_0xe00f('0x3e')]=_[_0xe00f('0x3f')](_0x47f41c[_0xe00f('0x40')],_0x47f41c[_0xe00f('0x3d')]);_0x3f2d42[_0xe00f('0x41')]=_[_0xe00f('0x3f')](_0x47f41c['model'],qs['fields'](_0x2939de[_0xe00f('0x3d')][_0xe00f('0x42')]));_0x3f2d42[_0xe00f('0x41')]=_0x3f2d42[_0xe00f('0x41')][_0xe00f('0x43')]?_0x3f2d42[_0xe00f('0x41')]:_0x47f41c['model'];_0x3f2d42[_0xe00f('0x45')]=qs[_0xe00f('0x58')](_0x2939de['query'][_0xe00f('0x58')]);_0x3f2d42[_0xe00f('0x48')]=qs['filters'](_['pick'](_0x2939de[_0xe00f('0x3d')],_0x47f41c[_0xe00f('0x3e')]));if(_0x2939de[_0xe00f('0x3d')][_0xe00f('0x47')]){_0x3f2d42[_0xe00f('0x48')]=_[_0xe00f('0x49')](_0x3f2d42['where'],{'$or':_[_0xe00f('0x38')](_0x3f2d42[_0xe00f('0x41')],function(_0x3e09e0){var _0xd30a6b={};_0xd30a6b[_0x3e09e0]={'$like':'%'+_0x2939de[_0xe00f('0x3d')][_0xe00f('0x47')]+'%'};return _0xd30a6b;})});}_0x3f2d42=_[_0xe00f('0x49')]({},_0x3f2d42,_0x2939de[_0xe00f('0x4c')]);return _0x357bef[_0xe00f('0x55')](_0x3f2d42);}})[_0xe00f('0x1c')](function(_0x2ac298){if(_0x2ac298){_0x1b6cce=_0x2ac298['length'];if(!_0x2939de[_0xe00f('0x3d')][_0xe00f('0x59')](_0xe00f('0x44'))){_0x3f2d42[_0xe00f('0x2b')]=qs['limit'](_0x2939de[_0xe00f('0x3d')]['limit']);_0x3f2d42['offset']=qs[_0xe00f('0x2a')](_0x2939de['query'][_0xe00f('0x2a')]);}return _0x357bef[_0xe00f('0x55')](_0x3f2d42);}})[_0xe00f('0x1c')](function(_0x17d7c2){if(_0x17d7c2){return _0x17d7c2?{'count':_0x1b6cce,'rows':_0x17d7c2}:null;}})['then'](respondWithResult(_0x234809,null))['catch'](handleError(_0x234809,null));};exports[_0xe00f('0x5a')]=function(_0x4beb4b,_0x1cd426,_0x5de61e){var _0x2a68ec={};var _0x4414c4={};var _0x28fb1e;var _0x105565;return db[_0xe00f('0x4d')][_0xe00f('0x56')]({'where':{'id':_0x4beb4b[_0xe00f('0x51')]['id']}})[_0xe00f('0x1c')](handleEntityNotFound(_0x1cd426,null))[_0xe00f('0x1c')](function(_0x4700fb){if(_0x4700fb){_0x28fb1e=_0x4700fb;_0x4414c4[_0xe00f('0x40')]=_[_0xe00f('0x3c')](db[_0xe00f('0x57')][_0xe00f('0x39')]);_0x4414c4['query']=_[_0xe00f('0x3c')](_0x4beb4b[_0xe00f('0x3d')]);_0x4414c4[_0xe00f('0x3e')]=_[_0xe00f('0x3f')](_0x4414c4[_0xe00f('0x40')],_0x4414c4[_0xe00f('0x3d')]);_0x2a68ec[_0xe00f('0x41')]=_[_0xe00f('0x3f')](_0x4414c4['model'],qs[_0xe00f('0x42')](_0x4beb4b['query'][_0xe00f('0x42')]));_0x2a68ec[_0xe00f('0x41')]=_0x2a68ec[_0xe00f('0x41')]['length']?_0x2a68ec['attributes']:_0x4414c4[_0xe00f('0x40')];_0x2a68ec[_0xe00f('0x45')]=qs[_0xe00f('0x58')](_0x4beb4b[_0xe00f('0x3d')]['sort']);_0x2a68ec[_0xe00f('0x48')]=qs[_0xe00f('0x3e')](_[_0xe00f('0x46')](_0x4beb4b[_0xe00f('0x3d')],_0x4414c4[_0xe00f('0x3e')]));if(_0x4beb4b[_0xe00f('0x3d')][_0xe00f('0x47')]){_0x2a68ec[_0xe00f('0x48')]=_['merge'](_0x2a68ec['where'],{'$or':_['map'](_0x2a68ec[_0xe00f('0x41')],function(_0x20996c){var _0x22ee4b={};_0x22ee4b[_0x20996c]={'$like':'%'+_0x4beb4b[_0xe00f('0x3d')]['filter']+'%'};return _0x22ee4b;})});}_0x2a68ec=_[_0xe00f('0x49')]({},_0x2a68ec,_0x4beb4b[_0xe00f('0x4c')]);return _0x28fb1e['getSubjects'](_0x2a68ec);}})[_0xe00f('0x1c')](function(_0x30a7d1){if(_0x30a7d1){_0x105565=_0x30a7d1[_0xe00f('0x43')];if(!_0x4beb4b['query'][_0xe00f('0x59')](_0xe00f('0x44'))){_0x2a68ec[_0xe00f('0x2b')]=qs['limit'](_0x4beb4b['query'][_0xe00f('0x2b')]);_0x2a68ec[_0xe00f('0x2a')]=qs[_0xe00f('0x2a')](_0x4beb4b['query'][_0xe00f('0x2a')]);}return _0x28fb1e[_0xe00f('0x5a')](_0x2a68ec);}})[_0xe00f('0x1c')](function(_0x570f52){if(_0x570f52){return _0x570f52?{'count':_0x105565,'rows':_0x570f52}:null;}})[_0xe00f('0x1c')](respondWithResult(_0x1cd426,null))[_0xe00f('0x26')](handleError(_0x1cd426,null));};exports[_0xe00f('0x5b')]=function(_0x11a5ed,_0x465745,_0x576256){var _0x3cefe6={};var _0x74e7cc={};var _0x73c90;var _0x54390a;return db[_0xe00f('0x4d')][_0xe00f('0x56')]({'where':{'id':_0x11a5ed[_0xe00f('0x51')]['id']}})[_0xe00f('0x1c')](handleEntityNotFound(_0x465745,null))[_0xe00f('0x1c')](function(_0x25f403){if(_0x25f403){_0x73c90=_0x25f403;_0x74e7cc[_0xe00f('0x40')]=_[_0xe00f('0x3c')](db[_0xe00f('0x57')]['rawAttributes']);_0x74e7cc[_0xe00f('0x3d')]=_[_0xe00f('0x3c')](_0x11a5ed[_0xe00f('0x3d')]);_0x74e7cc[_0xe00f('0x3e')]=_['intersection'](_0x74e7cc[_0xe00f('0x40')],_0x74e7cc[_0xe00f('0x3d')]);_0x3cefe6[_0xe00f('0x41')]=_[_0xe00f('0x3f')](_0x74e7cc[_0xe00f('0x40')],qs[_0xe00f('0x42')](_0x11a5ed[_0xe00f('0x3d')]['fields']));_0x3cefe6[_0xe00f('0x41')]=_0x3cefe6[_0xe00f('0x41')]['length']?_0x3cefe6[_0xe00f('0x41')]:_0x74e7cc[_0xe00f('0x40')];_0x3cefe6[_0xe00f('0x45')]=qs[_0xe00f('0x58')](_0x11a5ed['query']['sort']);_0x3cefe6[_0xe00f('0x48')]=qs['filters'](_[_0xe00f('0x46')](_0x11a5ed[_0xe00f('0x3d')],_0x74e7cc[_0xe00f('0x3e')]));if(_0x11a5ed['query'][_0xe00f('0x47')]){_0x3cefe6[_0xe00f('0x48')]=_[_0xe00f('0x49')](_0x3cefe6[_0xe00f('0x48')],{'$or':_['map'](_0x3cefe6[_0xe00f('0x41')],function(_0x460387){var _0x5cd80d={};_0x5cd80d[_0x460387]={'$like':'%'+_0x11a5ed['query']['filter']+'%'};return _0x5cd80d;})});}_0x3cefe6=_[_0xe00f('0x49')]({},_0x3cefe6,_0x11a5ed['options']);return _0x73c90[_0xe00f('0x5b')](_0x3cefe6);}})['then'](function(_0x55d5dd){if(_0x55d5dd){_0x54390a=_0x55d5dd['length'];if(!_0x11a5ed[_0xe00f('0x3d')][_0xe00f('0x59')]('nolimit')){_0x3cefe6['limit']=qs['limit'](_0x11a5ed[_0xe00f('0x3d')][_0xe00f('0x2b')]);_0x3cefe6[_0xe00f('0x2a')]=qs[_0xe00f('0x2a')](_0x11a5ed[_0xe00f('0x3d')][_0xe00f('0x2a')]);}return _0x73c90['getDescriptions'](_0x3cefe6);}})[_0xe00f('0x1c')](function(_0x5d674d){if(_0x5d674d){return _0x5d674d?{'count':_0x54390a,'rows':_0x5d674d}:null;}})[_0xe00f('0x1c')](respondWithResult(_0x465745,null))['catch'](handleError(_0x465745,null));}; \ No newline at end of file +var _0x4497=['getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','rawAttributes','type','model','map','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','SalesforceConfiguration','findAll','rows','show','params','options','find','create','body','getFields','findOne','order','getSubjects','SalesforceField'];(function(_0x3ecadc,_0x88fad3){var _0x3d5b07=function(_0x2ab621){while(--_0x2ab621){_0x3ecadc['push'](_0x3ecadc['shift']());}};_0x3d5b07(++_0x88fad3);}(_0x4497,0x16d));var _0x7449=function(_0x4ab3fb,_0x776775){_0x4ab3fb=_0x4ab3fb-0x0;var _0x34fe1e=_0x4497[_0x4ab3fb];return _0x34fe1e;};'use strict';var pdf=require(_0x7449('0x0'));var emlformat=require(_0x7449('0x1'));var rimraf=require(_0x7449('0x2'));var zipdir=require(_0x7449('0x3'));var jsonpatch=require(_0x7449('0x4'));var rp=require(_0x7449('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7449('0x6'));var util=require(_0x7449('0x7'));var path=require(_0x7449('0x8'));var sox=require(_0x7449('0x9'));var csv=require(_0x7449('0xa'));var ejs=require(_0x7449('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7449('0xc'));var squel=require(_0x7449('0xd'));var crypto=require('crypto');var jsforce=require(_0x7449('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7449('0xa'));var querystring=require('querystring');var Papa=require(_0x7449('0xf'));var Redis=require(_0x7449('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7449('0x11'));var as=require(_0x7449('0x12'));var hardwareService=require(_0x7449('0x13'));var logger=require('../../config/logger')(_0x7449('0x14'));var utils=require(_0x7449('0x15'));var config=require(_0x7449('0x16'));var licenseUtil=require(_0x7449('0x17'));var db=require(_0x7449('0x18'))['db'];var jayson=require(_0x7449('0x19'));var client=jayson[_0x7449('0x1a')][_0x7449('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x560d92,_0x41eb4c,_0x2e9b4d,_0xd454d0){return new BPromise(function(_0x5d3d40,_0x304f93){var _0x56138d=_0xd454d0||client;return _0x56138d['request'](_0x560d92,_0x2e9b4d)['then'](function(_0x480c90){logger[_0x7449('0x1c')](_0x7449('0x1d'),_0x41eb4c,_0x7449('0x1e'));logger[_0x7449('0x1f')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x41eb4c,_0x7449('0x1e'),JSON[_0x7449('0x20')](_0x480c90));if(_0x480c90[_0x7449('0x21')]){if(_0x480c90[_0x7449('0x21')][_0x7449('0x22')]===0x1f4){logger['error'](_0x7449('0x1d'),_0x41eb4c,_0x480c90[_0x7449('0x21')][_0x7449('0x23')]);return _0x304f93(_0x480c90[_0x7449('0x21')][_0x7449('0x23')]);}logger[_0x7449('0x21')]('SalesforceConfiguration,\x20%s,\x20%s',_0x41eb4c,_0x480c90[_0x7449('0x21')][_0x7449('0x23')]);return _0x5d3d40(_0x480c90[_0x7449('0x21')][_0x7449('0x23')]);}else{logger[_0x7449('0x1c')](_0x7449('0x1d'),_0x41eb4c,_0x7449('0x1e'));_0x5d3d40(_0x480c90[_0x7449('0x24')][_0x7449('0x23')]);}})[_0x7449('0x25')](function(_0x903d81){logger[_0x7449('0x21')]('SalesforceConfiguration,\x20%s,\x20%s',_0x41eb4c,_0x903d81);_0x304f93(_0x903d81);});});}function respondWithStatusCode(_0xb6ce18,_0x138274){_0x138274=_0x138274||0xcc;return function(_0x90f58c){if(_0x90f58c){return _0xb6ce18[_0x7449('0x26')](_0x138274);}return _0xb6ce18['status'](_0x138274)[_0x7449('0x27')]();};}function respondWithResult(_0x465d16,_0x40f64d){_0x40f64d=_0x40f64d||0xc8;return function(_0x1b7335){if(_0x1b7335){return _0x465d16[_0x7449('0x28')](_0x40f64d)[_0x7449('0x29')](_0x1b7335);}};}function respondWithFilteredResult(_0x5ed262,_0x511eb1){return function(_0x259e55){if(_0x259e55){var _0x2215ac=_0x259e55[_0x7449('0x2a')],_0x3de861=_0x511eb1[_0x7449('0x2b')],_0x57a924=_0x511eb1[_0x7449('0x2b')]+_0x511eb1[_0x7449('0x2c')],_0x5d84f3;if(_0x57a924>=_0x2215ac){_0x57a924=_0x2215ac;_0x5d84f3=0xc8;}else{_0x5d84f3=0xce;}_0x5ed262[_0x7449('0x28')](_0x5d84f3);return _0x5ed262['set'](_0x7449('0x2d'),_0x3de861+'-'+_0x57a924+'/'+_0x2215ac)['json'](_0x259e55);}return null;};}function patchUpdates(_0x47b9f2){return function(_0x4c7da7){try{jsonpatch[_0x7449('0x2e')](_0x4c7da7,_0x47b9f2,!![]);}catch(_0x2551b2){return BPromise[_0x7449('0x2f')](_0x2551b2);}return _0x4c7da7[_0x7449('0x30')]();};}function saveUpdates(_0x129233,_0x2d5940){return function(_0x437e12){if(_0x437e12){return _0x437e12[_0x7449('0x31')](_0x129233)[_0x7449('0x32')](function(_0x30adda){return _0x30adda;});}return null;};}function removeEntity(_0x5bffc5,_0x1ea745){return function(_0x444c70){if(_0x444c70){return _0x444c70[_0x7449('0x33')]()[_0x7449('0x32')](function(){_0x5bffc5['status'](0xcc)[_0x7449('0x27')]();});}};}function handleEntityNotFound(_0x25b915,_0x2da117){return function(_0x31d90d){if(!_0x31d90d){_0x25b915[_0x7449('0x26')](0x194);}return _0x31d90d;};}function handleError(_0x2fba30,_0x4f5a27){_0x4f5a27=_0x4f5a27||0x1f4;return function(_0x19a5ca){logger[_0x7449('0x21')](_0x19a5ca[_0x7449('0x34')]);if(_0x19a5ca[_0x7449('0x35')]){delete _0x19a5ca[_0x7449('0x35')];}_0x2fba30[_0x7449('0x28')](_0x4f5a27)[_0x7449('0x36')](_0x19a5ca);};}exports['index']=function(_0x5b47ee,_0x3cd23c){var _0x2bc0ee={},_0x2660ce={},_0xb07ced={'count':0x0,'rows':[]};var _0x29fbe5=_['map'](db['SalesforceConfiguration'][_0x7449('0x37')],function(_0x4d5560){return{'name':_0x4d5560['fieldName'],'type':_0x4d5560[_0x7449('0x38')]['key']};});_0x2660ce[_0x7449('0x39')]=_[_0x7449('0x3a')](_0x29fbe5,_0x7449('0x35'));_0x2660ce[_0x7449('0x3b')]=_[_0x7449('0x3c')](_0x5b47ee[_0x7449('0x3b')]);_0x2660ce[_0x7449('0x3d')]=_[_0x7449('0x3e')](_0x2660ce[_0x7449('0x39')],_0x2660ce[_0x7449('0x3b')]);_0x2bc0ee['attributes']=_['intersection'](_0x2660ce[_0x7449('0x39')],qs[_0x7449('0x3f')](_0x5b47ee[_0x7449('0x3b')][_0x7449('0x3f')]));_0x2bc0ee['attributes']=_0x2bc0ee['attributes'][_0x7449('0x40')]?_0x2bc0ee[_0x7449('0x41')]:_0x2660ce['model'];if(!_0x5b47ee[_0x7449('0x3b')][_0x7449('0x42')](_0x7449('0x43'))){_0x2bc0ee[_0x7449('0x2c')]=qs[_0x7449('0x2c')](_0x5b47ee[_0x7449('0x3b')]['limit']);_0x2bc0ee[_0x7449('0x2b')]=qs['offset'](_0x5b47ee[_0x7449('0x3b')]['offset']);}_0x2bc0ee['order']=qs[_0x7449('0x44')](_0x5b47ee[_0x7449('0x3b')][_0x7449('0x44')]);_0x2bc0ee['where']=qs['filters'](_[_0x7449('0x45')](_0x5b47ee['query'],_0x2660ce[_0x7449('0x3d')]),_0x29fbe5);if(_0x5b47ee[_0x7449('0x3b')][_0x7449('0x46')]){_0x2bc0ee[_0x7449('0x47')]=_[_0x7449('0x48')](_0x2bc0ee[_0x7449('0x47')],{'$or':_[_0x7449('0x3a')](_0x29fbe5,function(_0x55d205){if(_0x55d205[_0x7449('0x38')]!==_0x7449('0x49')){var _0x180b03={};_0x180b03[_0x55d205[_0x7449('0x35')]]={'$like':'%'+_0x5b47ee[_0x7449('0x3b')]['filter']+'%'};return _0x180b03;}})});}_0x2bc0ee=_['merge']({},_0x2bc0ee,_0x5b47ee['options']);var _0x493ffd={'where':_0x2bc0ee['where']};return db['SalesforceConfiguration'][_0x7449('0x2a')](_0x493ffd)[_0x7449('0x32')](function(_0x1fb8e1){_0xb07ced[_0x7449('0x2a')]=_0x1fb8e1;if(_0x5b47ee[_0x7449('0x3b')][_0x7449('0x4a')]){_0x2bc0ee[_0x7449('0x4b')]=[{'all':!![]}];}return db[_0x7449('0x4c')][_0x7449('0x4d')](_0x2bc0ee);})[_0x7449('0x32')](function(_0x171581){_0xb07ced[_0x7449('0x4e')]=_0x171581;return _0xb07ced;})[_0x7449('0x32')](respondWithFilteredResult(_0x3cd23c,_0x2bc0ee))[_0x7449('0x25')](handleError(_0x3cd23c,null));};exports[_0x7449('0x4f')]=function(_0x56c6ff,_0x47a303){var _0x181d54={'raw':![],'where':{'id':_0x56c6ff[_0x7449('0x50')]['id']}},_0x2eab1f={};_0x2eab1f['model']=_[_0x7449('0x3c')](db[_0x7449('0x4c')][_0x7449('0x37')]);_0x2eab1f[_0x7449('0x3b')]=_['keys'](_0x56c6ff['query']);_0x2eab1f[_0x7449('0x3d')]=_['intersection'](_0x2eab1f[_0x7449('0x39')],_0x2eab1f[_0x7449('0x3b')]);_0x181d54[_0x7449('0x41')]=_[_0x7449('0x3e')](_0x2eab1f[_0x7449('0x39')],qs[_0x7449('0x3f')](_0x56c6ff[_0x7449('0x3b')]['fields']));_0x181d54['attributes']=_0x181d54[_0x7449('0x41')][_0x7449('0x40')]?_0x181d54[_0x7449('0x41')]:_0x2eab1f[_0x7449('0x39')];if(_0x56c6ff[_0x7449('0x3b')]['includeAll']){_0x181d54['include']=[{'all':!![]}];}_0x181d54=_[_0x7449('0x48')]({},_0x181d54,_0x56c6ff[_0x7449('0x51')]);return db[_0x7449('0x4c')][_0x7449('0x52')](_0x181d54)[_0x7449('0x32')](handleEntityNotFound(_0x47a303,null))[_0x7449('0x32')](respondWithResult(_0x47a303,null))['catch'](handleError(_0x47a303,null));};exports[_0x7449('0x53')]=function(_0x1cb76f,_0x43ad28){return db[_0x7449('0x4c')][_0x7449('0x53')](_0x1cb76f['body'],{})[_0x7449('0x32')](respondWithResult(_0x43ad28,0xc9))[_0x7449('0x25')](handleError(_0x43ad28,null));};exports['update']=function(_0x6e7dc3,_0x2db2a5){if(_0x6e7dc3['body']['id']){delete _0x6e7dc3[_0x7449('0x54')]['id'];}return db[_0x7449('0x4c')]['find']({'where':{'id':_0x6e7dc3[_0x7449('0x50')]['id']}})['then'](handleEntityNotFound(_0x2db2a5,null))[_0x7449('0x32')](saveUpdates(_0x6e7dc3['body'],null))[_0x7449('0x32')](respondWithResult(_0x2db2a5,null))[_0x7449('0x25')](handleError(_0x2db2a5,null));};exports['destroy']=function(_0x1f8100,_0x4ef66c){return db[_0x7449('0x4c')][_0x7449('0x52')]({'where':{'id':_0x1f8100['params']['id']}})[_0x7449('0x32')](handleEntityNotFound(_0x4ef66c,null))[_0x7449('0x32')](removeEntity(_0x4ef66c,null))[_0x7449('0x25')](handleError(_0x4ef66c,null));};exports[_0x7449('0x55')]=function(_0x2ccdd8,_0x5cf595,_0x49d97f){var _0xc768f8={};var _0x3899f3={};var _0x58a71a;var _0x438ee3;return db[_0x7449('0x4c')][_0x7449('0x56')]({'where':{'id':_0x2ccdd8[_0x7449('0x50')]['id']}})['then'](handleEntityNotFound(_0x5cf595,null))[_0x7449('0x32')](function(_0x40f07f){if(_0x40f07f){_0x58a71a=_0x40f07f;_0x3899f3['model']=_['keys'](db['SalesforceField']['rawAttributes']);_0x3899f3['query']=_[_0x7449('0x3c')](_0x2ccdd8[_0x7449('0x3b')]);_0x3899f3[_0x7449('0x3d')]=_[_0x7449('0x3e')](_0x3899f3[_0x7449('0x39')],_0x3899f3[_0x7449('0x3b')]);_0xc768f8[_0x7449('0x41')]=_['intersection'](_0x3899f3[_0x7449('0x39')],qs[_0x7449('0x3f')](_0x2ccdd8[_0x7449('0x3b')][_0x7449('0x3f')]));_0xc768f8[_0x7449('0x41')]=_0xc768f8[_0x7449('0x41')]['length']?_0xc768f8[_0x7449('0x41')]:_0x3899f3[_0x7449('0x39')];_0xc768f8[_0x7449('0x57')]=qs[_0x7449('0x44')](_0x2ccdd8[_0x7449('0x3b')]['sort']);_0xc768f8[_0x7449('0x47')]=qs[_0x7449('0x3d')](_[_0x7449('0x45')](_0x2ccdd8[_0x7449('0x3b')],_0x3899f3['filters']));if(_0x2ccdd8[_0x7449('0x3b')][_0x7449('0x46')]){_0xc768f8[_0x7449('0x47')]=_[_0x7449('0x48')](_0xc768f8[_0x7449('0x47')],{'$or':_['map'](_0xc768f8['attributes'],function(_0x34503a){var _0x3a1f49={};_0x3a1f49[_0x34503a]={'$like':'%'+_0x2ccdd8[_0x7449('0x3b')][_0x7449('0x46')]+'%'};return _0x3a1f49;})});}_0xc768f8=_[_0x7449('0x48')]({},_0xc768f8,_0x2ccdd8[_0x7449('0x51')]);return _0x58a71a[_0x7449('0x55')](_0xc768f8);}})[_0x7449('0x32')](function(_0x3dc024){if(_0x3dc024){_0x438ee3=_0x3dc024[_0x7449('0x40')];if(!_0x2ccdd8[_0x7449('0x3b')][_0x7449('0x42')](_0x7449('0x43'))){_0xc768f8['limit']=qs[_0x7449('0x2c')](_0x2ccdd8[_0x7449('0x3b')][_0x7449('0x2c')]);_0xc768f8[_0x7449('0x2b')]=qs[_0x7449('0x2b')](_0x2ccdd8[_0x7449('0x3b')]['offset']);}return _0x58a71a[_0x7449('0x55')](_0xc768f8);}})[_0x7449('0x32')](function(_0x456830){if(_0x456830){return _0x456830?{'count':_0x438ee3,'rows':_0x456830}:null;}})[_0x7449('0x32')](respondWithResult(_0x5cf595,null))[_0x7449('0x25')](handleError(_0x5cf595,null));};exports[_0x7449('0x58')]=function(_0x26c489,_0x39d50f,_0x32d955){var _0x11160e={};var _0x521b92={};var _0x231819;var _0x539044;return db['SalesforceConfiguration'][_0x7449('0x56')]({'where':{'id':_0x26c489[_0x7449('0x50')]['id']}})['then'](handleEntityNotFound(_0x39d50f,null))[_0x7449('0x32')](function(_0x4b3241){if(_0x4b3241){_0x231819=_0x4b3241;_0x521b92['model']=_['keys'](db[_0x7449('0x59')]['rawAttributes']);_0x521b92[_0x7449('0x3b')]=_[_0x7449('0x3c')](_0x26c489['query']);_0x521b92['filters']=_[_0x7449('0x3e')](_0x521b92['model'],_0x521b92['query']);_0x11160e[_0x7449('0x41')]=_[_0x7449('0x3e')](_0x521b92['model'],qs[_0x7449('0x3f')](_0x26c489[_0x7449('0x3b')][_0x7449('0x3f')]));_0x11160e[_0x7449('0x41')]=_0x11160e[_0x7449('0x41')][_0x7449('0x40')]?_0x11160e[_0x7449('0x41')]:_0x521b92[_0x7449('0x39')];_0x11160e['order']=qs[_0x7449('0x44')](_0x26c489[_0x7449('0x3b')][_0x7449('0x44')]);_0x11160e[_0x7449('0x47')]=qs[_0x7449('0x3d')](_[_0x7449('0x45')](_0x26c489['query'],_0x521b92[_0x7449('0x3d')]));if(_0x26c489['query'][_0x7449('0x46')]){_0x11160e[_0x7449('0x47')]=_[_0x7449('0x48')](_0x11160e[_0x7449('0x47')],{'$or':_['map'](_0x11160e['attributes'],function(_0x271d20){var _0x523adc={};_0x523adc[_0x271d20]={'$like':'%'+_0x26c489[_0x7449('0x3b')][_0x7449('0x46')]+'%'};return _0x523adc;})});}_0x11160e=_[_0x7449('0x48')]({},_0x11160e,_0x26c489[_0x7449('0x51')]);return _0x231819[_0x7449('0x58')](_0x11160e);}})[_0x7449('0x32')](function(_0x1e34f5){if(_0x1e34f5){_0x539044=_0x1e34f5['length'];if(!_0x26c489[_0x7449('0x3b')]['hasOwnProperty'](_0x7449('0x43'))){_0x11160e[_0x7449('0x2c')]=qs[_0x7449('0x2c')](_0x26c489[_0x7449('0x3b')]['limit']);_0x11160e[_0x7449('0x2b')]=qs[_0x7449('0x2b')](_0x26c489[_0x7449('0x3b')]['offset']);}return _0x231819[_0x7449('0x58')](_0x11160e);}})[_0x7449('0x32')](function(_0xf4d4ce){if(_0xf4d4ce){return _0xf4d4ce?{'count':_0x539044,'rows':_0xf4d4ce}:null;}})[_0x7449('0x32')](respondWithResult(_0x39d50f,null))[_0x7449('0x25')](handleError(_0x39d50f,null));};exports['getDescriptions']=function(_0x15587e,_0xdfe286,_0x432bfc){var _0x49558f={};var _0x2e6dcf={};var _0x4fbea1;var _0x54a6e1;return db[_0x7449('0x4c')]['findOne']({'where':{'id':_0x15587e[_0x7449('0x50')]['id']}})['then'](handleEntityNotFound(_0xdfe286,null))['then'](function(_0x4c2b45){if(_0x4c2b45){_0x4fbea1=_0x4c2b45;_0x2e6dcf['model']=_[_0x7449('0x3c')](db[_0x7449('0x59')][_0x7449('0x37')]);_0x2e6dcf[_0x7449('0x3b')]=_[_0x7449('0x3c')](_0x15587e[_0x7449('0x3b')]);_0x2e6dcf[_0x7449('0x3d')]=_[_0x7449('0x3e')](_0x2e6dcf[_0x7449('0x39')],_0x2e6dcf[_0x7449('0x3b')]);_0x49558f['attributes']=_[_0x7449('0x3e')](_0x2e6dcf[_0x7449('0x39')],qs['fields'](_0x15587e[_0x7449('0x3b')][_0x7449('0x3f')]));_0x49558f[_0x7449('0x41')]=_0x49558f[_0x7449('0x41')][_0x7449('0x40')]?_0x49558f[_0x7449('0x41')]:_0x2e6dcf[_0x7449('0x39')];_0x49558f[_0x7449('0x57')]=qs[_0x7449('0x44')](_0x15587e['query'][_0x7449('0x44')]);_0x49558f[_0x7449('0x47')]=qs[_0x7449('0x3d')](_[_0x7449('0x45')](_0x15587e[_0x7449('0x3b')],_0x2e6dcf['filters']));if(_0x15587e[_0x7449('0x3b')]['filter']){_0x49558f[_0x7449('0x47')]=_[_0x7449('0x48')](_0x49558f[_0x7449('0x47')],{'$or':_['map'](_0x49558f['attributes'],function(_0x3213d0){var _0x4eef43={};_0x4eef43[_0x3213d0]={'$like':'%'+_0x15587e[_0x7449('0x3b')][_0x7449('0x46')]+'%'};return _0x4eef43;})});}_0x49558f=_[_0x7449('0x48')]({},_0x49558f,_0x15587e[_0x7449('0x51')]);return _0x4fbea1['getDescriptions'](_0x49558f);}})['then'](function(_0xd44b87){if(_0xd44b87){_0x54a6e1=_0xd44b87[_0x7449('0x40')];if(!_0x15587e[_0x7449('0x3b')][_0x7449('0x42')]('nolimit')){_0x49558f[_0x7449('0x2c')]=qs[_0x7449('0x2c')](_0x15587e[_0x7449('0x3b')][_0x7449('0x2c')]);_0x49558f['offset']=qs[_0x7449('0x2b')](_0x15587e['query']['offset']);}return _0x4fbea1[_0x7449('0x5a')](_0x49558f);}})[_0x7449('0x32')](function(_0x2b754b){if(_0x2b754b){return _0x2b754b?{'count':_0x54a6e1,'rows':_0x2b754b}:null;}})['then'](respondWithResult(_0xdfe286,null))[_0x7449('0x25')](handleError(_0xdfe286,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 0f20729..7761d3e 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 _0xadd8=['./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x59bd58,_0x166ff2){var _0x5cd851=function(_0x401ba3){while(--_0x401ba3){_0x59bd58['push'](_0x59bd58['shift']());}};_0x5cd851(++_0x166ff2);}(_0xadd8,0x7c));var _0x8add=function(_0xe96af9,_0xe6a7c){_0xe96af9=_0xe96af9-0x0;var _0x2e24a7=_0xadd8[_0xe96af9];return _0x2e24a7;};'use strict';var _=require(_0x8add('0x0'));var util=require('util');var logger=require(_0x8add('0x1'))(_0x8add('0x2'));var moment=require(_0x8add('0x3'));var BPromise=require(_0x8add('0x4'));var rp=require(_0x8add('0x5'));var fs=require('fs');var path=require(_0x8add('0x6'));var rimraf=require('rimraf');var config=require(_0x8add('0x7'));var attributes=require(_0x8add('0x8'));module[_0x8add('0x9')]=function(_0x542a6a,_0x3df8b2){return _0x542a6a[_0x8add('0xa')](_0x8add('0xb'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x28b5=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util'];(function(_0x2299a9,_0x5ab754){var _0x3b9ff9=function(_0x5d2203){while(--_0x5d2203){_0x2299a9['push'](_0x2299a9['shift']());}};_0x3b9ff9(++_0x5ab754);}(_0x28b5,0x132));var _0x528b=function(_0x43593d,_0x4a904e){_0x43593d=_0x43593d-0x0;var _0x2e6284=_0x28b5[_0x43593d];return _0x2e6284;};'use strict';var _=require(_0x528b('0x0'));var util=require(_0x528b('0x1'));var logger=require(_0x528b('0x2'))('api');var moment=require(_0x528b('0x3'));var BPromise=require(_0x528b('0x4'));var rp=require(_0x528b('0x5'));var fs=require('fs');var path=require(_0x528b('0x6'));var rimraf=require(_0x528b('0x7'));var config=require(_0x528b('0x8'));var attributes=require(_0x528b('0x9'));module[_0x528b('0xa')]=function(_0x346e88,_0x22e3ea){return _0x346e88[_0x528b('0xb')](_0x528b('0xc'),attributes,{'tableName':_0x528b('0xd'),'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 bcf49ce..9a79459 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 _0xf948=['message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x171fdc,_0x16ae91){var _0x3782ea=function(_0x58b691){while(--_0x58b691){_0x171fdc['push'](_0x171fdc['shift']());}};_0x3782ea(++_0x16ae91);}(_0xf948,0xc7));var _0x8f94=function(_0x5db440,_0x1e6fec){_0x5db440=_0x5db440-0x0;var _0x5a9776=_0xf948[_0x5db440];return _0x5a9776;};'use strict';var _=require('lodash');var util=require(_0x8f94('0x0'));var moment=require(_0x8f94('0x1'));var BPromise=require(_0x8f94('0x2'));var rs=require(_0x8f94('0x3'));var fs=require('fs');var Redis=require(_0x8f94('0x4'));var db=require(_0x8f94('0x5'))['db'];var utils=require(_0x8f94('0x6'));var logger=require(_0x8f94('0x7'))('rpc');var config=require(_0x8f94('0x8'));var jayson=require(_0x8f94('0x9'));var client=jayson[_0x8f94('0xa')][_0x8f94('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x337cb7,_0x4e662a,_0x76325e){return new BPromise(function(_0x492ffe,_0x3f3643){return client[_0x8f94('0xc')](_0x337cb7,_0x76325e)['then'](function(_0x3f1f97){logger[_0x8f94('0xd')](_0x8f94('0xe'),_0x4e662a,_0x8f94('0xf'));logger[_0x8f94('0x10')](_0x8f94('0x11'),_0x4e662a,_0x8f94('0xf'),JSON[_0x8f94('0x12')](_0x3f1f97));if(_0x3f1f97[_0x8f94('0x13')]){if(_0x3f1f97['error'][_0x8f94('0x14')]===0x1f4){logger[_0x8f94('0x13')](_0x8f94('0xe'),_0x4e662a,_0x3f1f97['error'][_0x8f94('0x15')]);return _0x3f3643(_0x3f1f97[_0x8f94('0x13')][_0x8f94('0x15')]);}logger['error'](_0x8f94('0xe'),_0x4e662a,_0x3f1f97[_0x8f94('0x13')][_0x8f94('0x15')]);return _0x492ffe(_0x3f1f97[_0x8f94('0x13')]['message']);}else{logger[_0x8f94('0xd')](_0x8f94('0xe'),_0x4e662a,_0x8f94('0xf'));_0x492ffe(_0x3f1f97['result']['message']);}})['catch'](function(_0x58f4fe){logger[_0x8f94('0x13')](_0x8f94('0xe'),_0x4e662a,_0x58f4fe);_0x3f3643(_0x58f4fe);});});} \ No newline at end of file +var _0x7103=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','util'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7103,0x125));var _0x3710=function(_0x4e6ca2,_0x135ba1){_0x4e6ca2=_0x4e6ca2-0x0;var _0x1e92c8=_0x7103[_0x4e6ca2];return _0x1e92c8;};'use strict';var _=require('lodash');var util=require(_0x3710('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3710('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3710('0x2'))['db'];var utils=require(_0x3710('0x3'));var logger=require(_0x3710('0x4'))('rpc');var config=require(_0x3710('0x5'));var jayson=require(_0x3710('0x6'));var client=jayson[_0x3710('0x7')][_0x3710('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x304519,_0x2a5ff8,_0x5bc967){return new BPromise(function(_0x1139d9,_0x2462ef){return client[_0x3710('0x9')](_0x304519,_0x5bc967)[_0x3710('0xa')](function(_0x3ee2cb){logger[_0x3710('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2a5ff8,_0x3710('0xc'));logger[_0x3710('0xd')](_0x3710('0xe'),_0x2a5ff8,_0x3710('0xc'),JSON[_0x3710('0xf')](_0x3ee2cb));if(_0x3ee2cb[_0x3710('0x10')]){if(_0x3ee2cb[_0x3710('0x10')][_0x3710('0x11')]===0x1f4){logger[_0x3710('0x10')](_0x3710('0x12'),_0x2a5ff8,_0x3ee2cb['error'][_0x3710('0x13')]);return _0x2462ef(_0x3ee2cb['error'][_0x3710('0x13')]);}logger[_0x3710('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2a5ff8,_0x3ee2cb[_0x3710('0x10')][_0x3710('0x13')]);return _0x1139d9(_0x3ee2cb[_0x3710('0x10')][_0x3710('0x13')]);}else{logger[_0x3710('0xb')](_0x3710('0x12'),_0x2a5ff8,_0x3710('0xc'));_0x1139d9(_0x3ee2cb[_0x3710('0x14')][_0x3710('0x13')]);}})['catch'](function(_0x50a812){logger[_0x3710('0x10')](_0x3710('0x12'),_0x2a5ff8,_0x50a812);_0x2462ef(_0x50a812);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 9c4ac0a..04a18fb 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 _0xf4ce=['create','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','isAuthenticated','index','get','/:id','show'];(function(_0x3d127c,_0x4cd28b){var _0xb76f=function(_0x735483){while(--_0x735483){_0x3d127c['push'](_0x3d127c['shift']());}};_0xb76f(++_0x4cd28b);}(_0xf4ce,0xf2));var _0xef4c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xf4ce[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xef4c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xef4c('0x1'));var express=require(_0xef4c('0x2'));var router=express[_0xef4c('0x3')]();var fs_extra=require(_0xef4c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSalesforceField.controller');router['get']('/',auth[_0xef4c('0x5')](),controller[_0xef4c('0x6')]);router[_0xef4c('0x7')](_0xef4c('0x8'),auth[_0xef4c('0x5')](),controller[_0xef4c('0x9')]);router['post']('/',auth[_0xef4c('0x5')](),controller[_0xef4c('0xa')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xef4c('0xb')]);router[_0xef4c('0xc')](_0xef4c('0x8'),auth[_0xef4c('0x5')](),controller['destroy']);module[_0xef4c('0xd')]=router; \ No newline at end of file +var _0x9ab8=['get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller'];(function(_0xec3d9b,_0x56ede3){var _0x303494=function(_0x25117d){while(--_0x25117d){_0xec3d9b['push'](_0xec3d9b['shift']());}};_0x303494(++_0x56ede3);}(_0x9ab8,0x81));var _0x89ab=function(_0x292410,_0x54b1de){_0x292410=_0x292410-0x0;var _0x4ccc59=_0x9ab8[_0x292410];return _0x4ccc59;};'use strict';var multer=require(_0x89ab('0x0'));var util=require(_0x89ab('0x1'));var path=require(_0x89ab('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x89ab('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x89ab('0x4'));var interaction=require(_0x89ab('0x5'));var config=require('../../config/environment');var controller=require(_0x89ab('0x6'));router[_0x89ab('0x7')]('/',auth[_0x89ab('0x8')](),controller[_0x89ab('0x9')]);router[_0x89ab('0x7')](_0x89ab('0xa'),auth[_0x89ab('0x8')](),controller[_0x89ab('0xb')]);router[_0x89ab('0xc')]('/',auth[_0x89ab('0x8')](),controller[_0x89ab('0xd')]);router[_0x89ab('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x89ab('0x8')](),controller[_0x89ab('0xf')]);module[_0x89ab('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 64dddae..51b13b0 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 _0xa9e0=['string','STRING','variable','sequelize','exports','ENUM','customVariable','picklist'];(function(_0x4f769a,_0x1adf52){var _0x284b49=function(_0xfe200c){while(--_0xfe200c){_0x4f769a['push'](_0x4f769a['shift']());}};_0x284b49(++_0x1adf52);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('string','variable',_0x0a9e('0x3'),'keyValue',_0x0a9e('0x4')),'defaultValue':_0x0a9e('0x5')},'content':{'type':Sequelize[_0x0a9e('0x6')]},'key':{'type':Sequelize[_0x0a9e('0x6')]},'keyType':{'type':Sequelize[_0x0a9e('0x2')]('string',_0x0a9e('0x7'),_0x0a9e('0x3'))},'keyContent':{'type':Sequelize[_0x0a9e('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x34e8=['picklist','STRING','variable','sequelize','exports','ENUM','string','customVariable','keyValue'];(function(_0x8242a1,_0x2914cb){var _0x70ad87=function(_0x2306bf){while(--_0x2306bf){_0x8242a1['push'](_0x8242a1['shift']());}};_0x70ad87(++_0x2914cb);}(_0x34e8,0x12c));var _0x834e=function(_0x58ea08,_0xa021b8){_0x58ea08=_0x58ea08-0x0;var _0x5d228f=_0x34e8[_0x58ea08];return _0x5d228f;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'type':{'type':Sequelize[_0x834e('0x2')](_0x834e('0x3'),'variable',_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'defaultValue':_0x834e('0x3')},'content':{'type':Sequelize[_0x834e('0x7')]},'key':{'type':Sequelize[_0x834e('0x7')]},'keyType':{'type':Sequelize[_0x834e('0x2')]('string',_0x834e('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0x834e('0x7')]},'idField':{'type':Sequelize[_0x834e('0x7')]},'variableName':{'type':Sequelize[_0x834e('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 6b3f9ae..f9ffd1d 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 _0x1779=['pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','SalesforceField','fieldName','type','model','keys','query','intersection','fields','attributes','length','order','sort','where','filters'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x1779,0x175));var _0x9177=function(_0x1e52dd,_0x227bae){_0x1e52dd=_0x1e52dd-0x0;var _0x4f0751=_0x1779[_0x1e52dd];return _0x4f0751;};'use strict';var pdf=require(_0x9177('0x0'));var emlformat=require(_0x9177('0x1'));var rimraf=require(_0x9177('0x2'));var zipdir=require(_0x9177('0x3'));var jsonpatch=require(_0x9177('0x4'));var rp=require('request-promise');var moment=require(_0x9177('0x5'));var BPromise=require(_0x9177('0x6'));var Mustache=require(_0x9177('0x7'));var util=require(_0x9177('0x8'));var path=require('path');var sox=require(_0x9177('0x9'));var csv=require(_0x9177('0xa'));var ejs=require(_0x9177('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9177('0xc'));var squel=require(_0x9177('0xd'));var crypto=require(_0x9177('0xe'));var jsforce=require(_0x9177('0xf'));var deskjs=require(_0x9177('0x10'));var toCsv=require(_0x9177('0xa'));var querystring=require(_0x9177('0x11'));var Papa=require(_0x9177('0x12'));var Redis=require(_0x9177('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x9177('0x14'));var as=require(_0x9177('0x15'));var hardwareService=require(_0x9177('0x16'));var logger=require(_0x9177('0x17'))('api');var utils=require(_0x9177('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a6850,_0x4417e9){_0x4417e9=_0x4417e9||0xcc;return function(_0xeac00d){if(_0xeac00d){return _0x5a6850[_0x9177('0x19')](_0x4417e9);}return _0x5a6850[_0x9177('0x1a')](_0x4417e9)[_0x9177('0x1b')]();};}function respondWithResult(_0xea8e7b,_0x91d184){_0x91d184=_0x91d184||0xc8;return function(_0x10735e){if(_0x10735e){return _0xea8e7b[_0x9177('0x1a')](_0x91d184)[_0x9177('0x1c')](_0x10735e);}};}function respondWithFilteredResult(_0x460252,_0x2065f7){return function(_0xe06ff5){if(_0xe06ff5){var _0x12045d=_0xe06ff5[_0x9177('0x1d')],_0x94ae7b=_0x2065f7[_0x9177('0x1e')],_0x45d01c=_0x2065f7[_0x9177('0x1e')]+_0x2065f7[_0x9177('0x1f')],_0x4d91c5;if(_0x45d01c>=_0x12045d){_0x45d01c=_0x12045d;_0x4d91c5=0xc8;}else{_0x4d91c5=0xce;}_0x460252[_0x9177('0x1a')](_0x4d91c5);return _0x460252[_0x9177('0x20')](_0x9177('0x21'),_0x94ae7b+'-'+_0x45d01c+'/'+_0x12045d)['json'](_0xe06ff5);}return null;};}function patchUpdates(_0xc6b0f){return function(_0x16c3f5){try{jsonpatch[_0x9177('0x22')](_0x16c3f5,_0xc6b0f,!![]);}catch(_0x1bfbee){return BPromise[_0x9177('0x23')](_0x1bfbee);}return _0x16c3f5[_0x9177('0x24')]();};}function saveUpdates(_0x737fd1,_0x3a3509){return function(_0x4262d5){if(_0x4262d5){return _0x4262d5[_0x9177('0x25')](_0x737fd1)[_0x9177('0x26')](function(_0x4cfdd8){return _0x4cfdd8;});}return null;};}function removeEntity(_0x1e671c,_0x2a1e6e){return function(_0x1ede65){if(_0x1ede65){return _0x1ede65[_0x9177('0x27')]()[_0x9177('0x26')](function(){_0x1e671c['status'](0xcc)[_0x9177('0x1b')]();});}};}function handleEntityNotFound(_0x318fff,_0x473032){return function(_0x278848){if(!_0x278848){_0x318fff[_0x9177('0x19')](0x194);}return _0x278848;};}function handleError(_0xea740b,_0x4828cf){_0x4828cf=_0x4828cf||0x1f4;return function(_0x54dc62){logger[_0x9177('0x28')](_0x54dc62['stack']);if(_0x54dc62[_0x9177('0x29')]){delete _0x54dc62[_0x9177('0x29')];}_0xea740b[_0x9177('0x1a')](_0x4828cf)[_0x9177('0x2a')](_0x54dc62);};}exports[_0x9177('0x2b')]=function(_0x341a06,_0x2237d0){var _0x3f5342={},_0x445add={},_0x1b1c6d={'count':0x0,'rows':[]};var _0x2dbe4c=_[_0x9177('0x2c')](db[_0x9177('0x2d')]['rawAttributes'],function(_0x2404be){return{'name':_0x2404be[_0x9177('0x2e')],'type':_0x2404be[_0x9177('0x2f')]['key']};});_0x445add[_0x9177('0x30')]=_[_0x9177('0x2c')](_0x2dbe4c,_0x9177('0x29'));_0x445add['query']=_[_0x9177('0x31')](_0x341a06[_0x9177('0x32')]);_0x445add['filters']=_['intersection'](_0x445add[_0x9177('0x30')],_0x445add[_0x9177('0x32')]);_0x3f5342['attributes']=_[_0x9177('0x33')](_0x445add[_0x9177('0x30')],qs[_0x9177('0x34')](_0x341a06[_0x9177('0x32')][_0x9177('0x34')]));_0x3f5342[_0x9177('0x35')]=_0x3f5342[_0x9177('0x35')][_0x9177('0x36')]?_0x3f5342[_0x9177('0x35')]:_0x445add[_0x9177('0x30')];if(!_0x341a06[_0x9177('0x32')]['hasOwnProperty']('nolimit')){_0x3f5342[_0x9177('0x1f')]=qs[_0x9177('0x1f')](_0x341a06[_0x9177('0x32')][_0x9177('0x1f')]);_0x3f5342[_0x9177('0x1e')]=qs[_0x9177('0x1e')](_0x341a06[_0x9177('0x32')]['offset']);}_0x3f5342[_0x9177('0x37')]=qs[_0x9177('0x38')](_0x341a06['query'][_0x9177('0x38')]);_0x3f5342[_0x9177('0x39')]=qs[_0x9177('0x3a')](_[_0x9177('0x3b')](_0x341a06[_0x9177('0x32')],_0x445add[_0x9177('0x3a')]),_0x2dbe4c);if(_0x341a06[_0x9177('0x32')][_0x9177('0x3c')]){_0x3f5342[_0x9177('0x39')]=_[_0x9177('0x3d')](_0x3f5342[_0x9177('0x39')],{'$or':_[_0x9177('0x2c')](_0x2dbe4c,function(_0x479df9){if(_0x479df9[_0x9177('0x2f')]!==_0x9177('0x3e')){var _0x648347={};_0x648347[_0x479df9[_0x9177('0x29')]]={'$like':'%'+_0x341a06[_0x9177('0x32')]['filter']+'%'};return _0x648347;}})});}_0x3f5342=_['merge']({},_0x3f5342,_0x341a06[_0x9177('0x3f')]);var _0x4b31cb={'where':_0x3f5342[_0x9177('0x39')]};return db['SalesforceField']['count'](_0x4b31cb)[_0x9177('0x26')](function(_0x483950){_0x1b1c6d[_0x9177('0x1d')]=_0x483950;if(_0x341a06[_0x9177('0x32')][_0x9177('0x40')]){_0x3f5342[_0x9177('0x41')]=[{'all':!![]}];}return db[_0x9177('0x2d')][_0x9177('0x42')](_0x3f5342);})[_0x9177('0x26')](function(_0x33b05b){_0x1b1c6d['rows']=_0x33b05b;return _0x1b1c6d;})['then'](respondWithFilteredResult(_0x2237d0,_0x3f5342))['catch'](handleError(_0x2237d0,null));};exports[_0x9177('0x43')]=function(_0x1df162,_0x469be6){var _0x216084={'raw':!![],'where':{'id':_0x1df162[_0x9177('0x44')]['id']}},_0x36b0a2={};_0x36b0a2['model']=_['keys'](db['SalesforceField']['rawAttributes']);_0x36b0a2['query']=_[_0x9177('0x31')](_0x1df162[_0x9177('0x32')]);_0x36b0a2[_0x9177('0x3a')]=_[_0x9177('0x33')](_0x36b0a2[_0x9177('0x30')],_0x36b0a2[_0x9177('0x32')]);_0x216084[_0x9177('0x35')]=_[_0x9177('0x33')](_0x36b0a2['model'],qs[_0x9177('0x34')](_0x1df162['query'][_0x9177('0x34')]));_0x216084[_0x9177('0x35')]=_0x216084[_0x9177('0x35')][_0x9177('0x36')]?_0x216084[_0x9177('0x35')]:_0x36b0a2[_0x9177('0x30')];if(_0x1df162[_0x9177('0x32')]['includeAll']){_0x216084[_0x9177('0x41')]=[{'all':!![]}];}_0x216084=_['merge']({},_0x216084,_0x1df162[_0x9177('0x3f')]);return db[_0x9177('0x2d')][_0x9177('0x45')](_0x216084)[_0x9177('0x26')](handleEntityNotFound(_0x469be6,null))[_0x9177('0x26')](respondWithResult(_0x469be6,null))[_0x9177('0x46')](handleError(_0x469be6,null));};exports['create']=function(_0x3ca40f,_0x4a21d8){return db[_0x9177('0x2d')]['create'](_0x3ca40f['body'],{})[_0x9177('0x26')](respondWithResult(_0x4a21d8,0xc9))[_0x9177('0x46')](handleError(_0x4a21d8,null));};exports[_0x9177('0x25')]=function(_0x5472db,_0x482f8a){if(_0x5472db[_0x9177('0x47')]['id']){delete _0x5472db[_0x9177('0x47')]['id'];}return db[_0x9177('0x2d')][_0x9177('0x45')]({'where':{'id':_0x5472db[_0x9177('0x44')]['id']}})[_0x9177('0x26')](handleEntityNotFound(_0x482f8a,null))[_0x9177('0x26')](saveUpdates(_0x5472db['body'],null))[_0x9177('0x26')](respondWithResult(_0x482f8a,null))[_0x9177('0x46')](handleError(_0x482f8a,null));};exports[_0x9177('0x27')]=function(_0x3d5784,_0x4098ce){return db[_0x9177('0x2d')][_0x9177('0x45')]({'where':{'id':_0x3d5784[_0x9177('0x44')]['id']}})[_0x9177('0x26')](handleEntityNotFound(_0x4098ce,null))['then'](removeEntity(_0x4098ce,null))[_0x9177('0x46')](handleError(_0x4098ce,null));}; \ No newline at end of file +var _0x8d0e=['intersection','attributes','model','fields','length','nolimit','offset','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','params','include','find','catch','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','set','Content-Range','apply','update','then','error','stack','name','send','index','map','SalesforceField','rawAttributes','type','query','keys'];(function(_0x3be7c3,_0x494f27){var _0x34b1b9=function(_0x2855c2){while(--_0x2855c2){_0x3be7c3['push'](_0x3be7c3['shift']());}};_0x34b1b9(++_0x494f27);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x4ddda1,_0x5833ce){_0x4ddda1=_0x4ddda1-0x0;var _0x41b39f=_0x8d0e[_0x4ddda1];return _0x41b39f;};'use strict';var pdf=require(_0xe8d0('0x0'));var emlformat=require(_0xe8d0('0x1'));var rimraf=require(_0xe8d0('0x2'));var zipdir=require(_0xe8d0('0x3'));var jsonpatch=require(_0xe8d0('0x4'));var rp=require(_0xe8d0('0x5'));var moment=require(_0xe8d0('0x6'));var BPromise=require(_0xe8d0('0x7'));var Mustache=require(_0xe8d0('0x8'));var util=require('util');var path=require(_0xe8d0('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe8d0('0xa'));var fs=require('fs');var fs_extra=require(_0xe8d0('0xb'));var _=require(_0xe8d0('0xc'));var squel=require(_0xe8d0('0xd'));var crypto=require(_0xe8d0('0xe'));var jsforce=require(_0xe8d0('0xf'));var deskjs=require(_0xe8d0('0x10'));var toCsv=require(_0xe8d0('0x11'));var querystring=require('querystring');var Papa=require(_0xe8d0('0x12'));var Redis=require(_0xe8d0('0x13'));var authService=require(_0xe8d0('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe8d0('0x15'));var logger=require(_0xe8d0('0x16'))(_0xe8d0('0x17'));var utils=require(_0xe8d0('0x18'));var config=require(_0xe8d0('0x19'));var licenseUtil=require(_0xe8d0('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38fac0,_0x15b9e5){_0x15b9e5=_0x15b9e5||0xcc;return function(_0x533b42){if(_0x533b42){return _0x38fac0[_0xe8d0('0x1b')](_0x15b9e5);}return _0x38fac0['status'](_0x15b9e5)['end']();};}function respondWithResult(_0x90a1ea,_0x2aa906){_0x2aa906=_0x2aa906||0xc8;return function(_0x1aa725){if(_0x1aa725){return _0x90a1ea[_0xe8d0('0x1c')](_0x2aa906)[_0xe8d0('0x1d')](_0x1aa725);}};}function respondWithFilteredResult(_0x7151c6,_0x52818a){return function(_0x6ccffa){if(_0x6ccffa){var _0x49554d=_0x6ccffa['count'],_0x6d932b=_0x52818a['offset'],_0x3c526c=_0x52818a['offset']+_0x52818a[_0xe8d0('0x1e')],_0xfe8a4;if(_0x3c526c>=_0x49554d){_0x3c526c=_0x49554d;_0xfe8a4=0xc8;}else{_0xfe8a4=0xce;}_0x7151c6[_0xe8d0('0x1c')](_0xfe8a4);return _0x7151c6[_0xe8d0('0x1f')](_0xe8d0('0x20'),_0x6d932b+'-'+_0x3c526c+'/'+_0x49554d)[_0xe8d0('0x1d')](_0x6ccffa);}return null;};}function patchUpdates(_0x588133){return function(_0x105861){try{jsonpatch[_0xe8d0('0x21')](_0x105861,_0x588133,!![]);}catch(_0x524b00){return BPromise['reject'](_0x524b00);}return _0x105861['save']();};}function saveUpdates(_0x384a60,_0x35d131){return function(_0x25363b){if(_0x25363b){return _0x25363b[_0xe8d0('0x22')](_0x384a60)[_0xe8d0('0x23')](function(_0x23a945){return _0x23a945;});}return null;};}function removeEntity(_0x1bd25c,_0x28a6b5){return function(_0x32e39a){if(_0x32e39a){return _0x32e39a['destroy']()[_0xe8d0('0x23')](function(){_0x1bd25c[_0xe8d0('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x106614,_0x2e69d1){return function(_0x274cac){if(!_0x274cac){_0x106614[_0xe8d0('0x1b')](0x194);}return _0x274cac;};}function handleError(_0x146783,_0x149dfd){_0x149dfd=_0x149dfd||0x1f4;return function(_0x31519b){logger[_0xe8d0('0x24')](_0x31519b[_0xe8d0('0x25')]);if(_0x31519b[_0xe8d0('0x26')]){delete _0x31519b[_0xe8d0('0x26')];}_0x146783['status'](_0x149dfd)[_0xe8d0('0x27')](_0x31519b);};}exports[_0xe8d0('0x28')]=function(_0x10dec2,_0x486f49){var _0x10a30b={},_0x343b08={},_0x526240={'count':0x0,'rows':[]};var _0x1519e2=_[_0xe8d0('0x29')](db[_0xe8d0('0x2a')][_0xe8d0('0x2b')],function(_0x3cf3d6){return{'name':_0x3cf3d6['fieldName'],'type':_0x3cf3d6[_0xe8d0('0x2c')]['key']};});_0x343b08['model']=_['map'](_0x1519e2,_0xe8d0('0x26'));_0x343b08[_0xe8d0('0x2d')]=_[_0xe8d0('0x2e')](_0x10dec2['query']);_0x343b08['filters']=_[_0xe8d0('0x2f')](_0x343b08['model'],_0x343b08[_0xe8d0('0x2d')]);_0x10a30b[_0xe8d0('0x30')]=_[_0xe8d0('0x2f')](_0x343b08[_0xe8d0('0x31')],qs[_0xe8d0('0x32')](_0x10dec2['query'][_0xe8d0('0x32')]));_0x10a30b[_0xe8d0('0x30')]=_0x10a30b[_0xe8d0('0x30')][_0xe8d0('0x33')]?_0x10a30b['attributes']:_0x343b08[_0xe8d0('0x31')];if(!_0x10dec2[_0xe8d0('0x2d')]['hasOwnProperty'](_0xe8d0('0x34'))){_0x10a30b['limit']=qs[_0xe8d0('0x1e')](_0x10dec2['query'][_0xe8d0('0x1e')]);_0x10a30b['offset']=qs[_0xe8d0('0x35')](_0x10dec2[_0xe8d0('0x2d')][_0xe8d0('0x35')]);}_0x10a30b[_0xe8d0('0x36')]=qs['sort'](_0x10dec2[_0xe8d0('0x2d')][_0xe8d0('0x37')]);_0x10a30b[_0xe8d0('0x38')]=qs['filters'](_[_0xe8d0('0x39')](_0x10dec2[_0xe8d0('0x2d')],_0x343b08[_0xe8d0('0x3a')]),_0x1519e2);if(_0x10dec2[_0xe8d0('0x2d')][_0xe8d0('0x3b')]){_0x10a30b['where']=_[_0xe8d0('0x3c')](_0x10a30b[_0xe8d0('0x38')],{'$or':_[_0xe8d0('0x29')](_0x1519e2,function(_0x3d76d5){if(_0x3d76d5[_0xe8d0('0x2c')]!==_0xe8d0('0x3d')){var _0xbb9620={};_0xbb9620[_0x3d76d5[_0xe8d0('0x26')]]={'$like':'%'+_0x10dec2['query']['filter']+'%'};return _0xbb9620;}})});}_0x10a30b=_[_0xe8d0('0x3c')]({},_0x10a30b,_0x10dec2[_0xe8d0('0x3e')]);var _0x45e2dc={'where':_0x10a30b[_0xe8d0('0x38')]};return db[_0xe8d0('0x2a')]['count'](_0x45e2dc)[_0xe8d0('0x23')](function(_0x4bd7a2){_0x526240[_0xe8d0('0x3f')]=_0x4bd7a2;if(_0x10dec2[_0xe8d0('0x2d')][_0xe8d0('0x40')]){_0x10a30b['include']=[{'all':!![]}];}return db[_0xe8d0('0x2a')][_0xe8d0('0x41')](_0x10a30b);})[_0xe8d0('0x23')](function(_0x230a90){_0x526240[_0xe8d0('0x42')]=_0x230a90;return _0x526240;})['then'](respondWithFilteredResult(_0x486f49,_0x10a30b))['catch'](handleError(_0x486f49,null));};exports['show']=function(_0x4cf0da,_0x14ffb6){var _0x52f288={'raw':!![],'where':{'id':_0x4cf0da[_0xe8d0('0x43')]['id']}},_0x1e6e8f={};_0x1e6e8f[_0xe8d0('0x31')]=_[_0xe8d0('0x2e')](db[_0xe8d0('0x2a')][_0xe8d0('0x2b')]);_0x1e6e8f[_0xe8d0('0x2d')]=_[_0xe8d0('0x2e')](_0x4cf0da['query']);_0x1e6e8f[_0xe8d0('0x3a')]=_[_0xe8d0('0x2f')](_0x1e6e8f['model'],_0x1e6e8f['query']);_0x52f288[_0xe8d0('0x30')]=_[_0xe8d0('0x2f')](_0x1e6e8f[_0xe8d0('0x31')],qs['fields'](_0x4cf0da[_0xe8d0('0x2d')][_0xe8d0('0x32')]));_0x52f288['attributes']=_0x52f288[_0xe8d0('0x30')][_0xe8d0('0x33')]?_0x52f288['attributes']:_0x1e6e8f[_0xe8d0('0x31')];if(_0x4cf0da[_0xe8d0('0x2d')][_0xe8d0('0x40')]){_0x52f288[_0xe8d0('0x44')]=[{'all':!![]}];}_0x52f288=_[_0xe8d0('0x3c')]({},_0x52f288,_0x4cf0da[_0xe8d0('0x3e')]);return db[_0xe8d0('0x2a')][_0xe8d0('0x45')](_0x52f288)['then'](handleEntityNotFound(_0x14ffb6,null))[_0xe8d0('0x23')](respondWithResult(_0x14ffb6,null))[_0xe8d0('0x46')](handleError(_0x14ffb6,null));};exports[_0xe8d0('0x47')]=function(_0x2278ef,_0x28d38b){return db[_0xe8d0('0x2a')][_0xe8d0('0x47')](_0x2278ef[_0xe8d0('0x48')],{})[_0xe8d0('0x23')](respondWithResult(_0x28d38b,0xc9))[_0xe8d0('0x46')](handleError(_0x28d38b,null));};exports[_0xe8d0('0x22')]=function(_0x3a5987,_0x596303){if(_0x3a5987[_0xe8d0('0x48')]['id']){delete _0x3a5987[_0xe8d0('0x48')]['id'];}return db[_0xe8d0('0x2a')][_0xe8d0('0x45')]({'where':{'id':_0x3a5987[_0xe8d0('0x43')]['id']}})[_0xe8d0('0x23')](handleEntityNotFound(_0x596303,null))[_0xe8d0('0x23')](saveUpdates(_0x3a5987['body'],null))[_0xe8d0('0x23')](respondWithResult(_0x596303,null))[_0xe8d0('0x46')](handleError(_0x596303,null));};exports[_0xe8d0('0x49')]=function(_0x205933,_0x4ed47f){return db[_0xe8d0('0x2a')]['find']({'where':{'id':_0x205933[_0xe8d0('0x43')]['id']}})[_0xe8d0('0x23')](handleEntityNotFound(_0x4ed47f,null))[_0xe8d0('0x23')](removeEntity(_0x4ed47f,null))[_0xe8d0('0x46')](handleError(_0x4ed47f,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index d84961b..5e05994 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 _0xab29=['path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','util','../../config/logger','api','bluebird'];(function(_0x28cef2,_0x46abbc){var _0x43ca5a=function(_0x5e841e){while(--_0x5e841e){_0x28cef2['push'](_0x28cef2['shift']());}};_0x43ca5a(++_0x46abbc);}(_0xab29,0x145));var _0x9ab2=function(_0x4471d9,_0x9cabc0){_0x4471d9=_0x4471d9-0x0;var _0x3865de=_0xab29[_0x4471d9];return _0x3865de;};'use strict';var _=require(_0x9ab2('0x0'));var util=require(_0x9ab2('0x1'));var logger=require(_0x9ab2('0x2'))(_0x9ab2('0x3'));var moment=require('moment');var BPromise=require(_0x9ab2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ab2('0x5'));var rimraf=require(_0x9ab2('0x6'));var config=require(_0x9ab2('0x7'));var attributes=require(_0x9ab2('0x8'));module[_0x9ab2('0x9')]=function(_0x47cc4f,_0x3c3e85){return _0x47cc4f[_0x9ab2('0xa')](_0x9ab2('0xb'),attributes,{'tableName':_0x9ab2('0xc'),'paranoid':![],'indexes':[{'name':_0x9ab2('0xd'),'fields':['idField',_0x9ab2('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x10af=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField'];(function(_0x205e5a,_0x5c19fb){var _0x10da58=function(_0x1ba35d){while(--_0x1ba35d){_0x205e5a['push'](_0x205e5a['shift']());}};_0x10da58(++_0x5c19fb);}(_0x10af,0xfc));var _0xf10a=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x10af[_0x39c734];return _0xb2a2f9;};'use strict';var _=require(_0xf10a('0x0'));var util=require('util');var logger=require(_0xf10a('0x1'))(_0xf10a('0x2'));var moment=require(_0xf10a('0x3'));var BPromise=require(_0xf10a('0x4'));var rp=require(_0xf10a('0x5'));var fs=require('fs');var path=require(_0xf10a('0x6'));var rimraf=require(_0xf10a('0x7'));var config=require(_0xf10a('0x8'));var attributes=require('./intSalesforceField.attributes');module[_0xf10a('0x9')]=function(_0xf86ea1,_0x5c9a4c){return _0xf86ea1['define'](_0xf10a('0xa'),attributes,{'tableName':_0xf10a('0xb'),'paranoid':![],'indexes':[{'name':_0xf10a('0xc'),'fields':[_0xf10a('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index c2203e5..ce1716d 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 _0x4483=['stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x45e286,_0x28b517){var _0x201263=function(_0x3b0050){while(--_0x3b0050){_0x45e286['push'](_0x45e286['shift']());}};_0x201263(++_0x28b517);}(_0x4483,0x1a3));var _0x3448=function(_0x511f28,_0x172aad){_0x511f28=_0x511f28-0x0;var _0x55a3ee=_0x4483[_0x511f28];return _0x55a3ee;};'use strict';var _=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var moment=require(_0x3448('0x2'));var BPromise=require('bluebird');var rs=require(_0x3448('0x3'));var fs=require('fs');var Redis=require(_0x3448('0x4'));var db=require(_0x3448('0x5'))['db'];var utils=require(_0x3448('0x6'));var logger=require(_0x3448('0x7'))('rpc');var config=require(_0x3448('0x8'));var jayson=require(_0x3448('0x9'));var client=jayson[_0x3448('0xa')][_0x3448('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bb7e5,_0x2caa81,_0x3cc81d){return new BPromise(function(_0x34b926,_0x5923ee){return client['request'](_0x1bb7e5,_0x3cc81d)[_0x3448('0xc')](function(_0x25c152){logger[_0x3448('0xd')](_0x3448('0xe'),_0x2caa81,_0x3448('0xf'));logger[_0x3448('0x10')](_0x3448('0x11'),_0x2caa81,_0x3448('0xf'),JSON[_0x3448('0x12')](_0x25c152));if(_0x25c152[_0x3448('0x13')]){if(_0x25c152[_0x3448('0x13')]['code']===0x1f4){logger['error'](_0x3448('0xe'),_0x2caa81,_0x25c152[_0x3448('0x13')]['message']);return _0x5923ee(_0x25c152[_0x3448('0x13')][_0x3448('0x14')]);}logger[_0x3448('0x13')]('SalesforceField,\x20%s,\x20%s',_0x2caa81,_0x25c152[_0x3448('0x13')][_0x3448('0x14')]);return _0x34b926(_0x25c152['error'][_0x3448('0x14')]);}else{logger[_0x3448('0xd')](_0x3448('0xe'),_0x2caa81,'request\x20sent');_0x34b926(_0x25c152[_0x3448('0x15')][_0x3448('0x14')]);}})[_0x3448('0x16')](function(_0x30f8dd){logger[_0x3448('0x13')](_0x3448('0xe'),_0x2caa81,_0x30f8dd);_0x5923ee(_0x30f8dd);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x374707,_0x3cb2db){var _0x36385f=function(_0x51cd80){while(--_0x51cd80){_0x374707['push'](_0x374707['shift']());}};_0x36385f(++_0x3cb2db);}(_0xe706,0xa3));var _0x6e70=function(_0x45c448,_0x326332){_0x45c448=_0x45c448-0x0;var _0x415d10=_0xe706[_0x45c448];return _0x415d10;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('SalesforceField,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('SalesforceField,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 192ae4e..fb625c5 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 _0x5b12=['../../components/auth/service','../../config/environment','isAuthenticated','/:id','show','get','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','exports','multer','util','path','express','fs-extra'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0x5b12,0xa3));var _0x25b1=function(_0x4aaa5c,_0x3815d3){_0x4aaa5c=_0x4aaa5c-0x0;var _0x45dc0d=_0x5b12[_0x4aaa5c];return _0x45dc0d;};'use strict';var multer=require(_0x25b1('0x0'));var util=require(_0x25b1('0x1'));var path=require(_0x25b1('0x2'));var timeout=require('connect-timeout');var express=require(_0x25b1('0x3'));var router=express['Router']();var fs_extra=require(_0x25b1('0x4'));var auth=require(_0x25b1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x25b1('0x6'));var controller=require('./intServicenowAccount.controller');router['get']('/',auth[_0x25b1('0x7')](),controller['index']);router['get'](_0x25b1('0x8'),auth[_0x25b1('0x7')](),controller[_0x25b1('0x9')]);router[_0x25b1('0xa')](_0x25b1('0xb'),auth[_0x25b1('0x7')](),controller[_0x25b1('0xc')]);router[_0x25b1('0xa')]('/:id/fields',auth[_0x25b1('0x7')](),controller[_0x25b1('0xd')]);router[_0x25b1('0xe')]('/',auth[_0x25b1('0x7')](),controller[_0x25b1('0xf')]);router[_0x25b1('0xe')](_0x25b1('0xb'),auth[_0x25b1('0x7')](),controller[_0x25b1('0x10')]);router[_0x25b1('0x11')](_0x25b1('0x8'),auth[_0x25b1('0x7')](),controller[_0x25b1('0x12')]);router[_0x25b1('0x13')](_0x25b1('0x8'),auth[_0x25b1('0x7')](),controller['destroy']);module[_0x25b1('0x14')]=router; \ No newline at end of file +var _0xc900=['../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','/:id','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x5523f8,_0x3f3b10){var _0x13518a=function(_0x186a21){while(--_0x186a21){_0x5523f8['push'](_0x5523f8['shift']());}};_0x13518a(++_0x3f3b10);}(_0xc900,0xb3));var _0x0c90=function(_0x9e54eb,_0x1a9919){_0x9e54eb=_0x9e54eb-0x0;var _0x418379=_0xc900[_0x9e54eb];return _0x418379;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0c90('0x0'));var timeout=require(_0x0c90('0x1'));var express=require(_0x0c90('0x2'));var router=express['Router']();var fs_extra=require(_0x0c90('0x3'));var auth=require(_0x0c90('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0c90('0x5'));var controller=require(_0x0c90('0x6'));router[_0x0c90('0x7')]('/',auth[_0x0c90('0x8')](),controller[_0x0c90('0x9')]);router[_0x0c90('0x7')]('/:id',auth[_0x0c90('0x8')](),controller[_0x0c90('0xa')]);router[_0x0c90('0x7')](_0x0c90('0xb'),auth[_0x0c90('0x8')](),controller[_0x0c90('0xc')]);router[_0x0c90('0x7')](_0x0c90('0xd'),auth[_0x0c90('0x8')](),controller[_0x0c90('0xe')]);router[_0x0c90('0xf')]('/',auth[_0x0c90('0x8')](),controller[_0x0c90('0x10')]);router['post'](_0x0c90('0xb'),auth['isAuthenticated'](),controller[_0x0c90('0x11')]);router['put'](_0x0c90('0x12'),auth[_0x0c90('0x8')](),controller[_0x0c90('0x13')]);router[_0x0c90('0x14')](_0x0c90('0x12'),auth['isAuthenticated'](),controller[_0x0c90('0x15')]);module[_0x0c90('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index adb8b29..7e185c1 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 _0xa004=['exports','STRING'];(function(_0x2b37aa,_0x1d40dc){var _0x52b73d=function(_0x5eb623){while(--_0x5eb623){_0x2b37aa['push'](_0x2b37aa['shift']());}};_0x52b73d(++_0x1d40dc);}(_0xa004,0x1ea));var _0x4a00=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa004[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x4a00('0x0')]={'name':{'type':Sequelize[_0x4a00('0x1')]},'description':{'type':Sequelize[_0x4a00('0x1')]},'username':{'type':Sequelize[_0x4a00('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x4a00('0x1')]},'email':{'type':Sequelize[_0x4a00('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xa184=['STRING','username','remoteUri','sequelize','exports'];(function(_0x534538,_0x32a10b){var _0x2f1f0f=function(_0x52cd12){while(--_0x52cd12){_0x534538['push'](_0x534538['shift']());}};_0x2f1f0f(++_0x32a10b);}(_0xa184,0x80));var _0x4a18=function(_0x525af9,_0x4edd23){_0x525af9=_0x525af9-0x0;var _0x129fbf=_0xa184[_0x525af9];return _0x129fbf;};'use strict';var Sequelize=require(_0x4a18('0x0'));module[_0x4a18('0x1')]={'name':{'type':Sequelize[_0x4a18('0x2')]},'description':{'type':Sequelize[_0x4a18('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x4a18('0x3')},'password':{'type':Sequelize[_0x4a18('0x2')]},'email':{'type':Sequelize[_0x4a18('0x2')]},'remoteUri':{'type':Sequelize[_0x4a18('0x2')],'unique':_0x4a18('0x4')},'serverUrl':{'type':Sequelize[_0x4a18('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 4b46402..b107021 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 _0xc1b9=['closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','priority','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','work_notes','work_start','assignment_group','business_stc','description','calendar_duration','sys_class_name','closed_by','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','correlation_id','location','category','username','password','email','serverUrl','remoteUri','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','all','concat','test','statusCode','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','then','info','ServicenowAccount,\x20%s,\x20%s','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','sendStatus','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','order','sort','where','filters','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','find','create','update','body','params','destroy','getConfigurations','findOne','ServicenowConfiguration','pick','filter','hasOwnProperty','nolimit','addConfiguration','Descriptions','getDescriptions','channel','ServicenowField','Subjects','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','user_input','sys_domain','sys_created_by','calendar_stc'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0xc1b9,0x1df));var _0x9c1b=function(_0x2c534a,_0x18a19e){_0x2c534a=_0x2c534a-0x0;var _0x3f5c99=_0xc1b9[_0x2c534a];return _0x3f5c99;};'use strict';var pdf=require(_0x9c1b('0x0'));var emlformat=require(_0x9c1b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9c1b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9c1b('0x3'));var moment=require(_0x9c1b('0x4'));var BPromise=require(_0x9c1b('0x5'));var Mustache=require(_0x9c1b('0x6'));var util=require('util');var path=require(_0x9c1b('0x7'));var sox=require('sox');var csv=require(_0x9c1b('0x8'));var ejs=require(_0x9c1b('0x9'));var fs=require('fs');var fs_extra=require(_0x9c1b('0xa'));var _=require(_0x9c1b('0xb'));var squel=require('squel');var crypto=require(_0x9c1b('0xc'));var jsforce=require(_0x9c1b('0xd'));var deskjs=require(_0x9c1b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9c1b('0xf'));var Papa=require('papaparse');var Redis=require(_0x9c1b('0x10'));var authService=require(_0x9c1b('0x11'));var qs=require(_0x9c1b('0x12'));var as=require(_0x9c1b('0x13'));var hardwareService=require(_0x9c1b('0x14'));var logger=require(_0x9c1b('0x15'))(_0x9c1b('0x16'));var utils=require(_0x9c1b('0x17'));var config=require(_0x9c1b('0x18'));var licenseUtil=require(_0x9c1b('0x19'));var db=require(_0x9c1b('0x1a'))['db'];var integrations=require(_0x9c1b('0x1b'));var jayson=require('jayson/promise');var client=jayson[_0x9c1b('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3937ba,_0x10c44e,_0x1d314e,_0xb8cd22){return new BPromise(function(_0x17e0f4,_0x5e5a6f){var _0x127a8c=_0xb8cd22||client;return _0x127a8c['request'](_0x3937ba,_0x1d314e)[_0x9c1b('0x1d')](function(_0x2e325c){logger[_0x9c1b('0x1e')](_0x9c1b('0x1f'),_0x10c44e,'request\x20sent');logger['debug'](_0x9c1b('0x20'),_0x10c44e,_0x9c1b('0x21'),JSON['stringify'](_0x2e325c));if(_0x2e325c[_0x9c1b('0x22')]){if(_0x2e325c[_0x9c1b('0x22')][_0x9c1b('0x23')]===0x1f4){logger[_0x9c1b('0x22')](_0x9c1b('0x1f'),_0x10c44e,_0x2e325c[_0x9c1b('0x22')][_0x9c1b('0x24')]);return _0x5e5a6f(_0x2e325c['error']['message']);}logger[_0x9c1b('0x22')](_0x9c1b('0x1f'),_0x10c44e,_0x2e325c['error'][_0x9c1b('0x24')]);return _0x17e0f4(_0x2e325c[_0x9c1b('0x22')][_0x9c1b('0x24')]);}else{logger[_0x9c1b('0x1e')]('ServicenowAccount,\x20%s,\x20%s',_0x10c44e,'request\x20sent');_0x17e0f4(_0x2e325c[_0x9c1b('0x25')][_0x9c1b('0x24')]);}})[_0x9c1b('0x26')](function(_0x559147){logger[_0x9c1b('0x22')](_0x9c1b('0x1f'),_0x10c44e,_0x559147);_0x5e5a6f(_0x559147);});});}function respondWithStatusCode(_0x1f7541,_0x61b418){_0x61b418=_0x61b418||0xcc;return function(_0x3438e3){if(_0x3438e3){return _0x1f7541['sendStatus'](_0x61b418);}return _0x1f7541[_0x9c1b('0x27')](_0x61b418)[_0x9c1b('0x28')]();};}function respondWithResult(_0x3f8e50,_0xa20efd){_0xa20efd=_0xa20efd||0xc8;return function(_0x1b3df6){if(_0x1b3df6){return _0x3f8e50[_0x9c1b('0x27')](_0xa20efd)[_0x9c1b('0x29')](_0x1b3df6);}};}function respondWithFilteredResult(_0xd3f8e8,_0x595662){return function(_0x51d5b6){if(_0x51d5b6){var _0x5eb845=_0x51d5b6[_0x9c1b('0x2a')],_0xb477a9=_0x595662[_0x9c1b('0x2b')],_0xdeb6bc=_0x595662['offset']+_0x595662[_0x9c1b('0x2c')],_0x4ae429;if(_0xdeb6bc>=_0x5eb845){_0xdeb6bc=_0x5eb845;_0x4ae429=0xc8;}else{_0x4ae429=0xce;}_0xd3f8e8[_0x9c1b('0x27')](_0x4ae429);return _0xd3f8e8[_0x9c1b('0x2d')](_0x9c1b('0x2e'),_0xb477a9+'-'+_0xdeb6bc+'/'+_0x5eb845)[_0x9c1b('0x29')](_0x51d5b6);}return null;};}function patchUpdates(_0xc2dc9c){return function(_0xcab6ee){try{jsonpatch[_0x9c1b('0x2f')](_0xcab6ee,_0xc2dc9c,!![]);}catch(_0x30f4ae){return BPromise[_0x9c1b('0x30')](_0x30f4ae);}return _0xcab6ee[_0x9c1b('0x31')]();};}function saveUpdates(_0x28655c,_0x58a516){return function(_0xd25483){if(_0xd25483){return _0xd25483['update'](_0x28655c)[_0x9c1b('0x1d')](function(_0x5e3815){return _0x5e3815;});}return null;};}function removeEntity(_0x3f1de9,_0x2df59b){return function(_0x5b995e){if(_0x5b995e){return _0x5b995e['destroy']()[_0x9c1b('0x1d')](function(){_0x3f1de9[_0x9c1b('0x27')](0xcc)[_0x9c1b('0x28')]();});}};}function handleEntityNotFound(_0x3a5580,_0x2d5ee5){return function(_0x576259){if(!_0x576259){_0x3a5580[_0x9c1b('0x32')](0x194);}return _0x576259;};}function handleError(_0x126ec4,_0x415f94){_0x415f94=_0x415f94||0x1f4;return function(_0x6d00e8){logger[_0x9c1b('0x22')](_0x6d00e8[_0x9c1b('0x33')]);if(_0x6d00e8[_0x9c1b('0x34')]){delete _0x6d00e8[_0x9c1b('0x34')];}_0x126ec4['status'](_0x415f94)[_0x9c1b('0x35')](_0x6d00e8);};}exports[_0x9c1b('0x36')]=function(_0x2d0d4e,_0x5accf6){var _0x52605e={},_0x1c33b={},_0x3ae8e1={'count':0x0,'rows':[]};var _0x334f0c=_[_0x9c1b('0x37')](db[_0x9c1b('0x38')][_0x9c1b('0x39')],function(_0x342c05){return{'name':_0x342c05[_0x9c1b('0x3a')],'type':_0x342c05[_0x9c1b('0x3b')][_0x9c1b('0x3c')]};});_0x1c33b['model']=_[_0x9c1b('0x37')](_0x334f0c,'name');_0x1c33b[_0x9c1b('0x3d')]=_[_0x9c1b('0x3e')](_0x2d0d4e[_0x9c1b('0x3d')]);_0x1c33b['filters']=_[_0x9c1b('0x3f')](_0x1c33b[_0x9c1b('0x40')],_0x1c33b[_0x9c1b('0x3d')]);_0x52605e['attributes']=_[_0x9c1b('0x3f')](_0x1c33b['model'],qs['fields'](_0x2d0d4e['query'][_0x9c1b('0x41')]));_0x52605e['attributes']=_0x52605e[_0x9c1b('0x42')][_0x9c1b('0x43')]?_0x52605e['attributes']:_0x1c33b['model'];if(!_0x2d0d4e[_0x9c1b('0x3d')]['hasOwnProperty']('nolimit')){_0x52605e[_0x9c1b('0x2c')]=qs[_0x9c1b('0x2c')](_0x2d0d4e['query'][_0x9c1b('0x2c')]);_0x52605e['offset']=qs[_0x9c1b('0x2b')](_0x2d0d4e[_0x9c1b('0x3d')][_0x9c1b('0x2b')]);}_0x52605e[_0x9c1b('0x44')]=qs[_0x9c1b('0x45')](_0x2d0d4e['query'][_0x9c1b('0x45')]);_0x52605e[_0x9c1b('0x46')]=qs[_0x9c1b('0x47')](_['pick'](_0x2d0d4e[_0x9c1b('0x3d')],_0x1c33b[_0x9c1b('0x47')]),_0x334f0c);if(_0x2d0d4e[_0x9c1b('0x3d')]['filter']){_0x52605e['where']=_['merge'](_0x52605e['where'],{'$or':_['map'](_0x334f0c,function(_0x27b69c){if(_0x27b69c[_0x9c1b('0x3b')]!==_0x9c1b('0x48')){var _0x15f14f={};_0x15f14f[_0x27b69c[_0x9c1b('0x34')]]={'$like':'%'+_0x2d0d4e['query']['filter']+'%'};return _0x15f14f;}})});}_0x52605e=_[_0x9c1b('0x49')]({},_0x52605e,_0x2d0d4e[_0x9c1b('0x4a')]);var _0x11a2c9={'where':_0x52605e[_0x9c1b('0x46')]};return db[_0x9c1b('0x38')]['count'](_0x11a2c9)[_0x9c1b('0x1d')](function(_0x4a08e8){_0x3ae8e1[_0x9c1b('0x2a')]=_0x4a08e8;if(_0x2d0d4e[_0x9c1b('0x3d')][_0x9c1b('0x4b')]){_0x52605e[_0x9c1b('0x4c')]=[{'all':!![]}];}return db[_0x9c1b('0x38')][_0x9c1b('0x4d')](_0x52605e);})[_0x9c1b('0x1d')](function(_0x2f509a){_0x3ae8e1[_0x9c1b('0x4e')]=_0x2f509a;return _0x3ae8e1;})['then'](respondWithFilteredResult(_0x5accf6,_0x52605e))['catch'](handleError(_0x5accf6,null));};exports[_0x9c1b('0x4f')]=function(_0x1fac0c,_0xb6b069){var _0xfeccff={'raw':![],'where':{'id':_0x1fac0c['params']['id']}},_0xfe1fb={};_0xfe1fb['model']=_[_0x9c1b('0x3e')](db[_0x9c1b('0x38')][_0x9c1b('0x39')]);_0xfe1fb[_0x9c1b('0x3d')]=_[_0x9c1b('0x3e')](_0x1fac0c['query']);_0xfe1fb[_0x9c1b('0x47')]=_[_0x9c1b('0x3f')](_0xfe1fb['model'],_0xfe1fb['query']);_0xfeccff[_0x9c1b('0x42')]=_[_0x9c1b('0x3f')](_0xfe1fb[_0x9c1b('0x40')],qs[_0x9c1b('0x41')](_0x1fac0c['query'][_0x9c1b('0x41')]));_0xfeccff[_0x9c1b('0x42')]=_0xfeccff['attributes'][_0x9c1b('0x43')]?_0xfeccff[_0x9c1b('0x42')]:_0xfe1fb[_0x9c1b('0x40')];if(_0x1fac0c[_0x9c1b('0x3d')][_0x9c1b('0x4b')]){_0xfeccff[_0x9c1b('0x4c')]=[{'all':!![]}];}_0xfeccff=_[_0x9c1b('0x49')]({},_0xfeccff,_0x1fac0c['options']);return db['ServicenowAccount'][_0x9c1b('0x50')](_0xfeccff)['then'](handleEntityNotFound(_0xb6b069,null))[_0x9c1b('0x1d')](respondWithResult(_0xb6b069,null))[_0x9c1b('0x26')](handleError(_0xb6b069,null));};exports[_0x9c1b('0x51')]=function(_0x533bfc,_0x196d7e){return db[_0x9c1b('0x38')][_0x9c1b('0x51')](_0x533bfc['body'],{})[_0x9c1b('0x1d')](respondWithResult(_0x196d7e,0xc9))['catch'](handleError(_0x196d7e,null));};exports[_0x9c1b('0x52')]=function(_0x29b4ce,_0x4b054e){if(_0x29b4ce['body']['id']){delete _0x29b4ce[_0x9c1b('0x53')]['id'];}return db['ServicenowAccount'][_0x9c1b('0x50')]({'where':{'id':_0x29b4ce[_0x9c1b('0x54')]['id']}})['then'](handleEntityNotFound(_0x4b054e,null))[_0x9c1b('0x1d')](saveUpdates(_0x29b4ce[_0x9c1b('0x53')],null))[_0x9c1b('0x1d')](respondWithResult(_0x4b054e,null))[_0x9c1b('0x26')](handleError(_0x4b054e,null));};exports[_0x9c1b('0x55')]=function(_0x5295ac,_0x5be07c){return db[_0x9c1b('0x38')][_0x9c1b('0x50')]({'where':{'id':_0x5295ac[_0x9c1b('0x54')]['id']}})[_0x9c1b('0x1d')](handleEntityNotFound(_0x5be07c,null))[_0x9c1b('0x1d')](removeEntity(_0x5be07c,null))[_0x9c1b('0x26')](handleError(_0x5be07c,null));};exports[_0x9c1b('0x56')]=function(_0x3b43f3,_0x5f1ea3,_0x557fa4){var _0x2ab3df={};var _0x3a5da8={};var _0x4d43a7;var _0x339603;return db[_0x9c1b('0x38')][_0x9c1b('0x57')]({'where':{'id':_0x3b43f3[_0x9c1b('0x54')]['id']}})[_0x9c1b('0x1d')](handleEntityNotFound(_0x5f1ea3,null))['then'](function(_0x33b9ba){if(_0x33b9ba){_0x4d43a7=_0x33b9ba;_0x3a5da8[_0x9c1b('0x40')]=_[_0x9c1b('0x3e')](db[_0x9c1b('0x58')][_0x9c1b('0x39')]);_0x3a5da8['query']=_[_0x9c1b('0x3e')](_0x3b43f3['query']);_0x3a5da8['filters']=_[_0x9c1b('0x3f')](_0x3a5da8[_0x9c1b('0x40')],_0x3a5da8['query']);_0x2ab3df['attributes']=_[_0x9c1b('0x3f')](_0x3a5da8[_0x9c1b('0x40')],qs[_0x9c1b('0x41')](_0x3b43f3['query']['fields']));_0x2ab3df[_0x9c1b('0x42')]=_0x2ab3df['attributes'][_0x9c1b('0x43')]?_0x2ab3df['attributes']:_0x3a5da8[_0x9c1b('0x40')];_0x2ab3df[_0x9c1b('0x44')]=qs['sort'](_0x3b43f3[_0x9c1b('0x3d')][_0x9c1b('0x45')]);_0x2ab3df['where']=qs['filters'](_[_0x9c1b('0x59')](_0x3b43f3['query'],_0x3a5da8[_0x9c1b('0x47')]));if(_0x3b43f3[_0x9c1b('0x3d')][_0x9c1b('0x5a')]){_0x2ab3df['where']=_[_0x9c1b('0x49')](_0x2ab3df['where'],{'$or':_[_0x9c1b('0x37')](_0x2ab3df[_0x9c1b('0x42')],function(_0x1ac815){var _0x5ba8c9={};_0x5ba8c9[_0x1ac815]={'$like':'%'+_0x3b43f3[_0x9c1b('0x3d')][_0x9c1b('0x5a')]+'%'};return _0x5ba8c9;})});}_0x2ab3df=_['merge']({},_0x2ab3df,_0x3b43f3[_0x9c1b('0x4a')]);return _0x4d43a7[_0x9c1b('0x56')](_0x2ab3df);}})[_0x9c1b('0x1d')](function(_0x62a014){if(_0x62a014){_0x339603=_0x62a014['length'];if(!_0x3b43f3[_0x9c1b('0x3d')][_0x9c1b('0x5b')](_0x9c1b('0x5c'))){_0x2ab3df['limit']=qs[_0x9c1b('0x2c')](_0x3b43f3[_0x9c1b('0x3d')][_0x9c1b('0x2c')]);_0x2ab3df['offset']=qs[_0x9c1b('0x2b')](_0x3b43f3['query'][_0x9c1b('0x2b')]);}return _0x4d43a7['getConfigurations'](_0x2ab3df);}})['then'](function(_0xcaaa95){if(_0xcaaa95){return _0xcaaa95?{'count':_0x339603,'rows':_0xcaaa95}:null;}})['then'](respondWithResult(_0x5f1ea3,null))[_0x9c1b('0x26')](handleError(_0x5f1ea3,null));};exports[_0x9c1b('0x5d')]=function(_0x524c25,_0x384b31,_0x4b0c3c){if(_0x524c25[_0x9c1b('0x53')]['id']){delete _0x524c25[_0x9c1b('0x53')]['id'];}return db[_0x9c1b('0x38')][_0x9c1b('0x57')]({'where':{'id':_0x524c25[_0x9c1b('0x54')]['id']}})[_0x9c1b('0x1d')](handleEntityNotFound(_0x384b31,null))[_0x9c1b('0x1d')](function(_0x109885){if(_0x109885){_0x524c25['body']['AccountId']=_0x109885['id'];_0x524c25[_0x9c1b('0x53')]['Subjects']=integrations['getSubjects'](_0x524c25[_0x9c1b('0x53')]['channel'],_0x524c25[_0x9c1b('0x53')]['type']);_0x524c25[_0x9c1b('0x53')][_0x9c1b('0x5e')]=integrations[_0x9c1b('0x5f')](_0x524c25[_0x9c1b('0x53')][_0x9c1b('0x60')],_0x524c25['body'][_0x9c1b('0x3b')]);return db[_0x9c1b('0x58')]['create'](_0x524c25['body'],{'include':[{'model':db[_0x9c1b('0x61')],'as':_0x9c1b('0x62')},{'model':db[_0x9c1b('0x61')],'as':_0x9c1b('0x5e')}]});}return null;})[_0x9c1b('0x1d')](respondWithResult(_0x384b31,null))[_0x9c1b('0x26')](handleError(_0x384b31,null));};exports[_0x9c1b('0x63')]=function(_0xf18a14,_0x3978f6,_0x216b15){var _0x2f06da=[_0x9c1b('0x64'),_0x9c1b('0x65'),_0x9c1b('0x66'),_0x9c1b('0x67'),_0x9c1b('0x68'),_0x9c1b('0x69'),_0x9c1b('0x6a'),_0x9c1b('0x6b'),'category'];var _0x34ed97=[_0x9c1b('0x6c'),'made_sla',_0x9c1b('0x6d'),_0x9c1b('0x6e'),_0x9c1b('0x6f'),_0x9c1b('0x70'),_0x9c1b('0x71'),'hold_reason',_0x9c1b('0x72'),_0x9c1b('0x73'),_0x9c1b('0x74'),'sys_updated_by','opened_by',_0x9c1b('0x75'),'sys_created_on',_0x9c1b('0x76'),'state',_0x9c1b('0x77'),_0x9c1b('0x66'),_0x9c1b('0x44'),_0x9c1b('0x78'),_0x9c1b('0x79'),_0x9c1b('0x7a'),_0x9c1b('0x7b'),_0x9c1b('0x7c'),'active',_0x9c1b('0x7d'),_0x9c1b('0x7e'),_0x9c1b('0x7f'),'sys_domain_path',_0x9c1b('0x80'),_0x9c1b('0x81'),_0x9c1b('0x82'),_0x9c1b('0x83'),_0x9c1b('0x84'),_0x9c1b('0x85'),_0x9c1b('0x86'),_0x9c1b('0x87'),_0x9c1b('0x88'),_0x9c1b('0x89'),'approval_set','subcategory',_0x9c1b('0x8a'),'short_description',_0x9c1b('0x68'),'correlation_display','delivery_task',_0x9c1b('0x8b'),_0x9c1b('0x8c'),_0x9c1b('0x8d'),'additional_assignee_list',_0x9c1b('0x8e'),_0x9c1b('0x8f'),_0x9c1b('0x69'),_0x9c1b('0x90'),'close_notes',_0x9c1b('0x91'),'follow_up',_0x9c1b('0x92'),_0x9c1b('0x93'),_0x9c1b('0x94'),_0x9c1b('0x95'),_0x9c1b('0x6a'),_0x9c1b('0x96'),_0x9c1b('0x97'),_0x9c1b('0x98'),_0x9c1b('0x99'),_0x9c1b('0x9a'),_0x9c1b('0x9b'),_0x9c1b('0x6b'),_0x9c1b('0x9c'),_0x9c1b('0x9d'),_0x9c1b('0x9e'),_0x9c1b('0x9f'),_0x9c1b('0xa0'),_0x9c1b('0xa1'),_0x9c1b('0xa2'),'sys_tags',_0x9c1b('0xa3'),'upon_approval',_0x9c1b('0xa4'),_0x9c1b('0xa5'),_0x9c1b('0xa6')];var _0x380c9d='';var _0x148e8f='';var _0x3b1bb8=[];var _0x12f978='';var _0x37d410='';var _0x1c89d7=[];var _0x2e3438='';var _0x50e261='';var _0x60d7d6={};var _0x40659a='';return db['ServicenowAccount'][_0x9c1b('0x57')]({'where':{'id':_0xf18a14[_0x9c1b('0x54')]['id']},'attributes':['id',_0x9c1b('0xa7'),_0x9c1b('0xa8'),_0x9c1b('0xa9'),'remoteUri',_0x9c1b('0xaa')]})[_0x9c1b('0x1d')](handleEntityNotFound(_0x3978f6,null))[_0x9c1b('0x1d')](function(_0x238871){if(_0x238871){_0x40659a=_0x238871[_0x9c1b('0xab')];var _0x427c25=_0x40659a[_0x9c1b('0xac')](-0x1);if(_0x427c25==='/'){_0x40659a=_0x40659a['substring'](0x0,_0x40659a[_0x9c1b('0xad')](_0x427c25));}_0x50e261=util[_0x9c1b('0xae')](_0x9c1b('0xaf'),_0x40659a);_0x2e3438=util[_0x9c1b('0xae')](_0x9c1b('0xb0'),_0x40659a);_0x60d7d6={'user':_0x238871['username'],'pass':_0x238871['password']};var _0x2b2f2b={'method':_0x9c1b('0xb1'),'uri':_0x50e261+_0x9c1b('0xb2'),'auth':_0x60d7d6,'json':!![]};return rp(_0x2b2f2b);}})[_0x9c1b('0x1d')](function(_0x51429e){if(_0x51429e['result'][_0x9c1b('0x43')]>0x0){_0x380c9d=_0x51429e[_0x9c1b('0x25')];}console[_0x9c1b('0xb3')](_0x9c1b('0xb4'),_0x380c9d);_0x1c89d7=[];_0x148e8f=Object[_0x9c1b('0xb5')]([],_0x380c9d);_[_0x9c1b('0xb6')](_0x148e8f,function(_0x56a2b3){return!_0x2f06da[_0x9c1b('0xb7')](_0x56a2b3[_0x9c1b('0x34')]);});_0x148e8f[_0x9c1b('0xb8')](function(_0x291e5a){var _0x19b98e=createFieldObject(_0x2e3438,_0x60d7d6,_0x291e5a[_0x9c1b('0xb9')],_0x291e5a[_0x9c1b('0x34')],_0x291e5a[_0x9c1b('0xba')],![]);_0x1c89d7['push'](_0x19b98e);});return Promise['all'](_0x1c89d7);})[_0x9c1b('0x1d')](function(_0x2e9e8b){_0x3b1bb8=_0x2e9e8b;_0x12f978=Object[_0x9c1b('0xb5')]([],_0x380c9d);console[_0x9c1b('0xb3')]('TCL:\x20_object',_0x380c9d);_[_0x9c1b('0xb6')](_0x12f978,function(_0x403494){return _0x34ed97['includes'](_0x403494[_0x9c1b('0x34')]);});console[_0x9c1b('0xb3')](_0x9c1b('0xbb'),_0x12f978);_0x1c89d7=[];_0x12f978[_0x9c1b('0xb8')](function(_0x259acd){var _0x38ac44=createFieldObject(_0x2e3438,_0x60d7d6,_0x259acd[_0x9c1b('0xb9')],_0x259acd[_0x9c1b('0x34')],_0x259acd['label'],!![]);_0x1c89d7[_0x9c1b('0xbc')](_0x38ac44);});return Promise[_0x9c1b('0xbd')](_0x1c89d7);})[_0x9c1b('0x1d')](function(_0xfd3eb7){_0x37d410=_0xfd3eb7;var _0x33f7f8=_0x3b1bb8[_0x9c1b('0xbe')](_0x37d410);return{'count':_0x33f7f8['length'],'rows':_0x33f7f8};})[_0x9c1b('0x1d')](respondWithResult(_0x3978f6,null))[_0x9c1b('0x26')](function(_0x33964b){console[_0x9c1b('0xb3')]('ServiceNow\x20error:\x20'+_0x33964b);var _0x401882=_0xf18a14[_0x9c1b('0x3d')][_0x9c1b('0xbf')]?0x1f4:_0x33964b[_0x9c1b('0xc0')]||0x1f4;logger[_0x9c1b('0x22')](_0x33964b[_0x9c1b('0x33')]);delete _0x33964b[_0x9c1b('0x34')];if(_0x401882===0x191){_0x401882=0x190;}_0x3978f6['status'](_0x401882)[_0x9c1b('0x35')](_0xf18a14[_0x9c1b('0x3d')][_0x9c1b('0xbf')]?{'message':'Wrong\x20credentials','statusCode':_0x33964b[_0x9c1b('0xc0')]}:_0x33964b);});};function createFieldObject(_0x44302e,_0x2a3190,_0x4ddfe7,_0x565555,_0x3a71fb,_0x28d254){return new Promise(function(_0x2fba74,_0x481b1c){var _0x2a5f8f={'id':_0x565555,'name':_0x3a71fb,'custom':_0x28d254};if(_0x4ddfe7===_0x9c1b('0xc1')){_0x2a5f8f[_0x9c1b('0x4a')]=[{'name':_0x9c1b('0xc2'),'value':_0x9c1b('0xc3')},{'name':_0x9c1b('0xc4'),'value':_0x9c1b('0xc5')}];_0x2fba74(_0x2a5f8f);}else{var _0x3b7547={'method':_0x9c1b('0xb1'),'uri':_0x44302e+_0x9c1b('0xc6')+_0x565555,'auth':_0x2a3190,'json':!![]};return rp(_0x3b7547)['then'](function(_0x27277c){var _0x49564e=[];if(_0x27277c[_0x9c1b('0x25')][_0x9c1b('0x43')]>0x0){_0x27277c[_0x9c1b('0x25')][_0x9c1b('0xb8')](function(_0x4095b5){if(_0x4095b5[_0x9c1b('0xc7')]===_0x9c1b('0xc5')){var _0x52ecb9={'name':_0x4095b5['label'],'value':_0x4095b5['value']};_0x49564e[_0x9c1b('0xbc')](_0x52ecb9);}});}_0x2a5f8f['options']=_0x49564e;if(_0x2a5f8f[_0x9c1b('0x4a')][_0x9c1b('0x43')]>0x0){_0x2fba74(_0x2a5f8f);}else{if(_0x28d254==![]){_0x2fba74();}else{_0x2fba74(_0x2a5f8f);}}});}});} \ No newline at end of file +var _0xcbfe=['pick','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','create','body','find','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','hold_reason','knowledge','subcategory','close_code','notify','severity','category','parent','watch_list','upon_reject','child_incidents','approval_history','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','priority','sys_domain_path','expected_start','opened_at','group_list','work_end','reopened_time','caller_id','work_notes','short_description','delivery_task','work_start','business_stc','additional_assignee_list','description','sys_class_name','close_notes','parent_incident','incident_state','urgency','problem_id','company','reassignment_count','assigned_to','comments','comments_and_work_notes','due_date','sys_mod_count','reopen_count','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/','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','forEach','internalType','label','push','all','TCL:\x20_object','includes','concat','ServiceNow\x20error:\x20','statusCode','stack','test','Wrong\x20credentials','true','False','false','GET','result','value','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','destroy','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x35a736,_0x2c5fc2){var _0x2a9eda=function(_0x145220){while(--_0x145220){_0x35a736['push'](_0x35a736['shift']());}};_0x2a9eda(++_0x2c5fc2);}(_0xcbfe,0x75));var _0xecbf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcbfe[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xecbf('0x0'));var emlformat=require(_0xecbf('0x1'));var rimraf=require(_0xecbf('0x2'));var zipdir=require(_0xecbf('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xecbf('0x4'));var moment=require(_0xecbf('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xecbf('0x6'));var path=require(_0xecbf('0x7'));var sox=require(_0xecbf('0x8'));var csv=require(_0xecbf('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xecbf('0xa'));var _=require(_0xecbf('0xb'));var squel=require(_0xecbf('0xc'));var crypto=require(_0xecbf('0xd'));var jsforce=require(_0xecbf('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xecbf('0xf'));var Papa=require(_0xecbf('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xecbf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xecbf('0x12'));var logger=require(_0xecbf('0x13'))(_0xecbf('0x14'));var utils=require(_0xecbf('0x15'));var config=require(_0xecbf('0x16'));var licenseUtil=require(_0xecbf('0x17'));var db=require(_0xecbf('0x18'))['db'];var integrations=require(_0xecbf('0x19'));var jayson=require('jayson/promise');var client=jayson['client'][_0xecbf('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1d856f,_0x5cdcc4,_0x47fd4f,_0x46f467){return new BPromise(function(_0xb15587,_0x11cd13){var _0x51b446=_0x46f467||client;return _0x51b446['request'](_0x1d856f,_0x47fd4f)[_0xecbf('0x1b')](function(_0x35594d){logger[_0xecbf('0x1c')](_0xecbf('0x1d'),_0x5cdcc4,_0xecbf('0x1e'));logger['debug'](_0xecbf('0x1f'),_0x5cdcc4,_0xecbf('0x1e'),JSON['stringify'](_0x35594d));if(_0x35594d[_0xecbf('0x20')]){if(_0x35594d['error'][_0xecbf('0x21')]===0x1f4){logger[_0xecbf('0x20')](_0xecbf('0x1d'),_0x5cdcc4,_0x35594d[_0xecbf('0x20')][_0xecbf('0x22')]);return _0x11cd13(_0x35594d[_0xecbf('0x20')][_0xecbf('0x22')]);}logger[_0xecbf('0x20')](_0xecbf('0x1d'),_0x5cdcc4,_0x35594d[_0xecbf('0x20')]['message']);return _0xb15587(_0x35594d[_0xecbf('0x20')][_0xecbf('0x22')]);}else{logger[_0xecbf('0x1c')](_0xecbf('0x1d'),_0x5cdcc4,_0xecbf('0x1e'));_0xb15587(_0x35594d['result'][_0xecbf('0x22')]);}})[_0xecbf('0x23')](function(_0x39a218){logger[_0xecbf('0x20')](_0xecbf('0x1d'),_0x5cdcc4,_0x39a218);_0x11cd13(_0x39a218);});});}function respondWithStatusCode(_0x282cb0,_0x3e3127){_0x3e3127=_0x3e3127||0xcc;return function(_0x32ef15){if(_0x32ef15){return _0x282cb0[_0xecbf('0x24')](_0x3e3127);}return _0x282cb0[_0xecbf('0x25')](_0x3e3127)[_0xecbf('0x26')]();};}function respondWithResult(_0x48f975,_0x1a0234){_0x1a0234=_0x1a0234||0xc8;return function(_0x3cd7d5){if(_0x3cd7d5){return _0x48f975[_0xecbf('0x25')](_0x1a0234)['json'](_0x3cd7d5);}};}function respondWithFilteredResult(_0xc7c1f9,_0x40d287){return function(_0x58b155){if(_0x58b155){var _0x5dc721=_0x58b155[_0xecbf('0x27')],_0x45617b=_0x40d287[_0xecbf('0x28')],_0x521450=_0x40d287[_0xecbf('0x28')]+_0x40d287[_0xecbf('0x29')],_0x29e9de;if(_0x521450>=_0x5dc721){_0x521450=_0x5dc721;_0x29e9de=0xc8;}else{_0x29e9de=0xce;}_0xc7c1f9[_0xecbf('0x25')](_0x29e9de);return _0xc7c1f9[_0xecbf('0x2a')](_0xecbf('0x2b'),_0x45617b+'-'+_0x521450+'/'+_0x5dc721)[_0xecbf('0x2c')](_0x58b155);}return null;};}function patchUpdates(_0x193f52){return function(_0x226bcf){try{jsonpatch['apply'](_0x226bcf,_0x193f52,!![]);}catch(_0x419f05){return BPromise[_0xecbf('0x2d')](_0x419f05);}return _0x226bcf[_0xecbf('0x2e')]();};}function saveUpdates(_0x3b095d,_0x878d09){return function(_0x52d4f3){if(_0x52d4f3){return _0x52d4f3[_0xecbf('0x2f')](_0x3b095d)['then'](function(_0x5bdade){return _0x5bdade;});}return null;};}function removeEntity(_0x10aeec,_0x183899){return function(_0x5b9838){if(_0x5b9838){return _0x5b9838[_0xecbf('0x30')]()[_0xecbf('0x1b')](function(){_0x10aeec[_0xecbf('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b96c2,_0x23dc19){return function(_0x1ddf62){if(!_0x1ddf62){_0x4b96c2[_0xecbf('0x24')](0x194);}return _0x1ddf62;};}function handleError(_0x4f8c31,_0xf9905){_0xf9905=_0xf9905||0x1f4;return function(_0x5cd47b){logger[_0xecbf('0x20')](_0x5cd47b['stack']);if(_0x5cd47b[_0xecbf('0x31')]){delete _0x5cd47b['name'];}_0x4f8c31['status'](_0xf9905)[_0xecbf('0x32')](_0x5cd47b);};}exports[_0xecbf('0x33')]=function(_0x4325be,_0x35e012){var _0x32e93a={},_0x4b4411={},_0xbe8c1b={'count':0x0,'rows':[]};var _0x194be8=_[_0xecbf('0x34')](db[_0xecbf('0x35')][_0xecbf('0x36')],function(_0x3c56be){return{'name':_0x3c56be[_0xecbf('0x37')],'type':_0x3c56be[_0xecbf('0x38')][_0xecbf('0x39')]};});_0x4b4411['model']=_[_0xecbf('0x34')](_0x194be8,'name');_0x4b4411[_0xecbf('0x3a')]=_['keys'](_0x4325be[_0xecbf('0x3a')]);_0x4b4411[_0xecbf('0x3b')]=_['intersection'](_0x4b4411[_0xecbf('0x3c')],_0x4b4411[_0xecbf('0x3a')]);_0x32e93a['attributes']=_[_0xecbf('0x3d')](_0x4b4411[_0xecbf('0x3c')],qs[_0xecbf('0x3e')](_0x4325be[_0xecbf('0x3a')]['fields']));_0x32e93a['attributes']=_0x32e93a[_0xecbf('0x3f')][_0xecbf('0x40')]?_0x32e93a[_0xecbf('0x3f')]:_0x4b4411[_0xecbf('0x3c')];if(!_0x4325be[_0xecbf('0x3a')][_0xecbf('0x41')](_0xecbf('0x42'))){_0x32e93a[_0xecbf('0x29')]=qs[_0xecbf('0x29')](_0x4325be['query'][_0xecbf('0x29')]);_0x32e93a[_0xecbf('0x28')]=qs[_0xecbf('0x28')](_0x4325be[_0xecbf('0x3a')][_0xecbf('0x28')]);}_0x32e93a[_0xecbf('0x43')]=qs['sort'](_0x4325be[_0xecbf('0x3a')][_0xecbf('0x44')]);_0x32e93a[_0xecbf('0x45')]=qs[_0xecbf('0x3b')](_[_0xecbf('0x46')](_0x4325be[_0xecbf('0x3a')],_0x4b4411['filters']),_0x194be8);if(_0x4325be[_0xecbf('0x3a')][_0xecbf('0x47')]){_0x32e93a[_0xecbf('0x45')]=_[_0xecbf('0x48')](_0x32e93a[_0xecbf('0x45')],{'$or':_['map'](_0x194be8,function(_0x200aa5){if(_0x200aa5['type']!=='VIRTUAL'){var _0x56cdb8={};_0x56cdb8[_0x200aa5[_0xecbf('0x31')]]={'$like':'%'+_0x4325be['query'][_0xecbf('0x47')]+'%'};return _0x56cdb8;}})});}_0x32e93a=_[_0xecbf('0x48')]({},_0x32e93a,_0x4325be[_0xecbf('0x49')]);var _0x49ad13={'where':_0x32e93a['where']};return db[_0xecbf('0x35')][_0xecbf('0x27')](_0x49ad13)[_0xecbf('0x1b')](function(_0x4a0988){_0xbe8c1b[_0xecbf('0x27')]=_0x4a0988;if(_0x4325be['query'][_0xecbf('0x4a')]){_0x32e93a[_0xecbf('0x4b')]=[{'all':!![]}];}return db[_0xecbf('0x35')][_0xecbf('0x4c')](_0x32e93a);})[_0xecbf('0x1b')](function(_0x45861d){_0xbe8c1b[_0xecbf('0x4d')]=_0x45861d;return _0xbe8c1b;})[_0xecbf('0x1b')](respondWithFilteredResult(_0x35e012,_0x32e93a))[_0xecbf('0x23')](handleError(_0x35e012,null));};exports[_0xecbf('0x4e')]=function(_0x178495,_0x3dd91f){var _0x5edffb={'raw':![],'where':{'id':_0x178495[_0xecbf('0x4f')]['id']}},_0x25c59d={};_0x25c59d[_0xecbf('0x3c')]=_[_0xecbf('0x50')](db[_0xecbf('0x35')][_0xecbf('0x36')]);_0x25c59d['query']=_[_0xecbf('0x50')](_0x178495['query']);_0x25c59d[_0xecbf('0x3b')]=_[_0xecbf('0x3d')](_0x25c59d[_0xecbf('0x3c')],_0x25c59d['query']);_0x5edffb['attributes']=_[_0xecbf('0x3d')](_0x25c59d['model'],qs[_0xecbf('0x3e')](_0x178495[_0xecbf('0x3a')][_0xecbf('0x3e')]));_0x5edffb[_0xecbf('0x3f')]=_0x5edffb[_0xecbf('0x3f')][_0xecbf('0x40')]?_0x5edffb['attributes']:_0x25c59d[_0xecbf('0x3c')];if(_0x178495['query'][_0xecbf('0x4a')]){_0x5edffb[_0xecbf('0x4b')]=[{'all':!![]}];}_0x5edffb=_['merge']({},_0x5edffb,_0x178495[_0xecbf('0x49')]);return db[_0xecbf('0x35')]['find'](_0x5edffb)[_0xecbf('0x1b')](handleEntityNotFound(_0x3dd91f,null))[_0xecbf('0x1b')](respondWithResult(_0x3dd91f,null))['catch'](handleError(_0x3dd91f,null));};exports['create']=function(_0x7c0a9c,_0x47645f){return db['ServicenowAccount'][_0xecbf('0x51')](_0x7c0a9c[_0xecbf('0x52')],{})[_0xecbf('0x1b')](respondWithResult(_0x47645f,0xc9))[_0xecbf('0x23')](handleError(_0x47645f,null));};exports['update']=function(_0x384c4e,_0x27349d){if(_0x384c4e['body']['id']){delete _0x384c4e[_0xecbf('0x52')]['id'];}return db[_0xecbf('0x35')]['find']({'where':{'id':_0x384c4e[_0xecbf('0x4f')]['id']}})[_0xecbf('0x1b')](handleEntityNotFound(_0x27349d,null))[_0xecbf('0x1b')](saveUpdates(_0x384c4e[_0xecbf('0x52')],null))[_0xecbf('0x1b')](respondWithResult(_0x27349d,null))[_0xecbf('0x23')](handleError(_0x27349d,null));};exports[_0xecbf('0x30')]=function(_0x15e6b7,_0xe396da){return db[_0xecbf('0x35')][_0xecbf('0x53')]({'where':{'id':_0x15e6b7[_0xecbf('0x4f')]['id']}})[_0xecbf('0x1b')](handleEntityNotFound(_0xe396da,null))[_0xecbf('0x1b')](removeEntity(_0xe396da,null))[_0xecbf('0x23')](handleError(_0xe396da,null));};exports[_0xecbf('0x54')]=function(_0x1668cf,_0x547e06,_0x1c070c){var _0x1a0ef8={};var _0x435034={};var _0x3ff11a;var _0x408cf7;return db[_0xecbf('0x35')][_0xecbf('0x55')]({'where':{'id':_0x1668cf[_0xecbf('0x4f')]['id']}})[_0xecbf('0x1b')](handleEntityNotFound(_0x547e06,null))[_0xecbf('0x1b')](function(_0x3896d4){if(_0x3896d4){_0x3ff11a=_0x3896d4;_0x435034[_0xecbf('0x3c')]=_[_0xecbf('0x50')](db[_0xecbf('0x56')][_0xecbf('0x36')]);_0x435034[_0xecbf('0x3a')]=_[_0xecbf('0x50')](_0x1668cf[_0xecbf('0x3a')]);_0x435034[_0xecbf('0x3b')]=_[_0xecbf('0x3d')](_0x435034['model'],_0x435034[_0xecbf('0x3a')]);_0x1a0ef8['attributes']=_[_0xecbf('0x3d')](_0x435034[_0xecbf('0x3c')],qs['fields'](_0x1668cf[_0xecbf('0x3a')][_0xecbf('0x3e')]));_0x1a0ef8['attributes']=_0x1a0ef8['attributes'][_0xecbf('0x40')]?_0x1a0ef8[_0xecbf('0x3f')]:_0x435034['model'];_0x1a0ef8[_0xecbf('0x43')]=qs[_0xecbf('0x44')](_0x1668cf[_0xecbf('0x3a')][_0xecbf('0x44')]);_0x1a0ef8[_0xecbf('0x45')]=qs[_0xecbf('0x3b')](_[_0xecbf('0x46')](_0x1668cf[_0xecbf('0x3a')],_0x435034[_0xecbf('0x3b')]));if(_0x1668cf['query'][_0xecbf('0x47')]){_0x1a0ef8['where']=_[_0xecbf('0x48')](_0x1a0ef8[_0xecbf('0x45')],{'$or':_['map'](_0x1a0ef8[_0xecbf('0x3f')],function(_0x400071){var _0x135747={};_0x135747[_0x400071]={'$like':'%'+_0x1668cf[_0xecbf('0x3a')][_0xecbf('0x47')]+'%'};return _0x135747;})});}_0x1a0ef8=_['merge']({},_0x1a0ef8,_0x1668cf['options']);return _0x3ff11a[_0xecbf('0x54')](_0x1a0ef8);}})[_0xecbf('0x1b')](function(_0x52149d){if(_0x52149d){_0x408cf7=_0x52149d[_0xecbf('0x40')];if(!_0x1668cf[_0xecbf('0x3a')][_0xecbf('0x41')](_0xecbf('0x42'))){_0x1a0ef8[_0xecbf('0x29')]=qs[_0xecbf('0x29')](_0x1668cf['query'][_0xecbf('0x29')]);_0x1a0ef8[_0xecbf('0x28')]=qs['offset'](_0x1668cf['query']['offset']);}return _0x3ff11a[_0xecbf('0x54')](_0x1a0ef8);}})[_0xecbf('0x1b')](function(_0x4ef906){if(_0x4ef906){return _0x4ef906?{'count':_0x408cf7,'rows':_0x4ef906}:null;}})[_0xecbf('0x1b')](respondWithResult(_0x547e06,null))[_0xecbf('0x23')](handleError(_0x547e06,null));};exports[_0xecbf('0x57')]=function(_0x50ec1e,_0x13dda6,_0x4cbfd6){if(_0x50ec1e[_0xecbf('0x52')]['id']){delete _0x50ec1e[_0xecbf('0x52')]['id'];}return db[_0xecbf('0x35')][_0xecbf('0x55')]({'where':{'id':_0x50ec1e[_0xecbf('0x4f')]['id']}})[_0xecbf('0x1b')](handleEntityNotFound(_0x13dda6,null))[_0xecbf('0x1b')](function(_0x2bfb5f){if(_0x2bfb5f){_0x50ec1e['body']['AccountId']=_0x2bfb5f['id'];_0x50ec1e[_0xecbf('0x52')][_0xecbf('0x58')]=integrations[_0xecbf('0x59')](_0x50ec1e[_0xecbf('0x52')][_0xecbf('0x5a')],_0x50ec1e['body'][_0xecbf('0x38')]);_0x50ec1e[_0xecbf('0x52')][_0xecbf('0x5b')]=integrations[_0xecbf('0x5c')](_0x50ec1e[_0xecbf('0x52')][_0xecbf('0x5a')],_0x50ec1e[_0xecbf('0x52')]['type']);return db['ServicenowConfiguration'][_0xecbf('0x51')](_0x50ec1e[_0xecbf('0x52')],{'include':[{'model':db['ServicenowField'],'as':_0xecbf('0x58')},{'model':db[_0xecbf('0x5d')],'as':_0xecbf('0x5b')}]});}return null;})['then'](respondWithResult(_0x13dda6,null))['catch'](handleError(_0x13dda6,null));};exports[_0xecbf('0x5e')]=function(_0x21adbd,_0x2cf330,_0x3214f3){var _0x2db4dd=['made_sla',_0xecbf('0x5f'),_0xecbf('0x60'),_0xecbf('0x61'),_0xecbf('0x62'),_0xecbf('0x63'),'incident_state',_0xecbf('0x64'),_0xecbf('0x65')];var _0x15512a=[_0xecbf('0x66'),'made_sla','caused_by',_0xecbf('0x67'),_0xecbf('0x68'),'sys_updated_on',_0xecbf('0x69'),_0xecbf('0x5f'),_0xecbf('0x6a'),'number','resolved_by',_0xecbf('0x6b'),_0xecbf('0x6c'),_0xecbf('0x6d'),_0xecbf('0x6e'),_0xecbf('0x6f'),'state',_0xecbf('0x70'),_0xecbf('0x60'),_0xecbf('0x43'),'calendar_stc',_0xecbf('0x71'),_0xecbf('0x72'),_0xecbf('0x73'),_0xecbf('0x74'),_0xecbf('0x75'),_0xecbf('0x76'),'business_service',_0xecbf('0x77'),_0xecbf('0x78'),'rfc','time_worked',_0xecbf('0x79'),_0xecbf('0x7a'),'business_duration',_0xecbf('0x7b'),_0xecbf('0x7c'),_0xecbf('0x7d'),'resolved_at',_0xecbf('0x7e'),'approval_set','subcategory',_0xecbf('0x7f'),_0xecbf('0x80'),_0xecbf('0x62'),'correlation_display',_0xecbf('0x81'),_0xecbf('0x82'),'assignment_group',_0xecbf('0x83'),_0xecbf('0x84'),_0xecbf('0x85'),'calendar_duration',_0xecbf('0x63'),_0xecbf('0x86'),_0xecbf('0x87'),'closed_by','follow_up',_0xecbf('0x88'),'sys_id','contact_type','reopened_by',_0xecbf('0x89'),_0xecbf('0x8a'),_0xecbf('0x8b'),_0xecbf('0x8c'),_0xecbf('0x8d'),'activity_due',_0xecbf('0x8e'),_0xecbf('0x64'),_0xecbf('0x8f'),'sla_due','approval',_0xecbf('0x90'),_0xecbf('0x91'),_0xecbf('0x92'),_0xecbf('0x93'),'sys_tags',_0xecbf('0x94'),_0xecbf('0x95'),_0xecbf('0x96'),_0xecbf('0x97'),'category'];var _0x43cf67='';var _0x200a78='';var _0x240659=[];var _0x36cfe3='';var _0x2297fb='';var _0x31ef06=[];var _0x4a2f41='';var _0x3f4aed='';var _0x471f5b={};var _0x36c5aa='';return db[_0xecbf('0x35')][_0xecbf('0x55')]({'where':{'id':_0x21adbd[_0xecbf('0x4f')]['id']},'attributes':['id',_0xecbf('0x98'),_0xecbf('0x99'),_0xecbf('0x9a'),_0xecbf('0x9b'),_0xecbf('0x9c')]})[_0xecbf('0x1b')](handleEntityNotFound(_0x2cf330,null))[_0xecbf('0x1b')](function(_0x3bd8e7){if(_0x3bd8e7){_0x36c5aa=_0x3bd8e7[_0xecbf('0x9b')];var _0x272d2f=_0x36c5aa[_0xecbf('0x9d')](-0x1);if(_0x272d2f==='/'){_0x36c5aa=_0x36c5aa[_0xecbf('0x9e')](0x0,_0x36c5aa[_0xecbf('0x9f')](_0x272d2f));}_0x3f4aed=util[_0xecbf('0xa0')](_0xecbf('0xa1'),_0x36c5aa);_0x4a2f41=util[_0xecbf('0xa0')](_0xecbf('0xa2'),_0x36c5aa);_0x471f5b={'user':_0x3bd8e7['username'],'pass':_0x3bd8e7[_0xecbf('0x99')]};var _0x3f76aa={'method':'GET','uri':_0x3f4aed+_0xecbf('0xa3'),'auth':_0x471f5b,'json':!![]};return rp(_0x3f76aa);}})[_0xecbf('0x1b')](function(_0x137b0e){if(_0x137b0e['result']['length']>0x0){_0x43cf67=_0x137b0e['result'];}console[_0xecbf('0xa4')](_0xecbf('0xa5'),_0x43cf67);_0x31ef06=[];_0x200a78=Object[_0xecbf('0xa6')]([],_0x43cf67);_[_0xecbf('0xa7')](_0x200a78,function(_0x519998){return!_0x2db4dd['includes'](_0x519998[_0xecbf('0x31')]);});_0x200a78[_0xecbf('0xa8')](function(_0x10410f){var _0x10cf86=createFieldObject(_0x4a2f41,_0x471f5b,_0x10410f[_0xecbf('0xa9')],_0x10410f[_0xecbf('0x31')],_0x10410f[_0xecbf('0xaa')],![]);_0x31ef06[_0xecbf('0xab')](_0x10cf86);});return Promise[_0xecbf('0xac')](_0x31ef06);})[_0xecbf('0x1b')](function(_0x1639b8){_0x240659=_0x1639b8;_0x36cfe3=Object['assign']([],_0x43cf67);console['log'](_0xecbf('0xad'),_0x43cf67);_[_0xecbf('0xa7')](_0x36cfe3,function(_0x5976d1){return _0x15512a[_0xecbf('0xae')](_0x5976d1[_0xecbf('0x31')]);});console[_0xecbf('0xa4')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x36cfe3);_0x31ef06=[];_0x36cfe3[_0xecbf('0xa8')](function(_0x4d3706){var _0x2b2c4f=createFieldObject(_0x4a2f41,_0x471f5b,_0x4d3706[_0xecbf('0xa9')],_0x4d3706['name'],_0x4d3706['label'],!![]);_0x31ef06[_0xecbf('0xab')](_0x2b2c4f);});return Promise[_0xecbf('0xac')](_0x31ef06);})['then'](function(_0x299364){_0x2297fb=_0x299364;var _0x20919c=_0x240659[_0xecbf('0xaf')](_0x2297fb);return{'count':_0x20919c['length'],'rows':_0x20919c};})[_0xecbf('0x1b')](respondWithResult(_0x2cf330,null))[_0xecbf('0x23')](function(_0x338355){console[_0xecbf('0xa4')](_0xecbf('0xb0')+_0x338355);var _0x2d4369=_0x21adbd[_0xecbf('0x3a')]['test']?0x1f4:_0x338355[_0xecbf('0xb1')]||0x1f4;logger[_0xecbf('0x20')](_0x338355[_0xecbf('0xb2')]);delete _0x338355[_0xecbf('0x31')];if(_0x2d4369===0x191){_0x2d4369=0x190;}_0x2cf330[_0xecbf('0x25')](_0x2d4369)[_0xecbf('0x32')](_0x21adbd[_0xecbf('0x3a')][_0xecbf('0xb3')]?{'message':_0xecbf('0xb4'),'statusCode':_0x338355[_0xecbf('0xb1')]}:_0x338355);});};function createFieldObject(_0x1ca461,_0x4a4608,_0x3f1f8e,_0x1d71d1,_0x3466cc,_0x316f89){return new Promise(function(_0x3cdb40,_0x5d2a1e){var _0x4efaf6={'id':_0x1d71d1,'name':_0x3466cc,'custom':_0x316f89};if(_0x3f1f8e==='boolean'){_0x4efaf6['options']=[{'name':'True','value':_0xecbf('0xb5')},{'name':_0xecbf('0xb6'),'value':_0xecbf('0xb7')}];_0x3cdb40(_0x4efaf6);}else{var _0x4ea1={'method':_0xecbf('0xb8'),'uri':_0x1ca461+'sys_choice?sysparm_query=name=incident^element='+_0x1d71d1,'auth':_0x4a4608,'json':!![]};return rp(_0x4ea1)['then'](function(_0xba07ac){var _0x273eb9=[];if(_0xba07ac['result'][_0xecbf('0x40')]>0x0){_0xba07ac[_0xecbf('0xb9')][_0xecbf('0xa8')](function(_0x2c2427){if(_0x2c2427['inactive']===_0xecbf('0xb7')){var _0x54b749={'name':_0x2c2427[_0xecbf('0xaa')],'value':_0x2c2427[_0xecbf('0xba')]};_0x273eb9['push'](_0x54b749);}});}_0x4efaf6[_0xecbf('0x49')]=_0x273eb9;if(_0x4efaf6[_0xecbf('0x49')][_0xecbf('0x40')]>0x0){_0x3cdb40(_0x4efaf6);}else{if(_0x316f89==![]){_0x3cdb40();}else{_0x3cdb40(_0x4efaf6);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index aca6673..26acfdd 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 _0x8958=['exports','define','ServicenowAccount','util','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes'];(function(_0x4059a2,_0x37df1d){var _0x19ca76=function(_0x235a80){while(--_0x235a80){_0x4059a2['push'](_0x4059a2['shift']());}};_0x19ca76(++_0x37df1d);}(_0x8958,0x93));var _0x8895=function(_0x16068d,_0x1fd621){_0x16068d=_0x16068d-0x0;var _0x3a668e=_0x8958[_0x16068d];return _0x3a668e;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8895('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var attributes=require(_0x8895('0x4'));var integrations=require('../../components/integrations/configuration');module[_0x8895('0x5')]=function(_0x2f03ad,_0x124e1e){return _0x2f03ad[_0x8895('0x6')](_0x8895('0x7'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee14=['ServicenowAccount','int_servicenow_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define'];(function(_0x32b642,_0x3c767e){var _0x132a27=function(_0x2066ef){while(--_0x2066ef){_0x32b642['push'](_0x32b642['shift']());}};_0x132a27(++_0x3c767e);}(_0xee14,0x13a));var _0x4ee1=function(_0x59828f,_0x4f2d86){_0x59828f=_0x59828f-0x0;var _0x52dc20=_0xee14[_0x59828f];return _0x52dc20;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4ee1('0x0'))(_0x4ee1('0x1'));var moment=require(_0x4ee1('0x2'));var BPromise=require(_0x4ee1('0x3'));var rp=require(_0x4ee1('0x4'));var fs=require('fs');var path=require(_0x4ee1('0x5'));var rimraf=require(_0x4ee1('0x6'));var config=require(_0x4ee1('0x7'));var attributes=require(_0x4ee1('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x4ee1('0x9')]=function(_0x573700,_0x327c18){return _0x573700[_0x4ee1('0xa')](_0x4ee1('0xb'),attributes,{'tableName':_0x4ee1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 767c015..428d99e 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 _0x5d6d=['where','limit','map','include','model','attributes','debug','ShowServicenowAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x5d6d,0x156));var _0xd5d6=function(_0x3ea229,_0x2a4677){_0x3ea229=_0x3ea229-0x0;var _0x4193d2=_0x5d6d[_0x3ea229];return _0x4193d2;};'use strict';var _=require(_0xd5d6('0x0'));var util=require(_0xd5d6('0x1'));var moment=require('moment');var BPromise=require(_0xd5d6('0x2'));var rs=require(_0xd5d6('0x3'));var fs=require('fs');var Redis=require(_0xd5d6('0x4'));var db=require(_0xd5d6('0x5'))['db'];var utils=require(_0xd5d6('0x6'));var logger=require(_0xd5d6('0x7'))('rpc');var config=require(_0xd5d6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd5d6('0x9')][_0xd5d6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2dab01,_0x28ac3b,_0xbb101e){return new BPromise(function(_0x133c04,_0x4e590e){return client[_0xd5d6('0xb')](_0x2dab01,_0xbb101e)[_0xd5d6('0xc')](function(_0x5e2e9a){logger[_0xd5d6('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x28ac3b,_0xd5d6('0xe'));logger['debug'](_0xd5d6('0xf'),_0x28ac3b,_0xd5d6('0xe'),JSON[_0xd5d6('0x10')](_0x5e2e9a));if(_0x5e2e9a[_0xd5d6('0x11')]){if(_0x5e2e9a['error'][_0xd5d6('0x12')]===0x1f4){logger[_0xd5d6('0x11')](_0xd5d6('0x13'),_0x28ac3b,_0x5e2e9a['error']['message']);return _0x4e590e(_0x5e2e9a[_0xd5d6('0x11')][_0xd5d6('0x14')]);}logger[_0xd5d6('0x11')](_0xd5d6('0x13'),_0x28ac3b,_0x5e2e9a[_0xd5d6('0x11')][_0xd5d6('0x14')]);return _0x133c04(_0x5e2e9a['error'][_0xd5d6('0x14')]);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x28ac3b,_0xd5d6('0xe'));_0x133c04(_0x5e2e9a[_0xd5d6('0x15')][_0xd5d6('0x14')]);}})[_0xd5d6('0x16')](function(_0x5e1792){logger[_0xd5d6('0x11')](_0xd5d6('0x13'),_0x28ac3b,_0x5e1792);_0x4e590e(_0x5e1792);});});}exports[_0xd5d6('0x17')]=function(_0x47981c){var _0xcd0a89=this;return new Promise(function(_0x15e397,_0x20dc93){return db[_0xd5d6('0x18')][_0xd5d6('0x19')]({'raw':_0x47981c[_0xd5d6('0x1a')]?_0x47981c[_0xd5d6('0x1a')][_0xd5d6('0x1b')]===undefined?!![]:![]:!![],'where':_0x47981c[_0xd5d6('0x1a')]?_0x47981c['options'][_0xd5d6('0x1c')]||null:null,'attributes':_0x47981c[_0xd5d6('0x1a')]?_0x47981c[_0xd5d6('0x1a')]['attributes']||null:null,'limit':_0x47981c['options']?_0x47981c[_0xd5d6('0x1a')][_0xd5d6('0x1d')]||null:null,'include':_0x47981c['options']?_0x47981c[_0xd5d6('0x1a')]['include']?_[_0xd5d6('0x1e')](_0x47981c[_0xd5d6('0x1a')][_0xd5d6('0x1f')],function(_0x5358bb){return{'model':db[_0x5358bb[_0xd5d6('0x20')]],'as':_0x5358bb['as'],'attributes':_0x5358bb[_0xd5d6('0x21')],'include':_0x5358bb[_0xd5d6('0x1f')]?_[_0xd5d6('0x1e')](_0x5358bb[_0xd5d6('0x1f')],function(_0x4f4df8){return{'model':db[_0x4f4df8[_0xd5d6('0x20')]],'as':_0x4f4df8['as'],'attributes':_0x4f4df8[_0xd5d6('0x21')],'include':_0x4f4df8[_0xd5d6('0x1f')]?_[_0xd5d6('0x1e')](_0x4f4df8[_0xd5d6('0x1f')],function(_0x24a80c){return{'model':db[_0x24a80c[_0xd5d6('0x20')]],'as':_0x24a80c['as'],'attributes':_0x24a80c[_0xd5d6('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4cda54){logger['info'](_0xd5d6('0x17'),_0x47981c);logger[_0xd5d6('0x22')](_0xd5d6('0x17'),_0x47981c,JSON[_0xd5d6('0x10')](_0x4cda54));_0x15e397(_0x4cda54);})['catch'](function(_0x5a9d71){logger[_0xd5d6('0x11')](_0xd5d6('0x17'),_0x5a9d71[_0xd5d6('0x14')],_0x47981c);_0x20dc93(_0xcd0a89[_0xd5d6('0x11')](0x1f4,_0x5a9d71['message']));});});};exports[_0xd5d6('0x23')]=function(_0x1f2155){var _0x5414c5=this;return new Promise(function(_0x384312,_0x1266f4){return db[_0xd5d6('0x18')][_0xd5d6('0x24')]({'raw':_0x1f2155[_0xd5d6('0x1a')]?_0x1f2155[_0xd5d6('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1f2155[_0xd5d6('0x1a')]?_0x1f2155[_0xd5d6('0x1a')]['where']||null:null,'attributes':_0x1f2155['options']?_0x1f2155[_0xd5d6('0x1a')][_0xd5d6('0x21')]||null:null,'include':_0x1f2155[_0xd5d6('0x1a')]?_0x1f2155[_0xd5d6('0x1a')][_0xd5d6('0x1f')]?_[_0xd5d6('0x1e')](_0x1f2155[_0xd5d6('0x1a')]['include'],function(_0x555c27){return{'model':db[_0x555c27['model']],'as':_0x555c27['as'],'attributes':_0x555c27['attributes'],'include':_0x555c27[_0xd5d6('0x1f')]?_[_0xd5d6('0x1e')](_0x555c27[_0xd5d6('0x1f')],function(_0x4d000b){return{'model':db[_0x4d000b['model']],'as':_0x4d000b['as'],'attributes':_0x4d000b['attributes'],'include':_0x4d000b[_0xd5d6('0x1f')]?_['map'](_0x4d000b['include'],function(_0x4c9d34){return{'model':db[_0x4c9d34[_0xd5d6('0x20')]],'as':_0x4c9d34['as'],'attributes':_0x4c9d34[_0xd5d6('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd5d6('0xc')](function(_0x7c5442){logger['info'](_0xd5d6('0x23'),_0x1f2155);logger[_0xd5d6('0x22')](_0xd5d6('0x23'),_0x1f2155,JSON[_0xd5d6('0x10')](_0x7c5442));_0x384312(_0x7c5442);})[_0xd5d6('0x16')](function(_0x4069f8){logger[_0xd5d6('0x11')]('ShowServicenowAccount',_0x4069f8[_0xd5d6('0x14')],_0x1f2155);_0x1266f4(_0x5414c5['error'](0x1f4,_0x4069f8[_0xd5d6('0x14')]));});});}; \ No newline at end of file +var _0xa84e=['map','model','then','find','ShowServicenowAccount','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','attributes','limit','include'];(function(_0x22bc7d,_0x37ce57){var _0x316f36=function(_0x56bda1){while(--_0x56bda1){_0x22bc7d['push'](_0x22bc7d['shift']());}};_0x316f36(++_0x37ce57);}(_0xa84e,0x11d));var _0xea84=function(_0x43b88c,_0x46fb04){_0x43b88c=_0x43b88c-0x0;var _0x407299=_0xa84e[_0x43b88c];return _0x407299;};'use strict';var _=require(_0xea84('0x0'));var util=require('util');var moment=require(_0xea84('0x1'));var BPromise=require(_0xea84('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xea84('0x3'))['db'];var utils=require(_0xea84('0x4'));var logger=require(_0xea84('0x5'))(_0xea84('0x6'));var config=require(_0xea84('0x7'));var jayson=require(_0xea84('0x8'));var client=jayson[_0xea84('0x9')][_0xea84('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54cf76,_0xcdc057,_0xc389e){return new BPromise(function(_0x2b426b,_0x43f6a5){return client[_0xea84('0xb')](_0x54cf76,_0xc389e)['then'](function(_0xa5bda6){logger[_0xea84('0xc')](_0xea84('0xd'),_0xcdc057,_0xea84('0xe'));logger[_0xea84('0xf')](_0xea84('0x10'),_0xcdc057,_0xea84('0xe'),JSON[_0xea84('0x11')](_0xa5bda6));if(_0xa5bda6[_0xea84('0x12')]){if(_0xa5bda6[_0xea84('0x12')]['code']===0x1f4){logger[_0xea84('0x12')](_0xea84('0xd'),_0xcdc057,_0xa5bda6['error']['message']);return _0x43f6a5(_0xa5bda6['error'][_0xea84('0x13')]);}logger[_0xea84('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0xcdc057,_0xa5bda6[_0xea84('0x12')][_0xea84('0x13')]);return _0x2b426b(_0xa5bda6[_0xea84('0x12')]['message']);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0xcdc057,_0xea84('0xe'));_0x2b426b(_0xa5bda6[_0xea84('0x14')][_0xea84('0x13')]);}})[_0xea84('0x15')](function(_0x3efe5d){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0xcdc057,_0x3efe5d);_0x43f6a5(_0x3efe5d);});});}exports[_0xea84('0x16')]=function(_0x5ceea9){var _0x2b0a03=this;return new Promise(function(_0x212651,_0x282f29){return db[_0xea84('0x17')][_0xea84('0x18')]({'raw':_0x5ceea9[_0xea84('0x19')]?_0x5ceea9[_0xea84('0x19')][_0xea84('0x1a')]===undefined?!![]:![]:!![],'where':_0x5ceea9[_0xea84('0x19')]?_0x5ceea9[_0xea84('0x19')]['where']||null:null,'attributes':_0x5ceea9['options']?_0x5ceea9['options'][_0xea84('0x1b')]||null:null,'limit':_0x5ceea9[_0xea84('0x19')]?_0x5ceea9['options'][_0xea84('0x1c')]||null:null,'include':_0x5ceea9['options']?_0x5ceea9['options'][_0xea84('0x1d')]?_[_0xea84('0x1e')](_0x5ceea9[_0xea84('0x19')][_0xea84('0x1d')],function(_0x296033){return{'model':db[_0x296033[_0xea84('0x1f')]],'as':_0x296033['as'],'attributes':_0x296033[_0xea84('0x1b')],'include':_0x296033[_0xea84('0x1d')]?_[_0xea84('0x1e')](_0x296033[_0xea84('0x1d')],function(_0x492c59){return{'model':db[_0x492c59[_0xea84('0x1f')]],'as':_0x492c59['as'],'attributes':_0x492c59[_0xea84('0x1b')],'include':_0x492c59[_0xea84('0x1d')]?_[_0xea84('0x1e')](_0x492c59['include'],function(_0x3778ef){return{'model':db[_0x3778ef['model']],'as':_0x3778ef['as'],'attributes':_0x3778ef[_0xea84('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xea84('0x20')](function(_0x3ef74f){logger[_0xea84('0xc')](_0xea84('0x16'),_0x5ceea9);logger['debug']('GetServicenowAccount',_0x5ceea9,JSON[_0xea84('0x11')](_0x3ef74f));_0x212651(_0x3ef74f);})[_0xea84('0x15')](function(_0x3128f1){logger[_0xea84('0x12')](_0xea84('0x16'),_0x3128f1[_0xea84('0x13')],_0x5ceea9);_0x282f29(_0x2b0a03[_0xea84('0x12')](0x1f4,_0x3128f1[_0xea84('0x13')]));});});};exports['ShowServicenowAccount']=function(_0x4c7040){var _0x482ab4=this;return new Promise(function(_0x3f5dc2,_0xdff95f){return db[_0xea84('0x17')][_0xea84('0x21')]({'raw':_0x4c7040[_0xea84('0x19')]?_0x4c7040[_0xea84('0x19')][_0xea84('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c7040['options']?_0x4c7040['options']['where']||null:null,'attributes':_0x4c7040[_0xea84('0x19')]?_0x4c7040[_0xea84('0x19')][_0xea84('0x1b')]||null:null,'include':_0x4c7040[_0xea84('0x19')]?_0x4c7040[_0xea84('0x19')][_0xea84('0x1d')]?_[_0xea84('0x1e')](_0x4c7040['options'][_0xea84('0x1d')],function(_0x39fa1e){return{'model':db[_0x39fa1e[_0xea84('0x1f')]],'as':_0x39fa1e['as'],'attributes':_0x39fa1e[_0xea84('0x1b')],'include':_0x39fa1e[_0xea84('0x1d')]?_[_0xea84('0x1e')](_0x39fa1e[_0xea84('0x1d')],function(_0x16932b){return{'model':db[_0x16932b[_0xea84('0x1f')]],'as':_0x16932b['as'],'attributes':_0x16932b['attributes'],'include':_0x16932b['include']?_[_0xea84('0x1e')](_0x16932b[_0xea84('0x1d')],function(_0x391ee8){return{'model':db[_0x391ee8[_0xea84('0x1f')]],'as':_0x391ee8['as'],'attributes':_0x391ee8[_0xea84('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d5f10){logger[_0xea84('0xc')](_0xea84('0x22'),_0x4c7040);logger[_0xea84('0xf')](_0xea84('0x22'),_0x4c7040,JSON[_0xea84('0x11')](_0x4d5f10));_0x3f5dc2(_0x4d5f10);})[_0xea84('0x15')](function(_0x36144c){logger[_0xea84('0x12')](_0xea84('0x22'),_0x36144c[_0xea84('0x13')],_0x4c7040);_0xdff95f(_0x482ab4[_0xea84('0x12')](0x1f4,_0x36144c[_0xea84('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index df5a294..e714d3a 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 _0x35d4=['../../components/interaction/service','index','/:id','isAuthenticated','show','/:id/fields','getFields','get','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service'];(function(_0x58e4e6,_0x170875){var _0x1deb4d=function(_0x4b1ac1){while(--_0x4b1ac1){_0x58e4e6['push'](_0x58e4e6['shift']());}};_0x1deb4d(++_0x170875);}(_0x35d4,0x199));var _0x435d=function(_0x5db902,_0xd761aa){_0x5db902=_0x5db902-0x0;var _0x1ffc86=_0x35d4[_0x5db902];return _0x1ffc86;};'use strict';var multer=require(_0x435d('0x0'));var util=require('util');var path=require(_0x435d('0x1'));var timeout=require('connect-timeout');var express=require(_0x435d('0x2'));var router=express['Router']();var fs_extra=require(_0x435d('0x3'));var auth=require(_0x435d('0x4'));var interaction=require(_0x435d('0x5'));var config=require('../../config/environment');var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x435d('0x6')]);router['get'](_0x435d('0x7'),auth[_0x435d('0x8')](),controller[_0x435d('0x9')]);router['get'](_0x435d('0xa'),auth[_0x435d('0x8')](),controller[_0x435d('0xb')]);router[_0x435d('0xc')](_0x435d('0xd'),auth[_0x435d('0x8')](),controller[_0x435d('0xe')]);router[_0x435d('0xc')]('/:id/descriptions',auth[_0x435d('0x8')](),controller[_0x435d('0xf')]);router[_0x435d('0x10')]('/',auth[_0x435d('0x8')](),controller[_0x435d('0x11')]);router[_0x435d('0x12')](_0x435d('0x7'),auth['isAuthenticated'](),controller[_0x435d('0x13')]);router[_0x435d('0x14')](_0x435d('0x7'),auth['isAuthenticated'](),controller[_0x435d('0x15')]);module[_0x435d('0x16')]=router; \ No newline at end of file +var _0xec5d=['./intServicenowConfiguration.controller','isAuthenticated','get','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x406d36,_0x51f480){var _0x3babaf=function(_0x168241){while(--_0x168241){_0x406d36['push'](_0x406d36['shift']());}};_0x3babaf(++_0x51f480);}(_0xec5d,0x19e));var _0xdec5=function(_0xfac5dc,_0x44309a){_0xfac5dc=_0xfac5dc-0x0;var _0xaebbcc=_0xec5d[_0xfac5dc];return _0xaebbcc;};'use strict';var multer=require(_0xdec5('0x0'));var util=require(_0xdec5('0x1'));var path=require('path');var timeout=require(_0xdec5('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdec5('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xdec5('0x4'));var config=require(_0xdec5('0x5'));var controller=require(_0xdec5('0x6'));router['get']('/',auth[_0xdec5('0x7')](),controller['index']);router[_0xdec5('0x8')](_0xdec5('0x9'),auth[_0xdec5('0x7')](),controller['show']);router[_0xdec5('0x8')](_0xdec5('0xa'),auth[_0xdec5('0x7')](),controller[_0xdec5('0xb')]);router[_0xdec5('0x8')](_0xdec5('0xc'),auth['isAuthenticated'](),controller[_0xdec5('0xd')]);router[_0xdec5('0x8')](_0xdec5('0xe'),auth[_0xdec5('0x7')](),controller[_0xdec5('0xf')]);router[_0xdec5('0x10')]('/',auth[_0xdec5('0x7')](),controller['create']);router[_0xdec5('0x11')](_0xdec5('0x9'),auth[_0xdec5('0x7')](),controller['update']);router['delete'](_0xdec5('0x9'),auth[_0xdec5('0x7')](),controller[_0xdec5('0x12')]);module[_0xdec5('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 8c27d8d..6124dff 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 _0x79fd=['STRING','sequelize','exports'];(function(_0x3cbbe7,_0x14df5e){var _0x11503d=function(_0x508098){while(--_0x508098){_0x3cbbe7['push'](_0x3cbbe7['shift']());}};_0x11503d(++_0x14df5e);}(_0x79fd,0xfa));var _0xd79f=function(_0xf3810d,_0x528272){_0xf3810d=_0xf3810d-0x0;var _0x3cf7e9=_0x79fd[_0xf3810d];return _0x3cf7e9;};'use strict';var Sequelize=require(_0xd79f('0x0'));module[_0xd79f('0x1')]={'name':{'type':Sequelize[_0xd79f('0x2')]},'description':{'type':Sequelize[_0xd79f('0x2')]}}; \ No newline at end of file +var _0x3bd6=['sequelize'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x3bd6,0x6c));var _0x63bd=function(_0x4dc228,_0x53bc00){_0x4dc228=_0x4dc228-0x0;var _0x14d638=_0x3bd6[_0x4dc228];return _0x14d638;};'use strict';var Sequelize=require(_0x63bd('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index dcb8895..e5f7ab7 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 _0xb687=['fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','includeAll','include','findAll','show','params','options','create','body','update','find','getFields','ServicenowField','filter','findOne','pick','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','name','send','map','ServicenowConfiguration','rawAttributes','fieldName','key','keys','query','intersection','model','attributes'];(function(_0x3c2c83,_0x2fd167){var _0x39e123=function(_0x488fe3){while(--_0x488fe3){_0x3c2c83['push'](_0x3c2c83['shift']());}};_0x39e123(++_0x2fd167);}(_0xb687,0xdb));var _0x7b68=function(_0x374aab,_0x5bad00){_0x374aab=_0x374aab-0x0;var _0x72b7af=_0xb687[_0x374aab];return _0x72b7af;};'use strict';var pdf=require(_0x7b68('0x0'));var emlformat=require(_0x7b68('0x1'));var rimraf=require(_0x7b68('0x2'));var zipdir=require(_0x7b68('0x3'));var jsonpatch=require(_0x7b68('0x4'));var rp=require(_0x7b68('0x5'));var moment=require(_0x7b68('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x7b68('0x7'));var util=require(_0x7b68('0x8'));var path=require(_0x7b68('0x9'));var sox=require(_0x7b68('0xa'));var csv=require(_0x7b68('0xb'));var ejs=require(_0x7b68('0xc'));var fs=require('fs');var fs_extra=require(_0x7b68('0xd'));var _=require(_0x7b68('0xe'));var squel=require('squel');var crypto=require(_0x7b68('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7b68('0x10'));var toCsv=require(_0x7b68('0xb'));var querystring=require(_0x7b68('0x11'));var Papa=require(_0x7b68('0x12'));var Redis=require(_0x7b68('0x13'));var authService=require(_0x7b68('0x14'));var qs=require(_0x7b68('0x15'));var as=require(_0x7b68('0x16'));var hardwareService=require(_0x7b68('0x17'));var logger=require(_0x7b68('0x18'))(_0x7b68('0x19'));var utils=require(_0x7b68('0x1a'));var config=require(_0x7b68('0x1b'));var licenseUtil=require(_0x7b68('0x1c'));var db=require(_0x7b68('0x1d'))['db'];var jayson=require(_0x7b68('0x1e'));var client=jayson[_0x7b68('0x1f')][_0x7b68('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x4693e4,_0x465c6d,_0x4ce265,_0x3f1a89){return new BPromise(function(_0x137ee9,_0x44b0d4){var _0x9bc730=_0x3f1a89||client;return _0x9bc730['request'](_0x4693e4,_0x4ce265)[_0x7b68('0x21')](function(_0x568c85){logger['info'](_0x7b68('0x22'),_0x465c6d,_0x7b68('0x23'));logger[_0x7b68('0x24')](_0x7b68('0x25'),_0x465c6d,_0x7b68('0x23'),JSON[_0x7b68('0x26')](_0x568c85));if(_0x568c85['error']){if(_0x568c85[_0x7b68('0x27')][_0x7b68('0x28')]===0x1f4){logger[_0x7b68('0x27')]('ServicenowConfiguration,\x20%s,\x20%s',_0x465c6d,_0x568c85['error'][_0x7b68('0x29')]);return _0x44b0d4(_0x568c85[_0x7b68('0x27')][_0x7b68('0x29')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x465c6d,_0x568c85['error'][_0x7b68('0x29')]);return _0x137ee9(_0x568c85[_0x7b68('0x27')][_0x7b68('0x29')]);}else{logger[_0x7b68('0x2a')](_0x7b68('0x22'),_0x465c6d,_0x7b68('0x23'));_0x137ee9(_0x568c85['result'][_0x7b68('0x29')]);}})[_0x7b68('0x2b')](function(_0x586520){logger[_0x7b68('0x27')]('ServicenowConfiguration,\x20%s,\x20%s',_0x465c6d,_0x586520);_0x44b0d4(_0x586520);});});}function respondWithStatusCode(_0x243489,_0x467c86){_0x467c86=_0x467c86||0xcc;return function(_0x181eab){if(_0x181eab){return _0x243489[_0x7b68('0x2c')](_0x467c86);}return _0x243489['status'](_0x467c86)[_0x7b68('0x2d')]();};}function respondWithResult(_0x3f4e0a,_0x29f7a5){_0x29f7a5=_0x29f7a5||0xc8;return function(_0x240ef2){if(_0x240ef2){return _0x3f4e0a[_0x7b68('0x2e')](_0x29f7a5)[_0x7b68('0x2f')](_0x240ef2);}};}function respondWithFilteredResult(_0x5d5b0d,_0x5cdccb){return function(_0x4ea64f){if(_0x4ea64f){var _0x430067=_0x4ea64f[_0x7b68('0x30')],_0x36ea04=_0x5cdccb[_0x7b68('0x31')],_0x112689=_0x5cdccb[_0x7b68('0x31')]+_0x5cdccb[_0x7b68('0x32')],_0x4d419e;if(_0x112689>=_0x430067){_0x112689=_0x430067;_0x4d419e=0xc8;}else{_0x4d419e=0xce;}_0x5d5b0d[_0x7b68('0x2e')](_0x4d419e);return _0x5d5b0d[_0x7b68('0x33')](_0x7b68('0x34'),_0x36ea04+'-'+_0x112689+'/'+_0x430067)[_0x7b68('0x2f')](_0x4ea64f);}return null;};}function patchUpdates(_0x324a8a){return function(_0x30c6ec){try{jsonpatch[_0x7b68('0x35')](_0x30c6ec,_0x324a8a,!![]);}catch(_0x2e92f6){return BPromise[_0x7b68('0x36')](_0x2e92f6);}return _0x30c6ec[_0x7b68('0x37')]();};}function saveUpdates(_0x3177a3,_0x2d1ac9){return function(_0x1dfcf6){if(_0x1dfcf6){return _0x1dfcf6['update'](_0x3177a3)[_0x7b68('0x21')](function(_0xfb028a){return _0xfb028a;});}return null;};}function removeEntity(_0x29bd2c,_0x9f90b0){return function(_0x1926f9){if(_0x1926f9){return _0x1926f9[_0x7b68('0x38')]()[_0x7b68('0x21')](function(){_0x29bd2c[_0x7b68('0x2e')](0xcc)[_0x7b68('0x2d')]();});}};}function handleEntityNotFound(_0x2c345b,_0x197dd8){return function(_0x5034fd){if(!_0x5034fd){_0x2c345b[_0x7b68('0x2c')](0x194);}return _0x5034fd;};}function handleError(_0x11cbdd,_0x387055){_0x387055=_0x387055||0x1f4;return function(_0x6dbab6){logger[_0x7b68('0x27')](_0x6dbab6['stack']);if(_0x6dbab6[_0x7b68('0x39')]){delete _0x6dbab6[_0x7b68('0x39')];}_0x11cbdd[_0x7b68('0x2e')](_0x387055)[_0x7b68('0x3a')](_0x6dbab6);};}exports['index']=function(_0xf1c2d3,_0x54c347){var _0x418d9d={},_0x3545fe={},_0x29b19d={'count':0x0,'rows':[]};var _0xaf9a82=_[_0x7b68('0x3b')](db[_0x7b68('0x3c')][_0x7b68('0x3d')],function(_0x504e95){return{'name':_0x504e95[_0x7b68('0x3e')],'type':_0x504e95['type'][_0x7b68('0x3f')]};});_0x3545fe['model']=_[_0x7b68('0x3b')](_0xaf9a82,'name');_0x3545fe['query']=_[_0x7b68('0x40')](_0xf1c2d3[_0x7b68('0x41')]);_0x3545fe['filters']=_[_0x7b68('0x42')](_0x3545fe[_0x7b68('0x43')],_0x3545fe[_0x7b68('0x41')]);_0x418d9d[_0x7b68('0x44')]=_[_0x7b68('0x42')](_0x3545fe[_0x7b68('0x43')],qs[_0x7b68('0x45')](_0xf1c2d3['query'][_0x7b68('0x45')]));_0x418d9d[_0x7b68('0x44')]=_0x418d9d[_0x7b68('0x44')][_0x7b68('0x46')]?_0x418d9d[_0x7b68('0x44')]:_0x3545fe[_0x7b68('0x43')];if(!_0xf1c2d3[_0x7b68('0x41')][_0x7b68('0x47')](_0x7b68('0x48'))){_0x418d9d[_0x7b68('0x32')]=qs[_0x7b68('0x32')](_0xf1c2d3[_0x7b68('0x41')][_0x7b68('0x32')]);_0x418d9d[_0x7b68('0x31')]=qs[_0x7b68('0x31')](_0xf1c2d3[_0x7b68('0x41')][_0x7b68('0x31')]);}_0x418d9d[_0x7b68('0x49')]=qs[_0x7b68('0x4a')](_0xf1c2d3['query'][_0x7b68('0x4a')]);_0x418d9d[_0x7b68('0x4b')]=qs[_0x7b68('0x4c')](_['pick'](_0xf1c2d3[_0x7b68('0x41')],_0x3545fe['filters']),_0xaf9a82);if(_0xf1c2d3[_0x7b68('0x41')]['filter']){_0x418d9d['where']=_[_0x7b68('0x4d')](_0x418d9d[_0x7b68('0x4b')],{'$or':_[_0x7b68('0x3b')](_0xaf9a82,function(_0x31d2a9){if(_0x31d2a9['type']!==_0x7b68('0x4e')){var _0x46642b={};_0x46642b[_0x31d2a9[_0x7b68('0x39')]]={'$like':'%'+_0xf1c2d3[_0x7b68('0x41')]['filter']+'%'};return _0x46642b;}})});}_0x418d9d=_[_0x7b68('0x4d')]({},_0x418d9d,_0xf1c2d3['options']);var _0x230e57={'where':_0x418d9d[_0x7b68('0x4b')]};return db[_0x7b68('0x3c')][_0x7b68('0x30')](_0x230e57)[_0x7b68('0x21')](function(_0x1c4e56){_0x29b19d[_0x7b68('0x30')]=_0x1c4e56;if(_0xf1c2d3['query'][_0x7b68('0x4f')]){_0x418d9d[_0x7b68('0x50')]=[{'all':!![]}];}return db[_0x7b68('0x3c')][_0x7b68('0x51')](_0x418d9d);})[_0x7b68('0x21')](function(_0x2a2ae4){_0x29b19d['rows']=_0x2a2ae4;return _0x29b19d;})[_0x7b68('0x21')](respondWithFilteredResult(_0x54c347,_0x418d9d))['catch'](handleError(_0x54c347,null));};exports[_0x7b68('0x52')]=function(_0x571d68,_0x9a3101){var _0x3365c1={'raw':![],'where':{'id':_0x571d68[_0x7b68('0x53')]['id']}},_0x5e74b5={};_0x5e74b5[_0x7b68('0x43')]=_['keys'](db['ServicenowConfiguration']['rawAttributes']);_0x5e74b5['query']=_[_0x7b68('0x40')](_0x571d68[_0x7b68('0x41')]);_0x5e74b5[_0x7b68('0x4c')]=_['intersection'](_0x5e74b5[_0x7b68('0x43')],_0x5e74b5[_0x7b68('0x41')]);_0x3365c1[_0x7b68('0x44')]=_[_0x7b68('0x42')](_0x5e74b5[_0x7b68('0x43')],qs['fields'](_0x571d68[_0x7b68('0x41')][_0x7b68('0x45')]));_0x3365c1[_0x7b68('0x44')]=_0x3365c1[_0x7b68('0x44')][_0x7b68('0x46')]?_0x3365c1[_0x7b68('0x44')]:_0x5e74b5[_0x7b68('0x43')];if(_0x571d68[_0x7b68('0x41')][_0x7b68('0x4f')]){_0x3365c1['include']=[{'all':!![]}];}_0x3365c1=_[_0x7b68('0x4d')]({},_0x3365c1,_0x571d68[_0x7b68('0x54')]);return db[_0x7b68('0x3c')]['find'](_0x3365c1)[_0x7b68('0x21')](handleEntityNotFound(_0x9a3101,null))[_0x7b68('0x21')](respondWithResult(_0x9a3101,null))[_0x7b68('0x2b')](handleError(_0x9a3101,null));};exports[_0x7b68('0x55')]=function(_0x1bebc9,_0x5b973a){return db[_0x7b68('0x3c')][_0x7b68('0x55')](_0x1bebc9[_0x7b68('0x56')],{})['then'](respondWithResult(_0x5b973a,0xc9))[_0x7b68('0x2b')](handleError(_0x5b973a,null));};exports[_0x7b68('0x57')]=function(_0x393729,_0x5a8f16){if(_0x393729['body']['id']){delete _0x393729[_0x7b68('0x56')]['id'];}return db[_0x7b68('0x3c')][_0x7b68('0x58')]({'where':{'id':_0x393729['params']['id']}})[_0x7b68('0x21')](handleEntityNotFound(_0x5a8f16,null))['then'](saveUpdates(_0x393729[_0x7b68('0x56')],null))[_0x7b68('0x21')](respondWithResult(_0x5a8f16,null))[_0x7b68('0x2b')](handleError(_0x5a8f16,null));};exports[_0x7b68('0x38')]=function(_0x3165ce,_0x444107){return db[_0x7b68('0x3c')][_0x7b68('0x58')]({'where':{'id':_0x3165ce[_0x7b68('0x53')]['id']}})[_0x7b68('0x21')](handleEntityNotFound(_0x444107,null))['then'](removeEntity(_0x444107,null))[_0x7b68('0x2b')](handleError(_0x444107,null));};exports[_0x7b68('0x59')]=function(_0x495014,_0x5543f0,_0x20e1dc){var _0x257508={};var _0x5401a0={};var _0x38c3a;var _0xf4b281;return db[_0x7b68('0x3c')]['findOne']({'where':{'id':_0x495014[_0x7b68('0x53')]['id']}})[_0x7b68('0x21')](handleEntityNotFound(_0x5543f0,null))[_0x7b68('0x21')](function(_0x14b9fb){if(_0x14b9fb){_0x38c3a=_0x14b9fb;_0x5401a0['model']=_[_0x7b68('0x40')](db[_0x7b68('0x5a')]['rawAttributes']);_0x5401a0[_0x7b68('0x41')]=_[_0x7b68('0x40')](_0x495014[_0x7b68('0x41')]);_0x5401a0[_0x7b68('0x4c')]=_['intersection'](_0x5401a0['model'],_0x5401a0[_0x7b68('0x41')]);_0x257508[_0x7b68('0x44')]=_[_0x7b68('0x42')](_0x5401a0['model'],qs[_0x7b68('0x45')](_0x495014[_0x7b68('0x41')][_0x7b68('0x45')]));_0x257508[_0x7b68('0x44')]=_0x257508['attributes'][_0x7b68('0x46')]?_0x257508[_0x7b68('0x44')]:_0x5401a0[_0x7b68('0x43')];_0x257508[_0x7b68('0x49')]=qs['sort'](_0x495014[_0x7b68('0x41')][_0x7b68('0x4a')]);_0x257508[_0x7b68('0x4b')]=qs[_0x7b68('0x4c')](_['pick'](_0x495014[_0x7b68('0x41')],_0x5401a0['filters']));if(_0x495014[_0x7b68('0x41')][_0x7b68('0x5b')]){_0x257508[_0x7b68('0x4b')]=_[_0x7b68('0x4d')](_0x257508[_0x7b68('0x4b')],{'$or':_[_0x7b68('0x3b')](_0x257508[_0x7b68('0x44')],function(_0x2e6222){var _0x4a2651={};_0x4a2651[_0x2e6222]={'$like':'%'+_0x495014[_0x7b68('0x41')][_0x7b68('0x5b')]+'%'};return _0x4a2651;})});}_0x257508=_['merge']({},_0x257508,_0x495014['options']);return _0x38c3a[_0x7b68('0x59')](_0x257508);}})[_0x7b68('0x21')](function(_0x1b72fe){if(_0x1b72fe){_0xf4b281=_0x1b72fe[_0x7b68('0x46')];if(!_0x495014[_0x7b68('0x41')][_0x7b68('0x47')]('nolimit')){_0x257508[_0x7b68('0x32')]=qs[_0x7b68('0x32')](_0x495014['query'][_0x7b68('0x32')]);_0x257508['offset']=qs[_0x7b68('0x31')](_0x495014[_0x7b68('0x41')][_0x7b68('0x31')]);}return _0x38c3a[_0x7b68('0x59')](_0x257508);}})[_0x7b68('0x21')](function(_0x3c73f0){if(_0x3c73f0){return _0x3c73f0?{'count':_0xf4b281,'rows':_0x3c73f0}:null;}})[_0x7b68('0x21')](respondWithResult(_0x5543f0,null))['catch'](handleError(_0x5543f0,null));};exports['getSubjects']=function(_0x40c416,_0x532101,_0x863b68){var _0x4c7014={};var _0x5000b1={};var _0x2c7540;var _0x10adc3;return db[_0x7b68('0x3c')][_0x7b68('0x5c')]({'where':{'id':_0x40c416[_0x7b68('0x53')]['id']}})[_0x7b68('0x21')](handleEntityNotFound(_0x532101,null))[_0x7b68('0x21')](function(_0x2521b0){if(_0x2521b0){_0x2c7540=_0x2521b0;_0x5000b1['model']=_[_0x7b68('0x40')](db[_0x7b68('0x5a')]['rawAttributes']);_0x5000b1['query']=_[_0x7b68('0x40')](_0x40c416[_0x7b68('0x41')]);_0x5000b1['filters']=_['intersection'](_0x5000b1[_0x7b68('0x43')],_0x5000b1[_0x7b68('0x41')]);_0x4c7014[_0x7b68('0x44')]=_[_0x7b68('0x42')](_0x5000b1[_0x7b68('0x43')],qs[_0x7b68('0x45')](_0x40c416['query'][_0x7b68('0x45')]));_0x4c7014[_0x7b68('0x44')]=_0x4c7014['attributes'][_0x7b68('0x46')]?_0x4c7014[_0x7b68('0x44')]:_0x5000b1[_0x7b68('0x43')];_0x4c7014[_0x7b68('0x49')]=qs['sort'](_0x40c416['query'][_0x7b68('0x4a')]);_0x4c7014[_0x7b68('0x4b')]=qs[_0x7b68('0x4c')](_[_0x7b68('0x5d')](_0x40c416['query'],_0x5000b1[_0x7b68('0x4c')]));if(_0x40c416[_0x7b68('0x41')][_0x7b68('0x5b')]){_0x4c7014[_0x7b68('0x4b')]=_[_0x7b68('0x4d')](_0x4c7014[_0x7b68('0x4b')],{'$or':_[_0x7b68('0x3b')](_0x4c7014[_0x7b68('0x44')],function(_0x39f3c5){var _0x581a4c={};_0x581a4c[_0x39f3c5]={'$like':'%'+_0x40c416[_0x7b68('0x41')]['filter']+'%'};return _0x581a4c;})});}_0x4c7014=_[_0x7b68('0x4d')]({},_0x4c7014,_0x40c416['options']);return _0x2c7540[_0x7b68('0x5e')](_0x4c7014);}})[_0x7b68('0x21')](function(_0x245c44){if(_0x245c44){_0x10adc3=_0x245c44['length'];if(!_0x40c416[_0x7b68('0x41')]['hasOwnProperty'](_0x7b68('0x48'))){_0x4c7014['limit']=qs[_0x7b68('0x32')](_0x40c416[_0x7b68('0x41')][_0x7b68('0x32')]);_0x4c7014[_0x7b68('0x31')]=qs[_0x7b68('0x31')](_0x40c416[_0x7b68('0x41')]['offset']);}return _0x2c7540[_0x7b68('0x5e')](_0x4c7014);}})[_0x7b68('0x21')](function(_0x2461f8){if(_0x2461f8){return _0x2461f8?{'count':_0x10adc3,'rows':_0x2461f8}:null;}})['then'](respondWithResult(_0x532101,null))[_0x7b68('0x2b')](handleError(_0x532101,null));};exports[_0x7b68('0x5f')]=function(_0x2750f8,_0x38b3f1,_0x32bc4b){var _0x489e42={};var _0x39e16b={};var _0x5a1aaf;var _0x217531;return db[_0x7b68('0x3c')][_0x7b68('0x5c')]({'where':{'id':_0x2750f8[_0x7b68('0x53')]['id']}})['then'](handleEntityNotFound(_0x38b3f1,null))['then'](function(_0x3338a2){if(_0x3338a2){_0x5a1aaf=_0x3338a2;_0x39e16b[_0x7b68('0x43')]=_[_0x7b68('0x40')](db[_0x7b68('0x5a')][_0x7b68('0x3d')]);_0x39e16b[_0x7b68('0x41')]=_[_0x7b68('0x40')](_0x2750f8[_0x7b68('0x41')]);_0x39e16b[_0x7b68('0x4c')]=_[_0x7b68('0x42')](_0x39e16b['model'],_0x39e16b[_0x7b68('0x41')]);_0x489e42[_0x7b68('0x44')]=_['intersection'](_0x39e16b[_0x7b68('0x43')],qs[_0x7b68('0x45')](_0x2750f8[_0x7b68('0x41')]['fields']));_0x489e42[_0x7b68('0x44')]=_0x489e42[_0x7b68('0x44')]['length']?_0x489e42[_0x7b68('0x44')]:_0x39e16b['model'];_0x489e42[_0x7b68('0x49')]=qs['sort'](_0x2750f8[_0x7b68('0x41')][_0x7b68('0x4a')]);_0x489e42[_0x7b68('0x4b')]=qs[_0x7b68('0x4c')](_['pick'](_0x2750f8[_0x7b68('0x41')],_0x39e16b[_0x7b68('0x4c')]));if(_0x2750f8[_0x7b68('0x41')][_0x7b68('0x5b')]){_0x489e42[_0x7b68('0x4b')]=_[_0x7b68('0x4d')](_0x489e42[_0x7b68('0x4b')],{'$or':_[_0x7b68('0x3b')](_0x489e42[_0x7b68('0x44')],function(_0x55e559){var _0xf13102={};_0xf13102[_0x55e559]={'$like':'%'+_0x2750f8['query'][_0x7b68('0x5b')]+'%'};return _0xf13102;})});}_0x489e42=_[_0x7b68('0x4d')]({},_0x489e42,_0x2750f8[_0x7b68('0x54')]);return _0x5a1aaf['getDescriptions'](_0x489e42);}})[_0x7b68('0x21')](function(_0xf59b61){if(_0xf59b61){_0x217531=_0xf59b61['length'];if(!_0x2750f8[_0x7b68('0x41')][_0x7b68('0x47')](_0x7b68('0x48'))){_0x489e42[_0x7b68('0x32')]=qs['limit'](_0x2750f8[_0x7b68('0x41')][_0x7b68('0x32')]);_0x489e42[_0x7b68('0x31')]=qs[_0x7b68('0x31')](_0x2750f8[_0x7b68('0x41')][_0x7b68('0x31')]);}return _0x5a1aaf[_0x7b68('0x5f')](_0x489e42);}})[_0x7b68('0x21')](function(_0x5ed37a){if(_0x5ed37a){return _0x5ed37a?{'count':_0x217531,'rows':_0x5ed37a}:null;}})[_0x7b68('0x21')](respondWithResult(_0x38b3f1,null))[_0x7b68('0x2b')](handleError(_0x38b3f1,null));}; \ No newline at end of file +var _0xf3f4=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','apply','reject','update','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','ServicenowConfiguration','includeAll','include','findAll','rows','params','intersection','create','body','destroy','find','getFields','findOne','ServicenowField','filter','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x4dc293,_0xc5a934){var _0x8ef2e0=function(_0x4d8133){while(--_0x4d8133){_0x4dc293['push'](_0x4dc293['shift']());}};_0x8ef2e0(++_0xc5a934);}(_0xf3f4,0x14d));var _0x4f3f=function(_0x1fa0da,_0x497505){_0x1fa0da=_0x1fa0da-0x0;var _0x593747=_0xf3f4[_0x1fa0da];return _0x593747;};'use strict';var pdf=require(_0x4f3f('0x0'));var emlformat=require(_0x4f3f('0x1'));var rimraf=require(_0x4f3f('0x2'));var zipdir=require(_0x4f3f('0x3'));var jsonpatch=require(_0x4f3f('0x4'));var rp=require('request-promise');var moment=require(_0x4f3f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4f3f('0x6'));var util=require(_0x4f3f('0x7'));var path=require('path');var sox=require(_0x4f3f('0x8'));var csv=require(_0x4f3f('0x9'));var ejs=require(_0x4f3f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4f3f('0xb'));var squel=require(_0x4f3f('0xc'));var crypto=require(_0x4f3f('0xd'));var jsforce=require(_0x4f3f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4f3f('0x9'));var querystring=require(_0x4f3f('0xf'));var Papa=require('papaparse');var Redis=require(_0x4f3f('0x10'));var authService=require(_0x4f3f('0x11'));var qs=require(_0x4f3f('0x12'));var as=require(_0x4f3f('0x13'));var hardwareService=require(_0x4f3f('0x14'));var logger=require(_0x4f3f('0x15'))(_0x4f3f('0x16'));var utils=require(_0x4f3f('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f3f('0x18'))['db'];var jayson=require(_0x4f3f('0x19'));var client=jayson['client'][_0x4f3f('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x195b65,_0x37ec45,_0x162fc0,_0x579147){return new BPromise(function(_0x455a96,_0x363c80){var _0x2b49a2=_0x579147||client;return _0x2b49a2[_0x4f3f('0x1b')](_0x195b65,_0x162fc0)[_0x4f3f('0x1c')](function(_0x1acef0){logger[_0x4f3f('0x1d')](_0x4f3f('0x1e'),_0x37ec45,_0x4f3f('0x1f'));logger[_0x4f3f('0x20')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x37ec45,_0x4f3f('0x1f'),JSON['stringify'](_0x1acef0));if(_0x1acef0[_0x4f3f('0x21')]){if(_0x1acef0[_0x4f3f('0x21')][_0x4f3f('0x22')]===0x1f4){logger['error'](_0x4f3f('0x1e'),_0x37ec45,_0x1acef0[_0x4f3f('0x21')][_0x4f3f('0x23')]);return _0x363c80(_0x1acef0[_0x4f3f('0x21')][_0x4f3f('0x23')]);}logger[_0x4f3f('0x21')](_0x4f3f('0x1e'),_0x37ec45,_0x1acef0[_0x4f3f('0x21')]['message']);return _0x455a96(_0x1acef0[_0x4f3f('0x21')][_0x4f3f('0x23')]);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x37ec45,_0x4f3f('0x1f'));_0x455a96(_0x1acef0[_0x4f3f('0x24')][_0x4f3f('0x23')]);}})[_0x4f3f('0x25')](function(_0xbc2636){logger[_0x4f3f('0x21')](_0x4f3f('0x1e'),_0x37ec45,_0xbc2636);_0x363c80(_0xbc2636);});});}function respondWithStatusCode(_0x21219f,_0x8a6273){_0x8a6273=_0x8a6273||0xcc;return function(_0x119c28){if(_0x119c28){return _0x21219f[_0x4f3f('0x26')](_0x8a6273);}return _0x21219f[_0x4f3f('0x27')](_0x8a6273)[_0x4f3f('0x28')]();};}function respondWithResult(_0x1a0c8c,_0x5659ba){_0x5659ba=_0x5659ba||0xc8;return function(_0x1bd37d){if(_0x1bd37d){return _0x1a0c8c[_0x4f3f('0x27')](_0x5659ba)[_0x4f3f('0x29')](_0x1bd37d);}};}function respondWithFilteredResult(_0x5140f2,_0x57df73){return function(_0x3ab527){if(_0x3ab527){var _0x2dd3d8=_0x3ab527[_0x4f3f('0x2a')],_0x3faa86=_0x57df73[_0x4f3f('0x2b')],_0x10b709=_0x57df73[_0x4f3f('0x2b')]+_0x57df73[_0x4f3f('0x2c')],_0x54f0ef;if(_0x10b709>=_0x2dd3d8){_0x10b709=_0x2dd3d8;_0x54f0ef=0xc8;}else{_0x54f0ef=0xce;}_0x5140f2[_0x4f3f('0x27')](_0x54f0ef);return _0x5140f2['set']('Content-Range',_0x3faa86+'-'+_0x10b709+'/'+_0x2dd3d8)[_0x4f3f('0x29')](_0x3ab527);}return null;};}function patchUpdates(_0x3c726c){return function(_0x27fc38){try{jsonpatch[_0x4f3f('0x2d')](_0x27fc38,_0x3c726c,!![]);}catch(_0x582137){return BPromise[_0x4f3f('0x2e')](_0x582137);}return _0x27fc38['save']();};}function saveUpdates(_0x98e6a2,_0x550d82){return function(_0x47d246){if(_0x47d246){return _0x47d246[_0x4f3f('0x2f')](_0x98e6a2)[_0x4f3f('0x1c')](function(_0x4b743a){return _0x4b743a;});}return null;};}function removeEntity(_0x280fac,_0x24b879){return function(_0x59369a){if(_0x59369a){return _0x59369a['destroy']()[_0x4f3f('0x1c')](function(){_0x280fac[_0x4f3f('0x27')](0xcc)[_0x4f3f('0x28')]();});}};}function handleEntityNotFound(_0x48ccb8,_0x1f79f4){return function(_0x4f44f2){if(!_0x4f44f2){_0x48ccb8[_0x4f3f('0x26')](0x194);}return _0x4f44f2;};}function handleError(_0x61caed,_0x176d4e){_0x176d4e=_0x176d4e||0x1f4;return function(_0xd64717){logger['error'](_0xd64717['stack']);if(_0xd64717[_0x4f3f('0x30')]){delete _0xd64717['name'];}_0x61caed[_0x4f3f('0x27')](_0x176d4e)['send'](_0xd64717);};}exports[_0x4f3f('0x31')]=function(_0xb3266e,_0x8ee4b6){var _0x4ae3fa={},_0x5eb4f4={},_0x7f8cea={'count':0x0,'rows':[]};var _0x1fbac9=_[_0x4f3f('0x32')](db['ServicenowConfiguration'][_0x4f3f('0x33')],function(_0x3b6d2b){return{'name':_0x3b6d2b[_0x4f3f('0x34')],'type':_0x3b6d2b[_0x4f3f('0x35')]['key']};});_0x5eb4f4[_0x4f3f('0x36')]=_[_0x4f3f('0x32')](_0x1fbac9,_0x4f3f('0x30'));_0x5eb4f4[_0x4f3f('0x37')]=_[_0x4f3f('0x38')](_0xb3266e[_0x4f3f('0x37')]);_0x5eb4f4[_0x4f3f('0x39')]=_['intersection'](_0x5eb4f4[_0x4f3f('0x36')],_0x5eb4f4[_0x4f3f('0x37')]);_0x4ae3fa[_0x4f3f('0x3a')]=_['intersection'](_0x5eb4f4[_0x4f3f('0x36')],qs['fields'](_0xb3266e[_0x4f3f('0x37')][_0x4f3f('0x3b')]));_0x4ae3fa[_0x4f3f('0x3a')]=_0x4ae3fa['attributes'][_0x4f3f('0x3c')]?_0x4ae3fa[_0x4f3f('0x3a')]:_0x5eb4f4['model'];if(!_0xb3266e[_0x4f3f('0x37')][_0x4f3f('0x3d')](_0x4f3f('0x3e'))){_0x4ae3fa[_0x4f3f('0x2c')]=qs[_0x4f3f('0x2c')](_0xb3266e[_0x4f3f('0x37')][_0x4f3f('0x2c')]);_0x4ae3fa[_0x4f3f('0x2b')]=qs['offset'](_0xb3266e[_0x4f3f('0x37')][_0x4f3f('0x2b')]);}_0x4ae3fa[_0x4f3f('0x3f')]=qs[_0x4f3f('0x40')](_0xb3266e[_0x4f3f('0x37')][_0x4f3f('0x40')]);_0x4ae3fa[_0x4f3f('0x41')]=qs['filters'](_[_0x4f3f('0x42')](_0xb3266e[_0x4f3f('0x37')],_0x5eb4f4[_0x4f3f('0x39')]),_0x1fbac9);if(_0xb3266e['query']['filter']){_0x4ae3fa['where']=_[_0x4f3f('0x43')](_0x4ae3fa[_0x4f3f('0x41')],{'$or':_[_0x4f3f('0x32')](_0x1fbac9,function(_0x2494ed){if(_0x2494ed[_0x4f3f('0x35')]!==_0x4f3f('0x44')){var _0x1fb9ff={};_0x1fb9ff[_0x2494ed[_0x4f3f('0x30')]]={'$like':'%'+_0xb3266e['query']['filter']+'%'};return _0x1fb9ff;}})});}_0x4ae3fa=_[_0x4f3f('0x43')]({},_0x4ae3fa,_0xb3266e[_0x4f3f('0x45')]);var _0x357c3b={'where':_0x4ae3fa[_0x4f3f('0x41')]};return db[_0x4f3f('0x46')][_0x4f3f('0x2a')](_0x357c3b)[_0x4f3f('0x1c')](function(_0xe2738c){_0x7f8cea['count']=_0xe2738c;if(_0xb3266e[_0x4f3f('0x37')][_0x4f3f('0x47')]){_0x4ae3fa[_0x4f3f('0x48')]=[{'all':!![]}];}return db[_0x4f3f('0x46')][_0x4f3f('0x49')](_0x4ae3fa);})[_0x4f3f('0x1c')](function(_0x291ae2){_0x7f8cea[_0x4f3f('0x4a')]=_0x291ae2;return _0x7f8cea;})['then'](respondWithFilteredResult(_0x8ee4b6,_0x4ae3fa))[_0x4f3f('0x25')](handleError(_0x8ee4b6,null));};exports['show']=function(_0x463809,_0x35c4c4){var _0x384db2={'raw':![],'where':{'id':_0x463809[_0x4f3f('0x4b')]['id']}},_0x12c7ce={};_0x12c7ce[_0x4f3f('0x36')]=_['keys'](db[_0x4f3f('0x46')][_0x4f3f('0x33')]);_0x12c7ce[_0x4f3f('0x37')]=_[_0x4f3f('0x38')](_0x463809['query']);_0x12c7ce[_0x4f3f('0x39')]=_[_0x4f3f('0x4c')](_0x12c7ce[_0x4f3f('0x36')],_0x12c7ce['query']);_0x384db2['attributes']=_[_0x4f3f('0x4c')](_0x12c7ce[_0x4f3f('0x36')],qs['fields'](_0x463809[_0x4f3f('0x37')]['fields']));_0x384db2[_0x4f3f('0x3a')]=_0x384db2['attributes'][_0x4f3f('0x3c')]?_0x384db2[_0x4f3f('0x3a')]:_0x12c7ce[_0x4f3f('0x36')];if(_0x463809[_0x4f3f('0x37')][_0x4f3f('0x47')]){_0x384db2[_0x4f3f('0x48')]=[{'all':!![]}];}_0x384db2=_[_0x4f3f('0x43')]({},_0x384db2,_0x463809['options']);return db[_0x4f3f('0x46')]['find'](_0x384db2)[_0x4f3f('0x1c')](handleEntityNotFound(_0x35c4c4,null))[_0x4f3f('0x1c')](respondWithResult(_0x35c4c4,null))[_0x4f3f('0x25')](handleError(_0x35c4c4,null));};exports[_0x4f3f('0x4d')]=function(_0x3c7857,_0x40ad56){return db['ServicenowConfiguration'][_0x4f3f('0x4d')](_0x3c7857[_0x4f3f('0x4e')],{})[_0x4f3f('0x1c')](respondWithResult(_0x40ad56,0xc9))[_0x4f3f('0x25')](handleError(_0x40ad56,null));};exports[_0x4f3f('0x2f')]=function(_0x293846,_0x35e85b){if(_0x293846[_0x4f3f('0x4e')]['id']){delete _0x293846[_0x4f3f('0x4e')]['id'];}return db[_0x4f3f('0x46')]['find']({'where':{'id':_0x293846['params']['id']}})['then'](handleEntityNotFound(_0x35e85b,null))['then'](saveUpdates(_0x293846['body'],null))[_0x4f3f('0x1c')](respondWithResult(_0x35e85b,null))[_0x4f3f('0x25')](handleError(_0x35e85b,null));};exports[_0x4f3f('0x4f')]=function(_0x12f190,_0x1b8b2a){return db[_0x4f3f('0x46')][_0x4f3f('0x50')]({'where':{'id':_0x12f190['params']['id']}})[_0x4f3f('0x1c')](handleEntityNotFound(_0x1b8b2a,null))[_0x4f3f('0x1c')](removeEntity(_0x1b8b2a,null))[_0x4f3f('0x25')](handleError(_0x1b8b2a,null));};exports[_0x4f3f('0x51')]=function(_0x418412,_0x51a8fd,_0x3cd2d){var _0x20de96={};var _0x40e9a8={};var _0x4fd219;var _0x6eb55c;return db['ServicenowConfiguration'][_0x4f3f('0x52')]({'where':{'id':_0x418412[_0x4f3f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x51a8fd,null))[_0x4f3f('0x1c')](function(_0x1bea87){if(_0x1bea87){_0x4fd219=_0x1bea87;_0x40e9a8['model']=_['keys'](db[_0x4f3f('0x53')][_0x4f3f('0x33')]);_0x40e9a8[_0x4f3f('0x37')]=_['keys'](_0x418412[_0x4f3f('0x37')]);_0x40e9a8[_0x4f3f('0x39')]=_[_0x4f3f('0x4c')](_0x40e9a8[_0x4f3f('0x36')],_0x40e9a8[_0x4f3f('0x37')]);_0x20de96[_0x4f3f('0x3a')]=_['intersection'](_0x40e9a8['model'],qs['fields'](_0x418412[_0x4f3f('0x37')]['fields']));_0x20de96[_0x4f3f('0x3a')]=_0x20de96[_0x4f3f('0x3a')][_0x4f3f('0x3c')]?_0x20de96['attributes']:_0x40e9a8[_0x4f3f('0x36')];_0x20de96[_0x4f3f('0x3f')]=qs[_0x4f3f('0x40')](_0x418412[_0x4f3f('0x37')][_0x4f3f('0x40')]);_0x20de96[_0x4f3f('0x41')]=qs['filters'](_[_0x4f3f('0x42')](_0x418412['query'],_0x40e9a8[_0x4f3f('0x39')]));if(_0x418412[_0x4f3f('0x37')][_0x4f3f('0x54')]){_0x20de96[_0x4f3f('0x41')]=_[_0x4f3f('0x43')](_0x20de96['where'],{'$or':_[_0x4f3f('0x32')](_0x20de96[_0x4f3f('0x3a')],function(_0x4b6d8a){var _0x7cda7={};_0x7cda7[_0x4b6d8a]={'$like':'%'+_0x418412[_0x4f3f('0x37')][_0x4f3f('0x54')]+'%'};return _0x7cda7;})});}_0x20de96=_['merge']({},_0x20de96,_0x418412['options']);return _0x4fd219[_0x4f3f('0x51')](_0x20de96);}})[_0x4f3f('0x1c')](function(_0x148bfd){if(_0x148bfd){_0x6eb55c=_0x148bfd['length'];if(!_0x418412['query'][_0x4f3f('0x3d')](_0x4f3f('0x3e'))){_0x20de96[_0x4f3f('0x2c')]=qs[_0x4f3f('0x2c')](_0x418412[_0x4f3f('0x37')][_0x4f3f('0x2c')]);_0x20de96['offset']=qs[_0x4f3f('0x2b')](_0x418412['query'][_0x4f3f('0x2b')]);}return _0x4fd219['getFields'](_0x20de96);}})[_0x4f3f('0x1c')](function(_0x18fcbd){if(_0x18fcbd){return _0x18fcbd?{'count':_0x6eb55c,'rows':_0x18fcbd}:null;}})[_0x4f3f('0x1c')](respondWithResult(_0x51a8fd,null))['catch'](handleError(_0x51a8fd,null));};exports[_0x4f3f('0x55')]=function(_0x4eeccd,_0x1f4d54,_0x46c707){var _0x87e35f={};var _0x5066ab={};var _0x20e7a1;var _0x506d85;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x4eeccd[_0x4f3f('0x4b')]['id']}})[_0x4f3f('0x1c')](handleEntityNotFound(_0x1f4d54,null))[_0x4f3f('0x1c')](function(_0x2de226){if(_0x2de226){_0x20e7a1=_0x2de226;_0x5066ab['model']=_[_0x4f3f('0x38')](db[_0x4f3f('0x53')][_0x4f3f('0x33')]);_0x5066ab[_0x4f3f('0x37')]=_[_0x4f3f('0x38')](_0x4eeccd[_0x4f3f('0x37')]);_0x5066ab[_0x4f3f('0x39')]=_[_0x4f3f('0x4c')](_0x5066ab['model'],_0x5066ab[_0x4f3f('0x37')]);_0x87e35f[_0x4f3f('0x3a')]=_[_0x4f3f('0x4c')](_0x5066ab[_0x4f3f('0x36')],qs[_0x4f3f('0x3b')](_0x4eeccd[_0x4f3f('0x37')][_0x4f3f('0x3b')]));_0x87e35f[_0x4f3f('0x3a')]=_0x87e35f[_0x4f3f('0x3a')][_0x4f3f('0x3c')]?_0x87e35f[_0x4f3f('0x3a')]:_0x5066ab[_0x4f3f('0x36')];_0x87e35f['order']=qs['sort'](_0x4eeccd[_0x4f3f('0x37')]['sort']);_0x87e35f['where']=qs[_0x4f3f('0x39')](_[_0x4f3f('0x42')](_0x4eeccd['query'],_0x5066ab[_0x4f3f('0x39')]));if(_0x4eeccd[_0x4f3f('0x37')][_0x4f3f('0x54')]){_0x87e35f['where']=_[_0x4f3f('0x43')](_0x87e35f[_0x4f3f('0x41')],{'$or':_[_0x4f3f('0x32')](_0x87e35f[_0x4f3f('0x3a')],function(_0x583d32){var _0x156d8b={};_0x156d8b[_0x583d32]={'$like':'%'+_0x4eeccd[_0x4f3f('0x37')]['filter']+'%'};return _0x156d8b;})});}_0x87e35f=_[_0x4f3f('0x43')]({},_0x87e35f,_0x4eeccd[_0x4f3f('0x45')]);return _0x20e7a1['getSubjects'](_0x87e35f);}})[_0x4f3f('0x1c')](function(_0x5ea3fd){if(_0x5ea3fd){_0x506d85=_0x5ea3fd[_0x4f3f('0x3c')];if(!_0x4eeccd['query'][_0x4f3f('0x3d')]('nolimit')){_0x87e35f[_0x4f3f('0x2c')]=qs[_0x4f3f('0x2c')](_0x4eeccd[_0x4f3f('0x37')][_0x4f3f('0x2c')]);_0x87e35f['offset']=qs[_0x4f3f('0x2b')](_0x4eeccd[_0x4f3f('0x37')][_0x4f3f('0x2b')]);}return _0x20e7a1[_0x4f3f('0x55')](_0x87e35f);}})[_0x4f3f('0x1c')](function(_0x173216){if(_0x173216){return _0x173216?{'count':_0x506d85,'rows':_0x173216}:null;}})[_0x4f3f('0x1c')](respondWithResult(_0x1f4d54,null))[_0x4f3f('0x25')](handleError(_0x1f4d54,null));};exports[_0x4f3f('0x56')]=function(_0x2768b5,_0x210210,_0x5726ec){var _0x476939={};var _0x3ce883={};var _0x496a28;var _0x46d58d;return db[_0x4f3f('0x46')]['findOne']({'where':{'id':_0x2768b5[_0x4f3f('0x4b')]['id']}})[_0x4f3f('0x1c')](handleEntityNotFound(_0x210210,null))['then'](function(_0x2c81a1){if(_0x2c81a1){_0x496a28=_0x2c81a1;_0x3ce883[_0x4f3f('0x36')]=_[_0x4f3f('0x38')](db[_0x4f3f('0x53')]['rawAttributes']);_0x3ce883[_0x4f3f('0x37')]=_[_0x4f3f('0x38')](_0x2768b5['query']);_0x3ce883[_0x4f3f('0x39')]=_[_0x4f3f('0x4c')](_0x3ce883[_0x4f3f('0x36')],_0x3ce883[_0x4f3f('0x37')]);_0x476939['attributes']=_[_0x4f3f('0x4c')](_0x3ce883['model'],qs[_0x4f3f('0x3b')](_0x2768b5[_0x4f3f('0x37')][_0x4f3f('0x3b')]));_0x476939[_0x4f3f('0x3a')]=_0x476939['attributes']['length']?_0x476939[_0x4f3f('0x3a')]:_0x3ce883[_0x4f3f('0x36')];_0x476939[_0x4f3f('0x3f')]=qs[_0x4f3f('0x40')](_0x2768b5[_0x4f3f('0x37')][_0x4f3f('0x40')]);_0x476939[_0x4f3f('0x41')]=qs[_0x4f3f('0x39')](_[_0x4f3f('0x42')](_0x2768b5[_0x4f3f('0x37')],_0x3ce883[_0x4f3f('0x39')]));if(_0x2768b5[_0x4f3f('0x37')]['filter']){_0x476939[_0x4f3f('0x41')]=_[_0x4f3f('0x43')](_0x476939[_0x4f3f('0x41')],{'$or':_[_0x4f3f('0x32')](_0x476939[_0x4f3f('0x3a')],function(_0x613aec){var _0x14923d={};_0x14923d[_0x613aec]={'$like':'%'+_0x2768b5[_0x4f3f('0x37')][_0x4f3f('0x54')]+'%'};return _0x14923d;})});}_0x476939=_[_0x4f3f('0x43')]({},_0x476939,_0x2768b5[_0x4f3f('0x45')]);return _0x496a28[_0x4f3f('0x56')](_0x476939);}})[_0x4f3f('0x1c')](function(_0xdc0e18){if(_0xdc0e18){_0x46d58d=_0xdc0e18[_0x4f3f('0x3c')];if(!_0x2768b5['query'][_0x4f3f('0x3d')](_0x4f3f('0x3e'))){_0x476939[_0x4f3f('0x2c')]=qs[_0x4f3f('0x2c')](_0x2768b5[_0x4f3f('0x37')][_0x4f3f('0x2c')]);_0x476939[_0x4f3f('0x2b')]=qs[_0x4f3f('0x2b')](_0x2768b5[_0x4f3f('0x37')][_0x4f3f('0x2b')]);}return _0x496a28[_0x4f3f('0x56')](_0x476939);}})[_0x4f3f('0x1c')](function(_0x16419c){if(_0x16419c){return _0x16419c?{'count':_0x46d58d,'rows':_0x16419c}:null;}})[_0x4f3f('0x1c')](respondWithResult(_0x210210,null))[_0x4f3f('0x25')](handleError(_0x210210,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 2bdfc4a..49b3fa4 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 _0xc75a=['moment','bluebird','request-promise','path','rimraf','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','util','../../config/logger','api'];(function(_0x15ceab,_0x564781){var _0x196a96=function(_0x224614){while(--_0x224614){_0x15ceab['push'](_0x15ceab['shift']());}};_0x196a96(++_0x564781);}(_0xc75a,0x8c));var _0xac75=function(_0x10d0f0,_0x1eba3d){_0x10d0f0=_0x10d0f0-0x0;var _0x93e308=_0xc75a[_0x10d0f0];return _0x93e308;};'use strict';var _=require('lodash');var util=require(_0xac75('0x0'));var logger=require(_0xac75('0x1'))(_0xac75('0x2'));var moment=require(_0xac75('0x3'));var BPromise=require(_0xac75('0x4'));var rp=require(_0xac75('0x5'));var fs=require('fs');var path=require(_0xac75('0x6'));var rimraf=require(_0xac75('0x7'));var config=require('../../config/environment');var attributes=require(_0xac75('0x8'));module[_0xac75('0x9')]=function(_0x52a32,_0x49df7b){return _0x52a32[_0xac75('0xa')](_0xac75('0xb'),attributes,{'tableName':_0xac75('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd747=['define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports'];(function(_0x1150d8,_0xbb2e1d){var _0x54b658=function(_0x652f0c){while(--_0x652f0c){_0x1150d8['push'](_0x1150d8['shift']());}};_0x54b658(++_0xbb2e1d);}(_0xd747,0x1e3));var _0x7d74=function(_0x58a2e3,_0xf6018a){_0x58a2e3=_0x58a2e3-0x0;var _0x377775=_0xd747[_0x58a2e3];return _0x377775;};'use strict';var _=require(_0x7d74('0x0'));var util=require(_0x7d74('0x1'));var logger=require(_0x7d74('0x2'))(_0x7d74('0x3'));var moment=require(_0x7d74('0x4'));var BPromise=require(_0x7d74('0x5'));var rp=require(_0x7d74('0x6'));var fs=require('fs');var path=require(_0x7d74('0x7'));var rimraf=require(_0x7d74('0x8'));var config=require(_0x7d74('0x9'));var attributes=require(_0x7d74('0xa'));module[_0x7d74('0xb')]=function(_0x4a8f57,_0x112a48){return _0x4a8f57[_0x7d74('0xc')](_0x7d74('0xd'),attributes,{'tableName':_0x7d74('0xe'),'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 f959389..6ad0d42 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 _0x7884=['debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s'];(function(_0x4c9afd,_0x21af7a){var _0x4ecefe=function(_0x4d67a1){while(--_0x4d67a1){_0x4c9afd['push'](_0x4c9afd['shift']());}};_0x4ecefe(++_0x21af7a);}(_0x7884,0x9e));var _0x4788=function(_0x300bd9,_0x1fedd9){_0x300bd9=_0x300bd9-0x0;var _0x574e18=_0x7884[_0x300bd9];return _0x574e18;};'use strict';var _=require(_0x4788('0x0'));var util=require(_0x4788('0x1'));var moment=require(_0x4788('0x2'));var BPromise=require(_0x4788('0x3'));var rs=require(_0x4788('0x4'));var fs=require('fs');var Redis=require(_0x4788('0x5'));var db=require(_0x4788('0x6'))['db'];var utils=require(_0x4788('0x7'));var logger=require(_0x4788('0x8'))(_0x4788('0x9'));var config=require('../../config/environment');var jayson=require(_0x4788('0xa'));var client=jayson[_0x4788('0xb')][_0x4788('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x40cf81,_0xd23056,_0x5f3d30){return new BPromise(function(_0x2599e6,_0x416296){return client[_0x4788('0xd')](_0x40cf81,_0x5f3d30)[_0x4788('0xe')](function(_0x68be0f){logger[_0x4788('0xf')](_0x4788('0x10'),_0xd23056,'request\x20sent');logger[_0x4788('0x11')](_0x4788('0x12'),_0xd23056,_0x4788('0x13'),JSON['stringify'](_0x68be0f));if(_0x68be0f[_0x4788('0x14')]){if(_0x68be0f[_0x4788('0x14')][_0x4788('0x15')]===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0xd23056,_0x68be0f[_0x4788('0x14')][_0x4788('0x16')]);return _0x416296(_0x68be0f[_0x4788('0x14')][_0x4788('0x16')]);}logger[_0x4788('0x14')](_0x4788('0x10'),_0xd23056,_0x68be0f[_0x4788('0x14')]['message']);return _0x2599e6(_0x68be0f[_0x4788('0x14')]['message']);}else{logger[_0x4788('0xf')](_0x4788('0x10'),_0xd23056,_0x4788('0x13'));_0x2599e6(_0x68be0f[_0x4788('0x17')][_0x4788('0x16')]);}})[_0x4788('0x18')](function(_0x109246){logger[_0x4788('0x14')](_0x4788('0x10'),_0xd23056,_0x109246);_0x416296(_0x109246);});});} \ No newline at end of file +var _0xbbc0=['then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x318d88,_0x84d20c){var _0x360f3b=function(_0x261c61){while(--_0x261c61){_0x318d88['push'](_0x318d88['shift']());}};_0x360f3b(++_0x84d20c);}(_0xbbc0,0x8f));var _0x0bbc=function(_0x2f35ce,_0x56dd4a){_0x2f35ce=_0x2f35ce-0x0;var _0x11bd3e=_0xbbc0[_0x2f35ce];return _0x11bd3e;};'use strict';var _=require(_0x0bbc('0x0'));var util=require('util');var moment=require(_0x0bbc('0x1'));var BPromise=require(_0x0bbc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0bbc('0x3'));var db=require(_0x0bbc('0x4'))['db'];var utils=require(_0x0bbc('0x5'));var logger=require(_0x0bbc('0x6'))(_0x0bbc('0x7'));var config=require('../../config/environment');var jayson=require(_0x0bbc('0x8'));var client=jayson[_0x0bbc('0x9')][_0x0bbc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a72fa,_0x462a33,_0x5db859){return new BPromise(function(_0x45d665,_0x398342){return client['request'](_0x4a72fa,_0x5db859)[_0x0bbc('0xb')](function(_0x52e1a6){logger[_0x0bbc('0xc')](_0x0bbc('0xd'),_0x462a33,_0x0bbc('0xe'));logger['debug'](_0x0bbc('0xf'),_0x462a33,_0x0bbc('0xe'),JSON[_0x0bbc('0x10')](_0x52e1a6));if(_0x52e1a6['error']){if(_0x52e1a6[_0x0bbc('0x11')][_0x0bbc('0x12')]===0x1f4){logger['error'](_0x0bbc('0xd'),_0x462a33,_0x52e1a6[_0x0bbc('0x11')][_0x0bbc('0x13')]);return _0x398342(_0x52e1a6[_0x0bbc('0x11')][_0x0bbc('0x13')]);}logger[_0x0bbc('0x11')](_0x0bbc('0xd'),_0x462a33,_0x52e1a6[_0x0bbc('0x11')][_0x0bbc('0x13')]);return _0x45d665(_0x52e1a6['error'][_0x0bbc('0x13')]);}else{logger['info'](_0x0bbc('0xd'),_0x462a33,'request\x20sent');_0x45d665(_0x52e1a6[_0x0bbc('0x14')][_0x0bbc('0x13')]);}})[_0x0bbc('0x15')](function(_0x32dda3){logger[_0x0bbc('0x11')](_0x0bbc('0xd'),_0x462a33,_0x32dda3);_0x398342(_0x32dda3);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index cac6eec..5d03ea1 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 _0x8ac4=['Router','fs-extra','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show','create','put','delete','destroy','exports','multer','util','path','express'];(function(_0x5d9070,_0x3354f0){var _0x1373cd=function(_0x3007a7){while(--_0x3007a7){_0x5d9070['push'](_0x5d9070['shift']());}};_0x1373cd(++_0x3354f0);}(_0x8ac4,0x95));var _0x48ac=function(_0x523a63,_0x328bd9){_0x523a63=_0x523a63-0x0;var _0x5c95ce=_0x8ac4[_0x523a63];return _0x5c95ce;};'use strict';var multer=require(_0x48ac('0x0'));var util=require(_0x48ac('0x1'));var path=require(_0x48ac('0x2'));var timeout=require('connect-timeout');var express=require(_0x48ac('0x3'));var router=express[_0x48ac('0x4')]();var fs_extra=require(_0x48ac('0x5'));var auth=require(_0x48ac('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x48ac('0x7'));var controller=require('./intServicenowField.controller');router[_0x48ac('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x48ac('0x9'),auth[_0x48ac('0xa')](),controller[_0x48ac('0xb')]);router['post']('/',auth[_0x48ac('0xa')](),controller[_0x48ac('0xc')]);router[_0x48ac('0xd')](_0x48ac('0x9'),auth[_0x48ac('0xa')](),controller['update']);router[_0x48ac('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x48ac('0xf')]);module[_0x48ac('0x10')]=router; \ No newline at end of file +var _0x2c5c=['show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller','get','index','/:id','isAuthenticated'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x2c5c,0x110));var _0xc2c5=function(_0x50fd6c,_0x386caa){_0x50fd6c=_0x50fd6c-0x0;var _0x7136cf=_0x2c5c[_0x50fd6c];return _0x7136cf;};'use strict';var multer=require(_0xc2c5('0x0'));var util=require(_0xc2c5('0x1'));var path=require(_0xc2c5('0x2'));var timeout=require(_0xc2c5('0x3'));var express=require(_0xc2c5('0x4'));var router=express['Router']();var fs_extra=require(_0xc2c5('0x5'));var auth=require(_0xc2c5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc2c5('0x7'));var controller=require(_0xc2c5('0x8'));router[_0xc2c5('0x9')]('/',auth['isAuthenticated'](),controller[_0xc2c5('0xa')]);router[_0xc2c5('0x9')](_0xc2c5('0xb'),auth[_0xc2c5('0xc')](),controller[_0xc2c5('0xd')]);router['post']('/',auth[_0xc2c5('0xc')](),controller[_0xc2c5('0xe')]);router['put'](_0xc2c5('0xb'),auth[_0xc2c5('0xc')](),controller[_0xc2c5('0xf')]);router[_0xc2c5('0x10')](_0xc2c5('0xb'),auth[_0xc2c5('0xc')](),controller[_0xc2c5('0x11')]);module[_0xc2c5('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 7bc45b0..13ce330 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 _0x7dfd=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x2be1ca,_0x12e7d2){var _0x2f07d7=function(_0x49cf57){while(--_0x49cf57){_0x2be1ca['push'](_0x2be1ca['shift']());}};_0x2f07d7(++_0x12e7d2);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'type':{'type':Sequelize[_0xd7df('0x2')](_0xd7df('0x3'),_0xd7df('0x4'),_0xd7df('0x5'),_0xd7df('0x6'),_0xd7df('0x7')),'defaultValue':_0xd7df('0x3')},'content':{'type':Sequelize[_0xd7df('0x8')]},'key':{'type':Sequelize[_0xd7df('0x8')]},'keyType':{'type':Sequelize[_0xd7df('0x2')](_0xd7df('0x3'),_0xd7df('0x4'),_0xd7df('0x5'))},'keyContent':{'type':Sequelize[_0xd7df('0x8')]},'idField':{'type':Sequelize[_0xd7df('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd7df('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd7df('0x8')]}}; \ No newline at end of file +var _0x5292=['exports','string','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x59a877,_0x54e643){var _0x1ee498=function(_0x54e059){while(--_0x54e059){_0x59a877['push'](_0x59a877['shift']());}};_0x1ee498(++_0x54e643);}(_0x5292,0xf7));var _0x2529=function(_0x30c57f,_0x4e26ca){_0x30c57f=_0x30c57f-0x0;var _0x570756=_0x5292[_0x30c57f];return _0x570756;};'use strict';var Sequelize=require(_0x2529('0x0'));module[_0x2529('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2529('0x2'),'variable',_0x2529('0x3'),_0x2529('0x4'),_0x2529('0x5')),'defaultValue':_0x2529('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2529('0x6')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x2529('0x3'))},'keyContent':{'type':Sequelize[_0x2529('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2529('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2529('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index d6c3899..d42fde8 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 _0x4b49=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','Content-Range','json','apply','reject','save','update','then','sendStatus','name','send','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','ServicenowField','rows','catch','show','params','length','include','options','create','body','find','destroy','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0xf793fc,_0x3d27bd){var _0x599b98=function(_0x3a2c09){while(--_0x3a2c09){_0xf793fc['push'](_0xf793fc['shift']());}};_0x599b98(++_0x3d27bd);}(_0x4b49,0x150));var _0x94b4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b49[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x94b4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x94b4('0x1'));var zipdir=require(_0x94b4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x94b4('0x3'));var moment=require(_0x94b4('0x4'));var BPromise=require(_0x94b4('0x5'));var Mustache=require(_0x94b4('0x6'));var util=require(_0x94b4('0x7'));var path=require(_0x94b4('0x8'));var sox=require(_0x94b4('0x9'));var csv=require(_0x94b4('0xa'));var ejs=require(_0x94b4('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x94b4('0xc'));var squel=require(_0x94b4('0xd'));var crypto=require('crypto');var jsforce=require(_0x94b4('0xe'));var deskjs=require(_0x94b4('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x94b4('0x10'));var Redis=require('ioredis');var authService=require(_0x94b4('0x11'));var qs=require(_0x94b4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x94b4('0x13'));var config=require(_0x94b4('0x14'));var licenseUtil=require(_0x94b4('0x15'));var db=require(_0x94b4('0x16'))['db'];function respondWithStatusCode(_0x7ff2ca,_0x5a9d66){_0x5a9d66=_0x5a9d66||0xcc;return function(_0x44cea6){if(_0x44cea6){return _0x7ff2ca['sendStatus'](_0x5a9d66);}return _0x7ff2ca[_0x94b4('0x17')](_0x5a9d66)[_0x94b4('0x18')]();};}function respondWithResult(_0x24e795,_0x172f9b){_0x172f9b=_0x172f9b||0xc8;return function(_0x3e82fa){if(_0x3e82fa){return _0x24e795[_0x94b4('0x17')](_0x172f9b)['json'](_0x3e82fa);}};}function respondWithFilteredResult(_0x5f49d2,_0x27882a){return function(_0x11a8f0){if(_0x11a8f0){var _0x256a51=_0x11a8f0[_0x94b4('0x19')],_0x600f32=_0x27882a[_0x94b4('0x1a')],_0x50d81d=_0x27882a[_0x94b4('0x1a')]+_0x27882a['limit'],_0x2da4af;if(_0x50d81d>=_0x256a51){_0x50d81d=_0x256a51;_0x2da4af=0xc8;}else{_0x2da4af=0xce;}_0x5f49d2['status'](_0x2da4af);return _0x5f49d2['set'](_0x94b4('0x1b'),_0x600f32+'-'+_0x50d81d+'/'+_0x256a51)[_0x94b4('0x1c')](_0x11a8f0);}return null;};}function patchUpdates(_0x4f74c7){return function(_0x54273b){try{jsonpatch[_0x94b4('0x1d')](_0x54273b,_0x4f74c7,!![]);}catch(_0x13b4c5){return BPromise[_0x94b4('0x1e')](_0x13b4c5);}return _0x54273b[_0x94b4('0x1f')]();};}function saveUpdates(_0x7e07b9,_0x540be0){return function(_0x1cc5b8){if(_0x1cc5b8){return _0x1cc5b8[_0x94b4('0x20')](_0x7e07b9)[_0x94b4('0x21')](function(_0x3d91fb){return _0x3d91fb;});}return null;};}function removeEntity(_0x25085c,_0x342c03){return function(_0x156429){if(_0x156429){return _0x156429['destroy']()['then'](function(){_0x25085c[_0x94b4('0x17')](0xcc)[_0x94b4('0x18')]();});}};}function handleEntityNotFound(_0x1a8d4e,_0x5e9f3e){return function(_0x20d214){if(!_0x20d214){_0x1a8d4e[_0x94b4('0x22')](0x194);}return _0x20d214;};}function handleError(_0x2120f5,_0x1c8335){_0x1c8335=_0x1c8335||0x1f4;return function(_0x28cbf1){logger['error'](_0x28cbf1['stack']);if(_0x28cbf1[_0x94b4('0x23')]){delete _0x28cbf1[_0x94b4('0x23')];}_0x2120f5[_0x94b4('0x17')](_0x1c8335)[_0x94b4('0x24')](_0x28cbf1);};}exports['index']=function(_0x51a927,_0xc12254){var _0x3692d8={},_0x405570={},_0x416bb8={'count':0x0,'rows':[]};var _0x34c47f=_['map'](db['ServicenowField'][_0x94b4('0x25')],function(_0x200478){return{'name':_0x200478[_0x94b4('0x26')],'type':_0x200478['type'][_0x94b4('0x27')]};});_0x405570[_0x94b4('0x28')]=_[_0x94b4('0x29')](_0x34c47f,_0x94b4('0x23'));_0x405570['query']=_[_0x94b4('0x2a')](_0x51a927[_0x94b4('0x2b')]);_0x405570[_0x94b4('0x2c')]=_[_0x94b4('0x2d')](_0x405570[_0x94b4('0x28')],_0x405570[_0x94b4('0x2b')]);_0x3692d8[_0x94b4('0x2e')]=_[_0x94b4('0x2d')](_0x405570['model'],qs[_0x94b4('0x2f')](_0x51a927[_0x94b4('0x2b')][_0x94b4('0x2f')]));_0x3692d8['attributes']=_0x3692d8['attributes']['length']?_0x3692d8[_0x94b4('0x2e')]:_0x405570[_0x94b4('0x28')];if(!_0x51a927[_0x94b4('0x2b')][_0x94b4('0x30')]('nolimit')){_0x3692d8['limit']=qs['limit'](_0x51a927[_0x94b4('0x2b')][_0x94b4('0x31')]);_0x3692d8['offset']=qs['offset'](_0x51a927[_0x94b4('0x2b')][_0x94b4('0x1a')]);}_0x3692d8[_0x94b4('0x32')]=qs['sort'](_0x51a927[_0x94b4('0x2b')][_0x94b4('0x33')]);_0x3692d8[_0x94b4('0x34')]=qs[_0x94b4('0x2c')](_[_0x94b4('0x35')](_0x51a927[_0x94b4('0x2b')],_0x405570[_0x94b4('0x2c')]),_0x34c47f);if(_0x51a927[_0x94b4('0x2b')][_0x94b4('0x36')]){_0x3692d8[_0x94b4('0x34')]=_[_0x94b4('0x37')](_0x3692d8[_0x94b4('0x34')],{'$or':_[_0x94b4('0x29')](_0x34c47f,function(_0x4344d2){if(_0x4344d2[_0x94b4('0x38')]!==_0x94b4('0x39')){var _0x5d8aaa={};_0x5d8aaa[_0x4344d2[_0x94b4('0x23')]]={'$like':'%'+_0x51a927[_0x94b4('0x2b')][_0x94b4('0x36')]+'%'};return _0x5d8aaa;}})});}_0x3692d8=_[_0x94b4('0x37')]({},_0x3692d8,_0x51a927['options']);var _0x261ae1={'where':_0x3692d8[_0x94b4('0x34')]};return db['ServicenowField'][_0x94b4('0x19')](_0x261ae1)['then'](function(_0x371d87){_0x416bb8[_0x94b4('0x19')]=_0x371d87;if(_0x51a927[_0x94b4('0x2b')][_0x94b4('0x3a')]){_0x3692d8['include']=[{'all':!![]}];}return db[_0x94b4('0x3b')]['findAll'](_0x3692d8);})['then'](function(_0x3cf086){_0x416bb8[_0x94b4('0x3c')]=_0x3cf086;return _0x416bb8;})[_0x94b4('0x21')](respondWithFilteredResult(_0xc12254,_0x3692d8))[_0x94b4('0x3d')](handleError(_0xc12254,null));};exports[_0x94b4('0x3e')]=function(_0x52a7eb,_0x308cb1){var _0x445174={'raw':!![],'where':{'id':_0x52a7eb[_0x94b4('0x3f')]['id']}},_0x253a51={};_0x253a51[_0x94b4('0x28')]=_[_0x94b4('0x2a')](db[_0x94b4('0x3b')][_0x94b4('0x25')]);_0x253a51[_0x94b4('0x2b')]=_[_0x94b4('0x2a')](_0x52a7eb[_0x94b4('0x2b')]);_0x253a51[_0x94b4('0x2c')]=_[_0x94b4('0x2d')](_0x253a51[_0x94b4('0x28')],_0x253a51[_0x94b4('0x2b')]);_0x445174[_0x94b4('0x2e')]=_['intersection'](_0x253a51[_0x94b4('0x28')],qs[_0x94b4('0x2f')](_0x52a7eb[_0x94b4('0x2b')][_0x94b4('0x2f')]));_0x445174[_0x94b4('0x2e')]=_0x445174[_0x94b4('0x2e')][_0x94b4('0x40')]?_0x445174[_0x94b4('0x2e')]:_0x253a51[_0x94b4('0x28')];if(_0x52a7eb[_0x94b4('0x2b')][_0x94b4('0x3a')]){_0x445174[_0x94b4('0x41')]=[{'all':!![]}];}_0x445174=_[_0x94b4('0x37')]({},_0x445174,_0x52a7eb[_0x94b4('0x42')]);return db['ServicenowField']['find'](_0x445174)[_0x94b4('0x21')](handleEntityNotFound(_0x308cb1,null))[_0x94b4('0x21')](respondWithResult(_0x308cb1,null))[_0x94b4('0x3d')](handleError(_0x308cb1,null));};exports[_0x94b4('0x43')]=function(_0x11afbb,_0x198ecc){return db[_0x94b4('0x3b')]['create'](_0x11afbb[_0x94b4('0x44')],{})[_0x94b4('0x21')](respondWithResult(_0x198ecc,0xc9))[_0x94b4('0x3d')](handleError(_0x198ecc,null));};exports[_0x94b4('0x20')]=function(_0x63379b,_0x568b65){if(_0x63379b[_0x94b4('0x44')]['id']){delete _0x63379b['body']['id'];}return db['ServicenowField'][_0x94b4('0x45')]({'where':{'id':_0x63379b['params']['id']}})[_0x94b4('0x21')](handleEntityNotFound(_0x568b65,null))[_0x94b4('0x21')](saveUpdates(_0x63379b[_0x94b4('0x44')],null))[_0x94b4('0x21')](respondWithResult(_0x568b65,null))[_0x94b4('0x3d')](handleError(_0x568b65,null));};exports[_0x94b4('0x46')]=function(_0x378415,_0x25d2d3){return db[_0x94b4('0x3b')][_0x94b4('0x45')]({'where':{'id':_0x378415[_0x94b4('0x3f')]['id']}})[_0x94b4('0x21')](handleEntityNotFound(_0x25d2d3,null))[_0x94b4('0x21')](removeEntity(_0x25d2d3,null))['catch'](handleError(_0x25d2d3,null));}; \ No newline at end of file +var _0x1029=['body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','includeAll','include','options','find','catch','create'];(function(_0x46372c,_0x53e176){var _0x5c503b=function(_0x3302ec){while(--_0x3302ec){_0x46372c['push'](_0x46372c['shift']());}};_0x5c503b(++_0x53e176);}(_0x1029,0x17e));var _0x9102=function(_0x4356aa,_0x1e663d){_0x4356aa=_0x4356aa-0x0;var _0x59fc2d=_0x1029[_0x4356aa];return _0x59fc2d;};'use strict';var pdf=require(_0x9102('0x0'));var emlformat=require(_0x9102('0x1'));var rimraf=require(_0x9102('0x2'));var zipdir=require(_0x9102('0x3'));var jsonpatch=require(_0x9102('0x4'));var rp=require(_0x9102('0x5'));var moment=require(_0x9102('0x6'));var BPromise=require(_0x9102('0x7'));var Mustache=require(_0x9102('0x8'));var util=require(_0x9102('0x9'));var path=require(_0x9102('0xa'));var sox=require(_0x9102('0xb'));var csv=require(_0x9102('0xc'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9102('0xd'));var _=require('lodash');var squel=require(_0x9102('0xe'));var crypto=require(_0x9102('0xf'));var jsforce=require(_0x9102('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x9102('0xc'));var querystring=require(_0x9102('0x11'));var Papa=require(_0x9102('0x12'));var Redis=require(_0x9102('0x13'));var authService=require(_0x9102('0x14'));var qs=require(_0x9102('0x15'));var as=require(_0x9102('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9102('0x17'))(_0x9102('0x18'));var utils=require('../../config/utils');var config=require(_0x9102('0x19'));var licenseUtil=require(_0x9102('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x594331,_0xc3b29f){_0xc3b29f=_0xc3b29f||0xcc;return function(_0x1fa670){if(_0x1fa670){return _0x594331[_0x9102('0x1b')](_0xc3b29f);}return _0x594331[_0x9102('0x1c')](_0xc3b29f)[_0x9102('0x1d')]();};}function respondWithResult(_0x1062a8,_0x221891){_0x221891=_0x221891||0xc8;return function(_0x38efd7){if(_0x38efd7){return _0x1062a8['status'](_0x221891)['json'](_0x38efd7);}};}function respondWithFilteredResult(_0x480744,_0x118f60){return function(_0x1afabd){if(_0x1afabd){var _0x573d0d=_0x1afabd[_0x9102('0x1e')],_0x2e1e31=_0x118f60[_0x9102('0x1f')],_0x3f2a5b=_0x118f60[_0x9102('0x1f')]+_0x118f60['limit'],_0x2ae0de;if(_0x3f2a5b>=_0x573d0d){_0x3f2a5b=_0x573d0d;_0x2ae0de=0xc8;}else{_0x2ae0de=0xce;}_0x480744['status'](_0x2ae0de);return _0x480744[_0x9102('0x20')](_0x9102('0x21'),_0x2e1e31+'-'+_0x3f2a5b+'/'+_0x573d0d)[_0x9102('0x22')](_0x1afabd);}return null;};}function patchUpdates(_0x12aa04){return function(_0x59066e){try{jsonpatch[_0x9102('0x23')](_0x59066e,_0x12aa04,!![]);}catch(_0x1e7762){return BPromise[_0x9102('0x24')](_0x1e7762);}return _0x59066e[_0x9102('0x25')]();};}function saveUpdates(_0xbe12bb,_0x41951e){return function(_0x4afd94){if(_0x4afd94){return _0x4afd94[_0x9102('0x26')](_0xbe12bb)['then'](function(_0x5acb0e){return _0x5acb0e;});}return null;};}function removeEntity(_0x45cf0c,_0x43939c){return function(_0x1f6f9d){if(_0x1f6f9d){return _0x1f6f9d[_0x9102('0x27')]()[_0x9102('0x28')](function(){_0x45cf0c[_0x9102('0x1c')](0xcc)[_0x9102('0x1d')]();});}};}function handleEntityNotFound(_0x23d144,_0x421e85){return function(_0x5b5035){if(!_0x5b5035){_0x23d144[_0x9102('0x1b')](0x194);}return _0x5b5035;};}function handleError(_0x4e5432,_0x2dc387){_0x2dc387=_0x2dc387||0x1f4;return function(_0x3a394d){logger[_0x9102('0x29')](_0x3a394d['stack']);if(_0x3a394d[_0x9102('0x2a')]){delete _0x3a394d[_0x9102('0x2a')];}_0x4e5432[_0x9102('0x1c')](_0x2dc387)[_0x9102('0x2b')](_0x3a394d);};}exports[_0x9102('0x2c')]=function(_0xb49aae,_0xb24aa2){var _0x305f64={},_0x56ea7b={},_0x27b34d={'count':0x0,'rows':[]};var _0x438d75=_[_0x9102('0x2d')](db[_0x9102('0x2e')][_0x9102('0x2f')],function(_0x3f7e8c){return{'name':_0x3f7e8c[_0x9102('0x30')],'type':_0x3f7e8c[_0x9102('0x31')][_0x9102('0x32')]};});_0x56ea7b[_0x9102('0x33')]=_['map'](_0x438d75,_0x9102('0x2a'));_0x56ea7b[_0x9102('0x34')]=_[_0x9102('0x35')](_0xb49aae[_0x9102('0x34')]);_0x56ea7b['filters']=_['intersection'](_0x56ea7b[_0x9102('0x33')],_0x56ea7b[_0x9102('0x34')]);_0x305f64['attributes']=_[_0x9102('0x36')](_0x56ea7b[_0x9102('0x33')],qs[_0x9102('0x37')](_0xb49aae[_0x9102('0x34')]['fields']));_0x305f64[_0x9102('0x38')]=_0x305f64[_0x9102('0x38')][_0x9102('0x39')]?_0x305f64['attributes']:_0x56ea7b[_0x9102('0x33')];if(!_0xb49aae[_0x9102('0x34')][_0x9102('0x3a')](_0x9102('0x3b'))){_0x305f64['limit']=qs['limit'](_0xb49aae[_0x9102('0x34')][_0x9102('0x3c')]);_0x305f64['offset']=qs[_0x9102('0x1f')](_0xb49aae[_0x9102('0x34')][_0x9102('0x1f')]);}_0x305f64[_0x9102('0x3d')]=qs[_0x9102('0x3e')](_0xb49aae[_0x9102('0x34')][_0x9102('0x3e')]);_0x305f64[_0x9102('0x3f')]=qs[_0x9102('0x40')](_[_0x9102('0x41')](_0xb49aae[_0x9102('0x34')],_0x56ea7b[_0x9102('0x40')]),_0x438d75);if(_0xb49aae[_0x9102('0x34')][_0x9102('0x42')]){_0x305f64[_0x9102('0x3f')]=_[_0x9102('0x43')](_0x305f64['where'],{'$or':_[_0x9102('0x2d')](_0x438d75,function(_0x430781){if(_0x430781[_0x9102('0x31')]!=='VIRTUAL'){var _0x2f35ee={};_0x2f35ee[_0x430781[_0x9102('0x2a')]]={'$like':'%'+_0xb49aae[_0x9102('0x34')][_0x9102('0x42')]+'%'};return _0x2f35ee;}})});}_0x305f64=_[_0x9102('0x43')]({},_0x305f64,_0xb49aae['options']);var _0x1464a5={'where':_0x305f64[_0x9102('0x3f')]};return db[_0x9102('0x2e')]['count'](_0x1464a5)[_0x9102('0x28')](function(_0x1707f6){_0x27b34d['count']=_0x1707f6;if(_0xb49aae['query'][_0x9102('0x44')]){_0x305f64[_0x9102('0x45')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x305f64);})['then'](function(_0x53c3af){_0x27b34d['rows']=_0x53c3af;return _0x27b34d;})[_0x9102('0x28')](respondWithFilteredResult(_0xb24aa2,_0x305f64))['catch'](handleError(_0xb24aa2,null));};exports['show']=function(_0x13f1c3,_0x18a208){var _0x464b6e={'raw':!![],'where':{'id':_0x13f1c3['params']['id']}},_0x1858fb={};_0x1858fb[_0x9102('0x33')]=_['keys'](db['ServicenowField'][_0x9102('0x2f')]);_0x1858fb[_0x9102('0x34')]=_[_0x9102('0x35')](_0x13f1c3['query']);_0x1858fb[_0x9102('0x40')]=_[_0x9102('0x36')](_0x1858fb[_0x9102('0x33')],_0x1858fb[_0x9102('0x34')]);_0x464b6e['attributes']=_[_0x9102('0x36')](_0x1858fb[_0x9102('0x33')],qs[_0x9102('0x37')](_0x13f1c3[_0x9102('0x34')][_0x9102('0x37')]));_0x464b6e[_0x9102('0x38')]=_0x464b6e[_0x9102('0x38')][_0x9102('0x39')]?_0x464b6e[_0x9102('0x38')]:_0x1858fb[_0x9102('0x33')];if(_0x13f1c3['query'][_0x9102('0x44')]){_0x464b6e[_0x9102('0x45')]=[{'all':!![]}];}_0x464b6e=_[_0x9102('0x43')]({},_0x464b6e,_0x13f1c3[_0x9102('0x46')]);return db[_0x9102('0x2e')][_0x9102('0x47')](_0x464b6e)[_0x9102('0x28')](handleEntityNotFound(_0x18a208,null))[_0x9102('0x28')](respondWithResult(_0x18a208,null))[_0x9102('0x48')](handleError(_0x18a208,null));};exports[_0x9102('0x49')]=function(_0x2f12ad,_0x3ac8d7){return db[_0x9102('0x2e')][_0x9102('0x49')](_0x2f12ad[_0x9102('0x4a')],{})['then'](respondWithResult(_0x3ac8d7,0xc9))[_0x9102('0x48')](handleError(_0x3ac8d7,null));};exports[_0x9102('0x26')]=function(_0x26805c,_0x1c2a9e){if(_0x26805c[_0x9102('0x4a')]['id']){delete _0x26805c[_0x9102('0x4a')]['id'];}return db[_0x9102('0x2e')]['find']({'where':{'id':_0x26805c[_0x9102('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1c2a9e,null))[_0x9102('0x28')](saveUpdates(_0x26805c[_0x9102('0x4a')],null))[_0x9102('0x28')](respondWithResult(_0x1c2a9e,null))[_0x9102('0x48')](handleError(_0x1c2a9e,null));};exports['destroy']=function(_0x3bf70d,_0x3af39f){return db[_0x9102('0x2e')][_0x9102('0x47')]({'where':{'id':_0x3bf70d['params']['id']}})[_0x9102('0x28')](handleEntityNotFound(_0x3af39f,null))['then'](removeEntity(_0x3af39f,null))[_0x9102('0x48')](handleError(_0x3af39f,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 9bf84ec..3f4d0e4 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 _0xfff8=['../../config/environment','./intServicenowField.attributes','define','ServicenowField','int_servicenow_fields','idField','FieldId','lodash','../../config/logger','bluebird','path','rimraf'];(function(_0x4d9fc9,_0x1a7049){var _0x21364d=function(_0x391631){while(--_0x391631){_0x4d9fc9['push'](_0x4d9fc9['shift']());}};_0x21364d(++_0x1a7049);}(_0xfff8,0x1ab));var _0x8fff=function(_0x3a4f97,_0x48094a){_0x3a4f97=_0x3a4f97-0x0;var _0x569e88=_0xfff8[_0x3a4f97];return _0x569e88;};'use strict';var _=require(_0x8fff('0x0'));var util=require('util');var logger=require(_0x8fff('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8fff('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8fff('0x3'));var rimraf=require(_0x8fff('0x4'));var config=require(_0x8fff('0x5'));var attributes=require(_0x8fff('0x6'));module['exports']=function(_0x3f257d,_0x543190){return _0x3f257d[_0x8fff('0x7')](_0x8fff('0x8'),attributes,{'tableName':_0x8fff('0x9'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x8fff('0xa'),_0x8fff('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6b86=['define','int_servicenow_fields','lodash','util','../../config/logger','api','path','rimraf','./intServicenowField.attributes','exports'];(function(_0x36bde9,_0x10858e){var _0x4b6b49=function(_0x1940ad){while(--_0x1940ad){_0x36bde9['push'](_0x36bde9['shift']());}};_0x4b6b49(++_0x10858e);}(_0x6b86,0xa2));var _0x66b8=function(_0x2e0c29,_0x3153b1){_0x2e0c29=_0x2e0c29-0x0;var _0x197545=_0x6b86[_0x2e0c29];return _0x197545;};'use strict';var _=require(_0x66b8('0x0'));var util=require(_0x66b8('0x1'));var logger=require(_0x66b8('0x2'))(_0x66b8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x66b8('0x4'));var rimraf=require(_0x66b8('0x5'));var config=require('../../config/environment');var attributes=require(_0x66b8('0x6'));module[_0x66b8('0x7')]=function(_0x1af497,_0x5f47fa){return _0x1af497[_0x66b8('0x8')]('ServicenowField',attributes,{'tableName':_0x66b8('0x9'),'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 c55058b..bf607dc 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 _0x4921=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util'];(function(_0x5fbf4e,_0x31a06a){var _0x3f66cd=function(_0x4daf8c){while(--_0x4daf8c){_0x5fbf4e['push'](_0x5fbf4e['shift']());}};_0x3f66cd(++_0x31a06a);}(_0x4921,0x113));var _0x1492=function(_0x5e8c0f,_0x1f20d9){_0x5e8c0f=_0x5e8c0f-0x0;var _0x568dbe=_0x4921[_0x5e8c0f];return _0x568dbe;};'use strict';var _=require('lodash');var util=require(_0x1492('0x0'));var moment=require('moment');var BPromise=require(_0x1492('0x1'));var rs=require(_0x1492('0x2'));var fs=require('fs');var Redis=require(_0x1492('0x3'));var db=require(_0x1492('0x4'))['db'];var utils=require(_0x1492('0x5'));var logger=require(_0x1492('0x6'))(_0x1492('0x7'));var config=require(_0x1492('0x8'));var jayson=require(_0x1492('0x9'));var client=jayson[_0x1492('0xa')][_0x1492('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58a69e,_0x1f2353,_0x494f88){return new BPromise(function(_0x174ab1,_0x499b04){return client[_0x1492('0xc')](_0x58a69e,_0x494f88)[_0x1492('0xd')](function(_0x3869e5){logger[_0x1492('0xe')](_0x1492('0xf'),_0x1f2353,_0x1492('0x10'));logger[_0x1492('0x11')](_0x1492('0x12'),_0x1f2353,_0x1492('0x10'),JSON[_0x1492('0x13')](_0x3869e5));if(_0x3869e5[_0x1492('0x14')]){if(_0x3869e5['error'][_0x1492('0x15')]===0x1f4){logger[_0x1492('0x14')](_0x1492('0xf'),_0x1f2353,_0x3869e5[_0x1492('0x14')][_0x1492('0x16')]);return _0x499b04(_0x3869e5[_0x1492('0x14')][_0x1492('0x16')]);}logger['error'](_0x1492('0xf'),_0x1f2353,_0x3869e5['error'][_0x1492('0x16')]);return _0x174ab1(_0x3869e5[_0x1492('0x14')]['message']);}else{logger['info'](_0x1492('0xf'),_0x1f2353,'request\x20sent');_0x174ab1(_0x3869e5['result'][_0x1492('0x16')]);}})['catch'](function(_0x38b70c){logger['error'](_0x1492('0xf'),_0x1f2353,_0x38b70c);_0x499b04(_0x38b70c);});});} \ No newline at end of file +var _0x879e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x879e,0x104));var _0xe879=function(_0x3e2f39,_0x52276d){_0x3e2f39=_0x3e2f39-0x0;var _0x1f915c=_0x879e[_0x3e2f39];return _0x1f915c;};'use strict';var _=require(_0xe879('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe879('0x1'));var rs=require(_0xe879('0x2'));var fs=require('fs');var Redis=require(_0xe879('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe879('0x4'));var logger=require(_0xe879('0x5'))(_0xe879('0x6'));var config=require(_0xe879('0x7'));var jayson=require(_0xe879('0x8'));var client=jayson[_0xe879('0x9')][_0xe879('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x472c38,_0x21bce7,_0x2c9902){return new BPromise(function(_0x1f509a,_0x3638ba){return client[_0xe879('0xb')](_0x472c38,_0x2c9902)[_0xe879('0xc')](function(_0x344210){logger[_0xe879('0xd')](_0xe879('0xe'),_0x21bce7,_0xe879('0xf'));logger[_0xe879('0x10')](_0xe879('0x11'),_0x21bce7,_0xe879('0xf'),JSON[_0xe879('0x12')](_0x344210));if(_0x344210[_0xe879('0x13')]){if(_0x344210[_0xe879('0x13')][_0xe879('0x14')]===0x1f4){logger[_0xe879('0x13')]('ServicenowField,\x20%s,\x20%s',_0x21bce7,_0x344210['error'][_0xe879('0x15')]);return _0x3638ba(_0x344210[_0xe879('0x13')][_0xe879('0x15')]);}logger[_0xe879('0x13')]('ServicenowField,\x20%s,\x20%s',_0x21bce7,_0x344210['error'][_0xe879('0x15')]);return _0x1f509a(_0x344210['error'][_0xe879('0x15')]);}else{logger[_0xe879('0xd')](_0xe879('0xe'),_0x21bce7,_0xe879('0xf'));_0x1f509a(_0x344210[_0xe879('0x16')]['message']);}})[_0xe879('0x17')](function(_0x7713e4){logger[_0xe879('0x13')](_0xe879('0xe'),_0x21bce7,_0x7713e4);_0x3638ba(_0x7713e4);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index c19947f..0f5f142 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 _0x9e58=['../../components/interaction/service','./intSugarcrmAccount.controller','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4feb6d,_0x29a455){var _0x389a8c=function(_0x492bf9){while(--_0x492bf9){_0x4feb6d['push'](_0x4feb6d['shift']());}};_0x389a8c(++_0x29a455);}(_0x9e58,0x100));var _0x89e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9e58[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x89e5('0x0'));var util=require(_0x89e5('0x1'));var path=require(_0x89e5('0x2'));var timeout=require(_0x89e5('0x3'));var express=require(_0x89e5('0x4'));var router=express[_0x89e5('0x5')]();var fs_extra=require(_0x89e5('0x6'));var auth=require(_0x89e5('0x7'));var interaction=require(_0x89e5('0x8'));var config=require('../../config/environment');var controller=require(_0x89e5('0x9'));router['get']('/',auth[_0x89e5('0xa')](),controller[_0x89e5('0xb')]);router[_0x89e5('0xc')](_0x89e5('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x89e5('0xc')](_0x89e5('0xe'),auth['isAuthenticated'](),controller[_0x89e5('0xf')]);router[_0x89e5('0xc')](_0x89e5('0x10'),auth[_0x89e5('0xa')](),controller[_0x89e5('0x11')]);router['post']('/',auth[_0x89e5('0xa')](),controller[_0x89e5('0x12')]);router['post'](_0x89e5('0xe'),auth[_0x89e5('0xa')](),controller[_0x89e5('0x13')]);router[_0x89e5('0x14')]('/:id',auth[_0x89e5('0xa')](),controller['update']);router[_0x89e5('0x15')](_0x89e5('0xd'),auth[_0x89e5('0xa')](),controller[_0x89e5('0x16')]);module[_0x89e5('0x17')]=router; \ No newline at end of file +var _0xe860=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','/:id','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','show'];(function(_0x4872ad,_0x5c8968){var _0x3ef263=function(_0x146c08){while(--_0x146c08){_0x4872ad['push'](_0x4872ad['shift']());}};_0x3ef263(++_0x5c8968);}(_0xe860,0x15b));var _0x0e86=function(_0x4fd57e,_0x154b79){_0x4fd57e=_0x4fd57e-0x0;var _0x782aa7=_0xe860[_0x4fd57e];return _0x782aa7;};'use strict';var multer=require(_0x0e86('0x0'));var util=require(_0x0e86('0x1'));var path=require('path');var timeout=require(_0x0e86('0x2'));var express=require('express');var router=express[_0x0e86('0x3')]();var fs_extra=require(_0x0e86('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0e86('0x5'));var controller=require('./intSugarcrmAccount.controller');router[_0x0e86('0x6')]('/',auth[_0x0e86('0x7')](),controller[_0x0e86('0x8')]);router['get']('/:id',auth[_0x0e86('0x7')](),controller[_0x0e86('0x9')]);router[_0x0e86('0x6')](_0x0e86('0xa'),auth[_0x0e86('0x7')](),controller[_0x0e86('0xb')]);router[_0x0e86('0x6')](_0x0e86('0xc'),auth['isAuthenticated'](),controller[_0x0e86('0xd')]);router[_0x0e86('0xe')]('/',auth[_0x0e86('0x7')](),controller[_0x0e86('0xf')]);router[_0x0e86('0xe')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x0e86('0x10')](_0x0e86('0x11'),auth[_0x0e86('0x7')](),controller[_0x0e86('0x12')]);router[_0x0e86('0x13')]('/:id',auth[_0x0e86('0x7')](),controller['destroy']);module[_0x0e86('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 12a7bd3..d4682c4 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 _0x071b=['sequelize','STRING','username','remoteUri'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x071b,0x184));var _0xb071=function(_0x25bfc2,_0x1a32ae){_0x25bfc2=_0x25bfc2-0x0;var _0x59a986=_0x071b[_0x25bfc2];return _0x59a986;};'use strict';var Sequelize=require(_0xb071('0x0'));module['exports']={'name':{'type':Sequelize[_0xb071('0x1')]},'description':{'type':Sequelize[_0xb071('0x1')]},'username':{'type':Sequelize[_0xb071('0x1')],'unique':_0xb071('0x2')},'password':{'type':Sequelize[_0xb071('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xb071('0x3')},'serverUrl':{'type':Sequelize[_0xb071('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xd50a=['sequelize','STRING','username','remoteUri'];(function(_0x2bb2b7,_0x4f85d2){var _0xab7dea=function(_0x3e9022){while(--_0x3e9022){_0x2bb2b7['push'](_0x2bb2b7['shift']());}};_0xab7dea(++_0x4f85d2);}(_0xd50a,0xd8));var _0xad50=function(_0x17ded1,_0x4efb57){_0x17ded1=_0x17ded1-0x0;var _0x47f0ab=_0xd50a[_0x17ded1];return _0x47f0ab;};'use strict';var Sequelize=require(_0xad50('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xad50('0x1')]},'username':{'type':Sequelize[_0xad50('0x1')],'unique':_0xad50('0x2')},'password':{'type':Sequelize[_0xad50('0x1')]},'remoteUri':{'type':Sequelize[_0xad50('0x1')],'unique':_0xad50('0x3')},'serverUrl':{'type':Sequelize[_0xad50('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 3798dee..0e5f5e0 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 _0xbbae=['label','endsWith','values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','json','count','offset','limit','set','apply','update','then','destroy','end','stack','name','send','map','SugarcrmAccount','rawAttributes','fieldName','type','key','intersection','model','query','fields','attributes','length','hasOwnProperty','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','create','body','params','getConfigurations','SugarcrmConfiguration','order','nolimit','addConfiguration','AccountId','getSubjects','channel','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','findOne','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','get_module_fields','Calls','module_fields','remove','includes'];(function(_0x4baa3e,_0x3f4458){var _0x40de22=function(_0x35e8d8){while(--_0x35e8d8){_0x4baa3e['push'](_0x4baa3e['shift']());}};_0x40de22(++_0x3f4458);}(_0xbbae,0x8c));var _0xebba=function(_0x302f85,_0x5bcca3){_0x302f85=_0x302f85-0x0;var _0x5ef7cb=_0xbbae[_0x302f85];return _0x5ef7cb;};'use strict';var pdf=require(_0xebba('0x0'));var emlformat=require(_0xebba('0x1'));var rimraf=require(_0xebba('0x2'));var zipdir=require(_0xebba('0x3'));var jsonpatch=require(_0xebba('0x4'));var rp=require(_0xebba('0x5'));var moment=require(_0xebba('0x6'));var BPromise=require(_0xebba('0x7'));var Mustache=require(_0xebba('0x8'));var util=require(_0xebba('0x9'));var path=require(_0xebba('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xebba('0xb'));var fs=require('fs');var fs_extra=require(_0xebba('0xc'));var _=require(_0xebba('0xd'));var squel=require(_0xebba('0xe'));var crypto=require(_0xebba('0xf'));var jsforce=require(_0xebba('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xebba('0x11'));var Papa=require('papaparse');var Redis=require(_0xebba('0x12'));var authService=require(_0xebba('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xebba('0x14'));var hardwareService=require(_0xebba('0x15'));var logger=require(_0xebba('0x16'))(_0xebba('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xebba('0x18'));var db=require(_0xebba('0x19'))['db'];var integrations=require(_0xebba('0x1a'));var jayson=require(_0xebba('0x1b'));var client=jayson[_0xebba('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x324996,_0x440d4e,_0x275562,_0x1af9bc){return new BPromise(function(_0x438692,_0x5eafa1){var _0x3b8f22=_0x1af9bc||client;return _0x3b8f22['request'](_0x324996,_0x275562)['then'](function(_0x21db2d){logger[_0xebba('0x1d')](_0xebba('0x1e'),_0x440d4e,_0xebba('0x1f'));logger[_0xebba('0x20')](_0xebba('0x21'),_0x440d4e,_0xebba('0x1f'),JSON['stringify'](_0x21db2d));if(_0x21db2d[_0xebba('0x22')]){if(_0x21db2d[_0xebba('0x22')][_0xebba('0x23')]===0x1f4){logger[_0xebba('0x22')]('SugarcrmAccount,\x20%s,\x20%s',_0x440d4e,_0x21db2d[_0xebba('0x22')]['message']);return _0x5eafa1(_0x21db2d['error'][_0xebba('0x24')]);}logger[_0xebba('0x22')](_0xebba('0x1e'),_0x440d4e,_0x21db2d[_0xebba('0x22')][_0xebba('0x24')]);return _0x438692(_0x21db2d['error'][_0xebba('0x24')]);}else{logger[_0xebba('0x1d')](_0xebba('0x1e'),_0x440d4e,'request\x20sent');_0x438692(_0x21db2d['result']['message']);}})[_0xebba('0x25')](function(_0x5e113c){logger[_0xebba('0x22')]('SugarcrmAccount,\x20%s,\x20%s',_0x440d4e,_0x5e113c);_0x5eafa1(_0x5e113c);});});}function respondWithStatusCode(_0x491327,_0x5ddee8){_0x5ddee8=_0x5ddee8||0xcc;return function(_0x139600){if(_0x139600){return _0x491327[_0xebba('0x26')](_0x5ddee8);}return _0x491327[_0xebba('0x27')](_0x5ddee8)['end']();};}function respondWithResult(_0x1d1726,_0x1fbef3){_0x1fbef3=_0x1fbef3||0xc8;return function(_0x4e2a61){if(_0x4e2a61){return _0x1d1726['status'](_0x1fbef3)[_0xebba('0x28')](_0x4e2a61);}};}function respondWithFilteredResult(_0x174594,_0x4d93ad){return function(_0x2277f1){if(_0x2277f1){var _0x1c2d1b=_0x2277f1[_0xebba('0x29')],_0x23e258=_0x4d93ad[_0xebba('0x2a')],_0x6a6bab=_0x4d93ad[_0xebba('0x2a')]+_0x4d93ad[_0xebba('0x2b')],_0xf84d66;if(_0x6a6bab>=_0x1c2d1b){_0x6a6bab=_0x1c2d1b;_0xf84d66=0xc8;}else{_0xf84d66=0xce;}_0x174594['status'](_0xf84d66);return _0x174594[_0xebba('0x2c')]('Content-Range',_0x23e258+'-'+_0x6a6bab+'/'+_0x1c2d1b)[_0xebba('0x28')](_0x2277f1);}return null;};}function patchUpdates(_0x3c2dbf){return function(_0x544601){try{jsonpatch[_0xebba('0x2d')](_0x544601,_0x3c2dbf,!![]);}catch(_0x2c896c){return BPromise['reject'](_0x2c896c);}return _0x544601['save']();};}function saveUpdates(_0x2eee35,_0x1aaedb){return function(_0x3410c6){if(_0x3410c6){return _0x3410c6[_0xebba('0x2e')](_0x2eee35)[_0xebba('0x2f')](function(_0x5dd59c){return _0x5dd59c;});}return null;};}function removeEntity(_0x5e8d0c,_0x4ae6d3){return function(_0x4405bc){if(_0x4405bc){return _0x4405bc[_0xebba('0x30')]()[_0xebba('0x2f')](function(){_0x5e8d0c[_0xebba('0x27')](0xcc)[_0xebba('0x31')]();});}};}function handleEntityNotFound(_0x4e31d6,_0x2688df){return function(_0x3b7fd2){if(!_0x3b7fd2){_0x4e31d6['sendStatus'](0x194);}return _0x3b7fd2;};}function handleError(_0x22a731,_0x5902f1){_0x5902f1=_0x5902f1||0x1f4;return function(_0x1a920b){logger[_0xebba('0x22')](_0x1a920b[_0xebba('0x32')]);if(_0x1a920b['name']){delete _0x1a920b[_0xebba('0x33')];}_0x22a731[_0xebba('0x27')](_0x5902f1)[_0xebba('0x34')](_0x1a920b);};}exports['index']=function(_0x40719a,_0x28d197){var _0x1873ca={},_0x19a8be={},_0x55caa6={'count':0x0,'rows':[]};var _0x22e37d=_[_0xebba('0x35')](db[_0xebba('0x36')][_0xebba('0x37')],function(_0x501cab){return{'name':_0x501cab[_0xebba('0x38')],'type':_0x501cab[_0xebba('0x39')][_0xebba('0x3a')]};});_0x19a8be['model']=_['map'](_0x22e37d,_0xebba('0x33'));_0x19a8be['query']=_['keys'](_0x40719a['query']);_0x19a8be['filters']=_[_0xebba('0x3b')](_0x19a8be[_0xebba('0x3c')],_0x19a8be[_0xebba('0x3d')]);_0x1873ca['attributes']=_[_0xebba('0x3b')](_0x19a8be[_0xebba('0x3c')],qs[_0xebba('0x3e')](_0x40719a[_0xebba('0x3d')][_0xebba('0x3e')]));_0x1873ca[_0xebba('0x3f')]=_0x1873ca[_0xebba('0x3f')][_0xebba('0x40')]?_0x1873ca[_0xebba('0x3f')]:_0x19a8be['model'];if(!_0x40719a['query'][_0xebba('0x41')]('nolimit')){_0x1873ca[_0xebba('0x2b')]=qs[_0xebba('0x2b')](_0x40719a['query'][_0xebba('0x2b')]);_0x1873ca['offset']=qs[_0xebba('0x2a')](_0x40719a[_0xebba('0x3d')][_0xebba('0x2a')]);}_0x1873ca['order']=qs[_0xebba('0x42')](_0x40719a[_0xebba('0x3d')]['sort']);_0x1873ca['where']=qs[_0xebba('0x43')](_[_0xebba('0x44')](_0x40719a[_0xebba('0x3d')],_0x19a8be['filters']),_0x22e37d);if(_0x40719a[_0xebba('0x3d')][_0xebba('0x45')]){_0x1873ca[_0xebba('0x46')]=_[_0xebba('0x47')](_0x1873ca[_0xebba('0x46')],{'$or':_['map'](_0x22e37d,function(_0x29c1c6){if(_0x29c1c6[_0xebba('0x39')]!==_0xebba('0x48')){var _0x532cd8={};_0x532cd8[_0x29c1c6['name']]={'$like':'%'+_0x40719a[_0xebba('0x3d')][_0xebba('0x45')]+'%'};return _0x532cd8;}})});}_0x1873ca=_['merge']({},_0x1873ca,_0x40719a[_0xebba('0x49')]);var _0x447a3d={'where':_0x1873ca[_0xebba('0x46')]};return db[_0xebba('0x36')][_0xebba('0x29')](_0x447a3d)[_0xebba('0x2f')](function(_0x1478d6){_0x55caa6[_0xebba('0x29')]=_0x1478d6;if(_0x40719a[_0xebba('0x3d')][_0xebba('0x4a')]){_0x1873ca[_0xebba('0x4b')]=[{'all':!![]}];}return db[_0xebba('0x36')][_0xebba('0x4c')](_0x1873ca);})[_0xebba('0x2f')](function(_0x3a3f8b){_0x55caa6[_0xebba('0x4d')]=_0x3a3f8b;return _0x55caa6;})[_0xebba('0x2f')](respondWithFilteredResult(_0x28d197,_0x1873ca))[_0xebba('0x25')](handleError(_0x28d197,null));};exports[_0xebba('0x4e')]=function(_0x416fa3,_0x10a5e9){var _0x5d3bc7={'raw':![],'where':{'id':_0x416fa3['params']['id']}},_0x1f0304={};_0x1f0304[_0xebba('0x3c')]=_['keys'](db[_0xebba('0x36')][_0xebba('0x37')]);_0x1f0304[_0xebba('0x3d')]=_[_0xebba('0x4f')](_0x416fa3[_0xebba('0x3d')]);_0x1f0304[_0xebba('0x43')]=_[_0xebba('0x3b')](_0x1f0304['model'],_0x1f0304[_0xebba('0x3d')]);_0x5d3bc7[_0xebba('0x3f')]=_[_0xebba('0x3b')](_0x1f0304[_0xebba('0x3c')],qs[_0xebba('0x3e')](_0x416fa3['query'][_0xebba('0x3e')]));_0x5d3bc7['attributes']=_0x5d3bc7[_0xebba('0x3f')][_0xebba('0x40')]?_0x5d3bc7[_0xebba('0x3f')]:_0x1f0304[_0xebba('0x3c')];if(_0x416fa3[_0xebba('0x3d')][_0xebba('0x4a')]){_0x5d3bc7[_0xebba('0x4b')]=[{'all':!![]}];}_0x5d3bc7=_[_0xebba('0x47')]({},_0x5d3bc7,_0x416fa3['options']);return db['SugarcrmAccount'][_0xebba('0x50')](_0x5d3bc7)[_0xebba('0x2f')](handleEntityNotFound(_0x10a5e9,null))['then'](respondWithResult(_0x10a5e9,null))[_0xebba('0x25')](handleError(_0x10a5e9,null));};exports['create']=function(_0x16c98f,_0x4ff61c){return db[_0xebba('0x36')][_0xebba('0x51')](_0x16c98f[_0xebba('0x52')],{})[_0xebba('0x2f')](respondWithResult(_0x4ff61c,0xc9))['catch'](handleError(_0x4ff61c,null));};exports[_0xebba('0x2e')]=function(_0x67c9ac,_0x548cd7){if(_0x67c9ac['body']['id']){delete _0x67c9ac[_0xebba('0x52')]['id'];}return db['SugarcrmAccount'][_0xebba('0x50')]({'where':{'id':_0x67c9ac['params']['id']}})[_0xebba('0x2f')](handleEntityNotFound(_0x548cd7,null))[_0xebba('0x2f')](saveUpdates(_0x67c9ac[_0xebba('0x52')],null))[_0xebba('0x2f')](respondWithResult(_0x548cd7,null))[_0xebba('0x25')](handleError(_0x548cd7,null));};exports[_0xebba('0x30')]=function(_0x1be171,_0x4a8781){return db[_0xebba('0x36')]['find']({'where':{'id':_0x1be171[_0xebba('0x53')]['id']}})['then'](handleEntityNotFound(_0x4a8781,null))[_0xebba('0x2f')](removeEntity(_0x4a8781,null))[_0xebba('0x25')](handleError(_0x4a8781,null));};exports[_0xebba('0x54')]=function(_0x36229a,_0xfa4e3e,_0x43a64b){var _0x1997e8={};var _0x2dc3c5={};var _0x437274;var _0x1c27a6;return db[_0xebba('0x36')]['findOne']({'where':{'id':_0x36229a[_0xebba('0x53')]['id']}})[_0xebba('0x2f')](handleEntityNotFound(_0xfa4e3e,null))['then'](function(_0x3dddcc){if(_0x3dddcc){_0x437274=_0x3dddcc;_0x2dc3c5['model']=_[_0xebba('0x4f')](db[_0xebba('0x55')][_0xebba('0x37')]);_0x2dc3c5[_0xebba('0x3d')]=_[_0xebba('0x4f')](_0x36229a['query']);_0x2dc3c5[_0xebba('0x43')]=_[_0xebba('0x3b')](_0x2dc3c5['model'],_0x2dc3c5[_0xebba('0x3d')]);_0x1997e8['attributes']=_[_0xebba('0x3b')](_0x2dc3c5[_0xebba('0x3c')],qs['fields'](_0x36229a[_0xebba('0x3d')][_0xebba('0x3e')]));_0x1997e8[_0xebba('0x3f')]=_0x1997e8[_0xebba('0x3f')][_0xebba('0x40')]?_0x1997e8[_0xebba('0x3f')]:_0x2dc3c5['model'];_0x1997e8[_0xebba('0x56')]=qs['sort'](_0x36229a['query'][_0xebba('0x42')]);_0x1997e8['where']=qs[_0xebba('0x43')](_[_0xebba('0x44')](_0x36229a[_0xebba('0x3d')],_0x2dc3c5['filters']));if(_0x36229a[_0xebba('0x3d')]['filter']){_0x1997e8[_0xebba('0x46')]=_[_0xebba('0x47')](_0x1997e8['where'],{'$or':_[_0xebba('0x35')](_0x1997e8['attributes'],function(_0x27fea7){var _0x2dc195={};_0x2dc195[_0x27fea7]={'$like':'%'+_0x36229a[_0xebba('0x3d')][_0xebba('0x45')]+'%'};return _0x2dc195;})});}_0x1997e8=_[_0xebba('0x47')]({},_0x1997e8,_0x36229a[_0xebba('0x49')]);return _0x437274[_0xebba('0x54')](_0x1997e8);}})[_0xebba('0x2f')](function(_0x3c397b){if(_0x3c397b){_0x1c27a6=_0x3c397b[_0xebba('0x40')];if(!_0x36229a[_0xebba('0x3d')]['hasOwnProperty'](_0xebba('0x57'))){_0x1997e8[_0xebba('0x2b')]=qs[_0xebba('0x2b')](_0x36229a[_0xebba('0x3d')][_0xebba('0x2b')]);_0x1997e8[_0xebba('0x2a')]=qs['offset'](_0x36229a[_0xebba('0x3d')][_0xebba('0x2a')]);}return _0x437274[_0xebba('0x54')](_0x1997e8);}})[_0xebba('0x2f')](function(_0x5b7154){if(_0x5b7154){return _0x5b7154?{'count':_0x1c27a6,'rows':_0x5b7154}:null;}})[_0xebba('0x2f')](respondWithResult(_0xfa4e3e,null))[_0xebba('0x25')](handleError(_0xfa4e3e,null));};exports[_0xebba('0x58')]=function(_0x56c50d,_0x4ad22e,_0x1a9380){if(_0x56c50d['body']['id']){delete _0x56c50d['body']['id'];}return db[_0xebba('0x36')]['findOne']({'where':{'id':_0x56c50d['params']['id']}})['then'](handleEntityNotFound(_0x4ad22e,null))[_0xebba('0x2f')](function(_0x2452b8){if(_0x2452b8){_0x56c50d[_0xebba('0x52')][_0xebba('0x59')]=_0x2452b8['id'];_0x56c50d[_0xebba('0x52')]['Subjects']=integrations[_0xebba('0x5a')](_0x56c50d['body'][_0xebba('0x5b')],_0x56c50d['body'][_0xebba('0x39')]);_0x56c50d[_0xebba('0x52')]['Descriptions']=integrations[_0xebba('0x5c')](_0x56c50d[_0xebba('0x52')][_0xebba('0x5b')],_0x56c50d['body'][_0xebba('0x39')]);return db[_0xebba('0x55')][_0xebba('0x51')](_0x56c50d[_0xebba('0x52')],{'include':[{'model':db[_0xebba('0x5d')],'as':'Subjects'},{'model':db[_0xebba('0x5d')],'as':'Descriptions'}]});}return null;})[_0xebba('0x2f')](respondWithResult(_0x4ad22e,null))[_0xebba('0x25')](handleError(_0x4ad22e,null));};exports[_0xebba('0x5e')]=function(_0x454a15,_0x171e8d,_0x348883){var _0x296316='';var _0x267935=['id',_0xebba('0x33'),_0xebba('0x5f'),_0xebba('0x60'),_0xebba('0x61'),_0xebba('0x62'),_0xebba('0x63'),_0xebba('0x64'),_0xebba('0x65'),_0xebba('0x66'),_0xebba('0x67'),'direction'];return db[_0xebba('0x36')][_0xebba('0x68')]({'where':{'id':_0x454a15['params']['id']},'attributes':['id','username',_0xebba('0x69'),_0xebba('0x6a')]})[_0xebba('0x2f')](handleEntityNotFound(_0x171e8d,null))[_0xebba('0x2f')](function(_0x2298e1){if(_0x2298e1){_0x296316=_0x2298e1[_0xebba('0x6a')];var _0xaced77=_0x296316[_0xebba('0x6b')](-0x1);if(_0xaced77==='/'){_0x296316=_0x296316[_0xebba('0x6c')](0x0,_0x296316[_0xebba('0x6d')](_0xaced77));}return rp({'method':_0xebba('0x6e'),'uri':util[_0xebba('0x6f')](_0xebba('0x70'),_0x296316,_0xebba('0x71')),'json':!![],'form':{'method':_0xebba('0x72'),'input_type':_0xebba('0x73'),'response_type':_0xebba('0x73'),'rest_data':JSON[_0xebba('0x74')]({'user_auth':{'user_name':_0x2298e1[_0xebba('0x75')],'password':_0x2298e1[_0xebba('0x69')],'encryption':_0xebba('0x76')},'application':_0xebba('0x77')})}});}})[_0xebba('0x2f')](function(_0xe45bd){if(_0xe45bd&&_0xe45bd['name']!=='Invalid\x20Login'&&_0xe45bd[_0xebba('0x33')]!==_0xebba('0x78')){return rp({'method':'POST','uri':util[_0xebba('0x6f')]('%s%s',_0x296316,_0xebba('0x71')),'json':!![],'form':{'method':_0xebba('0x79'),'input_type':_0xebba('0x73'),'response_type':_0xebba('0x73'),'rest_data':JSON[_0xebba('0x74')]({'session':_0xe45bd['id'],'module_name':_0xebba('0x7a')})}})['then'](function(_0x4ea239){if(_0x4ea239){var _0x1c0403=_['values'](_0x4ea239[_0xebba('0x7b')]);_[_0xebba('0x7c')](_0x1c0403,function(_0x3f033a){return _0x267935[_0xebba('0x7d')](_0x3f033a[_0xebba('0x33')]);});return{'count':_0x1c0403[_0xebba('0x40')],'rows':_['map'](_0x1c0403,function(_0x2e463a){return{'id':_0x2e463a[_0xebba('0x33')],'name':_0x2e463a[_0xebba('0x7e')],'custom':_[_0xebba('0x7f')](_0x2e463a['name'],'_c')?!![]:![],'options':_0x2e463a[_0xebba('0x49')]?_[_0xebba('0x35')](_[_0xebba('0x80')](_0x2e463a[_0xebba('0x49')]),function(_0x2bdef8){return{'name':_0x2bdef8['value'],'value':_0x2bdef8['name']};}):[]};})};}})[_0xebba('0x2f')](respondWithResult(_0x171e8d,null))['catch'](function(_0x3aabb1){var _0x57fe31=_0x454a15['query'][_0xebba('0x81')]?0x1f4:_0x3aabb1[_0xebba('0x82')]||0x1f4;logger['error'](_0xebba('0x83'),_0xebba('0x5e'),_0x57fe31,JSON[_0xebba('0x74')](_0x3aabb1));delete _0x3aabb1[_0xebba('0x33')];if(_0x57fe31===0x191){_0x57fe31=0x190;}_0x171e8d[_0xebba('0x27')](_0x57fe31)[_0xebba('0x34')](_0x454a15['query'][_0xebba('0x81')]?{'message':_0xebba('0x84'),'statusCode':_0x3aabb1[_0xebba('0x82')]}:_0x3aabb1);});}else{var _0x379803=0x1f4;_0x171e8d[_0xebba('0x27')](_0x379803)[_0xebba('0x34')]({'message':_0xebba('0x84'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xde3d=['moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','end','status','json','offset','limit','set','reject','save','update','sendStatus','stack','name','index','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','SugarcrmAccount','count','includeAll','include','findAll','rows','params','keys','rawAttributes','find','create','body','destroy','findOne','SugarcrmConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','username','remoteUri','substring','lastIndexOf','POST','format','JSON','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','Calls','remove','includes','endsWith','values','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xde3d,0xff));var _0xdde3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xde3d[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xdde3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdde3('0x1'));var zipdir=require(_0xdde3('0x2'));var jsonpatch=require(_0xdde3('0x3'));var rp=require(_0xdde3('0x4'));var moment=require(_0xdde3('0x5'));var BPromise=require(_0xdde3('0x6'));var Mustache=require(_0xdde3('0x7'));var util=require(_0xdde3('0x8'));var path=require('path');var sox=require(_0xdde3('0x9'));var csv=require(_0xdde3('0xa'));var ejs=require(_0xdde3('0xb'));var fs=require('fs');var fs_extra=require(_0xdde3('0xc'));var _=require(_0xdde3('0xd'));var squel=require(_0xdde3('0xe'));var crypto=require(_0xdde3('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdde3('0xa'));var querystring=require(_0xdde3('0x10'));var Papa=require('papaparse');var Redis=require(_0xdde3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdde3('0x12'));var as=require(_0xdde3('0x13'));var hardwareService=require(_0xdde3('0x14'));var logger=require(_0xdde3('0x15'))(_0xdde3('0x16'));var utils=require(_0xdde3('0x17'));var config=require(_0xdde3('0x18'));var licenseUtil=require(_0xdde3('0x19'));var db=require(_0xdde3('0x1a'))['db'];var integrations=require(_0xdde3('0x1b'));var jayson=require(_0xdde3('0x1c'));var client=jayson[_0xdde3('0x1d')][_0xdde3('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x16c31d,_0x1b3e2b,_0x5ba8c9,_0x2837a1){return new BPromise(function(_0x15e785,_0x76b5d1){var _0x1c2034=_0x2837a1||client;return _0x1c2034['request'](_0x16c31d,_0x5ba8c9)[_0xdde3('0x1f')](function(_0x4d6d6a){logger['info'](_0xdde3('0x20'),_0x1b3e2b,'request\x20sent');logger[_0xdde3('0x21')](_0xdde3('0x22'),_0x1b3e2b,_0xdde3('0x23'),JSON[_0xdde3('0x24')](_0x4d6d6a));if(_0x4d6d6a[_0xdde3('0x25')]){if(_0x4d6d6a[_0xdde3('0x25')][_0xdde3('0x26')]===0x1f4){logger[_0xdde3('0x25')](_0xdde3('0x20'),_0x1b3e2b,_0x4d6d6a[_0xdde3('0x25')][_0xdde3('0x27')]);return _0x76b5d1(_0x4d6d6a[_0xdde3('0x25')][_0xdde3('0x27')]);}logger[_0xdde3('0x25')](_0xdde3('0x20'),_0x1b3e2b,_0x4d6d6a[_0xdde3('0x25')][_0xdde3('0x27')]);return _0x15e785(_0x4d6d6a[_0xdde3('0x25')][_0xdde3('0x27')]);}else{logger['info'](_0xdde3('0x20'),_0x1b3e2b,_0xdde3('0x23'));_0x15e785(_0x4d6d6a[_0xdde3('0x28')]['message']);}})[_0xdde3('0x29')](function(_0x194408){logger[_0xdde3('0x25')](_0xdde3('0x20'),_0x1b3e2b,_0x194408);_0x76b5d1(_0x194408);});});}function respondWithStatusCode(_0xb6c105,_0x3db29c){_0x3db29c=_0x3db29c||0xcc;return function(_0x3b701d){if(_0x3b701d){return _0xb6c105['sendStatus'](_0x3db29c);}return _0xb6c105['status'](_0x3db29c)[_0xdde3('0x2a')]();};}function respondWithResult(_0x2e1ad5,_0x4714cd){_0x4714cd=_0x4714cd||0xc8;return function(_0x186861){if(_0x186861){return _0x2e1ad5[_0xdde3('0x2b')](_0x4714cd)[_0xdde3('0x2c')](_0x186861);}};}function respondWithFilteredResult(_0x24b729,_0x28af6c){return function(_0x34c12b){if(_0x34c12b){var _0x34d739=_0x34c12b['count'],_0x1abedf=_0x28af6c[_0xdde3('0x2d')],_0x33504d=_0x28af6c[_0xdde3('0x2d')]+_0x28af6c[_0xdde3('0x2e')],_0x21ce23;if(_0x33504d>=_0x34d739){_0x33504d=_0x34d739;_0x21ce23=0xc8;}else{_0x21ce23=0xce;}_0x24b729[_0xdde3('0x2b')](_0x21ce23);return _0x24b729[_0xdde3('0x2f')]('Content-Range',_0x1abedf+'-'+_0x33504d+'/'+_0x34d739)['json'](_0x34c12b);}return null;};}function patchUpdates(_0x480008){return function(_0x346a2c){try{jsonpatch['apply'](_0x346a2c,_0x480008,!![]);}catch(_0x5a025b){return BPromise[_0xdde3('0x30')](_0x5a025b);}return _0x346a2c[_0xdde3('0x31')]();};}function saveUpdates(_0x58970b,_0x481f98){return function(_0x40385f){if(_0x40385f){return _0x40385f[_0xdde3('0x32')](_0x58970b)[_0xdde3('0x1f')](function(_0x36f410){return _0x36f410;});}return null;};}function removeEntity(_0x10ed0e,_0x5655da){return function(_0x5ed821){if(_0x5ed821){return _0x5ed821['destroy']()['then'](function(){_0x10ed0e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cec66,_0xf6822){return function(_0x382e1a){if(!_0x382e1a){_0x1cec66[_0xdde3('0x33')](0x194);}return _0x382e1a;};}function handleError(_0x107d40,_0x82bba8){_0x82bba8=_0x82bba8||0x1f4;return function(_0x37b00a){logger[_0xdde3('0x25')](_0x37b00a[_0xdde3('0x34')]);if(_0x37b00a[_0xdde3('0x35')]){delete _0x37b00a[_0xdde3('0x35')];}_0x107d40[_0xdde3('0x2b')](_0x82bba8)['send'](_0x37b00a);};}exports[_0xdde3('0x36')]=function(_0x58fc19,_0x92b65e){var _0x107757={},_0x23742b={},_0x189c13={'count':0x0,'rows':[]};var _0x21473b=_['map'](db['SugarcrmAccount']['rawAttributes'],function(_0x4dc5f1){return{'name':_0x4dc5f1['fieldName'],'type':_0x4dc5f1[_0xdde3('0x37')][_0xdde3('0x38')]};});_0x23742b[_0xdde3('0x39')]=_['map'](_0x21473b,'name');_0x23742b[_0xdde3('0x3a')]=_['keys'](_0x58fc19[_0xdde3('0x3a')]);_0x23742b[_0xdde3('0x3b')]=_[_0xdde3('0x3c')](_0x23742b[_0xdde3('0x39')],_0x23742b[_0xdde3('0x3a')]);_0x107757[_0xdde3('0x3d')]=_[_0xdde3('0x3c')](_0x23742b['model'],qs[_0xdde3('0x3e')](_0x58fc19[_0xdde3('0x3a')][_0xdde3('0x3e')]));_0x107757[_0xdde3('0x3d')]=_0x107757[_0xdde3('0x3d')][_0xdde3('0x3f')]?_0x107757[_0xdde3('0x3d')]:_0x23742b[_0xdde3('0x39')];if(!_0x58fc19['query']['hasOwnProperty'](_0xdde3('0x40'))){_0x107757[_0xdde3('0x2e')]=qs[_0xdde3('0x2e')](_0x58fc19[_0xdde3('0x3a')][_0xdde3('0x2e')]);_0x107757[_0xdde3('0x2d')]=qs[_0xdde3('0x2d')](_0x58fc19[_0xdde3('0x3a')][_0xdde3('0x2d')]);}_0x107757[_0xdde3('0x41')]=qs[_0xdde3('0x42')](_0x58fc19[_0xdde3('0x3a')]['sort']);_0x107757[_0xdde3('0x43')]=qs[_0xdde3('0x3b')](_[_0xdde3('0x44')](_0x58fc19[_0xdde3('0x3a')],_0x23742b[_0xdde3('0x3b')]),_0x21473b);if(_0x58fc19['query'][_0xdde3('0x45')]){_0x107757[_0xdde3('0x43')]=_[_0xdde3('0x46')](_0x107757['where'],{'$or':_[_0xdde3('0x47')](_0x21473b,function(_0x4748e0){if(_0x4748e0['type']!==_0xdde3('0x48')){var _0x4360d2={};_0x4360d2[_0x4748e0['name']]={'$like':'%'+_0x58fc19[_0xdde3('0x3a')][_0xdde3('0x45')]+'%'};return _0x4360d2;}})});}_0x107757=_[_0xdde3('0x46')]({},_0x107757,_0x58fc19[_0xdde3('0x49')]);var _0x13bee7={'where':_0x107757[_0xdde3('0x43')]};return db[_0xdde3('0x4a')][_0xdde3('0x4b')](_0x13bee7)[_0xdde3('0x1f')](function(_0x477d83){_0x189c13['count']=_0x477d83;if(_0x58fc19[_0xdde3('0x3a')][_0xdde3('0x4c')]){_0x107757[_0xdde3('0x4d')]=[{'all':!![]}];}return db[_0xdde3('0x4a')][_0xdde3('0x4e')](_0x107757);})[_0xdde3('0x1f')](function(_0x447b52){_0x189c13[_0xdde3('0x4f')]=_0x447b52;return _0x189c13;})[_0xdde3('0x1f')](respondWithFilteredResult(_0x92b65e,_0x107757))[_0xdde3('0x29')](handleError(_0x92b65e,null));};exports['show']=function(_0x47988d,_0x60e140){var _0x2ef551={'raw':![],'where':{'id':_0x47988d[_0xdde3('0x50')]['id']}},_0x178090={};_0x178090['model']=_[_0xdde3('0x51')](db[_0xdde3('0x4a')][_0xdde3('0x52')]);_0x178090[_0xdde3('0x3a')]=_[_0xdde3('0x51')](_0x47988d[_0xdde3('0x3a')]);_0x178090[_0xdde3('0x3b')]=_[_0xdde3('0x3c')](_0x178090[_0xdde3('0x39')],_0x178090[_0xdde3('0x3a')]);_0x2ef551[_0xdde3('0x3d')]=_[_0xdde3('0x3c')](_0x178090[_0xdde3('0x39')],qs[_0xdde3('0x3e')](_0x47988d[_0xdde3('0x3a')][_0xdde3('0x3e')]));_0x2ef551[_0xdde3('0x3d')]=_0x2ef551[_0xdde3('0x3d')][_0xdde3('0x3f')]?_0x2ef551['attributes']:_0x178090['model'];if(_0x47988d['query'][_0xdde3('0x4c')]){_0x2ef551['include']=[{'all':!![]}];}_0x2ef551=_[_0xdde3('0x46')]({},_0x2ef551,_0x47988d['options']);return db[_0xdde3('0x4a')][_0xdde3('0x53')](_0x2ef551)[_0xdde3('0x1f')](handleEntityNotFound(_0x60e140,null))[_0xdde3('0x1f')](respondWithResult(_0x60e140,null))['catch'](handleError(_0x60e140,null));};exports[_0xdde3('0x54')]=function(_0x1e6e90,_0x3a78c5){return db[_0xdde3('0x4a')][_0xdde3('0x54')](_0x1e6e90[_0xdde3('0x55')],{})['then'](respondWithResult(_0x3a78c5,0xc9))['catch'](handleError(_0x3a78c5,null));};exports['update']=function(_0xb7695a,_0x13047f){if(_0xb7695a['body']['id']){delete _0xb7695a[_0xdde3('0x55')]['id'];}return db['SugarcrmAccount'][_0xdde3('0x53')]({'where':{'id':_0xb7695a['params']['id']}})['then'](handleEntityNotFound(_0x13047f,null))[_0xdde3('0x1f')](saveUpdates(_0xb7695a[_0xdde3('0x55')],null))[_0xdde3('0x1f')](respondWithResult(_0x13047f,null))['catch'](handleError(_0x13047f,null));};exports[_0xdde3('0x56')]=function(_0x59fe2e,_0x43ba9f){return db['SugarcrmAccount'][_0xdde3('0x53')]({'where':{'id':_0x59fe2e[_0xdde3('0x50')]['id']}})[_0xdde3('0x1f')](handleEntityNotFound(_0x43ba9f,null))[_0xdde3('0x1f')](removeEntity(_0x43ba9f,null))[_0xdde3('0x29')](handleError(_0x43ba9f,null));};exports['getConfigurations']=function(_0x440624,_0xad0890,_0x7e6645){var _0x5144d8={};var _0x5e93d1={};var _0x2e1aea;var _0x2a9516;return db['SugarcrmAccount'][_0xdde3('0x57')]({'where':{'id':_0x440624[_0xdde3('0x50')]['id']}})[_0xdde3('0x1f')](handleEntityNotFound(_0xad0890,null))[_0xdde3('0x1f')](function(_0x7cc94b){if(_0x7cc94b){_0x2e1aea=_0x7cc94b;_0x5e93d1[_0xdde3('0x39')]=_[_0xdde3('0x51')](db[_0xdde3('0x58')]['rawAttributes']);_0x5e93d1['query']=_[_0xdde3('0x51')](_0x440624['query']);_0x5e93d1[_0xdde3('0x3b')]=_['intersection'](_0x5e93d1[_0xdde3('0x39')],_0x5e93d1['query']);_0x5144d8[_0xdde3('0x3d')]=_['intersection'](_0x5e93d1[_0xdde3('0x39')],qs[_0xdde3('0x3e')](_0x440624[_0xdde3('0x3a')][_0xdde3('0x3e')]));_0x5144d8[_0xdde3('0x3d')]=_0x5144d8[_0xdde3('0x3d')][_0xdde3('0x3f')]?_0x5144d8[_0xdde3('0x3d')]:_0x5e93d1[_0xdde3('0x39')];_0x5144d8[_0xdde3('0x41')]=qs['sort'](_0x440624['query'][_0xdde3('0x42')]);_0x5144d8[_0xdde3('0x43')]=qs[_0xdde3('0x3b')](_[_0xdde3('0x44')](_0x440624['query'],_0x5e93d1[_0xdde3('0x3b')]));if(_0x440624[_0xdde3('0x3a')][_0xdde3('0x45')]){_0x5144d8[_0xdde3('0x43')]=_[_0xdde3('0x46')](_0x5144d8['where'],{'$or':_[_0xdde3('0x47')](_0x5144d8[_0xdde3('0x3d')],function(_0x804c6b){var _0xa24d70={};_0xa24d70[_0x804c6b]={'$like':'%'+_0x440624[_0xdde3('0x3a')]['filter']+'%'};return _0xa24d70;})});}_0x5144d8=_['merge']({},_0x5144d8,_0x440624['options']);return _0x2e1aea['getConfigurations'](_0x5144d8);}})[_0xdde3('0x1f')](function(_0x3aef5e){if(_0x3aef5e){_0x2a9516=_0x3aef5e[_0xdde3('0x3f')];if(!_0x440624[_0xdde3('0x3a')]['hasOwnProperty'](_0xdde3('0x40'))){_0x5144d8[_0xdde3('0x2e')]=qs[_0xdde3('0x2e')](_0x440624[_0xdde3('0x3a')][_0xdde3('0x2e')]);_0x5144d8[_0xdde3('0x2d')]=qs['offset'](_0x440624['query']['offset']);}return _0x2e1aea[_0xdde3('0x59')](_0x5144d8);}})['then'](function(_0x27babd){if(_0x27babd){return _0x27babd?{'count':_0x2a9516,'rows':_0x27babd}:null;}})[_0xdde3('0x1f')](respondWithResult(_0xad0890,null))[_0xdde3('0x29')](handleError(_0xad0890,null));};exports[_0xdde3('0x5a')]=function(_0x517eda,_0x425e02,_0x11b7c0){if(_0x517eda[_0xdde3('0x55')]['id']){delete _0x517eda['body']['id'];}return db[_0xdde3('0x4a')][_0xdde3('0x57')]({'where':{'id':_0x517eda[_0xdde3('0x50')]['id']}})[_0xdde3('0x1f')](handleEntityNotFound(_0x425e02,null))[_0xdde3('0x1f')](function(_0x317841){if(_0x317841){_0x517eda[_0xdde3('0x55')][_0xdde3('0x5b')]=_0x317841['id'];_0x517eda[_0xdde3('0x55')][_0xdde3('0x5c')]=integrations['getSubjects'](_0x517eda[_0xdde3('0x55')][_0xdde3('0x5d')],_0x517eda['body'][_0xdde3('0x37')]);_0x517eda['body'][_0xdde3('0x5e')]=integrations[_0xdde3('0x5f')](_0x517eda[_0xdde3('0x55')][_0xdde3('0x5d')],_0x517eda[_0xdde3('0x55')][_0xdde3('0x37')]);return db[_0xdde3('0x58')][_0xdde3('0x54')](_0x517eda[_0xdde3('0x55')],{'include':[{'model':db[_0xdde3('0x60')],'as':_0xdde3('0x5c')},{'model':db['SugarcrmField'],'as':_0xdde3('0x5e')}]});}return null;})[_0xdde3('0x1f')](respondWithResult(_0x425e02,null))[_0xdde3('0x29')](handleError(_0x425e02,null));};exports[_0xdde3('0x61')]=function(_0x220ee7,_0x2c8d68,_0x50bf1e){var _0x1cdec='';var _0x3c05af=['id',_0xdde3('0x35'),_0xdde3('0x62'),_0xdde3('0x63'),_0xdde3('0x64'),_0xdde3('0x65'),_0xdde3('0x66'),_0xdde3('0x67'),_0xdde3('0x68'),'parent_type','parent_name','direction'];return db[_0xdde3('0x4a')]['findOne']({'where':{'id':_0x220ee7['params']['id']},'attributes':['id',_0xdde3('0x69'),'password','remoteUri']})[_0xdde3('0x1f')](handleEntityNotFound(_0x2c8d68,null))[_0xdde3('0x1f')](function(_0x217063){if(_0x217063){_0x1cdec=_0x217063[_0xdde3('0x6a')];var _0x59a4d9=_0x1cdec['slice'](-0x1);if(_0x59a4d9==='/'){_0x1cdec=_0x1cdec[_0xdde3('0x6b')](0x0,_0x1cdec[_0xdde3('0x6c')](_0x59a4d9));}return rp({'method':_0xdde3('0x6d'),'uri':util[_0xdde3('0x6e')]('%s%s',_0x1cdec,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0xdde3('0x6f'),'response_type':_0xdde3('0x6f'),'rest_data':JSON[_0xdde3('0x24')]({'user_auth':{'user_name':_0x217063[_0xdde3('0x69')],'password':_0x217063[_0xdde3('0x70')],'encryption':_0xdde3('0x71')},'application':_0xdde3('0x72')})}});}})[_0xdde3('0x1f')](function(_0x3b4de2){if(_0x3b4de2&&_0x3b4de2[_0xdde3('0x35')]!==_0xdde3('0x73')&&_0x3b4de2[_0xdde3('0x35')]!==_0xdde3('0x74')){return rp({'method':'POST','uri':util[_0xdde3('0x6e')]('%s%s',_0x1cdec,_0xdde3('0x75')),'json':!![],'form':{'method':_0xdde3('0x76'),'input_type':_0xdde3('0x6f'),'response_type':_0xdde3('0x6f'),'rest_data':JSON['stringify']({'session':_0x3b4de2['id'],'module_name':_0xdde3('0x77')})}})[_0xdde3('0x1f')](function(_0x399242){if(_0x399242){var _0x5790ac=_['values'](_0x399242['module_fields']);_[_0xdde3('0x78')](_0x5790ac,function(_0xd4b0c6){return _0x3c05af[_0xdde3('0x79')](_0xd4b0c6[_0xdde3('0x35')]);});return{'count':_0x5790ac[_0xdde3('0x3f')],'rows':_[_0xdde3('0x47')](_0x5790ac,function(_0x5c8447){return{'id':_0x5c8447[_0xdde3('0x35')],'name':_0x5c8447['label'],'custom':_[_0xdde3('0x7a')](_0x5c8447['name'],'_c')?!![]:![],'options':_0x5c8447[_0xdde3('0x49')]?_['map'](_[_0xdde3('0x7b')](_0x5c8447['options']),function(_0x343b1e){return{'name':_0x343b1e[_0xdde3('0x7c')],'value':_0x343b1e[_0xdde3('0x35')]};}):[]};})};}})[_0xdde3('0x1f')](respondWithResult(_0x2c8d68,null))[_0xdde3('0x29')](function(_0x14a021){var _0x1f330a=_0x220ee7['query']['test']?0x1f4:_0x14a021[_0xdde3('0x7d')]||0x1f4;logger['error'](_0xdde3('0x7e'),'getFields',_0x1f330a,JSON[_0xdde3('0x24')](_0x14a021));delete _0x14a021[_0xdde3('0x35')];if(_0x1f330a===0x191){_0x1f330a=0x190;}_0x2c8d68[_0xdde3('0x2b')](_0x1f330a)[_0xdde3('0x7f')](_0x220ee7[_0xdde3('0x3a')][_0xdde3('0x80')]?{'message':_0xdde3('0x81'),'statusCode':_0x14a021[_0xdde3('0x7d')]}:_0x14a021);});}else{var _0x2ea828=0x1f4;_0x2c8d68['status'](_0x2ea828)['send']({'message':_0xdde3('0x81'),'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 0ccb323..43529f7 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 _0xce39=['moment','bluebird','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','api'];(function(_0x14a944,_0x44e3d0){var _0x52323a=function(_0x5ca764){while(--_0x5ca764){_0x14a944['push'](_0x14a944['shift']());}};_0x52323a(++_0x44e3d0);}(_0xce39,0x1ec));var _0x9ce3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xce39[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x9ce3('0x0'));var logger=require(_0x9ce3('0x1'))(_0x9ce3('0x2'));var moment=require(_0x9ce3('0x3'));var BPromise=require(_0x9ce3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9ce3('0x5'));var config=require('../../config/environment');var attributes=require(_0x9ce3('0x6'));var integrations=require(_0x9ce3('0x7'));module[_0x9ce3('0x8')]=function(_0x9aae03,_0x4d61c2){return _0x9aae03['define'](_0x9ce3('0x9'),attributes,{'tableName':_0x9ce3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x862b=['../../config/logger','api','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','define','lodash','util'];(function(_0x13af04,_0x34696c){var _0xd04e49=function(_0x3e5475){while(--_0x3e5475){_0x13af04['push'](_0x13af04['shift']());}};_0xd04e49(++_0x34696c);}(_0x862b,0x18a));var _0xb862=function(_0x5759e3,_0x4f1d55){_0x5759e3=_0x5759e3-0x0;var _0x602d3c=_0x862b[_0x5759e3];return _0x602d3c;};'use strict';var _=require(_0xb862('0x0'));var util=require(_0xb862('0x1'));var logger=require(_0xb862('0x2'))(_0xb862('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb862('0x4'));var rimraf=require(_0xb862('0x5'));var config=require(_0xb862('0x6'));var attributes=require(_0xb862('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x46c25c,_0x2874b2){return _0x46c25c[_0xb862('0x8')]('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 00793a0..e209e41 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 _0x37d7=['then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowSugarcrmAccount','find','lodash','moment','bluebird','ioredis','../../config/utils','rpc','client','request'];(function(_0xf32ff0,_0xf23737){var _0xb74b1a=function(_0x49e412){while(--_0x49e412){_0xf32ff0['push'](_0xf32ff0['shift']());}};_0xb74b1a(++_0xf23737);}(_0x37d7,0x1e8));var _0x737d=function(_0xb9cbcd,_0x8df75d){_0xb9cbcd=_0xb9cbcd-0x0;var _0x1a7102=_0x37d7[_0xb9cbcd];return _0x1a7102;};'use strict';var _=require(_0x737d('0x0'));var util=require('util');var moment=require(_0x737d('0x1'));var BPromise=require(_0x737d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x737d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x737d('0x4'));var logger=require('../../config/logger')(_0x737d('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x737d('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a028,_0x3c8490,_0x59956a){return new BPromise(function(_0x164161,_0x28b642){return client[_0x737d('0x7')](_0x2a028,_0x59956a)[_0x737d('0x8')](function(_0x33b805){logger[_0x737d('0x9')](_0x737d('0xa'),_0x3c8490,_0x737d('0xb'));logger[_0x737d('0xc')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x3c8490,_0x737d('0xb'),JSON[_0x737d('0xd')](_0x33b805));if(_0x33b805[_0x737d('0xe')]){if(_0x33b805[_0x737d('0xe')]['code']===0x1f4){logger['error'](_0x737d('0xa'),_0x3c8490,_0x33b805[_0x737d('0xe')][_0x737d('0xf')]);return _0x28b642(_0x33b805[_0x737d('0xe')]['message']);}logger[_0x737d('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x3c8490,_0x33b805[_0x737d('0xe')]['message']);return _0x164161(_0x33b805[_0x737d('0xe')][_0x737d('0xf')]);}else{logger[_0x737d('0x9')](_0x737d('0xa'),_0x3c8490,'request\x20sent');_0x164161(_0x33b805[_0x737d('0x10')]['message']);}})[_0x737d('0x11')](function(_0x16f1ed){logger[_0x737d('0xe')](_0x737d('0xa'),_0x3c8490,_0x16f1ed);_0x28b642(_0x16f1ed);});});}exports[_0x737d('0x12')]=function(_0x197350){var _0x45b484=this;return new Promise(function(_0x292130,_0x97f109){return db[_0x737d('0x13')][_0x737d('0x14')]({'raw':_0x197350[_0x737d('0x15')]?_0x197350['options'][_0x737d('0x16')]===undefined?!![]:![]:!![],'where':_0x197350[_0x737d('0x15')]?_0x197350['options'][_0x737d('0x17')]||null:null,'attributes':_0x197350[_0x737d('0x15')]?_0x197350['options'][_0x737d('0x18')]||null:null,'limit':_0x197350[_0x737d('0x15')]?_0x197350[_0x737d('0x15')][_0x737d('0x19')]||null:null,'include':_0x197350['options']?_0x197350[_0x737d('0x15')][_0x737d('0x1a')]?_[_0x737d('0x1b')](_0x197350[_0x737d('0x15')][_0x737d('0x1a')],function(_0x2e9779){return{'model':db[_0x2e9779[_0x737d('0x1c')]],'as':_0x2e9779['as'],'attributes':_0x2e9779[_0x737d('0x18')],'include':_0x2e9779[_0x737d('0x1a')]?_[_0x737d('0x1b')](_0x2e9779[_0x737d('0x1a')],function(_0x24a2c3){return{'model':db[_0x24a2c3[_0x737d('0x1c')]],'as':_0x24a2c3['as'],'attributes':_0x24a2c3[_0x737d('0x18')],'include':_0x24a2c3[_0x737d('0x1a')]?_['map'](_0x24a2c3[_0x737d('0x1a')],function(_0x5b7e43){return{'model':db[_0x5b7e43[_0x737d('0x1c')]],'as':_0x5b7e43['as'],'attributes':_0x5b7e43['attributes']};}):[]};}):[]};}):[]:[]})[_0x737d('0x8')](function(_0x50fe0a){logger[_0x737d('0x9')](_0x737d('0x12'),_0x197350);logger[_0x737d('0xc')](_0x737d('0x12'),_0x197350,JSON['stringify'](_0x50fe0a));_0x292130(_0x50fe0a);})[_0x737d('0x11')](function(_0x306b4d){logger[_0x737d('0xe')](_0x737d('0x12'),_0x306b4d[_0x737d('0xf')],_0x197350);_0x97f109(_0x45b484[_0x737d('0xe')](0x1f4,_0x306b4d[_0x737d('0xf')]));});});};exports[_0x737d('0x1d')]=function(_0x96f8e6){var _0x487d6d=this;return new Promise(function(_0x1edb36,_0x183fa2){return db[_0x737d('0x13')][_0x737d('0x1e')]({'raw':_0x96f8e6[_0x737d('0x15')]?_0x96f8e6['options'][_0x737d('0x16')]===undefined?!![]:![]:!![],'where':_0x96f8e6[_0x737d('0x15')]?_0x96f8e6['options']['where']||null:null,'attributes':_0x96f8e6[_0x737d('0x15')]?_0x96f8e6['options'][_0x737d('0x18')]||null:null,'include':_0x96f8e6[_0x737d('0x15')]?_0x96f8e6[_0x737d('0x15')][_0x737d('0x1a')]?_[_0x737d('0x1b')](_0x96f8e6[_0x737d('0x15')]['include'],function(_0x51f29a){return{'model':db[_0x51f29a[_0x737d('0x1c')]],'as':_0x51f29a['as'],'attributes':_0x51f29a[_0x737d('0x18')],'include':_0x51f29a[_0x737d('0x1a')]?_[_0x737d('0x1b')](_0x51f29a[_0x737d('0x1a')],function(_0xd45948){return{'model':db[_0xd45948[_0x737d('0x1c')]],'as':_0xd45948['as'],'attributes':_0xd45948[_0x737d('0x18')],'include':_0xd45948[_0x737d('0x1a')]?_['map'](_0xd45948['include'],function(_0x167c86){return{'model':db[_0x167c86[_0x737d('0x1c')]],'as':_0x167c86['as'],'attributes':_0x167c86['attributes']};}):[]};}):[]};}):[]:[]})[_0x737d('0x8')](function(_0x68925f){logger[_0x737d('0x9')](_0x737d('0x1d'),_0x96f8e6);logger[_0x737d('0xc')](_0x737d('0x1d'),_0x96f8e6,JSON[_0x737d('0xd')](_0x68925f));_0x1edb36(_0x68925f);})['catch'](function(_0x1b3eab){logger['error'](_0x737d('0x1d'),_0x1b3eab[_0x737d('0xf')],_0x96f8e6);_0x183fa2(_0x487d6d[_0x737d('0xe')](0x1f4,_0x1b3eab['message']));});});}; \ No newline at end of file +var _0x960c=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','code','message','error','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','limit','include','map','model','attributes','ShowSugarcrmAccount','raw','debug'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x960c,0x1ba));var _0xc960=function(_0x146a31,_0x20ad03){_0x146a31=_0x146a31-0x0;var _0x525abf=_0x960c[_0x146a31];return _0x525abf;};'use strict';var _=require(_0xc960('0x0'));var util=require(_0xc960('0x1'));var moment=require(_0xc960('0x2'));var BPromise=require(_0xc960('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc960('0x4'));var db=require(_0xc960('0x5'))['db'];var utils=require(_0xc960('0x6'));var logger=require(_0xc960('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc960('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5e03eb,_0x6a7653,_0x54ca88){return new BPromise(function(_0x324710,_0x18a736){return client[_0xc960('0x9')](_0x5e03eb,_0x54ca88)[_0xc960('0xa')](function(_0x4b1959){logger[_0xc960('0xb')](_0xc960('0xc'),_0x6a7653,_0xc960('0xd'));logger['debug'](_0xc960('0xe'),_0x6a7653,'request\x20sent',JSON[_0xc960('0xf')](_0x4b1959));if(_0x4b1959['error']){if(_0x4b1959['error'][_0xc960('0x10')]===0x1f4){logger['error'](_0xc960('0xc'),_0x6a7653,_0x4b1959['error'][_0xc960('0x11')]);return _0x18a736(_0x4b1959[_0xc960('0x12')]['message']);}logger[_0xc960('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x6a7653,_0x4b1959[_0xc960('0x12')]['message']);return _0x324710(_0x4b1959[_0xc960('0x12')][_0xc960('0x11')]);}else{logger[_0xc960('0xb')](_0xc960('0xc'),_0x6a7653,'request\x20sent');_0x324710(_0x4b1959[_0xc960('0x13')][_0xc960('0x11')]);}})[_0xc960('0x14')](function(_0x19edc2){logger[_0xc960('0x12')](_0xc960('0xc'),_0x6a7653,_0x19edc2);_0x18a736(_0x19edc2);});});}exports[_0xc960('0x15')]=function(_0x633d0f){var _0x3a66d0=this;return new Promise(function(_0x477d8f,_0x1fcbcc){return db[_0xc960('0x16')][_0xc960('0x17')]({'raw':_0x633d0f['options']?_0x633d0f[_0xc960('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x633d0f[_0xc960('0x18')]?_0x633d0f[_0xc960('0x18')][_0xc960('0x19')]||null:null,'attributes':_0x633d0f['options']?_0x633d0f[_0xc960('0x18')]['attributes']||null:null,'limit':_0x633d0f[_0xc960('0x18')]?_0x633d0f[_0xc960('0x18')][_0xc960('0x1a')]||null:null,'include':_0x633d0f[_0xc960('0x18')]?_0x633d0f[_0xc960('0x18')][_0xc960('0x1b')]?_[_0xc960('0x1c')](_0x633d0f[_0xc960('0x18')][_0xc960('0x1b')],function(_0x3dbf6f){return{'model':db[_0x3dbf6f[_0xc960('0x1d')]],'as':_0x3dbf6f['as'],'attributes':_0x3dbf6f[_0xc960('0x1e')],'include':_0x3dbf6f[_0xc960('0x1b')]?_[_0xc960('0x1c')](_0x3dbf6f[_0xc960('0x1b')],function(_0x1c324b){return{'model':db[_0x1c324b[_0xc960('0x1d')]],'as':_0x1c324b['as'],'attributes':_0x1c324b[_0xc960('0x1e')],'include':_0x1c324b[_0xc960('0x1b')]?_['map'](_0x1c324b[_0xc960('0x1b')],function(_0x3d587b){return{'model':db[_0x3d587b[_0xc960('0x1d')]],'as':_0x3d587b['as'],'attributes':_0x3d587b[_0xc960('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc960('0xa')](function(_0x26de56){logger[_0xc960('0xb')]('GetSugarcrmAccount',_0x633d0f);logger['debug'](_0xc960('0x15'),_0x633d0f,JSON['stringify'](_0x26de56));_0x477d8f(_0x26de56);})[_0xc960('0x14')](function(_0x1698e6){logger[_0xc960('0x12')](_0xc960('0x15'),_0x1698e6[_0xc960('0x11')],_0x633d0f);_0x1fcbcc(_0x3a66d0['error'](0x1f4,_0x1698e6['message']));});});};exports[_0xc960('0x1f')]=function(_0x2efcee){var _0x1aa255=this;return new Promise(function(_0x4a53ee,_0x1cb9e4){return db['SugarcrmAccount']['find']({'raw':_0x2efcee['options']?_0x2efcee[_0xc960('0x18')][_0xc960('0x20')]===undefined?!![]:![]:!![],'where':_0x2efcee[_0xc960('0x18')]?_0x2efcee['options'][_0xc960('0x19')]||null:null,'attributes':_0x2efcee[_0xc960('0x18')]?_0x2efcee[_0xc960('0x18')][_0xc960('0x1e')]||null:null,'include':_0x2efcee['options']?_0x2efcee['options'][_0xc960('0x1b')]?_[_0xc960('0x1c')](_0x2efcee[_0xc960('0x18')][_0xc960('0x1b')],function(_0x5d9065){return{'model':db[_0x5d9065[_0xc960('0x1d')]],'as':_0x5d9065['as'],'attributes':_0x5d9065[_0xc960('0x1e')],'include':_0x5d9065['include']?_[_0xc960('0x1c')](_0x5d9065[_0xc960('0x1b')],function(_0x5cc575){return{'model':db[_0x5cc575[_0xc960('0x1d')]],'as':_0x5cc575['as'],'attributes':_0x5cc575[_0xc960('0x1e')],'include':_0x5cc575[_0xc960('0x1b')]?_[_0xc960('0x1c')](_0x5cc575[_0xc960('0x1b')],function(_0x443ea6){return{'model':db[_0x443ea6[_0xc960('0x1d')]],'as':_0x443ea6['as'],'attributes':_0x443ea6['attributes']};}):[]};}):[]};}):[]:[]})[_0xc960('0xa')](function(_0x560ccd){logger[_0xc960('0xb')](_0xc960('0x1f'),_0x2efcee);logger[_0xc960('0x21')](_0xc960('0x1f'),_0x2efcee,JSON['stringify'](_0x560ccd));_0x4a53ee(_0x560ccd);})[_0xc960('0x14')](function(_0x163c31){logger[_0xc960('0x12')]('ShowSugarcrmAccount',_0x163c31[_0xc960('0x11')],_0x2efcee);_0x1cb9e4(_0x1aa255['error'](0x1f4,_0x163c31[_0xc960('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index f62e8c6..96ab0ce 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 _0x354e=['delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0x354e,0xea));var _0xe354=function(_0x2248ed,_0x1909d8){_0x2248ed=_0x2248ed-0x0;var _0x2c48a9=_0x354e[_0x2248ed];return _0x2c48a9;};'use strict';var multer=require('multer');var util=require(_0xe354('0x0'));var path=require(_0xe354('0x1'));var timeout=require('connect-timeout');var express=require(_0xe354('0x2'));var router=express[_0xe354('0x3')]();var fs_extra=require(_0xe354('0x4'));var auth=require(_0xe354('0x5'));var interaction=require(_0xe354('0x6'));var config=require(_0xe354('0x7'));var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth[_0xe354('0x8')](),controller['index']);router[_0xe354('0x9')](_0xe354('0xa'),auth[_0xe354('0x8')](),controller['show']);router['get'](_0xe354('0xb'),auth[_0xe354('0x8')](),controller[_0xe354('0xc')]);router[_0xe354('0x9')](_0xe354('0xd'),auth[_0xe354('0x8')](),controller[_0xe354('0xe')]);router[_0xe354('0x9')]('/:id/descriptions',auth[_0xe354('0x8')](),controller[_0xe354('0xf')]);router['post']('/',auth[_0xe354('0x8')](),controller[_0xe354('0x10')]);router[_0xe354('0x11')](_0xe354('0xa'),auth[_0xe354('0x8')](),controller['update']);router[_0xe354('0x12')](_0xe354('0xa'),auth[_0xe354('0x8')](),controller[_0xe354('0x13')]);module[_0xe354('0x14')]=router; \ No newline at end of file +var _0xd892=['../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x506d2f,_0x5ab76e){var _0x101255=function(_0x1596b1){while(--_0x1596b1){_0x506d2f['push'](_0x506d2f['shift']());}};_0x101255(++_0x5ab76e);}(_0xd892,0x124));var _0x2d89=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xd892[_0xbb091];return _0x467a04;};'use strict';var multer=require(_0x2d89('0x0'));var util=require(_0x2d89('0x1'));var path=require(_0x2d89('0x2'));var timeout=require(_0x2d89('0x3'));var express=require(_0x2d89('0x4'));var router=express[_0x2d89('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2d89('0x6'));var interaction=require(_0x2d89('0x7'));var config=require('../../config/environment');var controller=require(_0x2d89('0x8'));router[_0x2d89('0x9')]('/',auth[_0x2d89('0xa')](),controller[_0x2d89('0xb')]);router['get'](_0x2d89('0xc'),auth[_0x2d89('0xa')](),controller['show']);router[_0x2d89('0x9')](_0x2d89('0xd'),auth[_0x2d89('0xa')](),controller['getFields']);router[_0x2d89('0x9')]('/:id/subjects',auth[_0x2d89('0xa')](),controller[_0x2d89('0xe')]);router[_0x2d89('0x9')]('/:id/descriptions',auth[_0x2d89('0xa')](),controller[_0x2d89('0xf')]);router[_0x2d89('0x10')]('/',auth['isAuthenticated'](),controller[_0x2d89('0x11')]);router[_0x2d89('0x12')](_0x2d89('0xc'),auth[_0x2d89('0xa')](),controller[_0x2d89('0x13')]);router[_0x2d89('0x14')](_0x2d89('0xc'),auth[_0x2d89('0xa')](),controller[_0x2d89('0x15')]);module[_0x2d89('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index bae655a..898ee1c 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 _0x4ee2=['exports','STRING'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x4ee2,0x11c));var _0x24ee=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4ee2[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module[_0x24ee('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x24ee('0x1')]}}; \ No newline at end of file +var _0xd35c=['exports','STRING'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd35c,0xfa));var _0xcd35=function(_0x3abe3d,_0xed0e58){_0x3abe3d=_0x3abe3d-0x0;var _0x5a62d0=_0xd35c[_0x3abe3d];return _0x5a62d0;};'use strict';var Sequelize=require('sequelize');module[_0xcd35('0x0')]={'name':{'type':Sequelize[_0xcd35('0x1')]},'description':{'type':Sequelize[_0xcd35('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 18f5e10..7fc49e1 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 _0xeaf5=['intersection','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','show','params','find','create','body','rawAttributes','getFields','hasOwnProperty','getSubjects','findOne','SugarcrmField','getDescriptions','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','http','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','SugarcrmConfiguration','type','key','model','map','query','keys','filters','attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xeaf5,0x1c9));var _0x5eaf=function(_0x564e9f,_0x225a15){_0x564e9f=_0x564e9f-0x0;var _0x3a9f3e=_0xeaf5[_0x564e9f];return _0x3a9f3e;};'use strict';var pdf=require(_0x5eaf('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5eaf('0x1'));var jsonpatch=require(_0x5eaf('0x2'));var rp=require(_0x5eaf('0x3'));var moment=require(_0x5eaf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5eaf('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x5eaf('0x6'));var ejs=require(_0x5eaf('0x7'));var fs=require('fs');var fs_extra=require(_0x5eaf('0x8'));var _=require(_0x5eaf('0x9'));var squel=require(_0x5eaf('0xa'));var crypto=require('crypto');var jsforce=require(_0x5eaf('0xb'));var deskjs=require(_0x5eaf('0xc'));var toCsv=require(_0x5eaf('0x6'));var querystring=require('querystring');var Papa=require(_0x5eaf('0xd'));var Redis=require('ioredis');var authService=require(_0x5eaf('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5eaf('0xf'));var logger=require(_0x5eaf('0x10'))(_0x5eaf('0x11'));var utils=require('../../config/utils');var config=require(_0x5eaf('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x5eaf('0x13'))['db'];var jayson=require(_0x5eaf('0x14'));var client=jayson['client'][_0x5eaf('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x350aed,_0x123658,_0x80ea91,_0x29c3a5){return new BPromise(function(_0x430a0c,_0x55b7b4){var _0x4c0060=_0x29c3a5||client;return _0x4c0060['request'](_0x350aed,_0x80ea91)['then'](function(_0x233b32){logger[_0x5eaf('0x16')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x123658,_0x5eaf('0x17'));logger[_0x5eaf('0x18')](_0x5eaf('0x19'),_0x123658,_0x5eaf('0x17'),JSON[_0x5eaf('0x1a')](_0x233b32));if(_0x233b32[_0x5eaf('0x1b')]){if(_0x233b32[_0x5eaf('0x1b')][_0x5eaf('0x1c')]===0x1f4){logger[_0x5eaf('0x1b')](_0x5eaf('0x1d'),_0x123658,_0x233b32['error']['message']);return _0x55b7b4(_0x233b32[_0x5eaf('0x1b')][_0x5eaf('0x1e')]);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x123658,_0x233b32[_0x5eaf('0x1b')][_0x5eaf('0x1e')]);return _0x430a0c(_0x233b32[_0x5eaf('0x1b')]['message']);}else{logger[_0x5eaf('0x16')](_0x5eaf('0x1d'),_0x123658,_0x5eaf('0x17'));_0x430a0c(_0x233b32[_0x5eaf('0x1f')][_0x5eaf('0x1e')]);}})[_0x5eaf('0x20')](function(_0x13ca2f){logger[_0x5eaf('0x1b')](_0x5eaf('0x1d'),_0x123658,_0x13ca2f);_0x55b7b4(_0x13ca2f);});});}function respondWithStatusCode(_0x3aebe6,_0x4bc1f4){_0x4bc1f4=_0x4bc1f4||0xcc;return function(_0x47b31c){if(_0x47b31c){return _0x3aebe6[_0x5eaf('0x21')](_0x4bc1f4);}return _0x3aebe6[_0x5eaf('0x22')](_0x4bc1f4)[_0x5eaf('0x23')]();};}function respondWithResult(_0x42528a,_0x471162){_0x471162=_0x471162||0xc8;return function(_0x599275){if(_0x599275){return _0x42528a[_0x5eaf('0x22')](_0x471162)[_0x5eaf('0x24')](_0x599275);}};}function respondWithFilteredResult(_0x10d8a4,_0x12759a){return function(_0x20ec9b){if(_0x20ec9b){var _0x17767b=_0x20ec9b['count'],_0x451d12=_0x12759a[_0x5eaf('0x25')],_0x3fef06=_0x12759a[_0x5eaf('0x25')]+_0x12759a[_0x5eaf('0x26')],_0x3d38c5;if(_0x3fef06>=_0x17767b){_0x3fef06=_0x17767b;_0x3d38c5=0xc8;}else{_0x3d38c5=0xce;}_0x10d8a4[_0x5eaf('0x22')](_0x3d38c5);return _0x10d8a4['set'](_0x5eaf('0x27'),_0x451d12+'-'+_0x3fef06+'/'+_0x17767b)[_0x5eaf('0x24')](_0x20ec9b);}return null;};}function patchUpdates(_0x2d7191){return function(_0x154149){try{jsonpatch[_0x5eaf('0x28')](_0x154149,_0x2d7191,!![]);}catch(_0x400a6a){return BPromise[_0x5eaf('0x29')](_0x400a6a);}return _0x154149[_0x5eaf('0x2a')]();};}function saveUpdates(_0xa28987,_0x259270){return function(_0xd902e5){if(_0xd902e5){return _0xd902e5[_0x5eaf('0x2b')](_0xa28987)[_0x5eaf('0x2c')](function(_0x2ab310){return _0x2ab310;});}return null;};}function removeEntity(_0x5d7bf7,_0x4b9fd2){return function(_0x447ea0){if(_0x447ea0){return _0x447ea0[_0x5eaf('0x2d')]()[_0x5eaf('0x2c')](function(){_0x5d7bf7['status'](0xcc)[_0x5eaf('0x23')]();});}};}function handleEntityNotFound(_0x16be20,_0x1ec8ec){return function(_0x41bbca){if(!_0x41bbca){_0x16be20[_0x5eaf('0x21')](0x194);}return _0x41bbca;};}function handleError(_0x359b9d,_0xc58935){_0xc58935=_0xc58935||0x1f4;return function(_0x59891b){logger[_0x5eaf('0x1b')](_0x59891b[_0x5eaf('0x2e')]);if(_0x59891b[_0x5eaf('0x2f')]){delete _0x59891b[_0x5eaf('0x2f')];}_0x359b9d[_0x5eaf('0x22')](_0xc58935)[_0x5eaf('0x30')](_0x59891b);};}exports[_0x5eaf('0x31')]=function(_0x34f6a5,_0x5f4318){var _0x25cec9={},_0x4fd8d9={},_0x21c2c5={'count':0x0,'rows':[]};var _0x4a7a39=_['map'](db[_0x5eaf('0x32')]['rawAttributes'],function(_0x26c062){return{'name':_0x26c062['fieldName'],'type':_0x26c062[_0x5eaf('0x33')][_0x5eaf('0x34')]};});_0x4fd8d9[_0x5eaf('0x35')]=_[_0x5eaf('0x36')](_0x4a7a39,_0x5eaf('0x2f'));_0x4fd8d9[_0x5eaf('0x37')]=_[_0x5eaf('0x38')](_0x34f6a5['query']);_0x4fd8d9[_0x5eaf('0x39')]=_['intersection'](_0x4fd8d9[_0x5eaf('0x35')],_0x4fd8d9[_0x5eaf('0x37')]);_0x25cec9[_0x5eaf('0x3a')]=_[_0x5eaf('0x3b')](_0x4fd8d9[_0x5eaf('0x35')],qs[_0x5eaf('0x3c')](_0x34f6a5[_0x5eaf('0x37')][_0x5eaf('0x3c')]));_0x25cec9[_0x5eaf('0x3a')]=_0x25cec9['attributes'][_0x5eaf('0x3d')]?_0x25cec9[_0x5eaf('0x3a')]:_0x4fd8d9[_0x5eaf('0x35')];if(!_0x34f6a5[_0x5eaf('0x37')]['hasOwnProperty'](_0x5eaf('0x3e'))){_0x25cec9[_0x5eaf('0x26')]=qs[_0x5eaf('0x26')](_0x34f6a5[_0x5eaf('0x37')][_0x5eaf('0x26')]);_0x25cec9[_0x5eaf('0x25')]=qs[_0x5eaf('0x25')](_0x34f6a5[_0x5eaf('0x37')][_0x5eaf('0x25')]);}_0x25cec9[_0x5eaf('0x3f')]=qs[_0x5eaf('0x40')](_0x34f6a5[_0x5eaf('0x37')]['sort']);_0x25cec9['where']=qs['filters'](_[_0x5eaf('0x41')](_0x34f6a5[_0x5eaf('0x37')],_0x4fd8d9[_0x5eaf('0x39')]),_0x4a7a39);if(_0x34f6a5[_0x5eaf('0x37')][_0x5eaf('0x42')]){_0x25cec9['where']=_['merge'](_0x25cec9[_0x5eaf('0x43')],{'$or':_[_0x5eaf('0x36')](_0x4a7a39,function(_0x11df7e){if(_0x11df7e[_0x5eaf('0x33')]!==_0x5eaf('0x44')){var _0x9f4d11={};_0x9f4d11[_0x11df7e['name']]={'$like':'%'+_0x34f6a5[_0x5eaf('0x37')][_0x5eaf('0x42')]+'%'};return _0x9f4d11;}})});}_0x25cec9=_[_0x5eaf('0x45')]({},_0x25cec9,_0x34f6a5[_0x5eaf('0x46')]);var _0x2dfbdd={'where':_0x25cec9[_0x5eaf('0x43')]};return db[_0x5eaf('0x32')][_0x5eaf('0x47')](_0x2dfbdd)[_0x5eaf('0x2c')](function(_0x4fa16d){_0x21c2c5['count']=_0x4fa16d;if(_0x34f6a5[_0x5eaf('0x37')][_0x5eaf('0x48')]){_0x25cec9[_0x5eaf('0x49')]=[{'all':!![]}];}return db[_0x5eaf('0x32')]['findAll'](_0x25cec9);})[_0x5eaf('0x2c')](function(_0x1a10b6){_0x21c2c5['rows']=_0x1a10b6;return _0x21c2c5;})[_0x5eaf('0x2c')](respondWithFilteredResult(_0x5f4318,_0x25cec9))['catch'](handleError(_0x5f4318,null));};exports[_0x5eaf('0x4a')]=function(_0x41133c,_0x188ce5){var _0x48f4c7={'raw':![],'where':{'id':_0x41133c[_0x5eaf('0x4b')]['id']}},_0x621997={};_0x621997['model']=_[_0x5eaf('0x38')](db['SugarcrmConfiguration']['rawAttributes']);_0x621997[_0x5eaf('0x37')]=_[_0x5eaf('0x38')](_0x41133c[_0x5eaf('0x37')]);_0x621997[_0x5eaf('0x39')]=_[_0x5eaf('0x3b')](_0x621997['model'],_0x621997['query']);_0x48f4c7[_0x5eaf('0x3a')]=_[_0x5eaf('0x3b')](_0x621997[_0x5eaf('0x35')],qs[_0x5eaf('0x3c')](_0x41133c[_0x5eaf('0x37')]['fields']));_0x48f4c7[_0x5eaf('0x3a')]=_0x48f4c7[_0x5eaf('0x3a')][_0x5eaf('0x3d')]?_0x48f4c7[_0x5eaf('0x3a')]:_0x621997[_0x5eaf('0x35')];if(_0x41133c['query'][_0x5eaf('0x48')]){_0x48f4c7[_0x5eaf('0x49')]=[{'all':!![]}];}_0x48f4c7=_[_0x5eaf('0x45')]({},_0x48f4c7,_0x41133c[_0x5eaf('0x46')]);return db[_0x5eaf('0x32')][_0x5eaf('0x4c')](_0x48f4c7)[_0x5eaf('0x2c')](handleEntityNotFound(_0x188ce5,null))[_0x5eaf('0x2c')](respondWithResult(_0x188ce5,null))[_0x5eaf('0x20')](handleError(_0x188ce5,null));};exports[_0x5eaf('0x4d')]=function(_0x489386,_0xe371f6){return db['SugarcrmConfiguration'][_0x5eaf('0x4d')](_0x489386['body'],{})['then'](respondWithResult(_0xe371f6,0xc9))['catch'](handleError(_0xe371f6,null));};exports[_0x5eaf('0x2b')]=function(_0x2a4f19,_0x153f81){if(_0x2a4f19[_0x5eaf('0x4e')]['id']){delete _0x2a4f19['body']['id'];}return db[_0x5eaf('0x32')][_0x5eaf('0x4c')]({'where':{'id':_0x2a4f19[_0x5eaf('0x4b')]['id']}})[_0x5eaf('0x2c')](handleEntityNotFound(_0x153f81,null))[_0x5eaf('0x2c')](saveUpdates(_0x2a4f19[_0x5eaf('0x4e')],null))['then'](respondWithResult(_0x153f81,null))[_0x5eaf('0x20')](handleError(_0x153f81,null));};exports[_0x5eaf('0x2d')]=function(_0x566213,_0x2423da){return db[_0x5eaf('0x32')][_0x5eaf('0x4c')]({'where':{'id':_0x566213[_0x5eaf('0x4b')]['id']}})[_0x5eaf('0x2c')](handleEntityNotFound(_0x2423da,null))['then'](removeEntity(_0x2423da,null))[_0x5eaf('0x20')](handleError(_0x2423da,null));};exports['getFields']=function(_0x54dc86,_0x56851a,_0x383661){var _0x405eb0={};var _0x5d294b={};var _0x1a8368;var _0x35ba5a;return db[_0x5eaf('0x32')]['findOne']({'where':{'id':_0x54dc86[_0x5eaf('0x4b')]['id']}})['then'](handleEntityNotFound(_0x56851a,null))[_0x5eaf('0x2c')](function(_0x4f9423){if(_0x4f9423){_0x1a8368=_0x4f9423;_0x5d294b[_0x5eaf('0x35')]=_[_0x5eaf('0x38')](db['SugarcrmField'][_0x5eaf('0x4f')]);_0x5d294b[_0x5eaf('0x37')]=_[_0x5eaf('0x38')](_0x54dc86[_0x5eaf('0x37')]);_0x5d294b[_0x5eaf('0x39')]=_[_0x5eaf('0x3b')](_0x5d294b[_0x5eaf('0x35')],_0x5d294b[_0x5eaf('0x37')]);_0x405eb0['attributes']=_[_0x5eaf('0x3b')](_0x5d294b[_0x5eaf('0x35')],qs[_0x5eaf('0x3c')](_0x54dc86[_0x5eaf('0x37')]['fields']));_0x405eb0[_0x5eaf('0x3a')]=_0x405eb0[_0x5eaf('0x3a')][_0x5eaf('0x3d')]?_0x405eb0[_0x5eaf('0x3a')]:_0x5d294b['model'];_0x405eb0[_0x5eaf('0x3f')]=qs['sort'](_0x54dc86['query']['sort']);_0x405eb0[_0x5eaf('0x43')]=qs[_0x5eaf('0x39')](_['pick'](_0x54dc86[_0x5eaf('0x37')],_0x5d294b[_0x5eaf('0x39')]));if(_0x54dc86[_0x5eaf('0x37')]['filter']){_0x405eb0['where']=_[_0x5eaf('0x45')](_0x405eb0['where'],{'$or':_[_0x5eaf('0x36')](_0x405eb0[_0x5eaf('0x3a')],function(_0x2ac2bb){var _0x3e1280={};_0x3e1280[_0x2ac2bb]={'$like':'%'+_0x54dc86[_0x5eaf('0x37')]['filter']+'%'};return _0x3e1280;})});}_0x405eb0=_['merge']({},_0x405eb0,_0x54dc86[_0x5eaf('0x46')]);return _0x1a8368[_0x5eaf('0x50')](_0x405eb0);}})['then'](function(_0x1034da){if(_0x1034da){_0x35ba5a=_0x1034da[_0x5eaf('0x3d')];if(!_0x54dc86[_0x5eaf('0x37')][_0x5eaf('0x51')](_0x5eaf('0x3e'))){_0x405eb0[_0x5eaf('0x26')]=qs['limit'](_0x54dc86[_0x5eaf('0x37')]['limit']);_0x405eb0[_0x5eaf('0x25')]=qs[_0x5eaf('0x25')](_0x54dc86[_0x5eaf('0x37')][_0x5eaf('0x25')]);}return _0x1a8368[_0x5eaf('0x50')](_0x405eb0);}})[_0x5eaf('0x2c')](function(_0xc8655c){if(_0xc8655c){return _0xc8655c?{'count':_0x35ba5a,'rows':_0xc8655c}:null;}})['then'](respondWithResult(_0x56851a,null))[_0x5eaf('0x20')](handleError(_0x56851a,null));};exports[_0x5eaf('0x52')]=function(_0x46adb3,_0x8e387f,_0x93e5d8){var _0x34d821={};var _0x10e884={};var _0x1cb6ce;var _0x23a492;return db[_0x5eaf('0x32')][_0x5eaf('0x53')]({'where':{'id':_0x46adb3[_0x5eaf('0x4b')]['id']}})[_0x5eaf('0x2c')](handleEntityNotFound(_0x8e387f,null))[_0x5eaf('0x2c')](function(_0x6c496e){if(_0x6c496e){_0x1cb6ce=_0x6c496e;_0x10e884[_0x5eaf('0x35')]=_[_0x5eaf('0x38')](db[_0x5eaf('0x54')][_0x5eaf('0x4f')]);_0x10e884[_0x5eaf('0x37')]=_[_0x5eaf('0x38')](_0x46adb3[_0x5eaf('0x37')]);_0x10e884['filters']=_[_0x5eaf('0x3b')](_0x10e884[_0x5eaf('0x35')],_0x10e884['query']);_0x34d821[_0x5eaf('0x3a')]=_[_0x5eaf('0x3b')](_0x10e884[_0x5eaf('0x35')],qs['fields'](_0x46adb3['query'][_0x5eaf('0x3c')]));_0x34d821[_0x5eaf('0x3a')]=_0x34d821[_0x5eaf('0x3a')]['length']?_0x34d821[_0x5eaf('0x3a')]:_0x10e884[_0x5eaf('0x35')];_0x34d821[_0x5eaf('0x3f')]=qs[_0x5eaf('0x40')](_0x46adb3[_0x5eaf('0x37')][_0x5eaf('0x40')]);_0x34d821['where']=qs[_0x5eaf('0x39')](_[_0x5eaf('0x41')](_0x46adb3['query'],_0x10e884[_0x5eaf('0x39')]));if(_0x46adb3[_0x5eaf('0x37')]['filter']){_0x34d821[_0x5eaf('0x43')]=_['merge'](_0x34d821[_0x5eaf('0x43')],{'$or':_[_0x5eaf('0x36')](_0x34d821[_0x5eaf('0x3a')],function(_0x5c719c){var _0x1bb312={};_0x1bb312[_0x5c719c]={'$like':'%'+_0x46adb3['query'][_0x5eaf('0x42')]+'%'};return _0x1bb312;})});}_0x34d821=_[_0x5eaf('0x45')]({},_0x34d821,_0x46adb3[_0x5eaf('0x46')]);return _0x1cb6ce[_0x5eaf('0x52')](_0x34d821);}})[_0x5eaf('0x2c')](function(_0x11bf56){if(_0x11bf56){_0x23a492=_0x11bf56['length'];if(!_0x46adb3[_0x5eaf('0x37')][_0x5eaf('0x51')]('nolimit')){_0x34d821[_0x5eaf('0x26')]=qs[_0x5eaf('0x26')](_0x46adb3[_0x5eaf('0x37')][_0x5eaf('0x26')]);_0x34d821[_0x5eaf('0x25')]=qs[_0x5eaf('0x25')](_0x46adb3[_0x5eaf('0x37')][_0x5eaf('0x25')]);}return _0x1cb6ce[_0x5eaf('0x52')](_0x34d821);}})[_0x5eaf('0x2c')](function(_0x11db6c){if(_0x11db6c){return _0x11db6c?{'count':_0x23a492,'rows':_0x11db6c}:null;}})['then'](respondWithResult(_0x8e387f,null))['catch'](handleError(_0x8e387f,null));};exports[_0x5eaf('0x55')]=function(_0x37dbc5,_0x461573,_0x5d7c36){var _0x19b26f={};var _0x476cd9={};var _0xc1310d;var _0x426b07;return db['SugarcrmConfiguration'][_0x5eaf('0x53')]({'where':{'id':_0x37dbc5[_0x5eaf('0x4b')]['id']}})['then'](handleEntityNotFound(_0x461573,null))[_0x5eaf('0x2c')](function(_0x44b9c9){if(_0x44b9c9){_0xc1310d=_0x44b9c9;_0x476cd9[_0x5eaf('0x35')]=_[_0x5eaf('0x38')](db['SugarcrmField'][_0x5eaf('0x4f')]);_0x476cd9[_0x5eaf('0x37')]=_[_0x5eaf('0x38')](_0x37dbc5[_0x5eaf('0x37')]);_0x476cd9[_0x5eaf('0x39')]=_[_0x5eaf('0x3b')](_0x476cd9['model'],_0x476cd9[_0x5eaf('0x37')]);_0x19b26f[_0x5eaf('0x3a')]=_[_0x5eaf('0x3b')](_0x476cd9['model'],qs['fields'](_0x37dbc5[_0x5eaf('0x37')]['fields']));_0x19b26f[_0x5eaf('0x3a')]=_0x19b26f[_0x5eaf('0x3a')][_0x5eaf('0x3d')]?_0x19b26f[_0x5eaf('0x3a')]:_0x476cd9[_0x5eaf('0x35')];_0x19b26f[_0x5eaf('0x3f')]=qs['sort'](_0x37dbc5['query'][_0x5eaf('0x40')]);_0x19b26f[_0x5eaf('0x43')]=qs[_0x5eaf('0x39')](_[_0x5eaf('0x41')](_0x37dbc5[_0x5eaf('0x37')],_0x476cd9['filters']));if(_0x37dbc5['query'][_0x5eaf('0x42')]){_0x19b26f[_0x5eaf('0x43')]=_[_0x5eaf('0x45')](_0x19b26f[_0x5eaf('0x43')],{'$or':_[_0x5eaf('0x36')](_0x19b26f['attributes'],function(_0x3da12f){var _0x32ec4a={};_0x32ec4a[_0x3da12f]={'$like':'%'+_0x37dbc5[_0x5eaf('0x37')][_0x5eaf('0x42')]+'%'};return _0x32ec4a;})});}_0x19b26f=_[_0x5eaf('0x45')]({},_0x19b26f,_0x37dbc5[_0x5eaf('0x46')]);return _0xc1310d[_0x5eaf('0x55')](_0x19b26f);}})[_0x5eaf('0x2c')](function(_0x3f33e9){if(_0x3f33e9){_0x426b07=_0x3f33e9[_0x5eaf('0x3d')];if(!_0x37dbc5[_0x5eaf('0x37')][_0x5eaf('0x51')]('nolimit')){_0x19b26f['limit']=qs[_0x5eaf('0x26')](_0x37dbc5['query'][_0x5eaf('0x26')]);_0x19b26f['offset']=qs[_0x5eaf('0x25')](_0x37dbc5[_0x5eaf('0x37')][_0x5eaf('0x25')]);}return _0xc1310d[_0x5eaf('0x55')](_0x19b26f);}})[_0x5eaf('0x2c')](function(_0x357604){if(_0x357604){return _0x357604?{'count':_0x426b07,'rows':_0x357604}:null;}})[_0x5eaf('0x2c')](respondWithResult(_0x461573,null))[_0x5eaf('0x20')](handleError(_0x461573,null));}; \ No newline at end of file +var _0x887b=['params','length','includeAll','include','find','create','body','SugarcrmField','getFields','hasOwnProperty','getSubjects','findOne','getDescriptions','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','destroy','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SugarcrmConfiguration','findAll'];(function(_0xc5d3c8,_0x43352b){var _0x3537e4=function(_0x4bfe24){while(--_0x4bfe24){_0xc5d3c8['push'](_0xc5d3c8['shift']());}};_0x3537e4(++_0x43352b);}(_0x887b,0x1cf));var _0xb887=function(_0x16175f,_0x26c7d0){_0x16175f=_0x16175f-0x0;var _0x1deaeb=_0x887b[_0x16175f];return _0x1deaeb;};'use strict';var pdf=require(_0xb887('0x0'));var emlformat=require(_0xb887('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb887('0x2'));var moment=require(_0xb887('0x3'));var BPromise=require(_0xb887('0x4'));var Mustache=require(_0xb887('0x5'));var util=require(_0xb887('0x6'));var path=require(_0xb887('0x7'));var sox=require('sox');var csv=require(_0xb887('0x8'));var ejs=require(_0xb887('0x9'));var fs=require('fs');var fs_extra=require(_0xb887('0xa'));var _=require(_0xb887('0xb'));var squel=require(_0xb887('0xc'));var crypto=require(_0xb887('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb887('0xe'));var toCsv=require(_0xb887('0x8'));var querystring=require(_0xb887('0xf'));var Papa=require(_0xb887('0x10'));var Redis=require(_0xb887('0x11'));var authService=require(_0xb887('0x12'));var qs=require(_0xb887('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb887('0x14'));var logger=require(_0xb887('0x15'))(_0xb887('0x16'));var utils=require('../../config/utils');var config=require(_0xb887('0x17'));var licenseUtil=require(_0xb887('0x18'));var db=require(_0xb887('0x19'))['db'];var jayson=require(_0xb887('0x1a'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x238f60,_0x220bf2,_0x1ba3db,_0x2c3567){return new BPromise(function(_0x54750c,_0x276d12){var _0x24020f=_0x2c3567||client;return _0x24020f[_0xb887('0x1b')](_0x238f60,_0x1ba3db)[_0xb887('0x1c')](function(_0x4adc20){logger[_0xb887('0x1d')](_0xb887('0x1e'),_0x220bf2,_0xb887('0x1f'));logger[_0xb887('0x20')](_0xb887('0x21'),_0x220bf2,_0xb887('0x1f'),JSON[_0xb887('0x22')](_0x4adc20));if(_0x4adc20[_0xb887('0x23')]){if(_0x4adc20['error'][_0xb887('0x24')]===0x1f4){logger[_0xb887('0x23')](_0xb887('0x1e'),_0x220bf2,_0x4adc20[_0xb887('0x23')][_0xb887('0x25')]);return _0x276d12(_0x4adc20['error'][_0xb887('0x25')]);}logger[_0xb887('0x23')](_0xb887('0x1e'),_0x220bf2,_0x4adc20[_0xb887('0x23')][_0xb887('0x25')]);return _0x54750c(_0x4adc20[_0xb887('0x23')][_0xb887('0x25')]);}else{logger[_0xb887('0x1d')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x220bf2,'request\x20sent');_0x54750c(_0x4adc20[_0xb887('0x26')][_0xb887('0x25')]);}})[_0xb887('0x27')](function(_0xd98e6d){logger[_0xb887('0x23')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x220bf2,_0xd98e6d);_0x276d12(_0xd98e6d);});});}function respondWithStatusCode(_0x2d0242,_0x190361){_0x190361=_0x190361||0xcc;return function(_0x244d78){if(_0x244d78){return _0x2d0242[_0xb887('0x28')](_0x190361);}return _0x2d0242[_0xb887('0x29')](_0x190361)[_0xb887('0x2a')]();};}function respondWithResult(_0x545396,_0x40fe72){_0x40fe72=_0x40fe72||0xc8;return function(_0x4cd09e){if(_0x4cd09e){return _0x545396[_0xb887('0x29')](_0x40fe72)[_0xb887('0x2b')](_0x4cd09e);}};}function respondWithFilteredResult(_0x5840a0,_0x23ef73){return function(_0x26676e){if(_0x26676e){var _0x29ca5b=_0x26676e[_0xb887('0x2c')],_0x1d1183=_0x23ef73[_0xb887('0x2d')],_0x2651af=_0x23ef73[_0xb887('0x2d')]+_0x23ef73[_0xb887('0x2e')],_0x319e37;if(_0x2651af>=_0x29ca5b){_0x2651af=_0x29ca5b;_0x319e37=0xc8;}else{_0x319e37=0xce;}_0x5840a0['status'](_0x319e37);return _0x5840a0[_0xb887('0x2f')](_0xb887('0x30'),_0x1d1183+'-'+_0x2651af+'/'+_0x29ca5b)['json'](_0x26676e);}return null;};}function patchUpdates(_0x48d599){return function(_0x459b31){try{jsonpatch['apply'](_0x459b31,_0x48d599,!![]);}catch(_0x3f3ed6){return BPromise['reject'](_0x3f3ed6);}return _0x459b31[_0xb887('0x31')]();};}function saveUpdates(_0x401415,_0x186bb0){return function(_0x5f0c7e){if(_0x5f0c7e){return _0x5f0c7e[_0xb887('0x32')](_0x401415)[_0xb887('0x1c')](function(_0x23663f){return _0x23663f;});}return null;};}function removeEntity(_0x2905e6,_0x222c47){return function(_0x8171d){if(_0x8171d){return _0x8171d[_0xb887('0x33')]()[_0xb887('0x1c')](function(){_0x2905e6[_0xb887('0x29')](0xcc)[_0xb887('0x2a')]();});}};}function handleEntityNotFound(_0x3e961a,_0x4f2b70){return function(_0x3893a9){if(!_0x3893a9){_0x3e961a[_0xb887('0x28')](0x194);}return _0x3893a9;};}function handleError(_0x2d671a,_0x1b12a5){_0x1b12a5=_0x1b12a5||0x1f4;return function(_0x570fe1){logger[_0xb887('0x23')](_0x570fe1['stack']);if(_0x570fe1[_0xb887('0x34')]){delete _0x570fe1['name'];}_0x2d671a['status'](_0x1b12a5)[_0xb887('0x35')](_0x570fe1);};}exports[_0xb887('0x36')]=function(_0x1c18af,_0x4991f2){var _0x4f161e={},_0xf79b9f={},_0x583d00={'count':0x0,'rows':[]};var _0xf66fca=_[_0xb887('0x37')](db['SugarcrmConfiguration'][_0xb887('0x38')],function(_0x37ebd8){return{'name':_0x37ebd8[_0xb887('0x39')],'type':_0x37ebd8[_0xb887('0x3a')]['key']};});_0xf79b9f[_0xb887('0x3b')]=_[_0xb887('0x37')](_0xf66fca,_0xb887('0x34'));_0xf79b9f[_0xb887('0x3c')]=_[_0xb887('0x3d')](_0x1c18af['query']);_0xf79b9f[_0xb887('0x3e')]=_[_0xb887('0x3f')](_0xf79b9f['model'],_0xf79b9f[_0xb887('0x3c')]);_0x4f161e[_0xb887('0x40')]=_['intersection'](_0xf79b9f[_0xb887('0x3b')],qs['fields'](_0x1c18af[_0xb887('0x3c')][_0xb887('0x41')]));_0x4f161e[_0xb887('0x40')]=_0x4f161e[_0xb887('0x40')]['length']?_0x4f161e[_0xb887('0x40')]:_0xf79b9f[_0xb887('0x3b')];if(!_0x1c18af['query']['hasOwnProperty'](_0xb887('0x42'))){_0x4f161e[_0xb887('0x2e')]=qs[_0xb887('0x2e')](_0x1c18af[_0xb887('0x3c')][_0xb887('0x2e')]);_0x4f161e[_0xb887('0x2d')]=qs['offset'](_0x1c18af['query']['offset']);}_0x4f161e[_0xb887('0x43')]=qs[_0xb887('0x44')](_0x1c18af['query'][_0xb887('0x44')]);_0x4f161e[_0xb887('0x45')]=qs['filters'](_[_0xb887('0x46')](_0x1c18af[_0xb887('0x3c')],_0xf79b9f['filters']),_0xf66fca);if(_0x1c18af['query']['filter']){_0x4f161e[_0xb887('0x45')]=_[_0xb887('0x47')](_0x4f161e[_0xb887('0x45')],{'$or':_[_0xb887('0x37')](_0xf66fca,function(_0x3a4469){if(_0x3a4469['type']!==_0xb887('0x48')){var _0x3234a5={};_0x3234a5[_0x3a4469['name']]={'$like':'%'+_0x1c18af['query'][_0xb887('0x49')]+'%'};return _0x3234a5;}})});}_0x4f161e=_[_0xb887('0x47')]({},_0x4f161e,_0x1c18af[_0xb887('0x4a')]);var _0x198b0d={'where':_0x4f161e[_0xb887('0x45')]};return db['SugarcrmConfiguration']['count'](_0x198b0d)['then'](function(_0x164589){_0x583d00[_0xb887('0x2c')]=_0x164589;if(_0x1c18af[_0xb887('0x3c')]['includeAll']){_0x4f161e['include']=[{'all':!![]}];}return db[_0xb887('0x4b')][_0xb887('0x4c')](_0x4f161e);})[_0xb887('0x1c')](function(_0x5c1103){_0x583d00['rows']=_0x5c1103;return _0x583d00;})['then'](respondWithFilteredResult(_0x4991f2,_0x4f161e))['catch'](handleError(_0x4991f2,null));};exports['show']=function(_0x55c4cd,_0x484b30){var _0x34b4c7={'raw':![],'where':{'id':_0x55c4cd[_0xb887('0x4d')]['id']}},_0x2ea72e={};_0x2ea72e[_0xb887('0x3b')]=_['keys'](db[_0xb887('0x4b')][_0xb887('0x38')]);_0x2ea72e[_0xb887('0x3c')]=_[_0xb887('0x3d')](_0x55c4cd[_0xb887('0x3c')]);_0x2ea72e[_0xb887('0x3e')]=_[_0xb887('0x3f')](_0x2ea72e['model'],_0x2ea72e['query']);_0x34b4c7[_0xb887('0x40')]=_['intersection'](_0x2ea72e[_0xb887('0x3b')],qs['fields'](_0x55c4cd[_0xb887('0x3c')][_0xb887('0x41')]));_0x34b4c7['attributes']=_0x34b4c7[_0xb887('0x40')][_0xb887('0x4e')]?_0x34b4c7['attributes']:_0x2ea72e['model'];if(_0x55c4cd[_0xb887('0x3c')][_0xb887('0x4f')]){_0x34b4c7[_0xb887('0x50')]=[{'all':!![]}];}_0x34b4c7=_[_0xb887('0x47')]({},_0x34b4c7,_0x55c4cd['options']);return db[_0xb887('0x4b')][_0xb887('0x51')](_0x34b4c7)[_0xb887('0x1c')](handleEntityNotFound(_0x484b30,null))['then'](respondWithResult(_0x484b30,null))[_0xb887('0x27')](handleError(_0x484b30,null));};exports[_0xb887('0x52')]=function(_0x1e300b,_0x59e9c1){return db['SugarcrmConfiguration'][_0xb887('0x52')](_0x1e300b[_0xb887('0x53')],{})[_0xb887('0x1c')](respondWithResult(_0x59e9c1,0xc9))[_0xb887('0x27')](handleError(_0x59e9c1,null));};exports[_0xb887('0x32')]=function(_0x399f28,_0x33ef28){if(_0x399f28[_0xb887('0x53')]['id']){delete _0x399f28[_0xb887('0x53')]['id'];}return db['SugarcrmConfiguration'][_0xb887('0x51')]({'where':{'id':_0x399f28[_0xb887('0x4d')]['id']}})[_0xb887('0x1c')](handleEntityNotFound(_0x33ef28,null))[_0xb887('0x1c')](saveUpdates(_0x399f28[_0xb887('0x53')],null))['then'](respondWithResult(_0x33ef28,null))[_0xb887('0x27')](handleError(_0x33ef28,null));};exports[_0xb887('0x33')]=function(_0x45172b,_0x4b86ac){return db[_0xb887('0x4b')]['find']({'where':{'id':_0x45172b[_0xb887('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4b86ac,null))['then'](removeEntity(_0x4b86ac,null))['catch'](handleError(_0x4b86ac,null));};exports['getFields']=function(_0x395fa4,_0x244c59,_0x1864a8){var _0x22843f={};var _0x50575c={};var _0x538203;var _0x5b2d18;return db[_0xb887('0x4b')]['findOne']({'where':{'id':_0x395fa4[_0xb887('0x4d')]['id']}})[_0xb887('0x1c')](handleEntityNotFound(_0x244c59,null))[_0xb887('0x1c')](function(_0x2465ad){if(_0x2465ad){_0x538203=_0x2465ad;_0x50575c[_0xb887('0x3b')]=_[_0xb887('0x3d')](db[_0xb887('0x54')][_0xb887('0x38')]);_0x50575c[_0xb887('0x3c')]=_[_0xb887('0x3d')](_0x395fa4[_0xb887('0x3c')]);_0x50575c[_0xb887('0x3e')]=_[_0xb887('0x3f')](_0x50575c[_0xb887('0x3b')],_0x50575c[_0xb887('0x3c')]);_0x22843f[_0xb887('0x40')]=_[_0xb887('0x3f')](_0x50575c['model'],qs['fields'](_0x395fa4['query'][_0xb887('0x41')]));_0x22843f[_0xb887('0x40')]=_0x22843f[_0xb887('0x40')][_0xb887('0x4e')]?_0x22843f[_0xb887('0x40')]:_0x50575c['model'];_0x22843f[_0xb887('0x43')]=qs[_0xb887('0x44')](_0x395fa4[_0xb887('0x3c')][_0xb887('0x44')]);_0x22843f[_0xb887('0x45')]=qs['filters'](_[_0xb887('0x46')](_0x395fa4[_0xb887('0x3c')],_0x50575c[_0xb887('0x3e')]));if(_0x395fa4[_0xb887('0x3c')][_0xb887('0x49')]){_0x22843f[_0xb887('0x45')]=_[_0xb887('0x47')](_0x22843f[_0xb887('0x45')],{'$or':_[_0xb887('0x37')](_0x22843f[_0xb887('0x40')],function(_0x426dec){var _0x4013f6={};_0x4013f6[_0x426dec]={'$like':'%'+_0x395fa4[_0xb887('0x3c')]['filter']+'%'};return _0x4013f6;})});}_0x22843f=_[_0xb887('0x47')]({},_0x22843f,_0x395fa4['options']);return _0x538203[_0xb887('0x55')](_0x22843f);}})[_0xb887('0x1c')](function(_0x1ac52e){if(_0x1ac52e){_0x5b2d18=_0x1ac52e[_0xb887('0x4e')];if(!_0x395fa4[_0xb887('0x3c')][_0xb887('0x56')](_0xb887('0x42'))){_0x22843f[_0xb887('0x2e')]=qs[_0xb887('0x2e')](_0x395fa4[_0xb887('0x3c')][_0xb887('0x2e')]);_0x22843f[_0xb887('0x2d')]=qs['offset'](_0x395fa4[_0xb887('0x3c')][_0xb887('0x2d')]);}return _0x538203[_0xb887('0x55')](_0x22843f);}})[_0xb887('0x1c')](function(_0x56833d){if(_0x56833d){return _0x56833d?{'count':_0x5b2d18,'rows':_0x56833d}:null;}})[_0xb887('0x1c')](respondWithResult(_0x244c59,null))['catch'](handleError(_0x244c59,null));};exports[_0xb887('0x57')]=function(_0x17d998,_0x4cf1b9,_0x418ba9){var _0x17e6b1={};var _0x2dba76={};var _0x3413f5;var _0x495e6c;return db[_0xb887('0x4b')][_0xb887('0x58')]({'where':{'id':_0x17d998['params']['id']}})[_0xb887('0x1c')](handleEntityNotFound(_0x4cf1b9,null))[_0xb887('0x1c')](function(_0x5a914f){if(_0x5a914f){_0x3413f5=_0x5a914f;_0x2dba76[_0xb887('0x3b')]=_[_0xb887('0x3d')](db[_0xb887('0x54')][_0xb887('0x38')]);_0x2dba76[_0xb887('0x3c')]=_[_0xb887('0x3d')](_0x17d998[_0xb887('0x3c')]);_0x2dba76[_0xb887('0x3e')]=_[_0xb887('0x3f')](_0x2dba76[_0xb887('0x3b')],_0x2dba76[_0xb887('0x3c')]);_0x17e6b1[_0xb887('0x40')]=_[_0xb887('0x3f')](_0x2dba76['model'],qs[_0xb887('0x41')](_0x17d998[_0xb887('0x3c')][_0xb887('0x41')]));_0x17e6b1[_0xb887('0x40')]=_0x17e6b1['attributes']['length']?_0x17e6b1['attributes']:_0x2dba76[_0xb887('0x3b')];_0x17e6b1[_0xb887('0x43')]=qs[_0xb887('0x44')](_0x17d998[_0xb887('0x3c')]['sort']);_0x17e6b1['where']=qs['filters'](_['pick'](_0x17d998[_0xb887('0x3c')],_0x2dba76[_0xb887('0x3e')]));if(_0x17d998[_0xb887('0x3c')][_0xb887('0x49')]){_0x17e6b1[_0xb887('0x45')]=_[_0xb887('0x47')](_0x17e6b1[_0xb887('0x45')],{'$or':_[_0xb887('0x37')](_0x17e6b1[_0xb887('0x40')],function(_0x93acba){var _0x3a0414={};_0x3a0414[_0x93acba]={'$like':'%'+_0x17d998[_0xb887('0x3c')][_0xb887('0x49')]+'%'};return _0x3a0414;})});}_0x17e6b1=_[_0xb887('0x47')]({},_0x17e6b1,_0x17d998['options']);return _0x3413f5[_0xb887('0x57')](_0x17e6b1);}})['then'](function(_0x1de85e){if(_0x1de85e){_0x495e6c=_0x1de85e[_0xb887('0x4e')];if(!_0x17d998[_0xb887('0x3c')][_0xb887('0x56')](_0xb887('0x42'))){_0x17e6b1[_0xb887('0x2e')]=qs[_0xb887('0x2e')](_0x17d998[_0xb887('0x3c')][_0xb887('0x2e')]);_0x17e6b1['offset']=qs['offset'](_0x17d998['query'][_0xb887('0x2d')]);}return _0x3413f5[_0xb887('0x57')](_0x17e6b1);}})[_0xb887('0x1c')](function(_0x2c9ec3){if(_0x2c9ec3){return _0x2c9ec3?{'count':_0x495e6c,'rows':_0x2c9ec3}:null;}})[_0xb887('0x1c')](respondWithResult(_0x4cf1b9,null))[_0xb887('0x27')](handleError(_0x4cf1b9,null));};exports[_0xb887('0x59')]=function(_0x4e8da0,_0x48348a,_0x599c81){var _0x9ab7ee={};var _0x5ac20d={};var _0x18ba20;var _0x2a9322;return db[_0xb887('0x4b')]['findOne']({'where':{'id':_0x4e8da0[_0xb887('0x4d')]['id']}})[_0xb887('0x1c')](handleEntityNotFound(_0x48348a,null))['then'](function(_0xa4f4e4){if(_0xa4f4e4){_0x18ba20=_0xa4f4e4;_0x5ac20d[_0xb887('0x3b')]=_['keys'](db[_0xb887('0x54')][_0xb887('0x38')]);_0x5ac20d[_0xb887('0x3c')]=_['keys'](_0x4e8da0['query']);_0x5ac20d[_0xb887('0x3e')]=_[_0xb887('0x3f')](_0x5ac20d[_0xb887('0x3b')],_0x5ac20d['query']);_0x9ab7ee[_0xb887('0x40')]=_['intersection'](_0x5ac20d[_0xb887('0x3b')],qs[_0xb887('0x41')](_0x4e8da0[_0xb887('0x3c')][_0xb887('0x41')]));_0x9ab7ee[_0xb887('0x40')]=_0x9ab7ee['attributes'][_0xb887('0x4e')]?_0x9ab7ee['attributes']:_0x5ac20d[_0xb887('0x3b')];_0x9ab7ee['order']=qs[_0xb887('0x44')](_0x4e8da0[_0xb887('0x3c')][_0xb887('0x44')]);_0x9ab7ee[_0xb887('0x45')]=qs[_0xb887('0x3e')](_[_0xb887('0x46')](_0x4e8da0[_0xb887('0x3c')],_0x5ac20d[_0xb887('0x3e')]));if(_0x4e8da0[_0xb887('0x3c')][_0xb887('0x49')]){_0x9ab7ee['where']=_['merge'](_0x9ab7ee['where'],{'$or':_[_0xb887('0x37')](_0x9ab7ee[_0xb887('0x40')],function(_0x147ad4){var _0xfa8015={};_0xfa8015[_0x147ad4]={'$like':'%'+_0x4e8da0[_0xb887('0x3c')][_0xb887('0x49')]+'%'};return _0xfa8015;})});}_0x9ab7ee=_[_0xb887('0x47')]({},_0x9ab7ee,_0x4e8da0[_0xb887('0x4a')]);return _0x18ba20[_0xb887('0x59')](_0x9ab7ee);}})[_0xb887('0x1c')](function(_0x33d978){if(_0x33d978){_0x2a9322=_0x33d978[_0xb887('0x4e')];if(!_0x4e8da0['query'][_0xb887('0x56')]('nolimit')){_0x9ab7ee[_0xb887('0x2e')]=qs[_0xb887('0x2e')](_0x4e8da0[_0xb887('0x3c')]['limit']);_0x9ab7ee[_0xb887('0x2d')]=qs[_0xb887('0x2d')](_0x4e8da0[_0xb887('0x3c')][_0xb887('0x2d')]);}return _0x18ba20[_0xb887('0x59')](_0x9ab7ee);}})[_0xb887('0x1c')](function(_0x75afe9){if(_0x75afe9){return _0x75afe9?{'count':_0x2a9322,'rows':_0x75afe9}:null;}})[_0xb887('0x1c')](respondWithResult(_0x48348a,null))[_0xb887('0x27')](handleError(_0x48348a,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 9c6c2bf..c1d0012 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 _0x93f3=['path','rimraf','../../config/environment','exports','SugarcrmConfiguration','int_sugarcrm_configurations','../../config/logger','moment','bluebird','request-promise'];(function(_0x2459fd,_0x575d9b){var _0x364cd2=function(_0x4b22f6){while(--_0x4b22f6){_0x2459fd['push'](_0x2459fd['shift']());}};_0x364cd2(++_0x575d9b);}(_0x93f3,0x132));var _0x393f=function(_0x4cc478,_0xdfd578){_0x4cc478=_0x4cc478-0x0;var _0x58ec14=_0x93f3[_0x4cc478];return _0x58ec14;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x393f('0x0'))('api');var moment=require(_0x393f('0x1'));var BPromise=require(_0x393f('0x2'));var rp=require(_0x393f('0x3'));var fs=require('fs');var path=require(_0x393f('0x4'));var rimraf=require(_0x393f('0x5'));var config=require(_0x393f('0x6'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x393f('0x7')]=function(_0x331e7e,_0x4c66bf){return _0x331e7e['define'](_0x393f('0x8'),attributes,{'tableName':_0x393f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17ea=['path','rimraf','../../config/environment','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x17ea,0x18c));var _0xa17e=function(_0x6a8e0f,_0x312db8){_0x6a8e0f=_0x6a8e0f-0x0;var _0xa8de38=_0x17ea[_0x6a8e0f];return _0xa8de38;};'use strict';var _=require(_0xa17e('0x0'));var util=require(_0xa17e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa17e('0x2'));var BPromise=require(_0xa17e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa17e('0x4'));var rimraf=require(_0xa17e('0x5'));var config=require(_0xa17e('0x6'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xa17e('0x7')]=function(_0x926b07,_0x36b39a){return _0x926b07['define'](_0xa17e('0x8'),attributes,{'tableName':_0xa17e('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 8073cab..029129b 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 _0x9ded=['debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x2f4fac,_0x2e96fd){var _0x455741=function(_0x9cd5f3){while(--_0x9cd5f3){_0x2f4fac['push'](_0x2f4fac['shift']());}};_0x455741(++_0x2e96fd);}(_0x9ded,0x13c));var _0xd9de=function(_0x4a73dd,_0x58e46c){_0x4a73dd=_0x4a73dd-0x0;var _0x279e6b=_0x9ded[_0x4a73dd];return _0x279e6b;};'use strict';var _=require('lodash');var util=require(_0xd9de('0x0'));var moment=require(_0xd9de('0x1'));var BPromise=require(_0xd9de('0x2'));var rs=require(_0xd9de('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd9de('0x4'));var logger=require(_0xd9de('0x5'))(_0xd9de('0x6'));var config=require(_0xd9de('0x7'));var jayson=require(_0xd9de('0x8'));var client=jayson[_0xd9de('0x9')][_0xd9de('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19f024,_0x1aa5f1,_0x26311a){return new BPromise(function(_0x362034,_0x2ef470){return client['request'](_0x19f024,_0x26311a)[_0xd9de('0xb')](function(_0x494690){logger['info'](_0xd9de('0xc'),_0x1aa5f1,_0xd9de('0xd'));logger[_0xd9de('0xe')](_0xd9de('0xf'),_0x1aa5f1,_0xd9de('0xd'),JSON[_0xd9de('0x10')](_0x494690));if(_0x494690[_0xd9de('0x11')]){if(_0x494690[_0xd9de('0x11')]['code']===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x1aa5f1,_0x494690[_0xd9de('0x11')][_0xd9de('0x12')]);return _0x2ef470(_0x494690[_0xd9de('0x11')][_0xd9de('0x12')]);}logger[_0xd9de('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1aa5f1,_0x494690[_0xd9de('0x11')]['message']);return _0x362034(_0x494690[_0xd9de('0x11')][_0xd9de('0x12')]);}else{logger[_0xd9de('0x13')](_0xd9de('0xc'),_0x1aa5f1,_0xd9de('0xd'));_0x362034(_0x494690[_0xd9de('0x14')][_0xd9de('0x12')]);}})[_0xd9de('0x15')](function(_0xeec5d0){logger[_0xd9de('0x11')](_0xd9de('0xc'),_0x1aa5f1,_0xeec5d0);_0x2ef470(_0xeec5d0);});});} \ No newline at end of file +var _0x792b=['lodash','moment','../../config/logger','rpc','../../config/environment','client','http','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','message','info','catch'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x792b,0x140));var _0xb792=function(_0x5a92ad,_0x2219a6){_0x5a92ad=_0x5a92ad-0x0;var _0x2466f8=_0x792b[_0x5a92ad];return _0x2466f8;};'use strict';var _=require(_0xb792('0x0'));var util=require('util');var moment=require(_0xb792('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb792('0x2'))(_0xb792('0x3'));var config=require(_0xb792('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xb792('0x5')][_0xb792('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1036c4,_0x3c587b,_0x2b0cfc){return new BPromise(function(_0x57a4be,_0x187976){return client['request'](_0x1036c4,_0x2b0cfc)[_0xb792('0x7')](function(_0x789ed5){logger['info'](_0xb792('0x8'),_0x3c587b,_0xb792('0x9'));logger[_0xb792('0xa')](_0xb792('0xb'),_0x3c587b,_0xb792('0x9'),JSON['stringify'](_0x789ed5));if(_0x789ed5['error']){if(_0x789ed5[_0xb792('0xc')]['code']===0x1f4){logger[_0xb792('0xc')](_0xb792('0x8'),_0x3c587b,_0x789ed5[_0xb792('0xc')][_0xb792('0xd')]);return _0x187976(_0x789ed5[_0xb792('0xc')][_0xb792('0xd')]);}logger[_0xb792('0xc')](_0xb792('0x8'),_0x3c587b,_0x789ed5[_0xb792('0xc')][_0xb792('0xd')]);return _0x57a4be(_0x789ed5[_0xb792('0xc')]['message']);}else{logger[_0xb792('0xe')](_0xb792('0x8'),_0x3c587b,'request\x20sent');_0x57a4be(_0x789ed5['result'][_0xb792('0xd')]);}})[_0xb792('0xf')](function(_0x406985){logger[_0xb792('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3c587b,_0x406985);_0x187976(_0x406985);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 3eb94d2..c76de47 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 _0xb05d=['/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','show','create'];(function(_0x2ba818,_0x41e97b){var _0x53c1d2=function(_0x142e43){while(--_0x142e43){_0x2ba818['push'](_0x2ba818['shift']());}};_0x53c1d2(++_0x41e97b);}(_0xb05d,0x1d9));var _0xdb05=function(_0x10d670,_0x178996){_0x10d670=_0x10d670-0x0;var _0x20d6f8=_0xb05d[_0x10d670];return _0x20d6f8;};'use strict';var multer=require(_0xdb05('0x0'));var util=require('util');var path=require(_0xdb05('0x1'));var timeout=require(_0xdb05('0x2'));var express=require('express');var router=express[_0xdb05('0x3')]();var fs_extra=require(_0xdb05('0x4'));var auth=require(_0xdb05('0x5'));var interaction=require(_0xdb05('0x6'));var config=require(_0xdb05('0x7'));var controller=require(_0xdb05('0x8'));router[_0xdb05('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdb05('0x9')]('/:id',auth[_0xdb05('0xa')](),controller[_0xdb05('0xb')]);router['post']('/',auth[_0xdb05('0xa')](),controller[_0xdb05('0xc')]);router['put'](_0xdb05('0xd'),auth['isAuthenticated'](),controller[_0xdb05('0xe')]);router[_0xdb05('0xf')](_0xdb05('0xd'),auth[_0xdb05('0xa')](),controller[_0xdb05('0x10')]);module[_0xdb05('0x11')]=router; \ No newline at end of file +var _0x6ae2=['../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6ae2,0x1ed));var _0x26ae=function(_0x26ae31,_0x3f8239){_0x26ae31=_0x26ae31-0x0;var _0x396e9b=_0x6ae2[_0x26ae31];return _0x396e9b;};'use strict';var multer=require(_0x26ae('0x0'));var util=require(_0x26ae('0x1'));var path=require(_0x26ae('0x2'));var timeout=require(_0x26ae('0x3'));var express=require(_0x26ae('0x4'));var router=express[_0x26ae('0x5')]();var fs_extra=require(_0x26ae('0x6'));var auth=require(_0x26ae('0x7'));var interaction=require(_0x26ae('0x8'));var config=require('../../config/environment');var controller=require(_0x26ae('0x9'));router[_0x26ae('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x26ae('0xa')](_0x26ae('0xb'),auth[_0x26ae('0xc')](),controller[_0x26ae('0xd')]);router[_0x26ae('0xe')]('/',auth[_0x26ae('0xc')](),controller[_0x26ae('0xf')]);router[_0x26ae('0x10')](_0x26ae('0xb'),auth[_0x26ae('0xc')](),controller[_0x26ae('0x11')]);router[_0x26ae('0x12')]('/:id',auth[_0x26ae('0xc')](),controller['destroy']);module[_0x26ae('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 4019f35..d003b9e 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 _0x07c3=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x5778aa,_0x56c194){var _0x4f5f06=function(_0x4d6df2){while(--_0x4d6df2){_0x5778aa['push'](_0x5778aa['shift']());}};_0x4f5f06(++_0x56c194);}(_0x07c3,0x1bf));var _0x307c=function(_0x33975c,_0x50d085){_0x33975c=_0x33975c-0x0;var _0x1c15ab=_0x07c3[_0x33975c];return _0x1c15ab;};'use strict';var Sequelize=require(_0x307c('0x0'));module[_0x307c('0x1')]={'type':{'type':Sequelize[_0x307c('0x2')](_0x307c('0x3'),_0x307c('0x4'),_0x307c('0x5'),_0x307c('0x6'),_0x307c('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x307c('0x8')]},'key':{'type':Sequelize[_0x307c('0x8')]},'keyType':{'type':Sequelize[_0x307c('0x2')](_0x307c('0x3'),_0x307c('0x4'),_0x307c('0x5'))},'keyContent':{'type':Sequelize[_0x307c('0x8')]},'idField':{'type':Sequelize[_0x307c('0x8')]},'nameField':{'type':Sequelize[_0x307c('0x8')]},'customField':{'type':Sequelize[_0x307c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x307c('0x8')]}}; \ No newline at end of file +var _0xb49a=['BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable'];(function(_0x585970,_0x197dd2){var _0xa99602=function(_0x1eb7df){while(--_0x1eb7df){_0x585970['push'](_0x585970['shift']());}};_0xa99602(++_0x197dd2);}(_0xb49a,0xfb));var _0xab49=function(_0x54820c,_0xd5a2f6){_0x54820c=_0x54820c-0x0;var _0x5c60c1=_0xb49a[_0x54820c];return _0x5c60c1;};'use strict';var Sequelize=require(_0xab49('0x0'));module[_0xab49('0x1')]={'type':{'type':Sequelize[_0xab49('0x2')](_0xab49('0x3'),_0xab49('0x4'),'customVariable',_0xab49('0x5'),_0xab49('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xab49('0x7')]},'keyType':{'type':Sequelize[_0xab49('0x2')](_0xab49('0x3'),_0xab49('0x4'),_0xab49('0x8'))},'keyContent':{'type':Sequelize[_0xab49('0x7')]},'idField':{'type':Sequelize[_0xab49('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xab49('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xab49('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index d8d0a83..e049b04 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 _0xe205=['nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','include','findAll','catch','show','params','rawAttributes','find','create','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','SugarcrmField','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0xf200d4,_0x4faba2){var _0x5a5f16=function(_0x5963ae){while(--_0x5963ae){_0xf200d4['push'](_0xf200d4['shift']());}};_0x5a5f16(++_0x4faba2);}(_0xe205,0xa7));var _0x5e20=function(_0x48c381,_0x210f94){_0x48c381=_0x48c381-0x0;var _0x309e25=_0xe205[_0x48c381];return _0x309e25;};'use strict';var pdf=require(_0x5e20('0x0'));var emlformat=require(_0x5e20('0x1'));var rimraf=require(_0x5e20('0x2'));var zipdir=require(_0x5e20('0x3'));var jsonpatch=require(_0x5e20('0x4'));var rp=require(_0x5e20('0x5'));var moment=require(_0x5e20('0x6'));var BPromise=require(_0x5e20('0x7'));var Mustache=require(_0x5e20('0x8'));var util=require('util');var path=require(_0x5e20('0x9'));var sox=require(_0x5e20('0xa'));var csv=require(_0x5e20('0xb'));var ejs=require(_0x5e20('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5e20('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5e20('0xe'));var toCsv=require(_0x5e20('0xb'));var querystring=require('querystring');var Papa=require(_0x5e20('0xf'));var Redis=require(_0x5e20('0x10'));var authService=require(_0x5e20('0x11'));var qs=require(_0x5e20('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e20('0x13'));var logger=require(_0x5e20('0x14'))(_0x5e20('0x15'));var utils=require(_0x5e20('0x16'));var config=require(_0x5e20('0x17'));var licenseUtil=require(_0x5e20('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19eacf,_0x29b7a2){_0x29b7a2=_0x29b7a2||0xcc;return function(_0x22540d){if(_0x22540d){return _0x19eacf['sendStatus'](_0x29b7a2);}return _0x19eacf[_0x5e20('0x19')](_0x29b7a2)['end']();};}function respondWithResult(_0x1f47f3,_0x5ba833){_0x5ba833=_0x5ba833||0xc8;return function(_0x15587b){if(_0x15587b){return _0x1f47f3[_0x5e20('0x19')](_0x5ba833)[_0x5e20('0x1a')](_0x15587b);}};}function respondWithFilteredResult(_0x148ada,_0x294df8){return function(_0x542b3c){if(_0x542b3c){var _0xeaeb77=_0x542b3c[_0x5e20('0x1b')],_0x9a59ce=_0x294df8[_0x5e20('0x1c')],_0x166ffd=_0x294df8[_0x5e20('0x1c')]+_0x294df8[_0x5e20('0x1d')],_0x22c8d6;if(_0x166ffd>=_0xeaeb77){_0x166ffd=_0xeaeb77;_0x22c8d6=0xc8;}else{_0x22c8d6=0xce;}_0x148ada['status'](_0x22c8d6);return _0x148ada[_0x5e20('0x1e')](_0x5e20('0x1f'),_0x9a59ce+'-'+_0x166ffd+'/'+_0xeaeb77)['json'](_0x542b3c);}return null;};}function patchUpdates(_0x295eb3){return function(_0x1b1457){try{jsonpatch[_0x5e20('0x20')](_0x1b1457,_0x295eb3,!![]);}catch(_0x2d373d){return BPromise['reject'](_0x2d373d);}return _0x1b1457[_0x5e20('0x21')]();};}function saveUpdates(_0x50f222,_0x4a3587){return function(_0x57c7c5){if(_0x57c7c5){return _0x57c7c5['update'](_0x50f222)[_0x5e20('0x22')](function(_0x5cca90){return _0x5cca90;});}return null;};}function removeEntity(_0x3d89e4,_0x29b111){return function(_0x30d849){if(_0x30d849){return _0x30d849[_0x5e20('0x23')]()[_0x5e20('0x22')](function(){_0x3d89e4[_0x5e20('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15705f,_0x5a755f){return function(_0x52d4f5){if(!_0x52d4f5){_0x15705f[_0x5e20('0x24')](0x194);}return _0x52d4f5;};}function handleError(_0x58d678,_0x2bae08){_0x2bae08=_0x2bae08||0x1f4;return function(_0x1b01af){logger[_0x5e20('0x25')](_0x1b01af[_0x5e20('0x26')]);if(_0x1b01af[_0x5e20('0x27')]){delete _0x1b01af['name'];}_0x58d678[_0x5e20('0x19')](_0x2bae08)[_0x5e20('0x28')](_0x1b01af);};}exports[_0x5e20('0x29')]=function(_0x3032ef,_0x4c799d){var _0x3a0f06={},_0x2c5d80={},_0x37f09a={'count':0x0,'rows':[]};var _0x222e7a=_[_0x5e20('0x2a')](db[_0x5e20('0x2b')]['rawAttributes'],function(_0xbc2b0e){return{'name':_0xbc2b0e[_0x5e20('0x2c')],'type':_0xbc2b0e['type'][_0x5e20('0x2d')]};});_0x2c5d80[_0x5e20('0x2e')]=_[_0x5e20('0x2a')](_0x222e7a,_0x5e20('0x27'));_0x2c5d80[_0x5e20('0x2f')]=_[_0x5e20('0x30')](_0x3032ef['query']);_0x2c5d80[_0x5e20('0x31')]=_[_0x5e20('0x32')](_0x2c5d80[_0x5e20('0x2e')],_0x2c5d80[_0x5e20('0x2f')]);_0x3a0f06[_0x5e20('0x33')]=_[_0x5e20('0x32')](_0x2c5d80[_0x5e20('0x2e')],qs[_0x5e20('0x34')](_0x3032ef[_0x5e20('0x2f')][_0x5e20('0x34')]));_0x3a0f06[_0x5e20('0x33')]=_0x3a0f06['attributes'][_0x5e20('0x35')]?_0x3a0f06[_0x5e20('0x33')]:_0x2c5d80[_0x5e20('0x2e')];if(!_0x3032ef['query'][_0x5e20('0x36')](_0x5e20('0x37'))){_0x3a0f06[_0x5e20('0x1d')]=qs[_0x5e20('0x1d')](_0x3032ef[_0x5e20('0x2f')][_0x5e20('0x1d')]);_0x3a0f06[_0x5e20('0x1c')]=qs[_0x5e20('0x1c')](_0x3032ef[_0x5e20('0x2f')][_0x5e20('0x1c')]);}_0x3a0f06[_0x5e20('0x38')]=qs[_0x5e20('0x39')](_0x3032ef[_0x5e20('0x2f')][_0x5e20('0x39')]);_0x3a0f06['where']=qs[_0x5e20('0x31')](_['pick'](_0x3032ef['query'],_0x2c5d80[_0x5e20('0x31')]),_0x222e7a);if(_0x3032ef[_0x5e20('0x2f')]['filter']){_0x3a0f06[_0x5e20('0x3a')]=_[_0x5e20('0x3b')](_0x3a0f06['where'],{'$or':_[_0x5e20('0x2a')](_0x222e7a,function(_0x21292a){if(_0x21292a[_0x5e20('0x3c')]!==_0x5e20('0x3d')){var _0x15ce1d={};_0x15ce1d[_0x21292a[_0x5e20('0x27')]]={'$like':'%'+_0x3032ef[_0x5e20('0x2f')][_0x5e20('0x3e')]+'%'};return _0x15ce1d;}})});}_0x3a0f06=_[_0x5e20('0x3b')]({},_0x3a0f06,_0x3032ef[_0x5e20('0x3f')]);var _0x473b69={'where':_0x3a0f06[_0x5e20('0x3a')]};return db[_0x5e20('0x2b')][_0x5e20('0x1b')](_0x473b69)[_0x5e20('0x22')](function(_0x3d618c){_0x37f09a[_0x5e20('0x1b')]=_0x3d618c;if(_0x3032ef[_0x5e20('0x2f')]['includeAll']){_0x3a0f06[_0x5e20('0x40')]=[{'all':!![]}];}return db[_0x5e20('0x2b')][_0x5e20('0x41')](_0x3a0f06);})[_0x5e20('0x22')](function(_0x39018d){_0x37f09a['rows']=_0x39018d;return _0x37f09a;})[_0x5e20('0x22')](respondWithFilteredResult(_0x4c799d,_0x3a0f06))[_0x5e20('0x42')](handleError(_0x4c799d,null));};exports[_0x5e20('0x43')]=function(_0x24c05f,_0x4d973a){var _0x30d3ef={'raw':!![],'where':{'id':_0x24c05f[_0x5e20('0x44')]['id']}},_0x5c7ae8={};_0x5c7ae8[_0x5e20('0x2e')]=_[_0x5e20('0x30')](db['SugarcrmField'][_0x5e20('0x45')]);_0x5c7ae8[_0x5e20('0x2f')]=_[_0x5e20('0x30')](_0x24c05f[_0x5e20('0x2f')]);_0x5c7ae8[_0x5e20('0x31')]=_[_0x5e20('0x32')](_0x5c7ae8[_0x5e20('0x2e')],_0x5c7ae8[_0x5e20('0x2f')]);_0x30d3ef['attributes']=_[_0x5e20('0x32')](_0x5c7ae8[_0x5e20('0x2e')],qs[_0x5e20('0x34')](_0x24c05f['query'][_0x5e20('0x34')]));_0x30d3ef['attributes']=_0x30d3ef[_0x5e20('0x33')][_0x5e20('0x35')]?_0x30d3ef[_0x5e20('0x33')]:_0x5c7ae8[_0x5e20('0x2e')];if(_0x24c05f[_0x5e20('0x2f')]['includeAll']){_0x30d3ef[_0x5e20('0x40')]=[{'all':!![]}];}_0x30d3ef=_['merge']({},_0x30d3ef,_0x24c05f['options']);return db[_0x5e20('0x2b')][_0x5e20('0x46')](_0x30d3ef)[_0x5e20('0x22')](handleEntityNotFound(_0x4d973a,null))[_0x5e20('0x22')](respondWithResult(_0x4d973a,null))[_0x5e20('0x42')](handleError(_0x4d973a,null));};exports[_0x5e20('0x47')]=function(_0x57c794,_0x59c79f){return db['SugarcrmField'][_0x5e20('0x47')](_0x57c794[_0x5e20('0x48')],{})['then'](respondWithResult(_0x59c79f,0xc9))[_0x5e20('0x42')](handleError(_0x59c79f,null));};exports[_0x5e20('0x49')]=function(_0xf1e97c,_0x3bd5b8){if(_0xf1e97c[_0x5e20('0x48')]['id']){delete _0xf1e97c['body']['id'];}return db[_0x5e20('0x2b')][_0x5e20('0x46')]({'where':{'id':_0xf1e97c[_0x5e20('0x44')]['id']}})[_0x5e20('0x22')](handleEntityNotFound(_0x3bd5b8,null))[_0x5e20('0x22')](saveUpdates(_0xf1e97c[_0x5e20('0x48')],null))[_0x5e20('0x22')](respondWithResult(_0x3bd5b8,null))[_0x5e20('0x42')](handleError(_0x3bd5b8,null));};exports['destroy']=function(_0x5bbc8e,_0x4ea7d9){return db[_0x5e20('0x2b')][_0x5e20('0x46')]({'where':{'id':_0x5bbc8e['params']['id']}})[_0x5e20('0x22')](handleEntityNotFound(_0x4ea7d9,null))['then'](removeEntity(_0x4ea7d9,null))[_0x5e20('0x42')](handleError(_0x4ea7d9,null));}; \ No newline at end of file +var _0x16d2=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','end','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','merge','where','filter','options','includeAll','include','findAll','rows','catch','show','find','create','params','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x466a1a,_0x37933b){var _0x577165=function(_0x4c97b9){while(--_0x4c97b9){_0x466a1a['push'](_0x466a1a['shift']());}};_0x577165(++_0x37933b);}(_0x16d2,0x123));var _0x216d=function(_0x56a60a,_0xf4c330){_0x56a60a=_0x56a60a-0x0;var _0x5c4057=_0x16d2[_0x56a60a];return _0x5c4057;};'use strict';var pdf=require(_0x216d('0x0'));var emlformat=require(_0x216d('0x1'));var rimraf=require(_0x216d('0x2'));var zipdir=require(_0x216d('0x3'));var jsonpatch=require(_0x216d('0x4'));var rp=require(_0x216d('0x5'));var moment=require(_0x216d('0x6'));var BPromise=require(_0x216d('0x7'));var Mustache=require(_0x216d('0x8'));var util=require('util');var path=require(_0x216d('0x9'));var sox=require(_0x216d('0xa'));var csv=require(_0x216d('0xb'));var ejs=require(_0x216d('0xc'));var fs=require('fs');var fs_extra=require(_0x216d('0xd'));var _=require(_0x216d('0xe'));var squel=require(_0x216d('0xf'));var crypto=require(_0x216d('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x216d('0x11'));var toCsv=require(_0x216d('0xb'));var querystring=require(_0x216d('0x12'));var Papa=require(_0x216d('0x13'));var Redis=require(_0x216d('0x14'));var authService=require(_0x216d('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x216d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x216d('0x17'))(_0x216d('0x18'));var utils=require(_0x216d('0x19'));var config=require(_0x216d('0x1a'));var licenseUtil=require(_0x216d('0x1b'));var db=require(_0x216d('0x1c'))['db'];function respondWithStatusCode(_0x4c92d9,_0xb36a43){_0xb36a43=_0xb36a43||0xcc;return function(_0x4c07d0){if(_0x4c07d0){return _0x4c92d9[_0x216d('0x1d')](_0xb36a43);}return _0x4c92d9[_0x216d('0x1e')](_0xb36a43)['end']();};}function respondWithResult(_0x165c19,_0x322e4b){_0x322e4b=_0x322e4b||0xc8;return function(_0x54a816){if(_0x54a816){return _0x165c19[_0x216d('0x1e')](_0x322e4b)['json'](_0x54a816);}};}function respondWithFilteredResult(_0x448c0d,_0xf571a4){return function(_0x4631b0){if(_0x4631b0){var _0x23ff86=_0x4631b0[_0x216d('0x1f')],_0x3e5585=_0xf571a4[_0x216d('0x20')],_0x304dfa=_0xf571a4['offset']+_0xf571a4[_0x216d('0x21')],_0x467cd5;if(_0x304dfa>=_0x23ff86){_0x304dfa=_0x23ff86;_0x467cd5=0xc8;}else{_0x467cd5=0xce;}_0x448c0d['status'](_0x467cd5);return _0x448c0d['set'](_0x216d('0x22'),_0x3e5585+'-'+_0x304dfa+'/'+_0x23ff86)[_0x216d('0x23')](_0x4631b0);}return null;};}function patchUpdates(_0x574758){return function(_0x3f32e0){try{jsonpatch[_0x216d('0x24')](_0x3f32e0,_0x574758,!![]);}catch(_0x5abab0){return BPromise[_0x216d('0x25')](_0x5abab0);}return _0x3f32e0[_0x216d('0x26')]();};}function saveUpdates(_0x430e81,_0x3e9818){return function(_0x5c3e03){if(_0x5c3e03){return _0x5c3e03[_0x216d('0x27')](_0x430e81)[_0x216d('0x28')](function(_0x10f299){return _0x10f299;});}return null;};}function removeEntity(_0x438981,_0x206782){return function(_0x57cfbd){if(_0x57cfbd){return _0x57cfbd[_0x216d('0x29')]()[_0x216d('0x28')](function(){_0x438981[_0x216d('0x1e')](0xcc)[_0x216d('0x2a')]();});}};}function handleEntityNotFound(_0x6fa4b3,_0x54d96f){return function(_0x68d7){if(!_0x68d7){_0x6fa4b3[_0x216d('0x1d')](0x194);}return _0x68d7;};}function handleError(_0xb9f1e,_0x5998a1){_0x5998a1=_0x5998a1||0x1f4;return function(_0x4ec8a7){logger['error'](_0x4ec8a7['stack']);if(_0x4ec8a7['name']){delete _0x4ec8a7[_0x216d('0x2b')];}_0xb9f1e[_0x216d('0x1e')](_0x5998a1)[_0x216d('0x2c')](_0x4ec8a7);};}exports[_0x216d('0x2d')]=function(_0x46d0ef,_0x47fa6d){var _0x5b21d8={},_0xa7624a={},_0x51b2bd={'count':0x0,'rows':[]};var _0x23d1c3=_[_0x216d('0x2e')](db[_0x216d('0x2f')][_0x216d('0x30')],function(_0x307f2b){return{'name':_0x307f2b[_0x216d('0x31')],'type':_0x307f2b[_0x216d('0x32')][_0x216d('0x33')]};});_0xa7624a[_0x216d('0x34')]=_[_0x216d('0x2e')](_0x23d1c3,_0x216d('0x2b'));_0xa7624a[_0x216d('0x35')]=_[_0x216d('0x36')](_0x46d0ef['query']);_0xa7624a[_0x216d('0x37')]=_[_0x216d('0x38')](_0xa7624a[_0x216d('0x34')],_0xa7624a['query']);_0x5b21d8[_0x216d('0x39')]=_[_0x216d('0x38')](_0xa7624a[_0x216d('0x34')],qs[_0x216d('0x3a')](_0x46d0ef['query'][_0x216d('0x3a')]));_0x5b21d8[_0x216d('0x39')]=_0x5b21d8[_0x216d('0x39')][_0x216d('0x3b')]?_0x5b21d8[_0x216d('0x39')]:_0xa7624a[_0x216d('0x34')];if(!_0x46d0ef[_0x216d('0x35')][_0x216d('0x3c')](_0x216d('0x3d'))){_0x5b21d8[_0x216d('0x21')]=qs[_0x216d('0x21')](_0x46d0ef['query'][_0x216d('0x21')]);_0x5b21d8[_0x216d('0x20')]=qs[_0x216d('0x20')](_0x46d0ef['query'][_0x216d('0x20')]);}_0x5b21d8[_0x216d('0x3e')]=qs['sort'](_0x46d0ef[_0x216d('0x35')]['sort']);_0x5b21d8['where']=qs[_0x216d('0x37')](_[_0x216d('0x3f')](_0x46d0ef[_0x216d('0x35')],_0xa7624a[_0x216d('0x37')]),_0x23d1c3);if(_0x46d0ef['query']['filter']){_0x5b21d8['where']=_[_0x216d('0x40')](_0x5b21d8[_0x216d('0x41')],{'$or':_['map'](_0x23d1c3,function(_0x3ff9a0){if(_0x3ff9a0[_0x216d('0x32')]!=='VIRTUAL'){var _0xe49ba4={};_0xe49ba4[_0x3ff9a0[_0x216d('0x2b')]]={'$like':'%'+_0x46d0ef[_0x216d('0x35')][_0x216d('0x42')]+'%'};return _0xe49ba4;}})});}_0x5b21d8=_[_0x216d('0x40')]({},_0x5b21d8,_0x46d0ef[_0x216d('0x43')]);var _0x35cb6e={'where':_0x5b21d8[_0x216d('0x41')]};return db['SugarcrmField']['count'](_0x35cb6e)[_0x216d('0x28')](function(_0x2be24f){_0x51b2bd['count']=_0x2be24f;if(_0x46d0ef[_0x216d('0x35')][_0x216d('0x44')]){_0x5b21d8[_0x216d('0x45')]=[{'all':!![]}];}return db['SugarcrmField'][_0x216d('0x46')](_0x5b21d8);})[_0x216d('0x28')](function(_0x13d787){_0x51b2bd[_0x216d('0x47')]=_0x13d787;return _0x51b2bd;})['then'](respondWithFilteredResult(_0x47fa6d,_0x5b21d8))[_0x216d('0x48')](handleError(_0x47fa6d,null));};exports[_0x216d('0x49')]=function(_0x5665d7,_0x37bf4a){var _0x306e9f={'raw':!![],'where':{'id':_0x5665d7['params']['id']}},_0x590eb6={};_0x590eb6[_0x216d('0x34')]=_[_0x216d('0x36')](db[_0x216d('0x2f')]['rawAttributes']);_0x590eb6[_0x216d('0x35')]=_['keys'](_0x5665d7['query']);_0x590eb6[_0x216d('0x37')]=_[_0x216d('0x38')](_0x590eb6[_0x216d('0x34')],_0x590eb6['query']);_0x306e9f[_0x216d('0x39')]=_['intersection'](_0x590eb6[_0x216d('0x34')],qs[_0x216d('0x3a')](_0x5665d7[_0x216d('0x35')]['fields']));_0x306e9f[_0x216d('0x39')]=_0x306e9f[_0x216d('0x39')][_0x216d('0x3b')]?_0x306e9f[_0x216d('0x39')]:_0x590eb6['model'];if(_0x5665d7['query']['includeAll']){_0x306e9f[_0x216d('0x45')]=[{'all':!![]}];}_0x306e9f=_[_0x216d('0x40')]({},_0x306e9f,_0x5665d7[_0x216d('0x43')]);return db[_0x216d('0x2f')][_0x216d('0x4a')](_0x306e9f)[_0x216d('0x28')](handleEntityNotFound(_0x37bf4a,null))[_0x216d('0x28')](respondWithResult(_0x37bf4a,null))[_0x216d('0x48')](handleError(_0x37bf4a,null));};exports['create']=function(_0x3771dc,_0x2c6248){return db[_0x216d('0x2f')][_0x216d('0x4b')](_0x3771dc['body'],{})[_0x216d('0x28')](respondWithResult(_0x2c6248,0xc9))['catch'](handleError(_0x2c6248,null));};exports[_0x216d('0x27')]=function(_0x36179,_0xceb993){if(_0x36179['body']['id']){delete _0x36179['body']['id'];}return db[_0x216d('0x2f')][_0x216d('0x4a')]({'where':{'id':_0x36179[_0x216d('0x4c')]['id']}})[_0x216d('0x28')](handleEntityNotFound(_0xceb993,null))[_0x216d('0x28')](saveUpdates(_0x36179[_0x216d('0x4d')],null))['then'](respondWithResult(_0xceb993,null))['catch'](handleError(_0xceb993,null));};exports[_0x216d('0x29')]=function(_0x542630,_0x1e0dc9){return db[_0x216d('0x2f')]['find']({'where':{'id':_0x542630['params']['id']}})['then'](handleEntityNotFound(_0x1e0dc9,null))['then'](removeEntity(_0x1e0dc9,null))[_0x216d('0x48')](handleError(_0x1e0dc9,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index a217b11..46f1195 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 _0xc6e8=['FieldId','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','idField'];(function(_0x3d37a4,_0x28aadb){var _0x2c1495=function(_0x2e5fd6){while(--_0x2e5fd6){_0x3d37a4['push'](_0x3d37a4['shift']());}};_0x2c1495(++_0x28aadb);}(_0xc6e8,0x16d));var _0x8c6e=function(_0x48c652,_0x379b57){_0x48c652=_0x48c652-0x0;var _0x5d9163=_0xc6e8[_0x48c652];return _0x5d9163;};'use strict';var _=require(_0x8c6e('0x0'));var util=require('util');var logger=require(_0x8c6e('0x1'))(_0x8c6e('0x2'));var moment=require(_0x8c6e('0x3'));var BPromise=require(_0x8c6e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8c6e('0x5'));var config=require(_0x8c6e('0x6'));var attributes=require(_0x8c6e('0x7'));module[_0x8c6e('0x8')]=function(_0x169287,_0x26d19e){return _0x169287[_0x8c6e('0x9')](_0x8c6e('0xa'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x8c6e('0xb'),'fields':[_0x8c6e('0xc'),_0x8c6e('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xab47=['sugarcrm_unique_index','idField','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intSugarcrmField.attributes','define','SugarcrmField','int_sugarcrm_fields'];(function(_0x1a05ee,_0x19c15e){var _0x4fabe9=function(_0x11f5f5){while(--_0x11f5f5){_0x1a05ee['push'](_0x1a05ee['shift']());}};_0x4fabe9(++_0x19c15e);}(_0xab47,0x6a));var _0x7ab4=function(_0x506d2f,_0x5ab76e){_0x506d2f=_0x506d2f-0x0;var _0x101255=_0xab47[_0x506d2f];return _0x101255;};'use strict';var _=require(_0x7ab4('0x0'));var util=require('util');var logger=require(_0x7ab4('0x1'))('api');var moment=require(_0x7ab4('0x2'));var BPromise=require(_0x7ab4('0x3'));var rp=require(_0x7ab4('0x4'));var fs=require('fs');var path=require(_0x7ab4('0x5'));var rimraf=require(_0x7ab4('0x6'));var config=require('../../config/environment');var attributes=require(_0x7ab4('0x7'));module['exports']=function(_0x5e79e0,_0x18a353){return _0x5e79e0[_0x7ab4('0x8')](_0x7ab4('0x9'),attributes,{'tableName':_0x7ab4('0xa'),'paranoid':![],'indexes':[{'name':_0x7ab4('0xb'),'fields':[_0x7ab4('0xc'),'FieldId'],'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 43f895f..d1b0c7a 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x4cb33a,_0x3ef1c4){var _0x471842=function(_0x5ba212){while(--_0x5ba212){_0x4cb33a['push'](_0x4cb33a['shift']());}};_0x471842(++_0x3ef1c4);}(_0x5f66,0x1a0));var _0x65f6=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5f66[_0x297fd3];return _0x2af381;};'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')]('SugarcrmField,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0x8603=['message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','error'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x8603,0x190));var _0x3860=function(_0x4d1645,_0x5bd694){_0x4d1645=_0x4d1645-0x0;var _0x53b408=_0x8603[_0x4d1645];return _0x53b408;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eca44,_0xd3ce26,_0x472bf2){return new BPromise(function(_0x4aba10,_0x5c7350){return client['request'](_0x1eca44,_0x472bf2)[_0x3860('0x9')](function(_0x441dc4){logger['info'](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));logger['debug'](_0x3860('0xc'),_0xd3ce26,_0x3860('0xb'),JSON['stringify'](_0x441dc4));if(_0x441dc4[_0x3860('0xd')]){if(_0x441dc4[_0x3860('0xd')]['code']===0x1f4){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x5c7350(_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);}logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x4aba10(_0x441dc4['error'][_0x3860('0xe')]);}else{logger[_0x3860('0xf')](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));_0x4aba10(_0x441dc4[_0x3860('0x10')][_0x3860('0xe')]);}})[_0x3860('0x11')](function(_0x378305){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x378305);_0x5c7350(_0x378305);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index a6a42b8..f76d932 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 _0x6439=['put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6439,0x1ce));var _0x9643=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x6439[_0x397cfb];return _0x15fed9;};'use strict';var multer=require(_0x9643('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9643('0x1'));var express=require(_0x9643('0x2'));var router=express[_0x9643('0x3')]();var fs_extra=require(_0x9643('0x4'));var auth=require(_0x9643('0x5'));var interaction=require(_0x9643('0x6'));var config=require('../../config/environment');var controller=require(_0x9643('0x7'));router['get']('/',auth[_0x9643('0x8')](),controller[_0x9643('0x9')]);router['get']('/:id',auth[_0x9643('0x8')](),controller[_0x9643('0xa')]);router['get'](_0x9643('0xb'),auth[_0x9643('0x8')](),controller[_0x9643('0xc')]);router['get'](_0x9643('0xd'),auth[_0x9643('0x8')](),controller[_0x9643('0xe')]);router[_0x9643('0xf')]('/',auth[_0x9643('0x8')](),controller[_0x9643('0x10')]);router[_0x9643('0xf')](_0x9643('0xb'),auth[_0x9643('0x8')](),controller[_0x9643('0x11')]);router[_0x9643('0x12')](_0x9643('0x13'),auth[_0x9643('0x8')](),controller[_0x9643('0x14')]);router[_0x9643('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x9643('0x16')]);module[_0x9643('0x17')]=router; \ No newline at end of file +var _0x6fc4=['../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','express','../../components/interaction/service'];(function(_0x329ab4,_0xf5b6cf){var _0x12beda=function(_0x5f387a){while(--_0x5f387a){_0x329ab4['push'](_0x329ab4['shift']());}};_0x12beda(++_0xf5b6cf);}(_0x6fc4,0x1a0));var _0x46fc=function(_0x16938f,_0x35e57f){_0x16938f=_0x16938f-0x0;var _0x5c66e9=_0x6fc4[_0x16938f];return _0x5c66e9;};'use strict';var multer=require(_0x46fc('0x0'));var util=require(_0x46fc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x46fc('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x46fc('0x3'));var config=require(_0x46fc('0x4'));var controller=require(_0x46fc('0x5'));router[_0x46fc('0x6')]('/',auth[_0x46fc('0x7')](),controller[_0x46fc('0x8')]);router[_0x46fc('0x6')](_0x46fc('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x46fc('0x6')](_0x46fc('0xa'),auth[_0x46fc('0x7')](),controller[_0x46fc('0xb')]);router['get']('/:id/fields',auth[_0x46fc('0x7')](),controller[_0x46fc('0xc')]);router['post']('/',auth[_0x46fc('0x7')](),controller['create']);router[_0x46fc('0xd')](_0x46fc('0xa'),auth[_0x46fc('0x7')](),controller[_0x46fc('0xe')]);router[_0x46fc('0xf')](_0x46fc('0x9'),auth[_0x46fc('0x7')](),controller[_0x46fc('0x10')]);router[_0x46fc('0x11')](_0x46fc('0x9'),auth[_0x46fc('0x7')](),controller[_0x46fc('0x12')]);module[_0x46fc('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 844c719..2f0f28c 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 _0x6b27=['sequelize','STRING','HelpDesk'];(function(_0x3b3017,_0x531959){var _0xd8fd8d=function(_0x537d8f){while(--_0x537d8f){_0x3b3017['push'](_0x3b3017['shift']());}};_0xd8fd8d(++_0x531959);}(_0x6b27,0xc3));var _0x76b2=function(_0x19c4bd,_0x19a00d){_0x19c4bd=_0x19c4bd-0x0;var _0x2fc7b5=_0x6b27[_0x19c4bd];return _0x2fc7b5;};'use strict';var Sequelize=require(_0x76b2('0x0'));module['exports']={'name':{'type':Sequelize[_0x76b2('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x76b2('0x1')]},'username':{'type':Sequelize[_0x76b2('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x76b2('0x1')],'allowNull':![],'defaultValue':_0x76b2('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x76b2('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x76b2('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xf0c2=['STRING','HelpDesk','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xf0c2,0x6e));var _0x2f0c=function(_0x1a151f,_0x3648c8){_0x1a151f=_0x1a151f-0x0;var _0x2a08c6=_0xf0c2[_0x1a151f];return _0x2a08c6;};'use strict';var Sequelize=require('sequelize');module[_0x2f0c('0x0')]={'name':{'type':Sequelize[_0x2f0c('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x2f0c('0x1')]},'username':{'type':Sequelize[_0x2f0c('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x2f0c('0x1')],'allowNull':![],'defaultValue':_0x2f0c('0x2')},'remoteUri':{'type':Sequelize[_0x2f0c('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x2f0c('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x2f0c('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 343eb1d..e47860a 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 _0x75c8=['sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','getConfigurations','findOne','Subjects','getSubjects','channel','getDescriptions','VtigerConfiguration','VtigerField','Descriptions','md5','username','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','format','GET','getchallenge','POST','login','result','describe','sessionName','success','reference','owner','remove','includes','editable','label','startsWith','cf_','picklist','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','request','then','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','catch','status','end','json','count','offset','limit','set','Content-Range','reject','update','destroy','sendStatus','stack','name','index','map','VtigerAccount','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x18fe0a,_0xf3da56){var _0x52723a=function(_0x15319b){while(--_0x15319b){_0x18fe0a['push'](_0x18fe0a['shift']());}};_0x52723a(++_0xf3da56);}(_0x75c8,0x1c2));var _0x875c=function(_0x5887e6,_0xce7e8e){_0x5887e6=_0x5887e6-0x0;var _0x4af726=_0x75c8[_0x5887e6];return _0x4af726;};'use strict';var pdf=require(_0x875c('0x0'));var emlformat=require(_0x875c('0x1'));var rimraf=require(_0x875c('0x2'));var zipdir=require(_0x875c('0x3'));var jsonpatch=require(_0x875c('0x4'));var rp=require(_0x875c('0x5'));var moment=require(_0x875c('0x6'));var BPromise=require(_0x875c('0x7'));var Mustache=require(_0x875c('0x8'));var util=require(_0x875c('0x9'));var path=require(_0x875c('0xa'));var sox=require(_0x875c('0xb'));var csv=require(_0x875c('0xc'));var ejs=require(_0x875c('0xd'));var fs=require('fs');var fs_extra=require(_0x875c('0xe'));var _=require(_0x875c('0xf'));var squel=require('squel');var crypto=require(_0x875c('0x10'));var jsforce=require(_0x875c('0x11'));var deskjs=require(_0x875c('0x12'));var toCsv=require(_0x875c('0xc'));var querystring=require(_0x875c('0x13'));var Papa=require(_0x875c('0x14'));var Redis=require(_0x875c('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x875c('0x16'));var as=require(_0x875c('0x17'));var hardwareService=require(_0x875c('0x18'));var logger=require(_0x875c('0x19'))(_0x875c('0x1a'));var utils=require(_0x875c('0x1b'));var config=require(_0x875c('0x1c'));var licenseUtil=require(_0x875c('0x1d'));var db=require('../../mysqldb')['db'];var integrations=require(_0x875c('0x1e'));var jayson=require(_0x875c('0x1f'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x58be23,_0x5c9bfe,_0x5187eb,_0x2b61f1){return new BPromise(function(_0x146dc1,_0x3e9d68){var _0x3f56e9=_0x2b61f1||client;return _0x3f56e9[_0x875c('0x20')](_0x58be23,_0x5187eb)[_0x875c('0x21')](function(_0x2dc27e){logger[_0x875c('0x22')]('VtigerAccount,\x20%s,\x20%s',_0x5c9bfe,_0x875c('0x23'));logger[_0x875c('0x24')](_0x875c('0x25'),_0x5c9bfe,_0x875c('0x23'),JSON[_0x875c('0x26')](_0x2dc27e));if(_0x2dc27e[_0x875c('0x27')]){if(_0x2dc27e['error'][_0x875c('0x28')]===0x1f4){logger[_0x875c('0x27')](_0x875c('0x29'),_0x5c9bfe,_0x2dc27e[_0x875c('0x27')]['message']);return _0x3e9d68(_0x2dc27e[_0x875c('0x27')][_0x875c('0x2a')]);}logger['error'](_0x875c('0x29'),_0x5c9bfe,_0x2dc27e[_0x875c('0x27')][_0x875c('0x2a')]);return _0x146dc1(_0x2dc27e[_0x875c('0x27')][_0x875c('0x2a')]);}else{logger[_0x875c('0x22')](_0x875c('0x29'),_0x5c9bfe,'request\x20sent');_0x146dc1(_0x2dc27e['result']['message']);}})[_0x875c('0x2b')](function(_0x4c898d){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x5c9bfe,_0x4c898d);_0x3e9d68(_0x4c898d);});});}function respondWithStatusCode(_0x59adcb,_0x49ac62){_0x49ac62=_0x49ac62||0xcc;return function(_0x6d5f5e){if(_0x6d5f5e){return _0x59adcb['sendStatus'](_0x49ac62);}return _0x59adcb[_0x875c('0x2c')](_0x49ac62)[_0x875c('0x2d')]();};}function respondWithResult(_0x301cad,_0x1cf00f){_0x1cf00f=_0x1cf00f||0xc8;return function(_0x2a9175){if(_0x2a9175){return _0x301cad['status'](_0x1cf00f)[_0x875c('0x2e')](_0x2a9175);}};}function respondWithFilteredResult(_0x51f2ff,_0x401af0){return function(_0x5a2b11){if(_0x5a2b11){var _0x263432=_0x5a2b11[_0x875c('0x2f')],_0x19d6d2=_0x401af0[_0x875c('0x30')],_0x52afa5=_0x401af0[_0x875c('0x30')]+_0x401af0[_0x875c('0x31')],_0x52872b;if(_0x52afa5>=_0x263432){_0x52afa5=_0x263432;_0x52872b=0xc8;}else{_0x52872b=0xce;}_0x51f2ff['status'](_0x52872b);return _0x51f2ff[_0x875c('0x32')](_0x875c('0x33'),_0x19d6d2+'-'+_0x52afa5+'/'+_0x263432)[_0x875c('0x2e')](_0x5a2b11);}return null;};}function patchUpdates(_0x287ee0){return function(_0x54846a){try{jsonpatch['apply'](_0x54846a,_0x287ee0,!![]);}catch(_0x433435){return BPromise[_0x875c('0x34')](_0x433435);}return _0x54846a['save']();};}function saveUpdates(_0x566017,_0x496a13){return function(_0x336299){if(_0x336299){return _0x336299[_0x875c('0x35')](_0x566017)[_0x875c('0x21')](function(_0x766d3b){return _0x766d3b;});}return null;};}function removeEntity(_0x28f6fd,_0x250bbb){return function(_0x4f59e2){if(_0x4f59e2){return _0x4f59e2[_0x875c('0x36')]()['then'](function(){_0x28f6fd[_0x875c('0x2c')](0xcc)[_0x875c('0x2d')]();});}};}function handleEntityNotFound(_0x4036f8,_0x33863d){return function(_0x10dac7){if(!_0x10dac7){_0x4036f8[_0x875c('0x37')](0x194);}return _0x10dac7;};}function handleError(_0x40b599,_0x10103f){_0x10103f=_0x10103f||0x1f4;return function(_0x2c671e){logger['error'](_0x2c671e[_0x875c('0x38')]);if(_0x2c671e[_0x875c('0x39')]){delete _0x2c671e['name'];}_0x40b599[_0x875c('0x2c')](_0x10103f)['send'](_0x2c671e);};}exports[_0x875c('0x3a')]=function(_0x5c0a58,_0x2c7113){var _0x58616d={},_0x43e9a5={},_0x2a1215={'count':0x0,'rows':[]};var _0x1d35bd=_[_0x875c('0x3b')](db[_0x875c('0x3c')][_0x875c('0x3d')],function(_0x459284){return{'name':_0x459284['fieldName'],'type':_0x459284['type'][_0x875c('0x3e')]};});_0x43e9a5['model']=_[_0x875c('0x3b')](_0x1d35bd,_0x875c('0x39'));_0x43e9a5[_0x875c('0x3f')]=_[_0x875c('0x40')](_0x5c0a58[_0x875c('0x3f')]);_0x43e9a5[_0x875c('0x41')]=_[_0x875c('0x42')](_0x43e9a5[_0x875c('0x43')],_0x43e9a5['query']);_0x58616d[_0x875c('0x44')]=_[_0x875c('0x42')](_0x43e9a5['model'],qs[_0x875c('0x45')](_0x5c0a58['query'][_0x875c('0x45')]));_0x58616d[_0x875c('0x44')]=_0x58616d[_0x875c('0x44')][_0x875c('0x46')]?_0x58616d[_0x875c('0x44')]:_0x43e9a5['model'];if(!_0x5c0a58[_0x875c('0x3f')][_0x875c('0x47')](_0x875c('0x48'))){_0x58616d[_0x875c('0x31')]=qs[_0x875c('0x31')](_0x5c0a58[_0x875c('0x3f')][_0x875c('0x31')]);_0x58616d[_0x875c('0x30')]=qs['offset'](_0x5c0a58[_0x875c('0x3f')][_0x875c('0x30')]);}_0x58616d[_0x875c('0x49')]=qs[_0x875c('0x4a')](_0x5c0a58[_0x875c('0x3f')]['sort']);_0x58616d[_0x875c('0x4b')]=qs['filters'](_[_0x875c('0x4c')](_0x5c0a58[_0x875c('0x3f')],_0x43e9a5[_0x875c('0x41')]),_0x1d35bd);if(_0x5c0a58[_0x875c('0x3f')][_0x875c('0x4d')]){_0x58616d[_0x875c('0x4b')]=_[_0x875c('0x4e')](_0x58616d[_0x875c('0x4b')],{'$or':_['map'](_0x1d35bd,function(_0x54c335){if(_0x54c335[_0x875c('0x4f')]!==_0x875c('0x50')){var _0x251c3f={};_0x251c3f[_0x54c335['name']]={'$like':'%'+_0x5c0a58[_0x875c('0x3f')][_0x875c('0x4d')]+'%'};return _0x251c3f;}})});}_0x58616d=_['merge']({},_0x58616d,_0x5c0a58[_0x875c('0x51')]);var _0x1e1c80={'where':_0x58616d[_0x875c('0x4b')]};return db[_0x875c('0x3c')]['count'](_0x1e1c80)['then'](function(_0x5025bd){_0x2a1215['count']=_0x5025bd;if(_0x5c0a58['query'][_0x875c('0x52')]){_0x58616d[_0x875c('0x53')]=[{'all':!![]}];}return db[_0x875c('0x3c')][_0x875c('0x54')](_0x58616d);})[_0x875c('0x21')](function(_0x29e282){_0x2a1215[_0x875c('0x55')]=_0x29e282;return _0x2a1215;})[_0x875c('0x21')](respondWithFilteredResult(_0x2c7113,_0x58616d))['catch'](handleError(_0x2c7113,null));};exports['show']=function(_0x2c00d7,_0x8c1f9d){var _0x577374={'raw':![],'where':{'id':_0x2c00d7[_0x875c('0x56')]['id']}},_0x2d1dd2={};_0x2d1dd2[_0x875c('0x43')]=_['keys'](db['VtigerAccount']['rawAttributes']);_0x2d1dd2[_0x875c('0x3f')]=_[_0x875c('0x40')](_0x2c00d7['query']);_0x2d1dd2[_0x875c('0x41')]=_[_0x875c('0x42')](_0x2d1dd2['model'],_0x2d1dd2['query']);_0x577374[_0x875c('0x44')]=_['intersection'](_0x2d1dd2['model'],qs[_0x875c('0x45')](_0x2c00d7['query']['fields']));_0x577374[_0x875c('0x44')]=_0x577374['attributes'][_0x875c('0x46')]?_0x577374[_0x875c('0x44')]:_0x2d1dd2[_0x875c('0x43')];if(_0x2c00d7[_0x875c('0x3f')][_0x875c('0x52')]){_0x577374[_0x875c('0x53')]=[{'all':!![]}];}_0x577374=_['merge']({},_0x577374,_0x2c00d7['options']);return db[_0x875c('0x3c')][_0x875c('0x57')](_0x577374)[_0x875c('0x21')](handleEntityNotFound(_0x8c1f9d,null))['then'](respondWithResult(_0x8c1f9d,null))[_0x875c('0x2b')](handleError(_0x8c1f9d,null));};exports['create']=function(_0x32d276,_0x340ddd){return db[_0x875c('0x3c')][_0x875c('0x58')](_0x32d276['body'],{})[_0x875c('0x21')](respondWithResult(_0x340ddd,0xc9))[_0x875c('0x2b')](handleError(_0x340ddd,null));};exports[_0x875c('0x35')]=function(_0x138a79,_0xadaaf9){if(_0x138a79[_0x875c('0x59')]['id']){delete _0x138a79[_0x875c('0x59')]['id'];}return db['VtigerAccount'][_0x875c('0x57')]({'where':{'id':_0x138a79[_0x875c('0x56')]['id']}})[_0x875c('0x21')](handleEntityNotFound(_0xadaaf9,null))['then'](saveUpdates(_0x138a79[_0x875c('0x59')],null))[_0x875c('0x21')](respondWithResult(_0xadaaf9,null))[_0x875c('0x2b')](handleError(_0xadaaf9,null));};exports['destroy']=function(_0x58d133,_0x357a36){return db[_0x875c('0x3c')][_0x875c('0x57')]({'where':{'id':_0x58d133[_0x875c('0x56')]['id']}})[_0x875c('0x21')](handleEntityNotFound(_0x357a36,null))['then'](removeEntity(_0x357a36,null))[_0x875c('0x2b')](handleError(_0x357a36,null));};exports[_0x875c('0x5a')]=function(_0x2e7662,_0x1fcd45,_0xa581d2){var _0x15f483={};var _0x4956f4={};var _0xaaf599;var _0x44dab4;return db[_0x875c('0x3c')][_0x875c('0x5b')]({'where':{'id':_0x2e7662['params']['id']}})['then'](handleEntityNotFound(_0x1fcd45,null))[_0x875c('0x21')](function(_0x576218){if(_0x576218){_0xaaf599=_0x576218;_0x4956f4['model']=_[_0x875c('0x40')](db['VtigerConfiguration'][_0x875c('0x3d')]);_0x4956f4['query']=_['keys'](_0x2e7662['query']);_0x4956f4[_0x875c('0x41')]=_['intersection'](_0x4956f4['model'],_0x4956f4[_0x875c('0x3f')]);_0x15f483[_0x875c('0x44')]=_[_0x875c('0x42')](_0x4956f4[_0x875c('0x43')],qs['fields'](_0x2e7662['query'][_0x875c('0x45')]));_0x15f483[_0x875c('0x44')]=_0x15f483[_0x875c('0x44')][_0x875c('0x46')]?_0x15f483[_0x875c('0x44')]:_0x4956f4[_0x875c('0x43')];_0x15f483[_0x875c('0x49')]=qs['sort'](_0x2e7662[_0x875c('0x3f')]['sort']);_0x15f483[_0x875c('0x4b')]=qs[_0x875c('0x41')](_[_0x875c('0x4c')](_0x2e7662['query'],_0x4956f4['filters']));if(_0x2e7662[_0x875c('0x3f')][_0x875c('0x4d')]){_0x15f483[_0x875c('0x4b')]=_[_0x875c('0x4e')](_0x15f483['where'],{'$or':_[_0x875c('0x3b')](_0x15f483[_0x875c('0x44')],function(_0x3e265f){var _0x17aac2={};_0x17aac2[_0x3e265f]={'$like':'%'+_0x2e7662[_0x875c('0x3f')][_0x875c('0x4d')]+'%'};return _0x17aac2;})});}_0x15f483=_[_0x875c('0x4e')]({},_0x15f483,_0x2e7662['options']);return _0xaaf599[_0x875c('0x5a')](_0x15f483);}})[_0x875c('0x21')](function(_0x140596){if(_0x140596){_0x44dab4=_0x140596[_0x875c('0x46')];if(!_0x2e7662[_0x875c('0x3f')][_0x875c('0x47')](_0x875c('0x48'))){_0x15f483[_0x875c('0x31')]=qs['limit'](_0x2e7662[_0x875c('0x3f')][_0x875c('0x31')]);_0x15f483['offset']=qs[_0x875c('0x30')](_0x2e7662[_0x875c('0x3f')][_0x875c('0x30')]);}return _0xaaf599[_0x875c('0x5a')](_0x15f483);}})[_0x875c('0x21')](function(_0x23a3ce){if(_0x23a3ce){return _0x23a3ce?{'count':_0x44dab4,'rows':_0x23a3ce}:null;}})[_0x875c('0x21')](respondWithResult(_0x1fcd45,null))[_0x875c('0x2b')](handleError(_0x1fcd45,null));};exports['addConfiguration']=function(_0xfbf3ff,_0xe84d8d,_0x14f621){if(_0xfbf3ff[_0x875c('0x59')]['id']){delete _0xfbf3ff['body']['id'];}return db[_0x875c('0x3c')][_0x875c('0x5b')]({'where':{'id':_0xfbf3ff[_0x875c('0x56')]['id']}})[_0x875c('0x21')](handleEntityNotFound(_0xe84d8d,null))['then'](function(_0x16f54c){if(_0x16f54c){_0xfbf3ff['body']['AccountId']=_0x16f54c['id'];_0xfbf3ff[_0x875c('0x59')][_0x875c('0x5c')]=integrations[_0x875c('0x5d')](_0xfbf3ff[_0x875c('0x59')][_0x875c('0x5e')],_0xfbf3ff[_0x875c('0x59')][_0x875c('0x4f')]);_0xfbf3ff[_0x875c('0x59')]['Descriptions']=integrations[_0x875c('0x5f')](_0xfbf3ff[_0x875c('0x59')][_0x875c('0x5e')],_0xfbf3ff[_0x875c('0x59')]['type']);return db[_0x875c('0x60')][_0x875c('0x58')](_0xfbf3ff[_0x875c('0x59')],{'include':[{'model':db['VtigerField'],'as':_0x875c('0x5c')},{'model':db[_0x875c('0x61')],'as':_0x875c('0x62')}]});}return null;})[_0x875c('0x21')](respondWithResult(_0xe84d8d,null))[_0x875c('0x2b')](handleError(_0xe84d8d,null));};var md5=require(_0x875c('0x63'));exports['getFields']=function(_0x43874c,_0x737cbb,_0x550c48){var _0x10b5db=null;var _0x197002=null;var _0x55e0a1=null;var _0x28acb0=null;var _0x1773d4='';return db[_0x875c('0x3c')][_0x875c('0x5b')]({'where':{'id':_0x43874c[_0x875c('0x56')]['id']},'attributes':['id',_0x875c('0x39'),_0x875c('0x64'),'description',_0x875c('0x65'),_0x875c('0x66'),_0x875c('0x67'),_0x875c('0x68')]})[_0x875c('0x21')](handleEntityNotFound(_0x737cbb,null))['then'](function(_0x47c862){if(_0x47c862){_0x10b5db=_0x47c862[_0x875c('0x64')];_0x197002=_0x47c862['accessKey'];_0x55e0a1=_0x47c862[_0x875c('0x65')];_0x1773d4=_0x47c862[_0x875c('0x66')];var _0x5d67c5=_0x1773d4['slice'](-0x1);if(_0x5d67c5==='/'){_0x1773d4=_0x1773d4[_0x875c('0x69')](0x0,_0x1773d4[_0x875c('0x6a')](_0x5d67c5));}_0x28acb0=util[_0x875c('0x6b')]('%s/webservice.php',_0x1773d4);var _0xf39a2d={'method':_0x875c('0x6c'),'uri':_0x28acb0,'qs':{'operation':_0x875c('0x6d'),'username':_0x47c862['username']},'json':!![]};return rp(_0xf39a2d);}})[_0x875c('0x21')](function(_0x5ecb7f){if(_0x5ecb7f['success']){var _0x4bab87={'method':_0x875c('0x6e'),'uri':_0x28acb0,'form':{'operation':_0x875c('0x6f'),'username':_0x10b5db,'accessKey':md5(_0x5ecb7f[_0x875c('0x70')]['token']+_0x197002)},'json':!![]};return rp(_0x4bab87);}})[_0x875c('0x21')](function(_0x11a9f6){if(_0x11a9f6['success']){var _0x32c21b={'method':_0x875c('0x6c'),'uri':_0x28acb0,'qs':{'operation':_0x875c('0x71'),'username':_0x10b5db,'sessionName':_0x11a9f6[_0x875c('0x70')][_0x875c('0x72')],'elementType':_0x55e0a1},'json':!![]};return rp(_0x32c21b);}})['then'](function(_0x5069fd){if(_0x5069fd[_0x875c('0x73')]){var _0x33d228=['autogenerated',_0x875c('0x74'),_0x875c('0x75')];_[_0x875c('0x76')](_0x5069fd[_0x875c('0x70')][_0x875c('0x45')],function(_0x136701){return _0x33d228[_0x875c('0x77')](_0x136701[_0x875c('0x4f')][_0x875c('0x39')]);});_['remove'](_0x5069fd['result'][_0x875c('0x45')],function(_0x573239){return _0x573239[_0x875c('0x78')]==='false';});return{'count':_0x5069fd[_0x875c('0x70')][_0x875c('0x45')][_0x875c('0x46')],'rows':_[_0x875c('0x3b')](_0x5069fd[_0x875c('0x70')][_0x875c('0x45')],function(_0x439720){return{'id':_0x439720[_0x875c('0x39')],'name':_0x439720[_0x875c('0x79')],'custom':_[_0x875c('0x7a')](_0x439720[_0x875c('0x39')],_0x875c('0x7b'))?!![]:![],'options':_0x439720[_0x875c('0x4f')][_0x875c('0x39')]===_0x875c('0x7c')&&_0x439720[_0x875c('0x4f')]['picklistValues']['length']>0x0?_['map'](_0x439720[_0x875c('0x4f')]['picklistValues'],function(_0x565244){return{'name':_0x565244['label'],'value':_0x565244[_0x875c('0x7d')]};}):[]};})};}})['then'](respondWithResult(_0x737cbb,null))[_0x875c('0x2b')](function(_0x7cf4e8){console['log']('vTiger\x20error:\x20'+_0x7cf4e8);var _0x3f735c=_0x43874c[_0x875c('0x3f')][_0x875c('0x7e')]?0x1f4:_0x7cf4e8[_0x875c('0x7f')]||0x1f4;logger[_0x875c('0x27')](_0x875c('0x80'),'getFields',_0x3f735c,JSON[_0x875c('0x26')](_0x7cf4e8));delete _0x7cf4e8[_0x875c('0x39')];if(_0x3f735c===0x191){_0x3f735c=0x190;}_0x737cbb[_0x875c('0x2c')](_0x3f735c)[_0x875c('0x81')](_0x43874c['query'][_0x875c('0x7e')]?{'message':_0x875c('0x82'),'statusCode':_0x7cf4e8[_0x875c('0x7f')]}:_0x7cf4e8);});}; \ No newline at end of file +var _0x8c84=['type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','rows','params','keys','find','body','getConfigurations','findOne','filter','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','format','%s/webservice.php','success','token','GET','describe','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','VtigerAccount','rawAttributes'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x8c84,0xc9));var _0x48c8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8c84[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x48c8('0x0'));var emlformat=require(_0x48c8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x48c8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x48c8('0x3'));var moment=require(_0x48c8('0x4'));var BPromise=require(_0x48c8('0x5'));var Mustache=require(_0x48c8('0x6'));var util=require(_0x48c8('0x7'));var path=require(_0x48c8('0x8'));var sox=require(_0x48c8('0x9'));var csv=require(_0x48c8('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x48c8('0xb'));var _=require(_0x48c8('0xc'));var squel=require(_0x48c8('0xd'));var crypto=require('crypto');var jsforce=require(_0x48c8('0xe'));var deskjs=require(_0x48c8('0xf'));var toCsv=require(_0x48c8('0xa'));var querystring=require(_0x48c8('0x10'));var Papa=require(_0x48c8('0x11'));var Redis=require(_0x48c8('0x12'));var authService=require(_0x48c8('0x13'));var qs=require(_0x48c8('0x14'));var as=require(_0x48c8('0x15'));var hardwareService=require(_0x48c8('0x16'));var logger=require(_0x48c8('0x17'))('api');var utils=require(_0x48c8('0x18'));var config=require(_0x48c8('0x19'));var licenseUtil=require(_0x48c8('0x1a'));var db=require(_0x48c8('0x1b'))['db'];var integrations=require(_0x48c8('0x1c'));var jayson=require('jayson/promise');var client=jayson['client'][_0x48c8('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4b3bda,_0x4b8416,_0x5c567b,_0x389e70){return new BPromise(function(_0x2c217f,_0x2e2b76){var _0x3b0c3a=_0x389e70||client;return _0x3b0c3a[_0x48c8('0x1e')](_0x4b3bda,_0x5c567b)[_0x48c8('0x1f')](function(_0x39eb4a){logger[_0x48c8('0x20')](_0x48c8('0x21'),_0x4b8416,_0x48c8('0x22'));logger[_0x48c8('0x23')](_0x48c8('0x24'),_0x4b8416,_0x48c8('0x22'),JSON['stringify'](_0x39eb4a));if(_0x39eb4a[_0x48c8('0x25')]){if(_0x39eb4a['error'][_0x48c8('0x26')]===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x4b8416,_0x39eb4a[_0x48c8('0x25')][_0x48c8('0x27')]);return _0x2e2b76(_0x39eb4a[_0x48c8('0x25')][_0x48c8('0x27')]);}logger[_0x48c8('0x25')](_0x48c8('0x21'),_0x4b8416,_0x39eb4a[_0x48c8('0x25')][_0x48c8('0x27')]);return _0x2c217f(_0x39eb4a[_0x48c8('0x25')][_0x48c8('0x27')]);}else{logger['info'](_0x48c8('0x21'),_0x4b8416,_0x48c8('0x22'));_0x2c217f(_0x39eb4a[_0x48c8('0x28')]['message']);}})[_0x48c8('0x29')](function(_0x3bec5d){logger[_0x48c8('0x25')](_0x48c8('0x21'),_0x4b8416,_0x3bec5d);_0x2e2b76(_0x3bec5d);});});}function respondWithStatusCode(_0xb66186,_0x3cf77b){_0x3cf77b=_0x3cf77b||0xcc;return function(_0x63533){if(_0x63533){return _0xb66186[_0x48c8('0x2a')](_0x3cf77b);}return _0xb66186[_0x48c8('0x2b')](_0x3cf77b)[_0x48c8('0x2c')]();};}function respondWithResult(_0x2e23e4,_0x4dd7c7){_0x4dd7c7=_0x4dd7c7||0xc8;return function(_0x176581){if(_0x176581){return _0x2e23e4['status'](_0x4dd7c7)[_0x48c8('0x2d')](_0x176581);}};}function respondWithFilteredResult(_0x4ed6b0,_0x584241){return function(_0x4d3074){if(_0x4d3074){var _0x4febe5=_0x4d3074[_0x48c8('0x2e')],_0x5d4d29=_0x584241['offset'],_0x25503b=_0x584241[_0x48c8('0x2f')]+_0x584241[_0x48c8('0x30')],_0x6e78a7;if(_0x25503b>=_0x4febe5){_0x25503b=_0x4febe5;_0x6e78a7=0xc8;}else{_0x6e78a7=0xce;}_0x4ed6b0[_0x48c8('0x2b')](_0x6e78a7);return _0x4ed6b0[_0x48c8('0x31')](_0x48c8('0x32'),_0x5d4d29+'-'+_0x25503b+'/'+_0x4febe5)[_0x48c8('0x2d')](_0x4d3074);}return null;};}function patchUpdates(_0x362f6d){return function(_0x326dba){try{jsonpatch[_0x48c8('0x33')](_0x326dba,_0x362f6d,!![]);}catch(_0x3483fb){return BPromise[_0x48c8('0x34')](_0x3483fb);}return _0x326dba[_0x48c8('0x35')]();};}function saveUpdates(_0x294ea3,_0x301eb3){return function(_0x174b5e){if(_0x174b5e){return _0x174b5e[_0x48c8('0x36')](_0x294ea3)[_0x48c8('0x1f')](function(_0x18b9d6){return _0x18b9d6;});}return null;};}function removeEntity(_0x5a04b7,_0x4a59b7){return function(_0x932a20){if(_0x932a20){return _0x932a20[_0x48c8('0x37')]()['then'](function(){_0x5a04b7[_0x48c8('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x527ed9,_0x59b3ed){return function(_0x38bcd5){if(!_0x38bcd5){_0x527ed9['sendStatus'](0x194);}return _0x38bcd5;};}function handleError(_0x5b5af2,_0x44c0cf){_0x44c0cf=_0x44c0cf||0x1f4;return function(_0x27b922){logger['error'](_0x27b922[_0x48c8('0x38')]);if(_0x27b922[_0x48c8('0x39')]){delete _0x27b922[_0x48c8('0x39')];}_0x5b5af2[_0x48c8('0x2b')](_0x44c0cf)[_0x48c8('0x3a')](_0x27b922);};}exports[_0x48c8('0x3b')]=function(_0x486f53,_0x2ce3b3){var _0x46d15c={},_0x525656={},_0x2f7393={'count':0x0,'rows':[]};var _0x5eab41=_[_0x48c8('0x3c')](db[_0x48c8('0x3d')][_0x48c8('0x3e')],function(_0x4876b3){return{'name':_0x4876b3['fieldName'],'type':_0x4876b3[_0x48c8('0x3f')][_0x48c8('0x40')]};});_0x525656[_0x48c8('0x41')]=_[_0x48c8('0x3c')](_0x5eab41,'name');_0x525656[_0x48c8('0x42')]=_['keys'](_0x486f53[_0x48c8('0x42')]);_0x525656[_0x48c8('0x43')]=_[_0x48c8('0x44')](_0x525656[_0x48c8('0x41')],_0x525656[_0x48c8('0x42')]);_0x46d15c[_0x48c8('0x45')]=_[_0x48c8('0x44')](_0x525656[_0x48c8('0x41')],qs[_0x48c8('0x46')](_0x486f53[_0x48c8('0x42')][_0x48c8('0x46')]));_0x46d15c[_0x48c8('0x45')]=_0x46d15c[_0x48c8('0x45')][_0x48c8('0x47')]?_0x46d15c[_0x48c8('0x45')]:_0x525656['model'];if(!_0x486f53[_0x48c8('0x42')]['hasOwnProperty'](_0x48c8('0x48'))){_0x46d15c[_0x48c8('0x30')]=qs[_0x48c8('0x30')](_0x486f53[_0x48c8('0x42')][_0x48c8('0x30')]);_0x46d15c['offset']=qs[_0x48c8('0x2f')](_0x486f53[_0x48c8('0x42')][_0x48c8('0x2f')]);}_0x46d15c[_0x48c8('0x49')]=qs[_0x48c8('0x4a')](_0x486f53[_0x48c8('0x42')][_0x48c8('0x4a')]);_0x46d15c[_0x48c8('0x4b')]=qs[_0x48c8('0x43')](_[_0x48c8('0x4c')](_0x486f53[_0x48c8('0x42')],_0x525656['filters']),_0x5eab41);if(_0x486f53['query']['filter']){_0x46d15c[_0x48c8('0x4b')]=_['merge'](_0x46d15c['where'],{'$or':_[_0x48c8('0x3c')](_0x5eab41,function(_0x17b847){if(_0x17b847[_0x48c8('0x3f')]!==_0x48c8('0x4d')){var _0x17af5b={};_0x17af5b[_0x17b847['name']]={'$like':'%'+_0x486f53[_0x48c8('0x42')]['filter']+'%'};return _0x17af5b;}})});}_0x46d15c=_[_0x48c8('0x4e')]({},_0x46d15c,_0x486f53[_0x48c8('0x4f')]);var _0x1a5206={'where':_0x46d15c[_0x48c8('0x4b')]};return db[_0x48c8('0x3d')]['count'](_0x1a5206)[_0x48c8('0x1f')](function(_0x448229){_0x2f7393[_0x48c8('0x2e')]=_0x448229;if(_0x486f53['query'][_0x48c8('0x50')]){_0x46d15c[_0x48c8('0x51')]=[{'all':!![]}];}return db['VtigerAccount']['findAll'](_0x46d15c);})[_0x48c8('0x1f')](function(_0x357aab){_0x2f7393[_0x48c8('0x52')]=_0x357aab;return _0x2f7393;})[_0x48c8('0x1f')](respondWithFilteredResult(_0x2ce3b3,_0x46d15c))[_0x48c8('0x29')](handleError(_0x2ce3b3,null));};exports['show']=function(_0x559cac,_0x36a82d){var _0x7d0e5f={'raw':![],'where':{'id':_0x559cac[_0x48c8('0x53')]['id']}},_0xb4bd55={};_0xb4bd55['model']=_[_0x48c8('0x54')](db['VtigerAccount'][_0x48c8('0x3e')]);_0xb4bd55[_0x48c8('0x42')]=_['keys'](_0x559cac[_0x48c8('0x42')]);_0xb4bd55[_0x48c8('0x43')]=_['intersection'](_0xb4bd55[_0x48c8('0x41')],_0xb4bd55[_0x48c8('0x42')]);_0x7d0e5f['attributes']=_['intersection'](_0xb4bd55['model'],qs[_0x48c8('0x46')](_0x559cac['query'][_0x48c8('0x46')]));_0x7d0e5f[_0x48c8('0x45')]=_0x7d0e5f[_0x48c8('0x45')][_0x48c8('0x47')]?_0x7d0e5f[_0x48c8('0x45')]:_0xb4bd55['model'];if(_0x559cac[_0x48c8('0x42')][_0x48c8('0x50')]){_0x7d0e5f['include']=[{'all':!![]}];}_0x7d0e5f=_[_0x48c8('0x4e')]({},_0x7d0e5f,_0x559cac[_0x48c8('0x4f')]);return db[_0x48c8('0x3d')][_0x48c8('0x55')](_0x7d0e5f)[_0x48c8('0x1f')](handleEntityNotFound(_0x36a82d,null))[_0x48c8('0x1f')](respondWithResult(_0x36a82d,null))[_0x48c8('0x29')](handleError(_0x36a82d,null));};exports['create']=function(_0x4796cd,_0xba33d7){return db[_0x48c8('0x3d')]['create'](_0x4796cd['body'],{})[_0x48c8('0x1f')](respondWithResult(_0xba33d7,0xc9))[_0x48c8('0x29')](handleError(_0xba33d7,null));};exports[_0x48c8('0x36')]=function(_0x1bf79,_0x523b84){if(_0x1bf79['body']['id']){delete _0x1bf79[_0x48c8('0x56')]['id'];}return db['VtigerAccount'][_0x48c8('0x55')]({'where':{'id':_0x1bf79[_0x48c8('0x53')]['id']}})[_0x48c8('0x1f')](handleEntityNotFound(_0x523b84,null))[_0x48c8('0x1f')](saveUpdates(_0x1bf79[_0x48c8('0x56')],null))[_0x48c8('0x1f')](respondWithResult(_0x523b84,null))['catch'](handleError(_0x523b84,null));};exports['destroy']=function(_0x12b1e0,_0x24fdd6){return db['VtigerAccount'][_0x48c8('0x55')]({'where':{'id':_0x12b1e0[_0x48c8('0x53')]['id']}})[_0x48c8('0x1f')](handleEntityNotFound(_0x24fdd6,null))[_0x48c8('0x1f')](removeEntity(_0x24fdd6,null))[_0x48c8('0x29')](handleError(_0x24fdd6,null));};exports[_0x48c8('0x57')]=function(_0xcf92b1,_0x159038,_0x5eb5e2){var _0x50f873={};var _0x3cacee={};var _0x1386a5;var _0x487d3d;return db[_0x48c8('0x3d')][_0x48c8('0x58')]({'where':{'id':_0xcf92b1['params']['id']}})['then'](handleEntityNotFound(_0x159038,null))[_0x48c8('0x1f')](function(_0x5e2f06){if(_0x5e2f06){_0x1386a5=_0x5e2f06;_0x3cacee['model']=_[_0x48c8('0x54')](db['VtigerConfiguration'][_0x48c8('0x3e')]);_0x3cacee[_0x48c8('0x42')]=_[_0x48c8('0x54')](_0xcf92b1[_0x48c8('0x42')]);_0x3cacee[_0x48c8('0x43')]=_[_0x48c8('0x44')](_0x3cacee[_0x48c8('0x41')],_0x3cacee[_0x48c8('0x42')]);_0x50f873[_0x48c8('0x45')]=_[_0x48c8('0x44')](_0x3cacee[_0x48c8('0x41')],qs[_0x48c8('0x46')](_0xcf92b1[_0x48c8('0x42')][_0x48c8('0x46')]));_0x50f873[_0x48c8('0x45')]=_0x50f873[_0x48c8('0x45')]['length']?_0x50f873['attributes']:_0x3cacee[_0x48c8('0x41')];_0x50f873[_0x48c8('0x49')]=qs[_0x48c8('0x4a')](_0xcf92b1[_0x48c8('0x42')][_0x48c8('0x4a')]);_0x50f873[_0x48c8('0x4b')]=qs[_0x48c8('0x43')](_[_0x48c8('0x4c')](_0xcf92b1[_0x48c8('0x42')],_0x3cacee[_0x48c8('0x43')]));if(_0xcf92b1['query'][_0x48c8('0x59')]){_0x50f873[_0x48c8('0x4b')]=_[_0x48c8('0x4e')](_0x50f873[_0x48c8('0x4b')],{'$or':_[_0x48c8('0x3c')](_0x50f873[_0x48c8('0x45')],function(_0x13a2b4){var _0x9355c3={};_0x9355c3[_0x13a2b4]={'$like':'%'+_0xcf92b1[_0x48c8('0x42')][_0x48c8('0x59')]+'%'};return _0x9355c3;})});}_0x50f873=_['merge']({},_0x50f873,_0xcf92b1[_0x48c8('0x4f')]);return _0x1386a5[_0x48c8('0x57')](_0x50f873);}})[_0x48c8('0x1f')](function(_0x3dff26){if(_0x3dff26){_0x487d3d=_0x3dff26[_0x48c8('0x47')];if(!_0xcf92b1[_0x48c8('0x42')][_0x48c8('0x5a')](_0x48c8('0x48'))){_0x50f873[_0x48c8('0x30')]=qs[_0x48c8('0x30')](_0xcf92b1['query'][_0x48c8('0x30')]);_0x50f873[_0x48c8('0x2f')]=qs[_0x48c8('0x2f')](_0xcf92b1[_0x48c8('0x42')][_0x48c8('0x2f')]);}return _0x1386a5[_0x48c8('0x57')](_0x50f873);}})[_0x48c8('0x1f')](function(_0x5cc11b){if(_0x5cc11b){return _0x5cc11b?{'count':_0x487d3d,'rows':_0x5cc11b}:null;}})[_0x48c8('0x1f')](respondWithResult(_0x159038,null))[_0x48c8('0x29')](handleError(_0x159038,null));};exports[_0x48c8('0x5b')]=function(_0x4a468d,_0x3772f1,_0x2ce917){if(_0x4a468d[_0x48c8('0x56')]['id']){delete _0x4a468d[_0x48c8('0x56')]['id'];}return db[_0x48c8('0x3d')][_0x48c8('0x58')]({'where':{'id':_0x4a468d[_0x48c8('0x53')]['id']}})[_0x48c8('0x1f')](handleEntityNotFound(_0x3772f1,null))[_0x48c8('0x1f')](function(_0x4b0b35){if(_0x4b0b35){_0x4a468d[_0x48c8('0x56')][_0x48c8('0x5c')]=_0x4b0b35['id'];_0x4a468d[_0x48c8('0x56')][_0x48c8('0x5d')]=integrations[_0x48c8('0x5e')](_0x4a468d['body'][_0x48c8('0x5f')],_0x4a468d[_0x48c8('0x56')][_0x48c8('0x3f')]);_0x4a468d[_0x48c8('0x56')][_0x48c8('0x60')]=integrations[_0x48c8('0x61')](_0x4a468d['body'][_0x48c8('0x5f')],_0x4a468d[_0x48c8('0x56')][_0x48c8('0x3f')]);return db['VtigerConfiguration']['create'](_0x4a468d[_0x48c8('0x56')],{'include':[{'model':db[_0x48c8('0x62')],'as':_0x48c8('0x5d')},{'model':db[_0x48c8('0x62')],'as':_0x48c8('0x60')}]});}return null;})['then'](respondWithResult(_0x3772f1,null))[_0x48c8('0x29')](handleError(_0x3772f1,null));};var md5=require('md5');exports[_0x48c8('0x63')]=function(_0x3d8a9c,_0x252601,_0x1f3996){var _0x24f3ec=null;var _0x3c532f=null;var _0x36b958=null;var _0x5ad2eb=null;var _0x1e1b7a='';return db['VtigerAccount']['findOne']({'where':{'id':_0x3d8a9c[_0x48c8('0x53')]['id']},'attributes':['id','name',_0x48c8('0x64'),_0x48c8('0x65'),_0x48c8('0x66'),_0x48c8('0x67'),_0x48c8('0x68'),_0x48c8('0x69')]})[_0x48c8('0x1f')](handleEntityNotFound(_0x252601,null))[_0x48c8('0x1f')](function(_0x3e1f04){if(_0x3e1f04){_0x24f3ec=_0x3e1f04[_0x48c8('0x64')];_0x3c532f=_0x3e1f04[_0x48c8('0x69')];_0x36b958=_0x3e1f04['moduleName'];_0x1e1b7a=_0x3e1f04[_0x48c8('0x67')];var _0x4a3964=_0x1e1b7a['slice'](-0x1);if(_0x4a3964==='/'){_0x1e1b7a=_0x1e1b7a[_0x48c8('0x6a')](0x0,_0x1e1b7a[_0x48c8('0x6b')](_0x4a3964));}_0x5ad2eb=util[_0x48c8('0x6c')](_0x48c8('0x6d'),_0x1e1b7a);var _0x299f5b={'method':'GET','uri':_0x5ad2eb,'qs':{'operation':'getchallenge','username':_0x3e1f04[_0x48c8('0x64')]},'json':!![]};return rp(_0x299f5b);}})['then'](function(_0x424a22){if(_0x424a22[_0x48c8('0x6e')]){var _0x4c9b34={'method':'POST','uri':_0x5ad2eb,'form':{'operation':'login','username':_0x24f3ec,'accessKey':md5(_0x424a22[_0x48c8('0x28')][_0x48c8('0x6f')]+_0x3c532f)},'json':!![]};return rp(_0x4c9b34);}})['then'](function(_0x3d3144){if(_0x3d3144[_0x48c8('0x6e')]){var _0x2cf30c={'method':_0x48c8('0x70'),'uri':_0x5ad2eb,'qs':{'operation':_0x48c8('0x71'),'username':_0x24f3ec,'sessionName':_0x3d3144[_0x48c8('0x28')]['sessionName'],'elementType':_0x36b958},'json':!![]};return rp(_0x2cf30c);}})['then'](function(_0x5cfac8){if(_0x5cfac8['success']){var _0x3e51f4=['autogenerated',_0x48c8('0x72'),_0x48c8('0x73')];_[_0x48c8('0x74')](_0x5cfac8['result'][_0x48c8('0x46')],function(_0xda64e9){return _0x3e51f4[_0x48c8('0x75')](_0xda64e9['type'][_0x48c8('0x39')]);});_[_0x48c8('0x74')](_0x5cfac8[_0x48c8('0x28')]['fields'],function(_0x4fd36b){return _0x4fd36b[_0x48c8('0x76')]===_0x48c8('0x77');});return{'count':_0x5cfac8[_0x48c8('0x28')][_0x48c8('0x46')]['length'],'rows':_[_0x48c8('0x3c')](_0x5cfac8['result'][_0x48c8('0x46')],function(_0x2796e9){return{'id':_0x2796e9['name'],'name':_0x2796e9[_0x48c8('0x78')],'custom':_[_0x48c8('0x79')](_0x2796e9[_0x48c8('0x39')],_0x48c8('0x7a'))?!![]:![],'options':_0x2796e9[_0x48c8('0x3f')][_0x48c8('0x39')]===_0x48c8('0x7b')&&_0x2796e9[_0x48c8('0x3f')][_0x48c8('0x7c')]['length']>0x0?_[_0x48c8('0x3c')](_0x2796e9['type'][_0x48c8('0x7c')],function(_0xe1a472){return{'name':_0xe1a472['label'],'value':_0xe1a472[_0x48c8('0x7d')]};}):[]};})};}})[_0x48c8('0x1f')](respondWithResult(_0x252601,null))['catch'](function(_0x1568c6){console[_0x48c8('0x7e')]('vTiger\x20error:\x20'+_0x1568c6);var _0x24a736=_0x3d8a9c[_0x48c8('0x42')][_0x48c8('0x7f')]?0x1f4:_0x1568c6[_0x48c8('0x80')]||0x1f4;logger['error'](_0x48c8('0x81'),_0x48c8('0x63'),_0x24a736,JSON[_0x48c8('0x82')](_0x1568c6));delete _0x1568c6[_0x48c8('0x39')];if(_0x24a736===0x191){_0x24a736=0x190;}_0x252601[_0x48c8('0x2b')](_0x24a736)['send'](_0x3d8a9c[_0x48c8('0x42')]['test']?{'message':_0x48c8('0x83'),'statusCode':_0x1568c6[_0x48c8('0x80')]}:_0x1568c6);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 56f0985..0baae0a 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 _0x7bf5=['define','VtigerAccount','int_vtiger_accounts','lodash','api','moment','bluebird','request-promise','path','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration'];(function(_0x36ce78,_0x260279){var _0x3843f7=function(_0x522c0a){while(--_0x522c0a){_0x36ce78['push'](_0x36ce78['shift']());}};_0x3843f7(++_0x260279);}(_0x7bf5,0x18f));var _0x57bf=function(_0x4e0587,_0x409e3a){_0x4e0587=_0x4e0587-0x0;var _0x39a2c6=_0x7bf5[_0x4e0587];return _0x39a2c6;};'use strict';var _=require(_0x57bf('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x57bf('0x1'));var moment=require(_0x57bf('0x2'));var BPromise=require(_0x57bf('0x3'));var rp=require(_0x57bf('0x4'));var fs=require('fs');var path=require(_0x57bf('0x5'));var rimraf=require(_0x57bf('0x6'));var config=require('../../config/environment');var attributes=require(_0x57bf('0x7'));var integrations=require(_0x57bf('0x8'));module['exports']=function(_0xaf5fbd,_0x21a41c){return _0xaf5fbd[_0x57bf('0x9')](_0x57bf('0xa'),attributes,{'tableName':_0x57bf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c9d=['define','VtigerAccount','int_vtiger_accounts','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration'];(function(_0x4d53c3,_0x2dcc46){var _0x22c8c8=function(_0x12ea5e){while(--_0x12ea5e){_0x4d53c3['push'](_0x4d53c3['shift']());}};_0x22c8c8(++_0x2dcc46);}(_0x5c9d,0x177));var _0xd5c9=function(_0x450e22,_0x3ba125){_0x450e22=_0x450e22-0x0;var _0x5e3b1d=_0x5c9d[_0x450e22];return _0x5e3b1d;};'use strict';var _=require(_0xd5c9('0x0'));var util=require(_0xd5c9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd5c9('0x2'));var BPromise=require(_0xd5c9('0x3'));var rp=require(_0xd5c9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd5c9('0x5'));var config=require(_0xd5c9('0x6'));var attributes=require(_0xd5c9('0x7'));var integrations=require(_0xd5c9('0x8'));module['exports']=function(_0x15ec91,_0x521cfe){return _0x15ec91[_0xd5c9('0x9')](_0xd5c9('0xa'),attributes,{'tableName':_0xd5c9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 7285b3c..0aec0e9 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 _0x2d0b=['raw','attributes','limit','include','map','model','GetVtigerAccount','catch','find','then','ShowVtigerAccount','debug','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','VtigerAccount','findAll','options'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x2d0b,0x198));var _0xb2d0=function(_0x5b62d7,_0x29be5a){_0x5b62d7=_0x5b62d7-0x0;var _0x2e1fac=_0x2d0b[_0x5b62d7];return _0x2e1fac;};'use strict';var _=require(_0xb2d0('0x0'));var util=require(_0xb2d0('0x1'));var moment=require('moment');var BPromise=require(_0xb2d0('0x2'));var rs=require(_0xb2d0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb2d0('0x4'))['db'];var utils=require(_0xb2d0('0x5'));var logger=require(_0xb2d0('0x6'))(_0xb2d0('0x7'));var config=require(_0xb2d0('0x8'));var jayson=require(_0xb2d0('0x9'));var client=jayson[_0xb2d0('0xa')][_0xb2d0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x467425,_0x46f36e,_0x2bd3b4){return new BPromise(function(_0x1a0b58,_0x28ff24){return client[_0xb2d0('0xc')](_0x467425,_0x2bd3b4)['then'](function(_0x557f00){logger[_0xb2d0('0xd')](_0xb2d0('0xe'),_0x46f36e,'request\x20sent');logger['debug'](_0xb2d0('0xf'),_0x46f36e,'request\x20sent',JSON[_0xb2d0('0x10')](_0x557f00));if(_0x557f00[_0xb2d0('0x11')]){if(_0x557f00[_0xb2d0('0x11')][_0xb2d0('0x12')]===0x1f4){logger[_0xb2d0('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x46f36e,_0x557f00[_0xb2d0('0x11')]['message']);return _0x28ff24(_0x557f00[_0xb2d0('0x11')]['message']);}logger[_0xb2d0('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x46f36e,_0x557f00[_0xb2d0('0x11')][_0xb2d0('0x13')]);return _0x1a0b58(_0x557f00['error'][_0xb2d0('0x13')]);}else{logger[_0xb2d0('0xd')](_0xb2d0('0xe'),_0x46f36e,_0xb2d0('0x14'));_0x1a0b58(_0x557f00['result'][_0xb2d0('0x13')]);}})['catch'](function(_0x519992){logger[_0xb2d0('0x11')](_0xb2d0('0xe'),_0x46f36e,_0x519992);_0x28ff24(_0x519992);});});}exports['GetVtigerAccount']=function(_0x3686e0){var _0xcea63d=this;return new Promise(function(_0x5a397b,_0x249481){return db[_0xb2d0('0x15')][_0xb2d0('0x16')]({'raw':_0x3686e0['options']?_0x3686e0[_0xb2d0('0x17')][_0xb2d0('0x18')]===undefined?!![]:![]:!![],'where':_0x3686e0[_0xb2d0('0x17')]?_0x3686e0[_0xb2d0('0x17')]['where']||null:null,'attributes':_0x3686e0[_0xb2d0('0x17')]?_0x3686e0[_0xb2d0('0x17')][_0xb2d0('0x19')]||null:null,'limit':_0x3686e0['options']?_0x3686e0[_0xb2d0('0x17')][_0xb2d0('0x1a')]||null:null,'include':_0x3686e0['options']?_0x3686e0[_0xb2d0('0x17')][_0xb2d0('0x1b')]?_[_0xb2d0('0x1c')](_0x3686e0['options'][_0xb2d0('0x1b')],function(_0x13cef7){return{'model':db[_0x13cef7[_0xb2d0('0x1d')]],'as':_0x13cef7['as'],'attributes':_0x13cef7[_0xb2d0('0x19')],'include':_0x13cef7[_0xb2d0('0x1b')]?_[_0xb2d0('0x1c')](_0x13cef7[_0xb2d0('0x1b')],function(_0x591565){return{'model':db[_0x591565[_0xb2d0('0x1d')]],'as':_0x591565['as'],'attributes':_0x591565[_0xb2d0('0x19')],'include':_0x591565[_0xb2d0('0x1b')]?_[_0xb2d0('0x1c')](_0x591565[_0xb2d0('0x1b')],function(_0x54653a){return{'model':db[_0x54653a['model']],'as':_0x54653a['as'],'attributes':_0x54653a[_0xb2d0('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dc45d){logger[_0xb2d0('0xd')](_0xb2d0('0x1e'),_0x3686e0);logger['debug'](_0xb2d0('0x1e'),_0x3686e0,JSON['stringify'](_0x3dc45d));_0x5a397b(_0x3dc45d);})[_0xb2d0('0x1f')](function(_0x2e16c7){logger[_0xb2d0('0x11')]('GetVtigerAccount',_0x2e16c7[_0xb2d0('0x13')],_0x3686e0);_0x249481(_0xcea63d[_0xb2d0('0x11')](0x1f4,_0x2e16c7[_0xb2d0('0x13')]));});});};exports['ShowVtigerAccount']=function(_0x4bbffc){var _0x5b59c6=this;return new Promise(function(_0x500462,_0x1a684b){return db['VtigerAccount'][_0xb2d0('0x20')]({'raw':_0x4bbffc['options']?_0x4bbffc[_0xb2d0('0x17')][_0xb2d0('0x18')]===undefined?!![]:![]:!![],'where':_0x4bbffc[_0xb2d0('0x17')]?_0x4bbffc[_0xb2d0('0x17')]['where']||null:null,'attributes':_0x4bbffc['options']?_0x4bbffc['options'][_0xb2d0('0x19')]||null:null,'include':_0x4bbffc[_0xb2d0('0x17')]?_0x4bbffc[_0xb2d0('0x17')][_0xb2d0('0x1b')]?_[_0xb2d0('0x1c')](_0x4bbffc['options'][_0xb2d0('0x1b')],function(_0x214769){return{'model':db[_0x214769[_0xb2d0('0x1d')]],'as':_0x214769['as'],'attributes':_0x214769[_0xb2d0('0x19')],'include':_0x214769[_0xb2d0('0x1b')]?_[_0xb2d0('0x1c')](_0x214769[_0xb2d0('0x1b')],function(_0x5ba12b){return{'model':db[_0x5ba12b[_0xb2d0('0x1d')]],'as':_0x5ba12b['as'],'attributes':_0x5ba12b[_0xb2d0('0x19')],'include':_0x5ba12b['include']?_['map'](_0x5ba12b[_0xb2d0('0x1b')],function(_0x334130){return{'model':db[_0x334130[_0xb2d0('0x1d')]],'as':_0x334130['as'],'attributes':_0x334130['attributes']};}):[]};}):[]};}):[]:[]})[_0xb2d0('0x21')](function(_0x521fc0){logger[_0xb2d0('0xd')](_0xb2d0('0x22'),_0x4bbffc);logger[_0xb2d0('0x23')]('ShowVtigerAccount',_0x4bbffc,JSON[_0xb2d0('0x10')](_0x521fc0));_0x500462(_0x521fc0);})[_0xb2d0('0x1f')](function(_0x450779){logger[_0xb2d0('0x11')](_0xb2d0('0x22'),_0x450779['message'],_0x4bbffc);_0x1a684b(_0x5b59c6[_0xb2d0('0x11')](0x1f4,_0x450779[_0xb2d0('0x13')]));});});}; \ No newline at end of file +var _0x98a4=['catch','GetVtigerAccount','VtigerAccount','options','where','attributes','limit','include','map','model','then','find','raw','ShowVtigerAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x1e7b5a,_0x2f3fe6){var _0x19dfe1=function(_0x2bb9c6){while(--_0x2bb9c6){_0x1e7b5a['push'](_0x1e7b5a['shift']());}};_0x19dfe1(++_0x2f3fe6);}(_0x98a4,0x1e2));var _0x498a=function(_0x45e045,_0x265985){_0x45e045=_0x45e045-0x0;var _0x34a2f9=_0x98a4[_0x45e045];return _0x34a2f9;};'use strict';var _=require(_0x498a('0x0'));var util=require(_0x498a('0x1'));var moment=require(_0x498a('0x2'));var BPromise=require(_0x498a('0x3'));var rs=require(_0x498a('0x4'));var fs=require('fs');var Redis=require(_0x498a('0x5'));var db=require(_0x498a('0x6'))['db'];var utils=require(_0x498a('0x7'));var logger=require(_0x498a('0x8'))(_0x498a('0x9'));var config=require('../../config/environment');var jayson=require(_0x498a('0xa'));var client=jayson['client'][_0x498a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d4b2c,_0x231485,_0xe0dda1){return new BPromise(function(_0x357a53,_0x512081){return client[_0x498a('0xc')](_0x1d4b2c,_0xe0dda1)['then'](function(_0x544aea){logger[_0x498a('0xd')](_0x498a('0xe'),_0x231485,'request\x20sent');logger[_0x498a('0xf')](_0x498a('0x10'),_0x231485,_0x498a('0x11'),JSON[_0x498a('0x12')](_0x544aea));if(_0x544aea[_0x498a('0x13')]){if(_0x544aea['error'][_0x498a('0x14')]===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x231485,_0x544aea[_0x498a('0x13')][_0x498a('0x15')]);return _0x512081(_0x544aea[_0x498a('0x13')][_0x498a('0x15')]);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0x231485,_0x544aea[_0x498a('0x13')]['message']);return _0x357a53(_0x544aea[_0x498a('0x13')][_0x498a('0x15')]);}else{logger['info'](_0x498a('0xe'),_0x231485,_0x498a('0x11'));_0x357a53(_0x544aea['result'][_0x498a('0x15')]);}})[_0x498a('0x16')](function(_0xece0c1){logger[_0x498a('0x13')](_0x498a('0xe'),_0x231485,_0xece0c1);_0x512081(_0xece0c1);});});}exports[_0x498a('0x17')]=function(_0x47b26d){var _0x2e3cf4=this;return new Promise(function(_0x57dcb0,_0x11a3ec){return db[_0x498a('0x18')]['findAll']({'raw':_0x47b26d[_0x498a('0x19')]?_0x47b26d[_0x498a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x47b26d[_0x498a('0x19')]?_0x47b26d[_0x498a('0x19')][_0x498a('0x1a')]||null:null,'attributes':_0x47b26d[_0x498a('0x19')]?_0x47b26d[_0x498a('0x19')][_0x498a('0x1b')]||null:null,'limit':_0x47b26d['options']?_0x47b26d[_0x498a('0x19')][_0x498a('0x1c')]||null:null,'include':_0x47b26d[_0x498a('0x19')]?_0x47b26d['options'][_0x498a('0x1d')]?_[_0x498a('0x1e')](_0x47b26d[_0x498a('0x19')]['include'],function(_0x510384){return{'model':db[_0x510384[_0x498a('0x1f')]],'as':_0x510384['as'],'attributes':_0x510384[_0x498a('0x1b')],'include':_0x510384[_0x498a('0x1d')]?_['map'](_0x510384[_0x498a('0x1d')],function(_0x127511){return{'model':db[_0x127511['model']],'as':_0x127511['as'],'attributes':_0x127511[_0x498a('0x1b')],'include':_0x127511[_0x498a('0x1d')]?_[_0x498a('0x1e')](_0x127511[_0x498a('0x1d')],function(_0x762dfa){return{'model':db[_0x762dfa[_0x498a('0x1f')]],'as':_0x762dfa['as'],'attributes':_0x762dfa[_0x498a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x498a('0x20')](function(_0x275e38){logger[_0x498a('0xd')]('GetVtigerAccount',_0x47b26d);logger[_0x498a('0xf')](_0x498a('0x17'),_0x47b26d,JSON['stringify'](_0x275e38));_0x57dcb0(_0x275e38);})[_0x498a('0x16')](function(_0x17b244){logger[_0x498a('0x13')]('GetVtigerAccount',_0x17b244[_0x498a('0x15')],_0x47b26d);_0x11a3ec(_0x2e3cf4[_0x498a('0x13')](0x1f4,_0x17b244[_0x498a('0x15')]));});});};exports['ShowVtigerAccount']=function(_0x1dcf82){var _0x3ba260=this;return new Promise(function(_0x336855,_0xdfd688){return db[_0x498a('0x18')][_0x498a('0x21')]({'raw':_0x1dcf82['options']?_0x1dcf82[_0x498a('0x19')][_0x498a('0x22')]===undefined?!![]:![]:!![],'where':_0x1dcf82[_0x498a('0x19')]?_0x1dcf82['options'][_0x498a('0x1a')]||null:null,'attributes':_0x1dcf82[_0x498a('0x19')]?_0x1dcf82['options'][_0x498a('0x1b')]||null:null,'include':_0x1dcf82[_0x498a('0x19')]?_0x1dcf82[_0x498a('0x19')]['include']?_[_0x498a('0x1e')](_0x1dcf82[_0x498a('0x19')][_0x498a('0x1d')],function(_0x1d7153){return{'model':db[_0x1d7153['model']],'as':_0x1d7153['as'],'attributes':_0x1d7153[_0x498a('0x1b')],'include':_0x1d7153['include']?_[_0x498a('0x1e')](_0x1d7153[_0x498a('0x1d')],function(_0xe9b8da){return{'model':db[_0xe9b8da[_0x498a('0x1f')]],'as':_0xe9b8da['as'],'attributes':_0xe9b8da['attributes'],'include':_0xe9b8da[_0x498a('0x1d')]?_[_0x498a('0x1e')](_0xe9b8da[_0x498a('0x1d')],function(_0x30e586){return{'model':db[_0x30e586['model']],'as':_0x30e586['as'],'attributes':_0x30e586[_0x498a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x498a('0x20')](function(_0x1b9ef2){logger[_0x498a('0xd')](_0x498a('0x23'),_0x1dcf82);logger[_0x498a('0xf')]('ShowVtigerAccount',_0x1dcf82,JSON[_0x498a('0x12')](_0x1b9ef2));_0x336855(_0x1b9ef2);})[_0x498a('0x16')](function(_0x3d639a){logger[_0x498a('0x13')](_0x498a('0x23'),_0x3d639a[_0x498a('0x15')],_0x1dcf82);_0xdfd688(_0x3ba260[_0x498a('0x13')](0x1f4,_0x3d639a[_0x498a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index fc8b06c..446c9e8 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 _0xc4aa=['getDescriptions','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xc4aa[_0x88cd7b];return _0x56fcc8;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['get'](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);router['get'](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0x12')]);router[_0xac4a('0x13')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x14')]);router[_0xac4a('0x15')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x16')]);module[_0xac4a('0x17')]=router; \ No newline at end of file +var _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x2a79ae,_0x2992d4){var _0x431086=function(_0xf5eec2){while(--_0xf5eec2){_0x2a79ae['push'](_0x2a79ae['shift']());}};_0x431086(++_0x2992d4);}(_0x7a54,0x106));var _0x47a5=function(_0x448104,_0x3cf4ce){_0x448104=_0x448104-0x0;var _0x2d4000=_0x7a54[_0x448104];return _0x2d4000;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 8635c59..5dd7d75 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 _0x495f=['STRING','sequelize','exports'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x495f,0x109));var _0xf495=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x495f[_0x273c39];return _0x46d6b5;};'use strict';var Sequelize=require(_0xf495('0x0'));module[_0xf495('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf495('0x2')]}}; \ No newline at end of file +var _0x480f=['STRING','sequelize'];(function(_0x30a761,_0x2e6e9c){var _0x9971e4=function(_0x3e4b27){while(--_0x3e4b27){_0x30a761['push'](_0x30a761['shift']());}};_0x9971e4(++_0x2e6e9c);}(_0x480f,0x117));var _0xf480=function(_0x3058bc,_0x391ddb){_0x3058bc=_0x3058bc-0x0;var _0x586a60=_0x480f[_0x3058bc];return _0x586a60;};'use strict';var Sequelize=require(_0xf480('0x0'));module['exports']={'name':{'type':Sequelize[_0xf480('0x1')]},'description':{'type':Sequelize[_0xf480('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index fc92f6e..032c950 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 _0xe93b=['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/environment','../../config/license/util','../../mysqldb','http','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','json','offset','limit','Content-Range','apply','reject','update','destroy','end','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','show','params','options','find','create','body','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x34bbab,_0x2775e6){var _0x574c21=function(_0x4932de){while(--_0x4932de){_0x34bbab['push'](_0x34bbab['shift']());}};_0x574c21(++_0x2775e6);}(_0xe93b,0x1c2));var _0xbe93=function(_0x177bf6,_0x2be0d7){_0x177bf6=_0x177bf6-0x0;var _0x1f7b80=_0xe93b[_0x177bf6];return _0x1f7b80;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbe93('0x0'));var rimraf=require(_0xbe93('0x1'));var zipdir=require(_0xbe93('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbe93('0x3'));var moment=require(_0xbe93('0x4'));var BPromise=require(_0xbe93('0x5'));var Mustache=require(_0xbe93('0x6'));var util=require(_0xbe93('0x7'));var path=require(_0xbe93('0x8'));var sox=require(_0xbe93('0x9'));var csv=require(_0xbe93('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbe93('0xb'));var _=require(_0xbe93('0xc'));var squel=require(_0xbe93('0xd'));var crypto=require(_0xbe93('0xe'));var jsforce=require(_0xbe93('0xf'));var deskjs=require(_0xbe93('0x10'));var toCsv=require(_0xbe93('0xa'));var querystring=require(_0xbe93('0x11'));var Papa=require(_0xbe93('0x12'));var Redis=require('ioredis');var authService=require(_0xbe93('0x13'));var qs=require(_0xbe93('0x14'));var as=require(_0xbe93('0x15'));var hardwareService=require(_0xbe93('0x16'));var logger=require(_0xbe93('0x17'))(_0xbe93('0x18'));var utils=require('../../config/utils');var config=require(_0xbe93('0x19'));var licenseUtil=require(_0xbe93('0x1a'));var db=require(_0xbe93('0x1b'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xbe93('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x34b431,_0x26174b,_0x5c9c57,_0x527a2f){return new BPromise(function(_0x24ae1c,_0x223a49){var _0x3e3bc5=_0x527a2f||client;return _0x3e3bc5[_0xbe93('0x1d')](_0x34b431,_0x5c9c57)[_0xbe93('0x1e')](function(_0x8749fa){logger['info'](_0xbe93('0x1f'),_0x26174b,_0xbe93('0x20'));logger['debug'](_0xbe93('0x21'),_0x26174b,_0xbe93('0x20'),JSON['stringify'](_0x8749fa));if(_0x8749fa['error']){if(_0x8749fa[_0xbe93('0x22')][_0xbe93('0x23')]===0x1f4){logger['error'](_0xbe93('0x1f'),_0x26174b,_0x8749fa[_0xbe93('0x22')][_0xbe93('0x24')]);return _0x223a49(_0x8749fa[_0xbe93('0x22')][_0xbe93('0x24')]);}logger[_0xbe93('0x22')](_0xbe93('0x1f'),_0x26174b,_0x8749fa['error'][_0xbe93('0x24')]);return _0x24ae1c(_0x8749fa[_0xbe93('0x22')][_0xbe93('0x24')]);}else{logger[_0xbe93('0x25')](_0xbe93('0x1f'),_0x26174b,'request\x20sent');_0x24ae1c(_0x8749fa[_0xbe93('0x26')][_0xbe93('0x24')]);}})[_0xbe93('0x27')](function(_0x118798){logger[_0xbe93('0x22')]('VtigerConfiguration,\x20%s,\x20%s',_0x26174b,_0x118798);_0x223a49(_0x118798);});});}function respondWithStatusCode(_0x4d80ac,_0x14629a){_0x14629a=_0x14629a||0xcc;return function(_0x1dcc26){if(_0x1dcc26){return _0x4d80ac[_0xbe93('0x28')](_0x14629a);}return _0x4d80ac[_0xbe93('0x29')](_0x14629a)['end']();};}function respondWithResult(_0x26470f,_0x171279){_0x171279=_0x171279||0xc8;return function(_0x2517eb){if(_0x2517eb){return _0x26470f[_0xbe93('0x29')](_0x171279)[_0xbe93('0x2a')](_0x2517eb);}};}function respondWithFilteredResult(_0x153d40,_0x34d124){return function(_0x2d1de2){if(_0x2d1de2){var _0x28da32=_0x2d1de2['count'],_0x34bef0=_0x34d124[_0xbe93('0x2b')],_0xdcf0c4=_0x34d124[_0xbe93('0x2b')]+_0x34d124[_0xbe93('0x2c')],_0x94dfca;if(_0xdcf0c4>=_0x28da32){_0xdcf0c4=_0x28da32;_0x94dfca=0xc8;}else{_0x94dfca=0xce;}_0x153d40[_0xbe93('0x29')](_0x94dfca);return _0x153d40['set'](_0xbe93('0x2d'),_0x34bef0+'-'+_0xdcf0c4+'/'+_0x28da32)['json'](_0x2d1de2);}return null;};}function patchUpdates(_0x5ec553){return function(_0x356c09){try{jsonpatch[_0xbe93('0x2e')](_0x356c09,_0x5ec553,!![]);}catch(_0x24f605){return BPromise[_0xbe93('0x2f')](_0x24f605);}return _0x356c09['save']();};}function saveUpdates(_0x50da57,_0x4113cd){return function(_0x353bfe){if(_0x353bfe){return _0x353bfe[_0xbe93('0x30')](_0x50da57)[_0xbe93('0x1e')](function(_0x3c5790){return _0x3c5790;});}return null;};}function removeEntity(_0x11ce49,_0x3fb06c){return function(_0x2d8611){if(_0x2d8611){return _0x2d8611[_0xbe93('0x31')]()[_0xbe93('0x1e')](function(){_0x11ce49[_0xbe93('0x29')](0xcc)[_0xbe93('0x32')]();});}};}function handleEntityNotFound(_0x5802de,_0x5c1784){return function(_0x4592b1){if(!_0x4592b1){_0x5802de[_0xbe93('0x28')](0x194);}return _0x4592b1;};}function handleError(_0x6eff79,_0xf4185b){_0xf4185b=_0xf4185b||0x1f4;return function(_0x115b2b){logger['error'](_0x115b2b[_0xbe93('0x33')]);if(_0x115b2b[_0xbe93('0x34')]){delete _0x115b2b['name'];}_0x6eff79[_0xbe93('0x29')](_0xf4185b)[_0xbe93('0x35')](_0x115b2b);};}exports[_0xbe93('0x36')]=function(_0x152173,_0x40ee82){var _0x23d501={},_0x44c604={},_0x226641={'count':0x0,'rows':[]};var _0x57bf56=_[_0xbe93('0x37')](db[_0xbe93('0x38')][_0xbe93('0x39')],function(_0x1ff4be){return{'name':_0x1ff4be[_0xbe93('0x3a')],'type':_0x1ff4be[_0xbe93('0x3b')][_0xbe93('0x3c')]};});_0x44c604['model']=_[_0xbe93('0x37')](_0x57bf56,_0xbe93('0x34'));_0x44c604[_0xbe93('0x3d')]=_[_0xbe93('0x3e')](_0x152173[_0xbe93('0x3d')]);_0x44c604[_0xbe93('0x3f')]=_[_0xbe93('0x40')](_0x44c604[_0xbe93('0x41')],_0x44c604['query']);_0x23d501[_0xbe93('0x42')]=_[_0xbe93('0x40')](_0x44c604[_0xbe93('0x41')],qs[_0xbe93('0x43')](_0x152173[_0xbe93('0x3d')]['fields']));_0x23d501['attributes']=_0x23d501[_0xbe93('0x42')][_0xbe93('0x44')]?_0x23d501[_0xbe93('0x42')]:_0x44c604[_0xbe93('0x41')];if(!_0x152173[_0xbe93('0x3d')][_0xbe93('0x45')](_0xbe93('0x46'))){_0x23d501[_0xbe93('0x2c')]=qs['limit'](_0x152173[_0xbe93('0x3d')][_0xbe93('0x2c')]);_0x23d501[_0xbe93('0x2b')]=qs[_0xbe93('0x2b')](_0x152173['query'][_0xbe93('0x2b')]);}_0x23d501[_0xbe93('0x47')]=qs[_0xbe93('0x48')](_0x152173[_0xbe93('0x3d')]['sort']);_0x23d501[_0xbe93('0x49')]=qs[_0xbe93('0x3f')](_[_0xbe93('0x4a')](_0x152173[_0xbe93('0x3d')],_0x44c604[_0xbe93('0x3f')]),_0x57bf56);if(_0x152173[_0xbe93('0x3d')][_0xbe93('0x4b')]){_0x23d501['where']=_[_0xbe93('0x4c')](_0x23d501[_0xbe93('0x49')],{'$or':_[_0xbe93('0x37')](_0x57bf56,function(_0x160492){if(_0x160492[_0xbe93('0x3b')]!==_0xbe93('0x4d')){var _0x1c9e9f={};_0x1c9e9f[_0x160492[_0xbe93('0x34')]]={'$like':'%'+_0x152173[_0xbe93('0x3d')][_0xbe93('0x4b')]+'%'};return _0x1c9e9f;}})});}_0x23d501=_[_0xbe93('0x4c')]({},_0x23d501,_0x152173['options']);var _0x3d287c={'where':_0x23d501[_0xbe93('0x49')]};return db[_0xbe93('0x38')][_0xbe93('0x4e')](_0x3d287c)[_0xbe93('0x1e')](function(_0x595be3){_0x226641[_0xbe93('0x4e')]=_0x595be3;if(_0x152173[_0xbe93('0x3d')][_0xbe93('0x4f')]){_0x23d501[_0xbe93('0x50')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x23d501);})['then'](function(_0x3ad3b7){_0x226641['rows']=_0x3ad3b7;return _0x226641;})[_0xbe93('0x1e')](respondWithFilteredResult(_0x40ee82,_0x23d501))[_0xbe93('0x27')](handleError(_0x40ee82,null));};exports[_0xbe93('0x51')]=function(_0x532f95,_0x2b208d){var _0x5d780b={'raw':![],'where':{'id':_0x532f95[_0xbe93('0x52')]['id']}},_0x2fe346={};_0x2fe346[_0xbe93('0x41')]=_[_0xbe93('0x3e')](db['VtigerConfiguration'][_0xbe93('0x39')]);_0x2fe346[_0xbe93('0x3d')]=_['keys'](_0x532f95[_0xbe93('0x3d')]);_0x2fe346['filters']=_['intersection'](_0x2fe346['model'],_0x2fe346[_0xbe93('0x3d')]);_0x5d780b['attributes']=_[_0xbe93('0x40')](_0x2fe346['model'],qs[_0xbe93('0x43')](_0x532f95['query']['fields']));_0x5d780b['attributes']=_0x5d780b['attributes'][_0xbe93('0x44')]?_0x5d780b['attributes']:_0x2fe346[_0xbe93('0x41')];if(_0x532f95[_0xbe93('0x3d')][_0xbe93('0x4f')]){_0x5d780b['include']=[{'all':!![]}];}_0x5d780b=_[_0xbe93('0x4c')]({},_0x5d780b,_0x532f95[_0xbe93('0x53')]);return db['VtigerConfiguration'][_0xbe93('0x54')](_0x5d780b)[_0xbe93('0x1e')](handleEntityNotFound(_0x2b208d,null))['then'](respondWithResult(_0x2b208d,null))[_0xbe93('0x27')](handleError(_0x2b208d,null));};exports[_0xbe93('0x55')]=function(_0x5f843,_0x34631a){return db[_0xbe93('0x38')][_0xbe93('0x55')](_0x5f843[_0xbe93('0x56')],{})[_0xbe93('0x1e')](respondWithResult(_0x34631a,0xc9))[_0xbe93('0x27')](handleError(_0x34631a,null));};exports['update']=function(_0x1c90c0,_0x4ff07f){if(_0x1c90c0['body']['id']){delete _0x1c90c0[_0xbe93('0x56')]['id'];}return db['VtigerConfiguration'][_0xbe93('0x54')]({'where':{'id':_0x1c90c0['params']['id']}})[_0xbe93('0x1e')](handleEntityNotFound(_0x4ff07f,null))[_0xbe93('0x1e')](saveUpdates(_0x1c90c0[_0xbe93('0x56')],null))['then'](respondWithResult(_0x4ff07f,null))[_0xbe93('0x27')](handleError(_0x4ff07f,null));};exports[_0xbe93('0x31')]=function(_0xabeff8,_0x4b3b57){return db[_0xbe93('0x38')][_0xbe93('0x54')]({'where':{'id':_0xabeff8[_0xbe93('0x52')]['id']}})[_0xbe93('0x1e')](handleEntityNotFound(_0x4b3b57,null))['then'](removeEntity(_0x4b3b57,null))[_0xbe93('0x27')](handleError(_0x4b3b57,null));};exports[_0xbe93('0x57')]=function(_0x2de35e,_0x3e7e1b,_0xf8436d){var _0x1ae04d={};var _0xf26fc4={};var _0x1a2fac;var _0x36cbd1;return db[_0xbe93('0x38')][_0xbe93('0x58')]({'where':{'id':_0x2de35e[_0xbe93('0x52')]['id']}})['then'](handleEntityNotFound(_0x3e7e1b,null))[_0xbe93('0x1e')](function(_0x16e9f3){if(_0x16e9f3){_0x1a2fac=_0x16e9f3;_0xf26fc4['model']=_[_0xbe93('0x3e')](db[_0xbe93('0x59')][_0xbe93('0x39')]);_0xf26fc4[_0xbe93('0x3d')]=_['keys'](_0x2de35e[_0xbe93('0x3d')]);_0xf26fc4[_0xbe93('0x3f')]=_['intersection'](_0xf26fc4['model'],_0xf26fc4[_0xbe93('0x3d')]);_0x1ae04d[_0xbe93('0x42')]=_[_0xbe93('0x40')](_0xf26fc4[_0xbe93('0x41')],qs[_0xbe93('0x43')](_0x2de35e[_0xbe93('0x3d')][_0xbe93('0x43')]));_0x1ae04d[_0xbe93('0x42')]=_0x1ae04d[_0xbe93('0x42')]['length']?_0x1ae04d[_0xbe93('0x42')]:_0xf26fc4['model'];_0x1ae04d[_0xbe93('0x47')]=qs['sort'](_0x2de35e[_0xbe93('0x3d')]['sort']);_0x1ae04d[_0xbe93('0x49')]=qs[_0xbe93('0x3f')](_[_0xbe93('0x4a')](_0x2de35e[_0xbe93('0x3d')],_0xf26fc4[_0xbe93('0x3f')]));if(_0x2de35e[_0xbe93('0x3d')]['filter']){_0x1ae04d[_0xbe93('0x49')]=_[_0xbe93('0x4c')](_0x1ae04d[_0xbe93('0x49')],{'$or':_[_0xbe93('0x37')](_0x1ae04d[_0xbe93('0x42')],function(_0x34a57d){var _0x26d74c={};_0x26d74c[_0x34a57d]={'$like':'%'+_0x2de35e[_0xbe93('0x3d')]['filter']+'%'};return _0x26d74c;})});}_0x1ae04d=_[_0xbe93('0x4c')]({},_0x1ae04d,_0x2de35e[_0xbe93('0x53')]);return _0x1a2fac['getFields'](_0x1ae04d);}})['then'](function(_0x27f137){if(_0x27f137){_0x36cbd1=_0x27f137[_0xbe93('0x44')];if(!_0x2de35e[_0xbe93('0x3d')][_0xbe93('0x45')](_0xbe93('0x46'))){_0x1ae04d[_0xbe93('0x2c')]=qs[_0xbe93('0x2c')](_0x2de35e['query'][_0xbe93('0x2c')]);_0x1ae04d[_0xbe93('0x2b')]=qs[_0xbe93('0x2b')](_0x2de35e[_0xbe93('0x3d')][_0xbe93('0x2b')]);}return _0x1a2fac['getFields'](_0x1ae04d);}})[_0xbe93('0x1e')](function(_0x531684){if(_0x531684){return _0x531684?{'count':_0x36cbd1,'rows':_0x531684}:null;}})[_0xbe93('0x1e')](respondWithResult(_0x3e7e1b,null))[_0xbe93('0x27')](handleError(_0x3e7e1b,null));};exports[_0xbe93('0x5a')]=function(_0x1142a6,_0x4684c1,_0x5a7a3f){var _0x5e44ca={};var _0x5865ad={};var _0x574529;var _0x3b1a6e;return db['VtigerConfiguration'][_0xbe93('0x58')]({'where':{'id':_0x1142a6[_0xbe93('0x52')]['id']}})[_0xbe93('0x1e')](handleEntityNotFound(_0x4684c1,null))[_0xbe93('0x1e')](function(_0x222c3c){if(_0x222c3c){_0x574529=_0x222c3c;_0x5865ad[_0xbe93('0x41')]=_[_0xbe93('0x3e')](db['VtigerField'][_0xbe93('0x39')]);_0x5865ad[_0xbe93('0x3d')]=_['keys'](_0x1142a6[_0xbe93('0x3d')]);_0x5865ad[_0xbe93('0x3f')]=_[_0xbe93('0x40')](_0x5865ad['model'],_0x5865ad[_0xbe93('0x3d')]);_0x5e44ca[_0xbe93('0x42')]=_[_0xbe93('0x40')](_0x5865ad[_0xbe93('0x41')],qs[_0xbe93('0x43')](_0x1142a6['query']['fields']));_0x5e44ca[_0xbe93('0x42')]=_0x5e44ca[_0xbe93('0x42')][_0xbe93('0x44')]?_0x5e44ca[_0xbe93('0x42')]:_0x5865ad[_0xbe93('0x41')];_0x5e44ca['order']=qs[_0xbe93('0x48')](_0x1142a6[_0xbe93('0x3d')][_0xbe93('0x48')]);_0x5e44ca[_0xbe93('0x49')]=qs['filters'](_[_0xbe93('0x4a')](_0x1142a6['query'],_0x5865ad[_0xbe93('0x3f')]));if(_0x1142a6['query'][_0xbe93('0x4b')]){_0x5e44ca['where']=_[_0xbe93('0x4c')](_0x5e44ca['where'],{'$or':_['map'](_0x5e44ca[_0xbe93('0x42')],function(_0x284fca){var _0x38abd0={};_0x38abd0[_0x284fca]={'$like':'%'+_0x1142a6[_0xbe93('0x3d')][_0xbe93('0x4b')]+'%'};return _0x38abd0;})});}_0x5e44ca=_[_0xbe93('0x4c')]({},_0x5e44ca,_0x1142a6[_0xbe93('0x53')]);return _0x574529[_0xbe93('0x5a')](_0x5e44ca);}})[_0xbe93('0x1e')](function(_0xf3b7d3){if(_0xf3b7d3){_0x3b1a6e=_0xf3b7d3[_0xbe93('0x44')];if(!_0x1142a6['query'][_0xbe93('0x45')](_0xbe93('0x46'))){_0x5e44ca[_0xbe93('0x2c')]=qs[_0xbe93('0x2c')](_0x1142a6['query'][_0xbe93('0x2c')]);_0x5e44ca[_0xbe93('0x2b')]=qs[_0xbe93('0x2b')](_0x1142a6[_0xbe93('0x3d')][_0xbe93('0x2b')]);}return _0x574529[_0xbe93('0x5a')](_0x5e44ca);}})[_0xbe93('0x1e')](function(_0x51ebc2){if(_0x51ebc2){return _0x51ebc2?{'count':_0x3b1a6e,'rows':_0x51ebc2}:null;}})['then'](respondWithResult(_0x4684c1,null))['catch'](handleError(_0x4684c1,null));};exports['getDescriptions']=function(_0x1644c0,_0x200110,_0x156a6e){var _0x21531d={};var _0x3c1498={};var _0x4a44dc;var _0x270166;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x1644c0[_0xbe93('0x52')]['id']}})[_0xbe93('0x1e')](handleEntityNotFound(_0x200110,null))[_0xbe93('0x1e')](function(_0x569233){if(_0x569233){_0x4a44dc=_0x569233;_0x3c1498[_0xbe93('0x41')]=_['keys'](db[_0xbe93('0x59')][_0xbe93('0x39')]);_0x3c1498[_0xbe93('0x3d')]=_[_0xbe93('0x3e')](_0x1644c0[_0xbe93('0x3d')]);_0x3c1498[_0xbe93('0x3f')]=_[_0xbe93('0x40')](_0x3c1498[_0xbe93('0x41')],_0x3c1498[_0xbe93('0x3d')]);_0x21531d[_0xbe93('0x42')]=_[_0xbe93('0x40')](_0x3c1498[_0xbe93('0x41')],qs[_0xbe93('0x43')](_0x1644c0[_0xbe93('0x3d')]['fields']));_0x21531d['attributes']=_0x21531d[_0xbe93('0x42')]['length']?_0x21531d[_0xbe93('0x42')]:_0x3c1498['model'];_0x21531d[_0xbe93('0x47')]=qs[_0xbe93('0x48')](_0x1644c0[_0xbe93('0x3d')]['sort']);_0x21531d[_0xbe93('0x49')]=qs[_0xbe93('0x3f')](_['pick'](_0x1644c0['query'],_0x3c1498['filters']));if(_0x1644c0[_0xbe93('0x3d')][_0xbe93('0x4b')]){_0x21531d[_0xbe93('0x49')]=_['merge'](_0x21531d[_0xbe93('0x49')],{'$or':_[_0xbe93('0x37')](_0x21531d[_0xbe93('0x42')],function(_0x3fa17c){var _0x25b944={};_0x25b944[_0x3fa17c]={'$like':'%'+_0x1644c0[_0xbe93('0x3d')][_0xbe93('0x4b')]+'%'};return _0x25b944;})});}_0x21531d=_[_0xbe93('0x4c')]({},_0x21531d,_0x1644c0['options']);return _0x4a44dc['getDescriptions'](_0x21531d);}})[_0xbe93('0x1e')](function(_0x3e54c2){if(_0x3e54c2){_0x270166=_0x3e54c2[_0xbe93('0x44')];if(!_0x1644c0[_0xbe93('0x3d')][_0xbe93('0x45')](_0xbe93('0x46'))){_0x21531d[_0xbe93('0x2c')]=qs[_0xbe93('0x2c')](_0x1644c0[_0xbe93('0x3d')][_0xbe93('0x2c')]);_0x21531d['offset']=qs[_0xbe93('0x2b')](_0x1644c0[_0xbe93('0x3d')]['offset']);}return _0x4a44dc[_0xbe93('0x5b')](_0x21531d);}})[_0xbe93('0x1e')](function(_0x14aa27){if(_0x14aa27){return _0x14aa27?{'count':_0x270166,'rows':_0x14aa27}:null;}})[_0xbe93('0x1e')](respondWithResult(_0x200110,null))['catch'](handleError(_0x200110,null));}; \ No newline at end of file +var _0xb7d8=['body','params','getFields','findOne','VtigerField','fields','pick','hasOwnProperty','getSubjects','getDescriptions','nolimit','html-pdf','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','client','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','status','end','json','count','offset','limit','set','apply','update','destroy','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','order','sort','filter','where','options','VtigerConfiguration','includeAll','include','findAll','rows','catch','show','keys','length','merge','create'];(function(_0x31a6ac,_0xe74ba3){var _0x213b09=function(_0x2946d2){while(--_0x2946d2){_0x31a6ac['push'](_0x31a6ac['shift']());}};_0x213b09(++_0xe74ba3);}(_0xb7d8,0x163));var _0x8b7d=function(_0x2b30aa,_0x4ea2b8){_0x2b30aa=_0x2b30aa-0x0;var _0x166e92=_0xb7d8[_0x2b30aa];return _0x166e92;};'use strict';var pdf=require(_0x8b7d('0x0'));var emlformat=require(_0x8b7d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8b7d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8b7d('0x3'));var BPromise=require(_0x8b7d('0x4'));var Mustache=require('mustache');var util=require(_0x8b7d('0x5'));var path=require(_0x8b7d('0x6'));var sox=require(_0x8b7d('0x7'));var csv=require(_0x8b7d('0x8'));var ejs=require(_0x8b7d('0x9'));var fs=require('fs');var fs_extra=require(_0x8b7d('0xa'));var _=require(_0x8b7d('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8b7d('0xc'));var deskjs=require(_0x8b7d('0xd'));var toCsv=require(_0x8b7d('0x8'));var querystring=require(_0x8b7d('0xe'));var Papa=require(_0x8b7d('0xf'));var Redis=require(_0x8b7d('0x10'));var authService=require(_0x8b7d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8b7d('0x12'));var hardwareService=require(_0x8b7d('0x13'));var logger=require(_0x8b7d('0x14'))(_0x8b7d('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8b7d('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x8b7d('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7f532b,_0x5c7b5c,_0x43e831,_0x41d192){return new BPromise(function(_0x166ac9,_0x4d6da0){var _0x38fec4=_0x41d192||client;return _0x38fec4[_0x8b7d('0x18')](_0x7f532b,_0x43e831)[_0x8b7d('0x19')](function(_0x1a6dc1){logger[_0x8b7d('0x1a')](_0x8b7d('0x1b'),_0x5c7b5c,'request\x20sent');logger[_0x8b7d('0x1c')](_0x8b7d('0x1d'),_0x5c7b5c,_0x8b7d('0x1e'),JSON[_0x8b7d('0x1f')](_0x1a6dc1));if(_0x1a6dc1[_0x8b7d('0x20')]){if(_0x1a6dc1[_0x8b7d('0x20')][_0x8b7d('0x21')]===0x1f4){logger['error'](_0x8b7d('0x1b'),_0x5c7b5c,_0x1a6dc1[_0x8b7d('0x20')]['message']);return _0x4d6da0(_0x1a6dc1['error'][_0x8b7d('0x22')]);}logger[_0x8b7d('0x20')]('VtigerConfiguration,\x20%s,\x20%s',_0x5c7b5c,_0x1a6dc1[_0x8b7d('0x20')][_0x8b7d('0x22')]);return _0x166ac9(_0x1a6dc1[_0x8b7d('0x20')][_0x8b7d('0x22')]);}else{logger[_0x8b7d('0x1a')](_0x8b7d('0x1b'),_0x5c7b5c,_0x8b7d('0x1e'));_0x166ac9(_0x1a6dc1['result']['message']);}})['catch'](function(_0x5c82be){logger[_0x8b7d('0x20')](_0x8b7d('0x1b'),_0x5c7b5c,_0x5c82be);_0x4d6da0(_0x5c82be);});});}function respondWithStatusCode(_0x519d6e,_0x113c64){_0x113c64=_0x113c64||0xcc;return function(_0x3b435c){if(_0x3b435c){return _0x519d6e[_0x8b7d('0x23')](_0x113c64);}return _0x519d6e[_0x8b7d('0x24')](_0x113c64)[_0x8b7d('0x25')]();};}function respondWithResult(_0x2a27d4,_0x5664ef){_0x5664ef=_0x5664ef||0xc8;return function(_0x4f002a){if(_0x4f002a){return _0x2a27d4[_0x8b7d('0x24')](_0x5664ef)[_0x8b7d('0x26')](_0x4f002a);}};}function respondWithFilteredResult(_0x2f81fa,_0x1c35f7){return function(_0x492b6f){if(_0x492b6f){var _0x434231=_0x492b6f[_0x8b7d('0x27')],_0x525829=_0x1c35f7[_0x8b7d('0x28')],_0xe50704=_0x1c35f7[_0x8b7d('0x28')]+_0x1c35f7[_0x8b7d('0x29')],_0x301f80;if(_0xe50704>=_0x434231){_0xe50704=_0x434231;_0x301f80=0xc8;}else{_0x301f80=0xce;}_0x2f81fa['status'](_0x301f80);return _0x2f81fa[_0x8b7d('0x2a')]('Content-Range',_0x525829+'-'+_0xe50704+'/'+_0x434231)[_0x8b7d('0x26')](_0x492b6f);}return null;};}function patchUpdates(_0x1f45ea){return function(_0x446e6f){try{jsonpatch[_0x8b7d('0x2b')](_0x446e6f,_0x1f45ea,!![]);}catch(_0x262517){return BPromise['reject'](_0x262517);}return _0x446e6f['save']();};}function saveUpdates(_0x5cf8fd,_0x1dd29e){return function(_0x46377e){if(_0x46377e){return _0x46377e[_0x8b7d('0x2c')](_0x5cf8fd)[_0x8b7d('0x19')](function(_0x1b1d42){return _0x1b1d42;});}return null;};}function removeEntity(_0x5130e1,_0x408533){return function(_0x43ba4b){if(_0x43ba4b){return _0x43ba4b[_0x8b7d('0x2d')]()[_0x8b7d('0x19')](function(){_0x5130e1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x70cbd3,_0xec9b0d){return function(_0x1e5c60){if(!_0x1e5c60){_0x70cbd3['sendStatus'](0x194);}return _0x1e5c60;};}function handleError(_0x462a1d,_0x4d5aa0){_0x4d5aa0=_0x4d5aa0||0x1f4;return function(_0x260db9){logger[_0x8b7d('0x20')](_0x260db9[_0x8b7d('0x2e')]);if(_0x260db9[_0x8b7d('0x2f')]){delete _0x260db9[_0x8b7d('0x2f')];}_0x462a1d['status'](_0x4d5aa0)[_0x8b7d('0x30')](_0x260db9);};}exports[_0x8b7d('0x31')]=function(_0x1b4b4d,_0x413dff){var _0x46ca9e={},_0x5af419={},_0x33f982={'count':0x0,'rows':[]};var _0x45e80f=_[_0x8b7d('0x32')](db['VtigerConfiguration'][_0x8b7d('0x33')],function(_0x40c069){return{'name':_0x40c069['fieldName'],'type':_0x40c069[_0x8b7d('0x34')][_0x8b7d('0x35')]};});_0x5af419[_0x8b7d('0x36')]=_[_0x8b7d('0x32')](_0x45e80f,_0x8b7d('0x2f'));_0x5af419[_0x8b7d('0x37')]=_['keys'](_0x1b4b4d['query']);_0x5af419[_0x8b7d('0x38')]=_[_0x8b7d('0x39')](_0x5af419['model'],_0x5af419[_0x8b7d('0x37')]);_0x46ca9e[_0x8b7d('0x3a')]=_[_0x8b7d('0x39')](_0x5af419[_0x8b7d('0x36')],qs['fields'](_0x1b4b4d['query']['fields']));_0x46ca9e[_0x8b7d('0x3a')]=_0x46ca9e[_0x8b7d('0x3a')]['length']?_0x46ca9e[_0x8b7d('0x3a')]:_0x5af419[_0x8b7d('0x36')];if(!_0x1b4b4d['query']['hasOwnProperty']('nolimit')){_0x46ca9e['limit']=qs[_0x8b7d('0x29')](_0x1b4b4d['query']['limit']);_0x46ca9e[_0x8b7d('0x28')]=qs[_0x8b7d('0x28')](_0x1b4b4d[_0x8b7d('0x37')][_0x8b7d('0x28')]);}_0x46ca9e[_0x8b7d('0x3b')]=qs[_0x8b7d('0x3c')](_0x1b4b4d['query']['sort']);_0x46ca9e['where']=qs[_0x8b7d('0x38')](_['pick'](_0x1b4b4d[_0x8b7d('0x37')],_0x5af419[_0x8b7d('0x38')]),_0x45e80f);if(_0x1b4b4d[_0x8b7d('0x37')][_0x8b7d('0x3d')]){_0x46ca9e['where']=_['merge'](_0x46ca9e[_0x8b7d('0x3e')],{'$or':_[_0x8b7d('0x32')](_0x45e80f,function(_0x36ca7d){if(_0x36ca7d[_0x8b7d('0x34')]!=='VIRTUAL'){var _0x9f4688={};_0x9f4688[_0x36ca7d[_0x8b7d('0x2f')]]={'$like':'%'+_0x1b4b4d[_0x8b7d('0x37')]['filter']+'%'};return _0x9f4688;}})});}_0x46ca9e=_['merge']({},_0x46ca9e,_0x1b4b4d[_0x8b7d('0x3f')]);var _0xfe9525={'where':_0x46ca9e[_0x8b7d('0x3e')]};return db[_0x8b7d('0x40')][_0x8b7d('0x27')](_0xfe9525)[_0x8b7d('0x19')](function(_0x48a028){_0x33f982[_0x8b7d('0x27')]=_0x48a028;if(_0x1b4b4d[_0x8b7d('0x37')][_0x8b7d('0x41')]){_0x46ca9e[_0x8b7d('0x42')]=[{'all':!![]}];}return db[_0x8b7d('0x40')][_0x8b7d('0x43')](_0x46ca9e);})['then'](function(_0xa5383e){_0x33f982[_0x8b7d('0x44')]=_0xa5383e;return _0x33f982;})[_0x8b7d('0x19')](respondWithFilteredResult(_0x413dff,_0x46ca9e))[_0x8b7d('0x45')](handleError(_0x413dff,null));};exports[_0x8b7d('0x46')]=function(_0x5d5a0f,_0x226ded){var _0x5f507b={'raw':![],'where':{'id':_0x5d5a0f['params']['id']}},_0x2e1429={};_0x2e1429[_0x8b7d('0x36')]=_[_0x8b7d('0x47')](db[_0x8b7d('0x40')][_0x8b7d('0x33')]);_0x2e1429[_0x8b7d('0x37')]=_[_0x8b7d('0x47')](_0x5d5a0f[_0x8b7d('0x37')]);_0x2e1429[_0x8b7d('0x38')]=_[_0x8b7d('0x39')](_0x2e1429['model'],_0x2e1429[_0x8b7d('0x37')]);_0x5f507b[_0x8b7d('0x3a')]=_[_0x8b7d('0x39')](_0x2e1429[_0x8b7d('0x36')],qs['fields'](_0x5d5a0f['query']['fields']));_0x5f507b[_0x8b7d('0x3a')]=_0x5f507b[_0x8b7d('0x3a')][_0x8b7d('0x48')]?_0x5f507b[_0x8b7d('0x3a')]:_0x2e1429[_0x8b7d('0x36')];if(_0x5d5a0f[_0x8b7d('0x37')][_0x8b7d('0x41')]){_0x5f507b[_0x8b7d('0x42')]=[{'all':!![]}];}_0x5f507b=_[_0x8b7d('0x49')]({},_0x5f507b,_0x5d5a0f[_0x8b7d('0x3f')]);return db[_0x8b7d('0x40')]['find'](_0x5f507b)['then'](handleEntityNotFound(_0x226ded,null))[_0x8b7d('0x19')](respondWithResult(_0x226ded,null))[_0x8b7d('0x45')](handleError(_0x226ded,null));};exports[_0x8b7d('0x4a')]=function(_0x15986d,_0x284d9b){return db[_0x8b7d('0x40')][_0x8b7d('0x4a')](_0x15986d['body'],{})[_0x8b7d('0x19')](respondWithResult(_0x284d9b,0xc9))[_0x8b7d('0x45')](handleError(_0x284d9b,null));};exports[_0x8b7d('0x2c')]=function(_0x2528b2,_0x4ab916){if(_0x2528b2[_0x8b7d('0x4b')]['id']){delete _0x2528b2[_0x8b7d('0x4b')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x2528b2[_0x8b7d('0x4c')]['id']}})[_0x8b7d('0x19')](handleEntityNotFound(_0x4ab916,null))[_0x8b7d('0x19')](saveUpdates(_0x2528b2[_0x8b7d('0x4b')],null))[_0x8b7d('0x19')](respondWithResult(_0x4ab916,null))[_0x8b7d('0x45')](handleError(_0x4ab916,null));};exports['destroy']=function(_0x1de0dd,_0x422172){return db[_0x8b7d('0x40')]['find']({'where':{'id':_0x1de0dd[_0x8b7d('0x4c')]['id']}})[_0x8b7d('0x19')](handleEntityNotFound(_0x422172,null))[_0x8b7d('0x19')](removeEntity(_0x422172,null))[_0x8b7d('0x45')](handleError(_0x422172,null));};exports[_0x8b7d('0x4d')]=function(_0x2c1aa2,_0x620893,_0x584694){var _0x53ab7f={};var _0x70b6bd={};var _0x362059;var _0x4dd187;return db[_0x8b7d('0x40')][_0x8b7d('0x4e')]({'where':{'id':_0x2c1aa2['params']['id']}})[_0x8b7d('0x19')](handleEntityNotFound(_0x620893,null))['then'](function(_0x34d541){if(_0x34d541){_0x362059=_0x34d541;_0x70b6bd[_0x8b7d('0x36')]=_['keys'](db[_0x8b7d('0x4f')]['rawAttributes']);_0x70b6bd[_0x8b7d('0x37')]=_[_0x8b7d('0x47')](_0x2c1aa2[_0x8b7d('0x37')]);_0x70b6bd[_0x8b7d('0x38')]=_['intersection'](_0x70b6bd[_0x8b7d('0x36')],_0x70b6bd['query']);_0x53ab7f[_0x8b7d('0x3a')]=_[_0x8b7d('0x39')](_0x70b6bd['model'],qs['fields'](_0x2c1aa2[_0x8b7d('0x37')][_0x8b7d('0x50')]));_0x53ab7f['attributes']=_0x53ab7f['attributes']['length']?_0x53ab7f[_0x8b7d('0x3a')]:_0x70b6bd[_0x8b7d('0x36')];_0x53ab7f[_0x8b7d('0x3b')]=qs[_0x8b7d('0x3c')](_0x2c1aa2['query'][_0x8b7d('0x3c')]);_0x53ab7f[_0x8b7d('0x3e')]=qs[_0x8b7d('0x38')](_[_0x8b7d('0x51')](_0x2c1aa2[_0x8b7d('0x37')],_0x70b6bd[_0x8b7d('0x38')]));if(_0x2c1aa2[_0x8b7d('0x37')][_0x8b7d('0x3d')]){_0x53ab7f['where']=_[_0x8b7d('0x49')](_0x53ab7f[_0x8b7d('0x3e')],{'$or':_[_0x8b7d('0x32')](_0x53ab7f[_0x8b7d('0x3a')],function(_0x1a4f4a){var _0x2939dd={};_0x2939dd[_0x1a4f4a]={'$like':'%'+_0x2c1aa2[_0x8b7d('0x37')]['filter']+'%'};return _0x2939dd;})});}_0x53ab7f=_['merge']({},_0x53ab7f,_0x2c1aa2[_0x8b7d('0x3f')]);return _0x362059['getFields'](_0x53ab7f);}})[_0x8b7d('0x19')](function(_0x319de9){if(_0x319de9){_0x4dd187=_0x319de9[_0x8b7d('0x48')];if(!_0x2c1aa2['query'][_0x8b7d('0x52')]('nolimit')){_0x53ab7f[_0x8b7d('0x29')]=qs['limit'](_0x2c1aa2['query']['limit']);_0x53ab7f['offset']=qs[_0x8b7d('0x28')](_0x2c1aa2[_0x8b7d('0x37')][_0x8b7d('0x28')]);}return _0x362059[_0x8b7d('0x4d')](_0x53ab7f);}})[_0x8b7d('0x19')](function(_0x696b85){if(_0x696b85){return _0x696b85?{'count':_0x4dd187,'rows':_0x696b85}:null;}})[_0x8b7d('0x19')](respondWithResult(_0x620893,null))[_0x8b7d('0x45')](handleError(_0x620893,null));};exports['getSubjects']=function(_0x29bf09,_0x5342a3,_0x54e125){var _0x500af0={};var _0x13650d={};var _0x1d3bf5;var _0x22d925;return db[_0x8b7d('0x40')]['findOne']({'where':{'id':_0x29bf09['params']['id']}})[_0x8b7d('0x19')](handleEntityNotFound(_0x5342a3,null))[_0x8b7d('0x19')](function(_0x2423ce){if(_0x2423ce){_0x1d3bf5=_0x2423ce;_0x13650d[_0x8b7d('0x36')]=_[_0x8b7d('0x47')](db[_0x8b7d('0x4f')][_0x8b7d('0x33')]);_0x13650d['query']=_[_0x8b7d('0x47')](_0x29bf09['query']);_0x13650d[_0x8b7d('0x38')]=_[_0x8b7d('0x39')](_0x13650d[_0x8b7d('0x36')],_0x13650d[_0x8b7d('0x37')]);_0x500af0['attributes']=_[_0x8b7d('0x39')](_0x13650d[_0x8b7d('0x36')],qs[_0x8b7d('0x50')](_0x29bf09[_0x8b7d('0x37')][_0x8b7d('0x50')]));_0x500af0['attributes']=_0x500af0['attributes'][_0x8b7d('0x48')]?_0x500af0[_0x8b7d('0x3a')]:_0x13650d['model'];_0x500af0['order']=qs[_0x8b7d('0x3c')](_0x29bf09['query'][_0x8b7d('0x3c')]);_0x500af0[_0x8b7d('0x3e')]=qs[_0x8b7d('0x38')](_[_0x8b7d('0x51')](_0x29bf09['query'],_0x13650d[_0x8b7d('0x38')]));if(_0x29bf09[_0x8b7d('0x37')][_0x8b7d('0x3d')]){_0x500af0['where']=_[_0x8b7d('0x49')](_0x500af0[_0x8b7d('0x3e')],{'$or':_['map'](_0x500af0[_0x8b7d('0x3a')],function(_0x34c4fe){var _0x299a61={};_0x299a61[_0x34c4fe]={'$like':'%'+_0x29bf09[_0x8b7d('0x37')][_0x8b7d('0x3d')]+'%'};return _0x299a61;})});}_0x500af0=_[_0x8b7d('0x49')]({},_0x500af0,_0x29bf09['options']);return _0x1d3bf5[_0x8b7d('0x53')](_0x500af0);}})[_0x8b7d('0x19')](function(_0x4e835e){if(_0x4e835e){_0x22d925=_0x4e835e[_0x8b7d('0x48')];if(!_0x29bf09[_0x8b7d('0x37')][_0x8b7d('0x52')]('nolimit')){_0x500af0['limit']=qs['limit'](_0x29bf09[_0x8b7d('0x37')][_0x8b7d('0x29')]);_0x500af0[_0x8b7d('0x28')]=qs[_0x8b7d('0x28')](_0x29bf09[_0x8b7d('0x37')][_0x8b7d('0x28')]);}return _0x1d3bf5[_0x8b7d('0x53')](_0x500af0);}})[_0x8b7d('0x19')](function(_0xfff897){if(_0xfff897){return _0xfff897?{'count':_0x22d925,'rows':_0xfff897}:null;}})['then'](respondWithResult(_0x5342a3,null))[_0x8b7d('0x45')](handleError(_0x5342a3,null));};exports['getDescriptions']=function(_0x19a42c,_0x2b9355,_0x200684){var _0x11c1db={};var _0x565061={};var _0x38c04c;var _0xea79c8;return db[_0x8b7d('0x40')][_0x8b7d('0x4e')]({'where':{'id':_0x19a42c[_0x8b7d('0x4c')]['id']}})[_0x8b7d('0x19')](handleEntityNotFound(_0x2b9355,null))[_0x8b7d('0x19')](function(_0x114fed){if(_0x114fed){_0x38c04c=_0x114fed;_0x565061[_0x8b7d('0x36')]=_[_0x8b7d('0x47')](db[_0x8b7d('0x4f')][_0x8b7d('0x33')]);_0x565061[_0x8b7d('0x37')]=_[_0x8b7d('0x47')](_0x19a42c[_0x8b7d('0x37')]);_0x565061['filters']=_[_0x8b7d('0x39')](_0x565061[_0x8b7d('0x36')],_0x565061[_0x8b7d('0x37')]);_0x11c1db[_0x8b7d('0x3a')]=_['intersection'](_0x565061[_0x8b7d('0x36')],qs[_0x8b7d('0x50')](_0x19a42c[_0x8b7d('0x37')]['fields']));_0x11c1db[_0x8b7d('0x3a')]=_0x11c1db['attributes'][_0x8b7d('0x48')]?_0x11c1db[_0x8b7d('0x3a')]:_0x565061[_0x8b7d('0x36')];_0x11c1db['order']=qs[_0x8b7d('0x3c')](_0x19a42c['query']['sort']);_0x11c1db[_0x8b7d('0x3e')]=qs[_0x8b7d('0x38')](_[_0x8b7d('0x51')](_0x19a42c[_0x8b7d('0x37')],_0x565061['filters']));if(_0x19a42c['query']['filter']){_0x11c1db[_0x8b7d('0x3e')]=_['merge'](_0x11c1db[_0x8b7d('0x3e')],{'$or':_[_0x8b7d('0x32')](_0x11c1db['attributes'],function(_0x5233be){var _0x43fac1={};_0x43fac1[_0x5233be]={'$like':'%'+_0x19a42c[_0x8b7d('0x37')][_0x8b7d('0x3d')]+'%'};return _0x43fac1;})});}_0x11c1db=_[_0x8b7d('0x49')]({},_0x11c1db,_0x19a42c[_0x8b7d('0x3f')]);return _0x38c04c[_0x8b7d('0x54')](_0x11c1db);}})[_0x8b7d('0x19')](function(_0x2149e0){if(_0x2149e0){_0xea79c8=_0x2149e0[_0x8b7d('0x48')];if(!_0x19a42c['query'][_0x8b7d('0x52')](_0x8b7d('0x55'))){_0x11c1db['limit']=qs['limit'](_0x19a42c[_0x8b7d('0x37')][_0x8b7d('0x29')]);_0x11c1db[_0x8b7d('0x28')]=qs['offset'](_0x19a42c[_0x8b7d('0x37')][_0x8b7d('0x28')]);}return _0x38c04c[_0x8b7d('0x54')](_0x11c1db);}})[_0x8b7d('0x19')](function(_0x132789){if(_0x132789){return _0x132789?{'count':_0xea79c8,'rows':_0x132789}:null;}})[_0x8b7d('0x19')](respondWithResult(_0x2b9355,null))[_0x8b7d('0x45')](handleError(_0x2b9355,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index e783d39..f73962b 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 _0x7456=['rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x493241,_0x9cd3d3){var _0x31dbe5=function(_0x596b7f){while(--_0x596b7f){_0x493241['push'](_0x493241['shift']());}};_0x31dbe5(++_0x9cd3d3);}(_0x7456,0xfe));var _0x6745=function(_0x1177d5,_0x22b649){_0x1177d5=_0x1177d5-0x0;var _0xc3ddc2=_0x7456[_0x1177d5];return _0xc3ddc2;};'use strict';var _=require(_0x6745('0x0'));var util=require(_0x6745('0x1'));var logger=require(_0x6745('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6745('0x3'));var rp=require(_0x6745('0x4'));var fs=require('fs');var path=require(_0x6745('0x5'));var rimraf=require(_0x6745('0x6'));var config=require(_0x6745('0x7'));var attributes=require(_0x6745('0x8'));module[_0x6745('0x9')]=function(_0x321739,_0x454065){return _0x321739[_0x6745('0xa')](_0x6745('0xb'),attributes,{'tableName':_0x6745('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb23=['../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x3838af,_0x54b380){var _0x473f94=function(_0x3245c9){while(--_0x3245c9){_0x3838af['push'](_0x3838af['shift']());}};_0x473f94(++_0x54b380);}(_0xeb23,0x71));var _0x3eb2=function(_0x402f88,_0xaa6ea3){_0x402f88=_0x402f88-0x0;var _0x4a7acc=_0xeb23[_0x402f88];return _0x4a7acc;};'use strict';var _=require(_0x3eb2('0x0'));var util=require('util');var logger=require(_0x3eb2('0x1'))('api');var moment=require(_0x3eb2('0x2'));var BPromise=require(_0x3eb2('0x3'));var rp=require(_0x3eb2('0x4'));var fs=require('fs');var path=require(_0x3eb2('0x5'));var rimraf=require(_0x3eb2('0x6'));var config=require(_0x3eb2('0x7'));var attributes=require(_0x3eb2('0x8'));module['exports']=function(_0x21091d,_0x1bdb46){return _0x21091d[_0x3eb2('0x9')](_0x3eb2('0xa'),attributes,{'tableName':_0x3eb2('0xb'),'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 cc59350..4255966 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 _0x88bc=['bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x6dfbaa,_0x31eede){var _0xfbe02=function(_0x4adcaf){while(--_0x4adcaf){_0x6dfbaa['push'](_0x6dfbaa['shift']());}};_0xfbe02(++_0x31eede);}(_0x88bc,0x81));var _0xc88b=function(_0x2cc0b3,_0x120bf1){_0x2cc0b3=_0x2cc0b3-0x0;var _0x1667ef=_0x88bc[_0x2cc0b3];return _0x1667ef;};'use strict';var _=require(_0xc88b('0x0'));var util=require(_0xc88b('0x1'));var moment=require(_0xc88b('0x2'));var BPromise=require(_0xc88b('0x3'));var rs=require(_0xc88b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc88b('0x5'))(_0xc88b('0x6'));var config=require(_0xc88b('0x7'));var jayson=require(_0xc88b('0x8'));var client=jayson[_0xc88b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29d9ec,_0x1b3fce,_0x578bd9){return new BPromise(function(_0x3ffccf,_0x14f6ce){return client['request'](_0x29d9ec,_0x578bd9)[_0xc88b('0xa')](function(_0x5ca2b0){logger[_0xc88b('0xb')](_0xc88b('0xc'),_0x1b3fce,_0xc88b('0xd'));logger[_0xc88b('0xe')](_0xc88b('0xf'),_0x1b3fce,_0xc88b('0xd'),JSON[_0xc88b('0x10')](_0x5ca2b0));if(_0x5ca2b0[_0xc88b('0x11')]){if(_0x5ca2b0['error'][_0xc88b('0x12')]===0x1f4){logger[_0xc88b('0x11')](_0xc88b('0xc'),_0x1b3fce,_0x5ca2b0['error'][_0xc88b('0x13')]);return _0x14f6ce(_0x5ca2b0[_0xc88b('0x11')]['message']);}logger['error'](_0xc88b('0xc'),_0x1b3fce,_0x5ca2b0[_0xc88b('0x11')][_0xc88b('0x13')]);return _0x3ffccf(_0x5ca2b0[_0xc88b('0x11')]['message']);}else{logger[_0xc88b('0xb')](_0xc88b('0xc'),_0x1b3fce,_0xc88b('0xd'));_0x3ffccf(_0x5ca2b0[_0xc88b('0x14')][_0xc88b('0x13')]);}})[_0xc88b('0x15')](function(_0x2fa119){logger[_0xc88b('0x11')](_0xc88b('0xc'),_0x1b3fce,_0x2fa119);_0x14f6ce(_0x2fa119);});});} \ No newline at end of file +var _0x475d=['bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','request\x20sent','stringify','code','error','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x4c2958,_0x4b8be6){var _0x4135ae=function(_0x1f592e){while(--_0x1f592e){_0x4c2958['push'](_0x4c2958['shift']());}};_0x4135ae(++_0x4b8be6);}(_0x475d,0x101));var _0xd475=function(_0x27c13b,_0x53d77e){_0x27c13b=_0x27c13b-0x0;var _0x1fcd94=_0x475d[_0x27c13b];return _0x1fcd94;};'use strict';var _=require(_0xd475('0x0'));var util=require(_0xd475('0x1'));var moment=require(_0xd475('0x2'));var BPromise=require(_0xd475('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd475('0x4'))['db'];var utils=require(_0xd475('0x5'));var logger=require('../../config/logger')(_0xd475('0x6'));var config=require(_0xd475('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd475('0x8')][_0xd475('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d71cb,_0x19b790,_0x331a88){return new BPromise(function(_0x52d359,_0x57c58c){return client['request'](_0x4d71cb,_0x331a88)[_0xd475('0xa')](function(_0x2d04a4){logger[_0xd475('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0x19b790,_0xd475('0xc'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x19b790,_0xd475('0xc'),JSON[_0xd475('0xd')](_0x2d04a4));if(_0x2d04a4['error']){if(_0x2d04a4['error'][_0xd475('0xe')]===0x1f4){logger[_0xd475('0xf')](_0xd475('0x10'),_0x19b790,_0x2d04a4['error']['message']);return _0x57c58c(_0x2d04a4[_0xd475('0xf')][_0xd475('0x11')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x19b790,_0x2d04a4[_0xd475('0xf')][_0xd475('0x11')]);return _0x52d359(_0x2d04a4[_0xd475('0xf')][_0xd475('0x11')]);}else{logger['info'](_0xd475('0x10'),_0x19b790,'request\x20sent');_0x52d359(_0x2d04a4[_0xd475('0x12')][_0xd475('0x11')]);}})[_0xd475('0x13')](function(_0xe25519){logger[_0xd475('0xf')](_0xd475('0x10'),_0x19b790,_0xe25519);_0x57c58c(_0xe25519);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 7cca1de..4c3a4cf 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 _0x326f=['show','put','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','/:id'];(function(_0xa73841,_0x2072c1){var _0x5d365c=function(_0x45e242){while(--_0x45e242){_0xa73841['push'](_0xa73841['shift']());}};_0x5d365c(++_0x2072c1);}(_0x326f,0xd1));var _0xf326=function(_0x2ef21a,_0x25c19f){_0x2ef21a=_0x2ef21a-0x0;var _0x5d08fc=_0x326f[_0x2ef21a];return _0x5d08fc;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xf326('0xd')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xe')]);router[_0xf326('0xf')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x10')]=router; \ No newline at end of file +var _0xc4aa=['connect-timeout','express','Router','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','create','put','update','delete','exports','multer','util','path'];(function(_0x36af2a,_0xe472fd){var _0x5cf696=function(_0x4f8cd9){while(--_0x4f8cd9){_0x36af2a['push'](_0x36af2a['shift']());}};_0x5cf696(++_0xe472fd);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xc4aa[_0x21549c];return _0x426cbd;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xc')]);router[_0xac4a('0xd')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['destroy']);module[_0xac4a('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 4426735..a3bd860 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 _0xb66c=['customVariable','keyValue','string','STRING','BOOLEAN','sequelize','ENUM','variable'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xb66c,0x175));var _0xcb66=function(_0x89cfc6,_0x37ea10){_0x89cfc6=_0x89cfc6-0x0;var _0x51bfd2=_0xb66c[_0x89cfc6];return _0x51bfd2;};'use strict';var Sequelize=require(_0xcb66('0x0'));module['exports']={'type':{'type':Sequelize[_0xcb66('0x1')]('string',_0xcb66('0x2'),_0xcb66('0x3'),_0xcb66('0x4'),'picklist'),'defaultValue':_0xcb66('0x5')},'content':{'type':Sequelize[_0xcb66('0x6')]},'key':{'type':Sequelize[_0xcb66('0x6')]},'keyType':{'type':Sequelize[_0xcb66('0x1')]('string','variable',_0xcb66('0x3'))},'keyContent':{'type':Sequelize[_0xcb66('0x6')]},'idField':{'type':Sequelize[_0xcb66('0x6')]},'nameField':{'type':Sequelize[_0xcb66('0x6')]},'customField':{'type':Sequelize[_0xcb66('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf0ba=['STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','picklist'];(function(_0x28158f,_0x51146d){var _0x274ae4=function(_0x223e1b){while(--_0x223e1b){_0x28158f['push'](_0x28158f['shift']());}};_0x274ae4(++_0x51146d);}(_0xf0ba,0x1ed));var _0xaf0b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf0ba[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xaf0b('0x0'));module[_0xaf0b('0x1')]={'type':{'type':Sequelize[_0xaf0b('0x2')](_0xaf0b('0x3'),_0xaf0b('0x4'),'customVariable',_0xaf0b('0x5'),_0xaf0b('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xaf0b('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xaf0b('0x2')]('string','variable',_0xaf0b('0x8'))},'keyContent':{'type':Sequelize[_0xaf0b('0x7')]},'idField':{'type':Sequelize[_0xaf0b('0x7')]},'nameField':{'type':Sequelize[_0xaf0b('0x7')]},'customField':{'type':Sequelize[_0xaf0b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 028ed2a..86374b0 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 _0x90e6=['params','includeAll','options','find','create','update','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','apply','save','then','destroy','sendStatus','stack','name','send','VtigerField','rawAttributes','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','catch','show'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x90e6,0x127));var _0x690e=function(_0x2bb66c,_0x36c6c6){_0x2bb66c=_0x2bb66c-0x0;var _0x1e0f98=_0x90e6[_0x2bb66c];return _0x1e0f98;};'use strict';var pdf=require(_0x690e('0x0'));var emlformat=require(_0x690e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x690e('0x2'));var jsonpatch=require(_0x690e('0x3'));var rp=require(_0x690e('0x4'));var moment=require(_0x690e('0x5'));var BPromise=require(_0x690e('0x6'));var Mustache=require(_0x690e('0x7'));var util=require(_0x690e('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x690e('0x9'));var ejs=require(_0x690e('0xa'));var fs=require('fs');var fs_extra=require(_0x690e('0xb'));var _=require(_0x690e('0xc'));var squel=require(_0x690e('0xd'));var crypto=require(_0x690e('0xe'));var jsforce=require(_0x690e('0xf'));var deskjs=require(_0x690e('0x10'));var toCsv=require(_0x690e('0x9'));var querystring=require(_0x690e('0x11'));var Papa=require(_0x690e('0x12'));var Redis=require(_0x690e('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x690e('0x14'));var as=require(_0x690e('0x15'));var hardwareService=require(_0x690e('0x16'));var logger=require(_0x690e('0x17'))(_0x690e('0x18'));var utils=require('../../config/utils');var config=require(_0x690e('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x690e('0x1a'))['db'];function respondWithStatusCode(_0x575055,_0x5bfeb5){_0x5bfeb5=_0x5bfeb5||0xcc;return function(_0x5c9bdf){if(_0x5c9bdf){return _0x575055['sendStatus'](_0x5bfeb5);}return _0x575055['status'](_0x5bfeb5)['end']();};}function respondWithResult(_0x1afb03,_0x20a4ce){_0x20a4ce=_0x20a4ce||0xc8;return function(_0xbeabe1){if(_0xbeabe1){return _0x1afb03[_0x690e('0x1b')](_0x20a4ce)[_0x690e('0x1c')](_0xbeabe1);}};}function respondWithFilteredResult(_0x4602d,_0x593077){return function(_0x5af9f0){if(_0x5af9f0){var _0x25b2ce=_0x5af9f0[_0x690e('0x1d')],_0xf7222b=_0x593077[_0x690e('0x1e')],_0x275f37=_0x593077[_0x690e('0x1e')]+_0x593077[_0x690e('0x1f')],_0x435402;if(_0x275f37>=_0x25b2ce){_0x275f37=_0x25b2ce;_0x435402=0xc8;}else{_0x435402=0xce;}_0x4602d[_0x690e('0x1b')](_0x435402);return _0x4602d[_0x690e('0x20')]('Content-Range',_0xf7222b+'-'+_0x275f37+'/'+_0x25b2ce)[_0x690e('0x1c')](_0x5af9f0);}return null;};}function patchUpdates(_0x912767){return function(_0x2b069b){try{jsonpatch[_0x690e('0x21')](_0x2b069b,_0x912767,!![]);}catch(_0x26de76){return BPromise['reject'](_0x26de76);}return _0x2b069b[_0x690e('0x22')]();};}function saveUpdates(_0x4686f5,_0x114540){return function(_0x39cee5){if(_0x39cee5){return _0x39cee5['update'](_0x4686f5)[_0x690e('0x23')](function(_0x12962d){return _0x12962d;});}return null;};}function removeEntity(_0x31bc6e,_0x5926bc){return function(_0x5b19dd){if(_0x5b19dd){return _0x5b19dd[_0x690e('0x24')]()[_0x690e('0x23')](function(){_0x31bc6e[_0x690e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14f6b9,_0x323ae9){return function(_0x2f8721){if(!_0x2f8721){_0x14f6b9[_0x690e('0x25')](0x194);}return _0x2f8721;};}function handleError(_0xbd99e4,_0xa9178d){_0xa9178d=_0xa9178d||0x1f4;return function(_0x218532){logger['error'](_0x218532[_0x690e('0x26')]);if(_0x218532['name']){delete _0x218532[_0x690e('0x27')];}_0xbd99e4[_0x690e('0x1b')](_0xa9178d)[_0x690e('0x28')](_0x218532);};}exports['index']=function(_0x3672fd,_0x583595){var _0x1b25d5={},_0x4f2751={},_0x21c1d2={'count':0x0,'rows':[]};var _0x25bb9c=_['map'](db[_0x690e('0x29')][_0x690e('0x2a')],function(_0x5bb6d8){return{'name':_0x5bb6d8['fieldName'],'type':_0x5bb6d8['type']['key']};});_0x4f2751['model']=_[_0x690e('0x2b')](_0x25bb9c,'name');_0x4f2751[_0x690e('0x2c')]=_[_0x690e('0x2d')](_0x3672fd[_0x690e('0x2c')]);_0x4f2751[_0x690e('0x2e')]=_[_0x690e('0x2f')](_0x4f2751[_0x690e('0x30')],_0x4f2751[_0x690e('0x2c')]);_0x1b25d5['attributes']=_[_0x690e('0x2f')](_0x4f2751[_0x690e('0x30')],qs[_0x690e('0x31')](_0x3672fd['query'][_0x690e('0x31')]));_0x1b25d5[_0x690e('0x32')]=_0x1b25d5[_0x690e('0x32')][_0x690e('0x33')]?_0x1b25d5['attributes']:_0x4f2751['model'];if(!_0x3672fd[_0x690e('0x2c')][_0x690e('0x34')]('nolimit')){_0x1b25d5[_0x690e('0x1f')]=qs[_0x690e('0x1f')](_0x3672fd[_0x690e('0x2c')][_0x690e('0x1f')]);_0x1b25d5[_0x690e('0x1e')]=qs['offset'](_0x3672fd[_0x690e('0x2c')][_0x690e('0x1e')]);}_0x1b25d5['order']=qs[_0x690e('0x35')](_0x3672fd[_0x690e('0x2c')][_0x690e('0x35')]);_0x1b25d5[_0x690e('0x36')]=qs[_0x690e('0x2e')](_[_0x690e('0x37')](_0x3672fd['query'],_0x4f2751[_0x690e('0x2e')]),_0x25bb9c);if(_0x3672fd[_0x690e('0x2c')][_0x690e('0x38')]){_0x1b25d5[_0x690e('0x36')]=_[_0x690e('0x39')](_0x1b25d5[_0x690e('0x36')],{'$or':_['map'](_0x25bb9c,function(_0xe1c25){if(_0xe1c25[_0x690e('0x3a')]!==_0x690e('0x3b')){var _0x5a9607={};_0x5a9607[_0xe1c25[_0x690e('0x27')]]={'$like':'%'+_0x3672fd[_0x690e('0x2c')]['filter']+'%'};return _0x5a9607;}})});}_0x1b25d5=_[_0x690e('0x39')]({},_0x1b25d5,_0x3672fd['options']);var _0xcd9ab1={'where':_0x1b25d5[_0x690e('0x36')]};return db[_0x690e('0x29')][_0x690e('0x1d')](_0xcd9ab1)[_0x690e('0x23')](function(_0x210d77){_0x21c1d2[_0x690e('0x1d')]=_0x210d77;if(_0x3672fd[_0x690e('0x2c')]['includeAll']){_0x1b25d5[_0x690e('0x3c')]=[{'all':!![]}];}return db[_0x690e('0x29')][_0x690e('0x3d')](_0x1b25d5);})[_0x690e('0x23')](function(_0x3614cf){_0x21c1d2[_0x690e('0x3e')]=_0x3614cf;return _0x21c1d2;})[_0x690e('0x23')](respondWithFilteredResult(_0x583595,_0x1b25d5))[_0x690e('0x3f')](handleError(_0x583595,null));};exports[_0x690e('0x40')]=function(_0x1450d0,_0xc85667){var _0x82d4c4={'raw':!![],'where':{'id':_0x1450d0[_0x690e('0x41')]['id']}},_0x286944={};_0x286944[_0x690e('0x30')]=_[_0x690e('0x2d')](db[_0x690e('0x29')]['rawAttributes']);_0x286944[_0x690e('0x2c')]=_['keys'](_0x1450d0[_0x690e('0x2c')]);_0x286944['filters']=_[_0x690e('0x2f')](_0x286944[_0x690e('0x30')],_0x286944[_0x690e('0x2c')]);_0x82d4c4[_0x690e('0x32')]=_[_0x690e('0x2f')](_0x286944[_0x690e('0x30')],qs[_0x690e('0x31')](_0x1450d0['query'][_0x690e('0x31')]));_0x82d4c4[_0x690e('0x32')]=_0x82d4c4[_0x690e('0x32')]['length']?_0x82d4c4[_0x690e('0x32')]:_0x286944['model'];if(_0x1450d0['query'][_0x690e('0x42')]){_0x82d4c4[_0x690e('0x3c')]=[{'all':!![]}];}_0x82d4c4=_[_0x690e('0x39')]({},_0x82d4c4,_0x1450d0[_0x690e('0x43')]);return db[_0x690e('0x29')][_0x690e('0x44')](_0x82d4c4)[_0x690e('0x23')](handleEntityNotFound(_0xc85667,null))[_0x690e('0x23')](respondWithResult(_0xc85667,null))[_0x690e('0x3f')](handleError(_0xc85667,null));};exports['create']=function(_0x2a1f49,_0x35ed7d){return db[_0x690e('0x29')][_0x690e('0x45')](_0x2a1f49['body'],{})[_0x690e('0x23')](respondWithResult(_0x35ed7d,0xc9))[_0x690e('0x3f')](handleError(_0x35ed7d,null));};exports[_0x690e('0x46')]=function(_0x12d8b7,_0x12a238){if(_0x12d8b7[_0x690e('0x47')]['id']){delete _0x12d8b7[_0x690e('0x47')]['id'];}return db[_0x690e('0x29')]['find']({'where':{'id':_0x12d8b7['params']['id']}})[_0x690e('0x23')](handleEntityNotFound(_0x12a238,null))[_0x690e('0x23')](saveUpdates(_0x12d8b7[_0x690e('0x47')],null))[_0x690e('0x23')](respondWithResult(_0x12a238,null))[_0x690e('0x3f')](handleError(_0x12a238,null));};exports['destroy']=function(_0x938268,_0x46ec2a){return db[_0x690e('0x29')][_0x690e('0x44')]({'where':{'id':_0x938268[_0x690e('0x41')]['id']}})[_0x690e('0x23')](handleEntityNotFound(_0x46ec2a,null))[_0x690e('0x23')](removeEntity(_0x46ec2a,null))[_0x690e('0x3f')](handleError(_0x46ec2a,null));}; \ No newline at end of file +var _0x0c37=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','VtigerField','include','findAll','rows','show','params','includeAll','create','catch','body','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x0c37,0x1f1));var _0x70c3=function(_0x3899a3,_0xcb527){_0x3899a3=_0x3899a3-0x0;var _0x13e1ce=_0x0c37[_0x3899a3];return _0x13e1ce;};'use strict';var pdf=require(_0x70c3('0x0'));var emlformat=require(_0x70c3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x70c3('0x2'));var jsonpatch=require(_0x70c3('0x3'));var rp=require(_0x70c3('0x4'));var moment=require(_0x70c3('0x5'));var BPromise=require(_0x70c3('0x6'));var Mustache=require(_0x70c3('0x7'));var util=require('util');var path=require('path');var sox=require(_0x70c3('0x8'));var csv=require(_0x70c3('0x9'));var ejs=require(_0x70c3('0xa'));var fs=require('fs');var fs_extra=require(_0x70c3('0xb'));var _=require('lodash');var squel=require(_0x70c3('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x70c3('0xd'));var toCsv=require('to-csv');var querystring=require(_0x70c3('0xe'));var Papa=require(_0x70c3('0xf'));var Redis=require(_0x70c3('0x10'));var authService=require(_0x70c3('0x11'));var qs=require(_0x70c3('0x12'));var as=require(_0x70c3('0x13'));var hardwareService=require(_0x70c3('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x70c3('0x15'));var licenseUtil=require(_0x70c3('0x16'));var db=require(_0x70c3('0x17'))['db'];function respondWithStatusCode(_0x4c5c8d,_0x182f8a){_0x182f8a=_0x182f8a||0xcc;return function(_0x256833){if(_0x256833){return _0x4c5c8d[_0x70c3('0x18')](_0x182f8a);}return _0x4c5c8d[_0x70c3('0x19')](_0x182f8a)[_0x70c3('0x1a')]();};}function respondWithResult(_0x2100d1,_0x13eabf){_0x13eabf=_0x13eabf||0xc8;return function(_0x237251){if(_0x237251){return _0x2100d1[_0x70c3('0x19')](_0x13eabf)[_0x70c3('0x1b')](_0x237251);}};}function respondWithFilteredResult(_0x3c0be5,_0xd76329){return function(_0x23e154){if(_0x23e154){var _0x2c8dfe=_0x23e154[_0x70c3('0x1c')],_0x1c5bc2=_0xd76329[_0x70c3('0x1d')],_0x27f3fc=_0xd76329[_0x70c3('0x1d')]+_0xd76329[_0x70c3('0x1e')],_0x32bfac;if(_0x27f3fc>=_0x2c8dfe){_0x27f3fc=_0x2c8dfe;_0x32bfac=0xc8;}else{_0x32bfac=0xce;}_0x3c0be5[_0x70c3('0x19')](_0x32bfac);return _0x3c0be5[_0x70c3('0x1f')](_0x70c3('0x20'),_0x1c5bc2+'-'+_0x27f3fc+'/'+_0x2c8dfe)[_0x70c3('0x1b')](_0x23e154);}return null;};}function patchUpdates(_0x3cf103){return function(_0x283039){try{jsonpatch[_0x70c3('0x21')](_0x283039,_0x3cf103,!![]);}catch(_0x50f508){return BPromise[_0x70c3('0x22')](_0x50f508);}return _0x283039[_0x70c3('0x23')]();};}function saveUpdates(_0x48fd2a,_0xe0d65d){return function(_0x3acb20){if(_0x3acb20){return _0x3acb20[_0x70c3('0x24')](_0x48fd2a)['then'](function(_0x247f4a){return _0x247f4a;});}return null;};}function removeEntity(_0x139e09,_0x46ffce){return function(_0x2e56ca){if(_0x2e56ca){return _0x2e56ca[_0x70c3('0x25')]()[_0x70c3('0x26')](function(){_0x139e09[_0x70c3('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e8335,_0x5de577){return function(_0x340059){if(!_0x340059){_0x5e8335[_0x70c3('0x18')](0x194);}return _0x340059;};}function handleError(_0x3d9388,_0x1e7c03){_0x1e7c03=_0x1e7c03||0x1f4;return function(_0x314bf){logger[_0x70c3('0x27')](_0x314bf['stack']);if(_0x314bf['name']){delete _0x314bf[_0x70c3('0x28')];}_0x3d9388[_0x70c3('0x19')](_0x1e7c03)[_0x70c3('0x29')](_0x314bf);};}exports['index']=function(_0x2acf7c,_0x16eacb){var _0x59857c={},_0x2e78d3={},_0x59607f={'count':0x0,'rows':[]};var _0x2c576e=_[_0x70c3('0x2a')](db['VtigerField'][_0x70c3('0x2b')],function(_0xada659){return{'name':_0xada659[_0x70c3('0x2c')],'type':_0xada659[_0x70c3('0x2d')]['key']};});_0x2e78d3[_0x70c3('0x2e')]=_[_0x70c3('0x2a')](_0x2c576e,_0x70c3('0x28'));_0x2e78d3[_0x70c3('0x2f')]=_[_0x70c3('0x30')](_0x2acf7c['query']);_0x2e78d3[_0x70c3('0x31')]=_[_0x70c3('0x32')](_0x2e78d3[_0x70c3('0x2e')],_0x2e78d3[_0x70c3('0x2f')]);_0x59857c[_0x70c3('0x33')]=_[_0x70c3('0x32')](_0x2e78d3[_0x70c3('0x2e')],qs[_0x70c3('0x34')](_0x2acf7c[_0x70c3('0x2f')][_0x70c3('0x34')]));_0x59857c[_0x70c3('0x33')]=_0x59857c[_0x70c3('0x33')][_0x70c3('0x35')]?_0x59857c[_0x70c3('0x33')]:_0x2e78d3[_0x70c3('0x2e')];if(!_0x2acf7c[_0x70c3('0x2f')][_0x70c3('0x36')]('nolimit')){_0x59857c[_0x70c3('0x1e')]=qs[_0x70c3('0x1e')](_0x2acf7c['query'][_0x70c3('0x1e')]);_0x59857c[_0x70c3('0x1d')]=qs[_0x70c3('0x1d')](_0x2acf7c[_0x70c3('0x2f')][_0x70c3('0x1d')]);}_0x59857c[_0x70c3('0x37')]=qs[_0x70c3('0x38')](_0x2acf7c[_0x70c3('0x2f')][_0x70c3('0x38')]);_0x59857c['where']=qs[_0x70c3('0x31')](_[_0x70c3('0x39')](_0x2acf7c[_0x70c3('0x2f')],_0x2e78d3[_0x70c3('0x31')]),_0x2c576e);if(_0x2acf7c[_0x70c3('0x2f')][_0x70c3('0x3a')]){_0x59857c[_0x70c3('0x3b')]=_['merge'](_0x59857c[_0x70c3('0x3b')],{'$or':_[_0x70c3('0x2a')](_0x2c576e,function(_0x523cff){if(_0x523cff[_0x70c3('0x2d')]!==_0x70c3('0x3c')){var _0x2e9236={};_0x2e9236[_0x523cff['name']]={'$like':'%'+_0x2acf7c[_0x70c3('0x2f')][_0x70c3('0x3a')]+'%'};return _0x2e9236;}})});}_0x59857c=_[_0x70c3('0x3d')]({},_0x59857c,_0x2acf7c[_0x70c3('0x3e')]);var _0x371576={'where':_0x59857c['where']};return db[_0x70c3('0x3f')][_0x70c3('0x1c')](_0x371576)[_0x70c3('0x26')](function(_0x58a8ce){_0x59607f[_0x70c3('0x1c')]=_0x58a8ce;if(_0x2acf7c[_0x70c3('0x2f')]['includeAll']){_0x59857c[_0x70c3('0x40')]=[{'all':!![]}];}return db[_0x70c3('0x3f')][_0x70c3('0x41')](_0x59857c);})['then'](function(_0x5edc44){_0x59607f[_0x70c3('0x42')]=_0x5edc44;return _0x59607f;})['then'](respondWithFilteredResult(_0x16eacb,_0x59857c))['catch'](handleError(_0x16eacb,null));};exports[_0x70c3('0x43')]=function(_0x59720f,_0x1bfaca){var _0x16d519={'raw':!![],'where':{'id':_0x59720f[_0x70c3('0x44')]['id']}},_0x393b35={};_0x393b35[_0x70c3('0x2e')]=_[_0x70c3('0x30')](db[_0x70c3('0x3f')][_0x70c3('0x2b')]);_0x393b35[_0x70c3('0x2f')]=_[_0x70c3('0x30')](_0x59720f[_0x70c3('0x2f')]);_0x393b35[_0x70c3('0x31')]=_[_0x70c3('0x32')](_0x393b35[_0x70c3('0x2e')],_0x393b35['query']);_0x16d519['attributes']=_[_0x70c3('0x32')](_0x393b35['model'],qs[_0x70c3('0x34')](_0x59720f['query'][_0x70c3('0x34')]));_0x16d519[_0x70c3('0x33')]=_0x16d519[_0x70c3('0x33')][_0x70c3('0x35')]?_0x16d519[_0x70c3('0x33')]:_0x393b35[_0x70c3('0x2e')];if(_0x59720f[_0x70c3('0x2f')][_0x70c3('0x45')]){_0x16d519[_0x70c3('0x40')]=[{'all':!![]}];}_0x16d519=_[_0x70c3('0x3d')]({},_0x16d519,_0x59720f[_0x70c3('0x3e')]);return db['VtigerField']['find'](_0x16d519)['then'](handleEntityNotFound(_0x1bfaca,null))[_0x70c3('0x26')](respondWithResult(_0x1bfaca,null))['catch'](handleError(_0x1bfaca,null));};exports[_0x70c3('0x46')]=function(_0x473601,_0x2a05d2){return db[_0x70c3('0x3f')][_0x70c3('0x46')](_0x473601['body'],{})['then'](respondWithResult(_0x2a05d2,0xc9))[_0x70c3('0x47')](handleError(_0x2a05d2,null));};exports[_0x70c3('0x24')]=function(_0x291fce,_0x21ddc3){if(_0x291fce[_0x70c3('0x48')]['id']){delete _0x291fce[_0x70c3('0x48')]['id'];}return db[_0x70c3('0x3f')][_0x70c3('0x49')]({'where':{'id':_0x291fce[_0x70c3('0x44')]['id']}})[_0x70c3('0x26')](handleEntityNotFound(_0x21ddc3,null))['then'](saveUpdates(_0x291fce[_0x70c3('0x48')],null))[_0x70c3('0x26')](respondWithResult(_0x21ddc3,null))[_0x70c3('0x47')](handleError(_0x21ddc3,null));};exports[_0x70c3('0x25')]=function(_0x509f1b,_0xd5634a){return db[_0x70c3('0x3f')][_0x70c3('0x49')]({'where':{'id':_0x509f1b[_0x70c3('0x44')]['id']}})[_0x70c3('0x26')](handleEntityNotFound(_0xd5634a,null))['then'](removeEntity(_0xd5634a,null))['catch'](handleError(_0xd5634a,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index d1ce443..a452f71 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 _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x260fc2,_0x1ebd89){var _0x4a8571=function(_0x4a01ff){while(--_0x4a01ff){_0x260fc2['push'](_0x260fc2['shift']());}};_0x4a8571(++_0x1ebd89);}(_0x7a54,0x106));var _0x47a5=function(_0x1f3457,_0x4ceceb){_0x1f3457=_0x1f3457-0x0;var _0x236ea9=_0x7a54[_0x1f3457];return _0x236ea9;};'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':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'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 119a2ca..8c29212 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 _0xa908=['http','then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','VtigerField,\x20%s,\x20%s','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xa908,0x1c3));var _0x8a90=function(_0x57f4de,_0x57c7ae){_0x57f4de=_0x57f4de-0x0;var _0x1edd7b=_0xa908[_0x57f4de];return _0x1edd7b;};'use strict';var _=require(_0x8a90('0x0'));var util=require('util');var moment=require(_0x8a90('0x1'));var BPromise=require('bluebird');var rs=require(_0x8a90('0x2'));var fs=require('fs');var Redis=require(_0x8a90('0x3'));var db=require(_0x8a90('0x4'))['db'];var utils=require(_0x8a90('0x5'));var logger=require(_0x8a90('0x6'))('rpc');var config=require(_0x8a90('0x7'));var jayson=require(_0x8a90('0x8'));var client=jayson['client'][_0x8a90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1dc8f9,_0x12d376,_0x3faf88){return new BPromise(function(_0x20f8bf,_0x200f95){return client['request'](_0x1dc8f9,_0x3faf88)[_0x8a90('0xa')](function(_0x485401){logger[_0x8a90('0xb')]('VtigerField,\x20%s,\x20%s',_0x12d376,_0x8a90('0xc'));logger[_0x8a90('0xd')](_0x8a90('0xe'),_0x12d376,_0x8a90('0xc'),JSON[_0x8a90('0xf')](_0x485401));if(_0x485401[_0x8a90('0x10')]){if(_0x485401[_0x8a90('0x10')]['code']===0x1f4){logger['error'](_0x8a90('0x11'),_0x12d376,_0x485401[_0x8a90('0x10')][_0x8a90('0x12')]);return _0x200f95(_0x485401['error'][_0x8a90('0x12')]);}logger[_0x8a90('0x10')](_0x8a90('0x11'),_0x12d376,_0x485401['error'][_0x8a90('0x12')]);return _0x20f8bf(_0x485401[_0x8a90('0x10')]['message']);}else{logger[_0x8a90('0xb')](_0x8a90('0x11'),_0x12d376,_0x8a90('0xc'));_0x20f8bf(_0x485401[_0x8a90('0x13')]['message']);}})['catch'](function(_0x14db82){logger[_0x8a90('0x10')](_0x8a90('0x11'),_0x12d376,_0x14db82);_0x200f95(_0x14db82);});});} \ No newline at end of file +var _0xf12a=['info','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','code','error','VtigerField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xf12a,0x8e));var _0xaf12=function(_0x405aeb,_0x5ee732){_0x405aeb=_0x405aeb-0x0;var _0x50e76a=_0xf12a[_0x405aeb];return _0x50e76a;};'use strict';var _=require(_0xaf12('0x0'));var util=require(_0xaf12('0x1'));var moment=require(_0xaf12('0x2'));var BPromise=require(_0xaf12('0x3'));var rs=require(_0xaf12('0x4'));var fs=require('fs');var Redis=require(_0xaf12('0x5'));var db=require(_0xaf12('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaf12('0x7'));var config=require('../../config/environment');var jayson=require(_0xaf12('0x8'));var client=jayson['client'][_0xaf12('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x581819,_0x38389d,_0x418c64){return new BPromise(function(_0x3b6626,_0xff1952){return client[_0xaf12('0xa')](_0x581819,_0x418c64)[_0xaf12('0xb')](function(_0x3d733d){logger[_0xaf12('0xc')]('VtigerField,\x20%s,\x20%s',_0x38389d,_0xaf12('0xd'));logger['debug'](_0xaf12('0xe'),_0x38389d,'request\x20sent',JSON[_0xaf12('0xf')](_0x3d733d));if(_0x3d733d['error']){if(_0x3d733d['error'][_0xaf12('0x10')]===0x1f4){logger[_0xaf12('0x11')](_0xaf12('0x12'),_0x38389d,_0x3d733d[_0xaf12('0x11')][_0xaf12('0x13')]);return _0xff1952(_0x3d733d[_0xaf12('0x11')][_0xaf12('0x13')]);}logger[_0xaf12('0x11')](_0xaf12('0x12'),_0x38389d,_0x3d733d[_0xaf12('0x11')][_0xaf12('0x13')]);return _0x3b6626(_0x3d733d[_0xaf12('0x11')][_0xaf12('0x13')]);}else{logger[_0xaf12('0xc')](_0xaf12('0x12'),_0x38389d,_0xaf12('0xd'));_0x3b6626(_0x3d733d[_0xaf12('0x14')]['message']);}})[_0xaf12('0x15')](function(_0x31a420){logger['error']('VtigerField,\x20%s,\x20%s',_0x38389d,_0x31a420);_0xff1952(_0x31a420);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 0136a43..86245fc 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 _0x2d06=['getFields','post','create','addConfiguration','put','update','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields'];(function(_0x2b6a66,_0x541963){var _0x51dce1=function(_0x3e7138){while(--_0x3e7138){_0x2b6a66['push'](_0x2b6a66['shift']());}};_0x51dce1(++_0x541963);}(_0x2d06,0x157));var _0x62d0=function(_0x101c5c,_0x1b5eb1){_0x101c5c=_0x101c5c-0x0;var _0x3d2fb5=_0x2d06[_0x101c5c];return _0x3d2fb5;};'use strict';var multer=require('multer');var util=require(_0x62d0('0x0'));var path=require(_0x62d0('0x1'));var timeout=require(_0x62d0('0x2'));var express=require(_0x62d0('0x3'));var router=express['Router']();var fs_extra=require(_0x62d0('0x4'));var auth=require(_0x62d0('0x5'));var interaction=require(_0x62d0('0x6'));var config=require(_0x62d0('0x7'));var controller=require('./intZendeskAccount.controller');router[_0x62d0('0x8')]('/',auth[_0x62d0('0x9')](),controller['index']);router[_0x62d0('0x8')](_0x62d0('0xa'),auth['isAuthenticated'](),controller[_0x62d0('0xb')]);router[_0x62d0('0x8')](_0x62d0('0xc'),auth[_0x62d0('0x9')](),controller['getConfigurations']);router['get'](_0x62d0('0xd'),auth[_0x62d0('0x9')](),controller[_0x62d0('0xe')]);router[_0x62d0('0xf')]('/',auth[_0x62d0('0x9')](),controller[_0x62d0('0x10')]);router[_0x62d0('0xf')](_0x62d0('0xc'),auth[_0x62d0('0x9')](),controller[_0x62d0('0x11')]);router[_0x62d0('0x12')](_0x62d0('0xa'),auth[_0x62d0('0x9')](),controller[_0x62d0('0x13')]);router['delete'](_0x62d0('0xa'),auth[_0x62d0('0x9')](),controller[_0x62d0('0x14')]);module['exports']=router; \ No newline at end of file +var _0x5a99=['destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id','getConfigurations','/:id/fields','create','/:id/configurations','addConfiguration','put','update'];(function(_0xc0ac,_0x91375f){var _0x35490a=function(_0xf53b7d){while(--_0xf53b7d){_0xc0ac['push'](_0xc0ac['shift']());}};_0x35490a(++_0x91375f);}(_0x5a99,0xc9));var _0x95a9=function(_0x173964,_0x3f7ec6){_0x173964=_0x173964-0x0;var _0x1cba27=_0x5a99[_0x173964];return _0x1cba27;};'use strict';var multer=require(_0x95a9('0x0'));var util=require(_0x95a9('0x1'));var path=require(_0x95a9('0x2'));var timeout=require('connect-timeout');var express=require(_0x95a9('0x3'));var router=express[_0x95a9('0x4')]();var fs_extra=require(_0x95a9('0x5'));var auth=require(_0x95a9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x95a9('0x7'));var controller=require(_0x95a9('0x8'));router[_0x95a9('0x9')]('/',auth[_0x95a9('0xa')](),controller['index']);router[_0x95a9('0x9')](_0x95a9('0xb'),auth[_0x95a9('0xa')](),controller['show']);router[_0x95a9('0x9')]('/:id/configurations',auth[_0x95a9('0xa')](),controller[_0x95a9('0xc')]);router[_0x95a9('0x9')](_0x95a9('0xd'),auth[_0x95a9('0xa')](),controller['getFields']);router['post']('/',auth[_0x95a9('0xa')](),controller[_0x95a9('0xe')]);router['post'](_0x95a9('0xf'),auth['isAuthenticated'](),controller[_0x95a9('0x10')]);router[_0x95a9('0x11')](_0x95a9('0xb'),auth[_0x95a9('0xa')](),controller[_0x95a9('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x95a9('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 28152e3..e4bae0c 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 _0xa059=['ENUM','password','integrationTab','sequelize','STRING','remoteUri'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xa059,0x111));var _0x9a05=function(_0xb878a1,_0x5bdcdd){_0xb878a1=_0xb878a1-0x0;var _0x55c1df=_0xa059[_0xb878a1];return _0x55c1df;};'use strict';var Sequelize=require(_0x9a05('0x0'));module['exports']={'name':{'type':Sequelize[_0x9a05('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9a05('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x9a05('0x1')]},'remoteUri':{'type':Sequelize[_0x9a05('0x1')],'unique':_0x9a05('0x2')},'authType':{'type':Sequelize[_0x9a05('0x3')](_0x9a05('0x4'),'token'),'defaultValue':_0x9a05('0x4')},'serverUrl':{'type':Sequelize[_0x9a05('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x9a05('0x3')](_0x9a05('0x5'),'newTab'),'defaultValue':_0x9a05('0x5')}}; \ No newline at end of file +var _0xd122=['integrationTab','newTab','sequelize','STRING','username','remoteUri','ENUM','password','token'];(function(_0x1a705d,_0x2eeefa){var _0x575083=function(_0xd58372){while(--_0xd58372){_0x1a705d['push'](_0x1a705d['shift']());}};_0x575083(++_0x2eeefa);}(_0xd122,0x9b));var _0x2d12=function(_0x4c7f76,_0x56bb63){_0x4c7f76=_0x4c7f76-0x0;var _0x56c186=_0xd122[_0x4c7f76];return _0x56c186;};'use strict';var Sequelize=require(_0x2d12('0x0'));module['exports']={'name':{'type':Sequelize[_0x2d12('0x1')]},'description':{'type':Sequelize[_0x2d12('0x1')]},'username':{'type':Sequelize[_0x2d12('0x1')],'unique':_0x2d12('0x2')},'password':{'type':Sequelize[_0x2d12('0x1')]},'token':{'type':Sequelize[_0x2d12('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x2d12('0x3')},'authType':{'type':Sequelize[_0x2d12('0x4')](_0x2d12('0x5'),_0x2d12('0x6')),'defaultValue':_0x2d12('0x5')},'serverUrl':{'type':Sequelize[_0x2d12('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2d12('0x4')](_0x2d12('0x7'),_0x2d12('0x8')),'defaultValue':_0x2d12('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 80b368c..df2778b 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 _0x277c=['jayson/promise','client','http','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','end','json','count','limit','set','Content-Range','reject','save','destroy','sendStatus','stack','name','index','map','ZendeskAccount','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','length','include','find','create','body','update','params','findOne','rawAttributes','order','getConfigurations','Subjects','getSubjects','channel','type','Descriptions','ZendeskConfiguration','ZendeskField','getFields','username','password','token','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','authType','Basic\x20%s','%s:%s','base64','headers','%s/token:%s','toString','subject','description','remove','ticket_fields','position','title','custom_field_options','test','statusCode','stringify','send','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x277c,0x153));var _0xc277=function(_0x1e59ce,_0x809eb7){_0x1e59ce=_0x1e59ce-0x0;var _0x70e482=_0x277c[_0x1e59ce];return _0x70e482;};'use strict';var pdf=require(_0xc277('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc277('0x1'));var zipdir=require(_0xc277('0x2'));var jsonpatch=require(_0xc277('0x3'));var rp=require(_0xc277('0x4'));var moment=require(_0xc277('0x5'));var BPromise=require(_0xc277('0x6'));var Mustache=require(_0xc277('0x7'));var util=require(_0xc277('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xc277('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc277('0xa'));var _=require('lodash');var squel=require(_0xc277('0xb'));var crypto=require(_0xc277('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc277('0xd'));var toCsv=require(_0xc277('0x9'));var querystring=require(_0xc277('0xe'));var Papa=require(_0xc277('0xf'));var Redis=require(_0xc277('0x10'));var authService=require(_0xc277('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc277('0x12'));var logger=require(_0xc277('0x13'))(_0xc277('0x14'));var utils=require(_0xc277('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc277('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xc277('0x17'));var jayson=require(_0xc277('0x18'));var client=jayson[_0xc277('0x19')][_0xc277('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4bced3,_0x222bc8,_0x182d35,_0x8895bd){return new BPromise(function(_0x4de960,_0x5283ac){var _0x178e6d=_0x8895bd||client;return _0x178e6d['request'](_0x4bced3,_0x182d35)[_0xc277('0x1b')](function(_0x5d73f8){logger[_0xc277('0x1c')](_0xc277('0x1d'),_0x222bc8,_0xc277('0x1e'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x222bc8,_0xc277('0x1e'),JSON['stringify'](_0x5d73f8));if(_0x5d73f8['error']){if(_0x5d73f8[_0xc277('0x1f')][_0xc277('0x20')]===0x1f4){logger[_0xc277('0x1f')](_0xc277('0x1d'),_0x222bc8,_0x5d73f8[_0xc277('0x1f')][_0xc277('0x21')]);return _0x5283ac(_0x5d73f8[_0xc277('0x1f')]['message']);}logger['error'](_0xc277('0x1d'),_0x222bc8,_0x5d73f8[_0xc277('0x1f')][_0xc277('0x21')]);return _0x4de960(_0x5d73f8[_0xc277('0x1f')][_0xc277('0x21')]);}else{logger[_0xc277('0x1c')](_0xc277('0x1d'),_0x222bc8,_0xc277('0x1e'));_0x4de960(_0x5d73f8[_0xc277('0x22')][_0xc277('0x21')]);}})[_0xc277('0x23')](function(_0x57a198){logger[_0xc277('0x1f')](_0xc277('0x1d'),_0x222bc8,_0x57a198);_0x5283ac(_0x57a198);});});}function respondWithStatusCode(_0x54b2e1,_0x463fa6){_0x463fa6=_0x463fa6||0xcc;return function(_0x4820e1){if(_0x4820e1){return _0x54b2e1['sendStatus'](_0x463fa6);}return _0x54b2e1[_0xc277('0x24')](_0x463fa6)[_0xc277('0x25')]();};}function respondWithResult(_0x1583b6,_0x436784){_0x436784=_0x436784||0xc8;return function(_0x245e84){if(_0x245e84){return _0x1583b6[_0xc277('0x24')](_0x436784)[_0xc277('0x26')](_0x245e84);}};}function respondWithFilteredResult(_0x9ad1c5,_0xf903ea){return function(_0x3e04cb){if(_0x3e04cb){var _0x40d17a=_0x3e04cb[_0xc277('0x27')],_0x5e480e=_0xf903ea['offset'],_0x5f3933=_0xf903ea['offset']+_0xf903ea[_0xc277('0x28')],_0x31b6d4;if(_0x5f3933>=_0x40d17a){_0x5f3933=_0x40d17a;_0x31b6d4=0xc8;}else{_0x31b6d4=0xce;}_0x9ad1c5[_0xc277('0x24')](_0x31b6d4);return _0x9ad1c5[_0xc277('0x29')](_0xc277('0x2a'),_0x5e480e+'-'+_0x5f3933+'/'+_0x40d17a)[_0xc277('0x26')](_0x3e04cb);}return null;};}function patchUpdates(_0x484993){return function(_0x43757c){try{jsonpatch['apply'](_0x43757c,_0x484993,!![]);}catch(_0x12c2f9){return BPromise[_0xc277('0x2b')](_0x12c2f9);}return _0x43757c[_0xc277('0x2c')]();};}function saveUpdates(_0x881e70,_0x5e9f22){return function(_0x2ff49c){if(_0x2ff49c){return _0x2ff49c['update'](_0x881e70)[_0xc277('0x1b')](function(_0x288e42){return _0x288e42;});}return null;};}function removeEntity(_0xbc1a66,_0x3591ab){return function(_0x4f1603){if(_0x4f1603){return _0x4f1603[_0xc277('0x2d')]()[_0xc277('0x1b')](function(){_0xbc1a66['status'](0xcc)[_0xc277('0x25')]();});}};}function handleEntityNotFound(_0x4a7db2,_0x1c8ab8){return function(_0x186f13){if(!_0x186f13){_0x4a7db2[_0xc277('0x2e')](0x194);}return _0x186f13;};}function handleError(_0x2cc802,_0x2cc28d){_0x2cc28d=_0x2cc28d||0x1f4;return function(_0x86f57b){logger[_0xc277('0x1f')](_0x86f57b[_0xc277('0x2f')]);if(_0x86f57b[_0xc277('0x30')]){delete _0x86f57b[_0xc277('0x30')];}_0x2cc802[_0xc277('0x24')](_0x2cc28d)['send'](_0x86f57b);};}exports[_0xc277('0x31')]=function(_0x447d70,_0x28ab20){var _0x5b3445={},_0x380e45={},_0xe6631d={'count':0x0,'rows':[]};var _0x18986b=_[_0xc277('0x32')](db[_0xc277('0x33')]['rawAttributes'],function(_0x4de270){return{'name':_0x4de270[_0xc277('0x34')],'type':_0x4de270['type'][_0xc277('0x35')]};});_0x380e45[_0xc277('0x36')]=_[_0xc277('0x32')](_0x18986b,_0xc277('0x30'));_0x380e45[_0xc277('0x37')]=_[_0xc277('0x38')](_0x447d70[_0xc277('0x37')]);_0x380e45[_0xc277('0x39')]=_[_0xc277('0x3a')](_0x380e45[_0xc277('0x36')],_0x380e45[_0xc277('0x37')]);_0x5b3445['attributes']=_[_0xc277('0x3a')](_0x380e45[_0xc277('0x36')],qs[_0xc277('0x3b')](_0x447d70['query'][_0xc277('0x3b')]));_0x5b3445[_0xc277('0x3c')]=_0x5b3445['attributes']['length']?_0x5b3445[_0xc277('0x3c')]:_0x380e45[_0xc277('0x36')];if(!_0x447d70[_0xc277('0x37')][_0xc277('0x3d')](_0xc277('0x3e'))){_0x5b3445[_0xc277('0x28')]=qs[_0xc277('0x28')](_0x447d70['query'][_0xc277('0x28')]);_0x5b3445[_0xc277('0x3f')]=qs[_0xc277('0x3f')](_0x447d70['query']['offset']);}_0x5b3445['order']=qs['sort'](_0x447d70['query'][_0xc277('0x40')]);_0x5b3445['where']=qs[_0xc277('0x39')](_[_0xc277('0x41')](_0x447d70[_0xc277('0x37')],_0x380e45['filters']),_0x18986b);if(_0x447d70[_0xc277('0x37')][_0xc277('0x42')]){_0x5b3445[_0xc277('0x43')]=_[_0xc277('0x44')](_0x5b3445['where'],{'$or':_[_0xc277('0x32')](_0x18986b,function(_0x244032){if(_0x244032['type']!==_0xc277('0x45')){var _0x12a90a={};_0x12a90a[_0x244032[_0xc277('0x30')]]={'$like':'%'+_0x447d70[_0xc277('0x37')][_0xc277('0x42')]+'%'};return _0x12a90a;}})});}_0x5b3445=_[_0xc277('0x44')]({},_0x5b3445,_0x447d70[_0xc277('0x46')]);var _0x30560b={'where':_0x5b3445[_0xc277('0x43')]};return db[_0xc277('0x33')][_0xc277('0x27')](_0x30560b)['then'](function(_0x98f82){_0xe6631d[_0xc277('0x27')]=_0x98f82;if(_0x447d70[_0xc277('0x37')][_0xc277('0x47')]){_0x5b3445['include']=[{'all':!![]}];}return db[_0xc277('0x33')]['findAll'](_0x5b3445);})[_0xc277('0x1b')](function(_0x176834){_0xe6631d[_0xc277('0x48')]=_0x176834;return _0xe6631d;})[_0xc277('0x1b')](respondWithFilteredResult(_0x28ab20,_0x5b3445))[_0xc277('0x23')](handleError(_0x28ab20,null));};exports['show']=function(_0x37fb3f,_0x40868b){var _0x412bae={'raw':![],'where':{'id':_0x37fb3f['params']['id']}},_0x4700b2={};_0x4700b2[_0xc277('0x36')]=_[_0xc277('0x38')](db[_0xc277('0x33')]['rawAttributes']);_0x4700b2[_0xc277('0x37')]=_['keys'](_0x37fb3f[_0xc277('0x37')]);_0x4700b2[_0xc277('0x39')]=_[_0xc277('0x3a')](_0x4700b2[_0xc277('0x36')],_0x4700b2[_0xc277('0x37')]);_0x412bae[_0xc277('0x3c')]=_[_0xc277('0x3a')](_0x4700b2[_0xc277('0x36')],qs[_0xc277('0x3b')](_0x37fb3f[_0xc277('0x37')][_0xc277('0x3b')]));_0x412bae[_0xc277('0x3c')]=_0x412bae['attributes'][_0xc277('0x49')]?_0x412bae['attributes']:_0x4700b2[_0xc277('0x36')];if(_0x37fb3f[_0xc277('0x37')][_0xc277('0x47')]){_0x412bae[_0xc277('0x4a')]=[{'all':!![]}];}_0x412bae=_[_0xc277('0x44')]({},_0x412bae,_0x37fb3f['options']);return db[_0xc277('0x33')][_0xc277('0x4b')](_0x412bae)['then'](handleEntityNotFound(_0x40868b,null))['then'](respondWithResult(_0x40868b,null))[_0xc277('0x23')](handleError(_0x40868b,null));};exports['create']=function(_0x15e2b7,_0x1376a7){return db[_0xc277('0x33')][_0xc277('0x4c')](_0x15e2b7[_0xc277('0x4d')],{})['then'](respondWithResult(_0x1376a7,0xc9))['catch'](handleError(_0x1376a7,null));};exports[_0xc277('0x4e')]=function(_0x7cf9b4,_0x1f4171){if(_0x7cf9b4['body']['id']){delete _0x7cf9b4[_0xc277('0x4d')]['id'];}return db['ZendeskAccount'][_0xc277('0x4b')]({'where':{'id':_0x7cf9b4[_0xc277('0x4f')]['id']}})[_0xc277('0x1b')](handleEntityNotFound(_0x1f4171,null))['then'](saveUpdates(_0x7cf9b4['body'],null))['then'](respondWithResult(_0x1f4171,null))[_0xc277('0x23')](handleError(_0x1f4171,null));};exports[_0xc277('0x2d')]=function(_0x5057d1,_0x50a1b5){return db[_0xc277('0x33')][_0xc277('0x4b')]({'where':{'id':_0x5057d1[_0xc277('0x4f')]['id']}})[_0xc277('0x1b')](handleEntityNotFound(_0x50a1b5,null))['then'](removeEntity(_0x50a1b5,null))['catch'](handleError(_0x50a1b5,null));};exports['getConfigurations']=function(_0x1da618,_0x2cd384,_0x55b178){var _0xdec3b5={};var _0xce525b={};var _0x49f89f;var _0x4e71bd;return db[_0xc277('0x33')][_0xc277('0x50')]({'where':{'id':_0x1da618[_0xc277('0x4f')]['id']}})[_0xc277('0x1b')](handleEntityNotFound(_0x2cd384,null))[_0xc277('0x1b')](function(_0x31988b){if(_0x31988b){_0x49f89f=_0x31988b;_0xce525b[_0xc277('0x36')]=_[_0xc277('0x38')](db['ZendeskConfiguration'][_0xc277('0x51')]);_0xce525b['query']=_[_0xc277('0x38')](_0x1da618[_0xc277('0x37')]);_0xce525b['filters']=_['intersection'](_0xce525b[_0xc277('0x36')],_0xce525b[_0xc277('0x37')]);_0xdec3b5[_0xc277('0x3c')]=_['intersection'](_0xce525b['model'],qs[_0xc277('0x3b')](_0x1da618[_0xc277('0x37')][_0xc277('0x3b')]));_0xdec3b5[_0xc277('0x3c')]=_0xdec3b5[_0xc277('0x3c')][_0xc277('0x49')]?_0xdec3b5['attributes']:_0xce525b[_0xc277('0x36')];_0xdec3b5[_0xc277('0x52')]=qs[_0xc277('0x40')](_0x1da618[_0xc277('0x37')][_0xc277('0x40')]);_0xdec3b5[_0xc277('0x43')]=qs[_0xc277('0x39')](_[_0xc277('0x41')](_0x1da618[_0xc277('0x37')],_0xce525b[_0xc277('0x39')]));if(_0x1da618[_0xc277('0x37')]['filter']){_0xdec3b5[_0xc277('0x43')]=_[_0xc277('0x44')](_0xdec3b5[_0xc277('0x43')],{'$or':_[_0xc277('0x32')](_0xdec3b5['attributes'],function(_0x3743e5){var _0x2231e6={};_0x2231e6[_0x3743e5]={'$like':'%'+_0x1da618[_0xc277('0x37')][_0xc277('0x42')]+'%'};return _0x2231e6;})});}_0xdec3b5=_[_0xc277('0x44')]({},_0xdec3b5,_0x1da618[_0xc277('0x46')]);return _0x49f89f['getConfigurations'](_0xdec3b5);}})[_0xc277('0x1b')](function(_0x5496f7){if(_0x5496f7){_0x4e71bd=_0x5496f7[_0xc277('0x49')];if(!_0x1da618[_0xc277('0x37')]['hasOwnProperty']('nolimit')){_0xdec3b5[_0xc277('0x28')]=qs[_0xc277('0x28')](_0x1da618['query'][_0xc277('0x28')]);_0xdec3b5[_0xc277('0x3f')]=qs[_0xc277('0x3f')](_0x1da618[_0xc277('0x37')][_0xc277('0x3f')]);}return _0x49f89f[_0xc277('0x53')](_0xdec3b5);}})[_0xc277('0x1b')](function(_0x38af94){if(_0x38af94){return _0x38af94?{'count':_0x4e71bd,'rows':_0x38af94}:null;}})[_0xc277('0x1b')](respondWithResult(_0x2cd384,null))[_0xc277('0x23')](handleError(_0x2cd384,null));};exports['addConfiguration']=function(_0x57f570,_0x1d78c0,_0x429cbc){if(_0x57f570['body']['id']){delete _0x57f570[_0xc277('0x4d')]['id'];}return db[_0xc277('0x33')][_0xc277('0x50')]({'where':{'id':_0x57f570['params']['id']}})[_0xc277('0x1b')](handleEntityNotFound(_0x1d78c0,null))[_0xc277('0x1b')](function(_0x2abd4d){if(_0x2abd4d){_0x57f570[_0xc277('0x4d')]['AccountId']=_0x2abd4d['id'];_0x57f570[_0xc277('0x4d')][_0xc277('0x54')]=integrations[_0xc277('0x55')](_0x57f570['body'][_0xc277('0x56')],_0x57f570[_0xc277('0x4d')][_0xc277('0x57')]);_0x57f570[_0xc277('0x4d')][_0xc277('0x58')]=integrations['getDescriptions'](_0x57f570[_0xc277('0x4d')][_0xc277('0x56')],_0x57f570[_0xc277('0x4d')][_0xc277('0x57')]);return db[_0xc277('0x59')][_0xc277('0x4c')](_0x57f570[_0xc277('0x4d')],{'include':[{'model':db[_0xc277('0x5a')],'as':_0xc277('0x54')},{'model':db[_0xc277('0x5a')],'as':_0xc277('0x58')}]});}return null;})[_0xc277('0x1b')](respondWithResult(_0x1d78c0,null))[_0xc277('0x23')](handleError(_0x1d78c0,null));};exports[_0xc277('0x5b')]=function(_0x1b897c,_0x5d0a59,_0x14d520){var _0x53ce7d='';return db['ZendeskAccount'][_0xc277('0x50')]({'where':{'id':_0x1b897c['params']['id']},'attributes':['id',_0xc277('0x5c'),_0xc277('0x5d'),_0xc277('0x5e'),'authType',_0xc277('0x5f')]})[_0xc277('0x1b')](handleEntityNotFound(_0x5d0a59,null))[_0xc277('0x1b')](function(_0x3ae5f4){if(_0x3ae5f4){_0x53ce7d=_0x3ae5f4[_0xc277('0x5f')];var _0xb359f2=_0x53ce7d[_0xc277('0x60')](-0x1);if(_0xb359f2==='/'){_0x53ce7d=_0x53ce7d[_0xc277('0x61')](0x0,_0x53ce7d[_0xc277('0x62')](_0xb359f2));}var _0x3a7449={'method':_0xc277('0x63'),'uri':util[_0xc277('0x64')](_0xc277('0x65'),_0x53ce7d,'ticket_fields'),'json':!![]};switch(_0x3ae5f4[_0xc277('0x66')]){case _0xc277('0x5d'):_0x3a7449['headers']={'Authorization':util[_0xc277('0x64')](_0xc277('0x67'),new Buffer(util[_0xc277('0x64')](_0xc277('0x68'),_0x3ae5f4[_0xc277('0x5c')],_0x3ae5f4['password']))['toString'](_0xc277('0x69')))};break;case'token':_0x3a7449[_0xc277('0x6a')]={'Authorization':util[_0xc277('0x64')](_0xc277('0x67'),new Buffer(util['format'](_0xc277('0x6b'),_0x3ae5f4[_0xc277('0x5c')],_0x3ae5f4[_0xc277('0x5e')]))[_0xc277('0x6c')](_0xc277('0x69')))};break;default:throw new db['Sequelize']['ValidationError']('Unknown\x20authentication\x20type');}return rp(_0x3a7449);}})['then'](function(_0x1ddf5d){if(_0x1ddf5d){var _0xe41415=[_0xc277('0x6d'),_0xc277('0x6e'),'group','assignee'];_[_0xc277('0x6f')](_0x1ddf5d[_0xc277('0x70')],function(_0x3c196a){return _0xe41415['includes'](_0x3c196a[_0xc277('0x57')]);});return{'count':_0x1ddf5d[_0xc277('0x70')][_0xc277('0x49')],'rows':_['map'](_0x1ddf5d[_0xc277('0x70')],function(_0x266de7){return{'id':_0x266de7['id'],'name':_0x266de7[_0xc277('0x71')]>0x7?_0x266de7[_0xc277('0x72')]:_0x266de7[_0xc277('0x57')],'custom':_0x266de7[_0xc277('0x71')]>0x7?!![]:![],'options':_0x266de7['system_field_options']?_0x266de7['system_field_options']:_0x266de7[_0xc277('0x73')]?_0x266de7['custom_field_options']:[]};})};}})[_0xc277('0x1b')](respondWithResult(_0x5d0a59,null))[_0xc277('0x23')](function(_0x4a0d24){var _0x5d2cfe=_0x1b897c[_0xc277('0x37')][_0xc277('0x74')]?0x1f4:_0x4a0d24[_0xc277('0x75')]||0x1f4;logger[_0xc277('0x1f')]('getFields,\x20%s,\x20%s,\x20%s',_0xc277('0x5b'),_0x5d2cfe,JSON[_0xc277('0x76')](_0x4a0d24));delete _0x4a0d24['name'];if(_0x5d2cfe===0x191){_0x5d2cfe=0x190;}_0x5d0a59[_0xc277('0x24')](_0x5d2cfe)[_0xc277('0x77')](_0x1b897c[_0xc277('0x37')]['test']?{'message':_0xc277('0x78'),'statusCode':_0x4a0d24[_0xc277('0x75')]}:_0x4a0d24);});}; \ No newline at end of file +var _0x425d=['client','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','ZendeskAccount','includeAll','findAll','rows','show','keys','include','options','find','create','body','findOne','params','length','getConfigurations','hasOwnProperty','addConfiguration','getSubjects','channel','Descriptions','ZendeskConfiguration','ZendeskField','getFields','username','token','authType','remoteUri','slice','lastIndexOf','format','ticket_fields','password','headers','%s:%s','toString','Basic\x20%s','%s/token:%s','base64','ValidationError','Unknown\x20authentication\x20type','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise'];(function(_0x14ebbe,_0x2f6ced){var _0x335147=function(_0x57d9bf){while(--_0x57d9bf){_0x14ebbe['push'](_0x14ebbe['shift']());}};_0x335147(++_0x2f6ced);}(_0x425d,0x1e0));var _0xd425=function(_0x4298ed,_0x38e24c){_0x4298ed=_0x4298ed-0x0;var _0x206ec4=_0x425d[_0x4298ed];return _0x206ec4;};'use strict';var pdf=require(_0xd425('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd425('0x1'));var zipdir=require(_0xd425('0x2'));var jsonpatch=require(_0xd425('0x3'));var rp=require(_0xd425('0x4'));var moment=require(_0xd425('0x5'));var BPromise=require(_0xd425('0x6'));var Mustache=require(_0xd425('0x7'));var util=require('util');var path=require(_0xd425('0x8'));var sox=require(_0xd425('0x9'));var csv=require(_0xd425('0xa'));var ejs=require(_0xd425('0xb'));var fs=require('fs');var fs_extra=require(_0xd425('0xc'));var _=require(_0xd425('0xd'));var squel=require('squel');var crypto=require(_0xd425('0xe'));var jsforce=require(_0xd425('0xf'));var deskjs=require(_0xd425('0x10'));var toCsv=require(_0xd425('0xa'));var querystring=require(_0xd425('0x11'));var Papa=require(_0xd425('0x12'));var Redis=require(_0xd425('0x13'));var authService=require(_0xd425('0x14'));var qs=require(_0xd425('0x15'));var as=require(_0xd425('0x16'));var hardwareService=require(_0xd425('0x17'));var logger=require(_0xd425('0x18'))(_0xd425('0x19'));var utils=require(_0xd425('0x1a'));var config=require(_0xd425('0x1b'));var licenseUtil=require(_0xd425('0x1c'));var db=require(_0xd425('0x1d'))['db'];var integrations=require(_0xd425('0x1e'));var jayson=require(_0xd425('0x1f'));var client=jayson[_0xd425('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27318c,_0x17a498,_0x336dc3,_0x5d3d60){return new BPromise(function(_0x309263,_0x2e2e4e){var _0x643fd2=_0x5d3d60||client;return _0x643fd2[_0xd425('0x21')](_0x27318c,_0x336dc3)[_0xd425('0x22')](function(_0x538a0a){logger[_0xd425('0x23')](_0xd425('0x24'),_0x17a498,_0xd425('0x25'));logger[_0xd425('0x26')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x17a498,_0xd425('0x25'),JSON[_0xd425('0x27')](_0x538a0a));if(_0x538a0a[_0xd425('0x28')]){if(_0x538a0a[_0xd425('0x28')]['code']===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x17a498,_0x538a0a['error'][_0xd425('0x29')]);return _0x2e2e4e(_0x538a0a[_0xd425('0x28')][_0xd425('0x29')]);}logger['error'](_0xd425('0x24'),_0x17a498,_0x538a0a[_0xd425('0x28')]['message']);return _0x309263(_0x538a0a[_0xd425('0x28')][_0xd425('0x29')]);}else{logger[_0xd425('0x23')](_0xd425('0x24'),_0x17a498,_0xd425('0x25'));_0x309263(_0x538a0a[_0xd425('0x2a')][_0xd425('0x29')]);}})[_0xd425('0x2b')](function(_0x314201){logger[_0xd425('0x28')](_0xd425('0x24'),_0x17a498,_0x314201);_0x2e2e4e(_0x314201);});});}function respondWithStatusCode(_0x40e84b,_0x47f44a){_0x47f44a=_0x47f44a||0xcc;return function(_0x369b5b){if(_0x369b5b){return _0x40e84b[_0xd425('0x2c')](_0x47f44a);}return _0x40e84b[_0xd425('0x2d')](_0x47f44a)[_0xd425('0x2e')]();};}function respondWithResult(_0x2afcdb,_0x400dd7){_0x400dd7=_0x400dd7||0xc8;return function(_0x3c3402){if(_0x3c3402){return _0x2afcdb['status'](_0x400dd7)[_0xd425('0x2f')](_0x3c3402);}};}function respondWithFilteredResult(_0x177de2,_0x1d8861){return function(_0x57c950){if(_0x57c950){var _0x27ef8a=_0x57c950[_0xd425('0x30')],_0x3ad9bd=_0x1d8861[_0xd425('0x31')],_0x433189=_0x1d8861[_0xd425('0x31')]+_0x1d8861[_0xd425('0x32')],_0x999fb9;if(_0x433189>=_0x27ef8a){_0x433189=_0x27ef8a;_0x999fb9=0xc8;}else{_0x999fb9=0xce;}_0x177de2[_0xd425('0x2d')](_0x999fb9);return _0x177de2[_0xd425('0x33')]('Content-Range',_0x3ad9bd+'-'+_0x433189+'/'+_0x27ef8a)[_0xd425('0x2f')](_0x57c950);}return null;};}function patchUpdates(_0x219ada){return function(_0x298602){try{jsonpatch[_0xd425('0x34')](_0x298602,_0x219ada,!![]);}catch(_0x3275b1){return BPromise[_0xd425('0x35')](_0x3275b1);}return _0x298602[_0xd425('0x36')]();};}function saveUpdates(_0x40c392,_0x3ec51b){return function(_0x3342bb){if(_0x3342bb){return _0x3342bb[_0xd425('0x37')](_0x40c392)['then'](function(_0x316493){return _0x316493;});}return null;};}function removeEntity(_0x2a2a9b,_0x3120a4){return function(_0x21e0bd){if(_0x21e0bd){return _0x21e0bd[_0xd425('0x38')]()['then'](function(){_0x2a2a9b[_0xd425('0x2d')](0xcc)[_0xd425('0x2e')]();});}};}function handleEntityNotFound(_0x4cfcd1,_0x574962){return function(_0x51669d){if(!_0x51669d){_0x4cfcd1[_0xd425('0x2c')](0x194);}return _0x51669d;};}function handleError(_0xfb0c8,_0x167179){_0x167179=_0x167179||0x1f4;return function(_0x2d586f){logger['error'](_0x2d586f[_0xd425('0x39')]);if(_0x2d586f[_0xd425('0x3a')]){delete _0x2d586f[_0xd425('0x3a')];}_0xfb0c8[_0xd425('0x2d')](_0x167179)[_0xd425('0x3b')](_0x2d586f);};}exports[_0xd425('0x3c')]=function(_0x35bbec,_0x533af1){var _0x363fb0={},_0x59b3d3={},_0x22df81={'count':0x0,'rows':[]};var _0x29cca9=_[_0xd425('0x3d')](db['ZendeskAccount'][_0xd425('0x3e')],function(_0x26806c){return{'name':_0x26806c[_0xd425('0x3f')],'type':_0x26806c[_0xd425('0x40')]['key']};});_0x59b3d3[_0xd425('0x41')]=_[_0xd425('0x3d')](_0x29cca9,'name');_0x59b3d3['query']=_['keys'](_0x35bbec[_0xd425('0x42')]);_0x59b3d3[_0xd425('0x43')]=_[_0xd425('0x44')](_0x59b3d3['model'],_0x59b3d3['query']);_0x363fb0['attributes']=_[_0xd425('0x44')](_0x59b3d3[_0xd425('0x41')],qs[_0xd425('0x45')](_0x35bbec[_0xd425('0x42')][_0xd425('0x45')]));_0x363fb0[_0xd425('0x46')]=_0x363fb0[_0xd425('0x46')]['length']?_0x363fb0[_0xd425('0x46')]:_0x59b3d3[_0xd425('0x41')];if(!_0x35bbec[_0xd425('0x42')]['hasOwnProperty'](_0xd425('0x47'))){_0x363fb0[_0xd425('0x32')]=qs[_0xd425('0x32')](_0x35bbec['query'][_0xd425('0x32')]);_0x363fb0[_0xd425('0x31')]=qs[_0xd425('0x31')](_0x35bbec[_0xd425('0x42')]['offset']);}_0x363fb0[_0xd425('0x48')]=qs[_0xd425('0x49')](_0x35bbec[_0xd425('0x42')][_0xd425('0x49')]);_0x363fb0[_0xd425('0x4a')]=qs[_0xd425('0x43')](_[_0xd425('0x4b')](_0x35bbec['query'],_0x59b3d3[_0xd425('0x43')]),_0x29cca9);if(_0x35bbec[_0xd425('0x42')]['filter']){_0x363fb0[_0xd425('0x4a')]=_['merge'](_0x363fb0['where'],{'$or':_[_0xd425('0x3d')](_0x29cca9,function(_0x59e893){if(_0x59e893[_0xd425('0x40')]!=='VIRTUAL'){var _0x448829={};_0x448829[_0x59e893[_0xd425('0x3a')]]={'$like':'%'+_0x35bbec[_0xd425('0x42')][_0xd425('0x4c')]+'%'};return _0x448829;}})});}_0x363fb0=_[_0xd425('0x4d')]({},_0x363fb0,_0x35bbec['options']);var _0x2e4b21={'where':_0x363fb0['where']};return db[_0xd425('0x4e')]['count'](_0x2e4b21)[_0xd425('0x22')](function(_0x16f61c){_0x22df81[_0xd425('0x30')]=_0x16f61c;if(_0x35bbec[_0xd425('0x42')][_0xd425('0x4f')]){_0x363fb0['include']=[{'all':!![]}];}return db[_0xd425('0x4e')][_0xd425('0x50')](_0x363fb0);})[_0xd425('0x22')](function(_0x4091a7){_0x22df81[_0xd425('0x51')]=_0x4091a7;return _0x22df81;})['then'](respondWithFilteredResult(_0x533af1,_0x363fb0))[_0xd425('0x2b')](handleError(_0x533af1,null));};exports[_0xd425('0x52')]=function(_0x1450f2,_0x2a2ab4){var _0x34cd86={'raw':![],'where':{'id':_0x1450f2['params']['id']}},_0xf7a74c={};_0xf7a74c[_0xd425('0x41')]=_[_0xd425('0x53')](db['ZendeskAccount'][_0xd425('0x3e')]);_0xf7a74c[_0xd425('0x42')]=_[_0xd425('0x53')](_0x1450f2[_0xd425('0x42')]);_0xf7a74c['filters']=_[_0xd425('0x44')](_0xf7a74c[_0xd425('0x41')],_0xf7a74c[_0xd425('0x42')]);_0x34cd86[_0xd425('0x46')]=_[_0xd425('0x44')](_0xf7a74c['model'],qs['fields'](_0x1450f2[_0xd425('0x42')]['fields']));_0x34cd86[_0xd425('0x46')]=_0x34cd86[_0xd425('0x46')]['length']?_0x34cd86[_0xd425('0x46')]:_0xf7a74c['model'];if(_0x1450f2['query'][_0xd425('0x4f')]){_0x34cd86[_0xd425('0x54')]=[{'all':!![]}];}_0x34cd86=_[_0xd425('0x4d')]({},_0x34cd86,_0x1450f2[_0xd425('0x55')]);return db[_0xd425('0x4e')][_0xd425('0x56')](_0x34cd86)[_0xd425('0x22')](handleEntityNotFound(_0x2a2ab4,null))[_0xd425('0x22')](respondWithResult(_0x2a2ab4,null))['catch'](handleError(_0x2a2ab4,null));};exports[_0xd425('0x57')]=function(_0x1c6141,_0x1be9bb){return db[_0xd425('0x4e')][_0xd425('0x57')](_0x1c6141[_0xd425('0x58')],{})[_0xd425('0x22')](respondWithResult(_0x1be9bb,0xc9))[_0xd425('0x2b')](handleError(_0x1be9bb,null));};exports['update']=function(_0x4a2508,_0x47976d){if(_0x4a2508[_0xd425('0x58')]['id']){delete _0x4a2508[_0xd425('0x58')]['id'];}return db[_0xd425('0x4e')][_0xd425('0x56')]({'where':{'id':_0x4a2508['params']['id']}})['then'](handleEntityNotFound(_0x47976d,null))['then'](saveUpdates(_0x4a2508['body'],null))[_0xd425('0x22')](respondWithResult(_0x47976d,null))[_0xd425('0x2b')](handleError(_0x47976d,null));};exports['destroy']=function(_0x43cb49,_0x29ba4f){return db[_0xd425('0x4e')]['find']({'where':{'id':_0x43cb49['params']['id']}})[_0xd425('0x22')](handleEntityNotFound(_0x29ba4f,null))['then'](removeEntity(_0x29ba4f,null))['catch'](handleError(_0x29ba4f,null));};exports['getConfigurations']=function(_0x4458bc,_0x259482,_0x22b00e){var _0x5b2323={};var _0x3395d8={};var _0x48bd20;var _0x1158ac;return db[_0xd425('0x4e')][_0xd425('0x59')]({'where':{'id':_0x4458bc[_0xd425('0x5a')]['id']}})[_0xd425('0x22')](handleEntityNotFound(_0x259482,null))[_0xd425('0x22')](function(_0xa21f7c){if(_0xa21f7c){_0x48bd20=_0xa21f7c;_0x3395d8[_0xd425('0x41')]=_[_0xd425('0x53')](db['ZendeskConfiguration'][_0xd425('0x3e')]);_0x3395d8[_0xd425('0x42')]=_[_0xd425('0x53')](_0x4458bc[_0xd425('0x42')]);_0x3395d8['filters']=_['intersection'](_0x3395d8[_0xd425('0x41')],_0x3395d8[_0xd425('0x42')]);_0x5b2323[_0xd425('0x46')]=_[_0xd425('0x44')](_0x3395d8[_0xd425('0x41')],qs[_0xd425('0x45')](_0x4458bc[_0xd425('0x42')][_0xd425('0x45')]));_0x5b2323[_0xd425('0x46')]=_0x5b2323[_0xd425('0x46')][_0xd425('0x5b')]?_0x5b2323[_0xd425('0x46')]:_0x3395d8[_0xd425('0x41')];_0x5b2323[_0xd425('0x48')]=qs['sort'](_0x4458bc[_0xd425('0x42')][_0xd425('0x49')]);_0x5b2323[_0xd425('0x4a')]=qs['filters'](_['pick'](_0x4458bc['query'],_0x3395d8[_0xd425('0x43')]));if(_0x4458bc[_0xd425('0x42')][_0xd425('0x4c')]){_0x5b2323['where']=_[_0xd425('0x4d')](_0x5b2323['where'],{'$or':_[_0xd425('0x3d')](_0x5b2323[_0xd425('0x46')],function(_0x21d26e){var _0x5113fc={};_0x5113fc[_0x21d26e]={'$like':'%'+_0x4458bc[_0xd425('0x42')][_0xd425('0x4c')]+'%'};return _0x5113fc;})});}_0x5b2323=_[_0xd425('0x4d')]({},_0x5b2323,_0x4458bc[_0xd425('0x55')]);return _0x48bd20[_0xd425('0x5c')](_0x5b2323);}})[_0xd425('0x22')](function(_0x38a762){if(_0x38a762){_0x1158ac=_0x38a762[_0xd425('0x5b')];if(!_0x4458bc[_0xd425('0x42')][_0xd425('0x5d')](_0xd425('0x47'))){_0x5b2323[_0xd425('0x32')]=qs[_0xd425('0x32')](_0x4458bc[_0xd425('0x42')][_0xd425('0x32')]);_0x5b2323[_0xd425('0x31')]=qs[_0xd425('0x31')](_0x4458bc[_0xd425('0x42')]['offset']);}return _0x48bd20['getConfigurations'](_0x5b2323);}})[_0xd425('0x22')](function(_0x5c333a){if(_0x5c333a){return _0x5c333a?{'count':_0x1158ac,'rows':_0x5c333a}:null;}})[_0xd425('0x22')](respondWithResult(_0x259482,null))[_0xd425('0x2b')](handleError(_0x259482,null));};exports[_0xd425('0x5e')]=function(_0x1ae1e3,_0x4c7000,_0x3187ca){if(_0x1ae1e3[_0xd425('0x58')]['id']){delete _0x1ae1e3[_0xd425('0x58')]['id'];}return db[_0xd425('0x4e')][_0xd425('0x59')]({'where':{'id':_0x1ae1e3[_0xd425('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4c7000,null))['then'](function(_0x3ccffe){if(_0x3ccffe){_0x1ae1e3[_0xd425('0x58')]['AccountId']=_0x3ccffe['id'];_0x1ae1e3[_0xd425('0x58')]['Subjects']=integrations[_0xd425('0x5f')](_0x1ae1e3[_0xd425('0x58')][_0xd425('0x60')],_0x1ae1e3[_0xd425('0x58')][_0xd425('0x40')]);_0x1ae1e3[_0xd425('0x58')][_0xd425('0x61')]=integrations['getDescriptions'](_0x1ae1e3[_0xd425('0x58')][_0xd425('0x60')],_0x1ae1e3[_0xd425('0x58')][_0xd425('0x40')]);return db[_0xd425('0x62')]['create'](_0x1ae1e3[_0xd425('0x58')],{'include':[{'model':db[_0xd425('0x63')],'as':'Subjects'},{'model':db[_0xd425('0x63')],'as':_0xd425('0x61')}]});}return null;})['then'](respondWithResult(_0x4c7000,null))[_0xd425('0x2b')](handleError(_0x4c7000,null));};exports[_0xd425('0x64')]=function(_0x74d30b,_0xd923bb,_0x1b0cef){var _0x572f23='';return db[_0xd425('0x4e')]['findOne']({'where':{'id':_0x74d30b[_0xd425('0x5a')]['id']},'attributes':['id',_0xd425('0x65'),'password',_0xd425('0x66'),_0xd425('0x67'),_0xd425('0x68')]})[_0xd425('0x22')](handleEntityNotFound(_0xd923bb,null))['then'](function(_0x4f5fc5){if(_0x4f5fc5){_0x572f23=_0x4f5fc5[_0xd425('0x68')];var _0x2312c1=_0x572f23[_0xd425('0x69')](-0x1);if(_0x2312c1==='/'){_0x572f23=_0x572f23['substring'](0x0,_0x572f23[_0xd425('0x6a')](_0x2312c1));}var _0xb1479e={'method':'GET','uri':util[_0xd425('0x6b')]('%s/%s',_0x572f23,_0xd425('0x6c')),'json':!![]};switch(_0x4f5fc5[_0xd425('0x67')]){case _0xd425('0x6d'):_0xb1479e[_0xd425('0x6e')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xd425('0x6b')](_0xd425('0x6f'),_0x4f5fc5['username'],_0x4f5fc5[_0xd425('0x6d')]))[_0xd425('0x70')]('base64'))};break;case _0xd425('0x66'):_0xb1479e[_0xd425('0x6e')]={'Authorization':util[_0xd425('0x6b')](_0xd425('0x71'),new Buffer(util[_0xd425('0x6b')](_0xd425('0x72'),_0x4f5fc5[_0xd425('0x65')],_0x4f5fc5['token']))['toString'](_0xd425('0x73')))};break;default:throw new db['Sequelize'][(_0xd425('0x74'))](_0xd425('0x75'));}return rp(_0xb1479e);}})['then'](function(_0x244789){if(_0x244789){var _0x1c1c77=['subject','description',_0xd425('0x76'),_0xd425('0x77')];_[_0xd425('0x78')](_0x244789[_0xd425('0x6c')],function(_0x247b01){return _0x1c1c77[_0xd425('0x79')](_0x247b01[_0xd425('0x40')]);});return{'count':_0x244789[_0xd425('0x6c')]['length'],'rows':_[_0xd425('0x3d')](_0x244789[_0xd425('0x6c')],function(_0x5759a5){return{'id':_0x5759a5['id'],'name':_0x5759a5[_0xd425('0x7a')]>0x7?_0x5759a5[_0xd425('0x7b')]:_0x5759a5[_0xd425('0x40')],'custom':_0x5759a5[_0xd425('0x7a')]>0x7?!![]:![],'options':_0x5759a5[_0xd425('0x7c')]?_0x5759a5[_0xd425('0x7c')]:_0x5759a5[_0xd425('0x7d')]?_0x5759a5[_0xd425('0x7d')]:[]};})};}})[_0xd425('0x22')](respondWithResult(_0xd923bb,null))[_0xd425('0x2b')](function(_0x14cebc){var _0x572452=_0x74d30b[_0xd425('0x42')]['test']?0x1f4:_0x14cebc['statusCode']||0x1f4;logger[_0xd425('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0xd425('0x64'),_0x572452,JSON[_0xd425('0x27')](_0x14cebc));delete _0x14cebc[_0xd425('0x3a')];if(_0x572452===0x191){_0x572452=0x190;}_0xd923bb[_0xd425('0x2d')](_0x572452)[_0xd425('0x3b')](_0x74d30b[_0xd425('0x42')][_0xd425('0x7e')]?{'message':'Wrong\x20credentials','statusCode':_0x14cebc[_0xd425('0x7f')]}:_0x14cebc);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index a3febbb..da53732 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 _0xe248=['./intZendeskAccount.attributes','../../components/integrations/configuration','exports','int_zendesk_accounts','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1cc93f,_0x4a2c1c){var _0x3279d5=function(_0x2b7c03){while(--_0x2b7c03){_0x1cc93f['push'](_0x1cc93f['shift']());}};_0x3279d5(++_0x4a2c1c);}(_0xe248,0x112));var _0x8e24=function(_0x3aeef1,_0x40a547){_0x3aeef1=_0x3aeef1-0x0;var _0x32d427=_0xe248[_0x3aeef1];return _0x32d427;};'use strict';var _=require(_0x8e24('0x0'));var util=require(_0x8e24('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8e24('0x2'));var rp=require(_0x8e24('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8e24('0x4'));var config=require(_0x8e24('0x5'));var attributes=require(_0x8e24('0x6'));var integrations=require(_0x8e24('0x7'));module[_0x8e24('0x8')]=function(_0x22a6eb,_0x1ffc35){return _0x22a6eb['define']('ZendeskAccount',attributes,{'tableName':_0x8e24('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d9f=['../../config/logger','api','moment','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','lodash'];(function(_0x217aeb,_0x26446e){var _0x3a0222=function(_0x14f3f9){while(--_0x14f3f9){_0x217aeb['push'](_0x217aeb['shift']());}};_0x3a0222(++_0x26446e);}(_0x7d9f,0x117));var _0xf7d9=function(_0x3b6668,_0x3b3c41){_0x3b6668=_0x3b6668-0x0;var _0x4e47e6=_0x7d9f[_0x3b6668];return _0x4e47e6;};'use strict';var _=require(_0xf7d9('0x0'));var util=require('util');var logger=require(_0xf7d9('0x1'))(_0xf7d9('0x2'));var moment=require(_0xf7d9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf7d9('0x4'));var config=require(_0xf7d9('0x5'));var attributes=require(_0xf7d9('0x6'));var integrations=require(_0xf7d9('0x7'));module[_0xf7d9('0x8')]=function(_0x4cdc5f,_0x2de49d){return _0x4cdc5f[_0xf7d9('0x9')]('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 6d9a49a..2dda14a 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 _0xd8b0=['raw','where','include','map','model','attributes','ShowZendeskAccount','find','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','options'];(function(_0x227150,_0x2126af){var _0x4251e8=function(_0x3779d2){while(--_0x3779d2){_0x227150['push'](_0x227150['shift']());}};_0x4251e8(++_0x2126af);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['findAll']({'raw':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x19')]===undefined?!![]:![]:!![],'where':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x1a')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')]['attributes']||null:null,'limit':_0x5fecbd['options']?_0x5fecbd[_0x0d8b('0x18')]['limit']||null:null,'include':_0x5fecbd['options']?_0x5fecbd['options'][_0x0d8b('0x1b')]?_[_0x0d8b('0x1c')](_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x1b')],function(_0x221071){return{'model':db[_0x221071[_0x0d8b('0x1d')]],'as':_0x221071['as'],'attributes':_0x221071[_0x0d8b('0x1e')],'include':_0x221071[_0x0d8b('0x1b')]?_[_0x0d8b('0x1c')](_0x221071['include'],function(_0xe8bbee){return{'model':db[_0xe8bbee[_0x0d8b('0x1d')]],'as':_0xe8bbee['as'],'attributes':_0xe8bbee['attributes'],'include':_0xe8bbee[_0x0d8b('0x1b')]?_['map'](_0xe8bbee[_0x0d8b('0x1b')],function(_0x234bdd){return{'model':db[_0x234bdd[_0x0d8b('0x1d')]],'as':_0x234bdd['as'],'attributes':_0x234bdd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x28f639){logger[_0x0d8b('0xb')]('GetZendeskAccount',_0x5fecbd);logger[_0x0d8b('0xe')]('GetZendeskAccount',_0x5fecbd,JSON[_0x0d8b('0x10')](_0x28f639));_0x18dd2d(_0x28f639);})['catch'](function(_0x97050a){logger['error'](_0x0d8b('0x16'),_0x97050a['message'],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x97050a['message']));});});};exports[_0x0d8b('0x1f')]=function(_0x106e4c){var _0x2c058d=this;return new Promise(function(_0x56120a,_0x4c80a2){return db['ZendeskAccount'][_0x0d8b('0x20')]({'raw':_0x106e4c['options']?_0x106e4c[_0x0d8b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x106e4c['options']?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1a')]||null:null,'attributes':_0x106e4c[_0x0d8b('0x18')]?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1e')]||null:null,'include':_0x106e4c[_0x0d8b('0x18')]?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1b')]?_['map'](_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1b')],function(_0x4b3ea0){return{'model':db[_0x4b3ea0[_0x0d8b('0x1d')]],'as':_0x4b3ea0['as'],'attributes':_0x4b3ea0[_0x0d8b('0x1e')],'include':_0x4b3ea0[_0x0d8b('0x1b')]?_['map'](_0x4b3ea0[_0x0d8b('0x1b')],function(_0x2c507e){return{'model':db[_0x2c507e[_0x0d8b('0x1d')]],'as':_0x2c507e['as'],'attributes':_0x2c507e[_0x0d8b('0x1e')],'include':_0x2c507e[_0x0d8b('0x1b')]?_['map'](_0x2c507e[_0x0d8b('0x1b')],function(_0x1649fc){return{'model':db[_0x1649fc['model']],'as':_0x1649fc['as'],'attributes':_0x1649fc[_0x0d8b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0d8b('0xa')](function(_0x188af2){logger[_0x0d8b('0xb')](_0x0d8b('0x1f'),_0x106e4c);logger['debug']('ShowZendeskAccount',_0x106e4c,JSON[_0x0d8b('0x10')](_0x188af2));_0x56120a(_0x188af2);})['catch'](function(_0x531c55){logger[_0x0d8b('0x11')](_0x0d8b('0x1f'),_0x531c55[_0x0d8b('0x13')],_0x106e4c);_0x4c80a2(_0x2c058d[_0x0d8b('0x11')](0x1f4,_0x531c55[_0x0d8b('0x13')]));});});}; \ No newline at end of file +var _0xe706=['options','raw','where','attributes','limit','include','map','model','stringify','ShowZendeskAccount','ZendeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZendeskAccount','findAll'];(function(_0x21d96f,_0x58f607){var _0x5010d7=function(_0x30b8a4){while(--_0x30b8a4){_0x21d96f['push'](_0x21d96f['shift']());}};_0x5010d7(++_0x58f607);}(_0xe706,0xa3));var _0x6e70=function(_0xbbbeae,_0x4a414a){_0xbbbeae=_0xbbbeae-0x0;var _0x1cb9c9=_0xe706[_0xbbbeae];return _0x1cb9c9;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});}exports[_0x6e70('0x19')]=function(_0x5ea7a5){var _0x28a21f=this;return new Promise(function(_0x173afe,_0x53acdc){return db['ZendeskAccount'][_0x6e70('0x1a')]({'raw':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'limit':_0x5ea7a5['options']?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1f')]||null:null,'include':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5['options'][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x5ea7a5[_0x6e70('0x1b')]['include'],function(_0x10fc91){return{'model':db[_0x10fc91['model']],'as':_0x10fc91['as'],'attributes':_0x10fc91['attributes'],'include':_0x10fc91['include']?_[_0x6e70('0x21')](_0x10fc91[_0x6e70('0x20')],function(_0x51d292){return{'model':db[_0x51d292[_0x6e70('0x22')]],'as':_0x51d292['as'],'attributes':_0x51d292[_0x6e70('0x1e')],'include':_0x51d292['include']?_[_0x6e70('0x21')](_0x51d292[_0x6e70('0x20')],function(_0x2bb231){return{'model':db[_0x2bb231['model']],'as':_0x2bb231['as'],'attributes':_0x2bb231['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x3af17f){logger[_0x6e70('0xf')](_0x6e70('0x19'),_0x5ea7a5);logger[_0x6e70('0x12')]('GetZendeskAccount',_0x5ea7a5,JSON[_0x6e70('0x23')](_0x3af17f));_0x173afe(_0x3af17f);})[_0x6e70('0x18')](function(_0xecf336){logger[_0x6e70('0x14')](_0x6e70('0x19'),_0xecf336[_0x6e70('0x16')],_0x5ea7a5);_0x53acdc(_0x28a21f[_0x6e70('0x14')](0x1f4,_0xecf336[_0x6e70('0x16')]));});});};exports[_0x6e70('0x24')]=function(_0x3a5d30){var _0x4b1229=this;return new Promise(function(_0x1b27d8,_0x50d60b){return db[_0x6e70('0x25')]['find']({'raw':_0x3a5d30[_0x6e70('0x1b')]?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'include':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')],function(_0x1e3e76){return{'model':db[_0x1e3e76[_0x6e70('0x22')]],'as':_0x1e3e76['as'],'attributes':_0x1e3e76[_0x6e70('0x1e')],'include':_0x1e3e76[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x1e3e76['include'],function(_0x3b9c06){return{'model':db[_0x3b9c06['model']],'as':_0x3b9c06['as'],'attributes':_0x3b9c06[_0x6e70('0x1e')],'include':_0x3b9c06[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3b9c06[_0x6e70('0x20')],function(_0x233a83){return{'model':db[_0x233a83[_0x6e70('0x22')]],'as':_0x233a83['as'],'attributes':_0x233a83[_0x6e70('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x80bebb){logger[_0x6e70('0xf')](_0x6e70('0x24'),_0x3a5d30);logger[_0x6e70('0x12')](_0x6e70('0x24'),_0x3a5d30,JSON['stringify'](_0x80bebb));_0x1b27d8(_0x80bebb);})['catch'](function(_0x5424eb){logger[_0x6e70('0x14')](_0x6e70('0x24'),_0x5424eb[_0x6e70('0x16')],_0x3a5d30);_0x50d60b(_0x4b1229[_0x6e70('0x14')](0x1f4,_0x5424eb[_0x6e70('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index ea97f48..e37a630 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 _0xde23=['create','setTags','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xde23,0x1ab));var _0x3de2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xde23[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x3de2('0x0'));var util=require(_0x3de2('0x1'));var path=require(_0x3de2('0x2'));var timeout=require('connect-timeout');var express=require(_0x3de2('0x3'));var router=express[_0x3de2('0x4')]();var fs_extra=require(_0x3de2('0x5'));var auth=require(_0x3de2('0x6'));var interaction=require(_0x3de2('0x7'));var config=require('../../config/environment');var controller=require('./intZendeskConfiguration.controller');router[_0x3de2('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3de2('0x9'),auth[_0x3de2('0xa')](),controller[_0x3de2('0xb')]);router['get'](_0x3de2('0xc'),auth[_0x3de2('0xa')](),controller[_0x3de2('0xd')]);router[_0x3de2('0x8')](_0x3de2('0xe'),auth[_0x3de2('0xa')](),controller[_0x3de2('0xf')]);router[_0x3de2('0x8')](_0x3de2('0x10'),auth[_0x3de2('0xa')](),controller[_0x3de2('0x11')]);router[_0x3de2('0x8')](_0x3de2('0x12'),auth['isAuthenticated'](),controller[_0x3de2('0x13')]);router[_0x3de2('0x14')]('/',auth[_0x3de2('0xa')](),controller[_0x3de2('0x15')]);router[_0x3de2('0x14')](_0x3de2('0x12'),auth[_0x3de2('0xa')](),controller[_0x3de2('0x16')]);router[_0x3de2('0x17')](_0x3de2('0x9'),auth['isAuthenticated'](),controller[_0x3de2('0x18')]);router[_0x3de2('0x19')](_0x3de2('0x9'),auth[_0x3de2('0xa')](),controller[_0x3de2('0x1a')]);module[_0x3de2('0x1b')]=router; \ No newline at end of file +var _0x1f30=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','/:id/tags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index'];(function(_0x54bfa9,_0x424d55){var _0x160e13=function(_0xc77cb8){while(--_0xc77cb8){_0x54bfa9['push'](_0x54bfa9['shift']());}};_0x160e13(++_0x424d55);}(_0x1f30,0x109));var _0x01f3=function(_0x4e6089,_0x5a7ee5){_0x4e6089=_0x4e6089-0x0;var _0x2b411c=_0x1f30[_0x4e6089];return _0x2b411c;};'use strict';var multer=require('multer');var util=require(_0x01f3('0x0'));var path=require(_0x01f3('0x1'));var timeout=require(_0x01f3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x01f3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x01f3('0x4'));var config=require(_0x01f3('0x5'));var controller=require(_0x01f3('0x6'));router[_0x01f3('0x7')]('/',auth[_0x01f3('0x8')](),controller[_0x01f3('0x9')]);router[_0x01f3('0x7')](_0x01f3('0xa'),auth[_0x01f3('0x8')](),controller[_0x01f3('0xb')]);router[_0x01f3('0x7')](_0x01f3('0xc'),auth['isAuthenticated'](),controller[_0x01f3('0xd')]);router['get'](_0x01f3('0xe'),auth[_0x01f3('0x8')](),controller['getSubjects']);router[_0x01f3('0x7')](_0x01f3('0xf'),auth[_0x01f3('0x8')](),controller['getDescriptions']);router['get'](_0x01f3('0x10'),auth[_0x01f3('0x8')](),controller['getTags']);router[_0x01f3('0x11')]('/',auth[_0x01f3('0x8')](),controller[_0x01f3('0x12')]);router['post']('/:id/tags',auth[_0x01f3('0x8')](),controller[_0x01f3('0x13')]);router[_0x01f3('0x14')](_0x01f3('0xa'),auth[_0x01f3('0x8')](),controller[_0x01f3('0x15')]);router[_0x01f3('0x16')](_0x01f3('0xa'),auth[_0x01f3('0x8')](),controller[_0x01f3('0x17')]);module[_0x01f3('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index cdfcbe8..a0c66ef 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 _0xd239=['STRING','exports'];(function(_0x11f65f,_0x15e25d){var _0x20ea6c=function(_0x417405){while(--_0x417405){_0x11f65f['push'](_0x11f65f['shift']());}};_0x20ea6c(++_0x15e25d);}(_0xd239,0x137));var _0x9d23=function(_0x23859c,_0x5f24eb){_0x23859c=_0x23859c-0x0;var _0x581bcd=_0xd239[_0x23859c];return _0x581bcd;};'use strict';var Sequelize=require('sequelize');module[_0x9d23('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9d23('0x1')]}}; \ No newline at end of file +var _0xa2f5=['exports','STRING'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa2f5,0x17c));var _0x5a2f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa2f5[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module[_0x5a2f('0x0')]={'name':{'type':Sequelize[_0x5a2f('0x1')]},'description':{'type':Sequelize[_0x5a2f('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 2aebb16..4e16ceb 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 _0xa751=['util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','ZendeskConfiguration,\x20%s,\x20%s','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','stack','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','name','merge','includeAll','rows','show','params','options','create','body','update','find','ZendeskField','order','getFields','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache'];(function(_0xe4733d,_0x585e23){var _0x309d44=function(_0xa28418){while(--_0xa28418){_0xe4733d['push'](_0xe4733d['shift']());}};_0x309d44(++_0x585e23);}(_0xa751,0x175));var _0x1a75=function(_0x345318,_0xbd67bb){_0x345318=_0x345318-0x0;var _0x51b891=_0xa751[_0x345318];return _0x51b891;};'use strict';var pdf=require(_0x1a75('0x0'));var emlformat=require(_0x1a75('0x1'));var rimraf=require(_0x1a75('0x2'));var zipdir=require(_0x1a75('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1a75('0x4'));var moment=require('moment');var BPromise=require(_0x1a75('0x5'));var Mustache=require(_0x1a75('0x6'));var util=require(_0x1a75('0x7'));var path=require('path');var sox=require(_0x1a75('0x8'));var csv=require(_0x1a75('0x9'));var ejs=require(_0x1a75('0xa'));var fs=require('fs');var fs_extra=require(_0x1a75('0xb'));var _=require(_0x1a75('0xc'));var squel=require(_0x1a75('0xd'));var crypto=require(_0x1a75('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1a75('0xf'));var Papa=require(_0x1a75('0x10'));var Redis=require(_0x1a75('0x11'));var authService=require(_0x1a75('0x12'));var qs=require(_0x1a75('0x13'));var as=require(_0x1a75('0x14'));var hardwareService=require(_0x1a75('0x15'));var logger=require(_0x1a75('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1a75('0x17'));var db=require(_0x1a75('0x18'))['db'];var jayson=require(_0x1a75('0x19'));var client=jayson[_0x1a75('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ed24b,_0x1c6ceb,_0xf4a616,_0x48577b){return new BPromise(function(_0x1c84d3,_0xa8f0b7){var _0x5a840b=_0x48577b||client;return _0x5a840b[_0x1a75('0x1b')](_0x5ed24b,_0xf4a616)[_0x1a75('0x1c')](function(_0x15a1ec){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x1c6ceb,'request\x20sent');logger[_0x1a75('0x1d')](_0x1a75('0x1e'),_0x1c6ceb,_0x1a75('0x1f'),JSON[_0x1a75('0x20')](_0x15a1ec));if(_0x15a1ec[_0x1a75('0x21')]){if(_0x15a1ec[_0x1a75('0x21')]['code']===0x1f4){logger[_0x1a75('0x21')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1c6ceb,_0x15a1ec['error'][_0x1a75('0x22')]);return _0xa8f0b7(_0x15a1ec[_0x1a75('0x21')]['message']);}logger[_0x1a75('0x21')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1c6ceb,_0x15a1ec[_0x1a75('0x21')][_0x1a75('0x22')]);return _0x1c84d3(_0x15a1ec[_0x1a75('0x21')][_0x1a75('0x22')]);}else{logger[_0x1a75('0x23')](_0x1a75('0x24'),_0x1c6ceb,'request\x20sent');_0x1c84d3(_0x15a1ec[_0x1a75('0x25')]['message']);}})[_0x1a75('0x26')](function(_0x17139e){logger[_0x1a75('0x21')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1c6ceb,_0x17139e);_0xa8f0b7(_0x17139e);});});}function respondWithStatusCode(_0x443ff8,_0x5e6617){_0x5e6617=_0x5e6617||0xcc;return function(_0x42232d){if(_0x42232d){return _0x443ff8[_0x1a75('0x27')](_0x5e6617);}return _0x443ff8[_0x1a75('0x28')](_0x5e6617)['end']();};}function respondWithResult(_0x9fe9fe,_0x126f40){_0x126f40=_0x126f40||0xc8;return function(_0x4dec82){if(_0x4dec82){return _0x9fe9fe[_0x1a75('0x28')](_0x126f40)[_0x1a75('0x29')](_0x4dec82);}};}function respondWithFilteredResult(_0x5a6acc,_0x168e06){return function(_0x10b4ab){if(_0x10b4ab){var _0x34c106=_0x10b4ab[_0x1a75('0x2a')],_0x184d87=_0x168e06[_0x1a75('0x2b')],_0x4ba38b=_0x168e06[_0x1a75('0x2b')]+_0x168e06[_0x1a75('0x2c')],_0x2e16b7;if(_0x4ba38b>=_0x34c106){_0x4ba38b=_0x34c106;_0x2e16b7=0xc8;}else{_0x2e16b7=0xce;}_0x5a6acc[_0x1a75('0x28')](_0x2e16b7);return _0x5a6acc[_0x1a75('0x2d')](_0x1a75('0x2e'),_0x184d87+'-'+_0x4ba38b+'/'+_0x34c106)['json'](_0x10b4ab);}return null;};}function patchUpdates(_0x55a63c){return function(_0x6f60ba){try{jsonpatch[_0x1a75('0x2f')](_0x6f60ba,_0x55a63c,!![]);}catch(_0x1a0359){return BPromise[_0x1a75('0x30')](_0x1a0359);}return _0x6f60ba[_0x1a75('0x31')]();};}function saveUpdates(_0x2ab8ba,_0x1db620){return function(_0x28b353){if(_0x28b353){return _0x28b353['update'](_0x2ab8ba)['then'](function(_0x4c30d5){return _0x4c30d5;});}return null;};}function removeEntity(_0xdef8cb,_0x291789){return function(_0x330e01){if(_0x330e01){return _0x330e01[_0x1a75('0x32')]()['then'](function(){_0xdef8cb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x260834,_0x329889){return function(_0x5cec42){if(!_0x5cec42){_0x260834['sendStatus'](0x194);}return _0x5cec42;};}function handleError(_0x15410c,_0x4ddfd2){_0x4ddfd2=_0x4ddfd2||0x1f4;return function(_0x6c8e6c){logger[_0x1a75('0x21')](_0x6c8e6c[_0x1a75('0x33')]);if(_0x6c8e6c['name']){delete _0x6c8e6c['name'];}_0x15410c[_0x1a75('0x28')](_0x4ddfd2)[_0x1a75('0x34')](_0x6c8e6c);};}exports[_0x1a75('0x35')]=function(_0x24ee8e,_0x3d170e){var _0x19ea6d={},_0x283c70={},_0x3231bb={'count':0x0,'rows':[]};var _0x249aa8=_[_0x1a75('0x36')](db[_0x1a75('0x37')][_0x1a75('0x38')],function(_0x68d610){return{'name':_0x68d610[_0x1a75('0x39')],'type':_0x68d610[_0x1a75('0x3a')][_0x1a75('0x3b')]};});_0x283c70['model']=_[_0x1a75('0x36')](_0x249aa8,'name');_0x283c70['query']=_[_0x1a75('0x3c')](_0x24ee8e[_0x1a75('0x3d')]);_0x283c70[_0x1a75('0x3e')]=_[_0x1a75('0x3f')](_0x283c70[_0x1a75('0x40')],_0x283c70['query']);_0x19ea6d[_0x1a75('0x41')]=_[_0x1a75('0x3f')](_0x283c70[_0x1a75('0x40')],qs[_0x1a75('0x42')](_0x24ee8e[_0x1a75('0x3d')]['fields']));_0x19ea6d[_0x1a75('0x41')]=_0x19ea6d['attributes'][_0x1a75('0x43')]?_0x19ea6d[_0x1a75('0x41')]:_0x283c70[_0x1a75('0x40')];if(!_0x24ee8e[_0x1a75('0x3d')][_0x1a75('0x44')](_0x1a75('0x45'))){_0x19ea6d[_0x1a75('0x2c')]=qs['limit'](_0x24ee8e['query'][_0x1a75('0x2c')]);_0x19ea6d['offset']=qs[_0x1a75('0x2b')](_0x24ee8e[_0x1a75('0x3d')][_0x1a75('0x2b')]);}_0x19ea6d['order']=qs[_0x1a75('0x46')](_0x24ee8e[_0x1a75('0x3d')][_0x1a75('0x46')]);_0x19ea6d['where']=qs[_0x1a75('0x3e')](_[_0x1a75('0x47')](_0x24ee8e[_0x1a75('0x3d')],_0x283c70[_0x1a75('0x3e')]),_0x249aa8);if(_0x24ee8e[_0x1a75('0x3d')][_0x1a75('0x48')]){_0x19ea6d[_0x1a75('0x49')]=_['merge'](_0x19ea6d[_0x1a75('0x49')],{'$or':_[_0x1a75('0x36')](_0x249aa8,function(_0x189f8b){if(_0x189f8b[_0x1a75('0x3a')]!==_0x1a75('0x4a')){var _0x4d7072={};_0x4d7072[_0x189f8b[_0x1a75('0x4b')]]={'$like':'%'+_0x24ee8e[_0x1a75('0x3d')]['filter']+'%'};return _0x4d7072;}})});}_0x19ea6d=_[_0x1a75('0x4c')]({},_0x19ea6d,_0x24ee8e['options']);var _0x3a2276={'where':_0x19ea6d['where']};return db[_0x1a75('0x37')][_0x1a75('0x2a')](_0x3a2276)[_0x1a75('0x1c')](function(_0x14d113){_0x3231bb[_0x1a75('0x2a')]=_0x14d113;if(_0x24ee8e[_0x1a75('0x3d')][_0x1a75('0x4d')]){_0x19ea6d['include']=[{'all':!![]}];}return db[_0x1a75('0x37')]['findAll'](_0x19ea6d);})[_0x1a75('0x1c')](function(_0x36ec71){_0x3231bb[_0x1a75('0x4e')]=_0x36ec71;return _0x3231bb;})[_0x1a75('0x1c')](respondWithFilteredResult(_0x3d170e,_0x19ea6d))[_0x1a75('0x26')](handleError(_0x3d170e,null));};exports[_0x1a75('0x4f')]=function(_0x2cfacf,_0xd0557f){var _0x545145={'raw':![],'where':{'id':_0x2cfacf[_0x1a75('0x50')]['id']}},_0x42ffae={};_0x42ffae[_0x1a75('0x40')]=_[_0x1a75('0x3c')](db[_0x1a75('0x37')][_0x1a75('0x38')]);_0x42ffae[_0x1a75('0x3d')]=_[_0x1a75('0x3c')](_0x2cfacf[_0x1a75('0x3d')]);_0x42ffae[_0x1a75('0x3e')]=_[_0x1a75('0x3f')](_0x42ffae[_0x1a75('0x40')],_0x42ffae[_0x1a75('0x3d')]);_0x545145[_0x1a75('0x41')]=_[_0x1a75('0x3f')](_0x42ffae['model'],qs[_0x1a75('0x42')](_0x2cfacf[_0x1a75('0x3d')][_0x1a75('0x42')]));_0x545145[_0x1a75('0x41')]=_0x545145[_0x1a75('0x41')][_0x1a75('0x43')]?_0x545145[_0x1a75('0x41')]:_0x42ffae[_0x1a75('0x40')];if(_0x2cfacf['query'][_0x1a75('0x4d')]){_0x545145['include']=[{'all':!![]}];}_0x545145=_[_0x1a75('0x4c')]({},_0x545145,_0x2cfacf[_0x1a75('0x51')]);return db[_0x1a75('0x37')]['find'](_0x545145)['then'](handleEntityNotFound(_0xd0557f,null))['then'](respondWithResult(_0xd0557f,null))[_0x1a75('0x26')](handleError(_0xd0557f,null));};exports[_0x1a75('0x52')]=function(_0x445117,_0x8bcb3){return db[_0x1a75('0x37')]['create'](_0x445117[_0x1a75('0x53')],{})[_0x1a75('0x1c')](respondWithResult(_0x8bcb3,0xc9))[_0x1a75('0x26')](handleError(_0x8bcb3,null));};exports[_0x1a75('0x54')]=function(_0x3bf218,_0x8fc015){if(_0x3bf218['body']['id']){delete _0x3bf218['body']['id'];}return db['ZendeskConfiguration'][_0x1a75('0x55')]({'where':{'id':_0x3bf218[_0x1a75('0x50')]['id']}})[_0x1a75('0x1c')](handleEntityNotFound(_0x8fc015,null))['then'](saveUpdates(_0x3bf218['body'],null))[_0x1a75('0x1c')](respondWithResult(_0x8fc015,null))[_0x1a75('0x26')](handleError(_0x8fc015,null));};exports['destroy']=function(_0x289e63,_0x595225){return db['ZendeskConfiguration'][_0x1a75('0x55')]({'where':{'id':_0x289e63[_0x1a75('0x50')]['id']}})['then'](handleEntityNotFound(_0x595225,null))[_0x1a75('0x1c')](removeEntity(_0x595225,null))[_0x1a75('0x26')](handleError(_0x595225,null));};exports['getFields']=function(_0x2bcb53,_0x3ecc0b,_0x2f77a0){var _0x4ae984={};var _0x2ebbd2={};var _0x597dd2;var _0x336b34;return db[_0x1a75('0x37')]['findOne']({'where':{'id':_0x2bcb53[_0x1a75('0x50')]['id']}})[_0x1a75('0x1c')](handleEntityNotFound(_0x3ecc0b,null))[_0x1a75('0x1c')](function(_0xa84deb){if(_0xa84deb){_0x597dd2=_0xa84deb;_0x2ebbd2['model']=_[_0x1a75('0x3c')](db[_0x1a75('0x56')]['rawAttributes']);_0x2ebbd2[_0x1a75('0x3d')]=_['keys'](_0x2bcb53[_0x1a75('0x3d')]);_0x2ebbd2[_0x1a75('0x3e')]=_['intersection'](_0x2ebbd2[_0x1a75('0x40')],_0x2ebbd2[_0x1a75('0x3d')]);_0x4ae984[_0x1a75('0x41')]=_[_0x1a75('0x3f')](_0x2ebbd2[_0x1a75('0x40')],qs[_0x1a75('0x42')](_0x2bcb53['query'][_0x1a75('0x42')]));_0x4ae984[_0x1a75('0x41')]=_0x4ae984[_0x1a75('0x41')][_0x1a75('0x43')]?_0x4ae984[_0x1a75('0x41')]:_0x2ebbd2[_0x1a75('0x40')];_0x4ae984[_0x1a75('0x57')]=qs['sort'](_0x2bcb53[_0x1a75('0x3d')]['sort']);_0x4ae984[_0x1a75('0x49')]=qs[_0x1a75('0x3e')](_['pick'](_0x2bcb53['query'],_0x2ebbd2['filters']));if(_0x2bcb53[_0x1a75('0x3d')][_0x1a75('0x48')]){_0x4ae984[_0x1a75('0x49')]=_[_0x1a75('0x4c')](_0x4ae984[_0x1a75('0x49')],{'$or':_[_0x1a75('0x36')](_0x4ae984[_0x1a75('0x41')],function(_0x4383e3){var _0x36f70={};_0x36f70[_0x4383e3]={'$like':'%'+_0x2bcb53[_0x1a75('0x3d')]['filter']+'%'};return _0x36f70;})});}_0x4ae984=_[_0x1a75('0x4c')]({},_0x4ae984,_0x2bcb53[_0x1a75('0x51')]);return _0x597dd2[_0x1a75('0x58')](_0x4ae984);}})[_0x1a75('0x1c')](function(_0x81f73b){if(_0x81f73b){_0x336b34=_0x81f73b[_0x1a75('0x43')];if(!_0x2bcb53[_0x1a75('0x3d')][_0x1a75('0x44')](_0x1a75('0x45'))){_0x4ae984[_0x1a75('0x2c')]=qs[_0x1a75('0x2c')](_0x2bcb53['query']['limit']);_0x4ae984['offset']=qs['offset'](_0x2bcb53[_0x1a75('0x3d')][_0x1a75('0x2b')]);}return _0x597dd2[_0x1a75('0x58')](_0x4ae984);}})[_0x1a75('0x1c')](function(_0x14b070){if(_0x14b070){return _0x14b070?{'count':_0x336b34,'rows':_0x14b070}:null;}})[_0x1a75('0x1c')](respondWithResult(_0x3ecc0b,null))['catch'](handleError(_0x3ecc0b,null));};exports[_0x1a75('0x59')]=function(_0x3f2a7d,_0x2dbb6f,_0x9e2ff){var _0x51639a={};var _0x3608ec={};var _0x4393b8;var _0x44d4ea;return db[_0x1a75('0x37')][_0x1a75('0x5a')]({'where':{'id':_0x3f2a7d[_0x1a75('0x50')]['id']}})['then'](handleEntityNotFound(_0x2dbb6f,null))[_0x1a75('0x1c')](function(_0x140716){if(_0x140716){_0x4393b8=_0x140716;_0x3608ec['model']=_[_0x1a75('0x3c')](db[_0x1a75('0x56')]['rawAttributes']);_0x3608ec[_0x1a75('0x3d')]=_[_0x1a75('0x3c')](_0x3f2a7d[_0x1a75('0x3d')]);_0x3608ec[_0x1a75('0x3e')]=_[_0x1a75('0x3f')](_0x3608ec[_0x1a75('0x40')],_0x3608ec[_0x1a75('0x3d')]);_0x51639a['attributes']=_[_0x1a75('0x3f')](_0x3608ec[_0x1a75('0x40')],qs[_0x1a75('0x42')](_0x3f2a7d[_0x1a75('0x3d')][_0x1a75('0x42')]));_0x51639a[_0x1a75('0x41')]=_0x51639a['attributes']['length']?_0x51639a['attributes']:_0x3608ec[_0x1a75('0x40')];_0x51639a['order']=qs[_0x1a75('0x46')](_0x3f2a7d['query'][_0x1a75('0x46')]);_0x51639a[_0x1a75('0x49')]=qs[_0x1a75('0x3e')](_[_0x1a75('0x47')](_0x3f2a7d['query'],_0x3608ec[_0x1a75('0x3e')]));if(_0x3f2a7d[_0x1a75('0x3d')][_0x1a75('0x48')]){_0x51639a[_0x1a75('0x49')]=_[_0x1a75('0x4c')](_0x51639a[_0x1a75('0x49')],{'$or':_[_0x1a75('0x36')](_0x51639a[_0x1a75('0x41')],function(_0x36c5e9){var _0x28658f={};_0x28658f[_0x36c5e9]={'$like':'%'+_0x3f2a7d[_0x1a75('0x3d')][_0x1a75('0x48')]+'%'};return _0x28658f;})});}_0x51639a=_[_0x1a75('0x4c')]({},_0x51639a,_0x3f2a7d['options']);return _0x4393b8[_0x1a75('0x59')](_0x51639a);}})['then'](function(_0x42109d){if(_0x42109d){_0x44d4ea=_0x42109d[_0x1a75('0x43')];if(!_0x3f2a7d[_0x1a75('0x3d')][_0x1a75('0x44')](_0x1a75('0x45'))){_0x51639a[_0x1a75('0x2c')]=qs[_0x1a75('0x2c')](_0x3f2a7d[_0x1a75('0x3d')][_0x1a75('0x2c')]);_0x51639a[_0x1a75('0x2b')]=qs['offset'](_0x3f2a7d[_0x1a75('0x3d')][_0x1a75('0x2b')]);}return _0x4393b8['getSubjects'](_0x51639a);}})[_0x1a75('0x1c')](function(_0x469de1){if(_0x469de1){return _0x469de1?{'count':_0x44d4ea,'rows':_0x469de1}:null;}})['then'](respondWithResult(_0x2dbb6f,null))[_0x1a75('0x26')](handleError(_0x2dbb6f,null));};exports[_0x1a75('0x5b')]=function(_0x1de2a3,_0x53c8eb,_0x32cb9f){var _0xd063a8={};var _0x458dce={};var _0x2b2ce1;var _0x307dce;return db[_0x1a75('0x37')]['findOne']({'where':{'id':_0x1de2a3['params']['id']}})[_0x1a75('0x1c')](handleEntityNotFound(_0x53c8eb,null))[_0x1a75('0x1c')](function(_0x249301){if(_0x249301){_0x2b2ce1=_0x249301;_0x458dce[_0x1a75('0x40')]=_[_0x1a75('0x3c')](db[_0x1a75('0x56')][_0x1a75('0x38')]);_0x458dce[_0x1a75('0x3d')]=_[_0x1a75('0x3c')](_0x1de2a3[_0x1a75('0x3d')]);_0x458dce[_0x1a75('0x3e')]=_[_0x1a75('0x3f')](_0x458dce[_0x1a75('0x40')],_0x458dce[_0x1a75('0x3d')]);_0xd063a8['attributes']=_[_0x1a75('0x3f')](_0x458dce[_0x1a75('0x40')],qs[_0x1a75('0x42')](_0x1de2a3[_0x1a75('0x3d')][_0x1a75('0x42')]));_0xd063a8['attributes']=_0xd063a8['attributes']['length']?_0xd063a8[_0x1a75('0x41')]:_0x458dce['model'];_0xd063a8[_0x1a75('0x57')]=qs[_0x1a75('0x46')](_0x1de2a3[_0x1a75('0x3d')]['sort']);_0xd063a8[_0x1a75('0x49')]=qs[_0x1a75('0x3e')](_['pick'](_0x1de2a3[_0x1a75('0x3d')],_0x458dce['filters']));if(_0x1de2a3[_0x1a75('0x3d')]['filter']){_0xd063a8['where']=_[_0x1a75('0x4c')](_0xd063a8[_0x1a75('0x49')],{'$or':_[_0x1a75('0x36')](_0xd063a8[_0x1a75('0x41')],function(_0x43c0df){var _0x5d9cae={};_0x5d9cae[_0x43c0df]={'$like':'%'+_0x1de2a3[_0x1a75('0x3d')][_0x1a75('0x48')]+'%'};return _0x5d9cae;})});}_0xd063a8=_[_0x1a75('0x4c')]({},_0xd063a8,_0x1de2a3[_0x1a75('0x51')]);return _0x2b2ce1[_0x1a75('0x5b')](_0xd063a8);}})[_0x1a75('0x1c')](function(_0x1084fc){if(_0x1084fc){_0x307dce=_0x1084fc[_0x1a75('0x43')];if(!_0x1de2a3[_0x1a75('0x3d')]['hasOwnProperty']('nolimit')){_0xd063a8['limit']=qs[_0x1a75('0x2c')](_0x1de2a3[_0x1a75('0x3d')][_0x1a75('0x2c')]);_0xd063a8[_0x1a75('0x2b')]=qs['offset'](_0x1de2a3[_0x1a75('0x3d')][_0x1a75('0x2b')]);}return _0x2b2ce1['getDescriptions'](_0xd063a8);}})[_0x1a75('0x1c')](function(_0x1ee58a){if(_0x1ee58a){return _0x1ee58a?{'count':_0x307dce,'rows':_0x1ee58a}:null;}})[_0x1a75('0x1c')](respondWithResult(_0x53c8eb,null))[_0x1a75('0x26')](handleError(_0x53c8eb,null));};exports[_0x1a75('0x5c')]=function(_0x4d5753,_0x7349a8,_0x43ec5e){var _0x57e681={};var _0x283cb1={};var _0x28f45d;var _0x13aa5a;return db[_0x1a75('0x37')][_0x1a75('0x5a')]({'where':{'id':_0x4d5753[_0x1a75('0x50')]['id']}})[_0x1a75('0x1c')](handleEntityNotFound(_0x7349a8,null))[_0x1a75('0x1c')](function(_0x23d9d7){if(_0x23d9d7){_0x28f45d=_0x23d9d7;_0x283cb1['model']=_[_0x1a75('0x3c')](db[_0x1a75('0x5d')][_0x1a75('0x38')]);_0x283cb1[_0x1a75('0x3d')]=_[_0x1a75('0x3c')](_0x4d5753[_0x1a75('0x3d')]);_0x283cb1['filters']=_[_0x1a75('0x3f')](_0x283cb1[_0x1a75('0x40')],_0x283cb1[_0x1a75('0x3d')]);_0x57e681[_0x1a75('0x41')]=_['intersection'](_0x283cb1[_0x1a75('0x40')],qs[_0x1a75('0x42')](_0x4d5753[_0x1a75('0x3d')][_0x1a75('0x42')]));_0x57e681[_0x1a75('0x41')]=_0x57e681[_0x1a75('0x41')][_0x1a75('0x43')]?_0x57e681[_0x1a75('0x41')]:_0x283cb1[_0x1a75('0x40')];_0x57e681['order']=qs['sort'](_0x4d5753[_0x1a75('0x3d')][_0x1a75('0x46')]);_0x57e681[_0x1a75('0x49')]=qs[_0x1a75('0x3e')](_['pick'](_0x4d5753[_0x1a75('0x3d')],_0x283cb1[_0x1a75('0x3e')]));if(_0x4d5753[_0x1a75('0x3d')][_0x1a75('0x48')]){_0x57e681[_0x1a75('0x49')]=_[_0x1a75('0x4c')](_0x57e681[_0x1a75('0x49')],{'$or':_[_0x1a75('0x36')](_0x57e681[_0x1a75('0x41')],function(_0x46cef7){var _0x3df3c9={};_0x3df3c9[_0x46cef7]={'$like':'%'+_0x4d5753[_0x1a75('0x3d')][_0x1a75('0x48')]+'%'};return _0x3df3c9;})});}_0x57e681=_[_0x1a75('0x4c')]({},_0x57e681,_0x4d5753[_0x1a75('0x51')]);return _0x28f45d['getTags'](_0x57e681);}})['then'](function(_0x1dd0b8){if(_0x1dd0b8){_0x13aa5a=_0x1dd0b8[_0x1a75('0x43')];if(!_0x4d5753['query'][_0x1a75('0x44')](_0x1a75('0x45'))){_0x57e681['limit']=qs[_0x1a75('0x2c')](_0x4d5753[_0x1a75('0x3d')][_0x1a75('0x2c')]);_0x57e681['offset']=qs[_0x1a75('0x2b')](_0x4d5753['query'][_0x1a75('0x2b')]);}return _0x28f45d[_0x1a75('0x5c')](_0x57e681);}})[_0x1a75('0x1c')](function(_0x30843a){if(_0x30843a){return _0x30843a?{'count':_0x13aa5a,'rows':_0x30843a}:null;}})[_0x1a75('0x1c')](respondWithResult(_0x7349a8,null))[_0x1a75('0x26')](handleError(_0x7349a8,null));};exports[_0x1a75('0x5e')]=function(_0x41861f,_0x7d7ba2,_0x16c87c){if(_0x41861f[_0x1a75('0x53')]['id']){delete _0x41861f[_0x1a75('0x53')]['id'];}return db[_0x1a75('0x37')][_0x1a75('0x5a')]({'where':{'id':_0x41861f[_0x1a75('0x50')]['id']}})['then'](handleEntityNotFound(_0x7d7ba2,null))[_0x1a75('0x1c')](function(_0x1b1c06){if(_0x1b1c06){return _0x1b1c06[_0x1a75('0x5e')](_0x41861f['body']['ids']||[]);}return null;})['then'](respondWithResult(_0x7d7ba2,null))[_0x1a75('0x26')](handleError(_0x7d7ba2,null));}; \ No newline at end of file +var _0x3baf=['status','json','offset','limit','set','Content-Range','apply','save','update','destroy','end','name','send','index','map','ZendeskConfiguration','rawAttributes','type','key','query','keys','filters','intersection','fields','attributes','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','show','params','length','find','create','body','findOne','getFields','getSubjects','ZendeskField','getDescriptions','Tag','getTags','setTags','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus'];(function(_0x6a9790,_0x9ac899){var _0x82c768=function(_0x363193){while(--_0x363193){_0x6a9790['push'](_0x6a9790['shift']());}};_0x82c768(++_0x9ac899);}(_0x3baf,0xf7));var _0xf3ba=function(_0x20a070,_0x2f0ff9){_0x20a070=_0x20a070-0x0;var _0x433d80=_0x3baf[_0x20a070];return _0x433d80;};'use strict';var pdf=require(_0xf3ba('0x0'));var emlformat=require(_0xf3ba('0x1'));var rimraf=require(_0xf3ba('0x2'));var zipdir=require(_0xf3ba('0x3'));var jsonpatch=require(_0xf3ba('0x4'));var rp=require(_0xf3ba('0x5'));var moment=require(_0xf3ba('0x6'));var BPromise=require(_0xf3ba('0x7'));var Mustache=require(_0xf3ba('0x8'));var util=require(_0xf3ba('0x9'));var path=require(_0xf3ba('0xa'));var sox=require(_0xf3ba('0xb'));var csv=require(_0xf3ba('0xc'));var ejs=require(_0xf3ba('0xd'));var fs=require('fs');var fs_extra=require(_0xf3ba('0xe'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf3ba('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf3ba('0xc'));var querystring=require(_0xf3ba('0x10'));var Papa=require(_0xf3ba('0x11'));var Redis=require(_0xf3ba('0x12'));var authService=require(_0xf3ba('0x13'));var qs=require(_0xf3ba('0x14'));var as=require(_0xf3ba('0x15'));var hardwareService=require(_0xf3ba('0x16'));var logger=require(_0xf3ba('0x17'))(_0xf3ba('0x18'));var utils=require(_0xf3ba('0x19'));var config=require(_0xf3ba('0x1a'));var licenseUtil=require(_0xf3ba('0x1b'));var db=require(_0xf3ba('0x1c'))['db'];var jayson=require(_0xf3ba('0x1d'));var client=jayson[_0xf3ba('0x1e')][_0xf3ba('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3e44d6,_0x505b8d,_0x327675,_0x56816b){return new BPromise(function(_0x815037,_0x345fc9){var _0x4717be=_0x56816b||client;return _0x4717be[_0xf3ba('0x20')](_0x3e44d6,_0x327675)[_0xf3ba('0x21')](function(_0x53f848){logger[_0xf3ba('0x22')](_0xf3ba('0x23'),_0x505b8d,_0xf3ba('0x24'));logger['debug'](_0xf3ba('0x25'),_0x505b8d,_0xf3ba('0x24'),JSON[_0xf3ba('0x26')](_0x53f848));if(_0x53f848[_0xf3ba('0x27')]){if(_0x53f848['error'][_0xf3ba('0x28')]===0x1f4){logger[_0xf3ba('0x27')]('ZendeskConfiguration,\x20%s,\x20%s',_0x505b8d,_0x53f848['error'][_0xf3ba('0x29')]);return _0x345fc9(_0x53f848[_0xf3ba('0x27')][_0xf3ba('0x29')]);}logger['error'](_0xf3ba('0x23'),_0x505b8d,_0x53f848[_0xf3ba('0x27')][_0xf3ba('0x29')]);return _0x815037(_0x53f848[_0xf3ba('0x27')][_0xf3ba('0x29')]);}else{logger[_0xf3ba('0x22')](_0xf3ba('0x23'),_0x505b8d,'request\x20sent');_0x815037(_0x53f848['result']['message']);}})[_0xf3ba('0x2a')](function(_0x220588){logger[_0xf3ba('0x27')](_0xf3ba('0x23'),_0x505b8d,_0x220588);_0x345fc9(_0x220588);});});}function respondWithStatusCode(_0x2cc01a,_0x545ee1){_0x545ee1=_0x545ee1||0xcc;return function(_0x505560){if(_0x505560){return _0x2cc01a[_0xf3ba('0x2b')](_0x545ee1);}return _0x2cc01a[_0xf3ba('0x2c')](_0x545ee1)['end']();};}function respondWithResult(_0x1c9d6a,_0x37cba1){_0x37cba1=_0x37cba1||0xc8;return function(_0x59ce48){if(_0x59ce48){return _0x1c9d6a['status'](_0x37cba1)[_0xf3ba('0x2d')](_0x59ce48);}};}function respondWithFilteredResult(_0x7effa1,_0x5f1709){return function(_0x18a4fb){if(_0x18a4fb){var _0x318817=_0x18a4fb['count'],_0x15ac44=_0x5f1709['offset'],_0x5a880e=_0x5f1709[_0xf3ba('0x2e')]+_0x5f1709[_0xf3ba('0x2f')],_0x29ed57;if(_0x5a880e>=_0x318817){_0x5a880e=_0x318817;_0x29ed57=0xc8;}else{_0x29ed57=0xce;}_0x7effa1['status'](_0x29ed57);return _0x7effa1[_0xf3ba('0x30')](_0xf3ba('0x31'),_0x15ac44+'-'+_0x5a880e+'/'+_0x318817)['json'](_0x18a4fb);}return null;};}function patchUpdates(_0x57da3b){return function(_0x49f234){try{jsonpatch[_0xf3ba('0x32')](_0x49f234,_0x57da3b,!![]);}catch(_0x6423f){return BPromise['reject'](_0x6423f);}return _0x49f234[_0xf3ba('0x33')]();};}function saveUpdates(_0x5b2f0d,_0x48d81c){return function(_0x28dee0){if(_0x28dee0){return _0x28dee0[_0xf3ba('0x34')](_0x5b2f0d)[_0xf3ba('0x21')](function(_0x7af1e4){return _0x7af1e4;});}return null;};}function removeEntity(_0x1df823,_0xf1b77a){return function(_0x508d52){if(_0x508d52){return _0x508d52[_0xf3ba('0x35')]()['then'](function(){_0x1df823[_0xf3ba('0x2c')](0xcc)[_0xf3ba('0x36')]();});}};}function handleEntityNotFound(_0x5b8d31,_0x45a3bc){return function(_0x36b6a1){if(!_0x36b6a1){_0x5b8d31[_0xf3ba('0x2b')](0x194);}return _0x36b6a1;};}function handleError(_0xab4960,_0x4ba794){_0x4ba794=_0x4ba794||0x1f4;return function(_0x213112){logger['error'](_0x213112['stack']);if(_0x213112['name']){delete _0x213112[_0xf3ba('0x37')];}_0xab4960[_0xf3ba('0x2c')](_0x4ba794)[_0xf3ba('0x38')](_0x213112);};}exports[_0xf3ba('0x39')]=function(_0x3bab98,_0x55b29b){var _0x10fe3e={},_0x47f269={},_0x3a927e={'count':0x0,'rows':[]};var _0x4c5301=_[_0xf3ba('0x3a')](db[_0xf3ba('0x3b')][_0xf3ba('0x3c')],function(_0x1607a4){return{'name':_0x1607a4['fieldName'],'type':_0x1607a4[_0xf3ba('0x3d')][_0xf3ba('0x3e')]};});_0x47f269['model']=_[_0xf3ba('0x3a')](_0x4c5301,_0xf3ba('0x37'));_0x47f269[_0xf3ba('0x3f')]=_[_0xf3ba('0x40')](_0x3bab98[_0xf3ba('0x3f')]);_0x47f269[_0xf3ba('0x41')]=_[_0xf3ba('0x42')](_0x47f269['model'],_0x47f269[_0xf3ba('0x3f')]);_0x10fe3e['attributes']=_[_0xf3ba('0x42')](_0x47f269['model'],qs[_0xf3ba('0x43')](_0x3bab98[_0xf3ba('0x3f')][_0xf3ba('0x43')]));_0x10fe3e[_0xf3ba('0x44')]=_0x10fe3e[_0xf3ba('0x44')]['length']?_0x10fe3e['attributes']:_0x47f269[_0xf3ba('0x45')];if(!_0x3bab98[_0xf3ba('0x3f')][_0xf3ba('0x46')](_0xf3ba('0x47'))){_0x10fe3e[_0xf3ba('0x2f')]=qs[_0xf3ba('0x2f')](_0x3bab98['query'][_0xf3ba('0x2f')]);_0x10fe3e['offset']=qs[_0xf3ba('0x2e')](_0x3bab98[_0xf3ba('0x3f')][_0xf3ba('0x2e')]);}_0x10fe3e[_0xf3ba('0x48')]=qs[_0xf3ba('0x49')](_0x3bab98[_0xf3ba('0x3f')][_0xf3ba('0x49')]);_0x10fe3e[_0xf3ba('0x4a')]=qs['filters'](_[_0xf3ba('0x4b')](_0x3bab98[_0xf3ba('0x3f')],_0x47f269[_0xf3ba('0x41')]),_0x4c5301);if(_0x3bab98[_0xf3ba('0x3f')][_0xf3ba('0x4c')]){_0x10fe3e[_0xf3ba('0x4a')]=_[_0xf3ba('0x4d')](_0x10fe3e['where'],{'$or':_[_0xf3ba('0x3a')](_0x4c5301,function(_0x35481b){if(_0x35481b['type']!==_0xf3ba('0x4e')){var _0x451c64={};_0x451c64[_0x35481b[_0xf3ba('0x37')]]={'$like':'%'+_0x3bab98[_0xf3ba('0x3f')][_0xf3ba('0x4c')]+'%'};return _0x451c64;}})});}_0x10fe3e=_[_0xf3ba('0x4d')]({},_0x10fe3e,_0x3bab98[_0xf3ba('0x4f')]);var _0x166e69={'where':_0x10fe3e[_0xf3ba('0x4a')]};return db[_0xf3ba('0x3b')][_0xf3ba('0x50')](_0x166e69)[_0xf3ba('0x21')](function(_0x40c152){_0x3a927e[_0xf3ba('0x50')]=_0x40c152;if(_0x3bab98[_0xf3ba('0x3f')][_0xf3ba('0x51')]){_0x10fe3e[_0xf3ba('0x52')]=[{'all':!![]}];}return db[_0xf3ba('0x3b')]['findAll'](_0x10fe3e);})[_0xf3ba('0x21')](function(_0x1a0df2){_0x3a927e['rows']=_0x1a0df2;return _0x3a927e;})[_0xf3ba('0x21')](respondWithFilteredResult(_0x55b29b,_0x10fe3e))[_0xf3ba('0x2a')](handleError(_0x55b29b,null));};exports[_0xf3ba('0x53')]=function(_0x36f476,_0x52ef61){var _0x5d0e2a={'raw':![],'where':{'id':_0x36f476[_0xf3ba('0x54')]['id']}},_0x28ca9b={};_0x28ca9b[_0xf3ba('0x45')]=_[_0xf3ba('0x40')](db['ZendeskConfiguration'][_0xf3ba('0x3c')]);_0x28ca9b[_0xf3ba('0x3f')]=_[_0xf3ba('0x40')](_0x36f476['query']);_0x28ca9b[_0xf3ba('0x41')]=_[_0xf3ba('0x42')](_0x28ca9b[_0xf3ba('0x45')],_0x28ca9b[_0xf3ba('0x3f')]);_0x5d0e2a[_0xf3ba('0x44')]=_[_0xf3ba('0x42')](_0x28ca9b[_0xf3ba('0x45')],qs[_0xf3ba('0x43')](_0x36f476[_0xf3ba('0x3f')][_0xf3ba('0x43')]));_0x5d0e2a['attributes']=_0x5d0e2a[_0xf3ba('0x44')][_0xf3ba('0x55')]?_0x5d0e2a[_0xf3ba('0x44')]:_0x28ca9b[_0xf3ba('0x45')];if(_0x36f476['query'][_0xf3ba('0x51')]){_0x5d0e2a['include']=[{'all':!![]}];}_0x5d0e2a=_['merge']({},_0x5d0e2a,_0x36f476[_0xf3ba('0x4f')]);return db[_0xf3ba('0x3b')][_0xf3ba('0x56')](_0x5d0e2a)[_0xf3ba('0x21')](handleEntityNotFound(_0x52ef61,null))[_0xf3ba('0x21')](respondWithResult(_0x52ef61,null))[_0xf3ba('0x2a')](handleError(_0x52ef61,null));};exports[_0xf3ba('0x57')]=function(_0x787f73,_0x557fbd){return db[_0xf3ba('0x3b')][_0xf3ba('0x57')](_0x787f73[_0xf3ba('0x58')],{})[_0xf3ba('0x21')](respondWithResult(_0x557fbd,0xc9))['catch'](handleError(_0x557fbd,null));};exports['update']=function(_0x40548f,_0x31cd60){if(_0x40548f[_0xf3ba('0x58')]['id']){delete _0x40548f[_0xf3ba('0x58')]['id'];}return db[_0xf3ba('0x3b')]['find']({'where':{'id':_0x40548f[_0xf3ba('0x54')]['id']}})['then'](handleEntityNotFound(_0x31cd60,null))[_0xf3ba('0x21')](saveUpdates(_0x40548f['body'],null))[_0xf3ba('0x21')](respondWithResult(_0x31cd60,null))['catch'](handleError(_0x31cd60,null));};exports[_0xf3ba('0x35')]=function(_0x252936,_0x3f43db){return db[_0xf3ba('0x3b')][_0xf3ba('0x56')]({'where':{'id':_0x252936['params']['id']}})[_0xf3ba('0x21')](handleEntityNotFound(_0x3f43db,null))[_0xf3ba('0x21')](removeEntity(_0x3f43db,null))[_0xf3ba('0x2a')](handleError(_0x3f43db,null));};exports['getFields']=function(_0x2271cb,_0x553e9f,_0x1dde9f){var _0x14b7b1={};var _0x471f81={};var _0x21b9c6;var _0x3def85;return db[_0xf3ba('0x3b')][_0xf3ba('0x59')]({'where':{'id':_0x2271cb[_0xf3ba('0x54')]['id']}})[_0xf3ba('0x21')](handleEntityNotFound(_0x553e9f,null))[_0xf3ba('0x21')](function(_0x10cc72){if(_0x10cc72){_0x21b9c6=_0x10cc72;_0x471f81['model']=_[_0xf3ba('0x40')](db['ZendeskField'][_0xf3ba('0x3c')]);_0x471f81[_0xf3ba('0x3f')]=_[_0xf3ba('0x40')](_0x2271cb[_0xf3ba('0x3f')]);_0x471f81['filters']=_[_0xf3ba('0x42')](_0x471f81[_0xf3ba('0x45')],_0x471f81[_0xf3ba('0x3f')]);_0x14b7b1[_0xf3ba('0x44')]=_[_0xf3ba('0x42')](_0x471f81[_0xf3ba('0x45')],qs[_0xf3ba('0x43')](_0x2271cb[_0xf3ba('0x3f')][_0xf3ba('0x43')]));_0x14b7b1[_0xf3ba('0x44')]=_0x14b7b1['attributes']['length']?_0x14b7b1['attributes']:_0x471f81['model'];_0x14b7b1[_0xf3ba('0x48')]=qs[_0xf3ba('0x49')](_0x2271cb[_0xf3ba('0x3f')]['sort']);_0x14b7b1[_0xf3ba('0x4a')]=qs['filters'](_[_0xf3ba('0x4b')](_0x2271cb[_0xf3ba('0x3f')],_0x471f81['filters']));if(_0x2271cb['query'][_0xf3ba('0x4c')]){_0x14b7b1['where']=_[_0xf3ba('0x4d')](_0x14b7b1['where'],{'$or':_[_0xf3ba('0x3a')](_0x14b7b1[_0xf3ba('0x44')],function(_0xb3e3df){var _0x44b33f={};_0x44b33f[_0xb3e3df]={'$like':'%'+_0x2271cb['query'][_0xf3ba('0x4c')]+'%'};return _0x44b33f;})});}_0x14b7b1=_['merge']({},_0x14b7b1,_0x2271cb['options']);return _0x21b9c6[_0xf3ba('0x5a')](_0x14b7b1);}})[_0xf3ba('0x21')](function(_0x18b690){if(_0x18b690){_0x3def85=_0x18b690[_0xf3ba('0x55')];if(!_0x2271cb[_0xf3ba('0x3f')][_0xf3ba('0x46')]('nolimit')){_0x14b7b1[_0xf3ba('0x2f')]=qs[_0xf3ba('0x2f')](_0x2271cb[_0xf3ba('0x3f')]['limit']);_0x14b7b1[_0xf3ba('0x2e')]=qs[_0xf3ba('0x2e')](_0x2271cb[_0xf3ba('0x3f')][_0xf3ba('0x2e')]);}return _0x21b9c6['getFields'](_0x14b7b1);}})[_0xf3ba('0x21')](function(_0x21d2fd){if(_0x21d2fd){return _0x21d2fd?{'count':_0x3def85,'rows':_0x21d2fd}:null;}})[_0xf3ba('0x21')](respondWithResult(_0x553e9f,null))[_0xf3ba('0x2a')](handleError(_0x553e9f,null));};exports[_0xf3ba('0x5b')]=function(_0x5b964a,_0x25b0b7,_0x158814){var _0x2ae7cb={};var _0x1d5d2a={};var _0x33047b;var _0x33020b;return db[_0xf3ba('0x3b')][_0xf3ba('0x59')]({'where':{'id':_0x5b964a[_0xf3ba('0x54')]['id']}})[_0xf3ba('0x21')](handleEntityNotFound(_0x25b0b7,null))[_0xf3ba('0x21')](function(_0x2450c1){if(_0x2450c1){_0x33047b=_0x2450c1;_0x1d5d2a[_0xf3ba('0x45')]=_['keys'](db[_0xf3ba('0x5c')]['rawAttributes']);_0x1d5d2a[_0xf3ba('0x3f')]=_[_0xf3ba('0x40')](_0x5b964a[_0xf3ba('0x3f')]);_0x1d5d2a[_0xf3ba('0x41')]=_[_0xf3ba('0x42')](_0x1d5d2a[_0xf3ba('0x45')],_0x1d5d2a[_0xf3ba('0x3f')]);_0x2ae7cb[_0xf3ba('0x44')]=_['intersection'](_0x1d5d2a[_0xf3ba('0x45')],qs[_0xf3ba('0x43')](_0x5b964a[_0xf3ba('0x3f')]['fields']));_0x2ae7cb[_0xf3ba('0x44')]=_0x2ae7cb[_0xf3ba('0x44')][_0xf3ba('0x55')]?_0x2ae7cb[_0xf3ba('0x44')]:_0x1d5d2a[_0xf3ba('0x45')];_0x2ae7cb[_0xf3ba('0x48')]=qs[_0xf3ba('0x49')](_0x5b964a[_0xf3ba('0x3f')][_0xf3ba('0x49')]);_0x2ae7cb['where']=qs['filters'](_[_0xf3ba('0x4b')](_0x5b964a[_0xf3ba('0x3f')],_0x1d5d2a['filters']));if(_0x5b964a[_0xf3ba('0x3f')]['filter']){_0x2ae7cb[_0xf3ba('0x4a')]=_['merge'](_0x2ae7cb[_0xf3ba('0x4a')],{'$or':_[_0xf3ba('0x3a')](_0x2ae7cb['attributes'],function(_0x344bfb){var _0x57e5a6={};_0x57e5a6[_0x344bfb]={'$like':'%'+_0x5b964a[_0xf3ba('0x3f')][_0xf3ba('0x4c')]+'%'};return _0x57e5a6;})});}_0x2ae7cb=_[_0xf3ba('0x4d')]({},_0x2ae7cb,_0x5b964a[_0xf3ba('0x4f')]);return _0x33047b[_0xf3ba('0x5b')](_0x2ae7cb);}})[_0xf3ba('0x21')](function(_0x234a79){if(_0x234a79){_0x33020b=_0x234a79[_0xf3ba('0x55')];if(!_0x5b964a[_0xf3ba('0x3f')]['hasOwnProperty'](_0xf3ba('0x47'))){_0x2ae7cb[_0xf3ba('0x2f')]=qs[_0xf3ba('0x2f')](_0x5b964a[_0xf3ba('0x3f')][_0xf3ba('0x2f')]);_0x2ae7cb[_0xf3ba('0x2e')]=qs['offset'](_0x5b964a[_0xf3ba('0x3f')][_0xf3ba('0x2e')]);}return _0x33047b[_0xf3ba('0x5b')](_0x2ae7cb);}})['then'](function(_0xc30c62){if(_0xc30c62){return _0xc30c62?{'count':_0x33020b,'rows':_0xc30c62}:null;}})[_0xf3ba('0x21')](respondWithResult(_0x25b0b7,null))[_0xf3ba('0x2a')](handleError(_0x25b0b7,null));};exports[_0xf3ba('0x5d')]=function(_0x43f7b4,_0x388170,_0x5b3aef){var _0x1c7f94={};var _0x55c146={};var _0x560c1a;var _0x343e03;return db[_0xf3ba('0x3b')]['findOne']({'where':{'id':_0x43f7b4['params']['id']}})[_0xf3ba('0x21')](handleEntityNotFound(_0x388170,null))[_0xf3ba('0x21')](function(_0x385141){if(_0x385141){_0x560c1a=_0x385141;_0x55c146[_0xf3ba('0x45')]=_[_0xf3ba('0x40')](db[_0xf3ba('0x5c')][_0xf3ba('0x3c')]);_0x55c146['query']=_[_0xf3ba('0x40')](_0x43f7b4[_0xf3ba('0x3f')]);_0x55c146['filters']=_[_0xf3ba('0x42')](_0x55c146[_0xf3ba('0x45')],_0x55c146[_0xf3ba('0x3f')]);_0x1c7f94[_0xf3ba('0x44')]=_[_0xf3ba('0x42')](_0x55c146[_0xf3ba('0x45')],qs[_0xf3ba('0x43')](_0x43f7b4[_0xf3ba('0x3f')]['fields']));_0x1c7f94['attributes']=_0x1c7f94['attributes'][_0xf3ba('0x55')]?_0x1c7f94[_0xf3ba('0x44')]:_0x55c146['model'];_0x1c7f94['order']=qs['sort'](_0x43f7b4[_0xf3ba('0x3f')][_0xf3ba('0x49')]);_0x1c7f94['where']=qs[_0xf3ba('0x41')](_[_0xf3ba('0x4b')](_0x43f7b4[_0xf3ba('0x3f')],_0x55c146[_0xf3ba('0x41')]));if(_0x43f7b4[_0xf3ba('0x3f')][_0xf3ba('0x4c')]){_0x1c7f94[_0xf3ba('0x4a')]=_[_0xf3ba('0x4d')](_0x1c7f94[_0xf3ba('0x4a')],{'$or':_['map'](_0x1c7f94[_0xf3ba('0x44')],function(_0x9142b4){var _0x4ada9e={};_0x4ada9e[_0x9142b4]={'$like':'%'+_0x43f7b4[_0xf3ba('0x3f')][_0xf3ba('0x4c')]+'%'};return _0x4ada9e;})});}_0x1c7f94=_[_0xf3ba('0x4d')]({},_0x1c7f94,_0x43f7b4[_0xf3ba('0x4f')]);return _0x560c1a[_0xf3ba('0x5d')](_0x1c7f94);}})[_0xf3ba('0x21')](function(_0x44a342){if(_0x44a342){_0x343e03=_0x44a342[_0xf3ba('0x55')];if(!_0x43f7b4[_0xf3ba('0x3f')][_0xf3ba('0x46')](_0xf3ba('0x47'))){_0x1c7f94['limit']=qs[_0xf3ba('0x2f')](_0x43f7b4[_0xf3ba('0x3f')][_0xf3ba('0x2f')]);_0x1c7f94[_0xf3ba('0x2e')]=qs[_0xf3ba('0x2e')](_0x43f7b4[_0xf3ba('0x3f')]['offset']);}return _0x560c1a[_0xf3ba('0x5d')](_0x1c7f94);}})[_0xf3ba('0x21')](function(_0x69fec3){if(_0x69fec3){return _0x69fec3?{'count':_0x343e03,'rows':_0x69fec3}:null;}})[_0xf3ba('0x21')](respondWithResult(_0x388170,null))[_0xf3ba('0x2a')](handleError(_0x388170,null));};exports['getTags']=function(_0xa522f9,_0x46c4d8,_0x59df40){var _0xa74c81={};var _0x236868={};var _0x563ad1;var _0x88558e;return db[_0xf3ba('0x3b')]['findOne']({'where':{'id':_0xa522f9[_0xf3ba('0x54')]['id']}})[_0xf3ba('0x21')](handleEntityNotFound(_0x46c4d8,null))[_0xf3ba('0x21')](function(_0x3b9311){if(_0x3b9311){_0x563ad1=_0x3b9311;_0x236868['model']=_[_0xf3ba('0x40')](db[_0xf3ba('0x5e')][_0xf3ba('0x3c')]);_0x236868['query']=_[_0xf3ba('0x40')](_0xa522f9[_0xf3ba('0x3f')]);_0x236868[_0xf3ba('0x41')]=_[_0xf3ba('0x42')](_0x236868[_0xf3ba('0x45')],_0x236868[_0xf3ba('0x3f')]);_0xa74c81[_0xf3ba('0x44')]=_['intersection'](_0x236868['model'],qs[_0xf3ba('0x43')](_0xa522f9[_0xf3ba('0x3f')]['fields']));_0xa74c81['attributes']=_0xa74c81['attributes'][_0xf3ba('0x55')]?_0xa74c81[_0xf3ba('0x44')]:_0x236868['model'];_0xa74c81[_0xf3ba('0x48')]=qs[_0xf3ba('0x49')](_0xa522f9[_0xf3ba('0x3f')][_0xf3ba('0x49')]);_0xa74c81[_0xf3ba('0x4a')]=qs['filters'](_[_0xf3ba('0x4b')](_0xa522f9[_0xf3ba('0x3f')],_0x236868['filters']));if(_0xa522f9['query'][_0xf3ba('0x4c')]){_0xa74c81[_0xf3ba('0x4a')]=_[_0xf3ba('0x4d')](_0xa74c81[_0xf3ba('0x4a')],{'$or':_['map'](_0xa74c81[_0xf3ba('0x44')],function(_0x52f99d){var _0x49e0d7={};_0x49e0d7[_0x52f99d]={'$like':'%'+_0xa522f9['query']['filter']+'%'};return _0x49e0d7;})});}_0xa74c81=_[_0xf3ba('0x4d')]({},_0xa74c81,_0xa522f9[_0xf3ba('0x4f')]);return _0x563ad1[_0xf3ba('0x5f')](_0xa74c81);}})[_0xf3ba('0x21')](function(_0x3b3d36){if(_0x3b3d36){_0x88558e=_0x3b3d36[_0xf3ba('0x55')];if(!_0xa522f9['query'][_0xf3ba('0x46')]('nolimit')){_0xa74c81[_0xf3ba('0x2f')]=qs[_0xf3ba('0x2f')](_0xa522f9[_0xf3ba('0x3f')]['limit']);_0xa74c81[_0xf3ba('0x2e')]=qs[_0xf3ba('0x2e')](_0xa522f9['query'][_0xf3ba('0x2e')]);}return _0x563ad1[_0xf3ba('0x5f')](_0xa74c81);}})['then'](function(_0xb066){if(_0xb066){return _0xb066?{'count':_0x88558e,'rows':_0xb066}:null;}})[_0xf3ba('0x21')](respondWithResult(_0x46c4d8,null))[_0xf3ba('0x2a')](handleError(_0x46c4d8,null));};exports[_0xf3ba('0x60')]=function(_0x5b6965,_0xbb3e33,_0x21647a){if(_0x5b6965[_0xf3ba('0x58')]['id']){delete _0x5b6965[_0xf3ba('0x58')]['id'];}return db[_0xf3ba('0x3b')][_0xf3ba('0x59')]({'where':{'id':_0x5b6965['params']['id']}})['then'](handleEntityNotFound(_0xbb3e33,null))[_0xf3ba('0x21')](function(_0x2ee85e){if(_0x2ee85e){return _0x2ee85e[_0xf3ba('0x60')](_0x5b6965['body']['ids']||[]);}return null;})[_0xf3ba('0x21')](respondWithResult(_0xbb3e33,null))[_0xf3ba('0x2a')](handleError(_0xbb3e33,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index eebd622..e512272 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 _0xdb20=['bluebird','request-promise','path','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','lodash','moment'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xdb20,0x10c));var _0x0db2=function(_0x235651,_0x39ee30){_0x235651=_0x235651-0x0;var _0x5910d7=_0xdb20[_0x235651];return _0x5910d7;};'use strict';var _=require(_0x0db2('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0db2('0x1'));var BPromise=require(_0x0db2('0x2'));var rp=require(_0x0db2('0x3'));var fs=require('fs');var path=require(_0x0db2('0x4'));var rimraf=require('rimraf');var config=require(_0x0db2('0x5'));var attributes=require(_0x0db2('0x6'));module[_0x0db2('0x7')]=function(_0x5d802a,_0x14c0f3){return _0x5d802a[_0x0db2('0x8')](_0x0db2('0x9'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8bbf=['rimraf','exports','int_zendesk_configurations','lodash','api','moment','bluebird','request-promise','path'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x8bbf,0xc0));var _0xf8bb=function(_0x490418,_0x4c2852){_0x490418=_0x490418-0x0;var _0x4acba7=_0x8bbf[_0x490418];return _0x4acba7;};'use strict';var _=require(_0xf8bb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf8bb('0x1'));var moment=require(_0xf8bb('0x2'));var BPromise=require(_0xf8bb('0x3'));var rp=require(_0xf8bb('0x4'));var fs=require('fs');var path=require(_0xf8bb('0x5'));var rimraf=require(_0xf8bb('0x6'));var config=require('../../config/environment');var attributes=require('./intZendeskConfiguration.attributes');module[_0xf8bb('0x7')]=function(_0x5e633a,_0x1324b0){return _0x5e633a['define']('ZendeskConfiguration',attributes,{'tableName':_0xf8bb('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 26e61e2..c28159d 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 _0x8d90=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d90,0x10e));var _0x08d9=function(_0x1b2724,_0x105bca){_0x1b2724=_0x1b2724-0x0;var _0x56cc59=_0x8d90[_0x1b2724];return _0x56cc59;};'use strict';var _=require(_0x08d9('0x0'));var util=require(_0x08d9('0x1'));var moment=require(_0x08d9('0x2'));var BPromise=require(_0x08d9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x08d9('0x4'));var db=require(_0x08d9('0x5'))['db'];var utils=require(_0x08d9('0x6'));var logger=require('../../config/logger')(_0x08d9('0x7'));var config=require(_0x08d9('0x8'));var jayson=require(_0x08d9('0x9'));var client=jayson['client'][_0x08d9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x496cce,_0x261ade,_0xb44b28){return new BPromise(function(_0x53bfeb,_0x3cf4d2){return client[_0x08d9('0xb')](_0x496cce,_0xb44b28)[_0x08d9('0xc')](function(_0xd26bdb){logger[_0x08d9('0xd')](_0x08d9('0xe'),_0x261ade,_0x08d9('0xf'));logger[_0x08d9('0x10')](_0x08d9('0x11'),_0x261ade,_0x08d9('0xf'),JSON[_0x08d9('0x12')](_0xd26bdb));if(_0xd26bdb[_0x08d9('0x13')]){if(_0xd26bdb[_0x08d9('0x13')][_0x08d9('0x14')]===0x1f4){logger[_0x08d9('0x13')](_0x08d9('0xe'),_0x261ade,_0xd26bdb[_0x08d9('0x13')][_0x08d9('0x15')]);return _0x3cf4d2(_0xd26bdb[_0x08d9('0x13')]['message']);}logger[_0x08d9('0x13')](_0x08d9('0xe'),_0x261ade,_0xd26bdb[_0x08d9('0x13')][_0x08d9('0x15')]);return _0x53bfeb(_0xd26bdb[_0x08d9('0x13')][_0x08d9('0x15')]);}else{logger['info'](_0x08d9('0xe'),_0x261ade,'request\x20sent');_0x53bfeb(_0xd26bdb[_0x08d9('0x16')][_0x08d9('0x15')]);}})[_0x08d9('0x17')](function(_0xc285a9){logger[_0x08d9('0x13')](_0x08d9('0xe'),_0x261ade,_0xc285a9);_0x3cf4d2(_0xc285a9);});});} \ No newline at end of file +var _0x046b=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x1568f8,_0x359fdc){var _0x1f6812=function(_0x9022da){while(--_0x9022da){_0x1568f8['push'](_0x1568f8['shift']());}};_0x1f6812(++_0x359fdc);}(_0x046b,0x129));var _0xb046=function(_0x4f964a,_0x41f80b){_0x4f964a=_0x4f964a-0x0;var _0x22142b=_0x046b[_0x4f964a];return _0x22142b;};'use strict';var _=require(_0xb046('0x0'));var util=require('util');var moment=require(_0xb046('0x1'));var BPromise=require(_0xb046('0x2'));var rs=require(_0xb046('0x3'));var fs=require('fs');var Redis=require(_0xb046('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb046('0x5'))(_0xb046('0x6'));var config=require(_0xb046('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb046('0x8')][_0xb046('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe26075,_0xe45985,_0x4643b0){return new BPromise(function(_0x5ee8b2,_0x47fea5){return client[_0xb046('0xa')](_0xe26075,_0x4643b0)['then'](function(_0x55f702){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0xe45985,_0xb046('0xb'));logger[_0xb046('0xc')](_0xb046('0xd'),_0xe45985,_0xb046('0xb'),JSON[_0xb046('0xe')](_0x55f702));if(_0x55f702['error']){if(_0x55f702[_0xb046('0xf')][_0xb046('0x10')]===0x1f4){logger[_0xb046('0xf')](_0xb046('0x11'),_0xe45985,_0x55f702[_0xb046('0xf')][_0xb046('0x12')]);return _0x47fea5(_0x55f702[_0xb046('0xf')][_0xb046('0x12')]);}logger[_0xb046('0xf')](_0xb046('0x11'),_0xe45985,_0x55f702[_0xb046('0xf')][_0xb046('0x12')]);return _0x5ee8b2(_0x55f702[_0xb046('0xf')][_0xb046('0x12')]);}else{logger['info'](_0xb046('0x11'),_0xe45985,'request\x20sent');_0x5ee8b2(_0x55f702[_0xb046('0x13')]['message']);}})[_0xb046('0x14')](function(_0xdce3e6){logger[_0xb046('0xf')](_0xb046('0x11'),_0xe45985,_0xdce3e6);_0x47fea5(_0xdce3e6);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index bbd32c8..2086bf8 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 _0x5221=['update','delete','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x560e64,_0x3b0905){var _0x5a9701=function(_0x2d438b){while(--_0x2d438b){_0x560e64['push'](_0x560e64['shift']());}};_0x5a9701(++_0x3b0905);}(_0x5221,0x101));var _0x1522=function(_0x4e0236,_0x495afd){_0x4e0236=_0x4e0236-0x0;var _0x54056c=_0x5221[_0x4e0236];return _0x54056c;};'use strict';var multer=require('multer');var util=require(_0x1522('0x0'));var path=require(_0x1522('0x1'));var timeout=require(_0x1522('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1522('0x3'));var auth=require(_0x1522('0x4'));var interaction=require(_0x1522('0x5'));var config=require('../../config/environment');var controller=require(_0x1522('0x6'));router[_0x1522('0x7')]('/',auth[_0x1522('0x8')](),controller[_0x1522('0x9')]);router[_0x1522('0x7')](_0x1522('0xa'),auth['isAuthenticated'](),controller[_0x1522('0xb')]);router[_0x1522('0xc')]('/',auth[_0x1522('0x8')](),controller[_0x1522('0xd')]);router[_0x1522('0xe')](_0x1522('0xa'),auth[_0x1522('0x8')](),controller[_0x1522('0xf')]);router[_0x1522('0x10')](_0x1522('0xa'),auth[_0x1522('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfa53=['delete','exports','multer','connect-timeout','express','Router','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','put'];(function(_0x371145,_0x271b3d){var _0x583fae=function(_0x596df7){while(--_0x596df7){_0x371145['push'](_0x371145['shift']());}};_0x583fae(++_0x271b3d);}(_0xfa53,0x152));var _0x3fa5=function(_0x34f6f4,_0x80f33e){_0x34f6f4=_0x34f6f4-0x0;var _0x4b7d79=_0xfa53[_0x34f6f4];return _0x4b7d79;};'use strict';var multer=require(_0x3fa5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3fa5('0x1'));var express=require(_0x3fa5('0x2'));var router=express[_0x3fa5('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3fa5('0x4'));var controller=require(_0x3fa5('0x5'));router[_0x3fa5('0x6')]('/',auth[_0x3fa5('0x7')](),controller[_0x3fa5('0x8')]);router[_0x3fa5('0x6')](_0x3fa5('0x9'),auth[_0x3fa5('0x7')](),controller[_0x3fa5('0xa')]);router['post']('/',auth[_0x3fa5('0x7')](),controller['create']);router[_0x3fa5('0xb')](_0x3fa5('0x9'),auth[_0x3fa5('0x7')](),controller['update']);router[_0x3fa5('0xc')](_0x3fa5('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x3fa5('0xd')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index ba5ecb1..bc54a6a 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 _0x2750=['sequelize','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x158380,_0x522631){var _0x326d6f=function(_0x4db74a){while(--_0x4db74a){_0x158380['push'](_0x158380['shift']());}};_0x326d6f(++_0x522631);}(_0x2750,0x13b));var _0x0275=function(_0x45c7d7,_0x63a8c4){_0x45c7d7=_0x45c7d7-0x0;var _0x58726e=_0x2750[_0x45c7d7];return _0x58726e;};'use strict';var Sequelize=require(_0x0275('0x0'));module['exports']={'type':{'type':Sequelize[_0x0275('0x1')](_0x0275('0x2'),_0x0275('0x3'),_0x0275('0x4'),_0x0275('0x5'),_0x0275('0x6')),'defaultValue':_0x0275('0x2')},'content':{'type':Sequelize[_0x0275('0x7')]},'key':{'type':Sequelize[_0x0275('0x7')]},'keyType':{'type':Sequelize[_0x0275('0x1')]('string',_0x0275('0x3'),_0x0275('0x4'))},'keyContent':{'type':Sequelize[_0x0275('0x7')]},'idField':{'type':Sequelize[_0x0275('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0275('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0275('0x7')]}}; \ No newline at end of file +var _0xb66c=['customVariable','keyValue','string','STRING','BOOLEAN','sequelize','ENUM','variable'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xb66c,0x175));var _0xcb66=function(_0x49be7a,_0x569a87){_0x49be7a=_0x49be7a-0x0;var _0x18a404=_0xb66c[_0x49be7a];return _0x18a404;};'use strict';var Sequelize=require(_0xcb66('0x0'));module['exports']={'type':{'type':Sequelize[_0xcb66('0x1')]('string',_0xcb66('0x2'),_0xcb66('0x3'),_0xcb66('0x4'),'picklist'),'defaultValue':_0xcb66('0x5')},'content':{'type':Sequelize[_0xcb66('0x6')]},'key':{'type':Sequelize[_0xcb66('0x6')]},'keyType':{'type':Sequelize[_0xcb66('0x1')]('string','variable',_0xcb66('0x3'))},'keyContent':{'type':Sequelize[_0xcb66('0x6')]},'idField':{'type':Sequelize[_0xcb66('0x6')]},'nameField':{'type':Sequelize[_0xcb66('0x6')]},'customField':{'type':Sequelize[_0xcb66('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index f309101..d60a64a 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 _0x814b=['destroy','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','count','include','findAll','rows','catch','show','keys','includeAll','merge','options','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','reject','save','update','then'];(function(_0x32b132,_0x4e9042){var _0x11e8c5=function(_0x32e4bc){while(--_0x32e4bc){_0x32b132['push'](_0x32b132['shift']());}};_0x11e8c5(++_0x4e9042);}(_0x814b,0x1a2));var _0xb814=function(_0x53f897,_0x539857){_0x53f897=_0x53f897-0x0;var _0x6879f8=_0x814b[_0x53f897];return _0x6879f8;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb814('0xc'));var _=require(_0xb814('0xd'));var squel=require('squel');var crypto=require(_0xb814('0xe'));var jsforce=require(_0xb814('0xf'));var deskjs=require(_0xb814('0x10'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x11'));var Papa=require(_0xb814('0x12'));var Redis=require(_0xb814('0x13'));var authService=require(_0xb814('0x14'));var qs=require(_0xb814('0x15'));var as=require(_0xb814('0x16'));var hardwareService=require(_0xb814('0x17'));var logger=require('../../config/logger')(_0xb814('0x18'));var utils=require('../../config/utils');var config=require(_0xb814('0x19'));var licenseUtil=require(_0xb814('0x1a'));var db=require(_0xb814('0x1b'))['db'];function respondWithStatusCode(_0x2cc46b,_0x2ce718){_0x2ce718=_0x2ce718||0xcc;return function(_0x3bde14){if(_0x3bde14){return _0x2cc46b[_0xb814('0x1c')](_0x2ce718);}return _0x2cc46b[_0xb814('0x1d')](_0x2ce718)[_0xb814('0x1e')]();};}function respondWithResult(_0x2ab627,_0x3f4881){_0x3f4881=_0x3f4881||0xc8;return function(_0x44fb96){if(_0x44fb96){return _0x2ab627[_0xb814('0x1d')](_0x3f4881)[_0xb814('0x1f')](_0x44fb96);}};}function respondWithFilteredResult(_0x303aca,_0x3a71d6){return function(_0x45e0d0){if(_0x45e0d0){var _0x265a83=_0x45e0d0['count'],_0x125ce2=_0x3a71d6[_0xb814('0x20')],_0x21b73f=_0x3a71d6['offset']+_0x3a71d6[_0xb814('0x21')],_0x7a21ef;if(_0x21b73f>=_0x265a83){_0x21b73f=_0x265a83;_0x7a21ef=0xc8;}else{_0x7a21ef=0xce;}_0x303aca[_0xb814('0x1d')](_0x7a21ef);return _0x303aca['set']('Content-Range',_0x125ce2+'-'+_0x21b73f+'/'+_0x265a83)['json'](_0x45e0d0);}return null;};}function patchUpdates(_0x399b43){return function(_0x4d5276){try{jsonpatch['apply'](_0x4d5276,_0x399b43,!![]);}catch(_0xb684ea){return BPromise[_0xb814('0x22')](_0xb684ea);}return _0x4d5276[_0xb814('0x23')]();};}function saveUpdates(_0x4e139e,_0xf5b8aa){return function(_0x531032){if(_0x531032){return _0x531032[_0xb814('0x24')](_0x4e139e)[_0xb814('0x25')](function(_0x3b267e){return _0x3b267e;});}return null;};}function removeEntity(_0x470e81,_0x27352e){return function(_0x2bd039){if(_0x2bd039){return _0x2bd039[_0xb814('0x26')]()['then'](function(){_0x470e81[_0xb814('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f81d0,_0x457dac){return function(_0x31c7ec){if(!_0x31c7ec){_0x3f81d0[_0xb814('0x1c')](0x194);}return _0x31c7ec;};}function handleError(_0x1c8a2e,_0xb9e57d){_0xb9e57d=_0xb9e57d||0x1f4;return function(_0x3d836c){logger['error'](_0x3d836c[_0xb814('0x27')]);if(_0x3d836c[_0xb814('0x28')]){delete _0x3d836c[_0xb814('0x28')];}_0x1c8a2e[_0xb814('0x1d')](_0xb9e57d)[_0xb814('0x29')](_0x3d836c);};}exports[_0xb814('0x2a')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291={},_0x271aa8={},_0x328a08={'count':0x0,'rows':[]};var _0x52ed64=_[_0xb814('0x2b')](db[_0xb814('0x2c')][_0xb814('0x2d')],function(_0x499f22){return{'name':_0x499f22[_0xb814('0x2e')],'type':_0x499f22[_0xb814('0x2f')]['key']};});_0x271aa8[_0xb814('0x30')]=_['map'](_0x52ed64,_0xb814('0x28'));_0x271aa8['query']=_['keys'](_0x3f0150[_0xb814('0x31')]);_0x271aa8['filters']=_[_0xb814('0x32')](_0x271aa8[_0xb814('0x30')],_0x271aa8[_0xb814('0x31')]);_0x5a6291['attributes']=_['intersection'](_0x271aa8[_0xb814('0x30')],qs[_0xb814('0x33')](_0x3f0150['query'][_0xb814('0x33')]));_0x5a6291[_0xb814('0x34')]=_0x5a6291[_0xb814('0x34')][_0xb814('0x35')]?_0x5a6291[_0xb814('0x34')]:_0x271aa8[_0xb814('0x30')];if(!_0x3f0150[_0xb814('0x31')]['hasOwnProperty'](_0xb814('0x36'))){_0x5a6291[_0xb814('0x21')]=qs[_0xb814('0x21')](_0x3f0150[_0xb814('0x31')][_0xb814('0x21')]);_0x5a6291['offset']=qs[_0xb814('0x20')](_0x3f0150['query'][_0xb814('0x20')]);}_0x5a6291[_0xb814('0x37')]=qs[_0xb814('0x38')](_0x3f0150['query'][_0xb814('0x38')]);_0x5a6291[_0xb814('0x39')]=qs['filters'](_[_0xb814('0x3a')](_0x3f0150[_0xb814('0x31')],_0x271aa8[_0xb814('0x3b')]),_0x52ed64);if(_0x3f0150[_0xb814('0x31')][_0xb814('0x3c')]){_0x5a6291[_0xb814('0x39')]=_['merge'](_0x5a6291[_0xb814('0x39')],{'$or':_['map'](_0x52ed64,function(_0x2aaf1c){if(_0x2aaf1c['type']!==_0xb814('0x3d')){var _0x4b9233={};_0x4b9233[_0x2aaf1c[_0xb814('0x28')]]={'$like':'%'+_0x3f0150[_0xb814('0x31')]['filter']+'%'};return _0x4b9233;}})});}_0x5a6291=_['merge']({},_0x5a6291,_0x3f0150['options']);var _0x57b379={'where':_0x5a6291[_0xb814('0x39')]};return db[_0xb814('0x2c')][_0xb814('0x3e')](_0x57b379)[_0xb814('0x25')](function(_0x51cdba){_0x328a08['count']=_0x51cdba;if(_0x3f0150[_0xb814('0x31')]['includeAll']){_0x5a6291[_0xb814('0x3f')]=[{'all':!![]}];}return db[_0xb814('0x2c')][_0xb814('0x40')](_0x5a6291);})[_0xb814('0x25')](function(_0x42653f){_0x328a08[_0xb814('0x41')]=_0x42653f;return _0x328a08;})[_0xb814('0x25')](respondWithFilteredResult(_0x1e4e89,_0x5a6291))[_0xb814('0x42')](handleError(_0x1e4e89,null));};exports[_0xb814('0x43')]=function(_0x4b6ff8,_0x544d36){var _0x5d26be={'raw':!![],'where':{'id':_0x4b6ff8['params']['id']}},_0x56d9d1={};_0x56d9d1[_0xb814('0x30')]=_['keys'](db[_0xb814('0x2c')][_0xb814('0x2d')]);_0x56d9d1[_0xb814('0x31')]=_[_0xb814('0x44')](_0x4b6ff8['query']);_0x56d9d1[_0xb814('0x3b')]=_[_0xb814('0x32')](_0x56d9d1[_0xb814('0x30')],_0x56d9d1[_0xb814('0x31')]);_0x5d26be[_0xb814('0x34')]=_[_0xb814('0x32')](_0x56d9d1['model'],qs[_0xb814('0x33')](_0x4b6ff8[_0xb814('0x31')][_0xb814('0x33')]));_0x5d26be[_0xb814('0x34')]=_0x5d26be[_0xb814('0x34')][_0xb814('0x35')]?_0x5d26be[_0xb814('0x34')]:_0x56d9d1['model'];if(_0x4b6ff8['query'][_0xb814('0x45')]){_0x5d26be[_0xb814('0x3f')]=[{'all':!![]}];}_0x5d26be=_[_0xb814('0x46')]({},_0x5d26be,_0x4b6ff8[_0xb814('0x47')]);return db[_0xb814('0x2c')][_0xb814('0x48')](_0x5d26be)[_0xb814('0x25')](handleEntityNotFound(_0x544d36,null))[_0xb814('0x25')](respondWithResult(_0x544d36,null))[_0xb814('0x42')](handleError(_0x544d36,null));};exports[_0xb814('0x49')]=function(_0xe73300,_0x5c7a49){return db[_0xb814('0x2c')][_0xb814('0x49')](_0xe73300['body'],{})[_0xb814('0x25')](respondWithResult(_0x5c7a49,0xc9))['catch'](handleError(_0x5c7a49,null));};exports[_0xb814('0x24')]=function(_0x37866f,_0xc71270){if(_0x37866f[_0xb814('0x4a')]['id']){delete _0x37866f[_0xb814('0x4a')]['id'];}return db[_0xb814('0x2c')][_0xb814('0x48')]({'where':{'id':_0x37866f[_0xb814('0x4b')]['id']}})[_0xb814('0x25')](handleEntityNotFound(_0xc71270,null))[_0xb814('0x25')](saveUpdates(_0x37866f['body'],null))['then'](respondWithResult(_0xc71270,null))[_0xb814('0x42')](handleError(_0xc71270,null));};exports[_0xb814('0x26')]=function(_0x4156d8,_0x3f8e29){return db[_0xb814('0x2c')][_0xb814('0x48')]({'where':{'id':_0x4156d8[_0xb814('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3f8e29,null))[_0xb814('0x25')](removeEntity(_0x3f8e29,null))[_0xb814('0x42')](handleError(_0x3f8e29,null));}; \ No newline at end of file +var _0x7217=['rawAttributes','type','key','query','filters','intersection','attributes','model','fields','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','body','catch','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','ZendeskField'];(function(_0x44258c,_0x219b1b){var _0x86cb97=function(_0x2b5d0c){while(--_0x2b5d0c){_0x44258c['push'](_0x44258c['shift']());}};_0x86cb97(++_0x219b1b);}(_0x7217,0x19e));var _0x7721=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x7217[_0x4154a6];return _0x3b2786;};'use strict';var pdf=require(_0x7721('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7721('0x1'));var zipdir=require(_0x7721('0x2'));var jsonpatch=require(_0x7721('0x3'));var rp=require(_0x7721('0x4'));var moment=require(_0x7721('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7721('0x6'));var path=require(_0x7721('0x7'));var sox=require(_0x7721('0x8'));var csv=require(_0x7721('0x9'));var ejs=require(_0x7721('0xa'));var fs=require('fs');var fs_extra=require(_0x7721('0xb'));var _=require(_0x7721('0xc'));var squel=require(_0x7721('0xd'));var crypto=require(_0x7721('0xe'));var jsforce=require(_0x7721('0xf'));var deskjs=require(_0x7721('0x10'));var toCsv=require(_0x7721('0x9'));var querystring=require(_0x7721('0x11'));var Papa=require(_0x7721('0x12'));var Redis=require(_0x7721('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7721('0x14'));var as=require(_0x7721('0x15'));var hardwareService=require(_0x7721('0x16'));var logger=require(_0x7721('0x17'))(_0x7721('0x18'));var utils=require(_0x7721('0x19'));var config=require(_0x7721('0x1a'));var licenseUtil=require(_0x7721('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2911ec,_0x199930){_0x199930=_0x199930||0xcc;return function(_0x57ff6d){if(_0x57ff6d){return _0x2911ec[_0x7721('0x1c')](_0x199930);}return _0x2911ec[_0x7721('0x1d')](_0x199930)[_0x7721('0x1e')]();};}function respondWithResult(_0x2e9752,_0x5069da){_0x5069da=_0x5069da||0xc8;return function(_0x3cbce8){if(_0x3cbce8){return _0x2e9752[_0x7721('0x1d')](_0x5069da)['json'](_0x3cbce8);}};}function respondWithFilteredResult(_0x4e199a,_0x4b183e){return function(_0x5ed54){if(_0x5ed54){var _0x25a628=_0x5ed54[_0x7721('0x1f')],_0x3cc909=_0x4b183e['offset'],_0x32550d=_0x4b183e[_0x7721('0x20')]+_0x4b183e['limit'],_0x5ed94b;if(_0x32550d>=_0x25a628){_0x32550d=_0x25a628;_0x5ed94b=0xc8;}else{_0x5ed94b=0xce;}_0x4e199a[_0x7721('0x1d')](_0x5ed94b);return _0x4e199a[_0x7721('0x21')](_0x7721('0x22'),_0x3cc909+'-'+_0x32550d+'/'+_0x25a628)[_0x7721('0x23')](_0x5ed54);}return null;};}function patchUpdates(_0x2286e5){return function(_0x40af90){try{jsonpatch[_0x7721('0x24')](_0x40af90,_0x2286e5,!![]);}catch(_0x413263){return BPromise[_0x7721('0x25')](_0x413263);}return _0x40af90[_0x7721('0x26')]();};}function saveUpdates(_0x4ce1db,_0x288f7e){return function(_0x2c1583){if(_0x2c1583){return _0x2c1583[_0x7721('0x27')](_0x4ce1db)[_0x7721('0x28')](function(_0x57140c){return _0x57140c;});}return null;};}function removeEntity(_0x28f5a6,_0x512f31){return function(_0xb9e9dd){if(_0xb9e9dd){return _0xb9e9dd[_0x7721('0x29')]()[_0x7721('0x28')](function(){_0x28f5a6[_0x7721('0x1d')](0xcc)[_0x7721('0x1e')]();});}};}function handleEntityNotFound(_0x395b15,_0x2c6b7b){return function(_0x5b4d74){if(!_0x5b4d74){_0x395b15[_0x7721('0x1c')](0x194);}return _0x5b4d74;};}function handleError(_0x1abedb,_0x125564){_0x125564=_0x125564||0x1f4;return function(_0x1f67c7){logger[_0x7721('0x2a')](_0x1f67c7[_0x7721('0x2b')]);if(_0x1f67c7[_0x7721('0x2c')]){delete _0x1f67c7[_0x7721('0x2c')];}_0x1abedb[_0x7721('0x1d')](_0x125564)['send'](_0x1f67c7);};}exports[_0x7721('0x2d')]=function(_0x5b0551,_0x499b87){var _0x315202={},_0x343c19={},_0x53c904={'count':0x0,'rows':[]};var _0x158d98=_[_0x7721('0x2e')](db[_0x7721('0x2f')][_0x7721('0x30')],function(_0x1da2d8){return{'name':_0x1da2d8['fieldName'],'type':_0x1da2d8[_0x7721('0x31')][_0x7721('0x32')]};});_0x343c19['model']=_['map'](_0x158d98,_0x7721('0x2c'));_0x343c19[_0x7721('0x33')]=_['keys'](_0x5b0551[_0x7721('0x33')]);_0x343c19[_0x7721('0x34')]=_[_0x7721('0x35')](_0x343c19['model'],_0x343c19[_0x7721('0x33')]);_0x315202[_0x7721('0x36')]=_[_0x7721('0x35')](_0x343c19[_0x7721('0x37')],qs[_0x7721('0x38')](_0x5b0551['query'][_0x7721('0x38')]));_0x315202[_0x7721('0x36')]=_0x315202[_0x7721('0x36')]['length']?_0x315202[_0x7721('0x36')]:_0x343c19[_0x7721('0x37')];if(!_0x5b0551['query'][_0x7721('0x39')]('nolimit')){_0x315202[_0x7721('0x3a')]=qs[_0x7721('0x3a')](_0x5b0551[_0x7721('0x33')][_0x7721('0x3a')]);_0x315202[_0x7721('0x20')]=qs[_0x7721('0x20')](_0x5b0551[_0x7721('0x33')][_0x7721('0x20')]);}_0x315202[_0x7721('0x3b')]=qs[_0x7721('0x3c')](_0x5b0551[_0x7721('0x33')]['sort']);_0x315202[_0x7721('0x3d')]=qs['filters'](_[_0x7721('0x3e')](_0x5b0551[_0x7721('0x33')],_0x343c19[_0x7721('0x34')]),_0x158d98);if(_0x5b0551[_0x7721('0x33')][_0x7721('0x3f')]){_0x315202[_0x7721('0x3d')]=_['merge'](_0x315202['where'],{'$or':_['map'](_0x158d98,function(_0x539560){if(_0x539560[_0x7721('0x31')]!==_0x7721('0x40')){var _0x1acc72={};_0x1acc72[_0x539560[_0x7721('0x2c')]]={'$like':'%'+_0x5b0551['query'][_0x7721('0x3f')]+'%'};return _0x1acc72;}})});}_0x315202=_['merge']({},_0x315202,_0x5b0551[_0x7721('0x41')]);var _0x11f356={'where':_0x315202['where']};return db[_0x7721('0x2f')][_0x7721('0x1f')](_0x11f356)['then'](function(_0x4d0111){_0x53c904[_0x7721('0x1f')]=_0x4d0111;if(_0x5b0551[_0x7721('0x33')][_0x7721('0x42')]){_0x315202[_0x7721('0x43')]=[{'all':!![]}];}return db['ZendeskField'][_0x7721('0x44')](_0x315202);})[_0x7721('0x28')](function(_0x40ce8c){_0x53c904[_0x7721('0x45')]=_0x40ce8c;return _0x53c904;})[_0x7721('0x28')](respondWithFilteredResult(_0x499b87,_0x315202))['catch'](handleError(_0x499b87,null));};exports[_0x7721('0x46')]=function(_0x4a2c28,_0xaa3216){var _0x4a5b59={'raw':!![],'where':{'id':_0x4a2c28[_0x7721('0x47')]['id']}},_0x2333b8={};_0x2333b8[_0x7721('0x37')]=_['keys'](db[_0x7721('0x2f')][_0x7721('0x30')]);_0x2333b8[_0x7721('0x33')]=_['keys'](_0x4a2c28[_0x7721('0x33')]);_0x2333b8[_0x7721('0x34')]=_[_0x7721('0x35')](_0x2333b8[_0x7721('0x37')],_0x2333b8[_0x7721('0x33')]);_0x4a5b59[_0x7721('0x36')]=_[_0x7721('0x35')](_0x2333b8['model'],qs['fields'](_0x4a2c28[_0x7721('0x33')][_0x7721('0x38')]));_0x4a5b59[_0x7721('0x36')]=_0x4a5b59[_0x7721('0x36')][_0x7721('0x48')]?_0x4a5b59[_0x7721('0x36')]:_0x2333b8[_0x7721('0x37')];if(_0x4a2c28[_0x7721('0x33')][_0x7721('0x42')]){_0x4a5b59[_0x7721('0x43')]=[{'all':!![]}];}_0x4a5b59=_['merge']({},_0x4a5b59,_0x4a2c28['options']);return db[_0x7721('0x2f')][_0x7721('0x49')](_0x4a5b59)[_0x7721('0x28')](handleEntityNotFound(_0xaa3216,null))[_0x7721('0x28')](respondWithResult(_0xaa3216,null))['catch'](handleError(_0xaa3216,null));};exports[_0x7721('0x4a')]=function(_0x2d5a88,_0x56c3d9){return db[_0x7721('0x2f')]['create'](_0x2d5a88[_0x7721('0x4b')],{})['then'](respondWithResult(_0x56c3d9,0xc9))[_0x7721('0x4c')](handleError(_0x56c3d9,null));};exports[_0x7721('0x27')]=function(_0xf17c40,_0x4eda58){if(_0xf17c40[_0x7721('0x4b')]['id']){delete _0xf17c40[_0x7721('0x4b')]['id'];}return db['ZendeskField'][_0x7721('0x49')]({'where':{'id':_0xf17c40[_0x7721('0x47')]['id']}})[_0x7721('0x28')](handleEntityNotFound(_0x4eda58,null))['then'](saveUpdates(_0xf17c40[_0x7721('0x4b')],null))['then'](respondWithResult(_0x4eda58,null))[_0x7721('0x4c')](handleError(_0x4eda58,null));};exports[_0x7721('0x29')]=function(_0x4738ef,_0x443503){return db[_0x7721('0x2f')][_0x7721('0x49')]({'where':{'id':_0x4738ef[_0x7721('0x47')]['id']}})[_0x7721('0x28')](handleEntityNotFound(_0x443503,null))[_0x7721('0x28')](removeEntity(_0x443503,null))[_0x7721('0x4c')](handleError(_0x443503,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 2f423bc..eb4f4ed 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 _0xea1a=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','idField','lodash'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xea1a,0x158));var _0xaea1=function(_0x5390e9,_0x397ea2){_0x5390e9=_0x5390e9-0x0;var _0x24601d=_0xea1a[_0x5390e9];return _0x24601d;};'use strict';var _=require(_0xaea1('0x0'));var util=require(_0xaea1('0x1'));var logger=require(_0xaea1('0x2'))(_0xaea1('0x3'));var moment=require('moment');var BPromise=require(_0xaea1('0x4'));var rp=require(_0xaea1('0x5'));var fs=require('fs');var path=require(_0xaea1('0x6'));var rimraf=require(_0xaea1('0x7'));var config=require(_0xaea1('0x8'));var attributes=require(_0xaea1('0x9'));module[_0xaea1('0xa')]=function(_0x246ebc,_0x5208c7){return _0x246ebc[_0xaea1('0xb')](_0xaea1('0xc'),attributes,{'tableName':_0xaea1('0xd'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xaea1('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbca8=['path','rimraf','exports','define','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x1f1b15,_0x4e927c){var _0x3f2930=function(_0x2653ca){while(--_0x2653ca){_0x1f1b15['push'](_0x1f1b15['shift']());}};_0x3f2930(++_0x4e927c);}(_0xbca8,0xcc));var _0x8bca=function(_0x340dc5,_0x2a0e25){_0x340dc5=_0x340dc5-0x0;var _0x169854=_0xbca8[_0x340dc5];return _0x169854;};'use strict';var _=require(_0x8bca('0x0'));var util=require(_0x8bca('0x1'));var logger=require(_0x8bca('0x2'))(_0x8bca('0x3'));var moment=require(_0x8bca('0x4'));var BPromise=require('bluebird');var rp=require(_0x8bca('0x5'));var fs=require('fs');var path=require(_0x8bca('0x6'));var rimraf=require(_0x8bca('0x7'));var config=require('../../config/environment');var attributes=require('./intZendeskField.attributes');module[_0x8bca('0x8')]=function(_0x2ecf60,_0x318474){return _0x2ecf60[_0x8bca('0x9')]('ZendeskField',attributes,{'tableName':_0x8bca('0xa'),'paranoid':![],'indexes':[{'name':_0x8bca('0xb'),'fields':[_0x8bca('0xc'),_0x8bca('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 73f280d..41b7e40 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 _0x0e75=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','http','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x0e75,0x165));var _0x50e7=function(_0x1cacd0,_0x574d30){_0x1cacd0=_0x1cacd0-0x0;var _0x4a2df2=_0x0e75[_0x1cacd0];return _0x4a2df2;};'use strict';var _=require(_0x50e7('0x0'));var util=require(_0x50e7('0x1'));var moment=require(_0x50e7('0x2'));var BPromise=require(_0x50e7('0x3'));var rs=require(_0x50e7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x50e7('0x5'))['db'];var utils=require(_0x50e7('0x6'));var logger=require('../../config/logger')(_0x50e7('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x50e7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x455c85,_0x3858ee,_0x3c5c57){return new BPromise(function(_0x1b4e56,_0x5db296){return client['request'](_0x455c85,_0x3c5c57)['then'](function(_0x4d3783){logger[_0x50e7('0x9')](_0x50e7('0xa'),_0x3858ee,'request\x20sent');logger[_0x50e7('0xb')](_0x50e7('0xc'),_0x3858ee,_0x50e7('0xd'),JSON[_0x50e7('0xe')](_0x4d3783));if(_0x4d3783[_0x50e7('0xf')]){if(_0x4d3783[_0x50e7('0xf')][_0x50e7('0x10')]===0x1f4){logger[_0x50e7('0xf')](_0x50e7('0xa'),_0x3858ee,_0x4d3783['error'][_0x50e7('0x11')]);return _0x5db296(_0x4d3783[_0x50e7('0xf')][_0x50e7('0x11')]);}logger[_0x50e7('0xf')](_0x50e7('0xa'),_0x3858ee,_0x4d3783['error'][_0x50e7('0x11')]);return _0x1b4e56(_0x4d3783['error'][_0x50e7('0x11')]);}else{logger['info'](_0x50e7('0xa'),_0x3858ee,_0x50e7('0xd'));_0x1b4e56(_0x4d3783[_0x50e7('0x12')][_0x50e7('0x11')]);}})[_0x50e7('0x13')](function(_0x2163cc){logger[_0x50e7('0xf')]('ZendeskField,\x20%s,\x20%s',_0x3858ee,_0x2163cc);_0x5db296(_0x2163cc);});});} \ No newline at end of file +var _0x4404=['util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ZendeskField,\x20%s,\x20%s','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch'];(function(_0x5a5c0d,_0x952e87){var _0xce9729=function(_0x1477e8){while(--_0x1477e8){_0x5a5c0d['push'](_0x5a5c0d['shift']());}};_0xce9729(++_0x952e87);}(_0x4404,0x111));var _0x4440=function(_0x592f87,_0x35f49d){_0x592f87=_0x592f87-0x0;var _0x444bbb=_0x4404[_0x592f87];return _0x444bbb;};'use strict';var _=require('lodash');var util=require(_0x4440('0x0'));var moment=require(_0x4440('0x1'));var BPromise=require(_0x4440('0x2'));var rs=require(_0x4440('0x3'));var fs=require('fs');var Redis=require(_0x4440('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4440('0x5'))(_0x4440('0x6'));var config=require(_0x4440('0x7'));var jayson=require(_0x4440('0x8'));var client=jayson[_0x4440('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59b612,_0xcd58f9,_0x18d5fc){return new BPromise(function(_0xa863e9,_0x3e7582){return client[_0x4440('0xa')](_0x59b612,_0x18d5fc)[_0x4440('0xb')](function(_0x5b9ce5){logger['info'](_0x4440('0xc'),_0xcd58f9,'request\x20sent');logger['debug'](_0x4440('0xd'),_0xcd58f9,'request\x20sent',JSON[_0x4440('0xe')](_0x5b9ce5));if(_0x5b9ce5['error']){if(_0x5b9ce5[_0x4440('0xf')]['code']===0x1f4){logger['error'](_0x4440('0xc'),_0xcd58f9,_0x5b9ce5[_0x4440('0xf')]['message']);return _0x3e7582(_0x5b9ce5[_0x4440('0xf')][_0x4440('0x10')]);}logger[_0x4440('0xf')](_0x4440('0xc'),_0xcd58f9,_0x5b9ce5[_0x4440('0xf')][_0x4440('0x10')]);return _0xa863e9(_0x5b9ce5[_0x4440('0xf')][_0x4440('0x10')]);}else{logger[_0x4440('0x11')]('ZendeskField,\x20%s,\x20%s',_0xcd58f9,_0x4440('0x12'));_0xa863e9(_0x5b9ce5[_0x4440('0x13')][_0x4440('0x10')]);}})[_0x4440('0x14')](function(_0x5ffbbb){logger['error'](_0x4440('0xc'),_0xcd58f9,_0x5ffbbb);_0x3e7582(_0x5ffbbb);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 62273d7..6b4eaa9 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 _0x9897=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','post','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x9ffea6,_0x2ff67e){var _0x42255b=function(_0x2f69ee){while(--_0x2f69ee){_0x9ffea6['push'](_0x9ffea6['shift']());}};_0x42255b(++_0x2ff67e);}(_0x9897,0x125));var _0x7989=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x9897[_0x2aec52];return _0x3b8835;};'use strict';var multer=require('multer');var util=require(_0x7989('0x0'));var path=require(_0x7989('0x1'));var timeout=require(_0x7989('0x2'));var express=require(_0x7989('0x3'));var router=express[_0x7989('0x4')]();var fs_extra=require(_0x7989('0x5'));var auth=require(_0x7989('0x6'));var interaction=require(_0x7989('0x7'));var config=require(_0x7989('0x8'));var controller=require(_0x7989('0x9'));router[_0x7989('0xa')]('/',auth[_0x7989('0xb')](),controller[_0x7989('0xc')]);router[_0x7989('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x7989('0xd')]);router[_0x7989('0xa')](_0x7989('0xe'),auth[_0x7989('0xb')](),controller[_0x7989('0xf')]);router[_0x7989('0xa')](_0x7989('0x10'),auth[_0x7989('0xb')](),controller['getFields']);router[_0x7989('0x11')]('/',auth[_0x7989('0xb')](),controller['create']);router[_0x7989('0x11')](_0x7989('0xe'),auth[_0x7989('0xb')](),controller['addConfiguration']);router['put'](_0x7989('0x12'),auth[_0x7989('0xb')](),controller[_0x7989('0x13')]);router[_0x7989('0x14')](_0x7989('0x12'),auth[_0x7989('0xb')](),controller[_0x7989('0x15')]);module[_0x7989('0x16')]=router; \ No newline at end of file +var _0x9177=['/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x21fd7a,_0x153d0e){var _0x547f75=function(_0x35df2a){while(--_0x35df2a){_0x21fd7a['push'](_0x21fd7a['shift']());}};_0x547f75(++_0x153d0e);}(_0x9177,0xcb));var _0x7917=function(_0x442f02,_0x47d845){_0x442f02=_0x442f02-0x0;var _0xab6ef1=_0x9177[_0x442f02];return _0xab6ef1;};'use strict';var multer=require(_0x7917('0x0'));var util=require(_0x7917('0x1'));var path=require(_0x7917('0x2'));var timeout=require(_0x7917('0x3'));var express=require(_0x7917('0x4'));var router=express[_0x7917('0x5')]();var fs_extra=require(_0x7917('0x6'));var auth=require(_0x7917('0x7'));var interaction=require(_0x7917('0x8'));var config=require(_0x7917('0x9'));var controller=require('./intZohoAccount.controller');router[_0x7917('0xa')]('/',auth[_0x7917('0xb')](),controller[_0x7917('0xc')]);router[_0x7917('0xa')](_0x7917('0xd'),auth[_0x7917('0xb')](),controller['show']);router[_0x7917('0xa')](_0x7917('0xe'),auth[_0x7917('0xb')](),controller[_0x7917('0xf')]);router[_0x7917('0xa')](_0x7917('0x10'),auth[_0x7917('0xb')](),controller[_0x7917('0x11')]);router['post']('/',auth[_0x7917('0xb')](),controller['create']);router[_0x7917('0x12')](_0x7917('0xe'),auth[_0x7917('0xb')](),controller[_0x7917('0x13')]);router[_0x7917('0x14')](_0x7917('0xd'),auth[_0x7917('0xb')](),controller[_0x7917('0x15')]);router[_0x7917('0x16')](_0x7917('0xd'),auth[_0x7917('0xb')](),controller[_0x7917('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 0d2c388..c2b2ddc 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 _0x6b00=['sequelize','exports','STRING'];(function(_0x29d623,_0x1a5c9c){var _0x242e59=function(_0x2c78ab){while(--_0x2c78ab){_0x29d623['push'](_0x29d623['shift']());}};_0x242e59(++_0x1a5c9c);}(_0x6b00,0xe4));var _0x06b0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6b00[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x06b0('0x0'));module[_0x06b0('0x1')]={'name':{'type':Sequelize[_0x06b0('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x06b0('0x2')]},'zone':{'type':Sequelize[_0x06b0('0x2')]},'clientId':{'type':Sequelize[_0x06b0('0x2')]},'clientSecret':{'type':Sequelize[_0x06b0('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0x06b0('0x2')]},'refreshToken':{'type':Sequelize[_0x06b0('0x2')]}}; \ No newline at end of file +var _0x6cc5=['exports','STRING'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x6cc5,0x1d2));var _0x56cc=function(_0xd47bae,_0x2112cd){_0xd47bae=_0xd47bae-0x0;var _0x1bc166=_0x6cc5[_0xd47bae];return _0x1bc166;};'use strict';var Sequelize=require('sequelize');module[_0x56cc('0x0')]={'name':{'type':Sequelize[_0x56cc('0x1')]},'description':{'type':Sequelize[_0x56cc('0x1')]},'host':{'type':Sequelize[_0x56cc('0x1')]},'zone':{'type':Sequelize[_0x56cc('0x1')]},'clientId':{'type':Sequelize[_0x56cc('0x1')]},'clientSecret':{'type':Sequelize[_0x56cc('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0x56cc('0x1')]},'refreshToken':{'type':Sequelize[_0x56cc('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 631f053..5792072 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 _0x48a0=['options','includeAll','include','rows','show','params','keys','rawAttributes','fields','find','create','body','update','getConfigurations','findOne','ZohoConfiguration','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','zoho.eu','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','system_mandatory','push','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','then','info','ZohoAccount,\x20%s,\x20%s','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','end','json','count','offset','limit','set','Content-Range','save','destroy','sendStatus','stack','name','send','index','map','ZohoAccount','fieldName','type','query','filters','intersection','attributes','model','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x8c7987,_0x3d6936){var _0x582752=function(_0x249d8d){while(--_0x249d8d){_0x8c7987['push'](_0x8c7987['shift']());}};_0x582752(++_0x3d6936);}(_0x48a0,0x1cd));var _0x048a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x48a0[_0x57b54c];return _0x59cc19;};'use strict';var pdf=require(_0x048a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x048a('0x1'));var zipdir=require(_0x048a('0x2'));var jsonpatch=require(_0x048a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x048a('0x4'));var path=require('path');var sox=require(_0x048a('0x5'));var csv=require(_0x048a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x048a('0x7'));var _=require(_0x048a('0x8'));var squel=require(_0x048a('0x9'));var crypto=require('crypto');var jsforce=require(_0x048a('0xa'));var deskjs=require(_0x048a('0xb'));var toCsv=require(_0x048a('0x6'));var querystring=require(_0x048a('0xc'));var Papa=require(_0x048a('0xd'));var Redis=require(_0x048a('0xe'));var authService=require(_0x048a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x048a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x048a('0x11'))(_0x048a('0x12'));var utils=require(_0x048a('0x13'));var config=require(_0x048a('0x14'));var licenseUtil=require(_0x048a('0x15'));var db=require(_0x048a('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x048a('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33d68f,_0xd28ac3,_0x49b56d,_0x1c2705){return new BPromise(function(_0x3a69f8,_0x1140c7){var _0x1e5203=_0x1c2705||client;return _0x1e5203['request'](_0x33d68f,_0x49b56d)[_0x048a('0x18')](function(_0x483770){logger[_0x048a('0x19')](_0x048a('0x1a'),_0xd28ac3,'request\x20sent');logger['debug'](_0x048a('0x1b'),_0xd28ac3,_0x048a('0x1c'),JSON[_0x048a('0x1d')](_0x483770));if(_0x483770['error']){if(_0x483770[_0x048a('0x1e')][_0x048a('0x1f')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0xd28ac3,_0x483770[_0x048a('0x1e')][_0x048a('0x20')]);return _0x1140c7(_0x483770[_0x048a('0x1e')][_0x048a('0x20')]);}logger[_0x048a('0x1e')]('ZohoAccount,\x20%s,\x20%s',_0xd28ac3,_0x483770['error'][_0x048a('0x20')]);return _0x3a69f8(_0x483770[_0x048a('0x1e')]['message']);}else{logger[_0x048a('0x19')](_0x048a('0x1a'),_0xd28ac3,_0x048a('0x1c'));_0x3a69f8(_0x483770['result']['message']);}})[_0x048a('0x21')](function(_0x5c5d7c){logger['error'](_0x048a('0x1a'),_0xd28ac3,_0x5c5d7c);_0x1140c7(_0x5c5d7c);});});}function respondWithStatusCode(_0x5744e1,_0x3476a0){_0x3476a0=_0x3476a0||0xcc;return function(_0x801196){if(_0x801196){return _0x5744e1['sendStatus'](_0x3476a0);}return _0x5744e1[_0x048a('0x22')](_0x3476a0)[_0x048a('0x23')]();};}function respondWithResult(_0x2b6962,_0x16eaf6){_0x16eaf6=_0x16eaf6||0xc8;return function(_0x3073e1){if(_0x3073e1){return _0x2b6962['status'](_0x16eaf6)[_0x048a('0x24')](_0x3073e1);}};}function respondWithFilteredResult(_0x54187c,_0x521f2a){return function(_0x351966){if(_0x351966){var _0x43176d=_0x351966[_0x048a('0x25')],_0x4bd55f=_0x521f2a['offset'],_0x1e0ca9=_0x521f2a[_0x048a('0x26')]+_0x521f2a[_0x048a('0x27')],_0x21860e;if(_0x1e0ca9>=_0x43176d){_0x1e0ca9=_0x43176d;_0x21860e=0xc8;}else{_0x21860e=0xce;}_0x54187c[_0x048a('0x22')](_0x21860e);return _0x54187c[_0x048a('0x28')](_0x048a('0x29'),_0x4bd55f+'-'+_0x1e0ca9+'/'+_0x43176d)['json'](_0x351966);}return null;};}function patchUpdates(_0x3ccd39){return function(_0x4e8a0d){try{jsonpatch['apply'](_0x4e8a0d,_0x3ccd39,!![]);}catch(_0xdcd9e9){return BPromise['reject'](_0xdcd9e9);}return _0x4e8a0d[_0x048a('0x2a')]();};}function saveUpdates(_0x1f78fd,_0x14fde1){return function(_0x3366dc){if(_0x3366dc){return _0x3366dc['update'](_0x1f78fd)[_0x048a('0x18')](function(_0x361eb1){return _0x361eb1;});}return null;};}function removeEntity(_0x48afe5,_0x28935d){return function(_0x626ac7){if(_0x626ac7){return _0x626ac7[_0x048a('0x2b')]()['then'](function(){_0x48afe5['status'](0xcc)[_0x048a('0x23')]();});}};}function handleEntityNotFound(_0x1e0ad6,_0x4f813c){return function(_0x2d898b){if(!_0x2d898b){_0x1e0ad6[_0x048a('0x2c')](0x194);}return _0x2d898b;};}function handleError(_0x1673bd,_0x48500c){_0x48500c=_0x48500c||0x1f4;return function(_0x30b35f){logger[_0x048a('0x1e')](_0x30b35f[_0x048a('0x2d')]);if(_0x30b35f['name']){delete _0x30b35f[_0x048a('0x2e')];}_0x1673bd[_0x048a('0x22')](_0x48500c)[_0x048a('0x2f')](_0x30b35f);};}exports[_0x048a('0x30')]=function(_0x1dbfc6,_0x10d43d){var _0x35f403={},_0x9b7776={},_0x4f7087={'count':0x0,'rows':[]};var _0x447c6e=_[_0x048a('0x31')](db[_0x048a('0x32')]['rawAttributes'],function(_0x46cf2c){return{'name':_0x46cf2c[_0x048a('0x33')],'type':_0x46cf2c[_0x048a('0x34')]['key']};});_0x9b7776['model']=_['map'](_0x447c6e,'name');_0x9b7776[_0x048a('0x35')]=_['keys'](_0x1dbfc6[_0x048a('0x35')]);_0x9b7776[_0x048a('0x36')]=_[_0x048a('0x37')](_0x9b7776['model'],_0x9b7776['query']);_0x35f403[_0x048a('0x38')]=_[_0x048a('0x37')](_0x9b7776[_0x048a('0x39')],qs['fields'](_0x1dbfc6[_0x048a('0x35')]['fields']));_0x35f403['attributes']=_0x35f403['attributes'][_0x048a('0x3a')]?_0x35f403[_0x048a('0x38')]:_0x9b7776[_0x048a('0x39')];if(!_0x1dbfc6['query']['hasOwnProperty'](_0x048a('0x3b'))){_0x35f403['limit']=qs[_0x048a('0x27')](_0x1dbfc6[_0x048a('0x35')][_0x048a('0x27')]);_0x35f403[_0x048a('0x26')]=qs['offset'](_0x1dbfc6[_0x048a('0x35')][_0x048a('0x26')]);}_0x35f403[_0x048a('0x3c')]=qs[_0x048a('0x3d')](_0x1dbfc6[_0x048a('0x35')][_0x048a('0x3d')]);_0x35f403[_0x048a('0x3e')]=qs[_0x048a('0x36')](_[_0x048a('0x3f')](_0x1dbfc6[_0x048a('0x35')],_0x9b7776[_0x048a('0x36')]),_0x447c6e);if(_0x1dbfc6[_0x048a('0x35')][_0x048a('0x40')]){_0x35f403[_0x048a('0x3e')]=_[_0x048a('0x41')](_0x35f403[_0x048a('0x3e')],{'$or':_[_0x048a('0x31')](_0x447c6e,function(_0x14e1e1){if(_0x14e1e1[_0x048a('0x34')]!==_0x048a('0x42')){var _0x4e51ec={};_0x4e51ec[_0x14e1e1[_0x048a('0x2e')]]={'$like':'%'+_0x1dbfc6[_0x048a('0x35')][_0x048a('0x40')]+'%'};return _0x4e51ec;}})});}_0x35f403=_[_0x048a('0x41')]({},_0x35f403,_0x1dbfc6[_0x048a('0x43')]);var _0x4c24e1={'where':_0x35f403[_0x048a('0x3e')]};return db[_0x048a('0x32')][_0x048a('0x25')](_0x4c24e1)['then'](function(_0x4b7384){_0x4f7087['count']=_0x4b7384;if(_0x1dbfc6[_0x048a('0x35')][_0x048a('0x44')]){_0x35f403[_0x048a('0x45')]=[{'all':!![]}];}return db[_0x048a('0x32')]['findAll'](_0x35f403);})[_0x048a('0x18')](function(_0x30b976){_0x4f7087[_0x048a('0x46')]=_0x30b976;return _0x4f7087;})[_0x048a('0x18')](respondWithFilteredResult(_0x10d43d,_0x35f403))['catch'](handleError(_0x10d43d,null));};exports[_0x048a('0x47')]=function(_0x45885a,_0x42fd34){var _0x35ccba={'raw':![],'where':{'id':_0x45885a[_0x048a('0x48')]['id']}},_0xd044e4={};_0xd044e4[_0x048a('0x39')]=_[_0x048a('0x49')](db[_0x048a('0x32')][_0x048a('0x4a')]);_0xd044e4[_0x048a('0x35')]=_[_0x048a('0x49')](_0x45885a[_0x048a('0x35')]);_0xd044e4[_0x048a('0x36')]=_[_0x048a('0x37')](_0xd044e4[_0x048a('0x39')],_0xd044e4[_0x048a('0x35')]);_0x35ccba[_0x048a('0x38')]=_[_0x048a('0x37')](_0xd044e4[_0x048a('0x39')],qs[_0x048a('0x4b')](_0x45885a['query']['fields']));_0x35ccba['attributes']=_0x35ccba[_0x048a('0x38')]['length']?_0x35ccba['attributes']:_0xd044e4[_0x048a('0x39')];if(_0x45885a[_0x048a('0x35')][_0x048a('0x44')]){_0x35ccba[_0x048a('0x45')]=[{'all':!![]}];}_0x35ccba=_[_0x048a('0x41')]({},_0x35ccba,_0x45885a['options']);return db[_0x048a('0x32')][_0x048a('0x4c')](_0x35ccba)[_0x048a('0x18')](handleEntityNotFound(_0x42fd34,null))[_0x048a('0x18')](respondWithResult(_0x42fd34,null))[_0x048a('0x21')](handleError(_0x42fd34,null));};exports[_0x048a('0x4d')]=function(_0x54c569,_0x20d6ac){return db[_0x048a('0x32')][_0x048a('0x4d')](_0x54c569[_0x048a('0x4e')],{})[_0x048a('0x18')](respondWithResult(_0x20d6ac,0xc9))[_0x048a('0x21')](handleError(_0x20d6ac,null));};exports[_0x048a('0x4f')]=function(_0x4b5f7a,_0x40b0a6){if(_0x4b5f7a[_0x048a('0x4e')]['id']){delete _0x4b5f7a['body']['id'];}return db['ZohoAccount'][_0x048a('0x4c')]({'where':{'id':_0x4b5f7a[_0x048a('0x48')]['id']}})[_0x048a('0x18')](handleEntityNotFound(_0x40b0a6,null))['then'](saveUpdates(_0x4b5f7a['body'],null))['then'](respondWithResult(_0x40b0a6,null))[_0x048a('0x21')](handleError(_0x40b0a6,null));};exports[_0x048a('0x2b')]=function(_0x39533d,_0x3d0a40){return db[_0x048a('0x32')][_0x048a('0x4c')]({'where':{'id':_0x39533d[_0x048a('0x48')]['id']}})[_0x048a('0x18')](handleEntityNotFound(_0x3d0a40,null))[_0x048a('0x18')](removeEntity(_0x3d0a40,null))['catch'](handleError(_0x3d0a40,null));};exports[_0x048a('0x50')]=function(_0x478278,_0x34ff4e,_0xa2a259){var _0x24c110={};var _0x1350f={};var _0x112efc;var _0x471271;return db[_0x048a('0x32')][_0x048a('0x51')]({'where':{'id':_0x478278[_0x048a('0x48')]['id']}})[_0x048a('0x18')](handleEntityNotFound(_0x34ff4e,null))[_0x048a('0x18')](function(_0xf8f27e){if(_0xf8f27e){_0x112efc=_0xf8f27e;_0x1350f[_0x048a('0x39')]=_[_0x048a('0x49')](db[_0x048a('0x52')][_0x048a('0x4a')]);_0x1350f[_0x048a('0x35')]=_[_0x048a('0x49')](_0x478278['query']);_0x1350f[_0x048a('0x36')]=_[_0x048a('0x37')](_0x1350f[_0x048a('0x39')],_0x1350f[_0x048a('0x35')]);_0x24c110['attributes']=_[_0x048a('0x37')](_0x1350f['model'],qs['fields'](_0x478278[_0x048a('0x35')][_0x048a('0x4b')]));_0x24c110[_0x048a('0x38')]=_0x24c110[_0x048a('0x38')]['length']?_0x24c110[_0x048a('0x38')]:_0x1350f['model'];_0x24c110[_0x048a('0x3c')]=qs[_0x048a('0x3d')](_0x478278[_0x048a('0x35')]['sort']);_0x24c110[_0x048a('0x3e')]=qs['filters'](_['pick'](_0x478278[_0x048a('0x35')],_0x1350f[_0x048a('0x36')]));if(_0x478278[_0x048a('0x35')][_0x048a('0x40')]){_0x24c110[_0x048a('0x3e')]=_[_0x048a('0x41')](_0x24c110[_0x048a('0x3e')],{'$or':_[_0x048a('0x31')](_0x24c110[_0x048a('0x38')],function(_0x484e14){var _0x63f714={};_0x63f714[_0x484e14]={'$like':'%'+_0x478278[_0x048a('0x35')][_0x048a('0x40')]+'%'};return _0x63f714;})});}_0x24c110=_['merge']({},_0x24c110,_0x478278['options']);return _0x112efc[_0x048a('0x50')](_0x24c110);}})['then'](function(_0x1b50ba){if(_0x1b50ba){_0x471271=_0x1b50ba[_0x048a('0x3a')];if(!_0x478278[_0x048a('0x35')][_0x048a('0x53')](_0x048a('0x3b'))){_0x24c110[_0x048a('0x27')]=qs[_0x048a('0x27')](_0x478278[_0x048a('0x35')][_0x048a('0x27')]);_0x24c110['offset']=qs[_0x048a('0x26')](_0x478278[_0x048a('0x35')][_0x048a('0x26')]);}return _0x112efc['getConfigurations'](_0x24c110);}})['then'](function(_0x4fc64c){if(_0x4fc64c){return _0x4fc64c?{'count':_0x471271,'rows':_0x4fc64c}:null;}})[_0x048a('0x18')](respondWithResult(_0x34ff4e,null))[_0x048a('0x21')](handleError(_0x34ff4e,null));};exports[_0x048a('0x54')]=function(_0x43ca89,_0x1d746f,_0x3aa207){if(_0x43ca89['body']['id']){delete _0x43ca89[_0x048a('0x4e')]['id'];}return db[_0x048a('0x32')][_0x048a('0x51')]({'where':{'id':_0x43ca89['params']['id']}})[_0x048a('0x18')](handleEntityNotFound(_0x1d746f,null))[_0x048a('0x18')](function(_0x32f9d0){if(_0x32f9d0){_0x43ca89[_0x048a('0x4e')]['AccountId']=_0x32f9d0['id'];_0x43ca89['body'][_0x048a('0x55')]=integrations[_0x048a('0x56')](_0x43ca89[_0x048a('0x4e')][_0x048a('0x57')],_0x43ca89[_0x048a('0x4e')][_0x048a('0x34')]);_0x43ca89[_0x048a('0x4e')][_0x048a('0x58')]=integrations['getDescriptions'](_0x43ca89['body'][_0x048a('0x57')],_0x43ca89['body'][_0x048a('0x34')]);return db[_0x048a('0x52')][_0x048a('0x4d')](_0x43ca89[_0x048a('0x4e')],{'include':[{'model':db[_0x048a('0x59')],'as':_0x048a('0x55')},{'model':db['ZohoField'],'as':_0x048a('0x58')}]});}return null;})[_0x048a('0x18')](respondWithResult(_0x1d746f,null))['catch'](handleError(_0x1d746f,null));};function getAccessToken(_0x538c27){return new Promise(function(_0xe3450e,_0x467781){var _0x5aa3d2;switch(_0x538c27[_0x048a('0x5a')]){case'US':_0x5aa3d2=_0x048a('0x5b');break;case'AU':_0x5aa3d2='https://accounts.zoho.com.au';break;case'EU':_0x5aa3d2='https://accounts.zoho.eu';break;case'IN':_0x5aa3d2=_0x048a('0x5c');break;case'CN':_0x5aa3d2=_0x048a('0x5d');break;default:_0x5aa3d2=_0x048a('0x5e');break;}var _0x3c722c={'method':_0x048a('0x5f'),'uri':_0x5aa3d2+_0x048a('0x60'),'qs':{'refresh_token':_0x538c27[_0x048a('0x61')],'client_id':_0x538c27[_0x048a('0x62')],'client_secret':_0x538c27[_0x048a('0x63')],'grant_type':_0x048a('0x64')},'json':!![]};return rp(_0x3c722c)[_0x048a('0x18')](function(_0x3db76f){if(_0x3db76f['access_token']){_0xe3450e(_0x3db76f[_0x048a('0x65')]);}else{_0x467781(_0x048a('0x66'));}})[_0x048a('0x21')](function(_0x126de5){_0x467781(_0x126de5);});});}exports[_0x048a('0x67')]=function(_0x691e88,_0x34604c,_0x50f2bb){var _0x5e2bf4,_0x11cb2c,_0x578c10,_0x4ef2a2,_0x5a3dd5;return db[_0x048a('0x32')][_0x048a('0x51')]({'where':{'id':_0x691e88[_0x048a('0x48')]['id']},'attributes':['id',_0x048a('0x68'),_0x048a('0x5a'),_0x048a('0x62'),_0x048a('0x63'),_0x048a('0x69'),_0x048a('0x1f'),_0x048a('0x61')]})[_0x048a('0x18')](handleEntityNotFound(_0x34604c,null))[_0x048a('0x18')](function(_0x4d795b){_0x5a3dd5=_0x4d795b;_0x5e2bf4=_0x5a3dd5['host'];_0x11cb2c=_0x5e2bf4===_0x048a('0x6a')?'eu':'com';_0x578c10=_0x5a3dd5[_0x048a('0x69')];var _0x3ff1d8=_0x578c10[_0x048a('0x6b')](-0x1);if(_0x3ff1d8==='/'||_0x3ff1d8==='\x5c'||_0x3ff1d8===':'){_0x578c10=_0x578c10[_0x048a('0x6c')](0x0,_0x578c10['lastIndexOf'](_0x3ff1d8));}if(!_0x5a3dd5[_0x048a('0x61')]){throw new Error(_0x048a('0x6d'));}return getAccessToken(_0x5a3dd5);})[_0x048a('0x18')](function(_0x1b56a5){if(_0x1b56a5){return rp({'method':_0x048a('0x6e'),'uri':util[_0x048a('0x6f')](_0x048a('0x70'),_0x11cb2c),'qs':{'module':_0x048a('0x71')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1b56a5},'json':!![]});}})['then'](function(_0x80ac00){if(_0x80ac00){if(_0x80ac00[_0x048a('0x72')]&&_0x80ac00[_0x048a('0x72')]['error']){throw new Error(_0x80ac00['response'][_0x048a('0x1e')]['message']);}var _0x564ba8=[];var _0x45e59b=[];var _0x1540eb=['Owner',_0x048a('0x73'),'Description',_0x048a('0x74'),_0x048a('0x75'),_0x048a('0x76'),_0x048a('0x77'),'Call_Type'];_0x45e59b=_[_0x048a('0x78')](_0x80ac00['fields'],function(_0x3bedda){return _0x1540eb[_0x048a('0x79')](_0x3bedda['api_name']);});for(var _0x3a6517=0x0;_0x3a6517<_0x45e59b['length'];_0x3a6517++){if(_0x45e59b[_0x3a6517][_0x048a('0x7a')]===![]){_0x564ba8[_0x048a('0x7b')]({'id':_0x45e59b[_0x3a6517]['id'],'name':_0x45e59b[_0x3a6517]['display_label'],'custom':_0x45e59b[_0x3a6517][_0x048a('0x7c')],'options':_0x45e59b[_0x3a6517][_0x048a('0x7d')]===_0x048a('0x7e')&&_0x45e59b[_0x3a6517][_0x048a('0x7f')][_0x048a('0x3a')]>-0x1?_[_0x048a('0x31')](_0x45e59b[_0x3a6517]['pick_list_values'],function(_0x279c5f){return{'name':_0x279c5f,'value':_0x279c5f};}):[]});}}return{'count':_0x564ba8[_0x048a('0x3a')],'rows':_0x564ba8};}else{return{'count':0x0,'rows':[]};}})[_0x048a('0x18')](respondWithResult(_0x34604c,null))[_0x048a('0x21')](function(_0x29ecf9){var _0x12ad97=_0x691e88['query']['test']?0x1f4:_0x29ecf9[_0x048a('0x80')]||0x1f4;logger['error'](_0x048a('0x81'),'getFields',_0x12ad97,JSON[_0x048a('0x1d')](_0x29ecf9));delete _0x29ecf9[_0x048a('0x2e')];if(_0x12ad97===0x191){_0x12ad97=0x190;}_0x34604c['status'](_0x12ad97)[_0x048a('0x2f')](_0x691e88[_0x048a('0x35')][_0x048a('0x82')]?{'message':_0x048a('0x83'),'statusCode':_0x29ecf9['statusCode']}:_0x29ecf9);});}; \ No newline at end of file +var _0xd16c=['ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zoho.eu','com','serverUrl','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','stringify','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','stack','name','send','index','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','ZohoAccount','includeAll','include','findAll','rows','show','params','fields','merge','create','body','find','getConfigurations','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions'];(function(_0x15e75a,_0x20131a){var _0x20fcaa=function(_0x57a505){while(--_0x57a505){_0x15e75a['push'](_0x15e75a['shift']());}};_0x20fcaa(++_0x20131a);}(_0xd16c,0xb5));var _0xcd16=function(_0x395b2c,_0x2b8f56){_0x395b2c=_0x395b2c-0x0;var _0x3a55e6=_0xd16c[_0x395b2c];return _0x3a55e6;};'use strict';var pdf=require(_0xcd16('0x0'));var emlformat=require(_0xcd16('0x1'));var rimraf=require(_0xcd16('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcd16('0x3'));var rp=require(_0xcd16('0x4'));var moment=require(_0xcd16('0x5'));var BPromise=require(_0xcd16('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xcd16('0x7'));var sox=require(_0xcd16('0x8'));var csv=require(_0xcd16('0x9'));var ejs=require(_0xcd16('0xa'));var fs=require('fs');var fs_extra=require(_0xcd16('0xb'));var _=require(_0xcd16('0xc'));var squel=require('squel');var crypto=require(_0xcd16('0xd'));var jsforce=require(_0xcd16('0xe'));var deskjs=require(_0xcd16('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcd16('0x10'));var Papa=require(_0xcd16('0x11'));var Redis=require(_0xcd16('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcd16('0x13'));var hardwareService=require(_0xcd16('0x14'));var logger=require(_0xcd16('0x15'))(_0xcd16('0x16'));var utils=require(_0xcd16('0x17'));var config=require(_0xcd16('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xcd16('0x19'));var jayson=require(_0xcd16('0x1a'));var client=jayson['client'][_0xcd16('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4cba38,_0x1d14f7,_0x312482,_0x42668a){return new BPromise(function(_0x45644c,_0x106c02){var _0xae27f3=_0x42668a||client;return _0xae27f3['request'](_0x4cba38,_0x312482)[_0xcd16('0x1c')](function(_0x582958){logger[_0xcd16('0x1d')](_0xcd16('0x1e'),_0x1d14f7,_0xcd16('0x1f'));logger[_0xcd16('0x20')](_0xcd16('0x21'),_0x1d14f7,'request\x20sent',JSON['stringify'](_0x582958));if(_0x582958[_0xcd16('0x22')]){if(_0x582958[_0xcd16('0x22')][_0xcd16('0x23')]===0x1f4){logger[_0xcd16('0x22')](_0xcd16('0x1e'),_0x1d14f7,_0x582958[_0xcd16('0x22')][_0xcd16('0x24')]);return _0x106c02(_0x582958[_0xcd16('0x22')][_0xcd16('0x24')]);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x1d14f7,_0x582958[_0xcd16('0x22')]['message']);return _0x45644c(_0x582958['error']['message']);}else{logger[_0xcd16('0x1d')]('ZohoAccount,\x20%s,\x20%s',_0x1d14f7,_0xcd16('0x1f'));_0x45644c(_0x582958['result']['message']);}})[_0xcd16('0x25')](function(_0x4063eb){logger[_0xcd16('0x22')](_0xcd16('0x1e'),_0x1d14f7,_0x4063eb);_0x106c02(_0x4063eb);});});}function respondWithStatusCode(_0xa2ed4a,_0x55e687){_0x55e687=_0x55e687||0xcc;return function(_0x3e1cf5){if(_0x3e1cf5){return _0xa2ed4a[_0xcd16('0x26')](_0x55e687);}return _0xa2ed4a[_0xcd16('0x27')](_0x55e687)[_0xcd16('0x28')]();};}function respondWithResult(_0x384edb,_0x1c52b6){_0x1c52b6=_0x1c52b6||0xc8;return function(_0x1b1e98){if(_0x1b1e98){return _0x384edb[_0xcd16('0x27')](_0x1c52b6)['json'](_0x1b1e98);}};}function respondWithFilteredResult(_0x4a2bb1,_0x53edf3){return function(_0x29317f){if(_0x29317f){var _0x52bb46=_0x29317f[_0xcd16('0x29')],_0x48733a=_0x53edf3[_0xcd16('0x2a')],_0xc0209c=_0x53edf3['offset']+_0x53edf3[_0xcd16('0x2b')],_0x56c211;if(_0xc0209c>=_0x52bb46){_0xc0209c=_0x52bb46;_0x56c211=0xc8;}else{_0x56c211=0xce;}_0x4a2bb1['status'](_0x56c211);return _0x4a2bb1[_0xcd16('0x2c')](_0xcd16('0x2d'),_0x48733a+'-'+_0xc0209c+'/'+_0x52bb46)[_0xcd16('0x2e')](_0x29317f);}return null;};}function patchUpdates(_0x19234e){return function(_0x2146f2){try{jsonpatch[_0xcd16('0x2f')](_0x2146f2,_0x19234e,!![]);}catch(_0x121bfe){return BPromise['reject'](_0x121bfe);}return _0x2146f2[_0xcd16('0x30')]();};}function saveUpdates(_0x3d2635,_0x2320c3){return function(_0x29022f){if(_0x29022f){return _0x29022f[_0xcd16('0x31')](_0x3d2635)[_0xcd16('0x1c')](function(_0x30ffbd){return _0x30ffbd;});}return null;};}function removeEntity(_0x180684,_0x205c8f){return function(_0x49a353){if(_0x49a353){return _0x49a353[_0xcd16('0x32')]()['then'](function(){_0x180684['status'](0xcc)[_0xcd16('0x28')]();});}};}function handleEntityNotFound(_0x13ab62,_0x493baf){return function(_0x1b3bcc){if(!_0x1b3bcc){_0x13ab62[_0xcd16('0x26')](0x194);}return _0x1b3bcc;};}function handleError(_0x2667f3,_0x1ed3f2){_0x1ed3f2=_0x1ed3f2||0x1f4;return function(_0x3629c){logger[_0xcd16('0x22')](_0x3629c[_0xcd16('0x33')]);if(_0x3629c[_0xcd16('0x34')]){delete _0x3629c[_0xcd16('0x34')];}_0x2667f3[_0xcd16('0x27')](_0x1ed3f2)[_0xcd16('0x35')](_0x3629c);};}exports[_0xcd16('0x36')]=function(_0x305fb7,_0x51a33a){var _0x1c8a3d={},_0x1ef8c7={},_0x217869={'count':0x0,'rows':[]};var _0xea3232=_['map'](db['ZohoAccount'][_0xcd16('0x37')],function(_0x3b9085){return{'name':_0x3b9085['fieldName'],'type':_0x3b9085[_0xcd16('0x38')][_0xcd16('0x39')]};});_0x1ef8c7[_0xcd16('0x3a')]=_[_0xcd16('0x3b')](_0xea3232,_0xcd16('0x34'));_0x1ef8c7['query']=_[_0xcd16('0x3c')](_0x305fb7[_0xcd16('0x3d')]);_0x1ef8c7[_0xcd16('0x3e')]=_[_0xcd16('0x3f')](_0x1ef8c7['model'],_0x1ef8c7[_0xcd16('0x3d')]);_0x1c8a3d[_0xcd16('0x40')]=_[_0xcd16('0x3f')](_0x1ef8c7['model'],qs['fields'](_0x305fb7[_0xcd16('0x3d')]['fields']));_0x1c8a3d[_0xcd16('0x40')]=_0x1c8a3d['attributes'][_0xcd16('0x41')]?_0x1c8a3d['attributes']:_0x1ef8c7[_0xcd16('0x3a')];if(!_0x305fb7[_0xcd16('0x3d')]['hasOwnProperty'](_0xcd16('0x42'))){_0x1c8a3d['limit']=qs[_0xcd16('0x2b')](_0x305fb7[_0xcd16('0x3d')][_0xcd16('0x2b')]);_0x1c8a3d[_0xcd16('0x2a')]=qs['offset'](_0x305fb7[_0xcd16('0x3d')][_0xcd16('0x2a')]);}_0x1c8a3d[_0xcd16('0x43')]=qs[_0xcd16('0x44')](_0x305fb7[_0xcd16('0x3d')][_0xcd16('0x44')]);_0x1c8a3d[_0xcd16('0x45')]=qs[_0xcd16('0x3e')](_[_0xcd16('0x46')](_0x305fb7[_0xcd16('0x3d')],_0x1ef8c7[_0xcd16('0x3e')]),_0xea3232);if(_0x305fb7[_0xcd16('0x3d')][_0xcd16('0x47')]){_0x1c8a3d[_0xcd16('0x45')]=_['merge'](_0x1c8a3d[_0xcd16('0x45')],{'$or':_['map'](_0xea3232,function(_0x3962b7){if(_0x3962b7['type']!==_0xcd16('0x48')){var _0xc79feb={};_0xc79feb[_0x3962b7['name']]={'$like':'%'+_0x305fb7[_0xcd16('0x3d')][_0xcd16('0x47')]+'%'};return _0xc79feb;}})});}_0x1c8a3d=_['merge']({},_0x1c8a3d,_0x305fb7[_0xcd16('0x49')]);var _0x815f74={'where':_0x1c8a3d[_0xcd16('0x45')]};return db[_0xcd16('0x4a')][_0xcd16('0x29')](_0x815f74)[_0xcd16('0x1c')](function(_0x3fbe36){_0x217869[_0xcd16('0x29')]=_0x3fbe36;if(_0x305fb7[_0xcd16('0x3d')][_0xcd16('0x4b')]){_0x1c8a3d[_0xcd16('0x4c')]=[{'all':!![]}];}return db[_0xcd16('0x4a')][_0xcd16('0x4d')](_0x1c8a3d);})['then'](function(_0x40b330){_0x217869[_0xcd16('0x4e')]=_0x40b330;return _0x217869;})[_0xcd16('0x1c')](respondWithFilteredResult(_0x51a33a,_0x1c8a3d))['catch'](handleError(_0x51a33a,null));};exports[_0xcd16('0x4f')]=function(_0x1297a0,_0xf8bcd1){var _0x449058={'raw':![],'where':{'id':_0x1297a0[_0xcd16('0x50')]['id']}},_0x476f24={};_0x476f24[_0xcd16('0x3a')]=_[_0xcd16('0x3c')](db['ZohoAccount'][_0xcd16('0x37')]);_0x476f24[_0xcd16('0x3d')]=_[_0xcd16('0x3c')](_0x1297a0[_0xcd16('0x3d')]);_0x476f24[_0xcd16('0x3e')]=_[_0xcd16('0x3f')](_0x476f24[_0xcd16('0x3a')],_0x476f24[_0xcd16('0x3d')]);_0x449058['attributes']=_['intersection'](_0x476f24[_0xcd16('0x3a')],qs[_0xcd16('0x51')](_0x1297a0[_0xcd16('0x3d')][_0xcd16('0x51')]));_0x449058[_0xcd16('0x40')]=_0x449058['attributes'][_0xcd16('0x41')]?_0x449058[_0xcd16('0x40')]:_0x476f24[_0xcd16('0x3a')];if(_0x1297a0[_0xcd16('0x3d')][_0xcd16('0x4b')]){_0x449058[_0xcd16('0x4c')]=[{'all':!![]}];}_0x449058=_[_0xcd16('0x52')]({},_0x449058,_0x1297a0[_0xcd16('0x49')]);return db[_0xcd16('0x4a')]['find'](_0x449058)[_0xcd16('0x1c')](handleEntityNotFound(_0xf8bcd1,null))['then'](respondWithResult(_0xf8bcd1,null))['catch'](handleError(_0xf8bcd1,null));};exports[_0xcd16('0x53')]=function(_0x49d46e,_0x492f7d){return db['ZohoAccount']['create'](_0x49d46e[_0xcd16('0x54')],{})[_0xcd16('0x1c')](respondWithResult(_0x492f7d,0xc9))[_0xcd16('0x25')](handleError(_0x492f7d,null));};exports[_0xcd16('0x31')]=function(_0x25920b,_0xf0f3ae){if(_0x25920b[_0xcd16('0x54')]['id']){delete _0x25920b[_0xcd16('0x54')]['id'];}return db[_0xcd16('0x4a')][_0xcd16('0x55')]({'where':{'id':_0x25920b['params']['id']}})[_0xcd16('0x1c')](handleEntityNotFound(_0xf0f3ae,null))[_0xcd16('0x1c')](saveUpdates(_0x25920b[_0xcd16('0x54')],null))['then'](respondWithResult(_0xf0f3ae,null))['catch'](handleError(_0xf0f3ae,null));};exports[_0xcd16('0x32')]=function(_0x2cb5bc,_0x396e0f){return db[_0xcd16('0x4a')][_0xcd16('0x55')]({'where':{'id':_0x2cb5bc['params']['id']}})['then'](handleEntityNotFound(_0x396e0f,null))['then'](removeEntity(_0x396e0f,null))[_0xcd16('0x25')](handleError(_0x396e0f,null));};exports[_0xcd16('0x56')]=function(_0x5924bf,_0xeb0c2a,_0x271a0c){var _0x4af111={};var _0x127bdb={};var _0x414ab3;var _0x441f7f;return db[_0xcd16('0x4a')]['findOne']({'where':{'id':_0x5924bf[_0xcd16('0x50')]['id']}})[_0xcd16('0x1c')](handleEntityNotFound(_0xeb0c2a,null))[_0xcd16('0x1c')](function(_0x575497){if(_0x575497){_0x414ab3=_0x575497;_0x127bdb[_0xcd16('0x3a')]=_[_0xcd16('0x3c')](db['ZohoConfiguration'][_0xcd16('0x37')]);_0x127bdb[_0xcd16('0x3d')]=_['keys'](_0x5924bf[_0xcd16('0x3d')]);_0x127bdb[_0xcd16('0x3e')]=_[_0xcd16('0x3f')](_0x127bdb[_0xcd16('0x3a')],_0x127bdb[_0xcd16('0x3d')]);_0x4af111[_0xcd16('0x40')]=_[_0xcd16('0x3f')](_0x127bdb[_0xcd16('0x3a')],qs[_0xcd16('0x51')](_0x5924bf[_0xcd16('0x3d')]['fields']));_0x4af111[_0xcd16('0x40')]=_0x4af111[_0xcd16('0x40')][_0xcd16('0x41')]?_0x4af111['attributes']:_0x127bdb[_0xcd16('0x3a')];_0x4af111[_0xcd16('0x43')]=qs[_0xcd16('0x44')](_0x5924bf[_0xcd16('0x3d')][_0xcd16('0x44')]);_0x4af111[_0xcd16('0x45')]=qs[_0xcd16('0x3e')](_[_0xcd16('0x46')](_0x5924bf[_0xcd16('0x3d')],_0x127bdb[_0xcd16('0x3e')]));if(_0x5924bf[_0xcd16('0x3d')][_0xcd16('0x47')]){_0x4af111[_0xcd16('0x45')]=_['merge'](_0x4af111[_0xcd16('0x45')],{'$or':_[_0xcd16('0x3b')](_0x4af111[_0xcd16('0x40')],function(_0x45b87a){var _0x1df335={};_0x1df335[_0x45b87a]={'$like':'%'+_0x5924bf[_0xcd16('0x3d')][_0xcd16('0x47')]+'%'};return _0x1df335;})});}_0x4af111=_[_0xcd16('0x52')]({},_0x4af111,_0x5924bf[_0xcd16('0x49')]);return _0x414ab3[_0xcd16('0x56')](_0x4af111);}})[_0xcd16('0x1c')](function(_0x7c563b){if(_0x7c563b){_0x441f7f=_0x7c563b[_0xcd16('0x41')];if(!_0x5924bf['query'][_0xcd16('0x57')]('nolimit')){_0x4af111[_0xcd16('0x2b')]=qs[_0xcd16('0x2b')](_0x5924bf[_0xcd16('0x3d')][_0xcd16('0x2b')]);_0x4af111[_0xcd16('0x2a')]=qs[_0xcd16('0x2a')](_0x5924bf['query'][_0xcd16('0x2a')]);}return _0x414ab3[_0xcd16('0x56')](_0x4af111);}})[_0xcd16('0x1c')](function(_0xec0d99){if(_0xec0d99){return _0xec0d99?{'count':_0x441f7f,'rows':_0xec0d99}:null;}})['then'](respondWithResult(_0xeb0c2a,null))['catch'](handleError(_0xeb0c2a,null));};exports[_0xcd16('0x58')]=function(_0x21102c,_0x3da07d,_0x390975){if(_0x21102c[_0xcd16('0x54')]['id']){delete _0x21102c[_0xcd16('0x54')]['id'];}return db[_0xcd16('0x4a')][_0xcd16('0x59')]({'where':{'id':_0x21102c[_0xcd16('0x50')]['id']}})[_0xcd16('0x1c')](handleEntityNotFound(_0x3da07d,null))['then'](function(_0x2d3c14){if(_0x2d3c14){_0x21102c[_0xcd16('0x54')][_0xcd16('0x5a')]=_0x2d3c14['id'];_0x21102c[_0xcd16('0x54')][_0xcd16('0x5b')]=integrations['getSubjects'](_0x21102c['body'][_0xcd16('0x5c')],_0x21102c['body'][_0xcd16('0x38')]);_0x21102c['body'][_0xcd16('0x5d')]=integrations[_0xcd16('0x5e')](_0x21102c[_0xcd16('0x54')][_0xcd16('0x5c')],_0x21102c[_0xcd16('0x54')]['type']);return db['ZohoConfiguration'][_0xcd16('0x53')](_0x21102c[_0xcd16('0x54')],{'include':[{'model':db[_0xcd16('0x5f')],'as':'Subjects'},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x3da07d,null))[_0xcd16('0x25')](handleError(_0x3da07d,null));};function getAccessToken(_0x2dfe99){return new Promise(function(_0x21b6c4,_0x2619a0){var _0x56b157;switch(_0x2dfe99[_0xcd16('0x60')]){case'US':_0x56b157=_0xcd16('0x61');break;case'AU':_0x56b157='https://accounts.zoho.com.au';break;case'EU':_0x56b157=_0xcd16('0x62');break;case'IN':_0x56b157=_0xcd16('0x63');break;case'CN':_0x56b157=_0xcd16('0x64');break;default:_0x56b157=_0xcd16('0x62');break;}var _0x50e961={'method':_0xcd16('0x65'),'uri':_0x56b157+_0xcd16('0x66'),'qs':{'refresh_token':_0x2dfe99[_0xcd16('0x67')],'client_id':_0x2dfe99[_0xcd16('0x68')],'client_secret':_0x2dfe99[_0xcd16('0x69')],'grant_type':_0xcd16('0x6a')},'json':!![]};return rp(_0x50e961)[_0xcd16('0x1c')](function(_0x4b1abd){if(_0x4b1abd['access_token']){_0x21b6c4(_0x4b1abd['access_token']);}else{_0x2619a0(_0xcd16('0x6b'));}})[_0xcd16('0x25')](function(_0x7fdced){_0x2619a0(_0x7fdced);});});}exports[_0xcd16('0x6c')]=function(_0x36ffb2,_0x173346,_0x554a43){var _0x47409d,_0x1a0668,_0x1ad268,_0x5614af,_0x3650aa;return db['ZohoAccount'][_0xcd16('0x59')]({'where':{'id':_0x36ffb2[_0xcd16('0x50')]['id']},'attributes':['id',_0xcd16('0x6d'),'zone',_0xcd16('0x68'),'clientSecret','serverUrl',_0xcd16('0x23'),_0xcd16('0x67')]})['then'](handleEntityNotFound(_0x173346,null))[_0xcd16('0x1c')](function(_0x27287f){_0x3650aa=_0x27287f;_0x47409d=_0x3650aa['host'];_0x1a0668=_0x47409d===_0xcd16('0x6e')?'eu':_0xcd16('0x6f');_0x1ad268=_0x3650aa[_0xcd16('0x70')];var _0x2ea3da=_0x1ad268[_0xcd16('0x71')](-0x1);if(_0x2ea3da==='/'||_0x2ea3da==='\x5c'||_0x2ea3da===':'){_0x1ad268=_0x1ad268['substring'](0x0,_0x1ad268[_0xcd16('0x72')](_0x2ea3da));}if(!_0x3650aa[_0xcd16('0x67')]){throw new Error(_0xcd16('0x73'));}return getAccessToken(_0x3650aa);})[_0xcd16('0x1c')](function(_0x31a30f){if(_0x31a30f){return rp({'method':'GET','uri':util[_0xcd16('0x74')](_0xcd16('0x75'),_0x1a0668),'qs':{'module':_0xcd16('0x76')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x31a30f},'json':!![]});}})[_0xcd16('0x1c')](function(_0x3e6e92){if(_0x3e6e92){if(_0x3e6e92[_0xcd16('0x77')]&&_0x3e6e92[_0xcd16('0x77')]['error']){throw new Error(_0x3e6e92[_0xcd16('0x77')][_0xcd16('0x22')][_0xcd16('0x24')]);}var _0x4e8e63=[];var _0x284327=[];var _0x4f3e25=[_0xcd16('0x78'),_0xcd16('0x79'),_0xcd16('0x7a'),_0xcd16('0x7b'),_0xcd16('0x7c'),_0xcd16('0x7d'),_0xcd16('0x7e'),'Call_Type'];_0x284327=_[_0xcd16('0x7f')](_0x3e6e92[_0xcd16('0x51')],function(_0x674452){return _0x4f3e25[_0xcd16('0x80')](_0x674452['api_name']);});for(var _0x15a691=0x0;_0x15a691<_0x284327[_0xcd16('0x41')];_0x15a691++){if(_0x284327[_0x15a691]['system_mandatory']===![]){_0x4e8e63[_0xcd16('0x81')]({'id':_0x284327[_0x15a691]['id'],'name':_0x284327[_0x15a691][_0xcd16('0x82')],'custom':_0x284327[_0x15a691][_0xcd16('0x83')],'options':_0x284327[_0x15a691][_0xcd16('0x84')]===_0xcd16('0x85')&&_0x284327[_0x15a691][_0xcd16('0x86')][_0xcd16('0x41')]>-0x1?_[_0xcd16('0x3b')](_0x284327[_0x15a691][_0xcd16('0x86')],function(_0xbf87b9){return{'name':_0xbf87b9,'value':_0xbf87b9};}):[]});}}return{'count':_0x4e8e63[_0xcd16('0x41')],'rows':_0x4e8e63};}else{return{'count':0x0,'rows':[]};}})[_0xcd16('0x1c')](respondWithResult(_0x173346,null))[_0xcd16('0x25')](function(_0x5ebda3){var _0xeae4ca=_0x36ffb2['query'][_0xcd16('0x87')]?0x1f4:_0x5ebda3[_0xcd16('0x88')]||0x1f4;logger[_0xcd16('0x22')]('getFields,\x20%s,\x20%s,\x20%s',_0xcd16('0x6c'),_0xeae4ca,JSON[_0xcd16('0x89')](_0x5ebda3));delete _0x5ebda3['name'];if(_0xeae4ca===0x191){_0xeae4ca=0x190;}_0x173346[_0xcd16('0x27')](_0xeae4ca)['send'](_0x36ffb2[_0xcd16('0x3d')][_0xcd16('0x87')]?{'message':'Wrong\x20credentials','statusCode':_0x5ebda3[_0xcd16('0x88')]}:_0x5ebda3);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index ff1ba45..8d26a40 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 _0xfb1a=['bluebird','path','rimraf','../../config/environment','./intZohoAccount.attributes','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','parse','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','application/x-www-form-urlencoded','then','refreshToken','lodash','util','../../config/logger','moment'];(function(_0x39a210,_0x4e78c9){var _0x3fa6d5=function(_0x3e57a9){while(--_0x3e57a9){_0x39a210['push'](_0x39a210['shift']());}};_0x3fa6d5(++_0x4e78c9);}(_0xfb1a,0x1d5));var _0xafb1=function(_0x402146,_0x5ed9cf){_0x402146=_0x402146-0x0;var _0x2a4892=_0xfb1a[_0x402146];return _0x2a4892;};'use strict';var _=require(_0xafb1('0x0'));var util=require(_0xafb1('0x1'));var logger=require(_0xafb1('0x2'))('api');var moment=require(_0xafb1('0x3'));var BPromise=require(_0xafb1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xafb1('0x5'));var rimraf=require(_0xafb1('0x6'));var config=require(_0xafb1('0x7'));var attributes=require(_0xafb1('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x35224b,_0x4dd64b){return _0x35224b[_0xafb1('0x9')](_0xafb1('0xa'),attributes,{'tableName':_0xafb1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2838fd,_0x514856,_0x406451){if(_0x2838fd[_0xafb1('0xc')](_0xafb1('0xd'))||_0x2838fd[_0xafb1('0xc')](_0xafb1('0xe'))||_0x2838fd[_0xafb1('0xc')](_0xafb1('0xf'))||_0x2838fd['changed'](_0xafb1('0x10'))||_0x2838fd[_0xafb1('0xc')](_0xafb1('0x11'))||_0x2838fd[_0xafb1('0xc')](_0xafb1('0x12'))){var _0x583d30,_0x75cc7c;_0x583d30=_0x2838fd[_0xafb1('0xe')];var _0xa8b21=_0x583d30[_0xafb1('0x13')](-0x1);if(_0xa8b21==='/'||_0xa8b21==='\x5c'||_0xa8b21===':'){_0x583d30=_0x583d30[_0xafb1('0x14')](0x0,_0x583d30[_0xafb1('0x15')](_0xa8b21));}switch(_0x2838fd[_0xafb1('0xd')]){case'US':_0x75cc7c=_0xafb1('0x16');break;case'AU':_0x75cc7c=_0xafb1('0x17');break;case'IN':_0x75cc7c=_0xafb1('0x18');break;case'CN':_0x75cc7c=_0xafb1('0x19');break;default:_0x75cc7c=_0xafb1('0x1a');break;}var _0x4ce623={'method':_0xafb1('0x1b'),'uri':_0x75cc7c+_0xafb1('0x1c'),'form':{'grant_type':_0xafb1('0x1d'),'client_id':_0x2838fd[_0xafb1('0xf')],'client_secret':_0x2838fd[_0xafb1('0x10')],'redirect_uri':_0x2838fd[_0xafb1('0xe')],'code':_0x2838fd['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x4ce623)['then'](function(_0x2b8cb9){var _0x2a2020=JSON[_0xafb1('0x1e')](_0x2b8cb9);if(_0x2a2020['refresh_token']){_0x2838fd['refreshToken']=_0x2a2020[_0xafb1('0x1f')];logger[_0xafb1('0x20')](util[_0xafb1('0x21')](_0xafb1('0x22'),_0x2838fd[_0xafb1('0x23')],_0x2838fd['id']));}else{logger[_0xafb1('0x24')](util[_0xafb1('0x21')](_0xafb1('0x25'),_0x2838fd['name'],_0x2838fd['id']),util[_0xafb1('0x26')](_0x2a2020,{'showHidden':![],'depth':null}));}return _0x406451(null,_0x514856);})[_0xafb1('0x27')](function(_0x16922e){logger[_0xafb1('0x24')](util[_0xafb1('0x21')](_0xafb1('0x25'),_0x2838fd['name'],_0x2838fd['id']),util[_0xafb1('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x406451(_0x16922e);});}else{return _0x406451(null,_0x514856);}},'beforeUpdate':function(_0x46481d,_0x8cf014,_0x447b9c){if(_0x46481d[_0xafb1('0xc')](_0xafb1('0xd'))||_0x46481d[_0xafb1('0xc')]('serverUrl')||_0x46481d[_0xafb1('0xc')](_0xafb1('0xf'))||_0x46481d[_0xafb1('0xc')](_0xafb1('0x10'))||_0x46481d['changed'](_0xafb1('0x11'))||_0x46481d[_0xafb1('0xc')](_0xafb1('0x12'))){var _0x38157a,_0x2dd062;_0x38157a=_0x46481d[_0xafb1('0xe')];var _0x2dd422=_0x38157a['slice'](-0x1);if(_0x2dd422==='/'||_0x2dd422==='\x5c'||_0x2dd422===':'){_0x38157a=_0x38157a['substring'](0x0,_0x38157a['lastIndexOf'](_0x2dd422));}switch(_0x46481d[_0xafb1('0xd')]){case'US':_0x2dd062='https://accounts.zoho.com';break;case'AU':_0x2dd062=_0xafb1('0x17');break;case'IN':_0x2dd062=_0xafb1('0x18');break;case'CN':_0x2dd062=_0xafb1('0x19');break;default:_0x2dd062=_0xafb1('0x1a');break;}var _0x5b9f41={'method':_0xafb1('0x1b'),'uri':_0x2dd062+'/oauth/v2/token','form':{'grant_type':_0xafb1('0x1d'),'client_id':_0x46481d[_0xafb1('0xf')],'client_secret':_0x46481d['clientSecret'],'redirect_uri':_0x46481d[_0xafb1('0xe')],'code':_0x46481d[_0xafb1('0x11')]},'headers':{'Content-Type':_0xafb1('0x28')}};return rp(_0x5b9f41)[_0xafb1('0x29')](function(_0x14b2f2){var _0x18d4e6=JSON[_0xafb1('0x1e')](_0x14b2f2);if(_0x18d4e6[_0xafb1('0x1f')]){_0x46481d[_0xafb1('0x2a')]=_0x18d4e6['refresh_token'];logger['info'](util[_0xafb1('0x21')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x46481d[_0xafb1('0x23')],_0x46481d['id']));}else{logger[_0xafb1('0x24')](util[_0xafb1('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x46481d[_0xafb1('0x23')],_0x46481d['id']),util[_0xafb1('0x26')](_0x18d4e6,{'showHidden':![],'depth':null}));}return _0x447b9c(null,_0x8cf014);})[_0xafb1('0x27')](function(_0x371b66){logger[_0xafb1('0x24')](util[_0xafb1('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x46481d[_0xafb1('0x23')],_0x46481d['id']),util[_0xafb1('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x447b9c(_0x371b66);});}else{return _0x447b9c(null,_0x8cf014);}}}});}; \ No newline at end of file +var _0x4249=['format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','then','parse','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','application/x-www-form-urlencoded','refresh_token','refreshToken'];(function(_0x560821,_0x2a9a26){var _0x3496f8=function(_0x2cdb1d){while(--_0x2cdb1d){_0x560821['push'](_0x560821['shift']());}};_0x3496f8(++_0x2a9a26);}(_0x4249,0x87));var _0x9424=function(_0x569ed1,_0x2d7f71){_0x569ed1=_0x569ed1-0x0;var _0x33e50a=_0x4249[_0x569ed1];return _0x33e50a;};'use strict';var _=require(_0x9424('0x0'));var util=require(_0x9424('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9424('0x2'));var BPromise=require('bluebird');var rp=require(_0x9424('0x3'));var fs=require('fs');var path=require(_0x9424('0x4'));var rimraf=require(_0x9424('0x5'));var config=require(_0x9424('0x6'));var attributes=require(_0x9424('0x7'));var integrations=require(_0x9424('0x8'));module[_0x9424('0x9')]=function(_0x4ad522,_0x2f4b95){return _0x4ad522[_0x9424('0xa')](_0x9424('0xb'),attributes,{'tableName':_0x9424('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x35f08e,_0x41178c,_0xe37bd3){if(_0x35f08e[_0x9424('0xd')](_0x9424('0xe'))||_0x35f08e[_0x9424('0xd')](_0x9424('0xf'))||_0x35f08e[_0x9424('0xd')](_0x9424('0x10'))||_0x35f08e[_0x9424('0xd')](_0x9424('0x11'))||_0x35f08e[_0x9424('0xd')](_0x9424('0x12'))||_0x35f08e['changed'](_0x9424('0x13'))){var _0x476a77,_0x43f2ad;_0x476a77=_0x35f08e[_0x9424('0xf')];var _0x5f0710=_0x476a77[_0x9424('0x14')](-0x1);if(_0x5f0710==='/'||_0x5f0710==='\x5c'||_0x5f0710===':'){_0x476a77=_0x476a77[_0x9424('0x15')](0x0,_0x476a77[_0x9424('0x16')](_0x5f0710));}switch(_0x35f08e[_0x9424('0xe')]){case'US':_0x43f2ad=_0x9424('0x17');break;case'AU':_0x43f2ad=_0x9424('0x18');break;case'IN':_0x43f2ad=_0x9424('0x19');break;case'CN':_0x43f2ad=_0x9424('0x1a');break;default:_0x43f2ad=_0x9424('0x1b');break;}var _0xcdeeb9={'method':_0x9424('0x1c'),'uri':_0x43f2ad+_0x9424('0x1d'),'form':{'grant_type':'authorization_code','client_id':_0x35f08e['clientId'],'client_secret':_0x35f08e[_0x9424('0x11')],'redirect_uri':_0x35f08e['serverUrl'],'code':_0x35f08e[_0x9424('0x12')]},'headers':{'Content-Type':_0x9424('0x1e')}};return rp(_0xcdeeb9)['then'](function(_0x4b9f51){var _0x2358de=JSON['parse'](_0x4b9f51);if(_0x2358de[_0x9424('0x1f')]){_0x35f08e[_0x9424('0x20')]=_0x2358de[_0x9424('0x1f')];logger['info'](util[_0x9424('0x21')](_0x9424('0x22'),_0x35f08e[_0x9424('0x23')],_0x35f08e['id']));}else{logger[_0x9424('0x24')](util[_0x9424('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x35f08e[_0x9424('0x23')],_0x35f08e['id']),util[_0x9424('0x25')](_0x2358de,{'showHidden':![],'depth':null}));}return _0xe37bd3(null,_0x41178c);})[_0x9424('0x26')](function(_0x534c6d){logger[_0x9424('0x24')](util[_0x9424('0x21')](_0x9424('0x27'),_0x35f08e['name'],_0x35f08e['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0xe37bd3(_0x534c6d);});}else{return _0xe37bd3(null,_0x41178c);}},'beforeUpdate':function(_0x1bae2,_0x577e72,_0x4b0825){if(_0x1bae2[_0x9424('0xd')]('zone')||_0x1bae2[_0x9424('0xd')]('serverUrl')||_0x1bae2['changed']('clientId')||_0x1bae2[_0x9424('0xd')](_0x9424('0x11'))||_0x1bae2['changed']('code')||_0x1bae2[_0x9424('0xd')](_0x9424('0x13'))){var _0x205a37,_0x1c1796;_0x205a37=_0x1bae2[_0x9424('0xf')];var _0x25c3ca=_0x205a37[_0x9424('0x14')](-0x1);if(_0x25c3ca==='/'||_0x25c3ca==='\x5c'||_0x25c3ca===':'){_0x205a37=_0x205a37['substring'](0x0,_0x205a37['lastIndexOf'](_0x25c3ca));}switch(_0x1bae2[_0x9424('0xe')]){case'US':_0x1c1796=_0x9424('0x17');break;case'AU':_0x1c1796='https://accounts.zoho.com.au';break;case'IN':_0x1c1796=_0x9424('0x19');break;case'CN':_0x1c1796=_0x9424('0x1a');break;default:_0x1c1796=_0x9424('0x1b');break;}var _0x1cab2b={'method':'POST','uri':_0x1c1796+_0x9424('0x1d'),'form':{'grant_type':'authorization_code','client_id':_0x1bae2[_0x9424('0x10')],'client_secret':_0x1bae2[_0x9424('0x11')],'redirect_uri':_0x1bae2[_0x9424('0xf')],'code':_0x1bae2[_0x9424('0x12')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x1cab2b)[_0x9424('0x28')](function(_0x232e11){var _0x556a27=JSON[_0x9424('0x29')](_0x232e11);if(_0x556a27[_0x9424('0x1f')]){_0x1bae2[_0x9424('0x20')]=_0x556a27[_0x9424('0x1f')];logger['info'](util[_0x9424('0x21')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1bae2[_0x9424('0x23')],_0x1bae2['id']));}else{logger[_0x9424('0x24')](util[_0x9424('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1bae2['name'],_0x1bae2['id']),util[_0x9424('0x25')](_0x556a27,{'showHidden':![],'depth':null}));}return _0x4b0825(null,_0x577e72);})[_0x9424('0x26')](function(_0x44f862){logger[_0x9424('0x24')](util[_0x9424('0x21')](_0x9424('0x27'),_0x1bae2[_0x9424('0x23')],_0x1bae2['id']),util[_0x9424('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x4b0825(_0x44f862);});}else{return _0x4b0825(null,_0x577e72);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index fc63d6d..089843f 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 _0xa184=['error','code','message','result','GetZohoAccount','ZohoAccount','options','where','attributes','limit','map','include','model','catch','ShowZohoAccount','find','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x32ca62,_0x18fe6a){var _0x175d88=function(_0x3bc7ec){while(--_0x3bc7ec){_0x32ca62['push'](_0x32ca62['shift']());}};_0x175d88(++_0x18fe6a);}(_0xa184,0x110));var _0x4a18=function(_0x3f993e,_0x2d5757){_0x3f993e=_0x3f993e-0x0;var _0x39c135=_0xa184[_0x3f993e];return _0x39c135;};'use strict';var _=require(_0x4a18('0x0'));var util=require(_0x4a18('0x1'));var moment=require(_0x4a18('0x2'));var BPromise=require(_0x4a18('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a18('0x4'))['db'];var utils=require(_0x4a18('0x5'));var logger=require('../../config/logger')(_0x4a18('0x6'));var config=require(_0x4a18('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4a18('0x8')][_0x4a18('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24609f,_0x546947,_0x23669b){return new BPromise(function(_0x372522,_0x367a24){return client['request'](_0x24609f,_0x23669b)[_0x4a18('0xa')](function(_0x94be28){logger[_0x4a18('0xb')](_0x4a18('0xc'),_0x546947,_0x4a18('0xd'));logger[_0x4a18('0xe')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x546947,_0x4a18('0xd'),JSON[_0x4a18('0xf')](_0x94be28));if(_0x94be28[_0x4a18('0x10')]){if(_0x94be28['error'][_0x4a18('0x11')]===0x1f4){logger[_0x4a18('0x10')](_0x4a18('0xc'),_0x546947,_0x94be28[_0x4a18('0x10')][_0x4a18('0x12')]);return _0x367a24(_0x94be28[_0x4a18('0x10')][_0x4a18('0x12')]);}logger[_0x4a18('0x10')](_0x4a18('0xc'),_0x546947,_0x94be28['error'][_0x4a18('0x12')]);return _0x372522(_0x94be28[_0x4a18('0x10')][_0x4a18('0x12')]);}else{logger[_0x4a18('0xb')](_0x4a18('0xc'),_0x546947,'request\x20sent');_0x372522(_0x94be28[_0x4a18('0x13')][_0x4a18('0x12')]);}})['catch'](function(_0x5f1588){logger['error'](_0x4a18('0xc'),_0x546947,_0x5f1588);_0x367a24(_0x5f1588);});});}exports[_0x4a18('0x14')]=function(_0x3baf6d){var _0x27995a=this;return new Promise(function(_0xb44456,_0x13ae66){return db[_0x4a18('0x15')]['findAll']({'raw':_0x3baf6d[_0x4a18('0x16')]?_0x3baf6d[_0x4a18('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3baf6d[_0x4a18('0x16')]?_0x3baf6d[_0x4a18('0x16')][_0x4a18('0x17')]||null:null,'attributes':_0x3baf6d[_0x4a18('0x16')]?_0x3baf6d[_0x4a18('0x16')][_0x4a18('0x18')]||null:null,'limit':_0x3baf6d[_0x4a18('0x16')]?_0x3baf6d[_0x4a18('0x16')][_0x4a18('0x19')]||null:null,'include':_0x3baf6d[_0x4a18('0x16')]?_0x3baf6d['options']['include']?_[_0x4a18('0x1a')](_0x3baf6d[_0x4a18('0x16')][_0x4a18('0x1b')],function(_0x5e5531){return{'model':db[_0x5e5531[_0x4a18('0x1c')]],'as':_0x5e5531['as'],'attributes':_0x5e5531[_0x4a18('0x18')],'include':_0x5e5531['include']?_[_0x4a18('0x1a')](_0x5e5531['include'],function(_0xb99fed){return{'model':db[_0xb99fed['model']],'as':_0xb99fed['as'],'attributes':_0xb99fed[_0x4a18('0x18')],'include':_0xb99fed[_0x4a18('0x1b')]?_[_0x4a18('0x1a')](_0xb99fed[_0x4a18('0x1b')],function(_0xa360c3){return{'model':db[_0xa360c3['model']],'as':_0xa360c3['as'],'attributes':_0xa360c3[_0x4a18('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4a18('0xa')](function(_0xa597df){logger[_0x4a18('0xb')](_0x4a18('0x14'),_0x3baf6d);logger[_0x4a18('0xe')]('GetZohoAccount',_0x3baf6d,JSON['stringify'](_0xa597df));_0xb44456(_0xa597df);})[_0x4a18('0x1d')](function(_0x5cd8a1){logger[_0x4a18('0x10')]('GetZohoAccount',_0x5cd8a1[_0x4a18('0x12')],_0x3baf6d);_0x13ae66(_0x27995a[_0x4a18('0x10')](0x1f4,_0x5cd8a1['message']));});});};exports[_0x4a18('0x1e')]=function(_0x3197b4){var _0x34fb38=this;return new Promise(function(_0x254e54,_0x5d93c4){return db['ZohoAccount'][_0x4a18('0x1f')]({'raw':_0x3197b4[_0x4a18('0x16')]?_0x3197b4['options']['raw']===undefined?!![]:![]:!![],'where':_0x3197b4[_0x4a18('0x16')]?_0x3197b4[_0x4a18('0x16')]['where']||null:null,'attributes':_0x3197b4[_0x4a18('0x16')]?_0x3197b4[_0x4a18('0x16')][_0x4a18('0x18')]||null:null,'include':_0x3197b4['options']?_0x3197b4['options']['include']?_[_0x4a18('0x1a')](_0x3197b4[_0x4a18('0x16')][_0x4a18('0x1b')],function(_0x370cc9){return{'model':db[_0x370cc9[_0x4a18('0x1c')]],'as':_0x370cc9['as'],'attributes':_0x370cc9[_0x4a18('0x18')],'include':_0x370cc9[_0x4a18('0x1b')]?_['map'](_0x370cc9['include'],function(_0xd9576a){return{'model':db[_0xd9576a[_0x4a18('0x1c')]],'as':_0xd9576a['as'],'attributes':_0xd9576a['attributes'],'include':_0xd9576a[_0x4a18('0x1b')]?_[_0x4a18('0x1a')](_0xd9576a[_0x4a18('0x1b')],function(_0x3fb0fc){return{'model':db[_0x3fb0fc[_0x4a18('0x1c')]],'as':_0x3fb0fc['as'],'attributes':_0x3fb0fc[_0x4a18('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4be933){logger[_0x4a18('0xb')](_0x4a18('0x1e'),_0x3197b4);logger['debug'](_0x4a18('0x1e'),_0x3197b4,JSON['stringify'](_0x4be933));_0x254e54(_0x4be933);})['catch'](function(_0x3545b4){logger[_0x4a18('0x10')](_0x4a18('0x1e'),_0x3545b4[_0x4a18('0x12')],_0x3197b4);_0x5d93c4(_0x34fb38[_0x4a18('0x10')](0x1f4,_0x3545b4[_0x4a18('0x12')]));});});}; \ No newline at end of file +var _0xe7c3=['request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowZohoAccount','ZohoAccount','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','ZohoAccount,\x20%s,\x20%s'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe7c3,0x173));var _0x3e7c=function(_0x176a28,_0x568a39){_0x176a28=_0x176a28-0x0;var _0xe9dae5=_0xe7c3[_0x176a28];return _0xe9dae5;};'use strict';var _=require(_0x3e7c('0x0'));var util=require('util');var moment=require(_0x3e7c('0x1'));var BPromise=require(_0x3e7c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e7c('0x3'));var db=require(_0x3e7c('0x4'))['db'];var utils=require(_0x3e7c('0x5'));var logger=require('../../config/logger')(_0x3e7c('0x6'));var config=require(_0x3e7c('0x7'));var jayson=require(_0x3e7c('0x8'));var client=jayson['client'][_0x3e7c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d706d,_0x33f930,_0x2f8bcd){return new BPromise(function(_0x4fc98a,_0x197069){return client[_0x3e7c('0xa')](_0x1d706d,_0x2f8bcd)[_0x3e7c('0xb')](function(_0x33ab49){logger[_0x3e7c('0xc')](_0x3e7c('0xd'),_0x33f930,_0x3e7c('0xe'));logger[_0x3e7c('0xf')](_0x3e7c('0x10'),_0x33f930,_0x3e7c('0xe'),JSON[_0x3e7c('0x11')](_0x33ab49));if(_0x33ab49[_0x3e7c('0x12')]){if(_0x33ab49['error'][_0x3e7c('0x13')]===0x1f4){logger['error'](_0x3e7c('0xd'),_0x33f930,_0x33ab49['error'][_0x3e7c('0x14')]);return _0x197069(_0x33ab49[_0x3e7c('0x12')]['message']);}logger[_0x3e7c('0x12')](_0x3e7c('0xd'),_0x33f930,_0x33ab49[_0x3e7c('0x12')]['message']);return _0x4fc98a(_0x33ab49['error']['message']);}else{logger['info'](_0x3e7c('0xd'),_0x33f930,_0x3e7c('0xe'));_0x4fc98a(_0x33ab49[_0x3e7c('0x15')][_0x3e7c('0x14')]);}})[_0x3e7c('0x16')](function(_0x5381a8){logger['error'](_0x3e7c('0xd'),_0x33f930,_0x5381a8);_0x197069(_0x5381a8);});});}exports[_0x3e7c('0x17')]=function(_0x10fdf6){var _0xabe008=this;return new Promise(function(_0x1c1d8c,_0x62bed6){return db['ZohoAccount'][_0x3e7c('0x18')]({'raw':_0x10fdf6[_0x3e7c('0x19')]?_0x10fdf6['options'][_0x3e7c('0x1a')]===undefined?!![]:![]:!![],'where':_0x10fdf6[_0x3e7c('0x19')]?_0x10fdf6[_0x3e7c('0x19')][_0x3e7c('0x1b')]||null:null,'attributes':_0x10fdf6[_0x3e7c('0x19')]?_0x10fdf6['options'][_0x3e7c('0x1c')]||null:null,'limit':_0x10fdf6['options']?_0x10fdf6['options'][_0x3e7c('0x1d')]||null:null,'include':_0x10fdf6['options']?_0x10fdf6[_0x3e7c('0x19')][_0x3e7c('0x1e')]?_[_0x3e7c('0x1f')](_0x10fdf6[_0x3e7c('0x19')][_0x3e7c('0x1e')],function(_0x4ebfa5){return{'model':db[_0x4ebfa5[_0x3e7c('0x20')]],'as':_0x4ebfa5['as'],'attributes':_0x4ebfa5[_0x3e7c('0x1c')],'include':_0x4ebfa5[_0x3e7c('0x1e')]?_[_0x3e7c('0x1f')](_0x4ebfa5[_0x3e7c('0x1e')],function(_0x7539c1){return{'model':db[_0x7539c1[_0x3e7c('0x20')]],'as':_0x7539c1['as'],'attributes':_0x7539c1[_0x3e7c('0x1c')],'include':_0x7539c1[_0x3e7c('0x1e')]?_['map'](_0x7539c1[_0x3e7c('0x1e')],function(_0x2db463){return{'model':db[_0x2db463['model']],'as':_0x2db463['as'],'attributes':_0x2db463[_0x3e7c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3e7c('0xb')](function(_0x5e4ee3){logger[_0x3e7c('0xc')](_0x3e7c('0x17'),_0x10fdf6);logger[_0x3e7c('0xf')](_0x3e7c('0x17'),_0x10fdf6,JSON['stringify'](_0x5e4ee3));_0x1c1d8c(_0x5e4ee3);})[_0x3e7c('0x16')](function(_0x411b28){logger[_0x3e7c('0x12')](_0x3e7c('0x17'),_0x411b28[_0x3e7c('0x14')],_0x10fdf6);_0x62bed6(_0xabe008[_0x3e7c('0x12')](0x1f4,_0x411b28[_0x3e7c('0x14')]));});});};exports[_0x3e7c('0x21')]=function(_0x3de830){var _0xdaaa0f=this;return new Promise(function(_0x386666,_0x2b1054){return db[_0x3e7c('0x22')]['find']({'raw':_0x3de830[_0x3e7c('0x19')]?_0x3de830['options']['raw']===undefined?!![]:![]:!![],'where':_0x3de830[_0x3e7c('0x19')]?_0x3de830[_0x3e7c('0x19')]['where']||null:null,'attributes':_0x3de830[_0x3e7c('0x19')]?_0x3de830[_0x3e7c('0x19')][_0x3e7c('0x1c')]||null:null,'include':_0x3de830['options']?_0x3de830['options']['include']?_[_0x3e7c('0x1f')](_0x3de830[_0x3e7c('0x19')]['include'],function(_0x17c394){return{'model':db[_0x17c394[_0x3e7c('0x20')]],'as':_0x17c394['as'],'attributes':_0x17c394[_0x3e7c('0x1c')],'include':_0x17c394[_0x3e7c('0x1e')]?_['map'](_0x17c394[_0x3e7c('0x1e')],function(_0x593038){return{'model':db[_0x593038[_0x3e7c('0x20')]],'as':_0x593038['as'],'attributes':_0x593038[_0x3e7c('0x1c')],'include':_0x593038['include']?_[_0x3e7c('0x1f')](_0x593038['include'],function(_0x3282f2){return{'model':db[_0x3282f2[_0x3e7c('0x20')]],'as':_0x3282f2['as'],'attributes':_0x3282f2['attributes']};}):[]};}):[]};}):[]:[]})[_0x3e7c('0xb')](function(_0x5d4948){logger[_0x3e7c('0xc')]('ShowZohoAccount',_0x3de830);logger['debug'](_0x3e7c('0x21'),_0x3de830,JSON[_0x3e7c('0x11')](_0x5d4948));_0x386666(_0x5d4948);})[_0x3e7c('0x16')](function(_0x93c7dc){logger[_0x3e7c('0x12')](_0x3e7c('0x21'),_0x93c7dc[_0x3e7c('0x14')],_0x3de830);_0x2b1054(_0xdaaa0f[_0x3e7c('0x12')](0x1f4,_0x93c7dc['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 3658257..bed2571 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 _0xb0ab=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getDescriptions','post','put','/:id','update','delete','exports','multer'];(function(_0x41b57f,_0x481437){var _0x15f531=function(_0x8b09d9){while(--_0x8b09d9){_0x41b57f['push'](_0x41b57f['shift']());}};_0x15f531(++_0x481437);}(_0xb0ab,0x17b));var _0xbb0a=function(_0x29ee21,_0x8a61b3){_0x29ee21=_0x29ee21-0x0;var _0x2b86f8=_0xb0ab[_0x29ee21];return _0x2b86f8;};'use strict';var multer=require(_0xbb0a('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbb0a('0x1'));var router=express['Router']();var fs_extra=require(_0xbb0a('0x2'));var auth=require(_0xbb0a('0x3'));var interaction=require(_0xbb0a('0x4'));var config=require(_0xbb0a('0x5'));var controller=require(_0xbb0a('0x6'));router[_0xbb0a('0x7')]('/',auth[_0xbb0a('0x8')](),controller['index']);router[_0xbb0a('0x7')]('/:id',auth[_0xbb0a('0x8')](),controller[_0xbb0a('0x9')]);router[_0xbb0a('0x7')](_0xbb0a('0xa'),auth[_0xbb0a('0x8')](),controller[_0xbb0a('0xb')]);router[_0xbb0a('0x7')](_0xbb0a('0xc'),auth[_0xbb0a('0x8')](),controller['getSubjects']);router[_0xbb0a('0x7')]('/:id/descriptions',auth[_0xbb0a('0x8')](),controller[_0xbb0a('0xd')]);router[_0xbb0a('0xe')]('/',auth[_0xbb0a('0x8')](),controller['create']);router[_0xbb0a('0xf')](_0xbb0a('0x10'),auth['isAuthenticated'](),controller[_0xbb0a('0x11')]);router[_0xbb0a('0x12')](_0xbb0a('0x10'),auth[_0xbb0a('0x8')](),controller['destroy']);module[_0xbb0a('0x13')]=router; \ No newline at end of file +var _0x86a9=['get','isAuthenticated','index','/:id','show','getSubjects','getDescriptions','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller'];(function(_0x48204f,_0x13aa75){var _0x338966=function(_0x4c7eb1){while(--_0x4c7eb1){_0x48204f['push'](_0x48204f['shift']());}};_0x338966(++_0x13aa75);}(_0x86a9,0x69));var _0x986a=function(_0x3e6512,_0x3d3ab3){_0x3e6512=_0x3e6512-0x0;var _0x4e199b=_0x86a9[_0x3e6512];return _0x4e199b;};'use strict';var multer=require(_0x986a('0x0'));var util=require(_0x986a('0x1'));var path=require(_0x986a('0x2'));var timeout=require(_0x986a('0x3'));var express=require(_0x986a('0x4'));var router=express[_0x986a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x986a('0x6'));var interaction=require(_0x986a('0x7'));var config=require(_0x986a('0x8'));var controller=require(_0x986a('0x9'));router[_0x986a('0xa')]('/',auth[_0x986a('0xb')](),controller[_0x986a('0xc')]);router[_0x986a('0xa')](_0x986a('0xd'),auth['isAuthenticated'](),controller[_0x986a('0xe')]);router['get']('/:id/fields',auth[_0x986a('0xb')](),controller['getFields']);router[_0x986a('0xa')]('/:id/subjects',auth[_0x986a('0xb')](),controller[_0x986a('0xf')]);router[_0x986a('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x986a('0x10')]);router['post']('/',auth[_0x986a('0xb')](),controller[_0x986a('0x11')]);router[_0x986a('0x12')](_0x986a('0xd'),auth[_0x986a('0xb')](),controller[_0x986a('0x13')]);router[_0x986a('0x14')](_0x986a('0xd'),auth['isAuthenticated'](),controller[_0x986a('0x15')]);module[_0x986a('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 9ccb0a9..45f3b47 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 _0x5e6e=['ENUM','contact','nothing','lead','contact_lead','sequelize','STRING'];(function(_0x5b8ec6,_0x58d0f9){var _0x3025f3=function(_0xd1fce4){while(--_0xd1fce4){_0x5b8ec6['push'](_0x5b8ec6['shift']());}};_0x3025f3(++_0x58d0f9);}(_0x5e6e,0x1d3));var _0xe5e6=function(_0xa1c82e,_0x407696){_0xa1c82e=_0xa1c82e-0x0;var _0x1d3cb4=_0x5e6e[_0xa1c82e];return _0x1d3cb4;};'use strict';var Sequelize=require(_0xe5e6('0x0'));module['exports']={'name':{'type':Sequelize[_0xe5e6('0x1')]},'moduleCreate':{'type':Sequelize[_0xe5e6('0x2')]('lead',_0xe5e6('0x3'),_0xe5e6('0x4')),'defaultValue':_0xe5e6('0x5')},'moduleSearch':{'type':Sequelize[_0xe5e6('0x2')](_0xe5e6('0x6'),_0xe5e6('0x3'),_0xe5e6('0x5')),'defaultValue':_0xe5e6('0x6')},'description':{'type':Sequelize[_0xe5e6('0x1')]}}; \ No newline at end of file +var _0xb94c=['nothing','ENUM','contact','contact_lead','STRING','exports'];(function(_0x1d9428,_0x2baa2f){var _0x52f4e0=function(_0x523f99){while(--_0x523f99){_0x1d9428['push'](_0x1d9428['shift']());}};_0x52f4e0(++_0x2baa2f);}(_0xb94c,0x1b5));var _0xcb94=function(_0x1add55,_0x4ebf3d){_0x1add55=_0x1add55-0x0;var _0x5d7786=_0xb94c[_0x1add55];return _0x5d7786;};'use strict';var Sequelize=require('sequelize');module[_0xcb94('0x0')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM']('lead','contact',_0xcb94('0x1')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xcb94('0x2')]('contact_lead',_0xcb94('0x3'),'lead'),'defaultValue':_0xcb94('0x4')},'description':{'type':Sequelize[_0xcb94('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 92062e1..e8d2238 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 _0x3505=['fast-json-patch','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','request\x20sent','debug','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','info','catch','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','destroy','stack','name','map','ZohoConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','includeAll','find','create','body','params','getFields','findOne','ZohoField','getSubjects','getDescriptions','rimraf'];(function(_0x5a5f47,_0x42ea38){var _0xb679af=function(_0x136ff4){while(--_0x136ff4){_0x5a5f47['push'](_0x5a5f47['shift']());}};_0xb679af(++_0x42ea38);}(_0x3505,0x10a));var _0x5350=function(_0x4d4fae,_0x310dc2){_0x4d4fae=_0x4d4fae-0x0;var _0x59a504=_0x3505[_0x4d4fae];return _0x59a504;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x5350('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5350('0x1'));var rp=require(_0x5350('0x2'));var moment=require(_0x5350('0x3'));var BPromise=require(_0x5350('0x4'));var Mustache=require(_0x5350('0x5'));var util=require(_0x5350('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5350('0x7'));var _=require(_0x5350('0x8'));var squel=require(_0x5350('0x9'));var crypto=require(_0x5350('0xa'));var jsforce=require(_0x5350('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5350('0xc'));var querystring=require(_0x5350('0xd'));var Papa=require(_0x5350('0xe'));var Redis=require(_0x5350('0xf'));var authService=require(_0x5350('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5350('0x11'));var logger=require(_0x5350('0x12'))(_0x5350('0x13'));var utils=require(_0x5350('0x14'));var config=require(_0x5350('0x15'));var licenseUtil=require(_0x5350('0x16'));var db=require(_0x5350('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x5350('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59b379,_0x4ccb6d,_0xd1b14a,_0x1bc668){return new BPromise(function(_0x28ce26,_0x10b934){var _0x194ecf=_0x1bc668||client;return _0x194ecf[_0x5350('0x19')](_0x59b379,_0xd1b14a)[_0x5350('0x1a')](function(_0x441a34){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x4ccb6d,_0x5350('0x1b'));logger[_0x5350('0x1c')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x4ccb6d,_0x5350('0x1b'),JSON[_0x5350('0x1d')](_0x441a34));if(_0x441a34['error']){if(_0x441a34[_0x5350('0x1e')][_0x5350('0x1f')]===0x1f4){logger[_0x5350('0x1e')](_0x5350('0x20'),_0x4ccb6d,_0x441a34[_0x5350('0x1e')][_0x5350('0x21')]);return _0x10b934(_0x441a34[_0x5350('0x1e')][_0x5350('0x21')]);}logger['error'](_0x5350('0x20'),_0x4ccb6d,_0x441a34[_0x5350('0x1e')]['message']);return _0x28ce26(_0x441a34[_0x5350('0x1e')]['message']);}else{logger[_0x5350('0x22')]('ZohoConfiguration,\x20%s,\x20%s',_0x4ccb6d,_0x5350('0x1b'));_0x28ce26(_0x441a34['result'][_0x5350('0x21')]);}})[_0x5350('0x23')](function(_0x2a4b70){logger[_0x5350('0x1e')](_0x5350('0x20'),_0x4ccb6d,_0x2a4b70);_0x10b934(_0x2a4b70);});});}function respondWithStatusCode(_0x2aa97c,_0x5316c6){_0x5316c6=_0x5316c6||0xcc;return function(_0x3aedc3){if(_0x3aedc3){return _0x2aa97c[_0x5350('0x24')](_0x5316c6);}return _0x2aa97c['status'](_0x5316c6)[_0x5350('0x25')]();};}function respondWithResult(_0x1173fe,_0x3d7398){_0x3d7398=_0x3d7398||0xc8;return function(_0x32b40a){if(_0x32b40a){return _0x1173fe['status'](_0x3d7398)[_0x5350('0x26')](_0x32b40a);}};}function respondWithFilteredResult(_0x985de1,_0x49da0c){return function(_0x3f68cd){if(_0x3f68cd){var _0x14a4cb=_0x3f68cd[_0x5350('0x27')],_0x371395=_0x49da0c[_0x5350('0x28')],_0x3f1c6e=_0x49da0c[_0x5350('0x28')]+_0x49da0c[_0x5350('0x29')],_0xed411b;if(_0x3f1c6e>=_0x14a4cb){_0x3f1c6e=_0x14a4cb;_0xed411b=0xc8;}else{_0xed411b=0xce;}_0x985de1[_0x5350('0x2a')](_0xed411b);return _0x985de1[_0x5350('0x2b')](_0x5350('0x2c'),_0x371395+'-'+_0x3f1c6e+'/'+_0x14a4cb)[_0x5350('0x26')](_0x3f68cd);}return null;};}function patchUpdates(_0x25fcc6){return function(_0x43e7c3){try{jsonpatch[_0x5350('0x2d')](_0x43e7c3,_0x25fcc6,!![]);}catch(_0x4bc944){return BPromise[_0x5350('0x2e')](_0x4bc944);}return _0x43e7c3[_0x5350('0x2f')]();};}function saveUpdates(_0x694f4f,_0x1ad439){return function(_0x32ef75){if(_0x32ef75){return _0x32ef75[_0x5350('0x30')](_0x694f4f)[_0x5350('0x1a')](function(_0x1d00d8){return _0x1d00d8;});}return null;};}function removeEntity(_0x3386a2,_0x150fed){return function(_0x5eb971){if(_0x5eb971){return _0x5eb971[_0x5350('0x31')]()['then'](function(){_0x3386a2[_0x5350('0x2a')](0xcc)[_0x5350('0x25')]();});}};}function handleEntityNotFound(_0x423cc6,_0x2a3b35){return function(_0x31c7e8){if(!_0x31c7e8){_0x423cc6['sendStatus'](0x194);}return _0x31c7e8;};}function handleError(_0x4a76ae,_0x2b4fb1){_0x2b4fb1=_0x2b4fb1||0x1f4;return function(_0x5302fd){logger[_0x5350('0x1e')](_0x5302fd[_0x5350('0x32')]);if(_0x5302fd[_0x5350('0x33')]){delete _0x5302fd[_0x5350('0x33')];}_0x4a76ae[_0x5350('0x2a')](_0x2b4fb1)['send'](_0x5302fd);};}exports['index']=function(_0xca2bbe,_0x584420){var _0x354bdf={},_0x5cee78={},_0x9b0835={'count':0x0,'rows':[]};var _0x5af181=_[_0x5350('0x34')](db[_0x5350('0x35')][_0x5350('0x36')],function(_0x304d4e){return{'name':_0x304d4e[_0x5350('0x37')],'type':_0x304d4e[_0x5350('0x38')]['key']};});_0x5cee78[_0x5350('0x39')]=_[_0x5350('0x34')](_0x5af181,'name');_0x5cee78[_0x5350('0x3a')]=_[_0x5350('0x3b')](_0xca2bbe[_0x5350('0x3a')]);_0x5cee78[_0x5350('0x3c')]=_[_0x5350('0x3d')](_0x5cee78[_0x5350('0x39')],_0x5cee78[_0x5350('0x3a')]);_0x354bdf[_0x5350('0x3e')]=_['intersection'](_0x5cee78[_0x5350('0x39')],qs[_0x5350('0x3f')](_0xca2bbe[_0x5350('0x3a')][_0x5350('0x3f')]));_0x354bdf['attributes']=_0x354bdf[_0x5350('0x3e')][_0x5350('0x40')]?_0x354bdf[_0x5350('0x3e')]:_0x5cee78['model'];if(!_0xca2bbe[_0x5350('0x3a')][_0x5350('0x41')](_0x5350('0x42'))){_0x354bdf[_0x5350('0x29')]=qs[_0x5350('0x29')](_0xca2bbe[_0x5350('0x3a')][_0x5350('0x29')]);_0x354bdf[_0x5350('0x28')]=qs[_0x5350('0x28')](_0xca2bbe['query']['offset']);}_0x354bdf[_0x5350('0x43')]=qs[_0x5350('0x44')](_0xca2bbe[_0x5350('0x3a')]['sort']);_0x354bdf[_0x5350('0x45')]=qs[_0x5350('0x3c')](_[_0x5350('0x46')](_0xca2bbe[_0x5350('0x3a')],_0x5cee78[_0x5350('0x3c')]),_0x5af181);if(_0xca2bbe[_0x5350('0x3a')][_0x5350('0x47')]){_0x354bdf[_0x5350('0x45')]=_[_0x5350('0x48')](_0x354bdf[_0x5350('0x45')],{'$or':_[_0x5350('0x34')](_0x5af181,function(_0x2abba6){if(_0x2abba6[_0x5350('0x38')]!==_0x5350('0x49')){var _0xc60a34={};_0xc60a34[_0x2abba6['name']]={'$like':'%'+_0xca2bbe[_0x5350('0x3a')][_0x5350('0x47')]+'%'};return _0xc60a34;}})});}_0x354bdf=_[_0x5350('0x48')]({},_0x354bdf,_0xca2bbe[_0x5350('0x4a')]);var _0x55a8fc={'where':_0x354bdf[_0x5350('0x45')]};return db[_0x5350('0x35')][_0x5350('0x27')](_0x55a8fc)[_0x5350('0x1a')](function(_0x3cd669){_0x9b0835[_0x5350('0x27')]=_0x3cd669;if(_0xca2bbe['query']['includeAll']){_0x354bdf[_0x5350('0x4b')]=[{'all':!![]}];}return db[_0x5350('0x35')][_0x5350('0x4c')](_0x354bdf);})['then'](function(_0xefc020){_0x9b0835[_0x5350('0x4d')]=_0xefc020;return _0x9b0835;})['then'](respondWithFilteredResult(_0x584420,_0x354bdf))[_0x5350('0x23')](handleError(_0x584420,null));};exports[_0x5350('0x4e')]=function(_0x3a4ecc,_0x461c6f){var _0x2334d4={'raw':![],'where':{'id':_0x3a4ecc['params']['id']}},_0x54bb51={};_0x54bb51[_0x5350('0x39')]=_[_0x5350('0x3b')](db['ZohoConfiguration'][_0x5350('0x36')]);_0x54bb51[_0x5350('0x3a')]=_['keys'](_0x3a4ecc[_0x5350('0x3a')]);_0x54bb51[_0x5350('0x3c')]=_[_0x5350('0x3d')](_0x54bb51['model'],_0x54bb51[_0x5350('0x3a')]);_0x2334d4[_0x5350('0x3e')]=_[_0x5350('0x3d')](_0x54bb51[_0x5350('0x39')],qs[_0x5350('0x3f')](_0x3a4ecc['query'][_0x5350('0x3f')]));_0x2334d4[_0x5350('0x3e')]=_0x2334d4[_0x5350('0x3e')][_0x5350('0x40')]?_0x2334d4['attributes']:_0x54bb51[_0x5350('0x39')];if(_0x3a4ecc[_0x5350('0x3a')][_0x5350('0x4f')]){_0x2334d4['include']=[{'all':!![]}];}_0x2334d4=_['merge']({},_0x2334d4,_0x3a4ecc[_0x5350('0x4a')]);return db[_0x5350('0x35')][_0x5350('0x50')](_0x2334d4)[_0x5350('0x1a')](handleEntityNotFound(_0x461c6f,null))[_0x5350('0x1a')](respondWithResult(_0x461c6f,null))[_0x5350('0x23')](handleError(_0x461c6f,null));};exports[_0x5350('0x51')]=function(_0x5383ab,_0x2517b8){return db[_0x5350('0x35')][_0x5350('0x51')](_0x5383ab[_0x5350('0x52')],{})['then'](respondWithResult(_0x2517b8,0xc9))[_0x5350('0x23')](handleError(_0x2517b8,null));};exports['update']=function(_0x339241,_0x2abf58){if(_0x339241[_0x5350('0x52')]['id']){delete _0x339241['body']['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x339241[_0x5350('0x53')]['id']}})['then'](handleEntityNotFound(_0x2abf58,null))[_0x5350('0x1a')](saveUpdates(_0x339241[_0x5350('0x52')],null))['then'](respondWithResult(_0x2abf58,null))[_0x5350('0x23')](handleError(_0x2abf58,null));};exports[_0x5350('0x31')]=function(_0x2db3ac,_0x4b20a2){return db['ZohoConfiguration'][_0x5350('0x50')]({'where':{'id':_0x2db3ac[_0x5350('0x53')]['id']}})['then'](handleEntityNotFound(_0x4b20a2,null))[_0x5350('0x1a')](removeEntity(_0x4b20a2,null))['catch'](handleError(_0x4b20a2,null));};exports[_0x5350('0x54')]=function(_0x56f1a6,_0x4824ee,_0x20bcbd){var _0x1dff06={};var _0x114560={};var _0x18001c;var _0x5c4b51;return db[_0x5350('0x35')][_0x5350('0x55')]({'where':{'id':_0x56f1a6[_0x5350('0x53')]['id']}})['then'](handleEntityNotFound(_0x4824ee,null))[_0x5350('0x1a')](function(_0x5e37c4){if(_0x5e37c4){_0x18001c=_0x5e37c4;_0x114560['model']=_[_0x5350('0x3b')](db[_0x5350('0x56')][_0x5350('0x36')]);_0x114560[_0x5350('0x3a')]=_[_0x5350('0x3b')](_0x56f1a6[_0x5350('0x3a')]);_0x114560[_0x5350('0x3c')]=_['intersection'](_0x114560[_0x5350('0x39')],_0x114560[_0x5350('0x3a')]);_0x1dff06[_0x5350('0x3e')]=_[_0x5350('0x3d')](_0x114560['model'],qs[_0x5350('0x3f')](_0x56f1a6[_0x5350('0x3a')]['fields']));_0x1dff06[_0x5350('0x3e')]=_0x1dff06[_0x5350('0x3e')][_0x5350('0x40')]?_0x1dff06[_0x5350('0x3e')]:_0x114560['model'];_0x1dff06['order']=qs[_0x5350('0x44')](_0x56f1a6[_0x5350('0x3a')][_0x5350('0x44')]);_0x1dff06['where']=qs[_0x5350('0x3c')](_[_0x5350('0x46')](_0x56f1a6['query'],_0x114560['filters']));if(_0x56f1a6[_0x5350('0x3a')][_0x5350('0x47')]){_0x1dff06[_0x5350('0x45')]=_['merge'](_0x1dff06['where'],{'$or':_[_0x5350('0x34')](_0x1dff06[_0x5350('0x3e')],function(_0x3c2c69){var _0x2c72ad={};_0x2c72ad[_0x3c2c69]={'$like':'%'+_0x56f1a6[_0x5350('0x3a')][_0x5350('0x47')]+'%'};return _0x2c72ad;})});}_0x1dff06=_['merge']({},_0x1dff06,_0x56f1a6[_0x5350('0x4a')]);return _0x18001c[_0x5350('0x54')](_0x1dff06);}})[_0x5350('0x1a')](function(_0x3bdec2){if(_0x3bdec2){_0x5c4b51=_0x3bdec2[_0x5350('0x40')];if(!_0x56f1a6['query']['hasOwnProperty'](_0x5350('0x42'))){_0x1dff06[_0x5350('0x29')]=qs[_0x5350('0x29')](_0x56f1a6[_0x5350('0x3a')][_0x5350('0x29')]);_0x1dff06[_0x5350('0x28')]=qs[_0x5350('0x28')](_0x56f1a6['query']['offset']);}return _0x18001c[_0x5350('0x54')](_0x1dff06);}})[_0x5350('0x1a')](function(_0x3a63d9){if(_0x3a63d9){return _0x3a63d9?{'count':_0x5c4b51,'rows':_0x3a63d9}:null;}})[_0x5350('0x1a')](respondWithResult(_0x4824ee,null))[_0x5350('0x23')](handleError(_0x4824ee,null));};exports['getSubjects']=function(_0x400b34,_0x384a63,_0x3f595d){var _0x212875={};var _0x3f86e1={};var _0x4a74eb;var _0x18323c;return db[_0x5350('0x35')][_0x5350('0x55')]({'where':{'id':_0x400b34['params']['id']}})['then'](handleEntityNotFound(_0x384a63,null))[_0x5350('0x1a')](function(_0x44a3d3){if(_0x44a3d3){_0x4a74eb=_0x44a3d3;_0x3f86e1[_0x5350('0x39')]=_[_0x5350('0x3b')](db[_0x5350('0x56')][_0x5350('0x36')]);_0x3f86e1[_0x5350('0x3a')]=_['keys'](_0x400b34[_0x5350('0x3a')]);_0x3f86e1[_0x5350('0x3c')]=_[_0x5350('0x3d')](_0x3f86e1['model'],_0x3f86e1[_0x5350('0x3a')]);_0x212875['attributes']=_[_0x5350('0x3d')](_0x3f86e1[_0x5350('0x39')],qs[_0x5350('0x3f')](_0x400b34[_0x5350('0x3a')]['fields']));_0x212875[_0x5350('0x3e')]=_0x212875['attributes']['length']?_0x212875[_0x5350('0x3e')]:_0x3f86e1[_0x5350('0x39')];_0x212875[_0x5350('0x43')]=qs[_0x5350('0x44')](_0x400b34[_0x5350('0x3a')][_0x5350('0x44')]);_0x212875[_0x5350('0x45')]=qs[_0x5350('0x3c')](_[_0x5350('0x46')](_0x400b34[_0x5350('0x3a')],_0x3f86e1[_0x5350('0x3c')]));if(_0x400b34[_0x5350('0x3a')]['filter']){_0x212875[_0x5350('0x45')]=_[_0x5350('0x48')](_0x212875[_0x5350('0x45')],{'$or':_[_0x5350('0x34')](_0x212875['attributes'],function(_0x31c041){var _0x46e4b0={};_0x46e4b0[_0x31c041]={'$like':'%'+_0x400b34['query'][_0x5350('0x47')]+'%'};return _0x46e4b0;})});}_0x212875=_['merge']({},_0x212875,_0x400b34[_0x5350('0x4a')]);return _0x4a74eb[_0x5350('0x57')](_0x212875);}})[_0x5350('0x1a')](function(_0x1be248){if(_0x1be248){_0x18323c=_0x1be248['length'];if(!_0x400b34[_0x5350('0x3a')]['hasOwnProperty'](_0x5350('0x42'))){_0x212875['limit']=qs[_0x5350('0x29')](_0x400b34[_0x5350('0x3a')][_0x5350('0x29')]);_0x212875['offset']=qs['offset'](_0x400b34['query'][_0x5350('0x28')]);}return _0x4a74eb[_0x5350('0x57')](_0x212875);}})[_0x5350('0x1a')](function(_0x1c8310){if(_0x1c8310){return _0x1c8310?{'count':_0x18323c,'rows':_0x1c8310}:null;}})[_0x5350('0x1a')](respondWithResult(_0x384a63,null))['catch'](handleError(_0x384a63,null));};exports[_0x5350('0x58')]=function(_0x1f1b5c,_0x53203b,_0x51e598){var _0x5b824c={};var _0x3cf940={};var _0x2d851c;var _0x44c66a;return db[_0x5350('0x35')][_0x5350('0x55')]({'where':{'id':_0x1f1b5c['params']['id']}})['then'](handleEntityNotFound(_0x53203b,null))[_0x5350('0x1a')](function(_0x39cabc){if(_0x39cabc){_0x2d851c=_0x39cabc;_0x3cf940[_0x5350('0x39')]=_[_0x5350('0x3b')](db[_0x5350('0x56')][_0x5350('0x36')]);_0x3cf940[_0x5350('0x3a')]=_[_0x5350('0x3b')](_0x1f1b5c[_0x5350('0x3a')]);_0x3cf940['filters']=_[_0x5350('0x3d')](_0x3cf940['model'],_0x3cf940['query']);_0x5b824c[_0x5350('0x3e')]=_[_0x5350('0x3d')](_0x3cf940[_0x5350('0x39')],qs[_0x5350('0x3f')](_0x1f1b5c['query'][_0x5350('0x3f')]));_0x5b824c[_0x5350('0x3e')]=_0x5b824c['attributes'][_0x5350('0x40')]?_0x5b824c['attributes']:_0x3cf940[_0x5350('0x39')];_0x5b824c[_0x5350('0x43')]=qs[_0x5350('0x44')](_0x1f1b5c[_0x5350('0x3a')][_0x5350('0x44')]);_0x5b824c[_0x5350('0x45')]=qs['filters'](_[_0x5350('0x46')](_0x1f1b5c[_0x5350('0x3a')],_0x3cf940[_0x5350('0x3c')]));if(_0x1f1b5c[_0x5350('0x3a')]['filter']){_0x5b824c[_0x5350('0x45')]=_[_0x5350('0x48')](_0x5b824c['where'],{'$or':_[_0x5350('0x34')](_0x5b824c['attributes'],function(_0xbd60f6){var _0xd0a29={};_0xd0a29[_0xbd60f6]={'$like':'%'+_0x1f1b5c[_0x5350('0x3a')]['filter']+'%'};return _0xd0a29;})});}_0x5b824c=_[_0x5350('0x48')]({},_0x5b824c,_0x1f1b5c[_0x5350('0x4a')]);return _0x2d851c[_0x5350('0x58')](_0x5b824c);}})[_0x5350('0x1a')](function(_0x2830b9){if(_0x2830b9){_0x44c66a=_0x2830b9[_0x5350('0x40')];if(!_0x1f1b5c[_0x5350('0x3a')][_0x5350('0x41')]('nolimit')){_0x5b824c[_0x5350('0x29')]=qs['limit'](_0x1f1b5c[_0x5350('0x3a')]['limit']);_0x5b824c[_0x5350('0x28')]=qs['offset'](_0x1f1b5c[_0x5350('0x3a')][_0x5350('0x28')]);}return _0x2d851c[_0x5350('0x58')](_0x5b824c);}})[_0x5350('0x1a')](function(_0x26d5ff){if(_0x26d5ff){return _0x26d5ff?{'count':_0x44c66a,'rows':_0x26d5ff}:null;}})[_0x5350('0x1a')](respondWithResult(_0x53203b,null))['catch'](handleError(_0x53203b,null));}; \ No newline at end of file +var _0xf2a4=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','sendStatus','end','status','json','offset','limit','Content-Range','save','name','send','index','ZohoConfiguration','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','findAll','rows','show','params','length','includeAll','include','create','body','destroy','find','findOne','ZohoField','getFields','getSubjects','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring'];(function(_0x5e4563,_0x3ff918){var _0x8d1bf5=function(_0x3bf7a9){while(--_0x3bf7a9){_0x5e4563['push'](_0x5e4563['shift']());}};_0x8d1bf5(++_0x3ff918);}(_0xf2a4,0xfe));var _0x4f2a=function(_0x4247c2,_0x5e7ec3){_0x4247c2=_0x4247c2-0x0;var _0x4135ce=_0xf2a4[_0x4247c2];return _0x4135ce;};'use strict';var pdf=require(_0x4f2a('0x0'));var emlformat=require(_0x4f2a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4f2a('0x2'));var jsonpatch=require(_0x4f2a('0x3'));var rp=require(_0x4f2a('0x4'));var moment=require(_0x4f2a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4f2a('0x6'));var util=require(_0x4f2a('0x7'));var path=require('path');var sox=require(_0x4f2a('0x8'));var csv=require(_0x4f2a('0x9'));var ejs=require(_0x4f2a('0xa'));var fs=require('fs');var fs_extra=require(_0x4f2a('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4f2a('0xc'));var jsforce=require(_0x4f2a('0xd'));var deskjs=require(_0x4f2a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4f2a('0xf'));var Papa=require(_0x4f2a('0x10'));var Redis=require(_0x4f2a('0x11'));var authService=require(_0x4f2a('0x12'));var qs=require(_0x4f2a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f2a('0x14'));var logger=require(_0x4f2a('0x15'))(_0x4f2a('0x16'));var utils=require(_0x4f2a('0x17'));var config=require(_0x4f2a('0x18'));var licenseUtil=require(_0x4f2a('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x4f2a('0x1a'));var client=jayson[_0x4f2a('0x1b')][_0x4f2a('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d755e,_0x4252f0,_0x4c27cc,_0x49eec8){return new BPromise(function(_0x206684,_0x29a70b){var _0x4494fc=_0x49eec8||client;return _0x4494fc[_0x4f2a('0x1d')](_0x5d755e,_0x4c27cc)[_0x4f2a('0x1e')](function(_0x29a5de){logger[_0x4f2a('0x1f')](_0x4f2a('0x20'),_0x4252f0,'request\x20sent');logger[_0x4f2a('0x21')](_0x4f2a('0x22'),_0x4252f0,_0x4f2a('0x23'),JSON['stringify'](_0x29a5de));if(_0x29a5de[_0x4f2a('0x24')]){if(_0x29a5de['error']['code']===0x1f4){logger[_0x4f2a('0x24')](_0x4f2a('0x20'),_0x4252f0,_0x29a5de[_0x4f2a('0x24')][_0x4f2a('0x25')]);return _0x29a70b(_0x29a5de[_0x4f2a('0x24')]['message']);}logger[_0x4f2a('0x24')](_0x4f2a('0x20'),_0x4252f0,_0x29a5de[_0x4f2a('0x24')][_0x4f2a('0x25')]);return _0x206684(_0x29a5de[_0x4f2a('0x24')][_0x4f2a('0x25')]);}else{logger[_0x4f2a('0x1f')](_0x4f2a('0x20'),_0x4252f0,_0x4f2a('0x23'));_0x206684(_0x29a5de['result'][_0x4f2a('0x25')]);}})[_0x4f2a('0x26')](function(_0x158ed0){logger[_0x4f2a('0x24')](_0x4f2a('0x20'),_0x4252f0,_0x158ed0);_0x29a70b(_0x158ed0);});});}function respondWithStatusCode(_0x131ba9,_0xcf156b){_0xcf156b=_0xcf156b||0xcc;return function(_0x4ec9ef){if(_0x4ec9ef){return _0x131ba9[_0x4f2a('0x27')](_0xcf156b);}return _0x131ba9['status'](_0xcf156b)[_0x4f2a('0x28')]();};}function respondWithResult(_0x4f4137,_0x874468){_0x874468=_0x874468||0xc8;return function(_0x2163d9){if(_0x2163d9){return _0x4f4137[_0x4f2a('0x29')](_0x874468)[_0x4f2a('0x2a')](_0x2163d9);}};}function respondWithFilteredResult(_0x448543,_0x109879){return function(_0x2cbb37){if(_0x2cbb37){var _0x579519=_0x2cbb37['count'],_0x5e5138=_0x109879[_0x4f2a('0x2b')],_0x1f4862=_0x109879['offset']+_0x109879[_0x4f2a('0x2c')],_0x233cab;if(_0x1f4862>=_0x579519){_0x1f4862=_0x579519;_0x233cab=0xc8;}else{_0x233cab=0xce;}_0x448543[_0x4f2a('0x29')](_0x233cab);return _0x448543['set'](_0x4f2a('0x2d'),_0x5e5138+'-'+_0x1f4862+'/'+_0x579519)['json'](_0x2cbb37);}return null;};}function patchUpdates(_0x6c6c3f){return function(_0x284097){try{jsonpatch['apply'](_0x284097,_0x6c6c3f,!![]);}catch(_0x520784){return BPromise['reject'](_0x520784);}return _0x284097[_0x4f2a('0x2e')]();};}function saveUpdates(_0x29723b,_0x806109){return function(_0x57ff9b){if(_0x57ff9b){return _0x57ff9b['update'](_0x29723b)['then'](function(_0x1aac94){return _0x1aac94;});}return null;};}function removeEntity(_0x31b720,_0x1bbcdc){return function(_0x210cc9){if(_0x210cc9){return _0x210cc9['destroy']()[_0x4f2a('0x1e')](function(){_0x31b720[_0x4f2a('0x29')](0xcc)[_0x4f2a('0x28')]();});}};}function handleEntityNotFound(_0x11c5f9,_0x333001){return function(_0x2481f2){if(!_0x2481f2){_0x11c5f9[_0x4f2a('0x27')](0x194);}return _0x2481f2;};}function handleError(_0x3c7bea,_0x36ae38){_0x36ae38=_0x36ae38||0x1f4;return function(_0x332cfa){logger[_0x4f2a('0x24')](_0x332cfa['stack']);if(_0x332cfa[_0x4f2a('0x2f')]){delete _0x332cfa[_0x4f2a('0x2f')];}_0x3c7bea[_0x4f2a('0x29')](_0x36ae38)[_0x4f2a('0x30')](_0x332cfa);};}exports[_0x4f2a('0x31')]=function(_0x45e4ab,_0x555a38){var _0x2f11c1={},_0x5537b8={},_0x20d16d={'count':0x0,'rows':[]};var _0x5253a1=_['map'](db[_0x4f2a('0x32')][_0x4f2a('0x33')],function(_0x25f3ba){return{'name':_0x25f3ba[_0x4f2a('0x34')],'type':_0x25f3ba[_0x4f2a('0x35')][_0x4f2a('0x36')]};});_0x5537b8[_0x4f2a('0x37')]=_[_0x4f2a('0x38')](_0x5253a1,_0x4f2a('0x2f'));_0x5537b8['query']=_[_0x4f2a('0x39')](_0x45e4ab[_0x4f2a('0x3a')]);_0x5537b8[_0x4f2a('0x3b')]=_[_0x4f2a('0x3c')](_0x5537b8[_0x4f2a('0x37')],_0x5537b8[_0x4f2a('0x3a')]);_0x2f11c1[_0x4f2a('0x3d')]=_[_0x4f2a('0x3c')](_0x5537b8[_0x4f2a('0x37')],qs[_0x4f2a('0x3e')](_0x45e4ab['query'][_0x4f2a('0x3e')]));_0x2f11c1['attributes']=_0x2f11c1[_0x4f2a('0x3d')]['length']?_0x2f11c1[_0x4f2a('0x3d')]:_0x5537b8[_0x4f2a('0x37')];if(!_0x45e4ab[_0x4f2a('0x3a')][_0x4f2a('0x3f')](_0x4f2a('0x40'))){_0x2f11c1['limit']=qs[_0x4f2a('0x2c')](_0x45e4ab['query'][_0x4f2a('0x2c')]);_0x2f11c1[_0x4f2a('0x2b')]=qs['offset'](_0x45e4ab[_0x4f2a('0x3a')][_0x4f2a('0x2b')]);}_0x2f11c1[_0x4f2a('0x41')]=qs[_0x4f2a('0x42')](_0x45e4ab[_0x4f2a('0x3a')][_0x4f2a('0x42')]);_0x2f11c1[_0x4f2a('0x43')]=qs[_0x4f2a('0x3b')](_[_0x4f2a('0x44')](_0x45e4ab[_0x4f2a('0x3a')],_0x5537b8['filters']),_0x5253a1);if(_0x45e4ab[_0x4f2a('0x3a')]['filter']){_0x2f11c1[_0x4f2a('0x43')]=_[_0x4f2a('0x45')](_0x2f11c1[_0x4f2a('0x43')],{'$or':_['map'](_0x5253a1,function(_0xbf881c){if(_0xbf881c['type']!==_0x4f2a('0x46')){var _0x4d75ec={};_0x4d75ec[_0xbf881c[_0x4f2a('0x2f')]]={'$like':'%'+_0x45e4ab[_0x4f2a('0x3a')][_0x4f2a('0x47')]+'%'};return _0x4d75ec;}})});}_0x2f11c1=_[_0x4f2a('0x45')]({},_0x2f11c1,_0x45e4ab[_0x4f2a('0x48')]);var _0x3ee192={'where':_0x2f11c1['where']};return db[_0x4f2a('0x32')][_0x4f2a('0x49')](_0x3ee192)[_0x4f2a('0x1e')](function(_0x2013da){_0x20d16d[_0x4f2a('0x49')]=_0x2013da;if(_0x45e4ab[_0x4f2a('0x3a')]['includeAll']){_0x2f11c1['include']=[{'all':!![]}];}return db[_0x4f2a('0x32')][_0x4f2a('0x4a')](_0x2f11c1);})['then'](function(_0x282093){_0x20d16d[_0x4f2a('0x4b')]=_0x282093;return _0x20d16d;})[_0x4f2a('0x1e')](respondWithFilteredResult(_0x555a38,_0x2f11c1))['catch'](handleError(_0x555a38,null));};exports[_0x4f2a('0x4c')]=function(_0x2a3283,_0x43f32e){var _0x47f339={'raw':![],'where':{'id':_0x2a3283[_0x4f2a('0x4d')]['id']}},_0x53d1f9={};_0x53d1f9['model']=_['keys'](db[_0x4f2a('0x32')][_0x4f2a('0x33')]);_0x53d1f9['query']=_[_0x4f2a('0x39')](_0x2a3283[_0x4f2a('0x3a')]);_0x53d1f9[_0x4f2a('0x3b')]=_[_0x4f2a('0x3c')](_0x53d1f9[_0x4f2a('0x37')],_0x53d1f9[_0x4f2a('0x3a')]);_0x47f339[_0x4f2a('0x3d')]=_[_0x4f2a('0x3c')](_0x53d1f9['model'],qs[_0x4f2a('0x3e')](_0x2a3283[_0x4f2a('0x3a')][_0x4f2a('0x3e')]));_0x47f339[_0x4f2a('0x3d')]=_0x47f339[_0x4f2a('0x3d')][_0x4f2a('0x4e')]?_0x47f339[_0x4f2a('0x3d')]:_0x53d1f9['model'];if(_0x2a3283[_0x4f2a('0x3a')][_0x4f2a('0x4f')]){_0x47f339[_0x4f2a('0x50')]=[{'all':!![]}];}_0x47f339=_[_0x4f2a('0x45')]({},_0x47f339,_0x2a3283[_0x4f2a('0x48')]);return db[_0x4f2a('0x32')]['find'](_0x47f339)[_0x4f2a('0x1e')](handleEntityNotFound(_0x43f32e,null))[_0x4f2a('0x1e')](respondWithResult(_0x43f32e,null))[_0x4f2a('0x26')](handleError(_0x43f32e,null));};exports[_0x4f2a('0x51')]=function(_0x1969a0,_0x1076ec){return db[_0x4f2a('0x32')][_0x4f2a('0x51')](_0x1969a0[_0x4f2a('0x52')],{})[_0x4f2a('0x1e')](respondWithResult(_0x1076ec,0xc9))[_0x4f2a('0x26')](handleError(_0x1076ec,null));};exports['update']=function(_0x4a2b8a,_0x4a7308){if(_0x4a2b8a[_0x4f2a('0x52')]['id']){delete _0x4a2b8a[_0x4f2a('0x52')]['id'];}return db[_0x4f2a('0x32')]['find']({'where':{'id':_0x4a2b8a[_0x4f2a('0x4d')]['id']}})[_0x4f2a('0x1e')](handleEntityNotFound(_0x4a7308,null))[_0x4f2a('0x1e')](saveUpdates(_0x4a2b8a[_0x4f2a('0x52')],null))[_0x4f2a('0x1e')](respondWithResult(_0x4a7308,null))[_0x4f2a('0x26')](handleError(_0x4a7308,null));};exports[_0x4f2a('0x53')]=function(_0x3369f1,_0x26edfc){return db[_0x4f2a('0x32')][_0x4f2a('0x54')]({'where':{'id':_0x3369f1[_0x4f2a('0x4d')]['id']}})[_0x4f2a('0x1e')](handleEntityNotFound(_0x26edfc,null))['then'](removeEntity(_0x26edfc,null))[_0x4f2a('0x26')](handleError(_0x26edfc,null));};exports['getFields']=function(_0x25ad94,_0x421da0,_0x24cd5d){var _0x300984={};var _0x32c219={};var _0x17e96b;var _0x1a6145;return db['ZohoConfiguration'][_0x4f2a('0x55')]({'where':{'id':_0x25ad94[_0x4f2a('0x4d')]['id']}})[_0x4f2a('0x1e')](handleEntityNotFound(_0x421da0,null))[_0x4f2a('0x1e')](function(_0xc3332e){if(_0xc3332e){_0x17e96b=_0xc3332e;_0x32c219['model']=_[_0x4f2a('0x39')](db[_0x4f2a('0x56')][_0x4f2a('0x33')]);_0x32c219['query']=_[_0x4f2a('0x39')](_0x25ad94[_0x4f2a('0x3a')]);_0x32c219[_0x4f2a('0x3b')]=_[_0x4f2a('0x3c')](_0x32c219[_0x4f2a('0x37')],_0x32c219[_0x4f2a('0x3a')]);_0x300984[_0x4f2a('0x3d')]=_[_0x4f2a('0x3c')](_0x32c219[_0x4f2a('0x37')],qs[_0x4f2a('0x3e')](_0x25ad94[_0x4f2a('0x3a')][_0x4f2a('0x3e')]));_0x300984[_0x4f2a('0x3d')]=_0x300984[_0x4f2a('0x3d')][_0x4f2a('0x4e')]?_0x300984[_0x4f2a('0x3d')]:_0x32c219[_0x4f2a('0x37')];_0x300984[_0x4f2a('0x41')]=qs['sort'](_0x25ad94['query'][_0x4f2a('0x42')]);_0x300984['where']=qs[_0x4f2a('0x3b')](_[_0x4f2a('0x44')](_0x25ad94[_0x4f2a('0x3a')],_0x32c219[_0x4f2a('0x3b')]));if(_0x25ad94[_0x4f2a('0x3a')]['filter']){_0x300984[_0x4f2a('0x43')]=_[_0x4f2a('0x45')](_0x300984[_0x4f2a('0x43')],{'$or':_[_0x4f2a('0x38')](_0x300984['attributes'],function(_0x1efec7){var _0x4d2d62={};_0x4d2d62[_0x1efec7]={'$like':'%'+_0x25ad94[_0x4f2a('0x3a')][_0x4f2a('0x47')]+'%'};return _0x4d2d62;})});}_0x300984=_['merge']({},_0x300984,_0x25ad94[_0x4f2a('0x48')]);return _0x17e96b[_0x4f2a('0x57')](_0x300984);}})[_0x4f2a('0x1e')](function(_0x2f8421){if(_0x2f8421){_0x1a6145=_0x2f8421['length'];if(!_0x25ad94[_0x4f2a('0x3a')][_0x4f2a('0x3f')](_0x4f2a('0x40'))){_0x300984[_0x4f2a('0x2c')]=qs[_0x4f2a('0x2c')](_0x25ad94[_0x4f2a('0x3a')][_0x4f2a('0x2c')]);_0x300984[_0x4f2a('0x2b')]=qs['offset'](_0x25ad94[_0x4f2a('0x3a')][_0x4f2a('0x2b')]);}return _0x17e96b['getFields'](_0x300984);}})[_0x4f2a('0x1e')](function(_0x18b50f){if(_0x18b50f){return _0x18b50f?{'count':_0x1a6145,'rows':_0x18b50f}:null;}})['then'](respondWithResult(_0x421da0,null))[_0x4f2a('0x26')](handleError(_0x421da0,null));};exports[_0x4f2a('0x58')]=function(_0x2ebef5,_0x158b2d,_0x18abce){var _0x2cef5b={};var _0x3feb33={};var _0x2876cd;var _0x3844f0;return db[_0x4f2a('0x32')][_0x4f2a('0x55')]({'where':{'id':_0x2ebef5[_0x4f2a('0x4d')]['id']}})['then'](handleEntityNotFound(_0x158b2d,null))[_0x4f2a('0x1e')](function(_0x5eae58){if(_0x5eae58){_0x2876cd=_0x5eae58;_0x3feb33[_0x4f2a('0x37')]=_[_0x4f2a('0x39')](db[_0x4f2a('0x56')][_0x4f2a('0x33')]);_0x3feb33['query']=_['keys'](_0x2ebef5[_0x4f2a('0x3a')]);_0x3feb33[_0x4f2a('0x3b')]=_[_0x4f2a('0x3c')](_0x3feb33[_0x4f2a('0x37')],_0x3feb33['query']);_0x2cef5b[_0x4f2a('0x3d')]=_['intersection'](_0x3feb33['model'],qs[_0x4f2a('0x3e')](_0x2ebef5[_0x4f2a('0x3a')][_0x4f2a('0x3e')]));_0x2cef5b[_0x4f2a('0x3d')]=_0x2cef5b[_0x4f2a('0x3d')]['length']?_0x2cef5b[_0x4f2a('0x3d')]:_0x3feb33[_0x4f2a('0x37')];_0x2cef5b[_0x4f2a('0x41')]=qs[_0x4f2a('0x42')](_0x2ebef5[_0x4f2a('0x3a')][_0x4f2a('0x42')]);_0x2cef5b[_0x4f2a('0x43')]=qs['filters'](_['pick'](_0x2ebef5[_0x4f2a('0x3a')],_0x3feb33['filters']));if(_0x2ebef5[_0x4f2a('0x3a')][_0x4f2a('0x47')]){_0x2cef5b['where']=_[_0x4f2a('0x45')](_0x2cef5b[_0x4f2a('0x43')],{'$or':_[_0x4f2a('0x38')](_0x2cef5b['attributes'],function(_0x56c09b){var _0x2d2743={};_0x2d2743[_0x56c09b]={'$like':'%'+_0x2ebef5['query'][_0x4f2a('0x47')]+'%'};return _0x2d2743;})});}_0x2cef5b=_['merge']({},_0x2cef5b,_0x2ebef5[_0x4f2a('0x48')]);return _0x2876cd[_0x4f2a('0x58')](_0x2cef5b);}})['then'](function(_0x357a90){if(_0x357a90){_0x3844f0=_0x357a90['length'];if(!_0x2ebef5['query'][_0x4f2a('0x3f')]('nolimit')){_0x2cef5b[_0x4f2a('0x2c')]=qs[_0x4f2a('0x2c')](_0x2ebef5[_0x4f2a('0x3a')][_0x4f2a('0x2c')]);_0x2cef5b[_0x4f2a('0x2b')]=qs['offset'](_0x2ebef5[_0x4f2a('0x3a')]['offset']);}return _0x2876cd['getSubjects'](_0x2cef5b);}})[_0x4f2a('0x1e')](function(_0x4f3487){if(_0x4f3487){return _0x4f3487?{'count':_0x3844f0,'rows':_0x4f3487}:null;}})[_0x4f2a('0x1e')](respondWithResult(_0x158b2d,null))['catch'](handleError(_0x158b2d,null));};exports['getDescriptions']=function(_0x192502,_0x21c0c5,_0x23a5f0){var _0x26cfc0={};var _0x1fd567={};var _0x2ebb94;var _0x4affff;return db[_0x4f2a('0x32')][_0x4f2a('0x55')]({'where':{'id':_0x192502[_0x4f2a('0x4d')]['id']}})[_0x4f2a('0x1e')](handleEntityNotFound(_0x21c0c5,null))['then'](function(_0x4acac1){if(_0x4acac1){_0x2ebb94=_0x4acac1;_0x1fd567['model']=_[_0x4f2a('0x39')](db[_0x4f2a('0x56')][_0x4f2a('0x33')]);_0x1fd567[_0x4f2a('0x3a')]=_[_0x4f2a('0x39')](_0x192502[_0x4f2a('0x3a')]);_0x1fd567[_0x4f2a('0x3b')]=_[_0x4f2a('0x3c')](_0x1fd567['model'],_0x1fd567[_0x4f2a('0x3a')]);_0x26cfc0[_0x4f2a('0x3d')]=_[_0x4f2a('0x3c')](_0x1fd567[_0x4f2a('0x37')],qs[_0x4f2a('0x3e')](_0x192502[_0x4f2a('0x3a')]['fields']));_0x26cfc0[_0x4f2a('0x3d')]=_0x26cfc0['attributes'][_0x4f2a('0x4e')]?_0x26cfc0[_0x4f2a('0x3d')]:_0x1fd567[_0x4f2a('0x37')];_0x26cfc0[_0x4f2a('0x41')]=qs[_0x4f2a('0x42')](_0x192502[_0x4f2a('0x3a')][_0x4f2a('0x42')]);_0x26cfc0[_0x4f2a('0x43')]=qs['filters'](_[_0x4f2a('0x44')](_0x192502[_0x4f2a('0x3a')],_0x1fd567[_0x4f2a('0x3b')]));if(_0x192502[_0x4f2a('0x3a')][_0x4f2a('0x47')]){_0x26cfc0[_0x4f2a('0x43')]=_['merge'](_0x26cfc0[_0x4f2a('0x43')],{'$or':_[_0x4f2a('0x38')](_0x26cfc0[_0x4f2a('0x3d')],function(_0xa11658){var _0x456390={};_0x456390[_0xa11658]={'$like':'%'+_0x192502[_0x4f2a('0x3a')][_0x4f2a('0x47')]+'%'};return _0x456390;})});}_0x26cfc0=_[_0x4f2a('0x45')]({},_0x26cfc0,_0x192502[_0x4f2a('0x48')]);return _0x2ebb94[_0x4f2a('0x59')](_0x26cfc0);}})[_0x4f2a('0x1e')](function(_0x48ca6e){if(_0x48ca6e){_0x4affff=_0x48ca6e[_0x4f2a('0x4e')];if(!_0x192502['query']['hasOwnProperty']('nolimit')){_0x26cfc0['limit']=qs[_0x4f2a('0x2c')](_0x192502[_0x4f2a('0x3a')]['limit']);_0x26cfc0[_0x4f2a('0x2b')]=qs[_0x4f2a('0x2b')](_0x192502[_0x4f2a('0x3a')][_0x4f2a('0x2b')]);}return _0x2ebb94[_0x4f2a('0x59')](_0x26cfc0);}})[_0x4f2a('0x1e')](function(_0x198060){if(_0x198060){return _0x198060?{'count':_0x4affff,'rows':_0x198060}:null;}})['then'](respondWithResult(_0x21c0c5,null))[_0x4f2a('0x26')](handleError(_0x21c0c5,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index b693658..3e6df13 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 _0x864c=['../../config/logger','bluebird','request-promise','path','../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration','int_zoho_configurations'];(function(_0x51cd26,_0xf2e5f3){var _0x9cfab7=function(_0x40e76e){while(--_0x40e76e){_0x51cd26['push'](_0x51cd26['shift']());}};_0x9cfab7(++_0xf2e5f3);}(_0x864c,0x117));var _0xc864=function(_0x145f32,_0x192cfa){_0x145f32=_0x145f32-0x0;var _0x1fbf5a=_0x864c[_0x145f32];return _0x1fbf5a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc864('0x0'))('api');var moment=require('moment');var BPromise=require(_0xc864('0x1'));var rp=require(_0xc864('0x2'));var fs=require('fs');var path=require(_0xc864('0x3'));var rimraf=require('rimraf');var config=require(_0xc864('0x4'));var attributes=require(_0xc864('0x5'));module['exports']=function(_0x3d55b0,_0x47ea81){return _0x3d55b0[_0xc864('0x6')](_0xc864('0x7'),attributes,{'tableName':_0xc864('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c48=['path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3681a4,_0x255a2e){var _0x1b7836=function(_0x24d81f){while(--_0x24d81f){_0x3681a4['push'](_0x3681a4['shift']());}};_0x1b7836(++_0x255a2e);}(_0x9c48,0x19f));var _0x89c4=function(_0x149cb3,_0x5abc68){_0x149cb3=_0x149cb3-0x0;var _0x3153a8=_0x9c48[_0x149cb3];return _0x3153a8;};'use strict';var _=require(_0x89c4('0x0'));var util=require(_0x89c4('0x1'));var logger=require(_0x89c4('0x2'))('api');var moment=require(_0x89c4('0x3'));var BPromise=require(_0x89c4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x89c4('0x5'));var rimraf=require(_0x89c4('0x6'));var config=require(_0x89c4('0x7'));var attributes=require(_0x89c4('0x8'));module[_0x89c4('0x9')]=function(_0x5e5887,_0x3850f9){return _0x5e5887[_0x89c4('0xa')]('ZohoConfiguration',attributes,{'tableName':_0x89c4('0xb'),'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 2f74bea..2224250 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 _0x8db9=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x4ace8b,_0x5e753f){var _0xc48b9f=function(_0x44ac69){while(--_0x44ac69){_0x4ace8b['push'](_0x4ace8b['shift']());}};_0xc48b9f(++_0x5e753f);}(_0x8db9,0x87));var _0x98db=function(_0x2ccb01,_0x56aedc){_0x2ccb01=_0x2ccb01-0x0;var _0x408035=_0x8db9[_0x2ccb01];return _0x408035;};'use strict';var _=require(_0x98db('0x0'));var util=require(_0x98db('0x1'));var moment=require(_0x98db('0x2'));var BPromise=require(_0x98db('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x98db('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x98db('0x5'))(_0x98db('0x6'));var config=require(_0x98db('0x7'));var jayson=require(_0x98db('0x8'));var client=jayson[_0x98db('0x9')][_0x98db('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57e470,_0x4995ab,_0x1ffa92){return new BPromise(function(_0x5c6626,_0x5891bd){return client['request'](_0x57e470,_0x1ffa92)[_0x98db('0xb')](function(_0x709f62){logger['info'](_0x98db('0xc'),_0x4995ab,_0x98db('0xd'));logger[_0x98db('0xe')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x4995ab,_0x98db('0xd'),JSON[_0x98db('0xf')](_0x709f62));if(_0x709f62[_0x98db('0x10')]){if(_0x709f62[_0x98db('0x10')]['code']===0x1f4){logger[_0x98db('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x4995ab,_0x709f62[_0x98db('0x10')][_0x98db('0x11')]);return _0x5891bd(_0x709f62[_0x98db('0x10')][_0x98db('0x11')]);}logger['error'](_0x98db('0xc'),_0x4995ab,_0x709f62[_0x98db('0x10')][_0x98db('0x11')]);return _0x5c6626(_0x709f62[_0x98db('0x10')][_0x98db('0x11')]);}else{logger[_0x98db('0x12')](_0x98db('0xc'),_0x4995ab,_0x98db('0xd'));_0x5c6626(_0x709f62[_0x98db('0x13')][_0x98db('0x11')]);}})['catch'](function(_0x432e8c){logger[_0x98db('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x4995ab,_0x432e8c);_0x5891bd(_0x432e8c);});});} \ No newline at end of file +var _0x9b41=['info','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x50fda2,_0x2406c6){var _0x486572=function(_0x19a2ad){while(--_0x19a2ad){_0x50fda2['push'](_0x50fda2['shift']());}};_0x486572(++_0x2406c6);}(_0x9b41,0x14b));var _0x19b4=function(_0x13fd59,_0x2e05b1){_0x13fd59=_0x13fd59-0x0;var _0x2e6ce7=_0x9b41[_0x13fd59];return _0x2e6ce7;};'use strict';var _=require(_0x19b4('0x0'));var util=require(_0x19b4('0x1'));var moment=require(_0x19b4('0x2'));var BPromise=require(_0x19b4('0x3'));var rs=require(_0x19b4('0x4'));var fs=require('fs');var Redis=require(_0x19b4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x19b4('0x6'));var logger=require(_0x19b4('0x7'))(_0x19b4('0x8'));var config=require(_0x19b4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x19b4('0xa')][_0x19b4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26e470,_0x1ab38f,_0x689f8b){return new BPromise(function(_0x48d93c,_0x4c477a){return client[_0x19b4('0xc')](_0x26e470,_0x689f8b)[_0x19b4('0xd')](function(_0x3495d5){logger[_0x19b4('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x1ab38f,'request\x20sent');logger['debug'](_0x19b4('0xf'),_0x1ab38f,_0x19b4('0x10'),JSON[_0x19b4('0x11')](_0x3495d5));if(_0x3495d5[_0x19b4('0x12')]){if(_0x3495d5[_0x19b4('0x12')][_0x19b4('0x13')]===0x1f4){logger[_0x19b4('0x12')](_0x19b4('0x14'),_0x1ab38f,_0x3495d5[_0x19b4('0x12')][_0x19b4('0x15')]);return _0x4c477a(_0x3495d5[_0x19b4('0x12')][_0x19b4('0x15')]);}logger[_0x19b4('0x12')](_0x19b4('0x14'),_0x1ab38f,_0x3495d5['error'][_0x19b4('0x15')]);return _0x48d93c(_0x3495d5[_0x19b4('0x12')][_0x19b4('0x15')]);}else{logger[_0x19b4('0xe')](_0x19b4('0x14'),_0x1ab38f,_0x19b4('0x10'));_0x48d93c(_0x3495d5['result'][_0x19b4('0x15')]);}})[_0x19b4('0x16')](function(_0x5195b5){logger[_0x19b4('0x12')](_0x19b4('0x14'),_0x1ab38f,_0x5195b5);_0x4c477a(_0x5195b5);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index a5fce2d..690aa4b 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 _0xc902=['isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','/:id'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc902,0x15c));var _0x2c90=function(_0x2c317f,_0xeac12a){_0x2c317f=_0x2c317f-0x0;var _0x4b2397=_0xc902[_0x2c317f];return _0x4b2397;};'use strict';var multer=require(_0x2c90('0x0'));var util=require(_0x2c90('0x1'));var path=require(_0x2c90('0x2'));var timeout=require(_0x2c90('0x3'));var express=require(_0x2c90('0x4'));var router=express[_0x2c90('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2c90('0x6'));var interaction=require(_0x2c90('0x7'));var config=require(_0x2c90('0x8'));var controller=require(_0x2c90('0x9'));router[_0x2c90('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2c90('0xa')](_0x2c90('0xb'),auth[_0x2c90('0xc')](),controller[_0x2c90('0xd')]);router[_0x2c90('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2c90('0xf')]('/:id',auth[_0x2c90('0xc')](),controller[_0x2c90('0x10')]);router[_0x2c90('0x11')](_0x2c90('0xb'),auth[_0x2c90('0xc')](),controller[_0x2c90('0x12')]);module[_0x2c90('0x13')]=router; \ No newline at end of file +var _0x85d3=['destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','post','create','put','delete'];(function(_0x3f7e52,_0x3c422e){var _0x3f849f=function(_0xf96ee0){while(--_0xf96ee0){_0x3f7e52['push'](_0x3f7e52['shift']());}};_0x3f849f(++_0x3c422e);}(_0x85d3,0xc8));var _0x385d=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x85d3[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x385d('0x0'));var util=require(_0x385d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x385d('0x2'));var router=express[_0x385d('0x3')]();var fs_extra=require(_0x385d('0x4'));var auth=require(_0x385d('0x5'));var interaction=require(_0x385d('0x6'));var config=require(_0x385d('0x7'));var controller=require('./intZohoField.controller');router[_0x385d('0x8')]('/',auth['isAuthenticated'](),controller[_0x385d('0x9')]);router[_0x385d('0x8')](_0x385d('0xa'),auth[_0x385d('0xb')](),controller['show']);router[_0x385d('0xc')]('/',auth[_0x385d('0xb')](),controller[_0x385d('0xd')]);router[_0x385d('0xe')](_0x385d('0xa'),auth[_0x385d('0xb')](),controller['update']);router[_0x385d('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x385d('0x10')]);module[_0x385d('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index ad47f01..cfdd4bd 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 _0x07c3=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x4e3c89,_0x3fa9f4){var _0x44f53e=function(_0x48f013){while(--_0x48f013){_0x4e3c89['push'](_0x4e3c89['shift']());}};_0x44f53e(++_0x3fa9f4);}(_0x07c3,0x1bf));var _0x307c=function(_0x4a82ac,_0x1fb931){_0x4a82ac=_0x4a82ac-0x0;var _0x58ee97=_0x07c3[_0x4a82ac];return _0x58ee97;};'use strict';var Sequelize=require(_0x307c('0x0'));module[_0x307c('0x1')]={'type':{'type':Sequelize[_0x307c('0x2')](_0x307c('0x3'),_0x307c('0x4'),_0x307c('0x5'),_0x307c('0x6'),_0x307c('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x307c('0x8')]},'key':{'type':Sequelize[_0x307c('0x8')]},'keyType':{'type':Sequelize[_0x307c('0x2')](_0x307c('0x3'),_0x307c('0x4'),_0x307c('0x5'))},'keyContent':{'type':Sequelize[_0x307c('0x8')]},'idField':{'type':Sequelize[_0x307c('0x8')]},'nameField':{'type':Sequelize[_0x307c('0x8')]},'customField':{'type':Sequelize[_0x307c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x307c('0x8')]}}; \ No newline at end of file +var _0xcb81=['string','picklist','STRING','ENUM','variable','customVariable','BOOLEAN','sequelize','exports'];(function(_0x164f31,_0x369e5a){var _0x59914c=function(_0x304aaa){while(--_0x304aaa){_0x164f31['push'](_0x164f31['shift']());}};_0x59914c(++_0x369e5a);}(_0xcb81,0x154));var _0x1cb8=function(_0x5d88c0,_0x5d7d83){_0x5d88c0=_0x5d88c0-0x0;var _0x1b40f0=_0xcb81[_0x5d88c0];return _0x1b40f0;};'use strict';var Sequelize=require(_0x1cb8('0x0'));module[_0x1cb8('0x1')]={'type':{'type':Sequelize['ENUM'](_0x1cb8('0x2'),'variable','customVariable','keyValue',_0x1cb8('0x3')),'defaultValue':_0x1cb8('0x2')},'content':{'type':Sequelize[_0x1cb8('0x4')]},'key':{'type':Sequelize[_0x1cb8('0x4')]},'keyType':{'type':Sequelize[_0x1cb8('0x5')]('string',_0x1cb8('0x6'),_0x1cb8('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1cb8('0x4')]},'nameField':{'type':Sequelize[_0x1cb8('0x4')]},'customField':{'type':Sequelize[_0x1cb8('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 526f347..39f3783 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 _0x9af2=['index','ZohoField','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','nolimit','sort','filters','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','update','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send'];(function(_0x55f549,_0x4f90ac){var _0x589a78=function(_0x4b2cc3){while(--_0x4b2cc3){_0x55f549['push'](_0x55f549['shift']());}};_0x589a78(++_0x4f90ac);}(_0x9af2,0x1dc));var _0x29af=function(_0x10a940,_0x2dbfbd){_0x10a940=_0x10a940-0x0;var _0x1959da=_0x9af2[_0x10a940];return _0x1959da;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x29af('0x0'));var rimraf=require(_0x29af('0x1'));var zipdir=require(_0x29af('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x29af('0x3'));var BPromise=require(_0x29af('0x4'));var Mustache=require(_0x29af('0x5'));var util=require(_0x29af('0x6'));var path=require(_0x29af('0x7'));var sox=require(_0x29af('0x8'));var csv=require('to-csv');var ejs=require(_0x29af('0x9'));var fs=require('fs');var fs_extra=require(_0x29af('0xa'));var _=require(_0x29af('0xb'));var squel=require(_0x29af('0xc'));var crypto=require('crypto');var jsforce=require(_0x29af('0xd'));var deskjs=require(_0x29af('0xe'));var toCsv=require(_0x29af('0xf'));var querystring=require(_0x29af('0x10'));var Papa=require(_0x29af('0x11'));var Redis=require(_0x29af('0x12'));var authService=require(_0x29af('0x13'));var qs=require(_0x29af('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x29af('0x15'))(_0x29af('0x16'));var utils=require(_0x29af('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x29af('0x18'))['db'];function respondWithStatusCode(_0x36477b,_0x5a2f25){_0x5a2f25=_0x5a2f25||0xcc;return function(_0x31da86){if(_0x31da86){return _0x36477b[_0x29af('0x19')](_0x5a2f25);}return _0x36477b[_0x29af('0x1a')](_0x5a2f25)[_0x29af('0x1b')]();};}function respondWithResult(_0x26f389,_0x1d8081){_0x1d8081=_0x1d8081||0xc8;return function(_0x32ca2f){if(_0x32ca2f){return _0x26f389[_0x29af('0x1a')](_0x1d8081)[_0x29af('0x1c')](_0x32ca2f);}};}function respondWithFilteredResult(_0x380492,_0x35b51a){return function(_0x34d7c6){if(_0x34d7c6){var _0x1d8349=_0x34d7c6[_0x29af('0x1d')],_0x3d17e0=_0x35b51a[_0x29af('0x1e')],_0xa4e688=_0x35b51a[_0x29af('0x1e')]+_0x35b51a[_0x29af('0x1f')],_0x5d8bfc;if(_0xa4e688>=_0x1d8349){_0xa4e688=_0x1d8349;_0x5d8bfc=0xc8;}else{_0x5d8bfc=0xce;}_0x380492[_0x29af('0x1a')](_0x5d8bfc);return _0x380492[_0x29af('0x20')](_0x29af('0x21'),_0x3d17e0+'-'+_0xa4e688+'/'+_0x1d8349)[_0x29af('0x1c')](_0x34d7c6);}return null;};}function patchUpdates(_0x4db89b){return function(_0x1591ea){try{jsonpatch['apply'](_0x1591ea,_0x4db89b,!![]);}catch(_0x16c7f4){return BPromise[_0x29af('0x22')](_0x16c7f4);}return _0x1591ea[_0x29af('0x23')]();};}function saveUpdates(_0x32a447,_0x17137f){return function(_0x1b1cad){if(_0x1b1cad){return _0x1b1cad['update'](_0x32a447)[_0x29af('0x24')](function(_0x324731){return _0x324731;});}return null;};}function removeEntity(_0x59d2d9,_0x1c6241){return function(_0x327bc1){if(_0x327bc1){return _0x327bc1[_0x29af('0x25')]()[_0x29af('0x24')](function(){_0x59d2d9[_0x29af('0x1a')](0xcc)[_0x29af('0x1b')]();});}};}function handleEntityNotFound(_0x1bc09a,_0x2f115a){return function(_0x5a91d8){if(!_0x5a91d8){_0x1bc09a['sendStatus'](0x194);}return _0x5a91d8;};}function handleError(_0x4b7606,_0x57bfac){_0x57bfac=_0x57bfac||0x1f4;return function(_0x19229f){logger[_0x29af('0x26')](_0x19229f[_0x29af('0x27')]);if(_0x19229f[_0x29af('0x28')]){delete _0x19229f[_0x29af('0x28')];}_0x4b7606[_0x29af('0x1a')](_0x57bfac)[_0x29af('0x29')](_0x19229f);};}exports[_0x29af('0x2a')]=function(_0x1ad69d,_0x57d27a){var _0x47cba6={},_0x1008a7={},_0x27e2d3={'count':0x0,'rows':[]};var _0x2bf7ff=_['map'](db[_0x29af('0x2b')][_0x29af('0x2c')],function(_0xe50e12){return{'name':_0xe50e12[_0x29af('0x2d')],'type':_0xe50e12[_0x29af('0x2e')][_0x29af('0x2f')]};});_0x1008a7[_0x29af('0x30')]=_[_0x29af('0x31')](_0x2bf7ff,_0x29af('0x28'));_0x1008a7['query']=_['keys'](_0x1ad69d[_0x29af('0x32')]);_0x1008a7['filters']=_[_0x29af('0x33')](_0x1008a7['model'],_0x1008a7[_0x29af('0x32')]);_0x47cba6[_0x29af('0x34')]=_['intersection'](_0x1008a7[_0x29af('0x30')],qs['fields'](_0x1ad69d[_0x29af('0x32')][_0x29af('0x35')]));_0x47cba6[_0x29af('0x34')]=_0x47cba6[_0x29af('0x34')]['length']?_0x47cba6['attributes']:_0x1008a7[_0x29af('0x30')];if(!_0x1ad69d[_0x29af('0x32')]['hasOwnProperty'](_0x29af('0x36'))){_0x47cba6[_0x29af('0x1f')]=qs['limit'](_0x1ad69d[_0x29af('0x32')][_0x29af('0x1f')]);_0x47cba6[_0x29af('0x1e')]=qs[_0x29af('0x1e')](_0x1ad69d['query'][_0x29af('0x1e')]);}_0x47cba6['order']=qs[_0x29af('0x37')](_0x1ad69d[_0x29af('0x32')][_0x29af('0x37')]);_0x47cba6['where']=qs[_0x29af('0x38')](_['pick'](_0x1ad69d[_0x29af('0x32')],_0x1008a7[_0x29af('0x38')]),_0x2bf7ff);if(_0x1ad69d['query'][_0x29af('0x39')]){_0x47cba6[_0x29af('0x3a')]=_[_0x29af('0x3b')](_0x47cba6[_0x29af('0x3a')],{'$or':_[_0x29af('0x31')](_0x2bf7ff,function(_0x4f2604){if(_0x4f2604[_0x29af('0x2e')]!==_0x29af('0x3c')){var _0x2b2e83={};_0x2b2e83[_0x4f2604[_0x29af('0x28')]]={'$like':'%'+_0x1ad69d[_0x29af('0x32')][_0x29af('0x39')]+'%'};return _0x2b2e83;}})});}_0x47cba6=_[_0x29af('0x3b')]({},_0x47cba6,_0x1ad69d['options']);var _0x1ae071={'where':_0x47cba6[_0x29af('0x3a')]};return db[_0x29af('0x2b')][_0x29af('0x1d')](_0x1ae071)[_0x29af('0x24')](function(_0x22226e){_0x27e2d3[_0x29af('0x1d')]=_0x22226e;if(_0x1ad69d[_0x29af('0x32')][_0x29af('0x3d')]){_0x47cba6[_0x29af('0x3e')]=[{'all':!![]}];}return db[_0x29af('0x2b')][_0x29af('0x3f')](_0x47cba6);})[_0x29af('0x24')](function(_0x2aca03){_0x27e2d3[_0x29af('0x40')]=_0x2aca03;return _0x27e2d3;})[_0x29af('0x24')](respondWithFilteredResult(_0x57d27a,_0x47cba6))['catch'](handleError(_0x57d27a,null));};exports[_0x29af('0x41')]=function(_0x2e9b01,_0x28f276){var _0x5dfd3f={'raw':!![],'where':{'id':_0x2e9b01[_0x29af('0x42')]['id']}},_0x40c45c={};_0x40c45c[_0x29af('0x30')]=_['keys'](db[_0x29af('0x2b')]['rawAttributes']);_0x40c45c[_0x29af('0x32')]=_[_0x29af('0x43')](_0x2e9b01[_0x29af('0x32')]);_0x40c45c['filters']=_[_0x29af('0x33')](_0x40c45c[_0x29af('0x30')],_0x40c45c['query']);_0x5dfd3f[_0x29af('0x34')]=_[_0x29af('0x33')](_0x40c45c[_0x29af('0x30')],qs[_0x29af('0x35')](_0x2e9b01[_0x29af('0x32')][_0x29af('0x35')]));_0x5dfd3f[_0x29af('0x34')]=_0x5dfd3f[_0x29af('0x34')]['length']?_0x5dfd3f[_0x29af('0x34')]:_0x40c45c[_0x29af('0x30')];if(_0x2e9b01[_0x29af('0x32')][_0x29af('0x3d')]){_0x5dfd3f['include']=[{'all':!![]}];}_0x5dfd3f=_['merge']({},_0x5dfd3f,_0x2e9b01[_0x29af('0x44')]);return db['ZohoField'][_0x29af('0x45')](_0x5dfd3f)[_0x29af('0x24')](handleEntityNotFound(_0x28f276,null))['then'](respondWithResult(_0x28f276,null))[_0x29af('0x46')](handleError(_0x28f276,null));};exports[_0x29af('0x47')]=function(_0x46c10e,_0x9f003e){return db['ZohoField']['create'](_0x46c10e[_0x29af('0x48')],{})['then'](respondWithResult(_0x9f003e,0xc9))[_0x29af('0x46')](handleError(_0x9f003e,null));};exports[_0x29af('0x49')]=function(_0x213513,_0xeb46ef){if(_0x213513[_0x29af('0x48')]['id']){delete _0x213513['body']['id'];}return db[_0x29af('0x2b')]['find']({'where':{'id':_0x213513['params']['id']}})[_0x29af('0x24')](handleEntityNotFound(_0xeb46ef,null))['then'](saveUpdates(_0x213513[_0x29af('0x48')],null))['then'](respondWithResult(_0xeb46ef,null))['catch'](handleError(_0xeb46ef,null));};exports[_0x29af('0x25')]=function(_0x129c8f,_0x3420a9){return db[_0x29af('0x2b')][_0x29af('0x45')]({'where':{'id':_0x129c8f['params']['id']}})[_0x29af('0x24')](handleEntityNotFound(_0x3420a9,null))[_0x29af('0x24')](removeEntity(_0x3420a9,null))[_0x29af('0x46')](handleError(_0x3420a9,null));}; \ No newline at end of file +var _0x4605=['limit','set','reject','save','then','destroy','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','html-pdf','rimraf','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset'];(function(_0x5647c9,_0xf4e8b0){var _0x5e58ef=function(_0x2ab3e4){while(--_0x2ab3e4){_0x5647c9['push'](_0x5647c9['shift']());}};_0x5e58ef(++_0xf4e8b0);}(_0x4605,0xba));var _0x5460=function(_0x55e62b,_0x4f34ac){_0x55e62b=_0x55e62b-0x0;var _0xa7162f=_0x4605[_0x55e62b];return _0xa7162f;};'use strict';var pdf=require(_0x5460('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5460('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5460('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5460('0x3'));var Mustache=require(_0x5460('0x4'));var util=require(_0x5460('0x5'));var path=require(_0x5460('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5460('0x7'));var fs=require('fs');var fs_extra=require(_0x5460('0x8'));var _=require(_0x5460('0x9'));var squel=require(_0x5460('0xa'));var crypto=require(_0x5460('0xb'));var jsforce=require(_0x5460('0xc'));var deskjs=require(_0x5460('0xd'));var toCsv=require(_0x5460('0xe'));var querystring=require(_0x5460('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5460('0x10'));var qs=require(_0x5460('0x11'));var as=require(_0x5460('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5460('0x13'))(_0x5460('0x14'));var utils=require('../../config/utils');var config=require(_0x5460('0x15'));var licenseUtil=require(_0x5460('0x16'));var db=require(_0x5460('0x17'))['db'];function respondWithStatusCode(_0x3317cf,_0x1b3142){_0x1b3142=_0x1b3142||0xcc;return function(_0x2ba6d9){if(_0x2ba6d9){return _0x3317cf[_0x5460('0x18')](_0x1b3142);}return _0x3317cf[_0x5460('0x19')](_0x1b3142)[_0x5460('0x1a')]();};}function respondWithResult(_0x4e3ee6,_0x47e0ed){_0x47e0ed=_0x47e0ed||0xc8;return function(_0x34d909){if(_0x34d909){return _0x4e3ee6[_0x5460('0x19')](_0x47e0ed)[_0x5460('0x1b')](_0x34d909);}};}function respondWithFilteredResult(_0xcfc41d,_0x1d6692){return function(_0x139029){if(_0x139029){var _0x503139=_0x139029[_0x5460('0x1c')],_0x338b80=_0x1d6692[_0x5460('0x1d')],_0x1f613f=_0x1d6692[_0x5460('0x1d')]+_0x1d6692[_0x5460('0x1e')],_0x4e25ac;if(_0x1f613f>=_0x503139){_0x1f613f=_0x503139;_0x4e25ac=0xc8;}else{_0x4e25ac=0xce;}_0xcfc41d[_0x5460('0x19')](_0x4e25ac);return _0xcfc41d[_0x5460('0x1f')]('Content-Range',_0x338b80+'-'+_0x1f613f+'/'+_0x503139)['json'](_0x139029);}return null;};}function patchUpdates(_0x597745){return function(_0x53da5a){try{jsonpatch['apply'](_0x53da5a,_0x597745,!![]);}catch(_0xf4853f){return BPromise[_0x5460('0x20')](_0xf4853f);}return _0x53da5a[_0x5460('0x21')]();};}function saveUpdates(_0x3d9d46,_0x8b13ec){return function(_0x59729f){if(_0x59729f){return _0x59729f['update'](_0x3d9d46)[_0x5460('0x22')](function(_0x5be19a){return _0x5be19a;});}return null;};}function removeEntity(_0x52b4a8,_0x27882f){return function(_0x2f2683){if(_0x2f2683){return _0x2f2683[_0x5460('0x23')]()[_0x5460('0x22')](function(){_0x52b4a8['status'](0xcc)[_0x5460('0x1a')]();});}};}function handleEntityNotFound(_0x2cc430,_0x435e47){return function(_0x54d681){if(!_0x54d681){_0x2cc430[_0x5460('0x18')](0x194);}return _0x54d681;};}function handleError(_0x4b1eac,_0x3c5e6c){_0x3c5e6c=_0x3c5e6c||0x1f4;return function(_0x26f45a){logger['error'](_0x26f45a['stack']);if(_0x26f45a[_0x5460('0x24')]){delete _0x26f45a[_0x5460('0x24')];}_0x4b1eac['status'](_0x3c5e6c)[_0x5460('0x25')](_0x26f45a);};}exports[_0x5460('0x26')]=function(_0xd40cb7,_0x450899){var _0x3fb2bb={},_0x2a770c={},_0x4a297e={'count':0x0,'rows':[]};var _0x6a9fd1=_[_0x5460('0x27')](db[_0x5460('0x28')][_0x5460('0x29')],function(_0x3b1348){return{'name':_0x3b1348[_0x5460('0x2a')],'type':_0x3b1348[_0x5460('0x2b')][_0x5460('0x2c')]};});_0x2a770c[_0x5460('0x2d')]=_['map'](_0x6a9fd1,'name');_0x2a770c[_0x5460('0x2e')]=_['keys'](_0xd40cb7[_0x5460('0x2e')]);_0x2a770c['filters']=_[_0x5460('0x2f')](_0x2a770c['model'],_0x2a770c[_0x5460('0x2e')]);_0x3fb2bb[_0x5460('0x30')]=_[_0x5460('0x2f')](_0x2a770c[_0x5460('0x2d')],qs[_0x5460('0x31')](_0xd40cb7[_0x5460('0x2e')][_0x5460('0x31')]));_0x3fb2bb[_0x5460('0x30')]=_0x3fb2bb[_0x5460('0x30')][_0x5460('0x32')]?_0x3fb2bb[_0x5460('0x30')]:_0x2a770c[_0x5460('0x2d')];if(!_0xd40cb7[_0x5460('0x2e')]['hasOwnProperty'](_0x5460('0x33'))){_0x3fb2bb[_0x5460('0x1e')]=qs[_0x5460('0x1e')](_0xd40cb7['query'][_0x5460('0x1e')]);_0x3fb2bb[_0x5460('0x1d')]=qs[_0x5460('0x1d')](_0xd40cb7[_0x5460('0x2e')][_0x5460('0x1d')]);}_0x3fb2bb[_0x5460('0x34')]=qs[_0x5460('0x35')](_0xd40cb7[_0x5460('0x2e')][_0x5460('0x35')]);_0x3fb2bb[_0x5460('0x36')]=qs[_0x5460('0x37')](_[_0x5460('0x38')](_0xd40cb7[_0x5460('0x2e')],_0x2a770c[_0x5460('0x37')]),_0x6a9fd1);if(_0xd40cb7['query'][_0x5460('0x39')]){_0x3fb2bb[_0x5460('0x36')]=_[_0x5460('0x3a')](_0x3fb2bb[_0x5460('0x36')],{'$or':_[_0x5460('0x27')](_0x6a9fd1,function(_0x3c2d04){if(_0x3c2d04['type']!=='VIRTUAL'){var _0x4a7b0d={};_0x4a7b0d[_0x3c2d04[_0x5460('0x24')]]={'$like':'%'+_0xd40cb7[_0x5460('0x2e')][_0x5460('0x39')]+'%'};return _0x4a7b0d;}})});}_0x3fb2bb=_[_0x5460('0x3a')]({},_0x3fb2bb,_0xd40cb7[_0x5460('0x3b')]);var _0x2b838c={'where':_0x3fb2bb[_0x5460('0x36')]};return db[_0x5460('0x28')][_0x5460('0x1c')](_0x2b838c)['then'](function(_0x59bed4){_0x4a297e[_0x5460('0x1c')]=_0x59bed4;if(_0xd40cb7['query'][_0x5460('0x3c')]){_0x3fb2bb[_0x5460('0x3d')]=[{'all':!![]}];}return db[_0x5460('0x28')][_0x5460('0x3e')](_0x3fb2bb);})[_0x5460('0x22')](function(_0x50e154){_0x4a297e[_0x5460('0x3f')]=_0x50e154;return _0x4a297e;})[_0x5460('0x22')](respondWithFilteredResult(_0x450899,_0x3fb2bb))[_0x5460('0x40')](handleError(_0x450899,null));};exports[_0x5460('0x41')]=function(_0x3e8b52,_0x159c51){var _0x45be9e={'raw':!![],'where':{'id':_0x3e8b52[_0x5460('0x42')]['id']}},_0x3717a4={};_0x3717a4[_0x5460('0x2d')]=_[_0x5460('0x43')](db['ZohoField']['rawAttributes']);_0x3717a4['query']=_[_0x5460('0x43')](_0x3e8b52['query']);_0x3717a4[_0x5460('0x37')]=_[_0x5460('0x2f')](_0x3717a4[_0x5460('0x2d')],_0x3717a4[_0x5460('0x2e')]);_0x45be9e[_0x5460('0x30')]=_['intersection'](_0x3717a4[_0x5460('0x2d')],qs[_0x5460('0x31')](_0x3e8b52['query'][_0x5460('0x31')]));_0x45be9e[_0x5460('0x30')]=_0x45be9e[_0x5460('0x30')][_0x5460('0x32')]?_0x45be9e[_0x5460('0x30')]:_0x3717a4[_0x5460('0x2d')];if(_0x3e8b52[_0x5460('0x2e')][_0x5460('0x3c')]){_0x45be9e[_0x5460('0x3d')]=[{'all':!![]}];}_0x45be9e=_[_0x5460('0x3a')]({},_0x45be9e,_0x3e8b52[_0x5460('0x3b')]);return db[_0x5460('0x28')][_0x5460('0x44')](_0x45be9e)[_0x5460('0x22')](handleEntityNotFound(_0x159c51,null))[_0x5460('0x22')](respondWithResult(_0x159c51,null))['catch'](handleError(_0x159c51,null));};exports[_0x5460('0x45')]=function(_0x28336f,_0x53d6fe){return db['ZohoField'][_0x5460('0x45')](_0x28336f[_0x5460('0x46')],{})[_0x5460('0x22')](respondWithResult(_0x53d6fe,0xc9))[_0x5460('0x40')](handleError(_0x53d6fe,null));};exports[_0x5460('0x47')]=function(_0x21d026,_0x4bc8d9){if(_0x21d026[_0x5460('0x46')]['id']){delete _0x21d026['body']['id'];}return db[_0x5460('0x28')]['find']({'where':{'id':_0x21d026['params']['id']}})['then'](handleEntityNotFound(_0x4bc8d9,null))[_0x5460('0x22')](saveUpdates(_0x21d026[_0x5460('0x46')],null))[_0x5460('0x22')](respondWithResult(_0x4bc8d9,null))[_0x5460('0x40')](handleError(_0x4bc8d9,null));};exports[_0x5460('0x23')]=function(_0x3424ae,_0x322b65){return db['ZohoField'][_0x5460('0x44')]({'where':{'id':_0x3424ae['params']['id']}})[_0x5460('0x22')](handleEntityNotFound(_0x322b65,null))[_0x5460('0x22')](removeEntity(_0x322b65,null))[_0x5460('0x40')](handleError(_0x322b65,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 4d72680..97c6ec2 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 _0xfce6=['exports','ZohoField','int_zoho_fields','zoho_unique_index','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes'];(function(_0x55b637,_0x5bbfd3){var _0x9d011c=function(_0x565ac7){while(--_0x565ac7){_0x55b637['push'](_0x55b637['shift']());}};_0x9d011c(++_0x5bbfd3);}(_0xfce6,0x18a));var _0x6fce=function(_0x1633f0,_0x170f32){_0x1633f0=_0x1633f0-0x0;var _0x2c4066=_0xfce6[_0x1633f0];return _0x2c4066;};'use strict';var _=require(_0x6fce('0x0'));var util=require(_0x6fce('0x1'));var logger=require(_0x6fce('0x2'))(_0x6fce('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6fce('0x4'));var fs=require('fs');var path=require(_0x6fce('0x5'));var rimraf=require(_0x6fce('0x6'));var config=require(_0x6fce('0x7'));var attributes=require(_0x6fce('0x8'));module[_0x6fce('0x9')]=function(_0x588c89,_0x3f5943){return _0x588c89['define'](_0x6fce('0xa'),attributes,{'tableName':_0x6fce('0xb'),'paranoid':![],'indexes':[{'name':_0x6fce('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xad0c=['rimraf','../../config/environment','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x2c2439,_0x325167){var _0x2db2ef=function(_0x2bfc54){while(--_0x2bfc54){_0x2c2439['push'](_0x2c2439['shift']());}};_0x2db2ef(++_0x325167);}(_0xad0c,0xa9));var _0xcad0=function(_0x26a65d,_0x3687ee){_0x26a65d=_0x26a65d-0x0;var _0x14558e=_0xad0c[_0x26a65d];return _0x14558e;};'use strict';var _=require(_0xcad0('0x0'));var util=require(_0xcad0('0x1'));var logger=require(_0xcad0('0x2'))(_0xcad0('0x3'));var moment=require(_0xcad0('0x4'));var BPromise=require(_0xcad0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcad0('0x6'));var rimraf=require(_0xcad0('0x7'));var config=require(_0xcad0('0x8'));var attributes=require('./intZohoField.attributes');module[_0xcad0('0x9')]=function(_0x29ac58,_0xdd5434){return _0x29ac58[_0xcad0('0xa')](_0xcad0('0xb'),attributes,{'tableName':_0xcad0('0xc'),'paranoid':![],'indexes':[{'name':_0xcad0('0xd'),'fields':[_0xcad0('0xe'),_0xcad0('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 054f36f..4ef66e8 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 _0x0a9a=['ZohoField,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x3ee55a,_0x19aeea){var _0x581800=function(_0x636cb7){while(--_0x636cb7){_0x3ee55a['push'](_0x3ee55a['shift']());}};_0x581800(++_0x19aeea);}(_0x0a9a,0x183));var _0xa0a9=function(_0x4f7be1,_0x5294e1){_0x4f7be1=_0x4f7be1-0x0;var _0x568c46=_0x0a9a[_0x4f7be1];return _0x568c46;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var moment=require('moment');var BPromise=require(_0xa0a9('0x1'));var rs=require(_0xa0a9('0x2'));var fs=require('fs');var Redis=require(_0xa0a9('0x3'));var db=require(_0xa0a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0a9('0x7'));var client=jayson[_0xa0a9('0x8')][_0xa0a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31d689,_0x499a29,_0x2b2eb4){return new BPromise(function(_0x520f42,_0x10aa8a){return client[_0xa0a9('0xa')](_0x31d689,_0x2b2eb4)[_0xa0a9('0xb')](function(_0x2d6ac0){logger['info'](_0xa0a9('0xc'),_0x499a29,_0xa0a9('0xd'));logger['debug']('ZohoField,\x20%s,\x20%s,\x20%s',_0x499a29,_0xa0a9('0xd'),JSON[_0xa0a9('0xe')](_0x2d6ac0));if(_0x2d6ac0['error']){if(_0x2d6ac0[_0xa0a9('0xf')]['code']===0x1f4){logger[_0xa0a9('0xf')]('ZohoField,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x10aa8a(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}logger[_0xa0a9('0xf')]('ZohoField,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x520f42(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}else{logger[_0xa0a9('0x11')](_0xa0a9('0xc'),_0x499a29,'request\x20sent');_0x520f42(_0x2d6ac0[_0xa0a9('0x12')]['message']);}})['catch'](function(_0x347092){logger[_0xa0a9('0xf')](_0xa0a9('0xc'),_0x499a29,_0x347092);_0x10aa8a(_0x347092);});});} \ No newline at end of file +var _0xeec6=['then','info','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','error','ZohoField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x5b64a1,_0x2ec810){var _0x4b6f55=function(_0x44dd84){while(--_0x44dd84){_0x5b64a1['push'](_0x5b64a1['shift']());}};_0x4b6f55(++_0x2ec810);}(_0xeec6,0x1c2));var _0x6eec=function(_0x485abd,_0x32c7c1){_0x485abd=_0x485abd-0x0;var _0x3379f1=_0xeec6[_0x485abd];return _0x3379f1;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var moment=require(_0x6eec('0x2'));var BPromise=require(_0x6eec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6eec('0x4'));var db=require(_0x6eec('0x5'))['db'];var utils=require(_0x6eec('0x6'));var logger=require(_0x6eec('0x7'))(_0x6eec('0x8'));var config=require(_0x6eec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6eec('0xa')][_0x6eec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48064a,_0x5a5e47,_0x1c810e){return new BPromise(function(_0x3443c2,_0x834c2){return client['request'](_0x48064a,_0x1c810e)[_0x6eec('0xc')](function(_0x3aca38){logger[_0x6eec('0xd')]('ZohoField,\x20%s,\x20%s',_0x5a5e47,'request\x20sent');logger['debug'](_0x6eec('0xe'),_0x5a5e47,_0x6eec('0xf'),JSON['stringify'](_0x3aca38));if(_0x3aca38['error']){if(_0x3aca38[_0x6eec('0x10')]['code']===0x1f4){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x834c2(_0x3aca38[_0x6eec('0x10')]['message']);}logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x3443c2(_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);}else{logger[_0x6eec('0xd')](_0x6eec('0x11'),_0x5a5e47,_0x6eec('0xf'));_0x3443c2(_0x3aca38[_0x6eec('0x13')]['message']);}})[_0x6eec('0x14')](function(_0x5f1f33){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x5f1f33);_0x834c2(_0x5f1f33);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 0d6e7f6..bbe3d2d 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 _0xfef3=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x382d3d,_0x598c42){var _0x526418=function(_0x5d52b8){while(--_0x5d52b8){_0x382d3d['push'](_0x382d3d['shift']());}};_0x526418(++_0x598c42);}(_0xfef3,0x118));var _0x3fef=function(_0x2f37e0,_0x393ef9){_0x2f37e0=_0x2f37e0-0x0;var _0x43ccce=_0xfef3[_0x2f37e0];return _0x43ccce;};'use strict';var multer=require(_0x3fef('0x0'));var util=require('util');var path=require(_0x3fef('0x1'));var timeout=require('connect-timeout');var express=require(_0x3fef('0x2'));var router=express[_0x3fef('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3fef('0x4'));var interaction=require(_0x3fef('0x5'));var config=require('../../config/environment');module[_0x3fef('0x6')]=router; \ No newline at end of file +var _0xf6ed=['multer','path','connect-timeout','express','../../components/auth/service','exports'];(function(_0x1034ca,_0x14ecd6){var _0x1a023a=function(_0x2cfa65){while(--_0x2cfa65){_0x1034ca['push'](_0x1034ca['shift']());}};_0x1a023a(++_0x14ecd6);}(_0xf6ed,0x1ce));var _0xdf6e=function(_0x16d367,_0x58c247){_0x16d367=_0x16d367-0x0;var _0x1d4831=_0xf6ed[_0x16d367];return _0x1d4831;};'use strict';var multer=require(_0xdf6e('0x0'));var util=require('util');var path=require(_0xdf6e('0x1'));var timeout=require(_0xdf6e('0x2'));var express=require(_0xdf6e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdf6e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xdf6e('0x5')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 42e0aa5..0e65f7e 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 _0xe348=['state','sequelize','STRING','unique_name_and_version','app.js','BOOLEAN'];(function(_0x1e99bc,_0x3a0006){var _0x281232=function(_0x11c8cb){while(--_0x11c8cb){_0x1e99bc['push'](_0x1e99bc['shift']());}};_0x281232(++_0x3a0006);}(_0xe348,0x14b));var _0x8e34=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xe348[_0x88cd7b];return _0x56fcc8;};'use strict';var Sequelize=require(_0x8e34('0x0'));module['exports']={'name':{'type':Sequelize[_0x8e34('0x1')],'allowNull':![],'unique':_0x8e34('0x2')},'version':{'type':Sequelize[_0x8e34('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x8e34('0x1')],'defaultValue':_0x8e34('0x3')},'filename':{'type':Sequelize[_0x8e34('0x1')]},'path':{'type':Sequelize[_0x8e34('0x1')]},'type':{'type':Sequelize[_0x8e34('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x8e34('0x4')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x8e34('0x1')],'unique':_0x8e34('0x5')},'description':{'type':Sequelize[_0x8e34('0x1')]},'title':{'type':Sequelize[_0x8e34('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x8e34('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x2fe7=['sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','state'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x2fe7,0xaf));var _0x72fe=function(_0x454080,_0x166990){_0x454080=_0x454080-0x0;var _0x17f3d3=_0x2fe7[_0x454080];return _0x17f3d3;};'use strict';var Sequelize=require(_0x72fe('0x0'));module[_0x72fe('0x1')]={'name':{'type':Sequelize[_0x72fe('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x72fe('0x2')],'allowNull':![],'unique':_0x72fe('0x3')},'main':{'type':Sequelize[_0x72fe('0x2')],'defaultValue':_0x72fe('0x4')},'filename':{'type':Sequelize[_0x72fe('0x2')]},'path':{'type':Sequelize[_0x72fe('0x2')]},'type':{'type':Sequelize[_0x72fe('0x2')]},'size':{'type':Sequelize[_0x72fe('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x72fe('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':_0x72fe('0x6')},'description':{'type':Sequelize[_0x72fe('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x72fe('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index c70a20c..55b86b4 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 _0x81d7=['eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','Integration','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','html-pdf'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x81d7,0xdd));var _0x781d=function(_0x36e16d,_0x5a0ed8){_0x36e16d=_0x36e16d-0x0;var _0x54d22a=_0x81d7[_0x36e16d];return _0x54d22a;};'use strict';var pdf=require(_0x781d('0x0'));var emlformat=require(_0x781d('0x1'));var rimraf=require(_0x781d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x781d('0x3'));var rp=require(_0x781d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x781d('0x5'));var util=require(_0x781d('0x6'));var path=require(_0x781d('0x7'));var sox=require(_0x781d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x781d('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x781d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x781d('0xb'));var toCsv=require(_0x781d('0xc'));var querystring=require(_0x781d('0xd'));var Papa=require(_0x781d('0xe'));var Redis=require(_0x781d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x781d('0x10'));var as=require(_0x781d('0x11'));var hardwareService=require(_0x781d('0x12'));var logger=require(_0x781d('0x13'))(_0x781d('0x14'));var utils=require(_0x781d('0x15'));var config=require(_0x781d('0x16'));var licenseUtil=require(_0x781d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ae87e,_0x239c47){_0x239c47=_0x239c47||0xcc;return function(_0x4c191a){if(_0x4c191a){return _0x1ae87e[_0x781d('0x18')](_0x239c47);}return _0x1ae87e['status'](_0x239c47)[_0x781d('0x19')]();};}function respondWithResult(_0x259236,_0x4f5115){_0x4f5115=_0x4f5115||0xc8;return function(_0x50c638){if(_0x50c638){return _0x259236[_0x781d('0x1a')](_0x4f5115)[_0x781d('0x1b')](_0x50c638);}};}function respondWithFilteredResult(_0x13f110,_0x57a8f7){return function(_0x37ad02){if(_0x37ad02){var _0x5b1a5f=_0x37ad02[_0x781d('0x1c')],_0x137d4f=_0x57a8f7[_0x781d('0x1d')],_0x5b8e72=_0x57a8f7['offset']+_0x57a8f7[_0x781d('0x1e')],_0xb9f06b;if(_0x5b8e72>=_0x5b1a5f){_0x5b8e72=_0x5b1a5f;_0xb9f06b=0xc8;}else{_0xb9f06b=0xce;}_0x13f110[_0x781d('0x1a')](_0xb9f06b);return _0x13f110[_0x781d('0x1f')](_0x781d('0x20'),_0x137d4f+'-'+_0x5b8e72+'/'+_0x5b1a5f)[_0x781d('0x1b')](_0x37ad02);}return null;};}function patchUpdates(_0x45ec92){return function(_0x51b4e0){try{jsonpatch[_0x781d('0x21')](_0x51b4e0,_0x45ec92,!![]);}catch(_0x29f461){return BPromise[_0x781d('0x22')](_0x29f461);}return _0x51b4e0[_0x781d('0x23')]();};}function saveUpdates(_0x39b2b9,_0x33ce2d){return function(_0x2e50e4){if(_0x2e50e4){return _0x2e50e4[_0x781d('0x24')](_0x39b2b9)[_0x781d('0x25')](function(_0x3172aa){return _0x3172aa;});}return null;};}function removeEntity(_0x5a2c71,_0x5ab00f){return function(_0x530ab3){if(_0x530ab3){return _0x530ab3[_0x781d('0x26')]()[_0x781d('0x25')](function(){_0x5a2c71[_0x781d('0x1a')](0xcc)[_0x781d('0x19')]();});}};}function handleEntityNotFound(_0x1642b7,_0x129503){return function(_0x19a339){if(!_0x19a339){_0x1642b7[_0x781d('0x18')](0x194);}return _0x19a339;};}function handleError(_0x291e4d,_0x4735e8){_0x4735e8=_0x4735e8||0x1f4;return function(_0xc9e6f9){logger['error'](_0xc9e6f9[_0x781d('0x27')]);if(_0xc9e6f9[_0x781d('0x28')]){delete _0xc9e6f9['name'];}_0x291e4d['status'](_0x4735e8)[_0x781d('0x29')](_0xc9e6f9);};}exports[_0x781d('0x2a')]=function(_0x1f9f8b,_0x588793){var _0x231a25={},_0x24b66e={},_0x1e39eb={'count':0x0,'rows':[]};var _0x1193c9=_[_0x781d('0x2b')](db['Integration'][_0x781d('0x2c')],function(_0x34e1e4){return{'name':_0x34e1e4['fieldName'],'type':_0x34e1e4[_0x781d('0x2d')][_0x781d('0x2e')]};});_0x24b66e[_0x781d('0x2f')]=_[_0x781d('0x2b')](_0x1193c9,_0x781d('0x28'));_0x24b66e['query']=_['keys'](_0x1f9f8b[_0x781d('0x30')]);_0x24b66e[_0x781d('0x31')]=_[_0x781d('0x32')](_0x24b66e[_0x781d('0x2f')],_0x24b66e[_0x781d('0x30')]);_0x231a25[_0x781d('0x33')]=_[_0x781d('0x32')](_0x24b66e[_0x781d('0x2f')],qs[_0x781d('0x34')](_0x1f9f8b[_0x781d('0x30')][_0x781d('0x34')]));_0x231a25['attributes']=_0x231a25[_0x781d('0x33')]['length']?_0x231a25['attributes']:_0x24b66e[_0x781d('0x2f')];if(!_0x1f9f8b[_0x781d('0x30')][_0x781d('0x35')]('nolimit')){_0x231a25[_0x781d('0x1e')]=qs[_0x781d('0x1e')](_0x1f9f8b[_0x781d('0x30')][_0x781d('0x1e')]);_0x231a25[_0x781d('0x1d')]=qs['offset'](_0x1f9f8b[_0x781d('0x30')][_0x781d('0x1d')]);}_0x231a25[_0x781d('0x36')]=qs[_0x781d('0x37')](_0x1f9f8b[_0x781d('0x30')][_0x781d('0x37')]);_0x231a25['where']=qs[_0x781d('0x31')](_[_0x781d('0x38')](_0x1f9f8b[_0x781d('0x30')],_0x24b66e['filters']),_0x1193c9);if(_0x1f9f8b[_0x781d('0x30')][_0x781d('0x39')]){_0x231a25[_0x781d('0x3a')]=_[_0x781d('0x3b')](_0x231a25[_0x781d('0x3a')],{'$or':_[_0x781d('0x2b')](_0x1193c9,function(_0x5048c2){if(_0x5048c2[_0x781d('0x2d')]!==_0x781d('0x3c')){var _0x598a89={};_0x598a89[_0x5048c2[_0x781d('0x28')]]={'$like':'%'+_0x1f9f8b[_0x781d('0x30')]['filter']+'%'};return _0x598a89;}})});}_0x231a25=_[_0x781d('0x3b')]({},_0x231a25,_0x1f9f8b[_0x781d('0x3d')]);var _0x247047={'where':_0x231a25[_0x781d('0x3a')]};return db[_0x781d('0x3e')][_0x781d('0x1c')](_0x247047)[_0x781d('0x25')](function(_0xaabfc5){_0x1e39eb['count']=_0xaabfc5;if(_0x1f9f8b[_0x781d('0x30')][_0x781d('0x3f')]){_0x231a25[_0x781d('0x40')]=[{'all':!![]}];}return db[_0x781d('0x3e')][_0x781d('0x41')](_0x231a25);})['then'](function(_0x1702bc){_0x1e39eb[_0x781d('0x42')]=_0x1702bc;return _0x1e39eb;})[_0x781d('0x25')](respondWithFilteredResult(_0x588793,_0x231a25))[_0x781d('0x43')](handleError(_0x588793,null));};exports[_0x781d('0x44')]=function(_0x52be2c,_0x4fe540){var _0x5592f7={'raw':![],'where':{'id':_0x52be2c[_0x781d('0x45')]['id']}},_0x39e66d={};_0x39e66d[_0x781d('0x2f')]=_[_0x781d('0x46')](db['Integration']['rawAttributes']);_0x39e66d[_0x781d('0x30')]=_[_0x781d('0x46')](_0x52be2c[_0x781d('0x30')]);_0x39e66d['filters']=_[_0x781d('0x32')](_0x39e66d[_0x781d('0x2f')],_0x39e66d[_0x781d('0x30')]);_0x5592f7[_0x781d('0x33')]=_[_0x781d('0x32')](_0x39e66d[_0x781d('0x2f')],qs[_0x781d('0x34')](_0x52be2c[_0x781d('0x30')][_0x781d('0x34')]));_0x5592f7[_0x781d('0x33')]=_0x5592f7['attributes']['length']?_0x5592f7[_0x781d('0x33')]:_0x39e66d[_0x781d('0x2f')];if(_0x52be2c[_0x781d('0x30')][_0x781d('0x3f')]){_0x5592f7[_0x781d('0x40')]=[{'all':!![]}];}_0x5592f7=_['merge']({},_0x5592f7,_0x52be2c[_0x781d('0x3d')]);return db['Integration'][_0x781d('0x47')](_0x5592f7)['then'](handleEntityNotFound(_0x4fe540,null))[_0x781d('0x25')](respondWithResult(_0x4fe540,null))[_0x781d('0x43')](handleError(_0x4fe540,null));};exports[_0x781d('0x48')]=function(_0x1f7f4d,_0x3188c6){return db[_0x781d('0x3e')][_0x781d('0x48')](_0x1f7f4d[_0x781d('0x49')],{})[_0x781d('0x25')](respondWithResult(_0x3188c6,0xc9))[_0x781d('0x43')](handleError(_0x3188c6,null));};exports[_0x781d('0x24')]=function(_0x4b62a3,_0xe54fe4){if(_0x4b62a3[_0x781d('0x49')]['id']){delete _0x4b62a3[_0x781d('0x49')]['id'];}return db[_0x781d('0x3e')]['find']({'where':{'id':_0x4b62a3[_0x781d('0x45')]['id']}})['then'](handleEntityNotFound(_0xe54fe4,null))['then'](saveUpdates(_0x4b62a3[_0x781d('0x49')],null))[_0x781d('0x25')](respondWithResult(_0xe54fe4,null))[_0x781d('0x43')](handleError(_0xe54fe4,null));};exports['destroy']=function(_0x14a987,_0x4a32e5){return db[_0x781d('0x3e')][_0x781d('0x47')]({'where':{'id':_0x14a987[_0x781d('0x45')]['id']}})[_0x781d('0x25')](handleEntityNotFound(_0x4a32e5,null))['then'](removeEntity(_0x4a32e5,null))[_0x781d('0x43')](handleError(_0x4a32e5,null));}; \ No newline at end of file +var _0x3e3c=['apply','reject','update','then','end','error','stack','name','send','index','map','Integration','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','options','include','rows','catch','show','rawAttributes','includeAll','find','body','params','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','count','offset','Content-Range','json'];(function(_0x55e168,_0x2fe2f8){var _0x59c0c2=function(_0x469f16){while(--_0x469f16){_0x55e168['push'](_0x55e168['shift']());}};_0x59c0c2(++_0x2fe2f8);}(_0x3e3c,0xb9));var _0xc3e3=function(_0xc612c5,_0x49b75e){_0xc612c5=_0xc612c5-0x0;var _0x520fee=_0x3e3c[_0xc612c5];return _0x520fee;};'use strict';var pdf=require(_0xc3e3('0x0'));var emlformat=require(_0xc3e3('0x1'));var rimraf=require(_0xc3e3('0x2'));var zipdir=require(_0xc3e3('0x3'));var jsonpatch=require(_0xc3e3('0x4'));var rp=require(_0xc3e3('0x5'));var moment=require('moment');var BPromise=require(_0xc3e3('0x6'));var Mustache=require(_0xc3e3('0x7'));var util=require(_0xc3e3('0x8'));var path=require(_0xc3e3('0x9'));var sox=require(_0xc3e3('0xa'));var csv=require(_0xc3e3('0xb'));var ejs=require(_0xc3e3('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc3e3('0xd'));var crypto=require(_0xc3e3('0xe'));var jsforce=require(_0xc3e3('0xf'));var deskjs=require(_0xc3e3('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc3e3('0x11'));var Papa=require('papaparse');var Redis=require(_0xc3e3('0x12'));var authService=require(_0xc3e3('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc3e3('0x14'));var hardwareService=require(_0xc3e3('0x15'));var logger=require('../../config/logger')(_0xc3e3('0x16'));var utils=require('../../config/utils');var config=require(_0xc3e3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc3e3('0x18'))['db'];function respondWithStatusCode(_0x3992b5,_0x499743){_0x499743=_0x499743||0xcc;return function(_0x1b6a21){if(_0x1b6a21){return _0x3992b5[_0xc3e3('0x19')](_0x499743);}return _0x3992b5[_0xc3e3('0x1a')](_0x499743)['end']();};}function respondWithResult(_0x185fda,_0x34a739){_0x34a739=_0x34a739||0xc8;return function(_0x8d0217){if(_0x8d0217){return _0x185fda['status'](_0x34a739)['json'](_0x8d0217);}};}function respondWithFilteredResult(_0x113c34,_0x5a22d7){return function(_0x8cf5e3){if(_0x8cf5e3){var _0x2d306e=_0x8cf5e3[_0xc3e3('0x1b')],_0x3a68c2=_0x5a22d7[_0xc3e3('0x1c')],_0x259379=_0x5a22d7[_0xc3e3('0x1c')]+_0x5a22d7['limit'],_0xa6654f;if(_0x259379>=_0x2d306e){_0x259379=_0x2d306e;_0xa6654f=0xc8;}else{_0xa6654f=0xce;}_0x113c34[_0xc3e3('0x1a')](_0xa6654f);return _0x113c34['set'](_0xc3e3('0x1d'),_0x3a68c2+'-'+_0x259379+'/'+_0x2d306e)[_0xc3e3('0x1e')](_0x8cf5e3);}return null;};}function patchUpdates(_0x1e9d82){return function(_0x467ba3){try{jsonpatch[_0xc3e3('0x1f')](_0x467ba3,_0x1e9d82,!![]);}catch(_0x38da5c){return BPromise[_0xc3e3('0x20')](_0x38da5c);}return _0x467ba3['save']();};}function saveUpdates(_0x4933dc,_0x476557){return function(_0xfc22a5){if(_0xfc22a5){return _0xfc22a5[_0xc3e3('0x21')](_0x4933dc)['then'](function(_0xb1dce3){return _0xb1dce3;});}return null;};}function removeEntity(_0x5bedd2,_0x198fdc){return function(_0x169195){if(_0x169195){return _0x169195['destroy']()[_0xc3e3('0x22')](function(){_0x5bedd2['status'](0xcc)[_0xc3e3('0x23')]();});}};}function handleEntityNotFound(_0x202508,_0x623e90){return function(_0x17f3ed){if(!_0x17f3ed){_0x202508['sendStatus'](0x194);}return _0x17f3ed;};}function handleError(_0xade0c4,_0x5260fc){_0x5260fc=_0x5260fc||0x1f4;return function(_0x2c856f){logger[_0xc3e3('0x24')](_0x2c856f[_0xc3e3('0x25')]);if(_0x2c856f[_0xc3e3('0x26')]){delete _0x2c856f[_0xc3e3('0x26')];}_0xade0c4[_0xc3e3('0x1a')](_0x5260fc)[_0xc3e3('0x27')](_0x2c856f);};}exports[_0xc3e3('0x28')]=function(_0x4fb6d2,_0xbf1e14){var _0x577baf={},_0x12003d={},_0x19b204={'count':0x0,'rows':[]};var _0x101597=_[_0xc3e3('0x29')](db[_0xc3e3('0x2a')]['rawAttributes'],function(_0x2771c9){return{'name':_0x2771c9[_0xc3e3('0x2b')],'type':_0x2771c9[_0xc3e3('0x2c')]['key']};});_0x12003d[_0xc3e3('0x2d')]=_[_0xc3e3('0x29')](_0x101597,'name');_0x12003d[_0xc3e3('0x2e')]=_[_0xc3e3('0x2f')](_0x4fb6d2[_0xc3e3('0x2e')]);_0x12003d['filters']=_[_0xc3e3('0x30')](_0x12003d['model'],_0x12003d[_0xc3e3('0x2e')]);_0x577baf[_0xc3e3('0x31')]=_['intersection'](_0x12003d['model'],qs[_0xc3e3('0x32')](_0x4fb6d2[_0xc3e3('0x2e')][_0xc3e3('0x32')]));_0x577baf[_0xc3e3('0x31')]=_0x577baf[_0xc3e3('0x31')][_0xc3e3('0x33')]?_0x577baf[_0xc3e3('0x31')]:_0x12003d[_0xc3e3('0x2d')];if(!_0x4fb6d2[_0xc3e3('0x2e')][_0xc3e3('0x34')](_0xc3e3('0x35'))){_0x577baf[_0xc3e3('0x36')]=qs[_0xc3e3('0x36')](_0x4fb6d2['query'][_0xc3e3('0x36')]);_0x577baf[_0xc3e3('0x1c')]=qs[_0xc3e3('0x1c')](_0x4fb6d2['query']['offset']);}_0x577baf[_0xc3e3('0x37')]=qs['sort'](_0x4fb6d2['query'][_0xc3e3('0x38')]);_0x577baf[_0xc3e3('0x39')]=qs[_0xc3e3('0x3a')](_['pick'](_0x4fb6d2[_0xc3e3('0x2e')],_0x12003d[_0xc3e3('0x3a')]),_0x101597);if(_0x4fb6d2[_0xc3e3('0x2e')]['filter']){_0x577baf[_0xc3e3('0x39')]=_['merge'](_0x577baf[_0xc3e3('0x39')],{'$or':_[_0xc3e3('0x29')](_0x101597,function(_0x48d67c){if(_0x48d67c[_0xc3e3('0x2c')]!=='VIRTUAL'){var _0x55f45c={};_0x55f45c[_0x48d67c[_0xc3e3('0x26')]]={'$like':'%'+_0x4fb6d2['query'][_0xc3e3('0x3b')]+'%'};return _0x55f45c;}})});}_0x577baf=_[_0xc3e3('0x3c')]({},_0x577baf,_0x4fb6d2[_0xc3e3('0x3d')]);var _0x3cae72={'where':_0x577baf[_0xc3e3('0x39')]};return db[_0xc3e3('0x2a')][_0xc3e3('0x1b')](_0x3cae72)[_0xc3e3('0x22')](function(_0x47c215){_0x19b204['count']=_0x47c215;if(_0x4fb6d2['query']['includeAll']){_0x577baf[_0xc3e3('0x3e')]=[{'all':!![]}];}return db[_0xc3e3('0x2a')]['findAll'](_0x577baf);})[_0xc3e3('0x22')](function(_0xfe471a){_0x19b204[_0xc3e3('0x3f')]=_0xfe471a;return _0x19b204;})[_0xc3e3('0x22')](respondWithFilteredResult(_0xbf1e14,_0x577baf))[_0xc3e3('0x40')](handleError(_0xbf1e14,null));};exports[_0xc3e3('0x41')]=function(_0x315fa2,_0xf3461d){var _0x326ebd={'raw':![],'where':{'id':_0x315fa2['params']['id']}},_0x2c3773={};_0x2c3773[_0xc3e3('0x2d')]=_[_0xc3e3('0x2f')](db[_0xc3e3('0x2a')][_0xc3e3('0x42')]);_0x2c3773[_0xc3e3('0x2e')]=_[_0xc3e3('0x2f')](_0x315fa2[_0xc3e3('0x2e')]);_0x2c3773[_0xc3e3('0x3a')]=_['intersection'](_0x2c3773[_0xc3e3('0x2d')],_0x2c3773[_0xc3e3('0x2e')]);_0x326ebd[_0xc3e3('0x31')]=_['intersection'](_0x2c3773[_0xc3e3('0x2d')],qs[_0xc3e3('0x32')](_0x315fa2[_0xc3e3('0x2e')][_0xc3e3('0x32')]));_0x326ebd['attributes']=_0x326ebd['attributes'][_0xc3e3('0x33')]?_0x326ebd[_0xc3e3('0x31')]:_0x2c3773['model'];if(_0x315fa2[_0xc3e3('0x2e')][_0xc3e3('0x43')]){_0x326ebd[_0xc3e3('0x3e')]=[{'all':!![]}];}_0x326ebd=_['merge']({},_0x326ebd,_0x315fa2[_0xc3e3('0x3d')]);return db[_0xc3e3('0x2a')][_0xc3e3('0x44')](_0x326ebd)[_0xc3e3('0x22')](handleEntityNotFound(_0xf3461d,null))['then'](respondWithResult(_0xf3461d,null))[_0xc3e3('0x40')](handleError(_0xf3461d,null));};exports['create']=function(_0x3c1e68,_0x5dd9f5){return db['Integration']['create'](_0x3c1e68[_0xc3e3('0x45')],{})[_0xc3e3('0x22')](respondWithResult(_0x5dd9f5,0xc9))[_0xc3e3('0x40')](handleError(_0x5dd9f5,null));};exports[_0xc3e3('0x21')]=function(_0x20e003,_0x1ea62b){if(_0x20e003[_0xc3e3('0x45')]['id']){delete _0x20e003[_0xc3e3('0x45')]['id'];}return db[_0xc3e3('0x2a')]['find']({'where':{'id':_0x20e003[_0xc3e3('0x46')]['id']}})[_0xc3e3('0x22')](handleEntityNotFound(_0x1ea62b,null))[_0xc3e3('0x22')](saveUpdates(_0x20e003[_0xc3e3('0x45')],null))[_0xc3e3('0x22')](respondWithResult(_0x1ea62b,null))[_0xc3e3('0x40')](handleError(_0x1ea62b,null));};exports[_0xc3e3('0x47')]=function(_0x487c5c,_0x5dbe16){return db[_0xc3e3('0x2a')][_0xc3e3('0x44')]({'where':{'id':_0x487c5c[_0xc3e3('0x46')]['id']}})[_0xc3e3('0x22')](handleEntityNotFound(_0x5dbe16,null))[_0xc3e3('0x22')](removeEntity(_0x5dbe16,null))['catch'](handleError(_0x5dbe16,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index d4dfa9b..f9b5ff3 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 _0x675a=['bluebird','request-promise','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','lodash','moment'];(function(_0x102896,_0x3d4470){var _0x29ae4e=function(_0x2b720f){while(--_0x2b720f){_0x102896['push'](_0x102896['shift']());}};_0x29ae4e(++_0x3d4470);}(_0x675a,0xb2));var _0xa675=function(_0x26a3e1,_0x44ffd5){_0x26a3e1=_0x26a3e1-0x0;var _0x28c40e=_0x675a[_0x26a3e1];return _0x28c40e;};'use strict';var _=require(_0xa675('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa675('0x1'));var BPromise=require(_0xa675('0x2'));var rp=require(_0xa675('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa675('0x4'));var config=require(_0xa675('0x5'));var attributes=require(_0xa675('0x6'));module[_0xa675('0x7')]=function(_0x568f1a,_0x26082a){return _0x568f1a[_0xa675('0x8')](_0xa675('0x9'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44fa=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','lodash','util'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x44fa,0xb2));var _0xa44f=function(_0x1237f6,_0x46cbba){_0x1237f6=_0x1237f6-0x0;var _0x28099d=_0x44fa[_0x1237f6];return _0x28099d;};'use strict';var _=require(_0xa44f('0x0'));var util=require(_0xa44f('0x1'));var logger=require(_0xa44f('0x2'))(_0xa44f('0x3'));var moment=require(_0xa44f('0x4'));var BPromise=require(_0xa44f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa44f('0x6'));var config=require(_0xa44f('0x7'));var attributes=require(_0xa44f('0x8'));module[_0xa44f('0x9')]=function(_0x36eee4,_0x2755f3){return _0x36eee4[_0xa44f('0xa')](_0xa44f('0xb'),attributes,{'tableName':'integrations','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 a216a08..50e786d 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 _0xe181=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x56825b,_0x172b8d){var _0x69ce77=function(_0x348a1c){while(--_0x348a1c){_0x56825b['push'](_0x56825b['shift']());}};_0x69ce77(++_0x172b8d);}(_0xe181,0x68));var _0x1e18=function(_0x128443,_0x2fe025){_0x128443=_0x128443-0x0;var _0x1a4ce1=_0xe181[_0x128443];return _0x1a4ce1;};'use strict';var _=require(_0x1e18('0x0'));var util=require('util');var moment=require(_0x1e18('0x1'));var BPromise=require(_0x1e18('0x2'));var rs=require(_0x1e18('0x3'));var fs=require('fs');var Redis=require(_0x1e18('0x4'));var db=require(_0x1e18('0x5'))['db'];var utils=require(_0x1e18('0x6'));var logger=require(_0x1e18('0x7'))('rpc');var config=require(_0x1e18('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1e18('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x182c98,_0x46ba95,_0x25b786){return new BPromise(function(_0x9f9541,_0x398f77){return client['request'](_0x182c98,_0x25b786)[_0x1e18('0xa')](function(_0x40fda9){logger[_0x1e18('0xb')](_0x1e18('0xc'),_0x46ba95,_0x1e18('0xd'));logger[_0x1e18('0xe')]('Integration,\x20%s,\x20%s,\x20%s',_0x46ba95,_0x1e18('0xd'),JSON[_0x1e18('0xf')](_0x40fda9));if(_0x40fda9[_0x1e18('0x10')]){if(_0x40fda9[_0x1e18('0x10')][_0x1e18('0x11')]===0x1f4){logger[_0x1e18('0x10')](_0x1e18('0xc'),_0x46ba95,_0x40fda9[_0x1e18('0x10')]['message']);return _0x398f77(_0x40fda9[_0x1e18('0x10')]['message']);}logger[_0x1e18('0x10')]('Integration,\x20%s,\x20%s',_0x46ba95,_0x40fda9[_0x1e18('0x10')][_0x1e18('0x12')]);return _0x9f9541(_0x40fda9[_0x1e18('0x10')][_0x1e18('0x12')]);}else{logger[_0x1e18('0xb')](_0x1e18('0xc'),_0x46ba95,_0x1e18('0xd'));_0x9f9541(_0x40fda9[_0x1e18('0x13')][_0x1e18('0x12')]);}})[_0x1e18('0x14')](function(_0x12ef98){logger[_0x1e18('0x10')](_0x1e18('0xc'),_0x46ba95,_0x12ef98);_0x398f77(_0x12ef98);});});} \ No newline at end of file +var _0x1de4=['info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1de4,0x94));var _0x41de=function(_0x32d19b,_0xa3dcd){_0x32d19b=_0x32d19b-0x0;var _0x2b3139=_0x1de4[_0x32d19b];return _0x2b3139;};'use strict';var _=require(_0x41de('0x0'));var util=require(_0x41de('0x1'));var moment=require(_0x41de('0x2'));var BPromise=require(_0x41de('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x41de('0x4'));var db=require(_0x41de('0x5'))['db'];var utils=require(_0x41de('0x6'));var logger=require('../../config/logger')(_0x41de('0x7'));var config=require(_0x41de('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x41de('0x9')][_0x41de('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f1078,_0x352d9b,_0x50f716){return new BPromise(function(_0x4c292c,_0x344b7b){return client[_0x41de('0xb')](_0x2f1078,_0x50f716)[_0x41de('0xc')](function(_0xb268da){logger[_0x41de('0xd')](_0x41de('0xe'),_0x352d9b,'request\x20sent');logger[_0x41de('0xf')](_0x41de('0x10'),_0x352d9b,_0x41de('0x11'),JSON[_0x41de('0x12')](_0xb268da));if(_0xb268da[_0x41de('0x13')]){if(_0xb268da[_0x41de('0x13')]['code']===0x1f4){logger[_0x41de('0x13')](_0x41de('0xe'),_0x352d9b,_0xb268da[_0x41de('0x13')]['message']);return _0x344b7b(_0xb268da[_0x41de('0x13')][_0x41de('0x14')]);}logger['error'](_0x41de('0xe'),_0x352d9b,_0xb268da[_0x41de('0x13')][_0x41de('0x14')]);return _0x4c292c(_0xb268da[_0x41de('0x13')][_0x41de('0x14')]);}else{logger[_0x41de('0xd')](_0x41de('0xe'),_0x352d9b,_0x41de('0x11'));_0x4c292c(_0xb268da[_0x41de('0x15')][_0x41de('0x14')]);}})[_0x41de('0x16')](function(_0x4a9591){logger[_0x41de('0x13')](_0x41de('0xe'),_0x352d9b,_0x4a9591);_0x344b7b(_0x4a9591);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index bae5d23..9dc0ab3 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 _0x0e1e=['./integrationReport.controller','index','get','describe','/:id','isAuthenticated','post','create','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3cc4cd,_0x22fc22){var _0x38f22c=function(_0x5d81d9){while(--_0x5d81d9){_0x3cc4cd['push'](_0x3cc4cd['shift']());}};_0x38f22c(++_0x22fc22);}(_0x0e1e,0x102));var _0xe0e1=function(_0x51154c,_0x5114b9){_0x51154c=_0x51154c-0x0;var _0x20da7c=_0x0e1e[_0x51154c];return _0x20da7c;};'use strict';var multer=require(_0xe0e1('0x0'));var util=require(_0xe0e1('0x1'));var path=require('path');var timeout=require(_0xe0e1('0x2'));var express=require(_0xe0e1('0x3'));var router=express[_0xe0e1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe0e1('0x5'));var interaction=require(_0xe0e1('0x6'));var config=require(_0xe0e1('0x7'));var controller=require(_0xe0e1('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xe0e1('0x9')]);router[_0xe0e1('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xe0e1('0xb')]);router['get'](_0xe0e1('0xc'),auth[_0xe0e1('0xd')](),controller['show']);router[_0xe0e1('0xe')]('/',auth[_0xe0e1('0xd')](),controller[_0xe0e1('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xe0e1('0x10')]);router[_0xe0e1('0x11')](_0xe0e1('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xe0e1('0x12')]=router; \ No newline at end of file +var _0xabf0=['connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','post','create','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x33c4a7,_0x2980eb){var _0x127856=function(_0x1ebc74){while(--_0x1ebc74){_0x33c4a7['push'](_0x33c4a7['shift']());}};_0x127856(++_0x2980eb);}(_0xabf0,0x1bf));var _0x0abf=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xabf0[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x0abf('0x0'));var util=require(_0x0abf('0x1'));var path=require(_0x0abf('0x2'));var timeout=require(_0x0abf('0x3'));var express=require(_0x0abf('0x4'));var router=express['Router']();var fs_extra=require(_0x0abf('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0abf('0x6'));var controller=require('./integrationReport.controller');router[_0x0abf('0x7')]('/',auth[_0x0abf('0x8')](),controller[_0x0abf('0x9')]);router[_0x0abf('0x7')](_0x0abf('0xa'),auth[_0x0abf('0x8')](),controller['describe']);router[_0x0abf('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0abf('0xb')]('/',auth['isAuthenticated'](),controller[_0x0abf('0xc')]);router['put'](_0x0abf('0xd'),auth['isAuthenticated'](),controller[_0x0abf('0xe')]);router[_0x0abf('0xf')](_0x0abf('0xd'),auth[_0x0abf('0x8')](),controller[_0x0abf('0x10')]);module[_0x0abf('0x11')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index a1c6244..99fe132 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 _0x36f3=['SENDING','RECEIVED','FAILED','sequelize','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x36f3,0x1bb));var _0x336f=function(_0x3068db,_0x39c5de){_0x3068db=_0x3068db-0x0;var _0xca3dbb=_0x36f3[_0x3068db];return _0xca3dbb;};'use strict';var Sequelize=require(_0x336f('0x0'));module['exports']={'integration':{'type':Sequelize[_0x336f('0x1')]},'eventChannel':{'type':Sequelize[_0x336f('0x1')]},'exitStatus':{'type':Sequelize[_0x336f('0x1')]},'ticketId':{'type':Sequelize[_0x336f('0x1')]},'integrationId':{'type':Sequelize[_0x336f('0x2')]},'contacts':{'type':Sequelize[_0x336f('0x1')]},'uniqueid':{'type':Sequelize[_0x336f('0x1')]},'calleridnum':{'type':Sequelize[_0x336f('0x1')]},'calleridname':{'type':Sequelize[_0x336f('0x1')]},'queue':{'type':Sequelize[_0x336f('0x1')]},'interface':{'type':Sequelize[_0x336f('0x1')]},'membername':{'type':Sequelize[_0x336f('0x1')]},'agentcalledAt':{'type':Sequelize[_0x336f('0x3')]},'agentconnectAt':{'type':Sequelize[_0x336f('0x3')]},'holdtime':{'type':Sequelize[_0x336f('0x2')]},'agentcomplete':{'type':Sequelize[_0x336f('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x336f('0x2')]},'agentacw':{'type':Sequelize[_0x336f('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x336f('0x2')]},'reason':{'type':Sequelize[_0x336f('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x336f('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x336f('0x1')]},'channel':{'type':Sequelize[_0x336f('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x336f('0x1')]},'connectedlinenum':{'type':Sequelize[_0x336f('0x1')]},'connectedlinename':{'type':Sequelize[_0x336f('0x1')]},'language':{'type':Sequelize[_0x336f('0x1')]},'accountcode':{'type':Sequelize[_0x336f('0x1')]},'context':{'type':Sequelize[_0x336f('0x1')]},'exten':{'type':Sequelize[_0x336f('0x1')]},'priority':{'type':Sequelize[_0x336f('0x1')]},'destchannel':{'type':Sequelize[_0x336f('0x1')]},'destchannelstate':{'type':Sequelize[_0x336f('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x336f('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x336f('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x336f('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x336f('0x1')]},'destlanguage':{'type':Sequelize[_0x336f('0x1')]},'destaccountcode':{'type':Sequelize[_0x336f('0x1')]},'destcontext':{'type':Sequelize[_0x336f('0x1')]},'destexten':{'type':Sequelize[_0x336f('0x1')]},'destpriority':{'type':Sequelize[_0x336f('0x1')]},'destuniqueid':{'type':Sequelize[_0x336f('0x1')]},'messageId':{'type':Sequelize[_0x336f('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x336f('0x1')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x336f('0x1')]},'attachment':{'type':Sequelize[_0x336f('0x5')]},'html':{'type':Sequelize[_0x336f('0x5')]},'text':{'type':Sequelize[_0x336f('0x5')]},'status':{'type':Sequelize[_0x336f('0x6')](_0x336f('0x7'),_0x336f('0x8'),_0x336f('0x9'),_0x336f('0xa'))},'url':{'type':Sequelize[_0x336f('0x1')]},'app':{'type':Sequelize[_0x336f('0x1')]},'appdata':{'type':Sequelize[_0x336f('0x1')]},'projectId':{'type':Sequelize[_0x336f('0x2')]}}; \ No newline at end of file +var _0x8d89=['SENT','SENDING','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0x546e57,_0x1ef7bd){var _0x36381f=function(_0x25f791){while(--_0x25f791){_0x546e57['push'](_0x546e57['shift']());}};_0x36381f(++_0x1ef7bd);}(_0x8d89,0x119));var _0x98d8=function(_0x58c218,_0x88075c){_0x58c218=_0x58c218-0x0;var _0x382850=_0x8d89[_0x58c218];return _0x382850;};'use strict';var Sequelize=require(_0x98d8('0x0'));module[_0x98d8('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x98d8('0x2')]},'exitStatus':{'type':Sequelize[_0x98d8('0x2')]},'ticketId':{'type':Sequelize[_0x98d8('0x2')]},'integrationId':{'type':Sequelize[_0x98d8('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x98d8('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x98d8('0x2')]},'queue':{'type':Sequelize[_0x98d8('0x2')]},'interface':{'type':Sequelize[_0x98d8('0x2')]},'membername':{'type':Sequelize[_0x98d8('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x98d8('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x98d8('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x98d8('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x98d8('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x98d8('0x3')]},'reason':{'type':Sequelize[_0x98d8('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x98d8('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x98d8('0x4')]},'agentdump':{'type':Sequelize[_0x98d8('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x98d8('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x98d8('0x2')]},'connectedlinenum':{'type':Sequelize[_0x98d8('0x2')]},'connectedlinename':{'type':Sequelize[_0x98d8('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x98d8('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x98d8('0x2')]},'destchannelstate':{'type':Sequelize[_0x98d8('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x98d8('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x98d8('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x98d8('0x2')]},'destlanguage':{'type':Sequelize[_0x98d8('0x2')]},'destaccountcode':{'type':Sequelize[_0x98d8('0x2')]},'destcontext':{'type':Sequelize[_0x98d8('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x98d8('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x98d8('0x2')]},'from':{'type':Sequelize[_0x98d8('0x2')]},'to':{'type':Sequelize[_0x98d8('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x98d8('0x6')]},'html':{'type':Sequelize[_0x98d8('0x6')]},'text':{'type':Sequelize[_0x98d8('0x6')]},'status':{'type':Sequelize['ENUM'](_0x98d8('0x7'),_0x98d8('0x8'),'RECEIVED','FAILED')},'url':{'type':Sequelize[_0x98d8('0x2')]},'app':{'type':Sequelize[_0x98d8('0x2')]},'appdata':{'type':Sequelize[_0x98d8('0x2')]},'projectId':{'type':Sequelize[_0x98d8('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 67db5bc..1cd32b9 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 _0x8e0c=['body','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','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','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','includeAll','include','show','params','options','find','catch','create'];(function(_0x4e0dee,_0xa325c5){var _0x549e91=function(_0x202de3){while(--_0x202de3){_0x4e0dee['push'](_0x4e0dee['shift']());}};_0x549e91(++_0xa325c5);}(_0x8e0c,0x1be));var _0xc8e0=function(_0x16d1e9,_0x28cfe3){_0x16d1e9=_0x16d1e9-0x0;var _0x42d229=_0x8e0c[_0x16d1e9];return _0x42d229;};'use strict';var pdf=require(_0xc8e0('0x0'));var emlformat=require(_0xc8e0('0x1'));var rimraf=require(_0xc8e0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc8e0('0x3'));var rp=require(_0xc8e0('0x4'));var moment=require('moment');var BPromise=require(_0xc8e0('0x5'));var Mustache=require('mustache');var util=require(_0xc8e0('0x6'));var path=require(_0xc8e0('0x7'));var sox=require(_0xc8e0('0x8'));var csv=require(_0xc8e0('0x9'));var ejs=require(_0xc8e0('0xa'));var fs=require('fs');var fs_extra=require(_0xc8e0('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc8e0('0xc'));var jsforce=require(_0xc8e0('0xd'));var deskjs=require(_0xc8e0('0xe'));var toCsv=require(_0xc8e0('0x9'));var querystring=require(_0xc8e0('0xf'));var Papa=require(_0xc8e0('0x10'));var Redis=require(_0xc8e0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc8e0('0x12'));var as=require(_0xc8e0('0x13'));var hardwareService=require(_0xc8e0('0x14'));var logger=require(_0xc8e0('0x15'))(_0xc8e0('0x16'));var utils=require(_0xc8e0('0x17'));var config=require(_0xc8e0('0x18'));var licenseUtil=require(_0xc8e0('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x470889,_0xfa6bf8){_0xfa6bf8=_0xfa6bf8||0xcc;return function(_0x158c0e){if(_0x158c0e){return _0x470889[_0xc8e0('0x1a')](_0xfa6bf8);}return _0x470889[_0xc8e0('0x1b')](_0xfa6bf8)['end']();};}function respondWithResult(_0x3d8d77,_0x4c0b2a){_0x4c0b2a=_0x4c0b2a||0xc8;return function(_0x3188a1){if(_0x3188a1){return _0x3d8d77[_0xc8e0('0x1b')](_0x4c0b2a)[_0xc8e0('0x1c')](_0x3188a1);}};}function respondWithFilteredResult(_0x141f7c,_0x2c55c6){return function(_0x789923){if(_0x789923){var _0x6bf8d8=_0x789923[_0xc8e0('0x1d')],_0x1e43a4=_0x2c55c6[_0xc8e0('0x1e')],_0x19e515=_0x2c55c6[_0xc8e0('0x1e')]+_0x2c55c6[_0xc8e0('0x1f')],_0x36d418;if(_0x19e515>=_0x6bf8d8){_0x19e515=_0x6bf8d8;_0x36d418=0xc8;}else{_0x36d418=0xce;}_0x141f7c['status'](_0x36d418);return _0x141f7c['set'](_0xc8e0('0x20'),_0x1e43a4+'-'+_0x19e515+'/'+_0x6bf8d8)[_0xc8e0('0x1c')](_0x789923);}return null;};}function patchUpdates(_0x14c63e){return function(_0x18d675){try{jsonpatch[_0xc8e0('0x21')](_0x18d675,_0x14c63e,!![]);}catch(_0x318f2c){return BPromise[_0xc8e0('0x22')](_0x318f2c);}return _0x18d675[_0xc8e0('0x23')]();};}function saveUpdates(_0x397e64,_0x128300){return function(_0x38571f){if(_0x38571f){return _0x38571f[_0xc8e0('0x24')](_0x397e64)[_0xc8e0('0x25')](function(_0x102a21){return _0x102a21;});}return null;};}function removeEntity(_0x5ba0b6,_0x3cad50){return function(_0x36d747){if(_0x36d747){return _0x36d747['destroy']()[_0xc8e0('0x25')](function(){_0x5ba0b6[_0xc8e0('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21fd4d,_0x100e8d){return function(_0x1ba8d8){if(!_0x1ba8d8){_0x21fd4d[_0xc8e0('0x1a')](0x194);}return _0x1ba8d8;};}function handleError(_0x907348,_0x11c06f){_0x11c06f=_0x11c06f||0x1f4;return function(_0x5cd838){logger[_0xc8e0('0x26')](_0x5cd838[_0xc8e0('0x27')]);if(_0x5cd838[_0xc8e0('0x28')]){delete _0x5cd838['name'];}_0x907348[_0xc8e0('0x1b')](_0x11c06f)[_0xc8e0('0x29')](_0x5cd838);};}exports[_0xc8e0('0x2a')]=function(_0x93bc74,_0x27bdcd){var _0x1a817e={},_0xefd904={},_0x1d8406={'count':0x0,'rows':[]};var _0x45c477=_[_0xc8e0('0x2b')](db[_0xc8e0('0x2c')][_0xc8e0('0x2d')],function(_0x1878f3){return{'name':_0x1878f3[_0xc8e0('0x2e')],'type':_0x1878f3[_0xc8e0('0x2f')][_0xc8e0('0x30')]};});_0xefd904[_0xc8e0('0x31')]=_[_0xc8e0('0x2b')](_0x45c477,_0xc8e0('0x28'));_0xefd904[_0xc8e0('0x32')]=_[_0xc8e0('0x33')](_0x93bc74[_0xc8e0('0x32')]);_0xefd904[_0xc8e0('0x34')]=_[_0xc8e0('0x35')](_0xefd904['model'],_0xefd904[_0xc8e0('0x32')]);_0x1a817e[_0xc8e0('0x36')]=_['intersection'](_0xefd904[_0xc8e0('0x31')],qs['fields'](_0x93bc74['query'][_0xc8e0('0x37')]));_0x1a817e[_0xc8e0('0x36')]=_0x1a817e['attributes'][_0xc8e0('0x38')]?_0x1a817e[_0xc8e0('0x36')]:_0xefd904[_0xc8e0('0x31')];if(!_0x93bc74[_0xc8e0('0x32')]['hasOwnProperty'](_0xc8e0('0x39'))){_0x1a817e['limit']=qs['limit'](_0x93bc74['query'][_0xc8e0('0x1f')]);_0x1a817e[_0xc8e0('0x1e')]=qs[_0xc8e0('0x1e')](_0x93bc74[_0xc8e0('0x32')][_0xc8e0('0x1e')]);}_0x1a817e[_0xc8e0('0x3a')]=qs[_0xc8e0('0x3b')](_0x93bc74[_0xc8e0('0x32')][_0xc8e0('0x3b')]);_0x1a817e[_0xc8e0('0x3c')]=qs[_0xc8e0('0x34')](_[_0xc8e0('0x3d')](_0x93bc74[_0xc8e0('0x32')],_0xefd904[_0xc8e0('0x34')]),_0x45c477);if(_0x93bc74[_0xc8e0('0x32')][_0xc8e0('0x3e')]){_0x1a817e['where']=_[_0xc8e0('0x3f')](_0x1a817e['where'],{'$or':_[_0xc8e0('0x2b')](_0x45c477,function(_0x4541ab){if(_0x4541ab[_0xc8e0('0x2f')]!=='VIRTUAL'){var _0x634d2e={};_0x634d2e[_0x4541ab['name']]={'$like':'%'+_0x93bc74['query'][_0xc8e0('0x3e')]+'%'};return _0x634d2e;}})});}_0x1a817e=_['merge']({},_0x1a817e,_0x93bc74['options']);var _0x1e1dbc={'where':_0x1a817e[_0xc8e0('0x3c')]};return db[_0xc8e0('0x2c')][_0xc8e0('0x1d')](_0x1e1dbc)[_0xc8e0('0x25')](function(_0x5eb576){_0x1d8406[_0xc8e0('0x1d')]=_0x5eb576;if(_0x93bc74[_0xc8e0('0x32')][_0xc8e0('0x40')]){_0x1a817e[_0xc8e0('0x41')]=[{'all':!![]}];}return db[_0xc8e0('0x2c')]['findAll'](_0x1a817e);})[_0xc8e0('0x25')](function(_0x2476d8){_0x1d8406['rows']=_0x2476d8;return _0x1d8406;})[_0xc8e0('0x25')](respondWithFilteredResult(_0x27bdcd,_0x1a817e))['catch'](handleError(_0x27bdcd,null));};exports[_0xc8e0('0x42')]=function(_0x567301,_0x281449){var _0x32f557={'raw':![],'where':{'id':_0x567301[_0xc8e0('0x43')]['id']}},_0x3596ba={};_0x3596ba[_0xc8e0('0x31')]=_['keys'](db[_0xc8e0('0x2c')][_0xc8e0('0x2d')]);_0x3596ba[_0xc8e0('0x32')]=_[_0xc8e0('0x33')](_0x567301[_0xc8e0('0x32')]);_0x3596ba[_0xc8e0('0x34')]=_[_0xc8e0('0x35')](_0x3596ba[_0xc8e0('0x31')],_0x3596ba[_0xc8e0('0x32')]);_0x32f557[_0xc8e0('0x36')]=_['intersection'](_0x3596ba['model'],qs['fields'](_0x567301[_0xc8e0('0x32')]['fields']));_0x32f557[_0xc8e0('0x36')]=_0x32f557[_0xc8e0('0x36')]['length']?_0x32f557[_0xc8e0('0x36')]:_0x3596ba['model'];if(_0x567301[_0xc8e0('0x32')]['includeAll']){_0x32f557[_0xc8e0('0x41')]=[{'all':!![]}];}_0x32f557=_['merge']({},_0x32f557,_0x567301[_0xc8e0('0x44')]);return db[_0xc8e0('0x2c')][_0xc8e0('0x45')](_0x32f557)[_0xc8e0('0x25')](handleEntityNotFound(_0x281449,null))[_0xc8e0('0x25')](respondWithResult(_0x281449,null))[_0xc8e0('0x46')](handleError(_0x281449,null));};exports[_0xc8e0('0x47')]=function(_0x2484b1,_0x42b057){return db[_0xc8e0('0x2c')][_0xc8e0('0x47')](_0x2484b1[_0xc8e0('0x48')],{})[_0xc8e0('0x25')](respondWithResult(_0x42b057,0xc9))[_0xc8e0('0x46')](handleError(_0x42b057,null));};exports[_0xc8e0('0x24')]=function(_0x3e08be,_0x1f4f50){if(_0x3e08be[_0xc8e0('0x48')]['id']){delete _0x3e08be[_0xc8e0('0x48')]['id'];}return db[_0xc8e0('0x2c')][_0xc8e0('0x45')]({'where':{'id':_0x3e08be[_0xc8e0('0x43')]['id']}})[_0xc8e0('0x25')](handleEntityNotFound(_0x1f4f50,null))['then'](saveUpdates(_0x3e08be[_0xc8e0('0x48')],null))[_0xc8e0('0x25')](respondWithResult(_0x1f4f50,null))[_0xc8e0('0x46')](handleError(_0x1f4f50,null));};exports[_0xc8e0('0x49')]=function(_0x2f4d32,_0x234d54){return db['IntegrationReport']['find']({'where':{'id':_0x2f4d32[_0xc8e0('0x43')]['id']}})[_0xc8e0('0x25')](handleEntityNotFound(_0x234d54,null))[_0xc8e0('0x25')](removeEntity(_0x234d54,null))[_0xc8e0('0x46')](handleError(_0x234d54,null));};exports['describe']=function(_0xefeecb,_0x3b363d){return db[_0xc8e0('0x2c')]['describe']()['then'](respondWithResult(_0x3b363d,null))[_0xc8e0('0x46')](handleError(_0x3b363d,null));}; \ No newline at end of file +var _0xabb0=['body','destroy','describe','html-pdf','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','json','apply','reject','then','end','error','stack','name','index','map','IntegrationReport','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','include','findAll','rows','show','params','includeAll','find','catch','create'];(function(_0x299177,_0x5aa4cd){var _0x55e79a=function(_0x4e4b97){while(--_0x4e4b97){_0x299177['push'](_0x299177['shift']());}};_0x55e79a(++_0x5aa4cd);}(_0xabb0,0x17f));var _0x0abb=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xabb0[_0x126558];return _0x1f6d14;};'use strict';var pdf=require(_0x0abb('0x0'));var emlformat=require(_0x0abb('0x1'));var rimraf=require(_0x0abb('0x2'));var zipdir=require(_0x0abb('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0abb('0x4'));var moment=require(_0x0abb('0x5'));var BPromise=require(_0x0abb('0x6'));var Mustache=require(_0x0abb('0x7'));var util=require(_0x0abb('0x8'));var path=require(_0x0abb('0x9'));var sox=require(_0x0abb('0xa'));var csv=require(_0x0abb('0xb'));var ejs=require(_0x0abb('0xc'));var fs=require('fs');var fs_extra=require(_0x0abb('0xd'));var _=require(_0x0abb('0xe'));var squel=require(_0x0abb('0xf'));var crypto=require(_0x0abb('0x10'));var jsforce=require(_0x0abb('0x11'));var deskjs=require(_0x0abb('0x12'));var toCsv=require('to-csv');var querystring=require(_0x0abb('0x13'));var Papa=require('papaparse');var Redis=require(_0x0abb('0x14'));var authService=require(_0x0abb('0x15'));var qs=require(_0x0abb('0x16'));var as=require(_0x0abb('0x17'));var hardwareService=require(_0x0abb('0x18'));var logger=require(_0x0abb('0x19'))(_0x0abb('0x1a'));var utils=require('../../config/utils');var config=require(_0x0abb('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x0abb('0x1c'))['db'];function respondWithStatusCode(_0xaae684,_0x57b59d){_0x57b59d=_0x57b59d||0xcc;return function(_0x4a6ee7){if(_0x4a6ee7){return _0xaae684[_0x0abb('0x1d')](_0x57b59d);}return _0xaae684[_0x0abb('0x1e')](_0x57b59d)['end']();};}function respondWithResult(_0x28a6d2,_0xe7352f){_0xe7352f=_0xe7352f||0xc8;return function(_0x1bfe61){if(_0x1bfe61){return _0x28a6d2[_0x0abb('0x1e')](_0xe7352f)['json'](_0x1bfe61);}};}function respondWithFilteredResult(_0x539bb5,_0x14b96e){return function(_0x4e9c6d){if(_0x4e9c6d){var _0x4964d8=_0x4e9c6d[_0x0abb('0x1f')],_0x7c3c7c=_0x14b96e['offset'],_0x5463fe=_0x14b96e[_0x0abb('0x20')]+_0x14b96e[_0x0abb('0x21')],_0x69c9f2;if(_0x5463fe>=_0x4964d8){_0x5463fe=_0x4964d8;_0x69c9f2=0xc8;}else{_0x69c9f2=0xce;}_0x539bb5['status'](_0x69c9f2);return _0x539bb5[_0x0abb('0x22')]('Content-Range',_0x7c3c7c+'-'+_0x5463fe+'/'+_0x4964d8)[_0x0abb('0x23')](_0x4e9c6d);}return null;};}function patchUpdates(_0x54f162){return function(_0x26555a){try{jsonpatch[_0x0abb('0x24')](_0x26555a,_0x54f162,!![]);}catch(_0xc1cd02){return BPromise[_0x0abb('0x25')](_0xc1cd02);}return _0x26555a['save']();};}function saveUpdates(_0x448794,_0x318d74){return function(_0x4991a1){if(_0x4991a1){return _0x4991a1['update'](_0x448794)[_0x0abb('0x26')](function(_0x5020b9){return _0x5020b9;});}return null;};}function removeEntity(_0xe49ceb,_0xe48bfa){return function(_0x50d610){if(_0x50d610){return _0x50d610['destroy']()[_0x0abb('0x26')](function(){_0xe49ceb[_0x0abb('0x1e')](0xcc)[_0x0abb('0x27')]();});}};}function handleEntityNotFound(_0x2c61d1,_0x240250){return function(_0x2cf983){if(!_0x2cf983){_0x2c61d1[_0x0abb('0x1d')](0x194);}return _0x2cf983;};}function handleError(_0x3a0901,_0x5f24be){_0x5f24be=_0x5f24be||0x1f4;return function(_0x3cc55d){logger[_0x0abb('0x28')](_0x3cc55d[_0x0abb('0x29')]);if(_0x3cc55d[_0x0abb('0x2a')]){delete _0x3cc55d[_0x0abb('0x2a')];}_0x3a0901['status'](_0x5f24be)['send'](_0x3cc55d);};}exports[_0x0abb('0x2b')]=function(_0x30eba2,_0xc05563){var _0x1e6d03={},_0x2d0d4d={},_0x3ad03a={'count':0x0,'rows':[]};var _0x5a607f=_[_0x0abb('0x2c')](db[_0x0abb('0x2d')][_0x0abb('0x2e')],function(_0x1b46db){return{'name':_0x1b46db['fieldName'],'type':_0x1b46db[_0x0abb('0x2f')][_0x0abb('0x30')]};});_0x2d0d4d[_0x0abb('0x31')]=_[_0x0abb('0x2c')](_0x5a607f,'name');_0x2d0d4d['query']=_[_0x0abb('0x32')](_0x30eba2[_0x0abb('0x33')]);_0x2d0d4d[_0x0abb('0x34')]=_[_0x0abb('0x35')](_0x2d0d4d[_0x0abb('0x31')],_0x2d0d4d[_0x0abb('0x33')]);_0x1e6d03[_0x0abb('0x36')]=_['intersection'](_0x2d0d4d[_0x0abb('0x31')],qs[_0x0abb('0x37')](_0x30eba2['query']['fields']));_0x1e6d03['attributes']=_0x1e6d03['attributes'][_0x0abb('0x38')]?_0x1e6d03[_0x0abb('0x36')]:_0x2d0d4d[_0x0abb('0x31')];if(!_0x30eba2['query'][_0x0abb('0x39')](_0x0abb('0x3a'))){_0x1e6d03['limit']=qs[_0x0abb('0x21')](_0x30eba2[_0x0abb('0x33')][_0x0abb('0x21')]);_0x1e6d03['offset']=qs[_0x0abb('0x20')](_0x30eba2[_0x0abb('0x33')][_0x0abb('0x20')]);}_0x1e6d03['order']=qs[_0x0abb('0x3b')](_0x30eba2[_0x0abb('0x33')]['sort']);_0x1e6d03[_0x0abb('0x3c')]=qs['filters'](_['pick'](_0x30eba2['query'],_0x2d0d4d[_0x0abb('0x34')]),_0x5a607f);if(_0x30eba2[_0x0abb('0x33')][_0x0abb('0x3d')]){_0x1e6d03['where']=_[_0x0abb('0x3e')](_0x1e6d03[_0x0abb('0x3c')],{'$or':_[_0x0abb('0x2c')](_0x5a607f,function(_0x224bd9){if(_0x224bd9[_0x0abb('0x2f')]!=='VIRTUAL'){var _0x12f5a1={};_0x12f5a1[_0x224bd9[_0x0abb('0x2a')]]={'$like':'%'+_0x30eba2[_0x0abb('0x33')][_0x0abb('0x3d')]+'%'};return _0x12f5a1;}})});}_0x1e6d03=_[_0x0abb('0x3e')]({},_0x1e6d03,_0x30eba2[_0x0abb('0x3f')]);var _0x5ea991={'where':_0x1e6d03['where']};return db[_0x0abb('0x2d')][_0x0abb('0x1f')](_0x5ea991)['then'](function(_0x206775){_0x3ad03a['count']=_0x206775;if(_0x30eba2[_0x0abb('0x33')]['includeAll']){_0x1e6d03[_0x0abb('0x40')]=[{'all':!![]}];}return db[_0x0abb('0x2d')][_0x0abb('0x41')](_0x1e6d03);})['then'](function(_0x520321){_0x3ad03a[_0x0abb('0x42')]=_0x520321;return _0x3ad03a;})['then'](respondWithFilteredResult(_0xc05563,_0x1e6d03))['catch'](handleError(_0xc05563,null));};exports[_0x0abb('0x43')]=function(_0x2ccab0,_0x451daf){var _0x5d9a1f={'raw':![],'where':{'id':_0x2ccab0[_0x0abb('0x44')]['id']}},_0x33998f={};_0x33998f[_0x0abb('0x31')]=_[_0x0abb('0x32')](db[_0x0abb('0x2d')][_0x0abb('0x2e')]);_0x33998f[_0x0abb('0x33')]=_['keys'](_0x2ccab0['query']);_0x33998f[_0x0abb('0x34')]=_[_0x0abb('0x35')](_0x33998f[_0x0abb('0x31')],_0x33998f[_0x0abb('0x33')]);_0x5d9a1f[_0x0abb('0x36')]=_[_0x0abb('0x35')](_0x33998f['model'],qs['fields'](_0x2ccab0[_0x0abb('0x33')][_0x0abb('0x37')]));_0x5d9a1f[_0x0abb('0x36')]=_0x5d9a1f[_0x0abb('0x36')][_0x0abb('0x38')]?_0x5d9a1f['attributes']:_0x33998f['model'];if(_0x2ccab0['query'][_0x0abb('0x45')]){_0x5d9a1f[_0x0abb('0x40')]=[{'all':!![]}];}_0x5d9a1f=_[_0x0abb('0x3e')]({},_0x5d9a1f,_0x2ccab0['options']);return db[_0x0abb('0x2d')][_0x0abb('0x46')](_0x5d9a1f)[_0x0abb('0x26')](handleEntityNotFound(_0x451daf,null))[_0x0abb('0x26')](respondWithResult(_0x451daf,null))[_0x0abb('0x47')](handleError(_0x451daf,null));};exports[_0x0abb('0x48')]=function(_0x37408c,_0x35f2dd){return db[_0x0abb('0x2d')][_0x0abb('0x48')](_0x37408c['body'],{})[_0x0abb('0x26')](respondWithResult(_0x35f2dd,0xc9))[_0x0abb('0x47')](handleError(_0x35f2dd,null));};exports['update']=function(_0x57a44c,_0x3a34de){if(_0x57a44c[_0x0abb('0x49')]['id']){delete _0x57a44c[_0x0abb('0x49')]['id'];}return db[_0x0abb('0x2d')][_0x0abb('0x46')]({'where':{'id':_0x57a44c[_0x0abb('0x44')]['id']}})[_0x0abb('0x26')](handleEntityNotFound(_0x3a34de,null))[_0x0abb('0x26')](saveUpdates(_0x57a44c[_0x0abb('0x49')],null))['then'](respondWithResult(_0x3a34de,null))[_0x0abb('0x47')](handleError(_0x3a34de,null));};exports[_0x0abb('0x4a')]=function(_0x91db77,_0x744529){return db[_0x0abb('0x2d')][_0x0abb('0x46')]({'where':{'id':_0x91db77[_0x0abb('0x44')]['id']}})[_0x0abb('0x26')](handleEntityNotFound(_0x744529,null))[_0x0abb('0x26')](removeEntity(_0x744529,null))[_0x0abb('0x47')](handleError(_0x744529,null));};exports[_0x0abb('0x4b')]=function(_0x2692f7,_0x3618e4){return db[_0x0abb('0x2d')]['describe']()[_0x0abb('0x26')](respondWithResult(_0x3618e4,null))['catch'](handleError(_0x3618e4,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 3be34d0..68c457c 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 _0x1447=['util','moment','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash'];(function(_0x290f3d,_0x274ad4){var _0x1b98f0=function(_0x12a41d){while(--_0x12a41d){_0x290f3d['push'](_0x290f3d['shift']());}};_0x1b98f0(++_0x274ad4);}(_0x1447,0xbf));var _0x7144=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x1447[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x7144('0x0'));var util=require(_0x7144('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7144('0x2'));var BPromise=require('bluebird');var rp=require(_0x7144('0x3'));var fs=require('fs');var path=require(_0x7144('0x4'));var rimraf=require(_0x7144('0x5'));var config=require(_0x7144('0x6'));var attributes=require(_0x7144('0x7'));module[_0x7144('0x8')]=function(_0x265aea,_0x3be569){return _0x265aea[_0x7144('0x9')](_0x7144('0xa'),attributes,{'tableName':_0x7144('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89a9=['rimraf','exports','IntegrationReport','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x9bdf7b,_0x2adb5e){var _0x485401=function(_0x1c84b4){while(--_0x1c84b4){_0x9bdf7b['push'](_0x9bdf7b['shift']());}};_0x485401(++_0x2adb5e);}(_0x89a9,0xfd));var _0x989a=function(_0x39d806,_0x627fd2){_0x39d806=_0x39d806-0x0;var _0x16b0e1=_0x89a9[_0x39d806];return _0x16b0e1;};'use strict';var _=require(_0x989a('0x0'));var util=require(_0x989a('0x1'));var logger=require('../../config/logger')(_0x989a('0x2'));var moment=require(_0x989a('0x3'));var BPromise=require(_0x989a('0x4'));var rp=require(_0x989a('0x5'));var fs=require('fs');var path=require(_0x989a('0x6'));var rimraf=require(_0x989a('0x7'));var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0x989a('0x8')]=function(_0x249e3c,_0x545fcf){return _0x249e3c['define'](_0x989a('0x9'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index abaedda..881ddfb 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 _0xda3f=['rpc','jayson/promise','client','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x372515,_0xdd11f){var _0xa3bf4e=function(_0x212cc8){while(--_0x212cc8){_0x372515['push'](_0x372515['shift']());}};_0xa3bf4e(++_0xdd11f);}(_0xda3f,0xec));var _0xfda3=function(_0x51547a,_0x582d20){_0x51547a=_0x51547a-0x0;var _0xc539c7=_0xda3f[_0x51547a];return _0xc539c7;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('IntegrationReport,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('IntegrationReport,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0x0713=['IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1fcc68,_0x10acce){var _0x1c2bbc=function(_0x233917){while(--_0x233917){_0x1fcc68['push'](_0x1fcc68['shift']());}};_0x1c2bbc(++_0x10acce);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 7d30149..e6a78e1 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 _0x9489=['show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0x30787e,_0x36df9f){var _0x3a3cae=function(_0x4081c0){while(--_0x4081c0){_0x30787e['push'](_0x30787e['shift']());}};_0x3a3cae(++_0x36df9f);}(_0x9489,0xb2));var _0x9948=function(_0x1df88f,_0x3f084a){_0x1df88f=_0x1df88f-0x0;var _0x442bb5=_0x9489[_0x1df88f];return _0x442bb5;};'use strict';var multer=require(_0x9948('0x0'));var util=require(_0x9948('0x1'));var path=require(_0x9948('0x2'));var timeout=require(_0x9948('0x3'));var express=require(_0x9948('0x4'));var router=express[_0x9948('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9948('0x6'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x9948('0x7')]('/',auth[_0x9948('0x8')](),controller[_0x9948('0x9')]);router[_0x9948('0x7')](_0x9948('0xa'),auth[_0x9948('0x8')](),controller[_0x9948('0xb')]);router[_0x9948('0x7')](_0x9948('0xc'),auth['isAuthenticated'](),controller[_0x9948('0xd')]);router[_0x9948('0xe')]('/',auth[_0x9948('0x8')](),controller[_0x9948('0xf')]);router[_0x9948('0xe')](_0x9948('0xc'),auth[_0x9948('0x8')](),controller[_0x9948('0x10')]);router[_0x9948('0xe')](_0x9948('0x11'),auth[_0x9948('0x8')](),controller[_0x9948('0x12')]);router['put'](_0x9948('0xa'),auth[_0x9948('0x8')](),controller['update']);router[_0x9948('0x13')]('/:id',auth[_0x9948('0x8')](),controller[_0x9948('0x14')]);module['exports']=router; \ No newline at end of file +var _0xf700=['/:id','show','getIntervals','post','/:id/sub_intervals','addInterval','addIntervals','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','isAuthenticated','index','get'];(function(_0x58fdc5,_0x5986a){var _0x121190=function(_0x28bd5c){while(--_0x28bd5c){_0x58fdc5['push'](_0x58fdc5['shift']());}};_0x121190(++_0x5986a);}(_0xf700,0x143));var _0x0f70=function(_0xdde91,_0x3ae43e){_0xdde91=_0xdde91-0x0;var _0x1166d4=_0xf700[_0xdde91];return _0x1166d4;};'use strict';var multer=require(_0x0f70('0x0'));var util=require('util');var path=require(_0x0f70('0x1'));var timeout=require(_0x0f70('0x2'));var express=require(_0x0f70('0x3'));var router=express[_0x0f70('0x4')]();var fs_extra=require(_0x0f70('0x5'));var auth=require(_0x0f70('0x6'));var interaction=require(_0x0f70('0x7'));var config=require(_0x0f70('0x8'));var controller=require(_0x0f70('0x9'));router['get']('/',auth[_0x0f70('0xa')](),controller[_0x0f70('0xb')]);router[_0x0f70('0xc')](_0x0f70('0xd'),auth[_0x0f70('0xa')](),controller[_0x0f70('0xe')]);router[_0x0f70('0xc')]('/:id/sub_intervals',auth[_0x0f70('0xa')](),controller[_0x0f70('0xf')]);router[_0x0f70('0x10')]('/',auth[_0x0f70('0xa')](),controller['create']);router[_0x0f70('0x10')](_0x0f70('0x11'),auth['isAuthenticated'](),controller[_0x0f70('0x12')]);router[_0x0f70('0x10')]('/:id/sub_intervals/create_many',auth[_0x0f70('0xa')](),controller[_0x0f70('0x13')]);router[_0x0f70('0x14')](_0x0f70('0xd'),auth[_0x0f70('0xa')](),controller[_0x0f70('0x15')]);router['delete']('/:id',auth[_0x0f70('0xa')](),controller[_0x0f70('0x16')]);module[_0x0f70('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 58ce1e3..387cee7 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 _0x40c2=['sequelize','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x40c2,0x8d));var _0x240c=function(_0x3601b8,_0x24e23f){_0x3601b8=_0x3601b8-0x0;var _0x43d107=_0x40c2[_0x3601b8];return _0x43d107;};'use strict';var Sequelize=require(_0x240c('0x0'));module[_0x240c('0x1')]={'name':{'type':Sequelize[_0x240c('0x2')]},'description':{'type':Sequelize[_0x240c('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x5e61=['STRING','sequelize','exports'];(function(_0x1d7932,_0x5e7bbd){var _0x4be1ac=function(_0x3fdef9){while(--_0x3fdef9){_0x1d7932['push'](_0x1d7932['shift']());}};_0x4be1ac(++_0x5e7bbd);}(_0x5e61,0xd6));var _0x15e6=function(_0x49185d,_0x52126f){_0x49185d=_0x49185d-0x0;var _0x47fd5e=_0x5e61[_0x49185d];return _0x47fd5e;};'use strict';var Sequelize=require(_0x15e6('0x0'));module[_0x15e6('0x1')]={'name':{'type':Sequelize[_0x15e6('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x15e6('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 439a093..08da568 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 _0x7a54=['papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','Intervals','UserProfileResource','destroy','error','stack','name','send','index','map','Interval','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','order','sort','where','pick','filter','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','rawAttributes','merge','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addInterval','IntervalId','keys','getIntervals','hasOwnProperty','nolimit','findOne','bulkCreate','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce'];(function(_0x34e1fa,_0x3b75cd){var _0x59500e=function(_0x1b635c){while(--_0x1b635c){_0x34e1fa['push'](_0x34e1fa['shift']());}};_0x59500e(++_0x3b75cd);}(_0x7a54,0x106));var _0x47a5=function(_0x7eff60,_0x2b02f6){_0x7eff60=_0x7eff60-0x0;var _0x1a4488=_0x7a54[_0x7eff60];return _0x1a4488;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x47a5('0xb'));var squel=require(_0x47a5('0xc'));var crypto=require('crypto');var jsforce=require(_0x47a5('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x47a5('0xe'));var Redis=require(_0x47a5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x47a5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x47a5('0x11'))(_0x47a5('0x12'));var utils=require(_0x47a5('0x13'));var config=require(_0x47a5('0x14'));var licenseUtil=require(_0x47a5('0x15'));var db=require(_0x47a5('0x16'))['db'];var extensions=require(_0x47a5('0x17'));function respondWithStatusCode(_0x5beb89,_0x44bd3e){_0x44bd3e=_0x44bd3e||0xcc;return function(_0x221b54){if(_0x221b54){return _0x5beb89[_0x47a5('0x18')](_0x44bd3e);}return _0x5beb89[_0x47a5('0x19')](_0x44bd3e)[_0x47a5('0x1a')]();};}function respondWithResult(_0x620ee9,_0x3c6c46){_0x3c6c46=_0x3c6c46||0xc8;return function(_0x190faa){if(_0x190faa){return _0x620ee9['status'](_0x3c6c46)[_0x47a5('0x1b')](_0x190faa);}};}function respondWithFilteredResult(_0x11faf5,_0x3b001e){return function(_0x2a2cbb){if(_0x2a2cbb){var _0x1ef44c=_0x2a2cbb['count'],_0x574af6=_0x3b001e['offset'],_0x549de3=_0x3b001e[_0x47a5('0x1c')]+_0x3b001e[_0x47a5('0x1d')],_0x138bc0;if(_0x549de3>=_0x1ef44c){_0x549de3=_0x1ef44c;_0x138bc0=0xc8;}else{_0x138bc0=0xce;}_0x11faf5[_0x47a5('0x19')](_0x138bc0);return _0x11faf5[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x574af6+'-'+_0x549de3+'/'+_0x1ef44c)[_0x47a5('0x1b')](_0x2a2cbb);}return null;};}function patchUpdates(_0x2763d6){return function(_0xe3c618){try{jsonpatch[_0x47a5('0x20')](_0xe3c618,_0x2763d6,!![]);}catch(_0x4a9fcb){return BPromise[_0x47a5('0x21')](_0x4a9fcb);}return _0xe3c618[_0x47a5('0x22')]();};}function saveUpdates(_0x47cf3c,_0x2b0360){return function(_0x1f03f7){if(_0x1f03f7){return _0x1f03f7[_0x47a5('0x23')](_0x47cf3c)['then'](function(_0xb8ae6c){return _0xb8ae6c;});}return null;};}function removeEntity(_0x2f142b,_0x23db32){return function(_0x7a9f9e){if(_0x7a9f9e){return _0x7a9f9e['destroy']()[_0x47a5('0x24')](function(){var _0x385687=_0x7a9f9e['get']({'plain':!![]});var _0x28747d=_0x47a5('0x25');return db[_0x47a5('0x26')][_0x47a5('0x27')]({'where':{'type':_0x28747d,'resourceId':_0x385687['id']}})[_0x47a5('0x24')](function(){return _0x7a9f9e;});})['then'](function(){_0x2f142b['status'](0xcc)[_0x47a5('0x1a')]();});}};}function handleEntityNotFound(_0x5686db,_0x1ea9c8){return function(_0x5b6c4e){if(!_0x5b6c4e){_0x5686db[_0x47a5('0x18')](0x194);}return _0x5b6c4e;};}function handleError(_0x378208,_0x36ad34){_0x36ad34=_0x36ad34||0x1f4;return function(_0x1dac65){logger[_0x47a5('0x28')](_0x1dac65[_0x47a5('0x29')]);if(_0x1dac65[_0x47a5('0x2a')]){delete _0x1dac65[_0x47a5('0x2a')];}_0x378208[_0x47a5('0x19')](_0x36ad34)[_0x47a5('0x2b')](_0x1dac65);};}exports[_0x47a5('0x2c')]=function(_0x11a4fa,_0x3ad507){var _0x528582={},_0x243210={},_0x51833b={'count':0x0,'rows':[]};var _0x2ef875=_[_0x47a5('0x2d')](db[_0x47a5('0x2e')]['rawAttributes'],function(_0x256650){return{'name':_0x256650[_0x47a5('0x2f')],'type':_0x256650[_0x47a5('0x30')][_0x47a5('0x31')]};});_0x243210['model']=_['map'](_0x2ef875,_0x47a5('0x2a'));_0x243210[_0x47a5('0x32')]=_['keys'](_0x11a4fa['query']);_0x243210[_0x47a5('0x33')]=_[_0x47a5('0x34')](_0x243210['model'],_0x243210[_0x47a5('0x32')]);_0x528582['attributes']=_[_0x47a5('0x34')](_0x243210[_0x47a5('0x35')],qs['fields'](_0x11a4fa['query'][_0x47a5('0x36')]));_0x528582['attributes']=_0x528582[_0x47a5('0x37')][_0x47a5('0x38')]?_0x528582[_0x47a5('0x37')]:_0x243210['model'];if(!_0x11a4fa[_0x47a5('0x32')]['hasOwnProperty']('nolimit')){_0x528582[_0x47a5('0x1d')]=qs['limit'](_0x11a4fa[_0x47a5('0x32')]['limit']);_0x528582[_0x47a5('0x1c')]=qs[_0x47a5('0x1c')](_0x11a4fa[_0x47a5('0x32')][_0x47a5('0x1c')]);}_0x528582[_0x47a5('0x39')]=qs[_0x47a5('0x3a')](_0x11a4fa[_0x47a5('0x32')][_0x47a5('0x3a')]);_0x528582[_0x47a5('0x3b')]=qs['filters'](_[_0x47a5('0x3c')](_0x11a4fa[_0x47a5('0x32')],_0x243210['filters']),_0x2ef875);if(_0x11a4fa[_0x47a5('0x32')][_0x47a5('0x3d')]){_0x528582[_0x47a5('0x3b')]=_['merge'](_0x528582[_0x47a5('0x3b')],{'$or':_[_0x47a5('0x2d')](_0x2ef875,function(_0x596097){if(_0x596097[_0x47a5('0x30')]!==_0x47a5('0x3e')){var _0x54ae35={};_0x54ae35[_0x596097['name']]={'$like':'%'+_0x11a4fa['query'][_0x47a5('0x3d')]+'%'};return _0x54ae35;}})});}_0x528582=_['merge']({},_0x528582,_0x11a4fa[_0x47a5('0x3f')]);var _0x1f9631={'where':_0x528582[_0x47a5('0x3b')]};return db[_0x47a5('0x2e')][_0x47a5('0x40')](_0x1f9631)[_0x47a5('0x24')](function(_0x2003b0){_0x51833b[_0x47a5('0x40')]=_0x2003b0;if(_0x11a4fa[_0x47a5('0x32')][_0x47a5('0x41')]){_0x528582[_0x47a5('0x42')]=[{'all':!![]}];}return db[_0x47a5('0x2e')][_0x47a5('0x43')](_0x528582);})['then'](function(_0x1fbece){_0x51833b[_0x47a5('0x44')]=_0x1fbece;return _0x51833b;})[_0x47a5('0x24')](respondWithFilteredResult(_0x3ad507,_0x528582))[_0x47a5('0x45')](handleError(_0x3ad507,null));};exports['show']=function(_0x7de536,_0x528ef3){var _0x47c7a2={'raw':!![],'where':{'id':_0x7de536['params']['id']}},_0x55c43d={};_0x55c43d[_0x47a5('0x35')]=_['keys'](db[_0x47a5('0x2e')][_0x47a5('0x46')]);_0x55c43d[_0x47a5('0x32')]=_['keys'](_0x7de536[_0x47a5('0x32')]);_0x55c43d[_0x47a5('0x33')]=_['intersection'](_0x55c43d['model'],_0x55c43d[_0x47a5('0x32')]);_0x47c7a2['attributes']=_[_0x47a5('0x34')](_0x55c43d[_0x47a5('0x35')],qs[_0x47a5('0x36')](_0x7de536[_0x47a5('0x32')][_0x47a5('0x36')]));_0x47c7a2[_0x47a5('0x37')]=_0x47c7a2[_0x47a5('0x37')][_0x47a5('0x38')]?_0x47c7a2[_0x47a5('0x37')]:_0x55c43d[_0x47a5('0x35')];if(_0x7de536[_0x47a5('0x32')][_0x47a5('0x41')]){_0x47c7a2[_0x47a5('0x42')]=[{'all':!![]}];}_0x47c7a2=_[_0x47a5('0x47')]({},_0x47c7a2,_0x7de536[_0x47a5('0x3f')]);return db[_0x47a5('0x2e')]['find'](_0x47c7a2)[_0x47a5('0x24')](handleEntityNotFound(_0x528ef3,null))[_0x47a5('0x24')](respondWithResult(_0x528ef3,null))['catch'](handleError(_0x528ef3,null));};exports['create']=function(_0x3d0a88,_0x560e4e){return db[_0x47a5('0x2e')][_0x47a5('0x48')](_0x3d0a88['body'],{})['then'](function(_0x3d85cc){var _0x52d409=_0x3d0a88[_0x47a5('0x49')][_0x47a5('0x4a')]({'plain':!![]});if(!_0x52d409)throw new Error(_0x47a5('0x4b'));if(_0x52d409[_0x47a5('0x4c')]===_0x47a5('0x49')){var _0x26acd2=_0x3d85cc[_0x47a5('0x4a')]({'plain':!![]});var _0x53e994='Intervals';return db[_0x47a5('0x4d')][_0x47a5('0x4e')]({'where':{'name':_0x53e994,'userProfileId':_0x52d409[_0x47a5('0x4f')]},'raw':!![]})[_0x47a5('0x24')](function(_0x2c7020){if(_0x2c7020&&_0x2c7020[_0x47a5('0x50')]===0x0){return db[_0x47a5('0x26')]['create']({'name':_0x26acd2[_0x47a5('0x2a')],'resourceId':_0x26acd2['id'],'type':_0x2c7020[_0x47a5('0x2a')],'sectionId':_0x2c7020['id']},{})[_0x47a5('0x24')](function(){return _0x3d85cc;});}else{return _0x3d85cc;}})['catch'](function(_0x12ca40){logger['error'](_0x47a5('0x51'),_0x12ca40);throw _0x12ca40;});}return _0x3d85cc;})[_0x47a5('0x24')](respondWithResult(_0x560e4e,0xc9))[_0x47a5('0x45')](handleError(_0x560e4e,null));};exports[_0x47a5('0x23')]=function(_0x588551,_0x3adf14){if(_0x588551[_0x47a5('0x52')]['id']){delete _0x588551[_0x47a5('0x52')]['id'];}return db[_0x47a5('0x2e')][_0x47a5('0x4e')]({'where':{'id':_0x588551[_0x47a5('0x53')]['id']}})[_0x47a5('0x24')](handleEntityNotFound(_0x3adf14,null))['then'](saveUpdates(_0x588551[_0x47a5('0x52')],null))[_0x47a5('0x24')](respondWithResult(_0x3adf14,null))[_0x47a5('0x45')](handleError(_0x3adf14,null));};exports[_0x47a5('0x27')]=function(_0x3329aa,_0x1ab0bf){return db['Interval'][_0x47a5('0x4e')]({'where':{'id':_0x3329aa[_0x47a5('0x53')]['id']}})[_0x47a5('0x24')](handleEntityNotFound(_0x1ab0bf,null))['then'](removeEntity(_0x1ab0bf,null))[_0x47a5('0x45')](handleError(_0x1ab0bf,null));};exports[_0x47a5('0x54')]=function(_0x183b3c,_0x5d8d4a,_0x57641e){if(_0x183b3c[_0x47a5('0x52')]['id']){delete _0x183b3c[_0x47a5('0x52')]['id'];}return db['Interval']['find']({'where':{'id':_0x183b3c[_0x47a5('0x53')]['id']}})['then'](handleEntityNotFound(_0x5d8d4a,null))[_0x47a5('0x24')](function(_0x5d383d){if(_0x5d383d){_0x183b3c['body'][_0x47a5('0x55')]=_0x5d383d['id'];return db[_0x47a5('0x2e')]['create'](_0x183b3c[_0x47a5('0x52')]);}})[_0x47a5('0x24')](respondWithResult(_0x5d8d4a,null))['catch'](handleError(_0x5d8d4a,null));};exports['getIntervals']=function(_0x16b4fd,_0x30d482,_0x867da0){var _0x2931e4={};var _0x5996c4={};var _0x199621;var _0x2b4255;return db[_0x47a5('0x2e')]['findOne']({'where':{'id':_0x16b4fd[_0x47a5('0x53')]['id']}})['then'](handleEntityNotFound(_0x30d482,null))[_0x47a5('0x24')](function(_0x470da6){if(_0x470da6){_0x199621=_0x470da6;_0x5996c4[_0x47a5('0x35')]=_[_0x47a5('0x56')](db[_0x47a5('0x2e')]['rawAttributes']);_0x5996c4[_0x47a5('0x32')]=_['keys'](_0x16b4fd['query']);_0x5996c4['filters']=_['intersection'](_0x5996c4[_0x47a5('0x35')],_0x5996c4[_0x47a5('0x32')]);_0x2931e4[_0x47a5('0x37')]=_['intersection'](_0x5996c4['model'],qs[_0x47a5('0x36')](_0x16b4fd[_0x47a5('0x32')][_0x47a5('0x36')]));_0x2931e4[_0x47a5('0x37')]=_0x2931e4[_0x47a5('0x37')]['length']?_0x2931e4[_0x47a5('0x37')]:_0x5996c4['model'];_0x2931e4[_0x47a5('0x39')]=qs[_0x47a5('0x3a')](_0x16b4fd['query'][_0x47a5('0x3a')]);_0x2931e4[_0x47a5('0x3b')]=qs[_0x47a5('0x33')](_[_0x47a5('0x3c')](_0x16b4fd[_0x47a5('0x32')],_0x5996c4[_0x47a5('0x33')]));if(_0x16b4fd[_0x47a5('0x32')][_0x47a5('0x3d')]){_0x2931e4['where']=_[_0x47a5('0x47')](_0x2931e4[_0x47a5('0x3b')],{'$or':_[_0x47a5('0x2d')](_0x2931e4[_0x47a5('0x37')],function(_0x396cb0){var _0x4bbe14={};_0x4bbe14[_0x396cb0]={'$like':'%'+_0x16b4fd[_0x47a5('0x32')][_0x47a5('0x3d')]+'%'};return _0x4bbe14;})});}_0x2931e4=_[_0x47a5('0x47')]({},_0x2931e4,_0x16b4fd[_0x47a5('0x3f')]);return _0x199621[_0x47a5('0x57')](_0x2931e4);}})[_0x47a5('0x24')](function(_0x453191){if(_0x453191){_0x2b4255=_0x453191[_0x47a5('0x38')];if(!_0x16b4fd[_0x47a5('0x32')][_0x47a5('0x58')](_0x47a5('0x59'))){_0x2931e4[_0x47a5('0x1d')]=qs[_0x47a5('0x1d')](_0x16b4fd[_0x47a5('0x32')][_0x47a5('0x1d')]);_0x2931e4['offset']=qs[_0x47a5('0x1c')](_0x16b4fd[_0x47a5('0x32')][_0x47a5('0x1c')]);}return _0x199621['getIntervals'](_0x2931e4);}})[_0x47a5('0x24')](function(_0x2e46af){if(_0x2e46af){return _0x2e46af?{'count':_0x2b4255,'rows':_0x2e46af}:null;}})[_0x47a5('0x24')](respondWithResult(_0x30d482,null))[_0x47a5('0x45')](handleError(_0x30d482,null));};exports['addIntervals']=function(_0x3ac402,_0x522ccf,_0x2d5ee6){return db['Interval'][_0x47a5('0x5a')]({'where':{'id':_0x3ac402['params']['id']}})[_0x47a5('0x24')](handleEntityNotFound(_0x522ccf,null))[_0x47a5('0x24')](function(_0x2578d6){if(_0x2578d6){return db['sequelize']['transaction'](function(_0x4b8084){return db[_0x47a5('0x2e')][_0x47a5('0x27')]({'where':{'IntervalId':_0x3ac402[_0x47a5('0x53')]['id']},'transaction':_0x4b8084})[_0x47a5('0x24')](function(_0x525055){var _0x6c0f0=_[_0x47a5('0x2d')](_0x3ac402[_0x47a5('0x52')],function(_0xd5b23f){delete _0xd5b23f['id'];_0xd5b23f[_0x47a5('0x55')]=_0x3ac402[_0x47a5('0x53')]['id'];return _0xd5b23f;});return db[_0x47a5('0x2e')][_0x47a5('0x5b')](_0x6c0f0,{'transaction':_0x4b8084});});})[_0x47a5('0x24')](function(){return db[_0x47a5('0x2e')][_0x47a5('0x43')]({'where':{'IntervalId':_0x3ac402[_0x47a5('0x53')]['id']}});});}})['then'](respondWithResult(_0x522ccf,null))[_0x47a5('0x45')](handleError(_0x522ccf,null));}; \ No newline at end of file +var _0x7a54=['papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','Intervals','UserProfileResource','destroy','error','stack','name','send','index','map','Interval','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','order','sort','where','pick','filter','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','rawAttributes','merge','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addInterval','IntervalId','keys','getIntervals','hasOwnProperty','nolimit','findOne','bulkCreate','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce'];(function(_0x138286,_0xd5349e){var _0x161864=function(_0x2b67ad){while(--_0x2b67ad){_0x138286['push'](_0x138286['shift']());}};_0x161864(++_0xd5349e);}(_0x7a54,0x106));var _0x47a5=function(_0x58ce21,_0x868964){_0x58ce21=_0x58ce21-0x0;var _0x3a7404=_0x7a54[_0x58ce21];return _0x3a7404;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x47a5('0xb'));var squel=require(_0x47a5('0xc'));var crypto=require('crypto');var jsforce=require(_0x47a5('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x47a5('0xe'));var Redis=require(_0x47a5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x47a5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x47a5('0x11'))(_0x47a5('0x12'));var utils=require(_0x47a5('0x13'));var config=require(_0x47a5('0x14'));var licenseUtil=require(_0x47a5('0x15'));var db=require(_0x47a5('0x16'))['db'];var extensions=require(_0x47a5('0x17'));function respondWithStatusCode(_0x5beb89,_0x44bd3e){_0x44bd3e=_0x44bd3e||0xcc;return function(_0x221b54){if(_0x221b54){return _0x5beb89[_0x47a5('0x18')](_0x44bd3e);}return _0x5beb89[_0x47a5('0x19')](_0x44bd3e)[_0x47a5('0x1a')]();};}function respondWithResult(_0x620ee9,_0x3c6c46){_0x3c6c46=_0x3c6c46||0xc8;return function(_0x190faa){if(_0x190faa){return _0x620ee9['status'](_0x3c6c46)[_0x47a5('0x1b')](_0x190faa);}};}function respondWithFilteredResult(_0x11faf5,_0x3b001e){return function(_0x2a2cbb){if(_0x2a2cbb){var _0x1ef44c=_0x2a2cbb['count'],_0x574af6=_0x3b001e['offset'],_0x549de3=_0x3b001e[_0x47a5('0x1c')]+_0x3b001e[_0x47a5('0x1d')],_0x138bc0;if(_0x549de3>=_0x1ef44c){_0x549de3=_0x1ef44c;_0x138bc0=0xc8;}else{_0x138bc0=0xce;}_0x11faf5[_0x47a5('0x19')](_0x138bc0);return _0x11faf5[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x574af6+'-'+_0x549de3+'/'+_0x1ef44c)[_0x47a5('0x1b')](_0x2a2cbb);}return null;};}function patchUpdates(_0x2763d6){return function(_0xe3c618){try{jsonpatch[_0x47a5('0x20')](_0xe3c618,_0x2763d6,!![]);}catch(_0x4a9fcb){return BPromise[_0x47a5('0x21')](_0x4a9fcb);}return _0xe3c618[_0x47a5('0x22')]();};}function saveUpdates(_0x47cf3c,_0x2b0360){return function(_0x1f03f7){if(_0x1f03f7){return _0x1f03f7[_0x47a5('0x23')](_0x47cf3c)['then'](function(_0xb8ae6c){return _0xb8ae6c;});}return null;};}function removeEntity(_0x2f142b,_0x23db32){return function(_0x7a9f9e){if(_0x7a9f9e){return _0x7a9f9e['destroy']()[_0x47a5('0x24')](function(){var _0x385687=_0x7a9f9e['get']({'plain':!![]});var _0x28747d=_0x47a5('0x25');return db[_0x47a5('0x26')][_0x47a5('0x27')]({'where':{'type':_0x28747d,'resourceId':_0x385687['id']}})[_0x47a5('0x24')](function(){return _0x7a9f9e;});})['then'](function(){_0x2f142b['status'](0xcc)[_0x47a5('0x1a')]();});}};}function handleEntityNotFound(_0x5686db,_0x1ea9c8){return function(_0x5b6c4e){if(!_0x5b6c4e){_0x5686db[_0x47a5('0x18')](0x194);}return _0x5b6c4e;};}function handleError(_0x378208,_0x36ad34){_0x36ad34=_0x36ad34||0x1f4;return function(_0x1dac65){logger[_0x47a5('0x28')](_0x1dac65[_0x47a5('0x29')]);if(_0x1dac65[_0x47a5('0x2a')]){delete _0x1dac65[_0x47a5('0x2a')];}_0x378208[_0x47a5('0x19')](_0x36ad34)[_0x47a5('0x2b')](_0x1dac65);};}exports[_0x47a5('0x2c')]=function(_0x11a4fa,_0x3ad507){var _0x528582={},_0x243210={},_0x51833b={'count':0x0,'rows':[]};var _0x2ef875=_[_0x47a5('0x2d')](db[_0x47a5('0x2e')]['rawAttributes'],function(_0x256650){return{'name':_0x256650[_0x47a5('0x2f')],'type':_0x256650[_0x47a5('0x30')][_0x47a5('0x31')]};});_0x243210['model']=_['map'](_0x2ef875,_0x47a5('0x2a'));_0x243210[_0x47a5('0x32')]=_['keys'](_0x11a4fa['query']);_0x243210[_0x47a5('0x33')]=_[_0x47a5('0x34')](_0x243210['model'],_0x243210[_0x47a5('0x32')]);_0x528582['attributes']=_[_0x47a5('0x34')](_0x243210[_0x47a5('0x35')],qs['fields'](_0x11a4fa['query'][_0x47a5('0x36')]));_0x528582['attributes']=_0x528582[_0x47a5('0x37')][_0x47a5('0x38')]?_0x528582[_0x47a5('0x37')]:_0x243210['model'];if(!_0x11a4fa[_0x47a5('0x32')]['hasOwnProperty']('nolimit')){_0x528582[_0x47a5('0x1d')]=qs['limit'](_0x11a4fa[_0x47a5('0x32')]['limit']);_0x528582[_0x47a5('0x1c')]=qs[_0x47a5('0x1c')](_0x11a4fa[_0x47a5('0x32')][_0x47a5('0x1c')]);}_0x528582[_0x47a5('0x39')]=qs[_0x47a5('0x3a')](_0x11a4fa[_0x47a5('0x32')][_0x47a5('0x3a')]);_0x528582[_0x47a5('0x3b')]=qs['filters'](_[_0x47a5('0x3c')](_0x11a4fa[_0x47a5('0x32')],_0x243210['filters']),_0x2ef875);if(_0x11a4fa[_0x47a5('0x32')][_0x47a5('0x3d')]){_0x528582[_0x47a5('0x3b')]=_['merge'](_0x528582[_0x47a5('0x3b')],{'$or':_[_0x47a5('0x2d')](_0x2ef875,function(_0x596097){if(_0x596097[_0x47a5('0x30')]!==_0x47a5('0x3e')){var _0x54ae35={};_0x54ae35[_0x596097['name']]={'$like':'%'+_0x11a4fa['query'][_0x47a5('0x3d')]+'%'};return _0x54ae35;}})});}_0x528582=_['merge']({},_0x528582,_0x11a4fa[_0x47a5('0x3f')]);var _0x1f9631={'where':_0x528582[_0x47a5('0x3b')]};return db[_0x47a5('0x2e')][_0x47a5('0x40')](_0x1f9631)[_0x47a5('0x24')](function(_0x2003b0){_0x51833b[_0x47a5('0x40')]=_0x2003b0;if(_0x11a4fa[_0x47a5('0x32')][_0x47a5('0x41')]){_0x528582[_0x47a5('0x42')]=[{'all':!![]}];}return db[_0x47a5('0x2e')][_0x47a5('0x43')](_0x528582);})['then'](function(_0x1fbece){_0x51833b[_0x47a5('0x44')]=_0x1fbece;return _0x51833b;})[_0x47a5('0x24')](respondWithFilteredResult(_0x3ad507,_0x528582))[_0x47a5('0x45')](handleError(_0x3ad507,null));};exports['show']=function(_0x7de536,_0x528ef3){var _0x47c7a2={'raw':!![],'where':{'id':_0x7de536['params']['id']}},_0x55c43d={};_0x55c43d[_0x47a5('0x35')]=_['keys'](db[_0x47a5('0x2e')][_0x47a5('0x46')]);_0x55c43d[_0x47a5('0x32')]=_['keys'](_0x7de536[_0x47a5('0x32')]);_0x55c43d[_0x47a5('0x33')]=_['intersection'](_0x55c43d['model'],_0x55c43d[_0x47a5('0x32')]);_0x47c7a2['attributes']=_[_0x47a5('0x34')](_0x55c43d[_0x47a5('0x35')],qs[_0x47a5('0x36')](_0x7de536[_0x47a5('0x32')][_0x47a5('0x36')]));_0x47c7a2[_0x47a5('0x37')]=_0x47c7a2[_0x47a5('0x37')][_0x47a5('0x38')]?_0x47c7a2[_0x47a5('0x37')]:_0x55c43d[_0x47a5('0x35')];if(_0x7de536[_0x47a5('0x32')][_0x47a5('0x41')]){_0x47c7a2[_0x47a5('0x42')]=[{'all':!![]}];}_0x47c7a2=_[_0x47a5('0x47')]({},_0x47c7a2,_0x7de536[_0x47a5('0x3f')]);return db[_0x47a5('0x2e')]['find'](_0x47c7a2)[_0x47a5('0x24')](handleEntityNotFound(_0x528ef3,null))[_0x47a5('0x24')](respondWithResult(_0x528ef3,null))['catch'](handleError(_0x528ef3,null));};exports['create']=function(_0x3d0a88,_0x560e4e){return db[_0x47a5('0x2e')][_0x47a5('0x48')](_0x3d0a88['body'],{})['then'](function(_0x3d85cc){var _0x52d409=_0x3d0a88[_0x47a5('0x49')][_0x47a5('0x4a')]({'plain':!![]});if(!_0x52d409)throw new Error(_0x47a5('0x4b'));if(_0x52d409[_0x47a5('0x4c')]===_0x47a5('0x49')){var _0x26acd2=_0x3d85cc[_0x47a5('0x4a')]({'plain':!![]});var _0x53e994='Intervals';return db[_0x47a5('0x4d')][_0x47a5('0x4e')]({'where':{'name':_0x53e994,'userProfileId':_0x52d409[_0x47a5('0x4f')]},'raw':!![]})[_0x47a5('0x24')](function(_0x2c7020){if(_0x2c7020&&_0x2c7020[_0x47a5('0x50')]===0x0){return db[_0x47a5('0x26')]['create']({'name':_0x26acd2[_0x47a5('0x2a')],'resourceId':_0x26acd2['id'],'type':_0x2c7020[_0x47a5('0x2a')],'sectionId':_0x2c7020['id']},{})[_0x47a5('0x24')](function(){return _0x3d85cc;});}else{return _0x3d85cc;}})['catch'](function(_0x12ca40){logger['error'](_0x47a5('0x51'),_0x12ca40);throw _0x12ca40;});}return _0x3d85cc;})[_0x47a5('0x24')](respondWithResult(_0x560e4e,0xc9))[_0x47a5('0x45')](handleError(_0x560e4e,null));};exports[_0x47a5('0x23')]=function(_0x588551,_0x3adf14){if(_0x588551[_0x47a5('0x52')]['id']){delete _0x588551[_0x47a5('0x52')]['id'];}return db[_0x47a5('0x2e')][_0x47a5('0x4e')]({'where':{'id':_0x588551[_0x47a5('0x53')]['id']}})[_0x47a5('0x24')](handleEntityNotFound(_0x3adf14,null))['then'](saveUpdates(_0x588551[_0x47a5('0x52')],null))[_0x47a5('0x24')](respondWithResult(_0x3adf14,null))[_0x47a5('0x45')](handleError(_0x3adf14,null));};exports[_0x47a5('0x27')]=function(_0x3329aa,_0x1ab0bf){return db['Interval'][_0x47a5('0x4e')]({'where':{'id':_0x3329aa[_0x47a5('0x53')]['id']}})[_0x47a5('0x24')](handleEntityNotFound(_0x1ab0bf,null))['then'](removeEntity(_0x1ab0bf,null))[_0x47a5('0x45')](handleError(_0x1ab0bf,null));};exports[_0x47a5('0x54')]=function(_0x183b3c,_0x5d8d4a,_0x57641e){if(_0x183b3c[_0x47a5('0x52')]['id']){delete _0x183b3c[_0x47a5('0x52')]['id'];}return db['Interval']['find']({'where':{'id':_0x183b3c[_0x47a5('0x53')]['id']}})['then'](handleEntityNotFound(_0x5d8d4a,null))[_0x47a5('0x24')](function(_0x5d383d){if(_0x5d383d){_0x183b3c['body'][_0x47a5('0x55')]=_0x5d383d['id'];return db[_0x47a5('0x2e')]['create'](_0x183b3c[_0x47a5('0x52')]);}})[_0x47a5('0x24')](respondWithResult(_0x5d8d4a,null))['catch'](handleError(_0x5d8d4a,null));};exports['getIntervals']=function(_0x16b4fd,_0x30d482,_0x867da0){var _0x2931e4={};var _0x5996c4={};var _0x199621;var _0x2b4255;return db[_0x47a5('0x2e')]['findOne']({'where':{'id':_0x16b4fd[_0x47a5('0x53')]['id']}})['then'](handleEntityNotFound(_0x30d482,null))[_0x47a5('0x24')](function(_0x470da6){if(_0x470da6){_0x199621=_0x470da6;_0x5996c4[_0x47a5('0x35')]=_[_0x47a5('0x56')](db[_0x47a5('0x2e')]['rawAttributes']);_0x5996c4[_0x47a5('0x32')]=_['keys'](_0x16b4fd['query']);_0x5996c4['filters']=_['intersection'](_0x5996c4[_0x47a5('0x35')],_0x5996c4[_0x47a5('0x32')]);_0x2931e4[_0x47a5('0x37')]=_['intersection'](_0x5996c4['model'],qs[_0x47a5('0x36')](_0x16b4fd[_0x47a5('0x32')][_0x47a5('0x36')]));_0x2931e4[_0x47a5('0x37')]=_0x2931e4[_0x47a5('0x37')]['length']?_0x2931e4[_0x47a5('0x37')]:_0x5996c4['model'];_0x2931e4[_0x47a5('0x39')]=qs[_0x47a5('0x3a')](_0x16b4fd['query'][_0x47a5('0x3a')]);_0x2931e4[_0x47a5('0x3b')]=qs[_0x47a5('0x33')](_[_0x47a5('0x3c')](_0x16b4fd[_0x47a5('0x32')],_0x5996c4[_0x47a5('0x33')]));if(_0x16b4fd[_0x47a5('0x32')][_0x47a5('0x3d')]){_0x2931e4['where']=_[_0x47a5('0x47')](_0x2931e4[_0x47a5('0x3b')],{'$or':_[_0x47a5('0x2d')](_0x2931e4[_0x47a5('0x37')],function(_0x396cb0){var _0x4bbe14={};_0x4bbe14[_0x396cb0]={'$like':'%'+_0x16b4fd[_0x47a5('0x32')][_0x47a5('0x3d')]+'%'};return _0x4bbe14;})});}_0x2931e4=_[_0x47a5('0x47')]({},_0x2931e4,_0x16b4fd[_0x47a5('0x3f')]);return _0x199621[_0x47a5('0x57')](_0x2931e4);}})[_0x47a5('0x24')](function(_0x453191){if(_0x453191){_0x2b4255=_0x453191[_0x47a5('0x38')];if(!_0x16b4fd[_0x47a5('0x32')][_0x47a5('0x58')](_0x47a5('0x59'))){_0x2931e4[_0x47a5('0x1d')]=qs[_0x47a5('0x1d')](_0x16b4fd[_0x47a5('0x32')][_0x47a5('0x1d')]);_0x2931e4['offset']=qs[_0x47a5('0x1c')](_0x16b4fd[_0x47a5('0x32')][_0x47a5('0x1c')]);}return _0x199621['getIntervals'](_0x2931e4);}})[_0x47a5('0x24')](function(_0x2e46af){if(_0x2e46af){return _0x2e46af?{'count':_0x2b4255,'rows':_0x2e46af}:null;}})[_0x47a5('0x24')](respondWithResult(_0x30d482,null))[_0x47a5('0x45')](handleError(_0x30d482,null));};exports['addIntervals']=function(_0x3ac402,_0x522ccf,_0x2d5ee6){return db['Interval'][_0x47a5('0x5a')]({'where':{'id':_0x3ac402['params']['id']}})[_0x47a5('0x24')](handleEntityNotFound(_0x522ccf,null))[_0x47a5('0x24')](function(_0x2578d6){if(_0x2578d6){return db['sequelize']['transaction'](function(_0x4b8084){return db[_0x47a5('0x2e')][_0x47a5('0x27')]({'where':{'IntervalId':_0x3ac402[_0x47a5('0x53')]['id']},'transaction':_0x4b8084})[_0x47a5('0x24')](function(_0x525055){var _0x6c0f0=_[_0x47a5('0x2d')](_0x3ac402[_0x47a5('0x52')],function(_0xd5b23f){delete _0xd5b23f['id'];_0xd5b23f[_0x47a5('0x55')]=_0x3ac402[_0x47a5('0x53')]['id'];return _0xd5b23f;});return db[_0x47a5('0x2e')][_0x47a5('0x5b')](_0x6c0f0,{'transaction':_0x4b8084});});})[_0x47a5('0x24')](function(){return db[_0x47a5('0x2e')][_0x47a5('0x43')]({'where':{'IntervalId':_0x3ac402[_0x47a5('0x53')]['id']}});});}})['then'](respondWithResult(_0x522ccf,null))[_0x47a5('0x45')](handleError(_0x522ccf,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 9fe17ed..4ef493e 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 _0x117d=['exports','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./interval.attributes','../../components/extensions/rewrite'];(function(_0x3bbc98,_0x138310){var _0x3f9749=function(_0x42969d){while(--_0x42969d){_0x3bbc98['push'](_0x3bbc98['shift']());}};_0x3f9749(++_0x138310);}(_0x117d,0xac));var _0xd117=function(_0x420513,_0x30eae3){_0x420513=_0x420513-0x0;var _0x1b44ec=_0x117d[_0x420513];return _0x1b44ec;};'use strict';var _=require(_0xd117('0x0'));var util=require(_0xd117('0x1'));var logger=require(_0xd117('0x2'))('api');var moment=require(_0xd117('0x3'));var BPromise=require(_0xd117('0x4'));var rp=require(_0xd117('0x5'));var fs=require('fs');var path=require(_0xd117('0x6'));var rimraf=require(_0xd117('0x7'));var config=require('../../config/environment');var attributes=require(_0xd117('0x8'));var extensions=require(_0xd117('0x9'));module[_0xd117('0xa')]=function(_0x55f7a3,_0x494fcd){return _0x55f7a3['define'](_0xd117('0xb'),attributes,{'tableName':_0xd117('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x28a7dd,_0x41e479){extensions[_0xd117('0xd')](_0x55f7a3,_0x28a7dd);},'afterBulkCreate':function(_0x142e66,_0x11f72e,_0x2ec2c7){_0x2ec2c7();extensions[_0xd117('0xd')](_0x55f7a3,_0x142e66[0x0]);},'afterUpdate':function(_0x2835c0,_0x316583){extensions[_0xd117('0xd')](_0x55f7a3,_0x2835c0);},'afterDestroy':function(_0x2f47dd,_0x56adfd){extensions[_0xd117('0xd')](_0x55f7a3,_0x2f47dd);}}});}; \ No newline at end of file +var _0x7497=['rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','tools_intervals'];(function(_0x3c10fa,_0x460b1d){var _0x5655ee=function(_0x38dfc3){while(--_0x38dfc3){_0x3c10fa['push'](_0x3c10fa['shift']());}};_0x5655ee(++_0x460b1d);}(_0x7497,0x13c));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7749('0x0'));var util=require(_0x7749('0x1'));var logger=require(_0x7749('0x2'))(_0x7749('0x3'));var moment=require(_0x7749('0x4'));var BPromise=require(_0x7749('0x5'));var rp=require(_0x7749('0x6'));var fs=require('fs');var path=require(_0x7749('0x7'));var rimraf=require(_0x7749('0x8'));var config=require(_0x7749('0x9'));var attributes=require(_0x7749('0xa'));var extensions=require(_0x7749('0xb'));module[_0x7749('0xc')]=function(_0x341c81,_0xef965f){return _0x341c81['define']('Interval',attributes,{'tableName':_0x7749('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1bd19b,_0x4af29d){extensions['rewrite'](_0x341c81,_0x1bd19b);},'afterBulkCreate':function(_0x3e20c9,_0x3f6fe2,_0x13fd45){_0x13fd45();extensions[_0x7749('0xe')](_0x341c81,_0x3e20c9[0x0]);},'afterUpdate':function(_0x51e6b5,_0x483296){extensions[_0x7749('0xe')](_0x341c81,_0x51e6b5);},'afterDestroy':function(_0x55c062,_0x201de8){extensions['rewrite'](_0x341c81,_0x55c062);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 5b44249..a4777e3 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 _0xccfb=['../../config/environment','jayson/promise','client','http','request','then','Interval,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','options','raw','where','attributes','limit','model','include','map','GetInterval','ShowInterval','Interval','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3e317b,_0x2c64f2){var _0x2bec45=function(_0x114459){while(--_0x114459){_0x3e317b['push'](_0x3e317b['shift']());}};_0x2bec45(++_0x2c64f2);}(_0xccfb,0x1a7));var _0xbccf=function(_0x55b8eb,_0x5186e1){_0x55b8eb=_0x55b8eb-0x0;var _0x4d7223=_0xccfb[_0x55b8eb];return _0x4d7223;};'use strict';var _=require(_0xbccf('0x0'));var util=require(_0xbccf('0x1'));var moment=require(_0xbccf('0x2'));var BPromise=require(_0xbccf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbccf('0x4'));var db=require(_0xbccf('0x5'))['db'];var utils=require(_0xbccf('0x6'));var logger=require(_0xbccf('0x7'))(_0xbccf('0x8'));var config=require(_0xbccf('0x9'));var jayson=require(_0xbccf('0xa'));var client=jayson[_0xbccf('0xb')][_0xbccf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x285932,_0x15777d,_0x247a70){return new BPromise(function(_0x3f3d90,_0x50a820){return client[_0xbccf('0xd')](_0x285932,_0x247a70)[_0xbccf('0xe')](function(_0x53d596){logger['info'](_0xbccf('0xf'),_0x15777d,_0xbccf('0x10'));logger[_0xbccf('0x11')]('Interval,\x20%s,\x20%s,\x20%s',_0x15777d,_0xbccf('0x10'),JSON[_0xbccf('0x12')](_0x53d596));if(_0x53d596[_0xbccf('0x13')]){if(_0x53d596['error'][_0xbccf('0x14')]===0x1f4){logger[_0xbccf('0x13')](_0xbccf('0xf'),_0x15777d,_0x53d596[_0xbccf('0x13')][_0xbccf('0x15')]);return _0x50a820(_0x53d596[_0xbccf('0x13')]['message']);}logger[_0xbccf('0x13')](_0xbccf('0xf'),_0x15777d,_0x53d596[_0xbccf('0x13')]['message']);return _0x3f3d90(_0x53d596['error']['message']);}else{logger[_0xbccf('0x16')](_0xbccf('0xf'),_0x15777d,'request\x20sent');_0x3f3d90(_0x53d596[_0xbccf('0x17')]['message']);}})[_0xbccf('0x18')](function(_0x1ec1b5){logger[_0xbccf('0x13')](_0xbccf('0xf'),_0x15777d,_0x1ec1b5);_0x50a820(_0x1ec1b5);});});}exports['GetInterval']=function(_0x20d71f){var _0x32003a=this;return new Promise(function(_0x33c678,_0x562224){return db['Interval']['findAll']({'raw':_0x20d71f[_0xbccf('0x19')]?_0x20d71f['options'][_0xbccf('0x1a')]===undefined?!![]:![]:!![],'where':_0x20d71f[_0xbccf('0x19')]?_0x20d71f[_0xbccf('0x19')][_0xbccf('0x1b')]||null:null,'attributes':_0x20d71f[_0xbccf('0x19')]?_0x20d71f[_0xbccf('0x19')][_0xbccf('0x1c')]||null:null,'limit':_0x20d71f[_0xbccf('0x19')]?_0x20d71f['options'][_0xbccf('0x1d')]||null:null,'include':_0x20d71f[_0xbccf('0x19')]?_0x20d71f[_0xbccf('0x19')]['include']?_['map'](_0x20d71f['options']['include'],function(_0x167788){return{'model':db[_0x167788[_0xbccf('0x1e')]],'as':_0x167788['as'],'attributes':_0x167788[_0xbccf('0x1c')],'include':_0x167788[_0xbccf('0x1f')]?_[_0xbccf('0x20')](_0x167788[_0xbccf('0x1f')],function(_0x3bfa62){return{'model':db[_0x3bfa62[_0xbccf('0x1e')]],'as':_0x3bfa62['as'],'attributes':_0x3bfa62[_0xbccf('0x1c')],'include':_0x3bfa62[_0xbccf('0x1f')]?_[_0xbccf('0x20')](_0x3bfa62[_0xbccf('0x1f')],function(_0x548fd3){return{'model':db[_0x548fd3[_0xbccf('0x1e')]],'as':_0x548fd3['as'],'attributes':_0x548fd3[_0xbccf('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4bcebc){logger['info'](_0xbccf('0x21'),_0x20d71f);logger[_0xbccf('0x11')](_0xbccf('0x21'),_0x20d71f,JSON[_0xbccf('0x12')](_0x4bcebc));_0x33c678(_0x4bcebc);})[_0xbccf('0x18')](function(_0x4dad02){logger[_0xbccf('0x13')](_0xbccf('0x21'),_0x4dad02[_0xbccf('0x15')],_0x20d71f);_0x562224(_0x32003a[_0xbccf('0x13')](0x1f4,_0x4dad02[_0xbccf('0x15')]));});});};exports[_0xbccf('0x22')]=function(_0x50fb1a){var _0x297ad7=this;return new Promise(function(_0xaed09b,_0x3beae0){return db[_0xbccf('0x23')]['find']({'raw':_0x50fb1a[_0xbccf('0x19')]?_0x50fb1a[_0xbccf('0x19')][_0xbccf('0x1a')]===undefined?!![]:![]:!![],'where':_0x50fb1a[_0xbccf('0x19')]?_0x50fb1a[_0xbccf('0x19')][_0xbccf('0x1b')]||null:null,'attributes':_0x50fb1a[_0xbccf('0x19')]?_0x50fb1a['options'][_0xbccf('0x1c')]||null:null,'include':_0x50fb1a[_0xbccf('0x19')]?_0x50fb1a[_0xbccf('0x19')][_0xbccf('0x1f')]?_['map'](_0x50fb1a[_0xbccf('0x19')][_0xbccf('0x1f')],function(_0x224205){return{'model':db[_0x224205[_0xbccf('0x1e')]],'as':_0x224205['as'],'attributes':_0x224205[_0xbccf('0x1c')],'include':_0x224205['include']?_['map'](_0x224205[_0xbccf('0x1f')],function(_0x54453b){return{'model':db[_0x54453b[_0xbccf('0x1e')]],'as':_0x54453b['as'],'attributes':_0x54453b[_0xbccf('0x1c')],'include':_0x54453b['include']?_['map'](_0x54453b[_0xbccf('0x1f')],function(_0x2d99ed){return{'model':db[_0x2d99ed['model']],'as':_0x2d99ed['as'],'attributes':_0x2d99ed[_0xbccf('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x214a63){logger[_0xbccf('0x16')](_0xbccf('0x22'),_0x50fb1a);logger[_0xbccf('0x11')](_0xbccf('0x22'),_0x50fb1a,JSON[_0xbccf('0x12')](_0x214a63));_0xaed09b(_0x214a63);})[_0xbccf('0x18')](function(_0x5565ca){logger[_0xbccf('0x13')](_0xbccf('0x22'),_0x5565ca['message'],_0x50fb1a);_0x3beae0(_0x297ad7[_0xbccf('0x13')](0x1f4,_0x5565ca[_0xbccf('0x15')]));});});}; \ No newline at end of file +var _0x3a01=['attributes','include','map','model','then','ShowInterval','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Interval,\x20%s,\x20%s','result','catch','GetInterval','Interval','findAll','options','raw','where'];(function(_0x5e3277,_0x369ffa){var _0x1db722=function(_0x227710){while(--_0x227710){_0x5e3277['push'](_0x5e3277['shift']());}};_0x1db722(++_0x369ffa);}(_0x3a01,0x1da));var _0x13a0=function(_0x3c7b49,_0x1bee76){_0x3c7b49=_0x3c7b49-0x0;var _0x47e261=_0x3a01[_0x3c7b49];return _0x47e261;};'use strict';var _=require(_0x13a0('0x0'));var util=require(_0x13a0('0x1'));var moment=require(_0x13a0('0x2'));var BPromise=require('bluebird');var rs=require(_0x13a0('0x3'));var fs=require('fs');var Redis=require(_0x13a0('0x4'));var db=require(_0x13a0('0x5'))['db'];var utils=require(_0x13a0('0x6'));var logger=require(_0x13a0('0x7'))(_0x13a0('0x8'));var config=require(_0x13a0('0x9'));var jayson=require(_0x13a0('0xa'));var client=jayson[_0x13a0('0xb')][_0x13a0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x33dcd7,_0x40a31c,_0x2bbb23){return new BPromise(function(_0x28381d,_0x5d7c23){return client['request'](_0x33dcd7,_0x2bbb23)['then'](function(_0x1a6858){logger[_0x13a0('0xd')]('Interval,\x20%s,\x20%s',_0x40a31c,_0x13a0('0xe'));logger[_0x13a0('0xf')](_0x13a0('0x10'),_0x40a31c,_0x13a0('0xe'),JSON[_0x13a0('0x11')](_0x1a6858));if(_0x1a6858['error']){if(_0x1a6858[_0x13a0('0x12')][_0x13a0('0x13')]===0x1f4){logger['error']('Interval,\x20%s,\x20%s',_0x40a31c,_0x1a6858['error'][_0x13a0('0x14')]);return _0x5d7c23(_0x1a6858[_0x13a0('0x12')][_0x13a0('0x14')]);}logger[_0x13a0('0x12')](_0x13a0('0x15'),_0x40a31c,_0x1a6858['error'][_0x13a0('0x14')]);return _0x28381d(_0x1a6858[_0x13a0('0x12')][_0x13a0('0x14')]);}else{logger[_0x13a0('0xd')]('Interval,\x20%s,\x20%s',_0x40a31c,_0x13a0('0xe'));_0x28381d(_0x1a6858[_0x13a0('0x16')]['message']);}})[_0x13a0('0x17')](function(_0xd6d445){logger['error'](_0x13a0('0x15'),_0x40a31c,_0xd6d445);_0x5d7c23(_0xd6d445);});});}exports[_0x13a0('0x18')]=function(_0x5716e6){var _0x44ad28=this;return new Promise(function(_0x31344b,_0x561a32){return db[_0x13a0('0x19')][_0x13a0('0x1a')]({'raw':_0x5716e6[_0x13a0('0x1b')]?_0x5716e6[_0x13a0('0x1b')][_0x13a0('0x1c')]===undefined?!![]:![]:!![],'where':_0x5716e6[_0x13a0('0x1b')]?_0x5716e6[_0x13a0('0x1b')][_0x13a0('0x1d')]||null:null,'attributes':_0x5716e6['options']?_0x5716e6[_0x13a0('0x1b')][_0x13a0('0x1e')]||null:null,'limit':_0x5716e6['options']?_0x5716e6[_0x13a0('0x1b')]['limit']||null:null,'include':_0x5716e6[_0x13a0('0x1b')]?_0x5716e6[_0x13a0('0x1b')][_0x13a0('0x1f')]?_[_0x13a0('0x20')](_0x5716e6[_0x13a0('0x1b')][_0x13a0('0x1f')],function(_0x37803a){return{'model':db[_0x37803a[_0x13a0('0x21')]],'as':_0x37803a['as'],'attributes':_0x37803a['attributes'],'include':_0x37803a[_0x13a0('0x1f')]?_[_0x13a0('0x20')](_0x37803a[_0x13a0('0x1f')],function(_0x2a6fc1){return{'model':db[_0x2a6fc1[_0x13a0('0x21')]],'as':_0x2a6fc1['as'],'attributes':_0x2a6fc1[_0x13a0('0x1e')],'include':_0x2a6fc1[_0x13a0('0x1f')]?_['map'](_0x2a6fc1[_0x13a0('0x1f')],function(_0x595e45){return{'model':db[_0x595e45[_0x13a0('0x21')]],'as':_0x595e45['as'],'attributes':_0x595e45[_0x13a0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x13a0('0x22')](function(_0x775e43){logger[_0x13a0('0xd')](_0x13a0('0x18'),_0x5716e6);logger[_0x13a0('0xf')](_0x13a0('0x18'),_0x5716e6,JSON['stringify'](_0x775e43));_0x31344b(_0x775e43);})[_0x13a0('0x17')](function(_0xcb7927){logger[_0x13a0('0x12')](_0x13a0('0x18'),_0xcb7927[_0x13a0('0x14')],_0x5716e6);_0x561a32(_0x44ad28[_0x13a0('0x12')](0x1f4,_0xcb7927[_0x13a0('0x14')]));});});};exports[_0x13a0('0x23')]=function(_0xf710b){var _0x5df71c=this;return new Promise(function(_0x163bf3,_0x441072){return db[_0x13a0('0x19')]['find']({'raw':_0xf710b[_0x13a0('0x1b')]?_0xf710b['options'][_0x13a0('0x1c')]===undefined?!![]:![]:!![],'where':_0xf710b[_0x13a0('0x1b')]?_0xf710b['options'][_0x13a0('0x1d')]||null:null,'attributes':_0xf710b[_0x13a0('0x1b')]?_0xf710b[_0x13a0('0x1b')][_0x13a0('0x1e')]||null:null,'include':_0xf710b[_0x13a0('0x1b')]?_0xf710b['options']['include']?_[_0x13a0('0x20')](_0xf710b[_0x13a0('0x1b')][_0x13a0('0x1f')],function(_0x99cd6){return{'model':db[_0x99cd6[_0x13a0('0x21')]],'as':_0x99cd6['as'],'attributes':_0x99cd6['attributes'],'include':_0x99cd6[_0x13a0('0x1f')]?_[_0x13a0('0x20')](_0x99cd6[_0x13a0('0x1f')],function(_0x491e13){return{'model':db[_0x491e13[_0x13a0('0x21')]],'as':_0x491e13['as'],'attributes':_0x491e13['attributes'],'include':_0x491e13[_0x13a0('0x1f')]?_[_0x13a0('0x20')](_0x491e13[_0x13a0('0x1f')],function(_0x3d58af){return{'model':db[_0x3d58af['model']],'as':_0x3d58af['as'],'attributes':_0x3d58af[_0x13a0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x13a0('0x22')](function(_0x16f088){logger['info']('ShowInterval',_0xf710b);logger[_0x13a0('0xf')](_0x13a0('0x23'),_0xf710b,JSON['stringify'](_0x16f088));_0x163bf3(_0x16f088);})['catch'](function(_0xd8b009){logger[_0x13a0('0x12')]('ShowInterval',_0xd8b009[_0x13a0('0x14')],_0xf710b);_0x441072(_0x5df71c[_0x13a0('0x12')](0x1f4,_0xd8b009['message']));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 244b4d5..60711ab 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 _0x948a=['express','../../components/auth/service','./jira.controller','post','isAuthenticated','send'];(function(_0x34bc14,_0x25dea2){var _0xf761ae=function(_0x4a59a3){while(--_0x4a59a3){_0x34bc14['push'](_0x34bc14['shift']());}};_0xf761ae(++_0x25dea2);}(_0x948a,0xba));var _0xa948=function(_0x3451e6,_0x4c2168){_0x3451e6=_0x3451e6-0x0;var _0x579b63=_0x948a[_0x3451e6];return _0x579b63;};'use strict';var express=require(_0xa948('0x0'));var router=express['Router']();var auth=require(_0xa948('0x1'));var controller=require(_0xa948('0x2'));router[_0xa948('0x3')]('/',auth[_0xa948('0x4')](),controller[_0xa948('0x5')]);module['exports']=router; \ No newline at end of file +var _0x90fa=['../../components/auth/service','send','exports','express'];(function(_0x26623c,_0x335b7a){var _0x890a1f=function(_0x11e450){while(--_0x11e450){_0x26623c['push'](_0x26623c['shift']());}};_0x890a1f(++_0x335b7a);}(_0x90fa,0xe7));var _0xa90f=function(_0x404622,_0x3b1a87){_0x404622=_0x404622-0x0;var _0x336dd0=_0x90fa[_0x404622];return _0x336dd0;};'use strict';var express=require(_0xa90f('0x0'));var router=express['Router']();var auth=require(_0xa90f('0x1'));var controller=require('./jira.controller');router['post']('/',auth['isAuthenticated'](),controller[_0xa90f('0x2')]);module[_0xa90f('0x3')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 25bbbf8..edda144 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 _0x3b2f=['newToken','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','body','x-forwarded-for','connection','remoteAddress','socket','https','api','key','MOTGUI','summary','Report','\x20from\x20','stringify','issuetype','Bug','fields','customfield_11500','email','oldToken','customfield_11502'];(function(_0x3af407,_0x2080e4){var _0xc393e4=function(_0x5601dd){while(--_0x5601dd){_0x3af407['push'](_0x3af407['shift']());}};_0xc393e4(++_0x2080e4);}(_0x3b2f,0x75));var _0xf3b2=function(_0x199edf,_0x1a49d7){_0x199edf=_0x199edf-0x0;var _0x54ebaf=_0x3b2f[_0x199edf];return _0x54ebaf;};'use strict';var BPromise=require('bluebird');var https=require(_0xf3b2('0x0'));var logger=require('../../config/logger')(_0xf3b2('0x1'));var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x3c0555,_0x44fb80){var _0x4b1665={'fields':{'project':{'key':_0x3c0555[_0xf3b2('0x2')]||_0xf3b2('0x3')},'summary':(_0x3c0555[_0xf3b2('0x4')]||_0xf3b2('0x5'))+_0xf3b2('0x6')+_0x3c0555['ip'],'description':_0x3c0555['description']||JSON[_0xf3b2('0x7')](_0x3c0555),'issuetype':{'name':_0x3c0555[_0xf3b2('0x8')]||_0xf3b2('0x9')}}};_0x4b1665[_0xf3b2('0xa')][_0xf3b2('0xb')]=_0x3c0555[_0xf3b2('0xc')];_0x4b1665['fields']['customfield_11501']=_0x3c0555[_0xf3b2('0xd')];_0x4b1665[_0xf3b2('0xa')][_0xf3b2('0xe')]=_0x3c0555[_0xf3b2('0xf')];_0x4b1665[_0xf3b2('0xa')]['customfield_11503']=_0x3c0555[_0xf3b2('0x10')];_0x4b1665[_0xf3b2('0xa')][_0xf3b2('0x11')]=_0x3c0555[_0xf3b2('0x12')];_0x4b1665[_0xf3b2('0xa')][_0xf3b2('0x13')]=_0x3c0555['ip'];var _0x527ba2={'host':_0xf3b2('0x14'),'port':0x1bb,'path':_0xf3b2('0x15'),'method':_0xf3b2('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0xf3b2('0x17'),'Authorization':_0xf3b2('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0xf3b2('0x19')](_0xf3b2('0x1a'))}};var _0x4cf5fc=JSON['stringify'](_0x4b1665);var _0x29b3b1=https[_0xf3b2('0x1b')](_0x527ba2,function(_0x45de27){_0x45de27[_0xf3b2('0x1c')](_0xf3b2('0x1d'));var _0x4bf673='';_0x45de27['on'](_0xf3b2('0x1e'),function(_0x4da64f){_0x4bf673+=_0x4da64f;});_0x45de27['on'](_0xf3b2('0x1f'),function(){if(_0x44fb80){return _0x44fb80[_0xf3b2('0x20')](_0x45de27[_0xf3b2('0x21')])[_0xf3b2('0x22')](JSON['parse'](_0x4bf673));}});});_0x29b3b1['on'](_0xf3b2('0x23'),function(_0x163bc6){if(_0x44fb80){return _0x44fb80[_0xf3b2('0x20')](0x1f4)[_0xf3b2('0x22')]({'errors':[{'message':_0xf3b2('0x24'),'type':_0xf3b2('0x25')}]});}});_0x29b3b1[_0xf3b2('0x26')](_0x4cf5fc);_0x29b3b1['end']();}exports['openIssue']=openIssue;exports['send']=function(_0x21c58d,_0x4b0493){_0x21c58d[_0xf3b2('0x27')]['ip']=_0x21c58d['headers'][_0xf3b2('0x28')]||_0x21c58d[_0xf3b2('0x29')][_0xf3b2('0x2a')]||_0x21c58d[_0xf3b2('0x2b')][_0xf3b2('0x2a')]||_0x21c58d[_0xf3b2('0x29')][_0xf3b2('0x2b')][_0xf3b2('0x2a')];return openIssue(_0x21c58d[_0xf3b2('0x27')],_0x4b0493);}; \ No newline at end of file +var _0x90ab=['status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','headers','x-forwarded-for','remoteAddress','bluebird','https','api','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','description','customfield_11500','email','fields','customfield_11501','customfield_11502','customfield_11503','name','customfield_11504','customfield_10102','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','stringify','request','setEncoding','utf8','data','end'];(function(_0x546125,_0xfa3bf){var _0x77b546=function(_0x475555){while(--_0x475555){_0x546125['push'](_0x546125['shift']());}};_0x77b546(++_0xfa3bf);}(_0x90ab,0x1da));var _0xb90a=function(_0x50d5ae,_0x22a349){_0x50d5ae=_0x50d5ae-0x0;var _0x1e8d74=_0x90ab[_0x50d5ae];return _0x1e8d74;};'use strict';var BPromise=require(_0xb90a('0x0'));var https=require(_0xb90a('0x1'));var logger=require('../../config/logger')(_0xb90a('0x2'));var USERNAME='support';var PASSWORD=_0xb90a('0x3');function openIssue(_0xe0656f,_0xe5f8c5){var _0x251262={'fields':{'project':{'key':_0xe0656f[_0xb90a('0x4')]||_0xb90a('0x5')},'summary':(_0xe0656f['summary']||_0xb90a('0x6'))+_0xb90a('0x7')+_0xe0656f['ip'],'description':_0xe0656f[_0xb90a('0x8')]||JSON['stringify'](_0xe0656f),'issuetype':{'name':_0xe0656f['issuetype']||'Bug'}}};_0x251262['fields'][_0xb90a('0x9')]=_0xe0656f[_0xb90a('0xa')];_0x251262[_0xb90a('0xb')][_0xb90a('0xc')]=_0xe0656f['oldToken'];_0x251262[_0xb90a('0xb')][_0xb90a('0xd')]=_0xe0656f['newToken'];_0x251262['fields'][_0xb90a('0xe')]=_0xe0656f[_0xb90a('0xf')];_0x251262[_0xb90a('0xb')][_0xb90a('0x10')]=_0xe0656f['reason'];_0x251262[_0xb90a('0xb')][_0xb90a('0x11')]=_0xe0656f['ip'];var _0x219ae2={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xb90a('0x12'),'method':_0xb90a('0x13'),'timeout':0x4e20,'headers':{'Content-Type':_0xb90a('0x14'),'Authorization':_0xb90a('0x15')+new Buffer(USERNAME+':'+PASSWORD)[_0xb90a('0x16')](_0xb90a('0x17'))}};var _0x51fbca=JSON[_0xb90a('0x18')](_0x251262);var _0x59e7a4=https[_0xb90a('0x19')](_0x219ae2,function(_0x5c1da9){_0x5c1da9[_0xb90a('0x1a')](_0xb90a('0x1b'));var _0x15e8b8='';_0x5c1da9['on'](_0xb90a('0x1c'),function(_0x1c08c3){_0x15e8b8+=_0x1c08c3;});_0x5c1da9['on'](_0xb90a('0x1d'),function(){if(_0xe5f8c5){return _0xe5f8c5[_0xb90a('0x1e')](_0x5c1da9['statusCode'])[_0xb90a('0x1f')](JSON[_0xb90a('0x20')](_0x15e8b8));}});});_0x59e7a4['on'](_0xb90a('0x21'),function(_0x27a6a8){if(_0xe5f8c5){return _0xe5f8c5['status'](0x1f4)[_0xb90a('0x1f')]({'errors':[{'message':_0xb90a('0x22'),'type':'api.jira'}]});}});_0x59e7a4[_0xb90a('0x23')](_0x51fbca);_0x59e7a4[_0xb90a('0x1d')]();}exports[_0xb90a('0x24')]=openIssue;exports[_0xb90a('0x25')]=function(_0x246e05,_0x1f6909){_0x246e05[_0xb90a('0x26')]['ip']=_0x246e05[_0xb90a('0x27')][_0xb90a('0x28')]||_0x246e05['connection'][_0xb90a('0x29')]||_0x246e05['socket'][_0xb90a('0x29')]||_0x246e05['connection']['socket'][_0xb90a('0x29')];return openIssue(_0x246e05[_0xb90a('0x26')],_0x1f6909);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 3d7798f..9a05ef3 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 _0xec7a=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','isAuthenticated','index','get','/describe','/:id','show'];(function(_0x26942a,_0x53a7f9){var _0x525463=function(_0x530848){while(--_0x530848){_0x26942a['push'](_0x26942a['shift']());}};_0x525463(++_0x53a7f9);}(_0xec7a,0x1d4));var _0xaec7=function(_0x5d61b4,_0x4f7b91){_0x5d61b4=_0x5d61b4-0x0;var _0x183fc5=_0xec7a[_0x5d61b4];return _0x183fc5;};'use strict';var multer=require(_0xaec7('0x0'));var util=require(_0xaec7('0x1'));var path=require(_0xaec7('0x2'));var timeout=require(_0xaec7('0x3'));var express=require(_0xaec7('0x4'));var router=express[_0xaec7('0x5')]();var fs_extra=require(_0xaec7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xaec7('0x7'));var config=require(_0xaec7('0x8'));var controller=require(_0xaec7('0x9'));router['get']('/',auth[_0xaec7('0xa')](),controller[_0xaec7('0xb')]);router[_0xaec7('0xc')](_0xaec7('0xd'),auth[_0xaec7('0xa')](),controller['describe']);router[_0xaec7('0xc')](_0xaec7('0xe'),auth[_0xaec7('0xa')](),controller[_0xaec7('0xf')]);router['post']('/',auth[_0xaec7('0xa')](),controller[_0xaec7('0x10')]);router[_0xaec7('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xaec7('0x12')]);router[_0xaec7('0x13')](_0xaec7('0xe'),auth['isAuthenticated'](),controller[_0xaec7('0x14')]);module[_0xaec7('0x15')]=router; \ No newline at end of file +var _0xd22b=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','describe','/:id','post','put','delete','exports','util'];(function(_0xa41e13,_0x3bcb76){var _0xa2c16b=function(_0x3258e6){while(--_0x3258e6){_0xa41e13['push'](_0xa41e13['shift']());}};_0xa2c16b(++_0x3bcb76);}(_0xd22b,0xed));var _0xbd22=function(_0x4e0f55,_0x2bf5f9){_0x4e0f55=_0x4e0f55-0x0;var _0x4b7450=_0xd22b[_0x4e0f55];return _0x4b7450;};'use strict';var multer=require('multer');var util=require(_0xbd22('0x0'));var path=require(_0xbd22('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbd22('0x2')]();var fs_extra=require(_0xbd22('0x3'));var auth=require(_0xbd22('0x4'));var interaction=require(_0xbd22('0x5'));var config=require(_0xbd22('0x6'));var controller=require(_0xbd22('0x7'));router[_0xbd22('0x8')]('/',auth[_0xbd22('0x9')](),controller[_0xbd22('0xa')]);router[_0xbd22('0x8')]('/describe',auth[_0xbd22('0x9')](),controller[_0xbd22('0xb')]);router[_0xbd22('0x8')](_0xbd22('0xc'),auth[_0xbd22('0x9')](),controller['show']);router[_0xbd22('0xd')]('/',auth[_0xbd22('0x9')](),controller['create']);router[_0xbd22('0xe')](_0xbd22('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xbd22('0xf')](_0xbd22('0xc'),auth[_0xbd22('0x9')](),controller['destroy']);module[_0xbd22('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 03475d1..20fcfaa 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 _0x9d9b=['STRING','exports','TEXT','long'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x28fc99,_0x34e5ea){_0x28fc99=_0x28fc99-0x0;var _0x1fb310=_0x9d9b[_0x28fc99];return _0x1fb310;};'use strict';var Sequelize=require('sequelize');module[_0xb9d9('0x0')]={'question':{'type':Sequelize[_0xb9d9('0x1')]},'answer':{'type':Sequelize['TEXT'](_0xb9d9('0x2'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xb9d9('0x3')]},'queue':{'type':Sequelize[_0xb9d9('0x3')]},'uniqueid':{'type':Sequelize[_0xb9d9('0x3')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb9d9('0x3')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf7b4=['long','STRING','sequelize','TEXT'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xf7b4,0x152));var _0x4f7b=function(_0x188e3b,_0x4b8e01){_0x188e3b=_0x188e3b-0x0;var _0x5137c9=_0xf7b4[_0x188e3b];return _0x5137c9;};'use strict';var Sequelize=require(_0x4f7b('0x0'));module['exports']={'question':{'type':Sequelize['TEXT']},'answer':{'type':Sequelize[_0x4f7b('0x1')](_0x4f7b('0x2'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x4f7b('0x3')]},'uniqueid':{'type':Sequelize[_0x4f7b('0x3')]},'calleridname':{'type':Sequelize[_0x4f7b('0x3')]},'calleridnum':{'type':Sequelize[_0x4f7b('0x3')]},'questionId':{'type':Sequelize[_0x4f7b('0x3')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index cc19577..5b34717 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 _0x5bba=['filter','merge','includeAll','include','findAll','rows','catch','show','length','options','find','create','update','body','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','apply','reject','destroy','then','end','error','name','send','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','hasOwnProperty','limit','order','sort','where','filters'];(function(_0x12d8a1,_0x175bbb){var _0x4e57b9=function(_0x34130d){while(--_0x34130d){_0x12d8a1['push'](_0x12d8a1['shift']());}};_0x4e57b9(++_0x175bbb);}(_0x5bba,0x1b4));var _0xa5bb=function(_0x28b8b0,_0x5ad754){_0x28b8b0=_0x28b8b0-0x0;var _0x182c53=_0x5bba[_0x28b8b0];return _0x182c53;};'use strict';var pdf=require(_0xa5bb('0x0'));var emlformat=require(_0xa5bb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa5bb('0x2'));var jsonpatch=require(_0xa5bb('0x3'));var rp=require(_0xa5bb('0x4'));var moment=require(_0xa5bb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa5bb('0x6'));var util=require(_0xa5bb('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa5bb('0x8'));var crypto=require(_0xa5bb('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xa5bb('0xa'));var toCsv=require(_0xa5bb('0xb'));var querystring=require(_0xa5bb('0xc'));var Papa=require('papaparse');var Redis=require(_0xa5bb('0xd'));var authService=require(_0xa5bb('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xa5bb('0xf'));var hardwareService=require(_0xa5bb('0x10'));var logger=require('../../config/logger')(_0xa5bb('0x11'));var utils=require(_0xa5bb('0x12'));var config=require(_0xa5bb('0x13'));var licenseUtil=require(_0xa5bb('0x14'));var db=require(_0xa5bb('0x15'))['db'];function respondWithStatusCode(_0x3d653e,_0x276fcc){_0x276fcc=_0x276fcc||0xcc;return function(_0x44bcec){if(_0x44bcec){return _0x3d653e[_0xa5bb('0x16')](_0x276fcc);}return _0x3d653e[_0xa5bb('0x17')](_0x276fcc)['end']();};}function respondWithResult(_0x1caabf,_0x3b20f3){_0x3b20f3=_0x3b20f3||0xc8;return function(_0x1d9819){if(_0x1d9819){return _0x1caabf['status'](_0x3b20f3)[_0xa5bb('0x18')](_0x1d9819);}};}function respondWithFilteredResult(_0x2304a2,_0x1bf6b0){return function(_0x4facd1){if(_0x4facd1){var _0x318772=_0x4facd1[_0xa5bb('0x19')],_0x4f540f=_0x1bf6b0['offset'],_0x1d699e=_0x1bf6b0[_0xa5bb('0x1a')]+_0x1bf6b0['limit'],_0x5b3a09;if(_0x1d699e>=_0x318772){_0x1d699e=_0x318772;_0x5b3a09=0xc8;}else{_0x5b3a09=0xce;}_0x2304a2['status'](_0x5b3a09);return _0x2304a2['set'](_0xa5bb('0x1b'),_0x4f540f+'-'+_0x1d699e+'/'+_0x318772)[_0xa5bb('0x18')](_0x4facd1);}return null;};}function patchUpdates(_0x2df3fa){return function(_0x4e2d6d){try{jsonpatch[_0xa5bb('0x1c')](_0x4e2d6d,_0x2df3fa,!![]);}catch(_0x589f92){return BPromise[_0xa5bb('0x1d')](_0x589f92);}return _0x4e2d6d['save']();};}function saveUpdates(_0x2b30cf,_0xa1fa6b){return function(_0x2520a5){if(_0x2520a5){return _0x2520a5['update'](_0x2b30cf)['then'](function(_0x5d631f){return _0x5d631f;});}return null;};}function removeEntity(_0x2628a2,_0x1afd13){return function(_0x4d3971){if(_0x4d3971){return _0x4d3971[_0xa5bb('0x1e')]()[_0xa5bb('0x1f')](function(){_0x2628a2[_0xa5bb('0x17')](0xcc)[_0xa5bb('0x20')]();});}};}function handleEntityNotFound(_0x4a49a8,_0x3c387a){return function(_0x57d1d4){if(!_0x57d1d4){_0x4a49a8['sendStatus'](0x194);}return _0x57d1d4;};}function handleError(_0x5b6480,_0x119682){_0x119682=_0x119682||0x1f4;return function(_0x286bae){logger[_0xa5bb('0x21')](_0x286bae['stack']);if(_0x286bae[_0xa5bb('0x22')]){delete _0x286bae[_0xa5bb('0x22')];}_0x5b6480[_0xa5bb('0x17')](_0x119682)[_0xa5bb('0x23')](_0x286bae);};}exports['index']=function(_0x7880cd,_0x1ae60f){var _0x573a82={},_0x4a7812={},_0x372f04={'count':0x0,'rows':[]};var _0x13bd3a=_[_0xa5bb('0x24')](db[_0xa5bb('0x25')][_0xa5bb('0x26')],function(_0x3cc4c7){return{'name':_0x3cc4c7[_0xa5bb('0x27')],'type':_0x3cc4c7[_0xa5bb('0x28')][_0xa5bb('0x29')]};});_0x4a7812['model']=_[_0xa5bb('0x24')](_0x13bd3a,_0xa5bb('0x22'));_0x4a7812[_0xa5bb('0x2a')]=_[_0xa5bb('0x2b')](_0x7880cd['query']);_0x4a7812['filters']=_[_0xa5bb('0x2c')](_0x4a7812['model'],_0x4a7812[_0xa5bb('0x2a')]);_0x573a82[_0xa5bb('0x2d')]=_[_0xa5bb('0x2c')](_0x4a7812[_0xa5bb('0x2e')],qs[_0xa5bb('0x2f')](_0x7880cd[_0xa5bb('0x2a')][_0xa5bb('0x2f')]));_0x573a82[_0xa5bb('0x2d')]=_0x573a82[_0xa5bb('0x2d')]['length']?_0x573a82[_0xa5bb('0x2d')]:_0x4a7812[_0xa5bb('0x2e')];if(!_0x7880cd[_0xa5bb('0x2a')][_0xa5bb('0x30')]('nolimit')){_0x573a82[_0xa5bb('0x31')]=qs[_0xa5bb('0x31')](_0x7880cd['query']['limit']);_0x573a82[_0xa5bb('0x1a')]=qs['offset'](_0x7880cd[_0xa5bb('0x2a')][_0xa5bb('0x1a')]);}_0x573a82[_0xa5bb('0x32')]=qs[_0xa5bb('0x33')](_0x7880cd[_0xa5bb('0x2a')][_0xa5bb('0x33')]);_0x573a82[_0xa5bb('0x34')]=qs[_0xa5bb('0x35')](_['pick'](_0x7880cd[_0xa5bb('0x2a')],_0x4a7812['filters']),_0x13bd3a);if(_0x7880cd[_0xa5bb('0x2a')][_0xa5bb('0x36')]){_0x573a82['where']=_['merge'](_0x573a82['where'],{'$or':_['map'](_0x13bd3a,function(_0x4dfcf1){if(_0x4dfcf1[_0xa5bb('0x28')]!=='VIRTUAL'){var _0x45d5df={};_0x45d5df[_0x4dfcf1[_0xa5bb('0x22')]]={'$like':'%'+_0x7880cd[_0xa5bb('0x2a')][_0xa5bb('0x36')]+'%'};return _0x45d5df;}})});}_0x573a82=_[_0xa5bb('0x37')]({},_0x573a82,_0x7880cd['options']);var _0x831298={'where':_0x573a82[_0xa5bb('0x34')]};return db[_0xa5bb('0x25')][_0xa5bb('0x19')](_0x831298)[_0xa5bb('0x1f')](function(_0x5ee896){_0x372f04[_0xa5bb('0x19')]=_0x5ee896;if(_0x7880cd[_0xa5bb('0x2a')][_0xa5bb('0x38')]){_0x573a82[_0xa5bb('0x39')]=[{'all':!![]}];}return db[_0xa5bb('0x25')][_0xa5bb('0x3a')](_0x573a82);})[_0xa5bb('0x1f')](function(_0x301814){_0x372f04[_0xa5bb('0x3b')]=_0x301814;return _0x372f04;})[_0xa5bb('0x1f')](respondWithFilteredResult(_0x1ae60f,_0x573a82))[_0xa5bb('0x3c')](handleError(_0x1ae60f,null));};exports[_0xa5bb('0x3d')]=function(_0x5dc42e,_0x491be1){var _0xcd623={'raw':!![],'where':{'id':_0x5dc42e['params']['id']}},_0x230c71={};_0x230c71['model']=_[_0xa5bb('0x2b')](db['JscriptyAnswerReport'][_0xa5bb('0x26')]);_0x230c71[_0xa5bb('0x2a')]=_[_0xa5bb('0x2b')](_0x5dc42e[_0xa5bb('0x2a')]);_0x230c71[_0xa5bb('0x35')]=_[_0xa5bb('0x2c')](_0x230c71['model'],_0x230c71[_0xa5bb('0x2a')]);_0xcd623[_0xa5bb('0x2d')]=_[_0xa5bb('0x2c')](_0x230c71[_0xa5bb('0x2e')],qs[_0xa5bb('0x2f')](_0x5dc42e[_0xa5bb('0x2a')][_0xa5bb('0x2f')]));_0xcd623[_0xa5bb('0x2d')]=_0xcd623[_0xa5bb('0x2d')][_0xa5bb('0x3e')]?_0xcd623['attributes']:_0x230c71['model'];if(_0x5dc42e[_0xa5bb('0x2a')][_0xa5bb('0x38')]){_0xcd623[_0xa5bb('0x39')]=[{'all':!![]}];}_0xcd623=_[_0xa5bb('0x37')]({},_0xcd623,_0x5dc42e[_0xa5bb('0x3f')]);return db[_0xa5bb('0x25')][_0xa5bb('0x40')](_0xcd623)[_0xa5bb('0x1f')](handleEntityNotFound(_0x491be1,null))[_0xa5bb('0x1f')](respondWithResult(_0x491be1,null))['catch'](handleError(_0x491be1,null));};exports[_0xa5bb('0x41')]=function(_0x25a263,_0x397bc9){return db['JscriptyAnswerReport'][_0xa5bb('0x41')](_0x25a263['body'],{})['then'](respondWithResult(_0x397bc9,0xc9))['catch'](handleError(_0x397bc9,null));};exports[_0xa5bb('0x42')]=function(_0x3c04fe,_0x32010d){if(_0x3c04fe['body']['id']){delete _0x3c04fe[_0xa5bb('0x43')]['id'];}return db[_0xa5bb('0x25')][_0xa5bb('0x40')]({'where':{'id':_0x3c04fe[_0xa5bb('0x44')]['id']}})[_0xa5bb('0x1f')](handleEntityNotFound(_0x32010d,null))[_0xa5bb('0x1f')](saveUpdates(_0x3c04fe[_0xa5bb('0x43')],null))[_0xa5bb('0x1f')](respondWithResult(_0x32010d,null))[_0xa5bb('0x3c')](handleError(_0x32010d,null));};exports[_0xa5bb('0x1e')]=function(_0x3aac02,_0x394e8e){return db[_0xa5bb('0x25')][_0xa5bb('0x40')]({'where':{'id':_0x3aac02[_0xa5bb('0x44')]['id']}})['then'](handleEntityNotFound(_0x394e8e,null))[_0xa5bb('0x1f')](removeEntity(_0x394e8e,null))[_0xa5bb('0x3c')](handleError(_0x394e8e,null));};exports['describe']=function(_0x2f623e,_0x2d3f9b){return db[_0xa5bb('0x25')][_0xa5bb('0x45')]()['then'](respondWithResult(_0x2d3f9b,null))[_0xa5bb('0x3c')](handleError(_0x2d3f9b,null));}; \ No newline at end of file +var _0xb2f7=['../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update','then','stack','name','send','map','JscriptyAnswerReport','fieldName','type','key','query','keys','intersection','attributes','fields','length','model','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','params','rawAttributes','find','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service'];(function(_0x4f846e,_0xe5491f){var _0x54f14f=function(_0x368d2a){while(--_0x368d2a){_0x4f846e['push'](_0x4f846e['shift']());}};_0x54f14f(++_0xe5491f);}(_0xb2f7,0xb6));var _0x7b2f=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xb2f7[_0x8de54f];return _0x14cba4;};'use strict';var pdf=require(_0x7b2f('0x0'));var emlformat=require(_0x7b2f('0x1'));var rimraf=require(_0x7b2f('0x2'));var zipdir=require(_0x7b2f('0x3'));var jsonpatch=require(_0x7b2f('0x4'));var rp=require('request-promise');var moment=require(_0x7b2f('0x5'));var BPromise=require(_0x7b2f('0x6'));var Mustache=require(_0x7b2f('0x7'));var util=require(_0x7b2f('0x8'));var path=require(_0x7b2f('0x9'));var sox=require(_0x7b2f('0xa'));var csv=require(_0x7b2f('0xb'));var ejs=require(_0x7b2f('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b2f('0xd'));var squel=require('squel');var crypto=require(_0x7b2f('0xe'));var jsforce=require(_0x7b2f('0xf'));var deskjs=require(_0x7b2f('0x10'));var toCsv=require(_0x7b2f('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7b2f('0x11'));var authService=require(_0x7b2f('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b2f('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x7b2f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7b2f('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x410cdc,_0x16ee00){_0x16ee00=_0x16ee00||0xcc;return function(_0x5a95d6){if(_0x5a95d6){return _0x410cdc[_0x7b2f('0x16')](_0x16ee00);}return _0x410cdc[_0x7b2f('0x17')](_0x16ee00)[_0x7b2f('0x18')]();};}function respondWithResult(_0x111e6a,_0xdeb0eb){_0xdeb0eb=_0xdeb0eb||0xc8;return function(_0x31f337){if(_0x31f337){return _0x111e6a[_0x7b2f('0x17')](_0xdeb0eb)[_0x7b2f('0x19')](_0x31f337);}};}function respondWithFilteredResult(_0x43e5c1,_0x468d6d){return function(_0x8d8a4b){if(_0x8d8a4b){var _0x3c7192=_0x8d8a4b['count'],_0x401f6f=_0x468d6d[_0x7b2f('0x1a')],_0xe154f6=_0x468d6d[_0x7b2f('0x1a')]+_0x468d6d['limit'],_0x3795c4;if(_0xe154f6>=_0x3c7192){_0xe154f6=_0x3c7192;_0x3795c4=0xc8;}else{_0x3795c4=0xce;}_0x43e5c1[_0x7b2f('0x17')](_0x3795c4);return _0x43e5c1[_0x7b2f('0x1b')](_0x7b2f('0x1c'),_0x401f6f+'-'+_0xe154f6+'/'+_0x3c7192)[_0x7b2f('0x19')](_0x8d8a4b);}return null;};}function patchUpdates(_0x5526ec){return function(_0x3830c9){try{jsonpatch[_0x7b2f('0x1d')](_0x3830c9,_0x5526ec,!![]);}catch(_0x2fbb3e){return BPromise[_0x7b2f('0x1e')](_0x2fbb3e);}return _0x3830c9['save']();};}function saveUpdates(_0x126889,_0x4cb66f){return function(_0x3faf34){if(_0x3faf34){return _0x3faf34[_0x7b2f('0x1f')](_0x126889)[_0x7b2f('0x20')](function(_0x449e76){return _0x449e76;});}return null;};}function removeEntity(_0x2638b6,_0x2fec0c){return function(_0x225e6b){if(_0x225e6b){return _0x225e6b['destroy']()[_0x7b2f('0x20')](function(){_0x2638b6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12d0e8,_0x1a1180){return function(_0x3911f6){if(!_0x3911f6){_0x12d0e8[_0x7b2f('0x16')](0x194);}return _0x3911f6;};}function handleError(_0xb36d12,_0x553066){_0x553066=_0x553066||0x1f4;return function(_0x50287b){logger['error'](_0x50287b[_0x7b2f('0x21')]);if(_0x50287b[_0x7b2f('0x22')]){delete _0x50287b[_0x7b2f('0x22')];}_0xb36d12[_0x7b2f('0x17')](_0x553066)[_0x7b2f('0x23')](_0x50287b);};}exports['index']=function(_0x44ba63,_0xc80333){var _0x4cca2d={},_0x13c54d={},_0x30ba15={'count':0x0,'rows':[]};var _0x513a40=_[_0x7b2f('0x24')](db[_0x7b2f('0x25')]['rawAttributes'],function(_0x307357){return{'name':_0x307357[_0x7b2f('0x26')],'type':_0x307357[_0x7b2f('0x27')][_0x7b2f('0x28')]};});_0x13c54d['model']=_[_0x7b2f('0x24')](_0x513a40,_0x7b2f('0x22'));_0x13c54d[_0x7b2f('0x29')]=_[_0x7b2f('0x2a')](_0x44ba63[_0x7b2f('0x29')]);_0x13c54d['filters']=_[_0x7b2f('0x2b')](_0x13c54d['model'],_0x13c54d['query']);_0x4cca2d[_0x7b2f('0x2c')]=_[_0x7b2f('0x2b')](_0x13c54d['model'],qs[_0x7b2f('0x2d')](_0x44ba63[_0x7b2f('0x29')][_0x7b2f('0x2d')]));_0x4cca2d[_0x7b2f('0x2c')]=_0x4cca2d[_0x7b2f('0x2c')][_0x7b2f('0x2e')]?_0x4cca2d[_0x7b2f('0x2c')]:_0x13c54d[_0x7b2f('0x2f')];if(!_0x44ba63[_0x7b2f('0x29')]['hasOwnProperty']('nolimit')){_0x4cca2d[_0x7b2f('0x30')]=qs[_0x7b2f('0x30')](_0x44ba63[_0x7b2f('0x29')]['limit']);_0x4cca2d[_0x7b2f('0x1a')]=qs[_0x7b2f('0x1a')](_0x44ba63['query'][_0x7b2f('0x1a')]);}_0x4cca2d[_0x7b2f('0x31')]=qs[_0x7b2f('0x32')](_0x44ba63['query']['sort']);_0x4cca2d[_0x7b2f('0x33')]=qs[_0x7b2f('0x34')](_[_0x7b2f('0x35')](_0x44ba63[_0x7b2f('0x29')],_0x13c54d[_0x7b2f('0x34')]),_0x513a40);if(_0x44ba63[_0x7b2f('0x29')][_0x7b2f('0x36')]){_0x4cca2d['where']=_[_0x7b2f('0x37')](_0x4cca2d[_0x7b2f('0x33')],{'$or':_[_0x7b2f('0x24')](_0x513a40,function(_0x121e50){if(_0x121e50[_0x7b2f('0x27')]!==_0x7b2f('0x38')){var _0x2a2d56={};_0x2a2d56[_0x121e50['name']]={'$like':'%'+_0x44ba63[_0x7b2f('0x29')]['filter']+'%'};return _0x2a2d56;}})});}_0x4cca2d=_[_0x7b2f('0x37')]({},_0x4cca2d,_0x44ba63[_0x7b2f('0x39')]);var _0x49832a={'where':_0x4cca2d[_0x7b2f('0x33')]};return db[_0x7b2f('0x25')]['count'](_0x49832a)[_0x7b2f('0x20')](function(_0x37ec46){_0x30ba15['count']=_0x37ec46;if(_0x44ba63[_0x7b2f('0x29')][_0x7b2f('0x3a')]){_0x4cca2d[_0x7b2f('0x3b')]=[{'all':!![]}];}return db[_0x7b2f('0x25')]['findAll'](_0x4cca2d);})[_0x7b2f('0x20')](function(_0x135b6a){_0x30ba15['rows']=_0x135b6a;return _0x30ba15;})[_0x7b2f('0x20')](respondWithFilteredResult(_0xc80333,_0x4cca2d))[_0x7b2f('0x3c')](handleError(_0xc80333,null));};exports['show']=function(_0x3bdffe,_0x249168){var _0x40a4b6={'raw':!![],'where':{'id':_0x3bdffe[_0x7b2f('0x3d')]['id']}},_0x3ee03f={};_0x3ee03f[_0x7b2f('0x2f')]=_[_0x7b2f('0x2a')](db['JscriptyAnswerReport'][_0x7b2f('0x3e')]);_0x3ee03f[_0x7b2f('0x29')]=_[_0x7b2f('0x2a')](_0x3bdffe[_0x7b2f('0x29')]);_0x3ee03f[_0x7b2f('0x34')]=_[_0x7b2f('0x2b')](_0x3ee03f['model'],_0x3ee03f[_0x7b2f('0x29')]);_0x40a4b6['attributes']=_[_0x7b2f('0x2b')](_0x3ee03f[_0x7b2f('0x2f')],qs[_0x7b2f('0x2d')](_0x3bdffe[_0x7b2f('0x29')]['fields']));_0x40a4b6[_0x7b2f('0x2c')]=_0x40a4b6[_0x7b2f('0x2c')][_0x7b2f('0x2e')]?_0x40a4b6[_0x7b2f('0x2c')]:_0x3ee03f[_0x7b2f('0x2f')];if(_0x3bdffe[_0x7b2f('0x29')][_0x7b2f('0x3a')]){_0x40a4b6[_0x7b2f('0x3b')]=[{'all':!![]}];}_0x40a4b6=_[_0x7b2f('0x37')]({},_0x40a4b6,_0x3bdffe[_0x7b2f('0x39')]);return db[_0x7b2f('0x25')][_0x7b2f('0x3f')](_0x40a4b6)[_0x7b2f('0x20')](handleEntityNotFound(_0x249168,null))[_0x7b2f('0x20')](respondWithResult(_0x249168,null))[_0x7b2f('0x3c')](handleError(_0x249168,null));};exports['create']=function(_0x39c3da,_0x2ea0dc){return db[_0x7b2f('0x25')]['create'](_0x39c3da[_0x7b2f('0x40')],{})['then'](respondWithResult(_0x2ea0dc,0xc9))[_0x7b2f('0x3c')](handleError(_0x2ea0dc,null));};exports[_0x7b2f('0x1f')]=function(_0x632834,_0x4ef660){if(_0x632834[_0x7b2f('0x40')]['id']){delete _0x632834[_0x7b2f('0x40')]['id'];}return db[_0x7b2f('0x25')][_0x7b2f('0x3f')]({'where':{'id':_0x632834[_0x7b2f('0x3d')]['id']}})[_0x7b2f('0x20')](handleEntityNotFound(_0x4ef660,null))['then'](saveUpdates(_0x632834['body'],null))[_0x7b2f('0x20')](respondWithResult(_0x4ef660,null))['catch'](handleError(_0x4ef660,null));};exports[_0x7b2f('0x41')]=function(_0x3eec80,_0xbcf2e8){return db[_0x7b2f('0x25')]['find']({'where':{'id':_0x3eec80[_0x7b2f('0x3d')]['id']}})['then'](handleEntityNotFound(_0xbcf2e8,null))[_0x7b2f('0x20')](removeEntity(_0xbcf2e8,null))['catch'](handleError(_0xbcf2e8,null));};exports[_0x7b2f('0x42')]=function(_0x9d82e3,_0x550b71){return db[_0x7b2f('0x25')][_0x7b2f('0x42')]()[_0x7b2f('0x20')](respondWithResult(_0x550b71,null))[_0x7b2f('0x3c')](handleError(_0x550b71,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index ffa1fa4..1969ca4 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 _0x420f=['util','moment','bluebird','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers'];(function(_0x5f3749,_0x5bd01d){var _0x163a2=function(_0x57dc79){while(--_0x57dc79){_0x5f3749['push'](_0x5f3749['shift']());}};_0x163a2(++_0x5bd01d);}(_0x420f,0x17c));var _0xf420=function(_0x30a52d,_0x4a9d41){_0x30a52d=_0x30a52d-0x0;var _0x271a88=_0x420f[_0x30a52d];return _0x271a88;};'use strict';var _=require('lodash');var util=require(_0xf420('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf420('0x1'));var BPromise=require(_0xf420('0x2'));var rp=require(_0xf420('0x3'));var fs=require('fs');var path=require(_0xf420('0x4'));var rimraf=require('rimraf');var config=require(_0xf420('0x5'));var attributes=require(_0xf420('0x6'));module[_0xf420('0x7')]=function(_0x59fd9f,_0x5c7720){return _0x59fd9f['define'](_0xf420('0x8'),attributes,{'tableName':_0xf420('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa76=['api','bluebird','request-promise','rimraf','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xfa76,0x194));var _0x6fa7=function(_0x4fb899,_0x3e7645){_0x4fb899=_0x4fb899-0x0;var _0x2f7d4b=_0xfa76[_0x4fb899];return _0x2f7d4b;};'use strict';var _=require(_0x6fa7('0x0'));var util=require(_0x6fa7('0x1'));var logger=require(_0x6fa7('0x2'))(_0x6fa7('0x3'));var moment=require('moment');var BPromise=require(_0x6fa7('0x4'));var rp=require(_0x6fa7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6fa7('0x6'));var config=require('../../config/environment');var attributes=require(_0x6fa7('0x7'));module[_0x6fa7('0x8')]=function(_0x1b4492,_0x22655c){return _0x1b4492['define'](_0x6fa7('0x9'),attributes,{'tableName':_0x6fa7('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 5cf7f42..39e2227 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 _0x358b=['stringify','error','message','result','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x51368e,_0x2df5d7){var _0x5e9bdb=function(_0x2c9815){while(--_0x2c9815){_0x51368e['push'](_0x51368e['shift']());}};_0x5e9bdb(++_0x2df5d7);}(_0x358b,0x103));var _0xb358=function(_0x7d45c6,_0xe22fac){_0x7d45c6=_0x7d45c6-0x0;var _0x56a736=_0x358b[_0x7d45c6];return _0x56a736;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb358('0x0'));var BPromise=require(_0xb358('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb358('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xb358('0x3'))('rpc');var config=require(_0xb358('0x4'));var jayson=require(_0xb358('0x5'));var client=jayson[_0xb358('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2739b8,_0x333ab2,_0x487f5b){return new BPromise(function(_0x4ec575,_0x35db40){return client['request'](_0x2739b8,_0x487f5b)[_0xb358('0x7')](function(_0x22659d){logger[_0xb358('0x8')](_0xb358('0x9'),_0x333ab2,'request\x20sent');logger[_0xb358('0xa')](_0xb358('0xb'),_0x333ab2,_0xb358('0xc'),JSON[_0xb358('0xd')](_0x22659d));if(_0x22659d['error']){if(_0x22659d[_0xb358('0xe')]['code']===0x1f4){logger[_0xb358('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x333ab2,_0x22659d[_0xb358('0xe')][_0xb358('0xf')]);return _0x35db40(_0x22659d[_0xb358('0xe')][_0xb358('0xf')]);}logger[_0xb358('0xe')](_0xb358('0x9'),_0x333ab2,_0x22659d[_0xb358('0xe')][_0xb358('0xf')]);return _0x4ec575(_0x22659d[_0xb358('0xe')]['message']);}else{logger[_0xb358('0x8')](_0xb358('0x9'),_0x333ab2,_0xb358('0xc'));_0x4ec575(_0x22659d[_0xb358('0x10')][_0xb358('0xf')]);}})['catch'](function(_0x2dd044){logger[_0xb358('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x333ab2,_0x2dd044);_0x35db40(_0x2dd044);});});} \ No newline at end of file +var _0x64b4=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/logger','../../config/environment','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x64b4,0xf0));var _0x464b=function(_0x481940,_0x55890f){_0x481940=_0x481940-0x0;var _0x150025=_0x64b4[_0x481940];return _0x150025;};'use strict';var _=require(_0x464b('0x0'));var util=require(_0x464b('0x1'));var moment=require('moment');var BPromise=require(_0x464b('0x2'));var rs=require(_0x464b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x464b('0x4'))('rpc');var config=require(_0x464b('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x22726f,_0x20cbe7,_0x184c9f){return new BPromise(function(_0x3e48f6,_0x4ed3cd){return client[_0x464b('0x6')](_0x22726f,_0x184c9f)[_0x464b('0x7')](function(_0x57b8bf){logger[_0x464b('0x8')](_0x464b('0x9'),_0x20cbe7,'request\x20sent');logger['debug'](_0x464b('0xa'),_0x20cbe7,_0x464b('0xb'),JSON[_0x464b('0xc')](_0x57b8bf));if(_0x57b8bf['error']){if(_0x57b8bf[_0x464b('0xd')][_0x464b('0xe')]===0x1f4){logger[_0x464b('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x20cbe7,_0x57b8bf[_0x464b('0xd')][_0x464b('0xf')]);return _0x4ed3cd(_0x57b8bf[_0x464b('0xd')][_0x464b('0xf')]);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x20cbe7,_0x57b8bf[_0x464b('0xd')][_0x464b('0xf')]);return _0x3e48f6(_0x57b8bf[_0x464b('0xd')][_0x464b('0xf')]);}else{logger[_0x464b('0x8')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x20cbe7,_0x464b('0xb'));_0x3e48f6(_0x57b8bf[_0x464b('0x10')][_0x464b('0xf')]);}})[_0x464b('0x11')](function(_0x3df044){logger['error'](_0x464b('0x9'),_0x20cbe7,_0x3df044);_0x4ed3cd(_0x3df044);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 229bbc6..8a92846 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 _0x2a07=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','/:id/summary','30s','getSummary','create','post','/:id/clone','clone','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4762f0,_0x21911f){var _0xe3d378=function(_0x19bdc7){while(--_0x19bdc7){_0x4762f0['push'](_0x4762f0['shift']());}};_0xe3d378(++_0x21911f);}(_0x2a07,0x74));var _0x72a0=function(_0x5c2e65,_0x20e630){_0x5c2e65=_0x5c2e65-0x0;var _0x445359=_0x2a07[_0x5c2e65];return _0x445359;};'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['getAnswers']);router[_0x72a0('0xa')](_0x72a0('0x12'),auth[_0x72a0('0xb')](),timeout(_0x72a0('0x13')),controller[_0x72a0('0x14')]);router['post']('/',auth[_0x72a0('0xb')](),controller[_0x72a0('0x15')]);router[_0x72a0('0x16')](_0x72a0('0x17'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x18')]);router[_0x72a0('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x72a0('0x1a')]);router[_0x72a0('0x1b')](_0x72a0('0xd'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x1c')]);module[_0x72a0('0x1d')]=router; \ No newline at end of file +var _0xcaf2=['./jscriptyProject.controller','get','isAuthenticated','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','put','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x252979,_0x465d63){var _0x6b0a67=function(_0x476262){while(--_0x476262){_0x252979['push'](_0x252979['shift']());}};_0x6b0a67(++_0x465d63);}(_0xcaf2,0x8a));var _0x2caf=function(_0x2c63a4,_0x18a34f){_0x2c63a4=_0x2c63a4-0x0;var _0x210eb8=_0xcaf2[_0x2c63a4];return _0x210eb8;};'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'](),timeout(_0x2caf('0x10')),controller[_0x2caf('0x11')]);router[_0x2caf('0x12')]('/',auth[_0x2caf('0x8')](),controller[_0x2caf('0x13')]);router[_0x2caf('0x12')](_0x2caf('0x14'),auth[_0x2caf('0x8')](),controller['clone']);router[_0x2caf('0x15')](_0x2caf('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x2caf('0x9'),auth['isAuthenticated'](),controller[_0x2caf('0x16')]);module[_0x2caf('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 9699476..5c22549 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 _0x1687=['setDataValue','formData','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','description','BOOLEAN','lodash','exports','name','STRING','TEXT','long','isObjectLike'];(function(_0x5cbb28,_0x1674dc){var _0x2cf0ac=function(_0x3ac235){while(--_0x3ac235){_0x5cbb28['push'](_0x5cbb28['shift']());}};_0x2cf0ac(++_0x1674dc);}(_0x1687,0x191));var _0x7168=function(_0x302b62,_0x3ac099){_0x302b62=_0x302b62-0x0;var _0x241a97=_0x1687[_0x302b62];return _0x241a97;};'use strict';var Sequelize=require('sequelize');var _=require(_0x7168('0x0'));var util=require('util');module[_0x7168('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7168('0x2')},'description':{'type':Sequelize[_0x7168('0x3')]},'formData':{'type':Sequelize[_0x7168('0x4')](_0x7168('0x5')),'set':function(_0xe75d1a){if(_[_0x7168('0x6')](_0xe75d1a)){this[_0x7168('0x7')]('formData',JSON['stringify'](_0xe75d1a));}else if(_['isString'](_0xe75d1a)){this[_0x7168('0x7')](_0x7168('0x8'),_0xe75d1a);}else{this['setDataValue'](_0x7168('0x8'),util['format'](_0x7168('0x9'),this['getDataValue']('name')||'',this['getDataValue'](_0x7168('0xa'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x7168('0xb')],'defaultValue':![]}}; \ No newline at end of file +var _0xabaf=['lodash','util','exports','STRING','long','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','description','BOOLEAN','sequelize'];(function(_0x20076e,_0x38ac65){var _0x21b9a3=function(_0x47eaa0){while(--_0x47eaa0){_0x20076e['push'](_0x20076e['shift']());}};_0x21b9a3(++_0x38ac65);}(_0xabaf,0x1bf));var _0xfaba=function(_0x11e84b,_0x3a6bc7){_0x11e84b=_0x11e84b-0x0;var _0x5e64c6=_0xabaf[_0x11e84b];return _0x5e64c6;};'use strict';var Sequelize=require(_0xfaba('0x0'));var _=require(_0xfaba('0x1'));var util=require(_0xfaba('0x2'));module[_0xfaba('0x3')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xfaba('0x4')]},'formData':{'type':Sequelize['TEXT'](_0xfaba('0x5')),'set':function(_0xf6c4d0){if(_['isObjectLike'](_0xf6c4d0)){this[_0xfaba('0x6')](_0xfaba('0x7'),JSON[_0xfaba('0x8')](_0xf6c4d0));}else if(_[_0xfaba('0x9')](_0xf6c4d0)){this['setDataValue'](_0xfaba('0x7'),_0xf6c4d0);}else{this['setDataValue'](_0xfaba('0x7'),util[_0xfaba('0xa')](_0xfaba('0xb'),this[_0xfaba('0xc')](_0xfaba('0xd'))||'',this[_0xfaba('0xc')](_0xfaba('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xfaba('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 61da4ac..d88f252 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 _0xc5b1=['UserProfileSection','userProfileId','getSessions','findOne','JscriptySessionReport','getAnswers','pick','JscriptyAnswerReport','apply','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','download','html-pdf','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','Content-Range','reject','save','update','then','destroy','get','Projects','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','JscriptyProject','count','includeAll','include','findAll','rows','catch','params','intersection','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt'];(function(_0x2b00f4,_0x6af6a5){var _0x5087fb=function(_0x34c65b){while(--_0x34c65b){_0x2b00f4['push'](_0x2b00f4['shift']());}};_0x5087fb(++_0x6af6a5);}(_0xc5b1,0x11b));var _0x1c5b=function(_0x118306,_0x6cd292){_0x118306=_0x118306-0x0;var _0x53a9cc=_0xc5b1[_0x118306];return _0x53a9cc;};'use strict';var pdf=require(_0x1c5b('0x0'));var emlformat=require(_0x1c5b('0x1'));var rimraf=require(_0x1c5b('0x2'));var zipdir=require(_0x1c5b('0x3'));var jsonpatch=require(_0x1c5b('0x4'));var rp=require(_0x1c5b('0x5'));var moment=require(_0x1c5b('0x6'));var BPromise=require(_0x1c5b('0x7'));var Mustache=require(_0x1c5b('0x8'));var util=require(_0x1c5b('0x9'));var path=require('path');var sox=require(_0x1c5b('0xa'));var csv=require(_0x1c5b('0xb'));var ejs=require(_0x1c5b('0xc'));var fs=require('fs');var fs_extra=require(_0x1c5b('0xd'));var _=require(_0x1c5b('0xe'));var squel=require(_0x1c5b('0xf'));var crypto=require(_0x1c5b('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x1c5b('0x11'));var toCsv=require('to-csv');var querystring=require(_0x1c5b('0x12'));var Papa=require(_0x1c5b('0x13'));var Redis=require(_0x1c5b('0x14'));var authService=require(_0x1c5b('0x15'));var qs=require(_0x1c5b('0x16'));var as=require(_0x1c5b('0x17'));var hardwareService=require(_0x1c5b('0x18'));var logger=require(_0x1c5b('0x19'))(_0x1c5b('0x1a'));var utils=require(_0x1c5b('0x1b'));var config=require(_0x1c5b('0x1c'));var licenseUtil=require(_0x1c5b('0x1d'));var db=require(_0x1c5b('0x1e'))['db'];function respondWithStatusCode(_0xcb25d3,_0x5e2a41){_0x5e2a41=_0x5e2a41||0xcc;return function(_0xdf47c){if(_0xdf47c){return _0xcb25d3[_0x1c5b('0x1f')](_0x5e2a41);}return _0xcb25d3[_0x1c5b('0x20')](_0x5e2a41)['end']();};}function respondWithResult(_0x43677b,_0x14a532){_0x14a532=_0x14a532||0xc8;return function(_0x1be5fc){if(_0x1be5fc){return _0x43677b[_0x1c5b('0x20')](_0x14a532)[_0x1c5b('0x21')](_0x1be5fc);}};}function respondWithFilteredResult(_0x3c0e75,_0x237b12){return function(_0x2b3841){if(_0x2b3841){var _0x4cf554=_0x2b3841['count'],_0x454f82=_0x237b12[_0x1c5b('0x22')],_0x3d1262=_0x237b12[_0x1c5b('0x22')]+_0x237b12[_0x1c5b('0x23')],_0x4def80;if(_0x3d1262>=_0x4cf554){_0x3d1262=_0x4cf554;_0x4def80=0xc8;}else{_0x4def80=0xce;}_0x3c0e75[_0x1c5b('0x20')](_0x4def80);return _0x3c0e75['set'](_0x1c5b('0x24'),_0x454f82+'-'+_0x3d1262+'/'+_0x4cf554)[_0x1c5b('0x21')](_0x2b3841);}return null;};}function patchUpdates(_0x5a5e51){return function(_0x1609de){try{jsonpatch['apply'](_0x1609de,_0x5a5e51,!![]);}catch(_0x7640b9){return BPromise[_0x1c5b('0x25')](_0x7640b9);}return _0x1609de[_0x1c5b('0x26')]();};}function saveUpdates(_0x1c0cba,_0x5cc52b){return function(_0x2bc0c1){if(_0x2bc0c1){return _0x2bc0c1[_0x1c5b('0x27')](_0x1c0cba)[_0x1c5b('0x28')](function(_0x27bfaa){return _0x27bfaa;});}return null;};}function removeEntity(_0x4337c1,_0x3ca7c2){return function(_0x5d8a81){if(_0x5d8a81){return _0x5d8a81[_0x1c5b('0x29')]()[_0x1c5b('0x28')](function(){var _0x39d608=_0x5d8a81[_0x1c5b('0x2a')]({'plain':!![]});var _0x53f819=_0x1c5b('0x2b');return db['UserProfileResource'][_0x1c5b('0x29')]({'where':{'type':_0x53f819,'resourceId':_0x39d608['id']}})[_0x1c5b('0x28')](function(){return _0x5d8a81;});})[_0x1c5b('0x28')](function(){_0x4337c1[_0x1c5b('0x20')](0xcc)[_0x1c5b('0x2c')]();});}};}function handleEntityNotFound(_0x276def,_0x287200){return function(_0x49c585){if(!_0x49c585){_0x276def[_0x1c5b('0x1f')](0x194);}return _0x49c585;};}function handleError(_0x4f3cc8,_0x2caa01){_0x2caa01=_0x2caa01||0x1f4;return function(_0xed4bcf){logger[_0x1c5b('0x2d')](_0xed4bcf[_0x1c5b('0x2e')]);if(_0xed4bcf[_0x1c5b('0x2f')]){delete _0xed4bcf[_0x1c5b('0x2f')];}_0x4f3cc8['status'](_0x2caa01)['send'](_0xed4bcf);};}exports[_0x1c5b('0x30')]=function(_0x46b457,_0x5b43c6){var _0x10a77c={},_0x15a0e7={},_0x193bcd={'count':0x0,'rows':[]};var _0x57084c=_[_0x1c5b('0x31')](db['JscriptyProject'][_0x1c5b('0x32')],function(_0x5d1bd3){return{'name':_0x5d1bd3[_0x1c5b('0x33')],'type':_0x5d1bd3[_0x1c5b('0x34')][_0x1c5b('0x35')]};});_0x15a0e7[_0x1c5b('0x36')]=_['map'](_0x57084c,_0x1c5b('0x2f'));_0x15a0e7[_0x1c5b('0x37')]=_[_0x1c5b('0x38')](_0x46b457[_0x1c5b('0x37')]);_0x15a0e7['filters']=_['intersection'](_0x15a0e7[_0x1c5b('0x36')],_0x15a0e7[_0x1c5b('0x37')]);_0x10a77c[_0x1c5b('0x39')]=_['intersection'](_0x15a0e7[_0x1c5b('0x36')],qs[_0x1c5b('0x3a')](_0x46b457[_0x1c5b('0x37')][_0x1c5b('0x3a')]));_0x10a77c[_0x1c5b('0x39')]=_0x10a77c[_0x1c5b('0x39')][_0x1c5b('0x3b')]?_0x10a77c[_0x1c5b('0x39')]:_0x15a0e7[_0x1c5b('0x36')];if(!_0x46b457['query'][_0x1c5b('0x3c')](_0x1c5b('0x3d'))){_0x10a77c[_0x1c5b('0x23')]=qs['limit'](_0x46b457[_0x1c5b('0x37')]['limit']);_0x10a77c[_0x1c5b('0x22')]=qs[_0x1c5b('0x22')](_0x46b457[_0x1c5b('0x37')][_0x1c5b('0x22')]);}_0x10a77c[_0x1c5b('0x3e')]=qs[_0x1c5b('0x3f')](_0x46b457['query'][_0x1c5b('0x3f')]);_0x10a77c[_0x1c5b('0x40')]=qs[_0x1c5b('0x41')](_['pick'](_0x46b457[_0x1c5b('0x37')],_0x15a0e7[_0x1c5b('0x41')]),_0x57084c);if(_0x46b457['query']['filter']){_0x10a77c[_0x1c5b('0x40')]=_[_0x1c5b('0x42')](_0x10a77c[_0x1c5b('0x40')],{'$or':_[_0x1c5b('0x31')](_0x57084c,function(_0x3d7f74){if(_0x3d7f74['type']!==_0x1c5b('0x43')){var _0x3b7e0e={};_0x3b7e0e[_0x3d7f74[_0x1c5b('0x2f')]]={'$like':'%'+_0x46b457[_0x1c5b('0x37')][_0x1c5b('0x44')]+'%'};return _0x3b7e0e;}})});}_0x10a77c=_[_0x1c5b('0x42')]({},_0x10a77c,_0x46b457[_0x1c5b('0x45')]);var _0x1c08f0={'where':_0x10a77c[_0x1c5b('0x40')]};return db[_0x1c5b('0x46')]['count'](_0x1c08f0)[_0x1c5b('0x28')](function(_0x67efb1){_0x193bcd[_0x1c5b('0x47')]=_0x67efb1;if(_0x46b457[_0x1c5b('0x37')][_0x1c5b('0x48')]){_0x10a77c[_0x1c5b('0x49')]=[{'all':!![]}];}return db[_0x1c5b('0x46')][_0x1c5b('0x4a')](_0x10a77c);})[_0x1c5b('0x28')](function(_0x2d6762){_0x193bcd[_0x1c5b('0x4b')]=_0x2d6762;return _0x193bcd;})[_0x1c5b('0x28')](respondWithFilteredResult(_0x5b43c6,_0x10a77c))[_0x1c5b('0x4c')](handleError(_0x5b43c6,null));};exports['show']=function(_0x4d2aec,_0xae11d5){var _0x3c06c4={'raw':![],'where':{'id':_0x4d2aec[_0x1c5b('0x4d')]['id']}},_0x397cb0={};_0x397cb0['model']=_[_0x1c5b('0x38')](db[_0x1c5b('0x46')][_0x1c5b('0x32')]);_0x397cb0[_0x1c5b('0x37')]=_[_0x1c5b('0x38')](_0x4d2aec[_0x1c5b('0x37')]);_0x397cb0[_0x1c5b('0x41')]=_[_0x1c5b('0x4e')](_0x397cb0[_0x1c5b('0x36')],_0x397cb0['query']);_0x3c06c4[_0x1c5b('0x39')]=_['intersection'](_0x397cb0[_0x1c5b('0x36')],qs[_0x1c5b('0x3a')](_0x4d2aec['query']['fields']));_0x3c06c4['attributes']=_0x3c06c4[_0x1c5b('0x39')][_0x1c5b('0x3b')]?_0x3c06c4[_0x1c5b('0x39')]:_0x397cb0[_0x1c5b('0x36')];if(_0x4d2aec[_0x1c5b('0x37')]['includeAll']){_0x3c06c4[_0x1c5b('0x49')]=[{'all':!![]}];}_0x3c06c4=_['merge']({},_0x3c06c4,_0x4d2aec[_0x1c5b('0x45')]);return db[_0x1c5b('0x46')]['find'](_0x3c06c4)[_0x1c5b('0x28')](handleEntityNotFound(_0xae11d5,null))[_0x1c5b('0x28')](respondWithResult(_0xae11d5,null))['catch'](handleError(_0xae11d5,null));};exports[_0x1c5b('0x4f')]=function(_0x2451a0,_0x25d7d9){return db[_0x1c5b('0x46')][_0x1c5b('0x4f')](_0x2451a0[_0x1c5b('0x50')],{})['then'](function(_0x59e98f){var _0x419d99=_0x2451a0[_0x1c5b('0x51')][_0x1c5b('0x2a')]({'plain':!![]});if(!_0x419d99)throw new Error(_0x1c5b('0x52'));if(_0x419d99[_0x1c5b('0x53')]==='user'){var _0x5cb511=_0x59e98f[_0x1c5b('0x2a')]({'plain':!![]});var _0x2fb59d=_0x1c5b('0x2b');return db['UserProfileSection'][_0x1c5b('0x54')]({'where':{'name':_0x2fb59d,'userProfileId':_0x419d99['userProfileId']},'raw':!![]})[_0x1c5b('0x28')](function(_0x18f1c8){if(_0x18f1c8&&_0x18f1c8[_0x1c5b('0x55')]===0x0){return db[_0x1c5b('0x56')][_0x1c5b('0x4f')]({'name':_0x5cb511[_0x1c5b('0x2f')],'resourceId':_0x5cb511['id'],'type':_0x18f1c8[_0x1c5b('0x2f')],'sectionId':_0x18f1c8['id']},{})[_0x1c5b('0x28')](function(){return _0x59e98f;});}else{return _0x59e98f;}})['catch'](function(_0x5c18ac){logger[_0x1c5b('0x2d')](_0x1c5b('0x57'),_0x5c18ac);throw _0x5c18ac;});}return _0x59e98f;})[_0x1c5b('0x28')](respondWithResult(_0x25d7d9,0xc9))[_0x1c5b('0x4c')](handleError(_0x25d7d9,null));};exports[_0x1c5b('0x58')]=function(_0x47b360,_0x2d379c){var _0x19515b={'where':{'id':_0x47b360[_0x1c5b('0x4d')]['id']}},_0x281cb2={};_0x281cb2[_0x1c5b('0x36')]=_[_0x1c5b('0x38')](db[_0x1c5b('0x46')]['rawAttributes']);_0x19515b[_0x1c5b('0x39')]=_['intersection'](_0x281cb2[_0x1c5b('0x36')],qs[_0x1c5b('0x3a')](_0x47b360[_0x1c5b('0x37')]['fields']));_0x19515b[_0x1c5b('0x39')]=_0x19515b[_0x1c5b('0x39')][_0x1c5b('0x3b')]?_0x19515b[_0x1c5b('0x39')]:_0x281cb2['model'];if(_0x47b360['query'][_0x1c5b('0x48')]){_0x19515b['include']=[{'all':!![]}];}_0x19515b=_[_0x1c5b('0x42')]({},_0x19515b,_0x47b360[_0x1c5b('0x45')]);return db['JscriptyProject']['find'](_0x19515b)[_0x1c5b('0x28')](handleEntityNotFound(_0x2d379c,null))[_0x1c5b('0x28')](function(_0x2c59a6){if(_0x2c59a6){var _0x11ccd2=_0x2c59a6[_0x1c5b('0x2a')]({'plain':!![]});_0x11ccd2=qs[_0x1c5b('0x59')](_0x11ccd2,['id',_0x1c5b('0x5a'),_0x1c5b('0x5b')]);_0x47b360['body']=_['omit'](_0x47b360[_0x1c5b('0x50')],['id',_0x1c5b('0x5a'),'updatedAt']);return db[_0x1c5b('0x46')]['create'](_[_0x1c5b('0x42')](_0x11ccd2,_0x47b360[_0x1c5b('0x50')]),{'include':_0x47b360[_0x1c5b('0x37')]['includeAll']?[{'all':!![]}]:undefined})[_0x1c5b('0x28')](function(_0x18584a){var _0x52e010=_0x47b360['user']['get']({'plain':!![]});if(!_0x52e010)throw new Error(_0x1c5b('0x52'));if(_0x52e010[_0x1c5b('0x53')]==='user'){var _0x2ba96d=_0x18584a[_0x1c5b('0x2a')]({'plain':!![]});var _0x527c71='Projects';return db[_0x1c5b('0x5c')]['find']({'where':{'name':_0x527c71,'userProfileId':_0x52e010[_0x1c5b('0x5d')]},'raw':!![]})[_0x1c5b('0x28')](function(_0x272111){if(_0x272111&&_0x272111['autoAssociation']===0x0){return db[_0x1c5b('0x56')][_0x1c5b('0x4f')]({'name':_0x2ba96d[_0x1c5b('0x2f')],'resourceId':_0x2ba96d['id'],'type':_0x272111[_0x1c5b('0x2f')],'sectionId':_0x272111['id']},{})[_0x1c5b('0x28')](function(){return _0x18584a;});}else{return _0x18584a;}})['catch'](function(_0x1558ac){logger[_0x1c5b('0x2d')](_0x1c5b('0x57'),_0x1558ac);throw _0x1558ac;});}return _0x18584a;});}})[_0x1c5b('0x28')](respondWithResult(_0x2d379c,0xc9))[_0x1c5b('0x4c')](handleError(_0x2d379c,null));};exports[_0x1c5b('0x27')]=function(_0x26ba60,_0x3d040d){if(_0x26ba60[_0x1c5b('0x50')]['id']){delete _0x26ba60[_0x1c5b('0x50')]['id'];}return db[_0x1c5b('0x46')][_0x1c5b('0x54')]({'where':{'id':_0x26ba60[_0x1c5b('0x4d')]['id']}})[_0x1c5b('0x28')](handleEntityNotFound(_0x3d040d,null))[_0x1c5b('0x28')](saveUpdates(_0x26ba60[_0x1c5b('0x50')],null))[_0x1c5b('0x28')](respondWithResult(_0x3d040d,null))['catch'](handleError(_0x3d040d,null));};exports['destroy']=function(_0x49da57,_0x4fcc91){return db[_0x1c5b('0x46')][_0x1c5b('0x54')]({'where':{'id':_0x49da57[_0x1c5b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4fcc91,null))[_0x1c5b('0x28')](removeEntity(_0x4fcc91,null))[_0x1c5b('0x4c')](handleError(_0x4fcc91,null));};exports[_0x1c5b('0x5e')]=function(_0x246cae,_0x5f1012,_0x2cd816){var _0x40486b={'raw':!![],'where':{}};var _0x586712={};var _0x596ce7={'count':0x0,'rows':[]};return db[_0x1c5b('0x46')][_0x1c5b('0x5f')]({'where':{'id':_0x246cae['params']['id']}})[_0x1c5b('0x28')](handleEntityNotFound(_0x5f1012,null))[_0x1c5b('0x28')](function(_0x7beb17){if(_0x7beb17){_0x586712[_0x1c5b('0x36')]=_[_0x1c5b('0x38')](db[_0x1c5b('0x60')][_0x1c5b('0x32')]);_0x586712['query']=_[_0x1c5b('0x38')](_0x246cae[_0x1c5b('0x37')]);_0x586712['filters']=_[_0x1c5b('0x4e')](_0x586712['model'],_0x586712[_0x1c5b('0x37')]);_0x40486b[_0x1c5b('0x39')]=_[_0x1c5b('0x4e')](_0x586712[_0x1c5b('0x36')],qs[_0x1c5b('0x3a')](_0x246cae[_0x1c5b('0x37')][_0x1c5b('0x3a')]));_0x40486b[_0x1c5b('0x39')]=_0x40486b['attributes'][_0x1c5b('0x3b')]?_0x40486b[_0x1c5b('0x39')]:_0x586712[_0x1c5b('0x36')];if(!_0x246cae[_0x1c5b('0x37')]['hasOwnProperty'](_0x1c5b('0x3d'))){_0x40486b[_0x1c5b('0x23')]=qs[_0x1c5b('0x23')](_0x246cae[_0x1c5b('0x37')][_0x1c5b('0x23')]);_0x40486b['offset']=qs[_0x1c5b('0x22')](_0x246cae[_0x1c5b('0x37')][_0x1c5b('0x22')]);}_0x40486b[_0x1c5b('0x3e')]=qs['sort'](_0x246cae[_0x1c5b('0x37')][_0x1c5b('0x3f')]);_0x40486b[_0x1c5b('0x40')]=qs[_0x1c5b('0x41')](_['pick'](_0x246cae[_0x1c5b('0x37')],_0x586712[_0x1c5b('0x41')]));_0x40486b[_0x1c5b('0x40')]['ProjectId']=_0x7beb17['id'];if(_0x246cae[_0x1c5b('0x37')][_0x1c5b('0x44')]){_0x40486b['where']=_['merge'](_0x40486b[_0x1c5b('0x40')],{'$or':_[_0x1c5b('0x31')](_0x40486b[_0x1c5b('0x39')],function(_0x4064d3){var _0x527d2b={};_0x527d2b[_0x4064d3]={'$like':'%'+_0x246cae[_0x1c5b('0x37')][_0x1c5b('0x44')]+'%'};return _0x527d2b;})});}_0x40486b=_['merge']({},_0x40486b,_0x246cae[_0x1c5b('0x45')]);return db[_0x1c5b('0x60')]['count']({'where':_0x40486b[_0x1c5b('0x40')]})['then'](function(_0x5d2195){_0x596ce7[_0x1c5b('0x47')]=_0x5d2195;if(_0x246cae['query'][_0x1c5b('0x48')]){_0x40486b[_0x1c5b('0x49')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x40486b);})[_0x1c5b('0x28')](function(_0x2f3c6e){_0x596ce7[_0x1c5b('0x4b')]=_0x2f3c6e;return _0x596ce7;});}})[_0x1c5b('0x28')](respondWithFilteredResult(_0x5f1012,_0x40486b))[_0x1c5b('0x4c')](handleError(_0x5f1012,null));};exports[_0x1c5b('0x61')]=function(_0x3015b9,_0x37f856,_0x15db15){var _0x281fe4={'raw':!![],'where':{}};var _0x46277a={};var _0x1540eb={'count':0x0,'rows':[]};return db[_0x1c5b('0x46')][_0x1c5b('0x5f')]({'where':{'id':_0x3015b9[_0x1c5b('0x4d')]['id']}})[_0x1c5b('0x28')](handleEntityNotFound(_0x37f856,null))[_0x1c5b('0x28')](function(_0xe0a47a){if(_0xe0a47a){_0x46277a[_0x1c5b('0x36')]=_[_0x1c5b('0x38')](db['JscriptyAnswerReport']['rawAttributes']);_0x46277a[_0x1c5b('0x37')]=_[_0x1c5b('0x38')](_0x3015b9[_0x1c5b('0x37')]);_0x46277a['filters']=_[_0x1c5b('0x4e')](_0x46277a['model'],_0x46277a[_0x1c5b('0x37')]);_0x281fe4[_0x1c5b('0x39')]=_[_0x1c5b('0x4e')](_0x46277a['model'],qs[_0x1c5b('0x3a')](_0x3015b9[_0x1c5b('0x37')]['fields']));_0x281fe4[_0x1c5b('0x39')]=_0x281fe4[_0x1c5b('0x39')][_0x1c5b('0x3b')]?_0x281fe4[_0x1c5b('0x39')]:_0x46277a[_0x1c5b('0x36')];if(!_0x3015b9['query'][_0x1c5b('0x3c')](_0x1c5b('0x3d'))){_0x281fe4[_0x1c5b('0x23')]=qs[_0x1c5b('0x23')](_0x3015b9[_0x1c5b('0x37')][_0x1c5b('0x23')]);_0x281fe4[_0x1c5b('0x22')]=qs[_0x1c5b('0x22')](_0x3015b9['query'][_0x1c5b('0x22')]);}_0x281fe4[_0x1c5b('0x3e')]=qs[_0x1c5b('0x3f')](_0x3015b9['query'][_0x1c5b('0x3f')]);_0x281fe4['where']=qs['filters'](_[_0x1c5b('0x62')](_0x3015b9[_0x1c5b('0x37')],_0x46277a[_0x1c5b('0x41')]));_0x281fe4['where']['ProjectId']=_0xe0a47a['id'];if(_0x3015b9[_0x1c5b('0x37')][_0x1c5b('0x44')]){_0x281fe4['where']=_[_0x1c5b('0x42')](_0x281fe4[_0x1c5b('0x40')],{'$or':_[_0x1c5b('0x31')](_0x281fe4[_0x1c5b('0x39')],function(_0x2d57ce){var _0x3e7172={};_0x3e7172[_0x2d57ce]={'$like':'%'+_0x3015b9[_0x1c5b('0x37')]['filter']+'%'};return _0x3e7172;})});}_0x281fe4=_[_0x1c5b('0x42')]({},_0x281fe4,_0x3015b9[_0x1c5b('0x45')]);return db[_0x1c5b('0x63')]['count']({'where':_0x281fe4[_0x1c5b('0x40')]})[_0x1c5b('0x28')](function(_0x4375ee){_0x1540eb[_0x1c5b('0x47')]=_0x4375ee;if(_0x3015b9['query'][_0x1c5b('0x48')]){_0x281fe4[_0x1c5b('0x49')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x1c5b('0x4a')](_0x281fe4);})[_0x1c5b('0x28')](function(_0x345fcc){_0x1540eb[_0x1c5b('0x4b')]=_0x345fcc;return _0x1540eb;});}})['then'](respondWithFilteredResult(_0x37f856,_0x281fe4))[_0x1c5b('0x4c')](handleError(_0x37f856,null));};function char(_0x219407){return'number'===typeof _0x219407?String['fromCharCode'][_0x1c5b('0x64')](null,arguments):_0x219407;}function needsEncapsulation(_0x58931e){return!!_0x58931e&&(_0x58931e[_0x1c5b('0x65')]()[_0x1c5b('0x66')](char(0xd))>=0x0||_0x58931e[_0x1c5b('0x65')]()['indexOf'](char(0xa))>=0x0||_0x58931e['toString']()['indexOf'](char(0x2c))>=0x0||_0x58931e[_0x1c5b('0x65')]()[_0x1c5b('0x66')](char(0x22))>=0x0);}function encapsulate(_0x38cbe3){var _0x145b2a=char(0x22),_0x475fcb='\x5c'+char(0x22),_0x365243=_0x38cbe3[_0x1c5b('0x65')]()[_0x1c5b('0x67')](new RegExp(_0x145b2a,'g'),_0x475fcb);return _0x145b2a+_0x365243+_0x145b2a;}exports[_0x1c5b('0x68')]=function(_0x1065f5,_0x2f0a0c,_0x6a4193){var _0x5e1e85,_0x3aced0;var _0x773fef={'where':{'ProjectId':_0x1065f5[_0x1c5b('0x4d')]['id']}};if(_0x1065f5[_0x1c5b('0x37')][_0x1c5b('0x69')]){_0x773fef[_0x1c5b('0x40')][_0x1c5b('0x6a')]=JSON[_0x1c5b('0x6b')](_0x1065f5[_0x1c5b('0x37')][_0x1c5b('0x69')]);}return db[_0x1c5b('0x60')][_0x1c5b('0x4a')](_0x773fef)[_0x1c5b('0x28')](handleEntityNotFound(_0x2f0a0c,null))[_0x1c5b('0x28')](function(_0x1db456){if(_0x1db456){_0x5e1e85=_0x1db456;return db[_0x1c5b('0x6c')]['findAll']({'where':{'SessionId':{'$in':_[_0x1c5b('0x31')](_0x5e1e85,'id')},'ProjectId':_0x1065f5[_0x1c5b('0x4d')]['id']},'order':_0x1c5b('0x6d')});}})[_0x1c5b('0x28')](handleEntityNotFound(_0x2f0a0c,null))['then'](function(_0x193919){if(_0x193919){_0x3aced0=_0x193919;var _0x165d00={};for(var _0x3c83e9=0x0,_0x13b475=_0x3aced0['length'];_0x3c83e9<_0x13b475;_0x3c83e9++){if(!_0x165d00[_0x1c5b('0x3c')](_0x3aced0[_0x3c83e9][_0x1c5b('0x6e')])){_0x165d00[_0x3aced0[_0x3c83e9]['questionId']]=needsEncapsulation(_0x3aced0[_0x3c83e9][_0x1c5b('0x6f')])?encapsulate(_0x3aced0[_0x3c83e9][_0x1c5b('0x6f')]):_0x3aced0[_0x3c83e9]['question'];}}var _0x3fe677=[],_0x494467={};for(var _0x5edc50=0x0,_0x14ac26=_0x5e1e85[_0x1c5b('0x3b')];_0x5edc50<_0x14ac26;_0x5edc50++){_0x494467={'ProjectId':_0x1065f5[_0x1c5b('0x4d')]['id'],'SessionId':_0x5e1e85[_0x5edc50]['id'],'StartTime':moment(_0x5e1e85[_0x5edc50]['starttime'])[_0x1c5b('0x70')](_0x1c5b('0x71'))};for(var _0x31ab6f=0x0,_0x842090=_0x3aced0[_0x1c5b('0x3b')];_0x31ab6f<_0x842090;_0x31ab6f++){if(_0x3aced0[_0x31ab6f][_0x1c5b('0x72')]==_0x5e1e85[_0x5edc50]['id']&&_0x165d00[_0x1c5b('0x3c')](_0x3aced0[_0x31ab6f][_0x1c5b('0x6e')])){_0x494467[_0x165d00[_0x3aced0[_0x31ab6f]['questionId']]]=_0x3aced0[_0x31ab6f][_0x1c5b('0x73')];}}for(var _0x55f520 in _0x165d00){if(!_0x494467[_0x1c5b('0x3c')](_0x165d00[_0x55f520])){_0x494467[_0x165d00[_0x55f520]]=null;}}_0x3fe677[_0x1c5b('0x74')](_0x494467);}return _0x3fe677;}})['then'](function(_0x4f5964){if(!_[_0x1c5b('0x75')](_0x4f5964)){var _0x4eabaf=toCsv(_0x4f5964);var _0x2727cc=Date['now']();fs[_0x1c5b('0x76')](util['format'](_0x1c5b('0x77'),_0x1065f5[_0x1c5b('0x4d')]['id'],_0x2727cc),_0x4eabaf);_0x2f0a0c[_0x1c5b('0x78')](_0x1c5b('0x79'),_0x1c5b('0x7a')+util[_0x1c5b('0x70')](_0x1c5b('0x7b'),_0x1065f5[_0x1c5b('0x4d')]['id'],_0x2727cc));_0x2f0a0c[_0x1c5b('0x78')]('Content-type','text/csv');return _0x2f0a0c[_0x1c5b('0x7c')](util[_0x1c5b('0x70')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1065f5[_0x1c5b('0x4d')]['id'],_0x2727cc));}else{return _0x2f0a0c[_0x1c5b('0x1f')](0xcc);}})[_0x1c5b('0x4c')](handleError(_0x2f0a0c,null));}; \ No newline at end of file +var _0x1d05=['isEmpty','now','writeFileSync','format','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/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','count','offset','limit','set','Content-Range','save','update','then','destroy','UserProfileResource','error','name','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','JscriptyProject','include','findAll','rows','show','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Projects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','length','includeAll','merge','omit','createdAt','updatedAt','findOne','JscriptySessionReport','pick','ProjectId','getAnswers','JscriptyAnswerReport','fromCharCode','indexOf','toString','replace','getSummary','startTime','starttime','parse','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer'];(function(_0x50ea5e,_0x3640ce){var _0x5eb4d9=function(_0x397d73){while(--_0x397d73){_0x50ea5e['push'](_0x50ea5e['shift']());}};_0x5eb4d9(++_0x3640ce);}(_0x1d05,0x1ee));var _0x51d0=function(_0x63c2db,_0xf82d39){_0x63c2db=_0x63c2db-0x0;var _0x5f304f=_0x1d05[_0x63c2db];return _0x5f304f;};'use strict';var pdf=require(_0x51d0('0x0'));var emlformat=require(_0x51d0('0x1'));var rimraf=require(_0x51d0('0x2'));var zipdir=require(_0x51d0('0x3'));var jsonpatch=require(_0x51d0('0x4'));var rp=require(_0x51d0('0x5'));var moment=require(_0x51d0('0x6'));var BPromise=require(_0x51d0('0x7'));var Mustache=require(_0x51d0('0x8'));var util=require(_0x51d0('0x9'));var path=require(_0x51d0('0xa'));var sox=require(_0x51d0('0xb'));var csv=require(_0x51d0('0xc'));var ejs=require(_0x51d0('0xd'));var fs=require('fs');var fs_extra=require(_0x51d0('0xe'));var _=require('lodash');var squel=require(_0x51d0('0xf'));var crypto=require(_0x51d0('0x10'));var jsforce=require(_0x51d0('0x11'));var deskjs=require(_0x51d0('0x12'));var toCsv=require(_0x51d0('0xc'));var querystring=require(_0x51d0('0x13'));var Papa=require(_0x51d0('0x14'));var Redis=require(_0x51d0('0x15'));var authService=require(_0x51d0('0x16'));var qs=require(_0x51d0('0x17'));var as=require(_0x51d0('0x18'));var hardwareService=require(_0x51d0('0x19'));var logger=require(_0x51d0('0x1a'))('api');var utils=require(_0x51d0('0x1b'));var config=require(_0x51d0('0x1c'));var licenseUtil=require(_0x51d0('0x1d'));var db=require(_0x51d0('0x1e'))['db'];function respondWithStatusCode(_0xc24ec3,_0x3e8c5e){_0x3e8c5e=_0x3e8c5e||0xcc;return function(_0x260f0d){if(_0x260f0d){return _0xc24ec3[_0x51d0('0x1f')](_0x3e8c5e);}return _0xc24ec3[_0x51d0('0x20')](_0x3e8c5e)[_0x51d0('0x21')]();};}function respondWithResult(_0xff8509,_0x56daff){_0x56daff=_0x56daff||0xc8;return function(_0x686fc9){if(_0x686fc9){return _0xff8509[_0x51d0('0x20')](_0x56daff)[_0x51d0('0x22')](_0x686fc9);}};}function respondWithFilteredResult(_0x267b01,_0x5e19f4){return function(_0x142428){if(_0x142428){var _0x53ce37=_0x142428[_0x51d0('0x23')],_0x1885ac=_0x5e19f4[_0x51d0('0x24')],_0x278973=_0x5e19f4['offset']+_0x5e19f4[_0x51d0('0x25')],_0x2f4002;if(_0x278973>=_0x53ce37){_0x278973=_0x53ce37;_0x2f4002=0xc8;}else{_0x2f4002=0xce;}_0x267b01[_0x51d0('0x20')](_0x2f4002);return _0x267b01[_0x51d0('0x26')](_0x51d0('0x27'),_0x1885ac+'-'+_0x278973+'/'+_0x53ce37)[_0x51d0('0x22')](_0x142428);}return null;};}function patchUpdates(_0x1afdcc){return function(_0x4e0137){try{jsonpatch['apply'](_0x4e0137,_0x1afdcc,!![]);}catch(_0x3e9fec){return BPromise['reject'](_0x3e9fec);}return _0x4e0137[_0x51d0('0x28')]();};}function saveUpdates(_0x20db10,_0x458e6c){return function(_0x9b07bc){if(_0x9b07bc){return _0x9b07bc[_0x51d0('0x29')](_0x20db10)[_0x51d0('0x2a')](function(_0x49d9e5){return _0x49d9e5;});}return null;};}function removeEntity(_0x465b83,_0x40480e){return function(_0x28ff45){if(_0x28ff45){return _0x28ff45[_0x51d0('0x2b')]()['then'](function(){var _0x4a1ddc=_0x28ff45['get']({'plain':!![]});var _0x4a1ae5='Projects';return db[_0x51d0('0x2c')][_0x51d0('0x2b')]({'where':{'type':_0x4a1ae5,'resourceId':_0x4a1ddc['id']}})[_0x51d0('0x2a')](function(){return _0x28ff45;});})['then'](function(){_0x465b83['status'](0xcc)[_0x51d0('0x21')]();});}};}function handleEntityNotFound(_0x4cd2d8,_0x24a821){return function(_0x3c989d){if(!_0x3c989d){_0x4cd2d8[_0x51d0('0x1f')](0x194);}return _0x3c989d;};}function handleError(_0x23dd83,_0x523f7a){_0x523f7a=_0x523f7a||0x1f4;return function(_0x4b74be){logger[_0x51d0('0x2d')](_0x4b74be['stack']);if(_0x4b74be[_0x51d0('0x2e')]){delete _0x4b74be['name'];}_0x23dd83[_0x51d0('0x20')](_0x523f7a)['send'](_0x4b74be);};}exports['index']=function(_0x2cef57,_0x16ef27){var _0x2fdf1a={},_0x5717c8={},_0xd549e7={'count':0x0,'rows':[]};var _0x2426f9=_['map'](db['JscriptyProject'][_0x51d0('0x2f')],function(_0x4963b3){return{'name':_0x4963b3[_0x51d0('0x30')],'type':_0x4963b3[_0x51d0('0x31')]['key']};});_0x5717c8[_0x51d0('0x32')]=_[_0x51d0('0x33')](_0x2426f9,_0x51d0('0x2e'));_0x5717c8[_0x51d0('0x34')]=_[_0x51d0('0x35')](_0x2cef57[_0x51d0('0x34')]);_0x5717c8[_0x51d0('0x36')]=_['intersection'](_0x5717c8['model'],_0x5717c8[_0x51d0('0x34')]);_0x2fdf1a[_0x51d0('0x37')]=_[_0x51d0('0x38')](_0x5717c8[_0x51d0('0x32')],qs['fields'](_0x2cef57[_0x51d0('0x34')][_0x51d0('0x39')]));_0x2fdf1a[_0x51d0('0x37')]=_0x2fdf1a[_0x51d0('0x37')]['length']?_0x2fdf1a[_0x51d0('0x37')]:_0x5717c8[_0x51d0('0x32')];if(!_0x2cef57[_0x51d0('0x34')][_0x51d0('0x3a')](_0x51d0('0x3b'))){_0x2fdf1a[_0x51d0('0x25')]=qs[_0x51d0('0x25')](_0x2cef57[_0x51d0('0x34')]['limit']);_0x2fdf1a[_0x51d0('0x24')]=qs[_0x51d0('0x24')](_0x2cef57['query'][_0x51d0('0x24')]);}_0x2fdf1a[_0x51d0('0x3c')]=qs[_0x51d0('0x3d')](_0x2cef57['query'][_0x51d0('0x3d')]);_0x2fdf1a[_0x51d0('0x3e')]=qs[_0x51d0('0x36')](_['pick'](_0x2cef57[_0x51d0('0x34')],_0x5717c8[_0x51d0('0x36')]),_0x2426f9);if(_0x2cef57[_0x51d0('0x34')][_0x51d0('0x3f')]){_0x2fdf1a[_0x51d0('0x3e')]=_['merge'](_0x2fdf1a['where'],{'$or':_['map'](_0x2426f9,function(_0x346888){if(_0x346888[_0x51d0('0x31')]!==_0x51d0('0x40')){var _0x998f04={};_0x998f04[_0x346888[_0x51d0('0x2e')]]={'$like':'%'+_0x2cef57[_0x51d0('0x34')][_0x51d0('0x3f')]+'%'};return _0x998f04;}})});}_0x2fdf1a=_['merge']({},_0x2fdf1a,_0x2cef57[_0x51d0('0x41')]);var _0x17c630={'where':_0x2fdf1a[_0x51d0('0x3e')]};return db[_0x51d0('0x42')][_0x51d0('0x23')](_0x17c630)[_0x51d0('0x2a')](function(_0x1d73d9){_0xd549e7[_0x51d0('0x23')]=_0x1d73d9;if(_0x2cef57[_0x51d0('0x34')]['includeAll']){_0x2fdf1a[_0x51d0('0x43')]=[{'all':!![]}];}return db[_0x51d0('0x42')][_0x51d0('0x44')](_0x2fdf1a);})[_0x51d0('0x2a')](function(_0x19d613){_0xd549e7[_0x51d0('0x45')]=_0x19d613;return _0xd549e7;})[_0x51d0('0x2a')](respondWithFilteredResult(_0x16ef27,_0x2fdf1a))['catch'](handleError(_0x16ef27,null));};exports[_0x51d0('0x46')]=function(_0x2f05ee,_0x10566d){var _0x45dcb4={'raw':![],'where':{'id':_0x2f05ee['params']['id']}},_0x5319f1={};_0x5319f1[_0x51d0('0x32')]=_[_0x51d0('0x35')](db[_0x51d0('0x42')][_0x51d0('0x2f')]);_0x5319f1[_0x51d0('0x34')]=_[_0x51d0('0x35')](_0x2f05ee[_0x51d0('0x34')]);_0x5319f1[_0x51d0('0x36')]=_['intersection'](_0x5319f1[_0x51d0('0x32')],_0x5319f1[_0x51d0('0x34')]);_0x45dcb4[_0x51d0('0x37')]=_[_0x51d0('0x38')](_0x5319f1[_0x51d0('0x32')],qs['fields'](_0x2f05ee[_0x51d0('0x34')]['fields']));_0x45dcb4[_0x51d0('0x37')]=_0x45dcb4[_0x51d0('0x37')]['length']?_0x45dcb4[_0x51d0('0x37')]:_0x5319f1['model'];if(_0x2f05ee[_0x51d0('0x34')]['includeAll']){_0x45dcb4[_0x51d0('0x43')]=[{'all':!![]}];}_0x45dcb4=_['merge']({},_0x45dcb4,_0x2f05ee[_0x51d0('0x41')]);return db[_0x51d0('0x42')][_0x51d0('0x47')](_0x45dcb4)[_0x51d0('0x2a')](handleEntityNotFound(_0x10566d,null))['then'](respondWithResult(_0x10566d,null))[_0x51d0('0x48')](handleError(_0x10566d,null));};exports[_0x51d0('0x49')]=function(_0x2b86f2,_0x36e21a){return db['JscriptyProject'][_0x51d0('0x49')](_0x2b86f2[_0x51d0('0x4a')],{})['then'](function(_0x123aff){var _0x50caf2=_0x2b86f2['user'][_0x51d0('0x4b')]({'plain':!![]});if(!_0x50caf2)throw new Error(_0x51d0('0x4c'));if(_0x50caf2[_0x51d0('0x4d')]===_0x51d0('0x4e')){var _0x364193=_0x123aff[_0x51d0('0x4b')]({'plain':!![]});var _0x37ae97=_0x51d0('0x4f');return db[_0x51d0('0x50')][_0x51d0('0x47')]({'where':{'name':_0x37ae97,'userProfileId':_0x50caf2[_0x51d0('0x51')]},'raw':!![]})['then'](function(_0x152bd2){if(_0x152bd2&&_0x152bd2[_0x51d0('0x52')]===0x0){return db[_0x51d0('0x2c')]['create']({'name':_0x364193[_0x51d0('0x2e')],'resourceId':_0x364193['id'],'type':_0x152bd2[_0x51d0('0x2e')],'sectionId':_0x152bd2['id']},{})[_0x51d0('0x2a')](function(){return _0x123aff;});}else{return _0x123aff;}})[_0x51d0('0x48')](function(_0x4e2e4d){logger[_0x51d0('0x2d')](_0x51d0('0x53'),_0x4e2e4d);throw _0x4e2e4d;});}return _0x123aff;})[_0x51d0('0x2a')](respondWithResult(_0x36e21a,0xc9))[_0x51d0('0x48')](handleError(_0x36e21a,null));};exports['clone']=function(_0x28136f,_0x5c2a80){var _0x148e42={'where':{'id':_0x28136f[_0x51d0('0x54')]['id']}},_0x336ab2={};_0x336ab2[_0x51d0('0x32')]=_[_0x51d0('0x35')](db[_0x51d0('0x42')]['rawAttributes']);_0x148e42['attributes']=_[_0x51d0('0x38')](_0x336ab2[_0x51d0('0x32')],qs[_0x51d0('0x39')](_0x28136f[_0x51d0('0x34')][_0x51d0('0x39')]));_0x148e42[_0x51d0('0x37')]=_0x148e42['attributes'][_0x51d0('0x55')]?_0x148e42[_0x51d0('0x37')]:_0x336ab2[_0x51d0('0x32')];if(_0x28136f[_0x51d0('0x34')][_0x51d0('0x56')]){_0x148e42[_0x51d0('0x43')]=[{'all':!![]}];}_0x148e42=_[_0x51d0('0x57')]({},_0x148e42,_0x28136f[_0x51d0('0x41')]);return db['JscriptyProject'][_0x51d0('0x47')](_0x148e42)[_0x51d0('0x2a')](handleEntityNotFound(_0x5c2a80,null))[_0x51d0('0x2a')](function(_0x48bbe3){if(_0x48bbe3){var _0x415523=_0x48bbe3[_0x51d0('0x4b')]({'plain':!![]});_0x415523=qs[_0x51d0('0x58')](_0x415523,['id',_0x51d0('0x59'),'updatedAt']);_0x28136f[_0x51d0('0x4a')]=_[_0x51d0('0x58')](_0x28136f['body'],['id','createdAt',_0x51d0('0x5a')]);return db[_0x51d0('0x42')][_0x51d0('0x49')](_[_0x51d0('0x57')](_0x415523,_0x28136f[_0x51d0('0x4a')]),{'include':_0x28136f[_0x51d0('0x34')]['includeAll']?[{'all':!![]}]:undefined})[_0x51d0('0x2a')](function(_0x5c8a89){var _0x42af08=_0x28136f[_0x51d0('0x4e')][_0x51d0('0x4b')]({'plain':!![]});if(!_0x42af08)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x42af08[_0x51d0('0x4d')]===_0x51d0('0x4e')){var _0x2b13b4=_0x5c8a89[_0x51d0('0x4b')]({'plain':!![]});var _0x22ea41=_0x51d0('0x4f');return db[_0x51d0('0x50')][_0x51d0('0x47')]({'where':{'name':_0x22ea41,'userProfileId':_0x42af08['userProfileId']},'raw':!![]})[_0x51d0('0x2a')](function(_0x1916c4){if(_0x1916c4&&_0x1916c4['autoAssociation']===0x0){return db[_0x51d0('0x2c')][_0x51d0('0x49')]({'name':_0x2b13b4['name'],'resourceId':_0x2b13b4['id'],'type':_0x1916c4[_0x51d0('0x2e')],'sectionId':_0x1916c4['id']},{})[_0x51d0('0x2a')](function(){return _0x5c8a89;});}else{return _0x5c8a89;}})[_0x51d0('0x48')](function(_0x1b7946){logger[_0x51d0('0x2d')](_0x51d0('0x53'),_0x1b7946);throw _0x1b7946;});}return _0x5c8a89;});}})['then'](respondWithResult(_0x5c2a80,0xc9))[_0x51d0('0x48')](handleError(_0x5c2a80,null));};exports[_0x51d0('0x29')]=function(_0x3df3fb,_0x174967){if(_0x3df3fb[_0x51d0('0x4a')]['id']){delete _0x3df3fb['body']['id'];}return db[_0x51d0('0x42')][_0x51d0('0x47')]({'where':{'id':_0x3df3fb[_0x51d0('0x54')]['id']}})[_0x51d0('0x2a')](handleEntityNotFound(_0x174967,null))[_0x51d0('0x2a')](saveUpdates(_0x3df3fb[_0x51d0('0x4a')],null))['then'](respondWithResult(_0x174967,null))['catch'](handleError(_0x174967,null));};exports[_0x51d0('0x2b')]=function(_0x1f758c,_0x26371c){return db[_0x51d0('0x42')][_0x51d0('0x47')]({'where':{'id':_0x1f758c[_0x51d0('0x54')]['id']}})[_0x51d0('0x2a')](handleEntityNotFound(_0x26371c,null))['then'](removeEntity(_0x26371c,null))['catch'](handleError(_0x26371c,null));};exports['getSessions']=function(_0x29b250,_0x48ee6d,_0x9c4ed2){var _0x43bce6={'raw':!![],'where':{}};var _0x26e38b={};var _0x4442e8={'count':0x0,'rows':[]};return db[_0x51d0('0x42')][_0x51d0('0x5b')]({'where':{'id':_0x29b250[_0x51d0('0x54')]['id']}})['then'](handleEntityNotFound(_0x48ee6d,null))[_0x51d0('0x2a')](function(_0x2acc26){if(_0x2acc26){_0x26e38b['model']=_[_0x51d0('0x35')](db[_0x51d0('0x5c')][_0x51d0('0x2f')]);_0x26e38b[_0x51d0('0x34')]=_[_0x51d0('0x35')](_0x29b250[_0x51d0('0x34')]);_0x26e38b[_0x51d0('0x36')]=_[_0x51d0('0x38')](_0x26e38b['model'],_0x26e38b[_0x51d0('0x34')]);_0x43bce6[_0x51d0('0x37')]=_[_0x51d0('0x38')](_0x26e38b[_0x51d0('0x32')],qs[_0x51d0('0x39')](_0x29b250['query'][_0x51d0('0x39')]));_0x43bce6['attributes']=_0x43bce6[_0x51d0('0x37')][_0x51d0('0x55')]?_0x43bce6['attributes']:_0x26e38b[_0x51d0('0x32')];if(!_0x29b250[_0x51d0('0x34')][_0x51d0('0x3a')](_0x51d0('0x3b'))){_0x43bce6['limit']=qs[_0x51d0('0x25')](_0x29b250['query']['limit']);_0x43bce6[_0x51d0('0x24')]=qs['offset'](_0x29b250[_0x51d0('0x34')]['offset']);}_0x43bce6[_0x51d0('0x3c')]=qs[_0x51d0('0x3d')](_0x29b250['query'][_0x51d0('0x3d')]);_0x43bce6['where']=qs[_0x51d0('0x36')](_[_0x51d0('0x5d')](_0x29b250['query'],_0x26e38b[_0x51d0('0x36')]));_0x43bce6[_0x51d0('0x3e')][_0x51d0('0x5e')]=_0x2acc26['id'];if(_0x29b250[_0x51d0('0x34')][_0x51d0('0x3f')]){_0x43bce6[_0x51d0('0x3e')]=_[_0x51d0('0x57')](_0x43bce6['where'],{'$or':_['map'](_0x43bce6['attributes'],function(_0x14a3b0){var _0x20f87b={};_0x20f87b[_0x14a3b0]={'$like':'%'+_0x29b250['query']['filter']+'%'};return _0x20f87b;})});}_0x43bce6=_[_0x51d0('0x57')]({},_0x43bce6,_0x29b250[_0x51d0('0x41')]);return db[_0x51d0('0x5c')]['count']({'where':_0x43bce6[_0x51d0('0x3e')]})[_0x51d0('0x2a')](function(_0x4848bd){_0x4442e8[_0x51d0('0x23')]=_0x4848bd;if(_0x29b250[_0x51d0('0x34')][_0x51d0('0x56')]){_0x43bce6[_0x51d0('0x43')]=[{'all':!![]}];}return db[_0x51d0('0x5c')]['findAll'](_0x43bce6);})[_0x51d0('0x2a')](function(_0x7e56b2){_0x4442e8['rows']=_0x7e56b2;return _0x4442e8;});}})[_0x51d0('0x2a')](respondWithFilteredResult(_0x48ee6d,_0x43bce6))[_0x51d0('0x48')](handleError(_0x48ee6d,null));};exports[_0x51d0('0x5f')]=function(_0x431ad2,_0x14651c,_0x156fa2){var _0x1a9bd2={'raw':!![],'where':{}};var _0x4ba5ea={};var _0x9b7061={'count':0x0,'rows':[]};return db[_0x51d0('0x42')][_0x51d0('0x5b')]({'where':{'id':_0x431ad2[_0x51d0('0x54')]['id']}})[_0x51d0('0x2a')](handleEntityNotFound(_0x14651c,null))[_0x51d0('0x2a')](function(_0x2cc9c5){if(_0x2cc9c5){_0x4ba5ea[_0x51d0('0x32')]=_[_0x51d0('0x35')](db[_0x51d0('0x60')][_0x51d0('0x2f')]);_0x4ba5ea[_0x51d0('0x34')]=_['keys'](_0x431ad2[_0x51d0('0x34')]);_0x4ba5ea[_0x51d0('0x36')]=_['intersection'](_0x4ba5ea[_0x51d0('0x32')],_0x4ba5ea[_0x51d0('0x34')]);_0x1a9bd2[_0x51d0('0x37')]=_[_0x51d0('0x38')](_0x4ba5ea[_0x51d0('0x32')],qs[_0x51d0('0x39')](_0x431ad2['query'][_0x51d0('0x39')]));_0x1a9bd2[_0x51d0('0x37')]=_0x1a9bd2['attributes'][_0x51d0('0x55')]?_0x1a9bd2[_0x51d0('0x37')]:_0x4ba5ea[_0x51d0('0x32')];if(!_0x431ad2[_0x51d0('0x34')][_0x51d0('0x3a')]('nolimit')){_0x1a9bd2[_0x51d0('0x25')]=qs[_0x51d0('0x25')](_0x431ad2[_0x51d0('0x34')][_0x51d0('0x25')]);_0x1a9bd2[_0x51d0('0x24')]=qs[_0x51d0('0x24')](_0x431ad2['query'][_0x51d0('0x24')]);}_0x1a9bd2[_0x51d0('0x3c')]=qs[_0x51d0('0x3d')](_0x431ad2[_0x51d0('0x34')][_0x51d0('0x3d')]);_0x1a9bd2[_0x51d0('0x3e')]=qs[_0x51d0('0x36')](_[_0x51d0('0x5d')](_0x431ad2[_0x51d0('0x34')],_0x4ba5ea[_0x51d0('0x36')]));_0x1a9bd2[_0x51d0('0x3e')][_0x51d0('0x5e')]=_0x2cc9c5['id'];if(_0x431ad2[_0x51d0('0x34')]['filter']){_0x1a9bd2[_0x51d0('0x3e')]=_[_0x51d0('0x57')](_0x1a9bd2['where'],{'$or':_[_0x51d0('0x33')](_0x1a9bd2['attributes'],function(_0x5aebc1){var _0xfd0f22={};_0xfd0f22[_0x5aebc1]={'$like':'%'+_0x431ad2[_0x51d0('0x34')][_0x51d0('0x3f')]+'%'};return _0xfd0f22;})});}_0x1a9bd2=_['merge']({},_0x1a9bd2,_0x431ad2['options']);return db[_0x51d0('0x60')][_0x51d0('0x23')]({'where':_0x1a9bd2['where']})[_0x51d0('0x2a')](function(_0x4219ca){_0x9b7061['count']=_0x4219ca;if(_0x431ad2[_0x51d0('0x34')][_0x51d0('0x56')]){_0x1a9bd2['include']=[{'all':!![]}];}return db[_0x51d0('0x60')][_0x51d0('0x44')](_0x1a9bd2);})[_0x51d0('0x2a')](function(_0x32c43f){_0x9b7061[_0x51d0('0x45')]=_0x32c43f;return _0x9b7061;});}})[_0x51d0('0x2a')](respondWithFilteredResult(_0x14651c,_0x1a9bd2))[_0x51d0('0x48')](handleError(_0x14651c,null));};function char(_0x527d37){return'number'===typeof _0x527d37?String[_0x51d0('0x61')]['apply'](null,arguments):_0x527d37;}function needsEncapsulation(_0x1cf238){return!!_0x1cf238&&(_0x1cf238['toString']()[_0x51d0('0x62')](char(0xd))>=0x0||_0x1cf238[_0x51d0('0x63')]()[_0x51d0('0x62')](char(0xa))>=0x0||_0x1cf238['toString']()['indexOf'](char(0x2c))>=0x0||_0x1cf238[_0x51d0('0x63')]()[_0x51d0('0x62')](char(0x22))>=0x0);}function encapsulate(_0x19ed14){var _0x1fc67b=char(0x22),_0x1f212b='\x5c'+char(0x22),_0xaa955e=_0x19ed14[_0x51d0('0x63')]()[_0x51d0('0x64')](new RegExp(_0x1fc67b,'g'),_0x1f212b);return _0x1fc67b+_0xaa955e+_0x1fc67b;}exports[_0x51d0('0x65')]=function(_0x3abdd5,_0xb020b6,_0x4f10a0){var _0x2002d2,_0x47d7b2;var _0x320509={'where':{'ProjectId':_0x3abdd5[_0x51d0('0x54')]['id']}};if(_0x3abdd5[_0x51d0('0x34')][_0x51d0('0x66')]){_0x320509[_0x51d0('0x3e')][_0x51d0('0x67')]=JSON[_0x51d0('0x68')](_0x3abdd5['query'][_0x51d0('0x66')]);}return db[_0x51d0('0x5c')][_0x51d0('0x44')](_0x320509)['then'](handleEntityNotFound(_0xb020b6,null))[_0x51d0('0x2a')](function(_0x2cd265){if(_0x2cd265){_0x2002d2=_0x2cd265;return db['JscriptyQuestionReport'][_0x51d0('0x44')]({'where':{'SessionId':{'$in':_[_0x51d0('0x33')](_0x2002d2,'id')},'ProjectId':_0x3abdd5['params']['id']},'order':_0x51d0('0x69')});}})[_0x51d0('0x2a')](handleEntityNotFound(_0xb020b6,null))['then'](function(_0xc914fd){if(_0xc914fd){_0x47d7b2=_0xc914fd;var _0x2da753={};for(var _0x5025f0=0x0,_0x4a875a=_0x47d7b2[_0x51d0('0x55')];_0x5025f0<_0x4a875a;_0x5025f0++){if(!_0x2da753[_0x51d0('0x3a')](_0x47d7b2[_0x5025f0][_0x51d0('0x6a')])){_0x2da753[_0x47d7b2[_0x5025f0]['questionId']]=needsEncapsulation(_0x47d7b2[_0x5025f0][_0x51d0('0x6b')])?encapsulate(_0x47d7b2[_0x5025f0][_0x51d0('0x6b')]):_0x47d7b2[_0x5025f0][_0x51d0('0x6b')];}}var _0x51f827=[],_0x917487={};for(var _0x5870a2=0x0,_0x411aad=_0x2002d2[_0x51d0('0x55')];_0x5870a2<_0x411aad;_0x5870a2++){_0x917487={'ProjectId':_0x3abdd5[_0x51d0('0x54')]['id'],'SessionId':_0x2002d2[_0x5870a2]['id'],'StartTime':moment(_0x2002d2[_0x5870a2][_0x51d0('0x67')])['format'](_0x51d0('0x6c'))};for(var _0x5c036a=0x0,_0x5dec74=_0x47d7b2['length'];_0x5c036a<_0x5dec74;_0x5c036a++){if(_0x47d7b2[_0x5c036a][_0x51d0('0x6d')]==_0x2002d2[_0x5870a2]['id']&&_0x2da753['hasOwnProperty'](_0x47d7b2[_0x5c036a][_0x51d0('0x6a')])){_0x917487[_0x2da753[_0x47d7b2[_0x5c036a][_0x51d0('0x6a')]]]=_0x47d7b2[_0x5c036a][_0x51d0('0x6e')];}}for(var _0x10eef1 in _0x2da753){if(!_0x917487[_0x51d0('0x3a')](_0x2da753[_0x10eef1])){_0x917487[_0x2da753[_0x10eef1]]=null;}}_0x51f827['push'](_0x917487);}return _0x51f827;}})[_0x51d0('0x2a')](function(_0x5466f6){if(!_[_0x51d0('0x6f')](_0x5466f6)){var _0x16307d=toCsv(_0x5466f6);var _0x1568d0=Date[_0x51d0('0x70')]();fs[_0x51d0('0x71')](util[_0x51d0('0x72')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x3abdd5[_0x51d0('0x54')]['id'],_0x1568d0),_0x16307d);_0xb020b6['setHeader']('Content-disposition','attachment;\x20filename='+util[_0x51d0('0x72')](_0x51d0('0x73'),_0x3abdd5[_0x51d0('0x54')]['id'],_0x1568d0));_0xb020b6[_0x51d0('0x74')](_0x51d0('0x75'),_0x51d0('0x76'));return _0xb020b6[_0x51d0('0x77')](util[_0x51d0('0x72')](_0x51d0('0x78'),_0x3abdd5[_0x51d0('0x54')]['id'],_0x1568d0));}else{return _0xb020b6[_0x51d0('0x1f')](0xcc);}})[_0x51d0('0x48')](handleError(_0xb020b6,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index c521965..1fc4338 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 _0xb385=['rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x557f2a,_0x4f316f){var _0x23a194=function(_0x2da1d4){while(--_0x2da1d4){_0x557f2a['push'](_0x557f2a['shift']());}};_0x23a194(++_0x4f316f);}(_0xb385,0x13f));var _0x5b38=function(_0x3b94cd,_0x37efb3){_0x3b94cd=_0x3b94cd-0x0;var _0x213995=_0xb385[_0x3b94cd];return _0x213995;};'use strict';var _=require('lodash');var util=require(_0x5b38('0x0'));var logger=require(_0x5b38('0x1'))(_0x5b38('0x2'));var moment=require('moment');var BPromise=require(_0x5b38('0x3'));var rp=require(_0x5b38('0x4'));var fs=require('fs');var path=require(_0x5b38('0x5'));var rimraf=require(_0x5b38('0x6'));var config=require(_0x5b38('0x7'));var attributes=require(_0x5b38('0x8'));module[_0x5b38('0x9')]=function(_0x51f374,_0x4b953b){return _0x51f374[_0x5b38('0xa')](_0x5b38('0xb'),attributes,{'tableName':_0x5b38('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29ce=['path','rimraf','./jscriptyProject.attributes','exports','define','JscriptyProject','lodash','util','api','moment'];(function(_0x27a76b,_0x1ca15b){var _0x31dd72=function(_0x12a38f){while(--_0x12a38f){_0x27a76b['push'](_0x27a76b['shift']());}};_0x31dd72(++_0x1ca15b);}(_0x29ce,0xec));var _0xe29c=function(_0x43ccb5,_0x23daf0){_0x43ccb5=_0x43ccb5-0x0;var _0x59990b=_0x29ce[_0x43ccb5];return _0x59990b;};'use strict';var _=require(_0xe29c('0x0'));var util=require(_0xe29c('0x1'));var logger=require('../../config/logger')(_0xe29c('0x2'));var moment=require(_0xe29c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe29c('0x4'));var rimraf=require(_0xe29c('0x5'));var config=require('../../config/environment');var attributes=require(_0xe29c('0x6'));module[_0xe29c('0x7')]=function(_0x3effd7,_0x5a7aa6){return _0x3effd7[_0xe29c('0x8')](_0xe29c('0x9'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index da9e188..581da5f 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 _0x7a52=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','error','message','result','lodash'];(function(_0x186ebf,_0x2c356f){var _0x3a0235=function(_0xa90d5e){while(--_0xa90d5e){_0x186ebf['push'](_0x186ebf['shift']());}};_0x3a0235(++_0x2c356f);}(_0x7a52,0xfb));var _0x27a5=function(_0x53f38d,_0x28139b){_0x53f38d=_0x53f38d-0x0;var _0x257bb4=_0x7a52[_0x53f38d];return _0x257bb4;};'use strict';var _=require(_0x27a5('0x0'));var util=require(_0x27a5('0x1'));var moment=require(_0x27a5('0x2'));var BPromise=require(_0x27a5('0x3'));var rs=require(_0x27a5('0x4'));var fs=require('fs');var Redis=require(_0x27a5('0x5'));var db=require(_0x27a5('0x6'))['db'];var utils=require(_0x27a5('0x7'));var logger=require(_0x27a5('0x8'))('rpc');var config=require(_0x27a5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x27a5('0xa')][_0x27a5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a3598,_0x333011,_0xbb2bb){return new BPromise(function(_0x21bb0d,_0x3f4334){return client[_0x27a5('0xc')](_0x1a3598,_0xbb2bb)[_0x27a5('0xd')](function(_0x1ff777){logger[_0x27a5('0xe')](_0x27a5('0xf'),_0x333011,_0x27a5('0x10'));logger[_0x27a5('0x11')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x333011,'request\x20sent',JSON['stringify'](_0x1ff777));if(_0x1ff777[_0x27a5('0x12')]){if(_0x1ff777[_0x27a5('0x12')]['code']===0x1f4){logger[_0x27a5('0x12')](_0x27a5('0xf'),_0x333011,_0x1ff777[_0x27a5('0x12')][_0x27a5('0x13')]);return _0x3f4334(_0x1ff777[_0x27a5('0x12')]['message']);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x333011,_0x1ff777[_0x27a5('0x12')][_0x27a5('0x13')]);return _0x21bb0d(_0x1ff777['error'][_0x27a5('0x13')]);}else{logger[_0x27a5('0xe')](_0x27a5('0xf'),_0x333011,'request\x20sent');_0x21bb0d(_0x1ff777[_0x27a5('0x14')][_0x27a5('0x13')]);}})['catch'](function(_0x5482f1){logger[_0x27a5('0x12')](_0x27a5('0xf'),_0x333011,_0x5482f1);_0x3f4334(_0x5482f1);});});} \ No newline at end of file +var _0x4846=['message','JscriptyProject,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','info','request\x20sent','stringify','error','code'];(function(_0xc03249,_0x4b6610){var _0x48ac91=function(_0x45fa24){while(--_0x45fa24){_0xc03249['push'](_0xc03249['shift']());}};_0x48ac91(++_0x4b6610);}(_0x4846,0xb8));var _0x6484=function(_0x17c579,_0x1968f3){_0x17c579=_0x17c579-0x0;var _0xe506d7=_0x4846[_0x17c579];return _0xe506d7;};'use strict';var _=require(_0x6484('0x0'));var util=require(_0x6484('0x1'));var moment=require(_0x6484('0x2'));var BPromise=require(_0x6484('0x3'));var rs=require(_0x6484('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6484('0x5'))['db'];var utils=require(_0x6484('0x6'));var logger=require('../../config/logger')(_0x6484('0x7'));var config=require(_0x6484('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6484('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32f5b5,_0x24e478,_0x2b44f0){return new BPromise(function(_0x3945ef,_0xe27a91){return client['request'](_0x32f5b5,_0x2b44f0)[_0x6484('0xa')](function(_0x224799){logger[_0x6484('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x24e478,_0x6484('0xc'));logger['debug']('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x24e478,'request\x20sent',JSON[_0x6484('0xd')](_0x224799));if(_0x224799['error']){if(_0x224799[_0x6484('0xe')][_0x6484('0xf')]===0x1f4){logger[_0x6484('0xe')]('JscriptyProject,\x20%s,\x20%s',_0x24e478,_0x224799[_0x6484('0xe')][_0x6484('0x10')]);return _0xe27a91(_0x224799['error']['message']);}logger[_0x6484('0xe')](_0x6484('0x11'),_0x24e478,_0x224799[_0x6484('0xe')][_0x6484('0x10')]);return _0x3945ef(_0x224799[_0x6484('0xe')]['message']);}else{logger[_0x6484('0xb')](_0x6484('0x11'),_0x24e478,_0x6484('0xc'));_0x3945ef(_0x224799[_0x6484('0x12')][_0x6484('0x10')]);}})[_0x6484('0x13')](function(_0x4613ae){logger[_0x6484('0xe')](_0x6484('0x11'),_0x24e478,_0x4613ae);_0xe27a91(_0x4613ae);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index bf15850..3463725 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 _0xa852=['post','put','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x13b70c,_0x40be1c){var _0x2d0edd=function(_0x485ea4){while(--_0x485ea4){_0x13b70c['push'](_0x13b70c['shift']());}};_0x2d0edd(++_0x40be1c);}(_0xa852,0x1bc));var _0x2a85=function(_0x95d266,_0x1b528f){_0x95d266=_0x95d266-0x0;var _0x48cebf=_0xa852[_0x95d266];return _0x48cebf;};'use strict';var multer=require(_0x2a85('0x0'));var util=require(_0x2a85('0x1'));var path=require(_0x2a85('0x2'));var timeout=require(_0x2a85('0x3'));var express=require(_0x2a85('0x4'));var router=express['Router']();var fs_extra=require(_0x2a85('0x5'));var auth=require(_0x2a85('0x6'));var interaction=require(_0x2a85('0x7'));var config=require(_0x2a85('0x8'));var controller=require(_0x2a85('0x9'));router[_0x2a85('0xa')]('/',auth[_0x2a85('0xb')](),controller['index']);router['get'](_0x2a85('0xc'),auth[_0x2a85('0xb')](),controller[_0x2a85('0xd')]);router['get'](_0x2a85('0xe'),auth[_0x2a85('0xb')](),controller[_0x2a85('0xf')]);router[_0x2a85('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2a85('0x11')](_0x2a85('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x2a85('0x12')](_0x2a85('0xe'),auth[_0x2a85('0xb')](),controller['destroy']);module[_0x2a85('0x13')]=router; \ No newline at end of file +var _0x4b2e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','describe','show','post','create','put','update','/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x341e80,_0x205963){var _0x4494f9=function(_0x5c8497){while(--_0x5c8497){_0x341e80['push'](_0x341e80['shift']());}};_0x4494f9(++_0x205963);}(_0x4b2e,0xf5));var _0xe4b2=function(_0x3795e3,_0x3389ed){_0x3795e3=_0x3795e3-0x0;var _0x5ea369=_0x4b2e[_0x3795e3];return _0x5ea369;};'use strict';var multer=require(_0xe4b2('0x0'));var util=require(_0xe4b2('0x1'));var path=require(_0xe4b2('0x2'));var timeout=require(_0xe4b2('0x3'));var express=require(_0xe4b2('0x4'));var router=express[_0xe4b2('0x5')]();var fs_extra=require(_0xe4b2('0x6'));var auth=require(_0xe4b2('0x7'));var interaction=require(_0xe4b2('0x8'));var config=require(_0xe4b2('0x9'));var controller=require(_0xe4b2('0xa'));router[_0xe4b2('0xb')]('/',auth[_0xe4b2('0xc')](),controller['index']);router[_0xe4b2('0xb')]('/describe',auth[_0xe4b2('0xc')](),controller[_0xe4b2('0xd')]);router[_0xe4b2('0xb')]('/:id',auth[_0xe4b2('0xc')](),controller[_0xe4b2('0xe')]);router[_0xe4b2('0xf')]('/',auth[_0xe4b2('0xc')](),controller[_0xe4b2('0x10')]);router[_0xe4b2('0x11')]('/:id',auth[_0xe4b2('0xc')](),controller[_0xe4b2('0x12')]);router['delete'](_0xe4b2('0x13'),auth[_0xe4b2('0xc')](),controller[_0xe4b2('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index d7f7019..1a751d3 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 _0x235a=['sequelize','exports','TEXT','long','STRING'];(function(_0x38b14f,_0xd08fa8){var _0x22a324=function(_0x4bbb05){while(--_0x4bbb05){_0x38b14f['push'](_0x38b14f['shift']());}};_0x22a324(++_0xd08fa8);}(_0x235a,0x1ef));var _0xa235=function(_0x824f75,_0x5b4acd){_0x824f75=_0x824f75-0x0;var _0x7090eb=_0x235a[_0x824f75];return _0x7090eb;};'use strict';var Sequelize=require(_0xa235('0x0'));module[_0xa235('0x1')]={'question':{'type':Sequelize[_0xa235('0x2')]},'answer':{'type':Sequelize['TEXT'](_0xa235('0x3'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xa235('0x4')]},'queue':{'type':Sequelize[_0xa235('0x4')]},'uniqueid':{'type':Sequelize[_0xa235('0x4')]},'calleridname':{'type':Sequelize[_0xa235('0x4')]},'calleridnum':{'type':Sequelize[_0xa235('0x4')]},'questionId':{'type':Sequelize[_0xa235('0x4')]}}; \ No newline at end of file +var _0x4024=['long','STRING','sequelize','exports','TEXT'];(function(_0x5b26be,_0x24893b){var _0x4c02c9=function(_0x17dac2){while(--_0x17dac2){_0x5b26be['push'](_0x5b26be['shift']());}};_0x4c02c9(++_0x24893b);}(_0x4024,0x89));var _0x4402=function(_0x2f6a97,_0xbb8cb0){_0x2f6a97=_0x2f6a97-0x0;var _0x11af1b=_0x4024[_0x2f6a97];return _0x11af1b;};'use strict';var Sequelize=require(_0x4402('0x0'));module[_0x4402('0x1')]={'question':{'type':Sequelize['TEXT']},'answer':{'type':Sequelize[_0x4402('0x2')](_0x4402('0x3'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x4402('0x4')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4402('0x4')]},'calleridname':{'type':Sequelize[_0x4402('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 572807a..bcafe5b 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 _0xdc91=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','then','destroy','sendStatus','error','stack','name','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','intersection','fields','find','create','body','update','describe','html-pdf','eml-format','moment','bluebird','mustache','util','path'];(function(_0x2fb2a9,_0x5badf7){var _0x106844=function(_0x335669){while(--_0x335669){_0x2fb2a9['push'](_0x2fb2a9['shift']());}};_0x106844(++_0x5badf7);}(_0xdc91,0x8b));var _0x1dc9=function(_0x4f5a21,_0x98d231){_0x4f5a21=_0x4f5a21-0x0;var _0x40a7b0=_0xdc91[_0x4f5a21];return _0x40a7b0;};'use strict';var pdf=require(_0x1dc9('0x0'));var emlformat=require(_0x1dc9('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1dc9('0x2'));var BPromise=require(_0x1dc9('0x3'));var Mustache=require(_0x1dc9('0x4'));var util=require(_0x1dc9('0x5'));var path=require(_0x1dc9('0x6'));var sox=require(_0x1dc9('0x7'));var csv=require(_0x1dc9('0x8'));var ejs=require(_0x1dc9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1dc9('0xa'));var squel=require(_0x1dc9('0xb'));var crypto=require(_0x1dc9('0xc'));var jsforce=require(_0x1dc9('0xd'));var deskjs=require(_0x1dc9('0xe'));var toCsv=require(_0x1dc9('0x8'));var querystring=require(_0x1dc9('0xf'));var Papa=require(_0x1dc9('0x10'));var Redis=require(_0x1dc9('0x11'));var authService=require(_0x1dc9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1dc9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1dc9('0x14'))('api');var utils=require(_0x1dc9('0x15'));var config=require(_0x1dc9('0x16'));var licenseUtil=require(_0x1dc9('0x17'));var db=require(_0x1dc9('0x18'))['db'];function respondWithStatusCode(_0x5ce07c,_0x220c79){_0x220c79=_0x220c79||0xcc;return function(_0x432cee){if(_0x432cee){return _0x5ce07c['sendStatus'](_0x220c79);}return _0x5ce07c[_0x1dc9('0x19')](_0x220c79)[_0x1dc9('0x1a')]();};}function respondWithResult(_0x4fb23f,_0x5daaec){_0x5daaec=_0x5daaec||0xc8;return function(_0x8257d3){if(_0x8257d3){return _0x4fb23f[_0x1dc9('0x19')](_0x5daaec)[_0x1dc9('0x1b')](_0x8257d3);}};}function respondWithFilteredResult(_0x2c94b1,_0x4b7e11){return function(_0x4e8c52){if(_0x4e8c52){var _0x2566bb=_0x4e8c52[_0x1dc9('0x1c')],_0xeb26e9=_0x4b7e11[_0x1dc9('0x1d')],_0x5cccb9=_0x4b7e11[_0x1dc9('0x1d')]+_0x4b7e11[_0x1dc9('0x1e')],_0x21cf4d;if(_0x5cccb9>=_0x2566bb){_0x5cccb9=_0x2566bb;_0x21cf4d=0xc8;}else{_0x21cf4d=0xce;}_0x2c94b1[_0x1dc9('0x19')](_0x21cf4d);return _0x2c94b1[_0x1dc9('0x1f')](_0x1dc9('0x20'),_0xeb26e9+'-'+_0x5cccb9+'/'+_0x2566bb)[_0x1dc9('0x1b')](_0x4e8c52);}return null;};}function patchUpdates(_0x3bcb6f){return function(_0xcd7328){try{jsonpatch[_0x1dc9('0x21')](_0xcd7328,_0x3bcb6f,!![]);}catch(_0x2b2920){return BPromise['reject'](_0x2b2920);}return _0xcd7328['save']();};}function saveUpdates(_0x37784e,_0x4d3818){return function(_0x4c25db){if(_0x4c25db){return _0x4c25db['update'](_0x37784e)[_0x1dc9('0x22')](function(_0x3bfb75){return _0x3bfb75;});}return null;};}function removeEntity(_0x277499,_0x1b6829){return function(_0xe1f7c6){if(_0xe1f7c6){return _0xe1f7c6[_0x1dc9('0x23')]()[_0x1dc9('0x22')](function(){_0x277499['status'](0xcc)[_0x1dc9('0x1a')]();});}};}function handleEntityNotFound(_0x2a4740,_0x14181d){return function(_0x4c6e65){if(!_0x4c6e65){_0x2a4740[_0x1dc9('0x24')](0x194);}return _0x4c6e65;};}function handleError(_0x430a62,_0xec8330){_0xec8330=_0xec8330||0x1f4;return function(_0x2192bd){logger[_0x1dc9('0x25')](_0x2192bd[_0x1dc9('0x26')]);if(_0x2192bd[_0x1dc9('0x27')]){delete _0x2192bd[_0x1dc9('0x27')];}_0x430a62[_0x1dc9('0x19')](_0xec8330)['send'](_0x2192bd);};}exports['index']=function(_0x4c1eae,_0x770848){var _0x1ab666={},_0x2e01df={},_0x17a2ec={'count':0x0,'rows':[]};var _0x214805=_[_0x1dc9('0x28')](db[_0x1dc9('0x29')][_0x1dc9('0x2a')],function(_0x5f1403){return{'name':_0x5f1403[_0x1dc9('0x2b')],'type':_0x5f1403[_0x1dc9('0x2c')][_0x1dc9('0x2d')]};});_0x2e01df[_0x1dc9('0x2e')]=_[_0x1dc9('0x28')](_0x214805,_0x1dc9('0x27'));_0x2e01df['query']=_['keys'](_0x4c1eae[_0x1dc9('0x2f')]);_0x2e01df[_0x1dc9('0x30')]=_['intersection'](_0x2e01df[_0x1dc9('0x2e')],_0x2e01df[_0x1dc9('0x2f')]);_0x1ab666[_0x1dc9('0x31')]=_['intersection'](_0x2e01df[_0x1dc9('0x2e')],qs['fields'](_0x4c1eae[_0x1dc9('0x2f')]['fields']));_0x1ab666['attributes']=_0x1ab666[_0x1dc9('0x31')][_0x1dc9('0x32')]?_0x1ab666[_0x1dc9('0x31')]:_0x2e01df[_0x1dc9('0x2e')];if(!_0x4c1eae['query'][_0x1dc9('0x33')]('nolimit')){_0x1ab666[_0x1dc9('0x1e')]=qs[_0x1dc9('0x1e')](_0x4c1eae[_0x1dc9('0x2f')][_0x1dc9('0x1e')]);_0x1ab666[_0x1dc9('0x1d')]=qs[_0x1dc9('0x1d')](_0x4c1eae[_0x1dc9('0x2f')][_0x1dc9('0x1d')]);}_0x1ab666['order']=qs['sort'](_0x4c1eae[_0x1dc9('0x2f')][_0x1dc9('0x34')]);_0x1ab666[_0x1dc9('0x35')]=qs[_0x1dc9('0x30')](_['pick'](_0x4c1eae[_0x1dc9('0x2f')],_0x2e01df['filters']),_0x214805);if(_0x4c1eae[_0x1dc9('0x2f')][_0x1dc9('0x36')]){_0x1ab666[_0x1dc9('0x35')]=_[_0x1dc9('0x37')](_0x1ab666[_0x1dc9('0x35')],{'$or':_[_0x1dc9('0x28')](_0x214805,function(_0x58667c){if(_0x58667c[_0x1dc9('0x2c')]!==_0x1dc9('0x38')){var _0x24f713={};_0x24f713[_0x58667c[_0x1dc9('0x27')]]={'$like':'%'+_0x4c1eae[_0x1dc9('0x2f')][_0x1dc9('0x36')]+'%'};return _0x24f713;}})});}_0x1ab666=_['merge']({},_0x1ab666,_0x4c1eae[_0x1dc9('0x39')]);var _0xade93a={'where':_0x1ab666[_0x1dc9('0x35')]};return db[_0x1dc9('0x29')]['count'](_0xade93a)[_0x1dc9('0x22')](function(_0x2a294b){_0x17a2ec[_0x1dc9('0x1c')]=_0x2a294b;if(_0x4c1eae[_0x1dc9('0x2f')][_0x1dc9('0x3a')]){_0x1ab666[_0x1dc9('0x3b')]=[{'all':!![]}];}return db[_0x1dc9('0x29')][_0x1dc9('0x3c')](_0x1ab666);})[_0x1dc9('0x22')](function(_0x31a9ce){_0x17a2ec[_0x1dc9('0x3d')]=_0x31a9ce;return _0x17a2ec;})[_0x1dc9('0x22')](respondWithFilteredResult(_0x770848,_0x1ab666))[_0x1dc9('0x3e')](handleError(_0x770848,null));};exports[_0x1dc9('0x3f')]=function(_0x443131,_0x2ee60a){var _0x30258c={'raw':!![],'where':{'id':_0x443131[_0x1dc9('0x40')]['id']}},_0x3188cb={};_0x3188cb['model']=_[_0x1dc9('0x41')](db[_0x1dc9('0x29')][_0x1dc9('0x2a')]);_0x3188cb[_0x1dc9('0x2f')]=_['keys'](_0x443131[_0x1dc9('0x2f')]);_0x3188cb[_0x1dc9('0x30')]=_[_0x1dc9('0x42')](_0x3188cb[_0x1dc9('0x2e')],_0x3188cb[_0x1dc9('0x2f')]);_0x30258c[_0x1dc9('0x31')]=_[_0x1dc9('0x42')](_0x3188cb[_0x1dc9('0x2e')],qs['fields'](_0x443131['query'][_0x1dc9('0x43')]));_0x30258c['attributes']=_0x30258c[_0x1dc9('0x31')][_0x1dc9('0x32')]?_0x30258c['attributes']:_0x3188cb[_0x1dc9('0x2e')];if(_0x443131[_0x1dc9('0x2f')][_0x1dc9('0x3a')]){_0x30258c['include']=[{'all':!![]}];}_0x30258c=_[_0x1dc9('0x37')]({},_0x30258c,_0x443131[_0x1dc9('0x39')]);return db[_0x1dc9('0x29')][_0x1dc9('0x44')](_0x30258c)[_0x1dc9('0x22')](handleEntityNotFound(_0x2ee60a,null))[_0x1dc9('0x22')](respondWithResult(_0x2ee60a,null))[_0x1dc9('0x3e')](handleError(_0x2ee60a,null));};exports[_0x1dc9('0x45')]=function(_0x424b67,_0x2bf0cb){return db['JscriptyQuestionReport'][_0x1dc9('0x45')](_0x424b67[_0x1dc9('0x46')],{})[_0x1dc9('0x22')](respondWithResult(_0x2bf0cb,0xc9))['catch'](handleError(_0x2bf0cb,null));};exports[_0x1dc9('0x47')]=function(_0x896f2c,_0x44bed8){if(_0x896f2c[_0x1dc9('0x46')]['id']){delete _0x896f2c[_0x1dc9('0x46')]['id'];}return db[_0x1dc9('0x29')][_0x1dc9('0x44')]({'where':{'id':_0x896f2c['params']['id']}})[_0x1dc9('0x22')](handleEntityNotFound(_0x44bed8,null))[_0x1dc9('0x22')](saveUpdates(_0x896f2c[_0x1dc9('0x46')],null))['then'](respondWithResult(_0x44bed8,null))[_0x1dc9('0x3e')](handleError(_0x44bed8,null));};exports['destroy']=function(_0x46b74b,_0x5a132c){return db['JscriptyQuestionReport'][_0x1dc9('0x44')]({'where':{'id':_0x46b74b[_0x1dc9('0x40')]['id']}})[_0x1dc9('0x22')](handleEntityNotFound(_0x5a132c,null))[_0x1dc9('0x22')](removeEntity(_0x5a132c,null))[_0x1dc9('0x3e')](handleError(_0x5a132c,null));};exports['describe']=function(_0x1b7205,_0x188cf9){return db[_0x1dc9('0x29')][_0x1dc9('0x48')]()[_0x1dc9('0x22')](respondWithResult(_0x188cf9,null))['catch'](handleError(_0x188cf9,null));}; \ No newline at end of file +var _0xb44a=['index','map','JscriptyQuestionReport','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','merge','includeAll','params','options','find','catch','create','body','describe','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','name','send'];(function(_0x2a2b63,_0x24bbed){var _0x4de1e6=function(_0x2d49f2){while(--_0x2d49f2){_0x2a2b63['push'](_0x2a2b63['shift']());}};_0x4de1e6(++_0x24bbed);}(_0xb44a,0x1c2));var _0xab44=function(_0x197767,_0x400276){_0x197767=_0x197767-0x0;var _0x5422c6=_0xb44a[_0x197767];return _0x5422c6;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xab44('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xab44('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xab44('0x2'));var Mustache=require('mustache');var util=require(_0xab44('0x3'));var path=require(_0xab44('0x4'));var sox=require(_0xab44('0x5'));var csv=require(_0xab44('0x6'));var ejs=require(_0xab44('0x7'));var fs=require('fs');var fs_extra=require(_0xab44('0x8'));var _=require(_0xab44('0x9'));var squel=require(_0xab44('0xa'));var crypto=require(_0xab44('0xb'));var jsforce=require(_0xab44('0xc'));var deskjs=require(_0xab44('0xd'));var toCsv=require(_0xab44('0x6'));var querystring=require(_0xab44('0xe'));var Papa=require('papaparse');var Redis=require(_0xab44('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xab44('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xab44('0x11'))(_0xab44('0x12'));var utils=require(_0xab44('0x13'));var config=require(_0xab44('0x14'));var licenseUtil=require(_0xab44('0x15'));var db=require(_0xab44('0x16'))['db'];function respondWithStatusCode(_0x52d282,_0x57fcff){_0x57fcff=_0x57fcff||0xcc;return function(_0x13a1ca){if(_0x13a1ca){return _0x52d282['sendStatus'](_0x57fcff);}return _0x52d282[_0xab44('0x17')](_0x57fcff)['end']();};}function respondWithResult(_0x25f611,_0x15b98a){_0x15b98a=_0x15b98a||0xc8;return function(_0x344e6b){if(_0x344e6b){return _0x25f611[_0xab44('0x17')](_0x15b98a)[_0xab44('0x18')](_0x344e6b);}};}function respondWithFilteredResult(_0x41701b,_0x4875df){return function(_0x51251b){if(_0x51251b){var _0x44c85e=_0x51251b[_0xab44('0x19')],_0x272a5b=_0x4875df[_0xab44('0x1a')],_0x14fe36=_0x4875df[_0xab44('0x1a')]+_0x4875df[_0xab44('0x1b')],_0x33a79d;if(_0x14fe36>=_0x44c85e){_0x14fe36=_0x44c85e;_0x33a79d=0xc8;}else{_0x33a79d=0xce;}_0x41701b[_0xab44('0x17')](_0x33a79d);return _0x41701b[_0xab44('0x1c')](_0xab44('0x1d'),_0x272a5b+'-'+_0x14fe36+'/'+_0x44c85e)['json'](_0x51251b);}return null;};}function patchUpdates(_0xb779bb){return function(_0x401379){try{jsonpatch[_0xab44('0x1e')](_0x401379,_0xb779bb,!![]);}catch(_0x2902ca){return BPromise[_0xab44('0x1f')](_0x2902ca);}return _0x401379['save']();};}function saveUpdates(_0xcd426,_0x59da3b){return function(_0x1f7311){if(_0x1f7311){return _0x1f7311[_0xab44('0x20')](_0xcd426)[_0xab44('0x21')](function(_0x355083){return _0x355083;});}return null;};}function removeEntity(_0x486317,_0x3a2b1d){return function(_0x26fc03){if(_0x26fc03){return _0x26fc03[_0xab44('0x22')]()[_0xab44('0x21')](function(){_0x486317[_0xab44('0x17')](0xcc)[_0xab44('0x23')]();});}};}function handleEntityNotFound(_0x43f1c6,_0x554955){return function(_0x595761){if(!_0x595761){_0x43f1c6[_0xab44('0x24')](0x194);}return _0x595761;};}function handleError(_0x572e0b,_0x2439f3){_0x2439f3=_0x2439f3||0x1f4;return function(_0x5a7269){logger[_0xab44('0x25')](_0x5a7269['stack']);if(_0x5a7269['name']){delete _0x5a7269[_0xab44('0x26')];}_0x572e0b[_0xab44('0x17')](_0x2439f3)[_0xab44('0x27')](_0x5a7269);};}exports[_0xab44('0x28')]=function(_0x132bf6,_0x4e820c){var _0x2f86ac={},_0x5587fe={},_0x5071f3={'count':0x0,'rows':[]};var _0x887b0d=_[_0xab44('0x29')](db[_0xab44('0x2a')][_0xab44('0x2b')],function(_0x4550c8){return{'name':_0x4550c8[_0xab44('0x2c')],'type':_0x4550c8['type'][_0xab44('0x2d')]};});_0x5587fe[_0xab44('0x2e')]=_[_0xab44('0x29')](_0x887b0d,'name');_0x5587fe['query']=_[_0xab44('0x2f')](_0x132bf6['query']);_0x5587fe['filters']=_[_0xab44('0x30')](_0x5587fe[_0xab44('0x2e')],_0x5587fe[_0xab44('0x31')]);_0x2f86ac[_0xab44('0x32')]=_[_0xab44('0x30')](_0x5587fe[_0xab44('0x2e')],qs[_0xab44('0x33')](_0x132bf6[_0xab44('0x31')][_0xab44('0x33')]));_0x2f86ac[_0xab44('0x32')]=_0x2f86ac[_0xab44('0x32')][_0xab44('0x34')]?_0x2f86ac[_0xab44('0x32')]:_0x5587fe[_0xab44('0x2e')];if(!_0x132bf6['query']['hasOwnProperty'](_0xab44('0x35'))){_0x2f86ac[_0xab44('0x1b')]=qs['limit'](_0x132bf6[_0xab44('0x31')][_0xab44('0x1b')]);_0x2f86ac[_0xab44('0x1a')]=qs[_0xab44('0x1a')](_0x132bf6[_0xab44('0x31')][_0xab44('0x1a')]);}_0x2f86ac[_0xab44('0x36')]=qs[_0xab44('0x37')](_0x132bf6[_0xab44('0x31')][_0xab44('0x37')]);_0x2f86ac[_0xab44('0x38')]=qs[_0xab44('0x39')](_[_0xab44('0x3a')](_0x132bf6[_0xab44('0x31')],_0x5587fe[_0xab44('0x39')]),_0x887b0d);if(_0x132bf6[_0xab44('0x31')][_0xab44('0x3b')]){_0x2f86ac[_0xab44('0x38')]=_['merge'](_0x2f86ac[_0xab44('0x38')],{'$or':_[_0xab44('0x29')](_0x887b0d,function(_0x1eaf1f){if(_0x1eaf1f[_0xab44('0x3c')]!=='VIRTUAL'){var _0x2f25c7={};_0x2f25c7[_0x1eaf1f[_0xab44('0x26')]]={'$like':'%'+_0x132bf6[_0xab44('0x31')][_0xab44('0x3b')]+'%'};return _0x2f25c7;}})});}_0x2f86ac=_[_0xab44('0x3d')]({},_0x2f86ac,_0x132bf6['options']);var _0x3d5514={'where':_0x2f86ac[_0xab44('0x38')]};return db[_0xab44('0x2a')]['count'](_0x3d5514)[_0xab44('0x21')](function(_0x1e26de){_0x5071f3[_0xab44('0x19')]=_0x1e26de;if(_0x132bf6[_0xab44('0x31')][_0xab44('0x3e')]){_0x2f86ac['include']=[{'all':!![]}];}return db[_0xab44('0x2a')]['findAll'](_0x2f86ac);})[_0xab44('0x21')](function(_0x4f2b94){_0x5071f3['rows']=_0x4f2b94;return _0x5071f3;})['then'](respondWithFilteredResult(_0x4e820c,_0x2f86ac))['catch'](handleError(_0x4e820c,null));};exports['show']=function(_0x120585,_0x6131f2){var _0x1ab7df={'raw':!![],'where':{'id':_0x120585[_0xab44('0x3f')]['id']}},_0x1aec00={};_0x1aec00[_0xab44('0x2e')]=_[_0xab44('0x2f')](db[_0xab44('0x2a')][_0xab44('0x2b')]);_0x1aec00[_0xab44('0x31')]=_['keys'](_0x120585[_0xab44('0x31')]);_0x1aec00[_0xab44('0x39')]=_[_0xab44('0x30')](_0x1aec00[_0xab44('0x2e')],_0x1aec00['query']);_0x1ab7df[_0xab44('0x32')]=_[_0xab44('0x30')](_0x1aec00[_0xab44('0x2e')],qs[_0xab44('0x33')](_0x120585[_0xab44('0x31')][_0xab44('0x33')]));_0x1ab7df['attributes']=_0x1ab7df['attributes'][_0xab44('0x34')]?_0x1ab7df[_0xab44('0x32')]:_0x1aec00[_0xab44('0x2e')];if(_0x120585[_0xab44('0x31')][_0xab44('0x3e')]){_0x1ab7df['include']=[{'all':!![]}];}_0x1ab7df=_[_0xab44('0x3d')]({},_0x1ab7df,_0x120585[_0xab44('0x40')]);return db[_0xab44('0x2a')][_0xab44('0x41')](_0x1ab7df)['then'](handleEntityNotFound(_0x6131f2,null))[_0xab44('0x21')](respondWithResult(_0x6131f2,null))[_0xab44('0x42')](handleError(_0x6131f2,null));};exports[_0xab44('0x43')]=function(_0x556f7a,_0x3e55fc){return db[_0xab44('0x2a')][_0xab44('0x43')](_0x556f7a[_0xab44('0x44')],{})['then'](respondWithResult(_0x3e55fc,0xc9))[_0xab44('0x42')](handleError(_0x3e55fc,null));};exports['update']=function(_0x36a9f4,_0x1eef1b){if(_0x36a9f4[_0xab44('0x44')]['id']){delete _0x36a9f4[_0xab44('0x44')]['id'];}return db['JscriptyQuestionReport'][_0xab44('0x41')]({'where':{'id':_0x36a9f4['params']['id']}})[_0xab44('0x21')](handleEntityNotFound(_0x1eef1b,null))[_0xab44('0x21')](saveUpdates(_0x36a9f4[_0xab44('0x44')],null))[_0xab44('0x21')](respondWithResult(_0x1eef1b,null))[_0xab44('0x42')](handleError(_0x1eef1b,null));};exports['destroy']=function(_0x4736fd,_0x53ef06){return db[_0xab44('0x2a')][_0xab44('0x41')]({'where':{'id':_0x4736fd[_0xab44('0x3f')]['id']}})['then'](handleEntityNotFound(_0x53ef06,null))[_0xab44('0x21')](removeEntity(_0x53ef06,null))[_0xab44('0x42')](handleError(_0x53ef06,null));};exports[_0xab44('0x45')]=function(_0x160232,_0x41f946){return db['JscriptyQuestionReport']['describe']()[_0xab44('0x21')](respondWithResult(_0x41f946,null))[_0xab44('0x42')](handleError(_0x41f946,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index a9e9c40..cf65bfc 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 _0x5f60=['report_jscripty_questions','lodash','util','../../config/logger','api','request-promise','path','rimraf','./jscriptyQuestionReport.attributes','exports','define'];(function(_0x31b8dc,_0x335680){var _0x3caecb=function(_0x15f57f){while(--_0x15f57f){_0x31b8dc['push'](_0x31b8dc['shift']());}};_0x3caecb(++_0x335680);}(_0x5f60,0xe8));var _0x05f6=function(_0x2a880e,_0x44beb7){_0x2a880e=_0x2a880e-0x0;var _0x45e0ce=_0x5f60[_0x2a880e];return _0x45e0ce;};'use strict';var _=require(_0x05f6('0x0'));var util=require(_0x05f6('0x1'));var logger=require(_0x05f6('0x2'))(_0x05f6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x05f6('0x4'));var fs=require('fs');var path=require(_0x05f6('0x5'));var rimraf=require(_0x05f6('0x6'));var config=require('../../config/environment');var attributes=require(_0x05f6('0x7'));module[_0x05f6('0x8')]=function(_0x3cd778,_0x32ee36){return _0x3cd778[_0x05f6('0x9')]('JscriptyQuestionReport',attributes,{'tableName':_0x05f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83c7=['request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','lodash','util','../../config/logger','api','bluebird'];(function(_0x2c96f6,_0x877207){var _0x6d4808=function(_0x567e0c){while(--_0x567e0c){_0x2c96f6['push'](_0x2c96f6['shift']());}};_0x6d4808(++_0x877207);}(_0x83c7,0xdf));var _0x783c=function(_0x16bcbf,_0x227002){_0x16bcbf=_0x16bcbf-0x0;var _0x38fef2=_0x83c7[_0x16bcbf];return _0x38fef2;};'use strict';var _=require(_0x783c('0x0'));var util=require(_0x783c('0x1'));var logger=require(_0x783c('0x2'))(_0x783c('0x3'));var moment=require('moment');var BPromise=require(_0x783c('0x4'));var rp=require(_0x783c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x783c('0x6'));var config=require(_0x783c('0x7'));var attributes=require(_0x783c('0x8'));module[_0x783c('0x9')]=function(_0x2a5ce4,_0x1ad6d1){return _0x2a5ce4[_0x783c('0xa')](_0x783c('0xb'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index b701e8e..c3b0dae 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 _0x8354=['../../config/environment','client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x546f36,_0x571767){var _0x46853e=function(_0xca817d){while(--_0xca817d){_0x546f36['push'](_0x546f36['shift']());}};_0x46853e(++_0x571767);}(_0x8354,0x1c2));var _0x4835=function(_0xcc3861,_0x270911){_0xcc3861=_0xcc3861-0x0;var _0x4fd97d=_0x8354[_0xcc3861];return _0x4fd97d;};'use strict';var _=require(_0x4835('0x0'));var util=require(_0x4835('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4835('0x2'));var db=require(_0x4835('0x3'))['db'];var utils=require(_0x4835('0x4'));var logger=require('../../config/logger')(_0x4835('0x5'));var config=require(_0x4835('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4835('0x7')][_0x4835('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2516c3,_0x26fc07,_0x2c1094){return new BPromise(function(_0x5f20b,_0x1abb26){return client[_0x4835('0x9')](_0x2516c3,_0x2c1094)['then'](function(_0x231781){logger[_0x4835('0xa')](_0x4835('0xb'),_0x26fc07,'request\x20sent');logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x26fc07,_0x4835('0xc'),JSON[_0x4835('0xd')](_0x231781));if(_0x231781['error']){if(_0x231781[_0x4835('0xe')][_0x4835('0xf')]===0x1f4){logger[_0x4835('0xe')](_0x4835('0xb'),_0x26fc07,_0x231781[_0x4835('0xe')][_0x4835('0x10')]);return _0x1abb26(_0x231781[_0x4835('0xe')][_0x4835('0x10')]);}logger[_0x4835('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x26fc07,_0x231781['error'][_0x4835('0x10')]);return _0x5f20b(_0x231781[_0x4835('0xe')][_0x4835('0x10')]);}else{logger[_0x4835('0xa')](_0x4835('0xb'),_0x26fc07,_0x4835('0xc'));_0x5f20b(_0x231781[_0x4835('0x11')][_0x4835('0x10')]);}})[_0x4835('0x12')](function(_0x4450b6){logger[_0x4835('0xe')](_0x4835('0xb'),_0x26fc07,_0x4450b6);_0x1abb26(_0x4450b6);});});} \ No newline at end of file +var _0x2d9c=['request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s'];(function(_0x2a8ae2,_0x2c16ce){var _0x14a890=function(_0x2c159b){while(--_0x2c159b){_0x2a8ae2['push'](_0x2a8ae2['shift']());}};_0x14a890(++_0x2c16ce);}(_0x2d9c,0x191));var _0xc2d9=function(_0x131829,_0x5a99ea){_0x131829=_0x131829-0x0;var _0x1e70d4=_0x2d9c[_0x131829];return _0x1e70d4;};'use strict';var _=require(_0xc2d9('0x0'));var util=require(_0xc2d9('0x1'));var moment=require(_0xc2d9('0x2'));var BPromise=require(_0xc2d9('0x3'));var rs=require(_0xc2d9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc2d9('0x5'))['db'];var utils=require(_0xc2d9('0x6'));var logger=require(_0xc2d9('0x7'))(_0xc2d9('0x8'));var config=require(_0xc2d9('0x9'));var jayson=require(_0xc2d9('0xa'));var client=jayson[_0xc2d9('0xb')][_0xc2d9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x318bcd,_0xca5736,_0x5e480a){return new BPromise(function(_0x57c5c7,_0x6d6e3){return client[_0xc2d9('0xd')](_0x318bcd,_0x5e480a)[_0xc2d9('0xe')](function(_0x32a469){logger[_0xc2d9('0xf')](_0xc2d9('0x10'),_0xca5736,_0xc2d9('0x11'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0xca5736,_0xc2d9('0x11'),JSON['stringify'](_0x32a469));if(_0x32a469[_0xc2d9('0x12')]){if(_0x32a469[_0xc2d9('0x12')]['code']===0x1f4){logger[_0xc2d9('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0xca5736,_0x32a469[_0xc2d9('0x12')][_0xc2d9('0x13')]);return _0x6d6e3(_0x32a469[_0xc2d9('0x12')][_0xc2d9('0x13')]);}logger[_0xc2d9('0x12')](_0xc2d9('0x10'),_0xca5736,_0x32a469['error'][_0xc2d9('0x13')]);return _0x57c5c7(_0x32a469['error'][_0xc2d9('0x13')]);}else{logger[_0xc2d9('0xf')](_0xc2d9('0x10'),_0xca5736,_0xc2d9('0x11'));_0x57c5c7(_0x32a469[_0xc2d9('0x14')]['message']);}})[_0xc2d9('0x15')](function(_0x418477){logger[_0xc2d9('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0xca5736,_0x418477);_0x6d6e3(_0x418477);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 15776c6..b4ff7b6 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 _0x187d=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x31f043,_0x3b8836){var _0x1c161=function(_0x31211b){while(--_0x31211b){_0x31f043['push'](_0x31f043['shift']());}};_0x1c161(++_0x3b8836);}(_0x187d,0x93));var _0xd187=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x187d[_0x173d7e];return _0x2220d6;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var fs_extra=require(_0xd187('0x5'));var auth=require(_0xd187('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd187('0x7'));var controller=require(_0xd187('0x8'));router['get']('/',auth[_0xd187('0x9')](),controller[_0xd187('0xa')]);router[_0xd187('0xb')](_0xd187('0xc'),auth[_0xd187('0x9')](),controller[_0xd187('0xd')]);router[_0xd187('0xb')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0xf')]);router[_0xd187('0xb')](_0xd187('0x10'),auth[_0xd187('0x9')](),controller[_0xd187('0x11')]);router[_0xd187('0x12')]('/',auth['isAuthenticated'](),controller[_0xd187('0x13')]);router[_0xd187('0x14')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0x15')]);router[_0xd187('0x16')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0x17')]);module[_0xd187('0x18')]=router; \ No newline at end of file +var _0x6f47=['path','express','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','getQuestions','create','put','update','delete','destroy','util'];(function(_0x11ea9c,_0x3168f6){var _0x17ca3c=function(_0x10cba3){while(--_0x10cba3){_0x11ea9c['push'](_0x11ea9c['shift']());}};_0x17ca3c(++_0x3168f6);}(_0x6f47,0xc7));var _0x76f4=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x6f47[_0x166d93];return _0xba708;};'use strict';var multer=require('multer');var util=require(_0x76f4('0x0'));var path=require(_0x76f4('0x1'));var timeout=require('connect-timeout');var express=require(_0x76f4('0x2'));var router=express['Router']();var fs_extra=require(_0x76f4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x76f4('0x4'));var config=require(_0x76f4('0x5'));var controller=require(_0x76f4('0x6'));router[_0x76f4('0x7')]('/',auth['isAuthenticated'](),controller[_0x76f4('0x8')]);router[_0x76f4('0x7')](_0x76f4('0x9'),auth['isAuthenticated'](),controller[_0x76f4('0xa')]);router[_0x76f4('0x7')](_0x76f4('0xb'),auth[_0x76f4('0xc')](),controller[_0x76f4('0xd')]);router['get']('/:id/questions',auth[_0x76f4('0xc')](),controller[_0x76f4('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x76f4('0xf')]);router[_0x76f4('0x10')](_0x76f4('0xb'),auth[_0x76f4('0xc')](),controller[_0x76f4('0x11')]);router[_0x76f4('0x12')](_0x76f4('0xb'),auth[_0x76f4('0xc')](),controller[_0x76f4('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 9c4e2eb..9f48d13 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 _0x0dbc=['YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','sequelize','exports','DATE','starttime','endtime','format'];(function(_0x160148,_0x5c0639){var _0x5d4a2c=function(_0x4e4317){while(--_0x4e4317){_0x160148['push'](_0x160148['shift']());}};_0x5d4a2c(++_0x5c0639);}(_0x0dbc,0x1e0));var _0xc0db=function(_0x45c4bb,_0x252bda){_0x45c4bb=_0x45c4bb-0x0;var _0x1bc1be=_0x0dbc[_0x45c4bb];return _0x1bc1be;};'use strict';var moment=require('moment');var Sequelize=require(_0xc0db('0x0'));module[_0xc0db('0x1')]={'starttime':{'type':Sequelize[_0xc0db('0x2')],'set':function(_0x4eae74){this['setDataValue'](_0xc0db('0x3'),_0x4eae74);this['setDataValue'](_0xc0db('0x4'),moment()[_0xc0db('0x5')](_0xc0db('0x6')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xc0db('0x7')]},'projectname':{'type':Sequelize[_0xc0db('0x7')]},'queue':{'type':Sequelize[_0xc0db('0x7')]},'uniqueid':{'type':Sequelize[_0xc0db('0x7')]},'calleridname':{'type':Sequelize[_0xc0db('0x7')]},'calleridnum':{'type':Sequelize[_0xc0db('0x7')]},'completed':{'type':Sequelize[_0xc0db('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x40b2=['STRING','BOOLEAN','sequelize','exports','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE'];(function(_0x3cb04f,_0x44b1fd){var _0x2eb516=function(_0x3082a9){while(--_0x3082a9){_0x3cb04f['push'](_0x3cb04f['shift']());}};_0x2eb516(++_0x44b1fd);}(_0x40b2,0x142));var _0x240b=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x40b2[_0x5783f4];return _0x28e380;};'use strict';var moment=require('moment');var Sequelize=require(_0x240b('0x0'));module[_0x240b('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x2ba9c3){this[_0x240b('0x2')](_0x240b('0x3'),_0x2ba9c3);this[_0x240b('0x2')](_0x240b('0x4'),moment()[_0x240b('0x5')](_0x240b('0x6')));}},'endtime':{'type':Sequelize[_0x240b('0x7')]},'membername':{'type':Sequelize[_0x240b('0x8')]},'projectname':{'type':Sequelize[_0x240b('0x8')]},'queue':{'type':Sequelize[_0x240b('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x240b('0x8')]},'calleridnum':{'type':Sequelize[_0x240b('0x8')]},'completed':{'type':Sequelize[_0x240b('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 4f17d24..3719eed 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 _0x78fc=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','length','includeAll','find','create','body','catch','describe','getQuestions','JscriptyQuestionReport','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x321e05,_0x4953b3){var _0x5796d7=function(_0x1c9935){while(--_0x1c9935){_0x321e05['push'](_0x321e05['shift']());}};_0x5796d7(++_0x4953b3);}(_0x78fc,0x1c6));var _0xc78f=function(_0x55d8c5,_0x10287a){_0x55d8c5=_0x55d8c5-0x0;var _0x225ae5=_0x78fc[_0x55d8c5];return _0x225ae5;};'use strict';var pdf=require(_0xc78f('0x0'));var emlformat=require(_0xc78f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc78f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc78f('0x3'));var moment=require('moment');var BPromise=require(_0xc78f('0x4'));var Mustache=require(_0xc78f('0x5'));var util=require(_0xc78f('0x6'));var path=require(_0xc78f('0x7'));var sox=require('sox');var csv=require(_0xc78f('0x8'));var ejs=require(_0xc78f('0x9'));var fs=require('fs');var fs_extra=require(_0xc78f('0xa'));var _=require(_0xc78f('0xb'));var squel=require(_0xc78f('0xc'));var crypto=require(_0xc78f('0xd'));var jsforce=require(_0xc78f('0xe'));var deskjs=require(_0xc78f('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc78f('0x10'));var Papa=require('papaparse');var Redis=require(_0xc78f('0x11'));var authService=require(_0xc78f('0x12'));var qs=require(_0xc78f('0x13'));var as=require(_0xc78f('0x14'));var hardwareService=require(_0xc78f('0x15'));var logger=require(_0xc78f('0x16'))(_0xc78f('0x17'));var utils=require(_0xc78f('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc78f('0x19'));var db=require(_0xc78f('0x1a'))['db'];function respondWithStatusCode(_0x390848,_0x107f58){_0x107f58=_0x107f58||0xcc;return function(_0xf6d67e){if(_0xf6d67e){return _0x390848[_0xc78f('0x1b')](_0x107f58);}return _0x390848[_0xc78f('0x1c')](_0x107f58)[_0xc78f('0x1d')]();};}function respondWithResult(_0x45730c,_0x18562b){_0x18562b=_0x18562b||0xc8;return function(_0x268552){if(_0x268552){return _0x45730c[_0xc78f('0x1c')](_0x18562b)[_0xc78f('0x1e')](_0x268552);}};}function respondWithFilteredResult(_0x48e532,_0x5ae81a){return function(_0x3409d1){if(_0x3409d1){var _0x3850ba=_0x3409d1[_0xc78f('0x1f')],_0x470266=_0x5ae81a[_0xc78f('0x20')],_0x4794cb=_0x5ae81a[_0xc78f('0x20')]+_0x5ae81a[_0xc78f('0x21')],_0x376f54;if(_0x4794cb>=_0x3850ba){_0x4794cb=_0x3850ba;_0x376f54=0xc8;}else{_0x376f54=0xce;}_0x48e532[_0xc78f('0x1c')](_0x376f54);return _0x48e532[_0xc78f('0x22')](_0xc78f('0x23'),_0x470266+'-'+_0x4794cb+'/'+_0x3850ba)[_0xc78f('0x1e')](_0x3409d1);}return null;};}function patchUpdates(_0x2af0bd){return function(_0x135451){try{jsonpatch[_0xc78f('0x24')](_0x135451,_0x2af0bd,!![]);}catch(_0xa4399){return BPromise[_0xc78f('0x25')](_0xa4399);}return _0x135451['save']();};}function saveUpdates(_0x37a5cc,_0x475c21){return function(_0x43a5cd){if(_0x43a5cd){return _0x43a5cd['update'](_0x37a5cc)[_0xc78f('0x26')](function(_0x294649){return _0x294649;});}return null;};}function removeEntity(_0x231c67,_0x2eadc0){return function(_0x4f26a7){if(_0x4f26a7){return _0x4f26a7['destroy']()[_0xc78f('0x26')](function(){_0x231c67['status'](0xcc)[_0xc78f('0x1d')]();});}};}function handleEntityNotFound(_0x3030db,_0x5000ee){return function(_0x20255a){if(!_0x20255a){_0x3030db[_0xc78f('0x1b')](0x194);}return _0x20255a;};}function handleError(_0x20551e,_0x2edc28){_0x2edc28=_0x2edc28||0x1f4;return function(_0x5024e9){logger['error'](_0x5024e9['stack']);if(_0x5024e9[_0xc78f('0x27')]){delete _0x5024e9[_0xc78f('0x27')];}_0x20551e['status'](_0x2edc28)[_0xc78f('0x28')](_0x5024e9);};}exports[_0xc78f('0x29')]=function(_0x14638b,_0x4b5bb4){var _0x247b38={},_0xf21c40={},_0xd10e81={'count':0x0,'rows':[]};var _0x38f085=_[_0xc78f('0x2a')](db[_0xc78f('0x2b')][_0xc78f('0x2c')],function(_0x5a36e5){return{'name':_0x5a36e5[_0xc78f('0x2d')],'type':_0x5a36e5[_0xc78f('0x2e')][_0xc78f('0x2f')]};});_0xf21c40['model']=_[_0xc78f('0x2a')](_0x38f085,_0xc78f('0x27'));_0xf21c40['query']=_[_0xc78f('0x30')](_0x14638b[_0xc78f('0x31')]);_0xf21c40[_0xc78f('0x32')]=_[_0xc78f('0x33')](_0xf21c40[_0xc78f('0x34')],_0xf21c40[_0xc78f('0x31')]);_0x247b38[_0xc78f('0x35')]=_[_0xc78f('0x33')](_0xf21c40[_0xc78f('0x34')],qs[_0xc78f('0x36')](_0x14638b[_0xc78f('0x31')][_0xc78f('0x36')]));_0x247b38[_0xc78f('0x35')]=_0x247b38[_0xc78f('0x35')]['length']?_0x247b38[_0xc78f('0x35')]:_0xf21c40[_0xc78f('0x34')];if(!_0x14638b[_0xc78f('0x31')][_0xc78f('0x37')](_0xc78f('0x38'))){_0x247b38[_0xc78f('0x21')]=qs[_0xc78f('0x21')](_0x14638b['query']['limit']);_0x247b38[_0xc78f('0x20')]=qs[_0xc78f('0x20')](_0x14638b[_0xc78f('0x31')][_0xc78f('0x20')]);}_0x247b38[_0xc78f('0x39')]=qs[_0xc78f('0x3a')](_0x14638b['query'][_0xc78f('0x3a')]);_0x247b38[_0xc78f('0x3b')]=qs[_0xc78f('0x32')](_[_0xc78f('0x3c')](_0x14638b[_0xc78f('0x31')],_0xf21c40['filters']),_0x38f085);if(_0x14638b[_0xc78f('0x31')]['filter']){_0x247b38['where']=_['merge'](_0x247b38[_0xc78f('0x3b')],{'$or':_[_0xc78f('0x2a')](_0x38f085,function(_0x2b448d){if(_0x2b448d[_0xc78f('0x2e')]!=='VIRTUAL'){var _0x38fe9f={};_0x38fe9f[_0x2b448d[_0xc78f('0x27')]]={'$like':'%'+_0x14638b[_0xc78f('0x31')][_0xc78f('0x3d')]+'%'};return _0x38fe9f;}})});}_0x247b38=_[_0xc78f('0x3e')]({},_0x247b38,_0x14638b[_0xc78f('0x3f')]);var _0x58ceba={'where':_0x247b38[_0xc78f('0x3b')]};return db[_0xc78f('0x2b')][_0xc78f('0x1f')](_0x58ceba)[_0xc78f('0x26')](function(_0x8b5302){_0xd10e81[_0xc78f('0x1f')]=_0x8b5302;if(_0x14638b['query']['includeAll']){_0x247b38[_0xc78f('0x40')]=[{'all':!![]}];}return db[_0xc78f('0x2b')][_0xc78f('0x41')](_0x247b38);})['then'](function(_0x555336){_0xd10e81[_0xc78f('0x42')]=_0x555336;return _0xd10e81;})[_0xc78f('0x26')](respondWithFilteredResult(_0x4b5bb4,_0x247b38))['catch'](handleError(_0x4b5bb4,null));};exports[_0xc78f('0x43')]=function(_0x1b635e,_0x580ce8){var _0x270797={'raw':!![],'where':{'id':_0x1b635e[_0xc78f('0x44')]['id']}},_0x296be3={};_0x296be3['model']=_[_0xc78f('0x30')](db['JscriptySessionReport'][_0xc78f('0x2c')]);_0x296be3[_0xc78f('0x31')]=_['keys'](_0x1b635e[_0xc78f('0x31')]);_0x296be3[_0xc78f('0x32')]=_[_0xc78f('0x33')](_0x296be3[_0xc78f('0x34')],_0x296be3[_0xc78f('0x31')]);_0x270797[_0xc78f('0x35')]=_['intersection'](_0x296be3[_0xc78f('0x34')],qs[_0xc78f('0x36')](_0x1b635e['query'][_0xc78f('0x36')]));_0x270797['attributes']=_0x270797[_0xc78f('0x35')][_0xc78f('0x45')]?_0x270797[_0xc78f('0x35')]:_0x296be3[_0xc78f('0x34')];if(_0x1b635e['query'][_0xc78f('0x46')]){_0x270797['include']=[{'all':!![]}];}_0x270797=_['merge']({},_0x270797,_0x1b635e[_0xc78f('0x3f')]);return db[_0xc78f('0x2b')][_0xc78f('0x47')](_0x270797)[_0xc78f('0x26')](handleEntityNotFound(_0x580ce8,null))[_0xc78f('0x26')](respondWithResult(_0x580ce8,null))['catch'](handleError(_0x580ce8,null));};exports[_0xc78f('0x48')]=function(_0x73d748,_0x470194){return db[_0xc78f('0x2b')][_0xc78f('0x48')](_0x73d748[_0xc78f('0x49')],{})[_0xc78f('0x26')](respondWithResult(_0x470194,0xc9))[_0xc78f('0x4a')](handleError(_0x470194,null));};exports['update']=function(_0x5afc29,_0xc689c1){if(_0x5afc29[_0xc78f('0x49')]['id']){delete _0x5afc29[_0xc78f('0x49')]['id'];}return db[_0xc78f('0x2b')][_0xc78f('0x47')]({'where':{'id':_0x5afc29[_0xc78f('0x44')]['id']}})[_0xc78f('0x26')](handleEntityNotFound(_0xc689c1,null))['then'](saveUpdates(_0x5afc29[_0xc78f('0x49')],null))['then'](respondWithResult(_0xc689c1,null))[_0xc78f('0x4a')](handleError(_0xc689c1,null));};exports['destroy']=function(_0x273fe9,_0x4f7209){return db[_0xc78f('0x2b')]['find']({'where':{'id':_0x273fe9['params']['id']}})[_0xc78f('0x26')](handleEntityNotFound(_0x4f7209,null))['then'](removeEntity(_0x4f7209,null))[_0xc78f('0x4a')](handleError(_0x4f7209,null));};exports[_0xc78f('0x4b')]=function(_0x40529e,_0xf84b64){return db['JscriptySessionReport'][_0xc78f('0x4b')]()[_0xc78f('0x26')](respondWithResult(_0xf84b64,null))['catch'](handleError(_0xf84b64,null));};exports[_0xc78f('0x4c')]=function(_0x55dce6,_0x367571,_0x4ad2){var _0x2716c0={'raw':!![],'where':{}};var _0x1de79b={};var _0x20f454={'count':0x0,'rows':[]};return db[_0xc78f('0x2b')]['findOne']({'where':{'id':_0x55dce6[_0xc78f('0x44')]['id']}})['then'](handleEntityNotFound(_0x367571,null))['then'](function(_0x216b36){if(_0x216b36){_0x1de79b[_0xc78f('0x34')]=_[_0xc78f('0x30')](db[_0xc78f('0x4d')]['rawAttributes']);_0x1de79b['query']=_[_0xc78f('0x30')](_0x55dce6[_0xc78f('0x31')]);_0x1de79b['filters']=_['intersection'](_0x1de79b[_0xc78f('0x34')],_0x1de79b[_0xc78f('0x31')]);_0x2716c0[_0xc78f('0x35')]=_[_0xc78f('0x33')](_0x1de79b[_0xc78f('0x34')],qs[_0xc78f('0x36')](_0x55dce6[_0xc78f('0x31')]['fields']));_0x2716c0[_0xc78f('0x35')]=_0x2716c0[_0xc78f('0x35')][_0xc78f('0x45')]?_0x2716c0[_0xc78f('0x35')]:_0x1de79b['model'];if(!_0x55dce6[_0xc78f('0x31')][_0xc78f('0x37')](_0xc78f('0x38'))){_0x2716c0[_0xc78f('0x21')]=qs[_0xc78f('0x21')](_0x55dce6[_0xc78f('0x31')][_0xc78f('0x21')]);_0x2716c0[_0xc78f('0x20')]=qs[_0xc78f('0x20')](_0x55dce6[_0xc78f('0x31')][_0xc78f('0x20')]);}_0x2716c0['order']=qs[_0xc78f('0x3a')](_0x55dce6[_0xc78f('0x31')][_0xc78f('0x3a')]);_0x2716c0[_0xc78f('0x3b')]=qs[_0xc78f('0x32')](_[_0xc78f('0x3c')](_0x55dce6[_0xc78f('0x31')],_0x1de79b['filters']));_0x2716c0[_0xc78f('0x3b')]['SessionId']=_0x216b36['id'];if(_0x55dce6[_0xc78f('0x31')][_0xc78f('0x3d')]){_0x2716c0[_0xc78f('0x3b')]=_[_0xc78f('0x3e')](_0x2716c0[_0xc78f('0x3b')],{'$or':_[_0xc78f('0x2a')](_0x2716c0['attributes'],function(_0x34a2bd){var _0x4f618e={};_0x4f618e[_0x34a2bd]={'$like':'%'+_0x55dce6['query'][_0xc78f('0x3d')]+'%'};return _0x4f618e;})});}_0x2716c0=_[_0xc78f('0x3e')]({},_0x2716c0,_0x55dce6[_0xc78f('0x3f')]);return db[_0xc78f('0x4d')][_0xc78f('0x1f')]({'where':_0x2716c0[_0xc78f('0x3b')]})['then'](function(_0x3b5a93){_0x20f454[_0xc78f('0x1f')]=_0x3b5a93;if(_0x55dce6[_0xc78f('0x31')][_0xc78f('0x46')]){_0x2716c0['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xc78f('0x41')](_0x2716c0);})[_0xc78f('0x26')](function(_0xd2eb5d){_0x20f454['rows']=_0xd2eb5d;return _0x20f454;});}})['then'](respondWithFilteredResult(_0x367571,_0x2716c0))[_0xc78f('0x4a')](handleError(_0x367571,null));}; \ No newline at end of file +var _0x9067=['catch','create','body','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','error','name','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','show','params','includeAll','include','find'];(function(_0x919bbb,_0x55ef48){var _0x40971a=function(_0xc823b6){while(--_0xc823b6){_0x919bbb['push'](_0x919bbb['shift']());}};_0x40971a(++_0x55ef48);}(_0x9067,0x149));var _0x7906=function(_0x46ad7d,_0x54273b){_0x46ad7d=_0x46ad7d-0x0;var _0x54c59d=_0x9067[_0x46ad7d];return _0x54c59d;};'use strict';var pdf=require(_0x7906('0x0'));var emlformat=require(_0x7906('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7906('0x2'));var jsonpatch=require(_0x7906('0x3'));var rp=require(_0x7906('0x4'));var moment=require(_0x7906('0x5'));var BPromise=require(_0x7906('0x6'));var Mustache=require(_0x7906('0x7'));var util=require(_0x7906('0x8'));var path=require(_0x7906('0x9'));var sox=require('sox');var csv=require(_0x7906('0xa'));var ejs=require(_0x7906('0xb'));var fs=require('fs');var fs_extra=require(_0x7906('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7906('0xd'));var deskjs=require(_0x7906('0xe'));var toCsv=require(_0x7906('0xa'));var querystring=require(_0x7906('0xf'));var Papa=require(_0x7906('0x10'));var Redis=require(_0x7906('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7906('0x12'));var as=require(_0x7906('0x13'));var hardwareService=require(_0x7906('0x14'));var logger=require(_0x7906('0x15'))(_0x7906('0x16'));var utils=require('../../config/utils');var config=require(_0x7906('0x17'));var licenseUtil=require(_0x7906('0x18'));var db=require(_0x7906('0x19'))['db'];function respondWithStatusCode(_0x26d8a1,_0x5960e7){_0x5960e7=_0x5960e7||0xcc;return function(_0x49bf75){if(_0x49bf75){return _0x26d8a1[_0x7906('0x1a')](_0x5960e7);}return _0x26d8a1[_0x7906('0x1b')](_0x5960e7)[_0x7906('0x1c')]();};}function respondWithResult(_0x37943a,_0x1f624f){_0x1f624f=_0x1f624f||0xc8;return function(_0x230a1d){if(_0x230a1d){return _0x37943a[_0x7906('0x1b')](_0x1f624f)[_0x7906('0x1d')](_0x230a1d);}};}function respondWithFilteredResult(_0x1ede88,_0x5e9067){return function(_0x1163d9){if(_0x1163d9){var _0x27cd84=_0x1163d9[_0x7906('0x1e')],_0x17335e=_0x5e9067[_0x7906('0x1f')],_0x2688f5=_0x5e9067[_0x7906('0x1f')]+_0x5e9067[_0x7906('0x20')],_0x4740fd;if(_0x2688f5>=_0x27cd84){_0x2688f5=_0x27cd84;_0x4740fd=0xc8;}else{_0x4740fd=0xce;}_0x1ede88[_0x7906('0x1b')](_0x4740fd);return _0x1ede88[_0x7906('0x21')](_0x7906('0x22'),_0x17335e+'-'+_0x2688f5+'/'+_0x27cd84)['json'](_0x1163d9);}return null;};}function patchUpdates(_0x78cc5d){return function(_0x2bb94e){try{jsonpatch[_0x7906('0x23')](_0x2bb94e,_0x78cc5d,!![]);}catch(_0x2f3e7b){return BPromise['reject'](_0x2f3e7b);}return _0x2bb94e[_0x7906('0x24')]();};}function saveUpdates(_0x245bf8,_0x2a9fc0){return function(_0x4bcfb5){if(_0x4bcfb5){return _0x4bcfb5[_0x7906('0x25')](_0x245bf8)['then'](function(_0xeef266){return _0xeef266;});}return null;};}function removeEntity(_0x4c3820,_0xb1ecfa){return function(_0x38c570){if(_0x38c570){return _0x38c570['destroy']()[_0x7906('0x26')](function(){_0x4c3820['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fdfbd,_0x191a42){return function(_0x560a94){if(!_0x560a94){_0x4fdfbd[_0x7906('0x1a')](0x194);}return _0x560a94;};}function handleError(_0xfb3957,_0x2e9914){_0x2e9914=_0x2e9914||0x1f4;return function(_0x5616d1){logger[_0x7906('0x27')](_0x5616d1['stack']);if(_0x5616d1[_0x7906('0x28')]){delete _0x5616d1[_0x7906('0x28')];}_0xfb3957[_0x7906('0x1b')](_0x2e9914)['send'](_0x5616d1);};}exports[_0x7906('0x29')]=function(_0x5bc301,_0x4383e6){var _0x46d153={},_0x178a76={},_0x131529={'count':0x0,'rows':[]};var _0x8da452=_[_0x7906('0x2a')](db[_0x7906('0x2b')][_0x7906('0x2c')],function(_0x5e6e21){return{'name':_0x5e6e21[_0x7906('0x2d')],'type':_0x5e6e21[_0x7906('0x2e')][_0x7906('0x2f')]};});_0x178a76[_0x7906('0x30')]=_['map'](_0x8da452,_0x7906('0x28'));_0x178a76[_0x7906('0x31')]=_[_0x7906('0x32')](_0x5bc301['query']);_0x178a76[_0x7906('0x33')]=_[_0x7906('0x34')](_0x178a76[_0x7906('0x30')],_0x178a76[_0x7906('0x31')]);_0x46d153[_0x7906('0x35')]=_[_0x7906('0x34')](_0x178a76[_0x7906('0x30')],qs['fields'](_0x5bc301[_0x7906('0x31')][_0x7906('0x36')]));_0x46d153[_0x7906('0x35')]=_0x46d153[_0x7906('0x35')][_0x7906('0x37')]?_0x46d153['attributes']:_0x178a76['model'];if(!_0x5bc301[_0x7906('0x31')][_0x7906('0x38')](_0x7906('0x39'))){_0x46d153['limit']=qs[_0x7906('0x20')](_0x5bc301[_0x7906('0x31')][_0x7906('0x20')]);_0x46d153[_0x7906('0x1f')]=qs['offset'](_0x5bc301[_0x7906('0x31')][_0x7906('0x1f')]);}_0x46d153[_0x7906('0x3a')]=qs[_0x7906('0x3b')](_0x5bc301[_0x7906('0x31')][_0x7906('0x3b')]);_0x46d153[_0x7906('0x3c')]=qs['filters'](_[_0x7906('0x3d')](_0x5bc301['query'],_0x178a76[_0x7906('0x33')]),_0x8da452);if(_0x5bc301[_0x7906('0x31')][_0x7906('0x3e')]){_0x46d153[_0x7906('0x3c')]=_['merge'](_0x46d153[_0x7906('0x3c')],{'$or':_['map'](_0x8da452,function(_0x35c184){if(_0x35c184[_0x7906('0x2e')]!=='VIRTUAL'){var _0x520fda={};_0x520fda[_0x35c184[_0x7906('0x28')]]={'$like':'%'+_0x5bc301[_0x7906('0x31')][_0x7906('0x3e')]+'%'};return _0x520fda;}})});}_0x46d153=_[_0x7906('0x3f')]({},_0x46d153,_0x5bc301[_0x7906('0x40')]);var _0x136639={'where':_0x46d153['where']};return db[_0x7906('0x2b')][_0x7906('0x1e')](_0x136639)['then'](function(_0xd33a22){_0x131529['count']=_0xd33a22;if(_0x5bc301[_0x7906('0x31')]['includeAll']){_0x46d153['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x7906('0x41')](_0x46d153);})[_0x7906('0x26')](function(_0x115661){_0x131529['rows']=_0x115661;return _0x131529;})[_0x7906('0x26')](respondWithFilteredResult(_0x4383e6,_0x46d153))['catch'](handleError(_0x4383e6,null));};exports[_0x7906('0x42')]=function(_0x125050,_0x6d0668){var _0x19f445={'raw':!![],'where':{'id':_0x125050[_0x7906('0x43')]['id']}},_0x43c4c8={};_0x43c4c8[_0x7906('0x30')]=_['keys'](db['JscriptySessionReport']['rawAttributes']);_0x43c4c8['query']=_['keys'](_0x125050[_0x7906('0x31')]);_0x43c4c8['filters']=_[_0x7906('0x34')](_0x43c4c8[_0x7906('0x30')],_0x43c4c8['query']);_0x19f445['attributes']=_[_0x7906('0x34')](_0x43c4c8[_0x7906('0x30')],qs[_0x7906('0x36')](_0x125050[_0x7906('0x31')][_0x7906('0x36')]));_0x19f445[_0x7906('0x35')]=_0x19f445['attributes'][_0x7906('0x37')]?_0x19f445[_0x7906('0x35')]:_0x43c4c8[_0x7906('0x30')];if(_0x125050[_0x7906('0x31')][_0x7906('0x44')]){_0x19f445[_0x7906('0x45')]=[{'all':!![]}];}_0x19f445=_[_0x7906('0x3f')]({},_0x19f445,_0x125050['options']);return db[_0x7906('0x2b')][_0x7906('0x46')](_0x19f445)[_0x7906('0x26')](handleEntityNotFound(_0x6d0668,null))[_0x7906('0x26')](respondWithResult(_0x6d0668,null))[_0x7906('0x47')](handleError(_0x6d0668,null));};exports[_0x7906('0x48')]=function(_0x18dd0a,_0x94bc31){return db[_0x7906('0x2b')]['create'](_0x18dd0a[_0x7906('0x49')],{})[_0x7906('0x26')](respondWithResult(_0x94bc31,0xc9))[_0x7906('0x47')](handleError(_0x94bc31,null));};exports['update']=function(_0xb7aa4b,_0x15d7fa){if(_0xb7aa4b['body']['id']){delete _0xb7aa4b[_0x7906('0x49')]['id'];}return db[_0x7906('0x2b')]['find']({'where':{'id':_0xb7aa4b[_0x7906('0x43')]['id']}})[_0x7906('0x26')](handleEntityNotFound(_0x15d7fa,null))['then'](saveUpdates(_0xb7aa4b[_0x7906('0x49')],null))[_0x7906('0x26')](respondWithResult(_0x15d7fa,null))[_0x7906('0x47')](handleError(_0x15d7fa,null));};exports[_0x7906('0x4a')]=function(_0x2025c3,_0x24fe02){return db[_0x7906('0x2b')][_0x7906('0x46')]({'where':{'id':_0x2025c3[_0x7906('0x43')]['id']}})['then'](handleEntityNotFound(_0x24fe02,null))[_0x7906('0x26')](removeEntity(_0x24fe02,null))[_0x7906('0x47')](handleError(_0x24fe02,null));};exports[_0x7906('0x4b')]=function(_0x58da40,_0x3aac90){return db[_0x7906('0x2b')][_0x7906('0x4b')]()[_0x7906('0x26')](respondWithResult(_0x3aac90,null))[_0x7906('0x47')](handleError(_0x3aac90,null));};exports[_0x7906('0x4c')]=function(_0x23c81d,_0x429c36,_0x297360){var _0x1c6733={'raw':!![],'where':{}};var _0x298bb4={};var _0x465f15={'count':0x0,'rows':[]};return db[_0x7906('0x2b')][_0x7906('0x4d')]({'where':{'id':_0x23c81d[_0x7906('0x43')]['id']}})[_0x7906('0x26')](handleEntityNotFound(_0x429c36,null))[_0x7906('0x26')](function(_0x3405af){if(_0x3405af){_0x298bb4[_0x7906('0x30')]=_[_0x7906('0x32')](db[_0x7906('0x4e')][_0x7906('0x2c')]);_0x298bb4[_0x7906('0x31')]=_[_0x7906('0x32')](_0x23c81d[_0x7906('0x31')]);_0x298bb4[_0x7906('0x33')]=_['intersection'](_0x298bb4['model'],_0x298bb4[_0x7906('0x31')]);_0x1c6733[_0x7906('0x35')]=_['intersection'](_0x298bb4['model'],qs[_0x7906('0x36')](_0x23c81d['query'][_0x7906('0x36')]));_0x1c6733[_0x7906('0x35')]=_0x1c6733[_0x7906('0x35')]['length']?_0x1c6733[_0x7906('0x35')]:_0x298bb4[_0x7906('0x30')];if(!_0x23c81d[_0x7906('0x31')][_0x7906('0x38')](_0x7906('0x39'))){_0x1c6733[_0x7906('0x20')]=qs[_0x7906('0x20')](_0x23c81d[_0x7906('0x31')][_0x7906('0x20')]);_0x1c6733[_0x7906('0x1f')]=qs[_0x7906('0x1f')](_0x23c81d[_0x7906('0x31')][_0x7906('0x1f')]);}_0x1c6733[_0x7906('0x3a')]=qs['sort'](_0x23c81d[_0x7906('0x31')]['sort']);_0x1c6733[_0x7906('0x3c')]=qs[_0x7906('0x33')](_[_0x7906('0x3d')](_0x23c81d['query'],_0x298bb4['filters']));_0x1c6733[_0x7906('0x3c')][_0x7906('0x4f')]=_0x3405af['id'];if(_0x23c81d[_0x7906('0x31')][_0x7906('0x3e')]){_0x1c6733[_0x7906('0x3c')]=_[_0x7906('0x3f')](_0x1c6733[_0x7906('0x3c')],{'$or':_[_0x7906('0x2a')](_0x1c6733[_0x7906('0x35')],function(_0x11d864){var _0x3f2dda={};_0x3f2dda[_0x11d864]={'$like':'%'+_0x23c81d[_0x7906('0x31')][_0x7906('0x3e')]+'%'};return _0x3f2dda;})});}_0x1c6733=_[_0x7906('0x3f')]({},_0x1c6733,_0x23c81d['options']);return db[_0x7906('0x4e')]['count']({'where':_0x1c6733[_0x7906('0x3c')]})['then'](function(_0xe33c05){_0x465f15[_0x7906('0x1e')]=_0xe33c05;if(_0x23c81d[_0x7906('0x31')][_0x7906('0x44')]){_0x1c6733[_0x7906('0x45')]=[{'all':!![]}];}return db[_0x7906('0x4e')][_0x7906('0x41')](_0x1c6733);})['then'](function(_0x460b34){_0x465f15['rows']=_0x460b34;return _0x465f15;});}})['then'](respondWithFilteredResult(_0x429c36,_0x1c6733))[_0x7906('0x47')](handleError(_0x429c36,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 8465586..d159a15 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 _0xe40a=['rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions','lodash','util','api','moment','bluebird','request-promise'];(function(_0x70a3d8,_0x2d8c1a){var _0x1e4724=function(_0x30c81d){while(--_0x30c81d){_0x70a3d8['push'](_0x70a3d8['shift']());}};_0x1e4724(++_0x2d8c1a);}(_0xe40a,0x162));var _0xae40=function(_0x56a607,_0x3621df){_0x56a607=_0x56a607-0x0;var _0xd3d3e1=_0xe40a[_0x56a607];return _0xd3d3e1;};'use strict';var _=require(_0xae40('0x0'));var util=require(_0xae40('0x1'));var logger=require('../../config/logger')(_0xae40('0x2'));var moment=require(_0xae40('0x3'));var BPromise=require(_0xae40('0x4'));var rp=require(_0xae40('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xae40('0x6'));var config=require(_0xae40('0x7'));var attributes=require(_0xae40('0x8'));module[_0xae40('0x9')]=function(_0x5af919,_0x56ea38){return _0x5af919['define'](_0xae40('0xa'),attributes,{'tableName':_0xae40('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x51dc=['JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./jscriptySessionReport.attributes'];(function(_0x3fd153,_0x1c8184){var _0x3f42d0=function(_0x421ced){while(--_0x421ced){_0x3fd153['push'](_0x3fd153['shift']());}};_0x3f42d0(++_0x1c8184);}(_0x51dc,0x1af));var _0xc51d=function(_0x5a1c5f,_0x466439){_0x5a1c5f=_0x5a1c5f-0x0;var _0x5bede0=_0x51dc[_0x5a1c5f];return _0x5bede0;};'use strict';var _=require(_0xc51d('0x0'));var util=require('util');var logger=require(_0xc51d('0x1'))(_0xc51d('0x2'));var moment=require(_0xc51d('0x3'));var BPromise=require(_0xc51d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc51d('0x5'));var rimraf=require(_0xc51d('0x6'));var config=require(_0xc51d('0x7'));var attributes=require(_0xc51d('0x8'));module['exports']=function(_0x28f889,_0x53fd3c){return _0x28f889['define'](_0xc51d('0x9'),attributes,{'tableName':_0xc51d('0xa'),'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 2cb8190..b4e051c 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 _0x8a01=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','error','message','result','util','moment','bluebird','randomstring'];(function(_0x22f53f,_0x14ef66){var _0x57bc67=function(_0x375f18){while(--_0x375f18){_0x22f53f['push'](_0x22f53f['shift']());}};_0x57bc67(++_0x14ef66);}(_0x8a01,0x13c));var _0x18a0=function(_0x5bf279,_0x41f310){_0x5bf279=_0x5bf279-0x0;var _0xc7df1a=_0x8a01[_0x5bf279];return _0xc7df1a;};'use strict';var _=require('lodash');var util=require(_0x18a0('0x0'));var moment=require(_0x18a0('0x1'));var BPromise=require(_0x18a0('0x2'));var rs=require(_0x18a0('0x3'));var fs=require('fs');var Redis=require(_0x18a0('0x4'));var db=require(_0x18a0('0x5'))['db'];var utils=require(_0x18a0('0x6'));var logger=require(_0x18a0('0x7'))(_0x18a0('0x8'));var config=require(_0x18a0('0x9'));var jayson=require(_0x18a0('0xa'));var client=jayson['client'][_0x18a0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x297f53,_0x11a8dc,_0x494331){return new BPromise(function(_0x14c039,_0x2c7596){return client[_0x18a0('0xc')](_0x297f53,_0x494331)[_0x18a0('0xd')](function(_0x15e603){logger[_0x18a0('0xe')](_0x18a0('0xf'),_0x11a8dc,'request\x20sent');logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x11a8dc,_0x18a0('0x10'),JSON['stringify'](_0x15e603));if(_0x15e603['error']){if(_0x15e603[_0x18a0('0x11')]['code']===0x1f4){logger[_0x18a0('0x11')](_0x18a0('0xf'),_0x11a8dc,_0x15e603['error']['message']);return _0x2c7596(_0x15e603[_0x18a0('0x11')][_0x18a0('0x12')]);}logger[_0x18a0('0x11')](_0x18a0('0xf'),_0x11a8dc,_0x15e603[_0x18a0('0x11')][_0x18a0('0x12')]);return _0x14c039(_0x15e603[_0x18a0('0x11')][_0x18a0('0x12')]);}else{logger[_0x18a0('0xe')](_0x18a0('0xf'),_0x11a8dc,_0x18a0('0x10'));_0x14c039(_0x15e603[_0x18a0('0x13')][_0x18a0('0x12')]);}})['catch'](function(_0x1b2fc7){logger[_0x18a0('0x11')](_0x18a0('0xf'),_0x11a8dc,_0x1b2fc7);_0x2c7596(_0x1b2fc7);});});} \ No newline at end of file +var _0x376f=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x243ccc,_0x4d4de1){var _0x9a2114=function(_0x4010b7){while(--_0x4010b7){_0x243ccc['push'](_0x243ccc['shift']());}};_0x9a2114(++_0x4d4de1);}(_0x376f,0x18c));var _0xf376=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x376f[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xf376('0x0'));var util=require(_0xf376('0x1'));var moment=require(_0xf376('0x2'));var BPromise=require(_0xf376('0x3'));var rs=require(_0xf376('0x4'));var fs=require('fs');var Redis=require(_0xf376('0x5'));var db=require(_0xf376('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf376('0x7'))(_0xf376('0x8'));var config=require(_0xf376('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf376('0xa')][_0xf376('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a9d7b,_0x1c4fac,_0x1a8964){return new BPromise(function(_0x25cd67,_0x18ec33){return client[_0xf376('0xc')](_0x5a9d7b,_0x1a8964)[_0xf376('0xd')](function(_0x285e32){logger[_0xf376('0xe')](_0xf376('0xf'),_0x1c4fac,_0xf376('0x10'));logger[_0xf376('0x11')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x1c4fac,_0xf376('0x10'),JSON['stringify'](_0x285e32));if(_0x285e32[_0xf376('0x12')]){if(_0x285e32[_0xf376('0x12')][_0xf376('0x13')]===0x1f4){logger[_0xf376('0x12')](_0xf376('0xf'),_0x1c4fac,_0x285e32[_0xf376('0x12')][_0xf376('0x14')]);return _0x18ec33(_0x285e32[_0xf376('0x12')][_0xf376('0x14')]);}logger[_0xf376('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x1c4fac,_0x285e32[_0xf376('0x12')]['message']);return _0x25cd67(_0x285e32['error'][_0xf376('0x14')]);}else{logger[_0xf376('0xe')](_0xf376('0xf'),_0x1c4fac,_0xf376('0x10'));_0x25cd67(_0x285e32[_0xf376('0x15')]['message']);}})[_0xf376('0x16')](function(_0x420dec){logger[_0xf376('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x1c4fac,_0x420dec);_0x18ec33(_0x420dec);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 6366c46..9156ac8 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 _0x9f1e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','put','isAuthenticated','update','exports','util','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f1e,0x15a));var _0xe9f1=function(_0x321635,_0x235110){_0x321635=_0x321635-0x0;var _0x55adba=_0x9f1e[_0x321635];return _0x55adba;};'use strict';var multer=require('multer');var util=require(_0xe9f1('0x0'));var path=require('path');var timeout=require(_0xe9f1('0x1'));var express=require('express');var router=express[_0xe9f1('0x2')]();var fs_extra=require(_0xe9f1('0x3'));var auth=require(_0xe9f1('0x4'));var interaction=require(_0xe9f1('0x5'));var config=require('../../config/environment');var controller=require('./license.controller');router[_0xe9f1('0x6')]('/',controller[_0xe9f1('0x7')]);router[_0xe9f1('0x8')]('/:id',auth[_0xe9f1('0x9')](),controller[_0xe9f1('0xa')]);module[_0xe9f1('0xb')]=router; \ No newline at end of file +var _0x3821=['exports','multer','util','fs-extra','../../components/auth/service','../../config/environment','./license.controller','get','put','/:id','isAuthenticated','update'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x3821,0x6d));var _0x1382=function(_0x219645,_0x284e9f){_0x219645=_0x219645-0x0;var _0x599ff5=_0x3821[_0x219645];return _0x599ff5;};'use strict';var multer=require(_0x1382('0x0'));var util=require(_0x1382('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x1382('0x2'));var auth=require(_0x1382('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1382('0x4'));var controller=require(_0x1382('0x5'));router[_0x1382('0x6')]('/',controller['index']);router[_0x1382('0x7')](_0x1382('0x8'),auth[_0x1382('0x9')](),controller[_0x1382('0xa')]);module[_0x1382('0xb')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index ff5d9e2..d8a2cb6 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 _0xc4aa=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x4eb65b,_0x8d7e2b){var _0x36deb5=function(_0x95a997){while(--_0x95a997){_0x4eb65b['push'](_0x4eb65b['shift']());}};_0x36deb5(++_0x8d7e2b);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc4aa[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'license':{'type':Sequelize[_0xac4a('0x2')]},'data1':{'type':Sequelize[_0xac4a('0x3')]},'data2':{'type':Sequelize[_0xac4a('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xac4a('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdbf5=['exports','STRING','INTEGER'];(function(_0x2d8864,_0x34171a){var _0x435a6a=function(_0x3deecd){while(--_0x3deecd){_0x2d8864['push'](_0x2d8864['shift']());}};_0x435a6a(++_0x34171a);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x462aba,_0x9b0c9f){_0x462aba=_0x462aba-0x0;var _0x4983ef=_0xdbf5[_0x462aba];return _0x4983ef;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x5dbf('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x5dbf('0x2')],'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 3ddb433..c26c492 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 _0xd5b7=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','index','model','keys','License','query','filters','attributes','fields','length','merge','options','getLicense','update','body','find','params','checkLicense','demo','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x1c67a7,_0x2b35bd){var _0x3dc84a=function(_0x249c51){while(--_0x249c51){_0x1c67a7['push'](_0x1c67a7['shift']());}};_0x3dc84a(++_0x2b35bd);}(_0xd5b7,0xe4));var _0x7d5b=function(_0x9d639c,_0x524dbe){_0x9d639c=_0x9d639c-0x0;var _0x1671de=_0xd5b7[_0x9d639c];return _0x1671de;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7d5b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7d5b('0x1'));var jsonpatch=require(_0x7d5b('0x2'));var rp=require(_0x7d5b('0x3'));var moment=require(_0x7d5b('0x4'));var BPromise=require(_0x7d5b('0x5'));var Mustache=require(_0x7d5b('0x6'));var util=require('util');var path=require(_0x7d5b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7d5b('0x8'));var fs=require('fs');var fs_extra=require(_0x7d5b('0x9'));var _=require('lodash');var squel=require(_0x7d5b('0xa'));var crypto=require(_0x7d5b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7d5b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7d5b('0xd'));var Papa=require(_0x7d5b('0xe'));var Redis=require(_0x7d5b('0xf'));var authService=require(_0x7d5b('0x10'));var qs=require(_0x7d5b('0x11'));var as=require(_0x7d5b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d5b('0x13'))(_0x7d5b('0x14'));var utils=require(_0x7d5b('0x15'));var config=require(_0x7d5b('0x16'));var licenseUtil=require(_0x7d5b('0x17'));var db=require(_0x7d5b('0x18'))['db'];function respondWithStatusCode(_0x570464,_0x45da52){_0x45da52=_0x45da52||0xcc;return function(_0x210db6){if(_0x210db6){return _0x570464[_0x7d5b('0x19')](_0x45da52);}return _0x570464[_0x7d5b('0x1a')](_0x45da52)['end']();};}function respondWithResult(_0x443f1c,_0x393c0a){_0x393c0a=_0x393c0a||0xc8;return function(_0x98f801){if(_0x98f801){return _0x443f1c[_0x7d5b('0x1a')](_0x393c0a)[_0x7d5b('0x1b')](_0x98f801);}};}function respondWithFilteredResult(_0x19645b,_0x40e87e){return function(_0x53b352){if(_0x53b352){var _0x4405=_0x53b352[_0x7d5b('0x1c')],_0x96418f=_0x40e87e['offset'],_0x311d50=_0x40e87e[_0x7d5b('0x1d')]+_0x40e87e[_0x7d5b('0x1e')],_0x2e643d;if(_0x311d50>=_0x4405){_0x311d50=_0x4405;_0x2e643d=0xc8;}else{_0x2e643d=0xce;}_0x19645b[_0x7d5b('0x1a')](_0x2e643d);return _0x19645b[_0x7d5b('0x1f')](_0x7d5b('0x20'),_0x96418f+'-'+_0x311d50+'/'+_0x4405)['json'](_0x53b352);}return null;};}function patchUpdates(_0x5c155f){return function(_0x388fd6){try{jsonpatch[_0x7d5b('0x21')](_0x388fd6,_0x5c155f,!![]);}catch(_0x356386){return BPromise[_0x7d5b('0x22')](_0x356386);}return _0x388fd6[_0x7d5b('0x23')]();};}function saveUpdates(_0x586393,_0x2b62d6){return function(_0x2854df){if(_0x2854df){return _0x2854df['update'](_0x586393)[_0x7d5b('0x24')](function(_0x2f516e){return _0x2f516e;});}return null;};}function removeEntity(_0x10f2ef,_0x364db5){return function(_0x200693){if(_0x200693){return _0x200693[_0x7d5b('0x25')]()[_0x7d5b('0x24')](function(){_0x10f2ef[_0x7d5b('0x1a')](0xcc)[_0x7d5b('0x26')]();});}};}function handleEntityNotFound(_0x3eecc4,_0x371ce9){return function(_0x4d6ded){if(!_0x4d6ded){_0x3eecc4['sendStatus'](0x194);}return _0x4d6ded;};}function handleError(_0x57919e,_0x108c11){_0x108c11=_0x108c11||0x1f4;return function(_0x2087d1){logger[_0x7d5b('0x27')](_0x2087d1[_0x7d5b('0x28')]);if(_0x2087d1[_0x7d5b('0x29')]){delete _0x2087d1['name'];}_0x57919e['status'](_0x108c11)['send'](_0x2087d1);};}var utilLicense=require('../../config/license/util');exports[_0x7d5b('0x2a')]=function(_0x1fb377,_0x5deb4b){var _0x5d37b2={'raw':!![],'where':{'id':0x1}},_0x2b4764={};_0x2b4764[_0x7d5b('0x2b')]=_[_0x7d5b('0x2c')](db[_0x7d5b('0x2d')]['rawAttributes']);_0x2b4764[_0x7d5b('0x2e')]=_[_0x7d5b('0x2c')](_0x1fb377['query']);_0x2b4764[_0x7d5b('0x2f')]=_['intersection'](_0x2b4764[_0x7d5b('0x2b')],_0x2b4764[_0x7d5b('0x2e')]);_0x5d37b2[_0x7d5b('0x30')]=_['intersection'](_0x2b4764['model'],qs[_0x7d5b('0x31')](_0x1fb377['query'][_0x7d5b('0x31')]));_0x5d37b2[_0x7d5b('0x30')]=_0x5d37b2['attributes'][_0x7d5b('0x32')]?_0x5d37b2[_0x7d5b('0x30')]:_0x2b4764[_0x7d5b('0x2b')];_0x5d37b2=_[_0x7d5b('0x33')]({},_0x5d37b2,_0x1fb377[_0x7d5b('0x34')]);return utilLicense[_0x7d5b('0x35')](_0x5d37b2)[_0x7d5b('0x24')](respondWithResult(_0x5deb4b,null))['catch'](handleError(_0x5deb4b,null));};exports[_0x7d5b('0x36')]=function(_0x1120ec,_0x131511){if(_0x1120ec[_0x7d5b('0x37')]['id']){delete _0x1120ec['body']['id'];}return db[_0x7d5b('0x2d')][_0x7d5b('0x38')]({'where':{'id':_0x1120ec[_0x7d5b('0x39')]['id']}})[_0x7d5b('0x24')](handleEntityNotFound(_0x131511,null))[_0x7d5b('0x24')](function(_0x5e28ae){var _0x5a7be7=_0x5e28ae['get']({'plain':!![]});return utilLicense[_0x7d5b('0x3a')](_0x5a7be7,_0x1120ec[_0x7d5b('0x37')]['key']);})['then'](function(_0xd9ab3e){if(!_0xd9ab3e[_0x7d5b('0x3b')]){return saveUpdates(_0x1120ec[_0x7d5b('0x37')],null);}return _0xd9ab3e;})[_0x7d5b('0x24')](respondWithResult(_0x131511,null))[_0x7d5b('0x3c')](handleError(_0x131511,null));}; \ No newline at end of file +var _0x8518=['send','keys','License','query','filters','model','attributes','intersection','fields','length','merge','options','getLicense','catch','body','params','get','checkLicense','demo','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name'];(function(_0x3489aa,_0x4e1fb5){var _0x5f145b=function(_0x1c6c82){while(--_0x1c6c82){_0x3489aa['push'](_0x3489aa['shift']());}};_0x5f145b(++_0x4e1fb5);}(_0x8518,0xca));var _0x8851=function(_0x45be52,_0x46d496){_0x45be52=_0x45be52-0x0;var _0x15294f=_0x8518[_0x45be52];return _0x15294f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8851('0x0'));var rimraf=require(_0x8851('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8851('0x2'));var rp=require(_0x8851('0x3'));var moment=require('moment');var BPromise=require(_0x8851('0x4'));var Mustache=require(_0x8851('0x5'));var util=require(_0x8851('0x6'));var path=require(_0x8851('0x7'));var sox=require(_0x8851('0x8'));var csv=require(_0x8851('0x9'));var ejs=require(_0x8851('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8851('0xb'));var squel=require(_0x8851('0xc'));var crypto=require('crypto');var jsforce=require(_0x8851('0xd'));var deskjs=require(_0x8851('0xe'));var toCsv=require(_0x8851('0x9'));var querystring=require(_0x8851('0xf'));var Papa=require(_0x8851('0x10'));var Redis=require(_0x8851('0x11'));var authService=require(_0x8851('0x12'));var qs=require(_0x8851('0x13'));var as=require(_0x8851('0x14'));var hardwareService=require(_0x8851('0x15'));var logger=require(_0x8851('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x8851('0x17'));var licenseUtil=require(_0x8851('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38691e,_0x4f847a){_0x4f847a=_0x4f847a||0xcc;return function(_0x245643){if(_0x245643){return _0x38691e[_0x8851('0x19')](_0x4f847a);}return _0x38691e[_0x8851('0x1a')](_0x4f847a)[_0x8851('0x1b')]();};}function respondWithResult(_0x47b192,_0x243610){_0x243610=_0x243610||0xc8;return function(_0x5f4dcf){if(_0x5f4dcf){return _0x47b192[_0x8851('0x1a')](_0x243610)[_0x8851('0x1c')](_0x5f4dcf);}};}function respondWithFilteredResult(_0x1e5345,_0x8e111c){return function(_0x26c8fe){if(_0x26c8fe){var _0xf33480=_0x26c8fe[_0x8851('0x1d')],_0x17fbec=_0x8e111c[_0x8851('0x1e')],_0x33bc9e=_0x8e111c['offset']+_0x8e111c[_0x8851('0x1f')],_0x157d8d;if(_0x33bc9e>=_0xf33480){_0x33bc9e=_0xf33480;_0x157d8d=0xc8;}else{_0x157d8d=0xce;}_0x1e5345[_0x8851('0x1a')](_0x157d8d);return _0x1e5345[_0x8851('0x20')](_0x8851('0x21'),_0x17fbec+'-'+_0x33bc9e+'/'+_0xf33480)[_0x8851('0x1c')](_0x26c8fe);}return null;};}function patchUpdates(_0x52a603){return function(_0x1e0c10){try{jsonpatch['apply'](_0x1e0c10,_0x52a603,!![]);}catch(_0x11cefe){return BPromise[_0x8851('0x22')](_0x11cefe);}return _0x1e0c10[_0x8851('0x23')]();};}function saveUpdates(_0x148f5c,_0xb3135f){return function(_0x31eacb){if(_0x31eacb){return _0x31eacb[_0x8851('0x24')](_0x148f5c)[_0x8851('0x25')](function(_0x4b3b4b){return _0x4b3b4b;});}return null;};}function removeEntity(_0x32dd86,_0x546aad){return function(_0x43383a){if(_0x43383a){return _0x43383a[_0x8851('0x26')]()['then'](function(){_0x32dd86[_0x8851('0x1a')](0xcc)[_0x8851('0x1b')]();});}};}function handleEntityNotFound(_0x132bf3,_0x360ea4){return function(_0x5ddccb){if(!_0x5ddccb){_0x132bf3[_0x8851('0x19')](0x194);}return _0x5ddccb;};}function handleError(_0x1513ed,_0x48a7c7){_0x48a7c7=_0x48a7c7||0x1f4;return function(_0x100ea0){logger[_0x8851('0x27')](_0x100ea0[_0x8851('0x28')]);if(_0x100ea0[_0x8851('0x29')]){delete _0x100ea0[_0x8851('0x29')];}_0x1513ed[_0x8851('0x1a')](_0x48a7c7)[_0x8851('0x2a')](_0x100ea0);};}var utilLicense=require(_0x8851('0x18'));exports['index']=function(_0x25964e,_0x46b6df){var _0x331c27={'raw':!![],'where':{'id':0x1}},_0x5e2a54={};_0x5e2a54['model']=_[_0x8851('0x2b')](db[_0x8851('0x2c')]['rawAttributes']);_0x5e2a54[_0x8851('0x2d')]=_[_0x8851('0x2b')](_0x25964e[_0x8851('0x2d')]);_0x5e2a54[_0x8851('0x2e')]=_['intersection'](_0x5e2a54[_0x8851('0x2f')],_0x5e2a54[_0x8851('0x2d')]);_0x331c27[_0x8851('0x30')]=_[_0x8851('0x31')](_0x5e2a54[_0x8851('0x2f')],qs[_0x8851('0x32')](_0x25964e[_0x8851('0x2d')][_0x8851('0x32')]));_0x331c27['attributes']=_0x331c27['attributes'][_0x8851('0x33')]?_0x331c27['attributes']:_0x5e2a54[_0x8851('0x2f')];_0x331c27=_[_0x8851('0x34')]({},_0x331c27,_0x25964e[_0x8851('0x35')]);return utilLicense[_0x8851('0x36')](_0x331c27)['then'](respondWithResult(_0x46b6df,null))[_0x8851('0x37')](handleError(_0x46b6df,null));};exports['update']=function(_0x45a13c,_0x1b9a5a){if(_0x45a13c[_0x8851('0x38')]['id']){delete _0x45a13c['body']['id'];}return db[_0x8851('0x2c')]['find']({'where':{'id':_0x45a13c[_0x8851('0x39')]['id']}})[_0x8851('0x25')](handleEntityNotFound(_0x1b9a5a,null))[_0x8851('0x25')](function(_0x58a4e9){var _0x26518b=_0x58a4e9[_0x8851('0x3a')]({'plain':!![]});return utilLicense[_0x8851('0x3b')](_0x26518b,_0x45a13c['body']['key']);})[_0x8851('0x25')](function(_0x4df6ac){if(!_0x4df6ac[_0x8851('0x3c')]){return saveUpdates(_0x45a13c[_0x8851('0x38')],null);}return _0x4df6ac;})['then'](respondWithResult(_0x1b9a5a,null))[_0x8851('0x37')](handleError(_0x1b9a5a,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 3107e8c..b9e39bd 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 _0x5ecf=['moment','path','rimraf','../../config/environment','./license.attributes','exports','define','License','license','lodash','util','../../config/logger','api'];(function(_0x52e68e,_0x309912){var _0x3211a4=function(_0x467c01){while(--_0x467c01){_0x52e68e['push'](_0x52e68e['shift']());}};_0x3211a4(++_0x309912);}(_0x5ecf,0x1c3));var _0xf5ec=function(_0x533ff6,_0x3f03d4){_0x533ff6=_0x533ff6-0x0;var _0x26d705=_0x5ecf[_0x533ff6];return _0x26d705;};'use strict';var _=require(_0xf5ec('0x0'));var util=require(_0xf5ec('0x1'));var logger=require(_0xf5ec('0x2'))(_0xf5ec('0x3'));var moment=require(_0xf5ec('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf5ec('0x5'));var rimraf=require(_0xf5ec('0x6'));var config=require(_0xf5ec('0x7'));var attributes=require(_0xf5ec('0x8'));module[_0xf5ec('0x9')]=function(_0x540d1b,_0x2ff130){return _0x540d1b[_0xf5ec('0xa')](_0xf5ec('0xb'),attributes,{'tableName':_0xf5ec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda79=['api','bluebird','request-promise','path','../../config/environment','./license.attributes','exports','define','License','lodash','util'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xda79,0x82));var _0x9da7=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xda79[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x9da7('0x0'));var util=require(_0x9da7('0x1'));var logger=require('../../config/logger')(_0x9da7('0x2'));var moment=require('moment');var BPromise=require(_0x9da7('0x3'));var rp=require(_0x9da7('0x4'));var fs=require('fs');var path=require(_0x9da7('0x5'));var rimraf=require('rimraf');var config=require(_0x9da7('0x6'));var attributes=require(_0x9da7('0x7'));module[_0x9da7('0x8')]=function(_0x14821c,_0x2d1a1){return _0x14821c[_0x9da7('0x9')](_0x9da7('0xa'),attributes,{'tableName':'license','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 bea96fc..23163a5 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 _0x657b=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x657b,0x131));var _0xb657=function(_0xbb60c,_0x17e203){_0xbb60c=_0xbb60c-0x0;var _0x3bf35b=_0x657b[_0xbb60c];return _0x3bf35b;};'use strict';var _=require(_0xb657('0x0'));var util=require(_0xb657('0x1'));var moment=require(_0xb657('0x2'));var BPromise=require(_0xb657('0x3'));var rs=require(_0xb657('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb657('0x5'))['db'];var utils=require(_0xb657('0x6'));var logger=require('../../config/logger')(_0xb657('0x7'));var config=require(_0xb657('0x8'));var jayson=require(_0xb657('0x9'));var client=jayson[_0xb657('0xa')][_0xb657('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d54f6,_0x471e78,_0x55acdf){return new BPromise(function(_0x326dd7,_0x42a844){return client[_0xb657('0xc')](_0x5d54f6,_0x55acdf)['then'](function(_0x36b334){logger['info'](_0xb657('0xd'),_0x471e78,'request\x20sent');logger[_0xb657('0xe')](_0xb657('0xf'),_0x471e78,_0xb657('0x10'),JSON['stringify'](_0x36b334));if(_0x36b334[_0xb657('0x11')]){if(_0x36b334[_0xb657('0x11')][_0xb657('0x12')]===0x1f4){logger[_0xb657('0x11')]('License,\x20%s,\x20%s',_0x471e78,_0x36b334[_0xb657('0x11')][_0xb657('0x13')]);return _0x42a844(_0x36b334['error'][_0xb657('0x13')]);}logger[_0xb657('0x11')](_0xb657('0xd'),_0x471e78,_0x36b334[_0xb657('0x11')]['message']);return _0x326dd7(_0x36b334[_0xb657('0x11')][_0xb657('0x13')]);}else{logger['info']('License,\x20%s,\x20%s',_0x471e78,_0xb657('0x10'));_0x326dd7(_0x36b334[_0xb657('0x14')][_0xb657('0x13')]);}})[_0xb657('0x15')](function(_0x17c045){logger[_0xb657('0x11')](_0xb657('0xd'),_0x471e78,_0x17c045);_0x42a844(_0x17c045);});});} \ No newline at end of file +var _0x7d13=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','result','catch','util','bluebird'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x7d13,0x6c));var _0x37d1=function(_0x2fc69b,_0x55537d){_0x2fc69b=_0x2fc69b-0x0;var _0x25e3c9=_0x7d13[_0x2fc69b];return _0x25e3c9;};'use strict';var _=require('lodash');var util=require(_0x37d1('0x0'));var moment=require('moment');var BPromise=require(_0x37d1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37d1('0x2'));var db=require(_0x37d1('0x3'))['db'];var utils=require(_0x37d1('0x4'));var logger=require(_0x37d1('0x5'))(_0x37d1('0x6'));var config=require('../../config/environment');var jayson=require(_0x37d1('0x7'));var client=jayson[_0x37d1('0x8')][_0x37d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27ac1d,_0x5146e3,_0x9302bd){return new BPromise(function(_0x41dfaa,_0x115eca){return client[_0x37d1('0xa')](_0x27ac1d,_0x9302bd)[_0x37d1('0xb')](function(_0x636359){logger[_0x37d1('0xc')]('License,\x20%s,\x20%s',_0x5146e3,'request\x20sent');logger[_0x37d1('0xd')](_0x37d1('0xe'),_0x5146e3,'request\x20sent',JSON[_0x37d1('0xf')](_0x636359));if(_0x636359[_0x37d1('0x10')]){if(_0x636359[_0x37d1('0x10')][_0x37d1('0x11')]===0x1f4){logger[_0x37d1('0x10')](_0x37d1('0x12'),_0x5146e3,_0x636359[_0x37d1('0x10')][_0x37d1('0x13')]);return _0x115eca(_0x636359['error'][_0x37d1('0x13')]);}logger[_0x37d1('0x10')]('License,\x20%s,\x20%s',_0x5146e3,_0x636359[_0x37d1('0x10')][_0x37d1('0x13')]);return _0x41dfaa(_0x636359['error'][_0x37d1('0x13')]);}else{logger[_0x37d1('0xc')]('License,\x20%s,\x20%s',_0x5146e3,'request\x20sent');_0x41dfaa(_0x636359[_0x37d1('0x14')][_0x37d1('0x13')]);}})[_0x37d1('0x15')](function(_0x5ded71){logger[_0x37d1('0x10')](_0x37d1('0x12'),_0x5146e3,_0x5ded71);_0x115eca(_0x5ded71);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index f5c7daf..ac1f0e5 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 _0xd2e5=['addSmtp','addApplications','addAgents','update','delete','removeDispositions','removeAnswers','removeImap','destroy','removeAgents','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','get','/describe','describe','/:id','isAuthenticated','show','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','/:id/dispositions','addDisposition','post','/:id/canned_answers','create','addImap'];(function(_0x1789bc,_0x1acf84){var _0x35efd1=function(_0x2329b2){while(--_0x2329b2){_0x1789bc['push'](_0x1789bc['shift']());}};_0x35efd1(++_0x1acf84);}(_0xd2e5,0x15b));var _0x5d2e=function(_0xcd39c8,_0x2ad166){_0xcd39c8=_0xcd39c8-0x0;var _0x463dfc=_0xd2e5[_0xcd39c8];return _0x463dfc;};'use strict';var multer=require('multer');var util=require(_0x5d2e('0x0'));var path=require(_0x5d2e('0x1'));var timeout=require(_0x5d2e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5d2e('0x3'));var auth=require(_0x5d2e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailAccount.controller');router[_0x5d2e('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x5d2e('0x6'),auth['isAuthenticated'](),controller[_0x5d2e('0x7')]);router['get'](_0x5d2e('0x8'),auth[_0x5d2e('0x9')](),controller[_0x5d2e('0xa')]);router[_0x5d2e('0x5')]('/:id/dispositions',auth[_0x5d2e('0x9')](),controller[_0x5d2e('0xb')]);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x5d2e('0xc')]);router[_0x5d2e('0x5')](_0x5d2e('0xd'),auth[_0x5d2e('0x9')](),controller[_0x5d2e('0xe')]);router['get'](_0x5d2e('0xf'),auth[_0x5d2e('0x9')](),controller['getSmtp']);router['get'](_0x5d2e('0x10'),auth['isAuthenticated'](),controller[_0x5d2e('0x11')]);router[_0x5d2e('0x5')](_0x5d2e('0x12'),auth[_0x5d2e('0x9')](),controller[_0x5d2e('0x13')]);router[_0x5d2e('0x5')]('/:id/messages',auth[_0x5d2e('0x9')](),controller[_0x5d2e('0x14')]);router[_0x5d2e('0x5')](_0x5d2e('0x15'),auth[_0x5d2e('0x9')](),controller[_0x5d2e('0x16')]);router[_0x5d2e('0x5')](_0x5d2e('0x17'),auth[_0x5d2e('0x9')](),controller[_0x5d2e('0x18')]);router['post'](_0x5d2e('0x19'),auth[_0x5d2e('0x9')](),controller[_0x5d2e('0x1a')]);router[_0x5d2e('0x1b')](_0x5d2e('0x1c'),auth[_0x5d2e('0x9')](),controller['addAnswer']);router[_0x5d2e('0x1b')]('/',auth[_0x5d2e('0x9')](),controller[_0x5d2e('0x1d')]);router[_0x5d2e('0x1b')](_0x5d2e('0xd'),auth[_0x5d2e('0x9')](),controller[_0x5d2e('0x1e')]);router['post'](_0x5d2e('0xf'),auth[_0x5d2e('0x9')](),controller[_0x5d2e('0x1f')]);router[_0x5d2e('0x1b')](_0x5d2e('0x10'),auth[_0x5d2e('0x9')](),controller['addInteraction']);router[_0x5d2e('0x1b')](_0x5d2e('0x12'),auth[_0x5d2e('0x9')](),controller[_0x5d2e('0x20')]);router[_0x5d2e('0x1b')]('/:id/send',auth[_0x5d2e('0x9')](),controller['send']);router[_0x5d2e('0x1b')]('/:id/users',auth[_0x5d2e('0x9')](),controller[_0x5d2e('0x21')]);router['put'](_0x5d2e('0x8'),auth[_0x5d2e('0x9')](),controller[_0x5d2e('0x22')]);router[_0x5d2e('0x23')](_0x5d2e('0x19'),auth['isAuthenticated'](),controller[_0x5d2e('0x24')]);router[_0x5d2e('0x23')](_0x5d2e('0x1c'),auth[_0x5d2e('0x9')](),controller[_0x5d2e('0x25')]);router[_0x5d2e('0x23')](_0x5d2e('0xd'),auth[_0x5d2e('0x9')](),controller[_0x5d2e('0x26')]);router[_0x5d2e('0x23')](_0x5d2e('0xf'),auth[_0x5d2e('0x9')](),controller['removeSmtp']);router[_0x5d2e('0x23')](_0x5d2e('0x8'),auth[_0x5d2e('0x9')](),controller[_0x5d2e('0x27')]);router[_0x5d2e('0x23')]('/:id/users',auth['isAuthenticated'](),controller[_0x5d2e('0x28')]);module[_0x5d2e('0x29')]=router; \ No newline at end of file +var _0xa962=['addInteraction','addApplications','/:id/send','send','delete','/:id/dispositions','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','isAuthenticated','index','get','/describe','/:id','show','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','addImap','addSmtp'];(function(_0x5ee607,_0x5ef350){var _0x49a75a=function(_0x3fac2b){while(--_0x3fac2b){_0x5ee607['push'](_0x5ee607['shift']());}};_0x49a75a(++_0x5ef350);}(_0xa962,0xd1));var _0x2a96=function(_0x3f7598,_0x212e37){_0x3f7598=_0x3f7598-0x0;var _0x51fb16=_0xa962[_0x3f7598];return _0x51fb16;};'use strict';var multer=require(_0x2a96('0x0'));var util=require(_0x2a96('0x1'));var path=require(_0x2a96('0x2'));var timeout=require('connect-timeout');var express=require(_0x2a96('0x3'));var router=express[_0x2a96('0x4')]();var fs_extra=require(_0x2a96('0x5'));var auth=require(_0x2a96('0x6'));var interaction=require(_0x2a96('0x7'));var config=require('../../config/environment');var controller=require(_0x2a96('0x8'));router['get']('/',auth[_0x2a96('0x9')](),controller[_0x2a96('0xa')]);router[_0x2a96('0xb')](_0x2a96('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x2a96('0xd'),auth[_0x2a96('0x9')](),controller[_0x2a96('0xe')]);router[_0x2a96('0xb')]('/:id/dispositions',auth[_0x2a96('0x9')](),controller[_0x2a96('0xf')]);router['get'](_0x2a96('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x2a96('0xb')](_0x2a96('0x11'),auth[_0x2a96('0x9')](),controller[_0x2a96('0x12')]);router[_0x2a96('0xb')](_0x2a96('0x13'),auth['isAuthenticated'](),controller[_0x2a96('0x14')]);router[_0x2a96('0xb')](_0x2a96('0x15'),auth[_0x2a96('0x9')](),controller[_0x2a96('0x16')]);router[_0x2a96('0xb')](_0x2a96('0x17'),auth['isAuthenticated'](),controller[_0x2a96('0x18')]);router[_0x2a96('0xb')](_0x2a96('0x19'),auth[_0x2a96('0x9')](),controller[_0x2a96('0x1a')]);router[_0x2a96('0xb')](_0x2a96('0x1b'),auth[_0x2a96('0x9')](),controller[_0x2a96('0x1c')]);router[_0x2a96('0xb')](_0x2a96('0x1d'),auth['isAuthenticated'](),controller[_0x2a96('0x1e')]);router[_0x2a96('0x1f')]('/:id/dispositions',auth[_0x2a96('0x9')](),controller[_0x2a96('0x20')]);router[_0x2a96('0x1f')](_0x2a96('0x10'),auth[_0x2a96('0x9')](),controller[_0x2a96('0x21')]);router[_0x2a96('0x1f')]('/',auth[_0x2a96('0x9')](),controller['create']);router[_0x2a96('0x1f')]('/:id/in_servers',auth[_0x2a96('0x9')](),controller[_0x2a96('0x22')]);router[_0x2a96('0x1f')](_0x2a96('0x13'),auth[_0x2a96('0x9')](),controller[_0x2a96('0x23')]);router[_0x2a96('0x1f')](_0x2a96('0x15'),auth[_0x2a96('0x9')](),controller[_0x2a96('0x24')]);router[_0x2a96('0x1f')](_0x2a96('0x17'),auth['isAuthenticated'](),controller[_0x2a96('0x25')]);router[_0x2a96('0x1f')](_0x2a96('0x26'),auth[_0x2a96('0x9')](),controller[_0x2a96('0x27')]);router[_0x2a96('0x1f')](_0x2a96('0x1d'),auth['isAuthenticated'](),controller['addAgents']);router['put']('/:id',auth[_0x2a96('0x9')](),controller['update']);router[_0x2a96('0x28')](_0x2a96('0x29'),auth['isAuthenticated'](),controller[_0x2a96('0x2a')]);router[_0x2a96('0x28')](_0x2a96('0x10'),auth[_0x2a96('0x9')](),controller[_0x2a96('0x2b')]);router[_0x2a96('0x28')](_0x2a96('0x11'),auth[_0x2a96('0x9')](),controller[_0x2a96('0x2c')]);router[_0x2a96('0x28')](_0x2a96('0x13'),auth[_0x2a96('0x9')](),controller[_0x2a96('0x2d')]);router[_0x2a96('0x28')](_0x2a96('0xd'),auth[_0x2a96('0x9')](),controller[_0x2a96('0x2e')]);router['delete'](_0x2a96('0x1d'),auth[_0x2a96('0x9')](),controller[_0x2a96('0x2f')]);module[_0x2a96('0x30')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 417675e..80e4843 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 _0x78e1=['STRING','BOOLEAN','TEXT','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','sequelize','exports'];(function(_0x83fc28,_0x5a2817){var _0x40ffcf=function(_0xef4ee2){while(--_0xef4ee2){_0x83fc28['push'](_0x83fc28['shift']());}};_0x40ffcf(++_0x5a2817);}(_0x78e1,0x169));var _0x178e=function(_0x3413c2,_0x5acd27){_0x3413c2=_0x3413c2-0x0;var _0x3c3c46=_0x78e1[_0x3413c2];return _0x3c3c46;};'use strict';var Sequelize=require(_0x178e('0x0'));module[_0x178e('0x1')]={'description':{'type':Sequelize[_0x178e('0x2')]},'name':{'type':Sequelize[_0x178e('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x178e('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x178e('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x178e('0x4')]},'markAsUnread':{'type':Sequelize[_0x178e('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x178e('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x178e('0x5')](0x2)[_0x178e('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x178e('0x4')],'defaultValue':function(){return _0x178e('0x7');}},'notificationSound':{'type':Sequelize[_0x178e('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x178e('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x178e('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x178e('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x178e('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x178e('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x178e('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1d26ef){if(!_0x1d26ef)this[_0x178e('0x9')](_0x178e('0xa'),null);this[_0x178e('0x9')]('mandatoryDisposition',_0x1d26ef);}}}; \ No newline at end of file +var _0x76ff=['STRING','TEXT','BOOLEAN','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','exports'];(function(_0x2c244e,_0x597668){var _0x53b7a4=function(_0x52a71a){while(--_0x52a71a){_0x2c244e['push'](_0x2c244e['shift']());}};_0x53b7a4(++_0x597668);}(_0x76ff,0x11f));var _0xf76f=function(_0x139afb,_0x526074){_0x139afb=_0x139afb-0x0;var _0x13dcd8=_0x76ff[_0x139afb];return _0x13dcd8;};'use strict';var Sequelize=require('sequelize');module[_0xf76f('0x0')]={'description':{'type':Sequelize[_0xf76f('0x1')]},'name':{'type':Sequelize[_0xf76f('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xf76f('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xf76f('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xf76f('0x2')]},'markAsUnread':{'type':Sequelize[_0xf76f('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xf76f('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0xf76f('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xf76f('0x2')],'defaultValue':function(){return _0xf76f('0x5');}},'notificationSound':{'type':Sequelize[_0xf76f('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf76f('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf76f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf76f('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf76f('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xf76f('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf76f('0x8'),'set':function(_0x469e88){if(!_0x469e88)this['setDataValue'](_0xf76f('0x9'),null);this[_0xf76f('0xa')](_0xf76f('0xb'),_0x469e88);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 817675d..0d8e1ee 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 _0x89e7=['removeDispositions','addAnswer','CannedAnswer','create','removeAnswers','ids','key','email','ListId','isNil','active','description','cservice','cauthentication','user','cuser','pass','cpassword','authentication','host','port','service','password','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','CmContact','User','fullname','internal','Tag','Tags','color','tag','transaction','MailApplication','priority','getApplications','getMessages','MailMessage','nolimit','split','format','inlineCss','true','CmList','List','Contacts','updatedAt','from','%s\x20<%s>','attachments','root','server/files/attachments','basename','auth','secure','List\x20not\x20found','defaults','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','omit','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','MailAccounts','UserProfileResource','stack','name','send','index','MailServerIn','Imap','Smtp','Pause','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','MailAccount','findAll','rows','show','params','find','body','MailServerOut','mandatoryDispositionPause','describe','addDisposition','MailAccountId','getDispositions','findOne','Disposition'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x89e7,0x1e2));var _0x789e=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x89e7[_0x57b54c];return _0x59cc19;};'use strict';var pdf=require(_0x789e('0x0'));var emlformat=require(_0x789e('0x1'));var rimraf=require(_0x789e('0x2'));var zipdir=require(_0x789e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x789e('0x4'));var moment=require('moment');var BPromise=require(_0x789e('0x5'));var Mustache=require(_0x789e('0x6'));var util=require('util');var path=require(_0x789e('0x7'));var sox=require(_0x789e('0x8'));var csv=require(_0x789e('0x9'));var ejs=require(_0x789e('0xa'));var fs=require('fs');var fs_extra=require(_0x789e('0xb'));var _=require(_0x789e('0xc'));var squel=require(_0x789e('0xd'));var crypto=require('crypto');var jsforce=require(_0x789e('0xe'));var deskjs=require(_0x789e('0xf'));var toCsv=require(_0x789e('0x9'));var querystring=require('querystring');var Papa=require(_0x789e('0x10'));var htmlToText=require(_0x789e('0x11'));var juice=require('juice');var Redis=require(_0x789e('0x12'));var authService=require(_0x789e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x789e('0x14'));var hardwareService=require(_0x789e('0x15'));var logger=require(_0x789e('0x16'))('api');var utils=require(_0x789e('0x17'));var config=require(_0x789e('0x18'));var licenseUtil=require(_0x789e('0x19'));var db=require(_0x789e('0x1a'))['db'];config[_0x789e('0x1b')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x789e('0x1c'))(new Redis(config[_0x789e('0x1b')]));require('./mailAccount.socket')[_0x789e('0x1d')](socket);var jayson=require(_0x789e('0x1e'));var client=jayson[_0x789e('0x1f')][_0x789e('0x20')]({'port':0x232b});function respondWithRpcPromise(_0x51e08f,_0x26f777,_0x161431,_0x248b3c){return new BPromise(function(_0x317785,_0x514a0f){var _0x4b1466=_0x248b3c||client;return _0x4b1466[_0x789e('0x21')](_0x51e08f,_0x161431)[_0x789e('0x22')](function(_0x1cd99a){logger[_0x789e('0x23')](_0x789e('0x24'),_0x26f777,_0x789e('0x25'));logger[_0x789e('0x26')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x26f777,_0x789e('0x25'),JSON[_0x789e('0x27')](_0x1cd99a));if(_0x1cd99a[_0x789e('0x28')]){if(_0x1cd99a[_0x789e('0x28')][_0x789e('0x29')]===0x1f4){logger[_0x789e('0x28')](_0x789e('0x24'),_0x26f777,_0x1cd99a[_0x789e('0x28')][_0x789e('0x2a')]);return _0x514a0f(_0x1cd99a[_0x789e('0x28')][_0x789e('0x2a')]);}logger[_0x789e('0x28')](_0x789e('0x24'),_0x26f777,_0x1cd99a['error'][_0x789e('0x2a')]);return _0x317785(_0x1cd99a['error'][_0x789e('0x2a')]);}else{logger[_0x789e('0x23')](_0x789e('0x24'),_0x26f777,'request\x20sent');_0x317785(_0x1cd99a[_0x789e('0x2b')]['message']);}})[_0x789e('0x2c')](function(_0x2904c8){logger[_0x789e('0x28')](_0x789e('0x24'),_0x26f777,_0x2904c8);_0x514a0f(_0x2904c8);});});}function respondWithStatusCode(_0x3b8d32,_0x4936d2){_0x4936d2=_0x4936d2||0xcc;return function(_0x4232bf){if(_0x4232bf){return _0x3b8d32['sendStatus'](_0x4936d2);}return _0x3b8d32[_0x789e('0x2d')](_0x4936d2)[_0x789e('0x2e')]();};}function respondWithResult(_0x57cff6,_0x520d79){_0x520d79=_0x520d79||0xc8;return function(_0x481e53){if(_0x481e53){return _0x57cff6['status'](_0x520d79)['json'](_0x481e53);}};}function respondWithFilteredResult(_0x5ae7da,_0xaacd17){return function(_0x836b74){if(_0x836b74){var _0x3b456d=_0x836b74[_0x789e('0x2f')],_0x15a25d=_0xaacd17[_0x789e('0x30')],_0x55a961=_0xaacd17[_0x789e('0x30')]+_0xaacd17['limit'],_0x5bc6a9;if(_0x55a961>=_0x3b456d){_0x55a961=_0x3b456d;_0x5bc6a9=0xc8;}else{_0x5bc6a9=0xce;}_0x5ae7da[_0x789e('0x2d')](_0x5bc6a9);return _0x5ae7da[_0x789e('0x31')](_0x789e('0x32'),_0x15a25d+'-'+_0x55a961+'/'+_0x3b456d)[_0x789e('0x33')](_0x836b74);}return null;};}function patchUpdates(_0x46d9d5){return function(_0x5ef9bc){try{jsonpatch[_0x789e('0x34')](_0x5ef9bc,_0x46d9d5,!![]);}catch(_0x124477){return BPromise[_0x789e('0x35')](_0x124477);}return _0x5ef9bc[_0x789e('0x36')]();};}function saveUpdates(_0x4a56b3,_0x27a9f2){return function(_0x842919){if(_0x842919){return _0x842919[_0x789e('0x37')](_0x4a56b3)[_0x789e('0x22')](function(_0xcf9ac1){return _0xcf9ac1;});}return null;};}function removeEntity(_0x35e28c,_0x5d6d0e){return function(_0x15d389){if(_0x15d389){return _0x15d389[_0x789e('0x38')]()[_0x789e('0x22')](function(){var _0x24fd8a=_0x15d389['get']({'plain':!![]});var _0x216da7=_0x789e('0x39');return db[_0x789e('0x3a')]['destroy']({'where':{'type':_0x216da7,'resourceId':_0x24fd8a['id']}})[_0x789e('0x22')](function(){return _0x15d389;});})[_0x789e('0x22')](function(){_0x35e28c[_0x789e('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53f824,_0x1719bd){return function(_0x1a28f0){if(!_0x1a28f0){_0x53f824['sendStatus'](0x194);}return _0x1a28f0;};}function handleError(_0x4a38e9,_0x9097bd){_0x9097bd=_0x9097bd||0x1f4;return function(_0x4bb516){logger[_0x789e('0x28')](_0x4bb516[_0x789e('0x3b')]);if(_0x4bb516[_0x789e('0x3c')]){delete _0x4bb516[_0x789e('0x3c')];}_0x4a38e9['status'](_0x9097bd)[_0x789e('0x3d')](_0x4bb516);};}exports[_0x789e('0x3e')]=function(_0x22ed07,_0x45e4a1){var _0x36a23b={'include':[{'model':db[_0x789e('0x3f')],'as':_0x789e('0x40')},{'model':db['MailServerOut'],'as':_0x789e('0x41')},{'model':db[_0x789e('0x42')],'as':'mandatoryDispositionPause'}]},_0x4c68d5={},_0x1fecd9={'count':0x0,'rows':[]};var _0x1e559b=_[_0x789e('0x43')](db['MailAccount'][_0x789e('0x44')],function(_0x4b1902){return{'name':_0x4b1902[_0x789e('0x45')],'type':_0x4b1902[_0x789e('0x46')]['key']};});_0x4c68d5[_0x789e('0x47')]=_['map'](_0x1e559b,_0x789e('0x3c'));_0x4c68d5[_0x789e('0x48')]=_[_0x789e('0x49')](_0x22ed07[_0x789e('0x48')]);_0x4c68d5[_0x789e('0x4a')]=_[_0x789e('0x4b')](_0x4c68d5['model'],_0x4c68d5['query']);_0x36a23b[_0x789e('0x4c')]=_['intersection'](_0x4c68d5[_0x789e('0x47')],qs['fields'](_0x22ed07[_0x789e('0x48')][_0x789e('0x4d')]));_0x36a23b['attributes']=_0x36a23b['attributes'][_0x789e('0x4e')]?_0x36a23b[_0x789e('0x4c')]:_0x4c68d5[_0x789e('0x47')];if(!_0x22ed07['query'][_0x789e('0x4f')]('nolimit')){_0x36a23b[_0x789e('0x50')]=qs[_0x789e('0x50')](_0x22ed07[_0x789e('0x48')][_0x789e('0x50')]);_0x36a23b[_0x789e('0x30')]=qs[_0x789e('0x30')](_0x22ed07[_0x789e('0x48')][_0x789e('0x30')]);}_0x36a23b[_0x789e('0x51')]=qs[_0x789e('0x52')](_0x22ed07[_0x789e('0x48')][_0x789e('0x52')]);_0x36a23b[_0x789e('0x53')]=qs[_0x789e('0x4a')](_[_0x789e('0x54')](_0x22ed07['query'],_0x4c68d5[_0x789e('0x4a')]),_0x1e559b);if(_0x22ed07['query'][_0x789e('0x55')]){_0x36a23b['where']=_[_0x789e('0x56')](_0x36a23b[_0x789e('0x53')],{'$or':_[_0x789e('0x43')](_0x1e559b,function(_0x36c714){if(_0x36c714['type']!==_0x789e('0x57')){var _0x2b518b={};_0x2b518b[_0x36c714['name']]={'$like':'%'+_0x22ed07[_0x789e('0x48')]['filter']+'%'};return _0x2b518b;}})});}_0x36a23b=_['merge']({},_0x36a23b,_0x22ed07[_0x789e('0x58')]);var _0xc48645={'where':_0x36a23b[_0x789e('0x53')]};return db['MailAccount'][_0x789e('0x2f')](_0xc48645)[_0x789e('0x22')](function(_0xfac2e1){_0x1fecd9[_0x789e('0x2f')]=_0xfac2e1;if(_0x22ed07[_0x789e('0x48')][_0x789e('0x59')]){_0x36a23b[_0x789e('0x5a')]=[{'all':!![]}];}return db[_0x789e('0x5b')][_0x789e('0x5c')](_0x36a23b);})['then'](function(_0x584d30){_0x1fecd9[_0x789e('0x5d')]=_0x584d30;return _0x1fecd9;})[_0x789e('0x22')](respondWithFilteredResult(_0x45e4a1,_0x36a23b))[_0x789e('0x2c')](handleError(_0x45e4a1,null));};exports[_0x789e('0x5e')]=function(_0x13cefd,_0x58e60a){var _0x550f9b={'raw':![],'where':{'id':_0x13cefd[_0x789e('0x5f')]['id']},'include':[{'model':db[_0x789e('0x3f')],'as':_0x789e('0x40')},{'model':db['MailServerOut'],'as':_0x789e('0x41')},{'model':db[_0x789e('0x42')],'as':'mandatoryDispositionPause'}]},_0x5e0184={};_0x5e0184[_0x789e('0x47')]=_[_0x789e('0x49')](db['MailAccount'][_0x789e('0x44')]);_0x5e0184[_0x789e('0x48')]=_[_0x789e('0x49')](_0x13cefd['query']);_0x5e0184['filters']=_[_0x789e('0x4b')](_0x5e0184[_0x789e('0x47')],_0x5e0184[_0x789e('0x48')]);_0x550f9b[_0x789e('0x4c')]=_['intersection'](_0x5e0184[_0x789e('0x47')],qs[_0x789e('0x4d')](_0x13cefd['query']['fields']));_0x550f9b[_0x789e('0x4c')]=_0x550f9b[_0x789e('0x4c')][_0x789e('0x4e')]?_0x550f9b[_0x789e('0x4c')]:_0x5e0184[_0x789e('0x47')];if(_0x13cefd[_0x789e('0x48')][_0x789e('0x59')]){_0x550f9b[_0x789e('0x5a')]=[{'all':!![]}];}_0x550f9b=_['merge']({},_0x550f9b,_0x13cefd['options']);return db['MailAccount'][_0x789e('0x60')](_0x550f9b)[_0x789e('0x22')](handleEntityNotFound(_0x58e60a,null))['then'](respondWithResult(_0x58e60a,null))[_0x789e('0x2c')](handleError(_0x58e60a,null));};exports[_0x789e('0x37')]=function(_0x3f989f,_0xacee6a){if(_0x3f989f[_0x789e('0x61')]['id']){delete _0x3f989f[_0x789e('0x61')]['id'];}return db['MailAccount'][_0x789e('0x60')]({'where':{'id':_0x3f989f[_0x789e('0x5f')]['id']},'include':[{'model':db[_0x789e('0x3f')],'as':'Imap'},{'model':db[_0x789e('0x62')],'as':_0x789e('0x41')},{'model':db['Pause'],'as':_0x789e('0x63')}]})[_0x789e('0x22')](handleEntityNotFound(_0xacee6a,null))['then'](saveUpdates(_0x3f989f[_0x789e('0x61')],null))[_0x789e('0x22')](function(_0x43298c){if(_0x43298c&&_0x3f989f['body'][_0x789e('0x40')]){return db['MailServerIn'][_0x789e('0x37')](_0x3f989f[_0x789e('0x61')][_0x789e('0x40')],{'where':{'MailAccountId':_0x43298c['id']}})[_0x789e('0x22')](function(){return _0x43298c;});}return _0x43298c;})[_0x789e('0x22')](function(_0x2f216c){if(_0x2f216c&&_0x3f989f[_0x789e('0x61')][_0x789e('0x41')]){return db['MailServerOut']['update'](_0x3f989f[_0x789e('0x61')]['Smtp'],{'where':{'MailAccountId':_0x2f216c['id']}})[_0x789e('0x22')](function(){return _0x2f216c;});}return _0x2f216c;})[_0x789e('0x22')](respondWithResult(_0xacee6a,null))['catch'](handleError(_0xacee6a,null));};exports[_0x789e('0x64')]=function(_0x5144e8,_0x243fbf){return db[_0x789e('0x5b')][_0x789e('0x64')]()[_0x789e('0x22')](respondWithResult(_0x243fbf,null))[_0x789e('0x2c')](handleError(_0x243fbf,null));};exports[_0x789e('0x65')]=function(_0x2356b6,_0x51f4ae,_0x460dda){if(_0x2356b6[_0x789e('0x61')]['id']){delete _0x2356b6['body']['id'];}return db[_0x789e('0x5b')][_0x789e('0x60')]({'where':{'id':_0x2356b6[_0x789e('0x5f')]['id']}})[_0x789e('0x22')](handleEntityNotFound(_0x51f4ae,null))[_0x789e('0x22')](function(_0x16f0ed){if(_0x16f0ed){_0x2356b6['body'][_0x789e('0x66')]=_0x16f0ed['id'];return db['Disposition']['create'](_0x2356b6[_0x789e('0x61')]);}})[_0x789e('0x22')](respondWithResult(_0x51f4ae,null))[_0x789e('0x2c')](handleError(_0x51f4ae,null));};exports[_0x789e('0x67')]=function(_0xfa0fbb,_0x11fe42,_0x3df39e){var _0x3ff4eb={'raw':![],'where':{}};var _0x4a98aa={};var _0x685cd1={'count':0x0,'rows':[]};return db[_0x789e('0x5b')][_0x789e('0x68')]({'where':{'id':_0xfa0fbb[_0x789e('0x5f')]['id']}})[_0x789e('0x22')](handleEntityNotFound(_0x11fe42,null))['then'](function(_0x5212a8){if(_0x5212a8){_0x4a98aa[_0x789e('0x47')]=_[_0x789e('0x49')](db['Disposition'][_0x789e('0x44')]);_0x4a98aa['query']=_[_0x789e('0x49')](_0xfa0fbb[_0x789e('0x48')]);_0x4a98aa[_0x789e('0x4a')]=_[_0x789e('0x4b')](_0x4a98aa['model'],_0x4a98aa[_0x789e('0x48')]);_0x3ff4eb[_0x789e('0x4c')]=_['intersection'](_0x4a98aa[_0x789e('0x47')],qs[_0x789e('0x4d')](_0xfa0fbb['query'][_0x789e('0x4d')]));_0x3ff4eb[_0x789e('0x4c')]=_0x3ff4eb[_0x789e('0x4c')][_0x789e('0x4e')]?_0x3ff4eb[_0x789e('0x4c')]:_0x4a98aa[_0x789e('0x47')];if(!_0xfa0fbb[_0x789e('0x48')]['hasOwnProperty']('nolimit')){_0x3ff4eb[_0x789e('0x50')]=qs[_0x789e('0x50')](_0xfa0fbb[_0x789e('0x48')][_0x789e('0x50')]);_0x3ff4eb[_0x789e('0x30')]=qs[_0x789e('0x30')](_0xfa0fbb[_0x789e('0x48')]['offset']);}_0x3ff4eb[_0x789e('0x51')]=qs['sort'](_0xfa0fbb[_0x789e('0x48')][_0x789e('0x52')]);_0x3ff4eb['where']=qs[_0x789e('0x4a')](_[_0x789e('0x54')](_0xfa0fbb['query'],_0x4a98aa[_0x789e('0x4a')]));_0x3ff4eb['where'][_0x789e('0x66')]=_0x5212a8['id'];if(_0xfa0fbb[_0x789e('0x48')][_0x789e('0x55')]){_0x3ff4eb[_0x789e('0x53')]=_[_0x789e('0x56')](_0x3ff4eb[_0x789e('0x53')],{'$or':_[_0x789e('0x43')](_0x3ff4eb['attributes'],function(_0x87701){var _0x12e58f={};_0x12e58f[_0x87701]={'$like':'%'+_0xfa0fbb[_0x789e('0x48')][_0x789e('0x55')]+'%'};return _0x12e58f;})});}_0x3ff4eb=_[_0x789e('0x56')]({},_0x3ff4eb,_0xfa0fbb[_0x789e('0x58')]);return db[_0x789e('0x69')][_0x789e('0x2f')]({'where':_0x3ff4eb['where']})[_0x789e('0x22')](function(_0x4a09c8){_0x685cd1[_0x789e('0x2f')]=_0x4a09c8;if(_0xfa0fbb[_0x789e('0x48')][_0x789e('0x59')]){_0x3ff4eb[_0x789e('0x5a')]=[{'all':!![]}];}return db[_0x789e('0x69')][_0x789e('0x5c')](_0x3ff4eb);})['then'](function(_0x108b29){_0x685cd1[_0x789e('0x5d')]=_0x108b29;return _0x685cd1;});}})[_0x789e('0x22')](respondWithFilteredResult(_0x11fe42,_0x3ff4eb))[_0x789e('0x2c')](handleError(_0x11fe42,null));};exports[_0x789e('0x6a')]=function(_0x24e4f8,_0x36632a,_0x472e11){return db[_0x789e('0x5b')]['find']({'where':{'id':_0x24e4f8[_0x789e('0x5f')]['id']}})[_0x789e('0x22')](handleEntityNotFound(_0x36632a,null))['then'](function(_0x49b0fc){if(_0x49b0fc){return _0x49b0fc[_0x789e('0x6a')](_0x24e4f8['query']['ids']);}})[_0x789e('0x22')](respondWithStatusCode(_0x36632a,null))['catch'](handleError(_0x36632a,null));};exports[_0x789e('0x6b')]=function(_0x2888be,_0x24c90d,_0x838972){if(_0x2888be[_0x789e('0x61')]['id']){delete _0x2888be[_0x789e('0x61')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x2888be[_0x789e('0x5f')]['id']}})[_0x789e('0x22')](handleEntityNotFound(_0x24c90d,null))['then'](function(_0x34df29){if(_0x34df29){_0x2888be['body']['MailAccountId']=_0x34df29['id'];return db[_0x789e('0x6c')][_0x789e('0x6d')](_0x2888be[_0x789e('0x61')]);}})[_0x789e('0x22')](respondWithResult(_0x24c90d,null))[_0x789e('0x2c')](handleError(_0x24c90d,null));};exports['getAnswers']=function(_0x91f9b9,_0xa43d9b,_0x22245f){var _0x212ec9={'raw':![],'where':{}};var _0x1377d3={};var _0x29034f={'count':0x0,'rows':[]};return db['MailAccount'][_0x789e('0x68')]({'where':{'id':_0x91f9b9[_0x789e('0x5f')]['id']}})['then'](handleEntityNotFound(_0xa43d9b,null))[_0x789e('0x22')](function(_0x4e34fe){if(_0x4e34fe){_0x1377d3[_0x789e('0x47')]=_['keys'](db[_0x789e('0x6c')][_0x789e('0x44')]);_0x1377d3['query']=_[_0x789e('0x49')](_0x91f9b9['query']);_0x1377d3[_0x789e('0x4a')]=_[_0x789e('0x4b')](_0x1377d3['model'],_0x1377d3[_0x789e('0x48')]);_0x212ec9['attributes']=_[_0x789e('0x4b')](_0x1377d3[_0x789e('0x47')],qs[_0x789e('0x4d')](_0x91f9b9[_0x789e('0x48')]['fields']));_0x212ec9[_0x789e('0x4c')]=_0x212ec9[_0x789e('0x4c')]['length']?_0x212ec9[_0x789e('0x4c')]:_0x1377d3[_0x789e('0x47')];if(!_0x91f9b9[_0x789e('0x48')]['hasOwnProperty']('nolimit')){_0x212ec9['limit']=qs['limit'](_0x91f9b9[_0x789e('0x48')][_0x789e('0x50')]);_0x212ec9['offset']=qs[_0x789e('0x30')](_0x91f9b9[_0x789e('0x48')][_0x789e('0x30')]);}_0x212ec9[_0x789e('0x51')]=qs['sort'](_0x91f9b9['query'][_0x789e('0x52')]);_0x212ec9[_0x789e('0x53')]=qs[_0x789e('0x4a')](_[_0x789e('0x54')](_0x91f9b9[_0x789e('0x48')],_0x1377d3[_0x789e('0x4a')]));_0x212ec9[_0x789e('0x53')][_0x789e('0x66')]=_0x4e34fe['id'];if(_0x91f9b9[_0x789e('0x48')]['filter']){_0x212ec9[_0x789e('0x53')]=_['merge'](_0x212ec9[_0x789e('0x53')],{'$or':_[_0x789e('0x43')](_0x212ec9[_0x789e('0x4c')],function(_0xcdd817){var _0x45d906={};_0x45d906[_0xcdd817]={'$like':'%'+_0x91f9b9[_0x789e('0x48')][_0x789e('0x55')]+'%'};return _0x45d906;})});}_0x212ec9=_[_0x789e('0x56')]({},_0x212ec9,_0x91f9b9['options']);return db['CannedAnswer'][_0x789e('0x2f')]({'where':_0x212ec9[_0x789e('0x53')]})['then'](function(_0x45d1a3){_0x29034f[_0x789e('0x2f')]=_0x45d1a3;if(_0x91f9b9[_0x789e('0x48')][_0x789e('0x59')]){_0x212ec9[_0x789e('0x5a')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x212ec9);})[_0x789e('0x22')](function(_0xd7ed7a){_0x29034f[_0x789e('0x5d')]=_0xd7ed7a;return _0x29034f;});}})[_0x789e('0x22')](respondWithFilteredResult(_0xa43d9b,_0x212ec9))['catch'](handleError(_0xa43d9b,null));};exports[_0x789e('0x6e')]=function(_0x3e55e7,_0x1dab01,_0x3cfd61){return db[_0x789e('0x5b')]['find']({'where':{'id':_0x3e55e7[_0x789e('0x5f')]['id']}})[_0x789e('0x22')](handleEntityNotFound(_0x1dab01,null))[_0x789e('0x22')](function(_0x4c8b9a){if(_0x4c8b9a){return _0x4c8b9a['removeAnswers'](_0x3e55e7[_0x789e('0x48')][_0x789e('0x6f')]);}})['then'](respondWithStatusCode(_0x1dab01,null))[_0x789e('0x2c')](handleError(_0x1dab01,null));};exports[_0x789e('0x6d')]=function(_0x130fef,_0x387389){var _0x53c3d6={'name':_0x130fef[_0x789e('0x61')]['name'],'key':_0x130fef['body'][_0x789e('0x70')],'email':_0x130fef[_0x789e('0x61')][_0x789e('0x71')],'ListId':_0x130fef['body'][_0x789e('0x72')],'active':!_[_0x789e('0x73')](_0x130fef['body'][_0x789e('0x74')])?_0x130fef[_0x789e('0x61')][_0x789e('0x74')]:!![],'description':_0x130fef[_0x789e('0x61')][_0x789e('0x75')]||null,'Imap':{},'Smtp':{}};if(_[_0x789e('0x73')](_0x130fef[_0x789e('0x61')][_0x789e('0x76')])){if(_0x130fef['body'][_0x789e('0x77')]){_0x53c3d6[_0x789e('0x40')][_0x789e('0x78')]=_0x53c3d6['Smtp']['user']=_0x130fef[_0x789e('0x61')][_0x789e('0x79')];_0x53c3d6[_0x789e('0x40')]['password']=_0x53c3d6[_0x789e('0x41')][_0x789e('0x7a')]=_0x130fef[_0x789e('0x61')][_0x789e('0x7b')];}else{_0x53c3d6[_0x789e('0x40')][_0x789e('0x7c')]=_0x53c3d6['Smtp'][_0x789e('0x7c')]=![];}_0x53c3d6[_0x789e('0x40')][_0x789e('0x7d')]=_0x130fef[_0x789e('0x61')][_0x789e('0x40')]['host'];_0x53c3d6[_0x789e('0x40')][_0x789e('0x7e')]=_0x130fef[_0x789e('0x61')][_0x789e('0x40')][_0x789e('0x7e')];_0x53c3d6['Smtp'][_0x789e('0x7d')]=_0x130fef['body'][_0x789e('0x41')][_0x789e('0x7d')];_0x53c3d6['Smtp'][_0x789e('0x7e')]=_0x130fef['body'][_0x789e('0x41')][_0x789e('0x7e')];}else{_0x53c3d6[_0x789e('0x40')][_0x789e('0x7f')]=_0x53c3d6[_0x789e('0x41')][_0x789e('0x7f')]=_0x130fef[_0x789e('0x61')]['cservice'];_0x53c3d6[_0x789e('0x40')][_0x789e('0x78')]=_0x53c3d6[_0x789e('0x41')][_0x789e('0x78')]=_0x130fef['body'][_0x789e('0x79')];_0x53c3d6[_0x789e('0x40')][_0x789e('0x80')]=_0x53c3d6[_0x789e('0x41')]['pass']=_0x130fef[_0x789e('0x61')][_0x789e('0x7b')];}return db['MailAccount'][_0x789e('0x6d')](_0x53c3d6,{'include':[{'model':db[_0x789e('0x62')],'as':'Smtp'},{'model':db[_0x789e('0x3f')],'as':_0x789e('0x40')}]})[_0x789e('0x22')](function(_0xc8621d){var _0x34d343=_0x130fef[_0x789e('0x78')][_0x789e('0x81')]({'plain':!![]});if(!_0x34d343)throw new Error(_0x789e('0x82'));if(_0x34d343[_0x789e('0x83')]===_0x789e('0x78')){var _0x3e6b53=_0xc8621d[_0x789e('0x81')]({'plain':!![]});return db[_0x789e('0x84')][_0x789e('0x60')]({'where':{'name':_0x789e('0x39'),'userProfileId':_0x34d343['userProfileId']},'raw':!![]})['then'](function(_0x28e949){if(_0x28e949&&_0x28e949['autoAssociation']===0x0){return db[_0x789e('0x3a')][_0x789e('0x6d')]({'name':_0x3e6b53[_0x789e('0x3c')],'resourceId':_0x3e6b53['id'],'type':_0x28e949[_0x789e('0x3c')],'sectionId':_0x28e949['id']},{})['then'](function(){return _0xc8621d;});}else{return _0xc8621d;}})[_0x789e('0x2c')](function(_0x50dfa1){logger[_0x789e('0x28')](_0x789e('0x85'),_0x50dfa1);throw _0x50dfa1;});}return _0xc8621d;})[_0x789e('0x22')](respondWithResult(_0x387389,0xc9))[_0x789e('0x2c')](handleError(_0x387389,null));};exports[_0x789e('0x86')]=function(_0x3533a0,_0x4fd386,_0x27bebd){return db['MailAccount'][_0x789e('0x68')]({'where':{'id':_0x3533a0[_0x789e('0x5f')]['id']}})[_0x789e('0x22')](handleEntityNotFound(_0x4fd386,null))[_0x789e('0x22')](function(_0x2291e2){if(_0x2291e2){return _0x2291e2['getImap']();}return null;})['then'](respondWithResult(_0x4fd386,null))[_0x789e('0x2c')](handleError(_0x4fd386,null));};exports[_0x789e('0x87')]=function(_0x402833,_0x2a48bb,_0x4caf68){if(_0x402833['body']['id']){delete _0x402833[_0x789e('0x61')]['id'];}return db['MailAccount'][_0x789e('0x60')]({'where':{'id':_0x402833[_0x789e('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2a48bb,null))[_0x789e('0x22')](function(_0x441702){if(_0x441702){_0x402833[_0x789e('0x61')][_0x789e('0x66')]=_0x441702['id'];return db[_0x789e('0x3f')][_0x789e('0x6d')](_0x402833['body']);}})[_0x789e('0x22')](respondWithResult(_0x2a48bb,null))[_0x789e('0x2c')](handleError(_0x2a48bb,null));};exports[_0x789e('0x88')]=function(_0x2f8704,_0x3d0e99,_0x4b14b6){return db[_0x789e('0x5b')][_0x789e('0x68')]({'where':{'id':_0x2f8704[_0x789e('0x5f')]['id']}})[_0x789e('0x22')](handleEntityNotFound(_0x3d0e99,null))['then'](function(_0x280c5a){if(_0x280c5a){return _0x280c5a[_0x789e('0x89')](null);}return null;})[_0x789e('0x22')](respondWithStatusCode(_0x3d0e99,null))[_0x789e('0x2c')](handleError(_0x3d0e99,null));};exports['getSmtp']=function(_0x5a680a,_0xb7e024,_0x1c0cdc){return db[_0x789e('0x5b')][_0x789e('0x68')]({'where':{'id':_0x5a680a[_0x789e('0x5f')]['id']}})[_0x789e('0x22')](handleEntityNotFound(_0xb7e024,null))[_0x789e('0x22')](function(_0x224d3a){if(_0x224d3a){return _0x224d3a[_0x789e('0x8a')]();}return null;})['then'](respondWithResult(_0xb7e024,null))['catch'](handleError(_0xb7e024,null));};exports[_0x789e('0x8b')]=function(_0x21fec0,_0x598cb0,_0x2b8c67){if(_0x21fec0[_0x789e('0x61')]['id']){delete _0x21fec0[_0x789e('0x61')]['id'];}return db[_0x789e('0x5b')][_0x789e('0x60')]({'where':{'id':_0x21fec0[_0x789e('0x5f')]['id']}})['then'](handleEntityNotFound(_0x598cb0,null))[_0x789e('0x22')](function(_0x2fd3fb){if(_0x2fd3fb){_0x21fec0['body'][_0x789e('0x66')]=_0x2fd3fb['id'];return db[_0x789e('0x62')][_0x789e('0x6d')](_0x21fec0['body']);}})[_0x789e('0x22')](respondWithResult(_0x598cb0,null))[_0x789e('0x2c')](handleError(_0x598cb0,null));};exports[_0x789e('0x8c')]=function(_0x194d35,_0x583e9c,_0x54f8e3){return db['MailAccount'][_0x789e('0x68')]({'where':{'id':_0x194d35['params']['id']}})[_0x789e('0x22')](handleEntityNotFound(_0x583e9c,null))['then'](function(_0x24e558){if(_0x24e558){return _0x24e558[_0x789e('0x8d')](null);}return null;})[_0x789e('0x22')](respondWithStatusCode(_0x583e9c,null))[_0x789e('0x2c')](handleError(_0x583e9c,null));};exports[_0x789e('0x8e')]=function(_0x685d9d,_0x1d7316,_0x16b01d){return db[_0x789e('0x8f')][_0x789e('0x60')]({'where':{'id':_0x685d9d[_0x789e('0x5f')]['id']}})[_0x789e('0x22')](handleEntityNotFound(_0x1d7316,null))['then'](function(_0x5608a3){if(_0x5608a3){return _0x5608a3['addInteraction'](_0x685d9d[_0x789e('0x61')][_0x789e('0x6f')],_['omit'](_0x685d9d['body'],[_0x789e('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x1d7316,null))[_0x789e('0x2c')](handleError(_0x1d7316,null));};exports[_0x789e('0x90')]=function(_0x57735c,_0x33d22d,_0x368e86){var _0x5468ee={'raw':![],'where':{}};var _0x4e65bb={};var _0x395a16={'count':0x0,'rows':[]};return db[_0x789e('0x5b')][_0x789e('0x68')]({'where':{'id':_0x57735c[_0x789e('0x5f')]['id']}})['then'](handleEntityNotFound(_0x33d22d,null))[_0x789e('0x22')](function(_0xe6056f){if(_0xe6056f){_0x4e65bb[_0x789e('0x47')]=_['keys'](db[_0x789e('0x8f')]['rawAttributes']);_0x4e65bb[_0x789e('0x48')]=_[_0x789e('0x49')](_0x57735c[_0x789e('0x48')]);_0x4e65bb[_0x789e('0x4a')]=_['intersection'](_0x4e65bb[_0x789e('0x47')],_0x4e65bb[_0x789e('0x48')]);_0x5468ee[_0x789e('0x4c')]=_['intersection'](_0x4e65bb[_0x789e('0x47')],qs[_0x789e('0x4d')](_0x57735c[_0x789e('0x48')][_0x789e('0x4d')]));_0x5468ee[_0x789e('0x4c')]=_0x5468ee['attributes']['length']?_0x5468ee[_0x789e('0x4c')]:_0x4e65bb[_0x789e('0x47')];if(!_0x57735c[_0x789e('0x48')]['hasOwnProperty']('nolimit')){_0x5468ee['limit']=qs[_0x789e('0x50')](_0x57735c[_0x789e('0x48')][_0x789e('0x50')]);_0x5468ee['offset']=qs['offset'](_0x57735c[_0x789e('0x48')][_0x789e('0x30')]);}_0x5468ee[_0x789e('0x51')]=qs['sort'](_0x57735c[_0x789e('0x48')][_0x789e('0x52')]);_0x5468ee[_0x789e('0x53')]=qs[_0x789e('0x4a')](_['pick'](_0x57735c['query'],_0x4e65bb[_0x789e('0x4a')]));_0x5468ee[_0x789e('0x53')][_0x789e('0x66')]=_0xe6056f['id'];if(_0x57735c['query']['filter']){_0x5468ee['where']=_['merge'](_0x5468ee[_0x789e('0x53')],{'$or':_[_0x789e('0x43')](_0x5468ee[_0x789e('0x4c')],function(_0x3c9252){var _0x3ae81f={};_0x3ae81f[_0x3c9252]={'$like':'%'+_0x57735c['query'][_0x789e('0x55')]+'%'};return _0x3ae81f;})});}_0x5468ee=_[_0x789e('0x56')]({},_0x5468ee,_0x57735c[_0x789e('0x58')]);return db[_0x789e('0x8f')][_0x789e('0x2f')]({'where':_0x5468ee['where']})[_0x789e('0x22')](function(_0x3d1223){_0x395a16['count']=_0x3d1223;if(_0x57735c[_0x789e('0x48')][_0x789e('0x59')]){_0x5468ee[_0x789e('0x5a')]=[{'model':db[_0x789e('0x91')],'as':'Contact','required':![]},{'model':db[_0x789e('0x92')],'as':'Owner','attributes':[_0x789e('0x3c'),_0x789e('0x93'),_0x789e('0x94')],'required':![]},{'model':db[_0x789e('0x95')],'as':_0x789e('0x96'),'attributes':['id','name',_0x789e('0x97')],'where':_0x57735c[_0x789e('0x48')][_0x789e('0x98')]?{'id':_0x57735c[_0x789e('0x48')][_0x789e('0x98')]}:undefined,'required':_0x57735c[_0x789e('0x48')]['tag']?!![]:![]}];}return db[_0x789e('0x8f')]['findAll'](_0x5468ee);})[_0x789e('0x22')](function(_0x251236){_0x395a16['rows']=_0x251236;return _0x395a16;});}})['then'](respondWithFilteredResult(_0x33d22d,_0x5468ee))[_0x789e('0x2c')](handleError(_0x33d22d,null));};exports['addApplications']=function(_0x328291,_0x51f399,_0x110331){return db[_0x789e('0x5b')][_0x789e('0x68')]({'where':{'id':_0x328291['params']['id']}})['then'](handleEntityNotFound(_0x51f399,null))['then'](function(_0x45c982){if(_0x45c982){return db['sequelize'][_0x789e('0x99')](function(_0x1a7e27){return db[_0x789e('0x9a')]['destroy']({'where':{'MailAccountId':_0x328291['params']['id']},'transaction':_0x1a7e27})[_0x789e('0x22')](function(_0x338370){var _0x107075=_[_0x789e('0x43')](_0x328291['body'],function(_0x17f6c6){_0x17f6c6[_0x789e('0x66')]=_0x328291[_0x789e('0x5f')]['id'];return _0x17f6c6;});return db['MailApplication']['bulkCreate'](_0x107075,{'transaction':_0x1a7e27});});})[_0x789e('0x22')](function(){return db[_0x789e('0x9a')]['findAndCountAll']({'where':{'MailAccountId':_0x328291[_0x789e('0x5f')]['id']},'order':_0x789e('0x9b')});});}})['then'](respondWithResult(_0x51f399,null))[_0x789e('0x2c')](handleError(_0x51f399,null));};exports[_0x789e('0x9c')]=function(_0x4b1f4c,_0x41affa,_0x22b904){var _0x398969={};var _0x140b92={};var _0x305011;var _0x176950;return db[_0x789e('0x5b')][_0x789e('0x68')]({'where':{'id':_0x4b1f4c[_0x789e('0x5f')]['id']}})[_0x789e('0x22')](handleEntityNotFound(_0x41affa,null))[_0x789e('0x22')](function(_0x5e5e8c){if(_0x5e5e8c){_0x305011=_0x5e5e8c;_0x140b92[_0x789e('0x47')]=_[_0x789e('0x49')](db['MailApplication'][_0x789e('0x44')]);_0x140b92['query']=_[_0x789e('0x49')](_0x4b1f4c[_0x789e('0x48')]);_0x140b92['filters']=_[_0x789e('0x4b')](_0x140b92[_0x789e('0x47')],_0x140b92[_0x789e('0x48')]);_0x398969[_0x789e('0x4c')]=_['intersection'](_0x140b92['model'],qs[_0x789e('0x4d')](_0x4b1f4c[_0x789e('0x48')][_0x789e('0x4d')]));_0x398969[_0x789e('0x4c')]=_0x398969[_0x789e('0x4c')][_0x789e('0x4e')]?_0x398969[_0x789e('0x4c')]:_0x140b92[_0x789e('0x47')];_0x398969[_0x789e('0x51')]=qs[_0x789e('0x52')](_0x4b1f4c[_0x789e('0x48')]['sort']);_0x398969[_0x789e('0x53')]=qs[_0x789e('0x4a')](_[_0x789e('0x54')](_0x4b1f4c[_0x789e('0x48')],_0x140b92[_0x789e('0x4a')]));if(_0x4b1f4c[_0x789e('0x48')]['filter']){_0x398969['where']=_[_0x789e('0x56')](_0x398969[_0x789e('0x53')],{'$or':_[_0x789e('0x43')](_0x398969[_0x789e('0x4c')],function(_0x1419a6){var _0x1aef2a={};_0x1aef2a[_0x1419a6]={'$like':'%'+_0x4b1f4c['query']['filter']+'%'};return _0x1aef2a;})});}_0x398969=_[_0x789e('0x56')]({},_0x398969,_0x4b1f4c['options']);return _0x305011[_0x789e('0x9c')](_0x398969);}})[_0x789e('0x22')](function(_0x17bedf){if(_0x17bedf){_0x176950=_0x17bedf[_0x789e('0x4e')];if(!_0x4b1f4c[_0x789e('0x48')][_0x789e('0x4f')]('nolimit')){_0x398969[_0x789e('0x50')]=qs['limit'](_0x4b1f4c[_0x789e('0x48')][_0x789e('0x50')]);_0x398969['offset']=qs[_0x789e('0x30')](_0x4b1f4c[_0x789e('0x48')][_0x789e('0x30')]);}return _0x305011['getApplications'](_0x398969);}})[_0x789e('0x22')](function(_0x192ba5){if(_0x192ba5){return _0x192ba5?{'count':_0x176950,'rows':_0x192ba5}:null;}})[_0x789e('0x22')](respondWithResult(_0x41affa,null))[_0x789e('0x2c')](handleError(_0x41affa,null));};exports[_0x789e('0x9d')]=function(_0x2810ec,_0x330b4d,_0x3a1c28){var _0x407eda={'raw':!![],'where':{}};var _0x4f23e9={};var _0x5b75b2={'count':0x0,'rows':[]};return db[_0x789e('0x5b')]['findOne']({'where':{'id':_0x2810ec['params']['id']}})[_0x789e('0x22')](handleEntityNotFound(_0x330b4d,null))[_0x789e('0x22')](function(_0x19bfc9){if(_0x19bfc9){_0x4f23e9[_0x789e('0x47')]=_[_0x789e('0x49')](db[_0x789e('0x9e')]['rawAttributes']);_0x4f23e9[_0x789e('0x48')]=_[_0x789e('0x49')](_0x2810ec['query']);_0x4f23e9['filters']=_[_0x789e('0x4b')](_0x4f23e9['model'],_0x4f23e9[_0x789e('0x48')]);_0x407eda[_0x789e('0x4c')]=_[_0x789e('0x4b')](_0x4f23e9[_0x789e('0x47')],qs[_0x789e('0x4d')](_0x2810ec[_0x789e('0x48')][_0x789e('0x4d')]));_0x407eda[_0x789e('0x4c')]=_0x407eda[_0x789e('0x4c')][_0x789e('0x4e')]?_0x407eda[_0x789e('0x4c')]:_0x4f23e9[_0x789e('0x47')];if(!_0x2810ec[_0x789e('0x48')][_0x789e('0x4f')](_0x789e('0x9f'))){_0x407eda['limit']=qs['limit'](_0x2810ec[_0x789e('0x48')][_0x789e('0x50')]);_0x407eda[_0x789e('0x30')]=qs[_0x789e('0x30')](_0x2810ec[_0x789e('0x48')][_0x789e('0x30')]);}_0x407eda['order']=qs[_0x789e('0x52')](_0x2810ec[_0x789e('0x48')][_0x789e('0x52')]);_0x407eda['where']=qs[_0x789e('0x4a')](_[_0x789e('0x54')](_0x2810ec[_0x789e('0x48')],_0x4f23e9[_0x789e('0x4a')]));_0x407eda[_0x789e('0x53')][_0x789e('0x66')]=_0x19bfc9['id'];if(_0x2810ec[_0x789e('0x48')][_0x789e('0x55')]){_0x407eda[_0x789e('0x53')]=_['merge'](_0x407eda[_0x789e('0x53')],{'$or':_[_0x789e('0x43')](_0x407eda['attributes'],function(_0x319869){var _0x4df3a7={};_0x4df3a7[_0x319869]={'$like':'%'+_0x2810ec[_0x789e('0x48')][_0x789e('0x55')]+'%'};return _0x4df3a7;})});}if(_0x2810ec[_0x789e('0x48')]['$gte']){var _0x337892=_0x2810ec[_0x789e('0x48')]['$gte'][_0x789e('0xa0')](',');var _0xbdafc6={};_0xbdafc6[_0x337892[0x0]]={'$gte':moment(_0x337892[0x1])[_0x789e('0xa1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x407eda['where']=_[_0x789e('0x56')](_0x407eda[_0x789e('0x53')],_0xbdafc6);}_0x407eda=_[_0x789e('0x56')]({},_0x407eda,_0x2810ec[_0x789e('0x58')]);return db[_0x789e('0x9e')]['count']({'where':_0x407eda[_0x789e('0x53')]})['then'](function(_0x34a7c0){_0x5b75b2[_0x789e('0x2f')]=_0x34a7c0;if(_0x2810ec[_0x789e('0x48')][_0x789e('0x59')]){_0x407eda[_0x789e('0x5a')]=[{'all':!![]}];}return db[_0x789e('0x9e')]['findAll'](_0x407eda);})[_0x789e('0x22')](function(_0x529420){if(_0x2810ec[_0x789e('0x48')][_0x789e('0xa2')]===_0x789e('0xa3')){for(var _0x31669b=0x0;_0x31669b<_0x529420[_0x789e('0x4e')];_0x31669b++){_0x529420[_0x31669b]['body']=juice(_0x529420[_0x31669b][_0x789e('0x61')]);}}_0x5b75b2[_0x789e('0x5d')]=_0x529420;return _0x5b75b2;});}})['then'](respondWithFilteredResult(_0x330b4d,_0x407eda))[_0x789e('0x2c')](handleError(_0x330b4d,null));};exports[_0x789e('0x3d')]=function(_0xdd1d0b,_0x531761,_0x350b93){var _0x56d977,_0x5cfea8={},_0x1d6042;if(_0xdd1d0b[_0x789e('0x61')]['to']){_0x1d6042=_0xdd1d0b[_0x789e('0x61')]['to']['split'](',')[0x0];}return db[_0x789e('0x5b')][_0x789e('0x60')]({'where':{'id':_0xdd1d0b[_0x789e('0x5f')]['id']},'include':[{'model':db[_0x789e('0xa4')],'as':_0x789e('0xa5'),'include':[{'model':db[_0x789e('0x91')],'as':_0x789e('0xa6'),'where':{'email':_0x1d6042},'limit':0x1,'order':[[_0x789e('0xa7'),'DESC']]}]},{'model':db[_0x789e('0x62')],'as':_0x789e('0x41'),'raw':!![]}]})['then'](handleEntityNotFound(_0x531761,null))[_0x789e('0x22')](function(_0x23235b){if(_0x23235b){_0x56d977=_0x23235b;if(_0x23235b[_0x789e('0x41')]){if(_[_0x789e('0x73')](_0xdd1d0b['body'][_0x789e('0xa8')])){_0xdd1d0b[_0x789e('0x61')][_0x789e('0xa8')]=util[_0x789e('0xa1')](_0x789e('0xa9'),_0x23235b[_0x789e('0x3c')],_0x23235b[_0x789e('0x71')]||_0x23235b['Smtp'][_0x789e('0x78')]);}if(_0xdd1d0b[_0x789e('0x61')]['attachments']&&_0xdd1d0b[_0x789e('0x61')]['attachments']['length']){for(var _0x22aa97=0x0;_0x22aa97<_0xdd1d0b[_0x789e('0x61')][_0x789e('0xaa')][_0x789e('0x4e')];_0x22aa97+=0x1){_0xdd1d0b['body'][_0x789e('0xaa')][_0x22aa97]={'filename':_0xdd1d0b[_0x789e('0x61')][_0x789e('0xaa')][_0x22aa97][_0x789e('0x3c')],'path':path['join'](config[_0x789e('0xab')],_0x789e('0xac'),_0xdd1d0b[_0x789e('0x61')][_0x789e('0xaa')][_0x22aa97][_0x789e('0xad')])};}}var _0x19ab75={'tls':{'rejectUnauthorized':![]}};if(_[_0x789e('0x73')](_0x23235b[_0x789e('0x41')][_0x789e('0x7f')])){if(_0x23235b[_0x789e('0x41')][_0x789e('0x7c')]){_0x19ab75[_0x789e('0xae')]={'user':_0x23235b[_0x789e('0x41')][_0x789e('0x78')],'pass':_0x23235b[_0x789e('0x41')][_0x789e('0x7a')]};}_0x19ab75['host']=_0x23235b[_0x789e('0x41')][_0x789e('0x7d')];_0x19ab75[_0x789e('0x7e')]=_0x23235b[_0x789e('0x41')][_0x789e('0x7e')];_0x19ab75[_0x789e('0xaf')]=_0x23235b[_0x789e('0x41')][_0x789e('0xaf')];}else{_0x19ab75[_0x789e('0x7f')]=_0x23235b[_0x789e('0x41')][_0x789e('0x7f')];_0x19ab75['auth']={'user':_0x23235b[_0x789e('0x41')][_0x789e('0x78')],'pass':_0x23235b[_0x789e('0x41')]['pass']};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x19ab75,'message':_0xdd1d0b['body']});}else{throw new Error(_0x789e('0xb0'));}}})[_0x789e('0x22')](function(_0x301082){if(_0x301082){_0x5cfea8=_0x301082;if(_0x56d977[_0x789e('0xa5')]){if(_0x56d977[_0x789e('0xa5')]['Contacts']['length']){return _0x56d977[_0x789e('0xa5')][_0x789e('0xa6')][0x0];}else{return db[_0x789e('0x91')][_0x789e('0x6d')](_[_0x789e('0xb1')](_0xdd1d0b[_0x789e('0x61')],{'firstName':_0xdd1d0b[_0x789e('0x61')]['to'],'email':_0xdd1d0b['body']['to'],'phone':_0xdd1d0b[_0x789e('0x61')]['to'],'ListId':_0x56d977[_0x789e('0x72')]}));}}else{throw new Error(_0x789e('0xb0'));}}})[_0x789e('0x22')](function(_0x1b10d6){if(_0x1b10d6){var _0x46b444={'UserId':_0xdd1d0b[_0x789e('0x78')]['id'],'ContactId':_0x1b10d6['id'],'MailAccountId':_0x56d977['id'],'inReplyTo':_0x5cfea8[_0x789e('0xb2')],'to':_0xdd1d0b[_0x789e('0x61')][_0x789e('0xa8')],'cc':_0xdd1d0b[_0x789e('0x61')]['cc'],'subject':_0xdd1d0b[_0x789e('0x61')][_0x789e('0xb3')],'attach':_0xdd1d0b[_0x789e('0x61')][_0x789e('0xb4')],'firstMsgDirection':_0x789e('0xb5'),'lastMsgAt':moment()[_0x789e('0xa1')](_0x789e('0xb6')),'lastMsgDirection':_0x789e('0xb5'),'lastMsgBody':_0xdd1d0b[_0x789e('0x61')][_0x789e('0x61')],'Messages':[_[_0x789e('0x56')](_0xdd1d0b[_0x789e('0x61')],{'messageId':_0x5cfea8[_0x789e('0xb2')],'sentAt':moment()['format'](_0x789e('0xb6')),'read':!![],'MailAccountId':_0x56d977['id'],'UserId':_0xdd1d0b[_0x789e('0x78')]['id'],'ContactId':_0x1b10d6['id']})]};if(_0xdd1d0b[_0x789e('0x61')][_0x789e('0xb7')]){_0x46b444=_[_0x789e('0x56')](_0x46b444,_0xdd1d0b[_0x789e('0x61')][_0x789e('0xb7')]);}return db[_0x789e('0x8f')]['create'](_0x46b444,{'include':[{'model':db[_0x789e('0x9e')],'as':_0x789e('0xb8')}]});}})[_0x789e('0x22')](respondWithResult(_0x531761,null))['catch'](handleError(_0x531761,null));};exports[_0x789e('0xb9')]=function(_0x31cd91,_0x41616a,_0x5cf080){return db[_0x789e('0x5b')]['find']({'where':{'id':_0x31cd91[_0x789e('0x5f')]['id']},'include':[{'model':db[_0x789e('0x62')],'as':_0x789e('0x41'),'raw':!![]}]})[_0x789e('0x22')](handleEntityNotFound(_0x41616a,null))[_0x789e('0x22')](function(_0x15eb2b){if(_0x15eb2b&&_0x15eb2b[_0x789e('0x41')]){var _0xd3de49={'id':_0x15eb2b['id'],'tls':{'rejectUnauthorized':![]}};if(_0x15eb2b[_0x789e('0x41')][_0x789e('0x7f')]){_0xd3de49[_0x789e('0x7f')]=_0x15eb2b[_0x789e('0x41')]['service'];}else{_0xd3de49['host']=_0x15eb2b[_0x789e('0x41')]['host'];_0xd3de49[_0x789e('0x7e')]=_0x15eb2b[_0x789e('0x41')][_0x789e('0x7e')];_0xd3de49['secure']=_0x15eb2b[_0x789e('0x41')]['secure'];}if(_0x15eb2b[_0x789e('0x41')][_0x789e('0x7c')]){_0xd3de49[_0x789e('0xae')]={'user':_0x15eb2b[_0x789e('0x41')][_0x789e('0x78')],'pass':_0x15eb2b['Smtp']['pass']};}return respondWithRpcPromise(_0x789e('0xba'),_0x789e('0xb9'),{'account':_0xd3de49});}})['then'](respondWithResult(_0x41616a,null))[_0x789e('0x2c')](handleError(_0x41616a,null));};exports[_0x789e('0x38')]=function(_0x60326d,_0x120273){return db[_0x789e('0x5b')][_0x789e('0x60')]({'where':{'id':_0x60326d[_0x789e('0x5f')]['id']}})[_0x789e('0x22')](handleEntityNotFound(_0x120273,null))['then'](function(_0x4d6fd5){if(_0x4d6fd5&&_0x4d6fd5[_0x789e('0x7f')]){throw new db[(_0x789e('0xbb'))]['ValidationError'](_0x789e('0xbc'));}return _0x4d6fd5;})[_0x789e('0x22')](removeEntity(_0x120273,null))[_0x789e('0x2c')](handleError(_0x120273,null));};exports['addAgents']=function(_0x571018,_0x4b3304,_0x13ab5d){return db[_0x789e('0x5b')][_0x789e('0x60')]({'where':{'id':_0x571018[_0x789e('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4b3304,null))[_0x789e('0x22')](function(_0x20faf7){if(_0x20faf7){return _0x20faf7['addAgents'](_0x571018[_0x789e('0x61')][_0x789e('0x6f')],_[_0x789e('0xbd')](_0x571018[_0x789e('0x61')],['ids','id'])||{})[_0x789e('0xbe')](function(_0x3f8d7e){for(var _0x2168d1=0x0;_0x2168d1<_0x571018[_0x789e('0x61')][_0x789e('0x6f')][_0x789e('0x4e')];_0x2168d1+=0x1){socket[_0x789e('0xbf')](_0x789e('0xc0'),{'UserId':_0x571018['body']['ids'][_0x2168d1],'MailAccountId':_0x571018[_0x789e('0x5f')]['id']});}return _0x3f8d7e;});}})[_0x789e('0x22')](respondWithResult(_0x4b3304,null))[_0x789e('0x2c')](handleError(_0x4b3304,null));};exports[_0x789e('0xc1')]=function(_0x1d2cc2,_0x31be05,_0x2658a1){return db[_0x789e('0x5b')]['find']({'where':{'id':_0x1d2cc2[_0x789e('0x5f')]['id']}})[_0x789e('0x22')](handleEntityNotFound(_0x31be05,null))[_0x789e('0x22')](function(_0x329e60){if(_0x329e60){return _0x329e60[_0x789e('0xc1')](_0x1d2cc2['query']['ids'])[_0x789e('0x22')](function(){if(_['isArray'](_0x1d2cc2[_0x789e('0x48')][_0x789e('0x6f')])){for(var _0x53eabb=0x0;_0x53eabb<_0x1d2cc2[_0x789e('0x48')][_0x789e('0x6f')][_0x789e('0x4e')];_0x53eabb+=0x1){socket['emit'](_0x789e('0xc2'),{'UserId':Number(_0x1d2cc2[_0x789e('0x48')][_0x789e('0x6f')][_0x53eabb]),'MailAccountId':Number(_0x1d2cc2[_0x789e('0x5f')]['id'])});}}else{socket['emit'](_0x789e('0xc2'),{'UserId':Number(_0x1d2cc2[_0x789e('0x48')][_0x789e('0x6f')]),'MailAccountId':Number(_0x1d2cc2[_0x789e('0x5f')]['id'])});}});}})[_0x789e('0x22')](respondWithStatusCode(_0x31be05,null))[_0x789e('0x2c')](handleError(_0x31be05,null));};exports[_0x789e('0xc3')]=function(_0x5ade18,_0x80fb0,_0x4e7dda){var _0x337afc={};var _0x44683b={};var _0x1e6026;var _0x3d3cf3;return db[_0x789e('0x5b')]['findOne']({'where':{'id':_0x5ade18[_0x789e('0x5f')]['id']}})[_0x789e('0x22')](handleEntityNotFound(_0x80fb0,null))[_0x789e('0x22')](function(_0xeb8bde){if(_0xeb8bde){_0x1e6026=_0xeb8bde;_0x44683b[_0x789e('0x47')]=_['keys'](db[_0x789e('0x92')]['rawAttributes']);_0x44683b[_0x789e('0x48')]=_[_0x789e('0x49')](_0x5ade18[_0x789e('0x48')]);_0x44683b[_0x789e('0x4a')]=_[_0x789e('0x4b')](_0x44683b[_0x789e('0x47')],_0x44683b[_0x789e('0x48')]);_0x337afc[_0x789e('0x4c')]=_['intersection'](_0x44683b['model'],qs[_0x789e('0x4d')](_0x5ade18[_0x789e('0x48')][_0x789e('0x4d')]));_0x337afc[_0x789e('0x4c')]=_0x337afc[_0x789e('0x4c')][_0x789e('0x4e')]?_0x337afc[_0x789e('0x4c')]:_0x44683b[_0x789e('0x47')];_0x337afc[_0x789e('0x51')]=qs['sort'](_0x5ade18[_0x789e('0x48')][_0x789e('0x52')]);_0x337afc[_0x789e('0x53')]=qs[_0x789e('0x4a')](_['pick'](_0x5ade18[_0x789e('0x48')],_0x44683b[_0x789e('0x4a')]));if(_0x5ade18['query']['filter']){_0x337afc[_0x789e('0x53')]=_[_0x789e('0x56')](_0x337afc[_0x789e('0x53')],{'$or':_[_0x789e('0x43')](_0x337afc[_0x789e('0x4c')],function(_0x337818){var _0x55a4bd={};_0x55a4bd[_0x337818]={'$like':'%'+_0x5ade18[_0x789e('0x48')]['filter']+'%'};return _0x55a4bd;})});}_0x337afc=_[_0x789e('0x56')]({},_0x337afc,_0x5ade18['options']);return _0x1e6026[_0x789e('0xc3')](_0x337afc);}})[_0x789e('0x22')](function(_0x4fd124){if(_0x4fd124){_0x3d3cf3=_0x4fd124[_0x789e('0x4e')];if(!_0x5ade18['query'][_0x789e('0x4f')](_0x789e('0x9f'))){_0x337afc['limit']=qs[_0x789e('0x50')](_0x5ade18[_0x789e('0x48')]['limit']);_0x337afc[_0x789e('0x30')]=qs[_0x789e('0x30')](_0x5ade18[_0x789e('0x48')][_0x789e('0x30')]);}return _0x1e6026[_0x789e('0xc3')](_0x337afc);}})[_0x789e('0x22')](function(_0x15cee9){if(_0x15cee9){return _0x15cee9?{'count':_0x3d3cf3,'rows':_0x15cee9}:null;}})[_0x789e('0x22')](respondWithResult(_0x80fb0,null))[_0x789e('0x2c')](handleError(_0x80fb0,null));}; \ No newline at end of file +var _0xebe5=['message','result','catch','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','get','destroy','stack','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','MailAccount','include','findAll','rows','Pause','mandatoryDispositionPause','includeAll','find','body','params','describe','Disposition','create','getDispositions','findOne','nolimit','MailAccountId','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','key','ListId','active','description','user','cuser','password','pass','authentication','host','port','service','cservice','cpassword','role','UserProfileSection','MailAccounts','autoAssociation','UserProfileResource','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','split','CmList','List','Contacts','DESC','isNil','from','%s\x20<%s>','email','attachments','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Messages','verifySmtp','ValidationError','emit','userMailAccount:save','ids','removeAgents','isArray','userMailAccount:remove','getAgents','User','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','html-to-text','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2bf075,_0x18471b){var _0x41e52c=function(_0x500102){while(--_0x500102){_0x2bf075['push'](_0x2bf075['shift']());}};_0x41e52c(++_0x18471b);}(_0xebe5,0x15c));var _0x5ebe=function(_0x17a692,_0x4e6812){_0x17a692=_0x17a692-0x0;var _0x4f5e76=_0xebe5[_0x17a692];return _0x4f5e76;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x5ebe('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5ebe('0x1'));var rp=require(_0x5ebe('0x2'));var moment=require(_0x5ebe('0x3'));var BPromise=require(_0x5ebe('0x4'));var Mustache=require('mustache');var util=require(_0x5ebe('0x5'));var path=require('path');var sox=require(_0x5ebe('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5ebe('0x7'));var _=require(_0x5ebe('0x8'));var squel=require(_0x5ebe('0x9'));var crypto=require(_0x5ebe('0xa'));var jsforce=require(_0x5ebe('0xb'));var deskjs=require(_0x5ebe('0xc'));var toCsv=require(_0x5ebe('0xd'));var querystring=require(_0x5ebe('0xe'));var Papa=require(_0x5ebe('0xf'));var htmlToText=require(_0x5ebe('0x10'));var juice=require(_0x5ebe('0x11'));var Redis=require(_0x5ebe('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5ebe('0x13'));var as=require(_0x5ebe('0x14'));var hardwareService=require(_0x5ebe('0x15'));var logger=require('../../config/logger')(_0x5ebe('0x16'));var utils=require('../../config/utils');var config=require(_0x5ebe('0x17'));var licenseUtil=require(_0x5ebe('0x18'));var db=require('../../mysqldb')['db'];config[_0x5ebe('0x19')]=_[_0x5ebe('0x1a')](config[_0x5ebe('0x19')],{'host':_0x5ebe('0x1b'),'port':0x18eb});var socket=require(_0x5ebe('0x1c'))(new Redis(config[_0x5ebe('0x19')]));require('./mailAccount.socket')[_0x5ebe('0x1d')](socket);var jayson=require(_0x5ebe('0x1e'));var client=jayson[_0x5ebe('0x1f')][_0x5ebe('0x20')]({'port':0x232b});function respondWithRpcPromise(_0x5e3d11,_0x53aa4f,_0x5a34b4,_0x22212f){return new BPromise(function(_0x30077b,_0x43582f){var _0x59fde8=_0x22212f||client;return _0x59fde8[_0x5ebe('0x21')](_0x5e3d11,_0x5a34b4)[_0x5ebe('0x22')](function(_0x2c8271){logger[_0x5ebe('0x23')](_0x5ebe('0x24'),_0x53aa4f,'request\x20sent');logger['debug'](_0x5ebe('0x25'),_0x53aa4f,_0x5ebe('0x26'),JSON[_0x5ebe('0x27')](_0x2c8271));if(_0x2c8271[_0x5ebe('0x28')]){if(_0x2c8271[_0x5ebe('0x28')][_0x5ebe('0x29')]===0x1f4){logger['error'](_0x5ebe('0x24'),_0x53aa4f,_0x2c8271[_0x5ebe('0x28')]['message']);return _0x43582f(_0x2c8271[_0x5ebe('0x28')][_0x5ebe('0x2a')]);}logger[_0x5ebe('0x28')](_0x5ebe('0x24'),_0x53aa4f,_0x2c8271['error'][_0x5ebe('0x2a')]);return _0x30077b(_0x2c8271[_0x5ebe('0x28')]['message']);}else{logger[_0x5ebe('0x23')](_0x5ebe('0x24'),_0x53aa4f,_0x5ebe('0x26'));_0x30077b(_0x2c8271[_0x5ebe('0x2b')][_0x5ebe('0x2a')]);}})[_0x5ebe('0x2c')](function(_0x58cfea){logger[_0x5ebe('0x28')]('MailAccount,\x20%s,\x20%s',_0x53aa4f,_0x58cfea);_0x43582f(_0x58cfea);});});}function respondWithStatusCode(_0x2a46b9,_0x21573d){_0x21573d=_0x21573d||0xcc;return function(_0x407fd4){if(_0x407fd4){return _0x2a46b9[_0x5ebe('0x2d')](_0x21573d);}return _0x2a46b9[_0x5ebe('0x2e')](_0x21573d)[_0x5ebe('0x2f')]();};}function respondWithResult(_0xa7042e,_0x5e1880){_0x5e1880=_0x5e1880||0xc8;return function(_0x38ed1c){if(_0x38ed1c){return _0xa7042e[_0x5ebe('0x2e')](_0x5e1880)[_0x5ebe('0x30')](_0x38ed1c);}};}function respondWithFilteredResult(_0xd6d50,_0x19ac67){return function(_0x1fd7ab){if(_0x1fd7ab){var _0x52e612=_0x1fd7ab[_0x5ebe('0x31')],_0x2373d9=_0x19ac67[_0x5ebe('0x32')],_0x35ce0c=_0x19ac67[_0x5ebe('0x32')]+_0x19ac67['limit'],_0x1327ff;if(_0x35ce0c>=_0x52e612){_0x35ce0c=_0x52e612;_0x1327ff=0xc8;}else{_0x1327ff=0xce;}_0xd6d50['status'](_0x1327ff);return _0xd6d50[_0x5ebe('0x33')]('Content-Range',_0x2373d9+'-'+_0x35ce0c+'/'+_0x52e612)[_0x5ebe('0x30')](_0x1fd7ab);}return null;};}function patchUpdates(_0x5ba528){return function(_0x5dddf5){try{jsonpatch[_0x5ebe('0x34')](_0x5dddf5,_0x5ba528,!![]);}catch(_0xc0dad4){return BPromise[_0x5ebe('0x35')](_0xc0dad4);}return _0x5dddf5[_0x5ebe('0x36')]();};}function saveUpdates(_0x370775,_0x236e39){return function(_0x2209cb){if(_0x2209cb){return _0x2209cb[_0x5ebe('0x37')](_0x370775)['then'](function(_0xd6ea45){return _0xd6ea45;});}return null;};}function removeEntity(_0x5748aa,_0x78c43){return function(_0x24718d){if(_0x24718d){return _0x24718d['destroy']()['then'](function(){var _0x5471db=_0x24718d[_0x5ebe('0x38')]({'plain':!![]});var _0x47718a='MailAccounts';return db['UserProfileResource'][_0x5ebe('0x39')]({'where':{'type':_0x47718a,'resourceId':_0x5471db['id']}})[_0x5ebe('0x22')](function(){return _0x24718d;});})['then'](function(){_0x5748aa[_0x5ebe('0x2e')](0xcc)[_0x5ebe('0x2f')]();});}};}function handleEntityNotFound(_0x43b3a1,_0x1342eb){return function(_0x54dd8b){if(!_0x54dd8b){_0x43b3a1[_0x5ebe('0x2d')](0x194);}return _0x54dd8b;};}function handleError(_0x3af27b,_0x1ad8bd){_0x1ad8bd=_0x1ad8bd||0x1f4;return function(_0x24bfa4){logger[_0x5ebe('0x28')](_0x24bfa4[_0x5ebe('0x3a')]);if(_0x24bfa4[_0x5ebe('0x3b')]){delete _0x24bfa4[_0x5ebe('0x3b')];}_0x3af27b['status'](_0x1ad8bd)[_0x5ebe('0x3c')](_0x24bfa4);};}exports[_0x5ebe('0x3d')]=function(_0x4d1f2f,_0x3b45e1){var _0x2bd4e3={'include':[{'model':db[_0x5ebe('0x3e')],'as':_0x5ebe('0x3f')},{'model':db[_0x5ebe('0x40')],'as':_0x5ebe('0x41')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0xfa87ff={},_0x51dbba={'count':0x0,'rows':[]};var _0x3be9e8=_[_0x5ebe('0x42')](db['MailAccount'][_0x5ebe('0x43')],function(_0x3828cd){return{'name':_0x3828cd[_0x5ebe('0x44')],'type':_0x3828cd[_0x5ebe('0x45')]['key']};});_0xfa87ff[_0x5ebe('0x46')]=_[_0x5ebe('0x42')](_0x3be9e8,_0x5ebe('0x3b'));_0xfa87ff[_0x5ebe('0x47')]=_[_0x5ebe('0x48')](_0x4d1f2f['query']);_0xfa87ff[_0x5ebe('0x49')]=_[_0x5ebe('0x4a')](_0xfa87ff[_0x5ebe('0x46')],_0xfa87ff[_0x5ebe('0x47')]);_0x2bd4e3[_0x5ebe('0x4b')]=_['intersection'](_0xfa87ff[_0x5ebe('0x46')],qs[_0x5ebe('0x4c')](_0x4d1f2f[_0x5ebe('0x47')]['fields']));_0x2bd4e3[_0x5ebe('0x4b')]=_0x2bd4e3[_0x5ebe('0x4b')][_0x5ebe('0x4d')]?_0x2bd4e3['attributes']:_0xfa87ff[_0x5ebe('0x46')];if(!_0x4d1f2f['query'][_0x5ebe('0x4e')]('nolimit')){_0x2bd4e3[_0x5ebe('0x4f')]=qs[_0x5ebe('0x4f')](_0x4d1f2f[_0x5ebe('0x47')][_0x5ebe('0x4f')]);_0x2bd4e3[_0x5ebe('0x32')]=qs['offset'](_0x4d1f2f[_0x5ebe('0x47')][_0x5ebe('0x32')]);}_0x2bd4e3[_0x5ebe('0x50')]=qs['sort'](_0x4d1f2f[_0x5ebe('0x47')][_0x5ebe('0x51')]);_0x2bd4e3['where']=qs['filters'](_[_0x5ebe('0x52')](_0x4d1f2f[_0x5ebe('0x47')],_0xfa87ff[_0x5ebe('0x49')]),_0x3be9e8);if(_0x4d1f2f[_0x5ebe('0x47')][_0x5ebe('0x53')]){_0x2bd4e3[_0x5ebe('0x54')]=_['merge'](_0x2bd4e3[_0x5ebe('0x54')],{'$or':_[_0x5ebe('0x42')](_0x3be9e8,function(_0x293940){if(_0x293940['type']!==_0x5ebe('0x55')){var _0x14132b={};_0x14132b[_0x293940[_0x5ebe('0x3b')]]={'$like':'%'+_0x4d1f2f[_0x5ebe('0x47')][_0x5ebe('0x53')]+'%'};return _0x14132b;}})});}_0x2bd4e3=_[_0x5ebe('0x56')]({},_0x2bd4e3,_0x4d1f2f[_0x5ebe('0x57')]);var _0x1bcb77={'where':_0x2bd4e3['where']};return db[_0x5ebe('0x58')][_0x5ebe('0x31')](_0x1bcb77)[_0x5ebe('0x22')](function(_0x4b3324){_0x51dbba[_0x5ebe('0x31')]=_0x4b3324;if(_0x4d1f2f['query']['includeAll']){_0x2bd4e3[_0x5ebe('0x59')]=[{'all':!![]}];}return db[_0x5ebe('0x58')][_0x5ebe('0x5a')](_0x2bd4e3);})[_0x5ebe('0x22')](function(_0x442d96){_0x51dbba[_0x5ebe('0x5b')]=_0x442d96;return _0x51dbba;})['then'](respondWithFilteredResult(_0x3b45e1,_0x2bd4e3))['catch'](handleError(_0x3b45e1,null));};exports['show']=function(_0x29dde6,_0x115058){var _0x2c5e2a={'raw':![],'where':{'id':_0x29dde6['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x5ebe('0x3f')},{'model':db[_0x5ebe('0x40')],'as':_0x5ebe('0x41')},{'model':db[_0x5ebe('0x5c')],'as':_0x5ebe('0x5d')}]},_0xc84f06={};_0xc84f06[_0x5ebe('0x46')]=_['keys'](db['MailAccount'][_0x5ebe('0x43')]);_0xc84f06[_0x5ebe('0x47')]=_[_0x5ebe('0x48')](_0x29dde6[_0x5ebe('0x47')]);_0xc84f06[_0x5ebe('0x49')]=_['intersection'](_0xc84f06[_0x5ebe('0x46')],_0xc84f06[_0x5ebe('0x47')]);_0x2c5e2a[_0x5ebe('0x4b')]=_[_0x5ebe('0x4a')](_0xc84f06[_0x5ebe('0x46')],qs['fields'](_0x29dde6['query'][_0x5ebe('0x4c')]));_0x2c5e2a[_0x5ebe('0x4b')]=_0x2c5e2a[_0x5ebe('0x4b')][_0x5ebe('0x4d')]?_0x2c5e2a['attributes']:_0xc84f06[_0x5ebe('0x46')];if(_0x29dde6[_0x5ebe('0x47')][_0x5ebe('0x5e')]){_0x2c5e2a[_0x5ebe('0x59')]=[{'all':!![]}];}_0x2c5e2a=_['merge']({},_0x2c5e2a,_0x29dde6[_0x5ebe('0x57')]);return db[_0x5ebe('0x58')][_0x5ebe('0x5f')](_0x2c5e2a)[_0x5ebe('0x22')](handleEntityNotFound(_0x115058,null))[_0x5ebe('0x22')](respondWithResult(_0x115058,null))[_0x5ebe('0x2c')](handleError(_0x115058,null));};exports[_0x5ebe('0x37')]=function(_0x8f9c8d,_0x125f0e){if(_0x8f9c8d[_0x5ebe('0x60')]['id']){delete _0x8f9c8d['body']['id'];}return db[_0x5ebe('0x58')][_0x5ebe('0x5f')]({'where':{'id':_0x8f9c8d[_0x5ebe('0x61')]['id']},'include':[{'model':db[_0x5ebe('0x3e')],'as':'Imap'},{'model':db[_0x5ebe('0x40')],'as':_0x5ebe('0x41')},{'model':db[_0x5ebe('0x5c')],'as':'mandatoryDispositionPause'}]})[_0x5ebe('0x22')](handleEntityNotFound(_0x125f0e,null))[_0x5ebe('0x22')](saveUpdates(_0x8f9c8d[_0x5ebe('0x60')],null))[_0x5ebe('0x22')](function(_0xb69f6){if(_0xb69f6&&_0x8f9c8d[_0x5ebe('0x60')][_0x5ebe('0x3f')]){return db['MailServerIn'][_0x5ebe('0x37')](_0x8f9c8d['body'][_0x5ebe('0x3f')],{'where':{'MailAccountId':_0xb69f6['id']}})[_0x5ebe('0x22')](function(){return _0xb69f6;});}return _0xb69f6;})[_0x5ebe('0x22')](function(_0x4a0b56){if(_0x4a0b56&&_0x8f9c8d[_0x5ebe('0x60')][_0x5ebe('0x41')]){return db['MailServerOut']['update'](_0x8f9c8d['body'][_0x5ebe('0x41')],{'where':{'MailAccountId':_0x4a0b56['id']}})['then'](function(){return _0x4a0b56;});}return _0x4a0b56;})[_0x5ebe('0x22')](respondWithResult(_0x125f0e,null))[_0x5ebe('0x2c')](handleError(_0x125f0e,null));};exports[_0x5ebe('0x62')]=function(_0x29f178,_0x5924b1){return db['MailAccount'][_0x5ebe('0x62')]()[_0x5ebe('0x22')](respondWithResult(_0x5924b1,null))[_0x5ebe('0x2c')](handleError(_0x5924b1,null));};exports['addDisposition']=function(_0x59ff8e,_0x502629,_0x4a49ae){if(_0x59ff8e[_0x5ebe('0x60')]['id']){delete _0x59ff8e[_0x5ebe('0x60')]['id'];}return db['MailAccount'][_0x5ebe('0x5f')]({'where':{'id':_0x59ff8e['params']['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x502629,null))[_0x5ebe('0x22')](function(_0x496644){if(_0x496644){_0x59ff8e[_0x5ebe('0x60')]['MailAccountId']=_0x496644['id'];return db[_0x5ebe('0x63')][_0x5ebe('0x64')](_0x59ff8e[_0x5ebe('0x60')]);}})[_0x5ebe('0x22')](respondWithResult(_0x502629,null))[_0x5ebe('0x2c')](handleError(_0x502629,null));};exports[_0x5ebe('0x65')]=function(_0x1df5d8,_0x564666,_0x56376f){var _0x39867b={'raw':![],'where':{}};var _0x885a35={};var _0x4809c7={'count':0x0,'rows':[]};return db['MailAccount'][_0x5ebe('0x66')]({'where':{'id':_0x1df5d8[_0x5ebe('0x61')]['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x564666,null))[_0x5ebe('0x22')](function(_0x3ec6af){if(_0x3ec6af){_0x885a35[_0x5ebe('0x46')]=_[_0x5ebe('0x48')](db[_0x5ebe('0x63')][_0x5ebe('0x43')]);_0x885a35[_0x5ebe('0x47')]=_['keys'](_0x1df5d8[_0x5ebe('0x47')]);_0x885a35[_0x5ebe('0x49')]=_[_0x5ebe('0x4a')](_0x885a35[_0x5ebe('0x46')],_0x885a35[_0x5ebe('0x47')]);_0x39867b[_0x5ebe('0x4b')]=_[_0x5ebe('0x4a')](_0x885a35[_0x5ebe('0x46')],qs[_0x5ebe('0x4c')](_0x1df5d8[_0x5ebe('0x47')]['fields']));_0x39867b['attributes']=_0x39867b[_0x5ebe('0x4b')]['length']?_0x39867b[_0x5ebe('0x4b')]:_0x885a35[_0x5ebe('0x46')];if(!_0x1df5d8['query'][_0x5ebe('0x4e')](_0x5ebe('0x67'))){_0x39867b[_0x5ebe('0x4f')]=qs['limit'](_0x1df5d8[_0x5ebe('0x47')][_0x5ebe('0x4f')]);_0x39867b['offset']=qs[_0x5ebe('0x32')](_0x1df5d8[_0x5ebe('0x47')][_0x5ebe('0x32')]);}_0x39867b['order']=qs[_0x5ebe('0x51')](_0x1df5d8[_0x5ebe('0x47')][_0x5ebe('0x51')]);_0x39867b[_0x5ebe('0x54')]=qs[_0x5ebe('0x49')](_[_0x5ebe('0x52')](_0x1df5d8['query'],_0x885a35[_0x5ebe('0x49')]));_0x39867b[_0x5ebe('0x54')][_0x5ebe('0x68')]=_0x3ec6af['id'];if(_0x1df5d8[_0x5ebe('0x47')][_0x5ebe('0x53')]){_0x39867b[_0x5ebe('0x54')]=_[_0x5ebe('0x56')](_0x39867b[_0x5ebe('0x54')],{'$or':_['map'](_0x39867b[_0x5ebe('0x4b')],function(_0x1cd23c){var _0x4974a8={};_0x4974a8[_0x1cd23c]={'$like':'%'+_0x1df5d8[_0x5ebe('0x47')][_0x5ebe('0x53')]+'%'};return _0x4974a8;})});}_0x39867b=_[_0x5ebe('0x56')]({},_0x39867b,_0x1df5d8['options']);return db['Disposition'][_0x5ebe('0x31')]({'where':_0x39867b['where']})[_0x5ebe('0x22')](function(_0x1d0c2a){_0x4809c7[_0x5ebe('0x31')]=_0x1d0c2a;if(_0x1df5d8[_0x5ebe('0x47')][_0x5ebe('0x5e')]){_0x39867b[_0x5ebe('0x59')]=[{'all':!![]}];}return db[_0x5ebe('0x63')][_0x5ebe('0x5a')](_0x39867b);})[_0x5ebe('0x22')](function(_0x89d8d0){_0x4809c7[_0x5ebe('0x5b')]=_0x89d8d0;return _0x4809c7;});}})[_0x5ebe('0x22')](respondWithFilteredResult(_0x564666,_0x39867b))['catch'](handleError(_0x564666,null));};exports[_0x5ebe('0x69')]=function(_0x1fe1a7,_0x36b19f,_0x597466){return db[_0x5ebe('0x58')][_0x5ebe('0x5f')]({'where':{'id':_0x1fe1a7[_0x5ebe('0x61')]['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x36b19f,null))[_0x5ebe('0x22')](function(_0x1482cb){if(_0x1482cb){return _0x1482cb[_0x5ebe('0x69')](_0x1fe1a7[_0x5ebe('0x47')]['ids']);}})[_0x5ebe('0x22')](respondWithStatusCode(_0x36b19f,null))['catch'](handleError(_0x36b19f,null));};exports[_0x5ebe('0x6a')]=function(_0x5e05f0,_0x5d1bc5,_0x2e1f76){if(_0x5e05f0[_0x5ebe('0x60')]['id']){delete _0x5e05f0[_0x5ebe('0x60')]['id'];}return db[_0x5ebe('0x58')][_0x5ebe('0x5f')]({'where':{'id':_0x5e05f0[_0x5ebe('0x61')]['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x5d1bc5,null))['then'](function(_0x5c9fdf){if(_0x5c9fdf){_0x5e05f0['body'][_0x5ebe('0x68')]=_0x5c9fdf['id'];return db[_0x5ebe('0x6b')][_0x5ebe('0x64')](_0x5e05f0['body']);}})[_0x5ebe('0x22')](respondWithResult(_0x5d1bc5,null))[_0x5ebe('0x2c')](handleError(_0x5d1bc5,null));};exports[_0x5ebe('0x6c')]=function(_0x311ad2,_0x346748,_0x43ae24){var _0x180f47={'raw':![],'where':{}};var _0x341da9={};var _0x555d65={'count':0x0,'rows':[]};return db[_0x5ebe('0x58')][_0x5ebe('0x66')]({'where':{'id':_0x311ad2['params']['id']}})['then'](handleEntityNotFound(_0x346748,null))[_0x5ebe('0x22')](function(_0x20a093){if(_0x20a093){_0x341da9['model']=_['keys'](db[_0x5ebe('0x6b')]['rawAttributes']);_0x341da9[_0x5ebe('0x47')]=_['keys'](_0x311ad2[_0x5ebe('0x47')]);_0x341da9[_0x5ebe('0x49')]=_[_0x5ebe('0x4a')](_0x341da9[_0x5ebe('0x46')],_0x341da9[_0x5ebe('0x47')]);_0x180f47[_0x5ebe('0x4b')]=_[_0x5ebe('0x4a')](_0x341da9[_0x5ebe('0x46')],qs['fields'](_0x311ad2['query']['fields']));_0x180f47['attributes']=_0x180f47[_0x5ebe('0x4b')][_0x5ebe('0x4d')]?_0x180f47[_0x5ebe('0x4b')]:_0x341da9[_0x5ebe('0x46')];if(!_0x311ad2[_0x5ebe('0x47')][_0x5ebe('0x4e')]('nolimit')){_0x180f47[_0x5ebe('0x4f')]=qs[_0x5ebe('0x4f')](_0x311ad2[_0x5ebe('0x47')][_0x5ebe('0x4f')]);_0x180f47['offset']=qs[_0x5ebe('0x32')](_0x311ad2[_0x5ebe('0x47')]['offset']);}_0x180f47['order']=qs[_0x5ebe('0x51')](_0x311ad2[_0x5ebe('0x47')]['sort']);_0x180f47[_0x5ebe('0x54')]=qs[_0x5ebe('0x49')](_['pick'](_0x311ad2['query'],_0x341da9[_0x5ebe('0x49')]));_0x180f47[_0x5ebe('0x54')]['MailAccountId']=_0x20a093['id'];if(_0x311ad2[_0x5ebe('0x47')][_0x5ebe('0x53')]){_0x180f47[_0x5ebe('0x54')]=_[_0x5ebe('0x56')](_0x180f47[_0x5ebe('0x54')],{'$or':_[_0x5ebe('0x42')](_0x180f47[_0x5ebe('0x4b')],function(_0x3b5ae2){var _0x51aadd={};_0x51aadd[_0x3b5ae2]={'$like':'%'+_0x311ad2['query'][_0x5ebe('0x53')]+'%'};return _0x51aadd;})});}_0x180f47=_[_0x5ebe('0x56')]({},_0x180f47,_0x311ad2[_0x5ebe('0x57')]);return db[_0x5ebe('0x6b')][_0x5ebe('0x31')]({'where':_0x180f47['where']})[_0x5ebe('0x22')](function(_0x1a1ba0){_0x555d65['count']=_0x1a1ba0;if(_0x311ad2[_0x5ebe('0x47')][_0x5ebe('0x5e')]){_0x180f47['include']=[{'all':!![]}];}return db[_0x5ebe('0x6b')][_0x5ebe('0x5a')](_0x180f47);})[_0x5ebe('0x22')](function(_0x5051e0){_0x555d65[_0x5ebe('0x5b')]=_0x5051e0;return _0x555d65;});}})[_0x5ebe('0x22')](respondWithFilteredResult(_0x346748,_0x180f47))[_0x5ebe('0x2c')](handleError(_0x346748,null));};exports[_0x5ebe('0x6d')]=function(_0x1e701c,_0x3b6167,_0x158757){return db[_0x5ebe('0x58')][_0x5ebe('0x5f')]({'where':{'id':_0x1e701c[_0x5ebe('0x61')]['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x3b6167,null))[_0x5ebe('0x22')](function(_0x5a31a9){if(_0x5a31a9){return _0x5a31a9[_0x5ebe('0x6d')](_0x1e701c[_0x5ebe('0x47')]['ids']);}})['then'](respondWithStatusCode(_0x3b6167,null))[_0x5ebe('0x2c')](handleError(_0x3b6167,null));};exports[_0x5ebe('0x64')]=function(_0x207ad9,_0x1e56fd){var _0x2748a3={'name':_0x207ad9['body'][_0x5ebe('0x3b')],'key':_0x207ad9[_0x5ebe('0x60')][_0x5ebe('0x6e')],'email':_0x207ad9[_0x5ebe('0x60')]['email'],'ListId':_0x207ad9['body'][_0x5ebe('0x6f')],'active':!_['isNil'](_0x207ad9[_0x5ebe('0x60')][_0x5ebe('0x70')])?_0x207ad9['body'][_0x5ebe('0x70')]:!![],'description':_0x207ad9['body'][_0x5ebe('0x71')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x207ad9['body']['cservice'])){if(_0x207ad9['body']['cauthentication']){_0x2748a3[_0x5ebe('0x3f')][_0x5ebe('0x72')]=_0x2748a3[_0x5ebe('0x41')]['user']=_0x207ad9[_0x5ebe('0x60')][_0x5ebe('0x73')];_0x2748a3['Imap'][_0x5ebe('0x74')]=_0x2748a3['Smtp'][_0x5ebe('0x75')]=_0x207ad9[_0x5ebe('0x60')]['cpassword'];}else{_0x2748a3[_0x5ebe('0x3f')]['authentication']=_0x2748a3['Smtp'][_0x5ebe('0x76')]=![];}_0x2748a3['Imap'][_0x5ebe('0x77')]=_0x207ad9['body'][_0x5ebe('0x3f')][_0x5ebe('0x77')];_0x2748a3[_0x5ebe('0x3f')][_0x5ebe('0x78')]=_0x207ad9[_0x5ebe('0x60')][_0x5ebe('0x3f')][_0x5ebe('0x78')];_0x2748a3[_0x5ebe('0x41')][_0x5ebe('0x77')]=_0x207ad9[_0x5ebe('0x60')][_0x5ebe('0x41')][_0x5ebe('0x77')];_0x2748a3[_0x5ebe('0x41')][_0x5ebe('0x78')]=_0x207ad9[_0x5ebe('0x60')][_0x5ebe('0x41')]['port'];}else{_0x2748a3['Imap'][_0x5ebe('0x79')]=_0x2748a3[_0x5ebe('0x41')][_0x5ebe('0x79')]=_0x207ad9[_0x5ebe('0x60')][_0x5ebe('0x7a')];_0x2748a3['Imap'][_0x5ebe('0x72')]=_0x2748a3['Smtp']['user']=_0x207ad9[_0x5ebe('0x60')][_0x5ebe('0x73')];_0x2748a3['Imap']['password']=_0x2748a3[_0x5ebe('0x41')][_0x5ebe('0x75')]=_0x207ad9[_0x5ebe('0x60')][_0x5ebe('0x7b')];}return db[_0x5ebe('0x58')]['create'](_0x2748a3,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x5ebe('0x3e')],'as':'Imap'}]})[_0x5ebe('0x22')](function(_0x9008b){var _0x3112c0=_0x207ad9['user'][_0x5ebe('0x38')]({'plain':!![]});if(!_0x3112c0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3112c0[_0x5ebe('0x7c')]===_0x5ebe('0x72')){var _0x22fd98=_0x9008b[_0x5ebe('0x38')]({'plain':!![]});return db[_0x5ebe('0x7d')][_0x5ebe('0x5f')]({'where':{'name':_0x5ebe('0x7e'),'userProfileId':_0x3112c0['userProfileId']},'raw':!![]})[_0x5ebe('0x22')](function(_0xffb522){if(_0xffb522&&_0xffb522[_0x5ebe('0x7f')]===0x0){return db[_0x5ebe('0x80')][_0x5ebe('0x64')]({'name':_0x22fd98[_0x5ebe('0x3b')],'resourceId':_0x22fd98['id'],'type':_0xffb522[_0x5ebe('0x3b')],'sectionId':_0xffb522['id']},{})['then'](function(){return _0x9008b;});}else{return _0x9008b;}})[_0x5ebe('0x2c')](function(_0x2c4294){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c4294);throw _0x2c4294;});}return _0x9008b;})[_0x5ebe('0x22')](respondWithResult(_0x1e56fd,0xc9))[_0x5ebe('0x2c')](handleError(_0x1e56fd,null));};exports[_0x5ebe('0x81')]=function(_0x163c70,_0x4868a8,_0x3330fd){return db['MailAccount']['findOne']({'where':{'id':_0x163c70['params']['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x4868a8,null))[_0x5ebe('0x22')](function(_0x3b9334){if(_0x3b9334){return _0x3b9334[_0x5ebe('0x81')]();}return null;})[_0x5ebe('0x22')](respondWithResult(_0x4868a8,null))[_0x5ebe('0x2c')](handleError(_0x4868a8,null));};exports[_0x5ebe('0x82')]=function(_0x37a89f,_0x3386d0,_0x8ea44f){if(_0x37a89f[_0x5ebe('0x60')]['id']){delete _0x37a89f['body']['id'];}return db[_0x5ebe('0x58')][_0x5ebe('0x5f')]({'where':{'id':_0x37a89f[_0x5ebe('0x61')]['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x3386d0,null))[_0x5ebe('0x22')](function(_0x562a07){if(_0x562a07){_0x37a89f['body'][_0x5ebe('0x68')]=_0x562a07['id'];return db[_0x5ebe('0x3e')][_0x5ebe('0x64')](_0x37a89f['body']);}})[_0x5ebe('0x22')](respondWithResult(_0x3386d0,null))[_0x5ebe('0x2c')](handleError(_0x3386d0,null));};exports[_0x5ebe('0x83')]=function(_0x1e9469,_0x4d0763,_0x2f34c8){return db[_0x5ebe('0x58')][_0x5ebe('0x66')]({'where':{'id':_0x1e9469['params']['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x4d0763,null))[_0x5ebe('0x22')](function(_0x1fddc5){if(_0x1fddc5){return _0x1fddc5['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x4d0763,null))['catch'](handleError(_0x4d0763,null));};exports['getSmtp']=function(_0x266d0d,_0x5629da,_0x13ca0d){return db[_0x5ebe('0x58')]['findOne']({'where':{'id':_0x266d0d[_0x5ebe('0x61')]['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x5629da,null))[_0x5ebe('0x22')](function(_0x32dc20){if(_0x32dc20){return _0x32dc20[_0x5ebe('0x84')]();}return null;})[_0x5ebe('0x22')](respondWithResult(_0x5629da,null))[_0x5ebe('0x2c')](handleError(_0x5629da,null));};exports[_0x5ebe('0x85')]=function(_0x2950e3,_0x39a4a8,_0x335ab0){if(_0x2950e3[_0x5ebe('0x60')]['id']){delete _0x2950e3['body']['id'];}return db['MailAccount'][_0x5ebe('0x5f')]({'where':{'id':_0x2950e3[_0x5ebe('0x61')]['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x39a4a8,null))[_0x5ebe('0x22')](function(_0x4f4c14){if(_0x4f4c14){_0x2950e3[_0x5ebe('0x60')]['MailAccountId']=_0x4f4c14['id'];return db[_0x5ebe('0x40')][_0x5ebe('0x64')](_0x2950e3[_0x5ebe('0x60')]);}})[_0x5ebe('0x22')](respondWithResult(_0x39a4a8,null))[_0x5ebe('0x2c')](handleError(_0x39a4a8,null));};exports[_0x5ebe('0x86')]=function(_0x1d12b7,_0x157333,_0x5cbe03){return db[_0x5ebe('0x58')][_0x5ebe('0x66')]({'where':{'id':_0x1d12b7['params']['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x157333,null))[_0x5ebe('0x22')](function(_0x153de8){if(_0x153de8){return _0x153de8['setSmtp'](null);}return null;})[_0x5ebe('0x22')](respondWithStatusCode(_0x157333,null))[_0x5ebe('0x2c')](handleError(_0x157333,null));};exports[_0x5ebe('0x87')]=function(_0x2c744f,_0x31c232,_0x217987){return db[_0x5ebe('0x88')][_0x5ebe('0x5f')]({'where':{'id':_0x2c744f[_0x5ebe('0x61')]['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x31c232,null))[_0x5ebe('0x22')](function(_0x12f5e9){if(_0x12f5e9){return _0x12f5e9['addInteraction'](_0x2c744f['body']['ids'],_[_0x5ebe('0x89')](_0x2c744f[_0x5ebe('0x60')],['ids','id'])||{});}})[_0x5ebe('0x22')](respondWithResult(_0x31c232,null))[_0x5ebe('0x2c')](handleError(_0x31c232,null));};exports[_0x5ebe('0x8a')]=function(_0x461fcb,_0x1479a0,_0x373cb2){var _0x289325={'raw':![],'where':{}};var _0x4dfd16={};var _0x107d9c={'count':0x0,'rows':[]};return db[_0x5ebe('0x58')][_0x5ebe('0x66')]({'where':{'id':_0x461fcb[_0x5ebe('0x61')]['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x1479a0,null))[_0x5ebe('0x22')](function(_0x2fef32){if(_0x2fef32){_0x4dfd16[_0x5ebe('0x46')]=_[_0x5ebe('0x48')](db[_0x5ebe('0x88')][_0x5ebe('0x43')]);_0x4dfd16[_0x5ebe('0x47')]=_['keys'](_0x461fcb[_0x5ebe('0x47')]);_0x4dfd16['filters']=_[_0x5ebe('0x4a')](_0x4dfd16[_0x5ebe('0x46')],_0x4dfd16['query']);_0x289325[_0x5ebe('0x4b')]=_[_0x5ebe('0x4a')](_0x4dfd16[_0x5ebe('0x46')],qs[_0x5ebe('0x4c')](_0x461fcb['query']['fields']));_0x289325[_0x5ebe('0x4b')]=_0x289325[_0x5ebe('0x4b')]['length']?_0x289325[_0x5ebe('0x4b')]:_0x4dfd16[_0x5ebe('0x46')];if(!_0x461fcb[_0x5ebe('0x47')]['hasOwnProperty'](_0x5ebe('0x67'))){_0x289325['limit']=qs[_0x5ebe('0x4f')](_0x461fcb[_0x5ebe('0x47')]['limit']);_0x289325[_0x5ebe('0x32')]=qs['offset'](_0x461fcb['query'][_0x5ebe('0x32')]);}_0x289325['order']=qs[_0x5ebe('0x51')](_0x461fcb[_0x5ebe('0x47')][_0x5ebe('0x51')]);_0x289325[_0x5ebe('0x54')]=qs[_0x5ebe('0x49')](_[_0x5ebe('0x52')](_0x461fcb[_0x5ebe('0x47')],_0x4dfd16[_0x5ebe('0x49')]));_0x289325[_0x5ebe('0x54')][_0x5ebe('0x68')]=_0x2fef32['id'];if(_0x461fcb['query'][_0x5ebe('0x53')]){_0x289325[_0x5ebe('0x54')]=_[_0x5ebe('0x56')](_0x289325[_0x5ebe('0x54')],{'$or':_[_0x5ebe('0x42')](_0x289325[_0x5ebe('0x4b')],function(_0x5942c5){var _0x48d1a0={};_0x48d1a0[_0x5942c5]={'$like':'%'+_0x461fcb['query']['filter']+'%'};return _0x48d1a0;})});}_0x289325=_[_0x5ebe('0x56')]({},_0x289325,_0x461fcb['options']);return db[_0x5ebe('0x88')]['count']({'where':_0x289325[_0x5ebe('0x54')]})[_0x5ebe('0x22')](function(_0x25b73e){_0x107d9c[_0x5ebe('0x31')]=_0x25b73e;if(_0x461fcb[_0x5ebe('0x47')][_0x5ebe('0x5e')]){_0x289325['include']=[{'model':db[_0x5ebe('0x8b')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x5ebe('0x8c'),'attributes':[_0x5ebe('0x3b'),_0x5ebe('0x8d'),_0x5ebe('0x8e')],'required':![]},{'model':db[_0x5ebe('0x8f')],'as':_0x5ebe('0x90'),'attributes':['id',_0x5ebe('0x3b'),_0x5ebe('0x91')],'where':_0x461fcb['query']['tag']?{'id':_0x461fcb[_0x5ebe('0x47')]['tag']}:undefined,'required':_0x461fcb[_0x5ebe('0x47')][_0x5ebe('0x92')]?!![]:![]}];}return db[_0x5ebe('0x88')][_0x5ebe('0x5a')](_0x289325);})['then'](function(_0x3668be){_0x107d9c[_0x5ebe('0x5b')]=_0x3668be;return _0x107d9c;});}})[_0x5ebe('0x22')](respondWithFilteredResult(_0x1479a0,_0x289325))['catch'](handleError(_0x1479a0,null));};exports[_0x5ebe('0x93')]=function(_0x629815,_0x4e8217,_0x246f61){return db[_0x5ebe('0x58')]['findOne']({'where':{'id':_0x629815[_0x5ebe('0x61')]['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x4e8217,null))[_0x5ebe('0x22')](function(_0x2974ca){if(_0x2974ca){return db[_0x5ebe('0x94')][_0x5ebe('0x95')](function(_0x76f146){return db[_0x5ebe('0x96')]['destroy']({'where':{'MailAccountId':_0x629815[_0x5ebe('0x61')]['id']},'transaction':_0x76f146})[_0x5ebe('0x22')](function(_0x55556f){var _0x4b7c7f=_[_0x5ebe('0x42')](_0x629815[_0x5ebe('0x60')],function(_0x3908be){_0x3908be['MailAccountId']=_0x629815['params']['id'];return _0x3908be;});return db['MailApplication'][_0x5ebe('0x97')](_0x4b7c7f,{'transaction':_0x76f146});});})[_0x5ebe('0x22')](function(){return db[_0x5ebe('0x96')][_0x5ebe('0x98')]({'where':{'MailAccountId':_0x629815[_0x5ebe('0x61')]['id']},'order':_0x5ebe('0x99')});});}})[_0x5ebe('0x22')](respondWithResult(_0x4e8217,null))[_0x5ebe('0x2c')](handleError(_0x4e8217,null));};exports[_0x5ebe('0x9a')]=function(_0x3cab01,_0x20ffb3,_0x24bca7){var _0x53968f={};var _0x5c0648={};var _0x34e47d;var _0x526c0a;return db[_0x5ebe('0x58')][_0x5ebe('0x66')]({'where':{'id':_0x3cab01[_0x5ebe('0x61')]['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x20ffb3,null))[_0x5ebe('0x22')](function(_0x1f66f5){if(_0x1f66f5){_0x34e47d=_0x1f66f5;_0x5c0648[_0x5ebe('0x46')]=_['keys'](db[_0x5ebe('0x96')][_0x5ebe('0x43')]);_0x5c0648['query']=_[_0x5ebe('0x48')](_0x3cab01[_0x5ebe('0x47')]);_0x5c0648['filters']=_['intersection'](_0x5c0648[_0x5ebe('0x46')],_0x5c0648['query']);_0x53968f[_0x5ebe('0x4b')]=_[_0x5ebe('0x4a')](_0x5c0648[_0x5ebe('0x46')],qs['fields'](_0x3cab01['query']['fields']));_0x53968f['attributes']=_0x53968f['attributes']['length']?_0x53968f[_0x5ebe('0x4b')]:_0x5c0648['model'];_0x53968f[_0x5ebe('0x50')]=qs['sort'](_0x3cab01[_0x5ebe('0x47')][_0x5ebe('0x51')]);_0x53968f['where']=qs[_0x5ebe('0x49')](_[_0x5ebe('0x52')](_0x3cab01[_0x5ebe('0x47')],_0x5c0648['filters']));if(_0x3cab01[_0x5ebe('0x47')][_0x5ebe('0x53')]){_0x53968f[_0x5ebe('0x54')]=_[_0x5ebe('0x56')](_0x53968f['where'],{'$or':_[_0x5ebe('0x42')](_0x53968f[_0x5ebe('0x4b')],function(_0x1ae792){var _0x4c391d={};_0x4c391d[_0x1ae792]={'$like':'%'+_0x3cab01[_0x5ebe('0x47')][_0x5ebe('0x53')]+'%'};return _0x4c391d;})});}_0x53968f=_[_0x5ebe('0x56')]({},_0x53968f,_0x3cab01[_0x5ebe('0x57')]);return _0x34e47d[_0x5ebe('0x9a')](_0x53968f);}})['then'](function(_0x28f73b){if(_0x28f73b){_0x526c0a=_0x28f73b[_0x5ebe('0x4d')];if(!_0x3cab01[_0x5ebe('0x47')]['hasOwnProperty']('nolimit')){_0x53968f[_0x5ebe('0x4f')]=qs[_0x5ebe('0x4f')](_0x3cab01[_0x5ebe('0x47')][_0x5ebe('0x4f')]);_0x53968f[_0x5ebe('0x32')]=qs['offset'](_0x3cab01[_0x5ebe('0x47')][_0x5ebe('0x32')]);}return _0x34e47d[_0x5ebe('0x9a')](_0x53968f);}})[_0x5ebe('0x22')](function(_0x4ffecf){if(_0x4ffecf){return _0x4ffecf?{'count':_0x526c0a,'rows':_0x4ffecf}:null;}})[_0x5ebe('0x22')](respondWithResult(_0x20ffb3,null))[_0x5ebe('0x2c')](handleError(_0x20ffb3,null));};exports[_0x5ebe('0x9b')]=function(_0x33c8f6,_0x3de911,_0x5d472b){var _0xb496e4={'raw':!![],'where':{}};var _0x1bbf92={};var _0x409016={'count':0x0,'rows':[]};return db['MailAccount'][_0x5ebe('0x66')]({'where':{'id':_0x33c8f6['params']['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x3de911,null))[_0x5ebe('0x22')](function(_0x45b923){if(_0x45b923){_0x1bbf92[_0x5ebe('0x46')]=_[_0x5ebe('0x48')](db[_0x5ebe('0x9c')][_0x5ebe('0x43')]);_0x1bbf92['query']=_[_0x5ebe('0x48')](_0x33c8f6[_0x5ebe('0x47')]);_0x1bbf92[_0x5ebe('0x49')]=_[_0x5ebe('0x4a')](_0x1bbf92[_0x5ebe('0x46')],_0x1bbf92[_0x5ebe('0x47')]);_0xb496e4[_0x5ebe('0x4b')]=_['intersection'](_0x1bbf92['model'],qs[_0x5ebe('0x4c')](_0x33c8f6[_0x5ebe('0x47')][_0x5ebe('0x4c')]));_0xb496e4['attributes']=_0xb496e4[_0x5ebe('0x4b')][_0x5ebe('0x4d')]?_0xb496e4[_0x5ebe('0x4b')]:_0x1bbf92['model'];if(!_0x33c8f6[_0x5ebe('0x47')][_0x5ebe('0x4e')](_0x5ebe('0x67'))){_0xb496e4['limit']=qs['limit'](_0x33c8f6[_0x5ebe('0x47')][_0x5ebe('0x4f')]);_0xb496e4[_0x5ebe('0x32')]=qs[_0x5ebe('0x32')](_0x33c8f6[_0x5ebe('0x47')]['offset']);}_0xb496e4[_0x5ebe('0x50')]=qs[_0x5ebe('0x51')](_0x33c8f6[_0x5ebe('0x47')]['sort']);_0xb496e4['where']=qs[_0x5ebe('0x49')](_['pick'](_0x33c8f6[_0x5ebe('0x47')],_0x1bbf92['filters']));_0xb496e4[_0x5ebe('0x54')][_0x5ebe('0x68')]=_0x45b923['id'];if(_0x33c8f6[_0x5ebe('0x47')][_0x5ebe('0x53')]){_0xb496e4['where']=_[_0x5ebe('0x56')](_0xb496e4[_0x5ebe('0x54')],{'$or':_[_0x5ebe('0x42')](_0xb496e4[_0x5ebe('0x4b')],function(_0x147d9f){var _0x573809={};_0x573809[_0x147d9f]={'$like':'%'+_0x33c8f6['query']['filter']+'%'};return _0x573809;})});}if(_0x33c8f6[_0x5ebe('0x47')][_0x5ebe('0x9d')]){var _0x1ad49b=_0x33c8f6['query'][_0x5ebe('0x9d')]['split'](',');var _0x281e83={};_0x281e83[_0x1ad49b[0x0]]={'$gte':moment(_0x1ad49b[0x1])[_0x5ebe('0x9e')](_0x5ebe('0x9f'))};_0xb496e4['where']=_[_0x5ebe('0x56')](_0xb496e4[_0x5ebe('0x54')],_0x281e83);}_0xb496e4=_[_0x5ebe('0x56')]({},_0xb496e4,_0x33c8f6[_0x5ebe('0x57')]);return db[_0x5ebe('0x9c')][_0x5ebe('0x31')]({'where':_0xb496e4[_0x5ebe('0x54')]})[_0x5ebe('0x22')](function(_0xa6235e){_0x409016['count']=_0xa6235e;if(_0x33c8f6[_0x5ebe('0x47')][_0x5ebe('0x5e')]){_0xb496e4[_0x5ebe('0x59')]=[{'all':!![]}];}return db[_0x5ebe('0x9c')]['findAll'](_0xb496e4);})['then'](function(_0x4974f7){if(_0x33c8f6['query'][_0x5ebe('0xa0')]===_0x5ebe('0xa1')){for(var _0x3f0337=0x0;_0x3f0337<_0x4974f7[_0x5ebe('0x4d')];_0x3f0337++){_0x4974f7[_0x3f0337]['body']=juice(_0x4974f7[_0x3f0337][_0x5ebe('0x60')]);}}_0x409016[_0x5ebe('0x5b')]=_0x4974f7;return _0x409016;});}})[_0x5ebe('0x22')](respondWithFilteredResult(_0x3de911,_0xb496e4))[_0x5ebe('0x2c')](handleError(_0x3de911,null));};exports[_0x5ebe('0x3c')]=function(_0x3ebf84,_0x4a9608,_0x232d52){var _0x434088,_0x13a55e={},_0x343f2c;if(_0x3ebf84[_0x5ebe('0x60')]['to']){_0x343f2c=_0x3ebf84[_0x5ebe('0x60')]['to'][_0x5ebe('0xa2')](',')[0x0];}return db[_0x5ebe('0x58')][_0x5ebe('0x5f')]({'where':{'id':_0x3ebf84[_0x5ebe('0x61')]['id']},'include':[{'model':db[_0x5ebe('0xa3')],'as':_0x5ebe('0xa4'),'include':[{'model':db[_0x5ebe('0x8b')],'as':_0x5ebe('0xa5'),'where':{'email':_0x343f2c},'limit':0x1,'order':[['updatedAt',_0x5ebe('0xa6')]]}]},{'model':db['MailServerOut'],'as':_0x5ebe('0x41'),'raw':!![]}]})[_0x5ebe('0x22')](handleEntityNotFound(_0x4a9608,null))[_0x5ebe('0x22')](function(_0x18695a){if(_0x18695a){_0x434088=_0x18695a;if(_0x18695a[_0x5ebe('0x41')]){if(_[_0x5ebe('0xa7')](_0x3ebf84['body'][_0x5ebe('0xa8')])){_0x3ebf84[_0x5ebe('0x60')][_0x5ebe('0xa8')]=util[_0x5ebe('0x9e')](_0x5ebe('0xa9'),_0x18695a['name'],_0x18695a[_0x5ebe('0xaa')]||_0x18695a[_0x5ebe('0x41')][_0x5ebe('0x72')]);}if(_0x3ebf84[_0x5ebe('0x60')]['attachments']&&_0x3ebf84['body'][_0x5ebe('0xab')][_0x5ebe('0x4d')]){for(var _0x1ecb45=0x0;_0x1ecb45<_0x3ebf84[_0x5ebe('0x60')]['attachments'][_0x5ebe('0x4d')];_0x1ecb45+=0x1){_0x3ebf84[_0x5ebe('0x60')][_0x5ebe('0xab')][_0x1ecb45]={'filename':_0x3ebf84['body']['attachments'][_0x1ecb45][_0x5ebe('0x3b')],'path':path['join'](config[_0x5ebe('0xac')],_0x5ebe('0xad'),_0x3ebf84['body'][_0x5ebe('0xab')][_0x1ecb45][_0x5ebe('0xae')])};}}var _0x47b7f5={'tls':{'rejectUnauthorized':![]}};if(_[_0x5ebe('0xa7')](_0x18695a[_0x5ebe('0x41')][_0x5ebe('0x79')])){if(_0x18695a[_0x5ebe('0x41')][_0x5ebe('0x76')]){_0x47b7f5[_0x5ebe('0xaf')]={'user':_0x18695a[_0x5ebe('0x41')][_0x5ebe('0x72')],'pass':_0x18695a[_0x5ebe('0x41')][_0x5ebe('0x75')]};}_0x47b7f5[_0x5ebe('0x77')]=_0x18695a[_0x5ebe('0x41')]['host'];_0x47b7f5[_0x5ebe('0x78')]=_0x18695a[_0x5ebe('0x41')][_0x5ebe('0x78')];_0x47b7f5[_0x5ebe('0xb0')]=_0x18695a[_0x5ebe('0x41')][_0x5ebe('0xb0')];}else{_0x47b7f5['service']=_0x18695a[_0x5ebe('0x41')][_0x5ebe('0x79')];_0x47b7f5[_0x5ebe('0xaf')]={'user':_0x18695a['Smtp'][_0x5ebe('0x72')],'pass':_0x18695a['Smtp']['pass']};}return respondWithRpcPromise(_0x5ebe('0xb1'),_0x5ebe('0xb2'),{'account':_0x47b7f5,'message':_0x3ebf84[_0x5ebe('0x60')]});}else{throw new Error(_0x5ebe('0xb3'));}}})[_0x5ebe('0x22')](function(_0x4c5d1a){if(_0x4c5d1a){_0x13a55e=_0x4c5d1a;if(_0x434088[_0x5ebe('0xa4')]){if(_0x434088['List']['Contacts'][_0x5ebe('0x4d')]){return _0x434088[_0x5ebe('0xa4')]['Contacts'][0x0];}else{return db[_0x5ebe('0x8b')][_0x5ebe('0x64')](_[_0x5ebe('0x1a')](_0x3ebf84[_0x5ebe('0x60')],{'firstName':_0x3ebf84[_0x5ebe('0x60')]['to'],'email':_0x3ebf84[_0x5ebe('0x60')]['to'],'phone':_0x3ebf84[_0x5ebe('0x60')]['to'],'ListId':_0x434088[_0x5ebe('0x6f')]}));}}else{throw new Error(_0x5ebe('0xb3'));}}})['then'](function(_0x241a2e){if(_0x241a2e){var _0x4db97d={'UserId':_0x3ebf84[_0x5ebe('0x72')]['id'],'ContactId':_0x241a2e['id'],'MailAccountId':_0x434088['id'],'inReplyTo':_0x13a55e[_0x5ebe('0xb4')],'to':_0x3ebf84['body'][_0x5ebe('0xa8')],'cc':_0x3ebf84[_0x5ebe('0x60')]['cc'],'subject':_0x3ebf84[_0x5ebe('0x60')][_0x5ebe('0xb5')],'attach':_0x3ebf84[_0x5ebe('0x60')][_0x5ebe('0xb6')],'firstMsgDirection':_0x5ebe('0xb7'),'lastMsgAt':moment()[_0x5ebe('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x5ebe('0xb7'),'lastMsgBody':_0x3ebf84['body'][_0x5ebe('0x60')],'Messages':[_[_0x5ebe('0x56')](_0x3ebf84[_0x5ebe('0x60')],{'messageId':_0x13a55e[_0x5ebe('0xb4')],'sentAt':moment()[_0x5ebe('0x9e')](_0x5ebe('0x9f')),'read':!![],'MailAccountId':_0x434088['id'],'UserId':_0x3ebf84[_0x5ebe('0x72')]['id'],'ContactId':_0x241a2e['id']})]};if(_0x3ebf84[_0x5ebe('0x60')]['Interaction']){_0x4db97d=_[_0x5ebe('0x56')](_0x4db97d,_0x3ebf84[_0x5ebe('0x60')]['Interaction']);}return db[_0x5ebe('0x88')][_0x5ebe('0x64')](_0x4db97d,{'include':[{'model':db[_0x5ebe('0x9c')],'as':_0x5ebe('0xb8')}]});}})[_0x5ebe('0x22')](respondWithResult(_0x4a9608,null))[_0x5ebe('0x2c')](handleError(_0x4a9608,null));};exports['verifySmtp']=function(_0x30e513,_0x3a1d98,_0x2c7ace){return db['MailAccount'][_0x5ebe('0x5f')]({'where':{'id':_0x30e513[_0x5ebe('0x61')]['id']},'include':[{'model':db[_0x5ebe('0x40')],'as':_0x5ebe('0x41'),'raw':!![]}]})[_0x5ebe('0x22')](handleEntityNotFound(_0x3a1d98,null))[_0x5ebe('0x22')](function(_0x5dbd1d){if(_0x5dbd1d&&_0x5dbd1d[_0x5ebe('0x41')]){var _0x4ae387={'id':_0x5dbd1d['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5dbd1d[_0x5ebe('0x41')][_0x5ebe('0x79')]){_0x4ae387[_0x5ebe('0x79')]=_0x5dbd1d['Smtp']['service'];}else{_0x4ae387[_0x5ebe('0x77')]=_0x5dbd1d[_0x5ebe('0x41')]['host'];_0x4ae387['port']=_0x5dbd1d['Smtp'][_0x5ebe('0x78')];_0x4ae387[_0x5ebe('0xb0')]=_0x5dbd1d['Smtp']['secure'];}if(_0x5dbd1d[_0x5ebe('0x41')][_0x5ebe('0x76')]){_0x4ae387[_0x5ebe('0xaf')]={'user':_0x5dbd1d[_0x5ebe('0x41')][_0x5ebe('0x72')],'pass':_0x5dbd1d['Smtp'][_0x5ebe('0x75')]};}return respondWithRpcPromise('VerifySmtp',_0x5ebe('0xb9'),{'account':_0x4ae387});}})[_0x5ebe('0x22')](respondWithResult(_0x3a1d98,null))[_0x5ebe('0x2c')](handleError(_0x3a1d98,null));};exports[_0x5ebe('0x39')]=function(_0x1008eb,_0x566df7){return db[_0x5ebe('0x58')][_0x5ebe('0x5f')]({'where':{'id':_0x1008eb[_0x5ebe('0x61')]['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x566df7,null))['then'](function(_0x18e765){if(_0x18e765&&_0x18e765['service']){throw new db['Sequelize'][(_0x5ebe('0xba'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x18e765;})['then'](removeEntity(_0x566df7,null))['catch'](handleError(_0x566df7,null));};exports['addAgents']=function(_0x548702,_0x18b0e6,_0x1e7c20){return db[_0x5ebe('0x58')][_0x5ebe('0x5f')]({'where':{'id':_0x548702['params']['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x18b0e6,null))['then'](function(_0x5d44dc){if(_0x5d44dc){return _0x5d44dc['addAgents'](_0x548702['body']['ids'],_['omit'](_0x548702[_0x5ebe('0x60')],['ids','id'])||{})['spread'](function(_0x1f9269){for(var _0x39c069=0x0;_0x39c069<_0x548702[_0x5ebe('0x60')]['ids'][_0x5ebe('0x4d')];_0x39c069+=0x1){socket[_0x5ebe('0xbb')](_0x5ebe('0xbc'),{'UserId':_0x548702[_0x5ebe('0x60')][_0x5ebe('0xbd')][_0x39c069],'MailAccountId':_0x548702['params']['id']});}return _0x1f9269;});}})[_0x5ebe('0x22')](respondWithResult(_0x18b0e6,null))[_0x5ebe('0x2c')](handleError(_0x18b0e6,null));};exports[_0x5ebe('0xbe')]=function(_0x10037b,_0x5c4ed3,_0x3d290c){return db[_0x5ebe('0x58')][_0x5ebe('0x5f')]({'where':{'id':_0x10037b[_0x5ebe('0x61')]['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x5c4ed3,null))['then'](function(_0x3d0a3c){if(_0x3d0a3c){return _0x3d0a3c[_0x5ebe('0xbe')](_0x10037b[_0x5ebe('0x47')][_0x5ebe('0xbd')])['then'](function(){if(_[_0x5ebe('0xbf')](_0x10037b[_0x5ebe('0x47')][_0x5ebe('0xbd')])){for(var _0x409961=0x0;_0x409961<_0x10037b[_0x5ebe('0x47')][_0x5ebe('0xbd')]['length'];_0x409961+=0x1){socket[_0x5ebe('0xbb')](_0x5ebe('0xc0'),{'UserId':Number(_0x10037b[_0x5ebe('0x47')][_0x5ebe('0xbd')][_0x409961]),'MailAccountId':Number(_0x10037b[_0x5ebe('0x61')]['id'])});}}else{socket[_0x5ebe('0xbb')](_0x5ebe('0xc0'),{'UserId':Number(_0x10037b[_0x5ebe('0x47')]['ids']),'MailAccountId':Number(_0x10037b[_0x5ebe('0x61')]['id'])});}});}})[_0x5ebe('0x22')](respondWithStatusCode(_0x5c4ed3,null))[_0x5ebe('0x2c')](handleError(_0x5c4ed3,null));};exports[_0x5ebe('0xc1')]=function(_0x1f55a8,_0x64218c,_0x29e22e){var _0x33675e={};var _0x2eec26={};var _0x3fdc63;var _0x8ba07;return db[_0x5ebe('0x58')][_0x5ebe('0x66')]({'where':{'id':_0x1f55a8[_0x5ebe('0x61')]['id']}})[_0x5ebe('0x22')](handleEntityNotFound(_0x64218c,null))[_0x5ebe('0x22')](function(_0x1a2343){if(_0x1a2343){_0x3fdc63=_0x1a2343;_0x2eec26[_0x5ebe('0x46')]=_[_0x5ebe('0x48')](db[_0x5ebe('0xc2')]['rawAttributes']);_0x2eec26[_0x5ebe('0x47')]=_[_0x5ebe('0x48')](_0x1f55a8[_0x5ebe('0x47')]);_0x2eec26[_0x5ebe('0x49')]=_[_0x5ebe('0x4a')](_0x2eec26[_0x5ebe('0x46')],_0x2eec26[_0x5ebe('0x47')]);_0x33675e[_0x5ebe('0x4b')]=_['intersection'](_0x2eec26['model'],qs[_0x5ebe('0x4c')](_0x1f55a8[_0x5ebe('0x47')][_0x5ebe('0x4c')]));_0x33675e[_0x5ebe('0x4b')]=_0x33675e[_0x5ebe('0x4b')][_0x5ebe('0x4d')]?_0x33675e[_0x5ebe('0x4b')]:_0x2eec26[_0x5ebe('0x46')];_0x33675e[_0x5ebe('0x50')]=qs[_0x5ebe('0x51')](_0x1f55a8[_0x5ebe('0x47')][_0x5ebe('0x51')]);_0x33675e['where']=qs[_0x5ebe('0x49')](_['pick'](_0x1f55a8[_0x5ebe('0x47')],_0x2eec26[_0x5ebe('0x49')]));if(_0x1f55a8[_0x5ebe('0x47')][_0x5ebe('0x53')]){_0x33675e[_0x5ebe('0x54')]=_['merge'](_0x33675e[_0x5ebe('0x54')],{'$or':_[_0x5ebe('0x42')](_0x33675e[_0x5ebe('0x4b')],function(_0x271378){var _0x2bb7db={};_0x2bb7db[_0x271378]={'$like':'%'+_0x1f55a8[_0x5ebe('0x47')][_0x5ebe('0x53')]+'%'};return _0x2bb7db;})});}_0x33675e=_[_0x5ebe('0x56')]({},_0x33675e,_0x1f55a8[_0x5ebe('0x57')]);return _0x3fdc63[_0x5ebe('0xc1')](_0x33675e);}})['then'](function(_0x2a9ff6){if(_0x2a9ff6){_0x8ba07=_0x2a9ff6[_0x5ebe('0x4d')];if(!_0x1f55a8[_0x5ebe('0x47')]['hasOwnProperty'](_0x5ebe('0x67'))){_0x33675e[_0x5ebe('0x4f')]=qs[_0x5ebe('0x4f')](_0x1f55a8['query'][_0x5ebe('0x4f')]);_0x33675e[_0x5ebe('0x32')]=qs[_0x5ebe('0x32')](_0x1f55a8[_0x5ebe('0x47')][_0x5ebe('0x32')]);}return _0x3fdc63['getAgents'](_0x33675e);}})[_0x5ebe('0x22')](function(_0x174ad0){if(_0x174ad0){return _0x174ad0?{'count':_0x8ba07,'rows':_0x174ad0}:null;}})[_0x5ebe('0x22')](respondWithResult(_0x64218c,null))[_0x5ebe('0x2c')](handleError(_0x64218c,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index e1e5e21..3156e4f 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 _0x9e9f=['hook','exports','events','../../mysqldb','MailAccount','update','remove','emit','hasOwnProperty'];(function(_0x243b69,_0x173ec0){var _0x1d091b=function(_0x1c8fb0){while(--_0x1c8fb0){_0x243b69['push'](_0x243b69['shift']());}};_0x1d091b(++_0x173ec0);}(_0x9e9f,0x1cd));var _0xf9e9=function(_0x5a1a51,_0x144c79){_0x5a1a51=_0x5a1a51-0x0;var _0x47edd7=_0x9e9f[_0x5a1a51];return _0x47edd7;};'use strict';var EventEmitter=require(_0xf9e9('0x0'));var MailAccount=require(_0xf9e9('0x1'))['db'][_0xf9e9('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xf9e9('0x3'),'afterDestroy':_0xf9e9('0x4')};function emitEvent(_0x49bbb9){return function(_0x155480,_0x5c6057,_0x4afe31){MailAccountEvents[_0xf9e9('0x5')](_0x49bbb9+':'+_0x155480['id'],_0x155480);MailAccountEvents['emit'](_0x49bbb9,_0x155480);_0x4afe31(null);};}for(var e in events){if(events[_0xf9e9('0x6')](e)){var event=events[e];MailAccount[_0xf9e9('0x7')](e,emitEvent(event));}}module[_0xf9e9('0x8')]=MailAccountEvents; \ No newline at end of file +var _0x7257=['save','update','emit','hasOwnProperty','exports','events','../../mysqldb','MailAccount','setMaxListeners'];(function(_0x255093,_0x4fe4fa){var _0x440166=function(_0x366f54){while(--_0x366f54){_0x255093['push'](_0x255093['shift']());}};_0x440166(++_0x4fe4fa);}(_0x7257,0x1ac));var _0x7725=function(_0x180cd0,_0x386c6e){_0x180cd0=_0x180cd0-0x0;var _0x49fc32=_0x7257[_0x180cd0];return _0x49fc32;};'use strict';var EventEmitter=require(_0x7725('0x0'));var MailAccount=require(_0x7725('0x1'))['db'][_0x7725('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7725('0x3')](0x0);var events={'afterCreate':_0x7725('0x4'),'afterUpdate':_0x7725('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3ca6c7){return function(_0x206143,_0x18f64f,_0x3aa8f6){MailAccountEvents[_0x7725('0x6')](_0x3ca6c7+':'+_0x206143['id'],_0x206143);MailAccountEvents['emit'](_0x3ca6c7,_0x206143);_0x3aa8f6(null);};}for(var e in events){if(events[_0x7725('0x7')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x7725('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index f585797..79658a1 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 _0x1dd4=['mail_accounts','../../config/logger','api','moment','request-promise','path','../../config/environment','./mailAccount.attributes','exports','define','MailAccount'];(function(_0x4e5d57,_0x742e0f){var _0x160d0a=function(_0x84a1ae){while(--_0x84a1ae){_0x4e5d57['push'](_0x4e5d57['shift']());}};_0x160d0a(++_0x742e0f);}(_0x1dd4,0x12a));var _0x41dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dd4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x41dd('0x0'))(_0x41dd('0x1'));var moment=require(_0x41dd('0x2'));var BPromise=require('bluebird');var rp=require(_0x41dd('0x3'));var fs=require('fs');var path=require(_0x41dd('0x4'));var rimraf=require('rimraf');var config=require(_0x41dd('0x5'));var attributes=require(_0x41dd('0x6'));module[_0x41dd('0x7')]=function(_0x1e11ff,_0x374008){return _0x1e11ff[_0x41dd('0x8')](_0x41dd('0x9'),attributes,{'tableName':_0x41dd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbcf4=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','define','MailAccount','mail_accounts'];(function(_0x5017a2,_0x13718b){var _0x4ae179=function(_0x882998){while(--_0x882998){_0x5017a2['push'](_0x5017a2['shift']());}};_0x4ae179(++_0x13718b);}(_0xbcf4,0x1d9));var _0x4bcf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbcf4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4bcf('0x0'));var util=require(_0x4bcf('0x1'));var logger=require(_0x4bcf('0x2'))(_0x4bcf('0x3'));var moment=require(_0x4bcf('0x4'));var BPromise=require(_0x4bcf('0x5'));var rp=require(_0x4bcf('0x6'));var fs=require('fs');var path=require(_0x4bcf('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailAccount.attributes');module['exports']=function(_0xc55383,_0x42f53e){return _0xc55383[_0x4bcf('0x8')](_0x4bcf('0x9'),attributes,{'tableName':_0x4bcf('0xa'),'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 a4e2f68..83553cf 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 _0x2d70=['List\x20not\x20found','contact','messageId','generate','from','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','interaction','created','attachments','originTo','bcc','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','./mailAccount.socket','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailAccount','findAll','options','raw','attributes','limit','map','include','model','debug','ShowMailAccount','MailAccount','find','where','NotifyMailAccount','body','difference','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','MailApplication','Applications','MailServerOut','Smtp','get','account','list','orderBy','priority','asc','autoclose','applications','push','length','close','*,*,*,*','CmContact','create'];(function(_0x5b5eb4,_0x117c87){var _0x42af53=function(_0xdf6fcb){while(--_0xdf6fcb){_0x5b5eb4['push'](_0x5b5eb4['shift']());}};_0x42af53(++_0x117c87);}(_0x2d70,0x150));var _0x02d7=function(_0x4bfe08,_0x48ae7b){_0x4bfe08=_0x4bfe08-0x0;var _0x1f9125=_0x2d70[_0x4bfe08];return _0x1f9125;};'use strict';var _=require(_0x02d7('0x0'));var util=require(_0x02d7('0x1'));var moment=require(_0x02d7('0x2'));var BPromise=require('bluebird');var rs=require(_0x02d7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x02d7('0x4'));var logger=require(_0x02d7('0x5'))(_0x02d7('0x6'));var config=require(_0x02d7('0x7'));var jayson=require(_0x02d7('0x8'));var client=jayson[_0x02d7('0x9')]['http']({'port':0x232c});config[_0x02d7('0xa')]=_[_0x02d7('0xb')](config[_0x02d7('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x02d7('0xc'))['register'](socket);function respondWithRpcPromise(_0x468782,_0x61e2f4,_0x46746d){return new BPromise(function(_0x46bf1e,_0x261935){return client[_0x02d7('0xd')](_0x468782,_0x46746d)[_0x02d7('0xe')](function(_0x37e274){logger[_0x02d7('0xf')](_0x02d7('0x10'),_0x61e2f4,_0x02d7('0x11'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x61e2f4,_0x02d7('0x11'),JSON[_0x02d7('0x12')](_0x37e274));if(_0x37e274[_0x02d7('0x13')]){if(_0x37e274[_0x02d7('0x13')][_0x02d7('0x14')]===0x1f4){logger[_0x02d7('0x13')](_0x02d7('0x10'),_0x61e2f4,_0x37e274['error'][_0x02d7('0x15')]);return _0x261935(_0x37e274['error'][_0x02d7('0x15')]);}logger['error'](_0x02d7('0x10'),_0x61e2f4,_0x37e274[_0x02d7('0x13')][_0x02d7('0x15')]);return _0x46bf1e(_0x37e274[_0x02d7('0x13')][_0x02d7('0x15')]);}else{logger[_0x02d7('0xf')]('MailAccount,\x20%s,\x20%s',_0x61e2f4,_0x02d7('0x11'));_0x46bf1e(_0x37e274[_0x02d7('0x16')][_0x02d7('0x15')]);}})[_0x02d7('0x17')](function(_0x3d8926){logger['error'](_0x02d7('0x10'),_0x61e2f4,_0x3d8926);_0x261935(_0x3d8926);});});}exports[_0x02d7('0x18')]=function(_0x997a7a){var _0x43ed2a=this;return new Promise(function(_0x19848e,_0x4f28a0){return db['MailAccount'][_0x02d7('0x19')]({'raw':_0x997a7a[_0x02d7('0x1a')]?_0x997a7a['options'][_0x02d7('0x1b')]===undefined?!![]:![]:!![],'where':_0x997a7a['options']?_0x997a7a[_0x02d7('0x1a')]['where']||null:null,'attributes':_0x997a7a[_0x02d7('0x1a')]?_0x997a7a[_0x02d7('0x1a')][_0x02d7('0x1c')]||null:null,'limit':_0x997a7a[_0x02d7('0x1a')]?_0x997a7a[_0x02d7('0x1a')][_0x02d7('0x1d')]||null:null,'include':_0x997a7a[_0x02d7('0x1a')]?_0x997a7a[_0x02d7('0x1a')]['include']?_[_0x02d7('0x1e')](_0x997a7a[_0x02d7('0x1a')][_0x02d7('0x1f')],function(_0x2af8ab){return{'model':db[_0x2af8ab[_0x02d7('0x20')]],'as':_0x2af8ab['as'],'attributes':_0x2af8ab[_0x02d7('0x1c')],'include':_0x2af8ab[_0x02d7('0x1f')]?_[_0x02d7('0x1e')](_0x2af8ab[_0x02d7('0x1f')],function(_0x181c45){return{'model':db[_0x181c45[_0x02d7('0x20')]],'as':_0x181c45['as'],'attributes':_0x181c45[_0x02d7('0x1c')],'include':_0x181c45[_0x02d7('0x1f')]?_[_0x02d7('0x1e')](_0x181c45[_0x02d7('0x1f')],function(_0x311b12){return{'model':db[_0x311b12[_0x02d7('0x20')]],'as':_0x311b12['as'],'attributes':_0x311b12['attributes']};}):[]};}):[]};}):[]:[]})[_0x02d7('0xe')](function(_0x4afadc){logger['info'](_0x02d7('0x18'),_0x997a7a);logger[_0x02d7('0x21')](_0x02d7('0x18'),_0x997a7a,JSON[_0x02d7('0x12')](_0x4afadc));_0x19848e(_0x4afadc);})[_0x02d7('0x17')](function(_0x2e95cf){logger['error']('GetMailAccount',_0x2e95cf[_0x02d7('0x15')],_0x997a7a);_0x4f28a0(_0x43ed2a[_0x02d7('0x13')](0x1f4,_0x2e95cf[_0x02d7('0x15')]));});});};exports[_0x02d7('0x22')]=function(_0x1c2651){var _0x5accc8=this;return new Promise(function(_0x55747f,_0x3673d2){return db[_0x02d7('0x23')][_0x02d7('0x24')]({'raw':_0x1c2651[_0x02d7('0x1a')]?_0x1c2651[_0x02d7('0x1a')][_0x02d7('0x1b')]===undefined?!![]:![]:!![],'where':_0x1c2651[_0x02d7('0x1a')]?_0x1c2651[_0x02d7('0x1a')][_0x02d7('0x25')]||null:null,'attributes':_0x1c2651[_0x02d7('0x1a')]?_0x1c2651[_0x02d7('0x1a')]['attributes']||null:null,'include':_0x1c2651[_0x02d7('0x1a')]?_0x1c2651[_0x02d7('0x1a')][_0x02d7('0x1f')]?_['map'](_0x1c2651[_0x02d7('0x1a')]['include'],function(_0xdc94bc){return{'model':db[_0xdc94bc['model']],'as':_0xdc94bc['as'],'attributes':_0xdc94bc['attributes'],'include':_0xdc94bc['include']?_[_0x02d7('0x1e')](_0xdc94bc[_0x02d7('0x1f')],function(_0x3cc214){return{'model':db[_0x3cc214[_0x02d7('0x20')]],'as':_0x3cc214['as'],'attributes':_0x3cc214['attributes'],'include':_0x3cc214[_0x02d7('0x1f')]?_['map'](_0x3cc214['include'],function(_0x5a87f3){return{'model':db[_0x5a87f3[_0x02d7('0x20')]],'as':_0x5a87f3['as'],'attributes':_0x5a87f3[_0x02d7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x02d7('0xe')](function(_0x357cbd){logger[_0x02d7('0xf')](_0x02d7('0x22'),_0x1c2651);logger[_0x02d7('0x21')](_0x02d7('0x22'),_0x1c2651,JSON['stringify'](_0x357cbd));_0x55747f(_0x357cbd);})[_0x02d7('0x17')](function(_0x57cdc0){logger[_0x02d7('0x13')]('ShowMailAccount',_0x57cdc0[_0x02d7('0x15')],_0x1c2651);_0x3673d2(_0x5accc8[_0x02d7('0x13')](0x1f4,_0x57cdc0[_0x02d7('0x15')]));});});};exports[_0x02d7('0x26')]=function(_0x493999){var _0x9b2dbc=this;return new Promise(function(_0x410dab,_0x6a9e8f){var _0xce010={'body':_0x493999[_0x02d7('0x27')],'channel':'mail'};var _0x3b4dba=_[_0x02d7('0x28')](_['keys'](db['CmContact'][_0x02d7('0x29')]),[_0x02d7('0x2a'),_0x02d7('0x2b'),_0x02d7('0x2c'),_0x02d7('0x2d')]);var _0x7b4256=![];if(_0x493999['body']['id']){delete _0x493999[_0x02d7('0x27')]['id'];}if(_[_0x02d7('0x2e')](_0x493999['body']['from'])){return _0x6a9e8f(_0x9b2dbc['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x02d7('0x2e')](_0x493999[_0x02d7('0x27')][_0x02d7('0x27')])||_0x493999[_0x02d7('0x27')][_0x02d7('0x27')]===''){return _0x6a9e8f(_0x9b2dbc[_0x02d7('0x13')](0x1f4,_0x02d7('0x2f')));}if(_['isNil'](_0x493999[_0x02d7('0x27')][_0x02d7('0x30')])){return _0x6a9e8f(_0x9b2dbc[_0x02d7('0x13')](0x1f4,_0x02d7('0x31')+_0x3b4dba));}if(!_[_0x02d7('0x32')](_0x3b4dba,_0x493999['body'][_0x02d7('0x30')])){return _0x6a9e8f(_0x9b2dbc[_0x02d7('0x13')](0x1f4,_0x02d7('0x33')+_0x3b4dba));}var _0x571cb3={};_0x571cb3[_0x493999[_0x02d7('0x27')][_0x02d7('0x30')]]=_0x493999[_0x02d7('0x27')]['from'];return db['MailAccount'][_0x02d7('0x24')]({'where':{'id':_0x493999['account']['id']},'include':[{'model':db['CmList'],'as':_0x02d7('0x34'),'include':[{'model':db['CmContact'],'as':_0x02d7('0x35'),'where':_0x571cb3,'limit':0x1,'order':[[_0x02d7('0x2b'),'DESC']]}]},{'model':db[_0x02d7('0x36')],'as':_0x02d7('0x37')},{'model':db[_0x02d7('0x38')],'as':_0x02d7('0x39')}]})[_0x02d7('0xe')](function(_0x3345a9){if(_0x3345a9&&_0x3345a9['List']){var _0x588329=_0x3345a9[_0x02d7('0x3a')]({'plain':!![]});_0xce010[_0x02d7('0x3b')]=_['omit'](_0x588329,[_0x02d7('0x37'),_0x02d7('0x34')]);_0xce010['applications']=_0x588329[_0x02d7('0x37')];_0xce010[_0x02d7('0x3c')]=_0x588329[_0x02d7('0x34')];_0xce010['applications']=_[_0x02d7('0x3d')](_0xce010['applications'],[_0x02d7('0x3e')],[_0x02d7('0x3f')]);if(_0xce010[_0x02d7('0x3b')]&&_0xce010['account'][_0x02d7('0x40')]){_0xce010[_0x02d7('0x41')][_0x02d7('0x42')]({'id':0x0,'priority':_0xce010[_0x02d7('0x41')][_0x02d7('0x43')]+0x1,'app':_0x02d7('0x44'),'appdata':'autoclose','interval':_0x02d7('0x45')});}if(_0xce010[_0x02d7('0x3b')][_0x02d7('0x37')]){delete _0xce010[_0x02d7('0x3b')]['Applications'];}if(_0xce010[_0x02d7('0x3b')]['List']){delete _0xce010[_0x02d7('0x3b')][_0x02d7('0x34')];}if(_0x588329[_0x02d7('0x34')][_0x02d7('0x35')][_0x02d7('0x43')]){return _0x588329[_0x02d7('0x34')][_0x02d7('0x35')][0x0];}var _0x4b3b8d=_[_0x02d7('0xb')](_0x493999[_0x02d7('0x27')],{'firstName':_0x493999[_0x02d7('0x27')]['from'],'ListId':_0x588329[_0x02d7('0x2d')]});_0x4b3b8d[_0x493999['body'][_0x02d7('0x30')]]=_0x493999[_0x02d7('0x27')]['from'];return db[_0x02d7('0x46')][_0x02d7('0x47')](_0x4b3b8d);}else{throw new Error(_0x02d7('0x48'));}})[_0x02d7('0xe')](function(_0x2f4177){_0xce010[_0x02d7('0x49')]=_0x2f4177;if(_0x2f4177){if(!_0x493999[_0x02d7('0x27')][_0x02d7('0x15')][_0x02d7('0x4a')]){_0x493999[_0x02d7('0x27')][_0x02d7('0x15')]['messageId']=rs[_0x02d7('0x4b')]()+'\x20'+_0x493999[_0x02d7('0x27')][_0x02d7('0x15')][_0x02d7('0x4c')];}var _0x12716a={'ContactId':_0x2f4177['id'],'MailAccountId':_0x493999[_0x02d7('0x3b')]['id'],'inReplyTo':_0x493999[_0x02d7('0x27')]['message']['messageId'],'to':_0x493999[_0x02d7('0x27')][_0x02d7('0x15')][_0x02d7('0x4c')],'cc':_0x493999[_0x02d7('0x27')][_0x02d7('0x15')]['cc'],'subject':_0x493999['body']['message'][_0x02d7('0x4d')],'attach':_0x493999[_0x02d7('0x27')][_0x02d7('0x15')][_0x02d7('0x4e')],'lastMsgAt':moment()[_0x02d7('0x4f')](_0x02d7('0x50')),'lastMsgDirection':'in','lastMsgBody':_0x493999[_0x02d7('0x27')]['body']};return db[_0x02d7('0x51')]['find']({'where':{'closed':![],'MailAccountId':_0x493999[_0x02d7('0x3b')]['id']},'include':[{'model':db[_0x02d7('0x52')],'as':_0x02d7('0x53'),'attributes':[_0x02d7('0x4a')],'where':{'messageId':_0x493999['body'][_0x02d7('0x15')][_0x02d7('0x54')]}}]})[_0x02d7('0xe')](function(_0x50ce73){if(_0x50ce73){return[_0x50ce73,![]];}return db['MailInteraction'][_0x02d7('0x47')](_0x12716a)[_0x02d7('0xe')](function(_0x195500){return[_0x195500,!![]];});});}else{throw new Error(_0x02d7('0x55'));}})[_0x02d7('0x56')](function(_0x35c0df,_0x2598b1){if(_0x35c0df){_0x7b4256=_0x2598b1;if(!_0x2598b1){return _0x35c0df[_0x02d7('0x57')]({'inReplyTo':_0x493999['body']['message'][_0x02d7('0x4a')],'to':_0x493999[_0x02d7('0x27')][_0x02d7('0x15')][_0x02d7('0x4c')],'cc':_0x493999[_0x02d7('0x27')][_0x02d7('0x15')]['cc'],'subject':_0x493999[_0x02d7('0x27')][_0x02d7('0x15')][_0x02d7('0x4d')],'attach':_0x35c0df['attach']?_0x35c0df[_0x02d7('0x4e')]:_0x493999[_0x02d7('0x27')][_0x02d7('0x15')][_0x02d7('0x4e')],'substatus':null,'substatusAt':moment()[_0x02d7('0x4f')](_0x02d7('0x50')),'lastMsgAt':moment()['format'](_0x02d7('0x50')),'lastMsgDirection':'in','lastMsgBody':_0x493999[_0x02d7('0x27')][_0x02d7('0x27')]});}else{return _0x35c0df;}}})['then'](function(_0x4b96b9){_0xce010[_0x02d7('0x58')]=_0x4b96b9[_0x02d7('0x3a')]({'plain':!![]});_0xce010[_0x02d7('0x58')][_0x02d7('0x59')]=_0x7b4256;return db[_0x02d7('0x52')][_0x02d7('0x47')]({'body':_0x493999[_0x02d7('0x27')][_0x02d7('0x27')],'MailAccountId':_0x493999[_0x02d7('0x3b')]['id'],'MailInteractionId':_0x4b96b9['id'],'direction':'in','ContactId':_0xce010[_0x02d7('0x49')]['id'],'messageId':_0x493999[_0x02d7('0x27')][_0x02d7('0x15')]['messageId'],'from':_0x493999[_0x02d7('0x27')][_0x02d7('0x15')][_0x02d7('0x4c')],'to':_0x493999[_0x02d7('0x27')]['message']['to'],'cc':_0x493999['body']['message']['cc'],'subject':_0x493999[_0x02d7('0x27')][_0x02d7('0x15')][_0x02d7('0x4d')],'attach':_0x493999['body'][_0x02d7('0x15')][_0x02d7('0x4e')],'Attachments':_0x493999['body'][_0x02d7('0x15')][_0x02d7('0x5a')],'originTo':_0x493999[_0x02d7('0x27')]['message'][_0x02d7('0x5b')],'originCc':_0x493999['body'][_0x02d7('0x15')]['originCc'],'bcc':_0x493999[_0x02d7('0x27')][_0x02d7('0x15')][_0x02d7('0x5c')],'ChatWebsiteId':_0x493999['body'][_0x02d7('0x15')]['ChatWebsiteId']||null,'originChannel':_0x493999['body'][_0x02d7('0x15')]['originChannel']||_0x02d7('0x5d'),'ChatOfflineMessageId':_0x493999['body'][_0x02d7('0x15')][_0x02d7('0x5e')]||null},{'include':[{'model':db[_0x02d7('0x5f')],'as':_0x02d7('0x60')}]});})[_0x02d7('0xe')](function(_0x533a4f){_0xce010[_0x02d7('0x15')]=_0x533a4f;if(_0xce010['interaction'][_0x02d7('0x61')]){return db['User'][_0x02d7('0x24')]({'attributes':['id',_0x02d7('0x62')],'where':{'id':_0xce010[_0x02d7('0x58')][_0x02d7('0x61')]}})['then'](function(_0x502fe6){if(_0x502fe6){_0xce010[_0x02d7('0x41')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x502fe6['name']+','+(_0xce010[_0x02d7('0x3b')][_0x02d7('0x63')]||0xa),'interval':_0x02d7('0x45')});}return respondWithRpcPromise(_0x02d7('0x64'),_0x02d7('0x65'),_0xce010);});}return respondWithRpcPromise(_0x02d7('0x64'),_0x02d7('0x65'),_0xce010);})['then'](function(_0x2f9446){_0x410dab(_0x2f9446);})[_0x02d7('0x17')](function(_0x4778a9){_0x6a9e8f(_0x9b2dbc['error'](0x1f4,_0x4778a9['message']));});});}; \ No newline at end of file +var _0x63b8=['length','from','create','contact','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Contact\x20not\x20found','spread','update','interaction','created','MailMessage','attachments','originTo','originCc','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','User','name','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','util','moment','randomstring','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','options','raw','where','attributes','limit','include','map','model','ShowMailAccount','find','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','MailApplication','MailServerOut','Smtp','get','account','omit','Applications','orderBy','priority','asc','autoclose','applications','push','*,*,*,*'];(function(_0x47c46e,_0x23a296){var _0x3c0d69=function(_0x4e869e){while(--_0x4e869e){_0x47c46e['push'](_0x47c46e['shift']());}};_0x3c0d69(++_0x23a296);}(_0x63b8,0x1bc));var _0x863b=function(_0x446ad0,_0xe5aa2){_0x446ad0=_0x446ad0-0x0;var _0x49e596=_0x63b8[_0x446ad0];return _0x49e596;};'use strict';var _=require('lodash');var util=require(_0x863b('0x0'));var moment=require(_0x863b('0x1'));var BPromise=require('bluebird');var rs=require(_0x863b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x863b('0x3'));var logger=require(_0x863b('0x4'))(_0x863b('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x863b('0x6')]({'port':0x232c});config[_0x863b('0x7')]=_[_0x863b('0x8')](config[_0x863b('0x7')],{'host':_0x863b('0x9'),'port':0x18eb});var socket=require(_0x863b('0xa'))(new Redis(config[_0x863b('0x7')]));require(_0x863b('0xb'))[_0x863b('0xc')](socket);function respondWithRpcPromise(_0x5223b7,_0x4707f0,_0x4fcf22){return new BPromise(function(_0x390921,_0x3b9161){return client['request'](_0x5223b7,_0x4fcf22)[_0x863b('0xd')](function(_0x2f129b){logger[_0x863b('0xe')](_0x863b('0xf'),_0x4707f0,_0x863b('0x10'));logger[_0x863b('0x11')](_0x863b('0x12'),_0x4707f0,_0x863b('0x10'),JSON[_0x863b('0x13')](_0x2f129b));if(_0x2f129b[_0x863b('0x14')]){if(_0x2f129b[_0x863b('0x14')][_0x863b('0x15')]===0x1f4){logger[_0x863b('0x14')]('MailAccount,\x20%s,\x20%s',_0x4707f0,_0x2f129b[_0x863b('0x14')]['message']);return _0x3b9161(_0x2f129b['error']['message']);}logger[_0x863b('0x14')](_0x863b('0xf'),_0x4707f0,_0x2f129b[_0x863b('0x14')]['message']);return _0x390921(_0x2f129b[_0x863b('0x14')][_0x863b('0x16')]);}else{logger[_0x863b('0xe')](_0x863b('0xf'),_0x4707f0,_0x863b('0x10'));_0x390921(_0x2f129b[_0x863b('0x17')][_0x863b('0x16')]);}})[_0x863b('0x18')](function(_0x1aac2b){logger['error']('MailAccount,\x20%s,\x20%s',_0x4707f0,_0x1aac2b);_0x3b9161(_0x1aac2b);});});}exports[_0x863b('0x19')]=function(_0x4f6772){var _0x4137d6=this;return new Promise(function(_0x5b2d6b,_0x1d1a4c){return db[_0x863b('0x1a')]['findAll']({'raw':_0x4f6772[_0x863b('0x1b')]?_0x4f6772[_0x863b('0x1b')][_0x863b('0x1c')]===undefined?!![]:![]:!![],'where':_0x4f6772[_0x863b('0x1b')]?_0x4f6772[_0x863b('0x1b')][_0x863b('0x1d')]||null:null,'attributes':_0x4f6772[_0x863b('0x1b')]?_0x4f6772['options'][_0x863b('0x1e')]||null:null,'limit':_0x4f6772[_0x863b('0x1b')]?_0x4f6772['options'][_0x863b('0x1f')]||null:null,'include':_0x4f6772[_0x863b('0x1b')]?_0x4f6772[_0x863b('0x1b')][_0x863b('0x20')]?_[_0x863b('0x21')](_0x4f6772[_0x863b('0x1b')][_0x863b('0x20')],function(_0x1bbaa0){return{'model':db[_0x1bbaa0[_0x863b('0x22')]],'as':_0x1bbaa0['as'],'attributes':_0x1bbaa0[_0x863b('0x1e')],'include':_0x1bbaa0[_0x863b('0x20')]?_[_0x863b('0x21')](_0x1bbaa0['include'],function(_0x4c4916){return{'model':db[_0x4c4916[_0x863b('0x22')]],'as':_0x4c4916['as'],'attributes':_0x4c4916['attributes'],'include':_0x4c4916[_0x863b('0x20')]?_['map'](_0x4c4916[_0x863b('0x20')],function(_0x11e4d8){return{'model':db[_0x11e4d8[_0x863b('0x22')]],'as':_0x11e4d8['as'],'attributes':_0x11e4d8[_0x863b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x863b('0xd')](function(_0x522751){logger['info']('GetMailAccount',_0x4f6772);logger[_0x863b('0x11')]('GetMailAccount',_0x4f6772,JSON[_0x863b('0x13')](_0x522751));_0x5b2d6b(_0x522751);})[_0x863b('0x18')](function(_0x3b2c43){logger[_0x863b('0x14')](_0x863b('0x19'),_0x3b2c43['message'],_0x4f6772);_0x1d1a4c(_0x4137d6[_0x863b('0x14')](0x1f4,_0x3b2c43[_0x863b('0x16')]));});});};exports[_0x863b('0x23')]=function(_0x295046){var _0x36c8ab=this;return new Promise(function(_0x4328f5,_0x10f7ce){return db[_0x863b('0x1a')][_0x863b('0x24')]({'raw':_0x295046['options']?_0x295046[_0x863b('0x1b')][_0x863b('0x1c')]===undefined?!![]:![]:!![],'where':_0x295046[_0x863b('0x1b')]?_0x295046[_0x863b('0x1b')][_0x863b('0x1d')]||null:null,'attributes':_0x295046[_0x863b('0x1b')]?_0x295046[_0x863b('0x1b')][_0x863b('0x1e')]||null:null,'include':_0x295046[_0x863b('0x1b')]?_0x295046[_0x863b('0x1b')]['include']?_[_0x863b('0x21')](_0x295046[_0x863b('0x1b')][_0x863b('0x20')],function(_0x29ee99){return{'model':db[_0x29ee99[_0x863b('0x22')]],'as':_0x29ee99['as'],'attributes':_0x29ee99[_0x863b('0x1e')],'include':_0x29ee99[_0x863b('0x20')]?_[_0x863b('0x21')](_0x29ee99[_0x863b('0x20')],function(_0x192d0b){return{'model':db[_0x192d0b[_0x863b('0x22')]],'as':_0x192d0b['as'],'attributes':_0x192d0b[_0x863b('0x1e')],'include':_0x192d0b['include']?_['map'](_0x192d0b[_0x863b('0x20')],function(_0xde0f48){return{'model':db[_0xde0f48[_0x863b('0x22')]],'as':_0xde0f48['as'],'attributes':_0xde0f48[_0x863b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x863b('0xd')](function(_0x3843ae){logger[_0x863b('0xe')](_0x863b('0x23'),_0x295046);logger[_0x863b('0x11')](_0x863b('0x23'),_0x295046,JSON[_0x863b('0x13')](_0x3843ae));_0x4328f5(_0x3843ae);})['catch'](function(_0x16c0c3){logger[_0x863b('0x14')](_0x863b('0x23'),_0x16c0c3[_0x863b('0x16')],_0x295046);_0x10f7ce(_0x36c8ab['error'](0x1f4,_0x16c0c3[_0x863b('0x16')]));});});};exports[_0x863b('0x25')]=function(_0x1d389f){var _0x3292bd=this;return new Promise(function(_0x167ab0,_0xe370fc){var _0x47bb8a={'body':_0x1d389f[_0x863b('0x26')],'channel':_0x863b('0x27')};var _0x3a2ef9=_[_0x863b('0x28')](_[_0x863b('0x29')](db[_0x863b('0x2a')][_0x863b('0x2b')]),['createdAt',_0x863b('0x2c'),_0x863b('0x2d'),_0x863b('0x2e')]);var _0x3f47cd=![];if(_0x1d389f[_0x863b('0x26')]['id']){delete _0x1d389f[_0x863b('0x26')]['id'];}if(_[_0x863b('0x2f')](_0x1d389f[_0x863b('0x26')]['from'])){return _0xe370fc(_0x3292bd[_0x863b('0x14')](0x1f4,_0x863b('0x30')));}if(_[_0x863b('0x2f')](_0x1d389f['body'][_0x863b('0x26')])||_0x1d389f[_0x863b('0x26')]['body']===''){return _0xe370fc(_0x3292bd['error'](0x1f4,_0x863b('0x31')));}if(_[_0x863b('0x2f')](_0x1d389f[_0x863b('0x26')][_0x863b('0x32')])){return _0xe370fc(_0x3292bd[_0x863b('0x14')](0x1f4,_0x863b('0x33')+_0x3a2ef9));}if(!_[_0x863b('0x34')](_0x3a2ef9,_0x1d389f[_0x863b('0x26')][_0x863b('0x32')])){return _0xe370fc(_0x3292bd['error'](0x1f4,_0x863b('0x35')+_0x3a2ef9));}var _0x41f546={};_0x41f546[_0x1d389f[_0x863b('0x26')]['mapKey']]=_0x1d389f[_0x863b('0x26')]['from'];return db[_0x863b('0x1a')]['find']({'where':{'id':_0x1d389f['account']['id']},'include':[{'model':db[_0x863b('0x36')],'as':_0x863b('0x37'),'include':[{'model':db[_0x863b('0x2a')],'as':_0x863b('0x38'),'where':_0x41f546,'limit':0x1,'order':[[_0x863b('0x2c'),'DESC']]}]},{'model':db[_0x863b('0x39')],'as':'Applications'},{'model':db[_0x863b('0x3a')],'as':_0x863b('0x3b')}]})['then'](function(_0x334773){if(_0x334773&&_0x334773[_0x863b('0x37')]){var _0x3dbcdc=_0x334773[_0x863b('0x3c')]({'plain':!![]});_0x47bb8a[_0x863b('0x3d')]=_[_0x863b('0x3e')](_0x3dbcdc,[_0x863b('0x3f'),_0x863b('0x37')]);_0x47bb8a['applications']=_0x3dbcdc[_0x863b('0x3f')];_0x47bb8a['list']=_0x3dbcdc[_0x863b('0x37')];_0x47bb8a['applications']=_[_0x863b('0x40')](_0x47bb8a['applications'],[_0x863b('0x41')],[_0x863b('0x42')]);if(_0x47bb8a[_0x863b('0x3d')]&&_0x47bb8a['account'][_0x863b('0x43')]){_0x47bb8a[_0x863b('0x44')][_0x863b('0x45')]({'id':0x0,'priority':_0x47bb8a['applications']['length']+0x1,'app':'close','appdata':'autoclose','interval':_0x863b('0x46')});}if(_0x47bb8a[_0x863b('0x3d')][_0x863b('0x3f')]){delete _0x47bb8a[_0x863b('0x3d')][_0x863b('0x3f')];}if(_0x47bb8a[_0x863b('0x3d')][_0x863b('0x37')]){delete _0x47bb8a[_0x863b('0x3d')][_0x863b('0x37')];}if(_0x3dbcdc[_0x863b('0x37')][_0x863b('0x38')][_0x863b('0x47')]){return _0x3dbcdc[_0x863b('0x37')][_0x863b('0x38')][0x0];}var _0x4f60de=_[_0x863b('0x8')](_0x1d389f[_0x863b('0x26')],{'firstName':_0x1d389f[_0x863b('0x26')][_0x863b('0x48')],'ListId':_0x3dbcdc[_0x863b('0x2e')]});_0x4f60de[_0x1d389f['body']['mapKey']]=_0x1d389f[_0x863b('0x26')][_0x863b('0x48')];return db['CmContact'][_0x863b('0x49')](_0x4f60de);}else{throw new Error('List\x20not\x20found');}})[_0x863b('0xd')](function(_0x1cf4e6){_0x47bb8a[_0x863b('0x4a')]=_0x1cf4e6;if(_0x1cf4e6){if(!_0x1d389f[_0x863b('0x26')][_0x863b('0x16')][_0x863b('0x4b')]){_0x1d389f[_0x863b('0x26')][_0x863b('0x16')][_0x863b('0x4b')]=rs['generate']()+'\x20'+_0x1d389f['body'][_0x863b('0x16')][_0x863b('0x48')];}var _0x3a6531={'ContactId':_0x1cf4e6['id'],'MailAccountId':_0x1d389f[_0x863b('0x3d')]['id'],'inReplyTo':_0x1d389f[_0x863b('0x26')][_0x863b('0x16')][_0x863b('0x4b')],'to':_0x1d389f[_0x863b('0x26')][_0x863b('0x16')][_0x863b('0x48')],'cc':_0x1d389f[_0x863b('0x26')][_0x863b('0x16')]['cc'],'subject':_0x1d389f[_0x863b('0x26')][_0x863b('0x16')][_0x863b('0x4c')],'attach':_0x1d389f['body'][_0x863b('0x16')][_0x863b('0x4d')],'lastMsgAt':moment()[_0x863b('0x4e')](_0x863b('0x4f')),'lastMsgDirection':'in','lastMsgBody':_0x1d389f[_0x863b('0x26')][_0x863b('0x26')]};return db[_0x863b('0x50')][_0x863b('0x24')]({'where':{'closed':![],'MailAccountId':_0x1d389f[_0x863b('0x3d')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0x863b('0x4b')],'where':{'messageId':_0x1d389f[_0x863b('0x26')][_0x863b('0x16')]['inReplyTo']}}]})[_0x863b('0xd')](function(_0x225b93){if(_0x225b93){return[_0x225b93,![]];}return db[_0x863b('0x50')][_0x863b('0x49')](_0x3a6531)[_0x863b('0xd')](function(_0x46e818){return[_0x46e818,!![]];});});}else{throw new Error(_0x863b('0x51'));}})[_0x863b('0x52')](function(_0x2f5e69,_0x1b703e){if(_0x2f5e69){_0x3f47cd=_0x1b703e;if(!_0x1b703e){return _0x2f5e69[_0x863b('0x53')]({'inReplyTo':_0x1d389f[_0x863b('0x26')][_0x863b('0x16')][_0x863b('0x4b')],'to':_0x1d389f[_0x863b('0x26')][_0x863b('0x16')][_0x863b('0x48')],'cc':_0x1d389f[_0x863b('0x26')]['message']['cc'],'subject':_0x1d389f[_0x863b('0x26')]['message'][_0x863b('0x4c')],'attach':_0x2f5e69[_0x863b('0x4d')]?_0x2f5e69[_0x863b('0x4d')]:_0x1d389f[_0x863b('0x26')][_0x863b('0x16')][_0x863b('0x4d')],'substatus':null,'substatusAt':moment()[_0x863b('0x4e')](_0x863b('0x4f')),'lastMsgAt':moment()[_0x863b('0x4e')](_0x863b('0x4f')),'lastMsgDirection':'in','lastMsgBody':_0x1d389f['body'][_0x863b('0x26')]});}else{return _0x2f5e69;}}})['then'](function(_0x2bd9dd){_0x47bb8a[_0x863b('0x54')]=_0x2bd9dd[_0x863b('0x3c')]({'plain':!![]});_0x47bb8a[_0x863b('0x54')][_0x863b('0x55')]=_0x3f47cd;return db[_0x863b('0x56')]['create']({'body':_0x1d389f['body'][_0x863b('0x26')],'MailAccountId':_0x1d389f[_0x863b('0x3d')]['id'],'MailInteractionId':_0x2bd9dd['id'],'direction':'in','ContactId':_0x47bb8a['contact']['id'],'messageId':_0x1d389f[_0x863b('0x26')][_0x863b('0x16')][_0x863b('0x4b')],'from':_0x1d389f['body'][_0x863b('0x16')]['from'],'to':_0x1d389f[_0x863b('0x26')]['message']['to'],'cc':_0x1d389f[_0x863b('0x26')][_0x863b('0x16')]['cc'],'subject':_0x1d389f[_0x863b('0x26')][_0x863b('0x16')][_0x863b('0x4c')],'attach':_0x1d389f[_0x863b('0x26')][_0x863b('0x16')][_0x863b('0x4d')],'Attachments':_0x1d389f['body'][_0x863b('0x16')][_0x863b('0x57')],'originTo':_0x1d389f['body'][_0x863b('0x16')][_0x863b('0x58')],'originCc':_0x1d389f[_0x863b('0x26')]['message'][_0x863b('0x59')],'bcc':_0x1d389f['body']['message']['bcc'],'ChatWebsiteId':_0x1d389f[_0x863b('0x26')][_0x863b('0x16')]['ChatWebsiteId']||null,'originChannel':_0x1d389f[_0x863b('0x26')][_0x863b('0x16')][_0x863b('0x5a')]||_0x863b('0x5b'),'ChatOfflineMessageId':_0x1d389f[_0x863b('0x26')]['message'][_0x863b('0x5c')]||null},{'include':[{'model':db[_0x863b('0x5d')],'as':_0x863b('0x5e')}]});})['then'](function(_0x13bb23){_0x47bb8a[_0x863b('0x16')]=_0x13bb23;if(_0x47bb8a[_0x863b('0x54')]['UserId']){return db[_0x863b('0x5f')][_0x863b('0x24')]({'attributes':['id',_0x863b('0x60')],'where':{'id':_0x47bb8a[_0x863b('0x54')][_0x863b('0x61')]}})[_0x863b('0xd')](function(_0xd26471){if(_0xd26471){_0x47bb8a[_0x863b('0x44')][_0x863b('0x62')]({'id':0x0,'priority':0x0,'app':_0x863b('0x63'),'appdata':_0xd26471[_0x863b('0x60')]+','+(_0x47bb8a[_0x863b('0x3d')][_0x863b('0x64')]||0xa),'interval':_0x863b('0x46')});}return respondWithRpcPromise(_0x863b('0x65'),_0x863b('0x66'),_0x47bb8a);});}return respondWithRpcPromise(_0x863b('0x65'),_0x863b('0x66'),_0x47bb8a);})[_0x863b('0xd')](function(_0xfb103a){_0x167ab0(_0xfb103a);})[_0x863b('0x18')](function(_0x5e09ea){_0xe370fc(_0x3292bd[_0x863b('0x14')](0x1f4,_0x5e09ea[_0x863b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index ff48a56..6a96ddb 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 _0xfdcd=['register','length','save','remove','update','emit','removeListener'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xfdcd,0xe9));var _0xdfdc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfdcd[_0x2dafbe];return _0x58a45a;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xdfdc('0x0'),_0xdfdc('0x1'),_0xdfdc('0x2')];function createListener(_0x5d73e2,_0x373ab6){return function(_0x359884){_0x373ab6[_0xdfdc('0x3')](_0x5d73e2,_0x359884);};}function removeListener(_0x789311,_0x453c75){return function(){MailAccountEvents[_0xdfdc('0x4')](_0x789311,_0x453c75);};}exports[_0xdfdc('0x5')]=function(_0x31b119){for(var _0x1984bf=0x0,_0x1f2529=events[_0xdfdc('0x6')];_0x1984bf<_0x1f2529;_0x1984bf++){var _0x18691e=events[_0x1984bf];var _0xf45350=createListener('mailAccount:'+_0x18691e,_0x31b119);MailAccountEvents['on'](_0x18691e,_0xf45350);}}; \ No newline at end of file +var _0x37cc=['update','removeListener','register','length','mailAccount:','./mailAccount.events','save','remove'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x37cc,0x185));var _0xc37c=function(_0x1151c5,_0x3a81b1){_0x1151c5=_0x1151c5-0x0;var _0x2beb31=_0x37cc[_0x1151c5];return _0x2beb31;};'use strict';var MailAccountEvents=require(_0xc37c('0x0'));var events=[_0xc37c('0x1'),_0xc37c('0x2'),_0xc37c('0x3')];function createListener(_0x198089,_0x2bc194){return function(_0x48bba7){_0x2bc194['emit'](_0x198089,_0x48bba7);};}function removeListener(_0x334d3c,_0x946e3b){return function(){MailAccountEvents[_0xc37c('0x4')](_0x334d3c,_0x946e3b);};}exports[_0xc37c('0x5')]=function(_0x4c9dcd){for(var _0x582100=0x0,_0xd8f098=events[_0xc37c('0x6')];_0x582100<_0xd8f098;_0x582100++){var _0x3c5c63=events[_0x582100];var _0x483c8d=createListener(_0xc37c('0x7')+_0x3c5c63,_0x4c9dcd);MailAccountEvents['on'](_0x3c5c63,_0x483c8d);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 8b8697c..d575aa1 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 _0xc4aa=['show','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xc4aa[_0x5a776b];return _0xbbef59;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')](_0xac4a('0x9'),auth[_0xac4a('0xa')](),controller[_0xac4a('0xb')]);router[_0xac4a('0xc')](_0xac4a('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xac4a('0xd')](_0xac4a('0x9'),auth[_0xac4a('0xa')](),controller['destroy']);module[_0xac4a('0xe')]=router; \ No newline at end of file +var _0x1261=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','isAuthenticated','show','/:id','update','delete','destroy'];(function(_0x398acc,_0x21f70b){var _0x6a9478=function(_0x57591d){while(--_0x57591d){_0x398acc['push'](_0x398acc['shift']());}};_0x6a9478(++_0x21f70b);}(_0x1261,0x144));var _0x1126=function(_0x57b4cc,_0x2ae50e){_0x57b4cc=_0x57b4cc-0x0;var _0x45ba9d=_0x1261[_0x57b4cc];return _0x45ba9d;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/:id',auth[_0x1126('0xa')](),controller[_0x1126('0xb')]);router['put'](_0x1126('0xc'),auth[_0x1126('0xa')](),controller[_0x1126('0xd')]);router[_0x1126('0xe')](_0x1126('0xc'),auth['isAuthenticated'](),controller[_0x1126('0xf')]);module[_0x1126('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index e7a267d..6a45796 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 _0x6fd4=['noop','TEXT','*,*,*,*','INTEGER','STRING'];(function(_0x1d7592,_0x462899){var _0x390069=function(_0x2305a7){while(--_0x2305a7){_0x1d7592['push'](_0x1d7592['shift']());}};_0x390069(++_0x462899);}(_0x6fd4,0xad));var _0x46fd=function(_0x2b72cf,_0x38b55f){_0x2b72cf=_0x2b72cf-0x0;var _0x153990=_0x6fd4[_0x2b72cf];return _0x153990;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x46fd('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x46fd('0x1')],'allowNull':![],'defaultValue':_0x46fd('0x2')},'appdata':{'type':Sequelize[_0x46fd('0x3')]()},'description':{'type':Sequelize[_0x46fd('0x1')]},'interval':{'type':Sequelize[_0x46fd('0x1')],'defaultValue':_0x46fd('0x4')}}; \ No newline at end of file +var _0xa92e=['TEXT','STRING','sequelize','exports','INTEGER','noop'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xa92e,0x1ca));var _0xea92=function(_0x17c466,_0x292eca){_0x17c466=_0x17c466-0x0;var _0x37cefb=_0xa92e[_0x17c466];return _0x37cefb;};'use strict';var Sequelize=require(_0xea92('0x0'));module[_0xea92('0x1')]={'priority':{'type':Sequelize[_0xea92('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xea92('0x3')},'appdata':{'type':Sequelize[_0xea92('0x4')]()},'description':{'type':Sequelize[_0xea92('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 5e62844..56541c0 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 _0xc3e3=['stack','name','send','params','model','keys','rawAttributes','query','filters','attributes','intersection','length','includeAll','merge','MailApplication','find','catch','update','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','json','count','offset','limit','status','Content-Range','apply','save','then','destroy','error'];(function(_0x263215,_0x2df550){var _0x13806e=function(_0x2198c0){while(--_0x2198c0){_0x263215['push'](_0x263215['shift']());}};_0x13806e(++_0x2df550);}(_0xc3e3,0xc1));var _0x3c3e=function(_0x46bb73,_0x44f394){_0x46bb73=_0x46bb73-0x0;var _0x44f271=_0xc3e3[_0x46bb73];return _0x44f271;};'use strict';var pdf=require(_0x3c3e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3c3e('0x1'));var zipdir=require(_0x3c3e('0x2'));var jsonpatch=require(_0x3c3e('0x3'));var rp=require(_0x3c3e('0x4'));var moment=require(_0x3c3e('0x5'));var BPromise=require(_0x3c3e('0x6'));var Mustache=require(_0x3c3e('0x7'));var util=require(_0x3c3e('0x8'));var path=require(_0x3c3e('0x9'));var sox=require('sox');var csv=require(_0x3c3e('0xa'));var ejs=require(_0x3c3e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3c3e('0xc'));var squel=require(_0x3c3e('0xd'));var crypto=require(_0x3c3e('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3c3e('0xf'));var Papa=require(_0x3c3e('0x10'));var Redis=require(_0x3c3e('0x11'));var authService=require(_0x3c3e('0x12'));var qs=require(_0x3c3e('0x13'));var as=require(_0x3c3e('0x14'));var hardwareService=require(_0x3c3e('0x15'));var logger=require(_0x3c3e('0x16'))(_0x3c3e('0x17'));var utils=require('../../config/utils');var config=require(_0x3c3e('0x18'));var licenseUtil=require(_0x3c3e('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4137f4,_0xbf11f3){_0xbf11f3=_0xbf11f3||0xcc;return function(_0x11e454){if(_0x11e454){return _0x4137f4[_0x3c3e('0x1a')](_0xbf11f3);}return _0x4137f4['status'](_0xbf11f3)[_0x3c3e('0x1b')]();};}function respondWithResult(_0x1a8272,_0x3184be){_0x3184be=_0x3184be||0xc8;return function(_0x147c7e){if(_0x147c7e){return _0x1a8272['status'](_0x3184be)[_0x3c3e('0x1c')](_0x147c7e);}};}function respondWithFilteredResult(_0x49fae7,_0x4cd5e0){return function(_0x2e4513){if(_0x2e4513){var _0x4ffabc=_0x2e4513[_0x3c3e('0x1d')],_0x2609d0=_0x4cd5e0[_0x3c3e('0x1e')],_0x536c8d=_0x4cd5e0[_0x3c3e('0x1e')]+_0x4cd5e0[_0x3c3e('0x1f')],_0x57a7f0;if(_0x536c8d>=_0x4ffabc){_0x536c8d=_0x4ffabc;_0x57a7f0=0xc8;}else{_0x57a7f0=0xce;}_0x49fae7[_0x3c3e('0x20')](_0x57a7f0);return _0x49fae7['set'](_0x3c3e('0x21'),_0x2609d0+'-'+_0x536c8d+'/'+_0x4ffabc)['json'](_0x2e4513);}return null;};}function patchUpdates(_0x1245e2){return function(_0x33abc3){try{jsonpatch[_0x3c3e('0x22')](_0x33abc3,_0x1245e2,!![]);}catch(_0x22de6e){return BPromise['reject'](_0x22de6e);}return _0x33abc3[_0x3c3e('0x23')]();};}function saveUpdates(_0x287244,_0x14396a){return function(_0xb2894){if(_0xb2894){return _0xb2894['update'](_0x287244)[_0x3c3e('0x24')](function(_0x42f245){return _0x42f245;});}return null;};}function removeEntity(_0x6961d4,_0x53b08d){return function(_0x4374e4){if(_0x4374e4){return _0x4374e4[_0x3c3e('0x25')]()[_0x3c3e('0x24')](function(){_0x6961d4['status'](0xcc)[_0x3c3e('0x1b')]();});}};}function handleEntityNotFound(_0x2b43f5,_0x17243b){return function(_0x56836a){if(!_0x56836a){_0x2b43f5[_0x3c3e('0x1a')](0x194);}return _0x56836a;};}function handleError(_0x20abc4,_0x311605){_0x311605=_0x311605||0x1f4;return function(_0x3524d8){logger[_0x3c3e('0x26')](_0x3524d8[_0x3c3e('0x27')]);if(_0x3524d8[_0x3c3e('0x28')]){delete _0x3524d8[_0x3c3e('0x28')];}_0x20abc4[_0x3c3e('0x20')](_0x311605)[_0x3c3e('0x29')](_0x3524d8);};}exports['show']=function(_0x12a595,_0x4d9afd){var _0x2c09fb={'raw':!![],'where':{'id':_0x12a595[_0x3c3e('0x2a')]['id']}},_0x157960={};_0x157960[_0x3c3e('0x2b')]=_[_0x3c3e('0x2c')](db['MailApplication'][_0x3c3e('0x2d')]);_0x157960[_0x3c3e('0x2e')]=_['keys'](_0x12a595[_0x3c3e('0x2e')]);_0x157960[_0x3c3e('0x2f')]=_['intersection'](_0x157960[_0x3c3e('0x2b')],_0x157960[_0x3c3e('0x2e')]);_0x2c09fb[_0x3c3e('0x30')]=_[_0x3c3e('0x31')](_0x157960['model'],qs['fields'](_0x12a595['query']['fields']));_0x2c09fb[_0x3c3e('0x30')]=_0x2c09fb[_0x3c3e('0x30')][_0x3c3e('0x32')]?_0x2c09fb[_0x3c3e('0x30')]:_0x157960[_0x3c3e('0x2b')];if(_0x12a595[_0x3c3e('0x2e')][_0x3c3e('0x33')]){_0x2c09fb['include']=[{'all':!![]}];}_0x2c09fb=_[_0x3c3e('0x34')]({},_0x2c09fb,_0x12a595['options']);return db[_0x3c3e('0x35')][_0x3c3e('0x36')](_0x2c09fb)[_0x3c3e('0x24')](handleEntityNotFound(_0x4d9afd,null))[_0x3c3e('0x24')](respondWithResult(_0x4d9afd,null))[_0x3c3e('0x37')](handleError(_0x4d9afd,null));};exports[_0x3c3e('0x38')]=function(_0x2f4205,_0xf99918){if(_0x2f4205[_0x3c3e('0x39')]['id']){delete _0x2f4205[_0x3c3e('0x39')]['id'];}return db[_0x3c3e('0x35')][_0x3c3e('0x36')]({'where':{'id':_0x2f4205['params']['id']}})['then'](handleEntityNotFound(_0xf99918,null))['then'](saveUpdates(_0x2f4205[_0x3c3e('0x39')],null))['then'](respondWithResult(_0xf99918,null))[_0x3c3e('0x37')](handleError(_0xf99918,null));};exports[_0x3c3e('0x25')]=function(_0x387fc4,_0x281683){return db[_0x3c3e('0x35')][_0x3c3e('0x36')]({'where':{'id':_0x387fc4[_0x3c3e('0x2a')]['id']}})[_0x3c3e('0x24')](handleEntityNotFound(_0x281683,null))['then'](removeEntity(_0x281683,null))[_0x3c3e('0x37')](handleError(_0x281683,null));}; \ No newline at end of file +var _0x4083=['count','offset','limit','set','Content-Range','apply','update','then','error','stack','name','send','params','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','body','destroy','eml-format','rimraf','request-promise','mustache','path','sox','to-csv','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x390aa6,_0xb715d9){var _0x15d655=function(_0x4e2d38){while(--_0x4e2d38){_0x390aa6['push'](_0x390aa6['shift']());}};_0x15d655(++_0xb715d9);}(_0x4083,0xc7));var _0x3408=function(_0x496c59,_0x1dcb13){_0x496c59=_0x496c59-0x0;var _0x57492f=_0x4083[_0x496c59];return _0x57492f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3408('0x0'));var rimraf=require(_0x3408('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3408('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3408('0x3'));var util=require('util');var path=require(_0x3408('0x4'));var sox=require(_0x3408('0x5'));var csv=require(_0x3408('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3408('0x7'));var squel=require(_0x3408('0x8'));var crypto=require(_0x3408('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3408('0x6'));var querystring=require('querystring');var Papa=require(_0x3408('0xa'));var Redis=require(_0x3408('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x3408('0xc'));var as=require(_0x3408('0xd'));var hardwareService=require(_0x3408('0xe'));var logger=require(_0x3408('0xf'))(_0x3408('0x10'));var utils=require(_0x3408('0x11'));var config=require(_0x3408('0x12'));var licenseUtil=require(_0x3408('0x13'));var db=require(_0x3408('0x14'))['db'];function respondWithStatusCode(_0x1eefd9,_0x218666){_0x218666=_0x218666||0xcc;return function(_0x1e6b06){if(_0x1e6b06){return _0x1eefd9[_0x3408('0x15')](_0x218666);}return _0x1eefd9[_0x3408('0x16')](_0x218666)[_0x3408('0x17')]();};}function respondWithResult(_0x24c9a5,_0x1d9b4e){_0x1d9b4e=_0x1d9b4e||0xc8;return function(_0x333838){if(_0x333838){return _0x24c9a5[_0x3408('0x16')](_0x1d9b4e)[_0x3408('0x18')](_0x333838);}};}function respondWithFilteredResult(_0x1e08ff,_0x38ed85){return function(_0x184a76){if(_0x184a76){var _0x2585b8=_0x184a76[_0x3408('0x19')],_0x2ba83f=_0x38ed85[_0x3408('0x1a')],_0x34ed66=_0x38ed85['offset']+_0x38ed85[_0x3408('0x1b')],_0x4c41cc;if(_0x34ed66>=_0x2585b8){_0x34ed66=_0x2585b8;_0x4c41cc=0xc8;}else{_0x4c41cc=0xce;}_0x1e08ff['status'](_0x4c41cc);return _0x1e08ff[_0x3408('0x1c')](_0x3408('0x1d'),_0x2ba83f+'-'+_0x34ed66+'/'+_0x2585b8)['json'](_0x184a76);}return null;};}function patchUpdates(_0x2f1a00){return function(_0x15c0fb){try{jsonpatch[_0x3408('0x1e')](_0x15c0fb,_0x2f1a00,!![]);}catch(_0xdb1aed){return BPromise['reject'](_0xdb1aed);}return _0x15c0fb['save']();};}function saveUpdates(_0x61c367,_0x165319){return function(_0x161f20){if(_0x161f20){return _0x161f20[_0x3408('0x1f')](_0x61c367)['then'](function(_0x129475){return _0x129475;});}return null;};}function removeEntity(_0x47e54c,_0x19a05a){return function(_0x5eeb01){if(_0x5eeb01){return _0x5eeb01['destroy']()[_0x3408('0x20')](function(){_0x47e54c[_0x3408('0x16')](0xcc)[_0x3408('0x17')]();});}};}function handleEntityNotFound(_0x233dc4,_0x726cdb){return function(_0x4aea18){if(!_0x4aea18){_0x233dc4['sendStatus'](0x194);}return _0x4aea18;};}function handleError(_0xfae1e8,_0x295c7e){_0x295c7e=_0x295c7e||0x1f4;return function(_0x116056){logger[_0x3408('0x21')](_0x116056[_0x3408('0x22')]);if(_0x116056[_0x3408('0x23')]){delete _0x116056[_0x3408('0x23')];}_0xfae1e8[_0x3408('0x16')](_0x295c7e)[_0x3408('0x24')](_0x116056);};}exports['show']=function(_0x55947e,_0x5a9187){var _0x1e282f={'raw':!![],'where':{'id':_0x55947e[_0x3408('0x25')]['id']}},_0x232496={};_0x232496[_0x3408('0x26')]=_[_0x3408('0x27')](db[_0x3408('0x28')][_0x3408('0x29')]);_0x232496[_0x3408('0x2a')]=_[_0x3408('0x27')](_0x55947e['query']);_0x232496[_0x3408('0x2b')]=_[_0x3408('0x2c')](_0x232496['model'],_0x232496[_0x3408('0x2a')]);_0x1e282f[_0x3408('0x2d')]=_['intersection'](_0x232496[_0x3408('0x26')],qs['fields'](_0x55947e[_0x3408('0x2a')][_0x3408('0x2e')]));_0x1e282f[_0x3408('0x2d')]=_0x1e282f[_0x3408('0x2d')][_0x3408('0x2f')]?_0x1e282f[_0x3408('0x2d')]:_0x232496[_0x3408('0x26')];if(_0x55947e[_0x3408('0x2a')][_0x3408('0x30')]){_0x1e282f[_0x3408('0x31')]=[{'all':!![]}];}_0x1e282f=_[_0x3408('0x32')]({},_0x1e282f,_0x55947e[_0x3408('0x33')]);return db['MailApplication'][_0x3408('0x34')](_0x1e282f)[_0x3408('0x20')](handleEntityNotFound(_0x5a9187,null))[_0x3408('0x20')](respondWithResult(_0x5a9187,null))[_0x3408('0x35')](handleError(_0x5a9187,null));};exports[_0x3408('0x1f')]=function(_0x271064,_0x371802){if(_0x271064[_0x3408('0x36')]['id']){delete _0x271064['body']['id'];}return db[_0x3408('0x28')][_0x3408('0x34')]({'where':{'id':_0x271064['params']['id']}})['then'](handleEntityNotFound(_0x371802,null))[_0x3408('0x20')](saveUpdates(_0x271064[_0x3408('0x36')],null))['then'](respondWithResult(_0x371802,null))[_0x3408('0x35')](handleError(_0x371802,null));};exports[_0x3408('0x37')]=function(_0x39e231,_0x409cea){return db[_0x3408('0x28')][_0x3408('0x34')]({'where':{'id':_0x39e231['params']['id']}})['then'](handleEntityNotFound(_0x409cea,null))['then'](removeEntity(_0x409cea,null))['catch'](handleError(_0x409cea,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 3a6750a..1ebc415 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 _0x52aa=['mail_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication'];(function(_0x413f36,_0x5652a2){var _0x764429=function(_0x35842d){while(--_0x35842d){_0x413f36['push'](_0x413f36['shift']());}};_0x764429(++_0x5652a2);}(_0x52aa,0x113));var _0xa52a=function(_0xf1bb9d,_0x2403b9){_0xf1bb9d=_0xf1bb9d-0x0;var _0x2f7c2c=_0x52aa[_0xf1bb9d];return _0x2f7c2c;};'use strict';var _=require('lodash');var util=require(_0xa52a('0x0'));var logger=require(_0xa52a('0x1'))(_0xa52a('0x2'));var moment=require(_0xa52a('0x3'));var BPromise=require(_0xa52a('0x4'));var rp=require(_0xa52a('0x5'));var fs=require('fs');var path=require(_0xa52a('0x6'));var rimraf=require(_0xa52a('0x7'));var config=require(_0xa52a('0x8'));var attributes=require(_0xa52a('0x9'));module[_0xa52a('0xa')]=function(_0x5a72ee,_0x565d65){return _0x5a72ee[_0xa52a('0xb')](_0xa52a('0xc'),attributes,{'tableName':_0xa52a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa52a('0xe'),'collate':_0xa52a('0xf')});}; \ No newline at end of file +var _0xe35d=['mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','MailApplication'];(function(_0x2ff5bc,_0x13d5ce){var _0x1ec873=function(_0x17c62c){while(--_0x17c62c){_0x2ff5bc['push'](_0x2ff5bc['shift']());}};_0x1ec873(++_0x13d5ce);}(_0xe35d,0xd5));var _0xde35=function(_0x5235c0,_0x44717e){_0x5235c0=_0x5235c0-0x0;var _0x130aa5=_0xe35d[_0x5235c0];return _0x130aa5;};'use strict';var _=require(_0xde35('0x0'));var util=require(_0xde35('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xde35('0x2'));var BPromise=require(_0xde35('0x3'));var rp=require(_0xde35('0x4'));var fs=require('fs');var path=require(_0xde35('0x5'));var rimraf=require(_0xde35('0x6'));var config=require(_0xde35('0x7'));var attributes=require(_0xde35('0x8'));module[_0xde35('0x9')]=function(_0x20320f,_0x427941){return _0x20320f['define'](_0xde35('0xa'),attributes,{'tableName':_0xde35('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xde35('0xc'),'collate':_0xde35('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 0187ed5..c47c912 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 _0x0602=['MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','MailApplication','update','body','options','where','limit','UpdateMailApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info'];(function(_0x5baea9,_0x36886c){var _0x2e7715=function(_0x1be092){while(--_0x1be092){_0x5baea9['push'](_0x5baea9['shift']());}};_0x2e7715(++_0x36886c);}(_0x0602,0x1d1));var _0x2060=function(_0x208b55,_0x3a66ae){_0x208b55=_0x208b55-0x0;var _0x30bff7=_0x0602[_0x208b55];return _0x30bff7;};'use strict';var _=require(_0x2060('0x0'));var util=require(_0x2060('0x1'));var moment=require(_0x2060('0x2'));var BPromise=require(_0x2060('0x3'));var rs=require(_0x2060('0x4'));var fs=require('fs');var Redis=require(_0x2060('0x5'));var db=require(_0x2060('0x6'))['db'];var utils=require(_0x2060('0x7'));var logger=require(_0x2060('0x8'))(_0x2060('0x9'));var config=require('../../config/environment');var jayson=require(_0x2060('0xa'));var client=jayson['client'][_0x2060('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c849a,_0x1e3778,_0x5e5c4a){return new BPromise(function(_0x51fba1,_0x20eb30){return client[_0x2060('0xc')](_0x4c849a,_0x5e5c4a)[_0x2060('0xd')](function(_0x2c6dbf){logger[_0x2060('0xe')](_0x2060('0xf'),_0x1e3778,_0x2060('0x10'));logger[_0x2060('0x11')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x1e3778,'request\x20sent',JSON[_0x2060('0x12')](_0x2c6dbf));if(_0x2c6dbf[_0x2060('0x13')]){if(_0x2c6dbf[_0x2060('0x13')][_0x2060('0x14')]===0x1f4){logger[_0x2060('0x13')](_0x2060('0xf'),_0x1e3778,_0x2c6dbf[_0x2060('0x13')][_0x2060('0x15')]);return _0x20eb30(_0x2c6dbf[_0x2060('0x13')][_0x2060('0x15')]);}logger[_0x2060('0x13')](_0x2060('0xf'),_0x1e3778,_0x2c6dbf[_0x2060('0x13')]['message']);return _0x51fba1(_0x2c6dbf['error']['message']);}else{logger['info'](_0x2060('0xf'),_0x1e3778,'request\x20sent');_0x51fba1(_0x2c6dbf[_0x2060('0x16')][_0x2060('0x15')]);}})['catch'](function(_0x473a54){logger['error'](_0x2060('0xf'),_0x1e3778,_0x473a54);_0x20eb30(_0x473a54);});});}exports['UpdateMailApplication']=function(_0x2c5dfc){var _0x4d5fd4=this;return new Promise(function(_0x56e3d3,_0x13ff34){return db[_0x2060('0x17')][_0x2060('0x18')](_0x2c5dfc[_0x2060('0x19')],{'raw':_0x2c5dfc[_0x2060('0x1a')]?_0x2c5dfc['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c5dfc[_0x2060('0x1a')]?_0x2c5dfc['options'][_0x2060('0x1b')]||null:null,'attributes':_0x2c5dfc['options']?_0x2c5dfc['options']['attributes']||null:null,'limit':_0x2c5dfc[_0x2060('0x1a')]?_0x2c5dfc[_0x2060('0x1a')][_0x2060('0x1c')]||null:null})[_0x2060('0xd')](function(_0x1e54f2){logger[_0x2060('0xe')](_0x2060('0x1d'),_0x2c5dfc);logger[_0x2060('0x11')]('UpdateMailApplication',_0x2c5dfc,JSON[_0x2060('0x12')](_0x1e54f2));_0x56e3d3(_0x1e54f2);})['catch'](function(_0xfeab29){logger[_0x2060('0x13')](_0x2060('0x1d'),_0xfeab29[_0x2060('0x15')],_0x2c5dfc);_0x13ff34(_0x4d5fd4['error'](0x1f4,_0xfeab29[_0x2060('0x15')]));});});}; \ No newline at end of file +var _0xaaeb=['stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','options','raw','limit','info'];(function(_0x2c4f17,_0x19477f){var _0x494334=function(_0x4cb3ed){while(--_0x4cb3ed){_0x2c4f17['push'](_0x2c4f17['shift']());}};_0x494334(++_0x19477f);}(_0xaaeb,0x1c1));var _0xbaae=function(_0x52c4f6,_0x5b3ecc){_0x52c4f6=_0x52c4f6-0x0;var _0x34cabb=_0xaaeb[_0x52c4f6];return _0x34cabb;};'use strict';var _=require(_0xbaae('0x0'));var util=require(_0xbaae('0x1'));var moment=require(_0xbaae('0x2'));var BPromise=require(_0xbaae('0x3'));var rs=require(_0xbaae('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbaae('0x5'));var logger=require(_0xbaae('0x6'))('rpc');var config=require(_0xbaae('0x7'));var jayson=require(_0xbaae('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4cd967,_0x2c864b,_0xeb709){return new BPromise(function(_0x24ee4a,_0x19f99e){return client[_0xbaae('0x9')](_0x4cd967,_0xeb709)[_0xbaae('0xa')](function(_0x1d2ae7){logger['info'](_0xbaae('0xb'),_0x2c864b,'request\x20sent');logger[_0xbaae('0xc')](_0xbaae('0xd'),_0x2c864b,_0xbaae('0xe'),JSON['stringify'](_0x1d2ae7));if(_0x1d2ae7[_0xbaae('0xf')]){if(_0x1d2ae7[_0xbaae('0xf')][_0xbaae('0x10')]===0x1f4){logger['error'](_0xbaae('0xb'),_0x2c864b,_0x1d2ae7[_0xbaae('0xf')]['message']);return _0x19f99e(_0x1d2ae7['error'][_0xbaae('0x11')]);}logger[_0xbaae('0xf')](_0xbaae('0xb'),_0x2c864b,_0x1d2ae7[_0xbaae('0xf')][_0xbaae('0x11')]);return _0x24ee4a(_0x1d2ae7['error']['message']);}else{logger['info'](_0xbaae('0xb'),_0x2c864b,_0xbaae('0xe'));_0x24ee4a(_0x1d2ae7[_0xbaae('0x12')][_0xbaae('0x11')]);}})[_0xbaae('0x13')](function(_0x41304b){logger[_0xbaae('0xf')](_0xbaae('0xb'),_0x2c864b,_0x41304b);_0x19f99e(_0x41304b);});});}exports[_0xbaae('0x14')]=function(_0x10a118){var _0x5e1cca=this;return new Promise(function(_0x58cda7,_0x493fab){return db[_0xbaae('0x15')][_0xbaae('0x16')](_0x10a118['body'],{'raw':_0x10a118[_0xbaae('0x17')]?_0x10a118['options'][_0xbaae('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10a118['options']?_0x10a118[_0xbaae('0x17')]['where']||null:null,'attributes':_0x10a118[_0xbaae('0x17')]?_0x10a118[_0xbaae('0x17')]['attributes']||null:null,'limit':_0x10a118[_0xbaae('0x17')]?_0x10a118[_0xbaae('0x17')][_0xbaae('0x19')]||null:null})[_0xbaae('0xa')](function(_0x4486e6){logger[_0xbaae('0x1a')](_0xbaae('0x14'),_0x10a118);logger[_0xbaae('0xc')](_0xbaae('0x14'),_0x10a118,JSON[_0xbaae('0x1b')](_0x4486e6));_0x58cda7(_0x4486e6);})[_0xbaae('0x13')](function(_0xcb519e){logger[_0xbaae('0xf')]('UpdateMailApplication',_0xcb519e[_0xbaae('0x11')],_0x10a118);_0x493fab(_0x5e1cca[_0xbaae('0xf')](0x1f4,_0xcb519e[_0xbaae('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index e59fe24..8ede0ab 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 _0xb7e2=['express','fs-extra','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','mail','addTags','tracked','mailinteraction:update','delete','mailinteraction:destroy','/:id/tags','removeTags','exports','multer','path'];(function(_0x1ad136,_0x4cf4cc){var _0x26f32f=function(_0x134031){while(--_0x134031){_0x1ad136['push'](_0x1ad136['shift']());}};_0x26f32f(++_0x4cf4cc);}(_0xb7e2,0x103));var _0x2b7e=function(_0x39ea1c,_0x56123f){_0x39ea1c=_0x39ea1c-0x0;var _0x2a3d38=_0xb7e2[_0x39ea1c];return _0x2a3d38;};'use strict';var multer=require(_0x2b7e('0x0'));var util=require('util');var path=require(_0x2b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x2b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x2b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2b7e('0x4'));var config=require(_0x2b7e('0x5'));var controller=require(_0x2b7e('0x6'));router[_0x2b7e('0x7')]('/',auth[_0x2b7e('0x8')](),controller[_0x2b7e('0x9')]);router['get'](_0x2b7e('0xa'),auth[_0x2b7e('0x8')](),controller[_0x2b7e('0xb')]);router['get'](_0x2b7e('0xc'),auth[_0x2b7e('0x8')](),controller[_0x2b7e('0xd')]);router[_0x2b7e('0x7')](_0x2b7e('0xe'),auth['isAuthenticated'](),controller['getMessages']);router[_0x2b7e('0x7')](_0x2b7e('0xf'),auth[_0x2b7e('0x8')](),controller[_0x2b7e('0x10')]);router[_0x2b7e('0x11')]('/',auth[_0x2b7e('0x8')](),controller[_0x2b7e('0x12')]);router['post'](_0x2b7e('0xe'),auth[_0x2b7e('0x8')](),controller[_0x2b7e('0x13')]);router[_0x2b7e('0x11')]('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0x2b7e('0x14'),'mailinteraction:addtags'),controller[_0x2b7e('0x15')]);router['put'](_0x2b7e('0xc'),auth['isAuthenticated'](),interaction[_0x2b7e('0x16')](_0x2b7e('0x14'),_0x2b7e('0x17')),controller['update']);router[_0x2b7e('0x18')](_0x2b7e('0xc'),auth['isAuthenticated'](),interaction[_0x2b7e('0x16')](_0x2b7e('0x14'),_0x2b7e('0x19')),controller['destroy']);router[_0x2b7e('0x18')](_0x2b7e('0x1a'),auth[_0x2b7e('0x8')](),controller[_0x2b7e('0x1b')]);module[_0x2b7e('0x1c')]=router; \ No newline at end of file +var _0x72fa=['Router','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','tracked','mail','addTags','mailinteraction:update','update','delete','mailinteraction:destroy','/:id/tags','removeTags','exports','multer','util','connect-timeout','express'];(function(_0x20cddf,_0x343c9a){var _0x4296af=function(_0x130d2e){while(--_0x130d2e){_0x20cddf['push'](_0x20cddf['shift']());}};_0x4296af(++_0x343c9a);}(_0x72fa,0x78));var _0xa72f=function(_0x1a5cd7,_0x3811e9){_0x1a5cd7=_0x1a5cd7-0x0;var _0x399402=_0x72fa[_0x1a5cd7];return _0x399402;};'use strict';var multer=require(_0xa72f('0x0'));var util=require(_0xa72f('0x1'));var path=require('path');var timeout=require(_0xa72f('0x2'));var express=require(_0xa72f('0x3'));var router=express[_0xa72f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa72f('0x5'));var config=require(_0xa72f('0x6'));var controller=require(_0xa72f('0x7'));router[_0xa72f('0x8')]('/',auth[_0xa72f('0x9')](),controller[_0xa72f('0xa')]);router[_0xa72f('0x8')](_0xa72f('0xb'),auth[_0xa72f('0x9')](),controller[_0xa72f('0xc')]);router['get'](_0xa72f('0xd'),auth[_0xa72f('0x9')](),controller[_0xa72f('0xe')]);router['get'](_0xa72f('0xf'),auth[_0xa72f('0x9')](),controller['getMessages']);router[_0xa72f('0x8')](_0xa72f('0x10'),auth[_0xa72f('0x9')](),controller[_0xa72f('0x11')]);router[_0xa72f('0x12')]('/',auth[_0xa72f('0x9')](),controller[_0xa72f('0x13')]);router[_0xa72f('0x12')](_0xa72f('0xf'),auth[_0xa72f('0x9')](),controller[_0xa72f('0x14')]);router[_0xa72f('0x12')]('/:id/tags',auth[_0xa72f('0x9')](),interaction[_0xa72f('0x15')](_0xa72f('0x16'),'mailinteraction:addtags'),controller[_0xa72f('0x17')]);router['put'](_0xa72f('0xd'),auth[_0xa72f('0x9')](),interaction['tracked'](_0xa72f('0x16'),_0xa72f('0x18')),controller[_0xa72f('0x19')]);router[_0xa72f('0x1a')]('/:id',auth[_0xa72f('0x9')](),interaction[_0xa72f('0x15')](_0xa72f('0x16'),_0xa72f('0x1b')),controller['destroy']);router[_0xa72f('0x1a')](_0xa72f('0x1c'),auth[_0xa72f('0x9')](),controller[_0xa72f('0x1d')]);module[_0xa72f('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 57b8213..53cd0fb 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 _0x53f7=['long','BOOLEAN','ENUM','out','sequelize','iconv','exports','DATE','STRING','TEXT'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x53f7,0xae));var _0x753f=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0x53f7[_0x2db12b];return _0x20990b;};'use strict';var Sequelize=require(_0x753f('0x0'));var iconv=require(_0x753f('0x1'));module[_0x753f('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x753f('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x753f('0x4')]},'thirdDisposition':{'type':Sequelize[_0x753f('0x4')]},'note':{'type':Sequelize[_0x753f('0x4')]},'inReplyTo':{'type':Sequelize[_0x753f('0x4')](0x1fe)},'to':{'type':Sequelize[_0x753f('0x4')]},'cc':{'type':Sequelize[_0x753f('0x5')](_0x753f('0x6'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x753f('0x7')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x753f('0x3')]},'substatus':{'type':Sequelize[_0x753f('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x753f('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x753f('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x753f('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x753f('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x753f('0x5')]('long')},'lastMsgText':{'type':Sequelize[_0x753f('0x5')](_0x753f('0x6'))}}; \ No newline at end of file +var _0xb40d=['exports','BOOLEAN','STRING','TEXT','long','DATE','ENUM','out'];(function(_0x5c80f1,_0x1f7155){var _0x1a75a1=function(_0x395288){while(--_0x395288){_0x5c80f1['push'](_0x5c80f1['shift']());}};_0x1a75a1(++_0x1f7155);}(_0xb40d,0x108));var _0xdb40=function(_0x4a77b3,_0xc9d9d2){_0x4a77b3=_0x4a77b3-0x0;var _0x42b4f0=_0xb40d[_0x4a77b3];return _0x42b4f0;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module[_0xdb40('0x0')]={'closed':{'type':Sequelize[_0xdb40('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xdb40('0x2')]},'secondDisposition':{'type':Sequelize[_0xdb40('0x2')]},'thirdDisposition':{'type':Sequelize[_0xdb40('0x2')]},'note':{'type':Sequelize[_0xdb40('0x2')]},'inReplyTo':{'type':Sequelize[_0xdb40('0x2')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xdb40('0x3')](_0xdb40('0x4'))},'subject':{'type':Sequelize[_0xdb40('0x3')]()},'attach':{'type':Sequelize[_0xdb40('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xdb40('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0xdb40('0x5')]},'firstMsgDirection':{'type':Sequelize[_0xdb40('0x6')]('in',_0xdb40('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xdb40('0x5')]},'lastMsgDirection':{'type':Sequelize[_0xdb40('0x6')]('in',_0xdb40('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xdb40('0x3')](_0xdb40('0x4'))},'lastMsgText':{'type':Sequelize[_0xdb40('0x3')](_0xdb40('0x4'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index d744a86..843dcba 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 _0x222f=['mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','users','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','length','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','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)','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.secondDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','findOne','enableEmailPreview','all','rows','intersection','includeAll','include','options','create','body','params','describe','addMessage','omit','ids','getMessages','MailMessage','pick','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','addTags','setTags','findAll','emit','mailInteractionTags:save','removeTags','download','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','readFileSync','build','writeFileSync','message%d.eml','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','html-to-text','juice','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./mailInteraction.socket','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','Users','TagIds','Tags','forEach','push','MailInteraction','lastMsgBody','lastMsgText','trimStart','catch','index','map','rawAttributes','fieldName','type','query','keys','filters','model','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','select','field','color','from','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','u.id\x20=\x20ui.UserId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x222f,0x1a4));var _0xf222=function(_0x4565eb,_0x167f79){_0x4565eb=_0x4565eb-0x0;var _0x67832=_0x222f[_0x4565eb];return _0x67832;};'use strict';var pdf=require(_0xf222('0x0'));var emlformat=require(_0xf222('0x1'));var rimraf=require(_0xf222('0x2'));var zipdir=require(_0xf222('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf222('0x4'));var BPromise=require(_0xf222('0x5'));var Mustache=require(_0xf222('0x6'));var util=require(_0xf222('0x7'));var path=require('path');var sox=require(_0xf222('0x8'));var csv=require('to-csv');var ejs=require(_0xf222('0x9'));var fs=require('fs');var fs_extra=require(_0xf222('0xa'));var _=require('lodash');var squel=require(_0xf222('0xb'));var crypto=require(_0xf222('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf222('0xd'));var toCsv=require(_0xf222('0xe'));var querystring=require(_0xf222('0xf'));var Papa=require(_0xf222('0x10'));var htmlToText=require(_0xf222('0x11'));var juice=require(_0xf222('0x12'));var Redis=require('ioredis');var authService=require(_0xf222('0x13'));var qs=require(_0xf222('0x14'));var as=require(_0xf222('0x15'));var hardwareService=require(_0xf222('0x16'));var logger=require('../../config/logger')(_0xf222('0x17'));var utils=require(_0xf222('0x18'));var config=require(_0xf222('0x19'));var licenseUtil=require(_0xf222('0x1a'));var db=require(_0xf222('0x1b'))['db'];config[_0xf222('0x1c')]=_[_0xf222('0x1d')](config[_0xf222('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf222('0x1c')]));require(_0xf222('0x1e'))['register'](socket);function respondWithStatusCode(_0x39be58,_0x43d35b){_0x43d35b=_0x43d35b||0xcc;return function(_0x464f3e){if(_0x464f3e){return _0x39be58[_0xf222('0x1f')](_0x43d35b);}return _0x39be58[_0xf222('0x20')](_0x43d35b)[_0xf222('0x21')]();};}function respondWithResult(_0x30b646,_0x582fc4){_0x582fc4=_0x582fc4||0xc8;return function(_0x1efa9f){if(_0x1efa9f){return _0x30b646[_0xf222('0x20')](_0x582fc4)[_0xf222('0x22')](_0x1efa9f);}};}function respondWithFilteredResult(_0xfb4ddf,_0x12a2e4){return function(_0x1e57ee){if(_0x1e57ee){var _0x2a2f34=_0x1e57ee[_0xf222('0x23')],_0x4b2847=_0x12a2e4[_0xf222('0x24')],_0xf26a16=_0x12a2e4['offset']+_0x12a2e4['limit'],_0x1bdd0a;if(_0xf26a16>=_0x2a2f34){_0xf26a16=_0x2a2f34;_0x1bdd0a=0xc8;}else{_0x1bdd0a=0xce;}_0xfb4ddf[_0xf222('0x20')](_0x1bdd0a);return _0xfb4ddf[_0xf222('0x25')](_0xf222('0x26'),_0x4b2847+'-'+_0xf26a16+'/'+_0x2a2f34)[_0xf222('0x22')](_0x1e57ee);}return null;};}function patchUpdates(_0x35539d){return function(_0x151a89){try{jsonpatch['apply'](_0x151a89,_0x35539d,!![]);}catch(_0x176b20){return BPromise[_0xf222('0x27')](_0x176b20);}return _0x151a89[_0xf222('0x28')]();};}function saveUpdates(_0x12d443,_0x2c48ce){return function(_0x2d18ab){if(_0x2d18ab){return _0x2d18ab[_0xf222('0x29')](_0x12d443)[_0xf222('0x2a')](function(_0x50407b){return _0x50407b;});}return null;};}function removeEntity(_0x145e2e,_0x5151d9){return function(_0x1883c1){if(_0x1883c1){return _0x1883c1[_0xf222('0x2b')]()[_0xf222('0x2a')](function(){_0x145e2e[_0xf222('0x20')](0xcc)[_0xf222('0x21')]();});}};}function handleEntityNotFound(_0x263dc2,_0x15bf4e){return function(_0x2ec2e9){if(!_0x2ec2e9){_0x263dc2[_0xf222('0x1f')](0x194);}return _0x2ec2e9;};}function handleError(_0x501f8e,_0x14b2b1){_0x14b2b1=_0x14b2b1||0x1f4;return function(_0x1c5cd3){logger[_0xf222('0x2c')](_0x1c5cd3[_0xf222('0x2d')]);if(_0x1c5cd3[_0xf222('0x2e')]){delete _0x1c5cd3[_0xf222('0x2e')];}_0x501f8e[_0xf222('0x20')](_0x14b2b1)[_0xf222('0x2f')](_0x1c5cd3);};}function getInteractionUsers(_0x1e87ec,_0x59721a){return new BPromise(function(_0x3bdf98,_0x132b18){try{if(_0x59721a[_0x1e87ec['id']]){_0x1e87ec[_0xf222('0x30')]=_['map'](_0x59721a[_0x1e87ec['id']],function(_0x3ccc9e){return{'id':_0x3ccc9e['id'],'fullname':_0x3ccc9e['fullname']};});}}catch(_0x40c7e7){_0x132b18(_0x40c7e7);}_0x3bdf98(_0x1e87ec);});}function getInteractionTags(_0x27a8cc,_0x434e7b){return new BPromise(function(_0x272e0c,_0x37b4f7){try{if(_0x27a8cc[_0xf222('0x31')]){_0x27a8cc[_0xf222('0x32')]=[];_0x27a8cc['TagIds']['split'](',')[_0xf222('0x33')](function(_0xfcb434){_0x27a8cc[_0xf222('0x32')][_0xf222('0x34')](_0x434e7b[_0xfcb434]);});}delete _0x27a8cc[_0xf222('0x31')];}catch(_0x3cdd52){_0x37b4f7(_0x3cdd52);}_0x272e0c(_0x27a8cc);});}function getLastMessageText(_0x4e6a5e){return new BPromise(function(_0x21d643,_0x312c65){return db[_0xf222('0x35')]['findOne']({'where':{'id':_0x4e6a5e['id']},'attributes':[_0xf222('0x36'),_0xf222('0x37')],'raw':!![]})[_0xf222('0x2a')](function(_0x5e40a0){if(!_0x5e40a0[_0xf222('0x37')]){_0x4e6a5e[_0xf222('0x37')]=_[_0xf222('0x38')](htmlToText['fromString'](_0x5e40a0[_0xf222('0x36')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x4e6a5e[_0xf222('0x37')]=_0x5e40a0[_0xf222('0x37')];}_0x21d643(_0x4e6a5e);})[_0xf222('0x39')](function(_0x2e9b27){_0x312c65(_0x2e9b27);});});}function updateMailInteraction(_0x51c66e,_0x46d65e,_0x542123,_0x220214){return new BPromise(function(_0x38db1b,_0x29d6ff){return getInteractionUsers(_0x51c66e,_0x542123)['then'](function(_0x39784b){return getInteractionTags(_0x39784b,_0x46d65e);})[_0xf222('0x2a')](function(_0x54a10d){if(_0x220214){_0x38db1b(getLastMessageText(_0x54a10d));}else{_0x38db1b(_0x54a10d);}})[_0xf222('0x39')](function(_0x4b7b15){_0x29d6ff(_0x4b7b15);});});}exports[_0xf222('0x3a')]=function(_0x1b2f78,_0x769510){var _0x5c8b04={},_0x40bdf3={},_0x2c7ee0={'count':0x0,'rows':[]};var _0x2c1e49=_[_0xf222('0x3b')](db[_0xf222('0x35')][_0xf222('0x3c')],function(_0x51154b){return{'name':_0x51154b[_0xf222('0x3d')],'type':_0x51154b[_0xf222('0x3e')]['key']};});_0x40bdf3['model']=_[_0xf222('0x3b')](_0x2c1e49,'name');_0x40bdf3[_0xf222('0x3f')]=_[_0xf222('0x40')](_0x1b2f78[_0xf222('0x3f')]);_0x40bdf3[_0xf222('0x41')]=_['intersection'](_0x40bdf3['model'],_0x40bdf3[_0xf222('0x3f')]);_0x5c8b04['attributes']=_['intersection'](_0x40bdf3[_0xf222('0x42')],qs[_0xf222('0x43')](_0x1b2f78[_0xf222('0x3f')][_0xf222('0x43')]));_0x5c8b04[_0xf222('0x44')]=_0x5c8b04[_0xf222('0x44')]['length']?_0x5c8b04[_0xf222('0x44')]:_0x40bdf3[_0xf222('0x42')];if(!_0x1b2f78['query'][_0xf222('0x45')](_0xf222('0x46'))){_0x5c8b04['limit']=qs[_0xf222('0x47')](_0x1b2f78['query'][_0xf222('0x47')]);_0x5c8b04[_0xf222('0x24')]=qs[_0xf222('0x24')](_0x1b2f78[_0xf222('0x3f')][_0xf222('0x24')]);}_0x5c8b04[_0xf222('0x48')]=qs[_0xf222('0x49')](_0x1b2f78[_0xf222('0x3f')][_0xf222('0x49')]);_0x5c8b04[_0xf222('0x4a')]=qs[_0xf222('0x41')](_['pick'](_0x1b2f78['query'],_0x40bdf3['filters']),_0x2c1e49);var _0x350c6a=[];var _0x2c3584=squel[_0xf222('0x4b')]()[_0xf222('0x4c')]('id')['field'](_0xf222('0x2e'))[_0xf222('0x4c')](_0xf222('0x4d'))[_0xf222('0x4e')]('tools_tags');var _0x2bd5b1=squel[_0xf222('0x4b')]()[_0xf222('0x4c')](_0xf222('0x4f'))[_0xf222('0x4c')](_0xf222('0x50'))[_0xf222('0x4c')](_0xf222('0x51'))[_0xf222('0x4e')](_0xf222('0x52'),'ui')['left_join']('users','u',_0xf222('0x53'));var _0x47942b=squel[_0xf222('0x4b')]()['from'](_0xf222('0x54'),'i')['left_join'](_0xf222('0x55'),'c',_0xf222('0x56'))[_0xf222('0x57')](_0xf222('0x58'),'o','o.id\x20=\x20i.UserId')[_0xf222('0x57')](_0xf222('0x59'),'a',_0xf222('0x5a'))[_0xf222('0x57')](_0xf222('0x5b'),'me',_0xf222('0x5c'))[_0xf222('0x57')](_0xf222('0x5d'),'it',_0xf222('0x5e'))[_0xf222('0x57')](_0xf222('0x5f'),'t',_0xf222('0x60'));var _0x4aa98c=squel['expr']();var _0x2ed76e=[];var _0x28c5d1=squel[_0xf222('0x61')]();var _0xfb75f0;if(_0x1b2f78[_0xf222('0x3f')][_0xf222('0x62')]){_0xfb75f0=as[_0xf222('0x63')](_0x1b2f78[_0xf222('0x3f')][_0xf222('0x62')]);var _0x1e680a=_0xfb75f0[_0xf222('0x64')];for(var _0x4e9588=0x0;_0x4e9588<_0xfb75f0['conditions'][_0xf222('0x65')];_0x4e9588++){var _0x3cd479=_0xfb75f0[_0xf222('0x66')][_0x4e9588];var _0xbc503b='i';var _0x43dac3=_[_0xf222('0x67')](_0x2c1e49,[_0xf222('0x2e'),_0x3cd479[_0xf222('0x4c')]]);if(!_0x43dac3){switch(_0x3cd479[_0xf222('0x4c')]){case _0xf222('0x68'):if(_0x3cd479[_0xf222('0x69')]==0x1){_0x47942b[_0xf222('0x6a')]('`'+_0x3cd479[_0xf222('0x4c')]+_0xf222('0x6b'));}else{_0x47942b['having']('`'+_0x3cd479[_0xf222('0x4c')]+'`\x20>\x200');}break;case _0xf222('0x6c'):if(_0x3cd479[_0xf222('0x6d')]===_0xf222('0x6e')){if(_0x3cd479[_0xf222('0x69')]['split']('\x20')['length']>0x1){_0x4aa98c[_0x1e680a](_0xf222('0x6f'),qs[_0xf222('0x70')](_0x3cd479[_0xf222('0x69')]),null);}else{var _0xd092fc='%'+_0x3cd479[_0xf222('0x69')]+'%';_0x4aa98c[_0x1e680a]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xd092fc,_0xd092fc,_0xd092fc);}}else{_0x43dac3=_[_0xf222('0x67')](_0x2c1e49,['name',_0xf222('0x71')]);_0x3cd479[_0xf222('0x4c')]='ContactId';_0x89162f=as[_0xf222('0x72')](_0xbc503b,_0x43dac3['type'],_0x3cd479);_0x4aa98c[_0x1e680a](_0x89162f[_0xf222('0x73')],_0x89162f[_0xf222('0x69')][_0xf222('0x74')],_0x89162f['value'][_0xf222('0x21')]);}break;case _0xf222('0x75'):var _0x434e8e=_0x3cd479[_0xf222('0x69')][_0xf222('0x76')](',')[_0xf222('0x3b')](function(_0x262bf7){return Number(_0x262bf7);});_0x434e8e['forEach'](function(_0x286355){_0x28c5d1['or'](_0xf222('0x77'),'%,'+_0x286355+',%');});_0x2ed76e=_['union'](_0x2ed76e,_0x434e8e);break;case'User':if(_0x3cd479['operator']===_0xf222('0x6e')){_0x4aa98c[_0x1e680a](_0xf222('0x78'),'%'+_0x3cd479[_0xf222('0x69')]+'%',null);}else{_0x43dac3=_[_0xf222('0x67')](_0x2c1e49,['name',_0xf222('0x79')]);_0x3cd479['field']=_0xf222('0x79');_0x89162f=as[_0xf222('0x72')](_0xbc503b,_0x43dac3[_0xf222('0x3e')],_0x3cd479);_0x4aa98c[_0x1e680a](_0x89162f[_0xf222('0x73')],_0x89162f[_0xf222('0x69')][_0xf222('0x74')],_0x89162f[_0xf222('0x69')][_0xf222('0x21')]);}break;case _0xf222('0x7a'):_0x89162f=as['buildExpression']('me',null,_0x3cd479);_0x4aa98c[_0x1e680a](_0x89162f['text'],_0x89162f[_0xf222('0x69')]['start'],_0x89162f[_0xf222('0x69')][_0xf222('0x21')]);break;}}else{var _0x89162f=as['buildExpression'](_0xbc503b,_0x43dac3[_0xf222('0x3e')],_0x3cd479);_0x4aa98c[_0x1e680a](_0x89162f['text'],_0x89162f[_0xf222('0x69')][_0xf222('0x74')],_0x89162f[_0xf222('0x69')][_0xf222('0x21')]);}}}else{var _0x4cd922=_(_0x1b2f78[_0xf222('0x3f')])[_0xf222('0x40')]()[_0xf222('0x3b')](function(_0x3fe561){return _[_0xf222('0x7b')](_0x2c1e49,[_0xf222('0x2e'),_0x3fe561])?_0x3fe561:undefined;})[_0xf222('0x7c')]()[_0xf222('0x69')]();if(!_[_0xf222('0x7d')](_0x4cd922)){_0x4cd922[_0xf222('0x33')](function(_0x4c5e4a){if(_0x4c5e4a===_0xf222('0x7e')){_0x47942b[_0xf222('0x4a')](_0xf222('0x7f'),[][_0xf222('0x80')](_0x1b2f78[_0xf222('0x3f')][_0x4c5e4a]));}else if(_0x4c5e4a===_0xf222('0x81')){var _0x564fea=JSON[_0xf222('0x82')](_0x1b2f78['query'][_0x4c5e4a])[_0xf222('0x83')];var _0x3f86e3=JSON[_0xf222('0x82')](_0x1b2f78[_0xf222('0x3f')][_0x4c5e4a])[_0xf222('0x84')];_0x47942b['where'](_0xf222('0x85'),_0x564fea,_0x3f86e3);}else{if(_0x1b2f78[_0xf222('0x3f')][_0x4c5e4a]===_0xf222('0x86')){_0x47942b[_0xf222('0x4a')]('i.'+_0x4c5e4a+_0xf222('0x87'));}else{_0x47942b[_0xf222('0x4a')]('i.'+_0x4c5e4a+_0xf222('0x88'),_0x1b2f78['query'][_0x4c5e4a]);}}});}if(_0x1b2f78[_0xf222('0x3f')][_0xf222('0x89')]){if(_0x1b2f78[_0xf222('0x3f')][_0xf222('0x89')]==0x1){_0x47942b[_0xf222('0x6a')]('`unreadMessages`\x20=\x200');}else{_0x47942b[_0xf222('0x6a')](_0xf222('0x8a'));}}if(_0x1b2f78['query'][_0xf222('0x8b')]){_0x2ed76e=_[_0xf222('0x8c')](_0x1b2f78['query'][_0xf222('0x8b')])?_0x1b2f78[_0xf222('0x3f')]['tag']:new Array(_0x1b2f78[_0xf222('0x3f')]['tag']);_0x2ed76e[_0xf222('0x33')](function(_0x5d3c54){_0x28c5d1['or'](_0xf222('0x77'),'%,'+_0x5d3c54+',%');});}if(_0x1b2f78['query']['filter']){var _0x3177b5=_0x1b2f78[_0xf222('0x3f')][_0xf222('0x8d')][_0xf222('0x8e')]('\x5c','\x5c\x5c')[_0xf222('0x8e')](/'/g,'\x27\x27');if(qs[_0xf222('0x8f')](_0x3177b5)){_0x4aa98c['or'](_0xf222('0x90'),_0x3177b5+'%');}else if(qs[_0xf222('0x91')](_0x3177b5)){_0x4aa98c['or'](_0xf222('0x92'),_0x3177b5+'%');}else{_0x4aa98c['or'](_0xf222('0x93'),qs[_0xf222('0x70')](_0x3177b5))['or'](_0xf222('0x94'),qs[_0xf222('0x70')](_0x3177b5));}}}_0x47942b['where'](_0x4aa98c);_0x47942b['group']('i.id');var _0x3d2d6d={'type':db[_0xf222('0x95')]['QueryTypes'][_0xf222('0x96')],'raw':!![]};var _0xfda6df=_0x47942b[_0xf222('0x97')]();_0xfda6df[_0xf222('0x4c')]('i.id');_0xfda6df[_0xf222('0x4c')](_0xf222('0x98'),_0xf222('0x68'));if(_0x5c8b04[_0xf222('0x48')]){_0x5c8b04[_0xf222('0x48')][_0xf222('0x33')](function(_0x19f932){var _0x130998=_0x19f932[0x0]==='contactName'?_0x19f932[0x0]:'i.'+_0x19f932[0x0];_0x47942b[_0xf222('0x48')](_0x130998,_0x19f932[0x1]===_0xf222('0x99')?![]:!![]);});}if(!_[_0xf222('0x7d')](_0x2ed76e)){_0x47942b[_0xf222('0x6a')](_0x28c5d1);_0xfda6df[_0xf222('0x4a')](_0xf222('0x9a'),_0x2ed76e);}BPromise[_0xf222('0x9b')]()[_0xf222('0x2a')](function(){if(!_0xfb75f0){if(_0x1b2f78[_0xf222('0x3f')][_0xf222('0x7e')])return;_0xfda6df[_0xf222('0x4a')](_0xf222('0x9c'));_0x47942b[_0xf222('0x4a')](_0xf222('0x9c'));return;}if(_0x1b2f78[_0xf222('0x9d')][_0xf222('0x9e')]!==_0xf222('0x9f'))return;return _0x1b2f78[_0xf222('0x9d')][_0xf222('0xa0')]({'attributes':['id'],'raw':!![]})[_0xf222('0x2a')](function(_0x3ff83f){if(_['isEmpty'](_0x3ff83f)){_0xfda6df[_0xf222('0x4a')]('i.MailAccountId\x20IS\x20NULL');_0x47942b['where'](_0xf222('0xa1'));}else{_0xfda6df[_0xf222('0x4a')]('i.MailAccountId\x20IN\x20?',_[_0xf222('0x3b')](_0x3ff83f,'id'));_0x47942b['where'](_0xf222('0x7f'),_['map'](_0x3ff83f,'id'));}});})[_0xf222('0x2a')](function(){if(_0x1b2f78[_0xf222('0x9d')][_0xf222('0x9e')]===_0xf222('0x9f')&&!_0xfb75f0&&!_0x1b2f78[_0xf222('0x3f')][_0xf222('0x7e')])return[];return db['sequelize'][_0xf222('0x3f')](_0xfda6df[_0xf222('0xa2')](),_0x3d2d6d);})['then'](function(_0x303013){_0x2c7ee0[_0xf222('0x23')]=_0x303013['length'];if(_0x2c7ee0[_0xf222('0x23')]===0x0)return[];return db[_0xf222('0xa3')]['query'](_0x2c3584[_0xf222('0xa2')](),_0x3d2d6d)[_0xf222('0x2a')](function(_0x2792bb){_0x350c6a=_[_0xf222('0xa4')](_0x2792bb,'id');_0x3d2d6d=_[_0xf222('0xa5')](_0x3d2d6d,{'model':db[_0xf222('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1b2f78[_0xf222('0x3f')]['fields']){_0x5c8b04[_0xf222('0x44')][_0xf222('0x33')](function(_0x5e4055){_0x47942b[_0xf222('0x4c')]('i.'+_0x5e4055);});}else{_0x47942b[_0xf222('0x4c')](_0xf222('0x98'),_0xf222('0x68'));_0x47942b[_0xf222('0x4c')](_0xf222('0xa6'),_0xf222('0xa7'));_0x47942b[_0xf222('0x4c')]('a.mandatoryDisposition',_0xf222('0xa8'));_0x47942b[_0xf222('0x4c')](_0xf222('0xa9'),_0xf222('0xaa'));_0x47942b['field'](_0xf222('0xab'));_0x47942b[_0xf222('0x4c')](_0xf222('0xac'));_0x47942b[_0xf222('0x4c')](_0xf222('0xad'));_0x47942b['field'](_0xf222('0xae'));_0x47942b[_0xf222('0x4c')]('i.closedAt');_0x47942b[_0xf222('0x4c')](_0xf222('0xaf'));_0x47942b[_0xf222('0x4c')](_0xf222('0xb0'));_0x47942b['field'](_0xf222('0xb1'));_0x47942b[_0xf222('0x4c')](_0xf222('0xb2'));_0x47942b[_0xf222('0x4c')]('i.disposition');_0x47942b[_0xf222('0x4c')](_0xf222('0xb3'));_0x47942b['field']('i.thirdDisposition');_0x47942b[_0xf222('0x4c')](_0xf222('0xb4'));_0x47942b[_0xf222('0x4c')](_0xf222('0xb5'));_0x47942b[_0xf222('0x4c')](_0xf222('0xb6'));_0x47942b[_0xf222('0x4c')](_0xf222('0xb7'));_0x47942b[_0xf222('0x4c')]('i.UserId');_0x47942b[_0xf222('0x4c')](_0xf222('0xb8'),_0xf222('0xb9'));_0x47942b[_0xf222('0x4c')](_0xf222('0xba'),'Contact.lastName');_0x47942b[_0xf222('0x4c')](_0xf222('0xbb'),_0xf222('0xbc'));_0x47942b['field'](_0xf222('0xbd'),_0xf222('0xbe'));_0x47942b['field']('c.mobile',_0xf222('0xbf'));_0x47942b['field'](_0xf222('0xc0'),'Contact.fax');_0x47942b[_0xf222('0x4c')](_0xf222('0xc1'),'Owner.fullname');_0x47942b[_0xf222('0x4c')](_0xf222('0xc2'),_0xf222('0xc3'));_0x47942b[_0xf222('0x4c')](_0xf222('0xc4'),_0xf222('0x31'));}if(_0x5c8b04[_0xf222('0x47')])_0x47942b[_0xf222('0x47')](_0x5c8b04[_0xf222('0x47')]);if(_0x5c8b04[_0xf222('0x24')])_0x47942b[_0xf222('0x24')](_0x5c8b04[_0xf222('0x24')]);return db[_0xf222('0xa3')][_0xf222('0x3f')](_0x47942b['toString'](),_0x3d2d6d);})[_0xf222('0x2a')](function(_0x39cef2){_0x2bd5b1['where'](_0xf222('0xc5'),_[_0xf222('0x3b')](_0x39cef2,'id'));return db[_0xf222('0xa3')]['query'](_0x2bd5b1['toString'](),_0x3d2d6d)[_0xf222('0x2a')](function(_0x5aa7de){var _0x585173=_[_0xf222('0xc6')](_0x5aa7de,_0xf222('0xc7'));var _0x1c38da=[];return db['Setting'][_0xf222('0xc8')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0xf222('0x2a')](function(_0x1ac7cf){var _0xdd2c3a=_0x1ac7cf[_0xf222('0xc9')];_0x39cef2[_0xf222('0x33')](function(_0x50a13c){_0x1c38da[_0xf222('0x34')](updateMailInteraction(_0x50a13c,_0x350c6a,_0x585173,_0xdd2c3a));});return BPromise[_0xf222('0xca')](_0x1c38da);});});});})[_0xf222('0x2a')](function(_0x28f4fb){_0x2c7ee0[_0xf222('0xcb')]=_0x28f4fb;return _0x2c7ee0;})[_0xf222('0x2a')](respondWithFilteredResult(_0x769510,_0x5c8b04))[_0xf222('0x39')](handleError(_0x769510,null));};exports['show']=function(_0x5cf071,_0x496549){var _0x477a01={'raw':![],'where':{'id':_0x5cf071['params']['id']}},_0xbb4c9a={};_0xbb4c9a['model']=_[_0xf222('0x40')](db['MailInteraction'][_0xf222('0x3c')]);_0xbb4c9a[_0xf222('0x3f')]=_[_0xf222('0x40')](_0x5cf071['query']);_0xbb4c9a[_0xf222('0x41')]=_['intersection'](_0xbb4c9a[_0xf222('0x42')],_0xbb4c9a[_0xf222('0x3f')]);_0x477a01[_0xf222('0x44')]=_[_0xf222('0xcc')](_0xbb4c9a[_0xf222('0x42')],qs[_0xf222('0x43')](_0x5cf071['query']['fields']));_0x477a01[_0xf222('0x44')]=_0x477a01[_0xf222('0x44')]['length']?_0x477a01[_0xf222('0x44')]:_0xbb4c9a[_0xf222('0x42')];if(_0x5cf071[_0xf222('0x3f')][_0xf222('0xcd')]){_0x477a01[_0xf222('0xce')]=[{'all':!![]}];}_0x477a01=_['merge']({},_0x477a01,_0x5cf071[_0xf222('0xcf')]);return db[_0xf222('0x35')][_0xf222('0x67')](_0x477a01)[_0xf222('0x2a')](handleEntityNotFound(_0x496549,null))['then'](respondWithResult(_0x496549,null))[_0xf222('0x39')](handleError(_0x496549,null));};exports[_0xf222('0xd0')]=function(_0x3cbcf9,_0x14b685){return db[_0xf222('0x35')]['create'](_0x3cbcf9[_0xf222('0xd1')],{})[_0xf222('0x2a')](respondWithResult(_0x14b685,0xc9))['catch'](handleError(_0x14b685,null));};exports[_0xf222('0x29')]=function(_0x224440,_0x5707cc){if(_0x224440[_0xf222('0xd1')]['id']){delete _0x224440[_0xf222('0xd1')]['id'];}return db['MailInteraction'][_0xf222('0x67')]({'where':{'id':_0x224440['params']['id']}})[_0xf222('0x2a')](handleEntityNotFound(_0x5707cc,null))['then'](saveUpdates(_0x224440[_0xf222('0xd1')],null))[_0xf222('0x2a')](respondWithResult(_0x5707cc,null))[_0xf222('0x39')](handleError(_0x5707cc,null));};exports[_0xf222('0x2b')]=function(_0x1ef224,_0x574f81){return db['MailInteraction'][_0xf222('0x67')]({'where':{'id':_0x1ef224[_0xf222('0xd2')]['id']}})['then'](handleEntityNotFound(_0x574f81,null))[_0xf222('0x2a')](removeEntity(_0x574f81,null))[_0xf222('0x39')](handleError(_0x574f81,null));};exports['describe']=function(_0x1834ce,_0x2d5af0){return db[_0xf222('0x35')][_0xf222('0xd3')]()[_0xf222('0x2a')](respondWithResult(_0x2d5af0,null))[_0xf222('0x39')](handleError(_0x2d5af0,null));};exports['addMessage']=function(_0x21d9b7,_0x39e6fe,_0x245813){return db['MailMessage'][_0xf222('0x67')]({'where':{'id':_0x21d9b7[_0xf222('0xd2')]['id']}})[_0xf222('0x2a')](handleEntityNotFound(_0x39e6fe,null))['then'](function(_0xc97598){if(_0xc97598){return _0xc97598[_0xf222('0xd4')](_0x21d9b7['body']['ids'],_[_0xf222('0xd5')](_0x21d9b7[_0xf222('0xd1')],[_0xf222('0xd6'),'id'])||{});}})['then'](respondWithResult(_0x39e6fe,null))[_0xf222('0x39')](handleError(_0x39e6fe,null));};exports[_0xf222('0xd7')]=function(_0x59bdd6,_0x21a3b8,_0x53aec4){var _0x40486d={'raw':![],'where':{}};var _0x468a37={};var _0x2a7361={'count':0x0,'rows':[]};return db[_0xf222('0x35')]['findOne']({'where':{'id':_0x59bdd6[_0xf222('0xd2')]['id']}})[_0xf222('0x2a')](handleEntityNotFound(_0x21a3b8,null))['then'](function(_0x4ec733){if(_0x4ec733){_0x468a37[_0xf222('0x42')]=_['keys'](db[_0xf222('0xd8')][_0xf222('0x3c')]);_0x468a37[_0xf222('0x3f')]=_[_0xf222('0x40')](_0x59bdd6[_0xf222('0x3f')]);_0x468a37[_0xf222('0x41')]=_['intersection'](_0x468a37['model'],_0x468a37[_0xf222('0x3f')]);_0x40486d[_0xf222('0x44')]=_['intersection'](_0x468a37['model'],qs[_0xf222('0x43')](_0x59bdd6[_0xf222('0x3f')][_0xf222('0x43')]));_0x40486d[_0xf222('0x44')]=_0x40486d['attributes'][_0xf222('0x65')]?_0x40486d[_0xf222('0x44')]:_0x468a37['model'];if(!_0x59bdd6['query']['hasOwnProperty']('nolimit')){_0x40486d['limit']=qs[_0xf222('0x47')](_0x59bdd6[_0xf222('0x3f')][_0xf222('0x47')]);_0x40486d[_0xf222('0x24')]=qs['offset'](_0x59bdd6[_0xf222('0x3f')][_0xf222('0x24')]);}_0x40486d[_0xf222('0x48')]=qs['sort'](_0x59bdd6['query'][_0xf222('0x49')]);_0x40486d[_0xf222('0x4a')]=qs[_0xf222('0x41')](_[_0xf222('0xd9')](_0x59bdd6[_0xf222('0x3f')],_0x468a37[_0xf222('0x41')]));_0x40486d[_0xf222('0x4a')][_0xf222('0xc7')]=_0x4ec733['id'];if(_0x59bdd6[_0xf222('0x3f')][_0xf222('0x8d')]){_0x40486d['where']=_[_0xf222('0xa5')](_0x40486d[_0xf222('0x4a')],{'$or':_[_0xf222('0x3b')](_0x40486d[_0xf222('0x44')],function(_0x5d9bac){var _0x5f135b={};_0x5f135b[_0x5d9bac]={'$like':'%'+_0x59bdd6[_0xf222('0x3f')][_0xf222('0x8d')]+'%'};return _0x5f135b;})});}if(_0x59bdd6['query'][_0xf222('0x83')]){var _0x3c0ea1=_0x59bdd6[_0xf222('0x3f')][_0xf222('0x83')][_0xf222('0x76')](',');var _0x317d36={};_0x317d36[_0x3c0ea1[0x0]]={'$gte':moment(_0x3c0ea1[0x1])[_0xf222('0xda')](_0xf222('0xdb'))};_0x40486d[_0xf222('0x4a')]=_[_0xf222('0xa5')](_0x40486d[_0xf222('0x4a')],_0x317d36);}_0x40486d=_[_0xf222('0xa5')]({},_0x40486d,_0x59bdd6[_0xf222('0xcf')]);return db[_0xf222('0xd8')]['count']({'where':_0x40486d['where']})[_0xf222('0x2a')](function(_0x719a19){_0x2a7361[_0xf222('0x23')]=_0x719a19;if(_0x59bdd6[_0xf222('0x3f')][_0xf222('0xcd')]){_0x40486d[_0xf222('0xce')]=[{'all':!![]}];}return db[_0xf222('0xd8')]['findAll'](_0x40486d);})['then'](function(_0x3a171e){if(_0x59bdd6['query'][_0xf222('0xdc')]==='true'){for(var _0x2de1b4=0x0;_0x2de1b4<_0x3a171e[_0xf222('0x65')];_0x2de1b4++){_0x3a171e[_0x2de1b4][_0xf222('0xd1')]=juice(_0x3a171e[_0x2de1b4][_0xf222('0xd1')]);}}_0x2a7361[_0xf222('0xcb')]=_0x3a171e;return _0x2a7361;});}})[_0xf222('0x2a')](respondWithFilteredResult(_0x21a3b8,_0x40486d))[_0xf222('0x39')](handleError(_0x21a3b8,null));};exports[_0xf222('0xdd')]=function(_0x59ae28,_0x569cd9,_0x5ceb3c){return db['MailInteraction']['find']({'where':{'id':_0x59ae28['params']['id']}})[_0xf222('0x2a')](handleEntityNotFound(_0x569cd9,null))[_0xf222('0x2a')](function(_0x2674fe){if(_0x2674fe){return _0x2674fe[_0xf222('0xde')](_0x59ae28['body']['ids'],_[_0xf222('0xd5')](_0x59ae28['body'],[_0xf222('0xd6'),'id'])||{})['spread'](function(){return db[_0xf222('0x75')][_0xf222('0xdf')]({'attributes':['id',_0xf222('0x2e'),_0xf222('0x4d')],'where':{'id':_0x59ae28[_0xf222('0xd1')][_0xf222('0xd6')]}});})['then'](function(_0x36edd7){socket[_0xf222('0xe0')](_0xf222('0xe1'),{'id':Number(_0x59ae28[_0xf222('0xd2')]['id']),'tags':_0x36edd7||[]});return{'id':Number(_0x59ae28[_0xf222('0xd2')]['id']),'tags':_0x36edd7||[]};});}})[_0xf222('0x2a')](respondWithResult(_0x569cd9,null))[_0xf222('0x39')](handleError(_0x569cd9,null));};exports[_0xf222('0xe2')]=function(_0x26e374,_0xccaeb0,_0x4d364e){return db['MailInteraction']['find']({'where':{'id':_0x26e374['params']['id']}})['then'](handleEntityNotFound(_0xccaeb0,null))[_0xf222('0x2a')](function(_0x74d3b9){if(_0x74d3b9){return _0x74d3b9[_0xf222('0xe2')](_0x26e374[_0xf222('0x3f')]['ids']);}})[_0xf222('0x2a')](respondWithStatusCode(_0xccaeb0,null))[_0xf222('0x39')](handleError(_0xccaeb0,null));};exports[_0xf222('0xe3')]=function(_0x4eef69,_0x48bd2b){var _0xe406ec=moment()['unix']()[_0xf222('0xa2')]();var _0x2e174d=path[_0xf222('0xe4')](config[_0xf222('0xe5')],_0xf222('0xe6'),_0xf222('0xe7'),'tmp');var _0x4e43cb=path[_0xf222('0xe4')](config[_0xf222('0xe5')],'server',_0xf222('0xe7'),_0xf222('0xe8'));var _0x4ae4bc=path[_0xf222('0xe4')](_0x2e174d,_0xe406ec);var _0x4d874f=util[_0xf222('0xda')](_0xf222('0xe9'),_0x4eef69[_0xf222('0xd2')]['id'],_0xe406ec);var _0x26c62c=path['join'](_0x2e174d,_0x4d874f);var _0x4fa279=[];if(_0x4eef69[_0xf222('0x3f')]['attachments']){_0x4fa279[_0xf222('0x34')]({'model':db[_0xf222('0xea')],'as':_0xf222('0xeb'),'raw':!![]});}var _0xe93a10=[{'model':db[_0xf222('0xd8')],'as':_0xf222('0xec'),'attributes':['id',_0xf222('0xd1'),_0xf222('0x4e'),'to','cc',_0xf222('0xed'),_0xf222('0xee'),_0xf222('0x81')],'where':{'secret':![]},'order':qs[_0xf222('0x49')]('id'),'include':_0x4fa279}];return db[_0xf222('0x35')][_0xf222('0x67')]({'where':{'id':_0x4eef69[_0xf222('0xd2')]['id']},'include':_0xe93a10})['then'](handleEntityNotFound(_0x48bd2b,null))[_0xf222('0x2a')](function(_0x56d37c){if(_0x56d37c&&_0x56d37c[_0xf222('0xec')]){var _0x53a59b=_0x56d37c[_0xf222('0xef')]({'plain':!![]});fs[_0xf222('0xf0')](_0x4ae4bc);return BPromise[_0xf222('0xf1')](_0x53a59b[_0xf222('0xec')],function(_0x5b953f,_0x42b0c9){var _0x517403={'from':_0x5b953f[_0xf222('0x4e')],'to':_0x5b953f['to'],'subject':_0x5b953f[_0xf222('0xee')],'html':_0x5b953f[_0xf222('0xd1')],'headers':{'Date':moment(_0x5b953f[_0xf222('0x81')])[_0xf222('0xda')](_0xf222('0xf2'))},'attachments':[]};if(_0x5b953f['cc']){_0x517403['headers']['Cc']=_0x5b953f['cc'];}if(_0x5b953f[_0xf222('0xed')]){_0x517403[_0xf222('0xf3')]['Bcc']=_0x5b953f['bcc'];}return new BPromise(function(_0xf367c,_0x3e46e5){if(_0x5b953f[_0xf222('0xeb')]){for(var _0xb58b65=0x0;_0xb58b65<_0x5b953f['Attachments'][_0xf222('0x65')];_0xb58b65++){var _0x5a3deb=_0x5b953f[_0xf222('0xeb')][_0xb58b65];var _0x3e86da=path[_0xf222('0xe4')](_0x4e43cb,_0x5a3deb[_0xf222('0xf4')]);if(fs['existsSync'](_0x3e86da)){_0x517403[_0xf222('0xe8')][_0xf222('0x34')]({'name':_0x5a3deb['name'],'contentType':_0x5a3deb['type'],'data':fs[_0xf222('0xf5')](_0x3e86da)});}}}emlformat[_0xf222('0xf6')](_0x517403,function(_0x803659,_0x4fb971){if(_0x803659)return _0x3e46e5(_0x803659);fs[_0xf222('0xf7')](path[_0xf222('0xe4')](_0x4ae4bc,util['format'](_0xf222('0xf8'),_0x42b0c9)),_0x4fb971);return _0xf367c(_0x4fb971);});});})[_0xf222('0x2a')](function(){return new BPromise(function(_0xf4e832,_0x43532b){zipdir(_0x4ae4bc,{'saveTo':_0x26c62c},function(_0x314725,_0x28308b){if(_0x314725)return _0x43532b(_0x314725);return _0xf4e832(_0x28308b);});})[_0xf222('0x2a')](function(){return new BPromise(function(_0x5ae5f2,_0x5d9d18){rimraf(_0x4ae4bc,function(_0x5a1849){if(_0x5a1849)_0x5d9d18(_0x5a1849);return _0x5ae5f2();});});})['then'](function(){return _0x48bd2b[_0xf222('0xe3')](_0x26c62c,_0x4d874f,function(_0x21473b){if(_0x21473b){console[_0xf222('0xf9')](_0xf222('0xfa'),_0x21473b);}else{fs[_0xf222('0xfb')](_0x26c62c);}});});});}else{return _0x48bd2b[_0xf222('0x1f')](0xc8);}})[_0xf222('0x39')](handleError(_0x48bd2b,null));}; \ No newline at end of file +var _0xb43b=['offset','limit','set','reject','update','then','destroy','error','stack','name','Users','map','fullname','TagIds','Tags','forEach','push','MailInteraction','findOne','lastMsgBody','lastMsgText','trimStart','fromString','catch','index','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','field','from','u.id','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','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','conditions','find','unreadMessages','value','having','`\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','ContactId','buildExpression','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','start','plainBody','some','compact','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','MailAccountId','user','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','a.key','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','MailInteractionId','enableEmailPreview','all','rows','show','params','include','options','create','body','describe','MailMessage','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','inlineCss','addTags','setTags','spread','color','removeTags','download','join','root','files','server','transcript-%d-%s.zip','attachments','bcc','subject','Messages','get','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','readFileSync','writeFileSync','err','unlinkSync','sendStatus','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','socket.io-emitter','end','status','json','count'];(function(_0x3c9ef8,_0x38ceb2){var _0x83a178=function(_0x3ad8a0){while(--_0x3ad8a0){_0x3c9ef8['push'](_0x3c9ef8['shift']());}};_0x83a178(++_0x38ceb2);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1a9de0,_0x28e6da){_0x1a9de0=_0x1a9de0-0x0;var _0x48209f=_0xb43b[_0x1a9de0];return _0x48209f;};'use strict';var pdf=require(_0xbb43('0x0'));var emlformat=require(_0xbb43('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbb43('0x2'));var jsonpatch=require(_0xbb43('0x3'));var rp=require(_0xbb43('0x4'));var moment=require('moment');var BPromise=require(_0xbb43('0x5'));var Mustache=require(_0xbb43('0x6'));var util=require(_0xbb43('0x7'));var path=require(_0xbb43('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbb43('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb43('0xa'));var squel=require(_0xbb43('0xb'));var crypto=require(_0xbb43('0xc'));var jsforce=require(_0xbb43('0xd'));var deskjs=require(_0xbb43('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbb43('0xf'));var Papa=require(_0xbb43('0x10'));var htmlToText=require('html-to-text');var juice=require(_0xbb43('0x11'));var Redis=require(_0xbb43('0x12'));var authService=require(_0xbb43('0x13'));var qs=require(_0xbb43('0x14'));var as=require(_0xbb43('0x15'));var hardwareService=require(_0xbb43('0x16'));var logger=require('../../config/logger')(_0xbb43('0x17'));var utils=require(_0xbb43('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbb43('0x19'))['db'];config['redis']=_['defaults'](config[_0xbb43('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xbb43('0x1b'))(new Redis(config[_0xbb43('0x1a')]));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x4d5bcf,_0x338120){_0x338120=_0x338120||0xcc;return function(_0x2abce0){if(_0x2abce0){return _0x4d5bcf['sendStatus'](_0x338120);}return _0x4d5bcf['status'](_0x338120)[_0xbb43('0x1c')]();};}function respondWithResult(_0x563ce1,_0x5923dc){_0x5923dc=_0x5923dc||0xc8;return function(_0x2b0797){if(_0x2b0797){return _0x563ce1[_0xbb43('0x1d')](_0x5923dc)[_0xbb43('0x1e')](_0x2b0797);}};}function respondWithFilteredResult(_0x55dd73,_0x1c16d7){return function(_0x4f28b8){if(_0x4f28b8){var _0x3bb57d=_0x4f28b8[_0xbb43('0x1f')],_0x8e6429=_0x1c16d7[_0xbb43('0x20')],_0x4dfc54=_0x1c16d7[_0xbb43('0x20')]+_0x1c16d7[_0xbb43('0x21')],_0x5d765b;if(_0x4dfc54>=_0x3bb57d){_0x4dfc54=_0x3bb57d;_0x5d765b=0xc8;}else{_0x5d765b=0xce;}_0x55dd73['status'](_0x5d765b);return _0x55dd73[_0xbb43('0x22')]('Content-Range',_0x8e6429+'-'+_0x4dfc54+'/'+_0x3bb57d)[_0xbb43('0x1e')](_0x4f28b8);}return null;};}function patchUpdates(_0x4bfaca){return function(_0x2f5e31){try{jsonpatch['apply'](_0x2f5e31,_0x4bfaca,!![]);}catch(_0x3f323e){return BPromise[_0xbb43('0x23')](_0x3f323e);}return _0x2f5e31['save']();};}function saveUpdates(_0x1d0768,_0x4dfb7f){return function(_0xf24e60){if(_0xf24e60){return _0xf24e60[_0xbb43('0x24')](_0x1d0768)[_0xbb43('0x25')](function(_0x4d6d77){return _0x4d6d77;});}return null;};}function removeEntity(_0x53f0d5,_0x59a24d){return function(_0x269ca5){if(_0x269ca5){return _0x269ca5[_0xbb43('0x26')]()['then'](function(){_0x53f0d5[_0xbb43('0x1d')](0xcc)[_0xbb43('0x1c')]();});}};}function handleEntityNotFound(_0x226827,_0x3874fb){return function(_0x4ed43f){if(!_0x4ed43f){_0x226827['sendStatus'](0x194);}return _0x4ed43f;};}function handleError(_0x27fd7a,_0x42800f){_0x42800f=_0x42800f||0x1f4;return function(_0xa88db0){logger[_0xbb43('0x27')](_0xa88db0[_0xbb43('0x28')]);if(_0xa88db0[_0xbb43('0x29')]){delete _0xa88db0[_0xbb43('0x29')];}_0x27fd7a[_0xbb43('0x1d')](_0x42800f)['send'](_0xa88db0);};}function getInteractionUsers(_0x2ad6da,_0x56fe33){return new BPromise(function(_0x31fbc8,_0x436fd5){try{if(_0x56fe33[_0x2ad6da['id']]){_0x2ad6da[_0xbb43('0x2a')]=_[_0xbb43('0x2b')](_0x56fe33[_0x2ad6da['id']],function(_0x555b99){return{'id':_0x555b99['id'],'fullname':_0x555b99[_0xbb43('0x2c')]};});}}catch(_0x547a6f){_0x436fd5(_0x547a6f);}_0x31fbc8(_0x2ad6da);});}function getInteractionTags(_0x5566cf,_0x57d9d4){return new BPromise(function(_0x2af898,_0x573a05){try{if(_0x5566cf[_0xbb43('0x2d')]){_0x5566cf[_0xbb43('0x2e')]=[];_0x5566cf[_0xbb43('0x2d')]['split'](',')[_0xbb43('0x2f')](function(_0x1bdf91){_0x5566cf[_0xbb43('0x2e')][_0xbb43('0x30')](_0x57d9d4[_0x1bdf91]);});}delete _0x5566cf[_0xbb43('0x2d')];}catch(_0x2f1939){_0x573a05(_0x2f1939);}_0x2af898(_0x5566cf);});}function getLastMessageText(_0x3de482){return new BPromise(function(_0x24375b,_0x4f31ce){return db[_0xbb43('0x31')][_0xbb43('0x32')]({'where':{'id':_0x3de482['id']},'attributes':[_0xbb43('0x33'),_0xbb43('0x34')],'raw':!![]})[_0xbb43('0x25')](function(_0x37c565){if(!_0x37c565[_0xbb43('0x34')]){_0x3de482[_0xbb43('0x34')]=_[_0xbb43('0x35')](htmlToText[_0xbb43('0x36')](_0x37c565[_0xbb43('0x33')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x3de482[_0xbb43('0x34')]=_0x37c565[_0xbb43('0x34')];}_0x24375b(_0x3de482);})[_0xbb43('0x37')](function(_0x39062a){_0x4f31ce(_0x39062a);});});}function updateMailInteraction(_0x405f36,_0x549841,_0x39cbd7,_0x2d2056){return new BPromise(function(_0x52a694,_0x285014){return getInteractionUsers(_0x405f36,_0x39cbd7)[_0xbb43('0x25')](function(_0x11d384){return getInteractionTags(_0x11d384,_0x549841);})['then'](function(_0x5f4601){if(_0x2d2056){_0x52a694(getLastMessageText(_0x5f4601));}else{_0x52a694(_0x5f4601);}})['catch'](function(_0x40df31){_0x285014(_0x40df31);});});}exports[_0xbb43('0x38')]=function(_0x4a95c3,_0x4847df){var _0x2aa381={},_0x275425={},_0x29f6e5={'count':0x0,'rows':[]};var _0x37afbb=_[_0xbb43('0x2b')](db['MailInteraction'][_0xbb43('0x39')],function(_0x526cb8){return{'name':_0x526cb8[_0xbb43('0x3a')],'type':_0x526cb8[_0xbb43('0x3b')][_0xbb43('0x3c')]};});_0x275425['model']=_[_0xbb43('0x2b')](_0x37afbb,'name');_0x275425[_0xbb43('0x3d')]=_[_0xbb43('0x3e')](_0x4a95c3['query']);_0x275425[_0xbb43('0x3f')]=_['intersection'](_0x275425[_0xbb43('0x40')],_0x275425[_0xbb43('0x3d')]);_0x2aa381[_0xbb43('0x41')]=_[_0xbb43('0x42')](_0x275425['model'],qs[_0xbb43('0x43')](_0x4a95c3[_0xbb43('0x3d')]['fields']));_0x2aa381[_0xbb43('0x41')]=_0x2aa381['attributes'][_0xbb43('0x44')]?_0x2aa381[_0xbb43('0x41')]:_0x275425[_0xbb43('0x40')];if(!_0x4a95c3[_0xbb43('0x3d')][_0xbb43('0x45')](_0xbb43('0x46'))){_0x2aa381['limit']=qs[_0xbb43('0x21')](_0x4a95c3['query'][_0xbb43('0x21')]);_0x2aa381[_0xbb43('0x20')]=qs[_0xbb43('0x20')](_0x4a95c3[_0xbb43('0x3d')]['offset']);}_0x2aa381[_0xbb43('0x47')]=qs[_0xbb43('0x48')](_0x4a95c3[_0xbb43('0x3d')][_0xbb43('0x48')]);_0x2aa381[_0xbb43('0x49')]=qs[_0xbb43('0x3f')](_[_0xbb43('0x4a')](_0x4a95c3[_0xbb43('0x3d')],_0x275425['filters']),_0x37afbb);var _0x2eaece=[];var _0x8c57af=squel['select']()[_0xbb43('0x4b')]('id')['field']('name')['field']('color')[_0xbb43('0x4c')]('tools_tags');var _0x19c451=squel['select']()[_0xbb43('0x4b')](_0xbb43('0x4d'))[_0xbb43('0x4b')]('u.fullname')[_0xbb43('0x4b')]('ui.MailInteractionId')[_0xbb43('0x4c')](_0xbb43('0x4e'),'ui')[_0xbb43('0x4f')](_0xbb43('0x50'),'u',_0xbb43('0x51'));var _0x13d0a5=squel[_0xbb43('0x52')]()['from'](_0xbb43('0x53'),'i')[_0xbb43('0x4f')](_0xbb43('0x54'),'c',_0xbb43('0x55'))['left_join'](_0xbb43('0x50'),'o',_0xbb43('0x56'))[_0xbb43('0x4f')](_0xbb43('0x57'),'a','a.id\x20=\x20i.MailAccountId')[_0xbb43('0x4f')](_0xbb43('0x58'),'me',_0xbb43('0x59'))['left_join'](_0xbb43('0x5a'),'it',_0xbb43('0x5b'))[_0xbb43('0x4f')](_0xbb43('0x5c'),'t',_0xbb43('0x5d'));var _0x59c805=squel['expr']();var _0xb44557=[];var _0x5c75ba=squel[_0xbb43('0x5e')]();var _0xe0cdba;if(_0x4a95c3['query'][_0xbb43('0x5f')]){_0xe0cdba=as[_0xbb43('0x60')](_0x4a95c3[_0xbb43('0x3d')][_0xbb43('0x5f')]);var _0x1dfbb9=_0xe0cdba['sqlOperator'];for(var _0x124f88=0x0;_0x124f88<_0xe0cdba['conditions']['length'];_0x124f88++){var _0x3f42af=_0xe0cdba[_0xbb43('0x61')][_0x124f88];var _0x182c9b='i';var _0x474cee=_[_0xbb43('0x62')](_0x37afbb,['name',_0x3f42af['field']]);if(!_0x474cee){switch(_0x3f42af[_0xbb43('0x4b')]){case _0xbb43('0x63'):if(_0x3f42af[_0xbb43('0x64')]==0x1){_0x13d0a5[_0xbb43('0x65')]('`'+_0x3f42af[_0xbb43('0x4b')]+_0xbb43('0x66'));}else{_0x13d0a5[_0xbb43('0x65')]('`'+_0x3f42af[_0xbb43('0x4b')]+_0xbb43('0x67'));}break;case'Contact':if(_0x3f42af[_0xbb43('0x68')]===_0xbb43('0x69')){if(_0x3f42af[_0xbb43('0x64')][_0xbb43('0x6a')]('\x20')[_0xbb43('0x44')]>0x1){_0x59c805[_0x1dfbb9](_0xbb43('0x6b'),qs[_0xbb43('0x6c')](_0x3f42af[_0xbb43('0x64')]),null);}else{var _0x3e01e4='%'+_0x3f42af['value']+'%';_0x59c805[_0x1dfbb9]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3e01e4,_0x3e01e4,_0x3e01e4);}}else{_0x474cee=_[_0xbb43('0x62')](_0x37afbb,[_0xbb43('0x29'),_0xbb43('0x6d')]);_0x3f42af[_0xbb43('0x4b')]=_0xbb43('0x6d');_0xd3dcfc=as[_0xbb43('0x6e')](_0x182c9b,_0x474cee[_0xbb43('0x3b')],_0x3f42af);_0x59c805[_0x1dfbb9](_0xd3dcfc['text'],_0xd3dcfc[_0xbb43('0x64')]['start'],_0xd3dcfc['value'][_0xbb43('0x1c')]);}break;case _0xbb43('0x6f'):var _0x3cccea=_0x3f42af[_0xbb43('0x64')][_0xbb43('0x6a')](',')[_0xbb43('0x2b')](function(_0x18ee1a){return Number(_0x18ee1a);});_0x3cccea[_0xbb43('0x2f')](function(_0x51b076){_0x5c75ba['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x51b076+',%');});_0xb44557=_[_0xbb43('0x70')](_0xb44557,_0x3cccea);break;case _0xbb43('0x71'):if(_0x3f42af[_0xbb43('0x68')]===_0xbb43('0x69')){_0x59c805[_0x1dfbb9](_0xbb43('0x72'),'%'+_0x3f42af[_0xbb43('0x64')]+'%',null);}else{_0x474cee=_[_0xbb43('0x62')](_0x37afbb,[_0xbb43('0x29'),_0xbb43('0x73')]);_0x3f42af['field']=_0xbb43('0x73');_0xd3dcfc=as[_0xbb43('0x6e')](_0x182c9b,_0x474cee[_0xbb43('0x3b')],_0x3f42af);_0x59c805[_0x1dfbb9](_0xd3dcfc[_0xbb43('0x74')],_0xd3dcfc[_0xbb43('0x64')][_0xbb43('0x75')],_0xd3dcfc['value'][_0xbb43('0x1c')]);}break;case _0xbb43('0x76'):_0xd3dcfc=as[_0xbb43('0x6e')]('me',null,_0x3f42af);_0x59c805[_0x1dfbb9](_0xd3dcfc[_0xbb43('0x74')],_0xd3dcfc[_0xbb43('0x64')]['start'],_0xd3dcfc[_0xbb43('0x64')][_0xbb43('0x1c')]);break;}}else{var _0xd3dcfc=as[_0xbb43('0x6e')](_0x182c9b,_0x474cee[_0xbb43('0x3b')],_0x3f42af);_0x59c805[_0x1dfbb9](_0xd3dcfc[_0xbb43('0x74')],_0xd3dcfc[_0xbb43('0x64')][_0xbb43('0x75')],_0xd3dcfc[_0xbb43('0x64')][_0xbb43('0x1c')]);}}}else{var _0x580e75=_(_0x4a95c3[_0xbb43('0x3d')])['keys']()[_0xbb43('0x2b')](function(_0x2478fb){return _[_0xbb43('0x77')](_0x37afbb,[_0xbb43('0x29'),_0x2478fb])?_0x2478fb:undefined;})[_0xbb43('0x78')]()['value']();if(!_['isEmpty'](_0x580e75)){_0x580e75[_0xbb43('0x2f')](function(_0xa22c95){if(_0xa22c95==='MailAccountId'){_0x13d0a5[_0xbb43('0x49')](_0xbb43('0x79'),[][_0xbb43('0x7a')](_0x4a95c3[_0xbb43('0x3d')][_0xa22c95]));}else if(_0xa22c95===_0xbb43('0x7b')){var _0x298a77=JSON[_0xbb43('0x7c')](_0x4a95c3[_0xbb43('0x3d')][_0xa22c95])[_0xbb43('0x7d')];var _0xf2b3b0=JSON[_0xbb43('0x7c')](_0x4a95c3[_0xbb43('0x3d')][_0xa22c95])[_0xbb43('0x7e')];_0x13d0a5[_0xbb43('0x49')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x298a77,_0xf2b3b0);}else{if(_0x4a95c3['query'][_0xa22c95]===_0xbb43('0x7f')){_0x13d0a5[_0xbb43('0x49')]('i.'+_0xa22c95+_0xbb43('0x80'));}else{_0x13d0a5['where']('i.'+_0xa22c95+_0xbb43('0x81'),_0x4a95c3[_0xbb43('0x3d')][_0xa22c95]);}}});}if(_0x4a95c3[_0xbb43('0x3d')][_0xbb43('0x82')]){if(_0x4a95c3[_0xbb43('0x3d')]['read']==0x1){_0x13d0a5[_0xbb43('0x65')](_0xbb43('0x83'));}else{_0x13d0a5[_0xbb43('0x65')]('`unreadMessages`\x20>\x200');}}if(_0x4a95c3[_0xbb43('0x3d')][_0xbb43('0x84')]){_0xb44557=_[_0xbb43('0x85')](_0x4a95c3[_0xbb43('0x3d')][_0xbb43('0x84')])?_0x4a95c3[_0xbb43('0x3d')][_0xbb43('0x84')]:new Array(_0x4a95c3[_0xbb43('0x3d')][_0xbb43('0x84')]);_0xb44557[_0xbb43('0x2f')](function(_0x445219){_0x5c75ba['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x445219+',%');});}if(_0x4a95c3[_0xbb43('0x3d')][_0xbb43('0x86')]){var _0x2d439f=_0x4a95c3[_0xbb43('0x3d')][_0xbb43('0x86')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x2d439f)){_0x59c805['or'](_0xbb43('0x87'),_0x2d439f+'%');}else if(qs[_0xbb43('0x88')](_0x2d439f)){_0x59c805['or'](_0xbb43('0x89'),_0x2d439f+'%');}else{_0x59c805['or'](_0xbb43('0x8a'),qs[_0xbb43('0x6c')](_0x2d439f))['or'](_0xbb43('0x8b'),qs[_0xbb43('0x6c')](_0x2d439f));}}}_0x13d0a5['where'](_0x59c805);_0x13d0a5[_0xbb43('0x8c')](_0xbb43('0x8d'));var _0x3901c6={'type':db['Sequelize'][_0xbb43('0x8e')]['SELECT'],'raw':!![]};var _0x36f94e=_0x13d0a5['clone']();_0x36f94e[_0xbb43('0x4b')](_0xbb43('0x8d'));_0x36f94e[_0xbb43('0x4b')](_0xbb43('0x8f'),_0xbb43('0x63'));if(_0x2aa381[_0xbb43('0x47')]){_0x2aa381[_0xbb43('0x47')][_0xbb43('0x2f')](function(_0x4c4edb){var _0x708327=_0x4c4edb[0x0]===_0xbb43('0x90')?_0x4c4edb[0x0]:'i.'+_0x4c4edb[0x0];_0x13d0a5['order'](_0x708327,_0x4c4edb[0x1]===_0xbb43('0x91')?![]:!![]);});}if(!_[_0xbb43('0x92')](_0xb44557)){_0x13d0a5[_0xbb43('0x65')](_0x5c75ba);_0x36f94e['where'](_0xbb43('0x93'),_0xb44557);}BPromise[_0xbb43('0x94')]()[_0xbb43('0x25')](function(){if(!_0xe0cdba){if(_0x4a95c3[_0xbb43('0x3d')][_0xbb43('0x95')])return;_0x36f94e[_0xbb43('0x49')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x13d0a5[_0xbb43('0x49')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x4a95c3[_0xbb43('0x96')][_0xbb43('0x97')]!=='agent')return;return _0x4a95c3[_0xbb43('0x96')][_0xbb43('0x98')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4cee72){if(_[_0xbb43('0x92')](_0x4cee72)){_0x36f94e[_0xbb43('0x49')](_0xbb43('0x99'));_0x13d0a5[_0xbb43('0x49')](_0xbb43('0x99'));}else{_0x36f94e[_0xbb43('0x49')](_0xbb43('0x79'),_[_0xbb43('0x2b')](_0x4cee72,'id'));_0x13d0a5[_0xbb43('0x49')](_0xbb43('0x79'),_['map'](_0x4cee72,'id'));}});})[_0xbb43('0x25')](function(){if(_0x4a95c3[_0xbb43('0x96')][_0xbb43('0x97')]==='agent'&&!_0xe0cdba&&!_0x4a95c3['query'][_0xbb43('0x95')])return[];return db[_0xbb43('0x9a')][_0xbb43('0x3d')](_0x36f94e[_0xbb43('0x9b')](),_0x3901c6);})['then'](function(_0x2814fc){_0x29f6e5['count']=_0x2814fc[_0xbb43('0x44')];if(_0x29f6e5[_0xbb43('0x1f')]===0x0)return[];return db[_0xbb43('0x9a')]['query'](_0x8c57af[_0xbb43('0x9b')](),_0x3901c6)[_0xbb43('0x25')](function(_0x47b468){_0x2eaece=_['keyBy'](_0x47b468,'id');_0x3901c6=_[_0xbb43('0x9c')](_0x3901c6,{'model':db[_0xbb43('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4a95c3[_0xbb43('0x3d')][_0xbb43('0x43')]){_0x2aa381[_0xbb43('0x41')][_0xbb43('0x2f')](function(_0x32a2ae){_0x13d0a5[_0xbb43('0x4b')]('i.'+_0x32a2ae);});}else{_0x13d0a5['field'](_0xbb43('0x8f'),_0xbb43('0x63'));_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0x9d'),'Account.key');_0x13d0a5[_0xbb43('0x4b')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0x9e'),_0xbb43('0x90'));_0x13d0a5['field']('i.id');_0x13d0a5['field'](_0xbb43('0x9f'));_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xa0'));_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xa1'));_0x13d0a5['field'](_0xbb43('0xa2'));_0x13d0a5['field'](_0xbb43('0xa3'));_0x13d0a5['field']('i.lastMsgAt');_0x13d0a5['field'](_0xbb43('0xa4'));_0x13d0a5[_0xbb43('0x4b')]('i.subject');_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xa5'));_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xa6'));_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xa7'));_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xa8'));_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xa9'));_0x13d0a5[_0xbb43('0x4b')]('i.ContactId');_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xaa'));_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xab'));_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xac'),_0xbb43('0xad'));_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xae'),_0xbb43('0xaf'));_0x13d0a5[_0xbb43('0x4b')]('c.email','Contact.email');_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xb0'),'Contact.phone');_0x13d0a5[_0xbb43('0x4b')]('c.mobile',_0xbb43('0xb1'));_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xb2'),_0xbb43('0xb3'));_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xb4'),'Owner.fullname');_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xb5'),_0xbb43('0xb6'));_0x13d0a5[_0xbb43('0x4b')](_0xbb43('0xb7'),_0xbb43('0x2d'));}if(_0x2aa381[_0xbb43('0x21')])_0x13d0a5[_0xbb43('0x21')](_0x2aa381[_0xbb43('0x21')]);if(_0x2aa381[_0xbb43('0x20')])_0x13d0a5[_0xbb43('0x20')](_0x2aa381[_0xbb43('0x20')]);return db[_0xbb43('0x9a')][_0xbb43('0x3d')](_0x13d0a5[_0xbb43('0x9b')](),_0x3901c6);})['then'](function(_0x24fe48){_0x19c451[_0xbb43('0x49')]('ui.MailInteractionId\x20IN\x20?',_['map'](_0x24fe48,'id'));return db[_0xbb43('0x9a')]['query'](_0x19c451['toString'](),_0x3901c6)[_0xbb43('0x25')](function(_0x5d45da){var _0x395dfe=_[_0xbb43('0xb8')](_0x5d45da,_0xbb43('0xb9'));var _0x60dcf9=[];return db['Setting'][_0xbb43('0x32')]({'attributes':[_0xbb43('0xba')],'raw':!![]})[_0xbb43('0x25')](function(_0x5c65a1){var _0x263d28=_0x5c65a1[_0xbb43('0xba')];_0x24fe48['forEach'](function(_0x15b5c3){_0x60dcf9[_0xbb43('0x30')](updateMailInteraction(_0x15b5c3,_0x2eaece,_0x395dfe,_0x263d28));});return BPromise[_0xbb43('0xbb')](_0x60dcf9);});});});})[_0xbb43('0x25')](function(_0x61ff2f){_0x29f6e5[_0xbb43('0xbc')]=_0x61ff2f;return _0x29f6e5;})[_0xbb43('0x25')](respondWithFilteredResult(_0x4847df,_0x2aa381))[_0xbb43('0x37')](handleError(_0x4847df,null));};exports[_0xbb43('0xbd')]=function(_0x2703cf,_0xda0e5d){var _0x3c4d95={'raw':![],'where':{'id':_0x2703cf[_0xbb43('0xbe')]['id']}},_0x2aef2f={};_0x2aef2f['model']=_[_0xbb43('0x3e')](db[_0xbb43('0x31')][_0xbb43('0x39')]);_0x2aef2f[_0xbb43('0x3d')]=_['keys'](_0x2703cf[_0xbb43('0x3d')]);_0x2aef2f[_0xbb43('0x3f')]=_[_0xbb43('0x42')](_0x2aef2f[_0xbb43('0x40')],_0x2aef2f[_0xbb43('0x3d')]);_0x3c4d95['attributes']=_[_0xbb43('0x42')](_0x2aef2f[_0xbb43('0x40')],qs['fields'](_0x2703cf[_0xbb43('0x3d')][_0xbb43('0x43')]));_0x3c4d95['attributes']=_0x3c4d95[_0xbb43('0x41')][_0xbb43('0x44')]?_0x3c4d95[_0xbb43('0x41')]:_0x2aef2f[_0xbb43('0x40')];if(_0x2703cf[_0xbb43('0x3d')]['includeAll']){_0x3c4d95[_0xbb43('0xbf')]=[{'all':!![]}];}_0x3c4d95=_[_0xbb43('0x9c')]({},_0x3c4d95,_0x2703cf[_0xbb43('0xc0')]);return db[_0xbb43('0x31')][_0xbb43('0x62')](_0x3c4d95)['then'](handleEntityNotFound(_0xda0e5d,null))[_0xbb43('0x25')](respondWithResult(_0xda0e5d,null))['catch'](handleError(_0xda0e5d,null));};exports['create']=function(_0x247002,_0x54fd3b){return db[_0xbb43('0x31')][_0xbb43('0xc1')](_0x247002[_0xbb43('0xc2')],{})[_0xbb43('0x25')](respondWithResult(_0x54fd3b,0xc9))['catch'](handleError(_0x54fd3b,null));};exports['update']=function(_0x51eece,_0xe7b08a){if(_0x51eece[_0xbb43('0xc2')]['id']){delete _0x51eece[_0xbb43('0xc2')]['id'];}return db[_0xbb43('0x31')][_0xbb43('0x62')]({'where':{'id':_0x51eece[_0xbb43('0xbe')]['id']}})[_0xbb43('0x25')](handleEntityNotFound(_0xe7b08a,null))[_0xbb43('0x25')](saveUpdates(_0x51eece['body'],null))[_0xbb43('0x25')](respondWithResult(_0xe7b08a,null))['catch'](handleError(_0xe7b08a,null));};exports[_0xbb43('0x26')]=function(_0x4c5500,_0x1a4089){return db[_0xbb43('0x31')][_0xbb43('0x62')]({'where':{'id':_0x4c5500[_0xbb43('0xbe')]['id']}})[_0xbb43('0x25')](handleEntityNotFound(_0x1a4089,null))[_0xbb43('0x25')](removeEntity(_0x1a4089,null))[_0xbb43('0x37')](handleError(_0x1a4089,null));};exports['describe']=function(_0x115fef,_0x38cf36){return db[_0xbb43('0x31')][_0xbb43('0xc3')]()[_0xbb43('0x25')](respondWithResult(_0x38cf36,null))[_0xbb43('0x37')](handleError(_0x38cf36,null));};exports['addMessage']=function(_0x217127,_0x2965ec,_0x855367){return db[_0xbb43('0xc4')][_0xbb43('0x62')]({'where':{'id':_0x217127[_0xbb43('0xbe')]['id']}})[_0xbb43('0x25')](handleEntityNotFound(_0x2965ec,null))[_0xbb43('0x25')](function(_0xc4893f){if(_0xc4893f){return _0xc4893f['addMessage'](_0x217127[_0xbb43('0xc2')][_0xbb43('0xc5')],_[_0xbb43('0xc6')](_0x217127['body'],[_0xbb43('0xc5'),'id'])||{});}})['then'](respondWithResult(_0x2965ec,null))['catch'](handleError(_0x2965ec,null));};exports[_0xbb43('0xc7')]=function(_0x17d7c4,_0x524085,_0x15ce03){var _0x48d864={'raw':![],'where':{}};var _0x2d1b62={};var _0xdc226f={'count':0x0,'rows':[]};return db[_0xbb43('0x31')]['findOne']({'where':{'id':_0x17d7c4['params']['id']}})['then'](handleEntityNotFound(_0x524085,null))[_0xbb43('0x25')](function(_0x421626){if(_0x421626){_0x2d1b62[_0xbb43('0x40')]=_[_0xbb43('0x3e')](db[_0xbb43('0xc4')]['rawAttributes']);_0x2d1b62[_0xbb43('0x3d')]=_[_0xbb43('0x3e')](_0x17d7c4[_0xbb43('0x3d')]);_0x2d1b62[_0xbb43('0x3f')]=_[_0xbb43('0x42')](_0x2d1b62[_0xbb43('0x40')],_0x2d1b62['query']);_0x48d864['attributes']=_[_0xbb43('0x42')](_0x2d1b62[_0xbb43('0x40')],qs['fields'](_0x17d7c4['query'][_0xbb43('0x43')]));_0x48d864['attributes']=_0x48d864[_0xbb43('0x41')][_0xbb43('0x44')]?_0x48d864[_0xbb43('0x41')]:_0x2d1b62[_0xbb43('0x40')];if(!_0x17d7c4['query'][_0xbb43('0x45')](_0xbb43('0x46'))){_0x48d864[_0xbb43('0x21')]=qs[_0xbb43('0x21')](_0x17d7c4[_0xbb43('0x3d')][_0xbb43('0x21')]);_0x48d864['offset']=qs['offset'](_0x17d7c4[_0xbb43('0x3d')][_0xbb43('0x20')]);}_0x48d864[_0xbb43('0x47')]=qs[_0xbb43('0x48')](_0x17d7c4[_0xbb43('0x3d')]['sort']);_0x48d864['where']=qs[_0xbb43('0x3f')](_[_0xbb43('0x4a')](_0x17d7c4[_0xbb43('0x3d')],_0x2d1b62['filters']));_0x48d864[_0xbb43('0x49')][_0xbb43('0xb9')]=_0x421626['id'];if(_0x17d7c4[_0xbb43('0x3d')]['filter']){_0x48d864[_0xbb43('0x49')]=_['merge'](_0x48d864[_0xbb43('0x49')],{'$or':_[_0xbb43('0x2b')](_0x48d864[_0xbb43('0x41')],function(_0x51fcf2){var _0x449d91={};_0x449d91[_0x51fcf2]={'$like':'%'+_0x17d7c4[_0xbb43('0x3d')][_0xbb43('0x86')]+'%'};return _0x449d91;})});}if(_0x17d7c4[_0xbb43('0x3d')][_0xbb43('0x7d')]){var _0x34e8b8=_0x17d7c4[_0xbb43('0x3d')][_0xbb43('0x7d')][_0xbb43('0x6a')](',');var _0x38f5a6={};_0x38f5a6[_0x34e8b8[0x0]]={'$gte':moment(_0x34e8b8[0x1])[_0xbb43('0xc8')](_0xbb43('0xc9'))};_0x48d864[_0xbb43('0x49')]=_[_0xbb43('0x9c')](_0x48d864['where'],_0x38f5a6);}_0x48d864=_[_0xbb43('0x9c')]({},_0x48d864,_0x17d7c4[_0xbb43('0xc0')]);return db[_0xbb43('0xc4')][_0xbb43('0x1f')]({'where':_0x48d864[_0xbb43('0x49')]})[_0xbb43('0x25')](function(_0x1091fa){_0xdc226f[_0xbb43('0x1f')]=_0x1091fa;if(_0x17d7c4[_0xbb43('0x3d')][_0xbb43('0xca')]){_0x48d864[_0xbb43('0xbf')]=[{'all':!![]}];}return db[_0xbb43('0xc4')][_0xbb43('0xcb')](_0x48d864);})[_0xbb43('0x25')](function(_0x199b58){if(_0x17d7c4[_0xbb43('0x3d')][_0xbb43('0xcc')]==='true'){for(var _0x3034fa=0x0;_0x3034fa<_0x199b58['length'];_0x3034fa++){_0x199b58[_0x3034fa]['body']=juice(_0x199b58[_0x3034fa][_0xbb43('0xc2')]);}}_0xdc226f[_0xbb43('0xbc')]=_0x199b58;return _0xdc226f;});}})['then'](respondWithFilteredResult(_0x524085,_0x48d864))['catch'](handleError(_0x524085,null));};exports[_0xbb43('0xcd')]=function(_0x5911fc,_0x4d22e9,_0x35c678){return db['MailInteraction'][_0xbb43('0x62')]({'where':{'id':_0x5911fc['params']['id']}})[_0xbb43('0x25')](handleEntityNotFound(_0x4d22e9,null))[_0xbb43('0x25')](function(_0x591ffe){if(_0x591ffe){return _0x591ffe[_0xbb43('0xce')](_0x5911fc[_0xbb43('0xc2')][_0xbb43('0xc5')],_[_0xbb43('0xc6')](_0x5911fc[_0xbb43('0xc2')],['ids','id'])||{})[_0xbb43('0xcf')](function(){return db[_0xbb43('0x6f')][_0xbb43('0xcb')]({'attributes':['id',_0xbb43('0x29'),_0xbb43('0xd0')],'where':{'id':_0x5911fc['body'][_0xbb43('0xc5')]}});})[_0xbb43('0x25')](function(_0x27c371){socket['emit']('mailInteractionTags:save',{'id':Number(_0x5911fc[_0xbb43('0xbe')]['id']),'tags':_0x27c371||[]});return{'id':Number(_0x5911fc[_0xbb43('0xbe')]['id']),'tags':_0x27c371||[]};});}})[_0xbb43('0x25')](respondWithResult(_0x4d22e9,null))['catch'](handleError(_0x4d22e9,null));};exports['removeTags']=function(_0x43d2da,_0x1ab4c4,_0x35f06d){return db[_0xbb43('0x31')][_0xbb43('0x62')]({'where':{'id':_0x43d2da['params']['id']}})[_0xbb43('0x25')](handleEntityNotFound(_0x1ab4c4,null))[_0xbb43('0x25')](function(_0x1b0194){if(_0x1b0194){return _0x1b0194[_0xbb43('0xd1')](_0x43d2da[_0xbb43('0x3d')][_0xbb43('0xc5')]);}})['then'](respondWithStatusCode(_0x1ab4c4,null))[_0xbb43('0x37')](handleError(_0x1ab4c4,null));};exports[_0xbb43('0xd2')]=function(_0x12f7a9,_0x5166b9){var _0x3a3990=moment()['unix']()[_0xbb43('0x9b')]();var _0x3653e3=path[_0xbb43('0xd3')](config[_0xbb43('0xd4')],'server',_0xbb43('0xd5'),'tmp');var _0x108ac8=path[_0xbb43('0xd3')](config[_0xbb43('0xd4')],_0xbb43('0xd6'),_0xbb43('0xd5'),'attachments');var _0x767db5=path[_0xbb43('0xd3')](_0x3653e3,_0x3a3990);var _0x9ef7dd=util[_0xbb43('0xc8')](_0xbb43('0xd7'),_0x12f7a9['params']['id'],_0x3a3990);var _0x1ba8b8=path[_0xbb43('0xd3')](_0x3653e3,_0x9ef7dd);var _0x39c8fd=[];if(_0x12f7a9['query'][_0xbb43('0xd8')]){_0x39c8fd['push']({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x585f71=[{'model':db[_0xbb43('0xc4')],'as':'Messages','attributes':['id',_0xbb43('0xc2'),_0xbb43('0x4c'),'to','cc',_0xbb43('0xd9'),_0xbb43('0xda'),'createdAt'],'where':{'secret':![]},'order':qs[_0xbb43('0x48')]('id'),'include':_0x39c8fd}];return db[_0xbb43('0x31')]['find']({'where':{'id':_0x12f7a9[_0xbb43('0xbe')]['id']},'include':_0x585f71})[_0xbb43('0x25')](handleEntityNotFound(_0x5166b9,null))['then'](function(_0x4df644){if(_0x4df644&&_0x4df644[_0xbb43('0xdb')]){var _0x249cf5=_0x4df644[_0xbb43('0xdc')]({'plain':!![]});fs['mkdirSync'](_0x767db5);return BPromise[_0xbb43('0xdd')](_0x249cf5['Messages'],function(_0x448d75,_0x33edab){var _0x44ddc0={'from':_0x448d75[_0xbb43('0x4c')],'to':_0x448d75['to'],'subject':_0x448d75['subject'],'html':_0x448d75[_0xbb43('0xc2')],'headers':{'Date':moment(_0x448d75[_0xbb43('0x7b')])[_0xbb43('0xc8')](_0xbb43('0xde'))},'attachments':[]};if(_0x448d75['cc']){_0x44ddc0[_0xbb43('0xdf')]['Cc']=_0x448d75['cc'];}if(_0x448d75['bcc']){_0x44ddc0[_0xbb43('0xdf')][_0xbb43('0xe0')]=_0x448d75['bcc'];}return new BPromise(function(_0x5a87b3,_0x1d5cff){if(_0x448d75['Attachments']){for(var _0x2e3dbb=0x0;_0x2e3dbb<_0x448d75[_0xbb43('0xe1')][_0xbb43('0x44')];_0x2e3dbb++){var _0x114e8c=_0x448d75[_0xbb43('0xe1')][_0x2e3dbb];var _0xacec65=path[_0xbb43('0xd3')](_0x108ac8,_0x114e8c[_0xbb43('0xe2')]);if(fs[_0xbb43('0xe3')](_0xacec65)){_0x44ddc0[_0xbb43('0xd8')]['push']({'name':_0x114e8c[_0xbb43('0x29')],'contentType':_0x114e8c[_0xbb43('0x3b')],'data':fs[_0xbb43('0xe4')](_0xacec65)});}}}emlformat['build'](_0x44ddc0,function(_0x341065,_0x36909d){if(_0x341065)return _0x1d5cff(_0x341065);fs[_0xbb43('0xe5')](path[_0xbb43('0xd3')](_0x767db5,util[_0xbb43('0xc8')]('message%d.eml',_0x33edab)),_0x36909d);return _0x5a87b3(_0x36909d);});});})[_0xbb43('0x25')](function(){return new BPromise(function(_0x5c32a0,_0x5d600f){zipdir(_0x767db5,{'saveTo':_0x1ba8b8},function(_0x48d9c4,_0x5ae452){if(_0x48d9c4)return _0x5d600f(_0x48d9c4);return _0x5c32a0(_0x5ae452);});})[_0xbb43('0x25')](function(){return new BPromise(function(_0x35b9c5,_0x2c2cd5){rimraf(_0x767db5,function(_0x45ff85){if(_0x45ff85)_0x2c2cd5(_0x45ff85);return _0x35b9c5();});});})[_0xbb43('0x25')](function(){return _0x5166b9[_0xbb43('0xd2')](_0x1ba8b8,_0x9ef7dd,function(_0x108e6d){if(_0x108e6d){console['log'](_0xbb43('0xe6'),_0x108e6d);}else{fs[_0xbb43('0xe7')](_0x1ba8b8);}});});});}else{return _0x5166b9[_0xbb43('0xe8')](0xc8);}})[_0xbb43('0x37')](handleError(_0x5166b9,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 6d1b388..989853a 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 _0xf1ba=['emit','catch','hasOwnProperty','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','map','length'];(function(_0x2ca031,_0x2bad48){var _0x5d7c65=function(_0x521b68){while(--_0x521b68){_0x2ca031['push'](_0x2ca031['shift']());}};_0x5d7c65(++_0x2bad48);}(_0xf1ba,0x1e4));var _0xaf1b=function(_0x4846e2,_0x11b82d){_0x4846e2=_0x4846e2-0x0;var _0x11ce03=_0xf1ba[_0x4846e2];return _0x11ce03;};'use strict';var EventEmitter=require(_0xaf1b('0x0'));var MailInteraction=require(_0xaf1b('0x1'))['db'][_0xaf1b('0x2')];var MailMessage=require(_0xaf1b('0x1'))['db'][_0xaf1b('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xaf1b('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaf1b('0x5'),'afterDestroy':_0xaf1b('0x6')};function emitEvent(_0xf845a3){return function(_0x232bc7,_0x50a123,_0x484224){_0x232bc7[_0xaf1b('0x7')]({'attributes':['id'],'raw':!![]})[_0xaf1b('0x8')](function(_0x722a2b){_0x232bc7[_0xaf1b('0x9')]('Users',_0x722a2b[_0xaf1b('0xa')](function(_0x54a956){return{'id':_0x54a956['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x232bc7['id'],'direction':'in','read':![]},'raw':!![]});})[_0xaf1b('0x8')](function(_0xfc2a70){_0x232bc7['setDataValue']('unreadMessages',_0xfc2a70[_0xaf1b('0xb')]);MailInteractionEvents[_0xaf1b('0xc')](_0xf845a3+':'+_0x232bc7['id'],_0x232bc7);MailInteractionEvents['emit'](_0xf845a3,_0x232bc7);_0x484224(null);})[_0xaf1b('0xd')](_0x484224(null));};}for(var e in events){if(events[_0xaf1b('0xe')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xaf1b('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0xd05c=['hook','events','MailInteraction','../../mysqldb','setMaxListeners','save','remove','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x39880f,_0xe47643){var _0x33cdf7=function(_0x4deae7){while(--_0x4deae7){_0x39880f['push'](_0x39880f['shift']());}};_0x33cdf7(++_0xe47643);}(_0xd05c,0x1bb));var _0xcd05=function(_0x227c08,_0x2e1f5b){_0x227c08=_0x227c08-0x0;var _0x245253=_0xd05c[_0x227c08];return _0x245253;};'use strict';var EventEmitter=require(_0xcd05('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xcd05('0x1')];var MailMessage=require(_0xcd05('0x2'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xcd05('0x3')](0x0);var events={'afterCreate':_0xcd05('0x4'),'afterUpdate':'update','afterDestroy':_0xcd05('0x5')};function emitEvent(_0x12da15){return function(_0x1a215b,_0x140fa1,_0x501cd2){_0x1a215b['getUsers']({'attributes':['id'],'raw':!![]})[_0xcd05('0x6')](function(_0x3dc7de){_0x1a215b['setDataValue'](_0xcd05('0x7'),_0x3dc7de[_0xcd05('0x8')](function(_0x416d57){return{'id':_0x416d57['id']};}));return MailMessage[_0xcd05('0x9')]({'where':{'MailInteractionId':_0x1a215b['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcd05('0x6')](function(_0x520cba){_0x1a215b[_0xcd05('0xa')](_0xcd05('0xb'),_0x520cba[_0xcd05('0xc')]);MailInteractionEvents['emit'](_0x12da15+':'+_0x1a215b['id'],_0x1a215b);MailInteractionEvents[_0xcd05('0xd')](_0x12da15,_0x1a215b);_0x501cd2(null);})[_0xcd05('0xe')](_0x501cd2(null));};}for(var e in events){if(events[_0xcd05('0xf')](e)){var event=events[e];MailInteraction[_0xcd05('0x10')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index ce90d80..538720b 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 _0xdba8=['substatusAt','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','format','closed','models','get','MailMessage','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','subject','substatus'];(function(_0x4467d8,_0x545589){var _0xd70731=function(_0x6cbc4e){while(--_0x6cbc4e){_0x4467d8['push'](_0x4467d8['shift']());}};_0xd70731(++_0x545589);}(_0xdba8,0x179));var _0x8dba=function(_0x8074df,_0x599977){_0x8074df=_0x8074df-0x0;var _0x154e88=_0xdba8[_0x8074df];return _0x154e88;};'use strict';var _=require(_0x8dba('0x0'));var util=require(_0x8dba('0x1'));var logger=require(_0x8dba('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8dba('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8dba('0x4'));var rimraf=require(_0x8dba('0x5'));var config=require('../../config/environment');var attributes=require(_0x8dba('0x6'));module[_0x8dba('0x7')]=function(_0x1cfbbd,_0x3abfc0){return _0x1cfbbd[_0x8dba('0x8')](_0x8dba('0x9'),attributes,{'tableName':_0x8dba('0xa'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x8dba('0xb'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x47d8c2,_0x19d83a,_0x52f15a){if(_0x47d8c2[_0x8dba('0xc')]){_0x47d8c2[_0x8dba('0xd')]=moment()['format'](_0x8dba('0xe'));}if(_0x47d8c2['closed']){_0x47d8c2[_0x8dba('0xf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x52f15a(null,_0x19d83a);},'beforeUpdate':function(_0x352a8e,_0x406c2e,_0x49a991){if(_0x352a8e[_0x8dba('0x10')]('substatus')){_0x352a8e[_0x8dba('0xd')]=_0x352a8e[_0x8dba('0xc')]?moment()[_0x8dba('0x11')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x352a8e[_0x8dba('0x10')](_0x8dba('0x12'))){_0x352a8e['closedAt']=moment()[_0x8dba('0x11')](_0x8dba('0xe'));_0x352a8e[_0x8dba('0xc')]=null;_0x352a8e['substatusAt']=null;}_0x49a991(null,_0x352a8e);},'afterUpdate':function(_0x3ceaff,_0x39256c,_0x28ee69){var _0x3090f8=_0x1cfbbd[_0x8dba('0x13')];var _0xeecd9b=_0x3ceaff[_0x8dba('0x14')]({'plain':!![]});if(_0xeecd9b['closed']){return _0x3090f8[_0x8dba('0x15')][_0x8dba('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0xeecd9b['id']}})['then'](function(){_0x28ee69();})[_0x8dba('0x17')](function(_0x3bbc0a){_0x28ee69(_0x3bbc0a);});}else{_0x28ee69();}}},'charset':_0x8dba('0x18'),'collate':_0x8dba('0x19')});}; \ No newline at end of file +var _0x36f1=['substatusAt','models','get','MailMessage','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','FULLTEXT','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','substatus','closedAt'];(function(_0x2d37fb,_0x3c31d2){var _0x120c59=function(_0x5d04a0){while(--_0x5d04a0){_0x2d37fb['push'](_0x2d37fb['shift']());}};_0x120c59(++_0x3c31d2);}(_0x36f1,0xb0));var _0x136f=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x36f1[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x136f('0x0'));var util=require('util');var logger=require(_0x136f('0x1'))('api');var moment=require(_0x136f('0x2'));var BPromise=require(_0x136f('0x3'));var rp=require(_0x136f('0x4'));var fs=require('fs');var path=require(_0x136f('0x5'));var rimraf=require(_0x136f('0x6'));var config=require(_0x136f('0x7'));var attributes=require(_0x136f('0x8'));module[_0x136f('0x9')]=function(_0x5b00b5,_0x430433){return _0x5b00b5['define'](_0x136f('0xa'),attributes,{'tableName':_0x136f('0xb'),'paranoid':![],'indexes':[{'name':_0x136f('0xc'),'fields':['subject','to'],'type':_0x136f('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1a131b,_0x51d57,_0x7b0a5b){if(_0x1a131b['substatus']){_0x1a131b['substatusAt']=moment()[_0x136f('0xe')](_0x136f('0xf'));}if(_0x1a131b[_0x136f('0x10')]){_0x1a131b['closedAt']=moment()['format'](_0x136f('0xf'));}_0x7b0a5b(null,_0x51d57);},'beforeUpdate':function(_0x134404,_0x16add0,_0x227d03){if(_0x134404[_0x136f('0x11')]('substatus')){_0x134404['substatusAt']=_0x134404[_0x136f('0x12')]?moment()[_0x136f('0xe')](_0x136f('0xf')):null;}if(_0x134404['changed'](_0x136f('0x10'))){_0x134404[_0x136f('0x13')]=moment()[_0x136f('0xe')](_0x136f('0xf'));_0x134404[_0x136f('0x12')]=null;_0x134404[_0x136f('0x14')]=null;}_0x227d03(null,_0x134404);},'afterUpdate':function(_0x3a4a84,_0x39d1f8,_0x502721){var _0x16d69a=_0x5b00b5[_0x136f('0x15')];var _0x66cee=_0x3a4a84[_0x136f('0x16')]({'plain':!![]});if(_0x66cee[_0x136f('0x10')]){return _0x16d69a[_0x136f('0x17')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x66cee['id']}})[_0x136f('0x18')](function(){_0x502721();})[_0x136f('0x19')](function(_0x58ceb6){_0x502721(_0x58ceb6);});}else{_0x502721();}}},'charset':_0x136f('0x1a'),'collate':_0x136f('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 6cc595f..ef1c540 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 _0xc29b=['catch','MailInteraction','update','body','options','where','limit','UpdateMailInteraction','AddTagsToMailInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','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','message'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xc29b,0x12d));var _0xbc29=function(_0xe23b21,_0x50bad0){_0xe23b21=_0xe23b21-0x0;var _0x73943=_0xc29b[_0xe23b21];return _0x73943;};'use strict';var _=require(_0xbc29('0x0'));var util=require(_0xbc29('0x1'));var moment=require(_0xbc29('0x2'));var BPromise=require('bluebird');var rs=require(_0xbc29('0x3'));var fs=require('fs');var Redis=require(_0xbc29('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbc29('0x5'));var logger=require(_0xbc29('0x6'))(_0xbc29('0x7'));var config=require(_0xbc29('0x8'));var jayson=require(_0xbc29('0x9'));var client=jayson[_0xbc29('0xa')][_0xbc29('0xb')]({'port':0x232a});config[_0xbc29('0xc')]=_[_0xbc29('0xd')](config[_0xbc29('0xc')],{'host':_0xbc29('0xe'),'port':0x18eb});var socket=require(_0xbc29('0xf'))(new Redis(config[_0xbc29('0xc')]));require(_0xbc29('0x10'))[_0xbc29('0x11')](socket);function respondWithRpcPromise(_0x36d1e3,_0x13a581,_0x2f591c){return new BPromise(function(_0x35ece9,_0x2710ad){return client['request'](_0x36d1e3,_0x2f591c)[_0xbc29('0x12')](function(_0x888953){logger[_0xbc29('0x13')](_0xbc29('0x14'),_0x13a581,_0xbc29('0x15'));logger[_0xbc29('0x16')](_0xbc29('0x17'),_0x13a581,'request\x20sent',JSON[_0xbc29('0x18')](_0x888953));if(_0x888953[_0xbc29('0x19')]){if(_0x888953[_0xbc29('0x19')]['code']===0x1f4){logger['error'](_0xbc29('0x14'),_0x13a581,_0x888953['error'][_0xbc29('0x1a')]);return _0x2710ad(_0x888953[_0xbc29('0x19')][_0xbc29('0x1a')]);}logger['error'](_0xbc29('0x14'),_0x13a581,_0x888953['error'][_0xbc29('0x1a')]);return _0x35ece9(_0x888953[_0xbc29('0x19')][_0xbc29('0x1a')]);}else{logger[_0xbc29('0x13')](_0xbc29('0x14'),_0x13a581,_0xbc29('0x15'));_0x35ece9(_0x888953['result'][_0xbc29('0x1a')]);}})[_0xbc29('0x1b')](function(_0x4eadbe){logger['error'](_0xbc29('0x14'),_0x13a581,_0x4eadbe);_0x2710ad(_0x4eadbe);});});}exports['UpdateMailInteraction']=function(_0x5b5bed){var _0x39336e=this;return new Promise(function(_0x1e9f7b,_0x1912ea){return db[_0xbc29('0x1c')][_0xbc29('0x1d')](_0x5b5bed[_0xbc29('0x1e')],{'raw':_0x5b5bed[_0xbc29('0x1f')]?_0x5b5bed[_0xbc29('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b5bed[_0xbc29('0x1f')]?_0x5b5bed[_0xbc29('0x1f')][_0xbc29('0x20')]||null:null,'attributes':_0x5b5bed[_0xbc29('0x1f')]?_0x5b5bed[_0xbc29('0x1f')]['attributes']||null:null,'limit':_0x5b5bed[_0xbc29('0x1f')]?_0x5b5bed[_0xbc29('0x1f')][_0xbc29('0x21')]||null:null})[_0xbc29('0x12')](function(_0x56b31a){logger[_0xbc29('0x13')](_0xbc29('0x22'),_0x5b5bed);logger['debug'](_0xbc29('0x22'),_0x5b5bed,JSON[_0xbc29('0x18')](_0x56b31a));_0x1e9f7b(_0x56b31a);})['catch'](function(_0x4983b5){logger[_0xbc29('0x19')]('UpdateMailInteraction',_0x4983b5['message'],_0x5b5bed);_0x1912ea(_0x39336e[_0xbc29('0x19')](0x1f4,_0x4983b5[_0xbc29('0x1a')]));});});};exports[_0xbc29('0x23')]=function(_0x5ba311){return new Promise(function(_0x2840ca,_0x3febdf){return db[_0xbc29('0x1c')][_0xbc29('0x24')]({'where':_0x5ba311[_0xbc29('0x1f')]?_0x5ba311['options']['where']||null:null})[_0xbc29('0x12')](function(_0x134e6a){if(_0x134e6a){return _0x134e6a['addTags'](_0x5ba311[_0xbc29('0x1e')][_0xbc29('0x25')],_[_0xbc29('0x26')](_0x5ba311[_0xbc29('0x1e')],[_0xbc29('0x25'),'id'])||{});}})[_0xbc29('0x27')](function(_0x57c59a){logger[_0xbc29('0x13')](_0xbc29('0x28'),_0x5ba311);logger[_0xbc29('0x16')](_0xbc29('0x28'),_0x5ba311,JSON['stringify'](_0x57c59a));_0x2840ca(_0x57c59a);})[_0xbc29('0x1b')](function(_0x128ebb){logger[_0xbc29('0x19')]('AddTags',_0x128ebb['message'],_0x5ba311);_0x3febdf(_this[_0xbc29('0x19')](0x1f4,_0x128ebb[_0xbc29('0x1a')]));});});}; \ No newline at end of file +var _0xd71d=['body','options','raw','limit','stringify','AddTagsToMailInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','MailInteraction','update'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0xd71d,0x1a5));var _0xdd71=function(_0xa3463d,_0x32f8da){_0xa3463d=_0xa3463d-0x0;var _0x50fd67=_0xd71d[_0xa3463d];return _0x50fd67;};'use strict';var _=require(_0xdd71('0x0'));var util=require(_0xdd71('0x1'));var moment=require(_0xdd71('0x2'));var BPromise=require(_0xdd71('0x3'));var rs=require(_0xdd71('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd71('0x5'))['db'];var utils=require(_0xdd71('0x6'));var logger=require(_0xdd71('0x7'))('rpc');var config=require(_0xdd71('0x8'));var jayson=require(_0xdd71('0x9'));var client=jayson[_0xdd71('0xa')]['http']({'port':0x232a});config[_0xdd71('0xb')]=_[_0xdd71('0xc')](config[_0xdd71('0xb')],{'host':_0xdd71('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdd71('0xb')]));require(_0xdd71('0xe'))[_0xdd71('0xf')](socket);function respondWithRpcPromise(_0x42a51f,_0x1163dc,_0x5df09b){return new BPromise(function(_0x17cd75,_0x15d56b){return client[_0xdd71('0x10')](_0x42a51f,_0x5df09b)[_0xdd71('0x11')](function(_0x48bd45){logger[_0xdd71('0x12')](_0xdd71('0x13'),_0x1163dc,_0xdd71('0x14'));logger[_0xdd71('0x15')](_0xdd71('0x16'),_0x1163dc,_0xdd71('0x14'),JSON['stringify'](_0x48bd45));if(_0x48bd45[_0xdd71('0x17')]){if(_0x48bd45[_0xdd71('0x17')][_0xdd71('0x18')]===0x1f4){logger[_0xdd71('0x17')]('MailInteraction,\x20%s,\x20%s',_0x1163dc,_0x48bd45[_0xdd71('0x17')][_0xdd71('0x19')]);return _0x15d56b(_0x48bd45[_0xdd71('0x17')][_0xdd71('0x19')]);}logger[_0xdd71('0x17')](_0xdd71('0x13'),_0x1163dc,_0x48bd45[_0xdd71('0x17')][_0xdd71('0x19')]);return _0x17cd75(_0x48bd45[_0xdd71('0x17')][_0xdd71('0x19')]);}else{logger[_0xdd71('0x12')]('MailInteraction,\x20%s,\x20%s',_0x1163dc,'request\x20sent');_0x17cd75(_0x48bd45[_0xdd71('0x1a')][_0xdd71('0x19')]);}})[_0xdd71('0x1b')](function(_0x2a7d0b){logger[_0xdd71('0x17')](_0xdd71('0x13'),_0x1163dc,_0x2a7d0b);_0x15d56b(_0x2a7d0b);});});}exports['UpdateMailInteraction']=function(_0x3243ef){var _0x199e70=this;return new Promise(function(_0x1959ca,_0x3635fc){return db[_0xdd71('0x1c')][_0xdd71('0x1d')](_0x3243ef[_0xdd71('0x1e')],{'raw':_0x3243ef[_0xdd71('0x1f')]?_0x3243ef[_0xdd71('0x1f')][_0xdd71('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3243ef[_0xdd71('0x1f')]?_0x3243ef[_0xdd71('0x1f')]['where']||null:null,'attributes':_0x3243ef[_0xdd71('0x1f')]?_0x3243ef[_0xdd71('0x1f')]['attributes']||null:null,'limit':_0x3243ef[_0xdd71('0x1f')]?_0x3243ef['options'][_0xdd71('0x21')]||null:null})['then'](function(_0x4a5690){logger['info']('UpdateMailInteraction',_0x3243ef);logger[_0xdd71('0x15')]('UpdateMailInteraction',_0x3243ef,JSON[_0xdd71('0x22')](_0x4a5690));_0x1959ca(_0x4a5690);})[_0xdd71('0x1b')](function(_0xd8739d){logger[_0xdd71('0x17')]('UpdateMailInteraction',_0xd8739d['message'],_0x3243ef);_0x3635fc(_0x199e70[_0xdd71('0x17')](0x1f4,_0xd8739d[_0xdd71('0x19')]));});});};exports[_0xdd71('0x23')]=function(_0x5a240e){return new Promise(function(_0x4432af,_0x3a57fc){return db[_0xdd71('0x1c')]['find']({'where':_0x5a240e[_0xdd71('0x1f')]?_0x5a240e['options']['where']||null:null})[_0xdd71('0x11')](function(_0x43588c){if(_0x43588c){return _0x43588c[_0xdd71('0x24')](_0x5a240e[_0xdd71('0x1e')][_0xdd71('0x25')],_[_0xdd71('0x26')](_0x5a240e[_0xdd71('0x1e')],[_0xdd71('0x25'),'id'])||{});}})[_0xdd71('0x27')](function(_0x58fc27){logger[_0xdd71('0x12')](_0xdd71('0x28'),_0x5a240e);logger[_0xdd71('0x15')](_0xdd71('0x28'),_0x5a240e,JSON['stringify'](_0x58fc27));_0x4432af(_0x58fc27);})[_0xdd71('0x1b')](function(_0x4b8292){logger['error'](_0xdd71('0x28'),_0x4b8292[_0xdd71('0x19')],_0x5a240e);_0x3a57fc(_this[_0xdd71('0x17')](0x1f4,_0x4b8292['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 1707b18..0e2d8c2 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 _0x09c2=['./mailInteraction.events','save','remove','update','emit','removeListener','register','length'];(function(_0x6b329,_0x4f90dc){var _0x5e6570=function(_0x521d8c){while(--_0x521d8c){_0x6b329['push'](_0x6b329['shift']());}};_0x5e6570(++_0x4f90dc);}(_0x09c2,0x120));var _0x209c=function(_0x4bf0bc,_0x2c6490){_0x4bf0bc=_0x4bf0bc-0x0;var _0x223837=_0x09c2[_0x4bf0bc];return _0x223837;};'use strict';var MailInteractionEvents=require(_0x209c('0x0'));var events=[_0x209c('0x1'),_0x209c('0x2'),_0x209c('0x3')];function createListener(_0x1f2f5b,_0x209128){return function(_0x96abd8){_0x209128[_0x209c('0x4')](_0x1f2f5b,_0x96abd8);};}function removeListener(_0x55fb4f,_0x13c351){return function(){MailInteractionEvents[_0x209c('0x5')](_0x55fb4f,_0x13c351);};}exports[_0x209c('0x6')]=function(_0x4653d9){for(var _0x3694b1=0x0,_0x9883f=events[_0x209c('0x7')];_0x3694b1<_0x9883f;_0x3694b1++){var _0x1f2694=events[_0x3694b1];var _0x59e5e5=createListener('mailInteraction:'+_0x1f2694,_0x4653d9);MailInteractionEvents['on'](_0x1f2694,_0x59e5e5);}}; \ No newline at end of file +var _0x993e=['remove','update','length','./mailInteraction.events'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x993e,0x147));var _0xe993=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x993e[_0xa464c9];return _0x3d73c4;};'use strict';var MailInteractionEvents=require(_0xe993('0x0'));var events=['save',_0xe993('0x1'),_0xe993('0x2')];function createListener(_0x572907,_0x2757a8){return function(_0x487ba2){_0x2757a8['emit'](_0x572907,_0x487ba2);};}function removeListener(_0xb36585,_0x5e466c){return function(){MailInteractionEvents['removeListener'](_0xb36585,_0x5e466c);};}exports['register']=function(_0x1f00fe){for(var _0x16fec1=0x0,_0x17986a=events[_0xe993('0x3')];_0x16fec1<_0x17986a;_0x16fec1++){var _0x134af6=events[_0x16fec1];var _0x563428=createListener('mailInteraction:'+_0x134af6,_0x1f00fe);MailInteractionEvents['on'](_0x134af6,_0x563428);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 677de6d..0291059 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 _0xd5c2=['/:id','put','/:id/accept','accept','reject','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','index','/describe','isAuthenticated','show','download','post','tracked','mail'];(function(_0x2687ad,_0x38673e){var _0x429723=function(_0x2eacf7){while(--_0x2eacf7){_0x2687ad['push'](_0x2687ad['shift']());}};_0x429723(++_0x38673e);}(_0xd5c2,0x17e));var _0x2d5c=function(_0x443736,_0x2a7ae3){_0x443736=_0x443736-0x0;var _0x36b0b1=_0xd5c2[_0x443736];return _0x36b0b1;};'use strict';var multer=require('multer');var util=require(_0x2d5c('0x0'));var path=require(_0x2d5c('0x1'));var timeout=require(_0x2d5c('0x2'));var express=require(_0x2d5c('0x3'));var router=express[_0x2d5c('0x4')]();var fs_extra=require(_0x2d5c('0x5'));var auth=require(_0x2d5c('0x6'));var interaction=require(_0x2d5c('0x7'));var config=require('../../config/environment');var controller=require(_0x2d5c('0x8'));router[_0x2d5c('0x9')]('/',auth['isAuthenticated'](),controller[_0x2d5c('0xa')]);router[_0x2d5c('0x9')](_0x2d5c('0xb'),auth[_0x2d5c('0xc')](),controller['describe']);router[_0x2d5c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x2d5c('0xd')]);router[_0x2d5c('0x9')]('/:id/download',auth[_0x2d5c('0xc')](),controller[_0x2d5c('0xe')]);router[_0x2d5c('0xf')]('/',auth[_0x2d5c('0xc')](),interaction[_0x2d5c('0x10')](_0x2d5c('0x11'),'mailmessage:create'),controller['create']);router['put'](_0x2d5c('0x12'),auth[_0x2d5c('0xc')](),controller['update']);router[_0x2d5c('0x13')](_0x2d5c('0x14'),auth['isAuthenticated'](),controller[_0x2d5c('0x15')]);router[_0x2d5c('0x13')]('/:id/reject',auth[_0x2d5c('0xc')](),controller[_0x2d5c('0x16')]);router['delete'](_0x2d5c('0x12'),auth[_0x2d5c('0xc')](),controller[_0x2d5c('0x17')]);module[_0x2d5c('0x18')]=router; \ No newline at end of file +var _0xbca1=['util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','describe','show','/:id/download','post','tracked','mail','mailmessage:create','create','put','/:id','update','/:id/accept','accept','/:id/reject','delete','destroy','multer'];(function(_0x470f2c,_0x53c93d){var _0x47162d=function(_0x258ded){while(--_0x258ded){_0x470f2c['push'](_0x470f2c['shift']());}};_0x47162d(++_0x53c93d);}(_0xbca1,0xbc));var _0x1bca=function(_0x49510c,_0x4f9d22){_0x49510c=_0x49510c-0x0;var _0x484982=_0xbca1[_0x49510c];return _0x484982;};'use strict';var multer=require(_0x1bca('0x0'));var util=require(_0x1bca('0x1'));var path=require(_0x1bca('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1bca('0x3')]();var fs_extra=require(_0x1bca('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1bca('0x5'));var config=require(_0x1bca('0x6'));var controller=require(_0x1bca('0x7'));router[_0x1bca('0x8')]('/',auth[_0x1bca('0x9')](),controller[_0x1bca('0xa')]);router[_0x1bca('0x8')]('/describe',auth[_0x1bca('0x9')](),controller[_0x1bca('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x1bca('0xc')]);router['get'](_0x1bca('0xd'),auth[_0x1bca('0x9')](),controller['download']);router[_0x1bca('0xe')]('/',auth[_0x1bca('0x9')](),interaction[_0x1bca('0xf')](_0x1bca('0x10'),_0x1bca('0x11')),controller[_0x1bca('0x12')]);router[_0x1bca('0x13')](_0x1bca('0x14'),auth[_0x1bca('0x9')](),controller[_0x1bca('0x15')]);router[_0x1bca('0x13')](_0x1bca('0x16'),auth[_0x1bca('0x9')](),controller[_0x1bca('0x17')]);router['put'](_0x1bca('0x18'),auth[_0x1bca('0x9')](),controller['reject']);router[_0x1bca('0x19')]('/:id',auth[_0x1bca('0x9')](),controller[_0x1bca('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 042657d..18a64c7 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 _0x8881=['sequelize','exports','TEXT','long','BOOLEAN','ENUM','out','DATE','INTEGER','Email','Chat'];(function(_0x5bcbac,_0xf7b1fe){var _0x4dc299=function(_0x53bfef){while(--_0x53bfef){_0x5bcbac['push'](_0x5bcbac['shift']());}};_0x4dc299(++_0xf7b1fe);}(_0x8881,0x1c3));var _0x1888=function(_0x10df1e,_0xf56f85){_0x10df1e=_0x10df1e-0x0;var _0x3e24fb=_0x8881[_0x10df1e];return _0x3e24fb;};'use strict';var Sequelize=require(_0x1888('0x0'));var _=require('lodash');module[_0x1888('0x1')]={'body':{'type':Sequelize[_0x1888('0x2')](_0x1888('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium')},'read':{'type':Sequelize[_0x1888('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1888('0x5')]('in',_0x1888('0x6')),'defaultValue':_0x1888('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x1888('0x2')]('long')},'cc':{'type':Sequelize['TEXT'](_0x1888('0x3'))},'bcc':{'type':Sequelize[_0x1888('0x2')]('long')},'subject':{'type':Sequelize[_0x1888('0x2')]},'sentAt':{'type':Sequelize[_0x1888('0x7')]},'attach':{'type':Sequelize[_0x1888('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x1888('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x1888('0x7')]},'originTo':{'type':Sequelize[_0x1888('0x2')](_0x1888('0x3'))},'originCc':{'type':Sequelize['TEXT'](_0x1888('0x3'))},'originChannel':{'type':Sequelize[_0x1888('0x5')](_0x1888('0x9'),_0x1888('0xa')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0xa414=['long','medium','BOOLEAN','out','STRING','DATE','INTEGER','Email','sequelize','lodash','TEXT'];(function(_0x3e3cb5,_0x462726){var _0x40b63b=function(_0xd8bee5){while(--_0xd8bee5){_0x3e3cb5['push'](_0x3e3cb5['shift']());}};_0x40b63b(++_0x462726);}(_0xa414,0xd9));var _0x4a41=function(_0x4d8d59,_0x32fa9b){_0x4d8d59=_0x4d8d59-0x0;var _0x3217ff=_0xa414[_0x4d8d59];return _0x3217ff;};'use strict';var Sequelize=require(_0x4a41('0x0'));var _=require(_0x4a41('0x1'));module['exports']={'body':{'type':Sequelize[_0x4a41('0x2')](_0x4a41('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x4a41('0x2')](_0x4a41('0x4'))},'read':{'type':Sequelize[_0x4a41('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4a41('0x6')),'defaultValue':_0x4a41('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4a41('0x7')](0x1fe)},'from':{'type':Sequelize[_0x4a41('0x7')]},'to':{'type':Sequelize[_0x4a41('0x2')](_0x4a41('0x3'))},'cc':{'type':Sequelize[_0x4a41('0x2')](_0x4a41('0x3'))},'bcc':{'type':Sequelize[_0x4a41('0x2')](_0x4a41('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x4a41('0x8')]},'attach':{'type':Sequelize[_0x4a41('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x4a41('0x8')]},'originTo':{'type':Sequelize[_0x4a41('0x2')](_0x4a41('0x3'))},'originCc':{'type':Sequelize[_0x4a41('0x2')]('long')},'originChannel':{'type':Sequelize['ENUM']('Email','Chat'),'defaultValue':_0x4a41('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 945908d..c58e478 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 _0x2876=['attributes','fields','length','hasOwnProperty','limit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','body','destroy','describe','create','direction','split','findOne','MailAccountId','CmList','List','CmContact','updatedAt','DESC','Smtp','isNil','service','host','port','secure','pass','auth','user','attachments','join','basename','Contacts','ListId','List\x20not\x20found','sendMail','messageId','format','mail-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','find','Contact','MailInteraction','MailInteractionId','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','reject','mail','agent','RejectMessage','rejectMessage','rejectmessage','download','unix','toString','root','server','files','tmp','message-%s.eml','subject','createdAt','Attachment','Attachments','from','headers','bcc','Bcc','existsSync','readFileSync','build','writeFileSync','log','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','client','http','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','save','update','then','stack','name','send','MailMessage','rawAttributes','fieldName','type','key','model','map','query','filters','intersection'];(function(_0x186d5c,_0x517f35){var _0x431a16=function(_0x291263){while(--_0x291263){_0x186d5c['push'](_0x186d5c['shift']());}};_0x431a16(++_0x517f35);}(_0x2876,0x66));var _0x6287=function(_0x420f2a,_0x2cc58d){_0x420f2a=_0x420f2a-0x0;var _0x28f802=_0x2876[_0x420f2a];return _0x28f802;};'use strict';var pdf=require(_0x6287('0x0'));var emlformat=require(_0x6287('0x1'));var rimraf=require(_0x6287('0x2'));var zipdir=require(_0x6287('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6287('0x4'));var BPromise=require(_0x6287('0x5'));var Mustache=require(_0x6287('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6287('0x7'));var csv=require(_0x6287('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6287('0x9'));var squel=require(_0x6287('0xa'));var crypto=require(_0x6287('0xb'));var jsforce=require(_0x6287('0xc'));var deskjs=require(_0x6287('0xd'));var toCsv=require(_0x6287('0x8'));var querystring=require(_0x6287('0xe'));var Papa=require(_0x6287('0xf'));var Redis=require(_0x6287('0x10'));var authService=require(_0x6287('0x11'));var qs=require(_0x6287('0x12'));var as=require(_0x6287('0x13'));var hardwareService=require(_0x6287('0x14'));var logger=require(_0x6287('0x15'))(_0x6287('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x6287('0x17')]=_[_0x6287('0x18')](config[_0x6287('0x17')],{'host':_0x6287('0x19'),'port':0x18eb});var socket=require(_0x6287('0x1a'))(new Redis(config[_0x6287('0x17')]));require(_0x6287('0x1b'))[_0x6287('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9003=jayson[_0x6287('0x1d')][_0x6287('0x1e')]({'port':0x232b});var client9002=jayson['client'][_0x6287('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xe2fe49,_0x1f188d,_0x5da055,_0x3cfbca){return new BPromise(function(_0x49e02a,_0x12764d){var _0x2301f6=_0x3cfbca||client;return _0x2301f6['request'](_0xe2fe49,_0x5da055)['then'](function(_0x4e38b4){logger['info'](_0x6287('0x1f'),_0x1f188d,_0x6287('0x20'));logger[_0x6287('0x21')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x1f188d,_0x6287('0x20'),JSON[_0x6287('0x22')](_0x4e38b4));if(_0x4e38b4[_0x6287('0x23')]){if(_0x4e38b4[_0x6287('0x23')][_0x6287('0x24')]===0x1f4){logger[_0x6287('0x23')](_0x6287('0x1f'),_0x1f188d,_0x4e38b4[_0x6287('0x23')]['message']);return _0x12764d(_0x4e38b4[_0x6287('0x23')][_0x6287('0x25')]);}logger[_0x6287('0x23')](_0x6287('0x1f'),_0x1f188d,_0x4e38b4[_0x6287('0x23')][_0x6287('0x25')]);return _0x49e02a(_0x4e38b4['error']['message']);}else{logger[_0x6287('0x26')]('MailMessage,\x20%s,\x20%s',_0x1f188d,'request\x20sent');_0x49e02a(_0x4e38b4[_0x6287('0x27')]['message']);}})[_0x6287('0x28')](function(_0x106353){logger[_0x6287('0x23')](_0x6287('0x1f'),_0x1f188d,_0x106353);_0x12764d(_0x106353);});});}function respondWithStatusCode(_0x4d018b,_0x1f2fed){_0x1f2fed=_0x1f2fed||0xcc;return function(_0x3bc621){if(_0x3bc621){return _0x4d018b[_0x6287('0x29')](_0x1f2fed);}return _0x4d018b[_0x6287('0x2a')](_0x1f2fed)[_0x6287('0x2b')]();};}function respondWithResult(_0xc4b290,_0x1ce000){_0x1ce000=_0x1ce000||0xc8;return function(_0x48c003){if(_0x48c003){return _0xc4b290['status'](_0x1ce000)[_0x6287('0x2c')](_0x48c003);}};}function respondWithFilteredResult(_0x4e10c6,_0x34fa4e){return function(_0x34e910){if(_0x34e910){var _0x6e0f42=_0x34e910[_0x6287('0x2d')],_0xcdf95a=_0x34fa4e[_0x6287('0x2e')],_0x53ff9d=_0x34fa4e[_0x6287('0x2e')]+_0x34fa4e['limit'],_0x446ac2;if(_0x53ff9d>=_0x6e0f42){_0x53ff9d=_0x6e0f42;_0x446ac2=0xc8;}else{_0x446ac2=0xce;}_0x4e10c6[_0x6287('0x2a')](_0x446ac2);return _0x4e10c6[_0x6287('0x2f')](_0x6287('0x30'),_0xcdf95a+'-'+_0x53ff9d+'/'+_0x6e0f42)[_0x6287('0x2c')](_0x34e910);}return null;};}function patchUpdates(_0x40245e){return function(_0x31bf8d){try{jsonpatch['apply'](_0x31bf8d,_0x40245e,!![]);}catch(_0x3e495a){return BPromise['reject'](_0x3e495a);}return _0x31bf8d[_0x6287('0x31')]();};}function saveUpdates(_0x49b988,_0x13e611){return function(_0x371b15){if(_0x371b15){return _0x371b15[_0x6287('0x32')](_0x49b988)[_0x6287('0x33')](function(_0x7445a1){return _0x7445a1;});}return null;};}function removeEntity(_0x2dd4ac,_0x4f4a66){return function(_0x48004e){if(_0x48004e){return _0x48004e['destroy']()[_0x6287('0x33')](function(){_0x2dd4ac[_0x6287('0x2a')](0xcc)[_0x6287('0x2b')]();});}};}function handleEntityNotFound(_0x54265e,_0xb45eed){return function(_0x5022c0){if(!_0x5022c0){_0x54265e['sendStatus'](0x194);}return _0x5022c0;};}function handleError(_0x302351,_0x1ca052){_0x1ca052=_0x1ca052||0x1f4;return function(_0x580bf7){logger[_0x6287('0x23')](_0x580bf7[_0x6287('0x34')]);if(_0x580bf7[_0x6287('0x35')]){delete _0x580bf7[_0x6287('0x35')];}_0x302351[_0x6287('0x2a')](_0x1ca052)[_0x6287('0x36')](_0x580bf7);};}exports['index']=function(_0x465675,_0x2a546e){var _0x1910f1={},_0x30dfbc={},_0x2baa32={'count':0x0,'rows':[]};var _0x528727=_['map'](db[_0x6287('0x37')][_0x6287('0x38')],function(_0x37fa76){return{'name':_0x37fa76[_0x6287('0x39')],'type':_0x37fa76[_0x6287('0x3a')][_0x6287('0x3b')]};});_0x30dfbc[_0x6287('0x3c')]=_[_0x6287('0x3d')](_0x528727,_0x6287('0x35'));_0x30dfbc[_0x6287('0x3e')]=_['keys'](_0x465675[_0x6287('0x3e')]);_0x30dfbc[_0x6287('0x3f')]=_[_0x6287('0x40')](_0x30dfbc[_0x6287('0x3c')],_0x30dfbc[_0x6287('0x3e')]);_0x1910f1[_0x6287('0x41')]=_[_0x6287('0x40')](_0x30dfbc[_0x6287('0x3c')],qs[_0x6287('0x42')](_0x465675[_0x6287('0x3e')][_0x6287('0x42')]));_0x1910f1[_0x6287('0x41')]=_0x1910f1[_0x6287('0x41')][_0x6287('0x43')]?_0x1910f1[_0x6287('0x41')]:_0x30dfbc['model'];if(!_0x465675[_0x6287('0x3e')][_0x6287('0x44')]('nolimit')){_0x1910f1[_0x6287('0x45')]=qs[_0x6287('0x45')](_0x465675[_0x6287('0x3e')]['limit']);_0x1910f1[_0x6287('0x2e')]=qs['offset'](_0x465675[_0x6287('0x3e')][_0x6287('0x2e')]);}_0x1910f1[_0x6287('0x46')]=qs[_0x6287('0x47')](_0x465675['query'][_0x6287('0x47')]);_0x1910f1['where']=qs[_0x6287('0x3f')](_['pick'](_0x465675[_0x6287('0x3e')],_0x30dfbc[_0x6287('0x3f')]),_0x528727);if(_0x465675[_0x6287('0x3e')][_0x6287('0x48')]){_0x1910f1[_0x6287('0x49')]=_[_0x6287('0x4a')](_0x1910f1[_0x6287('0x49')],{'$or':_[_0x6287('0x3d')](_0x528727,function(_0x3e77cd){if(_0x3e77cd['type']!==_0x6287('0x4b')){var _0x599b02={};_0x599b02[_0x3e77cd[_0x6287('0x35')]]={'$like':'%'+_0x465675[_0x6287('0x3e')]['filter']+'%'};return _0x599b02;}})});}_0x1910f1=_['merge']({},_0x1910f1,_0x465675[_0x6287('0x4c')]);var _0x106987={'where':_0x1910f1[_0x6287('0x49')]};return db[_0x6287('0x37')][_0x6287('0x2d')](_0x106987)[_0x6287('0x33')](function(_0xf710bb){_0x2baa32['count']=_0xf710bb;if(_0x465675[_0x6287('0x3e')][_0x6287('0x4d')]){_0x1910f1[_0x6287('0x4e')]=[{'all':!![]}];}return db[_0x6287('0x37')][_0x6287('0x4f')](_0x1910f1);})[_0x6287('0x33')](function(_0x28acb5){_0x2baa32[_0x6287('0x50')]=_0x28acb5;return _0x2baa32;})[_0x6287('0x33')](respondWithFilteredResult(_0x2a546e,_0x1910f1))['catch'](handleError(_0x2a546e,null));};exports[_0x6287('0x51')]=function(_0x3fc0ca,_0x32ffd2){var _0x2bfbbe={'raw':!![],'where':{'id':_0x3fc0ca[_0x6287('0x52')]['id']}},_0x1938ff={};_0x1938ff[_0x6287('0x3c')]=_[_0x6287('0x53')](db[_0x6287('0x37')][_0x6287('0x38')]);_0x1938ff[_0x6287('0x3e')]=_['keys'](_0x3fc0ca[_0x6287('0x3e')]);_0x1938ff['filters']=_[_0x6287('0x40')](_0x1938ff[_0x6287('0x3c')],_0x1938ff[_0x6287('0x3e')]);_0x2bfbbe['attributes']=_[_0x6287('0x40')](_0x1938ff[_0x6287('0x3c')],qs[_0x6287('0x42')](_0x3fc0ca[_0x6287('0x3e')][_0x6287('0x42')]));_0x2bfbbe[_0x6287('0x41')]=_0x2bfbbe[_0x6287('0x41')][_0x6287('0x43')]?_0x2bfbbe['attributes']:_0x1938ff[_0x6287('0x3c')];if(_0x3fc0ca['query'][_0x6287('0x4d')]){_0x2bfbbe['include']=[{'all':!![]}];}_0x2bfbbe=_['merge']({},_0x2bfbbe,_0x3fc0ca[_0x6287('0x4c')]);return db[_0x6287('0x37')]['find'](_0x2bfbbe)[_0x6287('0x33')](handleEntityNotFound(_0x32ffd2,null))[_0x6287('0x33')](respondWithResult(_0x32ffd2,null))[_0x6287('0x28')](handleError(_0x32ffd2,null));};exports[_0x6287('0x32')]=function(_0x1fdfce,_0xa4e182){if(_0x1fdfce['body']['id']){delete _0x1fdfce['body']['id'];}return db['MailMessage']['find']({'where':{'id':_0x1fdfce[_0x6287('0x52')]['id']}})['then'](handleEntityNotFound(_0xa4e182,null))[_0x6287('0x33')](saveUpdates(_0x1fdfce[_0x6287('0x54')],null))[_0x6287('0x33')](respondWithResult(_0xa4e182,null))[_0x6287('0x28')](handleError(_0xa4e182,null));};exports[_0x6287('0x55')]=function(_0x2c64c0,_0x12a9fb){return db[_0x6287('0x37')]['find']({'where':{'id':_0x2c64c0[_0x6287('0x52')]['id']}})[_0x6287('0x33')](handleEntityNotFound(_0x12a9fb,null))[_0x6287('0x33')](removeEntity(_0x12a9fb,null))[_0x6287('0x28')](handleError(_0x12a9fb,null));};exports['describe']=function(_0x1d03d9,_0x8eb46){return db[_0x6287('0x37')][_0x6287('0x56')]()[_0x6287('0x33')](respondWithResult(_0x8eb46,null))[_0x6287('0x28')](handleError(_0x8eb46,null));};exports[_0x6287('0x57')]=function(_0x4d6566,_0x27d308){return db[_0x6287('0x37')]['create'](_0x4d6566[_0x6287('0x54')])[_0x6287('0x33')](function(_0x5cf5c9){if(_0x5cf5c9){if(_0x5cf5c9[_0x6287('0x58')]==='out'&&!_0x5cf5c9['secret']){var _0x4f65c4,_0x58d949,_0x5effa3;if(_0x4d6566['body']['to']){_0x58d949=_0x4d6566[_0x6287('0x54')]['to'][_0x6287('0x59')](',')[0x0];}return db['MailAccount'][_0x6287('0x5a')]({'where':{'id':_0x5cf5c9[_0x6287('0x5b')]},'include':[{'model':db[_0x6287('0x5c')],'as':_0x6287('0x5d'),'include':[{'model':db[_0x6287('0x5e')],'as':'Contacts','where':{'email':_0x58d949},'limit':0x1,'order':[[_0x6287('0x5f'),_0x6287('0x60')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0x6287('0x33')](function(_0x297cf6){_0x4f65c4=_0x297cf6;if(_0x4f65c4&&_0x4f65c4[_0x6287('0x61')]){var _0x2eaa57={'tls':{'rejectUnauthorized':![]}};if(_[_0x6287('0x62')](_0x4f65c4['Smtp'][_0x6287('0x63')])){_0x2eaa57[_0x6287('0x64')]=_0x4f65c4[_0x6287('0x61')]['host'];_0x2eaa57[_0x6287('0x65')]=_0x4f65c4[_0x6287('0x61')][_0x6287('0x65')];_0x2eaa57[_0x6287('0x66')]=_0x4f65c4[_0x6287('0x61')][_0x6287('0x66')];if(_0x4f65c4[_0x6287('0x61')]['authentication']){_0x2eaa57['auth']={'user':_0x4f65c4[_0x6287('0x61')]['user'],'pass':_0x4f65c4['Smtp'][_0x6287('0x67')]};}}else{_0x2eaa57[_0x6287('0x63')]=_0x4f65c4['Smtp'][_0x6287('0x63')];_0x2eaa57[_0x6287('0x68')]={'user':_0x4f65c4[_0x6287('0x61')][_0x6287('0x69')],'pass':_0x4f65c4[_0x6287('0x61')][_0x6287('0x67')]};_0x2eaa57[_0x6287('0x66')]=_0x4f65c4['Smtp'][_0x6287('0x66')];}if(_0x4d6566['body']['attachments']&&_0x4d6566[_0x6287('0x54')][_0x6287('0x6a')][_0x6287('0x43')]){for(var _0x15f15e=0x0;_0x15f15e<_0x4d6566[_0x6287('0x54')][_0x6287('0x6a')][_0x6287('0x43')];_0x15f15e+=0x1){_0x4d6566[_0x6287('0x54')][_0x6287('0x6a')][_0x15f15e]={'filename':_0x4d6566[_0x6287('0x54')]['attachments'][_0x15f15e][_0x6287('0x35')],'path':path[_0x6287('0x6b')](config['root'],'server/files/attachments',_0x4d6566[_0x6287('0x54')][_0x6287('0x6a')][_0x15f15e][_0x6287('0x6c')])};}}_0x5effa3={'account':_0x2eaa57,'message':_0x4d6566[_0x6287('0x54')]};return;}})[_0x6287('0x33')](function(){if(_0x4f65c4['List']){if(_0x4f65c4[_0x6287('0x5d')][_0x6287('0x6d')][_0x6287('0x43')]){return _0x4f65c4[_0x6287('0x5d')][_0x6287('0x6d')][0x0];}else{return db['CmContact'][_0x6287('0x57')](_[_0x6287('0x18')](_0x4d6566[_0x6287('0x54')],{'firstName':_0x4d6566[_0x6287('0x54')]['to'],'email':_0x4d6566[_0x6287('0x54')]['to'],'phone':_0x4d6566[_0x6287('0x54')]['to'],'ListId':_0x4f65c4[_0x6287('0x6e')]}));}}else{throw new Error(_0x6287('0x6f'));}})[_0x6287('0x33')](function(){if(_0x5effa3){return respondWithRpcPromise('SendMail',_0x6287('0x70'),_0x5effa3,client9003)[_0x6287('0x33')](function(_0x40b768){return _0x5cf5c9[_0x6287('0x32')]({'read':!![],'messageId':_0x40b768[_0x6287('0x71')],'sentAt':moment()[_0x6287('0x72')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x6287('0x28')](function(_0x467ae7){logger[_0x6287('0x23')]('%s',JSON[_0x6287('0x22')](_0x467ae7));return _0x5cf5c9;});}return _0x5cf5c9;});}return _0x5cf5c9;}})[_0x6287('0x33')](respondWithResult(_0x27d308,0xc9))[_0x6287('0x28')](handleError(_0x27d308,null));};var interaction_log=require(_0x6287('0x15'))(_0x6287('0x73'));exports[_0x6287('0x74')]=function(_0x2786e7,_0x19eeac,_0xeb4ef7){var _0x3764b2={'agent':{},'channel':'mail'};if(_0x2786e7[_0x6287('0x54')]['id']){delete _0x2786e7[_0x6287('0x54')]['id'];}_0x2786e7[_0x6287('0x54')][_0x6287('0x75')]=!![];_0x2786e7[_0x6287('0x54')][_0x6287('0x76')]=moment()[_0x6287('0x72')](_0x6287('0x77'));_0x2786e7[_0x6287('0x54')][_0x6287('0x78')]=_0x2786e7[_0x6287('0x54')][_0x6287('0x78')]||_0x2786e7['user']['id'];_0x3764b2['agent']['id']=_0x2786e7[_0x6287('0x54')][_0x6287('0x78')];return db[_0x6287('0x37')][_0x6287('0x79')]({'where':{'id':_0x2786e7[_0x6287('0x52')]['id'],'UserId':null},'include':[{'model':db[_0x6287('0x5e')],'as':_0x6287('0x7a')}]})[_0x6287('0x33')](handleEntityNotFound(_0x19eeac,null))[_0x6287('0x33')](saveUpdates(_0x2786e7[_0x6287('0x54')],null))[_0x6287('0x33')](function(_0x5023d1){if(_0x5023d1){_0x3764b2['message']=_0x5023d1['get']({'plain':!![]});return db[_0x6287('0x7b')][_0x6287('0x79')]({'where':{'id':_0x5023d1[_0x6287('0x7c')]}});}return null;})[_0x6287('0x33')](handleEntityNotFound(_0x19eeac,null))[_0x6287('0x33')](function(_0x281f00){if(_0x281f00){return _0x281f00[_0x6287('0x32')]({'UserId':_0x2786e7[_0x6287('0x54')][_0x6287('0x78')],'read1stAt':_[_0x6287('0x62')](_0x281f00[_0x6287('0x7d')])?moment()[_0x6287('0x72')](_0x6287('0x77')):undefined});}return null;})[_0x6287('0x33')](function(_0x31ce56){if(_0x31ce56){_0x3764b2[_0x6287('0x7e')]=_0x31ce56[_0x6287('0x7f')]({'plain':!![]});interaction_log[_0x6287('0x26')](_0x6287('0x80'),_0x2786e7[_0x6287('0x69')]['id'],_0x2786e7['user']['name'],_0x2786e7[_0x6287('0x69')][_0x6287('0x81')],_0x3764b2[_0x6287('0x7e')]['id'],_0x2786e7[_0x6287('0x54')]?JSON[_0x6287('0x22')](_0x2786e7[_0x6287('0x54')]):_0x6287('0x82'));return respondWithRpcPromise(_0x6287('0x83'),_0x6287('0x84'),_0x3764b2);}return null;})[_0x6287('0x33')](function(_0x2cda44){if(_0x2cda44){if(_0x2786e7[_0x6287('0x54')][_0x6287('0x85')]){_0x3764b2[_0x6287('0x25')][_0x6287('0x86')]=util[_0x6287('0x72')](_0x6287('0x87'),_0x2786e7[_0x6287('0x69')][_0x6287('0x35')]);_0x3764b2[_0x6287('0x25')][_0x6287('0x88')]=_0x3764b2[_0x6287('0x88')];_0x3764b2[_0x6287('0x25')][_0x6287('0x89')]=_0x6287('0x74');return respondWithRpcPromise(_0x6287('0x8a'),_0x6287('0x8a'),{'event':'acceptmessage','message':_0x3764b2[_0x6287('0x25')]},client9002)[_0x6287('0x33')](function(){return _0x3764b2;});}return _0x3764b2;}return null;})[_0x6287('0x33')](respondWithResult(_0x19eeac,null))[_0x6287('0x28')](handleError(_0x19eeac,null));};var interaction_log=require(_0x6287('0x15'))(_0x6287('0x73'));exports[_0x6287('0x8b')]=function(_0x4e3860,_0x1f9851,_0x388449){var _0x18e1ab={'agent':{},'channel':_0x6287('0x8c')};if(_0x4e3860[_0x6287('0x54')]['id']){delete _0x4e3860['body']['id'];}_0x4e3860[_0x6287('0x54')]['UserId']=_0x4e3860[_0x6287('0x54')][_0x6287('0x78')]||_0x4e3860['user']['id'];_0x18e1ab[_0x6287('0x8d')]['id']=_0x4e3860[_0x6287('0x54')][_0x6287('0x78')];return db[_0x6287('0x37')]['find']({'where':{'id':_0x4e3860[_0x6287('0x52')]['id'],'UserId':null}})[_0x6287('0x33')](handleEntityNotFound(_0x1f9851,null))[_0x6287('0x33')](function(_0x4f230a){if(_0x4f230a){_0x18e1ab[_0x6287('0x25')]=_0x4f230a[_0x6287('0x7f')]({'plain':!![]});return db['MailInteraction'][_0x6287('0x79')]({'where':{'id':_0x4f230a[_0x6287('0x7c')]}});}return null;})[_0x6287('0x33')](handleEntityNotFound(_0x1f9851,null))[_0x6287('0x33')](function(_0x2b9eb5){if(_0x2b9eb5){_0x18e1ab[_0x6287('0x7e')]=_0x2b9eb5['get']({'plain':!![]});interaction_log[_0x6287('0x26')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4e3860[_0x6287('0x69')]['id'],_0x4e3860['user'][_0x6287('0x35')],_0x4e3860['user'][_0x6287('0x81')],_0x18e1ab[_0x6287('0x7e')]['id'],_0x4e3860[_0x6287('0x54')]?JSON['stringify'](_0x4e3860[_0x6287('0x54')]):_0x6287('0x82'));return respondWithRpcPromise(_0x6287('0x8e'),_0x6287('0x8f'),_0x18e1ab);}return null;})[_0x6287('0x33')](function(_0x2e6b33){if(_0x2e6b33){_0x2e6b33['message'][_0x6287('0x86')]=util[_0x6287('0x72')](_0x6287('0x87'),_0x4e3860['user']['name']);_0x2e6b33['message']['channel']=_0x18e1ab[_0x6287('0x88')];_0x2e6b33[_0x6287('0x25')][_0x6287('0x89')]='reject';respondWithRpcPromise(_0x6287('0x8a'),'EventManager',{'event':_0x6287('0x90'),'message':_0x2e6b33[_0x6287('0x25')]},client9002);return _0x18e1ab;}return null;})[_0x6287('0x33')](respondWithResult(_0x1f9851,null))[_0x6287('0x28')](handleError(_0x1f9851,null));};exports[_0x6287('0x91')]=function(_0x58e8d5,_0x5a18a5){var _0x4d1546=moment()[_0x6287('0x92')]()[_0x6287('0x93')]();var _0x40beb1=path[_0x6287('0x6b')](config[_0x6287('0x94')],_0x6287('0x95'),_0x6287('0x96'),_0x6287('0x97'));var _0x1ccc8c=path[_0x6287('0x6b')](config[_0x6287('0x94')],_0x6287('0x95'),'files','attachments');var _0x11b457=util['format'](_0x6287('0x98'),_0x4d1546);return db[_0x6287('0x37')][_0x6287('0x79')]({'where':{'id':_0x58e8d5['params']['id']},'attributes':['id','body','from','to','cc','bcc',_0x6287('0x99'),_0x6287('0x9a')],'include':_0x58e8d5[_0x6287('0x3e')][_0x6287('0x6a')]?[{'model':db[_0x6287('0x9b')],'as':_0x6287('0x9c')}]:undefined})[_0x6287('0x33')](handleEntityNotFound(_0x5a18a5,null))[_0x6287('0x33')](function(_0x10f6ea){if(_0x10f6ea){var _0x422b2f=_0x10f6ea;var _0x32fead={'from':_0x422b2f[_0x6287('0x9d')],'to':_0x422b2f['to'],'subject':_0x422b2f[_0x6287('0x99')],'html':_0x422b2f[_0x6287('0x54')],'headers':{'Date':moment(_0x422b2f[_0x6287('0x9a')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x10f6ea['cc']){_0x32fead[_0x6287('0x9e')]['Cc']=_0x10f6ea['cc'];}if(_0x10f6ea[_0x6287('0x9f')]){_0x32fead[_0x6287('0x9e')][_0x6287('0xa0')]=_0x10f6ea[_0x6287('0x9f')];}return new BPromise(function(_0x35490c,_0x16627d){if(_0x10f6ea[_0x6287('0x9c')]){for(var _0x1f8788=0x0;_0x1f8788<_0x10f6ea[_0x6287('0x9c')][_0x6287('0x43')];_0x1f8788++){var _0x31be6c=_0x10f6ea['Attachments'][_0x1f8788];var _0x1f649c=path['join'](_0x1ccc8c,_0x31be6c[_0x6287('0x6c')]);if(fs[_0x6287('0xa1')](_0x1f649c)){_0x32fead[_0x6287('0x6a')]['push']({'name':_0x31be6c[_0x6287('0x35')],'contentType':_0x31be6c[_0x6287('0x3a')],'data':fs[_0x6287('0xa2')](_0x1f649c)});}}}emlformat[_0x6287('0xa3')](_0x32fead,function(_0x1005a4,_0x5b66b6){if(_0x1005a4)return _0x16627d(_0x1005a4);fs[_0x6287('0xa4')](path['join'](_0x40beb1,_0x11b457),_0x5b66b6);return _0x35490c(_0x5b66b6);});});}})[_0x6287('0x33')](function(_0x181d25){if(_0x181d25){return _0x5a18a5['download'](path[_0x6287('0x6b')](_0x40beb1,_0x11b457),_0x11b457,function(_0x312a0d){if(_0x312a0d){console[_0x6287('0xa5')]('err',_0x312a0d);}else{fs[_0x6287('0xa6')](path[_0x6287('0x6b')](_0x40beb1,_0x11b457));}});}})[_0x6287('0x28')](handleError(_0x5a18a5,null));}; \ No newline at end of file +var _0x9997=['query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','params','include','find','update','body','destroy','create','direction','out','secret','split','findOne','MailAccountId','List','Contacts','updatedAt','DESC','Smtp','isNil','service','host','port','auth','user','pass','secure','attachments','join','root','basename','CmContact','ListId','List\x20not\x20found','SendMail','sendMail','messageId','mail-interactions','accept','mail','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','Contact','get','MailInteraction','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','EventManager','acceptmessage','MailInteractionId','RejectMessage','rejectMessage','event','reject','download','unix','toString','server','files','tmp','message-%s.eml','from','bcc','subject','Attachment','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','push','readFileSync','build','writeFileSync','log','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','localhost','./mailMessage.socket','jayson/promise','http','client','request','then','info','request\x20sent','debug','stringify','error','code','MailMessage,\x20%s,\x20%s','message','status','end','json','count','offset','limit','set','apply','save','sendStatus','stack','name','index','map','MailMessage','rawAttributes','fieldName','type','key'];(function(_0x5bca99,_0x5ba77f){var _0x5541ed=function(_0x6dfacf){while(--_0x6dfacf){_0x5bca99['push'](_0x5bca99['shift']());}};_0x5541ed(++_0x5ba77f);}(_0x9997,0x1b8));var _0x7999=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x9997[_0x31ced5];return _0x10d9e5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7999('0x0'));var rimraf=require(_0x7999('0x1'));var zipdir=require(_0x7999('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7999('0x3'));var moment=require(_0x7999('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7999('0x5'));var util=require(_0x7999('0x6'));var path=require(_0x7999('0x7'));var sox=require('sox');var csv=require(_0x7999('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7999('0x9'));var _=require(_0x7999('0xa'));var squel=require(_0x7999('0xb'));var crypto=require(_0x7999('0xc'));var jsforce=require(_0x7999('0xd'));var deskjs=require(_0x7999('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7999('0xf'));var Papa=require(_0x7999('0x10'));var Redis=require(_0x7999('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7999('0x12'));var as=require(_0x7999('0x13'));var hardwareService=require(_0x7999('0x14'));var logger=require(_0x7999('0x15'))(_0x7999('0x16'));var utils=require(_0x7999('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7999('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x7999('0x19')](config[_0x7999('0x1a')],{'host':_0x7999('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7999('0x1c'))['register'](socket);var jayson=require(_0x7999('0x1d'));var client=jayson['client']['http']({'port':0x232c});var client9003=jayson['client'][_0x7999('0x1e')]({'port':0x232b});var client9002=jayson[_0x7999('0x1f')][_0x7999('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x240c7c,_0x574347,_0x2cfc79,_0x5955d0){return new BPromise(function(_0x7fa69c,_0x4fb51b){var _0x4d6024=_0x5955d0||client;return _0x4d6024[_0x7999('0x20')](_0x240c7c,_0x2cfc79)[_0x7999('0x21')](function(_0x2ef874){logger[_0x7999('0x22')]('MailMessage,\x20%s,\x20%s',_0x574347,_0x7999('0x23'));logger[_0x7999('0x24')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x574347,'request\x20sent',JSON[_0x7999('0x25')](_0x2ef874));if(_0x2ef874['error']){if(_0x2ef874[_0x7999('0x26')][_0x7999('0x27')]===0x1f4){logger[_0x7999('0x26')](_0x7999('0x28'),_0x574347,_0x2ef874[_0x7999('0x26')][_0x7999('0x29')]);return _0x4fb51b(_0x2ef874[_0x7999('0x26')][_0x7999('0x29')]);}logger[_0x7999('0x26')](_0x7999('0x28'),_0x574347,_0x2ef874[_0x7999('0x26')][_0x7999('0x29')]);return _0x7fa69c(_0x2ef874[_0x7999('0x26')][_0x7999('0x29')]);}else{logger[_0x7999('0x22')]('MailMessage,\x20%s,\x20%s',_0x574347,_0x7999('0x23'));_0x7fa69c(_0x2ef874['result'][_0x7999('0x29')]);}})['catch'](function(_0x17092a){logger[_0x7999('0x26')](_0x7999('0x28'),_0x574347,_0x17092a);_0x4fb51b(_0x17092a);});});}function respondWithStatusCode(_0x1ea988,_0x50f444){_0x50f444=_0x50f444||0xcc;return function(_0x51861c){if(_0x51861c){return _0x1ea988['sendStatus'](_0x50f444);}return _0x1ea988[_0x7999('0x2a')](_0x50f444)[_0x7999('0x2b')]();};}function respondWithResult(_0x3980ad,_0x7de56){_0x7de56=_0x7de56||0xc8;return function(_0x41e950){if(_0x41e950){return _0x3980ad[_0x7999('0x2a')](_0x7de56)[_0x7999('0x2c')](_0x41e950);}};}function respondWithFilteredResult(_0x46a958,_0x44735c){return function(_0x16aa5d){if(_0x16aa5d){var _0x6e9144=_0x16aa5d[_0x7999('0x2d')],_0x4d974c=_0x44735c[_0x7999('0x2e')],_0x1e02f6=_0x44735c[_0x7999('0x2e')]+_0x44735c[_0x7999('0x2f')],_0x541cc4;if(_0x1e02f6>=_0x6e9144){_0x1e02f6=_0x6e9144;_0x541cc4=0xc8;}else{_0x541cc4=0xce;}_0x46a958[_0x7999('0x2a')](_0x541cc4);return _0x46a958[_0x7999('0x30')]('Content-Range',_0x4d974c+'-'+_0x1e02f6+'/'+_0x6e9144)['json'](_0x16aa5d);}return null;};}function patchUpdates(_0x5f00ae){return function(_0x1c61df){try{jsonpatch[_0x7999('0x31')](_0x1c61df,_0x5f00ae,!![]);}catch(_0x536810){return BPromise['reject'](_0x536810);}return _0x1c61df[_0x7999('0x32')]();};}function saveUpdates(_0x4e3c33,_0x4bf585){return function(_0x51716c){if(_0x51716c){return _0x51716c['update'](_0x4e3c33)[_0x7999('0x21')](function(_0x1f525e){return _0x1f525e;});}return null;};}function removeEntity(_0x2e1929,_0x20b613){return function(_0x55a7be){if(_0x55a7be){return _0x55a7be['destroy']()[_0x7999('0x21')](function(){_0x2e1929[_0x7999('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1175cc,_0x458026){return function(_0x334aa1){if(!_0x334aa1){_0x1175cc[_0x7999('0x33')](0x194);}return _0x334aa1;};}function handleError(_0x19a5cb,_0x1d8ab0){_0x1d8ab0=_0x1d8ab0||0x1f4;return function(_0xe7d188){logger[_0x7999('0x26')](_0xe7d188[_0x7999('0x34')]);if(_0xe7d188['name']){delete _0xe7d188[_0x7999('0x35')];}_0x19a5cb[_0x7999('0x2a')](_0x1d8ab0)['send'](_0xe7d188);};}exports[_0x7999('0x36')]=function(_0x5433d3,_0x206c8b){var _0x2588db={},_0x3c4caf={},_0x415f27={'count':0x0,'rows':[]};var _0x2918b9=_[_0x7999('0x37')](db[_0x7999('0x38')][_0x7999('0x39')],function(_0x5b7094){return{'name':_0x5b7094[_0x7999('0x3a')],'type':_0x5b7094[_0x7999('0x3b')][_0x7999('0x3c')]};});_0x3c4caf['model']=_[_0x7999('0x37')](_0x2918b9,_0x7999('0x35'));_0x3c4caf[_0x7999('0x3d')]=_[_0x7999('0x3e')](_0x5433d3[_0x7999('0x3d')]);_0x3c4caf[_0x7999('0x3f')]=_[_0x7999('0x40')](_0x3c4caf[_0x7999('0x41')],_0x3c4caf[_0x7999('0x3d')]);_0x2588db[_0x7999('0x42')]=_[_0x7999('0x40')](_0x3c4caf[_0x7999('0x41')],qs[_0x7999('0x43')](_0x5433d3[_0x7999('0x3d')]['fields']));_0x2588db['attributes']=_0x2588db[_0x7999('0x42')][_0x7999('0x44')]?_0x2588db[_0x7999('0x42')]:_0x3c4caf[_0x7999('0x41')];if(!_0x5433d3['query']['hasOwnProperty'](_0x7999('0x45'))){_0x2588db[_0x7999('0x2f')]=qs[_0x7999('0x2f')](_0x5433d3[_0x7999('0x3d')][_0x7999('0x2f')]);_0x2588db['offset']=qs['offset'](_0x5433d3['query'][_0x7999('0x2e')]);}_0x2588db[_0x7999('0x46')]=qs[_0x7999('0x47')](_0x5433d3['query'][_0x7999('0x47')]);_0x2588db[_0x7999('0x48')]=qs[_0x7999('0x3f')](_[_0x7999('0x49')](_0x5433d3[_0x7999('0x3d')],_0x3c4caf[_0x7999('0x3f')]),_0x2918b9);if(_0x5433d3[_0x7999('0x3d')][_0x7999('0x4a')]){_0x2588db['where']=_['merge'](_0x2588db[_0x7999('0x48')],{'$or':_['map'](_0x2918b9,function(_0x36da80){if(_0x36da80['type']!=='VIRTUAL'){var _0x1bd2a2={};_0x1bd2a2[_0x36da80['name']]={'$like':'%'+_0x5433d3[_0x7999('0x3d')][_0x7999('0x4a')]+'%'};return _0x1bd2a2;}})});}_0x2588db=_[_0x7999('0x4b')]({},_0x2588db,_0x5433d3[_0x7999('0x4c')]);var _0x399924={'where':_0x2588db['where']};return db[_0x7999('0x38')][_0x7999('0x2d')](_0x399924)[_0x7999('0x21')](function(_0x2e2e93){_0x415f27[_0x7999('0x2d')]=_0x2e2e93;if(_0x5433d3[_0x7999('0x3d')][_0x7999('0x4d')]){_0x2588db['include']=[{'all':!![]}];}return db[_0x7999('0x38')][_0x7999('0x4e')](_0x2588db);})[_0x7999('0x21')](function(_0x1a5cd6){_0x415f27['rows']=_0x1a5cd6;return _0x415f27;})['then'](respondWithFilteredResult(_0x206c8b,_0x2588db))[_0x7999('0x4f')](handleError(_0x206c8b,null));};exports[_0x7999('0x50')]=function(_0x4e6529,_0x5e5664){var _0x26d047={'raw':!![],'where':{'id':_0x4e6529[_0x7999('0x51')]['id']}},_0x4c5402={};_0x4c5402['model']=_['keys'](db[_0x7999('0x38')]['rawAttributes']);_0x4c5402[_0x7999('0x3d')]=_['keys'](_0x4e6529[_0x7999('0x3d')]);_0x4c5402['filters']=_[_0x7999('0x40')](_0x4c5402[_0x7999('0x41')],_0x4c5402[_0x7999('0x3d')]);_0x26d047['attributes']=_['intersection'](_0x4c5402[_0x7999('0x41')],qs[_0x7999('0x43')](_0x4e6529['query'][_0x7999('0x43')]));_0x26d047[_0x7999('0x42')]=_0x26d047[_0x7999('0x42')][_0x7999('0x44')]?_0x26d047[_0x7999('0x42')]:_0x4c5402['model'];if(_0x4e6529[_0x7999('0x3d')][_0x7999('0x4d')]){_0x26d047[_0x7999('0x52')]=[{'all':!![]}];}_0x26d047=_[_0x7999('0x4b')]({},_0x26d047,_0x4e6529[_0x7999('0x4c')]);return db['MailMessage'][_0x7999('0x53')](_0x26d047)[_0x7999('0x21')](handleEntityNotFound(_0x5e5664,null))[_0x7999('0x21')](respondWithResult(_0x5e5664,null))[_0x7999('0x4f')](handleError(_0x5e5664,null));};exports[_0x7999('0x54')]=function(_0x35d4dc,_0x52e151){if(_0x35d4dc[_0x7999('0x55')]['id']){delete _0x35d4dc[_0x7999('0x55')]['id'];}return db['MailMessage']['find']({'where':{'id':_0x35d4dc[_0x7999('0x51')]['id']}})[_0x7999('0x21')](handleEntityNotFound(_0x52e151,null))[_0x7999('0x21')](saveUpdates(_0x35d4dc[_0x7999('0x55')],null))[_0x7999('0x21')](respondWithResult(_0x52e151,null))[_0x7999('0x4f')](handleError(_0x52e151,null));};exports[_0x7999('0x56')]=function(_0x40a582,_0x4aa712){return db[_0x7999('0x38')][_0x7999('0x53')]({'where':{'id':_0x40a582[_0x7999('0x51')]['id']}})['then'](handleEntityNotFound(_0x4aa712,null))[_0x7999('0x21')](removeEntity(_0x4aa712,null))['catch'](handleError(_0x4aa712,null));};exports['describe']=function(_0x251614,_0x4371a5){return db[_0x7999('0x38')]['describe']()[_0x7999('0x21')](respondWithResult(_0x4371a5,null))[_0x7999('0x4f')](handleError(_0x4371a5,null));};exports[_0x7999('0x57')]=function(_0x577758,_0x5af58a){return db[_0x7999('0x38')][_0x7999('0x57')](_0x577758[_0x7999('0x55')])['then'](function(_0x57f16a){if(_0x57f16a){if(_0x57f16a[_0x7999('0x58')]===_0x7999('0x59')&&!_0x57f16a[_0x7999('0x5a')]){var _0x5b6c5a,_0x5bcc9d,_0x26d120;if(_0x577758[_0x7999('0x55')]['to']){_0x5bcc9d=_0x577758[_0x7999('0x55')]['to'][_0x7999('0x5b')](',')[0x0];}return db['MailAccount'][_0x7999('0x5c')]({'where':{'id':_0x57f16a[_0x7999('0x5d')]},'include':[{'model':db['CmList'],'as':_0x7999('0x5e'),'include':[{'model':db['CmContact'],'as':_0x7999('0x5f'),'where':{'email':_0x5bcc9d},'limit':0x1,'order':[[_0x7999('0x60'),_0x7999('0x61')]]}]},{'model':db['MailServerOut'],'as':_0x7999('0x62'),'raw':!![]}]})[_0x7999('0x21')](function(_0x12aeec){_0x5b6c5a=_0x12aeec;if(_0x5b6c5a&&_0x5b6c5a[_0x7999('0x62')]){var _0x21eec3={'tls':{'rejectUnauthorized':![]}};if(_[_0x7999('0x63')](_0x5b6c5a[_0x7999('0x62')][_0x7999('0x64')])){_0x21eec3[_0x7999('0x65')]=_0x5b6c5a[_0x7999('0x62')][_0x7999('0x65')];_0x21eec3[_0x7999('0x66')]=_0x5b6c5a[_0x7999('0x62')][_0x7999('0x66')];_0x21eec3['secure']=_0x5b6c5a[_0x7999('0x62')]['secure'];if(_0x5b6c5a[_0x7999('0x62')]['authentication']){_0x21eec3[_0x7999('0x67')]={'user':_0x5b6c5a['Smtp'][_0x7999('0x68')],'pass':_0x5b6c5a['Smtp'][_0x7999('0x69')]};}}else{_0x21eec3[_0x7999('0x64')]=_0x5b6c5a['Smtp'][_0x7999('0x64')];_0x21eec3[_0x7999('0x67')]={'user':_0x5b6c5a[_0x7999('0x62')]['user'],'pass':_0x5b6c5a[_0x7999('0x62')]['pass']};_0x21eec3[_0x7999('0x6a')]=_0x5b6c5a[_0x7999('0x62')][_0x7999('0x6a')];}if(_0x577758[_0x7999('0x55')][_0x7999('0x6b')]&&_0x577758[_0x7999('0x55')][_0x7999('0x6b')][_0x7999('0x44')]){for(var _0x38f079=0x0;_0x38f079<_0x577758[_0x7999('0x55')][_0x7999('0x6b')][_0x7999('0x44')];_0x38f079+=0x1){_0x577758[_0x7999('0x55')]['attachments'][_0x38f079]={'filename':_0x577758['body']['attachments'][_0x38f079][_0x7999('0x35')],'path':path[_0x7999('0x6c')](config[_0x7999('0x6d')],'server/files/attachments',_0x577758[_0x7999('0x55')][_0x7999('0x6b')][_0x38f079][_0x7999('0x6e')])};}}_0x26d120={'account':_0x21eec3,'message':_0x577758['body']};return;}})['then'](function(){if(_0x5b6c5a[_0x7999('0x5e')]){if(_0x5b6c5a[_0x7999('0x5e')]['Contacts'][_0x7999('0x44')]){return _0x5b6c5a['List']['Contacts'][0x0];}else{return db[_0x7999('0x6f')][_0x7999('0x57')](_[_0x7999('0x19')](_0x577758[_0x7999('0x55')],{'firstName':_0x577758[_0x7999('0x55')]['to'],'email':_0x577758[_0x7999('0x55')]['to'],'phone':_0x577758[_0x7999('0x55')]['to'],'ListId':_0x5b6c5a[_0x7999('0x70')]}));}}else{throw new Error(_0x7999('0x71'));}})['then'](function(){if(_0x26d120){return respondWithRpcPromise(_0x7999('0x72'),_0x7999('0x73'),_0x26d120,client9003)['then'](function(_0x3a1318){return _0x57f16a[_0x7999('0x54')]({'read':!![],'messageId':_0x3a1318[_0x7999('0x74')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x7999('0x4f')](function(_0x5b2b45){logger[_0x7999('0x26')]('%s',JSON['stringify'](_0x5b2b45));return _0x57f16a;});}return _0x57f16a;});}return _0x57f16a;}})['then'](respondWithResult(_0x5af58a,0xc9))['catch'](handleError(_0x5af58a,null));};var interaction_log=require(_0x7999('0x15'))(_0x7999('0x75'));exports[_0x7999('0x76')]=function(_0x11e362,_0x2bf68d,_0x1e6eb3){var _0x24efbe={'agent':{},'channel':_0x7999('0x77')};if(_0x11e362['body']['id']){delete _0x11e362['body']['id'];}_0x11e362[_0x7999('0x55')]['read']=!![];_0x11e362[_0x7999('0x55')]['readAt']=moment()[_0x7999('0x78')](_0x7999('0x79'));_0x11e362[_0x7999('0x55')][_0x7999('0x7a')]=_0x11e362[_0x7999('0x55')][_0x7999('0x7a')]||_0x11e362[_0x7999('0x68')]['id'];_0x24efbe[_0x7999('0x7b')]['id']=_0x11e362['body'][_0x7999('0x7a')];return db[_0x7999('0x38')][_0x7999('0x53')]({'where':{'id':_0x11e362['params']['id'],'UserId':null},'include':[{'model':db[_0x7999('0x6f')],'as':_0x7999('0x7c')}]})['then'](handleEntityNotFound(_0x2bf68d,null))[_0x7999('0x21')](saveUpdates(_0x11e362[_0x7999('0x55')],null))[_0x7999('0x21')](function(_0xf22bd9){if(_0xf22bd9){_0x24efbe[_0x7999('0x29')]=_0xf22bd9[_0x7999('0x7d')]({'plain':!![]});return db[_0x7999('0x7e')][_0x7999('0x53')]({'where':{'id':_0xf22bd9['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2bf68d,null))[_0x7999('0x21')](function(_0x5a3f30){if(_0x5a3f30){return _0x5a3f30[_0x7999('0x54')]({'UserId':_0x11e362[_0x7999('0x55')][_0x7999('0x7a')],'read1stAt':_[_0x7999('0x63')](_0x5a3f30[_0x7999('0x7f')])?moment()[_0x7999('0x78')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x7999('0x21')](function(_0x157ace){if(_0x157ace){_0x24efbe[_0x7999('0x80')]=_0x157ace['get']({'plain':!![]});interaction_log[_0x7999('0x22')](_0x7999('0x81'),_0x11e362[_0x7999('0x68')]['id'],_0x11e362[_0x7999('0x68')]['name'],_0x11e362['user'][_0x7999('0x82')],_0x24efbe['interaction']['id'],_0x11e362[_0x7999('0x55')]?JSON['stringify'](_0x11e362[_0x7999('0x55')]):_0x7999('0x83'));return respondWithRpcPromise(_0x7999('0x84'),_0x7999('0x85'),_0x24efbe);}return null;})[_0x7999('0x21')](function(_0x3ae624){if(_0x3ae624){if(_0x11e362[_0x7999('0x55')]['manual']){_0x24efbe[_0x7999('0x29')][_0x7999('0x86')]=util[_0x7999('0x78')](_0x7999('0x87'),_0x11e362['user'][_0x7999('0x35')]);_0x24efbe['message']['channel']=_0x24efbe[_0x7999('0x88')];_0x24efbe[_0x7999('0x29')]['event']=_0x7999('0x76');return respondWithRpcPromise(_0x7999('0x89'),_0x7999('0x89'),{'event':_0x7999('0x8a'),'message':_0x24efbe[_0x7999('0x29')]},client9002)['then'](function(){return _0x24efbe;});}return _0x24efbe;}return null;})[_0x7999('0x21')](respondWithResult(_0x2bf68d,null))[_0x7999('0x4f')](handleError(_0x2bf68d,null));};var interaction_log=require(_0x7999('0x15'))(_0x7999('0x75'));exports['reject']=function(_0x325d12,_0x162d5f,_0x398bc8){var _0x3aa508={'agent':{},'channel':_0x7999('0x77')};if(_0x325d12['body']['id']){delete _0x325d12[_0x7999('0x55')]['id'];}_0x325d12[_0x7999('0x55')][_0x7999('0x7a')]=_0x325d12[_0x7999('0x55')][_0x7999('0x7a')]||_0x325d12[_0x7999('0x68')]['id'];_0x3aa508['agent']['id']=_0x325d12[_0x7999('0x55')][_0x7999('0x7a')];return db[_0x7999('0x38')][_0x7999('0x53')]({'where':{'id':_0x325d12['params']['id'],'UserId':null}})[_0x7999('0x21')](handleEntityNotFound(_0x162d5f,null))[_0x7999('0x21')](function(_0x5647b8){if(_0x5647b8){_0x3aa508[_0x7999('0x29')]=_0x5647b8[_0x7999('0x7d')]({'plain':!![]});return db[_0x7999('0x7e')][_0x7999('0x53')]({'where':{'id':_0x5647b8[_0x7999('0x8b')]}});}return null;})[_0x7999('0x21')](handleEntityNotFound(_0x162d5f,null))[_0x7999('0x21')](function(_0x315ca8){if(_0x315ca8){_0x3aa508[_0x7999('0x80')]=_0x315ca8['get']({'plain':!![]});interaction_log[_0x7999('0x22')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x325d12['user']['id'],_0x325d12[_0x7999('0x68')][_0x7999('0x35')],_0x325d12[_0x7999('0x68')]['role'],_0x3aa508[_0x7999('0x80')]['id'],_0x325d12[_0x7999('0x55')]?JSON[_0x7999('0x25')](_0x325d12[_0x7999('0x55')]):_0x7999('0x83'));return respondWithRpcPromise(_0x7999('0x8c'),_0x7999('0x8d'),_0x3aa508);}return null;})[_0x7999('0x21')](function(_0x5c073c){if(_0x5c073c){_0x5c073c[_0x7999('0x29')][_0x7999('0x86')]=util[_0x7999('0x78')](_0x7999('0x87'),_0x325d12[_0x7999('0x68')]['name']);_0x5c073c[_0x7999('0x29')][_0x7999('0x88')]=_0x3aa508[_0x7999('0x88')];_0x5c073c[_0x7999('0x29')][_0x7999('0x8e')]=_0x7999('0x8f');respondWithRpcPromise(_0x7999('0x89'),_0x7999('0x89'),{'event':'rejectmessage','message':_0x5c073c[_0x7999('0x29')]},client9002);return _0x3aa508;}return null;})[_0x7999('0x21')](respondWithResult(_0x162d5f,null))[_0x7999('0x4f')](handleError(_0x162d5f,null));};exports[_0x7999('0x90')]=function(_0x60135d,_0x5214f9){var _0x84f792=moment()[_0x7999('0x91')]()[_0x7999('0x92')]();var _0x57d189=path[_0x7999('0x6c')](config['root'],_0x7999('0x93'),_0x7999('0x94'),_0x7999('0x95'));var _0x1156bb=path[_0x7999('0x6c')](config[_0x7999('0x6d')],_0x7999('0x93'),_0x7999('0x94'),_0x7999('0x6b'));var _0x4fcd97=util['format'](_0x7999('0x96'),_0x84f792);return db[_0x7999('0x38')][_0x7999('0x53')]({'where':{'id':_0x60135d[_0x7999('0x51')]['id']},'attributes':['id',_0x7999('0x55'),_0x7999('0x97'),'to','cc',_0x7999('0x98'),_0x7999('0x99'),'createdAt'],'include':_0x60135d[_0x7999('0x3d')]['attachments']?[{'model':db[_0x7999('0x9a')],'as':'Attachments'}]:undefined})[_0x7999('0x21')](handleEntityNotFound(_0x5214f9,null))[_0x7999('0x21')](function(_0x46175d){if(_0x46175d){var _0x26e0a2=_0x46175d;var _0x2a6edc={'from':_0x26e0a2[_0x7999('0x97')],'to':_0x26e0a2['to'],'subject':_0x26e0a2['subject'],'html':_0x26e0a2[_0x7999('0x55')],'headers':{'Date':moment(_0x26e0a2[_0x7999('0x9b')])[_0x7999('0x78')](_0x7999('0x9c'))},'attachments':[]};if(_0x46175d['cc']){_0x2a6edc[_0x7999('0x9d')]['Cc']=_0x46175d['cc'];}if(_0x46175d[_0x7999('0x98')]){_0x2a6edc['headers'][_0x7999('0x9e')]=_0x46175d[_0x7999('0x98')];}return new BPromise(function(_0x30cb29,_0x31fde3){if(_0x46175d[_0x7999('0x9f')]){for(var _0x523992=0x0;_0x523992<_0x46175d[_0x7999('0x9f')][_0x7999('0x44')];_0x523992++){var _0x3f72a0=_0x46175d[_0x7999('0x9f')][_0x523992];var _0x2c2aae=path[_0x7999('0x6c')](_0x1156bb,_0x3f72a0[_0x7999('0x6e')]);if(fs[_0x7999('0xa0')](_0x2c2aae)){_0x2a6edc[_0x7999('0x6b')][_0x7999('0xa1')]({'name':_0x3f72a0[_0x7999('0x35')],'contentType':_0x3f72a0[_0x7999('0x3b')],'data':fs[_0x7999('0xa2')](_0x2c2aae)});}}}emlformat[_0x7999('0xa3')](_0x2a6edc,function(_0x5db966,_0x1e4fa4){if(_0x5db966)return _0x31fde3(_0x5db966);fs[_0x7999('0xa4')](path[_0x7999('0x6c')](_0x57d189,_0x4fcd97),_0x1e4fa4);return _0x30cb29(_0x1e4fa4);});});}})['then'](function(_0x449465){if(_0x449465){return _0x5214f9[_0x7999('0x90')](path[_0x7999('0x6c')](_0x57d189,_0x4fcd97),_0x4fcd97,function(_0x30618e){if(_0x30618e){console[_0x7999('0xa5')]('err',_0x30618e);}else{fs[_0x7999('0xa6')](path[_0x7999('0x6c')](_0x57d189,_0x4fcd97));}});}})[_0x7999('0x4f')](handleError(_0x5214f9,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index effcf2a..a953170 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 _0xc73b=['events','MailMessage','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x46d183,_0x2c3ccd){var _0x56dc55=function(_0x54271f){while(--_0x54271f){_0x46d183['push'](_0x46d183['shift']());}};_0x56dc55(++_0x2c3ccd);}(_0xc73b,0xbd));var _0xbc73=function(_0x19f046,_0x2717e1){_0x19f046=_0x19f046-0x0;var _0x5013b8=_0xc73b[_0x19f046];return _0x5013b8;};'use strict';var EventEmitter=require(_0xbc73('0x0'));var MailMessage=require('../../mysqldb')['db'][_0xbc73('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xbc73('0x2')](0x0);var events={'afterCreate':_0xbc73('0x3'),'afterUpdate':_0xbc73('0x4'),'afterDestroy':_0xbc73('0x5')};function emitEvent(_0x53203d){return function(_0x55f195,_0x386acf,_0x12b398){MailMessageEvents[_0xbc73('0x6')](_0x53203d+':'+_0x55f195['id'],_0x55f195);MailMessageEvents[_0xbc73('0x6')](_0x53203d,_0x55f195);_0x12b398(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xbc73('0x7')](e,emitEvent(event));}}module[_0xbc73('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x35eb=['hook','exports','events','../../mysqldb','MailMessage','update','remove','emit','hasOwnProperty'];(function(_0x538c70,_0x35531f){var _0x42ae01=function(_0x5c7368){while(--_0x5c7368){_0x538c70['push'](_0x538c70['shift']());}};_0x42ae01(++_0x35531f);}(_0x35eb,0x65));var _0xb35e=function(_0x1d128e,_0x2c87de){_0x1d128e=_0x1d128e-0x0;var _0x3d5236=_0x35eb[_0x1d128e];return _0x3d5236;};'use strict';var EventEmitter=require(_0xb35e('0x0'));var MailMessage=require(_0xb35e('0x1'))['db'][_0xb35e('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xb35e('0x3'),'afterDestroy':_0xb35e('0x4')};function emitEvent(_0x53c122){return function(_0xc6990f,_0x276a84,_0x565a9a){MailMessageEvents[_0xb35e('0x5')](_0x53c122+':'+_0xc6990f['id'],_0xc6990f);MailMessageEvents['emit'](_0x53c122,_0xc6990f);_0x565a9a(null);};}for(var e in events){if(events[_0xb35e('0x6')](e)){var event=events[e];MailMessage[_0xb35e('0x7')](e,emitEvent(event));}}module[_0xb35e('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 0729495..573a30d 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 _0x0899=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','subject','FULLTEXT','plainBody','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteractionId','then','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger'];(function(_0x425716,_0x3e9d1c){var _0x2d39af=function(_0x1febc1){while(--_0x1febc1){_0x425716['push'](_0x425716['shift']());}};_0x2d39af(++_0x3e9d1c);}(_0x0899,0xcf));var _0x9089=function(_0x349407,_0x1b1a22){_0x349407=_0x349407-0x0;var _0x120773=_0x0899[_0x349407];return _0x120773;};'use strict';var _=require(_0x9089('0x0'));var util=require(_0x9089('0x1'));var logger=require(_0x9089('0x2'))(_0x9089('0x3'));var moment=require(_0x9089('0x4'));var BPromise=require(_0x9089('0x5'));var rp=require(_0x9089('0x6'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x9089('0x7'));var rimraf=require(_0x9089('0x8'));var config=require(_0x9089('0x9'));var attributes=require(_0x9089('0xa'));module[_0x9089('0xb')]=function(_0x39cd13,_0x581409){return _0x39cd13[_0x9089('0xc')](_0x9089('0xd'),attributes,{'tableName':_0x9089('0xe'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x9089('0xf')]},{'name':_0x9089('0x10'),'fields':['plainBody',_0x9089('0x11')],'type':_0x9089('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x489f6c,_0x381bc0,_0x48aec3){if(_0x489f6c['body']){_0x489f6c[_0x9089('0x13')]=htmlToText['fromString'](_0x489f6c[_0x9089('0x14')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x48aec3(null,_0x381bc0);},'afterCreate':function(_0x23800b,_0x56bef4,_0x228ea9){var _0x26e1e8=_0x39cd13[_0x9089('0x15')];var _0x17ec91=_0x23800b[_0x9089('0x16')]({'plain':!![]});if(_0x17ec91[_0x9089('0x17')][_0x9089('0x18')]()==='in'||_0x17ec91[_0x9089('0x17')][_0x9089('0x18')]()===_0x9089('0x19')&&!_0x17ec91[_0x9089('0x1a')]&&!_[_0x9089('0x1b')](_0x17ec91[_0x9089('0x1c')])){_0x26e1e8['MailInteraction']['findOne']({'where':{'id':_0x17ec91[_0x9089('0x1d')]}})[_0x9089('0x1e')](function(_0x4ff635){if(_0x4ff635){_0x4ff635['update']({'lastMsgAt':_0x17ec91[_0x9089('0x1f')],'lastMsgDirection':_0x17ec91['direction']['toLowerCase'](),'lastMsgBody':_0x17ec91[_0x9089('0x14')]});}})[_0x9089('0x20')](function(_0x350ef5){console[_0x9089('0x21')](_0x350ef5);});}_0x228ea9();}},'charset':_0x9089('0x22'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe1e4=['path','../../config/environment','./mailMessage.attributes','exports','mail_messages','messageId','fti_mail_messages','plainBody','subject','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','MailInteractionId','then','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4fc6ab,_0x42c7da){var _0x94a979=function(_0x2a0ec0){while(--_0x2a0ec0){_0x4fc6ab['push'](_0x4fc6ab['shift']());}};_0x94a979(++_0x42c7da);}(_0xe1e4,0x1ac));var _0x4e1e=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xe1e4[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0x4e1e('0x0'));var util=require('util');var logger=require(_0x4e1e('0x1'))(_0x4e1e('0x2'));var moment=require(_0x4e1e('0x3'));var BPromise=require(_0x4e1e('0x4'));var rp=require(_0x4e1e('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x4e1e('0x6'));var rimraf=require('rimraf');var config=require(_0x4e1e('0x7'));var attributes=require(_0x4e1e('0x8'));module[_0x4e1e('0x9')]=function(_0x1b168e,_0x228cea){return _0x1b168e['define']('MailMessage',attributes,{'tableName':_0x4e1e('0xa'),'paranoid':![],'indexes':[{'name':_0x4e1e('0xb'),'fields':[_0x4e1e('0xb')]},{'name':_0x4e1e('0xc'),'fields':[_0x4e1e('0xd'),_0x4e1e('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4619e3,_0x218faf,_0x1b8ad8){if(_0x4619e3[_0x4e1e('0xf')]){_0x4619e3['plainBody']=htmlToText['fromString'](_0x4619e3['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1b8ad8(null,_0x218faf);},'afterCreate':function(_0x4889e1,_0xc9fd44,_0x5521bc){var _0x156aa9=_0x1b168e[_0x4e1e('0x10')];var _0x3ede85=_0x4889e1[_0x4e1e('0x11')]({'plain':!![]});if(_0x3ede85[_0x4e1e('0x12')][_0x4e1e('0x13')]()==='in'||_0x3ede85[_0x4e1e('0x12')]['toLowerCase']()===_0x4e1e('0x14')&&!_0x3ede85[_0x4e1e('0x15')]&&!_[_0x4e1e('0x16')](_0x3ede85[_0x4e1e('0x17')])){_0x156aa9[_0x4e1e('0x18')]['findOne']({'where':{'id':_0x3ede85[_0x4e1e('0x19')]}})[_0x4e1e('0x1a')](function(_0x2de414){if(_0x2de414){_0x2de414[_0x4e1e('0x1b')]({'lastMsgAt':_0x3ede85['createdAt'],'lastMsgDirection':_0x3ede85[_0x4e1e('0x12')]['toLowerCase'](),'lastMsgBody':_0x3ede85['body']});}})[_0x4e1e('0x1c')](function(_0x17b151){console['error'](_0x17b151);});}_0x5521bc();}},'charset':_0x4e1e('0x1d'),'collate':_0x4e1e('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 28ea815..c006ebd 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 _0x903b=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','stringify','lodash','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x903b,0x19d));var _0xb903=function(_0x36e892,_0xf19aa9){_0x36e892=_0x36e892-0x0;var _0x1f93d9=_0x903b[_0x36e892];return _0x1f93d9;};'use strict';var _=require(_0xb903('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb903('0x1'));var rs=require(_0xb903('0x2'));var fs=require('fs');var Redis=require(_0xb903('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb903('0x4'));var logger=require(_0xb903('0x5'))('rpc');var config=require(_0xb903('0x6'));var jayson=require(_0xb903('0x7'));var client=jayson[_0xb903('0x8')][_0xb903('0x9')]({'port':0x232a});config[_0xb903('0xa')]=_[_0xb903('0xb')](config[_0xb903('0xa')],{'host':_0xb903('0xc'),'port':0x18eb});var socket=require(_0xb903('0xd'))(new Redis(config[_0xb903('0xa')]));require(_0xb903('0xe'))['register'](socket);function respondWithRpcPromise(_0x1499ab,_0x525488,_0x883eba){return new BPromise(function(_0x1c8dc4,_0x1a98da){return client[_0xb903('0xf')](_0x1499ab,_0x883eba)[_0xb903('0x10')](function(_0x45caea){logger[_0xb903('0x11')](_0xb903('0x12'),_0x525488,_0xb903('0x13'));logger[_0xb903('0x14')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x525488,'request\x20sent',JSON['stringify'](_0x45caea));if(_0x45caea[_0xb903('0x15')]){if(_0x45caea[_0xb903('0x15')][_0xb903('0x16')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x525488,_0x45caea[_0xb903('0x15')][_0xb903('0x17')]);return _0x1a98da(_0x45caea['error']['message']);}logger[_0xb903('0x15')](_0xb903('0x12'),_0x525488,_0x45caea[_0xb903('0x15')][_0xb903('0x17')]);return _0x1c8dc4(_0x45caea[_0xb903('0x15')]['message']);}else{logger[_0xb903('0x11')](_0xb903('0x12'),_0x525488,_0xb903('0x13'));_0x1c8dc4(_0x45caea[_0xb903('0x18')][_0xb903('0x17')]);}})[_0xb903('0x19')](function(_0x407660){logger[_0xb903('0x15')](_0xb903('0x12'),_0x525488,_0x407660);_0x1a98da(_0x407660);});});}exports[_0xb903('0x1a')]=function(_0x58404a){var _0x786a15=this;return new Promise(function(_0x2ca83f,_0x4624fc){return db[_0xb903('0x1b')][_0xb903('0x1c')](_0x58404a['body'],{'raw':_0x58404a[_0xb903('0x1d')]?_0x58404a[_0xb903('0x1d')][_0xb903('0x1e')]===undefined?!![]:![]:!![]})[_0xb903('0x10')](function(_0x457cbf){logger[_0xb903('0x11')](_0xb903('0x1a'),_0x58404a);logger['debug'](_0xb903('0x1a'),_0x58404a,JSON[_0xb903('0x1f')](_0x457cbf));_0x2ca83f(_0x457cbf);})[_0xb903('0x19')](function(_0x102f9d){logger[_0xb903('0x15')](_0xb903('0x1a'),_0x102f9d[_0xb903('0x17')],_0x58404a);_0x4624fc(_0x786a15[_0xb903('0x15')](0x1f4,_0x102f9d[_0xb903('0x17')]));});});}; \ No newline at end of file +var _0xe4c7=['client','http','localhost','socket.io-emitter','redis','./mailMessage.socket','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','CreateMailMessage','MailMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x5bd1bc,_0x4ec775){var _0x3854cf=function(_0x17e1bb){while(--_0x17e1bb){_0x5bd1bc['push'](_0x5bd1bc['shift']());}};_0x3854cf(++_0x4ec775);}(_0xe4c7,0x1d2));var _0x7e4c=function(_0x10a0ab,_0x37b227){_0x10a0ab=_0x10a0ab-0x0;var _0x35f4c3=_0xe4c7[_0x10a0ab];return _0x35f4c3;};'use strict';var _=require(_0x7e4c('0x0'));var util=require(_0x7e4c('0x1'));var moment=require(_0x7e4c('0x2'));var BPromise=require(_0x7e4c('0x3'));var rs=require(_0x7e4c('0x4'));var fs=require('fs');var Redis=require(_0x7e4c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e4c('0x6'));var logger=require(_0x7e4c('0x7'))(_0x7e4c('0x8'));var config=require('../../config/environment');var jayson=require(_0x7e4c('0x9'));var client=jayson[_0x7e4c('0xa')][_0x7e4c('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x7e4c('0xc'),'port':0x18eb});var socket=require(_0x7e4c('0xd'))(new Redis(config[_0x7e4c('0xe')]));require(_0x7e4c('0xf'))['register'](socket);function respondWithRpcPromise(_0x402cd9,_0x4418be,_0x43827f){return new BPromise(function(_0x5c2f4b,_0x2a73cc){return client[_0x7e4c('0x10')](_0x402cd9,_0x43827f)[_0x7e4c('0x11')](function(_0x1b5cc3){logger[_0x7e4c('0x12')]('MailMessage,\x20%s,\x20%s',_0x4418be,_0x7e4c('0x13'));logger[_0x7e4c('0x14')](_0x7e4c('0x15'),_0x4418be,_0x7e4c('0x13'),JSON[_0x7e4c('0x16')](_0x1b5cc3));if(_0x1b5cc3[_0x7e4c('0x17')]){if(_0x1b5cc3['error'][_0x7e4c('0x18')]===0x1f4){logger['error'](_0x7e4c('0x19'),_0x4418be,_0x1b5cc3[_0x7e4c('0x17')][_0x7e4c('0x1a')]);return _0x2a73cc(_0x1b5cc3[_0x7e4c('0x17')][_0x7e4c('0x1a')]);}logger[_0x7e4c('0x17')](_0x7e4c('0x19'),_0x4418be,_0x1b5cc3[_0x7e4c('0x17')][_0x7e4c('0x1a')]);return _0x5c2f4b(_0x1b5cc3[_0x7e4c('0x17')]['message']);}else{logger[_0x7e4c('0x12')](_0x7e4c('0x19'),_0x4418be,_0x7e4c('0x13'));_0x5c2f4b(_0x1b5cc3[_0x7e4c('0x1b')][_0x7e4c('0x1a')]);}})['catch'](function(_0x28cd52){logger[_0x7e4c('0x17')](_0x7e4c('0x19'),_0x4418be,_0x28cd52);_0x2a73cc(_0x28cd52);});});}exports[_0x7e4c('0x1c')]=function(_0x4c599c){var _0x352eb5=this;return new Promise(function(_0x44ac17,_0x217221){return db[_0x7e4c('0x1d')][_0x7e4c('0x1e')](_0x4c599c[_0x7e4c('0x1f')],{'raw':_0x4c599c[_0x7e4c('0x20')]?_0x4c599c[_0x7e4c('0x20')][_0x7e4c('0x21')]===undefined?!![]:![]:!![]})[_0x7e4c('0x11')](function(_0x2662e0){logger[_0x7e4c('0x12')](_0x7e4c('0x1c'),_0x4c599c);logger['debug'](_0x7e4c('0x1c'),_0x4c599c,JSON[_0x7e4c('0x16')](_0x2662e0));_0x44ac17(_0x2662e0);})['catch'](function(_0x35d7e2){logger[_0x7e4c('0x17')](_0x7e4c('0x1c'),_0x35d7e2[_0x7e4c('0x1a')],_0x4c599c);_0x217221(_0x352eb5[_0x7e4c('0x17')](0x1f4,_0x35d7e2['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index d9e9b19..765cea0 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 _0xc452=['emit','register','length','mailMessage:','save','update'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xc452,0x154));var _0x2c45=function(_0x1b5f93,_0x2fc48f){_0x1b5f93=_0x1b5f93-0x0;var _0x5f2378=_0xc452[_0x1b5f93];return _0x5f2378;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x2c45('0x0'),'remove',_0x2c45('0x1')];function createListener(_0x3ab1eb,_0x28d20e){return function(_0x27491d){_0x28d20e[_0x2c45('0x2')](_0x3ab1eb,_0x27491d);};}function removeListener(_0x429adb,_0x41e445){return function(){MailMessageEvents['removeListener'](_0x429adb,_0x41e445);};}exports[_0x2c45('0x3')]=function(_0x5cba0){for(var _0x20eb23=0x0,_0x573bfe=events[_0x2c45('0x4')];_0x20eb23<_0x573bfe;_0x20eb23++){var _0x2b6bd4=events[_0x20eb23];var _0x3d7630=createListener(_0x2c45('0x5')+_0x2b6bd4,_0x5cba0);MailMessageEvents['on'](_0x2b6bd4,_0x3d7630);}}; \ No newline at end of file +var _0x4499=['mailMessage:','remove','update','emit','removeListener','length'];(function(_0x42c084,_0x3ac7cb){var _0x42fade=function(_0x14fe8f){while(--_0x14fe8f){_0x42c084['push'](_0x42c084['shift']());}};_0x42fade(++_0x3ac7cb);}(_0x4499,0x145));var _0x9449=function(_0x1d2a11,_0x44e346){_0x1d2a11=_0x1d2a11-0x0;var _0xc2dee0=_0x4499[_0x1d2a11];return _0xc2dee0;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=['save',_0x9449('0x0'),_0x9449('0x1')];function createListener(_0x36fd84,_0x352727){return function(_0x34e96e){_0x352727[_0x9449('0x2')](_0x36fd84,_0x34e96e);};}function removeListener(_0x599ac1,_0x465521){return function(){MailMessageEvents[_0x9449('0x3')](_0x599ac1,_0x465521);};}exports['register']=function(_0x4c5927){for(var _0xaecc82=0x0,_0x297234=events[_0x9449('0x4')];_0xaecc82<_0x297234;_0xaecc82++){var _0xdfcacc=events[_0xaecc82];var _0x2bf44b=createListener(_0x9449('0x5')+_0xdfcacc,_0x4c5927);MailMessageEvents['on'](_0xdfcacc,_0x2bf44b);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index f19323e..d4de291 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 _0x8e9d=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','getMembers','/:id/teams','getTeams','/:id/users','addTeams','post','addAgents','/:id','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','express'];(function(_0x377b02,_0x15026b){var _0x2194d6=function(_0x1033a4){while(--_0x1033a4){_0x377b02['push'](_0x377b02['shift']());}};_0x2194d6(++_0x15026b);}(_0x8e9d,0x14c));var _0xd8e9=function(_0x2e3a1b,_0x277df5){_0x2e3a1b=_0x2e3a1b-0x0;var _0x4658af=_0x8e9d[_0x2e3a1b];return _0x4658af;};'use strict';var multer=require(_0xd8e9('0x0'));var util=require(_0xd8e9('0x1'));var path=require('path');var timeout=require(_0xd8e9('0x2'));var express=require(_0xd8e9('0x3'));var router=express[_0xd8e9('0x4')]();var fs_extra=require(_0xd8e9('0x5'));var auth=require(_0xd8e9('0x6'));var interaction=require(_0xd8e9('0x7'));var config=require(_0xd8e9('0x8'));var controller=require('./mailQueue.controller');router[_0xd8e9('0x9')]('/',auth[_0xd8e9('0xa')](),controller[_0xd8e9('0xb')]);router['get']('/describe',auth[_0xd8e9('0xa')](),controller[_0xd8e9('0xc')]);router[_0xd8e9('0x9')]('/:id',auth[_0xd8e9('0xa')](),controller[_0xd8e9('0xd')]);router['get']('/:id/members',auth[_0xd8e9('0xa')](),controller[_0xd8e9('0xe')]);router['get'](_0xd8e9('0xf'),auth[_0xd8e9('0xa')](),controller[_0xd8e9('0x10')]);router['get'](_0xd8e9('0x11'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0xd8e9('0xa')](),controller['create']);router['post'](_0xd8e9('0xf'),auth[_0xd8e9('0xa')](),controller[_0xd8e9('0x12')]);router[_0xd8e9('0x13')](_0xd8e9('0x11'),auth[_0xd8e9('0xa')](),controller[_0xd8e9('0x14')]);router['put'](_0xd8e9('0x15'),auth[_0xd8e9('0xa')](),controller[_0xd8e9('0x16')]);router['delete']('/:id',auth[_0xd8e9('0xa')](),controller[_0xd8e9('0x17')]);router[_0xd8e9('0x18')](_0xd8e9('0xf'),auth[_0xd8e9('0xa')](),controller[_0xd8e9('0x19')]);router[_0xd8e9('0x18')](_0xd8e9('0x11'),auth[_0xd8e9('0xa')](),controller[_0xd8e9('0x1a')]);module[_0xd8e9('0x1b')]=router; \ No newline at end of file +var _0x993c=['getAgents','post','addTeams','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','./mailQueue.controller','get','index','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x31e2b1,_0x3e6a08){var _0x10c4fc=function(_0x4c73bc){while(--_0x4c73bc){_0x31e2b1['push'](_0x31e2b1['shift']());}};_0x10c4fc(++_0x3e6a08);}(_0x993c,0x9c));var _0xc993=function(_0x583f59,_0x3ac3ec){_0x583f59=_0x583f59-0x0;var _0x1898c9=_0x993c[_0x583f59];return _0x1898c9;};'use strict';var multer=require(_0xc993('0x0'));var util=require(_0xc993('0x1'));var path=require(_0xc993('0x2'));var timeout=require(_0xc993('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc993('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc993('0x5'));var config=require('../../config/environment');var controller=require(_0xc993('0x6'));router[_0xc993('0x7')]('/',auth['isAuthenticated'](),controller[_0xc993('0x8')]);router[_0xc993('0x7')]('/describe',auth[_0xc993('0x9')](),controller[_0xc993('0xa')]);router[_0xc993('0x7')](_0xc993('0xb'),auth[_0xc993('0x9')](),controller[_0xc993('0xc')]);router[_0xc993('0x7')](_0xc993('0xd'),auth[_0xc993('0x9')](),controller[_0xc993('0xe')]);router[_0xc993('0x7')](_0xc993('0xf'),auth[_0xc993('0x9')](),controller[_0xc993('0x10')]);router[_0xc993('0x7')](_0xc993('0x11'),auth[_0xc993('0x9')](),controller[_0xc993('0x12')]);router[_0xc993('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc993('0x13')](_0xc993('0xf'),auth[_0xc993('0x9')](),controller[_0xc993('0x14')]);router[_0xc993('0x13')](_0xc993('0x11'),auth['isAuthenticated'](),controller[_0xc993('0x15')]);router[_0xc993('0x16')](_0xc993('0xb'),auth[_0xc993('0x9')](),controller[_0xc993('0x17')]);router['delete'](_0xc993('0xb'),auth[_0xc993('0x9')](),controller[_0xc993('0x18')]);router[_0xc993('0x19')](_0xc993('0xf'),auth['isAuthenticated'](),controller[_0xc993('0x1a')]);router[_0xc993('0x19')](_0xc993('0x11'),auth[_0xc993('0x9')](),controller[_0xc993('0x1b')]);module[_0xc993('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 9d6e13e..6f69684 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 _0xaaf5=['name','INTEGER','ENUM','rrmemory','sequelize','exports','STRING'];(function(_0x4fc5fe,_0x4b19cb){var _0x56a47a=function(_0x5a4c2d){while(--_0x5a4c2d){_0x4fc5fe['push'](_0x4fc5fe['shift']());}};_0x56a47a(++_0x4b19cb);}(_0xaaf5,0x14d));var _0x5aaf=function(_0x5be05c,_0x1add5b){_0x5be05c=_0x5be05c-0x0;var _0x44b1d9=_0xaaf5[_0x5be05c];return _0x44b1d9;};'use strict';var Sequelize=require(_0x5aaf('0x0'));module[_0x5aaf('0x1')]={'name':{'type':Sequelize[_0x5aaf('0x2')],'unique':_0x5aaf('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5aaf('0x2')]},'timeout':{'type':Sequelize[_0x5aaf('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5aaf('0x5')](_0x5aaf('0x6'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x1c45=['STRING','name','INTEGER','ENUM','rrmemory','sequelize','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1c45,0x1b0));var _0x51c4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1c45[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x51c4('0x0'));module[_0x51c4('0x1')]={'name':{'type':Sequelize[_0x51c4('0x2')],'unique':_0x51c4('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x51c4('0x2')]},'timeout':{'type':Sequelize[_0x51c4('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x51c4('0x5')](_0x51c4('0x6'),'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 a914da6..ba42030 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 _0xb312=['updatedAt','createdAt','%s/%s','SIP','mailPause','getTeams','Team','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','findOrCreate','emit','userMailQueue:save','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','includes','all','union','compact','value','transaction','removeTeams','isEmpty','removeAgents','forEach','addAgents','omit','spread','isArray','userMailQueue:remove','rimraf','zip-dir','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./mailQueue.socket','register','status','json','count','offset','limit','apply','reject','save','update','destroy','then','get','MailQueues','sendStatus','name','send','index','MailQueue','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','role','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','MailQueueId','User','UserId','agent'];(function(_0x28d7b5,_0x1305a4){var _0x1ed035=function(_0x57e1f6){while(--_0x57e1f6){_0x28d7b5['push'](_0x28d7b5['shift']());}};_0x1ed035(++_0x1305a4);}(_0xb312,0xb4));var _0x2b31=function(_0x470018,_0x27f985){_0x470018=_0x470018-0x0;var _0x14ede=_0xb312[_0x470018];return _0x14ede;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2b31('0x0'));var zipdir=require(_0x2b31('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2b31('0x2'));var moment=require(_0x2b31('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2b31('0x4'));var util=require(_0x2b31('0x5'));var path=require(_0x2b31('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2b31('0x7'));var fs=require('fs');var fs_extra=require(_0x2b31('0x8'));var _=require(_0x2b31('0x9'));var squel=require('squel');var crypto=require(_0x2b31('0xa'));var jsforce=require(_0x2b31('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2b31('0xc'));var querystring=require(_0x2b31('0xd'));var Papa=require('papaparse');var Redis=require(_0x2b31('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2b31('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b31('0x10'));var logger=require(_0x2b31('0x11'))('api');var utils=require(_0x2b31('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x2b31('0x13'));var db=require('../../mysqldb')['db'];config[_0x2b31('0x14')]=_['defaults'](config[_0x2b31('0x14')],{'host':_0x2b31('0x15'),'port':0x18eb});var socket=require(_0x2b31('0x16'))(new Redis(config[_0x2b31('0x14')]));require(_0x2b31('0x17'))[_0x2b31('0x18')](socket);function respondWithStatusCode(_0x213f91,_0x2e9c6e){_0x2e9c6e=_0x2e9c6e||0xcc;return function(_0x34c690){if(_0x34c690){return _0x213f91['sendStatus'](_0x2e9c6e);}return _0x213f91[_0x2b31('0x19')](_0x2e9c6e)['end']();};}function respondWithResult(_0x362fe6,_0xf0bf0b){_0xf0bf0b=_0xf0bf0b||0xc8;return function(_0x2d44eb){if(_0x2d44eb){return _0x362fe6[_0x2b31('0x19')](_0xf0bf0b)[_0x2b31('0x1a')](_0x2d44eb);}};}function respondWithFilteredResult(_0x5f0687,_0x5b42f4){return function(_0x26b9dd){if(_0x26b9dd){var _0x554548=_0x26b9dd[_0x2b31('0x1b')],_0xd13be=_0x5b42f4[_0x2b31('0x1c')],_0xf3ac77=_0x5b42f4[_0x2b31('0x1c')]+_0x5b42f4[_0x2b31('0x1d')],_0x454b1d;if(_0xf3ac77>=_0x554548){_0xf3ac77=_0x554548;_0x454b1d=0xc8;}else{_0x454b1d=0xce;}_0x5f0687[_0x2b31('0x19')](_0x454b1d);return _0x5f0687['set']('Content-Range',_0xd13be+'-'+_0xf3ac77+'/'+_0x554548)[_0x2b31('0x1a')](_0x26b9dd);}return null;};}function patchUpdates(_0x1e5331){return function(_0x1afbc7){try{jsonpatch[_0x2b31('0x1e')](_0x1afbc7,_0x1e5331,!![]);}catch(_0x38a88b){return BPromise[_0x2b31('0x1f')](_0x38a88b);}return _0x1afbc7[_0x2b31('0x20')]();};}function saveUpdates(_0x2cc484,_0x103953){return function(_0x3df74d){if(_0x3df74d){return _0x3df74d[_0x2b31('0x21')](_0x2cc484)['then'](function(_0x48d3ba){return _0x48d3ba;});}return null;};}function removeEntity(_0x543856,_0xf65213){return function(_0x197511){if(_0x197511){return _0x197511[_0x2b31('0x22')]()[_0x2b31('0x23')](function(){var _0x2c02ab=_0x197511[_0x2b31('0x24')]({'plain':!![]});var _0x29d673=_0x2b31('0x25');return db['UserProfileResource'][_0x2b31('0x22')]({'where':{'type':_0x29d673,'resourceId':_0x2c02ab['id']}})[_0x2b31('0x23')](function(){return _0x197511;});})[_0x2b31('0x23')](function(){_0x543856[_0x2b31('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x795eef,_0x36a433){return function(_0x3ab95b){if(!_0x3ab95b){_0x795eef[_0x2b31('0x26')](0x194);}return _0x3ab95b;};}function handleError(_0x3c77c,_0x6ece74){_0x6ece74=_0x6ece74||0x1f4;return function(_0x1686eb){logger['error'](_0x1686eb['stack']);if(_0x1686eb[_0x2b31('0x27')]){delete _0x1686eb['name'];}_0x3c77c[_0x2b31('0x19')](_0x6ece74)[_0x2b31('0x28')](_0x1686eb);};}exports[_0x2b31('0x29')]=function(_0x15a1e9,_0x5e2561){var _0x24db94={},_0x121c29={},_0x56a60b={'count':0x0,'rows':[]};var _0xc99767=_['map'](db[_0x2b31('0x2a')][_0x2b31('0x2b')],function(_0x3ff77a){return{'name':_0x3ff77a['fieldName'],'type':_0x3ff77a[_0x2b31('0x2c')][_0x2b31('0x2d')]};});_0x121c29[_0x2b31('0x2e')]=_['map'](_0xc99767,_0x2b31('0x27'));_0x121c29[_0x2b31('0x2f')]=_['keys'](_0x15a1e9['query']);_0x121c29[_0x2b31('0x30')]=_[_0x2b31('0x31')](_0x121c29[_0x2b31('0x2e')],_0x121c29[_0x2b31('0x2f')]);_0x24db94[_0x2b31('0x32')]=_['intersection'](_0x121c29[_0x2b31('0x2e')],qs[_0x2b31('0x33')](_0x15a1e9[_0x2b31('0x2f')][_0x2b31('0x33')]));_0x24db94[_0x2b31('0x32')]=_0x24db94['attributes'][_0x2b31('0x34')]?_0x24db94[_0x2b31('0x32')]:_0x121c29[_0x2b31('0x2e')];if(!_0x15a1e9['query'][_0x2b31('0x35')](_0x2b31('0x36'))){_0x24db94['limit']=qs[_0x2b31('0x1d')](_0x15a1e9[_0x2b31('0x2f')]['limit']);_0x24db94[_0x2b31('0x1c')]=qs['offset'](_0x15a1e9['query'][_0x2b31('0x1c')]);}_0x24db94[_0x2b31('0x37')]=qs['sort'](_0x15a1e9[_0x2b31('0x2f')][_0x2b31('0x38')]);_0x24db94[_0x2b31('0x39')]=qs[_0x2b31('0x30')](_[_0x2b31('0x3a')](_0x15a1e9['query'],_0x121c29[_0x2b31('0x30')]),_0xc99767);if(_0x15a1e9[_0x2b31('0x2f')][_0x2b31('0x3b')]){_0x24db94[_0x2b31('0x39')]=_['merge'](_0x24db94[_0x2b31('0x39')],{'$or':_[_0x2b31('0x3c')](_0xc99767,function(_0x9df8eb){if(_0x9df8eb[_0x2b31('0x2c')]!==_0x2b31('0x3d')){var _0x340926={};_0x340926[_0x9df8eb[_0x2b31('0x27')]]={'$like':'%'+_0x15a1e9['query'][_0x2b31('0x3b')]+'%'};return _0x340926;}})});}_0x24db94=_[_0x2b31('0x3e')]({},_0x24db94,_0x15a1e9[_0x2b31('0x3f')]);var _0x1b4d4c={'where':_0x24db94['where']};return db[_0x2b31('0x2a')]['count'](_0x1b4d4c)[_0x2b31('0x23')](function(_0x1ad726){_0x56a60b[_0x2b31('0x1b')]=_0x1ad726;if(_0x15a1e9['query'][_0x2b31('0x40')]){_0x24db94[_0x2b31('0x41')]=[{'all':!![]}];}return db[_0x2b31('0x2a')][_0x2b31('0x42')](_0x24db94);})[_0x2b31('0x23')](function(_0x272bef){_0x56a60b[_0x2b31('0x43')]=_0x272bef;return _0x56a60b;})[_0x2b31('0x23')](respondWithFilteredResult(_0x5e2561,_0x24db94))[_0x2b31('0x44')](handleError(_0x5e2561,null));};exports[_0x2b31('0x45')]=function(_0x40b140,_0x219f2c){var _0x1f8cad={'raw':!![],'where':{'id':_0x40b140[_0x2b31('0x46')]['id']}},_0x280d3e={};_0x280d3e[_0x2b31('0x2e')]=_[_0x2b31('0x47')](db[_0x2b31('0x2a')][_0x2b31('0x2b')]);_0x280d3e[_0x2b31('0x2f')]=_[_0x2b31('0x47')](_0x40b140[_0x2b31('0x2f')]);_0x280d3e[_0x2b31('0x30')]=_[_0x2b31('0x31')](_0x280d3e['model'],_0x280d3e['query']);_0x1f8cad[_0x2b31('0x32')]=_[_0x2b31('0x31')](_0x280d3e[_0x2b31('0x2e')],qs[_0x2b31('0x33')](_0x40b140[_0x2b31('0x2f')][_0x2b31('0x33')]));_0x1f8cad[_0x2b31('0x32')]=_0x1f8cad[_0x2b31('0x32')][_0x2b31('0x34')]?_0x1f8cad[_0x2b31('0x32')]:_0x280d3e[_0x2b31('0x2e')];if(_0x40b140[_0x2b31('0x2f')]['includeAll']){_0x1f8cad[_0x2b31('0x41')]=[{'all':!![]}];}_0x1f8cad=_[_0x2b31('0x3e')]({},_0x1f8cad,_0x40b140['options']);return db[_0x2b31('0x2a')][_0x2b31('0x48')](_0x1f8cad)[_0x2b31('0x23')](handleEntityNotFound(_0x219f2c,null))['then'](respondWithResult(_0x219f2c,null))[_0x2b31('0x44')](handleError(_0x219f2c,null));};exports[_0x2b31('0x49')]=function(_0x467934,_0x32eeb5){return db['MailQueue'][_0x2b31('0x49')](_0x467934[_0x2b31('0x4a')],{})['then'](function(_0xf903fd){var _0x148374=_0x467934[_0x2b31('0x4b')][_0x2b31('0x24')]({'plain':!![]});if(!_0x148374)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x148374[_0x2b31('0x4c')]===_0x2b31('0x4b')){var _0x38f2a9=_0xf903fd[_0x2b31('0x24')]({'plain':!![]});var _0x2f50ff=_0x2b31('0x25');return db[_0x2b31('0x4d')][_0x2b31('0x48')]({'where':{'name':_0x2f50ff,'userProfileId':_0x148374[_0x2b31('0x4e')]},'raw':!![]})['then'](function(_0x595f0e){if(_0x595f0e&&_0x595f0e['autoAssociation']===0x0){return db[_0x2b31('0x4f')]['create']({'name':_0x38f2a9['name'],'resourceId':_0x38f2a9['id'],'type':_0x595f0e[_0x2b31('0x27')],'sectionId':_0x595f0e['id']},{})[_0x2b31('0x23')](function(){return _0xf903fd;});}else{return _0xf903fd;}})['catch'](function(_0x296522){logger[_0x2b31('0x50')](_0x2b31('0x51'),_0x296522);throw _0x296522;});}return _0xf903fd;})['then'](respondWithResult(_0x32eeb5,0xc9))[_0x2b31('0x44')](handleError(_0x32eeb5,null));};exports[_0x2b31('0x21')]=function(_0x1dc747,_0x5956d2){if(_0x1dc747['body']['id']){delete _0x1dc747[_0x2b31('0x4a')]['id'];}return db[_0x2b31('0x2a')][_0x2b31('0x48')]({'where':{'id':_0x1dc747[_0x2b31('0x46')]['id']}})[_0x2b31('0x23')](handleEntityNotFound(_0x5956d2,null))['then'](saveUpdates(_0x1dc747[_0x2b31('0x4a')],null))[_0x2b31('0x23')](respondWithResult(_0x5956d2,null))[_0x2b31('0x44')](handleError(_0x5956d2,null));};exports[_0x2b31('0x22')]=function(_0x4a052b,_0xd875e9){return db[_0x2b31('0x2a')][_0x2b31('0x48')]({'where':{'id':_0x4a052b[_0x2b31('0x46')]['id']}})['then'](handleEntityNotFound(_0xd875e9,null))[_0x2b31('0x23')](removeEntity(_0xd875e9,null))['catch'](handleError(_0xd875e9,null));};exports[_0x2b31('0x52')]=function(_0x2f6ec5,_0x197217){return db[_0x2b31('0x2a')][_0x2b31('0x52')]()[_0x2b31('0x23')](respondWithResult(_0x197217,null))['catch'](handleError(_0x197217,null));};exports[_0x2b31('0x53')]=function(_0x500c1a,_0x58a493,_0x15f581){var _0x422d89={'raw':!![],'where':{}},_0x2a4ee5={},_0x4df84e;return db[_0x2b31('0x2a')][_0x2b31('0x54')]({'where':{'id':_0x500c1a[_0x2b31('0x46')]['id']}})['then'](handleEntityNotFound(_0x58a493,null))[_0x2b31('0x23')](function(_0x49cad6){if(_0x49cad6){_0x4df84e=_0x49cad6[_0x2b31('0x24')]({'plain':!![]});_0x2a4ee5[_0x2b31('0x2e')]=_[_0x2b31('0x47')](db[_0x2b31('0x55')][_0x2b31('0x2b')]);_0x2a4ee5[_0x2b31('0x2f')]=_[_0x2b31('0x47')](_0x500c1a['query']);_0x2a4ee5['filters']=_[_0x2b31('0x31')](_0x2a4ee5[_0x2b31('0x2e')],_0x2a4ee5[_0x2b31('0x2f')]);_0x422d89[_0x2b31('0x32')]=_['intersection'](_0x2a4ee5[_0x2b31('0x2e')],qs[_0x2b31('0x33')](_0x500c1a[_0x2b31('0x2f')][_0x2b31('0x33')]));_0x422d89[_0x2b31('0x32')]=_0x422d89[_0x2b31('0x32')][_0x2b31('0x34')]?_0x422d89[_0x2b31('0x32')]:_0x2a4ee5[_0x2b31('0x2e')];if(!_0x500c1a['query'][_0x2b31('0x35')](_0x2b31('0x36'))){_0x422d89[_0x2b31('0x1d')]=qs[_0x2b31('0x1d')](_0x500c1a[_0x2b31('0x2f')]['limit']);_0x422d89['offset']=qs[_0x2b31('0x1c')](_0x500c1a[_0x2b31('0x2f')][_0x2b31('0x1c')]);}_0x422d89['order']=qs[_0x2b31('0x38')](_0x500c1a[_0x2b31('0x2f')][_0x2b31('0x38')]);_0x422d89['where']=qs[_0x2b31('0x30')](_[_0x2b31('0x3a')](_0x500c1a['query'],_0x2a4ee5['filters']));_0x422d89['where'][_0x2b31('0x56')]=_0x49cad6['id'];if(_0x500c1a[_0x2b31('0x2f')][_0x2b31('0x3b')]){_0x422d89[_0x2b31('0x39')]=_[_0x2b31('0x3e')](_0x422d89[_0x2b31('0x39')],{'$or':_[_0x2b31('0x3c')](_0x422d89[_0x2b31('0x32')],function(_0x5f0be3){var _0x551f4f={};_0x551f4f[_0x5f0be3]={'$like':'%'+_0x500c1a['query'][_0x2b31('0x3b')]+'%'};return _0x551f4f;})});}_0x422d89=_[_0x2b31('0x3e')]({},_0x422d89,_0x500c1a[_0x2b31('0x3f')]);return db[_0x2b31('0x55')][_0x2b31('0x42')](_0x422d89);}})[_0x2b31('0x23')](function(_0x385561){if(_0x385561){return db[_0x2b31('0x57')]['findAndCountAll']({'where':{'id':_[_0x2b31('0x3c')](_0x385561,_0x2b31('0x58')),'role':_0x2b31('0x59')},'attributes':['id','name','mailPause',_0x2b31('0x5a'),_0x2b31('0x5b')]});}})['then'](function(_0x154fc1){if(_0x154fc1){return{'count':_0x154fc1[_0x2b31('0x1b')],'rows':_[_0x2b31('0x3c')](_0x154fc1['rows'],function(_0x29a566){return{'membername':_0x29a566['name'],'UserId':_0x29a566['id'],'queue_name':_0x4df84e[_0x2b31('0x27')],'MailQueueId':_0x4df84e['id'],'interface':util['format'](_0x2b31('0x5c'),_0x2b31('0x5d'),_0x29a566['name']),'penalty':0x0,'paused':_0x29a566[_0x2b31('0x5e')],'createdAt':_0x29a566[_0x2b31('0x5b')],'updatedAt':_0x29a566[_0x2b31('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x58a493,_0x422d89))[_0x2b31('0x44')](handleError(_0x58a493,null));};exports[_0x2b31('0x5f')]=function(_0x38c506,_0x222af4,_0x5528b2){var _0x1a9932={};var _0x1258a8={};var _0x56e9a4;var _0xa02810;return db['MailQueue'][_0x2b31('0x54')]({'where':{'id':_0x38c506[_0x2b31('0x46')]['id']}})[_0x2b31('0x23')](handleEntityNotFound(_0x222af4,null))[_0x2b31('0x23')](function(_0x570765){if(_0x570765){_0x56e9a4=_0x570765;_0x1258a8['model']=_[_0x2b31('0x47')](db[_0x2b31('0x60')][_0x2b31('0x2b')]);_0x1258a8[_0x2b31('0x2f')]=_[_0x2b31('0x47')](_0x38c506[_0x2b31('0x2f')]);_0x1258a8['filters']=_[_0x2b31('0x31')](_0x1258a8[_0x2b31('0x2e')],_0x1258a8[_0x2b31('0x2f')]);_0x1a9932[_0x2b31('0x32')]=_[_0x2b31('0x31')](_0x1258a8[_0x2b31('0x2e')],qs['fields'](_0x38c506[_0x2b31('0x2f')][_0x2b31('0x33')]));_0x1a9932['attributes']=_0x1a9932['attributes'][_0x2b31('0x34')]?_0x1a9932[_0x2b31('0x32')]:_0x1258a8['model'];_0x1a9932[_0x2b31('0x37')]=qs['sort'](_0x38c506[_0x2b31('0x2f')][_0x2b31('0x38')]);_0x1a9932[_0x2b31('0x39')]=qs[_0x2b31('0x30')](_['pick'](_0x38c506[_0x2b31('0x2f')],_0x1258a8[_0x2b31('0x30')]));if(_0x38c506[_0x2b31('0x2f')][_0x2b31('0x3b')]){_0x1a9932['where']=_[_0x2b31('0x3e')](_0x1a9932['where'],{'$or':_[_0x2b31('0x3c')](_0x1a9932[_0x2b31('0x32')],function(_0x739861){var _0xa4451c={};_0xa4451c[_0x739861]={'$like':'%'+_0x38c506[_0x2b31('0x2f')][_0x2b31('0x3b')]+'%'};return _0xa4451c;})});}_0x1a9932=_['merge']({},_0x1a9932,_0x38c506[_0x2b31('0x3f')]);return _0x56e9a4[_0x2b31('0x5f')](_0x1a9932);}})[_0x2b31('0x23')](function(_0x474107){if(_0x474107){_0xa02810=_0x474107[_0x2b31('0x34')];if(!_0x38c506[_0x2b31('0x2f')][_0x2b31('0x35')](_0x2b31('0x36'))){_0x1a9932[_0x2b31('0x1d')]=qs['limit'](_0x38c506[_0x2b31('0x2f')][_0x2b31('0x1d')]);_0x1a9932[_0x2b31('0x1c')]=qs[_0x2b31('0x1c')](_0x38c506[_0x2b31('0x2f')][_0x2b31('0x1c')]);}return _0x56e9a4[_0x2b31('0x5f')](_0x1a9932);}})['then'](function(_0x2b4efe){if(_0x2b4efe){return _0x2b4efe?{'count':_0xa02810,'rows':_0x2b4efe}:null;}})[_0x2b31('0x23')](respondWithResult(_0x222af4,null))[_0x2b31('0x44')](handleError(_0x222af4,null));};exports[_0x2b31('0x61')]=function(_0x5554e3,_0x5d04ac,_0x98fd08){var _0x223fab=_0x5554e3[_0x2b31('0x4a')][_0x2b31('0x62')];return db[_0x2b31('0x60')][_0x2b31('0x42')]({'where':{'id':_0x223fab},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2b31('0x63'),'attributes':['id',_0x2b31('0x27'),_0x2b31('0x64'),_0x2b31('0x65'),'interface'],'raw':!![]}]})['then'](function(_0x328ee7){if(_0x328ee7){var _0x130a1a=_[_0x2b31('0x66')](_0x328ee7,function(_0x39f66d){var _0x18a6d5=_0x39f66d['get']({'plain':!![]});return _0x18a6d5['Agents'];});return db[_0x2b31('0x2a')][_0x2b31('0x48')]({'where':{'id':_0x5554e3['params']['id']}})[_0x2b31('0x23')](function(_0x47317f){return db[_0x2b31('0x67')]['transaction'](function(_0x57b02e){return _0x47317f[_0x2b31('0x61')](_0x223fab,{'transaction':_0x57b02e})['then'](function(){return BPromise['each'](_0x130a1a,function(_0x99a756){return db[_0x2b31('0x55')][_0x2b31('0x68')]({'where':{'UserId':_0x99a756['id'],'MailQueueId':_0x5554e3[_0x2b31('0x46')]['id']},'transaction':_0x57b02e});});})[_0x2b31('0x23')](function(){_0x130a1a['forEach'](function(_0x47d46c){socket[_0x2b31('0x69')](_0x2b31('0x6a'),{'UserId':_0x47d46c['id'],'MailQueueId':_0x47317f['id']});});});});});}})[_0x2b31('0x23')](respondWithStatusCode(_0x5d04ac,null))['catch'](handleError(_0x5d04ac,null));};exports['removeTeams']=function(_0x14f2db,_0x4d12a6,_0x48d8ae){return db[_0x2b31('0x60')][_0x2b31('0x42')]({'where':{'id':_0x14f2db[_0x2b31('0x2f')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2b31('0x57')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2b31('0x23')](handleEntityNotFound(_0x4d12a6,null))[_0x2b31('0x23')](function(_0x2ddb9d){var _0x3fe931=_['map'](_0x2ddb9d,'id');var _0x43ac3e=[];var _0x4c888f=[];var _0x229132=squel[_0x2b31('0x6b')]();_0x229132[_0x2b31('0x6c')](_0x2b31('0x6d'))[_0x2b31('0x6e')]('team_has_mail_queues','tq')[_0x2b31('0x6f')]('user_has_teams','ut',_0x2b31('0x70'))[_0x2b31('0x39')](_0x2b31('0x71'),_0x14f2db[_0x2b31('0x46')]['id']);for(var _0x314d3d=0x0;_0x314d3d<_0x2ddb9d[_0x2b31('0x34')];_0x314d3d+=0x1){let _0x13e484=_0x2ddb9d[_0x314d3d];for(var _0x5fd13b=0x0;_0x5fd13b<_0x13e484['Agents'][_0x2b31('0x34')];_0x5fd13b+=0x1){let _0x286539=_0x13e484[_0x2b31('0x63')][_0x5fd13b];var _0x131ddf=_0x229132[_0x2b31('0x72')]();_0x131ddf['where'](_0x2b31('0x73'),_0x286539['id']);_0x4c888f[_0x2b31('0x74')](db[_0x2b31('0x67')][_0x2b31('0x2f')](_0x131ddf['toString'](),{'type':db[_0x2b31('0x67')][_0x2b31('0x75')]['SELECT']})[_0x2b31('0x23')](function(_0x1c2fd1){if(_0x1c2fd1['length']===0x1){return _0x286539['id'];}else{var _0x1e96c2=_[_0x2b31('0x76')](_[_0x2b31('0x3c')](_0x1c2fd1,_0x2b31('0x77')),function(_0x84d7d9){return _[_0x2b31('0x78')](_0x3fe931,_0x84d7d9);});if(_0x1e96c2){return _0x286539['id'];}}}));}}return BPromise[_0x2b31('0x79')](_0x4c888f)['then'](function(_0xcbc684){_0x43ac3e=_(_0x43ac3e)[_0x2b31('0x7a')](_0xcbc684)[_0x2b31('0x7b')]()[_0x2b31('0x7c')]();return db[_0x2b31('0x2a')][_0x2b31('0x48')]({'where':{'id':_0x14f2db['params']['id']}})[_0x2b31('0x23')](function(_0x5dc9fc){return db[_0x2b31('0x67')][_0x2b31('0x7d')](function(_0x2da4e0){return _0x5dc9fc[_0x2b31('0x7e')](_0x14f2db[_0x2b31('0x2f')][_0x2b31('0x62')],{'transaction':_0x2da4e0})['then'](function(){if(!_[_0x2b31('0x7f')](_0x43ac3e)){return _0x5dc9fc[_0x2b31('0x80')](_0x43ac3e,{'transaction':_0x2da4e0});}})[_0x2b31('0x23')](function(){_0x43ac3e[_0x2b31('0x81')](function(_0x556505){socket['emit']('userMailQueue:remove',{'UserId':_0x556505,'MailQueueId':_0x5dc9fc['id']});});});});});});})[_0x2b31('0x23')](respondWithStatusCode(_0x4d12a6,null))[_0x2b31('0x44')](handleError(_0x4d12a6,null));};exports['addAgents']=function(_0x1ad3a1,_0x4de06b,_0x11b7fe){return db[_0x2b31('0x2a')][_0x2b31('0x48')]({'where':{'id':_0x1ad3a1['params']['id']}})[_0x2b31('0x23')](handleEntityNotFound(_0x4de06b,null))[_0x2b31('0x23')](function(_0x278857){if(_0x278857){return _0x278857[_0x2b31('0x82')](_0x1ad3a1[_0x2b31('0x4a')][_0x2b31('0x62')],_[_0x2b31('0x83')](_0x1ad3a1[_0x2b31('0x4a')],[_0x2b31('0x62'),'id'])||{})[_0x2b31('0x84')](function(_0x1c5f4d){for(var _0x26d3b2=0x0;_0x26d3b2<_0x1ad3a1[_0x2b31('0x4a')][_0x2b31('0x62')][_0x2b31('0x34')];_0x26d3b2+=0x1){socket[_0x2b31('0x69')]('userMailQueue:save',{'UserId':_0x1ad3a1[_0x2b31('0x4a')][_0x2b31('0x62')][_0x26d3b2],'MailQueueId':_0x1ad3a1[_0x2b31('0x46')]['id']});}return _0x1c5f4d;});}})[_0x2b31('0x23')](respondWithResult(_0x4de06b,null))[_0x2b31('0x44')](handleError(_0x4de06b,null));};exports[_0x2b31('0x80')]=function(_0x4cc067,_0x4423d4,_0x5501a1){return db['MailQueue'][_0x2b31('0x48')]({'where':{'id':_0x4cc067[_0x2b31('0x46')]['id']}})['then'](handleEntityNotFound(_0x4423d4,null))[_0x2b31('0x23')](function(_0xfa5f79){if(_0xfa5f79){return _0xfa5f79['removeAgents'](_0x4cc067['query'][_0x2b31('0x62')])[_0x2b31('0x23')](function(){if(_[_0x2b31('0x85')](_0x4cc067['query'][_0x2b31('0x62')])){for(var _0x5c88c0=0x0;_0x5c88c0<_0x4cc067[_0x2b31('0x2f')][_0x2b31('0x62')][_0x2b31('0x34')];_0x5c88c0+=0x1){socket[_0x2b31('0x69')]('userMailQueue:remove',{'UserId':Number(_0x4cc067[_0x2b31('0x2f')]['ids'][_0x5c88c0]),'MailQueueId':Number(_0x4cc067[_0x2b31('0x46')]['id'])});}}else{socket[_0x2b31('0x69')](_0x2b31('0x86'),{'UserId':Number(_0x4cc067['query'][_0x2b31('0x62')]),'MailQueueId':Number(_0x4cc067[_0x2b31('0x46')]['id'])});}});}})[_0x2b31('0x23')](respondWithStatusCode(_0x4423d4,null))[_0x2b31('0x44')](handleError(_0x4423d4,null));};exports['getAgents']=function(_0x4ad457,_0x9719c8,_0x151f35){var _0x4dc57e={};var _0x11163d={};var _0x34a55a;var _0x118f5f;return db[_0x2b31('0x2a')]['findOne']({'where':{'id':_0x4ad457['params']['id']}})[_0x2b31('0x23')](handleEntityNotFound(_0x9719c8,null))[_0x2b31('0x23')](function(_0x3246aa){if(_0x3246aa){_0x34a55a=_0x3246aa;_0x11163d[_0x2b31('0x2e')]=_[_0x2b31('0x47')](db[_0x2b31('0x57')]['rawAttributes']);_0x11163d['query']=_[_0x2b31('0x47')](_0x4ad457[_0x2b31('0x2f')]);_0x11163d[_0x2b31('0x30')]=_[_0x2b31('0x31')](_0x11163d[_0x2b31('0x2e')],_0x11163d[_0x2b31('0x2f')]);_0x4dc57e[_0x2b31('0x32')]=_[_0x2b31('0x31')](_0x11163d[_0x2b31('0x2e')],qs[_0x2b31('0x33')](_0x4ad457[_0x2b31('0x2f')]['fields']));_0x4dc57e[_0x2b31('0x32')]=_0x4dc57e[_0x2b31('0x32')][_0x2b31('0x34')]?_0x4dc57e[_0x2b31('0x32')]:_0x11163d[_0x2b31('0x2e')];_0x4dc57e['order']=qs['sort'](_0x4ad457[_0x2b31('0x2f')][_0x2b31('0x38')]);_0x4dc57e['where']=qs[_0x2b31('0x30')](_[_0x2b31('0x3a')](_0x4ad457['query'],_0x11163d['filters']));if(_0x4ad457[_0x2b31('0x2f')][_0x2b31('0x3b')]){_0x4dc57e[_0x2b31('0x39')]=_[_0x2b31('0x3e')](_0x4dc57e['where'],{'$or':_[_0x2b31('0x3c')](_0x4dc57e[_0x2b31('0x32')],function(_0x36127f){var _0x4a4fea={};_0x4a4fea[_0x36127f]={'$like':'%'+_0x4ad457[_0x2b31('0x2f')][_0x2b31('0x3b')]+'%'};return _0x4a4fea;})});}_0x4dc57e=_['merge']({},_0x4dc57e,_0x4ad457[_0x2b31('0x3f')]);return _0x34a55a['getAgents'](_0x4dc57e);}})[_0x2b31('0x23')](function(_0x3b6c12){if(_0x3b6c12){_0x118f5f=_0x3b6c12[_0x2b31('0x34')];if(!_0x4ad457[_0x2b31('0x2f')][_0x2b31('0x35')](_0x2b31('0x36'))){_0x4dc57e['limit']=qs[_0x2b31('0x1d')](_0x4ad457[_0x2b31('0x2f')][_0x2b31('0x1d')]);_0x4dc57e[_0x2b31('0x1c')]=qs[_0x2b31('0x1c')](_0x4ad457['query'][_0x2b31('0x1c')]);}return _0x34a55a['getAgents'](_0x4dc57e);}})[_0x2b31('0x23')](function(_0x4017c7){if(_0x4017c7){return _0x4017c7?{'count':_0x118f5f,'rows':_0x4017c7}:null;}})[_0x2b31('0x23')](respondWithResult(_0x9719c8,null))[_0x2b31('0x44')](handleError(_0x9719c8,null));}; \ No newline at end of file +var _0x66ab=['removeAgents','userMailQueue:remove','addAgents','omit','spread','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./mailQueue.socket','register','status','json','offset','set','Content-Range','apply','save','then','destroy','get','UserProfileResource','end','sendStatus','error','stack','name','index','MailQueue','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','order','MailQueueId','UserMailQueue','User','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','emit','userMailQueue:save','select','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','push','toString','QueryTypes','includes','compact','value','removeTeams'];(function(_0x573a7d,_0x7790d5){var _0x2d086a=function(_0xe08305){while(--_0xe08305){_0x573a7d['push'](_0x573a7d['shift']());}};_0x2d086a(++_0x7790d5);}(_0x66ab,0x11a));var _0xb66a=function(_0x21e31a,_0x4ccba8){_0x21e31a=_0x21e31a-0x0;var _0xec881d=_0x66ab[_0x21e31a];return _0xec881d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb66a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb66a('0x1'));var jsonpatch=require(_0xb66a('0x2'));var rp=require(_0xb66a('0x3'));var moment=require(_0xb66a('0x4'));var BPromise=require(_0xb66a('0x5'));var Mustache=require(_0xb66a('0x6'));var util=require(_0xb66a('0x7'));var path=require('path');var sox=require(_0xb66a('0x8'));var csv=require('to-csv');var ejs=require(_0xb66a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb66a('0xa'));var squel=require('squel');var crypto=require(_0xb66a('0xb'));var jsforce=require(_0xb66a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb66a('0xd'));var querystring=require(_0xb66a('0xe'));var Papa=require('papaparse');var Redis=require(_0xb66a('0xf'));var authService=require(_0xb66a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb66a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb66a('0x12'))('api');var utils=require(_0xb66a('0x13'));var config=require(_0xb66a('0x14'));var licenseUtil=require(_0xb66a('0x15'));var db=require(_0xb66a('0x16'))['db'];config['redis']=_[_0xb66a('0x17')](config[_0xb66a('0x18')],{'host':_0xb66a('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb66a('0x18')]));require(_0xb66a('0x1a'))[_0xb66a('0x1b')](socket);function respondWithStatusCode(_0x4bc508,_0x2803ea){_0x2803ea=_0x2803ea||0xcc;return function(_0x53aaf9){if(_0x53aaf9){return _0x4bc508['sendStatus'](_0x2803ea);}return _0x4bc508[_0xb66a('0x1c')](_0x2803ea)['end']();};}function respondWithResult(_0x219eed,_0x5e2101){_0x5e2101=_0x5e2101||0xc8;return function(_0x2aaac3){if(_0x2aaac3){return _0x219eed[_0xb66a('0x1c')](_0x5e2101)[_0xb66a('0x1d')](_0x2aaac3);}};}function respondWithFilteredResult(_0x65495b,_0x45d810){return function(_0x98ab6b){if(_0x98ab6b){var _0x49b2a5=_0x98ab6b['count'],_0x20c5e6=_0x45d810[_0xb66a('0x1e')],_0x14387b=_0x45d810[_0xb66a('0x1e')]+_0x45d810['limit'],_0x5c4666;if(_0x14387b>=_0x49b2a5){_0x14387b=_0x49b2a5;_0x5c4666=0xc8;}else{_0x5c4666=0xce;}_0x65495b[_0xb66a('0x1c')](_0x5c4666);return _0x65495b[_0xb66a('0x1f')](_0xb66a('0x20'),_0x20c5e6+'-'+_0x14387b+'/'+_0x49b2a5)[_0xb66a('0x1d')](_0x98ab6b);}return null;};}function patchUpdates(_0x202ee9){return function(_0x213e46){try{jsonpatch[_0xb66a('0x21')](_0x213e46,_0x202ee9,!![]);}catch(_0x394cea){return BPromise['reject'](_0x394cea);}return _0x213e46[_0xb66a('0x22')]();};}function saveUpdates(_0xf36cd6,_0x583a6e){return function(_0x9f53b0){if(_0x9f53b0){return _0x9f53b0['update'](_0xf36cd6)[_0xb66a('0x23')](function(_0x482703){return _0x482703;});}return null;};}function removeEntity(_0x701375,_0x3f1205){return function(_0x46e875){if(_0x46e875){return _0x46e875[_0xb66a('0x24')]()['then'](function(){var _0x272649=_0x46e875[_0xb66a('0x25')]({'plain':!![]});var _0x6304='MailQueues';return db[_0xb66a('0x26')][_0xb66a('0x24')]({'where':{'type':_0x6304,'resourceId':_0x272649['id']}})['then'](function(){return _0x46e875;});})[_0xb66a('0x23')](function(){_0x701375['status'](0xcc)[_0xb66a('0x27')]();});}};}function handleEntityNotFound(_0x19cbcc,_0x1a215b){return function(_0x1c0cdc){if(!_0x1c0cdc){_0x19cbcc[_0xb66a('0x28')](0x194);}return _0x1c0cdc;};}function handleError(_0x51f9d1,_0x3babc4){_0x3babc4=_0x3babc4||0x1f4;return function(_0x14fc0a){logger[_0xb66a('0x29')](_0x14fc0a[_0xb66a('0x2a')]);if(_0x14fc0a['name']){delete _0x14fc0a[_0xb66a('0x2b')];}_0x51f9d1['status'](_0x3babc4)['send'](_0x14fc0a);};}exports[_0xb66a('0x2c')]=function(_0x5815a8,_0x5e7a76){var _0x23ee16={},_0x27c382={},_0x577979={'count':0x0,'rows':[]};var _0x5d8b9c=_['map'](db[_0xb66a('0x2d')][_0xb66a('0x2e')],function(_0x492d08){return{'name':_0x492d08[_0xb66a('0x2f')],'type':_0x492d08[_0xb66a('0x30')][_0xb66a('0x31')]};});_0x27c382['model']=_[_0xb66a('0x32')](_0x5d8b9c,_0xb66a('0x2b'));_0x27c382[_0xb66a('0x33')]=_[_0xb66a('0x34')](_0x5815a8[_0xb66a('0x33')]);_0x27c382[_0xb66a('0x35')]=_[_0xb66a('0x36')](_0x27c382[_0xb66a('0x37')],_0x27c382[_0xb66a('0x33')]);_0x23ee16[_0xb66a('0x38')]=_[_0xb66a('0x36')](_0x27c382[_0xb66a('0x37')],qs[_0xb66a('0x39')](_0x5815a8[_0xb66a('0x33')]['fields']));_0x23ee16[_0xb66a('0x38')]=_0x23ee16[_0xb66a('0x38')]['length']?_0x23ee16[_0xb66a('0x38')]:_0x27c382[_0xb66a('0x37')];if(!_0x5815a8[_0xb66a('0x33')][_0xb66a('0x3a')](_0xb66a('0x3b'))){_0x23ee16[_0xb66a('0x3c')]=qs[_0xb66a('0x3c')](_0x5815a8[_0xb66a('0x33')]['limit']);_0x23ee16[_0xb66a('0x1e')]=qs['offset'](_0x5815a8['query'][_0xb66a('0x1e')]);}_0x23ee16['order']=qs[_0xb66a('0x3d')](_0x5815a8['query'][_0xb66a('0x3d')]);_0x23ee16[_0xb66a('0x3e')]=qs[_0xb66a('0x35')](_[_0xb66a('0x3f')](_0x5815a8[_0xb66a('0x33')],_0x27c382[_0xb66a('0x35')]),_0x5d8b9c);if(_0x5815a8[_0xb66a('0x33')][_0xb66a('0x40')]){_0x23ee16[_0xb66a('0x3e')]=_[_0xb66a('0x41')](_0x23ee16[_0xb66a('0x3e')],{'$or':_[_0xb66a('0x32')](_0x5d8b9c,function(_0x11a03f){if(_0x11a03f[_0xb66a('0x30')]!==_0xb66a('0x42')){var _0x18cf33={};_0x18cf33[_0x11a03f['name']]={'$like':'%'+_0x5815a8[_0xb66a('0x33')][_0xb66a('0x40')]+'%'};return _0x18cf33;}})});}_0x23ee16=_['merge']({},_0x23ee16,_0x5815a8[_0xb66a('0x43')]);var _0x4b18c8={'where':_0x23ee16['where']};return db[_0xb66a('0x2d')][_0xb66a('0x44')](_0x4b18c8)[_0xb66a('0x23')](function(_0x1a3abb){_0x577979['count']=_0x1a3abb;if(_0x5815a8[_0xb66a('0x33')][_0xb66a('0x45')]){_0x23ee16[_0xb66a('0x46')]=[{'all':!![]}];}return db[_0xb66a('0x2d')][_0xb66a('0x47')](_0x23ee16);})[_0xb66a('0x23')](function(_0x4a318c){_0x577979[_0xb66a('0x48')]=_0x4a318c;return _0x577979;})[_0xb66a('0x23')](respondWithFilteredResult(_0x5e7a76,_0x23ee16))[_0xb66a('0x49')](handleError(_0x5e7a76,null));};exports[_0xb66a('0x4a')]=function(_0x18c430,_0x5e1a62){var _0x3d2d0d={'raw':!![],'where':{'id':_0x18c430[_0xb66a('0x4b')]['id']}},_0x149f8d={};_0x149f8d['model']=_[_0xb66a('0x34')](db[_0xb66a('0x2d')][_0xb66a('0x2e')]);_0x149f8d[_0xb66a('0x33')]=_[_0xb66a('0x34')](_0x18c430[_0xb66a('0x33')]);_0x149f8d[_0xb66a('0x35')]=_[_0xb66a('0x36')](_0x149f8d[_0xb66a('0x37')],_0x149f8d['query']);_0x3d2d0d[_0xb66a('0x38')]=_[_0xb66a('0x36')](_0x149f8d[_0xb66a('0x37')],qs['fields'](_0x18c430[_0xb66a('0x33')]['fields']));_0x3d2d0d['attributes']=_0x3d2d0d[_0xb66a('0x38')][_0xb66a('0x4c')]?_0x3d2d0d[_0xb66a('0x38')]:_0x149f8d[_0xb66a('0x37')];if(_0x18c430[_0xb66a('0x33')][_0xb66a('0x45')]){_0x3d2d0d[_0xb66a('0x46')]=[{'all':!![]}];}_0x3d2d0d=_[_0xb66a('0x41')]({},_0x3d2d0d,_0x18c430[_0xb66a('0x43')]);return db['MailQueue'][_0xb66a('0x4d')](_0x3d2d0d)[_0xb66a('0x23')](handleEntityNotFound(_0x5e1a62,null))['then'](respondWithResult(_0x5e1a62,null))[_0xb66a('0x49')](handleError(_0x5e1a62,null));};exports['create']=function(_0x2dfd55,_0x20a797){return db['MailQueue'][_0xb66a('0x4e')](_0x2dfd55[_0xb66a('0x4f')],{})[_0xb66a('0x23')](function(_0x2fccf0){var _0x468eb6=_0x2dfd55[_0xb66a('0x50')]['get']({'plain':!![]});if(!_0x468eb6)throw new Error(_0xb66a('0x51'));if(_0x468eb6[_0xb66a('0x52')]==='user'){var _0x20b00a=_0x2fccf0[_0xb66a('0x25')]({'plain':!![]});var _0x2cacd9=_0xb66a('0x53');return db[_0xb66a('0x54')][_0xb66a('0x4d')]({'where':{'name':_0x2cacd9,'userProfileId':_0x468eb6[_0xb66a('0x55')]},'raw':!![]})['then'](function(_0x20c987){if(_0x20c987&&_0x20c987['autoAssociation']===0x0){return db[_0xb66a('0x26')]['create']({'name':_0x20b00a[_0xb66a('0x2b')],'resourceId':_0x20b00a['id'],'type':_0x20c987[_0xb66a('0x2b')],'sectionId':_0x20c987['id']},{})['then'](function(){return _0x2fccf0;});}else{return _0x2fccf0;}})[_0xb66a('0x49')](function(_0x557183){logger[_0xb66a('0x29')](_0xb66a('0x56'),_0x557183);throw _0x557183;});}return _0x2fccf0;})[_0xb66a('0x23')](respondWithResult(_0x20a797,0xc9))['catch'](handleError(_0x20a797,null));};exports[_0xb66a('0x57')]=function(_0x559f41,_0x105e50){if(_0x559f41[_0xb66a('0x4f')]['id']){delete _0x559f41[_0xb66a('0x4f')]['id'];}return db[_0xb66a('0x2d')][_0xb66a('0x4d')]({'where':{'id':_0x559f41[_0xb66a('0x4b')]['id']}})[_0xb66a('0x23')](handleEntityNotFound(_0x105e50,null))['then'](saveUpdates(_0x559f41[_0xb66a('0x4f')],null))[_0xb66a('0x23')](respondWithResult(_0x105e50,null))[_0xb66a('0x49')](handleError(_0x105e50,null));};exports[_0xb66a('0x24')]=function(_0x4ebb80,_0x3e4371){return db[_0xb66a('0x2d')][_0xb66a('0x4d')]({'where':{'id':_0x4ebb80[_0xb66a('0x4b')]['id']}})[_0xb66a('0x23')](handleEntityNotFound(_0x3e4371,null))[_0xb66a('0x23')](removeEntity(_0x3e4371,null))['catch'](handleError(_0x3e4371,null));};exports['describe']=function(_0x4278ba,_0xc475be){return db['MailQueue']['describe']()['then'](respondWithResult(_0xc475be,null))['catch'](handleError(_0xc475be,null));};exports['getMembers']=function(_0x232992,_0x2579aa,_0x5588c9){var _0x573c63={'raw':!![],'where':{}},_0x17147d={},_0x3f6ab9;return db[_0xb66a('0x2d')][_0xb66a('0x58')]({'where':{'id':_0x232992[_0xb66a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2579aa,null))[_0xb66a('0x23')](function(_0x57e669){if(_0x57e669){_0x3f6ab9=_0x57e669[_0xb66a('0x25')]({'plain':!![]});_0x17147d[_0xb66a('0x37')]=_[_0xb66a('0x34')](db['UserMailQueue'][_0xb66a('0x2e')]);_0x17147d['query']=_['keys'](_0x232992['query']);_0x17147d[_0xb66a('0x35')]=_[_0xb66a('0x36')](_0x17147d[_0xb66a('0x37')],_0x17147d[_0xb66a('0x33')]);_0x573c63[_0xb66a('0x38')]=_[_0xb66a('0x36')](_0x17147d[_0xb66a('0x37')],qs[_0xb66a('0x39')](_0x232992[_0xb66a('0x33')][_0xb66a('0x39')]));_0x573c63[_0xb66a('0x38')]=_0x573c63[_0xb66a('0x38')][_0xb66a('0x4c')]?_0x573c63[_0xb66a('0x38')]:_0x17147d['model'];if(!_0x232992['query'][_0xb66a('0x3a')]('nolimit')){_0x573c63[_0xb66a('0x3c')]=qs[_0xb66a('0x3c')](_0x232992[_0xb66a('0x33')][_0xb66a('0x3c')]);_0x573c63[_0xb66a('0x1e')]=qs[_0xb66a('0x1e')](_0x232992[_0xb66a('0x33')][_0xb66a('0x1e')]);}_0x573c63[_0xb66a('0x59')]=qs['sort'](_0x232992[_0xb66a('0x33')][_0xb66a('0x3d')]);_0x573c63['where']=qs['filters'](_['pick'](_0x232992[_0xb66a('0x33')],_0x17147d[_0xb66a('0x35')]));_0x573c63[_0xb66a('0x3e')][_0xb66a('0x5a')]=_0x57e669['id'];if(_0x232992['query']['filter']){_0x573c63[_0xb66a('0x3e')]=_[_0xb66a('0x41')](_0x573c63[_0xb66a('0x3e')],{'$or':_[_0xb66a('0x32')](_0x573c63[_0xb66a('0x38')],function(_0x22a593){var _0x19d568={};_0x19d568[_0x22a593]={'$like':'%'+_0x232992[_0xb66a('0x33')][_0xb66a('0x40')]+'%'};return _0x19d568;})});}_0x573c63=_[_0xb66a('0x41')]({},_0x573c63,_0x232992['options']);return db[_0xb66a('0x5b')][_0xb66a('0x47')](_0x573c63);}})['then'](function(_0x5888a5){if(_0x5888a5){return db[_0xb66a('0x5c')]['findAndCountAll']({'where':{'id':_[_0xb66a('0x32')](_0x5888a5,_0xb66a('0x5d')),'role':_0xb66a('0x5e')},'attributes':['id','name',_0xb66a('0x5f'),_0xb66a('0x60'),_0xb66a('0x61')]});}})['then'](function(_0xc2c5e4){if(_0xc2c5e4){return{'count':_0xc2c5e4['count'],'rows':_['map'](_0xc2c5e4[_0xb66a('0x48')],function(_0x3f5fd8){return{'membername':_0x3f5fd8[_0xb66a('0x2b')],'UserId':_0x3f5fd8['id'],'queue_name':_0x3f6ab9[_0xb66a('0x2b')],'MailQueueId':_0x3f6ab9['id'],'interface':util[_0xb66a('0x62')](_0xb66a('0x63'),_0xb66a('0x64'),_0x3f5fd8[_0xb66a('0x2b')]),'penalty':0x0,'paused':_0x3f5fd8[_0xb66a('0x5f')],'createdAt':_0x3f5fd8[_0xb66a('0x61')],'updatedAt':_0x3f5fd8[_0xb66a('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2579aa,_0x573c63))['catch'](handleError(_0x2579aa,null));};exports['getTeams']=function(_0x2eba56,_0x465484,_0x2b344f){var _0x20c0dc={};var _0x4bdbde={};var _0x2f4404;var _0x48e974;return db[_0xb66a('0x2d')]['findOne']({'where':{'id':_0x2eba56['params']['id']}})[_0xb66a('0x23')](handleEntityNotFound(_0x465484,null))[_0xb66a('0x23')](function(_0xd598cc){if(_0xd598cc){_0x2f4404=_0xd598cc;_0x4bdbde[_0xb66a('0x37')]=_[_0xb66a('0x34')](db[_0xb66a('0x65')][_0xb66a('0x2e')]);_0x4bdbde['query']=_[_0xb66a('0x34')](_0x2eba56[_0xb66a('0x33')]);_0x4bdbde[_0xb66a('0x35')]=_[_0xb66a('0x36')](_0x4bdbde['model'],_0x4bdbde[_0xb66a('0x33')]);_0x20c0dc[_0xb66a('0x38')]=_[_0xb66a('0x36')](_0x4bdbde[_0xb66a('0x37')],qs[_0xb66a('0x39')](_0x2eba56[_0xb66a('0x33')][_0xb66a('0x39')]));_0x20c0dc[_0xb66a('0x38')]=_0x20c0dc['attributes']['length']?_0x20c0dc[_0xb66a('0x38')]:_0x4bdbde[_0xb66a('0x37')];_0x20c0dc[_0xb66a('0x59')]=qs[_0xb66a('0x3d')](_0x2eba56[_0xb66a('0x33')][_0xb66a('0x3d')]);_0x20c0dc['where']=qs[_0xb66a('0x35')](_['pick'](_0x2eba56['query'],_0x4bdbde[_0xb66a('0x35')]));if(_0x2eba56[_0xb66a('0x33')][_0xb66a('0x40')]){_0x20c0dc[_0xb66a('0x3e')]=_[_0xb66a('0x41')](_0x20c0dc[_0xb66a('0x3e')],{'$or':_['map'](_0x20c0dc[_0xb66a('0x38')],function(_0xf31dbd){var _0x1fd2bf={};_0x1fd2bf[_0xf31dbd]={'$like':'%'+_0x2eba56[_0xb66a('0x33')][_0xb66a('0x40')]+'%'};return _0x1fd2bf;})});}_0x20c0dc=_[_0xb66a('0x41')]({},_0x20c0dc,_0x2eba56[_0xb66a('0x43')]);return _0x2f4404[_0xb66a('0x66')](_0x20c0dc);}})[_0xb66a('0x23')](function(_0x2a5a5a){if(_0x2a5a5a){_0x48e974=_0x2a5a5a[_0xb66a('0x4c')];if(!_0x2eba56[_0xb66a('0x33')][_0xb66a('0x3a')]('nolimit')){_0x20c0dc['limit']=qs[_0xb66a('0x3c')](_0x2eba56[_0xb66a('0x33')]['limit']);_0x20c0dc[_0xb66a('0x1e')]=qs['offset'](_0x2eba56[_0xb66a('0x33')][_0xb66a('0x1e')]);}return _0x2f4404['getTeams'](_0x20c0dc);}})[_0xb66a('0x23')](function(_0x4e9628){if(_0x4e9628){return _0x4e9628?{'count':_0x48e974,'rows':_0x4e9628}:null;}})['then'](respondWithResult(_0x465484,null))[_0xb66a('0x49')](handleError(_0x465484,null));};exports[_0xb66a('0x67')]=function(_0x5313cf,_0x1724ff,_0x18e49d){var _0x5881f4=_0x5313cf[_0xb66a('0x4f')][_0xb66a('0x68')];return db[_0xb66a('0x65')][_0xb66a('0x47')]({'where':{'id':_0x5881f4},'attributes':['id'],'include':[{'model':db[_0xb66a('0x5c')],'as':'Agents','attributes':['id',_0xb66a('0x2b'),_0xb66a('0x69'),_0xb66a('0x6a'),_0xb66a('0x6b')],'raw':!![]}]})[_0xb66a('0x23')](function(_0x2c5a4e){if(_0x2c5a4e){var _0x2a58fb=_[_0xb66a('0x6c')](_0x2c5a4e,function(_0xc519c7){var _0x376dc2=_0xc519c7['get']({'plain':!![]});return _0x376dc2[_0xb66a('0x6d')];});return db[_0xb66a('0x2d')]['find']({'where':{'id':_0x5313cf[_0xb66a('0x4b')]['id']}})['then'](function(_0x429480){return db[_0xb66a('0x6e')][_0xb66a('0x6f')](function(_0xa99462){return _0x429480[_0xb66a('0x67')](_0x5881f4,{'transaction':_0xa99462})[_0xb66a('0x23')](function(){return BPromise[_0xb66a('0x70')](_0x2a58fb,function(_0x3062c0){return db[_0xb66a('0x5b')]['findOrCreate']({'where':{'UserId':_0x3062c0['id'],'MailQueueId':_0x5313cf[_0xb66a('0x4b')]['id']},'transaction':_0xa99462});});})[_0xb66a('0x23')](function(){_0x2a58fb[_0xb66a('0x71')](function(_0x32ce5f){socket[_0xb66a('0x72')](_0xb66a('0x73'),{'UserId':_0x32ce5f['id'],'MailQueueId':_0x429480['id']});});});});});}})[_0xb66a('0x23')](respondWithStatusCode(_0x1724ff,null))[_0xb66a('0x49')](handleError(_0x1724ff,null));};exports['removeTeams']=function(_0x4d65dc,_0x18249c,_0x52c968){return db[_0xb66a('0x65')][_0xb66a('0x47')]({'where':{'id':_0x4d65dc[_0xb66a('0x33')][_0xb66a('0x68')]},'attributes':['id'],'include':[{'model':db[_0xb66a('0x5c')],'as':_0xb66a('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xb66a('0x23')](handleEntityNotFound(_0x18249c,null))[_0xb66a('0x23')](function(_0x53db85){var _0xb77a66=_[_0xb66a('0x32')](_0x53db85,'id');var _0x439a02=[];var _0x557418=[];var _0x372cc0=squel[_0xb66a('0x74')]();_0x372cc0['field'](_0xb66a('0x75'))[_0xb66a('0x76')](_0xb66a('0x77'),'tq')[_0xb66a('0x78')](_0xb66a('0x79'),'ut',_0xb66a('0x7a'))[_0xb66a('0x3e')](_0xb66a('0x7b'),_0x4d65dc[_0xb66a('0x4b')]['id']);for(var _0x127e44=0x0;_0x127e44<_0x53db85['length'];_0x127e44+=0x1){let _0x4f6c21=_0x53db85[_0x127e44];for(var _0x432283=0x0;_0x432283<_0x4f6c21[_0xb66a('0x6d')]['length'];_0x432283+=0x1){let _0x378d2a=_0x4f6c21['Agents'][_0x432283];var _0xdcedbd=_0x372cc0[_0xb66a('0x7c')]();_0xdcedbd[_0xb66a('0x3e')]('ut.UserId\x20=\x20?',_0x378d2a['id']);_0x557418[_0xb66a('0x7d')](db['sequelize'][_0xb66a('0x33')](_0xdcedbd[_0xb66a('0x7e')](),{'type':db[_0xb66a('0x6e')][_0xb66a('0x7f')]['SELECT']})[_0xb66a('0x23')](function(_0x176ff0){if(_0x176ff0[_0xb66a('0x4c')]===0x1){return _0x378d2a['id'];}else{var _0x379c6b=_['every'](_[_0xb66a('0x32')](_0x176ff0,'TeamId'),function(_0x5c1d1e){return _[_0xb66a('0x80')](_0xb77a66,_0x5c1d1e);});if(_0x379c6b){return _0x378d2a['id'];}}}));}}return BPromise['all'](_0x557418)['then'](function(_0xd36645){_0x439a02=_(_0x439a02)['union'](_0xd36645)[_0xb66a('0x81')]()[_0xb66a('0x82')]();return db['MailQueue'][_0xb66a('0x4d')]({'where':{'id':_0x4d65dc[_0xb66a('0x4b')]['id']}})['then'](function(_0x1b0818){return db[_0xb66a('0x6e')][_0xb66a('0x6f')](function(_0x3e592f){return _0x1b0818[_0xb66a('0x83')](_0x4d65dc['query']['ids'],{'transaction':_0x3e592f})['then'](function(){if(!_['isEmpty'](_0x439a02)){return _0x1b0818[_0xb66a('0x84')](_0x439a02,{'transaction':_0x3e592f});}})[_0xb66a('0x23')](function(){_0x439a02[_0xb66a('0x71')](function(_0x52a0d2){socket[_0xb66a('0x72')](_0xb66a('0x85'),{'UserId':_0x52a0d2,'MailQueueId':_0x1b0818['id']});});});});});});})['then'](respondWithStatusCode(_0x18249c,null))[_0xb66a('0x49')](handleError(_0x18249c,null));};exports[_0xb66a('0x86')]=function(_0x4fbb60,_0x3ae289,_0x48c065){return db['MailQueue']['find']({'where':{'id':_0x4fbb60[_0xb66a('0x4b')]['id']}})[_0xb66a('0x23')](handleEntityNotFound(_0x3ae289,null))['then'](function(_0x32f863){if(_0x32f863){return _0x32f863['addAgents'](_0x4fbb60[_0xb66a('0x4f')]['ids'],_[_0xb66a('0x87')](_0x4fbb60[_0xb66a('0x4f')],[_0xb66a('0x68'),'id'])||{})[_0xb66a('0x88')](function(_0x2e82a0){for(var _0x5c9ec6=0x0;_0x5c9ec6<_0x4fbb60[_0xb66a('0x4f')][_0xb66a('0x68')]['length'];_0x5c9ec6+=0x1){socket[_0xb66a('0x72')]('userMailQueue:save',{'UserId':_0x4fbb60['body'][_0xb66a('0x68')][_0x5c9ec6],'MailQueueId':_0x4fbb60[_0xb66a('0x4b')]['id']});}return _0x2e82a0;});}})[_0xb66a('0x23')](respondWithResult(_0x3ae289,null))['catch'](handleError(_0x3ae289,null));};exports[_0xb66a('0x84')]=function(_0x13c5e4,_0x1468b6,_0x1225d6){return db[_0xb66a('0x2d')][_0xb66a('0x4d')]({'where':{'id':_0x13c5e4[_0xb66a('0x4b')]['id']}})[_0xb66a('0x23')](handleEntityNotFound(_0x1468b6,null))[_0xb66a('0x23')](function(_0x2d2732){if(_0x2d2732){return _0x2d2732['removeAgents'](_0x13c5e4[_0xb66a('0x33')][_0xb66a('0x68')])[_0xb66a('0x23')](function(){if(_['isArray'](_0x13c5e4[_0xb66a('0x33')]['ids'])){for(var _0x1634a5=0x0;_0x1634a5<_0x13c5e4['query']['ids'][_0xb66a('0x4c')];_0x1634a5+=0x1){socket['emit'](_0xb66a('0x85'),{'UserId':Number(_0x13c5e4['query'][_0xb66a('0x68')][_0x1634a5]),'MailQueueId':Number(_0x13c5e4[_0xb66a('0x4b')]['id'])});}}else{socket[_0xb66a('0x72')](_0xb66a('0x85'),{'UserId':Number(_0x13c5e4['query'][_0xb66a('0x68')]),'MailQueueId':Number(_0x13c5e4['params']['id'])});}});}})[_0xb66a('0x23')](respondWithStatusCode(_0x1468b6,null))['catch'](handleError(_0x1468b6,null));};exports[_0xb66a('0x89')]=function(_0x3a7f79,_0x293dc4,_0x592358){var _0x4eabc1={};var _0x456b8a={};var _0x4bd5c7;var _0x3a514d;return db['MailQueue'][_0xb66a('0x58')]({'where':{'id':_0x3a7f79[_0xb66a('0x4b')]['id']}})[_0xb66a('0x23')](handleEntityNotFound(_0x293dc4,null))[_0xb66a('0x23')](function(_0x13c904){if(_0x13c904){_0x4bd5c7=_0x13c904;_0x456b8a[_0xb66a('0x37')]=_[_0xb66a('0x34')](db['User'][_0xb66a('0x2e')]);_0x456b8a['query']=_[_0xb66a('0x34')](_0x3a7f79[_0xb66a('0x33')]);_0x456b8a[_0xb66a('0x35')]=_[_0xb66a('0x36')](_0x456b8a[_0xb66a('0x37')],_0x456b8a[_0xb66a('0x33')]);_0x4eabc1[_0xb66a('0x38')]=_[_0xb66a('0x36')](_0x456b8a[_0xb66a('0x37')],qs[_0xb66a('0x39')](_0x3a7f79[_0xb66a('0x33')][_0xb66a('0x39')]));_0x4eabc1[_0xb66a('0x38')]=_0x4eabc1['attributes'][_0xb66a('0x4c')]?_0x4eabc1[_0xb66a('0x38')]:_0x456b8a[_0xb66a('0x37')];_0x4eabc1[_0xb66a('0x59')]=qs['sort'](_0x3a7f79[_0xb66a('0x33')][_0xb66a('0x3d')]);_0x4eabc1[_0xb66a('0x3e')]=qs[_0xb66a('0x35')](_[_0xb66a('0x3f')](_0x3a7f79[_0xb66a('0x33')],_0x456b8a[_0xb66a('0x35')]));if(_0x3a7f79[_0xb66a('0x33')][_0xb66a('0x40')]){_0x4eabc1[_0xb66a('0x3e')]=_['merge'](_0x4eabc1[_0xb66a('0x3e')],{'$or':_[_0xb66a('0x32')](_0x4eabc1[_0xb66a('0x38')],function(_0x421fd0){var _0x3e8119={};_0x3e8119[_0x421fd0]={'$like':'%'+_0x3a7f79[_0xb66a('0x33')][_0xb66a('0x40')]+'%'};return _0x3e8119;})});}_0x4eabc1=_[_0xb66a('0x41')]({},_0x4eabc1,_0x3a7f79[_0xb66a('0x43')]);return _0x4bd5c7[_0xb66a('0x89')](_0x4eabc1);}})[_0xb66a('0x23')](function(_0x5dcb4a){if(_0x5dcb4a){_0x3a514d=_0x5dcb4a[_0xb66a('0x4c')];if(!_0x3a7f79['query'][_0xb66a('0x3a')](_0xb66a('0x3b'))){_0x4eabc1[_0xb66a('0x3c')]=qs[_0xb66a('0x3c')](_0x3a7f79['query'][_0xb66a('0x3c')]);_0x4eabc1['offset']=qs[_0xb66a('0x1e')](_0x3a7f79['query'][_0xb66a('0x1e')]);}return _0x4bd5c7[_0xb66a('0x89')](_0x4eabc1);}})[_0xb66a('0x23')](function(_0x10a41b){if(_0x10a41b){return _0x10a41b?{'count':_0x3a514d,'rows':_0x10a41b}:null;}})[_0xb66a('0x23')](respondWithResult(_0x293dc4,null))[_0xb66a('0x49')](handleError(_0x293dc4,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 7519686..0f644f5 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 _0xcc04=['emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners','save','remove'];(function(_0x3a8c8f,_0x567295){var _0x4d8b4a=function(_0x42a96e){while(--_0x42a96e){_0x3a8c8f['push'](_0x3a8c8f['shift']());}};_0x4d8b4a(++_0x567295);}(_0xcc04,0x15a));var _0x4cc0=function(_0x6fe021,_0x5ac4fb){_0x6fe021=_0x6fe021-0x0;var _0x21f09f=_0xcc04[_0x6fe021];return _0x21f09f;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x4cc0('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x4cc0('0x1')](0x0);var events={'afterCreate':_0x4cc0('0x2'),'afterUpdate':'update','afterDestroy':_0x4cc0('0x3')};function emitEvent(_0x559b24){return function(_0x39e87c,_0x22adc1,_0x10abce){MailQueueEvents[_0x4cc0('0x4')](_0x559b24+':'+_0x39e87c['id'],_0x39e87c);MailQueueEvents['emit'](_0x559b24,_0x39e87c);_0x10abce(null);};}for(var e in events){if(events[_0x4cc0('0x5')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x4cc0('0x6')]=MailQueueEvents; \ No newline at end of file +var _0xd262=['hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit'];(function(_0x439fe3,_0x550a22){var _0x5c61e4=function(_0x3e9f0b){while(--_0x3e9f0b){_0x439fe3['push'](_0x439fe3['shift']());}};_0x5c61e4(++_0x550a22);}(_0xd262,0x12c));var _0x2d26=function(_0x18beb0,_0x5238d8){_0x18beb0=_0x18beb0-0x0;var _0x37d642=_0xd262[_0x18beb0];return _0x37d642;};'use strict';var EventEmitter=require(_0x2d26('0x0'));var MailQueue=require(_0x2d26('0x1'))['db'][_0x2d26('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x2d26('0x3')](0x0);var events={'afterCreate':_0x2d26('0x4'),'afterUpdate':_0x2d26('0x5'),'afterDestroy':_0x2d26('0x6')};function emitEvent(_0x2a621c){return function(_0x3a865c,_0x16ae12,_0x552e23){MailQueueEvents['emit'](_0x2a621c+':'+_0x3a865c['id'],_0x3a865c);MailQueueEvents[_0x2d26('0x7')](_0x2a621c,_0x3a865c);_0x552e23(null);};}for(var e in events){if(events[_0x2d26('0x8')](e)){var event=events[e];MailQueue[_0x2d26('0x9')](e,emitEvent(event));}}module[_0x2d26('0xa')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index f34c648..c34e320 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 _0x936f=['define','MailQueue','mail_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0x168397,_0x5ea34f){var _0x453c3b=function(_0x4b9ddd){while(--_0x4b9ddd){_0x168397['push'](_0x168397['shift']());}};_0x453c3b(++_0x5ea34f);}(_0x936f,0x1e3));var _0xf936=function(_0x1ca3a9,_0x4295c3){_0x1ca3a9=_0x1ca3a9-0x0;var _0x563781=_0x936f[_0x1ca3a9];return _0x563781;};'use strict';var _=require(_0xf936('0x0'));var util=require(_0xf936('0x1'));var logger=require(_0xf936('0x2'))('api');var moment=require(_0xf936('0x3'));var BPromise=require(_0xf936('0x4'));var rp=require(_0xf936('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf936('0x6'));var config=require(_0xf936('0x7'));var attributes=require(_0xf936('0x8'));module['exports']=function(_0x49ee26,_0x32ab07){return _0x49ee26[_0xf936('0x9')](_0xf936('0xa'),attributes,{'tableName':_0xf936('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x144c=['lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports','MailQueue','mail_queues'];(function(_0x55ccc5,_0x247db5){var _0x19633d=function(_0x46f722){while(--_0x46f722){_0x55ccc5['push'](_0x55ccc5['shift']());}};_0x19633d(++_0x247db5);}(_0x144c,0xab));var _0xc144=function(_0x7538c5,_0xa5d8ac){_0x7538c5=_0x7538c5-0x0;var _0x8b56be=_0x144c[_0x7538c5];return _0x8b56be;};'use strict';var _=require(_0xc144('0x0'));var util=require('util');var logger=require(_0xc144('0x1'))('api');var moment=require(_0xc144('0x2'));var BPromise=require(_0xc144('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc144('0x4'));var config=require(_0xc144('0x5'));var attributes=require('./mailQueue.attributes');module[_0xc144('0x6')]=function(_0x4f9189,_0x5f4952){return _0x4f9189['define'](_0xc144('0x7'),attributes,{'tableName':_0xc144('0x8'),'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 2f57e5a..4f14bd0 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 _0x61b9=['attributes','limit','include','map','model','GetMailQueue','ShowMailQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailQueue','findAll','options','raw'];(function(_0x56040d,_0xdad7a6){var _0x19908a=function(_0x42862){while(--_0x42862){_0x56040d['push'](_0x56040d['shift']());}};_0x19908a(++_0xdad7a6);}(_0x61b9,0xe0));var _0x961b=function(_0x3f88bc,_0xe38cf5){_0x3f88bc=_0x3f88bc-0x0;var _0x4df1c4=_0x61b9[_0x3f88bc];return _0x4df1c4;};'use strict';var _=require(_0x961b('0x0'));var util=require(_0x961b('0x1'));var moment=require(_0x961b('0x2'));var BPromise=require(_0x961b('0x3'));var rs=require(_0x961b('0x4'));var fs=require('fs');var Redis=require(_0x961b('0x5'));var db=require(_0x961b('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x961b('0x7'));var config=require(_0x961b('0x8'));var jayson=require(_0x961b('0x9'));var client=jayson[_0x961b('0xa')][_0x961b('0xb')]({'port':0x232a});config[_0x961b('0xc')]=_[_0x961b('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x961b('0xe'))(new Redis(config[_0x961b('0xc')]));require(_0x961b('0xf'))[_0x961b('0x10')](socket);function respondWithRpcPromise(_0x4a0090,_0x233471,_0x3e278c){return new BPromise(function(_0x5f20eb,_0x12c400){return client[_0x961b('0x11')](_0x4a0090,_0x3e278c)[_0x961b('0x12')](function(_0x156e28){logger[_0x961b('0x13')](_0x961b('0x14'),_0x233471,_0x961b('0x15'));logger[_0x961b('0x16')](_0x961b('0x17'),_0x233471,_0x961b('0x15'),JSON[_0x961b('0x18')](_0x156e28));if(_0x156e28[_0x961b('0x19')]){if(_0x156e28['error'][_0x961b('0x1a')]===0x1f4){logger[_0x961b('0x19')](_0x961b('0x14'),_0x233471,_0x156e28[_0x961b('0x19')][_0x961b('0x1b')]);return _0x12c400(_0x156e28[_0x961b('0x19')]['message']);}logger[_0x961b('0x19')](_0x961b('0x14'),_0x233471,_0x156e28['error'][_0x961b('0x1b')]);return _0x5f20eb(_0x156e28[_0x961b('0x19')]['message']);}else{logger[_0x961b('0x13')](_0x961b('0x14'),_0x233471,_0x961b('0x15'));_0x5f20eb(_0x156e28[_0x961b('0x1c')][_0x961b('0x1b')]);}})[_0x961b('0x1d')](function(_0x31f92c){logger[_0x961b('0x19')](_0x961b('0x14'),_0x233471,_0x31f92c);_0x12c400(_0x31f92c);});});}exports['GetMailQueue']=function(_0x348c29){var _0x5b0463=this;return new Promise(function(_0x5348e8,_0x4faf8d){return db[_0x961b('0x1e')][_0x961b('0x1f')]({'raw':_0x348c29[_0x961b('0x20')]?_0x348c29[_0x961b('0x20')][_0x961b('0x21')]===undefined?!![]:![]:!![],'where':_0x348c29[_0x961b('0x20')]?_0x348c29[_0x961b('0x20')]['where']||null:null,'attributes':_0x348c29[_0x961b('0x20')]?_0x348c29['options'][_0x961b('0x22')]||null:null,'limit':_0x348c29['options']?_0x348c29[_0x961b('0x20')][_0x961b('0x23')]||null:null,'include':_0x348c29[_0x961b('0x20')]?_0x348c29[_0x961b('0x20')][_0x961b('0x24')]?_[_0x961b('0x25')](_0x348c29[_0x961b('0x20')]['include'],function(_0x3a2ea0){return{'model':db[_0x3a2ea0[_0x961b('0x26')]],'as':_0x3a2ea0['as'],'attributes':_0x3a2ea0[_0x961b('0x22')],'include':_0x3a2ea0[_0x961b('0x24')]?_['map'](_0x3a2ea0[_0x961b('0x24')],function(_0x4d680a){return{'model':db[_0x4d680a[_0x961b('0x26')]],'as':_0x4d680a['as'],'attributes':_0x4d680a[_0x961b('0x22')],'include':_0x4d680a['include']?_[_0x961b('0x25')](_0x4d680a[_0x961b('0x24')],function(_0x44d46d){return{'model':db[_0x44d46d[_0x961b('0x26')]],'as':_0x44d46d['as'],'attributes':_0x44d46d[_0x961b('0x22')]};}):[]};}):[]};}):[]:[]})[_0x961b('0x12')](function(_0xff72ed){logger['info'](_0x961b('0x27'),_0x348c29);logger[_0x961b('0x16')](_0x961b('0x27'),_0x348c29,JSON[_0x961b('0x18')](_0xff72ed));_0x5348e8(_0xff72ed);})[_0x961b('0x1d')](function(_0x11fd2c){logger[_0x961b('0x19')](_0x961b('0x27'),_0x11fd2c['message'],_0x348c29);_0x4faf8d(_0x5b0463['error'](0x1f4,_0x11fd2c[_0x961b('0x1b')]));});});};exports[_0x961b('0x28')]=function(_0x3e2de5){var _0x2ef3da=this;return new Promise(function(_0x1d2ad8,_0x5d4d60){return db['MailQueue'][_0x961b('0x29')]({'raw':_0x3e2de5[_0x961b('0x20')]?_0x3e2de5['options'][_0x961b('0x21')]===undefined?!![]:![]:!![],'where':_0x3e2de5[_0x961b('0x20')]?_0x3e2de5[_0x961b('0x20')][_0x961b('0x2a')]||null:null,'attributes':_0x3e2de5[_0x961b('0x20')]?_0x3e2de5['options']['attributes']||null:null,'include':_0x3e2de5[_0x961b('0x20')]?_0x3e2de5[_0x961b('0x20')][_0x961b('0x24')]?_[_0x961b('0x25')](_0x3e2de5[_0x961b('0x20')][_0x961b('0x24')],function(_0x159ab4){return{'model':db[_0x159ab4['model']],'as':_0x159ab4['as'],'attributes':_0x159ab4[_0x961b('0x22')],'include':_0x159ab4[_0x961b('0x24')]?_[_0x961b('0x25')](_0x159ab4[_0x961b('0x24')],function(_0x4289a1){return{'model':db[_0x4289a1[_0x961b('0x26')]],'as':_0x4289a1['as'],'attributes':_0x4289a1[_0x961b('0x22')],'include':_0x4289a1[_0x961b('0x24')]?_[_0x961b('0x25')](_0x4289a1[_0x961b('0x24')],function(_0x11675f){return{'model':db[_0x11675f[_0x961b('0x26')]],'as':_0x11675f['as'],'attributes':_0x11675f['attributes']};}):[]};}):[]};}):[]:[]})[_0x961b('0x12')](function(_0x5d6397){logger[_0x961b('0x13')](_0x961b('0x28'),_0x3e2de5);logger['debug'](_0x961b('0x28'),_0x3e2de5,JSON[_0x961b('0x18')](_0x5d6397));_0x1d2ad8(_0x5d6397);})[_0x961b('0x1d')](function(_0x5d57d6){logger[_0x961b('0x19')]('ShowMailQueue',_0x5d57d6[_0x961b('0x1b')],_0x3e2de5);_0x5d4d60(_0x2ef3da[_0x961b('0x19')](0x1f4,_0x5d57d6['message']));});});}; \ No newline at end of file +var _0x125f=['defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','MailQueue','options','raw','where','attributes','limit','include','map','model','then','GetMailQueue','debug','catch','ShowMailQueue','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x5b9e30,_0x207255){var _0x102a4d=function(_0x5babf5){while(--_0x5babf5){_0x5b9e30['push'](_0x5b9e30['shift']());}};_0x102a4d(++_0x207255);}(_0x125f,0x1e4));var _0xf125=function(_0x10a11d,_0xcc39a6){_0x10a11d=_0x10a11d-0x0;var _0x32ef43=_0x125f[_0x10a11d];return _0x32ef43;};'use strict';var _=require(_0xf125('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf125('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf125('0x2'))['db'];var utils=require(_0xf125('0x3'));var logger=require(_0xf125('0x4'))(_0xf125('0x5'));var config=require(_0xf125('0x6'));var jayson=require(_0xf125('0x7'));var client=jayson['client'][_0xf125('0x8')]({'port':0x232a});config[_0xf125('0x9')]=_[_0xf125('0xa')](config['redis'],{'host':_0xf125('0xb'),'port':0x18eb});var socket=require(_0xf125('0xc'))(new Redis(config[_0xf125('0x9')]));require(_0xf125('0xd'))[_0xf125('0xe')](socket);function respondWithRpcPromise(_0xef045e,_0xa76502,_0x3c579b){return new BPromise(function(_0x3ba39e,_0x4563f9){return client[_0xf125('0xf')](_0xef045e,_0x3c579b)['then'](function(_0x2e0f33){logger[_0xf125('0x10')](_0xf125('0x11'),_0xa76502,_0xf125('0x12'));logger['debug'](_0xf125('0x13'),_0xa76502,_0xf125('0x12'),JSON[_0xf125('0x14')](_0x2e0f33));if(_0x2e0f33[_0xf125('0x15')]){if(_0x2e0f33[_0xf125('0x15')]['code']===0x1f4){logger['error'](_0xf125('0x11'),_0xa76502,_0x2e0f33['error'][_0xf125('0x16')]);return _0x4563f9(_0x2e0f33[_0xf125('0x15')][_0xf125('0x16')]);}logger['error'](_0xf125('0x11'),_0xa76502,_0x2e0f33[_0xf125('0x15')][_0xf125('0x16')]);return _0x3ba39e(_0x2e0f33[_0xf125('0x15')][_0xf125('0x16')]);}else{logger[_0xf125('0x10')](_0xf125('0x11'),_0xa76502,_0xf125('0x12'));_0x3ba39e(_0x2e0f33[_0xf125('0x17')][_0xf125('0x16')]);}})['catch'](function(_0x4f6827){logger[_0xf125('0x15')](_0xf125('0x11'),_0xa76502,_0x4f6827);_0x4563f9(_0x4f6827);});});}exports['GetMailQueue']=function(_0x3f861f){var _0x3178ce=this;return new Promise(function(_0x54eede,_0x8a5d6e){return db[_0xf125('0x18')]['findAll']({'raw':_0x3f861f[_0xf125('0x19')]?_0x3f861f['options'][_0xf125('0x1a')]===undefined?!![]:![]:!![],'where':_0x3f861f['options']?_0x3f861f[_0xf125('0x19')][_0xf125('0x1b')]||null:null,'attributes':_0x3f861f[_0xf125('0x19')]?_0x3f861f[_0xf125('0x19')][_0xf125('0x1c')]||null:null,'limit':_0x3f861f[_0xf125('0x19')]?_0x3f861f[_0xf125('0x19')][_0xf125('0x1d')]||null:null,'include':_0x3f861f['options']?_0x3f861f[_0xf125('0x19')][_0xf125('0x1e')]?_[_0xf125('0x1f')](_0x3f861f[_0xf125('0x19')][_0xf125('0x1e')],function(_0x5cf79b){return{'model':db[_0x5cf79b[_0xf125('0x20')]],'as':_0x5cf79b['as'],'attributes':_0x5cf79b[_0xf125('0x1c')],'include':_0x5cf79b[_0xf125('0x1e')]?_[_0xf125('0x1f')](_0x5cf79b[_0xf125('0x1e')],function(_0x25ad22){return{'model':db[_0x25ad22['model']],'as':_0x25ad22['as'],'attributes':_0x25ad22[_0xf125('0x1c')],'include':_0x25ad22[_0xf125('0x1e')]?_[_0xf125('0x1f')](_0x25ad22['include'],function(_0x226214){return{'model':db[_0x226214[_0xf125('0x20')]],'as':_0x226214['as'],'attributes':_0x226214[_0xf125('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf125('0x21')](function(_0x4e5127){logger[_0xf125('0x10')](_0xf125('0x22'),_0x3f861f);logger[_0xf125('0x23')](_0xf125('0x22'),_0x3f861f,JSON[_0xf125('0x14')](_0x4e5127));_0x54eede(_0x4e5127);})[_0xf125('0x24')](function(_0x307919){logger['error'](_0xf125('0x22'),_0x307919[_0xf125('0x16')],_0x3f861f);_0x8a5d6e(_0x3178ce[_0xf125('0x15')](0x1f4,_0x307919['message']));});});};exports[_0xf125('0x25')]=function(_0x3b7ed3){var _0x562147=this;return new Promise(function(_0x2ef85b,_0x587502){return db[_0xf125('0x18')]['find']({'raw':_0x3b7ed3[_0xf125('0x19')]?_0x3b7ed3[_0xf125('0x19')][_0xf125('0x1a')]===undefined?!![]:![]:!![],'where':_0x3b7ed3['options']?_0x3b7ed3[_0xf125('0x19')][_0xf125('0x1b')]||null:null,'attributes':_0x3b7ed3[_0xf125('0x19')]?_0x3b7ed3[_0xf125('0x19')][_0xf125('0x1c')]||null:null,'include':_0x3b7ed3[_0xf125('0x19')]?_0x3b7ed3[_0xf125('0x19')][_0xf125('0x1e')]?_[_0xf125('0x1f')](_0x3b7ed3['options'][_0xf125('0x1e')],function(_0x217ead){return{'model':db[_0x217ead[_0xf125('0x20')]],'as':_0x217ead['as'],'attributes':_0x217ead[_0xf125('0x1c')],'include':_0x217ead[_0xf125('0x1e')]?_[_0xf125('0x1f')](_0x217ead[_0xf125('0x1e')],function(_0x2254f5){return{'model':db[_0x2254f5[_0xf125('0x20')]],'as':_0x2254f5['as'],'attributes':_0x2254f5[_0xf125('0x1c')],'include':_0x2254f5[_0xf125('0x1e')]?_[_0xf125('0x1f')](_0x2254f5[_0xf125('0x1e')],function(_0x4c4f08){return{'model':db[_0x4c4f08['model']],'as':_0x4c4f08['as'],'attributes':_0x4c4f08[_0xf125('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf125('0x21')](function(_0x31cacb){logger[_0xf125('0x10')](_0xf125('0x25'),_0x3b7ed3);logger[_0xf125('0x23')]('ShowMailQueue',_0x3b7ed3,JSON[_0xf125('0x14')](_0x31cacb));_0x2ef85b(_0x31cacb);})[_0xf125('0x24')](function(_0x47b94b){logger[_0xf125('0x15')](_0xf125('0x25'),_0x47b94b[_0xf125('0x16')],_0x3b7ed3);_0x587502(_0x562147[_0xf125('0x15')](0x1f4,_0x47b94b[_0xf125('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index dd1beab..4881275 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 _0xe203=['register','length','mailQueue:','save','remove','emit'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xe203,0x1ad));var _0x3e20=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe203[_0x3dd15e];return _0x231fd0;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x3e20('0x0'),_0x3e20('0x1'),'update'];function createListener(_0x2a0d0f,_0x16ee72){return function(_0x4581ae){_0x16ee72[_0x3e20('0x2')](_0x2a0d0f,_0x4581ae);};}function removeListener(_0x5c7f78,_0x54bcc9){return function(){MailQueueEvents['removeListener'](_0x5c7f78,_0x54bcc9);};}exports[_0x3e20('0x3')]=function(_0x35a5a9){for(var _0x492c90=0x0,_0x1bed5e=events[_0x3e20('0x4')];_0x492c90<_0x1bed5e;_0x492c90++){var _0x2dec1b=events[_0x492c90];var _0x33e530=createListener(_0x3e20('0x5')+_0x2dec1b,_0x35a5a9);MailQueueEvents['on'](_0x2dec1b,_0x33e530);}}; \ No newline at end of file +var _0xe3e6=['remove','update','emit','removeListener','length','./mailQueue.events','save'];(function(_0x1d000a,_0x477985){var _0x1d19ce=function(_0x358cbc){while(--_0x358cbc){_0x1d000a['push'](_0x1d000a['shift']());}};_0x1d19ce(++_0x477985);}(_0xe3e6,0x139));var _0x6e3e=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0xe3e6[_0x4dcc2d];return _0x1bbd79;};'use strict';var MailQueueEvents=require(_0x6e3e('0x0'));var events=[_0x6e3e('0x1'),_0x6e3e('0x2'),_0x6e3e('0x3')];function createListener(_0x348a6a,_0x6a600b){return function(_0x487451){_0x6a600b[_0x6e3e('0x4')](_0x348a6a,_0x487451);};}function removeListener(_0x5a744c,_0x224708){return function(){MailQueueEvents[_0x6e3e('0x5')](_0x5a744c,_0x224708);};}exports['register']=function(_0x394205){for(var _0x55eb60=0x0,_0x26773c=events[_0x6e3e('0x6')];_0x55eb60<_0x26773c;_0x55eb60++){var _0x503b72=events[_0x55eb60];var _0x5353fe=createListener('mailQueue:'+_0x503b72,_0x394205);MailQueueEvents['on'](_0x503b72,_0x5353fe);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index cf84ef2..4307d85 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 _0xf9bc=['describe','/:id','show','create','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','index','get','/describe','isAuthenticated'];(function(_0xeee01b,_0x3e7c51){var _0x445a9c=function(_0x546c96){while(--_0x546c96){_0xeee01b['push'](_0xeee01b['shift']());}};_0x445a9c(++_0x3e7c51);}(_0xf9bc,0x7e));var _0xcf9b=function(_0x32e634,_0x1e5c1d){_0x32e634=_0x32e634-0x0;var _0x372638=_0xf9bc[_0x32e634];return _0x372638;};'use strict';var multer=require('multer');var util=require(_0xcf9b('0x0'));var path=require(_0xcf9b('0x1'));var timeout=require(_0xcf9b('0x2'));var express=require(_0xcf9b('0x3'));var router=express[_0xcf9b('0x4')]();var fs_extra=require(_0xcf9b('0x5'));var auth=require(_0xcf9b('0x6'));var interaction=require(_0xcf9b('0x7'));var config=require(_0xcf9b('0x8'));var controller=require(_0xcf9b('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xcf9b('0xa')]);router[_0xcf9b('0xb')](_0xcf9b('0xc'),auth[_0xcf9b('0xd')](),controller[_0xcf9b('0xe')]);router[_0xcf9b('0xb')](_0xcf9b('0xf'),auth[_0xcf9b('0xd')](),controller[_0xcf9b('0x10')]);router['post']('/',auth[_0xcf9b('0xd')](),controller[_0xcf9b('0x11')]);router['put'](_0xcf9b('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xcf9b('0xf'),auth['isAuthenticated'](),controller[_0xcf9b('0x12')]);module[_0xcf9b('0x13')]=router; \ No newline at end of file +var _0xc964=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','exports'];(function(_0x353203,_0x1df104){var _0x572d47=function(_0x128120){while(--_0x128120){_0x353203['push'](_0x353203['shift']());}};_0x572d47(++_0x1df104);}(_0xc964,0x7e));var _0x4c96=function(_0x3d441e,_0x1b8837){_0x3d441e=_0x3d441e-0x0;var _0x300d7e=_0xc964[_0x3d441e];return _0x300d7e;};'use strict';var multer=require(_0x4c96('0x0'));var util=require(_0x4c96('0x1'));var path=require('path');var timeout=require(_0x4c96('0x2'));var express=require(_0x4c96('0x3'));var router=express[_0x4c96('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4c96('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4c96('0x6'));var controller=require(_0x4c96('0x7'));router[_0x4c96('0x8')]('/',auth[_0x4c96('0x9')](),controller[_0x4c96('0xa')]);router[_0x4c96('0x8')](_0x4c96('0xb'),auth['isAuthenticated'](),controller[_0x4c96('0xc')]);router[_0x4c96('0x8')](_0x4c96('0xd'),auth['isAuthenticated'](),controller[_0x4c96('0xe')]);router[_0x4c96('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x4c96('0xd'),auth[_0x4c96('0x9')](),controller[_0x4c96('0x10')]);router['delete'](_0x4c96('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x4c96('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 9a89e61..87cc80d 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 _0x8153=['sequelize','exports','STRING','DATE','moment'];(function(_0x5e5966,_0x150414){var _0x45077f=function(_0x2531b4){while(--_0x2531b4){_0x5e5966['push'](_0x5e5966['shift']());}};_0x45077f(++_0x150414);}(_0x8153,0x117));var _0x3815=function(_0x21c19c,_0x3d74b6){_0x21c19c=_0x21c19c-0x0;var _0x5923ee=_0x8153[_0x21c19c];return _0x5923ee;};'use strict';var moment=require(_0x3815('0x0'));var Sequelize=require(_0x3815('0x1'));module[_0x3815('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x3815('0x3')]},'joinAt':{'type':Sequelize[_0x3815('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x3815('0x4')]},'reason':{'type':Sequelize[_0x3815('0x3')]}}; \ No newline at end of file +var _0x8e53=['moment','sequelize','exports','STRING','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8e53,0x1e0));var _0x38e5=function(_0x34f8e5,_0x278902){_0x34f8e5=_0x34f8e5-0x0;var _0x3deca8=_0x8e53[_0x34f8e5];return _0x3deca8;};'use strict';var moment=require(_0x38e5('0x0'));var Sequelize=require(_0x38e5('0x1'));module[_0x38e5('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x38e5('0x3')]},'joinAt':{'type':Sequelize[_0x38e5('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x38e5('0x4')]},'reason':{'type':Sequelize[_0x38e5('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 6d1f207..2512d2c 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 _0xc2d3=['rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','include','rows','catch','show','params','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','MailQueueReport'];(function(_0x49b459,_0xd4b197){var _0x635e25=function(_0x4f0e69){while(--_0x4f0e69){_0x49b459['push'](_0x49b459['shift']());}};_0x635e25(++_0xd4b197);}(_0xc2d3,0xfe));var _0x3c2d=function(_0x1a0df6,_0x32ea72){_0x1a0df6=_0x1a0df6-0x0;var _0x3de299=_0xc2d3[_0x1a0df6];return _0x3de299;};'use strict';var pdf=require(_0x3c2d('0x0'));var emlformat=require(_0x3c2d('0x1'));var rimraf=require(_0x3c2d('0x2'));var zipdir=require(_0x3c2d('0x3'));var jsonpatch=require(_0x3c2d('0x4'));var rp=require('request-promise');var moment=require(_0x3c2d('0x5'));var BPromise=require(_0x3c2d('0x6'));var Mustache=require('mustache');var util=require(_0x3c2d('0x7'));var path=require(_0x3c2d('0x8'));var sox=require(_0x3c2d('0x9'));var csv=require('to-csv');var ejs=require(_0x3c2d('0xa'));var fs=require('fs');var fs_extra=require(_0x3c2d('0xb'));var _=require(_0x3c2d('0xc'));var squel=require(_0x3c2d('0xd'));var crypto=require(_0x3c2d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3c2d('0xf'));var toCsv=require(_0x3c2d('0x10'));var querystring=require(_0x3c2d('0x11'));var Papa=require(_0x3c2d('0x12'));var Redis=require(_0x3c2d('0x13'));var authService=require(_0x3c2d('0x14'));var qs=require(_0x3c2d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c2d('0x16'));var logger=require(_0x3c2d('0x17'))('api');var utils=require(_0x3c2d('0x18'));var config=require(_0x3c2d('0x19'));var licenseUtil=require(_0x3c2d('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x212117,_0x1df940){_0x1df940=_0x1df940||0xcc;return function(_0x437bd4){if(_0x437bd4){return _0x212117[_0x3c2d('0x1b')](_0x1df940);}return _0x212117[_0x3c2d('0x1c')](_0x1df940)[_0x3c2d('0x1d')]();};}function respondWithResult(_0x3f3806,_0x4ab002){_0x4ab002=_0x4ab002||0xc8;return function(_0x247d7d){if(_0x247d7d){return _0x3f3806[_0x3c2d('0x1c')](_0x4ab002)[_0x3c2d('0x1e')](_0x247d7d);}};}function respondWithFilteredResult(_0x346dcf,_0x4e6104){return function(_0x5e8e71){if(_0x5e8e71){var _0x5f087e=_0x5e8e71[_0x3c2d('0x1f')],_0x1fe6e1=_0x4e6104[_0x3c2d('0x20')],_0xa533fd=_0x4e6104[_0x3c2d('0x20')]+_0x4e6104[_0x3c2d('0x21')],_0x217aae;if(_0xa533fd>=_0x5f087e){_0xa533fd=_0x5f087e;_0x217aae=0xc8;}else{_0x217aae=0xce;}_0x346dcf[_0x3c2d('0x1c')](_0x217aae);return _0x346dcf['set'](_0x3c2d('0x22'),_0x1fe6e1+'-'+_0xa533fd+'/'+_0x5f087e)[_0x3c2d('0x1e')](_0x5e8e71);}return null;};}function patchUpdates(_0x3eba8c){return function(_0x1d832e){try{jsonpatch['apply'](_0x1d832e,_0x3eba8c,!![]);}catch(_0x3b8c1b){return BPromise[_0x3c2d('0x23')](_0x3b8c1b);}return _0x1d832e['save']();};}function saveUpdates(_0x51a82a,_0x2c3933){return function(_0x2f2780){if(_0x2f2780){return _0x2f2780[_0x3c2d('0x24')](_0x51a82a)[_0x3c2d('0x25')](function(_0x372f68){return _0x372f68;});}return null;};}function removeEntity(_0x30d1cc,_0x54c454){return function(_0xf14fb9){if(_0xf14fb9){return _0xf14fb9[_0x3c2d('0x26')]()[_0x3c2d('0x25')](function(){_0x30d1cc[_0x3c2d('0x1c')](0xcc)[_0x3c2d('0x1d')]();});}};}function handleEntityNotFound(_0x554777,_0x3a2694){return function(_0x399eaa){if(!_0x399eaa){_0x554777[_0x3c2d('0x1b')](0x194);}return _0x399eaa;};}function handleError(_0x472635,_0x5ccad3){_0x5ccad3=_0x5ccad3||0x1f4;return function(_0x4a73ee){logger[_0x3c2d('0x27')](_0x4a73ee[_0x3c2d('0x28')]);if(_0x4a73ee[_0x3c2d('0x29')]){delete _0x4a73ee[_0x3c2d('0x29')];}_0x472635[_0x3c2d('0x1c')](_0x5ccad3)[_0x3c2d('0x2a')](_0x4a73ee);};}exports[_0x3c2d('0x2b')]=function(_0x26fc47,_0x46ea0b){var _0x1c9068={},_0x5306f4={},_0x43432f={'count':0x0,'rows':[]};var _0x50e4f7=_[_0x3c2d('0x2c')](db[_0x3c2d('0x2d')][_0x3c2d('0x2e')],function(_0xeedcba){return{'name':_0xeedcba[_0x3c2d('0x2f')],'type':_0xeedcba['type']['key']};});_0x5306f4[_0x3c2d('0x30')]=_[_0x3c2d('0x2c')](_0x50e4f7,_0x3c2d('0x29'));_0x5306f4[_0x3c2d('0x31')]=_[_0x3c2d('0x32')](_0x26fc47[_0x3c2d('0x31')]);_0x5306f4['filters']=_[_0x3c2d('0x33')](_0x5306f4['model'],_0x5306f4['query']);_0x1c9068[_0x3c2d('0x34')]=_[_0x3c2d('0x33')](_0x5306f4[_0x3c2d('0x30')],qs[_0x3c2d('0x35')](_0x26fc47[_0x3c2d('0x31')]['fields']));_0x1c9068['attributes']=_0x1c9068[_0x3c2d('0x34')][_0x3c2d('0x36')]?_0x1c9068['attributes']:_0x5306f4[_0x3c2d('0x30')];if(!_0x26fc47[_0x3c2d('0x31')]['hasOwnProperty'](_0x3c2d('0x37'))){_0x1c9068[_0x3c2d('0x21')]=qs[_0x3c2d('0x21')](_0x26fc47[_0x3c2d('0x31')][_0x3c2d('0x21')]);_0x1c9068[_0x3c2d('0x20')]=qs[_0x3c2d('0x20')](_0x26fc47[_0x3c2d('0x31')][_0x3c2d('0x20')]);}_0x1c9068['order']=qs[_0x3c2d('0x38')](_0x26fc47['query'][_0x3c2d('0x38')]);_0x1c9068[_0x3c2d('0x39')]=qs[_0x3c2d('0x3a')](_[_0x3c2d('0x3b')](_0x26fc47[_0x3c2d('0x31')],_0x5306f4[_0x3c2d('0x3a')]),_0x50e4f7);if(_0x26fc47[_0x3c2d('0x31')]['filter']){_0x1c9068[_0x3c2d('0x39')]=_[_0x3c2d('0x3c')](_0x1c9068[_0x3c2d('0x39')],{'$or':_[_0x3c2d('0x2c')](_0x50e4f7,function(_0x5eb18a){if(_0x5eb18a[_0x3c2d('0x3d')]!==_0x3c2d('0x3e')){var _0x5c4a75={};_0x5c4a75[_0x5eb18a[_0x3c2d('0x29')]]={'$like':'%'+_0x26fc47['query'][_0x3c2d('0x3f')]+'%'};return _0x5c4a75;}})});}_0x1c9068=_[_0x3c2d('0x3c')]({},_0x1c9068,_0x26fc47[_0x3c2d('0x40')]);var _0x185b4c={'where':_0x1c9068[_0x3c2d('0x39')]};return db[_0x3c2d('0x2d')]['count'](_0x185b4c)[_0x3c2d('0x25')](function(_0x5cfa79){_0x43432f['count']=_0x5cfa79;if(_0x26fc47['query']['includeAll']){_0x1c9068[_0x3c2d('0x41')]=[{'all':!![]}];}return db[_0x3c2d('0x2d')]['findAll'](_0x1c9068);})['then'](function(_0x28a263){_0x43432f[_0x3c2d('0x42')]=_0x28a263;return _0x43432f;})['then'](respondWithFilteredResult(_0x46ea0b,_0x1c9068))[_0x3c2d('0x43')](handleError(_0x46ea0b,null));};exports[_0x3c2d('0x44')]=function(_0x1f31b3,_0x2c8689){var _0x1fcec3={'raw':!![],'where':{'id':_0x1f31b3[_0x3c2d('0x45')]['id']}},_0x4574ca={};_0x4574ca[_0x3c2d('0x30')]=_['keys'](db['MailQueueReport'][_0x3c2d('0x2e')]);_0x4574ca[_0x3c2d('0x31')]=_[_0x3c2d('0x32')](_0x1f31b3[_0x3c2d('0x31')]);_0x4574ca[_0x3c2d('0x3a')]=_[_0x3c2d('0x33')](_0x4574ca[_0x3c2d('0x30')],_0x4574ca[_0x3c2d('0x31')]);_0x1fcec3[_0x3c2d('0x34')]=_[_0x3c2d('0x33')](_0x4574ca['model'],qs[_0x3c2d('0x35')](_0x1f31b3[_0x3c2d('0x31')][_0x3c2d('0x35')]));_0x1fcec3[_0x3c2d('0x34')]=_0x1fcec3[_0x3c2d('0x34')][_0x3c2d('0x36')]?_0x1fcec3[_0x3c2d('0x34')]:_0x4574ca[_0x3c2d('0x30')];if(_0x1f31b3[_0x3c2d('0x31')][_0x3c2d('0x46')]){_0x1fcec3['include']=[{'all':!![]}];}_0x1fcec3=_[_0x3c2d('0x3c')]({},_0x1fcec3,_0x1f31b3[_0x3c2d('0x40')]);return db['MailQueueReport'][_0x3c2d('0x47')](_0x1fcec3)[_0x3c2d('0x25')](handleEntityNotFound(_0x2c8689,null))[_0x3c2d('0x25')](respondWithResult(_0x2c8689,null))['catch'](handleError(_0x2c8689,null));};exports[_0x3c2d('0x48')]=function(_0x3cd02c,_0x3eec6b){return db[_0x3c2d('0x2d')][_0x3c2d('0x48')](_0x3cd02c['body'],{})[_0x3c2d('0x25')](respondWithResult(_0x3eec6b,0xc9))[_0x3c2d('0x43')](handleError(_0x3eec6b,null));};exports['update']=function(_0x242f27,_0x5e803f){if(_0x242f27[_0x3c2d('0x49')]['id']){delete _0x242f27['body']['id'];}return db[_0x3c2d('0x2d')][_0x3c2d('0x47')]({'where':{'id':_0x242f27[_0x3c2d('0x45')]['id']}})[_0x3c2d('0x25')](handleEntityNotFound(_0x5e803f,null))[_0x3c2d('0x25')](saveUpdates(_0x242f27['body'],null))['then'](respondWithResult(_0x5e803f,null))[_0x3c2d('0x43')](handleError(_0x5e803f,null));};exports[_0x3c2d('0x26')]=function(_0x10efb7,_0x4a109a){return db[_0x3c2d('0x2d')][_0x3c2d('0x47')]({'where':{'id':_0x10efb7[_0x3c2d('0x45')]['id']}})[_0x3c2d('0x25')](handleEntityNotFound(_0x4a109a,null))['then'](removeEntity(_0x4a109a,null))[_0x3c2d('0x43')](handleError(_0x4a109a,null));};exports[_0x3c2d('0x4a')]=function(_0x28ff76,_0x1f89d0){return db['MailQueueReport'][_0x3c2d('0x4a')]()[_0x3c2d('0x25')](respondWithResult(_0x1f89d0,null))[_0x3c2d('0x43')](handleError(_0x1f89d0,null));}; \ No newline at end of file +var _0xd739=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','length','find','catch','body','update','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x344de6,_0x3a858b){var _0x31380=function(_0x51c524){while(--_0x51c524){_0x344de6['push'](_0x344de6['shift']());}};_0x31380(++_0x3a858b);}(_0xd739,0x116));var _0x9d73=function(_0x20e284,_0x2af0ab){_0x20e284=_0x20e284-0x0;var _0x4b8e5e=_0xd739[_0x20e284];return _0x4b8e5e;};'use strict';var pdf=require(_0x9d73('0x0'));var emlformat=require(_0x9d73('0x1'));var rimraf=require(_0x9d73('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9d73('0x3'));var moment=require(_0x9d73('0x4'));var BPromise=require(_0x9d73('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9d73('0x6'));var sox=require(_0x9d73('0x7'));var csv=require(_0x9d73('0x8'));var ejs=require(_0x9d73('0x9'));var fs=require('fs');var fs_extra=require(_0x9d73('0xa'));var _=require(_0x9d73('0xb'));var squel=require('squel');var crypto=require(_0x9d73('0xc'));var jsforce=require(_0x9d73('0xd'));var deskjs=require(_0x9d73('0xe'));var toCsv=require(_0x9d73('0x8'));var querystring=require(_0x9d73('0xf'));var Papa=require(_0x9d73('0x10'));var Redis=require('ioredis');var authService=require(_0x9d73('0x11'));var qs=require(_0x9d73('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d73('0x13'));var logger=require(_0x9d73('0x14'))(_0x9d73('0x15'));var utils=require(_0x9d73('0x16'));var config=require(_0x9d73('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d73('0x18'))['db'];function respondWithStatusCode(_0x1f0371,_0xcb114d){_0xcb114d=_0xcb114d||0xcc;return function(_0x47b610){if(_0x47b610){return _0x1f0371['sendStatus'](_0xcb114d);}return _0x1f0371[_0x9d73('0x19')](_0xcb114d)['end']();};}function respondWithResult(_0x42da76,_0x5b9abf){_0x5b9abf=_0x5b9abf||0xc8;return function(_0x8a2d73){if(_0x8a2d73){return _0x42da76[_0x9d73('0x19')](_0x5b9abf)[_0x9d73('0x1a')](_0x8a2d73);}};}function respondWithFilteredResult(_0x59de9c,_0x5cb9d2){return function(_0x4d7513){if(_0x4d7513){var _0x5755a4=_0x4d7513[_0x9d73('0x1b')],_0x403b12=_0x5cb9d2[_0x9d73('0x1c')],_0x590107=_0x5cb9d2['offset']+_0x5cb9d2['limit'],_0x500b3e;if(_0x590107>=_0x5755a4){_0x590107=_0x5755a4;_0x500b3e=0xc8;}else{_0x500b3e=0xce;}_0x59de9c[_0x9d73('0x19')](_0x500b3e);return _0x59de9c['set'](_0x9d73('0x1d'),_0x403b12+'-'+_0x590107+'/'+_0x5755a4)['json'](_0x4d7513);}return null;};}function patchUpdates(_0x70358b){return function(_0xe4e051){try{jsonpatch[_0x9d73('0x1e')](_0xe4e051,_0x70358b,!![]);}catch(_0xf8e38d){return BPromise[_0x9d73('0x1f')](_0xf8e38d);}return _0xe4e051[_0x9d73('0x20')]();};}function saveUpdates(_0x301890,_0x466e67){return function(_0x967838){if(_0x967838){return _0x967838['update'](_0x301890)[_0x9d73('0x21')](function(_0x59d401){return _0x59d401;});}return null;};}function removeEntity(_0x442f8d,_0x3e6618){return function(_0x6f2628){if(_0x6f2628){return _0x6f2628[_0x9d73('0x22')]()[_0x9d73('0x21')](function(){_0x442f8d[_0x9d73('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5314da,_0x3dbd81){return function(_0x357322){if(!_0x357322){_0x5314da['sendStatus'](0x194);}return _0x357322;};}function handleError(_0x50e531,_0x550c37){_0x550c37=_0x550c37||0x1f4;return function(_0x3677fb){logger[_0x9d73('0x23')](_0x3677fb[_0x9d73('0x24')]);if(_0x3677fb[_0x9d73('0x25')]){delete _0x3677fb[_0x9d73('0x25')];}_0x50e531[_0x9d73('0x19')](_0x550c37)[_0x9d73('0x26')](_0x3677fb);};}exports[_0x9d73('0x27')]=function(_0xcb3f3d,_0x5f3dcb){var _0x271d22={},_0x3f5214={},_0x5504e5={'count':0x0,'rows':[]};var _0x359a6e=_[_0x9d73('0x28')](db[_0x9d73('0x29')][_0x9d73('0x2a')],function(_0x11938c){return{'name':_0x11938c['fieldName'],'type':_0x11938c[_0x9d73('0x2b')][_0x9d73('0x2c')]};});_0x3f5214['model']=_['map'](_0x359a6e,_0x9d73('0x25'));_0x3f5214[_0x9d73('0x2d')]=_[_0x9d73('0x2e')](_0xcb3f3d[_0x9d73('0x2d')]);_0x3f5214[_0x9d73('0x2f')]=_['intersection'](_0x3f5214[_0x9d73('0x30')],_0x3f5214['query']);_0x271d22[_0x9d73('0x31')]=_[_0x9d73('0x32')](_0x3f5214[_0x9d73('0x30')],qs[_0x9d73('0x33')](_0xcb3f3d[_0x9d73('0x2d')][_0x9d73('0x33')]));_0x271d22[_0x9d73('0x31')]=_0x271d22[_0x9d73('0x31')]['length']?_0x271d22[_0x9d73('0x31')]:_0x3f5214[_0x9d73('0x30')];if(!_0xcb3f3d[_0x9d73('0x2d')][_0x9d73('0x34')](_0x9d73('0x35'))){_0x271d22['limit']=qs[_0x9d73('0x36')](_0xcb3f3d[_0x9d73('0x2d')][_0x9d73('0x36')]);_0x271d22[_0x9d73('0x1c')]=qs['offset'](_0xcb3f3d['query']['offset']);}_0x271d22['order']=qs[_0x9d73('0x37')](_0xcb3f3d['query']['sort']);_0x271d22[_0x9d73('0x38')]=qs[_0x9d73('0x2f')](_[_0x9d73('0x39')](_0xcb3f3d[_0x9d73('0x2d')],_0x3f5214['filters']),_0x359a6e);if(_0xcb3f3d[_0x9d73('0x2d')][_0x9d73('0x3a')]){_0x271d22[_0x9d73('0x38')]=_['merge'](_0x271d22['where'],{'$or':_[_0x9d73('0x28')](_0x359a6e,function(_0x77da98){if(_0x77da98[_0x9d73('0x2b')]!==_0x9d73('0x3b')){var _0x203ecc={};_0x203ecc[_0x77da98[_0x9d73('0x25')]]={'$like':'%'+_0xcb3f3d[_0x9d73('0x2d')][_0x9d73('0x3a')]+'%'};return _0x203ecc;}})});}_0x271d22=_[_0x9d73('0x3c')]({},_0x271d22,_0xcb3f3d[_0x9d73('0x3d')]);var _0x4ad6d8={'where':_0x271d22['where']};return db['MailQueueReport']['count'](_0x4ad6d8)[_0x9d73('0x21')](function(_0x42ceab){_0x5504e5[_0x9d73('0x1b')]=_0x42ceab;if(_0xcb3f3d['query'][_0x9d73('0x3e')]){_0x271d22['include']=[{'all':!![]}];}return db[_0x9d73('0x29')][_0x9d73('0x3f')](_0x271d22);})['then'](function(_0xa13477){_0x5504e5[_0x9d73('0x40')]=_0xa13477;return _0x5504e5;})[_0x9d73('0x21')](respondWithFilteredResult(_0x5f3dcb,_0x271d22))['catch'](handleError(_0x5f3dcb,null));};exports[_0x9d73('0x41')]=function(_0x46c3e7,_0x892ceb){var _0x5d9781={'raw':!![],'where':{'id':_0x46c3e7[_0x9d73('0x42')]['id']}},_0x1218d0={};_0x1218d0[_0x9d73('0x30')]=_['keys'](db[_0x9d73('0x29')]['rawAttributes']);_0x1218d0[_0x9d73('0x2d')]=_[_0x9d73('0x2e')](_0x46c3e7[_0x9d73('0x2d')]);_0x1218d0['filters']=_[_0x9d73('0x32')](_0x1218d0[_0x9d73('0x30')],_0x1218d0[_0x9d73('0x2d')]);_0x5d9781[_0x9d73('0x31')]=_[_0x9d73('0x32')](_0x1218d0[_0x9d73('0x30')],qs[_0x9d73('0x33')](_0x46c3e7[_0x9d73('0x2d')][_0x9d73('0x33')]));_0x5d9781[_0x9d73('0x31')]=_0x5d9781['attributes'][_0x9d73('0x43')]?_0x5d9781[_0x9d73('0x31')]:_0x1218d0[_0x9d73('0x30')];if(_0x46c3e7[_0x9d73('0x2d')][_0x9d73('0x3e')]){_0x5d9781['include']=[{'all':!![]}];}_0x5d9781=_[_0x9d73('0x3c')]({},_0x5d9781,_0x46c3e7['options']);return db[_0x9d73('0x29')][_0x9d73('0x44')](_0x5d9781)[_0x9d73('0x21')](handleEntityNotFound(_0x892ceb,null))[_0x9d73('0x21')](respondWithResult(_0x892ceb,null))[_0x9d73('0x45')](handleError(_0x892ceb,null));};exports['create']=function(_0x238a01,_0x5d0b7a){return db[_0x9d73('0x29')]['create'](_0x238a01[_0x9d73('0x46')],{})[_0x9d73('0x21')](respondWithResult(_0x5d0b7a,0xc9))[_0x9d73('0x45')](handleError(_0x5d0b7a,null));};exports[_0x9d73('0x47')]=function(_0x5b6b42,_0x398c46){if(_0x5b6b42['body']['id']){delete _0x5b6b42[_0x9d73('0x46')]['id'];}return db[_0x9d73('0x29')][_0x9d73('0x44')]({'where':{'id':_0x5b6b42[_0x9d73('0x42')]['id']}})['then'](handleEntityNotFound(_0x398c46,null))[_0x9d73('0x21')](saveUpdates(_0x5b6b42[_0x9d73('0x46')],null))[_0x9d73('0x21')](respondWithResult(_0x398c46,null))[_0x9d73('0x45')](handleError(_0x398c46,null));};exports[_0x9d73('0x22')]=function(_0x3aa903,_0x588dd0){return db[_0x9d73('0x29')][_0x9d73('0x44')]({'where':{'id':_0x3aa903[_0x9d73('0x42')]['id']}})['then'](handleEntityNotFound(_0x588dd0,null))[_0x9d73('0x21')](removeEntity(_0x588dd0,null))['catch'](handleError(_0x588dd0,null));};exports[_0x9d73('0x48')]=function(_0x5c32c5,_0x3cd617){return db[_0x9d73('0x29')][_0x9d73('0x48')]()[_0x9d73('0x21')](respondWithResult(_0x3cd617,null))[_0x9d73('0x45')](handleError(_0x3cd617,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 0655d94..d7223a2 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 _0x2feb=['rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger','api','moment','path'];(function(_0x36616a,_0x5bce26){var _0x2223f5=function(_0xa31db2){while(--_0xa31db2){_0x36616a['push'](_0x36616a['shift']());}};_0x2223f5(++_0x5bce26);}(_0x2feb,0x10c));var _0xb2fe=function(_0x195c2c,_0x157ee4){_0x195c2c=_0x195c2c-0x0;var _0x35dbee=_0x2feb[_0x195c2c];return _0x35dbee;};'use strict';var _=require(_0xb2fe('0x0'));var util=require('util');var logger=require(_0xb2fe('0x1'))(_0xb2fe('0x2'));var moment=require(_0xb2fe('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb2fe('0x4'));var rimraf=require(_0xb2fe('0x5'));var config=require(_0xb2fe('0x6'));var attributes=require(_0xb2fe('0x7'));module[_0xb2fe('0x8')]=function(_0x1f36ed,_0x4beda6){return _0x1f36ed[_0xb2fe('0x9')](_0xb2fe('0xa'),attributes,{'tableName':_0xb2fe('0xb'),'paranoid':![],'indexes':[{'name':_0xb2fe('0xc'),'fields':[_0xb2fe('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbd9b=['bluebird','request-promise','rimraf','../../config/environment','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xbd9b,0x1dd));var _0xbbd9=function(_0x46f1b5,_0x3f96a4){_0x46f1b5=_0x46f1b5-0x0;var _0x505c69=_0xbd9b[_0x46f1b5];return _0x505c69;};'use strict';var _=require(_0xbbd9('0x0'));var util=require(_0xbbd9('0x1'));var logger=require(_0xbbd9('0x2'))('api');var moment=require(_0xbbd9('0x3'));var BPromise=require(_0xbbd9('0x4'));var rp=require(_0xbbd9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbbd9('0x6'));var config=require(_0xbbd9('0x7'));var attributes=require('./mailQueueReport.attributes');module[_0xbbd9('0x8')]=function(_0x31ce6a,_0x29f997){return _0x31ce6a[_0xbbd9('0x9')](_0xbbd9('0xa'),attributes,{'tableName':_0xbbd9('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xbbd9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 49a94b0..2607523 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 _0xdb3a=['catch','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','stringify','error','message','MailQueueReport,\x20%s,\x20%s'];(function(_0x80360d,_0x131681){var _0x45cd8c=function(_0x1dd2c8){while(--_0x1dd2c8){_0x80360d['push'](_0x80360d['shift']());}};_0x45cd8c(++_0x131681);}(_0xdb3a,0x17e));var _0xadb3=function(_0x75267d,_0x5d286c){_0x75267d=_0x75267d-0x0;var _0x21ccec=_0xdb3a[_0x75267d];return _0x21ccec;};'use strict';var _=require('lodash');var util=require(_0xadb3('0x0'));var moment=require(_0xadb3('0x1'));var BPromise=require(_0xadb3('0x2'));var rs=require(_0xadb3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xadb3('0x4'))['db'];var utils=require(_0xadb3('0x5'));var logger=require('../../config/logger')(_0xadb3('0x6'));var config=require(_0xadb3('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xadb3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40e2df,_0x12c667,_0x3edf3c){return new BPromise(function(_0x4dea93,_0x39994f){return client[_0xadb3('0x9')](_0x40e2df,_0x3edf3c)[_0xadb3('0xa')](function(_0x57ddb5){logger[_0xadb3('0xb')]('MailQueueReport,\x20%s,\x20%s',_0x12c667,_0xadb3('0xc'));logger[_0xadb3('0xd')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x12c667,_0xadb3('0xc'),JSON[_0xadb3('0xe')](_0x57ddb5));if(_0x57ddb5[_0xadb3('0xf')]){if(_0x57ddb5[_0xadb3('0xf')]['code']===0x1f4){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x12c667,_0x57ddb5[_0xadb3('0xf')][_0xadb3('0x10')]);return _0x39994f(_0x57ddb5[_0xadb3('0xf')][_0xadb3('0x10')]);}logger['error'](_0xadb3('0x11'),_0x12c667,_0x57ddb5[_0xadb3('0xf')]['message']);return _0x4dea93(_0x57ddb5[_0xadb3('0xf')][_0xadb3('0x10')]);}else{logger['info'](_0xadb3('0x11'),_0x12c667,_0xadb3('0xc'));_0x4dea93(_0x57ddb5['result'][_0xadb3('0x10')]);}})[_0xadb3('0x12')](function(_0x578901){logger[_0xadb3('0xf')](_0xadb3('0x11'),_0x12c667,_0x578901);_0x39994f(_0x578901);});});}exports['CreateMailQueueReport']=function(_0x528f07){var _0x2e5d48=this;return new Promise(function(_0x2b2c99,_0x28a8e9){return db['MailQueueReport']['create'](_0x528f07['body'],{'raw':_0x528f07['options']?_0x528f07[_0xadb3('0x13')][_0xadb3('0x14')]===undefined?!![]:![]:!![]})['then'](function(_0x3ef32c){logger[_0xadb3('0xb')]('CreateMailQueueReport',_0x528f07);logger[_0xadb3('0xd')]('CreateMailQueueReport',_0x528f07,JSON[_0xadb3('0xe')](_0x3ef32c));_0x2b2c99(_0x3ef32c);})['catch'](function(_0x4e7c31){logger[_0xadb3('0xf')](_0xadb3('0x15'),_0x4e7c31[_0xadb3('0x10')],_0x528f07);_0x28a8e9(_0x2e5d48[_0xadb3('0xf')](0x1f4,_0x4e7c31['message']));});});};exports[_0xadb3('0x16')]=function(_0x30d676){var _0x22ea34=this;return new Promise(function(_0x467cd1,_0x5a0e57){return db['MailQueueReport'][_0xadb3('0x17')](_0x30d676['body'],{'raw':_0x30d676[_0xadb3('0x13')]?_0x30d676[_0xadb3('0x13')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30d676[_0xadb3('0x13')]?_0x30d676[_0xadb3('0x13')]['where']||null:null,'attributes':_0x30d676[_0xadb3('0x13')]?_0x30d676['options']['attributes']||null:null,'limit':_0x30d676[_0xadb3('0x13')]?_0x30d676['options'][_0xadb3('0x18')]||null:null})['then'](function(_0x2c7731){logger['info']('UpdateMailQueueReport',_0x30d676);logger[_0xadb3('0xd')](_0xadb3('0x16'),_0x30d676,JSON[_0xadb3('0xe')](_0x2c7731));_0x467cd1(_0x2c7731);})[_0xadb3('0x12')](function(_0x15d6f3){logger[_0xadb3('0xf')]('UpdateMailQueueReport',_0x15d6f3[_0xadb3('0x10')],_0x30d676);_0x5a0e57(_0x22ea34[_0xadb3('0xf')](0x1f4,_0x15d6f3['message']));});});}; \ No newline at end of file +var _0xd348=['error','code','message','result','catch','CreateMailQueueReport','create','body','options','raw','UpdateMailQueueReport','MailQueueReport','update','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd348,0xce));var _0x8d34=function(_0x52565f,_0x27637e){_0x52565f=_0x52565f-0x0;var _0x53b9e9=_0xd348[_0x52565f];return _0x53b9e9;};'use strict';var _=require(_0x8d34('0x0'));var util=require(_0x8d34('0x1'));var moment=require('moment');var BPromise=require(_0x8d34('0x2'));var rs=require(_0x8d34('0x3'));var fs=require('fs');var Redis=require(_0x8d34('0x4'));var db=require(_0x8d34('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8d34('0x6'))(_0x8d34('0x7'));var config=require(_0x8d34('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8d34('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xeacd0f,_0xae9dca,_0x2bcac9){return new BPromise(function(_0x308ab9,_0x4baead){return client[_0x8d34('0xa')](_0xeacd0f,_0x2bcac9)[_0x8d34('0xb')](function(_0x2e32ff){logger[_0x8d34('0xc')](_0x8d34('0xd'),_0xae9dca,_0x8d34('0xe'));logger[_0x8d34('0xf')](_0x8d34('0x10'),_0xae9dca,_0x8d34('0xe'),JSON[_0x8d34('0x11')](_0x2e32ff));if(_0x2e32ff[_0x8d34('0x12')]){if(_0x2e32ff[_0x8d34('0x12')][_0x8d34('0x13')]===0x1f4){logger[_0x8d34('0x12')](_0x8d34('0xd'),_0xae9dca,_0x2e32ff[_0x8d34('0x12')][_0x8d34('0x14')]);return _0x4baead(_0x2e32ff[_0x8d34('0x12')][_0x8d34('0x14')]);}logger[_0x8d34('0x12')](_0x8d34('0xd'),_0xae9dca,_0x2e32ff['error'][_0x8d34('0x14')]);return _0x308ab9(_0x2e32ff[_0x8d34('0x12')][_0x8d34('0x14')]);}else{logger[_0x8d34('0xc')](_0x8d34('0xd'),_0xae9dca,_0x8d34('0xe'));_0x308ab9(_0x2e32ff[_0x8d34('0x15')]['message']);}})[_0x8d34('0x16')](function(_0x2465d6){logger[_0x8d34('0x12')]('MailQueueReport,\x20%s,\x20%s',_0xae9dca,_0x2465d6);_0x4baead(_0x2465d6);});});}exports[_0x8d34('0x17')]=function(_0x4982b5){var _0x31dc2b=this;return new Promise(function(_0x549908,_0x2caf64){return db['MailQueueReport'][_0x8d34('0x18')](_0x4982b5[_0x8d34('0x19')],{'raw':_0x4982b5[_0x8d34('0x1a')]?_0x4982b5['options'][_0x8d34('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3f1986){logger[_0x8d34('0xc')](_0x8d34('0x17'),_0x4982b5);logger[_0x8d34('0xf')](_0x8d34('0x17'),_0x4982b5,JSON['stringify'](_0x3f1986));_0x549908(_0x3f1986);})[_0x8d34('0x16')](function(_0x48a080){logger['error'](_0x8d34('0x17'),_0x48a080[_0x8d34('0x14')],_0x4982b5);_0x2caf64(_0x31dc2b[_0x8d34('0x12')](0x1f4,_0x48a080[_0x8d34('0x14')]));});});};exports[_0x8d34('0x1c')]=function(_0x31455e){var _0x4718e9=this;return new Promise(function(_0x5572b0,_0x59fade){return db[_0x8d34('0x1d')][_0x8d34('0x1e')](_0x31455e[_0x8d34('0x19')],{'raw':_0x31455e[_0x8d34('0x1a')]?_0x31455e[_0x8d34('0x1a')][_0x8d34('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31455e[_0x8d34('0x1a')]?_0x31455e[_0x8d34('0x1a')]['where']||null:null,'attributes':_0x31455e['options']?_0x31455e['options']['attributes']||null:null,'limit':_0x31455e['options']?_0x31455e[_0x8d34('0x1a')][_0x8d34('0x1f')]||null:null})[_0x8d34('0xb')](function(_0x5a17b5){logger[_0x8d34('0xc')]('UpdateMailQueueReport',_0x31455e);logger[_0x8d34('0xf')](_0x8d34('0x1c'),_0x31455e,JSON[_0x8d34('0x11')](_0x5a17b5));_0x5572b0(_0x5a17b5);})[_0x8d34('0x16')](function(_0x4afbb3){logger[_0x8d34('0x12')](_0x8d34('0x1c'),_0x4afbb3[_0x8d34('0x14')],_0x31455e);_0x59fade(_0x4718e9['error'](0x1f4,_0x4afbb3['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 9ac224c..a9016e6 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 _0x72a1=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x1e63c9,_0x4b31a1){var _0x274871=function(_0x3c5e18){while(--_0x3c5e18){_0x1e63c9['push'](_0x1e63c9['shift']());}};_0x274871(++_0x4b31a1);}(_0x72a1,0x1ce));var _0x172a=function(_0x4a28dd,_0x2f0bf0){_0x4a28dd=_0x4a28dd-0x0;var _0x1a4c3d=_0x72a1[_0x4a28dd];return _0x1a4c3d;};'use strict';var multer=require('multer');var util=require(_0x172a('0x0'));var path=require('path');var timeout=require(_0x172a('0x1'));var express=require('express');var router=express[_0x172a('0x2')]();var fs_extra=require(_0x172a('0x3'));var auth=require(_0x172a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x172a('0x5'));module['exports']=router; \ No newline at end of file +var _0x5397=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x24826c,_0x5d4ad3){var _0x5ca07b=function(_0x360ba3){while(--_0x360ba3){_0x24826c['push'](_0x24826c['shift']());}};_0x5ca07b(++_0x5d4ad3);}(_0x5397,0x105));var _0x7539=function(_0x5ab591,_0x37d129){_0x5ab591=_0x5ab591-0x0;var _0x395751=_0x5397[_0x5ab591];return _0x395751;};'use strict';var multer=require('multer');var util=require(_0x7539('0x0'));var path=require(_0x7539('0x1'));var timeout=require(_0x7539('0x2'));var express=require(_0x7539('0x3'));var router=express[_0x7539('0x4')]();var fs_extra=require(_0x7539('0x5'));var auth=require(_0x7539('0x6'));var interaction=require(_0x7539('0x7'));var config=require(_0x7539('0x8'));module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 7466d98..f5c262c 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 _0x9914=['BOOLEAN','INBOX','sequelize','exports','STRING','username','INTEGER'];(function(_0x73c7f6,_0x4d5a84){var _0x1f1c4e=function(_0x47f515){while(--_0x47f515){_0x73c7f6['push'](_0x73c7f6['shift']());}};_0x1f1c4e(++_0x4d5a84);}(_0x9914,0xf0));var _0x4991=function(_0x4c2fe6,_0x5e7094){_0x4c2fe6=_0x4c2fe6-0x0;var _0x4f47a0=_0x9914[_0x4c2fe6];return _0x4f47a0;};'use strict';var Sequelize=require(_0x4991('0x0'));module[_0x4991('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x4991('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x4991('0x2')],'unique':_0x4991('0x3')},'password':{'type':Sequelize[_0x4991('0x2')]},'port':{'type':Sequelize[_0x4991('0x4')]},'tls':{'type':Sequelize[_0x4991('0x5')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x4991('0x2')],'defaultValue':_0x4991('0x6')},'connTimeout':{'type':Sequelize[_0x4991('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x4991('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x4991('0x2')]}}; \ No newline at end of file +var _0x6def=['BOOLEAN','username','INTEGER','sequelize','STRING'];(function(_0x400360,_0x27cd32){var _0x2688e3=function(_0x441007){while(--_0x441007){_0x400360['push'](_0x400360['shift']());}};_0x2688e3(++_0x27cd32);}(_0x6def,0x166));var _0xf6de=function(_0x5a3589,_0x21fd98){_0x5a3589=_0x5a3589-0x0;var _0x36873e=_0x6def[_0x5a3589];return _0x36873e;};'use strict';var Sequelize=require(_0xf6de('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xf6de('0x1')]},'authentication':{'type':Sequelize[_0xf6de('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xf6de('0x1')],'unique':_0xf6de('0x3')},'password':{'type':Sequelize[_0xf6de('0x1')]},'port':{'type':Sequelize[_0xf6de('0x4')]},'tls':{'type':Sequelize[_0xf6de('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xf6de('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xf6de('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xf6de('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xf6de('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 221b782..b4202a2 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 _0x1775=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','util'];(function(_0xa65c2c,_0x786dbb){var _0x5aa54a=function(_0x74db57){while(--_0x74db57){_0xa65c2c['push'](_0xa65c2c['shift']());}};_0x5aa54a(++_0x786dbb);}(_0x1775,0x1db));var _0x5177=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x1775[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x5177('0x0'));var logger=require(_0x5177('0x1'))(_0x5177('0x2'));var moment=require(_0x5177('0x3'));var BPromise=require(_0x5177('0x4'));var rp=require(_0x5177('0x5'));var fs=require('fs');var path=require(_0x5177('0x6'));var rimraf=require(_0x5177('0x7'));var config=require(_0x5177('0x8'));var attributes=require(_0x5177('0x9'));module[_0x5177('0xa')]=function(_0x2c5c42,_0x153c1a){return _0x2c5c42[_0x5177('0xb')](_0x5177('0xc'),attributes,{'tableName':_0x5177('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4227=['./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','api','bluebird','request-promise','path','../../config/environment'];(function(_0x5b6ae2,_0x7752b9){var _0x29eb72=function(_0x4cb009){while(--_0x4cb009){_0x5b6ae2['push'](_0x5b6ae2['shift']());}};_0x29eb72(++_0x7752b9);}(_0x4227,0x89));var _0x7422=function(_0x5b66e5,_0x194afc){_0x5b66e5=_0x5b66e5-0x0;var _0x2f71d2=_0x4227[_0x5b66e5];return _0x2f71d2;};'use strict';var _=require(_0x7422('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7422('0x1'));var moment=require('moment');var BPromise=require(_0x7422('0x2'));var rp=require(_0x7422('0x3'));var fs=require('fs');var path=require(_0x7422('0x4'));var rimraf=require('rimraf');var config=require(_0x7422('0x5'));var attributes=require(_0x7422('0x6'));module[_0x7422('0x7')]=function(_0x36ddba,_0x4432d6){return _0x36ddba[_0x7422('0x8')](_0x7422('0x9'),attributes,{'tableName':_0x7422('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index f045392..9628951 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 _0x1244=['message','result','catch','GetMailServerIn','MailServerIn','findAll','options','where','limit','include','attributes','model','map','debug','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x4445d5,_0x55f47c){var _0x31a61c=function(_0xb3fe6f){while(--_0xb3fe6f){_0x4445d5['push'](_0x4445d5['shift']());}};_0x31a61c(++_0x55f47c);}(_0x1244,0x74));var _0x4124=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x1244[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0x4124('0x0'));var util=require(_0x4124('0x1'));var moment=require(_0x4124('0x2'));var BPromise=require(_0x4124('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4124('0x4'))['db'];var utils=require(_0x4124('0x5'));var logger=require(_0x4124('0x6'))(_0x4124('0x7'));var config=require(_0x4124('0x8'));var jayson=require(_0x4124('0x9'));var client=jayson[_0x4124('0xa')][_0x4124('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x481e01,_0x5b42b8,_0x588eea){return new BPromise(function(_0x157664,_0x4d0f0d){return client[_0x4124('0xc')](_0x481e01,_0x588eea)[_0x4124('0xd')](function(_0x368319){logger[_0x4124('0xe')](_0x4124('0xf'),_0x5b42b8,_0x4124('0x10'));logger['debug']('MailServerIn,\x20%s,\x20%s,\x20%s',_0x5b42b8,_0x4124('0x10'),JSON[_0x4124('0x11')](_0x368319));if(_0x368319[_0x4124('0x12')]){if(_0x368319['error'][_0x4124('0x13')]===0x1f4){logger['error'](_0x4124('0xf'),_0x5b42b8,_0x368319[_0x4124('0x12')][_0x4124('0x14')]);return _0x4d0f0d(_0x368319['error'][_0x4124('0x14')]);}logger[_0x4124('0x12')]('MailServerIn,\x20%s,\x20%s',_0x5b42b8,_0x368319['error'][_0x4124('0x14')]);return _0x157664(_0x368319[_0x4124('0x12')][_0x4124('0x14')]);}else{logger['info'](_0x4124('0xf'),_0x5b42b8,'request\x20sent');_0x157664(_0x368319[_0x4124('0x15')]['message']);}})[_0x4124('0x16')](function(_0x53c82d){logger['error'](_0x4124('0xf'),_0x5b42b8,_0x53c82d);_0x4d0f0d(_0x53c82d);});});}exports[_0x4124('0x17')]=function(_0x48130b){var _0x1b5f75=this;return new Promise(function(_0x4326dc,_0x40b121){return db[_0x4124('0x18')][_0x4124('0x19')]({'raw':_0x48130b[_0x4124('0x1a')]?_0x48130b[_0x4124('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x48130b[_0x4124('0x1a')]?_0x48130b[_0x4124('0x1a')][_0x4124('0x1b')]||null:null,'attributes':_0x48130b['options']?_0x48130b['options']['attributes']||null:null,'limit':_0x48130b[_0x4124('0x1a')]?_0x48130b['options'][_0x4124('0x1c')]||null:null,'include':_0x48130b[_0x4124('0x1a')]?_0x48130b[_0x4124('0x1a')][_0x4124('0x1d')]?_['map'](_0x48130b[_0x4124('0x1a')][_0x4124('0x1d')],function(_0x4edb22){return{'model':db[_0x4edb22['model']],'as':_0x4edb22['as'],'attributes':_0x4edb22[_0x4124('0x1e')],'include':_0x4edb22[_0x4124('0x1d')]?_['map'](_0x4edb22['include'],function(_0x50f005){return{'model':db[_0x50f005[_0x4124('0x1f')]],'as':_0x50f005['as'],'attributes':_0x50f005[_0x4124('0x1e')],'include':_0x50f005[_0x4124('0x1d')]?_[_0x4124('0x20')](_0x50f005['include'],function(_0x28fd78){return{'model':db[_0x28fd78[_0x4124('0x1f')]],'as':_0x28fd78['as'],'attributes':_0x28fd78[_0x4124('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4124('0xd')](function(_0x403aac){logger[_0x4124('0xe')](_0x4124('0x17'),_0x48130b);logger[_0x4124('0x21')]('GetMailServerIn',_0x48130b,JSON[_0x4124('0x11')](_0x403aac));_0x4326dc(_0x403aac);})[_0x4124('0x16')](function(_0x921b66){logger['error']('GetMailServerIn',_0x921b66[_0x4124('0x14')],_0x48130b);_0x40b121(_0x1b5f75['error'](0x1f4,_0x921b66['message']));});});}; \ No newline at end of file +var _0x9bc7=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','MailServerIn','findAll','options','raw','where','limit','include','map','attributes','model','then','GetMailServerIn'];(function(_0x1a958a,_0x5a7cc0){var _0x4faef8=function(_0x4e9c26){while(--_0x4e9c26){_0x1a958a['push'](_0x1a958a['shift']());}};_0x4faef8(++_0x5a7cc0);}(_0x9bc7,0x70));var _0x79bc=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9bc7[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x79bc('0x0'));var util=require(_0x79bc('0x1'));var moment=require('moment');var BPromise=require(_0x79bc('0x2'));var rs=require(_0x79bc('0x3'));var fs=require('fs');var Redis=require(_0x79bc('0x4'));var db=require(_0x79bc('0x5'))['db'];var utils=require(_0x79bc('0x6'));var logger=require(_0x79bc('0x7'))(_0x79bc('0x8'));var config=require(_0x79bc('0x9'));var jayson=require(_0x79bc('0xa'));var client=jayson[_0x79bc('0xb')][_0x79bc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21f7fd,_0x3a6adb,_0x2eaf50){return new BPromise(function(_0x199b55,_0xafdcc0){return client[_0x79bc('0xd')](_0x21f7fd,_0x2eaf50)['then'](function(_0x59ee9f){logger[_0x79bc('0xe')](_0x79bc('0xf'),_0x3a6adb,_0x79bc('0x10'));logger[_0x79bc('0x11')](_0x79bc('0x12'),_0x3a6adb,'request\x20sent',JSON[_0x79bc('0x13')](_0x59ee9f));if(_0x59ee9f['error']){if(_0x59ee9f['error'][_0x79bc('0x14')]===0x1f4){logger[_0x79bc('0x15')](_0x79bc('0xf'),_0x3a6adb,_0x59ee9f[_0x79bc('0x15')][_0x79bc('0x16')]);return _0xafdcc0(_0x59ee9f['error'][_0x79bc('0x16')]);}logger['error'](_0x79bc('0xf'),_0x3a6adb,_0x59ee9f['error'][_0x79bc('0x16')]);return _0x199b55(_0x59ee9f[_0x79bc('0x15')][_0x79bc('0x16')]);}else{logger['info'](_0x79bc('0xf'),_0x3a6adb,_0x79bc('0x10'));_0x199b55(_0x59ee9f[_0x79bc('0x17')][_0x79bc('0x16')]);}})['catch'](function(_0x5d3455){logger['error'](_0x79bc('0xf'),_0x3a6adb,_0x5d3455);_0xafdcc0(_0x5d3455);});});}exports['GetMailServerIn']=function(_0x5bfcd2){var _0x283026=this;return new Promise(function(_0x478851,_0x19c96a){return db[_0x79bc('0x18')][_0x79bc('0x19')]({'raw':_0x5bfcd2[_0x79bc('0x1a')]?_0x5bfcd2['options'][_0x79bc('0x1b')]===undefined?!![]:![]:!![],'where':_0x5bfcd2[_0x79bc('0x1a')]?_0x5bfcd2[_0x79bc('0x1a')][_0x79bc('0x1c')]||null:null,'attributes':_0x5bfcd2[_0x79bc('0x1a')]?_0x5bfcd2[_0x79bc('0x1a')]['attributes']||null:null,'limit':_0x5bfcd2[_0x79bc('0x1a')]?_0x5bfcd2[_0x79bc('0x1a')][_0x79bc('0x1d')]||null:null,'include':_0x5bfcd2[_0x79bc('0x1a')]?_0x5bfcd2[_0x79bc('0x1a')][_0x79bc('0x1e')]?_[_0x79bc('0x1f')](_0x5bfcd2[_0x79bc('0x1a')][_0x79bc('0x1e')],function(_0x3c2aa0){return{'model':db[_0x3c2aa0['model']],'as':_0x3c2aa0['as'],'attributes':_0x3c2aa0[_0x79bc('0x20')],'include':_0x3c2aa0[_0x79bc('0x1e')]?_[_0x79bc('0x1f')](_0x3c2aa0[_0x79bc('0x1e')],function(_0x5b21ab){return{'model':db[_0x5b21ab[_0x79bc('0x21')]],'as':_0x5b21ab['as'],'attributes':_0x5b21ab['attributes'],'include':_0x5b21ab[_0x79bc('0x1e')]?_[_0x79bc('0x1f')](_0x5b21ab[_0x79bc('0x1e')],function(_0x20c2a7){return{'model':db[_0x20c2a7['model']],'as':_0x20c2a7['as'],'attributes':_0x20c2a7[_0x79bc('0x20')]};}):[]};}):[]};}):[]:[]})[_0x79bc('0x22')](function(_0x29cb51){logger['info'](_0x79bc('0x23'),_0x5bfcd2);logger[_0x79bc('0x11')](_0x79bc('0x23'),_0x5bfcd2,JSON['stringify'](_0x29cb51));_0x478851(_0x29cb51);})[_0x79bc('0x24')](function(_0x49b667){logger[_0x79bc('0x15')]('GetMailServerIn',_0x49b667[_0x79bc('0x16')],_0x5bfcd2);_0x19c96a(_0x283026[_0x79bc('0x15')](0x1f4,_0x49b667[_0x79bc('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index b772a28..dc386e3 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 _0xec56=['update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x4c9915,_0x59725c){var _0x59bc68=function(_0x371075){while(--_0x371075){_0x4c9915['push'](_0x4c9915['shift']());}};_0x59bc68(++_0x59725c);}(_0xec56,0x1bd));var _0x6ec5=function(_0x3a7979,_0x44b6c6){_0x3a7979=_0x3a7979-0x0;var _0x277b0c=_0xec56[_0x3a7979];return _0x277b0c;};'use strict';var multer=require(_0x6ec5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6ec5('0x1'));var express=require(_0x6ec5('0x2'));var router=express[_0x6ec5('0x3')]();var fs_extra=require(_0x6ec5('0x4'));var auth=require(_0x6ec5('0x5'));var interaction=require(_0x6ec5('0x6'));var config=require(_0x6ec5('0x7'));var controller=require(_0x6ec5('0x8'));router[_0x6ec5('0x9')]('/',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xb')]);router[_0x6ec5('0x9')](_0x6ec5('0xc'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xd')]);router[_0x6ec5('0xe')]('/',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xf')]);router[_0x6ec5('0x10')]('/:id',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x11')]);router[_0x6ec5('0x12')](_0x6ec5('0xc'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x13')]);module[_0x6ec5('0x14')]=router; \ No newline at end of file +var _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x2d84f8,_0x44e209){var _0x3c2603=function(_0x30cffa){while(--_0x30cffa){_0x2d84f8['push'](_0x2d84f8['shift']());}};_0x3c2603(++_0x44e209);}(_0x008c,0x188));var _0xc008=function(_0x33d5d6,_0x2ad866){_0x33d5d6=_0x33d5d6-0x0;var _0x27032e=_0x008c[_0x33d5d6];return _0x27032e;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index c4272eb..5a6a045 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 _0x1b9b=['STRING','BOOLEAN','sequelize'];(function(_0x413392,_0x796c1f){var _0x2751e8=function(_0x395d67){while(--_0x395d67){_0x413392['push'](_0x413392['shift']());}};_0x2751e8(++_0x796c1f);}(_0x1b9b,0x89));var _0xb1b9=function(_0x48110a,_0x298104){_0x48110a=_0x48110a-0x0;var _0x431e08=_0x1b9b[_0x48110a];return _0x431e08;};'use strict';var Sequelize=require(_0xb1b9('0x0'));module['exports']={'description':{'type':Sequelize[_0xb1b9('0x1')]},'host':{'type':Sequelize[_0xb1b9('0x1')]},'user':{'type':Sequelize[_0xb1b9('0x1')]},'pass':{'type':Sequelize[_0xb1b9('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xb1b9('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0xb1b9('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x36f3=['INTEGER','BOOLEAN','exports','STRING'];(function(_0x3a238d,_0x103eff){var _0x491b6c=function(_0x471070){while(--_0x471070){_0x3a238d['push'](_0x3a238d['shift']());}};_0x491b6c(++_0x103eff);}(_0x36f3,0xe6));var _0x336f=function(_0x36d5d5,_0x1c1590){_0x36d5d5=_0x36d5d5-0x0;var _0x4eaa56=_0x36f3[_0x36d5d5];return _0x4eaa56;};'use strict';var Sequelize=require('sequelize');module[_0x336f('0x0')]={'description':{'type':Sequelize[_0x336f('0x1')]},'host':{'type':Sequelize[_0x336f('0x1')]},'user':{'type':Sequelize[_0x336f('0x1')]},'pass':{'type':Sequelize[_0x336f('0x1')]},'port':{'type':Sequelize[_0x336f('0x2')]},'secure':{'type':Sequelize[_0x336f('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x336f('0x1')]},'authentication':{'type':Sequelize[_0x336f('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 6753599..703d16a 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 _0x3af2=['then','destroy','error','stack','index','MailServerOut','rawAttributes','fieldName','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update'];(function(_0xbdf091,_0x35a06c){var _0x129fd5=function(_0x529abd){while(--_0x529abd){_0xbdf091['push'](_0xbdf091['shift']());}};_0x129fd5(++_0x35a06c);}(_0x3af2,0x1d6));var _0x23af=function(_0x100e36,_0x4da225){_0x100e36=_0x100e36-0x0;var _0x1df0c9=_0x3af2[_0x100e36];return _0x1df0c9;};'use strict';var pdf=require(_0x23af('0x0'));var emlformat=require(_0x23af('0x1'));var rimraf=require(_0x23af('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x23af('0x3'));var moment=require(_0x23af('0x4'));var BPromise=require(_0x23af('0x5'));var Mustache=require(_0x23af('0x6'));var util=require(_0x23af('0x7'));var path=require(_0x23af('0x8'));var sox=require('sox');var csv=require(_0x23af('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x23af('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x23af('0xb'));var deskjs=require(_0x23af('0xc'));var toCsv=require('to-csv');var querystring=require(_0x23af('0xd'));var Papa=require(_0x23af('0xe'));var Redis=require(_0x23af('0xf'));var authService=require(_0x23af('0x10'));var qs=require(_0x23af('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x23af('0x12'))('api');var utils=require(_0x23af('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x23af('0x14'));var db=require(_0x23af('0x15'))['db'];function respondWithStatusCode(_0x1a1fe5,_0x3e6148){_0x3e6148=_0x3e6148||0xcc;return function(_0x1acb1e){if(_0x1acb1e){return _0x1a1fe5[_0x23af('0x16')](_0x3e6148);}return _0x1a1fe5[_0x23af('0x17')](_0x3e6148)[_0x23af('0x18')]();};}function respondWithResult(_0x1eda1f,_0x3fe930){_0x3fe930=_0x3fe930||0xc8;return function(_0x38eb38){if(_0x38eb38){return _0x1eda1f[_0x23af('0x17')](_0x3fe930)[_0x23af('0x19')](_0x38eb38);}};}function respondWithFilteredResult(_0x540afe,_0x556e84){return function(_0x561d69){if(_0x561d69){var _0x1ce53b=_0x561d69[_0x23af('0x1a')],_0x366a6e=_0x556e84[_0x23af('0x1b')],_0x251876=_0x556e84[_0x23af('0x1b')]+_0x556e84[_0x23af('0x1c')],_0x111311;if(_0x251876>=_0x1ce53b){_0x251876=_0x1ce53b;_0x111311=0xc8;}else{_0x111311=0xce;}_0x540afe[_0x23af('0x17')](_0x111311);return _0x540afe['set'](_0x23af('0x1d'),_0x366a6e+'-'+_0x251876+'/'+_0x1ce53b)[_0x23af('0x19')](_0x561d69);}return null;};}function patchUpdates(_0x198d26){return function(_0x580aab){try{jsonpatch[_0x23af('0x1e')](_0x580aab,_0x198d26,!![]);}catch(_0x387000){return BPromise[_0x23af('0x1f')](_0x387000);}return _0x580aab[_0x23af('0x20')]();};}function saveUpdates(_0x5bbb3d,_0x4c0da6){return function(_0x1b7d13){if(_0x1b7d13){return _0x1b7d13[_0x23af('0x21')](_0x5bbb3d)[_0x23af('0x22')](function(_0x15d0af){return _0x15d0af;});}return null;};}function removeEntity(_0x51d244,_0x3c6f8b){return function(_0x5df792){if(_0x5df792){return _0x5df792[_0x23af('0x23')]()['then'](function(){_0x51d244[_0x23af('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f5c83,_0x4c6f7f){return function(_0x26247b){if(!_0x26247b){_0x1f5c83[_0x23af('0x16')](0x194);}return _0x26247b;};}function handleError(_0x1b6bae,_0x3a68a3){_0x3a68a3=_0x3a68a3||0x1f4;return function(_0x1961dc){logger[_0x23af('0x24')](_0x1961dc[_0x23af('0x25')]);if(_0x1961dc['name']){delete _0x1961dc['name'];}_0x1b6bae[_0x23af('0x17')](_0x3a68a3)['send'](_0x1961dc);};}exports[_0x23af('0x26')]=function(_0x575897,_0x5236fd){var _0x57e495={},_0xcc1d4f={},_0x1b54e4={'count':0x0,'rows':[]};var _0x5e435c=_['map'](db[_0x23af('0x27')][_0x23af('0x28')],function(_0x2b037b){return{'name':_0x2b037b[_0x23af('0x29')],'type':_0x2b037b['type'][_0x23af('0x2a')]};});_0xcc1d4f[_0x23af('0x2b')]=_['map'](_0x5e435c,_0x23af('0x2c'));_0xcc1d4f[_0x23af('0x2d')]=_[_0x23af('0x2e')](_0x575897[_0x23af('0x2d')]);_0xcc1d4f[_0x23af('0x2f')]=_['intersection'](_0xcc1d4f['model'],_0xcc1d4f[_0x23af('0x2d')]);_0x57e495[_0x23af('0x30')]=_[_0x23af('0x31')](_0xcc1d4f[_0x23af('0x2b')],qs[_0x23af('0x32')](_0x575897[_0x23af('0x2d')][_0x23af('0x32')]));_0x57e495[_0x23af('0x30')]=_0x57e495[_0x23af('0x30')][_0x23af('0x33')]?_0x57e495[_0x23af('0x30')]:_0xcc1d4f[_0x23af('0x2b')];if(!_0x575897['query'][_0x23af('0x34')](_0x23af('0x35'))){_0x57e495[_0x23af('0x1c')]=qs[_0x23af('0x1c')](_0x575897[_0x23af('0x2d')][_0x23af('0x1c')]);_0x57e495[_0x23af('0x1b')]=qs[_0x23af('0x1b')](_0x575897[_0x23af('0x2d')]['offset']);}_0x57e495['order']=qs[_0x23af('0x36')](_0x575897['query'][_0x23af('0x36')]);_0x57e495[_0x23af('0x37')]=qs['filters'](_['pick'](_0x575897[_0x23af('0x2d')],_0xcc1d4f['filters']),_0x5e435c);if(_0x575897[_0x23af('0x2d')][_0x23af('0x38')]){_0x57e495['where']=_[_0x23af('0x39')](_0x57e495['where'],{'$or':_[_0x23af('0x3a')](_0x5e435c,function(_0x4d71fb){if(_0x4d71fb[_0x23af('0x3b')]!==_0x23af('0x3c')){var _0x488fce={};_0x488fce[_0x4d71fb['name']]={'$like':'%'+_0x575897['query'][_0x23af('0x38')]+'%'};return _0x488fce;}})});}_0x57e495=_[_0x23af('0x39')]({},_0x57e495,_0x575897[_0x23af('0x3d')]);var _0x208355={'where':_0x57e495['where']};return db['MailServerOut'][_0x23af('0x1a')](_0x208355)[_0x23af('0x22')](function(_0x5c14ef){_0x1b54e4[_0x23af('0x1a')]=_0x5c14ef;if(_0x575897[_0x23af('0x2d')][_0x23af('0x3e')]){_0x57e495[_0x23af('0x3f')]=[{'all':!![]}];}return db[_0x23af('0x27')][_0x23af('0x40')](_0x57e495);})[_0x23af('0x22')](function(_0xd2fa22){_0x1b54e4[_0x23af('0x41')]=_0xd2fa22;return _0x1b54e4;})[_0x23af('0x22')](respondWithFilteredResult(_0x5236fd,_0x57e495))[_0x23af('0x42')](handleError(_0x5236fd,null));};exports[_0x23af('0x43')]=function(_0x578eac,_0x3a13b6){var _0x305169={'raw':!![],'where':{'id':_0x578eac[_0x23af('0x44')]['id']}},_0x543fbb={};_0x543fbb[_0x23af('0x2b')]=_[_0x23af('0x2e')](db[_0x23af('0x27')]['rawAttributes']);_0x543fbb[_0x23af('0x2d')]=_[_0x23af('0x2e')](_0x578eac[_0x23af('0x2d')]);_0x543fbb[_0x23af('0x2f')]=_[_0x23af('0x31')](_0x543fbb[_0x23af('0x2b')],_0x543fbb['query']);_0x305169[_0x23af('0x30')]=_['intersection'](_0x543fbb[_0x23af('0x2b')],qs[_0x23af('0x32')](_0x578eac[_0x23af('0x2d')][_0x23af('0x32')]));_0x305169[_0x23af('0x30')]=_0x305169['attributes'][_0x23af('0x33')]?_0x305169[_0x23af('0x30')]:_0x543fbb[_0x23af('0x2b')];if(_0x578eac['query'][_0x23af('0x3e')]){_0x305169[_0x23af('0x3f')]=[{'all':!![]}];}_0x305169=_[_0x23af('0x39')]({},_0x305169,_0x578eac[_0x23af('0x3d')]);return db[_0x23af('0x27')][_0x23af('0x45')](_0x305169)[_0x23af('0x22')](handleEntityNotFound(_0x3a13b6,null))['then'](respondWithResult(_0x3a13b6,null))[_0x23af('0x42')](handleError(_0x3a13b6,null));};exports['create']=function(_0x1de040,_0x477bbd){return db['MailServerOut'][_0x23af('0x46')](_0x1de040['body'],{})[_0x23af('0x22')](respondWithResult(_0x477bbd,0xc9))[_0x23af('0x42')](handleError(_0x477bbd,null));};exports[_0x23af('0x21')]=function(_0x1d6b7f,_0x1c2292){if(_0x1d6b7f[_0x23af('0x47')]['id']){delete _0x1d6b7f[_0x23af('0x47')]['id'];}return db[_0x23af('0x27')][_0x23af('0x45')]({'where':{'id':_0x1d6b7f[_0x23af('0x44')]['id']}})[_0x23af('0x22')](handleEntityNotFound(_0x1c2292,null))[_0x23af('0x22')](saveUpdates(_0x1d6b7f[_0x23af('0x47')],null))[_0x23af('0x22')](respondWithResult(_0x1c2292,null))[_0x23af('0x42')](handleError(_0x1c2292,null));};exports[_0x23af('0x23')]=function(_0x26304c,_0x26e8d5){return db[_0x23af('0x27')]['find']({'where':{'id':_0x26304c[_0x23af('0x44')]['id']}})[_0x23af('0x22')](handleEntityNotFound(_0x26e8d5,null))['then'](removeEntity(_0x26e8d5,null))[_0x23af('0x42')](handleError(_0x26e8d5,null));}; \ No newline at end of file +var _0xb3c8=['fast-json-patch','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','reject','save','update','then','sendStatus','error','name','send','index','map','MailServerOut','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','includeAll','findAll','catch','params','include','merge','options','find','create','body','eml-format','rimraf','zip-dir'];(function(_0x3068a3,_0x23f5ac){var _0x48a707=function(_0x59ad58){while(--_0x59ad58){_0x3068a3['push'](_0x3068a3['shift']());}};_0x48a707(++_0x23f5ac);}(_0xb3c8,0x19b));var _0x8b3c=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xb3c8[_0x243b2f];return _0xcb3c2d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8b3c('0x0'));var rimraf=require(_0x8b3c('0x1'));var zipdir=require(_0x8b3c('0x2'));var jsonpatch=require(_0x8b3c('0x3'));var rp=require('request-promise');var moment=require(_0x8b3c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8b3c('0x5'));var util=require(_0x8b3c('0x6'));var path=require('path');var sox=require(_0x8b3c('0x7'));var csv=require(_0x8b3c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b3c('0x9'));var _=require(_0x8b3c('0xa'));var squel=require(_0x8b3c('0xb'));var crypto=require('crypto');var jsforce=require(_0x8b3c('0xc'));var deskjs=require(_0x8b3c('0xd'));var toCsv=require(_0x8b3c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8b3c('0xe'));var authService=require(_0x8b3c('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8b3c('0x10'));var logger=require('../../config/logger')(_0x8b3c('0x11'));var utils=require(_0x8b3c('0x12'));var config=require(_0x8b3c('0x13'));var licenseUtil=require(_0x8b3c('0x14'));var db=require(_0x8b3c('0x15'))['db'];function respondWithStatusCode(_0x5d1c62,_0x16cff6){_0x16cff6=_0x16cff6||0xcc;return function(_0x36122b){if(_0x36122b){return _0x5d1c62['sendStatus'](_0x16cff6);}return _0x5d1c62[_0x8b3c('0x16')](_0x16cff6)[_0x8b3c('0x17')]();};}function respondWithResult(_0x259198,_0x2ebbca){_0x2ebbca=_0x2ebbca||0xc8;return function(_0x134298){if(_0x134298){return _0x259198[_0x8b3c('0x16')](_0x2ebbca)[_0x8b3c('0x18')](_0x134298);}};}function respondWithFilteredResult(_0x1c070d,_0x44a76a){return function(_0xe89da7){if(_0xe89da7){var _0x4273f6=_0xe89da7[_0x8b3c('0x19')],_0x1ce4e3=_0x44a76a[_0x8b3c('0x1a')],_0x5506b0=_0x44a76a[_0x8b3c('0x1a')]+_0x44a76a['limit'],_0x503066;if(_0x5506b0>=_0x4273f6){_0x5506b0=_0x4273f6;_0x503066=0xc8;}else{_0x503066=0xce;}_0x1c070d['status'](_0x503066);return _0x1c070d[_0x8b3c('0x1b')]('Content-Range',_0x1ce4e3+'-'+_0x5506b0+'/'+_0x4273f6)[_0x8b3c('0x18')](_0xe89da7);}return null;};}function patchUpdates(_0x59e668){return function(_0x49636){try{jsonpatch['apply'](_0x49636,_0x59e668,!![]);}catch(_0x33cce3){return BPromise[_0x8b3c('0x1c')](_0x33cce3);}return _0x49636[_0x8b3c('0x1d')]();};}function saveUpdates(_0x43810d,_0x25046f){return function(_0x1b46aa){if(_0x1b46aa){return _0x1b46aa[_0x8b3c('0x1e')](_0x43810d)[_0x8b3c('0x1f')](function(_0x1d96e9){return _0x1d96e9;});}return null;};}function removeEntity(_0x5bb365,_0xaa5083){return function(_0x1cc50c){if(_0x1cc50c){return _0x1cc50c['destroy']()[_0x8b3c('0x1f')](function(){_0x5bb365[_0x8b3c('0x16')](0xcc)[_0x8b3c('0x17')]();});}};}function handleEntityNotFound(_0x16940b,_0x48e2fe){return function(_0x28d015){if(!_0x28d015){_0x16940b[_0x8b3c('0x20')](0x194);}return _0x28d015;};}function handleError(_0x2bba10,_0x4a53ad){_0x4a53ad=_0x4a53ad||0x1f4;return function(_0x40daf4){logger[_0x8b3c('0x21')](_0x40daf4['stack']);if(_0x40daf4['name']){delete _0x40daf4[_0x8b3c('0x22')];}_0x2bba10[_0x8b3c('0x16')](_0x4a53ad)[_0x8b3c('0x23')](_0x40daf4);};}exports[_0x8b3c('0x24')]=function(_0xdb0236,_0x5c9046){var _0x5c10a6={},_0x1fac6e={},_0x12b9c6={'count':0x0,'rows':[]};var _0x20d3c2=_[_0x8b3c('0x25')](db[_0x8b3c('0x26')][_0x8b3c('0x27')],function(_0x456cff){return{'name':_0x456cff[_0x8b3c('0x28')],'type':_0x456cff['type'][_0x8b3c('0x29')]};});_0x1fac6e['model']=_[_0x8b3c('0x25')](_0x20d3c2,'name');_0x1fac6e[_0x8b3c('0x2a')]=_[_0x8b3c('0x2b')](_0xdb0236[_0x8b3c('0x2a')]);_0x1fac6e[_0x8b3c('0x2c')]=_[_0x8b3c('0x2d')](_0x1fac6e[_0x8b3c('0x2e')],_0x1fac6e[_0x8b3c('0x2a')]);_0x5c10a6[_0x8b3c('0x2f')]=_['intersection'](_0x1fac6e[_0x8b3c('0x2e')],qs[_0x8b3c('0x30')](_0xdb0236[_0x8b3c('0x2a')][_0x8b3c('0x30')]));_0x5c10a6['attributes']=_0x5c10a6[_0x8b3c('0x2f')][_0x8b3c('0x31')]?_0x5c10a6[_0x8b3c('0x2f')]:_0x1fac6e[_0x8b3c('0x2e')];if(!_0xdb0236[_0x8b3c('0x2a')][_0x8b3c('0x32')](_0x8b3c('0x33'))){_0x5c10a6['limit']=qs['limit'](_0xdb0236[_0x8b3c('0x2a')][_0x8b3c('0x34')]);_0x5c10a6['offset']=qs[_0x8b3c('0x1a')](_0xdb0236[_0x8b3c('0x2a')][_0x8b3c('0x1a')]);}_0x5c10a6[_0x8b3c('0x35')]=qs['sort'](_0xdb0236[_0x8b3c('0x2a')][_0x8b3c('0x36')]);_0x5c10a6[_0x8b3c('0x37')]=qs[_0x8b3c('0x2c')](_[_0x8b3c('0x38')](_0xdb0236[_0x8b3c('0x2a')],_0x1fac6e['filters']),_0x20d3c2);if(_0xdb0236['query'][_0x8b3c('0x39')]){_0x5c10a6[_0x8b3c('0x37')]=_['merge'](_0x5c10a6['where'],{'$or':_[_0x8b3c('0x25')](_0x20d3c2,function(_0x3e4670){if(_0x3e4670[_0x8b3c('0x3a')]!=='VIRTUAL'){var _0x15c53c={};_0x15c53c[_0x3e4670[_0x8b3c('0x22')]]={'$like':'%'+_0xdb0236[_0x8b3c('0x2a')][_0x8b3c('0x39')]+'%'};return _0x15c53c;}})});}_0x5c10a6=_['merge']({},_0x5c10a6,_0xdb0236['options']);var _0x11a81c={'where':_0x5c10a6[_0x8b3c('0x37')]};return db['MailServerOut'][_0x8b3c('0x19')](_0x11a81c)[_0x8b3c('0x1f')](function(_0x411d23){_0x12b9c6[_0x8b3c('0x19')]=_0x411d23;if(_0xdb0236[_0x8b3c('0x2a')][_0x8b3c('0x3b')]){_0x5c10a6['include']=[{'all':!![]}];}return db['MailServerOut'][_0x8b3c('0x3c')](_0x5c10a6);})[_0x8b3c('0x1f')](function(_0x53ac83){_0x12b9c6['rows']=_0x53ac83;return _0x12b9c6;})[_0x8b3c('0x1f')](respondWithFilteredResult(_0x5c9046,_0x5c10a6))[_0x8b3c('0x3d')](handleError(_0x5c9046,null));};exports['show']=function(_0x36ad43,_0x169409){var _0x3688f2={'raw':!![],'where':{'id':_0x36ad43[_0x8b3c('0x3e')]['id']}},_0x163e85={};_0x163e85[_0x8b3c('0x2e')]=_[_0x8b3c('0x2b')](db[_0x8b3c('0x26')][_0x8b3c('0x27')]);_0x163e85[_0x8b3c('0x2a')]=_[_0x8b3c('0x2b')](_0x36ad43[_0x8b3c('0x2a')]);_0x163e85['filters']=_[_0x8b3c('0x2d')](_0x163e85[_0x8b3c('0x2e')],_0x163e85[_0x8b3c('0x2a')]);_0x3688f2[_0x8b3c('0x2f')]=_['intersection'](_0x163e85[_0x8b3c('0x2e')],qs[_0x8b3c('0x30')](_0x36ad43[_0x8b3c('0x2a')][_0x8b3c('0x30')]));_0x3688f2['attributes']=_0x3688f2['attributes'][_0x8b3c('0x31')]?_0x3688f2[_0x8b3c('0x2f')]:_0x163e85['model'];if(_0x36ad43[_0x8b3c('0x2a')][_0x8b3c('0x3b')]){_0x3688f2[_0x8b3c('0x3f')]=[{'all':!![]}];}_0x3688f2=_[_0x8b3c('0x40')]({},_0x3688f2,_0x36ad43[_0x8b3c('0x41')]);return db[_0x8b3c('0x26')][_0x8b3c('0x42')](_0x3688f2)[_0x8b3c('0x1f')](handleEntityNotFound(_0x169409,null))[_0x8b3c('0x1f')](respondWithResult(_0x169409,null))['catch'](handleError(_0x169409,null));};exports[_0x8b3c('0x43')]=function(_0x31fd20,_0x486608){return db[_0x8b3c('0x26')][_0x8b3c('0x43')](_0x31fd20[_0x8b3c('0x44')],{})[_0x8b3c('0x1f')](respondWithResult(_0x486608,0xc9))[_0x8b3c('0x3d')](handleError(_0x486608,null));};exports[_0x8b3c('0x1e')]=function(_0x33efd5,_0x9a3df9){if(_0x33efd5[_0x8b3c('0x44')]['id']){delete _0x33efd5[_0x8b3c('0x44')]['id'];}return db[_0x8b3c('0x26')][_0x8b3c('0x42')]({'where':{'id':_0x33efd5[_0x8b3c('0x3e')]['id']}})[_0x8b3c('0x1f')](handleEntityNotFound(_0x9a3df9,null))[_0x8b3c('0x1f')](saveUpdates(_0x33efd5[_0x8b3c('0x44')],null))['then'](respondWithResult(_0x9a3df9,null))[_0x8b3c('0x3d')](handleError(_0x9a3df9,null));};exports['destroy']=function(_0x1be845,_0x456bac){return db[_0x8b3c('0x26')][_0x8b3c('0x42')]({'where':{'id':_0x1be845['params']['id']}})['then'](handleEntityNotFound(_0x456bac,null))[_0x8b3c('0x1f')](removeEntity(_0x456bac,null))[_0x8b3c('0x3d')](handleError(_0x456bac,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 7d6a9ca..21137b1 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 _0xdbf5=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out'];(function(_0x41fdcc,_0x586927){var _0x3de759=function(_0xd5d493){while(--_0xd5d493){_0x41fdcc['push'](_0x41fdcc['shift']());}};_0x3de759(++_0x586927);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x5e4c9b,_0x5801a8){_0x5e4c9b=_0x5e4c9b-0x0;var _0x2057ca=_0xdbf5[_0x5e4c9b];return _0x2057ca;};'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'));module[_0x5dbf('0x8')]=function(_0x3f8628,_0x3f8222){return _0x3f8628[_0x5dbf('0x9')](_0x5dbf('0xa'),attributes,{'tableName':_0x5dbf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4819=['mail_servers_out','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','MailServerOut'];(function(_0x5f401a,_0x37e7a8){var _0x1bed74=function(_0x1a7e9){while(--_0x1a7e9){_0x5f401a['push'](_0x5f401a['shift']());}};_0x1bed74(++_0x37e7a8);}(_0x4819,0xcd));var _0x9481=function(_0x52b844,_0x434e67){_0x52b844=_0x52b844-0x0;var _0x14432f=_0x4819[_0x52b844];return _0x14432f;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));module['exports']=function(_0x4d9e3a,_0x5def07){return _0x4d9e3a['define'](_0x9481('0xa'),attributes,{'tableName':_0x9481('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 1e64523..c7a313e 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 _0xc108=['request','then','info','debug','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailServerOut,\x20%s,\x20%s','message','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x23f6d5,_0x5da8c0){var _0x18a2a9=function(_0x37d382){while(--_0x37d382){_0x23f6d5['push'](_0x23f6d5['shift']());}};_0x18a2a9(++_0x5da8c0);}(_0xc108,0x10f));var _0x8c10=function(_0x419f64,_0x254a65){_0x419f64=_0x419f64-0x0;var _0x1efb78=_0xc108[_0x419f64];return _0x1efb78;};'use strict';var _=require(_0x8c10('0x0'));var util=require(_0x8c10('0x1'));var moment=require('moment');var BPromise=require(_0x8c10('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c10('0x3'));var db=require(_0x8c10('0x4'))['db'];var utils=require(_0x8c10('0x5'));var logger=require(_0x8c10('0x6'))(_0x8c10('0x7'));var config=require(_0x8c10('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1ea2d2,_0xb91af1,_0x5435e1){return new BPromise(function(_0x4423ed,_0x5a440e){return client[_0x8c10('0x9')](_0x1ea2d2,_0x5435e1)[_0x8c10('0xa')](function(_0x8fd1b2){logger[_0x8c10('0xb')]('MailServerOut,\x20%s,\x20%s',_0xb91af1,'request\x20sent');logger[_0x8c10('0xc')](_0x8c10('0xd'),_0xb91af1,_0x8c10('0xe'),JSON[_0x8c10('0xf')](_0x8fd1b2));if(_0x8fd1b2[_0x8c10('0x10')]){if(_0x8fd1b2[_0x8c10('0x10')][_0x8c10('0x11')]===0x1f4){logger[_0x8c10('0x10')](_0x8c10('0x12'),_0xb91af1,_0x8fd1b2['error'][_0x8c10('0x13')]);return _0x5a440e(_0x8fd1b2[_0x8c10('0x10')][_0x8c10('0x13')]);}logger['error'](_0x8c10('0x12'),_0xb91af1,_0x8fd1b2[_0x8c10('0x10')][_0x8c10('0x13')]);return _0x4423ed(_0x8fd1b2[_0x8c10('0x10')][_0x8c10('0x13')]);}else{logger['info']('MailServerOut,\x20%s,\x20%s',_0xb91af1,'request\x20sent');_0x4423ed(_0x8fd1b2['result']['message']);}})['catch'](function(_0x2e37ce){logger[_0x8c10('0x10')](_0x8c10('0x12'),_0xb91af1,_0x2e37ce);_0x5a440e(_0x2e37ce);});});} \ No newline at end of file +var _0xadb0=['message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x390f9b,_0x5dc3f5){var _0x4785f9=function(_0x1377af){while(--_0x1377af){_0x390f9b['push'](_0x390f9b['shift']());}};_0x4785f9(++_0x5dc3f5);}(_0xadb0,0x144));var _0x0adb=function(_0x31be74,_0x3992be){_0x31be74=_0x31be74-0x0;var _0x29275c=_0xadb0[_0x31be74];return _0x29275c;};'use strict';var _=require(_0x0adb('0x0'));var util=require(_0x0adb('0x1'));var moment=require('moment');var BPromise=require(_0x0adb('0x2'));var rs=require(_0x0adb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0adb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0adb('0x5'))('rpc');var config=require(_0x0adb('0x6'));var jayson=require(_0x0adb('0x7'));var client=jayson[_0x0adb('0x8')][_0x0adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb964e4,_0xd30840,_0x3d883e){return new BPromise(function(_0x191558,_0x57d5a3){return client['request'](_0xb964e4,_0x3d883e)[_0x0adb('0xa')](function(_0x1506cc){logger['info'](_0x0adb('0xb'),_0xd30840,_0x0adb('0xc'));logger[_0x0adb('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0xd30840,_0x0adb('0xc'),JSON[_0x0adb('0xe')](_0x1506cc));if(_0x1506cc['error']){if(_0x1506cc[_0x0adb('0xf')]['code']===0x1f4){logger[_0x0adb('0xf')]('MailServerOut,\x20%s,\x20%s',_0xd30840,_0x1506cc[_0x0adb('0xf')]['message']);return _0x57d5a3(_0x1506cc[_0x0adb('0xf')][_0x0adb('0x10')]);}logger[_0x0adb('0xf')](_0x0adb('0xb'),_0xd30840,_0x1506cc['error']['message']);return _0x191558(_0x1506cc[_0x0adb('0xf')][_0x0adb('0x10')]);}else{logger[_0x0adb('0x11')]('MailServerOut,\x20%s,\x20%s',_0xd30840,_0x0adb('0xc'));_0x191558(_0x1506cc[_0x0adb('0x12')][_0x0adb('0x10')]);}})[_0x0adb('0x13')](function(_0x598299){logger[_0x0adb('0xf')]('MailServerOut,\x20%s,\x20%s',_0xd30840,_0x598299);_0x57d5a3(_0x598299);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index ee33a99..e129eeb 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 _0xcf66=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','create','update','delete','exports','multer','util','path','express','Router','../../components/interaction/service'];(function(_0x1cfe2e,_0x1ebbcd){var _0x39233f=function(_0x48831a){while(--_0x48831a){_0x1cfe2e['push'](_0x1cfe2e['shift']());}};_0x39233f(++_0x1ebbcd);}(_0xcf66,0x71));var _0x6cf6=function(_0x20bcda,_0x2d18d2){_0x20bcda=_0x20bcda-0x0;var _0x4823b7=_0xcf66[_0x20bcda];return _0x4823b7;};'use strict';var multer=require(_0x6cf6('0x0'));var util=require(_0x6cf6('0x1'));var path=require(_0x6cf6('0x2'));var timeout=require('connect-timeout');var express=require(_0x6cf6('0x3'));var router=express[_0x6cf6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6cf6('0x5'));var config=require(_0x6cf6('0x6'));var controller=require('./mailSubstatus.controller');router[_0x6cf6('0x7')]('/',auth[_0x6cf6('0x8')](),controller[_0x6cf6('0x9')]);router['get'](_0x6cf6('0xa'),auth[_0x6cf6('0x8')](),controller[_0x6cf6('0xb')]);router[_0x6cf6('0x7')](_0x6cf6('0xc'),auth[_0x6cf6('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x6cf6('0xd')]);router['put'](_0x6cf6('0xc'),auth[_0x6cf6('0x8')](),controller[_0x6cf6('0xe')]);router[_0x6cf6('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6cf6('0x10')]=router; \ No newline at end of file +var _0x3014=['isAuthenticated','index','/describe','describe','show','create','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get'];(function(_0x2921b6,_0xf37d04){var _0x776fe1=function(_0x315487){while(--_0x315487){_0x2921b6['push'](_0x2921b6['shift']());}};_0x776fe1(++_0xf37d04);}(_0x3014,0x1d7));var _0x4301=function(_0xc118c3,_0xc8a09){_0xc118c3=_0xc118c3-0x0;var _0x4e6301=_0x3014[_0xc118c3];return _0x4e6301;};'use strict';var multer=require(_0x4301('0x0'));var util=require(_0x4301('0x1'));var path=require('path');var timeout=require(_0x4301('0x2'));var express=require(_0x4301('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4301('0x4'));var interaction=require(_0x4301('0x5'));var config=require(_0x4301('0x6'));var controller=require(_0x4301('0x7'));router[_0x4301('0x8')]('/',auth[_0x4301('0x9')](),controller[_0x4301('0xa')]);router[_0x4301('0x8')](_0x4301('0xb'),auth[_0x4301('0x9')](),controller[_0x4301('0xc')]);router['get']('/:id',auth[_0x4301('0x9')](),controller[_0x4301('0xd')]);router['post']('/',auth[_0x4301('0x9')](),controller[_0x4301('0xe')]);router[_0x4301('0xf')](_0x4301('0x10'),auth['isAuthenticated'](),controller[_0x4301('0x11')]);router['delete'](_0x4301('0x10'),auth[_0x4301('0x9')](),controller[_0x4301('0x12')]);module[_0x4301('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 85010aa..3e27dea 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 _0xdc86=['exports','name'];(function(_0x4a9f59,_0x1db784){var _0x562254=function(_0x354a12){while(--_0x354a12){_0x4a9f59['push'](_0x4a9f59['shift']());}};_0x562254(++_0x1db784);}(_0xdc86,0x118));var _0x6dc8=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xdc86[_0x176329];return _0x31997c;};'use strict';var Sequelize=require('sequelize');module[_0x6dc8('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x6dc8('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x46c1=['name','exports','STRING'];(function(_0x411f70,_0x4e9358){var _0x321eec=function(_0xfb48b6){while(--_0xfb48b6){_0x411f70['push'](_0x411f70['shift']());}};_0x321eec(++_0x4e9358);}(_0x46c1,0x7c));var _0x146c=function(_0x5b10a1,_0x3190da){_0x5b10a1=_0x5b10a1-0x0;var _0x6ccca0=_0x46c1[_0x5b10a1];return _0x6ccca0;};'use strict';var Sequelize=require('sequelize');module[_0x146c('0x0')]={'name':{'type':Sequelize[_0x146c('0x1')],'unique':_0x146c('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x146c('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 5b18e3c..2bf8eb2 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 _0xdb8d=['intersection','fields','length','hasOwnProperty','nolimit','order','pick','merge','map','filter','where','findAll','catch','show','params','includeAll','find','create','body','update','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','desk.js','to-csv','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack','name','MailSubstatus','rawAttributes','type','key','query','filters','model','attributes'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0xdb8d,0x1a8));var _0xddb8=function(_0x31b7d7,_0x3de9ed){_0x31b7d7=_0x31b7d7-0x0;var _0x3a376e=_0xdb8d[_0x31b7d7];return _0x3a376e;};'use strict';var pdf=require(_0xddb8('0x0'));var emlformat=require(_0xddb8('0x1'));var rimraf=require(_0xddb8('0x2'));var zipdir=require(_0xddb8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xddb8('0x4'));var moment=require(_0xddb8('0x5'));var BPromise=require(_0xddb8('0x6'));var Mustache=require(_0xddb8('0x7'));var util=require(_0xddb8('0x8'));var path=require('path');var sox=require(_0xddb8('0x9'));var csv=require('to-csv');var ejs=require(_0xddb8('0xa'));var fs=require('fs');var fs_extra=require(_0xddb8('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xddb8('0xc'));var toCsv=require(_0xddb8('0xd'));var querystring=require('querystring');var Papa=require(_0xddb8('0xe'));var Redis=require(_0xddb8('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(_0xddb8('0x10'))(_0xddb8('0x11'));var utils=require(_0xddb8('0x12'));var config=require(_0xddb8('0x13'));var licenseUtil=require(_0xddb8('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36da69,_0x376123){_0x376123=_0x376123||0xcc;return function(_0x284c56){if(_0x284c56){return _0x36da69[_0xddb8('0x15')](_0x376123);}return _0x36da69[_0xddb8('0x16')](_0x376123)[_0xddb8('0x17')]();};}function respondWithResult(_0x45060e,_0x1b5257){_0x1b5257=_0x1b5257||0xc8;return function(_0x4c7a04){if(_0x4c7a04){return _0x45060e[_0xddb8('0x16')](_0x1b5257)[_0xddb8('0x18')](_0x4c7a04);}};}function respondWithFilteredResult(_0xf9aac9,_0x4cb35e){return function(_0x41688c){if(_0x41688c){var _0x464efa=_0x41688c[_0xddb8('0x19')],_0x4a08ce=_0x4cb35e[_0xddb8('0x1a')],_0x98f813=_0x4cb35e['offset']+_0x4cb35e[_0xddb8('0x1b')],_0x1003ea;if(_0x98f813>=_0x464efa){_0x98f813=_0x464efa;_0x1003ea=0xc8;}else{_0x1003ea=0xce;}_0xf9aac9[_0xddb8('0x16')](_0x1003ea);return _0xf9aac9[_0xddb8('0x1c')](_0xddb8('0x1d'),_0x4a08ce+'-'+_0x98f813+'/'+_0x464efa)['json'](_0x41688c);}return null;};}function patchUpdates(_0x2ac226){return function(_0x154d3d){try{jsonpatch[_0xddb8('0x1e')](_0x154d3d,_0x2ac226,!![]);}catch(_0x429b05){return BPromise[_0xddb8('0x1f')](_0x429b05);}return _0x154d3d[_0xddb8('0x20')]();};}function saveUpdates(_0x27c65b,_0x3276da){return function(_0x404be9){if(_0x404be9){return _0x404be9['update'](_0x27c65b)[_0xddb8('0x21')](function(_0x24e98){return _0x24e98;});}return null;};}function removeEntity(_0x478953,_0x36c12d){return function(_0x22df29){if(_0x22df29){return _0x22df29['destroy']()[_0xddb8('0x21')](function(){_0x478953[_0xddb8('0x16')](0xcc)[_0xddb8('0x17')]();});}};}function handleEntityNotFound(_0xfdc9f7,_0x51fb1c){return function(_0x48acb2){if(!_0x48acb2){_0xfdc9f7[_0xddb8('0x15')](0x194);}return _0x48acb2;};}function handleError(_0x54aad0,_0x335cdc){_0x335cdc=_0x335cdc||0x1f4;return function(_0x5b2001){logger[_0xddb8('0x22')](_0x5b2001[_0xddb8('0x23')]);if(_0x5b2001[_0xddb8('0x24')]){delete _0x5b2001[_0xddb8('0x24')];}_0x54aad0['status'](_0x335cdc)['send'](_0x5b2001);};}exports['index']=function(_0x3c69c6,_0xdcbab2){var _0x48a3fb={},_0x53f3e4={},_0x30876c={'count':0x0,'rows':[]};var _0x35f8d7=_['map'](db[_0xddb8('0x25')][_0xddb8('0x26')],function(_0xd99550){return{'name':_0xd99550['fieldName'],'type':_0xd99550[_0xddb8('0x27')][_0xddb8('0x28')]};});_0x53f3e4['model']=_['map'](_0x35f8d7,_0xddb8('0x24'));_0x53f3e4['query']=_['keys'](_0x3c69c6[_0xddb8('0x29')]);_0x53f3e4[_0xddb8('0x2a')]=_['intersection'](_0x53f3e4[_0xddb8('0x2b')],_0x53f3e4[_0xddb8('0x29')]);_0x48a3fb[_0xddb8('0x2c')]=_[_0xddb8('0x2d')](_0x53f3e4[_0xddb8('0x2b')],qs[_0xddb8('0x2e')](_0x3c69c6['query'][_0xddb8('0x2e')]));_0x48a3fb['attributes']=_0x48a3fb['attributes'][_0xddb8('0x2f')]?_0x48a3fb['attributes']:_0x53f3e4[_0xddb8('0x2b')];if(!_0x3c69c6[_0xddb8('0x29')][_0xddb8('0x30')](_0xddb8('0x31'))){_0x48a3fb[_0xddb8('0x1b')]=qs[_0xddb8('0x1b')](_0x3c69c6[_0xddb8('0x29')]['limit']);_0x48a3fb[_0xddb8('0x1a')]=qs[_0xddb8('0x1a')](_0x3c69c6[_0xddb8('0x29')][_0xddb8('0x1a')]);}_0x48a3fb[_0xddb8('0x32')]=qs['sort'](_0x3c69c6[_0xddb8('0x29')]['sort']);_0x48a3fb['where']=qs['filters'](_[_0xddb8('0x33')](_0x3c69c6[_0xddb8('0x29')],_0x53f3e4['filters']),_0x35f8d7);if(_0x3c69c6[_0xddb8('0x29')]['filter']){_0x48a3fb['where']=_[_0xddb8('0x34')](_0x48a3fb['where'],{'$or':_[_0xddb8('0x35')](_0x35f8d7,function(_0x3f5e2d){if(_0x3f5e2d['type']!=='VIRTUAL'){var _0x23b405={};_0x23b405[_0x3f5e2d[_0xddb8('0x24')]]={'$like':'%'+_0x3c69c6[_0xddb8('0x29')][_0xddb8('0x36')]+'%'};return _0x23b405;}})});}_0x48a3fb=_[_0xddb8('0x34')]({},_0x48a3fb,_0x3c69c6['options']);var _0x84fd75={'where':_0x48a3fb[_0xddb8('0x37')]};return db[_0xddb8('0x25')][_0xddb8('0x19')](_0x84fd75)[_0xddb8('0x21')](function(_0x235b11){_0x30876c[_0xddb8('0x19')]=_0x235b11;if(_0x3c69c6[_0xddb8('0x29')]['includeAll']){_0x48a3fb['include']=[{'all':!![]}];}return db['MailSubstatus'][_0xddb8('0x38')](_0x48a3fb);})[_0xddb8('0x21')](function(_0x3a5d52){_0x30876c['rows']=_0x3a5d52;return _0x30876c;})[_0xddb8('0x21')](respondWithFilteredResult(_0xdcbab2,_0x48a3fb))[_0xddb8('0x39')](handleError(_0xdcbab2,null));};exports[_0xddb8('0x3a')]=function(_0x3dc715,_0x403e2a){var _0x4de25a={'raw':!![],'where':{'id':_0x3dc715[_0xddb8('0x3b')]['id']}},_0xfb8fed={};_0xfb8fed[_0xddb8('0x2b')]=_['keys'](db['MailSubstatus'][_0xddb8('0x26')]);_0xfb8fed[_0xddb8('0x29')]=_['keys'](_0x3dc715[_0xddb8('0x29')]);_0xfb8fed['filters']=_[_0xddb8('0x2d')](_0xfb8fed[_0xddb8('0x2b')],_0xfb8fed['query']);_0x4de25a[_0xddb8('0x2c')]=_[_0xddb8('0x2d')](_0xfb8fed[_0xddb8('0x2b')],qs[_0xddb8('0x2e')](_0x3dc715[_0xddb8('0x29')][_0xddb8('0x2e')]));_0x4de25a[_0xddb8('0x2c')]=_0x4de25a[_0xddb8('0x2c')][_0xddb8('0x2f')]?_0x4de25a[_0xddb8('0x2c')]:_0xfb8fed[_0xddb8('0x2b')];if(_0x3dc715[_0xddb8('0x29')][_0xddb8('0x3c')]){_0x4de25a['include']=[{'all':!![]}];}_0x4de25a=_[_0xddb8('0x34')]({},_0x4de25a,_0x3dc715['options']);return db[_0xddb8('0x25')][_0xddb8('0x3d')](_0x4de25a)[_0xddb8('0x21')](handleEntityNotFound(_0x403e2a,null))[_0xddb8('0x21')](respondWithResult(_0x403e2a,null))['catch'](handleError(_0x403e2a,null));};exports['create']=function(_0x5864cf,_0x4861cb){return db[_0xddb8('0x25')][_0xddb8('0x3e')](_0x5864cf[_0xddb8('0x3f')],{})[_0xddb8('0x21')](respondWithResult(_0x4861cb,0xc9))[_0xddb8('0x39')](handleError(_0x4861cb,null));};exports[_0xddb8('0x40')]=function(_0x13b942,_0x7ded12){if(_0x13b942[_0xddb8('0x3f')]['id']){delete _0x13b942['body']['id'];}return db[_0xddb8('0x25')][_0xddb8('0x3d')]({'where':{'id':_0x13b942[_0xddb8('0x3b')]['id']}})['then'](handleEntityNotFound(_0x7ded12,null))[_0xddb8('0x21')](saveUpdates(_0x13b942[_0xddb8('0x3f')],null))[_0xddb8('0x21')](respondWithResult(_0x7ded12,null))[_0xddb8('0x39')](handleError(_0x7ded12,null));};exports[_0xddb8('0x41')]=function(_0x228058,_0x3446b5){return db[_0xddb8('0x25')][_0xddb8('0x3d')]({'where':{'id':_0x228058[_0xddb8('0x3b')]['id']}})['then'](handleEntityNotFound(_0x3446b5,null))[_0xddb8('0x21')](removeEntity(_0x3446b5,null))[_0xddb8('0x39')](handleError(_0x3446b5,null));};exports[_0xddb8('0x42')]=function(_0x497675,_0x2e6640){return db[_0xddb8('0x25')][_0xddb8('0x42')]()[_0xddb8('0x21')](respondWithResult(_0x2e6640,null))[_0xddb8('0x39')](handleError(_0x2e6640,null));}; \ No newline at end of file +var _0xbb90=['squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','MailSubstatus','fieldName','key','model','query','filters','attributes','intersection','length','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','keys','fields','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb90,0x1b6));var _0x0bb9=function(_0x5c1cca,_0x4b80db){_0x5c1cca=_0x5c1cca-0x0;var _0x180cec=_0xbb90[_0x5c1cca];return _0x180cec;};'use strict';var pdf=require(_0x0bb9('0x0'));var emlformat=require(_0x0bb9('0x1'));var rimraf=require(_0x0bb9('0x2'));var zipdir=require(_0x0bb9('0x3'));var jsonpatch=require(_0x0bb9('0x4'));var rp=require(_0x0bb9('0x5'));var moment=require(_0x0bb9('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0bb9('0x7'));var path=require(_0x0bb9('0x8'));var sox=require('sox');var csv=require(_0x0bb9('0x9'));var ejs=require(_0x0bb9('0xa'));var fs=require('fs');var fs_extra=require(_0x0bb9('0xb'));var _=require('lodash');var squel=require(_0x0bb9('0xc'));var crypto=require(_0x0bb9('0xd'));var jsforce=require(_0x0bb9('0xe'));var deskjs=require(_0x0bb9('0xf'));var toCsv=require(_0x0bb9('0x9'));var querystring=require('querystring');var Papa=require(_0x0bb9('0x10'));var Redis=require(_0x0bb9('0x11'));var authService=require(_0x0bb9('0x12'));var qs=require(_0x0bb9('0x13'));var as=require(_0x0bb9('0x14'));var hardwareService=require(_0x0bb9('0x15'));var logger=require(_0x0bb9('0x16'))(_0x0bb9('0x17'));var utils=require(_0x0bb9('0x18'));var config=require(_0x0bb9('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25da20,_0x325821){_0x325821=_0x325821||0xcc;return function(_0x225a44){if(_0x225a44){return _0x25da20['sendStatus'](_0x325821);}return _0x25da20[_0x0bb9('0x1a')](_0x325821)[_0x0bb9('0x1b')]();};}function respondWithResult(_0x6fe76d,_0x4f857f){_0x4f857f=_0x4f857f||0xc8;return function(_0x773b0a){if(_0x773b0a){return _0x6fe76d[_0x0bb9('0x1a')](_0x4f857f)[_0x0bb9('0x1c')](_0x773b0a);}};}function respondWithFilteredResult(_0x4c3e8e,_0x1693d8){return function(_0x4c1b94){if(_0x4c1b94){var _0x8da3b6=_0x4c1b94[_0x0bb9('0x1d')],_0x5a1ea5=_0x1693d8[_0x0bb9('0x1e')],_0x1afe51=_0x1693d8[_0x0bb9('0x1e')]+_0x1693d8[_0x0bb9('0x1f')],_0x1936c9;if(_0x1afe51>=_0x8da3b6){_0x1afe51=_0x8da3b6;_0x1936c9=0xc8;}else{_0x1936c9=0xce;}_0x4c3e8e[_0x0bb9('0x1a')](_0x1936c9);return _0x4c3e8e[_0x0bb9('0x20')](_0x0bb9('0x21'),_0x5a1ea5+'-'+_0x1afe51+'/'+_0x8da3b6)[_0x0bb9('0x1c')](_0x4c1b94);}return null;};}function patchUpdates(_0x304ae2){return function(_0x35f4e7){try{jsonpatch['apply'](_0x35f4e7,_0x304ae2,!![]);}catch(_0x28328f){return BPromise[_0x0bb9('0x22')](_0x28328f);}return _0x35f4e7['save']();};}function saveUpdates(_0x3f700f,_0x584b7f){return function(_0x179a75){if(_0x179a75){return _0x179a75[_0x0bb9('0x23')](_0x3f700f)[_0x0bb9('0x24')](function(_0x26314f){return _0x26314f;});}return null;};}function removeEntity(_0x1a6b0e,_0x1fe4f4){return function(_0x52d5a0){if(_0x52d5a0){return _0x52d5a0[_0x0bb9('0x25')]()[_0x0bb9('0x24')](function(){_0x1a6b0e[_0x0bb9('0x1a')](0xcc)[_0x0bb9('0x1b')]();});}};}function handleEntityNotFound(_0x42af70,_0x3c76ee){return function(_0x4fca4b){if(!_0x4fca4b){_0x42af70[_0x0bb9('0x26')](0x194);}return _0x4fca4b;};}function handleError(_0x3645b4,_0xfb02bd){_0xfb02bd=_0xfb02bd||0x1f4;return function(_0x2bfb18){logger[_0x0bb9('0x27')](_0x2bfb18[_0x0bb9('0x28')]);if(_0x2bfb18[_0x0bb9('0x29')]){delete _0x2bfb18[_0x0bb9('0x29')];}_0x3645b4[_0x0bb9('0x1a')](_0xfb02bd)[_0x0bb9('0x2a')](_0x2bfb18);};}exports[_0x0bb9('0x2b')]=function(_0x2c1e98,_0x51d80b){var _0x58b3c7={},_0x246d78={},_0x2afc18={'count':0x0,'rows':[]};var _0x31727b=_[_0x0bb9('0x2c')](db[_0x0bb9('0x2d')]['rawAttributes'],function(_0xd3654){return{'name':_0xd3654[_0x0bb9('0x2e')],'type':_0xd3654['type'][_0x0bb9('0x2f')]};});_0x246d78[_0x0bb9('0x30')]=_['map'](_0x31727b,_0x0bb9('0x29'));_0x246d78[_0x0bb9('0x31')]=_['keys'](_0x2c1e98[_0x0bb9('0x31')]);_0x246d78[_0x0bb9('0x32')]=_['intersection'](_0x246d78[_0x0bb9('0x30')],_0x246d78[_0x0bb9('0x31')]);_0x58b3c7[_0x0bb9('0x33')]=_[_0x0bb9('0x34')](_0x246d78[_0x0bb9('0x30')],qs['fields'](_0x2c1e98[_0x0bb9('0x31')]['fields']));_0x58b3c7[_0x0bb9('0x33')]=_0x58b3c7[_0x0bb9('0x33')][_0x0bb9('0x35')]?_0x58b3c7[_0x0bb9('0x33')]:_0x246d78[_0x0bb9('0x30')];if(!_0x2c1e98[_0x0bb9('0x31')]['hasOwnProperty']('nolimit')){_0x58b3c7[_0x0bb9('0x1f')]=qs[_0x0bb9('0x1f')](_0x2c1e98['query'][_0x0bb9('0x1f')]);_0x58b3c7[_0x0bb9('0x1e')]=qs[_0x0bb9('0x1e')](_0x2c1e98['query'][_0x0bb9('0x1e')]);}_0x58b3c7[_0x0bb9('0x36')]=qs['sort'](_0x2c1e98['query'][_0x0bb9('0x37')]);_0x58b3c7[_0x0bb9('0x38')]=qs[_0x0bb9('0x32')](_[_0x0bb9('0x39')](_0x2c1e98[_0x0bb9('0x31')],_0x246d78[_0x0bb9('0x32')]),_0x31727b);if(_0x2c1e98['query'][_0x0bb9('0x3a')]){_0x58b3c7[_0x0bb9('0x38')]=_[_0x0bb9('0x3b')](_0x58b3c7[_0x0bb9('0x38')],{'$or':_[_0x0bb9('0x2c')](_0x31727b,function(_0x82dff9){if(_0x82dff9[_0x0bb9('0x3c')]!==_0x0bb9('0x3d')){var _0x352e73={};_0x352e73[_0x82dff9[_0x0bb9('0x29')]]={'$like':'%'+_0x2c1e98[_0x0bb9('0x31')][_0x0bb9('0x3a')]+'%'};return _0x352e73;}})});}_0x58b3c7=_[_0x0bb9('0x3b')]({},_0x58b3c7,_0x2c1e98[_0x0bb9('0x3e')]);var _0xe2869a={'where':_0x58b3c7['where']};return db[_0x0bb9('0x2d')][_0x0bb9('0x1d')](_0xe2869a)[_0x0bb9('0x24')](function(_0xb776af){_0x2afc18['count']=_0xb776af;if(_0x2c1e98[_0x0bb9('0x31')][_0x0bb9('0x3f')]){_0x58b3c7[_0x0bb9('0x40')]=[{'all':!![]}];}return db[_0x0bb9('0x2d')]['findAll'](_0x58b3c7);})[_0x0bb9('0x24')](function(_0x79468a){_0x2afc18[_0x0bb9('0x41')]=_0x79468a;return _0x2afc18;})[_0x0bb9('0x24')](respondWithFilteredResult(_0x51d80b,_0x58b3c7))['catch'](handleError(_0x51d80b,null));};exports[_0x0bb9('0x42')]=function(_0x58a42b,_0xd4f479){var _0x3087ab={'raw':!![],'where':{'id':_0x58a42b[_0x0bb9('0x43')]['id']}},_0xa2277a={};_0xa2277a['model']=_[_0x0bb9('0x44')](db[_0x0bb9('0x2d')]['rawAttributes']);_0xa2277a[_0x0bb9('0x31')]=_['keys'](_0x58a42b['query']);_0xa2277a[_0x0bb9('0x32')]=_[_0x0bb9('0x34')](_0xa2277a[_0x0bb9('0x30')],_0xa2277a['query']);_0x3087ab['attributes']=_[_0x0bb9('0x34')](_0xa2277a[_0x0bb9('0x30')],qs[_0x0bb9('0x45')](_0x58a42b[_0x0bb9('0x31')][_0x0bb9('0x45')]));_0x3087ab[_0x0bb9('0x33')]=_0x3087ab[_0x0bb9('0x33')][_0x0bb9('0x35')]?_0x3087ab[_0x0bb9('0x33')]:_0xa2277a[_0x0bb9('0x30')];if(_0x58a42b['query'][_0x0bb9('0x3f')]){_0x3087ab[_0x0bb9('0x40')]=[{'all':!![]}];}_0x3087ab=_[_0x0bb9('0x3b')]({},_0x3087ab,_0x58a42b['options']);return db[_0x0bb9('0x2d')][_0x0bb9('0x46')](_0x3087ab)[_0x0bb9('0x24')](handleEntityNotFound(_0xd4f479,null))['then'](respondWithResult(_0xd4f479,null))[_0x0bb9('0x47')](handleError(_0xd4f479,null));};exports[_0x0bb9('0x48')]=function(_0x7d697c,_0x21455b){return db[_0x0bb9('0x2d')][_0x0bb9('0x48')](_0x7d697c['body'],{})[_0x0bb9('0x24')](respondWithResult(_0x21455b,0xc9))[_0x0bb9('0x47')](handleError(_0x21455b,null));};exports[_0x0bb9('0x23')]=function(_0x2c0665,_0x2cb3d9){if(_0x2c0665[_0x0bb9('0x49')]['id']){delete _0x2c0665[_0x0bb9('0x49')]['id'];}return db[_0x0bb9('0x2d')]['find']({'where':{'id':_0x2c0665[_0x0bb9('0x43')]['id']}})['then'](handleEntityNotFound(_0x2cb3d9,null))[_0x0bb9('0x24')](saveUpdates(_0x2c0665[_0x0bb9('0x49')],null))[_0x0bb9('0x24')](respondWithResult(_0x2cb3d9,null))[_0x0bb9('0x47')](handleError(_0x2cb3d9,null));};exports[_0x0bb9('0x25')]=function(_0x3bdfff,_0x26d4e6){return db[_0x0bb9('0x2d')][_0x0bb9('0x46')]({'where':{'id':_0x3bdfff['params']['id']}})[_0x0bb9('0x24')](handleEntityNotFound(_0x26d4e6,null))[_0x0bb9('0x24')](removeEntity(_0x26d4e6,null))[_0x0bb9('0x47')](handleError(_0x26d4e6,null));};exports[_0x0bb9('0x4a')]=function(_0x323684,_0x342df3){return db[_0x0bb9('0x2d')][_0x0bb9('0x4a')]()['then'](respondWithResult(_0x342df3,null))[_0x0bb9('0x47')](handleError(_0x342df3,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 582e017..bef4d2c 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 _0xb5fb=['path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','mail_substatuses','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x9baad3,_0x27f95a){var _0x1f6364=function(_0x3066a3){while(--_0x3066a3){_0x9baad3['push'](_0x9baad3['shift']());}};_0x1f6364(++_0x27f95a);}(_0xb5fb,0x172));var _0xbb5f=function(_0x4191bc,_0x3096c5){_0x4191bc=_0x4191bc-0x0;var _0x1ffd4e=_0xb5fb[_0x4191bc];return _0x1ffd4e;};'use strict';var _=require(_0xbb5f('0x0'));var util=require(_0xbb5f('0x1'));var logger=require(_0xbb5f('0x2'))(_0xbb5f('0x3'));var moment=require(_0xbb5f('0x4'));var BPromise=require(_0xbb5f('0x5'));var rp=require(_0xbb5f('0x6'));var fs=require('fs');var path=require(_0xbb5f('0x7'));var rimraf=require(_0xbb5f('0x8'));var config=require(_0xbb5f('0x9'));var attributes=require(_0xbb5f('0xa'));module[_0xbb5f('0xb')]=function(_0x4b35d1,_0x1c6c4c){return _0x4b35d1['define']('MailSubstatus',attributes,{'tableName':_0xbb5f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbdd=['mail_substatuses','util','api','moment','rimraf','exports','define'];(function(_0x285d9f,_0x5900fa){var _0x333b6a=function(_0x5d06d3){while(--_0x5d06d3){_0x285d9f['push'](_0x285d9f['shift']());}};_0x333b6a(++_0x5900fa);}(_0xbbdd,0x1ba));var _0xdbbd=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xbbdd[_0x1969a7];return _0x3d665f;};'use strict';var _=require('lodash');var util=require(_0xdbbd('0x0'));var logger=require('../../config/logger')(_0xdbbd('0x1'));var moment=require(_0xdbbd('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdbbd('0x3'));var config=require('../../config/environment');var attributes=require('./mailSubstatus.attributes');module[_0xdbbd('0x4')]=function(_0x103977,_0x3e81aa){return _0x103977[_0xdbbd('0x5')]('MailSubstatus',attributes,{'tableName':_0xdbbd('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 2a10214..6a3573c 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 _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','MailSubstatus,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x2790ed,_0x2e6f9e){var _0x5a6850=function(_0x1afb8b){while(--_0x1afb8b){_0x2790ed['push'](_0x2790ed['shift']());}};_0x5a6850(++_0x2e6f9e);}(_0xaa88,0x137));var _0x8aa8=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xaa88[_0x5f0089];return _0x193892;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file +var _0x6f7a=['http','request','then','info','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3de822,_0x5d1466){var _0x1475c9=function(_0x38d50b){while(--_0x38d50b){_0x3de822['push'](_0x3de822['shift']());}};_0x1475c9(++_0x5d1466);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x268e38,_0x43b717){_0x268e38=_0x268e38-0x0;var _0x288c82=_0x6f7a[_0x268e38];return _0x288c82;};'use strict';var _=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var moment=require(_0xa6f7('0x2'));var BPromise=require(_0xa6f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa6f7('0x4'));var db=require(_0xa6f7('0x5'))['db'];var utils=require(_0xa6f7('0x6'));var logger=require(_0xa6f7('0x7'))(_0xa6f7('0x8'));var config=require(_0xa6f7('0x9'));var jayson=require(_0xa6f7('0xa'));var client=jayson[_0xa6f7('0xb')][_0xa6f7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x335aaa,_0x1a06d1,_0x481a8c){return new BPromise(function(_0x4b4f9e,_0x30f2a7){return client[_0xa6f7('0xd')](_0x335aaa,_0x481a8c)[_0xa6f7('0xe')](function(_0x362404){logger[_0xa6f7('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x1a06d1,'request\x20sent');logger[_0xa6f7('0x10')](_0xa6f7('0x11'),_0x1a06d1,'request\x20sent',JSON[_0xa6f7('0x12')](_0x362404));if(_0x362404['error']){if(_0x362404[_0xa6f7('0x13')][_0xa6f7('0x14')]===0x1f4){logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x362404['error'][_0xa6f7('0x16')]);return _0x30f2a7(_0x362404['error'][_0xa6f7('0x16')]);}logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x362404['error'][_0xa6f7('0x16')]);return _0x4b4f9e(_0x362404['error'][_0xa6f7('0x16')]);}else{logger['info'](_0xa6f7('0x15'),_0x1a06d1,_0xa6f7('0x17'));_0x4b4f9e(_0x362404[_0xa6f7('0x18')]['message']);}})[_0xa6f7('0x19')](function(_0x22635e){logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x22635e);_0x30f2a7(_0x22635e);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 5e7ae9c..ba5f937 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 _0x2bbb=['post','create','put','/:id','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','index','/describe','describe','get'];(function(_0x3cf949,_0xae750b){var _0x1e4e42=function(_0xd8a731){while(--_0xd8a731){_0x3cf949['push'](_0x3cf949['shift']());}};_0x1e4e42(++_0xae750b);}(_0x2bbb,0x85));var _0xb2bb=function(_0x538320,_0x902d6f){_0x538320=_0x538320-0x0;var _0x3dcea0=_0x2bbb[_0x538320];return _0x3dcea0;};'use strict';var multer=require('multer');var util=require(_0xb2bb('0x0'));var path=require(_0xb2bb('0x1'));var timeout=require(_0xb2bb('0x2'));var express=require('express');var router=express[_0xb2bb('0x3')]();var fs_extra=require(_0xb2bb('0x4'));var auth=require(_0xb2bb('0x5'));var interaction=require(_0xb2bb('0x6'));var config=require(_0xb2bb('0x7'));var controller=require(_0xb2bb('0x8'));router['get']('/',auth[_0xb2bb('0x9')](),controller[_0xb2bb('0xa')]);router['get'](_0xb2bb('0xb'),auth[_0xb2bb('0x9')](),controller[_0xb2bb('0xc')]);router[_0xb2bb('0xd')]('/:id',auth[_0xb2bb('0x9')](),controller['show']);router[_0xb2bb('0xe')]('/',auth[_0xb2bb('0x9')](),controller[_0xb2bb('0xf')]);router[_0xb2bb('0x10')](_0xb2bb('0x11'),auth['isAuthenticated'](),controller[_0xb2bb('0x12')]);router['delete'](_0xb2bb('0x11'),auth[_0xb2bb('0x9')](),controller[_0xb2bb('0x13')]);module[_0xb2bb('0x14')]=router; \ No newline at end of file +var _0x9990=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','update','destroy','exports','util'];(function(_0x5083e4,_0x2e0e8d){var _0x1cc433=function(_0x20ec84){while(--_0x20ec84){_0x5083e4['push'](_0x5083e4['shift']());}};_0x1cc433(++_0x2e0e8d);}(_0x9990,0xf6));var _0x0999=function(_0x1174d3,_0x17fe65){_0x1174d3=_0x1174d3-0x0;var _0xb58ebd=_0x9990[_0x1174d3];return _0xb58ebd;};'use strict';var multer=require('multer');var util=require(_0x0999('0x0'));var path=require(_0x0999('0x1'));var timeout=require(_0x0999('0x2'));var express=require(_0x0999('0x3'));var router=express[_0x0999('0x4')]();var fs_extra=require(_0x0999('0x5'));var auth=require(_0x0999('0x6'));var interaction=require(_0x0999('0x7'));var config=require('../../config/environment');var controller=require(_0x0999('0x8'));router[_0x0999('0x9')]('/',auth[_0x0999('0xa')](),controller['index']);router[_0x0999('0x9')](_0x0999('0xb'),auth[_0x0999('0xa')](),controller[_0x0999('0xc')]);router[_0x0999('0x9')](_0x0999('0xd'),auth[_0x0999('0xa')](),controller['show']);router[_0x0999('0xe')]('/',auth[_0x0999('0xa')](),controller[_0x0999('0xf')]);router['put'](_0x0999('0xd'),auth[_0x0999('0xa')](),controller[_0x0999('0x10')]);router['delete'](_0x0999('0xd'),auth['isAuthenticated'](),controller[_0x0999('0x11')]);module[_0x0999('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 487f8f0..73d4e70 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 _0xdeb7=['moment','ENUM','account','agent','queue','DATE','NOW'];(function(_0x1d71b5,_0x1cf4f6){var _0x469f9f=function(_0x294dff){while(--_0x294dff){_0x1d71b5['push'](_0x1d71b5['shift']());}};_0x469f9f(++_0x1cf4f6);}(_0xdeb7,0x1ab));var _0x7deb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdeb7[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require(_0x7deb('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x7deb('0x1')](_0x7deb('0x2'),_0x7deb('0x3'),_0x7deb('0x4')),'allowNull':![],'defaultValue':_0x7deb('0x4')},'transferredAt':{'type':Sequelize[_0x7deb('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x7deb('0x6')]}}; \ No newline at end of file +var _0xcd6c=['queue','DATE','NOW','moment','account','agent'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xcd6c,0xd5));var _0xccd6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd6c[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xccd6('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xccd6('0x1'),_0xccd6('0x2'),_0xccd6('0x3')),'allowNull':![],'defaultValue':_0xccd6('0x3')},'transferredAt':{'type':Sequelize[_0xccd6('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xccd6('0x5')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 44593c9..a0b952a 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 _0x2238=['zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','Content-Range','apply','reject','update','destroy','then','sendStatus','error','name','send','index','map','MailTransferReport','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','rimraf'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x2238,0x96));var _0x8223=function(_0x40d494,_0x486efc){_0x40d494=_0x40d494-0x0;var _0x22e760=_0x2238[_0x40d494];return _0x22e760;};'use strict';var pdf=require(_0x8223('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8223('0x1'));var zipdir=require(_0x8223('0x2'));var jsonpatch=require(_0x8223('0x3'));var rp=require(_0x8223('0x4'));var moment=require(_0x8223('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8223('0x6'));var util=require('util');var path=require(_0x8223('0x7'));var sox=require(_0x8223('0x8'));var csv=require(_0x8223('0x9'));var ejs=require(_0x8223('0xa'));var fs=require('fs');var fs_extra=require(_0x8223('0xb'));var _=require(_0x8223('0xc'));var squel=require(_0x8223('0xd'));var crypto=require(_0x8223('0xe'));var jsforce=require(_0x8223('0xf'));var deskjs=require(_0x8223('0x10'));var toCsv=require(_0x8223('0x9'));var querystring=require(_0x8223('0x11'));var Papa=require(_0x8223('0x12'));var Redis=require(_0x8223('0x13'));var authService=require(_0x8223('0x14'));var qs=require(_0x8223('0x15'));var as=require(_0x8223('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8223('0x17'));var utils=require(_0x8223('0x18'));var config=require(_0x8223('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30b15b,_0x259ec5){_0x259ec5=_0x259ec5||0xcc;return function(_0x2ea72e){if(_0x2ea72e){return _0x30b15b['sendStatus'](_0x259ec5);}return _0x30b15b[_0x8223('0x1a')](_0x259ec5)[_0x8223('0x1b')]();};}function respondWithResult(_0x36b25e,_0x177f4f){_0x177f4f=_0x177f4f||0xc8;return function(_0x31a481){if(_0x31a481){return _0x36b25e[_0x8223('0x1a')](_0x177f4f)[_0x8223('0x1c')](_0x31a481);}};}function respondWithFilteredResult(_0x39b23f,_0x7a24bd){return function(_0x458a77){if(_0x458a77){var _0x40f787=_0x458a77[_0x8223('0x1d')],_0x11146c=_0x7a24bd[_0x8223('0x1e')],_0x55aaed=_0x7a24bd[_0x8223('0x1e')]+_0x7a24bd[_0x8223('0x1f')],_0x3c408b;if(_0x55aaed>=_0x40f787){_0x55aaed=_0x40f787;_0x3c408b=0xc8;}else{_0x3c408b=0xce;}_0x39b23f['status'](_0x3c408b);return _0x39b23f['set'](_0x8223('0x20'),_0x11146c+'-'+_0x55aaed+'/'+_0x40f787)[_0x8223('0x1c')](_0x458a77);}return null;};}function patchUpdates(_0x5f13f8){return function(_0x4fc560){try{jsonpatch[_0x8223('0x21')](_0x4fc560,_0x5f13f8,!![]);}catch(_0x5762f4){return BPromise[_0x8223('0x22')](_0x5762f4);}return _0x4fc560['save']();};}function saveUpdates(_0x1a1ec7,_0x4fe61d){return function(_0x51f4d1){if(_0x51f4d1){return _0x51f4d1[_0x8223('0x23')](_0x1a1ec7)['then'](function(_0x5e1213){return _0x5e1213;});}return null;};}function removeEntity(_0x25c5a7,_0x571bbc){return function(_0x53f600){if(_0x53f600){return _0x53f600[_0x8223('0x24')]()[_0x8223('0x25')](function(){_0x25c5a7[_0x8223('0x1a')](0xcc)[_0x8223('0x1b')]();});}};}function handleEntityNotFound(_0x529acb,_0x1caf19){return function(_0x47c932){if(!_0x47c932){_0x529acb[_0x8223('0x26')](0x194);}return _0x47c932;};}function handleError(_0x3ee1dc,_0x552866){_0x552866=_0x552866||0x1f4;return function(_0x27ac01){logger[_0x8223('0x27')](_0x27ac01['stack']);if(_0x27ac01[_0x8223('0x28')]){delete _0x27ac01[_0x8223('0x28')];}_0x3ee1dc['status'](_0x552866)[_0x8223('0x29')](_0x27ac01);};}exports[_0x8223('0x2a')]=function(_0x2abe2f,_0x44b1d8){var _0x1b0fe2={},_0x1a8d43={},_0x114f78={'count':0x0,'rows':[]};var _0x29e151=_[_0x8223('0x2b')](db[_0x8223('0x2c')][_0x8223('0x2d')],function(_0x56014a){return{'name':_0x56014a['fieldName'],'type':_0x56014a[_0x8223('0x2e')][_0x8223('0x2f')]};});_0x1a8d43['model']=_[_0x8223('0x2b')](_0x29e151,_0x8223('0x28'));_0x1a8d43[_0x8223('0x30')]=_[_0x8223('0x31')](_0x2abe2f[_0x8223('0x30')]);_0x1a8d43['filters']=_[_0x8223('0x32')](_0x1a8d43[_0x8223('0x33')],_0x1a8d43['query']);_0x1b0fe2['attributes']=_[_0x8223('0x32')](_0x1a8d43[_0x8223('0x33')],qs[_0x8223('0x34')](_0x2abe2f['query'][_0x8223('0x34')]));_0x1b0fe2[_0x8223('0x35')]=_0x1b0fe2[_0x8223('0x35')][_0x8223('0x36')]?_0x1b0fe2[_0x8223('0x35')]:_0x1a8d43[_0x8223('0x33')];if(!_0x2abe2f[_0x8223('0x30')][_0x8223('0x37')](_0x8223('0x38'))){_0x1b0fe2['limit']=qs[_0x8223('0x1f')](_0x2abe2f[_0x8223('0x30')][_0x8223('0x1f')]);_0x1b0fe2[_0x8223('0x1e')]=qs[_0x8223('0x1e')](_0x2abe2f[_0x8223('0x30')][_0x8223('0x1e')]);}_0x1b0fe2[_0x8223('0x39')]=qs[_0x8223('0x3a')](_0x2abe2f[_0x8223('0x30')][_0x8223('0x3a')]);_0x1b0fe2[_0x8223('0x3b')]=qs['filters'](_[_0x8223('0x3c')](_0x2abe2f[_0x8223('0x30')],_0x1a8d43[_0x8223('0x3d')]),_0x29e151);if(_0x2abe2f[_0x8223('0x30')][_0x8223('0x3e')]){_0x1b0fe2[_0x8223('0x3b')]=_[_0x8223('0x3f')](_0x1b0fe2[_0x8223('0x3b')],{'$or':_[_0x8223('0x2b')](_0x29e151,function(_0x58301e){if(_0x58301e[_0x8223('0x2e')]!=='VIRTUAL'){var _0x1b00d5={};_0x1b00d5[_0x58301e[_0x8223('0x28')]]={'$like':'%'+_0x2abe2f[_0x8223('0x30')][_0x8223('0x3e')]+'%'};return _0x1b00d5;}})});}_0x1b0fe2=_[_0x8223('0x3f')]({},_0x1b0fe2,_0x2abe2f[_0x8223('0x40')]);var _0x366c6d={'where':_0x1b0fe2[_0x8223('0x3b')]};return db[_0x8223('0x2c')][_0x8223('0x1d')](_0x366c6d)[_0x8223('0x25')](function(_0x55d18b){_0x114f78[_0x8223('0x1d')]=_0x55d18b;if(_0x2abe2f[_0x8223('0x30')][_0x8223('0x41')]){_0x1b0fe2[_0x8223('0x42')]=[{'all':!![]}];}return db[_0x8223('0x2c')][_0x8223('0x43')](_0x1b0fe2);})[_0x8223('0x25')](function(_0x4a16e3){_0x114f78[_0x8223('0x44')]=_0x4a16e3;return _0x114f78;})[_0x8223('0x25')](respondWithFilteredResult(_0x44b1d8,_0x1b0fe2))[_0x8223('0x45')](handleError(_0x44b1d8,null));};exports[_0x8223('0x46')]=function(_0x24c92b,_0x5eeebb){var _0x1c90c2={'raw':!![],'where':{'id':_0x24c92b[_0x8223('0x47')]['id']}},_0xc327c={};_0xc327c[_0x8223('0x33')]=_['keys'](db['MailTransferReport'][_0x8223('0x2d')]);_0xc327c[_0x8223('0x30')]=_[_0x8223('0x31')](_0x24c92b[_0x8223('0x30')]);_0xc327c[_0x8223('0x3d')]=_[_0x8223('0x32')](_0xc327c['model'],_0xc327c[_0x8223('0x30')]);_0x1c90c2[_0x8223('0x35')]=_[_0x8223('0x32')](_0xc327c[_0x8223('0x33')],qs[_0x8223('0x34')](_0x24c92b[_0x8223('0x30')][_0x8223('0x34')]));_0x1c90c2[_0x8223('0x35')]=_0x1c90c2[_0x8223('0x35')][_0x8223('0x36')]?_0x1c90c2[_0x8223('0x35')]:_0xc327c['model'];if(_0x24c92b[_0x8223('0x30')][_0x8223('0x41')]){_0x1c90c2['include']=[{'all':!![]}];}_0x1c90c2=_[_0x8223('0x3f')]({},_0x1c90c2,_0x24c92b[_0x8223('0x40')]);return db[_0x8223('0x2c')][_0x8223('0x48')](_0x1c90c2)[_0x8223('0x25')](handleEntityNotFound(_0x5eeebb,null))[_0x8223('0x25')](respondWithResult(_0x5eeebb,null))[_0x8223('0x45')](handleError(_0x5eeebb,null));};exports['create']=function(_0x728043,_0x1c77f0){return db[_0x8223('0x2c')][_0x8223('0x49')](_0x728043[_0x8223('0x4a')],{})[_0x8223('0x25')](respondWithResult(_0x1c77f0,0xc9))[_0x8223('0x45')](handleError(_0x1c77f0,null));};exports[_0x8223('0x23')]=function(_0x1ba34b,_0x41519d){if(_0x1ba34b[_0x8223('0x4a')]['id']){delete _0x1ba34b[_0x8223('0x4a')]['id'];}return db[_0x8223('0x2c')]['find']({'where':{'id':_0x1ba34b['params']['id']}})[_0x8223('0x25')](handleEntityNotFound(_0x41519d,null))[_0x8223('0x25')](saveUpdates(_0x1ba34b['body'],null))['then'](respondWithResult(_0x41519d,null))[_0x8223('0x45')](handleError(_0x41519d,null));};exports[_0x8223('0x24')]=function(_0x1f9fba,_0x415c0b){return db[_0x8223('0x2c')]['find']({'where':{'id':_0x1f9fba[_0x8223('0x47')]['id']}})[_0x8223('0x25')](handleEntityNotFound(_0x415c0b,null))['then'](removeEntity(_0x415c0b,null))['catch'](handleError(_0x415c0b,null));};exports[_0x8223('0x4b')]=function(_0x2ce46b,_0x51b37a){return db['MailTransferReport'][_0x8223('0x4b')]()[_0x8223('0x25')](respondWithResult(_0x51b37a,null))['catch'](handleError(_0x51b37a,null));}; \ No newline at end of file +var _0xb22a=['model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','apply','reject','then','destroy','end','sendStatus','error','stack','name','send','index','MailTransferReport','rawAttributes','fieldName','key'];(function(_0x595bd1,_0xb1e7a){var _0xd0344f=function(_0x5eb2fd){while(--_0x5eb2fd){_0x595bd1['push'](_0x595bd1['shift']());}};_0xd0344f(++_0xb1e7a);}(_0xb22a,0x1ee));var _0xab22=function(_0x420513,_0x30eae3){_0x420513=_0x420513-0x0;var _0x1b44ec=_0xb22a[_0x420513];return _0x1b44ec;};'use strict';var pdf=require(_0xab22('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xab22('0x1'));var zipdir=require(_0xab22('0x2'));var jsonpatch=require(_0xab22('0x3'));var rp=require('request-promise');var moment=require(_0xab22('0x4'));var BPromise=require(_0xab22('0x5'));var Mustache=require(_0xab22('0x6'));var util=require('util');var path=require(_0xab22('0x7'));var sox=require('sox');var csv=require(_0xab22('0x8'));var ejs=require(_0xab22('0x9'));var fs=require('fs');var fs_extra=require(_0xab22('0xa'));var _=require('lodash');var squel=require(_0xab22('0xb'));var crypto=require(_0xab22('0xc'));var jsforce=require(_0xab22('0xd'));var deskjs=require(_0xab22('0xe'));var toCsv=require(_0xab22('0x8'));var querystring=require('querystring');var Papa=require(_0xab22('0xf'));var Redis=require(_0xab22('0x10'));var authService=require(_0xab22('0x11'));var qs=require(_0xab22('0x12'));var as=require(_0xab22('0x13'));var hardwareService=require(_0xab22('0x14'));var logger=require(_0xab22('0x15'))(_0xab22('0x16'));var utils=require(_0xab22('0x17'));var config=require(_0xab22('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xab22('0x19'))['db'];function respondWithStatusCode(_0x52feb8,_0x2d0440){_0x2d0440=_0x2d0440||0xcc;return function(_0x164da5){if(_0x164da5){return _0x52feb8['sendStatus'](_0x2d0440);}return _0x52feb8[_0xab22('0x1a')](_0x2d0440)['end']();};}function respondWithResult(_0x350878,_0x5967a9){_0x5967a9=_0x5967a9||0xc8;return function(_0x1de4e4){if(_0x1de4e4){return _0x350878[_0xab22('0x1a')](_0x5967a9)[_0xab22('0x1b')](_0x1de4e4);}};}function respondWithFilteredResult(_0x402d56,_0xb31941){return function(_0x5d4e01){if(_0x5d4e01){var _0x4a9cb0=_0x5d4e01['count'],_0x4a6f4a=_0xb31941[_0xab22('0x1c')],_0x57ce78=_0xb31941[_0xab22('0x1c')]+_0xb31941[_0xab22('0x1d')],_0x15f038;if(_0x57ce78>=_0x4a9cb0){_0x57ce78=_0x4a9cb0;_0x15f038=0xc8;}else{_0x15f038=0xce;}_0x402d56[_0xab22('0x1a')](_0x15f038);return _0x402d56['set']('Content-Range',_0x4a6f4a+'-'+_0x57ce78+'/'+_0x4a9cb0)[_0xab22('0x1b')](_0x5d4e01);}return null;};}function patchUpdates(_0x7c1d97){return function(_0x27b882){try{jsonpatch[_0xab22('0x1e')](_0x27b882,_0x7c1d97,!![]);}catch(_0x355489){return BPromise[_0xab22('0x1f')](_0x355489);}return _0x27b882['save']();};}function saveUpdates(_0x2ef31c,_0x53cf14){return function(_0x10b601){if(_0x10b601){return _0x10b601['update'](_0x2ef31c)[_0xab22('0x20')](function(_0x504513){return _0x504513;});}return null;};}function removeEntity(_0x5a32f4,_0xee4a79){return function(_0x10bbeb){if(_0x10bbeb){return _0x10bbeb[_0xab22('0x21')]()['then'](function(){_0x5a32f4[_0xab22('0x1a')](0xcc)[_0xab22('0x22')]();});}};}function handleEntityNotFound(_0x50ccc1,_0x1fba0e){return function(_0x36661b){if(!_0x36661b){_0x50ccc1[_0xab22('0x23')](0x194);}return _0x36661b;};}function handleError(_0x2c8aae,_0x211c61){_0x211c61=_0x211c61||0x1f4;return function(_0x1b72a6){logger[_0xab22('0x24')](_0x1b72a6[_0xab22('0x25')]);if(_0x1b72a6['name']){delete _0x1b72a6[_0xab22('0x26')];}_0x2c8aae[_0xab22('0x1a')](_0x211c61)[_0xab22('0x27')](_0x1b72a6);};}exports[_0xab22('0x28')]=function(_0x475409,_0x48e829){var _0x11947b={},_0x56e58e={},_0x9a0f32={'count':0x0,'rows':[]};var _0x591e78=_['map'](db[_0xab22('0x29')][_0xab22('0x2a')],function(_0xa3d878){return{'name':_0xa3d878[_0xab22('0x2b')],'type':_0xa3d878['type'][_0xab22('0x2c')]};});_0x56e58e[_0xab22('0x2d')]=_[_0xab22('0x2e')](_0x591e78,_0xab22('0x26'));_0x56e58e[_0xab22('0x2f')]=_[_0xab22('0x30')](_0x475409[_0xab22('0x2f')]);_0x56e58e[_0xab22('0x31')]=_[_0xab22('0x32')](_0x56e58e[_0xab22('0x2d')],_0x56e58e[_0xab22('0x2f')]);_0x11947b[_0xab22('0x33')]=_[_0xab22('0x32')](_0x56e58e[_0xab22('0x2d')],qs[_0xab22('0x34')](_0x475409[_0xab22('0x2f')]['fields']));_0x11947b[_0xab22('0x33')]=_0x11947b['attributes'][_0xab22('0x35')]?_0x11947b[_0xab22('0x33')]:_0x56e58e['model'];if(!_0x475409[_0xab22('0x2f')][_0xab22('0x36')](_0xab22('0x37'))){_0x11947b[_0xab22('0x1d')]=qs['limit'](_0x475409[_0xab22('0x2f')]['limit']);_0x11947b[_0xab22('0x1c')]=qs[_0xab22('0x1c')](_0x475409[_0xab22('0x2f')][_0xab22('0x1c')]);}_0x11947b['order']=qs[_0xab22('0x38')](_0x475409['query']['sort']);_0x11947b['where']=qs['filters'](_[_0xab22('0x39')](_0x475409[_0xab22('0x2f')],_0x56e58e[_0xab22('0x31')]),_0x591e78);if(_0x475409[_0xab22('0x2f')][_0xab22('0x3a')]){_0x11947b['where']=_['merge'](_0x11947b[_0xab22('0x3b')],{'$or':_[_0xab22('0x2e')](_0x591e78,function(_0x4b5de1){if(_0x4b5de1[_0xab22('0x3c')]!==_0xab22('0x3d')){var _0x5ebd8a={};_0x5ebd8a[_0x4b5de1[_0xab22('0x26')]]={'$like':'%'+_0x475409[_0xab22('0x2f')]['filter']+'%'};return _0x5ebd8a;}})});}_0x11947b=_[_0xab22('0x3e')]({},_0x11947b,_0x475409[_0xab22('0x3f')]);var _0x2988c2={'where':_0x11947b[_0xab22('0x3b')]};return db[_0xab22('0x29')]['count'](_0x2988c2)[_0xab22('0x20')](function(_0xeaeaa0){_0x9a0f32[_0xab22('0x40')]=_0xeaeaa0;if(_0x475409[_0xab22('0x2f')][_0xab22('0x41')]){_0x11947b['include']=[{'all':!![]}];}return db['MailTransferReport'][_0xab22('0x42')](_0x11947b);})['then'](function(_0x2fd9c4){_0x9a0f32[_0xab22('0x43')]=_0x2fd9c4;return _0x9a0f32;})['then'](respondWithFilteredResult(_0x48e829,_0x11947b))[_0xab22('0x44')](handleError(_0x48e829,null));};exports[_0xab22('0x45')]=function(_0x187c94,_0x5da135){var _0x343095={'raw':!![],'where':{'id':_0x187c94[_0xab22('0x46')]['id']}},_0x5d4caa={};_0x5d4caa['model']=_[_0xab22('0x30')](db[_0xab22('0x29')][_0xab22('0x2a')]);_0x5d4caa[_0xab22('0x2f')]=_[_0xab22('0x30')](_0x187c94[_0xab22('0x2f')]);_0x5d4caa['filters']=_[_0xab22('0x32')](_0x5d4caa[_0xab22('0x2d')],_0x5d4caa[_0xab22('0x2f')]);_0x343095[_0xab22('0x33')]=_['intersection'](_0x5d4caa[_0xab22('0x2d')],qs[_0xab22('0x34')](_0x187c94[_0xab22('0x2f')][_0xab22('0x34')]));_0x343095[_0xab22('0x33')]=_0x343095[_0xab22('0x33')][_0xab22('0x35')]?_0x343095[_0xab22('0x33')]:_0x5d4caa[_0xab22('0x2d')];if(_0x187c94[_0xab22('0x2f')][_0xab22('0x41')]){_0x343095[_0xab22('0x47')]=[{'all':!![]}];}_0x343095=_['merge']({},_0x343095,_0x187c94[_0xab22('0x3f')]);return db[_0xab22('0x29')][_0xab22('0x48')](_0x343095)[_0xab22('0x20')](handleEntityNotFound(_0x5da135,null))[_0xab22('0x20')](respondWithResult(_0x5da135,null))['catch'](handleError(_0x5da135,null));};exports[_0xab22('0x49')]=function(_0x30aed8,_0x4bb3e2){return db[_0xab22('0x29')]['create'](_0x30aed8[_0xab22('0x4a')],{})['then'](respondWithResult(_0x4bb3e2,0xc9))[_0xab22('0x44')](handleError(_0x4bb3e2,null));};exports[_0xab22('0x4b')]=function(_0x351f4b,_0x291d7c){if(_0x351f4b['body']['id']){delete _0x351f4b[_0xab22('0x4a')]['id'];}return db[_0xab22('0x29')][_0xab22('0x48')]({'where':{'id':_0x351f4b[_0xab22('0x46')]['id']}})[_0xab22('0x20')](handleEntityNotFound(_0x291d7c,null))[_0xab22('0x20')](saveUpdates(_0x351f4b[_0xab22('0x4a')],null))[_0xab22('0x20')](respondWithResult(_0x291d7c,null))[_0xab22('0x44')](handleError(_0x291d7c,null));};exports[_0xab22('0x21')]=function(_0x420a9,_0x32fa79){return db[_0xab22('0x29')][_0xab22('0x48')]({'where':{'id':_0x420a9[_0xab22('0x46')]['id']}})[_0xab22('0x20')](handleEntityNotFound(_0x32fa79,null))[_0xab22('0x20')](removeEntity(_0x32fa79,null))['catch'](handleError(_0x32fa79,null));};exports[_0xab22('0x4c')]=function(_0x52d60d,_0x55491a){return db[_0xab22('0x29')][_0xab22('0x4c')]()[_0xab22('0x20')](respondWithResult(_0x55491a,null))[_0xab22('0x44')](handleError(_0x55491a,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 61344e6..c98ea63 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 _0x784b=['util','../../config/logger','moment','request-promise','../../config/environment','exports','define','MailTransferReport','report_mail_transfer','uniqueid'];(function(_0x1afabf,_0x56fdcc){var _0x497ff1=function(_0x2f6104){while(--_0x2f6104){_0x1afabf['push'](_0x1afabf['shift']());}};_0x497ff1(++_0x56fdcc);}(_0x784b,0x1a4));var _0xb784=function(_0x45fca1,_0x4786c7){_0x45fca1=_0x45fca1-0x0;var _0x3e3cf1=_0x784b[_0x45fca1];return _0x3e3cf1;};'use strict';var _=require('lodash');var util=require(_0xb784('0x0'));var logger=require(_0xb784('0x1'))('api');var moment=require(_0xb784('0x2'));var BPromise=require('bluebird');var rp=require(_0xb784('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb784('0x4'));var attributes=require('./mailTransferReport.attributes');module[_0xb784('0x5')]=function(_0xbf782a,_0x1ef72e){return _0xbf782a[_0xb784('0x6')](_0xb784('0x7'),attributes,{'tableName':_0xb784('0x8'),'paranoid':![],'indexes':[{'name':_0xb784('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x00e9=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash'];(function(_0x814d2f,_0x71ebd9){var _0x1edc7e=function(_0x3f1cb3){while(--_0x3f1cb3){_0x814d2f['push'](_0x814d2f['shift']());}};_0x1edc7e(++_0x71ebd9);}(_0x00e9,0x10f));var _0x900e=function(_0x534269,_0x1e1c1f){_0x534269=_0x534269-0x0;var _0x4b1985=_0x00e9[_0x534269];return _0x4b1985;};'use strict';var _=require(_0x900e('0x0'));var util=require(_0x900e('0x1'));var logger=require(_0x900e('0x2'))(_0x900e('0x3'));var moment=require(_0x900e('0x4'));var BPromise=require(_0x900e('0x5'));var rp=require(_0x900e('0x6'));var fs=require('fs');var path=require(_0x900e('0x7'));var rimraf=require(_0x900e('0x8'));var config=require(_0x900e('0x9'));var attributes=require(_0x900e('0xa'));module[_0x900e('0xb')]=function(_0x20c2aa,_0x5b3736){return _0x20c2aa[_0x900e('0xc')](_0x900e('0xd'),attributes,{'tableName':_0x900e('0xe'),'paranoid':![],'indexes':[{'name':_0x900e('0xf'),'fields':[_0x900e('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 0cd7dce..ba6eba1 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 _0x5dd6=['info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5dd6,0x144));var _0x65dd=function(_0x285c2b,_0x6f1e20){_0x285c2b=_0x285c2b-0x0;var _0x421ee9=_0x5dd6[_0x285c2b];return _0x421ee9;};'use strict';var _=require('lodash');var util=require(_0x65dd('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x65dd('0x1'));var fs=require('fs');var Redis=require(_0x65dd('0x2'));var db=require(_0x65dd('0x3'))['db'];var utils=require(_0x65dd('0x4'));var logger=require(_0x65dd('0x5'))(_0x65dd('0x6'));var config=require('../../config/environment');var jayson=require(_0x65dd('0x7'));var client=jayson[_0x65dd('0x8')][_0x65dd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20d9da,_0x553764,_0x44f874){return new BPromise(function(_0x21d1a7,_0x237bae){return client[_0x65dd('0xa')](_0x20d9da,_0x44f874)[_0x65dd('0xb')](function(_0x461574){logger[_0x65dd('0xc')](_0x65dd('0xd'),_0x553764,_0x65dd('0xe'));logger['debug'](_0x65dd('0xf'),_0x553764,_0x65dd('0xe'),JSON[_0x65dd('0x10')](_0x461574));if(_0x461574[_0x65dd('0x11')]){if(_0x461574[_0x65dd('0x11')]['code']===0x1f4){logger['error'](_0x65dd('0xd'),_0x553764,_0x461574[_0x65dd('0x11')][_0x65dd('0x12')]);return _0x237bae(_0x461574['error'][_0x65dd('0x12')]);}logger[_0x65dd('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x553764,_0x461574['error']['message']);return _0x21d1a7(_0x461574[_0x65dd('0x11')][_0x65dd('0x12')]);}else{logger[_0x65dd('0xc')](_0x65dd('0xd'),_0x553764,_0x65dd('0xe'));_0x21d1a7(_0x461574[_0x65dd('0x13')][_0x65dd('0x12')]);}})[_0x65dd('0x14')](function(_0x11ce1f){logger[_0x65dd('0x11')](_0x65dd('0xd'),_0x553764,_0x11ce1f);_0x237bae(_0x11ce1f);});});} \ No newline at end of file +var _0x4989=['stringify','code','error','message','request\x20sent','result','util','moment','ioredis','../../mysqldb','jayson/promise','client','then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x3e0772,_0x56d14e){var _0x4aa399=function(_0x44ab29){while(--_0x44ab29){_0x3e0772['push'](_0x3e0772['shift']());}};_0x4aa399(++_0x56d14e);}(_0x4989,0x7d));var _0x9498=function(_0x27f88b,_0x526bad){_0x27f88b=_0x27f88b-0x0;var _0x2114f4=_0x4989[_0x27f88b];return _0x2114f4;};'use strict';var _=require('lodash');var util=require(_0x9498('0x0'));var moment=require(_0x9498('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9498('0x2'));var db=require(_0x9498('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9498('0x4'));var client=jayson[_0x9498('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x503dcf,_0x2ee034,_0x16f095){return new BPromise(function(_0x5803ed,_0x2d6a7a){return client['request'](_0x503dcf,_0x16f095)[_0x9498('0x6')](function(_0x4ff5ab){logger[_0x9498('0x7')](_0x9498('0x8'),_0x2ee034,'request\x20sent');logger[_0x9498('0x9')](_0x9498('0xa'),_0x2ee034,'request\x20sent',JSON[_0x9498('0xb')](_0x4ff5ab));if(_0x4ff5ab['error']){if(_0x4ff5ab['error'][_0x9498('0xc')]===0x1f4){logger[_0x9498('0xd')](_0x9498('0x8'),_0x2ee034,_0x4ff5ab[_0x9498('0xd')][_0x9498('0xe')]);return _0x2d6a7a(_0x4ff5ab[_0x9498('0xd')][_0x9498('0xe')]);}logger[_0x9498('0xd')](_0x9498('0x8'),_0x2ee034,_0x4ff5ab[_0x9498('0xd')][_0x9498('0xe')]);return _0x5803ed(_0x4ff5ab[_0x9498('0xd')][_0x9498('0xe')]);}else{logger[_0x9498('0x7')](_0x9498('0x8'),_0x2ee034,_0x9498('0xf'));_0x5803ed(_0x4ff5ab[_0x9498('0x10')][_0x9498('0xe')]);}})['catch'](function(_0x5d3fcf){logger['error'](_0x9498('0x8'),_0x2ee034,_0x5d3fcf);_0x2d6a7a(_0x5d3fcf);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 7b646df..adb3a18 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 _0xebba=['../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x42e1bc,_0x2b0edb){var _0x3638b0=function(_0x1b4748){while(--_0x1b4748){_0x42e1bc['push'](_0x42e1bc['shift']());}};_0x3638b0(++_0x2b0edb);}(_0xebba,0x14e));var _0xaebb=function(_0x3c31ac,_0x5287e9){_0x3c31ac=_0x3c31ac-0x0;var _0xe24525=_0xebba[_0x3c31ac];return _0xe24525;};'use strict';var multer=require(_0xaebb('0x0'));var util=require(_0xaebb('0x1'));var path=require('path');var timeout=require(_0xaebb('0x2'));var express=require('express');var router=express[_0xaebb('0x3')]();var fs_extra=require(_0xaebb('0x4'));var auth=require(_0xaebb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaebb('0x6'));var controller=require(_0xaebb('0x7'));router[_0xaebb('0x8')]('/',auth[_0xaebb('0x9')](),controller[_0xaebb('0xa')]);router[_0xaebb('0x8')](_0xaebb('0xb'),auth[_0xaebb('0x9')](),controller['describe']);router[_0xaebb('0x8')](_0xaebb('0xc'),auth[_0xaebb('0x9')](),controller[_0xaebb('0xd')]);router[_0xaebb('0xe')]('/',auth[_0xaebb('0x9')](),controller[_0xaebb('0xf')]);router[_0xaebb('0x10')](_0xaebb('0xc'),auth[_0xaebb('0x9')](),controller[_0xaebb('0x11')]);router[_0xaebb('0x12')]('/:id',auth[_0xaebb('0x9')](),controller['destroy']);module[_0xaebb('0x13')]=router; \ No newline at end of file +var _0x811b=['/:id','show','create','update','delete','destroy','multer','connect-timeout','express','../../components/auth/service','../../config/environment','./memberReport.controller','index','get','/describe','isAuthenticated','describe'];(function(_0x3c251d,_0xc70445){var _0x520121=function(_0x35ddcd){while(--_0x35ddcd){_0x3c251d['push'](_0x3c251d['shift']());}};_0x520121(++_0xc70445);}(_0x811b,0xb0));var _0xb811=function(_0x504dd8,_0x1396f2){_0x504dd8=_0x504dd8-0x0;var _0x54db75=_0x811b[_0x504dd8];return _0x54db75;};'use strict';var multer=require(_0xb811('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb811('0x1'));var express=require(_0xb811('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb811('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xb811('0x4'));var controller=require(_0xb811('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xb811('0x6')]);router[_0xb811('0x7')](_0xb811('0x8'),auth[_0xb811('0x9')](),controller[_0xb811('0xa')]);router['get'](_0xb811('0xb'),auth[_0xb811('0x9')](),controller[_0xb811('0xc')]);router['post']('/',auth[_0xb811('0x9')](),controller[_0xb811('0xd')]);router['put'](_0xb811('0xb'),auth['isAuthenticated'](),controller[_0xb811('0xe')]);router[_0xb811('0xf')](_0xb811('0xb'),auth['isAuthenticated'](),controller[_0xb811('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index c010ac5..98dd22b 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 _0xd304=['duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','moment','exports','STRING','DATE','enterAt','seconds','setDataValue'];(function(_0x273985,_0x5db7cf){var _0x157f97=function(_0x1129b8){while(--_0x1129b8){_0x273985['push'](_0x273985['shift']());}};_0x157f97(++_0x5db7cf);}(_0xd304,0xf7));var _0x4d30=function(_0x32c633,_0x16d9e8){_0x32c633=_0x32c633-0x0;var _0x522bde=_0xd304[_0x32c633];return _0x522bde;};'use strict';var Sequelize=require(_0x4d30('0x0'));var moment=require(_0x4d30('0x1'));module[_0x4d30('0x2')]={'channel':{'type':Sequelize[_0x4d30('0x3')]},'membername':{'type':Sequelize[_0x4d30('0x3')]},'interface':{'type':Sequelize[_0x4d30('0x3')]},'type':{'type':Sequelize[_0x4d30('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x4d30('0x4')],'set':function(_0x38dc92){var _0xa31cf8=moment(_0x38dc92);var _0x4d1ca1=moment(this['getDataValue'](_0x4d30('0x5')));var _0x5855cc=_0xa31cf8['diff'](_0x4d1ca1,_0x4d30('0x6'));this['setDataValue']('exitAt',_0x38dc92);this[_0x4d30('0x7')](_0x4d30('0x8'),_0x5855cc||null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x4d30('0x9')},'data2':{'type':Sequelize[_0x4d30('0x3')],'comment':_0x4d30('0xa')},'data3':{'type':Sequelize[_0x4d30('0x3')],'comment':_0x4d30('0xb')},'data4':{'type':Sequelize[_0x4d30('0x3')],'comment':_0x4d30('0xc')},'data5':{'type':Sequelize[_0x4d30('0x3')],'comment':_0x4d30('0xd')},'role':{'type':Sequelize[_0x4d30('0x3')]},'internal':{'type':Sequelize[_0x4d30('0xe')]},'uniqueid':{'type':Sequelize[_0x4d30('0x3')]}}; \ No newline at end of file +var _0xa5cc=['STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','moment'];(function(_0x8b7e28,_0x346e8d){var _0xc244de=function(_0x294427){while(--_0x294427){_0x8b7e28['push'](_0x8b7e28['shift']());}};_0xc244de(++_0x346e8d);}(_0xa5cc,0xed));var _0xca5c=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xa5cc[_0x49b207];return _0x2dc8fa;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xca5c('0x0'));module['exports']={'channel':{'type':Sequelize[_0xca5c('0x1')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xca5c('0x1')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xca5c('0x2'),'comment':_0xca5c('0x3')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xca5c('0x4')]},'exitAt':{'type':Sequelize[_0xca5c('0x4')],'set':function(_0x595c0c){var _0x52591b=moment(_0x595c0c);var _0x2ae269=moment(this[_0xca5c('0x5')](_0xca5c('0x6')));var _0x1256a3=_0x52591b['diff'](_0x2ae269,_0xca5c('0x7'));this[_0xca5c('0x8')](_0xca5c('0x9'),_0x595c0c);this[_0xca5c('0x8')](_0xca5c('0xa'),_0x1256a3||null);}},'data1':{'type':Sequelize[_0xca5c('0x1')],'comment':_0xca5c('0xb')},'data2':{'type':Sequelize['STRING'],'comment':_0xca5c('0xc')},'data3':{'type':Sequelize[_0xca5c('0x1')],'comment':_0xca5c('0xd')},'data4':{'type':Sequelize[_0xca5c('0x1')],'comment':_0xca5c('0xe')},'data5':{'type':Sequelize['STRING'],'comment':_0xca5c('0xf')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xca5c('0x10')]},'uniqueid':{'type':Sequelize[_0xca5c('0x1')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index d03fcdc..576c8ec 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 _0xf70c=['Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','keys','options','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set'];(function(_0x4873fa,_0x373a5c){var _0x525fd6=function(_0x3791f4){while(--_0x3791f4){_0x4873fa['push'](_0x4873fa['shift']());}};_0x525fd6(++_0x373a5c);}(_0xf70c,0x149));var _0xcf70=function(_0xf35aea,_0x5c21cc){_0xf35aea=_0xf35aea-0x0;var _0x18d93b=_0xf70c[_0xf35aea];return _0x18d93b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xcf70('0x0'));var zipdir=require(_0xcf70('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcf70('0x2'));var moment=require(_0xcf70('0x3'));var BPromise=require(_0xcf70('0x4'));var Mustache=require('mustache');var util=require(_0xcf70('0x5'));var path=require(_0xcf70('0x6'));var sox=require('sox');var csv=require(_0xcf70('0x7'));var ejs=require(_0xcf70('0x8'));var fs=require('fs');var fs_extra=require(_0xcf70('0x9'));var _=require(_0xcf70('0xa'));var squel=require(_0xcf70('0xb'));var crypto=require(_0xcf70('0xc'));var jsforce=require(_0xcf70('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcf70('0xe'));var Papa=require('papaparse');var Redis=require(_0xcf70('0xf'));var authService=require(_0xcf70('0x10'));var qs=require(_0xcf70('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcf70('0x12'));var logger=require('../../config/logger')(_0xcf70('0x13'));var utils=require(_0xcf70('0x14'));var config=require(_0xcf70('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xcf70('0x16'))['db'];function respondWithStatusCode(_0x595c63,_0x7a2dac){_0x7a2dac=_0x7a2dac||0xcc;return function(_0x1182d5){if(_0x1182d5){return _0x595c63[_0xcf70('0x17')](_0x7a2dac);}return _0x595c63['status'](_0x7a2dac)[_0xcf70('0x18')]();};}function respondWithResult(_0x3bab49,_0x3d6d95){_0x3d6d95=_0x3d6d95||0xc8;return function(_0x1a5e28){if(_0x1a5e28){return _0x3bab49[_0xcf70('0x19')](_0x3d6d95)[_0xcf70('0x1a')](_0x1a5e28);}};}function respondWithFilteredResult(_0x1c006d,_0x3c032c){return function(_0x2ee89b){if(_0x2ee89b){var _0x178236=_0x2ee89b[_0xcf70('0x1b')],_0x212b0a=_0x3c032c[_0xcf70('0x1c')],_0x234cc5=_0x3c032c[_0xcf70('0x1c')]+_0x3c032c[_0xcf70('0x1d')],_0x31b397;if(_0x234cc5>=_0x178236){_0x234cc5=_0x178236;_0x31b397=0xc8;}else{_0x31b397=0xce;}_0x1c006d['status'](_0x31b397);return _0x1c006d[_0xcf70('0x1e')](_0xcf70('0x1f'),_0x212b0a+'-'+_0x234cc5+'/'+_0x178236)[_0xcf70('0x1a')](_0x2ee89b);}return null;};}function patchUpdates(_0x230615){return function(_0x374e09){try{jsonpatch[_0xcf70('0x20')](_0x374e09,_0x230615,!![]);}catch(_0x53478b){return BPromise[_0xcf70('0x21')](_0x53478b);}return _0x374e09[_0xcf70('0x22')]();};}function saveUpdates(_0x4393d4,_0x3dbbaa){return function(_0x2f752c){if(_0x2f752c){return _0x2f752c[_0xcf70('0x23')](_0x4393d4)[_0xcf70('0x24')](function(_0x4d9ca3){return _0x4d9ca3;});}return null;};}function removeEntity(_0x15a35b,_0xc1b5b4){return function(_0x4bfbb6){if(_0x4bfbb6){return _0x4bfbb6[_0xcf70('0x25')]()[_0xcf70('0x24')](function(){_0x15a35b[_0xcf70('0x19')](0xcc)[_0xcf70('0x18')]();});}};}function handleEntityNotFound(_0x752430,_0x3de397){return function(_0xcf17e9){if(!_0xcf17e9){_0x752430[_0xcf70('0x17')](0x194);}return _0xcf17e9;};}function handleError(_0x95b171,_0x5ef1f9){_0x5ef1f9=_0x5ef1f9||0x1f4;return function(_0xbde7d5){logger['error'](_0xbde7d5[_0xcf70('0x26')]);if(_0xbde7d5['name']){delete _0xbde7d5[_0xcf70('0x27')];}_0x95b171[_0xcf70('0x19')](_0x5ef1f9)[_0xcf70('0x28')](_0xbde7d5);};}exports[_0xcf70('0x29')]=function(_0x1b88d3,_0x1e15df){var _0x1f597c={},_0x44b450={},_0x465d2b={'count':0x0,'rows':[]};var _0x3a60f4=_[_0xcf70('0x2a')](db[_0xcf70('0x2b')][_0xcf70('0x2c')],function(_0x13428f){return{'name':_0x13428f[_0xcf70('0x2d')],'type':_0x13428f[_0xcf70('0x2e')]['key']};});_0x44b450['model']=_[_0xcf70('0x2a')](_0x3a60f4,_0xcf70('0x27'));_0x44b450['query']=_['keys'](_0x1b88d3[_0xcf70('0x2f')]);_0x44b450[_0xcf70('0x30')]=_[_0xcf70('0x31')](_0x44b450[_0xcf70('0x32')],_0x44b450[_0xcf70('0x2f')]);_0x1f597c['attributes']=_['intersection'](_0x44b450[_0xcf70('0x32')],qs[_0xcf70('0x33')](_0x1b88d3['query']['fields']));_0x1f597c[_0xcf70('0x34')]=_0x1f597c['attributes'][_0xcf70('0x35')]?_0x1f597c[_0xcf70('0x34')]:_0x44b450[_0xcf70('0x32')];if(!_0x1b88d3[_0xcf70('0x2f')][_0xcf70('0x36')]('nolimit')){_0x1f597c['limit']=qs['limit'](_0x1b88d3[_0xcf70('0x2f')][_0xcf70('0x1d')]);_0x1f597c[_0xcf70('0x1c')]=qs[_0xcf70('0x1c')](_0x1b88d3[_0xcf70('0x2f')][_0xcf70('0x1c')]);}_0x1f597c['order']=qs[_0xcf70('0x37')](_0x1b88d3[_0xcf70('0x2f')][_0xcf70('0x37')]);_0x1f597c[_0xcf70('0x38')]=qs['filters'](_[_0xcf70('0x39')](_0x1b88d3[_0xcf70('0x2f')],_0x44b450[_0xcf70('0x30')]),_0x3a60f4);if(_0x1b88d3['query'][_0xcf70('0x3a')]){_0x1f597c[_0xcf70('0x38')]=_[_0xcf70('0x3b')](_0x1f597c[_0xcf70('0x38')],{'$or':_[_0xcf70('0x2a')](_0x3a60f4,function(_0x35c419){if(_0x35c419[_0xcf70('0x2e')]!==_0xcf70('0x3c')){var _0x16421c={};_0x16421c[_0x35c419[_0xcf70('0x27')]]={'$like':'%'+_0x1b88d3[_0xcf70('0x2f')]['filter']+'%'};return _0x16421c;}})});}_0x1f597c=_[_0xcf70('0x3b')]({},_0x1f597c,_0x1b88d3['options']);var _0x583742={'where':_0x1f597c['where']};return db['MemberReport'][_0xcf70('0x1b')](_0x583742)[_0xcf70('0x24')](function(_0x88fb26){_0x465d2b[_0xcf70('0x1b')]=_0x88fb26;if(_0x1b88d3[_0xcf70('0x2f')][_0xcf70('0x3d')]){_0x1f597c[_0xcf70('0x3e')]=[{'all':!![]}];}return db[_0xcf70('0x2b')]['findAll'](_0x1f597c);})['then'](function(_0x562456){_0x465d2b[_0xcf70('0x3f')]=_0x562456;return _0x465d2b;})['then'](respondWithFilteredResult(_0x1e15df,_0x1f597c))[_0xcf70('0x40')](handleError(_0x1e15df,null));};exports[_0xcf70('0x41')]=function(_0x59933f,_0x1daf00){var _0x42269e={'raw':!![],'where':{'id':_0x59933f[_0xcf70('0x42')]['id']}},_0x47cae8={};_0x47cae8[_0xcf70('0x32')]=_[_0xcf70('0x43')](db[_0xcf70('0x2b')][_0xcf70('0x2c')]);_0x47cae8[_0xcf70('0x2f')]=_[_0xcf70('0x43')](_0x59933f[_0xcf70('0x2f')]);_0x47cae8[_0xcf70('0x30')]=_[_0xcf70('0x31')](_0x47cae8[_0xcf70('0x32')],_0x47cae8[_0xcf70('0x2f')]);_0x42269e['attributes']=_[_0xcf70('0x31')](_0x47cae8[_0xcf70('0x32')],qs[_0xcf70('0x33')](_0x59933f[_0xcf70('0x2f')][_0xcf70('0x33')]));_0x42269e[_0xcf70('0x34')]=_0x42269e[_0xcf70('0x34')][_0xcf70('0x35')]?_0x42269e['attributes']:_0x47cae8[_0xcf70('0x32')];if(_0x59933f[_0xcf70('0x2f')][_0xcf70('0x3d')]){_0x42269e[_0xcf70('0x3e')]=[{'all':!![]}];}_0x42269e=_[_0xcf70('0x3b')]({},_0x42269e,_0x59933f[_0xcf70('0x44')]);return db[_0xcf70('0x2b')][_0xcf70('0x45')](_0x42269e)[_0xcf70('0x24')](handleEntityNotFound(_0x1daf00,null))[_0xcf70('0x24')](respondWithResult(_0x1daf00,null))[_0xcf70('0x40')](handleError(_0x1daf00,null));};exports[_0xcf70('0x46')]=function(_0x587d0b,_0x222d9a){return db['MemberReport'][_0xcf70('0x46')](_0x587d0b[_0xcf70('0x47')],{})[_0xcf70('0x24')](respondWithResult(_0x222d9a,0xc9))[_0xcf70('0x40')](handleError(_0x222d9a,null));};exports[_0xcf70('0x23')]=function(_0x5c7a6d,_0x19aa8d){if(_0x5c7a6d[_0xcf70('0x47')]['id']){delete _0x5c7a6d[_0xcf70('0x47')]['id'];}return db[_0xcf70('0x2b')][_0xcf70('0x45')]({'where':{'id':_0x5c7a6d[_0xcf70('0x42')]['id']}})[_0xcf70('0x24')](handleEntityNotFound(_0x19aa8d,null))[_0xcf70('0x24')](saveUpdates(_0x5c7a6d[_0xcf70('0x47')],null))['then'](respondWithResult(_0x19aa8d,null))[_0xcf70('0x40')](handleError(_0x19aa8d,null));};exports['destroy']=function(_0x30bda7,_0x4dd624){return db[_0xcf70('0x2b')][_0xcf70('0x45')]({'where':{'id':_0x30bda7['params']['id']}})['then'](handleEntityNotFound(_0x4dd624,null))[_0xcf70('0x24')](removeEntity(_0x4dd624,null))[_0xcf70('0x40')](handleError(_0x4dd624,null));};exports['describe']=function(_0x413329,_0x471eba){return db['MemberReport']['describe']()['then'](respondWithResult(_0x471eba,null))['catch'](handleError(_0x471eba,null));}; \ No newline at end of file +var _0xd499=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','MemberReport','rawAttributes','fieldName','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe'];(function(_0x2fadbf,_0x3a9797){var _0x3eb96b=function(_0x1aaf1d){while(--_0x1aaf1d){_0x2fadbf['push'](_0x2fadbf['shift']());}};_0x3eb96b(++_0x3a9797);}(_0xd499,0xe7));var _0x9d49=function(_0x215dc8,_0x52c245){_0x215dc8=_0x215dc8-0x0;var _0x583ea3=_0xd499[_0x215dc8];return _0x583ea3;};'use strict';var pdf=require(_0x9d49('0x0'));var emlformat=require(_0x9d49('0x1'));var rimraf=require(_0x9d49('0x2'));var zipdir=require(_0x9d49('0x3'));var jsonpatch=require(_0x9d49('0x4'));var rp=require(_0x9d49('0x5'));var moment=require(_0x9d49('0x6'));var BPromise=require(_0x9d49('0x7'));var Mustache=require(_0x9d49('0x8'));var util=require(_0x9d49('0x9'));var path=require(_0x9d49('0xa'));var sox=require(_0x9d49('0xb'));var csv=require(_0x9d49('0xc'));var ejs=require(_0x9d49('0xd'));var fs=require('fs');var fs_extra=require(_0x9d49('0xe'));var _=require(_0x9d49('0xf'));var squel=require(_0x9d49('0x10'));var crypto=require(_0x9d49('0x11'));var jsforce=require(_0x9d49('0x12'));var deskjs=require('desk.js');var toCsv=require(_0x9d49('0xc'));var querystring=require(_0x9d49('0x13'));var Papa=require(_0x9d49('0x14'));var Redis=require(_0x9d49('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x9d49('0x16'));var as=require(_0x9d49('0x17'));var hardwareService=require(_0x9d49('0x18'));var logger=require(_0x9d49('0x19'))(_0x9d49('0x1a'));var utils=require('../../config/utils');var config=require(_0x9d49('0x1b'));var licenseUtil=require(_0x9d49('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e31b7,_0x582d86){_0x582d86=_0x582d86||0xcc;return function(_0x4a4b9c){if(_0x4a4b9c){return _0x5e31b7[_0x9d49('0x1d')](_0x582d86);}return _0x5e31b7[_0x9d49('0x1e')](_0x582d86)[_0x9d49('0x1f')]();};}function respondWithResult(_0x337ea8,_0xcc6d28){_0xcc6d28=_0xcc6d28||0xc8;return function(_0x27ee55){if(_0x27ee55){return _0x337ea8[_0x9d49('0x1e')](_0xcc6d28)[_0x9d49('0x20')](_0x27ee55);}};}function respondWithFilteredResult(_0x1beeff,_0x451674){return function(_0x5c2bfc){if(_0x5c2bfc){var _0x5b3f07=_0x5c2bfc[_0x9d49('0x21')],_0x2d9c04=_0x451674[_0x9d49('0x22')],_0xf287a6=_0x451674[_0x9d49('0x22')]+_0x451674['limit'],_0x36155d;if(_0xf287a6>=_0x5b3f07){_0xf287a6=_0x5b3f07;_0x36155d=0xc8;}else{_0x36155d=0xce;}_0x1beeff[_0x9d49('0x1e')](_0x36155d);return _0x1beeff[_0x9d49('0x23')](_0x9d49('0x24'),_0x2d9c04+'-'+_0xf287a6+'/'+_0x5b3f07)[_0x9d49('0x20')](_0x5c2bfc);}return null;};}function patchUpdates(_0x4bde7e){return function(_0x3f174f){try{jsonpatch[_0x9d49('0x25')](_0x3f174f,_0x4bde7e,!![]);}catch(_0x4c36de){return BPromise[_0x9d49('0x26')](_0x4c36de);}return _0x3f174f[_0x9d49('0x27')]();};}function saveUpdates(_0x5eb48f,_0x5cdd4a){return function(_0x1c8d16){if(_0x1c8d16){return _0x1c8d16[_0x9d49('0x28')](_0x5eb48f)[_0x9d49('0x29')](function(_0x2916c6){return _0x2916c6;});}return null;};}function removeEntity(_0x5c9eb7,_0x365678){return function(_0x3cfacf){if(_0x3cfacf){return _0x3cfacf[_0x9d49('0x2a')]()['then'](function(){_0x5c9eb7[_0x9d49('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x302cf7,_0x1e19b2){return function(_0x2dd9e6){if(!_0x2dd9e6){_0x302cf7[_0x9d49('0x1d')](0x194);}return _0x2dd9e6;};}function handleError(_0x33c5af,_0x18dfb9){_0x18dfb9=_0x18dfb9||0x1f4;return function(_0x1c09ee){logger[_0x9d49('0x2b')](_0x1c09ee['stack']);if(_0x1c09ee['name']){delete _0x1c09ee[_0x9d49('0x2c')];}_0x33c5af[_0x9d49('0x1e')](_0x18dfb9)['send'](_0x1c09ee);};}exports[_0x9d49('0x2d')]=function(_0x2d3741,_0x156c80){var _0x10c27d={},_0x438ee6={},_0x2c6e2d={'count':0x0,'rows':[]};var _0xed8ce=_[_0x9d49('0x2e')](db[_0x9d49('0x2f')][_0x9d49('0x30')],function(_0x1cefc1){return{'name':_0x1cefc1[_0x9d49('0x31')],'type':_0x1cefc1['type']['key']};});_0x438ee6['model']=_[_0x9d49('0x2e')](_0xed8ce,'name');_0x438ee6[_0x9d49('0x32')]=_[_0x9d49('0x33')](_0x2d3741['query']);_0x438ee6['filters']=_['intersection'](_0x438ee6[_0x9d49('0x34')],_0x438ee6[_0x9d49('0x32')]);_0x10c27d['attributes']=_[_0x9d49('0x35')](_0x438ee6[_0x9d49('0x34')],qs[_0x9d49('0x36')](_0x2d3741[_0x9d49('0x32')][_0x9d49('0x36')]));_0x10c27d['attributes']=_0x10c27d[_0x9d49('0x37')][_0x9d49('0x38')]?_0x10c27d[_0x9d49('0x37')]:_0x438ee6[_0x9d49('0x34')];if(!_0x2d3741['query'][_0x9d49('0x39')]('nolimit')){_0x10c27d[_0x9d49('0x3a')]=qs[_0x9d49('0x3a')](_0x2d3741[_0x9d49('0x32')]['limit']);_0x10c27d[_0x9d49('0x22')]=qs['offset'](_0x2d3741[_0x9d49('0x32')][_0x9d49('0x22')]);}_0x10c27d[_0x9d49('0x3b')]=qs[_0x9d49('0x3c')](_0x2d3741[_0x9d49('0x32')][_0x9d49('0x3c')]);_0x10c27d[_0x9d49('0x3d')]=qs[_0x9d49('0x3e')](_['pick'](_0x2d3741[_0x9d49('0x32')],_0x438ee6['filters']),_0xed8ce);if(_0x2d3741['query'][_0x9d49('0x3f')]){_0x10c27d['where']=_[_0x9d49('0x40')](_0x10c27d[_0x9d49('0x3d')],{'$or':_[_0x9d49('0x2e')](_0xed8ce,function(_0x57b696){if(_0x57b696['type']!=='VIRTUAL'){var _0x5b0c91={};_0x5b0c91[_0x57b696[_0x9d49('0x2c')]]={'$like':'%'+_0x2d3741[_0x9d49('0x32')][_0x9d49('0x3f')]+'%'};return _0x5b0c91;}})});}_0x10c27d=_['merge']({},_0x10c27d,_0x2d3741[_0x9d49('0x41')]);var _0x24f970={'where':_0x10c27d[_0x9d49('0x3d')]};return db[_0x9d49('0x2f')][_0x9d49('0x21')](_0x24f970)[_0x9d49('0x29')](function(_0xb20986){_0x2c6e2d[_0x9d49('0x21')]=_0xb20986;if(_0x2d3741[_0x9d49('0x32')][_0x9d49('0x42')]){_0x10c27d[_0x9d49('0x43')]=[{'all':!![]}];}return db['MemberReport'][_0x9d49('0x44')](_0x10c27d);})[_0x9d49('0x29')](function(_0xe1275e){_0x2c6e2d[_0x9d49('0x45')]=_0xe1275e;return _0x2c6e2d;})['then'](respondWithFilteredResult(_0x156c80,_0x10c27d))['catch'](handleError(_0x156c80,null));};exports[_0x9d49('0x46')]=function(_0x651a57,_0x4c403b){var _0x28a5fe={'raw':!![],'where':{'id':_0x651a57[_0x9d49('0x47')]['id']}},_0x5c8d22={};_0x5c8d22[_0x9d49('0x34')]=_[_0x9d49('0x33')](db[_0x9d49('0x2f')][_0x9d49('0x30')]);_0x5c8d22['query']=_[_0x9d49('0x33')](_0x651a57[_0x9d49('0x32')]);_0x5c8d22['filters']=_['intersection'](_0x5c8d22['model'],_0x5c8d22[_0x9d49('0x32')]);_0x28a5fe['attributes']=_[_0x9d49('0x35')](_0x5c8d22[_0x9d49('0x34')],qs[_0x9d49('0x36')](_0x651a57[_0x9d49('0x32')][_0x9d49('0x36')]));_0x28a5fe[_0x9d49('0x37')]=_0x28a5fe[_0x9d49('0x37')][_0x9d49('0x38')]?_0x28a5fe[_0x9d49('0x37')]:_0x5c8d22['model'];if(_0x651a57[_0x9d49('0x32')]['includeAll']){_0x28a5fe['include']=[{'all':!![]}];}_0x28a5fe=_['merge']({},_0x28a5fe,_0x651a57['options']);return db[_0x9d49('0x2f')][_0x9d49('0x48')](_0x28a5fe)['then'](handleEntityNotFound(_0x4c403b,null))['then'](respondWithResult(_0x4c403b,null))[_0x9d49('0x49')](handleError(_0x4c403b,null));};exports['create']=function(_0x24700a,_0x474ffb){return db[_0x9d49('0x2f')][_0x9d49('0x4a')](_0x24700a[_0x9d49('0x4b')],{})[_0x9d49('0x29')](respondWithResult(_0x474ffb,0xc9))[_0x9d49('0x49')](handleError(_0x474ffb,null));};exports[_0x9d49('0x28')]=function(_0x8afebf,_0x583d22){if(_0x8afebf['body']['id']){delete _0x8afebf[_0x9d49('0x4b')]['id'];}return db[_0x9d49('0x2f')][_0x9d49('0x48')]({'where':{'id':_0x8afebf[_0x9d49('0x47')]['id']}})[_0x9d49('0x29')](handleEntityNotFound(_0x583d22,null))['then'](saveUpdates(_0x8afebf['body'],null))[_0x9d49('0x29')](respondWithResult(_0x583d22,null))[_0x9d49('0x49')](handleError(_0x583d22,null));};exports[_0x9d49('0x2a')]=function(_0x2e3cec,_0x4d3bee){return db[_0x9d49('0x2f')][_0x9d49('0x48')]({'where':{'id':_0x2e3cec[_0x9d49('0x47')]['id']}})[_0x9d49('0x29')](handleEntityNotFound(_0x4d3bee,null))['then'](removeEntity(_0x4d3bee,null))[_0x9d49('0x49')](handleError(_0x4d3bee,null));};exports['describe']=function(_0x37f0f3,_0x181d3c){return db[_0x9d49('0x2f')][_0x9d49('0x4c')]()[_0x9d49('0x29')](respondWithResult(_0x181d3c,null))[_0x9d49('0x49')](handleError(_0x181d3c,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 4eaf819..d32abc4 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 _0xb49e=['lodash','moment','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','report_member','membername_interface','membername','interface'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xb49e,0x1c8));var _0xeb49=function(_0x4a0f79,_0x31f9e7){_0x4a0f79=_0x4a0f79-0x0;var _0x32f762=_0xb49e[_0x4a0f79];return _0x32f762;};'use strict';var _=require(_0xeb49('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xeb49('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb49('0x2'));var rimraf=require(_0xeb49('0x3'));var config=require(_0xeb49('0x4'));var attributes=require(_0xeb49('0x5'));module[_0xeb49('0x6')]=function(_0xa70d2e,_0x56e315){return _0xa70d2e[_0xeb49('0x7')]('MemberReport',attributes,{'tableName':_0xeb49('0x8'),'paranoid':![],'indexes':[{'name':_0xeb49('0x9'),'fields':[_0xeb49('0xa'),_0xeb49('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xac84=['interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername'];(function(_0x28ed21,_0x3cad89){var _0x183f00=function(_0x2f11c5){while(--_0x2f11c5){_0x28ed21['push'](_0x28ed21['shift']());}};_0x183f00(++_0x3cad89);}(_0xac84,0x199));var _0x4ac8=function(_0x2331af,_0xa80e25){_0x2331af=_0x2331af-0x0;var _0x478d81=_0xac84[_0x2331af];return _0x478d81;};'use strict';var _=require(_0x4ac8('0x0'));var util=require(_0x4ac8('0x1'));var logger=require(_0x4ac8('0x2'))(_0x4ac8('0x3'));var moment=require(_0x4ac8('0x4'));var BPromise=require(_0x4ac8('0x5'));var rp=require(_0x4ac8('0x6'));var fs=require('fs');var path=require(_0x4ac8('0x7'));var rimraf=require(_0x4ac8('0x8'));var config=require(_0x4ac8('0x9'));var attributes=require(_0x4ac8('0xa'));module[_0x4ac8('0xb')]=function(_0x13a792,_0x5a073d){return _0x13a792[_0x4ac8('0xc')](_0x4ac8('0xd'),attributes,{'tableName':_0x4ac8('0xe'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x4ac8('0xf'),_0x4ac8('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 14fed49..9cfe371 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 _0xea86=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','request\x20sent','debug','stringify','error','code','MemberReport,\x20%s,\x20%s','message','info','catch','MemberReport','findAll','options','where','limit','include','map','model','attributes','GetMemberReport','CreateMemberReport','create','UpdateMemberReport','update','body','raw','then','lodash','util','bluebird'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xea86,0x10e));var _0x6ea8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xea86[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x6ea8('0x0'));var util=require(_0x6ea8('0x1'));var moment=require('moment');var BPromise=require(_0x6ea8('0x2'));var rs=require(_0x6ea8('0x3'));var fs=require('fs');var Redis=require(_0x6ea8('0x4'));var db=require(_0x6ea8('0x5'))['db'];var utils=require(_0x6ea8('0x6'));var logger=require(_0x6ea8('0x7'))(_0x6ea8('0x8'));var config=require(_0x6ea8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6ea8('0xa')][_0x6ea8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c0392,_0x5a6faf,_0x2451ad){return new BPromise(function(_0x364273,_0x24e9ef){return client[_0x6ea8('0xc')](_0x5c0392,_0x2451ad)['then'](function(_0x51c863){logger['info']('MemberReport,\x20%s,\x20%s',_0x5a6faf,_0x6ea8('0xd'));logger[_0x6ea8('0xe')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x5a6faf,'request\x20sent',JSON[_0x6ea8('0xf')](_0x51c863));if(_0x51c863['error']){if(_0x51c863[_0x6ea8('0x10')][_0x6ea8('0x11')]===0x1f4){logger[_0x6ea8('0x10')](_0x6ea8('0x12'),_0x5a6faf,_0x51c863[_0x6ea8('0x10')][_0x6ea8('0x13')]);return _0x24e9ef(_0x51c863[_0x6ea8('0x10')][_0x6ea8('0x13')]);}logger[_0x6ea8('0x10')](_0x6ea8('0x12'),_0x5a6faf,_0x51c863['error'][_0x6ea8('0x13')]);return _0x364273(_0x51c863[_0x6ea8('0x10')][_0x6ea8('0x13')]);}else{logger[_0x6ea8('0x14')](_0x6ea8('0x12'),_0x5a6faf,_0x6ea8('0xd'));_0x364273(_0x51c863['result']['message']);}})[_0x6ea8('0x15')](function(_0x42124b){logger['error'](_0x6ea8('0x12'),_0x5a6faf,_0x42124b);_0x24e9ef(_0x42124b);});});}exports['GetMemberReport']=function(_0x2e3e47){var _0x4168f1=this;return new Promise(function(_0x4b8449,_0x1baaf7){return db[_0x6ea8('0x16')][_0x6ea8('0x17')]({'raw':_0x2e3e47[_0x6ea8('0x18')]?_0x2e3e47[_0x6ea8('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2e3e47['options']?_0x2e3e47[_0x6ea8('0x18')][_0x6ea8('0x19')]||null:null,'attributes':_0x2e3e47['options']?_0x2e3e47[_0x6ea8('0x18')]['attributes']||null:null,'limit':_0x2e3e47[_0x6ea8('0x18')]?_0x2e3e47[_0x6ea8('0x18')][_0x6ea8('0x1a')]||null:null,'include':_0x2e3e47[_0x6ea8('0x18')]?_0x2e3e47[_0x6ea8('0x18')][_0x6ea8('0x1b')]?_[_0x6ea8('0x1c')](_0x2e3e47[_0x6ea8('0x18')]['include'],function(_0x2ebca3){return{'model':db[_0x2ebca3['model']],'as':_0x2ebca3['as'],'attributes':_0x2ebca3['attributes'],'include':_0x2ebca3[_0x6ea8('0x1b')]?_[_0x6ea8('0x1c')](_0x2ebca3[_0x6ea8('0x1b')],function(_0x16f02f){return{'model':db[_0x16f02f[_0x6ea8('0x1d')]],'as':_0x16f02f['as'],'attributes':_0x16f02f['attributes'],'include':_0x16f02f[_0x6ea8('0x1b')]?_[_0x6ea8('0x1c')](_0x16f02f[_0x6ea8('0x1b')],function(_0xa98a4b){return{'model':db[_0xa98a4b[_0x6ea8('0x1d')]],'as':_0xa98a4b['as'],'attributes':_0xa98a4b[_0x6ea8('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14b7cb){logger['info'](_0x6ea8('0x1f'),_0x2e3e47);logger[_0x6ea8('0xe')](_0x6ea8('0x1f'),_0x2e3e47,JSON[_0x6ea8('0xf')](_0x14b7cb));_0x4b8449(_0x14b7cb);})[_0x6ea8('0x15')](function(_0x5b7975){logger['error']('GetMemberReport',_0x5b7975['message'],_0x2e3e47);_0x1baaf7(_0x4168f1[_0x6ea8('0x10')](0x1f4,_0x5b7975[_0x6ea8('0x13')]));});});};exports[_0x6ea8('0x20')]=function(_0x5a27b4){var _0x3689f0=this;return new Promise(function(_0x1f1164,_0x48e332){return db['MemberReport'][_0x6ea8('0x21')](_0x5a27b4['body'],{'raw':_0x5a27b4[_0x6ea8('0x18')]?_0x5a27b4[_0x6ea8('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x23bce9){logger[_0x6ea8('0x14')](_0x6ea8('0x20'),_0x5a27b4);logger['debug'](_0x6ea8('0x20'),_0x5a27b4,JSON[_0x6ea8('0xf')](_0x23bce9));_0x1f1164(_0x23bce9);})[_0x6ea8('0x15')](function(_0x481fcc){logger[_0x6ea8('0x10')](_0x6ea8('0x20'),_0x481fcc['message'],_0x5a27b4);_0x48e332(_0x3689f0[_0x6ea8('0x10')](0x1f4,_0x481fcc[_0x6ea8('0x13')]));});});};exports[_0x6ea8('0x22')]=function(_0x2af248){var _0x4e4693=this;return new Promise(function(_0x228fbe,_0x525db9){return db[_0x6ea8('0x16')][_0x6ea8('0x23')](_0x2af248[_0x6ea8('0x24')],{'raw':_0x2af248['options']?_0x2af248[_0x6ea8('0x18')][_0x6ea8('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2af248[_0x6ea8('0x18')]?_0x2af248[_0x6ea8('0x18')][_0x6ea8('0x19')]||null:null,'attributes':_0x2af248[_0x6ea8('0x18')]?_0x2af248[_0x6ea8('0x18')][_0x6ea8('0x1e')]||null:null,'limit':_0x2af248['options']?_0x2af248[_0x6ea8('0x18')][_0x6ea8('0x1a')]||null:null})[_0x6ea8('0x26')](function(_0x369640){logger['info'](_0x6ea8('0x22'),_0x2af248);logger['debug'](_0x6ea8('0x22'),_0x2af248,JSON[_0x6ea8('0xf')](_0x369640));_0x228fbe(_0x369640);})[_0x6ea8('0x15')](function(_0x4e8bfb){logger[_0x6ea8('0x10')](_0x6ea8('0x22'),_0x4e8bfb[_0x6ea8('0x13')],_0x2af248);_0x525db9(_0x4e4693[_0x6ea8('0x10')](0x1f4,_0x4e8bfb[_0x6ea8('0x13')]));});});}; \ No newline at end of file +var _0x4ea4=['stringify','error','MemberReport,\x20%s,\x20%s','message','info','result','catch','GetMemberReport','options','raw','attributes','limit','map','include','model','debug','MemberReport','create','CreateMemberReport','update','body','where','UpdateMemberReport','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','request\x20sent'];(function(_0x13ce84,_0xc5cb0){var _0x2aea48=function(_0x437d34){while(--_0x437d34){_0x13ce84['push'](_0x13ce84['shift']());}};_0x2aea48(++_0xc5cb0);}(_0x4ea4,0x1a3));var _0x44ea=function(_0x3077cb,_0x3af841){_0x3077cb=_0x3077cb-0x0;var _0x417717=_0x4ea4[_0x3077cb];return _0x417717;};'use strict';var _=require('lodash');var util=require(_0x44ea('0x0'));var moment=require(_0x44ea('0x1'));var BPromise=require('bluebird');var rs=require(_0x44ea('0x2'));var fs=require('fs');var Redis=require(_0x44ea('0x3'));var db=require(_0x44ea('0x4'))['db'];var utils=require(_0x44ea('0x5'));var logger=require(_0x44ea('0x6'))(_0x44ea('0x7'));var config=require('../../config/environment');var jayson=require(_0x44ea('0x8'));var client=jayson[_0x44ea('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x114224,_0x31afd2,_0x2de18b){return new BPromise(function(_0x2128c8,_0x3858c0){return client[_0x44ea('0xa')](_0x114224,_0x2de18b)[_0x44ea('0xb')](function(_0x3c5520){logger['info']('MemberReport,\x20%s,\x20%s',_0x31afd2,'request\x20sent');logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x31afd2,_0x44ea('0xc'),JSON[_0x44ea('0xd')](_0x3c5520));if(_0x3c5520[_0x44ea('0xe')]){if(_0x3c5520[_0x44ea('0xe')]['code']===0x1f4){logger[_0x44ea('0xe')](_0x44ea('0xf'),_0x31afd2,_0x3c5520[_0x44ea('0xe')]['message']);return _0x3858c0(_0x3c5520['error'][_0x44ea('0x10')]);}logger[_0x44ea('0xe')]('MemberReport,\x20%s,\x20%s',_0x31afd2,_0x3c5520['error'][_0x44ea('0x10')]);return _0x2128c8(_0x3c5520[_0x44ea('0xe')]['message']);}else{logger[_0x44ea('0x11')]('MemberReport,\x20%s,\x20%s',_0x31afd2,_0x44ea('0xc'));_0x2128c8(_0x3c5520[_0x44ea('0x12')][_0x44ea('0x10')]);}})[_0x44ea('0x13')](function(_0x57de48){logger[_0x44ea('0xe')](_0x44ea('0xf'),_0x31afd2,_0x57de48);_0x3858c0(_0x57de48);});});}exports[_0x44ea('0x14')]=function(_0x519466){var _0x4bb659=this;return new Promise(function(_0x167d17,_0x1c142a){return db['MemberReport']['findAll']({'raw':_0x519466[_0x44ea('0x15')]?_0x519466['options'][_0x44ea('0x16')]===undefined?!![]:![]:!![],'where':_0x519466['options']?_0x519466[_0x44ea('0x15')]['where']||null:null,'attributes':_0x519466[_0x44ea('0x15')]?_0x519466[_0x44ea('0x15')][_0x44ea('0x17')]||null:null,'limit':_0x519466[_0x44ea('0x15')]?_0x519466[_0x44ea('0x15')][_0x44ea('0x18')]||null:null,'include':_0x519466[_0x44ea('0x15')]?_0x519466['options']['include']?_[_0x44ea('0x19')](_0x519466[_0x44ea('0x15')][_0x44ea('0x1a')],function(_0x486fbf){return{'model':db[_0x486fbf[_0x44ea('0x1b')]],'as':_0x486fbf['as'],'attributes':_0x486fbf[_0x44ea('0x17')],'include':_0x486fbf[_0x44ea('0x1a')]?_['map'](_0x486fbf[_0x44ea('0x1a')],function(_0x46d8c3){return{'model':db[_0x46d8c3['model']],'as':_0x46d8c3['as'],'attributes':_0x46d8c3[_0x44ea('0x17')],'include':_0x46d8c3['include']?_[_0x44ea('0x19')](_0x46d8c3[_0x44ea('0x1a')],function(_0x1949df){return{'model':db[_0x1949df[_0x44ea('0x1b')]],'as':_0x1949df['as'],'attributes':_0x1949df[_0x44ea('0x17')]};}):[]};}):[]};}):[]:[]})[_0x44ea('0xb')](function(_0x84e0fe){logger[_0x44ea('0x11')]('GetMemberReport',_0x519466);logger[_0x44ea('0x1c')]('GetMemberReport',_0x519466,JSON['stringify'](_0x84e0fe));_0x167d17(_0x84e0fe);})[_0x44ea('0x13')](function(_0x285477){logger[_0x44ea('0xe')](_0x44ea('0x14'),_0x285477[_0x44ea('0x10')],_0x519466);_0x1c142a(_0x4bb659[_0x44ea('0xe')](0x1f4,_0x285477[_0x44ea('0x10')]));});});};exports['CreateMemberReport']=function(_0x3358fa){var _0x253e2b=this;return new Promise(function(_0x45b8c9,_0x5d7aa7){return db[_0x44ea('0x1d')][_0x44ea('0x1e')](_0x3358fa['body'],{'raw':_0x3358fa[_0x44ea('0x15')]?_0x3358fa[_0x44ea('0x15')][_0x44ea('0x16')]===undefined?!![]:![]:!![]})[_0x44ea('0xb')](function(_0x12a26f){logger['info']('CreateMemberReport',_0x3358fa);logger[_0x44ea('0x1c')](_0x44ea('0x1f'),_0x3358fa,JSON[_0x44ea('0xd')](_0x12a26f));_0x45b8c9(_0x12a26f);})[_0x44ea('0x13')](function(_0x201f28){logger[_0x44ea('0xe')](_0x44ea('0x1f'),_0x201f28[_0x44ea('0x10')],_0x3358fa);_0x5d7aa7(_0x253e2b['error'](0x1f4,_0x201f28[_0x44ea('0x10')]));});});};exports['UpdateMemberReport']=function(_0x3d9435){var _0xe5d9ef=this;return new Promise(function(_0x48ce15,_0x35a928){return db[_0x44ea('0x1d')][_0x44ea('0x20')](_0x3d9435[_0x44ea('0x21')],{'raw':_0x3d9435[_0x44ea('0x15')]?_0x3d9435[_0x44ea('0x15')][_0x44ea('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d9435[_0x44ea('0x15')]?_0x3d9435['options'][_0x44ea('0x22')]||null:null,'attributes':_0x3d9435[_0x44ea('0x15')]?_0x3d9435[_0x44ea('0x15')][_0x44ea('0x17')]||null:null,'limit':_0x3d9435['options']?_0x3d9435['options'][_0x44ea('0x18')]||null:null})[_0x44ea('0xb')](function(_0x32cac7){logger[_0x44ea('0x11')](_0x44ea('0x23'),_0x3d9435);logger[_0x44ea('0x1c')](_0x44ea('0x23'),_0x3d9435,JSON[_0x44ea('0xd')](_0x32cac7));_0x48ce15(_0x32cac7);})['catch'](function(_0x49a032){logger['error'](_0x44ea('0x23'),_0x49a032[_0x44ea('0x10')],_0x3d9435);_0x35a928(_0xe5d9ef[_0x44ea('0xe')](0x1f4,_0x49a032['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 1ad0aab..33506d8 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 _0xe5b3=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','exports','util','path','connect-timeout','express','Router'];(function(_0x21ed83,_0x5b0e9c){var _0x3ea9df=function(_0x6712fc){while(--_0x6712fc){_0x21ed83['push'](_0x21ed83['shift']());}};_0x3ea9df(++_0x5b0e9c);}(_0xe5b3,0x133));var _0x3e5b=function(_0x33c935,_0x5aaf49){_0x33c935=_0x33c935-0x0;var _0x49c201=_0xe5b3[_0x33c935];return _0x49c201;};'use strict';var multer=require('multer');var util=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var timeout=require(_0x3e5b('0x2'));var express=require(_0x3e5b('0x3'));var router=express[_0x3e5b('0x4')]();var fs_extra=require(_0x3e5b('0x5'));var auth=require(_0x3e5b('0x6'));var interaction=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var controller=require(_0x3e5b('0x9'));router[_0x3e5b('0xa')]('/',controller['index']);module[_0x3e5b('0xb')]=router; \ No newline at end of file +var _0xcd59=['../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5ad794,_0x330eb1){var _0x58d45e=function(_0x28c899){while(--_0x28c899){_0x5ad794['push'](_0x5ad794['shift']());}};_0x58d45e(++_0x330eb1);}(_0xcd59,0x14b));var _0x9cd5=function(_0x4a8812,_0x430080){_0x4a8812=_0x4a8812-0x0;var _0x55a784=_0xcd59[_0x4a8812];return _0x55a784;};'use strict';var multer=require(_0x9cd5('0x0'));var util=require(_0x9cd5('0x1'));var path=require(_0x9cd5('0x2'));var timeout=require(_0x9cd5('0x3'));var express=require(_0x9cd5('0x4'));var router=express[_0x9cd5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9cd5('0x6'));var interaction=require(_0x9cd5('0x7'));var config=require(_0x9cd5('0x8'));var controller=require(_0x9cd5('0x9'));router[_0x9cd5('0xa')]('/',controller[_0x9cd5('0xb')]);module[_0x9cd5('0xc')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index e81bcc2..5199fce 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 _0x7e6d=['sequelize','STRING','version'];(function(_0xc9ce73,_0x551b77){var _0x28890c=function(_0x2866c8){while(--_0x2866c8){_0xc9ce73['push'](_0xc9ce73['shift']());}};_0x28890c(++_0x551b77);}(_0x7e6d,0xc9));var _0xd7e6=function(_0x485567,_0x1c609c){_0x485567=_0x485567-0x0;var _0x3421fe=_0x7e6d[_0x485567];return _0x3421fe;};'use strict';var Sequelize=require(_0xd7e6('0x0'));module['exports']={'version':{'type':Sequelize[_0xd7e6('0x1')],'unique':_0xd7e6('0x2')}}; \ No newline at end of file +var _0xfcf3=['sequelize','version'];(function(_0x296e27,_0x50b464){var _0x360dc2=function(_0x50e9b4){while(--_0x50e9b4){_0x296e27['push'](_0x296e27['shift']());}};_0x360dc2(++_0x50b464);}(_0xfcf3,0x110));var _0x3fcf=function(_0x38eb23,_0x196e8b){_0x38eb23=_0x38eb23-0x0;var _0x48506a=_0xfcf3[_0x38eb23];return _0x48506a;};'use strict';var Sequelize=require(_0x3fcf('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':_0x3fcf('0x1')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 77bc4a2..37d5958 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 _0xc8e9=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','then','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','type'];(function(_0x2e8154,_0x2396da){var _0x4d489b=function(_0x386966){while(--_0x386966){_0x2e8154['push'](_0x2e8154['shift']());}};_0x4d489b(++_0x2396da);}(_0xc8e9,0xe1));var _0x9c8e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc8e9[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x9c8e('0x0'));var emlformat=require(_0x9c8e('0x1'));var rimraf=require(_0x9c8e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9c8e('0x3'));var rp=require(_0x9c8e('0x4'));var moment=require(_0x9c8e('0x5'));var BPromise=require(_0x9c8e('0x6'));var Mustache=require(_0x9c8e('0x7'));var util=require('util');var path=require(_0x9c8e('0x8'));var sox=require(_0x9c8e('0x9'));var csv=require(_0x9c8e('0xa'));var ejs=require(_0x9c8e('0xb'));var fs=require('fs');var fs_extra=require(_0x9c8e('0xc'));var _=require(_0x9c8e('0xd'));var squel=require('squel');var crypto=require(_0x9c8e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9c8e('0xf'));var toCsv=require(_0x9c8e('0xa'));var querystring=require(_0x9c8e('0x10'));var Papa=require('papaparse');var Redis=require(_0x9c8e('0x11'));var authService=require(_0x9c8e('0x12'));var qs=require(_0x9c8e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c8e('0x14'));var logger=require(_0x9c8e('0x15'))('api');var utils=require(_0x9c8e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9c8e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f0149,_0x660cd8){_0x660cd8=_0x660cd8||0xcc;return function(_0xde8a59){if(_0xde8a59){return _0x2f0149[_0x9c8e('0x18')](_0x660cd8);}return _0x2f0149['status'](_0x660cd8)[_0x9c8e('0x19')]();};}function respondWithResult(_0xd0f37b,_0x5b7fcc){_0x5b7fcc=_0x5b7fcc||0xc8;return function(_0x39f796){if(_0x39f796){return _0xd0f37b[_0x9c8e('0x1a')](_0x5b7fcc)['json'](_0x39f796);}};}function respondWithFilteredResult(_0x3de205,_0x431316){return function(_0x567cea){if(_0x567cea){var _0x228127=_0x567cea[_0x9c8e('0x1b')],_0x22e9eb=_0x431316[_0x9c8e('0x1c')],_0x175e73=_0x431316[_0x9c8e('0x1c')]+_0x431316[_0x9c8e('0x1d')],_0x1d9ce9;if(_0x175e73>=_0x228127){_0x175e73=_0x228127;_0x1d9ce9=0xc8;}else{_0x1d9ce9=0xce;}_0x3de205[_0x9c8e('0x1a')](_0x1d9ce9);return _0x3de205[_0x9c8e('0x1e')](_0x9c8e('0x1f'),_0x22e9eb+'-'+_0x175e73+'/'+_0x228127)[_0x9c8e('0x20')](_0x567cea);}return null;};}function patchUpdates(_0xa359d4){return function(_0xaa3135){try{jsonpatch[_0x9c8e('0x21')](_0xaa3135,_0xa359d4,!![]);}catch(_0x15ea8b){return BPromise[_0x9c8e('0x22')](_0x15ea8b);}return _0xaa3135[_0x9c8e('0x23')]();};}function saveUpdates(_0x91bbf6,_0x4f7d3b){return function(_0x366131){if(_0x366131){return _0x366131['update'](_0x91bbf6)[_0x9c8e('0x24')](function(_0x8a6fbb){return _0x8a6fbb;});}return null;};}function removeEntity(_0x2d9840,_0xdc6904){return function(_0x32790b){if(_0x32790b){return _0x32790b['destroy']()[_0x9c8e('0x24')](function(){_0x2d9840[_0x9c8e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47c5c5,_0x2fdf5a){return function(_0x3eb59d){if(!_0x3eb59d){_0x47c5c5[_0x9c8e('0x18')](0x194);}return _0x3eb59d;};}function handleError(_0x405662,_0x16db35){_0x16db35=_0x16db35||0x1f4;return function(_0x2f446b){logger[_0x9c8e('0x25')](_0x2f446b[_0x9c8e('0x26')]);if(_0x2f446b['name']){delete _0x2f446b[_0x9c8e('0x27')];}_0x405662[_0x9c8e('0x1a')](_0x16db35)[_0x9c8e('0x28')](_0x2f446b);};}exports[_0x9c8e('0x29')]=function(_0x587fc5,_0x1d975c){var _0x535c34={},_0x5ef4ee={},_0x499d72={'count':0x0,'rows':[]};var _0x103923=_[_0x9c8e('0x2a')](db[_0x9c8e('0x2b')][_0x9c8e('0x2c')],function(_0x4c37b2){return{'name':_0x4c37b2[_0x9c8e('0x2d')],'type':_0x4c37b2[_0x9c8e('0x2e')][_0x9c8e('0x2f')]};});_0x5ef4ee[_0x9c8e('0x30')]=_[_0x9c8e('0x2a')](_0x103923,_0x9c8e('0x27'));_0x5ef4ee[_0x9c8e('0x31')]=_[_0x9c8e('0x32')](_0x587fc5[_0x9c8e('0x31')]);_0x5ef4ee[_0x9c8e('0x33')]=_[_0x9c8e('0x34')](_0x5ef4ee[_0x9c8e('0x30')],_0x5ef4ee[_0x9c8e('0x31')]);_0x535c34[_0x9c8e('0x35')]=_[_0x9c8e('0x34')](_0x5ef4ee[_0x9c8e('0x30')],qs[_0x9c8e('0x36')](_0x587fc5[_0x9c8e('0x31')][_0x9c8e('0x36')]));_0x535c34[_0x9c8e('0x35')]=_0x535c34['attributes'][_0x9c8e('0x37')]?_0x535c34['attributes']:_0x5ef4ee['model'];if(!_0x587fc5[_0x9c8e('0x31')][_0x9c8e('0x38')](_0x9c8e('0x39'))){_0x535c34[_0x9c8e('0x1d')]=qs[_0x9c8e('0x1d')](_0x587fc5[_0x9c8e('0x31')][_0x9c8e('0x1d')]);_0x535c34[_0x9c8e('0x1c')]=qs[_0x9c8e('0x1c')](_0x587fc5['query']['offset']);}_0x535c34['order']=qs['sort'](_0x587fc5[_0x9c8e('0x31')][_0x9c8e('0x3a')]);_0x535c34[_0x9c8e('0x3b')]=qs['filters'](_[_0x9c8e('0x3c')](_0x587fc5['query'],_0x5ef4ee[_0x9c8e('0x33')]),_0x103923);if(_0x587fc5[_0x9c8e('0x31')][_0x9c8e('0x3d')]){_0x535c34[_0x9c8e('0x3b')]=_['merge'](_0x535c34[_0x9c8e('0x3b')],{'$or':_[_0x9c8e('0x2a')](_0x103923,function(_0x35577d){if(_0x35577d['type']!==_0x9c8e('0x3e')){var _0x1378b6={};_0x1378b6[_0x35577d[_0x9c8e('0x27')]]={'$like':'%'+_0x587fc5[_0x9c8e('0x31')]['filter']+'%'};return _0x1378b6;}})});}_0x535c34=_['merge']({},_0x535c34,_0x587fc5[_0x9c8e('0x3f')]);var _0x123d0d={'where':_0x535c34['where']};return db[_0x9c8e('0x2b')][_0x9c8e('0x1b')](_0x123d0d)[_0x9c8e('0x24')](function(_0x17595e){_0x499d72[_0x9c8e('0x1b')]=_0x17595e;if(_0x587fc5['query'][_0x9c8e('0x40')]){_0x535c34[_0x9c8e('0x41')]=[{'all':!![]}];}return db[_0x9c8e('0x2b')][_0x9c8e('0x42')](_0x535c34);})[_0x9c8e('0x24')](function(_0xe4e010){_0x499d72['rows']=_0xe4e010;return _0x499d72;})[_0x9c8e('0x24')](respondWithFilteredResult(_0x1d975c,_0x535c34))[_0x9c8e('0x43')](handleError(_0x1d975c,null));}; \ No newline at end of file +var _0x7b84=['filter','merge','options','includeAll','include','findAll','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','Migration','fieldName','type','model','keys','query','intersection','fields','attributes','hasOwnProperty','order','where','filters','pick'];(function(_0x58999b,_0xea4695){var _0x5efc3a=function(_0x98de31){while(--_0x98de31){_0x58999b['push'](_0x58999b['shift']());}};_0x5efc3a(++_0xea4695);}(_0x7b84,0xc7));var _0x47b8=function(_0x37fee7,_0x347789){_0x37fee7=_0x37fee7-0x0;var _0x41f7ca=_0x7b84[_0x37fee7];return _0x41f7ca;};'use strict';var pdf=require(_0x47b8('0x0'));var emlformat=require(_0x47b8('0x1'));var rimraf=require(_0x47b8('0x2'));var zipdir=require(_0x47b8('0x3'));var jsonpatch=require(_0x47b8('0x4'));var rp=require(_0x47b8('0x5'));var moment=require(_0x47b8('0x6'));var BPromise=require(_0x47b8('0x7'));var Mustache=require(_0x47b8('0x8'));var util=require('util');var path=require(_0x47b8('0x9'));var sox=require('sox');var csv=require(_0x47b8('0xa'));var ejs=require(_0x47b8('0xb'));var fs=require('fs');var fs_extra=require(_0x47b8('0xc'));var _=require('lodash');var squel=require(_0x47b8('0xd'));var crypto=require(_0x47b8('0xe'));var jsforce=require(_0x47b8('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x47b8('0xa'));var querystring=require(_0x47b8('0x10'));var Papa=require(_0x47b8('0x11'));var Redis=require(_0x47b8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x47b8('0x13'));var as=require(_0x47b8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47b8('0x15'));var utils=require(_0x47b8('0x16'));var config=require(_0x47b8('0x17'));var licenseUtil=require(_0x47b8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3984b6,_0x5dbe12){_0x5dbe12=_0x5dbe12||0xcc;return function(_0x291a46){if(_0x291a46){return _0x3984b6[_0x47b8('0x19')](_0x5dbe12);}return _0x3984b6[_0x47b8('0x1a')](_0x5dbe12)[_0x47b8('0x1b')]();};}function respondWithResult(_0xa48378,_0xc9bf08){_0xc9bf08=_0xc9bf08||0xc8;return function(_0x4f0d0f){if(_0x4f0d0f){return _0xa48378['status'](_0xc9bf08)[_0x47b8('0x1c')](_0x4f0d0f);}};}function respondWithFilteredResult(_0x1b4aa7,_0x482c7b){return function(_0x1b0ee3){if(_0x1b0ee3){var _0x14da23=_0x1b0ee3[_0x47b8('0x1d')],_0x4eb0b7=_0x482c7b['offset'],_0x32f4d8=_0x482c7b[_0x47b8('0x1e')]+_0x482c7b[_0x47b8('0x1f')],_0x518bcf;if(_0x32f4d8>=_0x14da23){_0x32f4d8=_0x14da23;_0x518bcf=0xc8;}else{_0x518bcf=0xce;}_0x1b4aa7[_0x47b8('0x1a')](_0x518bcf);return _0x1b4aa7['set'](_0x47b8('0x20'),_0x4eb0b7+'-'+_0x32f4d8+'/'+_0x14da23)[_0x47b8('0x1c')](_0x1b0ee3);}return null;};}function patchUpdates(_0x212bf2){return function(_0x2a7ebc){try{jsonpatch[_0x47b8('0x21')](_0x2a7ebc,_0x212bf2,!![]);}catch(_0x418c08){return BPromise[_0x47b8('0x22')](_0x418c08);}return _0x2a7ebc['save']();};}function saveUpdates(_0x1154ce,_0x47e8ad){return function(_0x323e78){if(_0x323e78){return _0x323e78[_0x47b8('0x23')](_0x1154ce)[_0x47b8('0x24')](function(_0x2c60de){return _0x2c60de;});}return null;};}function removeEntity(_0x3349b1,_0x4f0fc6){return function(_0x3918d8){if(_0x3918d8){return _0x3918d8[_0x47b8('0x25')]()[_0x47b8('0x24')](function(){_0x3349b1[_0x47b8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48af03,_0x276785){return function(_0xa63c25){if(!_0xa63c25){_0x48af03[_0x47b8('0x19')](0x194);}return _0xa63c25;};}function handleError(_0x8b728a,_0x32021f){_0x32021f=_0x32021f||0x1f4;return function(_0x56e2c5){logger[_0x47b8('0x26')](_0x56e2c5[_0x47b8('0x27')]);if(_0x56e2c5['name']){delete _0x56e2c5[_0x47b8('0x28')];}_0x8b728a['status'](_0x32021f)[_0x47b8('0x29')](_0x56e2c5);};}exports['index']=function(_0x6d1d5e,_0x29c84a){var _0x33e4da={},_0x5e81fb={},_0x2d9c2b={'count':0x0,'rows':[]};var _0x375f8d=_[_0x47b8('0x2a')](db[_0x47b8('0x2b')]['rawAttributes'],function(_0x566045){return{'name':_0x566045[_0x47b8('0x2c')],'type':_0x566045[_0x47b8('0x2d')]['key']};});_0x5e81fb[_0x47b8('0x2e')]=_[_0x47b8('0x2a')](_0x375f8d,'name');_0x5e81fb['query']=_[_0x47b8('0x2f')](_0x6d1d5e[_0x47b8('0x30')]);_0x5e81fb['filters']=_[_0x47b8('0x31')](_0x5e81fb[_0x47b8('0x2e')],_0x5e81fb[_0x47b8('0x30')]);_0x33e4da['attributes']=_[_0x47b8('0x31')](_0x5e81fb[_0x47b8('0x2e')],qs['fields'](_0x6d1d5e['query'][_0x47b8('0x32')]));_0x33e4da[_0x47b8('0x33')]=_0x33e4da[_0x47b8('0x33')]['length']?_0x33e4da[_0x47b8('0x33')]:_0x5e81fb[_0x47b8('0x2e')];if(!_0x6d1d5e[_0x47b8('0x30')][_0x47b8('0x34')]('nolimit')){_0x33e4da['limit']=qs['limit'](_0x6d1d5e[_0x47b8('0x30')][_0x47b8('0x1f')]);_0x33e4da[_0x47b8('0x1e')]=qs[_0x47b8('0x1e')](_0x6d1d5e['query'][_0x47b8('0x1e')]);}_0x33e4da[_0x47b8('0x35')]=qs['sort'](_0x6d1d5e[_0x47b8('0x30')]['sort']);_0x33e4da[_0x47b8('0x36')]=qs[_0x47b8('0x37')](_[_0x47b8('0x38')](_0x6d1d5e['query'],_0x5e81fb[_0x47b8('0x37')]),_0x375f8d);if(_0x6d1d5e[_0x47b8('0x30')][_0x47b8('0x39')]){_0x33e4da[_0x47b8('0x36')]=_[_0x47b8('0x3a')](_0x33e4da[_0x47b8('0x36')],{'$or':_['map'](_0x375f8d,function(_0x268ac0){if(_0x268ac0['type']!=='VIRTUAL'){var _0x26934c={};_0x26934c[_0x268ac0['name']]={'$like':'%'+_0x6d1d5e[_0x47b8('0x30')][_0x47b8('0x39')]+'%'};return _0x26934c;}})});}_0x33e4da=_[_0x47b8('0x3a')]({},_0x33e4da,_0x6d1d5e[_0x47b8('0x3b')]);var _0x417062={'where':_0x33e4da['where']};return db[_0x47b8('0x2b')]['count'](_0x417062)[_0x47b8('0x24')](function(_0x269bd0){_0x2d9c2b[_0x47b8('0x1d')]=_0x269bd0;if(_0x6d1d5e[_0x47b8('0x30')][_0x47b8('0x3c')]){_0x33e4da[_0x47b8('0x3d')]=[{'all':!![]}];}return db[_0x47b8('0x2b')][_0x47b8('0x3e')](_0x33e4da);})[_0x47b8('0x24')](function(_0x4cc6e4){_0x2d9c2b['rows']=_0x4cc6e4;return _0x2d9c2b;})['then'](respondWithFilteredResult(_0x29c84a,_0x33e4da))[_0x47b8('0x3f')](handleError(_0x29c84a,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index fea3f90..6072140 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 _0x58e7=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','define','Migration','lodash'];(function(_0x12d951,_0x249808){var _0x44de17=function(_0x182fd9){while(--_0x182fd9){_0x12d951['push'](_0x12d951['shift']());}};_0x44de17(++_0x249808);}(_0x58e7,0x15b));var _0x758e=function(_0x257123,_0x123cb8){_0x257123=_0x257123-0x0;var _0x4003d6=_0x58e7[_0x257123];return _0x4003d6;};'use strict';var _=require(_0x758e('0x0'));var util=require(_0x758e('0x1'));var logger=require(_0x758e('0x2'))(_0x758e('0x3'));var moment=require('moment');var BPromise=require(_0x758e('0x4'));var rp=require(_0x758e('0x5'));var fs=require('fs');var path=require(_0x758e('0x6'));var rimraf=require(_0x758e('0x7'));var config=require(_0x758e('0x8'));var attributes=require(_0x758e('0x9'));module['exports']=function(_0x38fe72,_0x3ebf42){return _0x38fe72[_0x758e('0xa')](_0x758e('0xb'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab75=['define','Migration','migrations','lodash','util','api','bluebird','request-promise','path','rimraf','./migration.attributes','exports'];(function(_0xbcc6e1,_0x4c42f6){var _0x4985f9=function(_0x2f96ec){while(--_0x2f96ec){_0xbcc6e1['push'](_0xbcc6e1['shift']());}};_0x4985f9(++_0x4c42f6);}(_0xab75,0x10b));var _0x5ab7=function(_0x394431,_0x4d6074){_0x394431=_0x394431-0x0;var _0x560883=_0xab75[_0x394431];return _0x560883;};'use strict';var _=require(_0x5ab7('0x0'));var util=require(_0x5ab7('0x1'));var logger=require('../../config/logger')(_0x5ab7('0x2'));var moment=require('moment');var BPromise=require(_0x5ab7('0x3'));var rp=require(_0x5ab7('0x4'));var fs=require('fs');var path=require(_0x5ab7('0x5'));var rimraf=require(_0x5ab7('0x6'));var config=require('../../config/environment');var attributes=require(_0x5ab7('0x7'));module[_0x5ab7('0x8')]=function(_0x9ed08e,_0x3cb7f3){return _0x9ed08e[_0x5ab7('0x9')](_0x5ab7('0xa'),attributes,{'tableName':_0x5ab7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index b2542f8..71e994b 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 _0xbc1d=['moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util'];(function(_0x59684d,_0x17c2f8){var _0x31ae8d=function(_0x48fc6e){while(--_0x48fc6e){_0x59684d['push'](_0x59684d['shift']());}};_0x31ae8d(++_0x17c2f8);}(_0xbc1d,0x12a));var _0xdbc1=function(_0x4bc428,_0xf56dd9){_0x4bc428=_0x4bc428-0x0;var _0x3ca37f=_0xbc1d[_0x4bc428];return _0x3ca37f;};'use strict';var _=require(_0xdbc1('0x0'));var util=require(_0xdbc1('0x1'));var moment=require(_0xdbc1('0x2'));var BPromise=require('bluebird');var rs=require(_0xdbc1('0x3'));var fs=require('fs');var Redis=require(_0xdbc1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdbc1('0x5'));var logger=require(_0xdbc1('0x6'))('rpc');var config=require(_0xdbc1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdbc1('0x8')][_0xdbc1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28b00c,_0x18fccf,_0x1606b0){return new BPromise(function(_0x43ef54,_0x37cd8e){return client[_0xdbc1('0xa')](_0x28b00c,_0x1606b0)[_0xdbc1('0xb')](function(_0x559a39){logger[_0xdbc1('0xc')](_0xdbc1('0xd'),_0x18fccf,_0xdbc1('0xe'));logger[_0xdbc1('0xf')]('Migration,\x20%s,\x20%s,\x20%s',_0x18fccf,'request\x20sent',JSON[_0xdbc1('0x10')](_0x559a39));if(_0x559a39[_0xdbc1('0x11')]){if(_0x559a39[_0xdbc1('0x11')]['code']===0x1f4){logger['error'](_0xdbc1('0xd'),_0x18fccf,_0x559a39[_0xdbc1('0x11')][_0xdbc1('0x12')]);return _0x37cd8e(_0x559a39[_0xdbc1('0x11')]['message']);}logger['error'](_0xdbc1('0xd'),_0x18fccf,_0x559a39[_0xdbc1('0x11')]['message']);return _0x43ef54(_0x559a39[_0xdbc1('0x11')]['message']);}else{logger[_0xdbc1('0xc')]('Migration,\x20%s,\x20%s',_0x18fccf,'request\x20sent');_0x43ef54(_0x559a39['result'][_0xdbc1('0x12')]);}})[_0xdbc1('0x13')](function(_0x2290a0){logger['error'](_0xdbc1('0xd'),_0x18fccf,_0x2290a0);_0x37cd8e(_0x2290a0);});});} \ No newline at end of file +var _0xeeaf=['Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Migration,\x20%s,\x20%s','request\x20sent'];(function(_0x55e720,_0x1a85c2){var _0x1a250a=function(_0x284aa4){while(--_0x284aa4){_0x55e720['push'](_0x55e720['shift']());}};_0x1a250a(++_0x1a85c2);}(_0xeeaf,0x150));var _0xfeea=function(_0xed1c3a,_0x2b30e5){_0xed1c3a=_0xed1c3a-0x0;var _0x21f91c=_0xeeaf[_0xed1c3a];return _0x21f91c;};'use strict';var _=require(_0xfeea('0x0'));var util=require('util');var moment=require(_0xfeea('0x1'));var BPromise=require(_0xfeea('0x2'));var rs=require(_0xfeea('0x3'));var fs=require('fs');var Redis=require(_0xfeea('0x4'));var db=require(_0xfeea('0x5'))['db'];var utils=require(_0xfeea('0x6'));var logger=require(_0xfeea('0x7'))(_0xfeea('0x8'));var config=require(_0xfeea('0x9'));var jayson=require(_0xfeea('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2a18a8,_0x421507,_0x430d0e){return new BPromise(function(_0x325cf4,_0x313779){return client[_0xfeea('0xb')](_0x2a18a8,_0x430d0e)[_0xfeea('0xc')](function(_0x5aa010){logger[_0xfeea('0xd')](_0xfeea('0xe'),_0x421507,_0xfeea('0xf'));logger['debug'](_0xfeea('0x10'),_0x421507,'request\x20sent',JSON[_0xfeea('0x11')](_0x5aa010));if(_0x5aa010[_0xfeea('0x12')]){if(_0x5aa010[_0xfeea('0x12')][_0xfeea('0x13')]===0x1f4){logger['error'](_0xfeea('0xe'),_0x421507,_0x5aa010['error']['message']);return _0x313779(_0x5aa010[_0xfeea('0x12')][_0xfeea('0x14')]);}logger[_0xfeea('0x12')](_0xfeea('0xe'),_0x421507,_0x5aa010[_0xfeea('0x12')][_0xfeea('0x14')]);return _0x325cf4(_0x5aa010[_0xfeea('0x12')][_0xfeea('0x14')]);}else{logger[_0xfeea('0xd')](_0xfeea('0xe'),_0x421507,'request\x20sent');_0x325cf4(_0x5aa010['result'][_0xfeea('0x14')]);}})[_0xfeea('0x15')](function(_0x657ce8){logger[_0xfeea('0x12')](_0xfeea('0xe'),_0x421507,_0x657ce8);_0x313779(_0x657ce8);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 0272dd1..fe07fa7 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 _0x2229=['put','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./network.controller','get','isAuthenticated','index','/:id','show','create'];(function(_0x58d5ac,_0x11c4bc){var _0x37985c=function(_0x419671){while(--_0x419671){_0x58d5ac['push'](_0x58d5ac['shift']());}};_0x37985c(++_0x11c4bc);}(_0x2229,0x162));var _0x9222=function(_0x57862e,_0x2c787f){_0x57862e=_0x57862e-0x0;var _0x1f44ba=_0x2229[_0x57862e];return _0x1f44ba;};'use strict';var multer=require(_0x9222('0x0'));var util=require(_0x9222('0x1'));var path=require(_0x9222('0x2'));var timeout=require(_0x9222('0x3'));var express=require('express');var router=express[_0x9222('0x4')]();var fs_extra=require(_0x9222('0x5'));var auth=require(_0x9222('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9222('0x7'));router[_0x9222('0x8')]('/',auth[_0x9222('0x9')](),controller[_0x9222('0xa')]);router[_0x9222('0x8')](_0x9222('0xb'),auth[_0x9222('0x9')](),controller[_0x9222('0xc')]);router['post']('/',auth[_0x9222('0x9')](),controller[_0x9222('0xd')]);router[_0x9222('0xe')](_0x9222('0xb'),auth[_0x9222('0x9')](),controller['update']);router['delete'](_0x9222('0xb'),auth[_0x9222('0x9')](),controller[_0x9222('0xf')]);module['exports']=router; \ No newline at end of file +var _0x72ca=['show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated'];(function(_0x46563f,_0x180dea){var _0x176593=function(_0xc76561){while(--_0xc76561){_0x46563f['push'](_0x46563f['shift']());}};_0x176593(++_0x180dea);}(_0x72ca,0x135));var _0xa72c=function(_0x40c99e,_0x35411d){_0x40c99e=_0x40c99e-0x0;var _0x11b1db=_0x72ca[_0x40c99e];return _0x11b1db;};'use strict';var multer=require(_0xa72c('0x0'));var util=require(_0xa72c('0x1'));var path=require(_0xa72c('0x2'));var timeout=require(_0xa72c('0x3'));var express=require(_0xa72c('0x4'));var router=express[_0xa72c('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa72c('0x6'));var config=require(_0xa72c('0x7'));var controller=require(_0xa72c('0x8'));router[_0xa72c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa72c('0x9')]('/:id',auth[_0xa72c('0xa')](),controller[_0xa72c('0xb')]);router[_0xa72c('0xc')]('/',auth[_0xa72c('0xa')](),controller[_0xa72c('0xd')]);router[_0xa72c('0xe')](_0xa72c('0xf'),auth[_0xa72c('0xa')](),controller[_0xa72c('0x10')]);router[_0xa72c('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa72c('0x12')]);module[_0xa72c('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 18538b1..394b4a0 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 _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x2e0fc3,_0x38484f){var _0x3f125a=function(_0x283c48){while(--_0x283c48){_0x2e0fc3['push'](_0x2e0fc3['shift']());}};_0x3f125a(++_0x38484f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x3c6382,_0x305e94){var _0x55a35e=function(_0x51b73c){while(--_0x51b73c){_0x3c6382['push'](_0x3c6382['shift']());}};_0x55a35e(++_0x305e94);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 87a9dcc..f85906d 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 _0x7d6e=['rows','params','find','create','sequelize','transaction','body','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','STUN','utf8','toLowerCase','destroy','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Network','includeAll','include','findAll'];(function(_0x476115,_0x3c569b){var _0xc08523=function(_0x465c17){while(--_0x465c17){_0x476115['push'](_0x476115['shift']());}};_0xc08523(++_0x3c569b);}(_0x7d6e,0x157));var _0xe7d6=function(_0x438434,_0x36f21f){_0x438434=_0x438434-0x0;var _0x3b97c9=_0x7d6e[_0x438434];return _0x3b97c9;};'use strict';var pdf=require(_0xe7d6('0x0'));var emlformat=require(_0xe7d6('0x1'));var rimraf=require(_0xe7d6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe7d6('0x3'));var rp=require('request-promise');var moment=require(_0xe7d6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe7d6('0x5'));var util=require(_0xe7d6('0x6'));var path=require('path');var sox=require(_0xe7d6('0x7'));var csv=require(_0xe7d6('0x8'));var ejs=require(_0xe7d6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe7d6('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe7d6('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe7d6('0x8'));var querystring=require(_0xe7d6('0xc'));var Papa=require('papaparse');var Redis=require(_0xe7d6('0xd'));var authService=require(_0xe7d6('0xe'));var qs=require(_0xe7d6('0xf'));var as=require(_0xe7d6('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe7d6('0x11'));var utils=require(_0xe7d6('0x12'));var config=require(_0xe7d6('0x13'));var licenseUtil=require(_0xe7d6('0x14'));var db=require(_0xe7d6('0x15'))['db'];var jayson=require(_0xe7d6('0x16'));var client=jayson['client'][_0xe7d6('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x42dadb,_0x14a046,_0x328956,_0x3060ba){return new BPromise(function(_0x2f1c47,_0x574861){var _0x5d15cf=_0x3060ba||client;return _0x5d15cf[_0xe7d6('0x18')](_0x42dadb,_0x328956)['then'](function(_0x19e63e){logger[_0xe7d6('0x19')](_0xe7d6('0x1a'),_0x14a046,_0xe7d6('0x1b'));logger[_0xe7d6('0x1c')]('Network,\x20%s,\x20%s,\x20%s',_0x14a046,_0xe7d6('0x1b'),JSON['stringify'](_0x19e63e));if(_0x19e63e[_0xe7d6('0x1d')]){if(_0x19e63e[_0xe7d6('0x1d')][_0xe7d6('0x1e')]===0x1f4){logger[_0xe7d6('0x1d')]('Network,\x20%s,\x20%s',_0x14a046,_0x19e63e[_0xe7d6('0x1d')][_0xe7d6('0x1f')]);return _0x574861(_0x19e63e['error'][_0xe7d6('0x1f')]);}logger[_0xe7d6('0x1d')]('Network,\x20%s,\x20%s',_0x14a046,_0x19e63e[_0xe7d6('0x1d')][_0xe7d6('0x1f')]);return _0x2f1c47(_0x19e63e[_0xe7d6('0x1d')]['message']);}else{logger[_0xe7d6('0x19')](_0xe7d6('0x1a'),_0x14a046,_0xe7d6('0x1b'));_0x2f1c47(_0x19e63e[_0xe7d6('0x20')][_0xe7d6('0x1f')]);}})[_0xe7d6('0x21')](function(_0x30fc5a){logger[_0xe7d6('0x1d')]('Network,\x20%s,\x20%s',_0x14a046,_0x30fc5a);_0x574861(_0x30fc5a);});});}function respondWithStatusCode(_0x2ed11f,_0x1bc9ae){_0x1bc9ae=_0x1bc9ae||0xcc;return function(_0x1f7995){if(_0x1f7995){return _0x2ed11f['sendStatus'](_0x1bc9ae);}return _0x2ed11f[_0xe7d6('0x22')](_0x1bc9ae)[_0xe7d6('0x23')]();};}function respondWithResult(_0x29ab94,_0x94be47){_0x94be47=_0x94be47||0xc8;return function(_0x431090){if(_0x431090){return _0x29ab94['status'](_0x94be47)[_0xe7d6('0x24')](_0x431090);}};}function respondWithFilteredResult(_0x36ea64,_0x5f0042){return function(_0x445a8f){if(_0x445a8f){var _0x369bfd=_0x445a8f[_0xe7d6('0x25')],_0x51fd65=_0x5f0042['offset'],_0x15c823=_0x5f0042['offset']+_0x5f0042[_0xe7d6('0x26')],_0x468803;if(_0x15c823>=_0x369bfd){_0x15c823=_0x369bfd;_0x468803=0xc8;}else{_0x468803=0xce;}_0x36ea64[_0xe7d6('0x22')](_0x468803);return _0x36ea64[_0xe7d6('0x27')](_0xe7d6('0x28'),_0x51fd65+'-'+_0x15c823+'/'+_0x369bfd)[_0xe7d6('0x24')](_0x445a8f);}return null;};}function patchUpdates(_0x3fef92){return function(_0x40a8bd){try{jsonpatch[_0xe7d6('0x29')](_0x40a8bd,_0x3fef92,!![]);}catch(_0x2ab54e){return BPromise[_0xe7d6('0x2a')](_0x2ab54e);}return _0x40a8bd[_0xe7d6('0x2b')]();};}function saveUpdates(_0x5c3da2,_0x2f0625){return function(_0x196bbb){if(_0x196bbb){return _0x196bbb[_0xe7d6('0x2c')](_0x5c3da2)[_0xe7d6('0x2d')](function(_0xe4894f){return _0xe4894f;});}return null;};}function removeEntity(_0x1e0332,_0x30f0a7){return function(_0x48af2a){if(_0x48af2a){return _0x48af2a['destroy']()[_0xe7d6('0x2d')](function(){_0x1e0332[_0xe7d6('0x22')](0xcc)[_0xe7d6('0x23')]();});}};}function handleEntityNotFound(_0x252831,_0x158225){return function(_0xb24649){if(!_0xb24649){_0x252831['sendStatus'](0x194);}return _0xb24649;};}function handleError(_0x5e1c4a,_0x366d2b){_0x366d2b=_0x366d2b||0x1f4;return function(_0x35bbf8){logger[_0xe7d6('0x1d')](_0x35bbf8[_0xe7d6('0x2e')]);if(_0x35bbf8[_0xe7d6('0x2f')]){delete _0x35bbf8[_0xe7d6('0x2f')];}_0x5e1c4a[_0xe7d6('0x22')](_0x366d2b)[_0xe7d6('0x30')](_0x35bbf8);};}exports[_0xe7d6('0x31')]=function(_0x39e51e,_0x26f853){var _0x417961={},_0x3dbd53={},_0x13041c={'count':0x0,'rows':[]};var _0x1204c5=_[_0xe7d6('0x32')](db['Network'][_0xe7d6('0x33')],function(_0x2912a6){return{'name':_0x2912a6['fieldName'],'type':_0x2912a6[_0xe7d6('0x34')][_0xe7d6('0x35')]};});_0x3dbd53[_0xe7d6('0x36')]=_[_0xe7d6('0x32')](_0x1204c5,_0xe7d6('0x2f'));_0x3dbd53[_0xe7d6('0x37')]=_[_0xe7d6('0x38')](_0x39e51e[_0xe7d6('0x37')]);_0x3dbd53['filters']=_[_0xe7d6('0x39')](_0x3dbd53['model'],_0x3dbd53[_0xe7d6('0x37')]);_0x417961['attributes']=_['intersection'](_0x3dbd53[_0xe7d6('0x36')],qs['fields'](_0x39e51e[_0xe7d6('0x37')][_0xe7d6('0x3a')]));_0x417961[_0xe7d6('0x3b')]=_0x417961['attributes'][_0xe7d6('0x3c')]?_0x417961[_0xe7d6('0x3b')]:_0x3dbd53[_0xe7d6('0x36')];if(!_0x39e51e[_0xe7d6('0x37')][_0xe7d6('0x3d')](_0xe7d6('0x3e'))){_0x417961['limit']=qs['limit'](_0x39e51e[_0xe7d6('0x37')][_0xe7d6('0x26')]);_0x417961[_0xe7d6('0x3f')]=qs[_0xe7d6('0x3f')](_0x39e51e[_0xe7d6('0x37')][_0xe7d6('0x3f')]);}_0x417961[_0xe7d6('0x40')]=qs['sort'](_0x39e51e[_0xe7d6('0x37')][_0xe7d6('0x41')]);_0x417961[_0xe7d6('0x42')]=qs[_0xe7d6('0x43')](_[_0xe7d6('0x44')](_0x39e51e['query'],_0x3dbd53['filters']),_0x1204c5);if(_0x39e51e[_0xe7d6('0x37')][_0xe7d6('0x45')]){_0x417961['where']=_[_0xe7d6('0x46')](_0x417961['where'],{'$or':_['map'](_0x1204c5,function(_0x25628c){if(_0x25628c[_0xe7d6('0x34')]!==_0xe7d6('0x47')){var _0x2ef152={};_0x2ef152[_0x25628c['name']]={'$like':'%'+_0x39e51e['query']['filter']+'%'};return _0x2ef152;}})});}_0x417961=_[_0xe7d6('0x46')]({},_0x417961,_0x39e51e[_0xe7d6('0x48')]);var _0x398160={'where':_0x417961[_0xe7d6('0x42')]};return db[_0xe7d6('0x49')][_0xe7d6('0x25')](_0x398160)[_0xe7d6('0x2d')](function(_0x44f060){_0x13041c[_0xe7d6('0x25')]=_0x44f060;if(_0x39e51e[_0xe7d6('0x37')][_0xe7d6('0x4a')]){_0x417961[_0xe7d6('0x4b')]=[{'all':!![]}];}return db[_0xe7d6('0x49')][_0xe7d6('0x4c')](_0x417961);})[_0xe7d6('0x2d')](function(_0x24cec9){_0x13041c[_0xe7d6('0x4d')]=_0x24cec9;return _0x13041c;})['then'](respondWithFilteredResult(_0x26f853,_0x417961))[_0xe7d6('0x21')](handleError(_0x26f853,null));};exports['show']=function(_0xc8839e,_0x5af286){var _0x4e378b={'raw':!![],'where':{'id':_0xc8839e[_0xe7d6('0x4e')]['id']}},_0x10902d={};_0x10902d[_0xe7d6('0x36')]=_['keys'](db[_0xe7d6('0x49')]['rawAttributes']);_0x10902d['query']=_['keys'](_0xc8839e['query']);_0x10902d[_0xe7d6('0x43')]=_[_0xe7d6('0x39')](_0x10902d['model'],_0x10902d[_0xe7d6('0x37')]);_0x4e378b[_0xe7d6('0x3b')]=_[_0xe7d6('0x39')](_0x10902d[_0xe7d6('0x36')],qs['fields'](_0xc8839e[_0xe7d6('0x37')][_0xe7d6('0x3a')]));_0x4e378b[_0xe7d6('0x3b')]=_0x4e378b[_0xe7d6('0x3b')][_0xe7d6('0x3c')]?_0x4e378b['attributes']:_0x10902d['model'];if(_0xc8839e[_0xe7d6('0x37')]['includeAll']){_0x4e378b[_0xe7d6('0x4b')]=[{'all':!![]}];}_0x4e378b=_[_0xe7d6('0x46')]({},_0x4e378b,_0xc8839e[_0xe7d6('0x48')]);return db[_0xe7d6('0x49')][_0xe7d6('0x4f')](_0x4e378b)[_0xe7d6('0x2d')](handleEntityNotFound(_0x5af286,null))['then'](respondWithResult(_0x5af286,null))[_0xe7d6('0x21')](handleError(_0x5af286,null));};exports[_0xe7d6('0x50')]=function(_0x29b4fc,_0x5df5d7,_0x324bf9){var _0x18c2d8;return db[_0xe7d6('0x51')][_0xe7d6('0x52')](function(_0x22f42b){return db[_0xe7d6('0x49')][_0xe7d6('0x50')](_0x29b4fc[_0xe7d6('0x53')],{'raw':!![]})['then'](function(_0x440787){_0x18c2d8=_0x440787;return db[_0xe7d6('0x49')][_0xe7d6('0x4c')]({'where':{'type':_0x29b4fc[_0xe7d6('0x53')]['type']},'raw':!![]});})[_0xe7d6('0x2d')](function(_0x6c8c4b){if(_0x18c2d8[_0xe7d6('0x34')][_0xe7d6('0x54')]()=='STUN'){var _0x4de182=fs[_0xe7d6('0x55')](path[_0xe7d6('0x56')](config[_0xe7d6('0x57')],_0xe7d6('0x58')),'utf8');var _0xd059b0=ejs[_0xe7d6('0x59')](_0x4de182,{'networks':_0x6c8c4b||[]});fs[_0xe7d6('0x5a')](_0xe7d6('0x5b'),_0xd059b0);return respondWithRpcPromise(_0xe7d6('0x5c'),_0xe7d6('0x50'),{'module':_0xe7d6('0x5d')});}else if(_0x18c2d8[_0xe7d6('0x34')]['toUpperCase']()==_0xe7d6('0x5e')){var _0x27e145=fs[_0xe7d6('0x55')](path[_0xe7d6('0x56')](config[_0xe7d6('0x57')],_0xe7d6('0x5f')),'utf8');var _0x4bbd8d=ejs[_0xe7d6('0x59')](_0x27e145,{'networks':_0x6c8c4b||[]});fs[_0xe7d6('0x5a')](_0xe7d6('0x60'),_0x4bbd8d);return respondWithRpcPromise('Reload',_0xe7d6('0x50'),{'module':_0xe7d6('0x5d')});}else{var _0x44b0a8=fs['readFileSync'](path['join'](config[_0xe7d6('0x57')],_0xe7d6('0x61')),'utf8');var _0x298575=ejs['render'](_0x44b0a8,{'networks':_0x6c8c4b||[]});fs[_0xe7d6('0x5a')](util[_0xe7d6('0x62')](_0xe7d6('0x63'),_0x29b4fc[_0xe7d6('0x53')][_0xe7d6('0x34')]['toLowerCase']()),_0x298575);return respondWithRpcPromise('Reload','create',{'module':_0xe7d6('0x64')});}return null;})[_0xe7d6('0x2d')](function(){return _0x18c2d8;});})[_0xe7d6('0x2d')](respondWithResult(_0x5df5d7,0xc9))[_0xe7d6('0x21')](handleError(_0x5df5d7,null));};exports[_0xe7d6('0x2c')]=function(_0x28e0fe,_0x2beaa8,_0x51fa03){var _0x34e985;return db[_0xe7d6('0x51')][_0xe7d6('0x52')](function(_0x37dea2){return db[_0xe7d6('0x49')][_0xe7d6('0x4f')]({'where':{'id':_0x28e0fe['params']['id']}})[_0xe7d6('0x2d')](handleEntityNotFound(_0x2beaa8,null))[_0xe7d6('0x2d')](saveUpdates(_0x28e0fe['body'],null))[_0xe7d6('0x2d')](function(_0x5d1950){if(_0x5d1950){_0x34e985=_0x5d1950;return db['Network'][_0xe7d6('0x4c')]({'where':{'type':_0x34e985[_0xe7d6('0x34')]},'raw':!![]});}return null;})[_0xe7d6('0x2d')](function(_0x2bc189){if(_0x34e985[_0xe7d6('0x34')][_0xe7d6('0x54')]()==_0xe7d6('0x65')){var _0x4afefc=fs['readFileSync'](path[_0xe7d6('0x56')](config['root'],_0xe7d6('0x58')),_0xe7d6('0x66'));var _0x82f691=ejs[_0xe7d6('0x59')](_0x4afefc,{'networks':_0x2bc189||[]});fs[_0xe7d6('0x5a')]('/etc/asterisk/stun_xcally.conf',_0x82f691);return respondWithRpcPromise(_0xe7d6('0x5c'),'update',{'module':'res_stun_monitor.so'});}else if(_0x34e985[_0xe7d6('0x34')][_0xe7d6('0x54')]()==_0xe7d6('0x5e')){var _0x13c7cc=fs[_0xe7d6('0x55')](path[_0xe7d6('0x56')](config[_0xe7d6('0x57')],_0xe7d6('0x5f')),_0xe7d6('0x66'));var _0x4c96cf=ejs['render'](_0x13c7cc,{'networks':_0x2bc189||[]});fs[_0xe7d6('0x5a')](_0xe7d6('0x60'),_0x4c96cf);return respondWithRpcPromise(_0xe7d6('0x5c'),_0xe7d6('0x2c'),{'module':'res_stun_monitor.so'});}else{var _0x2737b1=fs[_0xe7d6('0x55')](path[_0xe7d6('0x56')](config[_0xe7d6('0x57')],_0xe7d6('0x61')),_0xe7d6('0x66'));var _0x204839=ejs[_0xe7d6('0x59')](_0x2737b1,{'networks':_0x2bc189||[]});fs[_0xe7d6('0x5a')](util[_0xe7d6('0x62')](_0xe7d6('0x63'),_0x28e0fe[_0xe7d6('0x53')][_0xe7d6('0x34')][_0xe7d6('0x67')]()),_0x204839);return respondWithRpcPromise(_0xe7d6('0x5c'),_0xe7d6('0x2c'),{'module':'chan_sip.so'});}return null;})[_0xe7d6('0x2d')](function(_0x4ee44a){if(_0x4ee44a){return _0x34e985;}return null;});})['then'](respondWithResult(_0x2beaa8,null))[_0xe7d6('0x21')](handleError(_0x2beaa8,null));};exports['destroy']=function(_0x1ec8f9,_0x510f9b,_0x1d85cc){var _0x261a74;return db[_0xe7d6('0x49')][_0xe7d6('0x4f')]({'where':{'id':_0x1ec8f9[_0xe7d6('0x4e')]['id']}})['then'](function(_0x12df27){_0x261a74=_0x12df27;return _0x12df27;})[_0xe7d6('0x2d')](handleEntityNotFound(_0x510f9b,null))['then'](removeEntity(_0x510f9b,null))['then'](function(){if(_0x261a74){return db['Network']['findAll']({'where':{'type':_0x261a74[_0xe7d6('0x34')]},'raw':!![]});}})[_0xe7d6('0x2d')](function(_0x1a8903){if(_0x261a74[_0xe7d6('0x34')]['toUpperCase']()==_0xe7d6('0x65')){var _0x17ca00=fs[_0xe7d6('0x55')](path['join'](config[_0xe7d6('0x57')],_0xe7d6('0x58')),'utf8');var _0x11a8ef=ejs['render'](_0x17ca00,{'networks':_0x1a8903||[]});fs[_0xe7d6('0x5a')](_0xe7d6('0x5b'),_0x11a8ef);return respondWithRpcPromise(_0xe7d6('0x5c'),'destroy',{'module':_0xe7d6('0x5d')});}else if(_0x261a74['type'][_0xe7d6('0x54')]()=='TURN'){var _0x106a41=fs['readFileSync'](path[_0xe7d6('0x56')](config['root'],_0xe7d6('0x5f')),'utf8');var _0x11e528=ejs['render'](_0x106a41,{'networks':_0x1a8903||[]});fs[_0xe7d6('0x5a')]('/etc/asterisk/turn_xcally.conf',_0x11e528);return respondWithRpcPromise('Reload',_0xe7d6('0x68'),{'module':_0xe7d6('0x5d')});}else{var _0x4b3284=fs['readFileSync'](path[_0xe7d6('0x56')](config['root'],'server/files/templates/network.ejs'),'utf8');var _0x40b9ee=ejs[_0xe7d6('0x59')](_0x4b3284,{'networks':_0x1a8903||[]});fs[_0xe7d6('0x5a')](util[_0xe7d6('0x62')]('/etc/asterisk/sip_xcally_%s.conf',_0x1ec8f9[_0xe7d6('0x53')]['type']['toLowerCase']()),_0x40b9ee);return respondWithRpcPromise('Reload',_0xe7d6('0x68'),{'module':_0xe7d6('0x64')});}return null;})[_0xe7d6('0x21')](handleError(_0x510f9b,null));}; \ No newline at end of file +var _0xba77=['render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','utf8','writeFileSync','/etc/asterisk/turn_xcally.conf','join','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','transaction','server/files/templates/network.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','index','Network','rawAttributes','fieldName','type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','params','includeAll','options','find','create','sequelize','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xba77,0x157));var _0x7ba7=function(_0x3ed054,_0x4d4f16){_0x3ed054=_0x3ed054-0x0;var _0x16dd95=_0xba77[_0x3ed054];return _0x16dd95;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7ba7('0x0'));var rimraf=require(_0x7ba7('0x1'));var zipdir=require(_0x7ba7('0x2'));var jsonpatch=require(_0x7ba7('0x3'));var rp=require(_0x7ba7('0x4'));var moment=require(_0x7ba7('0x5'));var BPromise=require(_0x7ba7('0x6'));var Mustache=require('mustache');var util=require(_0x7ba7('0x7'));var path=require(_0x7ba7('0x8'));var sox=require(_0x7ba7('0x9'));var csv=require(_0x7ba7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7ba7('0xb'));var _=require(_0x7ba7('0xc'));var squel=require(_0x7ba7('0xd'));var crypto=require(_0x7ba7('0xe'));var jsforce=require(_0x7ba7('0xf'));var deskjs=require(_0x7ba7('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7ba7('0x11'));var Papa=require(_0x7ba7('0x12'));var Redis=require(_0x7ba7('0x13'));var authService=require(_0x7ba7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7ba7('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7ba7('0x16'))(_0x7ba7('0x17'));var utils=require(_0x7ba7('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7ba7('0x19'));var db=require(_0x7ba7('0x1a'))['db'];var jayson=require(_0x7ba7('0x1b'));var client=jayson[_0x7ba7('0x1c')][_0x7ba7('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x23152c,_0x373b61,_0x234ea,_0x53ca7b){return new BPromise(function(_0x695b3b,_0x5111d9){var _0x569453=_0x53ca7b||client;return _0x569453['request'](_0x23152c,_0x234ea)[_0x7ba7('0x1e')](function(_0x5a8991){logger[_0x7ba7('0x1f')]('Network,\x20%s,\x20%s',_0x373b61,_0x7ba7('0x20'));logger['debug'](_0x7ba7('0x21'),_0x373b61,_0x7ba7('0x20'),JSON[_0x7ba7('0x22')](_0x5a8991));if(_0x5a8991[_0x7ba7('0x23')]){if(_0x5a8991['error'][_0x7ba7('0x24')]===0x1f4){logger['error'](_0x7ba7('0x25'),_0x373b61,_0x5a8991['error'][_0x7ba7('0x26')]);return _0x5111d9(_0x5a8991[_0x7ba7('0x23')][_0x7ba7('0x26')]);}logger['error'](_0x7ba7('0x25'),_0x373b61,_0x5a8991[_0x7ba7('0x23')][_0x7ba7('0x26')]);return _0x695b3b(_0x5a8991['error']['message']);}else{logger[_0x7ba7('0x1f')](_0x7ba7('0x25'),_0x373b61,_0x7ba7('0x20'));_0x695b3b(_0x5a8991['result'][_0x7ba7('0x26')]);}})[_0x7ba7('0x27')](function(_0x2478e2){logger[_0x7ba7('0x23')](_0x7ba7('0x25'),_0x373b61,_0x2478e2);_0x5111d9(_0x2478e2);});});}function respondWithStatusCode(_0x4d354f,_0x117631){_0x117631=_0x117631||0xcc;return function(_0x39adbb){if(_0x39adbb){return _0x4d354f[_0x7ba7('0x28')](_0x117631);}return _0x4d354f[_0x7ba7('0x29')](_0x117631)[_0x7ba7('0x2a')]();};}function respondWithResult(_0x151720,_0x50be2b){_0x50be2b=_0x50be2b||0xc8;return function(_0xb8eca5){if(_0xb8eca5){return _0x151720[_0x7ba7('0x29')](_0x50be2b)['json'](_0xb8eca5);}};}function respondWithFilteredResult(_0x2b0847,_0x2e8c67){return function(_0x3e8c21){if(_0x3e8c21){var _0x3afb08=_0x3e8c21[_0x7ba7('0x2b')],_0xa8b5a8=_0x2e8c67[_0x7ba7('0x2c')],_0x1e5eab=_0x2e8c67[_0x7ba7('0x2c')]+_0x2e8c67[_0x7ba7('0x2d')],_0x140572;if(_0x1e5eab>=_0x3afb08){_0x1e5eab=_0x3afb08;_0x140572=0xc8;}else{_0x140572=0xce;}_0x2b0847[_0x7ba7('0x29')](_0x140572);return _0x2b0847[_0x7ba7('0x2e')](_0x7ba7('0x2f'),_0xa8b5a8+'-'+_0x1e5eab+'/'+_0x3afb08)[_0x7ba7('0x30')](_0x3e8c21);}return null;};}function patchUpdates(_0x151e71){return function(_0x57b553){try{jsonpatch[_0x7ba7('0x31')](_0x57b553,_0x151e71,!![]);}catch(_0x77dac9){return BPromise[_0x7ba7('0x32')](_0x77dac9);}return _0x57b553[_0x7ba7('0x33')]();};}function saveUpdates(_0x29f6c3,_0x518182){return function(_0x35fef6){if(_0x35fef6){return _0x35fef6[_0x7ba7('0x34')](_0x29f6c3)[_0x7ba7('0x1e')](function(_0x43e622){return _0x43e622;});}return null;};}function removeEntity(_0x4e23b9,_0x1c8567){return function(_0x20898b){if(_0x20898b){return _0x20898b[_0x7ba7('0x35')]()[_0x7ba7('0x1e')](function(){_0x4e23b9[_0x7ba7('0x29')](0xcc)[_0x7ba7('0x2a')]();});}};}function handleEntityNotFound(_0x8c14be,_0x351a11){return function(_0x5d4026){if(!_0x5d4026){_0x8c14be[_0x7ba7('0x28')](0x194);}return _0x5d4026;};}function handleError(_0xcb4b21,_0x2e1fce){_0x2e1fce=_0x2e1fce||0x1f4;return function(_0x202cae){logger[_0x7ba7('0x23')](_0x202cae[_0x7ba7('0x36')]);if(_0x202cae[_0x7ba7('0x37')]){delete _0x202cae['name'];}_0xcb4b21[_0x7ba7('0x29')](_0x2e1fce)['send'](_0x202cae);};}exports[_0x7ba7('0x38')]=function(_0x4dcfde,_0x37c12d){var _0x1a6b3c={},_0x299b07={},_0x1da323={'count':0x0,'rows':[]};var _0x2ce844=_['map'](db[_0x7ba7('0x39')][_0x7ba7('0x3a')],function(_0x1c0fa9){return{'name':_0x1c0fa9[_0x7ba7('0x3b')],'type':_0x1c0fa9[_0x7ba7('0x3c')]['key']};});_0x299b07[_0x7ba7('0x3d')]=_[_0x7ba7('0x3e')](_0x2ce844,_0x7ba7('0x37'));_0x299b07[_0x7ba7('0x3f')]=_[_0x7ba7('0x40')](_0x4dcfde[_0x7ba7('0x3f')]);_0x299b07['filters']=_[_0x7ba7('0x41')](_0x299b07[_0x7ba7('0x3d')],_0x299b07['query']);_0x1a6b3c['attributes']=_[_0x7ba7('0x41')](_0x299b07[_0x7ba7('0x3d')],qs[_0x7ba7('0x42')](_0x4dcfde[_0x7ba7('0x3f')]['fields']));_0x1a6b3c[_0x7ba7('0x43')]=_0x1a6b3c[_0x7ba7('0x43')][_0x7ba7('0x44')]?_0x1a6b3c[_0x7ba7('0x43')]:_0x299b07[_0x7ba7('0x3d')];if(!_0x4dcfde['query'][_0x7ba7('0x45')](_0x7ba7('0x46'))){_0x1a6b3c[_0x7ba7('0x2d')]=qs[_0x7ba7('0x2d')](_0x4dcfde[_0x7ba7('0x3f')]['limit']);_0x1a6b3c[_0x7ba7('0x2c')]=qs[_0x7ba7('0x2c')](_0x4dcfde[_0x7ba7('0x3f')][_0x7ba7('0x2c')]);}_0x1a6b3c['order']=qs['sort'](_0x4dcfde[_0x7ba7('0x3f')][_0x7ba7('0x47')]);_0x1a6b3c[_0x7ba7('0x48')]=qs[_0x7ba7('0x49')](_[_0x7ba7('0x4a')](_0x4dcfde[_0x7ba7('0x3f')],_0x299b07[_0x7ba7('0x49')]),_0x2ce844);if(_0x4dcfde[_0x7ba7('0x3f')][_0x7ba7('0x4b')]){_0x1a6b3c[_0x7ba7('0x48')]=_[_0x7ba7('0x4c')](_0x1a6b3c[_0x7ba7('0x48')],{'$or':_[_0x7ba7('0x3e')](_0x2ce844,function(_0x150caf){if(_0x150caf[_0x7ba7('0x3c')]!==_0x7ba7('0x4d')){var _0x33cf92={};_0x33cf92[_0x150caf[_0x7ba7('0x37')]]={'$like':'%'+_0x4dcfde[_0x7ba7('0x3f')][_0x7ba7('0x4b')]+'%'};return _0x33cf92;}})});}_0x1a6b3c=_[_0x7ba7('0x4c')]({},_0x1a6b3c,_0x4dcfde['options']);var _0x405ce7={'where':_0x1a6b3c[_0x7ba7('0x48')]};return db[_0x7ba7('0x39')][_0x7ba7('0x2b')](_0x405ce7)[_0x7ba7('0x1e')](function(_0x266306){_0x1da323[_0x7ba7('0x2b')]=_0x266306;if(_0x4dcfde[_0x7ba7('0x3f')]['includeAll']){_0x1a6b3c[_0x7ba7('0x4e')]=[{'all':!![]}];}return db[_0x7ba7('0x39')][_0x7ba7('0x4f')](_0x1a6b3c);})[_0x7ba7('0x1e')](function(_0x4be98d){_0x1da323[_0x7ba7('0x50')]=_0x4be98d;return _0x1da323;})[_0x7ba7('0x1e')](respondWithFilteredResult(_0x37c12d,_0x1a6b3c))[_0x7ba7('0x27')](handleError(_0x37c12d,null));};exports['show']=function(_0x3c56fa,_0x505925){var _0x1b7cb6={'raw':!![],'where':{'id':_0x3c56fa[_0x7ba7('0x51')]['id']}},_0x4b5faf={};_0x4b5faf[_0x7ba7('0x3d')]=_['keys'](db[_0x7ba7('0x39')][_0x7ba7('0x3a')]);_0x4b5faf[_0x7ba7('0x3f')]=_[_0x7ba7('0x40')](_0x3c56fa[_0x7ba7('0x3f')]);_0x4b5faf[_0x7ba7('0x49')]=_[_0x7ba7('0x41')](_0x4b5faf[_0x7ba7('0x3d')],_0x4b5faf[_0x7ba7('0x3f')]);_0x1b7cb6[_0x7ba7('0x43')]=_[_0x7ba7('0x41')](_0x4b5faf[_0x7ba7('0x3d')],qs[_0x7ba7('0x42')](_0x3c56fa[_0x7ba7('0x3f')]['fields']));_0x1b7cb6[_0x7ba7('0x43')]=_0x1b7cb6[_0x7ba7('0x43')][_0x7ba7('0x44')]?_0x1b7cb6[_0x7ba7('0x43')]:_0x4b5faf[_0x7ba7('0x3d')];if(_0x3c56fa[_0x7ba7('0x3f')][_0x7ba7('0x52')]){_0x1b7cb6['include']=[{'all':!![]}];}_0x1b7cb6=_['merge']({},_0x1b7cb6,_0x3c56fa[_0x7ba7('0x53')]);return db[_0x7ba7('0x39')][_0x7ba7('0x54')](_0x1b7cb6)[_0x7ba7('0x1e')](handleEntityNotFound(_0x505925,null))[_0x7ba7('0x1e')](respondWithResult(_0x505925,null))['catch'](handleError(_0x505925,null));};exports[_0x7ba7('0x55')]=function(_0x10cbf9,_0x43420e,_0x52c2f2){var _0x9e1f24;return db[_0x7ba7('0x56')]['transaction'](function(_0x345013){return db[_0x7ba7('0x39')][_0x7ba7('0x55')](_0x10cbf9[_0x7ba7('0x57')],{'raw':!![]})['then'](function(_0x45910d){_0x9e1f24=_0x45910d;return db[_0x7ba7('0x39')][_0x7ba7('0x4f')]({'where':{'type':_0x10cbf9['body'][_0x7ba7('0x3c')]},'raw':!![]});})[_0x7ba7('0x1e')](function(_0x43d8d1){if(_0x9e1f24[_0x7ba7('0x3c')][_0x7ba7('0x58')]()==_0x7ba7('0x59')){var _0x4c54ca=fs[_0x7ba7('0x5a')](path['join'](config[_0x7ba7('0x5b')],_0x7ba7('0x5c')),'utf8');var _0x3d4bf2=ejs[_0x7ba7('0x5d')](_0x4c54ca,{'networks':_0x43d8d1||[]});fs['writeFileSync'](_0x7ba7('0x5e'),_0x3d4bf2);return respondWithRpcPromise(_0x7ba7('0x5f'),'create',{'module':_0x7ba7('0x60')});}else if(_0x9e1f24[_0x7ba7('0x3c')][_0x7ba7('0x58')]()==_0x7ba7('0x61')){var _0x4e2a88=fs['readFileSync'](path['join'](config[_0x7ba7('0x5b')],_0x7ba7('0x62')),_0x7ba7('0x63'));var _0x200d56=ejs[_0x7ba7('0x5d')](_0x4e2a88,{'networks':_0x43d8d1||[]});fs[_0x7ba7('0x64')](_0x7ba7('0x65'),_0x200d56);return respondWithRpcPromise(_0x7ba7('0x5f'),_0x7ba7('0x55'),{'module':_0x7ba7('0x60')});}else{var _0x223d23=fs['readFileSync'](path[_0x7ba7('0x66')](config[_0x7ba7('0x5b')],'server/files/templates/network.ejs'),_0x7ba7('0x63'));var _0x3d0d2b=ejs['render'](_0x223d23,{'networks':_0x43d8d1||[]});fs['writeFileSync'](util[_0x7ba7('0x67')](_0x7ba7('0x68'),_0x10cbf9['body'][_0x7ba7('0x3c')][_0x7ba7('0x69')]()),_0x3d0d2b);return respondWithRpcPromise(_0x7ba7('0x5f'),'create',{'module':_0x7ba7('0x6a')});}return null;})[_0x7ba7('0x1e')](function(){return _0x9e1f24;});})[_0x7ba7('0x1e')](respondWithResult(_0x43420e,0xc9))[_0x7ba7('0x27')](handleError(_0x43420e,null));};exports[_0x7ba7('0x34')]=function(_0x1e18e7,_0x1966f2,_0x202b88){var _0x5e1893;return db[_0x7ba7('0x56')][_0x7ba7('0x6b')](function(_0x16a8af){return db[_0x7ba7('0x39')][_0x7ba7('0x54')]({'where':{'id':_0x1e18e7[_0x7ba7('0x51')]['id']}})[_0x7ba7('0x1e')](handleEntityNotFound(_0x1966f2,null))['then'](saveUpdates(_0x1e18e7['body'],null))[_0x7ba7('0x1e')](function(_0x45fc49){if(_0x45fc49){_0x5e1893=_0x45fc49;return db['Network']['findAll']({'where':{'type':_0x5e1893[_0x7ba7('0x3c')]},'raw':!![]});}return null;})[_0x7ba7('0x1e')](function(_0x588542){if(_0x5e1893[_0x7ba7('0x3c')][_0x7ba7('0x58')]()=='STUN'){var _0x7ec082=fs[_0x7ba7('0x5a')](path[_0x7ba7('0x66')](config[_0x7ba7('0x5b')],_0x7ba7('0x5c')),'utf8');var _0x455417=ejs[_0x7ba7('0x5d')](_0x7ec082,{'networks':_0x588542||[]});fs[_0x7ba7('0x64')](_0x7ba7('0x5e'),_0x455417);return respondWithRpcPromise(_0x7ba7('0x5f'),_0x7ba7('0x34'),{'module':_0x7ba7('0x60')});}else if(_0x5e1893['type']['toUpperCase']()=='TURN'){var _0x73f0ad=fs[_0x7ba7('0x5a')](path[_0x7ba7('0x66')](config[_0x7ba7('0x5b')],_0x7ba7('0x62')),_0x7ba7('0x63'));var _0x15c411=ejs['render'](_0x73f0ad,{'networks':_0x588542||[]});fs[_0x7ba7('0x64')](_0x7ba7('0x65'),_0x15c411);return respondWithRpcPromise(_0x7ba7('0x5f'),_0x7ba7('0x34'),{'module':_0x7ba7('0x60')});}else{var _0x3fdbec=fs['readFileSync'](path[_0x7ba7('0x66')](config[_0x7ba7('0x5b')],_0x7ba7('0x6c')),_0x7ba7('0x63'));var _0x572503=ejs[_0x7ba7('0x5d')](_0x3fdbec,{'networks':_0x588542||[]});fs[_0x7ba7('0x64')](util[_0x7ba7('0x67')]('/etc/asterisk/sip_xcally_%s.conf',_0x1e18e7[_0x7ba7('0x57')][_0x7ba7('0x3c')][_0x7ba7('0x69')]()),_0x572503);return respondWithRpcPromise(_0x7ba7('0x5f'),'update',{'module':'chan_sip.so'});}return null;})[_0x7ba7('0x1e')](function(_0x4803ba){if(_0x4803ba){return _0x5e1893;}return null;});})['then'](respondWithResult(_0x1966f2,null))[_0x7ba7('0x27')](handleError(_0x1966f2,null));};exports[_0x7ba7('0x35')]=function(_0x16bc2f,_0x190e87,_0x2ff917){var _0x295d7e;return db[_0x7ba7('0x39')][_0x7ba7('0x54')]({'where':{'id':_0x16bc2f[_0x7ba7('0x51')]['id']}})[_0x7ba7('0x1e')](function(_0x3fa0ee){_0x295d7e=_0x3fa0ee;return _0x3fa0ee;})[_0x7ba7('0x1e')](handleEntityNotFound(_0x190e87,null))[_0x7ba7('0x1e')](removeEntity(_0x190e87,null))['then'](function(){if(_0x295d7e){return db[_0x7ba7('0x39')][_0x7ba7('0x4f')]({'where':{'type':_0x295d7e[_0x7ba7('0x3c')]},'raw':!![]});}})[_0x7ba7('0x1e')](function(_0x987d26){if(_0x295d7e[_0x7ba7('0x3c')][_0x7ba7('0x58')]()=='STUN'){var _0x48b44a=fs['readFileSync'](path['join'](config['root'],_0x7ba7('0x5c')),_0x7ba7('0x63'));var _0x32fdb7=ejs[_0x7ba7('0x5d')](_0x48b44a,{'networks':_0x987d26||[]});fs[_0x7ba7('0x64')](_0x7ba7('0x5e'),_0x32fdb7);return respondWithRpcPromise(_0x7ba7('0x5f'),_0x7ba7('0x35'),{'module':'res_stun_monitor.so'});}else if(_0x295d7e['type'][_0x7ba7('0x58')]()==_0x7ba7('0x61')){var _0x55332a=fs[_0x7ba7('0x5a')](path[_0x7ba7('0x66')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x7ba7('0x63'));var _0x29020f=ejs[_0x7ba7('0x5d')](_0x55332a,{'networks':_0x987d26||[]});fs[_0x7ba7('0x64')](_0x7ba7('0x65'),_0x29020f);return respondWithRpcPromise('Reload',_0x7ba7('0x35'),{'module':_0x7ba7('0x60')});}else{var _0x3a924a=fs[_0x7ba7('0x5a')](path[_0x7ba7('0x66')](config[_0x7ba7('0x5b')],_0x7ba7('0x6c')),_0x7ba7('0x63'));var _0x402a08=ejs['render'](_0x3a924a,{'networks':_0x987d26||[]});fs['writeFileSync'](util['format'](_0x7ba7('0x68'),_0x16bc2f[_0x7ba7('0x57')][_0x7ba7('0x3c')][_0x7ba7('0x69')]()),_0x402a08);return respondWithRpcPromise('Reload',_0x7ba7('0x35'),{'module':'chan_sip.so'});}return null;})['catch'](handleError(_0x190e87,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index f996c7c..9acc526 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 _0xa96f=['exports','Network','network','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./network.attributes'];(function(_0x61b3ab,_0x1fc298){var _0x57097f=function(_0x25970b){while(--_0x25970b){_0x61b3ab['push'](_0x61b3ab['shift']());}};_0x57097f(++_0x1fc298);}(_0xa96f,0x1d7));var _0xfa96=function(_0x134827,_0x21f6ed){_0x134827=_0x134827-0x0;var _0x366671=_0xa96f[_0x134827];return _0x366671;};'use strict';var _=require(_0xfa96('0x0'));var util=require(_0xfa96('0x1'));var logger=require(_0xfa96('0x2'))(_0xfa96('0x3'));var moment=require('moment');var BPromise=require(_0xfa96('0x4'));var rp=require(_0xfa96('0x5'));var fs=require('fs');var path=require(_0xfa96('0x6'));var rimraf=require(_0xfa96('0x7'));var config=require('../../config/environment');var attributes=require(_0xfa96('0x8'));module[_0xfa96('0x9')]=function(_0x4d4de1,_0x1682ae){return _0x4d4de1['define'](_0xfa96('0xa'),attributes,{'tableName':_0xfa96('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4404=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./network.attributes','define','Network','network','lodash','util'];(function(_0x47343c,_0x2724b3){var _0x222435=function(_0x4906f5){while(--_0x4906f5){_0x47343c['push'](_0x47343c['shift']());}};_0x222435(++_0x2724b3);}(_0x4404,0x1c5));var _0x4440=function(_0x2e3620,_0x5140e4){_0x2e3620=_0x2e3620-0x0;var _0x130708=_0x4404[_0x2e3620];return _0x130708;};'use strict';var _=require(_0x4440('0x0'));var util=require(_0x4440('0x1'));var logger=require(_0x4440('0x2'))(_0x4440('0x3'));var moment=require(_0x4440('0x4'));var BPromise=require('bluebird');var rp=require(_0x4440('0x5'));var fs=require('fs');var path=require(_0x4440('0x6'));var rimraf=require(_0x4440('0x7'));var config=require(_0x4440('0x8'));var attributes=require(_0x4440('0x9'));module['exports']=function(_0x967f66,_0x4974f1){return _0x967f66[_0x4440('0xa')](_0x4440('0xb'),attributes,{'tableName':_0x4440('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index cbca309..cea2ab1 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 _0xa2d1=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x1db251,_0xf0443d){var _0x56685a=function(_0x6ec6b7){while(--_0x6ec6b7){_0x1db251['push'](_0x1db251['shift']());}};_0x56685a(++_0xf0443d);}(_0xa2d1,0x168));var _0x1a2d=function(_0x5c768b,_0x5e88a6){_0x5c768b=_0x5c768b-0x0;var _0x335af8=_0xa2d1[_0x5c768b];return _0x335af8;};'use strict';var _=require(_0x1a2d('0x0'));var util=require(_0x1a2d('0x1'));var moment=require('moment');var BPromise=require(_0x1a2d('0x2'));var rs=require(_0x1a2d('0x3'));var fs=require('fs');var Redis=require(_0x1a2d('0x4'));var db=require(_0x1a2d('0x5'))['db'];var utils=require(_0x1a2d('0x6'));var logger=require(_0x1a2d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1a2d('0x8')][_0x1a2d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2362cf,_0x221682,_0x8076ce){return new BPromise(function(_0x376fce,_0x57c995){return client[_0x1a2d('0xa')](_0x2362cf,_0x8076ce)[_0x1a2d('0xb')](function(_0x4b8ccb){logger[_0x1a2d('0xc')](_0x1a2d('0xd'),_0x221682,_0x1a2d('0xe'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x221682,_0x1a2d('0xe'),JSON[_0x1a2d('0xf')](_0x4b8ccb));if(_0x4b8ccb[_0x1a2d('0x10')]){if(_0x4b8ccb[_0x1a2d('0x10')][_0x1a2d('0x11')]===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x221682,_0x4b8ccb[_0x1a2d('0x10')][_0x1a2d('0x12')]);return _0x57c995(_0x4b8ccb[_0x1a2d('0x10')][_0x1a2d('0x12')]);}logger[_0x1a2d('0x10')]('Network,\x20%s,\x20%s',_0x221682,_0x4b8ccb[_0x1a2d('0x10')][_0x1a2d('0x12')]);return _0x376fce(_0x4b8ccb[_0x1a2d('0x10')][_0x1a2d('0x12')]);}else{logger[_0x1a2d('0xc')](_0x1a2d('0xd'),_0x221682,'request\x20sent');_0x376fce(_0x4b8ccb[_0x1a2d('0x13')]['message']);}})[_0x1a2d('0x14')](function(_0xea8472){logger[_0x1a2d('0x10')](_0x1a2d('0xd'),_0x221682,_0xea8472);_0x57c995(_0xea8472);});});} \ No newline at end of file +var _0x1390=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Network,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x1390,0x90));var _0x0139=function(_0x465c9e,_0x1ee715){_0x465c9e=_0x465c9e-0x0;var _0x4d4628=_0x1390[_0x465c9e];return _0x4d4628;};'use strict';var _=require(_0x0139('0x0'));var util=require('util');var moment=require(_0x0139('0x1'));var BPromise=require(_0x0139('0x2'));var rs=require(_0x0139('0x3'));var fs=require('fs');var Redis=require(_0x0139('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0139('0x5'));var logger=require('../../config/logger')(_0x0139('0x6'));var config=require(_0x0139('0x7'));var jayson=require(_0x0139('0x8'));var client=jayson['client'][_0x0139('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f2c69,_0x3c60fd,_0x28b0b3){return new BPromise(function(_0x392b37,_0x41d445){return client['request'](_0x4f2c69,_0x28b0b3)['then'](function(_0x27301f){logger['info']('Network,\x20%s,\x20%s',_0x3c60fd,'request\x20sent');logger[_0x0139('0xa')](_0x0139('0xb'),_0x3c60fd,_0x0139('0xc'),JSON[_0x0139('0xd')](_0x27301f));if(_0x27301f[_0x0139('0xe')]){if(_0x27301f[_0x0139('0xe')][_0x0139('0xf')]===0x1f4){logger[_0x0139('0xe')](_0x0139('0x10'),_0x3c60fd,_0x27301f[_0x0139('0xe')][_0x0139('0x11')]);return _0x41d445(_0x27301f[_0x0139('0xe')]['message']);}logger[_0x0139('0xe')](_0x0139('0x10'),_0x3c60fd,_0x27301f[_0x0139('0xe')]['message']);return _0x392b37(_0x27301f[_0x0139('0xe')][_0x0139('0x11')]);}else{logger[_0x0139('0x12')](_0x0139('0x10'),_0x3c60fd,_0x0139('0xc'));_0x392b37(_0x27301f[_0x0139('0x13')][_0x0139('0x11')]);}})[_0x0139('0x14')](function(_0x20ddf0){logger[_0x0139('0xe')](_0x0139('0x10'),_0x3c60fd,_0x20ddf0);_0x41d445(_0x20ddf0);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index e3067c7..c90d8fd 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 _0x7fbe=['addApplications','addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','post','addDisposition','addAnswer','/:id/notify'];(function(_0x49cb92,_0x3c31a6){var _0x16ee5a=function(_0x48e0c6){while(--_0x48e0c6){_0x49cb92['push'](_0x49cb92['shift']());}};_0x16ee5a(++_0x3c31a6);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x44ad4b,_0x13ccad){_0x44ad4b=_0x44ad4b-0x0;var _0x4c0516=_0x7fbe[_0x44ad4b];return _0x4c0516;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['show']);router['get'](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x10')]);router[_0xe7fb('0x9')](_0xe7fb('0x11'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x12')]);router[_0xe7fb('0x9')](_0xe7fb('0x13'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x14')]);router[_0xe7fb('0x9')](_0xe7fb('0x15'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x16')]);router['get'](_0xe7fb('0x17'),auth[_0xe7fb('0xa')](),controller['getAgents']);router[_0xe7fb('0x18')]('/',auth[_0xe7fb('0xa')](),controller['create']);router[_0xe7fb('0x18')]('/:id/dispositions',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x19')]);router[_0xe7fb('0x18')](_0xe7fb('0x11'),auth['isAuthenticated'](),controller[_0xe7fb('0x1a')]);router['post'](_0xe7fb('0x1b'),controller['notify']);router[_0xe7fb('0x18')](_0xe7fb('0x13'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x1c')]);router['post'](_0xe7fb('0x17'),auth['isAuthenticated'](),controller[_0xe7fb('0x1d')]);router['post'](_0xe7fb('0x1e'),auth['isAuthenticated'](),controller[_0xe7fb('0x1f')]);router[_0xe7fb('0x20')]('/:id',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x21')]);router[_0xe7fb('0x22')]('/:id',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x23')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xe7fb('0x24')]);router['delete']('/:id/canned_answers',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x25')]);router[_0xe7fb('0x22')]('/:id/users',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x26')]);module[_0xe7fb('0x27')]=router; \ No newline at end of file +var _0x8ef6=['get','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/users','post','create','addDisposition','/:id/notify','notify','addApplications','addAgents','send','update','destroy','delete','removeDispositions','removeAnswers','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller'];(function(_0x15d57f,_0x208dd9){var _0x42cb32=function(_0x4feeb4){while(--_0x4feeb4){_0x15d57f['push'](_0x15d57f['shift']());}};_0x42cb32(++_0x208dd9);}(_0x8ef6,0xf2));var _0x68ef=function(_0x412890,_0x345ad3){_0x412890=_0x412890-0x0;var _0x1211bb=_0x8ef6[_0x412890];return _0x1211bb;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var fs_extra=require(_0x68ef('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var controller=require(_0x68ef('0x9'));router[_0x68ef('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x68ef('0xa')](_0x68ef('0xb'),auth[_0x68ef('0xc')](),controller['describe']);router[_0x68ef('0xa')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0xe')]);router[_0x68ef('0xa')](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x10')]);router[_0x68ef('0xa')](_0x68ef('0x11'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x12')]);router['get'](_0x68ef('0x13'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x14')]);router[_0x68ef('0xa')](_0x68ef('0x15'),auth[_0x68ef('0xc')](),controller['getInteractions']);router[_0x68ef('0xa')](_0x68ef('0x16'),auth[_0x68ef('0xc')](),controller['getAgents']);router[_0x68ef('0x17')]('/',auth[_0x68ef('0xc')](),controller[_0x68ef('0x18')]);router['post'](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x19')]);router[_0x68ef('0x17')]('/:id/canned_answers',auth[_0x68ef('0xc')](),controller['addAnswer']);router['post'](_0x68ef('0x1a'),controller[_0x68ef('0x1b')]);router['post']('/:id/applications',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1c')]);router[_0x68ef('0x17')]('/:id/users',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1d')]);router[_0x68ef('0x17')]('/:id/send',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1e')]);router['put'](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x1f')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x68ef('0x20')]);router[_0x68ef('0x21')](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x22')]);router[_0x68ef('0x21')](_0x68ef('0x11'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x23')]);router[_0x68ef('0x21')]('/:id/users',auth[_0x68ef('0xc')](),controller['removeAgents']);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 271eb92..bd2e1a4 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 _0xa7f9=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x243e44,_0x33b986){var _0x38b059=function(_0x385b2f){while(--_0x385b2f){_0x243e44['push'](_0x243e44['shift']());}};_0x38b059(++_0x33b986);}(_0xa7f9,0x17d));var _0x9a7f=function(_0x5caee2,_0x325a65){_0x5caee2=_0x5caee2-0x0;var _0x3f8747=_0xa7f9[_0x5caee2];return _0x3f8747;};'use strict';var Sequelize=require(_0x9a7f('0x0'));var rs=require(_0x9a7f('0x1'));module[_0x9a7f('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x9a7f('0x3')]},'token':{'type':Sequelize[_0x9a7f('0x3')],'defaultValue':function(){return rs[_0x9a7f('0x4')]();}},'replyUri':{'type':Sequelize[_0x9a7f('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9a7f('0x5')],'defaultValue':function(){return _0x9a7f('0x6');}},'notificationSound':{'type':Sequelize[_0x9a7f('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9a7f('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9a7f('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x9a7f('0x3')]},'queueTransfer':{'type':Sequelize[_0x9a7f('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9a7f('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9a7f('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9a7f('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x9a7f('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x9a7f('0x7')],'defaultValue':![],'comment':_0x9a7f('0xa'),'set':function(_0x5d24db){if(!_0x5d24db)this[_0x9a7f('0xb')]('mandatoryDispositionPauseId',null);this[_0x9a7f('0xb')](_0x9a7f('0xc'),_0x5d24db);}}}; \ No newline at end of file +var _0x2681=['name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING'];(function(_0xf34109,_0x380779){var _0x570bfc=function(_0x1ad086){while(--_0x1ad086){_0xf34109['push'](_0xf34109['shift']());}};_0x570bfc(++_0x380779);}(_0x2681,0x1e9));var _0x1268=function(_0x5d87f4,_0x4673e3){_0x5d87f4=_0x5d87f4-0x0;var _0x3d0902=_0x2681[_0x5d87f4];return _0x3d0902;};'use strict';var Sequelize=require(_0x1268('0x0'));var rs=require(_0x1268('0x1'));module['exports']={'name':{'type':Sequelize[_0x1268('0x2')],'unique':_0x1268('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x1268('0x2')],'defaultValue':function(){return rs[_0x1268('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x1268('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1268('0x5')],'defaultValue':function(){return _0x1268('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1268('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1268('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x1268('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1268('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1268('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x1268('0x7')],'defaultValue':![],'comment':_0x1268('0x9'),'set':function(_0x3d0df4){if(!_0x3d0df4)this[_0x1268('0xa')]('mandatoryDispositionPauseId',null);this[_0x1268('0xa')](_0x1268('0xb'),_0x3d0df4);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 98b202a..f7056b7 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 _0xe13a=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','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','redis','defaults','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','status','end','json','count','offset','set','Content-Range','apply','save','update','get','sendStatus','stack','name','index','Pause','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','where','pick','merge','VIRTUAL','filter','options','OpenchannelAccount','rows','show','mandatoryDispositionPause','keys','fields','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','userProfileId','autoAssociation','UserProfileResource','params','destroy','describe','Disposition','getDispositions','findOne','sort','removeDispositions','addAnswer','OpenchannelAccountId','CannedAnswer','include','findAll','removeAnswers','ids','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','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','CmList','List','Contacts','DESC','Applications','applications','orderBy','priority','asc','account','ListId','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','lastName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','addApplications','transaction','OpenchannelApplication','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','tag','addAgents','omit','emit','removeAgents','isArray','getAgents','send','out','Messages','OpenchannelMessage','dataValues','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x43c2f4,_0x55bab3){var _0xfe7cbd=function(_0x5d241f){while(--_0x5d241f){_0x43c2f4['push'](_0x43c2f4['shift']());}};_0xfe7cbd(++_0x55bab3);}(_0xe13a,0x178));var _0xae13=function(_0x244dfe,_0x4ccb3a){_0x244dfe=_0x244dfe-0x0;var _0xc1733a=_0xe13a[_0x244dfe];return _0xc1733a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xae13('0x0'));var rimraf=require(_0xae13('0x1'));var zipdir=require(_0xae13('0x2'));var jsonpatch=require(_0xae13('0x3'));var rp=require('request-promise');var moment=require(_0xae13('0x4'));var BPromise=require(_0xae13('0x5'));var Mustache=require(_0xae13('0x6'));var util=require(_0xae13('0x7'));var path=require(_0xae13('0x8'));var sox=require(_0xae13('0x9'));var csv=require(_0xae13('0xa'));var ejs=require(_0xae13('0xb'));var fs=require('fs');var fs_extra=require(_0xae13('0xc'));var _=require('lodash');var squel=require(_0xae13('0xd'));var crypto=require(_0xae13('0xe'));var jsforce=require(_0xae13('0xf'));var deskjs=require(_0xae13('0x10'));var toCsv=require(_0xae13('0xa'));var querystring=require(_0xae13('0x11'));var Papa=require(_0xae13('0x12'));var Redis=require(_0xae13('0x13'));var authService=require(_0xae13('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xae13('0x15'));var hardwareService=require(_0xae13('0x16'));var logger=require(_0xae13('0x17'))(_0xae13('0x18'));var utils=require(_0xae13('0x19'));var config=require(_0xae13('0x1a'));var licenseUtil=require(_0xae13('0x1b'));var db=require('../../mysqldb')['db'];config[_0xae13('0x1c')]=_[_0xae13('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelAccount.socket')[_0xae13('0x1e')](socket);var jayson=require(_0xae13('0x1f'));var client=jayson[_0xae13('0x20')][_0xae13('0x21')]({'port':0x232c});var client9002=jayson[_0xae13('0x20')][_0xae13('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x5c25a4,_0x3c488f,_0x5e46bc,_0xe10aab){return new BPromise(function(_0x16764b,_0x207363){var _0x118e52=_0xe10aab||client;return _0x118e52[_0xae13('0x22')](_0x5c25a4,_0x5e46bc)[_0xae13('0x23')](function(_0x32dcbe){logger[_0xae13('0x24')](_0xae13('0x25'),_0x3c488f,'request\x20sent');logger[_0xae13('0x26')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x3c488f,_0xae13('0x27'),JSON[_0xae13('0x28')](_0x32dcbe));if(_0x32dcbe['error']){if(_0x32dcbe[_0xae13('0x29')][_0xae13('0x2a')]===0x1f4){logger[_0xae13('0x29')](_0xae13('0x25'),_0x3c488f,_0x32dcbe[_0xae13('0x29')][_0xae13('0x2b')]);return _0x207363(_0x32dcbe['error']['message']);}logger[_0xae13('0x29')](_0xae13('0x25'),_0x3c488f,_0x32dcbe['error'][_0xae13('0x2b')]);return _0x16764b(_0x32dcbe['error'][_0xae13('0x2b')]);}else{logger[_0xae13('0x24')](_0xae13('0x25'),_0x3c488f,'request\x20sent');_0x16764b(_0x32dcbe['result']['message']);}})[_0xae13('0x2c')](function(_0xc5e6a7){logger[_0xae13('0x29')]('OpenchannelAccount,\x20%s,\x20%s',_0x3c488f,_0xc5e6a7);_0x207363(_0xc5e6a7);});});}function respondWithStatusCode(_0x370874,_0x517e71){_0x517e71=_0x517e71||0xcc;return function(_0x3d0d60){if(_0x3d0d60){return _0x370874['sendStatus'](_0x517e71);}return _0x370874[_0xae13('0x2d')](_0x517e71)[_0xae13('0x2e')]();};}function respondWithResult(_0x526e4e,_0xa98d6c){_0xa98d6c=_0xa98d6c||0xc8;return function(_0x370ee0){if(_0x370ee0){return _0x526e4e[_0xae13('0x2d')](_0xa98d6c)[_0xae13('0x2f')](_0x370ee0);}};}function respondWithFilteredResult(_0x578e99,_0x41ceb7){return function(_0x27b737){if(_0x27b737){var _0x1d7152=_0x27b737[_0xae13('0x30')],_0x68ce70=_0x41ceb7['offset'],_0x742759=_0x41ceb7[_0xae13('0x31')]+_0x41ceb7['limit'],_0x27bcf3;if(_0x742759>=_0x1d7152){_0x742759=_0x1d7152;_0x27bcf3=0xc8;}else{_0x27bcf3=0xce;}_0x578e99[_0xae13('0x2d')](_0x27bcf3);return _0x578e99[_0xae13('0x32')](_0xae13('0x33'),_0x68ce70+'-'+_0x742759+'/'+_0x1d7152)[_0xae13('0x2f')](_0x27b737);}return null;};}function patchUpdates(_0x352aec){return function(_0x39718f){try{jsonpatch[_0xae13('0x34')](_0x39718f,_0x352aec,!![]);}catch(_0x48f0f6){return BPromise['reject'](_0x48f0f6);}return _0x39718f[_0xae13('0x35')]();};}function saveUpdates(_0x233896,_0xb3764d){return function(_0x3710d6){if(_0x3710d6){return _0x3710d6[_0xae13('0x36')](_0x233896)[_0xae13('0x23')](function(_0x126686){return _0x126686;});}return null;};}function removeEntity(_0x1a8708,_0x1fda10){return function(_0x23f9d7){if(_0x23f9d7){return _0x23f9d7['destroy']()[_0xae13('0x23')](function(){var _0x116270=_0x23f9d7[_0xae13('0x37')]({'plain':!![]});var _0x597001='OpenchannelAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x597001,'resourceId':_0x116270['id']}})['then'](function(){return _0x23f9d7;});})['then'](function(){_0x1a8708[_0xae13('0x2d')](0xcc)[_0xae13('0x2e')]();});}};}function handleEntityNotFound(_0x34a801,_0x5bb32a){return function(_0x337a61){if(!_0x337a61){_0x34a801[_0xae13('0x38')](0x194);}return _0x337a61;};}function handleError(_0x40764c,_0x1f5587){_0x1f5587=_0x1f5587||0x1f4;return function(_0x2405c3){logger['error'](_0x2405c3[_0xae13('0x39')]);if(_0x2405c3[_0xae13('0x3a')]){delete _0x2405c3[_0xae13('0x3a')];}_0x40764c['status'](_0x1f5587)['send'](_0x2405c3);};}exports[_0xae13('0x3b')]=function(_0xd7006d,_0x120346){var _0x3c3202={'include':[{'model':db[_0xae13('0x3c')],'as':'mandatoryDispositionPause'}]},_0x4a17bb={},_0x140f63={'count':0x0,'rows':[]};var _0x249058=_[_0xae13('0x3d')](db['OpenchannelAccount'][_0xae13('0x3e')],function(_0xfbe515){return{'name':_0xfbe515[_0xae13('0x3f')],'type':_0xfbe515[_0xae13('0x40')]['key']};});_0x4a17bb[_0xae13('0x41')]=_[_0xae13('0x3d')](_0x249058,_0xae13('0x3a'));_0x4a17bb[_0xae13('0x42')]=_['keys'](_0xd7006d[_0xae13('0x42')]);_0x4a17bb[_0xae13('0x43')]=_[_0xae13('0x44')](_0x4a17bb[_0xae13('0x41')],_0x4a17bb['query']);_0x3c3202['attributes']=_[_0xae13('0x44')](_0x4a17bb[_0xae13('0x41')],qs['fields'](_0xd7006d[_0xae13('0x42')]['fields']));_0x3c3202[_0xae13('0x45')]=_0x3c3202[_0xae13('0x45')][_0xae13('0x46')]?_0x3c3202['attributes']:_0x4a17bb[_0xae13('0x41')];if(!_0xd7006d[_0xae13('0x42')][_0xae13('0x47')](_0xae13('0x48'))){_0x3c3202['limit']=qs[_0xae13('0x49')](_0xd7006d[_0xae13('0x42')][_0xae13('0x49')]);_0x3c3202[_0xae13('0x31')]=qs[_0xae13('0x31')](_0xd7006d[_0xae13('0x42')][_0xae13('0x31')]);}_0x3c3202[_0xae13('0x4a')]=qs['sort'](_0xd7006d[_0xae13('0x42')]['sort']);_0x3c3202[_0xae13('0x4b')]=qs[_0xae13('0x43')](_[_0xae13('0x4c')](_0xd7006d[_0xae13('0x42')],_0x4a17bb['filters']),_0x249058);if(_0xd7006d[_0xae13('0x42')]['filter']){_0x3c3202[_0xae13('0x4b')]=_[_0xae13('0x4d')](_0x3c3202['where'],{'$or':_[_0xae13('0x3d')](_0x249058,function(_0xde904a){if(_0xde904a[_0xae13('0x40')]!==_0xae13('0x4e')){var _0x4291a9={};_0x4291a9[_0xde904a[_0xae13('0x3a')]]={'$like':'%'+_0xd7006d['query'][_0xae13('0x4f')]+'%'};return _0x4291a9;}})});}_0x3c3202=_[_0xae13('0x4d')]({},_0x3c3202,_0xd7006d[_0xae13('0x50')]);var _0x3dbfb7={'where':_0x3c3202[_0xae13('0x4b')]};return db['OpenchannelAccount'][_0xae13('0x30')](_0x3dbfb7)[_0xae13('0x23')](function(_0x8e6f1e){_0x140f63['count']=_0x8e6f1e;if(_0xd7006d['query']['includeAll']){_0x3c3202['include']=[{'all':!![]}];}return db[_0xae13('0x51')]['findAll'](_0x3c3202);})[_0xae13('0x23')](function(_0x5554a6){_0x140f63[_0xae13('0x52')]=_0x5554a6;return _0x140f63;})[_0xae13('0x23')](respondWithFilteredResult(_0x120346,_0x3c3202))[_0xae13('0x2c')](handleError(_0x120346,null));};exports[_0xae13('0x53')]=function(_0x4509ea,_0x53d341){var _0x10d730={'raw':![],'where':{'id':_0x4509ea['params']['id']},'include':[{'model':db[_0xae13('0x3c')],'as':_0xae13('0x54')}]},_0x2560f1={};_0x2560f1['model']=_['keys'](db['OpenchannelAccount']['rawAttributes']);_0x2560f1[_0xae13('0x42')]=_[_0xae13('0x55')](_0x4509ea['query']);_0x2560f1[_0xae13('0x43')]=_[_0xae13('0x44')](_0x2560f1['model'],_0x2560f1[_0xae13('0x42')]);_0x10d730[_0xae13('0x45')]=_[_0xae13('0x44')](_0x2560f1[_0xae13('0x41')],qs[_0xae13('0x56')](_0x4509ea[_0xae13('0x42')][_0xae13('0x56')]));_0x10d730[_0xae13('0x45')]=_0x10d730[_0xae13('0x45')][_0xae13('0x46')]?_0x10d730['attributes']:_0x2560f1[_0xae13('0x41')];if(_0x4509ea[_0xae13('0x42')][_0xae13('0x57')]){_0x10d730['include']=[{'all':!![]}];}_0x10d730=_[_0xae13('0x4d')]({},_0x10d730,_0x4509ea['options']);return db[_0xae13('0x51')][_0xae13('0x58')](_0x10d730)[_0xae13('0x23')](handleEntityNotFound(_0x53d341,null))['then'](respondWithResult(_0x53d341,null))['catch'](handleError(_0x53d341,null));};exports[_0xae13('0x59')]=function(_0x3fa6e4,_0x21d732){return db[_0xae13('0x51')][_0xae13('0x59')](_0x3fa6e4[_0xae13('0x5a')],{})[_0xae13('0x23')](function(_0x4995d9){var _0x1a653e=_0x3fa6e4[_0xae13('0x5b')][_0xae13('0x37')]({'plain':!![]});if(!_0x1a653e)throw new Error(_0xae13('0x5c'));if(_0x1a653e[_0xae13('0x5d')]===_0xae13('0x5b')){var _0x14f543=_0x4995d9['get']({'plain':!![]});var _0x40439f=_0xae13('0x5e');return db['UserProfileSection'][_0xae13('0x58')]({'where':{'name':_0x40439f,'userProfileId':_0x1a653e[_0xae13('0x5f')]},'raw':!![]})[_0xae13('0x23')](function(_0x538e2a){if(_0x538e2a&&_0x538e2a[_0xae13('0x60')]===0x0){return db[_0xae13('0x61')]['create']({'name':_0x14f543[_0xae13('0x3a')],'resourceId':_0x14f543['id'],'type':_0x538e2a[_0xae13('0x3a')],'sectionId':_0x538e2a['id']},{})[_0xae13('0x23')](function(){return _0x4995d9;});}else{return _0x4995d9;}})[_0xae13('0x2c')](function(_0x13f508){logger[_0xae13('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13f508);throw _0x13f508;});}return _0x4995d9;})['then'](respondWithResult(_0x21d732,0xc9))[_0xae13('0x2c')](handleError(_0x21d732,null));};exports[_0xae13('0x36')]=function(_0x135704,_0x397bea){if(_0x135704[_0xae13('0x5a')]['id']){delete _0x135704[_0xae13('0x5a')]['id'];}return db['OpenchannelAccount'][_0xae13('0x58')]({'where':{'id':_0x135704[_0xae13('0x62')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x397bea,null))[_0xae13('0x23')](saveUpdates(_0x135704[_0xae13('0x5a')],null))[_0xae13('0x23')](respondWithResult(_0x397bea,null))[_0xae13('0x2c')](handleError(_0x397bea,null));};exports[_0xae13('0x63')]=function(_0x2754e0,_0x31e4af){return db[_0xae13('0x51')][_0xae13('0x58')]({'where':{'id':_0x2754e0[_0xae13('0x62')]['id']}})[_0xae13('0x23')](handleEntityNotFound(_0x31e4af,null))[_0xae13('0x23')](removeEntity(_0x31e4af,null))[_0xae13('0x2c')](handleError(_0x31e4af,null));};exports[_0xae13('0x64')]=function(_0xc3ef7d,_0x4e623b){return db[_0xae13('0x51')][_0xae13('0x64')]()['then'](respondWithResult(_0x4e623b,null))[_0xae13('0x2c')](handleError(_0x4e623b,null));};exports['addDisposition']=function(_0x5f120d,_0x20b8e5,_0x25cc60){if(_0x5f120d[_0xae13('0x5a')]['id']){delete _0x5f120d[_0xae13('0x5a')]['id'];}return db[_0xae13('0x51')][_0xae13('0x58')]({'where':{'id':_0x5f120d['params']['id']}})['then'](handleEntityNotFound(_0x20b8e5,null))[_0xae13('0x23')](function(_0xaa75da){if(_0xaa75da){_0x5f120d[_0xae13('0x5a')]['OpenchannelAccountId']=_0xaa75da['id'];return db[_0xae13('0x65')]['create'](_0x5f120d[_0xae13('0x5a')]);}})[_0xae13('0x23')](respondWithResult(_0x20b8e5,null))[_0xae13('0x2c')](handleError(_0x20b8e5,null));};exports[_0xae13('0x66')]=function(_0x21ca40,_0x5e8e4f,_0x3ff1a5){var _0x39b2e5={'raw':![],'where':{}};var _0x5ef8a2={};var _0x1c1a59={'count':0x0,'rows':[]};return db[_0xae13('0x51')][_0xae13('0x67')]({'where':{'id':_0x21ca40[_0xae13('0x62')]['id']}})[_0xae13('0x23')](handleEntityNotFound(_0x5e8e4f,null))[_0xae13('0x23')](function(_0x519134){if(_0x519134){_0x5ef8a2[_0xae13('0x41')]=_['keys'](db[_0xae13('0x65')]['rawAttributes']);_0x5ef8a2[_0xae13('0x42')]=_[_0xae13('0x55')](_0x21ca40['query']);_0x5ef8a2[_0xae13('0x43')]=_[_0xae13('0x44')](_0x5ef8a2[_0xae13('0x41')],_0x5ef8a2[_0xae13('0x42')]);_0x39b2e5[_0xae13('0x45')]=_[_0xae13('0x44')](_0x5ef8a2[_0xae13('0x41')],qs[_0xae13('0x56')](_0x21ca40['query'][_0xae13('0x56')]));_0x39b2e5[_0xae13('0x45')]=_0x39b2e5[_0xae13('0x45')][_0xae13('0x46')]?_0x39b2e5[_0xae13('0x45')]:_0x5ef8a2[_0xae13('0x41')];if(!_0x21ca40[_0xae13('0x42')][_0xae13('0x47')](_0xae13('0x48'))){_0x39b2e5[_0xae13('0x49')]=qs['limit'](_0x21ca40[_0xae13('0x42')]['limit']);_0x39b2e5['offset']=qs[_0xae13('0x31')](_0x21ca40[_0xae13('0x42')][_0xae13('0x31')]);}_0x39b2e5['order']=qs[_0xae13('0x68')](_0x21ca40['query'][_0xae13('0x68')]);_0x39b2e5['where']=qs[_0xae13('0x43')](_[_0xae13('0x4c')](_0x21ca40['query'],_0x5ef8a2[_0xae13('0x43')]));_0x39b2e5[_0xae13('0x4b')]['OpenchannelAccountId']=_0x519134['id'];if(_0x21ca40['query'][_0xae13('0x4f')]){_0x39b2e5['where']=_['merge'](_0x39b2e5[_0xae13('0x4b')],{'$or':_['map'](_0x39b2e5[_0xae13('0x45')],function(_0x4bc94a){var _0x2e6ae0={};_0x2e6ae0[_0x4bc94a]={'$like':'%'+_0x21ca40[_0xae13('0x42')][_0xae13('0x4f')]+'%'};return _0x2e6ae0;})});}_0x39b2e5=_[_0xae13('0x4d')]({},_0x39b2e5,_0x21ca40[_0xae13('0x50')]);return db[_0xae13('0x65')]['count']({'where':_0x39b2e5[_0xae13('0x4b')]})[_0xae13('0x23')](function(_0x5a5776){_0x1c1a59['count']=_0x5a5776;if(_0x21ca40['query'][_0xae13('0x57')]){_0x39b2e5['include']=[{'all':!![]}];}return db[_0xae13('0x65')]['findAll'](_0x39b2e5);})['then'](function(_0x2e0acb){_0x1c1a59[_0xae13('0x52')]=_0x2e0acb;return _0x1c1a59;});}})[_0xae13('0x23')](respondWithFilteredResult(_0x5e8e4f,_0x39b2e5))[_0xae13('0x2c')](handleError(_0x5e8e4f,null));};exports[_0xae13('0x69')]=function(_0x317ca7,_0x5c3f58,_0x2d714a){return db[_0xae13('0x51')][_0xae13('0x58')]({'where':{'id':_0x317ca7[_0xae13('0x62')]['id']}})['then'](handleEntityNotFound(_0x5c3f58,null))[_0xae13('0x23')](function(_0x1ef79f){if(_0x1ef79f){return _0x1ef79f[_0xae13('0x69')](_0x317ca7['query']['ids']);}})[_0xae13('0x23')](respondWithStatusCode(_0x5c3f58,null))[_0xae13('0x2c')](handleError(_0x5c3f58,null));};exports[_0xae13('0x6a')]=function(_0x745b8d,_0x13836d,_0x307a37){if(_0x745b8d[_0xae13('0x5a')]['id']){delete _0x745b8d[_0xae13('0x5a')]['id'];}return db['OpenchannelAccount'][_0xae13('0x58')]({'where':{'id':_0x745b8d[_0xae13('0x62')]['id']}})['then'](handleEntityNotFound(_0x13836d,null))[_0xae13('0x23')](function(_0x13783b){if(_0x13783b){_0x745b8d['body'][_0xae13('0x6b')]=_0x13783b['id'];return db[_0xae13('0x6c')]['create'](_0x745b8d[_0xae13('0x5a')]);}})[_0xae13('0x23')](respondWithResult(_0x13836d,null))[_0xae13('0x2c')](handleError(_0x13836d,null));};exports['getAnswers']=function(_0x4cbe2c,_0x1d5d77,_0x342a0c){var _0x1838dd={'raw':![],'where':{}};var _0x4ff445={};var _0x76b83f={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xae13('0x67')]({'where':{'id':_0x4cbe2c[_0xae13('0x62')]['id']}})[_0xae13('0x23')](handleEntityNotFound(_0x1d5d77,null))[_0xae13('0x23')](function(_0x23b9aa){if(_0x23b9aa){_0x4ff445[_0xae13('0x41')]=_[_0xae13('0x55')](db[_0xae13('0x6c')][_0xae13('0x3e')]);_0x4ff445[_0xae13('0x42')]=_['keys'](_0x4cbe2c[_0xae13('0x42')]);_0x4ff445['filters']=_[_0xae13('0x44')](_0x4ff445[_0xae13('0x41')],_0x4ff445[_0xae13('0x42')]);_0x1838dd[_0xae13('0x45')]=_[_0xae13('0x44')](_0x4ff445[_0xae13('0x41')],qs[_0xae13('0x56')](_0x4cbe2c[_0xae13('0x42')][_0xae13('0x56')]));_0x1838dd[_0xae13('0x45')]=_0x1838dd['attributes'][_0xae13('0x46')]?_0x1838dd[_0xae13('0x45')]:_0x4ff445[_0xae13('0x41')];if(!_0x4cbe2c[_0xae13('0x42')][_0xae13('0x47')](_0xae13('0x48'))){_0x1838dd[_0xae13('0x49')]=qs[_0xae13('0x49')](_0x4cbe2c['query'][_0xae13('0x49')]);_0x1838dd[_0xae13('0x31')]=qs[_0xae13('0x31')](_0x4cbe2c[_0xae13('0x42')][_0xae13('0x31')]);}_0x1838dd[_0xae13('0x4a')]=qs[_0xae13('0x68')](_0x4cbe2c['query'][_0xae13('0x68')]);_0x1838dd[_0xae13('0x4b')]=qs[_0xae13('0x43')](_[_0xae13('0x4c')](_0x4cbe2c[_0xae13('0x42')],_0x4ff445[_0xae13('0x43')]));_0x1838dd['where'][_0xae13('0x6b')]=_0x23b9aa['id'];if(_0x4cbe2c[_0xae13('0x42')][_0xae13('0x4f')]){_0x1838dd[_0xae13('0x4b')]=_[_0xae13('0x4d')](_0x1838dd[_0xae13('0x4b')],{'$or':_[_0xae13('0x3d')](_0x1838dd[_0xae13('0x45')],function(_0xfb9c02){var _0x1a586d={};_0x1a586d[_0xfb9c02]={'$like':'%'+_0x4cbe2c[_0xae13('0x42')]['filter']+'%'};return _0x1a586d;})});}_0x1838dd=_[_0xae13('0x4d')]({},_0x1838dd,_0x4cbe2c[_0xae13('0x50')]);return db[_0xae13('0x6c')][_0xae13('0x30')]({'where':_0x1838dd[_0xae13('0x4b')]})[_0xae13('0x23')](function(_0x5339a5){_0x76b83f['count']=_0x5339a5;if(_0x4cbe2c[_0xae13('0x42')]['includeAll']){_0x1838dd[_0xae13('0x6d')]=[{'all':!![]}];}return db[_0xae13('0x6c')][_0xae13('0x6e')](_0x1838dd);})[_0xae13('0x23')](function(_0x4ec66d){_0x76b83f['rows']=_0x4ec66d;return _0x76b83f;});}})[_0xae13('0x23')](respondWithFilteredResult(_0x1d5d77,_0x1838dd))[_0xae13('0x2c')](handleError(_0x1d5d77,null));};exports[_0xae13('0x6f')]=function(_0x4e5555,_0x4e4a75,_0x17d368){return db[_0xae13('0x51')][_0xae13('0x58')]({'where':{'id':_0x4e5555[_0xae13('0x62')]['id']}})[_0xae13('0x23')](handleEntityNotFound(_0x4e4a75,null))[_0xae13('0x23')](function(_0x59a061){if(_0x59a061){return _0x59a061[_0xae13('0x6f')](_0x4e5555[_0xae13('0x42')][_0xae13('0x70')]);}})['then'](respondWithStatusCode(_0x4e4a75,null))['catch'](handleError(_0x4e4a75,null));};exports[_0xae13('0x71')]=function(_0x25d1b6,_0x19e196,_0x43ce15){var _0x234305={'body':_0x25d1b6[_0xae13('0x5a')],'channel':_0xae13('0x72')};var _0x588b4c=[];var _0x25178e=[];var _0x1bd696={};var _0x4915d8=![];return db[_0xae13('0x73')]['describe']()[_0xae13('0x23')](function(_0x3c6c12){if(!_0x3c6c12){throw new db[(_0xae13('0x74'))][(_0xae13('0x75'))](_0xae13('0x76'));}_0x588b4c=_[_0xae13('0x77')](_[_0xae13('0x55')](_0x3c6c12),[_0xae13('0x78'),'updatedAt']);_0x25178e=_[_0xae13('0x77')](_[_0xae13('0x55')](_0x3c6c12),[_0xae13('0x78'),_0xae13('0x79'),_0xae13('0x7a'),'ListId']);if(_0x25d1b6['body']['id']){delete _0x25d1b6[_0xae13('0x5a')]['id'];}if(_[_0xae13('0x7b')](_0x25d1b6[_0xae13('0x5a')][_0xae13('0x7c')])){throw new db[(_0xae13('0x74'))][(_0xae13('0x75'))](_0xae13('0x7d'));}if(_[_0xae13('0x7b')](_0x25d1b6['body']['body'])||_0x25d1b6['body']['body']===''){throw new db['Sequelize'][(_0xae13('0x75'))](_0xae13('0x7e'));}if(_['isNil'](_0x25d1b6[_0xae13('0x5a')][_0xae13('0x7f')])){throw new db['Sequelize']['ValidationError'](_0xae13('0x80')+_0x25178e);}if(!_['includes'](_0x25178e,_0x25d1b6[_0xae13('0x5a')]['mapKey'])){throw new db[(_0xae13('0x74'))][(_0xae13('0x75'))](_0xae13('0x81')+_0x25178e);}_0x1bd696[_0x25d1b6[_0xae13('0x5a')]['mapKey']]=_0x25d1b6['body'][_0xae13('0x7c')];})['then'](function(){return db[_0xae13('0x51')][_0xae13('0x58')]({'where':{'id':_0x25d1b6['params']['id']},'include':[{'model':db[_0xae13('0x82')],'as':_0xae13('0x83'),'include':[{'model':db[_0xae13('0x73')],'as':_0xae13('0x84'),'where':_0x1bd696,'limit':0x1,'order':[['updatedAt',_0xae13('0x85')]]}]},{'model':db['OpenchannelApplication'],'as':_0xae13('0x86')}]});})[_0xae13('0x23')](handleEntityNotFound(_0x19e196,null))[_0xae13('0x23')](function(_0x127b67){if(_0x127b67&&_0x127b67['List']){_0x234305['account']=_0x127b67;_0x234305[_0xae13('0x87')]=_0x127b67[_0xae13('0x86')];_0x234305['list']=_0x127b67[_0xae13('0x83')];_0x234305['applications']=_[_0xae13('0x88')](_0x234305['applications'],[_0xae13('0x89')],[_0xae13('0x8a')]);if(_0x234305['account'][_0xae13('0x86')]){delete _0x234305['account']['Applications'];}if(_0x234305[_0xae13('0x8b')][_0xae13('0x83')]&&_0x234305[_0xae13('0x8b')][_0xae13('0x83')][_0xae13('0x84')][_0xae13('0x46')]){return _0x234305[_0xae13('0x8b')]['List'][_0xae13('0x84')][0x0];}var _0x39fc7c=_[_0xae13('0x1d')](_0x25d1b6[_0xae13('0x5a')],{'firstName':_0x25d1b6[_0xae13('0x5a')][_0xae13('0x7c')],'ListId':_0x127b67[_0xae13('0x8c')]});_0x39fc7c[_0x25d1b6[_0xae13('0x5a')][_0xae13('0x7f')]]=_0x25d1b6[_0xae13('0x5a')][_0xae13('0x7c')];return db['CmContact']['create'](_0x39fc7c,{'fields':_0x588b4c,'raw':!![]});}})['then'](handleEntityNotFound(_0x19e196,null))[_0xae13('0x23')](function(_0x42919c){_0x234305[_0xae13('0x8d')]=_0x42919c;if(_0x42919c){var _0x188883={'ContactId':_0x42919c['id'],'OpenchannelAccountId':_0x25d1b6[_0xae13('0x62')]['id'],'from':(_0x42919c[_0xae13('0x8e')]||'')+'\x20'+(_0x42919c['lastName']||'')};var _0x2da9e2={'OpenchannelAccountId':_0x25d1b6[_0xae13('0x62')]['id'],'closed':![]};if(_0x25d1b6['body']['threadId']){_0x2da9e2[_0xae13('0x8f')]=_0x25d1b6['body'][_0xae13('0x8f')];return db[_0xae13('0x90')][_0xae13('0x58')]({'where':_0x2da9e2})[_0xae13('0x23')](function(_0x49338e){if(_0x49338e){return[_0x49338e,![]];}_0x188883[_0xae13('0x8f')]=_0x25d1b6['body']['threadId'];_0x188883['externalUrl']=_0x25d1b6[_0xae13('0x5a')][_0xae13('0x91')];return db[_0xae13('0x90')][_0xae13('0x59')](_0x188883)[_0xae13('0x23')](function(_0x1403b9){return[_0x1403b9,!![]];});});}else{_0x2da9e2[_0xae13('0x8f')]=null;}_0x2da9e2[_0xae13('0x92')]=_0x42919c['id'];return db[_0xae13('0x90')]['find']({'where':_0x2da9e2})[_0xae13('0x23')](function(_0x2c159a){if(_0x2c159a){return[_0x2c159a,![]];}return db[_0xae13('0x90')][_0xae13('0x59')](_0x188883)[_0xae13('0x23')](function(_0x490cd7){return[_0x490cd7,!![]];});});}})[_0xae13('0x93')](function(_0x446773,_0x1d155e){if(_0x446773){_0x4915d8=_0x1d155e;if(!_0x1d155e){var _0x31e72d={'from':(_0x234305[_0xae13('0x8d')]['firstName']||'')+'\x20'+(_0x234305[_0xae13('0x8d')][_0xae13('0x94')]||'')};if(_0x25d1b6[_0xae13('0x5a')][_0xae13('0x8f')]&&_0x25d1b6[_0xae13('0x5a')][_0xae13('0x95')]&&_0x25d1b6['body']['threadId']!=_0x25d1b6[_0xae13('0x5a')][_0xae13('0x95')]){_0x31e72d[_0xae13('0x8f')]=_0x25d1b6['body'][_0xae13('0x95')];}return _0x446773[_0xae13('0x36')](_0x31e72d);}else{return _0x446773;}}})[_0xae13('0x23')](function(_0x3a4acc){_0x234305[_0xae13('0x96')]=_0x3a4acc['get']({'plain':!![]});_0x234305[_0xae13('0x96')][_0xae13('0x97')]=_0x4915d8;if(_0x234305[_0xae13('0x96')]['created']){if(_0x234305[_0xae13('0x8b')][_0xae13('0x98')]){_0x234305[_0xae13('0x87')][_0xae13('0x99')]({'id':0x0,'priority':_0x234305[_0xae13('0x87')][_0xae13('0x46')]+0x1,'app':_0xae13('0x9a'),'appdata':_0xae13('0x9b'),'interval':_0xae13('0x9c')});}}return db['OpenchannelMessage'][_0xae13('0x59')]({'body':_0x25d1b6[_0xae13('0x5a')][_0xae13('0x5a')],'OpenchannelAccountId':_0x25d1b6[_0xae13('0x62')]['id'],'OpenchannelInteractionId':_0x3a4acc['id'],'direction':'in','ContactId':_0x234305[_0xae13('0x8d')]['id'],'AttachmentId':_0x25d1b6[_0xae13('0x5a')]['AttachmentId']});})[_0xae13('0x23')](function(_0x322aa7){_0x234305[_0xae13('0x2b')]=_0x322aa7;if(_0x234305[_0xae13('0x96')][_0xae13('0x9d')]){return db['User'][_0xae13('0x58')]({'attributes':['id','name'],'where':{'id':_0x234305['interaction'][_0xae13('0x9d')]}})[_0xae13('0x23')](function(_0x45361c){if(_0x45361c){_0x234305[_0xae13('0x87')][_0xae13('0x9e')]({'id':0x0,'priority':0x0,'app':_0xae13('0x9f'),'appdata':_0x45361c[_0xae13('0x3a')]+','+(_0x234305[_0xae13('0x8b')][_0xae13('0xa0')]||0xa),'interval':_0xae13('0x9c')});_0x234305['forcedOwnership']=![];}return respondWithRpcPromise(_0xae13('0xa1'),'startRouting',_0x234305);});}return respondWithRpcPromise(_0xae13('0xa1'),_0xae13('0xa2'),_0x234305);})[_0xae13('0x23')](function(_0x1b2621){respondWithRpcPromise(_0xae13('0xa3'),'EventManager',{'event':_0xae13('0x71'),'message':_0x1b2621},client9002);return _0x1b2621;})[_0xae13('0x23')](respondWithResult(_0x19e196,null))[_0xae13('0x2c')](handleError(_0x19e196,null));};exports[_0xae13('0xa4')]=function(_0x4829c5,_0x1cbdb7,_0x179d00){return db[_0xae13('0x51')][_0xae13('0x67')]({'where':{'id':_0x4829c5[_0xae13('0x62')]['id']}})[_0xae13('0x23')](handleEntityNotFound(_0x1cbdb7,null))['then'](function(_0xbe8540){if(_0xbe8540){return db['sequelize'][_0xae13('0xa5')](function(_0x87b20e){return db['OpenchannelApplication'][_0xae13('0x63')]({'where':{'OpenchannelAccountId':_0x4829c5[_0xae13('0x62')]['id']},'transaction':_0x87b20e})[_0xae13('0x23')](function(_0x370c75){var _0x2dcd00=_[_0xae13('0x3d')](_0x4829c5['body'],function(_0x5620cd){_0x5620cd[_0xae13('0x6b')]=_0x4829c5[_0xae13('0x62')]['id'];return _0x5620cd;});return db[_0xae13('0xa6')][_0xae13('0xa7')](_0x2dcd00,{'transaction':_0x87b20e});});})[_0xae13('0x23')](function(){return db[_0xae13('0xa6')][_0xae13('0xa8')]({'where':{'OpenchannelAccountId':_0x4829c5[_0xae13('0x62')]['id']},'order':_0xae13('0x89')});});}})['then'](respondWithResult(_0x1cbdb7,null))[_0xae13('0x2c')](handleError(_0x1cbdb7,null));};exports[_0xae13('0xa9')]=function(_0x28668b,_0x4d3e2f,_0x28f2a7){var _0x55f6fa={};var _0x17b68e={};var _0x494a0e;var _0x3a7f27;return db[_0xae13('0x51')][_0xae13('0x67')]({'where':{'id':_0x28668b[_0xae13('0x62')]['id']}})[_0xae13('0x23')](handleEntityNotFound(_0x4d3e2f,null))[_0xae13('0x23')](function(_0x5b9920){if(_0x5b9920){_0x494a0e=_0x5b9920;_0x17b68e[_0xae13('0x41')]=_['keys'](db[_0xae13('0xa6')][_0xae13('0x3e')]);_0x17b68e[_0xae13('0x42')]=_[_0xae13('0x55')](_0x28668b[_0xae13('0x42')]);_0x17b68e[_0xae13('0x43')]=_[_0xae13('0x44')](_0x17b68e[_0xae13('0x41')],_0x17b68e[_0xae13('0x42')]);_0x55f6fa['attributes']=_['intersection'](_0x17b68e['model'],qs[_0xae13('0x56')](_0x28668b[_0xae13('0x42')]['fields']));_0x55f6fa['attributes']=_0x55f6fa[_0xae13('0x45')][_0xae13('0x46')]?_0x55f6fa[_0xae13('0x45')]:_0x17b68e['model'];_0x55f6fa['order']=qs['sort'](_0x28668b[_0xae13('0x42')][_0xae13('0x68')]);_0x55f6fa[_0xae13('0x4b')]=qs['filters'](_[_0xae13('0x4c')](_0x28668b[_0xae13('0x42')],_0x17b68e[_0xae13('0x43')]));if(_0x28668b['query'][_0xae13('0x4f')]){_0x55f6fa[_0xae13('0x4b')]=_[_0xae13('0x4d')](_0x55f6fa[_0xae13('0x4b')],{'$or':_['map'](_0x55f6fa['attributes'],function(_0x43ffdb){var _0x5f0cb9={};_0x5f0cb9[_0x43ffdb]={'$like':'%'+_0x28668b[_0xae13('0x42')][_0xae13('0x4f')]+'%'};return _0x5f0cb9;})});}_0x55f6fa=_['merge']({},_0x55f6fa,_0x28668b[_0xae13('0x50')]);return _0x494a0e[_0xae13('0xa9')](_0x55f6fa);}})[_0xae13('0x23')](function(_0x29d27d){if(_0x29d27d){_0x3a7f27=_0x29d27d[_0xae13('0x46')];if(!_0x28668b['query'][_0xae13('0x47')](_0xae13('0x48'))){_0x55f6fa['limit']=qs[_0xae13('0x49')](_0x28668b[_0xae13('0x42')][_0xae13('0x49')]);_0x55f6fa[_0xae13('0x31')]=qs['offset'](_0x28668b[_0xae13('0x42')][_0xae13('0x31')]);}return _0x494a0e[_0xae13('0xa9')](_0x55f6fa);}})[_0xae13('0x23')](function(_0x547f26){if(_0x547f26){return _0x547f26?{'count':_0x3a7f27,'rows':_0x547f26}:null;}})['then'](respondWithResult(_0x4d3e2f,null))[_0xae13('0x2c')](handleError(_0x4d3e2f,null));};exports[_0xae13('0xaa')]=function(_0x10b24c,_0x3938dd,_0x19b56a){var _0x34878d={'raw':![],'where':{}};var _0x3a7b02={};var _0xfa9ba6={'count':0x0,'rows':[]};return db[_0xae13('0x51')][_0xae13('0x67')]({'where':{'id':_0x10b24c['params']['id']}})[_0xae13('0x23')](handleEntityNotFound(_0x3938dd,null))[_0xae13('0x23')](function(_0x2378d1){if(_0x2378d1){_0x3a7b02[_0xae13('0x41')]=_['keys'](db[_0xae13('0x90')][_0xae13('0x3e')]);_0x3a7b02[_0xae13('0x42')]=_[_0xae13('0x55')](_0x10b24c[_0xae13('0x42')]);_0x3a7b02['filters']=_[_0xae13('0x44')](_0x3a7b02[_0xae13('0x41')],_0x3a7b02[_0xae13('0x42')]);_0x34878d[_0xae13('0x45')]=_[_0xae13('0x44')](_0x3a7b02[_0xae13('0x41')],qs[_0xae13('0x56')](_0x10b24c['query'][_0xae13('0x56')]));_0x34878d[_0xae13('0x45')]=_0x34878d['attributes'][_0xae13('0x46')]?_0x34878d[_0xae13('0x45')]:_0x3a7b02[_0xae13('0x41')];if(!_0x10b24c[_0xae13('0x42')][_0xae13('0x47')](_0xae13('0x48'))){_0x34878d[_0xae13('0x49')]=qs[_0xae13('0x49')](_0x10b24c[_0xae13('0x42')]['limit']);_0x34878d[_0xae13('0x31')]=qs[_0xae13('0x31')](_0x10b24c[_0xae13('0x42')]['offset']);}_0x34878d['order']=qs['sort'](_0x10b24c[_0xae13('0x42')][_0xae13('0x68')]);_0x34878d[_0xae13('0x4b')]=qs[_0xae13('0x43')](_[_0xae13('0x4c')](_0x10b24c[_0xae13('0x42')],_0x3a7b02[_0xae13('0x43')]));_0x34878d[_0xae13('0x4b')][_0xae13('0x6b')]=_0x2378d1['id'];if(_0x10b24c['query'][_0xae13('0x4f')]){_0x34878d['where']=_['merge'](_0x34878d[_0xae13('0x4b')],{'$or':_[_0xae13('0x3d')](_0x34878d[_0xae13('0x45')],function(_0x3e6229){var _0x3d4d5c={};_0x3d4d5c[_0x3e6229]={'$like':'%'+_0x10b24c[_0xae13('0x42')][_0xae13('0x4f')]+'%'};return _0x3d4d5c;})});}_0x34878d=_['merge']({},_0x34878d,_0x10b24c['options']);return db[_0xae13('0x90')][_0xae13('0x30')]({'where':_0x34878d[_0xae13('0x4b')]})['then'](function(_0x5ff432){_0xfa9ba6[_0xae13('0x30')]=_0x5ff432;if(_0x10b24c[_0xae13('0x42')][_0xae13('0x57')]){_0x34878d[_0xae13('0x6d')]=[{'model':db[_0xae13('0x73')],'as':_0xae13('0xab'),'required':![]},{'model':db[_0xae13('0xac')],'as':_0xae13('0xad'),'attributes':['name',_0xae13('0xae'),_0xae13('0xaf')],'required':![]},{'model':db[_0xae13('0xb0')],'as':_0xae13('0xb1'),'attributes':['id',_0xae13('0x3a'),'color'],'where':_0x10b24c[_0xae13('0x42')][_0xae13('0xb2')]?{'id':_0x10b24c[_0xae13('0x42')]['tag']}:undefined,'required':_0x10b24c[_0xae13('0x42')]['tag']?!![]:![]}];}return db[_0xae13('0x90')][_0xae13('0x6e')](_0x34878d);})[_0xae13('0x23')](function(_0x47b8b9){_0xfa9ba6[_0xae13('0x52')]=_0x47b8b9;return _0xfa9ba6;});}})[_0xae13('0x23')](respondWithFilteredResult(_0x3938dd,_0x34878d))[_0xae13('0x2c')](handleError(_0x3938dd,null));};exports[_0xae13('0xb3')]=function(_0x1c551d,_0x27009d,_0x5403bd){return db['OpenchannelAccount'][_0xae13('0x58')]({'where':{'id':_0x1c551d[_0xae13('0x62')]['id']}})[_0xae13('0x23')](handleEntityNotFound(_0x27009d,null))[_0xae13('0x23')](function(_0x5271c2){if(_0x5271c2){return _0x5271c2[_0xae13('0xb3')](_0x1c551d[_0xae13('0x5a')]['ids'],_[_0xae13('0xb4')](_0x1c551d[_0xae13('0x5a')],[_0xae13('0x70'),'id'])||{})[_0xae13('0x93')](function(_0xf02c47){for(var _0x2831cf=0x0;_0x2831cf<_0x1c551d[_0xae13('0x5a')][_0xae13('0x70')][_0xae13('0x46')];_0x2831cf+=0x1){socket[_0xae13('0xb5')]('userOpenchannelAccount:save',{'UserId':_0x1c551d[_0xae13('0x5a')]['ids'][_0x2831cf],'OpenchannelAccountId':_0x1c551d[_0xae13('0x62')]['id']});}return _0xf02c47;});}})[_0xae13('0x23')](respondWithResult(_0x27009d,null))[_0xae13('0x2c')](handleError(_0x27009d,null));};exports[_0xae13('0xb6')]=function(_0x2c5070,_0x280114,_0x2c09a7){return db[_0xae13('0x51')]['find']({'where':{'id':_0x2c5070['params']['id']}})[_0xae13('0x23')](handleEntityNotFound(_0x280114,null))[_0xae13('0x23')](function(_0x135ecf){if(_0x135ecf){return _0x135ecf[_0xae13('0xb6')](_0x2c5070['query']['ids'])[_0xae13('0x23')](function(){if(_[_0xae13('0xb7')](_0x2c5070[_0xae13('0x42')][_0xae13('0x70')])){for(var _0x449827=0x0;_0x449827<_0x2c5070[_0xae13('0x42')]['ids']['length'];_0x449827+=0x1){socket[_0xae13('0xb5')]('userOpenchannelAccount:remove',{'UserId':Number(_0x2c5070[_0xae13('0x42')]['ids'][_0x449827]),'OpenchannelAccountId':Number(_0x2c5070['params']['id'])});}}else{socket[_0xae13('0xb5')]('userOpenchannelAccount:remove',{'UserId':Number(_0x2c5070[_0xae13('0x42')][_0xae13('0x70')]),'OpenchannelAccountId':Number(_0x2c5070['params']['id'])});}});}})[_0xae13('0x23')](respondWithStatusCode(_0x280114,null))[_0xae13('0x2c')](handleError(_0x280114,null));};exports[_0xae13('0xb8')]=function(_0x2951a2,_0x483638,_0x4a30e1){var _0x2509f1={};var _0x4bfb83={};var _0x45ac16;var _0x4632a3;return db[_0xae13('0x51')][_0xae13('0x67')]({'where':{'id':_0x2951a2[_0xae13('0x62')]['id']}})['then'](handleEntityNotFound(_0x483638,null))['then'](function(_0x261146){if(_0x261146){_0x45ac16=_0x261146;_0x4bfb83[_0xae13('0x41')]=_[_0xae13('0x55')](db['User']['rawAttributes']);_0x4bfb83[_0xae13('0x42')]=_['keys'](_0x2951a2['query']);_0x4bfb83[_0xae13('0x43')]=_['intersection'](_0x4bfb83[_0xae13('0x41')],_0x4bfb83['query']);_0x2509f1[_0xae13('0x45')]=_[_0xae13('0x44')](_0x4bfb83[_0xae13('0x41')],qs[_0xae13('0x56')](_0x2951a2[_0xae13('0x42')][_0xae13('0x56')]));_0x2509f1[_0xae13('0x45')]=_0x2509f1[_0xae13('0x45')][_0xae13('0x46')]?_0x2509f1[_0xae13('0x45')]:_0x4bfb83[_0xae13('0x41')];_0x2509f1[_0xae13('0x4a')]=qs[_0xae13('0x68')](_0x2951a2[_0xae13('0x42')]['sort']);_0x2509f1['where']=qs[_0xae13('0x43')](_[_0xae13('0x4c')](_0x2951a2[_0xae13('0x42')],_0x4bfb83[_0xae13('0x43')]));if(_0x2951a2[_0xae13('0x42')][_0xae13('0x4f')]){_0x2509f1['where']=_[_0xae13('0x4d')](_0x2509f1[_0xae13('0x4b')],{'$or':_[_0xae13('0x3d')](_0x2509f1[_0xae13('0x45')],function(_0x432731){var _0x448e1f={};_0x448e1f[_0x432731]={'$like':'%'+_0x2951a2['query']['filter']+'%'};return _0x448e1f;})});}_0x2509f1=_['merge']({},_0x2509f1,_0x2951a2['options']);return _0x45ac16[_0xae13('0xb8')](_0x2509f1);}})[_0xae13('0x23')](function(_0x1439b0){if(_0x1439b0){_0x4632a3=_0x1439b0[_0xae13('0x46')];if(!_0x2951a2['query'][_0xae13('0x47')](_0xae13('0x48'))){_0x2509f1[_0xae13('0x49')]=qs[_0xae13('0x49')](_0x2951a2['query'][_0xae13('0x49')]);_0x2509f1[_0xae13('0x31')]=qs['offset'](_0x2951a2[_0xae13('0x42')][_0xae13('0x31')]);}return _0x45ac16[_0xae13('0xb8')](_0x2509f1);}})[_0xae13('0x23')](function(_0x401203){if(_0x401203){return _0x401203?{'count':_0x4632a3,'rows':_0x401203}:null;}})[_0xae13('0x23')](respondWithResult(_0x483638,null))[_0xae13('0x2c')](handleError(_0x483638,null));};exports[_0xae13('0xb9')]=function(_0x515fd1,_0x60d488,_0x1452fd){var _0x14ba38,_0xd462c5,_0x22607f;if(_[_0xae13('0x7b')](_0x515fd1[_0xae13('0x5a')][_0xae13('0x5a')])||_0x515fd1[_0xae13('0x5a')]['body']===''){throw new db[(_0xae13('0x74'))][(_0xae13('0x75'))](_0xae13('0x7e'));}if(_[_0xae13('0x7b')](_0x515fd1[_0xae13('0x5a')]['to'])){}_0x14ba38=_0x515fd1[_0xae13('0x5a')]['to'];return db[_0xae13('0x51')][_0xae13('0x67')]({'where':{'id':_0x515fd1['params']['id']}})['then'](handleEntityNotFound(_0x60d488,null))['then'](function(_0x30db02){if(_0x30db02){return db[_0xae13('0x51')][_0xae13('0x58')]({'where':{'id':_0x30db02['id']},'include':[{'model':db[_0xae13('0x82')],'as':_0xae13('0x83'),'include':[{'model':db[_0xae13('0x73')],'as':_0xae13('0x84'),'where':{[_0x30db02[_0xae13('0x7f')]]:_0x14ba38},'limit':0x1,'order':[[_0xae13('0x79'),_0xae13('0x85')]]}]}]})[_0xae13('0x23')](handleEntityNotFound(_0x60d488,null))[_0xae13('0x23')](function(_0x2c874c){if(_0x2c874c&&_0x2c874c[_0xae13('0x83')]){_0xd462c5=_0x2c874c[_0xae13('0x37')]({'plain':!![]});if(_0xd462c5['List']&&_0xd462c5[_0xae13('0x83')][_0xae13('0x84')][_0xae13('0x46')]){return _0xd462c5[_0xae13('0x83')]['Contacts'][0x0];}return db[_0xae13('0x73')][_0xae13('0x59')](_[_0xae13('0x1d')](_0x515fd1[_0xae13('0x5a')],{'firstName':_0x14ba38,[_0x2c874c[_0xae13('0x7f')]]:_0x14ba38,'phone':_0x14ba38,'ListId':_0xd462c5['ListId']}));}})['then'](handleEntityNotFound(_0x60d488,null))[_0xae13('0x23')](function(_0x473066){if(_0x473066){_0x22607f=_0x473066;return db[_0xae13('0x90')][_0xae13('0x58')]({'where':{'ContactId':_0x22607f['id'],'closed':![],'OpenchannelAccountId':_0xd462c5['id']}})[_0xae13('0x23')](function(_0x4aa5e6){if(_0x4aa5e6){return[_0x4aa5e6,![]];}return db[_0xae13('0x90')]['create']({'UserId':_0x515fd1[_0xae13('0x5b')]['id'],'ContactId':_0x22607f['id'],'OpenchannelAccountId':_0xd462c5['id'],'lastMsgDirection':_0xae13('0xba'),'Messages':[_[_0xae13('0x4d')](_0x515fd1[_0xae13('0x5a')],{'read':![],'body':_0x515fd1['body'][_0xae13('0x5a')],'OpenchannelAccountId':_0xd462c5['id'],'UserId':_0x515fd1[_0xae13('0x5b')]['id'],'ContactId':_0x22607f['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xae13('0xbb')}]})['then'](function(_0x4efe0a){return[_0x4efe0a,!![]];});});}})[_0xae13('0x93')](function(_0x1460b6,_0x46d872){if(_0x46d872){return _0x1460b6;}return db[_0xae13('0xbc')]['create'](_[_0xae13('0x4d')](_0x515fd1['body'],{'read':![],'body':_0x515fd1['body'][_0xae13('0x5a')],'OpenchannelAccountId':_0xd462c5['id'],'OpenchannelInteractionId':_0x1460b6['id'],'UserId':_0x515fd1[_0xae13('0x5b')]['id'],'ContactId':_0x22607f['id']}))[_0xae13('0x23')](function(_0x4587c5){_0x1460b6[_0xae13('0xbd')][_0xae13('0xbb')]=[];_0x1460b6[_0xae13('0xbd')][_0xae13('0xbb')][_0xae13('0x99')](_0x4587c5[_0xae13('0xbd')]);return _0x1460b6;});});}})[_0xae13('0x23')](respondWithResult(_0x60d488,null))[_0xae13('0x2c')](handleError(_0x60d488,null));}; \ No newline at end of file +var _0x3685=['Contacts','DESC','OpenchannelApplication','applications','Applications','list','priority','asc','account','defaults','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','User','fullname','internal','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','out','push','dataValues','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','get','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','OpenchannelAccounts','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','createdAt','ListId','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List'];(function(_0x94ab7f,_0x38f931){var _0x40c1e4=function(_0x3c96f1){while(--_0x3c96f1){_0x94ab7f['push'](_0x94ab7f['shift']());}};_0x40c1e4(++_0x38f931);}(_0x3685,0xf8));var _0x5368=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3685[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x5368('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5368('0x1'));var zipdir=require(_0x5368('0x2'));var jsonpatch=require(_0x5368('0x3'));var rp=require(_0x5368('0x4'));var moment=require(_0x5368('0x5'));var BPromise=require(_0x5368('0x6'));var Mustache=require(_0x5368('0x7'));var util=require(_0x5368('0x8'));var path=require(_0x5368('0x9'));var sox=require(_0x5368('0xa'));var csv=require('to-csv');var ejs=require(_0x5368('0xb'));var fs=require('fs');var fs_extra=require(_0x5368('0xc'));var _=require(_0x5368('0xd'));var squel=require(_0x5368('0xe'));var crypto=require('crypto');var jsforce=require(_0x5368('0xf'));var deskjs=require(_0x5368('0x10'));var toCsv=require(_0x5368('0x11'));var querystring=require(_0x5368('0x12'));var Papa=require(_0x5368('0x13'));var Redis=require(_0x5368('0x14'));var authService=require(_0x5368('0x15'));var qs=require(_0x5368('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5368('0x17'));var logger=require(_0x5368('0x18'))(_0x5368('0x19'));var utils=require('../../config/utils');var config=require(_0x5368('0x1a'));var licenseUtil=require(_0x5368('0x1b'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x5368('0x1c')],{'host':_0x5368('0x1d'),'port':0x18eb});var socket=require(_0x5368('0x1e'))(new Redis(config[_0x5368('0x1c')]));require(_0x5368('0x1f'))[_0x5368('0x20')](socket);var jayson=require(_0x5368('0x21'));var client=jayson[_0x5368('0x22')][_0x5368('0x23')]({'port':0x232c});var client9002=jayson[_0x5368('0x22')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41ce0e,_0x183041,_0x59c422,_0x19790d){return new BPromise(function(_0x1c04bd,_0x973143){var _0x24a4b3=_0x19790d||client;return _0x24a4b3['request'](_0x41ce0e,_0x59c422)[_0x5368('0x24')](function(_0x56ac4d){logger['info'](_0x5368('0x25'),_0x183041,'request\x20sent');logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x183041,_0x5368('0x26'),JSON[_0x5368('0x27')](_0x56ac4d));if(_0x56ac4d[_0x5368('0x28')]){if(_0x56ac4d['error']['code']===0x1f4){logger[_0x5368('0x28')](_0x5368('0x25'),_0x183041,_0x56ac4d[_0x5368('0x28')][_0x5368('0x29')]);return _0x973143(_0x56ac4d[_0x5368('0x28')][_0x5368('0x29')]);}logger[_0x5368('0x28')](_0x5368('0x25'),_0x183041,_0x56ac4d[_0x5368('0x28')][_0x5368('0x29')]);return _0x1c04bd(_0x56ac4d['error'][_0x5368('0x29')]);}else{logger[_0x5368('0x2a')](_0x5368('0x25'),_0x183041,_0x5368('0x26'));_0x1c04bd(_0x56ac4d[_0x5368('0x2b')][_0x5368('0x29')]);}})[_0x5368('0x2c')](function(_0x5d32ff){logger[_0x5368('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x183041,_0x5d32ff);_0x973143(_0x5d32ff);});});}function respondWithStatusCode(_0x49c518,_0x15c206){_0x15c206=_0x15c206||0xcc;return function(_0x229e5){if(_0x229e5){return _0x49c518[_0x5368('0x2d')](_0x15c206);}return _0x49c518[_0x5368('0x2e')](_0x15c206)[_0x5368('0x2f')]();};}function respondWithResult(_0x4b94cd,_0x725f8e){_0x725f8e=_0x725f8e||0xc8;return function(_0x200ad0){if(_0x200ad0){return _0x4b94cd[_0x5368('0x2e')](_0x725f8e)[_0x5368('0x30')](_0x200ad0);}};}function respondWithFilteredResult(_0x42d4b4,_0x3af128){return function(_0x3d40de){if(_0x3d40de){var _0x2963a6=_0x3d40de[_0x5368('0x31')],_0x3681e6=_0x3af128[_0x5368('0x32')],_0x3c8ae1=_0x3af128['offset']+_0x3af128[_0x5368('0x33')],_0x260eab;if(_0x3c8ae1>=_0x2963a6){_0x3c8ae1=_0x2963a6;_0x260eab=0xc8;}else{_0x260eab=0xce;}_0x42d4b4[_0x5368('0x2e')](_0x260eab);return _0x42d4b4[_0x5368('0x34')]('Content-Range',_0x3681e6+'-'+_0x3c8ae1+'/'+_0x2963a6)[_0x5368('0x30')](_0x3d40de);}return null;};}function patchUpdates(_0x50131a){return function(_0x26fc48){try{jsonpatch[_0x5368('0x35')](_0x26fc48,_0x50131a,!![]);}catch(_0x5007b6){return BPromise[_0x5368('0x36')](_0x5007b6);}return _0x26fc48[_0x5368('0x37')]();};}function saveUpdates(_0x592f21,_0x52344f){return function(_0x32a50e){if(_0x32a50e){return _0x32a50e[_0x5368('0x38')](_0x592f21)['then'](function(_0x46169e){return _0x46169e;});}return null;};}function removeEntity(_0x2fde35,_0x211762){return function(_0x4dc0ee){if(_0x4dc0ee){return _0x4dc0ee[_0x5368('0x39')]()['then'](function(){var _0x22b489=_0x4dc0ee[_0x5368('0x3a')]({'plain':!![]});var _0x7ec790='OpenchannelAccounts';return db[_0x5368('0x3b')][_0x5368('0x39')]({'where':{'type':_0x7ec790,'resourceId':_0x22b489['id']}})[_0x5368('0x24')](function(){return _0x4dc0ee;});})[_0x5368('0x24')](function(){_0x2fde35['status'](0xcc)[_0x5368('0x2f')]();});}};}function handleEntityNotFound(_0x4d016f,_0x295123){return function(_0x69c6c7){if(!_0x69c6c7){_0x4d016f['sendStatus'](0x194);}return _0x69c6c7;};}function handleError(_0x1b84fb,_0x197659){_0x197659=_0x197659||0x1f4;return function(_0x46e59a){logger[_0x5368('0x28')](_0x46e59a['stack']);if(_0x46e59a[_0x5368('0x3c')]){delete _0x46e59a[_0x5368('0x3c')];}_0x1b84fb[_0x5368('0x2e')](_0x197659)[_0x5368('0x3d')](_0x46e59a);};}exports[_0x5368('0x3e')]=function(_0x5d384a,_0x1183a1){var _0x411f8b={'include':[{'model':db[_0x5368('0x3f')],'as':_0x5368('0x40')}]},_0x4e2d3e={},_0x1e16ca={'count':0x0,'rows':[]};var _0x5e796f=_[_0x5368('0x41')](db[_0x5368('0x42')][_0x5368('0x43')],function(_0x25e432){return{'name':_0x25e432['fieldName'],'type':_0x25e432['type'][_0x5368('0x44')]};});_0x4e2d3e[_0x5368('0x45')]=_[_0x5368('0x41')](_0x5e796f,'name');_0x4e2d3e['query']=_[_0x5368('0x46')](_0x5d384a['query']);_0x4e2d3e[_0x5368('0x47')]=_[_0x5368('0x48')](_0x4e2d3e['model'],_0x4e2d3e[_0x5368('0x49')]);_0x411f8b[_0x5368('0x4a')]=_[_0x5368('0x48')](_0x4e2d3e[_0x5368('0x45')],qs[_0x5368('0x4b')](_0x5d384a[_0x5368('0x49')][_0x5368('0x4b')]));_0x411f8b[_0x5368('0x4a')]=_0x411f8b[_0x5368('0x4a')][_0x5368('0x4c')]?_0x411f8b[_0x5368('0x4a')]:_0x4e2d3e[_0x5368('0x45')];if(!_0x5d384a['query'][_0x5368('0x4d')](_0x5368('0x4e'))){_0x411f8b[_0x5368('0x33')]=qs['limit'](_0x5d384a[_0x5368('0x49')][_0x5368('0x33')]);_0x411f8b['offset']=qs[_0x5368('0x32')](_0x5d384a[_0x5368('0x49')][_0x5368('0x32')]);}_0x411f8b[_0x5368('0x4f')]=qs[_0x5368('0x50')](_0x5d384a[_0x5368('0x49')][_0x5368('0x50')]);_0x411f8b[_0x5368('0x51')]=qs[_0x5368('0x47')](_[_0x5368('0x52')](_0x5d384a['query'],_0x4e2d3e['filters']),_0x5e796f);if(_0x5d384a[_0x5368('0x49')][_0x5368('0x53')]){_0x411f8b[_0x5368('0x51')]=_[_0x5368('0x54')](_0x411f8b['where'],{'$or':_['map'](_0x5e796f,function(_0x1031b1){if(_0x1031b1['type']!==_0x5368('0x55')){var _0x5d3aac={};_0x5d3aac[_0x1031b1[_0x5368('0x3c')]]={'$like':'%'+_0x5d384a['query'][_0x5368('0x53')]+'%'};return _0x5d3aac;}})});}_0x411f8b=_[_0x5368('0x54')]({},_0x411f8b,_0x5d384a['options']);var _0x5159f7={'where':_0x411f8b[_0x5368('0x51')]};return db['OpenchannelAccount'][_0x5368('0x31')](_0x5159f7)[_0x5368('0x24')](function(_0x2ee00b){_0x1e16ca[_0x5368('0x31')]=_0x2ee00b;if(_0x5d384a['query'][_0x5368('0x56')]){_0x411f8b[_0x5368('0x57')]=[{'all':!![]}];}return db[_0x5368('0x42')][_0x5368('0x58')](_0x411f8b);})[_0x5368('0x24')](function(_0x4399c3){_0x1e16ca[_0x5368('0x59')]=_0x4399c3;return _0x1e16ca;})['then'](respondWithFilteredResult(_0x1183a1,_0x411f8b))['catch'](handleError(_0x1183a1,null));};exports[_0x5368('0x5a')]=function(_0x7d7a5,_0x367a7d){var _0x4850f8={'raw':![],'where':{'id':_0x7d7a5[_0x5368('0x5b')]['id']},'include':[{'model':db[_0x5368('0x3f')],'as':_0x5368('0x40')}]},_0x42b09e={};_0x42b09e[_0x5368('0x45')]=_[_0x5368('0x46')](db[_0x5368('0x42')][_0x5368('0x43')]);_0x42b09e['query']=_[_0x5368('0x46')](_0x7d7a5[_0x5368('0x49')]);_0x42b09e[_0x5368('0x47')]=_[_0x5368('0x48')](_0x42b09e['model'],_0x42b09e[_0x5368('0x49')]);_0x4850f8[_0x5368('0x4a')]=_[_0x5368('0x48')](_0x42b09e[_0x5368('0x45')],qs[_0x5368('0x4b')](_0x7d7a5[_0x5368('0x49')][_0x5368('0x4b')]));_0x4850f8[_0x5368('0x4a')]=_0x4850f8[_0x5368('0x4a')][_0x5368('0x4c')]?_0x4850f8[_0x5368('0x4a')]:_0x42b09e[_0x5368('0x45')];if(_0x7d7a5[_0x5368('0x49')][_0x5368('0x56')]){_0x4850f8['include']=[{'all':!![]}];}_0x4850f8=_[_0x5368('0x54')]({},_0x4850f8,_0x7d7a5[_0x5368('0x5c')]);return db[_0x5368('0x42')][_0x5368('0x5d')](_0x4850f8)[_0x5368('0x24')](handleEntityNotFound(_0x367a7d,null))[_0x5368('0x24')](respondWithResult(_0x367a7d,null))['catch'](handleError(_0x367a7d,null));};exports[_0x5368('0x5e')]=function(_0x4a5654,_0x3cc107){return db[_0x5368('0x42')][_0x5368('0x5e')](_0x4a5654[_0x5368('0x5f')],{})[_0x5368('0x24')](function(_0x257a24){var _0x170ecd=_0x4a5654['user'][_0x5368('0x3a')]({'plain':!![]});if(!_0x170ecd)throw new Error(_0x5368('0x60'));if(_0x170ecd[_0x5368('0x61')]===_0x5368('0x62')){var _0xf127d0=_0x257a24[_0x5368('0x3a')]({'plain':!![]});var _0x39afad=_0x5368('0x63');return db[_0x5368('0x64')][_0x5368('0x5d')]({'where':{'name':_0x39afad,'userProfileId':_0x170ecd[_0x5368('0x65')]},'raw':!![]})[_0x5368('0x24')](function(_0x38b389){if(_0x38b389&&_0x38b389['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xf127d0[_0x5368('0x3c')],'resourceId':_0xf127d0['id'],'type':_0x38b389[_0x5368('0x3c')],'sectionId':_0x38b389['id']},{})[_0x5368('0x24')](function(){return _0x257a24;});}else{return _0x257a24;}})[_0x5368('0x2c')](function(_0x5e8892){logger['error'](_0x5368('0x66'),_0x5e8892);throw _0x5e8892;});}return _0x257a24;})[_0x5368('0x24')](respondWithResult(_0x3cc107,0xc9))[_0x5368('0x2c')](handleError(_0x3cc107,null));};exports['update']=function(_0x344603,_0x5695a3){if(_0x344603[_0x5368('0x5f')]['id']){delete _0x344603[_0x5368('0x5f')]['id'];}return db[_0x5368('0x42')][_0x5368('0x5d')]({'where':{'id':_0x344603[_0x5368('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0x5368('0x40')}]})[_0x5368('0x24')](handleEntityNotFound(_0x5695a3,null))[_0x5368('0x24')](saveUpdates(_0x344603['body'],null))['then'](respondWithResult(_0x5695a3,null))[_0x5368('0x2c')](handleError(_0x5695a3,null));};exports[_0x5368('0x39')]=function(_0x5b2ec2,_0x591c07){return db[_0x5368('0x42')][_0x5368('0x5d')]({'where':{'id':_0x5b2ec2[_0x5368('0x5b')]['id']}})[_0x5368('0x24')](handleEntityNotFound(_0x591c07,null))[_0x5368('0x24')](removeEntity(_0x591c07,null))[_0x5368('0x2c')](handleError(_0x591c07,null));};exports[_0x5368('0x67')]=function(_0x146f65,_0x5b1347){return db[_0x5368('0x42')]['describe']()[_0x5368('0x24')](respondWithResult(_0x5b1347,null))[_0x5368('0x2c')](handleError(_0x5b1347,null));};exports[_0x5368('0x68')]=function(_0x5621bf,_0x71fc2c,_0x242a9a){if(_0x5621bf[_0x5368('0x5f')]['id']){delete _0x5621bf[_0x5368('0x5f')]['id'];}return db[_0x5368('0x42')][_0x5368('0x5d')]({'where':{'id':_0x5621bf[_0x5368('0x5b')]['id']}})[_0x5368('0x24')](handleEntityNotFound(_0x71fc2c,null))[_0x5368('0x24')](function(_0x343ae5){if(_0x343ae5){_0x5621bf[_0x5368('0x5f')][_0x5368('0x69')]=_0x343ae5['id'];return db[_0x5368('0x6a')][_0x5368('0x5e')](_0x5621bf[_0x5368('0x5f')]);}})[_0x5368('0x24')](respondWithResult(_0x71fc2c,null))[_0x5368('0x2c')](handleError(_0x71fc2c,null));};exports[_0x5368('0x6b')]=function(_0x3debf0,_0x5ec9ca,_0x3307c2){var _0x153cac={'raw':![],'where':{}};var _0x2f8493={};var _0x486ab6={'count':0x0,'rows':[]};return db[_0x5368('0x42')][_0x5368('0x6c')]({'where':{'id':_0x3debf0[_0x5368('0x5b')]['id']}})[_0x5368('0x24')](handleEntityNotFound(_0x5ec9ca,null))[_0x5368('0x24')](function(_0x5eea25){if(_0x5eea25){_0x2f8493['model']=_['keys'](db[_0x5368('0x6a')][_0x5368('0x43')]);_0x2f8493[_0x5368('0x49')]=_['keys'](_0x3debf0[_0x5368('0x49')]);_0x2f8493['filters']=_['intersection'](_0x2f8493[_0x5368('0x45')],_0x2f8493[_0x5368('0x49')]);_0x153cac[_0x5368('0x4a')]=_[_0x5368('0x48')](_0x2f8493[_0x5368('0x45')],qs[_0x5368('0x4b')](_0x3debf0[_0x5368('0x49')][_0x5368('0x4b')]));_0x153cac[_0x5368('0x4a')]=_0x153cac[_0x5368('0x4a')]['length']?_0x153cac[_0x5368('0x4a')]:_0x2f8493[_0x5368('0x45')];if(!_0x3debf0[_0x5368('0x49')]['hasOwnProperty'](_0x5368('0x4e'))){_0x153cac[_0x5368('0x33')]=qs[_0x5368('0x33')](_0x3debf0['query'][_0x5368('0x33')]);_0x153cac[_0x5368('0x32')]=qs['offset'](_0x3debf0[_0x5368('0x49')]['offset']);}_0x153cac[_0x5368('0x4f')]=qs['sort'](_0x3debf0[_0x5368('0x49')][_0x5368('0x50')]);_0x153cac[_0x5368('0x51')]=qs['filters'](_['pick'](_0x3debf0[_0x5368('0x49')],_0x2f8493[_0x5368('0x47')]));_0x153cac[_0x5368('0x51')][_0x5368('0x69')]=_0x5eea25['id'];if(_0x3debf0['query']['filter']){_0x153cac[_0x5368('0x51')]=_['merge'](_0x153cac[_0x5368('0x51')],{'$or':_['map'](_0x153cac[_0x5368('0x4a')],function(_0x4f635a){var _0x4fafa7={};_0x4fafa7[_0x4f635a]={'$like':'%'+_0x3debf0[_0x5368('0x49')]['filter']+'%'};return _0x4fafa7;})});}_0x153cac=_[_0x5368('0x54')]({},_0x153cac,_0x3debf0[_0x5368('0x5c')]);return db['Disposition'][_0x5368('0x31')]({'where':_0x153cac[_0x5368('0x51')]})[_0x5368('0x24')](function(_0x377b32){_0x486ab6['count']=_0x377b32;if(_0x3debf0[_0x5368('0x49')][_0x5368('0x56')]){_0x153cac[_0x5368('0x57')]=[{'all':!![]}];}return db[_0x5368('0x6a')][_0x5368('0x58')](_0x153cac);})[_0x5368('0x24')](function(_0x4fdce6){_0x486ab6[_0x5368('0x59')]=_0x4fdce6;return _0x486ab6;});}})[_0x5368('0x24')](respondWithFilteredResult(_0x5ec9ca,_0x153cac))[_0x5368('0x2c')](handleError(_0x5ec9ca,null));};exports[_0x5368('0x6d')]=function(_0xb94224,_0x257055,_0x6f2445){return db[_0x5368('0x42')][_0x5368('0x5d')]({'where':{'id':_0xb94224['params']['id']}})[_0x5368('0x24')](handleEntityNotFound(_0x257055,null))[_0x5368('0x24')](function(_0x1348c6){if(_0x1348c6){return _0x1348c6[_0x5368('0x6d')](_0xb94224[_0x5368('0x49')][_0x5368('0x6e')]);}})[_0x5368('0x24')](respondWithStatusCode(_0x257055,null))[_0x5368('0x2c')](handleError(_0x257055,null));};exports[_0x5368('0x6f')]=function(_0x123ffc,_0x30b0c3,_0x1a2952){if(_0x123ffc[_0x5368('0x5f')]['id']){delete _0x123ffc[_0x5368('0x5f')]['id'];}return db['OpenchannelAccount'][_0x5368('0x5d')]({'where':{'id':_0x123ffc[_0x5368('0x5b')]['id']}})['then'](handleEntityNotFound(_0x30b0c3,null))[_0x5368('0x24')](function(_0x53ad56){if(_0x53ad56){_0x123ffc[_0x5368('0x5f')][_0x5368('0x69')]=_0x53ad56['id'];return db[_0x5368('0x70')]['create'](_0x123ffc[_0x5368('0x5f')]);}})[_0x5368('0x24')](respondWithResult(_0x30b0c3,null))['catch'](handleError(_0x30b0c3,null));};exports[_0x5368('0x71')]=function(_0xd179,_0xa24994,_0x2aa776){var _0x2ef8e3={'raw':![],'where':{}};var _0x40e04a={};var _0x10656a={'count':0x0,'rows':[]};return db[_0x5368('0x42')]['findOne']({'where':{'id':_0xd179[_0x5368('0x5b')]['id']}})[_0x5368('0x24')](handleEntityNotFound(_0xa24994,null))[_0x5368('0x24')](function(_0x76583d){if(_0x76583d){_0x40e04a['model']=_[_0x5368('0x46')](db['CannedAnswer']['rawAttributes']);_0x40e04a['query']=_['keys'](_0xd179[_0x5368('0x49')]);_0x40e04a['filters']=_[_0x5368('0x48')](_0x40e04a['model'],_0x40e04a[_0x5368('0x49')]);_0x2ef8e3[_0x5368('0x4a')]=_['intersection'](_0x40e04a[_0x5368('0x45')],qs['fields'](_0xd179[_0x5368('0x49')][_0x5368('0x4b')]));_0x2ef8e3[_0x5368('0x4a')]=_0x2ef8e3['attributes'][_0x5368('0x4c')]?_0x2ef8e3[_0x5368('0x4a')]:_0x40e04a[_0x5368('0x45')];if(!_0xd179[_0x5368('0x49')][_0x5368('0x4d')](_0x5368('0x4e'))){_0x2ef8e3[_0x5368('0x33')]=qs[_0x5368('0x33')](_0xd179[_0x5368('0x49')]['limit']);_0x2ef8e3[_0x5368('0x32')]=qs[_0x5368('0x32')](_0xd179[_0x5368('0x49')]['offset']);}_0x2ef8e3[_0x5368('0x4f')]=qs['sort'](_0xd179[_0x5368('0x49')][_0x5368('0x50')]);_0x2ef8e3['where']=qs['filters'](_[_0x5368('0x52')](_0xd179[_0x5368('0x49')],_0x40e04a[_0x5368('0x47')]));_0x2ef8e3[_0x5368('0x51')]['OpenchannelAccountId']=_0x76583d['id'];if(_0xd179[_0x5368('0x49')][_0x5368('0x53')]){_0x2ef8e3[_0x5368('0x51')]=_[_0x5368('0x54')](_0x2ef8e3[_0x5368('0x51')],{'$or':_[_0x5368('0x41')](_0x2ef8e3[_0x5368('0x4a')],function(_0x58c4d4){var _0x2bb649={};_0x2bb649[_0x58c4d4]={'$like':'%'+_0xd179[_0x5368('0x49')][_0x5368('0x53')]+'%'};return _0x2bb649;})});}_0x2ef8e3=_[_0x5368('0x54')]({},_0x2ef8e3,_0xd179[_0x5368('0x5c')]);return db[_0x5368('0x70')][_0x5368('0x31')]({'where':_0x2ef8e3[_0x5368('0x51')]})[_0x5368('0x24')](function(_0x509fe9){_0x10656a[_0x5368('0x31')]=_0x509fe9;if(_0xd179[_0x5368('0x49')][_0x5368('0x56')]){_0x2ef8e3[_0x5368('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0x5368('0x58')](_0x2ef8e3);})[_0x5368('0x24')](function(_0x3955f4){_0x10656a[_0x5368('0x59')]=_0x3955f4;return _0x10656a;});}})[_0x5368('0x24')](respondWithFilteredResult(_0xa24994,_0x2ef8e3))[_0x5368('0x2c')](handleError(_0xa24994,null));};exports[_0x5368('0x72')]=function(_0x3cf884,_0x227040,_0x5ac1fa){return db[_0x5368('0x42')][_0x5368('0x5d')]({'where':{'id':_0x3cf884[_0x5368('0x5b')]['id']}})[_0x5368('0x24')](handleEntityNotFound(_0x227040,null))[_0x5368('0x24')](function(_0x2776a5){if(_0x2776a5){return _0x2776a5[_0x5368('0x72')](_0x3cf884[_0x5368('0x49')]['ids']);}})[_0x5368('0x24')](respondWithStatusCode(_0x227040,null))[_0x5368('0x2c')](handleError(_0x227040,null));};exports[_0x5368('0x73')]=function(_0x50f28f,_0x1f3ca8,_0x454e0a){var _0x1c5c63={'body':_0x50f28f[_0x5368('0x5f')],'channel':_0x5368('0x74')};var _0x2dc9a1=[];var _0x1f5122=[];var _0x30ce99={};var _0x27dcb1=![];return db[_0x5368('0x75')][_0x5368('0x67')]()['then'](function(_0x117590){if(!_0x117590){throw new db[(_0x5368('0x76'))][(_0x5368('0x77'))](_0x5368('0x78'));}_0x2dc9a1=_['difference'](_[_0x5368('0x46')](_0x117590),['createdAt',_0x5368('0x79')]);_0x1f5122=_['difference'](_[_0x5368('0x46')](_0x117590),[_0x5368('0x7a'),'updatedAt','CompanyId',_0x5368('0x7b')]);if(_0x50f28f[_0x5368('0x5f')]['id']){delete _0x50f28f['body']['id'];}if(_['isNil'](_0x50f28f['body'][_0x5368('0x7c')])){throw new db[(_0x5368('0x76'))]['ValidationError'](_0x5368('0x7d'));}if(_['isNil'](_0x50f28f[_0x5368('0x5f')][_0x5368('0x5f')])||_0x50f28f[_0x5368('0x5f')][_0x5368('0x5f')]===''){throw new db[(_0x5368('0x76'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x50f28f[_0x5368('0x5f')][_0x5368('0x7e')])){throw new db[(_0x5368('0x76'))][(_0x5368('0x77'))](_0x5368('0x7f')+_0x1f5122);}if(!_[_0x5368('0x80')](_0x1f5122,_0x50f28f[_0x5368('0x5f')]['mapKey'])){throw new db['Sequelize'][(_0x5368('0x77'))](_0x5368('0x81')+_0x1f5122);}_0x30ce99[_0x50f28f[_0x5368('0x5f')]['mapKey']]=_0x50f28f['body'][_0x5368('0x7c')];})[_0x5368('0x24')](function(){return db[_0x5368('0x42')][_0x5368('0x5d')]({'where':{'id':_0x50f28f[_0x5368('0x5b')]['id']},'include':[{'model':db[_0x5368('0x82')],'as':_0x5368('0x83'),'include':[{'model':db['CmContact'],'as':_0x5368('0x84'),'where':_0x30ce99,'limit':0x1,'order':[['updatedAt',_0x5368('0x85')]]}]},{'model':db[_0x5368('0x86')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x1f3ca8,null))[_0x5368('0x24')](function(_0x14c2cd){if(_0x14c2cd&&_0x14c2cd[_0x5368('0x83')]){_0x1c5c63['account']=_0x14c2cd;_0x1c5c63[_0x5368('0x87')]=_0x14c2cd[_0x5368('0x88')];_0x1c5c63[_0x5368('0x89')]=_0x14c2cd[_0x5368('0x83')];_0x1c5c63['applications']=_['orderBy'](_0x1c5c63[_0x5368('0x87')],[_0x5368('0x8a')],[_0x5368('0x8b')]);if(_0x1c5c63['account'][_0x5368('0x88')]){delete _0x1c5c63[_0x5368('0x8c')][_0x5368('0x88')];}if(_0x1c5c63[_0x5368('0x8c')]['List']&&_0x1c5c63[_0x5368('0x8c')]['List']['Contacts'][_0x5368('0x4c')]){return _0x1c5c63[_0x5368('0x8c')]['List'][_0x5368('0x84')][0x0];}var _0x3c3f32=_[_0x5368('0x8d')](_0x50f28f['body'],{'firstName':_0x50f28f[_0x5368('0x5f')][_0x5368('0x7c')],'ListId':_0x14c2cd[_0x5368('0x7b')]});_0x3c3f32[_0x50f28f[_0x5368('0x5f')]['mapKey']]=_0x50f28f[_0x5368('0x5f')][_0x5368('0x7c')];return db[_0x5368('0x75')][_0x5368('0x5e')](_0x3c3f32,{'fields':_0x2dc9a1,'raw':!![]});}})[_0x5368('0x24')](handleEntityNotFound(_0x1f3ca8,null))[_0x5368('0x24')](function(_0x5de622){_0x1c5c63[_0x5368('0x8e')]=_0x5de622;if(_0x5de622){var _0xaabeec={'ContactId':_0x5de622['id'],'OpenchannelAccountId':_0x50f28f[_0x5368('0x5b')]['id'],'from':(_0x5de622[_0x5368('0x8f')]||'')+'\x20'+(_0x5de622[_0x5368('0x90')]||'')};var _0x3c1182={'OpenchannelAccountId':_0x50f28f['params']['id'],'closed':![]};if(_0x50f28f[_0x5368('0x5f')][_0x5368('0x91')]){_0x3c1182[_0x5368('0x91')]=_0x50f28f['body']['threadId'];return db[_0x5368('0x92')][_0x5368('0x5d')]({'where':_0x3c1182})[_0x5368('0x24')](function(_0x202692){if(_0x202692){return[_0x202692,![]];}_0xaabeec['threadId']=_0x50f28f[_0x5368('0x5f')][_0x5368('0x91')];_0xaabeec[_0x5368('0x93')]=_0x50f28f[_0x5368('0x5f')][_0x5368('0x93')];return db['OpenchannelInteraction'][_0x5368('0x5e')](_0xaabeec)[_0x5368('0x24')](function(_0x4c5fdf){return[_0x4c5fdf,!![]];});});}else{_0x3c1182[_0x5368('0x91')]=null;}_0x3c1182[_0x5368('0x94')]=_0x5de622['id'];return db['OpenchannelInteraction'][_0x5368('0x5d')]({'where':_0x3c1182})['then'](function(_0x4131c0){if(_0x4131c0){return[_0x4131c0,![]];}return db['OpenchannelInteraction']['create'](_0xaabeec)[_0x5368('0x24')](function(_0x9fca5e){return[_0x9fca5e,!![]];});});}})[_0x5368('0x95')](function(_0x305878,_0x5ede24){if(_0x305878){_0x27dcb1=_0x5ede24;if(!_0x5ede24){var _0x1c5d2b={'from':(_0x1c5c63['contact']['firstName']||'')+'\x20'+(_0x1c5c63[_0x5368('0x8e')][_0x5368('0x90')]||'')};if(_0x50f28f['body'][_0x5368('0x91')]&&_0x50f28f['body'][_0x5368('0x96')]&&_0x50f28f[_0x5368('0x5f')]['threadId']!=_0x50f28f['body'][_0x5368('0x96')]){_0x1c5d2b['threadId']=_0x50f28f[_0x5368('0x5f')][_0x5368('0x96')];}return _0x305878['update'](_0x1c5d2b);}else{return _0x305878;}}})[_0x5368('0x24')](function(_0xd22d7d){_0x1c5c63[_0x5368('0x97')]=_0xd22d7d[_0x5368('0x3a')]({'plain':!![]});_0x1c5c63[_0x5368('0x97')]['created']=_0x27dcb1;if(_0x1c5c63[_0x5368('0x97')][_0x5368('0x98')]){if(_0x1c5c63[_0x5368('0x8c')][_0x5368('0x99')]){_0x1c5c63['applications']['push']({'id':0x0,'priority':_0x1c5c63[_0x5368('0x87')][_0x5368('0x4c')]+0x1,'app':_0x5368('0x9a'),'appdata':'unmanaged','interval':_0x5368('0x9b')});}}return db[_0x5368('0x9c')][_0x5368('0x5e')]({'body':_0x50f28f[_0x5368('0x5f')][_0x5368('0x5f')],'OpenchannelAccountId':_0x50f28f[_0x5368('0x5b')]['id'],'OpenchannelInteractionId':_0xd22d7d['id'],'direction':'in','ContactId':_0x1c5c63[_0x5368('0x8e')]['id'],'AttachmentId':_0x50f28f[_0x5368('0x5f')][_0x5368('0x9d')]});})[_0x5368('0x24')](function(_0x4305ae){_0x1c5c63[_0x5368('0x29')]=_0x4305ae;if(_0x1c5c63['interaction'][_0x5368('0x9e')]){return db['User'][_0x5368('0x5d')]({'attributes':['id',_0x5368('0x3c')],'where':{'id':_0x1c5c63[_0x5368('0x97')][_0x5368('0x9e')]}})[_0x5368('0x24')](function(_0x39219b){if(_0x39219b){_0x1c5c63[_0x5368('0x87')][_0x5368('0x9f')]({'id':0x0,'priority':0x0,'app':_0x5368('0xa0'),'appdata':_0x39219b[_0x5368('0x3c')]+','+(_0x1c5c63['account'][_0x5368('0xa1')]||0xa),'interval':_0x5368('0x9b')});_0x1c5c63[_0x5368('0xa2')]=![];}return respondWithRpcPromise(_0x5368('0xa3'),'startRouting',_0x1c5c63);});}return respondWithRpcPromise(_0x5368('0xa3'),_0x5368('0xa4'),_0x1c5c63);})[_0x5368('0x24')](function(_0x58539d){respondWithRpcPromise('EventManager',_0x5368('0xa5'),{'event':_0x5368('0x73'),'message':_0x58539d},client9002);return _0x58539d;})['then'](respondWithResult(_0x1f3ca8,null))[_0x5368('0x2c')](handleError(_0x1f3ca8,null));};exports[_0x5368('0xa6')]=function(_0x533d79,_0x59608b,_0x48797d){return db[_0x5368('0x42')][_0x5368('0x6c')]({'where':{'id':_0x533d79[_0x5368('0x5b')]['id']}})[_0x5368('0x24')](handleEntityNotFound(_0x59608b,null))[_0x5368('0x24')](function(_0x2288f3){if(_0x2288f3){return db['sequelize'][_0x5368('0xa7')](function(_0xefea41){return db[_0x5368('0x86')][_0x5368('0x39')]({'where':{'OpenchannelAccountId':_0x533d79[_0x5368('0x5b')]['id']},'transaction':_0xefea41})[_0x5368('0x24')](function(_0x2fc79c){var _0x308dbe=_[_0x5368('0x41')](_0x533d79[_0x5368('0x5f')],function(_0x4c4fc4){_0x4c4fc4[_0x5368('0x69')]=_0x533d79[_0x5368('0x5b')]['id'];return _0x4c4fc4;});return db[_0x5368('0x86')][_0x5368('0xa8')](_0x308dbe,{'transaction':_0xefea41});});})[_0x5368('0x24')](function(){return db[_0x5368('0x86')][_0x5368('0xa9')]({'where':{'OpenchannelAccountId':_0x533d79['params']['id']},'order':_0x5368('0x8a')});});}})[_0x5368('0x24')](respondWithResult(_0x59608b,null))[_0x5368('0x2c')](handleError(_0x59608b,null));};exports['getApplications']=function(_0x3176d5,_0x5d5f5e,_0x11e640){var _0x26cda9={};var _0x54c8a1={};var _0x20fd08;var _0x3e1be4;return db[_0x5368('0x42')]['findOne']({'where':{'id':_0x3176d5[_0x5368('0x5b')]['id']}})[_0x5368('0x24')](handleEntityNotFound(_0x5d5f5e,null))['then'](function(_0x2555c7){if(_0x2555c7){_0x20fd08=_0x2555c7;_0x54c8a1[_0x5368('0x45')]=_[_0x5368('0x46')](db[_0x5368('0x86')][_0x5368('0x43')]);_0x54c8a1['query']=_[_0x5368('0x46')](_0x3176d5[_0x5368('0x49')]);_0x54c8a1[_0x5368('0x47')]=_[_0x5368('0x48')](_0x54c8a1['model'],_0x54c8a1[_0x5368('0x49')]);_0x26cda9[_0x5368('0x4a')]=_[_0x5368('0x48')](_0x54c8a1[_0x5368('0x45')],qs['fields'](_0x3176d5[_0x5368('0x49')][_0x5368('0x4b')]));_0x26cda9['attributes']=_0x26cda9['attributes'][_0x5368('0x4c')]?_0x26cda9[_0x5368('0x4a')]:_0x54c8a1['model'];_0x26cda9[_0x5368('0x4f')]=qs[_0x5368('0x50')](_0x3176d5[_0x5368('0x49')][_0x5368('0x50')]);_0x26cda9[_0x5368('0x51')]=qs[_0x5368('0x47')](_[_0x5368('0x52')](_0x3176d5[_0x5368('0x49')],_0x54c8a1[_0x5368('0x47')]));if(_0x3176d5['query']['filter']){_0x26cda9['where']=_[_0x5368('0x54')](_0x26cda9['where'],{'$or':_[_0x5368('0x41')](_0x26cda9[_0x5368('0x4a')],function(_0x25aa30){var _0x833ba6={};_0x833ba6[_0x25aa30]={'$like':'%'+_0x3176d5['query'][_0x5368('0x53')]+'%'};return _0x833ba6;})});}_0x26cda9=_[_0x5368('0x54')]({},_0x26cda9,_0x3176d5['options']);return _0x20fd08[_0x5368('0xaa')](_0x26cda9);}})[_0x5368('0x24')](function(_0x3a3fd3){if(_0x3a3fd3){_0x3e1be4=_0x3a3fd3[_0x5368('0x4c')];if(!_0x3176d5['query'][_0x5368('0x4d')]('nolimit')){_0x26cda9[_0x5368('0x33')]=qs[_0x5368('0x33')](_0x3176d5['query'][_0x5368('0x33')]);_0x26cda9[_0x5368('0x32')]=qs['offset'](_0x3176d5[_0x5368('0x49')][_0x5368('0x32')]);}return _0x20fd08['getApplications'](_0x26cda9);}})[_0x5368('0x24')](function(_0x2087d7){if(_0x2087d7){return _0x2087d7?{'count':_0x3e1be4,'rows':_0x2087d7}:null;}})[_0x5368('0x24')](respondWithResult(_0x5d5f5e,null))[_0x5368('0x2c')](handleError(_0x5d5f5e,null));};exports[_0x5368('0xab')]=function(_0x3d73a9,_0x4f2bd1,_0x31587a){var _0x10989c={'raw':![],'where':{}};var _0x213204={};var _0x596082={'count':0x0,'rows':[]};return db[_0x5368('0x42')][_0x5368('0x6c')]({'where':{'id':_0x3d73a9['params']['id']}})['then'](handleEntityNotFound(_0x4f2bd1,null))['then'](function(_0x38f994){if(_0x38f994){_0x213204[_0x5368('0x45')]=_[_0x5368('0x46')](db[_0x5368('0x92')][_0x5368('0x43')]);_0x213204['query']=_[_0x5368('0x46')](_0x3d73a9['query']);_0x213204[_0x5368('0x47')]=_[_0x5368('0x48')](_0x213204[_0x5368('0x45')],_0x213204[_0x5368('0x49')]);_0x10989c['attributes']=_[_0x5368('0x48')](_0x213204[_0x5368('0x45')],qs['fields'](_0x3d73a9[_0x5368('0x49')][_0x5368('0x4b')]));_0x10989c['attributes']=_0x10989c[_0x5368('0x4a')]['length']?_0x10989c[_0x5368('0x4a')]:_0x213204[_0x5368('0x45')];if(!_0x3d73a9[_0x5368('0x49')][_0x5368('0x4d')](_0x5368('0x4e'))){_0x10989c[_0x5368('0x33')]=qs[_0x5368('0x33')](_0x3d73a9[_0x5368('0x49')][_0x5368('0x33')]);_0x10989c['offset']=qs[_0x5368('0x32')](_0x3d73a9[_0x5368('0x49')][_0x5368('0x32')]);}_0x10989c[_0x5368('0x4f')]=qs[_0x5368('0x50')](_0x3d73a9[_0x5368('0x49')][_0x5368('0x50')]);_0x10989c[_0x5368('0x51')]=qs[_0x5368('0x47')](_[_0x5368('0x52')](_0x3d73a9[_0x5368('0x49')],_0x213204[_0x5368('0x47')]));_0x10989c['where']['OpenchannelAccountId']=_0x38f994['id'];if(_0x3d73a9[_0x5368('0x49')][_0x5368('0x53')]){_0x10989c[_0x5368('0x51')]=_[_0x5368('0x54')](_0x10989c[_0x5368('0x51')],{'$or':_['map'](_0x10989c['attributes'],function(_0x543629){var _0x37fda0={};_0x37fda0[_0x543629]={'$like':'%'+_0x3d73a9['query']['filter']+'%'};return _0x37fda0;})});}_0x10989c=_['merge']({},_0x10989c,_0x3d73a9[_0x5368('0x5c')]);return db[_0x5368('0x92')][_0x5368('0x31')]({'where':_0x10989c['where']})['then'](function(_0x55e37b){_0x596082[_0x5368('0x31')]=_0x55e37b;if(_0x3d73a9['query'][_0x5368('0x56')]){_0x10989c[_0x5368('0x57')]=[{'model':db['CmContact'],'as':_0x5368('0xac'),'required':![]},{'model':db[_0x5368('0xad')],'as':'Owner','attributes':[_0x5368('0x3c'),_0x5368('0xae'),_0x5368('0xaf')],'required':![]},{'model':db['Tag'],'as':_0x5368('0xb0'),'attributes':['id','name',_0x5368('0xb1')],'where':_0x3d73a9['query'][_0x5368('0xb2')]?{'id':_0x3d73a9['query'][_0x5368('0xb2')]}:undefined,'required':_0x3d73a9[_0x5368('0x49')][_0x5368('0xb2')]?!![]:![]}];}return db[_0x5368('0x92')][_0x5368('0x58')](_0x10989c);})['then'](function(_0xc1b380){_0x596082[_0x5368('0x59')]=_0xc1b380;return _0x596082;});}})[_0x5368('0x24')](respondWithFilteredResult(_0x4f2bd1,_0x10989c))['catch'](handleError(_0x4f2bd1,null));};exports['addAgents']=function(_0xe8a6c5,_0x5a2795,_0x4b94af){return db[_0x5368('0x42')][_0x5368('0x5d')]({'where':{'id':_0xe8a6c5['params']['id']}})['then'](handleEntityNotFound(_0x5a2795,null))[_0x5368('0x24')](function(_0x1bc4c6){if(_0x1bc4c6){return _0x1bc4c6[_0x5368('0xb3')](_0xe8a6c5[_0x5368('0x5f')][_0x5368('0x6e')],_['omit'](_0xe8a6c5['body'],[_0x5368('0x6e'),'id'])||{})['spread'](function(_0xed03f1){for(var _0x426d03=0x0;_0x426d03<_0xe8a6c5[_0x5368('0x5f')]['ids']['length'];_0x426d03+=0x1){socket[_0x5368('0xb4')](_0x5368('0xb5'),{'UserId':_0xe8a6c5['body'][_0x5368('0x6e')][_0x426d03],'OpenchannelAccountId':_0xe8a6c5[_0x5368('0x5b')]['id']});}return _0xed03f1;});}})[_0x5368('0x24')](respondWithResult(_0x5a2795,null))[_0x5368('0x2c')](handleError(_0x5a2795,null));};exports[_0x5368('0xb6')]=function(_0x188fa7,_0x4eeb19,_0x132175){return db['OpenchannelAccount']['find']({'where':{'id':_0x188fa7[_0x5368('0x5b')]['id']}})[_0x5368('0x24')](handleEntityNotFound(_0x4eeb19,null))[_0x5368('0x24')](function(_0x282217){if(_0x282217){return _0x282217[_0x5368('0xb6')](_0x188fa7['query'][_0x5368('0x6e')])[_0x5368('0x24')](function(){if(_[_0x5368('0xb7')](_0x188fa7[_0x5368('0x49')]['ids'])){for(var _0xe7c04c=0x0;_0xe7c04c<_0x188fa7['query'][_0x5368('0x6e')]['length'];_0xe7c04c+=0x1){socket[_0x5368('0xb4')]('userOpenchannelAccount:remove',{'UserId':Number(_0x188fa7[_0x5368('0x49')][_0x5368('0x6e')][_0xe7c04c]),'OpenchannelAccountId':Number(_0x188fa7[_0x5368('0x5b')]['id'])});}}else{socket[_0x5368('0xb4')]('userOpenchannelAccount:remove',{'UserId':Number(_0x188fa7[_0x5368('0x49')][_0x5368('0x6e')]),'OpenchannelAccountId':Number(_0x188fa7[_0x5368('0x5b')]['id'])});}});}})[_0x5368('0x24')](respondWithStatusCode(_0x4eeb19,null))[_0x5368('0x2c')](handleError(_0x4eeb19,null));};exports['getAgents']=function(_0xf7d802,_0x54a3c3,_0x5d03f5){var _0x1271a1={};var _0x3ce3f1={};var _0x358ecc;var _0x19e1d8;return db[_0x5368('0x42')][_0x5368('0x6c')]({'where':{'id':_0xf7d802[_0x5368('0x5b')]['id']}})[_0x5368('0x24')](handleEntityNotFound(_0x54a3c3,null))[_0x5368('0x24')](function(_0x361bf4){if(_0x361bf4){_0x358ecc=_0x361bf4;_0x3ce3f1[_0x5368('0x45')]=_[_0x5368('0x46')](db[_0x5368('0xad')][_0x5368('0x43')]);_0x3ce3f1[_0x5368('0x49')]=_[_0x5368('0x46')](_0xf7d802[_0x5368('0x49')]);_0x3ce3f1[_0x5368('0x47')]=_[_0x5368('0x48')](_0x3ce3f1['model'],_0x3ce3f1[_0x5368('0x49')]);_0x1271a1['attributes']=_[_0x5368('0x48')](_0x3ce3f1[_0x5368('0x45')],qs[_0x5368('0x4b')](_0xf7d802[_0x5368('0x49')][_0x5368('0x4b')]));_0x1271a1[_0x5368('0x4a')]=_0x1271a1[_0x5368('0x4a')][_0x5368('0x4c')]?_0x1271a1[_0x5368('0x4a')]:_0x3ce3f1[_0x5368('0x45')];_0x1271a1[_0x5368('0x4f')]=qs[_0x5368('0x50')](_0xf7d802[_0x5368('0x49')][_0x5368('0x50')]);_0x1271a1[_0x5368('0x51')]=qs[_0x5368('0x47')](_['pick'](_0xf7d802[_0x5368('0x49')],_0x3ce3f1['filters']));if(_0xf7d802['query'][_0x5368('0x53')]){_0x1271a1[_0x5368('0x51')]=_['merge'](_0x1271a1[_0x5368('0x51')],{'$or':_['map'](_0x1271a1[_0x5368('0x4a')],function(_0x19cc87){var _0x44e29a={};_0x44e29a[_0x19cc87]={'$like':'%'+_0xf7d802[_0x5368('0x49')]['filter']+'%'};return _0x44e29a;})});}_0x1271a1=_[_0x5368('0x54')]({},_0x1271a1,_0xf7d802['options']);return _0x358ecc['getAgents'](_0x1271a1);}})[_0x5368('0x24')](function(_0x151260){if(_0x151260){_0x19e1d8=_0x151260[_0x5368('0x4c')];if(!_0xf7d802[_0x5368('0x49')][_0x5368('0x4d')]('nolimit')){_0x1271a1[_0x5368('0x33')]=qs['limit'](_0xf7d802[_0x5368('0x49')][_0x5368('0x33')]);_0x1271a1['offset']=qs[_0x5368('0x32')](_0xf7d802[_0x5368('0x49')][_0x5368('0x32')]);}return _0x358ecc[_0x5368('0xb8')](_0x1271a1);}})[_0x5368('0x24')](function(_0x24598c){if(_0x24598c){return _0x24598c?{'count':_0x19e1d8,'rows':_0x24598c}:null;}})['then'](respondWithResult(_0x54a3c3,null))[_0x5368('0x2c')](handleError(_0x54a3c3,null));};exports[_0x5368('0x3d')]=function(_0xca43c1,_0x27ae50,_0x612478){var _0x5107fd,_0x5ca7dd,_0x2a8049;if(_['isNil'](_0xca43c1[_0x5368('0x5f')]['body'])||_0xca43c1[_0x5368('0x5f')]['body']===''){throw new db[(_0x5368('0x76'))][(_0x5368('0x77'))](_0x5368('0xb9'));}if(_[_0x5368('0xba')](_0xca43c1[_0x5368('0x5f')]['to'])){}_0x5107fd=_0xca43c1['body']['to'];return db[_0x5368('0x42')][_0x5368('0x6c')]({'where':{'id':_0xca43c1['params']['id']}})[_0x5368('0x24')](handleEntityNotFound(_0x27ae50,null))[_0x5368('0x24')](function(_0x5c9436){if(_0x5c9436){return db[_0x5368('0x42')][_0x5368('0x5d')]({'where':{'id':_0x5c9436['id']},'include':[{'model':db[_0x5368('0x82')],'as':_0x5368('0x83'),'include':[{'model':db['CmContact'],'as':_0x5368('0x84'),'where':{[_0x5c9436['mapKey']]:_0x5107fd},'limit':0x1,'order':[['updatedAt',_0x5368('0x85')]]}]}]})[_0x5368('0x24')](handleEntityNotFound(_0x27ae50,null))['then'](function(_0x29f324){if(_0x29f324&&_0x29f324[_0x5368('0x83')]){_0x5ca7dd=_0x29f324[_0x5368('0x3a')]({'plain':!![]});if(_0x5ca7dd[_0x5368('0x83')]&&_0x5ca7dd[_0x5368('0x83')][_0x5368('0x84')][_0x5368('0x4c')]){return _0x5ca7dd[_0x5368('0x83')][_0x5368('0x84')][0x0];}return db['CmContact']['create'](_['defaults'](_0xca43c1[_0x5368('0x5f')],{'firstName':_0x5107fd,[_0x29f324[_0x5368('0x7e')]]:_0x5107fd,'phone':_0x5107fd,'ListId':_0x5ca7dd['ListId']}));}})[_0x5368('0x24')](handleEntityNotFound(_0x27ae50,null))[_0x5368('0x24')](function(_0x3127f6){if(_0x3127f6){_0x2a8049=_0x3127f6;return db[_0x5368('0x92')][_0x5368('0x5d')]({'where':{'ContactId':_0x2a8049['id'],'closed':![],'OpenchannelAccountId':_0x5ca7dd['id']}})[_0x5368('0x24')](function(_0x5837c4){if(_0x5837c4){return[_0x5837c4,![]];}return db['OpenchannelInteraction'][_0x5368('0x5e')]({'UserId':_0xca43c1[_0x5368('0x62')]['id'],'ContactId':_0x2a8049['id'],'OpenchannelAccountId':_0x5ca7dd['id'],'lastMsgDirection':_0x5368('0xbb'),'Messages':[_[_0x5368('0x54')](_0xca43c1[_0x5368('0x5f')],{'read':![],'body':_0xca43c1['body']['body'],'OpenchannelAccountId':_0x5ca7dd['id'],'UserId':_0xca43c1['user']['id'],'ContactId':_0x2a8049['id']})]},{'include':[{'model':db[_0x5368('0x9c')],'as':'Messages'}]})[_0x5368('0x24')](function(_0x5cc45b){return[_0x5cc45b,!![]];});});}})[_0x5368('0x95')](function(_0x3584dd,_0x51ce60){if(_0x51ce60){return _0x3584dd;}return db[_0x5368('0x9c')]['create'](_[_0x5368('0x54')](_0xca43c1['body'],{'read':![],'body':_0xca43c1[_0x5368('0x5f')][_0x5368('0x5f')],'OpenchannelAccountId':_0x5ca7dd['id'],'OpenchannelInteractionId':_0x3584dd['id'],'UserId':_0xca43c1[_0x5368('0x62')]['id'],'ContactId':_0x2a8049['id']}))[_0x5368('0x24')](function(_0x1e4c10){_0x3584dd['dataValues']['Messages']=[];_0x3584dd['dataValues']['Messages'][_0x5368('0xbc')](_0x1e4c10[_0x5368('0xbd')]);return _0x3584dd;});});}})[_0x5368('0x24')](respondWithResult(_0x27ae50,null))[_0x5368('0x2c')](handleError(_0x27ae50,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 8da4de2..22a6b69 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 _0xba2d=['OpenchannelAccount','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x179648,_0x2d8f01){var _0x3a57c3=function(_0x32c95c){while(--_0x32c95c){_0x179648['push'](_0x179648['shift']());}};_0x3a57c3(++_0x2d8f01);}(_0xba2d,0x198));var _0xdba2=function(_0x373d35,_0x131198){_0x373d35=_0x373d35-0x0;var _0x144781=_0xba2d[_0x373d35];return _0x144781;};'use strict';var EventEmitter=require(_0xdba2('0x0'));var OpenchannelAccount=require(_0xdba2('0x1'))['db'][_0xdba2('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdba2('0x3'),'afterUpdate':_0xdba2('0x4'),'afterDestroy':_0xdba2('0x5')};function emitEvent(_0x43114e){return function(_0x591b11,_0x156656,_0x45df64){OpenchannelAccountEvents['emit'](_0x43114e+':'+_0x591b11['id'],_0x591b11);OpenchannelAccountEvents[_0xdba2('0x6')](_0x43114e,_0x591b11);_0x45df64(null);};}for(var e in events){if(events[_0xdba2('0x7')](e)){var event=events[e];OpenchannelAccount[_0xdba2('0x8')](e,emitEvent(event));}}module[_0xdba2('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xf8e9=['remove','emit','exports','events','OpenchannelAccount','setMaxListeners','update'];(function(_0x4d08b8,_0x34c445){var _0x70214a=function(_0x4db67c){while(--_0x4db67c){_0x4d08b8['push'](_0x4d08b8['shift']());}};_0x70214a(++_0x34c445);}(_0xf8e9,0x9d));var _0x9f8e=function(_0x23507a,_0x59c5f2){_0x23507a=_0x23507a-0x0;var _0x138536=_0xf8e9[_0x23507a];return _0x138536;};'use strict';var EventEmitter=require(_0x9f8e('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x9f8e('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x9f8e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9f8e('0x3'),'afterDestroy':_0x9f8e('0x4')};function emitEvent(_0x97ba85){return function(_0x4e32e2,_0x5236ac,_0x1da0a7){OpenchannelAccountEvents[_0x9f8e('0x5')](_0x97ba85+':'+_0x4e32e2['id'],_0x4e32e2);OpenchannelAccountEvents['emit'](_0x97ba85,_0x4e32e2);_0x1da0a7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x9f8e('0x6')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 4c8bd02..3053c47 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 _0xe218=['OpenchannelAccount','openchannel_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelAccount.attributes','exports','define'];(function(_0x4c7e8e,_0x3c5035){var _0x503c3f=function(_0x5a0659){while(--_0x5a0659){_0x4c7e8e['push'](_0x4c7e8e['shift']());}};_0x503c3f(++_0x3c5035);}(_0xe218,0x144));var _0x8e21=function(_0x5ebcda,_0x5aaa0a){_0x5ebcda=_0x5ebcda-0x0;var _0x179c8e=_0xe218[_0x5ebcda];return _0x179c8e;};'use strict';var _=require(_0x8e21('0x0'));var util=require(_0x8e21('0x1'));var logger=require(_0x8e21('0x2'))(_0x8e21('0x3'));var moment=require(_0x8e21('0x4'));var BPromise=require(_0x8e21('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e21('0x6'));var rimraf=require(_0x8e21('0x7'));var config=require(_0x8e21('0x8'));var attributes=require(_0x8e21('0x9'));module[_0x8e21('0xa')]=function(_0x5f0aef,_0x5abc82){return _0x5f0aef[_0x8e21('0xb')](_0x8e21('0xc'),attributes,{'tableName':_0x8e21('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa172=['OpenchannelAccount','openchannel_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xa172,0x1ec));var _0x2a17=function(_0x4233a6,_0x104a18){_0x4233a6=_0x4233a6-0x0;var _0x2d21de=_0xa172[_0x4233a6];return _0x2d21de;};'use strict';var _=require(_0x2a17('0x0'));var util=require(_0x2a17('0x1'));var logger=require(_0x2a17('0x2'))(_0x2a17('0x3'));var moment=require(_0x2a17('0x4'));var BPromise=require(_0x2a17('0x5'));var rp=require(_0x2a17('0x6'));var fs=require('fs');var path=require(_0x2a17('0x7'));var rimraf=require(_0x2a17('0x8'));var config=require(_0x2a17('0x9'));var attributes=require('./openchannelAccount.attributes');module[_0x2a17('0xa')]=function(_0x212798,_0x5d2d4f){return _0x212798[_0x2a17('0xb')](_0x2a17('0xc'),attributes,{'tableName':_0x2a17('0xd'),'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 84c5aad..ab46919 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 _0xe021=['stringify','error','code','message','request\x20sent','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','request','info','OpenchannelAccount,\x20%s,\x20%s'];(function(_0x26d1d2,_0x2c825c){var _0x5ab422=function(_0x3342bd){while(--_0x3342bd){_0x26d1d2['push'](_0x26d1d2['shift']());}};_0x5ab422(++_0x2c825c);}(_0xe021,0x159));var _0x1e02=function(_0x4d944a,_0x5688dd){_0x4d944a=_0x4d944a-0x0;var _0x1ae3d4=_0xe021[_0x4d944a];return _0x1ae3d4;};'use strict';var _=require(_0x1e02('0x0'));var util=require(_0x1e02('0x1'));var moment=require(_0x1e02('0x2'));var BPromise=require(_0x1e02('0x3'));var rs=require(_0x1e02('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1e02('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1e02('0x6'));var config=require('../../config/environment');var jayson=require(_0x1e02('0x7'));var client=jayson['client'][_0x1e02('0x8')]({'port':0x232a});config[_0x1e02('0x9')]=_[_0x1e02('0xa')](config[_0x1e02('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x1e02('0xb'))(new Redis(config[_0x1e02('0x9')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x248241,_0x49b367,_0x2c790a){return new BPromise(function(_0x1b9f03,_0x4bff13){return client[_0x1e02('0xc')](_0x248241,_0x2c790a)['then'](function(_0x114f3f){logger[_0x1e02('0xd')](_0x1e02('0xe'),_0x49b367,'request\x20sent');logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x49b367,'request\x20sent',JSON[_0x1e02('0xf')](_0x114f3f));if(_0x114f3f[_0x1e02('0x10')]){if(_0x114f3f['error'][_0x1e02('0x11')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x49b367,_0x114f3f[_0x1e02('0x10')][_0x1e02('0x12')]);return _0x4bff13(_0x114f3f[_0x1e02('0x10')][_0x1e02('0x12')]);}logger[_0x1e02('0x10')](_0x1e02('0xe'),_0x49b367,_0x114f3f[_0x1e02('0x10')][_0x1e02('0x12')]);return _0x1b9f03(_0x114f3f[_0x1e02('0x10')][_0x1e02('0x12')]);}else{logger[_0x1e02('0xd')](_0x1e02('0xe'),_0x49b367,_0x1e02('0x13'));_0x1b9f03(_0x114f3f['result'][_0x1e02('0x12')]);}})['catch'](function(_0x57e37c){logger[_0x1e02('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x49b367,_0x57e37c);_0x4bff13(_0x57e37c);});});} \ No newline at end of file +var _0xf0c1=['socket.io-emitter','./openchannelAccount.socket','register','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x1ec586,_0x331aba){var _0x39b0f0=function(_0x5569ff){while(--_0x5569ff){_0x1ec586['push'](_0x1ec586['shift']());}};_0x39b0f0(++_0x331aba);}(_0xf0c1,0x138));var _0x1f0c=function(_0x6f1a87,_0x5d5bcf){_0x6f1a87=_0x6f1a87-0x0;var _0x2495c7=_0xf0c1[_0x6f1a87];return _0x2495c7;};'use strict';var _=require(_0x1f0c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1f0c('0x1'));var rs=require(_0x1f0c('0x2'));var fs=require('fs');var Redis=require(_0x1f0c('0x3'));var db=require(_0x1f0c('0x4'))['db'];var utils=require(_0x1f0c('0x5'));var logger=require(_0x1f0c('0x6'))(_0x1f0c('0x7'));var config=require(_0x1f0c('0x8'));var jayson=require(_0x1f0c('0x9'));var client=jayson[_0x1f0c('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x1f0c('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1f0c('0xc'))(new Redis(config[_0x1f0c('0xb')]));require(_0x1f0c('0xd'))[_0x1f0c('0xe')](socket);function respondWithRpcPromise(_0x1cd4ba,_0x10798d,_0x27c76b){return new BPromise(function(_0x111a72,_0x2385fb){return client['request'](_0x1cd4ba,_0x27c76b)[_0x1f0c('0xf')](function(_0x34581b){logger[_0x1f0c('0x10')](_0x1f0c('0x11'),_0x10798d,_0x1f0c('0x12'));logger[_0x1f0c('0x13')](_0x1f0c('0x14'),_0x10798d,_0x1f0c('0x12'),JSON[_0x1f0c('0x15')](_0x34581b));if(_0x34581b['error']){if(_0x34581b[_0x1f0c('0x16')][_0x1f0c('0x17')]===0x1f4){logger[_0x1f0c('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x10798d,_0x34581b[_0x1f0c('0x16')][_0x1f0c('0x18')]);return _0x2385fb(_0x34581b[_0x1f0c('0x16')][_0x1f0c('0x18')]);}logger[_0x1f0c('0x16')](_0x1f0c('0x11'),_0x10798d,_0x34581b[_0x1f0c('0x16')]['message']);return _0x111a72(_0x34581b['error'][_0x1f0c('0x18')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x10798d,_0x1f0c('0x12'));_0x111a72(_0x34581b[_0x1f0c('0x19')][_0x1f0c('0x18')]);}})[_0x1f0c('0x1a')](function(_0xde9b68){logger[_0x1f0c('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x10798d,_0xde9b68);_0x2385fb(_0xde9b68);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index e2b5515..f0a25ee 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 _0x8cec=['removeListener','openchannelAccount:','./openchannelAccount.events','save','remove','update','emit'];(function(_0xfaaad,_0x4c46e6){var _0x59136e=function(_0x96abfb){while(--_0x96abfb){_0xfaaad['push'](_0xfaaad['shift']());}};_0x59136e(++_0x4c46e6);}(_0x8cec,0x1f3));var _0xc8ce=function(_0x2a5b82,_0xc61f63){_0x2a5b82=_0x2a5b82-0x0;var _0x322e1a=_0x8cec[_0x2a5b82];return _0x322e1a;};'use strict';var OpenchannelAccountEvents=require(_0xc8ce('0x0'));var events=[_0xc8ce('0x1'),_0xc8ce('0x2'),_0xc8ce('0x3')];function createListener(_0xfc1cdf,_0x3c8fec){return function(_0x430869){_0x3c8fec[_0xc8ce('0x4')](_0xfc1cdf,_0x430869);};}function removeListener(_0x3b0767,_0x181370){return function(){OpenchannelAccountEvents[_0xc8ce('0x5')](_0x3b0767,_0x181370);};}exports['register']=function(_0x868d35){for(var _0x14d084=0x0,_0x4bac6b=events['length'];_0x14d084<_0x4bac6b;_0x14d084++){var _0x3ec7b1=events[_0x14d084];var _0x23974f=createListener(_0xc8ce('0x6')+_0x3ec7b1,_0x868d35);OpenchannelAccountEvents['on'](_0x3ec7b1,_0x23974f);}}; \ No newline at end of file +var _0xca9a=['./openchannelAccount.events','save','remove','update','register','length'];(function(_0x139000,_0x2dfd4f){var _0x251c5c=function(_0x42d907){while(--_0x42d907){_0x139000['push'](_0x139000['shift']());}};_0x251c5c(++_0x2dfd4f);}(_0xca9a,0xae));var _0xaca9=function(_0x3a02da,_0x207df0){_0x3a02da=_0x3a02da-0x0;var _0x10e655=_0xca9a[_0x3a02da];return _0x10e655;};'use strict';var OpenchannelAccountEvents=require(_0xaca9('0x0'));var events=[_0xaca9('0x1'),_0xaca9('0x2'),_0xaca9('0x3')];function createListener(_0x423c6d,_0x5254a9){return function(_0x5b7352){_0x5254a9['emit'](_0x423c6d,_0x5b7352);};}function removeListener(_0x1d75d4,_0x37a9d6){return function(){OpenchannelAccountEvents['removeListener'](_0x1d75d4,_0x37a9d6);};}exports[_0xaca9('0x4')]=function(_0x1f78a5){for(var _0x1d9900=0x0,_0x3b4194=events[_0xaca9('0x5')];_0x1d9900<_0x3b4194;_0x1d9900++){var _0x4509d5=events[_0x1d9900];var _0x323901=createListener('openchannelAccount:'+_0x4509d5,_0x1f78a5);OpenchannelAccountEvents['on'](_0x4509d5,_0x323901);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 8211aaf..d1103af 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 _0x42e6=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','index','/:id','show','post','isAuthenticated','create','put','update','delete'];(function(_0x11fb3f,_0x18b521){var _0x10ecfd=function(_0x2275d4){while(--_0x2275d4){_0x11fb3f['push'](_0x11fb3f['shift']());}};_0x10ecfd(++_0x18b521);}(_0x42e6,0x167));var _0x642e=function(_0x45a00b,_0x4f3748){_0x45a00b=_0x45a00b-0x0;var _0x4fc511=_0x42e6[_0x45a00b];return _0x4fc511;};'use strict';var multer=require('multer');var util=require(_0x642e('0x0'));var path=require(_0x642e('0x1'));var timeout=require(_0x642e('0x2'));var express=require(_0x642e('0x3'));var router=express[_0x642e('0x4')]();var fs_extra=require(_0x642e('0x5'));var auth=require(_0x642e('0x6'));var interaction=require(_0x642e('0x7'));var config=require(_0x642e('0x8'));var controller=require(_0x642e('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x642e('0xa')]);router['get'](_0x642e('0xb'),auth['isAuthenticated'](),controller[_0x642e('0xc')]);router[_0x642e('0xd')]('/',auth[_0x642e('0xe')](),controller[_0x642e('0xf')]);router[_0x642e('0x10')]('/:id',auth[_0x642e('0xe')](),controller[_0x642e('0x11')]);router[_0x642e('0x12')](_0x642e('0xb'),auth[_0x642e('0xe')](),controller[_0x642e('0x13')]);module[_0x642e('0x14')]=router; \ No newline at end of file +var _0x1676=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','index','get','/:id','show','post','put','delete','exports','multer','util','path'];(function(_0x54edfc,_0x2cee84){var _0x516b86=function(_0x1ded9a){while(--_0x1ded9a){_0x54edfc['push'](_0x54edfc['shift']());}};_0x516b86(++_0x2cee84);}(_0x1676,0xf9));var _0x6167=function(_0x4d54de,_0x14cc7f){_0x4d54de=_0x4d54de-0x0;var _0x23b9f4=_0x1676[_0x4d54de];return _0x23b9f4;};'use strict';var multer=require(_0x6167('0x0'));var util=require(_0x6167('0x1'));var path=require(_0x6167('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6167('0x3')]();var fs_extra=require(_0x6167('0x4'));var auth=require(_0x6167('0x5'));var interaction=require(_0x6167('0x6'));var config=require(_0x6167('0x7'));var controller=require(_0x6167('0x8'));router['get']('/',auth[_0x6167('0x9')](),controller[_0x6167('0xa')]);router[_0x6167('0xb')](_0x6167('0xc'),auth['isAuthenticated'](),controller[_0x6167('0xd')]);router[_0x6167('0xe')]('/',auth[_0x6167('0x9')](),controller['create']);router[_0x6167('0xf')](_0x6167('0xc'),auth[_0x6167('0x9')](),controller['update']);router[_0x6167('0x10')]('/:id',auth[_0x6167('0x9')](),controller['destroy']);module[_0x6167('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 24afa64..3bff513 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 _0x3b12=['noop','TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x5e4278,_0x53ed71){var _0x2b35fe=function(_0x172b6f){while(--_0x172b6f){_0x5e4278['push'](_0x5e4278['shift']());}};_0x2b35fe(++_0x53ed71);}(_0x3b12,0x14c));var _0x23b1=function(_0xa0ad61,_0x4c640c){_0xa0ad61=_0xa0ad61-0x0;var _0xb419f7=_0x3b12[_0xa0ad61];return _0xb419f7;};'use strict';var Sequelize=require(_0x23b1('0x0'));module[_0x23b1('0x1')]={'priority':{'type':Sequelize[_0x23b1('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x23b1('0x3')],'allowNull':![],'defaultValue':_0x23b1('0x4')},'appdata':{'type':Sequelize[_0x23b1('0x5')]()},'description':{'type':Sequelize[_0x23b1('0x3')]},'interval':{'type':Sequelize[_0x23b1('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xeafa=['exports','INTEGER','STRING','TEXT'];(function(_0x4069d6,_0x32c6d1){var _0x3ae8ed=function(_0x4812e7){while(--_0x4812e7){_0x4069d6['push'](_0x4069d6['shift']());}};_0x3ae8ed(++_0x32c6d1);}(_0xeafa,0x1e8));var _0xaeaf=function(_0x5a3b2b,_0x22903e){_0x5a3b2b=_0x5a3b2b-0x0;var _0x3568c7=_0xeafa[_0x5a3b2b];return _0x3568c7;};'use strict';var Sequelize=require('sequelize');module[_0xaeaf('0x0')]={'priority':{'type':Sequelize[_0xaeaf('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xaeaf('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xaeaf('0x3')]()},'description':{'type':Sequelize[_0xaeaf('0x2')]},'interval':{'type':Sequelize[_0xaeaf('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index db2b3b5..1b92f28 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 _0x259e=['querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x29ec8d,_0x12eb2d){var _0x2f2b5c=function(_0x13a93c){while(--_0x13a93c){_0x29ec8d['push'](_0x29ec8d['shift']());}};_0x2f2b5c(++_0x12eb2d);}(_0x259e,0x1ea));var _0xe259=function(_0x4b3880,_0x3f3989){_0x4b3880=_0x4b3880-0x0;var _0x5155a4=_0x259e[_0x4b3880];return _0x5155a4;};'use strict';var pdf=require(_0xe259('0x0'));var emlformat=require(_0xe259('0x1'));var rimraf=require(_0xe259('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe259('0x3'));var rp=require(_0xe259('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe259('0x5'));var util=require(_0xe259('0x6'));var path=require('path');var sox=require(_0xe259('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe259('0x8'));var _=require(_0xe259('0x9'));var squel=require(_0xe259('0xa'));var crypto=require(_0xe259('0xb'));var jsforce=require(_0xe259('0xc'));var deskjs=require(_0xe259('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe259('0xe'));var Papa=require('papaparse');var Redis=require(_0xe259('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe259('0x10'));var as=require(_0xe259('0x11'));var hardwareService=require(_0xe259('0x12'));var logger=require(_0xe259('0x13'))('api');var utils=require(_0xe259('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe259('0x15'));var db=require(_0xe259('0x16'))['db'];function respondWithStatusCode(_0x38737c,_0x444d2b){_0x444d2b=_0x444d2b||0xcc;return function(_0xc58886){if(_0xc58886){return _0x38737c[_0xe259('0x17')](_0x444d2b);}return _0x38737c[_0xe259('0x18')](_0x444d2b)[_0xe259('0x19')]();};}function respondWithResult(_0x4e564a,_0x367889){_0x367889=_0x367889||0xc8;return function(_0x550e48){if(_0x550e48){return _0x4e564a[_0xe259('0x18')](_0x367889)[_0xe259('0x1a')](_0x550e48);}};}function respondWithFilteredResult(_0x5b9e12,_0x5e567b){return function(_0x4cb490){if(_0x4cb490){var _0x1be7bb=_0x4cb490['count'],_0x29c8f5=_0x5e567b[_0xe259('0x1b')],_0xd5292d=_0x5e567b[_0xe259('0x1b')]+_0x5e567b[_0xe259('0x1c')],_0x2048df;if(_0xd5292d>=_0x1be7bb){_0xd5292d=_0x1be7bb;_0x2048df=0xc8;}else{_0x2048df=0xce;}_0x5b9e12['status'](_0x2048df);return _0x5b9e12[_0xe259('0x1d')](_0xe259('0x1e'),_0x29c8f5+'-'+_0xd5292d+'/'+_0x1be7bb)[_0xe259('0x1a')](_0x4cb490);}return null;};}function patchUpdates(_0x370831){return function(_0x49c78c){try{jsonpatch[_0xe259('0x1f')](_0x49c78c,_0x370831,!![]);}catch(_0x1a3005){return BPromise[_0xe259('0x20')](_0x1a3005);}return _0x49c78c['save']();};}function saveUpdates(_0x237bfd,_0x152989){return function(_0x92013c){if(_0x92013c){return _0x92013c[_0xe259('0x21')](_0x237bfd)[_0xe259('0x22')](function(_0x5c3347){return _0x5c3347;});}return null;};}function removeEntity(_0x2aff43,_0x5186f1){return function(_0x4696df){if(_0x4696df){return _0x4696df[_0xe259('0x23')]()[_0xe259('0x22')](function(){_0x2aff43[_0xe259('0x18')](0xcc)[_0xe259('0x19')]();});}};}function handleEntityNotFound(_0x5973d9,_0x7351de){return function(_0x38746c){if(!_0x38746c){_0x5973d9['sendStatus'](0x194);}return _0x38746c;};}function handleError(_0x15f1f6,_0x51806a){_0x51806a=_0x51806a||0x1f4;return function(_0x4322a0){logger[_0xe259('0x24')](_0x4322a0[_0xe259('0x25')]);if(_0x4322a0[_0xe259('0x26')]){delete _0x4322a0[_0xe259('0x26')];}_0x15f1f6[_0xe259('0x18')](_0x51806a)['send'](_0x4322a0);};}exports['index']=function(_0x3a1e4b,_0x185ad5){var _0x32b147={},_0x4ee8ef={},_0x44d2c0={'count':0x0,'rows':[]};var _0x5e71cf=_[_0xe259('0x27')](db[_0xe259('0x28')][_0xe259('0x29')],function(_0x2f88d0){return{'name':_0x2f88d0[_0xe259('0x2a')],'type':_0x2f88d0[_0xe259('0x2b')][_0xe259('0x2c')]};});_0x4ee8ef[_0xe259('0x2d')]=_['map'](_0x5e71cf,_0xe259('0x26'));_0x4ee8ef['query']=_[_0xe259('0x2e')](_0x3a1e4b[_0xe259('0x2f')]);_0x4ee8ef[_0xe259('0x30')]=_[_0xe259('0x31')](_0x4ee8ef[_0xe259('0x2d')],_0x4ee8ef[_0xe259('0x2f')]);_0x32b147[_0xe259('0x32')]=_[_0xe259('0x31')](_0x4ee8ef[_0xe259('0x2d')],qs[_0xe259('0x33')](_0x3a1e4b['query'][_0xe259('0x33')]));_0x32b147[_0xe259('0x32')]=_0x32b147[_0xe259('0x32')]['length']?_0x32b147[_0xe259('0x32')]:_0x4ee8ef['model'];if(!_0x3a1e4b['query']['hasOwnProperty'](_0xe259('0x34'))){_0x32b147[_0xe259('0x1c')]=qs[_0xe259('0x1c')](_0x3a1e4b[_0xe259('0x2f')]['limit']);_0x32b147[_0xe259('0x1b')]=qs[_0xe259('0x1b')](_0x3a1e4b['query']['offset']);}_0x32b147[_0xe259('0x35')]=qs[_0xe259('0x36')](_0x3a1e4b[_0xe259('0x2f')]['sort']);_0x32b147[_0xe259('0x37')]=qs[_0xe259('0x30')](_['pick'](_0x3a1e4b['query'],_0x4ee8ef[_0xe259('0x30')]),_0x5e71cf);if(_0x3a1e4b[_0xe259('0x2f')][_0xe259('0x38')]){_0x32b147[_0xe259('0x37')]=_[_0xe259('0x39')](_0x32b147['where'],{'$or':_[_0xe259('0x27')](_0x5e71cf,function(_0x1e8356){if(_0x1e8356[_0xe259('0x2b')]!==_0xe259('0x3a')){var _0x4cfb39={};_0x4cfb39[_0x1e8356[_0xe259('0x26')]]={'$like':'%'+_0x3a1e4b[_0xe259('0x2f')][_0xe259('0x38')]+'%'};return _0x4cfb39;}})});}_0x32b147=_[_0xe259('0x39')]({},_0x32b147,_0x3a1e4b[_0xe259('0x3b')]);var _0x54e99c={'where':_0x32b147[_0xe259('0x37')]};return db[_0xe259('0x28')][_0xe259('0x3c')](_0x54e99c)[_0xe259('0x22')](function(_0x22c10c){_0x44d2c0[_0xe259('0x3c')]=_0x22c10c;if(_0x3a1e4b[_0xe259('0x2f')][_0xe259('0x3d')]){_0x32b147[_0xe259('0x3e')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0xe259('0x3f')](_0x32b147);})[_0xe259('0x22')](function(_0x10cc95){_0x44d2c0[_0xe259('0x40')]=_0x10cc95;return _0x44d2c0;})[_0xe259('0x22')](respondWithFilteredResult(_0x185ad5,_0x32b147))['catch'](handleError(_0x185ad5,null));};exports[_0xe259('0x41')]=function(_0x4e2cae,_0x42b395){var _0x5746b4={'raw':!![],'where':{'id':_0x4e2cae[_0xe259('0x42')]['id']}},_0x52cca4={};_0x52cca4[_0xe259('0x2d')]=_['keys'](db[_0xe259('0x28')]['rawAttributes']);_0x52cca4['query']=_[_0xe259('0x2e')](_0x4e2cae['query']);_0x52cca4[_0xe259('0x30')]=_[_0xe259('0x31')](_0x52cca4[_0xe259('0x2d')],_0x52cca4[_0xe259('0x2f')]);_0x5746b4['attributes']=_[_0xe259('0x31')](_0x52cca4[_0xe259('0x2d')],qs[_0xe259('0x33')](_0x4e2cae['query']['fields']));_0x5746b4['attributes']=_0x5746b4[_0xe259('0x32')][_0xe259('0x43')]?_0x5746b4[_0xe259('0x32')]:_0x52cca4['model'];if(_0x4e2cae[_0xe259('0x2f')][_0xe259('0x3d')]){_0x5746b4[_0xe259('0x3e')]=[{'all':!![]}];}_0x5746b4=_[_0xe259('0x39')]({},_0x5746b4,_0x4e2cae[_0xe259('0x3b')]);return db[_0xe259('0x28')][_0xe259('0x44')](_0x5746b4)[_0xe259('0x22')](handleEntityNotFound(_0x42b395,null))[_0xe259('0x22')](respondWithResult(_0x42b395,null))[_0xe259('0x45')](handleError(_0x42b395,null));};exports[_0xe259('0x46')]=function(_0x241ffb,_0x44cb4f){return db[_0xe259('0x28')][_0xe259('0x46')](_0x241ffb[_0xe259('0x47')],{})[_0xe259('0x22')](respondWithResult(_0x44cb4f,0xc9))[_0xe259('0x45')](handleError(_0x44cb4f,null));};exports['update']=function(_0x3762a1,_0x1e1363){if(_0x3762a1[_0xe259('0x47')]['id']){delete _0x3762a1[_0xe259('0x47')]['id'];}return db['OpenchannelApplication'][_0xe259('0x44')]({'where':{'id':_0x3762a1[_0xe259('0x42')]['id']}})[_0xe259('0x22')](handleEntityNotFound(_0x1e1363,null))[_0xe259('0x22')](saveUpdates(_0x3762a1['body'],null))[_0xe259('0x22')](respondWithResult(_0x1e1363,null))[_0xe259('0x45')](handleError(_0x1e1363,null));};exports['destroy']=function(_0x5960e9,_0x2932f6){return db[_0xe259('0x28')][_0xe259('0x44')]({'where':{'id':_0x5960e9[_0xe259('0x42')]['id']}})[_0xe259('0x22')](handleEntityNotFound(_0x2932f6,null))[_0xe259('0x22')](removeEntity(_0x2932f6,null))[_0xe259('0x45')](handleError(_0x2932f6,null));}; \ No newline at end of file +var _0x7831=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','destroy','then','error','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','length','find','create','body','params','html-pdf','fast-json-patch','moment','bluebird'];(function(_0x41414c,_0x362f67){var _0x547978=function(_0x46fc3c){while(--_0x46fc3c){_0x41414c['push'](_0x41414c['shift']());}};_0x547978(++_0x362f67);}(_0x7831,0x124));var _0x1783=function(_0x2ba47a,_0x31ec4c){_0x2ba47a=_0x2ba47a-0x0;var _0x21d3eb=_0x7831[_0x2ba47a];return _0x21d3eb;};'use strict';var pdf=require(_0x1783('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1783('0x1'));var rp=require('request-promise');var moment=require(_0x1783('0x2'));var BPromise=require(_0x1783('0x3'));var Mustache=require(_0x1783('0x4'));var util=require(_0x1783('0x5'));var path=require(_0x1783('0x6'));var sox=require(_0x1783('0x7'));var csv=require(_0x1783('0x8'));var ejs=require(_0x1783('0x9'));var fs=require('fs');var fs_extra=require(_0x1783('0xa'));var _=require(_0x1783('0xb'));var squel=require('squel');var crypto=require(_0x1783('0xc'));var jsforce=require(_0x1783('0xd'));var deskjs=require(_0x1783('0xe'));var toCsv=require(_0x1783('0x8'));var querystring=require(_0x1783('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1783('0x10'));var qs=require(_0x1783('0x11'));var as=require(_0x1783('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1783('0x13'))(_0x1783('0x14'));var utils=require(_0x1783('0x15'));var config=require(_0x1783('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1783('0x17'))['db'];function respondWithStatusCode(_0x426c01,_0x205439){_0x205439=_0x205439||0xcc;return function(_0x1cac1f){if(_0x1cac1f){return _0x426c01[_0x1783('0x18')](_0x205439);}return _0x426c01['status'](_0x205439)[_0x1783('0x19')]();};}function respondWithResult(_0x2ba127,_0xb79055){_0xb79055=_0xb79055||0xc8;return function(_0x5d0f4d){if(_0x5d0f4d){return _0x2ba127[_0x1783('0x1a')](_0xb79055)[_0x1783('0x1b')](_0x5d0f4d);}};}function respondWithFilteredResult(_0x2d6ab0,_0x41d06c){return function(_0x255f08){if(_0x255f08){var _0x1974c9=_0x255f08[_0x1783('0x1c')],_0x377501=_0x41d06c[_0x1783('0x1d')],_0x5e7376=_0x41d06c['offset']+_0x41d06c[_0x1783('0x1e')],_0x4b0725;if(_0x5e7376>=_0x1974c9){_0x5e7376=_0x1974c9;_0x4b0725=0xc8;}else{_0x4b0725=0xce;}_0x2d6ab0[_0x1783('0x1a')](_0x4b0725);return _0x2d6ab0[_0x1783('0x1f')]('Content-Range',_0x377501+'-'+_0x5e7376+'/'+_0x1974c9)[_0x1783('0x1b')](_0x255f08);}return null;};}function patchUpdates(_0x21d3c6){return function(_0x2e7b44){try{jsonpatch[_0x1783('0x20')](_0x2e7b44,_0x21d3c6,!![]);}catch(_0x427486){return BPromise[_0x1783('0x21')](_0x427486);}return _0x2e7b44[_0x1783('0x22')]();};}function saveUpdates(_0x4c5458,_0x3a1730){return function(_0x4773ae){if(_0x4773ae){return _0x4773ae[_0x1783('0x23')](_0x4c5458)['then'](function(_0x5f51b9){return _0x5f51b9;});}return null;};}function removeEntity(_0x1400fa,_0x245e3a){return function(_0x437fcb){if(_0x437fcb){return _0x437fcb[_0x1783('0x24')]()[_0x1783('0x25')](function(){_0x1400fa[_0x1783('0x1a')](0xcc)[_0x1783('0x19')]();});}};}function handleEntityNotFound(_0x5d9cde,_0x4d4f24){return function(_0x2ca0e2){if(!_0x2ca0e2){_0x5d9cde[_0x1783('0x18')](0x194);}return _0x2ca0e2;};}function handleError(_0x2f7417,_0x65b720){_0x65b720=_0x65b720||0x1f4;return function(_0xf813db){logger[_0x1783('0x26')](_0xf813db['stack']);if(_0xf813db[_0x1783('0x27')]){delete _0xf813db[_0x1783('0x27')];}_0x2f7417[_0x1783('0x1a')](_0x65b720)[_0x1783('0x28')](_0xf813db);};}exports[_0x1783('0x29')]=function(_0x5a3227,_0x144ff2){var _0x4b9a9c={},_0x2d6d33={},_0x3f51d7={'count':0x0,'rows':[]};var _0x180f13=_[_0x1783('0x2a')](db[_0x1783('0x2b')][_0x1783('0x2c')],function(_0x14122e){return{'name':_0x14122e[_0x1783('0x2d')],'type':_0x14122e['type'][_0x1783('0x2e')]};});_0x2d6d33[_0x1783('0x2f')]=_[_0x1783('0x2a')](_0x180f13,_0x1783('0x27'));_0x2d6d33[_0x1783('0x30')]=_[_0x1783('0x31')](_0x5a3227[_0x1783('0x30')]);_0x2d6d33[_0x1783('0x32')]=_[_0x1783('0x33')](_0x2d6d33[_0x1783('0x2f')],_0x2d6d33[_0x1783('0x30')]);_0x4b9a9c[_0x1783('0x34')]=_[_0x1783('0x33')](_0x2d6d33[_0x1783('0x2f')],qs[_0x1783('0x35')](_0x5a3227[_0x1783('0x30')][_0x1783('0x35')]));_0x4b9a9c[_0x1783('0x34')]=_0x4b9a9c[_0x1783('0x34')]['length']?_0x4b9a9c[_0x1783('0x34')]:_0x2d6d33[_0x1783('0x2f')];if(!_0x5a3227[_0x1783('0x30')][_0x1783('0x36')](_0x1783('0x37'))){_0x4b9a9c[_0x1783('0x1e')]=qs[_0x1783('0x1e')](_0x5a3227[_0x1783('0x30')][_0x1783('0x1e')]);_0x4b9a9c['offset']=qs['offset'](_0x5a3227[_0x1783('0x30')]['offset']);}_0x4b9a9c['order']=qs['sort'](_0x5a3227[_0x1783('0x30')][_0x1783('0x38')]);_0x4b9a9c[_0x1783('0x39')]=qs['filters'](_[_0x1783('0x3a')](_0x5a3227[_0x1783('0x30')],_0x2d6d33['filters']),_0x180f13);if(_0x5a3227['query'][_0x1783('0x3b')]){_0x4b9a9c[_0x1783('0x39')]=_[_0x1783('0x3c')](_0x4b9a9c[_0x1783('0x39')],{'$or':_[_0x1783('0x2a')](_0x180f13,function(_0x72820a){if(_0x72820a[_0x1783('0x3d')]!==_0x1783('0x3e')){var _0x3696a8={};_0x3696a8[_0x72820a[_0x1783('0x27')]]={'$like':'%'+_0x5a3227['query'][_0x1783('0x3b')]+'%'};return _0x3696a8;}})});}_0x4b9a9c=_['merge']({},_0x4b9a9c,_0x5a3227[_0x1783('0x3f')]);var _0x1a13cc={'where':_0x4b9a9c[_0x1783('0x39')]};return db[_0x1783('0x2b')][_0x1783('0x1c')](_0x1a13cc)[_0x1783('0x25')](function(_0x29a2e4){_0x3f51d7[_0x1783('0x1c')]=_0x29a2e4;if(_0x5a3227[_0x1783('0x30')][_0x1783('0x40')]){_0x4b9a9c[_0x1783('0x41')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x1783('0x42')](_0x4b9a9c);})[_0x1783('0x25')](function(_0x3d7f72){_0x3f51d7['rows']=_0x3d7f72;return _0x3f51d7;})[_0x1783('0x25')](respondWithFilteredResult(_0x144ff2,_0x4b9a9c))[_0x1783('0x43')](handleError(_0x144ff2,null));};exports[_0x1783('0x44')]=function(_0x16b0e2,_0x55f52c){var _0xdc8816={'raw':!![],'where':{'id':_0x16b0e2['params']['id']}},_0x3559e8={};_0x3559e8[_0x1783('0x2f')]=_[_0x1783('0x31')](db[_0x1783('0x2b')][_0x1783('0x2c')]);_0x3559e8[_0x1783('0x30')]=_['keys'](_0x16b0e2[_0x1783('0x30')]);_0x3559e8[_0x1783('0x32')]=_[_0x1783('0x33')](_0x3559e8[_0x1783('0x2f')],_0x3559e8['query']);_0xdc8816[_0x1783('0x34')]=_[_0x1783('0x33')](_0x3559e8['model'],qs[_0x1783('0x35')](_0x16b0e2['query'][_0x1783('0x35')]));_0xdc8816[_0x1783('0x34')]=_0xdc8816[_0x1783('0x34')][_0x1783('0x45')]?_0xdc8816['attributes']:_0x3559e8[_0x1783('0x2f')];if(_0x16b0e2['query'][_0x1783('0x40')]){_0xdc8816[_0x1783('0x41')]=[{'all':!![]}];}_0xdc8816=_[_0x1783('0x3c')]({},_0xdc8816,_0x16b0e2[_0x1783('0x3f')]);return db[_0x1783('0x2b')][_0x1783('0x46')](_0xdc8816)[_0x1783('0x25')](handleEntityNotFound(_0x55f52c,null))[_0x1783('0x25')](respondWithResult(_0x55f52c,null))[_0x1783('0x43')](handleError(_0x55f52c,null));};exports[_0x1783('0x47')]=function(_0x211d6e,_0x3540f4){return db['OpenchannelApplication'][_0x1783('0x47')](_0x211d6e['body'],{})[_0x1783('0x25')](respondWithResult(_0x3540f4,0xc9))[_0x1783('0x43')](handleError(_0x3540f4,null));};exports[_0x1783('0x23')]=function(_0x51aa34,_0x52529f){if(_0x51aa34[_0x1783('0x48')]['id']){delete _0x51aa34[_0x1783('0x48')]['id'];}return db[_0x1783('0x2b')][_0x1783('0x46')]({'where':{'id':_0x51aa34[_0x1783('0x49')]['id']}})[_0x1783('0x25')](handleEntityNotFound(_0x52529f,null))[_0x1783('0x25')](saveUpdates(_0x51aa34['body'],null))['then'](respondWithResult(_0x52529f,null))[_0x1783('0x43')](handleError(_0x52529f,null));};exports[_0x1783('0x24')]=function(_0x2f2d37,_0x2a95b9){return db['OpenchannelApplication'][_0x1783('0x46')]({'where':{'id':_0x2f2d37[_0x1783('0x49')]['id']}})[_0x1783('0x25')](handleEntityNotFound(_0x2a95b9,null))['then'](removeEntity(_0x2a95b9,null))[_0x1783('0x43')](handleError(_0x2a95b9,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 45dc812..fd2ae79 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 _0x3e47=['moment','bluebird','request-promise','path','rimraf','./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x5c7525,_0x39490f){var _0x2e2ec8=function(_0x20d59a){while(--_0x20d59a){_0x5c7525['push'](_0x5c7525['shift']());}};_0x2e2ec8(++_0x39490f);}(_0x3e47,0x1bc));var _0x73e4=function(_0x371a1d,_0x3591f3){_0x371a1d=_0x371a1d-0x0;var _0x4ba340=_0x3e47[_0x371a1d];return _0x4ba340;};'use strict';var _=require(_0x73e4('0x0'));var util=require(_0x73e4('0x1'));var logger=require(_0x73e4('0x2'))(_0x73e4('0x3'));var moment=require(_0x73e4('0x4'));var BPromise=require(_0x73e4('0x5'));var rp=require(_0x73e4('0x6'));var fs=require('fs');var path=require(_0x73e4('0x7'));var rimraf=require(_0x73e4('0x8'));var config=require('../../config/environment');var attributes=require(_0x73e4('0x9'));module[_0x73e4('0xa')]=function(_0x989760,_0x3c4752){return _0x989760[_0x73e4('0xb')]('OpenchannelApplication',attributes,{'tableName':_0x73e4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x73e4('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x60ac=['../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','request-promise','rimraf'];(function(_0x4c2f94,_0x233f5a){var _0x4a6122=function(_0x356cac){while(--_0x356cac){_0x4c2f94['push'](_0x4c2f94['shift']());}};_0x4a6122(++_0x233f5a);}(_0x60ac,0x187));var _0xc60a=function(_0x4933d5,_0x15a500){_0x4933d5=_0x4933d5-0x0;var _0x1feb0f=_0x60ac[_0x4933d5];return _0x1feb0f;};'use strict';var _=require('lodash');var util=require(_0xc60a('0x0'));var logger=require(_0xc60a('0x1'))(_0xc60a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc60a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc60a('0x4'));var config=require(_0xc60a('0x5'));var attributes=require(_0xc60a('0x6'));module[_0xc60a('0x7')]=function(_0xe77823,_0x4a3497){return _0xe77823[_0xc60a('0x8')](_0xc60a('0x9'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc60a('0xa'),'collate':_0xc60a('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 8360ccd..cab9a9f 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 _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0xda9702,_0x521922){var _0x105be5=function(_0x11b6fb){while(--_0x11b6fb){_0xda9702['push'](_0xda9702['shift']());}};_0x105be5(++_0x521922);}(_0xb10b,0x12a));var _0xbb10=function(_0x4d35f3,_0x19ba66){_0x4d35f3=_0x4d35f3-0x0;var _0x382fea=_0xb10b[_0x4d35f3];return _0x382fea;};'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?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file +var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x460bdd,_0xde57aa){var _0x2eaaec=function(_0x45d19a){while(--_0x45d19a){_0x460bdd['push'](_0x460bdd['shift']());}};_0x2eaaec(++_0xde57aa);}(_0xb10b,0x12a));var _0xbb10=function(_0x528511,_0x815fd3){_0x528511=_0x528511-0x0;var _0xd1b2b7=_0xb10b[_0x528511];return _0xd1b2b7;};'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?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 5e81e9f..693145e 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 _0xa9e0=['tracked','openchannel','openchannelinteraction:addtags','addTags','/:id','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','show','/:id/messages','isAuthenticated','getMessages','create','post','addMessage','/:id/tags'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x10')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['post'](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x15')),controller[_0x0a9e('0x16')]);router['put'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')]('openchannel',_0x0a9e('0x18')),controller[_0x0a9e('0x19')]);router['delete'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x1a')),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1c')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);module[_0x0a9e('0x1e')]=router; \ No newline at end of file +var _0xa9e0=['tracked','openchannel','openchannelinteraction:addtags','addTags','/:id','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','show','/:id/messages','isAuthenticated','getMessages','create','post','addMessage','/:id/tags'];(function(_0x1488cd,_0x25a893){var _0x63fa13=function(_0x57dd1c){while(--_0x57dd1c){_0x1488cd['push'](_0x1488cd['shift']());}};_0x63fa13(++_0x25a893);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x10')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['post'](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x15')),controller[_0x0a9e('0x16')]);router['put'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')]('openchannel',_0x0a9e('0x18')),controller[_0x0a9e('0x19')]);router['delete'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x1a')),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1c')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);module[_0x0a9e('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 0918a51..44a7201 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 _0x10f8=['out','sequelize','DATE','STRING','ENUM'];(function(_0x16db8b,_0xca7d28){var _0x5ba017=function(_0x35b933){while(--_0x35b933){_0x16db8b['push'](_0x16db8b['shift']());}};_0x5ba017(++_0xca7d28);}(_0x10f8,0x119));var _0x810f=function(_0x1d2bc8,_0x2860bc){_0x1d2bc8=_0x1d2bc8-0x0;var _0x1857e1=_0x10f8[_0x1d2bc8];return _0x1857e1;};'use strict';var Sequelize=require(_0x810f('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x810f('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x810f('0x2')]},'thirdDisposition':{'type':Sequelize[_0x810f('0x2')]},'note':{'type':Sequelize[_0x810f('0x2')]},'read1stAt':{'type':Sequelize[_0x810f('0x1')]},'threadId':{'type':Sequelize[_0x810f('0x2')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x810f('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x810f('0x3')]('in',_0x810f('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x810f('0x2')]}}; \ No newline at end of file +var _0xd7d0=['sequelize','exports','DATE','STRING','out'];(function(_0x4f3030,_0x4577a3){var _0x4be84f=function(_0x1a0229){while(--_0x1a0229){_0x4f3030['push'](_0x4f3030['shift']());}};_0x4be84f(++_0x4577a3);}(_0xd7d0,0x113));var _0x0d7d=function(_0x57862e,_0x2c787f){_0x57862e=_0x57862e-0x0;var _0x1f44ba=_0xd7d0[_0x57862e];return _0x1f44ba;};'use strict';var Sequelize=require(_0x0d7d('0x0'));module[_0x0d7d('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0d7d('0x2')]},'disposition':{'type':Sequelize[_0x0d7d('0x3')]},'secondDisposition':{'type':Sequelize[_0x0d7d('0x3')]},'thirdDisposition':{'type':Sequelize[_0x0d7d('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x0d7d('0x3')]},'externalUrl':{'type':Sequelize[_0x0d7d('0x3')]},'lastMsgAt':{'type':Sequelize[_0x0d7d('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x0d7d('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x0d7d('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 8005e66..3c1fa68 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 _0x7d89=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','register','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','end','error','name','send','map','TagIds','Tags','push','catch','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','keys','intersection','model','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','tools_tags','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','openchannel_interactions','cm_contacts','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','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','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?','start','body','some','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\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)','t.id\x20IN\x20?','then','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','role','toString','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','show','params','includeAll','include','options','create','destroy','describe','addMessage','ids','getMessages','findOne','OpenchannelMessage','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','omit','spread','Tag','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','fullname','CmContact','lastName','Attachment','Messages','secret','Account','Owner','mkdirSync','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','YYYY-MM-DD','N.A.','closed','closedAt','disposition','threadId','Public','basename','existsSync','pipe','createWriteStream','out','System','firstName','direction','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js'];(function(_0x43eadd,_0x36ca50){var _0x125bde=function(_0x5d74cf){while(--_0x5d74cf){_0x43eadd['push'](_0x43eadd['shift']());}};_0x125bde(++_0x36ca50);}(_0x7d89,0xed));var _0x97d8=function(_0x38dd1d,_0x212b9d){_0x38dd1d=_0x38dd1d-0x0;var _0x5f50e0=_0x7d89[_0x38dd1d];return _0x5f50e0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x97d8('0x0'));var rimraf=require(_0x97d8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x97d8('0x2'));var rp=require(_0x97d8('0x3'));var moment=require('moment');var BPromise=require(_0x97d8('0x4'));var Mustache=require(_0x97d8('0x5'));var util=require(_0x97d8('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x97d8('0x7'));var ejs=require(_0x97d8('0x8'));var fs=require('fs');var fs_extra=require(_0x97d8('0x9'));var _=require(_0x97d8('0xa'));var squel=require(_0x97d8('0xb'));var crypto=require(_0x97d8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x97d8('0xd'));var toCsv=require('to-csv');var querystring=require(_0x97d8('0xe'));var Papa=require(_0x97d8('0xf'));var Redis=require(_0x97d8('0x10'));var authService=require(_0x97d8('0x11'));var qs=require(_0x97d8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97d8('0x13'));var logger=require('../../config/logger')(_0x97d8('0x14'));var utils=require(_0x97d8('0x15'));var config=require(_0x97d8('0x16'));var licenseUtil=require(_0x97d8('0x17'));var db=require(_0x97d8('0x18'))['db'];config[_0x97d8('0x19')]=_['defaults'](config[_0x97d8('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x97d8('0x19')]));require('./openchannelInteraction.socket')[_0x97d8('0x1a')](socket);function respondWithStatusCode(_0x5ea155,_0xe03d49){_0xe03d49=_0xe03d49||0xcc;return function(_0x4d1440){if(_0x4d1440){return _0x5ea155[_0x97d8('0x1b')](_0xe03d49);}return _0x5ea155[_0x97d8('0x1c')](_0xe03d49)['end']();};}function respondWithResult(_0x3281c4,_0x1dc30e){_0x1dc30e=_0x1dc30e||0xc8;return function(_0x253ec5){if(_0x253ec5){return _0x3281c4[_0x97d8('0x1c')](_0x1dc30e)[_0x97d8('0x1d')](_0x253ec5);}};}function respondWithFilteredResult(_0x355278,_0x4fffbc){return function(_0x40afb3){if(_0x40afb3){var _0x25a0d2=_0x40afb3[_0x97d8('0x1e')],_0x15386a=_0x4fffbc[_0x97d8('0x1f')],_0x55d183=_0x4fffbc[_0x97d8('0x1f')]+_0x4fffbc[_0x97d8('0x20')],_0x18ee40;if(_0x55d183>=_0x25a0d2){_0x55d183=_0x25a0d2;_0x18ee40=0xc8;}else{_0x18ee40=0xce;}_0x355278[_0x97d8('0x1c')](_0x18ee40);return _0x355278[_0x97d8('0x21')](_0x97d8('0x22'),_0x15386a+'-'+_0x55d183+'/'+_0x25a0d2)[_0x97d8('0x1d')](_0x40afb3);}return null;};}function patchUpdates(_0xbc3146){return function(_0x2908c8){try{jsonpatch['apply'](_0x2908c8,_0xbc3146,!![]);}catch(_0x6b388e){return BPromise[_0x97d8('0x23')](_0x6b388e);}return _0x2908c8[_0x97d8('0x24')]();};}function saveUpdates(_0x2c37f7,_0x187844){return function(_0x296731){if(_0x296731){return _0x296731[_0x97d8('0x25')](_0x2c37f7)['then'](function(_0x28bdaf){return _0x28bdaf;});}return null;};}function removeEntity(_0x5dc657,_0x2b495a){return function(_0x20767c){if(_0x20767c){return _0x20767c['destroy']()['then'](function(){_0x5dc657[_0x97d8('0x1c')](0xcc)[_0x97d8('0x26')]();});}};}function handleEntityNotFound(_0x2823cf,_0x407791){return function(_0x4c9536){if(!_0x4c9536){_0x2823cf[_0x97d8('0x1b')](0x194);}return _0x4c9536;};}function handleError(_0x155328,_0x80815f){_0x80815f=_0x80815f||0x1f4;return function(_0x160acf){logger[_0x97d8('0x27')](_0x160acf['stack']);if(_0x160acf[_0x97d8('0x28')]){delete _0x160acf['name'];}_0x155328[_0x97d8('0x1c')](_0x80815f)[_0x97d8('0x29')](_0x160acf);};}function getInteractionUsers(_0x521ffc,_0x57da32){return new BPromise(function(_0x4d29db,_0x1ca079){try{if(_0x57da32[_0x521ffc['id']]){_0x521ffc['Users']=_[_0x97d8('0x2a')](_0x57da32[_0x521ffc['id']],function(_0x59d628){return{'id':_0x59d628['id'],'fullname':_0x59d628['fullname']};});}}catch(_0x589cfc){_0x1ca079(_0x589cfc);}_0x4d29db(_0x521ffc);});}function getInteractionTags(_0x3320eb,_0x3abe9d){return new BPromise(function(_0x50b27f,_0x143e85){try{if(_0x3320eb[_0x97d8('0x2b')]){_0x3320eb[_0x97d8('0x2c')]=[];_0x3320eb['TagIds']['split'](',')['forEach'](function(_0x6985b6){_0x3320eb[_0x97d8('0x2c')][_0x97d8('0x2d')](_0x3abe9d[_0x6985b6]);});}delete _0x3320eb['TagIds'];}catch(_0x2a9a9e){_0x143e85(_0x2a9a9e);}_0x50b27f(_0x3320eb);});}function updateOpenchannelInteraction(_0x5e38e2,_0x274ef7,_0x235eaa){return new BPromise(function(_0x34b35e,_0x2d37c5){return getInteractionUsers(_0x5e38e2,_0x235eaa)['then'](function(_0x56d0a9){return getInteractionTags(_0x56d0a9,_0x274ef7);})['then'](function(_0xc9778){_0x34b35e(_0xc9778);})[_0x97d8('0x2e')](function(_0x5dca33){_0x2d37c5(_0x5dca33);});});}exports[_0x97d8('0x2f')]=function(_0x3f8fde,_0x4d185d){var _0x2855b5={},_0x82f635={},_0x463f9b={'count':0x0,'rows':[]};var _0xe1dbd9=_[_0x97d8('0x2a')](db[_0x97d8('0x30')][_0x97d8('0x31')],function(_0x2c12b1){return{'name':_0x2c12b1[_0x97d8('0x32')],'type':_0x2c12b1[_0x97d8('0x33')][_0x97d8('0x34')]};});_0x82f635['model']=_[_0x97d8('0x2a')](_0xe1dbd9,'name');_0x82f635['query']=_[_0x97d8('0x35')](_0x3f8fde['query']);_0x82f635['filters']=_[_0x97d8('0x36')](_0x82f635[_0x97d8('0x37')],_0x82f635[_0x97d8('0x38')]);_0x2855b5['attributes']=_[_0x97d8('0x36')](_0x82f635['model'],qs['fields'](_0x3f8fde['query'][_0x97d8('0x39')]));_0x2855b5[_0x97d8('0x3a')]=_0x2855b5[_0x97d8('0x3a')][_0x97d8('0x3b')]?_0x2855b5[_0x97d8('0x3a')]:_0x82f635[_0x97d8('0x37')];if(!_0x3f8fde[_0x97d8('0x38')][_0x97d8('0x3c')](_0x97d8('0x3d'))){_0x2855b5[_0x97d8('0x20')]=qs[_0x97d8('0x20')](_0x3f8fde[_0x97d8('0x38')]['limit']);_0x2855b5[_0x97d8('0x1f')]=qs[_0x97d8('0x1f')](_0x3f8fde[_0x97d8('0x38')][_0x97d8('0x1f')]);}_0x2855b5[_0x97d8('0x3e')]=qs[_0x97d8('0x3f')](_0x3f8fde[_0x97d8('0x38')][_0x97d8('0x3f')]);_0x2855b5[_0x97d8('0x40')]=qs[_0x97d8('0x41')](_[_0x97d8('0x42')](_0x3f8fde[_0x97d8('0x38')],_0x82f635['filters']),_0xe1dbd9);var _0x4a7617=[];var _0x10ff82=squel[_0x97d8('0x43')]()[_0x97d8('0x44')]('id')['field']('name')[_0x97d8('0x44')](_0x97d8('0x45'))['from'](_0x97d8('0x46'));var _0x10a25a=squel[_0x97d8('0x43')]()['field']('u.id')[_0x97d8('0x44')](_0x97d8('0x47'))[_0x97d8('0x44')](_0x97d8('0x48'))['from'](_0x97d8('0x49'),'ui')[_0x97d8('0x4a')](_0x97d8('0x4b'),'u',_0x97d8('0x4c'));var _0x46507f=squel['select']()[_0x97d8('0x4d')](_0x97d8('0x4e'),'i')[_0x97d8('0x4a')](_0x97d8('0x4f'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x97d8('0x4b'),'o',_0x97d8('0x50'))[_0x97d8('0x4a')](_0x97d8('0x51'),'a',_0x97d8('0x52'))[_0x97d8('0x4a')](_0x97d8('0x53'),'me',_0x97d8('0x54'))[_0x97d8('0x4a')](_0x97d8('0x55'),'it',_0x97d8('0x56'))[_0x97d8('0x4a')](_0x97d8('0x46'),'t',_0x97d8('0x57'));var _0x5b74ec=squel[_0x97d8('0x58')]();var _0x2d4c92=[];var _0x46c01e=squel[_0x97d8('0x58')]();var _0x31ad05;if(_0x3f8fde[_0x97d8('0x38')][_0x97d8('0x59')]){_0x31ad05=as[_0x97d8('0x5a')](_0x3f8fde[_0x97d8('0x38')][_0x97d8('0x59')]);var _0x48912d=_0x31ad05[_0x97d8('0x5b')];for(var _0x355bcc=0x0;_0x355bcc<_0x31ad05[_0x97d8('0x5c')][_0x97d8('0x3b')];_0x355bcc++){var _0x1f5607=_0x31ad05[_0x97d8('0x5c')][_0x355bcc];var _0x265bd5='i';var _0x48c173=_[_0x97d8('0x5d')](_0xe1dbd9,['name',_0x1f5607[_0x97d8('0x44')]]);if(!_0x48c173){switch(_0x1f5607['field']){case _0x97d8('0x5e'):if(_0x1f5607[_0x97d8('0x5f')]==0x1){_0x46507f[_0x97d8('0x60')]('`'+_0x1f5607['field']+_0x97d8('0x61'));}else{_0x46507f[_0x97d8('0x60')]('`'+_0x1f5607[_0x97d8('0x44')]+_0x97d8('0x62'));}break;case _0x97d8('0x63'):if(_0x1f5607[_0x97d8('0x64')]==='$substring'){if(_0x1f5607['value'][_0x97d8('0x65')]('\x20')[_0x97d8('0x3b')]>0x1){_0x5b74ec[_0x48912d](_0x97d8('0x66'),qs[_0x97d8('0x67')](_0x1f5607[_0x97d8('0x5f')]),null);}else{var _0x235f1f='%'+_0x1f5607[_0x97d8('0x5f')]+'%';_0x5b74ec[_0x48912d](_0x97d8('0x68'),_0x235f1f,_0x235f1f,_0x235f1f);}}else{_0x48c173=_[_0x97d8('0x5d')](_0xe1dbd9,[_0x97d8('0x28'),_0x97d8('0x69')]);_0x1f5607['field']=_0x97d8('0x69');_0x291498=as[_0x97d8('0x6a')](_0x265bd5,_0x48c173[_0x97d8('0x33')],_0x1f5607);_0x5b74ec[_0x48912d](_0x291498[_0x97d8('0x6b')],_0x291498[_0x97d8('0x5f')]['start'],_0x291498[_0x97d8('0x5f')][_0x97d8('0x26')]);}break;case'Tag':var _0x559864=_0x1f5607[_0x97d8('0x5f')]['split'](',')['map'](function(_0x32ef06){return Number(_0x32ef06);});_0x559864[_0x97d8('0x6c')](function(_0x39f980){_0x46c01e['or'](_0x97d8('0x6d'),'%,'+_0x39f980+',%');});_0x2d4c92=_[_0x97d8('0x6e')](_0x2d4c92,_0x559864);break;case _0x97d8('0x6f'):if(_0x1f5607[_0x97d8('0x64')]===_0x97d8('0x70')){_0x5b74ec[_0x48912d](_0x97d8('0x71'),'%'+_0x1f5607['value']+'%',null);}else{_0x48c173=_[_0x97d8('0x5d')](_0xe1dbd9,[_0x97d8('0x28'),'UserId']);_0x1f5607['field']='UserId';_0x291498=as[_0x97d8('0x6a')](_0x265bd5,_0x48c173[_0x97d8('0x33')],_0x1f5607);_0x5b74ec[_0x48912d](_0x291498[_0x97d8('0x6b')],_0x291498[_0x97d8('0x5f')][_0x97d8('0x72')],_0x291498[_0x97d8('0x5f')]['end']);}break;case _0x97d8('0x73'):_0x291498=as['buildExpression']('me',null,_0x1f5607);_0x5b74ec[_0x48912d](_0x291498[_0x97d8('0x6b')],_0x291498['value'][_0x97d8('0x72')],_0x291498[_0x97d8('0x5f')][_0x97d8('0x26')]);break;}}else{var _0x291498=as[_0x97d8('0x6a')](_0x265bd5,_0x48c173[_0x97d8('0x33')],_0x1f5607);_0x5b74ec[_0x48912d](_0x291498[_0x97d8('0x6b')],_0x291498[_0x97d8('0x5f')][_0x97d8('0x72')],_0x291498['value'][_0x97d8('0x26')]);}}}else{var _0x155da9=_(_0x3f8fde[_0x97d8('0x38')])['keys']()[_0x97d8('0x2a')](function(_0x1efe7d){return _[_0x97d8('0x74')](_0xe1dbd9,[_0x97d8('0x28'),_0x1efe7d])?_0x1efe7d:undefined;})['compact']()[_0x97d8('0x5f')]();if(!_[_0x97d8('0x75')](_0x155da9)){_0x155da9['forEach'](function(_0x50a0f8){if(_0x50a0f8===_0x97d8('0x76')){_0x46507f[_0x97d8('0x40')](_0x97d8('0x77'),[][_0x97d8('0x78')](_0x3f8fde['query'][_0x50a0f8]));}else if(_0x50a0f8===_0x97d8('0x79')){var _0x5d8ad1=JSON[_0x97d8('0x7a')](_0x3f8fde[_0x97d8('0x38')][_0x50a0f8])['$gte'];var _0x181445=JSON['parse'](_0x3f8fde['query'][_0x50a0f8])[_0x97d8('0x7b')];_0x46507f[_0x97d8('0x40')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5d8ad1,_0x181445);}else{if(_0x3f8fde[_0x97d8('0x38')][_0x50a0f8]===_0x97d8('0x7c')){_0x46507f['where']('i.'+_0x50a0f8+_0x97d8('0x7d'));}else{_0x46507f[_0x97d8('0x40')]('i.'+_0x50a0f8+_0x97d8('0x7e'),_0x3f8fde[_0x97d8('0x38')][_0x50a0f8]);}}});}if(_0x3f8fde[_0x97d8('0x38')]['read']){if(_0x3f8fde[_0x97d8('0x38')][_0x97d8('0x7f')]==0x1){_0x46507f[_0x97d8('0x60')](_0x97d8('0x80'));}else{_0x46507f[_0x97d8('0x60')](_0x97d8('0x81'));}}if(_0x3f8fde[_0x97d8('0x38')][_0x97d8('0x82')]){_0x2d4c92=_['isArray'](_0x3f8fde[_0x97d8('0x38')][_0x97d8('0x82')])?_0x3f8fde[_0x97d8('0x38')]['tag']:new Array(_0x3f8fde[_0x97d8('0x38')][_0x97d8('0x82')]);_0x2d4c92[_0x97d8('0x6c')](function(_0x1941e3){_0x46c01e['or'](_0x97d8('0x6d'),'%,'+_0x1941e3+',%');});}if(_0x3f8fde[_0x97d8('0x38')]['filter']){var _0x4c79aa=_0x3f8fde['query']['filter'][_0x97d8('0x83')]('\x5c','\x5c\x5c')[_0x97d8('0x83')](/'/g,'\x27\x27');if(qs[_0x97d8('0x84')](_0x4c79aa)){_0x5b74ec['or'](_0x97d8('0x85'),_0x4c79aa+'%');}else{_0x5b74ec['or'](_0x97d8('0x86'),qs[_0x97d8('0x67')](_0x4c79aa))['or'](_0x97d8('0x87'),_0x4c79aa+'%')['or'](_0x97d8('0x88'),_0x4c79aa+'%');}}}_0x46507f['where'](_0x5b74ec);_0x46507f[_0x97d8('0x89')](_0x97d8('0x8a'));var _0x3782d7={'type':db['Sequelize'][_0x97d8('0x8b')][_0x97d8('0x8c')],'raw':!![]};var _0x560f13=_0x46507f[_0x97d8('0x8d')]();_0x560f13[_0x97d8('0x44')](_0x97d8('0x8a'));_0x560f13[_0x97d8('0x44')](_0x97d8('0x8e'),'unreadMessages');if(_0x2855b5[_0x97d8('0x3e')]){_0x2855b5[_0x97d8('0x3e')][_0x97d8('0x6c')](function(_0x3f18ad){var _0x263ff4=_0x3f18ad[0x0]==='contactName'?_0x3f18ad[0x0]:'i.'+_0x3f18ad[0x0];_0x46507f['order'](_0x263ff4,_0x3f18ad[0x1]==='DESC'?![]:!![]);});}if(!_[_0x97d8('0x75')](_0x2d4c92)){_0x46507f[_0x97d8('0x60')](_0x46c01e);_0x560f13[_0x97d8('0x40')](_0x97d8('0x8f'),_0x2d4c92);}BPromise['resolve']()[_0x97d8('0x90')](function(){if(!_0x31ad05){if(_0x3f8fde[_0x97d8('0x38')][_0x97d8('0x76')])return;_0x560f13[_0x97d8('0x40')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x46507f[_0x97d8('0x40')](_0x97d8('0x91'));return;}if(_0x3f8fde[_0x97d8('0x92')]['role']!==_0x97d8('0x93'))return;return _0x3f8fde['user'][_0x97d8('0x94')]({'attributes':['id'],'raw':!![]})[_0x97d8('0x90')](function(_0x1d4ef5){if(_[_0x97d8('0x75')](_0x1d4ef5)){_0x560f13[_0x97d8('0x40')](_0x97d8('0x95'));_0x46507f[_0x97d8('0x40')](_0x97d8('0x95'));}else{_0x560f13[_0x97d8('0x40')](_0x97d8('0x77'),_['map'](_0x1d4ef5,'id'));_0x46507f[_0x97d8('0x40')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x97d8('0x2a')](_0x1d4ef5,'id'));}});})['then'](function(){if(_0x3f8fde[_0x97d8('0x92')][_0x97d8('0x96')]===_0x97d8('0x93')&&!_0x31ad05&&!_0x3f8fde[_0x97d8('0x38')][_0x97d8('0x76')])return[];return db['sequelize'][_0x97d8('0x38')](_0x560f13['toString'](),_0x3782d7);})[_0x97d8('0x90')](function(_0x5546e0){_0x463f9b[_0x97d8('0x1e')]=_0x5546e0[_0x97d8('0x3b')];if(_0x463f9b['count']===0x0)return[];return db['sequelize'][_0x97d8('0x38')](_0x10ff82[_0x97d8('0x97')](),_0x3782d7)[_0x97d8('0x90')](function(_0x41b577){_0x4a7617=_['keyBy'](_0x41b577,'id');_0x3782d7=_[_0x97d8('0x98')](_0x3782d7,{'model':db[_0x97d8('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3f8fde['query'][_0x97d8('0x39')]){_0x2855b5['attributes'][_0x97d8('0x6c')](function(_0x1add63){_0x46507f[_0x97d8('0x44')]('i.'+_0x1add63);});}else{_0x46507f[_0x97d8('0x44')](_0x97d8('0x8e'),_0x97d8('0x5e'));_0x46507f[_0x97d8('0x44')](_0x97d8('0x99'),_0x97d8('0x9a'));_0x46507f[_0x97d8('0x44')](_0x97d8('0x9b'),_0x97d8('0x9c'));_0x46507f[_0x97d8('0x44')](_0x97d8('0x9d'),_0x97d8('0x9e'));_0x46507f[_0x97d8('0x44')](_0x97d8('0x9f'));_0x46507f[_0x97d8('0x44')]('c.firstName',_0x97d8('0xa0'));_0x46507f['field'](_0x97d8('0xa1'),_0x97d8('0xa2'));_0x46507f[_0x97d8('0x44')](_0x97d8('0xa3'),'Contact.email');_0x46507f['field'](_0x97d8('0xa4'),_0x97d8('0xa5'));_0x46507f[_0x97d8('0x44')](_0x97d8('0xa6'),_0x97d8('0xa7'));_0x46507f[_0x97d8('0x44')](_0x97d8('0xa8'),_0x97d8('0xa9'));_0x46507f[_0x97d8('0x44')](_0x97d8('0xaa'),'Owner.fullname');_0x46507f[_0x97d8('0x44')](_0x97d8('0xab'),_0x97d8('0xac'));_0x46507f['field'](_0x97d8('0xad'),_0x97d8('0x2b'));}if(_0x2855b5['limit'])_0x46507f['limit'](_0x2855b5[_0x97d8('0x20')]);if(_0x2855b5[_0x97d8('0x1f')])_0x46507f[_0x97d8('0x1f')](_0x2855b5[_0x97d8('0x1f')]);return db[_0x97d8('0xae')][_0x97d8('0x38')](_0x46507f['toString'](),_0x3782d7);})[_0x97d8('0x90')](function(_0xc2587d){_0x10a25a[_0x97d8('0x40')](_0x97d8('0xaf'),_[_0x97d8('0x2a')](_0xc2587d,'id'));return db[_0x97d8('0xae')][_0x97d8('0x38')](_0x10a25a[_0x97d8('0x97')](),_0x3782d7)['then'](function(_0x4114ad){var _0x589864=_[_0x97d8('0xb0')](_0x4114ad,_0x97d8('0xb1'));var _0x305a72=[];_0xc2587d[_0x97d8('0x6c')](function(_0x3878f6){_0x305a72['push'](updateOpenchannelInteraction(_0x3878f6,_0x4a7617,_0x589864));});return BPromise[_0x97d8('0xb2')](_0x305a72);});});})[_0x97d8('0x90')](function(_0x305c48){_0x463f9b['rows']=_0x305c48;return _0x463f9b;})[_0x97d8('0x90')](respondWithFilteredResult(_0x4d185d,_0x2855b5))[_0x97d8('0x2e')](handleError(_0x4d185d,null));};exports[_0x97d8('0xb3')]=function(_0x23b767,_0x577619){var _0x9a1ccb={};if(_0x23b767['query']['type']&&_0x23b767[_0x97d8('0x38')]['type']===_0x97d8('0x4d')){_0x9a1ccb[_0x97d8('0x4d')]=_0x23b767[_0x97d8('0xb4')]['id'];}else{_0x9a1ccb['id']=_0x23b767[_0x97d8('0xb4')]['id'];}var _0x7129c9={'raw':![],'where':_0x9a1ccb},_0x19de6f={};_0x19de6f[_0x97d8('0x37')]=_[_0x97d8('0x35')](db['OpenchannelInteraction']['rawAttributes']);_0x19de6f[_0x97d8('0x38')]=_[_0x97d8('0x35')](_0x23b767[_0x97d8('0x38')]);_0x19de6f[_0x97d8('0x41')]=_[_0x97d8('0x36')](_0x19de6f[_0x97d8('0x37')],_0x19de6f[_0x97d8('0x38')]);_0x7129c9[_0x97d8('0x3a')]=_['intersection'](_0x19de6f['model'],qs[_0x97d8('0x39')](_0x23b767[_0x97d8('0x38')][_0x97d8('0x39')]));_0x7129c9[_0x97d8('0x3a')]=_0x7129c9[_0x97d8('0x3a')][_0x97d8('0x3b')]?_0x7129c9[_0x97d8('0x3a')]:_0x19de6f['model'];if(_0x23b767[_0x97d8('0x38')][_0x97d8('0xb5')]){_0x7129c9[_0x97d8('0xb6')]=[{'all':!![]}];}_0x7129c9=_['merge']({},_0x7129c9,_0x23b767[_0x97d8('0xb7')]);return db['OpenchannelInteraction'][_0x97d8('0x5d')](_0x7129c9)['then'](handleEntityNotFound(_0x577619,null))[_0x97d8('0x90')](respondWithResult(_0x577619,null))[_0x97d8('0x2e')](handleError(_0x577619,null));};exports['create']=function(_0x12538d,_0x298c9a){return db['OpenchannelInteraction'][_0x97d8('0xb8')](_0x12538d[_0x97d8('0x73')],{})['then'](respondWithResult(_0x298c9a,0xc9))[_0x97d8('0x2e')](handleError(_0x298c9a,null));};exports[_0x97d8('0x25')]=function(_0x1a7ed2,_0x116fcc){if(_0x1a7ed2[_0x97d8('0x73')]['id']){delete _0x1a7ed2[_0x97d8('0x73')]['id'];}return db[_0x97d8('0x30')][_0x97d8('0x5d')]({'where':{'id':_0x1a7ed2[_0x97d8('0xb4')]['id']}})[_0x97d8('0x90')](handleEntityNotFound(_0x116fcc,null))[_0x97d8('0x90')](saveUpdates(_0x1a7ed2['body'],null))[_0x97d8('0x90')](respondWithResult(_0x116fcc,null))['catch'](handleError(_0x116fcc,null));};exports[_0x97d8('0xb9')]=function(_0x4bc844,_0x42b19d){return db[_0x97d8('0x30')]['find']({'where':{'id':_0x4bc844['params']['id']}})['then'](handleEntityNotFound(_0x42b19d,null))[_0x97d8('0x90')](removeEntity(_0x42b19d,null))[_0x97d8('0x2e')](handleError(_0x42b19d,null));};exports[_0x97d8('0xba')]=function(_0x14a166,_0x30eeb0){return db[_0x97d8('0x30')][_0x97d8('0xba')]()[_0x97d8('0x90')](respondWithResult(_0x30eeb0,null))[_0x97d8('0x2e')](handleError(_0x30eeb0,null));};exports[_0x97d8('0xbb')]=function(_0x3891ed,_0x1dbdbe,_0x11abaa){return db['OpenchannelMessage'][_0x97d8('0x5d')]({'where':{'id':_0x3891ed['params']['id']}})[_0x97d8('0x90')](handleEntityNotFound(_0x1dbdbe,null))[_0x97d8('0x90')](function(_0xcbf541){if(_0xcbf541){return _0xcbf541[_0x97d8('0xbb')](_0x3891ed[_0x97d8('0x73')][_0x97d8('0xbc')],_['omit'](_0x3891ed[_0x97d8('0x73')],[_0x97d8('0xbc'),'id'])||{});}})[_0x97d8('0x90')](respondWithResult(_0x1dbdbe,null))[_0x97d8('0x2e')](handleError(_0x1dbdbe,null));};exports[_0x97d8('0xbd')]=function(_0xf580e9,_0x474b0a,_0x3f9a86){var _0x5b026d={'raw':![],'where':{}};var _0x2157f9={};var _0x4c8129={'count':0x0,'rows':[]};return db[_0x97d8('0x30')][_0x97d8('0xbe')]({'where':{'id':_0xf580e9[_0x97d8('0xb4')]['id']}})[_0x97d8('0x90')](handleEntityNotFound(_0x474b0a,null))[_0x97d8('0x90')](function(_0x381867){if(_0x381867){_0x2157f9[_0x97d8('0x37')]=_[_0x97d8('0x35')](db[_0x97d8('0xbf')][_0x97d8('0x31')]);_0x2157f9['query']=_[_0x97d8('0x35')](_0xf580e9[_0x97d8('0x38')]);_0x2157f9[_0x97d8('0x41')]=_['intersection'](_0x2157f9['model'],_0x2157f9['query']);_0x5b026d[_0x97d8('0x3a')]=_[_0x97d8('0x36')](_0x2157f9['model'],qs['fields'](_0xf580e9[_0x97d8('0x38')][_0x97d8('0x39')]));_0x5b026d['attributes']=_0x5b026d[_0x97d8('0x3a')]['length']?_0x5b026d[_0x97d8('0x3a')]:_0x2157f9[_0x97d8('0x37')];if(!_0xf580e9[_0x97d8('0x38')][_0x97d8('0x3c')](_0x97d8('0x3d'))){_0x5b026d['limit']=qs[_0x97d8('0x20')](_0xf580e9[_0x97d8('0x38')][_0x97d8('0x20')]);_0x5b026d[_0x97d8('0x1f')]=qs[_0x97d8('0x1f')](_0xf580e9[_0x97d8('0x38')][_0x97d8('0x1f')]);}_0x5b026d[_0x97d8('0x3e')]=qs['sort'](_0xf580e9[_0x97d8('0x38')][_0x97d8('0x3f')]);_0x5b026d[_0x97d8('0x40')]=qs[_0x97d8('0x41')](_[_0x97d8('0x42')](_0xf580e9[_0x97d8('0x38')],_0x2157f9[_0x97d8('0x41')]));_0x5b026d[_0x97d8('0x40')][_0x97d8('0xb1')]=_0x381867['id'];if(_0xf580e9[_0x97d8('0x38')][_0x97d8('0xc0')]){_0x5b026d[_0x97d8('0x40')]=_['merge'](_0x5b026d[_0x97d8('0x40')],{'$or':_['map'](_0x5b026d[_0x97d8('0x3a')],function(_0x7e8706){var _0x16a1f7={};_0x16a1f7[_0x7e8706]={'$like':'%'+_0xf580e9[_0x97d8('0x38')][_0x97d8('0xc0')]+'%'};return _0x16a1f7;})});}if(_0xf580e9[_0x97d8('0x38')][_0x97d8('0xc1')]){var _0x5c3a47=_0xf580e9[_0x97d8('0x38')][_0x97d8('0xc1')][_0x97d8('0x65')](',');var _0x2a044c={};_0x2a044c[_0x5c3a47[0x0]]={'$gte':moment(_0x5c3a47[0x1])[_0x97d8('0xc2')](_0x97d8('0xc3'))};_0x5b026d[_0x97d8('0x40')]=_[_0x97d8('0x98')](_0x5b026d[_0x97d8('0x40')],_0x2a044c);}_0x5b026d=_[_0x97d8('0x98')]({},_0x5b026d,_0xf580e9[_0x97d8('0xb7')]);return db['OpenchannelMessage'][_0x97d8('0x1e')]({'where':_0x5b026d[_0x97d8('0x40')]})[_0x97d8('0x90')](function(_0x18150b){_0x4c8129[_0x97d8('0x1e')]=_0x18150b;if(_0xf580e9['query']['includeAll']){_0x5b026d[_0x97d8('0xb6')]=[{'all':!![]}];}return db[_0x97d8('0xbf')][_0x97d8('0xc4')](_0x5b026d);})[_0x97d8('0x90')](function(_0x5b5add){_0x4c8129['rows']=_0x5b5add;return _0x4c8129;});}})[_0x97d8('0x90')](respondWithFilteredResult(_0x474b0a,_0x5b026d))[_0x97d8('0x2e')](handleError(_0x474b0a,null));};exports[_0x97d8('0xc5')]=function(_0x3c9701,_0x50bb51,_0x4c11d0){return db[_0x97d8('0x30')]['find']({'where':{'id':_0x3c9701['params']['id']}})['then'](handleEntityNotFound(_0x50bb51,null))[_0x97d8('0x90')](function(_0x88c61d){if(_0x88c61d){return _0x88c61d['setTags'](_0x3c9701[_0x97d8('0x73')]['ids'],_[_0x97d8('0xc6')](_0x3c9701[_0x97d8('0x73')],['ids','id'])||{})[_0x97d8('0xc7')](function(){return db[_0x97d8('0xc8')]['findAll']({'attributes':['id','name',_0x97d8('0x45')],'where':{'id':_0x3c9701[_0x97d8('0x73')][_0x97d8('0xbc')]}});})['then'](function(_0x5dbd17){socket[_0x97d8('0xc9')](_0x97d8('0xca'),{'id':Number(_0x3c9701[_0x97d8('0xb4')]['id']),'tags':_0x5dbd17||[]});return{'id':Number(_0x3c9701[_0x97d8('0xb4')]['id']),'tags':_0x5dbd17||[]};});}})[_0x97d8('0x90')](respondWithResult(_0x50bb51,null))[_0x97d8('0x2e')](handleError(_0x50bb51,null));};exports[_0x97d8('0xcb')]=function(_0x55aaab,_0xd859a0,_0x4c61af){return db[_0x97d8('0x30')]['find']({'where':{'id':_0x55aaab[_0x97d8('0xb4')]['id']}})[_0x97d8('0x90')](handleEntityNotFound(_0xd859a0,null))['then'](function(_0x1bd22e){if(_0x1bd22e){return _0x1bd22e[_0x97d8('0xcb')](_0x55aaab[_0x97d8('0x38')][_0x97d8('0xbc')]);}})[_0x97d8('0x90')](respondWithStatusCode(_0xd859a0,null))[_0x97d8('0x2e')](handleError(_0xd859a0,null));};exports[_0x97d8('0xcc')]=function(_0x13b02b,_0x3a9058){var _0x210e10=moment()[_0x97d8('0xcd')]()[_0x97d8('0x97')]();var _0x227931=path[_0x97d8('0xce')](config[_0x97d8('0xcf')],_0x97d8('0xd0'),_0x97d8('0xd1'),_0x97d8('0xd2'));var _0x28185f=path[_0x97d8('0xce')](config['root'],_0x97d8('0xd0'),'files',_0x97d8('0xd3'));var _0x3d2993=path['join'](_0x227931,_0x210e10);var _0x382225=util[_0x97d8('0xc2')]('transcript-%d-%s.zip',_0x13b02b[_0x97d8('0xb4')]['id'],_0x210e10);var _0x33c47d=path[_0x97d8('0xce')](_0x227931,_0x382225);var _0x5c5cd8=[];_0x5c5cd8[_0x97d8('0x2d')]({'model':db[_0x97d8('0x6f')],'as':_0x97d8('0x6f'),'attributes':['id',_0x97d8('0xd4')],'raw':!![]});_0x5c5cd8[_0x97d8('0x2d')]({'model':db[_0x97d8('0xd5')],'as':_0x97d8('0x63'),'attributes':['id','firstName',_0x97d8('0xd6')],'raw':!![]});if(_0x13b02b['query'][_0x97d8('0xd3')]){_0x5c5cd8[_0x97d8('0x2d')]({'model':db['Attachment'],'as':_0x97d8('0xd7'),'raw':!![]});}var _0x3f2ff0=[{'model':db[_0x97d8('0xbf')],'as':_0x97d8('0xd8'),'attributes':['id',_0x97d8('0x73'),_0x97d8('0x79'),'direction',_0x97d8('0xd9'),'read'],'include':_0x5c5cd8}];_0x3f2ff0['push']({'model':db['OpenchannelAccount'],'as':_0x97d8('0xda'),'attributes':['id',_0x97d8('0x28')]});_0x3f2ff0[_0x97d8('0x2d')]({'model':db[_0x97d8('0x6f')],'as':_0x97d8('0xdb'),'attributes':['id','fullname']});return db[_0x97d8('0x30')][_0x97d8('0x5d')]({'where':{'id':_0x13b02b[_0x97d8('0xb4')]['id']},'include':_0x3f2ff0})[_0x97d8('0x90')](handleEntityNotFound(_0x3a9058,null))['then'](function(_0x463998){if(_0x463998){var _0x1bbd48=_0x463998['get']({'plain':!![]});fs[_0x97d8('0xdc')](_0x3d2993);var _0x22d0bb={'format':'A4','border':_0x97d8('0xdd'),'header':{'height':_0x97d8('0xde'),'contents':{'first':'\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20'}},'footer':{'height':_0x97d8('0xdf'),'contents':{'default':util['format'](_0x97d8('0xe0'),util[_0x97d8('0xc2')](_0x97d8('0xe1'),_0x97d8('0xe2'),_0x1bbd48['id']),moment()[_0x97d8('0xc2')](_0x97d8('0xe3'))[_0x97d8('0x97')]())}}};var _0x43a460={'channel':_0x97d8('0xe2'),'account':_0x1bbd48['Account'][_0x97d8('0x28')],'agent':_0x1bbd48[_0x97d8('0xdb')]?_0x1bbd48['Owner']['fullname']:_0x97d8('0xe4'),'createdAt':moment(_0x1bbd48[_0x97d8('0x79')])[_0x97d8('0xc2')](_0x97d8('0xc3'))['toString'](),'closedAt':_0x1bbd48[_0x97d8('0xe5')]?moment(_0x1bbd48[_0x97d8('0xe6')])[_0x97d8('0xc2')](_0x97d8('0xc3'))[_0x97d8('0x97')]():'','disposition':_0x1bbd48[_0x97d8('0xe7')],'visibility':_0x1bbd48[_0x97d8('0xe8')]?_0x97d8('0xe9'):'Private','messages':_(_0x1bbd48[_0x97d8('0xd8')])[_0x97d8('0xc0')]({'secret':![]})[_0x97d8('0x2a')](function(_0x3f8922){if(_0x3f8922[_0x97d8('0xd7')]){var _0x39970d=path[_0x97d8('0xce')](_0x28185f,_0x3f8922[_0x97d8('0xd7')][_0x97d8('0xea')]);if(fs[_0x97d8('0xeb')](_0x39970d)){fs['createReadStream'](_0x39970d)[_0x97d8('0xec')](fs[_0x97d8('0xed')](path[_0x97d8('0xce')](_0x3d2993,_0x3f8922[_0x97d8('0xd7')]['basename'])));}}return{'date':moment(_0x3f8922[_0x97d8('0x79')])[_0x97d8('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')[_0x97d8('0x97')](),'sender':_0x3f8922['direction']===_0x97d8('0xee')?_0x3f8922[_0x97d8('0x6f')]?_0x3f8922['User'][_0x97d8('0xd4')]:_0x97d8('0xef'):_0x3f8922[_0x97d8('0x63')][_0x97d8('0xf0')]+(_0x3f8922['Contact']['lastName']?'\x20'+_0x3f8922[_0x97d8('0x63')][_0x97d8('0xd6')]:''),'body':_0x3f8922['Attachment']?_0x3f8922[_0x97d8('0xd7')]['basename']:_0x3f8922[_0x97d8('0x73')],'direction':_0x3f8922[_0x97d8('0xf1')]===_0x97d8('0xee')?'A':'C','secret':_0x3f8922[_0x97d8('0xd9')],'read':_0x3f8922[_0x97d8('0x7f')],'attachment':_0x3f8922['Attachment']};})[_0x97d8('0x5f')]()};return ejs[_0x97d8('0xf2')](path['join'](config['root'],_0x97d8('0xd0'),_0x97d8('0xf3'),_0x97d8('0xf4')),{'interaction':_0x43a460})[_0x97d8('0x90')](function(_0x533da0){return new BPromise(function(_0x2bd555,_0x108f15){pdf[_0x97d8('0xb8')](_0x533da0,_0x22d0bb)[_0x97d8('0xf5')](path[_0x97d8('0xce')](_0x3d2993,_0x97d8('0xf6')+_0x1bbd48['id']+'-'+_0x210e10+_0x97d8('0xf7')),function(_0x3210dd,_0x205c42){if(_0x3210dd)return _0x108f15(_0x3210dd);_0x2bd555(_0x205c42);});});})['then'](function(){return new BPromise(function(_0x43b01a,_0x1f90a2){zipdir(_0x3d2993,{'saveTo':_0x33c47d},function(_0x421174,_0x345d3e){if(_0x421174)return _0x1f90a2(_0x421174);return _0x43b01a(_0x345d3e);});})[_0x97d8('0x90')](function(){return new BPromise(function(_0x99bc34,_0x51b6bc){rimraf(_0x3d2993,function(_0x3bd6cf){if(_0x3bd6cf)_0x51b6bc(_0x3bd6cf);return _0x99bc34();});});})[_0x97d8('0x90')](function(){return _0x3a9058['download'](_0x33c47d,_0x382225,function(_0x203754){if(_0x203754){console[_0x97d8('0xf8')](_0x97d8('0xf9'),_0x203754);}else{fs[_0x97d8('0xfa')](_0x33c47d);}});});});}else{return _0x3a9058['sendStatus'](0xc8);}})[_0x97d8('0x2e')](handleError(_0x3a9058,null));}; \ No newline at end of file +var _0x018c=['redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','OpenchannelInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','select','field','color','from','tools_tags','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','o.id\x20=\x20i.UserId','openchannel_accounts','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','UserId','body','some','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','fields','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','Contact.lastName','c.email','c.phone','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','all','rows','params','includeAll','include','merge','options','create','describe','OpenchannelMessage','ids','omit','getMessages','findOne','nolimit','pick','OpenchannelInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','count','findAll','addTags','setTags','spread','emit','openchannelInteractionTags:save','removeTags','download','root','files','join','format','CmContact','firstName','attachments','Attachment','OpenchannelAccount','Account','Owner','get','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','%s\x20#%d','Openchannel','YYYY-MM-DD','N.A.','closed','closedAt','threadId','Public','Private','Messages','basename','existsSync','createWriteStream','direction','out','lastName','secret','renderFile','server','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','rimraf','request-promise','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/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x451bca,_0x5611a7){var _0x19ae63=function(_0x464ed9){while(--_0x464ed9){_0x451bca['push'](_0x451bca['shift']());}};_0x19ae63(++_0x5611a7);}(_0x018c,0xda));var _0xc018=function(_0x23d9c6,_0x24be67){_0x23d9c6=_0x23d9c6-0x0;var _0x2f34a8=_0x018c[_0x23d9c6];return _0x2f34a8;};'use strict';var pdf=require(_0xc018('0x0'));var emlformat=require(_0xc018('0x1'));var rimraf=require(_0xc018('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc018('0x3'));var moment=require('moment');var BPromise=require(_0xc018('0x4'));var Mustache=require(_0xc018('0x5'));var util=require(_0xc018('0x6'));var path=require(_0xc018('0x7'));var sox=require('sox');var csv=require(_0xc018('0x8'));var ejs=require(_0xc018('0x9'));var fs=require('fs');var fs_extra=require(_0xc018('0xa'));var _=require(_0xc018('0xb'));var squel=require(_0xc018('0xc'));var crypto=require(_0xc018('0xd'));var jsforce=require(_0xc018('0xe'));var deskjs=require(_0xc018('0xf'));var toCsv=require(_0xc018('0x8'));var querystring=require(_0xc018('0x10'));var Papa=require(_0xc018('0x11'));var Redis=require(_0xc018('0x12'));var authService=require(_0xc018('0x13'));var qs=require(_0xc018('0x14'));var as=require(_0xc018('0x15'));var hardwareService=require(_0xc018('0x16'));var logger=require(_0xc018('0x17'))(_0xc018('0x18'));var utils=require('../../config/utils');var config=require(_0xc018('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc018('0x1a'))['db'];config[_0xc018('0x1b')]=_[_0xc018('0x1c')](config[_0xc018('0x1b')],{'host':_0xc018('0x1d'),'port':0x18eb});var socket=require(_0xc018('0x1e'))(new Redis(config[_0xc018('0x1b')]));require(_0xc018('0x1f'))[_0xc018('0x20')](socket);function respondWithStatusCode(_0x380bbd,_0x30d6cb){_0x30d6cb=_0x30d6cb||0xcc;return function(_0x5d0ae3){if(_0x5d0ae3){return _0x380bbd[_0xc018('0x21')](_0x30d6cb);}return _0x380bbd[_0xc018('0x22')](_0x30d6cb)[_0xc018('0x23')]();};}function respondWithResult(_0x3a07f8,_0x70a0fd){_0x70a0fd=_0x70a0fd||0xc8;return function(_0x3f023f){if(_0x3f023f){return _0x3a07f8[_0xc018('0x22')](_0x70a0fd)[_0xc018('0x24')](_0x3f023f);}};}function respondWithFilteredResult(_0x550652,_0x5f2c11){return function(_0xe5f2fe){if(_0xe5f2fe){var _0x4e388e=_0xe5f2fe['count'],_0x994233=_0x5f2c11[_0xc018('0x25')],_0x41a22d=_0x5f2c11[_0xc018('0x25')]+_0x5f2c11[_0xc018('0x26')],_0x141afc;if(_0x41a22d>=_0x4e388e){_0x41a22d=_0x4e388e;_0x141afc=0xc8;}else{_0x141afc=0xce;}_0x550652['status'](_0x141afc);return _0x550652[_0xc018('0x27')](_0xc018('0x28'),_0x994233+'-'+_0x41a22d+'/'+_0x4e388e)[_0xc018('0x24')](_0xe5f2fe);}return null;};}function patchUpdates(_0x428a57){return function(_0x5dd6d9){try{jsonpatch[_0xc018('0x29')](_0x5dd6d9,_0x428a57,!![]);}catch(_0x30e7a6){return BPromise[_0xc018('0x2a')](_0x30e7a6);}return _0x5dd6d9[_0xc018('0x2b')]();};}function saveUpdates(_0x2576b8,_0xcd7583){return function(_0x117346){if(_0x117346){return _0x117346[_0xc018('0x2c')](_0x2576b8)[_0xc018('0x2d')](function(_0x41b7da){return _0x41b7da;});}return null;};}function removeEntity(_0x208521,_0x37e6d4){return function(_0x847da8){if(_0x847da8){return _0x847da8[_0xc018('0x2e')]()[_0xc018('0x2d')](function(){_0x208521['status'](0xcc)[_0xc018('0x23')]();});}};}function handleEntityNotFound(_0x83a279,_0x195f7e){return function(_0x331a0d){if(!_0x331a0d){_0x83a279['sendStatus'](0x194);}return _0x331a0d;};}function handleError(_0xde5fb6,_0x46fd6a){_0x46fd6a=_0x46fd6a||0x1f4;return function(_0x2dc832){logger['error'](_0x2dc832['stack']);if(_0x2dc832[_0xc018('0x2f')]){delete _0x2dc832[_0xc018('0x2f')];}_0xde5fb6['status'](_0x46fd6a)['send'](_0x2dc832);};}function getInteractionUsers(_0x1a631c,_0x31373c){return new BPromise(function(_0x31fcdc,_0x5092a3){try{if(_0x31373c[_0x1a631c['id']]){_0x1a631c[_0xc018('0x30')]=_[_0xc018('0x31')](_0x31373c[_0x1a631c['id']],function(_0x11c53e){return{'id':_0x11c53e['id'],'fullname':_0x11c53e[_0xc018('0x32')]};});}}catch(_0x34ea58){_0x5092a3(_0x34ea58);}_0x31fcdc(_0x1a631c);});}function getInteractionTags(_0x34fdf4,_0x1f8cfd){return new BPromise(function(_0x24b2fb,_0x2259ff){try{if(_0x34fdf4[_0xc018('0x33')]){_0x34fdf4[_0xc018('0x34')]=[];_0x34fdf4[_0xc018('0x33')][_0xc018('0x35')](',')[_0xc018('0x36')](function(_0x513a59){_0x34fdf4[_0xc018('0x34')][_0xc018('0x37')](_0x1f8cfd[_0x513a59]);});}delete _0x34fdf4[_0xc018('0x33')];}catch(_0xb92560){_0x2259ff(_0xb92560);}_0x24b2fb(_0x34fdf4);});}function updateOpenchannelInteraction(_0x438176,_0x2da4ab,_0x4625d5){return new BPromise(function(_0x275316,_0x3f9696){return getInteractionUsers(_0x438176,_0x4625d5)[_0xc018('0x2d')](function(_0x3c8357){return getInteractionTags(_0x3c8357,_0x2da4ab);})[_0xc018('0x2d')](function(_0x1a7d13){_0x275316(_0x1a7d13);})[_0xc018('0x38')](function(_0x5b04c6){_0x3f9696(_0x5b04c6);});});}exports[_0xc018('0x39')]=function(_0x2bab06,_0x1b47cb){var _0x41f3af={},_0x3d1929={},_0x199ccc={'count':0x0,'rows':[]};var _0x23227c=_[_0xc018('0x31')](db[_0xc018('0x3a')][_0xc018('0x3b')],function(_0x44388e){return{'name':_0x44388e[_0xc018('0x3c')],'type':_0x44388e['type'][_0xc018('0x3d')]};});_0x3d1929[_0xc018('0x3e')]=_[_0xc018('0x31')](_0x23227c,_0xc018('0x2f'));_0x3d1929[_0xc018('0x3f')]=_[_0xc018('0x40')](_0x2bab06[_0xc018('0x3f')]);_0x3d1929[_0xc018('0x41')]=_[_0xc018('0x42')](_0x3d1929[_0xc018('0x3e')],_0x3d1929[_0xc018('0x3f')]);_0x41f3af[_0xc018('0x43')]=_[_0xc018('0x42')](_0x3d1929[_0xc018('0x3e')],qs['fields'](_0x2bab06['query']['fields']));_0x41f3af[_0xc018('0x43')]=_0x41f3af[_0xc018('0x43')][_0xc018('0x44')]?_0x41f3af['attributes']:_0x3d1929[_0xc018('0x3e')];if(!_0x2bab06[_0xc018('0x3f')][_0xc018('0x45')]('nolimit')){_0x41f3af[_0xc018('0x26')]=qs[_0xc018('0x26')](_0x2bab06['query'][_0xc018('0x26')]);_0x41f3af['offset']=qs[_0xc018('0x25')](_0x2bab06[_0xc018('0x3f')][_0xc018('0x25')]);}_0x41f3af[_0xc018('0x46')]=qs[_0xc018('0x47')](_0x2bab06[_0xc018('0x3f')][_0xc018('0x47')]);_0x41f3af[_0xc018('0x48')]=qs['filters'](_['pick'](_0x2bab06[_0xc018('0x3f')],_0x3d1929[_0xc018('0x41')]),_0x23227c);var _0x3680e3=[];var _0x50f8c1=squel[_0xc018('0x49')]()[_0xc018('0x4a')]('id')['field'](_0xc018('0x2f'))[_0xc018('0x4a')](_0xc018('0x4b'))[_0xc018('0x4c')](_0xc018('0x4d'));var _0x111851=squel[_0xc018('0x49')]()['field']('u.id')[_0xc018('0x4a')](_0xc018('0x4e'))['field'](_0xc018('0x4f'))[_0xc018('0x4c')](_0xc018('0x50'),'ui')['left_join'](_0xc018('0x51'),'u',_0xc018('0x52'));var _0x4fa11c=squel[_0xc018('0x49')]()[_0xc018('0x4c')](_0xc018('0x53'),'i')[_0xc018('0x54')](_0xc018('0x55'),'c',_0xc018('0x56'))['left_join'](_0xc018('0x51'),'o',_0xc018('0x57'))[_0xc018('0x54')](_0xc018('0x58'),'a','a.id\x20=\x20i.OpenchannelAccountId')['left_join']('openchannel_messages','me','me.OpenchannelInteractionId\x20=\x20i.id')['left_join'](_0xc018('0x59'),'it',_0xc018('0x5a'))[_0xc018('0x54')](_0xc018('0x4d'),'t',_0xc018('0x5b'));var _0x4eefc7=squel['expr']();var _0x4edd5f=[];var _0x132dde=squel[_0xc018('0x5c')]();var _0x3eef49;if(_0x2bab06[_0xc018('0x3f')][_0xc018('0x5d')]){_0x3eef49=as['parseSearch'](_0x2bab06[_0xc018('0x3f')][_0xc018('0x5d')]);var _0x28532e=_0x3eef49[_0xc018('0x5e')];for(var _0x252b60=0x0;_0x252b60<_0x3eef49[_0xc018('0x5f')][_0xc018('0x44')];_0x252b60++){var _0x45aedb=_0x3eef49['conditions'][_0x252b60];var _0x4cc6b4='i';var _0x8063f5=_[_0xc018('0x60')](_0x23227c,[_0xc018('0x2f'),_0x45aedb[_0xc018('0x4a')]]);if(!_0x8063f5){switch(_0x45aedb['field']){case'unreadMessages':if(_0x45aedb[_0xc018('0x61')]==0x1){_0x4fa11c[_0xc018('0x62')]('`'+_0x45aedb[_0xc018('0x4a')]+_0xc018('0x63'));}else{_0x4fa11c['having']('`'+_0x45aedb[_0xc018('0x4a')]+_0xc018('0x64'));}break;case _0xc018('0x65'):if(_0x45aedb[_0xc018('0x66')]==='$substring'){if(_0x45aedb[_0xc018('0x61')][_0xc018('0x35')]('\x20')[_0xc018('0x44')]>0x1){_0x4eefc7[_0x28532e](_0xc018('0x67'),qs[_0xc018('0x68')](_0x45aedb[_0xc018('0x61')]),null);}else{var _0x8e488d='%'+_0x45aedb[_0xc018('0x61')]+'%';_0x4eefc7[_0x28532e]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x8e488d,_0x8e488d,_0x8e488d);}}else{_0x8063f5=_[_0xc018('0x60')](_0x23227c,['name',_0xc018('0x69')]);_0x45aedb[_0xc018('0x4a')]=_0xc018('0x69');_0x47062e=as[_0xc018('0x6a')](_0x4cc6b4,_0x8063f5[_0xc018('0x6b')],_0x45aedb);_0x4eefc7[_0x28532e](_0x47062e[_0xc018('0x6c')],_0x47062e[_0xc018('0x61')][_0xc018('0x6d')],_0x47062e['value'][_0xc018('0x23')]);}break;case _0xc018('0x6e'):var _0x390e9b=_0x45aedb['value']['split'](',')[_0xc018('0x31')](function(_0x132de3){return Number(_0x132de3);});_0x390e9b[_0xc018('0x36')](function(_0xe68edd){_0x132dde['or'](_0xc018('0x6f'),'%,'+_0xe68edd+',%');});_0x4edd5f=_[_0xc018('0x70')](_0x4edd5f,_0x390e9b);break;case _0xc018('0x71'):if(_0x45aedb['operator']===_0xc018('0x72')){_0x4eefc7[_0x28532e]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x45aedb[_0xc018('0x61')]+'%',null);}else{_0x8063f5=_[_0xc018('0x60')](_0x23227c,[_0xc018('0x2f'),_0xc018('0x73')]);_0x45aedb[_0xc018('0x4a')]=_0xc018('0x73');_0x47062e=as[_0xc018('0x6a')](_0x4cc6b4,_0x8063f5[_0xc018('0x6b')],_0x45aedb);_0x4eefc7[_0x28532e](_0x47062e[_0xc018('0x6c')],_0x47062e[_0xc018('0x61')]['start'],_0x47062e['value']['end']);}break;case _0xc018('0x74'):_0x47062e=as[_0xc018('0x6a')]('me',null,_0x45aedb);_0x4eefc7[_0x28532e](_0x47062e[_0xc018('0x6c')],_0x47062e[_0xc018('0x61')][_0xc018('0x6d')],_0x47062e[_0xc018('0x61')][_0xc018('0x23')]);break;}}else{var _0x47062e=as[_0xc018('0x6a')](_0x4cc6b4,_0x8063f5[_0xc018('0x6b')],_0x45aedb);_0x4eefc7[_0x28532e](_0x47062e[_0xc018('0x6c')],_0x47062e[_0xc018('0x61')][_0xc018('0x6d')],_0x47062e[_0xc018('0x61')][_0xc018('0x23')]);}}}else{var _0x3d74bd=_(_0x2bab06['query'])[_0xc018('0x40')]()[_0xc018('0x31')](function(_0x17497a){return _[_0xc018('0x75')](_0x23227c,[_0xc018('0x2f'),_0x17497a])?_0x17497a:undefined;})[_0xc018('0x76')]()[_0xc018('0x61')]();if(!_['isEmpty'](_0x3d74bd)){_0x3d74bd[_0xc018('0x36')](function(_0x251172){if(_0x251172===_0xc018('0x77')){_0x4fa11c[_0xc018('0x48')](_0xc018('0x78'),[][_0xc018('0x79')](_0x2bab06['query'][_0x251172]));}else if(_0x251172===_0xc018('0x7a')){var _0x49f4eb=JSON[_0xc018('0x7b')](_0x2bab06['query'][_0x251172])['$gte'];var _0x410188=JSON['parse'](_0x2bab06[_0xc018('0x3f')][_0x251172])['$lte'];_0x4fa11c[_0xc018('0x48')](_0xc018('0x7c'),_0x49f4eb,_0x410188);}else{if(_0x2bab06[_0xc018('0x3f')][_0x251172]===_0xc018('0x7d')){_0x4fa11c[_0xc018('0x48')]('i.'+_0x251172+'\x20IS\x20NULL');}else{_0x4fa11c['where']('i.'+_0x251172+_0xc018('0x7e'),_0x2bab06[_0xc018('0x3f')][_0x251172]);}}});}if(_0x2bab06[_0xc018('0x3f')][_0xc018('0x7f')]){if(_0x2bab06[_0xc018('0x3f')]['read']==0x1){_0x4fa11c['having'](_0xc018('0x80'));}else{_0x4fa11c['having'](_0xc018('0x81'));}}if(_0x2bab06['query'][_0xc018('0x82')]){_0x4edd5f=_[_0xc018('0x83')](_0x2bab06[_0xc018('0x3f')][_0xc018('0x82')])?_0x2bab06[_0xc018('0x3f')]['tag']:new Array(_0x2bab06[_0xc018('0x3f')]['tag']);_0x4edd5f[_0xc018('0x36')](function(_0x12ba42){_0x132dde['or'](_0xc018('0x6f'),'%,'+_0x12ba42+',%');});}if(_0x2bab06[_0xc018('0x3f')]['filter']){var _0x5b294a=_0x2bab06[_0xc018('0x3f')]['filter'][_0xc018('0x84')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5b294a)){_0x4eefc7['or'](_0xc018('0x85'),_0x5b294a+'%');}else{_0x4eefc7['or'](_0xc018('0x86'),qs[_0xc018('0x68')](_0x5b294a))['or'](_0xc018('0x87'),_0x5b294a+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x5b294a+'%');}}}_0x4fa11c[_0xc018('0x48')](_0x4eefc7);_0x4fa11c[_0xc018('0x88')](_0xc018('0x89'));var _0x2b2706={'type':db[_0xc018('0x8a')]['QueryTypes'][_0xc018('0x8b')],'raw':!![]};var _0x17fe65=_0x4fa11c[_0xc018('0x8c')]();_0x17fe65['field'](_0xc018('0x89'));_0x17fe65[_0xc018('0x4a')](_0xc018('0x8d'),'unreadMessages');if(_0x41f3af[_0xc018('0x46')]){_0x41f3af[_0xc018('0x46')][_0xc018('0x36')](function(_0xd942b2){var _0x2507a5=_0xd942b2[0x0]===_0xc018('0x8e')?_0xd942b2[0x0]:'i.'+_0xd942b2[0x0];_0x4fa11c[_0xc018('0x46')](_0x2507a5,_0xd942b2[0x1]===_0xc018('0x8f')?![]:!![]);});}if(!_[_0xc018('0x90')](_0x4edd5f)){_0x4fa11c[_0xc018('0x62')](_0x132dde);_0x17fe65['where'](_0xc018('0x91'),_0x4edd5f);}BPromise[_0xc018('0x92')]()['then'](function(){if(!_0x3eef49){if(_0x2bab06[_0xc018('0x3f')][_0xc018('0x77')])return;_0x17fe65[_0xc018('0x48')](_0xc018('0x93'));_0x4fa11c[_0xc018('0x48')](_0xc018('0x93'));return;}if(_0x2bab06[_0xc018('0x94')][_0xc018('0x95')]!=='agent')return;return _0x2bab06[_0xc018('0x94')][_0xc018('0x96')]({'attributes':['id'],'raw':!![]})[_0xc018('0x2d')](function(_0x2db97e){if(_[_0xc018('0x90')](_0x2db97e)){_0x17fe65[_0xc018('0x48')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x4fa11c[_0xc018('0x48')](_0xc018('0x97'));}else{_0x17fe65[_0xc018('0x48')](_0xc018('0x78'),_[_0xc018('0x31')](_0x2db97e,'id'));_0x4fa11c[_0xc018('0x48')](_0xc018('0x78'),_['map'](_0x2db97e,'id'));}});})[_0xc018('0x2d')](function(){if(_0x2bab06[_0xc018('0x94')]['role']==='agent'&&!_0x3eef49&&!_0x2bab06[_0xc018('0x3f')]['OpenchannelAccountId'])return[];return db[_0xc018('0x98')][_0xc018('0x3f')](_0x17fe65[_0xc018('0x99')](),_0x2b2706);})[_0xc018('0x2d')](function(_0x51fbc5){_0x199ccc['count']=_0x51fbc5[_0xc018('0x44')];if(_0x199ccc['count']===0x0)return[];return db['sequelize'][_0xc018('0x3f')](_0x50f8c1[_0xc018('0x99')](),_0x2b2706)['then'](function(_0x198703){_0x3680e3=_[_0xc018('0x9a')](_0x198703,'id');_0x2b2706=_['merge'](_0x2b2706,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2bab06[_0xc018('0x3f')][_0xc018('0x9b')]){_0x41f3af[_0xc018('0x43')][_0xc018('0x36')](function(_0x517b6f){_0x4fa11c['field']('i.'+_0x517b6f);});}else{_0x4fa11c[_0xc018('0x4a')](_0xc018('0x8d'),'unreadMessages');_0x4fa11c['field'](_0xc018('0x9c'),'Account.key');_0x4fa11c['field'](_0xc018('0x9d'),_0xc018('0x9e'));_0x4fa11c[_0xc018('0x4a')](_0xc018('0x9f'),'contactName');_0x4fa11c['field'](_0xc018('0xa0'));_0x4fa11c['field']('c.firstName',_0xc018('0xa1'));_0x4fa11c[_0xc018('0x4a')]('c.lastName',_0xc018('0xa2'));_0x4fa11c['field'](_0xc018('0xa3'),'Contact.email');_0x4fa11c[_0xc018('0x4a')](_0xc018('0xa4'),_0xc018('0xa5'));_0x4fa11c[_0xc018('0x4a')](_0xc018('0xa6'),_0xc018('0xa7'));_0x4fa11c['field'](_0xc018('0xa8'),_0xc018('0xa9'));_0x4fa11c[_0xc018('0x4a')]('o.fullname',_0xc018('0xaa'));_0x4fa11c[_0xc018('0x4a')](_0xc018('0xab'),_0xc018('0xac'));_0x4fa11c['field'](_0xc018('0xad'),_0xc018('0x33'));}if(_0x41f3af[_0xc018('0x26')])_0x4fa11c[_0xc018('0x26')](_0x41f3af[_0xc018('0x26')]);if(_0x41f3af[_0xc018('0x25')])_0x4fa11c['offset'](_0x41f3af[_0xc018('0x25')]);return db[_0xc018('0x98')][_0xc018('0x3f')](_0x4fa11c['toString'](),_0x2b2706);})[_0xc018('0x2d')](function(_0x35f4ed){_0x111851[_0xc018('0x48')](_0xc018('0xae'),_[_0xc018('0x31')](_0x35f4ed,'id'));return db[_0xc018('0x98')][_0xc018('0x3f')](_0x111851[_0xc018('0x99')](),_0x2b2706)['then'](function(_0x180e67){var _0x146758=_[_0xc018('0xaf')](_0x180e67,'OpenchannelInteractionId');var _0x38b7dc=[];_0x35f4ed[_0xc018('0x36')](function(_0x157145){_0x38b7dc['push'](updateOpenchannelInteraction(_0x157145,_0x3680e3,_0x146758));});return BPromise[_0xc018('0xb0')](_0x38b7dc);});});})[_0xc018('0x2d')](function(_0x1b2807){_0x199ccc[_0xc018('0xb1')]=_0x1b2807;return _0x199ccc;})[_0xc018('0x2d')](respondWithFilteredResult(_0x1b47cb,_0x41f3af))['catch'](handleError(_0x1b47cb,null));};exports['show']=function(_0x2d3e2d,_0x61f989){var _0x365063={};if(_0x2d3e2d['query']['type']&&_0x2d3e2d['query'][_0xc018('0x6b')]===_0xc018('0x4c')){_0x365063[_0xc018('0x4c')]=_0x2d3e2d[_0xc018('0xb2')]['id'];}else{_0x365063['id']=_0x2d3e2d['params']['id'];}var _0x53d7d1={'raw':![],'where':_0x365063},_0x1308af={};_0x1308af[_0xc018('0x3e')]=_[_0xc018('0x40')](db['OpenchannelInteraction'][_0xc018('0x3b')]);_0x1308af['query']=_[_0xc018('0x40')](_0x2d3e2d[_0xc018('0x3f')]);_0x1308af[_0xc018('0x41')]=_[_0xc018('0x42')](_0x1308af[_0xc018('0x3e')],_0x1308af[_0xc018('0x3f')]);_0x53d7d1['attributes']=_[_0xc018('0x42')](_0x1308af[_0xc018('0x3e')],qs[_0xc018('0x9b')](_0x2d3e2d[_0xc018('0x3f')]['fields']));_0x53d7d1[_0xc018('0x43')]=_0x53d7d1['attributes'][_0xc018('0x44')]?_0x53d7d1['attributes']:_0x1308af[_0xc018('0x3e')];if(_0x2d3e2d[_0xc018('0x3f')][_0xc018('0xb3')]){_0x53d7d1[_0xc018('0xb4')]=[{'all':!![]}];}_0x53d7d1=_[_0xc018('0xb5')]({},_0x53d7d1,_0x2d3e2d[_0xc018('0xb6')]);return db[_0xc018('0x3a')][_0xc018('0x60')](_0x53d7d1)[_0xc018('0x2d')](handleEntityNotFound(_0x61f989,null))[_0xc018('0x2d')](respondWithResult(_0x61f989,null))[_0xc018('0x38')](handleError(_0x61f989,null));};exports['create']=function(_0x5b3351,_0x1ea055){return db[_0xc018('0x3a')][_0xc018('0xb7')](_0x5b3351[_0xc018('0x74')],{})[_0xc018('0x2d')](respondWithResult(_0x1ea055,0xc9))['catch'](handleError(_0x1ea055,null));};exports[_0xc018('0x2c')]=function(_0x2afcb3,_0x45bc8f){if(_0x2afcb3[_0xc018('0x74')]['id']){delete _0x2afcb3[_0xc018('0x74')]['id'];}return db[_0xc018('0x3a')][_0xc018('0x60')]({'where':{'id':_0x2afcb3[_0xc018('0xb2')]['id']}})[_0xc018('0x2d')](handleEntityNotFound(_0x45bc8f,null))['then'](saveUpdates(_0x2afcb3[_0xc018('0x74')],null))['then'](respondWithResult(_0x45bc8f,null))[_0xc018('0x38')](handleError(_0x45bc8f,null));};exports['destroy']=function(_0x187cca,_0x54f6dd){return db['OpenchannelInteraction'][_0xc018('0x60')]({'where':{'id':_0x187cca[_0xc018('0xb2')]['id']}})[_0xc018('0x2d')](handleEntityNotFound(_0x54f6dd,null))[_0xc018('0x2d')](removeEntity(_0x54f6dd,null))['catch'](handleError(_0x54f6dd,null));};exports[_0xc018('0xb8')]=function(_0x12b801,_0x3742ce){return db[_0xc018('0x3a')][_0xc018('0xb8')]()['then'](respondWithResult(_0x3742ce,null))[_0xc018('0x38')](handleError(_0x3742ce,null));};exports['addMessage']=function(_0x15babc,_0x449787,_0x5edb2a){return db[_0xc018('0xb9')][_0xc018('0x60')]({'where':{'id':_0x15babc['params']['id']}})[_0xc018('0x2d')](handleEntityNotFound(_0x449787,null))[_0xc018('0x2d')](function(_0x5db1a9){if(_0x5db1a9){return _0x5db1a9['addMessage'](_0x15babc['body'][_0xc018('0xba')],_[_0xc018('0xbb')](_0x15babc[_0xc018('0x74')],[_0xc018('0xba'),'id'])||{});}})[_0xc018('0x2d')](respondWithResult(_0x449787,null))[_0xc018('0x38')](handleError(_0x449787,null));};exports[_0xc018('0xbc')]=function(_0x559589,_0x560acc,_0x548d38){var _0x1453a9={'raw':![],'where':{}};var _0x2671ca={};var _0x492139={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xc018('0xbd')]({'where':{'id':_0x559589[_0xc018('0xb2')]['id']}})[_0xc018('0x2d')](handleEntityNotFound(_0x560acc,null))[_0xc018('0x2d')](function(_0x253754){if(_0x253754){_0x2671ca[_0xc018('0x3e')]=_[_0xc018('0x40')](db[_0xc018('0xb9')][_0xc018('0x3b')]);_0x2671ca[_0xc018('0x3f')]=_[_0xc018('0x40')](_0x559589[_0xc018('0x3f')]);_0x2671ca[_0xc018('0x41')]=_[_0xc018('0x42')](_0x2671ca[_0xc018('0x3e')],_0x2671ca['query']);_0x1453a9[_0xc018('0x43')]=_['intersection'](_0x2671ca['model'],qs[_0xc018('0x9b')](_0x559589['query'][_0xc018('0x9b')]));_0x1453a9[_0xc018('0x43')]=_0x1453a9['attributes'][_0xc018('0x44')]?_0x1453a9[_0xc018('0x43')]:_0x2671ca['model'];if(!_0x559589[_0xc018('0x3f')][_0xc018('0x45')](_0xc018('0xbe'))){_0x1453a9[_0xc018('0x26')]=qs[_0xc018('0x26')](_0x559589[_0xc018('0x3f')][_0xc018('0x26')]);_0x1453a9[_0xc018('0x25')]=qs[_0xc018('0x25')](_0x559589[_0xc018('0x3f')][_0xc018('0x25')]);}_0x1453a9[_0xc018('0x46')]=qs['sort'](_0x559589['query'][_0xc018('0x47')]);_0x1453a9[_0xc018('0x48')]=qs['filters'](_[_0xc018('0xbf')](_0x559589['query'],_0x2671ca[_0xc018('0x41')]));_0x1453a9[_0xc018('0x48')][_0xc018('0xc0')]=_0x253754['id'];if(_0x559589['query'][_0xc018('0xc1')]){_0x1453a9[_0xc018('0x48')]=_[_0xc018('0xb5')](_0x1453a9[_0xc018('0x48')],{'$or':_['map'](_0x1453a9[_0xc018('0x43')],function(_0x29d920){var _0x409a38={};_0x409a38[_0x29d920]={'$like':'%'+_0x559589[_0xc018('0x3f')]['filter']+'%'};return _0x409a38;})});}if(_0x559589[_0xc018('0x3f')][_0xc018('0xc2')]){var _0x2be0b2=_0x559589['query'][_0xc018('0xc2')][_0xc018('0x35')](',');var _0x20e240={};_0x20e240[_0x2be0b2[0x0]]={'$gte':moment(_0x2be0b2[0x1])['format'](_0xc018('0xc3'))};_0x1453a9[_0xc018('0x48')]=_['merge'](_0x1453a9[_0xc018('0x48')],_0x20e240);}_0x1453a9=_[_0xc018('0xb5')]({},_0x1453a9,_0x559589[_0xc018('0xb6')]);return db['OpenchannelMessage'][_0xc018('0xc4')]({'where':_0x1453a9[_0xc018('0x48')]})[_0xc018('0x2d')](function(_0x12a3ee){_0x492139['count']=_0x12a3ee;if(_0x559589[_0xc018('0x3f')][_0xc018('0xb3')]){_0x1453a9['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0xc018('0xc5')](_0x1453a9);})[_0xc018('0x2d')](function(_0x5f543f){_0x492139[_0xc018('0xb1')]=_0x5f543f;return _0x492139;});}})[_0xc018('0x2d')](respondWithFilteredResult(_0x560acc,_0x1453a9))[_0xc018('0x38')](handleError(_0x560acc,null));};exports[_0xc018('0xc6')]=function(_0x318667,_0x3df27f,_0x259e5b){return db['OpenchannelInteraction'][_0xc018('0x60')]({'where':{'id':_0x318667[_0xc018('0xb2')]['id']}})[_0xc018('0x2d')](handleEntityNotFound(_0x3df27f,null))[_0xc018('0x2d')](function(_0x60eca4){if(_0x60eca4){return _0x60eca4[_0xc018('0xc7')](_0x318667['body']['ids'],_['omit'](_0x318667[_0xc018('0x74')],[_0xc018('0xba'),'id'])||{})[_0xc018('0xc8')](function(){return db[_0xc018('0x6e')][_0xc018('0xc5')]({'attributes':['id',_0xc018('0x2f'),_0xc018('0x4b')],'where':{'id':_0x318667['body'][_0xc018('0xba')]}});})[_0xc018('0x2d')](function(_0x26eb87){socket[_0xc018('0xc9')](_0xc018('0xca'),{'id':Number(_0x318667[_0xc018('0xb2')]['id']),'tags':_0x26eb87||[]});return{'id':Number(_0x318667[_0xc018('0xb2')]['id']),'tags':_0x26eb87||[]};});}})[_0xc018('0x2d')](respondWithResult(_0x3df27f,null))[_0xc018('0x38')](handleError(_0x3df27f,null));};exports['removeTags']=function(_0x599c66,_0x3d30ba,_0x426b09){return db[_0xc018('0x3a')][_0xc018('0x60')]({'where':{'id':_0x599c66[_0xc018('0xb2')]['id']}})[_0xc018('0x2d')](handleEntityNotFound(_0x3d30ba,null))[_0xc018('0x2d')](function(_0x32b162){if(_0x32b162){return _0x32b162[_0xc018('0xcb')](_0x599c66[_0xc018('0x3f')][_0xc018('0xba')]);}})[_0xc018('0x2d')](respondWithStatusCode(_0x3d30ba,null))[_0xc018('0x38')](handleError(_0x3d30ba,null));};exports[_0xc018('0xcc')]=function(_0x4123c5,_0x345ca5){var _0x2d2748=moment()['unix']()['toString']();var _0x2e1567=path['join'](config[_0xc018('0xcd')],'server',_0xc018('0xce'),'tmp');var _0x357091=path[_0xc018('0xcf')](config['root'],'server',_0xc018('0xce'),'attachments');var _0x26a7af=path[_0xc018('0xcf')](_0x2e1567,_0x2d2748);var _0x19e76d=util[_0xc018('0xd0')]('transcript-%d-%s.zip',_0x4123c5[_0xc018('0xb2')]['id'],_0x2d2748);var _0xc2412d=path[_0xc018('0xcf')](_0x2e1567,_0x19e76d);var _0x194bc5=[];_0x194bc5['push']({'model':db[_0xc018('0x71')],'as':'User','attributes':['id',_0xc018('0x32')],'raw':!![]});_0x194bc5[_0xc018('0x37')]({'model':db[_0xc018('0xd1')],'as':_0xc018('0x65'),'attributes':['id',_0xc018('0xd2'),'lastName'],'raw':!![]});if(_0x4123c5['query'][_0xc018('0xd3')]){_0x194bc5[_0xc018('0x37')]({'model':db['Attachment'],'as':_0xc018('0xd4'),'raw':!![]});}var _0x6b1c2c=[{'model':db[_0xc018('0xb9')],'as':'Messages','attributes':['id',_0xc018('0x74'),_0xc018('0x7a'),'direction','secret',_0xc018('0x7f')],'include':_0x194bc5}];_0x6b1c2c['push']({'model':db[_0xc018('0xd5')],'as':_0xc018('0xd6'),'attributes':['id',_0xc018('0x2f')]});_0x6b1c2c[_0xc018('0x37')]({'model':db[_0xc018('0x71')],'as':_0xc018('0xd7'),'attributes':['id',_0xc018('0x32')]});return db[_0xc018('0x3a')][_0xc018('0x60')]({'where':{'id':_0x4123c5[_0xc018('0xb2')]['id']},'include':_0x6b1c2c})[_0xc018('0x2d')](handleEntityNotFound(_0x345ca5,null))[_0xc018('0x2d')](function(_0x32c041){if(_0x32c041){var _0x2ddeaa=_0x32c041[_0xc018('0xd8')]({'plain':!![]});fs['mkdirSync'](_0x26a7af);var _0x1e82e9={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':_0xc018('0xd9')}},'footer':{'height':_0xc018('0xda'),'contents':{'default':util[_0xc018('0xd0')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xc018('0xd0')](_0xc018('0xdb'),_0xc018('0xdc'),_0x2ddeaa['id']),moment()[_0xc018('0xd0')](_0xc018('0xdd'))[_0xc018('0x99')]())}}};var _0x1066d0={'channel':_0xc018('0xdc'),'account':_0x2ddeaa[_0xc018('0xd6')]['name'],'agent':_0x2ddeaa['Owner']?_0x2ddeaa[_0xc018('0xd7')][_0xc018('0x32')]:_0xc018('0xde'),'createdAt':moment(_0x2ddeaa[_0xc018('0x7a')])[_0xc018('0xd0')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc018('0x99')](),'closedAt':_0x2ddeaa[_0xc018('0xdf')]?moment(_0x2ddeaa[_0xc018('0xe0')])['format'](_0xc018('0xc3'))[_0xc018('0x99')]():'','disposition':_0x2ddeaa['disposition'],'visibility':_0x2ddeaa[_0xc018('0xe1')]?_0xc018('0xe2'):_0xc018('0xe3'),'messages':_(_0x2ddeaa[_0xc018('0xe4')])[_0xc018('0xc1')]({'secret':![]})[_0xc018('0x31')](function(_0x4024de){if(_0x4024de[_0xc018('0xd4')]){var _0x2c7560=path[_0xc018('0xcf')](_0x357091,_0x4024de[_0xc018('0xd4')][_0xc018('0xe5')]);if(fs[_0xc018('0xe6')](_0x2c7560)){fs['createReadStream'](_0x2c7560)['pipe'](fs[_0xc018('0xe7')](path[_0xc018('0xcf')](_0x26a7af,_0x4024de['Attachment'][_0xc018('0xe5')])));}}return{'date':moment(_0x4024de['createdAt'])[_0xc018('0xd0')](_0xc018('0xc3'))[_0xc018('0x99')](),'sender':_0x4024de[_0xc018('0xe8')]===_0xc018('0xe9')?_0x4024de[_0xc018('0x71')]?_0x4024de[_0xc018('0x71')][_0xc018('0x32')]:'System':_0x4024de[_0xc018('0x65')][_0xc018('0xd2')]+(_0x4024de[_0xc018('0x65')]['lastName']?'\x20'+_0x4024de[_0xc018('0x65')][_0xc018('0xea')]:''),'body':_0x4024de[_0xc018('0xd4')]?_0x4024de[_0xc018('0xd4')][_0xc018('0xe5')]:_0x4024de['body'],'direction':_0x4024de[_0xc018('0xe8')]==='out'?'A':'C','secret':_0x4024de[_0xc018('0xeb')],'read':_0x4024de['read'],'attachment':_0x4024de[_0xc018('0xd4')]};})[_0xc018('0x61')]()};return ejs[_0xc018('0xec')](path[_0xc018('0xcf')](config[_0xc018('0xcd')],_0xc018('0xed'),_0xc018('0xee'),_0xc018('0xef')),{'interaction':_0x1066d0})['then'](function(_0x5043bd){return new BPromise(function(_0x230738,_0x3d3249){pdf[_0xc018('0xb7')](_0x5043bd,_0x1e82e9)[_0xc018('0xf0')](path[_0xc018('0xcf')](_0x26a7af,_0xc018('0xf1')+_0x2ddeaa['id']+'-'+_0x2d2748+_0xc018('0xf2')),function(_0x26cb22,_0x3682a5){if(_0x26cb22)return _0x3d3249(_0x26cb22);_0x230738(_0x3682a5);});});})['then'](function(){return new BPromise(function(_0x1b3c4f,_0x7dff31){zipdir(_0x26a7af,{'saveTo':_0xc2412d},function(_0x4b2fd0,_0x3d1deb){if(_0x4b2fd0)return _0x7dff31(_0x4b2fd0);return _0x1b3c4f(_0x3d1deb);});})[_0xc018('0x2d')](function(){return new BPromise(function(_0x68bee9,_0x5466ae){rimraf(_0x26a7af,function(_0xd286a6){if(_0xd286a6)_0x5466ae(_0xd286a6);return _0x68bee9();});});})[_0xc018('0x2d')](function(){return _0x345ca5[_0xc018('0xcc')](_0xc2412d,_0x19e76d,function(_0x380ad7){if(_0x380ad7){console[_0xc018('0xf3')]('err',_0x380ad7);}else{fs[_0xc018('0xf4')](_0xc2412d);}});});});}else{return _0x345ca5[_0xc018('0x21')](0xc8);}})[_0xc018('0x38')](handleError(_0x345ca5,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index f294332..acb65a4 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 _0x21ff=['getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','save'];(function(_0xf25023,_0x1c99f7){var _0x362291=function(_0x1668f7){while(--_0x1668f7){_0xf25023['push'](_0xf25023['shift']());}};_0x362291(++_0x1c99f7);}(_0x21ff,0x159));var _0xf21f=function(_0x4aa838,_0x4aa14f){_0x4aa838=_0x4aa838-0x0;var _0x3abff0=_0x21ff[_0x4aa838];return _0x3abff0;};'use strict';var EventEmitter=require(_0xf21f('0x0'));var OpenchannelInteraction=require(_0xf21f('0x1'))['db'][_0xf21f('0x2')];var OpenchannelMessage=require(_0xf21f('0x1'))['db'][_0xf21f('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf21f('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5a64a3){return function(_0x391d87,_0x402542,_0x59ac33){_0x391d87[_0xf21f('0x5')]({'attributes':['id'],'raw':!![]})[_0xf21f('0x6')](function(_0x50b70a){_0x391d87[_0xf21f('0x7')]('Users',_0x50b70a[_0xf21f('0x8')](function(_0x4c13d3){return{'id':_0x4c13d3['id']};}));return OpenchannelMessage[_0xf21f('0x9')]({'where':{'OpenchannelInteractionId':_0x391d87['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf21f('0x6')](function(_0x567799){_0x391d87['setDataValue'](_0xf21f('0xa'),_0x567799[_0xf21f('0xb')]);OpenchannelInteractionEvents[_0xf21f('0xc')](_0x5a64a3+':'+_0x391d87['id'],_0x391d87);OpenchannelInteractionEvents['emit'](_0x5a64a3,_0x391d87);_0x59ac33(null);})['catch'](_0x59ac33(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0xf21f('0xd')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xfea8=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','catch'];(function(_0xdbb6cb,_0x3b8fda){var _0x476b50=function(_0x470ebb){while(--_0x470ebb){_0xdbb6cb['push'](_0xdbb6cb['shift']());}};_0x476b50(++_0x3b8fda);}(_0xfea8,0x1e9));var _0x8fea=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xfea8[_0x35885a];return _0xe86249;};'use strict';var EventEmitter=require(_0x8fea('0x0'));var OpenchannelInteraction=require(_0x8fea('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x8fea('0x1'))['db'][_0x8fea('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x8fea('0x3')](0x0);var events={'afterCreate':_0x8fea('0x4'),'afterUpdate':_0x8fea('0x5'),'afterDestroy':'remove'};function emitEvent(_0x512920){return function(_0x37bc11,_0x193ca9,_0x4a5f2b){_0x37bc11[_0x8fea('0x6')]({'attributes':['id'],'raw':!![]})[_0x8fea('0x7')](function(_0x27f946){_0x37bc11[_0x8fea('0x8')](_0x8fea('0x9'),_0x27f946[_0x8fea('0xa')](function(_0x19f615){return{'id':_0x19f615['id']};}));return OpenchannelMessage[_0x8fea('0xb')]({'where':{'OpenchannelInteractionId':_0x37bc11['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8fea('0x7')](function(_0x52a767){_0x37bc11[_0x8fea('0x8')](_0x8fea('0xc'),_0x52a767[_0x8fea('0xd')]);OpenchannelInteractionEvents['emit'](_0x512920+':'+_0x37bc11['id'],_0x37bc11);OpenchannelInteractionEvents['emit'](_0x512920,_0x37bc11);_0x4a5f2b(null);})[_0x8fea('0xe')](_0x4a5f2b(null));};}for(var e in events){if(events[_0x8fea('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x8fea('0x10')](e,emitEvent(event));}}module[_0x8fea('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 3d53652..6270517 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 _0xdc97=['./openchannelInteraction.attributes','exports','define','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x4b4e6f,_0x53271f){var _0x23c2e2=function(_0x3521fd){while(--_0x3521fd){_0x4b4e6f['push'](_0x4b4e6f['shift']());}};_0x23c2e2(++_0x53271f);}(_0xdc97,0x13b));var _0x7dc9=function(_0x468572,_0x17e659){_0x468572=_0x468572-0x0;var _0x63cb0c=_0xdc97[_0x468572];return _0x63cb0c;};'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'));module[_0x7dc9('0x8')]=function(_0x3ba3ca,_0x589f02){return _0x3ba3ca[_0x7dc9('0x9')]('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2ff923,_0x23737d,_0x3318ea){if(_0x2ff923[_0x7dc9('0xa')](_0x7dc9('0xb'))){_0x2ff923['closedAt']=moment()[_0x7dc9('0xc')](_0x7dc9('0xd'));}_0x3318ea(null,_0x2ff923);}}});}; \ No newline at end of file +var _0x71ab=['changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions'];(function(_0x588649,_0x99f19d){var _0x370ba1=function(_0x5f224f){while(--_0x5f224f){_0x588649['push'](_0x588649['shift']());}};_0x370ba1(++_0x99f19d);}(_0x71ab,0x64));var _0xb71a=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x71ab[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));module[_0xb71a('0x8')]=function(_0x38d931,_0x22c072){return _0x38d931[_0xb71a('0x9')](_0xb71a('0xa'),attributes,{'tableName':_0xb71a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x43ca14,_0x471ab6,_0x18c7a6){if(_0x43ca14[_0xb71a('0xc')](_0xb71a('0xd'))){_0x43ca14[_0xb71a('0xe')]=moment()['format'](_0xb71a('0xf'));}_0x18c7a6(null,_0x43ca14);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index a0a72e5..cc8f7de 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 _0x5fbb=['jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','attributes','limit','debug','catch','AddTagsToOpenchannelInteraction','find','where','then','addTags','ids','AddTags','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x201dab,_0x513ba0){var _0xff8f07=function(_0x4f2eb9){while(--_0x4f2eb9){_0x201dab['push'](_0x201dab['shift']());}};_0xff8f07(++_0x513ba0);}(_0x5fbb,0xbd));var _0xb5fb=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x5fbb[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb5fb('0x0'));var rs=require(_0xb5fb('0x1'));var fs=require('fs');var Redis=require(_0xb5fb('0x2'));var db=require(_0xb5fb('0x3'))['db'];var utils=require(_0xb5fb('0x4'));var logger=require('../../config/logger')(_0xb5fb('0x5'));var config=require('../../config/environment');var jayson=require(_0xb5fb('0x6'));var client=jayson[_0xb5fb('0x7')][_0xb5fb('0x8')]({'port':0x232a});config[_0xb5fb('0x9')]=_['defaults'](config[_0xb5fb('0x9')],{'host':_0xb5fb('0xa'),'port':0x18eb});var socket=require(_0xb5fb('0xb'))(new Redis(config[_0xb5fb('0x9')]));require('./openchannelInteraction.socket')[_0xb5fb('0xc')](socket);function respondWithRpcPromise(_0x4c499b,_0x283dfb,_0x57a7fe){return new BPromise(function(_0x3b6020,_0x42152e){return client[_0xb5fb('0xd')](_0x4c499b,_0x57a7fe)['then'](function(_0x1c1223){logger[_0xb5fb('0xe')](_0xb5fb('0xf'),_0x283dfb,_0xb5fb('0x10'));logger['debug']('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x283dfb,_0xb5fb('0x10'),JSON[_0xb5fb('0x11')](_0x1c1223));if(_0x1c1223[_0xb5fb('0x12')]){if(_0x1c1223[_0xb5fb('0x12')][_0xb5fb('0x13')]===0x1f4){logger[_0xb5fb('0x12')](_0xb5fb('0xf'),_0x283dfb,_0x1c1223[_0xb5fb('0x12')][_0xb5fb('0x14')]);return _0x42152e(_0x1c1223[_0xb5fb('0x12')][_0xb5fb('0x14')]);}logger['error'](_0xb5fb('0xf'),_0x283dfb,_0x1c1223[_0xb5fb('0x12')][_0xb5fb('0x14')]);return _0x3b6020(_0x1c1223[_0xb5fb('0x12')][_0xb5fb('0x14')]);}else{logger[_0xb5fb('0xe')](_0xb5fb('0xf'),_0x283dfb,_0xb5fb('0x10'));_0x3b6020(_0x1c1223[_0xb5fb('0x15')][_0xb5fb('0x14')]);}})['catch'](function(_0x65695b){logger[_0xb5fb('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x283dfb,_0x65695b);_0x42152e(_0x65695b);});});}exports[_0xb5fb('0x16')]=function(_0xc5af29){var _0x12d098=this;return new Promise(function(_0x910632,_0xa31d0c){return db[_0xb5fb('0x17')][_0xb5fb('0x18')](_0xc5af29[_0xb5fb('0x19')],{'raw':_0xc5af29[_0xb5fb('0x1a')]?_0xc5af29[_0xb5fb('0x1a')][_0xb5fb('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc5af29[_0xb5fb('0x1a')]?_0xc5af29[_0xb5fb('0x1a')]['where']||null:null,'attributes':_0xc5af29['options']?_0xc5af29[_0xb5fb('0x1a')][_0xb5fb('0x1c')]||null:null,'limit':_0xc5af29[_0xb5fb('0x1a')]?_0xc5af29[_0xb5fb('0x1a')][_0xb5fb('0x1d')]||null:null})['then'](function(_0x5df0f3){logger[_0xb5fb('0xe')](_0xb5fb('0x16'),_0xc5af29);logger[_0xb5fb('0x1e')]('UpdateOpenchannelInteraction',_0xc5af29,JSON[_0xb5fb('0x11')](_0x5df0f3));_0x910632(_0x5df0f3);})[_0xb5fb('0x1f')](function(_0x3e2725){logger[_0xb5fb('0x12')](_0xb5fb('0x16'),_0x3e2725['message'],_0xc5af29);_0xa31d0c(_0x12d098[_0xb5fb('0x12')](0x1f4,_0x3e2725[_0xb5fb('0x14')]));});});};exports[_0xb5fb('0x20')]=function(_0x53efe7){return new Promise(function(_0x4daaec,_0x33ee63){return db[_0xb5fb('0x17')][_0xb5fb('0x21')]({'where':_0x53efe7[_0xb5fb('0x1a')]?_0x53efe7['options'][_0xb5fb('0x22')]||null:null})[_0xb5fb('0x23')](function(_0x483f34){if(_0x483f34){return _0x483f34[_0xb5fb('0x24')](_0x53efe7[_0xb5fb('0x19')]['ids'],_['omit'](_0x53efe7['body'],[_0xb5fb('0x25'),'id'])||{});}})['spread'](function(_0x5206d3){logger[_0xb5fb('0xe')](_0xb5fb('0x26'),_0x53efe7);logger[_0xb5fb('0x1e')](_0xb5fb('0x26'),_0x53efe7,JSON[_0xb5fb('0x11')](_0x5206d3));_0x4daaec(_0x5206d3);})[_0xb5fb('0x1f')](function(_0x109a02){logger['error'](_0xb5fb('0x26'),_0x109a02[_0xb5fb('0x14')],_0x53efe7);_0x33ee63(_this[_0xb5fb('0x12')](0x1f4,_0x109a02[_0xb5fb('0x14')]));});});}; \ No newline at end of file +var _0xf105=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelInteraction.socket','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','UpdateOpenchannelInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','ids','omit','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf105,0x134));var _0x5f10=function(_0x328ae0,_0x46907c){_0x328ae0=_0x328ae0-0x0;var _0x1bdf8f=_0xf105[_0x328ae0];return _0x1bdf8f;};'use strict';var _=require(_0x5f10('0x0'));var util=require('util');var moment=require(_0x5f10('0x1'));var BPromise=require(_0x5f10('0x2'));var rs=require(_0x5f10('0x3'));var fs=require('fs');var Redis=require(_0x5f10('0x4'));var db=require(_0x5f10('0x5'))['db'];var utils=require(_0x5f10('0x6'));var logger=require(_0x5f10('0x7'))('rpc');var config=require(_0x5f10('0x8'));var jayson=require(_0x5f10('0x9'));var client=jayson[_0x5f10('0xa')][_0x5f10('0xb')]({'port':0x232a});config[_0x5f10('0xc')]=_[_0x5f10('0xd')](config[_0x5f10('0xc')],{'host':_0x5f10('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5f10('0xc')]));require(_0x5f10('0xf'))[_0x5f10('0x10')](socket);function respondWithRpcPromise(_0x1d3d9d,_0x4fce36,_0xe9a9fb){return new BPromise(function(_0x3ff7b3,_0x384666){return client[_0x5f10('0x11')](_0x1d3d9d,_0xe9a9fb)[_0x5f10('0x12')](function(_0x541e5d){logger['info'](_0x5f10('0x13'),_0x4fce36,'request\x20sent');logger[_0x5f10('0x14')](_0x5f10('0x15'),_0x4fce36,_0x5f10('0x16'),JSON['stringify'](_0x541e5d));if(_0x541e5d[_0x5f10('0x17')]){if(_0x541e5d[_0x5f10('0x17')][_0x5f10('0x18')]===0x1f4){logger[_0x5f10('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4fce36,_0x541e5d[_0x5f10('0x17')][_0x5f10('0x19')]);return _0x384666(_0x541e5d[_0x5f10('0x17')][_0x5f10('0x19')]);}logger['error'](_0x5f10('0x13'),_0x4fce36,_0x541e5d[_0x5f10('0x17')][_0x5f10('0x19')]);return _0x3ff7b3(_0x541e5d[_0x5f10('0x17')][_0x5f10('0x19')]);}else{logger[_0x5f10('0x1a')](_0x5f10('0x13'),_0x4fce36,_0x5f10('0x16'));_0x3ff7b3(_0x541e5d[_0x5f10('0x1b')][_0x5f10('0x19')]);}})[_0x5f10('0x1c')](function(_0x41af5c){logger[_0x5f10('0x17')](_0x5f10('0x13'),_0x4fce36,_0x41af5c);_0x384666(_0x41af5c);});});}exports[_0x5f10('0x1d')]=function(_0x3fc0c1){var _0x17f839=this;return new Promise(function(_0x229ed8,_0x45ffe7){return db['OpenchannelInteraction'][_0x5f10('0x1e')](_0x3fc0c1[_0x5f10('0x1f')],{'raw':_0x3fc0c1[_0x5f10('0x20')]?_0x3fc0c1[_0x5f10('0x20')][_0x5f10('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fc0c1[_0x5f10('0x20')]?_0x3fc0c1[_0x5f10('0x20')][_0x5f10('0x22')]||null:null,'attributes':_0x3fc0c1[_0x5f10('0x20')]?_0x3fc0c1[_0x5f10('0x20')][_0x5f10('0x23')]||null:null,'limit':_0x3fc0c1[_0x5f10('0x20')]?_0x3fc0c1['options'][_0x5f10('0x24')]||null:null})[_0x5f10('0x12')](function(_0x474796){logger[_0x5f10('0x1a')](_0x5f10('0x1d'),_0x3fc0c1);logger['debug']('UpdateOpenchannelInteraction',_0x3fc0c1,JSON[_0x5f10('0x25')](_0x474796));_0x229ed8(_0x474796);})[_0x5f10('0x1c')](function(_0x10ff4a){logger[_0x5f10('0x17')](_0x5f10('0x1d'),_0x10ff4a['message'],_0x3fc0c1);_0x45ffe7(_0x17f839[_0x5f10('0x17')](0x1f4,_0x10ff4a[_0x5f10('0x19')]));});});};exports[_0x5f10('0x26')]=function(_0xc97937){return new Promise(function(_0x36e8c2,_0x1a87da){return db[_0x5f10('0x27')][_0x5f10('0x28')]({'where':_0xc97937[_0x5f10('0x20')]?_0xc97937[_0x5f10('0x20')][_0x5f10('0x22')]||null:null})[_0x5f10('0x12')](function(_0x4f022f){if(_0x4f022f){return _0x4f022f[_0x5f10('0x29')](_0xc97937['body'][_0x5f10('0x2a')],_[_0x5f10('0x2b')](_0xc97937[_0x5f10('0x1f')],[_0x5f10('0x2a'),'id'])||{});}})['spread'](function(_0x39fa24){logger[_0x5f10('0x1a')](_0x5f10('0x2c'),_0xc97937);logger[_0x5f10('0x14')](_0x5f10('0x2c'),_0xc97937,JSON[_0x5f10('0x25')](_0x39fa24));_0x36e8c2(_0x39fa24);})[_0x5f10('0x1c')](function(_0x5e2641){logger[_0x5f10('0x17')](_0x5f10('0x2c'),_0x5e2641['message'],_0xc97937);_0x1a87da(_this[_0x5f10('0x17')](0x1f4,_0x5e2641['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 71aa824..421c6a9 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 _0x18ac=['emit','removeListener','openchannelInteraction:','./openchannelInteraction.events','save','remove','update'];(function(_0xdbaf37,_0x5b74bb){var _0x546929=function(_0x41acc7){while(--_0x41acc7){_0xdbaf37['push'](_0xdbaf37['shift']());}};_0x546929(++_0x5b74bb);}(_0x18ac,0x161));var _0xc18a=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x18ac[_0x3bf83f];return _0x22c4a9;};'use strict';var OpenchannelInteractionEvents=require(_0xc18a('0x0'));var events=[_0xc18a('0x1'),_0xc18a('0x2'),_0xc18a('0x3')];function createListener(_0x53eff1,_0x3149af){return function(_0x4c4260){_0x3149af[_0xc18a('0x4')](_0x53eff1,_0x4c4260);};}function removeListener(_0x4d8f64,_0x5d31d7){return function(){OpenchannelInteractionEvents[_0xc18a('0x5')](_0x4d8f64,_0x5d31d7);};}exports['register']=function(_0x1a2d3d){for(var _0x48bf4e=0x0,_0x50c23d=events['length'];_0x48bf4e<_0x50c23d;_0x48bf4e++){var _0x30ea31=events[_0x48bf4e];var _0x11d269=createListener(_0xc18a('0x6')+_0x30ea31,_0x1a2d3d);OpenchannelInteractionEvents['on'](_0x30ea31,_0x11d269);}}; \ No newline at end of file +var _0x37db=['openchannelInteraction:','save','remove','emit','removeListener','register','length'];(function(_0x205b92,_0x23c973){var _0x331224=function(_0xe7891){while(--_0xe7891){_0x205b92['push'](_0x205b92['shift']());}};_0x331224(++_0x23c973);}(_0x37db,0x1eb));var _0xb37d=function(_0x39b0dc,_0x266b56){_0x39b0dc=_0x39b0dc-0x0;var _0x5681fb=_0x37db[_0x39b0dc];return _0x5681fb;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xb37d('0x0'),_0xb37d('0x1'),'update'];function createListener(_0x37958d,_0x2b5d5d){return function(_0x594b1e){_0x2b5d5d[_0xb37d('0x2')](_0x37958d,_0x594b1e);};}function removeListener(_0x5d978e,_0xda79bf){return function(){OpenchannelInteractionEvents[_0xb37d('0x3')](_0x5d978e,_0xda79bf);};}exports[_0xb37d('0x4')]=function(_0x5b6034){for(var _0x30c8ce=0x0,_0xe6c13b=events[_0xb37d('0x5')];_0x30c8ce<_0xe6c13b;_0x30c8ce++){var _0x11506c=events[_0x30c8ce];var _0x532292=createListener(_0xb37d('0x6')+_0x11506c,_0x5b6034);OpenchannelInteractionEvents['on'](_0x11506c,_0x532292);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 324c87f..0b94ac9 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 _0x75d4=['/describe','describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','create','put','/:id','update','/:id/accept','accept','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get'];(function(_0x2f74c6,_0x3ddb9f){var _0xe5b1ed=function(_0x4a12f4){while(--_0x4a12f4){_0x2f74c6['push'](_0x2f74c6['shift']());}};_0xe5b1ed(++_0x3ddb9f);}(_0x75d4,0x16e));var _0x475d=function(_0x29b1cf,_0x461902){_0x29b1cf=_0x29b1cf-0x0;var _0x372718=_0x75d4[_0x29b1cf];return _0x372718;};'use strict';var multer=require(_0x475d('0x0'));var util=require(_0x475d('0x1'));var path=require(_0x475d('0x2'));var timeout=require(_0x475d('0x3'));var express=require(_0x475d('0x4'));var router=express[_0x475d('0x5')]();var fs_extra=require(_0x475d('0x6'));var auth=require(_0x475d('0x7'));var interaction=require(_0x475d('0x8'));var config=require(_0x475d('0x9'));var controller=require('./openchannelMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x475d('0xa')]);router[_0x475d('0xb')](_0x475d('0xc'),auth['isAuthenticated'](),controller[_0x475d('0xd')]);router[_0x475d('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x475d('0xe')]);router[_0x475d('0xf')]('/',auth[_0x475d('0x10')](),interaction[_0x475d('0x11')](_0x475d('0x12'),_0x475d('0x13')),controller[_0x475d('0x14')]);router[_0x475d('0x15')](_0x475d('0x16'),auth['isAuthenticated'](),controller[_0x475d('0x17')]);router[_0x475d('0x15')](_0x475d('0x18'),auth[_0x475d('0x10')](),controller[_0x475d('0x19')]);router[_0x475d('0x15')]('/:id/reject',auth['isAuthenticated'](),controller['reject']);router['delete'](_0x475d('0x16'),auth['isAuthenticated'](),controller['destroy']);module[_0x475d('0x1a')]=router; \ No newline at end of file +var _0x2f3e=['create','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','openchannel'];(function(_0x5280da,_0x5a0554){var _0x23ab06=function(_0x5c40d7){while(--_0x5c40d7){_0x5280da['push'](_0x5280da['shift']());}};_0x23ab06(++_0x5a0554);}(_0x2f3e,0xfd));var _0xe2f3=function(_0x388b47,_0x5cdac5){_0x388b47=_0x388b47-0x0;var _0x4859df=_0x2f3e[_0x388b47];return _0x4859df;};'use strict';var multer=require('multer');var util=require(_0xe2f3('0x0'));var path=require('path');var timeout=require(_0xe2f3('0x1'));var express=require(_0xe2f3('0x2'));var router=express[_0xe2f3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe2f3('0x4'));var interaction=require(_0xe2f3('0x5'));var config=require(_0xe2f3('0x6'));var controller=require(_0xe2f3('0x7'));router[_0xe2f3('0x8')]('/',auth[_0xe2f3('0x9')](),controller[_0xe2f3('0xa')]);router[_0xe2f3('0x8')](_0xe2f3('0xb'),auth[_0xe2f3('0x9')](),controller[_0xe2f3('0xc')]);router[_0xe2f3('0x8')](_0xe2f3('0xd'),auth['isAuthenticated'](),controller[_0xe2f3('0xe')]);router[_0xe2f3('0xf')]('/',auth[_0xe2f3('0x9')](),interaction['tracked'](_0xe2f3('0x10'),'openchannelmessage:create'),controller[_0xe2f3('0x11')]);router['put'](_0xe2f3('0xd'),auth[_0xe2f3('0x9')](),controller[_0xe2f3('0x12')]);router[_0xe2f3('0x13')](_0xe2f3('0x14'),auth[_0xe2f3('0x9')](),controller[_0xe2f3('0x15')]);router['put'](_0xe2f3('0x16'),auth[_0xe2f3('0x9')](),controller[_0xe2f3('0x17')]);router[_0xe2f3('0x18')]('/:id',auth[_0xe2f3('0x9')](),controller[_0xe2f3('0x19')]);module[_0xe2f3('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 50de15d..c7ecddb 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 _0x6be1=['DATE','sequelize','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0xaaf2e2,_0x19d28a){var _0x28bc36=function(_0x53bdb5){while(--_0x53bdb5){_0xaaf2e2['push'](_0xaaf2e2['shift']());}};_0x28bc36(++_0x19d28a);}(_0x6be1,0x119));var _0x16be=function(_0x1fdd79,_0x2354b1){_0x1fdd79=_0x1fdd79-0x0;var _0x53addd=_0x6be1[_0x1fdd79];return _0x53addd;};'use strict';var Sequelize=require(_0x16be('0x0'));module['exports']={'body':{'type':Sequelize[_0x16be('0x1')](_0x16be('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x16be('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x16be('0x4')]('in',_0x16be('0x5')),'defaultValue':_0x16be('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x16be('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x16be('0x1')]}}; \ No newline at end of file +var _0xdb3f=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x1f1162,_0x34a370){var _0x19572a=function(_0x271ee7){while(--_0x271ee7){_0x1f1162['push'](_0x1f1162['shift']());}};_0x19572a(++_0x34a370);}(_0xdb3f,0x88));var _0xfdb3=function(_0x520a3f,_0x57eba7){_0x520a3f=_0x520a3f-0x0;var _0x189b9e=_0xdb3f[_0x520a3f];return _0x189b9e;};'use strict';var Sequelize=require(_0xfdb3('0x0'));module[_0xfdb3('0x1')]={'body':{'type':Sequelize[_0xfdb3('0x2')](_0xfdb3('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xfdb3('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xfdb3('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xfdb3('0x5')]('in',_0xfdb3('0x6')),'defaultValue':_0xfdb3('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xfdb3('0x7')]},'providerName':{'type':Sequelize[_0xfdb3('0x8')]},'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 54bdd66..1eb713e 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 _0xe310=['UserId','CmContact','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','accept','EventManager','acceptmessage','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelMessage.socket','jayson/promise','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','OpenchannelMessage','findAll','rows','params','rawAttributes','find','create','body','describe','openchannel-interactions','openchannel','read','readAt','format'];(function(_0x494911,_0x37a014){var _0x126ce2=function(_0x9cd7ae){while(--_0x9cd7ae){_0x494911['push'](_0x494911['shift']());}};_0x126ce2(++_0x37a014);}(_0xe310,0x111));var _0x0e31=function(_0xa88afb,_0x50a358){_0xa88afb=_0xa88afb-0x0;var _0x47f746=_0xe310[_0xa88afb];return _0x47f746;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0e31('0x0'));var rimraf=require(_0x0e31('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e31('0x2'));var rp=require(_0x0e31('0x3'));var moment=require('moment');var BPromise=require(_0x0e31('0x4'));var Mustache=require(_0x0e31('0x5'));var util=require(_0x0e31('0x6'));var path=require('path');var sox=require(_0x0e31('0x7'));var csv=require(_0x0e31('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e31('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0e31('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x0e31('0x8'));var querystring=require(_0x0e31('0xb'));var Papa=require('papaparse');var Redis=require(_0x0e31('0xc'));var authService=require(_0x0e31('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x0e31('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e31('0xf'))(_0x0e31('0x10'));var utils=require(_0x0e31('0x11'));var config=require(_0x0e31('0x12'));var licenseUtil=require(_0x0e31('0x13'));var db=require(_0x0e31('0x14'))['db'];config['redis']=_[_0x0e31('0x15')](config['redis'],{'host':_0x0e31('0x16'),'port':0x18eb});var socket=require(_0x0e31('0x17'))(new Redis(config[_0x0e31('0x18')]));require(_0x0e31('0x19'))['register'](socket);var jayson=require(_0x0e31('0x1a'));var client=jayson[_0x0e31('0x1b')][_0x0e31('0x1c')]({'port':0x232c});var client9002=jayson[_0x0e31('0x1b')][_0x0e31('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x6198ce,_0xebe6ee,_0x3e9989,_0x3a6600){return new BPromise(function(_0x3e05dc,_0x1da3fa){var _0x25054f=_0x3a6600||client;return _0x25054f[_0x0e31('0x1d')](_0x6198ce,_0x3e9989)['then'](function(_0x179365){logger[_0x0e31('0x1e')](_0x0e31('0x1f'),_0xebe6ee,_0x0e31('0x20'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0xebe6ee,'request\x20sent',JSON[_0x0e31('0x21')](_0x179365));if(_0x179365['error']){if(_0x179365[_0x0e31('0x22')][_0x0e31('0x23')]===0x1f4){logger['error'](_0x0e31('0x1f'),_0xebe6ee,_0x179365[_0x0e31('0x22')][_0x0e31('0x24')]);return _0x1da3fa(_0x179365[_0x0e31('0x22')][_0x0e31('0x24')]);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0xebe6ee,_0x179365[_0x0e31('0x22')][_0x0e31('0x24')]);return _0x3e05dc(_0x179365[_0x0e31('0x22')][_0x0e31('0x24')]);}else{logger[_0x0e31('0x1e')](_0x0e31('0x1f'),_0xebe6ee,_0x0e31('0x20'));_0x3e05dc(_0x179365[_0x0e31('0x25')][_0x0e31('0x24')]);}})[_0x0e31('0x26')](function(_0x4f6dcf){logger[_0x0e31('0x22')](_0x0e31('0x1f'),_0xebe6ee,_0x4f6dcf);_0x1da3fa(_0x4f6dcf);});});}function respondWithStatusCode(_0x10e274,_0x5a56c4){_0x5a56c4=_0x5a56c4||0xcc;return function(_0x530925){if(_0x530925){return _0x10e274[_0x0e31('0x27')](_0x5a56c4);}return _0x10e274[_0x0e31('0x28')](_0x5a56c4)['end']();};}function respondWithResult(_0x3c9f12,_0x2d9d4f){_0x2d9d4f=_0x2d9d4f||0xc8;return function(_0x2b2380){if(_0x2b2380){return _0x3c9f12[_0x0e31('0x28')](_0x2d9d4f)[_0x0e31('0x29')](_0x2b2380);}};}function respondWithFilteredResult(_0xe2e5ac,_0x15f8aa){return function(_0x43d60a){if(_0x43d60a){var _0x1bd237=_0x43d60a['count'],_0x12e70c=_0x15f8aa[_0x0e31('0x2a')],_0x18a284=_0x15f8aa[_0x0e31('0x2a')]+_0x15f8aa['limit'],_0x589616;if(_0x18a284>=_0x1bd237){_0x18a284=_0x1bd237;_0x589616=0xc8;}else{_0x589616=0xce;}_0xe2e5ac['status'](_0x589616);return _0xe2e5ac[_0x0e31('0x2b')](_0x0e31('0x2c'),_0x12e70c+'-'+_0x18a284+'/'+_0x1bd237)[_0x0e31('0x29')](_0x43d60a);}return null;};}function patchUpdates(_0x3ac19c){return function(_0x23de7d){try{jsonpatch[_0x0e31('0x2d')](_0x23de7d,_0x3ac19c,!![]);}catch(_0x94833b){return BPromise[_0x0e31('0x2e')](_0x94833b);}return _0x23de7d[_0x0e31('0x2f')]();};}function saveUpdates(_0x448c0f,_0xa87cb4){return function(_0x56d585){if(_0x56d585){return _0x56d585[_0x0e31('0x30')](_0x448c0f)[_0x0e31('0x31')](function(_0x11c1a7){return _0x11c1a7;});}return null;};}function removeEntity(_0x46aa31,_0x1bd9e0){return function(_0x24296c){if(_0x24296c){return _0x24296c[_0x0e31('0x32')]()[_0x0e31('0x31')](function(){_0x46aa31['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cdd25,_0x940d1f){return function(_0x21f4f1){if(!_0x21f4f1){_0x3cdd25[_0x0e31('0x27')](0x194);}return _0x21f4f1;};}function handleError(_0x4c6dfe,_0x189485){_0x189485=_0x189485||0x1f4;return function(_0x18fc71){logger['error'](_0x18fc71[_0x0e31('0x33')]);if(_0x18fc71[_0x0e31('0x34')]){delete _0x18fc71[_0x0e31('0x34')];}_0x4c6dfe[_0x0e31('0x28')](_0x189485)[_0x0e31('0x35')](_0x18fc71);};}exports[_0x0e31('0x36')]=function(_0x1ecdd6,_0x350c02){var _0x1267c3={},_0x22064f={},_0x3ceed6={'count':0x0,'rows':[]};var _0x3209a0=_[_0x0e31('0x37')](db['OpenchannelMessage']['rawAttributes'],function(_0x93acf){return{'name':_0x93acf[_0x0e31('0x38')],'type':_0x93acf[_0x0e31('0x39')][_0x0e31('0x3a')]};});_0x22064f[_0x0e31('0x3b')]=_[_0x0e31('0x37')](_0x3209a0,'name');_0x22064f['query']=_[_0x0e31('0x3c')](_0x1ecdd6[_0x0e31('0x3d')]);_0x22064f[_0x0e31('0x3e')]=_['intersection'](_0x22064f[_0x0e31('0x3b')],_0x22064f[_0x0e31('0x3d')]);_0x1267c3[_0x0e31('0x3f')]=_[_0x0e31('0x40')](_0x22064f['model'],qs[_0x0e31('0x41')](_0x1ecdd6[_0x0e31('0x3d')][_0x0e31('0x41')]));_0x1267c3['attributes']=_0x1267c3[_0x0e31('0x3f')][_0x0e31('0x42')]?_0x1267c3[_0x0e31('0x3f')]:_0x22064f['model'];if(!_0x1ecdd6[_0x0e31('0x3d')][_0x0e31('0x43')](_0x0e31('0x44'))){_0x1267c3['limit']=qs['limit'](_0x1ecdd6[_0x0e31('0x3d')][_0x0e31('0x45')]);_0x1267c3[_0x0e31('0x2a')]=qs[_0x0e31('0x2a')](_0x1ecdd6[_0x0e31('0x3d')][_0x0e31('0x2a')]);}_0x1267c3[_0x0e31('0x46')]=qs[_0x0e31('0x47')](_0x1ecdd6[_0x0e31('0x3d')][_0x0e31('0x47')]);_0x1267c3[_0x0e31('0x48')]=qs[_0x0e31('0x3e')](_['pick'](_0x1ecdd6[_0x0e31('0x3d')],_0x22064f[_0x0e31('0x3e')]),_0x3209a0);if(_0x1ecdd6[_0x0e31('0x3d')][_0x0e31('0x49')]){_0x1267c3[_0x0e31('0x48')]=_['merge'](_0x1267c3[_0x0e31('0x48')],{'$or':_['map'](_0x3209a0,function(_0x4cb119){if(_0x4cb119[_0x0e31('0x39')]!==_0x0e31('0x4a')){var _0x3e4654={};_0x3e4654[_0x4cb119[_0x0e31('0x34')]]={'$like':'%'+_0x1ecdd6['query'][_0x0e31('0x49')]+'%'};return _0x3e4654;}})});}_0x1267c3=_[_0x0e31('0x4b')]({},_0x1267c3,_0x1ecdd6['options']);var _0xcae5ae={'where':_0x1267c3[_0x0e31('0x48')]};return db['OpenchannelMessage'][_0x0e31('0x4c')](_0xcae5ae)['then'](function(_0x39c4df){_0x3ceed6[_0x0e31('0x4c')]=_0x39c4df;if(_0x1ecdd6['query'][_0x0e31('0x4d')]){_0x1267c3[_0x0e31('0x4e')]=[{'all':!![]}];}return db[_0x0e31('0x4f')][_0x0e31('0x50')](_0x1267c3);})[_0x0e31('0x31')](function(_0x7f751c){_0x3ceed6[_0x0e31('0x51')]=_0x7f751c;return _0x3ceed6;})[_0x0e31('0x31')](respondWithFilteredResult(_0x350c02,_0x1267c3))[_0x0e31('0x26')](handleError(_0x350c02,null));};exports['show']=function(_0xeb7de3,_0x4d04db){var _0x12f2d3={'raw':!![],'where':{'id':_0xeb7de3[_0x0e31('0x52')]['id']}},_0x214b5c={};_0x214b5c[_0x0e31('0x3b')]=_[_0x0e31('0x3c')](db[_0x0e31('0x4f')][_0x0e31('0x53')]);_0x214b5c[_0x0e31('0x3d')]=_[_0x0e31('0x3c')](_0xeb7de3[_0x0e31('0x3d')]);_0x214b5c[_0x0e31('0x3e')]=_['intersection'](_0x214b5c[_0x0e31('0x3b')],_0x214b5c[_0x0e31('0x3d')]);_0x12f2d3[_0x0e31('0x3f')]=_[_0x0e31('0x40')](_0x214b5c[_0x0e31('0x3b')],qs[_0x0e31('0x41')](_0xeb7de3[_0x0e31('0x3d')][_0x0e31('0x41')]));_0x12f2d3[_0x0e31('0x3f')]=_0x12f2d3[_0x0e31('0x3f')][_0x0e31('0x42')]?_0x12f2d3['attributes']:_0x214b5c[_0x0e31('0x3b')];if(_0xeb7de3[_0x0e31('0x3d')][_0x0e31('0x4d')]){_0x12f2d3[_0x0e31('0x4e')]=[{'all':!![]}];}_0x12f2d3=_[_0x0e31('0x4b')]({},_0x12f2d3,_0xeb7de3['options']);return db['OpenchannelMessage'][_0x0e31('0x54')](_0x12f2d3)[_0x0e31('0x31')](handleEntityNotFound(_0x4d04db,null))[_0x0e31('0x31')](respondWithResult(_0x4d04db,null))[_0x0e31('0x26')](handleError(_0x4d04db,null));};exports[_0x0e31('0x55')]=function(_0x4b996d,_0x20f41e){return db['OpenchannelMessage'][_0x0e31('0x55')](_0x4b996d[_0x0e31('0x56')],{})['then'](respondWithResult(_0x20f41e,0xc9))[_0x0e31('0x26')](handleError(_0x20f41e,null));};exports[_0x0e31('0x30')]=function(_0x41912f,_0x2dedc8){if(_0x41912f[_0x0e31('0x56')]['id']){delete _0x41912f[_0x0e31('0x56')]['id'];}return db[_0x0e31('0x4f')][_0x0e31('0x54')]({'where':{'id':_0x41912f[_0x0e31('0x52')]['id']}})[_0x0e31('0x31')](handleEntityNotFound(_0x2dedc8,null))[_0x0e31('0x31')](saveUpdates(_0x41912f[_0x0e31('0x56')],null))[_0x0e31('0x31')](respondWithResult(_0x2dedc8,null))[_0x0e31('0x26')](handleError(_0x2dedc8,null));};exports[_0x0e31('0x32')]=function(_0x2f4bb7,_0x1d8250){return db['OpenchannelMessage'][_0x0e31('0x54')]({'where':{'id':_0x2f4bb7[_0x0e31('0x52')]['id']}})[_0x0e31('0x31')](handleEntityNotFound(_0x1d8250,null))[_0x0e31('0x31')](removeEntity(_0x1d8250,null))[_0x0e31('0x26')](handleError(_0x1d8250,null));};exports[_0x0e31('0x57')]=function(_0x580861,_0x253e9e){return db[_0x0e31('0x4f')]['describe']()['then'](respondWithResult(_0x253e9e,null))[_0x0e31('0x26')](handleError(_0x253e9e,null));};var interaction_log=require(_0x0e31('0xf'))(_0x0e31('0x58'));exports['accept']=function(_0x35c3ca,_0x3e2637,_0x638fee){var _0x37a52b={'agent':{},'channel':_0x0e31('0x59')};if(_0x35c3ca['body']['id']){delete _0x35c3ca[_0x0e31('0x56')]['id'];}_0x35c3ca[_0x0e31('0x56')][_0x0e31('0x5a')]=!![];_0x35c3ca['body'][_0x0e31('0x5b')]=moment()[_0x0e31('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x35c3ca[_0x0e31('0x56')][_0x0e31('0x5d')]=_0x35c3ca[_0x0e31('0x56')]['UserId']||_0x35c3ca['user']['id'];_0x37a52b['agent']['id']=_0x35c3ca[_0x0e31('0x56')]['UserId'];return db[_0x0e31('0x4f')]['find']({'where':{'id':_0x35c3ca['params']['id'],'UserId':null},'include':[{'model':db[_0x0e31('0x5e')],'as':_0x0e31('0x5f')}]})[_0x0e31('0x31')](handleEntityNotFound(_0x3e2637,null))['then'](saveUpdates(_0x35c3ca['body'],null))['then'](function(_0x18deae){if(_0x18deae){_0x37a52b['message']=_0x18deae[_0x0e31('0x60')]({'plain':!![]});return db[_0x0e31('0x61')][_0x0e31('0x54')]({'where':{'id':_0x18deae[_0x0e31('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x3e2637,null))['then'](function(_0xfc4efc){if(_0xfc4efc){return _0xfc4efc['update']({'UserId':_0x35c3ca['body'][_0x0e31('0x5d')],'read1stAt':_[_0x0e31('0x63')](_0xfc4efc[_0x0e31('0x64')])?moment()[_0x0e31('0x5c')](_0x0e31('0x65')):undefined});}return null;})[_0x0e31('0x31')](function(_0x99f78a){if(_0x99f78a){_0x37a52b[_0x0e31('0x66')]=_0x99f78a[_0x0e31('0x60')]({'plain':!![]});interaction_log['info'](_0x0e31('0x67'),_0x35c3ca['user']['id'],_0x35c3ca[_0x0e31('0x68')]['name'],_0x35c3ca[_0x0e31('0x68')][_0x0e31('0x69')],_0x37a52b[_0x0e31('0x66')]['id'],_0x35c3ca[_0x0e31('0x56')]?JSON[_0x0e31('0x21')](_0x35c3ca[_0x0e31('0x56')]):_0x0e31('0x6a'));return respondWithRpcPromise(_0x0e31('0x6b'),_0x0e31('0x6c'),_0x37a52b);}return null;})[_0x0e31('0x31')](function(_0x192543){if(_0x192543){if(_0x35c3ca[_0x0e31('0x56')][_0x0e31('0x6d')]){_0x37a52b[_0x0e31('0x24')][_0x0e31('0x6e')]=util['format'](_0x0e31('0x6f'),_0x35c3ca['user'][_0x0e31('0x34')]);_0x37a52b[_0x0e31('0x24')][_0x0e31('0x70')]=_0x37a52b[_0x0e31('0x70')];_0x37a52b[_0x0e31('0x24')]['event']=_0x0e31('0x71');return respondWithRpcPromise('EventManager',_0x0e31('0x72'),{'event':_0x0e31('0x73'),'message':_0x37a52b[_0x0e31('0x24')]},client9002)[_0x0e31('0x31')](function(){return _0x37a52b;});}return _0x37a52b;}return null;})['then'](respondWithResult(_0x3e2637,null))['catch'](handleError(_0x3e2637,null));};var interaction_log=require('../../config/logger')(_0x0e31('0x58'));exports['reject']=function(_0x18f32f,_0x97fae7,_0x32a922){var _0x2cc0c8={'agent':{},'channel':_0x0e31('0x59')};if(_0x18f32f[_0x0e31('0x56')]['id']){delete _0x18f32f[_0x0e31('0x56')]['id'];}_0x18f32f[_0x0e31('0x56')][_0x0e31('0x5d')]=_0x18f32f[_0x0e31('0x56')][_0x0e31('0x5d')]||_0x18f32f['user']['id'];_0x2cc0c8[_0x0e31('0x74')]['id']=_0x18f32f[_0x0e31('0x56')]['UserId'];return db[_0x0e31('0x4f')]['find']({'where':{'id':_0x18f32f['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x97fae7,null))[_0x0e31('0x31')](function(_0x1ac9cf){if(_0x1ac9cf){_0x2cc0c8[_0x0e31('0x24')]=_0x1ac9cf['get']({'plain':!![]});return db[_0x0e31('0x61')][_0x0e31('0x54')]({'where':{'id':_0x1ac9cf[_0x0e31('0x62')]}});}return null;})[_0x0e31('0x31')](handleEntityNotFound(_0x97fae7,null))[_0x0e31('0x31')](function(_0x45df8f){if(_0x45df8f){_0x2cc0c8[_0x0e31('0x66')]=_0x45df8f[_0x0e31('0x60')]({'plain':!![]});interaction_log[_0x0e31('0x1e')](_0x0e31('0x75'),_0x18f32f[_0x0e31('0x68')]['id'],_0x18f32f[_0x0e31('0x68')][_0x0e31('0x34')],_0x18f32f[_0x0e31('0x68')][_0x0e31('0x69')],_0x2cc0c8[_0x0e31('0x66')]['id'],_0x18f32f['body']?JSON[_0x0e31('0x21')](_0x18f32f['body']):_0x0e31('0x6a'));return respondWithRpcPromise(_0x0e31('0x76'),_0x0e31('0x77'),_0x2cc0c8);}return null;})[_0x0e31('0x31')](function(_0x4df178){if(_0x4df178){_0x4df178['message'][_0x0e31('0x6e')]=util[_0x0e31('0x5c')]('SIP/%s',_0x18f32f[_0x0e31('0x68')][_0x0e31('0x34')]);_0x4df178[_0x0e31('0x24')][_0x0e31('0x70')]=_0x2cc0c8[_0x0e31('0x70')];_0x4df178['message'][_0x0e31('0x78')]='reject';respondWithRpcPromise(_0x0e31('0x72'),_0x0e31('0x72'),{'event':_0x0e31('0x79'),'message':_0x4df178[_0x0e31('0x24')]},client9002);return _0x2cc0c8;}return null;})[_0x0e31('0x31')](respondWithResult(_0x97fae7,null))['catch'](handleError(_0x97fae7,null));}; \ No newline at end of file +var _0xdf08=['fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','show','params','find','create','body','catch','describe','openchannel-interactions','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','OpenchannelInteraction','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','defaults','redis','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','OpenchannelMessage'];(function(_0x39acc5,_0x4211ad){var _0x37134d=function(_0x50181d){while(--_0x50181d){_0x39acc5['push'](_0x39acc5['shift']());}};_0x37134d(++_0x4211ad);}(_0xdf08,0x12e));var _0x8df0=function(_0x370b6a,_0x14ab11){_0x370b6a=_0x370b6a-0x0;var _0x2ec592=_0xdf08[_0x370b6a];return _0x2ec592;};'use strict';var pdf=require(_0x8df0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8df0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8df0('0x2'));var rp=require(_0x8df0('0x3'));var moment=require(_0x8df0('0x4'));var BPromise=require(_0x8df0('0x5'));var Mustache=require(_0x8df0('0x6'));var util=require(_0x8df0('0x7'));var path=require(_0x8df0('0x8'));var sox=require(_0x8df0('0x9'));var csv=require(_0x8df0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8df0('0xb'));var _=require('lodash');var squel=require(_0x8df0('0xc'));var crypto=require(_0x8df0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8df0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8df0('0xf'));var Papa=require('papaparse');var Redis=require(_0x8df0('0x10'));var authService=require(_0x8df0('0x11'));var qs=require(_0x8df0('0x12'));var as=require(_0x8df0('0x13'));var hardwareService=require(_0x8df0('0x14'));var logger=require(_0x8df0('0x15'))('api');var utils=require(_0x8df0('0x16'));var config=require(_0x8df0('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x8df0('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8df0('0x19')]));require(_0x8df0('0x1a'))[_0x8df0('0x1b')](socket);var jayson=require(_0x8df0('0x1c'));var client=jayson[_0x8df0('0x1d')][_0x8df0('0x1e')]({'port':0x232c});var client9002=jayson[_0x8df0('0x1d')][_0x8df0('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4edb72,_0x27c718,_0x976212,_0x356cf3){return new BPromise(function(_0x3c60fa,_0x369b83){var _0x3e4ab4=_0x356cf3||client;return _0x3e4ab4[_0x8df0('0x1f')](_0x4edb72,_0x976212)[_0x8df0('0x20')](function(_0x388ae6){logger[_0x8df0('0x21')](_0x8df0('0x22'),_0x27c718,_0x8df0('0x23'));logger[_0x8df0('0x24')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x27c718,_0x8df0('0x23'),JSON[_0x8df0('0x25')](_0x388ae6));if(_0x388ae6['error']){if(_0x388ae6[_0x8df0('0x26')][_0x8df0('0x27')]===0x1f4){logger[_0x8df0('0x26')](_0x8df0('0x22'),_0x27c718,_0x388ae6[_0x8df0('0x26')][_0x8df0('0x28')]);return _0x369b83(_0x388ae6[_0x8df0('0x26')][_0x8df0('0x28')]);}logger[_0x8df0('0x26')](_0x8df0('0x22'),_0x27c718,_0x388ae6[_0x8df0('0x26')][_0x8df0('0x28')]);return _0x3c60fa(_0x388ae6[_0x8df0('0x26')]['message']);}else{logger[_0x8df0('0x21')](_0x8df0('0x22'),_0x27c718,_0x8df0('0x23'));_0x3c60fa(_0x388ae6[_0x8df0('0x29')][_0x8df0('0x28')]);}})['catch'](function(_0x30f6cb){logger[_0x8df0('0x26')](_0x8df0('0x22'),_0x27c718,_0x30f6cb);_0x369b83(_0x30f6cb);});});}function respondWithStatusCode(_0x14ec8c,_0x17f6eb){_0x17f6eb=_0x17f6eb||0xcc;return function(_0x12f5a3){if(_0x12f5a3){return _0x14ec8c[_0x8df0('0x2a')](_0x17f6eb);}return _0x14ec8c[_0x8df0('0x2b')](_0x17f6eb)[_0x8df0('0x2c')]();};}function respondWithResult(_0x26eb41,_0x5d4f6d){_0x5d4f6d=_0x5d4f6d||0xc8;return function(_0x13194e){if(_0x13194e){return _0x26eb41[_0x8df0('0x2b')](_0x5d4f6d)['json'](_0x13194e);}};}function respondWithFilteredResult(_0x11f241,_0x6c8175){return function(_0x6962ea){if(_0x6962ea){var _0x274aca=_0x6962ea[_0x8df0('0x2d')],_0x2b1d62=_0x6c8175[_0x8df0('0x2e')],_0x1e429a=_0x6c8175[_0x8df0('0x2e')]+_0x6c8175[_0x8df0('0x2f')],_0x3d6bc7;if(_0x1e429a>=_0x274aca){_0x1e429a=_0x274aca;_0x3d6bc7=0xc8;}else{_0x3d6bc7=0xce;}_0x11f241[_0x8df0('0x2b')](_0x3d6bc7);return _0x11f241[_0x8df0('0x30')](_0x8df0('0x31'),_0x2b1d62+'-'+_0x1e429a+'/'+_0x274aca)['json'](_0x6962ea);}return null;};}function patchUpdates(_0xae6a53){return function(_0x5bc19f){try{jsonpatch[_0x8df0('0x32')](_0x5bc19f,_0xae6a53,!![]);}catch(_0x4fc125){return BPromise[_0x8df0('0x33')](_0x4fc125);}return _0x5bc19f[_0x8df0('0x34')]();};}function saveUpdates(_0x1b89d1,_0x3429d1){return function(_0x4cc4d2){if(_0x4cc4d2){return _0x4cc4d2[_0x8df0('0x35')](_0x1b89d1)['then'](function(_0x282dd1){return _0x282dd1;});}return null;};}function removeEntity(_0x454a04,_0x5ce095){return function(_0x24286e){if(_0x24286e){return _0x24286e[_0x8df0('0x36')]()[_0x8df0('0x20')](function(){_0x454a04[_0x8df0('0x2b')](0xcc)[_0x8df0('0x2c')]();});}};}function handleEntityNotFound(_0x142364,_0x31b27f){return function(_0x2502c7){if(!_0x2502c7){_0x142364['sendStatus'](0x194);}return _0x2502c7;};}function handleError(_0x404961,_0x25bd44){_0x25bd44=_0x25bd44||0x1f4;return function(_0x44621f){logger[_0x8df0('0x26')](_0x44621f[_0x8df0('0x37')]);if(_0x44621f[_0x8df0('0x38')]){delete _0x44621f[_0x8df0('0x38')];}_0x404961['status'](_0x25bd44)[_0x8df0('0x39')](_0x44621f);};}exports[_0x8df0('0x3a')]=function(_0x1e8ae5,_0x30675c){var _0x179a5f={},_0x23f528={},_0x353c93={'count':0x0,'rows':[]};var _0x837285=_[_0x8df0('0x3b')](db[_0x8df0('0x3c')]['rawAttributes'],function(_0x432a11){return{'name':_0x432a11[_0x8df0('0x3d')],'type':_0x432a11['type'][_0x8df0('0x3e')]};});_0x23f528[_0x8df0('0x3f')]=_[_0x8df0('0x3b')](_0x837285,_0x8df0('0x38'));_0x23f528[_0x8df0('0x40')]=_[_0x8df0('0x41')](_0x1e8ae5[_0x8df0('0x40')]);_0x23f528[_0x8df0('0x42')]=_[_0x8df0('0x43')](_0x23f528[_0x8df0('0x3f')],_0x23f528[_0x8df0('0x40')]);_0x179a5f[_0x8df0('0x44')]=_[_0x8df0('0x43')](_0x23f528[_0x8df0('0x3f')],qs[_0x8df0('0x45')](_0x1e8ae5[_0x8df0('0x40')]['fields']));_0x179a5f['attributes']=_0x179a5f[_0x8df0('0x44')][_0x8df0('0x46')]?_0x179a5f[_0x8df0('0x44')]:_0x23f528['model'];if(!_0x1e8ae5['query'][_0x8df0('0x47')](_0x8df0('0x48'))){_0x179a5f[_0x8df0('0x2f')]=qs[_0x8df0('0x2f')](_0x1e8ae5[_0x8df0('0x40')]['limit']);_0x179a5f[_0x8df0('0x2e')]=qs[_0x8df0('0x2e')](_0x1e8ae5[_0x8df0('0x40')][_0x8df0('0x2e')]);}_0x179a5f[_0x8df0('0x49')]=qs[_0x8df0('0x4a')](_0x1e8ae5[_0x8df0('0x40')]['sort']);_0x179a5f[_0x8df0('0x4b')]=qs[_0x8df0('0x42')](_[_0x8df0('0x4c')](_0x1e8ae5[_0x8df0('0x40')],_0x23f528['filters']),_0x837285);if(_0x1e8ae5[_0x8df0('0x40')][_0x8df0('0x4d')]){_0x179a5f[_0x8df0('0x4b')]=_[_0x8df0('0x4e')](_0x179a5f[_0x8df0('0x4b')],{'$or':_['map'](_0x837285,function(_0xa2b4d1){if(_0xa2b4d1[_0x8df0('0x4f')]!==_0x8df0('0x50')){var _0xebd0d4={};_0xebd0d4[_0xa2b4d1['name']]={'$like':'%'+_0x1e8ae5[_0x8df0('0x40')][_0x8df0('0x4d')]+'%'};return _0xebd0d4;}})});}_0x179a5f=_[_0x8df0('0x4e')]({},_0x179a5f,_0x1e8ae5[_0x8df0('0x51')]);var _0x1b9fa4={'where':_0x179a5f['where']};return db[_0x8df0('0x3c')]['count'](_0x1b9fa4)['then'](function(_0xfd8f33){_0x353c93['count']=_0xfd8f33;if(_0x1e8ae5[_0x8df0('0x40')][_0x8df0('0x52')]){_0x179a5f[_0x8df0('0x53')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x179a5f);})[_0x8df0('0x20')](function(_0x12b6b1){_0x353c93['rows']=_0x12b6b1;return _0x353c93;})[_0x8df0('0x20')](respondWithFilteredResult(_0x30675c,_0x179a5f))['catch'](handleError(_0x30675c,null));};exports[_0x8df0('0x54')]=function(_0x4ffc68,_0x11f8bc){var _0x431b3e={'raw':!![],'where':{'id':_0x4ffc68[_0x8df0('0x55')]['id']}},_0x3813dc={};_0x3813dc[_0x8df0('0x3f')]=_[_0x8df0('0x41')](db[_0x8df0('0x3c')]['rawAttributes']);_0x3813dc[_0x8df0('0x40')]=_[_0x8df0('0x41')](_0x4ffc68[_0x8df0('0x40')]);_0x3813dc[_0x8df0('0x42')]=_[_0x8df0('0x43')](_0x3813dc[_0x8df0('0x3f')],_0x3813dc[_0x8df0('0x40')]);_0x431b3e['attributes']=_['intersection'](_0x3813dc[_0x8df0('0x3f')],qs[_0x8df0('0x45')](_0x4ffc68[_0x8df0('0x40')]['fields']));_0x431b3e[_0x8df0('0x44')]=_0x431b3e[_0x8df0('0x44')][_0x8df0('0x46')]?_0x431b3e[_0x8df0('0x44')]:_0x3813dc[_0x8df0('0x3f')];if(_0x4ffc68[_0x8df0('0x40')][_0x8df0('0x52')]){_0x431b3e['include']=[{'all':!![]}];}_0x431b3e=_['merge']({},_0x431b3e,_0x4ffc68[_0x8df0('0x51')]);return db['OpenchannelMessage'][_0x8df0('0x56')](_0x431b3e)[_0x8df0('0x20')](handleEntityNotFound(_0x11f8bc,null))['then'](respondWithResult(_0x11f8bc,null))['catch'](handleError(_0x11f8bc,null));};exports['create']=function(_0x5a8a6f,_0x2c2816){return db[_0x8df0('0x3c')][_0x8df0('0x57')](_0x5a8a6f['body'],{})[_0x8df0('0x20')](respondWithResult(_0x2c2816,0xc9))['catch'](handleError(_0x2c2816,null));};exports[_0x8df0('0x35')]=function(_0xe70cc5,_0x292a4c){if(_0xe70cc5['body']['id']){delete _0xe70cc5[_0x8df0('0x58')]['id'];}return db[_0x8df0('0x3c')][_0x8df0('0x56')]({'where':{'id':_0xe70cc5['params']['id']}})[_0x8df0('0x20')](handleEntityNotFound(_0x292a4c,null))[_0x8df0('0x20')](saveUpdates(_0xe70cc5[_0x8df0('0x58')],null))[_0x8df0('0x20')](respondWithResult(_0x292a4c,null))[_0x8df0('0x59')](handleError(_0x292a4c,null));};exports[_0x8df0('0x36')]=function(_0x5b5a6f,_0x4709c9){return db['OpenchannelMessage'][_0x8df0('0x56')]({'where':{'id':_0x5b5a6f[_0x8df0('0x55')]['id']}})[_0x8df0('0x20')](handleEntityNotFound(_0x4709c9,null))[_0x8df0('0x20')](removeEntity(_0x4709c9,null))[_0x8df0('0x59')](handleError(_0x4709c9,null));};exports[_0x8df0('0x5a')]=function(_0x61f633,_0x34b5d2){return db[_0x8df0('0x3c')][_0x8df0('0x5a')]()[_0x8df0('0x20')](respondWithResult(_0x34b5d2,null))[_0x8df0('0x59')](handleError(_0x34b5d2,null));};var interaction_log=require(_0x8df0('0x15'))(_0x8df0('0x5b'));exports['accept']=function(_0x1d65a5,_0x54c637,_0xed0dd3){var _0x5d9e3d={'agent':{},'channel':_0x8df0('0x5c')};if(_0x1d65a5[_0x8df0('0x58')]['id']){delete _0x1d65a5[_0x8df0('0x58')]['id'];}_0x1d65a5[_0x8df0('0x58')][_0x8df0('0x5d')]=!![];_0x1d65a5[_0x8df0('0x58')][_0x8df0('0x5e')]=moment()[_0x8df0('0x5f')](_0x8df0('0x60'));_0x1d65a5[_0x8df0('0x58')][_0x8df0('0x61')]=_0x1d65a5['body']['UserId']||_0x1d65a5[_0x8df0('0x62')]['id'];_0x5d9e3d[_0x8df0('0x63')]['id']=_0x1d65a5[_0x8df0('0x58')][_0x8df0('0x61')];return db['OpenchannelMessage'][_0x8df0('0x56')]({'where':{'id':_0x1d65a5[_0x8df0('0x55')]['id'],'UserId':null},'include':[{'model':db[_0x8df0('0x64')],'as':_0x8df0('0x65')}]})[_0x8df0('0x20')](handleEntityNotFound(_0x54c637,null))[_0x8df0('0x20')](saveUpdates(_0x1d65a5[_0x8df0('0x58')],null))['then'](function(_0x42c304){if(_0x42c304){_0x5d9e3d['message']=_0x42c304[_0x8df0('0x66')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x42c304['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x54c637,null))[_0x8df0('0x20')](function(_0x360200){if(_0x360200){return _0x360200[_0x8df0('0x35')]({'UserId':_0x1d65a5[_0x8df0('0x58')]['UserId'],'read1stAt':_[_0x8df0('0x67')](_0x360200['read1stAt'])?moment()['format'](_0x8df0('0x60')):undefined});}return null;})[_0x8df0('0x20')](function(_0x2d1e59){if(_0x2d1e59){_0x5d9e3d[_0x8df0('0x68')]=_0x2d1e59[_0x8df0('0x66')]({'plain':!![]});interaction_log[_0x8df0('0x21')](_0x8df0('0x69'),_0x1d65a5[_0x8df0('0x62')]['id'],_0x1d65a5[_0x8df0('0x62')][_0x8df0('0x38')],_0x1d65a5[_0x8df0('0x62')][_0x8df0('0x6a')],_0x5d9e3d[_0x8df0('0x68')]['id'],_0x1d65a5[_0x8df0('0x58')]?JSON[_0x8df0('0x25')](_0x1d65a5[_0x8df0('0x58')]):_0x8df0('0x6b'));return respondWithRpcPromise(_0x8df0('0x6c'),'acceptMessage',_0x5d9e3d);}return null;})[_0x8df0('0x20')](function(_0x83a7e9){if(_0x83a7e9){if(_0x1d65a5[_0x8df0('0x58')][_0x8df0('0x6d')]){_0x5d9e3d[_0x8df0('0x28')][_0x8df0('0x6e')]=util['format'](_0x8df0('0x6f'),_0x1d65a5[_0x8df0('0x62')][_0x8df0('0x38')]);_0x5d9e3d[_0x8df0('0x28')][_0x8df0('0x70')]=_0x5d9e3d[_0x8df0('0x70')];_0x5d9e3d[_0x8df0('0x28')][_0x8df0('0x71')]='accept';return respondWithRpcPromise(_0x8df0('0x72'),_0x8df0('0x72'),{'event':_0x8df0('0x73'),'message':_0x5d9e3d[_0x8df0('0x28')]},client9002)[_0x8df0('0x20')](function(){return _0x5d9e3d;});}return _0x5d9e3d;}return null;})[_0x8df0('0x20')](respondWithResult(_0x54c637,null))[_0x8df0('0x59')](handleError(_0x54c637,null));};var interaction_log=require('../../config/logger')(_0x8df0('0x5b'));exports[_0x8df0('0x33')]=function(_0x300645,_0xcfa980,_0x323f4a){var _0x4886a0={'agent':{},'channel':_0x8df0('0x5c')};if(_0x300645['body']['id']){delete _0x300645[_0x8df0('0x58')]['id'];}_0x300645['body'][_0x8df0('0x61')]=_0x300645[_0x8df0('0x58')][_0x8df0('0x61')]||_0x300645[_0x8df0('0x62')]['id'];_0x4886a0['agent']['id']=_0x300645[_0x8df0('0x58')]['UserId'];return db[_0x8df0('0x3c')][_0x8df0('0x56')]({'where':{'id':_0x300645[_0x8df0('0x55')]['id'],'UserId':null}})[_0x8df0('0x20')](handleEntityNotFound(_0xcfa980,null))['then'](function(_0x4d345c){if(_0x4d345c){_0x4886a0[_0x8df0('0x28')]=_0x4d345c[_0x8df0('0x66')]({'plain':!![]});return db[_0x8df0('0x74')][_0x8df0('0x56')]({'where':{'id':_0x4d345c[_0x8df0('0x75')]}});}return null;})['then'](handleEntityNotFound(_0xcfa980,null))[_0x8df0('0x20')](function(_0x2a0248){if(_0x2a0248){_0x4886a0[_0x8df0('0x68')]=_0x2a0248['get']({'plain':!![]});interaction_log[_0x8df0('0x21')](_0x8df0('0x76'),_0x300645[_0x8df0('0x62')]['id'],_0x300645[_0x8df0('0x62')][_0x8df0('0x38')],_0x300645[_0x8df0('0x62')][_0x8df0('0x6a')],_0x4886a0[_0x8df0('0x68')]['id'],_0x300645['body']?JSON['stringify'](_0x300645[_0x8df0('0x58')]):'null');return respondWithRpcPromise(_0x8df0('0x77'),_0x8df0('0x78'),_0x4886a0);}return null;})[_0x8df0('0x20')](function(_0x34c7bd){if(_0x34c7bd){_0x34c7bd['message'][_0x8df0('0x6e')]=util[_0x8df0('0x5f')](_0x8df0('0x6f'),_0x300645[_0x8df0('0x62')][_0x8df0('0x38')]);_0x34c7bd[_0x8df0('0x28')]['channel']=_0x4886a0[_0x8df0('0x70')];_0x34c7bd[_0x8df0('0x28')]['event']=_0x8df0('0x33');respondWithRpcPromise(_0x8df0('0x72'),_0x8df0('0x72'),{'event':'rejectmessage','message':_0x34c7bd[_0x8df0('0x28')]},client9002);return _0x4886a0;}return null;})[_0x8df0('0x20')](respondWithResult(_0xcfa980,null))[_0x8df0('0x59')](handleError(_0xcfa980,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index fa9560b..1da4c2a 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 _0x3213=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','remove'];(function(_0x58226a,_0x48d416){var _0x59d680=function(_0xc8640a){while(--_0xc8640a){_0x58226a['push'](_0x58226a['shift']());}};_0x59d680(++_0x48d416);}(_0x3213,0x112));var _0x3321=function(_0xc3201,_0x1f4ba0){_0xc3201=_0xc3201-0x0;var _0x4c5e4c=_0x3213[_0xc3201];return _0x4c5e4c;};'use strict';var EventEmitter=require(_0x3321('0x0'));var OpenchannelMessage=require(_0x3321('0x1'))['db'][_0x3321('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x3321('0x3')](0x0);var events={'afterCreate':_0x3321('0x4'),'afterUpdate':'update','afterDestroy':_0x3321('0x5')};function emitEvent(_0x4093c2){return function(_0x505e2a,_0x349708,_0xa15599){OpenchannelMessageEvents['emit'](_0x4093c2+':'+_0x505e2a['id'],_0x505e2a);OpenchannelMessageEvents[_0x3321('0x6')](_0x4093c2,_0x505e2a);_0xa15599(null);};}for(var e in events){if(events[_0x3321('0x7')](e)){var event=events[e];OpenchannelMessage[_0x3321('0x8')](e,emitEvent(event));}}module[_0x3321('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x5558=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage'];(function(_0x5961a4,_0x142bea){var _0x100e13=function(_0x5784c2){while(--_0x5784c2){_0x5961a4['push'](_0x5961a4['shift']());}};_0x100e13(++_0x142bea);}(_0x5558,0x6b));var _0x8555=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x5558[_0x4b055c];return _0x4b62bb;};'use strict';var EventEmitter=require(_0x8555('0x0'));var OpenchannelMessage=require(_0x8555('0x1'))['db'][_0x8555('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x8555('0x3')](0x0);var events={'afterCreate':_0x8555('0x4'),'afterUpdate':_0x8555('0x5'),'afterDestroy':_0x8555('0x6')};function emitEvent(_0x2f550b){return function(_0x46f35f,_0x122144,_0x22eaff){OpenchannelMessageEvents[_0x8555('0x7')](_0x2f550b+':'+_0x46f35f['id'],_0x46f35f);OpenchannelMessageEvents['emit'](_0x2f550b,_0x46f35f);_0x22eaff(null);};}for(var e in events){if(events[_0x8555('0x8')](e)){var event=events[e];OpenchannelMessage[_0x8555('0x9')](e,emitEvent(event));}}module[_0x8555('0xa')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 53a59a9..fa414b0 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 _0x8db7=['toLowerCase','direction','out','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','secret','CmContact','describe','OpenchannelAccount','find','Interactions','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','length','Interaction','Contact','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get'];(function(_0x1ec65c,_0x354923){var _0x5249c2=function(_0x451341){while(--_0x451341){_0x1ec65c['push'](_0x1ec65c['shift']());}};_0x5249c2(++_0x354923);}(_0x8db7,0x1c1));var _0x78db=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x8db7[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x78db('0x0'));var util=require(_0x78db('0x1'));var logger=require(_0x78db('0x2'))(_0x78db('0x3'));var moment=require(_0x78db('0x4'));var BPromise=require(_0x78db('0x5'));var rp=require(_0x78db('0x6'));var fs=require('fs');var path=require(_0x78db('0x7'));var rimraf=require('rimraf');var config=require(_0x78db('0x8'));var attributes=require(_0x78db('0x9'));module[_0x78db('0xa')]=function(_0x1b7f56,_0x47c2da){return _0x1b7f56[_0x78db('0xb')](_0x78db('0xc'),attributes,{'tableName':_0x78db('0xd'),'paranoid':![],'indexes':[{'name':_0x78db('0xe'),'fields':[_0x78db('0xf')],'type':_0x78db('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c9f63,_0x5481bf,_0x28739c){var _0x52cb28=_0x1b7f56[_0x78db('0x11')];var _0x1be316=_0x3c9f63[_0x78db('0x12')]({'plain':!![]});if(_0x1be316['direction'][_0x78db('0x13')]()==='in'||_0x1be316[_0x78db('0x14')][_0x78db('0x13')]()===_0x78db('0x15')&&!_0x1be316['secret']&&!_['isNil'](_0x1be316['UserId'])){_0x52cb28[_0x78db('0x16')][_0x78db('0x17')]({'where':{'id':_0x1be316[_0x78db('0x18')]}})[_0x78db('0x19')](function(_0x2e1878){if(_0x2e1878){_0x2e1878[_0x78db('0x1a')]({'lastMsgAt':_0x1be316[_0x78db('0x1b')],'lastMsgDirection':_0x1be316[_0x78db('0x14')][_0x78db('0x13')]()});}})[_0x78db('0x1c')](function(_0x5e253e){console[_0x78db('0x1d')](_0x5e253e);});}if(_0x1be316[_0x78db('0x14')]===_0x78db('0x15')&&!_0x1be316[_0x78db('0x1e')]){var _0x5ac001;_0x52cb28[_0x78db('0x1f')][_0x78db('0x20')]()['then'](function(_0x283b3a){return _0x52cb28[_0x78db('0x21')][_0x78db('0x22')]({'where':{'id':_0x1be316['OpenchannelAccountId']},'include':[{'model':_0x52cb28[_0x78db('0x16')],'as':_0x78db('0x23'),'where':{'id':_0x1be316[_0x78db('0x18')]},'limit':0x1,'include':[{'model':_0x52cb28[_0x78db('0x1f')],'as':'Contact','attributes':_['keys'](_0x283b3a)}]}]});})[_0x78db('0x19')](function(_0x571d70){_0x5ac001=_0x571d70[_0x78db('0x12')]({'plain':!![]});if(_0x5ac001&&_0x5ac001[_0x78db('0x24')]){logger[_0x78db('0x25')](_0x78db('0x26'),_0x78db('0x27'),util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0x1be316['id'],_0x5ac001[_0x78db('0x24')]));if(_0x5ac001[_0x78db('0x23')]&&_0x5ac001[_0x78db('0x23')][_0x78db('0x28')]){_0x1be316[_0x78db('0x29')]=_['omit'](_0x5ac001[_0x78db('0x23')][0x0],_0x78db('0x2a'));_0x1be316[_0x78db('0x2a')]=_0x5ac001['Interactions'][0x0][_0x78db('0x2a')];}var _0x5481bf={'method':_0x78db('0x2b'),'uri':encodeURI(_0x5ac001[_0x78db('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5481bf[_0x78db('0x2c')]){case _0x78db('0x2d'):_0x5481bf['qs']=_0x1be316;break;case _0x78db('0x2b'):_0x5481bf[_0x78db('0xf')]=_0x1be316;break;}return rp(_0x5481bf)['then'](function(_0x1b3ee4){logger['info'](_0x78db('0x26'),_0x78db('0x27'),util['format'](_0x78db('0x2e'),_0x1be316['id'],_0x5ac001['replyUri']));if(_0x1b3ee4[_0x78db('0xf')][_0x78db('0x2f')]&&_0x1b3ee4[_0x78db('0xf')][_0x78db('0x2f')]!=_0x1be316[_0x78db('0x29')]['threadId']){return _0x52cb28['OpenchannelInteraction'][_0x78db('0x1a')]({'threadId':_0x1b3ee4[_0x78db('0xf')]['threadId']},{'logging':!![],'where':{'id':_0x1be316[_0x78db('0x29')]['id']}});}else{return;}})[_0x78db('0x19')](function(){return _0x3c9f63[_0x78db('0x1a')]({'read':!![]});})['catch'](function(_0x353e63){logger[_0x78db('0x1d')]('OpenchannelMessage,\x20%s,\x20%s',_0x78db('0x27'),util[_0x78db('0x30')](_0x353e63,{'showHidden':![],'depth':null}));_0x28739c();});}else{_0x28739c();}})[_0x78db('0x31')](function(){_0x28739c();});}else{_0x28739c();}}},'charset':_0x78db('0x32'),'collate':_0x78db('0x33')});}; \ No newline at end of file +var _0xcad4=['isNil','UserId','findOne','OpenchannelInteractionId','then','update','catch','error','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','CmContact','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','method','GET','POST','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','body','threadId','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','get','toLowerCase','direction','out','secret'];(function(_0x4fd109,_0x33c503){var _0x30f0a6=function(_0xc11c0d){while(--_0xc11c0d){_0x4fd109['push'](_0x4fd109['shift']());}};_0x30f0a6(++_0x33c503);}(_0xcad4,0x159));var _0x4cad=function(_0x23d8c3,_0x323336){_0x23d8c3=_0x23d8c3-0x0;var _0x90f27c=_0xcad4[_0x23d8c3];return _0x90f27c;};'use strict';var _=require(_0x4cad('0x0'));var util=require(_0x4cad('0x1'));var logger=require(_0x4cad('0x2'))(_0x4cad('0x3'));var moment=require('moment');var BPromise=require(_0x4cad('0x4'));var rp=require(_0x4cad('0x5'));var fs=require('fs');var path=require(_0x4cad('0x6'));var rimraf=require('rimraf');var config=require(_0x4cad('0x7'));var attributes=require('./openchannelMessage.attributes');module[_0x4cad('0x8')]=function(_0x4eb2cb,_0x52653e){return _0x4eb2cb[_0x4cad('0x9')](_0x4cad('0xa'),attributes,{'tableName':_0x4cad('0xb'),'paranoid':![],'indexes':[{'name':_0x4cad('0xc'),'fields':['body'],'type':_0x4cad('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4de990,_0x121693,_0x4a96df){var _0x426cfb=_0x4eb2cb['models'];var _0x48078a=_0x4de990[_0x4cad('0xe')]({'plain':!![]});if(_0x48078a['direction'][_0x4cad('0xf')]()==='in'||_0x48078a[_0x4cad('0x10')][_0x4cad('0xf')]()===_0x4cad('0x11')&&!_0x48078a[_0x4cad('0x12')]&&!_[_0x4cad('0x13')](_0x48078a[_0x4cad('0x14')])){_0x426cfb['OpenchannelInteraction'][_0x4cad('0x15')]({'where':{'id':_0x48078a[_0x4cad('0x16')]}})[_0x4cad('0x17')](function(_0x33cb6b){if(_0x33cb6b){_0x33cb6b[_0x4cad('0x18')]({'lastMsgAt':_0x48078a['createdAt'],'lastMsgDirection':_0x48078a[_0x4cad('0x10')][_0x4cad('0xf')]()});}})[_0x4cad('0x19')](function(_0x7fd2ad){console[_0x4cad('0x1a')](_0x7fd2ad);});}if(_0x48078a[_0x4cad('0x10')]===_0x4cad('0x11')&&!_0x48078a[_0x4cad('0x12')]){var _0x217719;_0x426cfb['CmContact'][_0x4cad('0x1b')]()[_0x4cad('0x17')](function(_0x424b01){return _0x426cfb[_0x4cad('0x1c')][_0x4cad('0x1d')]({'where':{'id':_0x48078a[_0x4cad('0x1e')]},'include':[{'model':_0x426cfb[_0x4cad('0x1f')],'as':_0x4cad('0x20'),'where':{'id':_0x48078a[_0x4cad('0x16')]},'limit':0x1,'include':[{'model':_0x426cfb[_0x4cad('0x21')],'as':_0x4cad('0x22'),'attributes':_[_0x4cad('0x23')](_0x424b01)}]}]});})['then'](function(_0x139a2a){_0x217719=_0x139a2a[_0x4cad('0xe')]({'plain':!![]});if(_0x217719&&_0x217719[_0x4cad('0x24')]){logger[_0x4cad('0x25')](_0x4cad('0x26'),'afterCreate',util[_0x4cad('0x27')](_0x4cad('0x28'),_0x48078a['id'],_0x217719[_0x4cad('0x24')]));if(_0x217719[_0x4cad('0x20')]&&_0x217719[_0x4cad('0x20')]['length']){_0x48078a[_0x4cad('0x29')]=_[_0x4cad('0x2a')](_0x217719[_0x4cad('0x20')][0x0],_0x4cad('0x22'));_0x48078a[_0x4cad('0x22')]=_0x217719['Interactions'][0x0]['Contact'];}var _0x121693={'method':'POST','uri':encodeURI(_0x217719['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x121693[_0x4cad('0x2b')]){case _0x4cad('0x2c'):_0x121693['qs']=_0x48078a;break;case _0x4cad('0x2d'):_0x121693['body']=_0x48078a;break;}return rp(_0x121693)[_0x4cad('0x17')](function(_0x381220){logger[_0x4cad('0x25')](_0x4cad('0x26'),_0x4cad('0x2e'),util[_0x4cad('0x27')](_0x4cad('0x2f'),_0x48078a['id'],_0x217719[_0x4cad('0x24')]));if(_0x381220[_0x4cad('0x30')][_0x4cad('0x31')]&&_0x381220[_0x4cad('0x30')][_0x4cad('0x31')]!=_0x48078a[_0x4cad('0x29')]['threadId']){return _0x426cfb[_0x4cad('0x1f')][_0x4cad('0x18')]({'threadId':_0x381220['body'][_0x4cad('0x31')]},{'logging':!![],'where':{'id':_0x48078a[_0x4cad('0x29')]['id']}});}else{return;}})[_0x4cad('0x17')](function(){return _0x4de990[_0x4cad('0x18')]({'read':!![]});})[_0x4cad('0x19')](function(_0x1a2e16){logger[_0x4cad('0x1a')](_0x4cad('0x26'),_0x4cad('0x2e'),util['inspect'](_0x1a2e16,{'showHidden':![],'depth':null}));_0x4a96df();});}else{_0x4a96df();}})[_0x4cad('0x32')](function(){_0x4a96df();});}else{_0x4a96df();}}},'charset':'utf8mb4','collate':_0x4cad('0x33')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 4848914..15174fb 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x454218,_0x1fbf9d){var _0x32771d=function(_0xe41f45){while(--_0xe41f45){_0x454218['push'](_0x454218['shift']());}};_0x32771d(++_0x1fbf9d);}(_0x5f2f,0x73));var _0xf5f2=function(_0xc2779b,_0x506b63){_0xc2779b=_0xc2779b-0x0;var _0x43f072=_0x5f2f[_0xc2779b];return _0x43f072;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body'];(function(_0x3fc29f,_0x3dfa3f){var _0xe50bb8=function(_0x214495){while(--_0x214495){_0x3fc29f['push'](_0x3fc29f['shift']());}};_0xe50bb8(++_0x3dfa3f);}(_0xb10b,0x12a));var _0xbb10=function(_0x215e8e,_0x2e9b00){_0x215e8e=_0x215e8e-0x0;var _0x43ce3b=_0xb10b[_0x215e8e];return _0x43ce3b;};'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});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 9d229c6..34949fe 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 _0x0713=['removeListener','register','length','openchannelMessage:','remove','update'];(function(_0x43b487,_0x21893a){var _0x2f707a=function(_0x477ee0){while(--_0x477ee0){_0x43b487['push'](_0x43b487['shift']());}};_0x2f707a(++_0x21893a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x3071('0x0'),_0x3071('0x1')];function createListener(_0x27405a,_0x305d85){return function(_0x864539){_0x305d85['emit'](_0x27405a,_0x864539);};}function removeListener(_0x2c547f,_0x7b18a4){return function(){OpenchannelMessageEvents[_0x3071('0x2')](_0x2c547f,_0x7b18a4);};}exports[_0x3071('0x3')]=function(_0xabd7b6){for(var _0x41cf76=0x0,_0x1d3dd6=events[_0x3071('0x4')];_0x41cf76<_0x1d3dd6;_0x41cf76++){var _0xbd737f=events[_0x41cf76];var _0x22274c=createListener(_0x3071('0x5')+_0xbd737f,_0xabd7b6);OpenchannelMessageEvents['on'](_0xbd737f,_0x22274c);}}; \ No newline at end of file +var _0x0713=['removeListener','register','length','openchannelMessage:','remove','update'];(function(_0x533528,_0x409d05){var _0x3189f1=function(_0x5e63d2){while(--_0x5e63d2){_0x533528['push'](_0x533528['shift']());}};_0x3189f1(++_0x409d05);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x3071('0x0'),_0x3071('0x1')];function createListener(_0x27405a,_0x305d85){return function(_0x864539){_0x305d85['emit'](_0x27405a,_0x864539);};}function removeListener(_0x2c547f,_0x7b18a4){return function(){OpenchannelMessageEvents[_0x3071('0x2')](_0x2c547f,_0x7b18a4);};}exports[_0x3071('0x3')]=function(_0xabd7b6){for(var _0x41cf76=0x0,_0x1d3dd6=events[_0x3071('0x4')];_0x41cf76<_0x1d3dd6;_0x41cf76++){var _0xbd737f=events[_0x41cf76];var _0x22274c=createListener(_0x3071('0x5')+_0xbd737f,_0xabd7b6);OpenchannelMessageEvents['on'](_0xbd737f,_0x22274c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 0f0aebf..2795c18 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 _0xa9e0=['post','create','/:id/teams','addTeams','put','delete','/:id','destroy','removeTeams','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','show','/:id/members','isAuthenticated','getMembers','/:id/users','getAgents'];(function(_0x24313c,_0x1a3fb0){var _0x56259e=function(_0x188f5e){while(--_0x188f5e){_0x24313c['push'](_0x24313c['shift']());}};_0x56259e(++_0x1a3fb0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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/teams',auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['post'](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x11')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller['addAgents']);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0xd')](),controller['update']);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth['isAuthenticated'](),controller[_0x0a9e('0x18')]);router['delete'](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);module[_0x0a9e('0x1b')]=router; \ No newline at end of file +var _0xa9e0=['post','create','/:id/teams','addTeams','put','delete','/:id','destroy','removeTeams','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','show','/:id/members','isAuthenticated','getMembers','/:id/users','getAgents'];(function(_0x1dde5d,_0x433089){var _0x376ec1=function(_0x6a0d59){while(--_0x6a0d59){_0x1dde5d['push'](_0x1dde5d['shift']());}};_0x376ec1(++_0x433089);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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/teams',auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['post'](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x11')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller['addAgents']);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0xd')](),controller['update']);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth['isAuthenticated'](),controller[_0x0a9e('0x18')]);router['delete'](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);module[_0x0a9e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index a8cc995..f63da13 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 _0xfc20=['beepall','sequelize','name','INTEGER','ENUM','rrmemory'];(function(_0x1ebe90,_0x5d29fc){var _0x447c82=function(_0x1c2646){while(--_0x1c2646){_0x1ebe90['push'](_0x1ebe90['shift']());}};_0x447c82(++_0x5d29fc);}(_0xfc20,0x12d));var _0x0fc2=function(_0x481422,_0x31ed9b){_0x481422=_0x481422-0x0;var _0x280a3a=_0xfc20[_0x481422];return _0x280a3a;};'use strict';var Sequelize=require(_0x0fc2('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x0fc2('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x0fc2('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0fc2('0x3')](_0x0fc2('0x4'),_0x0fc2('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x2f5e=['rrmemory','beepall','exports','STRING','INTEGER','ENUM'];(function(_0x5709e3,_0x3449a2){var _0x5e3262=function(_0x4b0b6f){while(--_0x4b0b6f){_0x5709e3['push'](_0x5709e3['shift']());}};_0x5e3262(++_0x3449a2);}(_0x2f5e,0xe0));var _0xe2f5=function(_0x55448c,_0x174be9){_0x55448c=_0x55448c-0x0;var _0x3b6b3a=_0x2f5e[_0x55448c];return _0x3b6b3a;};'use strict';var Sequelize=require('sequelize');module[_0xe2f5('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe2f5('0x1')]},'timeout':{'type':Sequelize[_0xe2f5('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe2f5('0x3')](_0xe2f5('0x4'),_0xe2f5('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index e7eb9b7..1f85b5d 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 _0x671a=['field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','push','QueryTypes','SELECT','includes','all','union','compact','value','transaction','isEmpty','removeAgents','forEach','emit','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','zip-dir','request-promise','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/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','then','get','OpenchannelQueues','UserProfileResource','sendStatus','error','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','name','OpenchannelQueue','includeAll','include','findAll','show','params','keys','options','find','create','body','user','role','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','nolimit','OpenchannelQueueId','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','rows','format','getTeams','Team','order','ids','Agents','online','interface','sequelize','each','findOrCreate','userOpenchannelQueue:save','removeTeams','select'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x671a,0x139));var _0xa671=function(_0x2ee20d,_0x354e70){_0x2ee20d=_0x2ee20d-0x0;var _0xade530=_0x671a[_0x2ee20d];return _0xade530;};'use strict';var pdf=require(_0xa671('0x0'));var emlformat=require(_0xa671('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa671('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa671('0x3'));var moment=require('moment');var BPromise=require(_0xa671('0x4'));var Mustache=require(_0xa671('0x5'));var util=require(_0xa671('0x6'));var path=require(_0xa671('0x7'));var sox=require(_0xa671('0x8'));var csv=require(_0xa671('0x9'));var ejs=require(_0xa671('0xa'));var fs=require('fs');var fs_extra=require(_0xa671('0xb'));var _=require(_0xa671('0xc'));var squel=require(_0xa671('0xd'));var crypto=require('crypto');var jsforce=require(_0xa671('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa671('0x9'));var querystring=require(_0xa671('0xf'));var Papa=require(_0xa671('0x10'));var Redis=require(_0xa671('0x11'));var authService=require(_0xa671('0x12'));var qs=require(_0xa671('0x13'));var as=require(_0xa671('0x14'));var hardwareService=require(_0xa671('0x15'));var logger=require(_0xa671('0x16'))(_0xa671('0x17'));var utils=require('../../config/utils');var config=require(_0xa671('0x18'));var licenseUtil=require(_0xa671('0x19'));var db=require(_0xa671('0x1a'))['db'];config[_0xa671('0x1b')]=_[_0xa671('0x1c')](config[_0xa671('0x1b')],{'host':_0xa671('0x1d'),'port':0x18eb});var socket=require(_0xa671('0x1e'))(new Redis(config[_0xa671('0x1b')]));require('./openchannelQueue.socket')[_0xa671('0x1f')](socket);function respondWithStatusCode(_0x3811af,_0x46939b){_0x46939b=_0x46939b||0xcc;return function(_0x51cfaa){if(_0x51cfaa){return _0x3811af['sendStatus'](_0x46939b);}return _0x3811af[_0xa671('0x20')](_0x46939b)[_0xa671('0x21')]();};}function respondWithResult(_0x3ded1a,_0x2dae44){_0x2dae44=_0x2dae44||0xc8;return function(_0x3582b3){if(_0x3582b3){return _0x3ded1a[_0xa671('0x20')](_0x2dae44)[_0xa671('0x22')](_0x3582b3);}};}function respondWithFilteredResult(_0x368a41,_0x2c08b0){return function(_0x3bbddc){if(_0x3bbddc){var _0x433d01=_0x3bbddc[_0xa671('0x23')],_0x116d8b=_0x2c08b0['offset'],_0x23b61f=_0x2c08b0[_0xa671('0x24')]+_0x2c08b0['limit'],_0x15e85a;if(_0x23b61f>=_0x433d01){_0x23b61f=_0x433d01;_0x15e85a=0xc8;}else{_0x15e85a=0xce;}_0x368a41[_0xa671('0x20')](_0x15e85a);return _0x368a41[_0xa671('0x25')](_0xa671('0x26'),_0x116d8b+'-'+_0x23b61f+'/'+_0x433d01)['json'](_0x3bbddc);}return null;};}function patchUpdates(_0x2ce889){return function(_0x48148b){try{jsonpatch['apply'](_0x48148b,_0x2ce889,!![]);}catch(_0x2144f4){return BPromise[_0xa671('0x27')](_0x2144f4);}return _0x48148b[_0xa671('0x28')]();};}function saveUpdates(_0xa77dad,_0x2b953c){return function(_0x3fdf63){if(_0x3fdf63){return _0x3fdf63[_0xa671('0x29')](_0xa77dad)['then'](function(_0x22e6e6){return _0x22e6e6;});}return null;};}function removeEntity(_0x44ed80,_0x6a9d7f){return function(_0x43ebba){if(_0x43ebba){return _0x43ebba[_0xa671('0x2a')]()[_0xa671('0x2b')](function(){var _0x446a7d=_0x43ebba[_0xa671('0x2c')]({'plain':!![]});var _0x503934=_0xa671('0x2d');return db[_0xa671('0x2e')][_0xa671('0x2a')]({'where':{'type':_0x503934,'resourceId':_0x446a7d['id']}})[_0xa671('0x2b')](function(){return _0x43ebba;});})[_0xa671('0x2b')](function(){_0x44ed80[_0xa671('0x20')](0xcc)[_0xa671('0x21')]();});}};}function handleEntityNotFound(_0x3fdc17,_0x3f4e66){return function(_0x39ffe9){if(!_0x39ffe9){_0x3fdc17[_0xa671('0x2f')](0x194);}return _0x39ffe9;};}function handleError(_0x1b5551,_0x35e126){_0x35e126=_0x35e126||0x1f4;return function(_0x496da4){logger[_0xa671('0x30')](_0x496da4['stack']);if(_0x496da4['name']){delete _0x496da4['name'];}_0x1b5551[_0xa671('0x20')](_0x35e126)[_0xa671('0x31')](_0x496da4);};}exports[_0xa671('0x32')]=function(_0x3e9d81,_0x471574){var _0x283780={},_0x35883b={},_0x32bfad={'count':0x0,'rows':[]};var _0x3d622e=_[_0xa671('0x33')](db['OpenchannelQueue'][_0xa671('0x34')],function(_0x2d2285){return{'name':_0x2d2285[_0xa671('0x35')],'type':_0x2d2285[_0xa671('0x36')]['key']};});_0x35883b[_0xa671('0x37')]=_[_0xa671('0x33')](_0x3d622e,'name');_0x35883b['query']=_['keys'](_0x3e9d81[_0xa671('0x38')]);_0x35883b[_0xa671('0x39')]=_[_0xa671('0x3a')](_0x35883b['model'],_0x35883b[_0xa671('0x38')]);_0x283780[_0xa671('0x3b')]=_[_0xa671('0x3a')](_0x35883b['model'],qs[_0xa671('0x3c')](_0x3e9d81[_0xa671('0x38')]['fields']));_0x283780[_0xa671('0x3b')]=_0x283780['attributes'][_0xa671('0x3d')]?_0x283780[_0xa671('0x3b')]:_0x35883b[_0xa671('0x37')];if(!_0x3e9d81['query'][_0xa671('0x3e')]('nolimit')){_0x283780[_0xa671('0x3f')]=qs[_0xa671('0x3f')](_0x3e9d81['query']['limit']);_0x283780[_0xa671('0x24')]=qs['offset'](_0x3e9d81['query']['offset']);}_0x283780['order']=qs['sort'](_0x3e9d81[_0xa671('0x38')][_0xa671('0x40')]);_0x283780[_0xa671('0x41')]=qs[_0xa671('0x39')](_[_0xa671('0x42')](_0x3e9d81[_0xa671('0x38')],_0x35883b[_0xa671('0x39')]),_0x3d622e);if(_0x3e9d81[_0xa671('0x38')][_0xa671('0x43')]){_0x283780[_0xa671('0x41')]=_[_0xa671('0x44')](_0x283780[_0xa671('0x41')],{'$or':_['map'](_0x3d622e,function(_0x443e4c){if(_0x443e4c[_0xa671('0x36')]!==_0xa671('0x45')){var _0x23e355={};_0x23e355[_0x443e4c[_0xa671('0x46')]]={'$like':'%'+_0x3e9d81[_0xa671('0x38')]['filter']+'%'};return _0x23e355;}})});}_0x283780=_['merge']({},_0x283780,_0x3e9d81['options']);var _0xa20be2={'where':_0x283780[_0xa671('0x41')]};return db[_0xa671('0x47')][_0xa671('0x23')](_0xa20be2)[_0xa671('0x2b')](function(_0x1e0042){_0x32bfad[_0xa671('0x23')]=_0x1e0042;if(_0x3e9d81[_0xa671('0x38')][_0xa671('0x48')]){_0x283780[_0xa671('0x49')]=[{'all':!![]}];}return db[_0xa671('0x47')][_0xa671('0x4a')](_0x283780);})[_0xa671('0x2b')](function(_0x3b9567){_0x32bfad['rows']=_0x3b9567;return _0x32bfad;})[_0xa671('0x2b')](respondWithFilteredResult(_0x471574,_0x283780))['catch'](handleError(_0x471574,null));};exports[_0xa671('0x4b')]=function(_0x2eea88,_0x1fc8d4){var _0x480938={'raw':!![],'where':{'id':_0x2eea88[_0xa671('0x4c')]['id']}},_0x1214cd={};_0x1214cd['model']=_[_0xa671('0x4d')](db['OpenchannelQueue'][_0xa671('0x34')]);_0x1214cd[_0xa671('0x38')]=_[_0xa671('0x4d')](_0x2eea88['query']);_0x1214cd[_0xa671('0x39')]=_[_0xa671('0x3a')](_0x1214cd['model'],_0x1214cd[_0xa671('0x38')]);_0x480938[_0xa671('0x3b')]=_['intersection'](_0x1214cd[_0xa671('0x37')],qs[_0xa671('0x3c')](_0x2eea88[_0xa671('0x38')][_0xa671('0x3c')]));_0x480938[_0xa671('0x3b')]=_0x480938['attributes'][_0xa671('0x3d')]?_0x480938['attributes']:_0x1214cd['model'];if(_0x2eea88[_0xa671('0x38')][_0xa671('0x48')]){_0x480938[_0xa671('0x49')]=[{'all':!![]}];}_0x480938=_[_0xa671('0x44')]({},_0x480938,_0x2eea88[_0xa671('0x4e')]);return db[_0xa671('0x47')][_0xa671('0x4f')](_0x480938)[_0xa671('0x2b')](handleEntityNotFound(_0x1fc8d4,null))[_0xa671('0x2b')](respondWithResult(_0x1fc8d4,null))['catch'](handleError(_0x1fc8d4,null));};exports[_0xa671('0x50')]=function(_0x2b26e5,_0x20ce73){return db[_0xa671('0x47')]['create'](_0x2b26e5[_0xa671('0x51')],{})[_0xa671('0x2b')](function(_0x208c7b){var _0x39d215=_0x2b26e5[_0xa671('0x52')][_0xa671('0x2c')]({'plain':!![]});if(!_0x39d215)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39d215[_0xa671('0x53')]===_0xa671('0x52')){var _0x2ce33c=_0x208c7b[_0xa671('0x2c')]({'plain':!![]});var _0x3e12fc=_0xa671('0x2d');return db['UserProfileSection'][_0xa671('0x4f')]({'where':{'name':_0x3e12fc,'userProfileId':_0x39d215[_0xa671('0x54')]},'raw':!![]})[_0xa671('0x2b')](function(_0x1b63f6){if(_0x1b63f6&&_0x1b63f6[_0xa671('0x55')]===0x0){return db[_0xa671('0x2e')][_0xa671('0x50')]({'name':_0x2ce33c[_0xa671('0x46')],'resourceId':_0x2ce33c['id'],'type':_0x1b63f6[_0xa671('0x46')],'sectionId':_0x1b63f6['id']},{})[_0xa671('0x2b')](function(){return _0x208c7b;});}else{return _0x208c7b;}})[_0xa671('0x56')](function(_0x3bde85){logger[_0xa671('0x30')](_0xa671('0x57'),_0x3bde85);throw _0x3bde85;});}return _0x208c7b;})[_0xa671('0x2b')](respondWithResult(_0x20ce73,0xc9))['catch'](handleError(_0x20ce73,null));};exports[_0xa671('0x29')]=function(_0xdb4b47,_0x16cefc){if(_0xdb4b47[_0xa671('0x51')]['id']){delete _0xdb4b47[_0xa671('0x51')]['id'];}return db['OpenchannelQueue'][_0xa671('0x4f')]({'where':{'id':_0xdb4b47[_0xa671('0x4c')]['id']}})[_0xa671('0x2b')](handleEntityNotFound(_0x16cefc,null))[_0xa671('0x2b')](saveUpdates(_0xdb4b47[_0xa671('0x51')],null))[_0xa671('0x2b')](respondWithResult(_0x16cefc,null))[_0xa671('0x56')](handleError(_0x16cefc,null));};exports[_0xa671('0x2a')]=function(_0x1479c7,_0x2d167d){return db['OpenchannelQueue'][_0xa671('0x4f')]({'where':{'id':_0x1479c7[_0xa671('0x4c')]['id']}})[_0xa671('0x2b')](handleEntityNotFound(_0x2d167d,null))[_0xa671('0x2b')](removeEntity(_0x2d167d,null))[_0xa671('0x56')](handleError(_0x2d167d,null));};exports['describe']=function(_0x4782e4,_0x56cb30){return db[_0xa671('0x47')][_0xa671('0x58')]()[_0xa671('0x2b')](respondWithResult(_0x56cb30,null))['catch'](handleError(_0x56cb30,null));};exports[_0xa671('0x59')]=function(_0x5688ba,_0x4af4b8,_0x1668ea){var _0x6160f2={'raw':!![],'where':{}},_0x54143d={},_0x3914f4;return db[_0xa671('0x47')][_0xa671('0x5a')]({'where':{'id':_0x5688ba['params']['id']}})[_0xa671('0x2b')](handleEntityNotFound(_0x4af4b8,null))[_0xa671('0x2b')](function(_0x31a040){if(_0x31a040){_0x3914f4=_0x31a040['get']({'plain':!![]});_0x54143d[_0xa671('0x37')]=_[_0xa671('0x4d')](db['UserOpenchannelQueue'][_0xa671('0x34')]);_0x54143d[_0xa671('0x38')]=_[_0xa671('0x4d')](_0x5688ba[_0xa671('0x38')]);_0x54143d[_0xa671('0x39')]=_[_0xa671('0x3a')](_0x54143d[_0xa671('0x37')],_0x54143d[_0xa671('0x38')]);_0x6160f2[_0xa671('0x3b')]=_['intersection'](_0x54143d[_0xa671('0x37')],qs[_0xa671('0x3c')](_0x5688ba[_0xa671('0x38')]['fields']));_0x6160f2[_0xa671('0x3b')]=_0x6160f2['attributes'][_0xa671('0x3d')]?_0x6160f2[_0xa671('0x3b')]:_0x54143d[_0xa671('0x37')];if(!_0x5688ba[_0xa671('0x38')][_0xa671('0x3e')](_0xa671('0x5b'))){_0x6160f2[_0xa671('0x3f')]=qs[_0xa671('0x3f')](_0x5688ba[_0xa671('0x38')][_0xa671('0x3f')]);_0x6160f2[_0xa671('0x24')]=qs[_0xa671('0x24')](_0x5688ba[_0xa671('0x38')][_0xa671('0x24')]);}_0x6160f2['order']=qs[_0xa671('0x40')](_0x5688ba['query'][_0xa671('0x40')]);_0x6160f2[_0xa671('0x41')]=qs[_0xa671('0x39')](_['pick'](_0x5688ba['query'],_0x54143d[_0xa671('0x39')]));_0x6160f2[_0xa671('0x41')][_0xa671('0x5c')]=_0x31a040['id'];if(_0x5688ba[_0xa671('0x38')]['filter']){_0x6160f2['where']=_[_0xa671('0x44')](_0x6160f2[_0xa671('0x41')],{'$or':_[_0xa671('0x33')](_0x6160f2['attributes'],function(_0x1ef408){var _0x14a82d={};_0x14a82d[_0x1ef408]={'$like':'%'+_0x5688ba[_0xa671('0x38')][_0xa671('0x43')]+'%'};return _0x14a82d;})});}_0x6160f2=_[_0xa671('0x44')]({},_0x6160f2,_0x5688ba['options']);return db[_0xa671('0x5d')][_0xa671('0x4a')](_0x6160f2);}})['then'](function(_0x3fa741){if(_0x3fa741){return db[_0xa671('0x5e')][_0xa671('0x5f')]({'where':{'id':_[_0xa671('0x33')](_0x3fa741,_0xa671('0x60')),'role':_0xa671('0x61')},'attributes':['id','name',_0xa671('0x62'),_0xa671('0x63'),_0xa671('0x64')]});}})[_0xa671('0x2b')](function(_0x495198){if(_0x495198){return{'count':_0x495198[_0xa671('0x23')],'rows':_['map'](_0x495198[_0xa671('0x65')],function(_0x25e55b){return{'membername':_0x25e55b[_0xa671('0x46')],'UserId':_0x25e55b['id'],'queue_name':_0x3914f4['name'],'OpenchannelQueueId':_0x3914f4['id'],'interface':util[_0xa671('0x66')]('%s/%s','SIP',_0x25e55b[_0xa671('0x46')]),'penalty':0x0,'paused':_0x25e55b[_0xa671('0x62')],'createdAt':_0x25e55b[_0xa671('0x64')],'updatedAt':_0x25e55b[_0xa671('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4af4b8,_0x6160f2))[_0xa671('0x56')](handleError(_0x4af4b8,null));};exports[_0xa671('0x67')]=function(_0x3c6ced,_0x13a172,_0x5cb19){var _0x52b582={};var _0x36adf0={};var _0x31234e;var _0x428fe3;return db[_0xa671('0x47')]['findOne']({'where':{'id':_0x3c6ced[_0xa671('0x4c')]['id']}})[_0xa671('0x2b')](handleEntityNotFound(_0x13a172,null))[_0xa671('0x2b')](function(_0x3fd111){if(_0x3fd111){_0x31234e=_0x3fd111;_0x36adf0[_0xa671('0x37')]=_[_0xa671('0x4d')](db[_0xa671('0x68')][_0xa671('0x34')]);_0x36adf0[_0xa671('0x38')]=_[_0xa671('0x4d')](_0x3c6ced[_0xa671('0x38')]);_0x36adf0['filters']=_['intersection'](_0x36adf0['model'],_0x36adf0[_0xa671('0x38')]);_0x52b582[_0xa671('0x3b')]=_[_0xa671('0x3a')](_0x36adf0[_0xa671('0x37')],qs['fields'](_0x3c6ced[_0xa671('0x38')]['fields']));_0x52b582[_0xa671('0x3b')]=_0x52b582[_0xa671('0x3b')][_0xa671('0x3d')]?_0x52b582[_0xa671('0x3b')]:_0x36adf0['model'];_0x52b582[_0xa671('0x69')]=qs[_0xa671('0x40')](_0x3c6ced[_0xa671('0x38')][_0xa671('0x40')]);_0x52b582[_0xa671('0x41')]=qs[_0xa671('0x39')](_[_0xa671('0x42')](_0x3c6ced['query'],_0x36adf0['filters']));if(_0x3c6ced[_0xa671('0x38')]['filter']){_0x52b582['where']=_[_0xa671('0x44')](_0x52b582[_0xa671('0x41')],{'$or':_[_0xa671('0x33')](_0x52b582[_0xa671('0x3b')],function(_0x8c05aa){var _0x3e712e={};_0x3e712e[_0x8c05aa]={'$like':'%'+_0x3c6ced[_0xa671('0x38')][_0xa671('0x43')]+'%'};return _0x3e712e;})});}_0x52b582=_[_0xa671('0x44')]({},_0x52b582,_0x3c6ced['options']);return _0x31234e[_0xa671('0x67')](_0x52b582);}})[_0xa671('0x2b')](function(_0x4da0f3){if(_0x4da0f3){_0x428fe3=_0x4da0f3[_0xa671('0x3d')];if(!_0x3c6ced['query']['hasOwnProperty'](_0xa671('0x5b'))){_0x52b582[_0xa671('0x3f')]=qs[_0xa671('0x3f')](_0x3c6ced[_0xa671('0x38')][_0xa671('0x3f')]);_0x52b582['offset']=qs[_0xa671('0x24')](_0x3c6ced[_0xa671('0x38')]['offset']);}return _0x31234e['getTeams'](_0x52b582);}})[_0xa671('0x2b')](function(_0x83db20){if(_0x83db20){return _0x83db20?{'count':_0x428fe3,'rows':_0x83db20}:null;}})[_0xa671('0x2b')](respondWithResult(_0x13a172,null))['catch'](handleError(_0x13a172,null));};exports['addTeams']=function(_0x2569d1,_0x30b96a,_0x2f62dc){var _0x19fbfa=_0x2569d1[_0xa671('0x51')][_0xa671('0x6a')];return db['Team']['findAll']({'where':{'id':_0x19fbfa},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa671('0x6b'),'attributes':['id',_0xa671('0x46'),_0xa671('0x6c'),'voicePause',_0xa671('0x6d')],'raw':!![]}]})[_0xa671('0x2b')](function(_0x4e9b3b){if(_0x4e9b3b){var _0x2a9004=_['flatMap'](_0x4e9b3b,function(_0x2f33f7){var _0x3f0d45=_0x2f33f7[_0xa671('0x2c')]({'plain':!![]});return _0x3f0d45[_0xa671('0x6b')];});return db['OpenchannelQueue'][_0xa671('0x4f')]({'where':{'id':_0x2569d1[_0xa671('0x4c')]['id']}})[_0xa671('0x2b')](function(_0x290169){return db[_0xa671('0x6e')]['transaction'](function(_0x378334){return _0x290169['addTeams'](_0x19fbfa,{'transaction':_0x378334})['then'](function(){return BPromise[_0xa671('0x6f')](_0x2a9004,function(_0x56532d){return db['UserOpenchannelQueue'][_0xa671('0x70')]({'where':{'UserId':_0x56532d['id'],'OpenchannelQueueId':_0x2569d1[_0xa671('0x4c')]['id']},'transaction':_0x378334});});})[_0xa671('0x2b')](function(){_0x2a9004['forEach'](function(_0x35e8e5){socket['emit'](_0xa671('0x71'),{'UserId':_0x35e8e5['id'],'OpenchannelQueueId':_0x290169['id']});});});});});}})[_0xa671('0x2b')](respondWithStatusCode(_0x30b96a,null))['catch'](handleError(_0x30b96a,null));};exports[_0xa671('0x72')]=function(_0x2e5486,_0x9b276b,_0x40f6f6){return db[_0xa671('0x68')][_0xa671('0x4a')]({'where':{'id':_0x2e5486[_0xa671('0x38')][_0xa671('0x6a')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa671('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xa671('0x2b')](handleEntityNotFound(_0x9b276b,null))['then'](function(_0x21bd2b){var _0x48f3f2=_['map'](_0x21bd2b,'id');var _0x39629e=[];var _0x3b0f06=[];var _0x1c6e0f=squel[_0xa671('0x73')]();_0x1c6e0f[_0xa671('0x74')](_0xa671('0x75'))[_0xa671('0x76')](_0xa671('0x77'),'tq')[_0xa671('0x78')](_0xa671('0x79'),'ut',_0xa671('0x7a'))[_0xa671('0x41')](_0xa671('0x7b'),_0x2e5486[_0xa671('0x4c')]['id']);for(var _0x4c3931=0x0;_0x4c3931<_0x21bd2b[_0xa671('0x3d')];_0x4c3931+=0x1){let _0x521a42=_0x21bd2b[_0x4c3931];for(var _0x734d8c=0x0;_0x734d8c<_0x521a42['Agents'][_0xa671('0x3d')];_0x734d8c+=0x1){let _0x3207d3=_0x521a42[_0xa671('0x6b')][_0x734d8c];var _0x1f5eff=_0x1c6e0f['clone']();_0x1f5eff[_0xa671('0x41')]('ut.UserId\x20=\x20?',_0x3207d3['id']);_0x3b0f06[_0xa671('0x7c')](db[_0xa671('0x6e')][_0xa671('0x38')](_0x1f5eff['toString'](),{'type':db[_0xa671('0x6e')][_0xa671('0x7d')][_0xa671('0x7e')]})['then'](function(_0x86f514){if(_0x86f514['length']===0x1){return _0x3207d3['id'];}else{var _0x5e629e=_['every'](_[_0xa671('0x33')](_0x86f514,'TeamId'),function(_0x1c5601){return _[_0xa671('0x7f')](_0x48f3f2,_0x1c5601);});if(_0x5e629e){return _0x3207d3['id'];}}}));}}return BPromise[_0xa671('0x80')](_0x3b0f06)[_0xa671('0x2b')](function(_0x4bd9bc){_0x39629e=_(_0x39629e)[_0xa671('0x81')](_0x4bd9bc)[_0xa671('0x82')]()[_0xa671('0x83')]();return db[_0xa671('0x47')][_0xa671('0x4f')]({'where':{'id':_0x2e5486[_0xa671('0x4c')]['id']}})[_0xa671('0x2b')](function(_0x55b5e5){return db[_0xa671('0x6e')][_0xa671('0x84')](function(_0x5f511e){return _0x55b5e5[_0xa671('0x72')](_0x2e5486[_0xa671('0x38')]['ids'],{'transaction':_0x5f511e})[_0xa671('0x2b')](function(){if(!_[_0xa671('0x85')](_0x39629e)){return _0x55b5e5[_0xa671('0x86')](_0x39629e,{'transaction':_0x5f511e});}})['then'](function(){_0x39629e[_0xa671('0x87')](function(_0x43ad72){socket[_0xa671('0x88')](_0xa671('0x89'),{'UserId':_0x43ad72,'OpenchannelQueueId':_0x55b5e5['id']});});});});});});})[_0xa671('0x2b')](respondWithStatusCode(_0x9b276b,null))['catch'](handleError(_0x9b276b,null));};exports[_0xa671('0x8a')]=function(_0x2290a2,_0x3ca018,_0x5a1dde){return db[_0xa671('0x47')][_0xa671('0x4f')]({'where':{'id':_0x2290a2[_0xa671('0x4c')]['id']}})[_0xa671('0x2b')](handleEntityNotFound(_0x3ca018,null))[_0xa671('0x2b')](function(_0x3fc316){if(_0x3fc316){return _0x3fc316['addAgents'](_0x2290a2[_0xa671('0x51')][_0xa671('0x6a')],_[_0xa671('0x8b')](_0x2290a2[_0xa671('0x51')],[_0xa671('0x6a'),'id'])||{})[_0xa671('0x8c')](function(_0x4472eb){for(var _0xc29d67=0x0;_0xc29d67<_0x2290a2[_0xa671('0x51')][_0xa671('0x6a')]['length'];_0xc29d67+=0x1){socket[_0xa671('0x88')]('userOpenchannelQueue:save',{'UserId':_0x2290a2[_0xa671('0x51')][_0xa671('0x6a')][_0xc29d67],'OpenchannelQueueId':_0x2290a2[_0xa671('0x4c')]['id']});}return _0x4472eb;});}})[_0xa671('0x2b')](respondWithResult(_0x3ca018,null))['catch'](handleError(_0x3ca018,null));};exports[_0xa671('0x86')]=function(_0x5d963d,_0x128e77,_0x38112c){return db[_0xa671('0x47')][_0xa671('0x4f')]({'where':{'id':_0x5d963d['params']['id']}})[_0xa671('0x2b')](handleEntityNotFound(_0x128e77,null))[_0xa671('0x2b')](function(_0x36fb7a){if(_0x36fb7a){return _0x36fb7a[_0xa671('0x86')](_0x5d963d['query']['ids'])[_0xa671('0x2b')](function(){if(_[_0xa671('0x8d')](_0x5d963d['query'][_0xa671('0x6a')])){for(var _0x12d7c5=0x0;_0x12d7c5<_0x5d963d['query'][_0xa671('0x6a')][_0xa671('0x3d')];_0x12d7c5+=0x1){socket[_0xa671('0x88')]('userOpenchannelQueue:remove',{'UserId':Number(_0x5d963d[_0xa671('0x38')][_0xa671('0x6a')][_0x12d7c5]),'OpenchannelQueueId':Number(_0x5d963d[_0xa671('0x4c')]['id'])});}}else{socket[_0xa671('0x88')](_0xa671('0x89'),{'UserId':Number(_0x5d963d['query'][_0xa671('0x6a')]),'OpenchannelQueueId':Number(_0x5d963d[_0xa671('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x128e77,null))[_0xa671('0x56')](handleError(_0x128e77,null));};exports[_0xa671('0x8e')]=function(_0x1b2142,_0x2d8d38,_0x6364dd){var _0x523cb9={};var _0x47cc64={};var _0x16227a;var _0x468d09;return db['OpenchannelQueue'][_0xa671('0x5a')]({'where':{'id':_0x1b2142['params']['id']}})[_0xa671('0x2b')](handleEntityNotFound(_0x2d8d38,null))[_0xa671('0x2b')](function(_0x5c2007){if(_0x5c2007){_0x16227a=_0x5c2007;_0x47cc64[_0xa671('0x37')]=_[_0xa671('0x4d')](db['User']['rawAttributes']);_0x47cc64[_0xa671('0x38')]=_[_0xa671('0x4d')](_0x1b2142[_0xa671('0x38')]);_0x47cc64['filters']=_['intersection'](_0x47cc64[_0xa671('0x37')],_0x47cc64['query']);_0x523cb9['attributes']=_[_0xa671('0x3a')](_0x47cc64['model'],qs[_0xa671('0x3c')](_0x1b2142[_0xa671('0x38')][_0xa671('0x3c')]));_0x523cb9[_0xa671('0x3b')]=_0x523cb9[_0xa671('0x3b')][_0xa671('0x3d')]?_0x523cb9['attributes']:_0x47cc64[_0xa671('0x37')];_0x523cb9[_0xa671('0x69')]=qs[_0xa671('0x40')](_0x1b2142[_0xa671('0x38')]['sort']);_0x523cb9[_0xa671('0x41')]=qs['filters'](_[_0xa671('0x42')](_0x1b2142[_0xa671('0x38')],_0x47cc64[_0xa671('0x39')]));if(_0x1b2142[_0xa671('0x38')][_0xa671('0x43')]){_0x523cb9['where']=_[_0xa671('0x44')](_0x523cb9[_0xa671('0x41')],{'$or':_[_0xa671('0x33')](_0x523cb9[_0xa671('0x3b')],function(_0x37bd67){var _0x2e8b9b={};_0x2e8b9b[_0x37bd67]={'$like':'%'+_0x1b2142[_0xa671('0x38')][_0xa671('0x43')]+'%'};return _0x2e8b9b;})});}_0x523cb9=_[_0xa671('0x44')]({},_0x523cb9,_0x1b2142[_0xa671('0x4e')]);return _0x16227a[_0xa671('0x8e')](_0x523cb9);}})['then'](function(_0x51a5fe){if(_0x51a5fe){_0x468d09=_0x51a5fe[_0xa671('0x3d')];if(!_0x1b2142[_0xa671('0x38')][_0xa671('0x3e')](_0xa671('0x5b'))){_0x523cb9[_0xa671('0x3f')]=qs['limit'](_0x1b2142['query'][_0xa671('0x3f')]);_0x523cb9['offset']=qs['offset'](_0x1b2142[_0xa671('0x38')][_0xa671('0x24')]);}return _0x16227a[_0xa671('0x8e')](_0x523cb9);}})[_0xa671('0x2b')](function(_0x5f1d64){if(_0x5f1d64){return _0x5f1d64?{'count':_0x468d09,'rows':_0x5f1d64}:null;}})[_0xa671('0x2b')](respondWithResult(_0x2d8d38,null))[_0xa671('0x56')](handleError(_0x2d8d38,null));}; \ No newline at end of file +var _0xfff8=['then','destroy','get','OpenchannelQueues','UserProfileResource','stack','name','send','fieldName','type','key','map','keys','query','filters','intersection','attributes','model','length','nolimit','order','sort','where','pick','filter','merge','options','OpenchannelQueue','include','findAll','rows','catch','show','rawAttributes','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMembers','UserOpenchannelQueue','hasOwnProperty','OpenchannelQueueId','User','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','forEach','emit','userOpenchannelQueue:save','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','findOne','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update'];(function(_0x3cd93c,_0x352f49){var _0x138608=function(_0x405d25){while(--_0x405d25){_0x3cd93c['push'](_0x3cd93c['shift']());}};_0x138608(++_0x352f49);}(_0xfff8,0xf6));var _0x8fff=function(_0x952182,_0x331364){_0x952182=_0x952182-0x0;var _0x3accf0=_0xfff8[_0x952182];return _0x3accf0;};'use strict';var pdf=require(_0x8fff('0x0'));var emlformat=require(_0x8fff('0x1'));var rimraf=require(_0x8fff('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8fff('0x3'));var rp=require(_0x8fff('0x4'));var moment=require(_0x8fff('0x5'));var BPromise=require(_0x8fff('0x6'));var Mustache=require(_0x8fff('0x7'));var util=require(_0x8fff('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x8fff('0x9'));var ejs=require(_0x8fff('0xa'));var fs=require('fs');var fs_extra=require(_0x8fff('0xb'));var _=require('lodash');var squel=require(_0x8fff('0xc'));var crypto=require(_0x8fff('0xd'));var jsforce=require(_0x8fff('0xe'));var deskjs=require(_0x8fff('0xf'));var toCsv=require(_0x8fff('0x9'));var querystring=require(_0x8fff('0x10'));var Papa=require(_0x8fff('0x11'));var Redis=require(_0x8fff('0x12'));var authService=require(_0x8fff('0x13'));var qs=require(_0x8fff('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8fff('0x15'))('api');var utils=require(_0x8fff('0x16'));var config=require(_0x8fff('0x17'));var licenseUtil=require(_0x8fff('0x18'));var db=require('../../mysqldb')['db'];config[_0x8fff('0x19')]=_[_0x8fff('0x1a')](config[_0x8fff('0x19')],{'host':_0x8fff('0x1b'),'port':0x18eb});var socket=require(_0x8fff('0x1c'))(new Redis(config[_0x8fff('0x19')]));require(_0x8fff('0x1d'))[_0x8fff('0x1e')](socket);function respondWithStatusCode(_0x912a3,_0x440f7e){_0x440f7e=_0x440f7e||0xcc;return function(_0x70049c){if(_0x70049c){return _0x912a3[_0x8fff('0x1f')](_0x440f7e);}return _0x912a3[_0x8fff('0x20')](_0x440f7e)[_0x8fff('0x21')]();};}function respondWithResult(_0x460b61,_0x217e57){_0x217e57=_0x217e57||0xc8;return function(_0x52068d){if(_0x52068d){return _0x460b61[_0x8fff('0x20')](_0x217e57)[_0x8fff('0x22')](_0x52068d);}};}function respondWithFilteredResult(_0x823e40,_0x43dcd3){return function(_0x427858){if(_0x427858){var _0x53e269=_0x427858[_0x8fff('0x23')],_0x46915c=_0x43dcd3[_0x8fff('0x24')],_0x5d375a=_0x43dcd3[_0x8fff('0x24')]+_0x43dcd3[_0x8fff('0x25')],_0x19dce2;if(_0x5d375a>=_0x53e269){_0x5d375a=_0x53e269;_0x19dce2=0xc8;}else{_0x19dce2=0xce;}_0x823e40[_0x8fff('0x20')](_0x19dce2);return _0x823e40[_0x8fff('0x26')](_0x8fff('0x27'),_0x46915c+'-'+_0x5d375a+'/'+_0x53e269)[_0x8fff('0x22')](_0x427858);}return null;};}function patchUpdates(_0x310748){return function(_0x293267){try{jsonpatch['apply'](_0x293267,_0x310748,!![]);}catch(_0x10e1e1){return BPromise['reject'](_0x10e1e1);}return _0x293267[_0x8fff('0x28')]();};}function saveUpdates(_0xe10f5d,_0x3293e0){return function(_0x57134c){if(_0x57134c){return _0x57134c[_0x8fff('0x29')](_0xe10f5d)[_0x8fff('0x2a')](function(_0x3f2a05){return _0x3f2a05;});}return null;};}function removeEntity(_0x35390a,_0x426c13){return function(_0x1af9aa){if(_0x1af9aa){return _0x1af9aa[_0x8fff('0x2b')]()['then'](function(){var _0x2c04c2=_0x1af9aa[_0x8fff('0x2c')]({'plain':!![]});var _0x3bf90a=_0x8fff('0x2d');return db[_0x8fff('0x2e')]['destroy']({'where':{'type':_0x3bf90a,'resourceId':_0x2c04c2['id']}})[_0x8fff('0x2a')](function(){return _0x1af9aa;});})[_0x8fff('0x2a')](function(){_0x35390a[_0x8fff('0x20')](0xcc)[_0x8fff('0x21')]();});}};}function handleEntityNotFound(_0x399791,_0x47a966){return function(_0x14f9cc){if(!_0x14f9cc){_0x399791[_0x8fff('0x1f')](0x194);}return _0x14f9cc;};}function handleError(_0x32c47a,_0x29bcc8){_0x29bcc8=_0x29bcc8||0x1f4;return function(_0x2def7e){logger['error'](_0x2def7e[_0x8fff('0x2f')]);if(_0x2def7e[_0x8fff('0x30')]){delete _0x2def7e['name'];}_0x32c47a['status'](_0x29bcc8)[_0x8fff('0x31')](_0x2def7e);};}exports['index']=function(_0x53791d,_0x307091){var _0xfee4ba={},_0x2275da={},_0x1132a9={'count':0x0,'rows':[]};var _0x3cfb23=_['map'](db['OpenchannelQueue']['rawAttributes'],function(_0x35a66c){return{'name':_0x35a66c[_0x8fff('0x32')],'type':_0x35a66c[_0x8fff('0x33')][_0x8fff('0x34')]};});_0x2275da['model']=_[_0x8fff('0x35')](_0x3cfb23,_0x8fff('0x30'));_0x2275da['query']=_[_0x8fff('0x36')](_0x53791d[_0x8fff('0x37')]);_0x2275da[_0x8fff('0x38')]=_[_0x8fff('0x39')](_0x2275da['model'],_0x2275da[_0x8fff('0x37')]);_0xfee4ba[_0x8fff('0x3a')]=_['intersection'](_0x2275da[_0x8fff('0x3b')],qs['fields'](_0x53791d[_0x8fff('0x37')]['fields']));_0xfee4ba[_0x8fff('0x3a')]=_0xfee4ba[_0x8fff('0x3a')][_0x8fff('0x3c')]?_0xfee4ba[_0x8fff('0x3a')]:_0x2275da[_0x8fff('0x3b')];if(!_0x53791d['query']['hasOwnProperty'](_0x8fff('0x3d'))){_0xfee4ba[_0x8fff('0x25')]=qs['limit'](_0x53791d['query'][_0x8fff('0x25')]);_0xfee4ba['offset']=qs[_0x8fff('0x24')](_0x53791d[_0x8fff('0x37')][_0x8fff('0x24')]);}_0xfee4ba[_0x8fff('0x3e')]=qs[_0x8fff('0x3f')](_0x53791d[_0x8fff('0x37')][_0x8fff('0x3f')]);_0xfee4ba[_0x8fff('0x40')]=qs[_0x8fff('0x38')](_[_0x8fff('0x41')](_0x53791d['query'],_0x2275da[_0x8fff('0x38')]),_0x3cfb23);if(_0x53791d[_0x8fff('0x37')][_0x8fff('0x42')]){_0xfee4ba['where']=_[_0x8fff('0x43')](_0xfee4ba[_0x8fff('0x40')],{'$or':_[_0x8fff('0x35')](_0x3cfb23,function(_0x4ea199){if(_0x4ea199['type']!=='VIRTUAL'){var _0xf1ff56={};_0xf1ff56[_0x4ea199[_0x8fff('0x30')]]={'$like':'%'+_0x53791d[_0x8fff('0x37')]['filter']+'%'};return _0xf1ff56;}})});}_0xfee4ba=_[_0x8fff('0x43')]({},_0xfee4ba,_0x53791d[_0x8fff('0x44')]);var _0x467ef1={'where':_0xfee4ba[_0x8fff('0x40')]};return db[_0x8fff('0x45')][_0x8fff('0x23')](_0x467ef1)['then'](function(_0x172aec){_0x1132a9[_0x8fff('0x23')]=_0x172aec;if(_0x53791d[_0x8fff('0x37')]['includeAll']){_0xfee4ba[_0x8fff('0x46')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0x8fff('0x47')](_0xfee4ba);})[_0x8fff('0x2a')](function(_0x43c2ad){_0x1132a9[_0x8fff('0x48')]=_0x43c2ad;return _0x1132a9;})[_0x8fff('0x2a')](respondWithFilteredResult(_0x307091,_0xfee4ba))[_0x8fff('0x49')](handleError(_0x307091,null));};exports[_0x8fff('0x4a')]=function(_0x19dc11,_0x290e99){var _0x40f6fd={'raw':!![],'where':{'id':_0x19dc11['params']['id']}},_0x549417={};_0x549417['model']=_[_0x8fff('0x36')](db['OpenchannelQueue'][_0x8fff('0x4b')]);_0x549417[_0x8fff('0x37')]=_[_0x8fff('0x36')](_0x19dc11[_0x8fff('0x37')]);_0x549417[_0x8fff('0x38')]=_[_0x8fff('0x39')](_0x549417[_0x8fff('0x3b')],_0x549417[_0x8fff('0x37')]);_0x40f6fd[_0x8fff('0x3a')]=_[_0x8fff('0x39')](_0x549417[_0x8fff('0x3b')],qs[_0x8fff('0x4c')](_0x19dc11[_0x8fff('0x37')][_0x8fff('0x4c')]));_0x40f6fd['attributes']=_0x40f6fd['attributes'][_0x8fff('0x3c')]?_0x40f6fd['attributes']:_0x549417['model'];if(_0x19dc11[_0x8fff('0x37')]['includeAll']){_0x40f6fd[_0x8fff('0x46')]=[{'all':!![]}];}_0x40f6fd=_[_0x8fff('0x43')]({},_0x40f6fd,_0x19dc11[_0x8fff('0x44')]);return db['OpenchannelQueue']['find'](_0x40f6fd)[_0x8fff('0x2a')](handleEntityNotFound(_0x290e99,null))['then'](respondWithResult(_0x290e99,null))[_0x8fff('0x49')](handleError(_0x290e99,null));};exports['create']=function(_0x11caba,_0x54234e){return db['OpenchannelQueue'][_0x8fff('0x4d')](_0x11caba[_0x8fff('0x4e')],{})[_0x8fff('0x2a')](function(_0x9c6851){var _0x38b46c=_0x11caba[_0x8fff('0x4f')]['get']({'plain':!![]});if(!_0x38b46c)throw new Error(_0x8fff('0x50'));if(_0x38b46c[_0x8fff('0x51')]==='user'){var _0x5f136d=_0x9c6851[_0x8fff('0x2c')]({'plain':!![]});var _0x4c7ceb=_0x8fff('0x2d');return db[_0x8fff('0x52')][_0x8fff('0x53')]({'where':{'name':_0x4c7ceb,'userProfileId':_0x38b46c[_0x8fff('0x54')]},'raw':!![]})[_0x8fff('0x2a')](function(_0x595be2){if(_0x595be2&&_0x595be2[_0x8fff('0x55')]===0x0){return db[_0x8fff('0x2e')]['create']({'name':_0x5f136d[_0x8fff('0x30')],'resourceId':_0x5f136d['id'],'type':_0x595be2[_0x8fff('0x30')],'sectionId':_0x595be2['id']},{})[_0x8fff('0x2a')](function(){return _0x9c6851;});}else{return _0x9c6851;}})[_0x8fff('0x49')](function(_0x3aa0d8){logger[_0x8fff('0x56')](_0x8fff('0x57'),_0x3aa0d8);throw _0x3aa0d8;});}return _0x9c6851;})[_0x8fff('0x2a')](respondWithResult(_0x54234e,0xc9))['catch'](handleError(_0x54234e,null));};exports[_0x8fff('0x29')]=function(_0x148c94,_0x4f1627){if(_0x148c94['body']['id']){delete _0x148c94[_0x8fff('0x4e')]['id'];}return db[_0x8fff('0x45')][_0x8fff('0x53')]({'where':{'id':_0x148c94[_0x8fff('0x58')]['id']}})[_0x8fff('0x2a')](handleEntityNotFound(_0x4f1627,null))[_0x8fff('0x2a')](saveUpdates(_0x148c94[_0x8fff('0x4e')],null))[_0x8fff('0x2a')](respondWithResult(_0x4f1627,null))['catch'](handleError(_0x4f1627,null));};exports[_0x8fff('0x2b')]=function(_0x5e6045,_0x1cc0ec){return db['OpenchannelQueue'][_0x8fff('0x53')]({'where':{'id':_0x5e6045[_0x8fff('0x58')]['id']}})[_0x8fff('0x2a')](handleEntityNotFound(_0x1cc0ec,null))[_0x8fff('0x2a')](removeEntity(_0x1cc0ec,null))[_0x8fff('0x49')](handleError(_0x1cc0ec,null));};exports['describe']=function(_0x158d09,_0xa9d1c1){return db[_0x8fff('0x45')]['describe']()[_0x8fff('0x2a')](respondWithResult(_0xa9d1c1,null))['catch'](handleError(_0xa9d1c1,null));};exports[_0x8fff('0x59')]=function(_0x2c561c,_0x1c18f9,_0x3e94c2){var _0x38f892={'raw':!![],'where':{}},_0x1e4c2a={},_0x3392a8;return db[_0x8fff('0x45')]['findOne']({'where':{'id':_0x2c561c['params']['id']}})[_0x8fff('0x2a')](handleEntityNotFound(_0x1c18f9,null))[_0x8fff('0x2a')](function(_0xa0cb2a){if(_0xa0cb2a){_0x3392a8=_0xa0cb2a['get']({'plain':!![]});_0x1e4c2a[_0x8fff('0x3b')]=_[_0x8fff('0x36')](db[_0x8fff('0x5a')]['rawAttributes']);_0x1e4c2a[_0x8fff('0x37')]=_['keys'](_0x2c561c[_0x8fff('0x37')]);_0x1e4c2a['filters']=_[_0x8fff('0x39')](_0x1e4c2a[_0x8fff('0x3b')],_0x1e4c2a[_0x8fff('0x37')]);_0x38f892['attributes']=_[_0x8fff('0x39')](_0x1e4c2a[_0x8fff('0x3b')],qs[_0x8fff('0x4c')](_0x2c561c['query']['fields']));_0x38f892['attributes']=_0x38f892[_0x8fff('0x3a')][_0x8fff('0x3c')]?_0x38f892[_0x8fff('0x3a')]:_0x1e4c2a[_0x8fff('0x3b')];if(!_0x2c561c[_0x8fff('0x37')][_0x8fff('0x5b')](_0x8fff('0x3d'))){_0x38f892[_0x8fff('0x25')]=qs[_0x8fff('0x25')](_0x2c561c[_0x8fff('0x37')][_0x8fff('0x25')]);_0x38f892[_0x8fff('0x24')]=qs[_0x8fff('0x24')](_0x2c561c[_0x8fff('0x37')][_0x8fff('0x24')]);}_0x38f892[_0x8fff('0x3e')]=qs[_0x8fff('0x3f')](_0x2c561c[_0x8fff('0x37')][_0x8fff('0x3f')]);_0x38f892['where']=qs[_0x8fff('0x38')](_['pick'](_0x2c561c['query'],_0x1e4c2a[_0x8fff('0x38')]));_0x38f892[_0x8fff('0x40')][_0x8fff('0x5c')]=_0xa0cb2a['id'];if(_0x2c561c[_0x8fff('0x37')][_0x8fff('0x42')]){_0x38f892[_0x8fff('0x40')]=_['merge'](_0x38f892['where'],{'$or':_['map'](_0x38f892[_0x8fff('0x3a')],function(_0x73bf31){var _0x2c12ae={};_0x2c12ae[_0x73bf31]={'$like':'%'+_0x2c561c['query']['filter']+'%'};return _0x2c12ae;})});}_0x38f892=_[_0x8fff('0x43')]({},_0x38f892,_0x2c561c[_0x8fff('0x44')]);return db[_0x8fff('0x5a')][_0x8fff('0x47')](_0x38f892);}})[_0x8fff('0x2a')](function(_0x4c02db){if(_0x4c02db){return db[_0x8fff('0x5d')][_0x8fff('0x5e')]({'where':{'id':_[_0x8fff('0x35')](_0x4c02db,'UserId'),'role':_0x8fff('0x5f')},'attributes':['id',_0x8fff('0x30'),_0x8fff('0x60'),_0x8fff('0x61'),_0x8fff('0x62')]});}})[_0x8fff('0x2a')](function(_0x5d4713){if(_0x5d4713){return{'count':_0x5d4713['count'],'rows':_[_0x8fff('0x35')](_0x5d4713[_0x8fff('0x48')],function(_0x44bdfa){return{'membername':_0x44bdfa[_0x8fff('0x30')],'UserId':_0x44bdfa['id'],'queue_name':_0x3392a8['name'],'OpenchannelQueueId':_0x3392a8['id'],'interface':util[_0x8fff('0x63')](_0x8fff('0x64'),'SIP',_0x44bdfa[_0x8fff('0x30')]),'penalty':0x0,'paused':_0x44bdfa[_0x8fff('0x60')],'createdAt':_0x44bdfa[_0x8fff('0x62')],'updatedAt':_0x44bdfa['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x8fff('0x2a')](respondWithFilteredResult(_0x1c18f9,_0x38f892))[_0x8fff('0x49')](handleError(_0x1c18f9,null));};exports[_0x8fff('0x65')]=function(_0x1ba510,_0x202bd5,_0x560c70){var _0x30ed4f={};var _0x6005eb={};var _0x188667;var _0x2ad4fc;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x1ba510[_0x8fff('0x58')]['id']}})[_0x8fff('0x2a')](handleEntityNotFound(_0x202bd5,null))['then'](function(_0x40cfe2){if(_0x40cfe2){_0x188667=_0x40cfe2;_0x6005eb[_0x8fff('0x3b')]=_['keys'](db[_0x8fff('0x66')][_0x8fff('0x4b')]);_0x6005eb[_0x8fff('0x37')]=_[_0x8fff('0x36')](_0x1ba510[_0x8fff('0x37')]);_0x6005eb[_0x8fff('0x38')]=_[_0x8fff('0x39')](_0x6005eb['model'],_0x6005eb['query']);_0x30ed4f['attributes']=_['intersection'](_0x6005eb['model'],qs[_0x8fff('0x4c')](_0x1ba510[_0x8fff('0x37')][_0x8fff('0x4c')]));_0x30ed4f[_0x8fff('0x3a')]=_0x30ed4f['attributes']['length']?_0x30ed4f['attributes']:_0x6005eb['model'];_0x30ed4f[_0x8fff('0x3e')]=qs[_0x8fff('0x3f')](_0x1ba510[_0x8fff('0x37')][_0x8fff('0x3f')]);_0x30ed4f[_0x8fff('0x40')]=qs['filters'](_['pick'](_0x1ba510[_0x8fff('0x37')],_0x6005eb[_0x8fff('0x38')]));if(_0x1ba510[_0x8fff('0x37')][_0x8fff('0x42')]){_0x30ed4f[_0x8fff('0x40')]=_[_0x8fff('0x43')](_0x30ed4f['where'],{'$or':_[_0x8fff('0x35')](_0x30ed4f[_0x8fff('0x3a')],function(_0x389cc1){var _0x5b035a={};_0x5b035a[_0x389cc1]={'$like':'%'+_0x1ba510[_0x8fff('0x37')][_0x8fff('0x42')]+'%'};return _0x5b035a;})});}_0x30ed4f=_['merge']({},_0x30ed4f,_0x1ba510['options']);return _0x188667[_0x8fff('0x65')](_0x30ed4f);}})[_0x8fff('0x2a')](function(_0x3e35a3){if(_0x3e35a3){_0x2ad4fc=_0x3e35a3[_0x8fff('0x3c')];if(!_0x1ba510['query']['hasOwnProperty'](_0x8fff('0x3d'))){_0x30ed4f[_0x8fff('0x25')]=qs[_0x8fff('0x25')](_0x1ba510[_0x8fff('0x37')]['limit']);_0x30ed4f[_0x8fff('0x24')]=qs[_0x8fff('0x24')](_0x1ba510[_0x8fff('0x37')][_0x8fff('0x24')]);}return _0x188667[_0x8fff('0x65')](_0x30ed4f);}})[_0x8fff('0x2a')](function(_0x1cfad6){if(_0x1cfad6){return _0x1cfad6?{'count':_0x2ad4fc,'rows':_0x1cfad6}:null;}})[_0x8fff('0x2a')](respondWithResult(_0x202bd5,null))[_0x8fff('0x49')](handleError(_0x202bd5,null));};exports[_0x8fff('0x67')]=function(_0x29e8c8,_0x58e108,_0x8c0c){var _0x51c8e1=_0x29e8c8[_0x8fff('0x4e')][_0x8fff('0x68')];return db[_0x8fff('0x66')]['findAll']({'where':{'id':_0x51c8e1},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8fff('0x69'),'attributes':['id','name',_0x8fff('0x6a'),_0x8fff('0x6b'),_0x8fff('0x6c')],'raw':!![]}]})[_0x8fff('0x2a')](function(_0x2507be){if(_0x2507be){var _0x1279be=_[_0x8fff('0x6d')](_0x2507be,function(_0x4ecdba){var _0x73dc42=_0x4ecdba[_0x8fff('0x2c')]({'plain':!![]});return _0x73dc42[_0x8fff('0x69')];});return db['OpenchannelQueue']['find']({'where':{'id':_0x29e8c8[_0x8fff('0x58')]['id']}})[_0x8fff('0x2a')](function(_0x3cb7e9){return db[_0x8fff('0x6e')][_0x8fff('0x6f')](function(_0x5dd23a){return _0x3cb7e9[_0x8fff('0x67')](_0x51c8e1,{'transaction':_0x5dd23a})[_0x8fff('0x2a')](function(){return BPromise['each'](_0x1279be,function(_0x47b640){return db[_0x8fff('0x5a')]['findOrCreate']({'where':{'UserId':_0x47b640['id'],'OpenchannelQueueId':_0x29e8c8[_0x8fff('0x58')]['id']},'transaction':_0x5dd23a});});})[_0x8fff('0x2a')](function(){_0x1279be[_0x8fff('0x70')](function(_0x5c01af){socket[_0x8fff('0x71')](_0x8fff('0x72'),{'UserId':_0x5c01af['id'],'OpenchannelQueueId':_0x3cb7e9['id']});});});});});}})[_0x8fff('0x2a')](respondWithStatusCode(_0x58e108,null))[_0x8fff('0x49')](handleError(_0x58e108,null));};exports['removeTeams']=function(_0xa1a58b,_0x3bb428,_0x7f5925){return db['Team'][_0x8fff('0x47')]({'where':{'id':_0xa1a58b[_0x8fff('0x37')][_0x8fff('0x68')]},'attributes':['id'],'include':[{'model':db[_0x8fff('0x5d')],'as':_0x8fff('0x69'),'attributes':['id'],'raw':!![]}]})[_0x8fff('0x2a')](handleEntityNotFound(_0x3bb428,null))[_0x8fff('0x2a')](function(_0x45374d){var _0x3595d4=_['map'](_0x45374d,'id');var _0x5f4ce8=[];var _0x42986d=[];var _0x1f127b=squel[_0x8fff('0x73')]();_0x1f127b[_0x8fff('0x74')](_0x8fff('0x75'))[_0x8fff('0x76')]('team_has_openchannel_queues','tq')[_0x8fff('0x77')]('user_has_teams','ut',_0x8fff('0x78'))[_0x8fff('0x40')](_0x8fff('0x79'),_0xa1a58b['params']['id']);for(var _0x310643=0x0;_0x310643<_0x45374d[_0x8fff('0x3c')];_0x310643+=0x1){let _0x27a826=_0x45374d[_0x310643];for(var _0x59ca80=0x0;_0x59ca80<_0x27a826[_0x8fff('0x69')]['length'];_0x59ca80+=0x1){let _0x4f7506=_0x27a826[_0x8fff('0x69')][_0x59ca80];var _0x308c57=_0x1f127b[_0x8fff('0x7a')]();_0x308c57['where'](_0x8fff('0x7b'),_0x4f7506['id']);_0x42986d[_0x8fff('0x7c')](db[_0x8fff('0x6e')][_0x8fff('0x37')](_0x308c57[_0x8fff('0x7d')](),{'type':db['sequelize'][_0x8fff('0x7e')][_0x8fff('0x7f')]})[_0x8fff('0x2a')](function(_0x4aca27){if(_0x4aca27[_0x8fff('0x3c')]===0x1){return _0x4f7506['id'];}else{var _0x48eb0e=_[_0x8fff('0x80')](_[_0x8fff('0x35')](_0x4aca27,_0x8fff('0x81')),function(_0x462cbf){return _[_0x8fff('0x82')](_0x3595d4,_0x462cbf);});if(_0x48eb0e){return _0x4f7506['id'];}}}));}}return BPromise[_0x8fff('0x83')](_0x42986d)['then'](function(_0x2bf059){_0x5f4ce8=_(_0x5f4ce8)[_0x8fff('0x84')](_0x2bf059)[_0x8fff('0x85')]()[_0x8fff('0x86')]();return db['OpenchannelQueue'][_0x8fff('0x53')]({'where':{'id':_0xa1a58b[_0x8fff('0x58')]['id']}})[_0x8fff('0x2a')](function(_0x577d40){return db[_0x8fff('0x6e')]['transaction'](function(_0x45ad31){return _0x577d40['removeTeams'](_0xa1a58b[_0x8fff('0x37')][_0x8fff('0x68')],{'transaction':_0x45ad31})['then'](function(){if(!_[_0x8fff('0x87')](_0x5f4ce8)){return _0x577d40[_0x8fff('0x88')](_0x5f4ce8,{'transaction':_0x45ad31});}})[_0x8fff('0x2a')](function(){_0x5f4ce8[_0x8fff('0x70')](function(_0x2d6dd4){socket[_0x8fff('0x71')]('userOpenchannelQueue:remove',{'UserId':_0x2d6dd4,'OpenchannelQueueId':_0x577d40['id']});});});});});});})['then'](respondWithStatusCode(_0x3bb428,null))['catch'](handleError(_0x3bb428,null));};exports[_0x8fff('0x89')]=function(_0x1c719f,_0x1b84f5,_0x2b5110){return db[_0x8fff('0x45')][_0x8fff('0x53')]({'where':{'id':_0x1c719f[_0x8fff('0x58')]['id']}})[_0x8fff('0x2a')](handleEntityNotFound(_0x1b84f5,null))[_0x8fff('0x2a')](function(_0x43fb3d){if(_0x43fb3d){return _0x43fb3d[_0x8fff('0x89')](_0x1c719f[_0x8fff('0x4e')][_0x8fff('0x68')],_[_0x8fff('0x8a')](_0x1c719f['body'],[_0x8fff('0x68'),'id'])||{})[_0x8fff('0x8b')](function(_0x27d65c){for(var _0x2c68e7=0x0;_0x2c68e7<_0x1c719f[_0x8fff('0x4e')]['ids'][_0x8fff('0x3c')];_0x2c68e7+=0x1){socket[_0x8fff('0x71')](_0x8fff('0x72'),{'UserId':_0x1c719f[_0x8fff('0x4e')][_0x8fff('0x68')][_0x2c68e7],'OpenchannelQueueId':_0x1c719f[_0x8fff('0x58')]['id']});}return _0x27d65c;});}})[_0x8fff('0x2a')](respondWithResult(_0x1b84f5,null))[_0x8fff('0x49')](handleError(_0x1b84f5,null));};exports['removeAgents']=function(_0x58f0bd,_0x45d674,_0x344cba){return db[_0x8fff('0x45')][_0x8fff('0x53')]({'where':{'id':_0x58f0bd[_0x8fff('0x58')]['id']}})['then'](handleEntityNotFound(_0x45d674,null))[_0x8fff('0x2a')](function(_0x922f9b){if(_0x922f9b){return _0x922f9b[_0x8fff('0x88')](_0x58f0bd[_0x8fff('0x37')][_0x8fff('0x68')])[_0x8fff('0x2a')](function(){if(_[_0x8fff('0x8c')](_0x58f0bd[_0x8fff('0x37')][_0x8fff('0x68')])){for(var _0x555758=0x0;_0x555758<_0x58f0bd[_0x8fff('0x37')][_0x8fff('0x68')]['length'];_0x555758+=0x1){socket[_0x8fff('0x71')](_0x8fff('0x8d'),{'UserId':Number(_0x58f0bd[_0x8fff('0x37')]['ids'][_0x555758]),'OpenchannelQueueId':Number(_0x58f0bd[_0x8fff('0x58')]['id'])});}}else{socket[_0x8fff('0x71')](_0x8fff('0x8d'),{'UserId':Number(_0x58f0bd[_0x8fff('0x37')]['ids']),'OpenchannelQueueId':Number(_0x58f0bd[_0x8fff('0x58')]['id'])});}});}})[_0x8fff('0x2a')](respondWithStatusCode(_0x45d674,null))[_0x8fff('0x49')](handleError(_0x45d674,null));};exports[_0x8fff('0x8e')]=function(_0x332dbe,_0x5b9289,_0x4edadc){var _0x466701={};var _0x981b27={};var _0x31b0fe;var _0x54d061;return db[_0x8fff('0x45')][_0x8fff('0x8f')]({'where':{'id':_0x332dbe['params']['id']}})['then'](handleEntityNotFound(_0x5b9289,null))[_0x8fff('0x2a')](function(_0x48df0e){if(_0x48df0e){_0x31b0fe=_0x48df0e;_0x981b27['model']=_[_0x8fff('0x36')](db[_0x8fff('0x5d')][_0x8fff('0x4b')]);_0x981b27[_0x8fff('0x37')]=_['keys'](_0x332dbe[_0x8fff('0x37')]);_0x981b27['filters']=_[_0x8fff('0x39')](_0x981b27['model'],_0x981b27[_0x8fff('0x37')]);_0x466701['attributes']=_[_0x8fff('0x39')](_0x981b27[_0x8fff('0x3b')],qs[_0x8fff('0x4c')](_0x332dbe[_0x8fff('0x37')]['fields']));_0x466701['attributes']=_0x466701[_0x8fff('0x3a')][_0x8fff('0x3c')]?_0x466701[_0x8fff('0x3a')]:_0x981b27['model'];_0x466701[_0x8fff('0x3e')]=qs['sort'](_0x332dbe['query'][_0x8fff('0x3f')]);_0x466701['where']=qs['filters'](_[_0x8fff('0x41')](_0x332dbe[_0x8fff('0x37')],_0x981b27['filters']));if(_0x332dbe['query'][_0x8fff('0x42')]){_0x466701[_0x8fff('0x40')]=_['merge'](_0x466701[_0x8fff('0x40')],{'$or':_['map'](_0x466701[_0x8fff('0x3a')],function(_0x3a10f4){var _0x263d2a={};_0x263d2a[_0x3a10f4]={'$like':'%'+_0x332dbe[_0x8fff('0x37')][_0x8fff('0x42')]+'%'};return _0x263d2a;})});}_0x466701=_[_0x8fff('0x43')]({},_0x466701,_0x332dbe[_0x8fff('0x44')]);return _0x31b0fe[_0x8fff('0x8e')](_0x466701);}})['then'](function(_0x333b28){if(_0x333b28){_0x54d061=_0x333b28[_0x8fff('0x3c')];if(!_0x332dbe['query'][_0x8fff('0x5b')](_0x8fff('0x3d'))){_0x466701['limit']=qs[_0x8fff('0x25')](_0x332dbe[_0x8fff('0x37')]['limit']);_0x466701[_0x8fff('0x24')]=qs[_0x8fff('0x24')](_0x332dbe['query']['offset']);}return _0x31b0fe[_0x8fff('0x8e')](_0x466701);}})[_0x8fff('0x2a')](function(_0x59e9c7){if(_0x59e9c7){return _0x59e9c7?{'count':_0x54d061,'rows':_0x59e9c7}:null;}})[_0x8fff('0x2a')](respondWithResult(_0x5b9289,null))['catch'](handleError(_0x5b9289,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index c0f8848..cee69c1 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 _0x257a=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelQueue','save','update'];(function(_0x26ed29,_0x2288f1){var _0x26182c=function(_0x23dc71){while(--_0x23dc71){_0x26ed29['push'](_0x26ed29['shift']());}};_0x26182c(++_0x2288f1);}(_0x257a,0x175));var _0xa257=function(_0xeaf017,_0x17d5ca){_0xeaf017=_0xeaf017-0x0;var _0x57b391=_0x257a[_0xeaf017];return _0x57b391;};'use strict';var EventEmitter=require(_0xa257('0x0'));var OpenchannelQueue=require(_0xa257('0x1'))['db'][_0xa257('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa257('0x3'),'afterUpdate':_0xa257('0x4'),'afterDestroy':_0xa257('0x5')};function emitEvent(_0x3914e4){return function(_0x360f7c,_0xceb2b7,_0x423907){OpenchannelQueueEvents[_0xa257('0x6')](_0x3914e4+':'+_0x360f7c['id'],_0x360f7c);OpenchannelQueueEvents[_0xa257('0x6')](_0x3914e4,_0x360f7c);_0x423907(null);};}for(var e in events){if(events[_0xa257('0x7')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0xa257('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xb3f2=['emit','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove'];(function(_0x368bba,_0x1f625b){var _0x409f8f=function(_0x463373){while(--_0x463373){_0x368bba['push'](_0x368bba['shift']());}};_0x409f8f(++_0x1f625b);}(_0xb3f2,0x14d));var _0x2b3f=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xb3f2[_0x500419];return _0x241c1a;};'use strict';var EventEmitter=require(_0x2b3f('0x0'));var OpenchannelQueue=require(_0x2b3f('0x1'))['db'][_0x2b3f('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x2b3f('0x3')](0x0);var events={'afterCreate':_0x2b3f('0x4'),'afterUpdate':_0x2b3f('0x5'),'afterDestroy':_0x2b3f('0x6')};function emitEvent(_0x450424){return function(_0xf0511c,_0x3d2525,_0x1baad5){OpenchannelQueueEvents[_0x2b3f('0x7')](_0x450424+':'+_0xf0511c['id'],_0xf0511c);OpenchannelQueueEvents['emit'](_0x450424,_0xf0511c);_0x1baad5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x2b3f('0x8')](e,emitEvent(event));}}module[_0x2b3f('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index adb19dc..70eb80c 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 _0xad5a=['path','../../config/environment','define','OpenchannelQueue','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x126f5a,_0x1afb4e){var _0x1d0df6=function(_0x5a4174){while(--_0x5a4174){_0x126f5a['push'](_0x126f5a['shift']());}};_0x1d0df6(++_0x1afb4e);}(_0xad5a,0x18a));var _0xaad5=function(_0x2947ea,_0x437a4b){_0x2947ea=_0x2947ea-0x0;var _0x595551=_0xad5a[_0x2947ea];return _0x595551;};'use strict';var _=require(_0xaad5('0x0'));var util=require(_0xaad5('0x1'));var logger=require(_0xaad5('0x2'))(_0xaad5('0x3'));var moment=require(_0xaad5('0x4'));var BPromise=require('bluebird');var rp=require(_0xaad5('0x5'));var fs=require('fs');var path=require(_0xaad5('0x6'));var rimraf=require('rimraf');var config=require(_0xaad5('0x7'));var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x3415ed,_0xd1aa25){return _0x3415ed[_0xaad5('0x8')](_0xaad5('0x9'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e1f=['api','moment','bluebird','request-promise','path','rimraf','exports','OpenchannelQueue','openchannel_queues','lodash','../../config/logger'];(function(_0x1ffb8e,_0x1544c9){var _0x462b75=function(_0x50507b){while(--_0x50507b){_0x1ffb8e['push'](_0x1ffb8e['shift']());}};_0x462b75(++_0x1544c9);}(_0x3e1f,0xe5));var _0xf3e1=function(_0x254b22,_0x27159f){_0x254b22=_0x254b22-0x0;var _0x1279db=_0x3e1f[_0x254b22];return _0x1279db;};'use strict';var _=require(_0xf3e1('0x0'));var util=require('util');var logger=require(_0xf3e1('0x1'))(_0xf3e1('0x2'));var moment=require(_0xf3e1('0x3'));var BPromise=require(_0xf3e1('0x4'));var rp=require(_0xf3e1('0x5'));var fs=require('fs');var path=require(_0xf3e1('0x6'));var rimraf=require(_0xf3e1('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module[_0xf3e1('0x8')]=function(_0x3ee96e,_0x4e24f3){return _0x3ee96e['define'](_0xf3e1('0x9'),attributes,{'tableName':_0xf3e1('0xa'),'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 a46391b..b0ff0b7 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 _0x11e3=['debug','ShowOpenchannelQueue','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','request\x20sent','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','where','include','model','attributes','map','info'];(function(_0x4d394d,_0x40e7b3){var _0x4f0003=function(_0x56d25d){while(--_0x56d25d){_0x4d394d['push'](_0x4d394d['shift']());}};_0x4f0003(++_0x40e7b3);}(_0x11e3,0x1e3));var _0x311e=function(_0x138fce,_0x304267){_0x138fce=_0x138fce-0x0;var _0x593cb0=_0x11e3[_0x138fce];return _0x593cb0;};'use strict';var _=require(_0x311e('0x0'));var util=require('util');var moment=require(_0x311e('0x1'));var BPromise=require(_0x311e('0x2'));var rs=require(_0x311e('0x3'));var fs=require('fs');var Redis=require(_0x311e('0x4'));var db=require(_0x311e('0x5'))['db'];var utils=require(_0x311e('0x6'));var logger=require(_0x311e('0x7'))(_0x311e('0x8'));var config=require(_0x311e('0x9'));var jayson=require(_0x311e('0xa'));var client=jayson[_0x311e('0xb')][_0x311e('0xc')]({'port':0x232a});config[_0x311e('0xd')]=_['defaults'](config[_0x311e('0xd')],{'host':_0x311e('0xe'),'port':0x18eb});var socket=require(_0x311e('0xf'))(new Redis(config[_0x311e('0xd')]));require(_0x311e('0x10'))[_0x311e('0x11')](socket);function respondWithRpcPromise(_0x2a7f02,_0x200290,_0x1c5067){return new BPromise(function(_0x8aac0e,_0x4168d9){return client[_0x311e('0x12')](_0x2a7f02,_0x1c5067)[_0x311e('0x13')](function(_0x1a7e82){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x200290,_0x311e('0x14'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x200290,_0x311e('0x14'),JSON[_0x311e('0x15')](_0x1a7e82));if(_0x1a7e82[_0x311e('0x16')]){if(_0x1a7e82[_0x311e('0x16')][_0x311e('0x17')]===0x1f4){logger[_0x311e('0x16')](_0x311e('0x18'),_0x200290,_0x1a7e82[_0x311e('0x16')][_0x311e('0x19')]);return _0x4168d9(_0x1a7e82[_0x311e('0x16')][_0x311e('0x19')]);}logger[_0x311e('0x16')](_0x311e('0x18'),_0x200290,_0x1a7e82[_0x311e('0x16')][_0x311e('0x19')]);return _0x8aac0e(_0x1a7e82[_0x311e('0x16')][_0x311e('0x19')]);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x200290,_0x311e('0x14'));_0x8aac0e(_0x1a7e82[_0x311e('0x1a')][_0x311e('0x19')]);}})[_0x311e('0x1b')](function(_0x334482){logger[_0x311e('0x16')](_0x311e('0x18'),_0x200290,_0x334482);_0x4168d9(_0x334482);});});}exports[_0x311e('0x1c')]=function(_0x590f00){var _0x191c28=this;return new Promise(function(_0x19fa48,_0x10fc65){return db[_0x311e('0x1d')]['findAll']({'raw':_0x590f00[_0x311e('0x1e')]?_0x590f00[_0x311e('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x590f00[_0x311e('0x1e')]?_0x590f00[_0x311e('0x1e')][_0x311e('0x1f')]||null:null,'attributes':_0x590f00[_0x311e('0x1e')]?_0x590f00[_0x311e('0x1e')]['attributes']||null:null,'limit':_0x590f00[_0x311e('0x1e')]?_0x590f00[_0x311e('0x1e')]['limit']||null:null,'include':_0x590f00[_0x311e('0x1e')]?_0x590f00[_0x311e('0x1e')][_0x311e('0x20')]?_['map'](_0x590f00['options'][_0x311e('0x20')],function(_0x2e52ba){return{'model':db[_0x2e52ba[_0x311e('0x21')]],'as':_0x2e52ba['as'],'attributes':_0x2e52ba[_0x311e('0x22')],'include':_0x2e52ba[_0x311e('0x20')]?_[_0x311e('0x23')](_0x2e52ba[_0x311e('0x20')],function(_0x130224){return{'model':db[_0x130224['model']],'as':_0x130224['as'],'attributes':_0x130224[_0x311e('0x22')],'include':_0x130224[_0x311e('0x20')]?_['map'](_0x130224[_0x311e('0x20')],function(_0x9f1222){return{'model':db[_0x9f1222[_0x311e('0x21')]],'as':_0x9f1222['as'],'attributes':_0x9f1222['attributes']};}):[]};}):[]};}):[]:[]})[_0x311e('0x13')](function(_0x4fcc70){logger[_0x311e('0x24')]('GetOpenchannelQueue',_0x590f00);logger[_0x311e('0x25')](_0x311e('0x1c'),_0x590f00,JSON[_0x311e('0x15')](_0x4fcc70));_0x19fa48(_0x4fcc70);})[_0x311e('0x1b')](function(_0x4b93f2){logger[_0x311e('0x16')](_0x311e('0x1c'),_0x4b93f2[_0x311e('0x19')],_0x590f00);_0x10fc65(_0x191c28[_0x311e('0x16')](0x1f4,_0x4b93f2[_0x311e('0x19')]));});});};exports[_0x311e('0x26')]=function(_0x2e66b1){var _0x3c26f0=this;return new Promise(function(_0xd348bd,_0x39eee6){return db[_0x311e('0x1d')]['find']({'raw':_0x2e66b1[_0x311e('0x1e')]?_0x2e66b1[_0x311e('0x1e')][_0x311e('0x27')]===undefined?!![]:![]:!![],'where':_0x2e66b1['options']?_0x2e66b1[_0x311e('0x1e')][_0x311e('0x1f')]||null:null,'attributes':_0x2e66b1[_0x311e('0x1e')]?_0x2e66b1[_0x311e('0x1e')][_0x311e('0x22')]||null:null,'include':_0x2e66b1['options']?_0x2e66b1[_0x311e('0x1e')][_0x311e('0x20')]?_[_0x311e('0x23')](_0x2e66b1['options'][_0x311e('0x20')],function(_0x244bbe){return{'model':db[_0x244bbe['model']],'as':_0x244bbe['as'],'attributes':_0x244bbe['attributes'],'include':_0x244bbe[_0x311e('0x20')]?_['map'](_0x244bbe[_0x311e('0x20')],function(_0x41173d){return{'model':db[_0x41173d[_0x311e('0x21')]],'as':_0x41173d['as'],'attributes':_0x41173d['attributes'],'include':_0x41173d[_0x311e('0x20')]?_[_0x311e('0x23')](_0x41173d[_0x311e('0x20')],function(_0x311579){return{'model':db[_0x311579['model']],'as':_0x311579['as'],'attributes':_0x311579[_0x311e('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x564d33){logger[_0x311e('0x24')](_0x311e('0x26'),_0x2e66b1);logger['debug'](_0x311e('0x26'),_0x2e66b1,JSON[_0x311e('0x15')](_0x564d33));_0xd348bd(_0x564d33);})[_0x311e('0x1b')](function(_0x180ed4){logger['error']('ShowOpenchannelQueue',_0x180ed4[_0x311e('0x19')],_0x2e66b1);_0x39eee6(_0x3c26f0[_0x311e('0x16')](0x1f4,_0x180ed4[_0x311e('0x19')]));});});}; \ No newline at end of file +var _0x203b=['stringify','error','code','message','request\x20sent','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','raw','options','limit','include','map','model','attributes','find','where','ShowOpenchannelQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x56fcf6,_0x401b3c){var _0x2078a7=function(_0x4f2790){while(--_0x4f2790){_0x56fcf6['push'](_0x56fcf6['shift']());}};_0x2078a7(++_0x401b3c);}(_0x203b,0x15c));var _0xb203=function(_0x3cfb5e,_0x114615){_0x3cfb5e=_0x3cfb5e-0x0;var _0x30be38=_0x203b[_0x3cfb5e];return _0x30be38;};'use strict';var _=require(_0xb203('0x0'));var util=require('util');var moment=require(_0xb203('0x1'));var BPromise=require(_0xb203('0x2'));var rs=require(_0xb203('0x3'));var fs=require('fs');var Redis=require(_0xb203('0x4'));var db=require(_0xb203('0x5'))['db'];var utils=require(_0xb203('0x6'));var logger=require(_0xb203('0x7'))(_0xb203('0x8'));var config=require(_0xb203('0x9'));var jayson=require(_0xb203('0xa'));var client=jayson['client'][_0xb203('0xb')]({'port':0x232a});config[_0xb203('0xc')]=_['defaults'](config[_0xb203('0xc')],{'host':_0xb203('0xd'),'port':0x18eb});var socket=require(_0xb203('0xe'))(new Redis(config[_0xb203('0xc')]));require('./openchannelQueue.socket')[_0xb203('0xf')](socket);function respondWithRpcPromise(_0x4df780,_0x18ef75,_0x5d1598){return new BPromise(function(_0x56fabf,_0x53d157){return client['request'](_0x4df780,_0x5d1598)[_0xb203('0x10')](function(_0x28caed){logger[_0xb203('0x11')](_0xb203('0x12'),_0x18ef75,'request\x20sent');logger[_0xb203('0x13')](_0xb203('0x14'),_0x18ef75,'request\x20sent',JSON[_0xb203('0x15')](_0x28caed));if(_0x28caed[_0xb203('0x16')]){if(_0x28caed[_0xb203('0x16')][_0xb203('0x17')]===0x1f4){logger['error'](_0xb203('0x12'),_0x18ef75,_0x28caed[_0xb203('0x16')][_0xb203('0x18')]);return _0x53d157(_0x28caed[_0xb203('0x16')][_0xb203('0x18')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x18ef75,_0x28caed[_0xb203('0x16')][_0xb203('0x18')]);return _0x56fabf(_0x28caed[_0xb203('0x16')][_0xb203('0x18')]);}else{logger[_0xb203('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x18ef75,_0xb203('0x19'));_0x56fabf(_0x28caed[_0xb203('0x1a')][_0xb203('0x18')]);}})[_0xb203('0x1b')](function(_0x56ccd7){logger[_0xb203('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x18ef75,_0x56ccd7);_0x53d157(_0x56ccd7);});});}exports[_0xb203('0x1c')]=function(_0x41595f){var _0x2fc740=this;return new Promise(function(_0x4ac477,_0x30605e){return db[_0xb203('0x1d')][_0xb203('0x1e')]({'raw':_0x41595f['options']?_0x41595f['options'][_0xb203('0x1f')]===undefined?!![]:![]:!![],'where':_0x41595f['options']?_0x41595f[_0xb203('0x20')]['where']||null:null,'attributes':_0x41595f[_0xb203('0x20')]?_0x41595f['options']['attributes']||null:null,'limit':_0x41595f[_0xb203('0x20')]?_0x41595f[_0xb203('0x20')][_0xb203('0x21')]||null:null,'include':_0x41595f[_0xb203('0x20')]?_0x41595f[_0xb203('0x20')][_0xb203('0x22')]?_[_0xb203('0x23')](_0x41595f[_0xb203('0x20')]['include'],function(_0x300d05){return{'model':db[_0x300d05[_0xb203('0x24')]],'as':_0x300d05['as'],'attributes':_0x300d05[_0xb203('0x25')],'include':_0x300d05[_0xb203('0x22')]?_[_0xb203('0x23')](_0x300d05['include'],function(_0x4a6c85){return{'model':db[_0x4a6c85[_0xb203('0x24')]],'as':_0x4a6c85['as'],'attributes':_0x4a6c85[_0xb203('0x25')],'include':_0x4a6c85['include']?_['map'](_0x4a6c85['include'],function(_0x50fb5b){return{'model':db[_0x50fb5b[_0xb203('0x24')]],'as':_0x50fb5b['as'],'attributes':_0x50fb5b[_0xb203('0x25')]};}):[]};}):[]};}):[]:[]})[_0xb203('0x10')](function(_0x55f3bc){logger[_0xb203('0x11')](_0xb203('0x1c'),_0x41595f);logger['debug']('GetOpenchannelQueue',_0x41595f,JSON['stringify'](_0x55f3bc));_0x4ac477(_0x55f3bc);})[_0xb203('0x1b')](function(_0x1b4910){logger['error'](_0xb203('0x1c'),_0x1b4910[_0xb203('0x18')],_0x41595f);_0x30605e(_0x2fc740[_0xb203('0x16')](0x1f4,_0x1b4910[_0xb203('0x18')]));});});};exports['ShowOpenchannelQueue']=function(_0xdb4937){var _0x464347=this;return new Promise(function(_0x24885d,_0x15cbd1){return db[_0xb203('0x1d')][_0xb203('0x26')]({'raw':_0xdb4937[_0xb203('0x20')]?_0xdb4937[_0xb203('0x20')][_0xb203('0x1f')]===undefined?!![]:![]:!![],'where':_0xdb4937[_0xb203('0x20')]?_0xdb4937['options'][_0xb203('0x27')]||null:null,'attributes':_0xdb4937['options']?_0xdb4937['options'][_0xb203('0x25')]||null:null,'include':_0xdb4937[_0xb203('0x20')]?_0xdb4937[_0xb203('0x20')]['include']?_['map'](_0xdb4937[_0xb203('0x20')]['include'],function(_0x2555da){return{'model':db[_0x2555da[_0xb203('0x24')]],'as':_0x2555da['as'],'attributes':_0x2555da[_0xb203('0x25')],'include':_0x2555da[_0xb203('0x22')]?_[_0xb203('0x23')](_0x2555da['include'],function(_0x24116b){return{'model':db[_0x24116b[_0xb203('0x24')]],'as':_0x24116b['as'],'attributes':_0x24116b['attributes'],'include':_0x24116b[_0xb203('0x22')]?_[_0xb203('0x23')](_0x24116b[_0xb203('0x22')],function(_0x2e0655){return{'model':db[_0x2e0655['model']],'as':_0x2e0655['as'],'attributes':_0x2e0655[_0xb203('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d0ded){logger[_0xb203('0x11')](_0xb203('0x28'),_0xdb4937);logger[_0xb203('0x13')]('ShowOpenchannelQueue',_0xdb4937,JSON['stringify'](_0x2d0ded));_0x24885d(_0x2d0ded);})[_0xb203('0x1b')](function(_0x455606){logger[_0xb203('0x16')](_0xb203('0x28'),_0x455606[_0xb203('0x18')],_0xdb4937);_0x15cbd1(_0x464347[_0xb203('0x16')](0x1f4,_0x455606['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index ac21c76..c37e00b 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 _0xb51c=['emit','removeListener','register','length','openchannelQueue:','save','remove'];(function(_0x47c6d6,_0x552689){var _0x4f21a6=function(_0x216da7){while(--_0x216da7){_0x47c6d6['push'](_0x47c6d6['shift']());}};_0x4f21a6(++_0x552689);}(_0xb51c,0x139));var _0xcb51=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xb51c[_0x18ab2a];return _0x16dcee;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xcb51('0x0'),_0xcb51('0x1'),'update'];function createListener(_0x22bfe5,_0x54e588){return function(_0x41239b){_0x54e588[_0xcb51('0x2')](_0x22bfe5,_0x41239b);};}function removeListener(_0x4d4c4c,_0x5014fb){return function(){OpenchannelQueueEvents[_0xcb51('0x3')](_0x4d4c4c,_0x5014fb);};}exports[_0xcb51('0x4')]=function(_0x57ae8c){for(var _0x1b6bce=0x0,_0x3cad2d=events[_0xcb51('0x5')];_0x1b6bce<_0x3cad2d;_0x1b6bce++){var _0x46265f=events[_0x1b6bce];var _0x48db23=createListener(_0xcb51('0x6')+_0x46265f,_0x57ae8c);OpenchannelQueueEvents['on'](_0x46265f,_0x48db23);}}; \ No newline at end of file +var _0xfdfa=['openchannelQueue:','./openchannelQueue.events','save','remove','emit','removeListener','register','length'];(function(_0x225ec9,_0x2e1289){var _0x466941=function(_0x4d3e54){while(--_0x4d3e54){_0x225ec9['push'](_0x225ec9['shift']());}};_0x466941(++_0x2e1289);}(_0xfdfa,0x1e9));var _0xafdf=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xfdfa[_0x1b349a];return _0x5d1f7c;};'use strict';var OpenchannelQueueEvents=require(_0xafdf('0x0'));var events=[_0xafdf('0x1'),_0xafdf('0x2'),'update'];function createListener(_0x3b2940,_0x26b50d){return function(_0xe2fa78){_0x26b50d[_0xafdf('0x3')](_0x3b2940,_0xe2fa78);};}function removeListener(_0x289e54,_0x411ea3){return function(){OpenchannelQueueEvents[_0xafdf('0x4')](_0x289e54,_0x411ea3);};}exports[_0xafdf('0x5')]=function(_0x4a83d6){for(var _0x19ccb5=0x0,_0x4316a2=events[_0xafdf('0x6')];_0x19ccb5<_0x4316a2;_0x19ccb5++){var _0x46c30a=events[_0x19ccb5];var _0x3b3d5e=createListener(_0xafdf('0x7')+_0x46c30a,_0x4a83d6);OpenchannelQueueEvents['on'](_0x46c30a,_0x3b3d5e);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index b36b4a3..991647c 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 _0x97ef=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x97ef,0x146));var _0xf97e=function(_0x2d23f1,_0x197871){_0x2d23f1=_0x2d23f1-0x0;var _0x20f613=_0x97ef[_0x2d23f1];return _0x20f613;};'use strict';var multer=require(_0xf97e('0x0'));var util=require(_0xf97e('0x1'));var path=require(_0xf97e('0x2'));var timeout=require(_0xf97e('0x3'));var express=require(_0xf97e('0x4'));var router=express[_0xf97e('0x5')]();var fs_extra=require(_0xf97e('0x6'));var auth=require(_0xf97e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf97e('0x8'));var controller=require(_0xf97e('0x9'));router[_0xf97e('0xa')]('/',auth[_0xf97e('0xb')](),controller[_0xf97e('0xc')]);router[_0xf97e('0xa')](_0xf97e('0xd'),auth[_0xf97e('0xb')](),controller[_0xf97e('0xe')]);router[_0xf97e('0xa')](_0xf97e('0xf'),auth[_0xf97e('0xb')](),controller[_0xf97e('0x10')]);router[_0xf97e('0x11')]('/',auth[_0xf97e('0xb')](),controller[_0xf97e('0x12')]);router[_0xf97e('0x13')](_0xf97e('0xf'),auth[_0xf97e('0xb')](),controller[_0xf97e('0x14')]);router[_0xf97e('0x15')](_0xf97e('0xf'),auth[_0xf97e('0xb')](),controller[_0xf97e('0x16')]);module[_0xf97e('0x17')]=router; \ No newline at end of file +var _0x3843=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3843,0x82));var _0x3384=function(_0x21cd0e,_0xd7914){_0x21cd0e=_0x21cd0e-0x0;var _0x440381=_0x3843[_0x21cd0e];return _0x440381;};'use strict';var multer=require(_0x3384('0x0'));var util=require('util');var path=require(_0x3384('0x1'));var timeout=require(_0x3384('0x2'));var express=require(_0x3384('0x3'));var router=express[_0x3384('0x4')]();var fs_extra=require(_0x3384('0x5'));var auth=require(_0x3384('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3384('0x7'));var controller=require(_0x3384('0x8'));router['get']('/',auth[_0x3384('0x9')](),controller[_0x3384('0xa')]);router[_0x3384('0xb')]('/describe',auth[_0x3384('0x9')](),controller[_0x3384('0xc')]);router[_0x3384('0xb')](_0x3384('0xd'),auth[_0x3384('0x9')](),controller[_0x3384('0xe')]);router[_0x3384('0xf')]('/',auth[_0x3384('0x9')](),controller[_0x3384('0x10')]);router[_0x3384('0x11')](_0x3384('0xd'),auth[_0x3384('0x9')](),controller[_0x3384('0x12')]);router[_0x3384('0x13')](_0x3384('0xd'),auth[_0x3384('0x9')](),controller[_0x3384('0x14')]);module[_0x3384('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 79198cb..d53ef20 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 _0xab99=['moment','exports','STRING','DATE'];(function(_0x3a5e18,_0x4b571e){var _0x1e74f5=function(_0x10b1d5){while(--_0x10b1d5){_0x3a5e18['push'](_0x3a5e18['shift']());}};_0x1e74f5(++_0x4b571e);}(_0xab99,0x188));var _0x9ab9=function(_0xfcf03f,_0x57d325){_0xfcf03f=_0xfcf03f-0x0;var _0x3b41c0=_0xab99[_0xfcf03f];return _0x3b41c0;};'use strict';var moment=require(_0x9ab9('0x0'));var Sequelize=require('sequelize');module[_0x9ab9('0x1')]={'uniqueid':{'type':Sequelize[_0x9ab9('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9ab9('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9ab9('0x3')]},'reason':{'type':Sequelize[_0x9ab9('0x2')]}}; \ No newline at end of file +var _0xe721=['STRING','DATE','exports'];(function(_0x83d48e,_0x507328){var _0x26f1d1=function(_0x252172){while(--_0x252172){_0x83d48e['push'](_0x83d48e['shift']());}};_0x26f1d1(++_0x507328);}(_0xe721,0x14f));var _0x1e72=function(_0x39efab,_0x55a207){_0x39efab=_0x39efab-0x0;var _0x5b3185=_0xe721[_0x39efab];return _0x5b3185;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1e72('0x0')]={'uniqueid':{'type':Sequelize[_0x1e72('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x1e72('0x1')]},'joinAt':{'type':Sequelize[_0x1e72('0x2')]},'leaveAt':{'type':Sequelize[_0x1e72('0x2')]},'acceptAt':{'type':Sequelize[_0x1e72('0x2')]},'exitAt':{'type':Sequelize[_0x1e72('0x2')]},'reason':{'type':Sequelize[_0x1e72('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 64daf5f..dd36d1c 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 _0x068c=['sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','filters','intersection','query','fields','attributes','length','nolimit','limit','order','sort','where','merge','options','count','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path'];(function(_0x590251,_0x123bd3){var _0x4b195b=function(_0xca57b3){while(--_0xca57b3){_0x590251['push'](_0x590251['shift']());}};_0x4b195b(++_0x123bd3);}(_0x068c,0x1c5));var _0xc068=function(_0x166e9f,_0x3227b3){_0x166e9f=_0x166e9f-0x0;var _0x585eee=_0x068c[_0x166e9f];return _0x585eee;};'use strict';var pdf=require(_0xc068('0x0'));var emlformat=require(_0xc068('0x1'));var rimraf=require(_0xc068('0x2'));var zipdir=require(_0xc068('0x3'));var jsonpatch=require(_0xc068('0x4'));var rp=require(_0xc068('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc068('0x6'));var util=require(_0xc068('0x7'));var path=require(_0xc068('0x8'));var sox=require(_0xc068('0x9'));var csv=require(_0xc068('0xa'));var ejs=require(_0xc068('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc068('0xc'));var squel=require(_0xc068('0xd'));var crypto=require('crypto');var jsforce=require(_0xc068('0xe'));var deskjs=require(_0xc068('0xf'));var toCsv=require(_0xc068('0xa'));var querystring=require(_0xc068('0x10'));var Papa=require(_0xc068('0x11'));var Redis=require(_0xc068('0x12'));var authService=require(_0xc068('0x13'));var qs=require(_0xc068('0x14'));var as=require(_0xc068('0x15'));var hardwareService=require(_0xc068('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xc068('0x17'));var config=require(_0xc068('0x18'));var licenseUtil=require(_0xc068('0x19'));var db=require(_0xc068('0x1a'))['db'];function respondWithStatusCode(_0x83981,_0x486c72){_0x486c72=_0x486c72||0xcc;return function(_0x15beb3){if(_0x15beb3){return _0x83981[_0xc068('0x1b')](_0x486c72);}return _0x83981['status'](_0x486c72)[_0xc068('0x1c')]();};}function respondWithResult(_0x18987e,_0x2f1bf9){_0x2f1bf9=_0x2f1bf9||0xc8;return function(_0xa05aff){if(_0xa05aff){return _0x18987e[_0xc068('0x1d')](_0x2f1bf9)[_0xc068('0x1e')](_0xa05aff);}};}function respondWithFilteredResult(_0x41ced6,_0x2d2a6d){return function(_0xcc0ef){if(_0xcc0ef){var _0x1faba5=_0xcc0ef['count'],_0x41b1fe=_0x2d2a6d[_0xc068('0x1f')],_0x548ed0=_0x2d2a6d[_0xc068('0x1f')]+_0x2d2a6d['limit'],_0xabe770;if(_0x548ed0>=_0x1faba5){_0x548ed0=_0x1faba5;_0xabe770=0xc8;}else{_0xabe770=0xce;}_0x41ced6[_0xc068('0x1d')](_0xabe770);return _0x41ced6[_0xc068('0x20')]('Content-Range',_0x41b1fe+'-'+_0x548ed0+'/'+_0x1faba5)[_0xc068('0x1e')](_0xcc0ef);}return null;};}function patchUpdates(_0x1a8ad5){return function(_0x3d0898){try{jsonpatch[_0xc068('0x21')](_0x3d0898,_0x1a8ad5,!![]);}catch(_0x5565ab){return BPromise[_0xc068('0x22')](_0x5565ab);}return _0x3d0898[_0xc068('0x23')]();};}function saveUpdates(_0xd6f2b9,_0x3d0ef8){return function(_0x54b86){if(_0x54b86){return _0x54b86[_0xc068('0x24')](_0xd6f2b9)[_0xc068('0x25')](function(_0x293257){return _0x293257;});}return null;};}function removeEntity(_0xea166a,_0x508652){return function(_0x10e91a){if(_0x10e91a){return _0x10e91a[_0xc068('0x26')]()[_0xc068('0x25')](function(){_0xea166a[_0xc068('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe664e0,_0x5e27a9){return function(_0x417b17){if(!_0x417b17){_0xe664e0[_0xc068('0x1b')](0x194);}return _0x417b17;};}function handleError(_0x39aae5,_0xd27b4f){_0xd27b4f=_0xd27b4f||0x1f4;return function(_0x56fecd){logger[_0xc068('0x27')](_0x56fecd[_0xc068('0x28')]);if(_0x56fecd[_0xc068('0x29')]){delete _0x56fecd[_0xc068('0x29')];}_0x39aae5[_0xc068('0x1d')](_0xd27b4f)[_0xc068('0x2a')](_0x56fecd);};}exports[_0xc068('0x2b')]=function(_0x285bf7,_0x3b2392){var _0x465b76={},_0x521bb6={},_0x56b929={'count':0x0,'rows':[]};var _0x3f3b91=_[_0xc068('0x2c')](db[_0xc068('0x2d')][_0xc068('0x2e')],function(_0x10be39){return{'name':_0x10be39[_0xc068('0x2f')],'type':_0x10be39[_0xc068('0x30')][_0xc068('0x31')]};});_0x521bb6[_0xc068('0x32')]=_[_0xc068('0x2c')](_0x3f3b91,_0xc068('0x29'));_0x521bb6['query']=_['keys'](_0x285bf7['query']);_0x521bb6[_0xc068('0x33')]=_[_0xc068('0x34')](_0x521bb6['model'],_0x521bb6[_0xc068('0x35')]);_0x465b76['attributes']=_[_0xc068('0x34')](_0x521bb6[_0xc068('0x32')],qs[_0xc068('0x36')](_0x285bf7[_0xc068('0x35')][_0xc068('0x36')]));_0x465b76[_0xc068('0x37')]=_0x465b76['attributes'][_0xc068('0x38')]?_0x465b76[_0xc068('0x37')]:_0x521bb6['model'];if(!_0x285bf7[_0xc068('0x35')]['hasOwnProperty'](_0xc068('0x39'))){_0x465b76[_0xc068('0x3a')]=qs['limit'](_0x285bf7[_0xc068('0x35')]['limit']);_0x465b76[_0xc068('0x1f')]=qs['offset'](_0x285bf7['query'][_0xc068('0x1f')]);}_0x465b76[_0xc068('0x3b')]=qs[_0xc068('0x3c')](_0x285bf7[_0xc068('0x35')]['sort']);_0x465b76[_0xc068('0x3d')]=qs[_0xc068('0x33')](_['pick'](_0x285bf7[_0xc068('0x35')],_0x521bb6[_0xc068('0x33')]),_0x3f3b91);if(_0x285bf7[_0xc068('0x35')]['filter']){_0x465b76['where']=_[_0xc068('0x3e')](_0x465b76['where'],{'$or':_['map'](_0x3f3b91,function(_0x1a9422){if(_0x1a9422[_0xc068('0x30')]!=='VIRTUAL'){var _0x1a9be0={};_0x1a9be0[_0x1a9422[_0xc068('0x29')]]={'$like':'%'+_0x285bf7[_0xc068('0x35')]['filter']+'%'};return _0x1a9be0;}})});}_0x465b76=_[_0xc068('0x3e')]({},_0x465b76,_0x285bf7[_0xc068('0x3f')]);var _0x5ee725={'where':_0x465b76['where']};return db[_0xc068('0x2d')][_0xc068('0x40')](_0x5ee725)[_0xc068('0x25')](function(_0x22b308){_0x56b929[_0xc068('0x40')]=_0x22b308;if(_0x285bf7['query'][_0xc068('0x41')]){_0x465b76[_0xc068('0x42')]=[{'all':!![]}];}return db[_0xc068('0x2d')][_0xc068('0x43')](_0x465b76);})[_0xc068('0x25')](function(_0x43e7cc){_0x56b929[_0xc068('0x44')]=_0x43e7cc;return _0x56b929;})['then'](respondWithFilteredResult(_0x3b2392,_0x465b76))[_0xc068('0x45')](handleError(_0x3b2392,null));};exports[_0xc068('0x46')]=function(_0x420cb0,_0x357c92){var _0x299030={'raw':!![],'where':{'id':_0x420cb0[_0xc068('0x47')]['id']}},_0x21d3c2={};_0x21d3c2[_0xc068('0x32')]=_['keys'](db[_0xc068('0x2d')][_0xc068('0x2e')]);_0x21d3c2['query']=_[_0xc068('0x48')](_0x420cb0['query']);_0x21d3c2[_0xc068('0x33')]=_[_0xc068('0x34')](_0x21d3c2['model'],_0x21d3c2['query']);_0x299030['attributes']=_[_0xc068('0x34')](_0x21d3c2[_0xc068('0x32')],qs['fields'](_0x420cb0[_0xc068('0x35')][_0xc068('0x36')]));_0x299030[_0xc068('0x37')]=_0x299030[_0xc068('0x37')][_0xc068('0x38')]?_0x299030[_0xc068('0x37')]:_0x21d3c2[_0xc068('0x32')];if(_0x420cb0[_0xc068('0x35')][_0xc068('0x41')]){_0x299030[_0xc068('0x42')]=[{'all':!![]}];}_0x299030=_[_0xc068('0x3e')]({},_0x299030,_0x420cb0[_0xc068('0x3f')]);return db[_0xc068('0x2d')]['find'](_0x299030)['then'](handleEntityNotFound(_0x357c92,null))[_0xc068('0x25')](respondWithResult(_0x357c92,null))[_0xc068('0x45')](handleError(_0x357c92,null));};exports[_0xc068('0x49')]=function(_0x587a6b,_0x26c823){return db[_0xc068('0x2d')][_0xc068('0x49')](_0x587a6b[_0xc068('0x4a')],{})['then'](respondWithResult(_0x26c823,0xc9))[_0xc068('0x45')](handleError(_0x26c823,null));};exports[_0xc068('0x24')]=function(_0x358c60,_0x52bd61){if(_0x358c60[_0xc068('0x4a')]['id']){delete _0x358c60[_0xc068('0x4a')]['id'];}return db[_0xc068('0x2d')][_0xc068('0x4b')]({'where':{'id':_0x358c60[_0xc068('0x47')]['id']}})[_0xc068('0x25')](handleEntityNotFound(_0x52bd61,null))[_0xc068('0x25')](saveUpdates(_0x358c60[_0xc068('0x4a')],null))[_0xc068('0x25')](respondWithResult(_0x52bd61,null))[_0xc068('0x45')](handleError(_0x52bd61,null));};exports[_0xc068('0x26')]=function(_0x2c8eb0,_0x32731f){return db['OpenchannelQueueReport'][_0xc068('0x4b')]({'where':{'id':_0x2c8eb0[_0xc068('0x47')]['id']}})[_0xc068('0x25')](handleEntityNotFound(_0x32731f,null))['then'](removeEntity(_0x32731f,null))[_0xc068('0x45')](handleError(_0x32731f,null));};exports[_0xc068('0x4c')]=function(_0x17fe8a,_0x2b9092){return db[_0xc068('0x2d')][_0xc068('0x4c')]()[_0xc068('0x25')](respondWithResult(_0x2b9092,null))[_0xc068('0x45')](handleError(_0x2b9092,null));}; \ No newline at end of file +var _0x2a49=['then','destroy','end','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','count','include','findAll','catch','show','includeAll','find','create','body','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','set','apply','save','update'];(function(_0x3ebd75,_0x28dcfb){var _0x47a6a0=function(_0x44078b){while(--_0x44078b){_0x3ebd75['push'](_0x3ebd75['shift']());}};_0x47a6a0(++_0x28dcfb);}(_0x2a49,0x77));var _0x92a4=function(_0x5d58c7,_0x4102a8){_0x5d58c7=_0x5d58c7-0x0;var _0x400089=_0x2a49[_0x5d58c7];return _0x400089;};'use strict';var pdf=require(_0x92a4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x92a4('0x1'));var zipdir=require(_0x92a4('0x2'));var jsonpatch=require(_0x92a4('0x3'));var rp=require(_0x92a4('0x4'));var moment=require('moment');var BPromise=require(_0x92a4('0x5'));var Mustache=require(_0x92a4('0x6'));var util=require(_0x92a4('0x7'));var path=require(_0x92a4('0x8'));var sox=require(_0x92a4('0x9'));var csv=require(_0x92a4('0xa'));var ejs=require(_0x92a4('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x92a4('0xc'));var squel=require(_0x92a4('0xd'));var crypto=require('crypto');var jsforce=require(_0x92a4('0xe'));var deskjs=require(_0x92a4('0xf'));var toCsv=require(_0x92a4('0xa'));var querystring=require(_0x92a4('0x10'));var Papa=require(_0x92a4('0x11'));var Redis=require('ioredis');var authService=require(_0x92a4('0x12'));var qs=require(_0x92a4('0x13'));var as=require(_0x92a4('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x92a4('0x15'))(_0x92a4('0x16'));var utils=require(_0x92a4('0x17'));var config=require(_0x92a4('0x18'));var licenseUtil=require(_0x92a4('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ff19e,_0x73afa9){_0x73afa9=_0x73afa9||0xcc;return function(_0x4b5239){if(_0x4b5239){return _0x3ff19e[_0x92a4('0x1a')](_0x73afa9);}return _0x3ff19e[_0x92a4('0x1b')](_0x73afa9)['end']();};}function respondWithResult(_0x5a21e7,_0x586c92){_0x586c92=_0x586c92||0xc8;return function(_0x2bd14c){if(_0x2bd14c){return _0x5a21e7['status'](_0x586c92)[_0x92a4('0x1c')](_0x2bd14c);}};}function respondWithFilteredResult(_0x1f554d,_0x4ddb01){return function(_0x3a01e2){if(_0x3a01e2){var _0x2bfcbc=_0x3a01e2['count'],_0x57f350=_0x4ddb01['offset'],_0x109297=_0x4ddb01[_0x92a4('0x1d')]+_0x4ddb01[_0x92a4('0x1e')],_0x545154;if(_0x109297>=_0x2bfcbc){_0x109297=_0x2bfcbc;_0x545154=0xc8;}else{_0x545154=0xce;}_0x1f554d[_0x92a4('0x1b')](_0x545154);return _0x1f554d[_0x92a4('0x1f')]('Content-Range',_0x57f350+'-'+_0x109297+'/'+_0x2bfcbc)[_0x92a4('0x1c')](_0x3a01e2);}return null;};}function patchUpdates(_0x49b883){return function(_0x33bc0c){try{jsonpatch[_0x92a4('0x20')](_0x33bc0c,_0x49b883,!![]);}catch(_0x26b65b){return BPromise['reject'](_0x26b65b);}return _0x33bc0c[_0x92a4('0x21')]();};}function saveUpdates(_0x1e4910,_0x39fa79){return function(_0x34e8e6){if(_0x34e8e6){return _0x34e8e6[_0x92a4('0x22')](_0x1e4910)[_0x92a4('0x23')](function(_0x13f500){return _0x13f500;});}return null;};}function removeEntity(_0x1219cc,_0x66b747){return function(_0x55de63){if(_0x55de63){return _0x55de63[_0x92a4('0x24')]()[_0x92a4('0x23')](function(){_0x1219cc['status'](0xcc)[_0x92a4('0x25')]();});}};}function handleEntityNotFound(_0x1a1bd0,_0x13df63){return function(_0xc0ee7f){if(!_0xc0ee7f){_0x1a1bd0[_0x92a4('0x1a')](0x194);}return _0xc0ee7f;};}function handleError(_0xca119b,_0x3bc17f){_0x3bc17f=_0x3bc17f||0x1f4;return function(_0x3c62a9){logger[_0x92a4('0x26')](_0x3c62a9[_0x92a4('0x27')]);if(_0x3c62a9[_0x92a4('0x28')]){delete _0x3c62a9[_0x92a4('0x28')];}_0xca119b['status'](_0x3bc17f)[_0x92a4('0x29')](_0x3c62a9);};}exports[_0x92a4('0x2a')]=function(_0x3f0554,_0x336f42){var _0xbaabb5={},_0x1d2a54={},_0x518537={'count':0x0,'rows':[]};var _0x76df04=_[_0x92a4('0x2b')](db[_0x92a4('0x2c')][_0x92a4('0x2d')],function(_0x32767c){return{'name':_0x32767c[_0x92a4('0x2e')],'type':_0x32767c[_0x92a4('0x2f')][_0x92a4('0x30')]};});_0x1d2a54[_0x92a4('0x31')]=_['map'](_0x76df04,'name');_0x1d2a54[_0x92a4('0x32')]=_[_0x92a4('0x33')](_0x3f0554[_0x92a4('0x32')]);_0x1d2a54[_0x92a4('0x34')]=_['intersection'](_0x1d2a54['model'],_0x1d2a54['query']);_0xbaabb5[_0x92a4('0x35')]=_[_0x92a4('0x36')](_0x1d2a54['model'],qs[_0x92a4('0x37')](_0x3f0554['query'][_0x92a4('0x37')]));_0xbaabb5[_0x92a4('0x35')]=_0xbaabb5[_0x92a4('0x35')][_0x92a4('0x38')]?_0xbaabb5['attributes']:_0x1d2a54['model'];if(!_0x3f0554[_0x92a4('0x32')][_0x92a4('0x39')]('nolimit')){_0xbaabb5[_0x92a4('0x1e')]=qs[_0x92a4('0x1e')](_0x3f0554[_0x92a4('0x32')][_0x92a4('0x1e')]);_0xbaabb5[_0x92a4('0x1d')]=qs[_0x92a4('0x1d')](_0x3f0554['query'][_0x92a4('0x1d')]);}_0xbaabb5[_0x92a4('0x3a')]=qs[_0x92a4('0x3b')](_0x3f0554['query']['sort']);_0xbaabb5[_0x92a4('0x3c')]=qs[_0x92a4('0x34')](_[_0x92a4('0x3d')](_0x3f0554[_0x92a4('0x32')],_0x1d2a54[_0x92a4('0x34')]),_0x76df04);if(_0x3f0554['query'][_0x92a4('0x3e')]){_0xbaabb5[_0x92a4('0x3c')]=_['merge'](_0xbaabb5[_0x92a4('0x3c')],{'$or':_['map'](_0x76df04,function(_0x5ab2c8){if(_0x5ab2c8['type']!==_0x92a4('0x3f')){var _0xe5657c={};_0xe5657c[_0x5ab2c8['name']]={'$like':'%'+_0x3f0554['query']['filter']+'%'};return _0xe5657c;}})});}_0xbaabb5=_[_0x92a4('0x40')]({},_0xbaabb5,_0x3f0554[_0x92a4('0x41')]);var _0x573306={'where':_0xbaabb5[_0x92a4('0x3c')]};return db['OpenchannelQueueReport'][_0x92a4('0x42')](_0x573306)[_0x92a4('0x23')](function(_0x530b25){_0x518537[_0x92a4('0x42')]=_0x530b25;if(_0x3f0554[_0x92a4('0x32')]['includeAll']){_0xbaabb5[_0x92a4('0x43')]=[{'all':!![]}];}return db[_0x92a4('0x2c')][_0x92a4('0x44')](_0xbaabb5);})['then'](function(_0x26d82a){_0x518537['rows']=_0x26d82a;return _0x518537;})[_0x92a4('0x23')](respondWithFilteredResult(_0x336f42,_0xbaabb5))[_0x92a4('0x45')](handleError(_0x336f42,null));};exports[_0x92a4('0x46')]=function(_0x5a26cb,_0x166c23){var _0xc1b760={'raw':!![],'where':{'id':_0x5a26cb['params']['id']}},_0x317d0b={};_0x317d0b[_0x92a4('0x31')]=_[_0x92a4('0x33')](db[_0x92a4('0x2c')][_0x92a4('0x2d')]);_0x317d0b[_0x92a4('0x32')]=_[_0x92a4('0x33')](_0x5a26cb[_0x92a4('0x32')]);_0x317d0b[_0x92a4('0x34')]=_[_0x92a4('0x36')](_0x317d0b[_0x92a4('0x31')],_0x317d0b[_0x92a4('0x32')]);_0xc1b760[_0x92a4('0x35')]=_['intersection'](_0x317d0b['model'],qs['fields'](_0x5a26cb[_0x92a4('0x32')][_0x92a4('0x37')]));_0xc1b760['attributes']=_0xc1b760[_0x92a4('0x35')][_0x92a4('0x38')]?_0xc1b760[_0x92a4('0x35')]:_0x317d0b['model'];if(_0x5a26cb[_0x92a4('0x32')][_0x92a4('0x47')]){_0xc1b760[_0x92a4('0x43')]=[{'all':!![]}];}_0xc1b760=_[_0x92a4('0x40')]({},_0xc1b760,_0x5a26cb[_0x92a4('0x41')]);return db[_0x92a4('0x2c')][_0x92a4('0x48')](_0xc1b760)[_0x92a4('0x23')](handleEntityNotFound(_0x166c23,null))[_0x92a4('0x23')](respondWithResult(_0x166c23,null))['catch'](handleError(_0x166c23,null));};exports['create']=function(_0x335367,_0x34c45d){return db[_0x92a4('0x2c')][_0x92a4('0x49')](_0x335367[_0x92a4('0x4a')],{})[_0x92a4('0x23')](respondWithResult(_0x34c45d,0xc9))[_0x92a4('0x45')](handleError(_0x34c45d,null));};exports[_0x92a4('0x22')]=function(_0x4a4dfd,_0x21d59d){if(_0x4a4dfd[_0x92a4('0x4a')]['id']){delete _0x4a4dfd[_0x92a4('0x4a')]['id'];}return db['OpenchannelQueueReport'][_0x92a4('0x48')]({'where':{'id':_0x4a4dfd[_0x92a4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x21d59d,null))[_0x92a4('0x23')](saveUpdates(_0x4a4dfd['body'],null))[_0x92a4('0x23')](respondWithResult(_0x21d59d,null))[_0x92a4('0x45')](handleError(_0x21d59d,null));};exports[_0x92a4('0x24')]=function(_0x1f5eb5,_0x91c5f9){return db[_0x92a4('0x2c')][_0x92a4('0x48')]({'where':{'id':_0x1f5eb5[_0x92a4('0x4b')]['id']}})[_0x92a4('0x23')](handleEntityNotFound(_0x91c5f9,null))[_0x92a4('0x23')](removeEntity(_0x91c5f9,null))[_0x92a4('0x45')](handleError(_0x91c5f9,null));};exports[_0x92a4('0x4c')]=function(_0x181e71,_0x382c70){return db['OpenchannelQueueReport'][_0x92a4('0x4c')]()[_0x92a4('0x23')](respondWithResult(_0x382c70,null))[_0x92a4('0x45')](handleError(_0x382c70,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index a4370e9..13ace53 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 _0x89bf=['request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','../../config/logger','moment'];(function(_0x1124fd,_0x5c4a0a){var _0x3d6f72=function(_0x159550){while(--_0x159550){_0x1124fd['push'](_0x1124fd['shift']());}};_0x3d6f72(++_0x5c4a0a);}(_0x89bf,0x11d));var _0xf89b=function(_0x1c48c4,_0x19e4e1){_0x1c48c4=_0x1c48c4-0x0;var _0x4fa846=_0x89bf[_0x1c48c4];return _0x4fa846;};'use strict';var _=require(_0xf89b('0x0'));var util=require('util');var logger=require(_0xf89b('0x1'))('api');var moment=require(_0xf89b('0x2'));var BPromise=require('bluebird');var rp=require(_0xf89b('0x3'));var fs=require('fs');var path=require(_0xf89b('0x4'));var rimraf=require('rimraf');var config=require(_0xf89b('0x5'));var attributes=require(_0xf89b('0x6'));module[_0xf89b('0x7')]=function(_0x2fa0a2,_0x26a35a){return _0x2fa0a2[_0xf89b('0x8')](_0xf89b('0x9'),attributes,{'tableName':_0xf89b('0xa'),'paranoid':![],'indexes':[{'name':_0xf89b('0xb'),'fields':[_0xf89b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xac22=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid'];(function(_0x202b05,_0x5a246c){var _0x22a0a7=function(_0x5157f2){while(--_0x5157f2){_0x202b05['push'](_0x202b05['shift']());}};_0x22a0a7(++_0x5a246c);}(_0xac22,0x138));var _0x2ac2=function(_0x550c35,_0x4cfaf3){_0x550c35=_0x550c35-0x0;var _0x586717=_0xac22[_0x550c35];return _0x586717;};'use strict';var _=require('lodash');var util=require(_0x2ac2('0x0'));var logger=require(_0x2ac2('0x1'))(_0x2ac2('0x2'));var moment=require(_0x2ac2('0x3'));var BPromise=require(_0x2ac2('0x4'));var rp=require(_0x2ac2('0x5'));var fs=require('fs');var path=require(_0x2ac2('0x6'));var rimraf=require('rimraf');var config=require(_0x2ac2('0x7'));var attributes=require(_0x2ac2('0x8'));module[_0x2ac2('0x9')]=function(_0x54943c,_0xd807b2){return _0x54943c[_0x2ac2('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x2ac2('0xb'),'paranoid':![],'indexes':[{'name':_0x2ac2('0xc'),'fields':[_0x2ac2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 56fe374..1be62c6 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 _0x83cf=['request','then','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','catch','UpdateOpenchannelQueueReport','where','attributes','limit','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x23ac3c,_0x25ab5e){var _0x25e6a5=function(_0x251667){while(--_0x251667){_0x23ac3c['push'](_0x23ac3c['shift']());}};_0x25e6a5(++_0x25ab5e);}(_0x83cf,0xb7));var _0xf83c=function(_0x2f7bab,_0x5ef284){_0x2f7bab=_0x2f7bab-0x0;var _0x450cae=_0x83cf[_0x2f7bab];return _0x450cae;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf83c('0x0'));var BPromise=require(_0xf83c('0x1'));var rs=require(_0xf83c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf83c('0x3'))['db'];var utils=require(_0xf83c('0x4'));var logger=require(_0xf83c('0x5'))('rpc');var config=require(_0xf83c('0x6'));var jayson=require(_0xf83c('0x7'));var client=jayson['client'][_0xf83c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45495c,_0x430c55,_0x39d3c7){return new BPromise(function(_0x405702,_0x4488ed){return client[_0xf83c('0x9')](_0x45495c,_0x39d3c7)[_0xf83c('0xa')](function(_0x4a9e54){logger['info'](_0xf83c('0xb'),_0x430c55,'request\x20sent');logger[_0xf83c('0xc')](_0xf83c('0xd'),_0x430c55,_0xf83c('0xe'),JSON[_0xf83c('0xf')](_0x4a9e54));if(_0x4a9e54[_0xf83c('0x10')]){if(_0x4a9e54[_0xf83c('0x10')][_0xf83c('0x11')]===0x1f4){logger[_0xf83c('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x430c55,_0x4a9e54[_0xf83c('0x10')][_0xf83c('0x12')]);return _0x4488ed(_0x4a9e54[_0xf83c('0x10')][_0xf83c('0x12')]);}logger[_0xf83c('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x430c55,_0x4a9e54['error'][_0xf83c('0x12')]);return _0x405702(_0x4a9e54['error'][_0xf83c('0x12')]);}else{logger[_0xf83c('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x430c55,'request\x20sent');_0x405702(_0x4a9e54[_0xf83c('0x14')][_0xf83c('0x12')]);}})['catch'](function(_0x17f11c){logger['error'](_0xf83c('0xb'),_0x430c55,_0x17f11c);_0x4488ed(_0x17f11c);});});}exports[_0xf83c('0x15')]=function(_0x2c524c){var _0x318ff9=this;return new Promise(function(_0x2b1466,_0x3b5d0c){return db[_0xf83c('0x16')][_0xf83c('0x17')](_0x2c524c[_0xf83c('0x18')],{'raw':_0x2c524c[_0xf83c('0x19')]?_0x2c524c['options'][_0xf83c('0x1a')]===undefined?!![]:![]:!![]})[_0xf83c('0xa')](function(_0x36cb05){logger[_0xf83c('0x13')]('CreateOpenchannelQueueReport',_0x2c524c);logger[_0xf83c('0xc')](_0xf83c('0x15'),_0x2c524c,JSON[_0xf83c('0xf')](_0x36cb05));_0x2b1466(_0x36cb05);})[_0xf83c('0x1b')](function(_0x2828e2){logger[_0xf83c('0x10')]('CreateOpenchannelQueueReport',_0x2828e2[_0xf83c('0x12')],_0x2c524c);_0x3b5d0c(_0x318ff9['error'](0x1f4,_0x2828e2[_0xf83c('0x12')]));});});};exports[_0xf83c('0x1c')]=function(_0x526bde){var _0x4cf17a=this;return new Promise(function(_0x1ed738,_0x46ac74){return db[_0xf83c('0x16')]['update'](_0x526bde['body'],{'raw':_0x526bde[_0xf83c('0x19')]?_0x526bde[_0xf83c('0x19')][_0xf83c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x526bde[_0xf83c('0x19')]?_0x526bde['options'][_0xf83c('0x1d')]||null:null,'attributes':_0x526bde[_0xf83c('0x19')]?_0x526bde[_0xf83c('0x19')][_0xf83c('0x1e')]||null:null,'limit':_0x526bde[_0xf83c('0x19')]?_0x526bde[_0xf83c('0x19')][_0xf83c('0x1f')]||null:null})[_0xf83c('0xa')](function(_0xa2d814){logger[_0xf83c('0x13')](_0xf83c('0x1c'),_0x526bde);logger[_0xf83c('0xc')](_0xf83c('0x1c'),_0x526bde,JSON['stringify'](_0xa2d814));_0x1ed738(_0xa2d814);})[_0xf83c('0x1b')](function(_0xbc2180){logger['error']('UpdateOpenchannelQueueReport',_0xbc2180['message'],_0x526bde);_0x46ac74(_0x4cf17a[_0xf83c('0x10')](0x1f4,_0xbc2180['message']));});});}; \ No newline at end of file +var _0xfb23=['request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','OpenchannelQueueReport','body','options','CreateOpenchannelQueueReport','debug','UpdateOpenchannelQueueReport','update','raw','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1721be,_0x4e2a86){var _0xf9507a=function(_0x20850d){while(--_0x20850d){_0x1721be['push'](_0x1721be['shift']());}};_0xf9507a(++_0x4e2a86);}(_0xfb23,0x195));var _0x3fb2=function(_0x16aaa6,_0x1bbd90){_0x16aaa6=_0x16aaa6-0x0;var _0x4ecf6b=_0xfb23[_0x16aaa6];return _0x4ecf6b;};'use strict';var _=require(_0x3fb2('0x0'));var util=require('util');var moment=require(_0x3fb2('0x1'));var BPromise=require(_0x3fb2('0x2'));var rs=require(_0x3fb2('0x3'));var fs=require('fs');var Redis=require(_0x3fb2('0x4'));var db=require(_0x3fb2('0x5'))['db'];var utils=require(_0x3fb2('0x6'));var logger=require(_0x3fb2('0x7'))('rpc');var config=require(_0x3fb2('0x8'));var jayson=require(_0x3fb2('0x9'));var client=jayson[_0x3fb2('0xa')][_0x3fb2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30c37e,_0xd2996b,_0x19a335){return new BPromise(function(_0x2e748c,_0x3e199a){return client[_0x3fb2('0xc')](_0x30c37e,_0x19a335)[_0x3fb2('0xd')](function(_0x5b8591){logger[_0x3fb2('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xd2996b,_0x3fb2('0xf'));logger['debug'](_0x3fb2('0x10'),_0xd2996b,_0x3fb2('0xf'),JSON[_0x3fb2('0x11')](_0x5b8591));if(_0x5b8591[_0x3fb2('0x12')]){if(_0x5b8591[_0x3fb2('0x12')][_0x3fb2('0x13')]===0x1f4){logger[_0x3fb2('0x12')](_0x3fb2('0x14'),_0xd2996b,_0x5b8591[_0x3fb2('0x12')]['message']);return _0x3e199a(_0x5b8591['error'][_0x3fb2('0x15')]);}logger[_0x3fb2('0x12')](_0x3fb2('0x14'),_0xd2996b,_0x5b8591['error'][_0x3fb2('0x15')]);return _0x2e748c(_0x5b8591[_0x3fb2('0x12')]['message']);}else{logger[_0x3fb2('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xd2996b,_0x3fb2('0xf'));_0x2e748c(_0x5b8591[_0x3fb2('0x16')][_0x3fb2('0x15')]);}})[_0x3fb2('0x17')](function(_0x4a7503){logger[_0x3fb2('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xd2996b,_0x4a7503);_0x3e199a(_0x4a7503);});});}exports['CreateOpenchannelQueueReport']=function(_0x29adbc){var _0x50d0f8=this;return new Promise(function(_0x4018dc,_0x486d57){return db[_0x3fb2('0x18')]['create'](_0x29adbc[_0x3fb2('0x19')],{'raw':_0x29adbc['options']?_0x29adbc[_0x3fb2('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x3fb2('0xd')](function(_0x7e34bd){logger[_0x3fb2('0xe')](_0x3fb2('0x1b'),_0x29adbc);logger[_0x3fb2('0x1c')]('CreateOpenchannelQueueReport',_0x29adbc,JSON[_0x3fb2('0x11')](_0x7e34bd));_0x4018dc(_0x7e34bd);})['catch'](function(_0x1e8c26){logger[_0x3fb2('0x12')](_0x3fb2('0x1b'),_0x1e8c26[_0x3fb2('0x15')],_0x29adbc);_0x486d57(_0x50d0f8[_0x3fb2('0x12')](0x1f4,_0x1e8c26[_0x3fb2('0x15')]));});});};exports[_0x3fb2('0x1d')]=function(_0x132f75){var _0x1e573e=this;return new Promise(function(_0x35a43c,_0x44b410){return db['OpenchannelQueueReport'][_0x3fb2('0x1e')](_0x132f75[_0x3fb2('0x19')],{'raw':_0x132f75['options']?_0x132f75[_0x3fb2('0x1a')][_0x3fb2('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x132f75['options']?_0x132f75[_0x3fb2('0x1a')][_0x3fb2('0x20')]||null:null,'attributes':_0x132f75[_0x3fb2('0x1a')]?_0x132f75['options'][_0x3fb2('0x21')]||null:null,'limit':_0x132f75[_0x3fb2('0x1a')]?_0x132f75[_0x3fb2('0x1a')][_0x3fb2('0x22')]||null:null})[_0x3fb2('0xd')](function(_0x3fbe48){logger[_0x3fb2('0xe')]('UpdateOpenchannelQueueReport',_0x132f75);logger[_0x3fb2('0x1c')](_0x3fb2('0x1d'),_0x132f75,JSON[_0x3fb2('0x11')](_0x3fbe48));_0x35a43c(_0x3fbe48);})[_0x3fb2('0x17')](function(_0xaa7c9a){logger[_0x3fb2('0x12')](_0x3fb2('0x1d'),_0xaa7c9a['message'],_0x132f75);_0x44b410(_0x1e573e[_0x3fb2('0x12')](0x1f4,_0xaa7c9a['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 5ef1661..077accf 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 _0x5c59=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','delete','destroy'];(function(_0x5303c9,_0x1997d4){var _0x14be90=function(_0x42a012){while(--_0x42a012){_0x5303c9['push'](_0x5303c9['shift']());}};_0x14be90(++_0x1997d4);}(_0x5c59,0x18d));var _0x95c5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5c59[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x95c5('0x0'));var util=require(_0x95c5('0x1'));var path=require(_0x95c5('0x2'));var timeout=require(_0x95c5('0x3'));var express=require('express');var router=express[_0x95c5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x95c5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x95c5('0x6'));var controller=require(_0x95c5('0x7'));router[_0x95c5('0x8')]('/',auth[_0x95c5('0x9')](),controller[_0x95c5('0xa')]);router[_0x95c5('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x95c5('0xb')]);router[_0x95c5('0x8')](_0x95c5('0xc'),auth['isAuthenticated'](),controller[_0x95c5('0xd')]);router[_0x95c5('0xe')]('/',auth[_0x95c5('0x9')](),controller['create']);router['put'](_0x95c5('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x95c5('0xf')](_0x95c5('0xc'),auth[_0x95c5('0x9')](),controller[_0x95c5('0x10')]);module[_0x95c5('0x11')]=router; \ No newline at end of file +var _0x1acd=['show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','index','isAuthenticated','/:id'];(function(_0xcf1a64,_0x32ef53){var _0x5c70b0=function(_0x1dbbac){while(--_0x1dbbac){_0xcf1a64['push'](_0xcf1a64['shift']());}};_0x5c70b0(++_0x32ef53);}(_0x1acd,0x10c));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(_0xd1ac('0x3'));var router=express['Router']();var fs_extra=require(_0xd1ac('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd1ac('0x5'));var config=require(_0xd1ac('0x6'));var controller=require(_0xd1ac('0x7'));router[_0xd1ac('0x8')]('/',auth['isAuthenticated'](),controller[_0xd1ac('0x9')]);router['get']('/describe',auth[_0xd1ac('0xa')](),controller['describe']);router[_0xd1ac('0x8')](_0xd1ac('0xb'),auth['isAuthenticated'](),controller[_0xd1ac('0xc')]);router[_0xd1ac('0xd')]('/',auth['isAuthenticated'](),controller[_0xd1ac('0xe')]);router[_0xd1ac('0xf')](_0xd1ac('0xb'),auth['isAuthenticated'](),controller[_0xd1ac('0x10')]);router[_0xd1ac('0x11')]('/:id',auth[_0xd1ac('0xa')](),controller[_0xd1ac('0x12')]);module[_0xd1ac('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 04e2da1..4da7027 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 _0xd5a0=['agent','NOW','moment','sequelize','exports','STRING','ENUM','account'];(function(_0xb4136a,_0x1828a7){var _0x2ef6e8=function(_0x27a0d2){while(--_0x27a0d2){_0xb4136a['push'](_0xb4136a['shift']());}};_0x2ef6e8(++_0x1828a7);}(_0xd5a0,0xf2));var _0x0d5a=function(_0x4274b0,_0x2e069c){_0x4274b0=_0x4274b0-0x0;var _0x2625df=_0xd5a0[_0x4274b0];return _0x2625df;};'use strict';var moment=require(_0x0d5a('0x0'));var Sequelize=require(_0x0d5a('0x1'));module[_0x0d5a('0x2')]={'uniqueid':{'type':Sequelize[_0x0d5a('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x0d5a('0x4')](_0x0d5a('0x5'),_0x0d5a('0x6'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x0d5a('0x7')]}}; \ No newline at end of file +var _0xfe0b=['sequelize','exports','STRING','ENUM','account','queue','DATE','NOW'];(function(_0x5d506b,_0x41b1ca){var _0x2a8f24=function(_0x12821c){while(--_0x12821c){_0x5d506b['push'](_0x5d506b['shift']());}};_0x2a8f24(++_0x41b1ca);}(_0xfe0b,0x78));var _0xbfe0=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xfe0b[_0x19e35c];return _0x3e1fe8;};'use strict';var moment=require('moment');var Sequelize=require(_0xbfe0('0x0'));module[_0xbfe0('0x1')]={'uniqueid':{'type':Sequelize[_0xbfe0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbfe0('0x3')](_0xbfe0('0x4'),'agent',_0xbfe0('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xbfe0('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbfe0('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index c478ec8..8b52d9a 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 _0x1be7=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','stack','index','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','map','name','query','keys','intersection','attributes','fields','length','nolimit','order','filters','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x29e09a,_0x33a8be){var _0x12f57b=function(_0x4fbb51){while(--_0x4fbb51){_0x29e09a['push'](_0x29e09a['shift']());}};_0x12f57b(++_0x33a8be);}(_0x1be7,0x111));var _0x71be=function(_0x23fa5d,_0x356419){_0x23fa5d=_0x23fa5d-0x0;var _0x43f2b0=_0x1be7[_0x23fa5d];return _0x43f2b0;};'use strict';var pdf=require(_0x71be('0x0'));var emlformat=require(_0x71be('0x1'));var rimraf=require(_0x71be('0x2'));var zipdir=require(_0x71be('0x3'));var jsonpatch=require(_0x71be('0x4'));var rp=require(_0x71be('0x5'));var moment=require(_0x71be('0x6'));var BPromise=require(_0x71be('0x7'));var Mustache=require(_0x71be('0x8'));var util=require(_0x71be('0x9'));var path=require('path');var sox=require(_0x71be('0xa'));var csv=require(_0x71be('0xb'));var ejs=require(_0x71be('0xc'));var fs=require('fs');var fs_extra=require(_0x71be('0xd'));var _=require(_0x71be('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x71be('0xf'));var deskjs=require(_0x71be('0x10'));var toCsv=require(_0x71be('0xb'));var querystring=require(_0x71be('0x11'));var Papa=require(_0x71be('0x12'));var Redis=require(_0x71be('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x71be('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x71be('0x15'))(_0x71be('0x16'));var utils=require(_0x71be('0x17'));var config=require(_0x71be('0x18'));var licenseUtil=require(_0x71be('0x19'));var db=require(_0x71be('0x1a'))['db'];function respondWithStatusCode(_0xd901e2,_0x34419c){_0x34419c=_0x34419c||0xcc;return function(_0x35abcb){if(_0x35abcb){return _0xd901e2[_0x71be('0x1b')](_0x34419c);}return _0xd901e2['status'](_0x34419c)[_0x71be('0x1c')]();};}function respondWithResult(_0x1eefaf,_0x3a8417){_0x3a8417=_0x3a8417||0xc8;return function(_0x27b80f){if(_0x27b80f){return _0x1eefaf[_0x71be('0x1d')](_0x3a8417)[_0x71be('0x1e')](_0x27b80f);}};}function respondWithFilteredResult(_0x35ac44,_0x2beae5){return function(_0x2427a3){if(_0x2427a3){var _0x3dc5a8=_0x2427a3[_0x71be('0x1f')],_0x6655f2=_0x2beae5[_0x71be('0x20')],_0x2726e4=_0x2beae5[_0x71be('0x20')]+_0x2beae5[_0x71be('0x21')],_0x15de7f;if(_0x2726e4>=_0x3dc5a8){_0x2726e4=_0x3dc5a8;_0x15de7f=0xc8;}else{_0x15de7f=0xce;}_0x35ac44[_0x71be('0x1d')](_0x15de7f);return _0x35ac44[_0x71be('0x22')](_0x71be('0x23'),_0x6655f2+'-'+_0x2726e4+'/'+_0x3dc5a8)[_0x71be('0x1e')](_0x2427a3);}return null;};}function patchUpdates(_0x50ad9d){return function(_0x3e5e5c){try{jsonpatch[_0x71be('0x24')](_0x3e5e5c,_0x50ad9d,!![]);}catch(_0x27f1a8){return BPromise['reject'](_0x27f1a8);}return _0x3e5e5c[_0x71be('0x25')]();};}function saveUpdates(_0x242ce4,_0x43c749){return function(_0x1095a9){if(_0x1095a9){return _0x1095a9['update'](_0x242ce4)[_0x71be('0x26')](function(_0x31fd5e){return _0x31fd5e;});}return null;};}function removeEntity(_0x599871,_0x8f772c){return function(_0x1a339b){if(_0x1a339b){return _0x1a339b[_0x71be('0x27')]()['then'](function(){_0x599871[_0x71be('0x1d')](0xcc)[_0x71be('0x1c')]();});}};}function handleEntityNotFound(_0x508d09,_0x276f8f){return function(_0x5bbd17){if(!_0x5bbd17){_0x508d09['sendStatus'](0x194);}return _0x5bbd17;};}function handleError(_0x28ee6a,_0x10a9af){_0x10a9af=_0x10a9af||0x1f4;return function(_0x205bc8){logger['error'](_0x205bc8[_0x71be('0x28')]);if(_0x205bc8['name']){delete _0x205bc8['name'];}_0x28ee6a[_0x71be('0x1d')](_0x10a9af)['send'](_0x205bc8);};}exports[_0x71be('0x29')]=function(_0x516c60,_0x4e6ca7){var _0x756c55={},_0x27e85d={},_0x4ee1f2={'count':0x0,'rows':[]};var _0x36ad77=_['map'](db[_0x71be('0x2a')][_0x71be('0x2b')],function(_0x1ef442){return{'name':_0x1ef442[_0x71be('0x2c')],'type':_0x1ef442[_0x71be('0x2d')][_0x71be('0x2e')]};});_0x27e85d[_0x71be('0x2f')]=_[_0x71be('0x30')](_0x36ad77,_0x71be('0x31'));_0x27e85d[_0x71be('0x32')]=_[_0x71be('0x33')](_0x516c60['query']);_0x27e85d['filters']=_[_0x71be('0x34')](_0x27e85d[_0x71be('0x2f')],_0x27e85d[_0x71be('0x32')]);_0x756c55[_0x71be('0x35')]=_[_0x71be('0x34')](_0x27e85d[_0x71be('0x2f')],qs['fields'](_0x516c60[_0x71be('0x32')][_0x71be('0x36')]));_0x756c55['attributes']=_0x756c55[_0x71be('0x35')][_0x71be('0x37')]?_0x756c55[_0x71be('0x35')]:_0x27e85d['model'];if(!_0x516c60[_0x71be('0x32')]['hasOwnProperty'](_0x71be('0x38'))){_0x756c55['limit']=qs[_0x71be('0x21')](_0x516c60[_0x71be('0x32')][_0x71be('0x21')]);_0x756c55[_0x71be('0x20')]=qs[_0x71be('0x20')](_0x516c60['query'][_0x71be('0x20')]);}_0x756c55[_0x71be('0x39')]=qs['sort'](_0x516c60['query']['sort']);_0x756c55['where']=qs[_0x71be('0x3a')](_['pick'](_0x516c60[_0x71be('0x32')],_0x27e85d[_0x71be('0x3a')]),_0x36ad77);if(_0x516c60[_0x71be('0x32')]['filter']){_0x756c55['where']=_[_0x71be('0x3b')](_0x756c55['where'],{'$or':_[_0x71be('0x30')](_0x36ad77,function(_0x28e753){if(_0x28e753[_0x71be('0x2d')]!==_0x71be('0x3c')){var _0x5e8cf2={};_0x5e8cf2[_0x28e753['name']]={'$like':'%'+_0x516c60['query']['filter']+'%'};return _0x5e8cf2;}})});}_0x756c55=_[_0x71be('0x3b')]({},_0x756c55,_0x516c60[_0x71be('0x3d')]);var _0x4aeb7a={'where':_0x756c55['where']};return db[_0x71be('0x2a')][_0x71be('0x1f')](_0x4aeb7a)[_0x71be('0x26')](function(_0x6df76d){_0x4ee1f2[_0x71be('0x1f')]=_0x6df76d;if(_0x516c60[_0x71be('0x32')][_0x71be('0x3e')]){_0x756c55[_0x71be('0x3f')]=[{'all':!![]}];}return db[_0x71be('0x2a')][_0x71be('0x40')](_0x756c55);})['then'](function(_0x16617f){_0x4ee1f2[_0x71be('0x41')]=_0x16617f;return _0x4ee1f2;})['then'](respondWithFilteredResult(_0x4e6ca7,_0x756c55))['catch'](handleError(_0x4e6ca7,null));};exports[_0x71be('0x42')]=function(_0x5589da,_0x3247e4){var _0x217d0c={'raw':!![],'where':{'id':_0x5589da[_0x71be('0x43')]['id']}},_0xefc873={};_0xefc873['model']=_[_0x71be('0x33')](db[_0x71be('0x2a')][_0x71be('0x2b')]);_0xefc873[_0x71be('0x32')]=_[_0x71be('0x33')](_0x5589da[_0x71be('0x32')]);_0xefc873[_0x71be('0x3a')]=_[_0x71be('0x34')](_0xefc873[_0x71be('0x2f')],_0xefc873[_0x71be('0x32')]);_0x217d0c[_0x71be('0x35')]=_['intersection'](_0xefc873[_0x71be('0x2f')],qs[_0x71be('0x36')](_0x5589da[_0x71be('0x32')]['fields']));_0x217d0c[_0x71be('0x35')]=_0x217d0c['attributes']['length']?_0x217d0c['attributes']:_0xefc873[_0x71be('0x2f')];if(_0x5589da[_0x71be('0x32')]['includeAll']){_0x217d0c['include']=[{'all':!![]}];}_0x217d0c=_[_0x71be('0x3b')]({},_0x217d0c,_0x5589da[_0x71be('0x3d')]);return db[_0x71be('0x2a')][_0x71be('0x44')](_0x217d0c)['then'](handleEntityNotFound(_0x3247e4,null))[_0x71be('0x26')](respondWithResult(_0x3247e4,null))[_0x71be('0x45')](handleError(_0x3247e4,null));};exports[_0x71be('0x46')]=function(_0x329a4e,_0x41b41c){return db[_0x71be('0x2a')]['create'](_0x329a4e[_0x71be('0x47')],{})['then'](respondWithResult(_0x41b41c,0xc9))['catch'](handleError(_0x41b41c,null));};exports[_0x71be('0x48')]=function(_0xdb3643,_0x58efc7){if(_0xdb3643[_0x71be('0x47')]['id']){delete _0xdb3643[_0x71be('0x47')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0xdb3643[_0x71be('0x43')]['id']}})['then'](handleEntityNotFound(_0x58efc7,null))[_0x71be('0x26')](saveUpdates(_0xdb3643[_0x71be('0x47')],null))[_0x71be('0x26')](respondWithResult(_0x58efc7,null))['catch'](handleError(_0x58efc7,null));};exports[_0x71be('0x27')]=function(_0x2df50f,_0x580169){return db['OpenchannelTransferReport'][_0x71be('0x44')]({'where':{'id':_0x2df50f[_0x71be('0x43')]['id']}})[_0x71be('0x26')](handleEntityNotFound(_0x580169,null))[_0x71be('0x26')](removeEntity(_0x580169,null))['catch'](handleError(_0x580169,null));};exports[_0x71be('0x49')]=function(_0x146460,_0x4681d8){return db[_0x71be('0x2a')][_0x71be('0x49')]()['then'](respondWithResult(_0x4681d8,null))[_0x71be('0x45')](handleError(_0x4681d8,null));}; \ No newline at end of file +var _0x58cc=['apply','update','destroy','then','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','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','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range'];(function(_0x1e82db,_0x375757){var _0x702bac=function(_0x1c412a){while(--_0x1c412a){_0x1e82db['push'](_0x1e82db['shift']());}};_0x702bac(++_0x375757);}(_0x58cc,0x7a));var _0xc58c=function(_0x10df18,_0x13338c){_0x10df18=_0x10df18-0x0;var _0x1f9a1d=_0x58cc[_0x10df18];return _0x1f9a1d;};'use strict';var pdf=require(_0xc58c('0x0'));var emlformat=require(_0xc58c('0x1'));var rimraf=require(_0xc58c('0x2'));var zipdir=require(_0xc58c('0x3'));var jsonpatch=require(_0xc58c('0x4'));var rp=require(_0xc58c('0x5'));var moment=require('moment');var BPromise=require(_0xc58c('0x6'));var Mustache=require(_0xc58c('0x7'));var util=require(_0xc58c('0x8'));var path=require(_0xc58c('0x9'));var sox=require(_0xc58c('0xa'));var csv=require(_0xc58c('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc58c('0xc'));var squel=require(_0xc58c('0xd'));var crypto=require('crypto');var jsforce=require(_0xc58c('0xe'));var deskjs=require(_0xc58c('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc58c('0x10'));var Papa=require('papaparse');var Redis=require(_0xc58c('0x11'));var authService=require(_0xc58c('0x12'));var qs=require(_0xc58c('0x13'));var as=require(_0xc58c('0x14'));var hardwareService=require(_0xc58c('0x15'));var logger=require(_0xc58c('0x16'))('api');var utils=require(_0xc58c('0x17'));var config=require(_0xc58c('0x18'));var licenseUtil=require(_0xc58c('0x19'));var db=require(_0xc58c('0x1a'))['db'];function respondWithStatusCode(_0x311dc2,_0x41ed49){_0x41ed49=_0x41ed49||0xcc;return function(_0x28f519){if(_0x28f519){return _0x311dc2[_0xc58c('0x1b')](_0x41ed49);}return _0x311dc2[_0xc58c('0x1c')](_0x41ed49)[_0xc58c('0x1d')]();};}function respondWithResult(_0x499235,_0x233b9c){_0x233b9c=_0x233b9c||0xc8;return function(_0x59b60a){if(_0x59b60a){return _0x499235[_0xc58c('0x1c')](_0x233b9c)[_0xc58c('0x1e')](_0x59b60a);}};}function respondWithFilteredResult(_0x3dfff5,_0x313849){return function(_0xa6b37a){if(_0xa6b37a){var _0x3fc914=_0xa6b37a[_0xc58c('0x1f')],_0x294b48=_0x313849[_0xc58c('0x20')],_0xf1601f=_0x313849['offset']+_0x313849[_0xc58c('0x21')],_0x171110;if(_0xf1601f>=_0x3fc914){_0xf1601f=_0x3fc914;_0x171110=0xc8;}else{_0x171110=0xce;}_0x3dfff5[_0xc58c('0x1c')](_0x171110);return _0x3dfff5[_0xc58c('0x22')](_0xc58c('0x23'),_0x294b48+'-'+_0xf1601f+'/'+_0x3fc914)['json'](_0xa6b37a);}return null;};}function patchUpdates(_0x43e650){return function(_0x36325b){try{jsonpatch[_0xc58c('0x24')](_0x36325b,_0x43e650,!![]);}catch(_0x4e1165){return BPromise['reject'](_0x4e1165);}return _0x36325b['save']();};}function saveUpdates(_0xcf3d26,_0x234a5b){return function(_0xae79a1){if(_0xae79a1){return _0xae79a1[_0xc58c('0x25')](_0xcf3d26)['then'](function(_0x48444f){return _0x48444f;});}return null;};}function removeEntity(_0x16ba3f,_0x284f0e){return function(_0x4b0800){if(_0x4b0800){return _0x4b0800[_0xc58c('0x26')]()[_0xc58c('0x27')](function(){_0x16ba3f[_0xc58c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4eb13a,_0x4729dd){return function(_0x1d2717){if(!_0x1d2717){_0x4eb13a[_0xc58c('0x1b')](0x194);}return _0x1d2717;};}function handleError(_0x1dd1bc,_0x5a66d8){_0x5a66d8=_0x5a66d8||0x1f4;return function(_0x293774){logger[_0xc58c('0x28')](_0x293774[_0xc58c('0x29')]);if(_0x293774[_0xc58c('0x2a')]){delete _0x293774[_0xc58c('0x2a')];}_0x1dd1bc[_0xc58c('0x1c')](_0x5a66d8)[_0xc58c('0x2b')](_0x293774);};}exports[_0xc58c('0x2c')]=function(_0x4d6ae4,_0x161c6f){var _0x2477df={},_0x402e57={},_0x585110={'count':0x0,'rows':[]};var _0x3dd9cc=_[_0xc58c('0x2d')](db[_0xc58c('0x2e')][_0xc58c('0x2f')],function(_0x4fd51d){return{'name':_0x4fd51d[_0xc58c('0x30')],'type':_0x4fd51d[_0xc58c('0x31')]['key']};});_0x402e57[_0xc58c('0x32')]=_[_0xc58c('0x2d')](_0x3dd9cc,'name');_0x402e57[_0xc58c('0x33')]=_[_0xc58c('0x34')](_0x4d6ae4[_0xc58c('0x33')]);_0x402e57[_0xc58c('0x35')]=_[_0xc58c('0x36')](_0x402e57[_0xc58c('0x32')],_0x402e57[_0xc58c('0x33')]);_0x2477df[_0xc58c('0x37')]=_[_0xc58c('0x36')](_0x402e57['model'],qs[_0xc58c('0x38')](_0x4d6ae4[_0xc58c('0x33')][_0xc58c('0x38')]));_0x2477df[_0xc58c('0x37')]=_0x2477df[_0xc58c('0x37')][_0xc58c('0x39')]?_0x2477df[_0xc58c('0x37')]:_0x402e57[_0xc58c('0x32')];if(!_0x4d6ae4['query'][_0xc58c('0x3a')](_0xc58c('0x3b'))){_0x2477df[_0xc58c('0x21')]=qs[_0xc58c('0x21')](_0x4d6ae4[_0xc58c('0x33')][_0xc58c('0x21')]);_0x2477df['offset']=qs[_0xc58c('0x20')](_0x4d6ae4[_0xc58c('0x33')][_0xc58c('0x20')]);}_0x2477df[_0xc58c('0x3c')]=qs[_0xc58c('0x3d')](_0x4d6ae4['query'][_0xc58c('0x3d')]);_0x2477df[_0xc58c('0x3e')]=qs[_0xc58c('0x35')](_[_0xc58c('0x3f')](_0x4d6ae4[_0xc58c('0x33')],_0x402e57[_0xc58c('0x35')]),_0x3dd9cc);if(_0x4d6ae4[_0xc58c('0x33')][_0xc58c('0x40')]){_0x2477df[_0xc58c('0x3e')]=_[_0xc58c('0x41')](_0x2477df[_0xc58c('0x3e')],{'$or':_[_0xc58c('0x2d')](_0x3dd9cc,function(_0x19df21){if(_0x19df21[_0xc58c('0x31')]!==_0xc58c('0x42')){var _0x2271cb={};_0x2271cb[_0x19df21[_0xc58c('0x2a')]]={'$like':'%'+_0x4d6ae4[_0xc58c('0x33')][_0xc58c('0x40')]+'%'};return _0x2271cb;}})});}_0x2477df=_[_0xc58c('0x41')]({},_0x2477df,_0x4d6ae4[_0xc58c('0x43')]);var _0x497ed1={'where':_0x2477df['where']};return db['OpenchannelTransferReport'][_0xc58c('0x1f')](_0x497ed1)[_0xc58c('0x27')](function(_0x4d9cbc){_0x585110[_0xc58c('0x1f')]=_0x4d9cbc;if(_0x4d6ae4[_0xc58c('0x33')]['includeAll']){_0x2477df[_0xc58c('0x44')]=[{'all':!![]}];}return db[_0xc58c('0x2e')][_0xc58c('0x45')](_0x2477df);})[_0xc58c('0x27')](function(_0x47676e){_0x585110[_0xc58c('0x46')]=_0x47676e;return _0x585110;})[_0xc58c('0x27')](respondWithFilteredResult(_0x161c6f,_0x2477df))[_0xc58c('0x47')](handleError(_0x161c6f,null));};exports[_0xc58c('0x48')]=function(_0x21dea0,_0x5f2bbd){var _0x321d5a={'raw':!![],'where':{'id':_0x21dea0[_0xc58c('0x49')]['id']}},_0x5e326a={};_0x5e326a[_0xc58c('0x32')]=_[_0xc58c('0x34')](db[_0xc58c('0x2e')][_0xc58c('0x2f')]);_0x5e326a['query']=_[_0xc58c('0x34')](_0x21dea0[_0xc58c('0x33')]);_0x5e326a[_0xc58c('0x35')]=_[_0xc58c('0x36')](_0x5e326a['model'],_0x5e326a['query']);_0x321d5a[_0xc58c('0x37')]=_['intersection'](_0x5e326a[_0xc58c('0x32')],qs['fields'](_0x21dea0[_0xc58c('0x33')][_0xc58c('0x38')]));_0x321d5a[_0xc58c('0x37')]=_0x321d5a[_0xc58c('0x37')][_0xc58c('0x39')]?_0x321d5a[_0xc58c('0x37')]:_0x5e326a[_0xc58c('0x32')];if(_0x21dea0[_0xc58c('0x33')][_0xc58c('0x4a')]){_0x321d5a[_0xc58c('0x44')]=[{'all':!![]}];}_0x321d5a=_[_0xc58c('0x41')]({},_0x321d5a,_0x21dea0[_0xc58c('0x43')]);return db[_0xc58c('0x2e')][_0xc58c('0x4b')](_0x321d5a)['then'](handleEntityNotFound(_0x5f2bbd,null))['then'](respondWithResult(_0x5f2bbd,null))[_0xc58c('0x47')](handleError(_0x5f2bbd,null));};exports[_0xc58c('0x4c')]=function(_0x46d25f,_0x1c72c7){return db[_0xc58c('0x2e')][_0xc58c('0x4c')](_0x46d25f[_0xc58c('0x4d')],{})[_0xc58c('0x27')](respondWithResult(_0x1c72c7,0xc9))[_0xc58c('0x47')](handleError(_0x1c72c7,null));};exports[_0xc58c('0x25')]=function(_0x1e0216,_0x315731){if(_0x1e0216[_0xc58c('0x4d')]['id']){delete _0x1e0216[_0xc58c('0x4d')]['id'];}return db['OpenchannelTransferReport'][_0xc58c('0x4b')]({'where':{'id':_0x1e0216[_0xc58c('0x49')]['id']}})[_0xc58c('0x27')](handleEntityNotFound(_0x315731,null))[_0xc58c('0x27')](saveUpdates(_0x1e0216[_0xc58c('0x4d')],null))[_0xc58c('0x27')](respondWithResult(_0x315731,null))[_0xc58c('0x47')](handleError(_0x315731,null));};exports['destroy']=function(_0x16af85,_0x577cf3){return db[_0xc58c('0x2e')]['find']({'where':{'id':_0x16af85[_0xc58c('0x49')]['id']}})[_0xc58c('0x27')](handleEntityNotFound(_0x577cf3,null))[_0xc58c('0x27')](removeEntity(_0x577cf3,null))['catch'](handleError(_0x577cf3,null));};exports['describe']=function(_0xf047ee,_0x27cd95){return db[_0xc58c('0x2e')][_0xc58c('0x4e')]()[_0xc58c('0x27')](respondWithResult(_0x27cd95,null))[_0xc58c('0x47')](handleError(_0x27cd95,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index d78b137..3d17839 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 _0xb118=['define','OpenchannelTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelTransferReport.attributes','exports'];(function(_0x2faf07,_0x2f4e58){var _0x25ba46=function(_0x210a7b){while(--_0x210a7b){_0x2faf07['push'](_0x2faf07['shift']());}};_0x25ba46(++_0x2f4e58);}(_0xb118,0x1d1));var _0x8b11=function(_0x408165,_0x5fe9b9){_0x408165=_0x408165-0x0;var _0x3979bf=_0xb118[_0x408165];return _0x3979bf;};'use strict';var _=require(_0x8b11('0x0'));var util=require(_0x8b11('0x1'));var logger=require(_0x8b11('0x2'))(_0x8b11('0x3'));var moment=require(_0x8b11('0x4'));var BPromise=require(_0x8b11('0x5'));var rp=require(_0x8b11('0x6'));var fs=require('fs');var path=require(_0x8b11('0x7'));var rimraf=require(_0x8b11('0x8'));var config=require('../../config/environment');var attributes=require(_0x8b11('0x9'));module[_0x8b11('0xa')]=function(_0x2e2b41,_0xd37f02){return _0x2e2b41[_0x8b11('0xb')](_0x8b11('0xc'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x8b11('0xd'),'fields':[_0x8b11('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xab13=['api','moment','bluebird','path','../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util','../../config/logger'];(function(_0x590851,_0x496bee){var _0x3b0115=function(_0x5140cc){while(--_0x5140cc){_0x590851['push'](_0x590851['shift']());}};_0x3b0115(++_0x496bee);}(_0xab13,0x18a));var _0x3ab1=function(_0xf3120,_0x80a54c){_0xf3120=_0xf3120-0x0;var _0x5aa549=_0xab13[_0xf3120];return _0x5aa549;};'use strict';var _=require('lodash');var util=require(_0x3ab1('0x0'));var logger=require(_0x3ab1('0x1'))(_0x3ab1('0x2'));var moment=require(_0x3ab1('0x3'));var BPromise=require(_0x3ab1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ab1('0x5'));var rimraf=require('rimraf');var config=require(_0x3ab1('0x6'));var attributes=require(_0x3ab1('0x7'));module[_0x3ab1('0x8')]=function(_0x213391,_0x5dd712){return _0x213391['define'](_0x3ab1('0x9'),attributes,{'tableName':_0x3ab1('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3ab1('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 a35e232..86c6683 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 _0x3e6d=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x64924c,_0x472da8){var _0x1b8e46=function(_0x3561fe){while(--_0x3561fe){_0x64924c['push'](_0x64924c['shift']());}};_0x1b8e46(++_0x472da8);}(_0x3e6d,0x187));var _0xd3e6=function(_0x3a733c,_0x34d4ab){_0x3a733c=_0x3a733c-0x0;var _0x370c4b=_0x3e6d[_0x3a733c];return _0x370c4b;};'use strict';var _=require('lodash');var util=require(_0xd3e6('0x0'));var moment=require(_0xd3e6('0x1'));var BPromise=require(_0xd3e6('0x2'));var rs=require(_0xd3e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd3e6('0x4'))['db'];var utils=require(_0xd3e6('0x5'));var logger=require(_0xd3e6('0x6'))(_0xd3e6('0x7'));var config=require('../../config/environment');var jayson=require(_0xd3e6('0x8'));var client=jayson[_0xd3e6('0x9')][_0xd3e6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x126e04,_0x1231ad,_0x768d4){return new BPromise(function(_0x12b32a,_0x4e1aef){return client['request'](_0x126e04,_0x768d4)[_0xd3e6('0xb')](function(_0x5468e6){logger[_0xd3e6('0xc')](_0xd3e6('0xd'),_0x1231ad,_0xd3e6('0xe'));logger['debug'](_0xd3e6('0xf'),_0x1231ad,_0xd3e6('0xe'),JSON[_0xd3e6('0x10')](_0x5468e6));if(_0x5468e6[_0xd3e6('0x11')]){if(_0x5468e6[_0xd3e6('0x11')][_0xd3e6('0x12')]===0x1f4){logger[_0xd3e6('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1231ad,_0x5468e6[_0xd3e6('0x11')][_0xd3e6('0x13')]);return _0x4e1aef(_0x5468e6[_0xd3e6('0x11')][_0xd3e6('0x13')]);}logger[_0xd3e6('0x11')](_0xd3e6('0xd'),_0x1231ad,_0x5468e6[_0xd3e6('0x11')]['message']);return _0x12b32a(_0x5468e6[_0xd3e6('0x11')]['message']);}else{logger[_0xd3e6('0xc')](_0xd3e6('0xd'),_0x1231ad,_0xd3e6('0xe'));_0x12b32a(_0x5468e6[_0xd3e6('0x14')][_0xd3e6('0x13')]);}})[_0xd3e6('0x15')](function(_0x34a117){logger[_0xd3e6('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1231ad,_0x34a117);_0x4e1aef(_0x34a117);});});} \ No newline at end of file +var _0x3713=['client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x16f9b1,_0x21450b){var _0x557675=function(_0x215576){while(--_0x215576){_0x16f9b1['push'](_0x16f9b1['shift']());}};_0x557675(++_0x21450b);}(_0x3713,0xe7));var _0x3371=function(_0x5d757c,_0x3bcb3d){_0x5d757c=_0x5d757c-0x0;var _0x44302f=_0x3713[_0x5d757c];return _0x44302f;};'use strict';var _=require(_0x3371('0x0'));var util=require('util');var moment=require(_0x3371('0x1'));var BPromise=require(_0x3371('0x2'));var rs=require(_0x3371('0x3'));var fs=require('fs');var Redis=require(_0x3371('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3371('0x5'));var logger=require(_0x3371('0x6'))('rpc');var config=require(_0x3371('0x7'));var jayson=require(_0x3371('0x8'));var client=jayson[_0x3371('0x9')][_0x3371('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26bf23,_0xd2e5fa,_0x8342ed){return new BPromise(function(_0x26f18e,_0x506a72){return client[_0x3371('0xb')](_0x26bf23,_0x8342ed)[_0x3371('0xc')](function(_0x45f661){logger[_0x3371('0xd')](_0x3371('0xe'),_0xd2e5fa,_0x3371('0xf'));logger[_0x3371('0x10')](_0x3371('0x11'),_0xd2e5fa,'request\x20sent',JSON[_0x3371('0x12')](_0x45f661));if(_0x45f661[_0x3371('0x13')]){if(_0x45f661[_0x3371('0x13')][_0x3371('0x14')]===0x1f4){logger[_0x3371('0x13')](_0x3371('0xe'),_0xd2e5fa,_0x45f661[_0x3371('0x13')][_0x3371('0x15')]);return _0x506a72(_0x45f661[_0x3371('0x13')][_0x3371('0x15')]);}logger[_0x3371('0x13')](_0x3371('0xe'),_0xd2e5fa,_0x45f661['error']['message']);return _0x26f18e(_0x45f661[_0x3371('0x13')][_0x3371('0x15')]);}else{logger[_0x3371('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s',_0xd2e5fa,_0x3371('0xf'));_0x26f18e(_0x45f661[_0x3371('0x16')]['message']);}})[_0x3371('0x17')](function(_0x1b3ce7){logger[_0x3371('0x13')](_0x3371('0xe'),_0xd2e5fa,_0x1b3ce7);_0x506a72(_0x1b3ce7);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 719d185..8ef954e 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 _0x8ac0=['show','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id'];(function(_0x78d8b7,_0x2cfc1d){var _0x5a979c=function(_0x3fee12){while(--_0x3fee12){_0x78d8b7['push'](_0x78d8b7['shift']());}};_0x5a979c(++_0x2cfc1d);}(_0x8ac0,0x1e9));var _0x08ac=function(_0x5377ca,_0x3b81d0){_0x5377ca=_0x5377ca-0x0;var _0x5c82d1=_0x8ac0[_0x5377ca];return _0x5c82d1;};'use strict';var multer=require(_0x08ac('0x0'));var util=require(_0x08ac('0x1'));var path=require(_0x08ac('0x2'));var timeout=require(_0x08ac('0x3'));var express=require(_0x08ac('0x4'));var router=express[_0x08ac('0x5')]();var fs_extra=require(_0x08ac('0x6'));var auth=require(_0x08ac('0x7'));var interaction=require(_0x08ac('0x8'));var config=require(_0x08ac('0x9'));var controller=require(_0x08ac('0xa'));router[_0x08ac('0xb')]('/',auth[_0x08ac('0xc')](),controller[_0x08ac('0xd')]);router[_0x08ac('0xb')](_0x08ac('0xe'),auth['isAuthenticated'](),controller[_0x08ac('0xf')]);router[_0x08ac('0x10')]('/',auth[_0x08ac('0xc')](),controller['create']);router[_0x08ac('0x11')](_0x08ac('0xe'),auth[_0x08ac('0xc')](),controller[_0x08ac('0x12')]);router[_0x08ac('0x13')]('/:id',auth[_0x08ac('0xc')](),controller[_0x08ac('0x14')]);module['exports']=router; \ No newline at end of file +var _0x72d1=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x72d1,0xc0));var _0x172d=function(_0x43e2e4,_0x4ad3b4){_0x43e2e4=_0x43e2e4-0x0;var _0x1b71d0=_0x72d1[_0x43e2e4];return _0x1b71d0;};'use strict';var multer=require(_0x172d('0x0'));var util=require(_0x172d('0x1'));var path=require(_0x172d('0x2'));var timeout=require('connect-timeout');var express=require(_0x172d('0x3'));var router=express[_0x172d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x172d('0x5'));var interaction=require(_0x172d('0x6'));var config=require(_0x172d('0x7'));var controller=require('./pause.controller');router[_0x172d('0x8')]('/',auth[_0x172d('0x9')](),controller[_0x172d('0xa')]);router[_0x172d('0x8')](_0x172d('0xb'),auth['isAuthenticated'](),controller[_0x172d('0xc')]);router[_0x172d('0xd')]('/',auth['isAuthenticated'](),controller[_0x172d('0xe')]);router[_0x172d('0xf')]('/:id',auth[_0x172d('0x9')](),controller[_0x172d('0x10')]);router[_0x172d('0x11')](_0x172d('0xb'),auth[_0x172d('0x9')](),controller[_0x172d('0x12')]);module[_0x172d('0x13')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 8906a7d..9009b47 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 _0x1fe7=['STRING','sequelize','exports'];(function(_0x1b9eaf,_0x19d0db){var _0x3ad51b=function(_0x5812d5){while(--_0x5812d5){_0x1b9eaf['push'](_0x1b9eaf['shift']());}};_0x3ad51b(++_0x19d0db);}(_0x1fe7,0x133));var _0x71fe=function(_0x147507,_0x368054){_0x147507=_0x147507-0x0;var _0x29537d=_0x1fe7[_0x147507];return _0x29537d;};'use strict';var Sequelize=require(_0x71fe('0x0'));module[_0x71fe('0x1')]={'name':{'type':Sequelize[_0x71fe('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x71fe('0x2')]}}; \ No newline at end of file +var _0x210f=['exports','STRING','name','sequelize'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x210f,0x123));var _0xf210=function(_0x7cf5ca,_0xfc5f30){_0x7cf5ca=_0x7cf5ca-0x0;var _0x39c365=_0x210f[_0x7cf5ca];return _0x39c365;};'use strict';var Sequelize=require(_0xf210('0x0'));module[_0xf210('0x1')]={'name':{'type':Sequelize[_0xf210('0x2')],'unique':_0xf210('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xf210('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index a2fd9ff..3402bc7 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 _0x155d=['crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','then','get','Pauses','UserProfileResource','sendStatus','error','name','send','index','map','Pause','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','show','params','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel'];(function(_0x23476f,_0x96858e){var _0x5e8429=function(_0x109466){while(--_0x109466){_0x23476f['push'](_0x23476f['shift']());}};_0x5e8429(++_0x96858e);}(_0x155d,0x1eb));var _0xd155=function(_0x41ee16,_0xfa94c3){_0x41ee16=_0x41ee16-0x0;var _0x1f60de=_0x155d[_0x41ee16];return _0x1f60de;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd155('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd155('0x1'));var rp=require(_0xd155('0x2'));var moment=require(_0xd155('0x3'));var BPromise=require(_0xd155('0x4'));var Mustache=require(_0xd155('0x5'));var util=require(_0xd155('0x6'));var path=require(_0xd155('0x7'));var sox=require(_0xd155('0x8'));var csv=require(_0xd155('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd155('0xa'));var _=require(_0xd155('0xb'));var squel=require(_0xd155('0xc'));var crypto=require(_0xd155('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd155('0xe'));var toCsv=require(_0xd155('0x9'));var querystring=require(_0xd155('0xf'));var Papa=require(_0xd155('0x10'));var Redis=require(_0xd155('0x11'));var authService=require(_0xd155('0x12'));var qs=require(_0xd155('0x13'));var as=require(_0xd155('0x14'));var hardwareService=require(_0xd155('0x15'));var logger=require('../../config/logger')(_0xd155('0x16'));var utils=require(_0xd155('0x17'));var config=require(_0xd155('0x18'));var licenseUtil=require(_0xd155('0x19'));var db=require(_0xd155('0x1a'))['db'];function respondWithStatusCode(_0x27c017,_0x8b5ddb){_0x8b5ddb=_0x8b5ddb||0xcc;return function(_0x3fb235){if(_0x3fb235){return _0x27c017['sendStatus'](_0x8b5ddb);}return _0x27c017[_0xd155('0x1b')](_0x8b5ddb)[_0xd155('0x1c')]();};}function respondWithResult(_0x104097,_0x2acc66){_0x2acc66=_0x2acc66||0xc8;return function(_0x8776b6){if(_0x8776b6){return _0x104097[_0xd155('0x1b')](_0x2acc66)[_0xd155('0x1d')](_0x8776b6);}};}function respondWithFilteredResult(_0x1e6fe0,_0x47cb66){return function(_0x36121d){if(_0x36121d){var _0xfa7b8a=_0x36121d[_0xd155('0x1e')],_0x44c628=_0x47cb66[_0xd155('0x1f')],_0x17e505=_0x47cb66[_0xd155('0x1f')]+_0x47cb66[_0xd155('0x20')],_0x41d473;if(_0x17e505>=_0xfa7b8a){_0x17e505=_0xfa7b8a;_0x41d473=0xc8;}else{_0x41d473=0xce;}_0x1e6fe0[_0xd155('0x1b')](_0x41d473);return _0x1e6fe0[_0xd155('0x21')]('Content-Range',_0x44c628+'-'+_0x17e505+'/'+_0xfa7b8a)[_0xd155('0x1d')](_0x36121d);}return null;};}function patchUpdates(_0x28337b){return function(_0x402f93){try{jsonpatch[_0xd155('0x22')](_0x402f93,_0x28337b,!![]);}catch(_0x48be1c){return BPromise[_0xd155('0x23')](_0x48be1c);}return _0x402f93[_0xd155('0x24')]();};}function saveUpdates(_0x7f1783,_0x2091a5){return function(_0x1863bf){if(_0x1863bf){return _0x1863bf[_0xd155('0x25')](_0x7f1783)['then'](function(_0x3df062){return _0x3df062;});}return null;};}function removeEntity(_0x3d8322,_0x429b80){return function(_0x51ba1f){if(_0x51ba1f){return _0x51ba1f[_0xd155('0x26')]()[_0xd155('0x27')](function(){var _0x90936=_0x51ba1f[_0xd155('0x28')]({'plain':!![]});var _0xd9a09f=_0xd155('0x29');return db[_0xd155('0x2a')]['destroy']({'where':{'type':_0xd9a09f,'resourceId':_0x90936['id']}})[_0xd155('0x27')](function(){return _0x51ba1f;});})[_0xd155('0x27')](function(){_0x3d8322[_0xd155('0x1b')](0xcc)[_0xd155('0x1c')]();});}};}function handleEntityNotFound(_0x168747,_0x3fbdec){return function(_0xee4d6c){if(!_0xee4d6c){_0x168747[_0xd155('0x2b')](0x194);}return _0xee4d6c;};}function handleError(_0x3d3443,_0x2b67f3){_0x2b67f3=_0x2b67f3||0x1f4;return function(_0x2d7b17){logger[_0xd155('0x2c')](_0x2d7b17['stack']);if(_0x2d7b17[_0xd155('0x2d')]){delete _0x2d7b17['name'];}_0x3d3443[_0xd155('0x1b')](_0x2b67f3)[_0xd155('0x2e')](_0x2d7b17);};}exports[_0xd155('0x2f')]=function(_0x2f248b,_0x447f0e){var _0x37dc1f={},_0x114e55={},_0x4f4328={'count':0x0,'rows':[]};var _0x5648d8=_[_0xd155('0x30')](db[_0xd155('0x31')][_0xd155('0x32')],function(_0x11cb85){return{'name':_0x11cb85[_0xd155('0x33')],'type':_0x11cb85['type']['key']};});_0x114e55[_0xd155('0x34')]=_['map'](_0x5648d8,_0xd155('0x2d'));_0x114e55[_0xd155('0x35')]=_[_0xd155('0x36')](_0x2f248b[_0xd155('0x35')]);_0x114e55[_0xd155('0x37')]=_[_0xd155('0x38')](_0x114e55['model'],_0x114e55[_0xd155('0x35')]);_0x37dc1f[_0xd155('0x39')]=_[_0xd155('0x38')](_0x114e55[_0xd155('0x34')],qs[_0xd155('0x3a')](_0x2f248b[_0xd155('0x35')][_0xd155('0x3a')]));_0x37dc1f[_0xd155('0x39')]=_0x37dc1f[_0xd155('0x39')][_0xd155('0x3b')]?_0x37dc1f[_0xd155('0x39')]:_0x114e55[_0xd155('0x34')];if(!_0x2f248b[_0xd155('0x35')]['hasOwnProperty']('nolimit')){_0x37dc1f[_0xd155('0x20')]=qs['limit'](_0x2f248b[_0xd155('0x35')][_0xd155('0x20')]);_0x37dc1f['offset']=qs[_0xd155('0x1f')](_0x2f248b[_0xd155('0x35')]['offset']);}_0x37dc1f[_0xd155('0x3c')]=qs[_0xd155('0x3d')](_0x2f248b['query'][_0xd155('0x3d')]);_0x37dc1f[_0xd155('0x3e')]=qs[_0xd155('0x37')](_[_0xd155('0x3f')](_0x2f248b['query'],_0x114e55[_0xd155('0x37')]),_0x5648d8);if(_0x2f248b['query'][_0xd155('0x40')]){_0x37dc1f[_0xd155('0x3e')]=_[_0xd155('0x41')](_0x37dc1f[_0xd155('0x3e')],{'$or':_[_0xd155('0x30')](_0x5648d8,function(_0x1805dd){if(_0x1805dd[_0xd155('0x42')]!==_0xd155('0x43')){var _0x3e7eb8={};_0x3e7eb8[_0x1805dd[_0xd155('0x2d')]]={'$like':'%'+_0x2f248b[_0xd155('0x35')][_0xd155('0x40')]+'%'};return _0x3e7eb8;}})});}_0x37dc1f=_['merge']({},_0x37dc1f,_0x2f248b['options']);var _0xc8c51f={'where':_0x37dc1f['where']};return db[_0xd155('0x31')][_0xd155('0x1e')](_0xc8c51f)['then'](function(_0x404198){_0x4f4328[_0xd155('0x1e')]=_0x404198;if(_0x2f248b['query'][_0xd155('0x44')]){_0x37dc1f[_0xd155('0x45')]=[{'all':!![]}];}return db[_0xd155('0x31')][_0xd155('0x46')](_0x37dc1f);})[_0xd155('0x27')](function(_0x51ffb1){_0x4f4328['rows']=_0x51ffb1;return _0x4f4328;})[_0xd155('0x27')](respondWithFilteredResult(_0x447f0e,_0x37dc1f))['catch'](handleError(_0x447f0e,null));};exports[_0xd155('0x47')]=function(_0x382d8e,_0x2d5222){var _0x311b42={'raw':!![],'where':{'id':_0x382d8e[_0xd155('0x48')]['id']}},_0x1fd334={};_0x1fd334[_0xd155('0x34')]=_[_0xd155('0x36')](db[_0xd155('0x31')][_0xd155('0x32')]);_0x1fd334[_0xd155('0x35')]=_['keys'](_0x382d8e[_0xd155('0x35')]);_0x1fd334['filters']=_[_0xd155('0x38')](_0x1fd334[_0xd155('0x34')],_0x1fd334[_0xd155('0x35')]);_0x311b42[_0xd155('0x39')]=_['intersection'](_0x1fd334[_0xd155('0x34')],qs[_0xd155('0x3a')](_0x382d8e[_0xd155('0x35')][_0xd155('0x3a')]));_0x311b42[_0xd155('0x39')]=_0x311b42[_0xd155('0x39')][_0xd155('0x3b')]?_0x311b42[_0xd155('0x39')]:_0x1fd334[_0xd155('0x34')];if(_0x382d8e[_0xd155('0x35')]['includeAll']){_0x311b42['include']=[{'all':!![]}];}_0x311b42=_['merge']({},_0x311b42,_0x382d8e[_0xd155('0x49')]);return db[_0xd155('0x31')]['find'](_0x311b42)[_0xd155('0x27')](handleEntityNotFound(_0x2d5222,null))['then'](respondWithResult(_0x2d5222,null))[_0xd155('0x4a')](handleError(_0x2d5222,null));};exports[_0xd155('0x4b')]=function(_0x1b8581,_0x1e86ad){return db['Pause'][_0xd155('0x4b')](_0x1b8581[_0xd155('0x4c')],{})['then'](function(_0x3970b9){var _0x3fee2e=_0x1b8581[_0xd155('0x4d')]['get']({'plain':!![]});if(!_0x3fee2e)throw new Error(_0xd155('0x4e'));if(_0x3fee2e[_0xd155('0x4f')]===_0xd155('0x4d')){var _0x235ad4=_0x3970b9['get']({'plain':!![]});var _0x101b41=_0xd155('0x29');return db[_0xd155('0x50')][_0xd155('0x51')]({'where':{'name':_0x101b41,'userProfileId':_0x3fee2e[_0xd155('0x52')]},'raw':!![]})[_0xd155('0x27')](function(_0x1fb4d5){if(_0x1fb4d5&&_0x1fb4d5[_0xd155('0x53')]===0x0){return db['UserProfileResource'][_0xd155('0x4b')]({'name':_0x235ad4['name'],'resourceId':_0x235ad4['id'],'type':_0x1fb4d5[_0xd155('0x2d')],'sectionId':_0x1fb4d5['id']},{})[_0xd155('0x27')](function(){return _0x3970b9;});}else{return _0x3970b9;}})[_0xd155('0x4a')](function(_0xe4230e){logger[_0xd155('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe4230e);throw _0xe4230e;});}return _0x3970b9;})['then'](respondWithResult(_0x1e86ad,0xc9))['catch'](handleError(_0x1e86ad,null));};exports[_0xd155('0x25')]=function(_0x44a254,_0x5a25ae){if(_0x44a254[_0xd155('0x4c')]['id']){delete _0x44a254['body']['id'];}return db['Pause'][_0xd155('0x51')]({'where':{'id':_0x44a254[_0xd155('0x48')]['id']}})[_0xd155('0x27')](handleEntityNotFound(_0x5a25ae,null))[_0xd155('0x27')](saveUpdates(_0x44a254['body'],null))[_0xd155('0x27')](respondWithResult(_0x5a25ae,null))[_0xd155('0x4a')](handleError(_0x5a25ae,null));};exports['destroy']=function(_0x3b6d0c,_0x29dc21){return db[_0xd155('0x31')][_0xd155('0x51')]({'where':{'id':_0x3b6d0c[_0xd155('0x48')]['id']}})[_0xd155('0x27')](handleEntityNotFound(_0x29dc21,null))['then'](removeEntity(_0x29dc21,null))[_0xd155('0x4a')](handleError(_0x29dc21,null));}; \ No newline at end of file +var _0x2082=['filter','merge','VIRTUAL','options','count','include','findAll','rows','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','index','map','Pause','fieldName','type','query','keys','intersection','model','attributes','fields','length','order','sort','where','filters','pick'];(function(_0x566bdf,_0x1f4861){var _0x331215=function(_0x524d0d){while(--_0x524d0d){_0x566bdf['push'](_0x566bdf['shift']());}};_0x331215(++_0x1f4861);}(_0x2082,0x1c3));var _0x2208=function(_0x2c7dc6,_0x3c4ce0){_0x2c7dc6=_0x2c7dc6-0x0;var _0x10002b=_0x2082[_0x2c7dc6];return _0x10002b;};'use strict';var pdf=require(_0x2208('0x0'));var emlformat=require(_0x2208('0x1'));var rimraf=require(_0x2208('0x2'));var zipdir=require(_0x2208('0x3'));var jsonpatch=require(_0x2208('0x4'));var rp=require('request-promise');var moment=require(_0x2208('0x5'));var BPromise=require(_0x2208('0x6'));var Mustache=require('mustache');var util=require(_0x2208('0x7'));var path=require('path');var sox=require(_0x2208('0x8'));var csv=require(_0x2208('0x9'));var ejs=require(_0x2208('0xa'));var fs=require('fs');var fs_extra=require(_0x2208('0xb'));var _=require(_0x2208('0xc'));var squel=require(_0x2208('0xd'));var crypto=require(_0x2208('0xe'));var jsforce=require(_0x2208('0xf'));var deskjs=require(_0x2208('0x10'));var toCsv=require(_0x2208('0x9'));var querystring=require(_0x2208('0x11'));var Papa=require(_0x2208('0x12'));var Redis=require(_0x2208('0x13'));var authService=require(_0x2208('0x14'));var qs=require(_0x2208('0x15'));var as=require(_0x2208('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2208('0x17'))('api');var utils=require(_0x2208('0x18'));var config=require(_0x2208('0x19'));var licenseUtil=require(_0x2208('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc7708c,_0x11b129){_0x11b129=_0x11b129||0xcc;return function(_0x363bd4){if(_0x363bd4){return _0xc7708c[_0x2208('0x1b')](_0x11b129);}return _0xc7708c[_0x2208('0x1c')](_0x11b129)[_0x2208('0x1d')]();};}function respondWithResult(_0x571fbc,_0x1e78cd){_0x1e78cd=_0x1e78cd||0xc8;return function(_0x5d35c1){if(_0x5d35c1){return _0x571fbc[_0x2208('0x1c')](_0x1e78cd)[_0x2208('0x1e')](_0x5d35c1);}};}function respondWithFilteredResult(_0x3e0b07,_0x583994){return function(_0x21dde8){if(_0x21dde8){var _0x193dd1=_0x21dde8['count'],_0x320f66=_0x583994[_0x2208('0x1f')],_0x15eae7=_0x583994['offset']+_0x583994[_0x2208('0x20')],_0x15e437;if(_0x15eae7>=_0x193dd1){_0x15eae7=_0x193dd1;_0x15e437=0xc8;}else{_0x15e437=0xce;}_0x3e0b07['status'](_0x15e437);return _0x3e0b07[_0x2208('0x21')](_0x2208('0x22'),_0x320f66+'-'+_0x15eae7+'/'+_0x193dd1)[_0x2208('0x1e')](_0x21dde8);}return null;};}function patchUpdates(_0x4700a8){return function(_0x2a7aec){try{jsonpatch[_0x2208('0x23')](_0x2a7aec,_0x4700a8,!![]);}catch(_0x45b546){return BPromise[_0x2208('0x24')](_0x45b546);}return _0x2a7aec[_0x2208('0x25')]();};}function saveUpdates(_0x4536ff,_0x43fd0f){return function(_0xdef301){if(_0xdef301){return _0xdef301[_0x2208('0x26')](_0x4536ff)[_0x2208('0x27')](function(_0x19ba31){return _0x19ba31;});}return null;};}function removeEntity(_0x3afd09,_0x3718b2){return function(_0x25345d){if(_0x25345d){return _0x25345d[_0x2208('0x28')]()[_0x2208('0x27')](function(){var _0x9e35c4=_0x25345d[_0x2208('0x29')]({'plain':!![]});var _0x50f5e3=_0x2208('0x2a');return db[_0x2208('0x2b')][_0x2208('0x28')]({'where':{'type':_0x50f5e3,'resourceId':_0x9e35c4['id']}})[_0x2208('0x27')](function(){return _0x25345d;});})[_0x2208('0x27')](function(){_0x3afd09[_0x2208('0x1c')](0xcc)[_0x2208('0x1d')]();});}};}function handleEntityNotFound(_0x5d849d,_0x49d4e8){return function(_0x17a9d4){if(!_0x17a9d4){_0x5d849d[_0x2208('0x1b')](0x194);}return _0x17a9d4;};}function handleError(_0x4e8695,_0xbda26e){_0xbda26e=_0xbda26e||0x1f4;return function(_0x4ed19a){logger[_0x2208('0x2c')](_0x4ed19a[_0x2208('0x2d')]);if(_0x4ed19a[_0x2208('0x2e')]){delete _0x4ed19a[_0x2208('0x2e')];}_0x4e8695[_0x2208('0x1c')](_0xbda26e)[_0x2208('0x2f')](_0x4ed19a);};}exports[_0x2208('0x30')]=function(_0x35f39a,_0x3c19c8){var _0x56d6e2={},_0x55fb2d={},_0x300543={'count':0x0,'rows':[]};var _0x43796a=_[_0x2208('0x31')](db[_0x2208('0x32')]['rawAttributes'],function(_0x29890d){return{'name':_0x29890d[_0x2208('0x33')],'type':_0x29890d[_0x2208('0x34')]['key']};});_0x55fb2d['model']=_[_0x2208('0x31')](_0x43796a,_0x2208('0x2e'));_0x55fb2d[_0x2208('0x35')]=_[_0x2208('0x36')](_0x35f39a[_0x2208('0x35')]);_0x55fb2d['filters']=_[_0x2208('0x37')](_0x55fb2d[_0x2208('0x38')],_0x55fb2d[_0x2208('0x35')]);_0x56d6e2[_0x2208('0x39')]=_['intersection'](_0x55fb2d['model'],qs[_0x2208('0x3a')](_0x35f39a[_0x2208('0x35')][_0x2208('0x3a')]));_0x56d6e2[_0x2208('0x39')]=_0x56d6e2[_0x2208('0x39')][_0x2208('0x3b')]?_0x56d6e2[_0x2208('0x39')]:_0x55fb2d['model'];if(!_0x35f39a[_0x2208('0x35')]['hasOwnProperty']('nolimit')){_0x56d6e2[_0x2208('0x20')]=qs['limit'](_0x35f39a[_0x2208('0x35')][_0x2208('0x20')]);_0x56d6e2[_0x2208('0x1f')]=qs[_0x2208('0x1f')](_0x35f39a[_0x2208('0x35')]['offset']);}_0x56d6e2[_0x2208('0x3c')]=qs[_0x2208('0x3d')](_0x35f39a[_0x2208('0x35')][_0x2208('0x3d')]);_0x56d6e2[_0x2208('0x3e')]=qs[_0x2208('0x3f')](_[_0x2208('0x40')](_0x35f39a[_0x2208('0x35')],_0x55fb2d[_0x2208('0x3f')]),_0x43796a);if(_0x35f39a['query'][_0x2208('0x41')]){_0x56d6e2[_0x2208('0x3e')]=_[_0x2208('0x42')](_0x56d6e2[_0x2208('0x3e')],{'$or':_[_0x2208('0x31')](_0x43796a,function(_0x375309){if(_0x375309[_0x2208('0x34')]!==_0x2208('0x43')){var _0x3e2537={};_0x3e2537[_0x375309[_0x2208('0x2e')]]={'$like':'%'+_0x35f39a[_0x2208('0x35')][_0x2208('0x41')]+'%'};return _0x3e2537;}})});}_0x56d6e2=_['merge']({},_0x56d6e2,_0x35f39a[_0x2208('0x44')]);var _0x40edd2={'where':_0x56d6e2[_0x2208('0x3e')]};return db[_0x2208('0x32')]['count'](_0x40edd2)[_0x2208('0x27')](function(_0x26b27f){_0x300543[_0x2208('0x45')]=_0x26b27f;if(_0x35f39a[_0x2208('0x35')]['includeAll']){_0x56d6e2[_0x2208('0x46')]=[{'all':!![]}];}return db['Pause'][_0x2208('0x47')](_0x56d6e2);})[_0x2208('0x27')](function(_0x188e4d){_0x300543[_0x2208('0x48')]=_0x188e4d;return _0x300543;})[_0x2208('0x27')](respondWithFilteredResult(_0x3c19c8,_0x56d6e2))['catch'](handleError(_0x3c19c8,null));};exports['show']=function(_0x4f0ea4,_0x31ca27){var _0x5c7ee9={'raw':!![],'where':{'id':_0x4f0ea4['params']['id']}},_0x2c0d2c={};_0x2c0d2c[_0x2208('0x38')]=_['keys'](db[_0x2208('0x32')][_0x2208('0x49')]);_0x2c0d2c[_0x2208('0x35')]=_[_0x2208('0x36')](_0x4f0ea4['query']);_0x2c0d2c[_0x2208('0x3f')]=_[_0x2208('0x37')](_0x2c0d2c['model'],_0x2c0d2c[_0x2208('0x35')]);_0x5c7ee9[_0x2208('0x39')]=_[_0x2208('0x37')](_0x2c0d2c[_0x2208('0x38')],qs[_0x2208('0x3a')](_0x4f0ea4[_0x2208('0x35')]['fields']));_0x5c7ee9[_0x2208('0x39')]=_0x5c7ee9[_0x2208('0x39')][_0x2208('0x3b')]?_0x5c7ee9[_0x2208('0x39')]:_0x2c0d2c['model'];if(_0x4f0ea4['query']['includeAll']){_0x5c7ee9['include']=[{'all':!![]}];}_0x5c7ee9=_[_0x2208('0x42')]({},_0x5c7ee9,_0x4f0ea4['options']);return db[_0x2208('0x32')][_0x2208('0x4a')](_0x5c7ee9)[_0x2208('0x27')](handleEntityNotFound(_0x31ca27,null))[_0x2208('0x27')](respondWithResult(_0x31ca27,null))[_0x2208('0x4b')](handleError(_0x31ca27,null));};exports[_0x2208('0x4c')]=function(_0x50cdf4,_0x1e302d){return db[_0x2208('0x32')][_0x2208('0x4c')](_0x50cdf4[_0x2208('0x4d')],{})[_0x2208('0x27')](function(_0x5b46a3){var _0x4f1eb9=_0x50cdf4[_0x2208('0x4e')][_0x2208('0x29')]({'plain':!![]});if(!_0x4f1eb9)throw new Error(_0x2208('0x4f'));if(_0x4f1eb9[_0x2208('0x50')]===_0x2208('0x4e')){var _0x3c1c42=_0x5b46a3[_0x2208('0x29')]({'plain':!![]});var _0x58d51a=_0x2208('0x2a');return db[_0x2208('0x51')][_0x2208('0x4a')]({'where':{'name':_0x58d51a,'userProfileId':_0x4f1eb9[_0x2208('0x52')]},'raw':!![]})['then'](function(_0x177844){if(_0x177844&&_0x177844[_0x2208('0x53')]===0x0){return db[_0x2208('0x2b')][_0x2208('0x4c')]({'name':_0x3c1c42[_0x2208('0x2e')],'resourceId':_0x3c1c42['id'],'type':_0x177844[_0x2208('0x2e')],'sectionId':_0x177844['id']},{})[_0x2208('0x27')](function(){return _0x5b46a3;});}else{return _0x5b46a3;}})['catch'](function(_0x401999){logger[_0x2208('0x2c')](_0x2208('0x54'),_0x401999);throw _0x401999;});}return _0x5b46a3;})[_0x2208('0x27')](respondWithResult(_0x1e302d,0xc9))['catch'](handleError(_0x1e302d,null));};exports[_0x2208('0x26')]=function(_0x1e6178,_0x5a505c){if(_0x1e6178[_0x2208('0x4d')]['id']){delete _0x1e6178[_0x2208('0x4d')]['id'];}return db[_0x2208('0x32')]['find']({'where':{'id':_0x1e6178[_0x2208('0x55')]['id']}})['then'](handleEntityNotFound(_0x5a505c,null))['then'](saveUpdates(_0x1e6178[_0x2208('0x4d')],null))[_0x2208('0x27')](respondWithResult(_0x5a505c,null))[_0x2208('0x4b')](handleError(_0x5a505c,null));};exports[_0x2208('0x28')]=function(_0x1235bb,_0x433748){return db[_0x2208('0x32')][_0x2208('0x4a')]({'where':{'id':_0x1235bb[_0x2208('0x55')]['id']}})[_0x2208('0x27')](handleEntityNotFound(_0x433748,null))['then'](removeEntity(_0x433748,null))[_0x2208('0x4b')](handleError(_0x433748,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index c90182e..5d3edbe 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 _0x8322=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','Pause','tools_pauses'];(function(_0x2ff5c6,_0x248fe2){var _0x5605f2=function(_0xc4a69){while(--_0xc4a69){_0x2ff5c6['push'](_0x2ff5c6['shift']());}};_0x5605f2(++_0x248fe2);}(_0x8322,0x186));var _0x2832=function(_0x142ec2,_0x5bb03d){_0x142ec2=_0x142ec2-0x0;var _0x45ef4e=_0x8322[_0x142ec2];return _0x45ef4e;};'use strict';var _=require(_0x2832('0x0'));var util=require(_0x2832('0x1'));var logger=require(_0x2832('0x2'))(_0x2832('0x3'));var moment=require(_0x2832('0x4'));var BPromise=require(_0x2832('0x5'));var rp=require(_0x2832('0x6'));var fs=require('fs');var path=require(_0x2832('0x7'));var rimraf=require(_0x2832('0x8'));var config=require(_0x2832('0x9'));var attributes=require('./pause.attributes');module['exports']=function(_0x3583d5,_0x1d10f2){return _0x3583d5[_0x2832('0xa')](_0x2832('0xb'),attributes,{'tableName':_0x2832('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0dd=['request-promise','path','rimraf','exports','define','Pause','tools_pauses','lodash','util','api','moment','bluebird'];(function(_0x235c9e,_0x15114c){var _0x146660=function(_0x5d1918){while(--_0x5d1918){_0x235c9e['push'](_0x235c9e['shift']());}};_0x146660(++_0x15114c);}(_0xe0dd,0x163));var _0xde0d=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0xe0dd[_0x51fe5f];return _0x4abce9;};'use strict';var _=require(_0xde0d('0x0'));var util=require(_0xde0d('0x1'));var logger=require('../../config/logger')(_0xde0d('0x2'));var moment=require(_0xde0d('0x3'));var BPromise=require(_0xde0d('0x4'));var rp=require(_0xde0d('0x5'));var fs=require('fs');var path=require(_0xde0d('0x6'));var rimraf=require(_0xde0d('0x7'));var config=require('../../config/environment');var attributes=require('./pause.attributes');module[_0xde0d('0x8')]=function(_0x1c7bda,_0x5c58e5){return _0x1c7bda[_0xde0d('0x9')](_0xde0d('0xa'),attributes,{'tableName':_0xde0d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 51b437e..bb33a36 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 _0x32c0=['map','model','then','debug','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','Pause,\x20%s,\x20%s','message','result','catch','ShowPause','Pause','find','options','raw','include','attributes'];(function(_0x582244,_0x33f08b){var _0x81f9e4=function(_0x1f63f8){while(--_0x1f63f8){_0x582244['push'](_0x582244['shift']());}};_0x81f9e4(++_0x33f08b);}(_0x32c0,0x1f3));var _0x032c=function(_0x132a0d,_0xb35932){_0x132a0d=_0x132a0d-0x0;var _0x379219=_0x32c0[_0x132a0d];return _0x379219;};'use strict';var _=require(_0x032c('0x0'));var util=require(_0x032c('0x1'));var moment=require('moment');var BPromise=require(_0x032c('0x2'));var rs=require(_0x032c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x032c('0x4'))['db'];var utils=require(_0x032c('0x5'));var logger=require(_0x032c('0x6'))(_0x032c('0x7'));var config=require('../../config/environment');var jayson=require(_0x032c('0x8'));var client=jayson[_0x032c('0x9')][_0x032c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xca7342,_0x59aaa4,_0x43f876){return new BPromise(function(_0x5d2a4c,_0x18217d){return client[_0x032c('0xb')](_0xca7342,_0x43f876)['then'](function(_0x5a2ae4){logger[_0x032c('0xc')]('Pause,\x20%s,\x20%s',_0x59aaa4,_0x032c('0xd'));logger['debug'](_0x032c('0xe'),_0x59aaa4,_0x032c('0xd'),JSON[_0x032c('0xf')](_0x5a2ae4));if(_0x5a2ae4[_0x032c('0x10')]){if(_0x5a2ae4[_0x032c('0x10')][_0x032c('0x11')]===0x1f4){logger['error'](_0x032c('0x12'),_0x59aaa4,_0x5a2ae4[_0x032c('0x10')][_0x032c('0x13')]);return _0x18217d(_0x5a2ae4[_0x032c('0x10')]['message']);}logger[_0x032c('0x10')](_0x032c('0x12'),_0x59aaa4,_0x5a2ae4[_0x032c('0x10')][_0x032c('0x13')]);return _0x5d2a4c(_0x5a2ae4[_0x032c('0x10')][_0x032c('0x13')]);}else{logger['info'](_0x032c('0x12'),_0x59aaa4,_0x032c('0xd'));_0x5d2a4c(_0x5a2ae4[_0x032c('0x14')][_0x032c('0x13')]);}})[_0x032c('0x15')](function(_0x46cbd2){logger['error'](_0x032c('0x12'),_0x59aaa4,_0x46cbd2);_0x18217d(_0x46cbd2);});});}exports[_0x032c('0x16')]=function(_0x4435ad){var _0x433ded=this;return new Promise(function(_0x2b2693,_0x35acc1){return db[_0x032c('0x17')][_0x032c('0x18')]({'raw':_0x4435ad[_0x032c('0x19')]?_0x4435ad[_0x032c('0x19')][_0x032c('0x1a')]===undefined?!![]:![]:!![],'where':_0x4435ad[_0x032c('0x19')]?_0x4435ad[_0x032c('0x19')]['where']||null:null,'attributes':_0x4435ad[_0x032c('0x19')]?_0x4435ad['options']['attributes']||null:null,'include':_0x4435ad['options']?_0x4435ad['options'][_0x032c('0x1b')]?_['map'](_0x4435ad[_0x032c('0x19')][_0x032c('0x1b')],function(_0x29851b){return{'model':db[_0x29851b['model']],'as':_0x29851b['as'],'attributes':_0x29851b[_0x032c('0x1c')],'include':_0x29851b[_0x032c('0x1b')]?_[_0x032c('0x1d')](_0x29851b[_0x032c('0x1b')],function(_0x2bbaef){return{'model':db[_0x2bbaef[_0x032c('0x1e')]],'as':_0x2bbaef['as'],'attributes':_0x2bbaef[_0x032c('0x1c')],'include':_0x2bbaef['include']?_[_0x032c('0x1d')](_0x2bbaef[_0x032c('0x1b')],function(_0x1d1cd5){return{'model':db[_0x1d1cd5['model']],'as':_0x1d1cd5['as'],'attributes':_0x1d1cd5[_0x032c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x032c('0x1f')](function(_0x15c368){logger[_0x032c('0xc')]('ShowPause',_0x4435ad);logger[_0x032c('0x20')](_0x032c('0x16'),_0x4435ad,JSON[_0x032c('0xf')](_0x15c368));_0x2b2693(_0x15c368);})[_0x032c('0x15')](function(_0x51d679){logger[_0x032c('0x10')](_0x032c('0x16'),_0x51d679[_0x032c('0x13')],_0x4435ad);_0x35acc1(_0x433ded[_0x032c('0x10')](0x1f4,_0x51d679[_0x032c('0x13')]));});});}; \ No newline at end of file +var _0xc30e=['../../config/environment','jayson/promise','client','debug','request\x20sent','stringify','error','code','Pause,\x20%s,\x20%s','message','info','result','ShowPause','Pause','find','options','where','include','map','attributes','model','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x52a7e1,_0x189bf3){var _0x4f4495=function(_0x5d1915){while(--_0x5d1915){_0x52a7e1['push'](_0x52a7e1['shift']());}};_0x4f4495(++_0x189bf3);}(_0xc30e,0x1d8));var _0xec30=function(_0x3bb6e6,_0x2a552f){_0x3bb6e6=_0x3bb6e6-0x0;var _0x5a0258=_0xc30e[_0x3bb6e6];return _0x5a0258;};'use strict';var _=require(_0xec30('0x0'));var util=require('util');var moment=require(_0xec30('0x1'));var BPromise=require(_0xec30('0x2'));var rs=require(_0xec30('0x3'));var fs=require('fs');var Redis=require(_0xec30('0x4'));var db=require(_0xec30('0x5'))['db'];var utils=require(_0xec30('0x6'));var logger=require(_0xec30('0x7'))('rpc');var config=require(_0xec30('0x8'));var jayson=require(_0xec30('0x9'));var client=jayson[_0xec30('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b222b,_0x1fe35a,_0x365609){return new BPromise(function(_0x49528d,_0x1d2812){return client['request'](_0x3b222b,_0x365609)['then'](function(_0x442028){logger['info']('Pause,\x20%s,\x20%s',_0x1fe35a,'request\x20sent');logger[_0xec30('0xb')]('Pause,\x20%s,\x20%s,\x20%s',_0x1fe35a,_0xec30('0xc'),JSON[_0xec30('0xd')](_0x442028));if(_0x442028[_0xec30('0xe')]){if(_0x442028['error'][_0xec30('0xf')]===0x1f4){logger['error'](_0xec30('0x10'),_0x1fe35a,_0x442028[_0xec30('0xe')][_0xec30('0x11')]);return _0x1d2812(_0x442028[_0xec30('0xe')][_0xec30('0x11')]);}logger[_0xec30('0xe')]('Pause,\x20%s,\x20%s',_0x1fe35a,_0x442028['error'][_0xec30('0x11')]);return _0x49528d(_0x442028[_0xec30('0xe')][_0xec30('0x11')]);}else{logger[_0xec30('0x12')](_0xec30('0x10'),_0x1fe35a,_0xec30('0xc'));_0x49528d(_0x442028[_0xec30('0x13')][_0xec30('0x11')]);}})['catch'](function(_0x1ad7e0){logger[_0xec30('0xe')]('Pause,\x20%s,\x20%s',_0x1fe35a,_0x1ad7e0);_0x1d2812(_0x1ad7e0);});});}exports[_0xec30('0x14')]=function(_0x522025){var _0xc925c1=this;return new Promise(function(_0x3482a0,_0x1597dd){return db[_0xec30('0x15')][_0xec30('0x16')]({'raw':_0x522025['options']?_0x522025[_0xec30('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x522025[_0xec30('0x17')]?_0x522025[_0xec30('0x17')][_0xec30('0x18')]||null:null,'attributes':_0x522025[_0xec30('0x17')]?_0x522025[_0xec30('0x17')]['attributes']||null:null,'include':_0x522025[_0xec30('0x17')]?_0x522025[_0xec30('0x17')][_0xec30('0x19')]?_[_0xec30('0x1a')](_0x522025['options'][_0xec30('0x19')],function(_0x308bbd){return{'model':db[_0x308bbd['model']],'as':_0x308bbd['as'],'attributes':_0x308bbd['attributes'],'include':_0x308bbd[_0xec30('0x19')]?_[_0xec30('0x1a')](_0x308bbd['include'],function(_0x42d795){return{'model':db[_0x42d795['model']],'as':_0x42d795['as'],'attributes':_0x42d795[_0xec30('0x1b')],'include':_0x42d795[_0xec30('0x19')]?_[_0xec30('0x1a')](_0x42d795[_0xec30('0x19')],function(_0x4c042f){return{'model':db[_0x4c042f[_0xec30('0x1c')]],'as':_0x4c042f['as'],'attributes':_0x4c042f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x388f07){logger['info'](_0xec30('0x14'),_0x522025);logger[_0xec30('0xb')](_0xec30('0x14'),_0x522025,JSON['stringify'](_0x388f07));_0x3482a0(_0x388f07);})[_0xec30('0x1d')](function(_0x501f4f){logger[_0xec30('0xe')](_0xec30('0x14'),_0x501f4f[_0xec30('0x11')],_0x522025);_0x1597dd(_0xc925c1['error'](0x1f4,_0x501f4f['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index c086e17..063b565 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 _0x3378=['/:id/download','download','diskStorage','root','server/files/plugins','originalname','%s-%s%s','basename','now','extname','post','upload','webhookPost','put','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','/:id','show'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x3378,0xca));var _0x8337=function(_0x43c8b8,_0x5e8934){_0x43c8b8=_0x43c8b8-0x0;var _0x413be3=_0x3378[_0x43c8b8];return _0x413be3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8337('0x0'));var timeout=require(_0x8337('0x1'));var express=require(_0x8337('0x2'));var router=express[_0x8337('0x3')]();var fs_extra=require(_0x8337('0x4'));var auth=require(_0x8337('0x5'));var interaction=require(_0x8337('0x6'));var config=require(_0x8337('0x7'));var controller=require(_0x8337('0x8'));router[_0x8337('0x9')]('/',auth[_0x8337('0xa')](),controller[_0x8337('0xb')]);router[_0x8337('0x9')](_0x8337('0xc'),controller['webhookGet']);router[_0x8337('0x9')](_0x8337('0xd'),auth['isAuthenticated'](),controller[_0x8337('0xe')]);router[_0x8337('0x9')](_0x8337('0xf'),auth[_0x8337('0xa')](),controller[_0x8337('0x10')]);var upload=multer({'storage':multer[_0x8337('0x11')]({'destination':function(_0x1f1b2e,_0x2014e1,_0x26c387){_0x26c387(null,path['join'](config[_0x8337('0x12')],_0x8337('0x13')));},'filename':function(_0x6a7c3b,_0x21a6fb,_0x5c91fd){_0x21a6fb[_0x8337('0x14')]=_0x21a6fb[_0x8337('0x14')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5c91fd(null,util['format'](_0x8337('0x15'),path[_0x8337('0x16')](_0x21a6fb[_0x8337('0x14')],path['extname'](_0x21a6fb[_0x8337('0x14')])),Date[_0x8337('0x17')](),path[_0x8337('0x18')](_0x21a6fb[_0x8337('0x14')])));}})});router[_0x8337('0x19')]('/',upload['single']('file'),controller[_0x8337('0x1a')]);router['post']('/webhook',controller[_0x8337('0x1b')]);router[_0x8337('0x1c')](_0x8337('0xd'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x8337('0xa')](),controller[_0x8337('0x1d')]);module[_0x8337('0x1e')]=router; \ No newline at end of file +var _0x5b98=['multer','path','connect-timeout','express','Router','../../config/environment','./plugin.controller','get','isAuthenticated','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','basename','now','extname','post','upload','webhookPost','put','update','delete','exports'];(function(_0x3556d6,_0x40f6f6){var _0x3cc1c5=function(_0x44e0c3){while(--_0x44e0c3){_0x3556d6['push'](_0x3556d6['shift']());}};_0x3cc1c5(++_0x40f6f6);}(_0x5b98,0x160));var _0x85b9=function(_0x12ca5f,_0x223d98){_0x12ca5f=_0x12ca5f-0x0;var _0xfc3ae9=_0x5b98[_0x12ca5f];return _0xfc3ae9;};'use strict';var multer=require(_0x85b9('0x0'));var util=require('util');var path=require(_0x85b9('0x1'));var timeout=require(_0x85b9('0x2'));var express=require(_0x85b9('0x3'));var router=express[_0x85b9('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x85b9('0x5'));var controller=require(_0x85b9('0x6'));router[_0x85b9('0x7')]('/',auth[_0x85b9('0x8')](),controller['index']);router[_0x85b9('0x7')](_0x85b9('0x9'),controller[_0x85b9('0xa')]);router['get'](_0x85b9('0xb'),auth['isAuthenticated'](),controller[_0x85b9('0xc')]);router[_0x85b9('0x7')](_0x85b9('0xd'),auth[_0x85b9('0x8')](),controller[_0x85b9('0xe')]);var upload=multer({'storage':multer[_0x85b9('0xf')]({'destination':function(_0x3f3bff,_0x17dd4b,_0xca1aa0){_0xca1aa0(null,path[_0x85b9('0x10')](config[_0x85b9('0x11')],_0x85b9('0x12')));},'filename':function(_0xddf30b,_0x2cba1a,_0x36a8bf){_0x2cba1a[_0x85b9('0x13')]=_0x2cba1a[_0x85b9('0x13')][_0x85b9('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x36a8bf(null,util[_0x85b9('0x15')]('%s-%s%s',path[_0x85b9('0x16')](_0x2cba1a[_0x85b9('0x13')],path['extname'](_0x2cba1a['originalname'])),Date[_0x85b9('0x17')](),path[_0x85b9('0x18')](_0x2cba1a['originalname'])));}})});router[_0x85b9('0x19')]('/',upload['single']('file'),controller[_0x85b9('0x1a')]);router[_0x85b9('0x19')]('/webhook',controller[_0x85b9('0x1b')]);router[_0x85b9('0x1c')](_0x85b9('0xb'),auth[_0x85b9('0x8')](),controller[_0x85b9('0x1d')]);router[_0x85b9('0x1e')](_0x85b9('0xb'),auth[_0x85b9('0x8')](),controller['delete']);module[_0x85b9('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 1a6a828..9feda2a 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 _0x2776=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly','never','always','sequelize','exports','STRING','html','script','TEXT'];(function(_0xe8dc7f,_0x59d78f){var _0x2af4c3=function(_0x2aa50e){while(--_0x2aa50e){_0xe8dc7f['push'](_0xe8dc7f['shift']());}};_0x2af4c3(++_0x59d78f);}(_0x2776,0x14c));var _0x6277=function(_0xb85af0,_0x2d529d){_0xb85af0=_0xb85af0-0x0;var _0x3e3cd6=_0x2776[_0xb85af0];return _0x3e3cd6;};'use strict';var Sequelize=require(_0x6277('0x0'));module[_0x6277('0x1')]={'name':{'type':Sequelize[_0x6277('0x2')]},'type':{'type':Sequelize['ENUM'](_0x6277('0x3'),_0x6277('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x6277('0x5')]},'path':{'type':Sequelize[_0x6277('0x2')],'comment':_0x6277('0x6')},'active':{'type':Sequelize[_0x6277('0x7')],'defaultValue':0x0,'comment':_0x6277('0x8')},'sidebar':{'type':Sequelize[_0x6277('0x9')](_0x6277('0xa'),'agentOnly','always',_0x6277('0xb')),'defaultValue':_0x6277('0xc'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x6277('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x6277('0x2')]},'scriptName':{'type':Sequelize[_0x6277('0x2')]},'scriptPath':{'type':Sequelize[_0x6277('0x2')]}}; \ No newline at end of file +var _0x78ed=['sequelize','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','always','never'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x78ed,0x104));var _0xd78e=function(_0x48141c,_0x3bca09){_0x48141c=_0x48141c-0x0;var _0x2e3ffb=_0x78ed[_0x48141c];return _0x2e3ffb;};'use strict';var Sequelize=require(_0xd78e('0x0'));module[_0xd78e('0x1')]={'name':{'type':Sequelize[_0xd78e('0x2')]},'type':{'type':Sequelize[_0xd78e('0x3')](_0xd78e('0x4'),'script')},'description':{'type':Sequelize[_0xd78e('0x5')]},'version':{'type':Sequelize[_0xd78e('0x5')]},'path':{'type':Sequelize[_0xd78e('0x2')],'comment':_0xd78e('0x6')},'active':{'type':Sequelize[_0xd78e('0x7')],'defaultValue':0x0,'comment':_0xd78e('0x8')},'sidebar':{'type':Sequelize[_0xd78e('0x3')](_0xd78e('0x9'),_0xd78e('0xa'),_0xd78e('0xb'),_0xd78e('0xc')),'defaultValue':_0xd78e('0xb'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xd78e('0x2')]},'scriptName':{'type':Sequelize[_0xd78e('0x2')]},'scriptPath':{'type':Sequelize[_0xd78e('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 51e6ae9..4639545 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 _0x72a3=['hasOwnProperty','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','include','find','download','params','root','server/files/plugins','%s.zip','createWriteStream','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','join','dirname','node_modules/**/*','basename','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','always','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','scriptName','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','update','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','archiver','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','localhost','./plugin.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','get','Plugins','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x1c0e23,_0xde3b9f){var _0x8d94c5=function(_0x590692){while(--_0x590692){_0x1c0e23['push'](_0x1c0e23['shift']());}};_0x8d94c5(++_0xde3b9f);}(_0x72a3,0x1c1));var _0x372a=function(_0x483e3a,_0x568361){_0x483e3a=_0x483e3a-0x0;var _0x43fca9=_0x72a3[_0x483e3a];return _0x43fca9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x372a('0x0'));var rimraf=require(_0x372a('0x1'));var zipdir=require(_0x372a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x372a('0x3'));var moment=require(_0x372a('0x4'));var BPromise=require(_0x372a('0x5'));var Mustache=require(_0x372a('0x6'));var util=require(_0x372a('0x7'));var path=require(_0x372a('0x8'));var sox=require(_0x372a('0x9'));var csv=require(_0x372a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x372a('0xb'));var _=require(_0x372a('0xc'));var squel=require(_0x372a('0xd'));var crypto=require(_0x372a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x372a('0xf'));var toCsv=require(_0x372a('0xa'));var querystring=require(_0x372a('0x10'));var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require(_0x372a('0x11'));var Redis=require('ioredis');var authService=require(_0x372a('0x12'));var qs=require(_0x372a('0x13'));var as=require(_0x372a('0x14'));var hardwareService=require(_0x372a('0x15'));var logger=require('../../config/logger')(_0x372a('0x16'));var utils=require(_0x372a('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x372a('0x18'))['db'];config['redis']=_['defaults'](config[_0x372a('0x19')],{'host':_0x372a('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x372a('0x1b'))[_0x372a('0x1c')](socket);function respondWithStatusCode(_0x3584c9,_0x7ad2c3){_0x7ad2c3=_0x7ad2c3||0xcc;return function(_0x4bcd34){if(_0x4bcd34){return _0x3584c9[_0x372a('0x1d')](_0x7ad2c3);}return _0x3584c9['status'](_0x7ad2c3)[_0x372a('0x1e')]();};}function respondWithResult(_0x183029,_0x125a32){_0x125a32=_0x125a32||0xc8;return function(_0x39ac00){if(_0x39ac00){return _0x183029[_0x372a('0x1f')](_0x125a32)[_0x372a('0x20')](_0x39ac00);}};}function respondWithFilteredResult(_0x50fb4b,_0x96335b){return function(_0xf655f9){if(_0xf655f9){var _0x2bf112=_0xf655f9[_0x372a('0x21')],_0x65608c=_0x96335b[_0x372a('0x22')],_0x5b8b72=_0x96335b['offset']+_0x96335b[_0x372a('0x23')],_0x1cd5a5;if(_0x5b8b72>=_0x2bf112){_0x5b8b72=_0x2bf112;_0x1cd5a5=0xc8;}else{_0x1cd5a5=0xce;}_0x50fb4b['status'](_0x1cd5a5);return _0x50fb4b[_0x372a('0x24')](_0x372a('0x25'),_0x65608c+'-'+_0x5b8b72+'/'+_0x2bf112)[_0x372a('0x20')](_0xf655f9);}return null;};}function patchUpdates(_0x2fba0c){return function(_0x1eadf7){try{jsonpatch[_0x372a('0x26')](_0x1eadf7,_0x2fba0c,!![]);}catch(_0x180a76){return BPromise['reject'](_0x180a76);}return _0x1eadf7[_0x372a('0x27')]();};}function saveUpdates(_0x1a8c03,_0x26db01){return function(_0x49665a){if(_0x49665a){return _0x49665a['update'](_0x1a8c03)[_0x372a('0x28')](function(_0x1f4d6b){return _0x1f4d6b;});}return null;};}function removeEntity(_0xf9b1fa,_0x4e85c7){return function(_0x1f24e7){if(_0x1f24e7){return _0x1f24e7[_0x372a('0x29')]()['then'](function(){var _0x219f48=_0x1f24e7[_0x372a('0x2a')]({'plain':!![]});var _0x25874c=_0x372a('0x2b');return db['UserProfileResource'][_0x372a('0x29')]({'where':{'type':_0x25874c,'resourceId':_0x219f48['id']}})[_0x372a('0x28')](function(){return _0x1f24e7;});})[_0x372a('0x28')](function(){_0xf9b1fa['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x281106,_0x430ee5){return function(_0x4c1f56){if(!_0x4c1f56){_0x281106[_0x372a('0x1d')](0x194);}return _0x4c1f56;};}function handleError(_0x19e1dd,_0x193f07){_0x193f07=_0x193f07||0x1f4;return function(_0x15c264){logger[_0x372a('0x2c')](_0x15c264[_0x372a('0x2d')]);if(_0x15c264[_0x372a('0x2e')]){delete _0x15c264[_0x372a('0x2e')];}_0x19e1dd[_0x372a('0x1f')](_0x193f07)[_0x372a('0x2f')](_0x15c264);};}exports[_0x372a('0x30')]=function(_0x33028a,_0x568b5e){var _0x1b9714={},_0xf467fc={},_0x5ca595={'count':0x0,'rows':[]};var _0x42f403=_[_0x372a('0x31')](db[_0x372a('0x32')][_0x372a('0x33')],function(_0x218baf){return{'name':_0x218baf[_0x372a('0x34')],'type':_0x218baf['type']['key']};});_0xf467fc[_0x372a('0x35')]=_[_0x372a('0x31')](_0x42f403,_0x372a('0x2e'));_0xf467fc['query']=_[_0x372a('0x36')](_0x33028a[_0x372a('0x37')]);_0xf467fc[_0x372a('0x38')]=_[_0x372a('0x39')](_0xf467fc[_0x372a('0x35')],_0xf467fc[_0x372a('0x37')]);_0x1b9714[_0x372a('0x3a')]=_[_0x372a('0x39')](_0xf467fc[_0x372a('0x35')],qs[_0x372a('0x3b')](_0x33028a[_0x372a('0x37')][_0x372a('0x3b')]));_0x1b9714[_0x372a('0x3a')]=_0x1b9714[_0x372a('0x3a')][_0x372a('0x3c')]?_0x1b9714[_0x372a('0x3a')]:_0xf467fc['model'];if(!_0x33028a[_0x372a('0x37')][_0x372a('0x3d')]('nolimit')){_0x1b9714[_0x372a('0x23')]=qs[_0x372a('0x23')](_0x33028a[_0x372a('0x37')][_0x372a('0x23')]);_0x1b9714['offset']=qs[_0x372a('0x22')](_0x33028a[_0x372a('0x37')][_0x372a('0x22')]);}_0x1b9714[_0x372a('0x3e')]=qs[_0x372a('0x3f')](_0x33028a[_0x372a('0x37')][_0x372a('0x3f')]);_0x1b9714['where']=qs['filters'](_[_0x372a('0x40')](_0x33028a[_0x372a('0x37')],_0xf467fc[_0x372a('0x38')]),_0x42f403);if(_0x33028a[_0x372a('0x37')]['filter']){_0x1b9714[_0x372a('0x41')]=_[_0x372a('0x42')](_0x1b9714['where'],{'$or':_[_0x372a('0x31')](_0x42f403,function(_0x25243c){if(_0x25243c[_0x372a('0x43')]!==_0x372a('0x44')){var _0x5a9366={};_0x5a9366[_0x25243c['name']]={'$like':'%'+_0x33028a['query'][_0x372a('0x45')]+'%'};return _0x5a9366;}})});}_0x1b9714=_['merge']({},_0x1b9714,_0x33028a[_0x372a('0x46')]);var _0x1743c9={'where':_0x1b9714['where']};return db['Plugin']['count'](_0x1743c9)[_0x372a('0x28')](function(_0x108919){_0x5ca595[_0x372a('0x21')]=_0x108919;if(_0x33028a[_0x372a('0x37')][_0x372a('0x47')]){_0x1b9714['include']=[{'all':!![]}];}return db[_0x372a('0x32')][_0x372a('0x48')](_0x1b9714);})['then'](function(_0x2b57a4){_0x5ca595[_0x372a('0x49')]=_0x2b57a4;return _0x5ca595;})[_0x372a('0x28')](respondWithFilteredResult(_0x568b5e,_0x1b9714))[_0x372a('0x4a')](handleError(_0x568b5e,null));};exports[_0x372a('0x4b')]=function(_0x36f619,_0x309ca6){var _0x2dadf7={'raw':!![],'where':{'id':_0x36f619['params']['id']}},_0x38328e={};_0x38328e['model']=_[_0x372a('0x36')](db[_0x372a('0x32')][_0x372a('0x33')]);_0x38328e[_0x372a('0x37')]=_[_0x372a('0x36')](_0x36f619['query']);_0x38328e[_0x372a('0x38')]=_[_0x372a('0x39')](_0x38328e[_0x372a('0x35')],_0x38328e[_0x372a('0x37')]);_0x2dadf7['attributes']=_[_0x372a('0x39')](_0x38328e[_0x372a('0x35')],qs[_0x372a('0x3b')](_0x36f619['query'][_0x372a('0x3b')]));_0x2dadf7[_0x372a('0x3a')]=_0x2dadf7[_0x372a('0x3a')][_0x372a('0x3c')]?_0x2dadf7['attributes']:_0x38328e[_0x372a('0x35')];if(_0x36f619['query'][_0x372a('0x47')]){_0x2dadf7[_0x372a('0x4c')]=[{'all':!![]}];}_0x2dadf7=_['merge']({},_0x2dadf7,_0x36f619[_0x372a('0x46')]);return db[_0x372a('0x32')][_0x372a('0x4d')](_0x2dadf7)[_0x372a('0x28')](handleEntityNotFound(_0x309ca6,null))[_0x372a('0x28')](respondWithResult(_0x309ca6,null))[_0x372a('0x4a')](handleError(_0x309ca6,null));};exports[_0x372a('0x4e')]=function(_0x1767bc,_0x4b3ce6,_0x1787aa){return db[_0x372a('0x32')]['find']({'where':{'id':_0x1767bc[_0x372a('0x4f')]['id']},'attributes':[_0x372a('0x2e'),_0x372a('0x8')],'raw':!![]})[_0x372a('0x28')](handleEntityNotFound(_0x4b3ce6,null))[_0x372a('0x28')](function(_0x1c7afa){if(_0x1c7afa){var _0x2a34bd=path['join'](config[_0x372a('0x50')],_0x372a('0x51'),util['format'](_0x372a('0x52'),path['basename'](_0x1c7afa[_0x372a('0x8')])));var _0x10285b=fs[_0x372a('0x53')](_0x2a34bd);var _0x501460=archiver('zip',{'zlib':{'level':0x9}});_0x501460['on'](_0x372a('0x54'),function(_0x11b60c){if(_0x11b60c['code']===_0x372a('0x55')){logger[_0x372a('0x2c')](_0x11b60c);}else{throw new db[(_0x372a('0x56'))][(_0x372a('0x57'))](_0x372a('0x58'));}});_0x501460['on'](_0x372a('0x2c'),function(_0x2bc4ff){throw new db['Sequelize'][(_0x372a('0x57'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x501460[_0x372a('0x59')](_0x10285b);_0x501460[_0x372a('0x5a')](_0x372a('0x5b'),{'cwd':path[_0x372a('0x5c')](config[_0x372a('0x50')],_0x372a('0x51'),path[_0x372a('0x5d')](_0x1c7afa[_0x372a('0x8')])),'ignore':[path[_0x372a('0x5c')](path['basename'](_0x1c7afa[_0x372a('0x8')]),_0x372a('0x5e')),path[_0x372a('0x5c')](path[_0x372a('0x5f')](_0x1c7afa[_0x372a('0x8')]),_0x372a('0x60'))],'nodir':!![]})[_0x372a('0x61')]();_0x10285b['on'](_0x372a('0x62'),function(){if(!fs[_0x372a('0x63')](_0x2a34bd)){throw new db[(_0x372a('0x56'))][(_0x372a('0x57'))](_0x372a('0x64'));}return _0x4b3ce6[_0x372a('0x4e')](_0x2a34bd,util[_0x372a('0x65')](_0x372a('0x52'),path[_0x372a('0x5f')](_0x1c7afa['path'])),function(_0x1b54fc){if(_0x1b54fc){throw new db['Sequelize'][(_0x372a('0x57'))](_0x372a('0x66'));}fs[_0x372a('0x67')](_0x2a34bd);logger['info']('Download\x20completed');logger[_0x372a('0x68')]('Temporary\x20file\x20removed');});});}return null;})[_0x372a('0x4a')](handleError(_0x4b3ce6,null));};exports[_0x372a('0x69')]=function(_0x3d7746,_0xf22513,_0x3e72bc){var _0x26fc63=path['basename'](_0x3d7746[_0x372a('0x6a')][_0x372a('0x6b')],path[_0x372a('0x6c')](_0x3d7746[_0x372a('0x6a')]['filename']));var _0x736c3c=path[_0x372a('0x5c')](config[_0x372a('0x50')],_0x372a('0x51'),_0x3d7746[_0x372a('0x6a')][_0x372a('0x6b')]);var _0x3a20f4=path[_0x372a('0x5c')](config['root'],_0x372a('0x51'),_0x26fc63);logger[_0x372a('0x68')](_0x372a('0x6d'),_0x736c3c);logger[_0x372a('0x68')]('Plugin\x20upload\x20destination:\x20%s',_0x3a20f4);try{fs[_0x372a('0x6e')](_0x736c3c,parseInt(_0x372a('0x6f'),0x8));extract(_0x736c3c,{'dir':_0x3a20f4},function(_0x3cbb49){if(_0x3cbb49){logger[_0x372a('0x2c')](_0x3cbb49);handleError(_0x3cbb49,!![]);};var _0x2dcc2c=fs[_0x372a('0x70')](_0x3a20f4);if(_0x2dcc2c[_0x372a('0x3c')]>0x1){removeReferences(_0x736c3c,_0x3a20f4);logger[_0x372a('0x2c')](_0x372a('0x71'));return _0x3e72bc(new Error(_0x372a('0x71')));}var _0x4b9427=fs[_0x372a('0x72')](path[_0x372a('0x5c')](_0x3a20f4,_0x2dcc2c[0x0]));if(_0x4b9427['isFile']()){removeReferences(_0x736c3c,_0x3a20f4);logger[_0x372a('0x2c')](_0x372a('0x71'));return _0x3e72bc(new Error(_0x372a('0x71')));}if(_0x4b9427[_0x372a('0x73')]()){var _0x117d1e=fs[_0x372a('0x70')](path[_0x372a('0x5c')](_0x3a20f4,_0x2dcc2c[0x0]));if(_0x117d1e[_0x372a('0x3c')]===0x0){removeReferences(_0x736c3c,_0x3a20f4);logger[_0x372a('0x2c')](_0x372a('0x71'));return _0x3e72bc(new Error('Invalid\x20plugin\x20structure'));}var _0x3cacce=_0x117d1e[_0x372a('0x74')](function(_0x250511){return _0x250511===_0x372a('0x75');});if(!_0x3cacce){return _0x3e72bc(new Error(_0x372a('0x76')));}var _0x27a5ec=fs[_0x372a('0x77')](path['join'](_0x3a20f4,_0x2dcc2c[0x0],'manifest.json'));var _0x17b87e=JSON[_0x372a('0x78')](_0x27a5ec);if('undefined'==typeof _0x17b87e[_0x372a('0x2e')]){return _0x3e72bc(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x372a('0x79')==typeof _0x17b87e[_0x372a('0x43')]){return _0x3e72bc(new Error(_0x372a('0x7a')));}if('undefined'==typeof _0x17b87e[_0x372a('0x7b')]){return _0x3e72bc(new Error(_0x372a('0x7c')));}if('undefined'==typeof _0x17b87e[_0x372a('0x7d')]){return _0x3e72bc(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x17b87e['type']===_0x372a('0x7e')){if(_0x372a('0x79')==typeof _0x17b87e[_0x372a('0x7d')]['views']){return _0x3e72bc(new Error(_0x372a('0x7f')));}if('undefined'==typeof _0x17b87e['parameters'][_0x372a('0x80')][_0x372a('0x81')]&&'undefined'==typeof _0x17b87e[_0x372a('0x7d')][_0x372a('0x80')][_0x372a('0x82')]){return _0x3e72bc(new Error(_0x372a('0x83')));}}else if(_0x17b87e[_0x372a('0x43')]===_0x372a('0x84')){if(_0x372a('0x79')==typeof _0x17b87e[_0x372a('0x7d')]['scriptName']){return _0x3e72bc(new Error(_0x372a('0x85')));}if(_0x372a('0x79')==typeof _0x17b87e[_0x372a('0x7d')][_0x372a('0x86')]){return _0x3e72bc(new Error(_0x372a('0x87')));}}else{return _0x3e72bc(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x2f1ab5=_0x17b87e[_0x372a('0x2e')];var _0x1342e9=_0x17b87e[_0x372a('0x88')];var _0x27e396=_0x17b87e[_0x372a('0x43')];var _0x430066=_0x17b87e['sidebar']?_0x17b87e['sidebar']:_0x372a('0x89');var _0x389862=_0x17b87e['icon']?_0x17b87e[_0x372a('0x8a')]:'icon-apps';var _0x42a142='';var _0x12af2f='';var _0x5e2154='';var _0x528c31='';var _0x167f98=_0x17b87e[_0x372a('0x7b')];if(_0x27e396===_0x372a('0x7e')){if(_0x372a('0x79')!=typeof _0x17b87e[_0x372a('0x7d')]['views'][_0x372a('0x81')]){var _0x9bed98=_0x17b87e[_0x372a('0x7d')][_0x372a('0x80')][_0x372a('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x372a('0x8b')](_0x9bed98)){_0x42a142=path[_0x372a('0x5c')](_0x372a('0x8c'),_0x26fc63,_0x2dcc2c[0x0],_0x9bed98);}else{_0x42a142=_0x9bed98;}}else{logger[_0x372a('0x68')](_0x372a('0x8d'));}if(_0x372a('0x79')!=typeof _0x17b87e[_0x372a('0x7d')][_0x372a('0x80')][_0x372a('0x82')]){var _0x3e28af=_0x17b87e[_0x372a('0x7d')][_0x372a('0x80')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x3e28af)){_0x12af2f=path['join']('plugins',_0x26fc63,_0x2dcc2c[0x0],_0x3e28af);}else{_0x12af2f=_0x3e28af;}}else{logger[_0x372a('0x68')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x27e396==='script'){_0x5e2154=_0x17b87e[_0x372a('0x7d')][_0x372a('0x8e')];_0x528c31=_0x17b87e[_0x372a('0x7d')][_0x372a('0x86')];if(_0x372a('0x79')!=typeof _0x17b87e[_0x372a('0x7d')][_0x372a('0x80')]){if(_0x372a('0x79')!=typeof _0x17b87e[_0x372a('0x7d')]['views'][_0x372a('0x81')]){var _0x9bed98=_0x17b87e['parameters'][_0x372a('0x80')][_0x372a('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x372a('0x8b')](_0x9bed98)){_0x42a142=path['join']('plugins',_0x26fc63,_0x2dcc2c[0x0],_0x9bed98);}else{_0x42a142=_0x9bed98;}}if(_0x372a('0x79')!=typeof _0x17b87e[_0x372a('0x7d')][_0x372a('0x80')][_0x372a('0x82')]){var _0x3e28af=_0x17b87e[_0x372a('0x7d')][_0x372a('0x80')][_0x372a('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x372a('0x8b')](_0x3e28af)){_0x12af2f=path[_0x372a('0x5c')](_0x372a('0x8c'),_0x26fc63,_0x2dcc2c[0x0],_0x3e28af);}else{_0x12af2f=_0x3e28af;}}}}var _0x297bbf={'name':_0x2f1ab5,'description':_0x1342e9,'path':path[_0x372a('0x5c')](_0x26fc63,_0x2dcc2c[0x0]),'type':_0x27e396,'sidebar':_0x430066,'icon':_0x389862,'adminUrl':_0x42a142,'agentUrl':_0x12af2f,'scriptName':_0x5e2154,'scriptPath':_0x528c31,'version':_0x167f98};removeReferences(_0x736c3c,null);return db[_0x372a('0x32')][_0x372a('0x8f')](_0x297bbf)[_0x372a('0x28')](function(_0x19bc6f){var _0x1e10f7={'role':_0x3d7746[_0x372a('0x90')][_0x372a('0x91')],'userProfileId':_0x3d7746[_0x372a('0x90')][_0x372a('0x92')]};if(!_0x1e10f7)throw new Error(_0x372a('0x93'));if(_0x1e10f7[_0x372a('0x91')]===_0x372a('0x94')){var _0x2d0a57=_0x19bc6f['get']({'plain':!![]});return db['UserProfileSection'][_0x372a('0x4d')]({'where':{'name':_0x372a('0x2b'),'userProfileId':_0x1e10f7['userProfileId']},'raw':!![]})[_0x372a('0x28')](function(_0x67f5c0){if(_0x67f5c0&&_0x67f5c0['autoAssociation']===0x0){return db[_0x372a('0x95')]['create']({'name':_0x2d0a57[_0x372a('0x2e')],'resourceId':_0x2d0a57['id'],'type':_0x67f5c0['name'],'sectionId':_0x67f5c0['id']},{})[_0x372a('0x28')](function(){return _0x19bc6f;});}else{return _0x19bc6f;}})[_0x372a('0x4a')](function(_0x4be6d5){logger[_0x372a('0x2c')](_0x372a('0x96'),_0x4be6d5);throw _0x4be6d5;});}return _0x19bc6f;})[_0x372a('0x28')](respondWithResult(_0xf22513,null))[_0x372a('0x4a')](handleError(_0xf22513,null));}});}catch(_0x4a3a1d){_0xf22513[_0x372a('0x1f')](0x1f4)[_0x372a('0x2f')](_0x4a3a1d);}};function removeReferences(_0x3425aa,_0x502b97){try{if(_0x3425aa){fs[_0x372a('0x67')](_0x3425aa);logger['info']('Zip\x20archive\x20removed');}if(_0x502b97){rimraf(_0x502b97,function(){});logger[_0x372a('0x68')](_0x372a('0x97'));}}catch(_0x95752d){logger[_0x372a('0x2c')](_0x95752d);}}exports[_0x372a('0x98')]=function(_0x2ecb0d,_0x47f187,_0x38e793){return db['Plugin'][_0x372a('0x4d')]({'where':{'id':_0x2ecb0d[_0x372a('0x4f')]['id']}})[_0x372a('0x28')](handleEntityNotFound(_0x47f187,null))[_0x372a('0x28')](saveUpdates(_0x2ecb0d[_0x372a('0x90')],null))['then'](respondWithResult(_0x47f187,null))[_0x372a('0x4a')](handleError(_0x47f187,null));};exports[_0x372a('0x99')]=function(_0x1eb719,_0xdc0096,_0x49f31a){return db[_0x372a('0x32')][_0x372a('0x4d')]({'where':{'id':_0x1eb719[_0x372a('0x4f')]['id']}})['then'](function(_0x18f095){if(_0x18f095){return _0x18f095[_0x372a('0x29')]();}})['then'](function(_0xdb7b1a){rimraf(path[_0x372a('0x5c')](config[_0x372a('0x50')],'server/files/plugins',path[_0x372a('0x5d')](_0xdb7b1a['path'])),function(){});return _0xdb7b1a;})[_0x372a('0x28')](handleEntityNotFound(_0xdc0096,null))[_0x372a('0x28')](respondWithStatusCode(_0xdc0096,null))[_0x372a('0x4a')](handleError(_0xdc0096,null));};exports[_0x372a('0x9a')]=function(_0x14abf0,_0x145349,_0x54c498){return BPromise[_0x372a('0x9b')]()[_0x372a('0x28')](function(){if(!_0x14abf0['query'][_0x372a('0x8')]){throw new Error(_0x372a('0x9c'));}if(!_0x14abf0[_0x372a('0x37')][_0x372a('0x9d')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x30bf0d=_0x14abf0[_0x372a('0x37')][_0x372a('0x9e')]?_0x14abf0['query'][_0x372a('0x9e')]+':'+_0x14abf0[_0x372a('0x37')]['port']:_0x372a('0x9f')+_0x14abf0[_0x372a('0x37')][_0x372a('0x9d')];var _0xcb9707=_0x14abf0[_0x372a('0x37')][_0x372a('0x20')]?_0x14abf0[_0x372a('0x37')][_0x372a('0x20')]:!![];var _0x27339d=_0x14abf0[_0x372a('0x37')][_0x372a('0xa0')]?_0x14abf0[_0x372a('0x37')][_0x372a('0xa0')]:null;var _0xf1c60d={'method':_0x14abf0[_0x372a('0xa1')],'uri':util[_0x372a('0x65')](_0x372a('0xa2'),_0x30bf0d,_0x14abf0['query'][_0x372a('0x8')]),'json':_0xcb9707,'resolveWithFullResponse':!![],'encoding':_0x27339d,'qs':_0x14abf0[_0x372a('0x37')]};if(_0x14abf0['headers']){_0xf1c60d[_0x372a('0xa3')]=_0x14abf0[_0x372a('0xa3')];if(_0xf1c60d[_0x372a('0xa3')][_0x372a('0xa4')]){delete _0xf1c60d['headers']['content-length'];}}if(_0xf1c60d[_0x372a('0xa3')][_0x372a('0xa5')]){delete _0xf1c60d[_0x372a('0xa3')][_0x372a('0xa5')];}return rp(_0xf1c60d);})[_0x372a('0x28')](function(_0x49442f){if(_0x49442f){_0x145349[_0x372a('0x24')](_0x49442f[_0x372a('0xa3')]);logger[_0x372a('0x68')](_0x49442f[_0x372a('0x90')]);if(_[_0x372a('0xa6')](_0x14abf0[_0x372a('0x37')][_0x372a('0x8')],_0x372a('0x4e'))&&_0x49442f[_0x372a('0xa7')]==0x1f4){return _0x145349[_0x372a('0x1d')](_0x49442f[_0x372a('0xa7')]);}else{return _0x145349['status'](_0x49442f[_0x372a('0xa7')])['send'](_0x49442f['body']);}}else{return _0x145349[_0x372a('0x1d')](0xc8);}})[_0x372a('0x4a')](handleError(_0x145349,null));};exports[_0x372a('0xa8')]=function(_0xf2929c,_0x87a460,_0x435802){return BPromise[_0x372a('0x9b')]()['then'](function(){if(!_0xf2929c[_0x372a('0x37')]['path']){throw new Error(_0x372a('0x9c'));}if(!_0xf2929c['query']['port']){throw new Error(_0x372a('0xa9'));}var _0xf4c98d=_0xf2929c['query'][_0x372a('0x9e')]?_0xf2929c[_0x372a('0x37')][_0x372a('0x9e')]+':'+_0xf2929c[_0x372a('0x37')][_0x372a('0x9d')]:'http://localhost:'+_0xf2929c[_0x372a('0x37')][_0x372a('0x9d')];var _0xee9bea=_0xf2929c[_0x372a('0x37')]['json']?_0xf2929c[_0x372a('0x37')]['json']:!![];var _0xaafcba=_0xf2929c[_0x372a('0x37')][_0x372a('0xa0')]?_0xf2929c[_0x372a('0x37')]['encoding']:null;var _0xc03ccc={'method':_0xf2929c[_0x372a('0xa1')],'uri':util[_0x372a('0x65')]('%s%s',_0xf4c98d,_0xf2929c[_0x372a('0x37')]['path']),'json':_0xee9bea,'resolveWithFullResponse':!![],'encoding':_0xaafcba,'body':_0xf2929c[_0x372a('0x90')]};if(_0xf2929c['headers']){_0xc03ccc[_0x372a('0xa3')]=_0xf2929c[_0x372a('0xa3')];if(_0xc03ccc[_0x372a('0xa3')]['content-length']){delete _0xc03ccc[_0x372a('0xa3')][_0x372a('0xa4')];}}if(_0xc03ccc['headers'][_0x372a('0xa5')]){delete _0xc03ccc[_0x372a('0xa3')][_0x372a('0xa5')];}return rp(_0xc03ccc);})[_0x372a('0x28')](function(_0x3623a3){if(_0x3623a3){_0x87a460[_0x372a('0x24')](_0x3623a3[_0x372a('0xa3')]);logger[_0x372a('0x68')](_0x3623a3[_0x372a('0x90')]);return _0x87a460[_0x372a('0x1f')](_0x3623a3['statusCode'])[_0x372a('0x2f')](_0x3623a3[_0x372a('0x90')]);}else{return _0x87a460[_0x372a('0x1d')](0xc8);}})['catch'](handleError(_0x87a460,null));}; \ No newline at end of file +var _0x92d4=['\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','statusCode','\x27PATH\x27\x20parameter\x20not\x20specified','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','count','offset','Content-Range','json','reject','save','update','then','destroy','get','Plugins','UserProfileResource','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','Plugin','includeAll','rows','catch','show','include','find','download','params','path','join','root','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','glob','**/*','server/files/plugins','finalize','existsSync','Plugin\x20not\x20found','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20destination:\x20%s','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','undefined','Invalid\x20manifest:\x20type\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','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','dirname','webhookGet','resolve','port'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x92d4,0x16a));var _0x492d=function(_0x4c25c4,_0xef0ef4){_0x4c25c4=_0x4c25c4-0x0;var _0x5ec546=_0x92d4[_0x4c25c4];return _0x5ec546;};'use strict';var pdf=require(_0x492d('0x0'));var emlformat=require(_0x492d('0x1'));var rimraf=require(_0x492d('0x2'));var zipdir=require(_0x492d('0x3'));var jsonpatch=require(_0x492d('0x4'));var rp=require(_0x492d('0x5'));var moment=require('moment');var BPromise=require(_0x492d('0x6'));var Mustache=require(_0x492d('0x7'));var util=require(_0x492d('0x8'));var path=require('path');var sox=require(_0x492d('0x9'));var csv=require(_0x492d('0xa'));var ejs=require(_0x492d('0xb'));var fs=require('fs');var fs_extra=require(_0x492d('0xc'));var _=require(_0x492d('0xd'));var squel=require('squel');var crypto=require(_0x492d('0xe'));var jsforce=require(_0x492d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x492d('0xa'));var querystring=require(_0x492d('0x10'));var Papa=require('papaparse');var extract=require(_0x492d('0x11'));var rimraf=require('rimraf');var archiver=require(_0x492d('0x12'));var Redis=require(_0x492d('0x13'));var authService=require(_0x492d('0x14'));var qs=require(_0x492d('0x15'));var as=require(_0x492d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x492d('0x17'))(_0x492d('0x18'));var utils=require(_0x492d('0x19'));var config=require(_0x492d('0x1a'));var licenseUtil=require(_0x492d('0x1b'));var db=require(_0x492d('0x1c'))['db'];config[_0x492d('0x1d')]=_[_0x492d('0x1e')](config[_0x492d('0x1d')],{'host':_0x492d('0x1f'),'port':0x18eb});var socket=require(_0x492d('0x20'))(new Redis(config[_0x492d('0x1d')]));require('./plugin.socket')[_0x492d('0x21')](socket);function respondWithStatusCode(_0x17a597,_0x3bb88f){_0x3bb88f=_0x3bb88f||0xcc;return function(_0x37f353){if(_0x37f353){return _0x17a597[_0x492d('0x22')](_0x3bb88f);}return _0x17a597[_0x492d('0x23')](_0x3bb88f)['end']();};}function respondWithResult(_0x14b2cf,_0x48ff39){_0x48ff39=_0x48ff39||0xc8;return function(_0x3e45a2){if(_0x3e45a2){return _0x14b2cf[_0x492d('0x23')](_0x48ff39)['json'](_0x3e45a2);}};}function respondWithFilteredResult(_0x324d02,_0x2c22fe){return function(_0x12fd6a){if(_0x12fd6a){var _0x1196e8=_0x12fd6a[_0x492d('0x24')],_0x364259=_0x2c22fe[_0x492d('0x25')],_0x508634=_0x2c22fe[_0x492d('0x25')]+_0x2c22fe['limit'],_0x446760;if(_0x508634>=_0x1196e8){_0x508634=_0x1196e8;_0x446760=0xc8;}else{_0x446760=0xce;}_0x324d02[_0x492d('0x23')](_0x446760);return _0x324d02['set'](_0x492d('0x26'),_0x364259+'-'+_0x508634+'/'+_0x1196e8)[_0x492d('0x27')](_0x12fd6a);}return null;};}function patchUpdates(_0x2e5840){return function(_0xbc481a){try{jsonpatch['apply'](_0xbc481a,_0x2e5840,!![]);}catch(_0x4d0a94){return BPromise[_0x492d('0x28')](_0x4d0a94);}return _0xbc481a[_0x492d('0x29')]();};}function saveUpdates(_0x4182b8,_0x144eff){return function(_0x2275ba){if(_0x2275ba){return _0x2275ba[_0x492d('0x2a')](_0x4182b8)[_0x492d('0x2b')](function(_0xdfa7eb){return _0xdfa7eb;});}return null;};}function removeEntity(_0x5b3f77,_0x22dca6){return function(_0x54ac88){if(_0x54ac88){return _0x54ac88[_0x492d('0x2c')]()[_0x492d('0x2b')](function(){var _0x511aed=_0x54ac88[_0x492d('0x2d')]({'plain':!![]});var _0x5ba704=_0x492d('0x2e');return db[_0x492d('0x2f')][_0x492d('0x2c')]({'where':{'type':_0x5ba704,'resourceId':_0x511aed['id']}})[_0x492d('0x2b')](function(){return _0x54ac88;});})[_0x492d('0x2b')](function(){_0x5b3f77[_0x492d('0x23')](0xcc)[_0x492d('0x30')]();});}};}function handleEntityNotFound(_0x86e2fb,_0x392560){return function(_0x81ffc5){if(!_0x81ffc5){_0x86e2fb[_0x492d('0x22')](0x194);}return _0x81ffc5;};}function handleError(_0x3a0694,_0x1250ae){_0x1250ae=_0x1250ae||0x1f4;return function(_0x23745d){logger[_0x492d('0x31')](_0x23745d[_0x492d('0x32')]);if(_0x23745d[_0x492d('0x33')]){delete _0x23745d['name'];}_0x3a0694[_0x492d('0x23')](_0x1250ae)[_0x492d('0x34')](_0x23745d);};}exports[_0x492d('0x35')]=function(_0x49f281,_0x91fcc1){var _0x5e8c6b={},_0xb25c0d={},_0x1649d0={'count':0x0,'rows':[]};var _0x187314=_['map'](db['Plugin'][_0x492d('0x36')],function(_0x380d2b){return{'name':_0x380d2b[_0x492d('0x37')],'type':_0x380d2b[_0x492d('0x38')][_0x492d('0x39')]};});_0xb25c0d[_0x492d('0x3a')]=_[_0x492d('0x3b')](_0x187314,_0x492d('0x33'));_0xb25c0d[_0x492d('0x3c')]=_['keys'](_0x49f281[_0x492d('0x3c')]);_0xb25c0d[_0x492d('0x3d')]=_[_0x492d('0x3e')](_0xb25c0d[_0x492d('0x3a')],_0xb25c0d['query']);_0x5e8c6b[_0x492d('0x3f')]=_['intersection'](_0xb25c0d['model'],qs[_0x492d('0x40')](_0x49f281[_0x492d('0x3c')][_0x492d('0x40')]));_0x5e8c6b[_0x492d('0x3f')]=_0x5e8c6b[_0x492d('0x3f')][_0x492d('0x41')]?_0x5e8c6b[_0x492d('0x3f')]:_0xb25c0d['model'];if(!_0x49f281['query'][_0x492d('0x42')](_0x492d('0x43'))){_0x5e8c6b['limit']=qs[_0x492d('0x44')](_0x49f281[_0x492d('0x3c')]['limit']);_0x5e8c6b[_0x492d('0x25')]=qs[_0x492d('0x25')](_0x49f281[_0x492d('0x3c')][_0x492d('0x25')]);}_0x5e8c6b[_0x492d('0x45')]=qs[_0x492d('0x46')](_0x49f281[_0x492d('0x3c')][_0x492d('0x46')]);_0x5e8c6b[_0x492d('0x47')]=qs[_0x492d('0x3d')](_['pick'](_0x49f281['query'],_0xb25c0d['filters']),_0x187314);if(_0x49f281['query'][_0x492d('0x48')]){_0x5e8c6b[_0x492d('0x47')]=_[_0x492d('0x49')](_0x5e8c6b['where'],{'$or':_[_0x492d('0x3b')](_0x187314,function(_0x46a517){if(_0x46a517[_0x492d('0x38')]!==_0x492d('0x4a')){var _0xa163a2={};_0xa163a2[_0x46a517[_0x492d('0x33')]]={'$like':'%'+_0x49f281[_0x492d('0x3c')]['filter']+'%'};return _0xa163a2;}})});}_0x5e8c6b=_['merge']({},_0x5e8c6b,_0x49f281[_0x492d('0x4b')]);var _0x3ff95b={'where':_0x5e8c6b[_0x492d('0x47')]};return db[_0x492d('0x4c')]['count'](_0x3ff95b)[_0x492d('0x2b')](function(_0x2babcf){_0x1649d0['count']=_0x2babcf;if(_0x49f281[_0x492d('0x3c')][_0x492d('0x4d')]){_0x5e8c6b['include']=[{'all':!![]}];}return db[_0x492d('0x4c')]['findAll'](_0x5e8c6b);})[_0x492d('0x2b')](function(_0x35408b){_0x1649d0[_0x492d('0x4e')]=_0x35408b;return _0x1649d0;})[_0x492d('0x2b')](respondWithFilteredResult(_0x91fcc1,_0x5e8c6b))[_0x492d('0x4f')](handleError(_0x91fcc1,null));};exports[_0x492d('0x50')]=function(_0x2bd5d7,_0x173e73){var _0x5c8d12={'raw':!![],'where':{'id':_0x2bd5d7['params']['id']}},_0x53de87={};_0x53de87['model']=_['keys'](db[_0x492d('0x4c')]['rawAttributes']);_0x53de87['query']=_['keys'](_0x2bd5d7[_0x492d('0x3c')]);_0x53de87['filters']=_[_0x492d('0x3e')](_0x53de87[_0x492d('0x3a')],_0x53de87[_0x492d('0x3c')]);_0x5c8d12[_0x492d('0x3f')]=_[_0x492d('0x3e')](_0x53de87[_0x492d('0x3a')],qs[_0x492d('0x40')](_0x2bd5d7[_0x492d('0x3c')][_0x492d('0x40')]));_0x5c8d12[_0x492d('0x3f')]=_0x5c8d12['attributes'][_0x492d('0x41')]?_0x5c8d12[_0x492d('0x3f')]:_0x53de87[_0x492d('0x3a')];if(_0x2bd5d7['query'][_0x492d('0x4d')]){_0x5c8d12[_0x492d('0x51')]=[{'all':!![]}];}_0x5c8d12=_[_0x492d('0x49')]({},_0x5c8d12,_0x2bd5d7['options']);return db[_0x492d('0x4c')][_0x492d('0x52')](_0x5c8d12)[_0x492d('0x2b')](handleEntityNotFound(_0x173e73,null))[_0x492d('0x2b')](respondWithResult(_0x173e73,null))[_0x492d('0x4f')](handleError(_0x173e73,null));};exports[_0x492d('0x53')]=function(_0x50327c,_0x3cc093,_0x2b9c81){return db[_0x492d('0x4c')][_0x492d('0x52')]({'where':{'id':_0x50327c[_0x492d('0x54')]['id']},'attributes':[_0x492d('0x33'),_0x492d('0x55')],'raw':!![]})[_0x492d('0x2b')](handleEntityNotFound(_0x3cc093,null))[_0x492d('0x2b')](function(_0x1895dd){if(_0x1895dd){var _0x4c3607=path[_0x492d('0x56')](config[_0x492d('0x57')],'server/files/plugins',util[_0x492d('0x58')](_0x492d('0x59'),path[_0x492d('0x5a')](_0x1895dd[_0x492d('0x55')])));var _0x47a8bf=fs[_0x492d('0x5b')](_0x4c3607);var _0x1e0b00=archiver(_0x492d('0x5c'),{'zlib':{'level':0x9}});_0x1e0b00['on'](_0x492d('0x5d'),function(_0x20e58d){if(_0x20e58d[_0x492d('0x5e')]===_0x492d('0x5f')){logger[_0x492d('0x31')](_0x20e58d);}else{throw new db[(_0x492d('0x60'))]['Error'](_0x492d('0x61'));}});_0x1e0b00['on']('error',function(_0x4ff41d){throw new db[(_0x492d('0x60'))][(_0x492d('0x62'))](_0x492d('0x61'));});_0x1e0b00[_0x492d('0x63')](_0x47a8bf);_0x1e0b00[_0x492d('0x64')](_0x492d('0x65'),{'cwd':path[_0x492d('0x56')](config[_0x492d('0x57')],_0x492d('0x66'),path['dirname'](_0x1895dd[_0x492d('0x55')])),'ignore':[path['join'](path[_0x492d('0x5a')](_0x1895dd[_0x492d('0x55')]),'node_modules/**/*'),path['join'](path[_0x492d('0x5a')](_0x1895dd['path']),'attachments/**/*')],'nodir':!![]})[_0x492d('0x67')]();_0x47a8bf['on']('close',function(){if(!fs[_0x492d('0x68')](_0x4c3607)){throw new db['Sequelize']['Error'](_0x492d('0x69'));}return _0x3cc093[_0x492d('0x53')](_0x4c3607,util[_0x492d('0x58')](_0x492d('0x59'),path[_0x492d('0x5a')](_0x1895dd['path'])),function(_0x52c5c6){if(_0x52c5c6){throw new db[(_0x492d('0x60'))]['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs['unlinkSync'](_0x4c3607);logger[_0x492d('0x6a')](_0x492d('0x6b'));logger[_0x492d('0x6a')](_0x492d('0x6c'));});});}return null;})[_0x492d('0x4f')](handleError(_0x3cc093,null));};exports[_0x492d('0x6d')]=function(_0x1f0fec,_0x86dd29,_0x27ce11){var _0x1a8c2a=path[_0x492d('0x5a')](_0x1f0fec[_0x492d('0x6e')][_0x492d('0x6f')],path['extname'](_0x1f0fec[_0x492d('0x6e')][_0x492d('0x6f')]));var _0x3cf646=path['join'](config[_0x492d('0x57')],_0x492d('0x66'),_0x1f0fec[_0x492d('0x6e')][_0x492d('0x6f')]);var _0x1f32d7=path[_0x492d('0x56')](config[_0x492d('0x57')],_0x492d('0x66'),_0x1a8c2a);logger[_0x492d('0x6a')]('Plugin\x20upload\x20filepath:\x20%s',_0x3cf646);logger[_0x492d('0x6a')](_0x492d('0x70'),_0x1f32d7);try{fs['chmodSync'](_0x3cf646,parseInt('0777',0x8));extract(_0x3cf646,{'dir':_0x1f32d7},function(_0x564d25){if(_0x564d25){logger['error'](_0x564d25);handleError(_0x564d25,!![]);};var _0x48ceda=fs[_0x492d('0x71')](_0x1f32d7);if(_0x48ceda['length']>0x1){removeReferences(_0x3cf646,_0x1f32d7);logger['error']('Invalid\x20plugin\x20structure');return _0x27ce11(new Error(_0x492d('0x72')));}var _0x2c2561=fs[_0x492d('0x73')](path['join'](_0x1f32d7,_0x48ceda[0x0]));if(_0x2c2561[_0x492d('0x74')]()){removeReferences(_0x3cf646,_0x1f32d7);logger[_0x492d('0x31')]('Invalid\x20plugin\x20structure');return _0x27ce11(new Error(_0x492d('0x72')));}if(_0x2c2561[_0x492d('0x75')]()){var _0x435d3d=fs[_0x492d('0x71')](path['join'](_0x1f32d7,_0x48ceda[0x0]));if(_0x435d3d[_0x492d('0x41')]===0x0){removeReferences(_0x3cf646,_0x1f32d7);logger[_0x492d('0x31')](_0x492d('0x72'));return _0x27ce11(new Error(_0x492d('0x72')));}var _0x5dd380=_0x435d3d[_0x492d('0x76')](function(_0x28a10d){return _0x28a10d===_0x492d('0x77');});if(!_0x5dd380){return _0x27ce11(new Error(_0x492d('0x78')));}var _0x26b3e7=fs['readFileSync'](path['join'](_0x1f32d7,_0x48ceda[0x0],'manifest.json'));var _0x29fa0e=JSON[_0x492d('0x79')](_0x26b3e7);if(_0x492d('0x7a')==typeof _0x29fa0e['name']){return _0x27ce11(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x492d('0x7a')==typeof _0x29fa0e[_0x492d('0x38')]){return _0x27ce11(new Error(_0x492d('0x7b')));}if(_0x492d('0x7a')==typeof _0x29fa0e[_0x492d('0x7c')]){return _0x27ce11(new Error(_0x492d('0x7d')));}if(_0x492d('0x7a')==typeof _0x29fa0e[_0x492d('0x7e')]){return _0x27ce11(new Error(_0x492d('0x7f')));}if(_0x29fa0e[_0x492d('0x38')]===_0x492d('0x80')){if(_0x492d('0x7a')==typeof _0x29fa0e['parameters'][_0x492d('0x81')]){return _0x27ce11(new Error(_0x492d('0x82')));}if('undefined'==typeof _0x29fa0e[_0x492d('0x7e')][_0x492d('0x81')][_0x492d('0x83')]&&_0x492d('0x7a')==typeof _0x29fa0e[_0x492d('0x7e')][_0x492d('0x81')][_0x492d('0x84')]){return _0x27ce11(new Error(_0x492d('0x85')));}}else if(_0x29fa0e[_0x492d('0x38')]==='script'){if(_0x492d('0x7a')==typeof _0x29fa0e[_0x492d('0x7e')][_0x492d('0x86')]){return _0x27ce11(new Error(_0x492d('0x87')));}if('undefined'==typeof _0x29fa0e['parameters'][_0x492d('0x88')]){return _0x27ce11(new Error(_0x492d('0x89')));}}else{return _0x27ce11(new Error(_0x492d('0x8a')));}var _0x24a914=_0x29fa0e[_0x492d('0x33')];var _0x517a4c=_0x29fa0e[_0x492d('0x8b')];var _0x8af6da=_0x29fa0e[_0x492d('0x38')];var _0x4f3f7b=_0x29fa0e[_0x492d('0x8c')]?_0x29fa0e[_0x492d('0x8c')]:_0x492d('0x8d');var _0xc135f1=_0x29fa0e[_0x492d('0x8e')]?_0x29fa0e[_0x492d('0x8e')]:_0x492d('0x8f');var _0x267c2b='';var _0x500796='';var _0x46d555='';var _0x548869='';var _0x3e3dcc=_0x29fa0e['version'];if(_0x8af6da===_0x492d('0x80')){if(_0x492d('0x7a')!=typeof _0x29fa0e[_0x492d('0x7e')]['views'][_0x492d('0x83')]){var _0x1872e5=_0x29fa0e[_0x492d('0x7e')][_0x492d('0x81')][_0x492d('0x83')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1872e5)){_0x267c2b=path[_0x492d('0x56')](_0x492d('0x90'),_0x1a8c2a,_0x48ceda[0x0],_0x1872e5);}else{_0x267c2b=_0x1872e5;}}else{logger[_0x492d('0x6a')](_0x492d('0x91'));}if(_0x492d('0x7a')!=typeof _0x29fa0e[_0x492d('0x7e')][_0x492d('0x81')]['agent']){var _0x4e3d02=_0x29fa0e[_0x492d('0x7e')][_0x492d('0x81')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x492d('0x92')](_0x4e3d02)){_0x500796=path[_0x492d('0x56')]('plugins',_0x1a8c2a,_0x48ceda[0x0],_0x4e3d02);}else{_0x500796=_0x4e3d02;}}else{logger[_0x492d('0x6a')](_0x492d('0x93'));}}else if(_0x8af6da==='script'){_0x46d555=_0x29fa0e['parameters'][_0x492d('0x86')];_0x548869=_0x29fa0e[_0x492d('0x7e')][_0x492d('0x88')];if(_0x492d('0x7a')!=typeof _0x29fa0e['parameters'][_0x492d('0x81')]){if(_0x492d('0x7a')!=typeof _0x29fa0e[_0x492d('0x7e')][_0x492d('0x81')][_0x492d('0x83')]){var _0x1872e5=_0x29fa0e[_0x492d('0x7e')][_0x492d('0x81')][_0x492d('0x83')];if(!/^(f|ht)tps?:\/\//i[_0x492d('0x92')](_0x1872e5)){_0x267c2b=path['join'](_0x492d('0x90'),_0x1a8c2a,_0x48ceda[0x0],_0x1872e5);}else{_0x267c2b=_0x1872e5;}}if(_0x492d('0x7a')!=typeof _0x29fa0e[_0x492d('0x7e')][_0x492d('0x81')][_0x492d('0x84')]){var _0x4e3d02=_0x29fa0e[_0x492d('0x7e')][_0x492d('0x81')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x492d('0x92')](_0x4e3d02)){_0x500796=path[_0x492d('0x56')](_0x492d('0x90'),_0x1a8c2a,_0x48ceda[0x0],_0x4e3d02);}else{_0x500796=_0x4e3d02;}}}}var _0x2ba1c2={'name':_0x24a914,'description':_0x517a4c,'path':path[_0x492d('0x56')](_0x1a8c2a,_0x48ceda[0x0]),'type':_0x8af6da,'sidebar':_0x4f3f7b,'icon':_0xc135f1,'adminUrl':_0x267c2b,'agentUrl':_0x500796,'scriptName':_0x46d555,'scriptPath':_0x548869,'version':_0x3e3dcc};removeReferences(_0x3cf646,null);return db[_0x492d('0x4c')][_0x492d('0x94')](_0x2ba1c2)['then'](function(_0x18f588){var _0x35c6c3={'role':_0x1f0fec[_0x492d('0x95')][_0x492d('0x96')],'userProfileId':_0x1f0fec[_0x492d('0x95')]['userProfileId']};if(!_0x35c6c3)throw new Error(_0x492d('0x97'));if(_0x35c6c3[_0x492d('0x96')]==='user'){var _0x3e82c6=_0x18f588[_0x492d('0x2d')]({'plain':!![]});return db[_0x492d('0x98')]['find']({'where':{'name':_0x492d('0x2e'),'userProfileId':_0x35c6c3[_0x492d('0x99')]},'raw':!![]})[_0x492d('0x2b')](function(_0x10d084){if(_0x10d084&&_0x10d084[_0x492d('0x9a')]===0x0){return db[_0x492d('0x2f')][_0x492d('0x94')]({'name':_0x3e82c6[_0x492d('0x33')],'resourceId':_0x3e82c6['id'],'type':_0x10d084[_0x492d('0x33')],'sectionId':_0x10d084['id']},{})[_0x492d('0x2b')](function(){return _0x18f588;});}else{return _0x18f588;}})[_0x492d('0x4f')](function(_0x5f03bb){logger[_0x492d('0x31')](_0x492d('0x9b'),_0x5f03bb);throw _0x5f03bb;});}return _0x18f588;})[_0x492d('0x2b')](respondWithResult(_0x86dd29,null))['catch'](handleError(_0x86dd29,null));}});}catch(_0x14b8a6){_0x86dd29['status'](0x1f4)[_0x492d('0x34')](_0x14b8a6);}};function removeReferences(_0x1537c1,_0x33c1b2){try{if(_0x1537c1){fs['unlinkSync'](_0x1537c1);logger[_0x492d('0x6a')](_0x492d('0x9c'));}if(_0x33c1b2){rimraf(_0x33c1b2,function(){});logger[_0x492d('0x6a')](_0x492d('0x9d'));}}catch(_0x53822a){logger[_0x492d('0x31')](_0x53822a);}}exports['update']=function(_0x2912de,_0x1eeccb,_0x59e0eb){return db[_0x492d('0x4c')][_0x492d('0x52')]({'where':{'id':_0x2912de[_0x492d('0x54')]['id']}})[_0x492d('0x2b')](handleEntityNotFound(_0x1eeccb,null))[_0x492d('0x2b')](saveUpdates(_0x2912de[_0x492d('0x95')],null))[_0x492d('0x2b')](respondWithResult(_0x1eeccb,null))['catch'](handleError(_0x1eeccb,null));};exports[_0x492d('0x9e')]=function(_0x416193,_0x1f0013,_0x5d0f4e){return db[_0x492d('0x4c')]['find']({'where':{'id':_0x416193[_0x492d('0x54')]['id']}})[_0x492d('0x2b')](function(_0x2c5e3d){if(_0x2c5e3d){return _0x2c5e3d[_0x492d('0x2c')]();}})[_0x492d('0x2b')](function(_0x1fd9ca){rimraf(path['join'](config[_0x492d('0x57')],_0x492d('0x66'),path[_0x492d('0x9f')](_0x1fd9ca['path'])),function(){});return _0x1fd9ca;})[_0x492d('0x2b')](handleEntityNotFound(_0x1f0013,null))[_0x492d('0x2b')](respondWithStatusCode(_0x1f0013,null))['catch'](handleError(_0x1f0013,null));};exports[_0x492d('0xa0')]=function(_0x1622c8,_0x50d0f4,_0x200393){return BPromise[_0x492d('0xa1')]()[_0x492d('0x2b')](function(){if(!_0x1622c8[_0x492d('0x3c')][_0x492d('0x55')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x1622c8[_0x492d('0x3c')][_0x492d('0xa2')]){throw new Error(_0x492d('0xa3'));}var _0xbc9267=_0x1622c8[_0x492d('0x3c')][_0x492d('0xa4')]?_0x1622c8[_0x492d('0x3c')]['hostname']+':'+_0x1622c8['query'][_0x492d('0xa2')]:_0x492d('0xa5')+_0x1622c8[_0x492d('0x3c')]['port'];var _0x5a79db=_0x1622c8['query'][_0x492d('0x27')]?_0x1622c8['query'][_0x492d('0x27')]:!![];var _0x4f4444=_0x1622c8[_0x492d('0x3c')]['encoding']?_0x1622c8[_0x492d('0x3c')][_0x492d('0xa6')]:null;var _0x1b4e25={'method':_0x1622c8[_0x492d('0xa7')],'uri':util[_0x492d('0x58')](_0x492d('0xa8'),_0xbc9267,_0x1622c8['query']['path']),'json':_0x5a79db,'resolveWithFullResponse':!![],'encoding':_0x4f4444,'qs':_0x1622c8[_0x492d('0x3c')]};if(_0x1622c8['headers']){_0x1b4e25[_0x492d('0xa9')]=_0x1622c8[_0x492d('0xa9')];if(_0x1b4e25['headers'][_0x492d('0xaa')]){delete _0x1b4e25[_0x492d('0xa9')][_0x492d('0xaa')];}}if(_0x1b4e25[_0x492d('0xa9')][_0x492d('0xab')]){delete _0x1b4e25[_0x492d('0xa9')][_0x492d('0xab')];}return rp(_0x1b4e25);})[_0x492d('0x2b')](function(_0x4db087){if(_0x4db087){_0x50d0f4[_0x492d('0xac')](_0x4db087['headers']);logger[_0x492d('0x6a')](_0x4db087[_0x492d('0x95')]);if(_['endsWith'](_0x1622c8['query']['path'],_0x492d('0x53'))&&_0x4db087[_0x492d('0xad')]==0x1f4){return _0x50d0f4['sendStatus'](_0x4db087['statusCode']);}else{return _0x50d0f4[_0x492d('0x23')](_0x4db087[_0x492d('0xad')])[_0x492d('0x34')](_0x4db087[_0x492d('0x95')]);}}else{return _0x50d0f4['sendStatus'](0xc8);}})['catch'](handleError(_0x50d0f4,null));};exports['webhookPost']=function(_0x4fe20b,_0x4d97f9,_0x2c469e){return BPromise[_0x492d('0xa1')]()[_0x492d('0x2b')](function(){if(!_0x4fe20b[_0x492d('0x3c')][_0x492d('0x55')]){throw new Error(_0x492d('0xae'));}if(!_0x4fe20b[_0x492d('0x3c')][_0x492d('0xa2')]){throw new Error(_0x492d('0xa3'));}var _0x3bc330=_0x4fe20b[_0x492d('0x3c')][_0x492d('0xa4')]?_0x4fe20b['query'][_0x492d('0xa4')]+':'+_0x4fe20b['query'][_0x492d('0xa2')]:_0x492d('0xa5')+_0x4fe20b[_0x492d('0x3c')][_0x492d('0xa2')];var _0x3aa273=_0x4fe20b[_0x492d('0x3c')]['json']?_0x4fe20b['query'][_0x492d('0x27')]:!![];var _0x4ae2ef=_0x4fe20b[_0x492d('0x3c')][_0x492d('0xa6')]?_0x4fe20b['query']['encoding']:null;var _0x249a82={'method':_0x4fe20b['method'],'uri':util['format']('%s%s',_0x3bc330,_0x4fe20b[_0x492d('0x3c')]['path']),'json':_0x3aa273,'resolveWithFullResponse':!![],'encoding':_0x4ae2ef,'body':_0x4fe20b[_0x492d('0x95')]};if(_0x4fe20b[_0x492d('0xa9')]){_0x249a82[_0x492d('0xa9')]=_0x4fe20b['headers'];if(_0x249a82[_0x492d('0xa9')][_0x492d('0xaa')]){delete _0x249a82['headers'][_0x492d('0xaa')];}}if(_0x249a82['headers'][_0x492d('0xab')]){delete _0x249a82[_0x492d('0xa9')][_0x492d('0xab')];}return rp(_0x249a82);})[_0x492d('0x2b')](function(_0xba9bec){if(_0xba9bec){_0x4d97f9[_0x492d('0xac')](_0xba9bec['headers']);logger[_0x492d('0x6a')](_0xba9bec[_0x492d('0x95')]);return _0x4d97f9[_0x492d('0x23')](_0xba9bec[_0x492d('0xad')])['send'](_0xba9bec[_0x492d('0x95')]);}else{return _0x4d97f9[_0x492d('0x22')](0xc8);}})['catch'](handleError(_0x4d97f9,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 43bd039..7b521eb 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 _0xe2cf=['remove','emit','hook','exports','../../mysqldb','setMaxListeners','update'];(function(_0x19bfe4,_0x37c5d5){var _0x179aae=function(_0x38ef6e){while(--_0x38ef6e){_0x19bfe4['push'](_0x19bfe4['shift']());}};_0x179aae(++_0x37c5d5);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x31d866,_0x1e1e3b){_0x31d866=_0x31d866-0x0;var _0x399948=_0xe2cf[_0x31d866];return _0x399948;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xfe2c('0x0'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xfe2c('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfe2c('0x2'),'afterDestroy':_0xfe2c('0x3')};function emitEvent(_0x43c1c9){return function(_0x11b6b8,_0x494978,_0xd40c31){PluginEvents[_0xfe2c('0x4')](_0x43c1c9+':'+_0x11b6b8['id'],_0x11b6b8);PluginEvents['emit'](_0x43c1c9,_0x11b6b8);_0xd40c31(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xfe2c('0x5')](e,emitEvent(event));}}module[_0xfe2c('0x6')]=PluginEvents; \ No newline at end of file +var _0x3a6d=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a6d,0x143));var _0xd3a6=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x3a6d[_0x50a0c2];return _0x5ebadd;};'use strict';var EventEmitter=require(_0xd3a6('0x0'));var Plugin=require(_0xd3a6('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xd3a6('0x2')](0x0);var events={'afterCreate':_0xd3a6('0x3'),'afterUpdate':_0xd3a6('0x4'),'afterDestroy':_0xd3a6('0x5')};function emitEvent(_0x3d37ff){return function(_0x585473,_0x1cb966,_0x27d641){PluginEvents[_0xd3a6('0x6')](_0x3d37ff+':'+_0x585473['id'],_0x585473);PluginEvents[_0xd3a6('0x6')](_0x3d37ff,_0x585473);_0x27d641(null);};}for(var e in events){if(events[_0xd3a6('0x7')](e)){var event=events[e];Plugin[_0xd3a6('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 102a59f..364b012 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 _0x3e74=['exports','Plugin','plugins','lodash','../../config/logger','api','moment','path','../../config/environment','./plugin.attributes'];(function(_0x456bd2,_0x156c79){var _0x2218c1=function(_0x44f2d4){while(--_0x44f2d4){_0x456bd2['push'](_0x456bd2['shift']());}};_0x2218c1(++_0x156c79);}(_0x3e74,0x175));var _0x43e7=function(_0x1033c4,_0x1360f0){_0x1033c4=_0x1033c4-0x0;var _0x515d38=_0x3e74[_0x1033c4];return _0x515d38;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeec6=['path','rimraf','../../config/environment','./plugin.attributes','Plugin','plugins','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1c5dfc,_0x33e663){var _0x2a4f2b=function(_0x4f9104){while(--_0x4f9104){_0x1c5dfc['push'](_0x1c5dfc['shift']());}};_0x2a4f2b(++_0x33e663);}(_0xeec6,0x1c2));var _0x6eec=function(_0x3cc751,_0x38b8ff){_0x3cc751=_0x3cc751-0x0;var _0x3956a2=_0xeec6[_0x3cc751];return _0x3956a2;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var logger=require(_0x6eec('0x2'))(_0x6eec('0x3'));var moment=require('moment');var BPromise=require(_0x6eec('0x4'));var rp=require(_0x6eec('0x5'));var fs=require('fs');var path=require(_0x6eec('0x6'));var rimraf=require(_0x6eec('0x7'));var config=require(_0x6eec('0x8'));var attributes=require(_0x6eec('0x9'));module['exports']=function(_0x185f31,_0x3c6eda){return _0x185f31['define'](_0x6eec('0xa'),attributes,{'tableName':_0x6eec('0xb'),'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 085d133..2046294 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 _0xd3b4=['../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','catch','Plugin','create','body','CreatePlugin','lodash','util','bluebird','randomstring','ioredis'];(function(_0x5ecd8d,_0x373e43){var _0x24f935=function(_0x32d600){while(--_0x32d600){_0x5ecd8d['push'](_0x5ecd8d['shift']());}};_0x24f935(++_0x373e43);}(_0xd3b4,0x1cb));var _0x4d3b=function(_0x1f6481,_0x3e8339){_0x1f6481=_0x1f6481-0x0;var _0x2626fb=_0xd3b4[_0x1f6481];return _0x2626fb;};'use strict';var _=require(_0x4d3b('0x0'));var util=require(_0x4d3b('0x1'));var moment=require('moment');var BPromise=require(_0x4d3b('0x2'));var rs=require(_0x4d3b('0x3'));var fs=require('fs');var Redis=require(_0x4d3b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4d3b('0x5'))('rpc');var config=require(_0x4d3b('0x6'));var jayson=require(_0x4d3b('0x7'));var client=jayson[_0x4d3b('0x8')]['http']({'port':0x232a});config[_0x4d3b('0x9')]=_[_0x4d3b('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4d3b('0xb'))(new Redis(config[_0x4d3b('0x9')]));require(_0x4d3b('0xc'))[_0x4d3b('0xd')](socket);function respondWithRpcPromise(_0x120b59,_0x4cb02b,_0x2ab011){return new BPromise(function(_0x4037bb,_0x53f806){return client[_0x4d3b('0xe')](_0x120b59,_0x2ab011)[_0x4d3b('0xf')](function(_0x500d50){logger[_0x4d3b('0x10')](_0x4d3b('0x11'),_0x4cb02b,_0x4d3b('0x12'));logger[_0x4d3b('0x13')](_0x4d3b('0x14'),_0x4cb02b,_0x4d3b('0x12'),JSON['stringify'](_0x500d50));if(_0x500d50['error']){if(_0x500d50[_0x4d3b('0x15')][_0x4d3b('0x16')]===0x1f4){logger[_0x4d3b('0x15')]('Plugin,\x20%s,\x20%s',_0x4cb02b,_0x500d50[_0x4d3b('0x15')][_0x4d3b('0x17')]);return _0x53f806(_0x500d50[_0x4d3b('0x15')]['message']);}logger['error'](_0x4d3b('0x11'),_0x4cb02b,_0x500d50[_0x4d3b('0x15')][_0x4d3b('0x17')]);return _0x4037bb(_0x500d50[_0x4d3b('0x15')]['message']);}else{logger[_0x4d3b('0x10')](_0x4d3b('0x11'),_0x4cb02b,_0x4d3b('0x12'));_0x4037bb(_0x500d50['result'][_0x4d3b('0x17')]);}})[_0x4d3b('0x18')](function(_0x3c24e3){logger[_0x4d3b('0x15')](_0x4d3b('0x11'),_0x4cb02b,_0x3c24e3);_0x53f806(_0x3c24e3);});});}exports['CreatePlugin']=function(_0x2eade9){var _0x114154=this;return new Promise(function(_0x1ca3c3,_0x360c50){return db[_0x4d3b('0x19')][_0x4d3b('0x1a')](_0x2eade9[_0x4d3b('0x1b')],{'raw':_0x2eade9['options']?_0x2eade9['options']['raw']===undefined?!![]:![]:!![]})[_0x4d3b('0xf')](function(_0x20d1e1){logger['info']('CreatePlugin',_0x2eade9);logger[_0x4d3b('0x13')](_0x4d3b('0x1c'),_0x2eade9,JSON['stringify'](_0x20d1e1));_0x1ca3c3(_0x20d1e1);})[_0x4d3b('0x18')](function(_0x3fee1a){logger[_0x4d3b('0x15')](_0x4d3b('0x1c'),_0x3fee1a[_0x4d3b('0x17')],_0x2eade9);_0x360c50(_0x114154['error'](0x1f4,_0x3fee1a[_0x4d3b('0x17')]));});});}; \ No newline at end of file +var _0xdc14=['then','debug','stringify','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreatePlugin','Plugin','create','options'];(function(_0x17f6ab,_0x5743f7){var _0x28758e=function(_0x371824){while(--_0x371824){_0x17f6ab['push'](_0x17f6ab['shift']());}};_0x28758e(++_0x5743f7);}(_0xdc14,0x136));var _0x4dc1=function(_0x46ac0c,_0x10c48f){_0x46ac0c=_0x46ac0c-0x0;var _0x2644d2=_0xdc14[_0x46ac0c];return _0x2644d2;};'use strict';var _=require(_0x4dc1('0x0'));var util=require(_0x4dc1('0x1'));var moment=require(_0x4dc1('0x2'));var BPromise=require('bluebird');var rs=require(_0x4dc1('0x3'));var fs=require('fs');var Redis=require(_0x4dc1('0x4'));var db=require(_0x4dc1('0x5'))['db'];var utils=require(_0x4dc1('0x6'));var logger=require(_0x4dc1('0x7'))(_0x4dc1('0x8'));var config=require(_0x4dc1('0x9'));var jayson=require(_0x4dc1('0xa'));var client=jayson[_0x4dc1('0xb')][_0x4dc1('0xc')]({'port':0x232a});config[_0x4dc1('0xd')]=_[_0x4dc1('0xe')](config[_0x4dc1('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x4dc1('0xf'))(new Redis(config[_0x4dc1('0xd')]));require(_0x4dc1('0x10'))[_0x4dc1('0x11')](socket);function respondWithRpcPromise(_0x5cec1e,_0x4e5177,_0x379780){return new BPromise(function(_0x538589,_0x4a1a3c){return client[_0x4dc1('0x12')](_0x5cec1e,_0x379780)['then'](function(_0x452b1c){logger[_0x4dc1('0x13')](_0x4dc1('0x14'),_0x4e5177,_0x4dc1('0x15'));logger['debug']('Plugin,\x20%s,\x20%s,\x20%s',_0x4e5177,'request\x20sent',JSON['stringify'](_0x452b1c));if(_0x452b1c['error']){if(_0x452b1c[_0x4dc1('0x16')][_0x4dc1('0x17')]===0x1f4){logger['error']('Plugin,\x20%s,\x20%s',_0x4e5177,_0x452b1c['error'][_0x4dc1('0x18')]);return _0x4a1a3c(_0x452b1c[_0x4dc1('0x16')][_0x4dc1('0x18')]);}logger['error'](_0x4dc1('0x14'),_0x4e5177,_0x452b1c[_0x4dc1('0x16')][_0x4dc1('0x18')]);return _0x538589(_0x452b1c[_0x4dc1('0x16')][_0x4dc1('0x18')]);}else{logger['info'](_0x4dc1('0x14'),_0x4e5177,_0x4dc1('0x15'));_0x538589(_0x452b1c[_0x4dc1('0x19')][_0x4dc1('0x18')]);}})['catch'](function(_0x1cb765){logger['error']('Plugin,\x20%s,\x20%s',_0x4e5177,_0x1cb765);_0x4a1a3c(_0x1cb765);});});}exports[_0x4dc1('0x1a')]=function(_0x4d0911){var _0x405c70=this;return new Promise(function(_0x5a39a2,_0x4edf33){return db[_0x4dc1('0x1b')][_0x4dc1('0x1c')](_0x4d0911['body'],{'raw':_0x4d0911[_0x4dc1('0x1d')]?_0x4d0911[_0x4dc1('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x4dc1('0x1e')](function(_0xd0c573){logger[_0x4dc1('0x13')]('CreatePlugin',_0x4d0911);logger[_0x4dc1('0x1f')]('CreatePlugin',_0x4d0911,JSON[_0x4dc1('0x20')](_0xd0c573));_0x5a39a2(_0xd0c573);})[_0x4dc1('0x21')](function(_0x3ef41d){logger[_0x4dc1('0x16')](_0x4dc1('0x1a'),_0x3ef41d[_0x4dc1('0x18')],_0x4d0911);_0x4edf33(_0x405c70[_0x4dc1('0x16')](0x1f4,_0x3ef41d[_0x4dc1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 94a7b72..9eea0ce 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 _0xa3a4=['remove','update','emit','removeListener','register','./plugin.events','save'];(function(_0x2f6c4a,_0x263e39){var _0xa50244=function(_0x50dc21){while(--_0x50dc21){_0x2f6c4a['push'](_0x2f6c4a['shift']());}};_0xa50244(++_0x263e39);}(_0xa3a4,0x6e));var _0x4a3a=function(_0x48d702,_0x41b680){_0x48d702=_0x48d702-0x0;var _0x32ed9d=_0xa3a4[_0x48d702];return _0x32ed9d;};'use strict';var PluginEvents=require(_0x4a3a('0x0'));var events=[_0x4a3a('0x1'),_0x4a3a('0x2'),_0x4a3a('0x3')];function createListener(_0x53e56e,_0x2926aa){return function(_0x160724){_0x2926aa[_0x4a3a('0x4')](_0x53e56e,_0x160724);};}function removeListener(_0x27b07f,_0x5446e7){return function(){PluginEvents[_0x4a3a('0x5')](_0x27b07f,_0x5446e7);};}exports[_0x4a3a('0x6')]=function(_0x50d582){for(var _0x4aa6bb=0x0,_0x46eeb9=events['length'];_0x4aa6bb<_0x46eeb9;_0x4aa6bb++){var _0x320a44=events[_0x4aa6bb];var _0x2362b1=createListener('plugin:'+_0x320a44,_0x50d582);PluginEvents['on'](_0x320a44,_0x2362b1);}}; \ No newline at end of file +var _0x4f01=['update','emit','register','length','plugin:','save','remove'];(function(_0x2612d5,_0x12651a){var _0x522573=function(_0x45fab1){while(--_0x45fab1){_0x2612d5['push'](_0x2612d5['shift']());}};_0x522573(++_0x12651a);}(_0x4f01,0xe5));var _0x14f0=function(_0x376a76,_0x3f3c4d){_0x376a76=_0x376a76-0x0;var _0xb37764=_0x4f01[_0x376a76];return _0xb37764;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x14f0('0x0'),_0x14f0('0x1'),_0x14f0('0x2')];function createListener(_0x1c0cdb,_0x3ba042){return function(_0x2727f6){_0x3ba042[_0x14f0('0x3')](_0x1c0cdb,_0x2727f6);};}function removeListener(_0x2c2070,_0x17d681){return function(){PluginEvents['removeListener'](_0x2c2070,_0x17d681);};}exports[_0x14f0('0x4')]=function(_0x36bc10){for(var _0x5c4969=0x0,_0xcf2512=events[_0x14f0('0x5')];_0x5c4969<_0xcf2512;_0x5c4969++){var _0xb1e01a=events[_0x5c4969];var _0xf71652=createListener(_0x14f0('0x6')+_0xb1e01a,_0x36bc10);PluginEvents['on'](_0xb1e01a,_0xf71652);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 22d94b4..c310d7e 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 _0x89f6=['put','delete','destroy','exports','express','Router','../../components/auth/service','get','isAuthenticated','index','/:id','show','post'];(function(_0x49c8da,_0x1fa91a){var _0x5363e8=function(_0x5a69e5){while(--_0x5a69e5){_0x49c8da['push'](_0x49c8da['shift']());}};_0x5363e8(++_0x1fa91a);}(_0x89f6,0xc7));var _0x689f=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x89f6[_0x18ab2a];return _0x16dcee;};'use strict';var express=require(_0x689f('0x0'));var router=express[_0x689f('0x1')]();var auth=require(_0x689f('0x2'));var controller=require('./pm2.controller');router[_0x689f('0x3')]('/',auth[_0x689f('0x4')](),controller[_0x689f('0x5')]);router[_0x689f('0x3')](_0x689f('0x6'),auth['isAuthenticated'](),controller[_0x689f('0x7')]);router[_0x689f('0x8')]('/',auth[_0x689f('0x4')](),controller['create']);router[_0x689f('0x9')]('/:id',auth[_0x689f('0x4')](),controller['update']);router[_0x689f('0xa')](_0x689f('0x6'),auth[_0x689f('0x4')](),controller[_0x689f('0xb')]);module[_0x689f('0xc')]=router; \ No newline at end of file +var _0xd42d=['./pm2.controller','get','isAuthenticated','index','show','post','create','/:id','destroy','exports','express','Router','../../components/auth/service'];(function(_0x259f87,_0x5b6a0e){var _0x78a5d4=function(_0x4e3489){while(--_0x4e3489){_0x259f87['push'](_0x259f87['shift']());}};_0x78a5d4(++_0x5b6a0e);}(_0xd42d,0x10e));var _0xdd42=function(_0x2590c7,_0x4eea69){_0x2590c7=_0x2590c7-0x0;var _0x4c7e7a=_0xd42d[_0x2590c7];return _0x4c7e7a;};'use strict';var express=require(_0xdd42('0x0'));var router=express[_0xdd42('0x1')]();var auth=require(_0xdd42('0x2'));var controller=require(_0xdd42('0x3'));router[_0xdd42('0x4')]('/',auth[_0xdd42('0x5')](),controller[_0xdd42('0x6')]);router[_0xdd42('0x4')]('/:id',auth[_0xdd42('0x5')](),controller[_0xdd42('0x7')]);router[_0xdd42('0x8')]('/',auth[_0xdd42('0x5')](),controller[_0xdd42('0x9')]);router['put'](_0xdd42('0xa'),auth[_0xdd42('0x5')](),controller['update']);router['delete']('/:id',auth[_0xdd42('0x5')](),controller[_0xdd42('0xb')]);module[_0xdd42('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 7ebab26..9869bcf 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 _0x1bfc=['stop','hasOwnProperty','destroy','delete','Unknown\x20id','lodash','api','path','child_process','exec','bluebird','sendStatus','error','stack','name','status','info','index','then','reject','length','catch','show','describe','params','create','body','script','join','cwd','chdir','dirname','start','dump','send','Missing\x20name\x20and/or\x20path','update','restart'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x1bfc,0x15b));var _0xc1bf=function(_0x3c07e0,_0x54d0c0){_0x3c07e0=_0x3c07e0-0x0;var _0x139703=_0x1bfc[_0x3c07e0];return _0x139703;};'use strict';var _=require(_0xc1bf('0x0'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0xc1bf('0x1'));var path=require(_0xc1bf('0x2'));var exec=require(_0xc1bf('0x3'))[_0xc1bf('0x4')];var BPromise=require(_0xc1bf('0x5'));function handleEntityNotFound(_0xc2bdb9,_0x37101d){return function(_0x405f7a){if(!_0x405f7a){_0xc2bdb9[_0xc1bf('0x6')](0x194);;}return _0x405f7a;};}function respondWithResult(_0x3068aa,_0x478399){_0x478399=_0x478399||0xc8;return function(_0x3dea9e){if(_0x3dea9e){return _0x3068aa['status'](_0x478399)['json'](_0x3dea9e);}return null;};}function handleError(_0x438e17,_0x3d9bb6){_0x3d9bb6=_0x3d9bb6||0x1f4;return function(_0x477037){logger[_0xc1bf('0x7')](_0x477037[_0xc1bf('0x8')]);if(_0x477037[_0xc1bf('0x9')]){delete _0x477037[_0xc1bf('0x9')];}_0x438e17[_0xc1bf('0xa')](_0x3d9bb6)['send'](_0x477037);};}function execChildProcess(){return new BPromise(function(_0x593317,_0x256fa7){exec('npm\x20install',function(_0x596962,_0x459bf4,_0x170721){logger[_0xc1bf('0xb')](_0x459bf4);logger[_0xc1bf('0xb')](_0x170721);if(_0x596962){logger[_0xc1bf('0x7')](_0x596962);return _0x256fa7(_0x596962);}return _0x593317(_0x459bf4);});});}exports[_0xc1bf('0xc')]=function(_0xeaa6f9,_0x388f7a){return pm2['list']()[_0xc1bf('0xd')](function(_0x43e08d){if(_0x43e08d){var _0xb372ff=_[_0xc1bf('0xe')](_0x43e08d,function(_0x2a1b9c){return _0x2a1b9c[_0xc1bf('0x9')]==='express'||_0x2a1b9c[_0xc1bf('0x9')]==='motion2';});return{'rows':_0xb372ff,'count':_0xb372ff[_0xc1bf('0xf')]};}return null;})[_0xc1bf('0xd')](respondWithResult(_0x388f7a,null))[_0xc1bf('0x10')](handleError(_0x388f7a,null));};exports[_0xc1bf('0x11')]=function(_0xb163ac,_0x3342c0){return pm2[_0xc1bf('0x12')](_0xb163ac[_0xc1bf('0x13')]['id'])[_0xc1bf('0xd')](respondWithResult(_0x3342c0,null))[_0xc1bf('0xd')](handleEntityNotFound(_0x3342c0,null))['catch'](handleError(_0x3342c0,null));};exports[_0xc1bf('0x14')]=function(_0x40223a,_0x5d2096){if(_0x40223a[_0xc1bf('0x15')][_0xc1bf('0x9')]&&_0x40223a['body'][_0xc1bf('0x16')]){var _0x4eaa7b=path[_0xc1bf('0x17')](__dirname,'../../files/plugins',_0x40223a[_0xc1bf('0x15')][_0xc1bf('0x16')]);var _0x324ed8=process[_0xc1bf('0x18')]();process[_0xc1bf('0x19')](path[_0xc1bf('0x1a')](_0x4eaa7b));return execChildProcess()[_0xc1bf('0xd')](function(_0x4be05e){process[_0xc1bf('0x19')](_0x324ed8);return pm2[_0xc1bf('0x1b')]({'name':_0x40223a[_0xc1bf('0x15')][_0xc1bf('0x9')],'script':_0x4eaa7b});})[_0xc1bf('0xd')](function(_0x27b903){pm2[_0xc1bf('0x1c')]();return _0x27b903[0x0];})[_0xc1bf('0xd')](respondWithResult(_0x5d2096,0xc9))[_0xc1bf('0x10')](handleError(_0x5d2096,null));}else{return _0x5d2096['status'](0x1f4)[_0xc1bf('0x1d')]({'message':_0xc1bf('0x1e')});}};exports[_0xc1bf('0x1f')]=function(_0x525c2b,_0x1c0934){if(_0x525c2b['body']['id']){delete _0x525c2b['body']['id'];}var _0x24200a={'online':_0xc1bf('0x20'),'stopped':_0xc1bf('0x21')};if(_0x24200a[_0xc1bf('0x22')](_0x525c2b[_0xc1bf('0x15')][_0xc1bf('0xa')])){return pm2[_0x24200a[_0x525c2b[_0xc1bf('0x15')][_0xc1bf('0xa')]]](_0x525c2b[_0xc1bf('0x13')]['id'])[_0xc1bf('0xd')](respondWithResult(_0x1c0934,0xc8))[_0xc1bf('0x10')](handleError(_0x1c0934,null));}else{return _0x1c0934['status'](0x1f4)[_0xc1bf('0x1d')]({'message':'Unknown\x20status'});}};exports[_0xc1bf('0x23')]=function(_0x48f19a,_0x38c696){if(_0x48f19a[_0xc1bf('0x15')]['id']){delete _0x48f19a[_0xc1bf('0x15')]['id'];}if(_0x48f19a['params']['id']){return pm2[_0xc1bf('0x24')](_0x48f19a[_0xc1bf('0x13')]['id'])[_0xc1bf('0xd')](function(_0x31f086){pm2[_0xc1bf('0x1c')]();return _0x31f086[0x0];})['then'](respondWithResult(_0x38c696,null))[_0xc1bf('0x10')](handleError(_0x38c696,null));}else{return _0x38c696['status'](0x1f4)[_0xc1bf('0x1d')]({'message':_0xc1bf('0x25')});}}; \ No newline at end of file +var _0x78a6=['dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','send','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','api','path','child_process','exec','bluebird','sendStatus','status','json','stack','name','info','error','index','then','reject','motion2','catch','show','describe','params','create','body','join','../../files/plugins','script','cwd','chdir','start'];(function(_0x4cdd59,_0x400fdc){var _0x1c90b2=function(_0x3a9343){while(--_0x3a9343){_0x4cdd59['push'](_0x4cdd59['shift']());}};_0x1c90b2(++_0x400fdc);}(_0x78a6,0x1eb));var _0x678a=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x78a6[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x678a('0x0'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0x678a('0x1'));var path=require(_0x678a('0x2'));var exec=require(_0x678a('0x3'))[_0x678a('0x4')];var BPromise=require(_0x678a('0x5'));function handleEntityNotFound(_0x1b3dc0,_0x46e134){return function(_0x1f1618){if(!_0x1f1618){_0x1b3dc0[_0x678a('0x6')](0x194);;}return _0x1f1618;};}function respondWithResult(_0x574ef9,_0x3b358c){_0x3b358c=_0x3b358c||0xc8;return function(_0x2eed7d){if(_0x2eed7d){return _0x574ef9[_0x678a('0x7')](_0x3b358c)[_0x678a('0x8')](_0x2eed7d);}return null;};}function handleError(_0x39de02,_0x417374){_0x417374=_0x417374||0x1f4;return function(_0x21925b){logger['error'](_0x21925b[_0x678a('0x9')]);if(_0x21925b['name']){delete _0x21925b[_0x678a('0xa')];}_0x39de02[_0x678a('0x7')](_0x417374)['send'](_0x21925b);};}function execChildProcess(){return new BPromise(function(_0x2e492e,_0x47c60f){exec('npm\x20install',function(_0x5a9d28,_0x1f94b1,_0x4e873a){logger['info'](_0x1f94b1);logger[_0x678a('0xb')](_0x4e873a);if(_0x5a9d28){logger[_0x678a('0xc')](_0x5a9d28);return _0x47c60f(_0x5a9d28);}return _0x2e492e(_0x1f94b1);});});}exports[_0x678a('0xd')]=function(_0x5a834d,_0x23bf76){return pm2['list']()[_0x678a('0xe')](function(_0x1b7e1d){if(_0x1b7e1d){var _0x3657ab=_[_0x678a('0xf')](_0x1b7e1d,function(_0x57bb91){return _0x57bb91['name']==='express'||_0x57bb91['name']===_0x678a('0x10');});return{'rows':_0x3657ab,'count':_0x3657ab['length']};}return null;})[_0x678a('0xe')](respondWithResult(_0x23bf76,null))[_0x678a('0x11')](handleError(_0x23bf76,null));};exports[_0x678a('0x12')]=function(_0x5c5dfb,_0x107a06){return pm2[_0x678a('0x13')](_0x5c5dfb[_0x678a('0x14')]['id'])[_0x678a('0xe')](respondWithResult(_0x107a06,null))[_0x678a('0xe')](handleEntityNotFound(_0x107a06,null))[_0x678a('0x11')](handleError(_0x107a06,null));};exports[_0x678a('0x15')]=function(_0x457b47,_0x3327cf){if(_0x457b47[_0x678a('0x16')][_0x678a('0xa')]&&_0x457b47[_0x678a('0x16')]['script']){var _0x263825=path[_0x678a('0x17')](__dirname,_0x678a('0x18'),_0x457b47[_0x678a('0x16')][_0x678a('0x19')]);var _0x3397e6=process[_0x678a('0x1a')]();process[_0x678a('0x1b')](path['dirname'](_0x263825));return execChildProcess()[_0x678a('0xe')](function(_0x34777c){process[_0x678a('0x1b')](_0x3397e6);return pm2[_0x678a('0x1c')]({'name':_0x457b47['body'][_0x678a('0xa')],'script':_0x263825});})[_0x678a('0xe')](function(_0x2a682f){pm2[_0x678a('0x1d')]();return _0x2a682f[0x0];})['then'](respondWithResult(_0x3327cf,0xc9))['catch'](handleError(_0x3327cf,null));}else{return _0x3327cf[_0x678a('0x7')](0x1f4)['send']({'message':_0x678a('0x1e')});}};exports[_0x678a('0x1f')]=function(_0x5c2206,_0x482465){if(_0x5c2206[_0x678a('0x16')]['id']){delete _0x5c2206['body']['id'];}var _0x2eae71={'online':_0x678a('0x20'),'stopped':_0x678a('0x21')};if(_0x2eae71[_0x678a('0x22')](_0x5c2206[_0x678a('0x16')]['status'])){return pm2[_0x2eae71[_0x5c2206['body']['status']]](_0x5c2206[_0x678a('0x14')]['id'])[_0x678a('0xe')](respondWithResult(_0x482465,0xc8))[_0x678a('0x11')](handleError(_0x482465,null));}else{return _0x482465[_0x678a('0x7')](0x1f4)[_0x678a('0x23')]({'message':_0x678a('0x24')});}};exports[_0x678a('0x25')]=function(_0x1f5259,_0x3a536c){if(_0x1f5259[_0x678a('0x16')]['id']){delete _0x1f5259[_0x678a('0x16')]['id'];}if(_0x1f5259[_0x678a('0x14')]['id']){return pm2[_0x678a('0x26')](_0x1f5259[_0x678a('0x14')]['id'])[_0x678a('0xe')](function(_0x59934f){pm2['dump']();return _0x59934f[0x0];})[_0x678a('0xe')](respondWithResult(_0x3a536c,null))[_0x678a('0x11')](handleError(_0x3a536c,null));}else{return _0x3a536c['status'](0x1f4)['send']({'message':_0x678a('0x27')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 35a6771..5b333a7 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 _0x9c02=['../../config/environment','multer','util','path','../../components/auth/service'];(function(_0x20fc55,_0x2ce9c6){var _0x3af523=function(_0x372d6b){while(--_0x372d6b){_0x20fc55['push'](_0x20fc55['shift']());}};_0x3af523(++_0x2ce9c6);}(_0x9c02,0x196));var _0x29c0=function(_0x1a245c,_0x478459){_0x1a245c=_0x1a245c-0x0;var _0x421b56=_0x9c02[_0x1a245c];return _0x421b56;};'use strict';var multer=require(_0x29c0('0x0'));var util=require(_0x29c0('0x1'));var path=require(_0x29c0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x29c0('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x29c0('0x4'));module['exports']=router; \ No newline at end of file +var _0xffe1=['util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x51c82c,_0x4aacbd){var _0x2b4d1b=function(_0x2c0e11){while(--_0x2c0e11){_0x51c82c['push'](_0x51c82c['shift']());}};_0x2b4d1b(++_0x4aacbd);}(_0xffe1,0x187));var _0x1ffe=function(_0x39e94d,_0x1aa514){_0x39e94d=_0x39e94d-0x0;var _0x504946=_0xffe1[_0x39e94d];return _0x504946;};'use strict';var multer=require(_0x1ffe('0x0'));var util=require(_0x1ffe('0x1'));var path=require('path');var timeout=require(_0x1ffe('0x2'));var express=require('express');var router=express[_0x1ffe('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1ffe('0x4'));var interaction=require(_0x1ffe('0x5'));var config=require(_0x1ffe('0x6'));module[_0x1ffe('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 cb5f1ea..aaff845 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 _0xb7b2=['exports','INTEGER','STRING','DATE'];(function(_0x4d7088,_0x5b7a0d){var _0x584ff7=function(_0x451d19){while(--_0x451d19){_0x4d7088['push'](_0x4d7088['shift']());}};_0x584ff7(++_0x5b7a0d);}(_0xb7b2,0xb8));var _0x2b7b=function(_0x23db25,_0x5df475){_0x23db25=_0x23db25-0x0;var _0x298c61=_0xb7b2[_0x23db25];return _0x298c61;};'use strict';var Sequelize=require('sequelize');module[_0x2b7b('0x0')]={'state':{'type':Sequelize[_0x2b7b('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x2b7b('0x2')]},'scheduledat':{'type':Sequelize[_0x2b7b('0x3')]},'uniqueid':{'type':Sequelize[_0x2b7b('0x2')]},'starttime':{'type':Sequelize[_0x2b7b('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x2b7b('0x2')]},'membername':{'type':Sequelize[_0x2b7b('0x2')]}}; \ No newline at end of file +var _0x74d5=['STRING','DATE','sequelize','exports','INTEGER'];(function(_0x23bf7c,_0x10a6ae){var _0x4223fd=function(_0x38a22f){while(--_0x38a22f){_0x23bf7c['push'](_0x23bf7c['shift']());}};_0x4223fd(++_0x10a6ae);}(_0x74d5,0x8e));var _0x574d=function(_0x57267d,_0x44976d){_0x57267d=_0x57267d-0x0;var _0x2cab22=_0x74d5[_0x57267d];return _0x2cab22;};'use strict';var Sequelize=require(_0x574d('0x0'));module[_0x574d('0x1')]={'state':{'type':Sequelize[_0x574d('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x574d('0x3')]},'scheduledat':{'type':Sequelize[_0x574d('0x4')]},'uniqueid':{'type':Sequelize[_0x574d('0x3')]},'starttime':{'type':Sequelize[_0x574d('0x4')]},'responsetime':{'type':Sequelize[_0x574d('0x4')]},'ringtime':{'type':Sequelize[_0x574d('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x574d('0x3')]},'membername':{'type':Sequelize[_0x574d('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index a8d8206..fa4f73e 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 _0x51d3=['moment','bluebird','request-promise','path','rimraf','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','../../config/logger','api'];(function(_0x1cda54,_0x120efa){var _0x373cbc=function(_0x2f2840){while(--_0x2f2840){_0x1cda54['push'](_0x1cda54['shift']());}};_0x373cbc(++_0x120efa);}(_0x51d3,0x172));var _0x351d=function(_0x5a2d89,_0x2a4487){_0x5a2d89=_0x5a2d89-0x0;var _0x52825c=_0x51d3[_0x5a2d89];return _0x52825c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x351d('0x0'))(_0x351d('0x1'));var moment=require(_0x351d('0x2'));var BPromise=require(_0x351d('0x3'));var rp=require(_0x351d('0x4'));var fs=require('fs');var path=require(_0x351d('0x5'));var rimraf=require(_0x351d('0x6'));var config=require('../../config/environment');var attributes=require(_0x351d('0x7'));module[_0x351d('0x8')]=function(_0x228f6b,_0x4775ce){return _0x228f6b[_0x351d('0x9')](_0x351d('0xa'),attributes,{'tableName':_0x351d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe460=['report_agent_preview','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','ReportAgentPreview'];(function(_0x4abbaa,_0xae0a0e){var _0x40a910=function(_0x1cd4ed){while(--_0x1cd4ed){_0x4abbaa['push'](_0x4abbaa['shift']());}};_0x40a910(++_0xae0a0e);}(_0xe460,0xb7));var _0x0e46=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0xe460[_0x1762b4];return _0x29beda;};'use strict';var _=require(_0x0e46('0x0'));var util=require(_0x0e46('0x1'));var logger=require(_0x0e46('0x2'))(_0x0e46('0x3'));var moment=require(_0x0e46('0x4'));var BPromise=require('bluebird');var rp=require(_0x0e46('0x5'));var fs=require('fs');var path=require(_0x0e46('0x6'));var rimraf=require(_0x0e46('0x7'));var config=require(_0x0e46('0x8'));var attributes=require('./reportAgentPreview.attributes');module[_0x0e46('0x9')]=function(_0x224471,_0x56f58b){return _0x224471[_0x0e46('0xa')](_0x0e46('0xb'),attributes,{'tableName':_0x0e46('0xc'),'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 7e5addd..028895e 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 _0xaa59=['rpc','jayson/promise','http','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','ReportAgentPreview','create','options','CreateReportAgentPreview','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x20e7e3,_0x1529be){var _0x14b9de=function(_0xa82925){while(--_0xa82925){_0x20e7e3['push'](_0x20e7e3['shift']());}};_0x14b9de(++_0x1529be);}(_0xaa59,0xdf));var _0x9aa5=function(_0x5ecf9a,_0x58d51e){_0x5ecf9a=_0x5ecf9a-0x0;var _0x53fe88=_0xaa59[_0x5ecf9a];return _0x53fe88;};'use strict';var _=require('lodash');var util=require(_0x9aa5('0x0'));var moment=require(_0x9aa5('0x1'));var BPromise=require(_0x9aa5('0x2'));var rs=require(_0x9aa5('0x3'));var fs=require('fs');var Redis=require(_0x9aa5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9aa5('0x5'));var logger=require(_0x9aa5('0x6'))(_0x9aa5('0x7'));var config=require('../../config/environment');var jayson=require(_0x9aa5('0x8'));var client=jayson['client'][_0x9aa5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19f998,_0x2d2f0a,_0x13a1c0){return new BPromise(function(_0x241200,_0x34a584){return client['request'](_0x19f998,_0x13a1c0)[_0x9aa5('0xa')](function(_0x2f8e60){logger[_0x9aa5('0xb')](_0x9aa5('0xc'),_0x2d2f0a,_0x9aa5('0xd'));logger[_0x9aa5('0xe')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x2d2f0a,'request\x20sent',JSON[_0x9aa5('0xf')](_0x2f8e60));if(_0x2f8e60[_0x9aa5('0x10')]){if(_0x2f8e60['error']['code']===0x1f4){logger[_0x9aa5('0x10')](_0x9aa5('0xc'),_0x2d2f0a,_0x2f8e60[_0x9aa5('0x10')][_0x9aa5('0x11')]);return _0x34a584(_0x2f8e60[_0x9aa5('0x10')][_0x9aa5('0x11')]);}logger[_0x9aa5('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x2d2f0a,_0x2f8e60['error']['message']);return _0x241200(_0x2f8e60[_0x9aa5('0x10')][_0x9aa5('0x11')]);}else{logger[_0x9aa5('0xb')](_0x9aa5('0xc'),_0x2d2f0a,_0x9aa5('0xd'));_0x241200(_0x2f8e60['result'][_0x9aa5('0x11')]);}})[_0x9aa5('0x12')](function(_0x48f127){logger['error'](_0x9aa5('0xc'),_0x2d2f0a,_0x48f127);_0x34a584(_0x48f127);});});}exports['CreateReportAgentPreview']=function(_0x24f8e0){var _0x14110a=this;return new Promise(function(_0x4f538e,_0x14bc37){return db[_0x9aa5('0x13')][_0x9aa5('0x14')](_0x24f8e0['body'],{'raw':_0x24f8e0['options']?_0x24f8e0[_0x9aa5('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x9aa5('0xa')](function(_0x3e0c2f){logger[_0x9aa5('0xb')](_0x9aa5('0x16'),_0x24f8e0);logger[_0x9aa5('0xe')](_0x9aa5('0x16'),_0x24f8e0,JSON[_0x9aa5('0xf')](_0x3e0c2f));_0x4f538e(_0x3e0c2f);})[_0x9aa5('0x12')](function(_0x12209c){logger[_0x9aa5('0x10')](_0x9aa5('0x16'),_0x12209c[_0x9aa5('0x11')],_0x24f8e0);_0x14bc37(_0x14110a[_0x9aa5('0x10')](0x1f4,_0x12209c[_0x9aa5('0x11')]));});});}; \ No newline at end of file +var _0x18a1=['debug','request\x20sent','error','message','catch','ReportAgentPreview','body','options','raw','CreateReportAgentPreview','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','ReportAgentPreview,\x20%s,\x20%s'];(function(_0x77d286,_0x1ddc6d){var _0x5446a5=function(_0x45e2cf){while(--_0x45e2cf){_0x77d286['push'](_0x77d286['shift']());}};_0x5446a5(++_0x1ddc6d);}(_0x18a1,0x1a3));var _0x118a=function(_0x40e25f,_0x51ea53){_0x40e25f=_0x40e25f-0x0;var _0x4d41d9=_0x18a1[_0x40e25f];return _0x4d41d9;};'use strict';var _=require('lodash');var util=require(_0x118a('0x0'));var moment=require(_0x118a('0x1'));var BPromise=require(_0x118a('0x2'));var rs=require(_0x118a('0x3'));var fs=require('fs');var Redis=require(_0x118a('0x4'));var db=require(_0x118a('0x5'))['db'];var utils=require(_0x118a('0x6'));var logger=require(_0x118a('0x7'))('rpc');var config=require(_0x118a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x118a('0x9')][_0x118a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c79ce,_0x592920,_0x1f8c30){return new BPromise(function(_0x45f373,_0x40f4c6){return client['request'](_0x5c79ce,_0x1f8c30)['then'](function(_0xcd2dc5){logger[_0x118a('0xb')](_0x118a('0xc'),_0x592920,'request\x20sent');logger[_0x118a('0xd')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x592920,_0x118a('0xe'),JSON['stringify'](_0xcd2dc5));if(_0xcd2dc5[_0x118a('0xf')]){if(_0xcd2dc5[_0x118a('0xf')]['code']===0x1f4){logger[_0x118a('0xf')]('ReportAgentPreview,\x20%s,\x20%s',_0x592920,_0xcd2dc5['error'][_0x118a('0x10')]);return _0x40f4c6(_0xcd2dc5[_0x118a('0xf')][_0x118a('0x10')]);}logger[_0x118a('0xf')]('ReportAgentPreview,\x20%s,\x20%s',_0x592920,_0xcd2dc5['error'][_0x118a('0x10')]);return _0x45f373(_0xcd2dc5[_0x118a('0xf')][_0x118a('0x10')]);}else{logger[_0x118a('0xb')](_0x118a('0xc'),_0x592920,'request\x20sent');_0x45f373(_0xcd2dc5['result'][_0x118a('0x10')]);}})[_0x118a('0x11')](function(_0x4a0740){logger[_0x118a('0xf')](_0x118a('0xc'),_0x592920,_0x4a0740);_0x40f4c6(_0x4a0740);});});}exports['CreateReportAgentPreview']=function(_0x5673f9){var _0x6901fc=this;return new Promise(function(_0x2de8e0,_0x47b0e7){return db[_0x118a('0x12')]['create'](_0x5673f9[_0x118a('0x13')],{'raw':_0x5673f9[_0x118a('0x14')]?_0x5673f9[_0x118a('0x14')][_0x118a('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x4f227a){logger[_0x118a('0xb')](_0x118a('0x16'),_0x5673f9);logger[_0x118a('0xd')](_0x118a('0x16'),_0x5673f9,JSON[_0x118a('0x17')](_0x4f227a));_0x2de8e0(_0x4f227a);})[_0x118a('0x11')](function(_0x377327){logger[_0x118a('0xf')](_0x118a('0x16'),_0x377327[_0x118a('0x10')],_0x5673f9);_0x47b0e7(_0x6901fc[_0x118a('0xf')](0x1f4,_0x377327['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index abf36fb..4bd6d9b 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 _0x54b5=['isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/sms/queues','smsQueues','/whatsapp/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','/telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get'];(function(_0x2fe689,_0x5794e5){var _0x35ea44=function(_0x51b9d6){while(--_0x51b9d6){_0x2fe689['push'](_0x2fe689['shift']());}};_0x35ea44(++_0x5794e5);}(_0x54b5,0x9a));var _0x554b=function(_0xfcfa18,_0x2f924f){_0xfcfa18=_0xfcfa18-0x0;var _0xc27500=_0x54b5[_0xfcfa18];return _0xc27500;};'use strict';var multer=require(_0x554b('0x0'));var util=require(_0x554b('0x1'));var path=require(_0x554b('0x2'));var express=require(_0x554b('0x3'));var router=express[_0x554b('0x4')]();var auth=require(_0x554b('0x5'));var controller=require(_0x554b('0x6'));router[_0x554b('0x7')]('/voice/channels',auth[_0x554b('0x8')](),controller[_0x554b('0x9')]);router['get'](_0x554b('0xa'),auth[_0x554b('0x8')](),controller[_0x554b('0xb')]);router[_0x554b('0x7')](_0x554b('0xc'),auth[_0x554b('0x8')](),controller['voiceChannelStopMixMonitor']);router[_0x554b('0x7')](_0x554b('0xd'),auth[_0x554b('0x8')](),controller['voiceQueues']);router[_0x554b('0x7')](_0x554b('0xe'),auth['isAuthenticated'](),controller['chatQueues']);router['get'](_0x554b('0xf'),auth['isAuthenticated'](),controller[_0x554b('0x10')]);router['get'](_0x554b('0x11'),auth['isAuthenticated'](),controller[_0x554b('0x12')]);router['get']('/openchannel/queues',auth[_0x554b('0x8')](),controller['openchannelQueues']);router[_0x554b('0x7')](_0x554b('0x13'),auth[_0x554b('0x8')](),controller[_0x554b('0x14')]);router[_0x554b('0x7')](_0x554b('0x15'),auth[_0x554b('0x8')](),controller['whatsappQueues']);router[_0x554b('0x7')]('/fax/queues',auth['isAuthenticated'](),controller[_0x554b('0x16')]);router[_0x554b('0x7')](_0x554b('0x17'),auth[_0x554b('0x8')](),controller[_0x554b('0x18')]);router[_0x554b('0x7')]('/voice/queues/channels',auth['isAuthenticated'](),controller[_0x554b('0x19')]);router['get'](_0x554b('0x1a'),auth[_0x554b('0x8')](),controller['voiceQueuesChannel']);router['get'](_0x554b('0x1b'),auth[_0x554b('0x8')](),controller['voiceQueuesChannelHangup']);router['get'](_0x554b('0x1c'),auth['isAuthenticated'](),controller['voiceQueuesChannelRedirect']);router[_0x554b('0x7')](_0x554b('0x1d'),auth[_0x554b('0x8')](),controller[_0x554b('0x1e')]);router[_0x554b('0x7')](_0x554b('0x1f'),auth[_0x554b('0x8')](),controller[_0x554b('0x20')]);router[_0x554b('0x7')](_0x554b('0x21'),auth[_0x554b('0x8')](),controller[_0x554b('0x22')]);router['get'](_0x554b('0x23'),auth[_0x554b('0x8')](),controller[_0x554b('0x24')]);router[_0x554b('0x25')]('/agents/:id/capacity',auth[_0x554b('0x8')](),controller['agentCapacity']);router[_0x554b('0x7')](_0x554b('0x26'),auth[_0x554b('0x8')](),controller['telephones']);router['get'](_0x554b('0x27'),auth['isAuthenticated'](),controller[_0x554b('0x28')]);router['get'](_0x554b('0x29'),auth[_0x554b('0x8')](),controller[_0x554b('0x2a')]);router[_0x554b('0x7')](_0x554b('0x2b'),auth['isAuthenticated'](),controller[_0x554b('0x2c')]);router[_0x554b('0x7')](_0x554b('0x2d'),auth['isAuthenticated'](),controller[_0x554b('0x2e')]);router[_0x554b('0x7')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x554b('0x2f')]);router[_0x554b('0x7')](_0x554b('0x30'),auth[_0x554b('0x8')](),controller[_0x554b('0x31')]);router[_0x554b('0x7')](_0x554b('0x32'),auth['isAuthenticated'](),controller[_0x554b('0x33')]);router[_0x554b('0x7')](_0x554b('0x34'),auth[_0x554b('0x8')](),controller[_0x554b('0x35')]);router['get'](_0x554b('0x36'),auth[_0x554b('0x8')](),controller[_0x554b('0x37')]);router[_0x554b('0x7')]('/fax/queues/waitinginteractions',auth[_0x554b('0x8')](),controller[_0x554b('0x38')]);router['post'](_0x554b('0x39'),auth[_0x554b('0x8')](),controller[_0x554b('0x3a')]('mail'));router[_0x554b('0x7')](_0x554b('0x3b'),auth[_0x554b('0x8')](),controller[_0x554b('0x3c')]);router[_0x554b('0x3d')](_0x554b('0x3e'),auth['isAuthenticated'](),controller[_0x554b('0x3a')](_0x554b('0x3f')));router[_0x554b('0x7')](_0x554b('0x40'),auth['isAuthenticated'](),controller[_0x554b('0x41')]);router['post'](_0x554b('0x42'),auth[_0x554b('0x8')](),controller[_0x554b('0x3a')](_0x554b('0x43')));router[_0x554b('0x7')](_0x554b('0x44'),auth[_0x554b('0x8')](),controller['showFaxQueues']);router[_0x554b('0x3d')](_0x554b('0x45'),auth['isAuthenticated'](),controller[_0x554b('0x3a')](_0x554b('0x46')));router['get']('/openchannel/queues/:id',auth['isAuthenticated'](),controller[_0x554b('0x47')]);router[_0x554b('0x3d')](_0x554b('0x48'),auth[_0x554b('0x8')](),controller[_0x554b('0x3a')](_0x554b('0x49')));router[_0x554b('0x3d')](_0x554b('0x4a'),auth[_0x554b('0x8')](),controller[_0x554b('0x3a')](_0x554b('0x4b')));router['get']('/sms/queues/:id',auth['isAuthenticated'](),controller[_0x554b('0x4c')]);router['get'](_0x554b('0x4d'),auth[_0x554b('0x8')](),controller[_0x554b('0x4e')]);router[_0x554b('0x3d')](_0x554b('0x4f'),auth[_0x554b('0x8')](),controller[_0x554b('0x50')]);module['exports']=router; \ No newline at end of file +var _0x4ff9=['put','/agents/:id/capacity','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','/chat/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer','util','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','/mail/accounts','/sms/queues','smsQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','agents'];(function(_0x2eec1f,_0x1b9987){var _0x543075=function(_0x5792d2){while(--_0x5792d2){_0x2eec1f['push'](_0x2eec1f['shift']());}};_0x543075(++_0x1b9987);}(_0x4ff9,0x149));var _0x94ff=function(_0x5018db,_0x24d66c){_0x5018db=_0x5018db-0x0;var _0x340c6a=_0x4ff9[_0x5018db];return _0x340c6a;};'use strict';var multer=require(_0x94ff('0x0'));var util=require(_0x94ff('0x1'));var path=require('path');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x94ff('0x2'));router[_0x94ff('0x3')](_0x94ff('0x4'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x6')]);router[_0x94ff('0x3')](_0x94ff('0x7'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x8')]);router['get'](_0x94ff('0x9'),auth['isAuthenticated'](),controller['voiceChannelStopMixMonitor']);router[_0x94ff('0x3')](_0x94ff('0xa'),auth[_0x94ff('0x5')](),controller[_0x94ff('0xb')]);router[_0x94ff('0x3')](_0x94ff('0xc'),auth[_0x94ff('0x5')](),controller[_0x94ff('0xd')]);router[_0x94ff('0x3')]('/mail/queues',auth[_0x94ff('0x5')](),controller[_0x94ff('0xe')]);router[_0x94ff('0x3')](_0x94ff('0xf'),auth[_0x94ff('0x5')](),controller['mailAccounts']);router[_0x94ff('0x3')]('/openchannel/queues',auth[_0x94ff('0x5')](),controller['openchannelQueues']);router[_0x94ff('0x3')](_0x94ff('0x10'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x11')]);router['get']('/whatsapp/queues',auth[_0x94ff('0x5')](),controller['whatsappQueues']);router[_0x94ff('0x3')](_0x94ff('0x12'),auth['isAuthenticated'](),controller[_0x94ff('0x13')]);router[_0x94ff('0x3')](_0x94ff('0x14'),auth['isAuthenticated'](),controller[_0x94ff('0x15')]);router[_0x94ff('0x3')](_0x94ff('0x16'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x17')]);router[_0x94ff('0x3')]('/voice/queues/channels/:uniqueid',auth[_0x94ff('0x5')](),controller[_0x94ff('0x18')]);router[_0x94ff('0x3')](_0x94ff('0x19'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x1a')]);router[_0x94ff('0x3')](_0x94ff('0x1b'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x1c')]);router[_0x94ff('0x3')](_0x94ff('0x1d'),auth['isAuthenticated'](),controller[_0x94ff('0x1e')]);router['get'](_0x94ff('0x1f'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x20')]);router['get'](_0x94ff('0x21'),auth['isAuthenticated'](),controller[_0x94ff('0x22')]);router[_0x94ff('0x3')]('/agents',auth[_0x94ff('0x5')](),controller[_0x94ff('0x23')]);router[_0x94ff('0x24')](_0x94ff('0x25'),auth[_0x94ff('0x5')](),controller['agentCapacity']);router['get']('/telephones',auth[_0x94ff('0x5')](),controller[_0x94ff('0x26')]);router['get'](_0x94ff('0x27'),auth['isAuthenticated'](),controller[_0x94ff('0x28')]);router[_0x94ff('0x3')](_0x94ff('0x29'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x2a')]);router['get'](_0x94ff('0x2b'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x2c')]);router[_0x94ff('0x3')](_0x94ff('0x2d'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x2e')]);router[_0x94ff('0x3')](_0x94ff('0x2f'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x30')]);router[_0x94ff('0x3')](_0x94ff('0x31'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x32')]);router[_0x94ff('0x3')]('/openchannel/queues/:id/waitinginteractions',auth[_0x94ff('0x5')](),controller[_0x94ff('0x33')]);router['get']('/sms/queues/waitinginteractions',auth[_0x94ff('0x5')](),controller[_0x94ff('0x34')]);router[_0x94ff('0x3')](_0x94ff('0x35'),auth['isAuthenticated'](),controller[_0x94ff('0x36')]);router['get'](_0x94ff('0x37'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x38')]);router[_0x94ff('0x39')]('/mail/queues/:id/notify',auth['isAuthenticated'](),controller[_0x94ff('0x3a')](_0x94ff('0x3b')));router['get']('/mail/queues/:id',auth[_0x94ff('0x5')](),controller[_0x94ff('0x3c')]);router[_0x94ff('0x39')](_0x94ff('0x3d'),auth[_0x94ff('0x5')](),controller['queueNotify']('chat'));router['get'](_0x94ff('0x3e'),auth['isAuthenticated'](),controller['showChatQueues']);router[_0x94ff('0x39')]('/fax/queues/:id/notify',auth[_0x94ff('0x5')](),controller[_0x94ff('0x3a')]('fax'));router[_0x94ff('0x3')]('/fax/queues/:id',auth[_0x94ff('0x5')](),controller[_0x94ff('0x3f')]);router[_0x94ff('0x39')](_0x94ff('0x40'),auth[_0x94ff('0x5')](),controller['queueNotify']('openchannel'));router['get'](_0x94ff('0x41'),auth[_0x94ff('0x5')](),controller['showOpenchannelQueues']);router[_0x94ff('0x39')](_0x94ff('0x42'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x3a')]('sms'));router[_0x94ff('0x39')](_0x94ff('0x43'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x3a')]('whatsapp'));router[_0x94ff('0x3')]('/sms/queues/:id',auth[_0x94ff('0x5')](),controller[_0x94ff('0x44')]);router['get'](_0x94ff('0x45'),auth[_0x94ff('0x5')](),controller['showWhatsappQueues']);router[_0x94ff('0x39')](_0x94ff('0x46'),auth[_0x94ff('0x5')](),controller[_0x94ff('0x47')]);module[_0x94ff('0x48')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index bd247f8..d65709d 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 _0x6074=['findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Account','Queue','findOne','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','create','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','Start','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','message','error','status','sendStatus','name','isNil','rows','VoiceChannels','query','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','merge','voiceQueuesChannelRedirect','Outbound','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport'];(function(_0x431f27,_0x127d1b){var _0x495a1f=function(_0x345e20){while(--_0x345e20){_0x431f27['push'](_0x431f27['shift']());}};_0x495a1f(++_0x127d1b);}(_0x6074,0xc3));var _0x4607=function(_0x333fed,_0x3d2122){_0x333fed=_0x333fed-0x0;var _0x12cac2=_0x6074[_0x333fed];return _0x12cac2;};'use strict';var BPromise=require(_0x4607('0x0'));var moment=require('moment');var _=require(_0x4607('0x1'));var util=require(_0x4607('0x2'));var db=require(_0x4607('0x3'))['db'];var logger=require(_0x4607('0x4'))(_0x4607('0x5'));var jayson=require(_0x4607('0x6'));var amiClient=jayson[_0x4607('0x7')]['http']({'port':0x232a});var mailClient=jayson[_0x4607('0x7')][_0x4607('0x8')]({'port':0x232b});var routingClient=jayson[_0x4607('0x7')][_0x4607('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x452171,_0x4be5c8,_0x35d573){return new BPromise(function(_0x5cf066,_0x2cac5d){var _0x9b5c16=_0x35d573?_0x35d573:amiClient;return _0x9b5c16[_0x4607('0x9')](_0x452171,_0x4be5c8)[_0x4607('0xa')](function(_0x2752ae){if(_0x2752ae['error']){if(_0x2752ae['error']['code']===0x1f4){return _0x2cac5d(_0x2752ae['error'][_0x4607('0xb')]);}return _0x5cf066(_0x2752ae[_0x4607('0xc')][_0x4607('0xb')]);}else{_0x5cf066(_0x2752ae['result']);}})['catch'](function(_0x2b77c2){_0x2cac5d(_0x2b77c2);});});}function respondWithResult(_0x5c99ee,_0x43d6d4){_0x43d6d4=_0x43d6d4||0xc8;return function(_0x5c057f){if(_0x5c057f){return _0x5c99ee[_0x4607('0xd')](_0x43d6d4)['json'](_0x5c057f);}return _0x5c99ee[_0x4607('0xe')](0x194);};}function handleError(_0x111ce9,_0x5f0067){_0x5f0067=_0x5f0067||0x1f4;return function(_0x2aa237){logger[_0x4607('0xc')](_0x2aa237['stack']);if(_0x2aa237[_0x4607('0xf')]){delete _0x2aa237[_0x4607('0xf')];}_0x111ce9['status'](_0x5f0067)['send'](_0x2aa237);};}function findById(_0x29eb5){return function(_0x215f70){if(!_['isNil'](_0x29eb5)&&!_[_0x4607('0x10')](_0x215f70)&&!_['isNil'](_0x215f70[_0x4607('0x11')])){return _['find'](_0x215f70[_0x4607('0x11')],function(_0x7ce4bb){return _0x7ce4bb['id']==_0x29eb5;});}return null;};}exports['voiceChannels']=function(_0x5e3815,_0x12823a){return respondWithRpcPromise(_0x4607('0x12'),_0x5e3815[_0x4607('0x13')])['then'](respondWithResult(_0x12823a,null))[_0x4607('0x14')](handleError(_0x12823a,null));};exports[_0x4607('0x15')]=function(_0x7524d8,_0x31a0ff){return respondWithRpcPromise(_0x4607('0x16'),_['merge'](_0x7524d8[_0x4607('0x13')],_0x7524d8[_0x4607('0x17')]))[_0x4607('0xa')](respondWithResult(_0x31a0ff,null))[_0x4607('0x14')](handleError(_0x31a0ff,null));};exports['voiceChannelStopMixMonitor']=function(_0x33cd8a,_0x25f443){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0x33cd8a[_0x4607('0x13')],_0x33cd8a[_0x4607('0x17')]))[_0x4607('0xa')](respondWithResult(_0x25f443,null))['catch'](handleError(_0x25f443,null));};exports[_0x4607('0x18')]=function(_0x6f2f52,_0x588748){return respondWithRpcPromise(_0x4607('0x19'),_0x6f2f52[_0x4607('0x13')])[_0x4607('0xa')](respondWithResult(_0x588748,null))[_0x4607('0x14')](handleError(_0x588748,null));};exports[_0x4607('0x1a')]=function(_0x3f6ee0,_0x594b69){return respondWithRpcPromise(_0x4607('0x19'),_0x3f6ee0[_0x4607('0x13')])[_0x4607('0xa')](findById(_0x3f6ee0[_0x4607('0x17')]['id']))['then'](respondWithResult(_0x594b69,null))['catch'](handleError(_0x594b69,null));};exports[_0x4607('0x1b')]=function(_0x2bf547,_0x8bc788){return respondWithRpcPromise(_0x4607('0x1c'),_['merge'](_0x2bf547[_0x4607('0x13')],_0x2bf547[_0x4607('0x17')]))['then'](respondWithResult(_0x8bc788,null))[_0x4607('0x14')](handleError(_0x8bc788,null));};exports[_0x4607('0x1d')]=function(_0x5bb5bf,_0x1d4a72){return respondWithRpcPromise('VoiceQueuesChannels',_0x5bb5bf['query'])[_0x4607('0xa')](respondWithResult(_0x1d4a72,null))['catch'](handleError(_0x1d4a72,null));};exports[_0x4607('0x1e')]=function(_0x4dc045,_0x1797c6){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x4607('0x1f')](_0x4dc045['query'],_0x4dc045['params']))[_0x4607('0xa')](respondWithResult(_0x1797c6,null))[_0x4607('0x14')](handleError(_0x1797c6,null));};exports['voiceQueuesChannelHangup']=function(_0x18630d,_0x16c9d8){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x4607('0x1f')](_0x18630d[_0x4607('0x13')],_0x18630d[_0x4607('0x17')]))[_0x4607('0xa')](respondWithResult(_0x16c9d8,null))[_0x4607('0x14')](handleError(_0x16c9d8,null));};exports[_0x4607('0x20')]=function(_0x55eae7,_0x42457d){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x4607('0x1f')](_0x55eae7[_0x4607('0x13')],_0x55eae7[_0x4607('0x17')]))[_0x4607('0xa')](respondWithResult(_0x42457d,null))[_0x4607('0x14')](handleError(_0x42457d,null));};exports['outbound']=function(_0x31bde9,_0x3df336){return respondWithRpcPromise(_0x4607('0x21'),_0x31bde9[_0x4607('0x13')])[_0x4607('0xa')](respondWithResult(_0x3df336,null))[_0x4607('0x14')](handleError(_0x3df336,null));};exports['outboundChannels']=function(_0x58b405,_0x53fde9){return respondWithRpcPromise('OutboundChannels',_0x58b405['query'])['then'](respondWithResult(_0x53fde9,null))[_0x4607('0x14')](handleError(_0x53fde9,null));};exports['agents']=function(_0x22af28,_0x5676dd){var _0x47a92a;return respondWithRpcPromise('Agents',_0x22af28[_0x4607('0x13')])[_0x4607('0xa')](function(_0x3a41db){_0x47a92a=_0x3a41db;return respondWithRpcPromise(_0x4607('0x22'),_0x22af28[_0x4607('0x13')],routingClient);})[_0x4607('0xa')](function(_0x4d1036){return _[_0x4607('0x1f')]({},_0x4d1036,_0x47a92a);})['then'](respondWithResult(_0x5676dd,null))[_0x4607('0x14')](handleError(_0x5676dd,null));};exports[_0x4607('0x23')]=function(_0xfc75dd,_0x1eb2a3){if(_0xfc75dd[_0x4607('0x24')]&&_0xfc75dd[_0x4607('0x24')][_0x4607('0x25')]&&_0xfc75dd[_0x4607('0x26')]&&_0xfc75dd[_0x4607('0x26')][_0x4607('0xf')]){for(var _0x5541db in _0xfc75dd[_0x4607('0x24')]['interaction']){if(_0xfc75dd[_0x4607('0x24')][_0x4607('0x25')][_0x4607('0x27')](_0x5541db)){db[_0x4607('0x28')][_0x4607('0x29')]({'where':{'channel':_0x5541db,'membername':_0xfc75dd[_0x4607('0x26')]['name'],'type':_0x4607('0x2a'),'exitAt':null,'uniqueid':_0xfc75dd[_0x4607('0x24')][_0x4607('0x25')][_0x5541db]&&_0xfc75dd[_0x4607('0x24')][_0x4607('0x25')][_0x5541db][_0x4607('0x2b')]?{'$notIn':_0xfc75dd[_0x4607('0x24')][_0x4607('0x25')][_0x5541db]}:{'$ne':null}}})[_0x4607('0xa')](function(_0x2ffb2f){var _0x29297a=moment()[_0x4607('0x2c')](_0x4607('0x2d'));for(var _0x4a5c1d=0x0,_0x262b34=_0x2ffb2f[_0x4607('0x2b')];_0x4a5c1d<_0x262b34;_0x4a5c1d+=0x1){_0x2ffb2f[_0x4a5c1d][_0x4607('0x2e')]({'exitAt':_0x29297a});}});for(var _0x1bbd87=0x0;_0x1bbd87<_0xfc75dd[_0x4607('0x24')][_0x4607('0x25')][_0x5541db]['length'];_0x1bbd87+=0x1){db[_0x4607('0x28')][_0x4607('0x2f')]({'where':{'channel':_0x5541db,'membername':_0xfc75dd[_0x4607('0x26')][_0x4607('0xf')],'type':'INTERACTION','uniqueid':_0xfc75dd[_0x4607('0x24')][_0x4607('0x25')][_0x5541db][_0x1bbd87],'exitAt':null},'defaults':{'channel':_0x5541db,'membername':_0xfc75dd[_0x4607('0x26')]['name'],'interface':_[_0x4607('0x10')](_0xfc75dd[_0x4607('0x26')][_0x4607('0x30')])?util[_0x4607('0x2c')](_0x4607('0x31'),_0xfc75dd[_0x4607('0x26')][_0x4607('0xf')]):_0xfc75dd[_0x4607('0x26')]['interface'],'type':_0x4607('0x2a'),'enterAt':moment()['format'](_0x4607('0x2d')),'role':_0x4607('0x32'),'internal':_0xfc75dd[_0x4607('0x26')][_0x4607('0x33')],'uniqueid':_0xfc75dd[_0x4607('0x24')][_0x4607('0x25')][_0x5541db][_0x1bbd87]}});}}}}return respondWithRpcPromise(_0x4607('0x34'),{'id':_0xfc75dd[_0x4607('0x17')]['id'],'capacity':_0xfc75dd[_0x4607('0x24')][_0x4607('0x35')]},routingClient)[_0x4607('0xa')](respondWithResult(_0x1eb2a3,null))['catch'](handleError(_0x1eb2a3,null));};exports[_0x4607('0x36')]=function(_0xcf7334,_0x5796a3){return respondWithRpcPromise(_0x4607('0x37'),_0xcf7334[_0x4607('0x13')])[_0x4607('0xa')](respondWithResult(_0x5796a3,null))[_0x4607('0x14')](handleError(_0x5796a3,null));};exports[_0x4607('0x38')]=function(_0x12c44a,_0x2eb8b8){return respondWithRpcPromise(_0x4607('0x39'),_0x12c44a['query'])[_0x4607('0xa')](respondWithResult(_0x2eb8b8,null))[_0x4607('0x14')](handleError(_0x2eb8b8,null));};exports[_0x4607('0x3a')]=function(_0x51bf7c,_0x34cedd){return respondWithRpcPromise('Campaigns',_0x51bf7c['query'])['then'](respondWithResult(_0x34cedd,null))['catch'](handleError(_0x34cedd,null));};exports['chatQueues']=function(_0x120296,_0x34dae4){return respondWithRpcPromise(_0x4607('0x3b'),_0x120296[_0x4607('0x13')],routingClient)[_0x4607('0xa')](respondWithResult(_0x34dae4,null))[_0x4607('0x14')](handleError(_0x34dae4,null));};exports[_0x4607('0x3c')]=function(_0x1252f3,_0x47f23a){return respondWithRpcPromise(_0x4607('0x3b'),_0x1252f3['query'],routingClient)[_0x4607('0xa')](findById(_0x1252f3[_0x4607('0x17')]['id']))[_0x4607('0xa')](respondWithResult(_0x47f23a,null))[_0x4607('0x14')](handleError(_0x47f23a,null));};exports[_0x4607('0x3d')]=function(_0x34793e,_0x7f6192){return respondWithRpcPromise(_0x4607('0x3e'),_0x34793e[_0x4607('0x13')],routingClient)[_0x4607('0xa')](respondWithResult(_0x7f6192,null))[_0x4607('0x14')](handleError(_0x7f6192,null));};exports[_0x4607('0x3f')]=function(_0x140477,_0xc964cf){return respondWithRpcPromise(_0x4607('0x3e'),_0x140477['query'],routingClient)[_0x4607('0xa')](findById(_0x140477[_0x4607('0x17')]['id']))[_0x4607('0xa')](respondWithResult(_0xc964cf,null))[_0x4607('0x14')](handleError(_0xc964cf,null));};exports[_0x4607('0x40')]=function(_0x3fef30,_0x4172fb){return respondWithRpcPromise(_0x4607('0x41'),_0x3fef30[_0x4607('0x13')],mailClient)[_0x4607('0xa')](respondWithResult(_0x4172fb,null))[_0x4607('0x14')](handleError(_0x4172fb,null));};exports[_0x4607('0x42')]=function(_0x15ccdb,_0x2b17eb){return respondWithRpcPromise('OpenchannelQueues',_0x15ccdb[_0x4607('0x13')],routingClient)[_0x4607('0xa')](respondWithResult(_0x2b17eb,null))[_0x4607('0x14')](handleError(_0x2b17eb,null));};exports[_0x4607('0x43')]=function(_0x1eceea,_0x52ef5a){return respondWithRpcPromise(_0x4607('0x44'),_0x1eceea[_0x4607('0x13')],routingClient)[_0x4607('0xa')](findById(_0x1eceea[_0x4607('0x17')]['id']))[_0x4607('0xa')](respondWithResult(_0x52ef5a,null))[_0x4607('0x14')](handleError(_0x52ef5a,null));};exports[_0x4607('0x45')]=function(_0x4c89b5,_0x310b6){return respondWithRpcPromise(_0x4607('0x46'),_0x4c89b5['query'],routingClient)[_0x4607('0xa')](respondWithResult(_0x310b6,null))[_0x4607('0x14')](handleError(_0x310b6,null));};exports[_0x4607('0x47')]=function(_0xcd80,_0x789b9c){return respondWithRpcPromise(_0x4607('0x46'),_0xcd80[_0x4607('0x13')],routingClient)[_0x4607('0xa')](findById(_0xcd80[_0x4607('0x17')]['id']))[_0x4607('0xa')](respondWithResult(_0x789b9c,null))[_0x4607('0x14')](handleError(_0x789b9c,null));};exports['whatsappQueues']=function(_0x4fe883,_0x4cfbe9){return respondWithRpcPromise('WhatsappQueues',_0x4fe883[_0x4607('0x13')],routingClient)[_0x4607('0xa')](respondWithResult(_0x4cfbe9,null))[_0x4607('0x14')](handleError(_0x4cfbe9,null));};exports[_0x4607('0x48')]=function(_0x50585c,_0x6d3801){return respondWithRpcPromise(_0x4607('0x49'),_0x50585c['query'],routingClient)[_0x4607('0xa')](findById(_0x50585c[_0x4607('0x17')]['id']))[_0x4607('0xa')](respondWithResult(_0x6d3801,null))['catch'](handleError(_0x6d3801,null));};exports[_0x4607('0x4a')]=function(_0x2deebb,_0x48d402){return respondWithRpcPromise(_0x4607('0x4b'),_0x2deebb[_0x4607('0x13')],routingClient)['then'](respondWithResult(_0x48d402,null))[_0x4607('0x14')](handleError(_0x48d402,null));};exports[_0x4607('0x4c')]=function(_0x3bd50f,_0x3f7674){return respondWithRpcPromise(_0x4607('0x4b'),_0x3bd50f['query'],routingClient)[_0x4607('0xa')](findById(_0x3bd50f[_0x4607('0x17')]['id']))[_0x4607('0xa')](respondWithResult(_0x3f7674,null))[_0x4607('0x14')](handleError(_0x3f7674,null));};exports['faxAccounts']=function(_0x1e7bad,_0x44e7e4){return respondWithRpcPromise(_0x4607('0x4d'),_0x1e7bad['query'])['then'](respondWithResult(_0x44e7e4,null))[_0x4607('0x14')](handleError(_0x44e7e4,null));};exports[_0x4607('0x4e')]=function(_0x26b841,_0x19fcc6){return respondWithRpcPromise(_0x4607('0x4f'),_0x26b841[_0x4607('0x13')],routingClient)[_0x4607('0xa')](respondWithResult(_0x19fcc6,null))[_0x4607('0x14')](handleError(_0x19fcc6,null));};exports['mailQueuesWaitingInteractions']=function(_0x43241a,_0x3d721e){return respondWithRpcPromise(_0x4607('0x50'),_0x43241a['query'],routingClient)[_0x4607('0xa')](respondWithResult(_0x3d721e,null))[_0x4607('0x14')](handleError(_0x3d721e,null));};exports[_0x4607('0x51')]=function(_0x4666d7,_0x650726){return respondWithRpcPromise(_0x4607('0x52'),_0x4666d7[_0x4607('0x13')],routingClient)[_0x4607('0xa')](respondWithResult(_0x650726,null))[_0x4607('0x14')](handleError(_0x650726,null));};exports[_0x4607('0x53')]=function(_0x5cb53e,_0x2630ea){return respondWithRpcPromise(_0x4607('0x52'),_0x5cb53e[_0x4607('0x13')],routingClient)[_0x4607('0xa')](function(_0x1e8b4b){if(_0x5cb53e['query'][_0x4607('0x54')]!==undefined){var _0x47ffd3=_(_0x1e8b4b[_0x4607('0x11')])[_0x4607('0x55')]([_0x5cb53e[_0x4607('0x13')][_0x4607('0x54')],_0x5cb53e['params']['id']])['map'](_0x4607('0x56'))['uniq']()[_0x4607('0x57')]();return _0x1e8b4b[_0x4607('0x11')]['filter'](function(_0x27e23b){return _0x47ffd3[_0x4607('0x58')](_0x27e23b['queue_id'])>-0x1;});}else{return _0x1e8b4b[_0x4607('0x11')][_0x4607('0x55')](function(_0x3d1ddd){return _0x3d1ddd[_0x4607('0x56')]===parseInt(_0x5cb53e[_0x4607('0x17')]['id']);});}})[_0x4607('0xa')](respondWithResult(_0x2630ea,null))[_0x4607('0x14')](handleError(_0x2630ea,null));};exports[_0x4607('0x59')]=function(_0x4d7ff3,_0xe7dd3e){return respondWithRpcPromise(_0x4607('0x5a'),_0x4d7ff3[_0x4607('0x13')],routingClient)[_0x4607('0xa')](respondWithResult(_0xe7dd3e,null))['catch'](handleError(_0xe7dd3e,null));};exports[_0x4607('0x5b')]=function(_0x5eeecc,_0x555787){return respondWithRpcPromise(_0x4607('0x5c'),_0x5eeecc[_0x4607('0x13')],routingClient)[_0x4607('0xa')](respondWithResult(_0x555787,null))['catch'](handleError(_0x555787,null));};exports[_0x4607('0x5d')]=function(_0x1eeed3,_0x260601){return respondWithRpcPromise(_0x4607('0x5e'),_0x1eeed3[_0x4607('0x13')],routingClient)[_0x4607('0xa')](respondWithResult(_0x260601,null))[_0x4607('0x14')](handleError(_0x260601,null));};exports['queueNotify']=function(_0x1c14ef){return function(_0x21cc5f,_0x15a1b1){var _0x10add1,_0x8416ff;var _0x331dde=_[_0x4607('0x5f')](_0x1c14ef);var _0x37aad5=_0x1c14ef===_0x4607('0x60')?'Website':_0x4607('0x61');return db[_0x331dde+_0x4607('0x62')][_0x4607('0x63')]({'raw':!![],'where':{'id':_0x21cc5f[_0x4607('0x17')]['id']}})[_0x4607('0xa')](function(_0x24fb64){if(_[_0x4607('0x10')](_0x24fb64)){throw new Error(_0x331dde+'\x20Queue\x20not\x20found');}_0x10add1=_0x24fb64;return db[_0x331dde+_0x4607('0x64')]['findOne']({'where':{'id':_0x21cc5f[_0x4607('0x24')][_0x4607('0x65')]},'include':[{'model':db[_0x331dde+_0x4607('0x66')],'as':_0x4607('0x66')},{'model':db[_0x331dde+_0x37aad5],'as':_0x4607('0x61')}]});})[_0x4607('0xa')](function(_0x50f1a4){if(_[_0x4607('0x10')](_0x50f1a4)){throw new Error(_0x331dde+_0x4607('0x67'));}_0x8416ff=_0x50f1a4;return _0x50f1a4[_0x4607('0x68')]({'read':0x0,'readAt':null,'UserId':null});})[_0x4607('0xa')](function(){var _0x7944bd={'uniqueid':_0x1c14ef+'.'+_0x8416ff['id']+'.'+_0x8416ff[_0x4607('0x66')]['id'],'FromUserId':_0x21cc5f['user']['id'],'type':_0x4607('0x69')};_0x7944bd[_0x331dde+_0x4607('0x6a')]=_0x8416ff['id'];_0x7944bd[_0x331dde+_0x4607('0x6b')]=_0x8416ff[_0x4607('0x66')]['id'];_0x7944bd[_0x4607('0x6c')+_0x331dde+_0x37aad5+'Id']=_0x8416ff[_0x4607('0x61')]['id'];_0x7944bd['To'+_0x331dde+'QueueId']=_0x10add1['id'];return db[_0x331dde+'TransferReport'][_0x4607('0x6d')](_0x7944bd);})[_0x4607('0xa')](function(){return respondWithRpcPromise('Start',{'channel':_0x1c14ef,'interaction':_0x8416ff[_0x4607('0x66')],'message':_0x8416ff,'account':_0x8416ff[_0x4607('0x61')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x10add1[_0x4607('0xf')]+','+(_0x8416ff['Account'][_0x4607('0x6e')]||0x12c),'interval':_0x4607('0x6f')}]},routingClient);})['then'](respondWithResult(_0x15a1b1,null))[_0x4607('0x14')](handleError(_0x15a1b1,null));};};exports[_0x4607('0x70')]=function(_0x45b193,_0x321b4e){var _0x25b63e,_0x163677;if(_['isNil'](_0x45b193['body']['channel'])){throw new Error(_0x4607('0x71'));}var _0x8e5280=_0x45b193['body']['channel'];var _0x29e4ce=_[_0x4607('0x5f')](_0x8e5280);var _0x5aab3b=_0x8e5280==='chat'?'Website':_0x4607('0x61');return db[_0x4607('0x72')][_0x4607('0x63')]({'raw':!![],'where':{'id':_0x45b193['params']['id'],'role':_0x4607('0x32')}})['then'](function(_0x2f0e59){if(_[_0x4607('0x10')](_0x2f0e59)){throw new Error(_0x4607('0x73'));}_0x25b63e=_0x2f0e59;return db[_0x29e4ce+_0x4607('0x64')][_0x4607('0x63')]({'where':{'id':_0x45b193[_0x4607('0x24')][_0x4607('0x65')]},'include':[{'model':db[_0x29e4ce+_0x4607('0x66')],'as':'Interaction'},{'model':db[_0x29e4ce+_0x5aab3b],'as':_0x4607('0x61')}]});})[_0x4607('0xa')](function(_0x3ed950){if(_[_0x4607('0x10')](_0x3ed950)){throw new Error(_0x29e4ce+'\x20Message\x20not\x20found');}_0x163677=_0x3ed950;return _0x3ed950[_0x4607('0x68')]({'read':0x0,'readAt':null,'UserId':null});})[_0x4607('0xa')](function(){var _0x522665={'uniqueid':_0x8e5280+'.'+_0x163677['id']+'.'+_0x163677[_0x4607('0x66')]['id'],'FromUserId':_0x45b193[_0x4607('0x26')]['id'],'type':_0x4607('0x69'),'ToUserId':_0x25b63e['id']};_0x522665[_0x29e4ce+_0x4607('0x6a')]=_0x163677['id'];_0x522665[_0x29e4ce+'InteractionId']=_0x163677[_0x4607('0x66')]['id'];_0x522665[_0x4607('0x6c')+_0x29e4ce+_0x5aab3b+'Id']=_0x163677[_0x4607('0x61')]['id'];return db[_0x29e4ce+'TransferReport'][_0x4607('0x6d')](_0x522665);})[_0x4607('0xa')](function(){return respondWithRpcPromise(_0x4607('0x74'),{'channel':_0x8e5280,'interaction':_0x163677['Interaction'],'message':_0x163677,'account':_0x163677[_0x4607('0x61')],'applications':[{'id':0x0,'priority':0x1,'app':_0x4607('0x32'),'appdata':_0x25b63e[_0x4607('0xf')]+','+(_0x163677['Account'][_0x4607('0x75')]||0x12c),'interval':_0x4607('0x6f')}]},routingClient);})[_0x4607('0xa')](respondWithResult(_0x321b4e,null))[_0x4607('0x14')](handleError(_0x321b4e,null));}; \ No newline at end of file +var _0xe753=['FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','queueNotify','chat','Website','Queue','\x20Queue\x20not\x20found','findOne','Interaction','Account','\x20Message\x20not\x20found','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','Agent\x20not\x20found','Message','messageId','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','http','client','request','then','error','message','result','catch','status','json','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','VoiceQueuesPreview','merge','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','length','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','telephones','trunks','Trunks','campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xe753,0x12a));var _0x3e75=function(_0x56d0b2,_0x2f7c9e){_0x56d0b2=_0x56d0b2-0x0;var _0x37e421=_0xe753[_0x56d0b2];return _0x37e421;};'use strict';var BPromise=require(_0x3e75('0x0'));var moment=require(_0x3e75('0x1'));var _=require(_0x3e75('0x2'));var util=require(_0x3e75('0x3'));var db=require(_0x3e75('0x4'))['db'];var logger=require(_0x3e75('0x5'))(_0x3e75('0x6'));var jayson=require(_0x3e75('0x7'));var amiClient=jayson['client'][_0x3e75('0x8')]({'port':0x232a});var mailClient=jayson[_0x3e75('0x9')][_0x3e75('0x8')]({'port':0x232b});var routingClient=jayson[_0x3e75('0x9')]['http']({'port':0x232c});function respondWithRpcPromise(_0x49f821,_0x2e56e4,_0x2da234){return new BPromise(function(_0x37b165,_0x17e222){var _0x48883f=_0x2da234?_0x2da234:amiClient;return _0x48883f[_0x3e75('0xa')](_0x49f821,_0x2e56e4)[_0x3e75('0xb')](function(_0x19b3f0){if(_0x19b3f0[_0x3e75('0xc')]){if(_0x19b3f0['error']['code']===0x1f4){return _0x17e222(_0x19b3f0[_0x3e75('0xc')][_0x3e75('0xd')]);}return _0x37b165(_0x19b3f0[_0x3e75('0xc')]['message']);}else{_0x37b165(_0x19b3f0[_0x3e75('0xe')]);}})[_0x3e75('0xf')](function(_0x9a44ec){_0x17e222(_0x9a44ec);});});}function respondWithResult(_0x3f1d3a,_0x26e121){_0x26e121=_0x26e121||0xc8;return function(_0x31a8db){if(_0x31a8db){return _0x3f1d3a[_0x3e75('0x10')](_0x26e121)[_0x3e75('0x11')](_0x31a8db);}return _0x3f1d3a['sendStatus'](0x194);};}function handleError(_0x3d2325,_0x1f24ad){_0x1f24ad=_0x1f24ad||0x1f4;return function(_0x191ed3){logger['error'](_0x191ed3[_0x3e75('0x12')]);if(_0x191ed3[_0x3e75('0x13')]){delete _0x191ed3['name'];}_0x3d2325[_0x3e75('0x10')](_0x1f24ad)[_0x3e75('0x14')](_0x191ed3);};}function findById(_0xbb65a6){return function(_0x2ff841){if(!_[_0x3e75('0x15')](_0xbb65a6)&&!_[_0x3e75('0x15')](_0x2ff841)&&!_[_0x3e75('0x15')](_0x2ff841[_0x3e75('0x16')])){return _[_0x3e75('0x17')](_0x2ff841['rows'],function(_0x581853){return _0x581853['id']==_0xbb65a6;});}return null;};}exports[_0x3e75('0x18')]=function(_0x3e436c,_0xee5e38){return respondWithRpcPromise(_0x3e75('0x19'),_0x3e436c[_0x3e75('0x1a')])[_0x3e75('0xb')](respondWithResult(_0xee5e38,null))[_0x3e75('0xf')](handleError(_0xee5e38,null));};exports[_0x3e75('0x1b')]=function(_0xabb832,_0x160fe3){return respondWithRpcPromise(_0x3e75('0x1c'),_['merge'](_0xabb832[_0x3e75('0x1a')],_0xabb832[_0x3e75('0x1d')]))[_0x3e75('0xb')](respondWithResult(_0x160fe3,null))[_0x3e75('0xf')](handleError(_0x160fe3,null));};exports[_0x3e75('0x1e')]=function(_0x46ac98,_0x5554e0){return respondWithRpcPromise(_0x3e75('0x1f'),_['merge'](_0x46ac98[_0x3e75('0x1a')],_0x46ac98['params']))[_0x3e75('0xb')](respondWithResult(_0x5554e0,null))[_0x3e75('0xf')](handleError(_0x5554e0,null));};exports[_0x3e75('0x20')]=function(_0x2cf8e6,_0xc5deb5){return respondWithRpcPromise('VoiceQueues',_0x2cf8e6[_0x3e75('0x1a')])[_0x3e75('0xb')](respondWithResult(_0xc5deb5,null))[_0x3e75('0xf')](handleError(_0xc5deb5,null));};exports['showVoiceQueues']=function(_0x32b17f,_0x2b3b32){return respondWithRpcPromise(_0x3e75('0x21'),_0x32b17f[_0x3e75('0x1a')])[_0x3e75('0xb')](findById(_0x32b17f['params']['id']))[_0x3e75('0xb')](respondWithResult(_0x2b3b32,null))['catch'](handleError(_0x2b3b32,null));};exports['voiceQueuesPreview']=function(_0x2f66a8,_0x56ed68){return respondWithRpcPromise(_0x3e75('0x22'),_[_0x3e75('0x23')](_0x2f66a8[_0x3e75('0x1a')],_0x2f66a8[_0x3e75('0x1d')]))[_0x3e75('0xb')](respondWithResult(_0x56ed68,null))[_0x3e75('0xf')](handleError(_0x56ed68,null));};exports[_0x3e75('0x24')]=function(_0xeee0a1,_0x135825){return respondWithRpcPromise(_0x3e75('0x25'),_0xeee0a1['query'])['then'](respondWithResult(_0x135825,null))[_0x3e75('0xf')](handleError(_0x135825,null));};exports['voiceQueuesChannel']=function(_0x57c1db,_0x3c7014){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x3e75('0x23')](_0x57c1db[_0x3e75('0x1a')],_0x57c1db['params']))[_0x3e75('0xb')](respondWithResult(_0x3c7014,null))[_0x3e75('0xf')](handleError(_0x3c7014,null));};exports[_0x3e75('0x26')]=function(_0x220565,_0x3440b4){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x3e75('0x23')](_0x220565[_0x3e75('0x1a')],_0x220565[_0x3e75('0x1d')]))['then'](respondWithResult(_0x3440b4,null))[_0x3e75('0xf')](handleError(_0x3440b4,null));};exports[_0x3e75('0x27')]=function(_0x4a6839,_0x363414){return respondWithRpcPromise(_0x3e75('0x28'),_['merge'](_0x4a6839[_0x3e75('0x1a')],_0x4a6839[_0x3e75('0x1d')]))[_0x3e75('0xb')](respondWithResult(_0x363414,null))['catch'](handleError(_0x363414,null));};exports['outbound']=function(_0x4099fe,_0x32a7a9){return respondWithRpcPromise(_0x3e75('0x29'),_0x4099fe['query'])[_0x3e75('0xb')](respondWithResult(_0x32a7a9,null))[_0x3e75('0xf')](handleError(_0x32a7a9,null));};exports[_0x3e75('0x2a')]=function(_0x20d408,_0x1717be){return respondWithRpcPromise('OutboundChannels',_0x20d408[_0x3e75('0x1a')])[_0x3e75('0xb')](respondWithResult(_0x1717be,null))[_0x3e75('0xf')](handleError(_0x1717be,null));};exports[_0x3e75('0x2b')]=function(_0x37fc98,_0x59139b){var _0x2b450e;return respondWithRpcPromise('Agents',_0x37fc98[_0x3e75('0x1a')])[_0x3e75('0xb')](function(_0x474167){_0x2b450e=_0x474167;return respondWithRpcPromise(_0x3e75('0x2c'),_0x37fc98['query'],routingClient);})[_0x3e75('0xb')](function(_0x118ba5){return _['merge']({},_0x118ba5,_0x2b450e);})[_0x3e75('0xb')](respondWithResult(_0x59139b,null))[_0x3e75('0xf')](handleError(_0x59139b,null));};exports[_0x3e75('0x2d')]=function(_0x3d6f07,_0x548e98){if(_0x3d6f07[_0x3e75('0x2e')]&&_0x3d6f07[_0x3e75('0x2e')][_0x3e75('0x2f')]&&_0x3d6f07[_0x3e75('0x30')]&&_0x3d6f07[_0x3e75('0x30')]['name']){for(var _0x4ec925 in _0x3d6f07[_0x3e75('0x2e')][_0x3e75('0x2f')]){if(_0x3d6f07[_0x3e75('0x2e')][_0x3e75('0x2f')][_0x3e75('0x31')](_0x4ec925)){db[_0x3e75('0x32')]['findAll']({'where':{'channel':_0x4ec925,'membername':_0x3d6f07['user']['name'],'type':_0x3e75('0x33'),'exitAt':null,'uniqueid':_0x3d6f07['body'][_0x3e75('0x2f')][_0x4ec925]&&_0x3d6f07[_0x3e75('0x2e')][_0x3e75('0x2f')][_0x4ec925]['length']?{'$notIn':_0x3d6f07[_0x3e75('0x2e')]['interaction'][_0x4ec925]}:{'$ne':null}}})[_0x3e75('0xb')](function(_0x476313){var _0x444edc=moment()[_0x3e75('0x34')](_0x3e75('0x35'));for(var _0xfa4c9b=0x0,_0x8abdad=_0x476313['length'];_0xfa4c9b<_0x8abdad;_0xfa4c9b+=0x1){_0x476313[_0xfa4c9b][_0x3e75('0x36')]({'exitAt':_0x444edc});}});for(var _0x158872=0x0;_0x158872<_0x3d6f07[_0x3e75('0x2e')][_0x3e75('0x2f')][_0x4ec925][_0x3e75('0x37')];_0x158872+=0x1){db[_0x3e75('0x32')][_0x3e75('0x38')]({'where':{'channel':_0x4ec925,'membername':_0x3d6f07[_0x3e75('0x30')][_0x3e75('0x13')],'type':_0x3e75('0x33'),'uniqueid':_0x3d6f07[_0x3e75('0x2e')]['interaction'][_0x4ec925][_0x158872],'exitAt':null},'defaults':{'channel':_0x4ec925,'membername':_0x3d6f07[_0x3e75('0x30')][_0x3e75('0x13')],'interface':_[_0x3e75('0x15')](_0x3d6f07[_0x3e75('0x30')][_0x3e75('0x39')])?util[_0x3e75('0x34')](_0x3e75('0x3a'),_0x3d6f07[_0x3e75('0x30')]['name']):_0x3d6f07['user'][_0x3e75('0x39')],'type':_0x3e75('0x33'),'enterAt':moment()[_0x3e75('0x34')](_0x3e75('0x35')),'role':_0x3e75('0x3b'),'internal':_0x3d6f07['user'][_0x3e75('0x3c')],'uniqueid':_0x3d6f07['body']['interaction'][_0x4ec925][_0x158872]}});}}}}return respondWithRpcPromise(_0x3e75('0x3d'),{'id':_0x3d6f07[_0x3e75('0x1d')]['id'],'capacity':_0x3d6f07['body']['capacity']},routingClient)[_0x3e75('0xb')](respondWithResult(_0x548e98,null))['catch'](handleError(_0x548e98,null));};exports[_0x3e75('0x3e')]=function(_0x5114d8,_0x19071a){return respondWithRpcPromise('Telephones',_0x5114d8[_0x3e75('0x1a')])[_0x3e75('0xb')](respondWithResult(_0x19071a,null))[_0x3e75('0xf')](handleError(_0x19071a,null));};exports[_0x3e75('0x3f')]=function(_0x4a78b7,_0x190f5b){return respondWithRpcPromise(_0x3e75('0x40'),_0x4a78b7['query'])['then'](respondWithResult(_0x190f5b,null))[_0x3e75('0xf')](handleError(_0x190f5b,null));};exports[_0x3e75('0x41')]=function(_0x1da639,_0x4f3e11){return respondWithRpcPromise('Campaigns',_0x1da639['query'])[_0x3e75('0xb')](respondWithResult(_0x4f3e11,null))[_0x3e75('0xf')](handleError(_0x4f3e11,null));};exports[_0x3e75('0x42')]=function(_0x2568ec,_0x1f13de){return respondWithRpcPromise('ChatQueues',_0x2568ec['query'],routingClient)[_0x3e75('0xb')](respondWithResult(_0x1f13de,null))[_0x3e75('0xf')](handleError(_0x1f13de,null));};exports[_0x3e75('0x43')]=function(_0x29d41c,_0x39faa1){return respondWithRpcPromise(_0x3e75('0x44'),_0x29d41c[_0x3e75('0x1a')],routingClient)[_0x3e75('0xb')](findById(_0x29d41c['params']['id']))[_0x3e75('0xb')](respondWithResult(_0x39faa1,null))[_0x3e75('0xf')](handleError(_0x39faa1,null));};exports[_0x3e75('0x45')]=function(_0x501a79,_0x73b7ab){return respondWithRpcPromise('MailQueues',_0x501a79[_0x3e75('0x1a')],routingClient)[_0x3e75('0xb')](respondWithResult(_0x73b7ab,null))[_0x3e75('0xf')](handleError(_0x73b7ab,null));};exports[_0x3e75('0x46')]=function(_0x1affac,_0x2d30ed){return respondWithRpcPromise(_0x3e75('0x47'),_0x1affac[_0x3e75('0x1a')],routingClient)[_0x3e75('0xb')](findById(_0x1affac['params']['id']))[_0x3e75('0xb')](respondWithResult(_0x2d30ed,null))[_0x3e75('0xf')](handleError(_0x2d30ed,null));};exports[_0x3e75('0x48')]=function(_0x4fc5b6,_0x2c4474){return respondWithRpcPromise(_0x3e75('0x49'),_0x4fc5b6[_0x3e75('0x1a')],mailClient)[_0x3e75('0xb')](respondWithResult(_0x2c4474,null))[_0x3e75('0xf')](handleError(_0x2c4474,null));};exports[_0x3e75('0x4a')]=function(_0x882b92,_0x357a48){return respondWithRpcPromise(_0x3e75('0x4b'),_0x882b92[_0x3e75('0x1a')],routingClient)[_0x3e75('0xb')](respondWithResult(_0x357a48,null))['catch'](handleError(_0x357a48,null));};exports[_0x3e75('0x4c')]=function(_0x4093eb,_0x10238c){return respondWithRpcPromise(_0x3e75('0x4b'),_0x4093eb[_0x3e75('0x1a')],routingClient)[_0x3e75('0xb')](findById(_0x4093eb[_0x3e75('0x1d')]['id']))[_0x3e75('0xb')](respondWithResult(_0x10238c,null))[_0x3e75('0xf')](handleError(_0x10238c,null));};exports[_0x3e75('0x4d')]=function(_0x1ed4cc,_0x499d5b){return respondWithRpcPromise(_0x3e75('0x4e'),_0x1ed4cc[_0x3e75('0x1a')],routingClient)['then'](respondWithResult(_0x499d5b,null))[_0x3e75('0xf')](handleError(_0x499d5b,null));};exports[_0x3e75('0x4f')]=function(_0x4795bd,_0x59a5c4){return respondWithRpcPromise(_0x3e75('0x4e'),_0x4795bd[_0x3e75('0x1a')],routingClient)[_0x3e75('0xb')](findById(_0x4795bd[_0x3e75('0x1d')]['id']))['then'](respondWithResult(_0x59a5c4,null))[_0x3e75('0xf')](handleError(_0x59a5c4,null));};exports[_0x3e75('0x50')]=function(_0x3a581b,_0x123254){return respondWithRpcPromise('WhatsappQueues',_0x3a581b['query'],routingClient)[_0x3e75('0xb')](respondWithResult(_0x123254,null))[_0x3e75('0xf')](handleError(_0x123254,null));};exports[_0x3e75('0x51')]=function(_0x358226,_0x405cfb){return respondWithRpcPromise(_0x3e75('0x52'),_0x358226[_0x3e75('0x1a')],routingClient)[_0x3e75('0xb')](findById(_0x358226[_0x3e75('0x1d')]['id']))[_0x3e75('0xb')](respondWithResult(_0x405cfb,null))['catch'](handleError(_0x405cfb,null));};exports['faxQueues']=function(_0xdc7c9a,_0x55f092){return respondWithRpcPromise(_0x3e75('0x53'),_0xdc7c9a[_0x3e75('0x1a')],routingClient)[_0x3e75('0xb')](respondWithResult(_0x55f092,null))['catch'](handleError(_0x55f092,null));};exports['showFaxQueues']=function(_0x21d260,_0x2c623e){return respondWithRpcPromise('FaxQueues',_0x21d260[_0x3e75('0x1a')],routingClient)[_0x3e75('0xb')](findById(_0x21d260[_0x3e75('0x1d')]['id']))['then'](respondWithResult(_0x2c623e,null))[_0x3e75('0xf')](handleError(_0x2c623e,null));};exports[_0x3e75('0x54')]=function(_0x2665a1,_0x54191d){return respondWithRpcPromise(_0x3e75('0x55'),_0x2665a1[_0x3e75('0x1a')])[_0x3e75('0xb')](respondWithResult(_0x54191d,null))[_0x3e75('0xf')](handleError(_0x54191d,null));};exports[_0x3e75('0x56')]=function(_0x3ccb82,_0x3aa7b2){return respondWithRpcPromise(_0x3e75('0x57'),_0x3ccb82['query'],routingClient)['then'](respondWithResult(_0x3aa7b2,null))['catch'](handleError(_0x3aa7b2,null));};exports[_0x3e75('0x58')]=function(_0x4f67db,_0x54e0f9){return respondWithRpcPromise(_0x3e75('0x59'),_0x4f67db['query'],routingClient)['then'](respondWithResult(_0x54e0f9,null))[_0x3e75('0xf')](handleError(_0x54e0f9,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x488dba,_0x2b666a){return respondWithRpcPromise(_0x3e75('0x5a'),_0x488dba[_0x3e75('0x1a')],routingClient)[_0x3e75('0xb')](respondWithResult(_0x2b666a,null))[_0x3e75('0xf')](handleError(_0x2b666a,null));};exports[_0x3e75('0x5b')]=function(_0x445b14,_0x4defe0){return respondWithRpcPromise(_0x3e75('0x5a'),_0x445b14['query'],routingClient)[_0x3e75('0xb')](function(_0x4a8e87){if(_0x445b14[_0x3e75('0x1a')][_0x3e75('0x5c')]!==undefined){var _0x2c66dc=_(_0x4a8e87[_0x3e75('0x16')])[_0x3e75('0x5d')]([_0x445b14[_0x3e75('0x1a')][_0x3e75('0x5c')],_0x445b14[_0x3e75('0x1d')]['id']])[_0x3e75('0x5e')](_0x3e75('0x5f'))[_0x3e75('0x60')]()[_0x3e75('0x61')]();return _0x4a8e87[_0x3e75('0x16')]['filter'](function(_0x4cad03){return _0x2c66dc['indexOf'](_0x4cad03[_0x3e75('0x5f')])>-0x1;});}else{return _0x4a8e87[_0x3e75('0x16')][_0x3e75('0x5d')](function(_0x37b796){return _0x37b796[_0x3e75('0x5f')]===parseInt(_0x445b14['params']['id']);});}})[_0x3e75('0xb')](respondWithResult(_0x4defe0,null))[_0x3e75('0xf')](handleError(_0x4defe0,null));};exports[_0x3e75('0x62')]=function(_0x4ea833,_0x95d20e){return respondWithRpcPromise(_0x3e75('0x63'),_0x4ea833[_0x3e75('0x1a')],routingClient)[_0x3e75('0xb')](respondWithResult(_0x95d20e,null))[_0x3e75('0xf')](handleError(_0x95d20e,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x2b89a9,_0x57e35f){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x2b89a9[_0x3e75('0x1a')],routingClient)[_0x3e75('0xb')](respondWithResult(_0x57e35f,null))[_0x3e75('0xf')](handleError(_0x57e35f,null));};exports['faxQueuesWaitingInteractions']=function(_0x5a1832,_0x10b9e7){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x5a1832['query'],routingClient)[_0x3e75('0xb')](respondWithResult(_0x10b9e7,null))[_0x3e75('0xf')](handleError(_0x10b9e7,null));};exports[_0x3e75('0x64')]=function(_0x2ea591){return function(_0x41b99e,_0x210a05){var _0x5c2585,_0x57521d;var _0x41f9a0=_['capitalize'](_0x2ea591);var _0x19d5df=_0x2ea591===_0x3e75('0x65')?_0x3e75('0x66'):'Account';return db[_0x41f9a0+_0x3e75('0x67')]['findOne']({'raw':!![],'where':{'id':_0x41b99e[_0x3e75('0x1d')]['id']}})[_0x3e75('0xb')](function(_0x5f2755){if(_[_0x3e75('0x15')](_0x5f2755)){throw new Error(_0x41f9a0+_0x3e75('0x68'));}_0x5c2585=_0x5f2755;return db[_0x41f9a0+'Message'][_0x3e75('0x69')]({'where':{'id':_0x41b99e[_0x3e75('0x2e')]['messageId']},'include':[{'model':db[_0x41f9a0+_0x3e75('0x6a')],'as':_0x3e75('0x6a')},{'model':db[_0x41f9a0+_0x19d5df],'as':_0x3e75('0x6b')}]});})[_0x3e75('0xb')](function(_0xd952d6){if(_['isNil'](_0xd952d6)){throw new Error(_0x41f9a0+_0x3e75('0x6c'));}_0x57521d=_0xd952d6;return _0xd952d6['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x3e75('0xb')](function(){var _0x8c98b0={'uniqueid':_0x2ea591+'.'+_0x57521d['id']+'.'+_0x57521d[_0x3e75('0x6a')]['id'],'FromUserId':_0x41b99e[_0x3e75('0x30')]['id'],'type':_0x3e75('0x6d')};_0x8c98b0[_0x41f9a0+_0x3e75('0x6e')]=_0x57521d['id'];_0x8c98b0[_0x41f9a0+_0x3e75('0x6f')]=_0x57521d[_0x3e75('0x6a')]['id'];_0x8c98b0[_0x3e75('0x70')+_0x41f9a0+_0x19d5df+'Id']=_0x57521d['Account']['id'];_0x8c98b0['To'+_0x41f9a0+_0x3e75('0x71')]=_0x5c2585['id'];return db[_0x41f9a0+_0x3e75('0x72')][_0x3e75('0x73')](_0x8c98b0);})[_0x3e75('0xb')](function(){return respondWithRpcPromise(_0x3e75('0x74'),{'channel':_0x2ea591,'interaction':_0x57521d['Interaction'],'message':_0x57521d,'account':_0x57521d[_0x3e75('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':_0x3e75('0x6d'),'appdata':_0x5c2585['name']+','+(_0x57521d[_0x3e75('0x6b')][_0x3e75('0x75')]||0x12c),'interval':_0x3e75('0x76')}]},routingClient);})['then'](respondWithResult(_0x210a05,null))[_0x3e75('0xf')](handleError(_0x210a05,null));};};exports[_0x3e75('0x77')]=function(_0x1d4b63,_0x5ca06b){var _0x42ca3b,_0xc1c757;if(_[_0x3e75('0x15')](_0x1d4b63[_0x3e75('0x2e')][_0x3e75('0x78')])){throw new Error(_0x3e75('0x79'));}var _0x1a7780=_0x1d4b63[_0x3e75('0x2e')]['channel'];var _0x1825f1=_[_0x3e75('0x7a')](_0x1a7780);var _0x424188=_0x1a7780===_0x3e75('0x65')?'Website':'Account';return db['User']['findOne']({'raw':!![],'where':{'id':_0x1d4b63[_0x3e75('0x1d')]['id'],'role':_0x3e75('0x3b')}})[_0x3e75('0xb')](function(_0x5a5ae1){if(_[_0x3e75('0x15')](_0x5a5ae1)){throw new Error(_0x3e75('0x7b'));}_0x42ca3b=_0x5a5ae1;return db[_0x1825f1+_0x3e75('0x7c')][_0x3e75('0x69')]({'where':{'id':_0x1d4b63[_0x3e75('0x2e')][_0x3e75('0x7d')]},'include':[{'model':db[_0x1825f1+_0x3e75('0x6a')],'as':_0x3e75('0x6a')},{'model':db[_0x1825f1+_0x424188],'as':_0x3e75('0x6b')}]});})[_0x3e75('0xb')](function(_0x13850c){if(_[_0x3e75('0x15')](_0x13850c)){throw new Error(_0x1825f1+_0x3e75('0x6c'));}_0xc1c757=_0x13850c;return _0x13850c['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x3e75('0xb')](function(){var _0x1b6333={'uniqueid':_0x1a7780+'.'+_0xc1c757['id']+'.'+_0xc1c757[_0x3e75('0x6a')]['id'],'FromUserId':_0x1d4b63[_0x3e75('0x30')]['id'],'type':_0x3e75('0x6d'),'ToUserId':_0x42ca3b['id']};_0x1b6333[_0x1825f1+_0x3e75('0x6e')]=_0xc1c757['id'];_0x1b6333[_0x1825f1+'InteractionId']=_0xc1c757['Interaction']['id'];_0x1b6333['From'+_0x1825f1+_0x424188+'Id']=_0xc1c757[_0x3e75('0x6b')]['id'];return db[_0x1825f1+'TransferReport'][_0x3e75('0x73')](_0x1b6333);})[_0x3e75('0xb')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a7780,'interaction':_0xc1c757[_0x3e75('0x6a')],'message':_0xc1c757,'account':_0xc1c757[_0x3e75('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':_0x3e75('0x3b'),'appdata':_0x42ca3b['name']+','+(_0xc1c757['Account'][_0x3e75('0x7e')]||0x12c),'interval':_0x3e75('0x76')}]},routingClient);})[_0x3e75('0xb')](respondWithResult(_0x5ca06b,null))[_0x3e75('0xf')](handleError(_0x5ca06b,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index e4ea3af..9c6944b 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 _0xc455=['../../config/environment','isAuthenticated','index','get','/:id','/:id/run','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xc455,0x13f));var _0x5c45=function(_0x36535e,_0x47bdc5){_0x36535e=_0x36535e-0x0;var _0x10efe2=_0xc455[_0x36535e];return _0x10efe2;};'use strict';var multer=require(_0x5c45('0x0'));var util=require('util');var path=require(_0x5c45('0x1'));var timeout=require(_0x5c45('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5c45('0x3'));var interaction=require(_0x5c45('0x4'));var config=require(_0x5c45('0x5'));var controller=require('./schedule.controller');router['get']('/',auth[_0x5c45('0x6')](),controller[_0x5c45('0x7')]);router[_0x5c45('0x8')](_0x5c45('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x5c45('0x8')](_0x5c45('0xa'),auth[_0x5c45('0x6')](),controller['run']);router[_0x5c45('0xb')]('/',auth[_0x5c45('0x6')](),controller[_0x5c45('0xc')]);router[_0x5c45('0xd')]('/:id',auth[_0x5c45('0x6')](),controller[_0x5c45('0xe')]);router[_0x5c45('0xf')](_0x5c45('0x9'),auth[_0x5c45('0x6')](),controller[_0x5c45('0x10')]);module[_0x5c45('0x11')]=router; \ No newline at end of file +var _0xb140=['index','get','show','/:id/run','post','create','/:id','update','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated'];(function(_0x421f42,_0x1c2d04){var _0x59128b=function(_0x333f9a){while(--_0x333f9a){_0x421f42['push'](_0x421f42['shift']());}};_0x59128b(++_0x1c2d04);}(_0xb140,0x1c3));var _0x0b14=function(_0x2c5ce4,_0x1b4766){_0x2c5ce4=_0x2c5ce4-0x0;var _0x4060a3=_0xb140[_0x2c5ce4];return _0x4060a3;};'use strict';var multer=require(_0x0b14('0x0'));var util=require(_0x0b14('0x1'));var path=require(_0x0b14('0x2'));var timeout=require(_0x0b14('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0b14('0x4'));var auth=require(_0x0b14('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0b14('0x6'));var controller=require('./schedule.controller');router['get']('/',auth[_0x0b14('0x7')](),controller[_0x0b14('0x8')]);router[_0x0b14('0x9')]('/:id',auth[_0x0b14('0x7')](),controller[_0x0b14('0xa')]);router[_0x0b14('0x9')](_0x0b14('0xb'),auth[_0x0b14('0x7')](),controller['run']);router[_0x0b14('0xc')]('/',auth[_0x0b14('0x7')](),controller[_0x0b14('0xd')]);router['put'](_0x0b14('0xe'),auth['isAuthenticated'](),controller[_0x0b14('0xf')]);router['delete'](_0x0b14('0xe'),auth[_0x0b14('0x7')](),controller[_0x0b14('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 62261df..ced1ca5 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 _0xd046=['DATE','ENUM','months','weeks','minutes','days','pdf','csv','custom','BOOLEAN','TEXT','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd046,0x129));var _0x6d04=function(_0x105c6b,_0x5affef){_0x105c6b=_0x105c6b-0x0;var _0x36b73b=_0xd046[_0x105c6b];return _0x36b73b;};'use strict';var Sequelize=require('sequelize');module[_0x6d04('0x0')]={'name':{'type':Sequelize[_0x6d04('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x6d04('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x6d04('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x6d04('0x2')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x6d04('0x3')]('years','quarters',_0x6d04('0x4'),_0x6d04('0x5'),'days','hours',_0x6d04('0x6')),'allowNull':![],'defaultValue':_0x6d04('0x7')},'output':{'type':Sequelize['ENUM']('csv',_0x6d04('0x8'),'xlsx'),'allowNull':![],'defaultValue':_0x6d04('0x9')},'type':{'type':Sequelize['ENUM']('custom','default'),'allowNull':![],'defaultValue':_0x6d04('0xa')},'sendMail':{'type':Sequelize[_0x6d04('0xb')],'defaultValue':![]},'email':{'type':Sequelize[_0x6d04('0x1')]},'cc':{'type':Sequelize[_0x6d04('0xc')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x6d04('0xb')],'defaultValue':!![]}}; \ No newline at end of file +var _0x102b=['DATE','INTEGER','ENUM','quarters','months','weeks','days','hours','pdf','custom','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*'];(function(_0x3588de,_0x15b64a){var _0x2b4386=function(_0x38ba7d){while(--_0x38ba7d){_0x3588de['push'](_0x3588de['shift']());}};_0x2b4386(++_0x15b64a);}(_0x102b,0x1be));var _0xb102=function(_0x1f7b1a,_0x4320ee){_0x1f7b1a=_0x1f7b1a-0x0;var _0x4269c0=_0x102b[_0x1f7b1a];return _0x4269c0;};'use strict';var Sequelize=require('sequelize');module[_0xb102('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb102('0x1')]},'active':{'type':Sequelize[_0xb102('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xb102('0x1')],'allowNull':![],'defaultValue':_0xb102('0x3')},'startAt':{'type':Sequelize[_0xb102('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xb102('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xb102('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xb102('0x6')]('years',_0xb102('0x7'),_0xb102('0x8'),_0xb102('0x9'),_0xb102('0xa'),_0xb102('0xb'),'minutes'),'allowNull':![],'defaultValue':_0xb102('0xa')},'output':{'type':Sequelize['ENUM']('csv',_0xb102('0xc'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xb102('0x6')](_0xb102('0xd'),'default'),'allowNull':![],'defaultValue':_0xb102('0xd')},'sendMail':{'type':Sequelize[_0xb102('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xb102('0x1')]},'cc':{'type':Sequelize[_0xb102('0xe')]},'bcc':{'type':Sequelize[_0xb102('0xe')]},'sendIfEmpty':{'type':Sequelize[_0xb102('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 9f124f5..1895b4d 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 _0xa397=['status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','error','name','send','index','map','Schedule','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','fields','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Scheduler','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0xb1cf62,_0x4ed9e3){var _0x52b8b0=function(_0x5438ec){while(--_0x5438ec){_0xb1cf62['push'](_0xb1cf62['shift']());}};_0x52b8b0(++_0x4ed9e3);}(_0xa397,0x188));var _0x7a39=function(_0x2cfc5a,_0x4bea57){_0x2cfc5a=_0x2cfc5a-0x0;var _0x44d603=_0xa397[_0x2cfc5a];return _0x44d603;};'use strict';var pdf=require(_0x7a39('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7a39('0x1'));var jsonpatch=require(_0x7a39('0x2'));var rp=require(_0x7a39('0x3'));var moment=require(_0x7a39('0x4'));var BPromise=require(_0x7a39('0x5'));var Mustache=require('mustache');var util=require(_0x7a39('0x6'));var path=require('path');var sox=require(_0x7a39('0x7'));var csv=require(_0x7a39('0x8'));var ejs=require(_0x7a39('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7a39('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7a39('0xb'));var deskjs=require(_0x7a39('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7a39('0xd'));var Papa=require(_0x7a39('0xe'));var Redis=require(_0x7a39('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7a39('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7a39('0x11'))(_0x7a39('0x12'));var utils=require(_0x7a39('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x7a39('0x14'));var db=require(_0x7a39('0x15'))['db'];function respondWithStatusCode(_0x1d865a,_0x3419f0){_0x3419f0=_0x3419f0||0xcc;return function(_0x11a1eb){if(_0x11a1eb){return _0x1d865a[_0x7a39('0x16')](_0x3419f0);}return _0x1d865a[_0x7a39('0x17')](_0x3419f0)[_0x7a39('0x18')]();};}function respondWithResult(_0x39caf8,_0x3a42c4){_0x3a42c4=_0x3a42c4||0xc8;return function(_0x2a7861){if(_0x2a7861){return _0x39caf8[_0x7a39('0x17')](_0x3a42c4)['json'](_0x2a7861);}};}function respondWithFilteredResult(_0x8b02f7,_0x4df8be){return function(_0x4cab55){if(_0x4cab55){var _0x781b57=_0x4cab55[_0x7a39('0x19')],_0x2ac154=_0x4df8be[_0x7a39('0x1a')],_0x466742=_0x4df8be[_0x7a39('0x1a')]+_0x4df8be[_0x7a39('0x1b')],_0x389c35;if(_0x466742>=_0x781b57){_0x466742=_0x781b57;_0x389c35=0xc8;}else{_0x389c35=0xce;}_0x8b02f7['status'](_0x389c35);return _0x8b02f7[_0x7a39('0x1c')](_0x7a39('0x1d'),_0x2ac154+'-'+_0x466742+'/'+_0x781b57)[_0x7a39('0x1e')](_0x4cab55);}return null;};}function patchUpdates(_0x325b9a){return function(_0x23a63a){try{jsonpatch[_0x7a39('0x1f')](_0x23a63a,_0x325b9a,!![]);}catch(_0x2676ec){return BPromise[_0x7a39('0x20')](_0x2676ec);}return _0x23a63a[_0x7a39('0x21')]();};}function saveUpdates(_0x1d9447,_0x327443){return function(_0x21ebd3){if(_0x21ebd3){return _0x21ebd3['update'](_0x1d9447)[_0x7a39('0x22')](function(_0x5cce2e){return _0x5cce2e;});}return null;};}function removeEntity(_0x57c594,_0x10ced8){return function(_0x349628){if(_0x349628){return _0x349628[_0x7a39('0x23')]()[_0x7a39('0x22')](function(){var _0x4e0e12=_0x349628[_0x7a39('0x24')]({'plain':!![]});var _0x25c59a='Scheduler';return db['UserProfileResource'][_0x7a39('0x23')]({'where':{'type':_0x25c59a,'resourceId':_0x4e0e12['id']}})['then'](function(){return _0x349628;});})[_0x7a39('0x22')](function(){_0x57c594[_0x7a39('0x17')](0xcc)[_0x7a39('0x18')]();});}};}function handleEntityNotFound(_0x2f13de,_0x9392ee){return function(_0x93fbb1){if(!_0x93fbb1){_0x2f13de[_0x7a39('0x16')](0x194);}return _0x93fbb1;};}function handleError(_0x3435e8,_0x1530c5){_0x1530c5=_0x1530c5||0x1f4;return function(_0x5642dd){logger[_0x7a39('0x25')](_0x5642dd['stack']);if(_0x5642dd[_0x7a39('0x26')]){delete _0x5642dd['name'];}_0x3435e8[_0x7a39('0x17')](_0x1530c5)[_0x7a39('0x27')](_0x5642dd);};}exports[_0x7a39('0x28')]=function(_0x2223fe,_0x4d70c2){var _0x433ddc={},_0x3513de={},_0x218f31={'count':0x0,'rows':[]};var _0x26a4d0=_[_0x7a39('0x29')](db[_0x7a39('0x2a')][_0x7a39('0x2b')],function(_0x306347){return{'name':_0x306347[_0x7a39('0x2c')],'type':_0x306347['type'][_0x7a39('0x2d')]};});_0x3513de[_0x7a39('0x2e')]=_[_0x7a39('0x29')](_0x26a4d0,_0x7a39('0x26'));_0x3513de[_0x7a39('0x2f')]=_['keys'](_0x2223fe[_0x7a39('0x2f')]);_0x3513de[_0x7a39('0x30')]=_[_0x7a39('0x31')](_0x3513de[_0x7a39('0x2e')],_0x3513de[_0x7a39('0x2f')]);_0x433ddc[_0x7a39('0x32')]=_['intersection'](_0x3513de[_0x7a39('0x2e')],qs['fields'](_0x2223fe[_0x7a39('0x2f')]['fields']));_0x433ddc[_0x7a39('0x32')]=_0x433ddc[_0x7a39('0x32')][_0x7a39('0x33')]?_0x433ddc[_0x7a39('0x32')]:_0x3513de[_0x7a39('0x2e')];if(!_0x2223fe[_0x7a39('0x2f')][_0x7a39('0x34')](_0x7a39('0x35'))){_0x433ddc[_0x7a39('0x1b')]=qs[_0x7a39('0x1b')](_0x2223fe['query']['limit']);_0x433ddc[_0x7a39('0x1a')]=qs[_0x7a39('0x1a')](_0x2223fe[_0x7a39('0x2f')]['offset']);}_0x433ddc[_0x7a39('0x36')]=qs[_0x7a39('0x37')](_0x2223fe['query']['sort']);_0x433ddc['where']=qs[_0x7a39('0x30')](_[_0x7a39('0x38')](_0x2223fe[_0x7a39('0x2f')],_0x3513de['filters']),_0x26a4d0);if(_0x2223fe[_0x7a39('0x2f')][_0x7a39('0x39')]){_0x433ddc[_0x7a39('0x3a')]=_[_0x7a39('0x3b')](_0x433ddc[_0x7a39('0x3a')],{'$or':_[_0x7a39('0x29')](_0x26a4d0,function(_0x167cbe){if(_0x167cbe[_0x7a39('0x3c')]!==_0x7a39('0x3d')){var _0x3434a2={};_0x3434a2[_0x167cbe[_0x7a39('0x26')]]={'$like':'%'+_0x2223fe[_0x7a39('0x2f')]['filter']+'%'};return _0x3434a2;}})});}_0x433ddc=_['merge']({},_0x433ddc,_0x2223fe['options']);var _0x296137={'where':_0x433ddc[_0x7a39('0x3a')]};return db[_0x7a39('0x2a')][_0x7a39('0x19')](_0x296137)[_0x7a39('0x22')](function(_0x46e5f8){_0x218f31['count']=_0x46e5f8;if(_0x2223fe['query'][_0x7a39('0x3e')]){_0x433ddc[_0x7a39('0x3f')]=[{'all':!![]}];}return db[_0x7a39('0x2a')][_0x7a39('0x40')](_0x433ddc);})[_0x7a39('0x22')](function(_0x242930){_0x218f31[_0x7a39('0x41')]=_0x242930;return _0x218f31;})[_0x7a39('0x22')](respondWithFilteredResult(_0x4d70c2,_0x433ddc))[_0x7a39('0x42')](handleError(_0x4d70c2,null));};exports['show']=function(_0x28aafa,_0x57bef0){var _0x2c8e9a={'raw':![],'where':{'id':_0x28aafa[_0x7a39('0x43')]['id']}},_0x6ac2db={};_0x6ac2db[_0x7a39('0x2e')]=_[_0x7a39('0x44')](db['Schedule']['rawAttributes']);_0x6ac2db[_0x7a39('0x2f')]=_[_0x7a39('0x44')](_0x28aafa[_0x7a39('0x2f')]);_0x6ac2db[_0x7a39('0x30')]=_[_0x7a39('0x31')](_0x6ac2db['model'],_0x6ac2db[_0x7a39('0x2f')]);_0x2c8e9a[_0x7a39('0x32')]=_[_0x7a39('0x31')](_0x6ac2db[_0x7a39('0x2e')],qs['fields'](_0x28aafa['query'][_0x7a39('0x45')]));_0x2c8e9a[_0x7a39('0x32')]=_0x2c8e9a[_0x7a39('0x32')][_0x7a39('0x33')]?_0x2c8e9a[_0x7a39('0x32')]:_0x6ac2db[_0x7a39('0x2e')];if(_0x28aafa[_0x7a39('0x2f')][_0x7a39('0x3e')]){_0x2c8e9a['include']=[{'all':!![]}];}_0x2c8e9a=_[_0x7a39('0x3b')]({},_0x2c8e9a,_0x28aafa[_0x7a39('0x46')]);return db[_0x7a39('0x2a')][_0x7a39('0x47')](_0x2c8e9a)[_0x7a39('0x22')](handleEntityNotFound(_0x57bef0,null))[_0x7a39('0x22')](respondWithResult(_0x57bef0,null))[_0x7a39('0x42')](handleError(_0x57bef0,null));};exports[_0x7a39('0x48')]=function(_0x114f00,_0x3e92ba){return db[_0x7a39('0x2a')]['create'](_0x114f00[_0x7a39('0x49')],{})[_0x7a39('0x22')](function(_0x27d150){var _0x1526b6=_0x114f00[_0x7a39('0x4a')][_0x7a39('0x24')]({'plain':!![]});if(!_0x1526b6)throw new Error(_0x7a39('0x4b'));if(_0x1526b6['role']==='user'){var _0x4d0578=_0x27d150[_0x7a39('0x24')]({'plain':!![]});var _0x5e2c7f=_0x7a39('0x4c');return db[_0x7a39('0x4d')]['find']({'where':{'name':_0x5e2c7f,'userProfileId':_0x1526b6[_0x7a39('0x4e')]},'raw':!![]})[_0x7a39('0x22')](function(_0x551942){if(_0x551942&&_0x551942[_0x7a39('0x4f')]===0x0){return db[_0x7a39('0x50')]['create']({'name':_0x4d0578[_0x7a39('0x26')],'resourceId':_0x4d0578['id'],'type':_0x551942[_0x7a39('0x26')],'sectionId':_0x551942['id']},{})['then'](function(){return _0x27d150;});}else{return _0x27d150;}})[_0x7a39('0x42')](function(_0x5193dc){logger[_0x7a39('0x25')](_0x7a39('0x51'),_0x5193dc);throw _0x5193dc;});}return _0x27d150;})[_0x7a39('0x22')](respondWithResult(_0x3e92ba,0xc9))[_0x7a39('0x42')](handleError(_0x3e92ba,null));};exports[_0x7a39('0x52')]=function(_0x4f138c,_0x27f748){if(_0x4f138c[_0x7a39('0x49')]['id']){delete _0x4f138c['body']['id'];}return db[_0x7a39('0x2a')][_0x7a39('0x47')]({'where':{'id':_0x4f138c[_0x7a39('0x43')]['id']}})[_0x7a39('0x22')](handleEntityNotFound(_0x27f748,null))['then'](saveUpdates(_0x4f138c[_0x7a39('0x49')],null))[_0x7a39('0x22')](respondWithResult(_0x27f748,null))[_0x7a39('0x42')](handleError(_0x27f748,null));};exports[_0x7a39('0x23')]=function(_0x152631,_0x373a22){return db[_0x7a39('0x2a')][_0x7a39('0x47')]({'where':{'id':_0x152631['params']['id']}})[_0x7a39('0x22')](handleEntityNotFound(_0x373a22,null))[_0x7a39('0x22')](removeEntity(_0x373a22,null))[_0x7a39('0x42')](handleError(_0x373a22,null));};exports['run']=function(_0x659db8,_0x505382,_0x212018){var _0x14924e=require('../../config/schedule');return db[_0x7a39('0x2a')][_0x7a39('0x47')]({'where':{'id':_0x659db8[_0x7a39('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x505382,null))[_0x7a39('0x22')](function(){_0x14924e['run'](_0x659db8['params']['id']);})['then'](respondWithStatusCode(_0x505382,null))['catch'](handleError(_0x505382,null));}; \ No newline at end of file +var _0x4f3e=['stack','name','send','map','Schedule','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','lodash','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','count','offset','limit','set','apply','save','update','then','destroy','get','Scheduler','UserProfileResource','sendStatus','error'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x4f3e,0xce));var _0xe4f3=function(_0x1ee1aa,_0x4bb6a3){_0x1ee1aa=_0x1ee1aa-0x0;var _0x661aa8=_0x4f3e[_0x1ee1aa];return _0x661aa8;};'use strict';var pdf=require(_0xe4f3('0x0'));var emlformat=require(_0xe4f3('0x1'));var rimraf=require(_0xe4f3('0x2'));var zipdir=require(_0xe4f3('0x3'));var jsonpatch=require(_0xe4f3('0x4'));var rp=require(_0xe4f3('0x5'));var moment=require('moment');var BPromise=require(_0xe4f3('0x6'));var Mustache=require('mustache');var util=require(_0xe4f3('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xe4f3('0x8'));var ejs=require(_0xe4f3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe4f3('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe4f3('0xb'));var deskjs=require(_0xe4f3('0xc'));var toCsv=require(_0xe4f3('0x8'));var querystring=require(_0xe4f3('0xd'));var Papa=require(_0xe4f3('0xe'));var Redis=require('ioredis');var authService=require(_0xe4f3('0xf'));var qs=require(_0xe4f3('0x10'));var as=require(_0xe4f3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe4f3('0x12'))(_0xe4f3('0x13'));var utils=require('../../config/utils');var config=require(_0xe4f3('0x14'));var licenseUtil=require(_0xe4f3('0x15'));var db=require(_0xe4f3('0x16'))['db'];function respondWithStatusCode(_0x35de1e,_0x3493ae){_0x3493ae=_0x3493ae||0xcc;return function(_0x17fbd1){if(_0x17fbd1){return _0x35de1e['sendStatus'](_0x3493ae);}return _0x35de1e[_0xe4f3('0x17')](_0x3493ae)[_0xe4f3('0x18')]();};}function respondWithResult(_0x40d35f,_0xb39dae){_0xb39dae=_0xb39dae||0xc8;return function(_0x4e7ec1){if(_0x4e7ec1){return _0x40d35f[_0xe4f3('0x17')](_0xb39dae)[_0xe4f3('0x19')](_0x4e7ec1);}};}function respondWithFilteredResult(_0x158fc5,_0x5a3e83){return function(_0x2933d1){if(_0x2933d1){var _0x26cbe2=_0x2933d1[_0xe4f3('0x1a')],_0x69fdea=_0x5a3e83[_0xe4f3('0x1b')],_0x3b72a6=_0x5a3e83[_0xe4f3('0x1b')]+_0x5a3e83[_0xe4f3('0x1c')],_0x814ba5;if(_0x3b72a6>=_0x26cbe2){_0x3b72a6=_0x26cbe2;_0x814ba5=0xc8;}else{_0x814ba5=0xce;}_0x158fc5['status'](_0x814ba5);return _0x158fc5[_0xe4f3('0x1d')]('Content-Range',_0x69fdea+'-'+_0x3b72a6+'/'+_0x26cbe2)[_0xe4f3('0x19')](_0x2933d1);}return null;};}function patchUpdates(_0x37608f){return function(_0x296139){try{jsonpatch[_0xe4f3('0x1e')](_0x296139,_0x37608f,!![]);}catch(_0x4aa0c0){return BPromise['reject'](_0x4aa0c0);}return _0x296139[_0xe4f3('0x1f')]();};}function saveUpdates(_0x3f6226,_0x1cd6ab){return function(_0x279abb){if(_0x279abb){return _0x279abb[_0xe4f3('0x20')](_0x3f6226)[_0xe4f3('0x21')](function(_0x9fd41c){return _0x9fd41c;});}return null;};}function removeEntity(_0x398a39,_0x3b68d3){return function(_0x14e1bf){if(_0x14e1bf){return _0x14e1bf[_0xe4f3('0x22')]()['then'](function(){var _0x28a036=_0x14e1bf[_0xe4f3('0x23')]({'plain':!![]});var _0x1f72d5=_0xe4f3('0x24');return db[_0xe4f3('0x25')]['destroy']({'where':{'type':_0x1f72d5,'resourceId':_0x28a036['id']}})[_0xe4f3('0x21')](function(){return _0x14e1bf;});})[_0xe4f3('0x21')](function(){_0x398a39[_0xe4f3('0x17')](0xcc)[_0xe4f3('0x18')]();});}};}function handleEntityNotFound(_0x3847e9,_0x3a7a67){return function(_0x21e63e){if(!_0x21e63e){_0x3847e9[_0xe4f3('0x26')](0x194);}return _0x21e63e;};}function handleError(_0x2f3922,_0x55747d){_0x55747d=_0x55747d||0x1f4;return function(_0x38bde1){logger[_0xe4f3('0x27')](_0x38bde1[_0xe4f3('0x28')]);if(_0x38bde1[_0xe4f3('0x29')]){delete _0x38bde1['name'];}_0x2f3922['status'](_0x55747d)[_0xe4f3('0x2a')](_0x38bde1);};}exports['index']=function(_0x30b90c,_0x27efc8){var _0x1268ce={},_0x485bfe={},_0x4ae8c6={'count':0x0,'rows':[]};var _0x5abb2a=_[_0xe4f3('0x2b')](db[_0xe4f3('0x2c')][_0xe4f3('0x2d')],function(_0x596d2a){return{'name':_0x596d2a['fieldName'],'type':_0x596d2a[_0xe4f3('0x2e')][_0xe4f3('0x2f')]};});_0x485bfe[_0xe4f3('0x30')]=_[_0xe4f3('0x2b')](_0x5abb2a,_0xe4f3('0x29'));_0x485bfe[_0xe4f3('0x31')]=_[_0xe4f3('0x32')](_0x30b90c['query']);_0x485bfe[_0xe4f3('0x33')]=_['intersection'](_0x485bfe[_0xe4f3('0x30')],_0x485bfe['query']);_0x1268ce[_0xe4f3('0x34')]=_[_0xe4f3('0x35')](_0x485bfe[_0xe4f3('0x30')],qs[_0xe4f3('0x36')](_0x30b90c[_0xe4f3('0x31')][_0xe4f3('0x36')]));_0x1268ce['attributes']=_0x1268ce[_0xe4f3('0x34')][_0xe4f3('0x37')]?_0x1268ce[_0xe4f3('0x34')]:_0x485bfe[_0xe4f3('0x30')];if(!_0x30b90c['query'][_0xe4f3('0x38')](_0xe4f3('0x39'))){_0x1268ce[_0xe4f3('0x1c')]=qs[_0xe4f3('0x1c')](_0x30b90c[_0xe4f3('0x31')][_0xe4f3('0x1c')]);_0x1268ce[_0xe4f3('0x1b')]=qs[_0xe4f3('0x1b')](_0x30b90c[_0xe4f3('0x31')][_0xe4f3('0x1b')]);}_0x1268ce[_0xe4f3('0x3a')]=qs[_0xe4f3('0x3b')](_0x30b90c[_0xe4f3('0x31')][_0xe4f3('0x3b')]);_0x1268ce[_0xe4f3('0x3c')]=qs['filters'](_[_0xe4f3('0x3d')](_0x30b90c[_0xe4f3('0x31')],_0x485bfe['filters']),_0x5abb2a);if(_0x30b90c[_0xe4f3('0x31')][_0xe4f3('0x3e')]){_0x1268ce[_0xe4f3('0x3c')]=_['merge'](_0x1268ce[_0xe4f3('0x3c')],{'$or':_['map'](_0x5abb2a,function(_0x28b881){if(_0x28b881[_0xe4f3('0x2e')]!=='VIRTUAL'){var _0x5e8ac0={};_0x5e8ac0[_0x28b881['name']]={'$like':'%'+_0x30b90c['query'][_0xe4f3('0x3e')]+'%'};return _0x5e8ac0;}})});}_0x1268ce=_[_0xe4f3('0x3f')]({},_0x1268ce,_0x30b90c[_0xe4f3('0x40')]);var _0xd52b58={'where':_0x1268ce[_0xe4f3('0x3c')]};return db[_0xe4f3('0x2c')][_0xe4f3('0x1a')](_0xd52b58)[_0xe4f3('0x21')](function(_0x594b15){_0x4ae8c6[_0xe4f3('0x1a')]=_0x594b15;if(_0x30b90c['query'][_0xe4f3('0x41')]){_0x1268ce[_0xe4f3('0x42')]=[{'all':!![]}];}return db['Schedule'][_0xe4f3('0x43')](_0x1268ce);})['then'](function(_0x4e4544){_0x4ae8c6[_0xe4f3('0x44')]=_0x4e4544;return _0x4ae8c6;})[_0xe4f3('0x21')](respondWithFilteredResult(_0x27efc8,_0x1268ce))[_0xe4f3('0x45')](handleError(_0x27efc8,null));};exports[_0xe4f3('0x46')]=function(_0x11e64a,_0x2ffd6b){var _0x146644={'raw':![],'where':{'id':_0x11e64a[_0xe4f3('0x47')]['id']}},_0x1ba433={};_0x1ba433['model']=_[_0xe4f3('0x32')](db['Schedule'][_0xe4f3('0x2d')]);_0x1ba433[_0xe4f3('0x31')]=_[_0xe4f3('0x32')](_0x11e64a['query']);_0x1ba433[_0xe4f3('0x33')]=_['intersection'](_0x1ba433[_0xe4f3('0x30')],_0x1ba433['query']);_0x146644[_0xe4f3('0x34')]=_[_0xe4f3('0x35')](_0x1ba433['model'],qs[_0xe4f3('0x36')](_0x11e64a['query'][_0xe4f3('0x36')]));_0x146644[_0xe4f3('0x34')]=_0x146644[_0xe4f3('0x34')][_0xe4f3('0x37')]?_0x146644[_0xe4f3('0x34')]:_0x1ba433[_0xe4f3('0x30')];if(_0x11e64a[_0xe4f3('0x31')][_0xe4f3('0x41')]){_0x146644[_0xe4f3('0x42')]=[{'all':!![]}];}_0x146644=_[_0xe4f3('0x3f')]({},_0x146644,_0x11e64a[_0xe4f3('0x40')]);return db[_0xe4f3('0x2c')][_0xe4f3('0x48')](_0x146644)[_0xe4f3('0x21')](handleEntityNotFound(_0x2ffd6b,null))['then'](respondWithResult(_0x2ffd6b,null))['catch'](handleError(_0x2ffd6b,null));};exports[_0xe4f3('0x49')]=function(_0x109227,_0x5cfe7a){return db[_0xe4f3('0x2c')][_0xe4f3('0x49')](_0x109227[_0xe4f3('0x4a')],{})[_0xe4f3('0x21')](function(_0x164b9f){var _0x301c92=_0x109227[_0xe4f3('0x4b')][_0xe4f3('0x23')]({'plain':!![]});if(!_0x301c92)throw new Error(_0xe4f3('0x4c'));if(_0x301c92[_0xe4f3('0x4d')]===_0xe4f3('0x4b')){var _0x1f6145=_0x164b9f[_0xe4f3('0x23')]({'plain':!![]});var _0x1bbd2a=_0xe4f3('0x24');return db['UserProfileSection'][_0xe4f3('0x48')]({'where':{'name':_0x1bbd2a,'userProfileId':_0x301c92[_0xe4f3('0x4e')]},'raw':!![]})[_0xe4f3('0x21')](function(_0x15789e){if(_0x15789e&&_0x15789e['autoAssociation']===0x0){return db[_0xe4f3('0x25')][_0xe4f3('0x49')]({'name':_0x1f6145[_0xe4f3('0x29')],'resourceId':_0x1f6145['id'],'type':_0x15789e['name'],'sectionId':_0x15789e['id']},{})[_0xe4f3('0x21')](function(){return _0x164b9f;});}else{return _0x164b9f;}})['catch'](function(_0xb5d2fe){logger[_0xe4f3('0x27')](_0xe4f3('0x4f'),_0xb5d2fe);throw _0xb5d2fe;});}return _0x164b9f;})[_0xe4f3('0x21')](respondWithResult(_0x5cfe7a,0xc9))['catch'](handleError(_0x5cfe7a,null));};exports['update']=function(_0x5e34ef,_0xe6333e){if(_0x5e34ef[_0xe4f3('0x4a')]['id']){delete _0x5e34ef['body']['id'];}return db[_0xe4f3('0x2c')]['find']({'where':{'id':_0x5e34ef['params']['id']}})['then'](handleEntityNotFound(_0xe6333e,null))['then'](saveUpdates(_0x5e34ef['body'],null))['then'](respondWithResult(_0xe6333e,null))[_0xe4f3('0x45')](handleError(_0xe6333e,null));};exports[_0xe4f3('0x22')]=function(_0x315968,_0xdcc940){return db[_0xe4f3('0x2c')][_0xe4f3('0x48')]({'where':{'id':_0x315968['params']['id']}})[_0xe4f3('0x21')](handleEntityNotFound(_0xdcc940,null))[_0xe4f3('0x21')](removeEntity(_0xdcc940,null))[_0xe4f3('0x45')](handleError(_0xdcc940,null));};exports[_0xe4f3('0x50')]=function(_0x3b2ce2,_0x7efcab,_0x2bcdd0){var _0x2e7e49=require(_0xe4f3('0x51'));return db[_0xe4f3('0x2c')]['find']({'where':{'id':_0x3b2ce2[_0xe4f3('0x47')]['id']},'raw':!![]})[_0xe4f3('0x21')](handleEntityNotFound(_0x7efcab,null))['then'](function(){_0x2e7e49['run'](_0x3b2ce2[_0xe4f3('0x47')]['id']);})[_0xe4f3('0x21')](respondWithStatusCode(_0x7efcab,null))['catch'](handleError(_0x7efcab,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index a2ed302..db931f9 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 _0x2b12=['path','rimraf','./schedule.attributes','exports','define','tools_schedules','lodash','../../config/logger','bluebird','request-promise'];(function(_0x39c190,_0x188ecb){var _0x36ede0=function(_0x2d5ec6){while(--_0x2d5ec6){_0x39c190['push'](_0x39c190['shift']());}};_0x36ede0(++_0x188ecb);}(_0x2b12,0x114));var _0x22b1=function(_0x3e036f,_0x361755){_0x3e036f=_0x3e036f-0x0;var _0x5f278e=_0x2b12[_0x3e036f];return _0x5f278e;};'use strict';var _=require(_0x22b1('0x0'));var util=require('util');var logger=require(_0x22b1('0x1'))('api');var moment=require('moment');var BPromise=require(_0x22b1('0x2'));var rp=require(_0x22b1('0x3'));var fs=require('fs');var path=require(_0x22b1('0x4'));var rimraf=require(_0x22b1('0x5'));var config=require('../../config/environment');var attributes=require(_0x22b1('0x6'));module[_0x22b1('0x7')]=function(_0x533254,_0x19f965){return _0x533254[_0x22b1('0x8')]('Schedule',attributes,{'tableName':_0x22b1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d2e=['bluebird','path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','util','../../config/logger','api'];(function(_0x35d073,_0xb2bde6){var _0x422e50=function(_0x156396){while(--_0x156396){_0x35d073['push'](_0x35d073['shift']());}};_0x422e50(++_0xb2bde6);}(_0x8d2e,0x152));var _0xe8d2=function(_0x569aff,_0x3c2404){_0x569aff=_0x569aff-0x0;var _0x3b86d2=_0x8d2e[_0x569aff];return _0x3b86d2;};'use strict';var _=require('lodash');var util=require(_0xe8d2('0x0'));var logger=require(_0xe8d2('0x1'))(_0xe8d2('0x2'));var moment=require('moment');var BPromise=require(_0xe8d2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe8d2('0x4'));var rimraf=require(_0xe8d2('0x5'));var config=require(_0xe8d2('0x6'));var attributes=require(_0xe8d2('0x7'));module[_0xe8d2('0x8')]=function(_0x3fc883,_0x5715f3){return _0x3fc883[_0xe8d2('0x9')](_0xe8d2('0xa'),attributes,{'tableName':'tools_schedules','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 be9c372..943a373 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 _0xf3d6=['Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','request','then','info'];(function(_0x5d9a28,_0x1bf0bf){var _0x1a0fcd=function(_0x44a228){while(--_0x44a228){_0x5d9a28['push'](_0x5d9a28['shift']());}};_0x1a0fcd(++_0x1bf0bf);}(_0xf3d6,0x10d));var _0x6f3d=function(_0x53c33c,_0x27223d){_0x53c33c=_0x53c33c-0x0;var _0x277750=_0xf3d6[_0x53c33c];return _0x277750;};'use strict';var _=require(_0x6f3d('0x0'));var util=require(_0x6f3d('0x1'));var moment=require(_0x6f3d('0x2'));var BPromise=require('bluebird');var rs=require(_0x6f3d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f3d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6f3d('0x5'))(_0x6f3d('0x6'));var config=require('../../config/environment');var jayson=require(_0x6f3d('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x26673d,_0x2b8a58,_0x37b155){return new BPromise(function(_0x298c83,_0x3195b2){return client[_0x6f3d('0x8')](_0x26673d,_0x37b155)[_0x6f3d('0x9')](function(_0xa6039c){logger[_0x6f3d('0xa')](_0x6f3d('0xb'),_0x2b8a58,_0x6f3d('0xc'));logger[_0x6f3d('0xd')](_0x6f3d('0xe'),_0x2b8a58,_0x6f3d('0xc'),JSON[_0x6f3d('0xf')](_0xa6039c));if(_0xa6039c[_0x6f3d('0x10')]){if(_0xa6039c[_0x6f3d('0x10')]['code']===0x1f4){logger[_0x6f3d('0x10')]('Schedule,\x20%s,\x20%s',_0x2b8a58,_0xa6039c[_0x6f3d('0x10')]['message']);return _0x3195b2(_0xa6039c[_0x6f3d('0x10')][_0x6f3d('0x11')]);}logger['error'](_0x6f3d('0xb'),_0x2b8a58,_0xa6039c[_0x6f3d('0x10')][_0x6f3d('0x11')]);return _0x298c83(_0xa6039c[_0x6f3d('0x10')][_0x6f3d('0x11')]);}else{logger[_0x6f3d('0xa')]('Schedule,\x20%s,\x20%s',_0x2b8a58,'request\x20sent');_0x298c83(_0xa6039c[_0x6f3d('0x12')][_0x6f3d('0x11')]);}})[_0x6f3d('0x13')](function(_0x414d63){logger[_0x6f3d('0x10')](_0x6f3d('0xb'),_0x2b8a58,_0x414d63);_0x3195b2(_0x414d63);});});} \ No newline at end of file +var _0x204a=['catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x204a,0x100));var _0xa204=function(_0x2c5922,_0x1a484e){_0x2c5922=_0x2c5922-0x0;var _0x426cde=_0x204a[_0x2c5922];return _0x426cde;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa204('0x0'));var BPromise=require(_0xa204('0x1'));var rs=require(_0xa204('0x2'));var fs=require('fs');var Redis=require(_0xa204('0x3'));var db=require(_0xa204('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa204('0x5'));var jayson=require(_0xa204('0x6'));var client=jayson[_0xa204('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3bd1aa,_0x3c6412,_0x3657cb){return new BPromise(function(_0x446f5c,_0x419df4){return client['request'](_0x3bd1aa,_0x3657cb)['then'](function(_0x18c861){logger[_0xa204('0x8')](_0xa204('0x9'),_0x3c6412,_0xa204('0xa'));logger['debug'](_0xa204('0xb'),_0x3c6412,_0xa204('0xa'),JSON['stringify'](_0x18c861));if(_0x18c861[_0xa204('0xc')]){if(_0x18c861[_0xa204('0xc')][_0xa204('0xd')]===0x1f4){logger['error'](_0xa204('0x9'),_0x3c6412,_0x18c861[_0xa204('0xc')][_0xa204('0xe')]);return _0x419df4(_0x18c861[_0xa204('0xc')][_0xa204('0xe')]);}logger[_0xa204('0xc')](_0xa204('0x9'),_0x3c6412,_0x18c861['error'][_0xa204('0xe')]);return _0x446f5c(_0x18c861[_0xa204('0xc')][_0xa204('0xe')]);}else{logger[_0xa204('0x8')](_0xa204('0x9'),_0x3c6412,_0xa204('0xa'));_0x446f5c(_0x18c861[_0xa204('0xf')]['message']);}})[_0xa204('0x10')](function(_0x4d8ee5){logger[_0xa204('0xc')](_0xa204('0x9'),_0x3c6412,_0x4d8ee5);_0x419df4(_0x4d8ee5);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 074f2ce..b12447a 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 _0x4b18=['./screenRecording.controller','get','index','/describe','isAuthenticated','describe','/:id','download','post','create','put','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x31b182,_0x1c4a17){var _0x17befd=function(_0x208f1b){while(--_0x208f1b){_0x31b182['push'](_0x31b182['shift']());}};_0x17befd(++_0x1c4a17);}(_0x4b18,0x115));var _0x84b1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4b18[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x84b1('0x0'));var util=require(_0x84b1('0x1'));var path=require(_0x84b1('0x2'));var timeout=require(_0x84b1('0x3'));var express=require('express');var router=express[_0x84b1('0x4')]();var fs_extra=require(_0x84b1('0x5'));var auth=require(_0x84b1('0x6'));var interaction=require(_0x84b1('0x7'));var config=require(_0x84b1('0x8'));var controller=require(_0x84b1('0x9'));router[_0x84b1('0xa')]('/',auth['isAuthenticated'](),controller[_0x84b1('0xb')]);router['get'](_0x84b1('0xc'),auth[_0x84b1('0xd')](),controller[_0x84b1('0xe')]);router['get'](_0x84b1('0xf'),auth[_0x84b1('0xd')](),controller['show']);router[_0x84b1('0xa')]('/:id/download',auth[_0x84b1('0xd')](),controller[_0x84b1('0x10')]);router[_0x84b1('0x11')]('/',auth['isAuthenticated'](),controller[_0x84b1('0x12')]);router[_0x84b1('0x13')](_0x84b1('0xf'),auth[_0x84b1('0xd')](),controller['update']);router[_0x84b1('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x84b1('0x15')]=router; \ No newline at end of file +var _0xe08b=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','/describe','/:id','isAuthenticated','show','/:id/download','download','create','put','delete'];(function(_0x2b0252,_0x3114b9){var _0x335ac4=function(_0x23871e){while(--_0x23871e){_0x2b0252['push'](_0x2b0252['shift']());}};_0x335ac4(++_0x3114b9);}(_0xe08b,0x1a6));var _0xbe08=function(_0x10dc60,_0x2fcce1){_0x10dc60=_0x10dc60-0x0;var _0x47dec5=_0xe08b[_0x10dc60];return _0x47dec5;};'use strict';var multer=require(_0xbe08('0x0'));var util=require(_0xbe08('0x1'));var path=require(_0xbe08('0x2'));var timeout=require(_0xbe08('0x3'));var express=require(_0xbe08('0x4'));var router=express['Router']();var fs_extra=require(_0xbe08('0x5'));var auth=require(_0xbe08('0x6'));var interaction=require(_0xbe08('0x7'));var config=require('../../config/environment');var controller=require(_0xbe08('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xbe08('0x9')](_0xbe08('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xbe08('0x9')](_0xbe08('0xb'),auth[_0xbe08('0xc')](),controller[_0xbe08('0xd')]);router[_0xbe08('0x9')](_0xbe08('0xe'),auth['isAuthenticated'](),controller[_0xbe08('0xf')]);router['post']('/',auth[_0xbe08('0xc')](),controller[_0xbe08('0x10')]);router[_0xbe08('0x11')](_0xbe08('0xb'),auth[_0xbe08('0xc')](),controller['update']);router[_0xbe08('0x12')](_0xbe08('0xb'),auth[_0xbe08('0xc')](),controller[_0xbe08('0x13')]);module[_0xbe08('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 e71602b..cd4a2b4 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 _0x038b=['value','extname','STRING','replace','INTEGER','startedAt','subtract','closedAt','setDataValue','duration','DATE','getDataValue','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','moment','path','../../config/environment','VIRTUAL'];(function(_0x20b2a3,_0x24f1b4){var _0x47ca0c=function(_0x542575){while(--_0x542575){_0x20b2a3['push'](_0x20b2a3['shift']());}};_0x47ca0c(++_0x24f1b4);}(_0x038b,0x114));var _0xb038=function(_0x412195,_0x446d28){_0x412195=_0x412195-0x0;var _0x2409de=_0x038b[_0x412195];return _0x2409de;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb038('0x0'));var path=require(_0xb038('0x1'));var config=require(_0xb038('0x2'));module['exports']={'format':{'type':Sequelize[_0xb038('0x3')],'get':function(){return this['getDataValue'](_0xb038('0x4'))?path[_0xb038('0x5')](this['getDataValue'](_0xb038('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0xb038('0x6')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x2e3e64){var _0x1b077a=_0x2e3e64[_0xb038('0x7')](/\\/g,'/');this['setDataValue']('value',_0x1b077a);}},'rating':{'type':Sequelize[_0xb038('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xb038('0x8')],'set':function(_0x4d85b4){this['setDataValue'](_0xb038('0x9'),moment()[_0xb038('0xa')](_0x4d85b4,'ms'));this['setDataValue'](_0xb038('0xb'),moment());this[_0xb038('0xc')](_0xb038('0xd'),_0x4d85b4);}},'startedAt':{'type':Sequelize[_0xb038('0xe')],'get':function(){return moment(this[_0xb038('0xf')](_0xb038('0x9')))[_0xb038('0x10')](_0xb038('0x11'))[_0xb038('0x12')]();}},'closedAt':{'type':Sequelize[_0xb038('0xe')],'get':function(){return moment(this[_0xb038('0xf')](_0xb038('0xb')))[_0xb038('0x10')](_0xb038('0x11'))[_0xb038('0x12')]();}},'createdAt':{'type':Sequelize[_0xb038('0xe')],'get':function(){return moment(this[_0xb038('0xf')]('createdAt'))[_0xb038('0x10')](_0xb038('0x11'))[_0xb038('0x12')]();}},'updatedAt':{'type':Sequelize[_0xb038('0xe')],'get':function(){return moment(this[_0xb038('0xf')](_0xb038('0x13')))['format'](_0xb038('0x11'))[_0xb038('0x12')]();}}}; \ No newline at end of file +var _0xb458=['STRING','replace','setDataValue','INTEGER','startedAt','closedAt','format','MM-DD-YYYY\x20HH:mm','DATE','toString','createdAt','updatedAt','sequelize','moment','path','VIRTUAL','getDataValue','value','extname'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xb458,0x103));var _0x8b45=function(_0x44029c,_0x426690){_0x44029c=_0x44029c-0x0;var _0x547fa1=_0xb458[_0x44029c];return _0x547fa1;};'use strict';var Sequelize=require(_0x8b45('0x0'));var moment=require(_0x8b45('0x1'));var path=require(_0x8b45('0x2'));var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0x8b45('0x3')],'get':function(){return this[_0x8b45('0x4')](_0x8b45('0x5'))?path[_0x8b45('0x6')](this['getDataValue'](_0x8b45('0x5'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x8b45('0x7')],'set':function(_0x12bd05){var _0x2daa9a=_0x12bd05[_0x8b45('0x8')](/\\/g,'/');this[_0x8b45('0x9')]('value',_0x2daa9a);}},'rating':{'type':Sequelize[_0x8b45('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x8b45('0xa')],'set':function(_0x33f30e){this[_0x8b45('0x9')](_0x8b45('0xb'),moment()['subtract'](_0x33f30e,'ms'));this[_0x8b45('0x9')](_0x8b45('0xc'),moment());this['setDataValue']('duration',_0x33f30e);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x8b45('0xb')))[_0x8b45('0xd')](_0x8b45('0xe'))['toString']();}},'closedAt':{'type':Sequelize[_0x8b45('0xf')],'get':function(){return moment(this[_0x8b45('0x4')](_0x8b45('0xc')))[_0x8b45('0xd')](_0x8b45('0xe'))[_0x8b45('0x10')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x8b45('0x11')))[_0x8b45('0xd')](_0x8b45('0xe'))[_0x8b45('0x10')]();}},'updatedAt':{'type':Sequelize[_0x8b45('0xf')],'get':function(){return moment(this[_0x8b45('0x4')](_0x8b45('0x12')))[_0x8b45('0xd')](_0x8b45('0xe'))[_0x8b45('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 2a58da7..e6d6dea 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 _0x70e0=['count','offset','limit','Content-Range','json','apply','then','destroy','end','sendStatus','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','format','keys','query','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','catch','show','params','find','create','body','update','duration','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','recording','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0xec3cf6,_0x4007ad){var _0x1bde38=function(_0x45f9ab){while(--_0x45f9ab){_0xec3cf6['push'](_0xec3cf6['shift']());}};_0x1bde38(++_0x4007ad);}(_0x70e0,0x17b));var _0x070e=function(_0x129d1f,_0x67d264){_0x129d1f=_0x129d1f-0x0;var _0x1fde6e=_0x70e0[_0x129d1f];return _0x1fde6e;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x070e('0x9'));var crypto=require(_0x070e('0xa'));var jsforce=require(_0x070e('0xb'));var deskjs=require(_0x070e('0xc'));var toCsv=require(_0x070e('0x8'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x070e('0xf'));var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x5bf079,_0x2930b8){_0x2930b8=_0x2930b8||0xcc;return function(_0x52da3b){if(_0x52da3b){return _0x5bf079['sendStatus'](_0x2930b8);}return _0x5bf079[_0x070e('0x18')](_0x2930b8)['end']();};}function respondWithResult(_0x4a33d2,_0x5bae0f){_0x5bae0f=_0x5bae0f||0xc8;return function(_0x11d2ce){if(_0x11d2ce){return _0x4a33d2[_0x070e('0x18')](_0x5bae0f)['json'](_0x11d2ce);}};}function respondWithFilteredResult(_0x5d3a38,_0x373d86){return function(_0xeae1a5){if(_0xeae1a5){var _0x180897=_0xeae1a5[_0x070e('0x19')],_0x19d9da=_0x373d86[_0x070e('0x1a')],_0x5bc71e=_0x373d86[_0x070e('0x1a')]+_0x373d86[_0x070e('0x1b')],_0x49861b;if(_0x5bc71e>=_0x180897){_0x5bc71e=_0x180897;_0x49861b=0xc8;}else{_0x49861b=0xce;}_0x5d3a38[_0x070e('0x18')](_0x49861b);return _0x5d3a38['set'](_0x070e('0x1c'),_0x19d9da+'-'+_0x5bc71e+'/'+_0x180897)[_0x070e('0x1d')](_0xeae1a5);}return null;};}function patchUpdates(_0x1ad3de){return function(_0x3ea105){try{jsonpatch[_0x070e('0x1e')](_0x3ea105,_0x1ad3de,!![]);}catch(_0x5c16fd){return BPromise['reject'](_0x5c16fd);}return _0x3ea105['save']();};}function saveUpdates(_0x9907cf,_0x3004f0){return function(_0x20dc60){if(_0x20dc60){return _0x20dc60['update'](_0x9907cf)[_0x070e('0x1f')](function(_0x5dc5d2){return _0x5dc5d2;});}return null;};}function removeEntity(_0xf8dd5d,_0x3f6985){return function(_0x27a01e){if(_0x27a01e){return _0x27a01e[_0x070e('0x20')]()[_0x070e('0x1f')](function(){_0xf8dd5d[_0x070e('0x18')](0xcc)[_0x070e('0x21')]();});}};}function handleEntityNotFound(_0x164cdf,_0x595c7e){return function(_0x2f8055){if(!_0x2f8055){_0x164cdf[_0x070e('0x22')](0x194);}return _0x2f8055;};}function handleError(_0x4790eb,_0x503f4d){_0x503f4d=_0x503f4d||0x1f4;return function(_0xf17c56){logger['error'](_0xf17c56['stack']);if(_0xf17c56[_0x070e('0x23')]){delete _0xf17c56[_0x070e('0x23')];}_0x4790eb[_0x070e('0x18')](_0x503f4d)[_0x070e('0x24')](_0xf17c56);};}exports[_0x070e('0x25')]=function(_0x497f58,_0x374c54){var _0x219e48={},_0x1d72d6={},_0x1d2a34={'count':0x0,'rows':[]};var _0x43dd96=_[_0x070e('0x26')](db[_0x070e('0x27')][_0x070e('0x28')],function(_0x5e8326){return{'name':_0x5e8326[_0x070e('0x29')],'type':_0x5e8326[_0x070e('0x2a')][_0x070e('0x2b')]};});_0x1d72d6['model']=_['differenceBy'](_[_0x070e('0x26')](_0x43dd96,_0x070e('0x23')),[_0x070e('0x2c')]);_0x1d72d6['query']=_[_0x070e('0x2d')](_0x497f58[_0x070e('0x2e')]);_0x1d72d6[_0x070e('0x2f')]=_[_0x070e('0x30')](_0x1d72d6['model'],_0x1d72d6['query']);_0x219e48['attributes']=_['intersection'](_0x1d72d6[_0x070e('0x31')],qs['fields'](_0x497f58[_0x070e('0x2e')][_0x070e('0x32')]));_0x219e48['attributes']=_0x219e48['attributes'][_0x070e('0x33')]?_0x219e48[_0x070e('0x34')]:_0x1d72d6['model'];if(!_0x497f58['query'][_0x070e('0x35')](_0x070e('0x36'))){_0x219e48[_0x070e('0x1b')]=qs[_0x070e('0x1b')](_0x497f58[_0x070e('0x2e')]['limit']);_0x219e48['offset']=qs[_0x070e('0x1a')](_0x497f58[_0x070e('0x2e')][_0x070e('0x1a')]);}_0x219e48[_0x070e('0x37')]=qs[_0x070e('0x38')](_0x497f58['query'][_0x070e('0x38')]);_0x219e48[_0x070e('0x39')]=qs['filters'](_[_0x070e('0x3a')](_0x497f58[_0x070e('0x2e')],_0x1d72d6['filters']),_0x43dd96);if(_0x497f58['query']['filter']){_0x219e48[_0x070e('0x39')]=_[_0x070e('0x3b')](_0x219e48[_0x070e('0x39')],{'$or':_[_0x070e('0x26')](_0x43dd96,function(_0x33c5f8){if(_0x33c5f8['type']!==_0x070e('0x3c')){var _0xa1bb20={};_0xa1bb20[_0x33c5f8[_0x070e('0x23')]]={'$like':'%'+_0x497f58['query'][_0x070e('0x3d')]+'%'};return _0xa1bb20;}})});}_0x219e48=_[_0x070e('0x3b')]({},_0x219e48,_0x497f58[_0x070e('0x3e')]);var _0x54b72f={'where':_0x219e48[_0x070e('0x39')]};return db[_0x070e('0x27')]['count'](_0x54b72f)[_0x070e('0x1f')](function(_0x5d689b){_0x1d2a34[_0x070e('0x19')]=_0x5d689b;if(_0x497f58[_0x070e('0x2e')][_0x070e('0x3f')]){_0x219e48[_0x070e('0x40')]=[{'all':!![]}];}return db[_0x070e('0x27')]['findAll'](_0x219e48);})[_0x070e('0x1f')](function(_0x5db2ce){_0x1d2a34['rows']=_0x5db2ce;return _0x1d2a34;})[_0x070e('0x1f')](respondWithFilteredResult(_0x374c54,_0x219e48))[_0x070e('0x41')](handleError(_0x374c54,null));};exports[_0x070e('0x42')]=function(_0x4d52ff,_0x2ad56c){var _0x1223be={'raw':![],'where':{'id':_0x4d52ff[_0x070e('0x43')]['id']}},_0x556bf3={};_0x556bf3['model']=_[_0x070e('0x2d')](db['ScreenRecording']['rawAttributes']);_0x556bf3['query']=_[_0x070e('0x2d')](_0x4d52ff[_0x070e('0x2e')]);_0x556bf3[_0x070e('0x2f')]=_[_0x070e('0x30')](_0x556bf3[_0x070e('0x31')],_0x556bf3['query']);_0x1223be[_0x070e('0x34')]=_['intersection'](_0x556bf3[_0x070e('0x31')],qs[_0x070e('0x32')](_0x4d52ff[_0x070e('0x2e')]['fields']));_0x1223be['attributes']=_0x1223be[_0x070e('0x34')]['length']?_0x1223be[_0x070e('0x34')]:_0x556bf3[_0x070e('0x31')];if(_0x4d52ff[_0x070e('0x2e')]['includeAll']){_0x1223be[_0x070e('0x40')]=[{'all':!![]}];}_0x1223be=_[_0x070e('0x3b')]({},_0x1223be,_0x4d52ff['options']);return db['ScreenRecording'][_0x070e('0x44')](_0x1223be)[_0x070e('0x1f')](handleEntityNotFound(_0x2ad56c,null))[_0x070e('0x1f')](respondWithResult(_0x2ad56c,null))[_0x070e('0x41')](handleError(_0x2ad56c,null));};exports[_0x070e('0x45')]=function(_0x5500d0,_0x20b80e){return db[_0x070e('0x27')][_0x070e('0x45')](_0x5500d0[_0x070e('0x46')],{})[_0x070e('0x1f')](respondWithResult(_0x20b80e,0xc9))[_0x070e('0x41')](handleError(_0x20b80e,null));};exports[_0x070e('0x47')]=function(_0x1b5374,_0xd67987){if(_0x1b5374[_0x070e('0x46')]['id']){delete _0x1b5374[_0x070e('0x46')]['id'];}delete _0x1b5374[_0x070e('0x46')][_0x070e('0x48')];delete _0x1b5374[_0x070e('0x46')][_0x070e('0x49')];delete _0x1b5374['body'][_0x070e('0x4a')];delete _0x1b5374[_0x070e('0x46')][_0x070e('0x4b')];return db[_0x070e('0x27')][_0x070e('0x44')]({'where':{'id':_0x1b5374[_0x070e('0x43')]['id']}})[_0x070e('0x1f')](handleEntityNotFound(_0xd67987,null))[_0x070e('0x1f')](saveUpdates(_0x1b5374[_0x070e('0x46')],null))['then'](respondWithResult(_0xd67987,null))[_0x070e('0x41')](handleError(_0xd67987,null));};exports['describe']=function(_0x1acddb,_0x2be643){return db['ScreenRecording'][_0x070e('0x4c')]()[_0x070e('0x1f')](respondWithResult(_0x2be643,null))[_0x070e('0x41')](handleError(_0x2be643,null));};exports[_0x070e('0x4d')]=function(_0x2b8e51,_0x1e8a4f,_0x83f21e){var _0x5694fa=require(_0x070e('0x4e'));var _0x5bacbd=![];var _0x516161={};if(_0x2b8e51[_0x070e('0x2e')][_0x070e('0x2a')]&&_0x2b8e51[_0x070e('0x2e')][_0x070e('0x2a')]===_0x070e('0x4f')){_0x516161[_0x070e('0x4f')]=_0x2b8e51[_0x070e('0x43')]['id'];}else{_0x516161['id']=_0x2b8e51[_0x070e('0x43')]['id'];}return db['ScreenRecording'][_0x070e('0x44')]({'where':_0x516161,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x1e8a4f,null))[_0x070e('0x1f')](function(_0x20acc6){if(_0x20acc6){var _0x589aee=path[_0x070e('0x50')](config[_0x070e('0x51')],_0x070e('0x52'),_0x20acc6[_0x070e('0x4b')]);var _0x1aacfc=util[_0x070e('0x2c')](_0x070e('0x53'),_0x589aee);if(fs['existsSync'](_0x1aacfc)){_0x5bacbd=!![];return _0x5694fa['decryptFile'](_0x1aacfc,_0x589aee,config['secrets'][_0x070e('0x54')])[_0x070e('0x1f')](function(){return _0x20acc6;});}return _0x20acc6;}})[_0x070e('0x1f')](function(_0x2f8fcb){if(_0x2f8fcb){var _0x5ac0b5=path[_0x070e('0x50')](config['root'],_0x070e('0x52'),_0x2f8fcb[_0x070e('0x4b')]);if(!fs[_0x070e('0x55')](_0x5ac0b5)){throw new db[(_0x070e('0x56'))][(_0x070e('0x57'))](_0x070e('0x58'));}if(_0x2f8fcb['filename']){return _0x1e8a4f[_0x070e('0x4d')](_0x5ac0b5,_0x2f8fcb[_0x070e('0x59')]+path[_0x070e('0x5a')](_0x5ac0b5),function(){if(_0x5bacbd){fs['unlink'](_0x5ac0b5);}});}else{return _0x1e8a4f[_0x070e('0x4d')](_0x5ac0b5,function(_0x1da803){if(_0x5bacbd){fs['unlink'](_0x5ac0b5);}});}}})[_0x070e('0x41')](function(_0x4e8dfc){if(_0x4e8dfc[_0x070e('0x5b')]==='ScreenRecording\x20not\x20found'){_0x1e8a4f['status'](0x194)['send'](_0x070e('0x5c'));}else{return handleError(_0x1e8a4f,null);}});};exports[_0x070e('0x20')]=function(_0x1100d8,_0x122198){return db[_0x070e('0x27')][_0x070e('0x44')]({'where':{'id':_0x1100d8['params']['id']}})[_0x070e('0x1f')](function(_0x54d4f9){if(!_0x54d4f9)throw new ReferenceError(_0x070e('0x5d'));return _0x54d4f9;})['then'](function(_0x2e10f7){var _0x34f410=path['join'](config[_0x070e('0x51')],'server/files/screen_recordings',_0x2e10f7[_0x070e('0x4b')]);logger[_0x070e('0x5e')](_0x070e('0x5f'),_0x34f410);if(!_[_0x070e('0x60')](_0x2e10f7[_0x070e('0x4b')])&&fs[_0x070e('0x55')](_0x34f410)){logger[_0x070e('0x5e')](_0x070e('0x61')+_0x34f410+_0x070e('0x62'));fs[_0x070e('0x63')](_0x34f410);}_0x34f410=_0x34f410+_0x070e('0x64');if(!_[_0x070e('0x60')](_0x2e10f7[_0x070e('0x4b')])&&fs[_0x070e('0x55')](_0x34f410)){logger['info'](_0x070e('0x61')+_0x34f410+_0x070e('0x62'));fs[_0x070e('0x63')](_0x34f410);}return _0x2e10f7;})[_0x070e('0x1f')](function(_0x5712d1){if(!_0x5712d1)throw new InternalError();return _0x5712d1[_0x070e('0x20')]();})[_0x070e('0x1f')](function(){_0x122198[_0x070e('0x18')](0xcc)[_0x070e('0x21')]();})[_0x070e('0x41')](handleError(_0x122198,null));}; \ No newline at end of file +var _0x70e0=['count','offset','limit','Content-Range','json','apply','then','destroy','end','sendStatus','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','format','keys','query','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','catch','show','params','find','create','body','update','duration','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','recording','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x14f051,_0x85870b){var _0x3f59ee=function(_0xc8785a){while(--_0xc8785a){_0x14f051['push'](_0x14f051['shift']());}};_0x3f59ee(++_0x85870b);}(_0x70e0,0x17b));var _0x070e=function(_0x3e16d5,_0x17af0e){_0x3e16d5=_0x3e16d5-0x0;var _0x4586e4=_0x70e0[_0x3e16d5];return _0x4586e4;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x070e('0x9'));var crypto=require(_0x070e('0xa'));var jsforce=require(_0x070e('0xb'));var deskjs=require(_0x070e('0xc'));var toCsv=require(_0x070e('0x8'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x070e('0xf'));var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x5bf079,_0x2930b8){_0x2930b8=_0x2930b8||0xcc;return function(_0x52da3b){if(_0x52da3b){return _0x5bf079['sendStatus'](_0x2930b8);}return _0x5bf079[_0x070e('0x18')](_0x2930b8)['end']();};}function respondWithResult(_0x4a33d2,_0x5bae0f){_0x5bae0f=_0x5bae0f||0xc8;return function(_0x11d2ce){if(_0x11d2ce){return _0x4a33d2[_0x070e('0x18')](_0x5bae0f)['json'](_0x11d2ce);}};}function respondWithFilteredResult(_0x5d3a38,_0x373d86){return function(_0xeae1a5){if(_0xeae1a5){var _0x180897=_0xeae1a5[_0x070e('0x19')],_0x19d9da=_0x373d86[_0x070e('0x1a')],_0x5bc71e=_0x373d86[_0x070e('0x1a')]+_0x373d86[_0x070e('0x1b')],_0x49861b;if(_0x5bc71e>=_0x180897){_0x5bc71e=_0x180897;_0x49861b=0xc8;}else{_0x49861b=0xce;}_0x5d3a38[_0x070e('0x18')](_0x49861b);return _0x5d3a38['set'](_0x070e('0x1c'),_0x19d9da+'-'+_0x5bc71e+'/'+_0x180897)[_0x070e('0x1d')](_0xeae1a5);}return null;};}function patchUpdates(_0x1ad3de){return function(_0x3ea105){try{jsonpatch[_0x070e('0x1e')](_0x3ea105,_0x1ad3de,!![]);}catch(_0x5c16fd){return BPromise['reject'](_0x5c16fd);}return _0x3ea105['save']();};}function saveUpdates(_0x9907cf,_0x3004f0){return function(_0x20dc60){if(_0x20dc60){return _0x20dc60['update'](_0x9907cf)[_0x070e('0x1f')](function(_0x5dc5d2){return _0x5dc5d2;});}return null;};}function removeEntity(_0xf8dd5d,_0x3f6985){return function(_0x27a01e){if(_0x27a01e){return _0x27a01e[_0x070e('0x20')]()[_0x070e('0x1f')](function(){_0xf8dd5d[_0x070e('0x18')](0xcc)[_0x070e('0x21')]();});}};}function handleEntityNotFound(_0x164cdf,_0x595c7e){return function(_0x2f8055){if(!_0x2f8055){_0x164cdf[_0x070e('0x22')](0x194);}return _0x2f8055;};}function handleError(_0x4790eb,_0x503f4d){_0x503f4d=_0x503f4d||0x1f4;return function(_0xf17c56){logger['error'](_0xf17c56['stack']);if(_0xf17c56[_0x070e('0x23')]){delete _0xf17c56[_0x070e('0x23')];}_0x4790eb[_0x070e('0x18')](_0x503f4d)[_0x070e('0x24')](_0xf17c56);};}exports[_0x070e('0x25')]=function(_0x497f58,_0x374c54){var _0x219e48={},_0x1d72d6={},_0x1d2a34={'count':0x0,'rows':[]};var _0x43dd96=_[_0x070e('0x26')](db[_0x070e('0x27')][_0x070e('0x28')],function(_0x5e8326){return{'name':_0x5e8326[_0x070e('0x29')],'type':_0x5e8326[_0x070e('0x2a')][_0x070e('0x2b')]};});_0x1d72d6['model']=_['differenceBy'](_[_0x070e('0x26')](_0x43dd96,_0x070e('0x23')),[_0x070e('0x2c')]);_0x1d72d6['query']=_[_0x070e('0x2d')](_0x497f58[_0x070e('0x2e')]);_0x1d72d6[_0x070e('0x2f')]=_[_0x070e('0x30')](_0x1d72d6['model'],_0x1d72d6['query']);_0x219e48['attributes']=_['intersection'](_0x1d72d6[_0x070e('0x31')],qs['fields'](_0x497f58[_0x070e('0x2e')][_0x070e('0x32')]));_0x219e48['attributes']=_0x219e48['attributes'][_0x070e('0x33')]?_0x219e48[_0x070e('0x34')]:_0x1d72d6['model'];if(!_0x497f58['query'][_0x070e('0x35')](_0x070e('0x36'))){_0x219e48[_0x070e('0x1b')]=qs[_0x070e('0x1b')](_0x497f58[_0x070e('0x2e')]['limit']);_0x219e48['offset']=qs[_0x070e('0x1a')](_0x497f58[_0x070e('0x2e')][_0x070e('0x1a')]);}_0x219e48[_0x070e('0x37')]=qs[_0x070e('0x38')](_0x497f58['query'][_0x070e('0x38')]);_0x219e48[_0x070e('0x39')]=qs['filters'](_[_0x070e('0x3a')](_0x497f58[_0x070e('0x2e')],_0x1d72d6['filters']),_0x43dd96);if(_0x497f58['query']['filter']){_0x219e48[_0x070e('0x39')]=_[_0x070e('0x3b')](_0x219e48[_0x070e('0x39')],{'$or':_[_0x070e('0x26')](_0x43dd96,function(_0x33c5f8){if(_0x33c5f8['type']!==_0x070e('0x3c')){var _0xa1bb20={};_0xa1bb20[_0x33c5f8[_0x070e('0x23')]]={'$like':'%'+_0x497f58['query'][_0x070e('0x3d')]+'%'};return _0xa1bb20;}})});}_0x219e48=_[_0x070e('0x3b')]({},_0x219e48,_0x497f58[_0x070e('0x3e')]);var _0x54b72f={'where':_0x219e48[_0x070e('0x39')]};return db[_0x070e('0x27')]['count'](_0x54b72f)[_0x070e('0x1f')](function(_0x5d689b){_0x1d2a34[_0x070e('0x19')]=_0x5d689b;if(_0x497f58[_0x070e('0x2e')][_0x070e('0x3f')]){_0x219e48[_0x070e('0x40')]=[{'all':!![]}];}return db[_0x070e('0x27')]['findAll'](_0x219e48);})[_0x070e('0x1f')](function(_0x5db2ce){_0x1d2a34['rows']=_0x5db2ce;return _0x1d2a34;})[_0x070e('0x1f')](respondWithFilteredResult(_0x374c54,_0x219e48))[_0x070e('0x41')](handleError(_0x374c54,null));};exports[_0x070e('0x42')]=function(_0x4d52ff,_0x2ad56c){var _0x1223be={'raw':![],'where':{'id':_0x4d52ff[_0x070e('0x43')]['id']}},_0x556bf3={};_0x556bf3['model']=_[_0x070e('0x2d')](db['ScreenRecording']['rawAttributes']);_0x556bf3['query']=_[_0x070e('0x2d')](_0x4d52ff[_0x070e('0x2e')]);_0x556bf3[_0x070e('0x2f')]=_[_0x070e('0x30')](_0x556bf3[_0x070e('0x31')],_0x556bf3['query']);_0x1223be[_0x070e('0x34')]=_['intersection'](_0x556bf3[_0x070e('0x31')],qs[_0x070e('0x32')](_0x4d52ff[_0x070e('0x2e')]['fields']));_0x1223be['attributes']=_0x1223be[_0x070e('0x34')]['length']?_0x1223be[_0x070e('0x34')]:_0x556bf3[_0x070e('0x31')];if(_0x4d52ff[_0x070e('0x2e')]['includeAll']){_0x1223be[_0x070e('0x40')]=[{'all':!![]}];}_0x1223be=_[_0x070e('0x3b')]({},_0x1223be,_0x4d52ff['options']);return db['ScreenRecording'][_0x070e('0x44')](_0x1223be)[_0x070e('0x1f')](handleEntityNotFound(_0x2ad56c,null))[_0x070e('0x1f')](respondWithResult(_0x2ad56c,null))[_0x070e('0x41')](handleError(_0x2ad56c,null));};exports[_0x070e('0x45')]=function(_0x5500d0,_0x20b80e){return db[_0x070e('0x27')][_0x070e('0x45')](_0x5500d0[_0x070e('0x46')],{})[_0x070e('0x1f')](respondWithResult(_0x20b80e,0xc9))[_0x070e('0x41')](handleError(_0x20b80e,null));};exports[_0x070e('0x47')]=function(_0x1b5374,_0xd67987){if(_0x1b5374[_0x070e('0x46')]['id']){delete _0x1b5374[_0x070e('0x46')]['id'];}delete _0x1b5374[_0x070e('0x46')][_0x070e('0x48')];delete _0x1b5374[_0x070e('0x46')][_0x070e('0x49')];delete _0x1b5374['body'][_0x070e('0x4a')];delete _0x1b5374[_0x070e('0x46')][_0x070e('0x4b')];return db[_0x070e('0x27')][_0x070e('0x44')]({'where':{'id':_0x1b5374[_0x070e('0x43')]['id']}})[_0x070e('0x1f')](handleEntityNotFound(_0xd67987,null))[_0x070e('0x1f')](saveUpdates(_0x1b5374[_0x070e('0x46')],null))['then'](respondWithResult(_0xd67987,null))[_0x070e('0x41')](handleError(_0xd67987,null));};exports['describe']=function(_0x1acddb,_0x2be643){return db['ScreenRecording'][_0x070e('0x4c')]()[_0x070e('0x1f')](respondWithResult(_0x2be643,null))[_0x070e('0x41')](handleError(_0x2be643,null));};exports[_0x070e('0x4d')]=function(_0x2b8e51,_0x1e8a4f,_0x83f21e){var _0x5694fa=require(_0x070e('0x4e'));var _0x5bacbd=![];var _0x516161={};if(_0x2b8e51[_0x070e('0x2e')][_0x070e('0x2a')]&&_0x2b8e51[_0x070e('0x2e')][_0x070e('0x2a')]===_0x070e('0x4f')){_0x516161[_0x070e('0x4f')]=_0x2b8e51[_0x070e('0x43')]['id'];}else{_0x516161['id']=_0x2b8e51[_0x070e('0x43')]['id'];}return db['ScreenRecording'][_0x070e('0x44')]({'where':_0x516161,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x1e8a4f,null))[_0x070e('0x1f')](function(_0x20acc6){if(_0x20acc6){var _0x589aee=path[_0x070e('0x50')](config[_0x070e('0x51')],_0x070e('0x52'),_0x20acc6[_0x070e('0x4b')]);var _0x1aacfc=util[_0x070e('0x2c')](_0x070e('0x53'),_0x589aee);if(fs['existsSync'](_0x1aacfc)){_0x5bacbd=!![];return _0x5694fa['decryptFile'](_0x1aacfc,_0x589aee,config['secrets'][_0x070e('0x54')])[_0x070e('0x1f')](function(){return _0x20acc6;});}return _0x20acc6;}})[_0x070e('0x1f')](function(_0x2f8fcb){if(_0x2f8fcb){var _0x5ac0b5=path[_0x070e('0x50')](config['root'],_0x070e('0x52'),_0x2f8fcb[_0x070e('0x4b')]);if(!fs[_0x070e('0x55')](_0x5ac0b5)){throw new db[(_0x070e('0x56'))][(_0x070e('0x57'))](_0x070e('0x58'));}if(_0x2f8fcb['filename']){return _0x1e8a4f[_0x070e('0x4d')](_0x5ac0b5,_0x2f8fcb[_0x070e('0x59')]+path[_0x070e('0x5a')](_0x5ac0b5),function(){if(_0x5bacbd){fs['unlink'](_0x5ac0b5);}});}else{return _0x1e8a4f[_0x070e('0x4d')](_0x5ac0b5,function(_0x1da803){if(_0x5bacbd){fs['unlink'](_0x5ac0b5);}});}}})[_0x070e('0x41')](function(_0x4e8dfc){if(_0x4e8dfc[_0x070e('0x5b')]==='ScreenRecording\x20not\x20found'){_0x1e8a4f['status'](0x194)['send'](_0x070e('0x5c'));}else{return handleError(_0x1e8a4f,null);}});};exports[_0x070e('0x20')]=function(_0x1100d8,_0x122198){return db[_0x070e('0x27')][_0x070e('0x44')]({'where':{'id':_0x1100d8['params']['id']}})[_0x070e('0x1f')](function(_0x54d4f9){if(!_0x54d4f9)throw new ReferenceError(_0x070e('0x5d'));return _0x54d4f9;})['then'](function(_0x2e10f7){var _0x34f410=path['join'](config[_0x070e('0x51')],'server/files/screen_recordings',_0x2e10f7[_0x070e('0x4b')]);logger[_0x070e('0x5e')](_0x070e('0x5f'),_0x34f410);if(!_[_0x070e('0x60')](_0x2e10f7[_0x070e('0x4b')])&&fs[_0x070e('0x55')](_0x34f410)){logger[_0x070e('0x5e')](_0x070e('0x61')+_0x34f410+_0x070e('0x62'));fs[_0x070e('0x63')](_0x34f410);}_0x34f410=_0x34f410+_0x070e('0x64');if(!_[_0x070e('0x60')](_0x2e10f7[_0x070e('0x4b')])&&fs[_0x070e('0x55')](_0x34f410)){logger['info'](_0x070e('0x61')+_0x34f410+_0x070e('0x62'));fs[_0x070e('0x63')](_0x34f410);}return _0x2e10f7;})[_0x070e('0x1f')](function(_0x5712d1){if(!_0x5712d1)throw new InternalError();return _0x5712d1[_0x070e('0x20')]();})[_0x070e('0x1f')](function(){_0x122198[_0x070e('0x18')](0xcc)[_0x070e('0x21')]();})[_0x070e('0x41')](handleError(_0x122198,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 13d476e..98ec1fe 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 _0xe28e=['../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0xe28e,0x14b));var _0xee28=function(_0x3ea933,_0x25be47){_0x3ea933=_0x3ea933-0x0;var _0x437ceb=_0xe28e[_0x3ea933];return _0x437ceb;};'use strict';var _=require(_0xee28('0x0'));var util=require(_0xee28('0x1'));var logger=require(_0xee28('0x2'))(_0xee28('0x3'));var moment=require(_0xee28('0x4'));var BPromise=require(_0xee28('0x5'));var rp=require(_0xee28('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xee28('0x7'));var attributes=require(_0xee28('0x8'));module[_0xee28('0x9')]=function(_0x3054f9,_0x4e2574){return _0x3054f9[_0xee28('0xa')](_0xee28('0xb'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0xee28('0xc'),'fields':[_0xee28('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5e13=['exports','define','ScreenRecording','interactionid','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x20efab,_0x34fa6f){var _0x52b8f1=function(_0x43fccb){while(--_0x43fccb){_0x20efab['push'](_0x20efab['shift']());}};_0x52b8f1(++_0x34fa6f);}(_0x5e13,0x1d2));var _0x35e1=function(_0x411bd1,_0x416106){_0x411bd1=_0x411bd1-0x0;var _0x320464=_0x5e13[_0x411bd1];return _0x320464;};'use strict';var _=require(_0x35e1('0x0'));var util=require(_0x35e1('0x1'));var logger=require(_0x35e1('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x35e1('0x3'));var fs=require('fs');var path=require(_0x35e1('0x4'));var rimraf=require(_0x35e1('0x5'));var config=require(_0x35e1('0x6'));var attributes=require('./screenRecording.attributes');module[_0x35e1('0x7')]=function(_0xc8ac89,_0x52f3fc){return _0xc8ac89[_0x35e1('0x8')](_0x35e1('0x9'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x35e1('0xa'),'fields':[_0x35e1('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index f023eb2..3019f2b 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 _0xa9e0=['http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\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(_0x2aed2e,_0x30b555){var _0x26861b=function(_0x32b62d){while(--_0x32b62d){_0x2aed2e['push'](_0x2aed2e['shift']());}};_0x26861b(++_0x30b555);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\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(_0x240eae,_0x374ebd){var _0x59b493=function(_0x45a7cc){while(--_0x45a7cc){_0x240eae['push'](_0x240eae['shift']());}};_0x59b493(++_0x374ebd);}(_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 diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 02daa9f..11b8923 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 _0xa9e0=['addFavicon','put','isAuthenticated','update','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','originalname','post','single','addLogo','logologin','extname','file','addLogoLogin','preferred','addPreferred','%s%s','favicon'];(function(_0x4a62bb,_0x3bf277){var _0x2d1adc=function(_0xe1a4d){while(--_0xe1a4d){_0x4a62bb['push'](_0x4a62bb['shift']());}};_0x2d1adc(++_0x3bf277);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),controller['getDate']);router['get'](_0x0a9e('0xb'),controller['show']);router['get'](_0x0a9e('0xc'),controller[_0x0a9e('0xd')]);router[_0x0a9e('0x8')](_0x0a9e('0xe'),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x8')]('/:id/gdpr',controller['gdpr']);router['get']('/:id/preferred',controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),controller[_0x0a9e('0x12')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x69aeb7,_0x5db4b0,_0x4283ce){_0x4283ce(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x44dcfd,_0x4d5611,_0x52a03d){_0x52a03d(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x18'),path['extname'](_0x4d5611[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/logo',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x1c')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x106033,_0x205fd6,_0x31b1ca){_0x31b1ca(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x1314ae,_0x112016,_0x1c696a){_0x1c696a(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x1d'),path[_0x0a9e('0x1e')](_0x112016['originalname'])));}})});router[_0x0a9e('0x1a')]('/:id/logo_login',upload['single'](_0x0a9e('0x1f')),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x30bae6,_0x4abc77,_0xfb6e48){_0xfb6e48(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x370d86,_0x42ac8f,_0x16b1ca){_0x16b1ca(null,util['format']('%s%s',_0x0a9e('0x21'),path[_0x0a9e('0x1e')](_0x42ac8f[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/preferred',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1dc186,_0x34dc65,_0x25fba9){_0x25fba9(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x11c3b6,_0x14de77,_0x5a101a){_0x5a101a(null,util[_0x0a9e('0x17')](_0x0a9e('0x23'),_0x0a9e('0x24'),path[_0x0a9e('0x1e')](_0x14de77['originalname'])));}})});router[_0x0a9e('0x1a')](_0x0a9e('0x11'),upload[_0x0a9e('0x1b')](_0x0a9e('0x1f')),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x26')](_0x0a9e('0xb'),auth[_0x0a9e('0x27')](),controller[_0x0a9e('0x28')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['addFavicon','put','isAuthenticated','update','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','originalname','post','single','addLogo','logologin','extname','file','addLogoLogin','preferred','addPreferred','%s%s','favicon'];(function(_0x4fde1b,_0xd723f9){var _0x1364e5=function(_0x1bc9b4){while(--_0x1bc9b4){_0x4fde1b['push'](_0x4fde1b['shift']());}};_0x1364e5(++_0xd723f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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'),controller['getDate']);router['get'](_0x0a9e('0xb'),controller['show']);router['get'](_0x0a9e('0xc'),controller[_0x0a9e('0xd')]);router[_0x0a9e('0x8')](_0x0a9e('0xe'),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x8')]('/:id/gdpr',controller['gdpr']);router['get']('/:id/preferred',controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),controller[_0x0a9e('0x12')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x69aeb7,_0x5db4b0,_0x4283ce){_0x4283ce(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x44dcfd,_0x4d5611,_0x52a03d){_0x52a03d(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x18'),path['extname'](_0x4d5611[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/logo',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x1c')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x106033,_0x205fd6,_0x31b1ca){_0x31b1ca(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x1314ae,_0x112016,_0x1c696a){_0x1c696a(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x1d'),path[_0x0a9e('0x1e')](_0x112016['originalname'])));}})});router[_0x0a9e('0x1a')]('/:id/logo_login',upload['single'](_0x0a9e('0x1f')),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x30bae6,_0x4abc77,_0xfb6e48){_0xfb6e48(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x370d86,_0x42ac8f,_0x16b1ca){_0x16b1ca(null,util['format']('%s%s',_0x0a9e('0x21'),path[_0x0a9e('0x1e')](_0x42ac8f[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/preferred',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1dc186,_0x34dc65,_0x25fba9){_0x25fba9(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x11c3b6,_0x14de77,_0x5a101a){_0x5a101a(null,util[_0x0a9e('0x17')](_0x0a9e('0x23'),_0x0a9e('0x24'),path[_0x0a9e('0x1e')](_0x14de77['originalname'])));}})});router[_0x0a9e('0x1a')](_0x0a9e('0x11'),upload[_0x0a9e('0x1b')](_0x0a9e('0x1f')),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x26')](_0x0a9e('0xb'),auth[_0x0a9e('0x27')](),controller[_0x0a9e('0x28')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 6cd7005..e0da3f3 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 _0xb355=['/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER'];(function(_0x40b921,_0x37d3b3){var _0x481c05=function(_0x2f7257){while(--_0x2f7257){_0x40b921['push'](_0x40b921['shift']());}};_0x481c05(++_0x37d3b3);}(_0xb355,0x15d));var _0x5b35=function(_0x9b3042,_0x47d05a){_0x9b3042=_0x9b3042-0x0;var _0x1b23e=_0xb355[_0x9b3042];return _0x1b23e;};'use strict';var Sequelize=require(_0x5b35('0x0'));module[_0x5b35('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x5b35('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x5b35('0x3')},'logo':{'type':Sequelize[_0x5b35('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x5b35('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x5b35('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x5b35('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x5b35('0x4')]},'turnaddr':{'type':Sequelize[_0x5b35('0x4')]},'turnusername':{'type':Sequelize[_0x5b35('0x4')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x5b35('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x5b35('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x5b35('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x5b35('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x5b35('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x5b35('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x5b35('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x5b35('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x5b35('0x4')],'defaultValue':_0x5b35('0x6')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x5b35('0x4')]},'defaultPreferred':{'type':Sequelize[_0x5b35('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x5b35('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x5b35('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x5b35('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x5b35('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x5b35('0x4')]},'defaultFavicon':{'type':Sequelize[_0x5b35('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x5b35('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x5b35('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x5b35('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x5b35('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x5b35('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x5b35('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x5b35('0x4')]},'language':{'type':Sequelize[_0x5b35('0x4')]},'bucket':{'type':Sequelize[_0x5b35('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x5b35('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x5b35('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x5b35('0x2')](0x2)[_0x5b35('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0x5b35('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x5b35('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x5b35('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x5b35('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x5b35('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x5b35('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xad92=['min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER'];(function(_0x2f8377,_0x3ed4bf){var _0x1705ed=function(_0x5db7ec){while(--_0x5db7ec){_0x2f8377['push'](_0x2f8377['shift']());}};_0x1705ed(++_0x3ed4bf);}(_0xad92,0x97));var _0x2ad9=function(_0x133fe4,_0x1f473b){_0x133fe4=_0x133fe4-0x0;var _0x4c4017=_0xad92[_0x133fe4];return _0x4c4017;};'use strict';var Sequelize=require(_0x2ad9('0x0'));module[_0x2ad9('0x1')]={'min_internal':{'type':Sequelize[_0x2ad9('0x2')](0xb),'unique':_0x2ad9('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x2ad9('0x2')](0xb),'unique':_0x2ad9('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x2ad9('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x2ad9('0x5')],'defaultValue':_0x2ad9('0x6')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x2ad9('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x2ad9('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x2ad9('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x2ad9('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x2ad9('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x2ad9('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x2ad9('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x2ad9('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x2ad9('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x2ad9('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x2ad9('0x5')],'defaultValue':_0x2ad9('0x8')},'enableEmailPreview':{'type':Sequelize[_0x2ad9('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x2ad9('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x2ad9('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x2ad9('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x2ad9('0x5')],'defaultValue':_0x2ad9('0x9')},'chatTimeout':{'type':Sequelize[_0x2ad9('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x2ad9('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x2ad9('0x5')]},'defaultPreferred':{'type':Sequelize[_0x2ad9('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x2ad9('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x2ad9('0x5')]},'defaultFavicon':{'type':Sequelize[_0x2ad9('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x2ad9('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x2ad9('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x2ad9('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x2ad9('0x2')]},'transcribeRegion':{'type':Sequelize[_0x2ad9('0x5')]},'sentiment':{'type':Sequelize[_0x2ad9('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x2ad9('0x5')]},'language':{'type':Sequelize[_0x2ad9('0x5')]},'bucket':{'type':Sequelize[_0x2ad9('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x2ad9('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x2ad9('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0x2ad9('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x2ad9('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x2ad9('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x2ad9('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index dd00307..be7bb01 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 _0x6e2c=['../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','send','index','map','type','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','filters','pick','where','merge','VIRTUAL','name','filter','options','Setting','include','findAll','rows','show','rawAttributes','includeAll','find','catch','body','file','filename','logo','params','loginLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','default_loginLogo.svg','gdpr','securePassword','addPreferred','default_preferred.png','getFavicon','defaultLoginLogo','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils'];(function(_0x4ad0f7,_0x1920b0){var _0x30f5c8=function(_0x2aa6b6){while(--_0x2aa6b6){_0x4ad0f7['push'](_0x4ad0f7['shift']());}};_0x30f5c8(++_0x1920b0);}(_0x6e2c,0xd4));var _0xc6e2=function(_0x3e6f6c,_0x579e57){_0x3e6f6c=_0x3e6f6c-0x0;var _0x598f15=_0x6e2c[_0x3e6f6c];return _0x598f15;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc6e2('0x0'));var rimraf=require(_0xc6e2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc6e2('0x2'));var util=require(_0xc6e2('0x3'));var path=require(_0xc6e2('0x4'));var sox=require(_0xc6e2('0x5'));var csv=require(_0xc6e2('0x6'));var ejs=require(_0xc6e2('0x7'));var fs=require('fs');var fs_extra=require(_0xc6e2('0x8'));var _=require('lodash');var squel=require(_0xc6e2('0x9'));var crypto=require(_0xc6e2('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc6e2('0xb'));var Papa=require('papaparse');var Redis=require(_0xc6e2('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xc6e2('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc6e2('0xe'))('api');var utils=require(_0xc6e2('0xf'));var config=require(_0xc6e2('0x10'));var licenseUtil=require(_0xc6e2('0x11'));var db=require(_0xc6e2('0x12'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xc6e2('0x13')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4890b7,_0x5ed69e,_0x948cd0,_0x5aca63){return new BPromise(function(_0x41306f,_0x4e1851){var _0x3b2310=_0x5aca63||client;return _0x3b2310[_0xc6e2('0x14')](_0x4890b7,_0x948cd0)[_0xc6e2('0x15')](function(_0x54ff1f){logger[_0xc6e2('0x16')](_0xc6e2('0x17'),_0x5ed69e,_0xc6e2('0x18'));logger[_0xc6e2('0x19')](_0xc6e2('0x1a'),_0x5ed69e,_0xc6e2('0x18'),JSON[_0xc6e2('0x1b')](_0x54ff1f));if(_0x54ff1f['error']){if(_0x54ff1f[_0xc6e2('0x1c')][_0xc6e2('0x1d')]===0x1f4){logger[_0xc6e2('0x1c')](_0xc6e2('0x17'),_0x5ed69e,_0x54ff1f['error'][_0xc6e2('0x1e')]);return _0x4e1851(_0x54ff1f[_0xc6e2('0x1c')][_0xc6e2('0x1e')]);}logger[_0xc6e2('0x1c')](_0xc6e2('0x17'),_0x5ed69e,_0x54ff1f[_0xc6e2('0x1c')][_0xc6e2('0x1e')]);return _0x41306f(_0x54ff1f[_0xc6e2('0x1c')][_0xc6e2('0x1e')]);}else{logger[_0xc6e2('0x16')](_0xc6e2('0x17'),_0x5ed69e,_0xc6e2('0x18'));_0x41306f(_0x54ff1f[_0xc6e2('0x1f')][_0xc6e2('0x1e')]);}})['catch'](function(_0x57225a){logger[_0xc6e2('0x1c')]('Setting,\x20%s,\x20%s',_0x5ed69e,_0x57225a);_0x4e1851(_0x57225a);});});}function respondWithStatusCode(_0x1a9dff,_0x3afe55){_0x3afe55=_0x3afe55||0xcc;return function(_0x5a4b07){if(_0x5a4b07){return _0x1a9dff[_0xc6e2('0x20')](_0x3afe55);}return _0x1a9dff[_0xc6e2('0x21')](_0x3afe55)['end']();};}function respondWithResult(_0x23501b,_0x3833df){_0x3833df=_0x3833df||0xc8;return function(_0x20bdb3){if(_0x20bdb3){return _0x23501b[_0xc6e2('0x21')](_0x3833df)[_0xc6e2('0x22')](_0x20bdb3);}};}function respondWithFilteredResult(_0x46d722,_0x3f69a2){return function(_0x423c79){if(_0x423c79){var _0x4324b2=_0x423c79[_0xc6e2('0x23')],_0x26699f=_0x3f69a2['offset'],_0x3f95c6=_0x3f69a2[_0xc6e2('0x24')]+_0x3f69a2['limit'],_0x87a2e2;if(_0x3f95c6>=_0x4324b2){_0x3f95c6=_0x4324b2;_0x87a2e2=0xc8;}else{_0x87a2e2=0xce;}_0x46d722['status'](_0x87a2e2);return _0x46d722[_0xc6e2('0x25')](_0xc6e2('0x26'),_0x26699f+'-'+_0x3f95c6+'/'+_0x4324b2)[_0xc6e2('0x22')](_0x423c79);}return null;};}function patchUpdates(_0x1b0a3d){return function(_0xd7e092){try{jsonpatch[_0xc6e2('0x27')](_0xd7e092,_0x1b0a3d,!![]);}catch(_0x6add84){return BPromise[_0xc6e2('0x28')](_0x6add84);}return _0xd7e092[_0xc6e2('0x29')]();};}function saveUpdates(_0x408a98,_0x2db8bb){return function(_0x2aa98f){if(_0x2aa98f){return _0x2aa98f[_0xc6e2('0x2a')](_0x408a98)[_0xc6e2('0x15')](function(_0x10e24f){return _0x10e24f;});}return null;};}function removeEntity(_0x7fcc56,_0x25766c){return function(_0x272418){if(_0x272418){return _0x272418[_0xc6e2('0x2b')]()[_0xc6e2('0x15')](function(){_0x7fcc56[_0xc6e2('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49e4c7,_0x245d79){return function(_0x387717){if(!_0x387717){_0x49e4c7['sendStatus'](0x194);}return _0x387717;};}function handleError(_0x183a75,_0x1e323c){_0x1e323c=_0x1e323c||0x1f4;return function(_0xe664ad){logger[_0xc6e2('0x1c')](_0xe664ad['stack']);if(_0xe664ad['name']){delete _0xe664ad['name'];}_0x183a75[_0xc6e2('0x21')](_0x1e323c)[_0xc6e2('0x2c')](_0xe664ad);};}exports[_0xc6e2('0x2d')]=function(_0x288d52,_0x3efed6){var _0x59c92e={},_0x2b5ad6={},_0x10a586={'count':0x0,'rows':[]};var _0x3ec471=_[_0xc6e2('0x2e')](db['Setting']['rawAttributes'],function(_0x2f6661){return{'name':_0x2f6661['fieldName'],'type':_0x2f6661[_0xc6e2('0x2f')]['key']};});_0x2b5ad6['model']=_[_0xc6e2('0x2e')](_0x3ec471,'name');_0x2b5ad6[_0xc6e2('0x30')]=_[_0xc6e2('0x31')](_0x288d52[_0xc6e2('0x30')]);_0x2b5ad6['filters']=_['intersection'](_0x2b5ad6[_0xc6e2('0x32')],_0x2b5ad6[_0xc6e2('0x30')]);_0x59c92e['attributes']=_[_0xc6e2('0x33')](_0x2b5ad6[_0xc6e2('0x32')],qs[_0xc6e2('0x34')](_0x288d52[_0xc6e2('0x30')][_0xc6e2('0x34')]));_0x59c92e[_0xc6e2('0x35')]=_0x59c92e[_0xc6e2('0x35')][_0xc6e2('0x36')]?_0x59c92e[_0xc6e2('0x35')]:_0x2b5ad6[_0xc6e2('0x32')];if(!_0x288d52[_0xc6e2('0x30')][_0xc6e2('0x37')](_0xc6e2('0x38'))){_0x59c92e[_0xc6e2('0x39')]=qs[_0xc6e2('0x39')](_0x288d52[_0xc6e2('0x30')][_0xc6e2('0x39')]);_0x59c92e['offset']=qs[_0xc6e2('0x24')](_0x288d52[_0xc6e2('0x30')][_0xc6e2('0x24')]);}_0x59c92e['order']=qs[_0xc6e2('0x3a')](_0x288d52['query'][_0xc6e2('0x3a')]);_0x59c92e['where']=qs[_0xc6e2('0x3b')](_[_0xc6e2('0x3c')](_0x288d52[_0xc6e2('0x30')],_0x2b5ad6[_0xc6e2('0x3b')]),_0x3ec471);if(_0x288d52['query']['filter']){_0x59c92e[_0xc6e2('0x3d')]=_[_0xc6e2('0x3e')](_0x59c92e[_0xc6e2('0x3d')],{'$or':_['map'](_0x3ec471,function(_0x25f0c0){if(_0x25f0c0[_0xc6e2('0x2f')]!==_0xc6e2('0x3f')){var _0x5f3463={};_0x5f3463[_0x25f0c0[_0xc6e2('0x40')]]={'$like':'%'+_0x288d52[_0xc6e2('0x30')][_0xc6e2('0x41')]+'%'};return _0x5f3463;}})});}_0x59c92e=_[_0xc6e2('0x3e')]({},_0x59c92e,_0x288d52[_0xc6e2('0x42')]);var _0x3f0f55={'where':_0x59c92e[_0xc6e2('0x3d')]};return db[_0xc6e2('0x43')][_0xc6e2('0x23')](_0x3f0f55)['then'](function(_0x10c84b){_0x10a586[_0xc6e2('0x23')]=_0x10c84b;if(_0x288d52['query']['includeAll']){_0x59c92e[_0xc6e2('0x44')]=[{'all':!![]}];}return db[_0xc6e2('0x43')][_0xc6e2('0x45')](_0x59c92e);})[_0xc6e2('0x15')](function(_0x5ae150){_0x10a586[_0xc6e2('0x46')]=_0x5ae150;return _0x10a586;})[_0xc6e2('0x15')](respondWithFilteredResult(_0x3efed6,_0x59c92e))['catch'](handleError(_0x3efed6,null));};exports[_0xc6e2('0x47')]=function(_0xafd575,_0x474753){var _0x98c2a={'raw':![],'where':{'id':_0xafd575['params']['id']}},_0x45a846={};_0x45a846[_0xc6e2('0x32')]=_[_0xc6e2('0x31')](db['Setting'][_0xc6e2('0x48')]);_0x45a846[_0xc6e2('0x30')]=_['keys'](_0xafd575['query']);_0x45a846[_0xc6e2('0x3b')]=_[_0xc6e2('0x33')](_0x45a846['model'],_0x45a846[_0xc6e2('0x30')]);_0x98c2a[_0xc6e2('0x35')]=_[_0xc6e2('0x33')](_0x45a846[_0xc6e2('0x32')],qs[_0xc6e2('0x34')](_0xafd575['query'][_0xc6e2('0x34')]));_0x98c2a[_0xc6e2('0x35')]=_0x98c2a[_0xc6e2('0x35')][_0xc6e2('0x36')]?_0x98c2a[_0xc6e2('0x35')]:_0x45a846[_0xc6e2('0x32')];if(_0xafd575[_0xc6e2('0x30')][_0xc6e2('0x49')]){_0x98c2a['include']=[{'all':!![]}];}_0x98c2a=_[_0xc6e2('0x3e')]({},_0x98c2a,_0xafd575[_0xc6e2('0x42')]);return db[_0xc6e2('0x43')][_0xc6e2('0x4a')](_0x98c2a)['then'](handleEntityNotFound(_0x474753,null))[_0xc6e2('0x15')](respondWithResult(_0x474753,null))[_0xc6e2('0x4b')](handleError(_0x474753,null));};exports['update']=function(_0x3ec5b7,_0x1ec288){if(_0x3ec5b7[_0xc6e2('0x4c')]['id']){delete _0x3ec5b7[_0xc6e2('0x4c')]['id'];}return db[_0xc6e2('0x43')][_0xc6e2('0x4a')]({'where':{'id':_0x3ec5b7['params']['id']}})[_0xc6e2('0x15')](handleEntityNotFound(_0x1ec288,null))[_0xc6e2('0x15')](saveUpdates(_0x3ec5b7[_0xc6e2('0x4c')],null))[_0xc6e2('0x15')](respondWithResult(_0x1ec288,null))[_0xc6e2('0x4b')](handleError(_0x1ec288,null));};exports['addLogo']=function(_0x82c090,_0x1fcb3e,_0xa3e0a7){if(_0x82c090['file']&&_0x82c090[_0xc6e2('0x4d')][_0xc6e2('0x4e')]){_0x82c090['body'][_0xc6e2('0x4f')]=_0x82c090[_0xc6e2('0x4d')][_0xc6e2('0x4e')];}return db[_0xc6e2('0x43')][_0xc6e2('0x4a')]({'where':{'id':_0x82c090[_0xc6e2('0x50')]['id']}})[_0xc6e2('0x15')](handleEntityNotFound(_0x1fcb3e,null))['then'](saveUpdates(_0x82c090[_0xc6e2('0x4c')],null))[_0xc6e2('0x15')](respondWithResult(_0x1fcb3e,null))[_0xc6e2('0x4b')](handleError(_0x1fcb3e,null));};exports['addLogoLogin']=function(_0x158f27,_0x384cd3,_0x2b0aba){if(_0x158f27[_0xc6e2('0x4d')]&&_0x158f27['file'][_0xc6e2('0x4e')]){_0x158f27[_0xc6e2('0x4c')][_0xc6e2('0x51')]=_0x158f27[_0xc6e2('0x4d')][_0xc6e2('0x4e')];}return db[_0xc6e2('0x43')][_0xc6e2('0x4a')]({'where':{'id':_0x158f27[_0xc6e2('0x50')]['id']}})[_0xc6e2('0x15')](handleEntityNotFound(_0x384cd3,null))[_0xc6e2('0x15')](saveUpdates(_0x158f27['body'],null))[_0xc6e2('0x15')](respondWithResult(_0x384cd3,null))[_0xc6e2('0x4b')](handleError(_0x384cd3,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x107cf0,_0x58f891,_0xa1ec52){var _0x4baf2e=_0xc6e2('0x52');var _0x420517={'custom':![]};return utilLicense[_0xc6e2('0x53')]()['then'](function(_0x29d169){if(_0x29d169){_0x420517=_0x29d169;}return db[_0xc6e2('0x43')][_0xc6e2('0x4a')]({'where':{'id':_0x107cf0[_0xc6e2('0x50')]['id']},'attributes':[_0xc6e2('0x4f'),_0xc6e2('0x51'),_0xc6e2('0x54'),_0xc6e2('0x55'),_0xc6e2('0x56'),'defaultLoginLogo',_0xc6e2('0x57'),_0xc6e2('0x58')],'raw':!![]});})['then'](handleEntityNotFound(_0x58f891,null))[_0xc6e2('0x15')](function(_0x5db1fb){if(_0x5db1fb){var _0x32c4f1=_0x5db1fb[_0xc6e2('0x4f')]&&fs[_0xc6e2('0x59')](path[_0xc6e2('0x5a')](config[_0xc6e2('0x5b')],_0x4baf2e,_['toLower'](_0x5db1fb[_0xc6e2('0x4f')])))?path[_0xc6e2('0x5a')](config[_0xc6e2('0x5b')],_0x4baf2e,_[_0xc6e2('0x5c')](_0x5db1fb[_0xc6e2('0x4f')])):path[_0xc6e2('0x5a')](config[_0xc6e2('0x5b')],_0x4baf2e,_[_0xc6e2('0x5c')]('default_logo.svg'));var _0x2c31e2=_0xc6e2('0x5d')+_[_0xc6e2('0x5e')](_0xc6e2('0x4f'));if(_0x5db1fb[_0x2c31e2]||!_0x420517[_0xc6e2('0x5f')]){_0x32c4f1=path['join'](config[_0xc6e2('0x5b')],_0x4baf2e,_[_0xc6e2('0x5c')]('default_logo.svg'));}if(!fs[_0xc6e2('0x59')](_0x32c4f1)){throw new db[(_0xc6e2('0x60'))][(_0xc6e2('0x61'))](_[_0xc6e2('0x5e')](_0xc6e2('0x4f'))+_0xc6e2('0x62'));}return _0x58f891[_0xc6e2('0x63')](_0x32c4f1);}})[_0xc6e2('0x4b')](handleError(_0x58f891,null));};var utilLicense=require(_0xc6e2('0x11'));exports[_0xc6e2('0x64')]=function(_0x758f57,_0x547812,_0x52cc4d){var _0x20b10f=_0xc6e2('0x52');var _0xf812d5={'custom':![]};return utilLicense[_0xc6e2('0x53')]()[_0xc6e2('0x15')](function(_0x53f1c3){if(_0x53f1c3){_0xf812d5=_0x53f1c3;}return db['Setting'][_0xc6e2('0x4a')]({'where':{'id':_0x758f57['params']['id']},'attributes':[_0xc6e2('0x4f'),_0xc6e2('0x51'),_0xc6e2('0x54'),'favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x547812,null))[_0xc6e2('0x15')](function(_0x576414){if(_0x576414){var _0x1fc906=_0x576414[_0xc6e2('0x51')]&&fs[_0xc6e2('0x59')](path[_0xc6e2('0x5a')](config['root'],_0x20b10f,_['toLower'](_0x576414['loginLogo'])))?path[_0xc6e2('0x5a')](config[_0xc6e2('0x5b')],_0x20b10f,_['toLower'](_0x576414[_0xc6e2('0x51')])):path['join'](config[_0xc6e2('0x5b')],_0x20b10f,_[_0xc6e2('0x5c')](_0xc6e2('0x65')));var _0x1f8522=_0xc6e2('0x5d')+_['upperFirst'](_0xc6e2('0x51'));if(_0x576414[_0x1f8522]||!_0xf812d5[_0xc6e2('0x5f')]){_0x1fc906=path[_0xc6e2('0x5a')](config[_0xc6e2('0x5b')],_0x20b10f,_[_0xc6e2('0x5c')]('default_loginLogo.svg'));}if(!fs[_0xc6e2('0x59')](_0x1fc906)){throw new db[(_0xc6e2('0x60'))][(_0xc6e2('0x61'))](_[_0xc6e2('0x5e')]('loginLogo')+'\x20not\x20found');}return _0x547812[_0xc6e2('0x63')](_0x1fc906);}})[_0xc6e2('0x4b')](handleError(_0x547812,null));};exports[_0xc6e2('0x66')]=function(_0x215ebd,_0x7a33a3){return db[_0xc6e2('0x43')][_0xc6e2('0x4a')]({'where':{'id':_0x215ebd[_0xc6e2('0x50')]['id']},'attributes':[_0xc6e2('0x67')]})[_0xc6e2('0x15')](respondWithResult(_0x7a33a3,null))[_0xc6e2('0x4b')](handleError(_0x7a33a3,null));};exports[_0xc6e2('0x68')]=function(_0x4fd721,_0x4107e4,_0x167531){if(_0x4fd721['file']&&_0x4fd721[_0xc6e2('0x4d')]['filename']){_0x4fd721['body'][_0xc6e2('0x54')]=_0x4fd721[_0xc6e2('0x4d')]['filename'];}return db[_0xc6e2('0x43')]['find']({'where':{'id':_0x4fd721[_0xc6e2('0x50')]['id']}})[_0xc6e2('0x15')](handleEntityNotFound(_0x4107e4,null))[_0xc6e2('0x15')](saveUpdates(_0x4fd721[_0xc6e2('0x4c')],null))[_0xc6e2('0x15')](respondWithResult(_0x4107e4,null))[_0xc6e2('0x4b')](handleError(_0x4107e4,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x107a73,_0x4392e6,_0x1b06e1){var _0xf1ae0='server/files/images/logos';var _0x2ef63c={'custom':![]};return utilLicense[_0xc6e2('0x53')]()[_0xc6e2('0x15')](function(_0x4c7d84){if(_0x4c7d84){_0x2ef63c=_0x4c7d84;}return db[_0xc6e2('0x43')][_0xc6e2('0x4a')]({'where':{'id':_0x107a73[_0xc6e2('0x50')]['id']},'attributes':[_0xc6e2('0x4f'),'loginLogo',_0xc6e2('0x54'),_0xc6e2('0x55'),_0xc6e2('0x56'),'defaultLoginLogo',_0xc6e2('0x57'),_0xc6e2('0x58')],'raw':!![]});})[_0xc6e2('0x15')](handleEntityNotFound(_0x4392e6,null))[_0xc6e2('0x15')](function(_0x74d3fd){if(_0x74d3fd){var _0x3c3b38=_0x74d3fd[_0xc6e2('0x54')]&&fs[_0xc6e2('0x59')](path[_0xc6e2('0x5a')](config[_0xc6e2('0x5b')],_0xf1ae0,_[_0xc6e2('0x5c')](_0x74d3fd[_0xc6e2('0x54')])))?path[_0xc6e2('0x5a')](config['root'],_0xf1ae0,_[_0xc6e2('0x5c')](_0x74d3fd[_0xc6e2('0x54')])):path[_0xc6e2('0x5a')](config['root'],_0xf1ae0,_[_0xc6e2('0x5c')](_0xc6e2('0x69')));var _0xa82012=_0xc6e2('0x5d')+_['upperFirst'](_0xc6e2('0x54'));if(_0x74d3fd[_0xa82012]||!_0x2ef63c[_0xc6e2('0x5f')]||!_0x2ef63c[_0xc6e2('0x54')]){_0x3c3b38=path[_0xc6e2('0x5a')](config[_0xc6e2('0x5b')],_0xf1ae0,_[_0xc6e2('0x5c')](_0xc6e2('0x69')));}if(!fs[_0xc6e2('0x59')](_0x3c3b38)){throw new db[(_0xc6e2('0x60'))][(_0xc6e2('0x61'))](_[_0xc6e2('0x5e')](_0xc6e2('0x54'))+_0xc6e2('0x62'));}return _0x4392e6['download'](_0x3c3b38);}})[_0xc6e2('0x4b')](handleError(_0x4392e6,null));};exports['addFavicon']=function(_0x81bcce,_0x3512a8,_0x8fe6a2){if(_0x81bcce['file']&&_0x81bcce[_0xc6e2('0x4d')][_0xc6e2('0x4e')]){_0x81bcce[_0xc6e2('0x4c')][_0xc6e2('0x55')]=_0x81bcce[_0xc6e2('0x4d')][_0xc6e2('0x4e')];}return db[_0xc6e2('0x43')]['find']({'where':{'id':_0x81bcce[_0xc6e2('0x50')]['id']}})[_0xc6e2('0x15')](handleEntityNotFound(_0x3512a8,null))[_0xc6e2('0x15')](saveUpdates(_0x81bcce[_0xc6e2('0x4c')],null))['then'](respondWithResult(_0x3512a8,null))[_0xc6e2('0x4b')](handleError(_0x3512a8,null));};var utilLicense=require(_0xc6e2('0x11'));exports[_0xc6e2('0x6a')]=function(_0x8dd6bb,_0x301f5b,_0x328f39){var _0x2ed47e=_0xc6e2('0x52');var _0x5df877={'custom':![]};return utilLicense[_0xc6e2('0x53')]()[_0xc6e2('0x15')](function(_0x501b40){if(_0x501b40){_0x5df877=_0x501b40;}return db['Setting'][_0xc6e2('0x4a')]({'where':{'id':_0x8dd6bb['params']['id']},'attributes':[_0xc6e2('0x4f'),_0xc6e2('0x51'),'preferred','favicon',_0xc6e2('0x56'),_0xc6e2('0x6b'),_0xc6e2('0x57'),_0xc6e2('0x58')],'raw':!![]});})['then'](handleEntityNotFound(_0x301f5b,null))['then'](function(_0x3364eb){if(_0x3364eb){var _0xf09eeb=_0x3364eb[_0xc6e2('0x55')]&&fs['existsSync'](path[_0xc6e2('0x5a')](config[_0xc6e2('0x5b')],_0x2ed47e,_['toLower'](_0x3364eb[_0xc6e2('0x55')])))?path[_0xc6e2('0x5a')](config[_0xc6e2('0x5b')],_0x2ed47e,_[_0xc6e2('0x5c')](_0x3364eb[_0xc6e2('0x55')])):path['join'](config[_0xc6e2('0x5b')],_0x2ed47e,_['toLower']('default_favicon.ico'));var _0x7ce70d=_0xc6e2('0x5d')+_[_0xc6e2('0x5e')](_0xc6e2('0x55'));if(_0x3364eb[_0x7ce70d]||!_0x5df877['custom']){_0xf09eeb=path[_0xc6e2('0x5a')](config[_0xc6e2('0x5b')],_0x2ed47e,_[_0xc6e2('0x5c')](_0xc6e2('0x6c')));}if(!fs[_0xc6e2('0x59')](_0xf09eeb)){throw new db[(_0xc6e2('0x60'))][(_0xc6e2('0x61'))](_[_0xc6e2('0x5e')](_0xc6e2('0x55'))+_0xc6e2('0x62'));}return _0x301f5b[_0xc6e2('0x63')](_0xf09eeb);}})[_0xc6e2('0x4b')](handleError(_0x301f5b,null));};exports[_0xc6e2('0x6d')]=function(_0x3c5d8c,_0x205087){var _0x897ab9={'offset':moment()[_0xc6e2('0x6e')]()};_0x897ab9[_0xc6e2('0x6f')]=moment()[_0xc6e2('0x6e')](_0x897ab9[_0xc6e2('0x24')])[_0xc6e2('0x70')](_0xc6e2('0x71'));return _0x205087[_0xc6e2('0x21')](0xc8)[_0xc6e2('0x2c')](_0x897ab9);}; \ No newline at end of file +var _0xd6c1=['defaultPreferred','default_loginLogo.svg','download','gdpr','securePassword','addPreferred','getPreferred','custom','default_preferred.png','addFavicon','default_favicon.ico','Sequelize','getDate','utcOffset','format','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','map','Setting','type','key','keys','query','filters','intersection','model','attributes','fields','length','order','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','includeAll','find','body','file','filename','addLogoLogin','loginLogo','../../config/license/util','getLogo','getLicense','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','join','toLower','root','default','upperFirst','default_logo.svg','ValidationError','\x20not\x20found','server/files/images/logos'];(function(_0x106b26,_0x2ecdea){var _0x24f211=function(_0x5be91f){while(--_0x5be91f){_0x106b26['push'](_0x106b26['shift']());}};_0x24f211(++_0x2ecdea);}(_0xd6c1,0xfb));var _0x1d6c=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xd6c1[_0x4a9fb1];return _0x348672;};'use strict';var pdf=require(_0x1d6c('0x0'));var emlformat=require(_0x1d6c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1d6c('0x2'));var jsonpatch=require(_0x1d6c('0x3'));var rp=require(_0x1d6c('0x4'));var moment=require(_0x1d6c('0x5'));var BPromise=require(_0x1d6c('0x6'));var Mustache=require(_0x1d6c('0x7'));var util=require(_0x1d6c('0x8'));var path=require(_0x1d6c('0x9'));var sox=require('sox');var csv=require(_0x1d6c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1d6c('0xb'));var _=require('lodash');var squel=require(_0x1d6c('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1d6c('0xd'));var toCsv=require(_0x1d6c('0xa'));var querystring=require(_0x1d6c('0xe'));var Papa=require('papaparse');var Redis=require(_0x1d6c('0xf'));var authService=require(_0x1d6c('0x10'));var qs=require(_0x1d6c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d6c('0x12'));var logger=require(_0x1d6c('0x13'))(_0x1d6c('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1d6c('0x15'))['db'];var jayson=require(_0x1d6c('0x16'));var client=jayson[_0x1d6c('0x17')][_0x1d6c('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x2a9511,_0x575b19,_0x3b58a5,_0x3755b1){return new BPromise(function(_0x4b9df4,_0x4f4410){var _0x2230b6=_0x3755b1||client;return _0x2230b6[_0x1d6c('0x19')](_0x2a9511,_0x3b58a5)[_0x1d6c('0x1a')](function(_0x1598d1){logger[_0x1d6c('0x1b')](_0x1d6c('0x1c'),_0x575b19,_0x1d6c('0x1d'));logger[_0x1d6c('0x1e')]('Setting,\x20%s,\x20%s,\x20%s',_0x575b19,_0x1d6c('0x1d'),JSON[_0x1d6c('0x1f')](_0x1598d1));if(_0x1598d1[_0x1d6c('0x20')]){if(_0x1598d1[_0x1d6c('0x20')][_0x1d6c('0x21')]===0x1f4){logger['error'](_0x1d6c('0x1c'),_0x575b19,_0x1598d1[_0x1d6c('0x20')]['message']);return _0x4f4410(_0x1598d1[_0x1d6c('0x20')][_0x1d6c('0x22')]);}logger[_0x1d6c('0x20')]('Setting,\x20%s,\x20%s',_0x575b19,_0x1598d1['error']['message']);return _0x4b9df4(_0x1598d1[_0x1d6c('0x20')][_0x1d6c('0x22')]);}else{logger[_0x1d6c('0x1b')](_0x1d6c('0x1c'),_0x575b19,_0x1d6c('0x1d'));_0x4b9df4(_0x1598d1[_0x1d6c('0x23')][_0x1d6c('0x22')]);}})[_0x1d6c('0x24')](function(_0x307f89){logger['error']('Setting,\x20%s,\x20%s',_0x575b19,_0x307f89);_0x4f4410(_0x307f89);});});}function respondWithStatusCode(_0x27c87b,_0x2d291b){_0x2d291b=_0x2d291b||0xcc;return function(_0x4fba44){if(_0x4fba44){return _0x27c87b[_0x1d6c('0x25')](_0x2d291b);}return _0x27c87b[_0x1d6c('0x26')](_0x2d291b)[_0x1d6c('0x27')]();};}function respondWithResult(_0x37f64c,_0x5e623e){_0x5e623e=_0x5e623e||0xc8;return function(_0x32f3ae){if(_0x32f3ae){return _0x37f64c[_0x1d6c('0x26')](_0x5e623e)[_0x1d6c('0x28')](_0x32f3ae);}};}function respondWithFilteredResult(_0x2bb0f3,_0x5cc291){return function(_0x1a55ab){if(_0x1a55ab){var _0x19f134=_0x1a55ab[_0x1d6c('0x29')],_0x334bf=_0x5cc291[_0x1d6c('0x2a')],_0x323057=_0x5cc291[_0x1d6c('0x2a')]+_0x5cc291[_0x1d6c('0x2b')],_0x24863b;if(_0x323057>=_0x19f134){_0x323057=_0x19f134;_0x24863b=0xc8;}else{_0x24863b=0xce;}_0x2bb0f3[_0x1d6c('0x26')](_0x24863b);return _0x2bb0f3[_0x1d6c('0x2c')](_0x1d6c('0x2d'),_0x334bf+'-'+_0x323057+'/'+_0x19f134)[_0x1d6c('0x28')](_0x1a55ab);}return null;};}function patchUpdates(_0xc625f6){return function(_0x27b434){try{jsonpatch[_0x1d6c('0x2e')](_0x27b434,_0xc625f6,!![]);}catch(_0x1979f8){return BPromise['reject'](_0x1979f8);}return _0x27b434[_0x1d6c('0x2f')]();};}function saveUpdates(_0x1b0ee9,_0x299a83){return function(_0x170a2e){if(_0x170a2e){return _0x170a2e[_0x1d6c('0x30')](_0x1b0ee9)[_0x1d6c('0x1a')](function(_0x4a8d2d){return _0x4a8d2d;});}return null;};}function removeEntity(_0x33bd2e,_0x2726c7){return function(_0x35391b){if(_0x35391b){return _0x35391b[_0x1d6c('0x31')]()['then'](function(){_0x33bd2e['status'](0xcc)[_0x1d6c('0x27')]();});}};}function handleEntityNotFound(_0x6a25f7,_0x5498b9){return function(_0x226eba){if(!_0x226eba){_0x6a25f7[_0x1d6c('0x25')](0x194);}return _0x226eba;};}function handleError(_0x46b63e,_0x2b8aa0){_0x2b8aa0=_0x2b8aa0||0x1f4;return function(_0x29ebc2){logger[_0x1d6c('0x20')](_0x29ebc2[_0x1d6c('0x32')]);if(_0x29ebc2['name']){delete _0x29ebc2[_0x1d6c('0x33')];}_0x46b63e['status'](_0x2b8aa0)[_0x1d6c('0x34')](_0x29ebc2);};}exports['index']=function(_0x352c33,_0x2404c0){var _0x2a9246={},_0x307c1e={},_0x5af514={'count':0x0,'rows':[]};var _0x2d49f6=_[_0x1d6c('0x35')](db[_0x1d6c('0x36')]['rawAttributes'],function(_0x35a3f1){return{'name':_0x35a3f1['fieldName'],'type':_0x35a3f1[_0x1d6c('0x37')][_0x1d6c('0x38')]};});_0x307c1e['model']=_[_0x1d6c('0x35')](_0x2d49f6,'name');_0x307c1e['query']=_[_0x1d6c('0x39')](_0x352c33[_0x1d6c('0x3a')]);_0x307c1e[_0x1d6c('0x3b')]=_[_0x1d6c('0x3c')](_0x307c1e[_0x1d6c('0x3d')],_0x307c1e[_0x1d6c('0x3a')]);_0x2a9246[_0x1d6c('0x3e')]=_[_0x1d6c('0x3c')](_0x307c1e[_0x1d6c('0x3d')],qs['fields'](_0x352c33[_0x1d6c('0x3a')][_0x1d6c('0x3f')]));_0x2a9246[_0x1d6c('0x3e')]=_0x2a9246[_0x1d6c('0x3e')][_0x1d6c('0x40')]?_0x2a9246[_0x1d6c('0x3e')]:_0x307c1e[_0x1d6c('0x3d')];if(!_0x352c33[_0x1d6c('0x3a')]['hasOwnProperty']('nolimit')){_0x2a9246['limit']=qs[_0x1d6c('0x2b')](_0x352c33[_0x1d6c('0x3a')]['limit']);_0x2a9246[_0x1d6c('0x2a')]=qs[_0x1d6c('0x2a')](_0x352c33[_0x1d6c('0x3a')][_0x1d6c('0x2a')]);}_0x2a9246[_0x1d6c('0x41')]=qs['sort'](_0x352c33[_0x1d6c('0x3a')]['sort']);_0x2a9246[_0x1d6c('0x42')]=qs[_0x1d6c('0x3b')](_[_0x1d6c('0x43')](_0x352c33[_0x1d6c('0x3a')],_0x307c1e['filters']),_0x2d49f6);if(_0x352c33[_0x1d6c('0x3a')][_0x1d6c('0x44')]){_0x2a9246['where']=_['merge'](_0x2a9246['where'],{'$or':_[_0x1d6c('0x35')](_0x2d49f6,function(_0x4f7e60){if(_0x4f7e60[_0x1d6c('0x37')]!==_0x1d6c('0x45')){var _0x38ac98={};_0x38ac98[_0x4f7e60[_0x1d6c('0x33')]]={'$like':'%'+_0x352c33[_0x1d6c('0x3a')][_0x1d6c('0x44')]+'%'};return _0x38ac98;}})});}_0x2a9246=_[_0x1d6c('0x46')]({},_0x2a9246,_0x352c33[_0x1d6c('0x47')]);var _0x324f36={'where':_0x2a9246[_0x1d6c('0x42')]};return db['Setting'][_0x1d6c('0x29')](_0x324f36)[_0x1d6c('0x1a')](function(_0x29a890){_0x5af514[_0x1d6c('0x29')]=_0x29a890;if(_0x352c33[_0x1d6c('0x3a')]['includeAll']){_0x2a9246[_0x1d6c('0x48')]=[{'all':!![]}];}return db['Setting'][_0x1d6c('0x49')](_0x2a9246);})[_0x1d6c('0x1a')](function(_0x397c49){_0x5af514[_0x1d6c('0x4a')]=_0x397c49;return _0x5af514;})[_0x1d6c('0x1a')](respondWithFilteredResult(_0x2404c0,_0x2a9246))[_0x1d6c('0x24')](handleError(_0x2404c0,null));};exports[_0x1d6c('0x4b')]=function(_0x581fb8,_0x16730f){var _0x4a7d1b={'raw':![],'where':{'id':_0x581fb8[_0x1d6c('0x4c')]['id']}},_0xa7c982={};_0xa7c982[_0x1d6c('0x3d')]=_[_0x1d6c('0x39')](db[_0x1d6c('0x36')]['rawAttributes']);_0xa7c982[_0x1d6c('0x3a')]=_['keys'](_0x581fb8['query']);_0xa7c982[_0x1d6c('0x3b')]=_[_0x1d6c('0x3c')](_0xa7c982[_0x1d6c('0x3d')],_0xa7c982[_0x1d6c('0x3a')]);_0x4a7d1b['attributes']=_[_0x1d6c('0x3c')](_0xa7c982[_0x1d6c('0x3d')],qs[_0x1d6c('0x3f')](_0x581fb8['query']['fields']));_0x4a7d1b[_0x1d6c('0x3e')]=_0x4a7d1b[_0x1d6c('0x3e')]['length']?_0x4a7d1b['attributes']:_0xa7c982[_0x1d6c('0x3d')];if(_0x581fb8[_0x1d6c('0x3a')][_0x1d6c('0x4d')]){_0x4a7d1b[_0x1d6c('0x48')]=[{'all':!![]}];}_0x4a7d1b=_[_0x1d6c('0x46')]({},_0x4a7d1b,_0x581fb8['options']);return db[_0x1d6c('0x36')][_0x1d6c('0x4e')](_0x4a7d1b)[_0x1d6c('0x1a')](handleEntityNotFound(_0x16730f,null))[_0x1d6c('0x1a')](respondWithResult(_0x16730f,null))[_0x1d6c('0x24')](handleError(_0x16730f,null));};exports[_0x1d6c('0x30')]=function(_0x206e64,_0x105458){if(_0x206e64['body']['id']){delete _0x206e64[_0x1d6c('0x4f')]['id'];}return db['Setting'][_0x1d6c('0x4e')]({'where':{'id':_0x206e64[_0x1d6c('0x4c')]['id']}})[_0x1d6c('0x1a')](handleEntityNotFound(_0x105458,null))[_0x1d6c('0x1a')](saveUpdates(_0x206e64['body'],null))['then'](respondWithResult(_0x105458,null))[_0x1d6c('0x24')](handleError(_0x105458,null));};exports['addLogo']=function(_0x42adbb,_0x3dc724,_0x8cac80){if(_0x42adbb[_0x1d6c('0x50')]&&_0x42adbb[_0x1d6c('0x50')]['filename']){_0x42adbb[_0x1d6c('0x4f')]['logo']=_0x42adbb['file'][_0x1d6c('0x51')];}return db[_0x1d6c('0x36')]['find']({'where':{'id':_0x42adbb[_0x1d6c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3dc724,null))[_0x1d6c('0x1a')](saveUpdates(_0x42adbb[_0x1d6c('0x4f')],null))[_0x1d6c('0x1a')](respondWithResult(_0x3dc724,null))[_0x1d6c('0x24')](handleError(_0x3dc724,null));};exports[_0x1d6c('0x52')]=function(_0x428f4f,_0x1cf939,_0x26e915){if(_0x428f4f[_0x1d6c('0x50')]&&_0x428f4f[_0x1d6c('0x50')][_0x1d6c('0x51')]){_0x428f4f['body'][_0x1d6c('0x53')]=_0x428f4f['file'][_0x1d6c('0x51')];}return db['Setting'][_0x1d6c('0x4e')]({'where':{'id':_0x428f4f[_0x1d6c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1cf939,null))['then'](saveUpdates(_0x428f4f['body'],null))[_0x1d6c('0x1a')](respondWithResult(_0x1cf939,null))[_0x1d6c('0x24')](handleError(_0x1cf939,null));};var utilLicense=require(_0x1d6c('0x54'));exports[_0x1d6c('0x55')]=function(_0x5a8933,_0x1f2ea6,_0x504559){var _0x491ed7='server/files/images/logos';var _0x59a4c4={'custom':![]};return utilLicense[_0x1d6c('0x56')]()['then'](function(_0xd0050f){if(_0xd0050f){_0x59a4c4=_0xd0050f;}return db[_0x1d6c('0x36')][_0x1d6c('0x4e')]({'where':{'id':_0x5a8933[_0x1d6c('0x4c')]['id']},'attributes':[_0x1d6c('0x57'),'loginLogo',_0x1d6c('0x58'),_0x1d6c('0x59'),_0x1d6c('0x5a'),_0x1d6c('0x5b'),'defaultPreferred',_0x1d6c('0x5c')],'raw':!![]});})[_0x1d6c('0x1a')](handleEntityNotFound(_0x1f2ea6,null))[_0x1d6c('0x1a')](function(_0x4c54d6){if(_0x4c54d6){var _0x54e359=_0x4c54d6[_0x1d6c('0x57')]&&fs[_0x1d6c('0x5d')](path[_0x1d6c('0x5e')](config['root'],_0x491ed7,_[_0x1d6c('0x5f')](_0x4c54d6['logo'])))?path['join'](config[_0x1d6c('0x60')],_0x491ed7,_[_0x1d6c('0x5f')](_0x4c54d6[_0x1d6c('0x57')])):path['join'](config[_0x1d6c('0x60')],_0x491ed7,_[_0x1d6c('0x5f')]('default_logo.svg'));var _0x1c3570=_0x1d6c('0x61')+_[_0x1d6c('0x62')](_0x1d6c('0x57'));if(_0x4c54d6[_0x1c3570]||!_0x59a4c4['custom']){_0x54e359=path[_0x1d6c('0x5e')](config[_0x1d6c('0x60')],_0x491ed7,_['toLower'](_0x1d6c('0x63')));}if(!fs[_0x1d6c('0x5d')](_0x54e359)){throw new db['Sequelize'][(_0x1d6c('0x64'))](_[_0x1d6c('0x62')](_0x1d6c('0x57'))+_0x1d6c('0x65'));}return _0x1f2ea6['download'](_0x54e359);}})[_0x1d6c('0x24')](handleError(_0x1f2ea6,null));};var utilLicense=require(_0x1d6c('0x54'));exports['getLogoLogin']=function(_0x309046,_0x1094f0,_0x142737){var _0x4e3af5=_0x1d6c('0x66');var _0x2fa2fd={'custom':![]};return utilLicense['getLicense']()[_0x1d6c('0x1a')](function(_0x134b0e){if(_0x134b0e){_0x2fa2fd=_0x134b0e;}return db[_0x1d6c('0x36')][_0x1d6c('0x4e')]({'where':{'id':_0x309046[_0x1d6c('0x4c')]['id']},'attributes':['logo',_0x1d6c('0x53'),_0x1d6c('0x58'),'favicon','defaultLogo',_0x1d6c('0x5b'),_0x1d6c('0x67'),_0x1d6c('0x5c')],'raw':!![]});})['then'](handleEntityNotFound(_0x1094f0,null))[_0x1d6c('0x1a')](function(_0x10704e){if(_0x10704e){var _0x10f219=_0x10704e[_0x1d6c('0x53')]&&fs[_0x1d6c('0x5d')](path['join'](config[_0x1d6c('0x60')],_0x4e3af5,_[_0x1d6c('0x5f')](_0x10704e[_0x1d6c('0x53')])))?path[_0x1d6c('0x5e')](config[_0x1d6c('0x60')],_0x4e3af5,_[_0x1d6c('0x5f')](_0x10704e[_0x1d6c('0x53')])):path[_0x1d6c('0x5e')](config[_0x1d6c('0x60')],_0x4e3af5,_[_0x1d6c('0x5f')]('default_loginLogo.svg'));var _0x51e6a9=_0x1d6c('0x61')+_[_0x1d6c('0x62')](_0x1d6c('0x53'));if(_0x10704e[_0x51e6a9]||!_0x2fa2fd['custom']){_0x10f219=path['join'](config['root'],_0x4e3af5,_['toLower'](_0x1d6c('0x68')));}if(!fs[_0x1d6c('0x5d')](_0x10f219)){throw new db['Sequelize'][(_0x1d6c('0x64'))](_[_0x1d6c('0x62')](_0x1d6c('0x53'))+_0x1d6c('0x65'));}return _0x1094f0[_0x1d6c('0x69')](_0x10f219);}})[_0x1d6c('0x24')](handleError(_0x1094f0,null));};exports[_0x1d6c('0x6a')]=function(_0x4d3b4a,_0x3ccd3e){return db[_0x1d6c('0x36')][_0x1d6c('0x4e')]({'where':{'id':_0x4d3b4a[_0x1d6c('0x4c')]['id']},'attributes':[_0x1d6c('0x6b')]})['then'](respondWithResult(_0x3ccd3e,null))[_0x1d6c('0x24')](handleError(_0x3ccd3e,null));};exports[_0x1d6c('0x6c')]=function(_0x503e1b,_0x1e67ad,_0x34ca6e){if(_0x503e1b[_0x1d6c('0x50')]&&_0x503e1b[_0x1d6c('0x50')]['filename']){_0x503e1b[_0x1d6c('0x4f')][_0x1d6c('0x58')]=_0x503e1b['file'][_0x1d6c('0x51')];}return db[_0x1d6c('0x36')][_0x1d6c('0x4e')]({'where':{'id':_0x503e1b['params']['id']}})[_0x1d6c('0x1a')](handleEntityNotFound(_0x1e67ad,null))[_0x1d6c('0x1a')](saveUpdates(_0x503e1b['body'],null))['then'](respondWithResult(_0x1e67ad,null))[_0x1d6c('0x24')](handleError(_0x1e67ad,null));};var utilLicense=require('../../config/license/util');exports[_0x1d6c('0x6d')]=function(_0x357540,_0x472346,_0x404bb1){var _0x498466='server/files/images/logos';var _0x56aa63={'custom':![]};return utilLicense[_0x1d6c('0x56')]()[_0x1d6c('0x1a')](function(_0x13c205){if(_0x13c205){_0x56aa63=_0x13c205;}return db[_0x1d6c('0x36')][_0x1d6c('0x4e')]({'where':{'id':_0x357540[_0x1d6c('0x4c')]['id']},'attributes':[_0x1d6c('0x57'),_0x1d6c('0x53'),_0x1d6c('0x58'),_0x1d6c('0x59'),_0x1d6c('0x5a'),_0x1d6c('0x5b'),_0x1d6c('0x67'),'defaultFavicon'],'raw':!![]});})[_0x1d6c('0x1a')](handleEntityNotFound(_0x472346,null))[_0x1d6c('0x1a')](function(_0x442cc3){if(_0x442cc3){var _0x262289=_0x442cc3['preferred']&&fs['existsSync'](path['join'](config[_0x1d6c('0x60')],_0x498466,_[_0x1d6c('0x5f')](_0x442cc3[_0x1d6c('0x58')])))?path['join'](config[_0x1d6c('0x60')],_0x498466,_[_0x1d6c('0x5f')](_0x442cc3['preferred'])):path['join'](config['root'],_0x498466,_[_0x1d6c('0x5f')]('default_preferred.png'));var _0x2777f4='default'+_[_0x1d6c('0x62')](_0x1d6c('0x58'));if(_0x442cc3[_0x2777f4]||!_0x56aa63[_0x1d6c('0x6e')]||!_0x56aa63['preferred']){_0x262289=path[_0x1d6c('0x5e')](config['root'],_0x498466,_['toLower'](_0x1d6c('0x6f')));}if(!fs[_0x1d6c('0x5d')](_0x262289)){throw new db['Sequelize'][(_0x1d6c('0x64'))](_[_0x1d6c('0x62')](_0x1d6c('0x58'))+_0x1d6c('0x65'));}return _0x472346[_0x1d6c('0x69')](_0x262289);}})['catch'](handleError(_0x472346,null));};exports[_0x1d6c('0x70')]=function(_0x21b76f,_0x45bfa4,_0x11ca3a){if(_0x21b76f[_0x1d6c('0x50')]&&_0x21b76f['file']['filename']){_0x21b76f['body'][_0x1d6c('0x59')]=_0x21b76f[_0x1d6c('0x50')][_0x1d6c('0x51')];}return db[_0x1d6c('0x36')][_0x1d6c('0x4e')]({'where':{'id':_0x21b76f['params']['id']}})[_0x1d6c('0x1a')](handleEntityNotFound(_0x45bfa4,null))['then'](saveUpdates(_0x21b76f[_0x1d6c('0x4f')],null))[_0x1d6c('0x1a')](respondWithResult(_0x45bfa4,null))[_0x1d6c('0x24')](handleError(_0x45bfa4,null));};var utilLicense=require(_0x1d6c('0x54'));exports['getFavicon']=function(_0x5ec29d,_0x256d7f,_0x58e57b){var _0x4a4652=_0x1d6c('0x66');var _0x1bce21={'custom':![]};return utilLicense[_0x1d6c('0x56')]()[_0x1d6c('0x1a')](function(_0x50530f){if(_0x50530f){_0x1bce21=_0x50530f;}return db[_0x1d6c('0x36')][_0x1d6c('0x4e')]({'where':{'id':_0x5ec29d[_0x1d6c('0x4c')]['id']},'attributes':[_0x1d6c('0x57'),_0x1d6c('0x53'),'preferred',_0x1d6c('0x59'),_0x1d6c('0x5a'),_0x1d6c('0x5b'),_0x1d6c('0x67'),'defaultFavicon'],'raw':!![]});})[_0x1d6c('0x1a')](handleEntityNotFound(_0x256d7f,null))[_0x1d6c('0x1a')](function(_0x3a9f82){if(_0x3a9f82){var _0x5d9c26=_0x3a9f82[_0x1d6c('0x59')]&&fs[_0x1d6c('0x5d')](path[_0x1d6c('0x5e')](config['root'],_0x4a4652,_['toLower'](_0x3a9f82[_0x1d6c('0x59')])))?path[_0x1d6c('0x5e')](config[_0x1d6c('0x60')],_0x4a4652,_[_0x1d6c('0x5f')](_0x3a9f82[_0x1d6c('0x59')])):path[_0x1d6c('0x5e')](config[_0x1d6c('0x60')],_0x4a4652,_[_0x1d6c('0x5f')](_0x1d6c('0x71')));var _0xf3d7e9=_0x1d6c('0x61')+_[_0x1d6c('0x62')](_0x1d6c('0x59'));if(_0x3a9f82[_0xf3d7e9]||!_0x1bce21[_0x1d6c('0x6e')]){_0x5d9c26=path[_0x1d6c('0x5e')](config[_0x1d6c('0x60')],_0x4a4652,_[_0x1d6c('0x5f')](_0x1d6c('0x71')));}if(!fs[_0x1d6c('0x5d')](_0x5d9c26)){throw new db[(_0x1d6c('0x72'))][(_0x1d6c('0x64'))](_[_0x1d6c('0x62')](_0x1d6c('0x59'))+'\x20not\x20found');}return _0x256d7f['download'](_0x5d9c26);}})['catch'](handleError(_0x256d7f,null));};exports[_0x1d6c('0x73')]=function(_0x3ff908,_0x23fd94){var _0x140517={'offset':moment()[_0x1d6c('0x74')]()};_0x140517['now']=moment()[_0x1d6c('0x74')](_0x140517[_0x1d6c('0x2a')])[_0x1d6c('0x75')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x23fd94['status'](0xc8)['send'](_0x140517);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index edb0826..7f14fee 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 _0x8c68=['moment','bluebird','path','rimraf','./setting.attributes','exports','Setting','settings','lodash','util','../../config/logger','api'];(function(_0x234e98,_0x28e981){var _0x4fd33f=function(_0x42295c){while(--_0x42295c){_0x234e98['push'](_0x234e98['shift']());}};_0x4fd33f(++_0x28e981);}(_0x8c68,0x1c4));var _0x88c6=function(_0x37074a,_0x20ae9a){_0x37074a=_0x37074a-0x0;var _0xc15c72=_0x8c68[_0x37074a];return _0xc15c72;};'use strict';var _=require(_0x88c6('0x0'));var util=require(_0x88c6('0x1'));var logger=require(_0x88c6('0x2'))(_0x88c6('0x3'));var moment=require(_0x88c6('0x4'));var BPromise=require(_0x88c6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x88c6('0x6'));var rimraf=require(_0x88c6('0x7'));var config=require('../../config/environment');var attributes=require(_0x88c6('0x8'));module[_0x88c6('0x9')]=function(_0x642b5a,_0x5c4c71){return _0x642b5a['define'](_0x88c6('0xa'),attributes,{'tableName':_0x88c6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd130=['Setting','settings','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0xc98c18,_0x4aecd0){var _0x1d4f6f=function(_0x36e666){while(--_0x36e666){_0xc98c18['push'](_0xc98c18['shift']());}};_0x1d4f6f(++_0x4aecd0);}(_0xd130,0x183));var _0x0d13=function(_0x272141,_0xc1016e){_0x272141=_0x272141-0x0;var _0x1ba809=_0xd130[_0x272141];return _0x1ba809;};'use strict';var _=require('lodash');var util=require(_0x0d13('0x0'));var logger=require(_0x0d13('0x1'))(_0x0d13('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0d13('0x3'));var fs=require('fs');var path=require(_0x0d13('0x4'));var rimraf=require(_0x0d13('0x5'));var config=require(_0x0d13('0x6'));var attributes=require(_0x0d13('0x7'));module[_0x0d13('0x8')]=function(_0x571063,_0x315355){return _0x571063['define'](_0x0d13('0x9'),attributes,{'tableName':_0x0d13('0xa'),'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 3476899..e4fd2ee 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 _0x24b3=['error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s'];(function(_0x2b29ab,_0x201845){var _0x16e64b=function(_0x42f652){while(--_0x42f652){_0x2b29ab['push'](_0x2b29ab['shift']());}};_0x16e64b(++_0x201845);}(_0x24b3,0xd6));var _0x324b=function(_0xed32b7,_0x3a9e78){_0xed32b7=_0xed32b7-0x0;var _0x2aaacf=_0x24b3[_0xed32b7];return _0x2aaacf;};'use strict';var _=require(_0x324b('0x0'));var util=require(_0x324b('0x1'));var moment=require(_0x324b('0x2'));var BPromise=require(_0x324b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x324b('0x4'));var db=require(_0x324b('0x5'))['db'];var utils=require(_0x324b('0x6'));var logger=require('../../config/logger')(_0x324b('0x7'));var config=require(_0x324b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x324b('0x9')][_0x324b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fa549,_0x5e3169,_0x52ffb1){return new BPromise(function(_0x35663e,_0x2fd45c){return client['request'](_0x3fa549,_0x52ffb1)['then'](function(_0x3b7905){logger['info'](_0x324b('0xb'),_0x5e3169,_0x324b('0xc'));logger['debug'](_0x324b('0xd'),_0x5e3169,'request\x20sent',JSON['stringify'](_0x3b7905));if(_0x3b7905[_0x324b('0xe')]){if(_0x3b7905[_0x324b('0xe')][_0x324b('0xf')]===0x1f4){logger[_0x324b('0xe')]('Setting,\x20%s,\x20%s',_0x5e3169,_0x3b7905[_0x324b('0xe')]['message']);return _0x2fd45c(_0x3b7905[_0x324b('0xe')]['message']);}logger[_0x324b('0xe')](_0x324b('0xb'),_0x5e3169,_0x3b7905[_0x324b('0xe')]['message']);return _0x35663e(_0x3b7905[_0x324b('0xe')][_0x324b('0x10')]);}else{logger[_0x324b('0x11')]('Setting,\x20%s,\x20%s',_0x5e3169,'request\x20sent');_0x35663e(_0x3b7905['result'][_0x324b('0x10')]);}})[_0x324b('0x12')](function(_0xef63b7){logger[_0x324b('0xe')](_0x324b('0xb'),_0x5e3169,_0xef63b7);_0x2fd45c(_0xef63b7);});});} \ No newline at end of file +var _0x0f1e=['catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','Setting,\x20%s,\x20%s','result'];(function(_0x3da612,_0x332456){var _0x1a9d1d=function(_0x5ca0d0){while(--_0x5ca0d0){_0x3da612['push'](_0x3da612['shift']());}};_0x1a9d1d(++_0x332456);}(_0x0f1e,0x13c));var _0xe0f1=function(_0x56418c,_0xd90668){_0x56418c=_0x56418c-0x0;var _0x1c838d=_0x0f1e[_0x56418c];return _0x1c838d;};'use strict';var _=require(_0xe0f1('0x0'));var util=require(_0xe0f1('0x1'));var moment=require(_0xe0f1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0f1('0x3'));var db=require(_0xe0f1('0x4'))['db'];var utils=require(_0xe0f1('0x5'));var logger=require(_0xe0f1('0x6'))(_0xe0f1('0x7'));var config=require(_0xe0f1('0x8'));var jayson=require(_0xe0f1('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4225a5,_0x43fb96,_0x3aec5a){return new BPromise(function(_0x2469d9,_0x3033ed){return client[_0xe0f1('0xa')](_0x4225a5,_0x3aec5a)[_0xe0f1('0xb')](function(_0x318086){logger[_0xe0f1('0xc')]('Setting,\x20%s,\x20%s',_0x43fb96,'request\x20sent');logger['debug'](_0xe0f1('0xd'),_0x43fb96,_0xe0f1('0xe'),JSON['stringify'](_0x318086));if(_0x318086[_0xe0f1('0xf')]){if(_0x318086['error'][_0xe0f1('0x10')]===0x1f4){logger[_0xe0f1('0xf')]('Setting,\x20%s,\x20%s',_0x43fb96,_0x318086['error'][_0xe0f1('0x11')]);return _0x3033ed(_0x318086[_0xe0f1('0xf')][_0xe0f1('0x11')]);}logger[_0xe0f1('0xf')]('Setting,\x20%s,\x20%s',_0x43fb96,_0x318086[_0xe0f1('0xf')][_0xe0f1('0x11')]);return _0x2469d9(_0x318086[_0xe0f1('0xf')][_0xe0f1('0x11')]);}else{logger[_0xe0f1('0xc')](_0xe0f1('0x12'),_0x43fb96,_0xe0f1('0xe'));_0x2469d9(_0x318086[_0xe0f1('0x13')]['message']);}})[_0xe0f1('0x14')](function(_0x65b8bf){logger[_0xe0f1('0xf')](_0xe0f1('0x12'),_0x43fb96,_0x65b8bf);_0x3033ed(_0x65b8bf);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 44f649c..9978788 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 _0x0913=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','addApplications','/:id/send','send','status','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','util','path','connect-timeout','express'];(function(_0x4f1874,_0x2aff4d){var _0x5e8a73=function(_0x2e19e6){while(--_0x2e19e6){_0x4f1874['push'](_0x4f1874['shift']());}};_0x5e8a73(++_0x2aff4d);}(_0x0913,0x17f));var _0x3091=function(_0x162fdd,_0x5a4ab6){_0x162fdd=_0x162fdd-0x0;var _0x20b527=_0x0913[_0x162fdd];return _0x20b527;};'use strict';var multer=require('multer');var util=require(_0x3091('0x0'));var path=require(_0x3091('0x1'));var timeout=require(_0x3091('0x2'));var express=require(_0x3091('0x3'));var router=express[_0x3091('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3091('0x5'));var interaction=require(_0x3091('0x6'));var config=require(_0x3091('0x7'));var controller=require('./smsAccount.controller');router[_0x3091('0x8')]('/',auth[_0x3091('0x9')](),controller[_0x3091('0xa')]);router['get'](_0x3091('0xb'),auth[_0x3091('0x9')](),controller[_0x3091('0xc')]);router[_0x3091('0x8')](_0x3091('0xd'),auth[_0x3091('0x9')](),controller[_0x3091('0xe')]);router[_0x3091('0x8')]('/:id/dispositions',auth[_0x3091('0x9')](),controller[_0x3091('0xf')]);router[_0x3091('0x8')]('/:id/canned_answers',auth[_0x3091('0x9')](),controller[_0x3091('0x10')]);router[_0x3091('0x8')](_0x3091('0x11'),auth[_0x3091('0x9')](),controller[_0x3091('0x12')]);router['get'](_0x3091('0x13'),auth[_0x3091('0x9')](),controller[_0x3091('0x14')]);router[_0x3091('0x8')](_0x3091('0x15'),controller['statusGet']);router['get'](_0x3091('0x16'),auth[_0x3091('0x9')](),controller[_0x3091('0x17')]);router[_0x3091('0x18')]('/',auth[_0x3091('0x9')](),controller[_0x3091('0x19')]);router[_0x3091('0x18')](_0x3091('0x1a'),auth[_0x3091('0x9')](),controller[_0x3091('0x1b')]);router[_0x3091('0x18')](_0x3091('0x1c'),auth[_0x3091('0x9')](),controller[_0x3091('0x1d')]);router[_0x3091('0x18')](_0x3091('0x1e'),controller['notify']);router['post'](_0x3091('0x11'),auth[_0x3091('0x9')](),controller[_0x3091('0x1f')]);router['post'](_0x3091('0x20'),auth['isAuthenticated'](),controller[_0x3091('0x21')]);router['post'](_0x3091('0x15'),controller[_0x3091('0x22')]);router[_0x3091('0x18')](_0x3091('0x16'),auth[_0x3091('0x9')](),controller[_0x3091('0x23')]);router[_0x3091('0x24')](_0x3091('0xd'),auth['isAuthenticated'](),controller[_0x3091('0x25')]);router[_0x3091('0x26')]('/:id',auth['isAuthenticated'](),controller[_0x3091('0x27')]);router[_0x3091('0x26')](_0x3091('0x1a'),auth[_0x3091('0x9')](),controller[_0x3091('0x28')]);router[_0x3091('0x26')](_0x3091('0x1c'),auth['isAuthenticated'](),controller[_0x3091('0x29')]);router[_0x3091('0x26')](_0x3091('0x16'),auth[_0x3091('0x9')](),controller[_0x3091('0x2a')]);module['exports']=router; \ No newline at end of file +var _0xa1cd=['describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/status','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','addApplications','/:id/send','send','status','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated'];(function(_0x5ad220,_0x27407e){var _0xdec77d=function(_0x58d736){while(--_0x58d736){_0x5ad220['push'](_0x5ad220['shift']());}};_0xdec77d(++_0x27407e);}(_0xa1cd,0x1c0));var _0xda1c=function(_0x1a9d8b,_0x4d5c2b){_0x1a9d8b=_0x1a9d8b-0x0;var _0x466424=_0xa1cd[_0x1a9d8b];return _0x466424;};'use strict';var multer=require(_0xda1c('0x0'));var util=require(_0xda1c('0x1'));var path=require(_0xda1c('0x2'));var timeout=require(_0xda1c('0x3'));var express=require('express');var router=express[_0xda1c('0x4')]();var fs_extra=require(_0xda1c('0x5'));var auth=require(_0xda1c('0x6'));var interaction=require(_0xda1c('0x7'));var config=require(_0xda1c('0x8'));var controller=require(_0xda1c('0x9'));router[_0xda1c('0xa')]('/',auth['isAuthenticated'](),controller[_0xda1c('0xb')]);router[_0xda1c('0xa')](_0xda1c('0xc'),auth[_0xda1c('0xd')](),controller[_0xda1c('0xe')]);router[_0xda1c('0xa')]('/:id',auth[_0xda1c('0xd')](),controller['show']);router[_0xda1c('0xa')](_0xda1c('0xf'),auth['isAuthenticated'](),controller[_0xda1c('0x10')]);router[_0xda1c('0xa')](_0xda1c('0x11'),auth[_0xda1c('0xd')](),controller[_0xda1c('0x12')]);router[_0xda1c('0xa')]('/:id/applications',auth[_0xda1c('0xd')](),controller[_0xda1c('0x13')]);router[_0xda1c('0xa')]('/:id/interactions',auth[_0xda1c('0xd')](),controller['getInteractions']);router[_0xda1c('0xa')](_0xda1c('0x14'),controller['statusGet']);router['get'](_0xda1c('0x15'),auth[_0xda1c('0xd')](),controller[_0xda1c('0x16')]);router[_0xda1c('0x17')]('/',auth[_0xda1c('0xd')](),controller[_0xda1c('0x18')]);router[_0xda1c('0x17')](_0xda1c('0xf'),auth[_0xda1c('0xd')](),controller[_0xda1c('0x19')]);router[_0xda1c('0x17')](_0xda1c('0x11'),auth[_0xda1c('0xd')](),controller[_0xda1c('0x1a')]);router[_0xda1c('0x17')](_0xda1c('0x1b'),controller[_0xda1c('0x1c')]);router['post'](_0xda1c('0x1d'),auth[_0xda1c('0xd')](),controller[_0xda1c('0x1e')]);router[_0xda1c('0x17')](_0xda1c('0x1f'),auth[_0xda1c('0xd')](),controller[_0xda1c('0x20')]);router[_0xda1c('0x17')](_0xda1c('0x14'),controller[_0xda1c('0x21')]);router[_0xda1c('0x17')](_0xda1c('0x15'),auth['isAuthenticated'](),controller['addAgents']);router[_0xda1c('0x22')](_0xda1c('0x23'),auth[_0xda1c('0xd')](),controller[_0xda1c('0x24')]);router[_0xda1c('0x25')](_0xda1c('0x23'),auth['isAuthenticated'](),controller[_0xda1c('0x26')]);router['delete']('/:id/dispositions',auth[_0xda1c('0xd')](),controller[_0xda1c('0x27')]);router[_0xda1c('0x25')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xda1c('0x28')]);router[_0xda1c('0x25')]('/:id/users',auth[_0xda1c('0xd')](),controller[_0xda1c('0x29')]);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 fff5286..3e0f86d 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 _0x081e=['setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','STRING','generate','ENUM','twilio','connectel','csc','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER'];(function(_0x5cb470,_0x134180){var _0x5c6bed=function(_0x10bd40){while(--_0x10bd40){_0x5cb470['push'](_0x5cb470['shift']());}};_0x5c6bed(++_0x134180);}(_0x081e,0xc5));var _0xe081=function(_0x1287a6,_0x38b142){_0x1287a6=_0x1287a6-0x0;var _0x3b6196=_0x081e[_0x1287a6];return _0x3b6196;};'use strict';var Sequelize=require(_0xe081('0x0'));var rs=require(_0xe081('0x1'));module['exports']={'name':{'type':Sequelize[_0xe081('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xe081('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xe081('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xe081('0x2')],'defaultValue':function(){return rs[_0xe081('0x3')]();}},'phone':{'type':Sequelize[_0xe081('0x2')]},'type':{'type':Sequelize[_0xe081('0x4')](_0xe081('0x5'),'skebby',_0xe081('0x6'),'clicksend','plivo','clickatell','bandwidth',_0xe081('0x7'),'infobip',_0xe081('0x8'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xe081('0x2')]},'authToken':{'type':Sequelize[_0xe081('0x2')]},'smsMethod':{'type':Sequelize[_0xe081('0x4')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xe081('0x2')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0xe081('0x2')]},'senderString':{'type':Sequelize[_0xe081('0x2')]},'deliveryReport':{'type':Sequelize[_0xe081('0x9')],'defaultValue':![]},'description':{'type':Sequelize[_0xe081('0x2')]},'notificationTemplate':{'type':Sequelize[_0xe081('0xa')],'defaultValue':function(){return _0xe081('0xb');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe081('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe081('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe081('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe081('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe081('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe081('0xc')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4911a0){if(!_0x4911a0)this[_0xe081('0xd')](_0xe081('0xe'),null);this[_0xe081('0xd')]('mandatoryDisposition',_0x4911a0);}}}; \ No newline at end of file +var _0xb923=['clicksend','clickatell','bandwidth','infobip','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','generate','ENUM','skebby'];(function(_0x4d2411,_0x13ac78){var _0x50514d=function(_0xfaaf97){while(--_0xfaaf97){_0x4d2411['push'](_0x4d2411['shift']());}};_0x50514d(++_0x13ac78);}(_0xb923,0x80));var _0x3b92=function(_0x5390e7,_0x41a2d5){_0x5390e7=_0x5390e7-0x0;var _0x598df2=_0xb923[_0x5390e7];return _0x598df2;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x3b92('0x0')]={'name':{'type':Sequelize[_0x3b92('0x1')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x3b92('0x1')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x3b92('0x1')],'defaultValue':function(){return rs[_0x3b92('0x2')]();}},'phone':{'type':Sequelize[_0x3b92('0x1')]},'type':{'type':Sequelize[_0x3b92('0x3')]('twilio',_0x3b92('0x4'),'connectel',_0x3b92('0x5'),'plivo',_0x3b92('0x6'),_0x3b92('0x7'),'csc',_0x3b92('0x8'),_0x3b92('0x9'))},'accountSid':{'type':Sequelize[_0x3b92('0x1')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x3b92('0x1')]},'smsMethod':{'type':Sequelize[_0x3b92('0x3')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x3b92('0x1')]},'apiKey':{'type':Sequelize[_0x3b92('0x1')]},'applicationId':{'type':Sequelize[_0x3b92('0x1')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x3b92('0x1')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x3b92('0x1')]},'notificationTemplate':{'type':Sequelize[_0x3b92('0xa')],'defaultValue':function(){return _0x3b92('0xb');}},'notificationSound':{'type':Sequelize[_0x3b92('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3b92('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3b92('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3b92('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3b92('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3b92('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3b92('0xd')],'comment':_0x3b92('0xe')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3b92('0xf'),'set':function(_0x380923){if(!_0x380923)this[_0x3b92('0x10')](_0x3b92('0x11'),null);this[_0x3b92('0x10')](_0x3b92('0x12'),_0x380923);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index c9da204..2fa6282 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 _0x2c7f=['request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','save','update','destroy','SmsAccounts','stack','name','send','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','options','SmsAccount','includeAll','findAll','rows','show','params','find','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','filter','removeDispositions','ids','addAnswer','CannedAnswer','nolimit','include','notify','sms','account','orderBy','priority','asc','Applications','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','Body','messageId','MessageSid','sender','text','clicksend','message_id','plivo','Text','results','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','refid','isNil','Sequelize','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','CmList','CmContact','Contacts','DESC','list','omit','SmsInteraction','interaction','created','autoclose','applications','push','close','*,*,*,*','SmsMessage','ContactId','AttachmentId','User','UserId','unshift','agent','Start','startRouting','receiveMessage','info','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','twilio','set','Content-Type','text/xml','\x0a','sequelize','transaction','SmsApplication','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','connectel','requestid','statusInt','status_code','infobip','DELIVERED','groupName','intelepeer','redif','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','bandwidth','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','csc','addAgents','spread','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','zip-dir'];(function(_0x1f1a97,_0xadfc15){var _0x29fc6a=function(_0x38c180){while(--_0x38c180){_0x1f1a97['push'](_0x1f1a97['shift']());}};_0x29fc6a(++_0xadfc15);}(_0x2c7f,0xe6));var _0xf2c7=function(_0x3f2e3f,_0x3b92f3){_0x3f2e3f=_0x3f2e3f-0x0;var _0x50f234=_0x2c7f[_0x3f2e3f];return _0x50f234;};'use strict';var pdf=require(_0xf2c7('0x0'));var emlformat=require(_0xf2c7('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf2c7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf2c7('0x3'));var moment=require('moment');var BPromise=require(_0xf2c7('0x4'));var Mustache=require(_0xf2c7('0x5'));var util=require(_0xf2c7('0x6'));var path=require(_0xf2c7('0x7'));var sox=require(_0xf2c7('0x8'));var csv=require(_0xf2c7('0x9'));var ejs=require(_0xf2c7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf2c7('0xb'));var squel=require(_0xf2c7('0xc'));var crypto=require(_0xf2c7('0xd'));var jsforce=require(_0xf2c7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf2c7('0xf'));var Redis=require(_0xf2c7('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf2c7('0x11'));var hardwareService=require(_0xf2c7('0x12'));var logger=require(_0xf2c7('0x13'))(_0xf2c7('0x14'));var utils=require(_0xf2c7('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xf2c7('0x16')]=_[_0xf2c7('0x17')](config[_0xf2c7('0x16')],{'host':_0xf2c7('0x18'),'port':0x18eb});var socket=require(_0xf2c7('0x19'))(new Redis(config[_0xf2c7('0x16')]));require(_0xf2c7('0x1a'))[_0xf2c7('0x1b')](socket);var jayson=require(_0xf2c7('0x1c'));var client=jayson[_0xf2c7('0x1d')][_0xf2c7('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x39f897,_0x19da78,_0x193b9a,_0x13c79d){return new BPromise(function(_0x54c531,_0x141158){var _0x500cea=_0x13c79d||client;return _0x500cea[_0xf2c7('0x1f')](_0x39f897,_0x193b9a)[_0xf2c7('0x20')](function(_0x59c59){logger['info']('SmsAccount,\x20%s,\x20%s',_0x19da78,_0xf2c7('0x21'));logger[_0xf2c7('0x22')](_0xf2c7('0x23'),_0x19da78,_0xf2c7('0x21'),JSON['stringify'](_0x59c59));if(_0x59c59[_0xf2c7('0x24')]){if(_0x59c59[_0xf2c7('0x24')][_0xf2c7('0x25')]===0x1f4){logger[_0xf2c7('0x24')](_0xf2c7('0x26'),_0x19da78,_0x59c59['error'][_0xf2c7('0x27')]);return _0x141158(_0x59c59[_0xf2c7('0x24')][_0xf2c7('0x27')]);}logger[_0xf2c7('0x24')](_0xf2c7('0x26'),_0x19da78,_0x59c59[_0xf2c7('0x24')]['message']);return _0x54c531(_0x59c59[_0xf2c7('0x24')][_0xf2c7('0x27')]);}else{logger['info'](_0xf2c7('0x26'),_0x19da78,'request\x20sent');_0x54c531(_0x59c59[_0xf2c7('0x28')][_0xf2c7('0x27')]);}})[_0xf2c7('0x29')](function(_0x1089ce){logger[_0xf2c7('0x24')](_0xf2c7('0x26'),_0x19da78,_0x1089ce);_0x141158(_0x1089ce);});});}function respondWithStatusCode(_0x405192,_0x287d91){_0x287d91=_0x287d91||0xcc;return function(_0x47df67){if(_0x47df67){return _0x405192[_0xf2c7('0x2a')](_0x287d91);}return _0x405192[_0xf2c7('0x2b')](_0x287d91)[_0xf2c7('0x2c')]();};}function respondWithResult(_0x1a21fb,_0x1dfcf2){_0x1dfcf2=_0x1dfcf2||0xc8;return function(_0x6e669e){if(_0x6e669e){return _0x1a21fb[_0xf2c7('0x2b')](_0x1dfcf2)['json'](_0x6e669e);}};}function respondWithFilteredResult(_0x2a11fe,_0x54c18e){return function(_0x228f00){if(_0x228f00){var _0x494de6=_0x228f00[_0xf2c7('0x2d')],_0x2f0e80=_0x54c18e[_0xf2c7('0x2e')],_0x3cbcef=_0x54c18e[_0xf2c7('0x2e')]+_0x54c18e[_0xf2c7('0x2f')],_0x56a97c;if(_0x3cbcef>=_0x494de6){_0x3cbcef=_0x494de6;_0x56a97c=0xc8;}else{_0x56a97c=0xce;}_0x2a11fe[_0xf2c7('0x2b')](_0x56a97c);return _0x2a11fe['set'](_0xf2c7('0x30'),_0x2f0e80+'-'+_0x3cbcef+'/'+_0x494de6)['json'](_0x228f00);}return null;};}function patchUpdates(_0x46afa8){return function(_0x58c4ce){try{jsonpatch[_0xf2c7('0x31')](_0x58c4ce,_0x46afa8,!![]);}catch(_0x4e2dfe){return BPromise[_0xf2c7('0x32')](_0x4e2dfe);}return _0x58c4ce[_0xf2c7('0x33')]();};}function saveUpdates(_0x920125,_0x64086){return function(_0x44111a){if(_0x44111a){return _0x44111a[_0xf2c7('0x34')](_0x920125)[_0xf2c7('0x20')](function(_0x564b5d){return _0x564b5d;});}return null;};}function removeEntity(_0x14531b,_0x56f27a){return function(_0x23d265){if(_0x23d265){return _0x23d265[_0xf2c7('0x35')]()[_0xf2c7('0x20')](function(){var _0x9794e1=_0x23d265['get']({'plain':!![]});var _0x4d35ee=_0xf2c7('0x36');return db['UserProfileResource'][_0xf2c7('0x35')]({'where':{'type':_0x4d35ee,'resourceId':_0x9794e1['id']}})[_0xf2c7('0x20')](function(){return _0x23d265;});})['then'](function(){_0x14531b[_0xf2c7('0x2b')](0xcc)[_0xf2c7('0x2c')]();});}};}function handleEntityNotFound(_0x561e01,_0x1311bc){return function(_0x219be8){if(!_0x219be8){_0x561e01[_0xf2c7('0x2a')](0x194);}return _0x219be8;};}function handleError(_0x1c79cd,_0x5a7f49){_0x5a7f49=_0x5a7f49||0x1f4;return function(_0x52fe83){logger['error'](_0x52fe83[_0xf2c7('0x37')]);if(_0x52fe83[_0xf2c7('0x38')]){delete _0x52fe83[_0xf2c7('0x38')];}_0x1c79cd[_0xf2c7('0x2b')](_0x5a7f49)[_0xf2c7('0x39')](_0x52fe83);};}exports['index']=function(_0x23f6e3,_0xcf73c8){var _0x5c50d8={'include':[{'model':db['Pause'],'as':_0xf2c7('0x3a')}]},_0xdd16a4={},_0x5335ef={'count':0x0,'rows':[]};var _0x41fa8b=_[_0xf2c7('0x3b')](db['SmsAccount'][_0xf2c7('0x3c')],function(_0x378637){return{'name':_0x378637[_0xf2c7('0x3d')],'type':_0x378637['type'][_0xf2c7('0x3e')]};});_0xdd16a4[_0xf2c7('0x3f')]=_['map'](_0x41fa8b,_0xf2c7('0x38'));_0xdd16a4[_0xf2c7('0x40')]=_[_0xf2c7('0x41')](_0x23f6e3['query']);_0xdd16a4[_0xf2c7('0x42')]=_[_0xf2c7('0x43')](_0xdd16a4[_0xf2c7('0x3f')],_0xdd16a4[_0xf2c7('0x40')]);_0x5c50d8[_0xf2c7('0x44')]=_['intersection'](_0xdd16a4[_0xf2c7('0x3f')],qs[_0xf2c7('0x45')](_0x23f6e3[_0xf2c7('0x40')][_0xf2c7('0x45')]));_0x5c50d8[_0xf2c7('0x44')]=_0x5c50d8[_0xf2c7('0x44')][_0xf2c7('0x46')]?_0x5c50d8[_0xf2c7('0x44')]:_0xdd16a4[_0xf2c7('0x3f')];if(!_0x23f6e3[_0xf2c7('0x40')][_0xf2c7('0x47')]('nolimit')){_0x5c50d8[_0xf2c7('0x2f')]=qs['limit'](_0x23f6e3[_0xf2c7('0x40')][_0xf2c7('0x2f')]);_0x5c50d8[_0xf2c7('0x2e')]=qs[_0xf2c7('0x2e')](_0x23f6e3[_0xf2c7('0x40')][_0xf2c7('0x2e')]);}_0x5c50d8[_0xf2c7('0x48')]=qs['sort'](_0x23f6e3['query'][_0xf2c7('0x49')]);_0x5c50d8[_0xf2c7('0x4a')]=qs[_0xf2c7('0x42')](_[_0xf2c7('0x4b')](_0x23f6e3[_0xf2c7('0x40')],_0xdd16a4['filters']),_0x41fa8b);if(_0x23f6e3['query']['filter']){_0x5c50d8[_0xf2c7('0x4a')]=_[_0xf2c7('0x4c')](_0x5c50d8[_0xf2c7('0x4a')],{'$or':_[_0xf2c7('0x3b')](_0x41fa8b,function(_0x8a1c49){if(_0x8a1c49[_0xf2c7('0x4d')]!==_0xf2c7('0x4e')){var _0x248417={};_0x248417[_0x8a1c49[_0xf2c7('0x38')]]={'$like':'%'+_0x23f6e3[_0xf2c7('0x40')]['filter']+'%'};return _0x248417;}})});}_0x5c50d8=_[_0xf2c7('0x4c')]({},_0x5c50d8,_0x23f6e3[_0xf2c7('0x4f')]);var _0x3b396d={'where':_0x5c50d8['where']};return db[_0xf2c7('0x50')]['count'](_0x3b396d)[_0xf2c7('0x20')](function(_0x214e65){_0x5335ef[_0xf2c7('0x2d')]=_0x214e65;if(_0x23f6e3[_0xf2c7('0x40')][_0xf2c7('0x51')]){_0x5c50d8['include']=[{'all':!![]}];}return db['SmsAccount'][_0xf2c7('0x52')](_0x5c50d8);})[_0xf2c7('0x20')](function(_0x532af9){_0x5335ef[_0xf2c7('0x53')]=_0x532af9;return _0x5335ef;})[_0xf2c7('0x20')](respondWithFilteredResult(_0xcf73c8,_0x5c50d8))[_0xf2c7('0x29')](handleError(_0xcf73c8,null));};exports[_0xf2c7('0x54')]=function(_0x1961b2,_0x1196d8){var _0x3dd73d={'raw':![],'where':{'id':_0x1961b2[_0xf2c7('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0xf2c7('0x3a')}]},_0x318ae4={};_0x318ae4[_0xf2c7('0x3f')]=_['keys'](db[_0xf2c7('0x50')]['rawAttributes']);_0x318ae4[_0xf2c7('0x40')]=_['keys'](_0x1961b2[_0xf2c7('0x40')]);_0x318ae4['filters']=_['intersection'](_0x318ae4[_0xf2c7('0x3f')],_0x318ae4['query']);_0x3dd73d['attributes']=_['intersection'](_0x318ae4[_0xf2c7('0x3f')],qs[_0xf2c7('0x45')](_0x1961b2['query'][_0xf2c7('0x45')]));_0x3dd73d[_0xf2c7('0x44')]=_0x3dd73d[_0xf2c7('0x44')][_0xf2c7('0x46')]?_0x3dd73d['attributes']:_0x318ae4[_0xf2c7('0x3f')];if(_0x1961b2[_0xf2c7('0x40')][_0xf2c7('0x51')]){_0x3dd73d['include']=[{'all':!![]}];}_0x3dd73d=_['merge']({},_0x3dd73d,_0x1961b2['options']);return db[_0xf2c7('0x50')][_0xf2c7('0x56')](_0x3dd73d)[_0xf2c7('0x20')](handleEntityNotFound(_0x1196d8,null))['then'](respondWithResult(_0x1196d8,null))['catch'](handleError(_0x1196d8,null));};exports[_0xf2c7('0x57')]=function(_0x1c5d40,_0x46ebd2){return db[_0xf2c7('0x50')][_0xf2c7('0x57')](_0x1c5d40[_0xf2c7('0x58')],{})[_0xf2c7('0x20')](function(_0x117e33){var _0x202938=_0x1c5d40[_0xf2c7('0x59')]['get']({'plain':!![]});if(!_0x202938)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x202938['role']==='user'){var _0xe91cfd=_0x117e33[_0xf2c7('0x5a')]({'plain':!![]});var _0x58e50e=_0xf2c7('0x36');return db[_0xf2c7('0x5b')][_0xf2c7('0x56')]({'where':{'name':_0x58e50e,'userProfileId':_0x202938[_0xf2c7('0x5c')]},'raw':!![]})[_0xf2c7('0x20')](function(_0x17d4bc){if(_0x17d4bc&&_0x17d4bc[_0xf2c7('0x5d')]===0x0){return db[_0xf2c7('0x5e')][_0xf2c7('0x57')]({'name':_0xe91cfd[_0xf2c7('0x38')],'resourceId':_0xe91cfd['id'],'type':_0x17d4bc[_0xf2c7('0x38')],'sectionId':_0x17d4bc['id']},{})[_0xf2c7('0x20')](function(){return _0x117e33;});}else{return _0x117e33;}})[_0xf2c7('0x29')](function(_0x5c0c83){logger[_0xf2c7('0x24')](_0xf2c7('0x5f'),_0x5c0c83);throw _0x5c0c83;});}return _0x117e33;})[_0xf2c7('0x20')](respondWithResult(_0x46ebd2,0xc9))['catch'](handleError(_0x46ebd2,null));};exports['update']=function(_0x37a6a4,_0x10eec3){if(_0x37a6a4[_0xf2c7('0x58')]['id']){delete _0x37a6a4[_0xf2c7('0x58')]['id'];}return db['SmsAccount'][_0xf2c7('0x56')]({'where':{'id':_0x37a6a4[_0xf2c7('0x55')]['id']},'include':[{'model':db[_0xf2c7('0x60')],'as':_0xf2c7('0x3a')}]})[_0xf2c7('0x20')](handleEntityNotFound(_0x10eec3,null))['then'](saveUpdates(_0x37a6a4['body'],null))[_0xf2c7('0x20')](respondWithResult(_0x10eec3,null))[_0xf2c7('0x29')](handleError(_0x10eec3,null));};exports['destroy']=function(_0x4ce8a2,_0x50935e){return db[_0xf2c7('0x50')]['find']({'where':{'id':_0x4ce8a2['params']['id']}})[_0xf2c7('0x20')](handleEntityNotFound(_0x50935e,null))['then'](removeEntity(_0x50935e,null))[_0xf2c7('0x29')](handleError(_0x50935e,null));};exports[_0xf2c7('0x61')]=function(_0x1cd938,_0x31be64){return db['SmsAccount'][_0xf2c7('0x61')]()[_0xf2c7('0x20')](respondWithResult(_0x31be64,null))[_0xf2c7('0x29')](handleError(_0x31be64,null));};exports[_0xf2c7('0x62')]=function(_0x450bc7,_0x4cfe88,_0xe3a15a){if(_0x450bc7[_0xf2c7('0x58')]['id']){delete _0x450bc7[_0xf2c7('0x58')]['id'];}return db[_0xf2c7('0x50')][_0xf2c7('0x56')]({'where':{'id':_0x450bc7[_0xf2c7('0x55')]['id']}})['then'](handleEntityNotFound(_0x4cfe88,null))[_0xf2c7('0x20')](function(_0x34e087){if(_0x34e087){_0x450bc7['body'][_0xf2c7('0x63')]=_0x34e087['id'];return db['Disposition']['create'](_0x450bc7[_0xf2c7('0x58')]);}})[_0xf2c7('0x20')](respondWithResult(_0x4cfe88,null))[_0xf2c7('0x29')](handleError(_0x4cfe88,null));};exports[_0xf2c7('0x64')]=function(_0x4cbda4,_0x118c47,_0x1f242a){var _0x5365d1={'raw':![],'where':{}};var _0x193936={};var _0x4a245f={'count':0x0,'rows':[]};return db['SmsAccount'][_0xf2c7('0x65')]({'where':{'id':_0x4cbda4[_0xf2c7('0x55')]['id']}})[_0xf2c7('0x20')](handleEntityNotFound(_0x118c47,null))[_0xf2c7('0x20')](function(_0x2bd8f7){if(_0x2bd8f7){_0x193936['model']=_[_0xf2c7('0x41')](db[_0xf2c7('0x66')]['rawAttributes']);_0x193936[_0xf2c7('0x40')]=_[_0xf2c7('0x41')](_0x4cbda4[_0xf2c7('0x40')]);_0x193936['filters']=_['intersection'](_0x193936['model'],_0x193936[_0xf2c7('0x40')]);_0x5365d1[_0xf2c7('0x44')]=_[_0xf2c7('0x43')](_0x193936[_0xf2c7('0x3f')],qs['fields'](_0x4cbda4[_0xf2c7('0x40')][_0xf2c7('0x45')]));_0x5365d1[_0xf2c7('0x44')]=_0x5365d1[_0xf2c7('0x44')][_0xf2c7('0x46')]?_0x5365d1[_0xf2c7('0x44')]:_0x193936[_0xf2c7('0x3f')];if(!_0x4cbda4[_0xf2c7('0x40')][_0xf2c7('0x47')]('nolimit')){_0x5365d1['limit']=qs[_0xf2c7('0x2f')](_0x4cbda4[_0xf2c7('0x40')]['limit']);_0x5365d1[_0xf2c7('0x2e')]=qs[_0xf2c7('0x2e')](_0x4cbda4[_0xf2c7('0x40')]['offset']);}_0x5365d1[_0xf2c7('0x48')]=qs[_0xf2c7('0x49')](_0x4cbda4[_0xf2c7('0x40')][_0xf2c7('0x49')]);_0x5365d1[_0xf2c7('0x4a')]=qs[_0xf2c7('0x42')](_['pick'](_0x4cbda4['query'],_0x193936[_0xf2c7('0x42')]));_0x5365d1[_0xf2c7('0x4a')][_0xf2c7('0x63')]=_0x2bd8f7['id'];if(_0x4cbda4[_0xf2c7('0x40')][_0xf2c7('0x67')]){_0x5365d1[_0xf2c7('0x4a')]=_[_0xf2c7('0x4c')](_0x5365d1[_0xf2c7('0x4a')],{'$or':_[_0xf2c7('0x3b')](_0x5365d1[_0xf2c7('0x44')],function(_0x8dd070){var _0xdb5961={};_0xdb5961[_0x8dd070]={'$like':'%'+_0x4cbda4[_0xf2c7('0x40')][_0xf2c7('0x67')]+'%'};return _0xdb5961;})});}_0x5365d1=_[_0xf2c7('0x4c')]({},_0x5365d1,_0x4cbda4['options']);return db[_0xf2c7('0x66')]['count']({'where':_0x5365d1[_0xf2c7('0x4a')]})[_0xf2c7('0x20')](function(_0x71af85){_0x4a245f[_0xf2c7('0x2d')]=_0x71af85;if(_0x4cbda4[_0xf2c7('0x40')][_0xf2c7('0x51')]){_0x5365d1['include']=[{'all':!![]}];}return db[_0xf2c7('0x66')]['findAll'](_0x5365d1);})['then'](function(_0x5e66cc){_0x4a245f[_0xf2c7('0x53')]=_0x5e66cc;return _0x4a245f;});}})[_0xf2c7('0x20')](respondWithFilteredResult(_0x118c47,_0x5365d1))[_0xf2c7('0x29')](handleError(_0x118c47,null));};exports['removeDispositions']=function(_0x22e09d,_0x143121,_0xed0b96){return db[_0xf2c7('0x50')][_0xf2c7('0x56')]({'where':{'id':_0x22e09d['params']['id']}})[_0xf2c7('0x20')](handleEntityNotFound(_0x143121,null))[_0xf2c7('0x20')](function(_0xd6ba79){if(_0xd6ba79){return _0xd6ba79[_0xf2c7('0x68')](_0x22e09d[_0xf2c7('0x40')][_0xf2c7('0x69')]);}})[_0xf2c7('0x20')](respondWithStatusCode(_0x143121,null))[_0xf2c7('0x29')](handleError(_0x143121,null));};exports[_0xf2c7('0x6a')]=function(_0x39db26,_0x168066,_0x3e222a){if(_0x39db26[_0xf2c7('0x58')]['id']){delete _0x39db26[_0xf2c7('0x58')]['id'];}return db[_0xf2c7('0x50')][_0xf2c7('0x56')]({'where':{'id':_0x39db26[_0xf2c7('0x55')]['id']}})[_0xf2c7('0x20')](handleEntityNotFound(_0x168066,null))['then'](function(_0x25dc30){if(_0x25dc30){_0x39db26[_0xf2c7('0x58')][_0xf2c7('0x63')]=_0x25dc30['id'];return db[_0xf2c7('0x6b')][_0xf2c7('0x57')](_0x39db26[_0xf2c7('0x58')]);}})[_0xf2c7('0x20')](respondWithResult(_0x168066,null))['catch'](handleError(_0x168066,null));};exports['getAnswers']=function(_0x10dd8a,_0xc8f210,_0x2e04d6){var _0x24d55b={'raw':![],'where':{}};var _0x2a07b3={};var _0x2633f9={'count':0x0,'rows':[]};return db[_0xf2c7('0x50')][_0xf2c7('0x65')]({'where':{'id':_0x10dd8a['params']['id']}})['then'](handleEntityNotFound(_0xc8f210,null))[_0xf2c7('0x20')](function(_0x3e6e30){if(_0x3e6e30){_0x2a07b3[_0xf2c7('0x3f')]=_[_0xf2c7('0x41')](db[_0xf2c7('0x6b')][_0xf2c7('0x3c')]);_0x2a07b3[_0xf2c7('0x40')]=_['keys'](_0x10dd8a[_0xf2c7('0x40')]);_0x2a07b3[_0xf2c7('0x42')]=_[_0xf2c7('0x43')](_0x2a07b3[_0xf2c7('0x3f')],_0x2a07b3[_0xf2c7('0x40')]);_0x24d55b[_0xf2c7('0x44')]=_['intersection'](_0x2a07b3['model'],qs[_0xf2c7('0x45')](_0x10dd8a[_0xf2c7('0x40')][_0xf2c7('0x45')]));_0x24d55b[_0xf2c7('0x44')]=_0x24d55b[_0xf2c7('0x44')][_0xf2c7('0x46')]?_0x24d55b[_0xf2c7('0x44')]:_0x2a07b3[_0xf2c7('0x3f')];if(!_0x10dd8a[_0xf2c7('0x40')][_0xf2c7('0x47')](_0xf2c7('0x6c'))){_0x24d55b[_0xf2c7('0x2f')]=qs[_0xf2c7('0x2f')](_0x10dd8a[_0xf2c7('0x40')]['limit']);_0x24d55b[_0xf2c7('0x2e')]=qs[_0xf2c7('0x2e')](_0x10dd8a[_0xf2c7('0x40')][_0xf2c7('0x2e')]);}_0x24d55b[_0xf2c7('0x48')]=qs['sort'](_0x10dd8a[_0xf2c7('0x40')][_0xf2c7('0x49')]);_0x24d55b[_0xf2c7('0x4a')]=qs[_0xf2c7('0x42')](_[_0xf2c7('0x4b')](_0x10dd8a[_0xf2c7('0x40')],_0x2a07b3[_0xf2c7('0x42')]));_0x24d55b[_0xf2c7('0x4a')][_0xf2c7('0x63')]=_0x3e6e30['id'];if(_0x10dd8a['query']['filter']){_0x24d55b[_0xf2c7('0x4a')]=_[_0xf2c7('0x4c')](_0x24d55b[_0xf2c7('0x4a')],{'$or':_[_0xf2c7('0x3b')](_0x24d55b[_0xf2c7('0x44')],function(_0x32d00b){var _0x3066ee={};_0x3066ee[_0x32d00b]={'$like':'%'+_0x10dd8a[_0xf2c7('0x40')][_0xf2c7('0x67')]+'%'};return _0x3066ee;})});}_0x24d55b=_[_0xf2c7('0x4c')]({},_0x24d55b,_0x10dd8a[_0xf2c7('0x4f')]);return db['CannedAnswer'][_0xf2c7('0x2d')]({'where':_0x24d55b[_0xf2c7('0x4a')]})['then'](function(_0xb0e40e){_0x2633f9['count']=_0xb0e40e;if(_0x10dd8a[_0xf2c7('0x40')]['includeAll']){_0x24d55b[_0xf2c7('0x6d')]=[{'all':!![]}];}return db[_0xf2c7('0x6b')][_0xf2c7('0x52')](_0x24d55b);})['then'](function(_0x5d9681){_0x2633f9['rows']=_0x5d9681;return _0x2633f9;});}})[_0xf2c7('0x20')](respondWithFilteredResult(_0xc8f210,_0x24d55b))['catch'](handleError(_0xc8f210,null));};exports['removeAnswers']=function(_0x5266aa,_0x2ce69d,_0xd97de7){return db[_0xf2c7('0x50')][_0xf2c7('0x56')]({'where':{'id':_0x5266aa[_0xf2c7('0x55')]['id']}})[_0xf2c7('0x20')](handleEntityNotFound(_0x2ce69d,null))[_0xf2c7('0x20')](function(_0x9eeefb){if(_0x9eeefb){return _0x9eeefb['removeAnswers'](_0x5266aa['query'][_0xf2c7('0x69')]);}})[_0xf2c7('0x20')](respondWithStatusCode(_0x2ce69d,null))[_0xf2c7('0x29')](handleError(_0x2ce69d,null));};exports[_0xf2c7('0x6e')]=function(_0x574730,_0x8a6759,_0x459312){var _0x5d2707={'channel':_0xf2c7('0x6f')};var _0x290462=[];var _0x43e5df=[];var _0x92f395={};return db['SmsAccount'][_0xf2c7('0x56')]({'where':{'id':_0x574730[_0xf2c7('0x55')]['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})[_0xf2c7('0x20')](handleEntityNotFound(_0x8a6759,null))[_0xf2c7('0x20')](function(_0x295097){_0x5d2707[_0xf2c7('0x70')]=_0x295097;_0x5d2707['applications']=_[_0xf2c7('0x71')](_0x295097['Applications'],[_0xf2c7('0x72')],[_0xf2c7('0x73')]);if(_0x5d2707[_0xf2c7('0x70')]['Applications']){delete _0x5d2707[_0xf2c7('0x70')][_0xf2c7('0x74')];}return db['CmContact'][_0xf2c7('0x61')]();})[_0xf2c7('0x20')](function(_0x22b77c){if(!_0x22b77c){throw new db['Sequelize'][(_0xf2c7('0x75'))](_0xf2c7('0x76'));}_0x290462=_[_0xf2c7('0x77')](_['keys'](_0x22b77c),[_0xf2c7('0x78'),_0xf2c7('0x79')]);_0x43e5df=_[_0xf2c7('0x77')](_[_0xf2c7('0x41')](_0x22b77c),[_0xf2c7('0x78'),_0xf2c7('0x79'),_0xf2c7('0x7a'),_0xf2c7('0x7b')]);_0x5d2707['body']={'mapKey':_0xf2c7('0x7c')};if(_0x5d2707[_0xf2c7('0x70')][_0xf2c7('0x4d')]){switch(_0x5d2707[_0xf2c7('0x70')]['type']){case'twilio':_0x5d2707[_0xf2c7('0x58')][_0xf2c7('0x7d')]=_0x574730['body'][_0xf2c7('0x7e')];_0x5d2707[_0xf2c7('0x58')][_0xf2c7('0x58')]=_0x574730[_0xf2c7('0x58')][_0xf2c7('0x7f')];_0x5d2707[_0xf2c7('0x58')][_0xf2c7('0x80')]=_0x574730['body'][_0xf2c7('0x81')];break;case'skebby':_0x5d2707[_0xf2c7('0x58')]['from']='+'+_0x574730['body'][_0xf2c7('0x82')];_0x5d2707['body'][_0xf2c7('0x58')]=_0x574730[_0xf2c7('0x58')][_0xf2c7('0x83')];break;case'connectel':_0x5d2707['body'][_0xf2c7('0x7d')]=_0x574730['body'][_0xf2c7('0x7d')];_0x5d2707[_0xf2c7('0x58')][_0xf2c7('0x58')]=_0x574730['body'][_0xf2c7('0x27')];break;case _0xf2c7('0x84'):_0x5d2707[_0xf2c7('0x58')]['from']=_0x574730['body'][_0xf2c7('0x7d')];_0x5d2707[_0xf2c7('0x58')][_0xf2c7('0x58')]=_0x574730[_0xf2c7('0x58')]['body'];_0x5d2707[_0xf2c7('0x58')][_0xf2c7('0x80')]=_0x574730[_0xf2c7('0x58')][_0xf2c7('0x85')];break;case _0xf2c7('0x86'):_0x5d2707['body'][_0xf2c7('0x7d')]=_0x574730['body']['From'];_0x5d2707[_0xf2c7('0x58')]['body']=_0x574730[_0xf2c7('0x58')][_0xf2c7('0x87')];_0x5d2707[_0xf2c7('0x58')][_0xf2c7('0x80')]=_0x574730[_0xf2c7('0x58')]['MessageUUID'];break;case'infobip':_0x5d2707['body'][_0xf2c7('0x7d')]='+'+_0x574730[_0xf2c7('0x58')]['results'][0x0][_0xf2c7('0x7d')];_0x5d2707[_0xf2c7('0x58')][_0xf2c7('0x58')]=_0x574730[_0xf2c7('0x58')]['results'][0x0]['text'];_0x5d2707['body'][_0xf2c7('0x80')]=_0x574730[_0xf2c7('0x58')][_0xf2c7('0x88')][0x0][_0xf2c7('0x80')];break;case'csc':_0x5d2707[_0xf2c7('0x58')][_0xf2c7('0x7d')]=_0x574730['body'][_0xf2c7('0x89')];_0x5d2707['body'][_0xf2c7('0x58')]=_0x574730[_0xf2c7('0x58')][_0xf2c7('0x8a')][_0xf2c7('0x27')];break;case _0xf2c7('0x8b'):_0x5d2707['body'][_0xf2c7('0x7d')]=_0x574730[_0xf2c7('0x58')][_0xf2c7('0x8c')];_0x5d2707['body']['body']=_0x574730['body'][_0xf2c7('0x83')];_0x5d2707['body'][_0xf2c7('0x80')]=_0x574730[_0xf2c7('0x58')][_0xf2c7('0x8d')];break;case'bandwidth':_0x5d2707[_0xf2c7('0x58')][_0xf2c7('0x80')]=_0x574730['body'][0x0][_0xf2c7('0x27')]['id'];_0x5d2707[_0xf2c7('0x58')][_0xf2c7('0x7d')]=_0x574730['body'][0x0][_0xf2c7('0x27')]['from'];_0x5d2707[_0xf2c7('0x58')][_0xf2c7('0x58')]=_0x574730[_0xf2c7('0x58')][0x0][_0xf2c7('0x27')][_0xf2c7('0x83')];break;case'intelepeer':_0x5d2707[_0xf2c7('0x58')][_0xf2c7('0x7d')]=_0x574730[_0xf2c7('0x58')][_0xf2c7('0x7d')];_0x5d2707[_0xf2c7('0x58')][_0xf2c7('0x58')]=_0x574730[_0xf2c7('0x58')][_0xf2c7('0x27')];_0x5d2707[_0xf2c7('0x58')]['messageId']=_0x574730['body'][_0xf2c7('0x8e')];break;}}if(_0x5d2707[_0xf2c7('0x58')]['id']){delete _0x5d2707['body']['id'];}if(_[_0xf2c7('0x8f')](_0x5d2707[_0xf2c7('0x58')][_0xf2c7('0x7d')])){throw new db[(_0xf2c7('0x90'))]['ValidationError'](_0xf2c7('0x91'));}if(_[_0xf2c7('0x8f')](_0x5d2707[_0xf2c7('0x58')][_0xf2c7('0x58')])||_0x5d2707[_0xf2c7('0x58')]['body']===''){throw new db[(_0xf2c7('0x90'))]['ValidationError'](_0xf2c7('0x92'));}if(_[_0xf2c7('0x8f')](_0x5d2707[_0xf2c7('0x58')][_0xf2c7('0x93')])){throw new db[(_0xf2c7('0x90'))][(_0xf2c7('0x75'))](_0xf2c7('0x94')+_0x43e5df);}if(!_['includes'](_0x43e5df,_0x5d2707[_0xf2c7('0x58')][_0xf2c7('0x93')])){throw new db[(_0xf2c7('0x90'))][(_0xf2c7('0x75'))](_0xf2c7('0x95')+_0x43e5df);}_0x92f395[_0x5d2707[_0xf2c7('0x58')][_0xf2c7('0x93')]]=_0x5d2707[_0xf2c7('0x58')][_0xf2c7('0x7d')];return db[_0xf2c7('0x96')][_0xf2c7('0x56')]({'where':{'id':_0x5d2707[_0xf2c7('0x70')][_0xf2c7('0x7b')]},'include':[{'model':db[_0xf2c7('0x97')],'as':_0xf2c7('0x98'),'where':_0x92f395,'limit':0x1,'order':[[_0xf2c7('0x79'),_0xf2c7('0x99')]]}]});})['then'](handleEntityNotFound(_0x8a6759,null))[_0xf2c7('0x20')](function(_0x3dd826){if(_0x3dd826){_0x5d2707[_0xf2c7('0x9a')]=_[_0xf2c7('0x9b')](_0x3dd826,[_0xf2c7('0x98')]);if(_0x3dd826[_0xf2c7('0x98')][_0xf2c7('0x46')]){return _0x3dd826[_0xf2c7('0x98')][0x0];}var _0x40da69=_['defaults'](_0x5d2707[_0xf2c7('0x58')],{'firstName':_0x5d2707[_0xf2c7('0x58')][_0xf2c7('0x7d')],'ListId':_0x3dd826['id']});_0x40da69[_0x5d2707['body']['mapKey']]=_0x5d2707[_0xf2c7('0x58')][_0xf2c7('0x7d')];return db['CmContact'][_0xf2c7('0x57')](_0x40da69,{'fields':_0x290462,'raw':!![]});}})[_0xf2c7('0x20')](handleEntityNotFound(_0x8a6759,null))[_0xf2c7('0x20')](function(_0x2463a2){if(_0x2463a2){_0x5d2707['contact']=_0x2463a2;var _0x5dae7e={'ContactId':_0x2463a2['id'],'phone':_0x5d2707[_0xf2c7('0x58')][_0xf2c7('0x7d')],'SmsAccountId':_0x574730[_0xf2c7('0x55')]['id']};var _0x3b9433={'ContactId':_0x2463a2['id'],'SmsAccountId':_0x574730[_0xf2c7('0x55')]['id'],'closed':![]};return db[_0xf2c7('0x9c')][_0xf2c7('0x56')]({'where':_0x3b9433})[_0xf2c7('0x20')](function(_0x538aae){if(_0x538aae){return[_0x538aae,![]];}return db[_0xf2c7('0x9c')][_0xf2c7('0x57')](_0x5dae7e)[_0xf2c7('0x20')](function(_0xb60ab7){return[_0xb60ab7,!![]];});});}})['spread'](function(_0x22cc5f,_0x69c2d6){_0x5d2707[_0xf2c7('0x9d')]=_0x22cc5f[_0xf2c7('0x5a')]({'plain':!![]});_0x5d2707[_0xf2c7('0x9d')][_0xf2c7('0x9e')]=![];if(_0x69c2d6){if(_0x5d2707[_0xf2c7('0x70')][_0xf2c7('0x9f')]){_0x5d2707[_0xf2c7('0xa0')][_0xf2c7('0xa1')]({'id':0x0,'priority':_0x5d2707['applications'][_0xf2c7('0x46')]+0x1,'app':_0xf2c7('0xa2'),'appdata':'unmanaged','interval':_0xf2c7('0xa3')});}_0x5d2707['interaction'][_0xf2c7('0x9e')]=!![];}return db[_0xf2c7('0xa4')][_0xf2c7('0x57')]({'phone':_0x5d2707[_0xf2c7('0x58')][_0xf2c7('0x7d')],'messageId':_0x5d2707[_0xf2c7('0x58')][_0xf2c7('0x80')],'body':_0x5d2707['body']['body'],'SmsAccountId':_0x574730[_0xf2c7('0x55')]['id'],'SmsInteractionId':_0x22cc5f['id'],'direction':'in','ContactId':_0x22cc5f[_0xf2c7('0xa5')],'AttachmentId':_0x5d2707[_0xf2c7('0x58')][_0xf2c7('0xa6')]});})['then'](function(_0x11835d){_0x5d2707[_0xf2c7('0x27')]=_0x11835d;if(_0x5d2707[_0xf2c7('0x9d')]['UserId']){return db[_0xf2c7('0xa7')][_0xf2c7('0x56')]({'attributes':['id','name'],'where':{'id':_0x5d2707[_0xf2c7('0x9d')][_0xf2c7('0xa8')]}})[_0xf2c7('0x20')](function(_0x220012){if(_0x220012){_0x5d2707[_0xf2c7('0xa0')][_0xf2c7('0xa9')]({'id':0x0,'priority':0x0,'app':_0xf2c7('0xaa'),'appdata':_0x220012[_0xf2c7('0x38')]+','+(_0x5d2707[_0xf2c7('0x70')]['waitForTheAssignedAgent']||0xa),'interval':_0xf2c7('0xa3')});}return respondWithRpcPromise(_0xf2c7('0xab'),_0xf2c7('0xac'),_0x5d2707);});}return respondWithRpcPromise('Start',_0xf2c7('0xac'),_0x5d2707);})['then'](function(_0xdaad60){if(_0xdaad60){var _0xf3b29b=0xc8;var _0x22b0d0=_0xf2c7('0xad');logger[_0xf2c7('0xae')](_0xf2c7('0x23'),_0x22b0d0,_0xf3b29b,_0xf2c7('0xaf'));logger[_0xf2c7('0x22')](_0xf2c7('0xb0'),_0x22b0d0,_0xf3b29b,_0xf2c7('0xaf'),JSON[_0xf2c7('0xb1')](_0xdaad60));if(_0x5d2707[_0xf2c7('0x70')]['type']===_0xf2c7('0xb2')){return _0x8a6759['status'](_0xf3b29b)[_0xf2c7('0xb3')](_0xf2c7('0xb4'),_0xf2c7('0xb5'))[_0xf2c7('0x39')](_0xf2c7('0xb6'));}else{return _0x8a6759[_0xf2c7('0x2b')](_0xf3b29b)['json'](_0xdaad60);}}})[_0xf2c7('0x29')](handleError(_0x8a6759,null));};exports['addApplications']=function(_0x2b91ce,_0x49bc7f,_0x13f993){return db[_0xf2c7('0x50')][_0xf2c7('0x65')]({'where':{'id':_0x2b91ce[_0xf2c7('0x55')]['id']}})[_0xf2c7('0x20')](handleEntityNotFound(_0x49bc7f,null))['then'](function(_0x5a7951){if(_0x5a7951){return db[_0xf2c7('0xb7')][_0xf2c7('0xb8')](function(_0x388d5f){return db[_0xf2c7('0xb9')][_0xf2c7('0x35')]({'where':{'SmsAccountId':_0x2b91ce['params']['id']},'transaction':_0x388d5f})[_0xf2c7('0x20')](function(_0x374a63){var _0x220f3c=_[_0xf2c7('0x3b')](_0x2b91ce[_0xf2c7('0x58')],function(_0x1ee185){_0x1ee185[_0xf2c7('0x63')]=_0x2b91ce['params']['id'];return _0x1ee185;});return db['SmsApplication'][_0xf2c7('0xba')](_0x220f3c,{'transaction':_0x388d5f});});})[_0xf2c7('0x20')](function(){return db['SmsApplication'][_0xf2c7('0xbb')]({'where':{'SmsAccountId':_0x2b91ce['params']['id']},'order':_0xf2c7('0x72')});});}})[_0xf2c7('0x20')](respondWithResult(_0x49bc7f,null))[_0xf2c7('0x29')](handleError(_0x49bc7f,null));};exports[_0xf2c7('0xbc')]=function(_0x4cbb57,_0x3deaa6,_0x3128d6){var _0x36ff9b={};var _0x36419e={};var _0x364f9b;var _0x522106;return db[_0xf2c7('0x50')][_0xf2c7('0x65')]({'where':{'id':_0x4cbb57['params']['id']}})[_0xf2c7('0x20')](handleEntityNotFound(_0x3deaa6,null))[_0xf2c7('0x20')](function(_0x153641){if(_0x153641){_0x364f9b=_0x153641;_0x36419e[_0xf2c7('0x3f')]=_[_0xf2c7('0x41')](db[_0xf2c7('0xb9')][_0xf2c7('0x3c')]);_0x36419e['query']=_[_0xf2c7('0x41')](_0x4cbb57[_0xf2c7('0x40')]);_0x36419e[_0xf2c7('0x42')]=_[_0xf2c7('0x43')](_0x36419e['model'],_0x36419e[_0xf2c7('0x40')]);_0x36ff9b[_0xf2c7('0x44')]=_[_0xf2c7('0x43')](_0x36419e[_0xf2c7('0x3f')],qs[_0xf2c7('0x45')](_0x4cbb57[_0xf2c7('0x40')][_0xf2c7('0x45')]));_0x36ff9b['attributes']=_0x36ff9b[_0xf2c7('0x44')]['length']?_0x36ff9b[_0xf2c7('0x44')]:_0x36419e[_0xf2c7('0x3f')];_0x36ff9b[_0xf2c7('0x48')]=qs[_0xf2c7('0x49')](_0x4cbb57[_0xf2c7('0x40')]['sort']);_0x36ff9b[_0xf2c7('0x4a')]=qs[_0xf2c7('0x42')](_[_0xf2c7('0x4b')](_0x4cbb57[_0xf2c7('0x40')],_0x36419e[_0xf2c7('0x42')]));if(_0x4cbb57[_0xf2c7('0x40')][_0xf2c7('0x67')]){_0x36ff9b[_0xf2c7('0x4a')]=_['merge'](_0x36ff9b['where'],{'$or':_['map'](_0x36ff9b['attributes'],function(_0x179adf){var _0x14be8a={};_0x14be8a[_0x179adf]={'$like':'%'+_0x4cbb57['query'][_0xf2c7('0x67')]+'%'};return _0x14be8a;})});}_0x36ff9b=_[_0xf2c7('0x4c')]({},_0x36ff9b,_0x4cbb57[_0xf2c7('0x4f')]);return _0x364f9b['getApplications'](_0x36ff9b);}})[_0xf2c7('0x20')](function(_0x1fbe84){if(_0x1fbe84){_0x522106=_0x1fbe84[_0xf2c7('0x46')];if(!_0x4cbb57[_0xf2c7('0x40')][_0xf2c7('0x47')](_0xf2c7('0x6c'))){_0x36ff9b['limit']=qs['limit'](_0x4cbb57[_0xf2c7('0x40')][_0xf2c7('0x2f')]);_0x36ff9b['offset']=qs[_0xf2c7('0x2e')](_0x4cbb57['query'][_0xf2c7('0x2e')]);}return _0x364f9b['getApplications'](_0x36ff9b);}})[_0xf2c7('0x20')](function(_0x3cc8a3){if(_0x3cc8a3){return _0x3cc8a3?{'count':_0x522106,'rows':_0x3cc8a3}:null;}})[_0xf2c7('0x20')](respondWithResult(_0x3deaa6,null))[_0xf2c7('0x29')](handleError(_0x3deaa6,null));};exports[_0xf2c7('0xbd')]=function(_0x405a26,_0x302d66,_0x3bc3ad){var _0x3c014f={'raw':![],'where':{}};var _0x3d9b25={};var _0x4d2e4d={'count':0x0,'rows':[]};return db[_0xf2c7('0x50')][_0xf2c7('0x65')]({'where':{'id':_0x405a26[_0xf2c7('0x55')]['id']}})[_0xf2c7('0x20')](handleEntityNotFound(_0x302d66,null))[_0xf2c7('0x20')](function(_0x1a1e0e){if(_0x1a1e0e){_0x3d9b25[_0xf2c7('0x3f')]=_[_0xf2c7('0x41')](db[_0xf2c7('0x9c')][_0xf2c7('0x3c')]);_0x3d9b25[_0xf2c7('0x40')]=_[_0xf2c7('0x41')](_0x405a26[_0xf2c7('0x40')]);_0x3d9b25[_0xf2c7('0x42')]=_[_0xf2c7('0x43')](_0x3d9b25[_0xf2c7('0x3f')],_0x3d9b25[_0xf2c7('0x40')]);_0x3c014f[_0xf2c7('0x44')]=_[_0xf2c7('0x43')](_0x3d9b25[_0xf2c7('0x3f')],qs[_0xf2c7('0x45')](_0x405a26[_0xf2c7('0x40')][_0xf2c7('0x45')]));_0x3c014f[_0xf2c7('0x44')]=_0x3c014f['attributes'][_0xf2c7('0x46')]?_0x3c014f[_0xf2c7('0x44')]:_0x3d9b25[_0xf2c7('0x3f')];if(!_0x405a26[_0xf2c7('0x40')][_0xf2c7('0x47')](_0xf2c7('0x6c'))){_0x3c014f[_0xf2c7('0x2f')]=qs[_0xf2c7('0x2f')](_0x405a26[_0xf2c7('0x40')][_0xf2c7('0x2f')]);_0x3c014f[_0xf2c7('0x2e')]=qs[_0xf2c7('0x2e')](_0x405a26[_0xf2c7('0x40')][_0xf2c7('0x2e')]);}_0x3c014f[_0xf2c7('0x48')]=qs[_0xf2c7('0x49')](_0x405a26['query'][_0xf2c7('0x49')]);_0x3c014f['where']=qs[_0xf2c7('0x42')](_[_0xf2c7('0x4b')](_0x405a26[_0xf2c7('0x40')],_0x3d9b25[_0xf2c7('0x42')]));_0x3c014f['where'][_0xf2c7('0x63')]=_0x1a1e0e['id'];if(_0x405a26['query']['filter']){_0x3c014f['where']=_['merge'](_0x3c014f['where'],{'$or':_[_0xf2c7('0x3b')](_0x3c014f['attributes'],function(_0x1fb918){var _0x16c49f={};_0x16c49f[_0x1fb918]={'$like':'%'+_0x405a26[_0xf2c7('0x40')]['filter']+'%'};return _0x16c49f;})});}_0x3c014f=_[_0xf2c7('0x4c')]({},_0x3c014f,_0x405a26['options']);return db[_0xf2c7('0x9c')][_0xf2c7('0x2d')]({'where':_0x3c014f[_0xf2c7('0x4a')]})[_0xf2c7('0x20')](function(_0x2451f9){_0x4d2e4d['count']=_0x2451f9;if(_0x405a26[_0xf2c7('0x40')][_0xf2c7('0x51')]){_0x3c014f['include']=[{'model':db[_0xf2c7('0x97')],'as':_0xf2c7('0xbe'),'required':![]},{'model':db[_0xf2c7('0xa7')],'as':_0xf2c7('0xbf'),'attributes':[_0xf2c7('0x38'),_0xf2c7('0xc0'),_0xf2c7('0xc1')],'required':![]},{'model':db['Tag'],'as':_0xf2c7('0xc2'),'attributes':['id',_0xf2c7('0x38'),_0xf2c7('0xc3')],'where':_0x405a26[_0xf2c7('0x40')][_0xf2c7('0xc4')]?{'id':_0x405a26[_0xf2c7('0x40')]['tag']}:undefined,'required':_0x405a26[_0xf2c7('0x40')][_0xf2c7('0xc4')]?!![]:![]}];}return db['SmsInteraction'][_0xf2c7('0x52')](_0x3c014f);})['then'](function(_0x238e14){_0x4d2e4d[_0xf2c7('0x53')]=_0x238e14;return _0x4d2e4d;});}})[_0xf2c7('0x20')](respondWithFilteredResult(_0x302d66,_0x3c014f))[_0xf2c7('0x29')](handleError(_0x302d66,null));};exports['send']=function(_0x547ea4,_0x1ec690,_0x333ef0){var _0x436a56,_0x3885b4,_0xe7efa0;if(_[_0xf2c7('0x8f')](_0x547ea4[_0xf2c7('0x58')][_0xf2c7('0x58')])||_0x547ea4[_0xf2c7('0x58')][_0xf2c7('0x58')]===''){throw new db[(_0xf2c7('0x90'))][(_0xf2c7('0x75'))](_0xf2c7('0x92'));}if(_[_0xf2c7('0x8f')](_0x547ea4[_0xf2c7('0x58')]['to'])){throw new db['Sequelize'][(_0xf2c7('0x75'))](_0xf2c7('0xc5'));}_0x436a56=_0x547ea4[_0xf2c7('0x58')]['to'];return db[_0xf2c7('0x50')][_0xf2c7('0x56')]({'where':{'id':_0x547ea4[_0xf2c7('0x55')]['id']},'include':[{'model':db[_0xf2c7('0x96')],'as':'List','include':[{'model':db[_0xf2c7('0x97')],'as':_0xf2c7('0x98'),'where':{'mobile':_0x436a56},'limit':0x1,'order':[[_0xf2c7('0x79'),_0xf2c7('0x99')]]}]}]})[_0xf2c7('0x20')](handleEntityNotFound(_0x1ec690,null))['then'](function(_0x4c5ad3){if(_0x4c5ad3&&_0x4c5ad3[_0xf2c7('0xc6')]){_0x3885b4=_0x4c5ad3['get']({'plain':!![]});if(_0x3885b4['List']&&_0x3885b4[_0xf2c7('0xc6')][_0xf2c7('0x98')]['length']){return _0x3885b4['List'][_0xf2c7('0x98')][0x0];}return db[_0xf2c7('0x97')]['create'](_[_0xf2c7('0x17')](_0x547ea4['body'],{'firstName':_0x436a56,'mobile':_0x436a56,'phone':_0x436a56,'ListId':_0x3885b4[_0xf2c7('0x7b')]}));}})[_0xf2c7('0x20')](handleEntityNotFound(_0x1ec690,null))['then'](function(_0x596b22){if(_0x596b22){_0xe7efa0=_0x596b22;return db['SmsInteraction'][_0xf2c7('0x56')]({'where':{'ContactId':_0xe7efa0['id'],'closed':![],'SmsAccountId':_0x3885b4['id']}})[_0xf2c7('0x20')](function(_0x3689ef){if(_0x3689ef){return[_0x3689ef,![]];}return db[_0xf2c7('0x9c')][_0xf2c7('0x57')]({'UserId':_0x547ea4[_0xf2c7('0x59')]['id'],'ContactId':_0xe7efa0['id'],'SmsAccountId':_0x3885b4['id'],'phone':_0x436a56,'firstMsgDirection':_0xf2c7('0xc7'),'Messages':[_[_0xf2c7('0x4c')](_0x547ea4[_0xf2c7('0x58')],{'read':![],'body':_0x547ea4[_0xf2c7('0x58')][_0xf2c7('0x58')],'phone':_0x436a56,'SmsAccountId':_0x3885b4['id'],'UserId':_0x547ea4[_0xf2c7('0x59')]['id'],'ContactId':_0xe7efa0['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xf2c7('0xc8')}]})[_0xf2c7('0x20')](function(_0x4345b6){return[_0x4345b6,!![]];});});}})['spread'](function(_0x5da66a,_0x4dad30){if(_0x4dad30){return _0x5da66a;}return db[_0xf2c7('0xa4')][_0xf2c7('0x57')](_[_0xf2c7('0x4c')](_0x547ea4['body'],{'read':![],'body':_0x547ea4[_0xf2c7('0x58')][_0xf2c7('0x58')],'phone':_0x436a56,'SmsAccountId':_0x3885b4['id'],'SmsInteractionId':_0x5da66a['id'],'UserId':_0x547ea4[_0xf2c7('0x59')]['id'],'ContactId':_0xe7efa0['id']}))[_0xf2c7('0x20')](function(_0x85bc1b){_0x5da66a[_0xf2c7('0xc9')]['Messages']=[];_0x5da66a[_0xf2c7('0xc9')][_0xf2c7('0xc8')]['push'](_0x85bc1b['dataValues']);return _0x5da66a;});})[_0xf2c7('0x20')](respondWithResult(_0x1ec690,null))[_0xf2c7('0x29')](handleError(_0x1ec690,null));};exports[_0xf2c7('0x2b')]=function(_0xaae0a1,_0x2d85f6,_0x332338){if(_0xaae0a1[_0xf2c7('0x58')]['id']){delete _0xaae0a1[_0xf2c7('0x58')]['id'];}var _0x26a42f,_0x3debf3,_0x1336c0;return db[_0xf2c7('0x50')][_0xf2c7('0x56')]({'where':{'id':_0xaae0a1['params']['id']}})[_0xf2c7('0x20')](handleEntityNotFound(_0x2d85f6,null))[_0xf2c7('0x20')](function(_0x3cca67){if(_0x3cca67){_0x1336c0=_0x3cca67;logger[_0xf2c7('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf2c7('0x2b'),_0xf2c7('0xca'),_0x3cca67[_0xf2c7('0x4d')],util[_0xf2c7('0xcb')](_0xaae0a1[_0xf2c7('0x58')],{'showHidden':![],'depth':null}));switch(_0x3cca67[_0xf2c7('0x4d')]){case _0xf2c7('0xcc'):if(_0xaae0a1[_0xf2c7('0x58')][_0xf2c7('0xcd')]&&_0xaae0a1['body'][_0xf2c7('0x2b')]){_0x3debf3=_0xaae0a1[_0xf2c7('0x58')]['status'];return db['SmsMessage'][_0xf2c7('0x56')]({'where':{'messageId':_0xaae0a1[_0xf2c7('0x58')][_0xf2c7('0xcd')]}});}break;case _0xf2c7('0xce'):if(_0xaae0a1[_0xf2c7('0x58')][_0xf2c7('0xcf')]&&_0xaae0a1[_0xf2c7('0x58')][_0xf2c7('0xd0')]){_0x3debf3=_0xaae0a1[_0xf2c7('0x58')][_0xf2c7('0xd0')];return db['SmsMessage'][_0xf2c7('0x56')]({'where':{'messageId':_0xaae0a1[_0xf2c7('0x58')][_0xf2c7('0xcf')]}});}break;case'clicksend':if(_0xaae0a1['body'][_0xf2c7('0x85')]&&_0xaae0a1[_0xf2c7('0x58')][_0xf2c7('0xd1')]){_0x3debf3=_0xaae0a1[_0xf2c7('0x58')][_0xf2c7('0xd1')];return db[_0xf2c7('0xa4')][_0xf2c7('0x56')]({'where':{'messageId':_0xaae0a1['body'][_0xf2c7('0x85')]}});}break;case _0xf2c7('0xd2'):var _0x4f3f79=_0xaae0a1[_0xf2c7('0x58')]['results'][0x0];if(_0x4f3f79[_0xf2c7('0x80')]&&_0x4f3f79['status']['groupName']===_0xf2c7('0xd3')){_0x3debf3=_0x4f3f79[_0xf2c7('0x2b')][_0xf2c7('0xd4')];return db[_0xf2c7('0xa4')][_0xf2c7('0x56')]({'where':{'messageId':_0x4f3f79[_0xf2c7('0x80')]}});}break;case'clickatell':if(_0xaae0a1[_0xf2c7('0x58')][_0xf2c7('0x80')]&&_0xaae0a1[_0xf2c7('0x58')][_0xf2c7('0x2b')]){_0x3debf3=_0xaae0a1[_0xf2c7('0x58')]['status'];return db[_0xf2c7('0xa4')][_0xf2c7('0x56')]({'where':{'messageId':_0xaae0a1['body']['messageId']}});}break;case'bandwidth':if(_0xaae0a1[_0xf2c7('0x58')][0x0][_0xf2c7('0x27')]['id']){_0x3debf3=_0xaae0a1[_0xf2c7('0x58')][0x0]['type'];return db[_0xf2c7('0xa4')][_0xf2c7('0x56')]({'where':{'messageId':_0xaae0a1[_0xf2c7('0x58')][0x0][_0xf2c7('0x27')]['id']}});}break;case _0xf2c7('0xd5'):if(_0xaae0a1[_0xf2c7('0x58')][_0xf2c7('0xd6')]&&_0xaae0a1[_0xf2c7('0x58')]['status']){_0x3debf3=_0xaae0a1[_0xf2c7('0x58')][_0xf2c7('0x2b')];return db['SmsMessage']['find']({'where':{'messageId':_0xaae0a1[_0xf2c7('0x58')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x2d85f6,null))[_0xf2c7('0x20')](function(_0x3f5742){if(_0x3f5742){_0x26a42f=_0x3f5742;switch(_0x1336c0[_0xf2c7('0x4d')]){case _0xf2c7('0xcc'):if(_0x3debf3===_0xf2c7('0xd3')){return _0x26a42f['update']({'read':!![]});}else{logger[_0xf2c7('0x24')](_0xf2c7('0x23'),_0xf2c7('0x2b'),_0xf2c7('0xcc'),util['inspect'](_0xaae0a1[_0xf2c7('0x58')],{'showHidden':![],'depth':null}));}break;case _0xf2c7('0xce'):if(_0x3debf3==='1'){return _0x26a42f[_0xf2c7('0x34')]({'read':!![]});}else{logger['error'](_0xf2c7('0x23'),_0xf2c7('0x2b'),'skebby',util[_0xf2c7('0xcb')](_0xaae0a1[_0xf2c7('0x58')],{'showHidden':![],'depth':null}));}break;case _0xf2c7('0x84'):if(!_0xaae0a1[_0xf2c7('0x58')]['error_code']&&_0x3debf3>=0xc8&&_0x3debf3<=0xce){return _0x26a42f[_0xf2c7('0x34')]({'read':!![]});}else{logger[_0xf2c7('0x24')](_0xf2c7('0x23'),_0xf2c7('0x2b'),_0xf2c7('0x84'),util[_0xf2c7('0xcb')](_0xaae0a1[_0xf2c7('0x58')],{'showHidden':![],'depth':null}));}break;case _0xf2c7('0xd2'):var _0x13ed14=_0xaae0a1[_0xf2c7('0x58')][_0xf2c7('0x88')][0x0];if(_0x13ed14['status']['groupName']===_0xf2c7('0xd3')){return _0x26a42f[_0xf2c7('0x34')]({'read':!![]});}else{logger[_0xf2c7('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf2c7('0x2b'),_0xf2c7('0xd2'),util['inspect'](_0xaae0a1[_0xf2c7('0x58')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x3debf3==_0xf2c7('0xd7')||_0x3debf3==_0xf2c7('0xd8')){return _0x26a42f['update']({'read':!![]});}else{logger[_0xf2c7('0x24')](_0xf2c7('0x23'),_0xf2c7('0x2b'),_0xf2c7('0x8b'),util[_0xf2c7('0xcb')](_0xaae0a1[_0xf2c7('0x58')],{'showHidden':![],'depth':null}));}break;case _0xf2c7('0xd9'):if(_0x3debf3==_0xf2c7('0xda')){return _0x26a42f[_0xf2c7('0x34')]({'read':!![]});}else{logger['error'](_0xf2c7('0x23'),'status',_0xf2c7('0xd9'),util[_0xf2c7('0xcb')](_0xaae0a1['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x3debf3===_0xf2c7('0xdb')||_0x3debf3===_0xf2c7('0xdc')){return _0x26a42f['update']({'read':!![]});}else{logger[_0xf2c7('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf2c7('0x2b'),_0xf2c7('0xd5'),util['inspect'](_0xaae0a1[_0xf2c7('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x26a42f;}})[_0xf2c7('0x20')](respondWithResult(_0x2d85f6,null))[_0xf2c7('0x29')](handleError(_0x2d85f6,null));};exports[_0xf2c7('0xdd')]=function(_0x18da52,_0x1dae5e,_0x35ae6b){var _0x42380b,_0x59c8e8,_0x485761;return db[_0xf2c7('0x50')][_0xf2c7('0x56')]({'where':{'id':_0x18da52['params']['id']}})[_0xf2c7('0x20')](handleEntityNotFound(_0x1dae5e,null))[_0xf2c7('0x20')](function(_0x3f7f7a){if(_0x3f7f7a){_0x485761=_0x3f7f7a;logger[_0xf2c7('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0x3f7f7a['type'],util[_0xf2c7('0xcb')](_0x18da52[_0xf2c7('0x40')],{'showHidden':![],'depth':null}));switch(_0x3f7f7a[_0xf2c7('0x4d')]){case'csc':if(_0x18da52[_0xf2c7('0x40')][_0xf2c7('0xde')]&&_0x18da52[_0xf2c7('0x40')][_0xf2c7('0xdf')]){_0x59c8e8=_0x18da52[_0xf2c7('0x40')][_0xf2c7('0xdf')];return db['SmsMessage']['find']({'where':{'messageId':_0x18da52[_0xf2c7('0x40')][_0xf2c7('0xde')]}});}break;}}})[_0xf2c7('0x20')](handleEntityNotFound(_0x1dae5e,null))[_0xf2c7('0x20')](function(_0x1d5486){if(_0x1d5486){_0x42380b=_0x1d5486;switch(_0x485761['type']){case _0xf2c7('0xe0'):if(_0x59c8e8==='2'||_0x59c8e8==='6'){return _0x42380b['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xf2c7('0xe0'),util[_0xf2c7('0xcb')](_0x18da52[_0xf2c7('0x40')],{'showHidden':![],'depth':null}));};break;}return _0x42380b;}})[_0xf2c7('0x20')](respondWithResult(_0x1dae5e,null))[_0xf2c7('0x29')](handleError(_0x1dae5e,null));};exports[_0xf2c7('0xe1')]=function(_0x6db888,_0x441bd1,_0x4f5f0f){return db[_0xf2c7('0x50')]['find']({'where':{'id':_0x6db888[_0xf2c7('0x55')]['id']}})[_0xf2c7('0x20')](handleEntityNotFound(_0x441bd1,null))[_0xf2c7('0x20')](function(_0xc58910){if(_0xc58910){return _0xc58910[_0xf2c7('0xe1')](_0x6db888[_0xf2c7('0x58')][_0xf2c7('0x69')],_[_0xf2c7('0x9b')](_0x6db888[_0xf2c7('0x58')],[_0xf2c7('0x69'),'id'])||{})[_0xf2c7('0xe2')](function(_0x41cb8e){for(var _0x5781b4=0x0;_0x5781b4<_0x6db888['body']['ids']['length'];_0x5781b4+=0x1){socket[_0xf2c7('0xe3')](_0xf2c7('0xe4'),{'UserId':_0x6db888[_0xf2c7('0x58')][_0xf2c7('0x69')][_0x5781b4],'SmsAccountId':_0x6db888[_0xf2c7('0x55')]['id']});}return _0x41cb8e;});}})[_0xf2c7('0x20')](respondWithResult(_0x441bd1,null))[_0xf2c7('0x29')](handleError(_0x441bd1,null));};exports[_0xf2c7('0xe5')]=function(_0x475086,_0x3edbc9,_0x71d516){return db[_0xf2c7('0x50')]['find']({'where':{'id':_0x475086['params']['id']}})[_0xf2c7('0x20')](handleEntityNotFound(_0x3edbc9,null))[_0xf2c7('0x20')](function(_0x176b55){if(_0x176b55){return _0x176b55[_0xf2c7('0xe5')](_0x475086['query'][_0xf2c7('0x69')])['then'](function(){if(_[_0xf2c7('0xe6')](_0x475086['query']['ids'])){for(var _0xd777fc=0x0;_0xd777fc<_0x475086[_0xf2c7('0x40')][_0xf2c7('0x69')][_0xf2c7('0x46')];_0xd777fc+=0x1){socket['emit'](_0xf2c7('0xe7'),{'UserId':Number(_0x475086[_0xf2c7('0x40')][_0xf2c7('0x69')][_0xd777fc]),'SmsAccountId':Number(_0x475086[_0xf2c7('0x55')]['id'])});}}else{socket[_0xf2c7('0xe3')](_0xf2c7('0xe7'),{'UserId':Number(_0x475086[_0xf2c7('0x40')]['ids']),'SmsAccountId':Number(_0x475086[_0xf2c7('0x55')]['id'])});}});}})[_0xf2c7('0x20')](respondWithStatusCode(_0x3edbc9,null))[_0xf2c7('0x29')](handleError(_0x3edbc9,null));};exports[_0xf2c7('0xe8')]=function(_0x4e8a85,_0x1c49e2,_0x2a4fce){var _0xd3de16={};var _0x14ae73={};var _0x62c079;var _0x175758;return db[_0xf2c7('0x50')][_0xf2c7('0x65')]({'where':{'id':_0x4e8a85['params']['id']}})[_0xf2c7('0x20')](handleEntityNotFound(_0x1c49e2,null))[_0xf2c7('0x20')](function(_0x44d63f){if(_0x44d63f){_0x62c079=_0x44d63f;_0x14ae73[_0xf2c7('0x3f')]=_[_0xf2c7('0x41')](db['User'][_0xf2c7('0x3c')]);_0x14ae73[_0xf2c7('0x40')]=_[_0xf2c7('0x41')](_0x4e8a85[_0xf2c7('0x40')]);_0x14ae73[_0xf2c7('0x42')]=_[_0xf2c7('0x43')](_0x14ae73[_0xf2c7('0x3f')],_0x14ae73[_0xf2c7('0x40')]);_0xd3de16[_0xf2c7('0x44')]=_[_0xf2c7('0x43')](_0x14ae73[_0xf2c7('0x3f')],qs[_0xf2c7('0x45')](_0x4e8a85['query'][_0xf2c7('0x45')]));_0xd3de16[_0xf2c7('0x44')]=_0xd3de16[_0xf2c7('0x44')][_0xf2c7('0x46')]?_0xd3de16['attributes']:_0x14ae73[_0xf2c7('0x3f')];_0xd3de16[_0xf2c7('0x48')]=qs[_0xf2c7('0x49')](_0x4e8a85[_0xf2c7('0x40')][_0xf2c7('0x49')]);_0xd3de16[_0xf2c7('0x4a')]=qs[_0xf2c7('0x42')](_[_0xf2c7('0x4b')](_0x4e8a85[_0xf2c7('0x40')],_0x14ae73[_0xf2c7('0x42')]));if(_0x4e8a85['query'][_0xf2c7('0x67')]){_0xd3de16[_0xf2c7('0x4a')]=_['merge'](_0xd3de16['where'],{'$or':_[_0xf2c7('0x3b')](_0xd3de16[_0xf2c7('0x44')],function(_0x1c9815){var _0x5dcc32={};_0x5dcc32[_0x1c9815]={'$like':'%'+_0x4e8a85[_0xf2c7('0x40')]['filter']+'%'};return _0x5dcc32;})});}_0xd3de16=_[_0xf2c7('0x4c')]({},_0xd3de16,_0x4e8a85['options']);return _0x62c079[_0xf2c7('0xe8')](_0xd3de16);}})[_0xf2c7('0x20')](function(_0x4c0079){if(_0x4c0079){_0x175758=_0x4c0079['length'];if(!_0x4e8a85[_0xf2c7('0x40')]['hasOwnProperty'](_0xf2c7('0x6c'))){_0xd3de16[_0xf2c7('0x2f')]=qs[_0xf2c7('0x2f')](_0x4e8a85['query'][_0xf2c7('0x2f')]);_0xd3de16[_0xf2c7('0x2e')]=qs[_0xf2c7('0x2e')](_0x4e8a85['query']['offset']);}return _0x62c079[_0xf2c7('0xe8')](_0xd3de16);}})[_0xf2c7('0x20')](function(_0x32520d){if(_0x32520d){return _0x32520d?{'count':_0x175758,'rows':_0x32520d}:null;}})[_0xf2c7('0x20')](respondWithResult(_0x1c49e2,null))['catch'](handleError(_0x1c49e2,null));}; \ No newline at end of file +var _0x8d4b=['SmsApplication','findAndCountAll','getApplications','getInteractions','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','Messages','spread','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','infobip','groupName','redif','connectel','update','DELIVERED','RECEIVED_BY_RECIPIENT','bandwidth','message-delivered','DELIVRD','ACCEPTD','message-id','state','emit','removeAgents','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','json','reject','save','destroy','get','UserProfileResource','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','include','findAll','rows','params','rawAttributes','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','create','getDispositions','findOne','Disposition','SmsAccountId','includeAll','removeDispositions','ids','CannedAnswer','removeAnswers','notify','applications','Applications','priority','asc','account','CmContact','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','twilio','From','Body','skebby','from','sender','text','messageId','message_id','Text','MessageUUID','results','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','refid','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','DESC','list','omit','Contacts','contact','SmsInteraction','interaction','autoclose','push','close','unmanaged','created','SmsMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','Start','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','addApplications','sequelize','transaction'];(function(_0x2f922f,_0x34a14f){var _0x4a63d4=function(_0x251b57){while(--_0x251b57){_0x2f922f['push'](_0x2f922f['shift']());}};_0x4a63d4(++_0x34a14f);}(_0x8d4b,0x103));var _0xb8d4=function(_0x447998,_0x299092){_0x447998=_0x447998-0x0;var _0x2cc4a6=_0x8d4b[_0x447998];return _0x2cc4a6;};'use strict';var pdf=require(_0xb8d4('0x0'));var emlformat=require(_0xb8d4('0x1'));var rimraf=require(_0xb8d4('0x2'));var zipdir=require(_0xb8d4('0x3'));var jsonpatch=require(_0xb8d4('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb8d4('0x5'));var Mustache=require(_0xb8d4('0x6'));var util=require(_0xb8d4('0x7'));var path=require(_0xb8d4('0x8'));var sox=require(_0xb8d4('0x9'));var csv=require(_0xb8d4('0xa'));var ejs=require(_0xb8d4('0xb'));var fs=require('fs');var fs_extra=require(_0xb8d4('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb8d4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb8d4('0xe'));var toCsv=require(_0xb8d4('0xa'));var querystring=require(_0xb8d4('0xf'));var Papa=require('papaparse');var Redis=require(_0xb8d4('0x10'));var authService=require(_0xb8d4('0x11'));var qs=require(_0xb8d4('0x12'));var as=require(_0xb8d4('0x13'));var hardwareService=require(_0xb8d4('0x14'));var logger=require(_0xb8d4('0x15'))(_0xb8d4('0x16'));var utils=require(_0xb8d4('0x17'));var config=require(_0xb8d4('0x18'));var licenseUtil=require(_0xb8d4('0x19'));var db=require(_0xb8d4('0x1a'))['db'];config['redis']=_[_0xb8d4('0x1b')](config[_0xb8d4('0x1c')],{'host':_0xb8d4('0x1d'),'port':0x18eb});var socket=require(_0xb8d4('0x1e'))(new Redis(config[_0xb8d4('0x1c')]));require(_0xb8d4('0x1f'))[_0xb8d4('0x20')](socket);var jayson=require(_0xb8d4('0x21'));var client=jayson['client'][_0xb8d4('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x49d91e,_0x5729ae,_0x2a67a4,_0x219267){return new BPromise(function(_0x827847,_0x43eddf){var _0x558efc=_0x219267||client;return _0x558efc[_0xb8d4('0x23')](_0x49d91e,_0x2a67a4)[_0xb8d4('0x24')](function(_0x2f57d3){logger[_0xb8d4('0x25')](_0xb8d4('0x26'),_0x5729ae,_0xb8d4('0x27'));logger[_0xb8d4('0x28')](_0xb8d4('0x29'),_0x5729ae,_0xb8d4('0x27'),JSON[_0xb8d4('0x2a')](_0x2f57d3));if(_0x2f57d3[_0xb8d4('0x2b')]){if(_0x2f57d3[_0xb8d4('0x2b')][_0xb8d4('0x2c')]===0x1f4){logger['error'](_0xb8d4('0x26'),_0x5729ae,_0x2f57d3[_0xb8d4('0x2b')][_0xb8d4('0x2d')]);return _0x43eddf(_0x2f57d3[_0xb8d4('0x2b')][_0xb8d4('0x2d')]);}logger['error'](_0xb8d4('0x26'),_0x5729ae,_0x2f57d3[_0xb8d4('0x2b')][_0xb8d4('0x2d')]);return _0x827847(_0x2f57d3[_0xb8d4('0x2b')][_0xb8d4('0x2d')]);}else{logger[_0xb8d4('0x25')](_0xb8d4('0x26'),_0x5729ae,_0xb8d4('0x27'));_0x827847(_0x2f57d3[_0xb8d4('0x2e')]['message']);}})[_0xb8d4('0x2f')](function(_0x555f6f){logger[_0xb8d4('0x2b')](_0xb8d4('0x26'),_0x5729ae,_0x555f6f);_0x43eddf(_0x555f6f);});});}function respondWithStatusCode(_0x586e6d,_0xadbe5e){_0xadbe5e=_0xadbe5e||0xcc;return function(_0x170438){if(_0x170438){return _0x586e6d[_0xb8d4('0x30')](_0xadbe5e);}return _0x586e6d[_0xb8d4('0x31')](_0xadbe5e)[_0xb8d4('0x32')]();};}function respondWithResult(_0x4bcbda,_0x2d6680){_0x2d6680=_0x2d6680||0xc8;return function(_0x280a2c){if(_0x280a2c){return _0x4bcbda[_0xb8d4('0x31')](_0x2d6680)['json'](_0x280a2c);}};}function respondWithFilteredResult(_0x324949,_0x28c233){return function(_0x3a65c5){if(_0x3a65c5){var _0x3c3d12=_0x3a65c5[_0xb8d4('0x33')],_0x55ea61=_0x28c233['offset'],_0x2c033a=_0x28c233[_0xb8d4('0x34')]+_0x28c233[_0xb8d4('0x35')],_0x2a3c66;if(_0x2c033a>=_0x3c3d12){_0x2c033a=_0x3c3d12;_0x2a3c66=0xc8;}else{_0x2a3c66=0xce;}_0x324949[_0xb8d4('0x31')](_0x2a3c66);return _0x324949[_0xb8d4('0x36')]('Content-Range',_0x55ea61+'-'+_0x2c033a+'/'+_0x3c3d12)[_0xb8d4('0x37')](_0x3a65c5);}return null;};}function patchUpdates(_0x5e814e){return function(_0x26a2c4){try{jsonpatch['apply'](_0x26a2c4,_0x5e814e,!![]);}catch(_0x48915a){return BPromise[_0xb8d4('0x38')](_0x48915a);}return _0x26a2c4[_0xb8d4('0x39')]();};}function saveUpdates(_0x10d9b8,_0x4b170e){return function(_0x5af2e1){if(_0x5af2e1){return _0x5af2e1['update'](_0x10d9b8)[_0xb8d4('0x24')](function(_0x5ac91f){return _0x5ac91f;});}return null;};}function removeEntity(_0x4ab74f,_0x21d143){return function(_0x5283d1){if(_0x5283d1){return _0x5283d1[_0xb8d4('0x3a')]()['then'](function(){var _0x1b79a9=_0x5283d1[_0xb8d4('0x3b')]({'plain':!![]});var _0x30c86b='SmsAccounts';return db[_0xb8d4('0x3c')]['destroy']({'where':{'type':_0x30c86b,'resourceId':_0x1b79a9['id']}})[_0xb8d4('0x24')](function(){return _0x5283d1;});})[_0xb8d4('0x24')](function(){_0x4ab74f[_0xb8d4('0x31')](0xcc)[_0xb8d4('0x32')]();});}};}function handleEntityNotFound(_0x1fc857,_0x4b4c4b){return function(_0x23895e){if(!_0x23895e){_0x1fc857['sendStatus'](0x194);}return _0x23895e;};}function handleError(_0x28a82d,_0x40071b){_0x40071b=_0x40071b||0x1f4;return function(_0xcd499d){logger['error'](_0xcd499d['stack']);if(_0xcd499d[_0xb8d4('0x3d')]){delete _0xcd499d[_0xb8d4('0x3d')];}_0x28a82d['status'](_0x40071b)[_0xb8d4('0x3e')](_0xcd499d);};}exports['index']=function(_0x6f86ae,_0x5ade26){var _0x46f7fd={'include':[{'model':db[_0xb8d4('0x3f')],'as':_0xb8d4('0x40')}]},_0x29b722={},_0x2db4b3={'count':0x0,'rows':[]};var _0x14fa83=_[_0xb8d4('0x41')](db[_0xb8d4('0x42')]['rawAttributes'],function(_0x3e7e82){return{'name':_0x3e7e82[_0xb8d4('0x43')],'type':_0x3e7e82[_0xb8d4('0x44')]['key']};});_0x29b722[_0xb8d4('0x45')]=_[_0xb8d4('0x41')](_0x14fa83,_0xb8d4('0x3d'));_0x29b722[_0xb8d4('0x46')]=_[_0xb8d4('0x47')](_0x6f86ae[_0xb8d4('0x46')]);_0x29b722[_0xb8d4('0x48')]=_[_0xb8d4('0x49')](_0x29b722['model'],_0x29b722[_0xb8d4('0x46')]);_0x46f7fd['attributes']=_['intersection'](_0x29b722[_0xb8d4('0x45')],qs[_0xb8d4('0x4a')](_0x6f86ae['query'][_0xb8d4('0x4a')]));_0x46f7fd[_0xb8d4('0x4b')]=_0x46f7fd['attributes'][_0xb8d4('0x4c')]?_0x46f7fd[_0xb8d4('0x4b')]:_0x29b722['model'];if(!_0x6f86ae[_0xb8d4('0x46')][_0xb8d4('0x4d')](_0xb8d4('0x4e'))){_0x46f7fd[_0xb8d4('0x35')]=qs['limit'](_0x6f86ae[_0xb8d4('0x46')][_0xb8d4('0x35')]);_0x46f7fd['offset']=qs[_0xb8d4('0x34')](_0x6f86ae['query']['offset']);}_0x46f7fd[_0xb8d4('0x4f')]=qs[_0xb8d4('0x50')](_0x6f86ae[_0xb8d4('0x46')][_0xb8d4('0x50')]);_0x46f7fd['where']=qs[_0xb8d4('0x48')](_[_0xb8d4('0x51')](_0x6f86ae[_0xb8d4('0x46')],_0x29b722[_0xb8d4('0x48')]),_0x14fa83);if(_0x6f86ae[_0xb8d4('0x46')]['filter']){_0x46f7fd['where']=_[_0xb8d4('0x52')](_0x46f7fd[_0xb8d4('0x53')],{'$or':_[_0xb8d4('0x41')](_0x14fa83,function(_0x57cff0){if(_0x57cff0[_0xb8d4('0x44')]!==_0xb8d4('0x54')){var _0x34a45e={};_0x34a45e[_0x57cff0[_0xb8d4('0x3d')]]={'$like':'%'+_0x6f86ae[_0xb8d4('0x46')][_0xb8d4('0x55')]+'%'};return _0x34a45e;}})});}_0x46f7fd=_['merge']({},_0x46f7fd,_0x6f86ae[_0xb8d4('0x56')]);var _0x522189={'where':_0x46f7fd['where']};return db[_0xb8d4('0x42')][_0xb8d4('0x33')](_0x522189)[_0xb8d4('0x24')](function(_0x577f5f){_0x2db4b3['count']=_0x577f5f;if(_0x6f86ae[_0xb8d4('0x46')]['includeAll']){_0x46f7fd[_0xb8d4('0x57')]=[{'all':!![]}];}return db[_0xb8d4('0x42')][_0xb8d4('0x58')](_0x46f7fd);})['then'](function(_0x1145f5){_0x2db4b3[_0xb8d4('0x59')]=_0x1145f5;return _0x2db4b3;})[_0xb8d4('0x24')](respondWithFilteredResult(_0x5ade26,_0x46f7fd))[_0xb8d4('0x2f')](handleError(_0x5ade26,null));};exports['show']=function(_0x372743,_0x111c8d){var _0x5d9539={'raw':![],'where':{'id':_0x372743[_0xb8d4('0x5a')]['id']},'include':[{'model':db[_0xb8d4('0x3f')],'as':'mandatoryDispositionPause'}]},_0x561821={};_0x561821[_0xb8d4('0x45')]=_[_0xb8d4('0x47')](db[_0xb8d4('0x42')][_0xb8d4('0x5b')]);_0x561821[_0xb8d4('0x46')]=_[_0xb8d4('0x47')](_0x372743[_0xb8d4('0x46')]);_0x561821['filters']=_[_0xb8d4('0x49')](_0x561821[_0xb8d4('0x45')],_0x561821[_0xb8d4('0x46')]);_0x5d9539[_0xb8d4('0x4b')]=_['intersection'](_0x561821[_0xb8d4('0x45')],qs[_0xb8d4('0x4a')](_0x372743[_0xb8d4('0x46')]['fields']));_0x5d9539['attributes']=_0x5d9539[_0xb8d4('0x4b')]['length']?_0x5d9539[_0xb8d4('0x4b')]:_0x561821[_0xb8d4('0x45')];if(_0x372743['query']['includeAll']){_0x5d9539[_0xb8d4('0x57')]=[{'all':!![]}];}_0x5d9539=_[_0xb8d4('0x52')]({},_0x5d9539,_0x372743[_0xb8d4('0x56')]);return db[_0xb8d4('0x42')][_0xb8d4('0x5c')](_0x5d9539)[_0xb8d4('0x24')](handleEntityNotFound(_0x111c8d,null))['then'](respondWithResult(_0x111c8d,null))[_0xb8d4('0x2f')](handleError(_0x111c8d,null));};exports['create']=function(_0x57bb49,_0x35a541){return db[_0xb8d4('0x42')]['create'](_0x57bb49['body'],{})['then'](function(_0x186d7b){var _0x41e8d6=_0x57bb49[_0xb8d4('0x5d')][_0xb8d4('0x3b')]({'plain':!![]});if(!_0x41e8d6)throw new Error(_0xb8d4('0x5e'));if(_0x41e8d6[_0xb8d4('0x5f')]===_0xb8d4('0x5d')){var _0x2ef957=_0x186d7b['get']({'plain':!![]});var _0x16f15d='SmsAccounts';return db[_0xb8d4('0x60')][_0xb8d4('0x5c')]({'where':{'name':_0x16f15d,'userProfileId':_0x41e8d6['userProfileId']},'raw':!![]})[_0xb8d4('0x24')](function(_0x2bdf20){if(_0x2bdf20&&_0x2bdf20[_0xb8d4('0x61')]===0x0){return db[_0xb8d4('0x3c')]['create']({'name':_0x2ef957[_0xb8d4('0x3d')],'resourceId':_0x2ef957['id'],'type':_0x2bdf20[_0xb8d4('0x3d')],'sectionId':_0x2bdf20['id']},{})['then'](function(){return _0x186d7b;});}else{return _0x186d7b;}})[_0xb8d4('0x2f')](function(_0x43617f){logger['error'](_0xb8d4('0x62'),_0x43617f);throw _0x43617f;});}return _0x186d7b;})[_0xb8d4('0x24')](respondWithResult(_0x35a541,0xc9))[_0xb8d4('0x2f')](handleError(_0x35a541,null));};exports['update']=function(_0x5cc5ea,_0x5c58d5){if(_0x5cc5ea[_0xb8d4('0x63')]['id']){delete _0x5cc5ea[_0xb8d4('0x63')]['id'];}return db[_0xb8d4('0x42')][_0xb8d4('0x5c')]({'where':{'id':_0x5cc5ea['params']['id']},'include':[{'model':db[_0xb8d4('0x3f')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x5c58d5,null))[_0xb8d4('0x24')](saveUpdates(_0x5cc5ea[_0xb8d4('0x63')],null))[_0xb8d4('0x24')](respondWithResult(_0x5c58d5,null))[_0xb8d4('0x2f')](handleError(_0x5c58d5,null));};exports[_0xb8d4('0x3a')]=function(_0x20d880,_0x2cf3aa){return db[_0xb8d4('0x42')]['find']({'where':{'id':_0x20d880[_0xb8d4('0x5a')]['id']}})[_0xb8d4('0x24')](handleEntityNotFound(_0x2cf3aa,null))['then'](removeEntity(_0x2cf3aa,null))[_0xb8d4('0x2f')](handleError(_0x2cf3aa,null));};exports['describe']=function(_0x467edb,_0x7856bb){return db[_0xb8d4('0x42')][_0xb8d4('0x64')]()[_0xb8d4('0x24')](respondWithResult(_0x7856bb,null))[_0xb8d4('0x2f')](handleError(_0x7856bb,null));};exports[_0xb8d4('0x65')]=function(_0x36032f,_0x1beec7,_0x375211){if(_0x36032f['body']['id']){delete _0x36032f[_0xb8d4('0x63')]['id'];}return db[_0xb8d4('0x42')][_0xb8d4('0x5c')]({'where':{'id':_0x36032f[_0xb8d4('0x5a')]['id']}})[_0xb8d4('0x24')](handleEntityNotFound(_0x1beec7,null))[_0xb8d4('0x24')](function(_0x1579e3){if(_0x1579e3){_0x36032f[_0xb8d4('0x63')]['SmsAccountId']=_0x1579e3['id'];return db['Disposition'][_0xb8d4('0x66')](_0x36032f[_0xb8d4('0x63')]);}})[_0xb8d4('0x24')](respondWithResult(_0x1beec7,null))[_0xb8d4('0x2f')](handleError(_0x1beec7,null));};exports[_0xb8d4('0x67')]=function(_0x5d04d9,_0x19c33e,_0x485ceb){var _0x2603c9={'raw':![],'where':{}};var _0x18dc15={};var _0x20b40b={'count':0x0,'rows':[]};return db[_0xb8d4('0x42')][_0xb8d4('0x68')]({'where':{'id':_0x5d04d9[_0xb8d4('0x5a')]['id']}})[_0xb8d4('0x24')](handleEntityNotFound(_0x19c33e,null))['then'](function(_0x1aa9db){if(_0x1aa9db){_0x18dc15['model']=_[_0xb8d4('0x47')](db[_0xb8d4('0x69')][_0xb8d4('0x5b')]);_0x18dc15['query']=_[_0xb8d4('0x47')](_0x5d04d9[_0xb8d4('0x46')]);_0x18dc15[_0xb8d4('0x48')]=_[_0xb8d4('0x49')](_0x18dc15[_0xb8d4('0x45')],_0x18dc15['query']);_0x2603c9[_0xb8d4('0x4b')]=_[_0xb8d4('0x49')](_0x18dc15[_0xb8d4('0x45')],qs[_0xb8d4('0x4a')](_0x5d04d9['query'][_0xb8d4('0x4a')]));_0x2603c9[_0xb8d4('0x4b')]=_0x2603c9[_0xb8d4('0x4b')][_0xb8d4('0x4c')]?_0x2603c9[_0xb8d4('0x4b')]:_0x18dc15['model'];if(!_0x5d04d9['query']['hasOwnProperty'](_0xb8d4('0x4e'))){_0x2603c9[_0xb8d4('0x35')]=qs[_0xb8d4('0x35')](_0x5d04d9[_0xb8d4('0x46')][_0xb8d4('0x35')]);_0x2603c9['offset']=qs[_0xb8d4('0x34')](_0x5d04d9['query'][_0xb8d4('0x34')]);}_0x2603c9[_0xb8d4('0x4f')]=qs[_0xb8d4('0x50')](_0x5d04d9[_0xb8d4('0x46')][_0xb8d4('0x50')]);_0x2603c9[_0xb8d4('0x53')]=qs['filters'](_['pick'](_0x5d04d9[_0xb8d4('0x46')],_0x18dc15[_0xb8d4('0x48')]));_0x2603c9[_0xb8d4('0x53')][_0xb8d4('0x6a')]=_0x1aa9db['id'];if(_0x5d04d9[_0xb8d4('0x46')][_0xb8d4('0x55')]){_0x2603c9[_0xb8d4('0x53')]=_[_0xb8d4('0x52')](_0x2603c9[_0xb8d4('0x53')],{'$or':_[_0xb8d4('0x41')](_0x2603c9[_0xb8d4('0x4b')],function(_0x3d179d){var _0x295ba2={};_0x295ba2[_0x3d179d]={'$like':'%'+_0x5d04d9[_0xb8d4('0x46')]['filter']+'%'};return _0x295ba2;})});}_0x2603c9=_['merge']({},_0x2603c9,_0x5d04d9[_0xb8d4('0x56')]);return db[_0xb8d4('0x69')][_0xb8d4('0x33')]({'where':_0x2603c9['where']})[_0xb8d4('0x24')](function(_0x5962e8){_0x20b40b[_0xb8d4('0x33')]=_0x5962e8;if(_0x5d04d9['query'][_0xb8d4('0x6b')]){_0x2603c9[_0xb8d4('0x57')]=[{'all':!![]}];}return db['Disposition'][_0xb8d4('0x58')](_0x2603c9);})[_0xb8d4('0x24')](function(_0x171bf6){_0x20b40b[_0xb8d4('0x59')]=_0x171bf6;return _0x20b40b;});}})[_0xb8d4('0x24')](respondWithFilteredResult(_0x19c33e,_0x2603c9))[_0xb8d4('0x2f')](handleError(_0x19c33e,null));};exports[_0xb8d4('0x6c')]=function(_0x5e2e4a,_0x14863a,_0x631401){return db[_0xb8d4('0x42')]['find']({'where':{'id':_0x5e2e4a[_0xb8d4('0x5a')]['id']}})['then'](handleEntityNotFound(_0x14863a,null))['then'](function(_0x1cc4e){if(_0x1cc4e){return _0x1cc4e[_0xb8d4('0x6c')](_0x5e2e4a['query'][_0xb8d4('0x6d')]);}})[_0xb8d4('0x24')](respondWithStatusCode(_0x14863a,null))['catch'](handleError(_0x14863a,null));};exports['addAnswer']=function(_0x3e6518,_0x4a1b60,_0x4bf6c4){if(_0x3e6518[_0xb8d4('0x63')]['id']){delete _0x3e6518['body']['id'];}return db['SmsAccount'][_0xb8d4('0x5c')]({'where':{'id':_0x3e6518['params']['id']}})[_0xb8d4('0x24')](handleEntityNotFound(_0x4a1b60,null))[_0xb8d4('0x24')](function(_0x1e9362){if(_0x1e9362){_0x3e6518[_0xb8d4('0x63')][_0xb8d4('0x6a')]=_0x1e9362['id'];return db[_0xb8d4('0x6e')][_0xb8d4('0x66')](_0x3e6518['body']);}})[_0xb8d4('0x24')](respondWithResult(_0x4a1b60,null))[_0xb8d4('0x2f')](handleError(_0x4a1b60,null));};exports['getAnswers']=function(_0x27d087,_0x3c9e28,_0x3e1c3a){var _0x42ae79={'raw':![],'where':{}};var _0x1dbe56={};var _0x47d87b={'count':0x0,'rows':[]};return db[_0xb8d4('0x42')][_0xb8d4('0x68')]({'where':{'id':_0x27d087[_0xb8d4('0x5a')]['id']}})[_0xb8d4('0x24')](handleEntityNotFound(_0x3c9e28,null))['then'](function(_0x4d62b4){if(_0x4d62b4){_0x1dbe56['model']=_['keys'](db['CannedAnswer'][_0xb8d4('0x5b')]);_0x1dbe56[_0xb8d4('0x46')]=_[_0xb8d4('0x47')](_0x27d087['query']);_0x1dbe56[_0xb8d4('0x48')]=_['intersection'](_0x1dbe56[_0xb8d4('0x45')],_0x1dbe56[_0xb8d4('0x46')]);_0x42ae79[_0xb8d4('0x4b')]=_[_0xb8d4('0x49')](_0x1dbe56[_0xb8d4('0x45')],qs['fields'](_0x27d087[_0xb8d4('0x46')][_0xb8d4('0x4a')]));_0x42ae79[_0xb8d4('0x4b')]=_0x42ae79[_0xb8d4('0x4b')]['length']?_0x42ae79[_0xb8d4('0x4b')]:_0x1dbe56[_0xb8d4('0x45')];if(!_0x27d087[_0xb8d4('0x46')]['hasOwnProperty'](_0xb8d4('0x4e'))){_0x42ae79[_0xb8d4('0x35')]=qs[_0xb8d4('0x35')](_0x27d087[_0xb8d4('0x46')][_0xb8d4('0x35')]);_0x42ae79['offset']=qs[_0xb8d4('0x34')](_0x27d087[_0xb8d4('0x46')]['offset']);}_0x42ae79[_0xb8d4('0x4f')]=qs[_0xb8d4('0x50')](_0x27d087['query'][_0xb8d4('0x50')]);_0x42ae79[_0xb8d4('0x53')]=qs['filters'](_[_0xb8d4('0x51')](_0x27d087['query'],_0x1dbe56[_0xb8d4('0x48')]));_0x42ae79[_0xb8d4('0x53')][_0xb8d4('0x6a')]=_0x4d62b4['id'];if(_0x27d087[_0xb8d4('0x46')][_0xb8d4('0x55')]){_0x42ae79[_0xb8d4('0x53')]=_[_0xb8d4('0x52')](_0x42ae79['where'],{'$or':_['map'](_0x42ae79['attributes'],function(_0x54de4a){var _0x177a32={};_0x177a32[_0x54de4a]={'$like':'%'+_0x27d087[_0xb8d4('0x46')][_0xb8d4('0x55')]+'%'};return _0x177a32;})});}_0x42ae79=_[_0xb8d4('0x52')]({},_0x42ae79,_0x27d087[_0xb8d4('0x56')]);return db[_0xb8d4('0x6e')][_0xb8d4('0x33')]({'where':_0x42ae79[_0xb8d4('0x53')]})[_0xb8d4('0x24')](function(_0x391ccd){_0x47d87b[_0xb8d4('0x33')]=_0x391ccd;if(_0x27d087[_0xb8d4('0x46')][_0xb8d4('0x6b')]){_0x42ae79[_0xb8d4('0x57')]=[{'all':!![]}];}return db[_0xb8d4('0x6e')][_0xb8d4('0x58')](_0x42ae79);})[_0xb8d4('0x24')](function(_0x27632b){_0x47d87b[_0xb8d4('0x59')]=_0x27632b;return _0x47d87b;});}})[_0xb8d4('0x24')](respondWithFilteredResult(_0x3c9e28,_0x42ae79))['catch'](handleError(_0x3c9e28,null));};exports[_0xb8d4('0x6f')]=function(_0x189a30,_0x274ad2,_0x14c7b6){return db[_0xb8d4('0x42')][_0xb8d4('0x5c')]({'where':{'id':_0x189a30[_0xb8d4('0x5a')]['id']}})[_0xb8d4('0x24')](handleEntityNotFound(_0x274ad2,null))[_0xb8d4('0x24')](function(_0x1e27a7){if(_0x1e27a7){return _0x1e27a7[_0xb8d4('0x6f')](_0x189a30['query'][_0xb8d4('0x6d')]);}})[_0xb8d4('0x24')](respondWithStatusCode(_0x274ad2,null))[_0xb8d4('0x2f')](handleError(_0x274ad2,null));};exports[_0xb8d4('0x70')]=function(_0x9b0f80,_0x2aa0e3,_0x3f516b){var _0x310dd5={'channel':'sms'};var _0x3af4e9=[];var _0x447ce6=[];var _0xe281b0={};return db[_0xb8d4('0x42')][_0xb8d4('0x5c')]({'where':{'id':_0x9b0f80['params']['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0x2aa0e3,null))['then'](function(_0x507ab3){_0x310dd5['account']=_0x507ab3;_0x310dd5[_0xb8d4('0x71')]=_['orderBy'](_0x507ab3[_0xb8d4('0x72')],[_0xb8d4('0x73')],[_0xb8d4('0x74')]);if(_0x310dd5[_0xb8d4('0x75')][_0xb8d4('0x72')]){delete _0x310dd5[_0xb8d4('0x75')][_0xb8d4('0x72')];}return db[_0xb8d4('0x76')][_0xb8d4('0x64')]();})[_0xb8d4('0x24')](function(_0x276c16){if(!_0x276c16){throw new db[(_0xb8d4('0x77'))]['ValidationError']('no\x20available\x20attributes');}_0x3af4e9=_[_0xb8d4('0x78')](_[_0xb8d4('0x47')](_0x276c16),[_0xb8d4('0x79'),_0xb8d4('0x7a')]);_0x447ce6=_[_0xb8d4('0x78')](_['keys'](_0x276c16),[_0xb8d4('0x79'),'updatedAt',_0xb8d4('0x7b'),_0xb8d4('0x7c')]);_0x310dd5[_0xb8d4('0x63')]={'mapKey':'mobile'};if(_0x310dd5['account'][_0xb8d4('0x44')]){switch(_0x310dd5[_0xb8d4('0x75')][_0xb8d4('0x44')]){case _0xb8d4('0x7d'):_0x310dd5['body']['from']=_0x9b0f80[_0xb8d4('0x63')][_0xb8d4('0x7e')];_0x310dd5[_0xb8d4('0x63')]['body']=_0x9b0f80[_0xb8d4('0x63')][_0xb8d4('0x7f')];_0x310dd5['body']['messageId']=_0x9b0f80[_0xb8d4('0x63')]['MessageSid'];break;case _0xb8d4('0x80'):_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x81')]='+'+_0x9b0f80[_0xb8d4('0x63')][_0xb8d4('0x82')];_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x63')]=_0x9b0f80['body'][_0xb8d4('0x83')];break;case'connectel':_0x310dd5[_0xb8d4('0x63')]['from']=_0x9b0f80[_0xb8d4('0x63')][_0xb8d4('0x81')];_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x63')]=_0x9b0f80[_0xb8d4('0x63')]['message'];break;case'clicksend':_0x310dd5['body'][_0xb8d4('0x81')]=_0x9b0f80[_0xb8d4('0x63')][_0xb8d4('0x81')];_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x63')]=_0x9b0f80[_0xb8d4('0x63')][_0xb8d4('0x63')];_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x84')]=_0x9b0f80[_0xb8d4('0x63')][_0xb8d4('0x85')];break;case'plivo':_0x310dd5[_0xb8d4('0x63')]['from']=_0x9b0f80[_0xb8d4('0x63')][_0xb8d4('0x7e')];_0x310dd5['body']['body']=_0x9b0f80[_0xb8d4('0x63')][_0xb8d4('0x86')];_0x310dd5[_0xb8d4('0x63')]['messageId']=_0x9b0f80[_0xb8d4('0x63')][_0xb8d4('0x87')];break;case'infobip':_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x81')]='+'+_0x9b0f80['body'][_0xb8d4('0x88')][0x0][_0xb8d4('0x81')];_0x310dd5['body'][_0xb8d4('0x63')]=_0x9b0f80['body'][_0xb8d4('0x88')][0x0][_0xb8d4('0x83')];_0x310dd5['body'][_0xb8d4('0x84')]=_0x9b0f80[_0xb8d4('0x63')]['results'][0x0][_0xb8d4('0x84')];break;case _0xb8d4('0x89'):_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x81')]=_0x9b0f80[_0xb8d4('0x63')]['originatingAddress'];_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x63')]=_0x9b0f80[_0xb8d4('0x63')][_0xb8d4('0x8a')][_0xb8d4('0x2d')];break;case _0xb8d4('0x8b'):_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x81')]=_0x9b0f80[_0xb8d4('0x63')][_0xb8d4('0x8c')];_0x310dd5[_0xb8d4('0x63')]['body']=_0x9b0f80['body'][_0xb8d4('0x83')];_0x310dd5['body'][_0xb8d4('0x84')]=_0x9b0f80['body'][_0xb8d4('0x8d')];break;case'bandwidth':_0x310dd5['body'][_0xb8d4('0x84')]=_0x9b0f80[_0xb8d4('0x63')][0x0]['message']['id'];_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x81')]=_0x9b0f80[_0xb8d4('0x63')][0x0]['message'][_0xb8d4('0x81')];_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x63')]=_0x9b0f80['body'][0x0][_0xb8d4('0x2d')][_0xb8d4('0x83')];break;case _0xb8d4('0x8e'):_0x310dd5['body'][_0xb8d4('0x81')]=_0x9b0f80[_0xb8d4('0x63')][_0xb8d4('0x81')];_0x310dd5[_0xb8d4('0x63')]['body']=_0x9b0f80[_0xb8d4('0x63')][_0xb8d4('0x2d')];_0x310dd5[_0xb8d4('0x63')]['messageId']=_0x9b0f80[_0xb8d4('0x63')][_0xb8d4('0x8f')];break;}}if(_0x310dd5[_0xb8d4('0x63')]['id']){delete _0x310dd5[_0xb8d4('0x63')]['id'];}if(_[_0xb8d4('0x90')](_0x310dd5[_0xb8d4('0x63')]['from'])){throw new db[(_0xb8d4('0x77'))][(_0xb8d4('0x91'))](_0xb8d4('0x92'));}if(_[_0xb8d4('0x90')](_0x310dd5['body'][_0xb8d4('0x63')])||_0x310dd5['body'][_0xb8d4('0x63')]===''){throw new db['Sequelize'][(_0xb8d4('0x91'))](_0xb8d4('0x93'));}if(_[_0xb8d4('0x90')](_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x94')])){throw new db[(_0xb8d4('0x77'))][(_0xb8d4('0x91'))](_0xb8d4('0x95')+_0x447ce6);}if(!_[_0xb8d4('0x96')](_0x447ce6,_0x310dd5['body'][_0xb8d4('0x94')])){throw new db['Sequelize'][(_0xb8d4('0x91'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x447ce6);}_0xe281b0[_0x310dd5[_0xb8d4('0x63')]['mapKey']]=_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x81')];return db[_0xb8d4('0x97')]['find']({'where':{'id':_0x310dd5[_0xb8d4('0x75')][_0xb8d4('0x7c')]},'include':[{'model':db[_0xb8d4('0x76')],'as':'Contacts','where':_0xe281b0,'limit':0x1,'order':[[_0xb8d4('0x7a'),_0xb8d4('0x98')]]}]});})['then'](handleEntityNotFound(_0x2aa0e3,null))['then'](function(_0xc322a6){if(_0xc322a6){_0x310dd5[_0xb8d4('0x99')]=_[_0xb8d4('0x9a')](_0xc322a6,[_0xb8d4('0x9b')]);if(_0xc322a6['Contacts'][_0xb8d4('0x4c')]){return _0xc322a6[_0xb8d4('0x9b')][0x0];}var _0x18a410=_['defaults'](_0x310dd5[_0xb8d4('0x63')],{'firstName':_0x310dd5['body'][_0xb8d4('0x81')],'ListId':_0xc322a6['id']});_0x18a410[_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x94')]]=_0x310dd5[_0xb8d4('0x63')]['from'];return db[_0xb8d4('0x76')]['create'](_0x18a410,{'fields':_0x3af4e9,'raw':!![]});}})[_0xb8d4('0x24')](handleEntityNotFound(_0x2aa0e3,null))[_0xb8d4('0x24')](function(_0x106496){if(_0x106496){_0x310dd5[_0xb8d4('0x9c')]=_0x106496;var _0x3a0048={'ContactId':_0x106496['id'],'phone':_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x81')],'SmsAccountId':_0x9b0f80[_0xb8d4('0x5a')]['id']};var _0x2ed70a={'ContactId':_0x106496['id'],'SmsAccountId':_0x9b0f80[_0xb8d4('0x5a')]['id'],'closed':![]};return db[_0xb8d4('0x9d')]['find']({'where':_0x2ed70a})[_0xb8d4('0x24')](function(_0x113d9d){if(_0x113d9d){return[_0x113d9d,![]];}return db[_0xb8d4('0x9d')]['create'](_0x3a0048)['then'](function(_0x1665ba){return[_0x1665ba,!![]];});});}})['spread'](function(_0x269322,_0x5eb7fe){_0x310dd5['interaction']=_0x269322[_0xb8d4('0x3b')]({'plain':!![]});_0x310dd5[_0xb8d4('0x9e')]['created']=![];if(_0x5eb7fe){if(_0x310dd5[_0xb8d4('0x75')][_0xb8d4('0x9f')]){_0x310dd5[_0xb8d4('0x71')][_0xb8d4('0xa0')]({'id':0x0,'priority':_0x310dd5[_0xb8d4('0x71')]['length']+0x1,'app':_0xb8d4('0xa1'),'appdata':_0xb8d4('0xa2'),'interval':'*,*,*,*'});}_0x310dd5[_0xb8d4('0x9e')][_0xb8d4('0xa3')]=!![];}return db[_0xb8d4('0xa4')][_0xb8d4('0x66')]({'phone':_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x81')],'messageId':_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x84')],'body':_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0x63')],'SmsAccountId':_0x9b0f80[_0xb8d4('0x5a')]['id'],'SmsInteractionId':_0x269322['id'],'direction':'in','ContactId':_0x269322['ContactId'],'AttachmentId':_0x310dd5[_0xb8d4('0x63')][_0xb8d4('0xa5')]});})[_0xb8d4('0x24')](function(_0x183cb1){_0x310dd5[_0xb8d4('0x2d')]=_0x183cb1;if(_0x310dd5['interaction'][_0xb8d4('0xa6')]){return db[_0xb8d4('0xa7')][_0xb8d4('0x5c')]({'attributes':['id',_0xb8d4('0x3d')],'where':{'id':_0x310dd5[_0xb8d4('0x9e')][_0xb8d4('0xa6')]}})[_0xb8d4('0x24')](function(_0x130519){if(_0x130519){_0x310dd5[_0xb8d4('0x71')][_0xb8d4('0xa8')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x130519[_0xb8d4('0x3d')]+','+(_0x310dd5[_0xb8d4('0x75')][_0xb8d4('0xa9')]||0xa),'interval':_0xb8d4('0xaa')});}return respondWithRpcPromise(_0xb8d4('0xab'),'startRouting',_0x310dd5);});}return respondWithRpcPromise(_0xb8d4('0xab'),'startRouting',_0x310dd5);})['then'](function(_0x38f82b){if(_0x38f82b){var _0x46ea24=0xc8;var _0xb0016='receiveMessage';logger['info'](_0xb8d4('0x29'),_0xb0016,_0x46ea24,_0xb8d4('0xac'));logger[_0xb8d4('0x28')](_0xb8d4('0xad'),_0xb0016,_0x46ea24,_0xb8d4('0xac'),JSON['stringify'](_0x38f82b));if(_0x310dd5[_0xb8d4('0x75')][_0xb8d4('0x44')]==='twilio'){return _0x2aa0e3[_0xb8d4('0x31')](_0x46ea24)[_0xb8d4('0x36')](_0xb8d4('0xae'),_0xb8d4('0xaf'))[_0xb8d4('0x3e')]('\x0a');}else{return _0x2aa0e3['status'](_0x46ea24)['json'](_0x38f82b);}}})[_0xb8d4('0x2f')](handleError(_0x2aa0e3,null));};exports[_0xb8d4('0xb0')]=function(_0x5ee759,_0x9b09a7,_0x4c131e){return db[_0xb8d4('0x42')][_0xb8d4('0x68')]({'where':{'id':_0x5ee759[_0xb8d4('0x5a')]['id']}})['then'](handleEntityNotFound(_0x9b09a7,null))[_0xb8d4('0x24')](function(_0x17c0a2){if(_0x17c0a2){return db[_0xb8d4('0xb1')][_0xb8d4('0xb2')](function(_0x651b6b){return db[_0xb8d4('0xb3')]['destroy']({'where':{'SmsAccountId':_0x5ee759[_0xb8d4('0x5a')]['id']},'transaction':_0x651b6b})[_0xb8d4('0x24')](function(_0x242f99){var _0xb55183=_[_0xb8d4('0x41')](_0x5ee759[_0xb8d4('0x63')],function(_0x4cc514){_0x4cc514[_0xb8d4('0x6a')]=_0x5ee759['params']['id'];return _0x4cc514;});return db[_0xb8d4('0xb3')]['bulkCreate'](_0xb55183,{'transaction':_0x651b6b});});})[_0xb8d4('0x24')](function(){return db[_0xb8d4('0xb3')][_0xb8d4('0xb4')]({'where':{'SmsAccountId':_0x5ee759[_0xb8d4('0x5a')]['id']},'order':_0xb8d4('0x73')});});}})[_0xb8d4('0x24')](respondWithResult(_0x9b09a7,null))['catch'](handleError(_0x9b09a7,null));};exports[_0xb8d4('0xb5')]=function(_0x3ade4c,_0x3de8ce,_0x5e225f){var _0x51a77f={};var _0x176744={};var _0x5f1302;var _0x210e97;return db['SmsAccount'][_0xb8d4('0x68')]({'where':{'id':_0x3ade4c[_0xb8d4('0x5a')]['id']}})[_0xb8d4('0x24')](handleEntityNotFound(_0x3de8ce,null))[_0xb8d4('0x24')](function(_0x1654bb){if(_0x1654bb){_0x5f1302=_0x1654bb;_0x176744[_0xb8d4('0x45')]=_[_0xb8d4('0x47')](db[_0xb8d4('0xb3')][_0xb8d4('0x5b')]);_0x176744['query']=_[_0xb8d4('0x47')](_0x3ade4c[_0xb8d4('0x46')]);_0x176744[_0xb8d4('0x48')]=_[_0xb8d4('0x49')](_0x176744['model'],_0x176744[_0xb8d4('0x46')]);_0x51a77f[_0xb8d4('0x4b')]=_[_0xb8d4('0x49')](_0x176744['model'],qs['fields'](_0x3ade4c[_0xb8d4('0x46')][_0xb8d4('0x4a')]));_0x51a77f[_0xb8d4('0x4b')]=_0x51a77f[_0xb8d4('0x4b')][_0xb8d4('0x4c')]?_0x51a77f[_0xb8d4('0x4b')]:_0x176744['model'];_0x51a77f[_0xb8d4('0x4f')]=qs['sort'](_0x3ade4c[_0xb8d4('0x46')][_0xb8d4('0x50')]);_0x51a77f[_0xb8d4('0x53')]=qs['filters'](_[_0xb8d4('0x51')](_0x3ade4c[_0xb8d4('0x46')],_0x176744[_0xb8d4('0x48')]));if(_0x3ade4c[_0xb8d4('0x46')][_0xb8d4('0x55')]){_0x51a77f[_0xb8d4('0x53')]=_['merge'](_0x51a77f[_0xb8d4('0x53')],{'$or':_['map'](_0x51a77f[_0xb8d4('0x4b')],function(_0xe0225){var _0x515927={};_0x515927[_0xe0225]={'$like':'%'+_0x3ade4c[_0xb8d4('0x46')]['filter']+'%'};return _0x515927;})});}_0x51a77f=_[_0xb8d4('0x52')]({},_0x51a77f,_0x3ade4c[_0xb8d4('0x56')]);return _0x5f1302[_0xb8d4('0xb5')](_0x51a77f);}})[_0xb8d4('0x24')](function(_0x367586){if(_0x367586){_0x210e97=_0x367586[_0xb8d4('0x4c')];if(!_0x3ade4c[_0xb8d4('0x46')][_0xb8d4('0x4d')](_0xb8d4('0x4e'))){_0x51a77f['limit']=qs[_0xb8d4('0x35')](_0x3ade4c[_0xb8d4('0x46')][_0xb8d4('0x35')]);_0x51a77f['offset']=qs[_0xb8d4('0x34')](_0x3ade4c[_0xb8d4('0x46')]['offset']);}return _0x5f1302[_0xb8d4('0xb5')](_0x51a77f);}})[_0xb8d4('0x24')](function(_0x1fef91){if(_0x1fef91){return _0x1fef91?{'count':_0x210e97,'rows':_0x1fef91}:null;}})[_0xb8d4('0x24')](respondWithResult(_0x3de8ce,null))['catch'](handleError(_0x3de8ce,null));};exports[_0xb8d4('0xb6')]=function(_0x31dd91,_0x1c7340,_0x2ff87d){var _0x15191d={'raw':![],'where':{}};var _0x2702d8={};var _0x4d8894={'count':0x0,'rows':[]};return db[_0xb8d4('0x42')][_0xb8d4('0x68')]({'where':{'id':_0x31dd91[_0xb8d4('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1c7340,null))[_0xb8d4('0x24')](function(_0x3b1243){if(_0x3b1243){_0x2702d8[_0xb8d4('0x45')]=_[_0xb8d4('0x47')](db[_0xb8d4('0x9d')][_0xb8d4('0x5b')]);_0x2702d8[_0xb8d4('0x46')]=_[_0xb8d4('0x47')](_0x31dd91[_0xb8d4('0x46')]);_0x2702d8['filters']=_['intersection'](_0x2702d8[_0xb8d4('0x45')],_0x2702d8['query']);_0x15191d[_0xb8d4('0x4b')]=_['intersection'](_0x2702d8[_0xb8d4('0x45')],qs['fields'](_0x31dd91[_0xb8d4('0x46')]['fields']));_0x15191d[_0xb8d4('0x4b')]=_0x15191d[_0xb8d4('0x4b')][_0xb8d4('0x4c')]?_0x15191d['attributes']:_0x2702d8['model'];if(!_0x31dd91['query'][_0xb8d4('0x4d')](_0xb8d4('0x4e'))){_0x15191d[_0xb8d4('0x35')]=qs[_0xb8d4('0x35')](_0x31dd91['query'][_0xb8d4('0x35')]);_0x15191d[_0xb8d4('0x34')]=qs[_0xb8d4('0x34')](_0x31dd91[_0xb8d4('0x46')][_0xb8d4('0x34')]);}_0x15191d[_0xb8d4('0x4f')]=qs[_0xb8d4('0x50')](_0x31dd91[_0xb8d4('0x46')][_0xb8d4('0x50')]);_0x15191d[_0xb8d4('0x53')]=qs[_0xb8d4('0x48')](_[_0xb8d4('0x51')](_0x31dd91[_0xb8d4('0x46')],_0x2702d8[_0xb8d4('0x48')]));_0x15191d[_0xb8d4('0x53')][_0xb8d4('0x6a')]=_0x3b1243['id'];if(_0x31dd91[_0xb8d4('0x46')][_0xb8d4('0x55')]){_0x15191d[_0xb8d4('0x53')]=_[_0xb8d4('0x52')](_0x15191d[_0xb8d4('0x53')],{'$or':_[_0xb8d4('0x41')](_0x15191d[_0xb8d4('0x4b')],function(_0xe4c8b5){var _0x6f9da9={};_0x6f9da9[_0xe4c8b5]={'$like':'%'+_0x31dd91[_0xb8d4('0x46')][_0xb8d4('0x55')]+'%'};return _0x6f9da9;})});}_0x15191d=_['merge']({},_0x15191d,_0x31dd91[_0xb8d4('0x56')]);return db[_0xb8d4('0x9d')][_0xb8d4('0x33')]({'where':_0x15191d['where']})[_0xb8d4('0x24')](function(_0x14c3f4){_0x4d8894[_0xb8d4('0x33')]=_0x14c3f4;if(_0x31dd91[_0xb8d4('0x46')][_0xb8d4('0x6b')]){_0x15191d['include']=[{'model':db[_0xb8d4('0x76')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xb8d4('0x3d'),_0xb8d4('0xb7'),_0xb8d4('0xb8')],'required':![]},{'model':db[_0xb8d4('0xb9')],'as':_0xb8d4('0xba'),'attributes':['id',_0xb8d4('0x3d'),_0xb8d4('0xbb')],'where':_0x31dd91[_0xb8d4('0x46')][_0xb8d4('0xbc')]?{'id':_0x31dd91[_0xb8d4('0x46')][_0xb8d4('0xbc')]}:undefined,'required':_0x31dd91['query'][_0xb8d4('0xbc')]?!![]:![]}];}return db[_0xb8d4('0x9d')][_0xb8d4('0x58')](_0x15191d);})['then'](function(_0x51456a){_0x4d8894[_0xb8d4('0x59')]=_0x51456a;return _0x4d8894;});}})[_0xb8d4('0x24')](respondWithFilteredResult(_0x1c7340,_0x15191d))[_0xb8d4('0x2f')](handleError(_0x1c7340,null));};exports[_0xb8d4('0x3e')]=function(_0xa08c35,_0x3a3e12,_0x2a2b38){var _0x50e249,_0x4d1843,_0x1bd265;if(_['isNil'](_0xa08c35[_0xb8d4('0x63')][_0xb8d4('0x63')])||_0xa08c35[_0xb8d4('0x63')][_0xb8d4('0x63')]===''){throw new db[(_0xb8d4('0x77'))][(_0xb8d4('0x91'))](_0xb8d4('0x93'));}if(_[_0xb8d4('0x90')](_0xa08c35[_0xb8d4('0x63')]['to'])){throw new db[(_0xb8d4('0x77'))]['ValidationError'](_0xb8d4('0xbd'));}_0x50e249=_0xa08c35[_0xb8d4('0x63')]['to'];return db[_0xb8d4('0x42')]['find']({'where':{'id':_0xa08c35[_0xb8d4('0x5a')]['id']},'include':[{'model':db['CmList'],'as':_0xb8d4('0xbe'),'include':[{'model':db['CmContact'],'as':_0xb8d4('0x9b'),'where':{'mobile':_0x50e249},'limit':0x1,'order':[[_0xb8d4('0x7a'),_0xb8d4('0x98')]]}]}]})[_0xb8d4('0x24')](handleEntityNotFound(_0x3a3e12,null))[_0xb8d4('0x24')](function(_0x271443){if(_0x271443&&_0x271443[_0xb8d4('0xbe')]){_0x4d1843=_0x271443[_0xb8d4('0x3b')]({'plain':!![]});if(_0x4d1843['List']&&_0x4d1843['List'][_0xb8d4('0x9b')]['length']){return _0x4d1843[_0xb8d4('0xbe')][_0xb8d4('0x9b')][0x0];}return db['CmContact'][_0xb8d4('0x66')](_['defaults'](_0xa08c35[_0xb8d4('0x63')],{'firstName':_0x50e249,'mobile':_0x50e249,'phone':_0x50e249,'ListId':_0x4d1843['ListId']}));}})[_0xb8d4('0x24')](handleEntityNotFound(_0x3a3e12,null))[_0xb8d4('0x24')](function(_0x34d4d2){if(_0x34d4d2){_0x1bd265=_0x34d4d2;return db[_0xb8d4('0x9d')]['find']({'where':{'ContactId':_0x1bd265['id'],'closed':![],'SmsAccountId':_0x4d1843['id']}})[_0xb8d4('0x24')](function(_0x8fdade){if(_0x8fdade){return[_0x8fdade,![]];}return db[_0xb8d4('0x9d')][_0xb8d4('0x66')]({'UserId':_0xa08c35[_0xb8d4('0x5d')]['id'],'ContactId':_0x1bd265['id'],'SmsAccountId':_0x4d1843['id'],'phone':_0x50e249,'firstMsgDirection':_0xb8d4('0xbf'),'Messages':[_[_0xb8d4('0x52')](_0xa08c35[_0xb8d4('0x63')],{'read':![],'body':_0xa08c35[_0xb8d4('0x63')][_0xb8d4('0x63')],'phone':_0x50e249,'SmsAccountId':_0x4d1843['id'],'UserId':_0xa08c35[_0xb8d4('0x5d')]['id'],'ContactId':_0x1bd265['id']})]},{'include':[{'model':db[_0xb8d4('0xa4')],'as':_0xb8d4('0xc0')}]})[_0xb8d4('0x24')](function(_0x5e22d2){return[_0x5e22d2,!![]];});});}})[_0xb8d4('0xc1')](function(_0x3c05e8,_0x4c0a49){if(_0x4c0a49){return _0x3c05e8;}return db[_0xb8d4('0xa4')][_0xb8d4('0x66')](_['merge'](_0xa08c35[_0xb8d4('0x63')],{'read':![],'body':_0xa08c35[_0xb8d4('0x63')][_0xb8d4('0x63')],'phone':_0x50e249,'SmsAccountId':_0x4d1843['id'],'SmsInteractionId':_0x3c05e8['id'],'UserId':_0xa08c35[_0xb8d4('0x5d')]['id'],'ContactId':_0x1bd265['id']}))[_0xb8d4('0x24')](function(_0x415220){_0x3c05e8[_0xb8d4('0xc2')][_0xb8d4('0xc0')]=[];_0x3c05e8[_0xb8d4('0xc2')][_0xb8d4('0xc0')][_0xb8d4('0xa0')](_0x415220[_0xb8d4('0xc2')]);return _0x3c05e8;});})[_0xb8d4('0x24')](respondWithResult(_0x3a3e12,null))[_0xb8d4('0x2f')](handleError(_0x3a3e12,null));};exports[_0xb8d4('0x31')]=function(_0x9a51e1,_0x90afe3,_0x180875){if(_0x9a51e1['body']['id']){delete _0x9a51e1['body']['id'];}var _0x51692b,_0x32ba0a,_0x212478;return db[_0xb8d4('0x42')]['find']({'where':{'id':_0x9a51e1[_0xb8d4('0x5a')]['id']}})['then'](handleEntityNotFound(_0x90afe3,null))[_0xb8d4('0x24')](function(_0x20f53b){if(_0x20f53b){_0x212478=_0x20f53b;logger[_0xb8d4('0x28')](_0xb8d4('0x29'),'status',_0xb8d4('0xc3'),_0x20f53b['type'],util[_0xb8d4('0xc4')](_0x9a51e1[_0xb8d4('0x63')],{'showHidden':![],'depth':null}));switch(_0x20f53b[_0xb8d4('0x44')]){case _0xb8d4('0x80'):if(_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0xc5')]&&_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0x31')]){_0x32ba0a=_0x9a51e1[_0xb8d4('0x63')]['status'];return db[_0xb8d4('0xa4')][_0xb8d4('0x5c')]({'where':{'messageId':_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0xc5')]}});}break;case'connectel':if(_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0xc6')]&&_0x9a51e1['body'][_0xb8d4('0xc7')]){_0x32ba0a=_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0xc7')];return db[_0xb8d4('0xa4')][_0xb8d4('0x5c')]({'where':{'messageId':_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0xc6')]}});}break;case _0xb8d4('0xc8'):if(_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0x85')]&&_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0xc9')]){_0x32ba0a=_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0xc9')];return db['SmsMessage'][_0xb8d4('0x5c')]({'where':{'messageId':_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0x85')]}});}break;case _0xb8d4('0xca'):var _0x39697f=_0x9a51e1['body'][_0xb8d4('0x88')][0x0];if(_0x39697f[_0xb8d4('0x84')]&&_0x39697f[_0xb8d4('0x31')][_0xb8d4('0xcb')]==='DELIVERED'){_0x32ba0a=_0x39697f[_0xb8d4('0x31')][_0xb8d4('0xcb')];return db[_0xb8d4('0xa4')][_0xb8d4('0x5c')]({'where':{'messageId':_0x39697f[_0xb8d4('0x84')]}});}break;case _0xb8d4('0x8b'):if(_0x9a51e1[_0xb8d4('0x63')]['messageId']&&_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0x31')]){_0x32ba0a=_0x9a51e1['body'][_0xb8d4('0x31')];return db[_0xb8d4('0xa4')][_0xb8d4('0x5c')]({'where':{'messageId':_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0x84')]}});}break;case'bandwidth':if(_0x9a51e1['body'][0x0][_0xb8d4('0x2d')]['id']){_0x32ba0a=_0x9a51e1[_0xb8d4('0x63')][0x0][_0xb8d4('0x44')];return db['SmsMessage'][_0xb8d4('0x5c')]({'where':{'messageId':_0x9a51e1[_0xb8d4('0x63')][0x0][_0xb8d4('0x2d')]['id']}});}break;case _0xb8d4('0x8e'):if(_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0xcc')]&&_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0x31')]){_0x32ba0a=_0x9a51e1['body'][_0xb8d4('0x31')];return db[_0xb8d4('0xa4')][_0xb8d4('0x5c')]({'where':{'messageId':_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0xcc')]}});}break;}}})[_0xb8d4('0x24')](handleEntityNotFound(_0x90afe3,null))['then'](function(_0x29acc2){if(_0x29acc2){_0x51692b=_0x29acc2;switch(_0x212478[_0xb8d4('0x44')]){case _0xb8d4('0x80'):if(_0x32ba0a==='DELIVERED'){return _0x51692b['update']({'read':!![]});}else{logger[_0xb8d4('0x2b')](_0xb8d4('0x29'),'status',_0xb8d4('0x80'),util[_0xb8d4('0xc4')](_0x9a51e1['body'],{'showHidden':![],'depth':null}));}break;case _0xb8d4('0xcd'):if(_0x32ba0a==='1'){return _0x51692b[_0xb8d4('0xce')]({'read':!![]});}else{logger[_0xb8d4('0x2b')](_0xb8d4('0x29'),_0xb8d4('0x31'),_0xb8d4('0x80'),util['inspect'](_0x9a51e1[_0xb8d4('0x63')],{'showHidden':![],'depth':null}));}break;case _0xb8d4('0xc8'):if(!_0x9a51e1[_0xb8d4('0x63')]['error_code']&&_0x32ba0a>=0xc8&&_0x32ba0a<=0xce){return _0x51692b[_0xb8d4('0xce')]({'read':!![]});}else{logger['error'](_0xb8d4('0x29'),_0xb8d4('0x31'),_0xb8d4('0xc8'),util[_0xb8d4('0xc4')](_0x9a51e1['body'],{'showHidden':![],'depth':null}));}break;case _0xb8d4('0xca'):var _0x55c25a=_0x9a51e1[_0xb8d4('0x63')][_0xb8d4('0x88')][0x0];if(_0x55c25a[_0xb8d4('0x31')]['groupName']===_0xb8d4('0xcf')){return _0x51692b[_0xb8d4('0xce')]({'read':!![]});}else{logger[_0xb8d4('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb8d4('0x31'),'infobip',util['inspect'](_0x9a51e1[_0xb8d4('0x63')],{'showHidden':![],'depth':null}));}break;case _0xb8d4('0x8b'):if(_0x32ba0a=='DELIVERED_TO_GATEWAY'||_0x32ba0a==_0xb8d4('0xd0')){return _0x51692b[_0xb8d4('0xce')]({'read':!![]});}else{logger[_0xb8d4('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb8d4('0x31'),_0xb8d4('0x8b'),util[_0xb8d4('0xc4')](_0x9a51e1[_0xb8d4('0x63')],{'showHidden':![],'depth':null}));}break;case _0xb8d4('0xd1'):if(_0x32ba0a==_0xb8d4('0xd2')){return _0x51692b['update']({'read':!![]});}else{logger[_0xb8d4('0x2b')](_0xb8d4('0x29'),_0xb8d4('0x31'),_0xb8d4('0xd1'),util[_0xb8d4('0xc4')](_0x9a51e1[_0xb8d4('0x63')],{'showHidden':![],'depth':null}));}break;case _0xb8d4('0x8e'):if(_0x32ba0a===_0xb8d4('0xd3')||_0x32ba0a===_0xb8d4('0xd4')){return _0x51692b['update']({'read':!![]});}else{logger[_0xb8d4('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xb8d4('0x8e'),util[_0xb8d4('0xc4')](_0x9a51e1[_0xb8d4('0x63')],{'showHidden':![],'depth':null}));}break;}return _0x51692b;}})['then'](respondWithResult(_0x90afe3,null))[_0xb8d4('0x2f')](handleError(_0x90afe3,null));};exports['statusGet']=function(_0x235900,_0x14a045,_0x517009){var _0x12910d,_0x371b00,_0x32df7d;return db[_0xb8d4('0x42')]['find']({'where':{'id':_0x235900[_0xb8d4('0x5a')]['id']}})[_0xb8d4('0x24')](handleEntityNotFound(_0x14a045,null))[_0xb8d4('0x24')](function(_0x34c3b9){if(_0x34c3b9){_0x32df7d=_0x34c3b9;logger[_0xb8d4('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb8d4('0x31'),'received\x20delivery\x20report\x20from',_0x34c3b9[_0xb8d4('0x44')],util[_0xb8d4('0xc4')](_0x235900[_0xb8d4('0x46')],{'showHidden':![],'depth':null}));switch(_0x34c3b9[_0xb8d4('0x44')]){case _0xb8d4('0x89'):if(_0x235900[_0xb8d4('0x46')][_0xb8d4('0xd5')]&&_0x235900[_0xb8d4('0x46')][_0xb8d4('0xd6')]){_0x371b00=_0x235900[_0xb8d4('0x46')][_0xb8d4('0xd6')];return db['SmsMessage'][_0xb8d4('0x5c')]({'where':{'messageId':_0x235900[_0xb8d4('0x46')][_0xb8d4('0xd5')]}});}break;}}})[_0xb8d4('0x24')](handleEntityNotFound(_0x14a045,null))[_0xb8d4('0x24')](function(_0x2d9a6a){if(_0x2d9a6a){_0x12910d=_0x2d9a6a;switch(_0x32df7d[_0xb8d4('0x44')]){case'csc':if(_0x371b00==='2'||_0x371b00==='6'){return _0x12910d[_0xb8d4('0xce')]({'read':!![]});}else{logger[_0xb8d4('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb8d4('0x31'),_0xb8d4('0x89'),util[_0xb8d4('0xc4')](_0x235900[_0xb8d4('0x46')],{'showHidden':![],'depth':null}));};break;}return _0x12910d;}})[_0xb8d4('0x24')](respondWithResult(_0x14a045,null))[_0xb8d4('0x2f')](handleError(_0x14a045,null));};exports['addAgents']=function(_0x154881,_0x1bd427,_0xefbdcc){return db['SmsAccount']['find']({'where':{'id':_0x154881[_0xb8d4('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1bd427,null))[_0xb8d4('0x24')](function(_0x4cf1b7){if(_0x4cf1b7){return _0x4cf1b7['addAgents'](_0x154881[_0xb8d4('0x63')]['ids'],_[_0xb8d4('0x9a')](_0x154881[_0xb8d4('0x63')],[_0xb8d4('0x6d'),'id'])||{})[_0xb8d4('0xc1')](function(_0x350ce6){for(var _0x24c718=0x0;_0x24c718<_0x154881[_0xb8d4('0x63')][_0xb8d4('0x6d')][_0xb8d4('0x4c')];_0x24c718+=0x1){socket[_0xb8d4('0xd7')]('userSmsAccount:save',{'UserId':_0x154881[_0xb8d4('0x63')]['ids'][_0x24c718],'SmsAccountId':_0x154881[_0xb8d4('0x5a')]['id']});}return _0x350ce6;});}})[_0xb8d4('0x24')](respondWithResult(_0x1bd427,null))[_0xb8d4('0x2f')](handleError(_0x1bd427,null));};exports['removeAgents']=function(_0x77c1e,_0x223f73,_0x1d3394){return db[_0xb8d4('0x42')][_0xb8d4('0x5c')]({'where':{'id':_0x77c1e[_0xb8d4('0x5a')]['id']}})[_0xb8d4('0x24')](handleEntityNotFound(_0x223f73,null))[_0xb8d4('0x24')](function(_0x349548){if(_0x349548){return _0x349548[_0xb8d4('0xd8')](_0x77c1e[_0xb8d4('0x46')]['ids'])['then'](function(){if(_[_0xb8d4('0xd9')](_0x77c1e[_0xb8d4('0x46')]['ids'])){for(var _0x19f975=0x0;_0x19f975<_0x77c1e[_0xb8d4('0x46')][_0xb8d4('0x6d')][_0xb8d4('0x4c')];_0x19f975+=0x1){socket[_0xb8d4('0xd7')]('userSmsAccount:remove',{'UserId':Number(_0x77c1e[_0xb8d4('0x46')][_0xb8d4('0x6d')][_0x19f975]),'SmsAccountId':Number(_0x77c1e[_0xb8d4('0x5a')]['id'])});}}else{socket[_0xb8d4('0xd7')]('userSmsAccount:remove',{'UserId':Number(_0x77c1e[_0xb8d4('0x46')][_0xb8d4('0x6d')]),'SmsAccountId':Number(_0x77c1e[_0xb8d4('0x5a')]['id'])});}});}})[_0xb8d4('0x24')](respondWithStatusCode(_0x223f73,null))[_0xb8d4('0x2f')](handleError(_0x223f73,null));};exports[_0xb8d4('0xda')]=function(_0x354312,_0x507057,_0x5cd079){var _0x1d180d={};var _0x515f39={};var _0xd422bc;var _0x4ac096;return db[_0xb8d4('0x42')][_0xb8d4('0x68')]({'where':{'id':_0x354312[_0xb8d4('0x5a')]['id']}})[_0xb8d4('0x24')](handleEntityNotFound(_0x507057,null))[_0xb8d4('0x24')](function(_0x52435c){if(_0x52435c){_0xd422bc=_0x52435c;_0x515f39[_0xb8d4('0x45')]=_[_0xb8d4('0x47')](db[_0xb8d4('0xa7')][_0xb8d4('0x5b')]);_0x515f39[_0xb8d4('0x46')]=_['keys'](_0x354312[_0xb8d4('0x46')]);_0x515f39[_0xb8d4('0x48')]=_[_0xb8d4('0x49')](_0x515f39[_0xb8d4('0x45')],_0x515f39[_0xb8d4('0x46')]);_0x1d180d['attributes']=_[_0xb8d4('0x49')](_0x515f39[_0xb8d4('0x45')],qs[_0xb8d4('0x4a')](_0x354312[_0xb8d4('0x46')][_0xb8d4('0x4a')]));_0x1d180d[_0xb8d4('0x4b')]=_0x1d180d['attributes']['length']?_0x1d180d['attributes']:_0x515f39[_0xb8d4('0x45')];_0x1d180d[_0xb8d4('0x4f')]=qs[_0xb8d4('0x50')](_0x354312[_0xb8d4('0x46')][_0xb8d4('0x50')]);_0x1d180d[_0xb8d4('0x53')]=qs[_0xb8d4('0x48')](_['pick'](_0x354312[_0xb8d4('0x46')],_0x515f39[_0xb8d4('0x48')]));if(_0x354312[_0xb8d4('0x46')][_0xb8d4('0x55')]){_0x1d180d['where']=_[_0xb8d4('0x52')](_0x1d180d['where'],{'$or':_[_0xb8d4('0x41')](_0x1d180d['attributes'],function(_0x204ff9){var _0x5c28d4={};_0x5c28d4[_0x204ff9]={'$like':'%'+_0x354312[_0xb8d4('0x46')][_0xb8d4('0x55')]+'%'};return _0x5c28d4;})});}_0x1d180d=_[_0xb8d4('0x52')]({},_0x1d180d,_0x354312[_0xb8d4('0x56')]);return _0xd422bc[_0xb8d4('0xda')](_0x1d180d);}})['then'](function(_0x3d4e6e){if(_0x3d4e6e){_0x4ac096=_0x3d4e6e[_0xb8d4('0x4c')];if(!_0x354312[_0xb8d4('0x46')][_0xb8d4('0x4d')]('nolimit')){_0x1d180d[_0xb8d4('0x35')]=qs['limit'](_0x354312[_0xb8d4('0x46')][_0xb8d4('0x35')]);_0x1d180d[_0xb8d4('0x34')]=qs[_0xb8d4('0x34')](_0x354312[_0xb8d4('0x46')][_0xb8d4('0x34')]);}return _0xd422bc['getAgents'](_0x1d180d);}})[_0xb8d4('0x24')](function(_0x1485c7){if(_0x1485c7){return _0x1485c7?{'count':_0x4ac096,'rows':_0x1485c7}:null;}})[_0xb8d4('0x24')](respondWithResult(_0x507057,null))[_0xb8d4('0x2f')](handleError(_0x507057,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 642c0cc..210c9f9 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 _0x917c=['emit','hasOwnProperty','exports','events','../../mysqldb','SmsAccount','save','update','remove'];(function(_0x1ae8ab,_0x6e5c2a){var _0x1ad705=function(_0x1dfa15){while(--_0x1dfa15){_0x1ae8ab['push'](_0x1ae8ab['shift']());}};_0x1ad705(++_0x6e5c2a);}(_0x917c,0xdb));var _0xc917=function(_0x269979,_0x39a5fb){_0x269979=_0x269979-0x0;var _0x5996b7=_0x917c[_0x269979];return _0x5996b7;};'use strict';var EventEmitter=require(_0xc917('0x0'));var SmsAccount=require(_0xc917('0x1'))['db'][_0xc917('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc917('0x3'),'afterUpdate':_0xc917('0x4'),'afterDestroy':_0xc917('0x5')};function emitEvent(_0x1abeab){return function(_0x10e7d8,_0x317d7f,_0x4a2a9d){SmsAccountEvents[_0xc917('0x6')](_0x1abeab+':'+_0x10e7d8['id'],_0x10e7d8);SmsAccountEvents[_0xc917('0x6')](_0x1abeab,_0x10e7d8);_0x4a2a9d(null);};}for(var e in events){if(events[_0xc917('0x7')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0xc917('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x3355=['update','remove','emit','hook','events','../../mysqldb','SmsAccount','setMaxListeners','save'];(function(_0x4a987b,_0x43efad){var _0xb8c588=function(_0x21070c){while(--_0x21070c){_0x4a987b['push'](_0x4a987b['shift']());}};_0xb8c588(++_0x43efad);}(_0x3355,0x94));var _0x5335=function(_0x105ba2,_0x346d0f){_0x105ba2=_0x105ba2-0x0;var _0x1e3f8b=_0x3355[_0x105ba2];return _0x1e3f8b;};'use strict';var EventEmitter=require(_0x5335('0x0'));var SmsAccount=require(_0x5335('0x1'))['db'][_0x5335('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x5335('0x3')](0x0);var events={'afterCreate':_0x5335('0x4'),'afterUpdate':_0x5335('0x5'),'afterDestroy':_0x5335('0x6')};function emitEvent(_0x7cf0a2){return function(_0x533a11,_0x59a132,_0x3d07f3){SmsAccountEvents[_0x5335('0x7')](_0x7cf0a2+':'+_0x533a11['id'],_0x533a11);SmsAccountEvents['emit'](_0x7cf0a2,_0x533a11);_0x3d07f3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x5335('0x8')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 799298c..5856eb8 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 _0x37b0=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','lodash','util','../../config/logger'];(function(_0x470048,_0x5c877e){var _0x2d0d67=function(_0x26b51a){while(--_0x26b51a){_0x470048['push'](_0x470048['shift']());}};_0x2d0d67(++_0x5c877e);}(_0x37b0,0x7b));var _0x037b=function(_0x1d98a3,_0x28e1b8){_0x1d98a3=_0x1d98a3-0x0;var _0x4b8246=_0x37b0[_0x1d98a3];return _0x4b8246;};'use strict';var _=require(_0x037b('0x0'));var util=require(_0x037b('0x1'));var logger=require(_0x037b('0x2'))(_0x037b('0x3'));var moment=require(_0x037b('0x4'));var BPromise=require(_0x037b('0x5'));var rp=require(_0x037b('0x6'));var fs=require('fs');var path=require(_0x037b('0x7'));var rimraf=require(_0x037b('0x8'));var config=require(_0x037b('0x9'));var attributes=require(_0x037b('0xa'));module[_0x037b('0xb')]=function(_0x3c0e03,_0x522270){return _0x3c0e03[_0x037b('0xc')](_0x037b('0xd'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8367=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','../../config/logger','api'];(function(_0xad380f,_0x3a29fb){var _0x5c1f52=function(_0x5c62af){while(--_0x5c62af){_0xad380f['push'](_0xad380f['shift']());}};_0x5c1f52(++_0x3a29fb);}(_0x8367,0x191));var _0x7836=function(_0x3246b4,_0x401153){_0x3246b4=_0x3246b4-0x0;var _0x34b3d7=_0x8367[_0x3246b4];return _0x34b3d7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7836('0x0'))(_0x7836('0x1'));var moment=require(_0x7836('0x2'));var BPromise=require(_0x7836('0x3'));var rp=require(_0x7836('0x4'));var fs=require('fs');var path=require(_0x7836('0x5'));var rimraf=require(_0x7836('0x6'));var config=require(_0x7836('0x7'));var attributes=require(_0x7836('0x8'));module[_0x7836('0x9')]=function(_0x1ea5ed,_0x4049ba){return _0x1ea5ed[_0x7836('0xa')](_0x7836('0xb'),attributes,{'tableName':_0x7836('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 53d943f..8572b10 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 _0xdbb5=['rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SmsAccount','find','options','raw','where','attributes','include','map','model','ShowSmsAccount','util','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2c6884,_0x10eb83){var _0x1b5657=function(_0x2620d2){while(--_0x2620d2){_0x2c6884['push'](_0x2c6884['shift']());}};_0x1b5657(++_0x10eb83);}(_0xdbb5,0x1b7));var _0x5dbb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdbb5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x5dbb('0x0'));var moment=require('moment');var BPromise=require(_0x5dbb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5dbb('0x2'))['db'];var utils=require(_0x5dbb('0x3'));var logger=require(_0x5dbb('0x4'))(_0x5dbb('0x5'));var config=require(_0x5dbb('0x6'));var jayson=require(_0x5dbb('0x7'));var client=jayson[_0x5dbb('0x8')][_0x5dbb('0x9')]({'port':0x232a});config[_0x5dbb('0xa')]=_['defaults'](config['redis'],{'host':_0x5dbb('0xb'),'port':0x18eb});var socket=require(_0x5dbb('0xc'))(new Redis(config['redis']));require(_0x5dbb('0xd'))['register'](socket);function respondWithRpcPromise(_0x1255cc,_0x1aa261,_0x147cff){return new BPromise(function(_0xcec529,_0x5bce77){return client[_0x5dbb('0xe')](_0x1255cc,_0x147cff)[_0x5dbb('0xf')](function(_0x4eada6){logger[_0x5dbb('0x10')](_0x5dbb('0x11'),_0x1aa261,'request\x20sent');logger[_0x5dbb('0x12')](_0x5dbb('0x13'),_0x1aa261,_0x5dbb('0x14'),JSON[_0x5dbb('0x15')](_0x4eada6));if(_0x4eada6[_0x5dbb('0x16')]){if(_0x4eada6['error'][_0x5dbb('0x17')]===0x1f4){logger[_0x5dbb('0x16')](_0x5dbb('0x11'),_0x1aa261,_0x4eada6[_0x5dbb('0x16')][_0x5dbb('0x18')]);return _0x5bce77(_0x4eada6['error'][_0x5dbb('0x18')]);}logger[_0x5dbb('0x16')](_0x5dbb('0x11'),_0x1aa261,_0x4eada6[_0x5dbb('0x16')][_0x5dbb('0x18')]);return _0xcec529(_0x4eada6[_0x5dbb('0x16')][_0x5dbb('0x18')]);}else{logger[_0x5dbb('0x10')](_0x5dbb('0x11'),_0x1aa261,'request\x20sent');_0xcec529(_0x4eada6[_0x5dbb('0x19')]['message']);}})[_0x5dbb('0x1a')](function(_0x1701cc){logger[_0x5dbb('0x16')](_0x5dbb('0x11'),_0x1aa261,_0x1701cc);_0x5bce77(_0x1701cc);});});}exports['ShowSmsAccount']=function(_0x40fd3b){var _0x33df1e=this;return new Promise(function(_0x228b68,_0x52c8f0){return db[_0x5dbb('0x1b')][_0x5dbb('0x1c')]({'raw':_0x40fd3b[_0x5dbb('0x1d')]?_0x40fd3b[_0x5dbb('0x1d')][_0x5dbb('0x1e')]===undefined?!![]:![]:!![],'where':_0x40fd3b[_0x5dbb('0x1d')]?_0x40fd3b['options'][_0x5dbb('0x1f')]||null:null,'attributes':_0x40fd3b['options']?_0x40fd3b[_0x5dbb('0x1d')][_0x5dbb('0x20')]||null:null,'include':_0x40fd3b[_0x5dbb('0x1d')]?_0x40fd3b[_0x5dbb('0x1d')][_0x5dbb('0x21')]?_[_0x5dbb('0x22')](_0x40fd3b[_0x5dbb('0x1d')][_0x5dbb('0x21')],function(_0xbbba7c){return{'model':db[_0xbbba7c[_0x5dbb('0x23')]],'as':_0xbbba7c['as'],'attributes':_0xbbba7c['attributes'],'include':_0xbbba7c[_0x5dbb('0x21')]?_[_0x5dbb('0x22')](_0xbbba7c[_0x5dbb('0x21')],function(_0xe50c72){return{'model':db[_0xe50c72[_0x5dbb('0x23')]],'as':_0xe50c72['as'],'attributes':_0xe50c72[_0x5dbb('0x20')],'include':_0xe50c72[_0x5dbb('0x21')]?_['map'](_0xe50c72[_0x5dbb('0x21')],function(_0x4ce9d9){return{'model':db[_0x4ce9d9[_0x5dbb('0x23')]],'as':_0x4ce9d9['as'],'attributes':_0x4ce9d9[_0x5dbb('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46f722){logger[_0x5dbb('0x10')](_0x5dbb('0x24'),_0x40fd3b);logger['debug'](_0x5dbb('0x24'),_0x40fd3b,JSON[_0x5dbb('0x15')](_0x46f722));_0x228b68(_0x46f722);})[_0x5dbb('0x1a')](function(_0x3fd1d7){logger[_0x5dbb('0x16')](_0x5dbb('0x24'),_0x3fd1d7[_0x5dbb('0x18')],_0x40fd3b);_0x52c8f0(_0x33df1e[_0x5dbb('0x16')](0x1f4,_0x3fd1d7['message']));});});}; \ No newline at end of file +var _0x3aae=['error','code','SmsAccount,\x20%s,\x20%s','message','ShowSmsAccount','SmsAccount','options','raw','where','attributes','map','include','model','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./smsAccount.socket','register','request','then','info','request\x20sent','debug','stringify'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x3aae,0x136));var _0xe3aa=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3aae[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xe3aa('0x0'));var util=require(_0xe3aa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe3aa('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe3aa('0x3'))['db'];var utils=require(_0xe3aa('0x4'));var logger=require(_0xe3aa('0x5'))(_0xe3aa('0x6'));var config=require(_0xe3aa('0x7'));var jayson=require(_0xe3aa('0x8'));var client=jayson[_0xe3aa('0x9')][_0xe3aa('0xa')]({'port':0x232a});config['redis']=_[_0xe3aa('0xb')](config['redis'],{'host':_0xe3aa('0xc'),'port':0x18eb});var socket=require(_0xe3aa('0xd'))(new Redis(config[_0xe3aa('0xe')]));require(_0xe3aa('0xf'))[_0xe3aa('0x10')](socket);function respondWithRpcPromise(_0x35256d,_0x47f921,_0x6292f7){return new BPromise(function(_0x4b43d7,_0x3fe85c){return client[_0xe3aa('0x11')](_0x35256d,_0x6292f7)[_0xe3aa('0x12')](function(_0x4e89da){logger[_0xe3aa('0x13')]('SmsAccount,\x20%s,\x20%s',_0x47f921,_0xe3aa('0x14'));logger[_0xe3aa('0x15')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47f921,_0xe3aa('0x14'),JSON[_0xe3aa('0x16')](_0x4e89da));if(_0x4e89da[_0xe3aa('0x17')]){if(_0x4e89da['error'][_0xe3aa('0x18')]===0x1f4){logger[_0xe3aa('0x17')](_0xe3aa('0x19'),_0x47f921,_0x4e89da['error'][_0xe3aa('0x1a')]);return _0x3fe85c(_0x4e89da['error'][_0xe3aa('0x1a')]);}logger[_0xe3aa('0x17')]('SmsAccount,\x20%s,\x20%s',_0x47f921,_0x4e89da[_0xe3aa('0x17')][_0xe3aa('0x1a')]);return _0x4b43d7(_0x4e89da[_0xe3aa('0x17')]['message']);}else{logger[_0xe3aa('0x13')](_0xe3aa('0x19'),_0x47f921,_0xe3aa('0x14'));_0x4b43d7(_0x4e89da['result']['message']);}})['catch'](function(_0x3306e5){logger[_0xe3aa('0x17')](_0xe3aa('0x19'),_0x47f921,_0x3306e5);_0x3fe85c(_0x3306e5);});});}exports[_0xe3aa('0x1b')]=function(_0x2e7e52){var _0x257364=this;return new Promise(function(_0x3eb6f5,_0x549ea1){return db[_0xe3aa('0x1c')]['find']({'raw':_0x2e7e52['options']?_0x2e7e52[_0xe3aa('0x1d')][_0xe3aa('0x1e')]===undefined?!![]:![]:!![],'where':_0x2e7e52['options']?_0x2e7e52[_0xe3aa('0x1d')][_0xe3aa('0x1f')]||null:null,'attributes':_0x2e7e52['options']?_0x2e7e52[_0xe3aa('0x1d')][_0xe3aa('0x20')]||null:null,'include':_0x2e7e52[_0xe3aa('0x1d')]?_0x2e7e52[_0xe3aa('0x1d')]['include']?_[_0xe3aa('0x21')](_0x2e7e52[_0xe3aa('0x1d')][_0xe3aa('0x22')],function(_0x1e6016){return{'model':db[_0x1e6016[_0xe3aa('0x23')]],'as':_0x1e6016['as'],'attributes':_0x1e6016['attributes'],'include':_0x1e6016['include']?_[_0xe3aa('0x21')](_0x1e6016[_0xe3aa('0x22')],function(_0x26cbcf){return{'model':db[_0x26cbcf['model']],'as':_0x26cbcf['as'],'attributes':_0x26cbcf[_0xe3aa('0x20')],'include':_0x26cbcf[_0xe3aa('0x22')]?_[_0xe3aa('0x21')](_0x26cbcf[_0xe3aa('0x22')],function(_0x94f128){return{'model':db[_0x94f128[_0xe3aa('0x23')]],'as':_0x94f128['as'],'attributes':_0x94f128[_0xe3aa('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe3aa('0x12')](function(_0x573ba1){logger[_0xe3aa('0x13')](_0xe3aa('0x1b'),_0x2e7e52);logger[_0xe3aa('0x15')](_0xe3aa('0x1b'),_0x2e7e52,JSON[_0xe3aa('0x16')](_0x573ba1));_0x3eb6f5(_0x573ba1);})[_0xe3aa('0x24')](function(_0x2072b3){logger[_0xe3aa('0x17')](_0xe3aa('0x1b'),_0x2072b3['message'],_0x2e7e52);_0x549ea1(_0x257364['error'](0x1f4,_0x2072b3[_0xe3aa('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 068bc95..fedd2eb 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 _0x6b75=['update','emit','removeListener','register','length','smsAccount:','save'];(function(_0x3c5878,_0x4c5058){var _0x49e8cf=function(_0x534e33){while(--_0x534e33){_0x3c5878['push'](_0x3c5878['shift']());}};_0x49e8cf(++_0x4c5058);}(_0x6b75,0xe6));var _0x56b7=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0x6b75[_0x37a79c];return _0x561d89;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0x56b7('0x0'),'remove',_0x56b7('0x1')];function createListener(_0x3af0f8,_0x9ebe24){return function(_0x5b8d7c){_0x9ebe24[_0x56b7('0x2')](_0x3af0f8,_0x5b8d7c);};}function removeListener(_0x4ff995,_0x6d965b){return function(){SmsAccountEvents[_0x56b7('0x3')](_0x4ff995,_0x6d965b);};}exports[_0x56b7('0x4')]=function(_0x496da3){for(var _0x16d1e8=0x0,_0x1babad=events[_0x56b7('0x5')];_0x16d1e8<_0x1babad;_0x16d1e8++){var _0x46d8a8=events[_0x16d1e8];var _0x74a37b=createListener(_0x56b7('0x6')+_0x46d8a8,_0x496da3);SmsAccountEvents['on'](_0x46d8a8,_0x74a37b);}}; \ No newline at end of file +var _0x675c=['smsAccount:','./smsAccount.events','save','update','register','length'];(function(_0x418933,_0x35b1a8){var _0x53b9de=function(_0x1fdbed){while(--_0x1fdbed){_0x418933['push'](_0x418933['shift']());}};_0x53b9de(++_0x35b1a8);}(_0x675c,0x6d));var _0xc675=function(_0x2c3a37,_0x49f86a){_0x2c3a37=_0x2c3a37-0x0;var _0x509da8=_0x675c[_0x2c3a37];return _0x509da8;};'use strict';var SmsAccountEvents=require(_0xc675('0x0'));var events=[_0xc675('0x1'),'remove',_0xc675('0x2')];function createListener(_0x239958,_0x451395){return function(_0x1c1574){_0x451395['emit'](_0x239958,_0x1c1574);};}function removeListener(_0x236a0b,_0x4d85f9){return function(){SmsAccountEvents['removeListener'](_0x236a0b,_0x4d85f9);};}exports[_0xc675('0x3')]=function(_0x5c2f46){for(var _0x3b23bc=0x0,_0x2b55af=events[_0xc675('0x4')];_0x3b23bc<_0x2b55af;_0x3b23bc++){var _0x4757e8=events[_0x3b23bc];var _0x5ede4a=createListener(_0xc675('0x5')+_0x4757e8,_0x5c2f46);SmsAccountEvents['on'](_0x4757e8,_0x5ede4a);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index e7993bd..1c12f8b 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 _0x97b9=['exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','post','create','put','/:id','update','destroy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x97b9,0x1ee));var _0x997b=function(_0x4cd57e,_0xc0bc96){_0x4cd57e=_0x4cd57e-0x0;var _0x5848a2=_0x97b9[_0x4cd57e];return _0x5848a2;};'use strict';var multer=require('multer');var util=require(_0x997b('0x0'));var path=require(_0x997b('0x1'));var timeout=require(_0x997b('0x2'));var express=require('express');var router=express[_0x997b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x997b('0x4'));var interaction=require(_0x997b('0x5'));var config=require(_0x997b('0x6'));var controller=require(_0x997b('0x7'));router[_0x997b('0x8')]('/',auth[_0x997b('0x9')](),controller['index']);router[_0x997b('0x8')]('/:id',auth[_0x997b('0x9')](),controller['show']);router[_0x997b('0xa')]('/',auth['isAuthenticated'](),controller[_0x997b('0xb')]);router[_0x997b('0xc')](_0x997b('0xd'),auth[_0x997b('0x9')](),controller[_0x997b('0xe')]);router['delete'](_0x997b('0xd'),auth[_0x997b('0x9')](),controller[_0x997b('0xf')]);module[_0x997b('0x10')]=router; \ No newline at end of file +var _0x3174=['../../components/interaction/service','../../config/environment','./smsApplication.controller','isAuthenticated','index','/:id','post','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xe896bf,_0x4f8e5e){var _0x4c7a8a=function(_0x410ff2){while(--_0x410ff2){_0xe896bf['push'](_0xe896bf['shift']());}};_0x4c7a8a(++_0x4f8e5e);}(_0x3174,0x6b));var _0x4317=function(_0x4e9481,_0x4defa6){_0x4e9481=_0x4e9481-0x0;var _0x4006ff=_0x3174[_0x4e9481];return _0x4006ff;};'use strict';var multer=require(_0x4317('0x0'));var util=require(_0x4317('0x1'));var path=require(_0x4317('0x2'));var timeout=require('connect-timeout');var express=require(_0x4317('0x3'));var router=express[_0x4317('0x4')]();var fs_extra=require(_0x4317('0x5'));var auth=require(_0x4317('0x6'));var interaction=require(_0x4317('0x7'));var config=require(_0x4317('0x8'));var controller=require(_0x4317('0x9'));router['get']('/',auth[_0x4317('0xa')](),controller[_0x4317('0xb')]);router['get'](_0x4317('0xc'),auth[_0x4317('0xa')](),controller['show']);router[_0x4317('0xd')]('/',auth['isAuthenticated'](),controller[_0x4317('0xe')]);router[_0x4317('0xf')](_0x4317('0xc'),auth[_0x4317('0xa')](),controller['update']);router[_0x4317('0x10')]('/:id',auth[_0x4317('0xa')](),controller[_0x4317('0x11')]);module[_0x4317('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 411620a..85d8935 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 _0xb352=['exports','INTEGER','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x1f9503,_0x8e450b){var _0xaab94f=function(_0x5b0c4d){while(--_0x5b0c4d){_0x1f9503['push'](_0x1f9503['shift']());}};_0xaab94f(++_0x8e450b);}(_0xb352,0xc3));var _0x2b35=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb352[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2b35('0x0'));module[_0x2b35('0x1')]={'priority':{'type':Sequelize[_0x2b35('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2b35('0x3')},'appdata':{'type':Sequelize[_0x2b35('0x4')]()},'description':{'type':Sequelize[_0x2b35('0x5')]},'interval':{'type':Sequelize[_0x2b35('0x5')],'defaultValue':_0x2b35('0x6')}}; \ No newline at end of file +var _0xc5e3=['INTEGER','noop','STRING','*,*,*,*','sequelize','exports'];(function(_0x2861e4,_0x475263){var _0x45e027=function(_0x4928b5){while(--_0x4928b5){_0x2861e4['push'](_0x2861e4['shift']());}};_0x45e027(++_0x475263);}(_0xc5e3,0xac));var _0x3c5e=function(_0x3d964d,_0x5d348e){_0x3d964d=_0x3d964d-0x0;var _0x1ca6bf=_0xc5e3[_0x3d964d];return _0x1ca6bf;};'use strict';var Sequelize=require(_0x3c5e('0x0'));module[_0x3c5e('0x1')]={'priority':{'type':Sequelize[_0x3c5e('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3c5e('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x3c5e('0x4')],'defaultValue':_0x3c5e('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index acffff1..510a114 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 _0x7001=['squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','apply','reject','save','update','then','destroy','error','stack','name','send','index','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','SmsApplication','includeAll','catch','show','params','rawAttributes','length','include','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x54c10d,_0x2f2251){var _0x1fa703=function(_0x508eb4){while(--_0x508eb4){_0x54c10d['push'](_0x54c10d['shift']());}};_0x1fa703(++_0x2f2251);}(_0x7001,0x11a));var _0x1700=function(_0x511c1c,_0x4c0fa5){_0x511c1c=_0x511c1c-0x0;var _0x1d84d7=_0x7001[_0x511c1c];return _0x1d84d7;};'use strict';var pdf=require(_0x1700('0x0'));var emlformat=require(_0x1700('0x1'));var rimraf=require(_0x1700('0x2'));var zipdir=require(_0x1700('0x3'));var jsonpatch=require(_0x1700('0x4'));var rp=require(_0x1700('0x5'));var moment=require(_0x1700('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x1700('0x7'));var util=require(_0x1700('0x8'));var path=require(_0x1700('0x9'));var sox=require(_0x1700('0xa'));var csv=require(_0x1700('0xb'));var ejs=require(_0x1700('0xc'));var fs=require('fs');var fs_extra=require(_0x1700('0xd'));var _=require('lodash');var squel=require(_0x1700('0xe'));var crypto=require(_0x1700('0xf'));var jsforce=require(_0x1700('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1700('0x11'));var Papa=require(_0x1700('0x12'));var Redis=require(_0x1700('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1700('0x14'));var logger=require('../../config/logger')(_0x1700('0x15'));var utils=require('../../config/utils');var config=require(_0x1700('0x16'));var licenseUtil=require(_0x1700('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22fc16,_0x344068){_0x344068=_0x344068||0xcc;return function(_0x3ced7a){if(_0x3ced7a){return _0x22fc16[_0x1700('0x18')](_0x344068);}return _0x22fc16[_0x1700('0x19')](_0x344068)[_0x1700('0x1a')]();};}function respondWithResult(_0x486636,_0x347426){_0x347426=_0x347426||0xc8;return function(_0x3e3b46){if(_0x3e3b46){return _0x486636[_0x1700('0x19')](_0x347426)[_0x1700('0x1b')](_0x3e3b46);}};}function respondWithFilteredResult(_0x52db54,_0xfe4d83){return function(_0x169fe7){if(_0x169fe7){var _0x345898=_0x169fe7[_0x1700('0x1c')],_0x365c62=_0xfe4d83[_0x1700('0x1d')],_0x49fb88=_0xfe4d83['offset']+_0xfe4d83['limit'],_0x32a024;if(_0x49fb88>=_0x345898){_0x49fb88=_0x345898;_0x32a024=0xc8;}else{_0x32a024=0xce;}_0x52db54[_0x1700('0x19')](_0x32a024);return _0x52db54['set']('Content-Range',_0x365c62+'-'+_0x49fb88+'/'+_0x345898)[_0x1700('0x1b')](_0x169fe7);}return null;};}function patchUpdates(_0xd60f12){return function(_0x384dd5){try{jsonpatch[_0x1700('0x1e')](_0x384dd5,_0xd60f12,!![]);}catch(_0x44e40b){return BPromise[_0x1700('0x1f')](_0x44e40b);}return _0x384dd5[_0x1700('0x20')]();};}function saveUpdates(_0xe09283,_0x57c4e4){return function(_0x9f0c6c){if(_0x9f0c6c){return _0x9f0c6c[_0x1700('0x21')](_0xe09283)[_0x1700('0x22')](function(_0x877b39){return _0x877b39;});}return null;};}function removeEntity(_0x46dded,_0x2744c4){return function(_0x192034){if(_0x192034){return _0x192034[_0x1700('0x23')]()['then'](function(){_0x46dded[_0x1700('0x19')](0xcc)[_0x1700('0x1a')]();});}};}function handleEntityNotFound(_0x5997bc,_0x39f8b2){return function(_0xed98f1){if(!_0xed98f1){_0x5997bc['sendStatus'](0x194);}return _0xed98f1;};}function handleError(_0x3f4e65,_0x4d4f18){_0x4d4f18=_0x4d4f18||0x1f4;return function(_0x1ade54){logger[_0x1700('0x24')](_0x1ade54[_0x1700('0x25')]);if(_0x1ade54[_0x1700('0x26')]){delete _0x1ade54['name'];}_0x3f4e65[_0x1700('0x19')](_0x4d4f18)[_0x1700('0x27')](_0x1ade54);};}exports[_0x1700('0x28')]=function(_0x3e60d8,_0x394627){var _0x5daebf={},_0x23261f={},_0x588e5f={'count':0x0,'rows':[]};var _0x596a06=_['map'](db['SmsApplication']['rawAttributes'],function(_0x403898){return{'name':_0x403898[_0x1700('0x29')],'type':_0x403898[_0x1700('0x2a')][_0x1700('0x2b')]};});_0x23261f[_0x1700('0x2c')]=_[_0x1700('0x2d')](_0x596a06,_0x1700('0x26'));_0x23261f[_0x1700('0x2e')]=_[_0x1700('0x2f')](_0x3e60d8[_0x1700('0x2e')]);_0x23261f['filters']=_['intersection'](_0x23261f[_0x1700('0x2c')],_0x23261f[_0x1700('0x2e')]);_0x5daebf[_0x1700('0x30')]=_[_0x1700('0x31')](_0x23261f[_0x1700('0x2c')],qs[_0x1700('0x32')](_0x3e60d8[_0x1700('0x2e')]['fields']));_0x5daebf[_0x1700('0x30')]=_0x5daebf[_0x1700('0x30')]['length']?_0x5daebf['attributes']:_0x23261f['model'];if(!_0x3e60d8[_0x1700('0x2e')][_0x1700('0x33')](_0x1700('0x34'))){_0x5daebf[_0x1700('0x35')]=qs[_0x1700('0x35')](_0x3e60d8[_0x1700('0x2e')]['limit']);_0x5daebf['offset']=qs[_0x1700('0x1d')](_0x3e60d8[_0x1700('0x2e')]['offset']);}_0x5daebf[_0x1700('0x36')]=qs['sort'](_0x3e60d8[_0x1700('0x2e')][_0x1700('0x37')]);_0x5daebf[_0x1700('0x38')]=qs[_0x1700('0x39')](_[_0x1700('0x3a')](_0x3e60d8[_0x1700('0x2e')],_0x23261f[_0x1700('0x39')]),_0x596a06);if(_0x3e60d8[_0x1700('0x2e')]['filter']){_0x5daebf[_0x1700('0x38')]=_[_0x1700('0x3b')](_0x5daebf[_0x1700('0x38')],{'$or':_[_0x1700('0x2d')](_0x596a06,function(_0x94972a){if(_0x94972a[_0x1700('0x2a')]!==_0x1700('0x3c')){var _0x1c9e52={};_0x1c9e52[_0x94972a[_0x1700('0x26')]]={'$like':'%'+_0x3e60d8[_0x1700('0x2e')][_0x1700('0x3d')]+'%'};return _0x1c9e52;}})});}_0x5daebf=_[_0x1700('0x3b')]({},_0x5daebf,_0x3e60d8['options']);var _0x22edaa={'where':_0x5daebf[_0x1700('0x38')]};return db[_0x1700('0x3e')][_0x1700('0x1c')](_0x22edaa)[_0x1700('0x22')](function(_0x3e5dac){_0x588e5f[_0x1700('0x1c')]=_0x3e5dac;if(_0x3e60d8['query'][_0x1700('0x3f')]){_0x5daebf['include']=[{'all':!![]}];}return db['SmsApplication']['findAll'](_0x5daebf);})[_0x1700('0x22')](function(_0x24a3e9){_0x588e5f['rows']=_0x24a3e9;return _0x588e5f;})['then'](respondWithFilteredResult(_0x394627,_0x5daebf))[_0x1700('0x40')](handleError(_0x394627,null));};exports[_0x1700('0x41')]=function(_0x25bfbf,_0x3060c8){var _0x2e99ee={'raw':!![],'where':{'id':_0x25bfbf[_0x1700('0x42')]['id']}},_0x43b805={};_0x43b805[_0x1700('0x2c')]=_[_0x1700('0x2f')](db[_0x1700('0x3e')][_0x1700('0x43')]);_0x43b805[_0x1700('0x2e')]=_['keys'](_0x25bfbf[_0x1700('0x2e')]);_0x43b805[_0x1700('0x39')]=_[_0x1700('0x31')](_0x43b805[_0x1700('0x2c')],_0x43b805['query']);_0x2e99ee[_0x1700('0x30')]=_[_0x1700('0x31')](_0x43b805['model'],qs[_0x1700('0x32')](_0x25bfbf['query']['fields']));_0x2e99ee[_0x1700('0x30')]=_0x2e99ee[_0x1700('0x30')][_0x1700('0x44')]?_0x2e99ee[_0x1700('0x30')]:_0x43b805[_0x1700('0x2c')];if(_0x25bfbf['query'][_0x1700('0x3f')]){_0x2e99ee[_0x1700('0x45')]=[{'all':!![]}];}_0x2e99ee=_['merge']({},_0x2e99ee,_0x25bfbf[_0x1700('0x46')]);return db[_0x1700('0x3e')][_0x1700('0x47')](_0x2e99ee)['then'](handleEntityNotFound(_0x3060c8,null))[_0x1700('0x22')](respondWithResult(_0x3060c8,null))[_0x1700('0x40')](handleError(_0x3060c8,null));};exports[_0x1700('0x48')]=function(_0x26e6a0,_0x46c26c){return db[_0x1700('0x3e')][_0x1700('0x48')](_0x26e6a0['body'],{})['then'](respondWithResult(_0x46c26c,0xc9))[_0x1700('0x40')](handleError(_0x46c26c,null));};exports[_0x1700('0x21')]=function(_0x50a306,_0x46a805){if(_0x50a306['body']['id']){delete _0x50a306[_0x1700('0x49')]['id'];}return db[_0x1700('0x3e')][_0x1700('0x47')]({'where':{'id':_0x50a306[_0x1700('0x42')]['id']}})[_0x1700('0x22')](handleEntityNotFound(_0x46a805,null))[_0x1700('0x22')](saveUpdates(_0x50a306[_0x1700('0x49')],null))['then'](respondWithResult(_0x46a805,null))[_0x1700('0x40')](handleError(_0x46a805,null));};exports[_0x1700('0x23')]=function(_0x205329,_0xa85117){return db[_0x1700('0x3e')]['find']({'where':{'id':_0x205329['params']['id']}})['then'](handleEntityNotFound(_0xa85117,null))['then'](removeEntity(_0xa85117,null))[_0x1700('0x40')](handleError(_0xa85117,null));}; \ No newline at end of file +var _0xe3b5=['request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','SmsApplication','count','includeAll','findAll','show','params','include','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x30a528,_0x1d04f2){var _0x3e029c=function(_0x4e4b97){while(--_0x4e4b97){_0x30a528['push'](_0x30a528['shift']());}};_0x3e029c(++_0x1d04f2);}(_0xe3b5,0xdd));var _0x5e3b=function(_0x456825,_0x37ff79){_0x456825=_0x456825-0x0;var _0x5e3a06=_0xe3b5[_0x456825];return _0x5e3a06;};'use strict';var pdf=require(_0x5e3b('0x0'));var emlformat=require(_0x5e3b('0x1'));var rimraf=require(_0x5e3b('0x2'));var zipdir=require(_0x5e3b('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5e3b('0x4'));var moment=require(_0x5e3b('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5e3b('0x6'));var path=require(_0x5e3b('0x7'));var sox=require(_0x5e3b('0x8'));var csv=require(_0x5e3b('0x9'));var ejs=require(_0x5e3b('0xa'));var fs=require('fs');var fs_extra=require(_0x5e3b('0xb'));var _=require(_0x5e3b('0xc'));var squel=require(_0x5e3b('0xd'));var crypto=require(_0x5e3b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5e3b('0xf'));var toCsv=require(_0x5e3b('0x9'));var querystring=require(_0x5e3b('0x10'));var Papa=require(_0x5e3b('0x11'));var Redis=require(_0x5e3b('0x12'));var authService=require(_0x5e3b('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e3b('0x14'));var logger=require(_0x5e3b('0x15'))(_0x5e3b('0x16'));var utils=require('../../config/utils');var config=require(_0x5e3b('0x17'));var licenseUtil=require(_0x5e3b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35b3e2,_0x2bbdb5){_0x2bbdb5=_0x2bbdb5||0xcc;return function(_0x5abc86){if(_0x5abc86){return _0x35b3e2['sendStatus'](_0x2bbdb5);}return _0x35b3e2[_0x5e3b('0x19')](_0x2bbdb5)['end']();};}function respondWithResult(_0x19d174,_0x1e3566){_0x1e3566=_0x1e3566||0xc8;return function(_0xe17e7e){if(_0xe17e7e){return _0x19d174[_0x5e3b('0x19')](_0x1e3566)[_0x5e3b('0x1a')](_0xe17e7e);}};}function respondWithFilteredResult(_0x670945,_0x22a11c){return function(_0x259832){if(_0x259832){var _0x768ab6=_0x259832['count'],_0x18a212=_0x22a11c[_0x5e3b('0x1b')],_0x7e19b2=_0x22a11c[_0x5e3b('0x1b')]+_0x22a11c[_0x5e3b('0x1c')],_0x1ae1d6;if(_0x7e19b2>=_0x768ab6){_0x7e19b2=_0x768ab6;_0x1ae1d6=0xc8;}else{_0x1ae1d6=0xce;}_0x670945[_0x5e3b('0x19')](_0x1ae1d6);return _0x670945[_0x5e3b('0x1d')](_0x5e3b('0x1e'),_0x18a212+'-'+_0x7e19b2+'/'+_0x768ab6)[_0x5e3b('0x1a')](_0x259832);}return null;};}function patchUpdates(_0x6b89b1){return function(_0x5b2270){try{jsonpatch[_0x5e3b('0x1f')](_0x5b2270,_0x6b89b1,!![]);}catch(_0x203da3){return BPromise['reject'](_0x203da3);}return _0x5b2270[_0x5e3b('0x20')]();};}function saveUpdates(_0x4d0428,_0x65f09d){return function(_0x20d599){if(_0x20d599){return _0x20d599[_0x5e3b('0x21')](_0x4d0428)[_0x5e3b('0x22')](function(_0x4e5083){return _0x4e5083;});}return null;};}function removeEntity(_0x3cfa05,_0x4e116a){return function(_0x1034ad){if(_0x1034ad){return _0x1034ad[_0x5e3b('0x23')]()[_0x5e3b('0x22')](function(){_0x3cfa05[_0x5e3b('0x19')](0xcc)[_0x5e3b('0x24')]();});}};}function handleEntityNotFound(_0xf1da7c,_0x275000){return function(_0x5480c7){if(!_0x5480c7){_0xf1da7c['sendStatus'](0x194);}return _0x5480c7;};}function handleError(_0x890b2,_0x47b303){_0x47b303=_0x47b303||0x1f4;return function(_0x1e59fc){logger[_0x5e3b('0x25')](_0x1e59fc[_0x5e3b('0x26')]);if(_0x1e59fc[_0x5e3b('0x27')]){delete _0x1e59fc[_0x5e3b('0x27')];}_0x890b2['status'](_0x47b303)[_0x5e3b('0x28')](_0x1e59fc);};}exports['index']=function(_0x3899c5,_0x3c59bc){var _0x160cdf={},_0x10bb52={},_0x3851b0={'count':0x0,'rows':[]};var _0x1530f4=_[_0x5e3b('0x29')](db['SmsApplication'][_0x5e3b('0x2a')],function(_0x49053c){return{'name':_0x49053c[_0x5e3b('0x2b')],'type':_0x49053c['type'][_0x5e3b('0x2c')]};});_0x10bb52[_0x5e3b('0x2d')]=_['map'](_0x1530f4,_0x5e3b('0x27'));_0x10bb52[_0x5e3b('0x2e')]=_[_0x5e3b('0x2f')](_0x3899c5[_0x5e3b('0x2e')]);_0x10bb52[_0x5e3b('0x30')]=_[_0x5e3b('0x31')](_0x10bb52[_0x5e3b('0x2d')],_0x10bb52['query']);_0x160cdf[_0x5e3b('0x32')]=_[_0x5e3b('0x31')](_0x10bb52[_0x5e3b('0x2d')],qs[_0x5e3b('0x33')](_0x3899c5[_0x5e3b('0x2e')][_0x5e3b('0x33')]));_0x160cdf[_0x5e3b('0x32')]=_0x160cdf[_0x5e3b('0x32')][_0x5e3b('0x34')]?_0x160cdf['attributes']:_0x10bb52[_0x5e3b('0x2d')];if(!_0x3899c5[_0x5e3b('0x2e')][_0x5e3b('0x35')](_0x5e3b('0x36'))){_0x160cdf[_0x5e3b('0x1c')]=qs['limit'](_0x3899c5['query'][_0x5e3b('0x1c')]);_0x160cdf[_0x5e3b('0x1b')]=qs[_0x5e3b('0x1b')](_0x3899c5[_0x5e3b('0x2e')][_0x5e3b('0x1b')]);}_0x160cdf[_0x5e3b('0x37')]=qs[_0x5e3b('0x38')](_0x3899c5[_0x5e3b('0x2e')][_0x5e3b('0x38')]);_0x160cdf[_0x5e3b('0x39')]=qs['filters'](_[_0x5e3b('0x3a')](_0x3899c5[_0x5e3b('0x2e')],_0x10bb52[_0x5e3b('0x30')]),_0x1530f4);if(_0x3899c5[_0x5e3b('0x2e')][_0x5e3b('0x3b')]){_0x160cdf['where']=_[_0x5e3b('0x3c')](_0x160cdf[_0x5e3b('0x39')],{'$or':_[_0x5e3b('0x29')](_0x1530f4,function(_0x337b97){if(_0x337b97[_0x5e3b('0x3d')]!==_0x5e3b('0x3e')){var _0x1fa83f={};_0x1fa83f[_0x337b97[_0x5e3b('0x27')]]={'$like':'%'+_0x3899c5[_0x5e3b('0x2e')][_0x5e3b('0x3b')]+'%'};return _0x1fa83f;}})});}_0x160cdf=_[_0x5e3b('0x3c')]({},_0x160cdf,_0x3899c5[_0x5e3b('0x3f')]);var _0xbd1153={'where':_0x160cdf['where']};return db[_0x5e3b('0x40')][_0x5e3b('0x41')](_0xbd1153)[_0x5e3b('0x22')](function(_0xdffafb){_0x3851b0[_0x5e3b('0x41')]=_0xdffafb;if(_0x3899c5['query'][_0x5e3b('0x42')]){_0x160cdf['include']=[{'all':!![]}];}return db[_0x5e3b('0x40')][_0x5e3b('0x43')](_0x160cdf);})[_0x5e3b('0x22')](function(_0x3344a2){_0x3851b0['rows']=_0x3344a2;return _0x3851b0;})['then'](respondWithFilteredResult(_0x3c59bc,_0x160cdf))['catch'](handleError(_0x3c59bc,null));};exports[_0x5e3b('0x44')]=function(_0x18bee3,_0x1cdbd3){var _0x3b4e3e={'raw':!![],'where':{'id':_0x18bee3[_0x5e3b('0x45')]['id']}},_0x50c7f7={};_0x50c7f7['model']=_['keys'](db['SmsApplication'][_0x5e3b('0x2a')]);_0x50c7f7[_0x5e3b('0x2e')]=_[_0x5e3b('0x2f')](_0x18bee3[_0x5e3b('0x2e')]);_0x50c7f7[_0x5e3b('0x30')]=_[_0x5e3b('0x31')](_0x50c7f7[_0x5e3b('0x2d')],_0x50c7f7[_0x5e3b('0x2e')]);_0x3b4e3e['attributes']=_[_0x5e3b('0x31')](_0x50c7f7[_0x5e3b('0x2d')],qs[_0x5e3b('0x33')](_0x18bee3[_0x5e3b('0x2e')][_0x5e3b('0x33')]));_0x3b4e3e[_0x5e3b('0x32')]=_0x3b4e3e[_0x5e3b('0x32')][_0x5e3b('0x34')]?_0x3b4e3e[_0x5e3b('0x32')]:_0x50c7f7[_0x5e3b('0x2d')];if(_0x18bee3[_0x5e3b('0x2e')][_0x5e3b('0x42')]){_0x3b4e3e[_0x5e3b('0x46')]=[{'all':!![]}];}_0x3b4e3e=_[_0x5e3b('0x3c')]({},_0x3b4e3e,_0x18bee3['options']);return db[_0x5e3b('0x40')][_0x5e3b('0x47')](_0x3b4e3e)[_0x5e3b('0x22')](handleEntityNotFound(_0x1cdbd3,null))[_0x5e3b('0x22')](respondWithResult(_0x1cdbd3,null))[_0x5e3b('0x48')](handleError(_0x1cdbd3,null));};exports[_0x5e3b('0x49')]=function(_0x445366,_0x268814){return db['SmsApplication']['create'](_0x445366['body'],{})['then'](respondWithResult(_0x268814,0xc9))[_0x5e3b('0x48')](handleError(_0x268814,null));};exports[_0x5e3b('0x21')]=function(_0x3dca04,_0x1effb6){if(_0x3dca04[_0x5e3b('0x4a')]['id']){delete _0x3dca04[_0x5e3b('0x4a')]['id'];}return db[_0x5e3b('0x40')]['find']({'where':{'id':_0x3dca04[_0x5e3b('0x45')]['id']}})[_0x5e3b('0x22')](handleEntityNotFound(_0x1effb6,null))['then'](saveUpdates(_0x3dca04[_0x5e3b('0x4a')],null))['then'](respondWithResult(_0x1effb6,null))[_0x5e3b('0x48')](handleError(_0x1effb6,null));};exports[_0x5e3b('0x23')]=function(_0x46b98f,_0x2f8fc0){return db[_0x5e3b('0x40')][_0x5e3b('0x47')]({'where':{'id':_0x46b98f[_0x5e3b('0x45')]['id']}})['then'](handleEntityNotFound(_0x2f8fc0,null))[_0x5e3b('0x22')](removeEntity(_0x2f8fc0,null))['catch'](handleError(_0x2f8fc0,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 9199184..b553b19 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 _0x1393=['api','request-promise','path','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x1393,0x19e));var _0x3139=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x1393[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x3139('0x0'));var util=require('util');var logger=require(_0x3139('0x1'))(_0x3139('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3139('0x3'));var fs=require('fs');var path=require(_0x3139('0x4'));var rimraf=require('rimraf');var config=require(_0x3139('0x5'));var attributes=require(_0x3139('0x6'));module[_0x3139('0x7')]=function(_0x289a5b,_0xcbc440){return _0x289a5b[_0x3139('0x8')](_0x3139('0x9'),attributes,{'tableName':_0x3139('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3139('0xb'),'collate':_0x3139('0xc')});}; \ No newline at end of file +var _0x4d9d=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash'];(function(_0x56fa4d,_0x52faff){var _0x22fbcb=function(_0x2c7d49){while(--_0x2c7d49){_0x56fa4d['push'](_0x56fa4d['shift']());}};_0x22fbcb(++_0x52faff);}(_0x4d9d,0x1df));var _0xd4d9=function(_0x17d133,_0x3aebc5){_0x17d133=_0x17d133-0x0;var _0xf4f7a2=_0x4d9d[_0x17d133];return _0xf4f7a2;};'use strict';var _=require(_0xd4d9('0x0'));var util=require(_0xd4d9('0x1'));var logger=require(_0xd4d9('0x2'))(_0xd4d9('0x3'));var moment=require(_0xd4d9('0x4'));var BPromise=require(_0xd4d9('0x5'));var rp=require(_0xd4d9('0x6'));var fs=require('fs');var path=require(_0xd4d9('0x7'));var rimraf=require(_0xd4d9('0x8'));var config=require(_0xd4d9('0x9'));var attributes=require(_0xd4d9('0xa'));module[_0xd4d9('0xb')]=function(_0x236616,_0x3ed109){return _0x236616[_0xd4d9('0xc')](_0xd4d9('0xd'),attributes,{'tableName':_0xd4d9('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd4d9('0xf')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index a642d41..ebae35f 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 _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x456a39,_0x36c9b3){var _0x1ec383=function(_0x404270){while(--_0x404270){_0x456a39['push'](_0x456a39['shift']());}};_0x1ec383(++_0x36c9b3);}(_0xabce,0x103));var _0xeabc=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xabce[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('SmsApplication,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});} \ No newline at end of file +var _0x41fe=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','debug','error','code','SmsApplication,\x20%s,\x20%s','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x33ba2a,_0x472888){var _0x1c77f8=function(_0x5b7e46){while(--_0x5b7e46){_0x33ba2a['push'](_0x33ba2a['shift']());}};_0x1c77f8(++_0x472888);}(_0x41fe,0xd1));var _0xe41f=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0x41fe[_0x2bc3f4];return _0x14ac53;};'use strict';var _=require(_0xe41f('0x0'));var util=require(_0xe41f('0x1'));var moment=require(_0xe41f('0x2'));var BPromise=require(_0xe41f('0x3'));var rs=require(_0xe41f('0x4'));var fs=require('fs');var Redis=require(_0xe41f('0x5'));var db=require(_0xe41f('0x6'))['db'];var utils=require(_0xe41f('0x7'));var logger=require(_0xe41f('0x8'))(_0xe41f('0x9'));var config=require(_0xe41f('0xa'));var jayson=require(_0xe41f('0xb'));var client=jayson[_0xe41f('0xc')][_0xe41f('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x32a410,_0x6fda32,_0x23fdc9){return new BPromise(function(_0x519361,_0x27ba71){return client[_0xe41f('0xe')](_0x32a410,_0x23fdc9)['then'](function(_0x7303e4){logger['info']('SmsApplication,\x20%s,\x20%s',_0x6fda32,'request\x20sent');logger[_0xe41f('0xf')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x6fda32,'request\x20sent',JSON['stringify'](_0x7303e4));if(_0x7303e4[_0xe41f('0x10')]){if(_0x7303e4[_0xe41f('0x10')][_0xe41f('0x11')]===0x1f4){logger[_0xe41f('0x10')](_0xe41f('0x12'),_0x6fda32,_0x7303e4[_0xe41f('0x10')][_0xe41f('0x13')]);return _0x27ba71(_0x7303e4[_0xe41f('0x10')][_0xe41f('0x13')]);}logger[_0xe41f('0x10')]('SmsApplication,\x20%s,\x20%s',_0x6fda32,_0x7303e4[_0xe41f('0x10')][_0xe41f('0x13')]);return _0x519361(_0x7303e4['error'][_0xe41f('0x13')]);}else{logger[_0xe41f('0x14')](_0xe41f('0x12'),_0x6fda32,_0xe41f('0x15'));_0x519361(_0x7303e4[_0xe41f('0x16')][_0xe41f('0x13')]);}})[_0xe41f('0x17')](function(_0x54635b){logger['error'](_0xe41f('0x12'),_0x6fda32,_0x54635b);_0x27ba71(_0x54635b);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index a9d5db7..bec6b32 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 _0xb96d=['addTags','put','/:id','smsinteraction:update','update','delete','smsinteraction:destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./smsInteraction.controller','get','isAuthenticated','index','/describe','show','/:id/messages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xb96d,0x9e));var _0xdb96=function(_0x3e531a,_0x28a82a){_0x3e531a=_0x3e531a-0x0;var _0x3c2574=_0xb96d[_0x3e531a];return _0x3c2574;};'use strict';var multer=require('multer');var util=require(_0xdb96('0x0'));var path=require(_0xdb96('0x1'));var timeout=require(_0xdb96('0x2'));var express=require('express');var router=express[_0xdb96('0x3')]();var fs_extra=require(_0xdb96('0x4'));var auth=require(_0xdb96('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdb96('0x6'));router[_0xdb96('0x7')]('/',auth[_0xdb96('0x8')](),controller[_0xdb96('0x9')]);router['get'](_0xdb96('0xa'),auth[_0xdb96('0x8')](),controller['describe']);router[_0xdb96('0x7')]('/:id',auth[_0xdb96('0x8')](),controller[_0xdb96('0xb')]);router['get'](_0xdb96('0xc'),auth[_0xdb96('0x8')](),controller['getMessages']);router[_0xdb96('0x7')](_0xdb96('0xd'),auth[_0xdb96('0x8')](),controller[_0xdb96('0xe')]);router['post']('/',auth[_0xdb96('0x8')](),controller[_0xdb96('0xf')]);router[_0xdb96('0x10')]('/:id/messages',auth[_0xdb96('0x8')](),controller[_0xdb96('0x11')]);router[_0xdb96('0x10')](_0xdb96('0x12'),auth[_0xdb96('0x8')](),interaction[_0xdb96('0x13')](_0xdb96('0x14'),_0xdb96('0x15')),controller[_0xdb96('0x16')]);router[_0xdb96('0x17')](_0xdb96('0x18'),auth[_0xdb96('0x8')](),interaction[_0xdb96('0x13')]('sms',_0xdb96('0x19')),controller[_0xdb96('0x1a')]);router[_0xdb96('0x1b')](_0xdb96('0x18'),auth['isAuthenticated'](),interaction[_0xdb96('0x13')](_0xdb96('0x14'),_0xdb96('0x1c')),controller['destroy']);router['delete'](_0xdb96('0x12'),auth['isAuthenticated'](),controller['removeTags']);module[_0xdb96('0x1d')]=router; \ No newline at end of file +var _0x2da6=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','create','post','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','/:id','smsinteraction:update','update','delete','smsinteraction:destroy','destroy'];(function(_0x10df03,_0x43bd49){var _0x43cbed=function(_0x4b13d9){while(--_0x4b13d9){_0x10df03['push'](_0x10df03['shift']());}};_0x43cbed(++_0x43bd49);}(_0x2da6,0x1dd));var _0x62da=function(_0x4063f2,_0x492432){_0x4063f2=_0x4063f2-0x0;var _0x72b663=_0x2da6[_0x4063f2];return _0x72b663;};'use strict';var multer=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var path=require(_0x62da('0x2'));var timeout=require(_0x62da('0x3'));var express=require(_0x62da('0x4'));var router=express[_0x62da('0x5')]();var fs_extra=require(_0x62da('0x6'));var auth=require(_0x62da('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x62da('0x8'));router[_0x62da('0x9')]('/',auth[_0x62da('0xa')](),controller[_0x62da('0xb')]);router[_0x62da('0x9')](_0x62da('0xc'),auth[_0x62da('0xa')](),controller[_0x62da('0xd')]);router[_0x62da('0x9')]('/:id',auth[_0x62da('0xa')](),controller[_0x62da('0xe')]);router[_0x62da('0x9')](_0x62da('0xf'),auth['isAuthenticated'](),controller[_0x62da('0x10')]);router[_0x62da('0x9')](_0x62da('0x11'),auth[_0x62da('0xa')](),controller[_0x62da('0x12')]);router['post']('/',auth[_0x62da('0xa')](),controller[_0x62da('0x13')]);router[_0x62da('0x14')](_0x62da('0xf'),auth[_0x62da('0xa')](),controller['addMessage']);router['post'](_0x62da('0x15'),auth[_0x62da('0xa')](),interaction[_0x62da('0x16')](_0x62da('0x17'),_0x62da('0x18')),controller[_0x62da('0x19')]);router[_0x62da('0x1a')](_0x62da('0x1b'),auth[_0x62da('0xa')](),interaction[_0x62da('0x16')](_0x62da('0x17'),_0x62da('0x1c')),controller[_0x62da('0x1d')]);router[_0x62da('0x1e')]('/:id',auth['isAuthenticated'](),interaction[_0x62da('0x16')]('sms',_0x62da('0x1f')),controller[_0x62da('0x20')]);router[_0x62da('0x1e')]('/:id/tags',auth[_0x62da('0xa')](),controller['removeTags']);module[_0x62da('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 6704daa..7adfece 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 _0x21e8=['moment','exports','STRING','DATE','out','sequelize'];(function(_0x5a7710,_0x1f6deb){var _0xfb7c53=function(_0x60e370){while(--_0x60e370){_0x5a7710['push'](_0x5a7710['shift']());}};_0xfb7c53(++_0x1f6deb);}(_0x21e8,0x101));var _0x821e=function(_0x1841fe,_0x10e34d){_0x1841fe=_0x1841fe-0x0;var _0x2cdd36=_0x21e8[_0x1841fe];return _0x2cdd36;};'use strict';var Sequelize=require(_0x821e('0x0'));var moment=require(_0x821e('0x1'));module[_0x821e('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x821e('0x3')]},'thirdDisposition':{'type':Sequelize[_0x821e('0x3')]},'note':{'type':Sequelize[_0x821e('0x3')]},'phone':{'type':Sequelize[_0x821e('0x3')]},'read1stAt':{'type':Sequelize[_0x821e('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x821e('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x821e('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x821e('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x8413=['STRING','out','ENUM','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x42fba6,_0x6d76b7){var _0x3a3312=function(_0x24fdc1){while(--_0x24fdc1){_0x42fba6['push'](_0x42fba6['shift']());}};_0x3a3312(++_0x6d76b7);}(_0x8413,0xd3));var _0x3841=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x8413[_0x42245d];return _0x4b211a;};'use strict';var Sequelize=require(_0x3841('0x0'));var moment=require(_0x3841('0x1'));module[_0x3841('0x2')]={'closed':{'type':Sequelize[_0x3841('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3841('0x4')]},'disposition':{'type':Sequelize[_0x3841('0x5')]},'secondDisposition':{'type':Sequelize[_0x3841('0x5')]},'thirdDisposition':{'type':Sequelize[_0x3841('0x5')]},'note':{'type':Sequelize[_0x3841('0x5')]},'phone':{'type':Sequelize[_0x3841('0x5')]},'read1stAt':{'type':Sequelize[_0x3841('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x3841('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3841('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x3841('0x7')]('in',_0x3841('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 8e63f64..29c1a15 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 _0xa9e0=['rawAttributes','includeAll','include','merge','create','body','params','describe','addMessage','SmsMessage','ids','omit','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','format','CmContact','firstName','lastName','Messages','secret','Owner','get','mkdirSync','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','YYYY-MM-DD','N.A.','closedAt','disposition','direction','out','System','views','downloadInteraction.html','toFile','transcript-','.pdf','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','sendStatus','end','json','count','offset','limit','status','set','apply','save','then','destroy','error','name','send','map','fullname','TagIds','Tags','split','forEach','push','catch','index','SmsInteraction','fieldName','type','key','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','u.id','u.fullname','ui.SmsInteractionId','from','user_has_sms_interactions','left_join','users','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','`\x20=\x200','having','`\x20>\x200','Contact','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','text','start','some','compact','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','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?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','isEmpty','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','a.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','show','model'];(function(_0xe8668f,_0x42446c){var _0xf3d4ff=function(_0x5447d6){while(--_0x5447d6){_0xe8668f['push'](_0xe8668f['shift']());}};_0xf3d4ff(++_0x42446c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var fs_extra=require(_0x0a9e('0xa'));var _=require(_0x0a9e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0a9e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0a9e('0xd'));var Papa=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var licenseUtil=require(_0x0a9e('0x14'));var db=require(_0x0a9e('0x15'))['db'];config[_0x0a9e('0x16')]=_[_0x0a9e('0x17')](config[_0x0a9e('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0x18'))(new Redis(config[_0x0a9e('0x16')]));require(_0x0a9e('0x19'))[_0x0a9e('0x1a')](socket);function respondWithStatusCode(_0x44dcfd,_0x4d5611){_0x4d5611=_0x4d5611||0xcc;return function(_0x52a03d){if(_0x52a03d){return _0x44dcfd[_0x0a9e('0x1b')](_0x4d5611);}return _0x44dcfd['status'](_0x4d5611)[_0x0a9e('0x1c')]();};}function respondWithResult(_0x519dfd,_0x16033c){_0x16033c=_0x16033c||0xc8;return function(_0x12066b){if(_0x12066b){return _0x519dfd['status'](_0x16033c)[_0x0a9e('0x1d')](_0x12066b);}};}function respondWithFilteredResult(_0x5a0a06,_0x459eb1){return function(_0x478723){if(_0x478723){var _0x106033=_0x478723[_0x0a9e('0x1e')],_0x205fd6=_0x459eb1[_0x0a9e('0x1f')],_0x31b1ca=_0x459eb1[_0x0a9e('0x1f')]+_0x459eb1[_0x0a9e('0x20')],_0x2eb11f;if(_0x31b1ca>=_0x106033){_0x31b1ca=_0x106033;_0x2eb11f=0xc8;}else{_0x2eb11f=0xce;}_0x5a0a06[_0x0a9e('0x21')](_0x2eb11f);return _0x5a0a06[_0x0a9e('0x22')]('Content-Range',_0x205fd6+'-'+_0x31b1ca+'/'+_0x106033)[_0x0a9e('0x1d')](_0x478723);}return null;};}function patchUpdates(_0x155cce){return function(_0x53682f){try{jsonpatch[_0x0a9e('0x23')](_0x53682f,_0x155cce,!![]);}catch(_0x5a09ef){return BPromise['reject'](_0x5a09ef);}return _0x53682f[_0x0a9e('0x24')]();};}function saveUpdates(_0x432e56,_0x38e7c4){return function(_0x30bae6){if(_0x30bae6){return _0x30bae6['update'](_0x432e56)[_0x0a9e('0x25')](function(_0x2fb0e4){return _0x2fb0e4;});}return null;};}function removeEntity(_0x3b45bc,_0x4d00e6){return function(_0x370d86){if(_0x370d86){return _0x370d86[_0x0a9e('0x26')]()[_0x0a9e('0x25')](function(){_0x3b45bc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x197ec0,_0x3a8e58){return function(_0x40c424){if(!_0x40c424){_0x197ec0[_0x0a9e('0x1b')](0x194);}return _0x40c424;};}function handleError(_0x526cf3,_0x384319){_0x384319=_0x384319||0x1f4;return function(_0x479bc4){logger[_0x0a9e('0x27')](_0x479bc4['stack']);if(_0x479bc4[_0x0a9e('0x28')]){delete _0x479bc4[_0x0a9e('0x28')];}_0x526cf3[_0x0a9e('0x21')](_0x384319)[_0x0a9e('0x29')](_0x479bc4);};}function getInteractionUsers(_0x140511,_0x1538a4){return new BPromise(function(_0x11c3b6,_0x14de77){try{if(_0x1538a4[_0x140511['id']]){_0x140511['Users']=_[_0x0a9e('0x2a')](_0x1538a4[_0x140511['id']],function(_0x468813){return{'id':_0x468813['id'],'fullname':_0x468813[_0x0a9e('0x2b')]};});}}catch(_0x2ec755){_0x14de77(_0x2ec755);}_0x11c3b6(_0x140511);});}function getInteractionTags(_0x5c877d,_0x15b200){return new BPromise(function(_0x40e7a3,_0x1843b2){try{if(_0x5c877d[_0x0a9e('0x2c')]){_0x5c877d[_0x0a9e('0x2d')]=[];_0x5c877d[_0x0a9e('0x2c')][_0x0a9e('0x2e')](',')[_0x0a9e('0x2f')](function(_0x1dbde2){_0x5c877d['Tags'][_0x0a9e('0x30')](_0x15b200[_0x1dbde2]);});}delete _0x5c877d['TagIds'];}catch(_0x2407f9){_0x1843b2(_0x2407f9);}_0x40e7a3(_0x5c877d);});}function updateSmsInteraction(_0x3ae878,_0x1122db,_0x33bdb7){return new BPromise(function(_0x25ce3a,_0x5180f1){return getInteractionUsers(_0x3ae878,_0x33bdb7)[_0x0a9e('0x25')](function(_0x46f0a5){return getInteractionTags(_0x46f0a5,_0x1122db);})[_0x0a9e('0x25')](function(_0x2da5c0){_0x25ce3a(_0x2da5c0);})[_0x0a9e('0x31')](function(_0x409319){_0x5180f1(_0x409319);});});}exports[_0x0a9e('0x32')]=function(_0x39e565,_0x5583a4){var _0x44295a={},_0x5e7238={},_0x2cc7a0={'count':0x0,'rows':[]};var _0x14b13f=_[_0x0a9e('0x2a')](db[_0x0a9e('0x33')]['rawAttributes'],function(_0x191e91){return{'name':_0x191e91[_0x0a9e('0x34')],'type':_0x191e91[_0x0a9e('0x35')][_0x0a9e('0x36')]};});_0x5e7238['model']=_['map'](_0x14b13f,_0x0a9e('0x28'));_0x5e7238['query']=_[_0x0a9e('0x37')](_0x39e565[_0x0a9e('0x38')]);_0x5e7238[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5e7238['model'],_0x5e7238[_0x0a9e('0x38')]);_0x44295a[_0x0a9e('0x3b')]=_[_0x0a9e('0x3a')](_0x5e7238['model'],qs[_0x0a9e('0x3c')](_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x3c')]));_0x44295a['attributes']=_0x44295a['attributes'][_0x0a9e('0x3d')]?_0x44295a[_0x0a9e('0x3b')]:_0x5e7238['model'];if(!_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x3e')](_0x0a9e('0x3f'))){_0x44295a[_0x0a9e('0x20')]=qs['limit'](_0x39e565['query'][_0x0a9e('0x20')]);_0x44295a[_0x0a9e('0x1f')]=qs['offset'](_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x1f')]);}_0x44295a[_0x0a9e('0x40')]=qs['sort'](_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x41')]);_0x44295a[_0x0a9e('0x42')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x43')](_0x39e565[_0x0a9e('0x38')],_0x5e7238[_0x0a9e('0x39')]),_0x14b13f);var _0x45a9b8=[];var _0x23b089=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('id')[_0x0a9e('0x45')](_0x0a9e('0x28'))[_0x0a9e('0x45')](_0x0a9e('0x46'))['from']('tools_tags');var _0x473fdc=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')](_0x0a9e('0x47'))[_0x0a9e('0x45')](_0x0a9e('0x48'))[_0x0a9e('0x45')](_0x0a9e('0x49'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'ui')[_0x0a9e('0x4c')](_0x0a9e('0x4d'),'u','u.id\x20=\x20ui.UserId');var _0x117c99=squel[_0x0a9e('0x44')]()[_0x0a9e('0x4a')](_0x0a9e('0x4e'),'i')[_0x0a9e('0x4c')](_0x0a9e('0x4f'),'c',_0x0a9e('0x50'))[_0x0a9e('0x4c')]('users','o',_0x0a9e('0x51'))['left_join'](_0x0a9e('0x52'),'a',_0x0a9e('0x53'))[_0x0a9e('0x4c')]('sms_messages','me',_0x0a9e('0x54'))[_0x0a9e('0x4c')](_0x0a9e('0x55'),'it',_0x0a9e('0x56'))[_0x0a9e('0x4c')](_0x0a9e('0x57'),'t',_0x0a9e('0x58'));var _0x5bbcde=squel[_0x0a9e('0x59')]();var _0x1bde3c=[];var _0x1b5e80=squel[_0x0a9e('0x59')]();var _0x409789;if(_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x5a')]){_0x409789=as[_0x0a9e('0x5b')](_0x39e565[_0x0a9e('0x38')]['search']);var _0xe401a=_0x409789[_0x0a9e('0x5c')];for(var _0x4f7240=0x0;_0x4f7240<_0x409789['conditions']['length'];_0x4f7240++){var _0x1adfee=_0x409789[_0x0a9e('0x5d')][_0x4f7240];var _0x37edaa='i';var _0x11545a=_[_0x0a9e('0x5e')](_0x14b13f,[_0x0a9e('0x28'),_0x1adfee[_0x0a9e('0x45')]]);if(!_0x11545a){switch(_0x1adfee[_0x0a9e('0x45')]){case'unreadMessages':if(_0x1adfee['value']==0x1){_0x117c99['having']('`'+_0x1adfee[_0x0a9e('0x45')]+_0x0a9e('0x5f'));}else{_0x117c99[_0x0a9e('0x60')]('`'+_0x1adfee['field']+_0x0a9e('0x61'));}break;case _0x0a9e('0x62'):if(_0x1adfee['operator']==='$substring'){if(_0x1adfee[_0x0a9e('0x63')]['split']('\x20')[_0x0a9e('0x3d')]>0x1){_0x5bbcde[_0xe401a]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x64')](_0x1adfee[_0x0a9e('0x63')]),null);}else{var _0x439340='%'+_0x1adfee['value']+'%';_0x5bbcde[_0xe401a](_0x0a9e('0x65'),_0x439340,_0x439340,_0x439340);}}else{_0x11545a=_[_0x0a9e('0x5e')](_0x14b13f,['name','ContactId']);_0x1adfee[_0x0a9e('0x45')]=_0x0a9e('0x66');_0x7be420=as['buildExpression'](_0x37edaa,_0x11545a[_0x0a9e('0x35')],_0x1adfee);_0x5bbcde[_0xe401a](_0x7be420['text'],_0x7be420[_0x0a9e('0x63')]['start'],_0x7be420[_0x0a9e('0x63')]['end']);}break;case'Tag':var _0x5df0ad=_0x1adfee[_0x0a9e('0x63')]['split'](',')[_0x0a9e('0x2a')](function(_0x65432){return Number(_0x65432);});_0x5df0ad[_0x0a9e('0x2f')](function(_0x19b4df){_0x1b5e80['or'](_0x0a9e('0x67'),'%,'+_0x19b4df+',%');});_0x1bde3c=_[_0x0a9e('0x68')](_0x1bde3c,_0x5df0ad);break;case _0x0a9e('0x69'):if(_0x1adfee[_0x0a9e('0x6a')]==='$substring'){_0x5bbcde[_0xe401a](_0x0a9e('0x6b'),'%'+_0x1adfee[_0x0a9e('0x63')]+'%',null);}else{_0x11545a=_[_0x0a9e('0x5e')](_0x14b13f,[_0x0a9e('0x28'),_0x0a9e('0x6c')]);_0x1adfee[_0x0a9e('0x45')]='UserId';_0x7be420=as[_0x0a9e('0x6d')](_0x37edaa,_0x11545a[_0x0a9e('0x35')],_0x1adfee);_0x5bbcde[_0xe401a](_0x7be420['text'],_0x7be420[_0x0a9e('0x63')]['start'],_0x7be420[_0x0a9e('0x63')]['end']);}break;case'body':_0x7be420=as['buildExpression']('me',null,_0x1adfee);_0x5bbcde[_0xe401a](_0x7be420[_0x0a9e('0x6e')],_0x7be420['value'][_0x0a9e('0x6f')],_0x7be420[_0x0a9e('0x63')][_0x0a9e('0x1c')]);break;}}else{var _0x7be420=as[_0x0a9e('0x6d')](_0x37edaa,_0x11545a[_0x0a9e('0x35')],_0x1adfee);_0x5bbcde[_0xe401a](_0x7be420['text'],_0x7be420[_0x0a9e('0x63')]['start'],_0x7be420[_0x0a9e('0x63')][_0x0a9e('0x1c')]);}}}else{var _0x51aaf7=_(_0x39e565['query'])[_0x0a9e('0x37')]()[_0x0a9e('0x2a')](function(_0x119677){return _[_0x0a9e('0x70')](_0x14b13f,['name',_0x119677])?_0x119677:undefined;})[_0x0a9e('0x71')]()[_0x0a9e('0x63')]();if(!_['isEmpty'](_0x51aaf7)){_0x51aaf7[_0x0a9e('0x2f')](function(_0x17e88c){if(_0x17e88c===_0x0a9e('0x72')){_0x117c99[_0x0a9e('0x42')](_0x0a9e('0x73'),[]['concat'](_0x39e565[_0x0a9e('0x38')][_0x17e88c]));}else if(_0x17e88c===_0x0a9e('0x74')){var _0x281c7d=JSON['parse'](_0x39e565[_0x0a9e('0x38')][_0x17e88c])['$gte'];var _0x5211e3=JSON[_0x0a9e('0x75')](_0x39e565[_0x0a9e('0x38')][_0x17e88c])[_0x0a9e('0x76')];_0x117c99[_0x0a9e('0x42')](_0x0a9e('0x77'),_0x281c7d,_0x5211e3);}else{if(_0x39e565[_0x0a9e('0x38')][_0x17e88c]===_0x0a9e('0x78')){_0x117c99[_0x0a9e('0x42')]('i.'+_0x17e88c+_0x0a9e('0x79'));}else{_0x117c99[_0x0a9e('0x42')]('i.'+_0x17e88c+_0x0a9e('0x7a'),_0x39e565[_0x0a9e('0x38')][_0x17e88c]);}}});}if(_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x7b')]){if(_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x7b')]==0x1){_0x117c99[_0x0a9e('0x60')](_0x0a9e('0x7c'));}else{_0x117c99['having'](_0x0a9e('0x7d'));}}if(_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x7e')]){_0x1bde3c=_['isArray'](_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x7e')])?_0x39e565['query'][_0x0a9e('0x7e')]:new Array(_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x7e')]);_0x1bde3c[_0x0a9e('0x2f')](function(_0x13b5c0){_0x1b5e80['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x13b5c0+',%');});}if(_0x39e565['query']['filter']){var _0x40fb85=_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x7f')][_0x0a9e('0x80')]('\x5c','\x5c\x5c')[_0x0a9e('0x80')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x81')](_0x40fb85)){_0x5bbcde['or'](_0x0a9e('0x82'),_0x40fb85+'%')['or'](_0x0a9e('0x83'),_0x40fb85+'%');}else{_0x5bbcde['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x64')](_0x40fb85))['or'](_0x0a9e('0x84'),_0x40fb85+'%');}}}_0x117c99[_0x0a9e('0x42')](_0x5bbcde);_0x117c99['group'](_0x0a9e('0x85'));var _0x583b2e={'type':db[_0x0a9e('0x86')][_0x0a9e('0x87')]['SELECT'],'raw':!![]};var _0x2ed01e=_0x117c99[_0x0a9e('0x88')]();_0x2ed01e[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x2ed01e['field'](_0x0a9e('0x89'),_0x0a9e('0x8a'));if(_0x44295a[_0x0a9e('0x40')]){_0x44295a[_0x0a9e('0x40')]['forEach'](function(_0x109ccb){var _0x3d91db=_0x109ccb[0x0]===_0x0a9e('0x8b')?_0x109ccb[0x0]:'i.'+_0x109ccb[0x0];_0x117c99[_0x0a9e('0x40')](_0x3d91db,_0x109ccb[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0a9e('0x8c')](_0x1bde3c)){_0x117c99[_0x0a9e('0x60')](_0x1b5e80);_0x2ed01e[_0x0a9e('0x42')](_0x0a9e('0x8d'),_0x1bde3c);}BPromise[_0x0a9e('0x8e')]()[_0x0a9e('0x25')](function(){if(!_0x409789){if(_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x72')])return;_0x2ed01e[_0x0a9e('0x42')](_0x0a9e('0x8f'));_0x117c99[_0x0a9e('0x42')](_0x0a9e('0x8f'));return;}if(_0x39e565[_0x0a9e('0x90')][_0x0a9e('0x91')]!=='agent')return;return _0x39e565[_0x0a9e('0x90')][_0x0a9e('0x92')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x25')](function(_0x563627){if(_[_0x0a9e('0x8c')](_0x563627)){_0x2ed01e[_0x0a9e('0x42')](_0x0a9e('0x93'));_0x117c99[_0x0a9e('0x42')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x2ed01e['where'](_0x0a9e('0x73'),_[_0x0a9e('0x2a')](_0x563627,'id'));_0x117c99['where'](_0x0a9e('0x73'),_['map'](_0x563627,'id'));}});})[_0x0a9e('0x25')](function(){if(_0x39e565[_0x0a9e('0x90')]['role']===_0x0a9e('0x94')&&!_0x409789&&!_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x72')])return[];return db[_0x0a9e('0x95')][_0x0a9e('0x38')](_0x2ed01e[_0x0a9e('0x96')](),_0x583b2e);})[_0x0a9e('0x25')](function(_0x482ca2){_0x2cc7a0[_0x0a9e('0x1e')]=_0x482ca2[_0x0a9e('0x3d')];if(_0x2cc7a0[_0x0a9e('0x1e')]===0x0)return[];return db[_0x0a9e('0x95')]['query'](_0x23b089[_0x0a9e('0x96')](),_0x583b2e)[_0x0a9e('0x25')](function(_0x4bf3a5){_0x45a9b8=_[_0x0a9e('0x97')](_0x4bf3a5,'id');_0x583b2e=_['merge'](_0x583b2e,{'model':db[_0x0a9e('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x3c')]){_0x44295a[_0x0a9e('0x3b')]['forEach'](function(_0x51ccd7){_0x117c99[_0x0a9e('0x45')]('i.'+_0x51ccd7);});}else{_0x117c99[_0x0a9e('0x45')](_0x0a9e('0x89'),'unreadMessages');_0x117c99[_0x0a9e('0x45')](_0x0a9e('0x98'),'Account.key');_0x117c99['field'](_0x0a9e('0x99'),'Account.mandatoryDisposition');_0x117c99['field']('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',_0x0a9e('0x8b'));_0x117c99[_0x0a9e('0x45')](_0x0a9e('0x9a'));_0x117c99[_0x0a9e('0x45')](_0x0a9e('0x9b'),_0x0a9e('0x9c'));_0x117c99['field'](_0x0a9e('0x9d'),'Contact.lastName');_0x117c99[_0x0a9e('0x45')](_0x0a9e('0x9e'),_0x0a9e('0x9f'));_0x117c99[_0x0a9e('0x45')]('c.phone',_0x0a9e('0xa0'));_0x117c99[_0x0a9e('0x45')](_0x0a9e('0xa1'),'Contact.mobile');_0x117c99[_0x0a9e('0x45')](_0x0a9e('0xa2'),_0x0a9e('0xa3'));_0x117c99[_0x0a9e('0x45')](_0x0a9e('0xa4'),_0x0a9e('0xa5'));_0x117c99[_0x0a9e('0x45')](_0x0a9e('0xa6'),'Owner.internal');_0x117c99[_0x0a9e('0x45')](_0x0a9e('0xa7'),'TagIds');}if(_0x44295a[_0x0a9e('0x20')])_0x117c99[_0x0a9e('0x20')](_0x44295a[_0x0a9e('0x20')]);if(_0x44295a['offset'])_0x117c99[_0x0a9e('0x1f')](_0x44295a['offset']);return db[_0x0a9e('0x95')][_0x0a9e('0x38')](_0x117c99[_0x0a9e('0x96')](),_0x583b2e);})[_0x0a9e('0x25')](function(_0x842d6f){_0x473fdc[_0x0a9e('0x42')](_0x0a9e('0xa8'),_[_0x0a9e('0x2a')](_0x842d6f,'id'));return db['sequelize'][_0x0a9e('0x38')](_0x473fdc[_0x0a9e('0x96')](),_0x583b2e)[_0x0a9e('0x25')](function(_0x30ef6e){var _0x28e60a=_[_0x0a9e('0xa9')](_0x30ef6e,_0x0a9e('0xaa'));var _0x33f0c9=[];_0x842d6f[_0x0a9e('0x2f')](function(_0x31af8c){_0x33f0c9[_0x0a9e('0x30')](updateSmsInteraction(_0x31af8c,_0x45a9b8,_0x28e60a));});return BPromise[_0x0a9e('0xab')](_0x33f0c9);});});})[_0x0a9e('0x25')](function(_0x4989f9){_0x2cc7a0[_0x0a9e('0xac')]=_0x4989f9;return _0x2cc7a0;})[_0x0a9e('0x25')](respondWithFilteredResult(_0x5583a4,_0x44295a))[_0x0a9e('0x31')](handleError(_0x5583a4,null));};exports[_0x0a9e('0xad')]=function(_0xb0599a,_0x5d9ddb){var _0x3afc8c={'raw':![],'where':{'id':_0xb0599a['params']['id']}},_0x1756c7={};_0x1756c7[_0x0a9e('0xae')]=_['keys'](db[_0x0a9e('0x33')][_0x0a9e('0xaf')]);_0x1756c7[_0x0a9e('0x38')]=_[_0x0a9e('0x37')](_0xb0599a['query']);_0x1756c7[_0x0a9e('0x39')]=_['intersection'](_0x1756c7[_0x0a9e('0xae')],_0x1756c7[_0x0a9e('0x38')]);_0x3afc8c['attributes']=_[_0x0a9e('0x3a')](_0x1756c7[_0x0a9e('0xae')],qs[_0x0a9e('0x3c')](_0xb0599a['query']['fields']));_0x3afc8c[_0x0a9e('0x3b')]=_0x3afc8c[_0x0a9e('0x3b')][_0x0a9e('0x3d')]?_0x3afc8c[_0x0a9e('0x3b')]:_0x1756c7[_0x0a9e('0xae')];if(_0xb0599a[_0x0a9e('0x38')][_0x0a9e('0xb0')]){_0x3afc8c[_0x0a9e('0xb1')]=[{'all':!![]}];}_0x3afc8c=_[_0x0a9e('0xb2')]({},_0x3afc8c,_0xb0599a['options']);return db[_0x0a9e('0x33')]['find'](_0x3afc8c)[_0x0a9e('0x25')](handleEntityNotFound(_0x5d9ddb,null))[_0x0a9e('0x25')](respondWithResult(_0x5d9ddb,null))[_0x0a9e('0x31')](handleError(_0x5d9ddb,null));};exports[_0x0a9e('0xb3')]=function(_0x1b61d5,_0x4e7273){return db[_0x0a9e('0x33')][_0x0a9e('0xb3')](_0x1b61d5[_0x0a9e('0xb4')],{})[_0x0a9e('0x25')](respondWithResult(_0x4e7273,0xc9))[_0x0a9e('0x31')](handleError(_0x4e7273,null));};exports['update']=function(_0x4f074c,_0x22a3cb){if(_0x4f074c['body']['id']){delete _0x4f074c[_0x0a9e('0xb4')]['id'];}return db[_0x0a9e('0x33')][_0x0a9e('0x5e')]({'where':{'id':_0x4f074c[_0x0a9e('0xb5')]['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0x22a3cb,null))[_0x0a9e('0x25')](saveUpdates(_0x4f074c['body'],null))['then'](respondWithResult(_0x22a3cb,null))[_0x0a9e('0x31')](handleError(_0x22a3cb,null));};exports['destroy']=function(_0x2469d1,_0x5c689c){return db[_0x0a9e('0x33')]['find']({'where':{'id':_0x2469d1['params']['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0x5c689c,null))[_0x0a9e('0x25')](removeEntity(_0x5c689c,null))['catch'](handleError(_0x5c689c,null));};exports[_0x0a9e('0xb6')]=function(_0x17cb30,_0x15c6b9){return db[_0x0a9e('0x33')][_0x0a9e('0xb6')]()['then'](respondWithResult(_0x15c6b9,null))['catch'](handleError(_0x15c6b9,null));};exports[_0x0a9e('0xb7')]=function(_0x22286c,_0x41c8cd,_0x24beb6){return db[_0x0a9e('0xb8')]['find']({'where':{'id':_0x22286c[_0x0a9e('0xb5')]['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0x41c8cd,null))['then'](function(_0x3c313d){if(_0x3c313d){return _0x3c313d[_0x0a9e('0xb7')](_0x22286c[_0x0a9e('0xb4')][_0x0a9e('0xb9')],_[_0x0a9e('0xba')](_0x22286c[_0x0a9e('0xb4')],[_0x0a9e('0xb9'),'id'])||{});}})[_0x0a9e('0x25')](respondWithResult(_0x41c8cd,null))[_0x0a9e('0x31')](handleError(_0x41c8cd,null));};exports[_0x0a9e('0xbb')]=function(_0x4bdebb,_0x1065a7,_0x301047){var _0x2ada60={'raw':![],'where':{}};var _0x1c4232={};var _0x1d0b02={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x4bdebb[_0x0a9e('0xb5')]['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0x1065a7,null))[_0x0a9e('0x25')](function(_0x2fea95){if(_0x2fea95){_0x1c4232[_0x0a9e('0xae')]=_['keys'](db[_0x0a9e('0xb8')][_0x0a9e('0xaf')]);_0x1c4232[_0x0a9e('0x38')]=_['keys'](_0x4bdebb[_0x0a9e('0x38')]);_0x1c4232['filters']=_[_0x0a9e('0x3a')](_0x1c4232['model'],_0x1c4232[_0x0a9e('0x38')]);_0x2ada60[_0x0a9e('0x3b')]=_[_0x0a9e('0x3a')](_0x1c4232['model'],qs[_0x0a9e('0x3c')](_0x4bdebb['query'][_0x0a9e('0x3c')]));_0x2ada60[_0x0a9e('0x3b')]=_0x2ada60[_0x0a9e('0x3b')][_0x0a9e('0x3d')]?_0x2ada60[_0x0a9e('0x3b')]:_0x1c4232[_0x0a9e('0xae')];if(!_0x4bdebb[_0x0a9e('0x38')][_0x0a9e('0x3e')](_0x0a9e('0x3f'))){_0x2ada60[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x4bdebb[_0x0a9e('0x38')][_0x0a9e('0x20')]);_0x2ada60[_0x0a9e('0x1f')]=qs[_0x0a9e('0x1f')](_0x4bdebb[_0x0a9e('0x38')]['offset']);}_0x2ada60['order']=qs[_0x0a9e('0x41')](_0x4bdebb['query'][_0x0a9e('0x41')]);_0x2ada60[_0x0a9e('0x42')]=qs['filters'](_[_0x0a9e('0x43')](_0x4bdebb[_0x0a9e('0x38')],_0x1c4232[_0x0a9e('0x39')]));_0x2ada60[_0x0a9e('0x42')]['SmsInteractionId']=_0x2fea95['id'];if(_0x4bdebb[_0x0a9e('0x38')][_0x0a9e('0x7f')]){_0x2ada60[_0x0a9e('0x42')]=_[_0x0a9e('0xb2')](_0x2ada60['where'],{'$or':_[_0x0a9e('0x2a')](_0x2ada60[_0x0a9e('0x3b')],function(_0x2b7092){var _0x5c838b={};_0x5c838b[_0x2b7092]={'$like':'%'+_0x4bdebb[_0x0a9e('0x38')][_0x0a9e('0x7f')]+'%'};return _0x5c838b;})});}if(_0x4bdebb[_0x0a9e('0x38')]['$gte']){var _0x303f75=_0x4bdebb[_0x0a9e('0x38')][_0x0a9e('0xbc')][_0x0a9e('0x2e')](',');var _0x2394d3={};_0x2394d3[_0x303f75[0x0]]={'$gte':moment(_0x303f75[0x1])['format'](_0x0a9e('0xbd'))};_0x2ada60[_0x0a9e('0x42')]=_['merge'](_0x2ada60[_0x0a9e('0x42')],_0x2394d3);}_0x2ada60=_[_0x0a9e('0xb2')]({},_0x2ada60,_0x4bdebb[_0x0a9e('0xbe')]);return db['SmsMessage']['count']({'where':_0x2ada60['where']})[_0x0a9e('0x25')](function(_0x4a70ce){_0x1d0b02['count']=_0x4a70ce;if(_0x4bdebb[_0x0a9e('0x38')][_0x0a9e('0xb0')]){_0x2ada60[_0x0a9e('0xb1')]=[{'all':!![]}];}return db['SmsMessage'][_0x0a9e('0xbf')](_0x2ada60);})[_0x0a9e('0x25')](function(_0x213d4e){_0x1d0b02[_0x0a9e('0xac')]=_0x213d4e;return _0x1d0b02;});}})[_0x0a9e('0x25')](respondWithFilteredResult(_0x1065a7,_0x2ada60))[_0x0a9e('0x31')](handleError(_0x1065a7,null));};exports[_0x0a9e('0xc0')]=function(_0x328ec5,_0x3b5bda,_0x5a1848){return db[_0x0a9e('0x33')]['find']({'where':{'id':_0x328ec5[_0x0a9e('0xb5')]['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0x3b5bda,null))[_0x0a9e('0x25')](function(_0x3cf222){if(_0x3cf222){return _0x3cf222[_0x0a9e('0xc1')](_0x328ec5[_0x0a9e('0xb4')]['ids'],_[_0x0a9e('0xba')](_0x328ec5[_0x0a9e('0xb4')],[_0x0a9e('0xb9'),'id'])||{})[_0x0a9e('0xc2')](function(){return db['Tag'][_0x0a9e('0xbf')]({'attributes':['id',_0x0a9e('0x28'),_0x0a9e('0x46')],'where':{'id':_0x328ec5[_0x0a9e('0xb4')][_0x0a9e('0xb9')]}});})[_0x0a9e('0x25')](function(_0x238c24){socket[_0x0a9e('0xc3')](_0x0a9e('0xc4'),{'id':Number(_0x328ec5[_0x0a9e('0xb5')]['id']),'tags':_0x238c24||[]});return{'id':Number(_0x328ec5['params']['id']),'tags':_0x238c24||[]};});}})[_0x0a9e('0x25')](respondWithResult(_0x3b5bda,null))[_0x0a9e('0x31')](handleError(_0x3b5bda,null));};exports[_0x0a9e('0xc5')]=function(_0x26b826,_0xea8bd1,_0x253f74){return db[_0x0a9e('0x33')][_0x0a9e('0x5e')]({'where':{'id':_0x26b826['params']['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0xea8bd1,null))[_0x0a9e('0x25')](function(_0x1a9ef1){if(_0x1a9ef1){return _0x1a9ef1['removeTags'](_0x26b826[_0x0a9e('0x38')][_0x0a9e('0xb9')]);}})[_0x0a9e('0x25')](respondWithStatusCode(_0xea8bd1,null))[_0x0a9e('0x31')](handleError(_0xea8bd1,null));};exports[_0x0a9e('0xc6')]=function(_0x1ba457,_0x424f1b){var _0x336a19=moment()[_0x0a9e('0xc7')]()[_0x0a9e('0x96')]();var _0x5a7dad=path[_0x0a9e('0xc8')](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xcb'),_0x0a9e('0xcc'));var _0x3942fd=path['join'](config[_0x0a9e('0xc9')],'server','files','attachments');var _0x19e4e6=path[_0x0a9e('0xc8')](_0x5a7dad,_0x336a19);var _0x426cb4=util[_0x0a9e('0xcd')]('transcript-%d-%s.zip',_0x1ba457[_0x0a9e('0xb5')]['id'],_0x336a19);var _0x309fa9=path[_0x0a9e('0xc8')](_0x5a7dad,_0x426cb4);var _0x1fdb10=[];_0x1fdb10[_0x0a9e('0x30')]({'model':db['User'],'as':'User','attributes':['id',_0x0a9e('0x2b')],'raw':!![]});_0x1fdb10[_0x0a9e('0x30')]({'model':db[_0x0a9e('0xce')],'as':'Contact','attributes':['id',_0x0a9e('0xcf'),_0x0a9e('0xd0')],'raw':!![]});var _0x422f0a=[{'model':db['SmsMessage'],'as':_0x0a9e('0xd1'),'attributes':['id',_0x0a9e('0xb4'),_0x0a9e('0x74'),'direction',_0x0a9e('0xd2'),_0x0a9e('0x7b')],'include':_0x1fdb10}];_0x422f0a[_0x0a9e('0x30')]({'model':db['SmsAccount'],'as':'Account','attributes':['id','name']});_0x422f0a[_0x0a9e('0x30')]({'model':db[_0x0a9e('0x69')],'as':_0x0a9e('0xd3'),'attributes':['id',_0x0a9e('0x2b')]});return db['SmsInteraction'][_0x0a9e('0x5e')]({'where':{'id':_0x1ba457['params']['id']},'include':_0x422f0a})[_0x0a9e('0x25')](handleEntityNotFound(_0x424f1b,null))[_0x0a9e('0x25')](function(_0x242f23){if(_0x242f23){var _0x57f673=_0x242f23[_0x0a9e('0xd4')]({'plain':!![]});fs[_0x0a9e('0xd5')](_0x19e4e6);var _0xb8a476={'format':'A4','border':'10px','header':{'height':_0x0a9e('0xd6'),'contents':{'first':'\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20'}},'footer':{'height':_0x0a9e('0xd7'),'contents':{'default':util['format'](_0x0a9e('0xd8'),util['format'](_0x0a9e('0xd9'),_0x0a9e('0xda'),_0x57f673['id']),moment()[_0x0a9e('0xcd')](_0x0a9e('0xdb'))[_0x0a9e('0x96')]())}}};var _0x251dd9={'channel':_0x0a9e('0xda'),'account':_0x57f673['Account'][_0x0a9e('0x28')],'agent':_0x57f673[_0x0a9e('0xd3')]?_0x57f673['Owner'][_0x0a9e('0x2b')]:_0x0a9e('0xdc'),'createdAt':moment(_0x57f673['createdAt'])[_0x0a9e('0xcd')](_0x0a9e('0xbd'))[_0x0a9e('0x96')](),'closedAt':_0x57f673['closed']?moment(_0x57f673[_0x0a9e('0xdd')])[_0x0a9e('0xcd')](_0x0a9e('0xbd'))[_0x0a9e('0x96')]():'','disposition':_0x57f673[_0x0a9e('0xde')],'messages':_(_0x57f673[_0x0a9e('0xd1')])[_0x0a9e('0x7f')]({'secret':![]})[_0x0a9e('0x2a')](function(_0x22767f){return{'date':moment(_0x22767f[_0x0a9e('0x74')])['format'](_0x0a9e('0xbd'))['toString'](),'sender':_0x22767f[_0x0a9e('0xdf')]===_0x0a9e('0xe0')?_0x22767f[_0x0a9e('0x69')]?_0x22767f[_0x0a9e('0x69')][_0x0a9e('0x2b')]:_0x0a9e('0xe1'):_0x22767f['Contact'][_0x0a9e('0xcf')]+(_0x22767f[_0x0a9e('0x62')][_0x0a9e('0xd0')]?'\x20'+_0x22767f['Contact'][_0x0a9e('0xd0')]:''),'body':_0x22767f[_0x0a9e('0xb4')],'direction':_0x22767f[_0x0a9e('0xdf')]===_0x0a9e('0xe0')?'A':'C','secret':_0x22767f[_0x0a9e('0xd2')],'read':_0x22767f[_0x0a9e('0x7b')]};})[_0x0a9e('0x63')]()};return ejs['renderFile'](path[_0x0a9e('0xc8')](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xe2'),_0x0a9e('0xe3')),{'interaction':_0x251dd9})[_0x0a9e('0x25')](function(_0x8120e){return new BPromise(function(_0x5d6a48,_0x5c8720){pdf[_0x0a9e('0xb3')](_0x8120e,_0xb8a476)[_0x0a9e('0xe4')](path[_0x0a9e('0xc8')](_0x19e4e6,_0x0a9e('0xe5')+_0x57f673['id']+'-'+_0x336a19+_0x0a9e('0xe6')),function(_0x131da8,_0x609711){if(_0x131da8)return _0x5c8720(_0x131da8);_0x5d6a48(_0x609711);});});})['then'](function(){return new BPromise(function(_0x39ea62,_0x1d7fc4){zipdir(_0x19e4e6,{'saveTo':_0x309fa9},function(_0x2d8e91,_0x2675a5){if(_0x2d8e91)return _0x1d7fc4(_0x2d8e91);return _0x39ea62(_0x2675a5);});})[_0x0a9e('0x25')](function(){return new BPromise(function(_0x3c6082,_0x16be7e){rimraf(_0x19e4e6,function(_0x54f0b8){if(_0x54f0b8)_0x16be7e(_0x54f0b8);return _0x3c6082();});});})[_0x0a9e('0x25')](function(){return _0x424f1b[_0x0a9e('0xc6')](_0x309fa9,_0x426cb4,function(_0x231826){if(_0x231826){console['log'](_0x0a9e('0xe7'),_0x231826);}else{fs[_0x0a9e('0xe8')](_0x309fa9);}});});});}else{return _0x424f1b[_0x0a9e('0x1b')](0xc8);}})[_0x0a9e('0x31')](handleError(_0x424f1b,null));}; \ No newline at end of file +var _0xa9e0=['rawAttributes','includeAll','include','merge','create','body','params','describe','addMessage','SmsMessage','ids','omit','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','format','CmContact','firstName','lastName','Messages','secret','Owner','get','mkdirSync','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','YYYY-MM-DD','N.A.','closedAt','disposition','direction','out','System','views','downloadInteraction.html','toFile','transcript-','.pdf','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','sendStatus','end','json','count','offset','limit','status','set','apply','save','then','destroy','error','name','send','map','fullname','TagIds','Tags','split','forEach','push','catch','index','SmsInteraction','fieldName','type','key','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','u.id','u.fullname','ui.SmsInteractionId','from','user_has_sms_interactions','left_join','users','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','`\x20=\x200','having','`\x20>\x200','Contact','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','text','start','some','compact','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','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?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','isEmpty','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','a.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','show','model'];(function(_0x622035,_0x1a4b91){var _0x326cf2=function(_0x5c3002){while(--_0x5c3002){_0x622035['push'](_0x622035['shift']());}};_0x326cf2(++_0x1a4b91);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var fs_extra=require(_0x0a9e('0xa'));var _=require(_0x0a9e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0a9e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0a9e('0xd'));var Papa=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var licenseUtil=require(_0x0a9e('0x14'));var db=require(_0x0a9e('0x15'))['db'];config[_0x0a9e('0x16')]=_[_0x0a9e('0x17')](config[_0x0a9e('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0x18'))(new Redis(config[_0x0a9e('0x16')]));require(_0x0a9e('0x19'))[_0x0a9e('0x1a')](socket);function respondWithStatusCode(_0x44dcfd,_0x4d5611){_0x4d5611=_0x4d5611||0xcc;return function(_0x52a03d){if(_0x52a03d){return _0x44dcfd[_0x0a9e('0x1b')](_0x4d5611);}return _0x44dcfd['status'](_0x4d5611)[_0x0a9e('0x1c')]();};}function respondWithResult(_0x519dfd,_0x16033c){_0x16033c=_0x16033c||0xc8;return function(_0x12066b){if(_0x12066b){return _0x519dfd['status'](_0x16033c)[_0x0a9e('0x1d')](_0x12066b);}};}function respondWithFilteredResult(_0x5a0a06,_0x459eb1){return function(_0x478723){if(_0x478723){var _0x106033=_0x478723[_0x0a9e('0x1e')],_0x205fd6=_0x459eb1[_0x0a9e('0x1f')],_0x31b1ca=_0x459eb1[_0x0a9e('0x1f')]+_0x459eb1[_0x0a9e('0x20')],_0x2eb11f;if(_0x31b1ca>=_0x106033){_0x31b1ca=_0x106033;_0x2eb11f=0xc8;}else{_0x2eb11f=0xce;}_0x5a0a06[_0x0a9e('0x21')](_0x2eb11f);return _0x5a0a06[_0x0a9e('0x22')]('Content-Range',_0x205fd6+'-'+_0x31b1ca+'/'+_0x106033)[_0x0a9e('0x1d')](_0x478723);}return null;};}function patchUpdates(_0x155cce){return function(_0x53682f){try{jsonpatch[_0x0a9e('0x23')](_0x53682f,_0x155cce,!![]);}catch(_0x5a09ef){return BPromise['reject'](_0x5a09ef);}return _0x53682f[_0x0a9e('0x24')]();};}function saveUpdates(_0x432e56,_0x38e7c4){return function(_0x30bae6){if(_0x30bae6){return _0x30bae6['update'](_0x432e56)[_0x0a9e('0x25')](function(_0x2fb0e4){return _0x2fb0e4;});}return null;};}function removeEntity(_0x3b45bc,_0x4d00e6){return function(_0x370d86){if(_0x370d86){return _0x370d86[_0x0a9e('0x26')]()[_0x0a9e('0x25')](function(){_0x3b45bc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x197ec0,_0x3a8e58){return function(_0x40c424){if(!_0x40c424){_0x197ec0[_0x0a9e('0x1b')](0x194);}return _0x40c424;};}function handleError(_0x526cf3,_0x384319){_0x384319=_0x384319||0x1f4;return function(_0x479bc4){logger[_0x0a9e('0x27')](_0x479bc4['stack']);if(_0x479bc4[_0x0a9e('0x28')]){delete _0x479bc4[_0x0a9e('0x28')];}_0x526cf3[_0x0a9e('0x21')](_0x384319)[_0x0a9e('0x29')](_0x479bc4);};}function getInteractionUsers(_0x140511,_0x1538a4){return new BPromise(function(_0x11c3b6,_0x14de77){try{if(_0x1538a4[_0x140511['id']]){_0x140511['Users']=_[_0x0a9e('0x2a')](_0x1538a4[_0x140511['id']],function(_0x468813){return{'id':_0x468813['id'],'fullname':_0x468813[_0x0a9e('0x2b')]};});}}catch(_0x2ec755){_0x14de77(_0x2ec755);}_0x11c3b6(_0x140511);});}function getInteractionTags(_0x5c877d,_0x15b200){return new BPromise(function(_0x40e7a3,_0x1843b2){try{if(_0x5c877d[_0x0a9e('0x2c')]){_0x5c877d[_0x0a9e('0x2d')]=[];_0x5c877d[_0x0a9e('0x2c')][_0x0a9e('0x2e')](',')[_0x0a9e('0x2f')](function(_0x1dbde2){_0x5c877d['Tags'][_0x0a9e('0x30')](_0x15b200[_0x1dbde2]);});}delete _0x5c877d['TagIds'];}catch(_0x2407f9){_0x1843b2(_0x2407f9);}_0x40e7a3(_0x5c877d);});}function updateSmsInteraction(_0x3ae878,_0x1122db,_0x33bdb7){return new BPromise(function(_0x25ce3a,_0x5180f1){return getInteractionUsers(_0x3ae878,_0x33bdb7)[_0x0a9e('0x25')](function(_0x46f0a5){return getInteractionTags(_0x46f0a5,_0x1122db);})[_0x0a9e('0x25')](function(_0x2da5c0){_0x25ce3a(_0x2da5c0);})[_0x0a9e('0x31')](function(_0x409319){_0x5180f1(_0x409319);});});}exports[_0x0a9e('0x32')]=function(_0x39e565,_0x5583a4){var _0x44295a={},_0x5e7238={},_0x2cc7a0={'count':0x0,'rows':[]};var _0x14b13f=_[_0x0a9e('0x2a')](db[_0x0a9e('0x33')]['rawAttributes'],function(_0x191e91){return{'name':_0x191e91[_0x0a9e('0x34')],'type':_0x191e91[_0x0a9e('0x35')][_0x0a9e('0x36')]};});_0x5e7238['model']=_['map'](_0x14b13f,_0x0a9e('0x28'));_0x5e7238['query']=_[_0x0a9e('0x37')](_0x39e565[_0x0a9e('0x38')]);_0x5e7238[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5e7238['model'],_0x5e7238[_0x0a9e('0x38')]);_0x44295a[_0x0a9e('0x3b')]=_[_0x0a9e('0x3a')](_0x5e7238['model'],qs[_0x0a9e('0x3c')](_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x3c')]));_0x44295a['attributes']=_0x44295a['attributes'][_0x0a9e('0x3d')]?_0x44295a[_0x0a9e('0x3b')]:_0x5e7238['model'];if(!_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x3e')](_0x0a9e('0x3f'))){_0x44295a[_0x0a9e('0x20')]=qs['limit'](_0x39e565['query'][_0x0a9e('0x20')]);_0x44295a[_0x0a9e('0x1f')]=qs['offset'](_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x1f')]);}_0x44295a[_0x0a9e('0x40')]=qs['sort'](_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x41')]);_0x44295a[_0x0a9e('0x42')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x43')](_0x39e565[_0x0a9e('0x38')],_0x5e7238[_0x0a9e('0x39')]),_0x14b13f);var _0x45a9b8=[];var _0x23b089=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('id')[_0x0a9e('0x45')](_0x0a9e('0x28'))[_0x0a9e('0x45')](_0x0a9e('0x46'))['from']('tools_tags');var _0x473fdc=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')](_0x0a9e('0x47'))[_0x0a9e('0x45')](_0x0a9e('0x48'))[_0x0a9e('0x45')](_0x0a9e('0x49'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'ui')[_0x0a9e('0x4c')](_0x0a9e('0x4d'),'u','u.id\x20=\x20ui.UserId');var _0x117c99=squel[_0x0a9e('0x44')]()[_0x0a9e('0x4a')](_0x0a9e('0x4e'),'i')[_0x0a9e('0x4c')](_0x0a9e('0x4f'),'c',_0x0a9e('0x50'))[_0x0a9e('0x4c')]('users','o',_0x0a9e('0x51'))['left_join'](_0x0a9e('0x52'),'a',_0x0a9e('0x53'))[_0x0a9e('0x4c')]('sms_messages','me',_0x0a9e('0x54'))[_0x0a9e('0x4c')](_0x0a9e('0x55'),'it',_0x0a9e('0x56'))[_0x0a9e('0x4c')](_0x0a9e('0x57'),'t',_0x0a9e('0x58'));var _0x5bbcde=squel[_0x0a9e('0x59')]();var _0x1bde3c=[];var _0x1b5e80=squel[_0x0a9e('0x59')]();var _0x409789;if(_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x5a')]){_0x409789=as[_0x0a9e('0x5b')](_0x39e565[_0x0a9e('0x38')]['search']);var _0xe401a=_0x409789[_0x0a9e('0x5c')];for(var _0x4f7240=0x0;_0x4f7240<_0x409789['conditions']['length'];_0x4f7240++){var _0x1adfee=_0x409789[_0x0a9e('0x5d')][_0x4f7240];var _0x37edaa='i';var _0x11545a=_[_0x0a9e('0x5e')](_0x14b13f,[_0x0a9e('0x28'),_0x1adfee[_0x0a9e('0x45')]]);if(!_0x11545a){switch(_0x1adfee[_0x0a9e('0x45')]){case'unreadMessages':if(_0x1adfee['value']==0x1){_0x117c99['having']('`'+_0x1adfee[_0x0a9e('0x45')]+_0x0a9e('0x5f'));}else{_0x117c99[_0x0a9e('0x60')]('`'+_0x1adfee['field']+_0x0a9e('0x61'));}break;case _0x0a9e('0x62'):if(_0x1adfee['operator']==='$substring'){if(_0x1adfee[_0x0a9e('0x63')]['split']('\x20')[_0x0a9e('0x3d')]>0x1){_0x5bbcde[_0xe401a]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x64')](_0x1adfee[_0x0a9e('0x63')]),null);}else{var _0x439340='%'+_0x1adfee['value']+'%';_0x5bbcde[_0xe401a](_0x0a9e('0x65'),_0x439340,_0x439340,_0x439340);}}else{_0x11545a=_[_0x0a9e('0x5e')](_0x14b13f,['name','ContactId']);_0x1adfee[_0x0a9e('0x45')]=_0x0a9e('0x66');_0x7be420=as['buildExpression'](_0x37edaa,_0x11545a[_0x0a9e('0x35')],_0x1adfee);_0x5bbcde[_0xe401a](_0x7be420['text'],_0x7be420[_0x0a9e('0x63')]['start'],_0x7be420[_0x0a9e('0x63')]['end']);}break;case'Tag':var _0x5df0ad=_0x1adfee[_0x0a9e('0x63')]['split'](',')[_0x0a9e('0x2a')](function(_0x65432){return Number(_0x65432);});_0x5df0ad[_0x0a9e('0x2f')](function(_0x19b4df){_0x1b5e80['or'](_0x0a9e('0x67'),'%,'+_0x19b4df+',%');});_0x1bde3c=_[_0x0a9e('0x68')](_0x1bde3c,_0x5df0ad);break;case _0x0a9e('0x69'):if(_0x1adfee[_0x0a9e('0x6a')]==='$substring'){_0x5bbcde[_0xe401a](_0x0a9e('0x6b'),'%'+_0x1adfee[_0x0a9e('0x63')]+'%',null);}else{_0x11545a=_[_0x0a9e('0x5e')](_0x14b13f,[_0x0a9e('0x28'),_0x0a9e('0x6c')]);_0x1adfee[_0x0a9e('0x45')]='UserId';_0x7be420=as[_0x0a9e('0x6d')](_0x37edaa,_0x11545a[_0x0a9e('0x35')],_0x1adfee);_0x5bbcde[_0xe401a](_0x7be420['text'],_0x7be420[_0x0a9e('0x63')]['start'],_0x7be420[_0x0a9e('0x63')]['end']);}break;case'body':_0x7be420=as['buildExpression']('me',null,_0x1adfee);_0x5bbcde[_0xe401a](_0x7be420[_0x0a9e('0x6e')],_0x7be420['value'][_0x0a9e('0x6f')],_0x7be420[_0x0a9e('0x63')][_0x0a9e('0x1c')]);break;}}else{var _0x7be420=as[_0x0a9e('0x6d')](_0x37edaa,_0x11545a[_0x0a9e('0x35')],_0x1adfee);_0x5bbcde[_0xe401a](_0x7be420['text'],_0x7be420[_0x0a9e('0x63')]['start'],_0x7be420[_0x0a9e('0x63')][_0x0a9e('0x1c')]);}}}else{var _0x51aaf7=_(_0x39e565['query'])[_0x0a9e('0x37')]()[_0x0a9e('0x2a')](function(_0x119677){return _[_0x0a9e('0x70')](_0x14b13f,['name',_0x119677])?_0x119677:undefined;})[_0x0a9e('0x71')]()[_0x0a9e('0x63')]();if(!_['isEmpty'](_0x51aaf7)){_0x51aaf7[_0x0a9e('0x2f')](function(_0x17e88c){if(_0x17e88c===_0x0a9e('0x72')){_0x117c99[_0x0a9e('0x42')](_0x0a9e('0x73'),[]['concat'](_0x39e565[_0x0a9e('0x38')][_0x17e88c]));}else if(_0x17e88c===_0x0a9e('0x74')){var _0x281c7d=JSON['parse'](_0x39e565[_0x0a9e('0x38')][_0x17e88c])['$gte'];var _0x5211e3=JSON[_0x0a9e('0x75')](_0x39e565[_0x0a9e('0x38')][_0x17e88c])[_0x0a9e('0x76')];_0x117c99[_0x0a9e('0x42')](_0x0a9e('0x77'),_0x281c7d,_0x5211e3);}else{if(_0x39e565[_0x0a9e('0x38')][_0x17e88c]===_0x0a9e('0x78')){_0x117c99[_0x0a9e('0x42')]('i.'+_0x17e88c+_0x0a9e('0x79'));}else{_0x117c99[_0x0a9e('0x42')]('i.'+_0x17e88c+_0x0a9e('0x7a'),_0x39e565[_0x0a9e('0x38')][_0x17e88c]);}}});}if(_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x7b')]){if(_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x7b')]==0x1){_0x117c99[_0x0a9e('0x60')](_0x0a9e('0x7c'));}else{_0x117c99['having'](_0x0a9e('0x7d'));}}if(_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x7e')]){_0x1bde3c=_['isArray'](_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x7e')])?_0x39e565['query'][_0x0a9e('0x7e')]:new Array(_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x7e')]);_0x1bde3c[_0x0a9e('0x2f')](function(_0x13b5c0){_0x1b5e80['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x13b5c0+',%');});}if(_0x39e565['query']['filter']){var _0x40fb85=_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x7f')][_0x0a9e('0x80')]('\x5c','\x5c\x5c')[_0x0a9e('0x80')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x81')](_0x40fb85)){_0x5bbcde['or'](_0x0a9e('0x82'),_0x40fb85+'%')['or'](_0x0a9e('0x83'),_0x40fb85+'%');}else{_0x5bbcde['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x64')](_0x40fb85))['or'](_0x0a9e('0x84'),_0x40fb85+'%');}}}_0x117c99[_0x0a9e('0x42')](_0x5bbcde);_0x117c99['group'](_0x0a9e('0x85'));var _0x583b2e={'type':db[_0x0a9e('0x86')][_0x0a9e('0x87')]['SELECT'],'raw':!![]};var _0x2ed01e=_0x117c99[_0x0a9e('0x88')]();_0x2ed01e[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x2ed01e['field'](_0x0a9e('0x89'),_0x0a9e('0x8a'));if(_0x44295a[_0x0a9e('0x40')]){_0x44295a[_0x0a9e('0x40')]['forEach'](function(_0x109ccb){var _0x3d91db=_0x109ccb[0x0]===_0x0a9e('0x8b')?_0x109ccb[0x0]:'i.'+_0x109ccb[0x0];_0x117c99[_0x0a9e('0x40')](_0x3d91db,_0x109ccb[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0a9e('0x8c')](_0x1bde3c)){_0x117c99[_0x0a9e('0x60')](_0x1b5e80);_0x2ed01e[_0x0a9e('0x42')](_0x0a9e('0x8d'),_0x1bde3c);}BPromise[_0x0a9e('0x8e')]()[_0x0a9e('0x25')](function(){if(!_0x409789){if(_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x72')])return;_0x2ed01e[_0x0a9e('0x42')](_0x0a9e('0x8f'));_0x117c99[_0x0a9e('0x42')](_0x0a9e('0x8f'));return;}if(_0x39e565[_0x0a9e('0x90')][_0x0a9e('0x91')]!=='agent')return;return _0x39e565[_0x0a9e('0x90')][_0x0a9e('0x92')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x25')](function(_0x563627){if(_[_0x0a9e('0x8c')](_0x563627)){_0x2ed01e[_0x0a9e('0x42')](_0x0a9e('0x93'));_0x117c99[_0x0a9e('0x42')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x2ed01e['where'](_0x0a9e('0x73'),_[_0x0a9e('0x2a')](_0x563627,'id'));_0x117c99['where'](_0x0a9e('0x73'),_['map'](_0x563627,'id'));}});})[_0x0a9e('0x25')](function(){if(_0x39e565[_0x0a9e('0x90')]['role']===_0x0a9e('0x94')&&!_0x409789&&!_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x72')])return[];return db[_0x0a9e('0x95')][_0x0a9e('0x38')](_0x2ed01e[_0x0a9e('0x96')](),_0x583b2e);})[_0x0a9e('0x25')](function(_0x482ca2){_0x2cc7a0[_0x0a9e('0x1e')]=_0x482ca2[_0x0a9e('0x3d')];if(_0x2cc7a0[_0x0a9e('0x1e')]===0x0)return[];return db[_0x0a9e('0x95')]['query'](_0x23b089[_0x0a9e('0x96')](),_0x583b2e)[_0x0a9e('0x25')](function(_0x4bf3a5){_0x45a9b8=_[_0x0a9e('0x97')](_0x4bf3a5,'id');_0x583b2e=_['merge'](_0x583b2e,{'model':db[_0x0a9e('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x39e565[_0x0a9e('0x38')][_0x0a9e('0x3c')]){_0x44295a[_0x0a9e('0x3b')]['forEach'](function(_0x51ccd7){_0x117c99[_0x0a9e('0x45')]('i.'+_0x51ccd7);});}else{_0x117c99[_0x0a9e('0x45')](_0x0a9e('0x89'),'unreadMessages');_0x117c99[_0x0a9e('0x45')](_0x0a9e('0x98'),'Account.key');_0x117c99['field'](_0x0a9e('0x99'),'Account.mandatoryDisposition');_0x117c99['field']('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',_0x0a9e('0x8b'));_0x117c99[_0x0a9e('0x45')](_0x0a9e('0x9a'));_0x117c99[_0x0a9e('0x45')](_0x0a9e('0x9b'),_0x0a9e('0x9c'));_0x117c99['field'](_0x0a9e('0x9d'),'Contact.lastName');_0x117c99[_0x0a9e('0x45')](_0x0a9e('0x9e'),_0x0a9e('0x9f'));_0x117c99[_0x0a9e('0x45')]('c.phone',_0x0a9e('0xa0'));_0x117c99[_0x0a9e('0x45')](_0x0a9e('0xa1'),'Contact.mobile');_0x117c99[_0x0a9e('0x45')](_0x0a9e('0xa2'),_0x0a9e('0xa3'));_0x117c99[_0x0a9e('0x45')](_0x0a9e('0xa4'),_0x0a9e('0xa5'));_0x117c99[_0x0a9e('0x45')](_0x0a9e('0xa6'),'Owner.internal');_0x117c99[_0x0a9e('0x45')](_0x0a9e('0xa7'),'TagIds');}if(_0x44295a[_0x0a9e('0x20')])_0x117c99[_0x0a9e('0x20')](_0x44295a[_0x0a9e('0x20')]);if(_0x44295a['offset'])_0x117c99[_0x0a9e('0x1f')](_0x44295a['offset']);return db[_0x0a9e('0x95')][_0x0a9e('0x38')](_0x117c99[_0x0a9e('0x96')](),_0x583b2e);})[_0x0a9e('0x25')](function(_0x842d6f){_0x473fdc[_0x0a9e('0x42')](_0x0a9e('0xa8'),_[_0x0a9e('0x2a')](_0x842d6f,'id'));return db['sequelize'][_0x0a9e('0x38')](_0x473fdc[_0x0a9e('0x96')](),_0x583b2e)[_0x0a9e('0x25')](function(_0x30ef6e){var _0x28e60a=_[_0x0a9e('0xa9')](_0x30ef6e,_0x0a9e('0xaa'));var _0x33f0c9=[];_0x842d6f[_0x0a9e('0x2f')](function(_0x31af8c){_0x33f0c9[_0x0a9e('0x30')](updateSmsInteraction(_0x31af8c,_0x45a9b8,_0x28e60a));});return BPromise[_0x0a9e('0xab')](_0x33f0c9);});});})[_0x0a9e('0x25')](function(_0x4989f9){_0x2cc7a0[_0x0a9e('0xac')]=_0x4989f9;return _0x2cc7a0;})[_0x0a9e('0x25')](respondWithFilteredResult(_0x5583a4,_0x44295a))[_0x0a9e('0x31')](handleError(_0x5583a4,null));};exports[_0x0a9e('0xad')]=function(_0xb0599a,_0x5d9ddb){var _0x3afc8c={'raw':![],'where':{'id':_0xb0599a['params']['id']}},_0x1756c7={};_0x1756c7[_0x0a9e('0xae')]=_['keys'](db[_0x0a9e('0x33')][_0x0a9e('0xaf')]);_0x1756c7[_0x0a9e('0x38')]=_[_0x0a9e('0x37')](_0xb0599a['query']);_0x1756c7[_0x0a9e('0x39')]=_['intersection'](_0x1756c7[_0x0a9e('0xae')],_0x1756c7[_0x0a9e('0x38')]);_0x3afc8c['attributes']=_[_0x0a9e('0x3a')](_0x1756c7[_0x0a9e('0xae')],qs[_0x0a9e('0x3c')](_0xb0599a['query']['fields']));_0x3afc8c[_0x0a9e('0x3b')]=_0x3afc8c[_0x0a9e('0x3b')][_0x0a9e('0x3d')]?_0x3afc8c[_0x0a9e('0x3b')]:_0x1756c7[_0x0a9e('0xae')];if(_0xb0599a[_0x0a9e('0x38')][_0x0a9e('0xb0')]){_0x3afc8c[_0x0a9e('0xb1')]=[{'all':!![]}];}_0x3afc8c=_[_0x0a9e('0xb2')]({},_0x3afc8c,_0xb0599a['options']);return db[_0x0a9e('0x33')]['find'](_0x3afc8c)[_0x0a9e('0x25')](handleEntityNotFound(_0x5d9ddb,null))[_0x0a9e('0x25')](respondWithResult(_0x5d9ddb,null))[_0x0a9e('0x31')](handleError(_0x5d9ddb,null));};exports[_0x0a9e('0xb3')]=function(_0x1b61d5,_0x4e7273){return db[_0x0a9e('0x33')][_0x0a9e('0xb3')](_0x1b61d5[_0x0a9e('0xb4')],{})[_0x0a9e('0x25')](respondWithResult(_0x4e7273,0xc9))[_0x0a9e('0x31')](handleError(_0x4e7273,null));};exports['update']=function(_0x4f074c,_0x22a3cb){if(_0x4f074c['body']['id']){delete _0x4f074c[_0x0a9e('0xb4')]['id'];}return db[_0x0a9e('0x33')][_0x0a9e('0x5e')]({'where':{'id':_0x4f074c[_0x0a9e('0xb5')]['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0x22a3cb,null))[_0x0a9e('0x25')](saveUpdates(_0x4f074c['body'],null))['then'](respondWithResult(_0x22a3cb,null))[_0x0a9e('0x31')](handleError(_0x22a3cb,null));};exports['destroy']=function(_0x2469d1,_0x5c689c){return db[_0x0a9e('0x33')]['find']({'where':{'id':_0x2469d1['params']['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0x5c689c,null))[_0x0a9e('0x25')](removeEntity(_0x5c689c,null))['catch'](handleError(_0x5c689c,null));};exports[_0x0a9e('0xb6')]=function(_0x17cb30,_0x15c6b9){return db[_0x0a9e('0x33')][_0x0a9e('0xb6')]()['then'](respondWithResult(_0x15c6b9,null))['catch'](handleError(_0x15c6b9,null));};exports[_0x0a9e('0xb7')]=function(_0x22286c,_0x41c8cd,_0x24beb6){return db[_0x0a9e('0xb8')]['find']({'where':{'id':_0x22286c[_0x0a9e('0xb5')]['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0x41c8cd,null))['then'](function(_0x3c313d){if(_0x3c313d){return _0x3c313d[_0x0a9e('0xb7')](_0x22286c[_0x0a9e('0xb4')][_0x0a9e('0xb9')],_[_0x0a9e('0xba')](_0x22286c[_0x0a9e('0xb4')],[_0x0a9e('0xb9'),'id'])||{});}})[_0x0a9e('0x25')](respondWithResult(_0x41c8cd,null))[_0x0a9e('0x31')](handleError(_0x41c8cd,null));};exports[_0x0a9e('0xbb')]=function(_0x4bdebb,_0x1065a7,_0x301047){var _0x2ada60={'raw':![],'where':{}};var _0x1c4232={};var _0x1d0b02={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x4bdebb[_0x0a9e('0xb5')]['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0x1065a7,null))[_0x0a9e('0x25')](function(_0x2fea95){if(_0x2fea95){_0x1c4232[_0x0a9e('0xae')]=_['keys'](db[_0x0a9e('0xb8')][_0x0a9e('0xaf')]);_0x1c4232[_0x0a9e('0x38')]=_['keys'](_0x4bdebb[_0x0a9e('0x38')]);_0x1c4232['filters']=_[_0x0a9e('0x3a')](_0x1c4232['model'],_0x1c4232[_0x0a9e('0x38')]);_0x2ada60[_0x0a9e('0x3b')]=_[_0x0a9e('0x3a')](_0x1c4232['model'],qs[_0x0a9e('0x3c')](_0x4bdebb['query'][_0x0a9e('0x3c')]));_0x2ada60[_0x0a9e('0x3b')]=_0x2ada60[_0x0a9e('0x3b')][_0x0a9e('0x3d')]?_0x2ada60[_0x0a9e('0x3b')]:_0x1c4232[_0x0a9e('0xae')];if(!_0x4bdebb[_0x0a9e('0x38')][_0x0a9e('0x3e')](_0x0a9e('0x3f'))){_0x2ada60[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x4bdebb[_0x0a9e('0x38')][_0x0a9e('0x20')]);_0x2ada60[_0x0a9e('0x1f')]=qs[_0x0a9e('0x1f')](_0x4bdebb[_0x0a9e('0x38')]['offset']);}_0x2ada60['order']=qs[_0x0a9e('0x41')](_0x4bdebb['query'][_0x0a9e('0x41')]);_0x2ada60[_0x0a9e('0x42')]=qs['filters'](_[_0x0a9e('0x43')](_0x4bdebb[_0x0a9e('0x38')],_0x1c4232[_0x0a9e('0x39')]));_0x2ada60[_0x0a9e('0x42')]['SmsInteractionId']=_0x2fea95['id'];if(_0x4bdebb[_0x0a9e('0x38')][_0x0a9e('0x7f')]){_0x2ada60[_0x0a9e('0x42')]=_[_0x0a9e('0xb2')](_0x2ada60['where'],{'$or':_[_0x0a9e('0x2a')](_0x2ada60[_0x0a9e('0x3b')],function(_0x2b7092){var _0x5c838b={};_0x5c838b[_0x2b7092]={'$like':'%'+_0x4bdebb[_0x0a9e('0x38')][_0x0a9e('0x7f')]+'%'};return _0x5c838b;})});}if(_0x4bdebb[_0x0a9e('0x38')]['$gte']){var _0x303f75=_0x4bdebb[_0x0a9e('0x38')][_0x0a9e('0xbc')][_0x0a9e('0x2e')](',');var _0x2394d3={};_0x2394d3[_0x303f75[0x0]]={'$gte':moment(_0x303f75[0x1])['format'](_0x0a9e('0xbd'))};_0x2ada60[_0x0a9e('0x42')]=_['merge'](_0x2ada60[_0x0a9e('0x42')],_0x2394d3);}_0x2ada60=_[_0x0a9e('0xb2')]({},_0x2ada60,_0x4bdebb[_0x0a9e('0xbe')]);return db['SmsMessage']['count']({'where':_0x2ada60['where']})[_0x0a9e('0x25')](function(_0x4a70ce){_0x1d0b02['count']=_0x4a70ce;if(_0x4bdebb[_0x0a9e('0x38')][_0x0a9e('0xb0')]){_0x2ada60[_0x0a9e('0xb1')]=[{'all':!![]}];}return db['SmsMessage'][_0x0a9e('0xbf')](_0x2ada60);})[_0x0a9e('0x25')](function(_0x213d4e){_0x1d0b02[_0x0a9e('0xac')]=_0x213d4e;return _0x1d0b02;});}})[_0x0a9e('0x25')](respondWithFilteredResult(_0x1065a7,_0x2ada60))[_0x0a9e('0x31')](handleError(_0x1065a7,null));};exports[_0x0a9e('0xc0')]=function(_0x328ec5,_0x3b5bda,_0x5a1848){return db[_0x0a9e('0x33')]['find']({'where':{'id':_0x328ec5[_0x0a9e('0xb5')]['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0x3b5bda,null))[_0x0a9e('0x25')](function(_0x3cf222){if(_0x3cf222){return _0x3cf222[_0x0a9e('0xc1')](_0x328ec5[_0x0a9e('0xb4')]['ids'],_[_0x0a9e('0xba')](_0x328ec5[_0x0a9e('0xb4')],[_0x0a9e('0xb9'),'id'])||{})[_0x0a9e('0xc2')](function(){return db['Tag'][_0x0a9e('0xbf')]({'attributes':['id',_0x0a9e('0x28'),_0x0a9e('0x46')],'where':{'id':_0x328ec5[_0x0a9e('0xb4')][_0x0a9e('0xb9')]}});})[_0x0a9e('0x25')](function(_0x238c24){socket[_0x0a9e('0xc3')](_0x0a9e('0xc4'),{'id':Number(_0x328ec5[_0x0a9e('0xb5')]['id']),'tags':_0x238c24||[]});return{'id':Number(_0x328ec5['params']['id']),'tags':_0x238c24||[]};});}})[_0x0a9e('0x25')](respondWithResult(_0x3b5bda,null))[_0x0a9e('0x31')](handleError(_0x3b5bda,null));};exports[_0x0a9e('0xc5')]=function(_0x26b826,_0xea8bd1,_0x253f74){return db[_0x0a9e('0x33')][_0x0a9e('0x5e')]({'where':{'id':_0x26b826['params']['id']}})[_0x0a9e('0x25')](handleEntityNotFound(_0xea8bd1,null))[_0x0a9e('0x25')](function(_0x1a9ef1){if(_0x1a9ef1){return _0x1a9ef1['removeTags'](_0x26b826[_0x0a9e('0x38')][_0x0a9e('0xb9')]);}})[_0x0a9e('0x25')](respondWithStatusCode(_0xea8bd1,null))[_0x0a9e('0x31')](handleError(_0xea8bd1,null));};exports[_0x0a9e('0xc6')]=function(_0x1ba457,_0x424f1b){var _0x336a19=moment()[_0x0a9e('0xc7')]()[_0x0a9e('0x96')]();var _0x5a7dad=path[_0x0a9e('0xc8')](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xcb'),_0x0a9e('0xcc'));var _0x3942fd=path['join'](config[_0x0a9e('0xc9')],'server','files','attachments');var _0x19e4e6=path[_0x0a9e('0xc8')](_0x5a7dad,_0x336a19);var _0x426cb4=util[_0x0a9e('0xcd')]('transcript-%d-%s.zip',_0x1ba457[_0x0a9e('0xb5')]['id'],_0x336a19);var _0x309fa9=path[_0x0a9e('0xc8')](_0x5a7dad,_0x426cb4);var _0x1fdb10=[];_0x1fdb10[_0x0a9e('0x30')]({'model':db['User'],'as':'User','attributes':['id',_0x0a9e('0x2b')],'raw':!![]});_0x1fdb10[_0x0a9e('0x30')]({'model':db[_0x0a9e('0xce')],'as':'Contact','attributes':['id',_0x0a9e('0xcf'),_0x0a9e('0xd0')],'raw':!![]});var _0x422f0a=[{'model':db['SmsMessage'],'as':_0x0a9e('0xd1'),'attributes':['id',_0x0a9e('0xb4'),_0x0a9e('0x74'),'direction',_0x0a9e('0xd2'),_0x0a9e('0x7b')],'include':_0x1fdb10}];_0x422f0a[_0x0a9e('0x30')]({'model':db['SmsAccount'],'as':'Account','attributes':['id','name']});_0x422f0a[_0x0a9e('0x30')]({'model':db[_0x0a9e('0x69')],'as':_0x0a9e('0xd3'),'attributes':['id',_0x0a9e('0x2b')]});return db['SmsInteraction'][_0x0a9e('0x5e')]({'where':{'id':_0x1ba457['params']['id']},'include':_0x422f0a})[_0x0a9e('0x25')](handleEntityNotFound(_0x424f1b,null))[_0x0a9e('0x25')](function(_0x242f23){if(_0x242f23){var _0x57f673=_0x242f23[_0x0a9e('0xd4')]({'plain':!![]});fs[_0x0a9e('0xd5')](_0x19e4e6);var _0xb8a476={'format':'A4','border':'10px','header':{'height':_0x0a9e('0xd6'),'contents':{'first':'\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20'}},'footer':{'height':_0x0a9e('0xd7'),'contents':{'default':util['format'](_0x0a9e('0xd8'),util['format'](_0x0a9e('0xd9'),_0x0a9e('0xda'),_0x57f673['id']),moment()[_0x0a9e('0xcd')](_0x0a9e('0xdb'))[_0x0a9e('0x96')]())}}};var _0x251dd9={'channel':_0x0a9e('0xda'),'account':_0x57f673['Account'][_0x0a9e('0x28')],'agent':_0x57f673[_0x0a9e('0xd3')]?_0x57f673['Owner'][_0x0a9e('0x2b')]:_0x0a9e('0xdc'),'createdAt':moment(_0x57f673['createdAt'])[_0x0a9e('0xcd')](_0x0a9e('0xbd'))[_0x0a9e('0x96')](),'closedAt':_0x57f673['closed']?moment(_0x57f673[_0x0a9e('0xdd')])[_0x0a9e('0xcd')](_0x0a9e('0xbd'))[_0x0a9e('0x96')]():'','disposition':_0x57f673[_0x0a9e('0xde')],'messages':_(_0x57f673[_0x0a9e('0xd1')])[_0x0a9e('0x7f')]({'secret':![]})[_0x0a9e('0x2a')](function(_0x22767f){return{'date':moment(_0x22767f[_0x0a9e('0x74')])['format'](_0x0a9e('0xbd'))['toString'](),'sender':_0x22767f[_0x0a9e('0xdf')]===_0x0a9e('0xe0')?_0x22767f[_0x0a9e('0x69')]?_0x22767f[_0x0a9e('0x69')][_0x0a9e('0x2b')]:_0x0a9e('0xe1'):_0x22767f['Contact'][_0x0a9e('0xcf')]+(_0x22767f[_0x0a9e('0x62')][_0x0a9e('0xd0')]?'\x20'+_0x22767f['Contact'][_0x0a9e('0xd0')]:''),'body':_0x22767f[_0x0a9e('0xb4')],'direction':_0x22767f[_0x0a9e('0xdf')]===_0x0a9e('0xe0')?'A':'C','secret':_0x22767f[_0x0a9e('0xd2')],'read':_0x22767f[_0x0a9e('0x7b')]};})[_0x0a9e('0x63')]()};return ejs['renderFile'](path[_0x0a9e('0xc8')](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xe2'),_0x0a9e('0xe3')),{'interaction':_0x251dd9})[_0x0a9e('0x25')](function(_0x8120e){return new BPromise(function(_0x5d6a48,_0x5c8720){pdf[_0x0a9e('0xb3')](_0x8120e,_0xb8a476)[_0x0a9e('0xe4')](path[_0x0a9e('0xc8')](_0x19e4e6,_0x0a9e('0xe5')+_0x57f673['id']+'-'+_0x336a19+_0x0a9e('0xe6')),function(_0x131da8,_0x609711){if(_0x131da8)return _0x5c8720(_0x131da8);_0x5d6a48(_0x609711);});});})['then'](function(){return new BPromise(function(_0x39ea62,_0x1d7fc4){zipdir(_0x19e4e6,{'saveTo':_0x309fa9},function(_0x2d8e91,_0x2675a5){if(_0x2d8e91)return _0x1d7fc4(_0x2d8e91);return _0x39ea62(_0x2675a5);});})[_0x0a9e('0x25')](function(){return new BPromise(function(_0x3c6082,_0x16be7e){rimraf(_0x19e4e6,function(_0x54f0b8){if(_0x54f0b8)_0x16be7e(_0x54f0b8);return _0x3c6082();});});})[_0x0a9e('0x25')](function(){return _0x424f1b[_0x0a9e('0xc6')](_0x309fa9,_0x426cb4,function(_0x231826){if(_0x231826){console['log'](_0x0a9e('0xe7'),_0x231826);}else{fs[_0x0a9e('0xe8')](_0x309fa9);}});});});}else{return _0x424f1b[_0x0a9e('0x1b')](0xc8);}})[_0x0a9e('0x31')](handleError(_0x424f1b,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 234a7ce..48ff77b 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 _0x1c9a=['Users','map','findAll','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','getUsers','then','setDataValue'];(function(_0xf1ce61,_0x3325dd){var _0x4b519a=function(_0x40e740){while(--_0x40e740){_0xf1ce61['push'](_0xf1ce61['shift']());}};_0x4b519a(++_0x3325dd);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0x1a7e86,_0x37be3b){_0x1a7e86=_0x1a7e86-0x0;var _0x198fa7=_0x1c9a[_0x1a7e86];return _0x198fa7;};'use strict';var EventEmitter=require(_0xa1c9('0x0'));var SmsInteraction=require(_0xa1c9('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0xa1c9('0x1'))['db'][_0xa1c9('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xa1c9('0x3')](0x0);var events={'afterCreate':_0xa1c9('0x4'),'afterUpdate':_0xa1c9('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2f883c){return function(_0x5bccfd,_0x1716cb,_0xdd22bf){_0x5bccfd[_0xa1c9('0x6')]({'attributes':['id'],'raw':!![]})[_0xa1c9('0x7')](function(_0x1a0364){_0x5bccfd[_0xa1c9('0x8')](_0xa1c9('0x9'),_0x1a0364[_0xa1c9('0xa')](function(_0x1b4b82){return{'id':_0x1b4b82['id']};}));return SmsMessage[_0xa1c9('0xb')]({'where':{'SmsInteractionId':_0x5bccfd['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa1c9('0x7')](function(_0xb96573){_0x5bccfd['setDataValue']('unreadMessages',_0xb96573[_0xa1c9('0xc')]);SmsInteractionEvents['emit'](_0x2f883c+':'+_0x5bccfd['id'],_0x5bccfd);SmsInteractionEvents[_0xa1c9('0xd')](_0x2f883c,_0x5bccfd);_0xdd22bf(null);})[_0xa1c9('0xe')](_0xdd22bf(null));};}for(var e in events){if(events[_0xa1c9('0xf')](e)){var event=events[e];SmsInteraction[_0xa1c9('0x10')](e,emitEvent(event));}}module[_0xa1c9('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0x7d9f=['emit','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','save','update','remove','getUsers','then','setDataValue','Users','length'];(function(_0x3ff0aa,_0x4701e5){var _0x10dc5e=function(_0xf344b2){while(--_0xf344b2){_0x3ff0aa['push'](_0x3ff0aa['shift']());}};_0x10dc5e(++_0x4701e5);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x1b8bc6,_0x4672de){_0x1b8bc6=_0x1b8bc6-0x0;var _0x17b6bd=_0x7d9f[_0x1b8bc6];return _0x17b6bd;};'use strict';var EventEmitter=require(_0xf7d9('0x0'));var SmsInteraction=require(_0xf7d9('0x1'))['db'][_0xf7d9('0x2')];var SmsMessage=require(_0xf7d9('0x1'))['db'][_0xf7d9('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf7d9('0x4'),'afterUpdate':_0xf7d9('0x5'),'afterDestroy':_0xf7d9('0x6')};function emitEvent(_0x159e95){return function(_0x23cb4c,_0x53fdaf,_0x4b50c7){_0x23cb4c[_0xf7d9('0x7')]({'attributes':['id'],'raw':!![]})[_0xf7d9('0x8')](function(_0x5772b4){_0x23cb4c[_0xf7d9('0x9')](_0xf7d9('0xa'),_0x5772b4['map'](function(_0x572d51){return{'id':_0x572d51['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x23cb4c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf7d9('0x8')](function(_0x33360a){_0x23cb4c['setDataValue']('unreadMessages',_0x33360a[_0xf7d9('0xb')]);SmsInteractionEvents[_0xf7d9('0xc')](_0x159e95+':'+_0x23cb4c['id'],_0x23cb4c);SmsInteractionEvents[_0xf7d9('0xc')](_0x159e95,_0x23cb4c);_0x4b50c7(null);})['catch'](_0x4b50c7(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xf7d9('0xd')](e,emitEvent(event));}}module[_0xf7d9('0xe')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 8ea3052..5567e64 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 _0x7f53=['lodash','util','api','moment','bluebird','path','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format'];(function(_0x5a745e,_0x5b4c13){var _0x23ff0e=function(_0x404f0f){while(--_0x404f0f){_0x5a745e['push'](_0x5a745e['shift']());}};_0x23ff0e(++_0x5b4c13);}(_0x7f53,0xc0));var _0x37f5=function(_0x431ff8,_0x4085dd){_0x431ff8=_0x431ff8-0x0;var _0x84ccd4=_0x7f53[_0x431ff8];return _0x84ccd4;};'use strict';var _=require(_0x37f5('0x0'));var util=require(_0x37f5('0x1'));var logger=require('../../config/logger')(_0x37f5('0x2'));var moment=require(_0x37f5('0x3'));var BPromise=require(_0x37f5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x37f5('0x5'));var rimraf=require('rimraf');var config=require(_0x37f5('0x6'));var attributes=require(_0x37f5('0x7'));module[_0x37f5('0x8')]=function(_0x3592ec,_0x550a68){return _0x3592ec[_0x37f5('0x9')](_0x37f5('0xa'),attributes,{'tableName':_0x37f5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a610b,_0x426d33,_0x14578b){if(_0x5a610b[_0x37f5('0xc')](_0x37f5('0xd'))){_0x5a610b[_0x37f5('0xe')]=moment()[_0x37f5('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x14578b(null,_0x5a610b);}}});}; \ No newline at end of file +var _0xcc84=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','sms_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x34c401,_0x4458ec){var _0x89c5e3=function(_0x57c41a){while(--_0x57c41a){_0x34c401['push'](_0x34c401['shift']());}};_0x89c5e3(++_0x4458ec);}(_0xcc84,0x180));var _0x4cc8=function(_0x1d4049,_0x5b60c9){_0x1d4049=_0x1d4049-0x0;var _0x1c72e6=_0xcc84[_0x1d4049];return _0x1c72e6;};'use strict';var _=require(_0x4cc8('0x0'));var util=require(_0x4cc8('0x1'));var logger=require(_0x4cc8('0x2'))(_0x4cc8('0x3'));var moment=require(_0x4cc8('0x4'));var BPromise=require(_0x4cc8('0x5'));var rp=require(_0x4cc8('0x6'));var fs=require('fs');var path=require(_0x4cc8('0x7'));var rimraf=require(_0x4cc8('0x8'));var config=require(_0x4cc8('0x9'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x5e53c6,_0x39dee0){return _0x5e53c6[_0x4cc8('0xa')]('SmsInteraction',attributes,{'tableName':_0x4cc8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xb61f76,_0x2294e3,_0x502aab){if(_0xb61f76[_0x4cc8('0xc')](_0x4cc8('0xd'))){_0xb61f76[_0x4cc8('0xe')]=moment()['format'](_0x4cc8('0xf'));}_0x502aab(null,_0xb61f76);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index cd87bf5..48208d8 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 _0xb599=['localhost','socket.io-emitter','./smsInteraction.socket','request','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','SmsInteraction,\x20%s,\x20%s','message','catch','UpdateSmsInteraction','update','body','options','raw','where','attributes','limit','AddTagsToSmsInteraction','SmsInteraction','find','then','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x1da8f4,_0x1ae2e2){var _0x284e53=function(_0x13e5ff){while(--_0x13e5ff){_0x1da8f4['push'](_0x1da8f4['shift']());}};_0x284e53(++_0x1ae2e2);}(_0xb599,0x1aa));var _0x9b59=function(_0x4ea3e0,_0x44ca82){_0x4ea3e0=_0x4ea3e0-0x0;var _0x115fc5=_0xb599[_0x4ea3e0];return _0x115fc5;};'use strict';var _=require(_0x9b59('0x0'));var util=require(_0x9b59('0x1'));var moment=require(_0x9b59('0x2'));var BPromise=require(_0x9b59('0x3'));var rs=require(_0x9b59('0x4'));var fs=require('fs');var Redis=require(_0x9b59('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9b59('0x6'));var logger=require('../../config/logger')(_0x9b59('0x7'));var config=require(_0x9b59('0x8'));var jayson=require(_0x9b59('0x9'));var client=jayson[_0x9b59('0xa')][_0x9b59('0xb')]({'port':0x232a});config[_0x9b59('0xc')]=_[_0x9b59('0xd')](config['redis'],{'host':_0x9b59('0xe'),'port':0x18eb});var socket=require(_0x9b59('0xf'))(new Redis(config[_0x9b59('0xc')]));require(_0x9b59('0x10'))['register'](socket);function respondWithRpcPromise(_0x5a0ca4,_0x1c7148,_0x250d7d){return new BPromise(function(_0x20dcd0,_0x14edf3){return client[_0x9b59('0x11')](_0x5a0ca4,_0x250d7d)['then'](function(_0xfdf1c1){logger[_0x9b59('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x1c7148,_0x9b59('0x13'));logger[_0x9b59('0x14')](_0x9b59('0x15'),_0x1c7148,'request\x20sent',JSON[_0x9b59('0x16')](_0xfdf1c1));if(_0xfdf1c1[_0x9b59('0x17')]){if(_0xfdf1c1[_0x9b59('0x17')]['code']===0x1f4){logger['error'](_0x9b59('0x18'),_0x1c7148,_0xfdf1c1[_0x9b59('0x17')]['message']);return _0x14edf3(_0xfdf1c1[_0x9b59('0x17')][_0x9b59('0x19')]);}logger[_0x9b59('0x17')](_0x9b59('0x18'),_0x1c7148,_0xfdf1c1[_0x9b59('0x17')][_0x9b59('0x19')]);return _0x20dcd0(_0xfdf1c1[_0x9b59('0x17')]['message']);}else{logger[_0x9b59('0x12')](_0x9b59('0x18'),_0x1c7148,'request\x20sent');_0x20dcd0(_0xfdf1c1['result'][_0x9b59('0x19')]);}})[_0x9b59('0x1a')](function(_0xab7eb7){logger[_0x9b59('0x17')](_0x9b59('0x18'),_0x1c7148,_0xab7eb7);_0x14edf3(_0xab7eb7);});});}exports[_0x9b59('0x1b')]=function(_0x1c1669){var _0x36bc74=this;return new Promise(function(_0x37adf4,_0x578b16){return db['SmsInteraction'][_0x9b59('0x1c')](_0x1c1669[_0x9b59('0x1d')],{'raw':_0x1c1669[_0x9b59('0x1e')]?_0x1c1669['options'][_0x9b59('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c1669[_0x9b59('0x1e')]?_0x1c1669[_0x9b59('0x1e')][_0x9b59('0x20')]||null:null,'attributes':_0x1c1669[_0x9b59('0x1e')]?_0x1c1669['options'][_0x9b59('0x21')]||null:null,'limit':_0x1c1669[_0x9b59('0x1e')]?_0x1c1669[_0x9b59('0x1e')][_0x9b59('0x22')]||null:null})['then'](function(_0x291e49){logger[_0x9b59('0x12')](_0x9b59('0x1b'),_0x1c1669);logger[_0x9b59('0x14')](_0x9b59('0x1b'),_0x1c1669,JSON[_0x9b59('0x16')](_0x291e49));_0x37adf4(_0x291e49);})['catch'](function(_0x5960b2){logger['error']('UpdateSmsInteraction',_0x5960b2[_0x9b59('0x19')],_0x1c1669);_0x578b16(_0x36bc74['error'](0x1f4,_0x5960b2['message']));});});};exports[_0x9b59('0x23')]=function(_0x21b9c1){return new Promise(function(_0x138d94,_0x36ae20){return db[_0x9b59('0x24')][_0x9b59('0x25')]({'where':_0x21b9c1['options']?_0x21b9c1[_0x9b59('0x1e')][_0x9b59('0x20')]||null:null})[_0x9b59('0x26')](function(_0x936445){if(_0x936445){return _0x936445[_0x9b59('0x27')](_0x21b9c1['body'][_0x9b59('0x28')],_[_0x9b59('0x29')](_0x21b9c1[_0x9b59('0x1d')],[_0x9b59('0x28'),'id'])||{});}})[_0x9b59('0x2a')](function(_0x588743){logger[_0x9b59('0x12')]('AddTags',_0x21b9c1);logger[_0x9b59('0x14')](_0x9b59('0x2b'),_0x21b9c1,JSON[_0x9b59('0x16')](_0x588743));_0x138d94(_0x588743);})[_0x9b59('0x1a')](function(_0x3673ea){logger[_0x9b59('0x17')](_0x9b59('0x2b'),_0x3673ea[_0x9b59('0x19')],_0x21b9c1);_0x36ae20(_this['error'](0x1f4,_0x3673ea[_0x9b59('0x19')]));});});}; \ No newline at end of file +var _0xcfa3=['AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./smsInteraction.socket','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','where','attributes','then','AddTagsToSmsInteraction','addTags','ids','spread'];(function(_0xee588,_0x368239){var _0x58dd1a=function(_0x3fd2b1){while(--_0x3fd2b1){_0xee588['push'](_0xee588['shift']());}};_0x58dd1a(++_0x368239);}(_0xcfa3,0x7c));var _0x3cfa=function(_0x533f16,_0x5fa494){_0x533f16=_0x533f16-0x0;var _0x4775b4=_0xcfa3[_0x533f16];return _0x4775b4;};'use strict';var _=require(_0x3cfa('0x0'));var util=require(_0x3cfa('0x1'));var moment=require(_0x3cfa('0x2'));var BPromise=require(_0x3cfa('0x3'));var rs=require(_0x3cfa('0x4'));var fs=require('fs');var Redis=require(_0x3cfa('0x5'));var db=require(_0x3cfa('0x6'))['db'];var utils=require(_0x3cfa('0x7'));var logger=require(_0x3cfa('0x8'))(_0x3cfa('0x9'));var config=require('../../config/environment');var jayson=require(_0x3cfa('0xa'));var client=jayson[_0x3cfa('0xb')][_0x3cfa('0xc')]({'port':0x232a});config['redis']=_[_0x3cfa('0xd')](config[_0x3cfa('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x3cfa('0xf'))(new Redis(config[_0x3cfa('0xe')]));require(_0x3cfa('0x10'))['register'](socket);function respondWithRpcPromise(_0xfe6037,_0xea7193,_0x4a70f9){return new BPromise(function(_0x1bfa89,_0x860d0c){return client['request'](_0xfe6037,_0x4a70f9)['then'](function(_0x57139c){logger[_0x3cfa('0x11')]('SmsInteraction,\x20%s,\x20%s',_0xea7193,_0x3cfa('0x12'));logger[_0x3cfa('0x13')](_0x3cfa('0x14'),_0xea7193,'request\x20sent',JSON[_0x3cfa('0x15')](_0x57139c));if(_0x57139c[_0x3cfa('0x16')]){if(_0x57139c['error'][_0x3cfa('0x17')]===0x1f4){logger[_0x3cfa('0x16')](_0x3cfa('0x18'),_0xea7193,_0x57139c[_0x3cfa('0x16')][_0x3cfa('0x19')]);return _0x860d0c(_0x57139c['error'][_0x3cfa('0x19')]);}logger[_0x3cfa('0x16')](_0x3cfa('0x18'),_0xea7193,_0x57139c['error']['message']);return _0x1bfa89(_0x57139c['error'][_0x3cfa('0x19')]);}else{logger[_0x3cfa('0x11')](_0x3cfa('0x18'),_0xea7193,_0x3cfa('0x12'));_0x1bfa89(_0x57139c[_0x3cfa('0x1a')][_0x3cfa('0x19')]);}})[_0x3cfa('0x1b')](function(_0xe149a8){logger[_0x3cfa('0x16')](_0x3cfa('0x18'),_0xea7193,_0xe149a8);_0x860d0c(_0xe149a8);});});}exports[_0x3cfa('0x1c')]=function(_0x50d2c7){var _0x4447be=this;return new Promise(function(_0x1bda1c,_0x571e73){return db[_0x3cfa('0x1d')][_0x3cfa('0x1e')](_0x50d2c7[_0x3cfa('0x1f')],{'raw':_0x50d2c7[_0x3cfa('0x20')]?_0x50d2c7['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50d2c7[_0x3cfa('0x20')]?_0x50d2c7[_0x3cfa('0x20')][_0x3cfa('0x21')]||null:null,'attributes':_0x50d2c7['options']?_0x50d2c7[_0x3cfa('0x20')][_0x3cfa('0x22')]||null:null,'limit':_0x50d2c7[_0x3cfa('0x20')]?_0x50d2c7[_0x3cfa('0x20')]['limit']||null:null})[_0x3cfa('0x23')](function(_0x2c354a){logger[_0x3cfa('0x11')](_0x3cfa('0x1c'),_0x50d2c7);logger[_0x3cfa('0x13')]('UpdateSmsInteraction',_0x50d2c7,JSON[_0x3cfa('0x15')](_0x2c354a));_0x1bda1c(_0x2c354a);})[_0x3cfa('0x1b')](function(_0x418ead){logger[_0x3cfa('0x16')](_0x3cfa('0x1c'),_0x418ead['message'],_0x50d2c7);_0x571e73(_0x4447be['error'](0x1f4,_0x418ead[_0x3cfa('0x19')]));});});};exports[_0x3cfa('0x24')]=function(_0x10c186){return new Promise(function(_0x15d2d5,_0x4b0001){return db[_0x3cfa('0x1d')]['find']({'where':_0x10c186[_0x3cfa('0x20')]?_0x10c186[_0x3cfa('0x20')][_0x3cfa('0x21')]||null:null})['then'](function(_0x25621f){if(_0x25621f){return _0x25621f[_0x3cfa('0x25')](_0x10c186[_0x3cfa('0x1f')]['ids'],_['omit'](_0x10c186[_0x3cfa('0x1f')],[_0x3cfa('0x26'),'id'])||{});}})[_0x3cfa('0x27')](function(_0xe47aaa){logger[_0x3cfa('0x11')]('AddTags',_0x10c186);logger[_0x3cfa('0x13')]('AddTags',_0x10c186,JSON[_0x3cfa('0x15')](_0xe47aaa));_0x15d2d5(_0xe47aaa);})[_0x3cfa('0x1b')](function(_0x2b6c81){logger[_0x3cfa('0x16')](_0x3cfa('0x28'),_0x2b6c81[_0x3cfa('0x19')],_0x10c186);_0x4b0001(_this[_0x3cfa('0x16')](0x1f4,_0x2b6c81[_0x3cfa('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 5ac5952..27fcfc3 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 _0x2032=['save','remove','update','removeListener','register','length','smsInteraction:'];(function(_0xf5d71c,_0x2613a6){var _0x5af672=function(_0x191f52){while(--_0x191f52){_0xf5d71c['push'](_0xf5d71c['shift']());}};_0x5af672(++_0x2613a6);}(_0x2032,0xd9));var _0x2203=function(_0x1b9e29,_0x4af736){_0x1b9e29=_0x1b9e29-0x0;var _0x48e2ed=_0x2032[_0x1b9e29];return _0x48e2ed;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x2203('0x0'),_0x2203('0x1'),_0x2203('0x2')];function createListener(_0x4c28da,_0x486390){return function(_0x228a29){_0x486390['emit'](_0x4c28da,_0x228a29);};}function removeListener(_0x46c49a,_0x880dcd){return function(){SmsInteractionEvents[_0x2203('0x3')](_0x46c49a,_0x880dcd);};}exports[_0x2203('0x4')]=function(_0x3f7ba1){for(var _0x13367a=0x0,_0x2e0f63=events[_0x2203('0x5')];_0x13367a<_0x2e0f63;_0x13367a++){var _0x18c4d6=events[_0x13367a];var _0x2049ff=createListener(_0x2203('0x6')+_0x18c4d6,_0x3f7ba1);SmsInteractionEvents['on'](_0x18c4d6,_0x2049ff);}}; \ No newline at end of file +var _0x2032=['save','remove','update','removeListener','register','length','smsInteraction:'];(function(_0x5f1617,_0x46277b){var _0x3af5da=function(_0x15b934){while(--_0x15b934){_0x5f1617['push'](_0x5f1617['shift']());}};_0x3af5da(++_0x46277b);}(_0x2032,0xd9));var _0x2203=function(_0x159a2a,_0x5af9f1){_0x159a2a=_0x159a2a-0x0;var _0x1bd212=_0x2032[_0x159a2a];return _0x1bd212;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x2203('0x0'),_0x2203('0x1'),_0x2203('0x2')];function createListener(_0x4c28da,_0x486390){return function(_0x228a29){_0x486390['emit'](_0x4c28da,_0x228a29);};}function removeListener(_0x46c49a,_0x880dcd){return function(){SmsInteractionEvents[_0x2203('0x3')](_0x46c49a,_0x880dcd);};}exports[_0x2203('0x4')]=function(_0x3f7ba1){for(var _0x13367a=0x0,_0x2e0f63=events[_0x2203('0x5')];_0x13367a<_0x2e0f63;_0x13367a++){var _0x18c4d6=events[_0x13367a];var _0x2049ff=createListener(_0x2203('0x6')+_0x18c4d6,_0x3f7ba1);SmsInteractionEvents['on'](_0x18c4d6,_0x2049ff);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index a119b22..d034ebe 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 _0xb575=['sms','create','/:id/status','status','put','update','accept','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','show','tracked'];(function(_0x171d3a,_0xce2c90){var _0x318ac7=function(_0x198426){while(--_0x198426){_0x171d3a['push'](_0x171d3a['shift']());}};_0x318ac7(++_0xce2c90);}(_0xb575,0x7c));var _0x5b57=function(_0x1f5d10,_0x59889f){_0x1f5d10=_0x1f5d10-0x0;var _0x2383f3=_0xb575[_0x1f5d10];return _0x2383f3;};'use strict';var multer=require(_0x5b57('0x0'));var util=require('util');var path=require(_0x5b57('0x1'));var timeout=require(_0x5b57('0x2'));var express=require(_0x5b57('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5b57('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5b57('0x5'));var controller=require('./smsMessage.controller');router['get']('/',auth[_0x5b57('0x6')](),controller[_0x5b57('0x7')]);router['get'](_0x5b57('0x8'),auth[_0x5b57('0x6')](),controller[_0x5b57('0x9')]);router[_0x5b57('0xa')](_0x5b57('0xb'),auth['isAuthenticated'](),controller[_0x5b57('0xc')]);router['post']('/',auth[_0x5b57('0x6')](),interaction[_0x5b57('0xd')](_0x5b57('0xe'),'smsmessage:create'),controller[_0x5b57('0xf')]);router['post'](_0x5b57('0x10'),controller[_0x5b57('0x11')]);router[_0x5b57('0x12')](_0x5b57('0xb'),auth[_0x5b57('0x6')](),controller[_0x5b57('0x13')]);router['put']('/:id/accept',auth[_0x5b57('0x6')](),controller[_0x5b57('0x14')]);router[_0x5b57('0x12')]('/:id/reject',auth[_0x5b57('0x6')](),controller['reject']);router[_0x5b57('0x15')](_0x5b57('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x5b57('0x16')]=router; \ No newline at end of file +var _0xb685=['/:id/reject','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','tracked','sms','post','/:id/status','status','put','update','/:id/accept','accept'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xb685,0x107));var _0x5b68=function(_0x53cb72,_0x458fac){_0x53cb72=_0x53cb72-0x0;var _0x932595=_0xb685[_0x53cb72];return _0x932595;};'use strict';var multer=require(_0x5b68('0x0'));var util=require(_0x5b68('0x1'));var path=require(_0x5b68('0x2'));var timeout=require(_0x5b68('0x3'));var express=require(_0x5b68('0x4'));var router=express[_0x5b68('0x5')]();var fs_extra=require(_0x5b68('0x6'));var auth=require(_0x5b68('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsMessage.controller');router[_0x5b68('0x8')]('/',auth[_0x5b68('0x9')](),controller[_0x5b68('0xa')]);router[_0x5b68('0x8')](_0x5b68('0xb'),auth[_0x5b68('0x9')](),controller[_0x5b68('0xc')]);router[_0x5b68('0x8')](_0x5b68('0xd'),auth[_0x5b68('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),interaction[_0x5b68('0xe')](_0x5b68('0xf'),'smsmessage:create'),controller['create']);router[_0x5b68('0x10')](_0x5b68('0x11'),controller[_0x5b68('0x12')]);router[_0x5b68('0x13')](_0x5b68('0xd'),auth['isAuthenticated'](),controller[_0x5b68('0x14')]);router[_0x5b68('0x13')](_0x5b68('0x15'),auth[_0x5b68('0x9')](),controller[_0x5b68('0x16')]);router[_0x5b68('0x13')](_0x5b68('0x17'),auth['isAuthenticated'](),controller['reject']);router[_0x5b68('0x18')](_0x5b68('0xd'),auth[_0x5b68('0x9')](),controller[_0x5b68('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 7a73092..8cdc03b 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 _0xbee7=['ENUM','out','DATE','STRING','sequelize','TEXT','BOOLEAN'];(function(_0x553f8e,_0x4b0082){var _0x82af0e=function(_0x45de10){while(--_0x45de10){_0x553f8e['push'](_0x553f8e['shift']());}};_0x82af0e(++_0x4b0082);}(_0xbee7,0x1b6));var _0x7bee=function(_0x514a7f,_0x55171d){_0x514a7f=_0x514a7f-0x0;var _0x38d6c5=_0xbee7[_0x514a7f];return _0x38d6c5;};'use strict';var Sequelize=require(_0x7bee('0x0'));module['exports']={'body':{'type':Sequelize[_0x7bee('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x7bee('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7bee('0x3')]('in',_0x7bee('0x4')),'defaultValue':_0x7bee('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x7bee('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x7bee('0x6')]},'providerResponse':{'type':Sequelize[_0x7bee('0x1')]}}; \ No newline at end of file +var _0xf4e1=['BOOLEAN','sequelize','exports','TEXT','medium','out','STRING'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf4e1,0x17b));var _0x1f4e=function(_0xc1389e,_0xe9d812){_0xc1389e=_0xc1389e-0x0;var _0x16d7d9=_0xf4e1[_0xc1389e];return _0x16d7d9;};'use strict';var Sequelize=require(_0x1f4e('0x0'));module[_0x1f4e('0x1')]={'body':{'type':Sequelize[_0x1f4e('0x2')](_0x1f4e('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x1f4e('0x4')),'defaultValue':_0x1f4e('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1f4e('0x5')](0xbe)},'phone':{'type':Sequelize[_0x1f4e('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x1f4e('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1f4e('0x5')]},'providerResponse':{'type':Sequelize[_0x1f4e('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index dd6dea2..979337d 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 _0xaee6=['squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','client','http','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL','merge','SmsMessage','includeAll','include','findAll','rows','show','params','options','find','create','body','describe','sms-interactions','accept','sms','readAt','format','UserId','user','agent','CmContact','get','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','info','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','role','RejectMessage','rejectMessage','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','indexOf','sent','delivered','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','DELIVERED','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x1d7300,_0x17f109){var _0x46ee98=function(_0x5ee16a){while(--_0x5ee16a){_0x1d7300['push'](_0x1d7300['shift']());}};_0x46ee98(++_0x17f109);}(_0xaee6,0x187));var _0x6aee=function(_0x42eeb8,_0x42a9e2){_0x42eeb8=_0x42eeb8-0x0;var _0x1f18a1=_0xaee6[_0x42eeb8];return _0x1f18a1;};'use strict';var pdf=require(_0x6aee('0x0'));var emlformat=require(_0x6aee('0x1'));var rimraf=require(_0x6aee('0x2'));var zipdir=require(_0x6aee('0x3'));var jsonpatch=require(_0x6aee('0x4'));var rp=require(_0x6aee('0x5'));var moment=require('moment');var BPromise=require(_0x6aee('0x6'));var Mustache=require(_0x6aee('0x7'));var util=require(_0x6aee('0x8'));var path=require('path');var sox=require(_0x6aee('0x9'));var csv=require(_0x6aee('0xa'));var ejs=require(_0x6aee('0xb'));var fs=require('fs');var fs_extra=require(_0x6aee('0xc'));var _=require(_0x6aee('0xd'));var squel=require(_0x6aee('0xe'));var crypto=require(_0x6aee('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6aee('0xa'));var querystring=require('querystring');var Papa=require(_0x6aee('0x10'));var Redis=require(_0x6aee('0x11'));var authService=require(_0x6aee('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6aee('0x13'));var hardwareService=require(_0x6aee('0x14'));var logger=require(_0x6aee('0x15'))(_0x6aee('0x16'));var utils=require('../../config/utils');var config=require(_0x6aee('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6aee('0x18'))['db'];config[_0x6aee('0x19')]=_[_0x6aee('0x1a')](config[_0x6aee('0x19')],{'host':_0x6aee('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6aee('0x19')]));require(_0x6aee('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x6aee('0x1d')][_0x6aee('0x1e')]({'port':0x232c});var client9002=jayson[_0x6aee('0x1d')][_0x6aee('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x16cc61,_0x257c0b,_0x1c0235,_0x2d84c0){return new BPromise(function(_0x5cc0b0,_0x124794){var _0x2d89f7=_0x2d84c0||client;return _0x2d89f7['request'](_0x16cc61,_0x1c0235)[_0x6aee('0x1f')](function(_0x29f71c){logger['info'](_0x6aee('0x20'),_0x257c0b,_0x6aee('0x21'));logger[_0x6aee('0x22')](_0x6aee('0x23'),_0x257c0b,_0x6aee('0x21'),JSON[_0x6aee('0x24')](_0x29f71c));if(_0x29f71c[_0x6aee('0x25')]){if(_0x29f71c['error'][_0x6aee('0x26')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x257c0b,_0x29f71c[_0x6aee('0x25')][_0x6aee('0x27')]);return _0x124794(_0x29f71c[_0x6aee('0x25')][_0x6aee('0x27')]);}logger[_0x6aee('0x25')](_0x6aee('0x20'),_0x257c0b,_0x29f71c[_0x6aee('0x25')][_0x6aee('0x27')]);return _0x5cc0b0(_0x29f71c['error'][_0x6aee('0x27')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x257c0b,_0x6aee('0x21'));_0x5cc0b0(_0x29f71c[_0x6aee('0x28')]['message']);}})[_0x6aee('0x29')](function(_0x166dcd){logger['error'](_0x6aee('0x20'),_0x257c0b,_0x166dcd);_0x124794(_0x166dcd);});});}function respondWithStatusCode(_0x43f0bb,_0x1c110c){_0x1c110c=_0x1c110c||0xcc;return function(_0x1f1b19){if(_0x1f1b19){return _0x43f0bb[_0x6aee('0x2a')](_0x1c110c);}return _0x43f0bb[_0x6aee('0x2b')](_0x1c110c)[_0x6aee('0x2c')]();};}function respondWithResult(_0x34f448,_0x34034a){_0x34034a=_0x34034a||0xc8;return function(_0x1916b7){if(_0x1916b7){return _0x34f448[_0x6aee('0x2b')](_0x34034a)[_0x6aee('0x2d')](_0x1916b7);}};}function respondWithFilteredResult(_0x3d06bb,_0x7327d4){return function(_0x15e0db){if(_0x15e0db){var _0x2fc285=_0x15e0db[_0x6aee('0x2e')],_0x52244f=_0x7327d4[_0x6aee('0x2f')],_0x4b9744=_0x7327d4[_0x6aee('0x2f')]+_0x7327d4['limit'],_0xe7f369;if(_0x4b9744>=_0x2fc285){_0x4b9744=_0x2fc285;_0xe7f369=0xc8;}else{_0xe7f369=0xce;}_0x3d06bb[_0x6aee('0x2b')](_0xe7f369);return _0x3d06bb['set'](_0x6aee('0x30'),_0x52244f+'-'+_0x4b9744+'/'+_0x2fc285)[_0x6aee('0x2d')](_0x15e0db);}return null;};}function patchUpdates(_0x136978){return function(_0xdd57b7){try{jsonpatch[_0x6aee('0x31')](_0xdd57b7,_0x136978,!![]);}catch(_0x233b94){return BPromise[_0x6aee('0x32')](_0x233b94);}return _0xdd57b7[_0x6aee('0x33')]();};}function saveUpdates(_0x349780,_0x17113b){return function(_0x3b86bd){if(_0x3b86bd){return _0x3b86bd[_0x6aee('0x34')](_0x349780)[_0x6aee('0x1f')](function(_0x57bed3){return _0x57bed3;});}return null;};}function removeEntity(_0x348405,_0xce7a31){return function(_0x32fa12){if(_0x32fa12){return _0x32fa12[_0x6aee('0x35')]()[_0x6aee('0x1f')](function(){_0x348405[_0x6aee('0x2b')](0xcc)[_0x6aee('0x2c')]();});}};}function handleEntityNotFound(_0x1c9f46,_0x4e43b2){return function(_0x2eee51){if(!_0x2eee51){_0x1c9f46[_0x6aee('0x2a')](0x194);}return _0x2eee51;};}function handleError(_0x741f9f,_0x2b21e2){_0x2b21e2=_0x2b21e2||0x1f4;return function(_0x2d964e){logger[_0x6aee('0x25')](_0x2d964e[_0x6aee('0x36')]);if(_0x2d964e[_0x6aee('0x37')]){delete _0x2d964e[_0x6aee('0x37')];}_0x741f9f[_0x6aee('0x2b')](_0x2b21e2)[_0x6aee('0x38')](_0x2d964e);};}exports['index']=function(_0x4d1252,_0x3478a2){var _0x5b8e7d={},_0x59b840={},_0x387c58={'count':0x0,'rows':[]};var _0x37b2cd=_[_0x6aee('0x39')](db['SmsMessage'][_0x6aee('0x3a')],function(_0x4450c3){return{'name':_0x4450c3[_0x6aee('0x3b')],'type':_0x4450c3[_0x6aee('0x3c')]['key']};});_0x59b840[_0x6aee('0x3d')]=_[_0x6aee('0x39')](_0x37b2cd,_0x6aee('0x37'));_0x59b840[_0x6aee('0x3e')]=_[_0x6aee('0x3f')](_0x4d1252['query']);_0x59b840[_0x6aee('0x40')]=_[_0x6aee('0x41')](_0x59b840[_0x6aee('0x3d')],_0x59b840[_0x6aee('0x3e')]);_0x5b8e7d[_0x6aee('0x42')]=_['intersection'](_0x59b840[_0x6aee('0x3d')],qs['fields'](_0x4d1252[_0x6aee('0x3e')][_0x6aee('0x43')]));_0x5b8e7d[_0x6aee('0x42')]=_0x5b8e7d[_0x6aee('0x42')][_0x6aee('0x44')]?_0x5b8e7d[_0x6aee('0x42')]:_0x59b840['model'];if(!_0x4d1252['query'][_0x6aee('0x45')]('nolimit')){_0x5b8e7d[_0x6aee('0x46')]=qs[_0x6aee('0x46')](_0x4d1252[_0x6aee('0x3e')][_0x6aee('0x46')]);_0x5b8e7d['offset']=qs[_0x6aee('0x2f')](_0x4d1252['query'][_0x6aee('0x2f')]);}_0x5b8e7d['order']=qs[_0x6aee('0x47')](_0x4d1252[_0x6aee('0x3e')][_0x6aee('0x47')]);_0x5b8e7d[_0x6aee('0x48')]=qs[_0x6aee('0x40')](_[_0x6aee('0x49')](_0x4d1252[_0x6aee('0x3e')],_0x59b840[_0x6aee('0x40')]),_0x37b2cd);if(_0x4d1252['query'][_0x6aee('0x4a')]){_0x5b8e7d[_0x6aee('0x48')]=_['merge'](_0x5b8e7d['where'],{'$or':_[_0x6aee('0x39')](_0x37b2cd,function(_0x39cfb5){if(_0x39cfb5['type']!==_0x6aee('0x4b')){var _0x5cae7c={};_0x5cae7c[_0x39cfb5[_0x6aee('0x37')]]={'$like':'%'+_0x4d1252[_0x6aee('0x3e')][_0x6aee('0x4a')]+'%'};return _0x5cae7c;}})});}_0x5b8e7d=_[_0x6aee('0x4c')]({},_0x5b8e7d,_0x4d1252['options']);var _0x4f5218={'where':_0x5b8e7d[_0x6aee('0x48')]};return db[_0x6aee('0x4d')][_0x6aee('0x2e')](_0x4f5218)[_0x6aee('0x1f')](function(_0x48b373){_0x387c58[_0x6aee('0x2e')]=_0x48b373;if(_0x4d1252['query'][_0x6aee('0x4e')]){_0x5b8e7d[_0x6aee('0x4f')]=[{'all':!![]}];}return db[_0x6aee('0x4d')][_0x6aee('0x50')](_0x5b8e7d);})['then'](function(_0x414328){_0x387c58[_0x6aee('0x51')]=_0x414328;return _0x387c58;})[_0x6aee('0x1f')](respondWithFilteredResult(_0x3478a2,_0x5b8e7d))[_0x6aee('0x29')](handleError(_0x3478a2,null));};exports[_0x6aee('0x52')]=function(_0x293aea,_0x229b2f){var _0x452e69={'raw':!![],'where':{'id':_0x293aea[_0x6aee('0x53')]['id']}},_0x56004e={};_0x56004e[_0x6aee('0x3d')]=_['keys'](db[_0x6aee('0x4d')][_0x6aee('0x3a')]);_0x56004e[_0x6aee('0x3e')]=_[_0x6aee('0x3f')](_0x293aea['query']);_0x56004e['filters']=_[_0x6aee('0x41')](_0x56004e[_0x6aee('0x3d')],_0x56004e[_0x6aee('0x3e')]);_0x452e69[_0x6aee('0x42')]=_['intersection'](_0x56004e[_0x6aee('0x3d')],qs['fields'](_0x293aea[_0x6aee('0x3e')]['fields']));_0x452e69[_0x6aee('0x42')]=_0x452e69[_0x6aee('0x42')][_0x6aee('0x44')]?_0x452e69[_0x6aee('0x42')]:_0x56004e[_0x6aee('0x3d')];if(_0x293aea[_0x6aee('0x3e')][_0x6aee('0x4e')]){_0x452e69[_0x6aee('0x4f')]=[{'all':!![]}];}_0x452e69=_[_0x6aee('0x4c')]({},_0x452e69,_0x293aea[_0x6aee('0x54')]);return db['SmsMessage'][_0x6aee('0x55')](_0x452e69)[_0x6aee('0x1f')](handleEntityNotFound(_0x229b2f,null))[_0x6aee('0x1f')](respondWithResult(_0x229b2f,null))[_0x6aee('0x29')](handleError(_0x229b2f,null));};exports['create']=function(_0x4e0c40,_0x3df9c6){return db['SmsMessage'][_0x6aee('0x56')](_0x4e0c40['body'],{})[_0x6aee('0x1f')](respondWithResult(_0x3df9c6,0xc9))[_0x6aee('0x29')](handleError(_0x3df9c6,null));};exports[_0x6aee('0x34')]=function(_0x5d9d7b,_0x57a52b){if(_0x5d9d7b[_0x6aee('0x57')]['id']){delete _0x5d9d7b['body']['id'];}return db['SmsMessage'][_0x6aee('0x55')]({'where':{'id':_0x5d9d7b[_0x6aee('0x53')]['id']}})[_0x6aee('0x1f')](handleEntityNotFound(_0x57a52b,null))[_0x6aee('0x1f')](saveUpdates(_0x5d9d7b[_0x6aee('0x57')],null))[_0x6aee('0x1f')](respondWithResult(_0x57a52b,null))[_0x6aee('0x29')](handleError(_0x57a52b,null));};exports[_0x6aee('0x35')]=function(_0x466bfd,_0x545cb2){return db[_0x6aee('0x4d')][_0x6aee('0x55')]({'where':{'id':_0x466bfd[_0x6aee('0x53')]['id']}})[_0x6aee('0x1f')](handleEntityNotFound(_0x545cb2,null))[_0x6aee('0x1f')](removeEntity(_0x545cb2,null))[_0x6aee('0x29')](handleError(_0x545cb2,null));};exports[_0x6aee('0x58')]=function(_0xc8fd4e,_0x1751e4){return db[_0x6aee('0x4d')][_0x6aee('0x58')]()['then'](respondWithResult(_0x1751e4,null))[_0x6aee('0x29')](handleError(_0x1751e4,null));};var interaction_log=require(_0x6aee('0x15'))(_0x6aee('0x59'));exports[_0x6aee('0x5a')]=function(_0x24586b,_0x238890,_0x1e1482){var _0xbd8036={'agent':{},'channel':_0x6aee('0x5b')};if(_0x24586b[_0x6aee('0x57')]['id']){delete _0x24586b[_0x6aee('0x57')]['id'];}_0x24586b[_0x6aee('0x57')]['read']=!![];_0x24586b['body'][_0x6aee('0x5c')]=moment()[_0x6aee('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x24586b[_0x6aee('0x57')][_0x6aee('0x5e')]=_0x24586b[_0x6aee('0x57')][_0x6aee('0x5e')]||_0x24586b[_0x6aee('0x5f')]['id'];_0xbd8036[_0x6aee('0x60')]['id']=_0x24586b['body']['UserId'];return db[_0x6aee('0x4d')][_0x6aee('0x55')]({'where':{'id':_0x24586b[_0x6aee('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x6aee('0x61')],'as':'Contact'}]})[_0x6aee('0x1f')](handleEntityNotFound(_0x238890,null))[_0x6aee('0x1f')](saveUpdates(_0x24586b[_0x6aee('0x57')],null))[_0x6aee('0x1f')](function(_0x44ce45){if(_0x44ce45){_0xbd8036[_0x6aee('0x27')]=_0x44ce45[_0x6aee('0x62')]({'plain':!![]});return db['SmsInteraction'][_0x6aee('0x55')]({'where':{'id':_0x44ce45[_0x6aee('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x238890,null))[_0x6aee('0x1f')](function(_0x111d4b){if(_0x111d4b){return _0x111d4b[_0x6aee('0x34')]({'UserId':_0x24586b['body'][_0x6aee('0x5e')],'read1stAt':_[_0x6aee('0x64')](_0x111d4b[_0x6aee('0x65')])?moment()[_0x6aee('0x5d')](_0x6aee('0x66')):undefined});}return null;})[_0x6aee('0x1f')](function(_0x26e464){if(_0x26e464){_0xbd8036[_0x6aee('0x67')]=_0x26e464[_0x6aee('0x62')]({'plain':!![]});interaction_log[_0x6aee('0x68')](_0x6aee('0x69'),_0x24586b[_0x6aee('0x5f')]['id'],_0x24586b[_0x6aee('0x5f')][_0x6aee('0x37')],_0x24586b[_0x6aee('0x5f')]['role'],_0xbd8036[_0x6aee('0x67')]['id'],_0x24586b['body']?JSON[_0x6aee('0x24')](_0x24586b[_0x6aee('0x57')]):'null');return respondWithRpcPromise(_0x6aee('0x6a'),_0x6aee('0x6b'),_0xbd8036);}return null;})[_0x6aee('0x1f')](function(_0x37623f){if(_0x37623f){if(_0x24586b[_0x6aee('0x57')][_0x6aee('0x6c')]){_0xbd8036[_0x6aee('0x27')][_0x6aee('0x6d')]=util['format'](_0x6aee('0x6e'),_0x24586b[_0x6aee('0x5f')][_0x6aee('0x37')]);_0xbd8036[_0x6aee('0x27')]['channel']=_0xbd8036[_0x6aee('0x6f')];_0xbd8036['message'][_0x6aee('0x70')]=_0x6aee('0x5a');return respondWithRpcPromise(_0x6aee('0x71'),'EventManager',{'event':_0x6aee('0x72'),'message':_0xbd8036[_0x6aee('0x27')]},client9002)[_0x6aee('0x1f')](function(){return _0xbd8036;});}return _0xbd8036;}return null;})[_0x6aee('0x1f')](respondWithResult(_0x238890,null))[_0x6aee('0x29')](handleError(_0x238890,null));};var interaction_log=require(_0x6aee('0x15'))(_0x6aee('0x59'));exports['reject']=function(_0x2a42ba,_0x54c445,_0x3728b7){var _0x963961={'agent':{},'channel':_0x6aee('0x5b')};if(_0x2a42ba['body']['id']){delete _0x2a42ba['body']['id'];}_0x2a42ba[_0x6aee('0x57')][_0x6aee('0x5e')]=_0x2a42ba[_0x6aee('0x57')][_0x6aee('0x5e')]||_0x2a42ba['user']['id'];_0x963961[_0x6aee('0x60')]['id']=_0x2a42ba[_0x6aee('0x57')]['UserId'];return db[_0x6aee('0x4d')][_0x6aee('0x55')]({'where':{'id':_0x2a42ba[_0x6aee('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x54c445,null))['then'](function(_0x9c123d){if(_0x9c123d){_0x963961[_0x6aee('0x27')]=_0x9c123d[_0x6aee('0x62')]({'plain':!![]});return db['SmsInteraction'][_0x6aee('0x55')]({'where':{'id':_0x9c123d[_0x6aee('0x63')]}});}return null;})[_0x6aee('0x1f')](handleEntityNotFound(_0x54c445,null))[_0x6aee('0x1f')](function(_0x4e0544){if(_0x4e0544){_0x963961[_0x6aee('0x67')]=_0x4e0544[_0x6aee('0x62')]({'plain':!![]});interaction_log[_0x6aee('0x68')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2a42ba[_0x6aee('0x5f')]['id'],_0x2a42ba[_0x6aee('0x5f')]['name'],_0x2a42ba['user'][_0x6aee('0x73')],_0x963961['interaction']['id'],_0x2a42ba[_0x6aee('0x57')]?JSON['stringify'](_0x2a42ba[_0x6aee('0x57')]):'null');return respondWithRpcPromise(_0x6aee('0x74'),_0x6aee('0x75'),_0x963961);}return null;})[_0x6aee('0x1f')](function(_0x3c36d9){if(_0x3c36d9){_0x3c36d9[_0x6aee('0x27')][_0x6aee('0x6d')]=util[_0x6aee('0x5d')](_0x6aee('0x6e'),_0x2a42ba['user'][_0x6aee('0x37')]);_0x3c36d9['message'][_0x6aee('0x6f')]=_0x963961[_0x6aee('0x6f')];_0x3c36d9[_0x6aee('0x27')][_0x6aee('0x70')]='reject';respondWithRpcPromise('EventManager',_0x6aee('0x71'),{'event':_0x6aee('0x76'),'message':_0x3c36d9[_0x6aee('0x27')]},client9002);return _0x963961;}return null;})[_0x6aee('0x1f')](respondWithResult(_0x54c445,null))[_0x6aee('0x29')](handleError(_0x54c445,null));};exports[_0x6aee('0x2b')]=function(_0x118d04,_0x3cb9bb,_0x559e54){if(_0x118d04[_0x6aee('0x57')]['id']){delete _0x118d04[_0x6aee('0x57')]['id'];}var _0x31d57c;return db[_0x6aee('0x4d')]['find']({'where':{'id':_0x118d04['params']['id']}})[_0x6aee('0x1f')](handleEntityNotFound(_0x3cb9bb,null))['then'](function(_0x5aee20){if(_0x5aee20){_0x31d57c=_0x5aee20;return db[_0x6aee('0x77')][_0x6aee('0x55')]({'where':{'id':_0x5aee20['SmsAccountId']}});}})[_0x6aee('0x1f')](handleEntityNotFound(_0x3cb9bb,null))['then'](function(_0x30591a){if(_0x30591a){logger[_0x6aee('0x22')](_0x6aee('0x23'),_0x6aee('0x2b'),_0x6aee('0x78'),_0x30591a['type'],util[_0x6aee('0x79')](_0x118d04[_0x6aee('0x57')],{'showHidden':![],'depth':null}));switch(_0x30591a['type']){case _0x6aee('0x7a'):if(_0x118d04[_0x6aee('0x57')][_0x6aee('0x7b')]&&_0x118d04[_0x6aee('0x57')][_0x6aee('0x7b')]===_0x31d57c[_0x6aee('0x7c')]){return _0x31d57c[_0x6aee('0x34')]({'read':!![]});}else{logger[_0x6aee('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6aee('0x2b'),_0x6aee('0x7a'),util['inspect'](_0x118d04['body'],{'showHidden':![],'depth':null}));}break;case _0x6aee('0x7d'):if(_0x118d04[_0x6aee('0x57')][_0x6aee('0x7e')]&&_0x118d04[_0x6aee('0x57')][_0x6aee('0x7e')]===_0x31d57c[_0x6aee('0x7c')]&&_[_0x6aee('0x7f')]([_0x6aee('0x80'),_0x6aee('0x81')],_0x118d04[_0x6aee('0x57')]['Status'])>=0x0){return _0x31d57c['update']({'read':!![]});}else{logger[_0x6aee('0x25')](_0x6aee('0x82'),_0x6aee('0x2b'),_0x6aee('0x83'),util[_0x6aee('0x79')](_0x118d04['body'],{'showHidden':![],'depth':null}));}break;case _0x6aee('0x84'):var _0x540ed9=_0x118d04[_0x6aee('0x57')][_0x6aee('0x85')][0x0];if(_0x540ed9[_0x6aee('0x2b')]['groupName']===_0x6aee('0x86')){return _0x31d57c['update']({'read':!![]});}else{logger[_0x6aee('0x25')](_0x6aee('0x82'),_0x6aee('0x2b'),_0x6aee('0x84'),util['inspect'](_0x118d04[_0x6aee('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x31d57c;}})[_0x6aee('0x1f')](respondWithResult(_0x3cb9bb,null))[_0x6aee('0x29')](handleError(_0x3cb9bb,null));}; \ No newline at end of file +var _0x5e11=['acceptmessage','reject','RejectMessage','rejectMessage','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','type','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','register','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','count','limit','apply','save','end','stack','name','map','SmsMessage','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','pick','VIRTUAL','filter','merge','findAll','rows','catch','show','params','options','find','create','body','destroy','describe','sms-interactions','accept','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','CmContact','Contact','SmsInteractionId','update','isNil','read1stAt','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','interaction','null','AcceptMessage','acceptMessage','manual','interface','format','SIP/%s','channel','event','EventManager'];(function(_0x531ef1,_0x53c97e){var _0x50dd44=function(_0x8c82b4){while(--_0x8c82b4){_0x531ef1['push'](_0x531ef1['shift']());}};_0x50dd44(++_0x53c97e);}(_0x5e11,0x1c3));var _0x15e1=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0x5e11[_0x4eafed];return _0x159c85;};'use strict';var pdf=require(_0x15e1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x15e1('0x1'));var zipdir=require(_0x15e1('0x2'));var jsonpatch=require(_0x15e1('0x3'));var rp=require(_0x15e1('0x4'));var moment=require(_0x15e1('0x5'));var BPromise=require(_0x15e1('0x6'));var Mustache=require('mustache');var util=require(_0x15e1('0x7'));var path=require('path');var sox=require(_0x15e1('0x8'));var csv=require(_0x15e1('0x9'));var ejs=require(_0x15e1('0xa'));var fs=require('fs');var fs_extra=require(_0x15e1('0xb'));var _=require(_0x15e1('0xc'));var squel=require('squel');var crypto=require(_0x15e1('0xd'));var jsforce=require(_0x15e1('0xe'));var deskjs=require(_0x15e1('0xf'));var toCsv=require(_0x15e1('0x9'));var querystring=require('querystring');var Papa=require(_0x15e1('0x10'));var Redis=require(_0x15e1('0x11'));var authService=require(_0x15e1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x15e1('0x13'));var hardwareService=require(_0x15e1('0x14'));var logger=require(_0x15e1('0x15'))(_0x15e1('0x16'));var utils=require(_0x15e1('0x17'));var config=require(_0x15e1('0x18'));var licenseUtil=require(_0x15e1('0x19'));var db=require(_0x15e1('0x1a'))['db'];config[_0x15e1('0x1b')]=_[_0x15e1('0x1c')](config[_0x15e1('0x1b')],{'host':_0x15e1('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x15e1('0x1b')]));require(_0x15e1('0x1e'))[_0x15e1('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x15e1('0x20')][_0x15e1('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x15e1('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xa1ba90,_0x36f758,_0x448d59,_0x36d214){return new BPromise(function(_0x14cd54,_0x376500){var _0x32008a=_0x36d214||client;return _0x32008a[_0x15e1('0x22')](_0xa1ba90,_0x448d59)[_0x15e1('0x23')](function(_0x440c73){logger[_0x15e1('0x24')](_0x15e1('0x25'),_0x36f758,_0x15e1('0x26'));logger[_0x15e1('0x27')](_0x15e1('0x28'),_0x36f758,'request\x20sent',JSON[_0x15e1('0x29')](_0x440c73));if(_0x440c73[_0x15e1('0x2a')]){if(_0x440c73['error'][_0x15e1('0x2b')]===0x1f4){logger[_0x15e1('0x2a')](_0x15e1('0x25'),_0x36f758,_0x440c73[_0x15e1('0x2a')]['message']);return _0x376500(_0x440c73['error'][_0x15e1('0x2c')]);}logger[_0x15e1('0x2a')](_0x15e1('0x25'),_0x36f758,_0x440c73[_0x15e1('0x2a')][_0x15e1('0x2c')]);return _0x14cd54(_0x440c73[_0x15e1('0x2a')][_0x15e1('0x2c')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x36f758,_0x15e1('0x26'));_0x14cd54(_0x440c73[_0x15e1('0x2d')]['message']);}})['catch'](function(_0x3d0f0f){logger[_0x15e1('0x2a')]('SmsMessage,\x20%s,\x20%s',_0x36f758,_0x3d0f0f);_0x376500(_0x3d0f0f);});});}function respondWithStatusCode(_0x477ff1,_0x1c8538){_0x1c8538=_0x1c8538||0xcc;return function(_0x21d188){if(_0x21d188){return _0x477ff1[_0x15e1('0x2e')](_0x1c8538);}return _0x477ff1[_0x15e1('0x2f')](_0x1c8538)['end']();};}function respondWithResult(_0x506af2,_0x4c14c3){_0x4c14c3=_0x4c14c3||0xc8;return function(_0x30353f){if(_0x30353f){return _0x506af2['status'](_0x4c14c3)[_0x15e1('0x30')](_0x30353f);}};}function respondWithFilteredResult(_0x23664b,_0x201b53){return function(_0x16c14e){if(_0x16c14e){var _0x40f5ef=_0x16c14e[_0x15e1('0x31')],_0x4e1dcf=_0x201b53['offset'],_0x29f2a7=_0x201b53['offset']+_0x201b53[_0x15e1('0x32')],_0x55513b;if(_0x29f2a7>=_0x40f5ef){_0x29f2a7=_0x40f5ef;_0x55513b=0xc8;}else{_0x55513b=0xce;}_0x23664b['status'](_0x55513b);return _0x23664b['set']('Content-Range',_0x4e1dcf+'-'+_0x29f2a7+'/'+_0x40f5ef)[_0x15e1('0x30')](_0x16c14e);}return null;};}function patchUpdates(_0x31aa27){return function(_0x523cc3){try{jsonpatch[_0x15e1('0x33')](_0x523cc3,_0x31aa27,!![]);}catch(_0x37a5f7){return BPromise['reject'](_0x37a5f7);}return _0x523cc3[_0x15e1('0x34')]();};}function saveUpdates(_0x159299,_0x45736d){return function(_0xcfdd11){if(_0xcfdd11){return _0xcfdd11['update'](_0x159299)[_0x15e1('0x23')](function(_0x40a779){return _0x40a779;});}return null;};}function removeEntity(_0x53499b,_0x51a55d){return function(_0x109fb0){if(_0x109fb0){return _0x109fb0['destroy']()['then'](function(){_0x53499b['status'](0xcc)[_0x15e1('0x35')]();});}};}function handleEntityNotFound(_0x13cb61,_0x97f7ff){return function(_0x2bab56){if(!_0x2bab56){_0x13cb61[_0x15e1('0x2e')](0x194);}return _0x2bab56;};}function handleError(_0x348acd,_0x3829c9){_0x3829c9=_0x3829c9||0x1f4;return function(_0x4fc7f5){logger[_0x15e1('0x2a')](_0x4fc7f5[_0x15e1('0x36')]);if(_0x4fc7f5[_0x15e1('0x37')]){delete _0x4fc7f5[_0x15e1('0x37')];}_0x348acd['status'](_0x3829c9)['send'](_0x4fc7f5);};}exports['index']=function(_0x32f4d0,_0x5e583e){var _0x33fb4e={},_0x4c457b={},_0x5b30a2={'count':0x0,'rows':[]};var _0x3a163e=_[_0x15e1('0x38')](db[_0x15e1('0x39')][_0x15e1('0x3a')],function(_0x358bd9){return{'name':_0x358bd9[_0x15e1('0x3b')],'type':_0x358bd9['type'][_0x15e1('0x3c')]};});_0x4c457b[_0x15e1('0x3d')]=_['map'](_0x3a163e,'name');_0x4c457b['query']=_[_0x15e1('0x3e')](_0x32f4d0[_0x15e1('0x3f')]);_0x4c457b[_0x15e1('0x40')]=_[_0x15e1('0x41')](_0x4c457b[_0x15e1('0x3d')],_0x4c457b[_0x15e1('0x3f')]);_0x33fb4e[_0x15e1('0x42')]=_['intersection'](_0x4c457b[_0x15e1('0x3d')],qs[_0x15e1('0x43')](_0x32f4d0[_0x15e1('0x3f')]['fields']));_0x33fb4e[_0x15e1('0x42')]=_0x33fb4e[_0x15e1('0x42')][_0x15e1('0x44')]?_0x33fb4e[_0x15e1('0x42')]:_0x4c457b[_0x15e1('0x3d')];if(!_0x32f4d0[_0x15e1('0x3f')]['hasOwnProperty'](_0x15e1('0x45'))){_0x33fb4e['limit']=qs['limit'](_0x32f4d0[_0x15e1('0x3f')]['limit']);_0x33fb4e[_0x15e1('0x46')]=qs[_0x15e1('0x46')](_0x32f4d0[_0x15e1('0x3f')]['offset']);}_0x33fb4e[_0x15e1('0x47')]=qs[_0x15e1('0x48')](_0x32f4d0[_0x15e1('0x3f')][_0x15e1('0x48')]);_0x33fb4e[_0x15e1('0x49')]=qs[_0x15e1('0x40')](_[_0x15e1('0x4a')](_0x32f4d0['query'],_0x4c457b[_0x15e1('0x40')]),_0x3a163e);if(_0x32f4d0[_0x15e1('0x3f')]['filter']){_0x33fb4e[_0x15e1('0x49')]=_['merge'](_0x33fb4e[_0x15e1('0x49')],{'$or':_[_0x15e1('0x38')](_0x3a163e,function(_0x36c5c4){if(_0x36c5c4['type']!==_0x15e1('0x4b')){var _0x4fe14c={};_0x4fe14c[_0x36c5c4[_0x15e1('0x37')]]={'$like':'%'+_0x32f4d0[_0x15e1('0x3f')][_0x15e1('0x4c')]+'%'};return _0x4fe14c;}})});}_0x33fb4e=_[_0x15e1('0x4d')]({},_0x33fb4e,_0x32f4d0['options']);var _0x2f0600={'where':_0x33fb4e[_0x15e1('0x49')]};return db[_0x15e1('0x39')][_0x15e1('0x31')](_0x2f0600)[_0x15e1('0x23')](function(_0x2bcd04){_0x5b30a2[_0x15e1('0x31')]=_0x2bcd04;if(_0x32f4d0[_0x15e1('0x3f')]['includeAll']){_0x33fb4e['include']=[{'all':!![]}];}return db[_0x15e1('0x39')][_0x15e1('0x4e')](_0x33fb4e);})[_0x15e1('0x23')](function(_0x8e7a1b){_0x5b30a2[_0x15e1('0x4f')]=_0x8e7a1b;return _0x5b30a2;})[_0x15e1('0x23')](respondWithFilteredResult(_0x5e583e,_0x33fb4e))[_0x15e1('0x50')](handleError(_0x5e583e,null));};exports[_0x15e1('0x51')]=function(_0x429a23,_0x2d958d){var _0x69474={'raw':!![],'where':{'id':_0x429a23[_0x15e1('0x52')]['id']}},_0x217062={};_0x217062['model']=_[_0x15e1('0x3e')](db[_0x15e1('0x39')]['rawAttributes']);_0x217062[_0x15e1('0x3f')]=_[_0x15e1('0x3e')](_0x429a23[_0x15e1('0x3f')]);_0x217062[_0x15e1('0x40')]=_['intersection'](_0x217062[_0x15e1('0x3d')],_0x217062[_0x15e1('0x3f')]);_0x69474[_0x15e1('0x42')]=_[_0x15e1('0x41')](_0x217062[_0x15e1('0x3d')],qs['fields'](_0x429a23[_0x15e1('0x3f')]['fields']));_0x69474[_0x15e1('0x42')]=_0x69474[_0x15e1('0x42')][_0x15e1('0x44')]?_0x69474[_0x15e1('0x42')]:_0x217062['model'];if(_0x429a23[_0x15e1('0x3f')]['includeAll']){_0x69474['include']=[{'all':!![]}];}_0x69474=_[_0x15e1('0x4d')]({},_0x69474,_0x429a23[_0x15e1('0x53')]);return db[_0x15e1('0x39')][_0x15e1('0x54')](_0x69474)[_0x15e1('0x23')](handleEntityNotFound(_0x2d958d,null))[_0x15e1('0x23')](respondWithResult(_0x2d958d,null))['catch'](handleError(_0x2d958d,null));};exports[_0x15e1('0x55')]=function(_0x70407d,_0x5cbc70){return db[_0x15e1('0x39')][_0x15e1('0x55')](_0x70407d[_0x15e1('0x56')],{})[_0x15e1('0x23')](respondWithResult(_0x5cbc70,0xc9))[_0x15e1('0x50')](handleError(_0x5cbc70,null));};exports['update']=function(_0x5035b3,_0xf60970){if(_0x5035b3[_0x15e1('0x56')]['id']){delete _0x5035b3[_0x15e1('0x56')]['id'];}return db[_0x15e1('0x39')][_0x15e1('0x54')]({'where':{'id':_0x5035b3[_0x15e1('0x52')]['id']}})[_0x15e1('0x23')](handleEntityNotFound(_0xf60970,null))['then'](saveUpdates(_0x5035b3[_0x15e1('0x56')],null))[_0x15e1('0x23')](respondWithResult(_0xf60970,null))['catch'](handleError(_0xf60970,null));};exports[_0x15e1('0x57')]=function(_0x41747a,_0x4f8605){return db[_0x15e1('0x39')][_0x15e1('0x54')]({'where':{'id':_0x41747a[_0x15e1('0x52')]['id']}})[_0x15e1('0x23')](handleEntityNotFound(_0x4f8605,null))[_0x15e1('0x23')](removeEntity(_0x4f8605,null))['catch'](handleError(_0x4f8605,null));};exports[_0x15e1('0x58')]=function(_0x4bb4ee,_0x2fb635){return db[_0x15e1('0x39')][_0x15e1('0x58')]()['then'](respondWithResult(_0x2fb635,null))[_0x15e1('0x50')](handleError(_0x2fb635,null));};var interaction_log=require(_0x15e1('0x15'))(_0x15e1('0x59'));exports[_0x15e1('0x5a')]=function(_0x31bc5f,_0x332f19,_0x779dd4){var _0x27a881={'agent':{},'channel':_0x15e1('0x5b')};if(_0x31bc5f[_0x15e1('0x56')]['id']){delete _0x31bc5f[_0x15e1('0x56')]['id'];}_0x31bc5f[_0x15e1('0x56')][_0x15e1('0x5c')]=!![];_0x31bc5f[_0x15e1('0x56')][_0x15e1('0x5d')]=moment()['format'](_0x15e1('0x5e'));_0x31bc5f['body'][_0x15e1('0x5f')]=_0x31bc5f[_0x15e1('0x56')][_0x15e1('0x5f')]||_0x31bc5f['user']['id'];_0x27a881[_0x15e1('0x60')]['id']=_0x31bc5f[_0x15e1('0x56')]['UserId'];return db['SmsMessage'][_0x15e1('0x54')]({'where':{'id':_0x31bc5f['params']['id'],'UserId':null},'include':[{'model':db[_0x15e1('0x61')],'as':_0x15e1('0x62')}]})[_0x15e1('0x23')](handleEntityNotFound(_0x332f19,null))['then'](saveUpdates(_0x31bc5f['body'],null))['then'](function(_0x5c3ff3){if(_0x5c3ff3){_0x27a881['message']=_0x5c3ff3['get']({'plain':!![]});return db['SmsInteraction'][_0x15e1('0x54')]({'where':{'id':_0x5c3ff3[_0x15e1('0x63')]}});}return null;})[_0x15e1('0x23')](handleEntityNotFound(_0x332f19,null))[_0x15e1('0x23')](function(_0x544e56){if(_0x544e56){return _0x544e56[_0x15e1('0x64')]({'UserId':_0x31bc5f[_0x15e1('0x56')][_0x15e1('0x5f')],'read1stAt':_[_0x15e1('0x65')](_0x544e56[_0x15e1('0x66')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x15e1('0x23')](function(_0x3bdb2b){if(_0x3bdb2b){_0x27a881['interaction']=_0x3bdb2b[_0x15e1('0x67')]({'plain':!![]});interaction_log[_0x15e1('0x24')](_0x15e1('0x68'),_0x31bc5f[_0x15e1('0x69')]['id'],_0x31bc5f[_0x15e1('0x69')][_0x15e1('0x37')],_0x31bc5f['user']['role'],_0x27a881[_0x15e1('0x6a')]['id'],_0x31bc5f[_0x15e1('0x56')]?JSON[_0x15e1('0x29')](_0x31bc5f[_0x15e1('0x56')]):_0x15e1('0x6b'));return respondWithRpcPromise(_0x15e1('0x6c'),_0x15e1('0x6d'),_0x27a881);}return null;})[_0x15e1('0x23')](function(_0x3b560a){if(_0x3b560a){if(_0x31bc5f[_0x15e1('0x56')][_0x15e1('0x6e')]){_0x27a881[_0x15e1('0x2c')][_0x15e1('0x6f')]=util[_0x15e1('0x70')](_0x15e1('0x71'),_0x31bc5f[_0x15e1('0x69')]['name']);_0x27a881[_0x15e1('0x2c')]['channel']=_0x27a881[_0x15e1('0x72')];_0x27a881[_0x15e1('0x2c')][_0x15e1('0x73')]='accept';return respondWithRpcPromise('EventManager',_0x15e1('0x74'),{'event':_0x15e1('0x75'),'message':_0x27a881[_0x15e1('0x2c')]},client9002)[_0x15e1('0x23')](function(){return _0x27a881;});}return _0x27a881;}return null;})[_0x15e1('0x23')](respondWithResult(_0x332f19,null))['catch'](handleError(_0x332f19,null));};var interaction_log=require(_0x15e1('0x15'))(_0x15e1('0x59'));exports[_0x15e1('0x76')]=function(_0x313e86,_0x29c758,_0x411e6d){var _0x4551bb={'agent':{},'channel':_0x15e1('0x5b')};if(_0x313e86[_0x15e1('0x56')]['id']){delete _0x313e86[_0x15e1('0x56')]['id'];}_0x313e86[_0x15e1('0x56')][_0x15e1('0x5f')]=_0x313e86[_0x15e1('0x56')][_0x15e1('0x5f')]||_0x313e86[_0x15e1('0x69')]['id'];_0x4551bb[_0x15e1('0x60')]['id']=_0x313e86[_0x15e1('0x56')][_0x15e1('0x5f')];return db[_0x15e1('0x39')][_0x15e1('0x54')]({'where':{'id':_0x313e86[_0x15e1('0x52')]['id'],'UserId':null}})[_0x15e1('0x23')](handleEntityNotFound(_0x29c758,null))[_0x15e1('0x23')](function(_0xb83a5e){if(_0xb83a5e){_0x4551bb[_0x15e1('0x2c')]=_0xb83a5e[_0x15e1('0x67')]({'plain':!![]});return db['SmsInteraction'][_0x15e1('0x54')]({'where':{'id':_0xb83a5e[_0x15e1('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x29c758,null))['then'](function(_0x4de1b1){if(_0x4de1b1){_0x4551bb[_0x15e1('0x6a')]=_0x4de1b1[_0x15e1('0x67')]({'plain':!![]});interaction_log[_0x15e1('0x24')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x313e86[_0x15e1('0x69')]['id'],_0x313e86[_0x15e1('0x69')][_0x15e1('0x37')],_0x313e86[_0x15e1('0x69')]['role'],_0x4551bb[_0x15e1('0x6a')]['id'],_0x313e86['body']?JSON[_0x15e1('0x29')](_0x313e86['body']):'null');return respondWithRpcPromise(_0x15e1('0x77'),_0x15e1('0x78'),_0x4551bb);}return null;})[_0x15e1('0x23')](function(_0x1f833d){if(_0x1f833d){_0x1f833d['message'][_0x15e1('0x6f')]=util[_0x15e1('0x70')]('SIP/%s',_0x313e86[_0x15e1('0x69')]['name']);_0x1f833d[_0x15e1('0x2c')][_0x15e1('0x72')]=_0x4551bb[_0x15e1('0x72')];_0x1f833d[_0x15e1('0x2c')][_0x15e1('0x73')]=_0x15e1('0x76');respondWithRpcPromise(_0x15e1('0x74'),_0x15e1('0x74'),{'event':_0x15e1('0x79'),'message':_0x1f833d['message']},client9002);return _0x4551bb;}return null;})[_0x15e1('0x23')](respondWithResult(_0x29c758,null))[_0x15e1('0x50')](handleError(_0x29c758,null));};exports[_0x15e1('0x2f')]=function(_0x169d2c,_0x80b2e1,_0x3fdcdc){if(_0x169d2c[_0x15e1('0x56')]['id']){delete _0x169d2c[_0x15e1('0x56')]['id'];}var _0x4099e7;return db[_0x15e1('0x39')][_0x15e1('0x54')]({'where':{'id':_0x169d2c[_0x15e1('0x52')]['id']}})['then'](handleEntityNotFound(_0x80b2e1,null))[_0x15e1('0x23')](function(_0x1404fc){if(_0x1404fc){_0x4099e7=_0x1404fc;return db[_0x15e1('0x7a')][_0x15e1('0x54')]({'where':{'id':_0x1404fc[_0x15e1('0x7b')]}});}})[_0x15e1('0x23')](handleEntityNotFound(_0x80b2e1,null))[_0x15e1('0x23')](function(_0x56f2e7){if(_0x56f2e7){logger[_0x15e1('0x27')](_0x15e1('0x28'),_0x15e1('0x2f'),_0x15e1('0x7c'),_0x56f2e7[_0x15e1('0x7d')],util[_0x15e1('0x7e')](_0x169d2c[_0x15e1('0x56')],{'showHidden':![],'depth':null}));switch(_0x56f2e7[_0x15e1('0x7d')]){case _0x15e1('0x7f'):if(_0x169d2c[_0x15e1('0x56')]['MessageSid']&&_0x169d2c[_0x15e1('0x56')][_0x15e1('0x80')]===_0x4099e7[_0x15e1('0x81')]){return _0x4099e7[_0x15e1('0x64')]({'read':!![]});}else{logger[_0x15e1('0x2a')](_0x15e1('0x82'),_0x15e1('0x2f'),_0x15e1('0x7f'),util[_0x15e1('0x7e')](_0x169d2c[_0x15e1('0x56')],{'showHidden':![],'depth':null}));}break;case _0x15e1('0x83'):if(_0x169d2c[_0x15e1('0x56')]['MessageUUID']&&_0x169d2c[_0x15e1('0x56')][_0x15e1('0x84')]===_0x4099e7[_0x15e1('0x81')]&&_[_0x15e1('0x85')]([_0x15e1('0x86'),_0x15e1('0x87')],_0x169d2c[_0x15e1('0x56')][_0x15e1('0x88')])>=0x0){return _0x4099e7[_0x15e1('0x64')]({'read':!![]});}else{logger['error'](_0x15e1('0x82'),_0x15e1('0x2f'),_0x15e1('0x89'),util['inspect'](_0x169d2c[_0x15e1('0x56')],{'showHidden':![],'depth':null}));}break;case _0x15e1('0x8a'):var _0x3096a6=_0x169d2c[_0x15e1('0x56')][_0x15e1('0x8b')][0x0];if(_0x3096a6['status'][_0x15e1('0x8c')]===_0x15e1('0x8d')){return _0x4099e7[_0x15e1('0x64')]({'read':!![]});}else{logger[_0x15e1('0x2a')](_0x15e1('0x82'),_0x15e1('0x2f'),_0x15e1('0x8a'),util[_0x15e1('0x7e')](_0x169d2c['body'],{'showHidden':![],'depth':null}));}break;}return _0x4099e7;}})[_0x15e1('0x23')](respondWithResult(_0x80b2e1,null))[_0x15e1('0x50')](handleError(_0x80b2e1,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index c79a5a1..5c89cec 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 _0xa7d7=['exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3e0780,_0x18f1de){var _0x443c40=function(_0x3f478a){while(--_0x3f478a){_0x3e0780['push'](_0x3e0780['shift']());}};_0x443c40(++_0x18f1de);}(_0xa7d7,0xc7));var _0x7a7d=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xa7d7[_0x363ef8];return _0x148822;};'use strict';var EventEmitter=require(_0x7a7d('0x0'));var SmsMessage=require(_0x7a7d('0x1'))['db'][_0x7a7d('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x7a7d('0x3')](0x0);var events={'afterCreate':_0x7a7d('0x4'),'afterUpdate':_0x7a7d('0x5'),'afterDestroy':_0x7a7d('0x6')};function emitEvent(_0xa48903){return function(_0x5e4d56,_0x571cb1,_0x2c0e9d){SmsMessageEvents[_0x7a7d('0x7')](_0xa48903+':'+_0x5e4d56['id'],_0x5e4d56);SmsMessageEvents[_0x7a7d('0x7')](_0xa48903,_0x5e4d56);_0x2c0e9d(null);};}for(var e in events){if(events[_0x7a7d('0x8')](e)){var event=events[e];SmsMessage[_0x7a7d('0x9')](e,emitEvent(event));}}module[_0x7a7d('0xa')]=SmsMessageEvents; \ No newline at end of file +var _0xe660=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x5dd6ef,_0x5054d9){var _0x33daab=function(_0x5bdfc7){while(--_0x5bdfc7){_0x5dd6ef['push'](_0x5dd6ef['shift']());}};_0x33daab(++_0x5054d9);}(_0xe660,0xb7));var _0x0e66=function(_0x17c8cc,_0x5e5647){_0x17c8cc=_0x17c8cc-0x0;var _0x3db4eb=_0xe660[_0x17c8cc];return _0x3db4eb;};'use strict';var EventEmitter=require(_0x0e66('0x0'));var SmsMessage=require(_0x0e66('0x1'))['db'][_0x0e66('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x0e66('0x3')](0x0);var events={'afterCreate':_0x0e66('0x4'),'afterUpdate':_0x0e66('0x5'),'afterDestroy':_0x0e66('0x6')};function emitEvent(_0x2357a6){return function(_0x2ddf7c,_0x2b7ab5,_0x2b8a0f){SmsMessageEvents['emit'](_0x2357a6+':'+_0x2ddf7c['id'],_0x2ddf7c);SmsMessageEvents[_0x0e66('0x7')](_0x2357a6,_0x2ddf7c);_0x2b8a0f(null);};}for(var e in events){if(events[_0x0e66('0x8')](e)){var event=events[e];SmsMessage[_0x0e66('0x9')](e,emitEvent(event));}}module[_0x0e66('0xa')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 1ea0acf..7d11372 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 _0x179a=['https://smsapi.connectel.se/api/v2/send/','deliveryReport','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','queued_count','data','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','remote','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','sort','length','createHash','digest','/external/get/send.php?','id_sms','clickatell','uuid','UTF-8','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','SmsInteractionId','then','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','user_key','session_key','total_sent','read','body','senderString','POST'];(function(_0x3ea5e1,_0x17c486){var _0x1b81d7=function(_0x5af999){while(--_0x5af999){_0x3ea5e1['push'](_0x3ea5e1['shift']());}};_0x1b81d7(++_0x17c486);}(_0x179a,0x13d));var _0xa179=function(_0x3b3cc6,_0x1a6e24){_0x3b3cc6=_0x3b3cc6-0x0;var _0x1161e4=_0x179a[_0x3b3cc6];return _0x1161e4;};'use strict';var _=require(_0xa179('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa179('0x1'));var moment=require(_0xa179('0x2'));var BPromise=require('bluebird');var rp=require(_0xa179('0x3'));var fs=require('fs');var path=require(_0xa179('0x4'));var rimraf=require(_0xa179('0x5'));var config=require(_0xa179('0x6'));var attributes=require(_0xa179('0x7'));module[_0xa179('0x8')]=function(_0xb4a2c7,_0x4775a2){return _0xb4a2c7[_0xa179('0x9')](_0xa179('0xa'),attributes,{'tableName':_0xa179('0xb'),'paranoid':![],'indexes':[{'name':_0xa179('0xc'),'fields':['messageId']},{'name':_0xa179('0xd'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xe1dac0,_0x20169a,_0x158040){var _0x3bc7b3=_0xb4a2c7[_0xa179('0xe')];var _0x4dc5c6=_0xe1dac0[_0xa179('0xf')]({'plain':!![]});if(_0x4dc5c6[_0xa179('0x10')]['toLowerCase']()==='in'||_0x4dc5c6['direction'][_0xa179('0x11')]()===_0xa179('0x12')&&!_0x4dc5c6[_0xa179('0x13')]&&!_[_0xa179('0x14')](_0x4dc5c6[_0xa179('0x15')])){_0x3bc7b3[_0xa179('0x16')]['findOne']({'where':{'id':_0x4dc5c6[_0xa179('0x17')]}})[_0xa179('0x18')](function(_0x2be541){if(_0x2be541){_0x2be541[_0xa179('0x19')]({'lastMsgAt':_0x4dc5c6[_0xa179('0x1a')],'lastMsgDirection':_0x4dc5c6[_0xa179('0x10')][_0xa179('0x11')]()});}})[_0xa179('0x1b')](function(_0x3bf0fa){console[_0xa179('0x1c')](_0x3bf0fa);});}if(_0x4dc5c6['direction']===_0xa179('0x12')&&!_0x4dc5c6['secret']){var _0x9c1e1b;_0x3bc7b3[_0xa179('0x1d')][_0xa179('0x1e')]({'where':{'id':_0x4dc5c6[_0xa179('0x1f')]},'raw':!![]})[_0xa179('0x18')](function(_0x41b88e){_0x9c1e1b=_0x41b88e;if(_0x9c1e1b&&_0x9c1e1b[_0xa179('0x20')]){switch(_0x9c1e1b[_0xa179('0x20')]){case'twilio':var _0x317b01=require(_0xa179('0x21'));if(_0x9c1e1b[_0xa179('0x22')]&&_0x9c1e1b[_0xa179('0x23')]&&_0x9c1e1b[_0xa179('0x24')]){var _0x550148=new _0x317b01(_0x9c1e1b[_0xa179('0x22')],_0x9c1e1b[_0xa179('0x23')]);_0x550148[_0xa179('0x25')]['create']({'body':_0x4dc5c6['body'],'to':_0x4dc5c6['phone'],'from':_0x9c1e1b['phone'],'statusCallback':_0x9c1e1b['remote']+_0xa179('0x26')+_0x4dc5c6['id']+_0xa179('0x27')+_0x9c1e1b[_0xa179('0x28')]})[_0xa179('0x18')](function(_0x15a1f2){if(_0x15a1f2[_0xa179('0x29')]){return _0xe1dac0[_0xa179('0x19')]({'messageId':_0x15a1f2[_0xa179('0x29')]});}})[_0xa179('0x1b')](function(_0x2e695a){logger[_0xa179('0x1c')](_0xa179('0x2a'),_0xa179('0x2b'),_0xa179('0x21'),util[_0xa179('0x2c')](_0x2e695a,{'showHidden':![],'depth':null}));});}else{logger[_0xa179('0x1c')](_0xa179('0x2a'),_0xa179('0x2b'),_0xa179('0x21'),_0xa179('0x2d'));}break;case _0xa179('0x2e'):var _0x5d0fa3=_0xa179('0x2f');if(_0x9c1e1b[_0xa179('0x30')]&&_0x9c1e1b[_0xa179('0x31')]){var _0x3667d6={'recipient':[_0x4dc5c6[_0xa179('0x24')]],'message':_0x4dc5c6['body'],'message_type':_0x9c1e1b[_0xa179('0x32')]};if(_0x9c1e1b['smsMethod']&&_0x9c1e1b['smsMethod']!=='SI'){_0x3667d6[_0xa179('0x33')]=_0x9c1e1b[_0xa179('0x24')];}var _0x200f16={'url':_0x5d0fa3+_0xa179('0x34')+_0x9c1e1b['username']+_0xa179('0x35')+_0x9c1e1b[_0xa179('0x31')],'method':_0xa179('0x36')};rp(_0x200f16)[_0xa179('0x18')](function(_0x34c345){var _0x30833a=_0x34c345[_0xa179('0x37')](';');var _0x3a437b={'user_key':_0x30833a[0x0],'session_key':_0x30833a[0x1]};_0x200f16={'url':_0x5d0fa3+_0xa179('0x38'),'method':'POST','headers':{'user_key':_0x3a437b[_0xa179('0x39')],'Session_key':_0x3a437b[_0xa179('0x3a')]},'json':!![],'body':_0x3667d6};return rp(_0x200f16);})[_0xa179('0x18')](function(_0x299f12){if(_0x299f12[_0xa179('0x3b')]>=0x1){var _0x10c2b3={'messageId':_0x299f12['internal_order_id']};if(_0x9c1e1b['smsMethod']!=='GP'||!_0x9c1e1b['deliveryReport']){_0x10c2b3[_0xa179('0x3c')]=!![];}return _0xe1dac0['update'](_0x10c2b3);}else{return logger[_0xa179('0x1c')](_0xa179('0x2a'),_0xa179('0x2b'),_0xa179('0x2e'),util[_0xa179('0x2c')](_0x299f12,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5aa117){return logger[_0xa179('0x1c')](_0xa179('0x2a'),_0xa179('0x2b'),_0xa179('0x2e'),util[_0xa179('0x2c')](_0x5aa117,{'showHidden':![],'depth':null}));});}else{logger[_0xa179('0x1c')](_0xa179('0x2a'),_0xa179('0x2b'),_0xa179('0x2e'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x9c1e1b[_0xa179('0x23')]){var _0x40c496={'recipient':_0x4dc5c6[_0xa179('0x24')],'message':_0x4dc5c6[_0xa179('0x3d')],'sender':_0x9c1e1b[_0xa179('0x3e')]||_0x9c1e1b['phone'],'authorization':_0x9c1e1b['authToken']};var _0x20169a={'method':_0xa179('0x3f'),'uri':_0xa179('0x40'),'body':_0x40c496,'json':!![]};rp(_0x20169a)[_0xa179('0x18')](function(_0x4246cb){var _0x4ceeac={'messageId':_0x4246cb['requestid']};if(!_0x9c1e1b[_0xa179('0x41')]){_0x4ceeac[_0xa179('0x3c')]=!![];}return _0xe1dac0[_0xa179('0x19')](_0x4ceeac);})[_0xa179('0x1b')](function(_0xc3302){logger[_0xa179('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa179('0x42'),util[_0xa179('0x2c')](_0xc3302,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa179('0x2a'),_0xa179('0x2b'),_0xa179('0x42'),_0xa179('0x43'));}break;case _0xa179('0x44'):if(_0x9c1e1b['username']&&_0x9c1e1b[_0xa179('0x31')]){var _0x40c496={'messages':[{'source':_0xa179('0x45'),'to':_0x4dc5c6[_0xa179('0x24')],'body':_0x4dc5c6[_0xa179('0x3d')],'from':_0x9c1e1b[_0xa179('0x3e')]||_0x9c1e1b[_0xa179('0x24')]}]};var _0x371a17=util[_0xa179('0x46')](_0xa179('0x47'),_0x9c1e1b[_0xa179('0x30')],_0x9c1e1b[_0xa179('0x31')]);var _0x20169a={'method':_0xa179('0x3f'),'uri':_0xa179('0x48'),'body':_0x40c496,'headers':{'Authorization':util['format'](_0xa179('0x49'),new Buffer(_0x371a17)['toString'](_0xa179('0x4a')))},'json':!![]};rp(_0x20169a)[_0xa179('0x18')](function(_0x491066){if(_0x491066[_0xa179('0x4b')]>=0xc8&&_0x491066['http_code']<=0xce){if(_0x491066['data']&&_0x491066['data'][_0xa179('0x4c')]>0x0){var _0x3edbd4=_['head'](_0x491066[_0xa179('0x4d')][_0xa179('0x25')]);var _0x3cf255={'messageId':_0x3edbd4[_0xa179('0x4e')]};if(!_0x9c1e1b[_0xa179('0x41')]){_0x3cf255['read']=!![];}return _0xe1dac0[_0xa179('0x19')](_0x3cf255);}else{logger[_0xa179('0x1c')](_0xa179('0x2a'),_0xa179('0x2b'),_0xa179('0x4f'),util['inspect'](_0x491066,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa179('0x2b'),_0xa179('0x4f'),util['inspect'](_0x491066,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4ba5de){logger[_0xa179('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa179('0x2b'),_0xa179('0x4f'),util[_0xa179('0x2c')](_0x4ba5de,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa179('0x2a'),_0xa179('0x2b'),_0xa179('0x4f'),_0xa179('0x50'));}break;case _0xa179('0x51'):if(_0x9c1e1b[_0xa179('0x52')]&&_0x9c1e1b[_0xa179('0x23')]){var _0x40c496={'dst':_0x4dc5c6['phone'],'text':_0x4dc5c6['body'],'src':_0x9c1e1b[_0xa179('0x3e')]||_0x9c1e1b['phone'],'url':_0x9c1e1b[_0xa179('0x53')]+_0xa179('0x26')+_0x4dc5c6['id']+'/status?token='+_0x9c1e1b[_0xa179('0x28')]};var _0x371a17=util[_0xa179('0x46')](_0xa179('0x47'),_0x9c1e1b[_0xa179('0x52')],_0x9c1e1b[_0xa179('0x23')]);var _0x20169a={'method':_0xa179('0x3f'),'uri':util[_0xa179('0x46')](_0xa179('0x54'),_0x9c1e1b[_0xa179('0x52')]),'body':_0x40c496,'headers':{'Authorization':util[_0xa179('0x46')](_0xa179('0x49'),new Buffer(_0x371a17)[_0xa179('0x55')]('base64'))},'json':!![]};rp(_0x20169a)[_0xa179('0x18')](function(_0x5d708f){var _0x5531b1={'messageId':_0x5d708f[_0xa179('0x56')][0x0]};return _0xe1dac0[_0xa179('0x19')](_0x5531b1);})[_0xa179('0x1b')](function(_0xe6ec80){logger[_0xa179('0x1c')](_0xa179('0x2a'),_0xa179('0x2b'),'plivo',util[_0xa179('0x2c')](_0xe6ec80,{'showHidden':![],'depth':null}));});}else{logger[_0xa179('0x1c')](_0xa179('0x2a'),'afterCreate',_0xa179('0x51'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x9c1e1b[_0xa179('0x30')]&&_0x9c1e1b[_0xa179('0x31')]){if(_0x9c1e1b[_0xa179('0x57')]){var _0x29a864={'method':_0xa179('0x3f'),'uri':_0x9c1e1b['baseUrl']+_0xa179('0x58'),'body':{'username':_0x9c1e1b[_0xa179('0x30')],'password':_0x9c1e1b[_0xa179('0x31')]},'json':!![]};return rp(_0x29a864)[_0xa179('0x18')](function(_0x12003f){var _0x456b06={'method':_0xa179('0x3f'),'uri':_0x9c1e1b[_0xa179('0x57')]+_0xa179('0x59'),'body':{'messages':[{'from':_0x9c1e1b[_0xa179('0x24')],'destinations':[{'to':_0x4dc5c6[_0xa179('0x24')]}],'text':_0x4dc5c6[_0xa179('0x3d')],'notifyUrl':_0x9c1e1b[_0xa179('0x53')]+_0xa179('0x26')+_0x4dc5c6['id']+'/status?token='+_0x9c1e1b[_0xa179('0x28')],'notifyContentType':_0xa179('0x5a'),'callbackData':_0x9c1e1b[_0xa179('0x24')]+';'+_0x4dc5c6[_0xa179('0x3d')]}]},'headers':{'Authorization':_0xa179('0x5b')+_0x12003f[_0xa179('0x28')]},'json':!![]};return rp(_0x456b06)[_0xa179('0x18')](function(_0x1e80a6){if(_0x1e80a6[_0xa179('0x25')]){var _0x4ae146={'messageId':_0x1e80a6['messages'][0x0][_0xa179('0xc')]};if(!_0x9c1e1b[_0xa179('0x41')]){_0x4ae146['read']=!![];}return _0xe1dac0[_0xa179('0x19')](_0x4ae146);}else{return logger[_0xa179('0x1c')](_0xa179('0x2a'),_0xa179('0x2b'),'infobip',util[_0xa179('0x2c')](_0x1e80a6,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x5e6b9f){return logger['error'](_0xa179('0x2a'),_0xa179('0x2b'),_0xa179('0x5c'),util[_0xa179('0x2c')](_0x5e6b9f,{'showHidden':![],'depth':null}));});}else{logger[_0xa179('0x1c')](_0xa179('0x2a'),_0xa179('0x2b'),_0xa179('0x5c'),_0xa179('0x5d'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa179('0x2b'),_0xa179('0x5c'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xa179('0x5e'):var _0x359ac4=require(_0xa179('0x5f'));if(_0x9c1e1b[_0xa179('0x60')]){var _0x3dc39a={};_0x3dc39a[_0xa179('0x61')]=_0x9c1e1b[_0xa179('0x30')];_0x3dc39a[_0xa179('0x24')]=_0x4dc5c6[_0xa179('0x24')];_0x3dc39a[_0xa179('0x33')]=_0x9c1e1b[_0xa179('0x24')];_0x3dc39a[_0xa179('0x62')]=_0x4dc5c6[_0xa179('0x3d')];_0x3dc39a[_0xa179('0x63')]=+new Date();var _0x5dc4e1='';var _0x10b484='';var _0x41f17d=Object['keys'](_0x3dc39a);_0x41f17d[_0xa179('0x64')]();for(var _0x257104=0x0;_0x257104<_0x41f17d[_0xa179('0x65')];_0x257104++){if(_0x5dc4e1!=''){_0x5dc4e1+='&';}_0x5dc4e1+=_0x41f17d[_0x257104]+'='+encodeURIComponent(_0x3dc39a[_0x41f17d[_0x257104]]);_0x10b484+=_0x3dc39a[_0x41f17d[_0x257104]];}_0x10b484+=_0x9c1e1b[_0xa179('0x60')];_0x10b484=_0x359ac4[_0xa179('0x66')]('md5')['update'](_0x10b484)[_0xa179('0x67')]('hex');if(_0x5dc4e1!==''){_0x5dc4e1+='&';}_0x5dc4e1+='signature='+_0x10b484;var _0x200f16={'method':_0xa179('0x36'),'uri':_0x9c1e1b[_0xa179('0x57')]+_0xa179('0x68')+_0x5dc4e1,'json':!![]};return rp(_0x200f16)['then'](function(_0x37293f){var _0x4016b4=Object['keys'](_0x37293f);if(_0x37293f[_0x4016b4[0x0]][_0xa179('0x1c')]&&parseInt(_0x37293f[_0x4016b4[0x0]][_0xa179('0x1c')])===0x0){var _0x1ef972={'messageId':_0x37293f[_0x4016b4[0x0]][_0xa179('0x69')]};if(!_0x9c1e1b[_0xa179('0x41')]){_0x1ef972[_0xa179('0x3c')]=!![];}return _0xe1dac0[_0xa179('0x19')](_0x1ef972);}else{return logger[_0xa179('0x1c')](_0xa179('0x2a'),_0xa179('0x2b'),_0xa179('0x5e'),util['inspect'](_0x37293f[_0xa179('0x1c')],{'showHidden':![],'depth':null}));}})[_0xa179('0x1b')](function(_0x4b58f0){return logger[_0xa179('0x1c')](_0xa179('0x2a'),_0xa179('0x2b'),_0xa179('0x5e'),util['inspect'](_0x4b58f0,{'showHidden':![],'depth':null}));});}else{logger[_0xa179('0x1c')](_0xa179('0x2a'),_0xa179('0x2b'),_0xa179('0x5e'),'Missing\x20parameters:\x20apiKey');}break;case _0xa179('0x6a'):if(_0x9c1e1b[_0xa179('0x60')]){var _0x187830={'method':'POST','uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x9c1e1b[_0xa179('0x60')]},'body':{'content':_0x4dc5c6[_0xa179('0x3d')],'to':[_0x4dc5c6[_0xa179('0x24')]],'from':_0x9c1e1b[_0xa179('0x24')],'binary':![],'clientMessageId':_0xa179('0x6b'),'charset':_0xa179('0x6c')},'json':!![]};rp(_0x187830)[_0xa179('0x18')](function(_0xb304b5){if(!_0xb304b5[_0xa179('0x1c')]){var _0x1f1259={'messageId':_0xb304b5['messages'][0x0]['apiMessageId']};if(!_0x9c1e1b['deliveryReport']){_0x1f1259[_0xa179('0x3c')]=!![];}return _0xe1dac0[_0xa179('0x19')](_0x1f1259);}else{return logger[_0xa179('0x1c')](_0xa179('0x2a'),'afterCreate',_0xa179('0x6a'),util[_0xa179('0x2c')](_0xb304b5['error'],{'showHidden':![],'depth':null}));}})[_0xa179('0x1b')](function(_0x3925e4){return logger[_0xa179('0x1c')](_0xa179('0x2a'),'afterCreate',_0xa179('0x6a'),util['inspect'](_0x3925e4,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa179('0x2b'),_0xa179('0x6a'),_0xa179('0x6d'));}break;case _0xa179('0x6e'):if(_0x9c1e1b['username']&&_0x9c1e1b[_0xa179('0x31')]){var _0x371a17=util['format']('%s:%s',_0x9c1e1b[_0xa179('0x30')],_0x9c1e1b[_0xa179('0x31')]);var _0x20169a={'method':_0xa179('0x3f'),'uri':_0xa179('0x6f')+_0x9c1e1b[_0xa179('0x70')]+_0xa179('0x71'),'body':{'to':[_0x4dc5c6['phone']],'text':_0x4dc5c6[_0xa179('0x3d')],'from':_0x9c1e1b[_0xa179('0x24')],'applicationId':_0x9c1e1b[_0xa179('0x72')]},'headers':{'Authorization':util[_0xa179('0x46')](_0xa179('0x49'),new Buffer(_0x371a17)['toString']('base64'))},'json':!![]};rp(_0x20169a)[_0xa179('0x18')](function(_0x7e12b5){if(_0x7e12b5['id']){var _0x8cbe05={'messageId':_0x7e12b5['id']};return _0xe1dac0[_0xa179('0x19')](_0x8cbe05);}else{logger['error'](_0xa179('0x2a'),_0xa179('0x2b'),'bandwidth',util[_0xa179('0x2c')](_0x7e12b5,{'showHidden':![],'depth':null}));}})[_0xa179('0x1b')](function(_0x3b71c9){logger['error'](_0xa179('0x2a'),_0xa179('0x2b'),_0xa179('0x6e'),util[_0xa179('0x2c')](_0x3b71c9,{'showHidden':![],'depth':null}));});}else{logger[_0xa179('0x1c')](_0xa179('0x2a'),'afterCreate',_0xa179('0x6e'),_0xa179('0x50'));}break;case _0xa179('0x73'):if(_0x9c1e1b[_0xa179('0x60')]){var _0x570ab3={};var _0x200f16={'method':_0xa179('0x3f'),'uri':_0xa179('0x74'),'headers':{'Authorization':_0xa179('0x75')+_0x9c1e1b[_0xa179('0x60')],'Content-Type':_0xa179('0x5a')},'body':{'from':_0x9c1e1b[_0xa179('0x24')],'to':_0x4dc5c6[_0xa179('0x24')],'text':_0x4dc5c6[_0xa179('0x3d')]},'json':!![]};return rp(_0x200f16)['then'](function(_0xb414fd){if(_0xb414fd[_0xa179('0x76')]==0xca){_0x570ab3[_0xa179('0x77')]=_0xb414fd;var _0x109d25={'method':_0xa179('0x3f'),'uri':_0xa179('0x78'),'headers':{'Authorization':'Bearer\x20'+_0x9c1e1b['apiKey'],'Content-Type':_0xa179('0x5a')},'body':{'refid':_0x570ab3[_0xa179('0x77')][_0xa179('0x79')]},'json':!![]};return rp(_0x109d25)[_0xa179('0x18')](function(_0x154f57){_0x570ab3[_0xa179('0x7a')]=_0x154f57;var _0x19e960={'messageId':_0x570ab3[_0xa179('0x77')][_0xa179('0x79')],'read':!![]};return _0xe1dac0['update'](_0x19e960);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa179('0x73'),util[_0xa179('0x2c')](_0xb414fd,{'showHidden':![],'depth':null}));}})[_0xa179('0x1b')](function(_0x262bc1){return logger['error'](_0xa179('0x2a'),_0xa179('0x2b'),_0xa179('0x73'),util[_0xa179('0x2c')](_0x262bc1,{'showHidden':![],'depth':null}));});}else{return logger[_0xa179('0x1c')](_0xa179('0x2a'),'afterCreate','intelepeer',_0xa179('0x7b'));}break;}}})[_0xa179('0x7c')](function(){_0x158040();});}else{_0x158040();}}},'charset':_0xa179('0x7d'),'collate':_0xa179('0x7e')});}; \ No newline at end of file +var _0x21ed=['direction','out','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','update','createdAt','catch','error','SmsAccount','SmsAccountId','then','type','twilio','accountSid','authToken','phone','messages','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','body','smsMethod','sender','login?username=','&password=','password','split','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','clicksend','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','http_code','data','head','message_id','clickSend','authId','https://api.plivo.com/v1/Account/%s/Message/','toString','base64','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','apiKey','login','text','timestamp','keys','length','createHash','digest','hex','signature=','GET','/external/get/send.php?','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','clickatell','bandwidth','%s:%s','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','application/json','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','toLowerCase'];(function(_0x4fc695,_0x4d6695){var _0x21f109=function(_0x451c4f){while(--_0x451c4f){_0x4fc695['push'](_0x4fc695['shift']());}};_0x21f109(++_0x4d6695);}(_0x21ed,0xe6));var _0xd21e=function(_0x533d45,_0x4c2fe5){_0x533d45=_0x533d45-0x0;var _0x8ce794=_0x21ed[_0x533d45];return _0x8ce794;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd21e('0x0'))('api');var moment=require('moment');var BPromise=require(_0xd21e('0x1'));var rp=require(_0xd21e('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd21e('0x3'));var config=require(_0xd21e('0x4'));var attributes=require(_0xd21e('0x5'));module['exports']=function(_0x284b2f,_0x504261){return _0x284b2f[_0xd21e('0x6')](_0xd21e('0x7'),attributes,{'tableName':_0xd21e('0x8'),'paranoid':![],'indexes':[{'name':_0xd21e('0x9'),'fields':[_0xd21e('0x9')]},{'name':_0xd21e('0xa'),'fields':['body'],'type':_0xd21e('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5be567,_0x4dbbe5,_0x168ebd){var _0x94798b=_0x284b2f[_0xd21e('0xc')];var _0x280e02=_0x5be567['get']({'plain':!![]});if(_0x280e02['direction'][_0xd21e('0xd')]()==='in'||_0x280e02[_0xd21e('0xe')][_0xd21e('0xd')]()===_0xd21e('0xf')&&!_0x280e02[_0xd21e('0x10')]&&!_[_0xd21e('0x11')](_0x280e02[_0xd21e('0x12')])){_0x94798b[_0xd21e('0x13')][_0xd21e('0x14')]({'where':{'id':_0x280e02[_0xd21e('0x15')]}})['then'](function(_0x5a1710){if(_0x5a1710){_0x5a1710[_0xd21e('0x16')]({'lastMsgAt':_0x280e02[_0xd21e('0x17')],'lastMsgDirection':_0x280e02[_0xd21e('0xe')]['toLowerCase']()});}})[_0xd21e('0x18')](function(_0x3bca27){console[_0xd21e('0x19')](_0x3bca27);});}if(_0x280e02[_0xd21e('0xe')]===_0xd21e('0xf')&&!_0x280e02['secret']){var _0x122700;_0x94798b[_0xd21e('0x1a')]['find']({'where':{'id':_0x280e02[_0xd21e('0x1b')]},'raw':!![]})[_0xd21e('0x1c')](function(_0x180397){_0x122700=_0x180397;if(_0x122700&&_0x122700['type']){switch(_0x122700[_0xd21e('0x1d')]){case'twilio':var _0x5f014a=require(_0xd21e('0x1e'));if(_0x122700[_0xd21e('0x1f')]&&_0x122700[_0xd21e('0x20')]&&_0x122700[_0xd21e('0x21')]){var _0x4e0ebf=new _0x5f014a(_0x122700[_0xd21e('0x1f')],_0x122700[_0xd21e('0x20')]);_0x4e0ebf[_0xd21e('0x22')]['create']({'body':_0x280e02['body'],'to':_0x280e02[_0xd21e('0x21')],'from':_0x122700[_0xd21e('0x21')],'statusCallback':_0x122700[_0xd21e('0x23')]+_0xd21e('0x24')+_0x280e02['id']+_0xd21e('0x25')+_0x122700[_0xd21e('0x26')]})['then'](function(_0x2bc5ba){if(_0x2bc5ba[_0xd21e('0x27')]){return _0x5be567[_0xd21e('0x16')]({'messageId':_0x2bc5ba[_0xd21e('0x27')]});}})[_0xd21e('0x18')](function(_0x3f6ec6){logger[_0xd21e('0x19')](_0xd21e('0x28'),_0xd21e('0x29'),'twilio',util[_0xd21e('0x2a')](_0x3f6ec6,{'showHidden':![],'depth':null}));});}else{logger[_0xd21e('0x19')](_0xd21e('0x28'),_0xd21e('0x29'),_0xd21e('0x1e'),_0xd21e('0x2b'));}break;case'skebby':var _0x7fc041=_0xd21e('0x2c');if(_0x122700[_0xd21e('0x2d')]&&_0x122700['password']){var _0x1720ad={'recipient':[_0x280e02[_0xd21e('0x21')]],'message':_0x280e02[_0xd21e('0x2e')],'message_type':_0x122700[_0xd21e('0x2f')]};if(_0x122700[_0xd21e('0x2f')]&&_0x122700['smsMethod']!=='SI'){_0x1720ad[_0xd21e('0x30')]=_0x122700[_0xd21e('0x21')];}var _0x3de19d={'url':_0x7fc041+_0xd21e('0x31')+_0x122700[_0xd21e('0x2d')]+_0xd21e('0x32')+_0x122700[_0xd21e('0x33')],'method':'GET'};rp(_0x3de19d)['then'](function(_0x1b218a){var _0x1802ee=_0x1b218a[_0xd21e('0x34')](';');var _0x5d798e={'user_key':_0x1802ee[0x0],'session_key':_0x1802ee[0x1]};_0x3de19d={'url':_0x7fc041+'sms','method':_0xd21e('0x35'),'headers':{'user_key':_0x5d798e[_0xd21e('0x36')],'Session_key':_0x5d798e[_0xd21e('0x37')]},'json':!![],'body':_0x1720ad};return rp(_0x3de19d);})[_0xd21e('0x1c')](function(_0x2d8342){if(_0x2d8342[_0xd21e('0x38')]>=0x1){var _0x10e450={'messageId':_0x2d8342[_0xd21e('0x39')]};if(_0x122700['smsMethod']!=='GP'||!_0x122700[_0xd21e('0x3a')]){_0x10e450[_0xd21e('0x3b')]=!![];}return _0x5be567[_0xd21e('0x16')](_0x10e450);}else{return logger['error'](_0xd21e('0x28'),_0xd21e('0x29'),'skebby',util[_0xd21e('0x2a')](_0x2d8342,{'showHidden':![],'depth':null}));}})[_0xd21e('0x18')](function(_0x59225e){return logger[_0xd21e('0x19')](_0xd21e('0x28'),_0xd21e('0x29'),'skebby',util[_0xd21e('0x2a')](_0x59225e,{'showHidden':![],'depth':null}));});}else{logger[_0xd21e('0x19')](_0xd21e('0x28'),_0xd21e('0x29'),_0xd21e('0x3c'),_0xd21e('0x3d'));}break;case _0xd21e('0x3e'):if(_0x122700[_0xd21e('0x20')]){var _0x30f6e3={'recipient':_0x280e02[_0xd21e('0x21')],'message':_0x280e02[_0xd21e('0x2e')],'sender':_0x122700[_0xd21e('0x3f')]||_0x122700[_0xd21e('0x21')],'authorization':_0x122700[_0xd21e('0x20')]};var _0x4dbbe5={'method':'POST','uri':_0xd21e('0x40'),'body':_0x30f6e3,'json':!![]};rp(_0x4dbbe5)[_0xd21e('0x1c')](function(_0x309a84){var _0x401e90={'messageId':_0x309a84[_0xd21e('0x41')]};if(!_0x122700['deliveryReport']){_0x401e90[_0xd21e('0x3b')]=!![];}return _0x5be567['update'](_0x401e90);})[_0xd21e('0x18')](function(_0x21e300){logger[_0xd21e('0x19')](_0xd21e('0x28'),'afterCreate',_0xd21e('0x3e'),util['inspect'](_0x21e300,{'showHidden':![],'depth':null}));});}else{logger[_0xd21e('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd21e('0x29'),_0xd21e('0x3e'),'Missing\x20parameters:\x20authToken');}break;case _0xd21e('0x42'):if(_0x122700[_0xd21e('0x2d')]&&_0x122700[_0xd21e('0x33')]){var _0x30f6e3={'messages':[{'source':_0xd21e('0x43'),'to':_0x280e02[_0xd21e('0x21')],'body':_0x280e02[_0xd21e('0x2e')],'from':_0x122700[_0xd21e('0x3f')]||_0x122700[_0xd21e('0x21')]}]};var _0x26eeb8=util[_0xd21e('0x44')]('%s:%s',_0x122700[_0xd21e('0x2d')],_0x122700[_0xd21e('0x33')]);var _0x4dbbe5={'method':'POST','uri':_0xd21e('0x45'),'body':_0x30f6e3,'headers':{'Authorization':util['format'](_0xd21e('0x46'),new Buffer(_0x26eeb8)['toString']('base64'))},'json':!![]};rp(_0x4dbbe5)[_0xd21e('0x1c')](function(_0x1b57ae){if(_0x1b57ae['http_code']>=0xc8&&_0x1b57ae[_0xd21e('0x47')]<=0xce){if(_0x1b57ae[_0xd21e('0x48')]&&_0x1b57ae[_0xd21e('0x48')]['queued_count']>0x0){var _0x527311=_[_0xd21e('0x49')](_0x1b57ae[_0xd21e('0x48')][_0xd21e('0x22')]);var _0x1076b7={'messageId':_0x527311[_0xd21e('0x4a')]};if(!_0x122700[_0xd21e('0x3a')]){_0x1076b7[_0xd21e('0x3b')]=!![];}return _0x5be567[_0xd21e('0x16')](_0x1076b7);}else{logger[_0xd21e('0x19')](_0xd21e('0x28'),'afterCreate',_0xd21e('0x4b'),util[_0xd21e('0x2a')](_0x1b57ae,{'showHidden':![],'depth':null}));}}else{logger[_0xd21e('0x19')](_0xd21e('0x28'),'afterCreate',_0xd21e('0x4b'),util['inspect'](_0x1b57ae,{'showHidden':![],'depth':null}));}})[_0xd21e('0x18')](function(_0x2575d5){logger[_0xd21e('0x19')](_0xd21e('0x28'),_0xd21e('0x29'),_0xd21e('0x4b'),util[_0xd21e('0x2a')](_0x2575d5,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd21e('0x28'),_0xd21e('0x29'),'clickSend',_0xd21e('0x3d'));}break;case'plivo':if(_0x122700[_0xd21e('0x4c')]&&_0x122700[_0xd21e('0x20')]){var _0x30f6e3={'dst':_0x280e02[_0xd21e('0x21')],'text':_0x280e02['body'],'src':_0x122700[_0xd21e('0x3f')]||_0x122700[_0xd21e('0x21')],'url':_0x122700['remote']+_0xd21e('0x24')+_0x280e02['id']+'/status?token='+_0x122700[_0xd21e('0x26')]};var _0x26eeb8=util['format']('%s:%s',_0x122700['authId'],_0x122700['authToken']);var _0x4dbbe5={'method':_0xd21e('0x35'),'uri':util['format'](_0xd21e('0x4d'),_0x122700[_0xd21e('0x4c')]),'body':_0x30f6e3,'headers':{'Authorization':util[_0xd21e('0x44')](_0xd21e('0x46'),new Buffer(_0x26eeb8)[_0xd21e('0x4e')](_0xd21e('0x4f')))},'json':!![]};rp(_0x4dbbe5)[_0xd21e('0x1c')](function(_0x52fdd4){var _0xd42b1e={'messageId':_0x52fdd4['message_uuid'][0x0]};return _0x5be567[_0xd21e('0x16')](_0xd42b1e);})[_0xd21e('0x18')](function(_0x2bd73e){logger['error'](_0xd21e('0x28'),_0xd21e('0x29'),'plivo',util[_0xd21e('0x2a')](_0x2bd73e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd21e('0x28'),_0xd21e('0x29'),_0xd21e('0x50'),_0xd21e('0x51'));}break;case _0xd21e('0x52'):if(_0x122700[_0xd21e('0x2d')]&&_0x122700[_0xd21e('0x33')]){if(_0x122700['baseUrl']){var _0x1b3bd8={'method':_0xd21e('0x35'),'uri':_0x122700[_0xd21e('0x53')]+_0xd21e('0x54'),'body':{'username':_0x122700[_0xd21e('0x2d')],'password':_0x122700[_0xd21e('0x33')]},'json':!![]};return rp(_0x1b3bd8)[_0xd21e('0x1c')](function(_0x2c573d){var _0x1912ab={'method':_0xd21e('0x35'),'uri':_0x122700['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x122700[_0xd21e('0x21')],'destinations':[{'to':_0x280e02['phone']}],'text':_0x280e02[_0xd21e('0x2e')],'notifyUrl':_0x122700[_0xd21e('0x23')]+_0xd21e('0x24')+_0x280e02['id']+_0xd21e('0x25')+_0x122700[_0xd21e('0x26')],'notifyContentType':'application/json','callbackData':_0x122700[_0xd21e('0x21')]+';'+_0x280e02[_0xd21e('0x2e')]}]},'headers':{'Authorization':_0xd21e('0x55')+_0x2c573d[_0xd21e('0x26')]},'json':!![]};return rp(_0x1912ab)[_0xd21e('0x1c')](function(_0x43a433){if(_0x43a433[_0xd21e('0x22')]){var _0x3068e7={'messageId':_0x43a433[_0xd21e('0x22')][0x0][_0xd21e('0x9')]};if(!_0x122700['deliveryReport']){_0x3068e7[_0xd21e('0x3b')]=!![];}return _0x5be567['update'](_0x3068e7);}else{return logger[_0xd21e('0x19')](_0xd21e('0x28'),_0xd21e('0x29'),_0xd21e('0x52'),util[_0xd21e('0x2a')](_0x43a433,{'showHidden':![],'depth':null}));}});})[_0xd21e('0x18')](function(_0xed26c6){return logger['error'](_0xd21e('0x28'),'afterCreate',_0xd21e('0x52'),util[_0xd21e('0x2a')](_0xed26c6,{'showHidden':![],'depth':null}));});}else{logger[_0xd21e('0x19')](_0xd21e('0x28'),_0xd21e('0x29'),'infobip',_0xd21e('0x56'));}}else{logger[_0xd21e('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd21e('0x52'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xd21e('0x57'):var _0x1fa606=require('crypto');if(_0x122700[_0xd21e('0x58')]){var _0xb3b423={};_0xb3b423[_0xd21e('0x59')]=_0x122700[_0xd21e('0x2d')];_0xb3b423[_0xd21e('0x21')]=_0x280e02[_0xd21e('0x21')];_0xb3b423[_0xd21e('0x30')]=_0x122700['phone'];_0xb3b423[_0xd21e('0x5a')]=_0x280e02[_0xd21e('0x2e')];_0xb3b423[_0xd21e('0x5b')]=+new Date();var _0x4c12a2='';var _0x30b027='';var _0x1610e5=Object[_0xd21e('0x5c')](_0xb3b423);_0x1610e5['sort']();for(var _0x264ce2=0x0;_0x264ce2<_0x1610e5[_0xd21e('0x5d')];_0x264ce2++){if(_0x4c12a2!=''){_0x4c12a2+='&';}_0x4c12a2+=_0x1610e5[_0x264ce2]+'='+encodeURIComponent(_0xb3b423[_0x1610e5[_0x264ce2]]);_0x30b027+=_0xb3b423[_0x1610e5[_0x264ce2]];}_0x30b027+=_0x122700[_0xd21e('0x58')];_0x30b027=_0x1fa606[_0xd21e('0x5e')]('md5')['update'](_0x30b027)[_0xd21e('0x5f')](_0xd21e('0x60'));if(_0x4c12a2!==''){_0x4c12a2+='&';}_0x4c12a2+=_0xd21e('0x61')+_0x30b027;var _0x3de19d={'method':_0xd21e('0x62'),'uri':_0x122700[_0xd21e('0x53')]+_0xd21e('0x63')+_0x4c12a2,'json':!![]};return rp(_0x3de19d)[_0xd21e('0x1c')](function(_0x314384){var _0x4f6206=Object[_0xd21e('0x5c')](_0x314384);if(_0x314384[_0x4f6206[0x0]][_0xd21e('0x19')]&&parseInt(_0x314384[_0x4f6206[0x0]]['error'])===0x0){var _0x1661fb={'messageId':_0x314384[_0x4f6206[0x0]]['id_sms']};if(!_0x122700['deliveryReport']){_0x1661fb[_0xd21e('0x3b')]=!![];}return _0x5be567[_0xd21e('0x16')](_0x1661fb);}else{return logger[_0xd21e('0x19')](_0xd21e('0x28'),_0xd21e('0x29'),_0xd21e('0x57'),util['inspect'](_0x314384[_0xd21e('0x19')],{'showHidden':![],'depth':null}));}})[_0xd21e('0x18')](function(_0x3fc12b){return logger[_0xd21e('0x19')](_0xd21e('0x28'),'afterCreate',_0xd21e('0x57'),util['inspect'](_0x3fc12b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd21e('0x28'),_0xd21e('0x29'),_0xd21e('0x57'),_0xd21e('0x64'));}break;case'clickatell':if(_0x122700[_0xd21e('0x58')]){var _0x2492dd={'method':_0xd21e('0x35'),'uri':_0xd21e('0x65'),'headers':{'Authorization':_0x122700[_0xd21e('0x58')]},'body':{'content':_0x280e02[_0xd21e('0x2e')],'to':[_0x280e02[_0xd21e('0x21')]],'from':_0x122700[_0xd21e('0x21')],'binary':![],'clientMessageId':_0xd21e('0x66'),'charset':_0xd21e('0x67')},'json':!![]};rp(_0x2492dd)[_0xd21e('0x1c')](function(_0x109e13){if(!_0x109e13[_0xd21e('0x19')]){var _0x1826da={'messageId':_0x109e13['messages'][0x0]['apiMessageId']};if(!_0x122700['deliveryReport']){_0x1826da[_0xd21e('0x3b')]=!![];}return _0x5be567[_0xd21e('0x16')](_0x1826da);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickatell',util[_0xd21e('0x2a')](_0x109e13['error'],{'showHidden':![],'depth':null}));}})[_0xd21e('0x18')](function(_0x52d85b){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd21e('0x29'),_0xd21e('0x68'),util['inspect'](_0x52d85b,{'showHidden':![],'depth':null}));});}else{logger[_0xd21e('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd21e('0x29'),'clickatell',_0xd21e('0x64'));}break;case _0xd21e('0x69'):if(_0x122700[_0xd21e('0x2d')]&&_0x122700[_0xd21e('0x33')]){var _0x26eeb8=util['format'](_0xd21e('0x6a'),_0x122700[_0xd21e('0x2d')],_0x122700['password']);var _0x4dbbe5={'method':_0xd21e('0x35'),'uri':_0xd21e('0x6b')+_0x122700[_0xd21e('0x6c')]+_0xd21e('0x6d'),'body':{'to':[_0x280e02[_0xd21e('0x21')]],'text':_0x280e02['body'],'from':_0x122700['phone'],'applicationId':_0x122700[_0xd21e('0x6e')]},'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x26eeb8)[_0xd21e('0x4e')]('base64'))},'json':!![]};rp(_0x4dbbe5)[_0xd21e('0x1c')](function(_0x120cfa){if(_0x120cfa['id']){var _0x5dad58={'messageId':_0x120cfa['id']};return _0x5be567[_0xd21e('0x16')](_0x5dad58);}else{logger['error'](_0xd21e('0x28'),_0xd21e('0x29'),_0xd21e('0x69'),util[_0xd21e('0x2a')](_0x120cfa,{'showHidden':![],'depth':null}));}})[_0xd21e('0x18')](function(_0x54c2c0){logger[_0xd21e('0x19')](_0xd21e('0x28'),_0xd21e('0x29'),_0xd21e('0x69'),util['inspect'](_0x54c2c0,{'showHidden':![],'depth':null}));});}else{logger[_0xd21e('0x19')](_0xd21e('0x28'),_0xd21e('0x29'),'bandwidth',_0xd21e('0x3d'));}break;case'intelepeer':if(_0x122700['apiKey']){var _0x36877f={};var _0x3de19d={'method':_0xd21e('0x35'),'uri':_0xd21e('0x6f'),'headers':{'Authorization':'Bearer\x20'+_0x122700['apiKey'],'Content-Type':_0xd21e('0x70')},'body':{'from':_0x122700[_0xd21e('0x21')],'to':_0x280e02[_0xd21e('0x21')],'text':_0x280e02[_0xd21e('0x2e')]},'json':!![]};return rp(_0x3de19d)['then'](function(_0x10e3d6){if(_0x10e3d6['code']==0xca){_0x36877f[_0xd21e('0x71')]=_0x10e3d6;var _0x4ea067={'method':_0xd21e('0x35'),'uri':_0xd21e('0x72'),'headers':{'Authorization':_0xd21e('0x73')+_0x122700[_0xd21e('0x58')],'Content-Type':_0xd21e('0x70')},'body':{'refid':_0x36877f[_0xd21e('0x71')][_0xd21e('0x74')]},'json':!![]};return rp(_0x4ea067)[_0xd21e('0x1c')](function(_0xb5eedb){_0x36877f[_0xd21e('0x75')]=_0xb5eedb;var _0x29c9d6={'messageId':_0x36877f['message']['refid'],'read':!![]};return _0x5be567[_0xd21e('0x16')](_0x29c9d6);});}else{return logger[_0xd21e('0x19')](_0xd21e('0x28'),_0xd21e('0x29'),'intelepeer',util[_0xd21e('0x2a')](_0x10e3d6,{'showHidden':![],'depth':null}));}})[_0xd21e('0x18')](function(_0x2c622f){return logger[_0xd21e('0x19')](_0xd21e('0x28'),_0xd21e('0x29'),_0xd21e('0x76'),util[_0xd21e('0x2a')](_0x2c622f,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd21e('0x29'),_0xd21e('0x76'),_0xd21e('0x77'));}break;}}})[_0xd21e('0x78')](function(){_0x168ebd();});}else{_0x168ebd();}}},'charset':_0xd21e('0x79'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 7f1d590..9b827f9 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 _0xf010=['SmsMessage,\x20%s,\x20%s','message','result','catch','SmsMessage','create','body','options','CreateSmsMessage','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsMessage.socket','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xf010,0xf0));var _0x0f01=function(_0x21f9ec,_0x5daab0){_0x21f9ec=_0x21f9ec-0x0;var _0x20c32c=_0xf010[_0x21f9ec];return _0x20c32c;};'use strict';var _=require(_0x0f01('0x0'));var util=require(_0x0f01('0x1'));var moment=require('moment');var BPromise=require(_0x0f01('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f01('0x3'));var db=require(_0x0f01('0x4'))['db'];var utils=require(_0x0f01('0x5'));var logger=require(_0x0f01('0x6'))('rpc');var config=require(_0x0f01('0x7'));var jayson=require(_0x0f01('0x8'));var client=jayson[_0x0f01('0x9')][_0x0f01('0xa')]({'port':0x232a});config[_0x0f01('0xb')]=_['defaults'](config[_0x0f01('0xb')],{'host':_0x0f01('0xc'),'port':0x18eb});var socket=require(_0x0f01('0xd'))(new Redis(config[_0x0f01('0xb')]));require(_0x0f01('0xe'))['register'](socket);function respondWithRpcPromise(_0x353ad5,_0x3c3375,_0x333039){return new BPromise(function(_0x3f6df6,_0x4da3fe){return client[_0x0f01('0xf')](_0x353ad5,_0x333039)[_0x0f01('0x10')](function(_0xd298f7){logger[_0x0f01('0x11')]('SmsMessage,\x20%s,\x20%s',_0x3c3375,_0x0f01('0x12'));logger[_0x0f01('0x13')](_0x0f01('0x14'),_0x3c3375,'request\x20sent',JSON[_0x0f01('0x15')](_0xd298f7));if(_0xd298f7[_0x0f01('0x16')]){if(_0xd298f7[_0x0f01('0x16')][_0x0f01('0x17')]===0x1f4){logger[_0x0f01('0x16')](_0x0f01('0x18'),_0x3c3375,_0xd298f7['error'][_0x0f01('0x19')]);return _0x4da3fe(_0xd298f7[_0x0f01('0x16')][_0x0f01('0x19')]);}logger[_0x0f01('0x16')](_0x0f01('0x18'),_0x3c3375,_0xd298f7[_0x0f01('0x16')][_0x0f01('0x19')]);return _0x3f6df6(_0xd298f7[_0x0f01('0x16')]['message']);}else{logger[_0x0f01('0x11')](_0x0f01('0x18'),_0x3c3375,_0x0f01('0x12'));_0x3f6df6(_0xd298f7[_0x0f01('0x1a')][_0x0f01('0x19')]);}})[_0x0f01('0x1b')](function(_0x589dd9){logger[_0x0f01('0x16')](_0x0f01('0x18'),_0x3c3375,_0x589dd9);_0x4da3fe(_0x589dd9);});});}exports['CreateSmsMessage']=function(_0x473986){var _0x14c43a=this;return new Promise(function(_0x7fec2c,_0xbfdd55){return db[_0x0f01('0x1c')][_0x0f01('0x1d')](_0x473986[_0x0f01('0x1e')],{'raw':_0x473986[_0x0f01('0x1f')]?_0x473986[_0x0f01('0x1f')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x542212){logger[_0x0f01('0x11')](_0x0f01('0x20'),_0x473986);logger[_0x0f01('0x13')](_0x0f01('0x20'),_0x473986,JSON[_0x0f01('0x15')](_0x542212));_0x7fec2c(_0x542212);})[_0x0f01('0x1b')](function(_0x1ab2f8){logger['error'](_0x0f01('0x20'),_0x1ab2f8[_0x0f01('0x19')],_0x473986);_0xbfdd55(_0x14c43a[_0x0f01('0x16')](0x1f4,_0x1ab2f8['message']));});});}; \ No newline at end of file +var _0xb9e4=['create','body','options','CreateSmsMessage','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','SmsMessage'];(function(_0x678ed,_0x339833){var _0x2c709c=function(_0x167f12){while(--_0x167f12){_0x678ed['push'](_0x678ed['shift']());}};_0x2c709c(++_0x339833);}(_0xb9e4,0x163));var _0x4b9e=function(_0x480182,_0x3e9ab3){_0x480182=_0x480182-0x0;var _0x9554d4=_0xb9e4[_0x480182];return _0x9554d4;};'use strict';var _=require('lodash');var util=require(_0x4b9e('0x0'));var moment=require(_0x4b9e('0x1'));var BPromise=require(_0x4b9e('0x2'));var rs=require(_0x4b9e('0x3'));var fs=require('fs');var Redis=require(_0x4b9e('0x4'));var db=require(_0x4b9e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4b9e('0x6'))(_0x4b9e('0x7'));var config=require(_0x4b9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4b9e('0x9')][_0x4b9e('0xa')]({'port':0x232a});config['redis']=_[_0x4b9e('0xb')](config[_0x4b9e('0xc')],{'host':_0x4b9e('0xd'),'port':0x18eb});var socket=require(_0x4b9e('0xe'))(new Redis(config['redis']));require(_0x4b9e('0xf'))[_0x4b9e('0x10')](socket);function respondWithRpcPromise(_0xeb834e,_0xb1e43c,_0x3646ba){return new BPromise(function(_0x192e38,_0xef1c25){return client[_0x4b9e('0x11')](_0xeb834e,_0x3646ba)[_0x4b9e('0x12')](function(_0x149728){logger[_0x4b9e('0x13')]('SmsMessage,\x20%s,\x20%s',_0xb1e43c,_0x4b9e('0x14'));logger[_0x4b9e('0x15')](_0x4b9e('0x16'),_0xb1e43c,'request\x20sent',JSON['stringify'](_0x149728));if(_0x149728[_0x4b9e('0x17')]){if(_0x149728[_0x4b9e('0x17')][_0x4b9e('0x18')]===0x1f4){logger[_0x4b9e('0x17')](_0x4b9e('0x19'),_0xb1e43c,_0x149728[_0x4b9e('0x17')][_0x4b9e('0x1a')]);return _0xef1c25(_0x149728[_0x4b9e('0x17')][_0x4b9e('0x1a')]);}logger[_0x4b9e('0x17')]('SmsMessage,\x20%s,\x20%s',_0xb1e43c,_0x149728[_0x4b9e('0x17')][_0x4b9e('0x1a')]);return _0x192e38(_0x149728['error'][_0x4b9e('0x1a')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0xb1e43c,_0x4b9e('0x14'));_0x192e38(_0x149728[_0x4b9e('0x1b')][_0x4b9e('0x1a')]);}})[_0x4b9e('0x1c')](function(_0x1768d2){logger['error'](_0x4b9e('0x19'),_0xb1e43c,_0x1768d2);_0xef1c25(_0x1768d2);});});}exports['CreateSmsMessage']=function(_0x474537){var _0x5d7836=this;return new Promise(function(_0x38babb,_0x37b51e){return db[_0x4b9e('0x1d')][_0x4b9e('0x1e')](_0x474537[_0x4b9e('0x1f')],{'raw':_0x474537[_0x4b9e('0x20')]?_0x474537['options']['raw']===undefined?!![]:![]:!![]})[_0x4b9e('0x12')](function(_0x1d176f){logger[_0x4b9e('0x13')]('CreateSmsMessage',_0x474537);logger['debug'](_0x4b9e('0x21'),_0x474537,JSON[_0x4b9e('0x22')](_0x1d176f));_0x38babb(_0x1d176f);})[_0x4b9e('0x1c')](function(_0x27a060){logger[_0x4b9e('0x17')](_0x4b9e('0x21'),_0x27a060[_0x4b9e('0x1a')],_0x474537);_0x37b51e(_0x5d7836[_0x4b9e('0x17')](0x1f4,_0x27a060[_0x4b9e('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 3cb1954..aea1a9e 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 _0x5b5b=['removeListener','smsMessage:','./smsMessage.events','remove','update'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5b5b,0x13d));var _0xb5b5=function(_0x558e45,_0x4f5e4f){_0x558e45=_0x558e45-0x0;var _0x3e9075=_0x5b5b[_0x558e45];return _0x3e9075;};'use strict';var SmsMessageEvents=require(_0xb5b5('0x0'));var events=['save',_0xb5b5('0x1'),_0xb5b5('0x2')];function createListener(_0x164111,_0x7f3fb5){return function(_0x404bd5){_0x7f3fb5['emit'](_0x164111,_0x404bd5);};}function removeListener(_0x4b0274,_0x30facb){return function(){SmsMessageEvents[_0xb5b5('0x3')](_0x4b0274,_0x30facb);};}exports['register']=function(_0x417aaf){for(var _0x4d81b6=0x0,_0x325cce=events['length'];_0x4d81b6<_0x325cce;_0x4d81b6++){var _0x557b58=events[_0x4d81b6];var _0x3423fe=createListener(_0xb5b5('0x4')+_0x557b58,_0x417aaf);SmsMessageEvents['on'](_0x557b58,_0x3423fe);}}; \ No newline at end of file +var _0x994a=['length','smsMessage:','remove','update','register'];(function(_0x3ed26a,_0x1a9bac){var _0x350db5=function(_0x5c9a97){while(--_0x5c9a97){_0x3ed26a['push'](_0x3ed26a['shift']());}};_0x350db5(++_0x1a9bac);}(_0x994a,0x1b5));var _0xa994=function(_0x5c214c,_0x415e6f){_0x5c214c=_0x5c214c-0x0;var _0x9e37e=_0x994a[_0x5c214c];return _0x9e37e;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save',_0xa994('0x0'),_0xa994('0x1')];function createListener(_0x2496dd,_0x3eb5e0){return function(_0x1ee2c8){_0x3eb5e0['emit'](_0x2496dd,_0x1ee2c8);};}function removeListener(_0x245c7b,_0x1e2631){return function(){SmsMessageEvents['removeListener'](_0x245c7b,_0x1e2631);};}exports[_0xa994('0x2')]=function(_0x288795){for(var _0x3672a6=0x0,_0x2487ad=events[_0xa994('0x3')];_0x3672a6<_0x2487ad;_0x3672a6++){var _0x21ae9e=events[_0x3672a6];var _0x1533c4=createListener(_0xa994('0x4')+_0x21ae9e,_0x288795);SmsMessageEvents['on'](_0x21ae9e,_0x1533c4);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 6a3fd04..a76dde7 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 _0x0979=['Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','describe','/:id','show','/:id/members','getMembers','getTeams','getAgents','post','create','/:id/teams','addTeams','/:id/users','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','connect-timeout'];(function(_0x1cc0de,_0x53f4a0){var _0x2e2b8b=function(_0x1eac77){while(--_0x1eac77){_0x1cc0de['push'](_0x1cc0de['shift']());}};_0x2e2b8b(++_0x53f4a0);}(_0x0979,0x1a1));var _0x9097=function(_0x233cb1,_0x8ca9a2){_0x233cb1=_0x233cb1-0x0;var _0x29ee7e=_0x0979[_0x233cb1];return _0x29ee7e;};'use strict';var multer=require(_0x9097('0x0'));var util=require(_0x9097('0x1'));var path=require('path');var timeout=require(_0x9097('0x2'));var express=require('express');var router=express[_0x9097('0x3')]();var fs_extra=require(_0x9097('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9097('0x5'));var config=require(_0x9097('0x6'));var controller=require(_0x9097('0x7'));router[_0x9097('0x8')]('/',auth[_0x9097('0x9')](),controller['index']);router[_0x9097('0x8')]('/describe',auth[_0x9097('0x9')](),controller[_0x9097('0xa')]);router[_0x9097('0x8')](_0x9097('0xb'),auth['isAuthenticated'](),controller[_0x9097('0xc')]);router[_0x9097('0x8')](_0x9097('0xd'),auth[_0x9097('0x9')](),controller[_0x9097('0xe')]);router['get']('/:id/teams',auth[_0x9097('0x9')](),controller[_0x9097('0xf')]);router[_0x9097('0x8')]('/:id/users',auth[_0x9097('0x9')](),controller[_0x9097('0x10')]);router[_0x9097('0x11')]('/',auth[_0x9097('0x9')](),controller[_0x9097('0x12')]);router['post'](_0x9097('0x13'),auth[_0x9097('0x9')](),controller[_0x9097('0x14')]);router[_0x9097('0x11')](_0x9097('0x15'),auth[_0x9097('0x9')](),controller[_0x9097('0x16')]);router[_0x9097('0x17')](_0x9097('0xb'),auth[_0x9097('0x9')](),controller[_0x9097('0x18')]);router[_0x9097('0x19')](_0x9097('0xb'),auth[_0x9097('0x9')](),controller['destroy']);router['delete'](_0x9097('0x13'),auth[_0x9097('0x9')](),controller[_0x9097('0x1a')]);router['delete'](_0x9097('0x15'),auth[_0x9097('0x9')](),controller[_0x9097('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x4ae6=['connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','delete','destroy','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ae6,0x8f));var _0x64ae=function(_0x36219a,_0x332224){_0x36219a=_0x36219a-0x0;var _0x597a4d=_0x4ae6[_0x36219a];return _0x597a4d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x64ae('0x0'));var timeout=require(_0x64ae('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x64ae('0x2'));var interaction=require(_0x64ae('0x3'));var config=require(_0x64ae('0x4'));var controller=require(_0x64ae('0x5'));router['get']('/',auth[_0x64ae('0x6')](),controller[_0x64ae('0x7')]);router[_0x64ae('0x8')](_0x64ae('0x9'),auth[_0x64ae('0x6')](),controller['describe']);router[_0x64ae('0x8')](_0x64ae('0xa'),auth[_0x64ae('0x6')](),controller[_0x64ae('0xb')]);router['get'](_0x64ae('0xc'),auth['isAuthenticated'](),controller[_0x64ae('0xd')]);router['get'](_0x64ae('0xe'),auth[_0x64ae('0x6')](),controller[_0x64ae('0xf')]);router[_0x64ae('0x8')]('/:id/users',auth[_0x64ae('0x6')](),controller[_0x64ae('0x10')]);router[_0x64ae('0x11')]('/',auth['isAuthenticated'](),controller[_0x64ae('0x12')]);router['post'](_0x64ae('0xe'),auth[_0x64ae('0x6')](),controller[_0x64ae('0x13')]);router[_0x64ae('0x11')](_0x64ae('0x14'),auth[_0x64ae('0x6')](),controller[_0x64ae('0x15')]);router['put'](_0x64ae('0xa'),auth[_0x64ae('0x6')](),controller['update']);router[_0x64ae('0x16')](_0x64ae('0xa'),auth[_0x64ae('0x6')](),controller[_0x64ae('0x17')]);router['delete'](_0x64ae('0xe'),auth[_0x64ae('0x6')](),controller['removeTeams']);router[_0x64ae('0x16')](_0x64ae('0x14'),auth[_0x64ae('0x6')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 9fb546c..1cb7bcb 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 _0x3755=['name','ENUM','rrmemory','roundrobin','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3755,0x13f));var _0x5375=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3755[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x5375('0x0'));module[_0x5375('0x1')]={'name':{'type':Sequelize[_0x5375('0x2')],'unique':_0x5375('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5375('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5375('0x4')](_0x5375('0x5'),'beepall',_0x5375('0x6'))}}; \ No newline at end of file +var _0xaf6c=['INTEGER','ENUM','rrmemory','beepall','sequelize','STRING','name'];(function(_0x3b2d9b,_0x374369){var _0x4bf259=function(_0x46a6a4){while(--_0x46a6a4){_0x3b2d9b['push'](_0x3b2d9b['shift']());}};_0x4bf259(++_0x374369);}(_0xaf6c,0xf9));var _0xcaf6=function(_0x112290,_0x1cafbb){_0x112290=_0x112290-0x0;var _0x27d718=_0xaf6c[_0x112290];return _0x27d718;};'use strict';var Sequelize=require(_0xcaf6('0x0'));module['exports']={'name':{'type':Sequelize[_0xcaf6('0x1')],'unique':_0xcaf6('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcaf6('0x1')]},'timeout':{'type':Sequelize[_0xcaf6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcaf6('0x4')](_0xcaf6('0x5'),_0xcaf6('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index b3a2dc5..f4cf03d 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 _0x8603=['ejs','fs-extra','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','name','index','SmsQueue','rawAttributes','type','key','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','nolimit','SmsQueueId','filter','findAndCountAll','agent','smsPause','updatedAt','rows','%s/%s','getTeams','addTeams','Team','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','ids','User','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','QueryTypes','SELECT','TeamId','all','compact','value','removeTeams','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','to-csv'];(function(_0x292102,_0x427efa){var _0x54c775=function(_0x27a4b6){while(--_0x27a4b6){_0x292102['push'](_0x292102['shift']());}};_0x54c775(++_0x427efa);}(_0x8603,0x190));var _0x3860=function(_0x542c11,_0x35d5df){_0x542c11=_0x542c11-0x0;var _0xd5ba30=_0x8603[_0x542c11];return _0xd5ba30;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3860('0x0'));var rimraf=require(_0x3860('0x1'));var zipdir=require(_0x3860('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3860('0x3'));var BPromise=require(_0x3860('0x4'));var Mustache=require(_0x3860('0x5'));var util=require('util');var path=require(_0x3860('0x6'));var sox=require('sox');var csv=require(_0x3860('0x7'));var ejs=require(_0x3860('0x8'));var fs=require('fs');var fs_extra=require(_0x3860('0x9'));var _=require(_0x3860('0xa'));var squel=require(_0x3860('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3860('0x7'));var querystring=require(_0x3860('0xc'));var Papa=require('papaparse');var Redis=require(_0x3860('0xd'));var authService=require(_0x3860('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3860('0xf'));var hardwareService=require(_0x3860('0x10'));var logger=require('../../config/logger')(_0x3860('0x11'));var utils=require(_0x3860('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x3860('0x13'));var db=require(_0x3860('0x14'))['db'];config[_0x3860('0x15')]=_[_0x3860('0x16')](config[_0x3860('0x15')],{'host':_0x3860('0x17'),'port':0x18eb});var socket=require(_0x3860('0x18'))(new Redis(config[_0x3860('0x15')]));require(_0x3860('0x19'))[_0x3860('0x1a')](socket);function respondWithStatusCode(_0x54dbc3,_0x3d861d){_0x3d861d=_0x3d861d||0xcc;return function(_0x21eaf1){if(_0x21eaf1){return _0x54dbc3[_0x3860('0x1b')](_0x3d861d);}return _0x54dbc3[_0x3860('0x1c')](_0x3d861d)[_0x3860('0x1d')]();};}function respondWithResult(_0xfa0c9a,_0x2d8a3a){_0x2d8a3a=_0x2d8a3a||0xc8;return function(_0x378305){if(_0x378305){return _0xfa0c9a[_0x3860('0x1c')](_0x2d8a3a)[_0x3860('0x1e')](_0x378305);}};}function respondWithFilteredResult(_0x3e51b4,_0x45b799){return function(_0x4b6b15){if(_0x4b6b15){var _0x4863bd=_0x4b6b15['count'],_0x373b06=_0x45b799[_0x3860('0x1f')],_0x41ce59=_0x45b799[_0x3860('0x1f')]+_0x45b799[_0x3860('0x20')],_0x33caaf;if(_0x41ce59>=_0x4863bd){_0x41ce59=_0x4863bd;_0x33caaf=0xc8;}else{_0x33caaf=0xce;}_0x3e51b4[_0x3860('0x1c')](_0x33caaf);return _0x3e51b4[_0x3860('0x21')](_0x3860('0x22'),_0x373b06+'-'+_0x41ce59+'/'+_0x4863bd)[_0x3860('0x1e')](_0x4b6b15);}return null;};}function patchUpdates(_0x1f8891){return function(_0x21d179){try{jsonpatch[_0x3860('0x23')](_0x21d179,_0x1f8891,!![]);}catch(_0xacd57f){return BPromise[_0x3860('0x24')](_0xacd57f);}return _0x21d179[_0x3860('0x25')]();};}function saveUpdates(_0x9eaaa1,_0xd33a51){return function(_0x564efd){if(_0x564efd){return _0x564efd[_0x3860('0x26')](_0x9eaaa1)[_0x3860('0x27')](function(_0x2b91f2){return _0x2b91f2;});}return null;};}function removeEntity(_0x301e03,_0x20bb1e){return function(_0x56a6d1){if(_0x56a6d1){return _0x56a6d1[_0x3860('0x28')]()['then'](function(){var _0x577750=_0x56a6d1[_0x3860('0x29')]({'plain':!![]});var _0x1c4bbc='SmsQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x1c4bbc,'resourceId':_0x577750['id']}})[_0x3860('0x27')](function(){return _0x56a6d1;});})[_0x3860('0x27')](function(){_0x301e03[_0x3860('0x1c')](0xcc)[_0x3860('0x1d')]();});}};}function handleEntityNotFound(_0x9332a5,_0x228d34){return function(_0x544b9a){if(!_0x544b9a){_0x9332a5['sendStatus'](0x194);}return _0x544b9a;};}function handleError(_0x389bd0,_0x1f1809){_0x1f1809=_0x1f1809||0x1f4;return function(_0x5a9af2){logger[_0x3860('0x2a')](_0x5a9af2[_0x3860('0x2b')]);if(_0x5a9af2[_0x3860('0x2c')]){delete _0x5a9af2[_0x3860('0x2c')];}_0x389bd0[_0x3860('0x1c')](_0x1f1809)['send'](_0x5a9af2);};}exports[_0x3860('0x2d')]=function(_0xf624ba,_0x367b14){var _0x4bd90c={},_0x45d24f={},_0x5e25ce={'count':0x0,'rows':[]};var _0x294b3a=_['map'](db[_0x3860('0x2e')][_0x3860('0x2f')],function(_0x24cf39){return{'name':_0x24cf39['fieldName'],'type':_0x24cf39[_0x3860('0x30')][_0x3860('0x31')]};});_0x45d24f['model']=_[_0x3860('0x32')](_0x294b3a,'name');_0x45d24f[_0x3860('0x33')]=_[_0x3860('0x34')](_0xf624ba[_0x3860('0x33')]);_0x45d24f[_0x3860('0x35')]=_[_0x3860('0x36')](_0x45d24f[_0x3860('0x37')],_0x45d24f[_0x3860('0x33')]);_0x4bd90c['attributes']=_[_0x3860('0x36')](_0x45d24f[_0x3860('0x37')],qs['fields'](_0xf624ba[_0x3860('0x33')][_0x3860('0x38')]));_0x4bd90c[_0x3860('0x39')]=_0x4bd90c['attributes']['length']?_0x4bd90c[_0x3860('0x39')]:_0x45d24f[_0x3860('0x37')];if(!_0xf624ba[_0x3860('0x33')][_0x3860('0x3a')]('nolimit')){_0x4bd90c['limit']=qs[_0x3860('0x20')](_0xf624ba[_0x3860('0x33')][_0x3860('0x20')]);_0x4bd90c[_0x3860('0x1f')]=qs[_0x3860('0x1f')](_0xf624ba['query'][_0x3860('0x1f')]);}_0x4bd90c[_0x3860('0x3b')]=qs['sort'](_0xf624ba['query'][_0x3860('0x3c')]);_0x4bd90c[_0x3860('0x3d')]=qs[_0x3860('0x35')](_[_0x3860('0x3e')](_0xf624ba[_0x3860('0x33')],_0x45d24f['filters']),_0x294b3a);if(_0xf624ba[_0x3860('0x33')]['filter']){_0x4bd90c[_0x3860('0x3d')]=_[_0x3860('0x3f')](_0x4bd90c['where'],{'$or':_[_0x3860('0x32')](_0x294b3a,function(_0x162e65){if(_0x162e65['type']!==_0x3860('0x40')){var _0xc7d34d={};_0xc7d34d[_0x162e65[_0x3860('0x2c')]]={'$like':'%'+_0xf624ba[_0x3860('0x33')]['filter']+'%'};return _0xc7d34d;}})});}_0x4bd90c=_[_0x3860('0x3f')]({},_0x4bd90c,_0xf624ba[_0x3860('0x41')]);var _0xd3896f={'where':_0x4bd90c['where']};return db[_0x3860('0x2e')]['count'](_0xd3896f)[_0x3860('0x27')](function(_0x424801){_0x5e25ce[_0x3860('0x42')]=_0x424801;if(_0xf624ba[_0x3860('0x33')][_0x3860('0x43')]){_0x4bd90c[_0x3860('0x44')]=[{'all':!![]}];}return db['SmsQueue'][_0x3860('0x45')](_0x4bd90c);})[_0x3860('0x27')](function(_0x5dc78f){_0x5e25ce['rows']=_0x5dc78f;return _0x5e25ce;})[_0x3860('0x27')](respondWithFilteredResult(_0x367b14,_0x4bd90c))[_0x3860('0x46')](handleError(_0x367b14,null));};exports['show']=function(_0x164a77,_0x30d8eb){var _0x4c6c23={'raw':!![],'where':{'id':_0x164a77[_0x3860('0x47')]['id']}},_0xa6791a={};_0xa6791a[_0x3860('0x37')]=_[_0x3860('0x34')](db[_0x3860('0x2e')][_0x3860('0x2f')]);_0xa6791a[_0x3860('0x33')]=_[_0x3860('0x34')](_0x164a77[_0x3860('0x33')]);_0xa6791a[_0x3860('0x35')]=_[_0x3860('0x36')](_0xa6791a[_0x3860('0x37')],_0xa6791a[_0x3860('0x33')]);_0x4c6c23['attributes']=_[_0x3860('0x36')](_0xa6791a['model'],qs[_0x3860('0x38')](_0x164a77[_0x3860('0x33')][_0x3860('0x38')]));_0x4c6c23[_0x3860('0x39')]=_0x4c6c23[_0x3860('0x39')][_0x3860('0x48')]?_0x4c6c23[_0x3860('0x39')]:_0xa6791a[_0x3860('0x37')];if(_0x164a77['query'][_0x3860('0x43')]){_0x4c6c23[_0x3860('0x44')]=[{'all':!![]}];}_0x4c6c23=_[_0x3860('0x3f')]({},_0x4c6c23,_0x164a77['options']);return db[_0x3860('0x2e')][_0x3860('0x49')](_0x4c6c23)[_0x3860('0x27')](handleEntityNotFound(_0x30d8eb,null))[_0x3860('0x27')](respondWithResult(_0x30d8eb,null))['catch'](handleError(_0x30d8eb,null));};exports['create']=function(_0x228538,_0x480a08){return db[_0x3860('0x2e')][_0x3860('0x4a')](_0x228538[_0x3860('0x4b')],{})['then'](function(_0x29c52d){var _0x5a019a=_0x228538[_0x3860('0x4c')]['get']({'plain':!![]});if(!_0x5a019a)throw new Error(_0x3860('0x4d'));if(_0x5a019a[_0x3860('0x4e')]===_0x3860('0x4c')){var _0x4b5790=_0x29c52d['get']({'plain':!![]});var _0x4408b5=_0x3860('0x4f');return db['UserProfileSection'][_0x3860('0x49')]({'where':{'name':_0x4408b5,'userProfileId':_0x5a019a['userProfileId']},'raw':!![]})[_0x3860('0x27')](function(_0x1267e1){if(_0x1267e1&&_0x1267e1[_0x3860('0x50')]===0x0){return db[_0x3860('0x51')][_0x3860('0x4a')]({'name':_0x4b5790[_0x3860('0x2c')],'resourceId':_0x4b5790['id'],'type':_0x1267e1[_0x3860('0x2c')],'sectionId':_0x1267e1['id']},{})['then'](function(){return _0x29c52d;});}else{return _0x29c52d;}})[_0x3860('0x46')](function(_0x73222c){logger[_0x3860('0x2a')](_0x3860('0x52'),_0x73222c);throw _0x73222c;});}return _0x29c52d;})[_0x3860('0x27')](respondWithResult(_0x480a08,0xc9))[_0x3860('0x46')](handleError(_0x480a08,null));};exports['update']=function(_0x2cf48c,_0x3ed276){if(_0x2cf48c[_0x3860('0x4b')]['id']){delete _0x2cf48c[_0x3860('0x4b')]['id'];}return db[_0x3860('0x2e')][_0x3860('0x49')]({'where':{'id':_0x2cf48c[_0x3860('0x47')]['id']}})[_0x3860('0x27')](handleEntityNotFound(_0x3ed276,null))['then'](saveUpdates(_0x2cf48c[_0x3860('0x4b')],null))[_0x3860('0x27')](respondWithResult(_0x3ed276,null))['catch'](handleError(_0x3ed276,null));};exports[_0x3860('0x28')]=function(_0x275df2,_0x2bebd8){return db['SmsQueue'][_0x3860('0x49')]({'where':{'id':_0x275df2['params']['id']}})[_0x3860('0x27')](handleEntityNotFound(_0x2bebd8,null))[_0x3860('0x27')](removeEntity(_0x2bebd8,null))[_0x3860('0x46')](handleError(_0x2bebd8,null));};exports[_0x3860('0x53')]=function(_0x27a853,_0x1cee19){return db[_0x3860('0x2e')][_0x3860('0x53')]()[_0x3860('0x27')](respondWithResult(_0x1cee19,null))[_0x3860('0x46')](handleError(_0x1cee19,null));};exports[_0x3860('0x54')]=function(_0x2bac24,_0x58147d,_0x5ce9a4){var _0x5111e0={'raw':!![],'where':{}},_0x5fbea0={},_0x572e29;return db['SmsQueue'][_0x3860('0x55')]({'where':{'id':_0x2bac24[_0x3860('0x47')]['id']}})[_0x3860('0x27')](handleEntityNotFound(_0x58147d,null))[_0x3860('0x27')](function(_0x3d6c17){if(_0x3d6c17){_0x572e29=_0x3d6c17[_0x3860('0x29')]({'plain':!![]});_0x5fbea0['model']=_['keys'](db['UserSmsQueue'][_0x3860('0x2f')]);_0x5fbea0[_0x3860('0x33')]=_[_0x3860('0x34')](_0x2bac24['query']);_0x5fbea0[_0x3860('0x35')]=_['intersection'](_0x5fbea0[_0x3860('0x37')],_0x5fbea0[_0x3860('0x33')]);_0x5111e0['attributes']=_[_0x3860('0x36')](_0x5fbea0[_0x3860('0x37')],qs[_0x3860('0x38')](_0x2bac24[_0x3860('0x33')]['fields']));_0x5111e0[_0x3860('0x39')]=_0x5111e0[_0x3860('0x39')][_0x3860('0x48')]?_0x5111e0['attributes']:_0x5fbea0['model'];if(!_0x2bac24[_0x3860('0x33')][_0x3860('0x3a')](_0x3860('0x56'))){_0x5111e0[_0x3860('0x20')]=qs[_0x3860('0x20')](_0x2bac24[_0x3860('0x33')]['limit']);_0x5111e0[_0x3860('0x1f')]=qs[_0x3860('0x1f')](_0x2bac24['query'][_0x3860('0x1f')]);}_0x5111e0[_0x3860('0x3b')]=qs[_0x3860('0x3c')](_0x2bac24[_0x3860('0x33')][_0x3860('0x3c')]);_0x5111e0[_0x3860('0x3d')]=qs['filters'](_[_0x3860('0x3e')](_0x2bac24[_0x3860('0x33')],_0x5fbea0[_0x3860('0x35')]));_0x5111e0[_0x3860('0x3d')][_0x3860('0x57')]=_0x3d6c17['id'];if(_0x2bac24[_0x3860('0x33')]['filter']){_0x5111e0[_0x3860('0x3d')]=_[_0x3860('0x3f')](_0x5111e0[_0x3860('0x3d')],{'$or':_['map'](_0x5111e0['attributes'],function(_0x150657){var _0x2d425d={};_0x2d425d[_0x150657]={'$like':'%'+_0x2bac24[_0x3860('0x33')][_0x3860('0x58')]+'%'};return _0x2d425d;})});}_0x5111e0=_[_0x3860('0x3f')]({},_0x5111e0,_0x2bac24['options']);return db['UserSmsQueue'][_0x3860('0x45')](_0x5111e0);}})[_0x3860('0x27')](function(_0x47e144){if(_0x47e144){return db['User'][_0x3860('0x59')]({'where':{'id':_[_0x3860('0x32')](_0x47e144,'UserId'),'role':_0x3860('0x5a')},'attributes':['id',_0x3860('0x2c'),_0x3860('0x5b'),_0x3860('0x5c'),'createdAt']});}})[_0x3860('0x27')](function(_0x215f81){if(_0x215f81){return{'count':_0x215f81['count'],'rows':_['map'](_0x215f81[_0x3860('0x5d')],function(_0x3427a5){return{'membername':_0x3427a5['name'],'UserId':_0x3427a5['id'],'queue_name':_0x572e29[_0x3860('0x2c')],'SmsQueueId':_0x572e29['id'],'interface':util['format'](_0x3860('0x5e'),'SIP',_0x3427a5['name']),'penalty':0x0,'paused':_0x3427a5[_0x3860('0x5b')],'createdAt':_0x3427a5['createdAt'],'updatedAt':_0x3427a5[_0x3860('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3860('0x27')](respondWithFilteredResult(_0x58147d,_0x5111e0))[_0x3860('0x46')](handleError(_0x58147d,null));};exports[_0x3860('0x5f')]=function(_0x19f717,_0x43c5a1,_0x4b3447){var _0x3756b3={};var _0x297321={};var _0x3b5b6f;var _0x5d7cc4;return db[_0x3860('0x2e')]['findOne']({'where':{'id':_0x19f717[_0x3860('0x47')]['id']}})[_0x3860('0x27')](handleEntityNotFound(_0x43c5a1,null))['then'](function(_0x73732c){if(_0x73732c){_0x3b5b6f=_0x73732c;_0x297321[_0x3860('0x37')]=_[_0x3860('0x34')](db['Team']['rawAttributes']);_0x297321['query']=_['keys'](_0x19f717[_0x3860('0x33')]);_0x297321[_0x3860('0x35')]=_[_0x3860('0x36')](_0x297321[_0x3860('0x37')],_0x297321['query']);_0x3756b3['attributes']=_[_0x3860('0x36')](_0x297321[_0x3860('0x37')],qs[_0x3860('0x38')](_0x19f717[_0x3860('0x33')]['fields']));_0x3756b3[_0x3860('0x39')]=_0x3756b3[_0x3860('0x39')]['length']?_0x3756b3['attributes']:_0x297321[_0x3860('0x37')];_0x3756b3[_0x3860('0x3b')]=qs[_0x3860('0x3c')](_0x19f717[_0x3860('0x33')]['sort']);_0x3756b3['where']=qs[_0x3860('0x35')](_['pick'](_0x19f717[_0x3860('0x33')],_0x297321[_0x3860('0x35')]));if(_0x19f717['query']['filter']){_0x3756b3['where']=_[_0x3860('0x3f')](_0x3756b3[_0x3860('0x3d')],{'$or':_['map'](_0x3756b3[_0x3860('0x39')],function(_0x1371b5){var _0x2351fe={};_0x2351fe[_0x1371b5]={'$like':'%'+_0x19f717[_0x3860('0x33')][_0x3860('0x58')]+'%'};return _0x2351fe;})});}_0x3756b3=_['merge']({},_0x3756b3,_0x19f717[_0x3860('0x41')]);return _0x3b5b6f[_0x3860('0x5f')](_0x3756b3);}})[_0x3860('0x27')](function(_0x35a2b1){if(_0x35a2b1){_0x5d7cc4=_0x35a2b1[_0x3860('0x48')];if(!_0x19f717['query'][_0x3860('0x3a')](_0x3860('0x56'))){_0x3756b3[_0x3860('0x20')]=qs[_0x3860('0x20')](_0x19f717[_0x3860('0x33')]['limit']);_0x3756b3['offset']=qs[_0x3860('0x1f')](_0x19f717[_0x3860('0x33')][_0x3860('0x1f')]);}return _0x3b5b6f[_0x3860('0x5f')](_0x3756b3);}})[_0x3860('0x27')](function(_0x293c60){if(_0x293c60){return _0x293c60?{'count':_0x5d7cc4,'rows':_0x293c60}:null;}})[_0x3860('0x27')](respondWithResult(_0x43c5a1,null))['catch'](handleError(_0x43c5a1,null));};exports[_0x3860('0x60')]=function(_0x3eb292,_0x58eddd,_0x1ff95b){var _0x2f70fa=_0x3eb292[_0x3860('0x4b')]['ids'];return db[_0x3860('0x61')][_0x3860('0x45')]({'where':{'id':_0x2f70fa},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3860('0x62'),'attributes':['id','name',_0x3860('0x63'),_0x3860('0x64'),'interface'],'raw':!![]}]})[_0x3860('0x27')](function(_0x2dc788){if(_0x2dc788){var _0x361113=_[_0x3860('0x65')](_0x2dc788,function(_0x115d49){var _0x5d37e4=_0x115d49[_0x3860('0x29')]({'plain':!![]});return _0x5d37e4[_0x3860('0x62')];});return db[_0x3860('0x2e')][_0x3860('0x49')]({'where':{'id':_0x3eb292[_0x3860('0x47')]['id']}})['then'](function(_0x490359){return db[_0x3860('0x66')][_0x3860('0x67')](function(_0x50bb73){return _0x490359[_0x3860('0x60')](_0x2f70fa,{'transaction':_0x50bb73})[_0x3860('0x27')](function(){return BPromise[_0x3860('0x68')](_0x361113,function(_0x9d8eca){return db['UserSmsQueue'][_0x3860('0x69')]({'where':{'UserId':_0x9d8eca['id'],'SmsQueueId':_0x3eb292['params']['id']},'transaction':_0x50bb73});});})[_0x3860('0x27')](function(){_0x361113[_0x3860('0x6a')](function(_0x405fb8){socket[_0x3860('0x6b')](_0x3860('0x6c'),{'UserId':_0x405fb8['id'],'SmsQueueId':_0x490359['id']});});});});});}})[_0x3860('0x27')](respondWithStatusCode(_0x58eddd,null))[_0x3860('0x46')](handleError(_0x58eddd,null));};exports['removeTeams']=function(_0x277aba,_0x47396d,_0x4ae542){return db['Team']['findAll']({'where':{'id':_0x277aba['query'][_0x3860('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x3860('0x6e')],'as':_0x3860('0x62'),'attributes':['id'],'raw':!![]}]})[_0x3860('0x27')](handleEntityNotFound(_0x47396d,null))[_0x3860('0x27')](function(_0xb3ce3b){var _0x51999d=_[_0x3860('0x32')](_0xb3ce3b,'id');var _0x5e2959=[];var _0x355f56=[];var _0x3b1683=squel[_0x3860('0x6f')]();_0x3b1683[_0x3860('0x70')](_0x3860('0x71'))[_0x3860('0x72')](_0x3860('0x73'),'tq')[_0x3860('0x74')](_0x3860('0x75'),'ut',_0x3860('0x76'))[_0x3860('0x3d')]('SmsQueueId\x20=\x20?',_0x277aba[_0x3860('0x47')]['id']);for(var _0x304c95=0x0;_0x304c95<_0xb3ce3b[_0x3860('0x48')];_0x304c95+=0x1){let _0x5c8a14=_0xb3ce3b[_0x304c95];for(var _0xf370f9=0x0;_0xf370f9<_0x5c8a14[_0x3860('0x62')][_0x3860('0x48')];_0xf370f9+=0x1){let _0x3d4469=_0x5c8a14['Agents'][_0xf370f9];var _0x16a462=_0x3b1683[_0x3860('0x77')]();_0x16a462[_0x3860('0x3d')]('ut.UserId\x20=\x20?',_0x3d4469['id']);_0x355f56[_0x3860('0x78')](db[_0x3860('0x66')][_0x3860('0x33')](_0x16a462['toString'](),{'type':db[_0x3860('0x66')][_0x3860('0x79')][_0x3860('0x7a')]})['then'](function(_0x11d103){if(_0x11d103[_0x3860('0x48')]===0x1){return _0x3d4469['id'];}else{var _0x204a10=_['every'](_[_0x3860('0x32')](_0x11d103,_0x3860('0x7b')),function(_0x1b8060){return _['includes'](_0x51999d,_0x1b8060);});if(_0x204a10){return _0x3d4469['id'];}}}));}}return BPromise[_0x3860('0x7c')](_0x355f56)['then'](function(_0x2e836e){_0x5e2959=_(_0x5e2959)['union'](_0x2e836e)[_0x3860('0x7d')]()[_0x3860('0x7e')]();return db[_0x3860('0x2e')][_0x3860('0x49')]({'where':{'id':_0x277aba[_0x3860('0x47')]['id']}})[_0x3860('0x27')](function(_0x437a95){return db[_0x3860('0x66')][_0x3860('0x67')](function(_0x1de607){return _0x437a95[_0x3860('0x7f')](_0x277aba[_0x3860('0x33')][_0x3860('0x6d')],{'transaction':_0x1de607})[_0x3860('0x27')](function(){if(!_[_0x3860('0x80')](_0x5e2959)){return _0x437a95[_0x3860('0x81')](_0x5e2959,{'transaction':_0x1de607});}})[_0x3860('0x27')](function(){_0x5e2959[_0x3860('0x6a')](function(_0x47ebbd){socket[_0x3860('0x6b')](_0x3860('0x82'),{'UserId':_0x47ebbd,'SmsQueueId':_0x437a95['id']});});});});});});})[_0x3860('0x27')](respondWithStatusCode(_0x47396d,null))[_0x3860('0x46')](handleError(_0x47396d,null));};exports[_0x3860('0x83')]=function(_0x27802b,_0xffe2a1,_0x130249){return db[_0x3860('0x2e')][_0x3860('0x49')]({'where':{'id':_0x27802b[_0x3860('0x47')]['id']}})['then'](handleEntityNotFound(_0xffe2a1,null))[_0x3860('0x27')](function(_0x1746cd){if(_0x1746cd){return _0x1746cd[_0x3860('0x83')](_0x27802b[_0x3860('0x4b')]['ids'],_[_0x3860('0x84')](_0x27802b[_0x3860('0x4b')],[_0x3860('0x6d'),'id'])||{})[_0x3860('0x85')](function(_0x4fbb64){for(var _0x280747=0x0;_0x280747<_0x27802b['body']['ids'][_0x3860('0x48')];_0x280747+=0x1){socket[_0x3860('0x6b')](_0x3860('0x6c'),{'UserId':_0x27802b[_0x3860('0x4b')][_0x3860('0x6d')][_0x280747],'SmsQueueId':_0x27802b[_0x3860('0x47')]['id']});}return _0x4fbb64;});}})[_0x3860('0x27')](respondWithResult(_0xffe2a1,null))[_0x3860('0x46')](handleError(_0xffe2a1,null));};exports[_0x3860('0x81')]=function(_0x468e83,_0x4677b0,_0x559c){return db[_0x3860('0x2e')]['find']({'where':{'id':_0x468e83[_0x3860('0x47')]['id']}})['then'](handleEntityNotFound(_0x4677b0,null))[_0x3860('0x27')](function(_0xfaaf41){if(_0xfaaf41){return _0xfaaf41['removeAgents'](_0x468e83[_0x3860('0x33')][_0x3860('0x6d')])[_0x3860('0x27')](function(){if(_[_0x3860('0x86')](_0x468e83[_0x3860('0x33')][_0x3860('0x6d')])){for(var _0x12296a=0x0;_0x12296a<_0x468e83['query'][_0x3860('0x6d')][_0x3860('0x48')];_0x12296a+=0x1){socket[_0x3860('0x6b')](_0x3860('0x82'),{'UserId':Number(_0x468e83[_0x3860('0x33')]['ids'][_0x12296a]),'SmsQueueId':Number(_0x468e83[_0x3860('0x47')]['id'])});}}else{socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x468e83['query'][_0x3860('0x6d')]),'SmsQueueId':Number(_0x468e83[_0x3860('0x47')]['id'])});}});}})[_0x3860('0x27')](respondWithStatusCode(_0x4677b0,null))[_0x3860('0x46')](handleError(_0x4677b0,null));};exports[_0x3860('0x87')]=function(_0x276a75,_0x270ca1,_0xe24a1d){var _0x59c203={};var _0x3c738a={};var _0x2a7ed5;var _0x5df190;return db['SmsQueue'][_0x3860('0x55')]({'where':{'id':_0x276a75[_0x3860('0x47')]['id']}})[_0x3860('0x27')](handleEntityNotFound(_0x270ca1,null))['then'](function(_0x1fe2d8){if(_0x1fe2d8){_0x2a7ed5=_0x1fe2d8;_0x3c738a['model']=_[_0x3860('0x34')](db['User'][_0x3860('0x2f')]);_0x3c738a[_0x3860('0x33')]=_['keys'](_0x276a75[_0x3860('0x33')]);_0x3c738a[_0x3860('0x35')]=_['intersection'](_0x3c738a[_0x3860('0x37')],_0x3c738a[_0x3860('0x33')]);_0x59c203[_0x3860('0x39')]=_['intersection'](_0x3c738a[_0x3860('0x37')],qs['fields'](_0x276a75[_0x3860('0x33')][_0x3860('0x38')]));_0x59c203['attributes']=_0x59c203[_0x3860('0x39')][_0x3860('0x48')]?_0x59c203[_0x3860('0x39')]:_0x3c738a[_0x3860('0x37')];_0x59c203[_0x3860('0x3b')]=qs['sort'](_0x276a75[_0x3860('0x33')][_0x3860('0x3c')]);_0x59c203['where']=qs['filters'](_[_0x3860('0x3e')](_0x276a75['query'],_0x3c738a[_0x3860('0x35')]));if(_0x276a75[_0x3860('0x33')]['filter']){_0x59c203[_0x3860('0x3d')]=_['merge'](_0x59c203[_0x3860('0x3d')],{'$or':_['map'](_0x59c203[_0x3860('0x39')],function(_0x24788d){var _0x2175d7={};_0x2175d7[_0x24788d]={'$like':'%'+_0x276a75[_0x3860('0x33')]['filter']+'%'};return _0x2175d7;})});}_0x59c203=_[_0x3860('0x3f')]({},_0x59c203,_0x276a75[_0x3860('0x41')]);return _0x2a7ed5[_0x3860('0x87')](_0x59c203);}})[_0x3860('0x27')](function(_0x4b7f2a){if(_0x4b7f2a){_0x5df190=_0x4b7f2a[_0x3860('0x48')];if(!_0x276a75[_0x3860('0x33')]['hasOwnProperty'](_0x3860('0x56'))){_0x59c203[_0x3860('0x20')]=qs[_0x3860('0x20')](_0x276a75[_0x3860('0x33')]['limit']);_0x59c203[_0x3860('0x1f')]=qs[_0x3860('0x1f')](_0x276a75[_0x3860('0x33')][_0x3860('0x1f')]);}return _0x2a7ed5['getAgents'](_0x59c203);}})[_0x3860('0x27')](function(_0x50f408){if(_0x50f408){return _0x50f408?{'count':_0x5df190,'rows':_0x50f408}:null;}})['then'](respondWithResult(_0x270ca1,null))['catch'](handleError(_0x270ca1,null));}; \ No newline at end of file +var _0x9ffd=['online','voicePause','interface','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','union','value','removeTeams','removeAgents','userSmsQueue:remove','addAgents','omit','userSmsQueue:save','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','status','json','count','offset','limit','Content-Range','reject','update','then','get','SmsQueues','UserProfileResource','destroy','end','sendStatus','error','stack','name','index','map','SmsQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','merge','type','VIRTUAL','options','where','includeAll','include','findAll','catch','show','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserSmsQueue','nolimit','pick','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','rows','format','SIP','createdAt','getTeams','Team','addTeams','ids'];(function(_0x60f018,_0x2ea2cb){var _0x2f759f=function(_0x5b8a8f){while(--_0x5b8a8f){_0x60f018['push'](_0x60f018['shift']());}};_0x2f759f(++_0x2ea2cb);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x2d4b8d,_0x362e72){_0x2d4b8d=_0x2d4b8d-0x0;var _0x419e59=_0x9ffd[_0x2d4b8d];return _0x419e59;};'use strict';var pdf=require(_0xd9ff('0x0'));var emlformat=require(_0xd9ff('0x1'));var rimraf=require(_0xd9ff('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd9ff('0x3'));var rp=require(_0xd9ff('0x4'));var moment=require(_0xd9ff('0x5'));var BPromise=require(_0xd9ff('0x6'));var Mustache=require('mustache');var util=require(_0xd9ff('0x7'));var path=require(_0xd9ff('0x8'));var sox=require('sox');var csv=require(_0xd9ff('0x9'));var ejs=require(_0xd9ff('0xa'));var fs=require('fs');var fs_extra=require(_0xd9ff('0xb'));var _=require(_0xd9ff('0xc'));var squel=require(_0xd9ff('0xd'));var crypto=require(_0xd9ff('0xe'));var jsforce=require(_0xd9ff('0xf'));var deskjs=require(_0xd9ff('0x10'));var toCsv=require(_0xd9ff('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd9ff('0x11'));var as=require(_0xd9ff('0x12'));var hardwareService=require(_0xd9ff('0x13'));var logger=require(_0xd9ff('0x14'))(_0xd9ff('0x15'));var utils=require(_0xd9ff('0x16'));var config=require(_0xd9ff('0x17'));var licenseUtil=require(_0xd9ff('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xd9ff('0x19')](config[_0xd9ff('0x1a')],{'host':_0xd9ff('0x1b'),'port':0x18eb});var socket=require(_0xd9ff('0x1c'))(new Redis(config[_0xd9ff('0x1a')]));require('./smsQueue.socket')[_0xd9ff('0x1d')](socket);function respondWithStatusCode(_0x3c9ace,_0x5c1a28){_0x5c1a28=_0x5c1a28||0xcc;return function(_0xf14c9f){if(_0xf14c9f){return _0x3c9ace['sendStatus'](_0x5c1a28);}return _0x3c9ace['status'](_0x5c1a28)['end']();};}function respondWithResult(_0x4c5718,_0x271287){_0x271287=_0x271287||0xc8;return function(_0x4f9d6d){if(_0x4f9d6d){return _0x4c5718[_0xd9ff('0x1e')](_0x271287)[_0xd9ff('0x1f')](_0x4f9d6d);}};}function respondWithFilteredResult(_0x39c6ce,_0x3afd19){return function(_0x5f45c4){if(_0x5f45c4){var _0x2d4df1=_0x5f45c4[_0xd9ff('0x20')],_0x3ccf15=_0x3afd19[_0xd9ff('0x21')],_0x128588=_0x3afd19[_0xd9ff('0x21')]+_0x3afd19[_0xd9ff('0x22')],_0x182775;if(_0x128588>=_0x2d4df1){_0x128588=_0x2d4df1;_0x182775=0xc8;}else{_0x182775=0xce;}_0x39c6ce['status'](_0x182775);return _0x39c6ce['set'](_0xd9ff('0x23'),_0x3ccf15+'-'+_0x128588+'/'+_0x2d4df1)[_0xd9ff('0x1f')](_0x5f45c4);}return null;};}function patchUpdates(_0x4eea4d){return function(_0x588151){try{jsonpatch['apply'](_0x588151,_0x4eea4d,!![]);}catch(_0x4b1477){return BPromise[_0xd9ff('0x24')](_0x4b1477);}return _0x588151['save']();};}function saveUpdates(_0x4c486a,_0x3fd141){return function(_0x291f52){if(_0x291f52){return _0x291f52[_0xd9ff('0x25')](_0x4c486a)[_0xd9ff('0x26')](function(_0x42a828){return _0x42a828;});}return null;};}function removeEntity(_0x4b058a,_0x4fada1){return function(_0x1136e9){if(_0x1136e9){return _0x1136e9['destroy']()[_0xd9ff('0x26')](function(){var _0x4d86fe=_0x1136e9[_0xd9ff('0x27')]({'plain':!![]});var _0x5d45b3=_0xd9ff('0x28');return db[_0xd9ff('0x29')][_0xd9ff('0x2a')]({'where':{'type':_0x5d45b3,'resourceId':_0x4d86fe['id']}})[_0xd9ff('0x26')](function(){return _0x1136e9;});})['then'](function(){_0x4b058a[_0xd9ff('0x1e')](0xcc)[_0xd9ff('0x2b')]();});}};}function handleEntityNotFound(_0x1c78c4,_0x4390f7){return function(_0x5c1c1f){if(!_0x5c1c1f){_0x1c78c4[_0xd9ff('0x2c')](0x194);}return _0x5c1c1f;};}function handleError(_0x3792d9,_0x44b5a7){_0x44b5a7=_0x44b5a7||0x1f4;return function(_0x45fb63){logger[_0xd9ff('0x2d')](_0x45fb63[_0xd9ff('0x2e')]);if(_0x45fb63[_0xd9ff('0x2f')]){delete _0x45fb63[_0xd9ff('0x2f')];}_0x3792d9[_0xd9ff('0x1e')](_0x44b5a7)['send'](_0x45fb63);};}exports[_0xd9ff('0x30')]=function(_0x4ba2be,_0x1d55fd){var _0x29c532={},_0xbdd352={},_0x552d08={'count':0x0,'rows':[]};var _0x2ba4d3=_[_0xd9ff('0x31')](db[_0xd9ff('0x32')][_0xd9ff('0x33')],function(_0x509291){return{'name':_0x509291[_0xd9ff('0x34')],'type':_0x509291['type'][_0xd9ff('0x35')]};});_0xbdd352[_0xd9ff('0x36')]=_[_0xd9ff('0x31')](_0x2ba4d3,_0xd9ff('0x2f'));_0xbdd352[_0xd9ff('0x37')]=_[_0xd9ff('0x38')](_0x4ba2be[_0xd9ff('0x37')]);_0xbdd352[_0xd9ff('0x39')]=_[_0xd9ff('0x3a')](_0xbdd352[_0xd9ff('0x36')],_0xbdd352[_0xd9ff('0x37')]);_0x29c532[_0xd9ff('0x3b')]=_[_0xd9ff('0x3a')](_0xbdd352[_0xd9ff('0x36')],qs['fields'](_0x4ba2be[_0xd9ff('0x37')][_0xd9ff('0x3c')]));_0x29c532[_0xd9ff('0x3b')]=_0x29c532['attributes'][_0xd9ff('0x3d')]?_0x29c532['attributes']:_0xbdd352[_0xd9ff('0x36')];if(!_0x4ba2be['query'][_0xd9ff('0x3e')]('nolimit')){_0x29c532[_0xd9ff('0x22')]=qs[_0xd9ff('0x22')](_0x4ba2be[_0xd9ff('0x37')]['limit']);_0x29c532['offset']=qs['offset'](_0x4ba2be[_0xd9ff('0x37')][_0xd9ff('0x21')]);}_0x29c532[_0xd9ff('0x3f')]=qs[_0xd9ff('0x40')](_0x4ba2be[_0xd9ff('0x37')][_0xd9ff('0x40')]);_0x29c532['where']=qs['filters'](_['pick'](_0x4ba2be[_0xd9ff('0x37')],_0xbdd352[_0xd9ff('0x39')]),_0x2ba4d3);if(_0x4ba2be[_0xd9ff('0x37')][_0xd9ff('0x41')]){_0x29c532['where']=_[_0xd9ff('0x42')](_0x29c532['where'],{'$or':_[_0xd9ff('0x31')](_0x2ba4d3,function(_0x3e2beb){if(_0x3e2beb[_0xd9ff('0x43')]!==_0xd9ff('0x44')){var _0x59fc07={};_0x59fc07[_0x3e2beb[_0xd9ff('0x2f')]]={'$like':'%'+_0x4ba2be[_0xd9ff('0x37')]['filter']+'%'};return _0x59fc07;}})});}_0x29c532=_[_0xd9ff('0x42')]({},_0x29c532,_0x4ba2be[_0xd9ff('0x45')]);var _0x94dcd8={'where':_0x29c532[_0xd9ff('0x46')]};return db[_0xd9ff('0x32')][_0xd9ff('0x20')](_0x94dcd8)['then'](function(_0x294c89){_0x552d08[_0xd9ff('0x20')]=_0x294c89;if(_0x4ba2be[_0xd9ff('0x37')][_0xd9ff('0x47')]){_0x29c532[_0xd9ff('0x48')]=[{'all':!![]}];}return db['SmsQueue'][_0xd9ff('0x49')](_0x29c532);})[_0xd9ff('0x26')](function(_0xe0bc49){_0x552d08['rows']=_0xe0bc49;return _0x552d08;})['then'](respondWithFilteredResult(_0x1d55fd,_0x29c532))[_0xd9ff('0x4a')](handleError(_0x1d55fd,null));};exports[_0xd9ff('0x4b')]=function(_0x18d1c4,_0x2dfb8f){var _0x437561={'raw':!![],'where':{'id':_0x18d1c4['params']['id']}},_0x30c69d={};_0x30c69d[_0xd9ff('0x36')]=_[_0xd9ff('0x38')](db['SmsQueue'][_0xd9ff('0x33')]);_0x30c69d[_0xd9ff('0x37')]=_[_0xd9ff('0x38')](_0x18d1c4[_0xd9ff('0x37')]);_0x30c69d[_0xd9ff('0x39')]=_['intersection'](_0x30c69d['model'],_0x30c69d['query']);_0x437561[_0xd9ff('0x3b')]=_['intersection'](_0x30c69d[_0xd9ff('0x36')],qs[_0xd9ff('0x3c')](_0x18d1c4[_0xd9ff('0x37')]['fields']));_0x437561[_0xd9ff('0x3b')]=_0x437561[_0xd9ff('0x3b')]['length']?_0x437561[_0xd9ff('0x3b')]:_0x30c69d[_0xd9ff('0x36')];if(_0x18d1c4[_0xd9ff('0x37')][_0xd9ff('0x47')]){_0x437561['include']=[{'all':!![]}];}_0x437561=_[_0xd9ff('0x42')]({},_0x437561,_0x18d1c4['options']);return db[_0xd9ff('0x32')]['find'](_0x437561)[_0xd9ff('0x26')](handleEntityNotFound(_0x2dfb8f,null))[_0xd9ff('0x26')](respondWithResult(_0x2dfb8f,null))[_0xd9ff('0x4a')](handleError(_0x2dfb8f,null));};exports[_0xd9ff('0x4c')]=function(_0xf21b7d,_0x540b78){return db[_0xd9ff('0x32')][_0xd9ff('0x4c')](_0xf21b7d[_0xd9ff('0x4d')],{})[_0xd9ff('0x26')](function(_0x5c3e11){var _0x537282=_0xf21b7d['user'][_0xd9ff('0x27')]({'plain':!![]});if(!_0x537282)throw new Error(_0xd9ff('0x4e'));if(_0x537282[_0xd9ff('0x4f')]==='user'){var _0x136bac=_0x5c3e11[_0xd9ff('0x27')]({'plain':!![]});var _0x6d1082=_0xd9ff('0x28');return db[_0xd9ff('0x50')][_0xd9ff('0x51')]({'where':{'name':_0x6d1082,'userProfileId':_0x537282[_0xd9ff('0x52')]},'raw':!![]})[_0xd9ff('0x26')](function(_0x1ad160){if(_0x1ad160&&_0x1ad160[_0xd9ff('0x53')]===0x0){return db[_0xd9ff('0x29')][_0xd9ff('0x4c')]({'name':_0x136bac[_0xd9ff('0x2f')],'resourceId':_0x136bac['id'],'type':_0x1ad160['name'],'sectionId':_0x1ad160['id']},{})[_0xd9ff('0x26')](function(){return _0x5c3e11;});}else{return _0x5c3e11;}})['catch'](function(_0x2c03a6){logger['error'](_0xd9ff('0x54'),_0x2c03a6);throw _0x2c03a6;});}return _0x5c3e11;})['then'](respondWithResult(_0x540b78,0xc9))[_0xd9ff('0x4a')](handleError(_0x540b78,null));};exports['update']=function(_0x3aea70,_0x4a45d4){if(_0x3aea70[_0xd9ff('0x4d')]['id']){delete _0x3aea70['body']['id'];}return db[_0xd9ff('0x32')]['find']({'where':{'id':_0x3aea70[_0xd9ff('0x55')]['id']}})[_0xd9ff('0x26')](handleEntityNotFound(_0x4a45d4,null))[_0xd9ff('0x26')](saveUpdates(_0x3aea70[_0xd9ff('0x4d')],null))['then'](respondWithResult(_0x4a45d4,null))[_0xd9ff('0x4a')](handleError(_0x4a45d4,null));};exports[_0xd9ff('0x2a')]=function(_0x1dc00c,_0x59f8e8){return db[_0xd9ff('0x32')][_0xd9ff('0x51')]({'where':{'id':_0x1dc00c[_0xd9ff('0x55')]['id']}})[_0xd9ff('0x26')](handleEntityNotFound(_0x59f8e8,null))[_0xd9ff('0x26')](removeEntity(_0x59f8e8,null))['catch'](handleError(_0x59f8e8,null));};exports[_0xd9ff('0x56')]=function(_0x412114,_0x11b6c4){return db[_0xd9ff('0x32')][_0xd9ff('0x56')]()[_0xd9ff('0x26')](respondWithResult(_0x11b6c4,null))[_0xd9ff('0x4a')](handleError(_0x11b6c4,null));};exports['getMembers']=function(_0x3be850,_0x11251f,_0x561a9b){var _0x1c885f={'raw':!![],'where':{}},_0x17c1b2={},_0x5b17c0;return db[_0xd9ff('0x32')][_0xd9ff('0x57')]({'where':{'id':_0x3be850[_0xd9ff('0x55')]['id']}})['then'](handleEntityNotFound(_0x11251f,null))['then'](function(_0x39473e){if(_0x39473e){_0x5b17c0=_0x39473e['get']({'plain':!![]});_0x17c1b2[_0xd9ff('0x36')]=_[_0xd9ff('0x38')](db[_0xd9ff('0x58')][_0xd9ff('0x33')]);_0x17c1b2['query']=_['keys'](_0x3be850['query']);_0x17c1b2[_0xd9ff('0x39')]=_[_0xd9ff('0x3a')](_0x17c1b2[_0xd9ff('0x36')],_0x17c1b2[_0xd9ff('0x37')]);_0x1c885f[_0xd9ff('0x3b')]=_['intersection'](_0x17c1b2[_0xd9ff('0x36')],qs['fields'](_0x3be850[_0xd9ff('0x37')][_0xd9ff('0x3c')]));_0x1c885f[_0xd9ff('0x3b')]=_0x1c885f[_0xd9ff('0x3b')][_0xd9ff('0x3d')]?_0x1c885f[_0xd9ff('0x3b')]:_0x17c1b2[_0xd9ff('0x36')];if(!_0x3be850[_0xd9ff('0x37')]['hasOwnProperty'](_0xd9ff('0x59'))){_0x1c885f[_0xd9ff('0x22')]=qs['limit'](_0x3be850['query'][_0xd9ff('0x22')]);_0x1c885f['offset']=qs[_0xd9ff('0x21')](_0x3be850[_0xd9ff('0x37')]['offset']);}_0x1c885f[_0xd9ff('0x3f')]=qs[_0xd9ff('0x40')](_0x3be850[_0xd9ff('0x37')][_0xd9ff('0x40')]);_0x1c885f[_0xd9ff('0x46')]=qs['filters'](_[_0xd9ff('0x5a')](_0x3be850['query'],_0x17c1b2['filters']));_0x1c885f[_0xd9ff('0x46')][_0xd9ff('0x5b')]=_0x39473e['id'];if(_0x3be850[_0xd9ff('0x37')][_0xd9ff('0x41')]){_0x1c885f['where']=_[_0xd9ff('0x42')](_0x1c885f[_0xd9ff('0x46')],{'$or':_[_0xd9ff('0x31')](_0x1c885f[_0xd9ff('0x3b')],function(_0x1bb042){var _0x255edf={};_0x255edf[_0x1bb042]={'$like':'%'+_0x3be850[_0xd9ff('0x37')][_0xd9ff('0x41')]+'%'};return _0x255edf;})});}_0x1c885f=_['merge']({},_0x1c885f,_0x3be850['options']);return db['UserSmsQueue'][_0xd9ff('0x49')](_0x1c885f);}})[_0xd9ff('0x26')](function(_0x514d59){if(_0x514d59){return db[_0xd9ff('0x5c')][_0xd9ff('0x5d')]({'where':{'id':_[_0xd9ff('0x31')](_0x514d59,_0xd9ff('0x5e')),'role':_0xd9ff('0x5f')},'attributes':['id',_0xd9ff('0x2f'),_0xd9ff('0x60'),_0xd9ff('0x61'),'createdAt']});}})[_0xd9ff('0x26')](function(_0x1ef766){if(_0x1ef766){return{'count':_0x1ef766[_0xd9ff('0x20')],'rows':_['map'](_0x1ef766[_0xd9ff('0x62')],function(_0x58c9c2){return{'membername':_0x58c9c2[_0xd9ff('0x2f')],'UserId':_0x58c9c2['id'],'queue_name':_0x5b17c0[_0xd9ff('0x2f')],'SmsQueueId':_0x5b17c0['id'],'interface':util[_0xd9ff('0x63')]('%s/%s',_0xd9ff('0x64'),_0x58c9c2[_0xd9ff('0x2f')]),'penalty':0x0,'paused':_0x58c9c2[_0xd9ff('0x60')],'createdAt':_0x58c9c2[_0xd9ff('0x65')],'updatedAt':_0x58c9c2['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd9ff('0x26')](respondWithFilteredResult(_0x11251f,_0x1c885f))[_0xd9ff('0x4a')](handleError(_0x11251f,null));};exports[_0xd9ff('0x66')]=function(_0x53fca5,_0x29a562,_0x212f86){var _0x2619c9={};var _0x5c6bf3={};var _0xac6ee;var _0x35926f;return db[_0xd9ff('0x32')][_0xd9ff('0x57')]({'where':{'id':_0x53fca5[_0xd9ff('0x55')]['id']}})['then'](handleEntityNotFound(_0x29a562,null))[_0xd9ff('0x26')](function(_0x45e825){if(_0x45e825){_0xac6ee=_0x45e825;_0x5c6bf3['model']=_[_0xd9ff('0x38')](db[_0xd9ff('0x67')][_0xd9ff('0x33')]);_0x5c6bf3['query']=_[_0xd9ff('0x38')](_0x53fca5['query']);_0x5c6bf3[_0xd9ff('0x39')]=_['intersection'](_0x5c6bf3[_0xd9ff('0x36')],_0x5c6bf3[_0xd9ff('0x37')]);_0x2619c9[_0xd9ff('0x3b')]=_[_0xd9ff('0x3a')](_0x5c6bf3[_0xd9ff('0x36')],qs[_0xd9ff('0x3c')](_0x53fca5[_0xd9ff('0x37')][_0xd9ff('0x3c')]));_0x2619c9[_0xd9ff('0x3b')]=_0x2619c9[_0xd9ff('0x3b')]['length']?_0x2619c9[_0xd9ff('0x3b')]:_0x5c6bf3[_0xd9ff('0x36')];_0x2619c9[_0xd9ff('0x3f')]=qs[_0xd9ff('0x40')](_0x53fca5[_0xd9ff('0x37')][_0xd9ff('0x40')]);_0x2619c9['where']=qs['filters'](_[_0xd9ff('0x5a')](_0x53fca5[_0xd9ff('0x37')],_0x5c6bf3[_0xd9ff('0x39')]));if(_0x53fca5[_0xd9ff('0x37')][_0xd9ff('0x41')]){_0x2619c9[_0xd9ff('0x46')]=_['merge'](_0x2619c9[_0xd9ff('0x46')],{'$or':_[_0xd9ff('0x31')](_0x2619c9[_0xd9ff('0x3b')],function(_0x3d4953){var _0x14c89f={};_0x14c89f[_0x3d4953]={'$like':'%'+_0x53fca5[_0xd9ff('0x37')]['filter']+'%'};return _0x14c89f;})});}_0x2619c9=_[_0xd9ff('0x42')]({},_0x2619c9,_0x53fca5[_0xd9ff('0x45')]);return _0xac6ee[_0xd9ff('0x66')](_0x2619c9);}})[_0xd9ff('0x26')](function(_0x373a32){if(_0x373a32){_0x35926f=_0x373a32[_0xd9ff('0x3d')];if(!_0x53fca5[_0xd9ff('0x37')][_0xd9ff('0x3e')]('nolimit')){_0x2619c9[_0xd9ff('0x22')]=qs['limit'](_0x53fca5[_0xd9ff('0x37')][_0xd9ff('0x22')]);_0x2619c9[_0xd9ff('0x21')]=qs[_0xd9ff('0x21')](_0x53fca5[_0xd9ff('0x37')][_0xd9ff('0x21')]);}return _0xac6ee[_0xd9ff('0x66')](_0x2619c9);}})[_0xd9ff('0x26')](function(_0x2492fa){if(_0x2492fa){return _0x2492fa?{'count':_0x35926f,'rows':_0x2492fa}:null;}})[_0xd9ff('0x26')](respondWithResult(_0x29a562,null))[_0xd9ff('0x4a')](handleError(_0x29a562,null));};exports[_0xd9ff('0x68')]=function(_0xa908a3,_0x5d29b9,_0x4413c4){var _0x3d5742=_0xa908a3[_0xd9ff('0x4d')][_0xd9ff('0x69')];return db['Team'][_0xd9ff('0x49')]({'where':{'id':_0x3d5742},'attributes':['id'],'include':[{'model':db[_0xd9ff('0x5c')],'as':'Agents','attributes':['id',_0xd9ff('0x2f'),_0xd9ff('0x6a'),_0xd9ff('0x6b'),_0xd9ff('0x6c')],'raw':!![]}]})[_0xd9ff('0x26')](function(_0x6b2b42){if(_0x6b2b42){var _0x372747=_['flatMap'](_0x6b2b42,function(_0x3ac557){var _0x4dcadb=_0x3ac557[_0xd9ff('0x27')]({'plain':!![]});return _0x4dcadb[_0xd9ff('0x6d')];});return db[_0xd9ff('0x32')][_0xd9ff('0x51')]({'where':{'id':_0xa908a3[_0xd9ff('0x55')]['id']}})[_0xd9ff('0x26')](function(_0x2226bf){return db[_0xd9ff('0x6e')][_0xd9ff('0x6f')](function(_0x108583){return _0x2226bf[_0xd9ff('0x68')](_0x3d5742,{'transaction':_0x108583})['then'](function(){return BPromise[_0xd9ff('0x70')](_0x372747,function(_0x3ae3dd){return db['UserSmsQueue'][_0xd9ff('0x71')]({'where':{'UserId':_0x3ae3dd['id'],'SmsQueueId':_0xa908a3[_0xd9ff('0x55')]['id']},'transaction':_0x108583});});})[_0xd9ff('0x26')](function(){_0x372747[_0xd9ff('0x72')](function(_0x1332a9){socket[_0xd9ff('0x73')]('userSmsQueue:save',{'UserId':_0x1332a9['id'],'SmsQueueId':_0x2226bf['id']});});});});});}})['then'](respondWithStatusCode(_0x5d29b9,null))[_0xd9ff('0x4a')](handleError(_0x5d29b9,null));};exports['removeTeams']=function(_0x58da81,_0x4a55c1,_0x4b9359){return db[_0xd9ff('0x67')][_0xd9ff('0x49')]({'where':{'id':_0x58da81[_0xd9ff('0x37')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd9ff('0x6d'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4a55c1,null))[_0xd9ff('0x26')](function(_0x4c50d2){var _0x338235=_[_0xd9ff('0x31')](_0x4c50d2,'id');var _0xdf0ca=[];var _0x1cb244=[];var _0x1938f1=squel['select']();_0x1938f1['field'](_0xd9ff('0x74'))[_0xd9ff('0x75')](_0xd9ff('0x76'),'tq')[_0xd9ff('0x77')](_0xd9ff('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xd9ff('0x46')](_0xd9ff('0x79'),_0x58da81[_0xd9ff('0x55')]['id']);for(var _0x7fdc57=0x0;_0x7fdc57<_0x4c50d2[_0xd9ff('0x3d')];_0x7fdc57+=0x1){let _0x29dafb=_0x4c50d2[_0x7fdc57];for(var _0x38731a=0x0;_0x38731a<_0x29dafb[_0xd9ff('0x6d')][_0xd9ff('0x3d')];_0x38731a+=0x1){let _0x41b7e3=_0x29dafb[_0xd9ff('0x6d')][_0x38731a];var _0x311b25=_0x1938f1[_0xd9ff('0x7a')]();_0x311b25['where'](_0xd9ff('0x7b'),_0x41b7e3['id']);_0x1cb244[_0xd9ff('0x7c')](db['sequelize']['query'](_0x311b25[_0xd9ff('0x7d')](),{'type':db[_0xd9ff('0x6e')]['QueryTypes'][_0xd9ff('0x7e')]})[_0xd9ff('0x26')](function(_0x178b5c){if(_0x178b5c[_0xd9ff('0x3d')]===0x1){return _0x41b7e3['id'];}else{var _0x46a0fa=_[_0xd9ff('0x7f')](_[_0xd9ff('0x31')](_0x178b5c,_0xd9ff('0x80')),function(_0x564e90){return _['includes'](_0x338235,_0x564e90);});if(_0x46a0fa){return _0x41b7e3['id'];}}}));}}return BPromise['all'](_0x1cb244)[_0xd9ff('0x26')](function(_0x610088){_0xdf0ca=_(_0xdf0ca)[_0xd9ff('0x81')](_0x610088)['compact']()[_0xd9ff('0x82')]();return db[_0xd9ff('0x32')][_0xd9ff('0x51')]({'where':{'id':_0x58da81[_0xd9ff('0x55')]['id']}})[_0xd9ff('0x26')](function(_0x6c45b3){return db['sequelize'][_0xd9ff('0x6f')](function(_0x514aa0){return _0x6c45b3[_0xd9ff('0x83')](_0x58da81[_0xd9ff('0x37')][_0xd9ff('0x69')],{'transaction':_0x514aa0})[_0xd9ff('0x26')](function(){if(!_['isEmpty'](_0xdf0ca)){return _0x6c45b3[_0xd9ff('0x84')](_0xdf0ca,{'transaction':_0x514aa0});}})[_0xd9ff('0x26')](function(){_0xdf0ca['forEach'](function(_0x59bcd4){socket['emit'](_0xd9ff('0x85'),{'UserId':_0x59bcd4,'SmsQueueId':_0x6c45b3['id']});});});});});});})[_0xd9ff('0x26')](respondWithStatusCode(_0x4a55c1,null))['catch'](handleError(_0x4a55c1,null));};exports[_0xd9ff('0x86')]=function(_0x149791,_0x16e130,_0x4f6eef){return db['SmsQueue']['find']({'where':{'id':_0x149791[_0xd9ff('0x55')]['id']}})['then'](handleEntityNotFound(_0x16e130,null))[_0xd9ff('0x26')](function(_0x1fbfcf){if(_0x1fbfcf){return _0x1fbfcf['addAgents'](_0x149791[_0xd9ff('0x4d')][_0xd9ff('0x69')],_[_0xd9ff('0x87')](_0x149791[_0xd9ff('0x4d')],[_0xd9ff('0x69'),'id'])||{})['spread'](function(_0xd46620){for(var _0x5d0d2e=0x0;_0x5d0d2e<_0x149791['body']['ids'][_0xd9ff('0x3d')];_0x5d0d2e+=0x1){socket[_0xd9ff('0x73')](_0xd9ff('0x88'),{'UserId':_0x149791[_0xd9ff('0x4d')]['ids'][_0x5d0d2e],'SmsQueueId':_0x149791['params']['id']});}return _0xd46620;});}})[_0xd9ff('0x26')](respondWithResult(_0x16e130,null))[_0xd9ff('0x4a')](handleError(_0x16e130,null));};exports[_0xd9ff('0x84')]=function(_0x443e0a,_0x28afbb,_0x490a21){return db['SmsQueue'][_0xd9ff('0x51')]({'where':{'id':_0x443e0a[_0xd9ff('0x55')]['id']}})[_0xd9ff('0x26')](handleEntityNotFound(_0x28afbb,null))[_0xd9ff('0x26')](function(_0x6d92e8){if(_0x6d92e8){return _0x6d92e8[_0xd9ff('0x84')](_0x443e0a['query'][_0xd9ff('0x69')])['then'](function(){if(_['isArray'](_0x443e0a[_0xd9ff('0x37')][_0xd9ff('0x69')])){for(var _0x33fee6=0x0;_0x33fee6<_0x443e0a[_0xd9ff('0x37')]['ids']['length'];_0x33fee6+=0x1){socket[_0xd9ff('0x73')]('userSmsQueue:remove',{'UserId':Number(_0x443e0a['query'][_0xd9ff('0x69')][_0x33fee6]),'SmsQueueId':Number(_0x443e0a['params']['id'])});}}else{socket[_0xd9ff('0x73')]('userSmsQueue:remove',{'UserId':Number(_0x443e0a[_0xd9ff('0x37')][_0xd9ff('0x69')]),'SmsQueueId':Number(_0x443e0a[_0xd9ff('0x55')]['id'])});}});}})[_0xd9ff('0x26')](respondWithStatusCode(_0x28afbb,null))[_0xd9ff('0x4a')](handleError(_0x28afbb,null));};exports[_0xd9ff('0x89')]=function(_0x2a4aea,_0x4cf14b,_0x30967e){var _0x5da105={};var _0x591d44={};var _0x181512;var _0x1aff49;return db['SmsQueue'][_0xd9ff('0x57')]({'where':{'id':_0x2a4aea['params']['id']}})['then'](handleEntityNotFound(_0x4cf14b,null))[_0xd9ff('0x26')](function(_0x2823a2){if(_0x2823a2){_0x181512=_0x2823a2;_0x591d44[_0xd9ff('0x36')]=_[_0xd9ff('0x38')](db[_0xd9ff('0x5c')][_0xd9ff('0x33')]);_0x591d44[_0xd9ff('0x37')]=_[_0xd9ff('0x38')](_0x2a4aea[_0xd9ff('0x37')]);_0x591d44[_0xd9ff('0x39')]=_[_0xd9ff('0x3a')](_0x591d44[_0xd9ff('0x36')],_0x591d44[_0xd9ff('0x37')]);_0x5da105['attributes']=_['intersection'](_0x591d44['model'],qs[_0xd9ff('0x3c')](_0x2a4aea['query'][_0xd9ff('0x3c')]));_0x5da105[_0xd9ff('0x3b')]=_0x5da105[_0xd9ff('0x3b')][_0xd9ff('0x3d')]?_0x5da105['attributes']:_0x591d44[_0xd9ff('0x36')];_0x5da105['order']=qs[_0xd9ff('0x40')](_0x2a4aea['query']['sort']);_0x5da105['where']=qs[_0xd9ff('0x39')](_['pick'](_0x2a4aea[_0xd9ff('0x37')],_0x591d44['filters']));if(_0x2a4aea[_0xd9ff('0x37')][_0xd9ff('0x41')]){_0x5da105[_0xd9ff('0x46')]=_[_0xd9ff('0x42')](_0x5da105[_0xd9ff('0x46')],{'$or':_[_0xd9ff('0x31')](_0x5da105['attributes'],function(_0x58b4e3){var _0x2f09f3={};_0x2f09f3[_0x58b4e3]={'$like':'%'+_0x2a4aea[_0xd9ff('0x37')][_0xd9ff('0x41')]+'%'};return _0x2f09f3;})});}_0x5da105=_[_0xd9ff('0x42')]({},_0x5da105,_0x2a4aea[_0xd9ff('0x45')]);return _0x181512['getAgents'](_0x5da105);}})[_0xd9ff('0x26')](function(_0x4542e9){if(_0x4542e9){_0x1aff49=_0x4542e9[_0xd9ff('0x3d')];if(!_0x2a4aea[_0xd9ff('0x37')][_0xd9ff('0x3e')](_0xd9ff('0x59'))){_0x5da105['limit']=qs[_0xd9ff('0x22')](_0x2a4aea[_0xd9ff('0x37')][_0xd9ff('0x22')]);_0x5da105[_0xd9ff('0x21')]=qs[_0xd9ff('0x21')](_0x2a4aea[_0xd9ff('0x37')][_0xd9ff('0x21')]);}return _0x181512[_0xd9ff('0x89')](_0x5da105);}})[_0xd9ff('0x26')](function(_0x12a989){if(_0x12a989){return _0x12a989?{'count':_0x1aff49,'rows':_0x12a989}:null;}})[_0xd9ff('0x26')](respondWithResult(_0x4cf14b,null))[_0xd9ff('0x4a')](handleError(_0x4cf14b,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 37d3b0e..f98bb93 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 _0x0fec=['emit','hasOwnProperty','events','../../mysqldb','SmsQueue','update'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0x0fec,0x1ca));var _0xc0fe=function(_0x83b5fe,_0x393931){_0x83b5fe=_0x83b5fe-0x0;var _0x2e34ba=_0x0fec[_0x83b5fe];return _0x2e34ba;};'use strict';var EventEmitter=require(_0xc0fe('0x0'));var SmsQueue=require(_0xc0fe('0x1'))['db'][_0xc0fe('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc0fe('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3fc05a){return function(_0x28af46,_0x4d1088,_0x168055){SmsQueueEvents['emit'](_0x3fc05a+':'+_0x28af46['id'],_0x28af46);SmsQueueEvents[_0xc0fe('0x4')](_0x3fc05a,_0x28af46);_0x168055(null);};}for(var e in events){if(events[_0xc0fe('0x5')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x65bd=['hasOwnProperty','hook','exports','events','setMaxListeners','save','update','emit'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x65bd,0xb3));var _0xd65b=function(_0x262f06,_0x5c8a91){_0x262f06=_0x262f06-0x0;var _0x20db02=_0x65bd[_0x262f06];return _0x20db02;};'use strict';var EventEmitter=require(_0xd65b('0x0'));var SmsQueue=require('../../mysqldb')['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xd65b('0x1')](0x0);var events={'afterCreate':_0xd65b('0x2'),'afterUpdate':_0xd65b('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3b8687){return function(_0x46412e,_0xd60aac,_0x4dbb47){SmsQueueEvents[_0xd65b('0x4')](_0x3b8687+':'+_0x46412e['id'],_0x46412e);SmsQueueEvents[_0xd65b('0x4')](_0x3b8687,_0x46412e);_0x4dbb47(null);};}for(var e in events){if(events[_0xd65b('0x5')](e)){var event=events[e];SmsQueue[_0xd65b('0x6')](e,emitEvent(event));}}module[_0xd65b('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index a019e2d..2efb361 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 _0x9dd1=['SmsQueue','sms_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define'];(function(_0x3ceb6d,_0x531f42){var _0x361939=function(_0x293618){while(--_0x293618){_0x3ceb6d['push'](_0x3ceb6d['shift']());}};_0x361939(++_0x531f42);}(_0x9dd1,0x160));var _0x19dd=function(_0x3bceea,_0x58af75){_0x3bceea=_0x3bceea-0x0;var _0x30a8d3=_0x9dd1[_0x3bceea];return _0x30a8d3;};'use strict';var _=require('lodash');var util=require(_0x19dd('0x0'));var logger=require(_0x19dd('0x1'))(_0x19dd('0x2'));var moment=require(_0x19dd('0x3'));var BPromise=require(_0x19dd('0x4'));var rp=require(_0x19dd('0x5'));var fs=require('fs');var path=require(_0x19dd('0x6'));var rimraf=require(_0x19dd('0x7'));var config=require(_0x19dd('0x8'));var attributes=require(_0x19dd('0x9'));module[_0x19dd('0xa')]=function(_0x50d7e2,_0x47cef0){return _0x50d7e2[_0x19dd('0xb')](_0x19dd('0xc'),attributes,{'tableName':_0x19dd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa543=['./smsQueue.attributes','exports','define','SmsQueue','sms_queues','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x297dfc,_0x3be7ee){var _0x19eba7=function(_0x50075c){while(--_0x50075c){_0x297dfc['push'](_0x297dfc['shift']());}};_0x19eba7(++_0x3be7ee);}(_0xa543,0x101));var _0x3a54=function(_0x4e17f7,_0x2e54e0){_0x4e17f7=_0x4e17f7-0x0;var _0x509ce4=_0xa543[_0x4e17f7];return _0x509ce4;};'use strict';var _=require('lodash');var util=require(_0x3a54('0x0'));var logger=require(_0x3a54('0x1'))('api');var moment=require(_0x3a54('0x2'));var BPromise=require(_0x3a54('0x3'));var rp=require(_0x3a54('0x4'));var fs=require('fs');var path=require(_0x3a54('0x5'));var rimraf=require('rimraf');var config=require(_0x3a54('0x6'));var attributes=require(_0x3a54('0x7'));module[_0x3a54('0x8')]=function(_0x22f504,_0x47a013){return _0x22f504[_0x3a54('0x9')](_0x3a54('0xa'),attributes,{'tableName':_0x3a54('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 a7f5319..4921e81 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 _0x6412=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','./smsQueue.socket','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetSmsQueue','findAll','options','raw','attributes','limit','include','map','model','catch','ShowSmsQueue','moment','ioredis','../../mysqldb'];(function(_0x2d13b1,_0x2678d5){var _0x18c844=function(_0x4b0e6c){while(--_0x4b0e6c){_0x2d13b1['push'](_0x2d13b1['shift']());}};_0x18c844(++_0x2678d5);}(_0x6412,0xf2));var _0x2641=function(_0x5a9884,_0x24c025){_0x5a9884=_0x5a9884-0x0;var _0x2b94b4=_0x6412[_0x5a9884];return _0x2b94b4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2641('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2641('0x1'));var db=require(_0x2641('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x2641('0x3'))(_0x2641('0x4'));var config=require(_0x2641('0x5'));var jayson=require(_0x2641('0x6'));var client=jayson[_0x2641('0x7')][_0x2641('0x8')]({'port':0x232a});config['redis']=_[_0x2641('0x9')](config['redis'],{'host':_0x2641('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2641('0xb')]));require(_0x2641('0xc'))['register'](socket);function respondWithRpcPromise(_0x26d797,_0x1aaad9,_0x1b86aa){return new BPromise(function(_0x306166,_0x1a15a2){return client[_0x2641('0xd')](_0x26d797,_0x1b86aa)[_0x2641('0xe')](function(_0x56ea9d){logger[_0x2641('0xf')](_0x2641('0x10'),_0x1aaad9,_0x2641('0x11'));logger[_0x2641('0x12')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x1aaad9,_0x2641('0x11'),JSON[_0x2641('0x13')](_0x56ea9d));if(_0x56ea9d[_0x2641('0x14')]){if(_0x56ea9d['error'][_0x2641('0x15')]===0x1f4){logger['error'](_0x2641('0x10'),_0x1aaad9,_0x56ea9d[_0x2641('0x14')][_0x2641('0x16')]);return _0x1a15a2(_0x56ea9d[_0x2641('0x14')][_0x2641('0x16')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x1aaad9,_0x56ea9d[_0x2641('0x14')]['message']);return _0x306166(_0x56ea9d[_0x2641('0x14')]['message']);}else{logger[_0x2641('0xf')](_0x2641('0x10'),_0x1aaad9,_0x2641('0x11'));_0x306166(_0x56ea9d[_0x2641('0x17')][_0x2641('0x16')]);}})['catch'](function(_0x2d62c4){logger[_0x2641('0x14')]('SmsQueue,\x20%s,\x20%s',_0x1aaad9,_0x2d62c4);_0x1a15a2(_0x2d62c4);});});}exports[_0x2641('0x18')]=function(_0x566e46){var _0x2dfa46=this;return new Promise(function(_0x58efbe,_0x1f1673){return db['SmsQueue'][_0x2641('0x19')]({'raw':_0x566e46['options']?_0x566e46[_0x2641('0x1a')][_0x2641('0x1b')]===undefined?!![]:![]:!![],'where':_0x566e46[_0x2641('0x1a')]?_0x566e46[_0x2641('0x1a')]['where']||null:null,'attributes':_0x566e46[_0x2641('0x1a')]?_0x566e46[_0x2641('0x1a')][_0x2641('0x1c')]||null:null,'limit':_0x566e46[_0x2641('0x1a')]?_0x566e46[_0x2641('0x1a')][_0x2641('0x1d')]||null:null,'include':_0x566e46['options']?_0x566e46[_0x2641('0x1a')][_0x2641('0x1e')]?_[_0x2641('0x1f')](_0x566e46[_0x2641('0x1a')]['include'],function(_0x1d506e){return{'model':db[_0x1d506e[_0x2641('0x20')]],'as':_0x1d506e['as'],'attributes':_0x1d506e['attributes'],'include':_0x1d506e[_0x2641('0x1e')]?_[_0x2641('0x1f')](_0x1d506e[_0x2641('0x1e')],function(_0x4f772){return{'model':db[_0x4f772[_0x2641('0x20')]],'as':_0x4f772['as'],'attributes':_0x4f772[_0x2641('0x1c')],'include':_0x4f772[_0x2641('0x1e')]?_[_0x2641('0x1f')](_0x4f772[_0x2641('0x1e')],function(_0x2d221f){return{'model':db[_0x2d221f[_0x2641('0x20')]],'as':_0x2d221f['as'],'attributes':_0x2d221f['attributes']};}):[]};}):[]};}):[]:[]})[_0x2641('0xe')](function(_0x3e5ab6){logger['info'](_0x2641('0x18'),_0x566e46);logger[_0x2641('0x12')](_0x2641('0x18'),_0x566e46,JSON[_0x2641('0x13')](_0x3e5ab6));_0x58efbe(_0x3e5ab6);})[_0x2641('0x21')](function(_0x228470){logger[_0x2641('0x14')](_0x2641('0x18'),_0x228470[_0x2641('0x16')],_0x566e46);_0x1f1673(_0x2dfa46['error'](0x1f4,_0x228470[_0x2641('0x16')]));});});};exports['ShowSmsQueue']=function(_0x5ce498){var _0x269e52=this;return new Promise(function(_0x402a03,_0x50f638){return db['SmsQueue']['find']({'raw':_0x5ce498[_0x2641('0x1a')]?_0x5ce498[_0x2641('0x1a')][_0x2641('0x1b')]===undefined?!![]:![]:!![],'where':_0x5ce498[_0x2641('0x1a')]?_0x5ce498[_0x2641('0x1a')]['where']||null:null,'attributes':_0x5ce498[_0x2641('0x1a')]?_0x5ce498[_0x2641('0x1a')]['attributes']||null:null,'include':_0x5ce498['options']?_0x5ce498['options']['include']?_[_0x2641('0x1f')](_0x5ce498[_0x2641('0x1a')][_0x2641('0x1e')],function(_0x30ea71){return{'model':db[_0x30ea71[_0x2641('0x20')]],'as':_0x30ea71['as'],'attributes':_0x30ea71[_0x2641('0x1c')],'include':_0x30ea71[_0x2641('0x1e')]?_['map'](_0x30ea71[_0x2641('0x1e')],function(_0x1c348f){return{'model':db[_0x1c348f[_0x2641('0x20')]],'as':_0x1c348f['as'],'attributes':_0x1c348f[_0x2641('0x1c')],'include':_0x1c348f[_0x2641('0x1e')]?_['map'](_0x1c348f[_0x2641('0x1e')],function(_0x25d60c){return{'model':db[_0x25d60c[_0x2641('0x20')]],'as':_0x25d60c['as'],'attributes':_0x25d60c[_0x2641('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2641('0xe')](function(_0x528e41){logger[_0x2641('0xf')](_0x2641('0x22'),_0x5ce498);logger['debug'](_0x2641('0x22'),_0x5ce498,JSON[_0x2641('0x13')](_0x528e41));_0x402a03(_0x528e41);})[_0x2641('0x21')](function(_0x2f22b7){logger[_0x2641('0x14')](_0x2641('0x22'),_0x2f22b7['message'],_0x5ce498);_0x50f638(_0x269e52[_0x2641('0x14')](0x1f4,_0x2f22b7[_0x2641('0x16')]));});});}; \ No newline at end of file +var _0x2af9=['client','http','redis','defaults','localhost','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowSmsQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x42acbc,_0x5e9a37){var _0x102e15=function(_0x399c5c){while(--_0x399c5c){_0x42acbc['push'](_0x42acbc['shift']());}};_0x102e15(++_0x5e9a37);}(_0x2af9,0x15e));var _0x92af=function(_0x1e5c05,_0x30a33){_0x1e5c05=_0x1e5c05-0x0;var _0x102141=_0x2af9[_0x1e5c05];return _0x102141;};'use strict';var _=require(_0x92af('0x0'));var util=require(_0x92af('0x1'));var moment=require('moment');var BPromise=require(_0x92af('0x2'));var rs=require(_0x92af('0x3'));var fs=require('fs');var Redis=require(_0x92af('0x4'));var db=require(_0x92af('0x5'))['db'];var utils=require(_0x92af('0x6'));var logger=require(_0x92af('0x7'))('rpc');var config=require(_0x92af('0x8'));var jayson=require(_0x92af('0x9'));var client=jayson[_0x92af('0xa')][_0x92af('0xb')]({'port':0x232a});config[_0x92af('0xc')]=_[_0x92af('0xd')](config[_0x92af('0xc')],{'host':_0x92af('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x92af('0xc')]));require(_0x92af('0xf'))[_0x92af('0x10')](socket);function respondWithRpcPromise(_0x51acc1,_0x12c6f0,_0x925286){return new BPromise(function(_0x4a1cbc,_0x219207){return client[_0x92af('0x11')](_0x51acc1,_0x925286)[_0x92af('0x12')](function(_0x5e768b){logger[_0x92af('0x13')](_0x92af('0x14'),_0x12c6f0,'request\x20sent');logger[_0x92af('0x15')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x12c6f0,_0x92af('0x16'),JSON[_0x92af('0x17')](_0x5e768b));if(_0x5e768b[_0x92af('0x18')]){if(_0x5e768b['error']['code']===0x1f4){logger[_0x92af('0x18')](_0x92af('0x14'),_0x12c6f0,_0x5e768b[_0x92af('0x18')][_0x92af('0x19')]);return _0x219207(_0x5e768b[_0x92af('0x18')][_0x92af('0x19')]);}logger[_0x92af('0x18')](_0x92af('0x14'),_0x12c6f0,_0x5e768b[_0x92af('0x18')][_0x92af('0x19')]);return _0x4a1cbc(_0x5e768b[_0x92af('0x18')][_0x92af('0x19')]);}else{logger[_0x92af('0x13')](_0x92af('0x14'),_0x12c6f0,_0x92af('0x16'));_0x4a1cbc(_0x5e768b[_0x92af('0x1a')][_0x92af('0x19')]);}})[_0x92af('0x1b')](function(_0xe3f955){logger['error'](_0x92af('0x14'),_0x12c6f0,_0xe3f955);_0x219207(_0xe3f955);});});}exports[_0x92af('0x1c')]=function(_0x43e23c){var _0x534b0a=this;return new Promise(function(_0x35f462,_0x2c07cd){return db[_0x92af('0x1d')][_0x92af('0x1e')]({'raw':_0x43e23c[_0x92af('0x1f')]?_0x43e23c[_0x92af('0x1f')][_0x92af('0x20')]===undefined?!![]:![]:!![],'where':_0x43e23c[_0x92af('0x1f')]?_0x43e23c['options'][_0x92af('0x21')]||null:null,'attributes':_0x43e23c[_0x92af('0x1f')]?_0x43e23c[_0x92af('0x1f')][_0x92af('0x22')]||null:null,'limit':_0x43e23c['options']?_0x43e23c['options'][_0x92af('0x23')]||null:null,'include':_0x43e23c[_0x92af('0x1f')]?_0x43e23c['options'][_0x92af('0x24')]?_[_0x92af('0x25')](_0x43e23c[_0x92af('0x1f')]['include'],function(_0x218564){return{'model':db[_0x218564[_0x92af('0x26')]],'as':_0x218564['as'],'attributes':_0x218564[_0x92af('0x22')],'include':_0x218564[_0x92af('0x24')]?_[_0x92af('0x25')](_0x218564[_0x92af('0x24')],function(_0x1dc445){return{'model':db[_0x1dc445[_0x92af('0x26')]],'as':_0x1dc445['as'],'attributes':_0x1dc445[_0x92af('0x22')],'include':_0x1dc445['include']?_['map'](_0x1dc445[_0x92af('0x24')],function(_0x49e8b3){return{'model':db[_0x49e8b3[_0x92af('0x26')]],'as':_0x49e8b3['as'],'attributes':_0x49e8b3[_0x92af('0x22')]};}):[]};}):[]};}):[]:[]})[_0x92af('0x12')](function(_0x10c074){logger['info'](_0x92af('0x1c'),_0x43e23c);logger['debug'](_0x92af('0x1c'),_0x43e23c,JSON[_0x92af('0x17')](_0x10c074));_0x35f462(_0x10c074);})[_0x92af('0x1b')](function(_0x600d79){logger['error'](_0x92af('0x1c'),_0x600d79[_0x92af('0x19')],_0x43e23c);_0x2c07cd(_0x534b0a[_0x92af('0x18')](0x1f4,_0x600d79[_0x92af('0x19')]));});});};exports[_0x92af('0x27')]=function(_0x5036af){var _0x5e889d=this;return new Promise(function(_0x94fe,_0xc23f83){return db[_0x92af('0x1d')]['find']({'raw':_0x5036af[_0x92af('0x1f')]?_0x5036af[_0x92af('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x5036af['options']?_0x5036af[_0x92af('0x1f')][_0x92af('0x21')]||null:null,'attributes':_0x5036af[_0x92af('0x1f')]?_0x5036af['options'][_0x92af('0x22')]||null:null,'include':_0x5036af[_0x92af('0x1f')]?_0x5036af[_0x92af('0x1f')][_0x92af('0x24')]?_[_0x92af('0x25')](_0x5036af['options'][_0x92af('0x24')],function(_0x217cda){return{'model':db[_0x217cda['model']],'as':_0x217cda['as'],'attributes':_0x217cda['attributes'],'include':_0x217cda[_0x92af('0x24')]?_[_0x92af('0x25')](_0x217cda[_0x92af('0x24')],function(_0x10810d){return{'model':db[_0x10810d[_0x92af('0x26')]],'as':_0x10810d['as'],'attributes':_0x10810d[_0x92af('0x22')],'include':_0x10810d[_0x92af('0x24')]?_[_0x92af('0x25')](_0x10810d[_0x92af('0x24')],function(_0x20b9c7){return{'model':db[_0x20b9c7[_0x92af('0x26')]],'as':_0x20b9c7['as'],'attributes':_0x20b9c7['attributes']};}):[]};}):[]};}):[]:[]})[_0x92af('0x12')](function(_0x167685){logger[_0x92af('0x13')](_0x92af('0x27'),_0x5036af);logger[_0x92af('0x15')](_0x92af('0x27'),_0x5036af,JSON[_0x92af('0x17')](_0x167685));_0x94fe(_0x167685);})[_0x92af('0x1b')](function(_0x21d9a0){logger[_0x92af('0x18')](_0x92af('0x27'),_0x21d9a0['message'],_0x5036af);_0xc23f83(_0x5e889d['error'](0x1f4,_0x21d9a0['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 6a4ed2e..0a9c07a 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 _0x9a35=['smsQueue:','save','remove','update','emit','register','length'];(function(_0x37a0ab,_0x34b900){var _0x13ca1d=function(_0x3c6a41){while(--_0x3c6a41){_0x37a0ab['push'](_0x37a0ab['shift']());}};_0x13ca1d(++_0x34b900);}(_0x9a35,0x1c8));var _0x59a3=function(_0x5d3547,_0x363d67){_0x5d3547=_0x5d3547-0x0;var _0x5074e7=_0x9a35[_0x5d3547];return _0x5074e7;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x59a3('0x0'),_0x59a3('0x1'),_0x59a3('0x2')];function createListener(_0xdbf6bb,_0x8008c1){return function(_0x4159a0){_0x8008c1[_0x59a3('0x3')](_0xdbf6bb,_0x4159a0);};}function removeListener(_0xc443b2,_0x37d9c8){return function(){SmsQueueEvents['removeListener'](_0xc443b2,_0x37d9c8);};}exports[_0x59a3('0x4')]=function(_0x4538bb){for(var _0x5bbdaf=0x0,_0xb083e=events[_0x59a3('0x5')];_0x5bbdaf<_0xb083e;_0x5bbdaf++){var _0x4af200=events[_0x5bbdaf];var _0x136573=createListener(_0x59a3('0x6')+_0x4af200,_0x4538bb);SmsQueueEvents['on'](_0x4af200,_0x136573);}}; \ No newline at end of file +var _0xa258=['remove','update','emit','removeListener','register','length','smsQueue:','./smsQueue.events','save'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0xa258,0x73));var _0x8a25=function(_0x4350c2,_0x112f3c){_0x4350c2=_0x4350c2-0x0;var _0x8b6406=_0xa258[_0x4350c2];return _0x8b6406;};'use strict';var SmsQueueEvents=require(_0x8a25('0x0'));var events=[_0x8a25('0x1'),_0x8a25('0x2'),_0x8a25('0x3')];function createListener(_0x3e6438,_0x3e6e01){return function(_0x69137f){_0x3e6e01[_0x8a25('0x4')](_0x3e6438,_0x69137f);};}function removeListener(_0x42b551,_0x1f4c32){return function(){SmsQueueEvents[_0x8a25('0x5')](_0x42b551,_0x1f4c32);};}exports[_0x8a25('0x6')]=function(_0x278aba){for(var _0xf23d29=0x0,_0x31f774=events[_0x8a25('0x7')];_0xf23d29<_0x31f774;_0xf23d29++){var _0x3193b9=events[_0xf23d29];var _0x2af104=createListener(_0x8a25('0x8')+_0x3193b9,_0x278aba);SmsQueueEvents['on'](_0x3193b9,_0x2af104);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 5a87167..39bba75 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 _0xa8d3=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','exports'];(function(_0x3afde9,_0x10ff9a){var _0x5c5ff3=function(_0x200c94){while(--_0x200c94){_0x3afde9['push'](_0x3afde9['shift']());}};_0x5c5ff3(++_0x10ff9a);}(_0xa8d3,0x190));var _0x3a8d=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa8d3[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x3a8d('0x0'));var util=require(_0x3a8d('0x1'));var path=require(_0x3a8d('0x2'));var timeout=require(_0x3a8d('0x3'));var express=require(_0x3a8d('0x4'));var router=express['Router']();var fs_extra=require(_0x3a8d('0x5'));var auth=require(_0x3a8d('0x6'));var interaction=require(_0x3a8d('0x7'));var config=require(_0x3a8d('0x8'));var controller=require('./smsQueueReport.controller');router[_0x3a8d('0x9')]('/',auth[_0x3a8d('0xa')](),controller[_0x3a8d('0xb')]);router[_0x3a8d('0x9')]('/describe',auth[_0x3a8d('0xa')](),controller[_0x3a8d('0xc')]);router[_0x3a8d('0x9')](_0x3a8d('0xd'),auth[_0x3a8d('0xa')](),controller[_0x3a8d('0xe')]);router[_0x3a8d('0xf')]('/',auth[_0x3a8d('0xa')](),controller[_0x3a8d('0x10')]);router[_0x3a8d('0x11')]('/:id',auth[_0x3a8d('0xa')](),controller[_0x3a8d('0x12')]);router['delete'](_0x3a8d('0xd'),auth[_0x3a8d('0xa')](),controller['destroy']);module[_0x3a8d('0x13')]=router; \ No newline at end of file +var _0x967d=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','delete','destroy','multer'];(function(_0x21f3bf,_0xfb0f59){var _0x249d08=function(_0x37e6c2){while(--_0x37e6c2){_0x21f3bf['push'](_0x21f3bf['shift']());}};_0x249d08(++_0xfb0f59);}(_0x967d,0x125));var _0xd967=function(_0x43faa3,_0x478c98){_0x43faa3=_0x43faa3-0x0;var _0x127d0a=_0x967d[_0x43faa3];return _0x127d0a;};'use strict';var multer=require(_0xd967('0x0'));var util=require('util');var path=require(_0xd967('0x1'));var timeout=require('connect-timeout');var express=require(_0xd967('0x2'));var router=express[_0xd967('0x3')]();var fs_extra=require(_0xd967('0x4'));var auth=require(_0xd967('0x5'));var interaction=require(_0xd967('0x6'));var config=require(_0xd967('0x7'));var controller=require(_0xd967('0x8'));router[_0xd967('0x9')]('/',auth[_0xd967('0xa')](),controller[_0xd967('0xb')]);router[_0xd967('0x9')](_0xd967('0xc'),auth[_0xd967('0xa')](),controller['describe']);router[_0xd967('0x9')]('/:id',auth[_0xd967('0xa')](),controller[_0xd967('0xd')]);router[_0xd967('0xe')]('/',auth[_0xd967('0xa')](),controller[_0xd967('0xf')]);router[_0xd967('0x10')](_0xd967('0x11'),auth['isAuthenticated'](),controller[_0xd967('0x12')]);router[_0xd967('0x13')](_0xd967('0x11'),auth[_0xd967('0xa')](),controller[_0xd967('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 4e7aa9b..3edb0bb 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 _0x1d18=['STRING','DATE','moment','sequelize','exports'];(function(_0x47e373,_0x37beb1){var _0x234dc0=function(_0x488fa3){while(--_0x488fa3){_0x47e373['push'](_0x47e373['shift']());}};_0x234dc0(++_0x37beb1);}(_0x1d18,0x12e));var _0x81d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d18[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x81d1('0x0'));var Sequelize=require(_0x81d1('0x1'));module[_0x81d1('0x2')]={'uniqueid':{'type':Sequelize[_0x81d1('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x81d1('0x3')]},'joinAt':{'type':Sequelize[_0x81d1('0x4')]},'leaveAt':{'type':Sequelize[_0x81d1('0x4')]},'acceptAt':{'type':Sequelize[_0x81d1('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x33ae=['exports','STRING','DATE','moment','sequelize'];(function(_0x587be3,_0x16553d){var _0x85d742=function(_0x344e68){while(--_0x344e68){_0x587be3['push'](_0x587be3['shift']());}};_0x85d742(++_0x16553d);}(_0x33ae,0x14d));var _0xe33a=function(_0x316efa,_0x20a1e1){_0x316efa=_0x316efa-0x0;var _0x4d96cc=_0x33ae[_0x316efa];return _0x4d96cc;};'use strict';var moment=require(_0xe33a('0x0'));var Sequelize=require(_0xe33a('0x1'));module[_0xe33a('0x2')]={'uniqueid':{'type':Sequelize[_0xe33a('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xe33a('0x4')]},'leaveAt':{'type':Sequelize[_0xe33a('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xe33a('0x4')]},'reason':{'type':Sequelize[_0xe33a('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index f8ec672..82bbc29 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 _0xed45=['destroy','sendStatus','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','keys','catch','create','body','find','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','squel','crypto','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','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then'];(function(_0x2b450a,_0x5ddd47){var _0x2bb995=function(_0x13bb3e){while(--_0x13bb3e){_0x2b450a['push'](_0x2b450a['shift']());}};_0x2bb995(++_0x5ddd47);}(_0xed45,0x112));var _0x5ed4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xed45[_0x2d7f0e];return _0x110b07;};'use strict';var pdf=require(_0x5ed4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5ed4('0x1'));var zipdir=require(_0x5ed4('0x2'));var jsonpatch=require(_0x5ed4('0x3'));var rp=require(_0x5ed4('0x4'));var moment=require('moment');var BPromise=require(_0x5ed4('0x5'));var Mustache=require(_0x5ed4('0x6'));var util=require(_0x5ed4('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5ed4('0x8'));var fs=require('fs');var fs_extra=require(_0x5ed4('0x9'));var _=require('lodash');var squel=require(_0x5ed4('0xa'));var crypto=require(_0x5ed4('0xb'));var jsforce=require(_0x5ed4('0xc'));var deskjs=require(_0x5ed4('0xd'));var toCsv=require(_0x5ed4('0xe'));var querystring=require(_0x5ed4('0xf'));var Papa=require(_0x5ed4('0x10'));var Redis=require('ioredis');var authService=require(_0x5ed4('0x11'));var qs=require(_0x5ed4('0x12'));var as=require(_0x5ed4('0x13'));var hardwareService=require(_0x5ed4('0x14'));var logger=require(_0x5ed4('0x15'))('api');var utils=require(_0x5ed4('0x16'));var config=require(_0x5ed4('0x17'));var licenseUtil=require(_0x5ed4('0x18'));var db=require(_0x5ed4('0x19'))['db'];function respondWithStatusCode(_0x1a0fcc,_0x57b776){_0x57b776=_0x57b776||0xcc;return function(_0x27e3ee){if(_0x27e3ee){return _0x1a0fcc['sendStatus'](_0x57b776);}return _0x1a0fcc[_0x5ed4('0x1a')](_0x57b776)[_0x5ed4('0x1b')]();};}function respondWithResult(_0x1c31d3,_0x3adb38){_0x3adb38=_0x3adb38||0xc8;return function(_0x1760e4){if(_0x1760e4){return _0x1c31d3[_0x5ed4('0x1a')](_0x3adb38)[_0x5ed4('0x1c')](_0x1760e4);}};}function respondWithFilteredResult(_0x202503,_0x535c58){return function(_0x488a46){if(_0x488a46){var _0x521933=_0x488a46[_0x5ed4('0x1d')],_0x48d61a=_0x535c58[_0x5ed4('0x1e')],_0x23e753=_0x535c58[_0x5ed4('0x1e')]+_0x535c58[_0x5ed4('0x1f')],_0x45f72c;if(_0x23e753>=_0x521933){_0x23e753=_0x521933;_0x45f72c=0xc8;}else{_0x45f72c=0xce;}_0x202503[_0x5ed4('0x1a')](_0x45f72c);return _0x202503[_0x5ed4('0x20')](_0x5ed4('0x21'),_0x48d61a+'-'+_0x23e753+'/'+_0x521933)[_0x5ed4('0x1c')](_0x488a46);}return null;};}function patchUpdates(_0x137bbe){return function(_0x1bacfc){try{jsonpatch[_0x5ed4('0x22')](_0x1bacfc,_0x137bbe,!![]);}catch(_0xefcfc){return BPromise['reject'](_0xefcfc);}return _0x1bacfc[_0x5ed4('0x23')]();};}function saveUpdates(_0x3693cd,_0x590bd4){return function(_0x1b46ac){if(_0x1b46ac){return _0x1b46ac[_0x5ed4('0x24')](_0x3693cd)[_0x5ed4('0x25')](function(_0x1ac35c){return _0x1ac35c;});}return null;};}function removeEntity(_0x2edc34,_0x2a5c1a){return function(_0x29fca4){if(_0x29fca4){return _0x29fca4[_0x5ed4('0x26')]()['then'](function(){_0x2edc34[_0x5ed4('0x1a')](0xcc)[_0x5ed4('0x1b')]();});}};}function handleEntityNotFound(_0x4a5d9a,_0x320a87){return function(_0x56c7a4){if(!_0x56c7a4){_0x4a5d9a[_0x5ed4('0x27')](0x194);}return _0x56c7a4;};}function handleError(_0x507525,_0x250473){_0x250473=_0x250473||0x1f4;return function(_0xb85a26){logger[_0x5ed4('0x28')](_0xb85a26[_0x5ed4('0x29')]);if(_0xb85a26['name']){delete _0xb85a26[_0x5ed4('0x2a')];}_0x507525[_0x5ed4('0x1a')](_0x250473)[_0x5ed4('0x2b')](_0xb85a26);};}exports[_0x5ed4('0x2c')]=function(_0x543495,_0x4e9684){var _0x42fe1a={},_0x27b37f={},_0x33198a={'count':0x0,'rows':[]};var _0x26d9b8=_[_0x5ed4('0x2d')](db[_0x5ed4('0x2e')][_0x5ed4('0x2f')],function(_0xa30ed0){return{'name':_0xa30ed0[_0x5ed4('0x30')],'type':_0xa30ed0[_0x5ed4('0x31')][_0x5ed4('0x32')]};});_0x27b37f[_0x5ed4('0x33')]=_['map'](_0x26d9b8,_0x5ed4('0x2a'));_0x27b37f[_0x5ed4('0x34')]=_['keys'](_0x543495[_0x5ed4('0x34')]);_0x27b37f[_0x5ed4('0x35')]=_['intersection'](_0x27b37f[_0x5ed4('0x33')],_0x27b37f[_0x5ed4('0x34')]);_0x42fe1a['attributes']=_[_0x5ed4('0x36')](_0x27b37f[_0x5ed4('0x33')],qs[_0x5ed4('0x37')](_0x543495[_0x5ed4('0x34')]['fields']));_0x42fe1a[_0x5ed4('0x38')]=_0x42fe1a[_0x5ed4('0x38')]['length']?_0x42fe1a['attributes']:_0x27b37f['model'];if(!_0x543495[_0x5ed4('0x34')][_0x5ed4('0x39')](_0x5ed4('0x3a'))){_0x42fe1a[_0x5ed4('0x1f')]=qs[_0x5ed4('0x1f')](_0x543495[_0x5ed4('0x34')][_0x5ed4('0x1f')]);_0x42fe1a[_0x5ed4('0x1e')]=qs[_0x5ed4('0x1e')](_0x543495[_0x5ed4('0x34')][_0x5ed4('0x1e')]);}_0x42fe1a[_0x5ed4('0x3b')]=qs[_0x5ed4('0x3c')](_0x543495[_0x5ed4('0x34')][_0x5ed4('0x3c')]);_0x42fe1a[_0x5ed4('0x3d')]=qs[_0x5ed4('0x35')](_[_0x5ed4('0x3e')](_0x543495[_0x5ed4('0x34')],_0x27b37f[_0x5ed4('0x35')]),_0x26d9b8);if(_0x543495[_0x5ed4('0x34')][_0x5ed4('0x3f')]){_0x42fe1a['where']=_['merge'](_0x42fe1a[_0x5ed4('0x3d')],{'$or':_['map'](_0x26d9b8,function(_0x41b178){if(_0x41b178['type']!==_0x5ed4('0x40')){var _0x1d0498={};_0x1d0498[_0x41b178[_0x5ed4('0x2a')]]={'$like':'%'+_0x543495[_0x5ed4('0x34')][_0x5ed4('0x3f')]+'%'};return _0x1d0498;}})});}_0x42fe1a=_[_0x5ed4('0x41')]({},_0x42fe1a,_0x543495[_0x5ed4('0x42')]);var _0x19053b={'where':_0x42fe1a['where']};return db[_0x5ed4('0x2e')][_0x5ed4('0x1d')](_0x19053b)['then'](function(_0x2ea9d0){_0x33198a['count']=_0x2ea9d0;if(_0x543495[_0x5ed4('0x34')][_0x5ed4('0x43')]){_0x42fe1a[_0x5ed4('0x44')]=[{'all':!![]}];}return db[_0x5ed4('0x2e')][_0x5ed4('0x45')](_0x42fe1a);})['then'](function(_0x4a8ad0){_0x33198a['rows']=_0x4a8ad0;return _0x33198a;})[_0x5ed4('0x25')](respondWithFilteredResult(_0x4e9684,_0x42fe1a))['catch'](handleError(_0x4e9684,null));};exports[_0x5ed4('0x46')]=function(_0x3adc27,_0x4521d6){var _0x3ca864={'raw':!![],'where':{'id':_0x3adc27['params']['id']}},_0x51724c={};_0x51724c[_0x5ed4('0x33')]=_[_0x5ed4('0x47')](db['SmsQueueReport'][_0x5ed4('0x2f')]);_0x51724c[_0x5ed4('0x34')]=_[_0x5ed4('0x47')](_0x3adc27['query']);_0x51724c[_0x5ed4('0x35')]=_['intersection'](_0x51724c[_0x5ed4('0x33')],_0x51724c[_0x5ed4('0x34')]);_0x3ca864[_0x5ed4('0x38')]=_[_0x5ed4('0x36')](_0x51724c[_0x5ed4('0x33')],qs['fields'](_0x3adc27[_0x5ed4('0x34')][_0x5ed4('0x37')]));_0x3ca864['attributes']=_0x3ca864[_0x5ed4('0x38')]['length']?_0x3ca864[_0x5ed4('0x38')]:_0x51724c[_0x5ed4('0x33')];if(_0x3adc27[_0x5ed4('0x34')][_0x5ed4('0x43')]){_0x3ca864[_0x5ed4('0x44')]=[{'all':!![]}];}_0x3ca864=_[_0x5ed4('0x41')]({},_0x3ca864,_0x3adc27[_0x5ed4('0x42')]);return db['SmsQueueReport']['find'](_0x3ca864)['then'](handleEntityNotFound(_0x4521d6,null))[_0x5ed4('0x25')](respondWithResult(_0x4521d6,null))[_0x5ed4('0x48')](handleError(_0x4521d6,null));};exports[_0x5ed4('0x49')]=function(_0x4fba2e,_0x2a7e8e){return db[_0x5ed4('0x2e')][_0x5ed4('0x49')](_0x4fba2e[_0x5ed4('0x4a')],{})[_0x5ed4('0x25')](respondWithResult(_0x2a7e8e,0xc9))[_0x5ed4('0x48')](handleError(_0x2a7e8e,null));};exports[_0x5ed4('0x24')]=function(_0x588660,_0x326449){if(_0x588660[_0x5ed4('0x4a')]['id']){delete _0x588660[_0x5ed4('0x4a')]['id'];}return db['SmsQueueReport'][_0x5ed4('0x4b')]({'where':{'id':_0x588660[_0x5ed4('0x4c')]['id']}})[_0x5ed4('0x25')](handleEntityNotFound(_0x326449,null))[_0x5ed4('0x25')](saveUpdates(_0x588660['body'],null))[_0x5ed4('0x25')](respondWithResult(_0x326449,null))[_0x5ed4('0x48')](handleError(_0x326449,null));};exports[_0x5ed4('0x26')]=function(_0x5117df,_0x2494eb){return db[_0x5ed4('0x2e')][_0x5ed4('0x4b')]({'where':{'id':_0x5117df[_0x5ed4('0x4c')]['id']}})[_0x5ed4('0x25')](handleEntityNotFound(_0x2494eb,null))['then'](removeEntity(_0x2494eb,null))[_0x5ed4('0x48')](handleError(_0x2494eb,null));};exports[_0x5ed4('0x4d')]=function(_0x54d19b,_0xc7f6a8){return db[_0x5ed4('0x2e')]['describe']()[_0x5ed4('0x25')](respondWithResult(_0xc7f6a8,null))[_0x5ed4('0x48')](handleError(_0xc7f6a8,null));}; \ No newline at end of file +var _0x31b6=['crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','limit','set','Content-Range','apply','destroy','then','end','stack','name','send','index','map','rawAttributes','fieldName','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','type','filter','count','includeAll','SmsQueueReport','rows','catch','show','keys','options','find','create','body','update','params','describe','eml-format','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x3dcab,_0x58860f){var _0x517c6a=function(_0x1bcf1f){while(--_0x1bcf1f){_0x3dcab['push'](_0x3dcab['shift']());}};_0x517c6a(++_0x58860f);}(_0x31b6,0x14a));var _0x631b=function(_0xf1f886,_0x5f0ebd){_0xf1f886=_0xf1f886-0x0;var _0x23cd8d=_0x31b6[_0xf1f886];return _0x23cd8d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x631b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x631b('0x1'));var jsonpatch=require(_0x631b('0x2'));var rp=require('request-promise');var moment=require(_0x631b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x631b('0x4'));var sox=require(_0x631b('0x5'));var csv=require(_0x631b('0x6'));var ejs=require(_0x631b('0x7'));var fs=require('fs');var fs_extra=require(_0x631b('0x8'));var _=require('lodash');var squel=require(_0x631b('0x9'));var crypto=require(_0x631b('0xa'));var jsforce=require(_0x631b('0xb'));var deskjs=require(_0x631b('0xc'));var toCsv=require(_0x631b('0x6'));var querystring=require('querystring');var Papa=require(_0x631b('0xd'));var Redis=require('ioredis');var authService=require(_0x631b('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x631b('0xf'));var hardwareService=require(_0x631b('0x10'));var logger=require('../../config/logger')(_0x631b('0x11'));var utils=require(_0x631b('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x631b('0x13'));var db=require(_0x631b('0x14'))['db'];function respondWithStatusCode(_0x349e4a,_0x1cced5){_0x1cced5=_0x1cced5||0xcc;return function(_0x287c3f){if(_0x287c3f){return _0x349e4a['sendStatus'](_0x1cced5);}return _0x349e4a[_0x631b('0x15')](_0x1cced5)['end']();};}function respondWithResult(_0x41d0a9,_0x31beb2){_0x31beb2=_0x31beb2||0xc8;return function(_0x1f40f2){if(_0x1f40f2){return _0x41d0a9[_0x631b('0x15')](_0x31beb2)[_0x631b('0x16')](_0x1f40f2);}};}function respondWithFilteredResult(_0x46dd5f,_0x54a7b0){return function(_0x2f873){if(_0x2f873){var _0x4bc639=_0x2f873['count'],_0x1144ea=_0x54a7b0[_0x631b('0x17')],_0x1e73ac=_0x54a7b0['offset']+_0x54a7b0[_0x631b('0x18')],_0x305622;if(_0x1e73ac>=_0x4bc639){_0x1e73ac=_0x4bc639;_0x305622=0xc8;}else{_0x305622=0xce;}_0x46dd5f[_0x631b('0x15')](_0x305622);return _0x46dd5f[_0x631b('0x19')](_0x631b('0x1a'),_0x1144ea+'-'+_0x1e73ac+'/'+_0x4bc639)[_0x631b('0x16')](_0x2f873);}return null;};}function patchUpdates(_0x199d2f){return function(_0x4f1d5d){try{jsonpatch[_0x631b('0x1b')](_0x4f1d5d,_0x199d2f,!![]);}catch(_0x4e5f12){return BPromise['reject'](_0x4e5f12);}return _0x4f1d5d['save']();};}function saveUpdates(_0x4f65be,_0x4cf7eb){return function(_0x1a42fc){if(_0x1a42fc){return _0x1a42fc['update'](_0x4f65be)['then'](function(_0x38d464){return _0x38d464;});}return null;};}function removeEntity(_0x3f9e38,_0x459e42){return function(_0x79966){if(_0x79966){return _0x79966[_0x631b('0x1c')]()[_0x631b('0x1d')](function(){_0x3f9e38[_0x631b('0x15')](0xcc)[_0x631b('0x1e')]();});}};}function handleEntityNotFound(_0x2ef406,_0xe1a6a9){return function(_0x4deb06){if(!_0x4deb06){_0x2ef406['sendStatus'](0x194);}return _0x4deb06;};}function handleError(_0x5b862b,_0x2f7677){_0x2f7677=_0x2f7677||0x1f4;return function(_0x2e05fe){logger['error'](_0x2e05fe[_0x631b('0x1f')]);if(_0x2e05fe['name']){delete _0x2e05fe[_0x631b('0x20')];}_0x5b862b[_0x631b('0x15')](_0x2f7677)[_0x631b('0x21')](_0x2e05fe);};}exports[_0x631b('0x22')]=function(_0x3cdcad,_0x1a9541){var _0x47d9bc={},_0x20f7e7={},_0x86e5bc={'count':0x0,'rows':[]};var _0x1e9b13=_[_0x631b('0x23')](db['SmsQueueReport'][_0x631b('0x24')],function(_0x385604){return{'name':_0x385604[_0x631b('0x25')],'type':_0x385604['type'][_0x631b('0x26')]};});_0x20f7e7['model']=_[_0x631b('0x23')](_0x1e9b13,_0x631b('0x20'));_0x20f7e7['query']=_['keys'](_0x3cdcad[_0x631b('0x27')]);_0x20f7e7[_0x631b('0x28')]=_['intersection'](_0x20f7e7[_0x631b('0x29')],_0x20f7e7['query']);_0x47d9bc['attributes']=_[_0x631b('0x2a')](_0x20f7e7[_0x631b('0x29')],qs[_0x631b('0x2b')](_0x3cdcad['query']['fields']));_0x47d9bc[_0x631b('0x2c')]=_0x47d9bc['attributes'][_0x631b('0x2d')]?_0x47d9bc[_0x631b('0x2c')]:_0x20f7e7[_0x631b('0x29')];if(!_0x3cdcad[_0x631b('0x27')][_0x631b('0x2e')](_0x631b('0x2f'))){_0x47d9bc['limit']=qs[_0x631b('0x18')](_0x3cdcad['query'][_0x631b('0x18')]);_0x47d9bc[_0x631b('0x17')]=qs['offset'](_0x3cdcad[_0x631b('0x27')]['offset']);}_0x47d9bc['order']=qs['sort'](_0x3cdcad[_0x631b('0x27')][_0x631b('0x30')]);_0x47d9bc['where']=qs[_0x631b('0x28')](_[_0x631b('0x31')](_0x3cdcad[_0x631b('0x27')],_0x20f7e7[_0x631b('0x28')]),_0x1e9b13);if(_0x3cdcad[_0x631b('0x27')]['filter']){_0x47d9bc[_0x631b('0x32')]=_[_0x631b('0x33')](_0x47d9bc[_0x631b('0x32')],{'$or':_['map'](_0x1e9b13,function(_0x49c187){if(_0x49c187[_0x631b('0x34')]!=='VIRTUAL'){var _0x440f78={};_0x440f78[_0x49c187['name']]={'$like':'%'+_0x3cdcad[_0x631b('0x27')][_0x631b('0x35')]+'%'};return _0x440f78;}})});}_0x47d9bc=_[_0x631b('0x33')]({},_0x47d9bc,_0x3cdcad['options']);var _0x195708={'where':_0x47d9bc[_0x631b('0x32')]};return db['SmsQueueReport'][_0x631b('0x36')](_0x195708)[_0x631b('0x1d')](function(_0x20d672){_0x86e5bc[_0x631b('0x36')]=_0x20d672;if(_0x3cdcad[_0x631b('0x27')][_0x631b('0x37')]){_0x47d9bc['include']=[{'all':!![]}];}return db[_0x631b('0x38')]['findAll'](_0x47d9bc);})[_0x631b('0x1d')](function(_0x91b452){_0x86e5bc[_0x631b('0x39')]=_0x91b452;return _0x86e5bc;})[_0x631b('0x1d')](respondWithFilteredResult(_0x1a9541,_0x47d9bc))[_0x631b('0x3a')](handleError(_0x1a9541,null));};exports[_0x631b('0x3b')]=function(_0x12b817,_0x2ca95d){var _0x375a46={'raw':!![],'where':{'id':_0x12b817['params']['id']}},_0x361664={};_0x361664[_0x631b('0x29')]=_[_0x631b('0x3c')](db[_0x631b('0x38')]['rawAttributes']);_0x361664[_0x631b('0x27')]=_[_0x631b('0x3c')](_0x12b817['query']);_0x361664[_0x631b('0x28')]=_[_0x631b('0x2a')](_0x361664[_0x631b('0x29')],_0x361664[_0x631b('0x27')]);_0x375a46[_0x631b('0x2c')]=_[_0x631b('0x2a')](_0x361664[_0x631b('0x29')],qs[_0x631b('0x2b')](_0x12b817[_0x631b('0x27')][_0x631b('0x2b')]));_0x375a46['attributes']=_0x375a46['attributes'][_0x631b('0x2d')]?_0x375a46['attributes']:_0x361664[_0x631b('0x29')];if(_0x12b817[_0x631b('0x27')]['includeAll']){_0x375a46['include']=[{'all':!![]}];}_0x375a46=_[_0x631b('0x33')]({},_0x375a46,_0x12b817[_0x631b('0x3d')]);return db['SmsQueueReport'][_0x631b('0x3e')](_0x375a46)[_0x631b('0x1d')](handleEntityNotFound(_0x2ca95d,null))[_0x631b('0x1d')](respondWithResult(_0x2ca95d,null))['catch'](handleError(_0x2ca95d,null));};exports[_0x631b('0x3f')]=function(_0x57ecf3,_0xb41c51){return db[_0x631b('0x38')][_0x631b('0x3f')](_0x57ecf3[_0x631b('0x40')],{})[_0x631b('0x1d')](respondWithResult(_0xb41c51,0xc9))[_0x631b('0x3a')](handleError(_0xb41c51,null));};exports[_0x631b('0x41')]=function(_0x4bee69,_0x3eba34){if(_0x4bee69['body']['id']){delete _0x4bee69[_0x631b('0x40')]['id'];}return db[_0x631b('0x38')][_0x631b('0x3e')]({'where':{'id':_0x4bee69[_0x631b('0x42')]['id']}})[_0x631b('0x1d')](handleEntityNotFound(_0x3eba34,null))['then'](saveUpdates(_0x4bee69[_0x631b('0x40')],null))[_0x631b('0x1d')](respondWithResult(_0x3eba34,null))[_0x631b('0x3a')](handleError(_0x3eba34,null));};exports[_0x631b('0x1c')]=function(_0x3f1c02,_0x27c584){return db['SmsQueueReport']['find']({'where':{'id':_0x3f1c02[_0x631b('0x42')]['id']}})['then'](handleEntityNotFound(_0x27c584,null))[_0x631b('0x1d')](removeEntity(_0x27c584,null))[_0x631b('0x3a')](handleError(_0x27c584,null));};exports[_0x631b('0x43')]=function(_0xfe3b86,_0x2817cd){return db[_0x631b('0x38')][_0x631b('0x43')]()[_0x631b('0x1d')](respondWithResult(_0x2817cd,null))[_0x631b('0x3a')](handleError(_0x2817cd,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index c97fd20..fe23c3f 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 _0x6995=['path','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','report_sms_queue','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1a16a6,_0x405141){var _0x5e3d0b=function(_0x314c34){while(--_0x314c34){_0x1a16a6['push'](_0x1a16a6['shift']());}};_0x5e3d0b(++_0x405141);}(_0x6995,0xfd));var _0x5699=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x6995[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x5699('0x0'));var util=require(_0x5699('0x1'));var logger=require(_0x5699('0x2'))(_0x5699('0x3'));var moment=require(_0x5699('0x4'));var BPromise=require(_0x5699('0x5'));var rp=require(_0x5699('0x6'));var fs=require('fs');var path=require(_0x5699('0x7'));var rimraf=require('rimraf');var config=require(_0x5699('0x8'));var attributes=require(_0x5699('0x9'));module['exports']=function(_0x362505,_0x1278fb){return _0x362505[_0x5699('0xa')](_0x5699('0xb'),attributes,{'tableName':_0x5699('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0849=['moment','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0849,0xca));var _0x9084=function(_0x1b65c6,_0x295b12){_0x1b65c6=_0x1b65c6-0x0;var _0x4ce2ae=_0x0849[_0x1b65c6];return _0x4ce2ae;};'use strict';var _=require(_0x9084('0x0'));var util=require(_0x9084('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9084('0x2'));var BPromise=require(_0x9084('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9084('0x4'));var rimraf=require(_0x9084('0x5'));var config=require(_0x9084('0x6'));var attributes=require(_0x9084('0x7'));module['exports']=function(_0x321e2e,_0x42288f){return _0x321e2e[_0x9084('0x8')](_0x9084('0x9'),attributes,{'tableName':_0x9084('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9084('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 819bcd6..51781a5 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 _0x2bec=['create','body','options','raw','then','UpdateSmsQueueReport','update','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateSmsQueueReport','SmsQueueReport'];(function(_0x2aeeb1,_0x92e412){var _0x12e777=function(_0x5863cc){while(--_0x5863cc){_0x2aeeb1['push'](_0x2aeeb1['shift']());}};_0x12e777(++_0x92e412);}(_0x2bec,0xbd));var _0xc2be=function(_0x5bb0ce,_0x2d6da3){_0x5bb0ce=_0x5bb0ce-0x0;var _0x90d4d2=_0x2bec[_0x5bb0ce];return _0x90d4d2;};'use strict';var _=require(_0xc2be('0x0'));var util=require(_0xc2be('0x1'));var moment=require(_0xc2be('0x2'));var BPromise=require(_0xc2be('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc2be('0x4'));var db=require(_0xc2be('0x5'))['db'];var utils=require(_0xc2be('0x6'));var logger=require(_0xc2be('0x7'))('rpc');var config=require(_0xc2be('0x8'));var jayson=require(_0xc2be('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36d18d,_0x1975c2,_0x161557){return new BPromise(function(_0x3b38a6,_0x3e36c5){return client['request'](_0x36d18d,_0x161557)['then'](function(_0x3332a2){logger['info'](_0xc2be('0xa'),_0x1975c2,_0xc2be('0xb'));logger[_0xc2be('0xc')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x1975c2,_0xc2be('0xb'),JSON[_0xc2be('0xd')](_0x3332a2));if(_0x3332a2['error']){if(_0x3332a2[_0xc2be('0xe')][_0xc2be('0xf')]===0x1f4){logger[_0xc2be('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x1975c2,_0x3332a2['error']['message']);return _0x3e36c5(_0x3332a2['error'][_0xc2be('0x10')]);}logger[_0xc2be('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x1975c2,_0x3332a2['error'][_0xc2be('0x10')]);return _0x3b38a6(_0x3332a2[_0xc2be('0xe')][_0xc2be('0x10')]);}else{logger[_0xc2be('0x11')](_0xc2be('0xa'),_0x1975c2,'request\x20sent');_0x3b38a6(_0x3332a2['result'][_0xc2be('0x10')]);}})[_0xc2be('0x12')](function(_0x191e20){logger[_0xc2be('0xe')](_0xc2be('0xa'),_0x1975c2,_0x191e20);_0x3e36c5(_0x191e20);});});}exports[_0xc2be('0x13')]=function(_0x1926e8){var _0x1a4363=this;return new Promise(function(_0xc237b6,_0x306eb4){return db[_0xc2be('0x14')][_0xc2be('0x15')](_0x1926e8[_0xc2be('0x16')],{'raw':_0x1926e8[_0xc2be('0x17')]?_0x1926e8['options'][_0xc2be('0x18')]===undefined?!![]:![]:!![]})[_0xc2be('0x19')](function(_0x3a5685){logger[_0xc2be('0x11')](_0xc2be('0x13'),_0x1926e8);logger[_0xc2be('0xc')]('CreateSmsQueueReport',_0x1926e8,JSON[_0xc2be('0xd')](_0x3a5685));_0xc237b6(_0x3a5685);})[_0xc2be('0x12')](function(_0x16a12b){logger[_0xc2be('0xe')](_0xc2be('0x13'),_0x16a12b[_0xc2be('0x10')],_0x1926e8);_0x306eb4(_0x1a4363['error'](0x1f4,_0x16a12b[_0xc2be('0x10')]));});});};exports[_0xc2be('0x1a')]=function(_0x122adf){var _0x2839c5=this;return new Promise(function(_0x4e6572,_0x110342){return db['SmsQueueReport'][_0xc2be('0x1b')](_0x122adf[_0xc2be('0x16')],{'raw':_0x122adf[_0xc2be('0x17')]?_0x122adf[_0xc2be('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x122adf[_0xc2be('0x17')]?_0x122adf['options'][_0xc2be('0x1c')]||null:null,'attributes':_0x122adf['options']?_0x122adf[_0xc2be('0x17')]['attributes']||null:null,'limit':_0x122adf[_0xc2be('0x17')]?_0x122adf[_0xc2be('0x17')][_0xc2be('0x1d')]||null:null})[_0xc2be('0x19')](function(_0x4d2a93){logger[_0xc2be('0x11')](_0xc2be('0x1a'),_0x122adf);logger['debug']('UpdateSmsQueueReport',_0x122adf,JSON[_0xc2be('0xd')](_0x4d2a93));_0x4e6572(_0x4d2a93);})[_0xc2be('0x12')](function(_0x10ce2d){logger[_0xc2be('0xe')](_0xc2be('0x1a'),_0x10ce2d[_0xc2be('0x10')],_0x122adf);_0x110342(_0x2839c5['error'](0x1f4,_0x10ce2d[_0xc2be('0x10')]));});});}; \ No newline at end of file +var _0x2bdd=['ioredis','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','create','body','options','CreateSmsQueueReport','UpdateSmsQueueReport','update','raw','where','limit','util','moment','bluebird'];(function(_0x5a349d,_0x3b73b5){var _0x3643a1=function(_0x22fe6b){while(--_0x22fe6b){_0x5a349d['push'](_0x5a349d['shift']());}};_0x3643a1(++_0x3b73b5);}(_0x2bdd,0x71));var _0xd2bd=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x2bdd[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require('lodash');var util=require(_0xd2bd('0x0'));var moment=require(_0xd2bd('0x1'));var BPromise=require(_0xd2bd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd2bd('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd2bd('0x4'));var jayson=require(_0xd2bd('0x5'));var client=jayson[_0xd2bd('0x6')][_0xd2bd('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x100bfc,_0x4b335c,_0x555e30){return new BPromise(function(_0x48cb61,_0x2d40aa){return client[_0xd2bd('0x8')](_0x100bfc,_0x555e30)[_0xd2bd('0x9')](function(_0x1d3a6f){logger[_0xd2bd('0xa')](_0xd2bd('0xb'),_0x4b335c,_0xd2bd('0xc'));logger[_0xd2bd('0xd')](_0xd2bd('0xe'),_0x4b335c,'request\x20sent',JSON[_0xd2bd('0xf')](_0x1d3a6f));if(_0x1d3a6f[_0xd2bd('0x10')]){if(_0x1d3a6f[_0xd2bd('0x10')]['code']===0x1f4){logger[_0xd2bd('0x10')](_0xd2bd('0xb'),_0x4b335c,_0x1d3a6f[_0xd2bd('0x10')][_0xd2bd('0x11')]);return _0x2d40aa(_0x1d3a6f[_0xd2bd('0x10')][_0xd2bd('0x11')]);}logger[_0xd2bd('0x10')](_0xd2bd('0xb'),_0x4b335c,_0x1d3a6f[_0xd2bd('0x10')]['message']);return _0x48cb61(_0x1d3a6f['error'][_0xd2bd('0x11')]);}else{logger['info'](_0xd2bd('0xb'),_0x4b335c,'request\x20sent');_0x48cb61(_0x1d3a6f[_0xd2bd('0x12')][_0xd2bd('0x11')]);}})[_0xd2bd('0x13')](function(_0x4df64f){logger['error'](_0xd2bd('0xb'),_0x4b335c,_0x4df64f);_0x2d40aa(_0x4df64f);});});}exports['CreateSmsQueueReport']=function(_0x198ef0){var _0x28f61c=this;return new Promise(function(_0x32e5d5,_0x1e48ce){return db['SmsQueueReport'][_0xd2bd('0x14')](_0x198ef0[_0xd2bd('0x15')],{'raw':_0x198ef0[_0xd2bd('0x16')]?_0x198ef0[_0xd2bd('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xd2bd('0x9')](function(_0x10f52e){logger[_0xd2bd('0xa')](_0xd2bd('0x17'),_0x198ef0);logger[_0xd2bd('0xd')](_0xd2bd('0x17'),_0x198ef0,JSON[_0xd2bd('0xf')](_0x10f52e));_0x32e5d5(_0x10f52e);})[_0xd2bd('0x13')](function(_0x19052e){logger[_0xd2bd('0x10')]('CreateSmsQueueReport',_0x19052e[_0xd2bd('0x11')],_0x198ef0);_0x1e48ce(_0x28f61c['error'](0x1f4,_0x19052e[_0xd2bd('0x11')]));});});};exports[_0xd2bd('0x18')]=function(_0x38f3b2){var _0xc06457=this;return new Promise(function(_0x4c21a1,_0x3e9b07){return db['SmsQueueReport'][_0xd2bd('0x19')](_0x38f3b2[_0xd2bd('0x15')],{'raw':_0x38f3b2[_0xd2bd('0x16')]?_0x38f3b2[_0xd2bd('0x16')][_0xd2bd('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38f3b2[_0xd2bd('0x16')]?_0x38f3b2['options'][_0xd2bd('0x1b')]||null:null,'attributes':_0x38f3b2[_0xd2bd('0x16')]?_0x38f3b2[_0xd2bd('0x16')]['attributes']||null:null,'limit':_0x38f3b2['options']?_0x38f3b2['options'][_0xd2bd('0x1c')]||null:null})['then'](function(_0x62df94){logger[_0xd2bd('0xa')]('UpdateSmsQueueReport',_0x38f3b2);logger[_0xd2bd('0xd')](_0xd2bd('0x18'),_0x38f3b2,JSON['stringify'](_0x62df94));_0x4c21a1(_0x62df94);})[_0xd2bd('0x13')](function(_0x2c60b5){logger['error'](_0xd2bd('0x18'),_0x2c60b5['message'],_0x38f3b2);_0x3e9b07(_0xc06457[_0xd2bd('0x10')](0x1f4,_0x2c60b5[_0xd2bd('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 3ad7713..1cd1188 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 _0x3233=['./smsTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1becf6,_0x1c3ceb){var _0x5d8626=function(_0x271756){while(--_0x271756){_0x1becf6['push'](_0x1becf6['shift']());}};_0x5d8626(++_0x1c3ceb);}(_0x3233,0x1f0));var _0x3323=function(_0x1db0c4,_0x98cdb2){_0x1db0c4=_0x1db0c4-0x0;var _0x59a1b8=_0x3233[_0x1db0c4];return _0x59a1b8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3323('0x0'));var timeout=require(_0x3323('0x1'));var express=require(_0x3323('0x2'));var router=express[_0x3323('0x3')]();var fs_extra=require(_0x3323('0x4'));var auth=require(_0x3323('0x5'));var interaction=require(_0x3323('0x6'));var config=require(_0x3323('0x7'));var controller=require(_0x3323('0x8'));router[_0x3323('0x9')]('/',auth[_0x3323('0xa')](),controller['index']);router['get'](_0x3323('0xb'),auth[_0x3323('0xa')](),controller[_0x3323('0xc')]);router[_0x3323('0x9')](_0x3323('0xd'),auth[_0x3323('0xa')](),controller['show']);router[_0x3323('0xe')]('/',auth[_0x3323('0xa')](),controller[_0x3323('0xf')]);router[_0x3323('0x10')](_0x3323('0xd'),auth[_0x3323('0xa')](),controller['update']);router['delete'](_0x3323('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x3323('0x11')]=router; \ No newline at end of file +var _0x16f6=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','create','delete','destroy','exports'];(function(_0x58fae5,_0xea34ed){var _0x2c5345=function(_0x16879f){while(--_0x16879f){_0x58fae5['push'](_0x58fae5['shift']());}};_0x2c5345(++_0xea34ed);}(_0x16f6,0xc8));var _0x616f=function(_0x2c76c4,_0x8720e9){_0x2c76c4=_0x2c76c4-0x0;var _0x4e7aba=_0x16f6[_0x2c76c4];return _0x4e7aba;};'use strict';var multer=require(_0x616f('0x0'));var util=require(_0x616f('0x1'));var path=require(_0x616f('0x2'));var timeout=require(_0x616f('0x3'));var express=require(_0x616f('0x4'));var router=express[_0x616f('0x5')]();var fs_extra=require(_0x616f('0x6'));var auth=require(_0x616f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x616f('0x8'));var controller=require(_0x616f('0x9'));router[_0x616f('0xa')]('/',auth[_0x616f('0xb')](),controller[_0x616f('0xc')]);router[_0x616f('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x616f('0xd')]);router[_0x616f('0xa')](_0x616f('0xe'),auth[_0x616f('0xb')](),controller[_0x616f('0xf')]);router['post']('/',auth[_0x616f('0xb')](),controller[_0x616f('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x616f('0x11')]('/:id',auth[_0x616f('0xb')](),controller[_0x616f('0x12')]);module[_0x616f('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index a874ee5..e9af059 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 _0x0068=['NOW','moment','sequelize','ENUM','queue'];(function(_0xbfde09,_0xc1fd96){var _0x1b6761=function(_0x4e382c){while(--_0x4e382c){_0xbfde09['push'](_0xbfde09['shift']());}};_0x1b6761(++_0xc1fd96);}(_0x0068,0x1f0));var _0x8006=function(_0x3fd318,_0x59f0c6){_0x3fd318=_0x3fd318-0x0;var _0x2c51d5=_0x0068[_0x3fd318];return _0x2c51d5;};'use strict';var moment=require(_0x8006('0x0'));var Sequelize=require(_0x8006('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x8006('0x2')]('account','agent',_0x8006('0x3')),'allowNull':![],'defaultValue':_0x8006('0x3')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x8006('0x4')]}}; \ No newline at end of file +var _0x9537=['NOW','sequelize','STRING','ENUM','account','queue','DATE'];(function(_0x178668,_0x1ec300){var _0x26107d=function(_0x4c0aa8){while(--_0x4c0aa8){_0x178668['push'](_0x178668['shift']());}};_0x26107d(++_0x1ec300);}(_0x9537,0x151));var _0x7953=function(_0x424b05,_0x526b5b){_0x424b05=_0x424b05-0x0;var _0x4c65cd=_0x9537[_0x424b05];return _0x4c65cd;};'use strict';var moment=require('moment');var Sequelize=require(_0x7953('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7953('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x7953('0x2')](_0x7953('0x3'),'agent',_0x7953('0x4')),'allowNull':![],'defaultValue':_0x7953('0x4')},'transferredAt':{'type':Sequelize[_0x7953('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x7953('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 81c4936..e8c2c07 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 _0xae0a=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','save','destroy','error','stack','name','send','index','SmsTransferReport','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','pick','where','merge','filter','options','then','includeAll','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util'];(function(_0x917400,_0x18c502){var _0x466e82=function(_0x398d3e){while(--_0x398d3e){_0x917400['push'](_0x917400['shift']());}};_0x466e82(++_0x18c502);}(_0xae0a,0x8e));var _0xaae0=function(_0x4efc25,_0x2367e1){_0x4efc25=_0x4efc25-0x0;var _0x51fae8=_0xae0a[_0x4efc25];return _0x51fae8;};'use strict';var pdf=require(_0xaae0('0x0'));var emlformat=require(_0xaae0('0x1'));var rimraf=require(_0xaae0('0x2'));var zipdir=require(_0xaae0('0x3'));var jsonpatch=require(_0xaae0('0x4'));var rp=require('request-promise');var moment=require(_0xaae0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xaae0('0x6'));var util=require(_0xaae0('0x7'));var path=require(_0xaae0('0x8'));var sox=require(_0xaae0('0x9'));var csv=require(_0xaae0('0xa'));var ejs=require(_0xaae0('0xb'));var fs=require('fs');var fs_extra=require(_0xaae0('0xc'));var _=require(_0xaae0('0xd'));var squel=require(_0xaae0('0xe'));var crypto=require(_0xaae0('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xaae0('0x10'));var toCsv=require('to-csv');var querystring=require(_0xaae0('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaae0('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xaae0('0x13'));var hardwareService=require(_0xaae0('0x14'));var logger=require(_0xaae0('0x15'))(_0xaae0('0x16'));var utils=require('../../config/utils');var config=require(_0xaae0('0x17'));var licenseUtil=require(_0xaae0('0x18'));var db=require(_0xaae0('0x19'))['db'];function respondWithStatusCode(_0x405cd4,_0x53512b){_0x53512b=_0x53512b||0xcc;return function(_0x350e4a){if(_0x350e4a){return _0x405cd4[_0xaae0('0x1a')](_0x53512b);}return _0x405cd4[_0xaae0('0x1b')](_0x53512b)[_0xaae0('0x1c')]();};}function respondWithResult(_0x2a8094,_0x10f5cd){_0x10f5cd=_0x10f5cd||0xc8;return function(_0x572fc9){if(_0x572fc9){return _0x2a8094[_0xaae0('0x1b')](_0x10f5cd)['json'](_0x572fc9);}};}function respondWithFilteredResult(_0x32f606,_0x2d6150){return function(_0x4d39b9){if(_0x4d39b9){var _0x3bb003=_0x4d39b9[_0xaae0('0x1d')],_0x1f01c5=_0x2d6150[_0xaae0('0x1e')],_0xb4c670=_0x2d6150[_0xaae0('0x1e')]+_0x2d6150[_0xaae0('0x1f')],_0x4013bb;if(_0xb4c670>=_0x3bb003){_0xb4c670=_0x3bb003;_0x4013bb=0xc8;}else{_0x4013bb=0xce;}_0x32f606[_0xaae0('0x1b')](_0x4013bb);return _0x32f606['set'](_0xaae0('0x20'),_0x1f01c5+'-'+_0xb4c670+'/'+_0x3bb003)['json'](_0x4d39b9);}return null;};}function patchUpdates(_0xd941e7){return function(_0x583fc9){try{jsonpatch[_0xaae0('0x21')](_0x583fc9,_0xd941e7,!![]);}catch(_0x38ce03){return BPromise[_0xaae0('0x22')](_0x38ce03);}return _0x583fc9[_0xaae0('0x23')]();};}function saveUpdates(_0x12520c,_0x447e53){return function(_0x349625){if(_0x349625){return _0x349625['update'](_0x12520c)['then'](function(_0xf9e92){return _0xf9e92;});}return null;};}function removeEntity(_0x4f08d2,_0x2d63d7){return function(_0x35a5ed){if(_0x35a5ed){return _0x35a5ed[_0xaae0('0x24')]()['then'](function(){_0x4f08d2[_0xaae0('0x1b')](0xcc)[_0xaae0('0x1c')]();});}};}function handleEntityNotFound(_0x5b8cf1,_0x1831e4){return function(_0x5cc21e){if(!_0x5cc21e){_0x5b8cf1['sendStatus'](0x194);}return _0x5cc21e;};}function handleError(_0x32dfe1,_0x515558){_0x515558=_0x515558||0x1f4;return function(_0x69e15b){logger[_0xaae0('0x25')](_0x69e15b[_0xaae0('0x26')]);if(_0x69e15b['name']){delete _0x69e15b[_0xaae0('0x27')];}_0x32dfe1[_0xaae0('0x1b')](_0x515558)[_0xaae0('0x28')](_0x69e15b);};}exports[_0xaae0('0x29')]=function(_0x2f8f61,_0x2e8c55){var _0x3e37b2={},_0x518b33={},_0x245371={'count':0x0,'rows':[]};var _0x2d9357=_['map'](db[_0xaae0('0x2a')]['rawAttributes'],function(_0x11b335){return{'name':_0x11b335[_0xaae0('0x2b')],'type':_0x11b335[_0xaae0('0x2c')][_0xaae0('0x2d')]};});_0x518b33[_0xaae0('0x2e')]=_[_0xaae0('0x2f')](_0x2d9357,_0xaae0('0x27'));_0x518b33[_0xaae0('0x30')]=_[_0xaae0('0x31')](_0x2f8f61[_0xaae0('0x30')]);_0x518b33[_0xaae0('0x32')]=_['intersection'](_0x518b33[_0xaae0('0x2e')],_0x518b33[_0xaae0('0x30')]);_0x3e37b2[_0xaae0('0x33')]=_[_0xaae0('0x34')](_0x518b33['model'],qs[_0xaae0('0x35')](_0x2f8f61[_0xaae0('0x30')][_0xaae0('0x35')]));_0x3e37b2[_0xaae0('0x33')]=_0x3e37b2[_0xaae0('0x33')][_0xaae0('0x36')]?_0x3e37b2['attributes']:_0x518b33['model'];if(!_0x2f8f61[_0xaae0('0x30')]['hasOwnProperty'](_0xaae0('0x37'))){_0x3e37b2[_0xaae0('0x1f')]=qs[_0xaae0('0x1f')](_0x2f8f61[_0xaae0('0x30')][_0xaae0('0x1f')]);_0x3e37b2[_0xaae0('0x1e')]=qs['offset'](_0x2f8f61[_0xaae0('0x30')]['offset']);}_0x3e37b2['order']=qs[_0xaae0('0x38')](_0x2f8f61[_0xaae0('0x30')]['sort']);_0x3e37b2['where']=qs[_0xaae0('0x32')](_[_0xaae0('0x39')](_0x2f8f61[_0xaae0('0x30')],_0x518b33[_0xaae0('0x32')]),_0x2d9357);if(_0x2f8f61['query']['filter']){_0x3e37b2[_0xaae0('0x3a')]=_[_0xaae0('0x3b')](_0x3e37b2[_0xaae0('0x3a')],{'$or':_[_0xaae0('0x2f')](_0x2d9357,function(_0x20fd59){if(_0x20fd59[_0xaae0('0x2c')]!=='VIRTUAL'){var _0x2f15e0={};_0x2f15e0[_0x20fd59[_0xaae0('0x27')]]={'$like':'%'+_0x2f8f61[_0xaae0('0x30')][_0xaae0('0x3c')]+'%'};return _0x2f15e0;}})});}_0x3e37b2=_[_0xaae0('0x3b')]({},_0x3e37b2,_0x2f8f61[_0xaae0('0x3d')]);var _0x1dbdc7={'where':_0x3e37b2['where']};return db['SmsTransferReport'][_0xaae0('0x1d')](_0x1dbdc7)[_0xaae0('0x3e')](function(_0x46120c){_0x245371[_0xaae0('0x1d')]=_0x46120c;if(_0x2f8f61[_0xaae0('0x30')][_0xaae0('0x3f')]){_0x3e37b2['include']=[{'all':!![]}];}return db[_0xaae0('0x2a')][_0xaae0('0x40')](_0x3e37b2);})[_0xaae0('0x3e')](function(_0x91bf48){_0x245371[_0xaae0('0x41')]=_0x91bf48;return _0x245371;})[_0xaae0('0x3e')](respondWithFilteredResult(_0x2e8c55,_0x3e37b2))[_0xaae0('0x42')](handleError(_0x2e8c55,null));};exports[_0xaae0('0x43')]=function(_0xf43277,_0x12bb57){var _0x5da7fa={'raw':!![],'where':{'id':_0xf43277[_0xaae0('0x44')]['id']}},_0x1a99d5={};_0x1a99d5[_0xaae0('0x2e')]=_[_0xaae0('0x31')](db[_0xaae0('0x2a')][_0xaae0('0x45')]);_0x1a99d5['query']=_[_0xaae0('0x31')](_0xf43277['query']);_0x1a99d5[_0xaae0('0x32')]=_[_0xaae0('0x34')](_0x1a99d5[_0xaae0('0x2e')],_0x1a99d5[_0xaae0('0x30')]);_0x5da7fa[_0xaae0('0x33')]=_[_0xaae0('0x34')](_0x1a99d5[_0xaae0('0x2e')],qs[_0xaae0('0x35')](_0xf43277[_0xaae0('0x30')]['fields']));_0x5da7fa[_0xaae0('0x33')]=_0x5da7fa['attributes'][_0xaae0('0x36')]?_0x5da7fa[_0xaae0('0x33')]:_0x1a99d5[_0xaae0('0x2e')];if(_0xf43277['query'][_0xaae0('0x3f')]){_0x5da7fa['include']=[{'all':!![]}];}_0x5da7fa=_[_0xaae0('0x3b')]({},_0x5da7fa,_0xf43277['options']);return db[_0xaae0('0x2a')][_0xaae0('0x46')](_0x5da7fa)[_0xaae0('0x3e')](handleEntityNotFound(_0x12bb57,null))[_0xaae0('0x3e')](respondWithResult(_0x12bb57,null))[_0xaae0('0x42')](handleError(_0x12bb57,null));};exports['create']=function(_0x4b728a,_0x54f3e2){return db[_0xaae0('0x2a')][_0xaae0('0x47')](_0x4b728a[_0xaae0('0x48')],{})['then'](respondWithResult(_0x54f3e2,0xc9))[_0xaae0('0x42')](handleError(_0x54f3e2,null));};exports[_0xaae0('0x49')]=function(_0x2ffefe,_0x36b52c){if(_0x2ffefe[_0xaae0('0x48')]['id']){delete _0x2ffefe[_0xaae0('0x48')]['id'];}return db[_0xaae0('0x2a')]['find']({'where':{'id':_0x2ffefe[_0xaae0('0x44')]['id']}})[_0xaae0('0x3e')](handleEntityNotFound(_0x36b52c,null))[_0xaae0('0x3e')](saveUpdates(_0x2ffefe[_0xaae0('0x48')],null))[_0xaae0('0x3e')](respondWithResult(_0x36b52c,null))[_0xaae0('0x42')](handleError(_0x36b52c,null));};exports[_0xaae0('0x24')]=function(_0x854ddb,_0x3c0a8a){return db[_0xaae0('0x2a')][_0xaae0('0x46')]({'where':{'id':_0x854ddb[_0xaae0('0x44')]['id']}})[_0xaae0('0x3e')](handleEntityNotFound(_0x3c0a8a,null))[_0xaae0('0x3e')](removeEntity(_0x3c0a8a,null))['catch'](handleError(_0x3c0a8a,null));};exports[_0xaae0('0x4a')]=function(_0x411979,_0x5efcb0){return db['SmsTransferReport'][_0xaae0('0x4a')]()['then'](respondWithResult(_0x5efcb0,null))[_0xaae0('0x42')](handleError(_0x5efcb0,null));}; \ No newline at end of file +var _0xbba0=['length','hasOwnProperty','nolimit','order','where','filters','pick','type','VIRTUAL','filter','options','SmsTransferReport','includeAll','include','rows','catch','params','keys','merge','find','create','body','destroy','html-pdf','rimraf','zip-dir','fast-json-patch','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','then','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','attributes','intersection','fields'];(function(_0x19fe32,_0x3a8828){var _0x3185cd=function(_0x1162c1){while(--_0x1162c1){_0x19fe32['push'](_0x19fe32['shift']());}};_0x3185cd(++_0x3a8828);}(_0xbba0,0xf5));var _0x0bba=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xbba0[_0x36ed48];return _0x51c63a;};'use strict';var pdf=require(_0x0bba('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0bba('0x1'));var zipdir=require(_0x0bba('0x2'));var jsonpatch=require(_0x0bba('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0bba('0x4'));var Mustache=require(_0x0bba('0x5'));var util=require(_0x0bba('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0bba('0x7'));var ejs=require(_0x0bba('0x8'));var fs=require('fs');var fs_extra=require(_0x0bba('0x9'));var _=require('lodash');var squel=require(_0x0bba('0xa'));var crypto=require(_0x0bba('0xb'));var jsforce=require(_0x0bba('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0bba('0xd'));var Papa=require(_0x0bba('0xe'));var Redis=require(_0x0bba('0xf'));var authService=require(_0x0bba('0x10'));var qs=require(_0x0bba('0x11'));var as=require(_0x0bba('0x12'));var hardwareService=require(_0x0bba('0x13'));var logger=require(_0x0bba('0x14'))(_0x0bba('0x15'));var utils=require(_0x0bba('0x16'));var config=require(_0x0bba('0x17'));var licenseUtil=require(_0x0bba('0x18'));var db=require(_0x0bba('0x19'))['db'];function respondWithStatusCode(_0x4a4134,_0x5e9cd2){_0x5e9cd2=_0x5e9cd2||0xcc;return function(_0x58b3eb){if(_0x58b3eb){return _0x4a4134[_0x0bba('0x1a')](_0x5e9cd2);}return _0x4a4134[_0x0bba('0x1b')](_0x5e9cd2)[_0x0bba('0x1c')]();};}function respondWithResult(_0x58085b,_0x2b3034){_0x2b3034=_0x2b3034||0xc8;return function(_0x3ea57f){if(_0x3ea57f){return _0x58085b[_0x0bba('0x1b')](_0x2b3034)['json'](_0x3ea57f);}};}function respondWithFilteredResult(_0xde4670,_0x68c148){return function(_0x1c39cf){if(_0x1c39cf){var _0x1876bf=_0x1c39cf[_0x0bba('0x1d')],_0x5cffce=_0x68c148[_0x0bba('0x1e')],_0x2c66e5=_0x68c148['offset']+_0x68c148[_0x0bba('0x1f')],_0x1a94b5;if(_0x2c66e5>=_0x1876bf){_0x2c66e5=_0x1876bf;_0x1a94b5=0xc8;}else{_0x1a94b5=0xce;}_0xde4670[_0x0bba('0x1b')](_0x1a94b5);return _0xde4670['set'](_0x0bba('0x20'),_0x5cffce+'-'+_0x2c66e5+'/'+_0x1876bf)[_0x0bba('0x21')](_0x1c39cf);}return null;};}function patchUpdates(_0x4a2a6b){return function(_0x42da1e){try{jsonpatch[_0x0bba('0x22')](_0x42da1e,_0x4a2a6b,!![]);}catch(_0x2d0af2){return BPromise['reject'](_0x2d0af2);}return _0x42da1e[_0x0bba('0x23')]();};}function saveUpdates(_0x38fec5,_0x44b609){return function(_0xd44019){if(_0xd44019){return _0xd44019[_0x0bba('0x24')](_0x38fec5)[_0x0bba('0x25')](function(_0x2889e3){return _0x2889e3;});}return null;};}function removeEntity(_0x392308,_0x5292b2){return function(_0xf651a3){if(_0xf651a3){return _0xf651a3['destroy']()[_0x0bba('0x25')](function(){_0x392308[_0x0bba('0x1b')](0xcc)[_0x0bba('0x1c')]();});}};}function handleEntityNotFound(_0x429ae7,_0x264539){return function(_0x6f3d08){if(!_0x6f3d08){_0x429ae7['sendStatus'](0x194);}return _0x6f3d08;};}function handleError(_0x359d50,_0x59bf72){_0x59bf72=_0x59bf72||0x1f4;return function(_0x2128ec){logger[_0x0bba('0x26')](_0x2128ec[_0x0bba('0x27')]);if(_0x2128ec[_0x0bba('0x28')]){delete _0x2128ec[_0x0bba('0x28')];}_0x359d50[_0x0bba('0x1b')](_0x59bf72)[_0x0bba('0x29')](_0x2128ec);};}exports['index']=function(_0x128240,_0x553a48){var _0x15c0bf={},_0x445088={},_0x467f17={'count':0x0,'rows':[]};var _0x317d3d=_[_0x0bba('0x2a')](db['SmsTransferReport'][_0x0bba('0x2b')],function(_0x7c6285){return{'name':_0x7c6285[_0x0bba('0x2c')],'type':_0x7c6285['type'][_0x0bba('0x2d')]};});_0x445088[_0x0bba('0x2e')]=_[_0x0bba('0x2a')](_0x317d3d,'name');_0x445088['query']=_['keys'](_0x128240[_0x0bba('0x2f')]);_0x445088['filters']=_['intersection'](_0x445088[_0x0bba('0x2e')],_0x445088[_0x0bba('0x2f')]);_0x15c0bf[_0x0bba('0x30')]=_[_0x0bba('0x31')](_0x445088[_0x0bba('0x2e')],qs['fields'](_0x128240[_0x0bba('0x2f')][_0x0bba('0x32')]));_0x15c0bf[_0x0bba('0x30')]=_0x15c0bf[_0x0bba('0x30')][_0x0bba('0x33')]?_0x15c0bf['attributes']:_0x445088[_0x0bba('0x2e')];if(!_0x128240['query'][_0x0bba('0x34')](_0x0bba('0x35'))){_0x15c0bf[_0x0bba('0x1f')]=qs[_0x0bba('0x1f')](_0x128240[_0x0bba('0x2f')][_0x0bba('0x1f')]);_0x15c0bf[_0x0bba('0x1e')]=qs[_0x0bba('0x1e')](_0x128240[_0x0bba('0x2f')][_0x0bba('0x1e')]);}_0x15c0bf[_0x0bba('0x36')]=qs['sort'](_0x128240[_0x0bba('0x2f')]['sort']);_0x15c0bf[_0x0bba('0x37')]=qs[_0x0bba('0x38')](_[_0x0bba('0x39')](_0x128240['query'],_0x445088[_0x0bba('0x38')]),_0x317d3d);if(_0x128240[_0x0bba('0x2f')]['filter']){_0x15c0bf['where']=_['merge'](_0x15c0bf[_0x0bba('0x37')],{'$or':_['map'](_0x317d3d,function(_0x3391af){if(_0x3391af[_0x0bba('0x3a')]!==_0x0bba('0x3b')){var _0x2c9e00={};_0x2c9e00[_0x3391af['name']]={'$like':'%'+_0x128240[_0x0bba('0x2f')][_0x0bba('0x3c')]+'%'};return _0x2c9e00;}})});}_0x15c0bf=_['merge']({},_0x15c0bf,_0x128240[_0x0bba('0x3d')]);var _0x4b0dcf={'where':_0x15c0bf[_0x0bba('0x37')]};return db[_0x0bba('0x3e')]['count'](_0x4b0dcf)[_0x0bba('0x25')](function(_0x125329){_0x467f17[_0x0bba('0x1d')]=_0x125329;if(_0x128240[_0x0bba('0x2f')][_0x0bba('0x3f')]){_0x15c0bf[_0x0bba('0x40')]=[{'all':!![]}];}return db[_0x0bba('0x3e')]['findAll'](_0x15c0bf);})[_0x0bba('0x25')](function(_0x31a3a2){_0x467f17[_0x0bba('0x41')]=_0x31a3a2;return _0x467f17;})['then'](respondWithFilteredResult(_0x553a48,_0x15c0bf))[_0x0bba('0x42')](handleError(_0x553a48,null));};exports['show']=function(_0x29d28,_0x3482c3){var _0x4de980={'raw':!![],'where':{'id':_0x29d28[_0x0bba('0x43')]['id']}},_0x4dff62={};_0x4dff62[_0x0bba('0x2e')]=_[_0x0bba('0x44')](db[_0x0bba('0x3e')]['rawAttributes']);_0x4dff62['query']=_['keys'](_0x29d28[_0x0bba('0x2f')]);_0x4dff62[_0x0bba('0x38')]=_[_0x0bba('0x31')](_0x4dff62[_0x0bba('0x2e')],_0x4dff62[_0x0bba('0x2f')]);_0x4de980['attributes']=_[_0x0bba('0x31')](_0x4dff62[_0x0bba('0x2e')],qs[_0x0bba('0x32')](_0x29d28['query'][_0x0bba('0x32')]));_0x4de980['attributes']=_0x4de980[_0x0bba('0x30')][_0x0bba('0x33')]?_0x4de980[_0x0bba('0x30')]:_0x4dff62[_0x0bba('0x2e')];if(_0x29d28[_0x0bba('0x2f')][_0x0bba('0x3f')]){_0x4de980[_0x0bba('0x40')]=[{'all':!![]}];}_0x4de980=_[_0x0bba('0x45')]({},_0x4de980,_0x29d28['options']);return db['SmsTransferReport'][_0x0bba('0x46')](_0x4de980)[_0x0bba('0x25')](handleEntityNotFound(_0x3482c3,null))['then'](respondWithResult(_0x3482c3,null))['catch'](handleError(_0x3482c3,null));};exports[_0x0bba('0x47')]=function(_0x14a4a8,_0xcf41a){return db[_0x0bba('0x3e')]['create'](_0x14a4a8[_0x0bba('0x48')],{})['then'](respondWithResult(_0xcf41a,0xc9))[_0x0bba('0x42')](handleError(_0xcf41a,null));};exports[_0x0bba('0x24')]=function(_0x13589f,_0x447cff){if(_0x13589f[_0x0bba('0x48')]['id']){delete _0x13589f['body']['id'];}return db[_0x0bba('0x3e')]['find']({'where':{'id':_0x13589f[_0x0bba('0x43')]['id']}})['then'](handleEntityNotFound(_0x447cff,null))[_0x0bba('0x25')](saveUpdates(_0x13589f[_0x0bba('0x48')],null))[_0x0bba('0x25')](respondWithResult(_0x447cff,null))[_0x0bba('0x42')](handleError(_0x447cff,null));};exports[_0x0bba('0x49')]=function(_0x24d50b,_0x149675){return db[_0x0bba('0x3e')]['find']({'where':{'id':_0x24d50b[_0x0bba('0x43')]['id']}})[_0x0bba('0x25')](handleEntityNotFound(_0x149675,null))[_0x0bba('0x25')](removeEntity(_0x149675,null))['catch'](handleError(_0x149675,null));};exports['describe']=function(_0x2da3f0,_0x25dc43){return db[_0x0bba('0x3e')]['describe']()[_0x0bba('0x25')](respondWithResult(_0x25dc43,null))[_0x0bba('0x42')](handleError(_0x25dc43,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index d7da426..b0f667e 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 _0x9a5a=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash'];(function(_0x33464e,_0x26acd9){var _0x5e08b9=function(_0x7ab813){while(--_0x7ab813){_0x33464e['push'](_0x33464e['shift']());}};_0x5e08b9(++_0x26acd9);}(_0x9a5a,0x194));var _0xa9a5=function(_0x4edf0b,_0x44a7f8){_0x4edf0b=_0x4edf0b-0x0;var _0x3b9da6=_0x9a5a[_0x4edf0b];return _0x3b9da6;};'use strict';var _=require(_0xa9a5('0x0'));var util=require(_0xa9a5('0x1'));var logger=require(_0xa9a5('0x2'))(_0xa9a5('0x3'));var moment=require(_0xa9a5('0x4'));var BPromise=require('bluebird');var rp=require(_0xa9a5('0x5'));var fs=require('fs');var path=require(_0xa9a5('0x6'));var rimraf=require(_0xa9a5('0x7'));var config=require(_0xa9a5('0x8'));var attributes=require(_0xa9a5('0x9'));module[_0xa9a5('0xa')]=function(_0x4a73f4,_0xb0ccd9){return _0x4a73f4[_0xa9a5('0xb')](_0xa9a5('0xc'),attributes,{'tableName':_0xa9a5('0xd'),'paranoid':![],'indexes':[{'name':_0xa9a5('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x82c4=['SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./smsTransferReport.attributes','define'];(function(_0x495ee7,_0x2a5811){var _0x4b6292=function(_0x582fe2){while(--_0x582fe2){_0x495ee7['push'](_0x495ee7['shift']());}};_0x4b6292(++_0x2a5811);}(_0x82c4,0x1ca));var _0x482c=function(_0xa61bff,_0x1dd784){_0xa61bff=_0xa61bff-0x0;var _0x7cf1ae=_0x82c4[_0xa61bff];return _0x7cf1ae;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var logger=require(_0x482c('0x2'))(_0x482c('0x3'));var moment=require(_0x482c('0x4'));var BPromise=require(_0x482c('0x5'));var rp=require(_0x482c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x482c('0x7'));var config=require('../../config/environment');var attributes=require(_0x482c('0x8'));module['exports']=function(_0x477cf4,_0x5d7c76){return _0x477cf4[_0x482c('0x9')](_0x482c('0xa'),attributes,{'tableName':_0x482c('0xb'),'paranoid':![],'indexes':[{'name':_0x482c('0xc'),'fields':[_0x482c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index ed2b834..864b413 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 _0xa5b3=['client','http','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xa5b3,0x1d2));var _0x3a5b=function(_0x2803e7,_0x421198){_0x2803e7=_0x2803e7-0x0;var _0x995855=_0xa5b3[_0x2803e7];return _0x995855;};'use strict';var _=require('lodash');var util=require(_0x3a5b('0x0'));var moment=require('moment');var BPromise=require(_0x3a5b('0x1'));var rs=require(_0x3a5b('0x2'));var fs=require('fs');var Redis=require(_0x3a5b('0x3'));var db=require(_0x3a5b('0x4'))['db'];var utils=require(_0x3a5b('0x5'));var logger=require('../../config/logger')(_0x3a5b('0x6'));var config=require(_0x3a5b('0x7'));var jayson=require(_0x3a5b('0x8'));var client=jayson[_0x3a5b('0x9')][_0x3a5b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fefd4,_0x5326d2,_0x15c965){return new BPromise(function(_0x5956e7,_0x53c47e){return client['request'](_0x3fefd4,_0x15c965)[_0x3a5b('0xb')](function(_0x3b9d8e){logger[_0x3a5b('0xc')](_0x3a5b('0xd'),_0x5326d2,'request\x20sent');logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x5326d2,_0x3a5b('0xe'),JSON['stringify'](_0x3b9d8e));if(_0x3b9d8e[_0x3a5b('0xf')]){if(_0x3b9d8e['error'][_0x3a5b('0x10')]===0x1f4){logger[_0x3a5b('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x5326d2,_0x3b9d8e[_0x3a5b('0xf')]['message']);return _0x53c47e(_0x3b9d8e['error'][_0x3a5b('0x11')]);}logger[_0x3a5b('0xf')](_0x3a5b('0xd'),_0x5326d2,_0x3b9d8e['error'][_0x3a5b('0x11')]);return _0x5956e7(_0x3b9d8e[_0x3a5b('0xf')][_0x3a5b('0x11')]);}else{logger[_0x3a5b('0xc')](_0x3a5b('0xd'),_0x5326d2,_0x3a5b('0xe'));_0x5956e7(_0x3b9d8e[_0x3a5b('0x12')][_0x3a5b('0x11')]);}})['catch'](function(_0x2e52e5){logger[_0x3a5b('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x5326d2,_0x2e52e5);_0x53c47e(_0x2e52e5);});});} \ No newline at end of file +var _0xf49f=['code','message','SmsTransferReport,\x20%s,\x20%s','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x26dd96,_0x1e70a6){var _0x1aa18f=function(_0x1e846){while(--_0x1e846){_0x26dd96['push'](_0x26dd96['shift']());}};_0x1aa18f(++_0x1e70a6);}(_0xf49f,0x139));var _0xff49=function(_0x58f028,_0x8937ab){_0x58f028=_0x58f028-0x0;var _0x8e0ec8=_0xf49f[_0x58f028];return _0x8e0ec8;};'use strict';var _=require('lodash');var util=require(_0xff49('0x0'));var moment=require(_0xff49('0x1'));var BPromise=require(_0xff49('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff49('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xff49('0x4'));var logger=require(_0xff49('0x5'))(_0xff49('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xff49('0x7')][_0xff49('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42d054,_0x129277,_0x213924){return new BPromise(function(_0x6377f1,_0x5508c6){return client[_0xff49('0x9')](_0x42d054,_0x213924)[_0xff49('0xa')](function(_0x6f71a9){logger[_0xff49('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x129277,'request\x20sent');logger[_0xff49('0xc')](_0xff49('0xd'),_0x129277,_0xff49('0xe'),JSON[_0xff49('0xf')](_0x6f71a9));if(_0x6f71a9[_0xff49('0x10')]){if(_0x6f71a9['error'][_0xff49('0x11')]===0x1f4){logger[_0xff49('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x129277,_0x6f71a9[_0xff49('0x10')][_0xff49('0x12')]);return _0x5508c6(_0x6f71a9['error']['message']);}logger['error'](_0xff49('0x13'),_0x129277,_0x6f71a9[_0xff49('0x10')][_0xff49('0x12')]);return _0x6377f1(_0x6f71a9['error'][_0xff49('0x12')]);}else{logger[_0xff49('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x129277,_0xff49('0xe'));_0x6377f1(_0x6f71a9[_0xff49('0x14')][_0xff49('0x12')]);}})[_0xff49('0x15')](function(_0x52bbc3){logger['error'](_0xff49('0x13'),_0x129277,_0x52bbc3);_0x5508c6(_0x52bbc3);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 1a5cfe2..3b8e40e 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 _0x6325=['delete','exports','util','express','Router','fs-extra','../../components/interaction/service','get','/:id','isAuthenticated','download','diskStorage','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','post','single','create','put','update'];(function(_0x507965,_0x4944f4){var _0x3608fc=function(_0x14c8d0){while(--_0x14c8d0){_0x507965['push'](_0x507965['shift']());}};_0x3608fc(++_0x4944f4);}(_0x6325,0x1b2));var _0x5632=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x6325[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require('multer');var util=require(_0x5632('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5632('0x1'));var router=express[_0x5632('0x2')]();var fs_extra=require(_0x5632('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5632('0x4'));var config=require('../../config/environment');var controller=require('./sound.controller');router[_0x5632('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x5632('0x6'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/download',auth[_0x5632('0x7')](),controller[_0x5632('0x8')]);var upload=multer({'storage':multer[_0x5632('0x9')]({'destination':function(_0x29db79,_0x51d2b0,_0x35da7f){_0x35da7f(null,path['join'](config[_0x5632('0xa')],_0x5632('0xb')));},'filename':function(_0x4733e1,_0x255fbb,_0x200533){_0x255fbb[_0x5632('0xc')]=_0x255fbb[_0x5632('0xc')][_0x5632('0xd')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x200533(null,util[_0x5632('0xe')](_0x5632('0xf'),path['basename'](_0x255fbb[_0x5632('0xc')],path[_0x5632('0x10')](_0x255fbb[_0x5632('0xc')])),Date['now'](),path[_0x5632('0x10')](_0x255fbb[_0x5632('0xc')])));}})});router[_0x5632('0x11')]('/',upload[_0x5632('0x12')]('file'),controller[_0x5632('0x13')]);router[_0x5632('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x5632('0x15')]);router[_0x5632('0x16')](_0x5632('0x6'),auth[_0x5632('0x7')](),controller[_0x5632('0x16')]);module[_0x5632('0x17')]=router; \ No newline at end of file +var _0x6cfc=['delete','exports','multer','path','Router','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','originalname','replace','%s-%s%s','basename','now','post','file','put','update'];(function(_0x5040b0,_0x53c900){var _0x32d66e=function(_0x10451b){while(--_0x10451b){_0x5040b0['push'](_0x5040b0['shift']());}};_0x32d66e(++_0x53c900);}(_0x6cfc,0x1f0));var _0xc6cf=function(_0x528575,_0x2e067d){_0x528575=_0x528575-0x0;var _0x3063b7=_0x6cfc[_0x528575];return _0x3063b7;};'use strict';var multer=require(_0xc6cf('0x0'));var util=require('util');var path=require(_0xc6cf('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc6cf('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc6cf('0x3'));var config=require(_0xc6cf('0x4'));var controller=require(_0xc6cf('0x5'));router[_0xc6cf('0x6')]('/',auth[_0xc6cf('0x7')](),controller[_0xc6cf('0x8')]);router[_0xc6cf('0x6')](_0xc6cf('0x9'),auth[_0xc6cf('0x7')](),controller[_0xc6cf('0xa')]);router[_0xc6cf('0x6')](_0xc6cf('0xb'),auth[_0xc6cf('0x7')](),controller[_0xc6cf('0xc')]);var upload=multer({'storage':multer[_0xc6cf('0xd')]({'destination':function(_0x2a8096,_0x79ff5f,_0x1903d3){_0x1903d3(null,path[_0xc6cf('0xe')](config['root'],'server/files/sounds/original/'));},'filename':function(_0x2398e9,_0x4e35cd,_0x2738a6){_0x4e35cd[_0xc6cf('0xf')]=_0x4e35cd['originalname'][_0xc6cf('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2738a6(null,util['format'](_0xc6cf('0x11'),path[_0xc6cf('0x12')](_0x4e35cd[_0xc6cf('0xf')],path['extname'](_0x4e35cd[_0xc6cf('0xf')])),Date[_0xc6cf('0x13')](),path['extname'](_0x4e35cd[_0xc6cf('0xf')])));}})});router[_0xc6cf('0x14')]('/',upload['single'](_0xc6cf('0x15')),controller['create']);router[_0xc6cf('0x16')](_0xc6cf('0x9'),auth[_0xc6cf('0x7')](),controller[_0xc6cf('0x17')]);router[_0xc6cf('0x18')](_0xc6cf('0x9'),auth[_0xc6cf('0x7')](),controller[_0xc6cf('0x18')]);module[_0xc6cf('0x19')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 45d60d5..d84824a 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 _0x822c=['INTEGER','sequelize','STRING','FLOAT','BIGINT'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x822c,0x105));var _0xc822=function(_0x163df7,_0x2be35f){_0x163df7=_0x163df7-0x0;var _0x5b1321=_0x822c[_0x163df7];return _0x5b1321;};'use strict';var Sequelize=require(_0xc822('0x0'));module['exports']={'name':{'type':Sequelize[_0xc822('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xc822('0x1')]},'display_name':{'type':Sequelize[_0xc822('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xc822('0x1')]},'original_format':{'type':Sequelize[_0xc822('0x1')]},'original_duration':{'type':Sequelize[_0xc822('0x2')]},'original_sampleCount':{'type':Sequelize[_0xc822('0x3')]},'original_channelCount':{'type':Sequelize[_0xc822('0x4')]},'original_bitRate':{'type':Sequelize[_0xc822('0x3')]},'original_sampleRate':{'type':Sequelize[_0xc822('0x4')]},'converted_format':{'type':Sequelize[_0xc822('0x1')]},'converted_duration':{'type':Sequelize[_0xc822('0x2')]},'converted_sampleCount':{'type':Sequelize[_0xc822('0x3')]},'converted_channelCount':{'type':Sequelize[_0xc822('0x4')]},'converted_bitRate':{'type':Sequelize[_0xc822('0x3')]},'converted_sampleRate':{'type':Sequelize[_0xc822('0x4')]}}; \ No newline at end of file +var _0xb31e=['BIGINT','sequelize','exports','STRING','FLOAT','INTEGER'];(function(_0x5db759,_0x46b917){var _0x137300=function(_0x312082){while(--_0x312082){_0x5db759['push'](_0x5db759['shift']());}};_0x137300(++_0x46b917);}(_0xb31e,0x17b));var _0xeb31=function(_0x58edc6,_0x1e068c){_0x58edc6=_0x58edc6-0x0;var _0x218d1b=_0xb31e[_0x58edc6];return _0x218d1b;};'use strict';var Sequelize=require(_0xeb31('0x0'));module[_0xeb31('0x1')]={'name':{'type':Sequelize[_0xeb31('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xeb31('0x2')]},'display_name':{'type':Sequelize[_0xeb31('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xeb31('0x2')]},'original_format':{'type':Sequelize[_0xeb31('0x2')]},'original_duration':{'type':Sequelize[_0xeb31('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xeb31('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xeb31('0x4')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xeb31('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xeb31('0x5')]},'converted_channelCount':{'type':Sequelize[_0xeb31('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xeb31('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 4c9e6c7..544a455 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 _0x96ae=['../../config/license/util','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','then','destroy','get','Sounds','stack','name','send','map','fieldName','type','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Sound','includeAll','include','findAll','rows','show','params','rawAttributes','find','download','save_name','converted_format','join','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','%s.%s','format','catch','create','file','originalname','extname','filename','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','error','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_sampleRate','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','start','description','delete','original_format','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x4debdd,_0x114aab){var _0x4a83e6=function(_0x4e8ed8){while(--_0x4e8ed8){_0x4debdd['push'](_0x4debdd['shift']());}};_0x4a83e6(++_0x114aab);}(_0x96ae,0xda));var _0xe96a=function(_0x5b1aed,_0x322c17){_0x5b1aed=_0x5b1aed-0x0;var _0x26add8=_0x96ae[_0x5b1aed];return _0x26add8;};'use strict';var pdf=require(_0xe96a('0x0'));var emlformat=require(_0xe96a('0x1'));var rimraf=require(_0xe96a('0x2'));var zipdir=require(_0xe96a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe96a('0x4'));var moment=require(_0xe96a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe96a('0x6'));var util=require(_0xe96a('0x7'));var path=require(_0xe96a('0x8'));var sox=require(_0xe96a('0x9'));var csv=require(_0xe96a('0xa'));var ejs=require(_0xe96a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe96a('0xc'));var crypto=require(_0xe96a('0xd'));var jsforce=require(_0xe96a('0xe'));var deskjs=require(_0xe96a('0xf'));var toCsv=require(_0xe96a('0xa'));var querystring=require(_0xe96a('0x10'));var Papa=require('papaparse');var Redis=require(_0xe96a('0x11'));var authService=require(_0xe96a('0x12'));var qs=require(_0xe96a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe96a('0x14'));var logger=require('../../config/logger')(_0xe96a('0x15'));var utils=require(_0xe96a('0x16'));var config=require(_0xe96a('0x17'));var licenseUtil=require(_0xe96a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6b0226,_0x42d0f0){_0x42d0f0=_0x42d0f0||0xcc;return function(_0xa08dfe){if(_0xa08dfe){return _0x6b0226[_0xe96a('0x19')](_0x42d0f0);}return _0x6b0226['status'](_0x42d0f0)[_0xe96a('0x1a')]();};}function respondWithResult(_0x355dad,_0x3ebb51){_0x3ebb51=_0x3ebb51||0xc8;return function(_0x5ae51f){if(_0x5ae51f){return _0x355dad[_0xe96a('0x1b')](_0x3ebb51)[_0xe96a('0x1c')](_0x5ae51f);}};}function respondWithFilteredResult(_0xff96e,_0x284c16){return function(_0xf7d2a8){if(_0xf7d2a8){var _0x1ac7bc=_0xf7d2a8[_0xe96a('0x1d')],_0x2be253=_0x284c16[_0xe96a('0x1e')],_0x21e8ac=_0x284c16[_0xe96a('0x1e')]+_0x284c16['limit'],_0x11ea10;if(_0x21e8ac>=_0x1ac7bc){_0x21e8ac=_0x1ac7bc;_0x11ea10=0xc8;}else{_0x11ea10=0xce;}_0xff96e[_0xe96a('0x1b')](_0x11ea10);return _0xff96e[_0xe96a('0x1f')](_0xe96a('0x20'),_0x2be253+'-'+_0x21e8ac+'/'+_0x1ac7bc)[_0xe96a('0x1c')](_0xf7d2a8);}return null;};}function patchUpdates(_0x4e26f2){return function(_0x40b1c3){try{jsonpatch[_0xe96a('0x21')](_0x40b1c3,_0x4e26f2,!![]);}catch(_0x1d096c){return BPromise[_0xe96a('0x22')](_0x1d096c);}return _0x40b1c3['save']();};}function saveUpdates(_0x546e59,_0x6ccd4a){return function(_0x35807f){if(_0x35807f){return _0x35807f['update'](_0x546e59)[_0xe96a('0x23')](function(_0x4c76d9){return _0x4c76d9;});}return null;};}function removeEntity(_0x3ee9a2,_0x326497){return function(_0x4bb6c5){if(_0x4bb6c5){return _0x4bb6c5[_0xe96a('0x24')]()['then'](function(){var _0x7d69df=_0x4bb6c5[_0xe96a('0x25')]({'plain':!![]});var _0x555801=_0xe96a('0x26');return db['UserProfileResource'][_0xe96a('0x24')]({'where':{'type':_0x555801,'resourceId':_0x7d69df['id']}})[_0xe96a('0x23')](function(){return _0x4bb6c5;});})['then'](function(){_0x3ee9a2[_0xe96a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e793a,_0x3682bb){return function(_0x288f95){if(!_0x288f95){_0x3e793a[_0xe96a('0x19')](0x194);}return _0x288f95;};}function handleError(_0x21a785,_0x4d6bb1){_0x4d6bb1=_0x4d6bb1||0x1f4;return function(_0x37710b){logger['error'](_0x37710b[_0xe96a('0x27')]);if(_0x37710b['name']){delete _0x37710b[_0xe96a('0x28')];}_0x21a785[_0xe96a('0x1b')](_0x4d6bb1)[_0xe96a('0x29')](_0x37710b);};}exports['index']=function(_0x19edff,_0x149c78){var _0xcd0345={},_0x11b1ca={},_0x45ba72={'count':0x0,'rows':[]};var _0x2e2a76=_[_0xe96a('0x2a')](db['Sound']['rawAttributes'],function(_0x25c002){return{'name':_0x25c002[_0xe96a('0x2b')],'type':_0x25c002[_0xe96a('0x2c')]['key']};});_0x11b1ca[_0xe96a('0x2d')]=_[_0xe96a('0x2a')](_0x2e2a76,'name');_0x11b1ca['query']=_[_0xe96a('0x2e')](_0x19edff[_0xe96a('0x2f')]);_0x11b1ca['filters']=_['intersection'](_0x11b1ca['model'],_0x11b1ca[_0xe96a('0x2f')]);_0xcd0345[_0xe96a('0x30')]=_[_0xe96a('0x31')](_0x11b1ca[_0xe96a('0x2d')],qs[_0xe96a('0x32')](_0x19edff[_0xe96a('0x2f')][_0xe96a('0x32')]));_0xcd0345[_0xe96a('0x30')]=_0xcd0345[_0xe96a('0x30')]['length']?_0xcd0345[_0xe96a('0x30')]:_0x11b1ca[_0xe96a('0x2d')];if(!_0x19edff[_0xe96a('0x2f')][_0xe96a('0x33')](_0xe96a('0x34'))){_0xcd0345['limit']=qs[_0xe96a('0x35')](_0x19edff[_0xe96a('0x2f')][_0xe96a('0x35')]);_0xcd0345[_0xe96a('0x1e')]=qs[_0xe96a('0x1e')](_0x19edff[_0xe96a('0x2f')]['offset']);}_0xcd0345[_0xe96a('0x36')]=qs[_0xe96a('0x37')](_0x19edff[_0xe96a('0x2f')]['sort']);_0xcd0345[_0xe96a('0x38')]=qs[_0xe96a('0x39')](_[_0xe96a('0x3a')](_0x19edff[_0xe96a('0x2f')],_0x11b1ca[_0xe96a('0x39')]),_0x2e2a76);if(_0x19edff['query'][_0xe96a('0x3b')]){_0xcd0345[_0xe96a('0x38')]=_[_0xe96a('0x3c')](_0xcd0345[_0xe96a('0x38')],{'$or':_[_0xe96a('0x2a')](_0x2e2a76,function(_0x54c39a){if(_0x54c39a[_0xe96a('0x2c')]!==_0xe96a('0x3d')){var _0x15b16a={};_0x15b16a[_0x54c39a['name']]={'$like':'%'+_0x19edff[_0xe96a('0x2f')][_0xe96a('0x3b')]+'%'};return _0x15b16a;}})});}_0xcd0345=_[_0xe96a('0x3c')]({},_0xcd0345,_0x19edff[_0xe96a('0x3e')]);var _0x30f197={'where':_0xcd0345[_0xe96a('0x38')]};return db[_0xe96a('0x3f')][_0xe96a('0x1d')](_0x30f197)[_0xe96a('0x23')](function(_0x2195da){_0x45ba72['count']=_0x2195da;if(_0x19edff[_0xe96a('0x2f')][_0xe96a('0x40')]){_0xcd0345[_0xe96a('0x41')]=[{'all':!![]}];}return db[_0xe96a('0x3f')][_0xe96a('0x42')](_0xcd0345);})[_0xe96a('0x23')](function(_0x552888){_0x45ba72[_0xe96a('0x43')]=_0x552888;return _0x45ba72;})[_0xe96a('0x23')](respondWithFilteredResult(_0x149c78,_0xcd0345))['catch'](handleError(_0x149c78,null));};exports[_0xe96a('0x44')]=function(_0xb470be,_0x590e72){var _0x2690d7={'raw':!![],'where':{'id':_0xb470be[_0xe96a('0x45')]['id']}},_0xb893be={};_0xb893be[_0xe96a('0x2d')]=_['keys'](db[_0xe96a('0x3f')][_0xe96a('0x46')]);_0xb893be[_0xe96a('0x2f')]=_['keys'](_0xb470be[_0xe96a('0x2f')]);_0xb893be[_0xe96a('0x39')]=_[_0xe96a('0x31')](_0xb893be[_0xe96a('0x2d')],_0xb893be[_0xe96a('0x2f')]);_0x2690d7['attributes']=_[_0xe96a('0x31')](_0xb893be[_0xe96a('0x2d')],qs[_0xe96a('0x32')](_0xb470be['query'][_0xe96a('0x32')]));_0x2690d7[_0xe96a('0x30')]=_0x2690d7[_0xe96a('0x30')]['length']?_0x2690d7[_0xe96a('0x30')]:_0xb893be[_0xe96a('0x2d')];if(_0xb470be[_0xe96a('0x2f')][_0xe96a('0x40')]){_0x2690d7[_0xe96a('0x41')]=[{'all':!![]}];}_0x2690d7=_[_0xe96a('0x3c')]({},_0x2690d7,_0xb470be[_0xe96a('0x3e')]);return db[_0xe96a('0x3f')][_0xe96a('0x47')](_0x2690d7)[_0xe96a('0x23')](handleEntityNotFound(_0x590e72,null))[_0xe96a('0x23')](respondWithResult(_0x590e72,null))['catch'](handleError(_0x590e72,null));};exports[_0xe96a('0x48')]=function(_0x3215dd,_0x442b4e,_0xcbfa2e){return db[_0xe96a('0x3f')][_0xe96a('0x47')]({'where':{'id':_0x3215dd[_0xe96a('0x45')]['id']},'attributes':[_0xe96a('0x28'),_0xe96a('0x49'),_0xe96a('0x4a')],'raw':!![]})[_0xe96a('0x23')](handleEntityNotFound(_0x442b4e,null))[_0xe96a('0x23')](function(_0x5cef6c){if(_0x5cef6c){if(!fs['existsSync'](path[_0xe96a('0x4b')](config[_0xe96a('0x4c')],_0xe96a('0x4d'),_0x5cef6c['save_name']+'.'+_0x5cef6c[_0xe96a('0x4a')]))){throw new db['Sequelize'][(_0xe96a('0x4e'))](_0xe96a('0x4f'));}return _0x442b4e[_0xe96a('0x48')](path[_0xe96a('0x4b')](config[_0xe96a('0x4c')],_0xe96a('0x4d'),util['format'](_0xe96a('0x50'),_0x5cef6c[_0xe96a('0x49')],_0x5cef6c[_0xe96a('0x4a')])),util[_0xe96a('0x51')](_0xe96a('0x50'),_0x5cef6c[_0xe96a('0x28')],_0x5cef6c['converted_format']));}return null;})[_0xe96a('0x52')](handleError(_0x442b4e,null));};exports[_0xe96a('0x53')]=function(_0x15f707,_0x4e7d10,_0x32f8a4){var _0x2304ae={'name':path['basename'](_0x15f707[_0xe96a('0x54')][_0xe96a('0x55')],path[_0xe96a('0x56')](_0x15f707[_0xe96a('0x54')][_0xe96a('0x55')])),'save_name':path['basename'](_0x15f707[_0xe96a('0x54')]['filename'],path[_0xe96a('0x56')](_0x15f707[_0xe96a('0x54')][_0xe96a('0x57')])),'original_format':path[_0xe96a('0x56')](_0x15f707[_0xe96a('0x54')][_0xe96a('0x55')])['substring'](0x1),'converted_format':_0xe96a('0x58')};var _0x2c0878=path[_0xe96a('0x4b')](config['root'],_0xe96a('0x59'),_0x15f707[_0xe96a('0x54')][_0xe96a('0x57')]);var _0x5599c3=path['join'](config[_0xe96a('0x4c')],_0xe96a('0x4d'),util['format'](_0xe96a('0x50'),path['basename'](_0x15f707[_0xe96a('0x54')][_0xe96a('0x57')],path[_0xe96a('0x56')](_0x15f707[_0xe96a('0x54')][_0xe96a('0x57')])),_0x2304ae['converted_format']));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x2c0878);logger[_0xe96a('0x5a')](_0xe96a('0x5b'),_0x5599c3);try{fs[_0xe96a('0x5c')](_0x2c0878,parseInt(_0xe96a('0x5d'),0x8));var _0x47fad2=sox[_0xe96a('0x5e')](_0x2c0878,_0x5599c3,{'sampleRate':0x1f40,'format':_0xe96a('0x58'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x47fad2['on'](_0xe96a('0x5f'),function(_0x26f0a1){fs['unlinkSync'](_0x2c0878);_0x4e7d10['status'](0x1f4)['send'](_0x26f0a1);});_0x47fad2['on']('src',function(_0x2b6cf4){_0x2304ae['original_duration']=isNaN(_0x2b6cf4[_0xe96a('0x60')])?null:_0x2b6cf4['duration']*0x3e8;_0x2304ae[_0xe96a('0x61')]=isNaN(_0x2b6cf4['sampleCount'])?null:_0x2b6cf4[_0xe96a('0x62')];_0x2304ae[_0xe96a('0x63')]=isNaN(_0x2b6cf4[_0xe96a('0x64')])?null:_0x2b6cf4['channelCount'];_0x2304ae[_0xe96a('0x65')]=isNaN(_0x2b6cf4[_0xe96a('0x66')])?null:_0x2b6cf4[_0xe96a('0x66')];_0x2304ae[_0xe96a('0x67')]=isNaN(_0x2b6cf4[_0xe96a('0x68')])?null:_0x2b6cf4[_0xe96a('0x68')];});_0x47fad2['on'](_0xe96a('0x69'),function(_0x1f8fc2){_0x2304ae[_0xe96a('0x6a')]=isNaN(_0x1f8fc2['duration'])?null:_0x1f8fc2[_0xe96a('0x60')]*0x3e8;_0x2304ae[_0xe96a('0x6b')]=isNaN(_0x1f8fc2[_0xe96a('0x62')])?null:_0x1f8fc2[_0xe96a('0x62')];_0x2304ae[_0xe96a('0x6c')]=isNaN(_0x1f8fc2[_0xe96a('0x64')])?null:_0x1f8fc2['channelCount'];_0x2304ae['converted_bitRate']=isNaN(_0x1f8fc2[_0xe96a('0x66')])?null:_0x1f8fc2['bitRate'];_0x2304ae[_0xe96a('0x6d')]=isNaN(_0x1f8fc2[_0xe96a('0x68')])?null:_0x1f8fc2[_0xe96a('0x68')];});_0x47fad2['on'](_0xe96a('0x1a'),function(){fs[_0xe96a('0x5c')](_0x5599c3,parseInt(_0xe96a('0x5d'),0x8));return db[_0xe96a('0x3f')][_0xe96a('0x53')](_0x2304ae)[_0xe96a('0x23')](function(_0x2f8d3c){var _0x152caf={'role':_0x15f707[_0xe96a('0x6e')]['role'],'userProfileId':_0x15f707[_0xe96a('0x6e')]['userProfileId']};if(!_0x152caf)throw new Error(_0xe96a('0x6f'));if(_0x152caf[_0xe96a('0x70')]==='user'){var _0x473bd9=_0x2f8d3c[_0xe96a('0x25')]({'plain':!![]});return db[_0xe96a('0x71')][_0xe96a('0x47')]({'where':{'name':'Sounds','userProfileId':_0x152caf[_0xe96a('0x72')]},'raw':!![]})[_0xe96a('0x23')](function(_0x231129){if(_0x231129&&_0x231129[_0xe96a('0x73')]===0x0){return db['UserProfileResource'][_0xe96a('0x53')]({'name':_0x473bd9[_0xe96a('0x28')],'resourceId':_0x473bd9['id'],'type':_0x231129['name'],'sectionId':_0x231129['id']},{})[_0xe96a('0x23')](function(){return _0x2f8d3c;});}else{return _0x2f8d3c;}})[_0xe96a('0x52')](function(_0x2e1f05){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e1f05);throw _0x2e1f05;});}return _0x2f8d3c;})[_0xe96a('0x23')](respondWithResult(_0x4e7d10,null))[_0xe96a('0x52')](handleError(_0x4e7d10,null));});_0x47fad2[_0xe96a('0x74')]();}catch(_0x55d529){_0x4e7d10[_0xe96a('0x1b')](0x1f4)['send'](_0x55d529);}};exports['update']=function(_0x4f25b1,_0x2cb6b8,_0x731880){return db[_0xe96a('0x3f')][_0xe96a('0x47')]({'where':{'id':_0x4f25b1[_0xe96a('0x45')]['id']}})[_0xe96a('0x23')](handleEntityNotFound(_0x2cb6b8,null))[_0xe96a('0x23')](saveUpdates(_[_0xe96a('0x3a')](_0x4f25b1[_0xe96a('0x6e')],['name',_0xe96a('0x75')]),null))[_0xe96a('0x23')](respondWithResult(_0x2cb6b8,null))[_0xe96a('0x52')](handleError(_0x2cb6b8,null));};exports[_0xe96a('0x76')]=function(_0x110393,_0x38c2d5,_0x2c939d){return db[_0xe96a('0x3f')][_0xe96a('0x47')]({'where':{'id':_0x110393[_0xe96a('0x45')]['id']}})['then'](function(_0x27c3ee){if(_0x27c3ee){return _0x27c3ee[_0xe96a('0x24')]();}})[_0xe96a('0x23')](function(_0x3286d9){var _0xeb9a7b=path[_0xe96a('0x4b')](config['root'],_0xe96a('0x59'),util[_0xe96a('0x51')](_0xe96a('0x50'),_0x3286d9[_0xe96a('0x49')],_0x3286d9[_0xe96a('0x77')]));var _0x44aab4=path['join'](config[_0xe96a('0x4c')],_0xe96a('0x4d'),util['format'](_0xe96a('0x50'),_0x3286d9[_0xe96a('0x49')],_0x3286d9[_0xe96a('0x4a')]));fs[_0xe96a('0x78')](_0xeb9a7b);fs[_0xe96a('0x78')](_0x44aab4);return _0x3286d9;})['then'](function(_0x5e5b0c){if(_0x5e5b0c){return _0x38c2d5['status'](0xcc)[_0xe96a('0x1a')]();}})[_0xe96a('0x23')](handleEntityNotFound(_0x38c2d5,null))[_0xe96a('0x52')](handleError(_0x38c2d5,null));}; \ No newline at end of file +var _0xf1d7=['converted_bitRate','converted_sampleRate','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','unlinkSync','html-pdf','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','offset','reject','save','update','then','get','Sounds','UserProfileResource','destroy','error','stack','name','send','Sound','rawAttributes','fieldName','map','query','keys','filters','model','attributes','intersection','fields','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','include','download','converted_format','existsSync','join','server/files/sounds/converted','save_name','Sequelize','root','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','duration','original_sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','sampleCount','converted_channelCount'];(function(_0x8a7e38,_0x473a5d){var _0x228609=function(_0x5dcb5c){while(--_0x5dcb5c){_0x8a7e38['push'](_0x8a7e38['shift']());}};_0x228609(++_0x473a5d);}(_0xf1d7,0x17e));var _0x7f1d=function(_0xad5e8a,_0x5e74df){_0xad5e8a=_0xad5e8a-0x0;var _0x658ac=_0xf1d7[_0xad5e8a];return _0x658ac;};'use strict';var pdf=require(_0x7f1d('0x0'));var emlformat=require(_0x7f1d('0x1'));var rimraf=require(_0x7f1d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7f1d('0x3'));var moment=require(_0x7f1d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7f1d('0x5'));var util=require('util');var path=require('path');var sox=require(_0x7f1d('0x6'));var csv=require(_0x7f1d('0x7'));var ejs=require(_0x7f1d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7f1d('0x9'));var squel=require(_0x7f1d('0xa'));var crypto=require(_0x7f1d('0xb'));var jsforce=require(_0x7f1d('0xc'));var deskjs=require(_0x7f1d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7f1d('0xe'));var Papa=require(_0x7f1d('0xf'));var Redis=require(_0x7f1d('0x10'));var authService=require(_0x7f1d('0x11'));var qs=require(_0x7f1d('0x12'));var as=require(_0x7f1d('0x13'));var hardwareService=require(_0x7f1d('0x14'));var logger=require(_0x7f1d('0x15'))(_0x7f1d('0x16'));var utils=require(_0x7f1d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7f1d('0x18'))['db'];function respondWithStatusCode(_0x233c7e,_0x32f617){_0x32f617=_0x32f617||0xcc;return function(_0x42da4f){if(_0x42da4f){return _0x233c7e[_0x7f1d('0x19')](_0x32f617);}return _0x233c7e['status'](_0x32f617)[_0x7f1d('0x1a')]();};}function respondWithResult(_0x401c81,_0x4e4602){_0x4e4602=_0x4e4602||0xc8;return function(_0x4e27c3){if(_0x4e27c3){return _0x401c81[_0x7f1d('0x1b')](_0x4e4602)['json'](_0x4e27c3);}};}function respondWithFilteredResult(_0x268214,_0x3cdf3b){return function(_0x233b9e){if(_0x233b9e){var _0x2a9536=_0x233b9e['count'],_0x329e87=_0x3cdf3b[_0x7f1d('0x1c')],_0x54fe2e=_0x3cdf3b[_0x7f1d('0x1c')]+_0x3cdf3b['limit'],_0x48da16;if(_0x54fe2e>=_0x2a9536){_0x54fe2e=_0x2a9536;_0x48da16=0xc8;}else{_0x48da16=0xce;}_0x268214[_0x7f1d('0x1b')](_0x48da16);return _0x268214['set']('Content-Range',_0x329e87+'-'+_0x54fe2e+'/'+_0x2a9536)['json'](_0x233b9e);}return null;};}function patchUpdates(_0x561023){return function(_0x7a4cf9){try{jsonpatch['apply'](_0x7a4cf9,_0x561023,!![]);}catch(_0x111a43){return BPromise[_0x7f1d('0x1d')](_0x111a43);}return _0x7a4cf9[_0x7f1d('0x1e')]();};}function saveUpdates(_0xb04ddc,_0x139517){return function(_0x1aef2f){if(_0x1aef2f){return _0x1aef2f[_0x7f1d('0x1f')](_0xb04ddc)['then'](function(_0x3ef891){return _0x3ef891;});}return null;};}function removeEntity(_0xa91517,_0x55e006){return function(_0x4c98e6){if(_0x4c98e6){return _0x4c98e6['destroy']()[_0x7f1d('0x20')](function(){var _0x4b1134=_0x4c98e6[_0x7f1d('0x21')]({'plain':!![]});var _0x48d181=_0x7f1d('0x22');return db[_0x7f1d('0x23')][_0x7f1d('0x24')]({'where':{'type':_0x48d181,'resourceId':_0x4b1134['id']}})[_0x7f1d('0x20')](function(){return _0x4c98e6;});})[_0x7f1d('0x20')](function(){_0xa91517[_0x7f1d('0x1b')](0xcc)[_0x7f1d('0x1a')]();});}};}function handleEntityNotFound(_0x330379,_0x2b853d){return function(_0x389b74){if(!_0x389b74){_0x330379[_0x7f1d('0x19')](0x194);}return _0x389b74;};}function handleError(_0x5259a1,_0x35cb0c){_0x35cb0c=_0x35cb0c||0x1f4;return function(_0xfecdf3){logger[_0x7f1d('0x25')](_0xfecdf3[_0x7f1d('0x26')]);if(_0xfecdf3[_0x7f1d('0x27')]){delete _0xfecdf3[_0x7f1d('0x27')];}_0x5259a1[_0x7f1d('0x1b')](_0x35cb0c)[_0x7f1d('0x28')](_0xfecdf3);};}exports['index']=function(_0x42449d,_0x130178){var _0x1c9607={},_0x3a34cd={},_0x2f480c={'count':0x0,'rows':[]};var _0xb8be2e=_['map'](db[_0x7f1d('0x29')][_0x7f1d('0x2a')],function(_0x14b269){return{'name':_0x14b269[_0x7f1d('0x2b')],'type':_0x14b269['type']['key']};});_0x3a34cd['model']=_[_0x7f1d('0x2c')](_0xb8be2e,_0x7f1d('0x27'));_0x3a34cd[_0x7f1d('0x2d')]=_[_0x7f1d('0x2e')](_0x42449d[_0x7f1d('0x2d')]);_0x3a34cd[_0x7f1d('0x2f')]=_['intersection'](_0x3a34cd[_0x7f1d('0x30')],_0x3a34cd[_0x7f1d('0x2d')]);_0x1c9607[_0x7f1d('0x31')]=_[_0x7f1d('0x32')](_0x3a34cd[_0x7f1d('0x30')],qs[_0x7f1d('0x33')](_0x42449d['query'][_0x7f1d('0x33')]));_0x1c9607[_0x7f1d('0x31')]=_0x1c9607[_0x7f1d('0x31')]['length']?_0x1c9607[_0x7f1d('0x31')]:_0x3a34cd[_0x7f1d('0x30')];if(!_0x42449d['query']['hasOwnProperty'](_0x7f1d('0x34'))){_0x1c9607['limit']=qs['limit'](_0x42449d[_0x7f1d('0x2d')][_0x7f1d('0x35')]);_0x1c9607[_0x7f1d('0x1c')]=qs[_0x7f1d('0x1c')](_0x42449d['query']['offset']);}_0x1c9607[_0x7f1d('0x36')]=qs[_0x7f1d('0x37')](_0x42449d[_0x7f1d('0x2d')][_0x7f1d('0x37')]);_0x1c9607[_0x7f1d('0x38')]=qs[_0x7f1d('0x2f')](_[_0x7f1d('0x39')](_0x42449d[_0x7f1d('0x2d')],_0x3a34cd[_0x7f1d('0x2f')]),_0xb8be2e);if(_0x42449d[_0x7f1d('0x2d')][_0x7f1d('0x3a')]){_0x1c9607[_0x7f1d('0x38')]=_[_0x7f1d('0x3b')](_0x1c9607[_0x7f1d('0x38')],{'$or':_['map'](_0xb8be2e,function(_0xb4835e){if(_0xb4835e[_0x7f1d('0x3c')]!==_0x7f1d('0x3d')){var _0x1345de={};_0x1345de[_0xb4835e[_0x7f1d('0x27')]]={'$like':'%'+_0x42449d[_0x7f1d('0x2d')][_0x7f1d('0x3a')]+'%'};return _0x1345de;}})});}_0x1c9607=_[_0x7f1d('0x3b')]({},_0x1c9607,_0x42449d[_0x7f1d('0x3e')]);var _0x22a0ea={'where':_0x1c9607[_0x7f1d('0x38')]};return db['Sound']['count'](_0x22a0ea)[_0x7f1d('0x20')](function(_0x337f20){_0x2f480c[_0x7f1d('0x3f')]=_0x337f20;if(_0x42449d[_0x7f1d('0x2d')][_0x7f1d('0x40')]){_0x1c9607['include']=[{'all':!![]}];}return db[_0x7f1d('0x29')][_0x7f1d('0x41')](_0x1c9607);})[_0x7f1d('0x20')](function(_0x3e6945){_0x2f480c[_0x7f1d('0x42')]=_0x3e6945;return _0x2f480c;})['then'](respondWithFilteredResult(_0x130178,_0x1c9607))[_0x7f1d('0x43')](handleError(_0x130178,null));};exports[_0x7f1d('0x44')]=function(_0x101ab8,_0x4bd51f){var _0x37e28b={'raw':!![],'where':{'id':_0x101ab8[_0x7f1d('0x45')]['id']}},_0x1944b0={};_0x1944b0[_0x7f1d('0x30')]=_[_0x7f1d('0x2e')](db[_0x7f1d('0x29')]['rawAttributes']);_0x1944b0['query']=_[_0x7f1d('0x2e')](_0x101ab8[_0x7f1d('0x2d')]);_0x1944b0[_0x7f1d('0x2f')]=_['intersection'](_0x1944b0[_0x7f1d('0x30')],_0x1944b0['query']);_0x37e28b['attributes']=_['intersection'](_0x1944b0[_0x7f1d('0x30')],qs[_0x7f1d('0x33')](_0x101ab8['query']['fields']));_0x37e28b[_0x7f1d('0x31')]=_0x37e28b[_0x7f1d('0x31')]['length']?_0x37e28b[_0x7f1d('0x31')]:_0x1944b0[_0x7f1d('0x30')];if(_0x101ab8[_0x7f1d('0x2d')][_0x7f1d('0x40')]){_0x37e28b[_0x7f1d('0x46')]=[{'all':!![]}];}_0x37e28b=_['merge']({},_0x37e28b,_0x101ab8[_0x7f1d('0x3e')]);return db[_0x7f1d('0x29')]['find'](_0x37e28b)[_0x7f1d('0x20')](handleEntityNotFound(_0x4bd51f,null))[_0x7f1d('0x20')](respondWithResult(_0x4bd51f,null))[_0x7f1d('0x43')](handleError(_0x4bd51f,null));};exports[_0x7f1d('0x47')]=function(_0x259d75,_0x4ad878,_0x14ea2c){return db[_0x7f1d('0x29')]['find']({'where':{'id':_0x259d75[_0x7f1d('0x45')]['id']},'attributes':[_0x7f1d('0x27'),'save_name',_0x7f1d('0x48')],'raw':!![]})[_0x7f1d('0x20')](handleEntityNotFound(_0x4ad878,null))['then'](function(_0x493c0b){if(_0x493c0b){if(!fs[_0x7f1d('0x49')](path[_0x7f1d('0x4a')](config['root'],_0x7f1d('0x4b'),_0x493c0b[_0x7f1d('0x4c')]+'.'+_0x493c0b[_0x7f1d('0x48')]))){throw new db[(_0x7f1d('0x4d'))]['ValidationError']('Sound\x20not\x20found');}return _0x4ad878[_0x7f1d('0x47')](path['join'](config[_0x7f1d('0x4e')],'server/files/sounds/converted',util[_0x7f1d('0x4f')](_0x7f1d('0x50'),_0x493c0b[_0x7f1d('0x4c')],_0x493c0b['converted_format'])),util['format'](_0x7f1d('0x50'),_0x493c0b['name'],_0x493c0b['converted_format']));}return null;})[_0x7f1d('0x43')](handleError(_0x4ad878,null));};exports[_0x7f1d('0x51')]=function(_0x1e4ba8,_0x598b10,_0x132ae3){var _0x235cf3={'name':path[_0x7f1d('0x52')](_0x1e4ba8[_0x7f1d('0x53')][_0x7f1d('0x54')],path[_0x7f1d('0x55')](_0x1e4ba8[_0x7f1d('0x53')][_0x7f1d('0x54')])),'save_name':path[_0x7f1d('0x52')](_0x1e4ba8['file'][_0x7f1d('0x56')],path['extname'](_0x1e4ba8[_0x7f1d('0x53')]['filename'])),'original_format':path[_0x7f1d('0x55')](_0x1e4ba8[_0x7f1d('0x53')][_0x7f1d('0x54')])[_0x7f1d('0x57')](0x1),'converted_format':_0x7f1d('0x58')};var _0x1e4437=path[_0x7f1d('0x4a')](config[_0x7f1d('0x4e')],_0x7f1d('0x59'),_0x1e4ba8[_0x7f1d('0x53')][_0x7f1d('0x56')]);var _0x48b3c9=path[_0x7f1d('0x4a')](config[_0x7f1d('0x4e')],_0x7f1d('0x4b'),util[_0x7f1d('0x4f')]('%s.%s',path[_0x7f1d('0x52')](_0x1e4ba8[_0x7f1d('0x53')][_0x7f1d('0x56')],path[_0x7f1d('0x55')](_0x1e4ba8[_0x7f1d('0x53')][_0x7f1d('0x56')])),_0x235cf3['converted_format']));logger[_0x7f1d('0x5a')](_0x7f1d('0x5b'),_0x1e4437);logger['info'](_0x7f1d('0x5c'),_0x48b3c9);try{fs[_0x7f1d('0x5d')](_0x1e4437,parseInt(_0x7f1d('0x5e'),0x8));var _0x58ca15=sox['transcode'](_0x1e4437,_0x48b3c9,{'sampleRate':0x1f40,'format':_0x7f1d('0x58'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x58ca15['on']('error',function(_0x2a9c9d){fs['unlinkSync'](_0x1e4437);_0x598b10[_0x7f1d('0x1b')](0x1f4)['send'](_0x2a9c9d);});_0x58ca15['on']('src',function(_0x1fb3ca){_0x235cf3['original_duration']=isNaN(_0x1fb3ca[_0x7f1d('0x5f')])?null:_0x1fb3ca[_0x7f1d('0x5f')]*0x3e8;_0x235cf3[_0x7f1d('0x60')]=isNaN(_0x1fb3ca['sampleCount'])?null:_0x1fb3ca['sampleCount'];_0x235cf3['original_channelCount']=isNaN(_0x1fb3ca['channelCount'])?null:_0x1fb3ca[_0x7f1d('0x61')];_0x235cf3[_0x7f1d('0x62')]=isNaN(_0x1fb3ca[_0x7f1d('0x63')])?null:_0x1fb3ca['bitRate'];_0x235cf3[_0x7f1d('0x64')]=isNaN(_0x1fb3ca[_0x7f1d('0x65')])?null:_0x1fb3ca[_0x7f1d('0x65')];});_0x58ca15['on'](_0x7f1d('0x66'),function(_0x2eaa0a){_0x235cf3[_0x7f1d('0x67')]=isNaN(_0x2eaa0a['duration'])?null:_0x2eaa0a[_0x7f1d('0x5f')]*0x3e8;_0x235cf3['converted_sampleCount']=isNaN(_0x2eaa0a[_0x7f1d('0x68')])?null:_0x2eaa0a[_0x7f1d('0x68')];_0x235cf3[_0x7f1d('0x69')]=isNaN(_0x2eaa0a[_0x7f1d('0x61')])?null:_0x2eaa0a[_0x7f1d('0x61')];_0x235cf3[_0x7f1d('0x6a')]=isNaN(_0x2eaa0a['bitRate'])?null:_0x2eaa0a[_0x7f1d('0x63')];_0x235cf3[_0x7f1d('0x6b')]=isNaN(_0x2eaa0a['sampleRate'])?null:_0x2eaa0a['sampleRate'];});_0x58ca15['on']('end',function(){fs[_0x7f1d('0x5d')](_0x48b3c9,parseInt(_0x7f1d('0x5e'),0x8));return db[_0x7f1d('0x29')]['create'](_0x235cf3)['then'](function(_0x24a3e6){var _0x5a4b79={'role':_0x1e4ba8['body'][_0x7f1d('0x6c')],'userProfileId':_0x1e4ba8[_0x7f1d('0x6d')][_0x7f1d('0x6e')]};if(!_0x5a4b79)throw new Error(_0x7f1d('0x6f'));if(_0x5a4b79[_0x7f1d('0x6c')]===_0x7f1d('0x70')){var _0x33da54=_0x24a3e6[_0x7f1d('0x21')]({'plain':!![]});return db[_0x7f1d('0x71')][_0x7f1d('0x72')]({'where':{'name':_0x7f1d('0x22'),'userProfileId':_0x5a4b79[_0x7f1d('0x6e')]},'raw':!![]})[_0x7f1d('0x20')](function(_0x47c60d){if(_0x47c60d&&_0x47c60d[_0x7f1d('0x73')]===0x0){return db[_0x7f1d('0x23')][_0x7f1d('0x51')]({'name':_0x33da54['name'],'resourceId':_0x33da54['id'],'type':_0x47c60d[_0x7f1d('0x27')],'sectionId':_0x47c60d['id']},{})[_0x7f1d('0x20')](function(){return _0x24a3e6;});}else{return _0x24a3e6;}})[_0x7f1d('0x43')](function(_0xa17b36){logger[_0x7f1d('0x25')](_0x7f1d('0x74'),_0xa17b36);throw _0xa17b36;});}return _0x24a3e6;})[_0x7f1d('0x20')](respondWithResult(_0x598b10,null))[_0x7f1d('0x43')](handleError(_0x598b10,null));});_0x58ca15[_0x7f1d('0x75')]();}catch(_0x6334ca){_0x598b10['status'](0x1f4)[_0x7f1d('0x28')](_0x6334ca);}};exports[_0x7f1d('0x1f')]=function(_0x396bd1,_0x5398db,_0x115d0b){return db[_0x7f1d('0x29')][_0x7f1d('0x72')]({'where':{'id':_0x396bd1[_0x7f1d('0x45')]['id']}})[_0x7f1d('0x20')](handleEntityNotFound(_0x5398db,null))[_0x7f1d('0x20')](saveUpdates(_['pick'](_0x396bd1[_0x7f1d('0x6d')],['name',_0x7f1d('0x76')]),null))[_0x7f1d('0x20')](respondWithResult(_0x5398db,null))[_0x7f1d('0x43')](handleError(_0x5398db,null));};exports[_0x7f1d('0x77')]=function(_0x10fb41,_0x3374de,_0x5cb2ce){return db[_0x7f1d('0x29')]['find']({'where':{'id':_0x10fb41[_0x7f1d('0x45')]['id']}})['then'](function(_0x3cd9a0){if(_0x3cd9a0){return _0x3cd9a0[_0x7f1d('0x24')]();}})[_0x7f1d('0x20')](function(_0x55318c){var _0x1af8c4=path[_0x7f1d('0x4a')](config[_0x7f1d('0x4e')],_0x7f1d('0x59'),util[_0x7f1d('0x4f')](_0x7f1d('0x50'),_0x55318c['save_name'],_0x55318c[_0x7f1d('0x78')]));var _0x4ea57b=path['join'](config['root'],_0x7f1d('0x4b'),util[_0x7f1d('0x4f')](_0x7f1d('0x50'),_0x55318c[_0x7f1d('0x4c')],_0x55318c[_0x7f1d('0x48')]));fs[_0x7f1d('0x79')](_0x1af8c4);fs[_0x7f1d('0x79')](_0x4ea57b);return _0x55318c;})[_0x7f1d('0x20')](function(_0x24d107){if(_0x24d107){return _0x3374de[_0x7f1d('0x1b')](0xcc)[_0x7f1d('0x1a')]();}})['then'](handleEntityNotFound(_0x3374de,null))['catch'](handleError(_0x3374de,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 1ac57bc..93a7f05 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 _0x9472=['define','Sound','tools_sounds','lodash','util','../../config/logger','api','moment','path','rimraf','./sound.attributes','exports'];(function(_0x1123c8,_0x5d5710){var _0x47c76a=function(_0x12c95c){while(--_0x12c95c){_0x1123c8['push'](_0x1123c8['shift']());}};_0x47c76a(++_0x5d5710);}(_0x9472,0x1ef));var _0x2947=function(_0x58f22d,_0x27e7d3){_0x58f22d=_0x58f22d-0x0;var _0xd1f5ca=_0x9472[_0x58f22d];return _0xd1f5ca;};'use strict';var _=require(_0x2947('0x0'));var util=require(_0x2947('0x1'));var logger=require(_0x2947('0x2'))(_0x2947('0x3'));var moment=require(_0x2947('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2947('0x5'));var rimraf=require(_0x2947('0x6'));var config=require('../../config/environment');var attributes=require(_0x2947('0x7'));module[_0x2947('0x8')]=function(_0x2cd703,_0x55e997){return _0x2cd703[_0x2947('0x9')](_0x2947('0xa'),attributes,{'tableName':_0x2947('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f17=['request-promise','rimraf','../../config/environment','exports','define','Sound','tools_sounds','util','../../config/logger','moment'];(function(_0x581feb,_0xd74dcc){var _0x734423=function(_0xe2facc){while(--_0xe2facc){_0x581feb['push'](_0x581feb['shift']());}};_0x734423(++_0xd74dcc);}(_0x4f17,0x75));var _0x74f1=function(_0x3df822,_0x299495){_0x3df822=_0x3df822-0x0;var _0x4e457d=_0x4f17[_0x3df822];return _0x4e457d;};'use strict';var _=require('lodash');var util=require(_0x74f1('0x0'));var logger=require(_0x74f1('0x1'))('api');var moment=require(_0x74f1('0x2'));var BPromise=require('bluebird');var rp=require(_0x74f1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x74f1('0x4'));var config=require(_0x74f1('0x5'));var attributes=require('./sound.attributes');module[_0x74f1('0x6')]=function(_0x178ca2,_0x1a226a){return _0x178ca2[_0x74f1('0x7')](_0x74f1('0x8'),attributes,{'tableName':_0x74f1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 29596aa..a081923 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 _0x5928=['result','catch','ShowSound','Sound','find','options','raw','where','attributes','include','map','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','Sound,\x20%s,\x20%s','message'];(function(_0x4e5d67,_0x54dffc){var _0x4acdf3=function(_0x53e5a3){while(--_0x53e5a3){_0x4e5d67['push'](_0x4e5d67['shift']());}};_0x4acdf3(++_0x54dffc);}(_0x5928,0xde));var _0x8592=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5928[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8592('0x0'));var util=require(_0x8592('0x1'));var moment=require(_0x8592('0x2'));var BPromise=require('bluebird');var rs=require(_0x8592('0x3'));var fs=require('fs');var Redis=require(_0x8592('0x4'));var db=require(_0x8592('0x5'))['db'];var utils=require(_0x8592('0x6'));var logger=require(_0x8592('0x7'))('rpc');var config=require(_0x8592('0x8'));var jayson=require(_0x8592('0x9'));var client=jayson[_0x8592('0xa')][_0x8592('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5da288,_0x1bdf24,_0xa007ed){return new BPromise(function(_0x4b70b9,_0x36661d){return client[_0x8592('0xc')](_0x5da288,_0xa007ed)[_0x8592('0xd')](function(_0x32fe25){logger[_0x8592('0xe')]('Sound,\x20%s,\x20%s',_0x1bdf24,_0x8592('0xf'));logger[_0x8592('0x10')](_0x8592('0x11'),_0x1bdf24,_0x8592('0xf'),JSON[_0x8592('0x12')](_0x32fe25));if(_0x32fe25['error']){if(_0x32fe25[_0x8592('0x13')][_0x8592('0x14')]===0x1f4){logger['error'](_0x8592('0x15'),_0x1bdf24,_0x32fe25['error'][_0x8592('0x16')]);return _0x36661d(_0x32fe25[_0x8592('0x13')][_0x8592('0x16')]);}logger['error'](_0x8592('0x15'),_0x1bdf24,_0x32fe25['error'][_0x8592('0x16')]);return _0x4b70b9(_0x32fe25[_0x8592('0x13')][_0x8592('0x16')]);}else{logger['info'](_0x8592('0x15'),_0x1bdf24,_0x8592('0xf'));_0x4b70b9(_0x32fe25[_0x8592('0x17')][_0x8592('0x16')]);}})[_0x8592('0x18')](function(_0x18d88a){logger['error'](_0x8592('0x15'),_0x1bdf24,_0x18d88a);_0x36661d(_0x18d88a);});});}exports[_0x8592('0x19')]=function(_0x372dd1){var _0x1a6894=this;return new Promise(function(_0x21ae1a,_0x547c72){return db[_0x8592('0x1a')][_0x8592('0x1b')]({'raw':_0x372dd1[_0x8592('0x1c')]?_0x372dd1[_0x8592('0x1c')][_0x8592('0x1d')]===undefined?!![]:![]:!![],'where':_0x372dd1[_0x8592('0x1c')]?_0x372dd1[_0x8592('0x1c')][_0x8592('0x1e')]||null:null,'attributes':_0x372dd1[_0x8592('0x1c')]?_0x372dd1[_0x8592('0x1c')][_0x8592('0x1f')]||null:null,'include':_0x372dd1[_0x8592('0x1c')]?_0x372dd1[_0x8592('0x1c')][_0x8592('0x20')]?_[_0x8592('0x21')](_0x372dd1[_0x8592('0x1c')][_0x8592('0x20')],function(_0x4d9204){return{'model':db[_0x4d9204['model']],'as':_0x4d9204['as'],'attributes':_0x4d9204[_0x8592('0x1f')],'include':_0x4d9204[_0x8592('0x20')]?_['map'](_0x4d9204[_0x8592('0x20')],function(_0x1cdec2){return{'model':db[_0x1cdec2[_0x8592('0x22')]],'as':_0x1cdec2['as'],'attributes':_0x1cdec2[_0x8592('0x1f')],'include':_0x1cdec2[_0x8592('0x20')]?_[_0x8592('0x21')](_0x1cdec2[_0x8592('0x20')],function(_0x10fb54){return{'model':db[_0x10fb54['model']],'as':_0x10fb54['as'],'attributes':_0x10fb54[_0x8592('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8592('0xd')](function(_0xc3b1f1){logger['info'](_0x8592('0x19'),_0x372dd1);logger['debug'](_0x8592('0x19'),_0x372dd1,JSON[_0x8592('0x12')](_0xc3b1f1));_0x21ae1a(_0xc3b1f1);})['catch'](function(_0x5caf7f){logger[_0x8592('0x13')](_0x8592('0x19'),_0x5caf7f[_0x8592('0x16')],_0x372dd1);_0x547c72(_0x1a6894[_0x8592('0x13')](0x1f4,_0x5caf7f[_0x8592('0x16')]));});});}; \ No newline at end of file +var _0x12c5=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSound','Sound','find','options','raw','where','attributes','include','map','model','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x12c5,0xc1));var _0x512c=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x12c5[_0x10004e];return _0x5af990;};'use strict';var _=require(_0x512c('0x0'));var util=require(_0x512c('0x1'));var moment=require('moment');var BPromise=require(_0x512c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x512c('0x3'));var db=require(_0x512c('0x4'))['db'];var utils=require(_0x512c('0x5'));var logger=require(_0x512c('0x6'))(_0x512c('0x7'));var config=require(_0x512c('0x8'));var jayson=require(_0x512c('0x9'));var client=jayson['client'][_0x512c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x221f89,_0x426db2,_0x3b61a4){return new BPromise(function(_0x5badf0,_0x1ec4e2){return client[_0x512c('0xb')](_0x221f89,_0x3b61a4)[_0x512c('0xc')](function(_0x2c6d2a){logger[_0x512c('0xd')](_0x512c('0xe'),_0x426db2,_0x512c('0xf'));logger[_0x512c('0x10')](_0x512c('0x11'),_0x426db2,_0x512c('0xf'),JSON[_0x512c('0x12')](_0x2c6d2a));if(_0x2c6d2a[_0x512c('0x13')]){if(_0x2c6d2a['error'][_0x512c('0x14')]===0x1f4){logger[_0x512c('0x13')](_0x512c('0xe'),_0x426db2,_0x2c6d2a[_0x512c('0x13')][_0x512c('0x15')]);return _0x1ec4e2(_0x2c6d2a['error'][_0x512c('0x15')]);}logger[_0x512c('0x13')]('Sound,\x20%s,\x20%s',_0x426db2,_0x2c6d2a[_0x512c('0x13')][_0x512c('0x15')]);return _0x5badf0(_0x2c6d2a[_0x512c('0x13')][_0x512c('0x15')]);}else{logger[_0x512c('0xd')](_0x512c('0xe'),_0x426db2,_0x512c('0xf'));_0x5badf0(_0x2c6d2a[_0x512c('0x16')][_0x512c('0x15')]);}})['catch'](function(_0x15e940){logger[_0x512c('0x13')](_0x512c('0xe'),_0x426db2,_0x15e940);_0x1ec4e2(_0x15e940);});});}exports[_0x512c('0x17')]=function(_0x51e915){var _0x49d9e1=this;return new Promise(function(_0x497079,_0xd7ff0d){return db[_0x512c('0x18')][_0x512c('0x19')]({'raw':_0x51e915[_0x512c('0x1a')]?_0x51e915['options'][_0x512c('0x1b')]===undefined?!![]:![]:!![],'where':_0x51e915[_0x512c('0x1a')]?_0x51e915[_0x512c('0x1a')][_0x512c('0x1c')]||null:null,'attributes':_0x51e915[_0x512c('0x1a')]?_0x51e915[_0x512c('0x1a')][_0x512c('0x1d')]||null:null,'include':_0x51e915[_0x512c('0x1a')]?_0x51e915[_0x512c('0x1a')][_0x512c('0x1e')]?_[_0x512c('0x1f')](_0x51e915[_0x512c('0x1a')]['include'],function(_0x5bdb66){return{'model':db[_0x5bdb66[_0x512c('0x20')]],'as':_0x5bdb66['as'],'attributes':_0x5bdb66[_0x512c('0x1d')],'include':_0x5bdb66[_0x512c('0x1e')]?_[_0x512c('0x1f')](_0x5bdb66['include'],function(_0x54c886){return{'model':db[_0x54c886[_0x512c('0x20')]],'as':_0x54c886['as'],'attributes':_0x54c886['attributes'],'include':_0x54c886['include']?_['map'](_0x54c886[_0x512c('0x1e')],function(_0x38448d){return{'model':db[_0x38448d[_0x512c('0x20')]],'as':_0x38448d['as'],'attributes':_0x38448d[_0x512c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x512c('0xc')](function(_0x5a63f5){logger[_0x512c('0xd')]('ShowSound',_0x51e915);logger[_0x512c('0x10')]('ShowSound',_0x51e915,JSON['stringify'](_0x5a63f5));_0x497079(_0x5a63f5);})['catch'](function(_0xac27f8){logger['error'](_0x512c('0x17'),_0xac27f8[_0x512c('0x15')],_0x51e915);_0xd7ff0d(_0x49d9e1[_0x512c('0x13')](0x1f4,_0xac27f8[_0x512c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index ad75940..703ba0e 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 _0x44c6=['./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0xc7348b,_0x145880){var _0x307cec=function(_0x4f1554){while(--_0x4f1554){_0xc7348b['push'](_0xc7348b['shift']());}};_0x307cec(++_0x145880);}(_0x44c6,0xae));var _0x644c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x44c6[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x644c('0x0'));var path=require('path');var timeout=require(_0x644c('0x1'));var express=require(_0x644c('0x2'));var router=express['Router']();var fs_extra=require(_0x644c('0x3'));var auth=require(_0x644c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x644c('0x5'));var controller=require(_0x644c('0x6'));router[_0x644c('0x7')]('/',auth[_0x644c('0x8')](),controller[_0x644c('0x9')]);router[_0x644c('0x7')](_0x644c('0xa'),auth['isAuthenticated'](),controller[_0x644c('0xb')]);router[_0x644c('0xc')]('/',auth['isAuthenticated'](),controller[_0x644c('0xd')]);router[_0x644c('0xe')](_0x644c('0xa'),auth[_0x644c('0x8')](),controller[_0x644c('0xf')]);router[_0x644c('0x10')]('/:id',auth[_0x644c('0x8')](),controller['destroy']);module[_0x644c('0x11')]=router; \ No newline at end of file +var _0xa675=['./squareMessage.controller','get','isAuthenticated','/:id','show','post','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x54eab6,_0x5e262f){var _0x1e7435=function(_0x468c91){while(--_0x468c91){_0x54eab6['push'](_0x54eab6['shift']());}};_0x1e7435(++_0x5e262f);}(_0xa675,0xac));var _0x5a67=function(_0x5654ef,_0x1ddf03){_0x5654ef=_0x5654ef-0x0;var _0x40fee1=_0xa675[_0x5654ef];return _0x40fee1;};'use strict';var multer=require('multer');var util=require(_0x5a67('0x0'));var path=require(_0x5a67('0x1'));var timeout=require(_0x5a67('0x2'));var express=require(_0x5a67('0x3'));var router=express[_0x5a67('0x4')]();var fs_extra=require(_0x5a67('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5a67('0x6'));var config=require(_0x5a67('0x7'));var controller=require(_0x5a67('0x8'));router[_0x5a67('0x9')]('/',auth[_0x5a67('0xa')](),controller['index']);router[_0x5a67('0x9')](_0x5a67('0xb'),auth['isAuthenticated'](),controller[_0x5a67('0xc')]);router[_0x5a67('0xd')]('/',auth[_0x5a67('0xa')](),controller['create']);router['put'](_0x5a67('0xb'),auth['isAuthenticated'](),controller[_0x5a67('0xe')]);router[_0x5a67('0xf')]('/:id',auth[_0x5a67('0xa')](),controller[_0x5a67('0x10')]);module[_0x5a67('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 fa7c859..f3b8aad 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 _0x04de=['TEXT','medium','ENUM','out','sequelize','exports','STRING'];(function(_0x1f803d,_0x1c966e){var _0x549186=function(_0x1308e2){while(--_0x1308e2){_0x1f803d['push'](_0x1f803d['shift']());}};_0x549186(++_0x1c966e);}(_0x04de,0x107));var _0xe04d=function(_0x35b2a1,_0x291bd5){_0x35b2a1=_0x35b2a1-0x0;var _0x500ef1=_0x04de[_0x35b2a1];return _0x500ef1;};'use strict';var Sequelize=require(_0xe04d('0x0'));module[_0xe04d('0x1')]={'uniqueid':{'type':Sequelize[_0xe04d('0x2')]},'body':{'type':Sequelize[_0xe04d('0x3')](_0xe04d('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xe04d('0x5')]('in',_0xe04d('0x6')),'defaultValue':_0xe04d('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0xe04d('0x2')]},'providerResponse':{'type':Sequelize[_0xe04d('0x3')]}}; \ No newline at end of file +var _0x24ca=['sequelize','TEXT','ENUM','out'];(function(_0x46fbba,_0x36010f){var _0xd143af=function(_0x1b3915){while(--_0x1b3915){_0x46fbba['push'](_0x46fbba['shift']());}};_0xd143af(++_0x36010f);}(_0x24ca,0x8c));var _0xa24c=function(_0x168127,_0x59cea1){_0x168127=_0x168127-0x0;var _0x4c99ad=_0x24ca[_0x168127];return _0x4c99ad;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xa24c('0x1')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xa24c('0x2')]('in',_0xa24c('0x3')),'defaultValue':_0xa24c('0x3'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xa24c('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 070d94b..faaa518 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 _0x5d38=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','end','error','stack','send','map','SquareMessage','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','type','VIRTUAL','name','options','include','catch','show','params','filters','includeAll','create','body','find','destroy','html-pdf'];(function(_0x422cff,_0x3c72a0){var _0x185612=function(_0x20f953){while(--_0x20f953){_0x422cff['push'](_0x422cff['shift']());}};_0x185612(++_0x3c72a0);}(_0x5d38,0xdd));var _0x85d3=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x5d38[_0x160c73];return _0xd9302;};'use strict';var pdf=require(_0x85d3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x85d3('0x1'));var zipdir=require(_0x85d3('0x2'));var jsonpatch=require(_0x85d3('0x3'));var rp=require(_0x85d3('0x4'));var moment=require('moment');var BPromise=require(_0x85d3('0x5'));var Mustache=require(_0x85d3('0x6'));var util=require(_0x85d3('0x7'));var path=require('path');var sox=require(_0x85d3('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x85d3('0x9'));var _=require(_0x85d3('0xa'));var squel=require(_0x85d3('0xb'));var crypto=require(_0x85d3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x85d3('0xd'));var toCsv=require(_0x85d3('0xe'));var querystring=require(_0x85d3('0xf'));var Papa=require(_0x85d3('0x10'));var Redis=require(_0x85d3('0x11'));var authService=require(_0x85d3('0x12'));var qs=require(_0x85d3('0x13'));var as=require(_0x85d3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x85d3('0x15'))(_0x85d3('0x16'));var utils=require('../../config/utils');var config=require(_0x85d3('0x17'));var licenseUtil=require(_0x85d3('0x18'));var db=require(_0x85d3('0x19'))['db'];function respondWithStatusCode(_0xc1a757,_0x178237){_0x178237=_0x178237||0xcc;return function(_0x54f2fb){if(_0x54f2fb){return _0xc1a757[_0x85d3('0x1a')](_0x178237);}return _0xc1a757[_0x85d3('0x1b')](_0x178237)['end']();};}function respondWithResult(_0x406341,_0x48ce3d){_0x48ce3d=_0x48ce3d||0xc8;return function(_0x213370){if(_0x213370){return _0x406341[_0x85d3('0x1b')](_0x48ce3d)['json'](_0x213370);}};}function respondWithFilteredResult(_0x4e9c29,_0x20b368){return function(_0x5e6d4f){if(_0x5e6d4f){var _0x44ed9f=_0x5e6d4f['count'],_0x5a2d62=_0x20b368[_0x85d3('0x1c')],_0x1a644a=_0x20b368[_0x85d3('0x1c')]+_0x20b368[_0x85d3('0x1d')],_0x510fa8;if(_0x1a644a>=_0x44ed9f){_0x1a644a=_0x44ed9f;_0x510fa8=0xc8;}else{_0x510fa8=0xce;}_0x4e9c29['status'](_0x510fa8);return _0x4e9c29[_0x85d3('0x1e')](_0x85d3('0x1f'),_0x5a2d62+'-'+_0x1a644a+'/'+_0x44ed9f)[_0x85d3('0x20')](_0x5e6d4f);}return null;};}function patchUpdates(_0x5e1058){return function(_0x534ca8){try{jsonpatch[_0x85d3('0x21')](_0x534ca8,_0x5e1058,!![]);}catch(_0x440f89){return BPromise[_0x85d3('0x22')](_0x440f89);}return _0x534ca8[_0x85d3('0x23')]();};}function saveUpdates(_0x51bbab,_0x5dcd77){return function(_0x60fb41){if(_0x60fb41){return _0x60fb41[_0x85d3('0x24')](_0x51bbab)[_0x85d3('0x25')](function(_0x100ecb){return _0x100ecb;});}return null;};}function removeEntity(_0x2ff01b,_0x5afa4b){return function(_0x50a053){if(_0x50a053){return _0x50a053['destroy']()[_0x85d3('0x25')](function(){_0x2ff01b[_0x85d3('0x1b')](0xcc)[_0x85d3('0x26')]();});}};}function handleEntityNotFound(_0x22689a,_0xca74e2){return function(_0xc21d72){if(!_0xc21d72){_0x22689a['sendStatus'](0x194);}return _0xc21d72;};}function handleError(_0x403903,_0x3b91d2){_0x3b91d2=_0x3b91d2||0x1f4;return function(_0x35ac8b){logger[_0x85d3('0x27')](_0x35ac8b[_0x85d3('0x28')]);if(_0x35ac8b['name']){delete _0x35ac8b['name'];}_0x403903['status'](_0x3b91d2)[_0x85d3('0x29')](_0x35ac8b);};}exports['index']=function(_0xc1bd58,_0x392128){var _0x42a03e={},_0x4f1f9c={},_0x419d27={'count':0x0,'rows':[]};var _0x1dde99=_[_0x85d3('0x2a')](db[_0x85d3('0x2b')][_0x85d3('0x2c')],function(_0x46f301){return{'name':_0x46f301[_0x85d3('0x2d')],'type':_0x46f301['type'][_0x85d3('0x2e')]};});_0x4f1f9c[_0x85d3('0x2f')]=_['map'](_0x1dde99,'name');_0x4f1f9c[_0x85d3('0x30')]=_[_0x85d3('0x31')](_0xc1bd58[_0x85d3('0x30')]);_0x4f1f9c['filters']=_['intersection'](_0x4f1f9c['model'],_0x4f1f9c[_0x85d3('0x30')]);_0x42a03e['attributes']=_[_0x85d3('0x32')](_0x4f1f9c[_0x85d3('0x2f')],qs[_0x85d3('0x33')](_0xc1bd58[_0x85d3('0x30')][_0x85d3('0x33')]));_0x42a03e[_0x85d3('0x34')]=_0x42a03e[_0x85d3('0x34')][_0x85d3('0x35')]?_0x42a03e[_0x85d3('0x34')]:_0x4f1f9c[_0x85d3('0x2f')];if(!_0xc1bd58[_0x85d3('0x30')]['hasOwnProperty']('nolimit')){_0x42a03e[_0x85d3('0x1d')]=qs['limit'](_0xc1bd58[_0x85d3('0x30')]['limit']);_0x42a03e['offset']=qs[_0x85d3('0x1c')](_0xc1bd58[_0x85d3('0x30')][_0x85d3('0x1c')]);}_0x42a03e[_0x85d3('0x36')]=qs[_0x85d3('0x37')](_0xc1bd58['query'][_0x85d3('0x37')]);_0x42a03e[_0x85d3('0x38')]=qs['filters'](_[_0x85d3('0x39')](_0xc1bd58[_0x85d3('0x30')],_0x4f1f9c['filters']),_0x1dde99);if(_0xc1bd58[_0x85d3('0x30')][_0x85d3('0x3a')]){_0x42a03e[_0x85d3('0x38')]=_[_0x85d3('0x3b')](_0x42a03e['where'],{'$or':_[_0x85d3('0x2a')](_0x1dde99,function(_0x5c99bd){if(_0x5c99bd[_0x85d3('0x3c')]!==_0x85d3('0x3d')){var _0x614bf4={};_0x614bf4[_0x5c99bd[_0x85d3('0x3e')]]={'$like':'%'+_0xc1bd58['query'][_0x85d3('0x3a')]+'%'};return _0x614bf4;}})});}_0x42a03e=_[_0x85d3('0x3b')]({},_0x42a03e,_0xc1bd58[_0x85d3('0x3f')]);var _0x2626f9={'where':_0x42a03e[_0x85d3('0x38')]};return db[_0x85d3('0x2b')]['count'](_0x2626f9)[_0x85d3('0x25')](function(_0x68d7ed){_0x419d27['count']=_0x68d7ed;if(_0xc1bd58[_0x85d3('0x30')]['includeAll']){_0x42a03e[_0x85d3('0x40')]=[{'all':!![]}];}return db[_0x85d3('0x2b')]['findAll'](_0x42a03e);})[_0x85d3('0x25')](function(_0x6031f0){_0x419d27['rows']=_0x6031f0;return _0x419d27;})[_0x85d3('0x25')](respondWithFilteredResult(_0x392128,_0x42a03e))[_0x85d3('0x41')](handleError(_0x392128,null));};exports[_0x85d3('0x42')]=function(_0x46098,_0x28575a){var _0x24e0a8={'raw':!![],'where':{'id':_0x46098[_0x85d3('0x43')]['id']}},_0x3a52e7={};_0x3a52e7['model']=_['keys'](db[_0x85d3('0x2b')][_0x85d3('0x2c')]);_0x3a52e7['query']=_['keys'](_0x46098[_0x85d3('0x30')]);_0x3a52e7[_0x85d3('0x44')]=_[_0x85d3('0x32')](_0x3a52e7[_0x85d3('0x2f')],_0x3a52e7[_0x85d3('0x30')]);_0x24e0a8['attributes']=_['intersection'](_0x3a52e7[_0x85d3('0x2f')],qs[_0x85d3('0x33')](_0x46098[_0x85d3('0x30')][_0x85d3('0x33')]));_0x24e0a8[_0x85d3('0x34')]=_0x24e0a8['attributes']['length']?_0x24e0a8['attributes']:_0x3a52e7['model'];if(_0x46098['query'][_0x85d3('0x45')]){_0x24e0a8[_0x85d3('0x40')]=[{'all':!![]}];}_0x24e0a8=_[_0x85d3('0x3b')]({},_0x24e0a8,_0x46098['options']);return db[_0x85d3('0x2b')]['find'](_0x24e0a8)[_0x85d3('0x25')](handleEntityNotFound(_0x28575a,null))[_0x85d3('0x25')](respondWithResult(_0x28575a,null))[_0x85d3('0x41')](handleError(_0x28575a,null));};exports['create']=function(_0x3d5f35,_0x4fd560){return db[_0x85d3('0x2b')][_0x85d3('0x46')](_0x3d5f35['body'],{})[_0x85d3('0x25')](respondWithResult(_0x4fd560,0xc9))[_0x85d3('0x41')](handleError(_0x4fd560,null));};exports[_0x85d3('0x24')]=function(_0x4581f7,_0x419160){if(_0x4581f7[_0x85d3('0x47')]['id']){delete _0x4581f7[_0x85d3('0x47')]['id'];}return db[_0x85d3('0x2b')][_0x85d3('0x48')]({'where':{'id':_0x4581f7[_0x85d3('0x43')]['id']}})[_0x85d3('0x25')](handleEntityNotFound(_0x419160,null))[_0x85d3('0x25')](saveUpdates(_0x4581f7[_0x85d3('0x47')],null))[_0x85d3('0x25')](respondWithResult(_0x419160,null))[_0x85d3('0x41')](handleError(_0x419160,null));};exports[_0x85d3('0x49')]=function(_0x5ad1d8,_0x497bfd){return db['SquareMessage'][_0x85d3('0x48')]({'where':{'id':_0x5ad1d8['params']['id']}})[_0x85d3('0x25')](handleEntityNotFound(_0x497bfd,null))[_0x85d3('0x25')](removeEntity(_0x497bfd,null))[_0x85d3('0x41')](handleError(_0x497bfd,null));}; \ No newline at end of file +var _0x0f56=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','set','Content-Range','reject','save','destroy','stack','name','send','index','SquareMessage','rawAttributes','fieldName','type','model','intersection','attributes','query','fields','length','nolimit','order','sort','where','filters','VIRTUAL','filter','merge','options','count','then','include','findAll','rows','show','params','keys','catch','create','update','body','find','html-pdf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x124b24,_0x24494f){var _0x1c62fa=function(_0xfcb2e3){while(--_0xfcb2e3){_0x124b24['push'](_0x124b24['shift']());}};_0x1c62fa(++_0x24494f);}(_0x0f56,0xc3));var _0x60f5=function(_0x435645,_0xc3d7aa){_0x435645=_0x435645-0x0;var _0x546f44=_0x0f56[_0x435645];return _0x546f44;};'use strict';var pdf=require(_0x60f5('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x60f5('0x1'));var moment=require(_0x60f5('0x2'));var BPromise=require(_0x60f5('0x3'));var Mustache=require(_0x60f5('0x4'));var util=require(_0x60f5('0x5'));var path=require(_0x60f5('0x6'));var sox=require(_0x60f5('0x7'));var csv=require(_0x60f5('0x8'));var ejs=require(_0x60f5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x60f5('0xa'));var squel=require(_0x60f5('0xb'));var crypto=require(_0x60f5('0xc'));var jsforce=require(_0x60f5('0xd'));var deskjs=require(_0x60f5('0xe'));var toCsv=require(_0x60f5('0x8'));var querystring=require(_0x60f5('0xf'));var Papa=require(_0x60f5('0x10'));var Redis=require('ioredis');var authService=require(_0x60f5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x60f5('0x12'));var hardwareService=require(_0x60f5('0x13'));var logger=require(_0x60f5('0x14'))(_0x60f5('0x15'));var utils=require(_0x60f5('0x16'));var config=require(_0x60f5('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x60f5('0x18'))['db'];function respondWithStatusCode(_0x41ff31,_0x36dca1){_0x36dca1=_0x36dca1||0xcc;return function(_0x41c064){if(_0x41c064){return _0x41ff31['sendStatus'](_0x36dca1);}return _0x41ff31['status'](_0x36dca1)[_0x60f5('0x19')]();};}function respondWithResult(_0x1896a5,_0x47eaaf){_0x47eaaf=_0x47eaaf||0xc8;return function(_0x28bcf9){if(_0x28bcf9){return _0x1896a5[_0x60f5('0x1a')](_0x47eaaf)[_0x60f5('0x1b')](_0x28bcf9);}};}function respondWithFilteredResult(_0x551408,_0x45e640){return function(_0x53469d){if(_0x53469d){var _0x41a7e0=_0x53469d['count'],_0x317e41=_0x45e640[_0x60f5('0x1c')],_0x441d59=_0x45e640['offset']+_0x45e640[_0x60f5('0x1d')],_0x48a9cf;if(_0x441d59>=_0x41a7e0){_0x441d59=_0x41a7e0;_0x48a9cf=0xc8;}else{_0x48a9cf=0xce;}_0x551408[_0x60f5('0x1a')](_0x48a9cf);return _0x551408[_0x60f5('0x1e')](_0x60f5('0x1f'),_0x317e41+'-'+_0x441d59+'/'+_0x41a7e0)[_0x60f5('0x1b')](_0x53469d);}return null;};}function patchUpdates(_0xd1ec7e){return function(_0x21d2a0){try{jsonpatch['apply'](_0x21d2a0,_0xd1ec7e,!![]);}catch(_0x1262a6){return BPromise[_0x60f5('0x20')](_0x1262a6);}return _0x21d2a0[_0x60f5('0x21')]();};}function saveUpdates(_0x373569,_0x12525d){return function(_0x527208){if(_0x527208){return _0x527208['update'](_0x373569)['then'](function(_0x3d5374){return _0x3d5374;});}return null;};}function removeEntity(_0x1d8d64,_0x2a51d1){return function(_0x469867){if(_0x469867){return _0x469867[_0x60f5('0x22')]()['then'](function(){_0x1d8d64[_0x60f5('0x1a')](0xcc)[_0x60f5('0x19')]();});}};}function handleEntityNotFound(_0x188796,_0x16a106){return function(_0x5d8772){if(!_0x5d8772){_0x188796['sendStatus'](0x194);}return _0x5d8772;};}function handleError(_0x4f89d6,_0x5ca298){_0x5ca298=_0x5ca298||0x1f4;return function(_0x68085e){logger['error'](_0x68085e[_0x60f5('0x23')]);if(_0x68085e[_0x60f5('0x24')]){delete _0x68085e[_0x60f5('0x24')];}_0x4f89d6[_0x60f5('0x1a')](_0x5ca298)[_0x60f5('0x25')](_0x68085e);};}exports[_0x60f5('0x26')]=function(_0x1e5e88,_0x2061de){var _0x191bb4={},_0x33fa9b={},_0x3653ba={'count':0x0,'rows':[]};var _0x2e005c=_['map'](db[_0x60f5('0x27')][_0x60f5('0x28')],function(_0x294802){return{'name':_0x294802[_0x60f5('0x29')],'type':_0x294802[_0x60f5('0x2a')]['key']};});_0x33fa9b[_0x60f5('0x2b')]=_['map'](_0x2e005c,'name');_0x33fa9b['query']=_['keys'](_0x1e5e88['query']);_0x33fa9b['filters']=_[_0x60f5('0x2c')](_0x33fa9b[_0x60f5('0x2b')],_0x33fa9b['query']);_0x191bb4[_0x60f5('0x2d')]=_[_0x60f5('0x2c')](_0x33fa9b['model'],qs['fields'](_0x1e5e88[_0x60f5('0x2e')][_0x60f5('0x2f')]));_0x191bb4[_0x60f5('0x2d')]=_0x191bb4[_0x60f5('0x2d')][_0x60f5('0x30')]?_0x191bb4[_0x60f5('0x2d')]:_0x33fa9b[_0x60f5('0x2b')];if(!_0x1e5e88['query']['hasOwnProperty'](_0x60f5('0x31'))){_0x191bb4['limit']=qs[_0x60f5('0x1d')](_0x1e5e88['query'][_0x60f5('0x1d')]);_0x191bb4['offset']=qs['offset'](_0x1e5e88[_0x60f5('0x2e')][_0x60f5('0x1c')]);}_0x191bb4[_0x60f5('0x32')]=qs[_0x60f5('0x33')](_0x1e5e88[_0x60f5('0x2e')][_0x60f5('0x33')]);_0x191bb4[_0x60f5('0x34')]=qs[_0x60f5('0x35')](_['pick'](_0x1e5e88[_0x60f5('0x2e')],_0x33fa9b[_0x60f5('0x35')]),_0x2e005c);if(_0x1e5e88[_0x60f5('0x2e')]['filter']){_0x191bb4[_0x60f5('0x34')]=_['merge'](_0x191bb4['where'],{'$or':_['map'](_0x2e005c,function(_0x2c30e4){if(_0x2c30e4[_0x60f5('0x2a')]!==_0x60f5('0x36')){var _0x1714dd={};_0x1714dd[_0x2c30e4['name']]={'$like':'%'+_0x1e5e88[_0x60f5('0x2e')][_0x60f5('0x37')]+'%'};return _0x1714dd;}})});}_0x191bb4=_[_0x60f5('0x38')]({},_0x191bb4,_0x1e5e88[_0x60f5('0x39')]);var _0x24d60a={'where':_0x191bb4[_0x60f5('0x34')]};return db[_0x60f5('0x27')][_0x60f5('0x3a')](_0x24d60a)[_0x60f5('0x3b')](function(_0x209291){_0x3653ba[_0x60f5('0x3a')]=_0x209291;if(_0x1e5e88[_0x60f5('0x2e')]['includeAll']){_0x191bb4[_0x60f5('0x3c')]=[{'all':!![]}];}return db[_0x60f5('0x27')][_0x60f5('0x3d')](_0x191bb4);})[_0x60f5('0x3b')](function(_0x1554e3){_0x3653ba[_0x60f5('0x3e')]=_0x1554e3;return _0x3653ba;})['then'](respondWithFilteredResult(_0x2061de,_0x191bb4))['catch'](handleError(_0x2061de,null));};exports[_0x60f5('0x3f')]=function(_0x3095f3,_0x3699a8){var _0x2ef483={'raw':!![],'where':{'id':_0x3095f3[_0x60f5('0x40')]['id']}},_0x1ca88e={};_0x1ca88e[_0x60f5('0x2b')]=_[_0x60f5('0x41')](db[_0x60f5('0x27')][_0x60f5('0x28')]);_0x1ca88e[_0x60f5('0x2e')]=_[_0x60f5('0x41')](_0x3095f3[_0x60f5('0x2e')]);_0x1ca88e['filters']=_[_0x60f5('0x2c')](_0x1ca88e[_0x60f5('0x2b')],_0x1ca88e['query']);_0x2ef483[_0x60f5('0x2d')]=_[_0x60f5('0x2c')](_0x1ca88e['model'],qs[_0x60f5('0x2f')](_0x3095f3[_0x60f5('0x2e')][_0x60f5('0x2f')]));_0x2ef483[_0x60f5('0x2d')]=_0x2ef483[_0x60f5('0x2d')][_0x60f5('0x30')]?_0x2ef483[_0x60f5('0x2d')]:_0x1ca88e[_0x60f5('0x2b')];if(_0x3095f3['query']['includeAll']){_0x2ef483[_0x60f5('0x3c')]=[{'all':!![]}];}_0x2ef483=_[_0x60f5('0x38')]({},_0x2ef483,_0x3095f3[_0x60f5('0x39')]);return db[_0x60f5('0x27')]['find'](_0x2ef483)[_0x60f5('0x3b')](handleEntityNotFound(_0x3699a8,null))['then'](respondWithResult(_0x3699a8,null))[_0x60f5('0x42')](handleError(_0x3699a8,null));};exports['create']=function(_0x150e24,_0x392b28){return db[_0x60f5('0x27')][_0x60f5('0x43')](_0x150e24['body'],{})[_0x60f5('0x3b')](respondWithResult(_0x392b28,0xc9))['catch'](handleError(_0x392b28,null));};exports[_0x60f5('0x44')]=function(_0x2ba9af,_0x3ce8c7){if(_0x2ba9af[_0x60f5('0x45')]['id']){delete _0x2ba9af[_0x60f5('0x45')]['id'];}return db[_0x60f5('0x27')][_0x60f5('0x46')]({'where':{'id':_0x2ba9af[_0x60f5('0x40')]['id']}})[_0x60f5('0x3b')](handleEntityNotFound(_0x3ce8c7,null))[_0x60f5('0x3b')](saveUpdates(_0x2ba9af[_0x60f5('0x45')],null))['then'](respondWithResult(_0x3ce8c7,null))['catch'](handleError(_0x3ce8c7,null));};exports[_0x60f5('0x22')]=function(_0x48b551,_0x5b49ec){return db[_0x60f5('0x27')][_0x60f5('0x46')]({'where':{'id':_0x48b551['params']['id']}})['then'](handleEntityNotFound(_0x5b49ec,null))['then'](removeEntity(_0x5b49ec,null))['catch'](handleError(_0x5b49ec,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 93f31b8..fdc56ea 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 _0x5ac5=['bluebird','request-promise','../../config/environment','define','SquareMessage','square_messages','../../config/logger','moment'];(function(_0x13e758,_0x317d23){var _0x5b53c3=function(_0x103e80){while(--_0x103e80){_0x13e758['push'](_0x13e758['shift']());}};_0x5b53c3(++_0x317d23);}(_0x5ac5,0x66));var _0x55ac=function(_0x7cee91,_0xc949da){_0x7cee91=_0x7cee91-0x0;var _0x475790=_0x5ac5[_0x7cee91];return _0x475790;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x55ac('0x0'))('api');var moment=require(_0x55ac('0x1'));var BPromise=require(_0x55ac('0x2'));var rp=require(_0x55ac('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x55ac('0x4'));var attributes=require('./squareMessage.attributes');module['exports']=function(_0x21c960,_0x413c40){return _0x21c960[_0x55ac('0x5')](_0x55ac('0x6'),attributes,{'tableName':_0x55ac('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8148=['path','./squareMessage.attributes','exports','define','square_messages','util','../../config/logger','moment','bluebird'];(function(_0x322919,_0x2ea14c){var _0x1ccdb7=function(_0x38c4e4){while(--_0x38c4e4){_0x322919['push'](_0x322919['shift']());}};_0x1ccdb7(++_0x2ea14c);}(_0x8148,0x152));var _0x8814=function(_0x452acd,_0x3bcaac){_0x452acd=_0x452acd-0x0;var _0x328e8=_0x8148[_0x452acd];return _0x328e8;};'use strict';var _=require('lodash');var util=require(_0x8814('0x0'));var logger=require(_0x8814('0x1'))('api');var moment=require(_0x8814('0x2'));var BPromise=require(_0x8814('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8814('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8814('0x5'));module[_0x8814('0x6')]=function(_0x42c370,_0x5584d9){return _0x42c370[_0x8814('0x7')]('SquareMessage',attributes,{'tableName':_0x8814('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 822cf5b..2e57634 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 _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x26c7aa,_0x2be2f5){var _0x1f1565=function(_0x58ee33){while(--_0x58ee33){_0x26c7aa['push'](_0x26c7aa['shift']());}};_0x1f1565(++_0x2be2f5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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['CreateSquareMessage']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file +var _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x2fdf7c,_0x205ad2){var _0x20b654=function(_0x3257c8){while(--_0x3257c8){_0x2fdf7c['push'](_0x2fdf7c['shift']());}};_0x20b654(++_0x205ad2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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['CreateSquareMessage']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 50d4338..ef3c545 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 _0xd9c0=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','test','post','create','update','delete'];(function(_0x3f6ae9,_0x250970){var _0x1a3047=function(_0x516ac8){while(--_0x516ac8){_0x3f6ae9['push'](_0x3f6ae9['shift']());}};_0x1a3047(++_0x250970);}(_0xd9c0,0x1dc));var _0x0d9c=function(_0x3861e3,_0x3ad6df){_0x3861e3=_0x3861e3-0x0;var _0x3903fd=_0xd9c0[_0x3861e3];return _0x3903fd;};'use strict';var multer=require('multer');var util=require(_0x0d9c('0x0'));var path=require(_0x0d9c('0x1'));var timeout=require(_0x0d9c('0x2'));var express=require(_0x0d9c('0x3'));var router=express['Router']();var fs_extra=require(_0x0d9c('0x4'));var auth=require(_0x0d9c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0d9c('0x6'));var controller=require(_0x0d9c('0x7'));router[_0x0d9c('0x8')]('/',auth[_0x0d9c('0x9')](),controller[_0x0d9c('0xa')]);router[_0x0d9c('0x8')](_0x0d9c('0xb'),auth[_0x0d9c('0x9')](),controller['show']);router['get']('/:id/test',auth[_0x0d9c('0x9')](),timeout('15s'),controller[_0x0d9c('0xc')]);router[_0x0d9c('0xd')]('/',auth[_0x0d9c('0x9')](),controller[_0x0d9c('0xe')]);router['put'](_0x0d9c('0xb'),auth[_0x0d9c('0x9')](),controller[_0x0d9c('0xf')]);router[_0x0d9c('0x10')]('/:id',auth[_0x0d9c('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa427=['../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','15s','test','post','create','put','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5890ea,_0x371000){var _0x1773af=function(_0x43cb18){while(--_0x43cb18){_0x5890ea['push'](_0x5890ea['shift']());}};_0x1773af(++_0x371000);}(_0xa427,0xbf));var _0x7a42=function(_0x5f3cc2,_0x23b6b4){_0x5f3cc2=_0x5f3cc2-0x0;var _0x3823b0=_0xa427[_0x5f3cc2];return _0x3823b0;};'use strict';var multer=require(_0x7a42('0x0'));var util=require(_0x7a42('0x1'));var path=require(_0x7a42('0x2'));var timeout=require('connect-timeout');var express=require(_0x7a42('0x3'));var router=express[_0x7a42('0x4')]();var fs_extra=require(_0x7a42('0x5'));var auth=require(_0x7a42('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7a42('0x7'));var controller=require(_0x7a42('0x8'));router[_0x7a42('0x9')]('/',auth[_0x7a42('0xa')](),controller[_0x7a42('0xb')]);router[_0x7a42('0x9')](_0x7a42('0xc'),auth[_0x7a42('0xa')](),controller[_0x7a42('0xd')]);router[_0x7a42('0x9')](_0x7a42('0xe'),auth[_0x7a42('0xa')](),timeout(_0x7a42('0xf')),controller[_0x7a42('0x10')]);router[_0x7a42('0x11')]('/',auth[_0x7a42('0xa')](),controller[_0x7a42('0x12')]);router[_0x7a42('0x13')](_0x7a42('0xc'),auth[_0x7a42('0xa')](),controller[_0x7a42('0x14')]);router[_0x7a42('0x15')](_0x7a42('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 93b7437..b70e73a 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 _0x3537=['sequelize','exports','STRING','name'];(function(_0x4bcd02,_0x401b12){var _0x4696eb=function(_0x35a989){while(--_0x35a989){_0x4bcd02['push'](_0x4bcd02['shift']());}};_0x4696eb(++_0x401b12);}(_0x3537,0x1a0));var _0x7353=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0x3537[_0x383356];return _0x32ee5a;};'use strict';var Sequelize=require(_0x7353('0x0'));module[_0x7353('0x1')]={'name':{'type':Sequelize[_0x7353('0x2')],'unique':_0x7353('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x7353('0x2')]},'description':{'type':Sequelize[_0x7353('0x2')]}}; \ No newline at end of file +var _0x91bd=['sequelize','STRING','name'];(function(_0x2e3545,_0x20a6ec){var _0xcf18f=function(_0x3c85dd){while(--_0x3c85dd){_0x2e3545['push'](_0x2e3545['shift']());}};_0xcf18f(++_0x20a6ec);}(_0x91bd,0x1aa));var _0xd91b=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0x91bd[_0x46efd7];return _0x5637e4;};'use strict';var Sequelize=require(_0xd91b('0x0'));module['exports']={'name':{'type':Sequelize[_0xd91b('0x1')],'unique':_0xd91b('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xd91b('0x1')]},'description':{'type':Sequelize[_0xd91b('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index aa16241..2e38a7f 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 _0xafdf=['request-promise','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ODBC','UserProfileResource','stack','name','send','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','pick','merge','where','filter','options','includeAll','include','findAll','rows','catch','show','keys','fields','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','odbc','openSync','closeSync','html-pdf','eml-format','zip-dir'];(function(_0x5471a6,_0x2b2fcf){var _0x37ec6b=function(_0x28da3e){while(--_0x28da3e){_0x5471a6['push'](_0x5471a6['shift']());}};_0x37ec6b(++_0x2b2fcf);}(_0xafdf,0xf6));var _0xfafd=function(_0x5848c,_0x244403){_0x5848c=_0x5848c-0x0;var _0x59482c=_0xafdf[_0x5848c];return _0x59482c;};'use strict';var pdf=require(_0xfafd('0x0'));var emlformat=require(_0xfafd('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfafd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfafd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfafd('0x4'));var util=require(_0xfafd('0x5'));var path=require(_0xfafd('0x6'));var sox=require(_0xfafd('0x7'));var csv=require(_0xfafd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfafd('0x9'));var crypto=require(_0xfafd('0xa'));var jsforce=require(_0xfafd('0xb'));var deskjs=require(_0xfafd('0xc'));var toCsv=require(_0xfafd('0x8'));var querystring=require(_0xfafd('0xd'));var Papa=require(_0xfafd('0xe'));var Redis=require(_0xfafd('0xf'));var authService=require(_0xfafd('0x10'));var qs=require(_0xfafd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfafd('0x12'));var logger=require('../../config/logger')(_0xfafd('0x13'));var utils=require(_0xfafd('0x14'));var config=require(_0xfafd('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xfafd('0x16'))['db'];function respondWithStatusCode(_0x4fe860,_0x26b9fe){_0x26b9fe=_0x26b9fe||0xcc;return function(_0x9a70c7){if(_0x9a70c7){return _0x4fe860[_0xfafd('0x17')](_0x26b9fe);}return _0x4fe860[_0xfafd('0x18')](_0x26b9fe)[_0xfafd('0x19')]();};}function respondWithResult(_0x36e405,_0x1c5892){_0x1c5892=_0x1c5892||0xc8;return function(_0x3a7a58){if(_0x3a7a58){return _0x36e405['status'](_0x1c5892)[_0xfafd('0x1a')](_0x3a7a58);}};}function respondWithFilteredResult(_0x5b1a29,_0x49ac48){return function(_0x39dd1e){if(_0x39dd1e){var _0x441062=_0x39dd1e[_0xfafd('0x1b')],_0x188b7d=_0x49ac48[_0xfafd('0x1c')],_0x4673e7=_0x49ac48['offset']+_0x49ac48[_0xfafd('0x1d')],_0x397a00;if(_0x4673e7>=_0x441062){_0x4673e7=_0x441062;_0x397a00=0xc8;}else{_0x397a00=0xce;}_0x5b1a29[_0xfafd('0x18')](_0x397a00);return _0x5b1a29[_0xfafd('0x1e')](_0xfafd('0x1f'),_0x188b7d+'-'+_0x4673e7+'/'+_0x441062)[_0xfafd('0x1a')](_0x39dd1e);}return null;};}function patchUpdates(_0x2622c1){return function(_0xfa7f21){try{jsonpatch[_0xfafd('0x20')](_0xfa7f21,_0x2622c1,!![]);}catch(_0x4a4fd8){return BPromise[_0xfafd('0x21')](_0x4a4fd8);}return _0xfa7f21[_0xfafd('0x22')]();};}function saveUpdates(_0x1bfa7a,_0x352879){return function(_0x300651){if(_0x300651){return _0x300651[_0xfafd('0x23')](_0x1bfa7a)[_0xfafd('0x24')](function(_0x18720d){return _0x18720d;});}return null;};}function removeEntity(_0x160bcd,_0x54a995){return function(_0x5d21ae){if(_0x5d21ae){return _0x5d21ae[_0xfafd('0x25')]()[_0xfafd('0x24')](function(){var _0x4fb912=_0x5d21ae[_0xfafd('0x26')]({'plain':!![]});var _0xfeb5ef=_0xfafd('0x27');return db[_0xfafd('0x28')][_0xfafd('0x25')]({'where':{'type':_0xfeb5ef,'resourceId':_0x4fb912['id']}})[_0xfafd('0x24')](function(){return _0x5d21ae;});})[_0xfafd('0x24')](function(){_0x160bcd[_0xfafd('0x18')](0xcc)[_0xfafd('0x19')]();});}};}function handleEntityNotFound(_0x13fa3e,_0x2726f3){return function(_0x44f0b5){if(!_0x44f0b5){_0x13fa3e[_0xfafd('0x17')](0x194);}return _0x44f0b5;};}function handleError(_0x5f0d69,_0x216372){_0x216372=_0x216372||0x1f4;return function(_0x54a077){logger['error'](_0x54a077[_0xfafd('0x29')]);if(_0x54a077[_0xfafd('0x2a')]){delete _0x54a077[_0xfafd('0x2a')];}_0x5f0d69[_0xfafd('0x18')](_0x216372)[_0xfafd('0x2b')](_0x54a077);};}exports['index']=function(_0x40af0a,_0x3a4ede){var _0x5229bd={},_0x284e94={},_0x21560d={'count':0x0,'rows':[]};var _0x45e9f9=_[_0xfafd('0x2c')](db[_0xfafd('0x2d')][_0xfafd('0x2e')],function(_0x50c38e){return{'name':_0x50c38e[_0xfafd('0x2f')],'type':_0x50c38e[_0xfafd('0x30')][_0xfafd('0x31')]};});_0x284e94[_0xfafd('0x32')]=_[_0xfafd('0x2c')](_0x45e9f9,_0xfafd('0x2a'));_0x284e94['query']=_['keys'](_0x40af0a[_0xfafd('0x33')]);_0x284e94[_0xfafd('0x34')]=_['intersection'](_0x284e94['model'],_0x284e94[_0xfafd('0x33')]);_0x5229bd[_0xfafd('0x35')]=_[_0xfafd('0x36')](_0x284e94[_0xfafd('0x32')],qs['fields'](_0x40af0a[_0xfafd('0x33')]['fields']));_0x5229bd[_0xfafd('0x35')]=_0x5229bd['attributes']['length']?_0x5229bd['attributes']:_0x284e94['model'];if(!_0x40af0a[_0xfafd('0x33')][_0xfafd('0x37')](_0xfafd('0x38'))){_0x5229bd[_0xfafd('0x1d')]=qs['limit'](_0x40af0a[_0xfafd('0x33')][_0xfafd('0x1d')]);_0x5229bd[_0xfafd('0x1c')]=qs[_0xfafd('0x1c')](_0x40af0a[_0xfafd('0x33')][_0xfafd('0x1c')]);}_0x5229bd[_0xfafd('0x39')]=qs['sort'](_0x40af0a[_0xfafd('0x33')][_0xfafd('0x3a')]);_0x5229bd['where']=qs[_0xfafd('0x34')](_[_0xfafd('0x3b')](_0x40af0a['query'],_0x284e94[_0xfafd('0x34')]),_0x45e9f9);if(_0x40af0a['query']['filter']){_0x5229bd['where']=_[_0xfafd('0x3c')](_0x5229bd[_0xfafd('0x3d')],{'$or':_[_0xfafd('0x2c')](_0x45e9f9,function(_0x855d32){if(_0x855d32[_0xfafd('0x30')]!=='VIRTUAL'){var _0x284c2a={};_0x284c2a[_0x855d32[_0xfafd('0x2a')]]={'$like':'%'+_0x40af0a['query'][_0xfafd('0x3e')]+'%'};return _0x284c2a;}})});}_0x5229bd=_['merge']({},_0x5229bd,_0x40af0a[_0xfafd('0x3f')]);var _0x5659a8={'where':_0x5229bd[_0xfafd('0x3d')]};return db['SquareOdbc']['count'](_0x5659a8)[_0xfafd('0x24')](function(_0x1d854c){_0x21560d[_0xfafd('0x1b')]=_0x1d854c;if(_0x40af0a[_0xfafd('0x33')][_0xfafd('0x40')]){_0x5229bd[_0xfafd('0x41')]=[{'all':!![]}];}return db['SquareOdbc'][_0xfafd('0x42')](_0x5229bd);})[_0xfafd('0x24')](function(_0x46dfb7){_0x21560d[_0xfafd('0x43')]=_0x46dfb7;return _0x21560d;})['then'](respondWithFilteredResult(_0x3a4ede,_0x5229bd))[_0xfafd('0x44')](handleError(_0x3a4ede,null));};exports[_0xfafd('0x45')]=function(_0x4d16b0,_0x134dd8){var _0x55641a={'raw':!![],'where':{'id':_0x4d16b0['params']['id']}},_0x218577={};_0x218577['model']=_[_0xfafd('0x46')](db[_0xfafd('0x2d')][_0xfafd('0x2e')]);_0x218577['query']=_[_0xfafd('0x46')](_0x4d16b0[_0xfafd('0x33')]);_0x218577[_0xfafd('0x34')]=_['intersection'](_0x218577['model'],_0x218577[_0xfafd('0x33')]);_0x55641a['attributes']=_[_0xfafd('0x36')](_0x218577['model'],qs[_0xfafd('0x47')](_0x4d16b0[_0xfafd('0x33')]['fields']));_0x55641a[_0xfafd('0x35')]=_0x55641a['attributes']['length']?_0x55641a[_0xfafd('0x35')]:_0x218577[_0xfafd('0x32')];if(_0x4d16b0[_0xfafd('0x33')][_0xfafd('0x40')]){_0x55641a[_0xfafd('0x41')]=[{'all':!![]}];}_0x55641a=_[_0xfafd('0x3c')]({},_0x55641a,_0x4d16b0[_0xfafd('0x3f')]);return db['SquareOdbc'][_0xfafd('0x48')](_0x55641a)[_0xfafd('0x24')](handleEntityNotFound(_0x134dd8,null))[_0xfafd('0x24')](respondWithResult(_0x134dd8,null))[_0xfafd('0x44')](handleError(_0x134dd8,null));};exports['create']=function(_0x19ef78,_0x1f7830){return db[_0xfafd('0x2d')]['create'](_0x19ef78[_0xfafd('0x49')],{})['then'](function(_0x314256){var _0xb1120=_0x19ef78[_0xfafd('0x4a')][_0xfafd('0x26')]({'plain':!![]});if(!_0xb1120)throw new Error(_0xfafd('0x4b'));if(_0xb1120['role']===_0xfafd('0x4a')){var _0x42514e=_0x314256[_0xfafd('0x26')]({'plain':!![]});var _0x54ce9c=_0xfafd('0x27');return db['UserProfileSection'][_0xfafd('0x48')]({'where':{'name':_0x54ce9c,'userProfileId':_0xb1120['userProfileId']},'raw':!![]})[_0xfafd('0x24')](function(_0x254e43){if(_0x254e43&&_0x254e43['autoAssociation']===0x0){return db[_0xfafd('0x28')]['create']({'name':_0x42514e[_0xfafd('0x2a')],'resourceId':_0x42514e['id'],'type':_0x254e43[_0xfafd('0x2a')],'sectionId':_0x254e43['id']},{})[_0xfafd('0x24')](function(){return _0x314256;});}else{return _0x314256;}})['catch'](function(_0x59245e){logger['error'](_0xfafd('0x4c'),_0x59245e);throw _0x59245e;});}return _0x314256;})[_0xfafd('0x24')](respondWithResult(_0x1f7830,0xc9))[_0xfafd('0x44')](handleError(_0x1f7830,null));};exports[_0xfafd('0x23')]=function(_0x4d6da9,_0x342c5c){if(_0x4d6da9[_0xfafd('0x49')]['id']){delete _0x4d6da9[_0xfafd('0x49')]['id'];}return db[_0xfafd('0x2d')]['find']({'where':{'id':_0x4d6da9[_0xfafd('0x4d')]['id']}})['then'](handleEntityNotFound(_0x342c5c,null))[_0xfafd('0x24')](saveUpdates(_0x4d6da9[_0xfafd('0x49')],null))[_0xfafd('0x24')](respondWithResult(_0x342c5c,null))[_0xfafd('0x44')](handleError(_0x342c5c,null));};exports[_0xfafd('0x25')]=function(_0x4b0985,_0x25ba86){return db[_0xfafd('0x2d')]['find']({'where':{'id':_0x4b0985['params']['id']}})['then'](handleEntityNotFound(_0x25ba86,null))['then'](removeEntity(_0x25ba86,null))[_0xfafd('0x44')](handleError(_0x25ba86,null));};exports[_0xfafd('0x4e')]=function(_0x2509d7,_0x2b1069,_0x6dee8){var _0x19ed68;return db[_0xfafd('0x2d')][_0xfafd('0x48')]({'where':{'id':_0x2509d7[_0xfafd('0x4d')]['id']},'attributes':['id',_0xfafd('0x4f')]})[_0xfafd('0x24')](handleEntityNotFound(_0x2b1069,null))['then'](function(_0x568e7b){if(_0x568e7b){var _0x4c97f1=require(_0xfafd('0x50'))();_0x4c97f1[_0xfafd('0x51')](_0x568e7b['dsn']);_0x4c97f1[_0xfafd('0x52')]();return _0x568e7b;}})[_0xfafd('0x24')](respondWithResult(_0x2b1069,null))[_0xfafd('0x44')](handleError(_0x2b1069,null));}; \ No newline at end of file +var _0xf70a=['index','map','SquareOdbc','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','catch','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','params','test','odbc','openSync','dsn','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','ODBC','UserProfileResource','error','stack','name'];(function(_0x5deca1,_0x27eb11){var _0x2e945b=function(_0x3822ea){while(--_0x3822ea){_0x5deca1['push'](_0x5deca1['shift']());}};_0x2e945b(++_0x27eb11);}(_0xf70a,0x18f));var _0xaf70=function(_0x305117,_0x289f1a){_0x305117=_0x305117-0x0;var _0x184cb7=_0xf70a[_0x305117];return _0x184cb7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xaf70('0x0'));var rimraf=require(_0xaf70('0x1'));var zipdir=require(_0xaf70('0x2'));var jsonpatch=require(_0xaf70('0x3'));var rp=require(_0xaf70('0x4'));var moment=require(_0xaf70('0x5'));var BPromise=require(_0xaf70('0x6'));var Mustache=require(_0xaf70('0x7'));var util=require(_0xaf70('0x8'));var path=require(_0xaf70('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaf70('0xa'));var fs=require('fs');var fs_extra=require(_0xaf70('0xb'));var _=require(_0xaf70('0xc'));var squel=require(_0xaf70('0xd'));var crypto=require(_0xaf70('0xe'));var jsforce=require(_0xaf70('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xaf70('0x10'));var querystring=require(_0xaf70('0x11'));var Papa=require(_0xaf70('0x12'));var Redis=require('ioredis');var authService=require(_0xaf70('0x13'));var qs=require(_0xaf70('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf70('0x15'))(_0xaf70('0x16'));var utils=require(_0xaf70('0x17'));var config=require(_0xaf70('0x18'));var licenseUtil=require(_0xaf70('0x19'));var db=require(_0xaf70('0x1a'))['db'];function respondWithStatusCode(_0x3bd683,_0x463dc0){_0x463dc0=_0x463dc0||0xcc;return function(_0x4646c5){if(_0x4646c5){return _0x3bd683[_0xaf70('0x1b')](_0x463dc0);}return _0x3bd683['status'](_0x463dc0)[_0xaf70('0x1c')]();};}function respondWithResult(_0xc13f30,_0x19f5c4){_0x19f5c4=_0x19f5c4||0xc8;return function(_0x5b699a){if(_0x5b699a){return _0xc13f30[_0xaf70('0x1d')](_0x19f5c4)[_0xaf70('0x1e')](_0x5b699a);}};}function respondWithFilteredResult(_0x44c946,_0x236476){return function(_0x90640c){if(_0x90640c){var _0x2f85ff=_0x90640c[_0xaf70('0x1f')],_0x3357b9=_0x236476[_0xaf70('0x20')],_0x2ba41b=_0x236476[_0xaf70('0x20')]+_0x236476['limit'],_0x4a5b14;if(_0x2ba41b>=_0x2f85ff){_0x2ba41b=_0x2f85ff;_0x4a5b14=0xc8;}else{_0x4a5b14=0xce;}_0x44c946[_0xaf70('0x1d')](_0x4a5b14);return _0x44c946[_0xaf70('0x21')](_0xaf70('0x22'),_0x3357b9+'-'+_0x2ba41b+'/'+_0x2f85ff)[_0xaf70('0x1e')](_0x90640c);}return null;};}function patchUpdates(_0x613f2f){return function(_0x67c838){try{jsonpatch[_0xaf70('0x23')](_0x67c838,_0x613f2f,!![]);}catch(_0x795c8a){return BPromise[_0xaf70('0x24')](_0x795c8a);}return _0x67c838['save']();};}function saveUpdates(_0x2fbb60,_0x5d53fd){return function(_0x1abe87){if(_0x1abe87){return _0x1abe87[_0xaf70('0x25')](_0x2fbb60)[_0xaf70('0x26')](function(_0x30b3f1){return _0x30b3f1;});}return null;};}function removeEntity(_0x296f79,_0x7c903){return function(_0x2efd5d){if(_0x2efd5d){return _0x2efd5d[_0xaf70('0x27')]()['then'](function(){var _0x37068e=_0x2efd5d[_0xaf70('0x28')]({'plain':!![]});var _0x4706b7=_0xaf70('0x29');return db[_0xaf70('0x2a')]['destroy']({'where':{'type':_0x4706b7,'resourceId':_0x37068e['id']}})[_0xaf70('0x26')](function(){return _0x2efd5d;});})[_0xaf70('0x26')](function(){_0x296f79[_0xaf70('0x1d')](0xcc)[_0xaf70('0x1c')]();});}};}function handleEntityNotFound(_0x1f2140,_0x503799){return function(_0x37d092){if(!_0x37d092){_0x1f2140[_0xaf70('0x1b')](0x194);}return _0x37d092;};}function handleError(_0x134e58,_0x1acb57){_0x1acb57=_0x1acb57||0x1f4;return function(_0x5ac7ed){logger[_0xaf70('0x2b')](_0x5ac7ed[_0xaf70('0x2c')]);if(_0x5ac7ed[_0xaf70('0x2d')]){delete _0x5ac7ed[_0xaf70('0x2d')];}_0x134e58[_0xaf70('0x1d')](_0x1acb57)['send'](_0x5ac7ed);};}exports[_0xaf70('0x2e')]=function(_0x2c2fe8,_0x52ce61){var _0x2f196e={},_0x586702={},_0x648f96={'count':0x0,'rows':[]};var _0x558281=_[_0xaf70('0x2f')](db[_0xaf70('0x30')][_0xaf70('0x31')],function(_0xbdabff){return{'name':_0xbdabff[_0xaf70('0x32')],'type':_0xbdabff['type'][_0xaf70('0x33')]};});_0x586702[_0xaf70('0x34')]=_[_0xaf70('0x2f')](_0x558281,_0xaf70('0x2d'));_0x586702[_0xaf70('0x35')]=_[_0xaf70('0x36')](_0x2c2fe8[_0xaf70('0x35')]);_0x586702[_0xaf70('0x37')]=_[_0xaf70('0x38')](_0x586702[_0xaf70('0x34')],_0x586702[_0xaf70('0x35')]);_0x2f196e['attributes']=_[_0xaf70('0x38')](_0x586702[_0xaf70('0x34')],qs[_0xaf70('0x39')](_0x2c2fe8[_0xaf70('0x35')][_0xaf70('0x39')]));_0x2f196e[_0xaf70('0x3a')]=_0x2f196e['attributes'][_0xaf70('0x3b')]?_0x2f196e['attributes']:_0x586702[_0xaf70('0x34')];if(!_0x2c2fe8[_0xaf70('0x35')][_0xaf70('0x3c')](_0xaf70('0x3d'))){_0x2f196e[_0xaf70('0x3e')]=qs['limit'](_0x2c2fe8[_0xaf70('0x35')][_0xaf70('0x3e')]);_0x2f196e[_0xaf70('0x20')]=qs[_0xaf70('0x20')](_0x2c2fe8[_0xaf70('0x35')]['offset']);}_0x2f196e[_0xaf70('0x3f')]=qs[_0xaf70('0x40')](_0x2c2fe8[_0xaf70('0x35')][_0xaf70('0x40')]);_0x2f196e[_0xaf70('0x41')]=qs['filters'](_[_0xaf70('0x42')](_0x2c2fe8[_0xaf70('0x35')],_0x586702[_0xaf70('0x37')]),_0x558281);if(_0x2c2fe8[_0xaf70('0x35')][_0xaf70('0x43')]){_0x2f196e[_0xaf70('0x41')]=_['merge'](_0x2f196e['where'],{'$or':_[_0xaf70('0x2f')](_0x558281,function(_0x1f6d44){if(_0x1f6d44[_0xaf70('0x44')]!=='VIRTUAL'){var _0x37627d={};_0x37627d[_0x1f6d44[_0xaf70('0x2d')]]={'$like':'%'+_0x2c2fe8['query']['filter']+'%'};return _0x37627d;}})});}_0x2f196e=_[_0xaf70('0x45')]({},_0x2f196e,_0x2c2fe8[_0xaf70('0x46')]);var _0x4ecabc={'where':_0x2f196e['where']};return db['SquareOdbc']['count'](_0x4ecabc)[_0xaf70('0x26')](function(_0xa9cd97){_0x648f96[_0xaf70('0x1f')]=_0xa9cd97;if(_0x2c2fe8[_0xaf70('0x35')][_0xaf70('0x47')]){_0x2f196e[_0xaf70('0x48')]=[{'all':!![]}];}return db[_0xaf70('0x30')][_0xaf70('0x49')](_0x2f196e);})['then'](function(_0x215b7d){_0x648f96['rows']=_0x215b7d;return _0x648f96;})[_0xaf70('0x26')](respondWithFilteredResult(_0x52ce61,_0x2f196e))[_0xaf70('0x4a')](handleError(_0x52ce61,null));};exports[_0xaf70('0x4b')]=function(_0x41edfe,_0x49b46f){var _0x1d32d2={'raw':!![],'where':{'id':_0x41edfe['params']['id']}},_0x4df44d={};_0x4df44d[_0xaf70('0x34')]=_[_0xaf70('0x36')](db[_0xaf70('0x30')][_0xaf70('0x31')]);_0x4df44d[_0xaf70('0x35')]=_['keys'](_0x41edfe[_0xaf70('0x35')]);_0x4df44d['filters']=_[_0xaf70('0x38')](_0x4df44d[_0xaf70('0x34')],_0x4df44d['query']);_0x1d32d2[_0xaf70('0x3a')]=_[_0xaf70('0x38')](_0x4df44d[_0xaf70('0x34')],qs['fields'](_0x41edfe['query'][_0xaf70('0x39')]));_0x1d32d2['attributes']=_0x1d32d2[_0xaf70('0x3a')][_0xaf70('0x3b')]?_0x1d32d2[_0xaf70('0x3a')]:_0x4df44d[_0xaf70('0x34')];if(_0x41edfe['query'][_0xaf70('0x47')]){_0x1d32d2[_0xaf70('0x48')]=[{'all':!![]}];}_0x1d32d2=_[_0xaf70('0x45')]({},_0x1d32d2,_0x41edfe['options']);return db[_0xaf70('0x30')][_0xaf70('0x4c')](_0x1d32d2)[_0xaf70('0x26')](handleEntityNotFound(_0x49b46f,null))[_0xaf70('0x26')](respondWithResult(_0x49b46f,null))[_0xaf70('0x4a')](handleError(_0x49b46f,null));};exports[_0xaf70('0x4d')]=function(_0x5ba0f2,_0x416315){return db[_0xaf70('0x30')]['create'](_0x5ba0f2[_0xaf70('0x4e')],{})['then'](function(_0x57fb16){var _0x2f2759=_0x5ba0f2['user']['get']({'plain':!![]});if(!_0x2f2759)throw new Error(_0xaf70('0x4f'));if(_0x2f2759[_0xaf70('0x50')]==='user'){var _0xcd5826=_0x57fb16[_0xaf70('0x28')]({'plain':!![]});var _0x2a2a1a=_0xaf70('0x29');return db[_0xaf70('0x51')][_0xaf70('0x4c')]({'where':{'name':_0x2a2a1a,'userProfileId':_0x2f2759[_0xaf70('0x52')]},'raw':!![]})[_0xaf70('0x26')](function(_0x24394f){if(_0x24394f&&_0x24394f['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xcd5826[_0xaf70('0x2d')],'resourceId':_0xcd5826['id'],'type':_0x24394f['name'],'sectionId':_0x24394f['id']},{})[_0xaf70('0x26')](function(){return _0x57fb16;});}else{return _0x57fb16;}})[_0xaf70('0x4a')](function(_0x4be25f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4be25f);throw _0x4be25f;});}return _0x57fb16;})[_0xaf70('0x26')](respondWithResult(_0x416315,0xc9))[_0xaf70('0x4a')](handleError(_0x416315,null));};exports['update']=function(_0xf4a77f,_0x2e27de){if(_0xf4a77f['body']['id']){delete _0xf4a77f['body']['id'];}return db[_0xaf70('0x30')]['find']({'where':{'id':_0xf4a77f[_0xaf70('0x53')]['id']}})[_0xaf70('0x26')](handleEntityNotFound(_0x2e27de,null))['then'](saveUpdates(_0xf4a77f[_0xaf70('0x4e')],null))[_0xaf70('0x26')](respondWithResult(_0x2e27de,null))['catch'](handleError(_0x2e27de,null));};exports[_0xaf70('0x27')]=function(_0xe441f4,_0x21f7b0){return db['SquareOdbc']['find']({'where':{'id':_0xe441f4[_0xaf70('0x53')]['id']}})[_0xaf70('0x26')](handleEntityNotFound(_0x21f7b0,null))['then'](removeEntity(_0x21f7b0,null))[_0xaf70('0x4a')](handleError(_0x21f7b0,null));};exports[_0xaf70('0x54')]=function(_0x2f5678,_0x2ea5b1,_0x1e5456){var _0x21d27c;return db['SquareOdbc'][_0xaf70('0x4c')]({'where':{'id':_0x2f5678[_0xaf70('0x53')]['id']},'attributes':['id','dsn']})[_0xaf70('0x26')](handleEntityNotFound(_0x2ea5b1,null))[_0xaf70('0x26')](function(_0x5549e4){if(_0x5549e4){var _0x3d26c2=require(_0xaf70('0x55'))();_0x3d26c2[_0xaf70('0x56')](_0x5549e4[_0xaf70('0x57')]);_0x3d26c2[_0xaf70('0x58')]();return _0x5549e4;}})[_0xaf70('0x26')](respondWithResult(_0x2ea5b1,null))['catch'](handleError(_0x2ea5b1,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 6327c37..73d7844 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 _0xf787=['util','request-promise','path','../../config/environment','exports','define','SquareOdbc'];(function(_0x2bff77,_0xae3d76){var _0x479003=function(_0x318bf6){while(--_0x318bf6){_0x2bff77['push'](_0x2bff77['shift']());}};_0x479003(++_0xae3d76);}(_0xf787,0x17a));var _0x7f78=function(_0x50754a,_0x35cc9a){_0x50754a=_0x50754a-0x0;var _0x13f5b3=_0xf787[_0x50754a];return _0x13f5b3;};'use strict';var _=require('lodash');var util=require(_0x7f78('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7f78('0x1'));var fs=require('fs');var path=require(_0x7f78('0x2'));var rimraf=require('rimraf');var config=require(_0x7f78('0x3'));var attributes=require('./squareOdbc.attributes');module[_0x7f78('0x4')]=function(_0x4e1414,_0x2d9414){return _0x4e1414[_0x7f78('0x5')](_0x7f78('0x6'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9749=['SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','define'];(function(_0x1fae76,_0x2d852d){var _0x5e5bf1=function(_0x6d40ca){while(--_0x6d40ca){_0x1fae76['push'](_0x1fae76['shift']());}};_0x5e5bf1(++_0x2d852d);}(_0x9749,0xde));var _0x9974=function(_0x5cc89b,_0x21cae4){_0x5cc89b=_0x5cc89b-0x0;var _0x19b93d=_0x9749[_0x5cc89b];return _0x19b93d;};'use strict';var _=require(_0x9974('0x0'));var util=require(_0x9974('0x1'));var logger=require(_0x9974('0x2'))(_0x9974('0x3'));var moment=require(_0x9974('0x4'));var BPromise=require('bluebird');var rp=require(_0x9974('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9974('0x6'));var config=require(_0x9974('0x7'));var attributes=require('./squareOdbc.attributes');module['exports']=function(_0x24fba0,_0xa1e04d){return _0x24fba0[_0x9974('0x8')](_0x9974('0x9'),attributes,{'tableName':_0x9974('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index d4be172..5c04a64 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 _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x32de8c,_0x2bfb6d){var _0x3f8c0d=function(_0x2b218d){while(--_0x2b218d){_0x32de8c['push'](_0x32de8c['shift']());}};_0x3f8c0d(++_0x2bfb6d);}(_0xe14b,0x93));var _0xbe14=function(_0x3dba06,_0x2bdbc2){_0x3dba06=_0x3dba06-0x0;var _0x376d9f=_0xe14b[_0x3dba06];return _0x376d9f;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file +var _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','SquareOdbc,\x20%s,\x20%s','result','catch','ShowSquareOdbc','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x51fd25,_0x2fcbb){var _0x4529ae=function(_0x17ed81){while(--_0x17ed81){_0x51fd25['push'](_0x51fd25['shift']());}};_0x4529ae(++_0x2fcbb);}(_0x5fc3,0xa8));var _0x35fc=function(_0x255ac0,_0x3f6645){_0x255ac0=_0x255ac0-0x0;var _0x437bf1=_0x5fc3[_0x255ac0];return _0x437bf1;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['SquareOdbc'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 6042c70..3b8616f 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 _0xb730=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','create','update','delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x5d1708,_0x365d80){var _0x1d7b6b=function(_0x212fe0){while(--_0x212fe0){_0x5d1708['push'](_0x5d1708['shift']());}};_0x1d7b6b(++_0x365d80);}(_0xb730,0x17f));var _0x0b73=function(_0x2c3a92,_0x236f79){_0x2c3a92=_0x2c3a92-0x0;var _0x268f2c=_0xb730[_0x2c3a92];return _0x268f2c;};'use strict';var multer=require(_0x0b73('0x0'));var util=require(_0x0b73('0x1'));var path=require(_0x0b73('0x2'));var timeout=require(_0x0b73('0x3'));var express=require(_0x0b73('0x4'));var router=express[_0x0b73('0x5')]();var fs_extra=require(_0x0b73('0x6'));var auth=require(_0x0b73('0x7'));var interaction=require(_0x0b73('0x8'));var config=require(_0x0b73('0x9'));var controller=require('./squareProject.controller');router[_0x0b73('0xa')]('/',auth[_0x0b73('0xb')](),controller[_0x0b73('0xc')]);router[_0x0b73('0xa')](_0x0b73('0xd'),auth[_0x0b73('0xb')](),controller[_0x0b73('0xe')]);router[_0x0b73('0xa')](_0x0b73('0xf'),auth[_0x0b73('0xb')](),controller[_0x0b73('0x10')]);router['post']('/',auth[_0x0b73('0xb')](),controller[_0x0b73('0x11')]);router['post'](_0x0b73('0xf'),auth[_0x0b73('0xb')](),controller['addUsers']);router['put'](_0x0b73('0xd'),auth[_0x0b73('0xb')](),controller[_0x0b73('0x12')]);router[_0x0b73('0x13')]('/:id',auth[_0x0b73('0xb')](),controller[_0x0b73('0x14')]);router[_0x0b73('0x13')](_0x0b73('0xf'),auth[_0x0b73('0xb')](),controller[_0x0b73('0x15')]);module[_0x0b73('0x16')]=router; \ No newline at end of file +var _0xc8c2=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','getUsers','post','create','/:id/users','addUsers','put','update','delete','removeUsers','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x390143,_0x2b54ac){var _0x11361b=function(_0x3666c3){while(--_0x3666c3){_0x390143['push'](_0x390143['shift']());}};_0x11361b(++_0x2b54ac);}(_0xc8c2,0xf4));var _0x2c8c=function(_0x5787fa,_0x2073d7){_0x5787fa=_0x5787fa-0x0;var _0x424173=_0xc8c2[_0x5787fa];return _0x424173;};'use strict';var multer=require(_0x2c8c('0x0'));var util=require(_0x2c8c('0x1'));var path=require(_0x2c8c('0x2'));var timeout=require(_0x2c8c('0x3'));var express=require(_0x2c8c('0x4'));var router=express['Router']();var fs_extra=require(_0x2c8c('0x5'));var auth=require(_0x2c8c('0x6'));var interaction=require(_0x2c8c('0x7'));var config=require(_0x2c8c('0x8'));var controller=require(_0x2c8c('0x9'));router[_0x2c8c('0xa')]('/',auth[_0x2c8c('0xb')](),controller[_0x2c8c('0xc')]);router['get'](_0x2c8c('0xd'),auth[_0x2c8c('0xb')](),controller[_0x2c8c('0xe')]);router[_0x2c8c('0xa')]('/:id/users',auth[_0x2c8c('0xb')](),controller[_0x2c8c('0xf')]);router[_0x2c8c('0x10')]('/',auth[_0x2c8c('0xb')](),controller[_0x2c8c('0x11')]);router[_0x2c8c('0x10')](_0x2c8c('0x12'),auth[_0x2c8c('0xb')](),controller[_0x2c8c('0x13')]);router[_0x2c8c('0x14')](_0x2c8c('0xd'),auth['isAuthenticated'](),controller[_0x2c8c('0x15')]);router[_0x2c8c('0x16')](_0x2c8c('0xd'),auth[_0x2c8c('0xb')](),controller['destroy']);router[_0x2c8c('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0x2c8c('0x17')]);module[_0x2c8c('0x18')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index ff6dec5..bb09c76 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 _0x6a6e=['long','getDataValue','preproduction','toString','utf8','production','DATE','exports','STRING','name','TEXT','BLOB'];(function(_0x3431fb,_0x8bf9e1){var _0x9c6a02=function(_0xf096d0){while(--_0xf096d0){_0x3431fb['push'](_0x3431fb['shift']());}};_0x9c6a02(++_0x8bf9e1);}(_0x6a6e,0xd3));var _0xe6a6=function(_0x52de9b,_0x19df61){_0x52de9b=_0x52de9b-0x0;var _0x1ad0c7=_0x6a6e[_0x52de9b];return _0x1ad0c7;};'use strict';var Sequelize=require('sequelize');module[_0xe6a6('0x0')]={'name':{'type':Sequelize[_0xe6a6('0x1')],'unique':_0xe6a6('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xe6a6('0x1')]},'notes':{'type':Sequelize[_0xe6a6('0x3')]},'preproduction':{'type':Sequelize[_0xe6a6('0x4')](_0xe6a6('0x5')),'get':function(){if(this[_0xe6a6('0x6')]('preproduction')){return this[_0xe6a6('0x6')](_0xe6a6('0x7'))[_0xe6a6('0x8')](_0xe6a6('0x9'));}}},'production':{'type':Sequelize[_0xe6a6('0x4')](_0xe6a6('0x5')),'get':function(){if(this[_0xe6a6('0x6')](_0xe6a6('0xa'))){return this[_0xe6a6('0x6')](_0xe6a6('0xa'))[_0xe6a6('0x8')](_0xe6a6('0x9'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xe6a6('0xb')]}}; \ No newline at end of file +var _0xe3da=['TEXT','BLOB','long','getDataValue','preproduction','utf8','production','DATE','sequelize','exports','name','STRING'];(function(_0x3aeb36,_0x312dc9){var _0xa2ef21=function(_0x50a46b){while(--_0x50a46b){_0x3aeb36['push'](_0x3aeb36['shift']());}};_0xa2ef21(++_0x312dc9);}(_0xe3da,0x1e8));var _0xae3d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe3da[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0xae3d('0x0'));module[_0xae3d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xae3d('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xae3d('0x3')]},'notes':{'type':Sequelize[_0xae3d('0x4')]},'preproduction':{'type':Sequelize[_0xae3d('0x5')](_0xae3d('0x6')),'get':function(){if(this[_0xae3d('0x7')](_0xae3d('0x8'))){return this['getDataValue'](_0xae3d('0x8'))['toString'](_0xae3d('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0xae3d('0x6')),'get':function(){if(this[_0xae3d('0x7')](_0xae3d('0xa'))){return this['getDataValue'](_0xae3d('0xa'))['toString'](_0xae3d('0x9'));}}},'savedAt':{'type':Sequelize[_0xae3d('0xb')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 97126f1..5d35099 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 _0x78e7=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','SquareProjects','UserProfileResource','error','stack','name','send','index','map','SquareProject','rawAttributes','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','params','keys','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','nolimit','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x14669b,_0x5f11da){var _0x238404=function(_0x1baace){while(--_0x1baace){_0x14669b['push'](_0x14669b['shift']());}};_0x238404(++_0x5f11da);}(_0x78e7,0x1d9));var _0x778e=function(_0xb2cec5,_0x2b0237){_0xb2cec5=_0xb2cec5-0x0;var _0x348efb=_0x78e7[_0xb2cec5];return _0x348efb;};'use strict';var pdf=require(_0x778e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x778e('0x1'));var zipdir=require(_0x778e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x778e('0x3'));var moment=require(_0x778e('0x4'));var BPromise=require(_0x778e('0x5'));var Mustache=require(_0x778e('0x6'));var util=require(_0x778e('0x7'));var path=require('path');var sox=require(_0x778e('0x8'));var csv=require(_0x778e('0x9'));var ejs=require(_0x778e('0xa'));var fs=require('fs');var fs_extra=require(_0x778e('0xb'));var _=require(_0x778e('0xc'));var squel=require('squel');var crypto=require(_0x778e('0xd'));var jsforce=require(_0x778e('0xe'));var deskjs=require(_0x778e('0xf'));var toCsv=require(_0x778e('0x9'));var querystring=require(_0x778e('0x10'));var Papa=require(_0x778e('0x11'));var Redis=require(_0x778e('0x12'));var authService=require(_0x778e('0x13'));var qs=require(_0x778e('0x14'));var as=require(_0x778e('0x15'));var hardwareService=require(_0x778e('0x16'));var logger=require(_0x778e('0x17'))(_0x778e('0x18'));var utils=require(_0x778e('0x19'));var config=require(_0x778e('0x1a'));var licenseUtil=require(_0x778e('0x1b'));var db=require(_0x778e('0x1c'))['db'];config[_0x778e('0x1d')]=_[_0x778e('0x1e')](config[_0x778e('0x1d')],{'host':_0x778e('0x1f'),'port':0x18eb});var socket=require(_0x778e('0x20'))(new Redis(config[_0x778e('0x1d')]));require(_0x778e('0x21'))[_0x778e('0x22')](socket);function respondWithStatusCode(_0x324a15,_0x30550c){_0x30550c=_0x30550c||0xcc;return function(_0x5b1884){if(_0x5b1884){return _0x324a15[_0x778e('0x23')](_0x30550c);}return _0x324a15[_0x778e('0x24')](_0x30550c)[_0x778e('0x25')]();};}function respondWithResult(_0x5c62bd,_0x426699){_0x426699=_0x426699||0xc8;return function(_0x5b4720){if(_0x5b4720){return _0x5c62bd[_0x778e('0x24')](_0x426699)[_0x778e('0x26')](_0x5b4720);}};}function respondWithFilteredResult(_0x368e8,_0x535114){return function(_0x3f35d8){if(_0x3f35d8){var _0x543da4=_0x3f35d8[_0x778e('0x27')],_0x45c19d=_0x535114[_0x778e('0x28')],_0x4f67ed=_0x535114[_0x778e('0x28')]+_0x535114[_0x778e('0x29')],_0x5494e2;if(_0x4f67ed>=_0x543da4){_0x4f67ed=_0x543da4;_0x5494e2=0xc8;}else{_0x5494e2=0xce;}_0x368e8[_0x778e('0x24')](_0x5494e2);return _0x368e8[_0x778e('0x2a')]('Content-Range',_0x45c19d+'-'+_0x4f67ed+'/'+_0x543da4)['json'](_0x3f35d8);}return null;};}function patchUpdates(_0x5ea8cc){return function(_0x2468fa){try{jsonpatch['apply'](_0x2468fa,_0x5ea8cc,!![]);}catch(_0x5a5d32){return BPromise[_0x778e('0x2b')](_0x5a5d32);}return _0x2468fa[_0x778e('0x2c')]();};}function saveUpdates(_0x12a309,_0x5b5265){return function(_0x12025c){if(_0x12025c){return _0x12025c[_0x778e('0x2d')](_0x12a309)[_0x778e('0x2e')](function(_0x2c8708){return _0x2c8708;});}return null;};}function removeEntity(_0x37ca23,_0x39d794){return function(_0x24e04b){if(_0x24e04b){return _0x24e04b[_0x778e('0x2f')]()[_0x778e('0x2e')](function(){var _0x4c4a5d=_0x24e04b['get']({'plain':!![]});var _0x4cb4e3=_0x778e('0x30');return db[_0x778e('0x31')][_0x778e('0x2f')]({'where':{'type':_0x4cb4e3,'resourceId':_0x4c4a5d['id']}})['then'](function(){return _0x24e04b;});})[_0x778e('0x2e')](function(){_0x37ca23[_0x778e('0x24')](0xcc)[_0x778e('0x25')]();});}};}function handleEntityNotFound(_0x10b3cb,_0x4a49eb){return function(_0x1d7f3c){if(!_0x1d7f3c){_0x10b3cb[_0x778e('0x23')](0x194);}return _0x1d7f3c;};}function handleError(_0x1acf27,_0x2b2b82){_0x2b2b82=_0x2b2b82||0x1f4;return function(_0x40cf78){logger[_0x778e('0x32')](_0x40cf78[_0x778e('0x33')]);if(_0x40cf78[_0x778e('0x34')]){delete _0x40cf78[_0x778e('0x34')];}_0x1acf27[_0x778e('0x24')](_0x2b2b82)[_0x778e('0x35')](_0x40cf78);};}exports[_0x778e('0x36')]=function(_0x94a883,_0x1c29ce){var _0x3e4276={},_0x4d8936={},_0x19e068={'count':0x0,'rows':[]};var _0x27c1fa=_[_0x778e('0x37')](db[_0x778e('0x38')][_0x778e('0x39')],function(_0x18e757){return{'name':_0x18e757['fieldName'],'type':_0x18e757['type']['key']};});_0x4d8936['model']=_[_0x778e('0x37')](_0x27c1fa,_0x778e('0x34'));_0x4d8936[_0x778e('0x3a')]=_['keys'](_0x94a883[_0x778e('0x3a')]);_0x4d8936[_0x778e('0x3b')]=_[_0x778e('0x3c')](_0x4d8936['model'],_0x4d8936[_0x778e('0x3a')]);_0x3e4276[_0x778e('0x3d')]=_[_0x778e('0x3c')](_0x4d8936[_0x778e('0x3e')],qs[_0x778e('0x3f')](_0x94a883[_0x778e('0x3a')][_0x778e('0x3f')]));_0x3e4276[_0x778e('0x3d')]=_0x3e4276['attributes'][_0x778e('0x40')]?_0x3e4276['attributes']:_0x4d8936['model'];if(!_0x94a883[_0x778e('0x3a')][_0x778e('0x41')]('nolimit')){_0x3e4276[_0x778e('0x29')]=qs[_0x778e('0x29')](_0x94a883[_0x778e('0x3a')][_0x778e('0x29')]);_0x3e4276[_0x778e('0x28')]=qs[_0x778e('0x28')](_0x94a883[_0x778e('0x3a')]['offset']);}_0x3e4276[_0x778e('0x42')]=qs[_0x778e('0x43')](_0x94a883[_0x778e('0x3a')]['sort']);_0x3e4276['where']=qs[_0x778e('0x3b')](_[_0x778e('0x44')](_0x94a883[_0x778e('0x3a')],_0x4d8936[_0x778e('0x3b')]),_0x27c1fa);if(_0x94a883['query'][_0x778e('0x45')]){_0x3e4276['where']=_[_0x778e('0x46')](_0x3e4276[_0x778e('0x47')],{'$or':_[_0x778e('0x37')](_0x27c1fa,function(_0x56dc6d){if(_0x56dc6d['type']!==_0x778e('0x48')){var _0x10d3d4={};_0x10d3d4[_0x56dc6d[_0x778e('0x34')]]={'$like':'%'+_0x94a883['query'][_0x778e('0x45')]+'%'};return _0x10d3d4;}})});}_0x3e4276=_['merge']({},_0x3e4276,_0x94a883['options']);var _0x1414c1={'where':_0x3e4276[_0x778e('0x47')]};return db[_0x778e('0x38')][_0x778e('0x27')](_0x1414c1)['then'](function(_0x478cfa){_0x19e068[_0x778e('0x27')]=_0x478cfa;if(_0x94a883[_0x778e('0x3a')][_0x778e('0x49')]){_0x3e4276[_0x778e('0x4a')]=[{'all':!![]}];}return db[_0x778e('0x38')][_0x778e('0x4b')](_0x3e4276);})[_0x778e('0x2e')](function(_0x351830){_0x19e068[_0x778e('0x4c')]=_0x351830;return _0x19e068;})[_0x778e('0x2e')](respondWithFilteredResult(_0x1c29ce,_0x3e4276))['catch'](handleError(_0x1c29ce,null));};exports['show']=function(_0x3a8203,_0x2f8648){var _0x5ce083={'raw':![],'where':{'id':_0x3a8203[_0x778e('0x4d')]['id']}},_0x542700={};_0x542700[_0x778e('0x3e')]=_['keys'](db[_0x778e('0x38')][_0x778e('0x39')]);_0x542700['query']=_[_0x778e('0x4e')](_0x3a8203[_0x778e('0x3a')]);_0x542700[_0x778e('0x3b')]=_[_0x778e('0x3c')](_0x542700[_0x778e('0x3e')],_0x542700[_0x778e('0x3a')]);_0x5ce083[_0x778e('0x3d')]=_['intersection'](_0x542700[_0x778e('0x3e')],qs['fields'](_0x3a8203[_0x778e('0x3a')][_0x778e('0x3f')]));_0x5ce083[_0x778e('0x3d')]=_0x5ce083['attributes'][_0x778e('0x40')]?_0x5ce083['attributes']:_0x542700['model'];if(_0x3a8203[_0x778e('0x3a')][_0x778e('0x49')]){_0x5ce083[_0x778e('0x4a')]=[{'all':!![]}];}_0x5ce083=_['merge']({},_0x5ce083,_0x3a8203[_0x778e('0x4f')]);return db['SquareProject'][_0x778e('0x50')](_0x5ce083)['then'](handleEntityNotFound(_0x2f8648,null))[_0x778e('0x2e')](respondWithResult(_0x2f8648,null))[_0x778e('0x51')](handleError(_0x2f8648,null));};exports[_0x778e('0x52')]=function(_0x598cb0,_0x47a39e){return db['SquareProject'][_0x778e('0x52')](_0x598cb0[_0x778e('0x53')],{})[_0x778e('0x2e')](function(_0x130762){var _0x22a52a=_0x598cb0[_0x778e('0x54')][_0x778e('0x55')]({'plain':!![]});if(!_0x22a52a)throw new Error(_0x778e('0x56'));if(_0x22a52a['role']==='user'){var _0x5dd752=_0x130762[_0x778e('0x55')]({'plain':!![]});var _0x265e6a=_0x778e('0x30');return db['UserProfileSection'][_0x778e('0x50')]({'where':{'name':_0x265e6a,'userProfileId':_0x22a52a['userProfileId']},'raw':!![]})[_0x778e('0x2e')](function(_0x445d0b){if(_0x445d0b&&_0x445d0b[_0x778e('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x5dd752[_0x778e('0x34')],'resourceId':_0x5dd752['id'],'type':_0x445d0b['name'],'sectionId':_0x445d0b['id']},{})[_0x778e('0x2e')](function(){return _0x130762;});}else{return _0x130762;}})[_0x778e('0x51')](function(_0x3d5777){logger[_0x778e('0x32')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d5777);throw _0x3d5777;});}return _0x130762;})['then'](respondWithResult(_0x47a39e,0xc9))[_0x778e('0x51')](handleError(_0x47a39e,null));};exports['update']=function(_0x191d44,_0x5c0f83){if(_0x191d44[_0x778e('0x53')]['id']){delete _0x191d44[_0x778e('0x53')]['id'];}return db[_0x778e('0x38')][_0x778e('0x50')]({'where':{'id':_0x191d44[_0x778e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5c0f83,null))[_0x778e('0x2e')](saveUpdates(_0x191d44[_0x778e('0x53')],null))['then'](respondWithResult(_0x5c0f83,null))[_0x778e('0x51')](handleError(_0x5c0f83,null));};exports[_0x778e('0x2f')]=function(_0x4ee4c4,_0x131f19){return db['SquareProject'][_0x778e('0x50')]({'where':{'id':_0x4ee4c4[_0x778e('0x4d')]['id']}})[_0x778e('0x2e')](handleEntityNotFound(_0x131f19,null))['then'](removeEntity(_0x131f19,null))[_0x778e('0x51')](handleError(_0x131f19,null));};exports['addUsers']=function(_0x30d0cf,_0x38d3d6,_0x538602){return db[_0x778e('0x38')]['find']({'where':{'id':_0x30d0cf[_0x778e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x38d3d6,null))[_0x778e('0x2e')](function(_0x408453){if(_0x408453){return _0x408453[_0x778e('0x58')](_0x30d0cf['body'][_0x778e('0x59')],_[_0x778e('0x5a')](_0x30d0cf[_0x778e('0x53')],[_0x778e('0x59'),'id'])||{});}})[_0x778e('0x2e')](respondWithResult(_0x38d3d6,null))[_0x778e('0x51')](handleError(_0x38d3d6,null));};exports[_0x778e('0x5b')]=function(_0x246cec,_0x51f3c2,_0x1893d9){return db['SquareProject'][_0x778e('0x50')]({'where':{'id':_0x246cec[_0x778e('0x4d')]['id']}})[_0x778e('0x2e')](handleEntityNotFound(_0x51f3c2,null))[_0x778e('0x2e')](function(_0x161e78){if(_0x161e78){return _0x161e78[_0x778e('0x5b')](_0x246cec['query'][_0x778e('0x59')])['then'](function(){if(_[_0x778e('0x5c')](_0x246cec['query'][_0x778e('0x59')])){for(var _0x22a413=0x0;_0x22a413<_0x246cec[_0x778e('0x3a')]['ids'][_0x778e('0x40')];_0x22a413+=0x1){socket[_0x778e('0x5d')](_0x778e('0x5e'),{'UserId':Number(_0x246cec[_0x778e('0x3a')][_0x778e('0x59')][_0x22a413]),'SquareProjectId':Number(_0x246cec[_0x778e('0x4d')]['id'])});}}else{socket[_0x778e('0x5d')](_0x778e('0x5e'),{'UserId':Number(_0x246cec[_0x778e('0x3a')][_0x778e('0x59')]),'SquareProjectId':Number(_0x246cec[_0x778e('0x4d')]['id'])});}});}})[_0x778e('0x2e')](respondWithStatusCode(_0x51f3c2,null))[_0x778e('0x51')](handleError(_0x51f3c2,null));};exports[_0x778e('0x5f')]=function(_0x4e0b6a,_0x2cbb23,_0x562506){var _0x35c672={};var _0x381885={};var _0x70f2cc;var _0x2e2e7d;return db[_0x778e('0x38')][_0x778e('0x60')]({'where':{'id':_0x4e0b6a[_0x778e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2cbb23,null))[_0x778e('0x2e')](function(_0x3f52cc){if(_0x3f52cc){_0x70f2cc=_0x3f52cc;_0x381885[_0x778e('0x3e')]=_[_0x778e('0x4e')](db[_0x778e('0x61')][_0x778e('0x39')]);_0x381885[_0x778e('0x3a')]=_[_0x778e('0x4e')](_0x4e0b6a[_0x778e('0x3a')]);_0x381885[_0x778e('0x3b')]=_[_0x778e('0x3c')](_0x381885[_0x778e('0x3e')],_0x381885['query']);_0x35c672[_0x778e('0x3d')]=_[_0x778e('0x3c')](_0x381885[_0x778e('0x3e')],qs[_0x778e('0x3f')](_0x4e0b6a['query']['fields']));_0x35c672[_0x778e('0x3d')]=_0x35c672['attributes'][_0x778e('0x40')]?_0x35c672[_0x778e('0x3d')]:_0x381885[_0x778e('0x3e')];_0x35c672['order']=qs['sort'](_0x4e0b6a['query'][_0x778e('0x43')]);_0x35c672[_0x778e('0x47')]=qs[_0x778e('0x3b')](_[_0x778e('0x44')](_0x4e0b6a['query'],_0x381885['filters']));if(_0x4e0b6a[_0x778e('0x3a')][_0x778e('0x45')]){_0x35c672[_0x778e('0x47')]=_[_0x778e('0x46')](_0x35c672[_0x778e('0x47')],{'$or':_[_0x778e('0x37')](_0x35c672['attributes'],function(_0x5cddc9){var _0x5a5cfb={};_0x5a5cfb[_0x5cddc9]={'$like':'%'+_0x4e0b6a[_0x778e('0x3a')]['filter']+'%'};return _0x5a5cfb;})});}_0x35c672=_[_0x778e('0x46')]({},_0x35c672,_0x4e0b6a[_0x778e('0x4f')]);return _0x70f2cc[_0x778e('0x5f')](_0x35c672);}})[_0x778e('0x2e')](function(_0x48d532){if(_0x48d532){_0x2e2e7d=_0x48d532['length'];if(!_0x4e0b6a[_0x778e('0x3a')]['hasOwnProperty'](_0x778e('0x62'))){_0x35c672[_0x778e('0x29')]=qs[_0x778e('0x29')](_0x4e0b6a['query'][_0x778e('0x29')]);_0x35c672['offset']=qs[_0x778e('0x28')](_0x4e0b6a[_0x778e('0x3a')]['offset']);}return _0x70f2cc['getUsers'](_0x35c672);}})[_0x778e('0x2e')](function(_0x3ecff0){if(_0x3ecff0){return _0x3ecff0?{'count':_0x2e2e7d,'rows':_0x3ecff0}:null;}})[_0x778e('0x2e')](respondWithResult(_0x2cbb23,null))[_0x778e('0x51')](handleError(_0x2cbb23,null));}; \ No newline at end of file +var _0x4e33=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','body','params','ids','removeUsers','isArray','userSquareProject:remove','emit','findOne','User','order','getUsers','html-pdf','zip-dir','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','SquareProject','count','includeAll','include','rows','show','length','find','catch','create'];(function(_0x2544f9,_0x4f82c5){var _0x136492=function(_0x4ab946){while(--_0x4ab946){_0x2544f9['push'](_0x2544f9['shift']());}};_0x136492(++_0x4f82c5);}(_0x4e33,0x1eb));var _0x34e3=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0x4e33[_0x19b84f];return _0x18067b;};'use strict';var pdf=require(_0x34e3('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x34e3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x34e3('0x2'));var moment=require(_0x34e3('0x3'));var BPromise=require(_0x34e3('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x34e3('0x5'));var csv=require(_0x34e3('0x6'));var ejs=require(_0x34e3('0x7'));var fs=require('fs');var fs_extra=require(_0x34e3('0x8'));var _=require(_0x34e3('0x9'));var squel=require(_0x34e3('0xa'));var crypto=require('crypto');var jsforce=require(_0x34e3('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x34e3('0xc'));var Papa=require(_0x34e3('0xd'));var Redis=require(_0x34e3('0xe'));var authService=require(_0x34e3('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x34e3('0x10'));var hardwareService=require(_0x34e3('0x11'));var logger=require('../../config/logger')(_0x34e3('0x12'));var utils=require(_0x34e3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x34e3('0x14'));var db=require(_0x34e3('0x15'))['db'];config[_0x34e3('0x16')]=_[_0x34e3('0x17')](config[_0x34e3('0x16')],{'host':_0x34e3('0x18'),'port':0x18eb});var socket=require(_0x34e3('0x19'))(new Redis(config[_0x34e3('0x16')]));require(_0x34e3('0x1a'))[_0x34e3('0x1b')](socket);function respondWithStatusCode(_0x4b00b5,_0x44ea7f){_0x44ea7f=_0x44ea7f||0xcc;return function(_0x267256){if(_0x267256){return _0x4b00b5[_0x34e3('0x1c')](_0x44ea7f);}return _0x4b00b5[_0x34e3('0x1d')](_0x44ea7f)[_0x34e3('0x1e')]();};}function respondWithResult(_0x1c1368,_0x5c3537){_0x5c3537=_0x5c3537||0xc8;return function(_0xc3678){if(_0xc3678){return _0x1c1368['status'](_0x5c3537)[_0x34e3('0x1f')](_0xc3678);}};}function respondWithFilteredResult(_0x58ca4e,_0x26930b){return function(_0x28e4b6){if(_0x28e4b6){var _0x3c7315=_0x28e4b6['count'],_0x865b6f=_0x26930b[_0x34e3('0x20')],_0x44daae=_0x26930b['offset']+_0x26930b[_0x34e3('0x21')],_0x244485;if(_0x44daae>=_0x3c7315){_0x44daae=_0x3c7315;_0x244485=0xc8;}else{_0x244485=0xce;}_0x58ca4e[_0x34e3('0x1d')](_0x244485);return _0x58ca4e[_0x34e3('0x22')](_0x34e3('0x23'),_0x865b6f+'-'+_0x44daae+'/'+_0x3c7315)[_0x34e3('0x1f')](_0x28e4b6);}return null;};}function patchUpdates(_0x1c1a77){return function(_0x4a5698){try{jsonpatch[_0x34e3('0x24')](_0x4a5698,_0x1c1a77,!![]);}catch(_0x2ad4ca){return BPromise[_0x34e3('0x25')](_0x2ad4ca);}return _0x4a5698[_0x34e3('0x26')]();};}function saveUpdates(_0x5082e0,_0x1c2a57){return function(_0x578cd2){if(_0x578cd2){return _0x578cd2[_0x34e3('0x27')](_0x5082e0)[_0x34e3('0x28')](function(_0x16fd82){return _0x16fd82;});}return null;};}function removeEntity(_0x4851c4,_0x4a7854){return function(_0x422a88){if(_0x422a88){return _0x422a88[_0x34e3('0x29')]()[_0x34e3('0x28')](function(){var _0x5caeba=_0x422a88[_0x34e3('0x2a')]({'plain':!![]});var _0x577b1f=_0x34e3('0x2b');return db[_0x34e3('0x2c')][_0x34e3('0x29')]({'where':{'type':_0x577b1f,'resourceId':_0x5caeba['id']}})[_0x34e3('0x28')](function(){return _0x422a88;});})[_0x34e3('0x28')](function(){_0x4851c4[_0x34e3('0x1d')](0xcc)[_0x34e3('0x1e')]();});}};}function handleEntityNotFound(_0x1a4e7c,_0x3362d4){return function(_0x52dd33){if(!_0x52dd33){_0x1a4e7c['sendStatus'](0x194);}return _0x52dd33;};}function handleError(_0x1816bb,_0x414f9e){_0x414f9e=_0x414f9e||0x1f4;return function(_0x21055e){logger[_0x34e3('0x2d')](_0x21055e[_0x34e3('0x2e')]);if(_0x21055e[_0x34e3('0x2f')]){delete _0x21055e['name'];}_0x1816bb[_0x34e3('0x1d')](_0x414f9e)[_0x34e3('0x30')](_0x21055e);};}exports[_0x34e3('0x31')]=function(_0x549e94,_0x437860){var _0x44ccee={},_0x4b3deb={},_0x16552f={'count':0x0,'rows':[]};var _0xa77b58=_[_0x34e3('0x32')](db['SquareProject'][_0x34e3('0x33')],function(_0x1bf3f2){return{'name':_0x1bf3f2['fieldName'],'type':_0x1bf3f2[_0x34e3('0x34')]['key']};});_0x4b3deb[_0x34e3('0x35')]=_[_0x34e3('0x32')](_0xa77b58,'name');_0x4b3deb[_0x34e3('0x36')]=_[_0x34e3('0x37')](_0x549e94[_0x34e3('0x36')]);_0x4b3deb[_0x34e3('0x38')]=_['intersection'](_0x4b3deb[_0x34e3('0x35')],_0x4b3deb[_0x34e3('0x36')]);_0x44ccee[_0x34e3('0x39')]=_[_0x34e3('0x3a')](_0x4b3deb[_0x34e3('0x35')],qs[_0x34e3('0x3b')](_0x549e94[_0x34e3('0x36')]['fields']));_0x44ccee[_0x34e3('0x39')]=_0x44ccee[_0x34e3('0x39')]['length']?_0x44ccee[_0x34e3('0x39')]:_0x4b3deb[_0x34e3('0x35')];if(!_0x549e94[_0x34e3('0x36')][_0x34e3('0x3c')](_0x34e3('0x3d'))){_0x44ccee[_0x34e3('0x21')]=qs[_0x34e3('0x21')](_0x549e94[_0x34e3('0x36')][_0x34e3('0x21')]);_0x44ccee['offset']=qs['offset'](_0x549e94['query'][_0x34e3('0x20')]);}_0x44ccee['order']=qs[_0x34e3('0x3e')](_0x549e94[_0x34e3('0x36')]['sort']);_0x44ccee[_0x34e3('0x3f')]=qs[_0x34e3('0x38')](_[_0x34e3('0x40')](_0x549e94[_0x34e3('0x36')],_0x4b3deb[_0x34e3('0x38')]),_0xa77b58);if(_0x549e94['query'][_0x34e3('0x41')]){_0x44ccee[_0x34e3('0x3f')]=_[_0x34e3('0x42')](_0x44ccee['where'],{'$or':_['map'](_0xa77b58,function(_0x7aca78){if(_0x7aca78[_0x34e3('0x34')]!==_0x34e3('0x43')){var _0x2f1411={};_0x2f1411[_0x7aca78[_0x34e3('0x2f')]]={'$like':'%'+_0x549e94[_0x34e3('0x36')][_0x34e3('0x41')]+'%'};return _0x2f1411;}})});}_0x44ccee=_[_0x34e3('0x42')]({},_0x44ccee,_0x549e94[_0x34e3('0x44')]);var _0x5cf376={'where':_0x44ccee['where']};return db[_0x34e3('0x45')][_0x34e3('0x46')](_0x5cf376)['then'](function(_0x5d5f57){_0x16552f[_0x34e3('0x46')]=_0x5d5f57;if(_0x549e94[_0x34e3('0x36')][_0x34e3('0x47')]){_0x44ccee[_0x34e3('0x48')]=[{'all':!![]}];}return db[_0x34e3('0x45')]['findAll'](_0x44ccee);})['then'](function(_0x5106a6){_0x16552f[_0x34e3('0x49')]=_0x5106a6;return _0x16552f;})[_0x34e3('0x28')](respondWithFilteredResult(_0x437860,_0x44ccee))['catch'](handleError(_0x437860,null));};exports[_0x34e3('0x4a')]=function(_0x4af1c1,_0x441a03){var _0x31d4b6={'raw':![],'where':{'id':_0x4af1c1['params']['id']}},_0x339f48={};_0x339f48[_0x34e3('0x35')]=_[_0x34e3('0x37')](db['SquareProject'][_0x34e3('0x33')]);_0x339f48['query']=_['keys'](_0x4af1c1['query']);_0x339f48[_0x34e3('0x38')]=_[_0x34e3('0x3a')](_0x339f48[_0x34e3('0x35')],_0x339f48[_0x34e3('0x36')]);_0x31d4b6['attributes']=_[_0x34e3('0x3a')](_0x339f48[_0x34e3('0x35')],qs[_0x34e3('0x3b')](_0x4af1c1[_0x34e3('0x36')][_0x34e3('0x3b')]));_0x31d4b6['attributes']=_0x31d4b6[_0x34e3('0x39')][_0x34e3('0x4b')]?_0x31d4b6['attributes']:_0x339f48['model'];if(_0x4af1c1[_0x34e3('0x36')][_0x34e3('0x47')]){_0x31d4b6[_0x34e3('0x48')]=[{'all':!![]}];}_0x31d4b6=_[_0x34e3('0x42')]({},_0x31d4b6,_0x4af1c1[_0x34e3('0x44')]);return db[_0x34e3('0x45')][_0x34e3('0x4c')](_0x31d4b6)[_0x34e3('0x28')](handleEntityNotFound(_0x441a03,null))[_0x34e3('0x28')](respondWithResult(_0x441a03,null))[_0x34e3('0x4d')](handleError(_0x441a03,null));};exports['create']=function(_0x4b1fc5,_0x58c9cc){return db[_0x34e3('0x45')][_0x34e3('0x4e')](_0x4b1fc5['body'],{})[_0x34e3('0x28')](function(_0x45e77f){var _0xbb3889=_0x4b1fc5[_0x34e3('0x4f')]['get']({'plain':!![]});if(!_0xbb3889)throw new Error(_0x34e3('0x50'));if(_0xbb3889['role']==='user'){var _0x34bfcb=_0x45e77f[_0x34e3('0x2a')]({'plain':!![]});var _0x451480='SquareProjects';return db[_0x34e3('0x51')]['find']({'where':{'name':_0x451480,'userProfileId':_0xbb3889[_0x34e3('0x52')]},'raw':!![]})[_0x34e3('0x28')](function(_0x31eb30){if(_0x31eb30&&_0x31eb30[_0x34e3('0x53')]===0x0){return db[_0x34e3('0x2c')][_0x34e3('0x4e')]({'name':_0x34bfcb['name'],'resourceId':_0x34bfcb['id'],'type':_0x31eb30[_0x34e3('0x2f')],'sectionId':_0x31eb30['id']},{})['then'](function(){return _0x45e77f;});}else{return _0x45e77f;}})[_0x34e3('0x4d')](function(_0x22c3f8){logger[_0x34e3('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22c3f8);throw _0x22c3f8;});}return _0x45e77f;})[_0x34e3('0x28')](respondWithResult(_0x58c9cc,0xc9))[_0x34e3('0x4d')](handleError(_0x58c9cc,null));};exports['update']=function(_0x176478,_0x1d6044){if(_0x176478[_0x34e3('0x54')]['id']){delete _0x176478['body']['id'];}return db['SquareProject'][_0x34e3('0x4c')]({'where':{'id':_0x176478[_0x34e3('0x55')]['id']}})['then'](handleEntityNotFound(_0x1d6044,null))[_0x34e3('0x28')](saveUpdates(_0x176478['body'],null))[_0x34e3('0x28')](respondWithResult(_0x1d6044,null))[_0x34e3('0x4d')](handleError(_0x1d6044,null));};exports[_0x34e3('0x29')]=function(_0x1c4e24,_0x344254){return db[_0x34e3('0x45')][_0x34e3('0x4c')]({'where':{'id':_0x1c4e24[_0x34e3('0x55')]['id']}})[_0x34e3('0x28')](handleEntityNotFound(_0x344254,null))[_0x34e3('0x28')](removeEntity(_0x344254,null))[_0x34e3('0x4d')](handleError(_0x344254,null));};exports['addUsers']=function(_0x2a2a70,_0x892abf,_0x448b8e){return db[_0x34e3('0x45')][_0x34e3('0x4c')]({'where':{'id':_0x2a2a70[_0x34e3('0x55')]['id']}})[_0x34e3('0x28')](handleEntityNotFound(_0x892abf,null))['then'](function(_0x436b2f){if(_0x436b2f){return _0x436b2f['addUsers'](_0x2a2a70[_0x34e3('0x54')][_0x34e3('0x56')],_['omit'](_0x2a2a70[_0x34e3('0x54')],[_0x34e3('0x56'),'id'])||{});}})['then'](respondWithResult(_0x892abf,null))[_0x34e3('0x4d')](handleError(_0x892abf,null));};exports[_0x34e3('0x57')]=function(_0xe6ade3,_0x5ccc8c,_0x383532){return db[_0x34e3('0x45')][_0x34e3('0x4c')]({'where':{'id':_0xe6ade3[_0x34e3('0x55')]['id']}})[_0x34e3('0x28')](handleEntityNotFound(_0x5ccc8c,null))[_0x34e3('0x28')](function(_0x40c72c){if(_0x40c72c){return _0x40c72c[_0x34e3('0x57')](_0xe6ade3[_0x34e3('0x36')][_0x34e3('0x56')])[_0x34e3('0x28')](function(){if(_[_0x34e3('0x58')](_0xe6ade3[_0x34e3('0x36')][_0x34e3('0x56')])){for(var _0x381c83=0x0;_0x381c83<_0xe6ade3[_0x34e3('0x36')][_0x34e3('0x56')][_0x34e3('0x4b')];_0x381c83+=0x1){socket['emit'](_0x34e3('0x59'),{'UserId':Number(_0xe6ade3[_0x34e3('0x36')]['ids'][_0x381c83]),'SquareProjectId':Number(_0xe6ade3[_0x34e3('0x55')]['id'])});}}else{socket[_0x34e3('0x5a')](_0x34e3('0x59'),{'UserId':Number(_0xe6ade3[_0x34e3('0x36')]['ids']),'SquareProjectId':Number(_0xe6ade3[_0x34e3('0x55')]['id'])});}});}})[_0x34e3('0x28')](respondWithStatusCode(_0x5ccc8c,null))[_0x34e3('0x4d')](handleError(_0x5ccc8c,null));};exports['getUsers']=function(_0x4ff7c4,_0x217a94,_0x254747){var _0x3fcf8a={};var _0xb2867f={};var _0x35e3b7;var _0x2b96fa;return db[_0x34e3('0x45')][_0x34e3('0x5b')]({'where':{'id':_0x4ff7c4[_0x34e3('0x55')]['id']}})[_0x34e3('0x28')](handleEntityNotFound(_0x217a94,null))[_0x34e3('0x28')](function(_0x1288fa){if(_0x1288fa){_0x35e3b7=_0x1288fa;_0xb2867f['model']=_[_0x34e3('0x37')](db[_0x34e3('0x5c')]['rawAttributes']);_0xb2867f[_0x34e3('0x36')]=_[_0x34e3('0x37')](_0x4ff7c4[_0x34e3('0x36')]);_0xb2867f[_0x34e3('0x38')]=_['intersection'](_0xb2867f[_0x34e3('0x35')],_0xb2867f['query']);_0x3fcf8a[_0x34e3('0x39')]=_['intersection'](_0xb2867f[_0x34e3('0x35')],qs[_0x34e3('0x3b')](_0x4ff7c4['query']['fields']));_0x3fcf8a[_0x34e3('0x39')]=_0x3fcf8a[_0x34e3('0x39')][_0x34e3('0x4b')]?_0x3fcf8a[_0x34e3('0x39')]:_0xb2867f[_0x34e3('0x35')];_0x3fcf8a[_0x34e3('0x5d')]=qs['sort'](_0x4ff7c4[_0x34e3('0x36')][_0x34e3('0x3e')]);_0x3fcf8a[_0x34e3('0x3f')]=qs['filters'](_[_0x34e3('0x40')](_0x4ff7c4[_0x34e3('0x36')],_0xb2867f[_0x34e3('0x38')]));if(_0x4ff7c4['query']['filter']){_0x3fcf8a[_0x34e3('0x3f')]=_['merge'](_0x3fcf8a[_0x34e3('0x3f')],{'$or':_[_0x34e3('0x32')](_0x3fcf8a[_0x34e3('0x39')],function(_0x47ae88){var _0x505d53={};_0x505d53[_0x47ae88]={'$like':'%'+_0x4ff7c4[_0x34e3('0x36')]['filter']+'%'};return _0x505d53;})});}_0x3fcf8a=_[_0x34e3('0x42')]({},_0x3fcf8a,_0x4ff7c4[_0x34e3('0x44')]);return _0x35e3b7[_0x34e3('0x5e')](_0x3fcf8a);}})[_0x34e3('0x28')](function(_0x1faa5b){if(_0x1faa5b){_0x2b96fa=_0x1faa5b[_0x34e3('0x4b')];if(!_0x4ff7c4[_0x34e3('0x36')][_0x34e3('0x3c')]('nolimit')){_0x3fcf8a[_0x34e3('0x21')]=qs['limit'](_0x4ff7c4[_0x34e3('0x36')]['limit']);_0x3fcf8a[_0x34e3('0x20')]=qs['offset'](_0x4ff7c4[_0x34e3('0x36')][_0x34e3('0x20')]);}return _0x35e3b7['getUsers'](_0x3fcf8a);}})[_0x34e3('0x28')](function(_0x1d7bf3){if(_0x1d7bf3){return _0x1d7bf3?{'count':_0x2b96fa,'rows':_0x1d7bf3}:null;}})[_0x34e3('0x28')](respondWithResult(_0x217a94,null))[_0x34e3('0x4d')](handleError(_0x217a94,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 28bc561..9bcce0f 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 _0xd023=['exports','events','../../mysqldb','SquareProject','save','emit','hasOwnProperty','hook'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd023,0x1b1));var _0x3d02=function(_0x28c939,_0x110e29){_0x28c939=_0x28c939-0x0;var _0x527fe9=_0xd023[_0x28c939];return _0x527fe9;};'use strict';var EventEmitter=require(_0x3d02('0x0'));var SquareProject=require(_0x3d02('0x1'))['db'][_0x3d02('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3d02('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1a91cf){return function(_0x50c0f1,_0x246fca,_0x5350a7){SquareProjectEvents[_0x3d02('0x4')](_0x1a91cf+':'+_0x50c0f1['id'],_0x50c0f1);SquareProjectEvents[_0x3d02('0x4')](_0x1a91cf,_0x50c0f1);_0x5350a7(null);};}for(var e in events){if(events[_0x3d02('0x5')](e)){var event=events[e];SquareProject[_0x3d02('0x6')](e,emitEvent(event));}}module[_0x3d02('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x1cf4=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x1cf4,0xbf));var _0x41cf=function(_0x3aee2e,_0xf3d800){_0x3aee2e=_0x3aee2e-0x0;var _0x836df3=_0x1cf4[_0x3aee2e];return _0x836df3;};'use strict';var EventEmitter=require(_0x41cf('0x0'));var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x41cf('0x1')](0x0);var events={'afterCreate':_0x41cf('0x2'),'afterUpdate':'update','afterDestroy':_0x41cf('0x3')};function emitEvent(_0x2308e9){return function(_0x446a26,_0x32902d,_0x29b5da){SquareProjectEvents[_0x41cf('0x4')](_0x2308e9+':'+_0x446a26['id'],_0x446a26);SquareProjectEvents[_0x41cf('0x4')](_0x2308e9,_0x446a26);_0x29b5da(null);};}for(var e in events){if(events[_0x41cf('0x5')](e)){var event=events[e];SquareProject[_0x41cf('0x6')](e,emitEvent(event));}}module[_0x41cf('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 26531d2..b9f0042 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 _0x34e5=['publishedAt','format','util','api','moment','bluebird','request-promise','path','../../config/environment','./squareProject.attributes','exports','define','SquareProject','savedAt','YYYY-MM-DD\x20HH:mm:ss','production'];(function(_0x30bdd0,_0x3311d0){var _0x48ee24=function(_0x4cdeb4){while(--_0x4cdeb4){_0x30bdd0['push'](_0x30bdd0['shift']());}};_0x48ee24(++_0x3311d0);}(_0x34e5,0x172));var _0x534e=function(_0x426cab,_0x331b0c){_0x426cab=_0x426cab-0x0;var _0x3140a6=_0x34e5[_0x426cab];return _0x3140a6;};'use strict';var _=require('lodash');var util=require(_0x534e('0x0'));var logger=require('../../config/logger')(_0x534e('0x1'));var moment=require(_0x534e('0x2'));var BPromise=require(_0x534e('0x3'));var rp=require(_0x534e('0x4'));var fs=require('fs');var path=require(_0x534e('0x5'));var rimraf=require('rimraf');var config=require(_0x534e('0x6'));var attributes=require(_0x534e('0x7'));module[_0x534e('0x8')]=function(_0x117f0c,_0x436a92){return _0x117f0c[_0x534e('0x9')](_0x534e('0xa'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x24d562,_0x929597,_0xa836bb){if(_0x24d562['changed']('preproduction')){_0x24d562[_0x534e('0xb')]=moment()['format'](_0x534e('0xc'));}if(_0x24d562['changed'](_0x534e('0xd'))){_0x24d562[_0x534e('0xe')]=moment()[_0x534e('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0xa836bb(null,_0x24d562);}}});}; \ No newline at end of file +var _0x919e=['rimraf','../../config/environment','./squareProject.attributes','exports','SquareProject','square_projects','changed','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','production','format','lodash','util','../../config/logger','moment','path'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x919e,0x1d7));var _0xe919=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x919e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe919('0x0'));var util=require(_0xe919('0x1'));var logger=require(_0xe919('0x2'))('api');var moment=require(_0xe919('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe919('0x4'));var rimraf=require(_0xe919('0x5'));var config=require(_0xe919('0x6'));var attributes=require(_0xe919('0x7'));module[_0xe919('0x8')]=function(_0x5a27ad,_0x1225a5){return _0x5a27ad['define'](_0xe919('0x9'),attributes,{'tableName':_0xe919('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x57c3fe,_0x44d418,_0x5c4129){if(_0x57c3fe[_0xe919('0xb')](_0xe919('0xc'))){_0x57c3fe[_0xe919('0xd')]=moment()['format'](_0xe919('0xe'));}if(_0x57c3fe[_0xe919('0xb')](_0xe919('0xf'))){_0x57c3fe['publishedAt']=moment()[_0xe919('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5c4129(null,_0x57c3fe);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 549b094..3a3b9e1 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 _0x3565=['client','http','redis','defaults','localhost','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','ShowSquareProject','SquareProject','find','options','where','attributes','include','model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0xbd653e,_0x483a47){var _0x4333ef=function(_0x53a879){while(--_0x53a879){_0xbd653e['push'](_0xbd653e['shift']());}};_0x4333ef(++_0x483a47);}(_0x3565,0x153));var _0x5356=function(_0x141a29,_0x33790d){_0x141a29=_0x141a29-0x0;var _0x2edc6f=_0x3565[_0x141a29];return _0x2edc6f;};'use strict';var _=require(_0x5356('0x0'));var util=require(_0x5356('0x1'));var moment=require(_0x5356('0x2'));var BPromise=require(_0x5356('0x3'));var rs=require(_0x5356('0x4'));var fs=require('fs');var Redis=require(_0x5356('0x5'));var db=require(_0x5356('0x6'))['db'];var utils=require(_0x5356('0x7'));var logger=require(_0x5356('0x8'))('rpc');var config=require(_0x5356('0x9'));var jayson=require(_0x5356('0xa'));var client=jayson[_0x5356('0xb')][_0x5356('0xc')]({'port':0x232a});config[_0x5356('0xd')]=_[_0x5356('0xe')](config['redis'],{'host':_0x5356('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5356('0xd')]));require('./squareProject.socket')['register'](socket);function respondWithRpcPromise(_0x1dc70e,_0x55f3eb,_0x578c98){return new BPromise(function(_0x5da248,_0x496945){return client['request'](_0x1dc70e,_0x578c98)[_0x5356('0x10')](function(_0x412b9a){logger[_0x5356('0x11')](_0x5356('0x12'),_0x55f3eb,_0x5356('0x13'));logger[_0x5356('0x14')](_0x5356('0x15'),_0x55f3eb,_0x5356('0x13'),JSON[_0x5356('0x16')](_0x412b9a));if(_0x412b9a['error']){if(_0x412b9a['error']['code']===0x1f4){logger[_0x5356('0x17')](_0x5356('0x12'),_0x55f3eb,_0x412b9a[_0x5356('0x17')]['message']);return _0x496945(_0x412b9a[_0x5356('0x17')]['message']);}logger['error'](_0x5356('0x12'),_0x55f3eb,_0x412b9a[_0x5356('0x17')][_0x5356('0x18')]);return _0x5da248(_0x412b9a[_0x5356('0x17')]['message']);}else{logger[_0x5356('0x11')](_0x5356('0x12'),_0x55f3eb,'request\x20sent');_0x5da248(_0x412b9a['result']['message']);}})[_0x5356('0x19')](function(_0x48a360){logger['error'](_0x5356('0x12'),_0x55f3eb,_0x48a360);_0x496945(_0x48a360);});});}exports[_0x5356('0x1a')]=function(_0x5e4910){var _0xf51d06=this;return new Promise(function(_0x126671,_0x1217df){return db[_0x5356('0x1b')][_0x5356('0x1c')]({'raw':_0x5e4910['options']?_0x5e4910[_0x5356('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5e4910[_0x5356('0x1d')]?_0x5e4910[_0x5356('0x1d')][_0x5356('0x1e')]||null:null,'attributes':_0x5e4910[_0x5356('0x1d')]?_0x5e4910[_0x5356('0x1d')][_0x5356('0x1f')]||null:null,'include':_0x5e4910[_0x5356('0x1d')]?_0x5e4910[_0x5356('0x1d')][_0x5356('0x20')]?_['map'](_0x5e4910[_0x5356('0x1d')][_0x5356('0x20')],function(_0x58dc89){return{'model':db[_0x58dc89[_0x5356('0x21')]],'as':_0x58dc89['as'],'attributes':_0x58dc89[_0x5356('0x1f')],'include':_0x58dc89[_0x5356('0x20')]?_['map'](_0x58dc89[_0x5356('0x20')],function(_0x6d840f){return{'model':db[_0x6d840f[_0x5356('0x21')]],'as':_0x6d840f['as'],'attributes':_0x6d840f['attributes'],'include':_0x6d840f[_0x5356('0x20')]?_[_0x5356('0x22')](_0x6d840f['include'],function(_0x60af1a){return{'model':db[_0x60af1a[_0x5356('0x21')]],'as':_0x60af1a['as'],'attributes':_0x60af1a['attributes']};}):[]};}):[]};}):[]:[]})[_0x5356('0x10')](function(_0x2ff15e){logger['info'](_0x5356('0x1a'),_0x5e4910);logger[_0x5356('0x14')](_0x5356('0x1a'),_0x5e4910,JSON['stringify'](_0x2ff15e));_0x126671(_0x2ff15e);})['catch'](function(_0x172675){logger[_0x5356('0x17')](_0x5356('0x1a'),_0x172675[_0x5356('0x18')],_0x5e4910);_0x1217df(_0xf51d06[_0x5356('0x17')](0x1f4,_0x172675[_0x5356('0x18')]));});});}; \ No newline at end of file +var _0x6c86=['ShowSquareProject','SquareProject','find','options','where','include','map','model','attributes','stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch'];(function(_0x56ecda,_0x1a6b83){var _0x28ce71=function(_0x10e4d0){while(--_0x10e4d0){_0x56ecda['push'](_0x56ecda['shift']());}};_0x28ce71(++_0x1a6b83);}(_0x6c86,0x186));var _0x66c8=function(_0x13a8d6,_0x4e8ec9){_0x13a8d6=_0x13a8d6-0x0;var _0x23fed9=_0x6c86[_0x13a8d6];return _0x23fed9;};'use strict';var _=require(_0x66c8('0x0'));var util=require(_0x66c8('0x1'));var moment=require(_0x66c8('0x2'));var BPromise=require(_0x66c8('0x3'));var rs=require(_0x66c8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x66c8('0x5'));var logger=require(_0x66c8('0x6'))(_0x66c8('0x7'));var config=require(_0x66c8('0x8'));var jayson=require(_0x66c8('0x9'));var client=jayson[_0x66c8('0xa')][_0x66c8('0xb')]({'port':0x232a});config[_0x66c8('0xc')]=_[_0x66c8('0xd')](config[_0x66c8('0xc')],{'host':_0x66c8('0xe'),'port':0x18eb});var socket=require(_0x66c8('0xf'))(new Redis(config[_0x66c8('0xc')]));require('./squareProject.socket')[_0x66c8('0x10')](socket);function respondWithRpcPromise(_0x389a98,_0x2caee6,_0x41c4e4){return new BPromise(function(_0x174b3b,_0x13a76d){return client[_0x66c8('0x11')](_0x389a98,_0x41c4e4)['then'](function(_0x44ae78){logger['info'](_0x66c8('0x12'),_0x2caee6,_0x66c8('0x13'));logger[_0x66c8('0x14')](_0x66c8('0x15'),_0x2caee6,_0x66c8('0x13'),JSON['stringify'](_0x44ae78));if(_0x44ae78[_0x66c8('0x16')]){if(_0x44ae78[_0x66c8('0x16')][_0x66c8('0x17')]===0x1f4){logger[_0x66c8('0x16')](_0x66c8('0x12'),_0x2caee6,_0x44ae78[_0x66c8('0x16')][_0x66c8('0x18')]);return _0x13a76d(_0x44ae78[_0x66c8('0x16')][_0x66c8('0x18')]);}logger[_0x66c8('0x16')]('SquareProject,\x20%s,\x20%s',_0x2caee6,_0x44ae78[_0x66c8('0x16')]['message']);return _0x174b3b(_0x44ae78[_0x66c8('0x16')][_0x66c8('0x18')]);}else{logger[_0x66c8('0x19')]('SquareProject,\x20%s,\x20%s',_0x2caee6,_0x66c8('0x13'));_0x174b3b(_0x44ae78[_0x66c8('0x1a')][_0x66c8('0x18')]);}})[_0x66c8('0x1b')](function(_0x3df630){logger[_0x66c8('0x16')](_0x66c8('0x12'),_0x2caee6,_0x3df630);_0x13a76d(_0x3df630);});});}exports[_0x66c8('0x1c')]=function(_0x2c85f1){var _0x3dc62c=this;return new Promise(function(_0x1f32ed,_0x2ae87b){return db[_0x66c8('0x1d')][_0x66c8('0x1e')]({'raw':_0x2c85f1['options']?_0x2c85f1[_0x66c8('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x2c85f1['options']?_0x2c85f1['options'][_0x66c8('0x20')]||null:null,'attributes':_0x2c85f1['options']?_0x2c85f1['options']['attributes']||null:null,'include':_0x2c85f1[_0x66c8('0x1f')]?_0x2c85f1[_0x66c8('0x1f')][_0x66c8('0x21')]?_[_0x66c8('0x22')](_0x2c85f1['options'][_0x66c8('0x21')],function(_0xc533df){return{'model':db[_0xc533df[_0x66c8('0x23')]],'as':_0xc533df['as'],'attributes':_0xc533df[_0x66c8('0x24')],'include':_0xc533df['include']?_['map'](_0xc533df[_0x66c8('0x21')],function(_0x202d7b){return{'model':db[_0x202d7b[_0x66c8('0x23')]],'as':_0x202d7b['as'],'attributes':_0x202d7b[_0x66c8('0x24')],'include':_0x202d7b[_0x66c8('0x21')]?_['map'](_0x202d7b[_0x66c8('0x21')],function(_0x4b1571){return{'model':db[_0x4b1571[_0x66c8('0x23')]],'as':_0x4b1571['as'],'attributes':_0x4b1571['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d6f2c){logger[_0x66c8('0x19')]('ShowSquareProject',_0x2c85f1);logger[_0x66c8('0x14')](_0x66c8('0x1c'),_0x2c85f1,JSON[_0x66c8('0x25')](_0x4d6f2c));_0x1f32ed(_0x4d6f2c);})['catch'](function(_0x59b85f){logger[_0x66c8('0x16')]('ShowSquareProject',_0x59b85f[_0x66c8('0x18')],_0x2c85f1);_0x2ae87b(_0x3dc62c['error'](0x1f4,_0x59b85f[_0x66c8('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index d3fcc3a..d5f16e2 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 _0xfdbd=['removeListener','squareProject:','./squareProject.events','save','remove','update','emit'];(function(_0x1487a4,_0x39123d){var _0x2d52a7=function(_0x3e9392){while(--_0x3e9392){_0x1487a4['push'](_0x1487a4['shift']());}};_0x2d52a7(++_0x39123d);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x1d9dfa,_0x30598d){_0x1d9dfa=_0x1d9dfa-0x0;var _0x252661=_0xfdbd[_0x1d9dfa];return _0x252661;};'use strict';var SquareProjectEvents=require(_0xdfdb('0x0'));var events=[_0xdfdb('0x1'),_0xdfdb('0x2'),_0xdfdb('0x3')];function createListener(_0x28f05d,_0x3078f0){return function(_0x11218a){_0x3078f0[_0xdfdb('0x4')](_0x28f05d,_0x11218a);};}function removeListener(_0x330ad3,_0x5945e0){return function(){SquareProjectEvents[_0xdfdb('0x5')](_0x330ad3,_0x5945e0);};}exports['register']=function(_0x453ef6){for(var _0x41bd5e=0x0,_0x489f19=events['length'];_0x41bd5e<_0x489f19;_0x41bd5e++){var _0x590b5d=events[_0x41bd5e];var _0x188508=createListener(_0xdfdb('0x6')+_0x590b5d,_0x453ef6);SquareProjectEvents['on'](_0x590b5d,_0x188508);}}; \ No newline at end of file +var _0x01d9=['./squareProject.events','save','remove','update','emit','removeListener','register','length','squareProject:'];(function(_0xbb0f8e,_0x326a1b){var _0x2f0899=function(_0x5ab321){while(--_0x5ab321){_0xbb0f8e['push'](_0xbb0f8e['shift']());}};_0x2f0899(++_0x326a1b);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var SquareProjectEvents=require(_0x901d('0x0'));var events=[_0x901d('0x1'),_0x901d('0x2'),_0x901d('0x3')];function createListener(_0x521cc9,_0x2ce1fd){return function(_0x28bf48){_0x2ce1fd[_0x901d('0x4')](_0x521cc9,_0x28bf48);};}function removeListener(_0x8f7b4,_0x214f38){return function(){SquareProjectEvents[_0x901d('0x5')](_0x8f7b4,_0x214f38);};}exports[_0x901d('0x6')]=function(_0x4e7842){for(var _0x1e5d7d=0x0,_0x6c9ac8=events[_0x901d('0x7')];_0x1e5d7d<_0x6c9ac8;_0x1e5d7d++){var _0x12c39f=events[_0x1e5d7d];var _0x313f85=createListener(_0x901d('0x8')+_0x12c39f,_0x4e7842);SquareProjectEvents['on'](_0x12c39f,_0x313f85);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 0933fdb..808e37c 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 _0x4cd1=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','isAuthenticated','index','show','get','/:id/download','download','create','put','/:id','update','/:id/delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x4cd1,0x1ac));var _0x14cd=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x4cd1[_0x411add];return _0x238242;};'use strict';var multer=require(_0x14cd('0x0'));var util=require(_0x14cd('0x1'));var path=require(_0x14cd('0x2'));var timeout=require(_0x14cd('0x3'));var express=require(_0x14cd('0x4'));var router=express[_0x14cd('0x5')]();var fs_extra=require(_0x14cd('0x6'));var auth=require(_0x14cd('0x7'));var interaction=require(_0x14cd('0x8'));var config=require(_0x14cd('0x9'));var controller=require(_0x14cd('0xa'));router['get']('/',auth[_0x14cd('0xb')](),controller[_0x14cd('0xc')]);router['get']('/:id',auth[_0x14cd('0xb')](),controller[_0x14cd('0xd')]);router[_0x14cd('0xe')](_0x14cd('0xf'),auth[_0x14cd('0xb')](),controller[_0x14cd('0x10')]);router['post']('/',auth[_0x14cd('0xb')](),controller[_0x14cd('0x11')]);router[_0x14cd('0x12')](_0x14cd('0x13'),auth['isAuthenticated'](),controller[_0x14cd('0x14')]);router['delete'](_0x14cd('0x15'),auth[_0x14cd('0xb')](),controller[_0x14cd('0x16')]);module[_0x14cd('0x17')]=router; \ No newline at end of file +var _0xd452=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','/:id/download','isAuthenticated','download','post','put','update','/:id/delete','destroy','exports','util','connect-timeout','express','Router','fs-extra'];(function(_0x580dc4,_0x4dddf4){var _0x144fd9=function(_0xac7188){while(--_0xac7188){_0x580dc4['push'](_0x580dc4['shift']());}};_0x144fd9(++_0x4dddf4);}(_0xd452,0x8e));var _0x2d45=function(_0x3861f7,_0x995b22){_0x3861f7=_0x3861f7-0x0;var _0x50879f=_0xd452[_0x3861f7];return _0x50879f;};'use strict';var multer=require('multer');var util=require(_0x2d45('0x0'));var path=require('path');var timeout=require(_0x2d45('0x1'));var express=require(_0x2d45('0x2'));var router=express[_0x2d45('0x3')]();var fs_extra=require(_0x2d45('0x4'));var auth=require(_0x2d45('0x5'));var interaction=require(_0x2d45('0x6'));var config=require(_0x2d45('0x7'));var controller=require('./squareRecording.controller');router[_0x2d45('0x8')]('/',auth['isAuthenticated'](),controller[_0x2d45('0x9')]);router[_0x2d45('0x8')](_0x2d45('0xa'),auth['isAuthenticated'](),controller[_0x2d45('0xb')]);router['get'](_0x2d45('0xc'),auth[_0x2d45('0xd')](),controller[_0x2d45('0xe')]);router[_0x2d45('0xf')]('/',auth[_0x2d45('0xd')](),controller['create']);router[_0x2d45('0x10')](_0x2d45('0xa'),auth[_0x2d45('0xd')](),controller[_0x2d45('0x11')]);router['delete'](_0x2d45('0x12'),auth['isAuthenticated'](),controller[_0x2d45('0x13')]);module[_0x2d45('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index ee38c71..33b993b 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 _0xc0c5=['getDataValue','STRING'];(function(_0x3e85ab,_0x1e7d04){var _0x49147d=function(_0x10cccf){while(--_0x10cccf){_0x3e85ab['push'](_0x3e85ab['shift']());}};_0x49147d(++_0x1e7d04);}(_0xc0c5,0xe5));var _0x5c0c=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xc0c5[_0x1c546c];return _0x2cc384;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x5c0c('0x0')]},'callerid':{'type':Sequelize[_0x5c0c('0x0')]},'calleridname':{'type':Sequelize[_0x5c0c('0x0')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x5c0c('0x0')]},'priority':{'type':Sequelize[_0x5c0c('0x0')]},'accountcode':{'type':Sequelize[_0x5c0c('0x0')]},'dnid':{'type':Sequelize[_0x5c0c('0x0')]},'projectName':{'type':Sequelize[_0x5c0c('0x0')]},'saveName':{'type':Sequelize[_0x5c0c('0x0')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x5c0c('0x0')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x58cd5f='';var _0x4c1aa1=this[_0x5c0c('0x1')]('savePath');if(_0x4c1aa1){_0x58cd5f=_0x4c1aa1['substring'](_0x4c1aa1['lastIndexOf']('.'));}return _0x58cd5f;}}}; \ No newline at end of file +var _0x8101=['sequelize','exports','STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf'];(function(_0x4c0699,_0x1f326d){var _0x472d6f=function(_0x2f88d3){while(--_0x2f88d3){_0x4c0699['push'](_0x4c0699['shift']());}};_0x472d6f(++_0x1f326d);}(_0x8101,0xc0));var _0x1810=function(_0x5d860f,_0x467498){_0x5d860f=_0x5d860f-0x0;var _0x236490=_0x8101[_0x5d860f];return _0x236490;};'use strict';var Sequelize=require(_0x1810('0x0'));module[_0x1810('0x1')]={'uniqueid':{'type':Sequelize[_0x1810('0x2')]},'callerid':{'type':Sequelize[_0x1810('0x2')]},'calleridname':{'type':Sequelize[_0x1810('0x2')]},'context':{'type':Sequelize[_0x1810('0x2')]},'extension':{'type':Sequelize[_0x1810('0x2')]},'priority':{'type':Sequelize[_0x1810('0x2')]},'accountcode':{'type':Sequelize[_0x1810('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x1810('0x2')]},'filename':{'type':Sequelize[_0x1810('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x1810('0x3')],'get':function(){var _0x44802e='';var _0x3f076f=this[_0x1810('0x4')](_0x1810('0x5'));if(_0x3f076f){_0x44802e=_0x3f076f[_0x1810('0x6')](_0x3f076f[_0x1810('0x7')]('.'));}return _0x44802e;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 6a61b4b..7d5f361 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 _0x373d=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','json','count','limit','Content-Range','reject','save','update','then','destroy','end','error','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','filters','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','keys','attributes','intersection','find','catch','create','body','../../components/encryptor','uniqueid','savePath','format','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','filename','download','unlink','message','SquareRecording\x20not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','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','papaparse','ioredis'];(function(_0x3042c5,_0x36cb88){var _0x7cd140=function(_0x4cdcd8){while(--_0x4cdcd8){_0x3042c5['push'](_0x3042c5['shift']());}};_0x7cd140(++_0x36cb88);}(_0x373d,0x110));var _0xd373=function(_0x593da6,_0x839a8d){_0x593da6=_0x593da6-0x0;var _0x1169de=_0x373d[_0x593da6];return _0x1169de;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd373('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd373('0x1'));var jsonpatch=require(_0xd373('0x2'));var rp=require(_0xd373('0x3'));var moment=require(_0xd373('0x4'));var BPromise=require(_0xd373('0x5'));var Mustache=require(_0xd373('0x6'));var util=require(_0xd373('0x7'));var path=require(_0xd373('0x8'));var sox=require(_0xd373('0x9'));var csv=require(_0xd373('0xa'));var ejs=require(_0xd373('0xb'));var fs=require('fs');var fs_extra=require(_0xd373('0xc'));var _=require(_0xd373('0xd'));var squel=require(_0xd373('0xe'));var crypto=require(_0xd373('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xd373('0x10'));var toCsv=require(_0xd373('0xa'));var querystring=require('querystring');var Papa=require(_0xd373('0x11'));var Redis=require(_0xd373('0x12'));var authService=require(_0xd373('0x13'));var qs=require(_0xd373('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd373('0x15'));var logger=require(_0xd373('0x16'))(_0xd373('0x17'));var utils=require(_0xd373('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a29d6,_0x75b0d0){_0x75b0d0=_0x75b0d0||0xcc;return function(_0x12ec8e){if(_0x12ec8e){return _0x1a29d6[_0xd373('0x19')](_0x75b0d0);}return _0x1a29d6['status'](_0x75b0d0)['end']();};}function respondWithResult(_0x19a0d4,_0x1ce9c1){_0x1ce9c1=_0x1ce9c1||0xc8;return function(_0x4c6ce7){if(_0x4c6ce7){return _0x19a0d4[_0xd373('0x1a')](_0x1ce9c1)[_0xd373('0x1b')](_0x4c6ce7);}};}function respondWithFilteredResult(_0x21d4bb,_0x4649fc){return function(_0x91c617){if(_0x91c617){var _0x14c114=_0x91c617[_0xd373('0x1c')],_0x3a5116=_0x4649fc['offset'],_0x4efb8a=_0x4649fc['offset']+_0x4649fc[_0xd373('0x1d')],_0x144107;if(_0x4efb8a>=_0x14c114){_0x4efb8a=_0x14c114;_0x144107=0xc8;}else{_0x144107=0xce;}_0x21d4bb[_0xd373('0x1a')](_0x144107);return _0x21d4bb['set'](_0xd373('0x1e'),_0x3a5116+'-'+_0x4efb8a+'/'+_0x14c114)[_0xd373('0x1b')](_0x91c617);}return null;};}function patchUpdates(_0x4d49b8){return function(_0x52263b){try{jsonpatch['apply'](_0x52263b,_0x4d49b8,!![]);}catch(_0x5d811c){return BPromise[_0xd373('0x1f')](_0x5d811c);}return _0x52263b[_0xd373('0x20')]();};}function saveUpdates(_0x48a950,_0x17ab27){return function(_0x446301){if(_0x446301){return _0x446301[_0xd373('0x21')](_0x48a950)[_0xd373('0x22')](function(_0x263ab7){return _0x263ab7;});}return null;};}function removeEntity(_0x4a2039,_0x4bfb0e){return function(_0x2d7e59){if(_0x2d7e59){return _0x2d7e59[_0xd373('0x23')]()[_0xd373('0x22')](function(){_0x4a2039['status'](0xcc)[_0xd373('0x24')]();});}};}function handleEntityNotFound(_0xdb8c32,_0x3c6a3e){return function(_0x3ca6e9){if(!_0x3ca6e9){_0xdb8c32[_0xd373('0x19')](0x194);}return _0x3ca6e9;};}function handleError(_0x5b981e,_0x5c592c){_0x5c592c=_0x5c592c||0x1f4;return function(_0x177333){logger[_0xd373('0x25')](_0x177333['stack']);if(_0x177333[_0xd373('0x26')]){delete _0x177333['name'];}_0x5b981e[_0xd373('0x1a')](_0x5c592c)[_0xd373('0x27')](_0x177333);};}exports[_0xd373('0x28')]=function(_0x34884d,_0x590abc){var _0x17c206={},_0x538c33={},_0xa3cbfe={'count':0x0,'rows':[]};var _0x4b2a34=_[_0xd373('0x29')](db[_0xd373('0x2a')][_0xd373('0x2b')],function(_0x285551){return{'name':_0x285551[_0xd373('0x2c')],'type':_0x285551[_0xd373('0x2d')][_0xd373('0x2e')]};});_0x538c33[_0xd373('0x2f')]=_[_0xd373('0x29')](_0x4b2a34,'name');_0x538c33[_0xd373('0x30')]=_['keys'](_0x34884d[_0xd373('0x30')]);_0x538c33[_0xd373('0x31')]=_['intersection'](_0x538c33[_0xd373('0x2f')],_0x538c33[_0xd373('0x30')]);_0x17c206['attributes']=_['intersection'](_0x538c33[_0xd373('0x2f')],qs[_0xd373('0x32')](_0x34884d['query']['fields']));_0x17c206['attributes']=_0x17c206['attributes'][_0xd373('0x33')]?_0x17c206['attributes']:_0x538c33['model'];if(!_0x34884d[_0xd373('0x30')][_0xd373('0x34')](_0xd373('0x35'))){_0x17c206[_0xd373('0x1d')]=qs[_0xd373('0x1d')](_0x34884d[_0xd373('0x30')][_0xd373('0x1d')]);_0x17c206[_0xd373('0x36')]=qs[_0xd373('0x36')](_0x34884d[_0xd373('0x30')]['offset']);}_0x17c206[_0xd373('0x37')]=qs[_0xd373('0x38')](_0x34884d['query'][_0xd373('0x38')]);_0x17c206[_0xd373('0x39')]=qs[_0xd373('0x31')](_[_0xd373('0x3a')](_0x34884d['query'],_0x538c33[_0xd373('0x31')]),_0x4b2a34);if(_0x34884d['query'][_0xd373('0x3b')]){_0x17c206[_0xd373('0x39')]=_['merge'](_0x17c206[_0xd373('0x39')],{'$or':_[_0xd373('0x29')](_0x4b2a34,function(_0x2e6826){if(_0x2e6826[_0xd373('0x2d')]!==_0xd373('0x3c')){var _0x1899c2={};_0x1899c2[_0x2e6826[_0xd373('0x26')]]={'$like':'%'+_0x34884d[_0xd373('0x30')][_0xd373('0x3b')]+'%'};return _0x1899c2;}})});}_0x17c206=_[_0xd373('0x3d')]({},_0x17c206,_0x34884d[_0xd373('0x3e')]);var _0xd24f97={'where':_0x17c206[_0xd373('0x39')]};return db[_0xd373('0x2a')]['count'](_0xd24f97)['then'](function(_0x44843d){_0xa3cbfe[_0xd373('0x1c')]=_0x44843d;if(_0x34884d[_0xd373('0x30')][_0xd373('0x3f')]){_0x17c206[_0xd373('0x40')]=[{'all':!![]}];}return db[_0xd373('0x2a')]['findAll'](_0x17c206);})[_0xd373('0x22')](function(_0x1358ea){_0xa3cbfe[_0xd373('0x41')]=_0x1358ea;return _0xa3cbfe;})[_0xd373('0x22')](respondWithFilteredResult(_0x590abc,_0x17c206))['catch'](handleError(_0x590abc,null));};exports['show']=function(_0x4acd5f,_0x2ef34c){var _0x5f148a={'raw':!![],'where':{'id':_0x4acd5f[_0xd373('0x42')]['id']}},_0x2dab2b={};_0x2dab2b[_0xd373('0x2f')]=_[_0xd373('0x43')](db[_0xd373('0x2a')][_0xd373('0x2b')]);_0x2dab2b[_0xd373('0x30')]=_[_0xd373('0x43')](_0x4acd5f['query']);_0x2dab2b['filters']=_['intersection'](_0x2dab2b[_0xd373('0x2f')],_0x2dab2b[_0xd373('0x30')]);_0x5f148a[_0xd373('0x44')]=_[_0xd373('0x45')](_0x2dab2b[_0xd373('0x2f')],qs[_0xd373('0x32')](_0x4acd5f[_0xd373('0x30')][_0xd373('0x32')]));_0x5f148a['attributes']=_0x5f148a['attributes'][_0xd373('0x33')]?_0x5f148a['attributes']:_0x2dab2b[_0xd373('0x2f')];if(_0x4acd5f[_0xd373('0x30')][_0xd373('0x3f')]){_0x5f148a[_0xd373('0x40')]=[{'all':!![]}];}_0x5f148a=_[_0xd373('0x3d')]({},_0x5f148a,_0x4acd5f['options']);return db[_0xd373('0x2a')][_0xd373('0x46')](_0x5f148a)['then'](handleEntityNotFound(_0x2ef34c,null))[_0xd373('0x22')](respondWithResult(_0x2ef34c,null))[_0xd373('0x47')](handleError(_0x2ef34c,null));};exports[_0xd373('0x48')]=function(_0x36aa2a,_0x581cd4){return db[_0xd373('0x2a')][_0xd373('0x48')](_0x36aa2a['body'],{})[_0xd373('0x22')](respondWithResult(_0x581cd4,0xc9))['catch'](handleError(_0x581cd4,null));};exports[_0xd373('0x21')]=function(_0x5963df,_0x158ad4){if(_0x5963df[_0xd373('0x49')]['id']){delete _0x5963df[_0xd373('0x49')]['id'];}return db[_0xd373('0x2a')][_0xd373('0x46')]({'where':{'id':_0x5963df[_0xd373('0x42')]['id']}})[_0xd373('0x22')](handleEntityNotFound(_0x158ad4,null))[_0xd373('0x22')](saveUpdates(_0x5963df[_0xd373('0x49')],null))[_0xd373('0x22')](respondWithResult(_0x158ad4,null))[_0xd373('0x47')](handleError(_0x158ad4,null));};exports['download']=function(_0x16a506,_0x1fb089,_0xa6f9e7){var _0x5ced75=require(_0xd373('0x4a'));var _0x15ebbf=![];var _0x15b913={};if(_0x16a506[_0xd373('0x30')][_0xd373('0x2d')]&&_0x16a506[_0xd373('0x30')][_0xd373('0x2d')]===_0xd373('0x4b')){_0x15b913['uniqueid']=_0x16a506[_0xd373('0x42')]['id'];}else{_0x15b913['id']=_0x16a506[_0xd373('0x42')]['id'];}return db[_0xd373('0x2a')][_0xd373('0x46')]({'where':_0x15b913,'attributes':['id',_0xd373('0x4c'),'filename'],'raw':!![]})[_0xd373('0x22')](handleEntityNotFound(_0x1fb089,null))[_0xd373('0x22')](function(_0x13be3f){if(_0x13be3f){var _0x5cd477=_0x13be3f['savePath'];var _0x274a09=util[_0xd373('0x4d')](_0xd373('0x4e'),_0x5cd477);if(fs[_0xd373('0x4f')](_0x274a09)){_0x15ebbf=!![];return _0x5ced75['decryptFile'](_0x274a09,_0x5cd477,config[_0xd373('0x50')][_0xd373('0x51')])['then'](function(){return _0x13be3f;});}return _0x13be3f;}})[_0xd373('0x22')](function(_0xca55d4){if(_0xca55d4){var _0x377eb2=_0xca55d4[_0xd373('0x4c')];if(!fs[_0xd373('0x4f')](_0x377eb2)){throw new db[(_0xd373('0x52'))][(_0xd373('0x53'))]('SquareRecording\x20not\x20found');}if(_0xca55d4[_0xd373('0x54')]){return _0x1fb089[_0xd373('0x55')](_0x377eb2,_0xca55d4[_0xd373('0x54')]+path['extname'](_0x377eb2),function(){if(_0x15ebbf){fs[_0xd373('0x56')](_0x377eb2);}});}else{return _0x1fb089[_0xd373('0x55')](_0x377eb2,function(_0x6ac990){if(_0x15ebbf){fs[_0xd373('0x56')](_0x377eb2);}});}}})[_0xd373('0x47')](function(_0x44524a){if(_0x44524a[_0xd373('0x57')]===_0xd373('0x58')){_0x1fb089[_0xd373('0x1a')](0x194)[_0xd373('0x27')]('Not\x20found');}else{return handleError(_0x1fb089,null);}});};exports[_0xd373('0x23')]=function(_0x3d1cac,_0x1172f2){return db[_0xd373('0x2a')][_0xd373('0x46')]({'where':{'id':_0x3d1cac['params']['id']}})[_0xd373('0x22')](function(_0x505aa9){if(!_0x505aa9)throw new ReferenceError(_0xd373('0x59'));return _0x505aa9;})[_0xd373('0x22')](function(_0x97cb21){var _0x4062e3=_0x97cb21[_0xd373('0x4c')];logger[_0xd373('0x5a')](_0xd373('0x5b'),_0x4062e3);if(!_['isNil'](_0x97cb21[_0xd373('0x4c')])&&fs[_0xd373('0x4f')](_0x4062e3)){logger[_0xd373('0x5a')](_0xd373('0x5c')+_0x4062e3+_0xd373('0x5d'));fs[_0xd373('0x5e')](_0x4062e3);}_0x4062e3=_0x4062e3+_0xd373('0x5f');if(!_[_0xd373('0x60')](_0x97cb21['savePath'])&&fs[_0xd373('0x4f')](_0x4062e3)){logger[_0xd373('0x5a')](_0xd373('0x5c')+_0x4062e3+_0xd373('0x5d'));fs[_0xd373('0x5e')](_0x4062e3);}return _0x97cb21;})['then'](function(_0x32d05e){if(!_0x32d05e)throw new InternalError();return _0x32d05e[_0xd373('0x23')]();})[_0xd373('0x22')](function(){_0x1172f2['status'](0xcc)['end']();})[_0xd373('0x47')](handleError(_0x1172f2,null));}; \ No newline at end of file +var _0x9700=['../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','SquareRecording','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','fields','find','catch','create','body','download'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9700,0x77));var _0x0970=function(_0x46df65,_0x4df43b){_0x46df65=_0x46df65-0x0;var _0x2a5a25=_0x9700[_0x46df65];return _0x2a5a25;};'use strict';var pdf=require(_0x0970('0x0'));var emlformat=require(_0x0970('0x1'));var rimraf=require(_0x0970('0x2'));var zipdir=require(_0x0970('0x3'));var jsonpatch=require(_0x0970('0x4'));var rp=require(_0x0970('0x5'));var moment=require(_0x0970('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x0970('0x7'));var util=require(_0x0970('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x0970('0x9'));var ejs=require(_0x0970('0xa'));var fs=require('fs');var fs_extra=require(_0x0970('0xb'));var _=require(_0x0970('0xc'));var squel=require(_0x0970('0xd'));var crypto=require('crypto');var jsforce=require(_0x0970('0xe'));var deskjs=require(_0x0970('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0970('0x10'));var Papa=require(_0x0970('0x11'));var Redis=require(_0x0970('0x12'));var authService=require(_0x0970('0x13'));var qs=require(_0x0970('0x14'));var as=require(_0x0970('0x15'));var hardwareService=require(_0x0970('0x16'));var logger=require(_0x0970('0x17'))('api');var utils=require(_0x0970('0x18'));var config=require(_0x0970('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x0970('0x1a'))['db'];function respondWithStatusCode(_0x1846db,_0x3bf5a9){_0x3bf5a9=_0x3bf5a9||0xcc;return function(_0x11005a){if(_0x11005a){return _0x1846db[_0x0970('0x1b')](_0x3bf5a9);}return _0x1846db[_0x0970('0x1c')](_0x3bf5a9)[_0x0970('0x1d')]();};}function respondWithResult(_0x312086,_0x28162a){_0x28162a=_0x28162a||0xc8;return function(_0x3b6ebb){if(_0x3b6ebb){return _0x312086[_0x0970('0x1c')](_0x28162a)['json'](_0x3b6ebb);}};}function respondWithFilteredResult(_0x1d4985,_0x1a680e){return function(_0x3c931a){if(_0x3c931a){var _0x17e5d0=_0x3c931a[_0x0970('0x1e')],_0x41559=_0x1a680e['offset'],_0x32acf2=_0x1a680e[_0x0970('0x1f')]+_0x1a680e['limit'],_0x479d69;if(_0x32acf2>=_0x17e5d0){_0x32acf2=_0x17e5d0;_0x479d69=0xc8;}else{_0x479d69=0xce;}_0x1d4985[_0x0970('0x1c')](_0x479d69);return _0x1d4985[_0x0970('0x20')](_0x0970('0x21'),_0x41559+'-'+_0x32acf2+'/'+_0x17e5d0)[_0x0970('0x22')](_0x3c931a);}return null;};}function patchUpdates(_0x26a5e7){return function(_0xac5ea5){try{jsonpatch[_0x0970('0x23')](_0xac5ea5,_0x26a5e7,!![]);}catch(_0x888eaf){return BPromise[_0x0970('0x24')](_0x888eaf);}return _0xac5ea5[_0x0970('0x25')]();};}function saveUpdates(_0x128e74,_0x230c1e){return function(_0x4dbdd0){if(_0x4dbdd0){return _0x4dbdd0[_0x0970('0x26')](_0x128e74)[_0x0970('0x27')](function(_0x4a76dd){return _0x4a76dd;});}return null;};}function removeEntity(_0x28de87,_0x5137c7){return function(_0x56a66e){if(_0x56a66e){return _0x56a66e[_0x0970('0x28')]()[_0x0970('0x27')](function(){_0x28de87['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a2526,_0x5b41ac){return function(_0x611e28){if(!_0x611e28){_0x4a2526[_0x0970('0x1b')](0x194);}return _0x611e28;};}function handleError(_0x13c870,_0x33ff87){_0x33ff87=_0x33ff87||0x1f4;return function(_0x259d60){logger['error'](_0x259d60[_0x0970('0x29')]);if(_0x259d60[_0x0970('0x2a')]){delete _0x259d60['name'];}_0x13c870['status'](_0x33ff87)[_0x0970('0x2b')](_0x259d60);};}exports[_0x0970('0x2c')]=function(_0xf38957,_0x14a5c2){var _0x56eca6={},_0x7b3494={},_0x24aedf={'count':0x0,'rows':[]};var _0x3525e4=_['map'](db[_0x0970('0x2d')][_0x0970('0x2e')],function(_0xe5ab32){return{'name':_0xe5ab32[_0x0970('0x2f')],'type':_0xe5ab32[_0x0970('0x30')][_0x0970('0x31')]};});_0x7b3494[_0x0970('0x32')]=_[_0x0970('0x33')](_0x3525e4,'name');_0x7b3494[_0x0970('0x34')]=_['keys'](_0xf38957[_0x0970('0x34')]);_0x7b3494[_0x0970('0x35')]=_[_0x0970('0x36')](_0x7b3494[_0x0970('0x32')],_0x7b3494[_0x0970('0x34')]);_0x56eca6[_0x0970('0x37')]=_[_0x0970('0x36')](_0x7b3494[_0x0970('0x32')],qs['fields'](_0xf38957[_0x0970('0x34')]['fields']));_0x56eca6[_0x0970('0x37')]=_0x56eca6[_0x0970('0x37')][_0x0970('0x38')]?_0x56eca6['attributes']:_0x7b3494[_0x0970('0x32')];if(!_0xf38957['query']['hasOwnProperty'](_0x0970('0x39'))){_0x56eca6[_0x0970('0x3a')]=qs[_0x0970('0x3a')](_0xf38957[_0x0970('0x34')][_0x0970('0x3a')]);_0x56eca6[_0x0970('0x1f')]=qs['offset'](_0xf38957[_0x0970('0x34')][_0x0970('0x1f')]);}_0x56eca6['order']=qs['sort'](_0xf38957['query'][_0x0970('0x3b')]);_0x56eca6['where']=qs[_0x0970('0x35')](_[_0x0970('0x3c')](_0xf38957[_0x0970('0x34')],_0x7b3494[_0x0970('0x35')]),_0x3525e4);if(_0xf38957[_0x0970('0x34')][_0x0970('0x3d')]){_0x56eca6[_0x0970('0x3e')]=_[_0x0970('0x3f')](_0x56eca6[_0x0970('0x3e')],{'$or':_[_0x0970('0x33')](_0x3525e4,function(_0xce4a97){if(_0xce4a97['type']!==_0x0970('0x40')){var _0x26ff4e={};_0x26ff4e[_0xce4a97[_0x0970('0x2a')]]={'$like':'%'+_0xf38957[_0x0970('0x34')][_0x0970('0x3d')]+'%'};return _0x26ff4e;}})});}_0x56eca6=_[_0x0970('0x3f')]({},_0x56eca6,_0xf38957[_0x0970('0x41')]);var _0x5f347b={'where':_0x56eca6[_0x0970('0x3e')]};return db['SquareRecording'][_0x0970('0x1e')](_0x5f347b)['then'](function(_0x3efa19){_0x24aedf[_0x0970('0x1e')]=_0x3efa19;if(_0xf38957[_0x0970('0x34')][_0x0970('0x42')]){_0x56eca6[_0x0970('0x43')]=[{'all':!![]}];}return db[_0x0970('0x2d')][_0x0970('0x44')](_0x56eca6);})[_0x0970('0x27')](function(_0x4ea077){_0x24aedf[_0x0970('0x45')]=_0x4ea077;return _0x24aedf;})[_0x0970('0x27')](respondWithFilteredResult(_0x14a5c2,_0x56eca6))['catch'](handleError(_0x14a5c2,null));};exports[_0x0970('0x46')]=function(_0x15b697,_0x54f4cc){var _0x1bf48a={'raw':!![],'where':{'id':_0x15b697[_0x0970('0x47')]['id']}},_0x5539d2={};_0x5539d2[_0x0970('0x32')]=_[_0x0970('0x48')](db[_0x0970('0x2d')][_0x0970('0x2e')]);_0x5539d2[_0x0970('0x34')]=_[_0x0970('0x48')](_0x15b697['query']);_0x5539d2[_0x0970('0x35')]=_['intersection'](_0x5539d2[_0x0970('0x32')],_0x5539d2['query']);_0x1bf48a['attributes']=_[_0x0970('0x36')](_0x5539d2['model'],qs[_0x0970('0x49')](_0x15b697[_0x0970('0x34')]['fields']));_0x1bf48a[_0x0970('0x37')]=_0x1bf48a[_0x0970('0x37')][_0x0970('0x38')]?_0x1bf48a[_0x0970('0x37')]:_0x5539d2[_0x0970('0x32')];if(_0x15b697[_0x0970('0x34')][_0x0970('0x42')]){_0x1bf48a[_0x0970('0x43')]=[{'all':!![]}];}_0x1bf48a=_[_0x0970('0x3f')]({},_0x1bf48a,_0x15b697[_0x0970('0x41')]);return db[_0x0970('0x2d')][_0x0970('0x4a')](_0x1bf48a)[_0x0970('0x27')](handleEntityNotFound(_0x54f4cc,null))['then'](respondWithResult(_0x54f4cc,null))[_0x0970('0x4b')](handleError(_0x54f4cc,null));};exports[_0x0970('0x4c')]=function(_0x84898c,_0x157a30){return db[_0x0970('0x2d')]['create'](_0x84898c[_0x0970('0x4d')],{})[_0x0970('0x27')](respondWithResult(_0x157a30,0xc9))[_0x0970('0x4b')](handleError(_0x157a30,null));};exports[_0x0970('0x26')]=function(_0x19a4e5,_0x14f1a6){if(_0x19a4e5['body']['id']){delete _0x19a4e5[_0x0970('0x4d')]['id'];}return db[_0x0970('0x2d')][_0x0970('0x4a')]({'where':{'id':_0x19a4e5['params']['id']}})['then'](handleEntityNotFound(_0x14f1a6,null))[_0x0970('0x27')](saveUpdates(_0x19a4e5[_0x0970('0x4d')],null))['then'](respondWithResult(_0x14f1a6,null))[_0x0970('0x4b')](handleError(_0x14f1a6,null));};exports[_0x0970('0x4e')]=function(_0x1b8937,_0xa139d1,_0x3422e8){var _0x344b85=require(_0x0970('0x4f'));var _0x1a705f=![];var _0x5d3e6b={};if(_0x1b8937['query']['type']&&_0x1b8937[_0x0970('0x34')][_0x0970('0x30')]===_0x0970('0x50')){_0x5d3e6b[_0x0970('0x50')]=_0x1b8937[_0x0970('0x47')]['id'];}else{_0x5d3e6b['id']=_0x1b8937[_0x0970('0x47')]['id'];}return db[_0x0970('0x2d')][_0x0970('0x4a')]({'where':_0x5d3e6b,'attributes':['id',_0x0970('0x51'),_0x0970('0x52')],'raw':!![]})[_0x0970('0x27')](handleEntityNotFound(_0xa139d1,null))[_0x0970('0x27')](function(_0x1b5e05){if(_0x1b5e05){var _0x1a0cb0=_0x1b5e05[_0x0970('0x51')];var _0x27360a=util[_0x0970('0x53')](_0x0970('0x54'),_0x1a0cb0);if(fs[_0x0970('0x55')](_0x27360a)){_0x1a705f=!![];return _0x344b85[_0x0970('0x56')](_0x27360a,_0x1a0cb0,config[_0x0970('0x57')][_0x0970('0x58')])[_0x0970('0x27')](function(){return _0x1b5e05;});}return _0x1b5e05;}})[_0x0970('0x27')](function(_0x3e55d2){if(_0x3e55d2){var _0x2c9ec2=_0x3e55d2[_0x0970('0x51')];if(!fs['existsSync'](_0x2c9ec2)){throw new db['Sequelize'][(_0x0970('0x59'))](_0x0970('0x5a'));}if(_0x3e55d2[_0x0970('0x52')]){return _0xa139d1['download'](_0x2c9ec2,_0x3e55d2['filename']+path[_0x0970('0x5b')](_0x2c9ec2),function(){if(_0x1a705f){fs[_0x0970('0x5c')](_0x2c9ec2);}});}else{return _0xa139d1[_0x0970('0x4e')](_0x2c9ec2,function(_0x429739){if(_0x1a705f){fs[_0x0970('0x5c')](_0x2c9ec2);}});}}})[_0x0970('0x4b')](function(_0x3184b2){if(_0x3184b2[_0x0970('0x5d')]===_0x0970('0x5a')){_0xa139d1[_0x0970('0x1c')](0x194)['send']('Not\x20found');}else{return handleError(_0xa139d1,null);}});};exports[_0x0970('0x28')]=function(_0x29b12a,_0x2ce452){return db['SquareRecording']['find']({'where':{'id':_0x29b12a['params']['id']}})['then'](function(_0x4c2bda){if(!_0x4c2bda)throw new ReferenceError('Entity\x20not\x20found');return _0x4c2bda;})[_0x0970('0x27')](function(_0x525065){var _0x2fd2f2=_0x525065['savePath'];logger[_0x0970('0x5e')]('cancellazione\x20fisica\x20documento\x20%s',_0x2fd2f2);if(!_[_0x0970('0x5f')](_0x525065[_0x0970('0x51')])&&fs[_0x0970('0x55')](_0x2fd2f2)){logger['info'](_0x0970('0x60')+_0x2fd2f2+_0x0970('0x61'));fs[_0x0970('0x62')](_0x2fd2f2);}_0x2fd2f2=_0x2fd2f2+'.cypher';if(!_[_0x0970('0x5f')](_0x525065[_0x0970('0x51')])&&fs['existsSync'](_0x2fd2f2)){logger[_0x0970('0x5e')](_0x0970('0x60')+_0x2fd2f2+_0x0970('0x61'));fs['unlinkSync'](_0x2fd2f2);}return _0x525065;})[_0x0970('0x27')](function(_0x21672a){if(!_0x21672a)throw new InternalError();return _0x21672a[_0x0970('0x28')]();})[_0x0970('0x27')](function(){_0x2ce452[_0x0970('0x1c')](0xcc)['end']();})['catch'](handleError(_0x2ce452,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 7bbe52d..8aff7f8 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 _0xf7b4=['path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','api','moment'];(function(_0x919567,_0x1ccd2a){var _0x30a2d7=function(_0x303c65){while(--_0x303c65){_0x919567['push'](_0x919567['shift']());}};_0x30a2d7(++_0x1ccd2a);}(_0xf7b4,0x152));var _0x4f7b=function(_0x3fe31b,_0x54779a){_0x3fe31b=_0x3fe31b-0x0;var _0x41ec8e=_0xf7b4[_0x3fe31b];return _0x41ec8e;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4f7b('0x1'));var moment=require(_0x4f7b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f7b('0x3'));var rimraf=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));var attributes=require(_0x4f7b('0x6'));module[_0x4f7b('0x7')]=function(_0x2637f0,_0x427f8b){return _0x2637f0[_0x4f7b('0x8')](_0x4f7b('0x9'),attributes,{'tableName':_0x4f7b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xefda=['../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','api','moment','request-promise','path','rimraf'];(function(_0x5d688c,_0x269916){var _0x2e93ba=function(_0x23d93b){while(--_0x23d93b){_0x5d688c['push'](_0x5d688c['shift']());}};_0x2e93ba(++_0x269916);}(_0xefda,0x96));var _0xaefd=function(_0xb8484a,_0x95e48d){_0xb8484a=_0xb8484a-0x0;var _0x4dbbe7=_0xefda[_0xb8484a];return _0x4dbbe7;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 9de198e..356a948 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 _0x5e71=['jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','CreateSquareRecording','SquareRecording','create','body','raw','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2ccb09,_0x1f8334){var _0x7db1d6=function(_0x40a8f3){while(--_0x40a8f3){_0x2ccb09['push'](_0x2ccb09['shift']());}};_0x7db1d6(++_0x1f8334);}(_0x5e71,0xa8));var _0x15e7=function(_0x38c2b2,_0x2ac4f){_0x38c2b2=_0x38c2b2-0x0;var _0x334032=_0x5e71[_0x38c2b2];return _0x334032;};'use strict';var _=require(_0x15e7('0x0'));var util=require(_0x15e7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x15e7('0x2'));var fs=require('fs');var Redis=require(_0x15e7('0x3'));var db=require(_0x15e7('0x4'))['db'];var utils=require(_0x15e7('0x5'));var logger=require(_0x15e7('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x15e7('0x7'));var client=jayson[_0x15e7('0x8')][_0x15e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x456893,_0x3d3fd4,_0x2e58b5){return new BPromise(function(_0x54fc31,_0x929aec){return client[_0x15e7('0xa')](_0x456893,_0x2e58b5)[_0x15e7('0xb')](function(_0x4d8599){logger[_0x15e7('0xc')](_0x15e7('0xd'),_0x3d3fd4,_0x15e7('0xe'));logger[_0x15e7('0xf')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x3d3fd4,_0x15e7('0xe'),JSON[_0x15e7('0x10')](_0x4d8599));if(_0x4d8599['error']){if(_0x4d8599['error']['code']===0x1f4){logger[_0x15e7('0x11')](_0x15e7('0xd'),_0x3d3fd4,_0x4d8599[_0x15e7('0x11')][_0x15e7('0x12')]);return _0x929aec(_0x4d8599[_0x15e7('0x11')][_0x15e7('0x12')]);}logger[_0x15e7('0x11')](_0x15e7('0xd'),_0x3d3fd4,_0x4d8599[_0x15e7('0x11')]['message']);return _0x54fc31(_0x4d8599['error']['message']);}else{logger['info'](_0x15e7('0xd'),_0x3d3fd4,'request\x20sent');_0x54fc31(_0x4d8599['result']['message']);}})[_0x15e7('0x13')](function(_0xabaab4){logger[_0x15e7('0x11')]('SquareRecording,\x20%s,\x20%s',_0x3d3fd4,_0xabaab4);_0x929aec(_0xabaab4);});});}exports[_0x15e7('0x14')]=function(_0x4a4612){var _0x4e4d61=this;return new Promise(function(_0x2eec15,_0x198e0e){return db[_0x15e7('0x15')][_0x15e7('0x16')](_0x4a4612[_0x15e7('0x17')],{'raw':_0x4a4612['options']?_0x4a4612['options'][_0x15e7('0x18')]===undefined?!![]:![]:!![]})[_0x15e7('0xb')](function(_0x58158c){logger['info'](_0x15e7('0x14'),_0x4a4612);logger[_0x15e7('0xf')](_0x15e7('0x14'),_0x4a4612,JSON['stringify'](_0x58158c));_0x2eec15(_0x58158c);})[_0x15e7('0x13')](function(_0x384a14){logger[_0x15e7('0x11')](_0x15e7('0x14'),_0x384a14[_0x15e7('0x12')],_0x4a4612);_0x198e0e(_0x4e4d61[_0x15e7('0x11')](0x1f4,_0x384a14[_0x15e7('0x12')]));});});}; \ No newline at end of file +var _0x37e6=['message','SquareRecording','body','raw','CreateSquareRecording','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2beb3a,_0x10e475){var _0x362b1c=function(_0x558bad){while(--_0x558bad){_0x2beb3a['push'](_0x2beb3a['shift']());}};_0x362b1c(++_0x10e475);}(_0x37e6,0x8c));var _0x637e=function(_0x1056c2,_0xfbcd8){_0x1056c2=_0x1056c2-0x0;var _0x11119a=_0x37e6[_0x1056c2];return _0x11119a;};'use strict';var _=require(_0x637e('0x0'));var util=require(_0x637e('0x1'));var moment=require(_0x637e('0x2'));var BPromise=require(_0x637e('0x3'));var rs=require(_0x637e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x637e('0x5'))['db'];var utils=require(_0x637e('0x6'));var logger=require(_0x637e('0x7'))('rpc');var config=require(_0x637e('0x8'));var jayson=require(_0x637e('0x9'));var client=jayson[_0x637e('0xa')][_0x637e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x439c04,_0x58ef8b,_0x3f83ec){return new BPromise(function(_0x4530b0,_0x52a3ac){return client[_0x637e('0xc')](_0x439c04,_0x3f83ec)[_0x637e('0xd')](function(_0xb97814){logger[_0x637e('0xe')](_0x637e('0xf'),_0x58ef8b,_0x637e('0x10'));logger[_0x637e('0x11')](_0x637e('0x12'),_0x58ef8b,_0x637e('0x10'),JSON[_0x637e('0x13')](_0xb97814));if(_0xb97814[_0x637e('0x14')]){if(_0xb97814[_0x637e('0x14')][_0x637e('0x15')]===0x1f4){logger[_0x637e('0x14')]('SquareRecording,\x20%s,\x20%s',_0x58ef8b,_0xb97814['error'][_0x637e('0x16')]);return _0x52a3ac(_0xb97814[_0x637e('0x14')][_0x637e('0x16')]);}logger[_0x637e('0x14')](_0x637e('0xf'),_0x58ef8b,_0xb97814['error'][_0x637e('0x16')]);return _0x4530b0(_0xb97814[_0x637e('0x14')]['message']);}else{logger[_0x637e('0xe')](_0x637e('0xf'),_0x58ef8b,_0x637e('0x10'));_0x4530b0(_0xb97814['result']['message']);}})['catch'](function(_0x103316){logger['error']('SquareRecording,\x20%s,\x20%s',_0x58ef8b,_0x103316);_0x52a3ac(_0x103316);});});}exports['CreateSquareRecording']=function(_0x3474a8){var _0x5c7f22=this;return new Promise(function(_0x406181,_0x283c82){return db[_0x637e('0x17')]['create'](_0x3474a8[_0x637e('0x18')],{'raw':_0x3474a8['options']?_0x3474a8['options'][_0x637e('0x19')]===undefined?!![]:![]:!![]})[_0x637e('0xd')](function(_0x28e71d){logger[_0x637e('0xe')](_0x637e('0x1a'),_0x3474a8);logger[_0x637e('0x11')]('CreateSquareRecording',_0x3474a8,JSON['stringify'](_0x28e71d));_0x406181(_0x28e71d);})['catch'](function(_0x29f443){logger[_0x637e('0x14')](_0x637e('0x1a'),_0x29f443[_0x637e('0x16')],_0x3474a8);_0x283c82(_0x5c7f22[_0x637e('0x14')](0x1f4,_0x29f443[_0x637e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 8e84c22..f283090 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 _0xf1b2=['put','update','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/describe','describe','get','/:id','show','post'];(function(_0x3c4352,_0x5f3cd9){var _0x47dcbd=function(_0x1220cd){while(--_0x1220cd){_0x3c4352['push'](_0x3c4352['shift']());}};_0x47dcbd(++_0x5f3cd9);}(_0xf1b2,0x10e));var _0x2f1b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf1b2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2f1b('0x0'));var util=require(_0x2f1b('0x1'));var path=require(_0x2f1b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2f1b('0x3')]();var fs_extra=require(_0x2f1b('0x4'));var auth=require(_0x2f1b('0x5'));var interaction=require(_0x2f1b('0x6'));var config=require(_0x2f1b('0x7'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x2f1b('0x8')](),controller['index']);router['get'](_0x2f1b('0x9'),auth[_0x2f1b('0x8')](),controller[_0x2f1b('0xa')]);router[_0x2f1b('0xb')](_0x2f1b('0xc'),auth[_0x2f1b('0x8')](),controller[_0x2f1b('0xd')]);router[_0x2f1b('0xe')]('/',auth[_0x2f1b('0x8')](),controller['create']);router[_0x2f1b('0xf')](_0x2f1b('0xc'),auth[_0x2f1b('0x8')](),controller[_0x2f1b('0x10')]);router[_0x2f1b('0x11')](_0x2f1b('0xc'),auth[_0x2f1b('0x8')](),controller[_0x2f1b('0x12')]);module['exports']=router; \ No newline at end of file +var _0x88c3=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','update','delete','destroy','exports'];(function(_0x1a931f,_0x2cabb9){var _0x21d049=function(_0x3c07b1){while(--_0x3c07b1){_0x1a931f['push'](_0x1a931f['shift']());}};_0x21d049(++_0x2cabb9);}(_0x88c3,0x1c2));var _0x388c=function(_0x4ae970,_0x43b505){_0x4ae970=_0x4ae970-0x0;var _0x4a17af=_0x88c3[_0x4ae970];return _0x4a17af;};'use strict';var multer=require('multer');var util=require(_0x388c('0x0'));var path=require('path');var timeout=require(_0x388c('0x1'));var express=require(_0x388c('0x2'));var router=express['Router']();var fs_extra=require(_0x388c('0x3'));var auth=require(_0x388c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x388c('0x5'));var controller=require(_0x388c('0x6'));router[_0x388c('0x7')]('/',auth[_0x388c('0x8')](),controller[_0x388c('0x9')]);router[_0x388c('0x7')](_0x388c('0xa'),auth[_0x388c('0x8')](),controller['describe']);router[_0x388c('0x7')](_0x388c('0xb'),auth[_0x388c('0x8')](),controller['show']);router[_0x388c('0xc')]('/',auth['isAuthenticated'](),controller[_0x388c('0xd')]);router['put'](_0x388c('0xb'),auth['isAuthenticated'](),controller[_0x388c('0xe')]);router[_0x388c('0xf')](_0x388c('0xb'),auth['isAuthenticated'](),controller[_0x388c('0x10')]);module[_0x388c('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 663cd3b..09cf77a 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 _0x1585=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x33d0f4,_0x2aae8d){var _0x509296=function(_0x15511a){while(--_0x15511a){_0x33d0f4['push'](_0x33d0f4['shift']());}};_0x509296(++_0x2aae8d);}(_0x1585,0xcc));var _0x5158=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x1585[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require(_0x5158('0x0'));module[_0x5158('0x1')]={'network':{'type':Sequelize[_0x5158('0x2')]},'network_script':{'type':Sequelize[_0x5158('0x2')]},'request':{'type':Sequelize[_0x5158('0x2')]},'channel':{'type':Sequelize[_0x5158('0x2')]},'language':{'type':Sequelize[_0x5158('0x2')]},'type':{'type':Sequelize[_0x5158('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x5158('0x2')]},'callerid':{'type':Sequelize[_0x5158('0x2')]},'calleridname':{'type':Sequelize[_0x5158('0x2')]},'callingpres':{'type':Sequelize[_0x5158('0x2')]},'callingani2':{'type':Sequelize[_0x5158('0x2')]},'callington':{'type':Sequelize[_0x5158('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x5158('0x2')]},'context':{'type':Sequelize[_0x5158('0x2')]},'extension':{'type':Sequelize[_0x5158('0x2')]},'priority':{'type':Sequelize[_0x5158('0x2')]},'enhanced':{'type':Sequelize[_0x5158('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x5158('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x5158('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x5158('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xf56a=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x25b613,_0x42d4e7){var _0x5ee1d9=function(_0x1c16c5){while(--_0x1c16c5){_0x25b613['push'](_0x25b613['shift']());}};_0x5ee1d9(++_0x42d4e7);}(_0xf56a,0x1ac));var _0xaf56=function(_0x291f8b,_0x3b5591){_0x291f8b=_0x291f8b-0x0;var _0x275171=_0xf56a[_0x291f8b];return _0x275171;};'use strict';var Sequelize=require(_0xaf56('0x0'));module[_0xaf56('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xaf56('0x2')]},'request':{'type':Sequelize[_0xaf56('0x2')]},'channel':{'type':Sequelize[_0xaf56('0x2')]},'language':{'type':Sequelize[_0xaf56('0x2')]},'type':{'type':Sequelize[_0xaf56('0x2')]},'uniqueid':{'type':Sequelize[_0xaf56('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xaf56('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xaf56('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xaf56('0x2')]},'rdnis':{'type':Sequelize[_0xaf56('0x2')]},'context':{'type':Sequelize[_0xaf56('0x2')]},'extension':{'type':Sequelize[_0xaf56('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xaf56('0x2')]},'threadid':{'type':Sequelize[_0xaf56('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xaf56('0x3')]},'leaveAt':{'type':Sequelize[_0xaf56('0x3')]},'bot':{'type':Sequelize[_0xaf56('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 40c0a9e..1e6ac55 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 _0xc6ec=['map','SquareReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','catch','fields','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','count','offset','set','apply','update','then','destroy','error','stack','name','send'];(function(_0x5c6994,_0x19ad9a){var _0x1d5c84=function(_0x4a385a){while(--_0x4a385a){_0x5c6994['push'](_0x5c6994['shift']());}};_0x1d5c84(++_0x19ad9a);}(_0xc6ec,0xac));var _0xcc6e=function(_0x5c38cd,_0x5a6b4e){_0x5c38cd=_0x5c38cd-0x0;var _0xc985ef=_0xc6ec[_0x5c38cd];return _0xc985ef;};'use strict';var pdf=require(_0xcc6e('0x0'));var emlformat=require(_0xcc6e('0x1'));var rimraf=require(_0xcc6e('0x2'));var zipdir=require(_0xcc6e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc6e('0x4'));var moment=require(_0xcc6e('0x5'));var BPromise=require(_0xcc6e('0x6'));var Mustache=require(_0xcc6e('0x7'));var util=require(_0xcc6e('0x8'));var path=require(_0xcc6e('0x9'));var sox=require(_0xcc6e('0xa'));var csv=require(_0xcc6e('0xb'));var ejs=require(_0xcc6e('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6e('0xd'));var _=require('lodash');var squel=require(_0xcc6e('0xe'));var crypto=require('crypto');var jsforce=require(_0xcc6e('0xf'));var deskjs=require(_0xcc6e('0x10'));var toCsv=require(_0xcc6e('0xb'));var querystring=require(_0xcc6e('0x11'));var Papa=require(_0xcc6e('0x12'));var Redis=require(_0xcc6e('0x13'));var authService=require(_0xcc6e('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6e('0x15'));var hardwareService=require(_0xcc6e('0x16'));var logger=require(_0xcc6e('0x17'))(_0xcc6e('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcc6e('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x70a0ec,_0x2a4c6e){_0x2a4c6e=_0x2a4c6e||0xcc;return function(_0x5371b5){if(_0x5371b5){return _0x70a0ec[_0xcc6e('0x1a')](_0x2a4c6e);}return _0x70a0ec[_0xcc6e('0x1b')](_0x2a4c6e)[_0xcc6e('0x1c')]();};}function respondWithResult(_0x11496b,_0x4b62ea){_0x4b62ea=_0x4b62ea||0xc8;return function(_0x48dfa6){if(_0x48dfa6){return _0x11496b[_0xcc6e('0x1b')](_0x4b62ea)[_0xcc6e('0x1d')](_0x48dfa6);}};}function respondWithFilteredResult(_0x346ce5,_0x47f7d0){return function(_0x315f85){if(_0x315f85){var _0x9c797=_0x315f85[_0xcc6e('0x1e')],_0x2148e9=_0x47f7d0['offset'],_0x2f71d6=_0x47f7d0[_0xcc6e('0x1f')]+_0x47f7d0['limit'],_0x3e0b5f;if(_0x2f71d6>=_0x9c797){_0x2f71d6=_0x9c797;_0x3e0b5f=0xc8;}else{_0x3e0b5f=0xce;}_0x346ce5[_0xcc6e('0x1b')](_0x3e0b5f);return _0x346ce5[_0xcc6e('0x20')]('Content-Range',_0x2148e9+'-'+_0x2f71d6+'/'+_0x9c797)[_0xcc6e('0x1d')](_0x315f85);}return null;};}function patchUpdates(_0x2b9ea7){return function(_0x569bbe){try{jsonpatch[_0xcc6e('0x21')](_0x569bbe,_0x2b9ea7,!![]);}catch(_0x552e1d){return BPromise['reject'](_0x552e1d);}return _0x569bbe['save']();};}function saveUpdates(_0x5ce044,_0x551b75){return function(_0x57e41c){if(_0x57e41c){return _0x57e41c[_0xcc6e('0x22')](_0x5ce044)[_0xcc6e('0x23')](function(_0x20b095){return _0x20b095;});}return null;};}function removeEntity(_0x471a87,_0x5c09c2){return function(_0x8f9de9){if(_0x8f9de9){return _0x8f9de9[_0xcc6e('0x24')]()[_0xcc6e('0x23')](function(){_0x471a87['status'](0xcc)[_0xcc6e('0x1c')]();});}};}function handleEntityNotFound(_0x34528e,_0x10fdeb){return function(_0x483b47){if(!_0x483b47){_0x34528e['sendStatus'](0x194);}return _0x483b47;};}function handleError(_0x2c9d9f,_0x3a2e41){_0x3a2e41=_0x3a2e41||0x1f4;return function(_0x11449c){logger[_0xcc6e('0x25')](_0x11449c[_0xcc6e('0x26')]);if(_0x11449c[_0xcc6e('0x27')]){delete _0x11449c[_0xcc6e('0x27')];}_0x2c9d9f['status'](_0x3a2e41)[_0xcc6e('0x28')](_0x11449c);};}exports['index']=function(_0xb0fdcf,_0x352b69){var _0x4ffad0={},_0x5b9a28={},_0x26f5e3={'count':0x0,'rows':[]};var _0x3cace5=_[_0xcc6e('0x29')](db[_0xcc6e('0x2a')][_0xcc6e('0x2b')],function(_0x5c6255){return{'name':_0x5c6255['fieldName'],'type':_0x5c6255[_0xcc6e('0x2c')][_0xcc6e('0x2d')]};});_0x5b9a28[_0xcc6e('0x2e')]=_[_0xcc6e('0x29')](_0x3cace5,_0xcc6e('0x27'));_0x5b9a28[_0xcc6e('0x2f')]=_[_0xcc6e('0x30')](_0xb0fdcf[_0xcc6e('0x2f')]);_0x5b9a28[_0xcc6e('0x31')]=_[_0xcc6e('0x32')](_0x5b9a28['model'],_0x5b9a28['query']);_0x4ffad0[_0xcc6e('0x33')]=_['intersection'](_0x5b9a28[_0xcc6e('0x2e')],qs['fields'](_0xb0fdcf[_0xcc6e('0x2f')]['fields']));_0x4ffad0[_0xcc6e('0x33')]=_0x4ffad0['attributes'][_0xcc6e('0x34')]?_0x4ffad0[_0xcc6e('0x33')]:_0x5b9a28['model'];if(!_0xb0fdcf[_0xcc6e('0x2f')][_0xcc6e('0x35')]('nolimit')){_0x4ffad0[_0xcc6e('0x36')]=qs[_0xcc6e('0x36')](_0xb0fdcf['query'][_0xcc6e('0x36')]);_0x4ffad0[_0xcc6e('0x1f')]=qs['offset'](_0xb0fdcf[_0xcc6e('0x2f')]['offset']);}_0x4ffad0[_0xcc6e('0x37')]=qs[_0xcc6e('0x38')](_0xb0fdcf[_0xcc6e('0x2f')][_0xcc6e('0x38')]);_0x4ffad0[_0xcc6e('0x39')]=qs[_0xcc6e('0x31')](_['pick'](_0xb0fdcf[_0xcc6e('0x2f')],_0x5b9a28[_0xcc6e('0x31')]),_0x3cace5);if(_0xb0fdcf[_0xcc6e('0x2f')][_0xcc6e('0x3a')]){_0x4ffad0[_0xcc6e('0x39')]=_[_0xcc6e('0x3b')](_0x4ffad0[_0xcc6e('0x39')],{'$or':_['map'](_0x3cace5,function(_0x1c46a5){if(_0x1c46a5[_0xcc6e('0x2c')]!==_0xcc6e('0x3c')){var _0x47ba16={};_0x47ba16[_0x1c46a5['name']]={'$like':'%'+_0xb0fdcf['query']['filter']+'%'};return _0x47ba16;}})});}_0x4ffad0=_[_0xcc6e('0x3b')]({},_0x4ffad0,_0xb0fdcf[_0xcc6e('0x3d')]);var _0x3c1019={'where':_0x4ffad0[_0xcc6e('0x39')]};return db['SquareReport'][_0xcc6e('0x1e')](_0x3c1019)[_0xcc6e('0x23')](function(_0x159e73){_0x26f5e3['count']=_0x159e73;if(_0xb0fdcf[_0xcc6e('0x2f')][_0xcc6e('0x3e')]){_0x4ffad0['include']=[{'all':!![]}];}return db[_0xcc6e('0x2a')]['findAll'](_0x4ffad0);})[_0xcc6e('0x23')](function(_0x2deb1d){_0x26f5e3[_0xcc6e('0x3f')]=_0x2deb1d;return _0x26f5e3;})['then'](respondWithFilteredResult(_0x352b69,_0x4ffad0))[_0xcc6e('0x40')](handleError(_0x352b69,null));};exports['show']=function(_0x591668,_0x42c8d8){var _0x349751={'raw':!![],'where':{'id':_0x591668['params']['id']}},_0x4be4cb={};_0x4be4cb[_0xcc6e('0x2e')]=_['keys'](db[_0xcc6e('0x2a')][_0xcc6e('0x2b')]);_0x4be4cb[_0xcc6e('0x2f')]=_[_0xcc6e('0x30')](_0x591668['query']);_0x4be4cb[_0xcc6e('0x31')]=_[_0xcc6e('0x32')](_0x4be4cb[_0xcc6e('0x2e')],_0x4be4cb[_0xcc6e('0x2f')]);_0x349751[_0xcc6e('0x33')]=_[_0xcc6e('0x32')](_0x4be4cb[_0xcc6e('0x2e')],qs[_0xcc6e('0x41')](_0x591668[_0xcc6e('0x2f')]['fields']));_0x349751['attributes']=_0x349751['attributes']['length']?_0x349751['attributes']:_0x4be4cb['model'];if(_0x591668[_0xcc6e('0x2f')][_0xcc6e('0x3e')]){_0x349751['include']=[{'all':!![]}];}_0x349751=_[_0xcc6e('0x3b')]({},_0x349751,_0x591668[_0xcc6e('0x3d')]);return db[_0xcc6e('0x2a')][_0xcc6e('0x42')](_0x349751)[_0xcc6e('0x23')](handleEntityNotFound(_0x42c8d8,null))[_0xcc6e('0x23')](respondWithResult(_0x42c8d8,null))[_0xcc6e('0x40')](handleError(_0x42c8d8,null));};exports[_0xcc6e('0x43')]=function(_0x220873,_0x3af186){return db['SquareReport']['create'](_0x220873[_0xcc6e('0x44')],{})['then'](respondWithResult(_0x3af186,0xc9))['catch'](handleError(_0x3af186,null));};exports[_0xcc6e('0x22')]=function(_0x207a5c,_0x32639e){if(_0x207a5c[_0xcc6e('0x44')]['id']){delete _0x207a5c[_0xcc6e('0x44')]['id'];}return db['SquareReport'][_0xcc6e('0x42')]({'where':{'id':_0x207a5c[_0xcc6e('0x45')]['id']}})[_0xcc6e('0x23')](handleEntityNotFound(_0x32639e,null))[_0xcc6e('0x23')](saveUpdates(_0x207a5c[_0xcc6e('0x44')],null))['then'](respondWithResult(_0x32639e,null))[_0xcc6e('0x40')](handleError(_0x32639e,null));};exports[_0xcc6e('0x24')]=function(_0x42a05b,_0x3c73b1){return db[_0xcc6e('0x2a')][_0xcc6e('0x42')]({'where':{'id':_0x42a05b['params']['id']}})['then'](handleEntityNotFound(_0x3c73b1,null))[_0xcc6e('0x23')](removeEntity(_0x3c73b1,null))[_0xcc6e('0x40')](handleError(_0x3c73b1,null));};exports[_0xcc6e('0x46')]=function(_0x40b1ed,_0x20240c){return db['SquareReport']['describe']()[_0xcc6e('0x23')](respondWithResult(_0x20240c,null))[_0xcc6e('0x40')](handleError(_0x20240c,null));}; \ No newline at end of file +var _0x0421=['type','VIRTUAL','merge','options','SquareReport','then','include','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x115920,_0x507f3e){var _0x258144=function(_0x338258){while(--_0x338258){_0x115920['push'](_0x115920['shift']());}};_0x258144(++_0x507f3e);}(_0x0421,0x142));var _0x1042=function(_0x201181,_0x3ad169){_0x201181=_0x201181-0x0;var _0x58cf9c=_0x0421[_0x201181];return _0x58cf9c;};'use strict';var pdf=require(_0x1042('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1042('0x1'));var zipdir=require(_0x1042('0x2'));var jsonpatch=require(_0x1042('0x3'));var rp=require(_0x1042('0x4'));var moment=require('moment');var BPromise=require(_0x1042('0x5'));var Mustache=require(_0x1042('0x6'));var util=require('util');var path=require(_0x1042('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1042('0x8'));var fs=require('fs');var fs_extra=require(_0x1042('0x9'));var _=require(_0x1042('0xa'));var squel=require('squel');var crypto=require(_0x1042('0xb'));var jsforce=require(_0x1042('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1042('0xd'));var Papa=require(_0x1042('0xe'));var Redis=require(_0x1042('0xf'));var authService=require(_0x1042('0x10'));var qs=require(_0x1042('0x11'));var as=require(_0x1042('0x12'));var hardwareService=require(_0x1042('0x13'));var logger=require(_0x1042('0x14'))(_0x1042('0x15'));var utils=require(_0x1042('0x16'));var config=require(_0x1042('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cfd62,_0x21a8f5){_0x21a8f5=_0x21a8f5||0xcc;return function(_0x1bd025){if(_0x1bd025){return _0x3cfd62[_0x1042('0x18')](_0x21a8f5);}return _0x3cfd62['status'](_0x21a8f5)[_0x1042('0x19')]();};}function respondWithResult(_0x456027,_0x550beb){_0x550beb=_0x550beb||0xc8;return function(_0x4b0384){if(_0x4b0384){return _0x456027[_0x1042('0x1a')](_0x550beb)[_0x1042('0x1b')](_0x4b0384);}};}function respondWithFilteredResult(_0x5a250c,_0x569c18){return function(_0x11ce87){if(_0x11ce87){var _0xad67a0=_0x11ce87[_0x1042('0x1c')],_0xb05a99=_0x569c18['offset'],_0x1c96f6=_0x569c18[_0x1042('0x1d')]+_0x569c18[_0x1042('0x1e')],_0x277f9a;if(_0x1c96f6>=_0xad67a0){_0x1c96f6=_0xad67a0;_0x277f9a=0xc8;}else{_0x277f9a=0xce;}_0x5a250c[_0x1042('0x1a')](_0x277f9a);return _0x5a250c[_0x1042('0x1f')](_0x1042('0x20'),_0xb05a99+'-'+_0x1c96f6+'/'+_0xad67a0)['json'](_0x11ce87);}return null;};}function patchUpdates(_0x2f9163){return function(_0x1042d6){try{jsonpatch[_0x1042('0x21')](_0x1042d6,_0x2f9163,!![]);}catch(_0x2ed30f){return BPromise[_0x1042('0x22')](_0x2ed30f);}return _0x1042d6[_0x1042('0x23')]();};}function saveUpdates(_0x3a35ed,_0x1b8c14){return function(_0x84de0a){if(_0x84de0a){return _0x84de0a[_0x1042('0x24')](_0x3a35ed)['then'](function(_0x49b40e){return _0x49b40e;});}return null;};}function removeEntity(_0x462007,_0x429430){return function(_0xc84e3c){if(_0xc84e3c){return _0xc84e3c['destroy']()['then'](function(){_0x462007[_0x1042('0x1a')](0xcc)[_0x1042('0x19')]();});}};}function handleEntityNotFound(_0x5b3e77,_0x5260be){return function(_0x44a1bd){if(!_0x44a1bd){_0x5b3e77[_0x1042('0x18')](0x194);}return _0x44a1bd;};}function handleError(_0x28b2c0,_0x34c4cd){_0x34c4cd=_0x34c4cd||0x1f4;return function(_0x1d1be3){logger['error'](_0x1d1be3['stack']);if(_0x1d1be3[_0x1042('0x25')]){delete _0x1d1be3[_0x1042('0x25')];}_0x28b2c0['status'](_0x34c4cd)[_0x1042('0x26')](_0x1d1be3);};}exports[_0x1042('0x27')]=function(_0x5245e2,_0xfe6043){var _0x1e3149={},_0x1a908b={},_0x4865ce={'count':0x0,'rows':[]};var _0x5b0886=_[_0x1042('0x28')](db['SquareReport'][_0x1042('0x29')],function(_0x28d7df){return{'name':_0x28d7df[_0x1042('0x2a')],'type':_0x28d7df['type']['key']};});_0x1a908b[_0x1042('0x2b')]=_[_0x1042('0x28')](_0x5b0886,_0x1042('0x25'));_0x1a908b[_0x1042('0x2c')]=_[_0x1042('0x2d')](_0x5245e2['query']);_0x1a908b[_0x1042('0x2e')]=_[_0x1042('0x2f')](_0x1a908b['model'],_0x1a908b['query']);_0x1e3149[_0x1042('0x30')]=_[_0x1042('0x2f')](_0x1a908b[_0x1042('0x2b')],qs['fields'](_0x5245e2[_0x1042('0x2c')][_0x1042('0x31')]));_0x1e3149['attributes']=_0x1e3149[_0x1042('0x30')][_0x1042('0x32')]?_0x1e3149['attributes']:_0x1a908b['model'];if(!_0x5245e2[_0x1042('0x2c')][_0x1042('0x33')](_0x1042('0x34'))){_0x1e3149[_0x1042('0x1e')]=qs[_0x1042('0x1e')](_0x5245e2[_0x1042('0x2c')][_0x1042('0x1e')]);_0x1e3149[_0x1042('0x1d')]=qs[_0x1042('0x1d')](_0x5245e2[_0x1042('0x2c')][_0x1042('0x1d')]);}_0x1e3149[_0x1042('0x35')]=qs[_0x1042('0x36')](_0x5245e2[_0x1042('0x2c')][_0x1042('0x36')]);_0x1e3149[_0x1042('0x37')]=qs[_0x1042('0x2e')](_[_0x1042('0x38')](_0x5245e2['query'],_0x1a908b[_0x1042('0x2e')]),_0x5b0886);if(_0x5245e2[_0x1042('0x2c')][_0x1042('0x39')]){_0x1e3149[_0x1042('0x37')]=_['merge'](_0x1e3149[_0x1042('0x37')],{'$or':_[_0x1042('0x28')](_0x5b0886,function(_0x3fab07){if(_0x3fab07[_0x1042('0x3a')]!==_0x1042('0x3b')){var _0x5a033d={};_0x5a033d[_0x3fab07['name']]={'$like':'%'+_0x5245e2[_0x1042('0x2c')][_0x1042('0x39')]+'%'};return _0x5a033d;}})});}_0x1e3149=_[_0x1042('0x3c')]({},_0x1e3149,_0x5245e2[_0x1042('0x3d')]);var _0x4c7301={'where':_0x1e3149[_0x1042('0x37')]};return db[_0x1042('0x3e')][_0x1042('0x1c')](_0x4c7301)[_0x1042('0x3f')](function(_0x107de2){_0x4865ce[_0x1042('0x1c')]=_0x107de2;if(_0x5245e2[_0x1042('0x2c')]['includeAll']){_0x1e3149[_0x1042('0x40')]=[{'all':!![]}];}return db[_0x1042('0x3e')][_0x1042('0x41')](_0x1e3149);})[_0x1042('0x3f')](function(_0x36e5bf){_0x4865ce[_0x1042('0x42')]=_0x36e5bf;return _0x4865ce;})[_0x1042('0x3f')](respondWithFilteredResult(_0xfe6043,_0x1e3149))[_0x1042('0x43')](handleError(_0xfe6043,null));};exports[_0x1042('0x44')]=function(_0x559601,_0xaf8b72){var _0x2d3227={'raw':!![],'where':{'id':_0x559601[_0x1042('0x45')]['id']}},_0x167666={};_0x167666[_0x1042('0x2b')]=_[_0x1042('0x2d')](db[_0x1042('0x3e')][_0x1042('0x29')]);_0x167666[_0x1042('0x2c')]=_[_0x1042('0x2d')](_0x559601['query']);_0x167666[_0x1042('0x2e')]=_[_0x1042('0x2f')](_0x167666[_0x1042('0x2b')],_0x167666[_0x1042('0x2c')]);_0x2d3227['attributes']=_[_0x1042('0x2f')](_0x167666[_0x1042('0x2b')],qs[_0x1042('0x31')](_0x559601[_0x1042('0x2c')][_0x1042('0x31')]));_0x2d3227[_0x1042('0x30')]=_0x2d3227['attributes'][_0x1042('0x32')]?_0x2d3227[_0x1042('0x30')]:_0x167666[_0x1042('0x2b')];if(_0x559601[_0x1042('0x2c')][_0x1042('0x46')]){_0x2d3227[_0x1042('0x40')]=[{'all':!![]}];}_0x2d3227=_[_0x1042('0x3c')]({},_0x2d3227,_0x559601[_0x1042('0x3d')]);return db['SquareReport'][_0x1042('0x47')](_0x2d3227)[_0x1042('0x3f')](handleEntityNotFound(_0xaf8b72,null))[_0x1042('0x3f')](respondWithResult(_0xaf8b72,null))[_0x1042('0x43')](handleError(_0xaf8b72,null));};exports[_0x1042('0x48')]=function(_0x1a7e85,_0x35749e){return db['SquareReport'][_0x1042('0x48')](_0x1a7e85[_0x1042('0x49')],{})[_0x1042('0x3f')](respondWithResult(_0x35749e,0xc9))[_0x1042('0x43')](handleError(_0x35749e,null));};exports[_0x1042('0x24')]=function(_0x190774,_0x5990eb){if(_0x190774[_0x1042('0x49')]['id']){delete _0x190774[_0x1042('0x49')]['id'];}return db['SquareReport'][_0x1042('0x47')]({'where':{'id':_0x190774[_0x1042('0x45')]['id']}})['then'](handleEntityNotFound(_0x5990eb,null))[_0x1042('0x3f')](saveUpdates(_0x190774[_0x1042('0x49')],null))[_0x1042('0x3f')](respondWithResult(_0x5990eb,null))['catch'](handleError(_0x5990eb,null));};exports[_0x1042('0x4a')]=function(_0x46ff9e,_0x153970){return db['SquareReport'][_0x1042('0x47')]({'where':{'id':_0x46ff9e[_0x1042('0x45')]['id']}})[_0x1042('0x3f')](handleEntityNotFound(_0x153970,null))['then'](removeEntity(_0x153970,null))[_0x1042('0x43')](handleError(_0x153970,null));};exports[_0x1042('0x4b')]=function(_0x432588,_0x4237fc){return db[_0x1042('0x3e')]['describe']()[_0x1042('0x3f')](respondWithResult(_0x4237fc,null))[_0x1042('0x43')](handleError(_0x4237fc,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index f7eb40d..b782fd4 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 _0x7193=['leaveAt','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./squareReport.attributes','define','SquareReport','report_square','uniqueid','project_name'];(function(_0x589ea6,_0x34e30f){var _0x1ab1fe=function(_0x485547){while(--_0x485547){_0x589ea6['push'](_0x589ea6['shift']());}};_0x1ab1fe(++_0x34e30f);}(_0x7193,0x97));var _0x3719=function(_0x26d2a1,_0x351a41){_0x26d2a1=_0x26d2a1-0x0;var _0x3d28f8=_0x7193[_0x26d2a1];return _0x3d28f8;};'use strict';var _=require(_0x3719('0x0'));var util=require(_0x3719('0x1'));var logger=require(_0x3719('0x2'))(_0x3719('0x3'));var moment=require(_0x3719('0x4'));var BPromise=require('bluebird');var rp=require(_0x3719('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3719('0x6'));var config=require(_0x3719('0x7'));var attributes=require(_0x3719('0x8'));module['exports']=function(_0x2473d4,_0x33e93b){return _0x2473d4[_0x3719('0x9')](_0x3719('0xa'),attributes,{'tableName':_0x3719('0xb'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x3719('0xc'),_0x3719('0xd')]},{'name':_0x3719('0xe'),'fields':[_0x3719('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfee1=['define','SquareReport','report_square','uid_pname','uniqueid','project_name','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0xfee1,0x106));var _0x1fee=function(_0x18abd2,_0x22d4b3){_0x18abd2=_0x18abd2-0x0;var _0x1dcad6=_0xfee1[_0x18abd2];return _0x1dcad6;};'use strict';var _=require(_0x1fee('0x0'));var util=require(_0x1fee('0x1'));var logger=require(_0x1fee('0x2'))('api');var moment=require(_0x1fee('0x3'));var BPromise=require(_0x1fee('0x4'));var rp=require(_0x1fee('0x5'));var fs=require('fs');var path=require(_0x1fee('0x6'));var rimraf=require(_0x1fee('0x7'));var config=require(_0x1fee('0x8'));var attributes=require('./squareReport.attributes');module[_0x1fee('0x9')]=function(_0x16bea2,_0x1d3a1e){return _0x16bea2[_0x1fee('0xa')](_0x1fee('0xb'),attributes,{'tableName':_0x1fee('0xc'),'paranoid':![],'indexes':[{'name':_0x1fee('0xd'),'fields':[_0x1fee('0xe'),_0x1fee('0xf')]},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 58d1e2c..f4dd9c3 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 _0x84ab=['rpc','../../config/environment','jayson/promise','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','debug','UpdateSquareReport','update','where','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x598548,_0x1f2e2e){var _0x1782a1=function(_0x2cbd04){while(--_0x2cbd04){_0x598548['push'](_0x598548['shift']());}};_0x1782a1(++_0x1f2e2e);}(_0x84ab,0x12f));var _0xb84a=function(_0x55c1f0,_0x4f574f){_0x55c1f0=_0x55c1f0-0x0;var _0x1530fa=_0x84ab[_0x55c1f0];return _0x1530fa;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var moment=require(_0xb84a('0x2'));var BPromise=require(_0xb84a('0x3'));var rs=require(_0xb84a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb84a('0x5'))['db'];var utils=require(_0xb84a('0x6'));var logger=require('../../config/logger')(_0xb84a('0x7'));var config=require(_0xb84a('0x8'));var jayson=require(_0xb84a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc496,_0xd445b5,_0x4fac4d){return new BPromise(function(_0x3e9086,_0x8d9dbe){return client['request'](_0x4dc496,_0x4fac4d)[_0xb84a('0xa')](function(_0x525cb7){logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,_0xb84a('0xd'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0xd445b5,'request\x20sent',JSON[_0xb84a('0xe')](_0x525cb7));if(_0x525cb7[_0xb84a('0xf')]){if(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x10')]===0x1f4){logger[_0xb84a('0xf')]('SquareReport,\x20%s,\x20%s',_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x8d9dbe(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x3e9086(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}else{logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,'request\x20sent');_0x3e9086(_0x525cb7[_0xb84a('0x12')][_0xb84a('0x11')]);}})[_0xb84a('0x13')](function(_0x3c0b54){logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x3c0b54);_0x8d9dbe(_0x3c0b54);});});}exports[_0xb84a('0x14')]=function(_0x34d82f){var _0x28fe46=this;return new Promise(function(_0x3f7437,_0x11d5a0){return db[_0xb84a('0x15')][_0xb84a('0x16')](_0x34d82f[_0xb84a('0x17')],{'raw':_0x34d82f['options']?_0x34d82f[_0xb84a('0x18')][_0xb84a('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0xac76d3){logger[_0xb84a('0xb')](_0xb84a('0x14'),_0x34d82f);logger[_0xb84a('0x1a')]('CreateSquareReport',_0x34d82f,JSON['stringify'](_0xac76d3));_0x3f7437(_0xac76d3);})[_0xb84a('0x13')](function(_0x19097d){logger[_0xb84a('0xf')](_0xb84a('0x14'),_0x19097d[_0xb84a('0x11')],_0x34d82f);_0x11d5a0(_0x28fe46[_0xb84a('0xf')](0x1f4,_0x19097d[_0xb84a('0x11')]));});});};exports[_0xb84a('0x1b')]=function(_0x3aa06f){var _0x26fe42=this;return new Promise(function(_0x10d860,_0x1aab7d){return db[_0xb84a('0x15')][_0xb84a('0x1c')](_0x3aa06f[_0xb84a('0x17')],{'raw':_0x3aa06f[_0xb84a('0x18')]?_0x3aa06f[_0xb84a('0x18')][_0xb84a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3aa06f[_0xb84a('0x18')]?_0x3aa06f[_0xb84a('0x18')][_0xb84a('0x1d')]||null:null,'attributes':_0x3aa06f[_0xb84a('0x18')]?_0x3aa06f[_0xb84a('0x18')][_0xb84a('0x1e')]||null:null,'limit':_0x3aa06f[_0xb84a('0x18')]?_0x3aa06f[_0xb84a('0x18')]['limit']||null:null})['then'](function(_0x4608ce){logger[_0xb84a('0xb')]('UpdateSquareReport',_0x3aa06f);logger[_0xb84a('0x1a')](_0xb84a('0x1b'),_0x3aa06f,JSON['stringify'](_0x4608ce));_0x10d860(_0x4608ce);})['catch'](function(_0x28f2e7){logger[_0xb84a('0xf')]('UpdateSquareReport',_0x28f2e7[_0xb84a('0x11')],_0x3aa06f);_0x1aab7d(_0x26fe42[_0xb84a('0xf')](0x1f4,_0x28f2e7[_0xb84a('0x11')]));});});}; \ No newline at end of file +var _0x8d0e=['../../config/environment','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareReport','create','options','CreateSquareReport','debug','update','body','raw','where','UpdateSquareReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4db4f2,_0x422e88){var _0x4ccfee=function(_0xf74f82){while(--_0xf74f82){_0x4db4f2['push'](_0x4db4f2['shift']());}};_0x4ccfee(++_0x422e88);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x196bef,_0x5ae3cf){_0x196bef=_0x196bef-0x0;var _0xa75d96=_0x8d0e[_0x196bef];return _0xa75d96;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var moment=require(_0xe8d0('0x2'));var BPromise=require(_0xe8d0('0x3'));var rs=require(_0xe8d0('0x4'));var fs=require('fs');var Redis=require(_0xe8d0('0x5'));var db=require(_0xe8d0('0x6'))['db'];var utils=require(_0xe8d0('0x7'));var logger=require(_0xe8d0('0x8'))('rpc');var config=require(_0xe8d0('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe8d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x92483d,_0x469d37,_0xcc03d0){return new BPromise(function(_0x2b6dce,_0x13aa63){return client[_0xe8d0('0xb')](_0x92483d,_0xcc03d0)[_0xe8d0('0xc')](function(_0x5605a0){logger[_0xe8d0('0xd')](_0xe8d0('0xe'),_0x469d37,_0xe8d0('0xf'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x469d37,_0xe8d0('0xf'),JSON[_0xe8d0('0x10')](_0x5605a0));if(_0x5605a0[_0xe8d0('0x11')]){if(_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x12')]===0x1f4){logger[_0xe8d0('0x11')]('SquareReport,\x20%s,\x20%s',_0x469d37,_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);return _0x13aa63(_0x5605a0['error'][_0xe8d0('0x13')]);}logger['error']('SquareReport,\x20%s,\x20%s',_0x469d37,_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);return _0x2b6dce(_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);}else{logger[_0xe8d0('0xd')](_0xe8d0('0xe'),_0x469d37,'request\x20sent');_0x2b6dce(_0x5605a0[_0xe8d0('0x14')]['message']);}})[_0xe8d0('0x15')](function(_0x3c526c){logger[_0xe8d0('0x11')]('SquareReport,\x20%s,\x20%s',_0x469d37,_0x3c526c);_0x13aa63(_0x3c526c);});});}exports['CreateSquareReport']=function(_0x47c67a){var _0x1bdd94=this;return new Promise(function(_0x384854,_0x27b910){return db[_0xe8d0('0x16')][_0xe8d0('0x17')](_0x47c67a['body'],{'raw':_0x47c67a[_0xe8d0('0x18')]?_0x47c67a[_0xe8d0('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x554402){logger[_0xe8d0('0xd')](_0xe8d0('0x19'),_0x47c67a);logger[_0xe8d0('0x1a')](_0xe8d0('0x19'),_0x47c67a,JSON[_0xe8d0('0x10')](_0x554402));_0x384854(_0x554402);})[_0xe8d0('0x15')](function(_0x1bd25c){logger[_0xe8d0('0x11')](_0xe8d0('0x19'),_0x1bd25c['message'],_0x47c67a);_0x27b910(_0x1bdd94[_0xe8d0('0x11')](0x1f4,_0x1bd25c[_0xe8d0('0x13')]));});});};exports['UpdateSquareReport']=function(_0x106614){var _0x2e69d1=this;return new Promise(function(_0x274cac,_0xd86c76){return db[_0xe8d0('0x16')][_0xe8d0('0x1b')](_0x106614[_0xe8d0('0x1c')],{'raw':_0x106614[_0xe8d0('0x18')]?_0x106614[_0xe8d0('0x18')][_0xe8d0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x106614[_0xe8d0('0x18')]?_0x106614['options'][_0xe8d0('0x1e')]||null:null,'attributes':_0x106614[_0xe8d0('0x18')]?_0x106614[_0xe8d0('0x18')]['attributes']||null:null,'limit':_0x106614[_0xe8d0('0x18')]?_0x106614[_0xe8d0('0x18')]['limit']||null:null})[_0xe8d0('0xc')](function(_0x3ffcb7){logger[_0xe8d0('0xd')](_0xe8d0('0x1f'),_0x106614);logger[_0xe8d0('0x1a')]('UpdateSquareReport',_0x106614,JSON[_0xe8d0('0x10')](_0x3ffcb7));_0x274cac(_0x3ffcb7);})['catch'](function(_0x5d3276){logger['error'](_0xe8d0('0x1f'),_0x5d3276[_0xe8d0('0x13')],_0x106614);_0xd86c76(_0x2e69d1[_0xe8d0('0x11')](0x1f4,_0x5d3276['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index d94fa8d..d22d912 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 _0x0941=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','describe','show','/:id','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x43e9dd,_0x43b181){var _0x2f3c58=function(_0x2c9f63){while(--_0x2c9f63){_0x43e9dd['push'](_0x43e9dd['shift']());}};_0x2f3c58(++_0x43b181);}(_0x0941,0x82));var _0x1094=function(_0x5ec0e6,_0xecaf27){_0x5ec0e6=_0x5ec0e6-0x0;var _0x180ed3=_0x0941[_0x5ec0e6];return _0x180ed3;};'use strict';var multer=require(_0x1094('0x0'));var util=require('util');var path=require(_0x1094('0x1'));var timeout=require(_0x1094('0x2'));var express=require(_0x1094('0x3'));var router=express[_0x1094('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1094('0x5'));var interaction=require(_0x1094('0x6'));var config=require(_0x1094('0x7'));var controller=require(_0x1094('0x8'));router[_0x1094('0x9')]('/',auth[_0x1094('0xa')](),controller[_0x1094('0xb')]);router[_0x1094('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x1094('0xc')]);router[_0x1094('0x9')]('/:id',auth[_0x1094('0xa')](),controller[_0x1094('0xd')]);router['post']('/',auth[_0x1094('0xa')](),controller['create']);router['put'](_0x1094('0xe'),auth[_0x1094('0xa')](),controller[_0x1094('0xf')]);router[_0x1094('0x10')](_0x1094('0xe'),auth[_0x1094('0xa')](),controller[_0x1094('0x11')]);module[_0x1094('0x12')]=router; \ No newline at end of file +var _0x54f2=['update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','/describe','get','/:id','show','post','create'];(function(_0x4c7e7b,_0x2e6c49){var _0x83eb34=function(_0x5c726b){while(--_0x5c726b){_0x4c7e7b['push'](_0x4c7e7b['shift']());}};_0x83eb34(++_0x2e6c49);}(_0x54f2,0x1d8));var _0x254f=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x54f2[_0x36c5b0];return _0xf19333;};'use strict';var multer=require('multer');var util=require(_0x254f('0x0'));var path=require('path');var timeout=require(_0x254f('0x1'));var express=require(_0x254f('0x2'));var router=express[_0x254f('0x3')]();var fs_extra=require(_0x254f('0x4'));var auth=require(_0x254f('0x5'));var interaction=require(_0x254f('0x6'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router['get']('/',auth[_0x254f('0x7')](),controller['index']);router['get'](_0x254f('0x8'),auth[_0x254f('0x7')](),controller['describe']);router[_0x254f('0x9')](_0x254f('0xa'),auth[_0x254f('0x7')](),controller[_0x254f('0xb')]);router[_0x254f('0xc')]('/',auth[_0x254f('0x7')](),controller[_0x254f('0xd')]);router['put'](_0x254f('0xa'),auth[_0x254f('0x7')](),controller[_0x254f('0xe')]);router[_0x254f('0xf')]('/:id',auth[_0x254f('0x7')](),controller[_0x254f('0x10')]);module[_0x254f('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 7cc7d46..6cdacc6 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 _0x348f=['exports','STRING','TEXT','sequelize'];(function(_0x387b45,_0x3e3b69){var _0x168062=function(_0x3ba7e7){while(--_0x3ba7e7){_0x387b45['push'](_0x387b45['shift']());}};_0x168062(++_0x3e3b69);}(_0x348f,0xaf));var _0xf348=function(_0x1a3a88,_0xfdd03d){_0x1a3a88=_0x1a3a88-0x0;var _0x563c71=_0x348f[_0x1a3a88];return _0x563c71;};'use strict';var Sequelize=require(_0xf348('0x0'));module[_0xf348('0x1')]={'uniqueid':{'type':Sequelize[_0xf348('0x2')]},'node':{'type':Sequelize[_0xf348('0x2')]},'application':{'type':Sequelize[_0xf348('0x2')]},'data':{'type':Sequelize[_0xf348('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xf348('0x2')]}}; \ No newline at end of file +var _0x06a5=['STRING','TEXT'];(function(_0xc29be3,_0x377032){var _0x15a466=function(_0x236532){while(--_0x236532){_0xc29be3['push'](_0xc29be3['shift']());}};_0x15a466(++_0x377032);}(_0x06a5,0x112));var _0x506a=function(_0x2f4abe,_0x257fd4){_0x2f4abe=_0x2f4abe-0x0;var _0x30797b=_0x06a5[_0x2f4abe];return _0x30797b;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x506a('0x0')]},'node':{'type':Sequelize[_0x506a('0x0')]},'application':{'type':Sequelize[_0x506a('0x0')]},'data':{'type':Sequelize[_0x506a('0x1')]},'project_name':{'type':Sequelize[_0x506a('0x0')]},'callerid':{'type':Sequelize[_0x506a('0x0')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 03a9241..58caa1a 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 _0x4491=['lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','apply','save','update','then','destroy','end','error','stack','send','index','SquareDetailsReport','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','count','includeAll','include','findAll','catch','params','rawAttributes','options','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x82bf6a,_0x510644){var _0x171b81=function(_0x51420a){while(--_0x51420a){_0x82bf6a['push'](_0x82bf6a['shift']());}};_0x171b81(++_0x510644);}(_0x4491,0xe6));var _0x1449=function(_0x4eef97,_0x42d547){_0x4eef97=_0x4eef97-0x0;var _0x545742=_0x4491[_0x4eef97];return _0x545742;};'use strict';var pdf=require(_0x1449('0x0'));var emlformat=require(_0x1449('0x1'));var rimraf=require(_0x1449('0x2'));var zipdir=require(_0x1449('0x3'));var jsonpatch=require(_0x1449('0x4'));var rp=require(_0x1449('0x5'));var moment=require(_0x1449('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1449('0x7'));var path=require(_0x1449('0x8'));var sox=require(_0x1449('0x9'));var csv=require(_0x1449('0xa'));var ejs=require(_0x1449('0xb'));var fs=require('fs');var fs_extra=require(_0x1449('0xc'));var _=require(_0x1449('0xd'));var squel=require(_0x1449('0xe'));var crypto=require(_0x1449('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x1449('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1449('0x11'));var Papa=require(_0x1449('0x12'));var Redis=require(_0x1449('0x13'));var authService=require(_0x1449('0x14'));var qs=require(_0x1449('0x15'));var as=require(_0x1449('0x16'));var hardwareService=require(_0x1449('0x17'));var logger=require(_0x1449('0x18'))(_0x1449('0x19'));var utils=require(_0x1449('0x1a'));var config=require(_0x1449('0x1b'));var licenseUtil=require(_0x1449('0x1c'));var db=require(_0x1449('0x1d'))['db'];function respondWithStatusCode(_0x51b744,_0x4225a9){_0x4225a9=_0x4225a9||0xcc;return function(_0x3e9a2d){if(_0x3e9a2d){return _0x51b744[_0x1449('0x1e')](_0x4225a9);}return _0x51b744[_0x1449('0x1f')](_0x4225a9)['end']();};}function respondWithResult(_0x248cb6,_0x1dcc33){_0x1dcc33=_0x1dcc33||0xc8;return function(_0x2e02d1){if(_0x2e02d1){return _0x248cb6[_0x1449('0x1f')](_0x1dcc33)[_0x1449('0x20')](_0x2e02d1);}};}function respondWithFilteredResult(_0x2a8995,_0x23e614){return function(_0x87db51){if(_0x87db51){var _0x3cb162=_0x87db51['count'],_0x2a5424=_0x23e614['offset'],_0x489539=_0x23e614[_0x1449('0x21')]+_0x23e614['limit'],_0x5c95f6;if(_0x489539>=_0x3cb162){_0x489539=_0x3cb162;_0x5c95f6=0xc8;}else{_0x5c95f6=0xce;}_0x2a8995['status'](_0x5c95f6);return _0x2a8995[_0x1449('0x22')](_0x1449('0x23'),_0x2a5424+'-'+_0x489539+'/'+_0x3cb162)[_0x1449('0x20')](_0x87db51);}return null;};}function patchUpdates(_0x16bb3b){return function(_0x64255d){try{jsonpatch[_0x1449('0x24')](_0x64255d,_0x16bb3b,!![]);}catch(_0x44d2f0){return BPromise['reject'](_0x44d2f0);}return _0x64255d[_0x1449('0x25')]();};}function saveUpdates(_0x633409,_0xdd47ec){return function(_0x105fdf){if(_0x105fdf){return _0x105fdf[_0x1449('0x26')](_0x633409)[_0x1449('0x27')](function(_0x56edea){return _0x56edea;});}return null;};}function removeEntity(_0x2ae478,_0x520cc5){return function(_0x764168){if(_0x764168){return _0x764168[_0x1449('0x28')]()[_0x1449('0x27')](function(){_0x2ae478['status'](0xcc)[_0x1449('0x29')]();});}};}function handleEntityNotFound(_0x171404,_0x1d9b87){return function(_0x20b552){if(!_0x20b552){_0x171404[_0x1449('0x1e')](0x194);}return _0x20b552;};}function handleError(_0xa27502,_0x3f3813){_0x3f3813=_0x3f3813||0x1f4;return function(_0x4d1039){logger[_0x1449('0x2a')](_0x4d1039[_0x1449('0x2b')]);if(_0x4d1039['name']){delete _0x4d1039['name'];}_0xa27502[_0x1449('0x1f')](_0x3f3813)[_0x1449('0x2c')](_0x4d1039);};}exports[_0x1449('0x2d')]=function(_0x3a71ee,_0x1fe1cf){var _0x7bbe0e={},_0x4e74ce={},_0x2013fa={'count':0x0,'rows':[]};var _0x256a6c=_['map'](db[_0x1449('0x2e')]['rawAttributes'],function(_0x4c24bc){return{'name':_0x4c24bc[_0x1449('0x2f')],'type':_0x4c24bc[_0x1449('0x30')][_0x1449('0x31')]};});_0x4e74ce[_0x1449('0x32')]=_[_0x1449('0x33')](_0x256a6c,_0x1449('0x34'));_0x4e74ce[_0x1449('0x35')]=_[_0x1449('0x36')](_0x3a71ee['query']);_0x4e74ce[_0x1449('0x37')]=_[_0x1449('0x38')](_0x4e74ce['model'],_0x4e74ce[_0x1449('0x35')]);_0x7bbe0e[_0x1449('0x39')]=_[_0x1449('0x38')](_0x4e74ce[_0x1449('0x32')],qs[_0x1449('0x3a')](_0x3a71ee[_0x1449('0x35')][_0x1449('0x3a')]));_0x7bbe0e[_0x1449('0x39')]=_0x7bbe0e[_0x1449('0x39')][_0x1449('0x3b')]?_0x7bbe0e[_0x1449('0x39')]:_0x4e74ce[_0x1449('0x32')];if(!_0x3a71ee[_0x1449('0x35')][_0x1449('0x3c')](_0x1449('0x3d'))){_0x7bbe0e[_0x1449('0x3e')]=qs['limit'](_0x3a71ee[_0x1449('0x35')]['limit']);_0x7bbe0e[_0x1449('0x21')]=qs[_0x1449('0x21')](_0x3a71ee[_0x1449('0x35')][_0x1449('0x21')]);}_0x7bbe0e['order']=qs['sort'](_0x3a71ee[_0x1449('0x35')][_0x1449('0x3f')]);_0x7bbe0e[_0x1449('0x40')]=qs[_0x1449('0x37')](_[_0x1449('0x41')](_0x3a71ee[_0x1449('0x35')],_0x4e74ce['filters']),_0x256a6c);if(_0x3a71ee['query']['filter']){_0x7bbe0e[_0x1449('0x40')]=_[_0x1449('0x42')](_0x7bbe0e['where'],{'$or':_[_0x1449('0x33')](_0x256a6c,function(_0x40105d){if(_0x40105d[_0x1449('0x30')]!==_0x1449('0x43')){var _0x18e528={};_0x18e528[_0x40105d[_0x1449('0x34')]]={'$like':'%'+_0x3a71ee['query'][_0x1449('0x44')]+'%'};return _0x18e528;}})});}_0x7bbe0e=_[_0x1449('0x42')]({},_0x7bbe0e,_0x3a71ee['options']);var _0x52520f={'where':_0x7bbe0e['where']};return db[_0x1449('0x2e')][_0x1449('0x45')](_0x52520f)[_0x1449('0x27')](function(_0x175730){_0x2013fa['count']=_0x175730;if(_0x3a71ee[_0x1449('0x35')][_0x1449('0x46')]){_0x7bbe0e[_0x1449('0x47')]=[{'all':!![]}];}return db[_0x1449('0x2e')][_0x1449('0x48')](_0x7bbe0e);})[_0x1449('0x27')](function(_0x448612){_0x2013fa['rows']=_0x448612;return _0x2013fa;})['then'](respondWithFilteredResult(_0x1fe1cf,_0x7bbe0e))[_0x1449('0x49')](handleError(_0x1fe1cf,null));};exports['show']=function(_0x18a4a3,_0x5f0688){var _0x51b313={'raw':!![],'where':{'id':_0x18a4a3[_0x1449('0x4a')]['id']}},_0x51d168={};_0x51d168[_0x1449('0x32')]=_['keys'](db[_0x1449('0x2e')][_0x1449('0x4b')]);_0x51d168[_0x1449('0x35')]=_['keys'](_0x18a4a3[_0x1449('0x35')]);_0x51d168[_0x1449('0x37')]=_[_0x1449('0x38')](_0x51d168['model'],_0x51d168[_0x1449('0x35')]);_0x51b313['attributes']=_[_0x1449('0x38')](_0x51d168[_0x1449('0x32')],qs['fields'](_0x18a4a3[_0x1449('0x35')][_0x1449('0x3a')]));_0x51b313['attributes']=_0x51b313['attributes'][_0x1449('0x3b')]?_0x51b313['attributes']:_0x51d168[_0x1449('0x32')];if(_0x18a4a3[_0x1449('0x35')][_0x1449('0x46')]){_0x51b313['include']=[{'all':!![]}];}_0x51b313=_['merge']({},_0x51b313,_0x18a4a3[_0x1449('0x4c')]);return db[_0x1449('0x2e')]['find'](_0x51b313)[_0x1449('0x27')](handleEntityNotFound(_0x5f0688,null))[_0x1449('0x27')](respondWithResult(_0x5f0688,null))[_0x1449('0x49')](handleError(_0x5f0688,null));};exports[_0x1449('0x4d')]=function(_0x99c331,_0x3f0f44){return db[_0x1449('0x2e')][_0x1449('0x4d')](_0x99c331['body'],{})['then'](respondWithResult(_0x3f0f44,0xc9))[_0x1449('0x49')](handleError(_0x3f0f44,null));};exports[_0x1449('0x26')]=function(_0x180527,_0x360947){if(_0x180527['body']['id']){delete _0x180527[_0x1449('0x4e')]['id'];}return db[_0x1449('0x2e')]['find']({'where':{'id':_0x180527[_0x1449('0x4a')]['id']}})[_0x1449('0x27')](handleEntityNotFound(_0x360947,null))['then'](saveUpdates(_0x180527['body'],null))[_0x1449('0x27')](respondWithResult(_0x360947,null))[_0x1449('0x49')](handleError(_0x360947,null));};exports[_0x1449('0x28')]=function(_0x30a1c7,_0xf3633a){return db[_0x1449('0x2e')][_0x1449('0x4f')]({'where':{'id':_0x30a1c7[_0x1449('0x4a')]['id']}})['then'](handleEntityNotFound(_0xf3633a,null))[_0x1449('0x27')](removeEntity(_0xf3633a,null))[_0x1449('0x49')](handleError(_0xf3633a,null));};exports[_0x1449('0x50')]=function(_0x1bd073,_0x2b8fea){return db[_0x1449('0x2e')]['describe']()[_0x1449('0x27')](respondWithResult(_0x2b8fea,null))['catch'](handleError(_0x2b8fea,null));}; \ No newline at end of file +var _0x1b7e=['map','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','set','apply','reject','save','update','destroy','then','error','name','send','index','SquareDetailsReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge'];(function(_0x421c02,_0x156783){var _0x208b7a=function(_0x43a54b){while(--_0x43a54b){_0x421c02['push'](_0x421c02['shift']());}};_0x208b7a(++_0x156783);}(_0x1b7e,0x1f0));var _0xe1b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1b7e[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xe1b7('0x0'));var emlformat=require(_0xe1b7('0x1'));var rimraf=require(_0xe1b7('0x2'));var zipdir=require(_0xe1b7('0x3'));var jsonpatch=require(_0xe1b7('0x4'));var rp=require(_0xe1b7('0x5'));var moment=require('moment');var BPromise=require(_0xe1b7('0x6'));var Mustache=require(_0xe1b7('0x7'));var util=require('util');var path=require(_0xe1b7('0x8'));var sox=require(_0xe1b7('0x9'));var csv=require('to-csv');var ejs=require(_0xe1b7('0xa'));var fs=require('fs');var fs_extra=require(_0xe1b7('0xb'));var _=require(_0xe1b7('0xc'));var squel=require(_0xe1b7('0xd'));var crypto=require(_0xe1b7('0xe'));var jsforce=require(_0xe1b7('0xf'));var deskjs=require(_0xe1b7('0x10'));var toCsv=require(_0xe1b7('0x11'));var querystring=require(_0xe1b7('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe1b7('0x13'));var qs=require(_0xe1b7('0x14'));var as=require(_0xe1b7('0x15'));var hardwareService=require(_0xe1b7('0x16'));var logger=require('../../config/logger')(_0xe1b7('0x17'));var utils=require(_0xe1b7('0x18'));var config=require(_0xe1b7('0x19'));var licenseUtil=require(_0xe1b7('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27c47e,_0x42906f){_0x42906f=_0x42906f||0xcc;return function(_0x4375c2){if(_0x4375c2){return _0x27c47e[_0xe1b7('0x1b')](_0x42906f);}return _0x27c47e[_0xe1b7('0x1c')](_0x42906f)[_0xe1b7('0x1d')]();};}function respondWithResult(_0xdaa63c,_0x3f94fd){_0x3f94fd=_0x3f94fd||0xc8;return function(_0x2c1a17){if(_0x2c1a17){return _0xdaa63c['status'](_0x3f94fd)[_0xe1b7('0x1e')](_0x2c1a17);}};}function respondWithFilteredResult(_0x2e5144,_0x57d167){return function(_0x343fc8){if(_0x343fc8){var _0x5c6581=_0x343fc8['count'],_0x959b32=_0x57d167[_0xe1b7('0x1f')],_0x282cf7=_0x57d167[_0xe1b7('0x1f')]+_0x57d167['limit'],_0x2c2d6a;if(_0x282cf7>=_0x5c6581){_0x282cf7=_0x5c6581;_0x2c2d6a=0xc8;}else{_0x2c2d6a=0xce;}_0x2e5144[_0xe1b7('0x1c')](_0x2c2d6a);return _0x2e5144[_0xe1b7('0x20')]('Content-Range',_0x959b32+'-'+_0x282cf7+'/'+_0x5c6581)[_0xe1b7('0x1e')](_0x343fc8);}return null;};}function patchUpdates(_0x49d165){return function(_0x2adc2e){try{jsonpatch[_0xe1b7('0x21')](_0x2adc2e,_0x49d165,!![]);}catch(_0x48304c){return BPromise[_0xe1b7('0x22')](_0x48304c);}return _0x2adc2e[_0xe1b7('0x23')]();};}function saveUpdates(_0x13a4a7,_0x27dfa8){return function(_0xcd14a){if(_0xcd14a){return _0xcd14a[_0xe1b7('0x24')](_0x13a4a7)['then'](function(_0x54abc2){return _0x54abc2;});}return null;};}function removeEntity(_0x4c30e3,_0x9fdbd8){return function(_0x51538b){if(_0x51538b){return _0x51538b[_0xe1b7('0x25')]()[_0xe1b7('0x26')](function(){_0x4c30e3['status'](0xcc)[_0xe1b7('0x1d')]();});}};}function handleEntityNotFound(_0x33c667,_0x2f4a86){return function(_0xfa5067){if(!_0xfa5067){_0x33c667[_0xe1b7('0x1b')](0x194);}return _0xfa5067;};}function handleError(_0x5bb429,_0x3469b3){_0x3469b3=_0x3469b3||0x1f4;return function(_0x30e1ed){logger[_0xe1b7('0x27')](_0x30e1ed['stack']);if(_0x30e1ed['name']){delete _0x30e1ed[_0xe1b7('0x28')];}_0x5bb429[_0xe1b7('0x1c')](_0x3469b3)[_0xe1b7('0x29')](_0x30e1ed);};}exports[_0xe1b7('0x2a')]=function(_0x5d46f2,_0x50ca5b){var _0x167bbe={},_0x284be4={},_0x517d7d={'count':0x0,'rows':[]};var _0x39f984=_['map'](db[_0xe1b7('0x2b')][_0xe1b7('0x2c')],function(_0x4784a3){return{'name':_0x4784a3[_0xe1b7('0x2d')],'type':_0x4784a3['type'][_0xe1b7('0x2e')]};});_0x284be4[_0xe1b7('0x2f')]=_['map'](_0x39f984,_0xe1b7('0x28'));_0x284be4[_0xe1b7('0x30')]=_[_0xe1b7('0x31')](_0x5d46f2[_0xe1b7('0x30')]);_0x284be4['filters']=_[_0xe1b7('0x32')](_0x284be4[_0xe1b7('0x2f')],_0x284be4[_0xe1b7('0x30')]);_0x167bbe[_0xe1b7('0x33')]=_[_0xe1b7('0x32')](_0x284be4[_0xe1b7('0x2f')],qs[_0xe1b7('0x34')](_0x5d46f2[_0xe1b7('0x30')][_0xe1b7('0x34')]));_0x167bbe['attributes']=_0x167bbe['attributes'][_0xe1b7('0x35')]?_0x167bbe[_0xe1b7('0x33')]:_0x284be4[_0xe1b7('0x2f')];if(!_0x5d46f2[_0xe1b7('0x30')][_0xe1b7('0x36')](_0xe1b7('0x37'))){_0x167bbe[_0xe1b7('0x38')]=qs['limit'](_0x5d46f2[_0xe1b7('0x30')][_0xe1b7('0x38')]);_0x167bbe['offset']=qs[_0xe1b7('0x1f')](_0x5d46f2['query'][_0xe1b7('0x1f')]);}_0x167bbe[_0xe1b7('0x39')]=qs['sort'](_0x5d46f2[_0xe1b7('0x30')][_0xe1b7('0x3a')]);_0x167bbe[_0xe1b7('0x3b')]=qs[_0xe1b7('0x3c')](_[_0xe1b7('0x3d')](_0x5d46f2[_0xe1b7('0x30')],_0x284be4[_0xe1b7('0x3c')]),_0x39f984);if(_0x5d46f2['query'][_0xe1b7('0x3e')]){_0x167bbe[_0xe1b7('0x3b')]=_[_0xe1b7('0x3f')](_0x167bbe[_0xe1b7('0x3b')],{'$or':_[_0xe1b7('0x40')](_0x39f984,function(_0x399fa5){if(_0x399fa5[_0xe1b7('0x41')]!==_0xe1b7('0x42')){var _0xeb95b8={};_0xeb95b8[_0x399fa5['name']]={'$like':'%'+_0x5d46f2[_0xe1b7('0x30')][_0xe1b7('0x3e')]+'%'};return _0xeb95b8;}})});}_0x167bbe=_['merge']({},_0x167bbe,_0x5d46f2[_0xe1b7('0x43')]);var _0x5d6f91={'where':_0x167bbe[_0xe1b7('0x3b')]};return db[_0xe1b7('0x2b')][_0xe1b7('0x44')](_0x5d6f91)['then'](function(_0x564f9f){_0x517d7d['count']=_0x564f9f;if(_0x5d46f2[_0xe1b7('0x30')][_0xe1b7('0x45')]){_0x167bbe[_0xe1b7('0x46')]=[{'all':!![]}];}return db[_0xe1b7('0x2b')][_0xe1b7('0x47')](_0x167bbe);})['then'](function(_0xd4f150){_0x517d7d[_0xe1b7('0x48')]=_0xd4f150;return _0x517d7d;})[_0xe1b7('0x26')](respondWithFilteredResult(_0x50ca5b,_0x167bbe))[_0xe1b7('0x49')](handleError(_0x50ca5b,null));};exports[_0xe1b7('0x4a')]=function(_0x4addce,_0x459d66){var _0x23a208={'raw':!![],'where':{'id':_0x4addce[_0xe1b7('0x4b')]['id']}},_0x23ed7f={};_0x23ed7f[_0xe1b7('0x2f')]=_[_0xe1b7('0x31')](db[_0xe1b7('0x2b')][_0xe1b7('0x2c')]);_0x23ed7f[_0xe1b7('0x30')]=_['keys'](_0x4addce['query']);_0x23ed7f[_0xe1b7('0x3c')]=_[_0xe1b7('0x32')](_0x23ed7f['model'],_0x23ed7f['query']);_0x23a208['attributes']=_['intersection'](_0x23ed7f[_0xe1b7('0x2f')],qs[_0xe1b7('0x34')](_0x4addce[_0xe1b7('0x30')][_0xe1b7('0x34')]));_0x23a208[_0xe1b7('0x33')]=_0x23a208[_0xe1b7('0x33')]['length']?_0x23a208[_0xe1b7('0x33')]:_0x23ed7f[_0xe1b7('0x2f')];if(_0x4addce['query'][_0xe1b7('0x45')]){_0x23a208['include']=[{'all':!![]}];}_0x23a208=_[_0xe1b7('0x3f')]({},_0x23a208,_0x4addce[_0xe1b7('0x43')]);return db[_0xe1b7('0x2b')]['find'](_0x23a208)[_0xe1b7('0x26')](handleEntityNotFound(_0x459d66,null))[_0xe1b7('0x26')](respondWithResult(_0x459d66,null))[_0xe1b7('0x49')](handleError(_0x459d66,null));};exports[_0xe1b7('0x4c')]=function(_0x31d6a9,_0x262a8f){return db[_0xe1b7('0x2b')][_0xe1b7('0x4c')](_0x31d6a9[_0xe1b7('0x4d')],{})[_0xe1b7('0x26')](respondWithResult(_0x262a8f,0xc9))[_0xe1b7('0x49')](handleError(_0x262a8f,null));};exports[_0xe1b7('0x24')]=function(_0x4a2d7f,_0x201f5f){if(_0x4a2d7f[_0xe1b7('0x4d')]['id']){delete _0x4a2d7f[_0xe1b7('0x4d')]['id'];}return db[_0xe1b7('0x2b')]['find']({'where':{'id':_0x4a2d7f['params']['id']}})['then'](handleEntityNotFound(_0x201f5f,null))[_0xe1b7('0x26')](saveUpdates(_0x4a2d7f[_0xe1b7('0x4d')],null))['then'](respondWithResult(_0x201f5f,null))[_0xe1b7('0x49')](handleError(_0x201f5f,null));};exports[_0xe1b7('0x25')]=function(_0x22dca9,_0x5ca1e5){return db[_0xe1b7('0x2b')][_0xe1b7('0x4e')]({'where':{'id':_0x22dca9[_0xe1b7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5ca1e5,null))[_0xe1b7('0x26')](removeEntity(_0x5ca1e5,null))[_0xe1b7('0x49')](handleError(_0x5ca1e5,null));};exports['describe']=function(_0x5c93b9,_0x9444be){return db['SquareDetailsReport'][_0xe1b7('0x4f')]()['then'](respondWithResult(_0x9444be,null))['catch'](handleError(_0x9444be,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index e8035f9..809e493 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 _0x448f=['../../config/environment','./squareReportDetail.attributes','define','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x448f,0xd4));var _0xf448=function(_0x1bb161,_0x25b93c){_0x1bb161=_0x1bb161-0x0;var _0x2d4246=_0x448f[_0x1bb161];return _0x2d4246;};'use strict';var _=require(_0xf448('0x0'));var util=require(_0xf448('0x1'));var logger=require(_0xf448('0x2'))('api');var moment=require(_0xf448('0x3'));var BPromise=require(_0xf448('0x4'));var rp=require(_0xf448('0x5'));var fs=require('fs');var path=require(_0xf448('0x6'));var rimraf=require(_0xf448('0x7'));var config=require(_0xf448('0x8'));var attributes=require(_0xf448('0x9'));module['exports']=function(_0x365993,_0xf2819d){return _0x365993[_0xf448('0xa')]('SquareDetailsReport',attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa90b=['./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x467cb0,_0x303070){var _0x2153f7=function(_0x51775a){while(--_0x51775a){_0x467cb0['push'](_0x467cb0['shift']());}};_0x2153f7(++_0x303070);}(_0xa90b,0x10c));var _0xba90=function(_0xab9f3d,_0xb336fa){_0xab9f3d=_0xab9f3d-0x0;var _0x5283bf=_0xa90b[_0xab9f3d];return _0x5283bf;};'use strict';var _=require('lodash');var util=require(_0xba90('0x0'));var logger=require('../../config/logger')(_0xba90('0x1'));var moment=require(_0xba90('0x2'));var BPromise=require(_0xba90('0x3'));var rp=require(_0xba90('0x4'));var fs=require('fs');var path=require(_0xba90('0x5'));var rimraf=require(_0xba90('0x6'));var config=require(_0xba90('0x7'));var attributes=require(_0xba90('0x8'));module['exports']=function(_0x5b7452,_0x1d5f07){return _0x5b7452[_0xba90('0x9')](_0xba90('0xa'),attributes,{'tableName':_0xba90('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 5002e6d..f3015ef 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 _0x030f=['message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','then','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x030f,0xab));var _0xf030=function(_0x51786e,_0x5ee24e){_0x51786e=_0x51786e-0x0;var _0x25b5e2=_0x030f[_0x51786e];return _0x25b5e2;};'use strict';var _=require(_0xf030('0x0'));var util=require(_0xf030('0x1'));var moment=require(_0xf030('0x2'));var BPromise=require(_0xf030('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf030('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf030('0x5'));var logger=require(_0xf030('0x6'))('rpc');var config=require(_0xf030('0x7'));var jayson=require(_0xf030('0x8'));var client=jayson[_0xf030('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4caf25,_0x2bcb4a,_0x56f0f5){return new BPromise(function(_0x318fa8,_0x422253){return client[_0xf030('0xa')](_0x4caf25,_0x56f0f5)['then'](function(_0x310079){logger[_0xf030('0xb')](_0xf030('0xc'),_0x2bcb4a,_0xf030('0xd'));logger[_0xf030('0xe')](_0xf030('0xf'),_0x2bcb4a,'request\x20sent',JSON['stringify'](_0x310079));if(_0x310079['error']){if(_0x310079[_0xf030('0x10')][_0xf030('0x11')]===0x1f4){logger[_0xf030('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x2bcb4a,_0x310079[_0xf030('0x10')][_0xf030('0x12')]);return _0x422253(_0x310079['error'][_0xf030('0x12')]);}logger[_0xf030('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x2bcb4a,_0x310079[_0xf030('0x10')][_0xf030('0x12')]);return _0x318fa8(_0x310079[_0xf030('0x10')][_0xf030('0x12')]);}else{logger[_0xf030('0xb')](_0xf030('0xc'),_0x2bcb4a,_0xf030('0xd'));_0x318fa8(_0x310079[_0xf030('0x13')][_0xf030('0x12')]);}})[_0xf030('0x14')](function(_0xb6009a){logger[_0xf030('0x10')](_0xf030('0xc'),_0x2bcb4a,_0xb6009a);_0x422253(_0xb6009a);});});}exports[_0xf030('0x15')]=function(_0x1da2fd){var _0x371d8a=this;return new Promise(function(_0x1abbd2,_0x3af464){return db[_0xf030('0x16')][_0xf030('0x17')](_0x1da2fd[_0xf030('0x18')],{'raw':_0x1da2fd['options']?_0x1da2fd[_0xf030('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xf030('0x1a')](function(_0x23da62){logger[_0xf030('0xb')]('CreateSquareDetailsReport',_0x1da2fd);logger[_0xf030('0xe')](_0xf030('0x15'),_0x1da2fd,JSON['stringify'](_0x23da62));_0x1abbd2(_0x23da62);})[_0xf030('0x14')](function(_0x3ad4f8){logger[_0xf030('0x10')]('CreateSquareDetailsReport',_0x3ad4f8['message'],_0x1da2fd);_0x3af464(_0x371d8a[_0xf030('0x10')](0x1f4,_0x3ad4f8[_0xf030('0x12')]));});});}; \ No newline at end of file +var _0x9f8d=['stringify','error','message','result','CreateSquareDetailsReport','SquareDetailsReport','create','body','raw','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9f8d,0x167));var _0xd9f8=function(_0x1b8504,_0x441c97){_0x1b8504=_0x1b8504-0x0;var _0x3e9c77=_0x9f8d[_0x1b8504];return _0x3e9c77;};'use strict';var _=require(_0xd9f8('0x0'));var util=require(_0xd9f8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd9f8('0x2'));var fs=require('fs');var Redis=require(_0xd9f8('0x3'));var db=require(_0xd9f8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd9f8('0x5'))(_0xd9f8('0x6'));var config=require('../../config/environment');var jayson=require(_0xd9f8('0x7'));var client=jayson[_0xd9f8('0x8')][_0xd9f8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x821466,_0x2ff8e6,_0x2dcd44){return new BPromise(function(_0x307aaa,_0x4c5436){return client[_0xd9f8('0xa')](_0x821466,_0x2dcd44)['then'](function(_0x2cce96){logger[_0xd9f8('0xb')](_0xd9f8('0xc'),_0x2ff8e6,'request\x20sent');logger[_0xd9f8('0xd')](_0xd9f8('0xe'),_0x2ff8e6,_0xd9f8('0xf'),JSON[_0xd9f8('0x10')](_0x2cce96));if(_0x2cce96[_0xd9f8('0x11')]){if(_0x2cce96[_0xd9f8('0x11')]['code']===0x1f4){logger[_0xd9f8('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x2ff8e6,_0x2cce96['error'][_0xd9f8('0x12')]);return _0x4c5436(_0x2cce96['error']['message']);}logger[_0xd9f8('0x11')](_0xd9f8('0xc'),_0x2ff8e6,_0x2cce96[_0xd9f8('0x11')]['message']);return _0x307aaa(_0x2cce96[_0xd9f8('0x11')][_0xd9f8('0x12')]);}else{logger[_0xd9f8('0xb')](_0xd9f8('0xc'),_0x2ff8e6,'request\x20sent');_0x307aaa(_0x2cce96[_0xd9f8('0x13')][_0xd9f8('0x12')]);}})['catch'](function(_0x2339fc){logger[_0xd9f8('0x11')](_0xd9f8('0xc'),_0x2ff8e6,_0x2339fc);_0x4c5436(_0x2339fc);});});}exports[_0xd9f8('0x14')]=function(_0x582308){var _0xe8a79e=this;return new Promise(function(_0x4ae9ac,_0x142d44){return db[_0xd9f8('0x15')][_0xd9f8('0x16')](_0x582308[_0xd9f8('0x17')],{'raw':_0x582308['options']?_0x582308['options'][_0xd9f8('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x3a02ef){logger[_0xd9f8('0xb')](_0xd9f8('0x14'),_0x582308);logger[_0xd9f8('0xd')](_0xd9f8('0x14'),_0x582308,JSON['stringify'](_0x3a02ef));_0x4ae9ac(_0x3a02ef);})['catch'](function(_0x9cb580){logger[_0xd9f8('0x11')]('CreateSquareDetailsReport',_0x9cb580[_0xd9f8('0x12')],_0x582308);_0x142d44(_0xe8a79e[_0xd9f8('0x11')](0x1f4,_0x9cb580[_0xd9f8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 55d524a..908264a 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 _0xe438=['get','killProcess','exports','express','../../components/auth/service','./system.controller','isAuthenticated','index'];(function(_0x31fd1d,_0x217992){var _0x392eee=function(_0x5018d7){while(--_0x5018d7){_0x31fd1d['push'](_0x31fd1d['shift']());}};_0x392eee(++_0x217992);}(_0xe438,0x1e3));var _0x8e43=function(_0x131f78,_0x3fdd05){_0x131f78=_0x131f78-0x0;var _0x448e46=_0xe438[_0x131f78];return _0x448e46;};'use strict';var express=require(_0x8e43('0x0'));var router=express['Router']();var auth=require(_0x8e43('0x1'));var controller=require(_0x8e43('0x2'));router['get']('/',auth[_0x8e43('0x3')](),controller[_0x8e43('0x4')]);router[_0x8e43('0x5')]('/process/:pid/kill',auth['isAuthenticated'](),controller[_0x8e43('0x6')]);module[_0x8e43('0x7')]=router; \ No newline at end of file +var _0x5aaa=['killProcess','express','Router','get','isAuthenticated','/process/:pid/kill'];(function(_0x2ef393,_0x15b7f5){var _0x3e1a67=function(_0x5519f4){while(--_0x5519f4){_0x2ef393['push'](_0x2ef393['shift']());}};_0x3e1a67(++_0x15b7f5);}(_0x5aaa,0xeb));var _0xa5aa=function(_0x582d9e,_0x3c3ad2){_0x582d9e=_0x582d9e-0x0;var _0x4d8b92=_0x5aaa[_0x582d9e];return _0x4d8b92;};'use strict';var express=require(_0xa5aa('0x0'));var router=express[_0xa5aa('0x1')]();var auth=require('../../components/auth/service');var controller=require('./system.controller');router[_0xa5aa('0x2')]('/',auth[_0xa5aa('0x3')](),controller['index']);router[_0xa5aa('0x2')](_0xa5aa('0x4'),auth['isAuthenticated'](),controller[_0xa5aa('0x5')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 0ffdd60..9751e1e 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 _0x7412=['ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','../../config/logger','util','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','index','getAllData','then','json','killProcess','components/import/cm','format'];(function(_0x575fb9,_0x228530){var _0x332463=function(_0x5275b4){while(--_0x5275b4){_0x575fb9['push'](_0x575fb9['shift']());}};_0x332463(++_0x228530);}(_0x7412,0x161));var _0x2741=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x7412[_0x29d915];return _0x160f86;};'use strict';var info=require(_0x2741('0x0'));var exec=require('child_process')['exec'];var logger=require(_0x2741('0x1'))('api');var util=require(_0x2741('0x2'));var BPromise=require('bluebird');var _=require('lodash');function handleError(_0x509ce6,_0x552836,_0x521b65){_0x552836=_0x552836||0x1f4;return function(_0x4ea3e9){logger[_0x2741('0x3')](_0x2741('0x4'),_0x521b65,_0x552836,util[_0x2741('0x5')](_0x4ea3e9,{'showHidden':![],'depth':null}));delete _0x4ea3e9['name'];_0x509ce6[_0x2741('0x6')](_0x552836)[_0x2741('0x7')](_0x4ea3e9);};}exports[_0x2741('0x8')]=function(_0x2f3fb1,_0x5109f1){return info[_0x2741('0x9')]()[_0x2741('0xa')](function(_0x1aeaf9){return _0x5109f1[_0x2741('0x6')](0xc8)[_0x2741('0xb')](_0x1aeaf9);})['catch'](function(_0xf230d6){return _0x5109f1[_0x2741('0x6')](0x1f4)[_0x2741('0xb')](_0xf230d6);});};exports[_0x2741('0xc')]=function(_0x3c83ba,_0x3736f4){var _0x1f70d6=[_0x2741('0xd')];return new BPromise(function(_0x5115e9,_0x2311f2){return exec(util[_0x2741('0xe')](_0x2741('0xf'),_0x3c83ba[_0x2741('0x10')][_0x2741('0x11')]),function(_0xc535ee,_0x1738fa,_0x29838b){if(_0xc535ee){return _0x2311f2(_0xc535ee);}return _0x5115e9(_0x1738fa);});})[_0x2741('0xa')](function(_0x56a04c){var _0x1f7ef5=![];var _0x27eacd=_0x56a04c['split'](/\n/);for(var _0x22f12c=0x0,_0x4537c5=_0x1f70d6['length'];_0x22f12c<_0x4537c5,_0x1f7ef5===![];_0x22f12c+=0x1){if(_0x56a04c['indexOf'](_0x1f70d6[_0x22f12c])>=0x0){_0x1f7ef5=!![];}}if(!_0x1f7ef5){throw new Error(util[_0x2741('0xe')](_0x2741('0x12'),_0x3c83ba[_0x2741('0x10')][_0x2741('0x11')]));}process[_0x2741('0x13')](_0x3c83ba[_0x2741('0x10')][_0x2741('0x11')],_0x2741('0x14'));return _0x3736f4['status'](0xc8)[_0x2741('0xb')]({'message':util['format'](_0x2741('0x15'),_0x3c83ba['params']['pid'])});})[_0x2741('0x16')](handleError(_0x3736f4,null,_0x2741('0xc')));}; \ No newline at end of file +var _0x8463=['util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','send','index','getAllData','then','status','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api'];(function(_0x1db251,_0xf0443d){var _0x56685a=function(_0x6ec6b7){while(--_0x6ec6b7){_0x1db251['push'](_0x1db251['shift']());}};_0x56685a(++_0xf0443d);}(_0x8463,0x140));var _0x3846=function(_0x522058,_0x15af74){_0x522058=_0x522058-0x0;var _0x72cbb0=_0x8463[_0x522058];return _0x72cbb0;};'use strict';var info=require(_0x3846('0x0'));var exec=require(_0x3846('0x1'))['exec'];var logger=require(_0x3846('0x2'))(_0x3846('0x3'));var util=require(_0x3846('0x4'));var BPromise=require(_0x3846('0x5'));var _=require('lodash');function handleError(_0x22dbe7,_0x28939c,_0x4b1a52){_0x28939c=_0x28939c||0x1f4;return function(_0x2474ac){logger[_0x3846('0x6')](_0x3846('0x7'),_0x4b1a52,_0x28939c,util[_0x3846('0x8')](_0x2474ac,{'showHidden':![],'depth':null}));delete _0x2474ac[_0x3846('0x9')];_0x22dbe7['status'](_0x28939c)[_0x3846('0xa')](_0x2474ac);};}exports[_0x3846('0xb')]=function(_0x58af61,_0x1cb865){return info[_0x3846('0xc')]()[_0x3846('0xd')](function(_0x1424cc){return _0x1cb865[_0x3846('0xe')](0xc8)[_0x3846('0xf')](_0x1424cc);})[_0x3846('0x10')](function(_0x54760a){return _0x1cb865['status'](0x1f4)[_0x3846('0xf')](_0x54760a);});};exports[_0x3846('0x11')]=function(_0x140d17,_0xe9a85){var _0x23aa98=[_0x3846('0x12')];return new BPromise(function(_0x30e9be,_0x288f2e){return exec(util[_0x3846('0x13')](_0x3846('0x14'),_0x140d17[_0x3846('0x15')][_0x3846('0x16')]),function(_0x59bf6b,_0x2f434e,_0x5a605f){if(_0x59bf6b){return _0x288f2e(_0x59bf6b);}return _0x30e9be(_0x2f434e);});})['then'](function(_0x340c3d){var _0x4fc257=![];var _0x24664a=_0x340c3d['split'](/\n/);for(var _0x182605=0x0,_0x55710f=_0x23aa98['length'];_0x182605<_0x55710f,_0x4fc257===![];_0x182605+=0x1){if(_0x340c3d[_0x3846('0x17')](_0x23aa98[_0x182605])>=0x0){_0x4fc257=!![];}}if(!_0x4fc257){throw new Error(util['format'](_0x3846('0x18'),_0x140d17[_0x3846('0x15')][_0x3846('0x16')]));}process[_0x3846('0x19')](_0x140d17[_0x3846('0x15')]['pid'],'SIGINT');return _0xe9a85[_0x3846('0xe')](0xc8)['json']({'message':util[_0x3846('0x13')](_0x3846('0x1a'),_0x140d17[_0x3846('0x15')]['pid'])});})[_0x3846('0x10')](handleError(_0xe9a85,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 8f35014..d83721f 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 _0xa162=['exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','destroy'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xa162,0x169));var _0x2a16=function(_0x535ec4,_0x1c7370){_0x535ec4=_0x535ec4-0x0;var _0x2138ed=_0xa162[_0x535ec4];return _0x2138ed;};'use strict';var multer=require(_0x2a16('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2a16('0x1'));var express=require(_0x2a16('0x2'));var router=express[_0x2a16('0x3')]();var fs_extra=require(_0x2a16('0x4'));var auth=require(_0x2a16('0x5'));var interaction=require(_0x2a16('0x6'));var config=require(_0x2a16('0x7'));var controller=require(_0x2a16('0x8'));router['get']('/',auth[_0x2a16('0x9')](),controller[_0x2a16('0xa')]);router[_0x2a16('0xb')](_0x2a16('0xc'),auth[_0x2a16('0x9')](),controller[_0x2a16('0xd')]);router[_0x2a16('0xe')]('/',auth[_0x2a16('0x9')](),controller[_0x2a16('0xf')]);router['put'](_0x2a16('0xc'),auth[_0x2a16('0x9')](),controller[_0x2a16('0x10')]);router[_0x2a16('0x11')](_0x2a16('0xc'),auth[_0x2a16('0x9')](),controller[_0x2a16('0x12')]);module[_0x2a16('0x13')]=router; \ No newline at end of file +var _0x8ca7=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x45518f,_0x475a6b){var _0x198175=function(_0x40d333){while(--_0x40d333){_0x45518f['push'](_0x45518f['shift']());}};_0x198175(++_0x475a6b);}(_0x8ca7,0x9b));var _0x78ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ca7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x78ca('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x78ca('0x1'));var router=express[_0x78ca('0x2')]();var fs_extra=require(_0x78ca('0x3'));var auth=require(_0x78ca('0x4'));var interaction=require(_0x78ca('0x5'));var config=require(_0x78ca('0x6'));var controller=require('./tag.controller');router[_0x78ca('0x7')]('/',auth[_0x78ca('0x8')](),controller[_0x78ca('0x9')]);router[_0x78ca('0x7')](_0x78ca('0xa'),auth[_0x78ca('0x8')](),controller[_0x78ca('0xb')]);router[_0x78ca('0xc')]('/',auth[_0x78ca('0x8')](),controller[_0x78ca('0xd')]);router[_0x78ca('0xe')](_0x78ca('0xa'),auth[_0x78ca('0x8')](),controller[_0x78ca('0xf')]);router[_0x78ca('0x10')](_0x78ca('0xa'),auth[_0x78ca('0x8')](),controller[_0x78ca('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index a557051..66680c1 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 _0x0713=['#0091EA','STRING','name'];(function(_0x4a4ac7,_0x31b0d6){var _0x4c08db=function(_0x3377e2){while(--_0x3377e2){_0x4a4ac7['push'](_0x4a4ac7['shift']());}};_0x4c08db(++_0x31b0d6);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'unique':_0x3071('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0x2')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0xda3f=['exports','STRING'];(function(_0x377700,_0x235235){var _0x1fc4d6=function(_0x29bb70){while(--_0x29bb70){_0x377700['push'](_0x377700['shift']());}};_0x1fc4d6(++_0x235235);}(_0xda3f,0xec));var _0xfda3=function(_0x5f7079,_0x557a2d){_0x5f7079=_0x5f7079-0x0;var _0x103cb8=_0xda3f[_0x5f7079];return _0x103cb8;};'use strict';var Sequelize=require('sequelize');module[_0xfda3('0x0')]={'name':{'type':Sequelize[_0xfda3('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xfda3('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 61b8766..3e466ce 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 _0x9957=['lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','save','update','then','destroy','get','Tags','UserProfileResource','end','error','stack','name','send','map','Tag','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','fields','model','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var fs_extra=require(_0x7995('0xc'));var _=require(_0x7995('0xd'));var squel=require('squel');var crypto=require(_0x7995('0xe'));var jsforce=require(_0x7995('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7995('0xa'));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('../../config/license/hardware');var logger=require(_0x7995('0x16'))(_0x7995('0x17'));var utils=require('../../config/utils');var config=require(_0x7995('0x18'));var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x385f00,_0x281576){_0x281576=_0x281576||0xcc;return function(_0x23999f){if(_0x23999f){return _0x385f00[_0x7995('0x1b')](_0x281576);}return _0x385f00['status'](_0x281576)['end']();};}function respondWithResult(_0x2b4e94,_0x2233dd){_0x2233dd=_0x2233dd||0xc8;return function(_0x24b5bb){if(_0x24b5bb){return _0x2b4e94[_0x7995('0x1c')](_0x2233dd)[_0x7995('0x1d')](_0x24b5bb);}};}function respondWithFilteredResult(_0x1a5310,_0x2202ce){return function(_0x41cbf0){if(_0x41cbf0){var _0x5377e5=_0x41cbf0[_0x7995('0x1e')],_0x2eeacc=_0x2202ce[_0x7995('0x1f')],_0x565d97=_0x2202ce[_0x7995('0x1f')]+_0x2202ce[_0x7995('0x20')],_0x2f832e;if(_0x565d97>=_0x5377e5){_0x565d97=_0x5377e5;_0x2f832e=0xc8;}else{_0x2f832e=0xce;}_0x1a5310[_0x7995('0x1c')](_0x2f832e);return _0x1a5310['set']('Content-Range',_0x2eeacc+'-'+_0x565d97+'/'+_0x5377e5)[_0x7995('0x1d')](_0x41cbf0);}return null;};}function patchUpdates(_0x5e6f90){return function(_0x555f74){try{jsonpatch[_0x7995('0x21')](_0x555f74,_0x5e6f90,!![]);}catch(_0x3d463e){return BPromise['reject'](_0x3d463e);}return _0x555f74[_0x7995('0x22')]();};}function saveUpdates(_0x51f276,_0x4b1a8e){return function(_0x3e4c54){if(_0x3e4c54){return _0x3e4c54[_0x7995('0x23')](_0x51f276)[_0x7995('0x24')](function(_0x1a8568){return _0x1a8568;});}return null;};}function removeEntity(_0x460924,_0x1c278a){return function(_0x5d40ae){if(_0x5d40ae){return _0x5d40ae[_0x7995('0x25')]()[_0x7995('0x24')](function(){var _0x204507=_0x5d40ae[_0x7995('0x26')]({'plain':!![]});var _0x563799=_0x7995('0x27');return db[_0x7995('0x28')][_0x7995('0x25')]({'where':{'type':_0x563799,'resourceId':_0x204507['id']}})['then'](function(){return _0x5d40ae;});})[_0x7995('0x24')](function(){_0x460924[_0x7995('0x1c')](0xcc)[_0x7995('0x29')]();});}};}function handleEntityNotFound(_0x268ce7,_0x3a3fcf){return function(_0x2a307e){if(!_0x2a307e){_0x268ce7['sendStatus'](0x194);}return _0x2a307e;};}function handleError(_0x47625f,_0x5911c3){_0x5911c3=_0x5911c3||0x1f4;return function(_0x229742){logger[_0x7995('0x2a')](_0x229742[_0x7995('0x2b')]);if(_0x229742[_0x7995('0x2c')]){delete _0x229742[_0x7995('0x2c')];}_0x47625f['status'](_0x5911c3)[_0x7995('0x2d')](_0x229742);};}exports['index']=function(_0x456a28,_0x3250e0){var _0x4253e5={},_0x574574={},_0x530611={'count':0x0,'rows':[]};var _0x48e573=_[_0x7995('0x2e')](db[_0x7995('0x2f')][_0x7995('0x30')],function(_0x2b874d){return{'name':_0x2b874d[_0x7995('0x31')],'type':_0x2b874d[_0x7995('0x32')]['key']};});_0x574574['model']=_[_0x7995('0x2e')](_0x48e573,'name');_0x574574[_0x7995('0x33')]=_[_0x7995('0x34')](_0x456a28[_0x7995('0x33')]);_0x574574[_0x7995('0x35')]=_[_0x7995('0x36')](_0x574574['model'],_0x574574[_0x7995('0x33')]);_0x4253e5[_0x7995('0x37')]=_['intersection'](_0x574574['model'],qs['fields'](_0x456a28[_0x7995('0x33')][_0x7995('0x38')]));_0x4253e5['attributes']=_0x4253e5[_0x7995('0x37')]['length']?_0x4253e5[_0x7995('0x37')]:_0x574574[_0x7995('0x39')];if(!_0x456a28[_0x7995('0x33')]['hasOwnProperty']('nolimit')){_0x4253e5[_0x7995('0x20')]=qs['limit'](_0x456a28['query'][_0x7995('0x20')]);_0x4253e5[_0x7995('0x1f')]=qs['offset'](_0x456a28[_0x7995('0x33')][_0x7995('0x1f')]);}_0x4253e5[_0x7995('0x3a')]=qs[_0x7995('0x3b')](_0x456a28[_0x7995('0x33')]['sort']);_0x4253e5[_0x7995('0x3c')]=qs[_0x7995('0x35')](_[_0x7995('0x3d')](_0x456a28[_0x7995('0x33')],_0x574574['filters']),_0x48e573);if(_0x456a28[_0x7995('0x33')][_0x7995('0x3e')]){_0x4253e5[_0x7995('0x3c')]=_[_0x7995('0x3f')](_0x4253e5[_0x7995('0x3c')],{'$or':_[_0x7995('0x2e')](_0x48e573,function(_0x5688a1){if(_0x5688a1[_0x7995('0x32')]!==_0x7995('0x40')){var _0x8a1be0={};_0x8a1be0[_0x5688a1[_0x7995('0x2c')]]={'$like':'%'+_0x456a28[_0x7995('0x33')][_0x7995('0x3e')]+'%'};return _0x8a1be0;}})});}_0x4253e5=_[_0x7995('0x3f')]({},_0x4253e5,_0x456a28[_0x7995('0x41')]);var _0x1234e1={'where':_0x4253e5[_0x7995('0x3c')]};return db[_0x7995('0x2f')][_0x7995('0x1e')](_0x1234e1)[_0x7995('0x24')](function(_0x53cda2){_0x530611['count']=_0x53cda2;if(_0x456a28[_0x7995('0x33')][_0x7995('0x42')]){_0x4253e5['include']=[{'all':!![]}];}return db['Tag'][_0x7995('0x43')](_0x4253e5);})['then'](function(_0x504a33){_0x530611[_0x7995('0x44')]=_0x504a33;return _0x530611;})[_0x7995('0x24')](respondWithFilteredResult(_0x3250e0,_0x4253e5))[_0x7995('0x45')](handleError(_0x3250e0,null));};exports['show']=function(_0x46ac4f,_0x5e85b9){var _0x3993b5={'raw':!![],'where':{'id':_0x46ac4f['params']['id']}},_0x5a8881={};_0x5a8881[_0x7995('0x39')]=_[_0x7995('0x34')](db[_0x7995('0x2f')][_0x7995('0x30')]);_0x5a8881['query']=_[_0x7995('0x34')](_0x46ac4f[_0x7995('0x33')]);_0x5a8881[_0x7995('0x35')]=_[_0x7995('0x36')](_0x5a8881['model'],_0x5a8881['query']);_0x3993b5[_0x7995('0x37')]=_['intersection'](_0x5a8881[_0x7995('0x39')],qs['fields'](_0x46ac4f[_0x7995('0x33')]['fields']));_0x3993b5[_0x7995('0x37')]=_0x3993b5[_0x7995('0x37')]['length']?_0x3993b5[_0x7995('0x37')]:_0x5a8881[_0x7995('0x39')];if(_0x46ac4f[_0x7995('0x33')][_0x7995('0x42')]){_0x3993b5['include']=[{'all':!![]}];}_0x3993b5=_[_0x7995('0x3f')]({},_0x3993b5,_0x46ac4f[_0x7995('0x41')]);return db[_0x7995('0x2f')]['find'](_0x3993b5)[_0x7995('0x24')](handleEntityNotFound(_0x5e85b9,null))[_0x7995('0x24')](respondWithResult(_0x5e85b9,null))[_0x7995('0x45')](handleError(_0x5e85b9,null));};exports[_0x7995('0x46')]=function(_0x255313,_0x51934b){return db[_0x7995('0x2f')][_0x7995('0x46')](_0x255313['body'],{})[_0x7995('0x24')](function(_0x5843ba){var _0x1d87f9=_0x255313[_0x7995('0x47')][_0x7995('0x26')]({'plain':!![]});if(!_0x1d87f9)throw new Error(_0x7995('0x48'));if(_0x1d87f9[_0x7995('0x49')]===_0x7995('0x47')){var _0x1579b9=_0x5843ba['get']({'plain':!![]});var _0x427dcf=_0x7995('0x27');return db[_0x7995('0x4a')]['find']({'where':{'name':_0x427dcf,'userProfileId':_0x1d87f9[_0x7995('0x4b')]},'raw':!![]})[_0x7995('0x24')](function(_0x12d4b8){if(_0x12d4b8&&_0x12d4b8['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x1579b9[_0x7995('0x2c')],'resourceId':_0x1579b9['id'],'type':_0x12d4b8[_0x7995('0x2c')],'sectionId':_0x12d4b8['id']},{})['then'](function(){return _0x5843ba;});}else{return _0x5843ba;}})[_0x7995('0x45')](function(_0x29f300){logger[_0x7995('0x2a')](_0x7995('0x4c'),_0x29f300);throw _0x29f300;});}return _0x5843ba;})[_0x7995('0x24')](respondWithResult(_0x51934b,0xc9))['catch'](handleError(_0x51934b,null));};exports[_0x7995('0x23')]=function(_0x4ab09f,_0x14fe7f){if(_0x4ab09f[_0x7995('0x4d')]['id']){delete _0x4ab09f[_0x7995('0x4d')]['id'];}return db['Tag']['find']({'where':{'id':_0x4ab09f['params']['id']}})['then'](handleEntityNotFound(_0x14fe7f,null))[_0x7995('0x24')](saveUpdates(_0x4ab09f[_0x7995('0x4d')],null))[_0x7995('0x24')](respondWithResult(_0x14fe7f,null))[_0x7995('0x45')](handleError(_0x14fe7f,null));};exports[_0x7995('0x25')]=function(_0x357e60,_0x1f4270){return db[_0x7995('0x2f')][_0x7995('0x4e')]({'where':{'id':_0x357e60[_0x7995('0x4f')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x1f4270,null))[_0x7995('0x24')](removeEntity(_0x1f4270,null))[_0x7995('0x45')](handleError(_0x1f4270,null));}; \ No newline at end of file +var _0x7a54=['includeAll','include','findAll','rows','catch','show','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','json','apply','save','update','then','destroy','get','Tags','UserProfileResource','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','filters','filter','merge','VIRTUAL'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x7a54,0x106));var _0x47a5=function(_0x492e6c,_0x5f4190){_0x492e6c=_0x492e6c-0x0;var _0x387de8=_0x7a54[_0x492e6c];return _0x387de8;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x47a5('0xb'));var squel=require(_0x47a5('0xc'));var crypto=require('crypto');var jsforce=require(_0x47a5('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x47a5('0xe'));var Redis=require(_0x47a5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x47a5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x47a5('0x11'))(_0x47a5('0x12'));var utils=require(_0x47a5('0x13'));var config=require(_0x47a5('0x14'));var licenseUtil=require(_0x47a5('0x15'));var db=require(_0x47a5('0x16'))['db'];function respondWithStatusCode(_0x1eae59,_0x5beb89){_0x5beb89=_0x5beb89||0xcc;return function(_0x44bd3e){if(_0x44bd3e){return _0x1eae59[_0x47a5('0x17')](_0x5beb89);}return _0x1eae59[_0x47a5('0x18')](_0x5beb89)[_0x47a5('0x19')]();};}function respondWithResult(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xc8;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x18')](_0x620ee9)['json'](_0x3c6c46);}};}function respondWithFilteredResult(_0x362359,_0x11faf5){return function(_0x3b001e){if(_0x3b001e){var _0x2a2cbb=_0x3b001e[_0x47a5('0x1a')],_0x1ef44c=_0x11faf5['offset'],_0x574af6=_0x11faf5['offset']+_0x11faf5[_0x47a5('0x1b')],_0x549de3;if(_0x574af6>=_0x2a2cbb){_0x574af6=_0x2a2cbb;_0x549de3=0xc8;}else{_0x549de3=0xce;}_0x362359[_0x47a5('0x18')](_0x549de3);return _0x362359[_0x47a5('0x1c')](_0x47a5('0x1d'),_0x1ef44c+'-'+_0x574af6+'/'+_0x2a2cbb)[_0x47a5('0x1e')](_0x3b001e);}return null;};}function patchUpdates(_0x12b98e){return function(_0x2763d6){try{jsonpatch[_0x47a5('0x1f')](_0x2763d6,_0x12b98e,!![]);}catch(_0x3aed38){return BPromise['reject'](_0x3aed38);}return _0x2763d6[_0x47a5('0x20')]();};}function saveUpdates(_0xf160ba,_0x47cf3c){return function(_0x2b0360){if(_0x2b0360){return _0x2b0360[_0x47a5('0x21')](_0xf160ba)[_0x47a5('0x22')](function(_0x4c5910){return _0x4c5910;});}return null;};}function removeEntity(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x23')]()['then'](function(){var _0xe2dea9=_0x23db32[_0x47a5('0x24')]({'plain':!![]});var _0x513981=_0x47a5('0x25');return db[_0x47a5('0x26')][_0x47a5('0x23')]({'where':{'type':_0x513981,'resourceId':_0xe2dea9['id']}})[_0x47a5('0x22')](function(){return _0x23db32;});})[_0x47a5('0x22')](function(){_0xb8ae6c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x136745,_0x5686db){return function(_0x1ea9c8){if(!_0x1ea9c8){_0x136745['sendStatus'](0x194);}return _0x1ea9c8;};}function handleError(_0x23cb77,_0x378208){_0x378208=_0x378208||0x1f4;return function(_0x36ad34){logger[_0x47a5('0x27')](_0x36ad34[_0x47a5('0x28')]);if(_0x36ad34[_0x47a5('0x29')]){delete _0x36ad34[_0x47a5('0x29')];}_0x23cb77[_0x47a5('0x18')](_0x378208)[_0x47a5('0x2a')](_0x36ad34);};}exports[_0x47a5('0x2b')]=function(_0x1127f8,_0x11a4fa){var _0x3ad507={},_0x528582={},_0x243210={'count':0x0,'rows':[]};var _0x51833b=_[_0x47a5('0x2c')](db[_0x47a5('0x2d')][_0x47a5('0x2e')],function(_0x4d6b57){return{'name':_0x4d6b57[_0x47a5('0x2f')],'type':_0x4d6b57[_0x47a5('0x30')][_0x47a5('0x31')]};});_0x528582[_0x47a5('0x32')]=_['map'](_0x51833b,'name');_0x528582[_0x47a5('0x33')]=_[_0x47a5('0x34')](_0x1127f8['query']);_0x528582['filters']=_[_0x47a5('0x35')](_0x528582[_0x47a5('0x32')],_0x528582['query']);_0x3ad507[_0x47a5('0x36')]=_['intersection'](_0x528582[_0x47a5('0x32')],qs[_0x47a5('0x37')](_0x1127f8['query']['fields']));_0x3ad507[_0x47a5('0x36')]=_0x3ad507['attributes'][_0x47a5('0x38')]?_0x3ad507[_0x47a5('0x36')]:_0x528582[_0x47a5('0x32')];if(!_0x1127f8['query'][_0x47a5('0x39')]('nolimit')){_0x3ad507['limit']=qs[_0x47a5('0x1b')](_0x1127f8['query'][_0x47a5('0x1b')]);_0x3ad507['offset']=qs[_0x47a5('0x3a')](_0x1127f8[_0x47a5('0x33')][_0x47a5('0x3a')]);}_0x3ad507[_0x47a5('0x3b')]=qs[_0x47a5('0x3c')](_0x1127f8[_0x47a5('0x33')][_0x47a5('0x3c')]);_0x3ad507[_0x47a5('0x3d')]=qs[_0x47a5('0x3e')](_['pick'](_0x1127f8[_0x47a5('0x33')],_0x528582[_0x47a5('0x3e')]),_0x51833b);if(_0x1127f8['query'][_0x47a5('0x3f')]){_0x3ad507[_0x47a5('0x3d')]=_[_0x47a5('0x40')](_0x3ad507['where'],{'$or':_[_0x47a5('0x2c')](_0x51833b,function(_0x10f660){if(_0x10f660['type']!==_0x47a5('0x41')){var _0x19218a={};_0x19218a[_0x10f660['name']]={'$like':'%'+_0x1127f8['query']['filter']+'%'};return _0x19218a;}})});}_0x3ad507=_[_0x47a5('0x40')]({},_0x3ad507,_0x1127f8['options']);var _0x9b5eaf={'where':_0x3ad507[_0x47a5('0x3d')]};return db[_0x47a5('0x2d')][_0x47a5('0x1a')](_0x9b5eaf)[_0x47a5('0x22')](function(_0xcb5243){_0x243210[_0x47a5('0x1a')]=_0xcb5243;if(_0x1127f8[_0x47a5('0x33')][_0x47a5('0x42')]){_0x3ad507[_0x47a5('0x43')]=[{'all':!![]}];}return db[_0x47a5('0x2d')][_0x47a5('0x44')](_0x3ad507);})[_0x47a5('0x22')](function(_0x56dbbd){_0x243210[_0x47a5('0x45')]=_0x56dbbd;return _0x243210;})[_0x47a5('0x22')](respondWithFilteredResult(_0x11a4fa,_0x3ad507))[_0x47a5('0x46')](handleError(_0x11a4fa,null));};exports[_0x47a5('0x47')]=function(_0x586f4f,_0x7de536){var _0x528ef3={'raw':!![],'where':{'id':_0x586f4f['params']['id']}},_0x47c7a2={};_0x47c7a2['model']=_[_0x47a5('0x34')](db['Tag'][_0x47a5('0x2e')]);_0x47c7a2[_0x47a5('0x33')]=_[_0x47a5('0x34')](_0x586f4f['query']);_0x47c7a2[_0x47a5('0x3e')]=_[_0x47a5('0x35')](_0x47c7a2['model'],_0x47c7a2['query']);_0x528ef3[_0x47a5('0x36')]=_['intersection'](_0x47c7a2[_0x47a5('0x32')],qs[_0x47a5('0x37')](_0x586f4f[_0x47a5('0x33')][_0x47a5('0x37')]));_0x528ef3[_0x47a5('0x36')]=_0x528ef3[_0x47a5('0x36')][_0x47a5('0x38')]?_0x528ef3[_0x47a5('0x36')]:_0x47c7a2[_0x47a5('0x32')];if(_0x586f4f[_0x47a5('0x33')][_0x47a5('0x42')]){_0x528ef3[_0x47a5('0x43')]=[{'all':!![]}];}_0x528ef3=_[_0x47a5('0x40')]({},_0x528ef3,_0x586f4f[_0x47a5('0x48')]);return db[_0x47a5('0x2d')][_0x47a5('0x49')](_0x528ef3)['then'](handleEntityNotFound(_0x7de536,null))[_0x47a5('0x22')](respondWithResult(_0x7de536,null))[_0x47a5('0x46')](handleError(_0x7de536,null));};exports['create']=function(_0x52b3a8,_0x3d0a88){return db['Tag'][_0x47a5('0x4a')](_0x52b3a8[_0x47a5('0x4b')],{})['then'](function(_0x4f62d3){var _0x3d85cc=_0x52b3a8['user'][_0x47a5('0x24')]({'plain':!![]});if(!_0x3d85cc)throw new Error(_0x47a5('0x4c'));if(_0x3d85cc[_0x47a5('0x4d')]===_0x47a5('0x4e')){var _0x44fe8a=_0x4f62d3[_0x47a5('0x24')]({'plain':!![]});var _0x238ebb='Tags';return db['UserProfileSection'][_0x47a5('0x49')]({'where':{'name':_0x238ebb,'userProfileId':_0x3d85cc[_0x47a5('0x4f')]},'raw':!![]})[_0x47a5('0x22')](function(_0x9ea93e){if(_0x9ea93e&&_0x9ea93e[_0x47a5('0x50')]===0x0){return db[_0x47a5('0x26')][_0x47a5('0x4a')]({'name':_0x44fe8a['name'],'resourceId':_0x44fe8a['id'],'type':_0x9ea93e[_0x47a5('0x29')],'sectionId':_0x9ea93e['id']},{})[_0x47a5('0x22')](function(){return _0x4f62d3;});}else{return _0x4f62d3;}})[_0x47a5('0x46')](function(_0x5c3c75){logger[_0x47a5('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c3c75);throw _0x5c3c75;});}return _0x4f62d3;})[_0x47a5('0x22')](respondWithResult(_0x3d0a88,0xc9))[_0x47a5('0x46')](handleError(_0x3d0a88,null));};exports[_0x47a5('0x21')]=function(_0xf03bd5,_0x588551){if(_0xf03bd5[_0x47a5('0x4b')]['id']){delete _0xf03bd5[_0x47a5('0x4b')]['id'];}return db[_0x47a5('0x2d')][_0x47a5('0x49')]({'where':{'id':_0xf03bd5[_0x47a5('0x51')]['id']}})[_0x47a5('0x22')](handleEntityNotFound(_0x588551,null))[_0x47a5('0x22')](saveUpdates(_0xf03bd5['body'],null))[_0x47a5('0x22')](respondWithResult(_0x588551,null))[_0x47a5('0x46')](handleError(_0x588551,null));};exports[_0x47a5('0x23')]=function(_0x8da9fb,_0x3329aa){return db[_0x47a5('0x2d')]['find']({'where':{'id':_0x8da9fb[_0x47a5('0x51')]['id']}})[_0x47a5('0x22')](handleEntityNotFound(_0x3329aa,null))[_0x47a5('0x22')](removeEntity(_0x3329aa,null))['catch'](handleError(_0x3329aa,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index d68cca2..33ddf8f 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 _0x6076=['tools_tags','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x6076,0xaa));var _0x6607=function(_0x3cca0d,_0x34b580){_0x3cca0d=_0x3cca0d-0x0;var _0x1b3bf7=_0x6076[_0x3cca0d];return _0x1b3bf7;};'use strict';var _=require(_0x6607('0x0'));var util=require('util');var logger=require(_0x6607('0x1'))(_0x6607('0x2'));var moment=require(_0x6607('0x3'));var BPromise=require(_0x6607('0x4'));var rp=require(_0x6607('0x5'));var fs=require('fs');var path=require(_0x6607('0x6'));var rimraf=require(_0x6607('0x7'));var config=require(_0x6607('0x8'));var attributes=require(_0x6607('0x9'));module[_0x6607('0xa')]=function(_0x4e48cd,_0x485fd1){return _0x4e48cd[_0x6607('0xb')]('Tag',attributes,{'tableName':_0x6607('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x988c=['bluebird','request-promise','./tag.attributes','exports','define','Tag','lodash','moment'];(function(_0x50cf3a,_0x265e83){var _0x41e677=function(_0x4d35ed){while(--_0x4d35ed){_0x50cf3a['push'](_0x50cf3a['shift']());}};_0x41e677(++_0x265e83);}(_0x988c,0x19e));var _0xc988=function(_0x4feadb,_0x43bfe9){_0x4feadb=_0x4feadb-0x0;var _0x17789b=_0x988c[_0x4feadb];return _0x17789b;};'use strict';var _=require(_0xc988('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc988('0x1'));var BPromise=require(_0xc988('0x2'));var rp=require(_0xc988('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc988('0x4'));module[_0xc988('0x5')]=function(_0x17fa32,_0x56317c){return _0x17fa32[_0xc988('0x6')](_0xc988('0x7'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 0e2f655..b8a114b 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 _0x2e54=['rpc','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3f6e26,_0x811a34){var _0x474345=function(_0x4a0cbe){while(--_0x4a0cbe){_0x3f6e26['push'](_0x3f6e26['shift']());}};_0x474345(++_0x811a34);}(_0x2e54,0x1dd));var _0x42e5=function(_0x75228d,_0x55ca31){_0x75228d=_0x75228d-0x0;var _0x36ba5d=_0x2e54[_0x75228d];return _0x36ba5d;};'use strict';var _=require(_0x42e5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x42e5('0x1'));var rs=require(_0x42e5('0x2'));var fs=require('fs');var Redis=require(_0x42e5('0x3'));var db=require(_0x42e5('0x4'))['db'];var utils=require(_0x42e5('0x5'));var logger=require(_0x42e5('0x6'))(_0x42e5('0x7'));var config=require('../../config/environment');var jayson=require(_0x42e5('0x8'));var client=jayson[_0x42e5('0x9')][_0x42e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bed10,_0x2af5bb,_0x56be20){return new BPromise(function(_0x335b92,_0x490b99){return client[_0x42e5('0xb')](_0x4bed10,_0x56be20)[_0x42e5('0xc')](function(_0x10ee5a){logger[_0x42e5('0xd')](_0x42e5('0xe'),_0x2af5bb,_0x42e5('0xf'));logger[_0x42e5('0x10')](_0x42e5('0x11'),_0x2af5bb,_0x42e5('0xf'),JSON['stringify'](_0x10ee5a));if(_0x10ee5a[_0x42e5('0x12')]){if(_0x10ee5a[_0x42e5('0x12')]['code']===0x1f4){logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);return _0x490b99(_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);}logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);return _0x335b92(_0x10ee5a['error'][_0x42e5('0x13')]);}else{logger[_0x42e5('0xd')](_0x42e5('0xe'),_0x2af5bb,_0x42e5('0xf'));_0x335b92(_0x10ee5a[_0x42e5('0x14')][_0x42e5('0x13')]);}})[_0x42e5('0x15')](function(_0x3abe3d){logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x3abe3d);_0x490b99(_0x3abe3d);});});} \ No newline at end of file +var _0xb9a7=['request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Tag,\x20%s,\x20%s'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xb9a7,0x112));var _0x7b9a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xb9a7[_0x51020b];return _0x371e47;};'use strict';var _=require('lodash');var util=require(_0x7b9a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b9a('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b9a('0x2'));var logger=require(_0x7b9a('0x3'))(_0x7b9a('0x4'));var config=require(_0x7b9a('0x5'));var jayson=require(_0x7b9a('0x6'));var client=jayson[_0x7b9a('0x7')][_0x7b9a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7019fd,_0x37ce81,_0x3e51f0){return new BPromise(function(_0x4d3f20,_0x43d8e2){return client[_0x7b9a('0x9')](_0x7019fd,_0x3e51f0)['then'](function(_0x511e28){logger['info'](_0x7b9a('0xa'),_0x37ce81,_0x7b9a('0xb'));logger['debug'](_0x7b9a('0xc'),_0x37ce81,'request\x20sent',JSON[_0x7b9a('0xd')](_0x511e28));if(_0x511e28['error']){if(_0x511e28[_0x7b9a('0xe')][_0x7b9a('0xf')]===0x1f4){logger[_0x7b9a('0xe')]('Tag,\x20%s,\x20%s',_0x37ce81,_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);return _0x43d8e2(_0x511e28['error'][_0x7b9a('0x10')]);}logger[_0x7b9a('0xe')]('Tag,\x20%s,\x20%s',_0x37ce81,_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);return _0x4d3f20(_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);}else{logger[_0x7b9a('0x11')](_0x7b9a('0xa'),_0x37ce81,_0x7b9a('0xb'));_0x4d3f20(_0x511e28[_0x7b9a('0x12')][_0x7b9a('0x10')]);}})['catch'](function(_0x34a82d){logger['error'](_0x7b9a('0xa'),_0x37ce81,_0x34a82d);_0x43d8e2(_0x34a82d);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 3fb6674..9e4a08d 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 _0x084e=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','isAuthenticated','show','/:id/queues','/:id/users','getAgents','post','create','addQueues','addAgents','update','destroy','removeQueues','delete','removeAgents','exports','util'];(function(_0xcda84f,_0x4d7c49){var _0x4ae45e=function(_0xc5ecfd){while(--_0xc5ecfd){_0xcda84f['push'](_0xcda84f['shift']());}};_0x4ae45e(++_0x4d7c49);}(_0x084e,0x6b));var _0xe084=function(_0x4cdbb2,_0x7c8b5a){_0x4cdbb2=_0x4cdbb2-0x0;var _0x2f6dba=_0x084e[_0x4cdbb2];return _0x2f6dba;};'use strict';var multer=require('multer');var util=require(_0xe084('0x0'));var path=require(_0xe084('0x1'));var timeout=require(_0xe084('0x2'));var express=require(_0xe084('0x3'));var router=express[_0xe084('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe084('0x5'));var interaction=require(_0xe084('0x6'));var config=require(_0xe084('0x7'));var controller=require(_0xe084('0x8'));router[_0xe084('0x9')]('/',auth['isAuthenticated'](),controller[_0xe084('0xa')]);router[_0xe084('0x9')](_0xe084('0xb'),auth[_0xe084('0xc')](),controller[_0xe084('0xd')]);router[_0xe084('0x9')](_0xe084('0xe'),auth[_0xe084('0xc')](),controller['getQueues']);router['get'](_0xe084('0xf'),auth['isAuthenticated'](),controller[_0xe084('0x10')]);router[_0xe084('0x11')]('/',auth['isAuthenticated'](),controller[_0xe084('0x12')]);router[_0xe084('0x11')]('/:id/queues',auth[_0xe084('0xc')](),controller[_0xe084('0x13')]);router[_0xe084('0x11')](_0xe084('0xf'),auth[_0xe084('0xc')](),controller[_0xe084('0x14')]);router['put'](_0xe084('0xb'),auth[_0xe084('0xc')](),controller[_0xe084('0x15')]);router['delete'](_0xe084('0xb'),auth[_0xe084('0xc')](),controller[_0xe084('0x16')]);router['delete'](_0xe084('0xe'),auth[_0xe084('0xc')](),controller[_0xe084('0x17')]);router[_0xe084('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0xe084('0x19')]);module[_0xe084('0x1a')]=router; \ No newline at end of file +var _0xd41f=['addAgents','put','update','delete','removeQueues','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./team.controller','get','index','/:id','isAuthenticated','/:id/queues','getQueues','/:id/users','post','create','addQueues'];(function(_0x4afee1,_0x590539){var _0x4a7087=function(_0x564136){while(--_0x564136){_0x4afee1['push'](_0x4afee1['shift']());}};_0x4a7087(++_0x590539);}(_0xd41f,0x197));var _0xfd41=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd41f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfd41('0x0'));var util=require(_0xfd41('0x1'));var path=require('path');var timeout=require(_0xfd41('0x2'));var express=require(_0xfd41('0x3'));var router=express[_0xfd41('0x4')]();var fs_extra=require(_0xfd41('0x5'));var auth=require(_0xfd41('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfd41('0x7'));router[_0xfd41('0x8')]('/',auth['isAuthenticated'](),controller[_0xfd41('0x9')]);router['get'](_0xfd41('0xa'),auth[_0xfd41('0xb')](),controller['show']);router[_0xfd41('0x8')](_0xfd41('0xc'),auth['isAuthenticated'](),controller[_0xfd41('0xd')]);router[_0xfd41('0x8')](_0xfd41('0xe'),auth[_0xfd41('0xb')](),controller['getAgents']);router[_0xfd41('0xf')]('/',auth['isAuthenticated'](),controller[_0xfd41('0x10')]);router[_0xfd41('0xf')](_0xfd41('0xc'),auth['isAuthenticated'](),controller[_0xfd41('0x11')]);router[_0xfd41('0xf')](_0xfd41('0xe'),auth[_0xfd41('0xb')](),controller[_0xfd41('0x12')]);router[_0xfd41('0x13')](_0xfd41('0xa'),auth['isAuthenticated'](),controller[_0xfd41('0x14')]);router[_0xfd41('0x15')](_0xfd41('0xa'),auth[_0xfd41('0xb')](),controller['destroy']);router[_0xfd41('0x15')](_0xfd41('0xc'),auth[_0xfd41('0xb')](),controller[_0xfd41('0x16')]);router[_0xfd41('0x15')](_0xfd41('0xe'),auth[_0xfd41('0xb')](),controller[_0xfd41('0x17')]);module[_0xfd41('0x18')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index cd4e00e..b299113 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 _0x7be9=['sequelize','STRING','name'];(function(_0x4eeaac,_0x30fefd){var _0x2d6edf=function(_0x35cfdd){while(--_0x35cfdd){_0x4eeaac['push'](_0x4eeaac['shift']());}};_0x2d6edf(++_0x30fefd);}(_0x7be9,0x13e));var _0x97be=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x7be9[_0x4c445a];return _0x2f611c;};'use strict';var Sequelize=require(_0x97be('0x0'));module['exports']={'name':{'type':Sequelize[_0x97be('0x1')],'allowNull':![],'unique':_0x97be('0x2')},'description':{'type':Sequelize[_0x97be('0x1')]}}; \ No newline at end of file +var _0x436b=['name','sequelize','exports','STRING'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x436b,0x131));var _0xb436=function(_0x50eab9,_0x1a6d00){_0x50eab9=_0x50eab9-0x0;var _0x102a2f=_0x436b[_0x50eab9];return _0x102a2f;};'use strict';var Sequelize=require(_0xb436('0x0'));module[_0xb436('0x1')]={'name':{'type':Sequelize[_0xb436('0x2')],'allowNull':![],'unique':_0xb436('0x3')},'description':{'type':Sequelize[_0xb436('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 92c52ce..6aff935 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 _0xfc9b=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','Teams','UserProfileResource','then','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','fields','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','findOne','channel','isValidChannel','toLowerCase','options','capitalize','Queues','addQueues','Sequelize','ValidationError','Unknown\x20channel','add','ids','removeQueues','remove','addAgents','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','sequelize','transaction','Voice','through','penalty','defaults','TeamVoiceQueue','Queue','emit','Queue:save','QueueId','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','removeAgents','parse','User','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','papaparse','../../components/auth/service'];(function(_0x356f92,_0x5305fa){var _0x4dfd0a=function(_0x56f731){while(--_0x56f731){_0x356f92['push'](_0x356f92['shift']());}};_0x4dfd0a(++_0x5305fa);}(_0xfc9b,0x74));var _0xbfc9=function(_0x419e31,_0x5ca904){_0x419e31=_0x419e31-0x0;var _0x58ccfc=_0xfc9b[_0x419e31];return _0x58ccfc;};'use strict';var pdf=require(_0xbfc9('0x0'));var emlformat=require(_0xbfc9('0x1'));var rimraf=require(_0xbfc9('0x2'));var zipdir=require(_0xbfc9('0x3'));var jsonpatch=require(_0xbfc9('0x4'));var rp=require(_0xbfc9('0x5'));var moment=require(_0xbfc9('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xbfc9('0x7'));var util=require('util');var path=require(_0xbfc9('0x8'));var sox=require(_0xbfc9('0x9'));var csv=require('to-csv');var ejs=require(_0xbfc9('0xa'));var fs=require('fs');var fs_extra=require(_0xbfc9('0xb'));var _=require(_0xbfc9('0xc'));var squel=require(_0xbfc9('0xd'));var crypto=require('crypto');var jsforce=require(_0xbfc9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xbfc9('0xf'));var querystring=require('querystring');var Papa=require(_0xbfc9('0x10'));var Redis=require('ioredis');var authService=require(_0xbfc9('0x11'));var qs=require(_0xbfc9('0x12'));var as=require(_0xbfc9('0x13'));var hardwareService=require(_0xbfc9('0x14'));var logger=require(_0xbfc9('0x15'))(_0xbfc9('0x16'));var utils=require('../../config/utils');var config=require(_0xbfc9('0x17'));var licenseUtil=require(_0xbfc9('0x18'));var db=require('../../mysqldb')['db'];config[_0xbfc9('0x19')]=_['defaults'](config[_0xbfc9('0x19')],{'host':_0xbfc9('0x1a'),'port':0x18eb});var socket=require(_0xbfc9('0x1b'))(new Redis(config[_0xbfc9('0x19')]));require('./team.socket')[_0xbfc9('0x1c')](socket);function respondWithStatusCode(_0x1d92e6,_0x1e3ad1){_0x1e3ad1=_0x1e3ad1||0xcc;return function(_0x30c34e){if(_0x30c34e){return _0x1d92e6[_0xbfc9('0x1d')](_0x1e3ad1);}return _0x1d92e6[_0xbfc9('0x1e')](_0x1e3ad1)[_0xbfc9('0x1f')]();};}function respondWithResult(_0x367986,_0x1cec94){_0x1cec94=_0x1cec94||0xc8;return function(_0x42cacd){if(_0x42cacd){return _0x367986[_0xbfc9('0x1e')](_0x1cec94)[_0xbfc9('0x20')](_0x42cacd);}};}function respondWithFilteredResult(_0x18e44f,_0x21e216){return function(_0x12755a){if(_0x12755a){var _0x345e7a=_0x12755a[_0xbfc9('0x21')],_0xa78e78=_0x21e216[_0xbfc9('0x22')],_0x45967a=_0x21e216[_0xbfc9('0x22')]+_0x21e216['limit'],_0xfe769d;if(_0x45967a>=_0x345e7a){_0x45967a=_0x345e7a;_0xfe769d=0xc8;}else{_0xfe769d=0xce;}_0x18e44f[_0xbfc9('0x1e')](_0xfe769d);return _0x18e44f[_0xbfc9('0x23')](_0xbfc9('0x24'),_0xa78e78+'-'+_0x45967a+'/'+_0x345e7a)[_0xbfc9('0x20')](_0x12755a);}return null;};}function patchUpdates(_0x2df6b9){return function(_0x2c1f43){try{jsonpatch[_0xbfc9('0x25')](_0x2c1f43,_0x2df6b9,!![]);}catch(_0x3f1603){return BPromise[_0xbfc9('0x26')](_0x3f1603);}return _0x2c1f43[_0xbfc9('0x27')]();};}function saveUpdates(_0x30e769,_0x3f7abf){return function(_0x39bc58){if(_0x39bc58){return _0x39bc58[_0xbfc9('0x28')](_0x30e769)['then'](function(_0x1f365f){return _0x1f365f;});}return null;};}function removeEntity(_0x43a8a2,_0x1fd9ef){return function(_0x2ba7d6){if(_0x2ba7d6){return _0x2ba7d6[_0xbfc9('0x29')]()['then'](function(){var _0x4498ed=_0x2ba7d6[_0xbfc9('0x2a')]({'plain':!![]});var _0x1c2390=_0xbfc9('0x2b');return db[_0xbfc9('0x2c')][_0xbfc9('0x29')]({'where':{'type':_0x1c2390,'resourceId':_0x4498ed['id']}})[_0xbfc9('0x2d')](function(){return _0x2ba7d6;});})[_0xbfc9('0x2d')](function(){_0x43a8a2[_0xbfc9('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5185e5,_0x555cf1){return function(_0x1a02e3){if(!_0x1a02e3){_0x5185e5['sendStatus'](0x194);}return _0x1a02e3;};}function handleError(_0x58401b,_0x123261){_0x123261=_0x123261||0x1f4;return function(_0x2aa754){logger[_0xbfc9('0x2e')](_0x2aa754[_0xbfc9('0x2f')]);if(_0x2aa754[_0xbfc9('0x30')]){delete _0x2aa754[_0xbfc9('0x30')];}_0x58401b[_0xbfc9('0x1e')](_0x123261)[_0xbfc9('0x31')](_0x2aa754);};}exports[_0xbfc9('0x32')]=function(_0x56c98e,_0x310f94){var _0xd845d7={},_0x44576a={},_0x4a966b={'count':0x0,'rows':[]};var _0x5c306c=_[_0xbfc9('0x33')](db[_0xbfc9('0x34')][_0xbfc9('0x35')],function(_0xbc9756){return{'name':_0xbc9756[_0xbfc9('0x36')],'type':_0xbc9756[_0xbfc9('0x37')][_0xbfc9('0x38')]};});_0x44576a[_0xbfc9('0x39')]=_[_0xbfc9('0x33')](_0x5c306c,'name');_0x44576a['query']=_[_0xbfc9('0x3a')](_0x56c98e[_0xbfc9('0x3b')]);_0x44576a[_0xbfc9('0x3c')]=_[_0xbfc9('0x3d')](_0x44576a[_0xbfc9('0x39')],_0x44576a[_0xbfc9('0x3b')]);_0xd845d7['attributes']=_[_0xbfc9('0x3d')](_0x44576a['model'],qs['fields'](_0x56c98e[_0xbfc9('0x3b')]['fields']));_0xd845d7[_0xbfc9('0x3e')]=_0xd845d7[_0xbfc9('0x3e')][_0xbfc9('0x3f')]?_0xd845d7['attributes']:_0x44576a[_0xbfc9('0x39')];if(!_0x56c98e['query']['hasOwnProperty'](_0xbfc9('0x40'))){_0xd845d7[_0xbfc9('0x41')]=qs['limit'](_0x56c98e[_0xbfc9('0x3b')]['limit']);_0xd845d7['offset']=qs[_0xbfc9('0x22')](_0x56c98e[_0xbfc9('0x3b')][_0xbfc9('0x22')]);}_0xd845d7[_0xbfc9('0x42')]=qs[_0xbfc9('0x43')](_0x56c98e[_0xbfc9('0x3b')][_0xbfc9('0x43')]);_0xd845d7[_0xbfc9('0x44')]=qs['filters'](_[_0xbfc9('0x45')](_0x56c98e[_0xbfc9('0x3b')],_0x44576a['filters']),_0x5c306c);if(_0x56c98e['query'][_0xbfc9('0x46')]){_0xd845d7[_0xbfc9('0x44')]=_['merge'](_0xd845d7[_0xbfc9('0x44')],{'$or':_[_0xbfc9('0x33')](_0x5c306c,function(_0x2eca59){if(_0x2eca59[_0xbfc9('0x37')]!==_0xbfc9('0x47')){var _0x3d473c={};_0x3d473c[_0x2eca59[_0xbfc9('0x30')]]={'$like':'%'+_0x56c98e[_0xbfc9('0x3b')][_0xbfc9('0x46')]+'%'};return _0x3d473c;}})});}_0xd845d7=_[_0xbfc9('0x48')]({},_0xd845d7,_0x56c98e['options']);var _0x92a5d0={'where':_0xd845d7['where']};return db['Team'][_0xbfc9('0x21')](_0x92a5d0)[_0xbfc9('0x2d')](function(_0x5a0327){_0x4a966b[_0xbfc9('0x21')]=_0x5a0327;if(_0x56c98e[_0xbfc9('0x3b')]['includeAll']){_0xd845d7[_0xbfc9('0x49')]=[{'all':!![]}];}return db[_0xbfc9('0x34')][_0xbfc9('0x4a')](_0xd845d7);})['then'](function(_0x50e21c){_0x4a966b[_0xbfc9('0x4b')]=_0x50e21c;return _0x4a966b;})[_0xbfc9('0x2d')](respondWithFilteredResult(_0x310f94,_0xd845d7))['catch'](handleError(_0x310f94,null));};exports['show']=function(_0x548f06,_0x4e20ee){var _0x1d8f79={'raw':![],'where':{'id':_0x548f06['params']['id']}},_0xe16e4f={};_0xe16e4f[_0xbfc9('0x39')]=_[_0xbfc9('0x3a')](db['Team']['rawAttributes']);_0xe16e4f['query']=_[_0xbfc9('0x3a')](_0x548f06[_0xbfc9('0x3b')]);_0xe16e4f[_0xbfc9('0x3c')]=_[_0xbfc9('0x3d')](_0xe16e4f[_0xbfc9('0x39')],_0xe16e4f[_0xbfc9('0x3b')]);_0x1d8f79[_0xbfc9('0x3e')]=_[_0xbfc9('0x3d')](_0xe16e4f[_0xbfc9('0x39')],qs[_0xbfc9('0x4c')](_0x548f06['query'][_0xbfc9('0x4c')]));_0x1d8f79['attributes']=_0x1d8f79[_0xbfc9('0x3e')][_0xbfc9('0x3f')]?_0x1d8f79[_0xbfc9('0x3e')]:_0xe16e4f['model'];if(_0x548f06['query'][_0xbfc9('0x4d')]){_0x1d8f79[_0xbfc9('0x49')]=[{'all':!![]}];}_0x1d8f79=_[_0xbfc9('0x48')]({},_0x1d8f79,_0x548f06['options']);return db[_0xbfc9('0x34')][_0xbfc9('0x4e')](_0x1d8f79)['then'](handleEntityNotFound(_0x4e20ee,null))[_0xbfc9('0x2d')](respondWithResult(_0x4e20ee,null))[_0xbfc9('0x4f')](handleError(_0x4e20ee,null));};exports['create']=function(_0x2874b8,_0x2f4130){return db['Team'][_0xbfc9('0x50')](_0x2874b8[_0xbfc9('0x51')],{})['then'](function(_0x24425d){var _0xb85134=_0x2874b8['user']['get']({'plain':!![]});if(!_0xb85134)throw new Error(_0xbfc9('0x52'));if(_0xb85134[_0xbfc9('0x53')]===_0xbfc9('0x54')){var _0x4b3652=_0x24425d[_0xbfc9('0x2a')]({'plain':!![]});var _0x706e5e=_0xbfc9('0x2b');return db['UserProfileSection'][_0xbfc9('0x4e')]({'where':{'name':_0x706e5e,'userProfileId':_0xb85134[_0xbfc9('0x55')]},'raw':!![]})['then'](function(_0x4194be){if(_0x4194be&&_0x4194be[_0xbfc9('0x56')]===0x0){return db[_0xbfc9('0x2c')][_0xbfc9('0x50')]({'name':_0x4b3652['name'],'resourceId':_0x4b3652['id'],'type':_0x4194be['name'],'sectionId':_0x4194be['id']},{})['then'](function(){return _0x24425d;});}else{return _0x24425d;}})[_0xbfc9('0x4f')](function(_0x15395a){logger['error'](_0xbfc9('0x57'),_0x15395a);throw _0x15395a;});}return _0x24425d;})[_0xbfc9('0x2d')](respondWithResult(_0x2f4130,0xc9))['catch'](handleError(_0x2f4130,null));};exports[_0xbfc9('0x28')]=function(_0x2e6a5e,_0x5dc46b){if(_0x2e6a5e['body']['id']){delete _0x2e6a5e[_0xbfc9('0x51')]['id'];}return db[_0xbfc9('0x34')]['find']({'where':{'id':_0x2e6a5e[_0xbfc9('0x58')]['id']}})['then'](handleEntityNotFound(_0x5dc46b,null))[_0xbfc9('0x2d')](saveUpdates(_0x2e6a5e['body'],null))['then'](respondWithResult(_0x5dc46b,null))[_0xbfc9('0x4f')](handleError(_0x5dc46b,null));};exports[_0xbfc9('0x29')]=function(_0x400342,_0x293557){return db[_0xbfc9('0x34')][_0xbfc9('0x4e')]({'where':{'id':_0x400342[_0xbfc9('0x58')]['id']}})[_0xbfc9('0x2d')](handleEntityNotFound(_0x293557,null))[_0xbfc9('0x2d')](removeEntity(_0x293557,null))[_0xbfc9('0x4f')](handleError(_0x293557,null));};exports['getQueues']=function(_0xfe5b36,_0x43e6f6,_0x3ed57f){return db[_0xbfc9('0x34')][_0xbfc9('0x59')]({'where':{'id':_0xfe5b36[_0xbfc9('0x58')]['id']}})[_0xbfc9('0x2d')](handleEntityNotFound(_0x43e6f6,null))['then'](function(_0x57c215){if(!_0xfe5b36[_0xbfc9('0x3b')][_0xbfc9('0x5a')]||!utils[_0xbfc9('0x5b')](_0xfe5b36[_0xbfc9('0x3b')][_0xbfc9('0x5a')])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}var _0x279e97={};var _0x379bf7={};_0x379bf7[_0xbfc9('0x39')]=_['keys'](db[_['capitalize'](_0xfe5b36['query'][_0xbfc9('0x5a')][_0xbfc9('0x5c')]())+'Queue'][_0xbfc9('0x35')]);_0x379bf7[_0xbfc9('0x3b')]=_[_0xbfc9('0x3a')](_0xfe5b36[_0xbfc9('0x3b')]);_0x379bf7[_0xbfc9('0x3c')]=_['intersection'](_0x379bf7['model'],_0x379bf7[_0xbfc9('0x3b')]);_0x279e97[_0xbfc9('0x3e')]=_['intersection'](_0x379bf7[_0xbfc9('0x39')],qs[_0xbfc9('0x4c')](_0xfe5b36[_0xbfc9('0x3b')][_0xbfc9('0x4c')]));_0x279e97[_0xbfc9('0x3e')]=_0x279e97['attributes'][_0xbfc9('0x3f')]?_0x279e97[_0xbfc9('0x3e')]:_0x379bf7[_0xbfc9('0x39')];_0x279e97[_0xbfc9('0x41')]=qs[_0xbfc9('0x41')](_0xfe5b36[_0xbfc9('0x3b')][_0xbfc9('0x41')]);_0x279e97['offset']=qs['offset'](_0xfe5b36['query'][_0xbfc9('0x22')]);_0x279e97[_0xbfc9('0x42')]=qs['sort'](_0xfe5b36[_0xbfc9('0x3b')]['sort']);_0x279e97[_0xbfc9('0x44')]=qs[_0xbfc9('0x3c')](_[_0xbfc9('0x45')](_0xfe5b36[_0xbfc9('0x3b')],_0x379bf7['filters']));_0x279e97=_['merge']({},_0x279e97,_0xfe5b36[_0xbfc9('0x5d')]);return _0x57c215[_0xbfc9('0x2a')+_[_0xbfc9('0x5e')](_0xfe5b36[_0xbfc9('0x3b')]['channel'][_0xbfc9('0x5c')]())+_0xbfc9('0x5f')](_0x279e97);})['then'](respondWithResult(_0x43e6f6,null))[_0xbfc9('0x4f')](handleError(_0x43e6f6,null));};exports[_0xbfc9('0x60')]=function(_0xc548c5,_0x3ce862,_0x5f1997){return db['Team'][_0xbfc9('0x59')]({'where':{'id':_0xc548c5[_0xbfc9('0x58')]['id']}})['then'](function(_0x44db0e){if(_0x44db0e){if(!_0xc548c5['body'][_0xbfc9('0x5a')]||!utils[_0xbfc9('0x5b')](_0xc548c5[_0xbfc9('0x51')][_0xbfc9('0x5a')])){throw new db[(_0xbfc9('0x61'))][(_0xbfc9('0x62'))](_0xbfc9('0x63'));}return _0x44db0e[_0xbfc9('0x64')+_['capitalize'](_0xc548c5['body'][_0xbfc9('0x5a')]['toLowerCase']())+_0xbfc9('0x5f')](_0xc548c5['body'][_0xbfc9('0x65')]);}return null;})[_0xbfc9('0x2d')](handleEntityNotFound(_0x3ce862,null))['then'](respondWithStatusCode(_0x3ce862,null))[_0xbfc9('0x4f')](handleError(_0x3ce862,null));};exports[_0xbfc9('0x66')]=function(_0x2a4640,_0x19facf,_0x425c46){return db[_0xbfc9('0x34')]['findOne']({'where':{'id':_0x2a4640['params']['id']}})[_0xbfc9('0x2d')](function(_0x29962a){if(_0x29962a){if(!_0x2a4640[_0xbfc9('0x3b')][_0xbfc9('0x5a')]||!utils[_0xbfc9('0x5b')](_0x2a4640[_0xbfc9('0x3b')][_0xbfc9('0x5a')])){throw new db['Sequelize'][(_0xbfc9('0x62'))](_0xbfc9('0x63'));}return _0x29962a[_0xbfc9('0x67')+_[_0xbfc9('0x5e')](_0x2a4640[_0xbfc9('0x3b')]['channel']['toLowerCase']())+_0xbfc9('0x5f')](_0x2a4640[_0xbfc9('0x3b')][_0xbfc9('0x65')]);}return null;})[_0xbfc9('0x2d')](handleEntityNotFound(_0x19facf,null))[_0xbfc9('0x2d')](respondWithStatusCode(_0x19facf,null))[_0xbfc9('0x4f')](handleError(_0x19facf,null));};exports[_0xbfc9('0x68')]=function(_0x397fb4,_0x11467c){return db[_0xbfc9('0x34')][_0xbfc9('0x4e')]({'where':{'id':_0x397fb4['params']['id']}})[_0xbfc9('0x2d')](handleEntityNotFound(_0x11467c,null))[_0xbfc9('0x2d')](function(_0x66ff17){if(_0x66ff17){var _0x4ba0bc=['Voice',_0xbfc9('0x69'),_0xbfc9('0x6a'),_0xbfc9('0x6b'),_0xbfc9('0x6c'),_0xbfc9('0x6d'),_0xbfc9('0x6e')];return db[_0xbfc9('0x6f')][_0xbfc9('0x70')](function(_0x176401){var _0x598a62=_[_0xbfc9('0x33')](_0x4ba0bc,function(_0x4875b9){var _0x15bb92={'attributes':['id',_0xbfc9('0x30')]};if(_0x4875b9===_0xbfc9('0x71')){_0x15bb92[_0xbfc9('0x72')]={'attributes':[_0xbfc9('0x73')]};}return _0x66ff17['get'+_0x4875b9+_0xbfc9('0x5f')](_0x15bb92)[_0xbfc9('0x2d')](function(_0x67ecbb){var _0x2b8dea=_['map'](_0x67ecbb,function(_0x50c815){var _0x5593c9=_[_0xbfc9('0x33')](_0x397fb4[_0xbfc9('0x51')]['ids'],function(_0x24a65a){var _0x5ea29c={'where':{'UserId':_0x24a65a,[_0x4875b9+'QueueId']:_0x50c815['id']},'transaction':_0x176401};if(_0x4875b9==='Voice'){_0x5ea29c[_0xbfc9('0x74')]={'penalty':_0x50c815[_0xbfc9('0x75')]['penalty']};}return db['User'+_0x4875b9+_0xbfc9('0x76')]['findOrCreate'](_0x5ea29c)[_0xbfc9('0x2d')](function(){socket[_0xbfc9('0x77')]('user'+_0x4875b9+_0xbfc9('0x78'),{'UserId':_0x24a65a,[_0x4875b9+_0xbfc9('0x79')]:_0x50c815['id']});if(_0x4875b9!=='Voice')return;return db['User'][_0xbfc9('0x4a')]({'where':{'id':_0x397fb4['body'][_0xbfc9('0x65')],'online':0x1},'attributes':['id','name','online',_0xbfc9('0x7a'),_0xbfc9('0x7b')],'raw':!![]})[_0xbfc9('0x2d')](function(_0x4a92c9){var _0x24a641=_['map'](_0x4a92c9,function(_0x42cf11){return db[_0xbfc9('0x7c')][_0xbfc9('0x7d')]({'membername':_0x42cf11[_0xbfc9('0x30')],'UserId':_0x42cf11['id'],'queue_name':_0x50c815['name'],'VoiceQueueId':_0x50c815['id'],'interface':_[_0xbfc9('0x7e')](_0x42cf11[_0xbfc9('0x7b')])?util[_0xbfc9('0x7f')](_0xbfc9('0x80'),_0x42cf11['name']):_0x42cf11[_0xbfc9('0x7b')],'paused':_0x42cf11['voicePause']||![],'penalty':_0x50c815[_0xbfc9('0x75')]['penalty']},{'transaction':_0x176401});});return Promise[_0xbfc9('0x81')](_0x24a641);});});});return Promise[_0xbfc9('0x81')](_0x5593c9);});return Promise[_0xbfc9('0x81')](_0x2b8dea);});});return Promise[_0xbfc9('0x81')](_0x598a62)['then'](function(){return _0x66ff17['addAgents'](_0x397fb4[_0xbfc9('0x51')][_0xbfc9('0x65')],{'transaction':_0x176401})['spread'](function(_0x5926bf){return _0x5926bf;});});});}})[_0xbfc9('0x2d')](respondWithResult(_0x11467c,null))['catch'](handleError(_0x11467c,null));};exports[_0xbfc9('0x82')]=function(_0x2ec82c,_0x43d9eb){return db['Team']['find']({'where':{'id':_0x2ec82c[_0xbfc9('0x58')]['id']}})[_0xbfc9('0x2d')](handleEntityNotFound(_0x43d9eb,null))[_0xbfc9('0x2d')](function(_0x74f646){if(_0x74f646){var _0x2b1ed2=['Voice',_0xbfc9('0x69'),'Mail',_0xbfc9('0x6b'),'Fax',_0xbfc9('0x6d'),_0xbfc9('0x6e')];return db[_0xbfc9('0x6f')][_0xbfc9('0x70')](function(_0x43d31a){var _0xcfd93d=_[_0xbfc9('0x33')](_0x2b1ed2,function(_0x4b9892){var _0x3b39ef={'attributes':['id',_0xbfc9('0x30')]};return _0x74f646[_0xbfc9('0x2a')+_0x4b9892+_0xbfc9('0x5f')](_0x3b39ef)[_0xbfc9('0x2d')](function(_0x441705){var _0x3c6aa6=_[_0xbfc9('0x33')](_0x441705,function(_0x3d3743){return _0x3d3743['removeAgents'](_0x2ec82c[_0xbfc9('0x3b')][_0xbfc9('0x65')],{'transaction':_0x43d31a})['then'](function(){var _0x4f013b=JSON[_0xbfc9('0x83')]('['+_0x2ec82c[_0xbfc9('0x3b')][_0xbfc9('0x65')]+']');var _0x228d8d=_[_0xbfc9('0x33')](_0x4f013b,function(_0x3e1bcc){socket[_0xbfc9('0x77')](_0xbfc9('0x54')+_0x4b9892+'Queue:remove',{'UserId':Number(_0x3e1bcc),[_0x4b9892+_0xbfc9('0x79')]:_0x3d3743['id']});if(_0x4b9892!=='Voice')return;return db[_0xbfc9('0x7c')][_0xbfc9('0x29')]({'where':{'VoiceQueueId':_0x3d3743['id'],'UserId':_0x3e1bcc},'transaction':_0x43d31a});});return Promise[_0xbfc9('0x81')](_0x228d8d);});});return Promise[_0xbfc9('0x81')](_0x3c6aa6);});});return Promise[_0xbfc9('0x81')](_0xcfd93d)[_0xbfc9('0x2d')](function(){return _0x74f646[_0xbfc9('0x82')](_0x2ec82c[_0xbfc9('0x3b')][_0xbfc9('0x65')],{'transaction':_0x43d31a});});});}})[_0xbfc9('0x2d')](respondWithStatusCode(_0x43d9eb,null))[_0xbfc9('0x4f')](handleError(_0x43d9eb,null));};exports['getAgents']=function(_0x56c43e,_0x10aa84,_0x4e6437){var _0x46937b={};var _0x5e6cb9={};var _0x8103f5;var _0x45a0fc;return db[_0xbfc9('0x34')]['findOne']({'where':{'id':_0x56c43e[_0xbfc9('0x58')]['id']}})[_0xbfc9('0x2d')](handleEntityNotFound(_0x10aa84,null))[_0xbfc9('0x2d')](function(_0x1d024f){if(_0x1d024f){_0x8103f5=_0x1d024f;_0x5e6cb9[_0xbfc9('0x39')]=_[_0xbfc9('0x3a')](db[_0xbfc9('0x84')][_0xbfc9('0x35')]);_0x5e6cb9[_0xbfc9('0x3b')]=_[_0xbfc9('0x3a')](_0x56c43e[_0xbfc9('0x3b')]);_0x5e6cb9[_0xbfc9('0x3c')]=_[_0xbfc9('0x3d')](_0x5e6cb9[_0xbfc9('0x39')],_0x5e6cb9['query']);_0x46937b[_0xbfc9('0x3e')]=_[_0xbfc9('0x3d')](_0x5e6cb9[_0xbfc9('0x39')],qs[_0xbfc9('0x4c')](_0x56c43e['query'][_0xbfc9('0x4c')]));_0x46937b[_0xbfc9('0x3e')]=_0x46937b[_0xbfc9('0x3e')][_0xbfc9('0x3f')]?_0x46937b['attributes']:_0x5e6cb9['model'];_0x46937b[_0xbfc9('0x42')]=qs['sort'](_0x56c43e[_0xbfc9('0x3b')]['sort']);_0x46937b['where']=qs[_0xbfc9('0x3c')](_[_0xbfc9('0x45')](_0x56c43e[_0xbfc9('0x3b')],_0x5e6cb9[_0xbfc9('0x3c')]));if(_0x56c43e[_0xbfc9('0x3b')][_0xbfc9('0x46')]){_0x46937b[_0xbfc9('0x44')]=_[_0xbfc9('0x48')](_0x46937b['where'],{'$or':_[_0xbfc9('0x33')](_0x46937b[_0xbfc9('0x3e')],function(_0x2d956f){var _0x1e4f10={};_0x1e4f10[_0x2d956f]={'$like':'%'+_0x56c43e[_0xbfc9('0x3b')][_0xbfc9('0x46')]+'%'};return _0x1e4f10;})});}_0x46937b=_[_0xbfc9('0x48')]({},_0x46937b,_0x56c43e[_0xbfc9('0x5d')]);return _0x8103f5[_0xbfc9('0x85')](_0x46937b);}})[_0xbfc9('0x2d')](function(_0x32de6c){if(_0x32de6c){_0x45a0fc=_0x32de6c['length'];if(!_0x56c43e['query']['hasOwnProperty'](_0xbfc9('0x40'))){_0x46937b['limit']=qs[_0xbfc9('0x41')](_0x56c43e[_0xbfc9('0x3b')][_0xbfc9('0x41')]);_0x46937b[_0xbfc9('0x22')]=qs[_0xbfc9('0x22')](_0x56c43e[_0xbfc9('0x3b')][_0xbfc9('0x22')]);}return _0x8103f5['getAgents'](_0x46937b);}})[_0xbfc9('0x2d')](function(_0x313bad){if(_0x313bad){return _0x313bad?{'count':_0x45a0fc,'rows':_0x313bad}:null;}})[_0xbfc9('0x2d')](respondWithResult(_0x10aa84,null))[_0xbfc9('0x4f')](handleError(_0x10aa84,null));}; \ No newline at end of file +var _0x1c75=['Team','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','keys','find','catch','create','body','user','role','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','params','channel','isValidChannel','Sequelize','Unknown\x20channel','capitalize','Queue','order','pick','toLowerCase','Queues','addQueues','ValidationError','add','remove','ids','addAgents','Voice','Chat','Mail','Fax','Whatsapp','sequelize','transaction','through','penalty','TeamVoiceQueue','User','findOrCreate','QueueId','voicePause','interface','upsert','SIP/%s','all','Sms','removeAgents','emit','Queue:remove','getAgents','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','redis','defaults','socket.io-emitter','./team.socket','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Teams','stack','name','index'];(function(_0x563c9c,_0x3f4699){var _0x3af8d4=function(_0x2d8599){while(--_0x2d8599){_0x563c9c['push'](_0x563c9c['shift']());}};_0x3af8d4(++_0x3f4699);}(_0x1c75,0xce));var _0x51c7=function(_0x5755bf,_0x5a50ba){_0x5755bf=_0x5755bf-0x0;var _0x156408=_0x1c75[_0x5755bf];return _0x156408;};'use strict';var pdf=require(_0x51c7('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x51c7('0x1'));var rp=require(_0x51c7('0x2'));var moment=require(_0x51c7('0x3'));var BPromise=require(_0x51c7('0x4'));var Mustache=require(_0x51c7('0x5'));var util=require(_0x51c7('0x6'));var path=require(_0x51c7('0x7'));var sox=require(_0x51c7('0x8'));var csv=require(_0x51c7('0x9'));var ejs=require(_0x51c7('0xa'));var fs=require('fs');var fs_extra=require(_0x51c7('0xb'));var _=require('lodash');var squel=require(_0x51c7('0xc'));var crypto=require(_0x51c7('0xd'));var jsforce=require(_0x51c7('0xe'));var deskjs=require(_0x51c7('0xf'));var toCsv=require('to-csv');var querystring=require(_0x51c7('0x10'));var Papa=require('papaparse');var Redis=require(_0x51c7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x51c7('0x12'));var as=require(_0x51c7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x51c7('0x14'))(_0x51c7('0x15'));var utils=require(_0x51c7('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x51c7('0x17')]=_[_0x51c7('0x18')](config[_0x51c7('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x51c7('0x19'))(new Redis(config['redis']));require(_0x51c7('0x1a'))['register'](socket);function respondWithStatusCode(_0x2e54af,_0x48f08a){_0x48f08a=_0x48f08a||0xcc;return function(_0x730429){if(_0x730429){return _0x2e54af[_0x51c7('0x1b')](_0x48f08a);}return _0x2e54af[_0x51c7('0x1c')](_0x48f08a)[_0x51c7('0x1d')]();};}function respondWithResult(_0x521d8a,_0x177e14){_0x177e14=_0x177e14||0xc8;return function(_0x1782d6){if(_0x1782d6){return _0x521d8a[_0x51c7('0x1c')](_0x177e14)[_0x51c7('0x1e')](_0x1782d6);}};}function respondWithFilteredResult(_0x209ab3,_0x36b29a){return function(_0x4a64e4){if(_0x4a64e4){var _0xe4cf49=_0x4a64e4[_0x51c7('0x1f')],_0x8dd5b0=_0x36b29a[_0x51c7('0x20')],_0x6960a9=_0x36b29a['offset']+_0x36b29a['limit'],_0x52bb0d;if(_0x6960a9>=_0xe4cf49){_0x6960a9=_0xe4cf49;_0x52bb0d=0xc8;}else{_0x52bb0d=0xce;}_0x209ab3[_0x51c7('0x1c')](_0x52bb0d);return _0x209ab3[_0x51c7('0x21')](_0x51c7('0x22'),_0x8dd5b0+'-'+_0x6960a9+'/'+_0xe4cf49)[_0x51c7('0x1e')](_0x4a64e4);}return null;};}function patchUpdates(_0x4072b9){return function(_0x3a7c98){try{jsonpatch[_0x51c7('0x23')](_0x3a7c98,_0x4072b9,!![]);}catch(_0x5248e2){return BPromise[_0x51c7('0x24')](_0x5248e2);}return _0x3a7c98[_0x51c7('0x25')]();};}function saveUpdates(_0x4e0108,_0x23bf9c){return function(_0x48b259){if(_0x48b259){return _0x48b259[_0x51c7('0x26')](_0x4e0108)[_0x51c7('0x27')](function(_0x414de0){return _0x414de0;});}return null;};}function removeEntity(_0x48e6e6,_0x11f01f){return function(_0x2a76a5){if(_0x2a76a5){return _0x2a76a5[_0x51c7('0x28')]()[_0x51c7('0x27')](function(){var _0x44de99=_0x2a76a5[_0x51c7('0x29')]({'plain':!![]});var _0x57fe70=_0x51c7('0x2a');return db['UserProfileResource'][_0x51c7('0x28')]({'where':{'type':_0x57fe70,'resourceId':_0x44de99['id']}})[_0x51c7('0x27')](function(){return _0x2a76a5;});})[_0x51c7('0x27')](function(){_0x48e6e6[_0x51c7('0x1c')](0xcc)[_0x51c7('0x1d')]();});}};}function handleEntityNotFound(_0x224940,_0x32ac6e){return function(_0x198465){if(!_0x198465){_0x224940[_0x51c7('0x1b')](0x194);}return _0x198465;};}function handleError(_0x2a18e0,_0x104315){_0x104315=_0x104315||0x1f4;return function(_0x16db1b){logger['error'](_0x16db1b[_0x51c7('0x2b')]);if(_0x16db1b[_0x51c7('0x2c')]){delete _0x16db1b[_0x51c7('0x2c')];}_0x2a18e0[_0x51c7('0x1c')](_0x104315)['send'](_0x16db1b);};}exports[_0x51c7('0x2d')]=function(_0x5e90bc,_0x3d590d){var _0x29b08a={},_0x47476e={},_0x5882c9={'count':0x0,'rows':[]};var _0xa7ff09=_['map'](db[_0x51c7('0x2e')][_0x51c7('0x2f')],function(_0x239fc6){return{'name':_0x239fc6[_0x51c7('0x30')],'type':_0x239fc6[_0x51c7('0x31')][_0x51c7('0x32')]};});_0x47476e[_0x51c7('0x33')]=_[_0x51c7('0x34')](_0xa7ff09,_0x51c7('0x2c'));_0x47476e[_0x51c7('0x35')]=_['keys'](_0x5e90bc[_0x51c7('0x35')]);_0x47476e['filters']=_[_0x51c7('0x36')](_0x47476e[_0x51c7('0x33')],_0x47476e['query']);_0x29b08a[_0x51c7('0x37')]=_[_0x51c7('0x36')](_0x47476e[_0x51c7('0x33')],qs[_0x51c7('0x38')](_0x5e90bc['query'][_0x51c7('0x38')]));_0x29b08a[_0x51c7('0x37')]=_0x29b08a[_0x51c7('0x37')][_0x51c7('0x39')]?_0x29b08a['attributes']:_0x47476e[_0x51c7('0x33')];if(!_0x5e90bc[_0x51c7('0x35')][_0x51c7('0x3a')](_0x51c7('0x3b'))){_0x29b08a[_0x51c7('0x3c')]=qs['limit'](_0x5e90bc[_0x51c7('0x35')]['limit']);_0x29b08a[_0x51c7('0x20')]=qs['offset'](_0x5e90bc[_0x51c7('0x35')][_0x51c7('0x20')]);}_0x29b08a['order']=qs[_0x51c7('0x3d')](_0x5e90bc[_0x51c7('0x35')][_0x51c7('0x3d')]);_0x29b08a[_0x51c7('0x3e')]=qs['filters'](_['pick'](_0x5e90bc[_0x51c7('0x35')],_0x47476e[_0x51c7('0x3f')]),_0xa7ff09);if(_0x5e90bc[_0x51c7('0x35')][_0x51c7('0x40')]){_0x29b08a['where']=_[_0x51c7('0x41')](_0x29b08a['where'],{'$or':_[_0x51c7('0x34')](_0xa7ff09,function(_0x1a5d25){if(_0x1a5d25[_0x51c7('0x31')]!==_0x51c7('0x42')){var _0x53a154={};_0x53a154[_0x1a5d25[_0x51c7('0x2c')]]={'$like':'%'+_0x5e90bc[_0x51c7('0x35')][_0x51c7('0x40')]+'%'};return _0x53a154;}})});}_0x29b08a=_[_0x51c7('0x41')]({},_0x29b08a,_0x5e90bc[_0x51c7('0x43')]);var _0x2cf6cf={'where':_0x29b08a['where']};return db['Team'][_0x51c7('0x1f')](_0x2cf6cf)[_0x51c7('0x27')](function(_0x5dd64a){_0x5882c9[_0x51c7('0x1f')]=_0x5dd64a;if(_0x5e90bc[_0x51c7('0x35')][_0x51c7('0x44')]){_0x29b08a[_0x51c7('0x45')]=[{'all':!![]}];}return db[_0x51c7('0x2e')][_0x51c7('0x46')](_0x29b08a);})[_0x51c7('0x27')](function(_0x24f1c0){_0x5882c9[_0x51c7('0x47')]=_0x24f1c0;return _0x5882c9;})[_0x51c7('0x27')](respondWithFilteredResult(_0x3d590d,_0x29b08a))['catch'](handleError(_0x3d590d,null));};exports['show']=function(_0x1bc95c,_0x2ab2a1){var _0x39ffba={'raw':![],'where':{'id':_0x1bc95c['params']['id']}},_0x415d2e={};_0x415d2e['model']=_[_0x51c7('0x48')](db[_0x51c7('0x2e')][_0x51c7('0x2f')]);_0x415d2e['query']=_[_0x51c7('0x48')](_0x1bc95c[_0x51c7('0x35')]);_0x415d2e[_0x51c7('0x3f')]=_[_0x51c7('0x36')](_0x415d2e['model'],_0x415d2e[_0x51c7('0x35')]);_0x39ffba['attributes']=_[_0x51c7('0x36')](_0x415d2e[_0x51c7('0x33')],qs[_0x51c7('0x38')](_0x1bc95c[_0x51c7('0x35')]['fields']));_0x39ffba['attributes']=_0x39ffba['attributes'][_0x51c7('0x39')]?_0x39ffba[_0x51c7('0x37')]:_0x415d2e['model'];if(_0x1bc95c['query']['includeAll']){_0x39ffba[_0x51c7('0x45')]=[{'all':!![]}];}_0x39ffba=_['merge']({},_0x39ffba,_0x1bc95c[_0x51c7('0x43')]);return db[_0x51c7('0x2e')][_0x51c7('0x49')](_0x39ffba)[_0x51c7('0x27')](handleEntityNotFound(_0x2ab2a1,null))['then'](respondWithResult(_0x2ab2a1,null))[_0x51c7('0x4a')](handleError(_0x2ab2a1,null));};exports[_0x51c7('0x4b')]=function(_0x10fd72,_0x2f506b){return db[_0x51c7('0x2e')][_0x51c7('0x4b')](_0x10fd72[_0x51c7('0x4c')],{})[_0x51c7('0x27')](function(_0x4d2ed0){var _0xf730ed=_0x10fd72[_0x51c7('0x4d')][_0x51c7('0x29')]({'plain':!![]});if(!_0xf730ed)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf730ed[_0x51c7('0x4e')]==='user'){var _0x168bb2=_0x4d2ed0[_0x51c7('0x29')]({'plain':!![]});var _0x3e70eb=_0x51c7('0x2a');return db[_0x51c7('0x4f')][_0x51c7('0x49')]({'where':{'name':_0x3e70eb,'userProfileId':_0xf730ed['userProfileId']},'raw':!![]})['then'](function(_0x14c9e4){if(_0x14c9e4&&_0x14c9e4[_0x51c7('0x50')]===0x0){return db[_0x51c7('0x51')][_0x51c7('0x4b')]({'name':_0x168bb2[_0x51c7('0x2c')],'resourceId':_0x168bb2['id'],'type':_0x14c9e4[_0x51c7('0x2c')],'sectionId':_0x14c9e4['id']},{})[_0x51c7('0x27')](function(){return _0x4d2ed0;});}else{return _0x4d2ed0;}})[_0x51c7('0x4a')](function(_0x3fee47){logger[_0x51c7('0x52')](_0x51c7('0x53'),_0x3fee47);throw _0x3fee47;});}return _0x4d2ed0;})[_0x51c7('0x27')](respondWithResult(_0x2f506b,0xc9))[_0x51c7('0x4a')](handleError(_0x2f506b,null));};exports[_0x51c7('0x26')]=function(_0x45459b,_0x1c25c1){if(_0x45459b[_0x51c7('0x4c')]['id']){delete _0x45459b[_0x51c7('0x4c')]['id'];}return db[_0x51c7('0x2e')]['find']({'where':{'id':_0x45459b['params']['id']}})[_0x51c7('0x27')](handleEntityNotFound(_0x1c25c1,null))[_0x51c7('0x27')](saveUpdates(_0x45459b[_0x51c7('0x4c')],null))[_0x51c7('0x27')](respondWithResult(_0x1c25c1,null))['catch'](handleError(_0x1c25c1,null));};exports[_0x51c7('0x28')]=function(_0x1f4fb6,_0x5453c5){return db[_0x51c7('0x2e')][_0x51c7('0x49')]({'where':{'id':_0x1f4fb6['params']['id']}})[_0x51c7('0x27')](handleEntityNotFound(_0x5453c5,null))[_0x51c7('0x27')](removeEntity(_0x5453c5,null))[_0x51c7('0x4a')](handleError(_0x5453c5,null));};exports[_0x51c7('0x54')]=function(_0x4a7fae,_0x4a5549,_0x76a1ec){return db[_0x51c7('0x2e')][_0x51c7('0x55')]({'where':{'id':_0x4a7fae[_0x51c7('0x56')]['id']}})[_0x51c7('0x27')](handleEntityNotFound(_0x4a5549,null))[_0x51c7('0x27')](function(_0x144298){if(!_0x4a7fae[_0x51c7('0x35')][_0x51c7('0x57')]||!utils[_0x51c7('0x58')](_0x4a7fae['query']['channel'])){throw new db[(_0x51c7('0x59'))]['ValidationError'](_0x51c7('0x5a'));}var _0x5d1798={};var _0x3424bb={};_0x3424bb[_0x51c7('0x33')]=_['keys'](db[_[_0x51c7('0x5b')](_0x4a7fae[_0x51c7('0x35')]['channel']['toLowerCase']())+_0x51c7('0x5c')][_0x51c7('0x2f')]);_0x3424bb['query']=_[_0x51c7('0x48')](_0x4a7fae[_0x51c7('0x35')]);_0x3424bb[_0x51c7('0x3f')]=_['intersection'](_0x3424bb[_0x51c7('0x33')],_0x3424bb[_0x51c7('0x35')]);_0x5d1798[_0x51c7('0x37')]=_['intersection'](_0x3424bb['model'],qs[_0x51c7('0x38')](_0x4a7fae[_0x51c7('0x35')][_0x51c7('0x38')]));_0x5d1798[_0x51c7('0x37')]=_0x5d1798[_0x51c7('0x37')][_0x51c7('0x39')]?_0x5d1798[_0x51c7('0x37')]:_0x3424bb[_0x51c7('0x33')];_0x5d1798[_0x51c7('0x3c')]=qs['limit'](_0x4a7fae[_0x51c7('0x35')]['limit']);_0x5d1798[_0x51c7('0x20')]=qs[_0x51c7('0x20')](_0x4a7fae[_0x51c7('0x35')]['offset']);_0x5d1798[_0x51c7('0x5d')]=qs[_0x51c7('0x3d')](_0x4a7fae[_0x51c7('0x35')][_0x51c7('0x3d')]);_0x5d1798[_0x51c7('0x3e')]=qs['filters'](_[_0x51c7('0x5e')](_0x4a7fae[_0x51c7('0x35')],_0x3424bb['filters']));_0x5d1798=_['merge']({},_0x5d1798,_0x4a7fae['options']);return _0x144298[_0x51c7('0x29')+_[_0x51c7('0x5b')](_0x4a7fae[_0x51c7('0x35')][_0x51c7('0x57')][_0x51c7('0x5f')]())+_0x51c7('0x60')](_0x5d1798);})[_0x51c7('0x27')](respondWithResult(_0x4a5549,null))[_0x51c7('0x4a')](handleError(_0x4a5549,null));};exports[_0x51c7('0x61')]=function(_0x564db5,_0x2eddb8,_0x24a905){return db['Team'][_0x51c7('0x55')]({'where':{'id':_0x564db5[_0x51c7('0x56')]['id']}})[_0x51c7('0x27')](function(_0x5c5d2f){if(_0x5c5d2f){if(!_0x564db5[_0x51c7('0x4c')][_0x51c7('0x57')]||!utils['isValidChannel'](_0x564db5[_0x51c7('0x4c')][_0x51c7('0x57')])){throw new db[(_0x51c7('0x59'))][(_0x51c7('0x62'))](_0x51c7('0x5a'));}return _0x5c5d2f[_0x51c7('0x63')+_['capitalize'](_0x564db5[_0x51c7('0x4c')]['channel'][_0x51c7('0x5f')]())+_0x51c7('0x60')](_0x564db5[_0x51c7('0x4c')]['ids']);}return null;})[_0x51c7('0x27')](handleEntityNotFound(_0x2eddb8,null))[_0x51c7('0x27')](respondWithStatusCode(_0x2eddb8,null))[_0x51c7('0x4a')](handleError(_0x2eddb8,null));};exports['removeQueues']=function(_0x2ce9a9,_0x20c68c,_0xb1abdf){return db[_0x51c7('0x2e')][_0x51c7('0x55')]({'where':{'id':_0x2ce9a9[_0x51c7('0x56')]['id']}})[_0x51c7('0x27')](function(_0x1b8cff){if(_0x1b8cff){if(!_0x2ce9a9['query']['channel']||!utils['isValidChannel'](_0x2ce9a9[_0x51c7('0x35')][_0x51c7('0x57')])){throw new db[(_0x51c7('0x59'))][(_0x51c7('0x62'))]('Unknown\x20channel');}return _0x1b8cff[_0x51c7('0x64')+_[_0x51c7('0x5b')](_0x2ce9a9['query'][_0x51c7('0x57')][_0x51c7('0x5f')]())+_0x51c7('0x60')](_0x2ce9a9[_0x51c7('0x35')][_0x51c7('0x65')]);}return null;})['then'](handleEntityNotFound(_0x20c68c,null))[_0x51c7('0x27')](respondWithStatusCode(_0x20c68c,null))[_0x51c7('0x4a')](handleError(_0x20c68c,null));};exports[_0x51c7('0x66')]=function(_0x4a7de5,_0x2b1216){return db[_0x51c7('0x2e')][_0x51c7('0x49')]({'where':{'id':_0x4a7de5['params']['id']}})[_0x51c7('0x27')](handleEntityNotFound(_0x2b1216,null))[_0x51c7('0x27')](function(_0x2b7da8){if(_0x2b7da8){var _0x26f93d=[_0x51c7('0x67'),_0x51c7('0x68'),_0x51c7('0x69'),'Sms',_0x51c7('0x6a'),'Openchannel',_0x51c7('0x6b')];return db[_0x51c7('0x6c')][_0x51c7('0x6d')](function(_0x2ea6bd){var _0x3cbc33=_[_0x51c7('0x34')](_0x26f93d,function(_0x14bdec){var _0x53b4f9={'attributes':['id',_0x51c7('0x2c')]};if(_0x14bdec===_0x51c7('0x67')){_0x53b4f9[_0x51c7('0x6e')]={'attributes':[_0x51c7('0x6f')]};}return _0x2b7da8[_0x51c7('0x29')+_0x14bdec+_0x51c7('0x60')](_0x53b4f9)[_0x51c7('0x27')](function(_0x5d9c3d){var _0x5d03cd=_['map'](_0x5d9c3d,function(_0x2280a6){var _0x44ed81=_[_0x51c7('0x34')](_0x4a7de5[_0x51c7('0x4c')][_0x51c7('0x65')],function(_0x522fa7){var _0x135a91={'where':{'UserId':_0x522fa7,[_0x14bdec+'QueueId']:_0x2280a6['id']},'transaction':_0x2ea6bd};if(_0x14bdec===_0x51c7('0x67')){_0x135a91[_0x51c7('0x18')]={'penalty':_0x2280a6[_0x51c7('0x70')][_0x51c7('0x6f')]};}return db[_0x51c7('0x71')+_0x14bdec+'Queue'][_0x51c7('0x72')](_0x135a91)[_0x51c7('0x27')](function(){socket['emit']('user'+_0x14bdec+'Queue:save',{'UserId':_0x522fa7,[_0x14bdec+_0x51c7('0x73')]:_0x2280a6['id']});if(_0x14bdec!==_0x51c7('0x67'))return;return db[_0x51c7('0x71')][_0x51c7('0x46')]({'where':{'id':_0x4a7de5[_0x51c7('0x4c')][_0x51c7('0x65')],'online':0x1},'attributes':['id',_0x51c7('0x2c'),'online',_0x51c7('0x74'),_0x51c7('0x75')],'raw':!![]})[_0x51c7('0x27')](function(_0x7b7285){var _0x31110c=_[_0x51c7('0x34')](_0x7b7285,function(_0x2e2bb0){return db['UserVoiceQueueRt'][_0x51c7('0x76')]({'membername':_0x2e2bb0['name'],'UserId':_0x2e2bb0['id'],'queue_name':_0x2280a6[_0x51c7('0x2c')],'VoiceQueueId':_0x2280a6['id'],'interface':_['isNil'](_0x2e2bb0[_0x51c7('0x75')])?util['format'](_0x51c7('0x77'),_0x2e2bb0[_0x51c7('0x2c')]):_0x2e2bb0['interface'],'paused':_0x2e2bb0[_0x51c7('0x74')]||![],'penalty':_0x2280a6[_0x51c7('0x70')][_0x51c7('0x6f')]},{'transaction':_0x2ea6bd});});return Promise[_0x51c7('0x78')](_0x31110c);});});});return Promise[_0x51c7('0x78')](_0x44ed81);});return Promise[_0x51c7('0x78')](_0x5d03cd);});});return Promise[_0x51c7('0x78')](_0x3cbc33)[_0x51c7('0x27')](function(){return _0x2b7da8['addAgents'](_0x4a7de5[_0x51c7('0x4c')][_0x51c7('0x65')],{'transaction':_0x2ea6bd})['spread'](function(_0x2f32b0){return _0x2f32b0;});});});}})['then'](respondWithResult(_0x2b1216,null))['catch'](handleError(_0x2b1216,null));};exports['removeAgents']=function(_0x941093,_0x405f5e){return db[_0x51c7('0x2e')][_0x51c7('0x49')]({'where':{'id':_0x941093[_0x51c7('0x56')]['id']}})['then'](handleEntityNotFound(_0x405f5e,null))[_0x51c7('0x27')](function(_0x321b1d){if(_0x321b1d){var _0x5c7546=[_0x51c7('0x67'),'Chat',_0x51c7('0x69'),_0x51c7('0x79'),_0x51c7('0x6a'),'Openchannel',_0x51c7('0x6b')];return db[_0x51c7('0x6c')]['transaction'](function(_0x55f740){var _0x3ccebc=_[_0x51c7('0x34')](_0x5c7546,function(_0x5ca0e5){var _0x880809={'attributes':['id',_0x51c7('0x2c')]};return _0x321b1d[_0x51c7('0x29')+_0x5ca0e5+_0x51c7('0x60')](_0x880809)[_0x51c7('0x27')](function(_0x36d28a){var _0x45a465=_['map'](_0x36d28a,function(_0x5f58a4){return _0x5f58a4[_0x51c7('0x7a')](_0x941093['query'][_0x51c7('0x65')],{'transaction':_0x55f740})[_0x51c7('0x27')](function(){var _0x4eb9fc=JSON['parse']('['+_0x941093['query'][_0x51c7('0x65')]+']');var _0xdf2202=_[_0x51c7('0x34')](_0x4eb9fc,function(_0x438215){socket[_0x51c7('0x7b')](_0x51c7('0x4d')+_0x5ca0e5+_0x51c7('0x7c'),{'UserId':Number(_0x438215),[_0x5ca0e5+_0x51c7('0x73')]:_0x5f58a4['id']});if(_0x5ca0e5!==_0x51c7('0x67'))return;return db['UserVoiceQueueRt'][_0x51c7('0x28')]({'where':{'VoiceQueueId':_0x5f58a4['id'],'UserId':_0x438215},'transaction':_0x55f740});});return Promise[_0x51c7('0x78')](_0xdf2202);});});return Promise[_0x51c7('0x78')](_0x45a465);});});return Promise[_0x51c7('0x78')](_0x3ccebc)[_0x51c7('0x27')](function(){return _0x321b1d[_0x51c7('0x7a')](_0x941093[_0x51c7('0x35')][_0x51c7('0x65')],{'transaction':_0x55f740});});});}})['then'](respondWithStatusCode(_0x405f5e,null))[_0x51c7('0x4a')](handleError(_0x405f5e,null));};exports[_0x51c7('0x7d')]=function(_0x244672,_0x1c2eaf,_0x7a0bb8){var _0x2bb6a6={};var _0x137656={};var _0x4c018b;var _0x550edf;return db[_0x51c7('0x2e')][_0x51c7('0x55')]({'where':{'id':_0x244672[_0x51c7('0x56')]['id']}})['then'](handleEntityNotFound(_0x1c2eaf,null))[_0x51c7('0x27')](function(_0x49f3b6){if(_0x49f3b6){_0x4c018b=_0x49f3b6;_0x137656['model']=_[_0x51c7('0x48')](db[_0x51c7('0x71')][_0x51c7('0x2f')]);_0x137656[_0x51c7('0x35')]=_[_0x51c7('0x48')](_0x244672[_0x51c7('0x35')]);_0x137656[_0x51c7('0x3f')]=_[_0x51c7('0x36')](_0x137656['model'],_0x137656[_0x51c7('0x35')]);_0x2bb6a6[_0x51c7('0x37')]=_['intersection'](_0x137656[_0x51c7('0x33')],qs[_0x51c7('0x38')](_0x244672[_0x51c7('0x35')][_0x51c7('0x38')]));_0x2bb6a6[_0x51c7('0x37')]=_0x2bb6a6[_0x51c7('0x37')]['length']?_0x2bb6a6[_0x51c7('0x37')]:_0x137656[_0x51c7('0x33')];_0x2bb6a6['order']=qs['sort'](_0x244672[_0x51c7('0x35')][_0x51c7('0x3d')]);_0x2bb6a6[_0x51c7('0x3e')]=qs[_0x51c7('0x3f')](_[_0x51c7('0x5e')](_0x244672[_0x51c7('0x35')],_0x137656['filters']));if(_0x244672['query'][_0x51c7('0x40')]){_0x2bb6a6[_0x51c7('0x3e')]=_['merge'](_0x2bb6a6['where'],{'$or':_[_0x51c7('0x34')](_0x2bb6a6[_0x51c7('0x37')],function(_0xfa35eb){var _0x2ae927={};_0x2ae927[_0xfa35eb]={'$like':'%'+_0x244672[_0x51c7('0x35')]['filter']+'%'};return _0x2ae927;})});}_0x2bb6a6=_['merge']({},_0x2bb6a6,_0x244672[_0x51c7('0x43')]);return _0x4c018b[_0x51c7('0x7d')](_0x2bb6a6);}})[_0x51c7('0x27')](function(_0x3897ab){if(_0x3897ab){_0x550edf=_0x3897ab['length'];if(!_0x244672[_0x51c7('0x35')]['hasOwnProperty'](_0x51c7('0x3b'))){_0x2bb6a6[_0x51c7('0x3c')]=qs[_0x51c7('0x3c')](_0x244672[_0x51c7('0x35')][_0x51c7('0x3c')]);_0x2bb6a6[_0x51c7('0x20')]=qs[_0x51c7('0x20')](_0x244672['query']['offset']);}return _0x4c018b[_0x51c7('0x7d')](_0x2bb6a6);}})[_0x51c7('0x27')](function(_0x5ae6bc){if(_0x5ae6bc){return _0x5ae6bc?{'count':_0x550edf,'rows':_0x5ae6bc}:null;}})[_0x51c7('0x27')](respondWithResult(_0x1c2eaf,null))[_0x51c7('0x4a')](handleError(_0x1c2eaf,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index fd38aa6..a1b1584 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 _0x8e8a=['remove','hasOwnProperty','exports','events','../../mysqldb','Team','setMaxListeners','save','update'];(function(_0x3d5eba,_0xec5ae0){var _0x48d279=function(_0x2ca9e6){while(--_0x2ca9e6){_0x3d5eba['push'](_0x3d5eba['shift']());}};_0x48d279(++_0xec5ae0);}(_0x8e8a,0x198));var _0xa8e8=function(_0x46f5a6,_0x20caa5){_0x46f5a6=_0x46f5a6-0x0;var _0x1a9226=_0x8e8a[_0x46f5a6];return _0x1a9226;};'use strict';var EventEmitter=require(_0xa8e8('0x0'));var Team=require(_0xa8e8('0x1'))['db'][_0xa8e8('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xa8e8('0x3')](0x0);var events={'afterCreate':_0xa8e8('0x4'),'afterUpdate':_0xa8e8('0x5'),'afterDestroy':_0xa8e8('0x6')};function emitEvent(_0x371771){return function(_0x431c56,_0x352766,_0x37c8a2){TeamEvents['emit'](_0x371771+':'+_0x431c56['id'],_0x431c56);TeamEvents['emit'](_0x371771,_0x431c56);_0x37c8a2(null);};}for(var e in events){if(events[_0xa8e8('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xa8e8('0x8')]=TeamEvents; \ No newline at end of file +var _0xad3f=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x1ff106,_0x58c90e){var _0x4274cd=function(_0x44d2f5){while(--_0x44d2f5){_0x1ff106['push'](_0x1ff106['shift']());}};_0x4274cd(++_0x58c90e);}(_0xad3f,0x133));var _0xfad3=function(_0x1eaf73,_0x75d844){_0x1eaf73=_0x1eaf73-0x0;var _0x26f9f9=_0xad3f[_0x1eaf73];return _0x26f9f9;};'use strict';var EventEmitter=require(_0xfad3('0x0'));var Team=require(_0xfad3('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xfad3('0x2')](0x0);var events={'afterCreate':_0xfad3('0x3'),'afterUpdate':'update','afterDestroy':_0xfad3('0x4')};function emitEvent(_0x40dc1d){return function(_0x574642,_0x4ee34f,_0x2663c2){TeamEvents['emit'](_0x40dc1d+':'+_0x574642['id'],_0x574642);TeamEvents[_0xfad3('0x5')](_0x40dc1d,_0x574642);_0x2663c2(null);};}for(var e in events){if(events[_0xfad3('0x6')](e)){var event=events[e];Team[_0xfad3('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 16590e9..f672c94 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 _0xd9cd=['rimraf','../../config/environment','./team.attributes','exports','define','teams','lodash','util','../../config/logger','api','request-promise'];(function(_0x4255f6,_0x95df37){var _0x1ef354=function(_0x533fbc){while(--_0x533fbc){_0x4255f6['push'](_0x4255f6['shift']());}};_0x1ef354(++_0x95df37);}(_0xd9cd,0xcc));var _0xdd9c=function(_0xc29e65,_0x7f1e9e){_0xc29e65=_0xc29e65-0x0;var _0x36240d=_0xd9cd[_0xc29e65];return _0x36240d;};'use strict';var _=require(_0xdd9c('0x0'));var util=require(_0xdd9c('0x1'));var logger=require(_0xdd9c('0x2'))(_0xdd9c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdd9c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdd9c('0x5'));var config=require(_0xdd9c('0x6'));var attributes=require(_0xdd9c('0x7'));module[_0xdd9c('0x8')]=function(_0x3ed72e,_0x128215){return _0x3ed72e[_0xdd9c('0x9')]('Team',attributes,{'tableName':_0xdd9c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50c4=['moment','bluebird','request-promise','path','exports','define','Team','teams','lodash','util','api'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x50c4,0xce));var _0x450c=function(_0x41d2d4,_0x12bcf4){_0x41d2d4=_0x41d2d4-0x0;var _0x225e0f=_0x50c4[_0x41d2d4];return _0x225e0f;};'use strict';var _=require(_0x450c('0x0'));var util=require(_0x450c('0x1'));var logger=require('../../config/logger')(_0x450c('0x2'));var moment=require(_0x450c('0x3'));var BPromise=require(_0x450c('0x4'));var rp=require(_0x450c('0x5'));var fs=require('fs');var path=require(_0x450c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./team.attributes');module[_0x450c('0x7')]=function(_0x791ee5,_0x540c14){return _0x791ee5[_0x450c('0x8')](_0x450c('0x9'),attributes,{'tableName':_0x450c('0xa'),'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 c04f42c..d17aa1d 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 _0xeff2=['jayson/promise','client','http','redis','defaults','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x2c9944,_0x5153e0){var _0x456f97=function(_0x5b811f){while(--_0x5b811f){_0x2c9944['push'](_0x2c9944['shift']());}};_0x456f97(++_0x5153e0);}(_0xeff2,0xff));var _0x2eff=function(_0x455a50,_0x831faf){_0x455a50=_0x455a50-0x0;var _0x26c090=_0xeff2[_0x455a50];return _0x26c090;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2eff('0x0'));var BPromise=require('bluebird');var rs=require(_0x2eff('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2eff('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x2eff('0x3'))('rpc');var config=require(_0x2eff('0x4'));var jayson=require(_0x2eff('0x5'));var client=jayson[_0x2eff('0x6')][_0x2eff('0x7')]({'port':0x232a});config[_0x2eff('0x8')]=_[_0x2eff('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2eff('0xa'))(new Redis(config[_0x2eff('0x8')]));require(_0x2eff('0xb'))[_0x2eff('0xc')](socket);function respondWithRpcPromise(_0x37372a,_0x3f2689,_0x439124){return new BPromise(function(_0x3f0675,_0x168761){return client[_0x2eff('0xd')](_0x37372a,_0x439124)[_0x2eff('0xe')](function(_0x5273c4){logger[_0x2eff('0xf')](_0x2eff('0x10'),_0x3f2689,_0x2eff('0x11'));logger[_0x2eff('0x12')](_0x2eff('0x13'),_0x3f2689,'request\x20sent',JSON[_0x2eff('0x14')](_0x5273c4));if(_0x5273c4[_0x2eff('0x15')]){if(_0x5273c4[_0x2eff('0x15')][_0x2eff('0x16')]===0x1f4){logger[_0x2eff('0x15')](_0x2eff('0x10'),_0x3f2689,_0x5273c4[_0x2eff('0x15')][_0x2eff('0x17')]);return _0x168761(_0x5273c4[_0x2eff('0x15')][_0x2eff('0x17')]);}logger[_0x2eff('0x15')](_0x2eff('0x10'),_0x3f2689,_0x5273c4['error'][_0x2eff('0x17')]);return _0x3f0675(_0x5273c4['error']['message']);}else{logger[_0x2eff('0xf')]('Team,\x20%s,\x20%s',_0x3f2689,_0x2eff('0x11'));_0x3f0675(_0x5273c4[_0x2eff('0x18')][_0x2eff('0x17')]);}})[_0x2eff('0x19')](function(_0x2731f5){logger[_0x2eff('0x15')](_0x2eff('0x10'),_0x3f2689,_0x2731f5);_0x168761(_0x2731f5);});});} \ No newline at end of file +var _0x5409=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','request','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','code','error','Team,\x20%s,\x20%s','message'];(function(_0x132fb6,_0x7a257b){var _0x2ca9d5=function(_0x490d53){while(--_0x490d53){_0x132fb6['push'](_0x132fb6['shift']());}};_0x2ca9d5(++_0x7a257b);}(_0x5409,0x12e));var _0x9540=function(_0x98ba9e,_0x28de31){_0x98ba9e=_0x98ba9e-0x0;var _0x138bf3=_0x5409[_0x98ba9e];return _0x138bf3;};'use strict';var _=require(_0x9540('0x0'));var util=require(_0x9540('0x1'));var moment=require(_0x9540('0x2'));var BPromise=require(_0x9540('0x3'));var rs=require(_0x9540('0x4'));var fs=require('fs');var Redis=require(_0x9540('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9540('0x6'));var logger=require(_0x9540('0x7'))(_0x9540('0x8'));var config=require(_0x9540('0x9'));var jayson=require(_0x9540('0xa'));var client=jayson[_0x9540('0xb')][_0x9540('0xc')]({'port':0x232a});config[_0x9540('0xd')]=_[_0x9540('0xe')](config[_0x9540('0xd')],{'host':_0x9540('0xf'),'port':0x18eb});var socket=require(_0x9540('0x10'))(new Redis(config[_0x9540('0xd')]));require(_0x9540('0x11'))['register'](socket);function respondWithRpcPromise(_0x5bb093,_0xd8f7de,_0x120fe3){return new BPromise(function(_0x53ea61,_0x5d6e7f){return client[_0x9540('0x12')](_0x5bb093,_0x120fe3)[_0x9540('0x13')](function(_0x8a2a80){logger[_0x9540('0x14')]('Team,\x20%s,\x20%s',_0xd8f7de,_0x9540('0x15'));logger[_0x9540('0x16')](_0x9540('0x17'),_0xd8f7de,_0x9540('0x15'),JSON['stringify'](_0x8a2a80));if(_0x8a2a80['error']){if(_0x8a2a80['error'][_0x9540('0x18')]===0x1f4){logger[_0x9540('0x19')](_0x9540('0x1a'),_0xd8f7de,_0x8a2a80[_0x9540('0x19')][_0x9540('0x1b')]);return _0x5d6e7f(_0x8a2a80[_0x9540('0x19')]['message']);}logger[_0x9540('0x19')](_0x9540('0x1a'),_0xd8f7de,_0x8a2a80[_0x9540('0x19')][_0x9540('0x1b')]);return _0x53ea61(_0x8a2a80[_0x9540('0x19')]['message']);}else{logger[_0x9540('0x14')]('Team,\x20%s,\x20%s',_0xd8f7de,'request\x20sent');_0x53ea61(_0x8a2a80[_0x9540('0x1c')][_0x9540('0x1b')]);}})[_0x9540('0x1d')](function(_0x483a07){logger[_0x9540('0x19')](_0x9540('0x1a'),_0xd8f7de,_0x483a07);_0x5d6e7f(_0x483a07);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index f20ae48..5983de0 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 _0xfa45=['register','length','team:','./team.events','save','remove','update','removeListener'];(function(_0xcdfc4f,_0x8a111a){var _0x3f70d1=function(_0xc0f333){while(--_0xc0f333){_0xcdfc4f['push'](_0xcdfc4f['shift']());}};_0x3f70d1(++_0x8a111a);}(_0xfa45,0x11b));var _0x5fa4=function(_0x357a26,_0x38acd1){_0x357a26=_0x357a26-0x0;var _0x6fced6=_0xfa45[_0x357a26];return _0x6fced6;};'use strict';var TeamEvents=require(_0x5fa4('0x0'));var events=[_0x5fa4('0x1'),_0x5fa4('0x2'),_0x5fa4('0x3')];function createListener(_0x46c739,_0x2d966c){return function(_0x1e88c8){_0x2d966c['emit'](_0x46c739,_0x1e88c8);};}function removeListener(_0x2b3824,_0x4b7365){return function(){TeamEvents[_0x5fa4('0x4')](_0x2b3824,_0x4b7365);};}exports[_0x5fa4('0x5')]=function(_0x1121f8){for(var _0x260b0d=0x0,_0x28a266=events[_0x5fa4('0x6')];_0x260b0d<_0x28a266;_0x260b0d++){var _0x298dce=events[_0x260b0d];var _0x108de1=createListener(_0x5fa4('0x7')+_0x298dce,_0x1121f8);TeamEvents['on'](_0x298dce,_0x108de1);}}; \ No newline at end of file +var _0x7c71=['update','emit','removeListener','register','length','team:','./team.events','save','remove'];(function(_0x56a3dd,_0x2b1843){var _0x11edca=function(_0xd8b617){while(--_0xd8b617){_0x56a3dd['push'](_0x56a3dd['shift']());}};_0x11edca(++_0x2b1843);}(_0x7c71,0x177));var _0x17c7=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0x7c71[_0x3207aa];return _0x51758f;};'use strict';var TeamEvents=require(_0x17c7('0x0'));var events=[_0x17c7('0x1'),_0x17c7('0x2'),_0x17c7('0x3')];function createListener(_0x5f1e52,_0x323ba0){return function(_0x449af7){_0x323ba0[_0x17c7('0x4')](_0x5f1e52,_0x449af7);};}function removeListener(_0x5a4923,_0x4fed29){return function(){TeamEvents[_0x17c7('0x5')](_0x5a4923,_0x4fed29);};}exports[_0x17c7('0x6')]=function(_0x26b276){for(var _0x3e98d9=0x0,_0x3c061b=events[_0x17c7('0x7')];_0x3e98d9<_0x3c061b;_0x3e98d9++){var _0x1ff4ec=events[_0x3e98d9];var _0x50feb0=createListener(_0x17c7('0x8')+_0x1ff4ec,_0x26b276);TeamEvents['on'](_0x1ff4ec,_0x50feb0);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 4b39e0a..54b0db7 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 _0x8cc8=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x42844f,_0x454277){var _0x3b8739=function(_0x59cb26){while(--_0x59cb26){_0x42844f['push'](_0x42844f['shift']());}};_0x3b8739(++_0x454277);}(_0x8cc8,0x177));var _0x88cc=function(_0x1efe1e,_0x20e1dc){_0x1efe1e=_0x1efe1e-0x0;var _0x4f6832=_0x8cc8[_0x1efe1e];return _0x4f6832;};'use strict';var multer=require(_0x88cc('0x0'));var util=require(_0x88cc('0x1'));var path=require(_0x88cc('0x2'));var timeout=require(_0x88cc('0x3'));var express=require(_0x88cc('0x4'));var router=express[_0x88cc('0x5')]();var fs_extra=require(_0x88cc('0x6'));var auth=require(_0x88cc('0x7'));var interaction=require(_0x88cc('0x8'));var config=require(_0x88cc('0x9'));module[_0x88cc('0xa')]=router; \ No newline at end of file +var _0xf7b4=['../../config/environment','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x43a8b0,_0x2b5908){var _0x3aaf7b=function(_0x486421){while(--_0x486421){_0x43a8b0['push'](_0x43a8b0['shift']());}};_0x3aaf7b(++_0x2b5908);}(_0xf7b4,0x152));var _0x4f7b=function(_0x4f0c68,_0x153910){_0x4f0c68=_0x4f0c68-0x0;var _0x5ad1f7=_0xf7b4[_0x4f0c68];return _0x5ad1f7;};'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'));module[_0x4f7b('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index f5b15fd..f353f2e 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 _0xbaf0=['exports','INTEGER'];(function(_0x4667b2,_0x135b67){var _0x1070f2=function(_0xa72ca5){while(--_0xa72ca5){_0x4667b2['push'](_0x4667b2['shift']());}};_0x1070f2(++_0x135b67);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x197115,_0x14d69a){var _0x19d830=function(_0x1f59c5){while(--_0x1f59c5){_0x197115['push'](_0x197115['shift']());}};_0x19d830(++_0x14d69a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 378aa66..370031a 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 _0xcac1=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./teamVoiceQueue.attributes'];(function(_0x6dd869,_0x42b780){var _0x4fcc47=function(_0x2727cb){while(--_0x2727cb){_0x6dd869['push'](_0x6dd869['shift']());}};_0x4fcc47(++_0x42b780);}(_0xcac1,0x195));var _0x1cac=function(_0x2b30fe,_0xe92c0a){_0x2b30fe=_0x2b30fe-0x0;var _0x2d1e4e=_0xcac1[_0x2b30fe];return _0x2d1e4e;};'use strict';var _=require(_0x1cac('0x0'));var util=require(_0x1cac('0x1'));var logger=require('../../config/logger')(_0x1cac('0x2'));var moment=require(_0x1cac('0x3'));var BPromise=require(_0x1cac('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cac('0x5'));var rimraf=require(_0x1cac('0x6'));var config=require(_0x1cac('0x7'));var attributes=require(_0x1cac('0x8'));module['exports']=function(_0x1e9d34,_0x25a726){return _0x1e9d34['define']('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd29=['define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./teamVoiceQueue.attributes'];(function(_0x2858b1,_0x296858){var _0x1cf8b9=function(_0x5e3cec){while(--_0x5e3cec){_0x2858b1['push'](_0x2858b1['shift']());}};_0x1cf8b9(++_0x296858);}(_0xdd29,0x16b));var _0x9dd2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd29[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9dd2('0x0'));var util=require(_0x9dd2('0x1'));var logger=require(_0x9dd2('0x2'))('api');var moment=require(_0x9dd2('0x3'));var BPromise=require(_0x9dd2('0x4'));var rp=require(_0x9dd2('0x5'));var fs=require('fs');var path=require(_0x9dd2('0x6'));var rimraf=require('rimraf');var config=require(_0x9dd2('0x7'));var attributes=require(_0x9dd2('0x8'));module['exports']=function(_0x3bf819,_0x20579e){return _0x3bf819[_0x9dd2('0x9')](_0x9dd2('0xa'),attributes,{'tableName':_0x9dd2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index ae93ccb..47381e6 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 _0x9eac=['util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x500923,_0x3689d9){var _0x4c4e33=function(_0x48f469){while(--_0x48f469){_0x500923['push'](_0x500923['shift']());}};_0x4c4e33(++_0x3689d9);}(_0x9eac,0x1a3));var _0xc9ea=function(_0x16a223,_0x31b6e8){_0x16a223=_0x16a223-0x0;var _0x5ded66=_0x9eac[_0x16a223];return _0x5ded66;};'use strict';var _=require(_0xc9ea('0x0'));var util=require(_0xc9ea('0x1'));var moment=require('moment');var BPromise=require(_0xc9ea('0x2'));var rs=require(_0xc9ea('0x3'));var fs=require('fs');var Redis=require(_0xc9ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc9ea('0x5'))(_0xc9ea('0x6'));var config=require(_0xc9ea('0x7'));var jayson=require(_0xc9ea('0x8'));var client=jayson['client'][_0xc9ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28448c,_0x508bc0,_0xd56dae){return new BPromise(function(_0x181810,_0x3d304b){return client[_0xc9ea('0xa')](_0x28448c,_0xd56dae)[_0xc9ea('0xb')](function(_0x446b29){logger[_0xc9ea('0xc')](_0xc9ea('0xd'),_0x508bc0,_0xc9ea('0xe'));logger['debug'](_0xc9ea('0xf'),_0x508bc0,'request\x20sent',JSON[_0xc9ea('0x10')](_0x446b29));if(_0x446b29[_0xc9ea('0x11')]){if(_0x446b29['error']['code']===0x1f4){logger[_0xc9ea('0x11')](_0xc9ea('0xd'),_0x508bc0,_0x446b29[_0xc9ea('0x11')][_0xc9ea('0x12')]);return _0x3d304b(_0x446b29[_0xc9ea('0x11')][_0xc9ea('0x12')]);}logger[_0xc9ea('0x11')](_0xc9ea('0xd'),_0x508bc0,_0x446b29[_0xc9ea('0x11')][_0xc9ea('0x12')]);return _0x181810(_0x446b29[_0xc9ea('0x11')][_0xc9ea('0x12')]);}else{logger[_0xc9ea('0xc')](_0xc9ea('0xd'),_0x508bc0,_0xc9ea('0xe'));_0x181810(_0x446b29[_0xc9ea('0x13')][_0xc9ea('0x12')]);}})[_0xc9ea('0x14')](function(_0x4f894c){logger[_0xc9ea('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x508bc0,_0x4f894c);_0x3d304b(_0x4f894c);});});} \ No newline at end of file +var _0x7bc8=['message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x10fe43,_0x584402){var _0xd4ff1a=function(_0x7d7771){while(--_0x7d7771){_0x10fe43['push'](_0x10fe43['shift']());}};_0xd4ff1a(++_0x584402);}(_0x7bc8,0x10b));var _0x87bc=function(_0x3a7691,_0xd5769d){_0x3a7691=_0x3a7691-0x0;var _0x5f2d74=_0x7bc8[_0x3a7691];return _0x5f2d74;};'use strict';var _=require(_0x87bc('0x0'));var util=require(_0x87bc('0x1'));var moment=require(_0x87bc('0x2'));var BPromise=require(_0x87bc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x87bc('0x4'));var db=require(_0x87bc('0x5'))['db'];var utils=require(_0x87bc('0x6'));var logger=require(_0x87bc('0x7'))(_0x87bc('0x8'));var config=require(_0x87bc('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x87bc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bf192,_0x2e2e8c,_0x5d6b9a){return new BPromise(function(_0x52b6f7,_0x5acfda){return client[_0x87bc('0xb')](_0x2bf192,_0x5d6b9a)['then'](function(_0x3819c9){logger['info'](_0x87bc('0xc'),_0x2e2e8c,_0x87bc('0xd'));logger[_0x87bc('0xe')](_0x87bc('0xf'),_0x2e2e8c,_0x87bc('0xd'),JSON[_0x87bc('0x10')](_0x3819c9));if(_0x3819c9[_0x87bc('0x11')]){if(_0x3819c9[_0x87bc('0x11')][_0x87bc('0x12')]===0x1f4){logger[_0x87bc('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2e2e8c,_0x3819c9[_0x87bc('0x11')][_0x87bc('0x13')]);return _0x5acfda(_0x3819c9['error'][_0x87bc('0x13')]);}logger['error'](_0x87bc('0xc'),_0x2e2e8c,_0x3819c9[_0x87bc('0x11')]['message']);return _0x52b6f7(_0x3819c9[_0x87bc('0x11')][_0x87bc('0x13')]);}else{logger[_0x87bc('0x14')](_0x87bc('0xc'),_0x2e2e8c,_0x87bc('0xd'));_0x52b6f7(_0x3819c9[_0x87bc('0x15')][_0x87bc('0x13')]);}})['catch'](function(_0x3b09fa){logger[_0x87bc('0x11')](_0x87bc('0xc'),_0x2e2e8c,_0x3b09fa);_0x5acfda(_0x3b09fa);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 7996b62..a71db40 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 _0x7fbe=['./template.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x34f9d0,_0x1149c8){var _0x105c38=function(_0x4226bf){while(--_0x4226bf){_0x34f9d0['push'](_0x34f9d0['shift']());}};_0x105c38(++_0x1149c8);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x5e709a,_0x1d7975){_0x5e709a=_0x5e709a-0x0;var _0x57401a=_0x7fbe[_0x5e709a];return _0x57401a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0xe')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);router['put']('/:id',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x10')]);router[_0xe7fb('0x11')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x12')]);module[_0xe7fb('0x13')]=router; \ No newline at end of file +var _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','show','create'];(function(_0x39be0e,_0x448f15){var _0x1fa5eb=function(_0x10ceb0){while(--_0x10ceb0){_0x39be0e['push'](_0x39be0e['shift']());}};_0x1fa5eb(++_0x448f15);}(_0x55ca,0x126));var _0xa55c=function(_0x4fc421,_0x94e88){_0x4fc421=_0x4fc421-0x0;var _0x8c6d63=_0x55ca[_0x4fc421];return _0x8c6d63;};'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['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 8aefc13..b43872b 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 _0x2ea8=['STRING','exports'];(function(_0x2936ef,_0x2e3a68){var _0x52702d=function(_0x27c245){while(--_0x27c245){_0x2936ef['push'](_0x2936ef['shift']());}};_0x52702d(++_0x2e3a68);}(_0x2ea8,0x73));var _0x82ea=function(_0x58b3d5,_0x5584f8){_0x58b3d5=_0x58b3d5-0x0;var _0x2f6de9=_0x2ea8[_0x58b3d5];return _0x2f6de9;};'use strict';var Sequelize=require('sequelize');module[_0x82ea('0x0')]={'name':{'type':Sequelize[_0x82ea('0x1')]},'description':{'type':Sequelize[_0x82ea('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xf45a=['STRING','sequelize'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf45a,0xcf));var _0xaf45=function(_0x4aac12,_0x3097e5){_0x4aac12=_0x4aac12-0x0;var _0xb7aa3a=_0xf45a[_0x4aac12];return _0xb7aa3a;};'use strict';var Sequelize=require(_0xaf45('0x0'));module['exports']={'name':{'type':Sequelize[_0xaf45('0x1')]},'description':{'type':Sequelize[_0xaf45('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 09c7796..5458b46 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 _0xa902=['to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','count','offset','limit','set','json','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','end','name','index','map','Template','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','filter','VIRTUAL','merge','includeAll','include','findAll','catch','params','options','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox'];(function(_0x29c603,_0x32acf9){var _0x5daca3=function(_0x32fd74){while(--_0x32fd74){_0x29c603['push'](_0x29c603['shift']());}};_0x5daca3(++_0x32acf9);}(_0xa902,0x8d));var _0x2a90=function(_0x441221,_0x166082){_0x441221=_0x441221-0x0;var _0x497e40=_0xa902[_0x441221];return _0x497e40;};'use strict';var pdf=require(_0x2a90('0x0'));var emlformat=require(_0x2a90('0x1'));var rimraf=require(_0x2a90('0x2'));var zipdir=require(_0x2a90('0x3'));var jsonpatch=require(_0x2a90('0x4'));var rp=require('request-promise');var moment=require(_0x2a90('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2a90('0x6'));var path=require(_0x2a90('0x7'));var sox=require(_0x2a90('0x8'));var csv=require(_0x2a90('0x9'));var ejs=require(_0x2a90('0xa'));var fs=require('fs');var fs_extra=require(_0x2a90('0xb'));var _=require('lodash');var squel=require(_0x2a90('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2a90('0xd'));var toCsv=require(_0x2a90('0x9'));var querystring=require(_0x2a90('0xe'));var Papa=require(_0x2a90('0xf'));var Redis=require(_0x2a90('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2a90('0x11'));var as=require(_0x2a90('0x12'));var hardwareService=require(_0x2a90('0x13'));var logger=require(_0x2a90('0x14'))('api');var utils=require(_0x2a90('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2a90('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f6953,_0x57aee3){_0x57aee3=_0x57aee3||0xcc;return function(_0x407ce5){if(_0x407ce5){return _0x1f6953[_0x2a90('0x17')](_0x57aee3);}return _0x1f6953[_0x2a90('0x18')](_0x57aee3)['end']();};}function respondWithResult(_0x56d1b8,_0x57227c){_0x57227c=_0x57227c||0xc8;return function(_0x46cb32){if(_0x46cb32){return _0x56d1b8[_0x2a90('0x18')](_0x57227c)['json'](_0x46cb32);}};}function respondWithFilteredResult(_0x1ff63d,_0x21c648){return function(_0x312782){if(_0x312782){var _0x25bd0e=_0x312782[_0x2a90('0x19')],_0x3200b4=_0x21c648[_0x2a90('0x1a')],_0x37858e=_0x21c648['offset']+_0x21c648[_0x2a90('0x1b')],_0x2fa60f;if(_0x37858e>=_0x25bd0e){_0x37858e=_0x25bd0e;_0x2fa60f=0xc8;}else{_0x2fa60f=0xce;}_0x1ff63d[_0x2a90('0x18')](_0x2fa60f);return _0x1ff63d[_0x2a90('0x1c')]('Content-Range',_0x3200b4+'-'+_0x37858e+'/'+_0x25bd0e)[_0x2a90('0x1d')](_0x312782);}return null;};}function patchUpdates(_0x1f51a6){return function(_0x148d18){try{jsonpatch[_0x2a90('0x1e')](_0x148d18,_0x1f51a6,!![]);}catch(_0x13809a){return BPromise[_0x2a90('0x1f')](_0x13809a);}return _0x148d18[_0x2a90('0x20')]();};}function saveUpdates(_0x114d42,_0xf97adb){return function(_0x465284){if(_0x465284){return _0x465284[_0x2a90('0x21')](_0x114d42)[_0x2a90('0x22')](function(_0x4fdd62){return _0x4fdd62;});}return null;};}function removeEntity(_0x3da7d0,_0x217873){return function(_0x2955a9){if(_0x2955a9){return _0x2955a9[_0x2a90('0x23')]()['then'](function(){var _0x180485=_0x2955a9[_0x2a90('0x24')]({'plain':!![]});var _0x4ed9e6=_0x2a90('0x25');return db[_0x2a90('0x26')][_0x2a90('0x23')]({'where':{'type':_0x4ed9e6,'resourceId':_0x180485['id']}})[_0x2a90('0x22')](function(){return _0x2955a9;});})[_0x2a90('0x22')](function(){_0x3da7d0[_0x2a90('0x18')](0xcc)[_0x2a90('0x27')]();});}};}function handleEntityNotFound(_0x24a6d3,_0x48c2f9){return function(_0x27f883){if(!_0x27f883){_0x24a6d3[_0x2a90('0x17')](0x194);}return _0x27f883;};}function handleError(_0x3934d4,_0x40c61a){_0x40c61a=_0x40c61a||0x1f4;return function(_0x8544e5){logger['error'](_0x8544e5['stack']);if(_0x8544e5[_0x2a90('0x28')]){delete _0x8544e5['name'];}_0x3934d4['status'](_0x40c61a)['send'](_0x8544e5);};}exports[_0x2a90('0x29')]=function(_0x3c78f5,_0x595638){var _0x5bd700={},_0x1add9a={},_0x5b5cc1={'count':0x0,'rows':[]};var _0x35570e=_[_0x2a90('0x2a')](db[_0x2a90('0x2b')][_0x2a90('0x2c')],function(_0xf18d11){return{'name':_0xf18d11[_0x2a90('0x2d')],'type':_0xf18d11[_0x2a90('0x2e')]['key']};});_0x1add9a[_0x2a90('0x2f')]=_[_0x2a90('0x2a')](_0x35570e,_0x2a90('0x28'));_0x1add9a['query']=_[_0x2a90('0x30')](_0x3c78f5[_0x2a90('0x31')]);_0x1add9a[_0x2a90('0x32')]=_[_0x2a90('0x33')](_0x1add9a['model'],_0x1add9a[_0x2a90('0x31')]);_0x5bd700[_0x2a90('0x34')]=_[_0x2a90('0x33')](_0x1add9a[_0x2a90('0x2f')],qs[_0x2a90('0x35')](_0x3c78f5[_0x2a90('0x31')]['fields']));_0x5bd700[_0x2a90('0x34')]=_0x5bd700[_0x2a90('0x34')][_0x2a90('0x36')]?_0x5bd700[_0x2a90('0x34')]:_0x1add9a['model'];if(!_0x3c78f5[_0x2a90('0x31')][_0x2a90('0x37')]('nolimit')){_0x5bd700[_0x2a90('0x1b')]=qs[_0x2a90('0x1b')](_0x3c78f5['query']['limit']);_0x5bd700[_0x2a90('0x1a')]=qs[_0x2a90('0x1a')](_0x3c78f5[_0x2a90('0x31')]['offset']);}_0x5bd700[_0x2a90('0x38')]=qs['sort'](_0x3c78f5[_0x2a90('0x31')]['sort']);_0x5bd700[_0x2a90('0x39')]=qs['filters'](_['pick'](_0x3c78f5[_0x2a90('0x31')],_0x1add9a['filters']),_0x35570e);if(_0x3c78f5[_0x2a90('0x31')][_0x2a90('0x3a')]){_0x5bd700[_0x2a90('0x39')]=_['merge'](_0x5bd700[_0x2a90('0x39')],{'$or':_[_0x2a90('0x2a')](_0x35570e,function(_0x3be438){if(_0x3be438['type']!==_0x2a90('0x3b')){var _0x2d6a44={};_0x2d6a44[_0x3be438[_0x2a90('0x28')]]={'$like':'%'+_0x3c78f5['query'][_0x2a90('0x3a')]+'%'};return _0x2d6a44;}})});}_0x5bd700=_[_0x2a90('0x3c')]({},_0x5bd700,_0x3c78f5['options']);var _0x2771e8={'where':_0x5bd700[_0x2a90('0x39')]};return db[_0x2a90('0x2b')][_0x2a90('0x19')](_0x2771e8)[_0x2a90('0x22')](function(_0x3f2685){_0x5b5cc1[_0x2a90('0x19')]=_0x3f2685;if(_0x3c78f5[_0x2a90('0x31')][_0x2a90('0x3d')]){_0x5bd700[_0x2a90('0x3e')]=[{'all':!![]}];}return db[_0x2a90('0x2b')][_0x2a90('0x3f')](_0x5bd700);})[_0x2a90('0x22')](function(_0x18a6ea){_0x5b5cc1['rows']=_0x18a6ea;return _0x5b5cc1;})[_0x2a90('0x22')](respondWithFilteredResult(_0x595638,_0x5bd700))[_0x2a90('0x40')](handleError(_0x595638,null));};exports['show']=function(_0x1045bb,_0x1e971c){var _0x7cde7b={'raw':!![],'where':{'id':_0x1045bb[_0x2a90('0x41')]['id']}},_0xbcf5cc={};_0xbcf5cc['model']=_[_0x2a90('0x30')](db['Template'][_0x2a90('0x2c')]);_0xbcf5cc['query']=_[_0x2a90('0x30')](_0x1045bb[_0x2a90('0x31')]);_0xbcf5cc[_0x2a90('0x32')]=_[_0x2a90('0x33')](_0xbcf5cc[_0x2a90('0x2f')],_0xbcf5cc[_0x2a90('0x31')]);_0x7cde7b[_0x2a90('0x34')]=_['intersection'](_0xbcf5cc['model'],qs[_0x2a90('0x35')](_0x1045bb[_0x2a90('0x31')][_0x2a90('0x35')]));_0x7cde7b[_0x2a90('0x34')]=_0x7cde7b[_0x2a90('0x34')][_0x2a90('0x36')]?_0x7cde7b[_0x2a90('0x34')]:_0xbcf5cc[_0x2a90('0x2f')];if(_0x1045bb['query'][_0x2a90('0x3d')]){_0x7cde7b['include']=[{'all':!![]}];}_0x7cde7b=_[_0x2a90('0x3c')]({},_0x7cde7b,_0x1045bb[_0x2a90('0x42')]);return db['Template'][_0x2a90('0x43')](_0x7cde7b)[_0x2a90('0x22')](handleEntityNotFound(_0x1e971c,null))[_0x2a90('0x22')](respondWithResult(_0x1e971c,null))[_0x2a90('0x40')](handleError(_0x1e971c,null));};exports[_0x2a90('0x44')]=function(_0x43a931,_0x3ad6c2){return db['Template']['create'](_0x43a931[_0x2a90('0x45')],{})[_0x2a90('0x22')](function(_0x42c890){var _0x43266a=_0x43a931[_0x2a90('0x46')]['get']({'plain':!![]});if(!_0x43266a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43266a[_0x2a90('0x47')]===_0x2a90('0x46')){var _0x53d682=_0x42c890['get']({'plain':!![]});var _0x48dc65=_0x2a90('0x25');return db['UserProfileSection'][_0x2a90('0x43')]({'where':{'name':_0x48dc65,'userProfileId':_0x43266a[_0x2a90('0x48')]},'raw':!![]})[_0x2a90('0x22')](function(_0x19e997){if(_0x19e997&&_0x19e997[_0x2a90('0x49')]===0x0){return db[_0x2a90('0x26')]['create']({'name':_0x53d682[_0x2a90('0x28')],'resourceId':_0x53d682['id'],'type':_0x19e997[_0x2a90('0x28')],'sectionId':_0x19e997['id']},{})['then'](function(){return _0x42c890;});}else{return _0x42c890;}})[_0x2a90('0x40')](function(_0x4d1303){logger['error'](_0x2a90('0x4a'),_0x4d1303);throw _0x4d1303;});}return _0x42c890;})[_0x2a90('0x22')](respondWithResult(_0x3ad6c2,0xc9))['catch'](handleError(_0x3ad6c2,null));};exports['update']=function(_0x2dd550,_0x5951eb){if(_0x2dd550[_0x2a90('0x45')]['id']){delete _0x2dd550[_0x2a90('0x45')]['id'];}return db['Template'][_0x2a90('0x43')]({'where':{'id':_0x2dd550[_0x2a90('0x41')]['id']}})[_0x2a90('0x22')](handleEntityNotFound(_0x5951eb,null))['then'](saveUpdates(_0x2dd550[_0x2a90('0x45')],null))[_0x2a90('0x22')](respondWithResult(_0x5951eb,null))['catch'](handleError(_0x5951eb,null));};exports['destroy']=function(_0x3ea646,_0x2172d4){return db['Template'][_0x2a90('0x43')]({'where':{'id':_0x3ea646['params']['id']}})[_0x2a90('0x22')](handleEntityNotFound(_0x2172d4,null))['then'](removeEntity(_0x2172d4,null))[_0x2a90('0x40')](handleError(_0x2172d4,null));}; \ No newline at end of file +var _0x34b7=['where','pick','merge','VIRTUAL','options','rows','catch','params','includeAll','find','create','body','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','map','Template','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','sort'];(function(_0x217077,_0x535e80){var _0x289538=function(_0x15f864){while(--_0x15f864){_0x217077['push'](_0x217077['shift']());}};_0x289538(++_0x535e80);}(_0x34b7,0x196));var _0x734b=function(_0x37b546,_0x8c85de){_0x37b546=_0x37b546-0x0;var _0x24a3b5=_0x34b7[_0x37b546];return _0x24a3b5;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x734b('0x0'));var zipdir=require(_0x734b('0x1'));var jsonpatch=require(_0x734b('0x2'));var rp=require(_0x734b('0x3'));var moment=require(_0x734b('0x4'));var BPromise=require(_0x734b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x734b('0x6'));var sox=require(_0x734b('0x7'));var csv=require(_0x734b('0x8'));var ejs=require(_0x734b('0x9'));var fs=require('fs');var fs_extra=require(_0x734b('0xa'));var _=require(_0x734b('0xb'));var squel=require('squel');var crypto=require(_0x734b('0xc'));var jsforce=require(_0x734b('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x734b('0xe'));var Redis=require('ioredis');var authService=require(_0x734b('0xf'));var qs=require(_0x734b('0x10'));var as=require(_0x734b('0x11'));var hardwareService=require(_0x734b('0x12'));var logger=require(_0x734b('0x13'))(_0x734b('0x14'));var utils=require(_0x734b('0x15'));var config=require(_0x734b('0x16'));var licenseUtil=require(_0x734b('0x17'));var db=require(_0x734b('0x18'))['db'];function respondWithStatusCode(_0x189a82,_0xff9ddf){_0xff9ddf=_0xff9ddf||0xcc;return function(_0x145ec3){if(_0x145ec3){return _0x189a82[_0x734b('0x19')](_0xff9ddf);}return _0x189a82['status'](_0xff9ddf)[_0x734b('0x1a')]();};}function respondWithResult(_0x252510,_0x47791c){_0x47791c=_0x47791c||0xc8;return function(_0xd1ab2a){if(_0xd1ab2a){return _0x252510[_0x734b('0x1b')](_0x47791c)[_0x734b('0x1c')](_0xd1ab2a);}};}function respondWithFilteredResult(_0x2372bd,_0x2c03bd){return function(_0xa6d111){if(_0xa6d111){var _0x4b8c63=_0xa6d111[_0x734b('0x1d')],_0x42407a=_0x2c03bd[_0x734b('0x1e')],_0x4d2d23=_0x2c03bd[_0x734b('0x1e')]+_0x2c03bd['limit'],_0x461df5;if(_0x4d2d23>=_0x4b8c63){_0x4d2d23=_0x4b8c63;_0x461df5=0xc8;}else{_0x461df5=0xce;}_0x2372bd['status'](_0x461df5);return _0x2372bd[_0x734b('0x1f')](_0x734b('0x20'),_0x42407a+'-'+_0x4d2d23+'/'+_0x4b8c63)[_0x734b('0x1c')](_0xa6d111);}return null;};}function patchUpdates(_0x41ba87){return function(_0x1c605c){try{jsonpatch[_0x734b('0x21')](_0x1c605c,_0x41ba87,!![]);}catch(_0x1c68c4){return BPromise[_0x734b('0x22')](_0x1c68c4);}return _0x1c605c[_0x734b('0x23')]();};}function saveUpdates(_0x1d2b27,_0x7060f8){return function(_0x3d0ffd){if(_0x3d0ffd){return _0x3d0ffd[_0x734b('0x24')](_0x1d2b27)[_0x734b('0x25')](function(_0x56f807){return _0x56f807;});}return null;};}function removeEntity(_0x1e4dcc,_0x7856d7){return function(_0x4f98a7){if(_0x4f98a7){return _0x4f98a7[_0x734b('0x26')]()[_0x734b('0x25')](function(){var _0x1a7908=_0x4f98a7[_0x734b('0x27')]({'plain':!![]});var _0x46d432=_0x734b('0x28');return db[_0x734b('0x29')][_0x734b('0x26')]({'where':{'type':_0x46d432,'resourceId':_0x1a7908['id']}})[_0x734b('0x25')](function(){return _0x4f98a7;});})[_0x734b('0x25')](function(){_0x1e4dcc[_0x734b('0x1b')](0xcc)[_0x734b('0x1a')]();});}};}function handleEntityNotFound(_0x3bb651,_0x566d55){return function(_0x49732b){if(!_0x49732b){_0x3bb651[_0x734b('0x19')](0x194);}return _0x49732b;};}function handleError(_0x3680a0,_0x47a0a9){_0x47a0a9=_0x47a0a9||0x1f4;return function(_0x32ea00){logger[_0x734b('0x2a')](_0x32ea00[_0x734b('0x2b')]);if(_0x32ea00[_0x734b('0x2c')]){delete _0x32ea00[_0x734b('0x2c')];}_0x3680a0[_0x734b('0x1b')](_0x47a0a9)[_0x734b('0x2d')](_0x32ea00);};}exports['index']=function(_0x1f3652,_0x436efe){var _0x42e9ae={},_0x241c89={},_0x729431={'count':0x0,'rows':[]};var _0x427c36=_[_0x734b('0x2e')](db[_0x734b('0x2f')][_0x734b('0x30')],function(_0x3065b0){return{'name':_0x3065b0['fieldName'],'type':_0x3065b0[_0x734b('0x31')][_0x734b('0x32')]};});_0x241c89['model']=_[_0x734b('0x2e')](_0x427c36,_0x734b('0x2c'));_0x241c89[_0x734b('0x33')]=_[_0x734b('0x34')](_0x1f3652[_0x734b('0x33')]);_0x241c89[_0x734b('0x35')]=_[_0x734b('0x36')](_0x241c89[_0x734b('0x37')],_0x241c89[_0x734b('0x33')]);_0x42e9ae[_0x734b('0x38')]=_[_0x734b('0x36')](_0x241c89[_0x734b('0x37')],qs[_0x734b('0x39')](_0x1f3652[_0x734b('0x33')][_0x734b('0x39')]));_0x42e9ae['attributes']=_0x42e9ae[_0x734b('0x38')]['length']?_0x42e9ae[_0x734b('0x38')]:_0x241c89[_0x734b('0x37')];if(!_0x1f3652[_0x734b('0x33')][_0x734b('0x3a')](_0x734b('0x3b'))){_0x42e9ae[_0x734b('0x3c')]=qs['limit'](_0x1f3652['query'][_0x734b('0x3c')]);_0x42e9ae['offset']=qs[_0x734b('0x1e')](_0x1f3652['query'][_0x734b('0x1e')]);}_0x42e9ae['order']=qs[_0x734b('0x3d')](_0x1f3652['query'][_0x734b('0x3d')]);_0x42e9ae[_0x734b('0x3e')]=qs[_0x734b('0x35')](_[_0x734b('0x3f')](_0x1f3652[_0x734b('0x33')],_0x241c89[_0x734b('0x35')]),_0x427c36);if(_0x1f3652[_0x734b('0x33')]['filter']){_0x42e9ae[_0x734b('0x3e')]=_[_0x734b('0x40')](_0x42e9ae['where'],{'$or':_[_0x734b('0x2e')](_0x427c36,function(_0x309b31){if(_0x309b31[_0x734b('0x31')]!==_0x734b('0x41')){var _0x4feaa8={};_0x4feaa8[_0x309b31[_0x734b('0x2c')]]={'$like':'%'+_0x1f3652[_0x734b('0x33')]['filter']+'%'};return _0x4feaa8;}})});}_0x42e9ae=_[_0x734b('0x40')]({},_0x42e9ae,_0x1f3652[_0x734b('0x42')]);var _0x5dc018={'where':_0x42e9ae[_0x734b('0x3e')]};return db[_0x734b('0x2f')][_0x734b('0x1d')](_0x5dc018)[_0x734b('0x25')](function(_0x56eb35){_0x729431['count']=_0x56eb35;if(_0x1f3652[_0x734b('0x33')]['includeAll']){_0x42e9ae['include']=[{'all':!![]}];}return db[_0x734b('0x2f')]['findAll'](_0x42e9ae);})[_0x734b('0x25')](function(_0x4d77f0){_0x729431[_0x734b('0x43')]=_0x4d77f0;return _0x729431;})[_0x734b('0x25')](respondWithFilteredResult(_0x436efe,_0x42e9ae))[_0x734b('0x44')](handleError(_0x436efe,null));};exports['show']=function(_0x5cf3a0,_0x2e1aa8){var _0x553824={'raw':!![],'where':{'id':_0x5cf3a0[_0x734b('0x45')]['id']}},_0x5c5e09={};_0x5c5e09[_0x734b('0x37')]=_['keys'](db[_0x734b('0x2f')]['rawAttributes']);_0x5c5e09[_0x734b('0x33')]=_[_0x734b('0x34')](_0x5cf3a0[_0x734b('0x33')]);_0x5c5e09['filters']=_[_0x734b('0x36')](_0x5c5e09[_0x734b('0x37')],_0x5c5e09[_0x734b('0x33')]);_0x553824[_0x734b('0x38')]=_['intersection'](_0x5c5e09['model'],qs['fields'](_0x5cf3a0[_0x734b('0x33')]['fields']));_0x553824['attributes']=_0x553824[_0x734b('0x38')]['length']?_0x553824[_0x734b('0x38')]:_0x5c5e09[_0x734b('0x37')];if(_0x5cf3a0[_0x734b('0x33')][_0x734b('0x46')]){_0x553824['include']=[{'all':!![]}];}_0x553824=_[_0x734b('0x40')]({},_0x553824,_0x5cf3a0['options']);return db[_0x734b('0x2f')][_0x734b('0x47')](_0x553824)[_0x734b('0x25')](handleEntityNotFound(_0x2e1aa8,null))['then'](respondWithResult(_0x2e1aa8,null))[_0x734b('0x44')](handleError(_0x2e1aa8,null));};exports['create']=function(_0x357ae4,_0x331a87){return db['Template'][_0x734b('0x48')](_0x357ae4[_0x734b('0x49')],{})[_0x734b('0x25')](function(_0x38125a){var _0x21e127=_0x357ae4['user'][_0x734b('0x27')]({'plain':!![]});if(!_0x21e127)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21e127[_0x734b('0x4a')]==='user'){var _0xd3c688=_0x38125a[_0x734b('0x27')]({'plain':!![]});var _0x1a7e12=_0x734b('0x28');return db[_0x734b('0x4b')]['find']({'where':{'name':_0x1a7e12,'userProfileId':_0x21e127['userProfileId']},'raw':!![]})['then'](function(_0x284a4e){if(_0x284a4e&&_0x284a4e[_0x734b('0x4c')]===0x0){return db['UserProfileResource'][_0x734b('0x48')]({'name':_0xd3c688[_0x734b('0x2c')],'resourceId':_0xd3c688['id'],'type':_0x284a4e['name'],'sectionId':_0x284a4e['id']},{})[_0x734b('0x25')](function(){return _0x38125a;});}else{return _0x38125a;}})[_0x734b('0x44')](function(_0x44e6d2){logger['error'](_0x734b('0x4d'),_0x44e6d2);throw _0x44e6d2;});}return _0x38125a;})[_0x734b('0x25')](respondWithResult(_0x331a87,0xc9))[_0x734b('0x44')](handleError(_0x331a87,null));};exports[_0x734b('0x24')]=function(_0x5e2d7c,_0x44cc7d){if(_0x5e2d7c[_0x734b('0x49')]['id']){delete _0x5e2d7c[_0x734b('0x49')]['id'];}return db[_0x734b('0x2f')]['find']({'where':{'id':_0x5e2d7c[_0x734b('0x45')]['id']}})['then'](handleEntityNotFound(_0x44cc7d,null))[_0x734b('0x25')](saveUpdates(_0x5e2d7c[_0x734b('0x49')],null))[_0x734b('0x25')](respondWithResult(_0x44cc7d,null))[_0x734b('0x44')](handleError(_0x44cc7d,null));};exports['destroy']=function(_0x2b9da7,_0x1af382){return db['Template']['find']({'where':{'id':_0x2b9da7[_0x734b('0x45')]['id']}})['then'](handleEntityNotFound(_0x1af382,null))[_0x734b('0x25')](removeEntity(_0x1af382,null))[_0x734b('0x44')](handleError(_0x1af382,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 61cdc3e..485e329 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 _0x115e=['request-promise','path','rimraf','../../config/environment','define','tools_templates','lodash','util','../../config/logger','api','moment'];(function(_0x1e3885,_0x64212b){var _0x26e5a9=function(_0x1c826f){while(--_0x1c826f){_0x1e3885['push'](_0x1e3885['shift']());}};_0x26e5a9(++_0x64212b);}(_0x115e,0xa0));var _0xe115=function(_0x58ab58,_0x486c25){_0x58ab58=_0x58ab58-0x0;var _0x5c41d9=_0x115e[_0x58ab58];return _0x5c41d9;};'use strict';var _=require(_0xe115('0x0'));var util=require(_0xe115('0x1'));var logger=require(_0xe115('0x2'))(_0xe115('0x3'));var moment=require(_0xe115('0x4'));var BPromise=require('bluebird');var rp=require(_0xe115('0x5'));var fs=require('fs');var path=require(_0xe115('0x6'));var rimraf=require(_0xe115('0x7'));var config=require(_0xe115('0x8'));var attributes=require('./template.attributes');module['exports']=function(_0x517c3f,_0x113895){return _0x517c3f[_0xe115('0x9')]('Template',attributes,{'tableName':_0xe115('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdee=['moment','bluebird','path','rimraf','./template.attributes','exports','define','tools_templates','lodash','util','api'];(function(_0x321985,_0x15180c){var _0x1f09f5=function(_0x2d5b8d){while(--_0x2d5b8d){_0x321985['push'](_0x321985['shift']());}};_0x1f09f5(++_0x15180c);}(_0xbdee,0x126));var _0xebde=function(_0x12e673,_0x441304){_0x12e673=_0x12e673-0x0;var _0x28991c=_0xbdee[_0x12e673];return _0x28991c;};'use strict';var _=require(_0xebde('0x0'));var util=require(_0xebde('0x1'));var logger=require('../../config/logger')(_0xebde('0x2'));var moment=require(_0xebde('0x3'));var BPromise=require(_0xebde('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xebde('0x5'));var rimraf=require(_0xebde('0x6'));var config=require('../../config/environment');var attributes=require(_0xebde('0x7'));module[_0xebde('0x8')]=function(_0x5cab15,_0x4e2037){return _0x5cab15[_0xebde('0x9')]('Template',attributes,{'tableName':_0xebde('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 17df3df..2aec6e4 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 _0x80f5=['request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','map','model','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','Template,\x20%s,\x20%s'];(function(_0x353898,_0xafeb34){var _0x2210da=function(_0x3eb0b7){while(--_0x3eb0b7){_0x353898['push'](_0x353898['shift']());}};_0x2210da(++_0xafeb34);}(_0x80f5,0x149));var _0x580f=function(_0x5998d0,_0x24ad81){_0x5998d0=_0x5998d0-0x0;var _0x47149d=_0x80f5[_0x5998d0];return _0x47149d;};'use strict';var _=require(_0x580f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x580f('0x1'));var rs=require(_0x580f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x580f('0x3'))['db'];var utils=require(_0x580f('0x4'));var logger=require('../../config/logger')(_0x580f('0x5'));var config=require(_0x580f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x580f('0x7')][_0x580f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x59cc6c,_0x4b0adf,_0x58d989){return new BPromise(function(_0x3c5c37,_0x40595b){return client['request'](_0x59cc6c,_0x58d989)[_0x580f('0x9')](function(_0x4ce333){logger[_0x580f('0xa')](_0x580f('0xb'),_0x4b0adf,_0x580f('0xc'));logger[_0x580f('0xd')](_0x580f('0xe'),_0x4b0adf,_0x580f('0xc'),JSON[_0x580f('0xf')](_0x4ce333));if(_0x4ce333[_0x580f('0x10')]){if(_0x4ce333['error'][_0x580f('0x11')]===0x1f4){logger[_0x580f('0x10')](_0x580f('0xb'),_0x4b0adf,_0x4ce333['error']['message']);return _0x40595b(_0x4ce333[_0x580f('0x10')]['message']);}logger[_0x580f('0x10')](_0x580f('0xb'),_0x4b0adf,_0x4ce333[_0x580f('0x10')]['message']);return _0x3c5c37(_0x4ce333[_0x580f('0x10')][_0x580f('0x12')]);}else{logger[_0x580f('0xa')](_0x580f('0xb'),_0x4b0adf,_0x580f('0xc'));_0x3c5c37(_0x4ce333['result'][_0x580f('0x12')]);}})[_0x580f('0x13')](function(_0x35e199){logger['error']('Template,\x20%s,\x20%s',_0x4b0adf,_0x35e199);_0x40595b(_0x35e199);});});}exports[_0x580f('0x14')]=function(_0x66c18){var _0x4cc054=this;return new Promise(function(_0x9c7927,_0x38906d){return db[_0x580f('0x15')][_0x580f('0x16')]({'raw':_0x66c18[_0x580f('0x17')]?_0x66c18[_0x580f('0x17')][_0x580f('0x18')]===undefined?!![]:![]:!![],'where':_0x66c18[_0x580f('0x17')]?_0x66c18[_0x580f('0x17')][_0x580f('0x19')]||null:null,'attributes':_0x66c18['options']?_0x66c18['options'][_0x580f('0x1a')]||null:null,'limit':_0x66c18[_0x580f('0x17')]?_0x66c18[_0x580f('0x17')][_0x580f('0x1b')]||null:null,'include':_0x66c18[_0x580f('0x17')]?_0x66c18[_0x580f('0x17')][_0x580f('0x1c')]?_[_0x580f('0x1d')](_0x66c18[_0x580f('0x17')][_0x580f('0x1c')],function(_0x7eaf1f){return{'model':db[_0x7eaf1f[_0x580f('0x1e')]],'as':_0x7eaf1f['as'],'attributes':_0x7eaf1f['attributes'],'include':_0x7eaf1f['include']?_['map'](_0x7eaf1f[_0x580f('0x1c')],function(_0x40222e){return{'model':db[_0x40222e[_0x580f('0x1e')]],'as':_0x40222e['as'],'attributes':_0x40222e['attributes'],'include':_0x40222e['include']?_[_0x580f('0x1d')](_0x40222e[_0x580f('0x1c')],function(_0x5c2dfb){return{'model':db[_0x5c2dfb[_0x580f('0x1e')]],'as':_0x5c2dfb['as'],'attributes':_0x5c2dfb[_0x580f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x580f('0x9')](function(_0x5e53ff){logger[_0x580f('0xa')](_0x580f('0x14'),_0x66c18);logger[_0x580f('0xd')]('GetTemplate',_0x66c18,JSON[_0x580f('0xf')](_0x5e53ff));_0x9c7927(_0x5e53ff);})['catch'](function(_0x1250d1){logger[_0x580f('0x10')](_0x580f('0x14'),_0x1250d1[_0x580f('0x12')],_0x66c18);_0x38906d(_0x4cc054[_0x580f('0x10')](0x1f4,_0x1250d1[_0x580f('0x12')]));});});}; \ No newline at end of file +var _0xba82=['request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','map','model','util','bluebird','ioredis','../../mysqldb','jayson/promise','request','then','info','Template,\x20%s,\x20%s'];(function(_0x56b928,_0x57ff0c){var _0x284b0a=function(_0x5ee18e){while(--_0x5ee18e){_0x56b928['push'](_0x56b928['shift']());}};_0x284b0a(++_0x57ff0c);}(_0xba82,0x17f));var _0x2ba8=function(_0x433c91,_0x53d791){_0x433c91=_0x433c91-0x0;var _0x117df6=_0xba82[_0x433c91];return _0x117df6;};'use strict';var _=require('lodash');var util=require(_0x2ba8('0x0'));var moment=require('moment');var BPromise=require(_0x2ba8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ba8('0x2'));var db=require(_0x2ba8('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2ba8('0x4'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x13bf77,_0xf71b25,_0x1bc319){return new BPromise(function(_0x55b20d,_0x3a48fe){return client[_0x2ba8('0x5')](_0x13bf77,_0x1bc319)[_0x2ba8('0x6')](function(_0x1d772c){logger[_0x2ba8('0x7')](_0x2ba8('0x8'),_0xf71b25,_0x2ba8('0x9'));logger[_0x2ba8('0xa')](_0x2ba8('0xb'),_0xf71b25,'request\x20sent',JSON[_0x2ba8('0xc')](_0x1d772c));if(_0x1d772c[_0x2ba8('0xd')]){if(_0x1d772c['error'][_0x2ba8('0xe')]===0x1f4){logger[_0x2ba8('0xd')](_0x2ba8('0x8'),_0xf71b25,_0x1d772c[_0x2ba8('0xd')]['message']);return _0x3a48fe(_0x1d772c[_0x2ba8('0xd')][_0x2ba8('0xf')]);}logger[_0x2ba8('0xd')](_0x2ba8('0x8'),_0xf71b25,_0x1d772c[_0x2ba8('0xd')][_0x2ba8('0xf')]);return _0x55b20d(_0x1d772c[_0x2ba8('0xd')][_0x2ba8('0xf')]);}else{logger[_0x2ba8('0x7')](_0x2ba8('0x8'),_0xf71b25,_0x2ba8('0x9'));_0x55b20d(_0x1d772c['result']['message']);}})[_0x2ba8('0x10')](function(_0x2b0630){logger['error'](_0x2ba8('0x8'),_0xf71b25,_0x2b0630);_0x3a48fe(_0x2b0630);});});}exports[_0x2ba8('0x11')]=function(_0x550828){var _0x4060da=this;return new Promise(function(_0x2d6d43,_0x12abc6){return db[_0x2ba8('0x12')][_0x2ba8('0x13')]({'raw':_0x550828['options']?_0x550828[_0x2ba8('0x14')][_0x2ba8('0x15')]===undefined?!![]:![]:!![],'where':_0x550828[_0x2ba8('0x14')]?_0x550828[_0x2ba8('0x14')][_0x2ba8('0x16')]||null:null,'attributes':_0x550828[_0x2ba8('0x14')]?_0x550828[_0x2ba8('0x14')][_0x2ba8('0x17')]||null:null,'limit':_0x550828[_0x2ba8('0x14')]?_0x550828['options'][_0x2ba8('0x18')]||null:null,'include':_0x550828[_0x2ba8('0x14')]?_0x550828[_0x2ba8('0x14')][_0x2ba8('0x19')]?_[_0x2ba8('0x1a')](_0x550828[_0x2ba8('0x14')][_0x2ba8('0x19')],function(_0x361402){return{'model':db[_0x361402[_0x2ba8('0x1b')]],'as':_0x361402['as'],'attributes':_0x361402[_0x2ba8('0x17')],'include':_0x361402[_0x2ba8('0x19')]?_['map'](_0x361402['include'],function(_0x18a537){return{'model':db[_0x18a537['model']],'as':_0x18a537['as'],'attributes':_0x18a537[_0x2ba8('0x17')],'include':_0x18a537[_0x2ba8('0x19')]?_[_0x2ba8('0x1a')](_0x18a537['include'],function(_0x505ec5){return{'model':db[_0x505ec5[_0x2ba8('0x1b')]],'as':_0x505ec5['as'],'attributes':_0x505ec5[_0x2ba8('0x17')]};}):[]};}):[]};}):[]:[]})[_0x2ba8('0x6')](function(_0x2890a1){logger[_0x2ba8('0x7')](_0x2ba8('0x11'),_0x550828);logger[_0x2ba8('0xa')](_0x2ba8('0x11'),_0x550828,JSON[_0x2ba8('0xc')](_0x2890a1));_0x2d6d43(_0x2890a1);})[_0x2ba8('0x10')](function(_0x287195){logger[_0x2ba8('0xd')](_0x2ba8('0x11'),_0x287195[_0x2ba8('0xf')],_0x550828);_0x12abc6(_0x4060da[_0x2ba8('0xd')](0x1f4,_0x287195[_0x2ba8('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 09fd43c..10ebc9a 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 _0x0790=['index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','get','/:id/actions','getActions','post','create','addAllCondition','addAction','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0790,0x134));var _0x0079=function(_0x5f0501,_0x19196e){_0x5f0501=_0x5f0501-0x0;var _0x3c2c45=_0x0790[_0x5f0501];return _0x3c2c45;};'use strict';var multer=require(_0x0079('0x0'));var util=require(_0x0079('0x1'));var path=require('path');var timeout=require(_0x0079('0x2'));var express=require(_0x0079('0x3'));var router=express[_0x0079('0x4')]();var fs_extra=require(_0x0079('0x5'));var auth=require(_0x0079('0x6'));var interaction=require(_0x0079('0x7'));var config=require(_0x0079('0x8'));var controller=require(_0x0079('0x9'));router['get']('/',auth[_0x0079('0xa')](),controller[_0x0079('0xb')]);router['get'](_0x0079('0xc'),auth[_0x0079('0xa')](),controller[_0x0079('0xd')]);router['get'](_0x0079('0xe'),auth[_0x0079('0xa')](),controller[_0x0079('0xf')]);router['get'](_0x0079('0x10'),auth[_0x0079('0xa')](),controller[_0x0079('0x11')]);router[_0x0079('0x12')](_0x0079('0x13'),auth['isAuthenticated'](),controller[_0x0079('0x14')]);router[_0x0079('0x15')]('/',auth[_0x0079('0xa')](),controller[_0x0079('0x16')]);router[_0x0079('0x15')](_0x0079('0xe'),auth[_0x0079('0xa')](),controller[_0x0079('0x17')]);router[_0x0079('0x15')]('/:id/any_conditions',auth[_0x0079('0xa')](),controller['addAnyCondition']);router[_0x0079('0x15')](_0x0079('0x13'),auth[_0x0079('0xa')](),controller[_0x0079('0x18')]);router['put']('/:id',auth[_0x0079('0xa')](),controller[_0x0079('0x19')]);router[_0x0079('0x1a')](_0x0079('0xc'),auth['isAuthenticated'](),controller[_0x0079('0x1b')]);module[_0x0079('0x1c')]=router; \ No newline at end of file +var _0x7f7f=['create','addAction','put','update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions','post'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7f7f,0x6a));var _0xf7f7=function(_0x9fcd34,_0x48acf6){_0x9fcd34=_0x9fcd34-0x0;var _0x4ca147=_0x7f7f[_0x9fcd34];return _0x4ca147;};'use strict';var multer=require(_0xf7f7('0x0'));var util=require(_0xf7f7('0x1'));var path=require(_0xf7f7('0x2'));var timeout=require(_0xf7f7('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf7f7('0x4'));var auth=require(_0xf7f7('0x5'));var interaction=require(_0xf7f7('0x6'));var config=require(_0xf7f7('0x7'));var controller=require(_0xf7f7('0x8'));router[_0xf7f7('0x9')]('/',auth[_0xf7f7('0xa')](),controller['index']);router[_0xf7f7('0x9')](_0xf7f7('0xb'),auth[_0xf7f7('0xa')](),controller[_0xf7f7('0xc')]);router[_0xf7f7('0x9')](_0xf7f7('0xd'),auth[_0xf7f7('0xa')](),controller[_0xf7f7('0xe')]);router[_0xf7f7('0x9')](_0xf7f7('0xf'),auth[_0xf7f7('0xa')](),controller['getAnyConditions']);router[_0xf7f7('0x9')](_0xf7f7('0x10'),auth['isAuthenticated'](),controller[_0xf7f7('0x11')]);router[_0xf7f7('0x12')]('/',auth[_0xf7f7('0xa')](),controller[_0xf7f7('0x13')]);router[_0xf7f7('0x12')](_0xf7f7('0xd'),auth[_0xf7f7('0xa')](),controller['addAllCondition']);router[_0xf7f7('0x12')](_0xf7f7('0xf'),auth[_0xf7f7('0xa')](),controller['addAnyCondition']);router[_0xf7f7('0x12')](_0xf7f7('0x10'),auth[_0xf7f7('0xa')](),controller[_0xf7f7('0x14')]);router[_0xf7f7('0x15')](_0xf7f7('0xb'),auth[_0xf7f7('0xa')](),controller[_0xf7f7('0x16')]);router[_0xf7f7('0x17')](_0xf7f7('0xb'),auth['isAuthenticated'](),controller[_0xf7f7('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 839ab9d..28934bd 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 _0xc56d=['STRING','exports'];(function(_0x2d5c90,_0x283db9){var _0x22a1ae=function(_0x3419c4){while(--_0x3419c4){_0x2d5c90['push'](_0x2d5c90['shift']());}};_0x22a1ae(++_0x283db9);}(_0xc56d,0x19b));var _0xdc56=function(_0x30783a,_0x45e217){_0x30783a=_0x30783a-0x0;var _0x485636=_0xc56d[_0x30783a];return _0x485636;};'use strict';var Sequelize=require('sequelize');module[_0xdc56('0x0')]={'name':{'type':Sequelize[_0xdc56('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdc56('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1c08=['exports','STRING','BOOLEAN','sequelize'];(function(_0xcb385f,_0x35c1b2){var _0x1768dd=function(_0x438c96){while(--_0x438c96){_0xcb385f['push'](_0xcb385f['shift']());}};_0x1768dd(++_0x35c1b2);}(_0x1c08,0x18b));var _0x81c0=function(_0x75ad68,_0xc75b2a){_0x75ad68=_0x75ad68-0x0;var _0x469c7d=_0x1c08[_0x75ad68];return _0x469c7d;};'use strict';var Sequelize=require(_0x81c0('0x0'));module[_0x81c0('0x1')]={'name':{'type':Sequelize[_0x81c0('0x2')]},'channel':{'type':Sequelize[_0x81c0('0x2')]},'description':{'type':Sequelize[_0x81c0('0x2')]},'status':{'type':Sequelize[_0x81c0('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 78a563c..9e1aa50 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 _0xdbec=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x33a82c,_0x5c8a15){var _0x17c221=function(_0x3aeee2){while(--_0x3aeee2){_0x33a82c['push'](_0x33a82c['shift']());}};_0x17c221(++_0x5c8a15);}(_0xdbec,0x17a));var _0xcdbe=function(_0x48ca9b,_0x4d7b19){_0x48ca9b=_0x48ca9b-0x0;var _0x59205d=_0xdbec[_0x48ca9b];return _0x59205d;};'use strict';var pdf=require(_0xcdbe('0x0'));var emlformat=require(_0xcdbe('0x1'));var rimraf=require(_0xcdbe('0x2'));var zipdir=require(_0xcdbe('0x3'));var jsonpatch=require(_0xcdbe('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcdbe('0x5'));var Mustache=require(_0xcdbe('0x6'));var util=require(_0xcdbe('0x7'));var path=require(_0xcdbe('0x8'));var sox=require(_0xcdbe('0x9'));var csv=require(_0xcdbe('0xa'));var ejs=require(_0xcdbe('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcdbe('0xc'));var crypto=require(_0xcdbe('0xd'));var jsforce=require(_0xcdbe('0xe'));var deskjs=require(_0xcdbe('0xf'));var toCsv=require(_0xcdbe('0xa'));var querystring=require(_0xcdbe('0x10'));var Papa=require(_0xcdbe('0x11'));var Redis=require(_0xcdbe('0x12'));var authService=require(_0xcdbe('0x13'));var qs=require(_0xcdbe('0x14'));var as=require(_0xcdbe('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcdbe('0x16'))(_0xcdbe('0x17'));var utils=require('../../config/utils');var config=require(_0xcdbe('0x18'));var licenseUtil=require(_0xcdbe('0x19'));var db=require(_0xcdbe('0x1a'))['db'];function respondWithStatusCode(_0x2f56b1,_0x1375aa){_0x1375aa=_0x1375aa||0xcc;return function(_0xe51293){if(_0xe51293){return _0x2f56b1[_0xcdbe('0x1b')](_0x1375aa);}return _0x2f56b1['status'](_0x1375aa)[_0xcdbe('0x1c')]();};}function respondWithResult(_0xb59ad9,_0x37354f){_0x37354f=_0x37354f||0xc8;return function(_0x3910b4){if(_0x3910b4){return _0xb59ad9[_0xcdbe('0x1d')](_0x37354f)[_0xcdbe('0x1e')](_0x3910b4);}};}function respondWithFilteredResult(_0xe6b2e6,_0x4669d7){return function(_0x1f537d){if(_0x1f537d){var _0x4832e4=_0x1f537d[_0xcdbe('0x1f')],_0x393b0e=_0x4669d7[_0xcdbe('0x20')],_0x48075a=_0x4669d7[_0xcdbe('0x20')]+_0x4669d7['limit'],_0xf3e9cf;if(_0x48075a>=_0x4832e4){_0x48075a=_0x4832e4;_0xf3e9cf=0xc8;}else{_0xf3e9cf=0xce;}_0xe6b2e6[_0xcdbe('0x1d')](_0xf3e9cf);return _0xe6b2e6[_0xcdbe('0x21')](_0xcdbe('0x22'),_0x393b0e+'-'+_0x48075a+'/'+_0x4832e4)['json'](_0x1f537d);}return null;};}function patchUpdates(_0x23f63f){return function(_0x1a25ed){try{jsonpatch[_0xcdbe('0x23')](_0x1a25ed,_0x23f63f,!![]);}catch(_0x1333dd){return BPromise[_0xcdbe('0x24')](_0x1333dd);}return _0x1a25ed[_0xcdbe('0x25')]();};}function saveUpdates(_0x28ebb3,_0x34c8bf){return function(_0x358d77){if(_0x358d77){return _0x358d77['update'](_0x28ebb3)[_0xcdbe('0x26')](function(_0x4bec8a){return _0x4bec8a;});}return null;};}function removeEntity(_0x5edeed,_0x197cc3){return function(_0x499ea7){if(_0x499ea7){return _0x499ea7[_0xcdbe('0x27')]()[_0xcdbe('0x26')](function(){var _0x491ee1=_0x499ea7[_0xcdbe('0x28')]({'plain':!![]});var _0x4ec46a='Triggers';return db[_0xcdbe('0x29')]['destroy']({'where':{'type':_0x4ec46a,'resourceId':_0x491ee1['id']}})['then'](function(){return _0x499ea7;});})['then'](function(){_0x5edeed['status'](0xcc)[_0xcdbe('0x1c')]();});}};}function handleEntityNotFound(_0x153826,_0x1092ee){return function(_0x47c3bc){if(!_0x47c3bc){_0x153826[_0xcdbe('0x1b')](0x194);}return _0x47c3bc;};}function handleError(_0x428ee0,_0x886355){_0x886355=_0x886355||0x1f4;return function(_0x4681c4){logger[_0xcdbe('0x2a')](_0x4681c4[_0xcdbe('0x2b')]);if(_0x4681c4[_0xcdbe('0x2c')]){delete _0x4681c4[_0xcdbe('0x2c')];}_0x428ee0[_0xcdbe('0x1d')](_0x886355)[_0xcdbe('0x2d')](_0x4681c4);};}exports[_0xcdbe('0x2e')]=function(_0x27fb74,_0x1b7682){var _0x39f561={},_0x4fa53a={},_0x4fc856={'count':0x0,'rows':[]};var _0xf8e286=_[_0xcdbe('0x2f')](db[_0xcdbe('0x30')][_0xcdbe('0x31')],function(_0x5dcc11){return{'name':_0x5dcc11[_0xcdbe('0x32')],'type':_0x5dcc11[_0xcdbe('0x33')]['key']};});_0x4fa53a[_0xcdbe('0x34')]=_[_0xcdbe('0x2f')](_0xf8e286,_0xcdbe('0x2c'));_0x4fa53a[_0xcdbe('0x35')]=_[_0xcdbe('0x36')](_0x27fb74[_0xcdbe('0x35')]);_0x4fa53a[_0xcdbe('0x37')]=_[_0xcdbe('0x38')](_0x4fa53a['model'],_0x4fa53a[_0xcdbe('0x35')]);_0x39f561[_0xcdbe('0x39')]=_[_0xcdbe('0x38')](_0x4fa53a[_0xcdbe('0x34')],qs[_0xcdbe('0x3a')](_0x27fb74['query'][_0xcdbe('0x3a')]));_0x39f561[_0xcdbe('0x39')]=_0x39f561[_0xcdbe('0x39')][_0xcdbe('0x3b')]?_0x39f561['attributes']:_0x4fa53a['model'];if(!_0x27fb74[_0xcdbe('0x35')][_0xcdbe('0x3c')](_0xcdbe('0x3d'))){_0x39f561['limit']=qs['limit'](_0x27fb74['query'][_0xcdbe('0x3e')]);_0x39f561[_0xcdbe('0x20')]=qs[_0xcdbe('0x20')](_0x27fb74[_0xcdbe('0x35')][_0xcdbe('0x20')]);}_0x39f561[_0xcdbe('0x3f')]=qs[_0xcdbe('0x40')](_0x27fb74['query'][_0xcdbe('0x40')]);_0x39f561[_0xcdbe('0x41')]=qs[_0xcdbe('0x37')](_[_0xcdbe('0x42')](_0x27fb74['query'],_0x4fa53a[_0xcdbe('0x37')]),_0xf8e286);if(_0x27fb74[_0xcdbe('0x35')]['filter']){_0x39f561[_0xcdbe('0x41')]=_[_0xcdbe('0x43')](_0x39f561['where'],{'$or':_[_0xcdbe('0x2f')](_0xf8e286,function(_0xdcdaac){if(_0xdcdaac[_0xcdbe('0x33')]!==_0xcdbe('0x44')){var _0x4f531f={};_0x4f531f[_0xdcdaac[_0xcdbe('0x2c')]]={'$like':'%'+_0x27fb74[_0xcdbe('0x35')][_0xcdbe('0x45')]+'%'};return _0x4f531f;}})});}_0x39f561=_[_0xcdbe('0x43')]({},_0x39f561,_0x27fb74[_0xcdbe('0x46')]);var _0x23d4da={'where':_0x39f561[_0xcdbe('0x41')]};return db[_0xcdbe('0x30')][_0xcdbe('0x1f')](_0x23d4da)[_0xcdbe('0x26')](function(_0x454362){_0x4fc856[_0xcdbe('0x1f')]=_0x454362;if(_0x27fb74[_0xcdbe('0x35')]['includeAll']){_0x39f561['include']=[{'all':!![]}];}return db[_0xcdbe('0x30')][_0xcdbe('0x47')](_0x39f561);})['then'](function(_0x522d7f){_0x4fc856[_0xcdbe('0x48')]=_0x522d7f;return _0x4fc856;})['then'](respondWithFilteredResult(_0x1b7682,_0x39f561))[_0xcdbe('0x49')](handleError(_0x1b7682,null));};exports[_0xcdbe('0x4a')]=function(_0xcfcb38,_0x1b07b4){var _0x3e2e27={'raw':![],'where':{'id':_0xcfcb38[_0xcdbe('0x4b')]['id']}},_0x1122ee={};_0x1122ee[_0xcdbe('0x34')]=_[_0xcdbe('0x36')](db['Trigger'][_0xcdbe('0x31')]);_0x1122ee[_0xcdbe('0x35')]=_[_0xcdbe('0x36')](_0xcfcb38['query']);_0x1122ee['filters']=_['intersection'](_0x1122ee[_0xcdbe('0x34')],_0x1122ee[_0xcdbe('0x35')]);_0x3e2e27[_0xcdbe('0x39')]=_[_0xcdbe('0x38')](_0x1122ee[_0xcdbe('0x34')],qs[_0xcdbe('0x3a')](_0xcfcb38[_0xcdbe('0x35')][_0xcdbe('0x3a')]));_0x3e2e27[_0xcdbe('0x39')]=_0x3e2e27[_0xcdbe('0x39')][_0xcdbe('0x3b')]?_0x3e2e27[_0xcdbe('0x39')]:_0x1122ee[_0xcdbe('0x34')];if(_0xcfcb38['query'][_0xcdbe('0x4c')]){_0x3e2e27['include']=[{'all':!![]}];}_0x3e2e27=_[_0xcdbe('0x43')]({},_0x3e2e27,_0xcfcb38[_0xcdbe('0x46')]);return db[_0xcdbe('0x30')][_0xcdbe('0x4d')](_0x3e2e27)[_0xcdbe('0x26')](handleEntityNotFound(_0x1b07b4,null))[_0xcdbe('0x26')](respondWithResult(_0x1b07b4,null))[_0xcdbe('0x49')](handleError(_0x1b07b4,null));};exports[_0xcdbe('0x4e')]=function(_0x41440b,_0x5de3c1){return db[_0xcdbe('0x30')][_0xcdbe('0x4e')](_0x41440b[_0xcdbe('0x4f')],{})['then'](function(_0x50ddb2){var _0x87da18=_0x41440b[_0xcdbe('0x50')][_0xcdbe('0x28')]({'plain':!![]});if(!_0x87da18)throw new Error(_0xcdbe('0x51'));if(_0x87da18[_0xcdbe('0x52')]===_0xcdbe('0x50')){var _0x3695e5=_0x50ddb2[_0xcdbe('0x28')]({'plain':!![]});var _0x35b1b9=_0xcdbe('0x53');return db['UserProfileSection'][_0xcdbe('0x4d')]({'where':{'name':_0x35b1b9,'userProfileId':_0x87da18[_0xcdbe('0x54')]},'raw':!![]})[_0xcdbe('0x26')](function(_0x2a91ea){if(_0x2a91ea&&_0x2a91ea[_0xcdbe('0x55')]===0x0){return db[_0xcdbe('0x29')][_0xcdbe('0x4e')]({'name':_0x3695e5['name'],'resourceId':_0x3695e5['id'],'type':_0x2a91ea['name'],'sectionId':_0x2a91ea['id']},{})[_0xcdbe('0x26')](function(){return _0x50ddb2;});}else{return _0x50ddb2;}})[_0xcdbe('0x49')](function(_0x4ed89d){logger[_0xcdbe('0x2a')](_0xcdbe('0x56'),_0x4ed89d);throw _0x4ed89d;});}return _0x50ddb2;})[_0xcdbe('0x26')](respondWithResult(_0x5de3c1,0xc9))[_0xcdbe('0x49')](handleError(_0x5de3c1,null));};exports[_0xcdbe('0x57')]=function(_0x4a2096,_0x5b7210){if(_0x4a2096['body']['id']){delete _0x4a2096[_0xcdbe('0x4f')]['id'];}return db[_0xcdbe('0x30')]['find']({'where':{'id':_0x4a2096[_0xcdbe('0x4b')]['id']}})[_0xcdbe('0x26')](handleEntityNotFound(_0x5b7210,null))[_0xcdbe('0x26')](saveUpdates(_0x4a2096['body'],null))[_0xcdbe('0x26')](respondWithResult(_0x5b7210,null))['catch'](handleError(_0x5b7210,null));};exports['destroy']=function(_0xd9cec4,_0x24705e){return db[_0xcdbe('0x30')][_0xcdbe('0x4d')]({'where':{'id':_0xd9cec4[_0xcdbe('0x4b')]['id']}})['then'](handleEntityNotFound(_0x24705e,null))['then'](removeEntity(_0x24705e,null))[_0xcdbe('0x49')](handleError(_0x24705e,null));};exports[_0xcdbe('0x58')]=function(_0x479ce1,_0x36e841,_0x441697){if(_0x479ce1[_0xcdbe('0x4f')]['id']){delete _0x479ce1[_0xcdbe('0x4f')]['id'];}return db[_0xcdbe('0x30')]['find']({'where':{'id':_0x479ce1[_0xcdbe('0x4b')]['id']}})['then'](handleEntityNotFound(_0x36e841,null))[_0xcdbe('0x26')](function(_0x520a43){if(_0x520a43){_0x479ce1['body'][_0xcdbe('0x59')]=_0x520a43['id'];return db[_0xcdbe('0x5a')][_0xcdbe('0x4e')](_0x479ce1[_0xcdbe('0x4f')]);}})['then'](respondWithResult(_0x36e841,null))['catch'](handleError(_0x36e841,null));};exports[_0xcdbe('0x5b')]=function(_0x5320ba,_0x8173e,_0x57276a){if(_0x5320ba[_0xcdbe('0x4f')]['id']){delete _0x5320ba[_0xcdbe('0x4f')]['id'];}return db[_0xcdbe('0x30')][_0xcdbe('0x4d')]({'where':{'id':_0x5320ba[_0xcdbe('0x4b')]['id']}})[_0xcdbe('0x26')](handleEntityNotFound(_0x8173e,null))[_0xcdbe('0x26')](function(_0x41106e){if(_0x41106e){_0x5320ba[_0xcdbe('0x4f')]['TriggerAnyId']=_0x41106e['id'];return db[_0xcdbe('0x5a')][_0xcdbe('0x4e')](_0x5320ba[_0xcdbe('0x4f')]);}})[_0xcdbe('0x26')](respondWithResult(_0x8173e,null))[_0xcdbe('0x49')](handleError(_0x8173e,null));};exports[_0xcdbe('0x5c')]=function(_0x18e04f,_0x4a2a07,_0x3780f0){var _0x302f79={};var _0x5c3005={};var _0x48f83a;var _0x10aeb0;return db[_0xcdbe('0x30')][_0xcdbe('0x5d')]({'where':{'id':_0x18e04f['params']['id']}})['then'](handleEntityNotFound(_0x4a2a07,null))[_0xcdbe('0x26')](function(_0x35b902){if(_0x35b902){_0x48f83a=_0x35b902;_0x5c3005['model']=_[_0xcdbe('0x36')](db['Condition'][_0xcdbe('0x31')]);_0x5c3005['query']=_[_0xcdbe('0x36')](_0x18e04f['query']);_0x5c3005['filters']=_[_0xcdbe('0x38')](_0x5c3005[_0xcdbe('0x34')],_0x5c3005[_0xcdbe('0x35')]);_0x302f79['attributes']=_['intersection'](_0x5c3005[_0xcdbe('0x34')],qs['fields'](_0x18e04f[_0xcdbe('0x35')][_0xcdbe('0x3a')]));_0x302f79[_0xcdbe('0x39')]=_0x302f79[_0xcdbe('0x39')][_0xcdbe('0x3b')]?_0x302f79['attributes']:_0x5c3005[_0xcdbe('0x34')];_0x302f79['order']=qs['sort'](_0x18e04f[_0xcdbe('0x35')][_0xcdbe('0x40')]);_0x302f79['where']=qs[_0xcdbe('0x37')](_['pick'](_0x18e04f[_0xcdbe('0x35')],_0x5c3005['filters']));if(_0x18e04f[_0xcdbe('0x35')]['filter']){_0x302f79[_0xcdbe('0x41')]=_[_0xcdbe('0x43')](_0x302f79[_0xcdbe('0x41')],{'$or':_[_0xcdbe('0x2f')](_0x302f79['attributes'],function(_0x76b607){var _0x119fd9={};_0x119fd9[_0x76b607]={'$like':'%'+_0x18e04f['query'][_0xcdbe('0x45')]+'%'};return _0x119fd9;})});}_0x302f79=_[_0xcdbe('0x43')]({},_0x302f79,_0x18e04f[_0xcdbe('0x46')]);return _0x48f83a[_0xcdbe('0x5c')](_0x302f79);}})['then'](function(_0x23e532){if(_0x23e532){_0x10aeb0=_0x23e532[_0xcdbe('0x3b')];if(!_0x18e04f[_0xcdbe('0x35')][_0xcdbe('0x3c')](_0xcdbe('0x3d'))){_0x302f79[_0xcdbe('0x3e')]=qs['limit'](_0x18e04f[_0xcdbe('0x35')][_0xcdbe('0x3e')]);_0x302f79[_0xcdbe('0x20')]=qs[_0xcdbe('0x20')](_0x18e04f[_0xcdbe('0x35')][_0xcdbe('0x20')]);}return _0x48f83a[_0xcdbe('0x5c')](_0x302f79);}})[_0xcdbe('0x26')](function(_0x457d9b){if(_0x457d9b){return _0x457d9b?{'count':_0x10aeb0,'rows':_0x457d9b}:null;}})['then'](respondWithResult(_0x4a2a07,null))['catch'](handleError(_0x4a2a07,null));};exports[_0xcdbe('0x5e')]=function(_0x234e14,_0xe631d3,_0x3c18b8){var _0x446a62={};var _0x4d70f4={};var _0x558f6b;var _0x41a80e;return db['Trigger']['findOne']({'where':{'id':_0x234e14['params']['id']}})[_0xcdbe('0x26')](handleEntityNotFound(_0xe631d3,null))[_0xcdbe('0x26')](function(_0x49d0f5){if(_0x49d0f5){_0x558f6b=_0x49d0f5;_0x4d70f4[_0xcdbe('0x34')]=_[_0xcdbe('0x36')](db[_0xcdbe('0x5a')][_0xcdbe('0x31')]);_0x4d70f4['query']=_[_0xcdbe('0x36')](_0x234e14[_0xcdbe('0x35')]);_0x4d70f4[_0xcdbe('0x37')]=_['intersection'](_0x4d70f4[_0xcdbe('0x34')],_0x4d70f4[_0xcdbe('0x35')]);_0x446a62[_0xcdbe('0x39')]=_[_0xcdbe('0x38')](_0x4d70f4[_0xcdbe('0x34')],qs[_0xcdbe('0x3a')](_0x234e14[_0xcdbe('0x35')][_0xcdbe('0x3a')]));_0x446a62[_0xcdbe('0x39')]=_0x446a62[_0xcdbe('0x39')][_0xcdbe('0x3b')]?_0x446a62['attributes']:_0x4d70f4[_0xcdbe('0x34')];_0x446a62[_0xcdbe('0x3f')]=qs[_0xcdbe('0x40')](_0x234e14[_0xcdbe('0x35')][_0xcdbe('0x40')]);_0x446a62[_0xcdbe('0x41')]=qs[_0xcdbe('0x37')](_['pick'](_0x234e14[_0xcdbe('0x35')],_0x4d70f4['filters']));if(_0x234e14['query'][_0xcdbe('0x45')]){_0x446a62[_0xcdbe('0x41')]=_[_0xcdbe('0x43')](_0x446a62[_0xcdbe('0x41')],{'$or':_['map'](_0x446a62[_0xcdbe('0x39')],function(_0x3e5b64){var _0x55a68b={};_0x55a68b[_0x3e5b64]={'$like':'%'+_0x234e14[_0xcdbe('0x35')]['filter']+'%'};return _0x55a68b;})});}_0x446a62=_[_0xcdbe('0x43')]({},_0x446a62,_0x234e14[_0xcdbe('0x46')]);return _0x558f6b[_0xcdbe('0x5e')](_0x446a62);}})[_0xcdbe('0x26')](function(_0x3942d3){if(_0x3942d3){_0x41a80e=_0x3942d3['length'];if(!_0x234e14[_0xcdbe('0x35')]['hasOwnProperty'](_0xcdbe('0x3d'))){_0x446a62[_0xcdbe('0x3e')]=qs[_0xcdbe('0x3e')](_0x234e14[_0xcdbe('0x35')][_0xcdbe('0x3e')]);_0x446a62[_0xcdbe('0x20')]=qs[_0xcdbe('0x20')](_0x234e14[_0xcdbe('0x35')][_0xcdbe('0x20')]);}return _0x558f6b['getAnyConditions'](_0x446a62);}})['then'](function(_0xeb572a){if(_0xeb572a){return _0xeb572a?{'count':_0x41a80e,'rows':_0xeb572a}:null;}})[_0xcdbe('0x26')](respondWithResult(_0xe631d3,null))[_0xcdbe('0x49')](handleError(_0xe631d3,null));};exports[_0xcdbe('0x5f')]=function(_0x355f43,_0x2c8279,_0x2f28d8){if(_0x355f43[_0xcdbe('0x4f')]['id']){delete _0x355f43[_0xcdbe('0x4f')]['id'];}return db[_0xcdbe('0x30')][_0xcdbe('0x4d')]({'where':{'id':_0x355f43[_0xcdbe('0x4b')]['id']}})[_0xcdbe('0x26')](handleEntityNotFound(_0x2c8279,null))[_0xcdbe('0x26')](function(_0x1f60ca){if(_0x1f60ca){_0x355f43['body'][_0xcdbe('0x60')]=_0x1f60ca['id'];return db[_0xcdbe('0x61')][_0xcdbe('0x4e')](_0x355f43[_0xcdbe('0x4f')]);}})[_0xcdbe('0x26')](respondWithResult(_0x2c8279,null))['catch'](handleError(_0x2c8279,null));};exports['getActions']=function(_0x484fd7,_0x3e828a,_0x3fdf2b){var _0x55d1c3={};var _0xa64376={};var _0x48e3e8;var _0x1959d8;return db[_0xcdbe('0x30')]['findOne']({'where':{'id':_0x484fd7[_0xcdbe('0x4b')]['id']}})[_0xcdbe('0x26')](handleEntityNotFound(_0x3e828a,null))[_0xcdbe('0x26')](function(_0x5c3330){if(_0x5c3330){_0x48e3e8=_0x5c3330;_0xa64376[_0xcdbe('0x34')]=_[_0xcdbe('0x36')](db[_0xcdbe('0x61')]['rawAttributes']);_0xa64376[_0xcdbe('0x35')]=_['keys'](_0x484fd7[_0xcdbe('0x35')]);_0xa64376['filters']=_[_0xcdbe('0x38')](_0xa64376['model'],_0xa64376[_0xcdbe('0x35')]);_0x55d1c3[_0xcdbe('0x39')]=_[_0xcdbe('0x38')](_0xa64376[_0xcdbe('0x34')],qs[_0xcdbe('0x3a')](_0x484fd7[_0xcdbe('0x35')]['fields']));_0x55d1c3['attributes']=_0x55d1c3[_0xcdbe('0x39')][_0xcdbe('0x3b')]?_0x55d1c3['attributes']:_0xa64376[_0xcdbe('0x34')];_0x55d1c3[_0xcdbe('0x3f')]=qs[_0xcdbe('0x40')](_0x484fd7[_0xcdbe('0x35')][_0xcdbe('0x40')]);_0x55d1c3['where']=qs[_0xcdbe('0x37')](_['pick'](_0x484fd7[_0xcdbe('0x35')],_0xa64376[_0xcdbe('0x37')]));if(_0x484fd7['query'][_0xcdbe('0x45')]){_0x55d1c3[_0xcdbe('0x41')]=_[_0xcdbe('0x43')](_0x55d1c3[_0xcdbe('0x41')],{'$or':_[_0xcdbe('0x2f')](_0x55d1c3['attributes'],function(_0x24c77f){var _0x19ff78={};_0x19ff78[_0x24c77f]={'$like':'%'+_0x484fd7[_0xcdbe('0x35')]['filter']+'%'};return _0x19ff78;})});}_0x55d1c3=_[_0xcdbe('0x43')]({},_0x55d1c3,_0x484fd7[_0xcdbe('0x46')]);return _0x48e3e8[_0xcdbe('0x62')](_0x55d1c3);}})['then'](function(_0x3b0dce){if(_0x3b0dce){_0x1959d8=_0x3b0dce[_0xcdbe('0x3b')];if(!_0x484fd7[_0xcdbe('0x35')][_0xcdbe('0x3c')](_0xcdbe('0x3d'))){_0x55d1c3[_0xcdbe('0x3e')]=qs[_0xcdbe('0x3e')](_0x484fd7[_0xcdbe('0x35')]['limit']);_0x55d1c3[_0xcdbe('0x20')]=qs[_0xcdbe('0x20')](_0x484fd7[_0xcdbe('0x35')][_0xcdbe('0x20')]);}return _0x48e3e8['getActions'](_0x55d1c3);}})[_0xcdbe('0x26')](function(_0x228fc2){if(_0x228fc2){return _0x228fc2?{'count':_0x1959d8,'rows':_0x228fc2}:null;}})[_0xcdbe('0x26')](respondWithResult(_0x3e828a,null))[_0xcdbe('0x49')](handleError(_0x3e828a,null));}; \ No newline at end of file +var _0x2c3b=['role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','getAnyConditions','findOne','addAction','TriggerId','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','Triggers','UserProfileResource','error','name','send','map','Trigger','fieldName','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x28941b,_0x106034){var _0x59870e=function(_0x1b1c70){while(--_0x1b1c70){_0x28941b['push'](_0x28941b['shift']());}};_0x59870e(++_0x106034);}(_0x2c3b,0x18b));var _0xb2c3=function(_0x2ce5e3,_0x429426){_0x2ce5e3=_0x2ce5e3-0x0;var _0xe1e73c=_0x2c3b[_0x2ce5e3];return _0xe1e73c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb2c3('0x0'));var rimraf=require(_0xb2c3('0x1'));var zipdir=require(_0xb2c3('0x2'));var jsonpatch=require(_0xb2c3('0x3'));var rp=require(_0xb2c3('0x4'));var moment=require(_0xb2c3('0x5'));var BPromise=require(_0xb2c3('0x6'));var Mustache=require(_0xb2c3('0x7'));var util=require('util');var path=require(_0xb2c3('0x8'));var sox=require('sox');var csv=require(_0xb2c3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb2c3('0xa'));var _=require(_0xb2c3('0xb'));var squel=require(_0xb2c3('0xc'));var crypto=require(_0xb2c3('0xd'));var jsforce=require(_0xb2c3('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb2c3('0x9'));var querystring=require(_0xb2c3('0xf'));var Papa=require(_0xb2c3('0x10'));var Redis=require(_0xb2c3('0x11'));var authService=require(_0xb2c3('0x12'));var qs=require(_0xb2c3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb2c3('0x14'));var logger=require(_0xb2c3('0x15'))(_0xb2c3('0x16'));var utils=require(_0xb2c3('0x17'));var config=require(_0xb2c3('0x18'));var licenseUtil=require(_0xb2c3('0x19'));var db=require(_0xb2c3('0x1a'))['db'];function respondWithStatusCode(_0x20fcfb,_0x1d94ad){_0x1d94ad=_0x1d94ad||0xcc;return function(_0x16af91){if(_0x16af91){return _0x20fcfb[_0xb2c3('0x1b')](_0x1d94ad);}return _0x20fcfb[_0xb2c3('0x1c')](_0x1d94ad)[_0xb2c3('0x1d')]();};}function respondWithResult(_0x55ba83,_0x5d1f08){_0x5d1f08=_0x5d1f08||0xc8;return function(_0x251b6a){if(_0x251b6a){return _0x55ba83[_0xb2c3('0x1c')](_0x5d1f08)[_0xb2c3('0x1e')](_0x251b6a);}};}function respondWithFilteredResult(_0x4856e6,_0x36fc3c){return function(_0x5bf16f){if(_0x5bf16f){var _0xfc3c27=_0x5bf16f[_0xb2c3('0x1f')],_0x3238d6=_0x36fc3c[_0xb2c3('0x20')],_0x44212e=_0x36fc3c[_0xb2c3('0x20')]+_0x36fc3c[_0xb2c3('0x21')],_0x4dfee8;if(_0x44212e>=_0xfc3c27){_0x44212e=_0xfc3c27;_0x4dfee8=0xc8;}else{_0x4dfee8=0xce;}_0x4856e6[_0xb2c3('0x1c')](_0x4dfee8);return _0x4856e6['set'](_0xb2c3('0x22'),_0x3238d6+'-'+_0x44212e+'/'+_0xfc3c27)[_0xb2c3('0x1e')](_0x5bf16f);}return null;};}function patchUpdates(_0x3af0ed){return function(_0x2ec834){try{jsonpatch[_0xb2c3('0x23')](_0x2ec834,_0x3af0ed,!![]);}catch(_0xe9a3fb){return BPromise[_0xb2c3('0x24')](_0xe9a3fb);}return _0x2ec834[_0xb2c3('0x25')]();};}function saveUpdates(_0x140a01,_0x4eba5f){return function(_0x3f1290){if(_0x3f1290){return _0x3f1290[_0xb2c3('0x26')](_0x140a01)[_0xb2c3('0x27')](function(_0x1baef3){return _0x1baef3;});}return null;};}function removeEntity(_0x349b69,_0x592470){return function(_0x2a5ce8){if(_0x2a5ce8){return _0x2a5ce8[_0xb2c3('0x28')]()[_0xb2c3('0x27')](function(){var _0x500251=_0x2a5ce8[_0xb2c3('0x29')]({'plain':!![]});var _0x20b65d=_0xb2c3('0x2a');return db[_0xb2c3('0x2b')][_0xb2c3('0x28')]({'where':{'type':_0x20b65d,'resourceId':_0x500251['id']}})[_0xb2c3('0x27')](function(){return _0x2a5ce8;});})[_0xb2c3('0x27')](function(){_0x349b69[_0xb2c3('0x1c')](0xcc)[_0xb2c3('0x1d')]();});}};}function handleEntityNotFound(_0x45c64c,_0x5d60b1){return function(_0x7833d9){if(!_0x7833d9){_0x45c64c['sendStatus'](0x194);}return _0x7833d9;};}function handleError(_0x21b80b,_0x287f75){_0x287f75=_0x287f75||0x1f4;return function(_0x403c6d){logger[_0xb2c3('0x2c')](_0x403c6d['stack']);if(_0x403c6d[_0xb2c3('0x2d')]){delete _0x403c6d[_0xb2c3('0x2d')];}_0x21b80b[_0xb2c3('0x1c')](_0x287f75)[_0xb2c3('0x2e')](_0x403c6d);};}exports['index']=function(_0x53a274,_0x2a653c){var _0x51dc6f={},_0x1db146={},_0x41255c={'count':0x0,'rows':[]};var _0x34b0d1=_[_0xb2c3('0x2f')](db[_0xb2c3('0x30')]['rawAttributes'],function(_0x4d2448){return{'name':_0x4d2448[_0xb2c3('0x31')],'type':_0x4d2448[_0xb2c3('0x32')]['key']};});_0x1db146['model']=_[_0xb2c3('0x2f')](_0x34b0d1,_0xb2c3('0x2d'));_0x1db146[_0xb2c3('0x33')]=_['keys'](_0x53a274[_0xb2c3('0x33')]);_0x1db146[_0xb2c3('0x34')]=_[_0xb2c3('0x35')](_0x1db146[_0xb2c3('0x36')],_0x1db146[_0xb2c3('0x33')]);_0x51dc6f['attributes']=_[_0xb2c3('0x35')](_0x1db146[_0xb2c3('0x36')],qs[_0xb2c3('0x37')](_0x53a274['query'][_0xb2c3('0x37')]));_0x51dc6f[_0xb2c3('0x38')]=_0x51dc6f[_0xb2c3('0x38')][_0xb2c3('0x39')]?_0x51dc6f[_0xb2c3('0x38')]:_0x1db146[_0xb2c3('0x36')];if(!_0x53a274['query'][_0xb2c3('0x3a')](_0xb2c3('0x3b'))){_0x51dc6f[_0xb2c3('0x21')]=qs['limit'](_0x53a274[_0xb2c3('0x33')][_0xb2c3('0x21')]);_0x51dc6f[_0xb2c3('0x20')]=qs[_0xb2c3('0x20')](_0x53a274[_0xb2c3('0x33')]['offset']);}_0x51dc6f[_0xb2c3('0x3c')]=qs[_0xb2c3('0x3d')](_0x53a274[_0xb2c3('0x33')][_0xb2c3('0x3d')]);_0x51dc6f['where']=qs['filters'](_[_0xb2c3('0x3e')](_0x53a274[_0xb2c3('0x33')],_0x1db146[_0xb2c3('0x34')]),_0x34b0d1);if(_0x53a274[_0xb2c3('0x33')][_0xb2c3('0x3f')]){_0x51dc6f[_0xb2c3('0x40')]=_[_0xb2c3('0x41')](_0x51dc6f[_0xb2c3('0x40')],{'$or':_[_0xb2c3('0x2f')](_0x34b0d1,function(_0x48f2b3){if(_0x48f2b3[_0xb2c3('0x32')]!==_0xb2c3('0x42')){var _0x283149={};_0x283149[_0x48f2b3['name']]={'$like':'%'+_0x53a274[_0xb2c3('0x33')][_0xb2c3('0x3f')]+'%'};return _0x283149;}})});}_0x51dc6f=_[_0xb2c3('0x41')]({},_0x51dc6f,_0x53a274[_0xb2c3('0x43')]);var _0x4c73a0={'where':_0x51dc6f[_0xb2c3('0x40')]};return db[_0xb2c3('0x30')][_0xb2c3('0x1f')](_0x4c73a0)[_0xb2c3('0x27')](function(_0x3b8494){_0x41255c[_0xb2c3('0x1f')]=_0x3b8494;if(_0x53a274[_0xb2c3('0x33')][_0xb2c3('0x44')]){_0x51dc6f['include']=[{'all':!![]}];}return db[_0xb2c3('0x30')][_0xb2c3('0x45')](_0x51dc6f);})[_0xb2c3('0x27')](function(_0x538235){_0x41255c[_0xb2c3('0x46')]=_0x538235;return _0x41255c;})['then'](respondWithFilteredResult(_0x2a653c,_0x51dc6f))[_0xb2c3('0x47')](handleError(_0x2a653c,null));};exports[_0xb2c3('0x48')]=function(_0x366f5e,_0x33db17){var _0x2542bb={'raw':![],'where':{'id':_0x366f5e[_0xb2c3('0x49')]['id']}},_0xe98c7={};_0xe98c7['model']=_[_0xb2c3('0x4a')](db[_0xb2c3('0x30')][_0xb2c3('0x4b')]);_0xe98c7[_0xb2c3('0x33')]=_['keys'](_0x366f5e[_0xb2c3('0x33')]);_0xe98c7[_0xb2c3('0x34')]=_['intersection'](_0xe98c7[_0xb2c3('0x36')],_0xe98c7['query']);_0x2542bb[_0xb2c3('0x38')]=_[_0xb2c3('0x35')](_0xe98c7[_0xb2c3('0x36')],qs[_0xb2c3('0x37')](_0x366f5e[_0xb2c3('0x33')][_0xb2c3('0x37')]));_0x2542bb[_0xb2c3('0x38')]=_0x2542bb[_0xb2c3('0x38')][_0xb2c3('0x39')]?_0x2542bb[_0xb2c3('0x38')]:_0xe98c7['model'];if(_0x366f5e[_0xb2c3('0x33')][_0xb2c3('0x44')]){_0x2542bb[_0xb2c3('0x4c')]=[{'all':!![]}];}_0x2542bb=_['merge']({},_0x2542bb,_0x366f5e[_0xb2c3('0x43')]);return db['Trigger']['find'](_0x2542bb)[_0xb2c3('0x27')](handleEntityNotFound(_0x33db17,null))[_0xb2c3('0x27')](respondWithResult(_0x33db17,null))[_0xb2c3('0x47')](handleError(_0x33db17,null));};exports[_0xb2c3('0x4d')]=function(_0x1a1df2,_0x1a7b15){return db[_0xb2c3('0x30')][_0xb2c3('0x4d')](_0x1a1df2[_0xb2c3('0x4e')],{})[_0xb2c3('0x27')](function(_0x3c1c2c){var _0x30f162=_0x1a1df2['user'][_0xb2c3('0x29')]({'plain':!![]});if(!_0x30f162)throw new Error(_0xb2c3('0x4f'));if(_0x30f162[_0xb2c3('0x50')]==='user'){var _0x3102a2=_0x3c1c2c[_0xb2c3('0x29')]({'plain':!![]});var _0x40c3f7=_0xb2c3('0x2a');return db['UserProfileSection'][_0xb2c3('0x51')]({'where':{'name':_0x40c3f7,'userProfileId':_0x30f162[_0xb2c3('0x52')]},'raw':!![]})[_0xb2c3('0x27')](function(_0x4fe406){if(_0x4fe406&&_0x4fe406['autoAssociation']===0x0){return db[_0xb2c3('0x2b')][_0xb2c3('0x4d')]({'name':_0x3102a2[_0xb2c3('0x2d')],'resourceId':_0x3102a2['id'],'type':_0x4fe406['name'],'sectionId':_0x4fe406['id']},{})['then'](function(){return _0x3c1c2c;});}else{return _0x3c1c2c;}})['catch'](function(_0x33cdbc){logger[_0xb2c3('0x2c')](_0xb2c3('0x53'),_0x33cdbc);throw _0x33cdbc;});}return _0x3c1c2c;})[_0xb2c3('0x27')](respondWithResult(_0x1a7b15,0xc9))[_0xb2c3('0x47')](handleError(_0x1a7b15,null));};exports[_0xb2c3('0x26')]=function(_0x3e8253,_0x4b9281){if(_0x3e8253[_0xb2c3('0x4e')]['id']){delete _0x3e8253[_0xb2c3('0x4e')]['id'];}return db[_0xb2c3('0x30')][_0xb2c3('0x51')]({'where':{'id':_0x3e8253[_0xb2c3('0x49')]['id']}})[_0xb2c3('0x27')](handleEntityNotFound(_0x4b9281,null))[_0xb2c3('0x27')](saveUpdates(_0x3e8253['body'],null))[_0xb2c3('0x27')](respondWithResult(_0x4b9281,null))['catch'](handleError(_0x4b9281,null));};exports[_0xb2c3('0x28')]=function(_0x45b8c2,_0x5e5e19){return db[_0xb2c3('0x30')]['find']({'where':{'id':_0x45b8c2[_0xb2c3('0x49')]['id']}})['then'](handleEntityNotFound(_0x5e5e19,null))['then'](removeEntity(_0x5e5e19,null))[_0xb2c3('0x47')](handleError(_0x5e5e19,null));};exports[_0xb2c3('0x54')]=function(_0x401ee4,_0x2aabbb,_0x318bd9){if(_0x401ee4[_0xb2c3('0x4e')]['id']){delete _0x401ee4['body']['id'];}return db[_0xb2c3('0x30')][_0xb2c3('0x51')]({'where':{'id':_0x401ee4[_0xb2c3('0x49')]['id']}})[_0xb2c3('0x27')](handleEntityNotFound(_0x2aabbb,null))['then'](function(_0x1eecff){if(_0x1eecff){_0x401ee4['body'][_0xb2c3('0x55')]=_0x1eecff['id'];return db[_0xb2c3('0x56')][_0xb2c3('0x4d')](_0x401ee4[_0xb2c3('0x4e')]);}})[_0xb2c3('0x27')](respondWithResult(_0x2aabbb,null))[_0xb2c3('0x47')](handleError(_0x2aabbb,null));};exports[_0xb2c3('0x57')]=function(_0x48e41c,_0x39439f,_0x546065){if(_0x48e41c[_0xb2c3('0x4e')]['id']){delete _0x48e41c[_0xb2c3('0x4e')]['id'];}return db['Trigger']['find']({'where':{'id':_0x48e41c['params']['id']}})['then'](handleEntityNotFound(_0x39439f,null))[_0xb2c3('0x27')](function(_0x237191){if(_0x237191){_0x48e41c['body']['TriggerAnyId']=_0x237191['id'];return db[_0xb2c3('0x56')]['create'](_0x48e41c[_0xb2c3('0x4e')]);}})[_0xb2c3('0x27')](respondWithResult(_0x39439f,null))[_0xb2c3('0x47')](handleError(_0x39439f,null));};exports[_0xb2c3('0x58')]=function(_0xbaf81a,_0xfe1ef4,_0x5bb69a){var _0xd25d5f={};var _0x177804={};var _0xa9eacc;var _0x333c40;return db['Trigger']['findOne']({'where':{'id':_0xbaf81a[_0xb2c3('0x49')]['id']}})[_0xb2c3('0x27')](handleEntityNotFound(_0xfe1ef4,null))[_0xb2c3('0x27')](function(_0x4ebc68){if(_0x4ebc68){_0xa9eacc=_0x4ebc68;_0x177804[_0xb2c3('0x36')]=_['keys'](db['Condition'][_0xb2c3('0x4b')]);_0x177804['query']=_['keys'](_0xbaf81a[_0xb2c3('0x33')]);_0x177804[_0xb2c3('0x34')]=_[_0xb2c3('0x35')](_0x177804['model'],_0x177804[_0xb2c3('0x33')]);_0xd25d5f['attributes']=_['intersection'](_0x177804[_0xb2c3('0x36')],qs[_0xb2c3('0x37')](_0xbaf81a[_0xb2c3('0x33')][_0xb2c3('0x37')]));_0xd25d5f[_0xb2c3('0x38')]=_0xd25d5f[_0xb2c3('0x38')]['length']?_0xd25d5f[_0xb2c3('0x38')]:_0x177804['model'];_0xd25d5f[_0xb2c3('0x3c')]=qs['sort'](_0xbaf81a[_0xb2c3('0x33')][_0xb2c3('0x3d')]);_0xd25d5f['where']=qs[_0xb2c3('0x34')](_[_0xb2c3('0x3e')](_0xbaf81a[_0xb2c3('0x33')],_0x177804['filters']));if(_0xbaf81a[_0xb2c3('0x33')]['filter']){_0xd25d5f[_0xb2c3('0x40')]=_[_0xb2c3('0x41')](_0xd25d5f['where'],{'$or':_[_0xb2c3('0x2f')](_0xd25d5f[_0xb2c3('0x38')],function(_0x113b48){var _0x5732cd={};_0x5732cd[_0x113b48]={'$like':'%'+_0xbaf81a[_0xb2c3('0x33')][_0xb2c3('0x3f')]+'%'};return _0x5732cd;})});}_0xd25d5f=_['merge']({},_0xd25d5f,_0xbaf81a['options']);return _0xa9eacc[_0xb2c3('0x58')](_0xd25d5f);}})[_0xb2c3('0x27')](function(_0x3a0fc0){if(_0x3a0fc0){_0x333c40=_0x3a0fc0['length'];if(!_0xbaf81a[_0xb2c3('0x33')]['hasOwnProperty'](_0xb2c3('0x3b'))){_0xd25d5f['limit']=qs[_0xb2c3('0x21')](_0xbaf81a[_0xb2c3('0x33')][_0xb2c3('0x21')]);_0xd25d5f[_0xb2c3('0x20')]=qs['offset'](_0xbaf81a['query']['offset']);}return _0xa9eacc[_0xb2c3('0x58')](_0xd25d5f);}})[_0xb2c3('0x27')](function(_0x1f9f9d){if(_0x1f9f9d){return _0x1f9f9d?{'count':_0x333c40,'rows':_0x1f9f9d}:null;}})['then'](respondWithResult(_0xfe1ef4,null))['catch'](handleError(_0xfe1ef4,null));};exports[_0xb2c3('0x59')]=function(_0x2ccbbc,_0x46df91,_0x3cbea8){var _0x521a92={};var _0x1465dc={};var _0x1d6be8;var _0x55b8e9;return db['Trigger'][_0xb2c3('0x5a')]({'where':{'id':_0x2ccbbc[_0xb2c3('0x49')]['id']}})['then'](handleEntityNotFound(_0x46df91,null))[_0xb2c3('0x27')](function(_0x4fdf1b){if(_0x4fdf1b){_0x1d6be8=_0x4fdf1b;_0x1465dc[_0xb2c3('0x36')]=_[_0xb2c3('0x4a')](db[_0xb2c3('0x56')]['rawAttributes']);_0x1465dc[_0xb2c3('0x33')]=_[_0xb2c3('0x4a')](_0x2ccbbc[_0xb2c3('0x33')]);_0x1465dc[_0xb2c3('0x34')]=_[_0xb2c3('0x35')](_0x1465dc[_0xb2c3('0x36')],_0x1465dc[_0xb2c3('0x33')]);_0x521a92[_0xb2c3('0x38')]=_[_0xb2c3('0x35')](_0x1465dc[_0xb2c3('0x36')],qs['fields'](_0x2ccbbc['query'][_0xb2c3('0x37')]));_0x521a92[_0xb2c3('0x38')]=_0x521a92[_0xb2c3('0x38')]['length']?_0x521a92[_0xb2c3('0x38')]:_0x1465dc[_0xb2c3('0x36')];_0x521a92['order']=qs['sort'](_0x2ccbbc['query'][_0xb2c3('0x3d')]);_0x521a92['where']=qs['filters'](_[_0xb2c3('0x3e')](_0x2ccbbc['query'],_0x1465dc['filters']));if(_0x2ccbbc['query'][_0xb2c3('0x3f')]){_0x521a92[_0xb2c3('0x40')]=_['merge'](_0x521a92[_0xb2c3('0x40')],{'$or':_['map'](_0x521a92[_0xb2c3('0x38')],function(_0x297719){var _0x2429ec={};_0x2429ec[_0x297719]={'$like':'%'+_0x2ccbbc[_0xb2c3('0x33')]['filter']+'%'};return _0x2429ec;})});}_0x521a92=_['merge']({},_0x521a92,_0x2ccbbc[_0xb2c3('0x43')]);return _0x1d6be8[_0xb2c3('0x59')](_0x521a92);}})[_0xb2c3('0x27')](function(_0x1f58af){if(_0x1f58af){_0x55b8e9=_0x1f58af[_0xb2c3('0x39')];if(!_0x2ccbbc['query']['hasOwnProperty']('nolimit')){_0x521a92[_0xb2c3('0x21')]=qs[_0xb2c3('0x21')](_0x2ccbbc[_0xb2c3('0x33')]['limit']);_0x521a92[_0xb2c3('0x20')]=qs[_0xb2c3('0x20')](_0x2ccbbc[_0xb2c3('0x33')][_0xb2c3('0x20')]);}return _0x1d6be8[_0xb2c3('0x59')](_0x521a92);}})['then'](function(_0xc2024d){if(_0xc2024d){return _0xc2024d?{'count':_0x55b8e9,'rows':_0xc2024d}:null;}})['then'](respondWithResult(_0x46df91,null))[_0xb2c3('0x47')](handleError(_0x46df91,null));};exports[_0xb2c3('0x5b')]=function(_0x2be3c2,_0xea2809,_0x1cb718){if(_0x2be3c2[_0xb2c3('0x4e')]['id']){delete _0x2be3c2[_0xb2c3('0x4e')]['id'];}return db[_0xb2c3('0x30')]['find']({'where':{'id':_0x2be3c2[_0xb2c3('0x49')]['id']}})[_0xb2c3('0x27')](handleEntityNotFound(_0xea2809,null))['then'](function(_0x54d7e4){if(_0x54d7e4){_0x2be3c2['body'][_0xb2c3('0x5c')]=_0x54d7e4['id'];return db['Action'][_0xb2c3('0x4d')](_0x2be3c2[_0xb2c3('0x4e')]);}})[_0xb2c3('0x27')](respondWithResult(_0xea2809,null))[_0xb2c3('0x47')](handleError(_0xea2809,null));};exports[_0xb2c3('0x5d')]=function(_0x24796e,_0x32d7be,_0x1da9a7){var _0x4b0255={};var _0x511b13={};var _0x494865;var _0x5d135c;return db[_0xb2c3('0x30')][_0xb2c3('0x5a')]({'where':{'id':_0x24796e[_0xb2c3('0x49')]['id']}})['then'](handleEntityNotFound(_0x32d7be,null))[_0xb2c3('0x27')](function(_0xde8671){if(_0xde8671){_0x494865=_0xde8671;_0x511b13[_0xb2c3('0x36')]=_['keys'](db[_0xb2c3('0x5e')][_0xb2c3('0x4b')]);_0x511b13[_0xb2c3('0x33')]=_[_0xb2c3('0x4a')](_0x24796e['query']);_0x511b13[_0xb2c3('0x34')]=_['intersection'](_0x511b13[_0xb2c3('0x36')],_0x511b13[_0xb2c3('0x33')]);_0x4b0255[_0xb2c3('0x38')]=_[_0xb2c3('0x35')](_0x511b13[_0xb2c3('0x36')],qs[_0xb2c3('0x37')](_0x24796e[_0xb2c3('0x33')][_0xb2c3('0x37')]));_0x4b0255[_0xb2c3('0x38')]=_0x4b0255[_0xb2c3('0x38')]['length']?_0x4b0255[_0xb2c3('0x38')]:_0x511b13['model'];_0x4b0255[_0xb2c3('0x3c')]=qs[_0xb2c3('0x3d')](_0x24796e[_0xb2c3('0x33')][_0xb2c3('0x3d')]);_0x4b0255[_0xb2c3('0x40')]=qs['filters'](_[_0xb2c3('0x3e')](_0x24796e['query'],_0x511b13[_0xb2c3('0x34')]));if(_0x24796e[_0xb2c3('0x33')]['filter']){_0x4b0255[_0xb2c3('0x40')]=_[_0xb2c3('0x41')](_0x4b0255['where'],{'$or':_[_0xb2c3('0x2f')](_0x4b0255['attributes'],function(_0x492096){var _0x42328c={};_0x42328c[_0x492096]={'$like':'%'+_0x24796e['query']['filter']+'%'};return _0x42328c;})});}_0x4b0255=_['merge']({},_0x4b0255,_0x24796e[_0xb2c3('0x43')]);return _0x494865['getActions'](_0x4b0255);}})['then'](function(_0x4018f9){if(_0x4018f9){_0x5d135c=_0x4018f9[_0xb2c3('0x39')];if(!_0x24796e[_0xb2c3('0x33')]['hasOwnProperty'](_0xb2c3('0x3b'))){_0x4b0255[_0xb2c3('0x21')]=qs[_0xb2c3('0x21')](_0x24796e[_0xb2c3('0x33')]['limit']);_0x4b0255[_0xb2c3('0x20')]=qs['offset'](_0x24796e[_0xb2c3('0x33')][_0xb2c3('0x20')]);}return _0x494865['getActions'](_0x4b0255);}})[_0xb2c3('0x27')](function(_0x5517ab){if(_0x5517ab){return _0x5517ab?{'count':_0x5d135c,'rows':_0x5517ab}:null;}})[_0xb2c3('0x27')](respondWithResult(_0x32d7be,null))[_0xb2c3('0x47')](handleError(_0x32d7be,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index c503cc8..8e0d848 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 _0x5355=['path','rimraf','./trigger.attributes','Trigger','tools_triggers','lodash','../../config/logger','api','moment','request-promise'];(function(_0x6d9f5d,_0x3663e4){var _0x3025f1=function(_0x230228){while(--_0x230228){_0x6d9f5d['push'](_0x6d9f5d['shift']());}};_0x3025f1(++_0x3663e4);}(_0x5355,0x91));var _0x5535=function(_0x3f5dca,_0x59472b){_0x3f5dca=_0x3f5dca-0x0;var _0x5b833a=_0x5355[_0x3f5dca];return _0x5b833a;};'use strict';var _=require(_0x5535('0x0'));var util=require('util');var logger=require(_0x5535('0x1'))(_0x5535('0x2'));var moment=require(_0x5535('0x3'));var BPromise=require('bluebird');var rp=require(_0x5535('0x4'));var fs=require('fs');var path=require(_0x5535('0x5'));var rimraf=require(_0x5535('0x6'));var config=require('../../config/environment');var attributes=require(_0x5535('0x7'));module['exports']=function(_0x40d36d,_0x325c52){return _0x40d36d['define'](_0x5535('0x8'),attributes,{'tableName':_0x5535('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb04d=['util','api','moment','bluebird','request-promise','path','rimraf','./trigger.attributes','define','lodash'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb04d,0x1ad));var _0xdb04=function(_0x5a5c89,_0x37c7d6){_0x5a5c89=_0x5a5c89-0x0;var _0x35a495=_0xb04d[_0x5a5c89];return _0x35a495;};'use strict';var _=require(_0xdb04('0x0'));var util=require(_0xdb04('0x1'));var logger=require('../../config/logger')(_0xdb04('0x2'));var moment=require(_0xdb04('0x3'));var BPromise=require(_0xdb04('0x4'));var rp=require(_0xdb04('0x5'));var fs=require('fs');var path=require(_0xdb04('0x6'));var rimraf=require(_0xdb04('0x7'));var config=require('../../config/environment');var attributes=require(_0xdb04('0x8'));module['exports']=function(_0x2f1224,_0x26a763){return _0x2f1224[_0xdb04('0x9')]('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 99395ab..c9fba14 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 _0x5eb8=['where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','message','catch','Trigger','findAll','options','raw','limit','include','model','attributes','map','then','GetTrigger','stringify','ShowTrigger'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x5eb8,0xb0));var _0x85eb=function(_0x2b1551,_0x1776fe){_0x2b1551=_0x2b1551-0x0;var _0x2fc2a1=_0x5eb8[_0x2b1551];return _0x2fc2a1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8814,_0x16d7b9,_0x3af658){return new BPromise(function(_0x448345,_0x5cd4ec){return client[_0x85eb('0xc')](_0x4a8814,_0x3af658)['then'](function(_0x1f0036){logger[_0x85eb('0xd')](_0x85eb('0xe'),_0x16d7b9,_0x85eb('0xf'));logger[_0x85eb('0x10')](_0x85eb('0x11'),_0x16d7b9,_0x85eb('0xf'),JSON['stringify'](_0x1f0036));if(_0x1f0036[_0x85eb('0x12')]){if(_0x1f0036[_0x85eb('0x12')]['code']===0x1f4){logger[_0x85eb('0x12')](_0x85eb('0xe'),_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x5cd4ec(_0x1f0036['error']['message']);}logger[_0x85eb('0x12')]('Trigger,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('Trigger,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('Trigger,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});}exports['GetTrigger']=function(_0x50d2a8){var _0xe198ca=this;return new Promise(function(_0x39ca96,_0x10cf2f){return db[_0x85eb('0x15')][_0x85eb('0x16')]({'raw':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8['options'][_0x85eb('0x18')]===undefined?!![]:![]:!![],'where':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')]['where']||null:null,'attributes':_0x50d2a8['options']?_0x50d2a8['options']['attributes']||null:null,'limit':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')][_0x85eb('0x19')]||null:null,'include':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')][_0x85eb('0x1a')]?_['map'](_0x50d2a8['options']['include'],function(_0x298e84){return{'model':db[_0x298e84[_0x85eb('0x1b')]],'as':_0x298e84['as'],'attributes':_0x298e84[_0x85eb('0x1c')],'include':_0x298e84[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x298e84[_0x85eb('0x1a')],function(_0x5dfc96){return{'model':db[_0x5dfc96[_0x85eb('0x1b')]],'as':_0x5dfc96['as'],'attributes':_0x5dfc96[_0x85eb('0x1c')],'include':_0x5dfc96[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x5dfc96[_0x85eb('0x1a')],function(_0x57a03c){return{'model':db[_0x57a03c[_0x85eb('0x1b')]],'as':_0x57a03c['as'],'attributes':_0x57a03c[_0x85eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x85eb('0x1e')](function(_0x3e7eb9){logger[_0x85eb('0xd')](_0x85eb('0x1f'),_0x50d2a8);logger['debug']('GetTrigger',_0x50d2a8,JSON[_0x85eb('0x20')](_0x3e7eb9));_0x39ca96(_0x3e7eb9);})['catch'](function(_0xa9b14f){logger['error'](_0x85eb('0x1f'),_0xa9b14f[_0x85eb('0x13')],_0x50d2a8);_0x10cf2f(_0xe198ca[_0x85eb('0x12')](0x1f4,_0xa9b14f[_0x85eb('0x13')]));});});};exports[_0x85eb('0x21')]=function(_0xf4ac13){var _0x41ed76=this;return new Promise(function(_0x5decd5,_0x237f19){return db[_0x85eb('0x15')]['find']({'raw':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13['options']['raw']===undefined?!![]:![]:!![],'where':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x22')]||null:null,'attributes':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x1c')]||null:null,'include':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0xf4ac13['options'][_0x85eb('0x1a')],function(_0x3a5b87){return{'model':db[_0x3a5b87['model']],'as':_0x3a5b87['as'],'attributes':_0x3a5b87['attributes'],'include':_0x3a5b87[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x3a5b87[_0x85eb('0x1a')],function(_0x12cb4c){return{'model':db[_0x12cb4c[_0x85eb('0x1b')]],'as':_0x12cb4c['as'],'attributes':_0x12cb4c[_0x85eb('0x1c')],'include':_0x12cb4c[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x12cb4c[_0x85eb('0x1a')],function(_0x373e5f){return{'model':db[_0x373e5f[_0x85eb('0x1b')]],'as':_0x373e5f['as'],'attributes':_0x373e5f[_0x85eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x85eb('0x1e')](function(_0x33605a){logger['info'](_0x85eb('0x21'),_0xf4ac13);logger[_0x85eb('0x10')]('ShowTrigger',_0xf4ac13,JSON['stringify'](_0x33605a));_0x5decd5(_0x33605a);})[_0x85eb('0x14')](function(_0xe22d16){logger['error'](_0x85eb('0x21'),_0xe22d16['message'],_0xf4ac13);_0x237f19(_0x41ed76[_0x85eb('0x12')](0x1f4,_0xe22d16['message']));});});}; \ No newline at end of file +var _0xdd4f=['request\x20sent','stringify','error','code','message','info','result','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowTrigger','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s'];(function(_0x4c9bc4,_0x50a2d8){var _0x1a64ea=function(_0x189ba9){while(--_0x189ba9){_0x4c9bc4['push'](_0x4c9bc4['shift']());}};_0x1a64ea(++_0x50a2d8);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x10e1ce,_0x1f28eb){_0x10e1ce=_0x10e1ce-0x0;var _0x5be2ea=_0xdd4f[_0x10e1ce];return _0x5be2ea;};'use strict';var _=require(_0xfdd4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfdd4('0x1'));var fs=require('fs');var Redis=require(_0xfdd4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfdd4('0x3'));var logger=require(_0xfdd4('0x4'))(_0xfdd4('0x5'));var config=require('../../config/environment');var jayson=require(_0xfdd4('0x6'));var client=jayson[_0xfdd4('0x7')][_0xfdd4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x307ac6,_0x3c72d4,_0x51acd6){return new BPromise(function(_0x3cd8e6,_0x563ae6){return client[_0xfdd4('0x9')](_0x307ac6,_0x51acd6)[_0xfdd4('0xa')](function(_0x1e823e){logger['info'](_0xfdd4('0xb'),_0x3c72d4,'request\x20sent');logger[_0xfdd4('0xc')](_0xfdd4('0xd'),_0x3c72d4,_0xfdd4('0xe'),JSON[_0xfdd4('0xf')](_0x1e823e));if(_0x1e823e[_0xfdd4('0x10')]){if(_0x1e823e[_0xfdd4('0x10')][_0xfdd4('0x11')]===0x1f4){logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x1e823e[_0xfdd4('0x10')][_0xfdd4('0x12')]);return _0x563ae6(_0x1e823e['error'][_0xfdd4('0x12')]);}logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x1e823e['error'][_0xfdd4('0x12')]);return _0x3cd8e6(_0x1e823e['error'][_0xfdd4('0x12')]);}else{logger[_0xfdd4('0x13')](_0xfdd4('0xb'),_0x3c72d4,_0xfdd4('0xe'));_0x3cd8e6(_0x1e823e[_0xfdd4('0x14')]['message']);}})['catch'](function(_0x559c77){logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x559c77);_0x563ae6(_0x559c77);});});}exports[_0xfdd4('0x15')]=function(_0x2ccc88){var _0x32b5f7=this;return new Promise(function(_0x33d752,_0x1746e1){return db[_0xfdd4('0x16')][_0xfdd4('0x17')]({'raw':_0x2ccc88['options']?_0x2ccc88[_0xfdd4('0x18')][_0xfdd4('0x19')]===undefined?!![]:![]:!![],'where':_0x2ccc88[_0xfdd4('0x18')]?_0x2ccc88[_0xfdd4('0x18')][_0xfdd4('0x1a')]||null:null,'attributes':_0x2ccc88[_0xfdd4('0x18')]?_0x2ccc88[_0xfdd4('0x18')][_0xfdd4('0x1b')]||null:null,'limit':_0x2ccc88['options']?_0x2ccc88[_0xfdd4('0x18')][_0xfdd4('0x1c')]||null:null,'include':_0x2ccc88[_0xfdd4('0x18')]?_0x2ccc88[_0xfdd4('0x18')][_0xfdd4('0x1d')]?_[_0xfdd4('0x1e')](_0x2ccc88[_0xfdd4('0x18')][_0xfdd4('0x1d')],function(_0x538b00){return{'model':db[_0x538b00[_0xfdd4('0x1f')]],'as':_0x538b00['as'],'attributes':_0x538b00[_0xfdd4('0x1b')],'include':_0x538b00[_0xfdd4('0x1d')]?_['map'](_0x538b00[_0xfdd4('0x1d')],function(_0x39b712){return{'model':db[_0x39b712[_0xfdd4('0x1f')]],'as':_0x39b712['as'],'attributes':_0x39b712[_0xfdd4('0x1b')],'include':_0x39b712[_0xfdd4('0x1d')]?_['map'](_0x39b712[_0xfdd4('0x1d')],function(_0x2c88ad){return{'model':db[_0x2c88ad[_0xfdd4('0x1f')]],'as':_0x2c88ad['as'],'attributes':_0x2c88ad[_0xfdd4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfdd4('0xa')](function(_0x192471){logger[_0xfdd4('0x13')](_0xfdd4('0x15'),_0x2ccc88);logger['debug'](_0xfdd4('0x15'),_0x2ccc88,JSON[_0xfdd4('0xf')](_0x192471));_0x33d752(_0x192471);})[_0xfdd4('0x20')](function(_0xef012e){logger[_0xfdd4('0x10')]('GetTrigger',_0xef012e[_0xfdd4('0x12')],_0x2ccc88);_0x1746e1(_0x32b5f7[_0xfdd4('0x10')](0x1f4,_0xef012e[_0xfdd4('0x12')]));});});};exports[_0xfdd4('0x21')]=function(_0x13cc5e){var _0x4d64ce=this;return new Promise(function(_0x374e98,_0x315568){return db[_0xfdd4('0x16')]['find']({'raw':_0x13cc5e[_0xfdd4('0x18')]?_0x13cc5e['options'][_0xfdd4('0x19')]===undefined?!![]:![]:!![],'where':_0x13cc5e[_0xfdd4('0x18')]?_0x13cc5e['options']['where']||null:null,'attributes':_0x13cc5e[_0xfdd4('0x18')]?_0x13cc5e[_0xfdd4('0x18')]['attributes']||null:null,'include':_0x13cc5e['options']?_0x13cc5e[_0xfdd4('0x18')][_0xfdd4('0x1d')]?_[_0xfdd4('0x1e')](_0x13cc5e[_0xfdd4('0x18')][_0xfdd4('0x1d')],function(_0x265cab){return{'model':db[_0x265cab[_0xfdd4('0x1f')]],'as':_0x265cab['as'],'attributes':_0x265cab[_0xfdd4('0x1b')],'include':_0x265cab[_0xfdd4('0x1d')]?_[_0xfdd4('0x1e')](_0x265cab[_0xfdd4('0x1d')],function(_0x12b8b1){return{'model':db[_0x12b8b1[_0xfdd4('0x1f')]],'as':_0x12b8b1['as'],'attributes':_0x12b8b1[_0xfdd4('0x1b')],'include':_0x12b8b1[_0xfdd4('0x1d')]?_[_0xfdd4('0x1e')](_0x12b8b1[_0xfdd4('0x1d')],function(_0x3a0102){return{'model':db[_0x3a0102[_0xfdd4('0x1f')]],'as':_0x3a0102['as'],'attributes':_0x3a0102[_0xfdd4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfdd4('0xa')](function(_0x2e4c8c){logger[_0xfdd4('0x13')](_0xfdd4('0x21'),_0x13cc5e);logger[_0xfdd4('0xc')](_0xfdd4('0x21'),_0x13cc5e,JSON['stringify'](_0x2e4c8c));_0x374e98(_0x2e4c8c);})[_0xfdd4('0x20')](function(_0x3716da){logger[_0xfdd4('0x10')](_0xfdd4('0x21'),_0x3716da[_0xfdd4('0x12')],_0x13cc5e);_0x315568(_0x4d64ce[_0xfdd4('0x10')](0x1f4,_0x3716da['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 4ecd4ce..0d76d1a 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 _0xdc32=['get','isAuthenticated','index','show','post','/:id/clone','clone','put','delete','/:id','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller'];(function(_0x54aa65,_0x7e847){var _0x2332ef=function(_0x462244){while(--_0x462244){_0x54aa65['push'](_0x54aa65['shift']());}};_0x2332ef(++_0x7e847);}(_0xdc32,0x1af));var _0x2dc3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdc32[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x2dc3('0x0'));var util=require(_0x2dc3('0x1'));var path=require('path');var timeout=require(_0x2dc3('0x2'));var express=require(_0x2dc3('0x3'));var router=express[_0x2dc3('0x4')]();var fs_extra=require(_0x2dc3('0x5'));var auth=require(_0x2dc3('0x6'));var interaction=require(_0x2dc3('0x7'));var config=require(_0x2dc3('0x8'));var controller=require(_0x2dc3('0x9'));router[_0x2dc3('0xa')]('/',auth[_0x2dc3('0xb')](),controller[_0x2dc3('0xc')]);router[_0x2dc3('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x2dc3('0xd')]);router[_0x2dc3('0xe')](_0x2dc3('0xf'),auth[_0x2dc3('0xb')](),controller[_0x2dc3('0x10')]);router['post']('/',auth[_0x2dc3('0xb')](),controller['create']);router[_0x2dc3('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x2dc3('0x12')](_0x2dc3('0x13'),auth[_0x2dc3('0xb')](),controller['destroy']);module[_0x2dc3('0x14')]=router; \ No newline at end of file +var _0xc44b=['isAuthenticated','show','post','create','delete','/:id','destroy','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','get'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xc44b,0xad));var _0xbc44=function(_0x396466,_0xe9857b){_0x396466=_0x396466-0x0;var _0x5e9ab4=_0xc44b[_0x396466];return _0x5e9ab4;};'use strict';var multer=require(_0xbc44('0x0'));var util=require(_0xbc44('0x1'));var path=require(_0xbc44('0x2'));var timeout=require('connect-timeout');var express=require(_0xbc44('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbc44('0x4'));var config=require(_0xbc44('0x5'));var controller=require('./trunk.controller');router[_0xbc44('0x6')]('/',auth[_0xbc44('0x7')](),controller['index']);router['get']('/:id',auth[_0xbc44('0x7')](),controller[_0xbc44('0x8')]);router[_0xbc44('0x9')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0xbc44('0x9')]('/',auth[_0xbc44('0x7')](),controller[_0xbc44('0xa')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xbc44('0xb')](_0xbc44('0xc'),auth['isAuthenticated'](),controller[_0xbc44('0xd')]);module[_0xbc44('0xe')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index dd5359c..c5d6b04 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 _0x5bda=['certificate','active','actpass','dynamic','update,nonat','BOOLEAN','exports','STRING','name','ENUM','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint'];(function(_0xa97590,_0x343ef0){var _0x41435b=function(_0x50bdf2){while(--_0x50bdf2){_0xa97590['push'](_0xa97590['shift']());}};_0x41435b(++_0x343ef0);}(_0x5bda,0x119));var _0xa5bd=function(_0x353622,_0x2253b3){_0x353622=_0x353622-0x0;var _0xe9f64d=_0x5bda[_0x353622];return _0xe9f64d;};'use strict';var Sequelize=require('sequelize');module[_0xa5bd('0x0')]={'name':{'type':Sequelize[_0xa5bd('0x1')],'allowNull':![],'unique':_0xa5bd('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xa5bd('0x3')](_0xa5bd('0x4'),_0xa5bd('0x5'),_0xa5bd('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xa5bd('0x1')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xa5bd('0x3')](_0xa5bd('0x7'),'ALLOWED_PASSED_SCREEN',_0xa5bd('0x8'),'ALLOWED',_0xa5bd('0x9'),_0xa5bd('0xa'),_0xa5bd('0xb'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xa5bd('0x1')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xa5bd('0x1')]},'transport':{'type':Sequelize[_0xa5bd('0x1')],'defaultValue':_0xa5bd('0xc'),'set':function(_0x3629eb){this[_0xa5bd('0xd')](_0xa5bd('0xe'),_0x3629eb?_0x3629eb[_0xa5bd('0xf')](','):null);},'get':function(){return this[_0xa5bd('0x10')](_0xa5bd('0xe'))?this['getDataValue'](_0xa5bd('0xe'))[_0xa5bd('0x11')](','):null;},'comment':_0xa5bd('0x12')},'dtmfmode':{'type':Sequelize[_0xa5bd('0x3')](_0xa5bd('0x13'),_0xa5bd('0x14'),_0xa5bd('0x15'),_0xa5bd('0x16'),_0xa5bd('0x17')),'defaultValue':_0xa5bd('0x13')},'directmedia':{'type':Sequelize['ENUM'](_0xa5bd('0x18'),'no',_0xa5bd('0x19'),_0xa5bd('0x1a'),_0xa5bd('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa5bd('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xa5bd('0x1c'),'set':function(_0x21562d){this['setDataValue'](_0xa5bd('0x1d'),_0x21562d?_0x21562d['join'](','):null);},'get':function(){return this[_0xa5bd('0x10')](_0xa5bd('0x1d'))?this[_0xa5bd('0x10')](_0xa5bd('0x1d'))[_0xa5bd('0x11')](','):null;},'comment':_0xa5bd('0x1e')},'callgroup':{'type':Sequelize[_0xa5bd('0x1')]},'namedcallgroup':{'type':Sequelize[_0xa5bd('0x1')]},'pickupgroup':{'type':Sequelize[_0xa5bd('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xa5bd('0x1')]},'language':{'type':Sequelize[_0xa5bd('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xa5bd('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xa5bd('0x1')],'defaultValue':_0xa5bd('0x1f')},'allow':{'type':Sequelize[_0xa5bd('0x1')],'allowNull':![],'defaultValue':_0xa5bd('0x20'),'set':function(_0x39f31f){this['setDataValue'](_0xa5bd('0x21'),_0x39f31f?_0x39f31f[_0xa5bd('0xf')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue']('allow')?this[_0xa5bd('0x10')]('allow')[_0xa5bd('0x11')](';'):null;},'comment':_0xa5bd('0x22')},'autoframing':{'type':Sequelize[_0xa5bd('0x3')]('yes','no')},'insecure':{'type':Sequelize[_0xa5bd('0x1')],'defaultValue':_0xa5bd('0x23'),'set':function(_0x2e0e6f){this[_0xa5bd('0xd')]('insecure',_0x2e0e6f?_0x2e0e6f[_0xa5bd('0xf')](','):null);},'get':function(){return this[_0xa5bd('0x10')](_0xa5bd('0x24'))?this[_0xa5bd('0x10')](_0xa5bd('0x24'))['split'](','):null;},'comment':_0xa5bd('0x25')},'trustrpid':{'type':Sequelize[_0xa5bd('0x3')](_0xa5bd('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xa5bd('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xa5bd('0x3')](_0xa5bd('0x18'),'no',_0xa5bd('0x26'))},'promiscredir':{'type':Sequelize[_0xa5bd('0x3')](_0xa5bd('0x18'),'no')},'useclientcode':{'type':Sequelize[_0xa5bd('0x3')](_0xa5bd('0x18'),'no')},'accountcode':{'type':Sequelize[_0xa5bd('0x27')](0xb)},'setvar':{'type':Sequelize[_0xa5bd('0x1')]},'callerid':{'type':Sequelize[_0xa5bd('0x1')],'defaultValue':_0xa5bd('0x28')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xa5bd('0x3')](_0xa5bd('0x18'),'no'),'defaultValue':_0xa5bd('0x18')},'busylevel':{'type':Sequelize[_0xa5bd('0x27')](0xb)},'allowoverlap':{'type':Sequelize[_0xa5bd('0x3')](_0xa5bd('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0xa5bd('0x3')]('yes','no')},'allowtransfer':{'type':Sequelize[_0xa5bd('0x3')](_0xa5bd('0x18'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xa5bd('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0xa5bd('0x1')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xa5bd('0x3')](_0xa5bd('0x18'),'no',_0xa5bd('0x29')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xa5bd('0x3')](_0xa5bd('0x18'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xa5bd('0x3')](_0xa5bd('0x2a'),_0xa5bd('0x2b'),_0xa5bd('0x2c'))},'session_expires':{'type':Sequelize[_0xa5bd('0x27')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xa5bd('0x3')](_0xa5bd('0x2d'),_0xa5bd('0x2e')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xa5bd('0x1')]},'fromdomain':{'type':Sequelize[_0xa5bd('0x1')]},'fromuser':{'type':Sequelize[_0xa5bd('0x1')]},'port':{'type':Sequelize[_0xa5bd('0x27')](0x5)},'qualify':{'type':Sequelize[_0xa5bd('0x3')]('yes','no'),'defaultValue':_0xa5bd('0x18')},'keepalive':{'type':Sequelize[_0xa5bd('0x27')](0xb)},'defaultip':{'type':Sequelize[_0xa5bd('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xa5bd('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xa5bd('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xa5bd('0x27')](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no',_0xa5bd('0x2f')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa5bd('0x1')]},'callbackextension':{'type':Sequelize[_0xa5bd('0x1')]},'timert1':{'type':Sequelize[_0xa5bd('0x27')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xa5bd('0x27')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xa5bd('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xa5bd('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xa5bd('0x27')](0xb)},'encryption':{'type':Sequelize[_0xa5bd('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xa5bd('0x18'),'no')},'force_avp':{'type':Sequelize[_0xa5bd('0x3')](_0xa5bd('0x18'),'no')},'icesupport':{'type':Sequelize[_0xa5bd('0x3')](_0xa5bd('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0xa5bd('0x3')](_0xa5bd('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0xa5bd('0x3')](_0xa5bd('0x18'),'no',_0xa5bd('0x30'),_0xa5bd('0x31'))},'dtlsrekey':{'type':Sequelize[_0xa5bd('0x27')](0xb)},'dtlscertfile':{'type':Sequelize[_0xa5bd('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xa5bd('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xa5bd('0x1')]},'dtlscapath':{'type':Sequelize[_0xa5bd('0x1')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xa5bd('0x32'),'passive',_0xa5bd('0x33')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa5bd('0x1')]},'usereqphone':{'type':Sequelize[_0xa5bd('0x3')](_0xa5bd('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa5bd('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xa5bd('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xa5bd('0x3')](_0xa5bd('0x18'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xa5bd('0x18'),'no')},'vmexten':{'type':Sequelize[_0xa5bd('0x1')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xa5bd('0x1')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa5bd('0x1')]},'host':{'type':Sequelize[_0xa5bd('0x1')],'defaultValue':_0xa5bd('0x34')},'canreinvite':{'type':Sequelize[_0xa5bd('0x3')](_0xa5bd('0x18'),'no',_0xa5bd('0x19'),_0xa5bd('0x1a'),_0xa5bd('0x35')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xa5bd('0x1')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xa5bd('0x36')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xa5bd('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0xc9e5=['uas','pai','fingerprint','active','passive','actpass','update,nonat','BOOLEAN','sequelize','exports','STRING','name','friend','user','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB','udp','setDataValue','join','transport','split','rfc2833','shortinfo','nonat','update','outgoing','yes','nat','getDataValue','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','INTEGER','always','accept','originate'];(function(_0x106df8,_0x5e190b){var _0x1b6d78=function(_0xc46051){while(--_0xc46051){_0x106df8['push'](_0x106df8['shift']());}};_0x1b6d78(++_0x5e190b);}(_0xc9e5,0x89));var _0x5c9e=function(_0x2a29e2,_0x12ff0a){_0x2a29e2=_0x2a29e2-0x0;var _0x5be96a=_0xc9e5[_0x2a29e2];return _0x5be96a;};'use strict';var Sequelize=require(_0x5c9e('0x0'));module[_0x5c9e('0x1')]={'name':{'type':Sequelize[_0x5c9e('0x2')],'allowNull':![],'unique':_0x5c9e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x5c9e('0x4'),_0x5c9e('0x5'),'peer'),'allowNull':![],'defaultValue':_0x5c9e('0x4')},'context':{'type':Sequelize[_0x5c9e('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x5c9e('0x6')]('ALLOWED_NOT_SCREENED',_0x5c9e('0x7'),_0x5c9e('0x8'),'ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0x5c9e('0x9'))},'deny':{'type':Sequelize[_0x5c9e('0x2')]},'permit':{'type':Sequelize[_0x5c9e('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x5c9e('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x5c9e('0xa'),'set':function(_0x16316f){this[_0x5c9e('0xb')]('transport',_0x16316f?_0x16316f[_0x5c9e('0xc')](','):null);},'get':function(){return this['getDataValue'](_0x5c9e('0xd'))?this['getDataValue'](_0x5c9e('0xd'))[_0x5c9e('0xe')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0xf'),'info',_0x5c9e('0x10'),'inband','auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x5c9e('0x6')]('yes','no',_0x5c9e('0x11'),_0x5c9e('0x12'),_0x5c9e('0x13')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x14'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x5c9e('0x2')]},'directmediadeny':{'type':Sequelize[_0x5c9e('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x5dcc41){this[_0x5c9e('0xb')](_0x5c9e('0x15'),_0x5dcc41?_0x5dcc41['join'](','):null);},'get':function(){return this[_0x5c9e('0x16')](_0x5c9e('0x15'))?this['getDataValue']('nat')[_0x5c9e('0xe')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x5c9e('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x5c9e('0x2')]},'language':{'type':Sequelize[_0x5c9e('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x5c9e('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x5c9e('0x2')],'defaultValue':_0x5c9e('0x17')},'allow':{'type':Sequelize[_0x5c9e('0x2')],'allowNull':![],'defaultValue':_0x5c9e('0x18'),'set':function(_0x1d1792){this[_0x5c9e('0xb')](_0x5c9e('0x19'),_0x1d1792?_0x1d1792[_0x5c9e('0xc')](';'):_0x5c9e('0x18'));},'get':function(){return this[_0x5c9e('0x16')](_0x5c9e('0x19'))?this[_0x5c9e('0x16')](_0x5c9e('0x19'))[_0x5c9e('0xe')](';'):null;},'comment':_0x5c9e('0x1a')},'autoframing':{'type':Sequelize[_0x5c9e('0x6')]('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x5c9e('0x1b'),'set':function(_0x24cad3){this['setDataValue'](_0x5c9e('0x1c'),_0x24cad3?_0x24cad3[_0x5c9e('0xc')](','):null);},'get':function(){return this[_0x5c9e('0x16')](_0x5c9e('0x1c'))?this[_0x5c9e('0x16')]('insecure')[_0x5c9e('0xe')](','):null;},'comment':_0x5c9e('0x1d')},'trustrpid':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x14'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x5c9e('0x6')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x14'),'no',_0x5c9e('0x1e'))},'promiscredir':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x14'),'no')},'useclientcode':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x14'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x5c9e('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x5c9e('0x2')]},'callcounter':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x14'),'no'),'defaultValue':_0x5c9e('0x14')},'busylevel':{'type':Sequelize[_0x5c9e('0x1f')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x5c9e('0x14'),'no')},'allowsubscribe':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x14'),'no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x14'),'no')},'subscribecontext':{'type':Sequelize[_0x5c9e('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize['ENUM'](_0x5c9e('0x14'),'no',_0x5c9e('0x20')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x5c9e('0x1f')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x5c9e('0x6')]('yes','no')},'mailbox':{'type':Sequelize[_0x5c9e('0x2')]},'session_timers':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x21'),'refuse',_0x5c9e('0x22'))},'session_expires':{'type':Sequelize[_0x5c9e('0x1f')](0xb)},'session_minse':{'type':Sequelize[_0x5c9e('0x1f')](0xb)},'session_refresher':{'type':Sequelize[_0x5c9e('0x6')]('uac',_0x5c9e('0x23')),'defaultValue':_0x5c9e('0x23')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x5c9e('0x2')]},'fromdomain':{'type':Sequelize[_0x5c9e('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x5c9e('0x1f')](0x5)},'qualify':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x14'),'no'),'defaultValue':_0x5c9e('0x14')},'keepalive':{'type':Sequelize[_0x5c9e('0x1f')](0xb)},'defaultip':{'type':Sequelize[_0x5c9e('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x5c9e('0x1f')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x5c9e('0x1f')](0xb)},'sendrpid':{'type':Sequelize[_0x5c9e('0x6')]('yes','no',_0x5c9e('0x24')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x5c9e('0x2')]},'timert1':{'type':Sequelize[_0x5c9e('0x1f')](0xb)},'timerb':{'type':Sequelize[_0x5c9e('0x1f')](0xb)},'qualifyfreq':{'type':Sequelize[_0x5c9e('0x1f')](0xb)},'contactpermit':{'type':Sequelize[_0x5c9e('0x2')]},'contactdeny':{'type':Sequelize[_0x5c9e('0x2')]},'contactacl':{'type':Sequelize[_0x5c9e('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x5c9e('0x2')]},'use_q850_reason':{'type':Sequelize[_0x5c9e('0x2')]},'maxforwards':{'type':Sequelize[_0x5c9e('0x1f')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x5c9e('0x14'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x14'),'no')},'force_avp':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x14'),'no')},'icesupport':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x14'),'no')},'dtlsenable':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x14'),'no')},'dtlsverify':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x14'),'no',_0x5c9e('0x25'),'certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x5c9e('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x5c9e('0x2')]},'dtlscipher':{'type':Sequelize[_0x5c9e('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x5c9e('0x2')]},'dtlssetup':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x26'),_0x5c9e('0x27'),_0x5c9e('0x28')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x5c9e('0x2')]},'usereqphone':{'type':Sequelize[_0x5c9e('0x6')](_0x5c9e('0x14'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x5c9e('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x5c9e('0x1f')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x5c9e('0x14'),'no')},'subscribemwi':{'type':Sequelize[_0x5c9e('0x6')]('yes','no')},'vmexten':{'type':Sequelize[_0x5c9e('0x2')]},'mohinterpret':{'type':Sequelize[_0x5c9e('0x2')]},'mohsuggest':{'type':Sequelize[_0x5c9e('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5c9e('0x2')]},'host':{'type':Sequelize[_0x5c9e('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM'](_0x5c9e('0x14'),'no',_0x5c9e('0x11'),_0x5c9e('0x12'),_0x5c9e('0x29')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x5c9e('0x2a')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x5c9e('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index d298a4e..99c286c 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 _0x2f1b=['util','sox','to-csv','ejs','lodash','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','message','error','catch','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','get','Trunks','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','options','Trunk','find','clone','include','createdAt','updatedAt','body','omit','create','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','user','destroy','server/files/templates/registry.ejs','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x2f1b,0xd2));var _0xb2f1=function(_0x3d7a9f,_0x3420f1){_0x3d7a9f=_0x3d7a9f-0x0;var _0x1878d8=_0x2f1b[_0x3d7a9f];return _0x1878d8;};'use strict';var pdf=require(_0xb2f1('0x0'));var emlformat=require(_0xb2f1('0x1'));var rimraf=require(_0xb2f1('0x2'));var zipdir=require(_0xb2f1('0x3'));var jsonpatch=require(_0xb2f1('0x4'));var rp=require(_0xb2f1('0x5'));var moment=require('moment');var BPromise=require(_0xb2f1('0x6'));var Mustache=require(_0xb2f1('0x7'));var util=require(_0xb2f1('0x8'));var path=require('path');var sox=require(_0xb2f1('0x9'));var csv=require(_0xb2f1('0xa'));var ejs=require(_0xb2f1('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb2f1('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb2f1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb2f1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb2f1('0xe'));var authService=require(_0xb2f1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb2f1('0x10'));var hardwareService=require(_0xb2f1('0x11'));var logger=require(_0xb2f1('0x12'))(_0xb2f1('0x13'));var utils=require(_0xb2f1('0x14'));var config=require(_0xb2f1('0x15'));var licenseUtil=require(_0xb2f1('0x16'));var db=require(_0xb2f1('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb2f1('0x18')][_0xb2f1('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x5cf89c,_0x1b7f82,_0x5cff89,_0x108f6b){return new BPromise(function(_0x444323,_0x5eca8){var _0x542ab1=_0x108f6b||client;return _0x542ab1['request'](_0x5cf89c,_0x5cff89)[_0xb2f1('0x1a')](function(_0x2f951b){logger[_0xb2f1('0x1b')](_0xb2f1('0x1c'),_0x1b7f82,_0xb2f1('0x1d'));logger['debug'](_0xb2f1('0x1e'),_0x1b7f82,_0xb2f1('0x1d'),JSON[_0xb2f1('0x1f')](_0x2f951b));if(_0x2f951b['error']){if(_0x2f951b['error']['code']===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x1b7f82,_0x2f951b['error'][_0xb2f1('0x20')]);return _0x5eca8(_0x2f951b[_0xb2f1('0x21')][_0xb2f1('0x20')]);}logger[_0xb2f1('0x21')]('Trunk,\x20%s,\x20%s',_0x1b7f82,_0x2f951b[_0xb2f1('0x21')][_0xb2f1('0x20')]);return _0x444323(_0x2f951b['error']['message']);}else{logger[_0xb2f1('0x1b')](_0xb2f1('0x1c'),_0x1b7f82,_0xb2f1('0x1d'));_0x444323(_0x2f951b['result'][_0xb2f1('0x20')]);}})[_0xb2f1('0x22')](function(_0x4bbb3d){logger[_0xb2f1('0x21')](_0xb2f1('0x1c'),_0x1b7f82,_0x4bbb3d);_0x5eca8(_0x4bbb3d);});});}function respondWithStatusCode(_0x58732b,_0x1d0820){_0x1d0820=_0x1d0820||0xcc;return function(_0x27568d){if(_0x27568d){return _0x58732b['sendStatus'](_0x1d0820);}return _0x58732b['status'](_0x1d0820)[_0xb2f1('0x23')]();};}function respondWithResult(_0x525dea,_0x2ec6fd){_0x2ec6fd=_0x2ec6fd||0xc8;return function(_0x2f25a0){if(_0x2f25a0){return _0x525dea[_0xb2f1('0x24')](_0x2ec6fd)['json'](_0x2f25a0);}};}function respondWithFilteredResult(_0x2c9069,_0xdcd7c8){return function(_0x2a9cba){if(_0x2a9cba){var _0xe152f8=_0x2a9cba[_0xb2f1('0x25')],_0x11e9e4=_0xdcd7c8['offset'],_0x51b699=_0xdcd7c8[_0xb2f1('0x26')]+_0xdcd7c8[_0xb2f1('0x27')],_0x171f59;if(_0x51b699>=_0xe152f8){_0x51b699=_0xe152f8;_0x171f59=0xc8;}else{_0x171f59=0xce;}_0x2c9069[_0xb2f1('0x24')](_0x171f59);return _0x2c9069[_0xb2f1('0x28')](_0xb2f1('0x29'),_0x11e9e4+'-'+_0x51b699+'/'+_0xe152f8)[_0xb2f1('0x2a')](_0x2a9cba);}return null;};}function patchUpdates(_0x24eec7){return function(_0xa5674d){try{jsonpatch[_0xb2f1('0x2b')](_0xa5674d,_0x24eec7,!![]);}catch(_0x2e81d7){return BPromise[_0xb2f1('0x2c')](_0x2e81d7);}return _0xa5674d[_0xb2f1('0x2d')]();};}function saveUpdates(_0x2cd0ed,_0x3eb52a){return function(_0x49a299){if(_0x49a299){return _0x49a299[_0xb2f1('0x2e')](_0x2cd0ed)[_0xb2f1('0x1a')](function(_0x43e24a){return _0x43e24a;});}return null;};}function removeEntity(_0x52596e,_0xb5e345){return function(_0x554d28){if(_0x554d28){return _0x554d28['destroy']()[_0xb2f1('0x1a')](function(){var _0x12000b=_0x554d28[_0xb2f1('0x2f')]({'plain':!![]});var _0x5b41e0=_0xb2f1('0x30');return db[_0xb2f1('0x31')]['destroy']({'where':{'type':_0x5b41e0,'resourceId':_0x12000b['id']}})[_0xb2f1('0x1a')](function(){return _0x554d28;});})[_0xb2f1('0x1a')](function(){_0x52596e[_0xb2f1('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d9f9a,_0x4348c3){return function(_0x3f5dac){if(!_0x3f5dac){_0x2d9f9a['sendStatus'](0x194);}return _0x3f5dac;};}function handleError(_0x9f5a89,_0x4137a7){_0x4137a7=_0x4137a7||0x1f4;return function(_0x90db7){logger[_0xb2f1('0x21')](_0x90db7[_0xb2f1('0x32')]);if(_0x90db7[_0xb2f1('0x33')]){delete _0x90db7['name'];}_0x9f5a89[_0xb2f1('0x24')](_0x4137a7)[_0xb2f1('0x34')](_0x90db7);};}exports[_0xb2f1('0x35')]=function(_0xc89067,_0x27a0e5){var _0x3cf062={},_0x36cb36={},_0x533710={'count':0x0,'rows':[]};var _0x23ee84=_[_0xb2f1('0x36')](db['Trunk'][_0xb2f1('0x37')],function(_0x1dcdc6){return{'name':_0x1dcdc6[_0xb2f1('0x38')],'type':_0x1dcdc6[_0xb2f1('0x39')][_0xb2f1('0x3a')]};});_0x36cb36[_0xb2f1('0x3b')]=_[_0xb2f1('0x36')](_0x23ee84,_0xb2f1('0x33'));_0x36cb36[_0xb2f1('0x3c')]=_[_0xb2f1('0x3d')](_0xc89067[_0xb2f1('0x3c')]);_0x36cb36['filters']=_['intersection'](_0x36cb36[_0xb2f1('0x3b')],_0x36cb36[_0xb2f1('0x3c')]);_0x3cf062[_0xb2f1('0x3e')]=_[_0xb2f1('0x3f')](_0x36cb36['model'],qs[_0xb2f1('0x40')](_0xc89067[_0xb2f1('0x3c')][_0xb2f1('0x40')]));_0x3cf062[_0xb2f1('0x3e')]=_0x3cf062['attributes'][_0xb2f1('0x41')]?_0x3cf062['attributes']:_0x36cb36[_0xb2f1('0x3b')];if(!_0xc89067[_0xb2f1('0x3c')][_0xb2f1('0x42')]('nolimit')){_0x3cf062[_0xb2f1('0x27')]=qs[_0xb2f1('0x27')](_0xc89067[_0xb2f1('0x3c')][_0xb2f1('0x27')]);_0x3cf062[_0xb2f1('0x26')]=qs['offset'](_0xc89067[_0xb2f1('0x3c')][_0xb2f1('0x26')]);}_0x3cf062[_0xb2f1('0x43')]=qs['sort'](_0xc89067[_0xb2f1('0x3c')][_0xb2f1('0x44')]);_0x3cf062[_0xb2f1('0x45')]=qs[_0xb2f1('0x46')](_[_0xb2f1('0x47')](_0xc89067['query'],_0x36cb36[_0xb2f1('0x46')]),_0x23ee84);if(_0xc89067[_0xb2f1('0x3c')][_0xb2f1('0x48')]){_0x3cf062['where']=_[_0xb2f1('0x49')](_0x3cf062[_0xb2f1('0x45')],{'$or':_[_0xb2f1('0x36')](_0x23ee84,function(_0x112ac6){if(_0x112ac6['type']!==_0xb2f1('0x4a')){var _0x5a1df6={};_0x5a1df6[_0x112ac6[_0xb2f1('0x33')]]={'$like':'%'+_0xc89067['query'][_0xb2f1('0x48')]+'%'};return _0x5a1df6;}})});}_0x3cf062=_['merge']({},_0x3cf062,_0xc89067['options']);var _0x4b01d5={'where':_0x3cf062['where']};return db['Trunk'][_0xb2f1('0x25')](_0x4b01d5)[_0xb2f1('0x1a')](function(_0x227920){_0x533710['count']=_0x227920;if(_0xc89067['query'][_0xb2f1('0x4b')]){_0x3cf062['include']=[{'all':!![]}];}return db['Trunk'][_0xb2f1('0x4c')](_0x3cf062);})[_0xb2f1('0x1a')](function(_0x7403c3){_0x533710[_0xb2f1('0x4d')]=_0x7403c3;return _0x533710;})[_0xb2f1('0x1a')](respondWithFilteredResult(_0x27a0e5,_0x3cf062))[_0xb2f1('0x22')](handleError(_0x27a0e5,null));};exports[_0xb2f1('0x4e')]=function(_0x55ef33,_0x15f94c){var _0x35431e={'raw':![],'where':{'id':_0x55ef33[_0xb2f1('0x4f')]['id']}},_0x3acb0f={};_0x3acb0f[_0xb2f1('0x3b')]=_['keys'](db['Trunk']['rawAttributes']);_0x3acb0f[_0xb2f1('0x3c')]=_[_0xb2f1('0x3d')](_0x55ef33[_0xb2f1('0x3c')]);_0x3acb0f[_0xb2f1('0x46')]=_['intersection'](_0x3acb0f[_0xb2f1('0x3b')],_0x3acb0f[_0xb2f1('0x3c')]);_0x35431e[_0xb2f1('0x3e')]=_[_0xb2f1('0x3f')](_0x3acb0f[_0xb2f1('0x3b')],qs[_0xb2f1('0x40')](_0x55ef33[_0xb2f1('0x3c')][_0xb2f1('0x40')]));_0x35431e['attributes']=_0x35431e['attributes'][_0xb2f1('0x41')]?_0x35431e[_0xb2f1('0x3e')]:_0x3acb0f[_0xb2f1('0x3b')];if(_0x55ef33[_0xb2f1('0x3c')][_0xb2f1('0x4b')]){_0x35431e['include']=[{'all':!![]}];}_0x35431e=_[_0xb2f1('0x49')]({},_0x35431e,_0x55ef33[_0xb2f1('0x50')]);return db[_0xb2f1('0x51')][_0xb2f1('0x52')](_0x35431e)[_0xb2f1('0x1a')](handleEntityNotFound(_0x15f94c,null))[_0xb2f1('0x1a')](respondWithResult(_0x15f94c,null))[_0xb2f1('0x22')](handleError(_0x15f94c,null));};exports[_0xb2f1('0x53')]=function(_0x3ff94f,_0x19191e){var _0x432c0c={'where':{'id':_0x3ff94f['params']['id']}},_0x1e240e={};_0x1e240e[_0xb2f1('0x3b')]=_[_0xb2f1('0x3d')](db[_0xb2f1('0x51')]['rawAttributes']);_0x432c0c[_0xb2f1('0x3e')]=_['intersection'](_0x1e240e[_0xb2f1('0x3b')],qs['fields'](_0x3ff94f[_0xb2f1('0x3c')][_0xb2f1('0x40')]));_0x432c0c['attributes']=_0x432c0c[_0xb2f1('0x3e')]['length']?_0x432c0c[_0xb2f1('0x3e')]:_0x1e240e[_0xb2f1('0x3b')];if(_0x3ff94f['query'][_0xb2f1('0x4b')]){_0x432c0c[_0xb2f1('0x54')]=[{'all':!![]}];}_0x432c0c=_[_0xb2f1('0x49')]({},_0x432c0c,_0x3ff94f[_0xb2f1('0x50')]);return db['Trunk'][_0xb2f1('0x52')](_0x432c0c)[_0xb2f1('0x1a')](handleEntityNotFound(_0x19191e,null))[_0xb2f1('0x1a')](function(_0x57efa6){if(_0x57efa6){var _0x3d3658=_0x57efa6[_0xb2f1('0x2f')]({'plain':!![]});_0x3d3658=qs['omit'](_0x3d3658,['id',_0xb2f1('0x55'),_0xb2f1('0x56')]);_0x3ff94f[_0xb2f1('0x57')]=_[_0xb2f1('0x58')](_0x3ff94f[_0xb2f1('0x57')],['id','createdAt',_0xb2f1('0x56')]);return db['Trunk'][_0xb2f1('0x59')](_[_0xb2f1('0x49')](_0x3d3658,_0x3ff94f[_0xb2f1('0x57')]),{'include':_0x3ff94f[_0xb2f1('0x3c')][_0xb2f1('0x4b')]?[{'all':!![]}]:undefined})[_0xb2f1('0x1a')](function(_0x5967e3){var _0x7dc585=_0x3ff94f['user'][_0xb2f1('0x2f')]({'plain':!![]});if(!_0x7dc585)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7dc585[_0xb2f1('0x5a')]==='user'){var _0x1ae55b=_0x5967e3['get']({'plain':!![]});var _0x2af65c=_0xb2f1('0x30');return db[_0xb2f1('0x5b')]['find']({'where':{'name':_0x2af65c,'userProfileId':_0x7dc585[_0xb2f1('0x5c')]},'raw':!![]})[_0xb2f1('0x1a')](function(_0x39f0f8){if(_0x39f0f8&&_0x39f0f8[_0xb2f1('0x5d')]===0x0){return db[_0xb2f1('0x31')][_0xb2f1('0x59')]({'name':_0x1ae55b[_0xb2f1('0x33')],'resourceId':_0x1ae55b['id'],'type':_0x39f0f8[_0xb2f1('0x33')],'sectionId':_0x39f0f8['id']},{})[_0xb2f1('0x1a')](function(){return _0x5967e3;});}else{return _0x5967e3;}})[_0xb2f1('0x22')](function(_0x4410b0){logger[_0xb2f1('0x21')](_0xb2f1('0x5e'),_0x4410b0);throw _0x4410b0;});}return _0x5967e3;});}})[_0xb2f1('0x1a')](respondWithResult(_0x19191e,0xc9))['catch'](handleError(_0x19191e,null));};exports[_0xb2f1('0x59')]=function(_0x1ff8d8,_0x4c92a4,_0x51cb6d){var _0x3e36aa;return db['Trunk'][_0xb2f1('0x59')](_0x1ff8d8[_0xb2f1('0x57')],{'raw':!![]})['then'](function(_0x265020){_0x3e36aa=_0x265020;return db[_0xb2f1('0x51')][_0xb2f1('0x4c')]({'raw':!![]});})[_0xb2f1('0x1a')](function(_0x3e7afd){var _0x2056b8=fs[_0xb2f1('0x5f')](path[_0xb2f1('0x60')](config[_0xb2f1('0x61')],_0xb2f1('0x62')),_0xb2f1('0x63'));var _0x42ce9e=fs[_0xb2f1('0x5f')](path[_0xb2f1('0x60')](config[_0xb2f1('0x61')],'server/files/templates/registry.ejs'),_0xb2f1('0x63'));var _0x5c1fb8=ejs[_0xb2f1('0x64')](_0x2056b8,{'trunks':_0x3e7afd||[]});fs[_0xb2f1('0x65')](_0xb2f1('0x66'),_0x5c1fb8);if(_0x3e36aa[_0xb2f1('0x67')]){var _0x1a9083=ejs[_0xb2f1('0x64')](_0x42ce9e,{'trunks':_0x3e7afd||[]});fs[_0xb2f1('0x65')](_0xb2f1('0x68'),_0x1a9083);}})[_0xb2f1('0x1a')](function(){return respondWithRpcPromise('Reload',_0xb2f1('0x59'),{'module':_0xb2f1('0x69')});})[_0xb2f1('0x1a')](function(){var _0x4676c3=_0x1ff8d8['user'][_0xb2f1('0x2f')]({'plain':!![]});if(!_0x4676c3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4676c3[_0xb2f1('0x5a')]===_0xb2f1('0x6a')){var _0x395f6b=_0x3e36aa[_0xb2f1('0x2f')]({'plain':!![]});return db[_0xb2f1('0x5b')][_0xb2f1('0x52')]({'where':{'name':_0xb2f1('0x30'),'userProfileId':_0x4676c3[_0xb2f1('0x5c')]},'raw':!![]})[_0xb2f1('0x1a')](function(_0x400c5f){if(_0x400c5f&&_0x400c5f[_0xb2f1('0x5d')]===0x0){return db[_0xb2f1('0x31')][_0xb2f1('0x59')]({'name':_0x395f6b[_0xb2f1('0x33')],'resourceId':_0x395f6b['id'],'type':_0x400c5f['name'],'sectionId':_0x400c5f['id']},{})[_0xb2f1('0x1a')](function(){return _0x3e36aa;});}else{return _0x3e36aa;}})[_0xb2f1('0x22')](function(_0x1b38a3){logger[_0xb2f1('0x21')](_0xb2f1('0x5e'),_0x1b38a3);throw _0x1b38a3;});}return _0x3e36aa;})['then'](respondWithResult(_0x4c92a4,0xc9))['catch'](handleError(_0x4c92a4,null));};exports[_0xb2f1('0x2e')]=function(_0x574d56,_0x4f5c50,_0x2415d2){var _0x2bf783;return db['Trunk'][_0xb2f1('0x52')]({'where':{'id':_0x574d56['params']['id']}})[_0xb2f1('0x1a')](handleEntityNotFound(_0x4f5c50,null))[_0xb2f1('0x1a')](saveUpdates(_0x574d56[_0xb2f1('0x57')],null))[_0xb2f1('0x1a')](function(_0xadca87){if(_0xadca87){_0x2bf783=_0xadca87;return db[_0xb2f1('0x51')][_0xb2f1('0x4c')]({'raw':!![]});}})[_0xb2f1('0x1a')](function(_0x248e82){if(_0x248e82){var _0x5b56bb=fs[_0xb2f1('0x5f')](path['join'](config['root'],_0xb2f1('0x62')),_0xb2f1('0x63'));var _0x4b4b74=fs[_0xb2f1('0x5f')](path['join'](config[_0xb2f1('0x61')],'server/files/templates/registry.ejs'),_0xb2f1('0x63'));var _0x375ca5=ejs[_0xb2f1('0x64')](_0x5b56bb,{'trunks':_0x248e82||[]});fs[_0xb2f1('0x65')](_0xb2f1('0x66'),_0x375ca5);var _0x10ac6e=ejs[_0xb2f1('0x64')](_0x4b4b74,{'trunks':_0x248e82||[]});fs[_0xb2f1('0x65')](_0xb2f1('0x68'),_0x10ac6e);return respondWithRpcPromise('Reload',_0xb2f1('0x2e'),{'module':_0xb2f1('0x69')});}return null;})[_0xb2f1('0x1a')](function(_0x46909a){if(_0x46909a){return _0x2bf783;}})[_0xb2f1('0x1a')](respondWithResult(_0x4f5c50,null))[_0xb2f1('0x22')](handleError(_0x4f5c50,null));};exports[_0xb2f1('0x6b')]=function(_0x41b270,_0x88d613,_0x45a603){var _0x3565de;return db[_0xb2f1('0x51')][_0xb2f1('0x52')]({'where':{'id':_0x41b270[_0xb2f1('0x4f')]['id']}})[_0xb2f1('0x1a')](handleEntityNotFound(_0x88d613,null))[_0xb2f1('0x1a')](removeEntity(_0x88d613,null))[_0xb2f1('0x1a')](function(){return db[_0xb2f1('0x51')]['findAll']({'raw':!![]});})['then'](function(_0x1ee6bc){var _0x14ffc0=fs['readFileSync'](path['join'](config[_0xb2f1('0x61')],_0xb2f1('0x62')),'utf8');var _0x179e39=fs[_0xb2f1('0x5f')](path[_0xb2f1('0x60')](config[_0xb2f1('0x61')],_0xb2f1('0x6c')),'utf8');var _0x5343a9=ejs[_0xb2f1('0x64')](_0x14ffc0,{'trunks':_0x1ee6bc});var _0x5681b1=ejs[_0xb2f1('0x64')](_0x179e39,{'trunks':_0x1ee6bc});fs[_0xb2f1('0x65')](_0xb2f1('0x66'),_0x5343a9);fs[_0xb2f1('0x65')](_0xb2f1('0x68'),_0x5681b1);return respondWithRpcPromise('Reload',_0xb2f1('0x6b'),{'module':'chan_sip.so'});})[_0xb2f1('0x22')](handleError(_0x88d613,null));}; \ No newline at end of file +var _0x98c6=['../../config/license/util','../../mysqldb','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','end','count','offset','limit','status','set','Content-Range','apply','reject','save','update','destroy','get','Trunks','UserProfileResource','stack','send','index','map','rawAttributes','type','key','model','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','Trunk','includeAll','include','findAll','rows','show','params','find','omit','createdAt','updatedAt','body','create','role','user','UserProfileSection','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','/etc/asterisk/sip_xcally_registers.conf','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','server/files/templates/registry.ejs','Reload','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment'];(function(_0x2e8de8,_0xac464e){var _0x4df88d=function(_0x405924){while(--_0x405924){_0x2e8de8['push'](_0x2e8de8['shift']());}};_0x4df88d(++_0xac464e);}(_0x98c6,0xc7));var _0x698c=function(_0x352521,_0x1e1113){_0x352521=_0x352521-0x0;var _0x64a222=_0x98c6[_0x352521];return _0x64a222;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x698c('0x0'));var rimraf=require(_0x698c('0x1'));var zipdir=require(_0x698c('0x2'));var jsonpatch=require(_0x698c('0x3'));var rp=require(_0x698c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x698c('0x5'));var sox=require('sox');var csv=require(_0x698c('0x6'));var ejs=require(_0x698c('0x7'));var fs=require('fs');var fs_extra=require(_0x698c('0x8'));var _=require(_0x698c('0x9'));var squel=require('squel');var crypto=require(_0x698c('0xa'));var jsforce=require(_0x698c('0xb'));var deskjs=require(_0x698c('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x698c('0xd'));var Redis=require(_0x698c('0xe'));var authService=require(_0x698c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x698c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x698c('0x11'));var config=require(_0x698c('0x12'));var licenseUtil=require(_0x698c('0x13'));var db=require(_0x698c('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x698c('0x15')][_0x698c('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x2c3c45,_0x5f0f16,_0x2f4099,_0x2a021a){return new BPromise(function(_0xcf6ea1,_0x4df191){var _0xa11a9d=_0x2a021a||client;return _0xa11a9d[_0x698c('0x17')](_0x2c3c45,_0x2f4099)[_0x698c('0x18')](function(_0xaf9495){logger[_0x698c('0x19')](_0x698c('0x1a'),_0x5f0f16,_0x698c('0x1b'));logger[_0x698c('0x1c')](_0x698c('0x1d'),_0x5f0f16,'request\x20sent',JSON[_0x698c('0x1e')](_0xaf9495));if(_0xaf9495['error']){if(_0xaf9495[_0x698c('0x1f')]['code']===0x1f4){logger['error'](_0x698c('0x1a'),_0x5f0f16,_0xaf9495[_0x698c('0x1f')][_0x698c('0x20')]);return _0x4df191(_0xaf9495[_0x698c('0x1f')][_0x698c('0x20')]);}logger[_0x698c('0x1f')]('Trunk,\x20%s,\x20%s',_0x5f0f16,_0xaf9495[_0x698c('0x1f')][_0x698c('0x20')]);return _0xcf6ea1(_0xaf9495['error'][_0x698c('0x20')]);}else{logger['info'](_0x698c('0x1a'),_0x5f0f16,_0x698c('0x1b'));_0xcf6ea1(_0xaf9495[_0x698c('0x21')]['message']);}})['catch'](function(_0x2d19a0){logger[_0x698c('0x1f')](_0x698c('0x1a'),_0x5f0f16,_0x2d19a0);_0x4df191(_0x2d19a0);});});}function respondWithStatusCode(_0x2ebd00,_0x59b646){_0x59b646=_0x59b646||0xcc;return function(_0x37df73){if(_0x37df73){return _0x2ebd00[_0x698c('0x22')](_0x59b646);}return _0x2ebd00['status'](_0x59b646)[_0x698c('0x23')]();};}function respondWithResult(_0x21c076,_0x40c75c){_0x40c75c=_0x40c75c||0xc8;return function(_0x53d8f6){if(_0x53d8f6){return _0x21c076['status'](_0x40c75c)['json'](_0x53d8f6);}};}function respondWithFilteredResult(_0x3f739e,_0x127f4d){return function(_0x2c24bf){if(_0x2c24bf){var _0xb6c49=_0x2c24bf[_0x698c('0x24')],_0x19c19b=_0x127f4d[_0x698c('0x25')],_0x5ae595=_0x127f4d['offset']+_0x127f4d[_0x698c('0x26')],_0x451281;if(_0x5ae595>=_0xb6c49){_0x5ae595=_0xb6c49;_0x451281=0xc8;}else{_0x451281=0xce;}_0x3f739e[_0x698c('0x27')](_0x451281);return _0x3f739e[_0x698c('0x28')](_0x698c('0x29'),_0x19c19b+'-'+_0x5ae595+'/'+_0xb6c49)['json'](_0x2c24bf);}return null;};}function patchUpdates(_0x55eaf0){return function(_0x28dd35){try{jsonpatch[_0x698c('0x2a')](_0x28dd35,_0x55eaf0,!![]);}catch(_0x3c1365){return BPromise[_0x698c('0x2b')](_0x3c1365);}return _0x28dd35[_0x698c('0x2c')]();};}function saveUpdates(_0x29428e,_0x3783e5){return function(_0x334a80){if(_0x334a80){return _0x334a80[_0x698c('0x2d')](_0x29428e)['then'](function(_0x559390){return _0x559390;});}return null;};}function removeEntity(_0x2c0d45,_0x858602){return function(_0x207cc4){if(_0x207cc4){return _0x207cc4[_0x698c('0x2e')]()[_0x698c('0x18')](function(){var _0x3d7be7=_0x207cc4[_0x698c('0x2f')]({'plain':!![]});var _0x25ed5c=_0x698c('0x30');return db[_0x698c('0x31')][_0x698c('0x2e')]({'where':{'type':_0x25ed5c,'resourceId':_0x3d7be7['id']}})['then'](function(){return _0x207cc4;});})['then'](function(){_0x2c0d45[_0x698c('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f9cf3,_0x1d9ce1){return function(_0x44a23a){if(!_0x44a23a){_0x1f9cf3[_0x698c('0x22')](0x194);}return _0x44a23a;};}function handleError(_0x5d69f2,_0x478b3c){_0x478b3c=_0x478b3c||0x1f4;return function(_0x2512bb){logger['error'](_0x2512bb[_0x698c('0x32')]);if(_0x2512bb['name']){delete _0x2512bb['name'];}_0x5d69f2[_0x698c('0x27')](_0x478b3c)[_0x698c('0x33')](_0x2512bb);};}exports[_0x698c('0x34')]=function(_0x586044,_0x2372c7){var _0x31c680={},_0x326498={},_0x13c1f3={'count':0x0,'rows':[]};var _0x9fff0f=_[_0x698c('0x35')](db['Trunk'][_0x698c('0x36')],function(_0x5dbfb6){return{'name':_0x5dbfb6['fieldName'],'type':_0x5dbfb6[_0x698c('0x37')][_0x698c('0x38')]};});_0x326498[_0x698c('0x39')]=_['map'](_0x9fff0f,_0x698c('0x3a'));_0x326498[_0x698c('0x3b')]=_[_0x698c('0x3c')](_0x586044['query']);_0x326498['filters']=_[_0x698c('0x3d')](_0x326498[_0x698c('0x39')],_0x326498[_0x698c('0x3b')]);_0x31c680['attributes']=_[_0x698c('0x3d')](_0x326498[_0x698c('0x39')],qs['fields'](_0x586044['query'][_0x698c('0x3e')]));_0x31c680[_0x698c('0x3f')]=_0x31c680[_0x698c('0x3f')][_0x698c('0x40')]?_0x31c680['attributes']:_0x326498[_0x698c('0x39')];if(!_0x586044[_0x698c('0x3b')][_0x698c('0x41')](_0x698c('0x42'))){_0x31c680['limit']=qs[_0x698c('0x26')](_0x586044[_0x698c('0x3b')]['limit']);_0x31c680['offset']=qs[_0x698c('0x25')](_0x586044[_0x698c('0x3b')][_0x698c('0x25')]);}_0x31c680[_0x698c('0x43')]=qs[_0x698c('0x44')](_0x586044[_0x698c('0x3b')][_0x698c('0x44')]);_0x31c680[_0x698c('0x45')]=qs['filters'](_[_0x698c('0x46')](_0x586044[_0x698c('0x3b')],_0x326498[_0x698c('0x47')]),_0x9fff0f);if(_0x586044[_0x698c('0x3b')][_0x698c('0x48')]){_0x31c680[_0x698c('0x45')]=_[_0x698c('0x49')](_0x31c680['where'],{'$or':_[_0x698c('0x35')](_0x9fff0f,function(_0x4ed8f9){if(_0x4ed8f9[_0x698c('0x37')]!==_0x698c('0x4a')){var _0x3a129a={};_0x3a129a[_0x4ed8f9[_0x698c('0x3a')]]={'$like':'%'+_0x586044['query'][_0x698c('0x48')]+'%'};return _0x3a129a;}})});}_0x31c680=_[_0x698c('0x49')]({},_0x31c680,_0x586044[_0x698c('0x4b')]);var _0x567a5b={'where':_0x31c680['where']};return db[_0x698c('0x4c')]['count'](_0x567a5b)[_0x698c('0x18')](function(_0x5b7199){_0x13c1f3[_0x698c('0x24')]=_0x5b7199;if(_0x586044['query'][_0x698c('0x4d')]){_0x31c680[_0x698c('0x4e')]=[{'all':!![]}];}return db[_0x698c('0x4c')][_0x698c('0x4f')](_0x31c680);})[_0x698c('0x18')](function(_0x2ca00d){_0x13c1f3[_0x698c('0x50')]=_0x2ca00d;return _0x13c1f3;})[_0x698c('0x18')](respondWithFilteredResult(_0x2372c7,_0x31c680))['catch'](handleError(_0x2372c7,null));};exports[_0x698c('0x51')]=function(_0x374e7f,_0x4d2aeb){var _0x509021={'raw':![],'where':{'id':_0x374e7f[_0x698c('0x52')]['id']}},_0x550b49={};_0x550b49[_0x698c('0x39')]=_['keys'](db[_0x698c('0x4c')]['rawAttributes']);_0x550b49[_0x698c('0x3b')]=_[_0x698c('0x3c')](_0x374e7f[_0x698c('0x3b')]);_0x550b49[_0x698c('0x47')]=_[_0x698c('0x3d')](_0x550b49['model'],_0x550b49[_0x698c('0x3b')]);_0x509021[_0x698c('0x3f')]=_[_0x698c('0x3d')](_0x550b49['model'],qs['fields'](_0x374e7f[_0x698c('0x3b')][_0x698c('0x3e')]));_0x509021[_0x698c('0x3f')]=_0x509021[_0x698c('0x3f')]['length']?_0x509021[_0x698c('0x3f')]:_0x550b49['model'];if(_0x374e7f['query']['includeAll']){_0x509021[_0x698c('0x4e')]=[{'all':!![]}];}_0x509021=_['merge']({},_0x509021,_0x374e7f[_0x698c('0x4b')]);return db[_0x698c('0x4c')][_0x698c('0x53')](_0x509021)[_0x698c('0x18')](handleEntityNotFound(_0x4d2aeb,null))[_0x698c('0x18')](respondWithResult(_0x4d2aeb,null))['catch'](handleError(_0x4d2aeb,null));};exports['clone']=function(_0x31896e,_0x10513f){var _0x2269f8={'where':{'id':_0x31896e[_0x698c('0x52')]['id']}},_0x1c560c={};_0x1c560c[_0x698c('0x39')]=_[_0x698c('0x3c')](db['Trunk'][_0x698c('0x36')]);_0x2269f8[_0x698c('0x3f')]=_['intersection'](_0x1c560c[_0x698c('0x39')],qs[_0x698c('0x3e')](_0x31896e[_0x698c('0x3b')][_0x698c('0x3e')]));_0x2269f8['attributes']=_0x2269f8[_0x698c('0x3f')][_0x698c('0x40')]?_0x2269f8[_0x698c('0x3f')]:_0x1c560c[_0x698c('0x39')];if(_0x31896e[_0x698c('0x3b')][_0x698c('0x4d')]){_0x2269f8[_0x698c('0x4e')]=[{'all':!![]}];}_0x2269f8=_[_0x698c('0x49')]({},_0x2269f8,_0x31896e[_0x698c('0x4b')]);return db[_0x698c('0x4c')][_0x698c('0x53')](_0x2269f8)[_0x698c('0x18')](handleEntityNotFound(_0x10513f,null))[_0x698c('0x18')](function(_0x54528e){if(_0x54528e){var _0x15003e=_0x54528e[_0x698c('0x2f')]({'plain':!![]});_0x15003e=qs[_0x698c('0x54')](_0x15003e,['id',_0x698c('0x55'),_0x698c('0x56')]);_0x31896e[_0x698c('0x57')]=_[_0x698c('0x54')](_0x31896e[_0x698c('0x57')],['id',_0x698c('0x55'),'updatedAt']);return db[_0x698c('0x4c')][_0x698c('0x58')](_[_0x698c('0x49')](_0x15003e,_0x31896e[_0x698c('0x57')]),{'include':_0x31896e[_0x698c('0x3b')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x4db4b4){var _0x577408=_0x31896e['user'][_0x698c('0x2f')]({'plain':!![]});if(!_0x577408)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x577408[_0x698c('0x59')]===_0x698c('0x5a')){var _0x59ca15=_0x4db4b4['get']({'plain':!![]});var _0x52cc96=_0x698c('0x30');return db[_0x698c('0x5b')]['find']({'where':{'name':_0x52cc96,'userProfileId':_0x577408['userProfileId']},'raw':!![]})[_0x698c('0x18')](function(_0x31530a){if(_0x31530a&&_0x31530a['autoAssociation']===0x0){return db[_0x698c('0x31')][_0x698c('0x58')]({'name':_0x59ca15[_0x698c('0x3a')],'resourceId':_0x59ca15['id'],'type':_0x31530a[_0x698c('0x3a')],'sectionId':_0x31530a['id']},{})['then'](function(){return _0x4db4b4;});}else{return _0x4db4b4;}})[_0x698c('0x5c')](function(_0x5beac9){logger[_0x698c('0x1f')](_0x698c('0x5d'),_0x5beac9);throw _0x5beac9;});}return _0x4db4b4;});}})[_0x698c('0x18')](respondWithResult(_0x10513f,0xc9))['catch'](handleError(_0x10513f,null));};exports['create']=function(_0x33add5,_0x30cac7,_0x41f2f6){var _0x200d5b;return db[_0x698c('0x4c')]['create'](_0x33add5[_0x698c('0x57')],{'raw':!![]})[_0x698c('0x18')](function(_0x44d5ef){_0x200d5b=_0x44d5ef;return db[_0x698c('0x4c')]['findAll']({'raw':!![]});})[_0x698c('0x18')](function(_0x105841){var _0x250a05=fs[_0x698c('0x5e')](path[_0x698c('0x5f')](config[_0x698c('0x60')],_0x698c('0x61')),'utf8');var _0x44288d=fs[_0x698c('0x5e')](path[_0x698c('0x5f')](config[_0x698c('0x60')],'server/files/templates/registry.ejs'),_0x698c('0x62'));var _0x459440=ejs[_0x698c('0x63')](_0x250a05,{'trunks':_0x105841||[]});fs[_0x698c('0x64')](_0x698c('0x65'),_0x459440);if(_0x200d5b['registry']){var _0x2b40b5=ejs[_0x698c('0x63')](_0x44288d,{'trunks':_0x105841||[]});fs['writeFileSync'](_0x698c('0x66'),_0x2b40b5);}})[_0x698c('0x18')](function(){return respondWithRpcPromise('Reload',_0x698c('0x58'),{'module':'chan_sip.so'});})[_0x698c('0x18')](function(){var _0x427c1c=_0x33add5['user']['get']({'plain':!![]});if(!_0x427c1c)throw new Error(_0x698c('0x67'));if(_0x427c1c[_0x698c('0x59')]===_0x698c('0x5a')){var _0x12f515=_0x200d5b[_0x698c('0x2f')]({'plain':!![]});return db[_0x698c('0x5b')][_0x698c('0x53')]({'where':{'name':_0x698c('0x30'),'userProfileId':_0x427c1c[_0x698c('0x68')]},'raw':!![]})[_0x698c('0x18')](function(_0x5bf9e4){if(_0x5bf9e4&&_0x5bf9e4[_0x698c('0x69')]===0x0){return db[_0x698c('0x31')][_0x698c('0x58')]({'name':_0x12f515[_0x698c('0x3a')],'resourceId':_0x12f515['id'],'type':_0x5bf9e4['name'],'sectionId':_0x5bf9e4['id']},{})[_0x698c('0x18')](function(){return _0x200d5b;});}else{return _0x200d5b;}})[_0x698c('0x5c')](function(_0x372040){logger['error'](_0x698c('0x5d'),_0x372040);throw _0x372040;});}return _0x200d5b;})[_0x698c('0x18')](respondWithResult(_0x30cac7,0xc9))[_0x698c('0x5c')](handleError(_0x30cac7,null));};exports[_0x698c('0x2d')]=function(_0x3e2a15,_0x328bc6,_0x28e1d7){var _0x38efcc;return db['Trunk']['find']({'where':{'id':_0x3e2a15['params']['id']}})[_0x698c('0x18')](handleEntityNotFound(_0x328bc6,null))[_0x698c('0x18')](saveUpdates(_0x3e2a15[_0x698c('0x57')],null))[_0x698c('0x18')](function(_0x512b9a){if(_0x512b9a){_0x38efcc=_0x512b9a;return db['Trunk']['findAll']({'raw':!![]});}})[_0x698c('0x18')](function(_0x259d45){if(_0x259d45){var _0x5bc7c3=fs[_0x698c('0x5e')](path[_0x698c('0x5f')](config[_0x698c('0x60')],'server/files/templates/trunk.ejs'),'utf8');var _0x2ba167=fs[_0x698c('0x5e')](path[_0x698c('0x5f')](config[_0x698c('0x60')],_0x698c('0x6a')),_0x698c('0x62'));var _0x1ec0ba=ejs[_0x698c('0x63')](_0x5bc7c3,{'trunks':_0x259d45||[]});fs[_0x698c('0x64')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1ec0ba);var _0x1cce58=ejs[_0x698c('0x63')](_0x2ba167,{'trunks':_0x259d45||[]});fs[_0x698c('0x64')]('/etc/asterisk/sip_xcally_registers.conf',_0x1cce58);return respondWithRpcPromise(_0x698c('0x6b'),_0x698c('0x2d'),{'module':'chan_sip.so'});}return null;})[_0x698c('0x18')](function(_0x231889){if(_0x231889){return _0x38efcc;}})[_0x698c('0x18')](respondWithResult(_0x328bc6,null))[_0x698c('0x5c')](handleError(_0x328bc6,null));};exports[_0x698c('0x2e')]=function(_0x484441,_0x38b97e,_0x514401){var _0xbf2894;return db[_0x698c('0x4c')][_0x698c('0x53')]({'where':{'id':_0x484441[_0x698c('0x52')]['id']}})[_0x698c('0x18')](handleEntityNotFound(_0x38b97e,null))[_0x698c('0x18')](removeEntity(_0x38b97e,null))[_0x698c('0x18')](function(){return db[_0x698c('0x4c')][_0x698c('0x4f')]({'raw':!![]});})[_0x698c('0x18')](function(_0x2f8128){var _0x48fb03=fs[_0x698c('0x5e')](path[_0x698c('0x5f')](config[_0x698c('0x60')],_0x698c('0x61')),_0x698c('0x62'));var _0x235fa8=fs['readFileSync'](path[_0x698c('0x5f')](config['root'],_0x698c('0x6a')),_0x698c('0x62'));var _0x2aaaa8=ejs[_0x698c('0x63')](_0x48fb03,{'trunks':_0x2f8128});var _0x25392d=ejs[_0x698c('0x63')](_0x235fa8,{'trunks':_0x2f8128});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x2aaaa8);fs[_0x698c('0x64')](_0x698c('0x66'),_0x25392d);return respondWithRpcPromise('Reload',_0x698c('0x2e'),{'module':_0x698c('0x6c')});})[_0x698c('0x5c')](handleError(_0x38b97e,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 2b42f5d..4eb01f8 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 _0x26a8=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash'];(function(_0x16a71c,_0x1b2cd5){var _0xfb1a17=function(_0x984b28){while(--_0x984b28){_0x16a71c['push'](_0x16a71c['shift']());}};_0xfb1a17(++_0x1b2cd5);}(_0x26a8,0x6f));var _0x826a=function(_0x1005f8,_0x520b7a){_0x1005f8=_0x1005f8-0x0;var _0x12ab86=_0x26a8[_0x1005f8];return _0x12ab86;};'use strict';var _=require(_0x826a('0x0'));var util=require(_0x826a('0x1'));var logger=require(_0x826a('0x2'))(_0x826a('0x3'));var moment=require(_0x826a('0x4'));var BPromise=require(_0x826a('0x5'));var rp=require(_0x826a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x826a('0x7'));var config=require(_0x826a('0x8'));var attributes=require(_0x826a('0x9'));module[_0x826a('0xa')]=function(_0x8e9576,_0x204946){return _0x8e9576[_0x826a('0xb')](_0x826a('0xc'),attributes,{'tableName':_0x826a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfec6=['moment','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','api'];(function(_0x4501c5,_0x49524d){var _0x3d8e45=function(_0x3290da){while(--_0x3290da){_0x4501c5['push'](_0x4501c5['shift']());}};_0x3d8e45(++_0x49524d);}(_0xfec6,0x99));var _0x6fec=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xfec6[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x6fec('0x0'));var util=require(_0x6fec('0x1'));var logger=require('../../config/logger')(_0x6fec('0x2'));var moment=require(_0x6fec('0x3'));var BPromise=require('bluebird');var rp=require(_0x6fec('0x4'));var fs=require('fs');var path=require(_0x6fec('0x5'));var rimraf=require(_0x6fec('0x6'));var config=require(_0x6fec('0x7'));var attributes=require(_0x6fec('0x8'));module[_0x6fec('0x9')]=function(_0x5abb01,_0x4bbe3d){return _0x5abb01[_0x6fec('0xa')](_0x6fec('0xb'),attributes,{'tableName':_0x6fec('0xc'),'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 33a6df9..02ea0c6 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 _0x5f66=['debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','GetTrunk','findAll','options','attributes','limit','include','model','map','ShowTrunk','Trunk','raw','where','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','Trunk,\x20%s,\x20%s','request\x20sent'];(function(_0x3edc97,_0x2b8842){var _0x556058=function(_0x976e6f){while(--_0x976e6f){_0x3edc97['push'](_0x3edc97['shift']());}};_0x556058(++_0x2b8842);}(_0x5f66,0x1a0));var _0x65f6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5f66[_0x138adb];return _0x1b27f2;};'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')]('Trunk,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});}exports[_0x65f6('0x15')]=function(_0x1f974c){var _0xc8660c=this;return new Promise(function(_0x18380e,_0x495dd6){return db['Trunk'][_0x65f6('0x16')]({'raw':_0x1f974c['options']?_0x1f974c['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')]['where']||null:null,'attributes':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')][_0x65f6('0x18')]||null:null,'limit':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')][_0x65f6('0x19')]||null:null,'include':_0x1f974c['options']?_0x1f974c[_0x65f6('0x17')]['include']?_['map'](_0x1f974c[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x524e42){return{'model':db[_0x524e42[_0x65f6('0x1b')]],'as':_0x524e42['as'],'attributes':_0x524e42[_0x65f6('0x18')],'include':_0x524e42[_0x65f6('0x1a')]?_[_0x65f6('0x1c')](_0x524e42['include'],function(_0x9d7bb0){return{'model':db[_0x9d7bb0[_0x65f6('0x1b')]],'as':_0x9d7bb0['as'],'attributes':_0x9d7bb0[_0x65f6('0x18')],'include':_0x9d7bb0['include']?_['map'](_0x9d7bb0['include'],function(_0x29abdb){return{'model':db[_0x29abdb[_0x65f6('0x1b')]],'as':_0x29abdb['as'],'attributes':_0x29abdb['attributes']};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x28f710){logger['info'](_0x65f6('0x15'),_0x1f974c);logger[_0x65f6('0xd')](_0x65f6('0x15'),_0x1f974c,JSON['stringify'](_0x28f710));_0x18380e(_0x28f710);})['catch'](function(_0x488d36){logger[_0x65f6('0x12')](_0x65f6('0x15'),_0x488d36[_0x65f6('0x11')],_0x1f974c);_0x495dd6(_0xc8660c[_0x65f6('0x12')](0x1f4,_0x488d36[_0x65f6('0x11')]));});});};exports[_0x65f6('0x1d')]=function(_0x144e55){var _0x4ace4c=this;return new Promise(function(_0x4ea23d,_0x154cbd){return db[_0x65f6('0x1e')]['find']({'raw':_0x144e55['options']?_0x144e55[_0x65f6('0x17')][_0x65f6('0x1f')]===undefined?!![]:![]:!![],'where':_0x144e55[_0x65f6('0x17')]?_0x144e55[_0x65f6('0x17')][_0x65f6('0x20')]||null:null,'attributes':_0x144e55[_0x65f6('0x17')]?_0x144e55['options'][_0x65f6('0x18')]||null:null,'include':_0x144e55[_0x65f6('0x17')]?_0x144e55[_0x65f6('0x17')]['include']?_[_0x65f6('0x1c')](_0x144e55[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x45510a){return{'model':db[_0x45510a[_0x65f6('0x1b')]],'as':_0x45510a['as'],'attributes':_0x45510a[_0x65f6('0x18')],'include':_0x45510a['include']?_[_0x65f6('0x1c')](_0x45510a[_0x65f6('0x1a')],function(_0x4f3e22){return{'model':db[_0x4f3e22[_0x65f6('0x1b')]],'as':_0x4f3e22['as'],'attributes':_0x4f3e22['attributes'],'include':_0x4f3e22[_0x65f6('0x1a')]?_['map'](_0x4f3e22[_0x65f6('0x1a')],function(_0x24f7fd){return{'model':db[_0x24f7fd['model']],'as':_0x24f7fd['as'],'attributes':_0x24f7fd[_0x65f6('0x18')]};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x3b261d){logger['info']('ShowTrunk',_0x144e55);logger[_0x65f6('0xd')]('ShowTrunk',_0x144e55,JSON[_0x65f6('0xf')](_0x3b261d));_0x4ea23d(_0x3b261d);})['catch'](function(_0x22d760){logger[_0x65f6('0x12')]('ShowTrunk',_0x22d760[_0x65f6('0x11')],_0x144e55);_0x154cbd(_0x4ace4c['error'](0x1f4,_0x22d760['message']));});});}; \ No newline at end of file +var _0x1a85=['info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk','Trunk','options','raw','where','limit','include','model','map','attributes','then','ShowTrunk','find','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x1a85,0x178));var _0x51a8=function(_0x3e9155,_0x38e9d2){_0x3e9155=_0x3e9155-0x0;var _0x5de67a=_0x1a85[_0x3e9155];return _0x5de67a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('Trunk,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});}exports[_0x51a8('0x13')]=function(_0x45a433){var _0xd52230=this;return new Promise(function(_0x23539e,_0x3bc1a2){return db[_0x51a8('0x14')]['findAll']({'raw':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x16')]===undefined?!![]:![]:!![],'where':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x17')]||null:null,'attributes':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')]['attributes']||null:null,'limit':_0x45a433[_0x51a8('0x15')]?_0x45a433['options'][_0x51a8('0x18')]||null:null,'include':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x19')]?_['map'](_0x45a433[_0x51a8('0x15')]['include'],function(_0x47f063){return{'model':db[_0x47f063[_0x51a8('0x1a')]],'as':_0x47f063['as'],'attributes':_0x47f063['attributes'],'include':_0x47f063[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x47f063[_0x51a8('0x19')],function(_0x18e2f3){return{'model':db[_0x18e2f3[_0x51a8('0x1a')]],'as':_0x18e2f3['as'],'attributes':_0x18e2f3[_0x51a8('0x1c')],'include':_0x18e2f3[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x18e2f3['include'],function(_0x273ce2){return{'model':db[_0x273ce2[_0x51a8('0x1a')]],'as':_0x273ce2['as'],'attributes':_0x273ce2[_0x51a8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x51a8('0x1d')](function(_0x1c150d){logger[_0x51a8('0x8')](_0x51a8('0x13'),_0x45a433);logger[_0x51a8('0xb')](_0x51a8('0x13'),_0x45a433,JSON[_0x51a8('0xd')](_0x1c150d));_0x23539e(_0x1c150d);})[_0x51a8('0x12')](function(_0x347a02){logger['error'](_0x51a8('0x13'),_0x347a02['message'],_0x45a433);_0x3bc1a2(_0xd52230[_0x51a8('0xe')](0x1f4,_0x347a02[_0x51a8('0x10')]));});});};exports[_0x51a8('0x1e')]=function(_0x41df56){var _0x2136b4=this;return new Promise(function(_0x4ea271,_0x10c19b){return db['Trunk'][_0x51a8('0x1f')]({'raw':_0x41df56[_0x51a8('0x15')]?_0x41df56[_0x51a8('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x41df56[_0x51a8('0x15')]?_0x41df56['options'][_0x51a8('0x17')]||null:null,'attributes':_0x41df56[_0x51a8('0x15')]?_0x41df56[_0x51a8('0x15')][_0x51a8('0x1c')]||null:null,'include':_0x41df56[_0x51a8('0x15')]?_0x41df56['options'][_0x51a8('0x19')]?_['map'](_0x41df56[_0x51a8('0x15')][_0x51a8('0x19')],function(_0x41561a){return{'model':db[_0x41561a['model']],'as':_0x41561a['as'],'attributes':_0x41561a[_0x51a8('0x1c')],'include':_0x41561a[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x41561a[_0x51a8('0x19')],function(_0x41c020){return{'model':db[_0x41c020['model']],'as':_0x41c020['as'],'attributes':_0x41c020['attributes'],'include':_0x41c020['include']?_[_0x51a8('0x1b')](_0x41c020[_0x51a8('0x19')],function(_0x4ec1db){return{'model':db[_0x4ec1db[_0x51a8('0x1a')]],'as':_0x4ec1db['as'],'attributes':_0x4ec1db['attributes']};}):[]};}):[]};}):[]:[]})[_0x51a8('0x1d')](function(_0x38aa25){logger[_0x51a8('0x8')](_0x51a8('0x1e'),_0x41df56);logger[_0x51a8('0xb')](_0x51a8('0x1e'),_0x41df56,JSON['stringify'](_0x38aa25));_0x4ea271(_0x38aa25);})['catch'](function(_0x377b4c){logger['error']('ShowTrunk',_0x377b4c['message'],_0x41df56);_0x10c19b(_0x2136b4[_0x51a8('0xe')](0x1f4,_0x377b4c[_0x51a8('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index af32e91..440dce5 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 _0xedb4=['removeSmsAccounts','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','/presence','getPresence','/:id','show','/:id/avatar','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','addContacts','create','/create_many','bulkCreate','/:id/queues','diskStorage','join','root','server/files/images/','format','now','single','file','addAvatar','/:id/login','logout','/:id/pause','/:id/unpause','unpause','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addSquareProjects','put','update','/:id/password','delete','removeQueues','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts'];(function(_0x432ce7,_0x52df97){var _0x437b88=function(_0x46a030){while(--_0x46a030){_0x432ce7['push'](_0x432ce7['shift']());}};_0x437b88(++_0x52df97);}(_0xedb4,0x15b));var _0x4edb=function(_0x57cb4f,_0x541f57){_0x57cb4f=_0x57cb4f-0x0;var _0x29bb45=_0xedb4[_0x57cb4f];return _0x29bb45;};'use strict';var multer=require(_0x4edb('0x0'));var util=require(_0x4edb('0x1'));var path=require('path');var timeout=require(_0x4edb('0x2'));var express=require('express');var router=express[_0x4edb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4edb('0x4'));var interaction=require(_0x4edb('0x5'));var config=require(_0x4edb('0x6'));var controller=require(_0x4edb('0x7'));router[_0x4edb('0x8')]('/',auth[_0x4edb('0x9')](),controller[_0x4edb('0xa')]);router[_0x4edb('0x8')](_0x4edb('0xb'),auth['isAuthenticated'](),controller[_0x4edb('0xc')]);router[_0x4edb('0x8')](_0x4edb('0xd'),auth['isAuthenticated'](),controller['whoami']);router['get'](_0x4edb('0xe'),auth['isAuthenticated'](),controller[_0x4edb('0xf')]);router[_0x4edb('0x8')](_0x4edb('0x10'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x11')]);router['get'](_0x4edb('0x12'),controller['getAvatar']);router['get'](_0x4edb('0x13'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x14')]);router[_0x4edb('0x8')]('/:id/queues',auth[_0x4edb('0x9')](),controller[_0x4edb('0x15')]);router[_0x4edb('0x8')](_0x4edb('0x16'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x17')]);router[_0x4edb('0x8')](_0x4edb('0x18'),auth['isAuthenticated'](),controller[_0x4edb('0x19')]);router[_0x4edb('0x8')](_0x4edb('0x1a'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x1b')]);router['get']('/:id/screen_recordings',auth['isAuthenticated'](),controller[_0x4edb('0x1c')]);router[_0x4edb('0x8')](_0x4edb('0x1d'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x1e')]);router[_0x4edb('0x8')](_0x4edb('0x1f'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x20')]);router['get'](_0x4edb('0x21'),auth['isAuthenticated'](),controller[_0x4edb('0x22')]);router[_0x4edb('0x8')](_0x4edb('0x23'),auth[_0x4edb('0x9')](),controller['getSmsInteractions']);router[_0x4edb('0x8')](_0x4edb('0x24'),auth[_0x4edb('0x9')](),controller['getFaxInteractions']);router['get'](_0x4edb('0x25'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x26')]);router[_0x4edb('0x8')](_0x4edb('0x27'),auth[_0x4edb('0x9')](),controller['getTeams']);router[_0x4edb('0x8')]('/:id/lists',auth['isAuthenticated'](),controller['getLists']);router[_0x4edb('0x8')](_0x4edb('0x28'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x29')]);router[_0x4edb('0x8')]('/:id/prefixes',auth['isAuthenticated'](),controller[_0x4edb('0x2a')]);router[_0x4edb('0x8')](_0x4edb('0x2b'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x2c')]);router[_0x4edb('0x8')]('/:id/mail_accounts',auth[_0x4edb('0x9')](),controller[_0x4edb('0x2d')]);router[_0x4edb('0x8')](_0x4edb('0x2e'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x2f')]);router[_0x4edb('0x8')](_0x4edb('0x30'),auth['isAuthenticated'](),controller[_0x4edb('0x31')]);router[_0x4edb('0x8')](_0x4edb('0x32'),auth[_0x4edb('0x9')](),controller['getChatWebsites']);router[_0x4edb('0x8')](_0x4edb('0x33'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x34')]);router['get'](_0x4edb('0x35'),auth[_0x4edb('0x9')](),controller['getSquareProjects']);router[_0x4edb('0x8')](_0x4edb('0x36'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x37')]);router[_0x4edb('0x8')](_0x4edb('0x38'),auth[_0x4edb('0x9')](),controller['getApiKey']);router[_0x4edb('0x39')](_0x4edb('0x13'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x3a')]);router[_0x4edb('0x39')]('/',auth[_0x4edb('0x9')](),controller[_0x4edb('0x3b')]);router[_0x4edb('0x39')](_0x4edb('0x3c'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x3d')]);router[_0x4edb('0x39')](_0x4edb('0x3e'),auth[_0x4edb('0x9')](),controller['addQueues']);var upload=multer({'storage':multer[_0x4edb('0x3f')]({'destination':function(_0x3c0f6f,_0xab1e12,_0x56c6b8){_0x56c6b8(null,path[_0x4edb('0x40')](config[_0x4edb('0x41')],_0x4edb('0x42')));},'filename':function(_0x4d810b,_0x3df512,_0x29f02e){_0x29f02e(null,util[_0x4edb('0x43')]('%s-%s',Date[_0x4edb('0x44')](),_0x3df512['originalname']));}})});router[_0x4edb('0x39')](_0x4edb('0x12'),upload[_0x4edb('0x45')](_0x4edb('0x46')),controller[_0x4edb('0x47')]);router[_0x4edb('0x39')](_0x4edb('0x48'),auth[_0x4edb('0x9')](),controller['login']);router[_0x4edb('0x39')]('/:id/logout',auth[_0x4edb('0x9')](),controller[_0x4edb('0x49')]);router[_0x4edb('0x39')](_0x4edb('0x4a'),auth[_0x4edb('0x9')](),controller['pause']);router['post'](_0x4edb('0x4b'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x4c')]);router[_0x4edb('0x39')]('/:id/teams',auth[_0x4edb('0x9')](),controller['addTeams']);router['post'](_0x4edb('0x4d'),auth['isAuthenticated'](),controller['addChatInteractions']);router[_0x4edb('0x39')](_0x4edb('0x4e'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x4f')]);router['post'](_0x4edb('0x50'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x51')]);router[_0x4edb('0x39')](_0x4edb('0x52'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x53')]);router[_0x4edb('0x39')]('/:id/openchannel_interactions',auth[_0x4edb('0x9')](),controller[_0x4edb('0x54')]);router[_0x4edb('0x39')]('/:id/whatsapp_interactions',auth[_0x4edb('0x9')](),controller[_0x4edb('0x55')]);router['post'](_0x4edb('0x2b'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x56')]);router['post'](_0x4edb('0x57'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x58')]);router[_0x4edb('0x39')](_0x4edb('0x2e'),auth['isAuthenticated'](),controller[_0x4edb('0x59')]);router[_0x4edb('0x39')]('/:id/sms_accounts',auth[_0x4edb('0x9')](),controller[_0x4edb('0x5a')]);router[_0x4edb('0x39')](_0x4edb('0x32'),auth['isAuthenticated'](),controller[_0x4edb('0x5b')]);router[_0x4edb('0x39')](_0x4edb('0x33'),auth['isAuthenticated'](),controller['addWhatsappAccounts']);router[_0x4edb('0x39')](_0x4edb('0x35'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x5c')]);router[_0x4edb('0x39')](_0x4edb('0x38'),auth[_0x4edb('0x9')](),controller['createApiKey']);router[_0x4edb('0x5d')](_0x4edb('0x10'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x5e')]);router[_0x4edb('0x5d')](_0x4edb('0x5f'),auth[_0x4edb('0x9')](),controller['changePassword']);router[_0x4edb('0x60')](_0x4edb('0x3e'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x61')]);router['delete'](_0x4edb('0x27'),auth[_0x4edb('0x9')](),controller['removeTeams']);router[_0x4edb('0x60')](_0x4edb('0x10'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x62')]);router['delete'](_0x4edb('0x4d'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x63')]);router[_0x4edb('0x60')](_0x4edb('0x4e'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x64')]);router[_0x4edb('0x60')](_0x4edb('0x50'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x65')]);router['delete'](_0x4edb('0x52'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x66')]);router[_0x4edb('0x60')](_0x4edb('0x67'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x68')]);router[_0x4edb('0x60')](_0x4edb('0x69'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x6a')]);router[_0x4edb('0x60')]('/:id/fax_accounts',auth['isAuthenticated'](),controller['removeFaxAccounts']);router['delete'](_0x4edb('0x57'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x6b')]);router[_0x4edb('0x60')](_0x4edb('0x2e'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x6c')]);router['delete']('/:id/sms_accounts',auth[_0x4edb('0x9')](),controller[_0x4edb('0x6d')]);router[_0x4edb('0x60')](_0x4edb('0x32'),auth[_0x4edb('0x9')](),controller['removeChatWebsites']);router[_0x4edb('0x60')]('/:id/whatsapp_accounts',auth[_0x4edb('0x9')](),controller[_0x4edb('0x6e')]);router[_0x4edb('0x60')](_0x4edb('0x35'),auth[_0x4edb('0x9')](),controller[_0x4edb('0x6f')]);router[_0x4edb('0x60')](_0x4edb('0x38'),auth['isAuthenticated'](),controller[_0x4edb('0x70')]);module[_0x4edb('0x71')]=router; \ No newline at end of file +var _0x2036=['/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','post','addContacts','create','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/fax_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addOpenchannelAccounts','addSquareProjects','createApiKey','update','put','/:id/password','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','describe','/whoami','whoami','/presence','getPresence','/:id','/:id/avatar','getAvatar','/:id/contacts','getContacts','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0x2036,0x11e));var _0x6203=function(_0x7a0eb6,_0x81f990){_0x7a0eb6=_0x7a0eb6-0x0;var _0x2a720a=_0x2036[_0x7a0eb6];return _0x2a720a;};'use strict';var multer=require(_0x6203('0x0'));var util=require('util');var path=require(_0x6203('0x1'));var timeout=require(_0x6203('0x2'));var express=require(_0x6203('0x3'));var router=express[_0x6203('0x4')]();var fs_extra=require(_0x6203('0x5'));var auth=require(_0x6203('0x6'));var interaction=require(_0x6203('0x7'));var config=require(_0x6203('0x8'));var controller=require(_0x6203('0x9'));router[_0x6203('0xa')]('/',auth[_0x6203('0xb')](),controller[_0x6203('0xc')]);router[_0x6203('0xa')]('/describe',auth[_0x6203('0xb')](),controller[_0x6203('0xd')]);router[_0x6203('0xa')](_0x6203('0xe'),auth[_0x6203('0xb')](),controller[_0x6203('0xf')]);router[_0x6203('0xa')](_0x6203('0x10'),auth['isAuthenticated'](),controller[_0x6203('0x11')]);router[_0x6203('0xa')](_0x6203('0x12'),auth['isAuthenticated'](),controller['show']);router['get'](_0x6203('0x13'),controller[_0x6203('0x14')]);router[_0x6203('0xa')](_0x6203('0x15'),auth['isAuthenticated'](),controller[_0x6203('0x16')]);router[_0x6203('0xa')]('/:id/queues',auth[_0x6203('0xb')](),controller['getQueues']);router[_0x6203('0xa')]('/:id/queues_rt',auth[_0x6203('0xb')](),controller[_0x6203('0x17')]);router[_0x6203('0xa')](_0x6203('0x18'),auth['isAuthenticated'](),controller['getGroups']);router[_0x6203('0xa')](_0x6203('0x19'),auth[_0x6203('0xb')](),controller[_0x6203('0x1a')]);router[_0x6203('0xa')](_0x6203('0x1b'),auth[_0x6203('0xb')](),controller[_0x6203('0x1c')]);router[_0x6203('0xa')](_0x6203('0x1d'),auth[_0x6203('0xb')](),controller[_0x6203('0x1e')]);router['get']('/:id/openchannel/interactions',auth[_0x6203('0xb')](),controller[_0x6203('0x1f')]);router[_0x6203('0xa')](_0x6203('0x20'),auth[_0x6203('0xb')](),controller[_0x6203('0x21')]);router[_0x6203('0xa')](_0x6203('0x22'),auth[_0x6203('0xb')](),controller[_0x6203('0x23')]);router[_0x6203('0xa')](_0x6203('0x24'),auth['isAuthenticated'](),controller['getFaxInteractions']);router[_0x6203('0xa')](_0x6203('0x25'),auth['isAuthenticated'](),controller[_0x6203('0x26')]);router[_0x6203('0xa')](_0x6203('0x27'),auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x6203('0x28'),auth[_0x6203('0xb')](),controller[_0x6203('0x29')]);router[_0x6203('0xa')](_0x6203('0x2a'),auth['isAuthenticated'](),controller[_0x6203('0x2b')]);router[_0x6203('0xa')](_0x6203('0x2c'),auth[_0x6203('0xb')](),controller[_0x6203('0x2d')]);router['get'](_0x6203('0x2e'),auth['isAuthenticated'](),controller[_0x6203('0x2f')]);router[_0x6203('0xa')](_0x6203('0x30'),auth['isAuthenticated'](),controller[_0x6203('0x31')]);router[_0x6203('0xa')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router[_0x6203('0xa')](_0x6203('0x32'),auth[_0x6203('0xb')](),controller[_0x6203('0x33')]);router[_0x6203('0xa')](_0x6203('0x34'),auth[_0x6203('0xb')](),controller[_0x6203('0x35')]);router[_0x6203('0xa')](_0x6203('0x36'),auth[_0x6203('0xb')](),controller[_0x6203('0x37')]);router[_0x6203('0xa')](_0x6203('0x38'),auth[_0x6203('0xb')](),controller[_0x6203('0x39')]);router[_0x6203('0xa')]('/:id/scheduled_calls',auth[_0x6203('0xb')](),controller[_0x6203('0x3a')]);router[_0x6203('0xa')](_0x6203('0x3b'),auth[_0x6203('0xb')](),controller['getApiKey']);router[_0x6203('0x3c')]('/:id/contacts',auth[_0x6203('0xb')](),controller[_0x6203('0x3d')]);router['post']('/',auth[_0x6203('0xb')](),controller[_0x6203('0x3e')]);router['post']('/create_many',auth[_0x6203('0xb')](),controller[_0x6203('0x3f')]);router[_0x6203('0x3c')]('/:id/queues',auth[_0x6203('0xb')](),controller[_0x6203('0x40')]);var upload=multer({'storage':multer[_0x6203('0x41')]({'destination':function(_0x28d05b,_0x40a19e,_0x392b8d){_0x392b8d(null,path[_0x6203('0x42')](config[_0x6203('0x43')],_0x6203('0x44')));},'filename':function(_0x59dc9f,_0x4c99c1,_0xa86a38){_0xa86a38(null,util[_0x6203('0x45')](_0x6203('0x46'),Date[_0x6203('0x47')](),_0x4c99c1[_0x6203('0x48')]));}})});router['post']('/:id/avatar',upload[_0x6203('0x49')](_0x6203('0x4a')),controller['addAvatar']);router[_0x6203('0x3c')](_0x6203('0x4b'),auth[_0x6203('0xb')](),controller[_0x6203('0x4c')]);router['post'](_0x6203('0x4d'),auth[_0x6203('0xb')](),controller[_0x6203('0x4e')]);router[_0x6203('0x3c')](_0x6203('0x4f'),auth[_0x6203('0xb')](),controller[_0x6203('0x50')]);router['post'](_0x6203('0x51'),auth[_0x6203('0xb')](),controller[_0x6203('0x52')]);router[_0x6203('0x3c')](_0x6203('0x27'),auth[_0x6203('0xb')](),controller['addTeams']);router[_0x6203('0x3c')](_0x6203('0x53'),auth[_0x6203('0xb')](),controller[_0x6203('0x54')]);router[_0x6203('0x3c')]('/:id/mail_interactions',auth[_0x6203('0xb')](),controller['addMailInteractions']);router[_0x6203('0x3c')](_0x6203('0x55'),auth['isAuthenticated'](),controller['addFaxInteractions']);router[_0x6203('0x3c')]('/:id/sms_interactions',auth[_0x6203('0xb')](),controller[_0x6203('0x56')]);router[_0x6203('0x3c')](_0x6203('0x57'),auth[_0x6203('0xb')](),controller['addOpenchannelInteractions']);router[_0x6203('0x3c')](_0x6203('0x58'),auth['isAuthenticated'](),controller[_0x6203('0x59')]);router[_0x6203('0x3c')](_0x6203('0x2e'),auth[_0x6203('0xb')](),controller[_0x6203('0x5a')]);router[_0x6203('0x3c')](_0x6203('0x30'),auth[_0x6203('0xb')](),controller['addMailAccounts']);router[_0x6203('0x3c')]('/:id/openchannel_accounts',auth[_0x6203('0xb')](),controller[_0x6203('0x5b')]);router[_0x6203('0x3c')](_0x6203('0x32'),auth['isAuthenticated'](),controller['addSmsAccounts']);router[_0x6203('0x3c')](_0x6203('0x34'),auth[_0x6203('0xb')](),controller['addChatWebsites']);router[_0x6203('0x3c')](_0x6203('0x36'),auth['isAuthenticated'](),controller['addWhatsappAccounts']);router[_0x6203('0x3c')](_0x6203('0x38'),auth[_0x6203('0xb')](),controller[_0x6203('0x5c')]);router[_0x6203('0x3c')]('/:id/api_key',auth[_0x6203('0xb')](),controller[_0x6203('0x5d')]);router['put']('/:id',auth[_0x6203('0xb')](),controller[_0x6203('0x5e')]);router[_0x6203('0x5f')](_0x6203('0x60'),auth[_0x6203('0xb')](),controller['changePassword']);router[_0x6203('0x61')]('/:id/queues',auth[_0x6203('0xb')](),controller[_0x6203('0x62')]);router[_0x6203('0x61')]('/:id/teams',auth[_0x6203('0xb')](),controller[_0x6203('0x63')]);router[_0x6203('0x61')](_0x6203('0x12'),auth[_0x6203('0xb')](),controller[_0x6203('0x64')]);router[_0x6203('0x61')](_0x6203('0x53'),auth['isAuthenticated'](),controller[_0x6203('0x65')]);router['delete']('/:id/mail_interactions',auth[_0x6203('0xb')](),controller[_0x6203('0x66')]);router[_0x6203('0x61')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x6203('0x67')]);router[_0x6203('0x61')](_0x6203('0x68'),auth[_0x6203('0xb')](),controller['removeSmsInteractions']);router[_0x6203('0x61')]('/:id/openchannel_interactions',auth[_0x6203('0xb')](),controller['removeOpenchannelInteractions']);router[_0x6203('0x61')]('/:id/whatsapp_interactions',auth[_0x6203('0xb')](),controller[_0x6203('0x69')]);router[_0x6203('0x61')](_0x6203('0x2e'),auth['isAuthenticated'](),controller[_0x6203('0x6a')]);router['delete'](_0x6203('0x30'),auth[_0x6203('0xb')](),controller[_0x6203('0x6b')]);router[_0x6203('0x61')]('/:id/openchannel_accounts',auth[_0x6203('0xb')](),controller['removeOpenchannelAccounts']);router['delete']('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x6203('0x6c')]);router[_0x6203('0x61')](_0x6203('0x34'),auth[_0x6203('0xb')](),controller[_0x6203('0x6d')]);router[_0x6203('0x61')]('/:id/whatsapp_accounts',auth[_0x6203('0xb')](),controller[_0x6203('0x6e')]);router['delete'](_0x6203('0x38'),auth['isAuthenticated'](),controller[_0x6203('0x6f')]);router['delete']('/:id/api_key',auth[_0x6203('0xb')](),controller[_0x6203('0x70')]);module[_0x6203('0x71')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index e6ef8f6..44e0092 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 _0x23d2=['ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','originate','uac','uas','fingerprint','certificate','active','passive','actpass','update,nonat','DATE','showWebBar','get','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlssetup','dtlsprivatekey','rtcp_mux','dtlsverify','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','loginAttempts','blockedAt','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','fullname','callerid','format','getDataValue','internal','email','toLowerCase','user','agent','telephone','INTEGER','\x22%s\x22\x20<%s>','BOOLEAN','dynamic','friend','from-sip','ENUM','ALLOWED_NOT_SCREENED','ALLOWED','PROHIB_NOT_SCREENED','PROHIB','udp','transport','join','split','rfc2833','info','shortinfo','inband','yes','nonat','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all'];(function(_0x34e0ed,_0x5dd71e){var _0x227cd7=function(_0x24def4){while(--_0x24def4){_0x34e0ed['push'](_0x34e0ed['shift']());}};_0x227cd7(++_0x5dd71e);}(_0x23d2,0xdb));var _0x223d=function(_0x41905e,_0x3bf9df){_0x41905e=_0x41905e-0x0;var _0x31b7c3=_0x23d2[_0x41905e];return _0x31b7c3;};'use strict';var Sequelize=require(_0x223d('0x0'));var moment=require(_0x223d('0x1'));var util=require(_0x223d('0x2'));var _=require(_0x223d('0x3'));module[_0x223d('0x4')]={'name':{'type':Sequelize[_0x223d('0x5')],'allowNull':![],'unique':_0x223d('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1cfe38){this[_0x223d('0x7')](_0x223d('0x6'),_0x1cfe38);this[_0x223d('0x7')](_0x223d('0x8'),_0x1cfe38);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x223d('0x5')],'allowNull':![],'set':function(_0x36998c){this[_0x223d('0x7')](_0x223d('0x9'),_0x36998c);this['setDataValue'](_0x223d('0xa'),util[_0x223d('0xb')]('\x22%s\x22\x20<%s>',_0x36998c,this[_0x223d('0xc')](_0x223d('0xd'))));}},'alias':{'type':Sequelize[_0x223d('0x5')]},'email':{'type':Sequelize[_0x223d('0x5')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x431528){if(_0x431528){this[_0x223d('0x7')](_0x223d('0xe'),_0x431528[_0x223d('0xf')]());}}},'role':{'type':Sequelize['ENUM']('admin',_0x223d('0x10'),_0x223d('0x11'),_0x223d('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x223d('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x223d('0x5')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x223d('0x13')](0xb),'allowNull':![],'unique':_0x223d('0xd'),'set':function(_0xe17e40){this[_0x223d('0x7')](_0x223d('0xd'),_0xe17e40);this[_0x223d('0x7')]('accountcode',_0xe17e40);this['setDataValue'](_0x223d('0xa'),util[_0x223d('0xb')](_0x223d('0x14'),this[_0x223d('0xc')](_0x223d('0x9')),_0xe17e40));}},'salt':{'type':Sequelize[_0x223d('0x5')]},'phone':{'type':Sequelize[_0x223d('0x5')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x223d('0x5')]},'zipcode':{'type':Sequelize[_0x223d('0x5')]},'userpic':{'type':Sequelize[_0x223d('0x5')]},'city':{'type':Sequelize[_0x223d('0x5')]},'country':{'type':Sequelize[_0x223d('0x5')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x223d('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x223d('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x223d('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x223d('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x223d('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x223d('0x5')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x223d('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x223d('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x223d('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x223d('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x223d('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x223d('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x223d('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x223d('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x223d('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x223d('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x223d('0x16')},'ipaddr':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0x223d('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x223d('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x223d('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x223d('0x17'),_0x223d('0x10'),'peer'),'allowNull':!![],'defaultValue':_0x223d('0x17')},'context':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![],'defaultValue':_0x223d('0x18')},'callingpres':{'type':Sequelize[_0x223d('0x19')](_0x223d('0x1a'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0x223d('0x1b'),_0x223d('0x1c'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0x223d('0x1d')),'allowNull':!![]},'deny':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x223d('0x1e'),'set':function(_0x490f61){this['setDataValue'](_0x223d('0x1f'),_0x490f61?_0x490f61[_0x223d('0x20')](','):null);},'get':function(){return this[_0x223d('0xc')]('transport')?this['getDataValue']('transport')[_0x223d('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x223d('0x19')](_0x223d('0x22'),_0x223d('0x23'),_0x223d('0x24'),_0x223d('0x25'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x223d('0x19')](_0x223d('0x26'),'no',_0x223d('0x27'),'update',_0x223d('0x28')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x223d('0x19')](_0x223d('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x223d('0x29'),'set':function(_0x3ce9f5){this[_0x223d('0x7')](_0x223d('0x2a'),_0x3ce9f5?_0x3ce9f5[_0x223d('0x20')](','):null);},'get':function(){return this[_0x223d('0xc')](_0x223d('0x2a'))?this[_0x223d('0xc')](_0x223d('0x2a'))['split'](','):null;},'comment':_0x223d('0x2b')},'callgroup':{'type':Sequelize[_0x223d('0x5')]},'namedcallgroup':{'type':Sequelize[_0x223d('0x5')]},'pickupgroup':{'type':Sequelize[_0x223d('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x223d('0x5')]},'language':{'type':Sequelize[_0x223d('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x223d('0x5')]},'disallow':{'type':Sequelize[_0x223d('0x5')],'allowNull':![],'defaultValue':_0x223d('0x2c')},'allow':{'type':Sequelize[_0x223d('0x5')],'allowNull':![],'defaultValue':_0x223d('0x2d'),'set':function(_0x524689){this[_0x223d('0x7')](_0x223d('0x2e'),_0x524689?_0x524689[_0x223d('0x20')](';'):_0x223d('0x2d'));},'get':function(){return this[_0x223d('0xc')]('allow')?this[_0x223d('0xc')](_0x223d('0x2e'))[_0x223d('0x21')](';'):null;},'comment':_0x223d('0x2f')},'autoframing':{'type':Sequelize[_0x223d('0x19')](_0x223d('0x26'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![],'set':function(_0x4f208a){this[_0x223d('0x7')]('insecure',_0x4f208a?_0x4f208a[_0x223d('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x223d('0x30'))?this['getDataValue'](_0x223d('0x30'))[_0x223d('0x21')](','):null;},'comment':_0x223d('0x31')},'trustrpid':{'type':Sequelize[_0x223d('0x19')](_0x223d('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x223d('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x223d('0x19')]('yes','no',_0x223d('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x223d('0x19')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x223d('0x19')](_0x223d('0x26'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![],'defaultValue':_0x223d('0x33')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x223d('0x19')](_0x223d('0x26'),'no'),'allowNull':!![],'defaultValue':_0x223d('0x26')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x223d('0x19')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x223d('0x19')](_0x223d('0x26'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x223d('0x19')](_0x223d('0x26'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x223d('0x19')]('yes','no',_0x223d('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x223d('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x223d('0x19')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept','refuse',_0x223d('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x223d('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x223d('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x223d('0x19')](_0x223d('0x36'),_0x223d('0x37')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x223d('0x19')](_0x223d('0x26'),'no'),'allowNull':!![],'defaultValue':_0x223d('0x26')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x223d('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x223d('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x223d('0x19')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x223d('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x223d('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x223d('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x223d('0x19')](_0x223d('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x223d('0x19')](_0x223d('0x26'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x223d('0x19')](_0x223d('0x26'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x223d('0x19')](_0x223d('0x26'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x223d('0x26'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0x223d('0x38'),_0x223d('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x223d('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x223d('0x3a'),_0x223d('0x3b'),_0x223d('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x223d('0x19')](_0x223d('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x223d('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x223d('0x19')](_0x223d('0x26'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x223d('0x26'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x223d('0x26'),'no','nonat','update',_0x223d('0x3d')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x223d('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x223d('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0x223d('0x3e')]},'passwordResetAt':{'type':Sequelize[_0x223d('0x3e')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x223d('0x5')]},'showWebBar':{'type':Sequelize[_0x223d('0x13')],'defaultValue':0x0,'set':function(_0xa25cf0){this[_0x223d('0x7')](_0x223d('0x3f'),_0xa25cf0);var _0x87adf2=this[_0x223d('0x40')]({'plain':!![]});switch(_0xa25cf0){case 0x0:case 0x1:var _0x56b75d=_0x87adf2[_0x223d('0x1f')]?_['isArray'](_0x87adf2['transport'])?_0x87adf2[_0x223d('0x1f')][_0x223d('0x20')]():_0x87adf2[_0x223d('0x1f')]:_0x223d('0x1e');if(_0x56b75d===_0x223d('0x41')){_0x56b75d=_0x223d('0x1e');}this['setDataValue']('transport',_0x56b75d);this[_0x223d('0x7')](_0x223d('0x42'),'no');this[_0x223d('0x7')](_0x223d('0x43'),null);this[_0x223d('0x7')](_0x223d('0x44'),null);this[_0x223d('0x7')](_0x223d('0x45'),null);this[_0x223d('0x7')](_0x223d('0x46'),null);this[_0x223d('0x7')]('dtlsverify',null);this['setDataValue'](_0x223d('0x47'),null);this['setDataValue']('dtlscertfile',null);this[_0x223d('0x7')](_0x223d('0x48'),null);this[_0x223d('0x7')](_0x223d('0x49'),'no');break;case 0x2:this[_0x223d('0x7')](_0x223d('0x1f'),_0x223d('0x41'));this[_0x223d('0x7')](_0x223d('0x42'),'yes');this[_0x223d('0x7')]('avpf',_0x223d('0x26'));this[_0x223d('0x7')]('force_avp',_0x223d('0x26'));this['setDataValue'](_0x223d('0x45'),'yes');this[_0x223d('0x7')]('dtlsenable',_0x223d('0x26'));this[_0x223d('0x7')](_0x223d('0x4a'),'no');this['setDataValue']('dtlssetup','actpass');this['setDataValue'](_0x223d('0x4b'),_0x87adf2['dtlscertfile']||_0x223d('0x4c'));this[_0x223d('0x7')](_0x223d('0x48'),_0x87adf2['dtlsprivatekey']||_0x223d('0x4d'));this[_0x223d('0x7')]('rtcp_mux',_0x223d('0x26'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x3a672d){this[_0x223d('0x7')](_0x223d('0x4e'),_0x3a672d?_0x3a672d[_0x223d('0x20')](','):[]);},'get':function(){return this[_0x223d('0xc')](_0x223d('0x4e'))?_[_0x223d('0x4f')](this[_0x223d('0xc')](_0x223d('0x4e'))[_0x223d('0x21')](','),function(_0x4e8103){return parseInt(_0x4e8103,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x223d('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0x223d('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x223d('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x223d('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x223d('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x223d('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x223d('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x223d('0x26'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x223d('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x223d('0x5')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x223d('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x223d('0x50')],'get':function(){return this[_0x223d('0xc')](_0x223d('0x51'))?this[_0x223d('0xc')](_0x223d('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x223d('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x223d('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x223d('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x223d('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x223d('0x15')],'defaultValue':![],'set':function(_0x37db35){if(typeof _0x37db35===_0x223d('0x52')){var _0x12d4d7=_0x37db35==='1'?!![]:_0x37db35==='0'?![]:_0x37db35===_0x223d('0x53')?!![]:_0x37db35==='false'?![]:![];this[_0x223d('0x7')](_0x223d('0x54'),_0x12d4d7);}else{this[_0x223d('0x7')]('screenrecording',_0x37db35);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x7798ac){this['setDataValue'](_0x223d('0x55'),_0x7798ac);if(_0x7798ac===!![]){this['setDataValue']('blockedAt',moment());this[_0x223d('0x7')](_0x223d('0x56'),0x0);}else{this[_0x223d('0x7')](_0x223d('0x57'),null);}}},'blockedAt':{'type':Sequelize[_0x223d('0x3e')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x223d('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x223d('0x15')],'defaultValue':!![]}}; \ No newline at end of file +var _0x998f=['PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','insecure','never','\x22\x22\x20<>','originate','uac','uas','active','passive','actpass','update','update,nonat','showWebBar','get','wss','udp','avpf','force_avp','icesupport','dtlsenable','dtlscertfile','encryption','dtlssetup','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','rtcp_mux','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','internal','email','ENUM','admin','telephone','local','accountcode','\x22%s\x22\x20<%s>','BOOLEAN','DEFAULT\x20PAUSE','DATE','INTEGER','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED'];(function(_0x1315f0,_0x25a87b){var _0x457bb2=function(_0x3ed927){while(--_0x3ed927){_0x1315f0['push'](_0x1315f0['shift']());}};_0x457bb2(++_0x25a87b);}(_0x998f,0x1a8));var _0xf998=function(_0x58fe2f,_0xa835da){_0x58fe2f=_0x58fe2f-0x0;var _0x251ee5=_0x998f[_0x58fe2f];return _0x251ee5;};'use strict';var Sequelize=require(_0xf998('0x0'));var moment=require(_0xf998('0x1'));var util=require(_0xf998('0x2'));var _=require(_0xf998('0x3'));module[_0xf998('0x4')]={'name':{'type':Sequelize[_0xf998('0x5')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x55299f){this['setDataValue'](_0xf998('0x6'),_0x55299f);this[_0xf998('0x7')](_0xf998('0x8'),_0x55299f);},'comment':_0xf998('0x9')},'fullname':{'type':Sequelize[_0xf998('0x5')],'allowNull':![],'set':function(_0x344109){this[_0xf998('0x7')](_0xf998('0xa'),_0x344109);this[_0xf998('0x7')](_0xf998('0xb'),util[_0xf998('0xc')]('\x22%s\x22\x20<%s>',_0x344109,this['getDataValue'](_0xf998('0xd'))));}},'alias':{'type':Sequelize[_0xf998('0x5')]},'email':{'type':Sequelize[_0xf998('0x5')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x3b1ef6){if(_0x3b1ef6){this[_0xf998('0x7')](_0xf998('0xe'),_0x3b1ef6['toLowerCase']());}}},'role':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x10'),'user','agent',_0xf998('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0xf998('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xf998('0x5')],'defaultValue':_0xf998('0x12')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xf998('0xd'),'set':function(_0x999b8e){this[_0xf998('0x7')](_0xf998('0xd'),_0x999b8e);this[_0xf998('0x7')](_0xf998('0x13'),_0x999b8e);this['setDataValue'](_0xf998('0xb'),util[_0xf998('0xc')](_0xf998('0x14'),this['getDataValue']('fullname'),_0x999b8e));}},'salt':{'type':Sequelize[_0xf998('0x5')]},'phone':{'type':Sequelize[_0xf998('0x5')]},'mobile':{'type':Sequelize[_0xf998('0x5')]},'address':{'type':Sequelize[_0xf998('0x5')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xf998('0x5')]},'city':{'type':Sequelize[_0xf998('0x5')]},'country':{'type':Sequelize[_0xf998('0x5')]},'online':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xf998('0x5')],'defaultValue':_0xf998('0x16')},'lastPauseAt':{'type':Sequelize[_0xf998('0x17')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xf998('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xf998('0x18')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xf998('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xf998('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xf998('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xf998('0x18')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xf998('0x18')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![],'defaultValue':_0xf998('0x19')},'ipaddr':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xf998('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0xf998('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x1a'),'user','peer'),'allowNull':!![],'defaultValue':_0xf998('0x1a')},'context':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![],'defaultValue':_0xf998('0x1b')},'callingpres':{'type':Sequelize['ENUM'](_0xf998('0x1c'),_0xf998('0x1d'),'ALLOWED_FAILED_SCREEN',_0xf998('0x1e'),_0xf998('0x1f'),_0xf998('0x20'),_0xf998('0x21'),_0xf998('0x22')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![],'defaultValue':'udp','set':function(_0x1e764c){this[_0xf998('0x7')](_0xf998('0x23'),_0x1e764c?_0x1e764c[_0xf998('0x24')](','):null);},'get':function(){return this[_0xf998('0x25')]('transport')?this[_0xf998('0x25')](_0xf998('0x23'))[_0xf998('0x26')](','):null;},'comment':_0xf998('0x27')},'dtmfmode':{'type':Sequelize['ENUM'](_0xf998('0x28'),_0xf998('0x29'),_0xf998('0x2a'),_0xf998('0x2b'),_0xf998('0x2c')),'allowNull':!![],'defaultValue':_0xf998('0x28')},'directmedia':{'type':Sequelize['ENUM'](_0xf998('0x2d'),'no',_0xf998('0x2e'),'update',_0xf998('0x2f')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![],'defaultValue':_0xf998('0x30'),'set':function(_0x41f2b7){this[_0xf998('0x7')](_0xf998('0x31'),_0x41f2b7?_0x41f2b7[_0xf998('0x24')](','):null);},'get':function(){return this[_0xf998('0x25')]('nat')?this[_0xf998('0x25')](_0xf998('0x31'))[_0xf998('0x26')](','):null;},'comment':_0xf998('0x32')},'callgroup':{'type':Sequelize[_0xf998('0x5')]},'namedcallgroup':{'type':Sequelize[_0xf998('0x5')]},'pickupgroup':{'type':Sequelize[_0xf998('0x5')]},'namedpickupgroup':{'type':Sequelize[_0xf998('0x5')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xf998('0x5')],'allowNull':![],'defaultValue':_0xf998('0x33')},'allow':{'type':Sequelize[_0xf998('0x5')],'allowNull':![],'defaultValue':_0xf998('0x34'),'set':function(_0x59243b){this[_0xf998('0x7')](_0xf998('0x35'),_0x59243b?_0x59243b['join'](';'):_0xf998('0x34'));},'get':function(){return this[_0xf998('0x25')](_0xf998('0x35'))?this[_0xf998('0x25')](_0xf998('0x35'))[_0xf998('0x26')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xf998('0xf')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![],'set':function(_0x37216d){this[_0xf998('0x7')](_0xf998('0x36'),_0x37216d?_0x37216d[_0xf998('0x24')](','):null);},'get':function(){return this[_0xf998('0x25')](_0xf998('0x36'))?this['getDataValue']('insecure')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xf998('0x2d'),'no',_0xf998('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xf998('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![],'defaultValue':_0xf998('0x38')},'amaflags':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xf998('0x18')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xf998('0xf')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf998('0x18')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept','refuse',_0xf998('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x3a'),_0xf998('0x3b')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xf998('0x2d'),'no'),'allowNull':!![],'defaultValue':_0xf998('0x2d')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xf998('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xf998('0x18')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xf998('0x18')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xf998('0x18')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xf998('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xf998('0x18')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xf998('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xf998('0x2d'),'no','fingerprint','certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xf998('0x18')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xf998('0x3c'),_0xf998('0x3d'),_0xf998('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xf998('0x18')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xf998('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xf998('0xf')](_0xf998('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xf998('0xf')]('yes','no',_0xf998('0x2e'),_0xf998('0x3f'),_0xf998('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0xf998('0x17')]},'passwordResetAt':{'type':Sequelize[_0xf998('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xf998('0x5')]},'showWebBar':{'type':Sequelize[_0xf998('0x18')],'defaultValue':0x0,'set':function(_0x775d5f){this[_0xf998('0x7')](_0xf998('0x41'),_0x775d5f);var _0x3dfa57=this[_0xf998('0x42')]({'plain':!![]});switch(_0x775d5f){case 0x0:case 0x1:var _0x2bd55b=_0x3dfa57[_0xf998('0x23')]?_['isArray'](_0x3dfa57['transport'])?_0x3dfa57[_0xf998('0x23')][_0xf998('0x24')]():_0x3dfa57[_0xf998('0x23')]:'udp';if(_0x2bd55b===_0xf998('0x43')){_0x2bd55b=_0xf998('0x44');}this[_0xf998('0x7')](_0xf998('0x23'),_0x2bd55b);this[_0xf998('0x7')]('encryption','no');this['setDataValue'](_0xf998('0x45'),null);this[_0xf998('0x7')](_0xf998('0x46'),null);this[_0xf998('0x7')](_0xf998('0x47'),null);this[_0xf998('0x7')](_0xf998('0x48'),null);this[_0xf998('0x7')]('dtlsverify',null);this[_0xf998('0x7')]('dtlssetup',null);this[_0xf998('0x7')](_0xf998('0x49'),null);this[_0xf998('0x7')]('dtlsprivatekey',null);this[_0xf998('0x7')]('rtcp_mux','no');break;case 0x2:this[_0xf998('0x7')](_0xf998('0x23'),_0xf998('0x43'));this[_0xf998('0x7')](_0xf998('0x4a'),_0xf998('0x2d'));this[_0xf998('0x7')](_0xf998('0x45'),_0xf998('0x2d'));this[_0xf998('0x7')](_0xf998('0x46'),'yes');this['setDataValue'](_0xf998('0x47'),_0xf998('0x2d'));this[_0xf998('0x7')](_0xf998('0x48'),'yes');this['setDataValue']('dtlsverify','no');this[_0xf998('0x7')](_0xf998('0x4b'),_0xf998('0x3e'));this['setDataValue'](_0xf998('0x49'),_0x3dfa57[_0xf998('0x49')]||_0xf998('0x4c'));this[_0xf998('0x7')](_0xf998('0x4d'),_0x3dfa57[_0xf998('0x4d')]||'/etc/pki/tls/private/motion.key');this[_0xf998('0x7')](_0xf998('0x4e'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0xf998('0x4f')],'set':function(_0x1ea7a3){this[_0xf998('0x7')](_0xf998('0x50'),_0x1ea7a3?_0x1ea7a3[_0xf998('0x24')](','):[]);},'get':function(){return this[_0xf998('0x25')](_0xf998('0x50'))?_[_0xf998('0x51')](this[_0xf998('0x25')](_0xf998('0x50'))[_0xf998('0x26')](','),function(_0x15ceaa){return parseInt(_0x15ceaa,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xf998('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xf998('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xf998('0x18')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xf998('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0xf998('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xf998('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xf998('0x5')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xf998('0x52')],'get':function(){return this[_0xf998('0x25')](_0xf998('0x53'))?this[_0xf998('0x25')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0xf998('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xf998('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![],'set':function(_0x3a157f){if(typeof _0x3a157f===_0xf998('0x54')){var _0x41e2d3=_0x3a157f==='1'?!![]:_0x3a157f==='0'?![]:_0x3a157f===_0xf998('0x55')?!![]:_0x3a157f===_0xf998('0x56')?![]:![];this[_0xf998('0x7')](_0xf998('0x57'),_0x41e2d3);}else{this[_0xf998('0x7')]('screenrecording',_0x3a157f);}}},'blocked':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![],'set':function(_0x58c21f){this[_0xf998('0x7')](_0xf998('0x58'),_0x58c21f);if(_0x58c21f===!![]){this[_0xf998('0x7')](_0xf998('0x59'),moment());this[_0xf998('0x7')](_0xf998('0x5a'),0x0);}else{this[_0xf998('0x7')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0xf998('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xf998('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xf998('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xf998('0x15')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 1909081..042b8e6 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 _0xe706=['phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','socket','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','PAUSE','LOGININPAUSE','bulkCreate','isMiddleware','logout','pause','QueuePause','DEFAULT\x20PAUSE','mailPause','faxPause','whatsapppause','pauseType','lastPauseAt','unpause','chat','openchannel','manual','set','%s%s','Pause','getTeams','Team','getVoiceQueues','setDataValue','Voice','getMailQueues','Mail','getSmsQueues','Sms','getWhatsappQueues','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','Chat','Whatsapp','getDataValue','getLists','CmList','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','concat','$and','$gt','$lt','$lte','$ne','$notBetween','$in','$like','$notLike','$notILike','$overlap','$contains','$contained','dialActive','VoiceQueue','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','apiKeyNonce','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','teams','queues','resolve','inbound','col','toString','asc','desc','uniqBy','orderBy','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','client','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unavailable','voiceStatus','slice','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','http','then','info','User,\x20%s,\x20%s','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','update','destroy','get','role','admin','user','agent','Telephones','telephone','filter','ignore','map','value','includes','find','UserProfileResource','end','stack','name','send','index','User','rawAttributes','fieldName','key','model','differenceBy','salt','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','where','merge','type','sequelize','lower','includeAll','include','findAll','rows','show','params','password','body','describe','addContacts','ids','omit','internal','securePassword','validatePasswordPattern','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','102','113','105','108','109','100','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','userProfileId','create','Agents','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','push','all','each','UserProfileSection','isEmpty','autoAssociation','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','enforcePasswordHistory','previousPasswords','validatePasswordHistory','updatePasswordsHistory','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','penalty','spread','toLowerCase','QueueId','emit','Queue:save','voice','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','remove','Queues','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','existsSync','server/files/images/','download','getContacts','CmContact','List','Tag','Tags','color','tag','nolimit','getQueues','options','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login'];(function(_0x3f50ad,_0x2d4102){var _0x225c50=function(_0x1cb88d){while(--_0x1cb88d){_0x3f50ad['push'](_0x3f50ad['shift']());}};_0x225c50(++_0x2d4102);}(_0xe706,0xa3));var _0x6e70=function(_0x393db8,_0x3e1157){_0x393db8=_0x393db8-0x0;var _0x4295cc=_0xe706[_0x393db8];return _0x4295cc;};'use strict';var pdf=require(_0x6e70('0x0'));var emlformat=require(_0x6e70('0x1'));var rimraf=require(_0x6e70('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e70('0x3'));var rp=require(_0x6e70('0x4'));var moment=require(_0x6e70('0x5'));var BPromise=require(_0x6e70('0x6'));var Mustache=require(_0x6e70('0x7'));var util=require(_0x6e70('0x8'));var path=require(_0x6e70('0x9'));var sox=require(_0x6e70('0xa'));var csv=require(_0x6e70('0xb'));var ejs=require(_0x6e70('0xc'));var fs=require('fs');var fs_extra=require(_0x6e70('0xd'));var _=require(_0x6e70('0xe'));var squel=require(_0x6e70('0xf'));var crypto=require(_0x6e70('0x10'));var jsforce=require(_0x6e70('0x11'));var deskjs=require(_0x6e70('0x12'));var toCsv=require(_0x6e70('0xb'));var querystring=require(_0x6e70('0x13'));var Papa=require(_0x6e70('0x14'));var Redis=require(_0x6e70('0x15'));var authService=require(_0x6e70('0x16'));var qs=require(_0x6e70('0x17'));var as=require(_0x6e70('0x18'));var hardwareService=require(_0x6e70('0x19'));var logger=require('../../config/logger')('api');var utils=require(_0x6e70('0x1a'));var config=require(_0x6e70('0x1b'));var licenseUtil=require(_0x6e70('0x1c'));var db=require(_0x6e70('0x1d'))['db'];config[_0x6e70('0x1e')]=_[_0x6e70('0x1f')](config[_0x6e70('0x1e')],{'host':_0x6e70('0x20'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./user.socket')[_0x6e70('0x21')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x6e70('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x22c50c,_0x5d9263,_0x24f3ac,_0x5c3fe7){return new BPromise(function(_0x2efc0f,_0x161f23){var _0x4ca554=_0x5c3fe7||client;return _0x4ca554['request'](_0x22c50c,_0x24f3ac)[_0x6e70('0x23')](function(_0x5ea7a5){logger[_0x6e70('0x24')](_0x6e70('0x25'),_0x5d9263,'request\x20sent');logger['debug'](_0x6e70('0x26'),_0x5d9263,_0x6e70('0x27'),JSON[_0x6e70('0x28')](_0x5ea7a5));if(_0x5ea7a5[_0x6e70('0x29')]){if(_0x5ea7a5[_0x6e70('0x29')][_0x6e70('0x2a')]===0x1f4){logger[_0x6e70('0x29')](_0x6e70('0x25'),_0x5d9263,_0x5ea7a5[_0x6e70('0x29')][_0x6e70('0x2b')]);return _0x161f23(_0x5ea7a5['error'][_0x6e70('0x2b')]);}logger[_0x6e70('0x29')](_0x6e70('0x25'),_0x5d9263,_0x5ea7a5['error'][_0x6e70('0x2b')]);return _0x2efc0f(_0x5ea7a5[_0x6e70('0x29')][_0x6e70('0x2b')]);}else{logger['info'](_0x6e70('0x25'),_0x5d9263,'request\x20sent');_0x2efc0f(_0x5ea7a5['result']['message']);}})[_0x6e70('0x2c')](function(_0x19c5ae){logger['error'](_0x6e70('0x25'),_0x5d9263,_0x19c5ae);_0x161f23(_0x19c5ae);});});}function respondWithStatusCode(_0x1196ed,_0x5f268f){_0x5f268f=_0x5f268f||0xcc;return function(_0x338ad6){if(_0x338ad6){return _0x1196ed[_0x6e70('0x2d')](_0x5f268f);}return _0x1196ed[_0x6e70('0x2e')](_0x5f268f)['end']();};}function respondWithResult(_0x54a5fe,_0x2c4d37){_0x2c4d37=_0x2c4d37||0xc8;return function(_0x3af17f){if(_0x3af17f){return _0x54a5fe[_0x6e70('0x2e')](_0x2c4d37)[_0x6e70('0x2f')](_0x3af17f);}};}function respondWithFilteredResult(_0x43fee0,_0x5d772a){return function(_0x1952ea){if(_0x1952ea){var _0x406f29=_0x1952ea[_0x6e70('0x30')],_0xecf336=_0x5d772a[_0x6e70('0x31')],_0x2864a0=_0x5d772a[_0x6e70('0x31')]+_0x5d772a[_0x6e70('0x32')],_0x396a67;if(_0x2864a0>=_0x406f29){_0x2864a0=_0x406f29;_0x396a67=0xc8;}else{_0x396a67=0xce;}_0x43fee0[_0x6e70('0x2e')](_0x396a67);return _0x43fee0['set'](_0x6e70('0x33'),_0xecf336+'-'+_0x2864a0+'/'+_0x406f29)['json'](_0x1952ea);}return null;};}function patchUpdates(_0x259486){return function(_0x5a7a2a){try{jsonpatch[_0x6e70('0x34')](_0x5a7a2a,_0x259486,!![]);}catch(_0x2722e8){return BPromise[_0x6e70('0x35')](_0x2722e8);}return _0x5a7a2a['save']();};}function saveUpdates(_0x38c40d,_0x42b094){return function(_0x5780a1){if(_0x5780a1){return _0x5780a1[_0x6e70('0x36')](_0x38c40d)[_0x6e70('0x23')](function(_0x52b457){return _0x52b457;});}return null;};}function removeEntity(_0x10d8f6,_0x3665a1){return function(_0x2d52bd){if(_0x2d52bd){return _0x2d52bd[_0x6e70('0x37')]()[_0x6e70('0x23')](function(){var _0x1e3e76=_0x2d52bd[_0x6e70('0x38')]({'plain':!![]});if(_0x1e3e76[_0x6e70('0x39')]===_0x6e70('0x3a'))return;var _0x419a41=[{'name':'Users','value':_0x6e70('0x3b'),'ignore':!![]},{'name':'Agents','value':_0x6e70('0x3c'),'ignore':![]},{'name':_0x6e70('0x3d'),'value':_0x6e70('0x3e'),'ignore':![]}];var _0x32d12d=_(_0x419a41)[_0x6e70('0x3f')](_0x6e70('0x40'))[_0x6e70('0x41')](_0x6e70('0x42'))[_0x6e70('0x42')]();if(_[_0x6e70('0x43')](_0x32d12d,_0x1e3e76[_0x6e70('0x39')])){return;}var _0x23d5e2=_[_0x6e70('0x44')](_0x419a41,['value',_0x1e3e76['role']])['name'];return db[_0x6e70('0x45')][_0x6e70('0x37')]({'where':{'type':_0x23d5e2,'resourceId':_0x1e3e76['id']}})[_0x6e70('0x23')](function(){return _0x2d52bd;});})[_0x6e70('0x23')](function(){_0x10d8f6[_0x6e70('0x2e')](0xcc)[_0x6e70('0x46')]();});}};}function handleEntityNotFound(_0x572a71,_0x3b508c){return function(_0x9e7ad2){if(!_0x9e7ad2){_0x572a71[_0x6e70('0x2d')](0x194);}return _0x9e7ad2;};}function handleError(_0x20647a,_0x89f3df){_0x89f3df=_0x89f3df||0x1f4;return function(_0x37bf46){logger[_0x6e70('0x29')](_0x37bf46[_0x6e70('0x47')]);if(_0x37bf46['name']){delete _0x37bf46[_0x6e70('0x48')];}_0x20647a[_0x6e70('0x2e')](_0x89f3df)[_0x6e70('0x49')](_0x37bf46);};}exports[_0x6e70('0x4a')]=function(_0x201da9,_0x1de947){var _0x21b0e7={},_0x4a8adc={},_0x56ea6e={'count':0x0,'rows':[]};var _0x5ae898=_[_0x6e70('0x41')](db[_0x6e70('0x4b')][_0x6e70('0x4c')],function(_0x64ff8e){return{'name':_0x64ff8e[_0x6e70('0x4d')],'type':_0x64ff8e['type'][_0x6e70('0x4e')]};});_0x4a8adc[_0x6e70('0x4f')]=_[_0x6e70('0x50')](_['map'](_0x5ae898,'name'),['password',_0x6e70('0x51')]);_0x4a8adc['query']=_[_0x6e70('0x52')](_0x201da9[_0x6e70('0x53')]);_0x4a8adc[_0x6e70('0x54')]=_[_0x6e70('0x55')](_0x4a8adc['model'],_0x4a8adc[_0x6e70('0x53')]);_0x21b0e7['attributes']=_[_0x6e70('0x55')](_0x4a8adc[_0x6e70('0x4f')],qs[_0x6e70('0x56')](_0x201da9[_0x6e70('0x53')]['fields']));_0x21b0e7[_0x6e70('0x57')]=_0x21b0e7[_0x6e70('0x57')][_0x6e70('0x58')]?_0x21b0e7[_0x6e70('0x57')]:_0x4a8adc[_0x6e70('0x4f')];if(!_0x201da9[_0x6e70('0x53')][_0x6e70('0x59')]('nolimit')){_0x21b0e7[_0x6e70('0x32')]=qs[_0x6e70('0x32')](_0x201da9[_0x6e70('0x53')][_0x6e70('0x32')]);_0x21b0e7[_0x6e70('0x31')]=qs[_0x6e70('0x31')](_0x201da9[_0x6e70('0x53')]['offset']);}_0x21b0e7[_0x6e70('0x5a')]=qs['sort'](_0x201da9[_0x6e70('0x53')][_0x6e70('0x5b')]);_0x21b0e7['where']=qs['filters'](_[_0x6e70('0x5c')](_0x201da9[_0x6e70('0x53')],_0x4a8adc[_0x6e70('0x54')]),_0x5ae898);if(_0x201da9['query']['filter']){_0x21b0e7[_0x6e70('0x5d')]=_[_0x6e70('0x5e')](_0x21b0e7[_0x6e70('0x5d')],{'$or':_[_0x6e70('0x41')](_0x5ae898,function(_0x2e25d5){if(_0x2e25d5[_0x6e70('0x5f')]!=='VIRTUAL'){return db[_0x6e70('0x60')][_0x6e70('0x5d')](db[_0x6e70('0x60')]['fn'](_0x6e70('0x61'),db[_0x6e70('0x60')]['col'](_0x2e25d5['name'])),{'$like':db[_0x6e70('0x60')]['fn'](_0x6e70('0x61'),'%'+_0x201da9[_0x6e70('0x53')][_0x6e70('0x3f')]+'%')});}})});}_0x21b0e7=_[_0x6e70('0x5e')]({},_0x21b0e7,_0x201da9['options']);var _0x41bd0b={'where':_0x21b0e7[_0x6e70('0x5d')]};return db[_0x6e70('0x4b')][_0x6e70('0x30')](_0x41bd0b)[_0x6e70('0x23')](function(_0x4a111a){_0x56ea6e[_0x6e70('0x30')]=_0x4a111a;if(_0x201da9[_0x6e70('0x53')][_0x6e70('0x62')]){_0x21b0e7[_0x6e70('0x63')]=[{'all':!![]}];}return db[_0x6e70('0x4b')][_0x6e70('0x64')](_0x21b0e7);})['then'](function(_0x40e7c6){_0x56ea6e[_0x6e70('0x65')]=_0x40e7c6;return _0x56ea6e;})['then'](respondWithFilteredResult(_0x1de947,_0x21b0e7))[_0x6e70('0x2c')](handleError(_0x1de947,null));};exports[_0x6e70('0x66')]=function(_0x54efdf,_0x3cfaa9){var _0xb3f06c={'raw':![],'where':{'id':_0x54efdf[_0x6e70('0x67')]['id']}},_0x2134c4={};_0x2134c4[_0x6e70('0x4f')]=_['differenceBy'](_[_0x6e70('0x52')](db[_0x6e70('0x4b')][_0x6e70('0x4c')]),[_0x6e70('0x68'),_0x6e70('0x51')]);_0x2134c4[_0x6e70('0x53')]=_[_0x6e70('0x52')](_0x54efdf[_0x6e70('0x53')]);_0x2134c4[_0x6e70('0x54')]=_[_0x6e70('0x55')](_0x2134c4[_0x6e70('0x4f')],_0x2134c4[_0x6e70('0x53')]);_0xb3f06c[_0x6e70('0x57')]=_[_0x6e70('0x55')](_0x2134c4[_0x6e70('0x4f')],qs[_0x6e70('0x56')](_0x54efdf[_0x6e70('0x53')][_0x6e70('0x56')]));_0xb3f06c[_0x6e70('0x57')]=_0xb3f06c[_0x6e70('0x57')]['length']?_0xb3f06c[_0x6e70('0x57')]:_0x2134c4[_0x6e70('0x4f')];if(_0x54efdf[_0x6e70('0x53')][_0x6e70('0x62')]){_0xb3f06c[_0x6e70('0x63')]=[{'all':!![]}];}_0xb3f06c=_[_0x6e70('0x5e')]({},_0xb3f06c,_0x54efdf['options']);return db[_0x6e70('0x4b')][_0x6e70('0x44')](_0xb3f06c)['then'](handleEntityNotFound(_0x3cfaa9,null))[_0x6e70('0x23')](respondWithResult(_0x3cfaa9,null))[_0x6e70('0x2c')](handleError(_0x3cfaa9,null));};exports[_0x6e70('0x36')]=function(_0x590f7f,_0x51f268){if(_0x590f7f[_0x6e70('0x69')]['id']){delete _0x590f7f[_0x6e70('0x69')]['id'];}delete _0x590f7f[_0x6e70('0x69')][_0x6e70('0x39')];return db[_0x6e70('0x4b')][_0x6e70('0x44')]({'where':{'id':_0x590f7f[_0x6e70('0x67')]['id']}})['then'](handleEntityNotFound(_0x51f268,null))['then'](saveUpdates(_0x590f7f[_0x6e70('0x69')],null))[_0x6e70('0x23')](respondWithResult(_0x51f268,null))[_0x6e70('0x2c')](handleError(_0x51f268,null));};exports[_0x6e70('0x6a')]=function(_0x5b1e6f,_0x517c8b){return db[_0x6e70('0x4b')][_0x6e70('0x6a')]()['then'](respondWithResult(_0x517c8b,null))['catch'](handleError(_0x517c8b,null));};exports[_0x6e70('0x6b')]=function(_0x47fbed,_0x2a8fb7,_0x23900b){return db[_0x6e70('0x4b')][_0x6e70('0x44')]({'where':{'id':_0x47fbed[_0x6e70('0x67')]['id']}})[_0x6e70('0x23')](handleEntityNotFound(_0x2a8fb7,null))[_0x6e70('0x23')](function(_0x6ab1d6){if(_0x6ab1d6){return _0x6ab1d6['addContacts'](_0x47fbed[_0x6e70('0x69')][_0x6e70('0x6c')],_[_0x6e70('0x6d')](_0x47fbed[_0x6e70('0x69')],[_0x6e70('0x6c'),'id'])||{});}})['then'](respondWithResult(_0x2a8fb7,null))['catch'](handleError(_0x2a8fb7,null));};function validateUser(_0x5979bf){return new BPromise(function(_0x1bb338,_0xd91b9){if(_0x5979bf[_0x6e70('0x6e')])return _0x1bb338(_0x5979bf);return db['Setting']['findById'](0x1)[_0x6e70('0x23')](function(_0x3dae08){if(_0x3dae08[_0x6e70('0x6f')])authService[_0x6e70('0x70')](_0x5979bf[_0x6e70('0x68')]);db[_0x6e70('0x4b')]['max'](_0x6e70('0x6e'))[_0x6e70('0x23')](function(_0x30d11b){if(_[_0x6e70('0x71')](_0x30d11b)){_0x5979bf['internal']=_0x3dae08[_0x6e70('0x72')]||0x1;return;}if(_['isNil'](_0x3dae08['min_internal'])||_0x3dae08[_0x6e70('0x72')]===_0x30d11b){_0x5979bf[_0x6e70('0x6e')]=_0x30d11b+0x1;return;}if(_0x3dae08[_0x6e70('0x72')]>_0x30d11b){_0x5979bf[_0x6e70('0x6e')]=_0x3dae08[_0x6e70('0x72')];return;}return db[_0x6e70('0x60')]['query'](_0x6e70('0x73'),{'type':db[_0x6e70('0x60')][_0x6e70('0x74')][_0x6e70('0x75')]})[_0x6e70('0x23')](function(_0x13c092){if(_0x13c092&&_0x13c092[_0x6e70('0x58')]){for(var _0xd9b4a9=0x0,_0x2f1362=_0x13c092[_0x6e70('0x58')];_0xd9b4a9<_0x2f1362&&_['isNil'](_0x5979bf[_0x6e70('0x6e')]);_0xd9b4a9++){if(_0x3dae08[_0x6e70('0x72')]<=_0x13c092[_0xd9b4a9][_0x6e70('0x76')]){_0x5979bf['internal']=_0x13c092[_0xd9b4a9]['from'];}else if(_0x3dae08[_0x6e70('0x72')]>_0x13c092[_0xd9b4a9][_0x6e70('0x76')]&&_0x3dae08[_0x6e70('0x72')]<=_0x13c092[_0xd9b4a9]['to']){_0x5979bf[_0x6e70('0x6e')]=_0x3dae08[_0x6e70('0x72')];}}}if(_['isNil'](_0x5979bf['internal'])){_0x5979bf[_0x6e70('0x6e')]=_0x30d11b+0x1;}return _0x1bb338(_0x5979bf);});});})[_0x6e70('0x2c')](function(_0x56d4d9){_0xd91b9(_0x56d4d9);});});}function updateUser(_0x58666a){return new BPromise(function(_0x1c7c5f,_0xf7a034){try{if(_0x58666a[_0x6e70('0x77')]){_0x58666a[_0x6e70('0x78')]=_0x58666a[_0x6e70('0x6e')];_0x58666a[_0x6e70('0x79')]={'mailbox':_0x58666a[_0x6e70('0x6e')],'password':_0x58666a[_0x6e70('0x68')],'fullname':_0x58666a[_0x6e70('0x7a')],'email':_0x58666a[_0x6e70('0x7b')]};}if(_0x58666a[_0x6e70('0x39')]===_0x6e70('0x3c')){if(!_0x58666a[_0x6e70('0x7c')])_0x58666a['permissions']=['101',_0x6e70('0x7d'),'103',_0x6e70('0x7e'),'110','104',_0x6e70('0x7f'),'106','107',_0x6e70('0x80'),_0x6e70('0x81'),_0x6e70('0x82'),'111','114','115'];}_0x1c7c5f(_0x58666a);}catch(_0x3e7be7){_0xf7a034(_0x3e7be7);}});}exports['create']=function(_0x2e8ed3,_0x34237d){if(_0x2e8ed3[_0x6e70('0x3b')][_0x6e70('0x39')]===_0x6e70('0x3c'))throw new Error(_0x6e70('0x83'));if(_0x2e8ed3[_0x6e70('0x69')]['role']===_0x6e70('0x3b')&&_0x2e8ed3[_0x6e70('0x3b')][_0x6e70('0x39')]!=='admin'){throw new Error(_0x6e70('0x84'));}if(_0x2e8ed3[_0x6e70('0x69')][_0x6e70('0x39')]===_0x6e70('0x3a')&&_0x2e8ed3[_0x6e70('0x3b')][_0x6e70('0x39')]!==_0x6e70('0x3a')){throw new Error(_0x6e70('0x85'));}return licenseUtil[_0x6e70('0x86')]([_0x2e8ed3['body']])[_0x6e70('0x23')](function(){return validateUser(_0x2e8ed3[_0x6e70('0x69')]);})['then'](function(_0x252f07){return updateUser(_0x252f07)[_0x6e70('0x23')](function(_0x51be27){if(_0x51be27['role']===_0x6e70('0x3a')){_0x51be27['settingsEnabled']=_0x2e8ed3[_0x6e70('0x3b')]['settingsEnabled'];delete _0x51be27[_0x6e70('0x87')];}return _0x51be27;});})[_0x6e70('0x23')](function(_0x106f32){return db[_0x6e70('0x4b')][_0x6e70('0x88')](_0x106f32,{'include':[{'model':db[_0x6e70('0x79')],'as':_0x6e70('0x79')}]});})['then'](function(_0x4d6a09){if(_0x2e8ed3[_0x6e70('0x69')]['role']===_0x6e70('0x3b'))return _0x4d6a09;if(_0x2e8ed3[_0x6e70('0x3b')][_0x6e70('0x39')]!==_0x6e70('0x3b'))return _0x4d6a09;return db['UserProfileSection'][_0x6e70('0x44')]({'where':{'name':_0x4d6a09['role']===_0x6e70('0x3c')?_0x6e70('0x89'):_0x6e70('0x3d'),'userProfileId':_0x2e8ed3[_0x6e70('0x3b')][_0x6e70('0x87')]},'raw':!![]})[_0x6e70('0x23')](function(_0x2c3bf6){if(!_0x2c3bf6||_0x2c3bf6['autoAssociation']!=0x0)return _0x4d6a09;return db[_0x6e70('0x45')]['create']({'name':_0x4d6a09[_0x6e70('0x48')],'resourceId':_0x4d6a09['id'],'type':_0x2c3bf6['name'],'sectionId':_0x2c3bf6['id']},{})['then'](function(){return _0x4d6a09;});})['catch'](function(_0x1b4258){logger[_0x6e70('0x29')](_0x6e70('0x8a'),_0x1b4258);throw _0x1b4258;});})[_0x6e70('0x23')](respondWithResult(_0x34237d,0xc9))[_0x6e70('0x2c')](handleError(_0x34237d,null));};exports['bulkCreate']=function(_0x395214,_0xb273e){var _0x48c30c=_0x395214[_0x6e70('0x69')];var _0x50e494=[];if(_0x395214[_0x6e70('0x3b')]['role']==='agent')throw new Error(_0x6e70('0x83'));if(_[_0x6e70('0x8b')](_0x48c30c,[_0x6e70('0x39'),_0x6e70('0x3b')])&&_0x395214[_0x6e70('0x3b')][_0x6e70('0x39')]!==_0x6e70('0x3a')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x6e70('0x8b')](_0x48c30c,['role',_0x6e70('0x3a')])&&_0x395214[_0x6e70('0x3b')][_0x6e70('0x39')]!==_0x6e70('0x3a')){throw new Error(_0x6e70('0x8c'));}return licenseUtil[_0x6e70('0x86')](_0x48c30c)[_0x6e70('0x23')](function(){return validateUser(_0x48c30c[0x0]);})['then'](function(){for(var _0x4466f0=0x1;_0x4466f0<_0x48c30c['length'];_0x4466f0++){var _0x27bdf2=_0x48c30c[_0x4466f0-0x1][_0x6e70('0x6e')];if(!_0x48c30c[_0x4466f0][_0x6e70('0x6e')])_0x48c30c[_0x4466f0][_0x6e70('0x6e')]=_0x27bdf2+0x1;_0x50e494[_0x6e70('0x8d')](validateUser(_0x48c30c[_0x4466f0]));}return BPromise[_0x6e70('0x8e')](_0x50e494);})[_0x6e70('0x23')](function(){_0x50e494=[];for(var _0xfb1d53=0x0;_0xfb1d53<_0x48c30c[_0x6e70('0x58')];_0xfb1d53++){_0x50e494[_0x6e70('0x8d')](updateUser(_0x48c30c[_0xfb1d53]));}return BPromise['all'](_0x50e494);})[_0x6e70('0x23')](function(){return BPromise[_0x6e70('0x8f')](_0x48c30c,function(_0x31559b){return db[_0x6e70('0x4b')][_0x6e70('0x88')](_0x31559b,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})['then'](function(_0x18f781){_0x31559b['id']=_0x18f781['id'];return _0x31559b;});});})[_0x6e70('0x23')](function(_0x26e8ed){if(_0x395214[_0x6e70('0x69')][_0x6e70('0x39')]===_0x6e70('0x3b'))return _0x26e8ed;if(_0x395214[_0x6e70('0x3b')][_0x6e70('0x39')]!==_0x6e70('0x3b'))return _0x26e8ed;var _0x29b0f4=_[_0x6e70('0x8b')](_0x26e8ed,function(_0x400b20){return _0x400b20[_0x6e70('0x39')]===_0x6e70('0x3c')||_0x400b20[_0x6e70('0x39')]==='telephone';});if(!_0x29b0f4)return _0x26e8ed;return db[_0x6e70('0x90')][_0x6e70('0x64')]({'where':{'name':{'$or':[_0x6e70('0x89'),_0x6e70('0x3d')]},'userProfileId':_0x395214[_0x6e70('0x3b')][_0x6e70('0x87')]},'raw':!![]})['then'](function(_0x52a7b0){if(_[_0x6e70('0x91')](_0x52a7b0)||!_[_0x6e70('0x8b')](_0x52a7b0,[_0x6e70('0x92'),0x0]))return _0x26e8ed;_0x50e494=[];var _0x2b7170=_(_0x52a7b0)[_0x6e70('0x41')](function(_0x213926){if(_0x213926[_0x6e70('0x92')]===0x1)return;return _0x213926['name']===_0x6e70('0x89')?'agent':_0x6e70('0x3e');})[_0x6e70('0x93')]()[_0x6e70('0x42')]();for(var _0x3caa72=0x0;_0x3caa72<_0x26e8ed['length'];_0x3caa72++){if(!_[_0x6e70('0x43')](_0x2b7170,_0x26e8ed[_0x3caa72][_0x6e70('0x39')]))return;var _0x5ee5a5=_0x26e8ed[_0x3caa72][_0x6e70('0x39')]==='agent'?_0x6e70('0x89'):'Telephones';_0x50e494['push'](db[_0x6e70('0x45')][_0x6e70('0x88')]({'name':_0x26e8ed[_0x3caa72][_0x6e70('0x48')],'resourceId':_0x26e8ed[_0x3caa72]['id'],'type':_0x5ee5a5,'sectionId':_['find'](_0x52a7b0,[_0x6e70('0x48'),_0x5ee5a5])['id']},{}));}return BPromise[_0x6e70('0x8e')](_0x50e494);});})['then'](respondWithResult(_0xb273e,0xc9))[_0x6e70('0x2c')](handleError(_0xb273e,null));};exports[_0x6e70('0x94')]=function(_0x270fe2,_0x2d08f2,_0xb2d064){if(_0x270fe2[_0x6e70('0x69')]['id']){delete _0x270fe2[_0x6e70('0x69')]['id'];}return db[_0x6e70('0x4b')][_0x6e70('0x44')]({'where':{'id':_0x270fe2['params']['id']}})['then'](function(_0xb5e3be){if(!_0xb5e3be)return null;if(_0xb5e3be['id']===_0x270fe2['user']['id']){if(!_0x270fe2[_0x6e70('0x69')][_0x6e70('0x95')]||!_0x270fe2['body'][_0x6e70('0x96')]){throw new db[(_0x6e70('0x97'))][(_0x6e70('0x98'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0xb5e3be[_0x6e70('0x99')](_0x270fe2[_0x6e70('0x69')][_0x6e70('0x95')])){throw new db[(_0x6e70('0x97'))][(_0x6e70('0x98'))](_0x6e70('0x9a'));}if(_0x270fe2[_0x6e70('0x69')][_0x6e70('0x95')]===_0x270fe2[_0x6e70('0x69')][_0x6e70('0x96')]){throw new db[(_0x6e70('0x97'))][(_0x6e70('0x98'))](_0x6e70('0x9b'));}}else if(_0x270fe2['user'][_0x6e70('0x39')]===_0x6e70('0x3a')){if(!_0x270fe2[_0x6e70('0x69')][_0x6e70('0x96')]){throw new db[(_0x6e70('0x97'))]['ValidationError'](_0x6e70('0x9c'));}}else if(_0x270fe2[_0x6e70('0x3b')][_0x6e70('0x39')]==='user'){if(!_0x270fe2[_0x6e70('0x69')]['newPassword']){throw new db['Sequelize'][(_0x6e70('0x98'))](_0x6e70('0x9c'));}if(_0xb5e3be[_0x6e70('0x39')]!==_0x6e70('0x3c')){throw new db['Sequelize'][(_0x6e70('0x98'))](_0x6e70('0x83'));}}else{throw new db['Sequelize']['ValidationError']('Unauthorized');}return _0xb5e3be;})[_0x6e70('0x23')](handleEntityNotFound(_0x2d08f2,null))[_0x6e70('0x23')](function(_0x46227d){return db[_0x6e70('0x9d')][_0x6e70('0x9e')]({'attributes':['id',_0x6e70('0x6f'),_0x6e70('0x9f'),'passwordHistoryLimit']})[_0x6e70('0x23')](function(_0x3474c7){if(_0x3474c7[_0x6e70('0x6f')])authService[_0x6e70('0x70')](_0x270fe2[_0x6e70('0x69')][_0x6e70('0x96')]);if(!_0x3474c7[_0x6e70('0x9f')]||!_0x46227d[_0x6e70('0xa0')])return _0x46227d;authService[_0x6e70('0xa1')](_0x270fe2[_0x6e70('0x69')][_0x6e70('0x96')],_0x46227d[_0x6e70('0xa0')],_0x3474c7['passwordHistoryLimit']);return _0x46227d;})[_0x6e70('0x23')](saveUpdates({'password':_0x270fe2[_0x6e70('0x69')][_0x6e70('0x96')],'passwordResetAt':_0x270fe2['user']['id']==_0x270fe2[_0x6e70('0x67')]['id']?moment():null,'previousPasswords':authService[_0x6e70('0xa2')](_0x270fe2[_0x6e70('0x69')][_0x6e70('0x96')],_0x46227d[_0x6e70('0xa0')])},null));})[_0x6e70('0x23')](respondWithResult(_0x2d08f2,null))['catch'](handleError(_0x2d08f2,null));};exports['addQueues']=function(_0x454149,_0x36d119,_0xc93d60){var _0x432794=_0x454149[_0x6e70('0x69')][_0x6e70('0xa3')];return db['User'][_0x6e70('0x44')]({'where':{'id':_0x454149[_0x6e70('0x67')]['id']},'attributes':['id',_0x6e70('0x48'),_0x6e70('0x39'),_0x6e70('0xa4'),_0x6e70('0xa5'),_0x6e70('0xa6'),_0x6e70('0xa7')]})[_0x6e70('0x23')](handleEntityNotFound(_0x36d119,null))[_0x6e70('0x23')](function(_0xd2d74f){if(_0xd2d74f){if(!utils[_0x6e70('0xa8')](_0x432794)){throw new db[(_0x6e70('0x97'))][(_0x6e70('0x98'))](_0x6e70('0xa9'));}return _0xd2d74f[_0x6e70('0xaa')+_[_0x6e70('0xab')](_0x432794['toLowerCase']())+'Queues'](_0x454149[_0x6e70('0x69')][_0x6e70('0x6c')],{'penalty':_0x454149[_0x6e70('0x69')][_0x6e70('0xac')]||0x0})[_0x6e70('0xad')](function(_0x2272c3){for(var _0x58a004=0x0;_0x58a004<_0x454149[_0x6e70('0x69')]['ids'][_0x6e70('0x58')];_0x58a004+=0x1){var _0x4c06bd={'UserId':_0x454149[_0x6e70('0x67')]['id']};_0x4c06bd[_['capitalize'](_0x432794[_0x6e70('0xae')]())+_0x6e70('0xaf')]=_0x454149[_0x6e70('0x69')]['ids'][_0x58a004];socket[_0x6e70('0xb0')](_0x6e70('0x3b')+_[_0x6e70('0xab')](_0x432794[_0x6e70('0xae')]())+_0x6e70('0xb1'),_0x4c06bd);}return _0x2272c3;})[_0x6e70('0x23')](function(){if(_0x432794===_0x6e70('0xb2')){return db['VoiceQueue'][_0x6e70('0x64')]({'where':{'id':_0x454149[_0x6e70('0x69')]['ids']||[]},'raw':!![],'attributes':['id',_0x6e70('0x48')]});}})[_0x6e70('0x23')](function(_0x53ce58){var _0x5cec64=_0xd2d74f[_0x6e70('0x38')]({'plain':!![]});var _0x561de9=[];if(_0x432794===_0x6e70('0xb2')&&_0x5cec64[_0x6e70('0x39')]===_0x6e70('0x3c')&&_0x5cec64[_0x6e70('0xa4')]){for(var _0x4561a5=0x0;_0x4561a5<_0x53ce58[_0x6e70('0x58')];_0x4561a5+=0x1){_0x561de9[_0x6e70('0x8d')]({'membername':_0x5cec64[_0x6e70('0x48')],'UserId':_0x5cec64['id'],'queue_name':_0x53ce58[_0x4561a5][_0x6e70('0x48')],'VoiceQueueId':_0x53ce58[_0x4561a5]['id'],'interface':_[_0x6e70('0x71')](_0x5cec64[_0x6e70('0xa7')])?util[_0x6e70('0xb3')](_0x6e70('0xb4'),_0x5cec64['name']):_0x5cec64[_0x6e70('0xa7')],'paused':_0x5cec64[_0x6e70('0xa6')]||![],'penalty':_0x454149[_0x6e70('0x69')][_0x6e70('0xac')]||0x0});}return BPromise[_0x6e70('0x8f')](_0x561de9,function(_0x29f2ec){return db[_0x6e70('0xb5')][_0x6e70('0xb6')](_0x29f2ec);});}return _0xd2d74f;});}})[_0x6e70('0x23')](respondWithStatusCode(_0x36d119,null))['catch'](handleError(_0x36d119,null));};exports[_0x6e70('0xb7')]=function(_0xa512d1,_0x349387,_0x49fd11){var _0x88522;return db[_0x6e70('0x4b')][_0x6e70('0x44')]({'where':{'id':_0xa512d1[_0x6e70('0x67')]['id']},'attributes':['id','name','role']})[_0x6e70('0x23')](handleEntityNotFound(_0x349387,null))['then'](function(_0x4fa241){if(_0x4fa241){_0x88522=_0x4fa241;if(!_0xa512d1[_0x6e70('0x53')][_0x6e70('0xa3')]||!utils[_0x6e70('0xa8')](_0xa512d1[_0x6e70('0x53')][_0x6e70('0xa3')])){throw new db[(_0x6e70('0x97'))][(_0x6e70('0x98'))](_0x6e70('0xa9'));}return _0x4fa241[_0x6e70('0xb8')+_[_0x6e70('0xab')](_0xa512d1['query'][_0x6e70('0xa3')][_0x6e70('0xae')]())+_0x6e70('0xb9')](_0xa512d1[_0x6e70('0x53')][_0x6e70('0x6c')]);}})[_0x6e70('0x23')](function(_0x2033fa){for(var _0xa9a209=0x0;_0xa9a209<_0xa512d1[_0x6e70('0x53')][_0x6e70('0x6c')]['length'];_0xa9a209+=0x1){var _0x582d29={'UserId':_0xa512d1['params']['id']};_0x582d29[_['capitalize'](_0xa512d1[_0x6e70('0x53')][_0x6e70('0xa3')][_0x6e70('0xae')]())+'QueueId']=_0xa512d1[_0x6e70('0x53')]['ids'][_0xa9a209];socket[_0x6e70('0xb0')]('user'+_['capitalize'](_0xa512d1[_0x6e70('0x53')][_0x6e70('0xa3')][_0x6e70('0xae')]())+_0x6e70('0xba'),_0x582d29);}return _0x2033fa;})[_0x6e70('0x23')](function(){if(_0xa512d1[_0x6e70('0x53')][_0x6e70('0xa3')]==='voice'){return db[_0x6e70('0xb5')][_0x6e70('0x37')]({'where':{'UserId':_0xa512d1['params']['id'],'VoiceQueueId':_0xa512d1[_0x6e70('0x53')][_0x6e70('0x6c')]},'individualHooks':!![]})[_0x6e70('0x23')](function(){return _0x88522;});}return _0x88522;})['then'](respondWithStatusCode(_0x349387,null))[_0x6e70('0x2c')](handleError(_0x349387,null));};exports[_0x6e70('0xbb')]=function(_0x5516b9,_0x502927,_0x18f71f){_0x5516b9[_0x6e70('0x69')][_0x6e70('0xbc')]=_0x5516b9[_0x6e70('0xbd')][_0x6e70('0xbe')];return db['User']['find']({'where':{'id':_0x5516b9[_0x6e70('0x67')]['id']}})[_0x6e70('0x23')](handleEntityNotFound(_0x502927,null))[_0x6e70('0x23')](saveUpdates(_0x5516b9['body'],null))[_0x6e70('0x23')](respondWithResult(_0x502927,null))[_0x6e70('0x2c')](handleError(_0x502927,null));};exports[_0x6e70('0xbf')]=function(_0x231873,_0x3adb11,_0x165291){var _0x3c888d=path[_0x6e70('0xc0')](config[_0x6e70('0xc1')],_0x6e70('0xc2'));return db['User'][_0x6e70('0x44')]({'where':{'id':_0x231873[_0x6e70('0x67')]['id']},'attributes':['id',_0x6e70('0xbc')],'raw':!![]})[_0x6e70('0x23')](handleEntityNotFound(_0x3adb11,null))['then'](function(_0x7ffbdf){if(_0x7ffbdf){if(_[_0x6e70('0x71')](_0x7ffbdf[_0x6e70('0xbc')])){return _0x3adb11['download'](_0x3c888d);}else{if(!fs[_0x6e70('0xc3')](path[_0x6e70('0xc0')](config[_0x6e70('0xc1')],_0x6e70('0xc4'),_0x7ffbdf['userpic']))){return _0x3adb11[_0x6e70('0xc5')](_0x3c888d);}return _0x3adb11[_0x6e70('0xc5')](path[_0x6e70('0xc0')](config[_0x6e70('0xc1')],_0x6e70('0xc4'),_0x7ffbdf[_0x6e70('0xbc')]));}}})[_0x6e70('0x2c')](handleError(_0x3adb11,null));};exports[_0x6e70('0xc6')]=function(_0x2eb49f,_0x46a4c2,_0x4e0788){var _0x53f283={};var _0x11b784={};var _0x3dec80;var _0x323887;return db[_0x6e70('0x4b')][_0x6e70('0x9e')]({'where':{'id':_0x2eb49f[_0x6e70('0x67')]['id']}})[_0x6e70('0x23')](handleEntityNotFound(_0x46a4c2,null))[_0x6e70('0x23')](function(_0x3d4dc3){if(_0x3d4dc3){_0x3dec80=_0x3d4dc3;_0x11b784[_0x6e70('0x4f')]=_[_0x6e70('0x52')](db[_0x6e70('0xc7')][_0x6e70('0x4c')]);_0x11b784[_0x6e70('0x53')]=_[_0x6e70('0x52')](_0x2eb49f['query']);_0x11b784[_0x6e70('0x54')]=_[_0x6e70('0x55')](_0x11b784[_0x6e70('0x4f')],_0x11b784['query']);_0x53f283[_0x6e70('0x57')]=_[_0x6e70('0x55')](_0x11b784[_0x6e70('0x4f')],qs[_0x6e70('0x56')](_0x2eb49f[_0x6e70('0x53')][_0x6e70('0x56')]));_0x53f283['attributes']=_0x53f283[_0x6e70('0x57')][_0x6e70('0x58')]?_0x53f283['attributes']:_0x11b784[_0x6e70('0x4f')];_0x53f283[_0x6e70('0x5a')]=qs[_0x6e70('0x5b')](_0x2eb49f[_0x6e70('0x53')][_0x6e70('0x5b')]);_0x53f283['where']=qs['filters'](_[_0x6e70('0x5c')](_0x2eb49f['query'],_0x11b784[_0x6e70('0x54')]));if(_0x2eb49f[_0x6e70('0x53')][_0x6e70('0x3f')]){_0x53f283[_0x6e70('0x5d')]=_[_0x6e70('0x5e')](_0x53f283['where'],{'$or':_[_0x6e70('0x41')](_0x53f283[_0x6e70('0x57')],function(_0x27c06b){var _0x14086b={};_0x14086b[_0x27c06b]={'$like':'%'+_0x2eb49f[_0x6e70('0x53')][_0x6e70('0x3f')]+'%'};return _0x14086b;})});}_0x53f283=_['merge']({},_0x53f283,_0x2eb49f['options']);return _0x3dec80[_0x6e70('0xc6')](_0x53f283);}})[_0x6e70('0x23')](function(_0x1f47f1){if(_0x1f47f1){_0x323887=_0x1f47f1[_0x6e70('0x58')];if(_0x2eb49f['query']['hasOwnProperty'](_0x6e70('0x62'))){_0x53f283[_0x6e70('0x63')]=[{'model':db['CmList'],'as':_0x6e70('0xc8'),'required':![]},{'model':db[_0x6e70('0xc9')],'as':_0x6e70('0xca'),'attributes':['id','name',_0x6e70('0xcb')],'where':_0x2eb49f[_0x6e70('0x53')]['tag']?{'id':_0x2eb49f[_0x6e70('0x53')]['tag']}:undefined,'required':_0x2eb49f[_0x6e70('0x53')][_0x6e70('0xcc')]?!![]:![]}];}if(!_0x2eb49f[_0x6e70('0x53')]['hasOwnProperty'](_0x6e70('0xcd'))){_0x53f283[_0x6e70('0x32')]=qs[_0x6e70('0x32')](_0x2eb49f[_0x6e70('0x53')][_0x6e70('0x32')]);_0x53f283['offset']=qs[_0x6e70('0x31')](_0x2eb49f['query'][_0x6e70('0x31')]);}return _0x3dec80[_0x6e70('0xc6')](_0x53f283);}})[_0x6e70('0x23')](function(_0x1be934){if(_0x1be934){return _0x1be934?{'count':_0x323887,'rows':_0x1be934}:null;}})[_0x6e70('0x23')](respondWithResult(_0x46a4c2,null))[_0x6e70('0x2c')](handleError(_0x46a4c2,null));};exports[_0x6e70('0xce')]=function(_0x234cbf,_0x59ff93,_0x3fdd9b){var _0x4e3b0c;var _0x337d22;var _0x35e889={};var _0x2e7bb1;return db[_0x6e70('0x4b')]['findOne']({'where':{'id':_0x234cbf[_0x6e70('0x67')]['id']},'attributes':['id','name','role']})[_0x6e70('0x23')](handleEntityNotFound(_0x59ff93,null))['then'](function(_0x114df8){if(!utils[_0x6e70('0xa8')](_0x234cbf[_0x6e70('0x53')]['channel'])){throw new db['Sequelize'][(_0x6e70('0x98'))](_0x6e70('0xa9'));}_0x4e3b0c=_0x114df8;var _0x2752a5={};_0x2752a5[_0x6e70('0x4f')]=_[_0x6e70('0x52')](db[_[_0x6e70('0xab')](_0x234cbf['query'][_0x6e70('0xa3')])+'Queue']['rawAttributes']);_0x2752a5['query']=_[_0x6e70('0x52')](_0x234cbf[_0x6e70('0x53')]);_0x2752a5['filters']=_[_0x6e70('0x55')](_0x2752a5['model'],_0x2752a5[_0x6e70('0x53')]);_0x35e889[_0x6e70('0x57')]=_[_0x6e70('0x55')](_0x2752a5[_0x6e70('0x4f')],qs[_0x6e70('0x56')](_0x234cbf[_0x6e70('0x53')][_0x6e70('0x56')]));_0x35e889[_0x6e70('0x57')]=_0x35e889[_0x6e70('0x57')][_0x6e70('0x58')]?_0x35e889[_0x6e70('0x57')]:_0x2752a5[_0x6e70('0x4f')];_0x35e889['order']=qs['sort'](_0x234cbf[_0x6e70('0x53')][_0x6e70('0x5b')]);_0x35e889[_0x6e70('0x5d')]=qs[_0x6e70('0x54')](_['pick'](_0x234cbf['query'],_0x2752a5[_0x6e70('0x54')]));if(_0x234cbf[_0x6e70('0x53')][_0x6e70('0x3f')]){_0x35e889[_0x6e70('0x5d')]=_['merge'](_0x35e889[_0x6e70('0x5d')],{'$or':_['map'](_0x35e889[_0x6e70('0x57')],function(_0x66728e){var _0x15ca6c={};_0x15ca6c[_0x66728e]={'$like':'%'+_0x234cbf[_0x6e70('0x53')][_0x6e70('0x3f')]+'%'};return _0x15ca6c;})});}_0x35e889=_['merge']({},_0x35e889,_0x234cbf[_0x6e70('0xcf')]);switch(_0x4e3b0c[_0x6e70('0x39')]){case _0x6e70('0x3a'):return db[_['capitalize'](_0x234cbf[_0x6e70('0x53')][_0x6e70('0xa3')])+_0x6e70('0xd0')][_0x6e70('0x64')](_0x35e889);case _0x6e70('0x3b'):case _0x6e70('0x3c'):return _0x4e3b0c[_0x6e70('0x38')+_[_0x6e70('0xab')](_0x234cbf[_0x6e70('0x53')][_0x6e70('0xa3')])+_0x6e70('0xb9')](_0x35e889);default:throw new db[(_0x6e70('0x97'))][(_0x6e70('0x98'))](_0x6e70('0xd1'));}})[_0x6e70('0x23')](function(_0x1f95a4){_0x2e7bb1=_0x1f95a4[_0x6e70('0x58')];if(!_0x234cbf[_0x6e70('0x53')][_0x6e70('0x59')](_0x6e70('0xcd'))){_0x35e889[_0x6e70('0x32')]=qs['limit'](_0x234cbf[_0x6e70('0x53')]['limit']);_0x35e889['offset']=qs['offset'](_0x234cbf['query'][_0x6e70('0x31')]);}switch(_0x4e3b0c[_0x6e70('0x39')]){case _0x6e70('0x3a'):return db[_[_0x6e70('0xab')](_0x234cbf[_0x6e70('0x53')][_0x6e70('0xa3')])+_0x6e70('0xd0')]['findAll'](_0x35e889);case _0x6e70('0x3b'):case _0x6e70('0x3c'):return _0x4e3b0c['get'+_['capitalize'](_0x234cbf[_0x6e70('0x53')][_0x6e70('0xa3')])+_0x6e70('0xb9')](_0x35e889);}})[_0x6e70('0x23')](function(_0x25930f){return{'count':_0x2e7bb1,'rows':_0x25930f};})['then'](respondWithResult(_0x59ff93,null))['catch'](handleError(_0x59ff93,null));};exports[_0x6e70('0xd2')]=function(_0x198b0a,_0x1e7c5e,_0x4bdbb7){var _0x3b2047={};var _0x1a4177={};var _0x1c9bce;var _0x5be572;return db['User'][_0x6e70('0x9e')]({'where':{'id':_0x198b0a[_0x6e70('0x67')]['id']}})[_0x6e70('0x23')](handleEntityNotFound(_0x1e7c5e,null))[_0x6e70('0x23')](function(_0x23c273){if(_0x23c273){_0x1c9bce=_0x23c273;_0x1a4177['model']=_['keys'](db[_0x6e70('0xb5')][_0x6e70('0x4c')]);_0x1a4177[_0x6e70('0x53')]=_['keys'](_0x198b0a[_0x6e70('0x53')]);_0x1a4177[_0x6e70('0x54')]=_[_0x6e70('0x55')](_0x1a4177['model'],_0x1a4177[_0x6e70('0x53')]);_0x3b2047['attributes']=_[_0x6e70('0x55')](_0x1a4177[_0x6e70('0x4f')],qs['fields'](_0x198b0a[_0x6e70('0x53')][_0x6e70('0x56')]));_0x3b2047['attributes']=_0x3b2047[_0x6e70('0x57')][_0x6e70('0x58')]?_0x3b2047[_0x6e70('0x57')]:_0x1a4177[_0x6e70('0x4f')];_0x3b2047[_0x6e70('0x5a')]=qs[_0x6e70('0x5b')](_0x198b0a[_0x6e70('0x53')][_0x6e70('0x5b')]);_0x3b2047[_0x6e70('0x5d')]=qs[_0x6e70('0x54')](_['pick'](_0x198b0a['query'],_0x1a4177[_0x6e70('0x54')]));if(_0x198b0a['query'][_0x6e70('0x3f')]){_0x3b2047[_0x6e70('0x5d')]=_[_0x6e70('0x5e')](_0x3b2047[_0x6e70('0x5d')],{'$or':_[_0x6e70('0x41')](_0x3b2047[_0x6e70('0x57')],function(_0x1ba6f7){var _0x3a9260={};_0x3a9260[_0x1ba6f7]={'$like':'%'+_0x198b0a[_0x6e70('0x53')]['filter']+'%'};return _0x3a9260;})});}_0x3b2047=_['merge']({},_0x3b2047,_0x198b0a['options']);return _0x1c9bce[_0x6e70('0xd2')](_0x3b2047);}})['then'](function(_0x1681f0){if(_0x1681f0){_0x5be572=_0x1681f0[_0x6e70('0x58')];if(!_0x198b0a[_0x6e70('0x53')][_0x6e70('0x59')](_0x6e70('0xcd'))){_0x3b2047[_0x6e70('0x32')]=qs['limit'](_0x198b0a[_0x6e70('0x53')][_0x6e70('0x32')]);_0x3b2047[_0x6e70('0x31')]=qs[_0x6e70('0x31')](_0x198b0a[_0x6e70('0x53')][_0x6e70('0x31')]);}return _0x1c9bce[_0x6e70('0xd2')](_0x3b2047);}})['then'](function(_0x10ede6){if(_0x10ede6){return _0x10ede6?{'count':_0x5be572,'rows':_0x10ede6}:null;}})[_0x6e70('0x23')](respondWithResult(_0x1e7c5e,null))['catch'](handleError(_0x1e7c5e,null));};exports[_0x6e70('0xd3')]=function(_0x442f89,_0x5734d6,_0x4d712d){var _0x1767ff={};var _0x2f656c={};var _0x52035a;var _0x367dd2;return db[_0x6e70('0x4b')][_0x6e70('0x9e')]({'where':{'id':_0x442f89[_0x6e70('0x67')]['id']}})[_0x6e70('0x23')](handleEntityNotFound(_0x5734d6,null))['then'](function(_0x350536){if(_0x350536){_0x52035a=_0x350536;_0x2f656c[_0x6e70('0x4f')]=_['keys'](db[_0x6e70('0xd4')]['rawAttributes']);_0x2f656c['query']=_['keys'](_0x442f89[_0x6e70('0x53')]);_0x2f656c[_0x6e70('0x54')]=_['intersection'](_0x2f656c[_0x6e70('0x4f')],_0x2f656c[_0x6e70('0x53')]);_0x1767ff['attributes']=_['intersection'](_0x2f656c[_0x6e70('0x4f')],qs[_0x6e70('0x56')](_0x442f89['query'][_0x6e70('0x56')]));_0x1767ff[_0x6e70('0x57')]=_0x1767ff[_0x6e70('0x57')][_0x6e70('0x58')]?_0x1767ff['attributes']:_0x2f656c[_0x6e70('0x4f')];_0x1767ff['order']=qs['sort'](_0x442f89['query'][_0x6e70('0x5b')]);_0x1767ff['where']=qs[_0x6e70('0x54')](_[_0x6e70('0x5c')](_0x442f89[_0x6e70('0x53')],_0x2f656c['filters']));if(_0x442f89['query'][_0x6e70('0x3f')]){_0x1767ff['where']=_[_0x6e70('0x5e')](_0x1767ff[_0x6e70('0x5d')],{'$or':_[_0x6e70('0x41')](_0x1767ff[_0x6e70('0x57')],function(_0x2c5d28){var _0x204c3a={};_0x204c3a[_0x2c5d28]={'$like':'%'+_0x442f89[_0x6e70('0x53')]['filter']+'%'};return _0x204c3a;})});}_0x1767ff=_[_0x6e70('0x5e')]({},_0x1767ff,_0x442f89[_0x6e70('0xcf')]);return _0x52035a[_0x6e70('0xd3')](_0x1767ff);}})[_0x6e70('0x23')](function(_0x54ed01){if(_0x54ed01){_0x367dd2=_0x54ed01[_0x6e70('0x58')];if(!_0x442f89[_0x6e70('0x53')][_0x6e70('0x59')]('nolimit')){_0x1767ff[_0x6e70('0x32')]=qs[_0x6e70('0x32')](_0x442f89[_0x6e70('0x53')][_0x6e70('0x32')]);_0x1767ff['offset']=qs[_0x6e70('0x31')](_0x442f89[_0x6e70('0x53')][_0x6e70('0x31')]);}return _0x52035a[_0x6e70('0xd3')](_0x1767ff);}})['then'](function(_0x20bb7c){if(_0x20bb7c){return _0x20bb7c?{'count':_0x367dd2,'rows':_0x20bb7c}:null;}})[_0x6e70('0x23')](respondWithResult(_0x5734d6,null))[_0x6e70('0x2c')](handleError(_0x5734d6,null));};exports[_0x6e70('0xd5')]=function(_0xc9483c,_0xb6a345,_0xfe0b8b){var _0xa38468={'raw':!![],'where':{}};var _0x40201f={};var _0x383786={'count':0x0,'rows':[]};return db[_0x6e70('0x4b')][_0x6e70('0x9e')]({'where':{'id':_0xc9483c['params']['id']}})[_0x6e70('0x23')](handleEntityNotFound(_0xb6a345,null))[_0x6e70('0x23')](function(_0x8bec73){if(_0x8bec73){_0x40201f[_0x6e70('0x4f')]=_[_0x6e70('0x52')](db['VoiceRecording']['rawAttributes']);_0x40201f[_0x6e70('0x53')]=_[_0x6e70('0x52')](_0xc9483c[_0x6e70('0x53')]);_0x40201f['filters']=_['intersection'](_0x40201f[_0x6e70('0x4f')],_0x40201f[_0x6e70('0x53')]);_0xa38468['attributes']=_[_0x6e70('0x55')](_0x40201f[_0x6e70('0x4f')],qs[_0x6e70('0x56')](_0xc9483c[_0x6e70('0x53')][_0x6e70('0x56')]));_0xa38468[_0x6e70('0x57')]=_0xa38468[_0x6e70('0x57')][_0x6e70('0x58')]?_0xa38468[_0x6e70('0x57')]:_0x40201f[_0x6e70('0x4f')];if(!_0xc9483c[_0x6e70('0x53')][_0x6e70('0x59')](_0x6e70('0xcd'))){_0xa38468[_0x6e70('0x32')]=qs['limit'](_0xc9483c[_0x6e70('0x53')][_0x6e70('0x32')]);_0xa38468['offset']=qs[_0x6e70('0x31')](_0xc9483c['query'][_0x6e70('0x31')]);}_0xa38468['order']=qs[_0x6e70('0x5b')](_0xc9483c[_0x6e70('0x53')]['sort']);_0xa38468[_0x6e70('0x5d')]=qs['filters'](_['pick'](_0xc9483c[_0x6e70('0x53')],_0x40201f[_0x6e70('0x54')]));_0xa38468[_0x6e70('0x5d')][_0x6e70('0xd6')]=_0x8bec73['id'];if(_0xc9483c[_0x6e70('0x53')][_0x6e70('0x3f')]){_0xa38468[_0x6e70('0x5d')]=_[_0x6e70('0x5e')](_0xa38468[_0x6e70('0x5d')],{'$or':_[_0x6e70('0x41')](_0xa38468[_0x6e70('0x57')],function(_0x128a24){var _0x24e8e8={};_0x24e8e8[_0x128a24]={'$like':'%'+_0xc9483c[_0x6e70('0x53')][_0x6e70('0x3f')]+'%'};return _0x24e8e8;})});}_0xa38468=_[_0x6e70('0x5e')]({},_0xa38468,_0xc9483c[_0x6e70('0xcf')]);return db[_0x6e70('0xd7')][_0x6e70('0x30')]({'where':_0xa38468['where']})[_0x6e70('0x23')](function(_0x56cc9b){_0x383786[_0x6e70('0x30')]=_0x56cc9b;if(_0xc9483c['query'][_0x6e70('0x62')]){_0xa38468[_0x6e70('0x63')]=[{'all':!![]}];}return db[_0x6e70('0xd7')]['findAll'](_0xa38468);})[_0x6e70('0x23')](function(_0x283c0f){_0x383786[_0x6e70('0x65')]=_0x283c0f;return _0x383786;});}})[_0x6e70('0x23')](respondWithFilteredResult(_0xb6a345,_0xa38468))[_0x6e70('0x2c')](handleError(_0xb6a345,null));};exports[_0x6e70('0xd8')]=function(_0x49baa4,_0xdcb1a2,_0x10c7c3){var _0x41270a={'raw':!![],'where':{}};var _0x533169={};var _0x545c9c={'count':0x0,'rows':[]};return db[_0x6e70('0x4b')][_0x6e70('0x9e')]({'where':{'id':_0x49baa4[_0x6e70('0x67')]['id']}})[_0x6e70('0x23')](handleEntityNotFound(_0xdcb1a2,null))[_0x6e70('0x23')](function(_0x4aa88f){if(_0x4aa88f){_0x533169[_0x6e70('0x4f')]=_[_0x6e70('0x52')](db[_0x6e70('0xd9')][_0x6e70('0x4c')]);_0x533169[_0x6e70('0x53')]=_[_0x6e70('0x52')](_0x49baa4[_0x6e70('0x53')]);_0x533169[_0x6e70('0x54')]=_[_0x6e70('0x55')](_0x533169[_0x6e70('0x4f')],_0x533169[_0x6e70('0x53')]);_0x41270a[_0x6e70('0x57')]=_[_0x6e70('0x55')](_0x533169[_0x6e70('0x4f')],qs['fields'](_0x49baa4[_0x6e70('0x53')][_0x6e70('0x56')]));_0x41270a[_0x6e70('0x57')]=_0x41270a['attributes'][_0x6e70('0x58')]?_0x41270a[_0x6e70('0x57')]:_0x533169[_0x6e70('0x4f')];if(!_0x49baa4[_0x6e70('0x53')]['hasOwnProperty']('nolimit')){_0x41270a[_0x6e70('0x32')]=qs['limit'](_0x49baa4[_0x6e70('0x53')]['limit']);_0x41270a['offset']=qs[_0x6e70('0x31')](_0x49baa4[_0x6e70('0x53')][_0x6e70('0x31')]);}_0x41270a['order']=qs['sort'](_0x49baa4[_0x6e70('0x53')][_0x6e70('0x5b')]);_0x41270a[_0x6e70('0x5d')]=qs['filters'](_[_0x6e70('0x5c')](_0x49baa4[_0x6e70('0x53')],_0x533169['filters']));_0x41270a['where']['UserId']=_0x4aa88f['id'];if(_0x49baa4['query'][_0x6e70('0x3f')]){_0x41270a[_0x6e70('0x5d')]=_[_0x6e70('0x5e')](_0x41270a[_0x6e70('0x5d')],{'$or':_['map'](_0x41270a[_0x6e70('0x57')],function(_0x277cfe){var _0x241666={};_0x241666[_0x277cfe]={'$like':'%'+_0x49baa4['query'][_0x6e70('0x3f')]+'%'};return _0x241666;})});}_0x41270a=_[_0x6e70('0x5e')]({},_0x41270a,_0x49baa4[_0x6e70('0xcf')]);return db[_0x6e70('0xd9')][_0x6e70('0x30')]({'where':_0x41270a[_0x6e70('0x5d')]})[_0x6e70('0x23')](function(_0x2fea44){_0x545c9c['count']=_0x2fea44;if(_0x49baa4[_0x6e70('0x53')][_0x6e70('0x62')]){_0x41270a['include']=[{'all':!![]}];}return db[_0x6e70('0xd9')][_0x6e70('0x64')](_0x41270a);})[_0x6e70('0x23')](function(_0x1a335a){_0x545c9c[_0x6e70('0x65')]=_0x1a335a;return _0x545c9c;});}})[_0x6e70('0x23')](respondWithFilteredResult(_0xdcb1a2,_0x41270a))[_0x6e70('0x2c')](handleError(_0xdcb1a2,null));};exports[_0x6e70('0xda')]=function(_0x31a54d,_0x1751e3,_0xa0c226){var _0x151ba4={};var _0x1e1ac9={};var _0x5a7286;var _0x275c72;return db[_0x6e70('0x4b')][_0x6e70('0x9e')]({'where':{'id':_0x31a54d['params']['id']}})[_0x6e70('0x23')](handleEntityNotFound(_0x1751e3,null))[_0x6e70('0x23')](function(_0x313fb1){if(_0x313fb1){_0x5a7286=_0x313fb1;_0x1e1ac9[_0x6e70('0x4f')]=_[_0x6e70('0x52')](db[_0x6e70('0xdb')][_0x6e70('0x4c')]);_0x1e1ac9[_0x6e70('0x53')]=_['keys'](_0x31a54d[_0x6e70('0x53')]);_0x1e1ac9[_0x6e70('0x54')]=_[_0x6e70('0x55')](_0x1e1ac9[_0x6e70('0x4f')],_0x1e1ac9[_0x6e70('0x53')]);_0x151ba4[_0x6e70('0x57')]=_['intersection'](_0x1e1ac9[_0x6e70('0x4f')],qs[_0x6e70('0x56')](_0x31a54d[_0x6e70('0x53')][_0x6e70('0x56')]));_0x151ba4[_0x6e70('0x57')]=_0x151ba4[_0x6e70('0x57')][_0x6e70('0x58')]?_0x151ba4[_0x6e70('0x57')]:_0x1e1ac9[_0x6e70('0x4f')];_0x151ba4['order']=qs[_0x6e70('0x5b')](_0x31a54d['query'][_0x6e70('0x5b')]);_0x151ba4[_0x6e70('0x5d')]=qs[_0x6e70('0x54')](_[_0x6e70('0x5c')](_0x31a54d[_0x6e70('0x53')],_0x1e1ac9[_0x6e70('0x54')]));if(_0x31a54d['query'][_0x6e70('0x3f')]){_0x151ba4[_0x6e70('0x5d')]=_[_0x6e70('0x5e')](_0x151ba4['where'],{'$or':_[_0x6e70('0x41')](_0x151ba4[_0x6e70('0x57')],function(_0x52e22f){var _0x1f4d3d={};_0x1f4d3d[_0x52e22f]={'$like':'%'+_0x31a54d[_0x6e70('0x53')][_0x6e70('0x3f')]+'%'};return _0x1f4d3d;})});}_0x151ba4=_[_0x6e70('0x5e')]({},_0x151ba4,_0x31a54d[_0x6e70('0xcf')]);return _0x5a7286['getChatInteractions'](_0x151ba4);}})[_0x6e70('0x23')](function(_0x377fc9){if(_0x377fc9){_0x275c72=_0x377fc9['length'];if(!_0x31a54d[_0x6e70('0x53')][_0x6e70('0x59')](_0x6e70('0xcd'))){_0x151ba4[_0x6e70('0x32')]=qs[_0x6e70('0x32')](_0x31a54d[_0x6e70('0x53')][_0x6e70('0x32')]);_0x151ba4[_0x6e70('0x31')]=qs['offset'](_0x31a54d['query'][_0x6e70('0x31')]);}return _0x5a7286['getChatInteractions'](_0x151ba4);}})[_0x6e70('0x23')](function(_0x1780cc){if(_0x1780cc){return _0x1780cc?{'count':_0x275c72,'rows':_0x1780cc}:null;}})[_0x6e70('0x23')](respondWithResult(_0x1751e3,null))[_0x6e70('0x2c')](handleError(_0x1751e3,null));};exports['getOpenchannelInteractions']=function(_0x2b3a7f,_0x403eea,_0x502ba3){var _0x32959a={};var _0x23c9cb={};var _0x3da2e1;var _0x582ffd;return db[_0x6e70('0x4b')][_0x6e70('0x9e')]({'where':{'id':_0x2b3a7f[_0x6e70('0x67')]['id']}})[_0x6e70('0x23')](handleEntityNotFound(_0x403eea,null))[_0x6e70('0x23')](function(_0x3d7117){if(_0x3d7117){_0x3da2e1=_0x3d7117;_0x23c9cb[_0x6e70('0x4f')]=_[_0x6e70('0x52')](db[_0x6e70('0xdc')][_0x6e70('0x4c')]);_0x23c9cb[_0x6e70('0x53')]=_[_0x6e70('0x52')](_0x2b3a7f[_0x6e70('0x53')]);_0x23c9cb[_0x6e70('0x54')]=_[_0x6e70('0x55')](_0x23c9cb['model'],_0x23c9cb[_0x6e70('0x53')]);_0x32959a[_0x6e70('0x57')]=_[_0x6e70('0x55')](_0x23c9cb[_0x6e70('0x4f')],qs[_0x6e70('0x56')](_0x2b3a7f[_0x6e70('0x53')]['fields']));_0x32959a[_0x6e70('0x57')]=_0x32959a[_0x6e70('0x57')]['length']?_0x32959a['attributes']:_0x23c9cb[_0x6e70('0x4f')];_0x32959a[_0x6e70('0x5a')]=qs[_0x6e70('0x5b')](_0x2b3a7f[_0x6e70('0x53')][_0x6e70('0x5b')]);_0x32959a[_0x6e70('0x5d')]=qs[_0x6e70('0x54')](_['pick'](_0x2b3a7f['query'],_0x23c9cb[_0x6e70('0x54')]));if(_0x2b3a7f[_0x6e70('0x53')][_0x6e70('0x3f')]){_0x32959a[_0x6e70('0x5d')]=_[_0x6e70('0x5e')](_0x32959a['where'],{'$or':_[_0x6e70('0x41')](_0x32959a[_0x6e70('0x57')],function(_0x2ac092){var _0xbfc11d={};_0xbfc11d[_0x2ac092]={'$like':'%'+_0x2b3a7f[_0x6e70('0x53')][_0x6e70('0x3f')]+'%'};return _0xbfc11d;})});}_0x32959a=_['merge']({},_0x32959a,_0x2b3a7f[_0x6e70('0xcf')]);return _0x3da2e1[_0x6e70('0xdd')](_0x32959a);}})[_0x6e70('0x23')](function(_0xbcaf1){if(_0xbcaf1){_0x582ffd=_0xbcaf1[_0x6e70('0x58')];if(!_0x2b3a7f[_0x6e70('0x53')][_0x6e70('0x59')](_0x6e70('0xcd'))){_0x32959a[_0x6e70('0x32')]=qs[_0x6e70('0x32')](_0x2b3a7f[_0x6e70('0x53')][_0x6e70('0x32')]);_0x32959a[_0x6e70('0x31')]=qs['offset'](_0x2b3a7f[_0x6e70('0x53')][_0x6e70('0x31')]);}return _0x3da2e1[_0x6e70('0xdd')](_0x32959a);}})[_0x6e70('0x23')](function(_0x204979){if(_0x204979){return _0x204979?{'count':_0x582ffd,'rows':_0x204979}:null;}})[_0x6e70('0x23')](respondWithResult(_0x403eea,null))[_0x6e70('0x2c')](handleError(_0x403eea,null));};exports[_0x6e70('0xde')]=function(_0x25a840,_0x28c3a5,_0x1b88a9){var _0x35a444={'raw':!![],'where':{}};var _0x57d646={};var _0x146d63={'count':0x0,'rows':[]};return db[_0x6e70('0x4b')]['findOne']({'where':{'id':_0x25a840[_0x6e70('0x67')]['id']}})['then'](handleEntityNotFound(_0x28c3a5,null))[_0x6e70('0x23')](function(_0x267afe){if(_0x267afe){_0x57d646[_0x6e70('0x4f')]=_['keys'](db['MailInteraction'][_0x6e70('0x4c')]);_0x57d646['query']=_[_0x6e70('0x52')](_0x25a840[_0x6e70('0x53')]);_0x57d646['filters']=_['intersection'](_0x57d646[_0x6e70('0x4f')],_0x57d646['query']);_0x35a444[_0x6e70('0x57')]=_[_0x6e70('0x55')](_0x57d646[_0x6e70('0x4f')],qs[_0x6e70('0x56')](_0x25a840[_0x6e70('0x53')][_0x6e70('0x56')]));_0x35a444[_0x6e70('0x57')]=_0x35a444[_0x6e70('0x57')][_0x6e70('0x58')]?_0x35a444['attributes']:_0x57d646[_0x6e70('0x4f')];if(!_0x25a840['query'][_0x6e70('0x59')](_0x6e70('0xcd'))){_0x35a444[_0x6e70('0x32')]=qs[_0x6e70('0x32')](_0x25a840[_0x6e70('0x53')][_0x6e70('0x32')]);_0x35a444[_0x6e70('0x31')]=qs[_0x6e70('0x31')](_0x25a840[_0x6e70('0x53')]['offset']);}_0x35a444[_0x6e70('0x5a')]=qs['sort'](_0x25a840[_0x6e70('0x53')][_0x6e70('0x5b')]);_0x35a444[_0x6e70('0x5d')]=qs[_0x6e70('0x54')](_[_0x6e70('0x5c')](_0x25a840[_0x6e70('0x53')],_0x57d646['filters']));_0x35a444[_0x6e70('0x5d')][_0x6e70('0xd6')]=_0x267afe['id'];if(_0x25a840[_0x6e70('0x53')][_0x6e70('0x3f')]){_0x35a444[_0x6e70('0x5d')]=_[_0x6e70('0x5e')](_0x35a444[_0x6e70('0x5d')],{'$or':_[_0x6e70('0x41')](_0x35a444['attributes'],function(_0x1e37c3){var _0x14b0a3={};_0x14b0a3[_0x1e37c3]={'$like':'%'+_0x25a840[_0x6e70('0x53')][_0x6e70('0x3f')]+'%'};return _0x14b0a3;})});}_0x35a444=_['merge']({},_0x35a444,_0x25a840[_0x6e70('0xcf')]);return db['MailInteraction']['count']({'where':_0x35a444[_0x6e70('0x5d')]})[_0x6e70('0x23')](function(_0x25f977){_0x146d63[_0x6e70('0x30')]=_0x25f977;if(_0x25a840['query']['includeAll']){_0x35a444[_0x6e70('0x63')]=[{'all':!![]}];}return db[_0x6e70('0xdf')][_0x6e70('0x64')](_0x35a444);})['then'](function(_0x22f321){_0x146d63['rows']=_0x22f321;return _0x146d63;});}})[_0x6e70('0x23')](respondWithFilteredResult(_0x28c3a5,_0x35a444))[_0x6e70('0x2c')](handleError(_0x28c3a5,null));};exports['getSmsInteractions']=function(_0xdcbe6c,_0x406409,_0x3514b9){var _0x2d3922={};var _0x49d5f8={};var _0x463448;var _0x373f7c;return db[_0x6e70('0x4b')][_0x6e70('0x9e')]({'where':{'id':_0xdcbe6c['params']['id']}})[_0x6e70('0x23')](handleEntityNotFound(_0x406409,null))['then'](function(_0x3677fe){if(_0x3677fe){_0x463448=_0x3677fe;_0x49d5f8[_0x6e70('0x4f')]=_[_0x6e70('0x52')](db[_0x6e70('0xe0')][_0x6e70('0x4c')]);_0x49d5f8[_0x6e70('0x53')]=_[_0x6e70('0x52')](_0xdcbe6c[_0x6e70('0x53')]);_0x49d5f8[_0x6e70('0x54')]=_[_0x6e70('0x55')](_0x49d5f8[_0x6e70('0x4f')],_0x49d5f8[_0x6e70('0x53')]);_0x2d3922[_0x6e70('0x57')]=_[_0x6e70('0x55')](_0x49d5f8[_0x6e70('0x4f')],qs['fields'](_0xdcbe6c['query'][_0x6e70('0x56')]));_0x2d3922[_0x6e70('0x57')]=_0x2d3922[_0x6e70('0x57')]['length']?_0x2d3922[_0x6e70('0x57')]:_0x49d5f8[_0x6e70('0x4f')];_0x2d3922['order']=qs['sort'](_0xdcbe6c[_0x6e70('0x53')][_0x6e70('0x5b')]);_0x2d3922[_0x6e70('0x5d')]=qs[_0x6e70('0x54')](_[_0x6e70('0x5c')](_0xdcbe6c[_0x6e70('0x53')],_0x49d5f8[_0x6e70('0x54')]));if(_0xdcbe6c['query'][_0x6e70('0x3f')]){_0x2d3922[_0x6e70('0x5d')]=_[_0x6e70('0x5e')](_0x2d3922[_0x6e70('0x5d')],{'$or':_['map'](_0x2d3922[_0x6e70('0x57')],function(_0x1dfc0e){var _0x378d3d={};_0x378d3d[_0x1dfc0e]={'$like':'%'+_0xdcbe6c[_0x6e70('0x53')][_0x6e70('0x3f')]+'%'};return _0x378d3d;})});}_0x2d3922=_[_0x6e70('0x5e')]({},_0x2d3922,_0xdcbe6c[_0x6e70('0xcf')]);return _0x463448[_0x6e70('0xe1')](_0x2d3922);}})[_0x6e70('0x23')](function(_0x22d17a){if(_0x22d17a){_0x373f7c=_0x22d17a['length'];if(!_0xdcbe6c[_0x6e70('0x53')][_0x6e70('0x59')](_0x6e70('0xcd'))){_0x2d3922[_0x6e70('0x32')]=qs[_0x6e70('0x32')](_0xdcbe6c[_0x6e70('0x53')][_0x6e70('0x32')]);_0x2d3922[_0x6e70('0x31')]=qs[_0x6e70('0x31')](_0xdcbe6c[_0x6e70('0x53')][_0x6e70('0x31')]);}return _0x463448[_0x6e70('0xe1')](_0x2d3922);}})[_0x6e70('0x23')](function(_0x2a6991){if(_0x2a6991){return _0x2a6991?{'count':_0x373f7c,'rows':_0x2a6991}:null;}})[_0x6e70('0x23')](respondWithResult(_0x406409,null))[_0x6e70('0x2c')](handleError(_0x406409,null));};exports[_0x6e70('0xe2')]=function(_0x18944c,_0x4498bc,_0x1d7f68){var _0x422c52={};var _0x5331d9={};var _0xd67b0d;var _0x282712;return db[_0x6e70('0x4b')][_0x6e70('0x9e')]({'where':{'id':_0x18944c['params']['id']}})['then'](handleEntityNotFound(_0x4498bc,null))[_0x6e70('0x23')](function(_0x3a2f39){if(_0x3a2f39){_0xd67b0d=_0x3a2f39;_0x5331d9['model']=_['keys'](db[_0x6e70('0xe3')][_0x6e70('0x4c')]);_0x5331d9[_0x6e70('0x53')]=_['keys'](_0x18944c['query']);_0x5331d9[_0x6e70('0x54')]=_[_0x6e70('0x55')](_0x5331d9[_0x6e70('0x4f')],_0x5331d9[_0x6e70('0x53')]);_0x422c52['attributes']=_['intersection'](_0x5331d9[_0x6e70('0x4f')],qs[_0x6e70('0x56')](_0x18944c[_0x6e70('0x53')]['fields']));_0x422c52[_0x6e70('0x57')]=_0x422c52['attributes'][_0x6e70('0x58')]?_0x422c52[_0x6e70('0x57')]:_0x5331d9['model'];_0x422c52[_0x6e70('0x5a')]=qs[_0x6e70('0x5b')](_0x18944c[_0x6e70('0x53')][_0x6e70('0x5b')]);_0x422c52['where']=qs[_0x6e70('0x54')](_[_0x6e70('0x5c')](_0x18944c[_0x6e70('0x53')],_0x5331d9[_0x6e70('0x54')]));if(_0x18944c[_0x6e70('0x53')][_0x6e70('0x3f')]){_0x422c52[_0x6e70('0x5d')]=_[_0x6e70('0x5e')](_0x422c52[_0x6e70('0x5d')],{'$or':_['map'](_0x422c52[_0x6e70('0x57')],function(_0x2c5f8e){var _0x292d05={};_0x292d05[_0x2c5f8e]={'$like':'%'+_0x18944c[_0x6e70('0x53')][_0x6e70('0x3f')]+'%'};return _0x292d05;})});}_0x422c52=_[_0x6e70('0x5e')]({},_0x422c52,_0x18944c['options']);return _0xd67b0d[_0x6e70('0xe2')](_0x422c52);}})[_0x6e70('0x23')](function(_0x487a78){if(_0x487a78){_0x282712=_0x487a78[_0x6e70('0x58')];if(!_0x18944c['query'][_0x6e70('0x59')](_0x6e70('0xcd'))){_0x422c52['limit']=qs[_0x6e70('0x32')](_0x18944c[_0x6e70('0x53')][_0x6e70('0x32')]);_0x422c52[_0x6e70('0x31')]=qs[_0x6e70('0x31')](_0x18944c[_0x6e70('0x53')][_0x6e70('0x31')]);}return _0xd67b0d[_0x6e70('0xe2')](_0x422c52);}})[_0x6e70('0x23')](function(_0x343e88){if(_0x343e88){return _0x343e88?{'count':_0x282712,'rows':_0x343e88}:null;}})['then'](respondWithResult(_0x4498bc,null))[_0x6e70('0x2c')](handleError(_0x4498bc,null));};exports[_0x6e70('0xe4')]=function(_0x617a39,_0x5c23f1,_0x50a85a){var _0x4ef8f3={};var _0x7159d={};var _0x36d0c4;var _0x1bd965;return db['User'][_0x6e70('0x9e')]({'where':{'id':_0x617a39[_0x6e70('0x67')]['id']}})[_0x6e70('0x23')](handleEntityNotFound(_0x5c23f1,null))[_0x6e70('0x23')](function(_0x3f4dfb){if(_0x3f4dfb){_0x36d0c4=_0x3f4dfb;_0x7159d[_0x6e70('0x4f')]=_[_0x6e70('0x52')](db[_0x6e70('0xe5')][_0x6e70('0x4c')]);_0x7159d[_0x6e70('0x53')]=_[_0x6e70('0x52')](_0x617a39[_0x6e70('0x53')]);_0x7159d[_0x6e70('0x54')]=_['intersection'](_0x7159d[_0x6e70('0x4f')],_0x7159d[_0x6e70('0x53')]);_0x4ef8f3[_0x6e70('0x57')]=_[_0x6e70('0x55')](_0x7159d[_0x6e70('0x4f')],qs['fields'](_0x617a39[_0x6e70('0x53')][_0x6e70('0x56')]));_0x4ef8f3['attributes']=_0x4ef8f3[_0x6e70('0x57')][_0x6e70('0x58')]?_0x4ef8f3[_0x6e70('0x57')]:_0x7159d[_0x6e70('0x4f')];_0x4ef8f3[_0x6e70('0x5a')]=qs[_0x6e70('0x5b')](_0x617a39[_0x6e70('0x53')]['sort']);_0x4ef8f3[_0x6e70('0x5d')]=qs['filters'](_[_0x6e70('0x5c')](_0x617a39[_0x6e70('0x53')],_0x7159d[_0x6e70('0x54')]));if(_0x617a39[_0x6e70('0x53')][_0x6e70('0x3f')]){_0x4ef8f3[_0x6e70('0x5d')]=_[_0x6e70('0x5e')](_0x4ef8f3[_0x6e70('0x5d')],{'$or':_[_0x6e70('0x41')](_0x4ef8f3['attributes'],function(_0x31194e){var _0x3a25ed={};_0x3a25ed[_0x31194e]={'$like':'%'+_0x617a39[_0x6e70('0x53')][_0x6e70('0x3f')]+'%'};return _0x3a25ed;})});}_0x4ef8f3=_[_0x6e70('0x5e')]({},_0x4ef8f3,_0x617a39[_0x6e70('0xcf')]);return _0x36d0c4[_0x6e70('0xe4')](_0x4ef8f3);}})[_0x6e70('0x23')](function(_0x3aa47e){if(_0x3aa47e){_0x1bd965=_0x3aa47e['length'];if(!_0x617a39['query'][_0x6e70('0x59')]('nolimit')){_0x4ef8f3[_0x6e70('0x32')]=qs[_0x6e70('0x32')](_0x617a39[_0x6e70('0x53')][_0x6e70('0x32')]);_0x4ef8f3[_0x6e70('0x31')]=qs['offset'](_0x617a39[_0x6e70('0x53')]['offset']);}return _0x36d0c4[_0x6e70('0xe4')](_0x4ef8f3);}})['then'](function(_0x1dbda4){if(_0x1dbda4){return _0x1dbda4?{'count':_0x1bd965,'rows':_0x1dbda4}:null;}})[_0x6e70('0x23')](respondWithResult(_0x5c23f1,null))[_0x6e70('0x2c')](handleError(_0x5c23f1,null));};exports[_0x6e70('0xe6')]=function(_0x52795b,_0x50d99f,_0x2050cb){var _0x19e2be;var _0x4e9c50;var _0x191061;var _0x5bcfcb=!_[_0x6e70('0x71')](_0x52795b[_0x6e70('0x67')]['id'])?_0x52795b['params']['id']:!_['isNil'](_0x52795b[_0x6e70('0x3b')]['id'])?_0x52795b[_0x6e70('0x3b')]['id']:null;return db[_0x6e70('0x4b')]['find']({'where':{'id':_0x5bcfcb,'role':{'$or':[_0x6e70('0x3a'),_0x6e70('0x3b'),_0x6e70('0x3c')]}},'attributes':['id','name',_0x6e70('0xe7'),_0x6e70('0xe8'),'role',_0x6e70('0x6e'),_0x6e70('0xa5')]})['then'](function(_0x2ac7c8){if(_0x2ac7c8){if(_0x2ac7c8['role']===_0x6e70('0x3c')){_0x19e2be=_0x2ac7c8;if(_0x52795b[_0x6e70('0x69')][_0x6e70('0xa7')]){_0x191061=util[_0x6e70('0xb3')](_0x6e70('0xe9'),_0x19e2be[_0x52795b[_0x6e70('0x69')][_0x6e70('0xa7')]]);}else if(_0x52795b[_0x6e70('0x69')][_0x6e70('0xea')]){_0x191061=util[_0x6e70('0xb3')](_0x6e70('0xb4'),_0x52795b['body'][_0x6e70('0xea')]);}else{_0x191061=util['format'](_0x6e70('0xb4'),_0x19e2be['name']);}socket['to'](util[_0x6e70('0xb3')](_0x6e70('0xeb'),_0x19e2be[_0x6e70('0x48')]))[_0x6e70('0xb0')](_0x6e70('0xec'),{'user':{'id':_0x19e2be['id'],'name':_0x19e2be[_0x6e70('0x48')]},'ip':_0x52795b[_0x6e70('0xed')][_0x6e70('0xee')]||_0x52795b[_0x6e70('0xef')]['remoteAddress']||_0x52795b[_0x6e70('0xf0')][_0x6e70('0xf1')]||_0x52795b['connection'][_0x6e70('0xf0')][_0x6e70('0xf1')]});return db[_0x6e70('0xb5')][_0x6e70('0x37')]({'where':{'membername':_0x19e2be[_0x6e70('0x48')]},'individualHooks':!![]});}}else{throw new db[(_0x6e70('0x97'))][(_0x6e70('0x98'))](_0x6e70('0xf2'));}})[_0x6e70('0x23')](function(){if(_0x19e2be){return _0x19e2be['getVoiceQueues']({'raw':!![]});}})[_0x6e70('0x23')](function(_0x1e21ff){if(_0x19e2be){var _0x22a213=[];if(_0x1e21ff){_0x4e9c50=_0x1e21ff;if(_0x4e9c50[_0x6e70('0x58')]){for(var _0x2dadac=0x0;_0x2dadac<_0x4e9c50[_0x6e70('0x58')];_0x2dadac++){_0x22a213['push']({'membername':_0x19e2be[_0x6e70('0x48')],'UserId':_0x19e2be['id'],'queue_name':_0x4e9c50[_0x2dadac]['name'],'VoiceQueueId':_0x4e9c50[_0x2dadac]['id'],'interface':_0x191061,'paused':_0x19e2be[_0x6e70('0xa5')]||![],'penalty':_0x4e9c50[_0x2dadac][_0x6e70('0xf3')]||0x0});}return BPromise[_0x6e70('0x8f')](_0x22a213,function(_0x5aac45){return db['UserVoiceQueueRt'][_0x6e70('0xb6')](_0x5aac45);});}}}})[_0x6e70('0x23')](function(){if(_0x19e2be){return db[_0x6e70('0xf4')][_0x6e70('0x64')]({'where':{'membername':_0x19e2be['name'],'exitAt':null}});}})[_0x6e70('0x23')](function(_0x109ea6){if(_0x19e2be){var _0x316fcc=[];_0x109ea6[_0x6e70('0xf5')](function(_0x26393e){_0x316fcc[_0x6e70('0x8d')](_0x26393e[_0x6e70('0x36')]({'exitAt':moment()[_0x6e70('0xb3')](_0x6e70('0xf6'))}));});return BPromise['all'](_0x316fcc);}})[_0x6e70('0x23')](function(){if(_0x19e2be){var _0x1b2563=[];var _0x12bf01=[];var _0x8b7661=utils[_0x6e70('0xf7')]();var _0x52127a={'membername':_0x19e2be[_0x6e70('0x48')],'interface':_0x191061,'enterAt':moment()[_0x6e70('0xb3')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x19e2be[_0x6e70('0x39')],'internal':_0x19e2be[_0x6e70('0x6e')]};_0x8b7661[_0x6e70('0xf5')](function(_0x4bd0bc){_0x1b2563[_0x6e70('0x8d')](_[_0x6e70('0x5e')]({'channel':_0x4bd0bc,'type':_0x6e70('0xf8'),'data1':_0x52795b['body']['device'],'data2':_0x191061},_0x52127a));if(_0x19e2be['loginInPause']){_0x12bf01[_0x6e70('0x8d')](_[_0x6e70('0x5e')]({'channel':_0x4bd0bc,'type':_0x6e70('0xf9'),'data1':_0x6e70('0xfa')},_0x52127a));}});return db[_0x6e70('0xf4')][_0x6e70('0xfb')](_0x1b2563['concat'](_0x12bf01),{'individualHooks':!![]});}})[_0x6e70('0x23')](function(){if(_0x19e2be){return _0x19e2be[_0x6e70('0x36')]({'online':!![],'lastLoginAt':moment()[_0x6e70('0xb3')](_0x6e70('0xf6')),'voicePause':_0x19e2be['loginInPause']||![],'mailPause':_0x19e2be[_0x6e70('0xa5')]||![],'chatPause':_0x19e2be[_0x6e70('0xa5')]||![],'faxPause':_0x19e2be[_0x6e70('0xa5')]||![],'smsPause':_0x19e2be[_0x6e70('0xa5')]||![],'openchannelPause':_0x19e2be[_0x6e70('0xa5')]||![],'whatsappPause':_0x19e2be['loginInPause']||![],'pauseType':_0x19e2be['loginInPause']?_0x6e70('0xfa'):null,'interface':_0x191061,'lastPauseAt':moment()[_0x6e70('0xb3')](_0x6e70('0xf6'))});}})[_0x6e70('0x23')](function(_0x364149){if(_0x52795b[_0x6e70('0xfc')]){return _0x2050cb();}else{return BPromise['resolve'](_0x364149)['then'](respondWithResult(_0x50d99f,null));}})[_0x6e70('0x2c')](handleError(_0x50d99f,null));};exports[_0x6e70('0xfd')]=function(_0x403985,_0x3dff60,_0x30e9cf){var _0x1a67c9;return db['User'][_0x6e70('0x44')]({'where':{'id':_0x403985[_0x6e70('0x67')]['id'],'role':_0x6e70('0x3c')},'attributes':['id',_0x6e70('0x48'),_0x6e70('0x39')]})[_0x6e70('0x23')](handleEntityNotFound(_0x3dff60,null))[_0x6e70('0x23')](function(_0x57bfff){if(_0x57bfff){_0x1a67c9=_0x57bfff;return db[_0x6e70('0xb5')][_0x6e70('0x37')]({'where':{'membername':_0x1a67c9[_0x6e70('0x48')]},'individualHooks':!![]});}})['then'](function(){return db[_0x6e70('0xf4')][_0x6e70('0x64')]({'where':{'membername':_0x1a67c9[_0x6e70('0x48')],'exitAt':null}});})[_0x6e70('0x23')](function(_0x50cd48){var _0x5cce60=[];_0x50cd48[_0x6e70('0xf5')](function(_0x5cc741){_0x5cce60[_0x6e70('0x8d')](_0x5cc741[_0x6e70('0x36')]({'exitAt':moment()[_0x6e70('0xb3')](_0x6e70('0xf6'))}));});return BPromise['all'](_0x5cce60);})[_0x6e70('0x23')](function(){return _0x1a67c9['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x3dff60,null))[_0x6e70('0x2c')](handleError(_0x3dff60,null));};exports[_0x6e70('0xfe')]=function(_0x267ab4,_0x35d9be,_0x2939b8){var _0x40d96a;return db[_0x6e70('0xb5')][_0x6e70('0x36')]({'paused':0x1},{'where':{'UserId':_0x267ab4[_0x6e70('0x67')]['id']},'individualHooks':!![]})[_0x6e70('0x23')](function(){return db[_0x6e70('0x4b')]['find']({'where':{'id':_0x267ab4[_0x6e70('0x67')]['id'],'role':_0x6e70('0x3c')},'attributes':['id',_0x6e70('0x48'),_0x6e70('0x39'),_0x6e70('0x6e'),_0x6e70('0xa7')]});})[_0x6e70('0x23')](handleEntityNotFound(_0x35d9be,null))[_0x6e70('0x23')](function(_0x20b56d){if(_0x20b56d){_0x40d96a=_0x20b56d;return respondWithRpcPromise(_0x6e70('0xff'),_0x6e70('0xfe'),{'id':_0x40d96a['id'],'name':_0x40d96a[_0x6e70('0x48')],'pause':!![]});}})[_0x6e70('0x23')](function(){if(_0x40d96a){return db[_0x6e70('0xf4')]['findAll']({'where':{'membername':_0x40d96a[_0x6e70('0x48')],'type':_0x6e70('0xf9'),'exitAt':null}});}})[_0x6e70('0x23')](function(_0x14f050){if(_0x14f050[_0x6e70('0x58')]){var _0x423e9c=moment()[_0x6e70('0xb3')](_0x6e70('0xf6'));for(var _0x292849=0x0,_0xfc7c3d=_0x14f050[_0x6e70('0x58')];_0x292849<_0xfc7c3d;_0x292849++){_0x14f050[_0x292849]['updateAttributes']({'exitAt':_0x423e9c});}}})[_0x6e70('0x23')](function(){var _0x29be51=[];var _0x3d814e=utils[_0x6e70('0xf7')]();_0x3d814e[_0x6e70('0xf5')](function(_0xfebb2){_0x29be51[_0x6e70('0x8d')]({'channel':_0xfebb2,'membername':_0x40d96a[_0x6e70('0x48')],'interface':_[_0x6e70('0x71')](_0x40d96a[_0x6e70('0xa7')])?util[_0x6e70('0xb3')]('SIP/%s',_0x40d96a[_0x6e70('0x48')]):_0x40d96a['interface'],'type':_0x6e70('0xf9'),'enterAt':moment()['format'](_0x6e70('0xf6')),'data1':_0x267ab4[_0x6e70('0x69')][_0x6e70('0x5f')]||_0x6e70('0x100'),'role':_0x40d96a[_0x6e70('0x39')],'internal':_0x40d96a['internal']});});return db[_0x6e70('0xf4')][_0x6e70('0xfb')](_0x29be51,{'individualHooks':!![]});})[_0x6e70('0x23')](function(){return _0x40d96a['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x267ab4[_0x6e70('0x69')]['type']||_0x6e70('0x100'),'lastPauseAt':moment()[_0x6e70('0xb3')](_0x6e70('0xf6'))});})['then'](respondWithResult(_0x35d9be,null))[_0x6e70('0x2c')](handleError(_0x35d9be,null));};exports['unpause']=function(_0x315e3d,_0x56afbf,_0x1e836f){var _0x273cff;return db[_0x6e70('0x4b')][_0x6e70('0x44')]({'where':{'id':_0x315e3d[_0x6e70('0x67')]['id']},'attributes':['id',_0x6e70('0x48'),_0x6e70('0x39'),'voicePause',_0x6e70('0x101'),'chatPause',_0x6e70('0x102'),'openchannelPause','smsPause',_0x6e70('0x103'),_0x6e70('0x104'),_0x6e70('0x105')]})[_0x6e70('0x23')](handleEntityNotFound(_0x56afbf,null))[_0x6e70('0x23')](function(_0x4011da){if(_0x4011da){_0x273cff=_0x4011da;if(_0x315e3d[_0x6e70('0x69')][_0x6e70('0xa3')]&&!utils[_0x6e70('0xa8')](_0x315e3d['body']['channel'])){throw new db[(_0x6e70('0x97'))][(_0x6e70('0x98'))](_0x6e70('0xa9'));}switch(_0x315e3d[_0x6e70('0x69')][_0x6e70('0xa3')]){case _0x6e70('0xb2'):return respondWithRpcPromise(_0x6e70('0xff'),_0x6e70('0x106'),{'id':_0x273cff['id'],'name':_0x273cff[_0x6e70('0x48')],'pause':![]})[_0x6e70('0x23')](function(){return db[_0x6e70('0xb5')]['update']({'paused':0x0},{'where':{'UserId':_0x273cff['id']},'individualHooks':!![]});})[_0x6e70('0x23')](function(){return db[_0x6e70('0xf4')][_0x6e70('0x44')]({'where':{'channel':_0x315e3d[_0x6e70('0x69')][_0x6e70('0xa3')],'membername':_0x273cff[_0x6e70('0x48')],'type':_0x6e70('0xf9'),'exitAt':null}});})['then'](function(_0x4a1c61){if(_0x4a1c61){return _0x4a1c61[_0x6e70('0x36')]({'exitAt':moment()[_0x6e70('0xb3')](_0x6e70('0xf6')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x6e70('0x23')](function(){return _0x273cff[_0x6e70('0x36')]({'voicePause':![]});});case'mail':case _0x6e70('0x107'):case'fax':case'sms':case'whatsapp':case _0x6e70('0x108'):return db[_0x6e70('0xf4')][_0x6e70('0x44')]({'where':{'channel':_0x315e3d[_0x6e70('0x69')][_0x6e70('0xa3')],'membername':_0x273cff['name'],'type':_0x6e70('0xf9'),'exitAt':null}})[_0x6e70('0x23')](function(_0xc97b58){if(_0xc97b58){return _0xc97b58[_0x6e70('0x36')]({'exitAt':moment()['format'](_0x6e70('0xf6')),'data2':_0x6e70('0x109')},{'individualHooks':!![]});}return null;})[_0x6e70('0x23')](function(){var _0x5543cb={};_[_0x6e70('0x10a')](_0x5543cb,util[_0x6e70('0xb3')](_0x6e70('0x10b'),_0x315e3d[_0x6e70('0x69')][_0x6e70('0xa3')],_0x6e70('0x10c')),![]);return _0x273cff[_0x6e70('0x36')](_0x5543cb);});default:return respondWithRpcPromise(_0x6e70('0xff'),'unpause',{'id':_0x273cff['id'],'name':_0x273cff[_0x6e70('0x48')],'pause':![]})[_0x6e70('0x23')](function(){return db[_0x6e70('0xb5')]['update']({'paused':0x0},{'where':{'UserId':_0x273cff['id']}});})[_0x6e70('0x23')](function(){return db[_0x6e70('0xf4')][_0x6e70('0x64')]({'where':{'membername':_0x273cff[_0x6e70('0x48')],'type':_0x6e70('0xf9'),'exitAt':null}});})[_0x6e70('0x23')](function(_0x102d7a){var _0x102e9a=[];_0x102d7a[_0x6e70('0xf5')](function(_0xe18916){_0x102e9a[_0x6e70('0x8d')](_0xe18916[_0x6e70('0x36')]({'exitAt':moment()['format'](_0x6e70('0xf6')),'data2':'manual'}));});return BPromise[_0x6e70('0x8e')](_0x102e9a);})[_0x6e70('0x23')](function(){return _0x273cff[_0x6e70('0x36')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x6e70('0x23')](respondWithResult(_0x56afbf,null))[_0x6e70('0x2c')](handleError(_0x56afbf,null));};exports[_0x6e70('0x10d')]=function(_0x43fca4,_0x5cbf4a,_0x1cd51b){var _0x4b6669={};var _0x122d2f={};var _0x36d5af;var _0x5b2053;return db[_0x6e70('0x4b')][_0x6e70('0x9e')]({'where':{'id':_0x43fca4[_0x6e70('0x67')]['id']}})[_0x6e70('0x23')](handleEntityNotFound(_0x5cbf4a,null))[_0x6e70('0x23')](function(_0x3516f9){if(_0x3516f9){_0x36d5af=_0x3516f9;_0x122d2f[_0x6e70('0x4f')]=_[_0x6e70('0x52')](db[_0x6e70('0x10e')][_0x6e70('0x4c')]);_0x122d2f[_0x6e70('0x53')]=_[_0x6e70('0x52')](_0x43fca4[_0x6e70('0x53')]);_0x122d2f[_0x6e70('0x54')]=_[_0x6e70('0x55')](_0x122d2f['model'],_0x122d2f[_0x6e70('0x53')]);_0x4b6669['attributes']=_['intersection'](_0x122d2f[_0x6e70('0x4f')],qs[_0x6e70('0x56')](_0x43fca4[_0x6e70('0x53')][_0x6e70('0x56')]));_0x4b6669['attributes']=_0x4b6669[_0x6e70('0x57')]['length']?_0x4b6669['attributes']:_0x122d2f[_0x6e70('0x4f')];_0x4b6669['order']=qs[_0x6e70('0x5b')](_0x43fca4[_0x6e70('0x53')][_0x6e70('0x5b')]);_0x4b6669[_0x6e70('0x5d')]=qs['filters'](_[_0x6e70('0x5c')](_0x43fca4[_0x6e70('0x53')],_0x122d2f[_0x6e70('0x54')]));if(_0x43fca4[_0x6e70('0x53')][_0x6e70('0x3f')]){_0x4b6669[_0x6e70('0x5d')]=_[_0x6e70('0x5e')](_0x4b6669[_0x6e70('0x5d')],{'$or':_[_0x6e70('0x41')](_0x4b6669[_0x6e70('0x57')],function(_0x1fb37e){var _0x2a718f={};_0x2a718f[_0x1fb37e]={'$like':'%'+_0x43fca4['query']['filter']+'%'};return _0x2a718f;})});}_0x4b6669=_['merge']({},_0x4b6669,_0x43fca4[_0x6e70('0xcf')]);return _0x36d5af[_0x6e70('0x10d')](_0x4b6669);}})[_0x6e70('0x23')](function(_0x35b169){if(_0x35b169){_0x5b2053=_0x35b169[_0x6e70('0x58')];if(!_0x43fca4[_0x6e70('0x53')][_0x6e70('0x59')]('nolimit')){_0x4b6669[_0x6e70('0x32')]=qs[_0x6e70('0x32')](_0x43fca4[_0x6e70('0x53')]['limit']);_0x4b6669['offset']=qs[_0x6e70('0x31')](_0x43fca4[_0x6e70('0x53')]['offset']);}return _0x36d5af[_0x6e70('0x10d')](_0x4b6669);}})[_0x6e70('0x23')](function(_0x3ee1d9){if(_0x3ee1d9){return _0x3ee1d9?{'count':_0x5b2053,'rows':_0x3ee1d9}:null;}})[_0x6e70('0x23')](respondWithResult(_0x5cbf4a,null))[_0x6e70('0x2c')](handleError(_0x5cbf4a,null));};exports['addTeams']=function(_0xd254a3,_0x2b4179){return db[_0x6e70('0x4b')][_0x6e70('0x44')]({'where':{'id':_0xd254a3[_0x6e70('0x67')]['id']}})[_0x6e70('0x23')](handleEntityNotFound(_0x2b4179,null))[_0x6e70('0x23')](function(_0x26cfd5){if(_0x26cfd5){var _0x12665e=_0x26cfd5[_0x6e70('0x38')]({'plain':!![]});return _0x26cfd5['addTeams'](_0xd254a3['body'][_0x6e70('0x6c')],_['omit'](_0xd254a3[_0x6e70('0x69')],[_0x6e70('0x6c'),'id'])||{})['then'](function(){for(var _0xbcf2ed=0x0;_0xbcf2ed<_0xd254a3[_0x6e70('0x69')]['ids']['length'];_0xbcf2ed++){var _0x384221=[];db[_0x6e70('0x10e')][_0x6e70('0x9e')]({'where':{'id':_0xd254a3['body'][_0x6e70('0x6c')][_0xbcf2ed]}})[_0x6e70('0x23')](function(_0x41990e){_0x384221[_0x6e70('0x8d')](_0x41990e[_0x6e70('0x10f')]()[_0x6e70('0x23')](function(_0x2ce4d5){for(var _0x1b5755=0x0;_0x1b5755<_0x2ce4d5[_0x6e70('0x58')];_0x1b5755++){_0x2ce4d5[_0x1b5755][_0x6e70('0x110')](_0x6e70('0xa3'),_0x6e70('0x111'));}return _0x2ce4d5;}));_0x384221[_0x6e70('0x8d')](_0x41990e['getChatQueues']()['then'](function(_0x517585){for(var _0x28aee1=0x0;_0x28aee1<_0x517585[_0x6e70('0x58')];_0x28aee1++){_0x517585[_0x28aee1][_0x6e70('0x110')]('channel','Chat');}return _0x517585;}));_0x384221[_0x6e70('0x8d')](_0x41990e[_0x6e70('0x112')]()[_0x6e70('0x23')](function(_0x56b29b){for(var _0x7da021=0x0;_0x7da021<_0x56b29b[_0x6e70('0x58')];_0x7da021++){_0x56b29b[_0x7da021][_0x6e70('0x110')](_0x6e70('0xa3'),_0x6e70('0x113'));}return _0x56b29b;}));_0x384221[_0x6e70('0x8d')](_0x41990e[_0x6e70('0x114')]()[_0x6e70('0x23')](function(_0x50b6df){for(var _0x53a253=0x0;_0x53a253<_0x50b6df[_0x6e70('0x58')];_0x53a253++){_0x50b6df[_0x53a253][_0x6e70('0x110')](_0x6e70('0xa3'),_0x6e70('0x115'));}return _0x50b6df;}));_0x384221['push'](_0x41990e[_0x6e70('0x116')]()[_0x6e70('0x23')](function(_0x53a957){for(var _0x1638e9=0x0;_0x1638e9<_0x53a957['length'];_0x1638e9++){_0x53a957[_0x1638e9][_0x6e70('0x110')](_0x6e70('0xa3'),'Whatsapp');}return _0x53a957;}));_0x384221[_0x6e70('0x8d')](_0x41990e[_0x6e70('0x117')]()[_0x6e70('0x23')](function(_0x23c535){for(var _0x1c44ad=0x0;_0x1c44ad<_0x23c535['length'];_0x1c44ad++){_0x23c535[_0x1c44ad][_0x6e70('0x110')](_0x6e70('0xa3'),_0x6e70('0x118'));}return _0x23c535;}));_0x384221['push'](_0x41990e[_0x6e70('0x119')]()[_0x6e70('0x23')](function(_0x1e4c97){for(var _0x126558=0x0;_0x126558<_0x1e4c97[_0x6e70('0x58')];_0x126558++){_0x1e4c97[_0x126558][_0x6e70('0x110')](_0x6e70('0xa3'),_0x6e70('0x11a'));}return _0x1e4c97;}));return BPromise[_0x6e70('0x8e')](_0x384221);})['then'](function(_0x1f40ec){var _0x7d8ea9=_[_0x6e70('0x11b')](_0x1f40ec);_0x384221=[];return db[_0x6e70('0x60')][_0x6e70('0x11c')](function(_0x23dfa9){for(var _0x4fd701=0x0;_0x4fd701<_0x7d8ea9[_0x6e70('0x58')];_0x4fd701++){_0x384221[_0x6e70('0x8d')](_0x7d8ea9[_0x4fd701][_0x6e70('0x11d')](_0x12665e['id']),{'transaction':_0x23dfa9});}return BPromise['all'](_0x384221)[_0x6e70('0x23')](function(){if(_0x12665e[_0x6e70('0xa4')]){return BPromise[_0x6e70('0x8f')](_['filter'](_0x7d8ea9,function(_0x27d42b){return _0x27d42b['getDataValue'](_0x6e70('0xa3'))===_0x6e70('0x111');}),function(_0x579532){return db[_0x6e70('0xb5')]['upsert']({'membername':_0x12665e[_0x6e70('0x48')],'UserId':_0x12665e['id'],'queue_name':_0x579532[_0x6e70('0x48')],'VoiceQueueId':_0x579532['id'],'interface':_['isNil'](_0x12665e[_0x6e70('0xa7')])?util[_0x6e70('0xb3')]('SIP/%s',_0x12665e[_0x6e70('0x48')]):_0x12665e['interface'],'paused':_0x12665e[_0x6e70('0xa6')]||![],'penalty':_0x12665e[_0x6e70('0xac')]},{'transaction':_0x23dfa9});});}else{return;}})[_0x6e70('0x23')](function(){for(var _0x266f37=0x0;_0x266f37<_0x7d8ea9[_0x6e70('0x58')];_0x266f37++){var _0x1c3a17=_0x7d8ea9[_0x266f37]['getDataValue'](_0x6e70('0xa3'));var _0x2c6213=_0x1c3a17+'QueueId';socket[_0x6e70('0xb0')](_0x6e70('0x3b')+_0x1c3a17+'Queue:save',{'UserId':_0x12665e['id'],['queueField']:_0x7d8ea9[_0x266f37]['id']});}});});});}});}})[_0x6e70('0x23')](respondWithStatusCode(_0x2b4179,null))[_0x6e70('0x2c')](handleError(_0x2b4179,null));};exports['removeTeams']=function(_0x2b1a5f,_0x2ff5a6){return db[_0x6e70('0x4b')]['findOne']({'where':{'id':_0x2b1a5f[_0x6e70('0x67')]['id']}})[_0x6e70('0x23')](handleEntityNotFound(_0x2ff5a6,null))[_0x6e70('0x23')](function(_0x3a1359){if(_0x3a1359){var _0x169d28=_0x3a1359['get']({'plain':!![]});var _0x2fa4a3=_0x2b1a5f['query']['ids'];return _0x3a1359['removeTeams'](_0x2fa4a3)[_0x6e70('0x23')](function(){for(var _0x5b04ec=0x0;_0x5b04ec<_0x2fa4a3[_0x6e70('0x58')];_0x5b04ec++){var _0x29ad9d=[];db[_0x6e70('0x10e')][_0x6e70('0x9e')]({'where':{'id':_0x2fa4a3[_0x5b04ec]}})['then'](function(_0x406b57){_0x29ad9d['push'](_0x406b57[_0x6e70('0x10f')]()[_0x6e70('0x23')](function(_0x3e4c63){for(var _0x30f5bc=0x0;_0x30f5bc<_0x3e4c63[_0x6e70('0x58')];_0x30f5bc++){_0x3e4c63[_0x30f5bc][_0x6e70('0x110')]('channel',_0x6e70('0x111'));}return _0x3e4c63;}));_0x29ad9d[_0x6e70('0x8d')](_0x406b57['getChatQueues']()[_0x6e70('0x23')](function(_0x3e863e){for(var _0x3bf146=0x0;_0x3bf146<_0x3e863e[_0x6e70('0x58')];_0x3bf146++){_0x3e863e[_0x3bf146][_0x6e70('0x110')](_0x6e70('0xa3'),_0x6e70('0x11e'));}return _0x3e863e;}));_0x29ad9d['push'](_0x406b57[_0x6e70('0x112')]()['then'](function(_0x5ee140){for(var _0x2a7d1d=0x0;_0x2a7d1d<_0x5ee140[_0x6e70('0x58')];_0x2a7d1d++){_0x5ee140[_0x2a7d1d]['setDataValue'](_0x6e70('0xa3'),_0x6e70('0x113'));}return _0x5ee140;}));_0x29ad9d[_0x6e70('0x8d')](_0x406b57[_0x6e70('0x114')]()[_0x6e70('0x23')](function(_0x1a2b53){for(var _0x21c4fd=0x0;_0x21c4fd<_0x1a2b53[_0x6e70('0x58')];_0x21c4fd++){_0x1a2b53[_0x21c4fd][_0x6e70('0x110')](_0x6e70('0xa3'),_0x6e70('0x115'));}return _0x1a2b53;}));_0x29ad9d[_0x6e70('0x8d')](_0x406b57[_0x6e70('0x116')]()[_0x6e70('0x23')](function(_0x3d6eaf){for(var _0x3fde57=0x0;_0x3fde57<_0x3d6eaf[_0x6e70('0x58')];_0x3fde57++){_0x3d6eaf[_0x3fde57][_0x6e70('0x110')]('channel',_0x6e70('0x11f'));}return _0x3d6eaf;}));_0x29ad9d['push'](_0x406b57['getFaxQueues']()['then'](function(_0x180b80){for(var _0x244606=0x0;_0x244606<_0x180b80[_0x6e70('0x58')];_0x244606++){_0x180b80[_0x244606][_0x6e70('0x110')](_0x6e70('0xa3'),_0x6e70('0x118'));}return _0x180b80;}));_0x29ad9d[_0x6e70('0x8d')](_0x406b57[_0x6e70('0x119')]()[_0x6e70('0x23')](function(_0xd3b0cb){for(var _0x33a12b=0x0;_0x33a12b<_0xd3b0cb['length'];_0x33a12b++){_0xd3b0cb[_0x33a12b][_0x6e70('0x110')](_0x6e70('0xa3'),_0x6e70('0x11a'));}return _0xd3b0cb;}));return BPromise[_0x6e70('0x8e')](_0x29ad9d);})[_0x6e70('0x23')](function(_0xc179e5){var _0x3cfb0b=_['flatten'](_0xc179e5);_0x29ad9d=[];return db[_0x6e70('0x60')][_0x6e70('0x11c')](function(_0x3981b2){for(var _0x593f06=0x0;_0x593f06<_0x3cfb0b['length'];_0x593f06++){_0x29ad9d['push'](_0x3cfb0b[_0x593f06]['removeAgent'](_0x169d28['id']),{'transaction':_0x3981b2});}return BPromise[_0x6e70('0x8e')](_0x29ad9d)['then'](function(){if(_0x169d28[_0x6e70('0xa4')]){return BPromise[_0x6e70('0x8f')](_[_0x6e70('0x3f')](_0x3cfb0b,function(_0x4b9138){return _0x4b9138[_0x6e70('0x120')](_0x6e70('0xa3'))==='Voice';}),function(_0x3c519c){return db[_0x6e70('0xb5')]['destroy']({'where':{'VoiceQueueId':_0x3c519c['id'],'UserId':_0x169d28['id']},'transaction':_0x3981b2});});}else{return;}})['then'](function(){for(var _0x5cb34c=0x0;_0x5cb34c<_0x3cfb0b['length'];_0x5cb34c++){var _0x4ec1f3=_0x3cfb0b[_0x5cb34c]['getDataValue'](_0x6e70('0xa3'));var _0x559e51=_0x4ec1f3+_0x6e70('0xaf');socket[_0x6e70('0xb0')]('user'+_0x4ec1f3+'Queue:remove',{'UserId':_0x169d28['id'],['queueField']:_0x3cfb0b[_0x5cb34c]['id']});}});});});}});}})[_0x6e70('0x23')](respondWithStatusCode(_0x2ff5a6,null))[_0x6e70('0x2c')](handleError(_0x2ff5a6,null));};exports[_0x6e70('0x121')]=function(_0x46b32a,_0x14dedf,_0x83fe08){var _0x5a36fb={};var _0x160e3e={};var _0x2a2f5d;var _0x412177;return db[_0x6e70('0x4b')][_0x6e70('0x9e')]({'where':{'id':_0x46b32a[_0x6e70('0x67')]['id']}})[_0x6e70('0x23')](handleEntityNotFound(_0x14dedf,null))[_0x6e70('0x23')](function(_0x546a86){if(_0x546a86){_0x2a2f5d=_0x546a86;_0x160e3e[_0x6e70('0x4f')]=_[_0x6e70('0x52')](db[_0x6e70('0x122')][_0x6e70('0x4c')]);_0x160e3e[_0x6e70('0x53')]=_[_0x6e70('0x52')](_0x46b32a[_0x6e70('0x53')]);_0x160e3e[_0x6e70('0x54')]=_[_0x6e70('0x55')](_0x160e3e[_0x6e70('0x4f')],_0x160e3e[_0x6e70('0x53')]);_0x5a36fb['attributes']=_[_0x6e70('0x55')](_0x160e3e['model'],qs['fields'](_0x46b32a['query'][_0x6e70('0x56')]));_0x5a36fb[_0x6e70('0x57')]=_0x5a36fb[_0x6e70('0x57')]['length']?_0x5a36fb[_0x6e70('0x57')]:_0x160e3e[_0x6e70('0x4f')];_0x5a36fb['order']=qs[_0x6e70('0x5b')](_0x46b32a[_0x6e70('0x53')][_0x6e70('0x5b')]);_0x5a36fb['where']=qs[_0x6e70('0x54')](_[_0x6e70('0x5c')](_0x46b32a[_0x6e70('0x53')],_0x160e3e[_0x6e70('0x54')]));if(_0x46b32a[_0x6e70('0x53')][_0x6e70('0x3f')]){_0x5a36fb['where']=_[_0x6e70('0x5e')](_0x5a36fb['where'],{'$or':_[_0x6e70('0x41')](_0x5a36fb['attributes'],function(_0x31d26b){var _0x5150f3={};_0x5150f3[_0x31d26b]={'$like':'%'+_0x46b32a[_0x6e70('0x53')][_0x6e70('0x3f')]+'%'};return _0x5150f3;})});}_0x5a36fb=_[_0x6e70('0x5e')]({},_0x5a36fb,_0x46b32a[_0x6e70('0xcf')]);return _0x2a2f5d[_0x6e70('0x121')](_0x5a36fb);}})[_0x6e70('0x23')](function(_0x50541a){if(_0x50541a){_0x412177=_0x50541a['length'];if(!_0x46b32a[_0x6e70('0x53')]['hasOwnProperty']('nolimit')){_0x5a36fb[_0x6e70('0x32')]=qs[_0x6e70('0x32')](_0x46b32a[_0x6e70('0x53')][_0x6e70('0x32')]);_0x5a36fb[_0x6e70('0x31')]=qs[_0x6e70('0x31')](_0x46b32a['query'][_0x6e70('0x31')]);}return _0x2a2f5d[_0x6e70('0x121')](_0x5a36fb);}})['then'](function(_0x3249b5){if(_0x3249b5){return _0x3249b5?{'count':_0x412177,'rows':_0x3249b5}:null;}})[_0x6e70('0x23')](respondWithResult(_0x14dedf,null))[_0x6e70('0x2c')](handleError(_0x14dedf,null));};exports[_0x6e70('0x123')]=function(_0x2c861c,_0x1d3739,_0xcd8929){var _0x35d802={};var _0x4a626c={};var _0x5b8b1e;var _0x11d944;return db[_0x6e70('0x4b')]['findOne']({'where':{'id':_0x2c861c[_0x6e70('0x67')]['id']}})[_0x6e70('0x23')](handleEntityNotFound(_0x1d3739,null))[_0x6e70('0x23')](function(_0x85d52b){if(_0x85d52b){_0x5b8b1e=_0x85d52b;_0x4a626c['model']=_['keys'](db[_0x6e70('0x4b')][_0x6e70('0x4c')]);_0x4a626c[_0x6e70('0x53')]=_[_0x6e70('0x52')](_0x2c861c[_0x6e70('0x53')]);_0x4a626c[_0x6e70('0x54')]=_[_0x6e70('0x55')](_0x4a626c[_0x6e70('0x4f')],_0x4a626c['query']);_0x35d802['attributes']=_[_0x6e70('0x55')](_0x4a626c[_0x6e70('0x4f')],qs[_0x6e70('0x56')](_0x2c861c['query'][_0x6e70('0x56')]));_0x35d802[_0x6e70('0x57')]=_0x35d802[_0x6e70('0x57')][_0x6e70('0x58')]?_0x35d802[_0x6e70('0x57')]:_0x4a626c[_0x6e70('0x4f')];_0x35d802['order']=qs[_0x6e70('0x5b')](_0x2c861c[_0x6e70('0x53')][_0x6e70('0x5b')]);_0x35d802[_0x6e70('0x5d')]=qs[_0x6e70('0x54')](_[_0x6e70('0x5c')](_0x2c861c[_0x6e70('0x53')],_0x4a626c['filters']));if(_0x2c861c[_0x6e70('0x53')][_0x6e70('0x3f')]){_0x35d802[_0x6e70('0x5d')]=_['merge'](_0x35d802['where'],{'$or':_[_0x6e70('0x41')](_0x35d802[_0x6e70('0x57')],function(_0x193c44){var _0x1d153f={};_0x1d153f[_0x193c44]={'$like':'%'+_0x2c861c[_0x6e70('0x53')][_0x6e70('0x3f')]+'%'};return _0x1d153f;})});}_0x35d802['model']=db[_0x6e70('0x4b')];_0x35d802['as']='Agents';_0x35d802=_['merge']({},_0x35d802,_0x2c861c[_0x6e70('0xcf')]);return _0x5b8b1e['getVoiceQueues']({'include':[_0x35d802]});}})[_0x6e70('0x23')](function(_0x23f7e9){if(_0x23f7e9){var _0x3e26a0={},_0x1bd448=[],_0x202b55=0x0;for(var _0x4a708a=0x0;_0x4a708a<_0x23f7e9[_0x6e70('0x58')];_0x4a708a+=0x1){for(var _0x163430=0x0,_0xfa8f66;_0x163430<_0x23f7e9[_0x4a708a][_0x6e70('0x89')][_0x6e70('0x58')];_0x163430+=0x1){_0xfa8f66=_0x23f7e9[_0x4a708a][_0x6e70('0x89')][_0x163430][_0x6e70('0x38')]({'plain':!![]});_0x3e26a0[_0xfa8f66['id']]=_0xfa8f66;}}_0x3e26a0=_[_0x6e70('0x124')](_0x3e26a0);for(var _0x3d9ade=qs[_0x6e70('0x31')](_0x2c861c[_0x6e70('0x53')][_0x6e70('0x31')]);_0x3d9ade<_0x3e26a0[_0x6e70('0x58')]&&_0x1bd448[_0x6e70('0x58')]=_0x9de64b){_0x405a2f=_0x9de64b;_0x536635=0xc8;}else{_0x536635=0xce;}_0x2e28fe[_0x1cb9('0x2c')](_0x536635);return _0x2e28fe[_0x1cb9('0x31')]('Content-Range',_0x48888d+'-'+_0x405a2f+'/'+_0x9de64b)[_0x1cb9('0x2d')](_0x41e5c2);}return null;};}function patchUpdates(_0x4eba82){return function(_0xe0a0e2){try{jsonpatch[_0x1cb9('0x32')](_0xe0a0e2,_0x4eba82,!![]);}catch(_0x4220d7){return BPromise['reject'](_0x4220d7);}return _0xe0a0e2[_0x1cb9('0x33')]();};}function saveUpdates(_0x5e84fd,_0x3a3543){return function(_0x58f4f5){if(_0x58f4f5){return _0x58f4f5[_0x1cb9('0x34')](_0x5e84fd)[_0x1cb9('0x1f')](function(_0x3a2c60){return _0x3a2c60;});}return null;};}function removeEntity(_0xae910,_0x56c3e0){return function(_0x2114a4){if(_0x2114a4){return _0x2114a4[_0x1cb9('0x35')]()[_0x1cb9('0x1f')](function(){var _0x91a1db=_0x2114a4[_0x1cb9('0x36')]({'plain':!![]});if(_0x91a1db[_0x1cb9('0x37')]===_0x1cb9('0x38'))return;var _0x1ed5ad=[{'name':_0x1cb9('0x39'),'value':_0x1cb9('0x3a'),'ignore':!![]},{'name':_0x1cb9('0x3b'),'value':_0x1cb9('0x3c'),'ignore':![]},{'name':_0x1cb9('0x3d'),'value':'telephone','ignore':![]}];var _0x54c6e6=_(_0x1ed5ad)[_0x1cb9('0x3e')](_0x1cb9('0x3f'))[_0x1cb9('0x40')](_0x1cb9('0x41'))[_0x1cb9('0x41')]();if(_[_0x1cb9('0x42')](_0x54c6e6,_0x91a1db[_0x1cb9('0x37')])){return;}var _0x3f5637=_['find'](_0x1ed5ad,[_0x1cb9('0x41'),_0x91a1db[_0x1cb9('0x37')]])[_0x1cb9('0x43')];return db['UserProfileResource'][_0x1cb9('0x35')]({'where':{'type':_0x3f5637,'resourceId':_0x91a1db['id']}})['then'](function(){return _0x2114a4;});})[_0x1cb9('0x1f')](function(){_0xae910['status'](0xcc)[_0x1cb9('0x2b')]();});}};}function handleEntityNotFound(_0x13d4fd,_0x289b73){return function(_0x2bcacd){if(!_0x2bcacd){_0x13d4fd[_0x1cb9('0x2a')](0x194);}return _0x2bcacd;};}function handleError(_0x291802,_0x1a85ee){_0x1a85ee=_0x1a85ee||0x1f4;return function(_0x4a4788){logger['error'](_0x4a4788[_0x1cb9('0x44')]);if(_0x4a4788[_0x1cb9('0x43')]){delete _0x4a4788[_0x1cb9('0x43')];}_0x291802[_0x1cb9('0x2c')](_0x1a85ee)[_0x1cb9('0x45')](_0x4a4788);};}exports[_0x1cb9('0x46')]=function(_0x32130b,_0x4a670c){var _0xbcaa32={},_0x47edad={},_0x576ef2={'count':0x0,'rows':[]};var _0x4c6c75=_[_0x1cb9('0x40')](db[_0x1cb9('0x47')][_0x1cb9('0x48')],function(_0x2e3cf3){return{'name':_0x2e3cf3[_0x1cb9('0x49')],'type':_0x2e3cf3['type'][_0x1cb9('0x4a')]};});_0x47edad['model']=_[_0x1cb9('0x4b')](_[_0x1cb9('0x40')](_0x4c6c75,_0x1cb9('0x43')),['password',_0x1cb9('0x4c')]);_0x47edad['query']=_[_0x1cb9('0x4d')](_0x32130b[_0x1cb9('0x4e')]);_0x47edad['filters']=_['intersection'](_0x47edad[_0x1cb9('0x4f')],_0x47edad[_0x1cb9('0x4e')]);_0xbcaa32[_0x1cb9('0x50')]=_[_0x1cb9('0x51')](_0x47edad[_0x1cb9('0x4f')],qs['fields'](_0x32130b[_0x1cb9('0x4e')]['fields']));_0xbcaa32['attributes']=_0xbcaa32['attributes'][_0x1cb9('0x52')]?_0xbcaa32[_0x1cb9('0x50')]:_0x47edad[_0x1cb9('0x4f')];if(!_0x32130b[_0x1cb9('0x4e')][_0x1cb9('0x53')](_0x1cb9('0x54'))){_0xbcaa32[_0x1cb9('0x30')]=qs[_0x1cb9('0x30')](_0x32130b[_0x1cb9('0x4e')][_0x1cb9('0x30')]);_0xbcaa32[_0x1cb9('0x2f')]=qs['offset'](_0x32130b[_0x1cb9('0x4e')][_0x1cb9('0x2f')]);}_0xbcaa32[_0x1cb9('0x55')]=qs['sort'](_0x32130b[_0x1cb9('0x4e')][_0x1cb9('0x56')]);_0xbcaa32[_0x1cb9('0x57')]=qs[_0x1cb9('0x58')](_[_0x1cb9('0x59')](_0x32130b['query'],_0x47edad[_0x1cb9('0x58')]),_0x4c6c75);if(_0x32130b['query'][_0x1cb9('0x3e')]){_0xbcaa32['where']=_[_0x1cb9('0x5a')](_0xbcaa32[_0x1cb9('0x57')],{'$or':_[_0x1cb9('0x40')](_0x4c6c75,function(_0x2cb57b){if(_0x2cb57b['type']!==_0x1cb9('0x5b')){return db[_0x1cb9('0x5c')][_0x1cb9('0x57')](db[_0x1cb9('0x5c')]['fn'](_0x1cb9('0x5d'),db[_0x1cb9('0x5c')][_0x1cb9('0x5e')](_0x2cb57b[_0x1cb9('0x43')])),{'$like':db[_0x1cb9('0x5c')]['fn'](_0x1cb9('0x5d'),'%'+_0x32130b['query']['filter']+'%')});}})});}_0xbcaa32=_[_0x1cb9('0x5a')]({},_0xbcaa32,_0x32130b[_0x1cb9('0x5f')]);var _0x19e83a={'where':_0xbcaa32[_0x1cb9('0x57')]};return db[_0x1cb9('0x47')][_0x1cb9('0x2e')](_0x19e83a)[_0x1cb9('0x1f')](function(_0x1c4ff6){_0x576ef2[_0x1cb9('0x2e')]=_0x1c4ff6;if(_0x32130b[_0x1cb9('0x4e')]['includeAll']){_0xbcaa32[_0x1cb9('0x60')]=[{'all':!![]}];}return db['User'][_0x1cb9('0x61')](_0xbcaa32);})['then'](function(_0x135795){_0x576ef2['rows']=_0x135795;return _0x576ef2;})['then'](respondWithFilteredResult(_0x4a670c,_0xbcaa32))[_0x1cb9('0x29')](handleError(_0x4a670c,null));};exports[_0x1cb9('0x62')]=function(_0x303da3,_0x4bce54){var _0x3c157f={'raw':![],'where':{'id':_0x303da3['params']['id']}},_0xe67f19={};_0xe67f19['model']=_[_0x1cb9('0x4b')](_[_0x1cb9('0x4d')](db[_0x1cb9('0x47')][_0x1cb9('0x48')]),[_0x1cb9('0x63'),_0x1cb9('0x4c')]);_0xe67f19[_0x1cb9('0x4e')]=_['keys'](_0x303da3[_0x1cb9('0x4e')]);_0xe67f19[_0x1cb9('0x58')]=_[_0x1cb9('0x51')](_0xe67f19['model'],_0xe67f19[_0x1cb9('0x4e')]);_0x3c157f[_0x1cb9('0x50')]=_[_0x1cb9('0x51')](_0xe67f19[_0x1cb9('0x4f')],qs[_0x1cb9('0x64')](_0x303da3[_0x1cb9('0x4e')]['fields']));_0x3c157f[_0x1cb9('0x50')]=_0x3c157f[_0x1cb9('0x50')][_0x1cb9('0x52')]?_0x3c157f[_0x1cb9('0x50')]:_0xe67f19[_0x1cb9('0x4f')];if(_0x303da3[_0x1cb9('0x4e')][_0x1cb9('0x65')]){_0x3c157f[_0x1cb9('0x60')]=[{'all':!![]}];}_0x3c157f=_[_0x1cb9('0x5a')]({},_0x3c157f,_0x303da3[_0x1cb9('0x5f')]);return db[_0x1cb9('0x47')]['find'](_0x3c157f)[_0x1cb9('0x1f')](handleEntityNotFound(_0x4bce54,null))[_0x1cb9('0x1f')](respondWithResult(_0x4bce54,null))[_0x1cb9('0x29')](handleError(_0x4bce54,null));};exports[_0x1cb9('0x34')]=function(_0x4fc66b,_0x4a9cf8){if(_0x4fc66b[_0x1cb9('0x66')]['id']){delete _0x4fc66b[_0x1cb9('0x66')]['id'];}delete _0x4fc66b[_0x1cb9('0x66')][_0x1cb9('0x37')];return db[_0x1cb9('0x47')][_0x1cb9('0x67')]({'where':{'id':_0x4fc66b[_0x1cb9('0x68')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x4a9cf8,null))['then'](saveUpdates(_0x4fc66b['body'],null))[_0x1cb9('0x1f')](respondWithResult(_0x4a9cf8,null))['catch'](handleError(_0x4a9cf8,null));};exports['describe']=function(_0x4ca5bc,_0x580369){return db['User'][_0x1cb9('0x69')]()[_0x1cb9('0x1f')](respondWithResult(_0x580369,null))[_0x1cb9('0x29')](handleError(_0x580369,null));};exports[_0x1cb9('0x6a')]=function(_0x23d435,_0xccbee3,_0x54f008){return db[_0x1cb9('0x47')][_0x1cb9('0x67')]({'where':{'id':_0x23d435['params']['id']}})['then'](handleEntityNotFound(_0xccbee3,null))[_0x1cb9('0x1f')](function(_0x7b3380){if(_0x7b3380){return _0x7b3380[_0x1cb9('0x6a')](_0x23d435[_0x1cb9('0x66')][_0x1cb9('0x6b')],_['omit'](_0x23d435['body'],['ids','id'])||{});}})[_0x1cb9('0x1f')](respondWithResult(_0xccbee3,null))[_0x1cb9('0x29')](handleError(_0xccbee3,null));};function validateUser(_0x196349){return new BPromise(function(_0x2e83fe,_0x349f33){if(_0x196349['internal'])return _0x2e83fe(_0x196349);return db[_0x1cb9('0x6c')][_0x1cb9('0x6d')](0x1)['then'](function(_0x55b8e9){if(_0x55b8e9[_0x1cb9('0x6e')])authService['validatePasswordPattern'](_0x196349[_0x1cb9('0x63')]);db[_0x1cb9('0x47')][_0x1cb9('0x6f')](_0x1cb9('0x70'))[_0x1cb9('0x1f')](function(_0x398779){if(_['isNil'](_0x398779)){_0x196349[_0x1cb9('0x70')]=_0x55b8e9[_0x1cb9('0x71')]||0x1;return;}if(_[_0x1cb9('0x72')](_0x55b8e9[_0x1cb9('0x71')])||_0x55b8e9['min_internal']===_0x398779){_0x196349['internal']=_0x398779+0x1;return;}if(_0x55b8e9[_0x1cb9('0x71')]>_0x398779){_0x196349[_0x1cb9('0x70')]=_0x55b8e9[_0x1cb9('0x71')];return;}return db[_0x1cb9('0x5c')][_0x1cb9('0x4e')](_0x1cb9('0x73'),{'type':db['sequelize'][_0x1cb9('0x74')]['SELECT']})[_0x1cb9('0x1f')](function(_0x26dae9){if(_0x26dae9&&_0x26dae9['length']){for(var _0xf5b006=0x0,_0xce1835=_0x26dae9[_0x1cb9('0x52')];_0xf5b006<_0xce1835&&_['isNil'](_0x196349[_0x1cb9('0x70')]);_0xf5b006++){if(_0x55b8e9[_0x1cb9('0x71')]<=_0x26dae9[_0xf5b006][_0x1cb9('0x75')]){_0x196349[_0x1cb9('0x70')]=_0x26dae9[_0xf5b006][_0x1cb9('0x75')];}else if(_0x55b8e9[_0x1cb9('0x71')]>_0x26dae9[_0xf5b006]['from']&&_0x55b8e9[_0x1cb9('0x71')]<=_0x26dae9[_0xf5b006]['to']){_0x196349[_0x1cb9('0x70')]=_0x55b8e9[_0x1cb9('0x71')];}}}if(_[_0x1cb9('0x72')](_0x196349[_0x1cb9('0x70')])){_0x196349[_0x1cb9('0x70')]=_0x398779+0x1;}return _0x2e83fe(_0x196349);});});})[_0x1cb9('0x29')](function(_0x37bcd9){_0x349f33(_0x37bcd9);});});}function updateUser(_0x4cd544){return new BPromise(function(_0x28bac2,_0x78e9c){try{if(_0x4cd544['voicemail']){_0x4cd544[_0x1cb9('0x76')]=_0x4cd544['internal'];_0x4cd544[_0x1cb9('0x77')]={'mailbox':_0x4cd544['internal'],'password':_0x4cd544['password'],'fullname':_0x4cd544[_0x1cb9('0x78')],'email':_0x4cd544[_0x1cb9('0x79')]};}if(_0x4cd544['role']===_0x1cb9('0x3c')){if(!_0x4cd544['permissions'])_0x4cd544[_0x1cb9('0x7a')]=[_0x1cb9('0x7b'),_0x1cb9('0x7c'),_0x1cb9('0x7d'),'113',_0x1cb9('0x7e'),_0x1cb9('0x7f'),_0x1cb9('0x80'),_0x1cb9('0x81'),_0x1cb9('0x82'),_0x1cb9('0x83'),'109',_0x1cb9('0x84'),_0x1cb9('0x85'),_0x1cb9('0x86'),_0x1cb9('0x87')];}_0x28bac2(_0x4cd544);}catch(_0x102f2c){_0x78e9c(_0x102f2c);}});}exports[_0x1cb9('0x88')]=function(_0x5e07ba,_0x3db146){if(_0x5e07ba[_0x1cb9('0x3a')]['role']===_0x1cb9('0x3c'))throw new Error(_0x1cb9('0x89'));if(_0x5e07ba[_0x1cb9('0x66')][_0x1cb9('0x37')]===_0x1cb9('0x3a')&&_0x5e07ba[_0x1cb9('0x3a')][_0x1cb9('0x37')]!=='admin'){throw new Error(_0x1cb9('0x8a'));}if(_0x5e07ba['body'][_0x1cb9('0x37')]===_0x1cb9('0x38')&&_0x5e07ba['user'][_0x1cb9('0x37')]!==_0x1cb9('0x38')){throw new Error(_0x1cb9('0x8b'));}return licenseUtil[_0x1cb9('0x8c')]([_0x5e07ba['body']])[_0x1cb9('0x1f')](function(){return validateUser(_0x5e07ba[_0x1cb9('0x66')]);})[_0x1cb9('0x1f')](function(_0x5d0e8c){return updateUser(_0x5d0e8c)[_0x1cb9('0x1f')](function(_0xe3ee8e){if(_0xe3ee8e[_0x1cb9('0x37')]===_0x1cb9('0x38')){_0xe3ee8e[_0x1cb9('0x8d')]=_0x5e07ba[_0x1cb9('0x3a')][_0x1cb9('0x8d')];delete _0xe3ee8e['userProfileId'];}return _0xe3ee8e;});})[_0x1cb9('0x1f')](function(_0x4b15a4){return db[_0x1cb9('0x47')][_0x1cb9('0x88')](_0x4b15a4,{'include':[{'model':db[_0x1cb9('0x77')],'as':_0x1cb9('0x77')}]});})['then'](function(_0x1ff5e9){if(_0x5e07ba[_0x1cb9('0x66')]['role']===_0x1cb9('0x3a'))return _0x1ff5e9;if(_0x5e07ba[_0x1cb9('0x3a')][_0x1cb9('0x37')]!==_0x1cb9('0x3a'))return _0x1ff5e9;return db[_0x1cb9('0x8e')]['find']({'where':{'name':_0x1ff5e9['role']==='agent'?'Agents':_0x1cb9('0x3d'),'userProfileId':_0x5e07ba[_0x1cb9('0x3a')][_0x1cb9('0x8f')]},'raw':!![]})[_0x1cb9('0x1f')](function(_0x3534b6){if(!_0x3534b6||_0x3534b6[_0x1cb9('0x90')]!=0x0)return _0x1ff5e9;return db[_0x1cb9('0x91')][_0x1cb9('0x88')]({'name':_0x1ff5e9['name'],'resourceId':_0x1ff5e9['id'],'type':_0x3534b6[_0x1cb9('0x43')],'sectionId':_0x3534b6['id']},{})[_0x1cb9('0x1f')](function(){return _0x1ff5e9;});})[_0x1cb9('0x29')](function(_0x5eff1e){logger[_0x1cb9('0x24')](_0x1cb9('0x92'),_0x5eff1e);throw _0x5eff1e;});})['then'](respondWithResult(_0x3db146,0xc9))[_0x1cb9('0x29')](handleError(_0x3db146,null));};exports[_0x1cb9('0x93')]=function(_0x887adc,_0x466dc7){var _0x5cb5e5=_0x887adc[_0x1cb9('0x66')];var _0x282ffa=[];if(_0x887adc['user']['role']===_0x1cb9('0x3c'))throw new Error(_0x1cb9('0x89'));if(_['some'](_0x5cb5e5,['role',_0x1cb9('0x3a')])&&_0x887adc[_0x1cb9('0x3a')]['role']!=='admin'){throw new Error(_0x1cb9('0x8a'));}if(_['some'](_0x5cb5e5,['role','admin'])&&_0x887adc[_0x1cb9('0x3a')]['role']!==_0x1cb9('0x38')){throw new Error(_0x1cb9('0x94'));}return licenseUtil[_0x1cb9('0x8c')](_0x5cb5e5)['then'](function(){return validateUser(_0x5cb5e5[0x0]);})[_0x1cb9('0x1f')](function(){for(var _0x2fbe45=0x1;_0x2fbe45<_0x5cb5e5[_0x1cb9('0x52')];_0x2fbe45++){var _0x4c54b5=_0x5cb5e5[_0x2fbe45-0x1][_0x1cb9('0x70')];if(!_0x5cb5e5[_0x2fbe45][_0x1cb9('0x70')])_0x5cb5e5[_0x2fbe45][_0x1cb9('0x70')]=_0x4c54b5+0x1;_0x282ffa[_0x1cb9('0x95')](validateUser(_0x5cb5e5[_0x2fbe45]));}return BPromise[_0x1cb9('0x96')](_0x282ffa);})['then'](function(){_0x282ffa=[];for(var _0x19bd03=0x0;_0x19bd03<_0x5cb5e5[_0x1cb9('0x52')];_0x19bd03++){_0x282ffa[_0x1cb9('0x95')](updateUser(_0x5cb5e5[_0x19bd03]));}return BPromise['all'](_0x282ffa);})[_0x1cb9('0x1f')](function(){return BPromise[_0x1cb9('0x97')](_0x5cb5e5,function(_0x534378){return db[_0x1cb9('0x47')][_0x1cb9('0x88')](_0x534378,{'include':[{'model':db['VoiceMail'],'as':_0x1cb9('0x77')}]})[_0x1cb9('0x1f')](function(_0x40148e){_0x534378['id']=_0x40148e['id'];return _0x534378;});});})[_0x1cb9('0x1f')](function(_0x2f19e5){if(_0x887adc[_0x1cb9('0x66')][_0x1cb9('0x37')]===_0x1cb9('0x3a'))return _0x2f19e5;if(_0x887adc[_0x1cb9('0x3a')][_0x1cb9('0x37')]!==_0x1cb9('0x3a'))return _0x2f19e5;var _0x2bb5a2=_[_0x1cb9('0x98')](_0x2f19e5,function(_0x1b2b1c){return _0x1b2b1c[_0x1cb9('0x37')]===_0x1cb9('0x3c')||_0x1b2b1c[_0x1cb9('0x37')]===_0x1cb9('0x99');});if(!_0x2bb5a2)return _0x2f19e5;return db['UserProfileSection']['findAll']({'where':{'name':{'$or':[_0x1cb9('0x3b'),_0x1cb9('0x3d')]},'userProfileId':_0x887adc[_0x1cb9('0x3a')][_0x1cb9('0x8f')]},'raw':!![]})[_0x1cb9('0x1f')](function(_0x165789){if(_[_0x1cb9('0x9a')](_0x165789)||!_['some'](_0x165789,['autoAssociation',0x0]))return _0x2f19e5;_0x282ffa=[];var _0x1d14a4=_(_0x165789)[_0x1cb9('0x40')](function(_0x29b478){if(_0x29b478[_0x1cb9('0x90')]===0x1)return;return _0x29b478[_0x1cb9('0x43')]==='Agents'?_0x1cb9('0x3c'):_0x1cb9('0x99');})[_0x1cb9('0x9b')]()['value']();for(var _0x36faa4=0x0;_0x36faa4<_0x2f19e5[_0x1cb9('0x52')];_0x36faa4++){if(!_[_0x1cb9('0x42')](_0x1d14a4,_0x2f19e5[_0x36faa4]['role']))return;var _0x17fc5a=_0x2f19e5[_0x36faa4][_0x1cb9('0x37')]===_0x1cb9('0x3c')?'Agents':'Telephones';_0x282ffa['push'](db[_0x1cb9('0x91')][_0x1cb9('0x88')]({'name':_0x2f19e5[_0x36faa4][_0x1cb9('0x43')],'resourceId':_0x2f19e5[_0x36faa4]['id'],'type':_0x17fc5a,'sectionId':_['find'](_0x165789,[_0x1cb9('0x43'),_0x17fc5a])['id']},{}));}return BPromise['all'](_0x282ffa);});})['then'](respondWithResult(_0x466dc7,0xc9))[_0x1cb9('0x29')](handleError(_0x466dc7,null));};exports[_0x1cb9('0x9c')]=function(_0x46f990,_0x2fa5b8,_0x2b31b7){if(_0x46f990[_0x1cb9('0x66')]['id']){delete _0x46f990[_0x1cb9('0x66')]['id'];}return db[_0x1cb9('0x47')][_0x1cb9('0x67')]({'where':{'id':_0x46f990[_0x1cb9('0x68')]['id']}})['then'](function(_0x4ff2da){if(!_0x4ff2da)return null;if(_0x4ff2da['id']===_0x46f990[_0x1cb9('0x3a')]['id']){if(!_0x46f990[_0x1cb9('0x66')]['oldPassword']||!_0x46f990['body']['newPassword']){throw new db['Sequelize'][(_0x1cb9('0x9d'))](_0x1cb9('0x9e'));}if(!_0x4ff2da['authenticate'](_0x46f990[_0x1cb9('0x66')][_0x1cb9('0x9f')])){throw new db[(_0x1cb9('0xa0'))][(_0x1cb9('0x9d'))](_0x1cb9('0xa1'));}if(_0x46f990['body'][_0x1cb9('0x9f')]===_0x46f990[_0x1cb9('0x66')][_0x1cb9('0xa2')]){throw new db[(_0x1cb9('0xa0'))]['ValidationError'](_0x1cb9('0xa3'));}}else if(_0x46f990[_0x1cb9('0x3a')]['role']==='admin'){if(!_0x46f990['body'][_0x1cb9('0xa2')]){throw new db['Sequelize'][(_0x1cb9('0x9d'))](_0x1cb9('0xa4'));}}else if(_0x46f990[_0x1cb9('0x3a')][_0x1cb9('0x37')]===_0x1cb9('0x3a')){if(!_0x46f990[_0x1cb9('0x66')]['newPassword']){throw new db[(_0x1cb9('0xa0'))][(_0x1cb9('0x9d'))](_0x1cb9('0xa4'));}if(_0x4ff2da[_0x1cb9('0x37')]!==_0x1cb9('0x3c')){throw new db[(_0x1cb9('0xa0'))][(_0x1cb9('0x9d'))](_0x1cb9('0x89'));}}else{throw new db[(_0x1cb9('0xa0'))][(_0x1cb9('0x9d'))](_0x1cb9('0x89'));}return _0x4ff2da;})[_0x1cb9('0x1f')](handleEntityNotFound(_0x2fa5b8,null))[_0x1cb9('0x1f')](function(_0x1022d8){return db[_0x1cb9('0x6c')]['findOne']({'attributes':['id','securePassword','enforcePasswordHistory',_0x1cb9('0xa5')]})[_0x1cb9('0x1f')](function(_0x4d887c){if(_0x4d887c[_0x1cb9('0x6e')])authService[_0x1cb9('0xa6')](_0x46f990[_0x1cb9('0x66')]['newPassword']);if(!_0x4d887c[_0x1cb9('0xa7')]||!_0x1022d8[_0x1cb9('0xa8')])return _0x1022d8;authService[_0x1cb9('0xa9')](_0x46f990[_0x1cb9('0x66')][_0x1cb9('0xa2')],_0x1022d8['previousPasswords'],_0x4d887c[_0x1cb9('0xa5')]);return _0x1022d8;})['then'](saveUpdates({'password':_0x46f990['body'][_0x1cb9('0xa2')],'passwordResetAt':_0x46f990[_0x1cb9('0x3a')]['id']==_0x46f990[_0x1cb9('0x68')]['id']?moment():null,'previousPasswords':authService[_0x1cb9('0xaa')](_0x46f990[_0x1cb9('0x66')][_0x1cb9('0xa2')],_0x1022d8[_0x1cb9('0xa8')])},null));})[_0x1cb9('0x1f')](respondWithResult(_0x2fa5b8,null))['catch'](handleError(_0x2fa5b8,null));};exports[_0x1cb9('0xab')]=function(_0x1b259c,_0x370df9,_0x2d8585){var _0x2aed50=_0x1b259c['body'][_0x1cb9('0xac')];return db[_0x1cb9('0x47')][_0x1cb9('0x67')]({'where':{'id':_0x1b259c[_0x1cb9('0x68')]['id']},'attributes':['id',_0x1cb9('0x43'),'role',_0x1cb9('0xad'),_0x1cb9('0xae'),_0x1cb9('0xaf'),'interface']})[_0x1cb9('0x1f')](handleEntityNotFound(_0x370df9,null))[_0x1cb9('0x1f')](function(_0x42d642){if(_0x42d642){if(!utils[_0x1cb9('0xb0')](_0x2aed50)){throw new db[(_0x1cb9('0xa0'))][(_0x1cb9('0x9d'))]('Unknown\x20channel');}return _0x42d642[_0x1cb9('0xb1')+_[_0x1cb9('0xb2')](_0x2aed50[_0x1cb9('0xb3')]())+'Queues'](_0x1b259c[_0x1cb9('0x66')][_0x1cb9('0x6b')],{'penalty':_0x1b259c['body']['penalty']||0x0})[_0x1cb9('0xb4')](function(_0x3fc823){for(var _0xe867bd=0x0;_0xe867bd<_0x1b259c[_0x1cb9('0x66')][_0x1cb9('0x6b')]['length'];_0xe867bd+=0x1){var _0x3fdb00={'UserId':_0x1b259c[_0x1cb9('0x68')]['id']};_0x3fdb00[_[_0x1cb9('0xb2')](_0x2aed50[_0x1cb9('0xb3')]())+_0x1cb9('0xb5')]=_0x1b259c['body']['ids'][_0xe867bd];socket[_0x1cb9('0xb6')](_0x1cb9('0x3a')+_[_0x1cb9('0xb2')](_0x2aed50['toLowerCase']())+'Queue:save',_0x3fdb00);}return _0x3fc823;})[_0x1cb9('0x1f')](function(){if(_0x2aed50===_0x1cb9('0xb7')){return db[_0x1cb9('0xb8')]['findAll']({'where':{'id':_0x1b259c['body']['ids']||[]},'raw':!![],'attributes':['id',_0x1cb9('0x43')]});}})[_0x1cb9('0x1f')](function(_0x27995f){var _0x5268fa=_0x42d642[_0x1cb9('0x36')]({'plain':!![]});var _0x5311dd=[];if(_0x2aed50===_0x1cb9('0xb7')&&_0x5268fa[_0x1cb9('0x37')]===_0x1cb9('0x3c')&&_0x5268fa[_0x1cb9('0xad')]){for(var _0x42e789=0x0;_0x42e789<_0x27995f['length'];_0x42e789+=0x1){_0x5311dd[_0x1cb9('0x95')]({'membername':_0x5268fa['name'],'UserId':_0x5268fa['id'],'queue_name':_0x27995f[_0x42e789][_0x1cb9('0x43')],'VoiceQueueId':_0x27995f[_0x42e789]['id'],'interface':_[_0x1cb9('0x72')](_0x5268fa[_0x1cb9('0xb9')])?util[_0x1cb9('0xba')](_0x1cb9('0xbb'),_0x5268fa['name']):_0x5268fa[_0x1cb9('0xb9')],'paused':_0x5268fa[_0x1cb9('0xaf')]||![],'penalty':_0x1b259c[_0x1cb9('0x66')][_0x1cb9('0xbc')]||0x0});}return BPromise[_0x1cb9('0x97')](_0x5311dd,function(_0x42c4d6){return db[_0x1cb9('0xbd')]['upsert'](_0x42c4d6);});}return _0x42d642;});}})['then'](respondWithStatusCode(_0x370df9,null))[_0x1cb9('0x29')](handleError(_0x370df9,null));};exports[_0x1cb9('0xbe')]=function(_0x46fdc2,_0x1cdff0,_0x106fe7){var _0x54b0d0;return db[_0x1cb9('0x47')][_0x1cb9('0x67')]({'where':{'id':_0x46fdc2['params']['id']},'attributes':['id','name',_0x1cb9('0x37')]})['then'](handleEntityNotFound(_0x1cdff0,null))[_0x1cb9('0x1f')](function(_0x4af9bb){if(_0x4af9bb){_0x54b0d0=_0x4af9bb;if(!_0x46fdc2[_0x1cb9('0x4e')][_0x1cb9('0xac')]||!utils[_0x1cb9('0xb0')](_0x46fdc2[_0x1cb9('0x4e')][_0x1cb9('0xac')])){throw new db[(_0x1cb9('0xa0'))][(_0x1cb9('0x9d'))](_0x1cb9('0xbf'));}return _0x4af9bb[_0x1cb9('0xc0')+_[_0x1cb9('0xb2')](_0x46fdc2[_0x1cb9('0x4e')][_0x1cb9('0xac')]['toLowerCase']())+'Queues'](_0x46fdc2['query']['ids']);}})[_0x1cb9('0x1f')](function(_0xb23270){for(var _0x550877=0x0;_0x550877<_0x46fdc2['query']['ids'][_0x1cb9('0x52')];_0x550877+=0x1){var _0x327c0d={'UserId':_0x46fdc2[_0x1cb9('0x68')]['id']};_0x327c0d[_[_0x1cb9('0xb2')](_0x46fdc2['query'][_0x1cb9('0xac')][_0x1cb9('0xb3')]())+_0x1cb9('0xb5')]=_0x46fdc2['query'][_0x1cb9('0x6b')][_0x550877];socket[_0x1cb9('0xb6')]('user'+_[_0x1cb9('0xb2')](_0x46fdc2['query'][_0x1cb9('0xac')][_0x1cb9('0xb3')]())+_0x1cb9('0xc1'),_0x327c0d);}return _0xb23270;})[_0x1cb9('0x1f')](function(){if(_0x46fdc2[_0x1cb9('0x4e')][_0x1cb9('0xac')]===_0x1cb9('0xb7')){return db['UserVoiceQueueRt'][_0x1cb9('0x35')]({'where':{'UserId':_0x46fdc2[_0x1cb9('0x68')]['id'],'VoiceQueueId':_0x46fdc2[_0x1cb9('0x4e')][_0x1cb9('0x6b')]},'individualHooks':!![]})[_0x1cb9('0x1f')](function(){return _0x54b0d0;});}return _0x54b0d0;})[_0x1cb9('0x1f')](respondWithStatusCode(_0x1cdff0,null))[_0x1cb9('0x29')](handleError(_0x1cdff0,null));};exports[_0x1cb9('0xc2')]=function(_0x181146,_0x394a89,_0x4a050d){_0x181146[_0x1cb9('0x66')][_0x1cb9('0xc3')]=_0x181146[_0x1cb9('0xc4')][_0x1cb9('0xc5')];return db[_0x1cb9('0x47')]['find']({'where':{'id':_0x181146[_0x1cb9('0x68')]['id']}})['then'](handleEntityNotFound(_0x394a89,null))['then'](saveUpdates(_0x181146[_0x1cb9('0x66')],null))[_0x1cb9('0x1f')](respondWithResult(_0x394a89,null))[_0x1cb9('0x29')](handleError(_0x394a89,null));};exports[_0x1cb9('0xc6')]=function(_0x1d45aa,_0x250556,_0x3bc190){var _0x1fad95=path[_0x1cb9('0xc7')](config['root'],'server/files/images/logos/default_profile.png');return db[_0x1cb9('0x47')][_0x1cb9('0x67')]({'where':{'id':_0x1d45aa[_0x1cb9('0x68')]['id']},'attributes':['id',_0x1cb9('0xc3')],'raw':!![]})[_0x1cb9('0x1f')](handleEntityNotFound(_0x250556,null))[_0x1cb9('0x1f')](function(_0x27f056){if(_0x27f056){if(_[_0x1cb9('0x72')](_0x27f056[_0x1cb9('0xc3')])){return _0x250556[_0x1cb9('0xc8')](_0x1fad95);}else{if(!fs['existsSync'](path[_0x1cb9('0xc7')](config[_0x1cb9('0xc9')],_0x1cb9('0xca'),_0x27f056[_0x1cb9('0xc3')]))){return _0x250556[_0x1cb9('0xc8')](_0x1fad95);}return _0x250556[_0x1cb9('0xc8')](path['join'](config[_0x1cb9('0xc9')],_0x1cb9('0xca'),_0x27f056[_0x1cb9('0xc3')]));}}})[_0x1cb9('0x29')](handleError(_0x250556,null));};exports[_0x1cb9('0xcb')]=function(_0x1bf6a4,_0x44dbc8,_0x592e22){var _0x200ad9={};var _0x1c1dc0={};var _0x276900;var _0x45c0e6;return db[_0x1cb9('0x47')][_0x1cb9('0xcc')]({'where':{'id':_0x1bf6a4[_0x1cb9('0x68')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x44dbc8,null))[_0x1cb9('0x1f')](function(_0x42622e){if(_0x42622e){_0x276900=_0x42622e;_0x1c1dc0[_0x1cb9('0x4f')]=_[_0x1cb9('0x4d')](db[_0x1cb9('0xcd')][_0x1cb9('0x48')]);_0x1c1dc0[_0x1cb9('0x4e')]=_[_0x1cb9('0x4d')](_0x1bf6a4[_0x1cb9('0x4e')]);_0x1c1dc0[_0x1cb9('0x58')]=_[_0x1cb9('0x51')](_0x1c1dc0[_0x1cb9('0x4f')],_0x1c1dc0[_0x1cb9('0x4e')]);_0x200ad9[_0x1cb9('0x50')]=_['intersection'](_0x1c1dc0[_0x1cb9('0x4f')],qs[_0x1cb9('0x64')](_0x1bf6a4[_0x1cb9('0x4e')][_0x1cb9('0x64')]));_0x200ad9[_0x1cb9('0x50')]=_0x200ad9[_0x1cb9('0x50')]['length']?_0x200ad9[_0x1cb9('0x50')]:_0x1c1dc0['model'];_0x200ad9[_0x1cb9('0x55')]=qs[_0x1cb9('0x56')](_0x1bf6a4[_0x1cb9('0x4e')]['sort']);_0x200ad9[_0x1cb9('0x57')]=qs[_0x1cb9('0x58')](_[_0x1cb9('0x59')](_0x1bf6a4[_0x1cb9('0x4e')],_0x1c1dc0['filters']));if(_0x1bf6a4[_0x1cb9('0x4e')][_0x1cb9('0x3e')]){_0x200ad9[_0x1cb9('0x57')]=_[_0x1cb9('0x5a')](_0x200ad9['where'],{'$or':_[_0x1cb9('0x40')](_0x200ad9[_0x1cb9('0x50')],function(_0x574001){var _0x21d844={};_0x21d844[_0x574001]={'$like':'%'+_0x1bf6a4[_0x1cb9('0x4e')][_0x1cb9('0x3e')]+'%'};return _0x21d844;})});}_0x200ad9=_[_0x1cb9('0x5a')]({},_0x200ad9,_0x1bf6a4[_0x1cb9('0x5f')]);return _0x276900[_0x1cb9('0xcb')](_0x200ad9);}})[_0x1cb9('0x1f')](function(_0x78d2bc){if(_0x78d2bc){_0x45c0e6=_0x78d2bc[_0x1cb9('0x52')];if(_0x1bf6a4[_0x1cb9('0x4e')][_0x1cb9('0x53')]('includeAll')){_0x200ad9[_0x1cb9('0x60')]=[{'model':db['CmList'],'as':_0x1cb9('0xce'),'required':![]},{'model':db[_0x1cb9('0xcf')],'as':_0x1cb9('0xd0'),'attributes':['id',_0x1cb9('0x43'),_0x1cb9('0xd1')],'where':_0x1bf6a4[_0x1cb9('0x4e')][_0x1cb9('0xd2')]?{'id':_0x1bf6a4[_0x1cb9('0x4e')][_0x1cb9('0xd2')]}:undefined,'required':_0x1bf6a4[_0x1cb9('0x4e')][_0x1cb9('0xd2')]?!![]:![]}];}if(!_0x1bf6a4[_0x1cb9('0x4e')][_0x1cb9('0x53')]('nolimit')){_0x200ad9[_0x1cb9('0x30')]=qs[_0x1cb9('0x30')](_0x1bf6a4[_0x1cb9('0x4e')]['limit']);_0x200ad9['offset']=qs['offset'](_0x1bf6a4[_0x1cb9('0x4e')][_0x1cb9('0x2f')]);}return _0x276900['getContacts'](_0x200ad9);}})[_0x1cb9('0x1f')](function(_0x31627f){if(_0x31627f){return _0x31627f?{'count':_0x45c0e6,'rows':_0x31627f}:null;}})[_0x1cb9('0x1f')](respondWithResult(_0x44dbc8,null))[_0x1cb9('0x29')](handleError(_0x44dbc8,null));};exports[_0x1cb9('0xd3')]=function(_0x5b2928,_0x18792b,_0x149b0c){var _0x259727;var _0x1b0aae;var _0x566572={};var _0x4adc16;return db[_0x1cb9('0x47')][_0x1cb9('0xcc')]({'where':{'id':_0x5b2928[_0x1cb9('0x68')]['id']},'attributes':['id',_0x1cb9('0x43'),_0x1cb9('0x37')]})['then'](handleEntityNotFound(_0x18792b,null))[_0x1cb9('0x1f')](function(_0x436e30){if(!utils[_0x1cb9('0xb0')](_0x5b2928[_0x1cb9('0x4e')][_0x1cb9('0xac')])){throw new db[(_0x1cb9('0xa0'))][(_0x1cb9('0x9d'))](_0x1cb9('0xbf'));}_0x259727=_0x436e30;var _0xa43246={};_0xa43246[_0x1cb9('0x4f')]=_[_0x1cb9('0x4d')](db[_['capitalize'](_0x5b2928[_0x1cb9('0x4e')][_0x1cb9('0xac')])+'Queue'][_0x1cb9('0x48')]);_0xa43246['query']=_[_0x1cb9('0x4d')](_0x5b2928[_0x1cb9('0x4e')]);_0xa43246[_0x1cb9('0x58')]=_[_0x1cb9('0x51')](_0xa43246[_0x1cb9('0x4f')],_0xa43246[_0x1cb9('0x4e')]);_0x566572[_0x1cb9('0x50')]=_[_0x1cb9('0x51')](_0xa43246[_0x1cb9('0x4f')],qs['fields'](_0x5b2928['query']['fields']));_0x566572[_0x1cb9('0x50')]=_0x566572[_0x1cb9('0x50')][_0x1cb9('0x52')]?_0x566572['attributes']:_0xa43246[_0x1cb9('0x4f')];_0x566572[_0x1cb9('0x55')]=qs[_0x1cb9('0x56')](_0x5b2928[_0x1cb9('0x4e')]['sort']);_0x566572['where']=qs[_0x1cb9('0x58')](_[_0x1cb9('0x59')](_0x5b2928['query'],_0xa43246[_0x1cb9('0x58')]));if(_0x5b2928[_0x1cb9('0x4e')]['filter']){_0x566572[_0x1cb9('0x57')]=_[_0x1cb9('0x5a')](_0x566572[_0x1cb9('0x57')],{'$or':_['map'](_0x566572['attributes'],function(_0x3d9610){var _0x73fc01={};_0x73fc01[_0x3d9610]={'$like':'%'+_0x5b2928['query'][_0x1cb9('0x3e')]+'%'};return _0x73fc01;})});}_0x566572=_[_0x1cb9('0x5a')]({},_0x566572,_0x5b2928[_0x1cb9('0x5f')]);switch(_0x259727[_0x1cb9('0x37')]){case'admin':return db[_[_0x1cb9('0xb2')](_0x5b2928[_0x1cb9('0x4e')][_0x1cb9('0xac')])+_0x1cb9('0xd4')][_0x1cb9('0x61')](_0x566572);case'user':case _0x1cb9('0x3c'):return _0x259727['get'+_[_0x1cb9('0xb2')](_0x5b2928['query'][_0x1cb9('0xac')])+'Queues'](_0x566572);default:throw new db[(_0x1cb9('0xa0'))][(_0x1cb9('0x9d'))](_0x1cb9('0xd5'));}})[_0x1cb9('0x1f')](function(_0x3f54a8){_0x4adc16=_0x3f54a8[_0x1cb9('0x52')];if(!_0x5b2928[_0x1cb9('0x4e')][_0x1cb9('0x53')]('nolimit')){_0x566572[_0x1cb9('0x30')]=qs[_0x1cb9('0x30')](_0x5b2928[_0x1cb9('0x4e')][_0x1cb9('0x30')]);_0x566572[_0x1cb9('0x2f')]=qs[_0x1cb9('0x2f')](_0x5b2928['query']['offset']);}switch(_0x259727[_0x1cb9('0x37')]){case _0x1cb9('0x38'):return db[_[_0x1cb9('0xb2')](_0x5b2928[_0x1cb9('0x4e')][_0x1cb9('0xac')])+_0x1cb9('0xd4')]['findAll'](_0x566572);case'user':case _0x1cb9('0x3c'):return _0x259727[_0x1cb9('0x36')+_[_0x1cb9('0xb2')](_0x5b2928['query'][_0x1cb9('0xac')])+_0x1cb9('0xd6')](_0x566572);}})[_0x1cb9('0x1f')](function(_0x490100){return{'count':_0x4adc16,'rows':_0x490100};})[_0x1cb9('0x1f')](respondWithResult(_0x18792b,null))[_0x1cb9('0x29')](handleError(_0x18792b,null));};exports[_0x1cb9('0xd7')]=function(_0xb3ff97,_0x24eaec,_0x182ca2){var _0x22340d={};var _0x3979bb={};var _0x3f445f;var _0x7b0437;return db[_0x1cb9('0x47')][_0x1cb9('0xcc')]({'where':{'id':_0xb3ff97['params']['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x24eaec,null))['then'](function(_0x47bb20){if(_0x47bb20){_0x3f445f=_0x47bb20;_0x3979bb['model']=_['keys'](db[_0x1cb9('0xbd')][_0x1cb9('0x48')]);_0x3979bb['query']=_[_0x1cb9('0x4d')](_0xb3ff97['query']);_0x3979bb[_0x1cb9('0x58')]=_[_0x1cb9('0x51')](_0x3979bb[_0x1cb9('0x4f')],_0x3979bb['query']);_0x22340d[_0x1cb9('0x50')]=_[_0x1cb9('0x51')](_0x3979bb[_0x1cb9('0x4f')],qs[_0x1cb9('0x64')](_0xb3ff97[_0x1cb9('0x4e')][_0x1cb9('0x64')]));_0x22340d[_0x1cb9('0x50')]=_0x22340d[_0x1cb9('0x50')]['length']?_0x22340d[_0x1cb9('0x50')]:_0x3979bb['model'];_0x22340d[_0x1cb9('0x55')]=qs['sort'](_0xb3ff97[_0x1cb9('0x4e')][_0x1cb9('0x56')]);_0x22340d[_0x1cb9('0x57')]=qs['filters'](_[_0x1cb9('0x59')](_0xb3ff97[_0x1cb9('0x4e')],_0x3979bb[_0x1cb9('0x58')]));if(_0xb3ff97[_0x1cb9('0x4e')][_0x1cb9('0x3e')]){_0x22340d['where']=_[_0x1cb9('0x5a')](_0x22340d[_0x1cb9('0x57')],{'$or':_[_0x1cb9('0x40')](_0x22340d['attributes'],function(_0x27840b){var _0x1978d3={};_0x1978d3[_0x27840b]={'$like':'%'+_0xb3ff97[_0x1cb9('0x4e')][_0x1cb9('0x3e')]+'%'};return _0x1978d3;})});}_0x22340d=_['merge']({},_0x22340d,_0xb3ff97[_0x1cb9('0x5f')]);return _0x3f445f['getVoiceQueuesRt'](_0x22340d);}})['then'](function(_0x327071){if(_0x327071){_0x7b0437=_0x327071['length'];if(!_0xb3ff97[_0x1cb9('0x4e')]['hasOwnProperty'](_0x1cb9('0x54'))){_0x22340d[_0x1cb9('0x30')]=qs['limit'](_0xb3ff97[_0x1cb9('0x4e')][_0x1cb9('0x30')]);_0x22340d[_0x1cb9('0x2f')]=qs[_0x1cb9('0x2f')](_0xb3ff97[_0x1cb9('0x4e')][_0x1cb9('0x2f')]);}return _0x3f445f['getVoiceQueuesRt'](_0x22340d);}})[_0x1cb9('0x1f')](function(_0x45a7a4){if(_0x45a7a4){return _0x45a7a4?{'count':_0x7b0437,'rows':_0x45a7a4}:null;}})[_0x1cb9('0x1f')](respondWithResult(_0x24eaec,null))[_0x1cb9('0x29')](handleError(_0x24eaec,null));};exports[_0x1cb9('0xd8')]=function(_0x170033,_0x5caa7c,_0x5a4d77){var _0x3f3ff9={};var _0x203478={};var _0x2f5705;var _0x33bfc1;return db['User'][_0x1cb9('0xcc')]({'where':{'id':_0x170033[_0x1cb9('0x68')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x5caa7c,null))['then'](function(_0x410c9f){if(_0x410c9f){_0x2f5705=_0x410c9f;_0x203478[_0x1cb9('0x4f')]=_['keys'](db[_0x1cb9('0xd9')][_0x1cb9('0x48')]);_0x203478['query']=_[_0x1cb9('0x4d')](_0x170033[_0x1cb9('0x4e')]);_0x203478[_0x1cb9('0x58')]=_[_0x1cb9('0x51')](_0x203478[_0x1cb9('0x4f')],_0x203478[_0x1cb9('0x4e')]);_0x3f3ff9[_0x1cb9('0x50')]=_['intersection'](_0x203478[_0x1cb9('0x4f')],qs['fields'](_0x170033[_0x1cb9('0x4e')][_0x1cb9('0x64')]));_0x3f3ff9[_0x1cb9('0x50')]=_0x3f3ff9[_0x1cb9('0x50')]['length']?_0x3f3ff9[_0x1cb9('0x50')]:_0x203478[_0x1cb9('0x4f')];_0x3f3ff9[_0x1cb9('0x55')]=qs['sort'](_0x170033[_0x1cb9('0x4e')]['sort']);_0x3f3ff9['where']=qs[_0x1cb9('0x58')](_['pick'](_0x170033[_0x1cb9('0x4e')],_0x203478['filters']));if(_0x170033[_0x1cb9('0x4e')][_0x1cb9('0x3e')]){_0x3f3ff9[_0x1cb9('0x57')]=_[_0x1cb9('0x5a')](_0x3f3ff9[_0x1cb9('0x57')],{'$or':_[_0x1cb9('0x40')](_0x3f3ff9[_0x1cb9('0x50')],function(_0x3cbd38){var _0x1a4b8c={};_0x1a4b8c[_0x3cbd38]={'$like':'%'+_0x170033[_0x1cb9('0x4e')][_0x1cb9('0x3e')]+'%'};return _0x1a4b8c;})});}_0x3f3ff9=_[_0x1cb9('0x5a')]({},_0x3f3ff9,_0x170033[_0x1cb9('0x5f')]);return _0x2f5705['getGroups'](_0x3f3ff9);}})[_0x1cb9('0x1f')](function(_0x183798){if(_0x183798){_0x33bfc1=_0x183798['length'];if(!_0x170033['query'][_0x1cb9('0x53')](_0x1cb9('0x54'))){_0x3f3ff9[_0x1cb9('0x30')]=qs['limit'](_0x170033[_0x1cb9('0x4e')][_0x1cb9('0x30')]);_0x3f3ff9['offset']=qs[_0x1cb9('0x2f')](_0x170033[_0x1cb9('0x4e')][_0x1cb9('0x2f')]);}return _0x2f5705[_0x1cb9('0xd8')](_0x3f3ff9);}})[_0x1cb9('0x1f')](function(_0x3771ef){if(_0x3771ef){return _0x3771ef?{'count':_0x33bfc1,'rows':_0x3771ef}:null;}})['then'](respondWithResult(_0x5caa7c,null))[_0x1cb9('0x29')](handleError(_0x5caa7c,null));};exports['getRecordings']=function(_0x30e969,_0x5ef01e,_0x3680dd){var _0x1a808a={'raw':!![],'where':{}};var _0x45d912={};var _0x451250={'count':0x0,'rows':[]};return db[_0x1cb9('0x47')][_0x1cb9('0xcc')]({'where':{'id':_0x30e969['params']['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x5ef01e,null))[_0x1cb9('0x1f')](function(_0x4169d9){if(_0x4169d9){_0x45d912['model']=_['keys'](db[_0x1cb9('0xda')]['rawAttributes']);_0x45d912[_0x1cb9('0x4e')]=_[_0x1cb9('0x4d')](_0x30e969['query']);_0x45d912[_0x1cb9('0x58')]=_[_0x1cb9('0x51')](_0x45d912[_0x1cb9('0x4f')],_0x45d912[_0x1cb9('0x4e')]);_0x1a808a[_0x1cb9('0x50')]=_[_0x1cb9('0x51')](_0x45d912[_0x1cb9('0x4f')],qs[_0x1cb9('0x64')](_0x30e969[_0x1cb9('0x4e')][_0x1cb9('0x64')]));_0x1a808a[_0x1cb9('0x50')]=_0x1a808a[_0x1cb9('0x50')]['length']?_0x1a808a[_0x1cb9('0x50')]:_0x45d912[_0x1cb9('0x4f')];if(!_0x30e969[_0x1cb9('0x4e')][_0x1cb9('0x53')](_0x1cb9('0x54'))){_0x1a808a['limit']=qs[_0x1cb9('0x30')](_0x30e969[_0x1cb9('0x4e')]['limit']);_0x1a808a[_0x1cb9('0x2f')]=qs[_0x1cb9('0x2f')](_0x30e969[_0x1cb9('0x4e')][_0x1cb9('0x2f')]);}_0x1a808a[_0x1cb9('0x55')]=qs[_0x1cb9('0x56')](_0x30e969['query'][_0x1cb9('0x56')]);_0x1a808a[_0x1cb9('0x57')]=qs['filters'](_[_0x1cb9('0x59')](_0x30e969[_0x1cb9('0x4e')],_0x45d912[_0x1cb9('0x58')]));_0x1a808a['where']['UserId']=_0x4169d9['id'];if(_0x30e969[_0x1cb9('0x4e')][_0x1cb9('0x3e')]){_0x1a808a[_0x1cb9('0x57')]=_[_0x1cb9('0x5a')](_0x1a808a[_0x1cb9('0x57')],{'$or':_[_0x1cb9('0x40')](_0x1a808a[_0x1cb9('0x50')],function(_0x4c62ad){var _0x52fdb2={};_0x52fdb2[_0x4c62ad]={'$like':'%'+_0x30e969['query'][_0x1cb9('0x3e')]+'%'};return _0x52fdb2;})});}_0x1a808a=_['merge']({},_0x1a808a,_0x30e969[_0x1cb9('0x5f')]);return db[_0x1cb9('0xda')][_0x1cb9('0x2e')]({'where':_0x1a808a[_0x1cb9('0x57')]})[_0x1cb9('0x1f')](function(_0x550dca){_0x451250[_0x1cb9('0x2e')]=_0x550dca;if(_0x30e969['query']['includeAll']){_0x1a808a[_0x1cb9('0x60')]=[{'all':!![]}];}return db[_0x1cb9('0xda')][_0x1cb9('0x61')](_0x1a808a);})['then'](function(_0x46c7fe){_0x451250[_0x1cb9('0xdb')]=_0x46c7fe;return _0x451250;});}})[_0x1cb9('0x1f')](respondWithFilteredResult(_0x5ef01e,_0x1a808a))[_0x1cb9('0x29')](handleError(_0x5ef01e,null));};exports[_0x1cb9('0xdc')]=function(_0x3b8cdb,_0x60cc43,_0x3ab9a0){var _0x30e355={'raw':!![],'where':{}};var _0x2bf661={};var _0x117b81={'count':0x0,'rows':[]};return db[_0x1cb9('0x47')][_0x1cb9('0xcc')]({'where':{'id':_0x3b8cdb[_0x1cb9('0x68')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x60cc43,null))['then'](function(_0x399138){if(_0x399138){_0x2bf661['model']=_['keys'](db[_0x1cb9('0xdd')][_0x1cb9('0x48')]);_0x2bf661[_0x1cb9('0x4e')]=_[_0x1cb9('0x4d')](_0x3b8cdb[_0x1cb9('0x4e')]);_0x2bf661[_0x1cb9('0x58')]=_[_0x1cb9('0x51')](_0x2bf661['model'],_0x2bf661['query']);_0x30e355['attributes']=_[_0x1cb9('0x51')](_0x2bf661[_0x1cb9('0x4f')],qs['fields'](_0x3b8cdb['query'][_0x1cb9('0x64')]));_0x30e355[_0x1cb9('0x50')]=_0x30e355[_0x1cb9('0x50')]['length']?_0x30e355[_0x1cb9('0x50')]:_0x2bf661[_0x1cb9('0x4f')];if(!_0x3b8cdb['query'][_0x1cb9('0x53')](_0x1cb9('0x54'))){_0x30e355[_0x1cb9('0x30')]=qs[_0x1cb9('0x30')](_0x3b8cdb[_0x1cb9('0x4e')][_0x1cb9('0x30')]);_0x30e355['offset']=qs['offset'](_0x3b8cdb['query'][_0x1cb9('0x2f')]);}_0x30e355['order']=qs['sort'](_0x3b8cdb[_0x1cb9('0x4e')]['sort']);_0x30e355[_0x1cb9('0x57')]=qs['filters'](_[_0x1cb9('0x59')](_0x3b8cdb['query'],_0x2bf661[_0x1cb9('0x58')]));_0x30e355['where'][_0x1cb9('0xde')]=_0x399138['id'];if(_0x3b8cdb[_0x1cb9('0x4e')]['filter']){_0x30e355[_0x1cb9('0x57')]=_[_0x1cb9('0x5a')](_0x30e355[_0x1cb9('0x57')],{'$or':_[_0x1cb9('0x40')](_0x30e355[_0x1cb9('0x50')],function(_0x5e7e2e){var _0x268601={};_0x268601[_0x5e7e2e]={'$like':'%'+_0x3b8cdb['query'][_0x1cb9('0x3e')]+'%'};return _0x268601;})});}_0x30e355=_[_0x1cb9('0x5a')]({},_0x30e355,_0x3b8cdb[_0x1cb9('0x5f')]);return db[_0x1cb9('0xdd')][_0x1cb9('0x2e')]({'where':_0x30e355[_0x1cb9('0x57')]})[_0x1cb9('0x1f')](function(_0x46b009){_0x117b81['count']=_0x46b009;if(_0x3b8cdb['query']['includeAll']){_0x30e355[_0x1cb9('0x60')]=[{'all':!![]}];}return db[_0x1cb9('0xdd')][_0x1cb9('0x61')](_0x30e355);})[_0x1cb9('0x1f')](function(_0xbbc101){_0x117b81[_0x1cb9('0xdb')]=_0xbbc101;return _0x117b81;});}})[_0x1cb9('0x1f')](respondWithFilteredResult(_0x60cc43,_0x30e355))[_0x1cb9('0x29')](handleError(_0x60cc43,null));};exports[_0x1cb9('0xdf')]=function(_0x49bd15,_0x4997ad,_0x318a4c){var _0x35d396={};var _0x2c68b9={};var _0x44fbbc;var _0x3eb851;return db[_0x1cb9('0x47')][_0x1cb9('0xcc')]({'where':{'id':_0x49bd15[_0x1cb9('0x68')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x4997ad,null))[_0x1cb9('0x1f')](function(_0x4c6764){if(_0x4c6764){_0x44fbbc=_0x4c6764;_0x2c68b9[_0x1cb9('0x4f')]=_[_0x1cb9('0x4d')](db[_0x1cb9('0xe0')][_0x1cb9('0x48')]);_0x2c68b9['query']=_[_0x1cb9('0x4d')](_0x49bd15[_0x1cb9('0x4e')]);_0x2c68b9[_0x1cb9('0x58')]=_[_0x1cb9('0x51')](_0x2c68b9['model'],_0x2c68b9[_0x1cb9('0x4e')]);_0x35d396[_0x1cb9('0x50')]=_[_0x1cb9('0x51')](_0x2c68b9[_0x1cb9('0x4f')],qs[_0x1cb9('0x64')](_0x49bd15[_0x1cb9('0x4e')][_0x1cb9('0x64')]));_0x35d396[_0x1cb9('0x50')]=_0x35d396['attributes']['length']?_0x35d396['attributes']:_0x2c68b9[_0x1cb9('0x4f')];_0x35d396['order']=qs['sort'](_0x49bd15[_0x1cb9('0x4e')][_0x1cb9('0x56')]);_0x35d396['where']=qs[_0x1cb9('0x58')](_[_0x1cb9('0x59')](_0x49bd15['query'],_0x2c68b9[_0x1cb9('0x58')]));if(_0x49bd15[_0x1cb9('0x4e')]['filter']){_0x35d396[_0x1cb9('0x57')]=_[_0x1cb9('0x5a')](_0x35d396[_0x1cb9('0x57')],{'$or':_[_0x1cb9('0x40')](_0x35d396[_0x1cb9('0x50')],function(_0x3a5195){var _0x4bc4b9={};_0x4bc4b9[_0x3a5195]={'$like':'%'+_0x49bd15['query'][_0x1cb9('0x3e')]+'%'};return _0x4bc4b9;})});}_0x35d396=_[_0x1cb9('0x5a')]({},_0x35d396,_0x49bd15['options']);return _0x44fbbc[_0x1cb9('0xdf')](_0x35d396);}})[_0x1cb9('0x1f')](function(_0x2d6c56){if(_0x2d6c56){_0x3eb851=_0x2d6c56['length'];if(!_0x49bd15['query'][_0x1cb9('0x53')](_0x1cb9('0x54'))){_0x35d396['limit']=qs[_0x1cb9('0x30')](_0x49bd15[_0x1cb9('0x4e')][_0x1cb9('0x30')]);_0x35d396['offset']=qs['offset'](_0x49bd15[_0x1cb9('0x4e')][_0x1cb9('0x2f')]);}return _0x44fbbc[_0x1cb9('0xdf')](_0x35d396);}})[_0x1cb9('0x1f')](function(_0x511c7b){if(_0x511c7b){return _0x511c7b?{'count':_0x3eb851,'rows':_0x511c7b}:null;}})[_0x1cb9('0x1f')](respondWithResult(_0x4997ad,null))[_0x1cb9('0x29')](handleError(_0x4997ad,null));};exports[_0x1cb9('0xe1')]=function(_0x22b6f9,_0x199eb7,_0x5320e3){var _0x5ec994={};var _0x1d2143={};var _0x358a0b;var _0x1f8e9d;return db[_0x1cb9('0x47')][_0x1cb9('0xcc')]({'where':{'id':_0x22b6f9[_0x1cb9('0x68')]['id']}})['then'](handleEntityNotFound(_0x199eb7,null))[_0x1cb9('0x1f')](function(_0x48ee69){if(_0x48ee69){_0x358a0b=_0x48ee69;_0x1d2143[_0x1cb9('0x4f')]=_[_0x1cb9('0x4d')](db['OpenchannelInteraction']['rawAttributes']);_0x1d2143[_0x1cb9('0x4e')]=_[_0x1cb9('0x4d')](_0x22b6f9['query']);_0x1d2143[_0x1cb9('0x58')]=_[_0x1cb9('0x51')](_0x1d2143[_0x1cb9('0x4f')],_0x1d2143[_0x1cb9('0x4e')]);_0x5ec994[_0x1cb9('0x50')]=_[_0x1cb9('0x51')](_0x1d2143[_0x1cb9('0x4f')],qs[_0x1cb9('0x64')](_0x22b6f9[_0x1cb9('0x4e')][_0x1cb9('0x64')]));_0x5ec994[_0x1cb9('0x50')]=_0x5ec994[_0x1cb9('0x50')][_0x1cb9('0x52')]?_0x5ec994['attributes']:_0x1d2143[_0x1cb9('0x4f')];_0x5ec994[_0x1cb9('0x55')]=qs[_0x1cb9('0x56')](_0x22b6f9[_0x1cb9('0x4e')][_0x1cb9('0x56')]);_0x5ec994[_0x1cb9('0x57')]=qs['filters'](_[_0x1cb9('0x59')](_0x22b6f9[_0x1cb9('0x4e')],_0x1d2143['filters']));if(_0x22b6f9[_0x1cb9('0x4e')][_0x1cb9('0x3e')]){_0x5ec994['where']=_[_0x1cb9('0x5a')](_0x5ec994[_0x1cb9('0x57')],{'$or':_[_0x1cb9('0x40')](_0x5ec994[_0x1cb9('0x50')],function(_0x2a799f){var _0xddc143={};_0xddc143[_0x2a799f]={'$like':'%'+_0x22b6f9['query'][_0x1cb9('0x3e')]+'%'};return _0xddc143;})});}_0x5ec994=_[_0x1cb9('0x5a')]({},_0x5ec994,_0x22b6f9[_0x1cb9('0x5f')]);return _0x358a0b['getOpenchannelInteractions'](_0x5ec994);}})[_0x1cb9('0x1f')](function(_0x4af331){if(_0x4af331){_0x1f8e9d=_0x4af331['length'];if(!_0x22b6f9[_0x1cb9('0x4e')][_0x1cb9('0x53')](_0x1cb9('0x54'))){_0x5ec994[_0x1cb9('0x30')]=qs['limit'](_0x22b6f9[_0x1cb9('0x4e')][_0x1cb9('0x30')]);_0x5ec994[_0x1cb9('0x2f')]=qs[_0x1cb9('0x2f')](_0x22b6f9[_0x1cb9('0x4e')][_0x1cb9('0x2f')]);}return _0x358a0b[_0x1cb9('0xe1')](_0x5ec994);}})['then'](function(_0x14978e){if(_0x14978e){return _0x14978e?{'count':_0x1f8e9d,'rows':_0x14978e}:null;}})[_0x1cb9('0x1f')](respondWithResult(_0x199eb7,null))[_0x1cb9('0x29')](handleError(_0x199eb7,null));};exports['getMailInteractions']=function(_0x20db03,_0x572ef7,_0x396540){var _0x4561cc={'raw':!![],'where':{}};var _0x2733af={};var _0x1e3826={'count':0x0,'rows':[]};return db[_0x1cb9('0x47')]['findOne']({'where':{'id':_0x20db03['params']['id']}})['then'](handleEntityNotFound(_0x572ef7,null))['then'](function(_0x1b685d){if(_0x1b685d){_0x2733af['model']=_[_0x1cb9('0x4d')](db['MailInteraction'][_0x1cb9('0x48')]);_0x2733af[_0x1cb9('0x4e')]=_[_0x1cb9('0x4d')](_0x20db03[_0x1cb9('0x4e')]);_0x2733af[_0x1cb9('0x58')]=_[_0x1cb9('0x51')](_0x2733af[_0x1cb9('0x4f')],_0x2733af[_0x1cb9('0x4e')]);_0x4561cc['attributes']=_[_0x1cb9('0x51')](_0x2733af[_0x1cb9('0x4f')],qs[_0x1cb9('0x64')](_0x20db03[_0x1cb9('0x4e')][_0x1cb9('0x64')]));_0x4561cc['attributes']=_0x4561cc['attributes'][_0x1cb9('0x52')]?_0x4561cc['attributes']:_0x2733af['model'];if(!_0x20db03['query'][_0x1cb9('0x53')](_0x1cb9('0x54'))){_0x4561cc[_0x1cb9('0x30')]=qs[_0x1cb9('0x30')](_0x20db03[_0x1cb9('0x4e')]['limit']);_0x4561cc[_0x1cb9('0x2f')]=qs[_0x1cb9('0x2f')](_0x20db03['query'][_0x1cb9('0x2f')]);}_0x4561cc[_0x1cb9('0x55')]=qs[_0x1cb9('0x56')](_0x20db03[_0x1cb9('0x4e')][_0x1cb9('0x56')]);_0x4561cc[_0x1cb9('0x57')]=qs[_0x1cb9('0x58')](_['pick'](_0x20db03[_0x1cb9('0x4e')],_0x2733af['filters']));_0x4561cc['where'][_0x1cb9('0xde')]=_0x1b685d['id'];if(_0x20db03['query'][_0x1cb9('0x3e')]){_0x4561cc[_0x1cb9('0x57')]=_[_0x1cb9('0x5a')](_0x4561cc['where'],{'$or':_[_0x1cb9('0x40')](_0x4561cc[_0x1cb9('0x50')],function(_0x72f476){var _0x2e6004={};_0x2e6004[_0x72f476]={'$like':'%'+_0x20db03[_0x1cb9('0x4e')][_0x1cb9('0x3e')]+'%'};return _0x2e6004;})});}_0x4561cc=_['merge']({},_0x4561cc,_0x20db03[_0x1cb9('0x5f')]);return db[_0x1cb9('0xe2')]['count']({'where':_0x4561cc['where']})[_0x1cb9('0x1f')](function(_0xa36e89){_0x1e3826[_0x1cb9('0x2e')]=_0xa36e89;if(_0x20db03[_0x1cb9('0x4e')][_0x1cb9('0x65')]){_0x4561cc['include']=[{'all':!![]}];}return db[_0x1cb9('0xe2')]['findAll'](_0x4561cc);})[_0x1cb9('0x1f')](function(_0x46bb8e){_0x1e3826[_0x1cb9('0xdb')]=_0x46bb8e;return _0x1e3826;});}})[_0x1cb9('0x1f')](respondWithFilteredResult(_0x572ef7,_0x4561cc))[_0x1cb9('0x29')](handleError(_0x572ef7,null));};exports['getSmsInteractions']=function(_0x3a151b,_0x53095b,_0x1444db){var _0x5aef8a={};var _0x2d699d={};var _0x37a414;var _0x56042a;return db[_0x1cb9('0x47')]['findOne']({'where':{'id':_0x3a151b[_0x1cb9('0x68')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x53095b,null))['then'](function(_0xd7e084){if(_0xd7e084){_0x37a414=_0xd7e084;_0x2d699d[_0x1cb9('0x4f')]=_[_0x1cb9('0x4d')](db[_0x1cb9('0xe3')]['rawAttributes']);_0x2d699d['query']=_[_0x1cb9('0x4d')](_0x3a151b[_0x1cb9('0x4e')]);_0x2d699d[_0x1cb9('0x58')]=_[_0x1cb9('0x51')](_0x2d699d['model'],_0x2d699d[_0x1cb9('0x4e')]);_0x5aef8a[_0x1cb9('0x50')]=_['intersection'](_0x2d699d[_0x1cb9('0x4f')],qs[_0x1cb9('0x64')](_0x3a151b[_0x1cb9('0x4e')]['fields']));_0x5aef8a[_0x1cb9('0x50')]=_0x5aef8a['attributes'][_0x1cb9('0x52')]?_0x5aef8a[_0x1cb9('0x50')]:_0x2d699d['model'];_0x5aef8a[_0x1cb9('0x55')]=qs[_0x1cb9('0x56')](_0x3a151b[_0x1cb9('0x4e')]['sort']);_0x5aef8a[_0x1cb9('0x57')]=qs[_0x1cb9('0x58')](_['pick'](_0x3a151b[_0x1cb9('0x4e')],_0x2d699d[_0x1cb9('0x58')]));if(_0x3a151b[_0x1cb9('0x4e')][_0x1cb9('0x3e')]){_0x5aef8a['where']=_[_0x1cb9('0x5a')](_0x5aef8a['where'],{'$or':_['map'](_0x5aef8a[_0x1cb9('0x50')],function(_0x4c40da){var _0x194eea={};_0x194eea[_0x4c40da]={'$like':'%'+_0x3a151b[_0x1cb9('0x4e')][_0x1cb9('0x3e')]+'%'};return _0x194eea;})});}_0x5aef8a=_['merge']({},_0x5aef8a,_0x3a151b[_0x1cb9('0x5f')]);return _0x37a414[_0x1cb9('0xe4')](_0x5aef8a);}})[_0x1cb9('0x1f')](function(_0x40f094){if(_0x40f094){_0x56042a=_0x40f094[_0x1cb9('0x52')];if(!_0x3a151b[_0x1cb9('0x4e')][_0x1cb9('0x53')](_0x1cb9('0x54'))){_0x5aef8a[_0x1cb9('0x30')]=qs[_0x1cb9('0x30')](_0x3a151b[_0x1cb9('0x4e')][_0x1cb9('0x30')]);_0x5aef8a['offset']=qs[_0x1cb9('0x2f')](_0x3a151b[_0x1cb9('0x4e')][_0x1cb9('0x2f')]);}return _0x37a414[_0x1cb9('0xe4')](_0x5aef8a);}})[_0x1cb9('0x1f')](function(_0x1e36b8){if(_0x1e36b8){return _0x1e36b8?{'count':_0x56042a,'rows':_0x1e36b8}:null;}})['then'](respondWithResult(_0x53095b,null))[_0x1cb9('0x29')](handleError(_0x53095b,null));};exports[_0x1cb9('0xe5')]=function(_0x12a2c0,_0x43f3af,_0x44ad12){var _0x4801d7={};var _0x189f7b={};var _0x595905;var _0x18186b;return db[_0x1cb9('0x47')][_0x1cb9('0xcc')]({'where':{'id':_0x12a2c0[_0x1cb9('0x68')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x43f3af,null))[_0x1cb9('0x1f')](function(_0x237135){if(_0x237135){_0x595905=_0x237135;_0x189f7b[_0x1cb9('0x4f')]=_[_0x1cb9('0x4d')](db['FaxInteraction']['rawAttributes']);_0x189f7b[_0x1cb9('0x4e')]=_[_0x1cb9('0x4d')](_0x12a2c0[_0x1cb9('0x4e')]);_0x189f7b[_0x1cb9('0x58')]=_[_0x1cb9('0x51')](_0x189f7b[_0x1cb9('0x4f')],_0x189f7b[_0x1cb9('0x4e')]);_0x4801d7['attributes']=_[_0x1cb9('0x51')](_0x189f7b['model'],qs[_0x1cb9('0x64')](_0x12a2c0['query'][_0x1cb9('0x64')]));_0x4801d7[_0x1cb9('0x50')]=_0x4801d7[_0x1cb9('0x50')]['length']?_0x4801d7['attributes']:_0x189f7b[_0x1cb9('0x4f')];_0x4801d7['order']=qs[_0x1cb9('0x56')](_0x12a2c0[_0x1cb9('0x4e')][_0x1cb9('0x56')]);_0x4801d7[_0x1cb9('0x57')]=qs[_0x1cb9('0x58')](_['pick'](_0x12a2c0[_0x1cb9('0x4e')],_0x189f7b[_0x1cb9('0x58')]));if(_0x12a2c0[_0x1cb9('0x4e')][_0x1cb9('0x3e')]){_0x4801d7[_0x1cb9('0x57')]=_[_0x1cb9('0x5a')](_0x4801d7[_0x1cb9('0x57')],{'$or':_['map'](_0x4801d7[_0x1cb9('0x50')],function(_0x48f353){var _0x501ea0={};_0x501ea0[_0x48f353]={'$like':'%'+_0x12a2c0[_0x1cb9('0x4e')][_0x1cb9('0x3e')]+'%'};return _0x501ea0;})});}_0x4801d7=_['merge']({},_0x4801d7,_0x12a2c0[_0x1cb9('0x5f')]);return _0x595905[_0x1cb9('0xe5')](_0x4801d7);}})[_0x1cb9('0x1f')](function(_0x1d032b){if(_0x1d032b){_0x18186b=_0x1d032b[_0x1cb9('0x52')];if(!_0x12a2c0[_0x1cb9('0x4e')]['hasOwnProperty'](_0x1cb9('0x54'))){_0x4801d7['limit']=qs[_0x1cb9('0x30')](_0x12a2c0[_0x1cb9('0x4e')][_0x1cb9('0x30')]);_0x4801d7['offset']=qs['offset'](_0x12a2c0[_0x1cb9('0x4e')]['offset']);}return _0x595905['getFaxInteractions'](_0x4801d7);}})[_0x1cb9('0x1f')](function(_0x2a4bca){if(_0x2a4bca){return _0x2a4bca?{'count':_0x18186b,'rows':_0x2a4bca}:null;}})['then'](respondWithResult(_0x43f3af,null))[_0x1cb9('0x29')](handleError(_0x43f3af,null));};exports[_0x1cb9('0xe6')]=function(_0x1e676d,_0x6dfbd0,_0x34a654){var _0x5756c8={};var _0xc369a={};var _0x45865e;var _0x241e05;return db[_0x1cb9('0x47')]['findOne']({'where':{'id':_0x1e676d[_0x1cb9('0x68')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x6dfbd0,null))['then'](function(_0x230de0){if(_0x230de0){_0x45865e=_0x230de0;_0xc369a['model']=_[_0x1cb9('0x4d')](db[_0x1cb9('0xe7')][_0x1cb9('0x48')]);_0xc369a[_0x1cb9('0x4e')]=_['keys'](_0x1e676d[_0x1cb9('0x4e')]);_0xc369a['filters']=_[_0x1cb9('0x51')](_0xc369a[_0x1cb9('0x4f')],_0xc369a[_0x1cb9('0x4e')]);_0x5756c8[_0x1cb9('0x50')]=_[_0x1cb9('0x51')](_0xc369a[_0x1cb9('0x4f')],qs[_0x1cb9('0x64')](_0x1e676d[_0x1cb9('0x4e')][_0x1cb9('0x64')]));_0x5756c8[_0x1cb9('0x50')]=_0x5756c8[_0x1cb9('0x50')][_0x1cb9('0x52')]?_0x5756c8['attributes']:_0xc369a[_0x1cb9('0x4f')];_0x5756c8[_0x1cb9('0x55')]=qs[_0x1cb9('0x56')](_0x1e676d[_0x1cb9('0x4e')][_0x1cb9('0x56')]);_0x5756c8[_0x1cb9('0x57')]=qs[_0x1cb9('0x58')](_[_0x1cb9('0x59')](_0x1e676d['query'],_0xc369a[_0x1cb9('0x58')]));if(_0x1e676d[_0x1cb9('0x4e')][_0x1cb9('0x3e')]){_0x5756c8['where']=_[_0x1cb9('0x5a')](_0x5756c8['where'],{'$or':_[_0x1cb9('0x40')](_0x5756c8[_0x1cb9('0x50')],function(_0x575392){var _0x4e0ed8={};_0x4e0ed8[_0x575392]={'$like':'%'+_0x1e676d[_0x1cb9('0x4e')][_0x1cb9('0x3e')]+'%'};return _0x4e0ed8;})});}_0x5756c8=_[_0x1cb9('0x5a')]({},_0x5756c8,_0x1e676d[_0x1cb9('0x5f')]);return _0x45865e[_0x1cb9('0xe6')](_0x5756c8);}})['then'](function(_0x54f8e6){if(_0x54f8e6){_0x241e05=_0x54f8e6['length'];if(!_0x1e676d[_0x1cb9('0x4e')][_0x1cb9('0x53')](_0x1cb9('0x54'))){_0x5756c8[_0x1cb9('0x30')]=qs[_0x1cb9('0x30')](_0x1e676d[_0x1cb9('0x4e')]['limit']);_0x5756c8['offset']=qs[_0x1cb9('0x2f')](_0x1e676d[_0x1cb9('0x4e')][_0x1cb9('0x2f')]);}return _0x45865e[_0x1cb9('0xe6')](_0x5756c8);}})['then'](function(_0x31fefb){if(_0x31fefb){return _0x31fefb?{'count':_0x241e05,'rows':_0x31fefb}:null;}})[_0x1cb9('0x1f')](respondWithResult(_0x6dfbd0,null))[_0x1cb9('0x29')](handleError(_0x6dfbd0,null));};exports[_0x1cb9('0xe8')]=function(_0x18ca2d,_0x2ac02b,_0x53a57e){var _0x50b0f6;var _0x499e3c;var _0x39627c;var _0x3bf219=!_['isNil'](_0x18ca2d[_0x1cb9('0x68')]['id'])?_0x18ca2d['params']['id']:!_[_0x1cb9('0x72')](_0x18ca2d[_0x1cb9('0x3a')]['id'])?_0x18ca2d[_0x1cb9('0x3a')]['id']:null;return db[_0x1cb9('0x47')][_0x1cb9('0x67')]({'where':{'id':_0x3bf219,'role':{'$or':[_0x1cb9('0x38'),_0x1cb9('0x3a'),_0x1cb9('0x3c')]}},'attributes':['id',_0x1cb9('0x43'),_0x1cb9('0xe9'),_0x1cb9('0xea'),_0x1cb9('0x37'),_0x1cb9('0x70'),_0x1cb9('0xae')]})['then'](function(_0x23eef2){if(_0x23eef2){if(_0x23eef2[_0x1cb9('0x37')]===_0x1cb9('0x3c')){_0x50b0f6=_0x23eef2;if(_0x18ca2d[_0x1cb9('0x66')]['interface']){_0x39627c=util[_0x1cb9('0xba')](_0x1cb9('0xeb'),_0x50b0f6[_0x18ca2d[_0x1cb9('0x66')][_0x1cb9('0xb9')]]);}else if(_0x18ca2d[_0x1cb9('0x66')]['intrf']){_0x39627c=util[_0x1cb9('0xba')](_0x1cb9('0xbb'),_0x18ca2d[_0x1cb9('0x66')][_0x1cb9('0xec')]);}else{_0x39627c=util[_0x1cb9('0xba')](_0x1cb9('0xbb'),_0x50b0f6[_0x1cb9('0x43')]);}socket['to'](util['format'](_0x1cb9('0xed'),_0x50b0f6[_0x1cb9('0x43')]))[_0x1cb9('0xb6')](_0x1cb9('0xee'),{'user':{'id':_0x50b0f6['id'],'name':_0x50b0f6[_0x1cb9('0x43')]},'ip':_0x18ca2d['headers'][_0x1cb9('0xef')]||_0x18ca2d[_0x1cb9('0xf0')][_0x1cb9('0xf1')]||_0x18ca2d[_0x1cb9('0xf2')][_0x1cb9('0xf1')]||_0x18ca2d[_0x1cb9('0xf0')]['socket'][_0x1cb9('0xf1')]});return db[_0x1cb9('0xbd')]['destroy']({'where':{'membername':_0x50b0f6[_0x1cb9('0x43')]},'individualHooks':!![]});}}else{throw new db[(_0x1cb9('0xa0'))][(_0x1cb9('0x9d'))](_0x1cb9('0xf3'));}})[_0x1cb9('0x1f')](function(){if(_0x50b0f6){return _0x50b0f6[_0x1cb9('0xf4')]({'raw':!![]});}})[_0x1cb9('0x1f')](function(_0x2d6701){if(_0x50b0f6){var _0x3b697f=[];if(_0x2d6701){_0x499e3c=_0x2d6701;if(_0x499e3c[_0x1cb9('0x52')]){for(var _0x5494e4=0x0;_0x5494e4<_0x499e3c[_0x1cb9('0x52')];_0x5494e4++){_0x3b697f['push']({'membername':_0x50b0f6[_0x1cb9('0x43')],'UserId':_0x50b0f6['id'],'queue_name':_0x499e3c[_0x5494e4][_0x1cb9('0x43')],'VoiceQueueId':_0x499e3c[_0x5494e4]['id'],'interface':_0x39627c,'paused':_0x50b0f6['loginInPause']||![],'penalty':_0x499e3c[_0x5494e4][_0x1cb9('0xf5')]||0x0});}return BPromise['each'](_0x3b697f,function(_0x25b3f0){return db[_0x1cb9('0xbd')]['upsert'](_0x25b3f0);});}}}})['then'](function(){if(_0x50b0f6){return db[_0x1cb9('0xf6')]['findAll']({'where':{'membername':_0x50b0f6[_0x1cb9('0x43')],'exitAt':null}});}})[_0x1cb9('0x1f')](function(_0x258670){if(_0x50b0f6){var _0x375a3e=[];_0x258670[_0x1cb9('0xf7')](function(_0x55f632){_0x375a3e[_0x1cb9('0x95')](_0x55f632[_0x1cb9('0x34')]({'exitAt':moment()[_0x1cb9('0xba')](_0x1cb9('0xf8'))}));});return BPromise[_0x1cb9('0x96')](_0x375a3e);}})[_0x1cb9('0x1f')](function(){if(_0x50b0f6){var _0x4f383c=[];var _0x426757=[];var _0x4a3947=utils[_0x1cb9('0xf9')]();var _0x55eaf9={'membername':_0x50b0f6['name'],'interface':_0x39627c,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x50b0f6[_0x1cb9('0x37')],'internal':_0x50b0f6[_0x1cb9('0x70')]};_0x4a3947[_0x1cb9('0xf7')](function(_0x16b437){_0x4f383c[_0x1cb9('0x95')](_[_0x1cb9('0x5a')]({'channel':_0x16b437,'type':_0x1cb9('0xfa'),'data1':_0x18ca2d[_0x1cb9('0x66')][_0x1cb9('0xfb')],'data2':_0x39627c},_0x55eaf9));if(_0x50b0f6['loginInPause']){_0x426757[_0x1cb9('0x95')](_[_0x1cb9('0x5a')]({'channel':_0x16b437,'type':_0x1cb9('0xfc'),'data1':_0x1cb9('0xfd')},_0x55eaf9));}});return db[_0x1cb9('0xf6')][_0x1cb9('0x93')](_0x4f383c[_0x1cb9('0xfe')](_0x426757),{'individualHooks':!![]});}})[_0x1cb9('0x1f')](function(){if(_0x50b0f6){return _0x50b0f6['update']({'online':!![],'lastLoginAt':moment()[_0x1cb9('0xba')](_0x1cb9('0xf8')),'voicePause':_0x50b0f6['loginInPause']||![],'mailPause':_0x50b0f6[_0x1cb9('0xae')]||![],'chatPause':_0x50b0f6[_0x1cb9('0xae')]||![],'faxPause':_0x50b0f6[_0x1cb9('0xae')]||![],'smsPause':_0x50b0f6[_0x1cb9('0xae')]||![],'openchannelPause':_0x50b0f6['loginInPause']||![],'whatsappPause':_0x50b0f6[_0x1cb9('0xae')]||![],'pauseType':_0x50b0f6[_0x1cb9('0xae')]?_0x1cb9('0xfd'):null,'interface':_0x39627c,'lastPauseAt':moment()[_0x1cb9('0xba')](_0x1cb9('0xf8'))});}})[_0x1cb9('0x1f')](function(_0x36c51b){if(_0x18ca2d[_0x1cb9('0xff')]){return _0x53a57e();}else{return BPromise[_0x1cb9('0x100')](_0x36c51b)[_0x1cb9('0x1f')](respondWithResult(_0x2ac02b,null));}})[_0x1cb9('0x29')](handleError(_0x2ac02b,null));};exports[_0x1cb9('0x101')]=function(_0x3f9b5d,_0x170b32,_0x5c0b29){var _0xad25cc;return db[_0x1cb9('0x47')][_0x1cb9('0x67')]({'where':{'id':_0x3f9b5d[_0x1cb9('0x68')]['id'],'role':_0x1cb9('0x3c')},'attributes':['id','name',_0x1cb9('0x37')]})[_0x1cb9('0x1f')](handleEntityNotFound(_0x170b32,null))['then'](function(_0x4ec491){if(_0x4ec491){_0xad25cc=_0x4ec491;return db['UserVoiceQueueRt'][_0x1cb9('0x35')]({'where':{'membername':_0xad25cc['name']},'individualHooks':!![]});}})[_0x1cb9('0x1f')](function(){return db['MemberReport'][_0x1cb9('0x61')]({'where':{'membername':_0xad25cc['name'],'exitAt':null}});})[_0x1cb9('0x1f')](function(_0x3f2e56){var _0x5cfb57=[];_0x3f2e56[_0x1cb9('0xf7')](function(_0x4e9b4e){_0x5cfb57[_0x1cb9('0x95')](_0x4e9b4e[_0x1cb9('0x34')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x1cb9('0x96')](_0x5cfb57);})[_0x1cb9('0x1f')](function(){return _0xad25cc['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x1cb9('0x1f')](respondWithResult(_0x170b32,null))[_0x1cb9('0x29')](handleError(_0x170b32,null));};exports['pause']=function(_0x59436f,_0x1316fc,_0x4ed004){var _0x63dc58;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x59436f[_0x1cb9('0x68')]['id']},'individualHooks':!![]})[_0x1cb9('0x1f')](function(){return db[_0x1cb9('0x47')][_0x1cb9('0x67')]({'where':{'id':_0x59436f['params']['id'],'role':'agent'},'attributes':['id',_0x1cb9('0x43'),'role',_0x1cb9('0x70'),'interface']});})['then'](handleEntityNotFound(_0x1316fc,null))['then'](function(_0x185219){if(_0x185219){_0x63dc58=_0x185219;return respondWithRpcPromise(_0x1cb9('0x102'),_0x1cb9('0x103'),{'id':_0x63dc58['id'],'name':_0x63dc58['name'],'pause':!![]});}})[_0x1cb9('0x1f')](function(){if(_0x63dc58){return db['MemberReport'][_0x1cb9('0x61')]({'where':{'membername':_0x63dc58[_0x1cb9('0x43')],'type':'PAUSE','exitAt':null}});}})[_0x1cb9('0x1f')](function(_0x545f41){if(_0x545f41[_0x1cb9('0x52')]){var _0x284e25=moment()[_0x1cb9('0xba')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x18b543=0x0,_0x1b61be=_0x545f41[_0x1cb9('0x52')];_0x18b543<_0x1b61be;_0x18b543++){_0x545f41[_0x18b543][_0x1cb9('0x104')]({'exitAt':_0x284e25});}}})[_0x1cb9('0x1f')](function(){var _0xf98b70=[];var _0x1151a6=utils[_0x1cb9('0xf9')]();_0x1151a6['forEach'](function(_0x5857c1){_0xf98b70[_0x1cb9('0x95')]({'channel':_0x5857c1,'membername':_0x63dc58[_0x1cb9('0x43')],'interface':_[_0x1cb9('0x72')](_0x63dc58[_0x1cb9('0xb9')])?util[_0x1cb9('0xba')]('SIP/%s',_0x63dc58[_0x1cb9('0x43')]):_0x63dc58[_0x1cb9('0xb9')],'type':'PAUSE','enterAt':moment()[_0x1cb9('0xba')](_0x1cb9('0xf8')),'data1':_0x59436f['body']['type']||_0x1cb9('0x105'),'role':_0x63dc58[_0x1cb9('0x37')],'internal':_0x63dc58[_0x1cb9('0x70')]});});return db[_0x1cb9('0xf6')][_0x1cb9('0x93')](_0xf98b70,{'individualHooks':!![]});})[_0x1cb9('0x1f')](function(){return _0x63dc58['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x59436f[_0x1cb9('0x66')][_0x1cb9('0x106')]||_0x1cb9('0x105'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x1cb9('0x1f')](respondWithResult(_0x1316fc,null))['catch'](handleError(_0x1316fc,null));};exports['unpause']=function(_0x2fa0fe,_0x1e3938,_0x30364b){var _0x1d357a;return db[_0x1cb9('0x47')][_0x1cb9('0x67')]({'where':{'id':_0x2fa0fe[_0x1cb9('0x68')]['id']},'attributes':['id',_0x1cb9('0x43'),_0x1cb9('0x37'),'voicePause','mailPause',_0x1cb9('0x107'),_0x1cb9('0x108'),_0x1cb9('0x109'),'smsPause',_0x1cb9('0x10a'),_0x1cb9('0x10b'),'lastPauseAt']})[_0x1cb9('0x1f')](handleEntityNotFound(_0x1e3938,null))['then'](function(_0x440755){if(_0x440755){_0x1d357a=_0x440755;if(_0x2fa0fe['body'][_0x1cb9('0xac')]&&!utils[_0x1cb9('0xb0')](_0x2fa0fe[_0x1cb9('0x66')]['channel'])){throw new db[(_0x1cb9('0xa0'))][(_0x1cb9('0x9d'))]('Unknown\x20channel');}switch(_0x2fa0fe[_0x1cb9('0x66')][_0x1cb9('0xac')]){case _0x1cb9('0xb7'):return respondWithRpcPromise(_0x1cb9('0x102'),'unpause',{'id':_0x1d357a['id'],'name':_0x1d357a[_0x1cb9('0x43')],'pause':![]})['then'](function(){return db[_0x1cb9('0xbd')][_0x1cb9('0x34')]({'paused':0x0},{'where':{'UserId':_0x1d357a['id']},'individualHooks':!![]});})[_0x1cb9('0x1f')](function(){return db[_0x1cb9('0xf6')]['find']({'where':{'channel':_0x2fa0fe[_0x1cb9('0x66')]['channel'],'membername':_0x1d357a[_0x1cb9('0x43')],'type':_0x1cb9('0xfc'),'exitAt':null}});})[_0x1cb9('0x1f')](function(_0x3b60be){if(_0x3b60be){return _0x3b60be[_0x1cb9('0x34')]({'exitAt':moment()[_0x1cb9('0xba')](_0x1cb9('0xf8')),'data2':_0x1cb9('0x10c')},{'individualHooks':!![]});}return null;})[_0x1cb9('0x1f')](function(){return _0x1d357a[_0x1cb9('0x34')]({'voicePause':![]});});case'mail':case _0x1cb9('0x10d'):case _0x1cb9('0x10e'):case _0x1cb9('0x10f'):case'whatsapp':case _0x1cb9('0x110'):return db[_0x1cb9('0xf6')][_0x1cb9('0x67')]({'where':{'channel':_0x2fa0fe['body'][_0x1cb9('0xac')],'membername':_0x1d357a[_0x1cb9('0x43')],'type':_0x1cb9('0xfc'),'exitAt':null}})[_0x1cb9('0x1f')](function(_0x36929e){if(_0x36929e){return _0x36929e[_0x1cb9('0x34')]({'exitAt':moment()['format'](_0x1cb9('0xf8')),'data2':_0x1cb9('0x10c')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x146062={};_[_0x1cb9('0x31')](_0x146062,util['format'](_0x1cb9('0x111'),_0x2fa0fe[_0x1cb9('0x66')]['channel'],_0x1cb9('0x112')),![]);return _0x1d357a[_0x1cb9('0x34')](_0x146062);});default:return respondWithRpcPromise(_0x1cb9('0x102'),_0x1cb9('0x113'),{'id':_0x1d357a['id'],'name':_0x1d357a[_0x1cb9('0x43')],'pause':![]})['then'](function(){return db['UserVoiceQueueRt'][_0x1cb9('0x34')]({'paused':0x0},{'where':{'UserId':_0x1d357a['id']}});})[_0x1cb9('0x1f')](function(){return db[_0x1cb9('0xf6')]['findAll']({'where':{'membername':_0x1d357a['name'],'type':_0x1cb9('0xfc'),'exitAt':null}});})[_0x1cb9('0x1f')](function(_0x1f7283){var _0x320daa=[];_0x1f7283['forEach'](function(_0x27ae51){_0x320daa[_0x1cb9('0x95')](_0x27ae51['update']({'exitAt':moment()[_0x1cb9('0xba')](_0x1cb9('0xf8')),'data2':'manual'}));});return BPromise[_0x1cb9('0x96')](_0x320daa);})[_0x1cb9('0x1f')](function(){return _0x1d357a[_0x1cb9('0x34')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x1cb9('0x1f')](respondWithResult(_0x1e3938,null))[_0x1cb9('0x29')](handleError(_0x1e3938,null));};exports[_0x1cb9('0x114')]=function(_0x32655b,_0x168a4b,_0xc18104){var _0x3a6f53={};var _0x1ac4bb={};var _0x4af047;var _0x2da5e5;return db['User'][_0x1cb9('0xcc')]({'where':{'id':_0x32655b[_0x1cb9('0x68')]['id']}})['then'](handleEntityNotFound(_0x168a4b,null))['then'](function(_0x2cad61){if(_0x2cad61){_0x4af047=_0x2cad61;_0x1ac4bb[_0x1cb9('0x4f')]=_[_0x1cb9('0x4d')](db[_0x1cb9('0x115')]['rawAttributes']);_0x1ac4bb['query']=_[_0x1cb9('0x4d')](_0x32655b[_0x1cb9('0x4e')]);_0x1ac4bb[_0x1cb9('0x58')]=_[_0x1cb9('0x51')](_0x1ac4bb[_0x1cb9('0x4f')],_0x1ac4bb[_0x1cb9('0x4e')]);_0x3a6f53[_0x1cb9('0x50')]=_[_0x1cb9('0x51')](_0x1ac4bb[_0x1cb9('0x4f')],qs[_0x1cb9('0x64')](_0x32655b['query'][_0x1cb9('0x64')]));_0x3a6f53[_0x1cb9('0x50')]=_0x3a6f53[_0x1cb9('0x50')][_0x1cb9('0x52')]?_0x3a6f53[_0x1cb9('0x50')]:_0x1ac4bb[_0x1cb9('0x4f')];_0x3a6f53[_0x1cb9('0x55')]=qs[_0x1cb9('0x56')](_0x32655b[_0x1cb9('0x4e')][_0x1cb9('0x56')]);_0x3a6f53[_0x1cb9('0x57')]=qs[_0x1cb9('0x58')](_[_0x1cb9('0x59')](_0x32655b[_0x1cb9('0x4e')],_0x1ac4bb[_0x1cb9('0x58')]));if(_0x32655b[_0x1cb9('0x4e')][_0x1cb9('0x3e')]){_0x3a6f53[_0x1cb9('0x57')]=_[_0x1cb9('0x5a')](_0x3a6f53[_0x1cb9('0x57')],{'$or':_['map'](_0x3a6f53[_0x1cb9('0x50')],function(_0x4aa96f){var _0x4e0f2c={};_0x4e0f2c[_0x4aa96f]={'$like':'%'+_0x32655b[_0x1cb9('0x4e')][_0x1cb9('0x3e')]+'%'};return _0x4e0f2c;})});}_0x3a6f53=_[_0x1cb9('0x5a')]({},_0x3a6f53,_0x32655b[_0x1cb9('0x5f')]);return _0x4af047[_0x1cb9('0x114')](_0x3a6f53);}})[_0x1cb9('0x1f')](function(_0x3b21f9){if(_0x3b21f9){_0x2da5e5=_0x3b21f9[_0x1cb9('0x52')];if(!_0x32655b[_0x1cb9('0x4e')]['hasOwnProperty']('nolimit')){_0x3a6f53[_0x1cb9('0x30')]=qs[_0x1cb9('0x30')](_0x32655b['query'][_0x1cb9('0x30')]);_0x3a6f53[_0x1cb9('0x2f')]=qs[_0x1cb9('0x2f')](_0x32655b[_0x1cb9('0x4e')][_0x1cb9('0x2f')]);}return _0x4af047[_0x1cb9('0x114')](_0x3a6f53);}})[_0x1cb9('0x1f')](function(_0x2faa13){if(_0x2faa13){return _0x2faa13?{'count':_0x2da5e5,'rows':_0x2faa13}:null;}})[_0x1cb9('0x1f')](respondWithResult(_0x168a4b,null))['catch'](handleError(_0x168a4b,null));};exports['addTeams']=function(_0x4e6a1a,_0x1ec2e0){return db[_0x1cb9('0x47')][_0x1cb9('0x67')]({'where':{'id':_0x4e6a1a[_0x1cb9('0x68')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x1ec2e0,null))['then'](function(_0x46f169){if(_0x46f169){var _0x2b71da=_0x46f169[_0x1cb9('0x36')]({'plain':!![]});return _0x46f169[_0x1cb9('0x116')](_0x4e6a1a[_0x1cb9('0x66')][_0x1cb9('0x6b')],_[_0x1cb9('0x117')](_0x4e6a1a[_0x1cb9('0x66')],['ids','id'])||{})[_0x1cb9('0x1f')](function(){for(var _0x268808=0x0;_0x268808<_0x4e6a1a[_0x1cb9('0x66')][_0x1cb9('0x6b')][_0x1cb9('0x52')];_0x268808++){var _0x502fd3=[];db[_0x1cb9('0x115')]['findOne']({'where':{'id':_0x4e6a1a['body'][_0x1cb9('0x6b')][_0x268808]}})[_0x1cb9('0x1f')](function(_0x12305e){_0x502fd3[_0x1cb9('0x95')](_0x12305e[_0x1cb9('0xf4')]()['then'](function(_0x1c0375){for(var _0x163b14=0x0;_0x163b14<_0x1c0375['length'];_0x163b14++){_0x1c0375[_0x163b14][_0x1cb9('0x118')]('channel',_0x1cb9('0x119'));}return _0x1c0375;}));_0x502fd3[_0x1cb9('0x95')](_0x12305e[_0x1cb9('0x11a')]()[_0x1cb9('0x1f')](function(_0x4124f9){for(var _0x10b17e=0x0;_0x10b17e<_0x4124f9[_0x1cb9('0x52')];_0x10b17e++){_0x4124f9[_0x10b17e][_0x1cb9('0x118')](_0x1cb9('0xac'),'Chat');}return _0x4124f9;}));_0x502fd3[_0x1cb9('0x95')](_0x12305e[_0x1cb9('0x11b')]()[_0x1cb9('0x1f')](function(_0x31156b){for(var _0x914f70=0x0;_0x914f70<_0x31156b[_0x1cb9('0x52')];_0x914f70++){_0x31156b[_0x914f70][_0x1cb9('0x118')](_0x1cb9('0xac'),_0x1cb9('0x11c'));}return _0x31156b;}));_0x502fd3[_0x1cb9('0x95')](_0x12305e['getSmsQueues']()[_0x1cb9('0x1f')](function(_0x50afa4){for(var _0x432f23=0x0;_0x432f23<_0x50afa4[_0x1cb9('0x52')];_0x432f23++){_0x50afa4[_0x432f23]['setDataValue'](_0x1cb9('0xac'),_0x1cb9('0x11d'));}return _0x50afa4;}));_0x502fd3['push'](_0x12305e[_0x1cb9('0x11e')]()[_0x1cb9('0x1f')](function(_0x4a434a){for(var _0x1ee6b1=0x0;_0x1ee6b1<_0x4a434a[_0x1cb9('0x52')];_0x1ee6b1++){_0x4a434a[_0x1ee6b1][_0x1cb9('0x118')](_0x1cb9('0xac'),_0x1cb9('0x11f'));}return _0x4a434a;}));_0x502fd3['push'](_0x12305e[_0x1cb9('0x120')]()['then'](function(_0x5e3302){for(var _0x1313c3=0x0;_0x1313c3<_0x5e3302[_0x1cb9('0x52')];_0x1313c3++){_0x5e3302[_0x1313c3]['setDataValue'](_0x1cb9('0xac'),_0x1cb9('0x121'));}return _0x5e3302;}));_0x502fd3[_0x1cb9('0x95')](_0x12305e[_0x1cb9('0x122')]()[_0x1cb9('0x1f')](function(_0x564266){for(var _0xb95366=0x0;_0xb95366<_0x564266['length'];_0xb95366++){_0x564266[_0xb95366][_0x1cb9('0x118')](_0x1cb9('0xac'),'Openchannel');}return _0x564266;}));return BPromise[_0x1cb9('0x96')](_0x502fd3);})[_0x1cb9('0x1f')](function(_0x383fde){var _0x18b557=_['flatten'](_0x383fde);_0x502fd3=[];return db[_0x1cb9('0x5c')][_0x1cb9('0x123')](function(_0x13e6f7){for(var _0x66355e=0x0;_0x66355e<_0x18b557[_0x1cb9('0x52')];_0x66355e++){_0x502fd3[_0x1cb9('0x95')](_0x18b557[_0x66355e][_0x1cb9('0x124')](_0x2b71da['id']),{'transaction':_0x13e6f7});}return BPromise[_0x1cb9('0x96')](_0x502fd3)[_0x1cb9('0x1f')](function(){if(_0x2b71da[_0x1cb9('0xad')]){return BPromise[_0x1cb9('0x97')](_[_0x1cb9('0x3e')](_0x18b557,function(_0x40bed6){return _0x40bed6[_0x1cb9('0x125')](_0x1cb9('0xac'))===_0x1cb9('0x119');}),function(_0x55c15f){return db['UserVoiceQueueRt'][_0x1cb9('0x126')]({'membername':_0x2b71da[_0x1cb9('0x43')],'UserId':_0x2b71da['id'],'queue_name':_0x55c15f['name'],'VoiceQueueId':_0x55c15f['id'],'interface':_[_0x1cb9('0x72')](_0x2b71da[_0x1cb9('0xb9')])?util['format']('SIP/%s',_0x2b71da[_0x1cb9('0x43')]):_0x2b71da[_0x1cb9('0xb9')],'paused':_0x2b71da[_0x1cb9('0xaf')]||![],'penalty':_0x2b71da[_0x1cb9('0xbc')]},{'transaction':_0x13e6f7});});}else{return;}})[_0x1cb9('0x1f')](function(){for(var _0x28b781=0x0;_0x28b781<_0x18b557[_0x1cb9('0x52')];_0x28b781++){var _0x11fd5d=_0x18b557[_0x28b781][_0x1cb9('0x125')](_0x1cb9('0xac'));var _0x13cb56=_0x11fd5d+_0x1cb9('0xb5');socket[_0x1cb9('0xb6')]('user'+_0x11fd5d+'Queue:save',{'UserId':_0x2b71da['id'],['queueField']:_0x18b557[_0x28b781]['id']});}});});});}});}})[_0x1cb9('0x1f')](respondWithStatusCode(_0x1ec2e0,null))['catch'](handleError(_0x1ec2e0,null));};exports[_0x1cb9('0x127')]=function(_0x207977,_0x1e601c){return db[_0x1cb9('0x47')][_0x1cb9('0xcc')]({'where':{'id':_0x207977['params']['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x1e601c,null))['then'](function(_0x3dbb5e){if(_0x3dbb5e){var _0x23205c=_0x3dbb5e[_0x1cb9('0x36')]({'plain':!![]});var _0x33dc60=_0x207977[_0x1cb9('0x4e')][_0x1cb9('0x6b')];return _0x3dbb5e[_0x1cb9('0x127')](_0x33dc60)[_0x1cb9('0x1f')](function(){for(var _0x5880d4=0x0;_0x5880d4<_0x33dc60[_0x1cb9('0x52')];_0x5880d4++){var _0x444f2e=[];db['Team']['findOne']({'where':{'id':_0x33dc60[_0x5880d4]}})[_0x1cb9('0x1f')](function(_0x1f0186){_0x444f2e[_0x1cb9('0x95')](_0x1f0186[_0x1cb9('0xf4')]()['then'](function(_0xba3d7c){for(var _0x435be0=0x0;_0x435be0<_0xba3d7c['length'];_0x435be0++){_0xba3d7c[_0x435be0][_0x1cb9('0x118')](_0x1cb9('0xac'),_0x1cb9('0x119'));}return _0xba3d7c;}));_0x444f2e[_0x1cb9('0x95')](_0x1f0186[_0x1cb9('0x11a')]()[_0x1cb9('0x1f')](function(_0x1048a4){for(var _0x961db2=0x0;_0x961db2<_0x1048a4[_0x1cb9('0x52')];_0x961db2++){_0x1048a4[_0x961db2][_0x1cb9('0x118')](_0x1cb9('0xac'),'Chat');}return _0x1048a4;}));_0x444f2e['push'](_0x1f0186[_0x1cb9('0x11b')]()[_0x1cb9('0x1f')](function(_0x21dc31){for(var _0x2469b2=0x0;_0x2469b2<_0x21dc31[_0x1cb9('0x52')];_0x2469b2++){_0x21dc31[_0x2469b2][_0x1cb9('0x118')](_0x1cb9('0xac'),_0x1cb9('0x11c'));}return _0x21dc31;}));_0x444f2e[_0x1cb9('0x95')](_0x1f0186[_0x1cb9('0x128')]()[_0x1cb9('0x1f')](function(_0x388ddd){for(var _0x384542=0x0;_0x384542<_0x388ddd['length'];_0x384542++){_0x388ddd[_0x384542]['setDataValue'](_0x1cb9('0xac'),_0x1cb9('0x11d'));}return _0x388ddd;}));_0x444f2e[_0x1cb9('0x95')](_0x1f0186['getWhatsappQueues']()[_0x1cb9('0x1f')](function(_0x5c8a6f){for(var _0x4c36f0=0x0;_0x4c36f0<_0x5c8a6f[_0x1cb9('0x52')];_0x4c36f0++){_0x5c8a6f[_0x4c36f0][_0x1cb9('0x118')]('channel',_0x1cb9('0x11f'));}return _0x5c8a6f;}));_0x444f2e[_0x1cb9('0x95')](_0x1f0186[_0x1cb9('0x120')]()[_0x1cb9('0x1f')](function(_0x184acb){for(var _0x5768bf=0x0;_0x5768bf<_0x184acb[_0x1cb9('0x52')];_0x5768bf++){_0x184acb[_0x5768bf][_0x1cb9('0x118')](_0x1cb9('0xac'),_0x1cb9('0x121'));}return _0x184acb;}));_0x444f2e[_0x1cb9('0x95')](_0x1f0186[_0x1cb9('0x122')]()[_0x1cb9('0x1f')](function(_0x37cc8e){for(var _0x297e9d=0x0;_0x297e9d<_0x37cc8e['length'];_0x297e9d++){_0x37cc8e[_0x297e9d][_0x1cb9('0x118')]('channel',_0x1cb9('0x129'));}return _0x37cc8e;}));return BPromise[_0x1cb9('0x96')](_0x444f2e);})[_0x1cb9('0x1f')](function(_0xd4b57f){var _0x38c0a0=_[_0x1cb9('0x12a')](_0xd4b57f);_0x444f2e=[];return db['sequelize'][_0x1cb9('0x123')](function(_0x249814){for(var _0x3d0200=0x0;_0x3d0200<_0x38c0a0[_0x1cb9('0x52')];_0x3d0200++){_0x444f2e['push'](_0x38c0a0[_0x3d0200][_0x1cb9('0x12b')](_0x23205c['id']),{'transaction':_0x249814});}return BPromise[_0x1cb9('0x96')](_0x444f2e)['then'](function(){if(_0x23205c['online']){return BPromise[_0x1cb9('0x97')](_[_0x1cb9('0x3e')](_0x38c0a0,function(_0x32de36){return _0x32de36[_0x1cb9('0x125')]('channel')==='Voice';}),function(_0x52b267){return db[_0x1cb9('0xbd')]['destroy']({'where':{'VoiceQueueId':_0x52b267['id'],'UserId':_0x23205c['id']},'transaction':_0x249814});});}else{return;}})[_0x1cb9('0x1f')](function(){for(var _0x1a24b0=0x0;_0x1a24b0<_0x38c0a0[_0x1cb9('0x52')];_0x1a24b0++){var _0x1d060e=_0x38c0a0[_0x1a24b0][_0x1cb9('0x125')]('channel');var _0x534b17=_0x1d060e+_0x1cb9('0xb5');socket[_0x1cb9('0xb6')](_0x1cb9('0x3a')+_0x1d060e+_0x1cb9('0xc1'),{'UserId':_0x23205c['id'],['queueField']:_0x38c0a0[_0x1a24b0]['id']});}});});});}});}})[_0x1cb9('0x1f')](respondWithStatusCode(_0x1e601c,null))['catch'](handleError(_0x1e601c,null));};exports[_0x1cb9('0x12c')]=function(_0x112dfc,_0x350878,_0x5355e9){var _0x490450={};var _0x45abcf={};var _0x52c3a4;var _0x4a46cc;return db[_0x1cb9('0x47')][_0x1cb9('0xcc')]({'where':{'id':_0x112dfc['params']['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x350878,null))['then'](function(_0x245aad){if(_0x245aad){_0x52c3a4=_0x245aad;_0x45abcf[_0x1cb9('0x4f')]=_[_0x1cb9('0x4d')](db[_0x1cb9('0x12d')][_0x1cb9('0x48')]);_0x45abcf[_0x1cb9('0x4e')]=_['keys'](_0x112dfc[_0x1cb9('0x4e')]);_0x45abcf[_0x1cb9('0x58')]=_['intersection'](_0x45abcf['model'],_0x45abcf[_0x1cb9('0x4e')]);_0x490450[_0x1cb9('0x50')]=_['intersection'](_0x45abcf['model'],qs[_0x1cb9('0x64')](_0x112dfc['query'][_0x1cb9('0x64')]));_0x490450[_0x1cb9('0x50')]=_0x490450['attributes']['length']?_0x490450[_0x1cb9('0x50')]:_0x45abcf[_0x1cb9('0x4f')];_0x490450['order']=qs['sort'](_0x112dfc[_0x1cb9('0x4e')][_0x1cb9('0x56')]);_0x490450[_0x1cb9('0x57')]=qs[_0x1cb9('0x58')](_[_0x1cb9('0x59')](_0x112dfc[_0x1cb9('0x4e')],_0x45abcf[_0x1cb9('0x58')]));if(_0x112dfc[_0x1cb9('0x4e')][_0x1cb9('0x3e')]){_0x490450['where']=_[_0x1cb9('0x5a')](_0x490450[_0x1cb9('0x57')],{'$or':_[_0x1cb9('0x40')](_0x490450[_0x1cb9('0x50')],function(_0x1a4aa0){var _0x5b15cb={};_0x5b15cb[_0x1a4aa0]={'$like':'%'+_0x112dfc['query'][_0x1cb9('0x3e')]+'%'};return _0x5b15cb;})});}_0x490450=_[_0x1cb9('0x5a')]({},_0x490450,_0x112dfc[_0x1cb9('0x5f')]);return _0x52c3a4[_0x1cb9('0x12c')](_0x490450);}})[_0x1cb9('0x1f')](function(_0x2a9bb0){if(_0x2a9bb0){_0x4a46cc=_0x2a9bb0[_0x1cb9('0x52')];if(!_0x112dfc[_0x1cb9('0x4e')][_0x1cb9('0x53')](_0x1cb9('0x54'))){_0x490450[_0x1cb9('0x30')]=qs[_0x1cb9('0x30')](_0x112dfc[_0x1cb9('0x4e')][_0x1cb9('0x30')]);_0x490450[_0x1cb9('0x2f')]=qs[_0x1cb9('0x2f')](_0x112dfc[_0x1cb9('0x4e')][_0x1cb9('0x2f')]);}return _0x52c3a4[_0x1cb9('0x12c')](_0x490450);}})[_0x1cb9('0x1f')](function(_0x21a4db){if(_0x21a4db){return _0x21a4db?{'count':_0x4a46cc,'rows':_0x21a4db}:null;}})[_0x1cb9('0x1f')](respondWithResult(_0x350878,null))['catch'](handleError(_0x350878,null));};exports[_0x1cb9('0x12e')]=function(_0x225a58,_0x405405,_0x5af533){var _0x3d6f5d={};var _0x2e1fa2={};var _0x237545;var _0x457a16;return db[_0x1cb9('0x47')][_0x1cb9('0xcc')]({'where':{'id':_0x225a58['params']['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x405405,null))[_0x1cb9('0x1f')](function(_0x4a57b3){if(_0x4a57b3){_0x237545=_0x4a57b3;_0x2e1fa2['model']=_['keys'](db[_0x1cb9('0x47')]['rawAttributes']);_0x2e1fa2[_0x1cb9('0x4e')]=_[_0x1cb9('0x4d')](_0x225a58['query']);_0x2e1fa2[_0x1cb9('0x58')]=_[_0x1cb9('0x51')](_0x2e1fa2['model'],_0x2e1fa2[_0x1cb9('0x4e')]);_0x3d6f5d[_0x1cb9('0x50')]=_['intersection'](_0x2e1fa2[_0x1cb9('0x4f')],qs[_0x1cb9('0x64')](_0x225a58['query']['fields']));_0x3d6f5d[_0x1cb9('0x50')]=_0x3d6f5d['attributes'][_0x1cb9('0x52')]?_0x3d6f5d[_0x1cb9('0x50')]:_0x2e1fa2['model'];_0x3d6f5d[_0x1cb9('0x55')]=qs[_0x1cb9('0x56')](_0x225a58['query'][_0x1cb9('0x56')]);_0x3d6f5d[_0x1cb9('0x57')]=qs['filters'](_[_0x1cb9('0x59')](_0x225a58[_0x1cb9('0x4e')],_0x2e1fa2[_0x1cb9('0x58')]));if(_0x225a58[_0x1cb9('0x4e')]['filter']){_0x3d6f5d[_0x1cb9('0x57')]=_[_0x1cb9('0x5a')](_0x3d6f5d['where'],{'$or':_[_0x1cb9('0x40')](_0x3d6f5d[_0x1cb9('0x50')],function(_0x18c2cf){var _0x146ec9={};_0x146ec9[_0x18c2cf]={'$like':'%'+_0x225a58[_0x1cb9('0x4e')][_0x1cb9('0x3e')]+'%'};return _0x146ec9;})});}_0x3d6f5d[_0x1cb9('0x4f')]=db[_0x1cb9('0x47')];_0x3d6f5d['as']=_0x1cb9('0x3b');_0x3d6f5d=_[_0x1cb9('0x5a')]({},_0x3d6f5d,_0x225a58[_0x1cb9('0x5f')]);return _0x237545[_0x1cb9('0xf4')]({'include':[_0x3d6f5d]});}})[_0x1cb9('0x1f')](function(_0x168a42){if(_0x168a42){var _0x2d0735={},_0x14fd50=[],_0x13e7ac=0x0;for(var _0x48939e=0x0;_0x48939e<_0x168a42['length'];_0x48939e+=0x1){for(var _0x335a1d=0x0,_0x5aca26;_0x335a1d<_0x168a42[_0x48939e][_0x1cb9('0x3b')][_0x1cb9('0x52')];_0x335a1d+=0x1){_0x5aca26=_0x168a42[_0x48939e]['Agents'][_0x335a1d][_0x1cb9('0x36')]({'plain':!![]});_0x2d0735[_0x5aca26['id']]=_0x5aca26;}}_0x2d0735=_[_0x1cb9('0x12f')](_0x2d0735);for(var _0x1773f0=qs[_0x1cb9('0x2f')](_0x225a58[_0x1cb9('0x4e')][_0x1cb9('0x2f')]);_0x1773f0<_0x2d0735[_0x1cb9('0x52')]&&_0x14fd50[_0x1cb9('0x52')]=_0x53b05a[_0x34ad('0x50')]){throw new Error(_0x34ad('0x51'));}})['then'](function(){if(_0x1b970e){return db[_0x34ad('0x2d')][_0x34ad('0x4c')]({'where':{'membername':_0x1b970e[_0x34ad('0x2a')]},'individualHooks':!![]});}})[_0x34ad('0x12')](function(){if(_0x1b970e){return _0x1b970e[_0x34ad('0x52')]({'raw':!![]});}})[_0x34ad('0x12')](function(_0x1739b8){if(_0x1b970e){if(_0x1739b8){var _0x49a3aa=[];_0x480065=_0x1739b8;if(_0x480065['length']){for(var _0x9c86c4=0x0;_0x9c86c4<_0x480065[_0x34ad('0x30')];_0x9c86c4++){_0x49a3aa[_0x34ad('0x53')](db[_0x34ad('0x2d')][_0x34ad('0x54')]({'membername':_0x1b970e['name'],'UserId':_0x1b970e['id'],'queue_name':_0x480065[_0x9c86c4][_0x34ad('0x2a')],'VoiceQueueId':_0x480065[_0x9c86c4]['id'],'interface':_0x2c9cc8,'paused':_0x1b970e['loginInPause']||![],'penalty':_0x480065[_0x9c86c4][_0x34ad('0x55')]||0x0}));}return BPromise[_0x34ad('0x4a')](_0x49a3aa);}}}})[_0x34ad('0x12')](function(){if(_0x1b970e){return db[_0x34ad('0x2f')][_0x34ad('0x20')]({'where':{'membername':_0x1b970e[_0x34ad('0x2a')],'exitAt':null}});}})[_0x34ad('0x12')](function(_0x41efb7){if(_0x1b970e){if(_0x41efb7&&_0x41efb7[_0x34ad('0x30')]){var _0x20988a=[];_0x41efb7[_0x34ad('0x33')](function(_0x282148){_0x20988a[_0x34ad('0x53')](_0x282148[_0x34ad('0x2e')]({'exitAt':moment()[_0x34ad('0x35')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x34ad('0x4a')](_0x20988a);}}})['then'](function(_0x51abf2){if(_0x1b970e){var _0x92a9bb=[];var _0xfe0159=[];var _0x305ee9=utils[_0x34ad('0x32')]();var _0x39b4f8={'membername':_0x1b970e[_0x34ad('0x2a')],'interface':_0x2c9cc8,'enterAt':moment()[_0x34ad('0x35')](_0x34ad('0x31')),'role':_0x1b970e[_0x34ad('0x39')],'internal':_0x1b970e[_0x34ad('0x2b')]};_0x305ee9[_0x34ad('0x33')](function(_0x2cd912){_0x92a9bb['push'](_[_0x34ad('0x56')]({'channel':_0x2cd912,'type':'LOGIN','data1':'callysquare','data2':_0x2c9cc8},_0x39b4f8));if(_0x1b970e[_0x34ad('0x57')]){_0xfe0159[_0x34ad('0x53')](_[_0x34ad('0x56')]({'channel':_0x2cd912,'type':_0x34ad('0x41'),'data1':_0x34ad('0x58')},_0x39b4f8));}});return db[_0x34ad('0x2f')][_0x34ad('0x3b')](_0x92a9bb['concat'](_0xfe0159),{'individualHooks':!![]});}})[_0x34ad('0x12')](function(){if(_0x1b970e){return _0x1b970e['update']({'online':!![],'lastLoginAt':moment()['format'](_0x34ad('0x31')),'voicePause':_0x1b970e['loginInPause']||![],'mailPause':_0x1b970e['loginInPause']||![],'chatPause':_0x1b970e[_0x34ad('0x57')]||![],'faxPause':_0x1b970e[_0x34ad('0x57')]||![],'smsPause':_0x1b970e[_0x34ad('0x57')]||![],'openchannelPause':_0x1b970e[_0x34ad('0x57')]||![],'pauseType':_0x1b970e[_0x34ad('0x57')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x34ad('0x35')](_0x34ad('0x31')),'interface':_0x2c9cc8});}})[_0x34ad('0x12')](function(_0xaf2d17){_0x2caa7e(_0xaf2d17);})[_0x34ad('0x1d')](function(_0x472961){_0x41b4d6(_0x4e16f3['error'](0x1f4,_0x472961[_0x34ad('0x1b')]));});});}; \ No newline at end of file +var _0x79d7=['message','result','catch','GetUser','findAll','options','raw','attributes','limit','include','map','model','debug','ShowUser','User','find','where','PauseUser','name','role','internal','interface','UserVoiceQueueRt','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','format','SIP/%s','body','type','MemberReport','bulkCreate','update','DEFAULT\x20PAUSE','UnpauseUser','findOne','channel','Unknown\x20channel','voice','chat','fax','openchannel','whatsapp','system','set','%s%s','Pause','all','LogoutUser','mobile','phone','loginInPause','count','agent','../../config/license/util','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','merge','callysquare','LOGININPAUSE','concat','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','localhost','then','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x22754d,_0x3ffa6b){var _0x4e2724=function(_0x3e4691){while(--_0x3e4691){_0x22754d['push'](_0x22754d['shift']());}};_0x4e2724(++_0x3ffa6b);}(_0x79d7,0x9c));var _0x779d=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x79d7[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0x779d('0x0'));var util=require('util');var moment=require(_0x779d('0x1'));var BPromise=require(_0x779d('0x2'));var rs=require(_0x779d('0x3'));var fs=require('fs');var Redis=require(_0x779d('0x4'));var db=require(_0x779d('0x5'))['db'];var utils=require(_0x779d('0x6'));var logger=require('../../config/logger')(_0x779d('0x7'));var config=require(_0x779d('0x8'));var jayson=require(_0x779d('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x779d('0xa')]=_['defaults'](config[_0x779d('0xa')],{'host':_0x779d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./user.socket')['register'](socket);function respondWithRpcPromise(_0x2d23c1,_0x31a2e8,_0x3c820b){return new BPromise(function(_0x505e77,_0x19f327){return client['request'](_0x2d23c1,_0x3c820b)[_0x779d('0xc')](function(_0x568423){logger[_0x779d('0xd')](_0x779d('0xe'),_0x31a2e8,_0x779d('0xf'));logger['debug'](_0x779d('0x10'),_0x31a2e8,_0x779d('0xf'),JSON[_0x779d('0x11')](_0x568423));if(_0x568423[_0x779d('0x12')]){if(_0x568423[_0x779d('0x12')][_0x779d('0x13')]===0x1f4){logger['error'](_0x779d('0xe'),_0x31a2e8,_0x568423[_0x779d('0x12')][_0x779d('0x14')]);return _0x19f327(_0x568423[_0x779d('0x12')][_0x779d('0x14')]);}logger['error'](_0x779d('0xe'),_0x31a2e8,_0x568423[_0x779d('0x12')][_0x779d('0x14')]);return _0x505e77(_0x568423['error'][_0x779d('0x14')]);}else{logger[_0x779d('0xd')](_0x779d('0xe'),_0x31a2e8,_0x779d('0xf'));_0x505e77(_0x568423[_0x779d('0x15')][_0x779d('0x14')]);}})[_0x779d('0x16')](function(_0x3a0465){logger[_0x779d('0x12')](_0x779d('0xe'),_0x31a2e8,_0x3a0465);_0x19f327(_0x3a0465);});});}exports[_0x779d('0x17')]=function(_0x373abb){var _0x4553a2=this;return new Promise(function(_0x5b1f79,_0x1ab255){return db['User'][_0x779d('0x18')]({'raw':_0x373abb['options']?_0x373abb[_0x779d('0x19')][_0x779d('0x1a')]===undefined?!![]:![]:!![],'where':_0x373abb[_0x779d('0x19')]?_0x373abb[_0x779d('0x19')]['where']||null:null,'attributes':_0x373abb[_0x779d('0x19')]?_0x373abb[_0x779d('0x19')][_0x779d('0x1b')]||null:null,'limit':_0x373abb[_0x779d('0x19')]?_0x373abb[_0x779d('0x19')][_0x779d('0x1c')]||null:null,'include':_0x373abb[_0x779d('0x19')]?_0x373abb[_0x779d('0x19')][_0x779d('0x1d')]?_[_0x779d('0x1e')](_0x373abb['options'][_0x779d('0x1d')],function(_0x58e397){return{'model':db[_0x58e397['model']],'as':_0x58e397['as'],'attributes':_0x58e397[_0x779d('0x1b')],'include':_0x58e397[_0x779d('0x1d')]?_['map'](_0x58e397[_0x779d('0x1d')],function(_0x842638){return{'model':db[_0x842638[_0x779d('0x1f')]],'as':_0x842638['as'],'attributes':_0x842638['attributes'],'include':_0x842638[_0x779d('0x1d')]?_[_0x779d('0x1e')](_0x842638[_0x779d('0x1d')],function(_0x1b7584){return{'model':db[_0x1b7584[_0x779d('0x1f')]],'as':_0x1b7584['as'],'attributes':_0x1b7584[_0x779d('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x12714c){logger[_0x779d('0xd')](_0x779d('0x17'),_0x373abb);logger[_0x779d('0x20')](_0x779d('0x17'),_0x373abb,JSON[_0x779d('0x11')](_0x12714c));_0x5b1f79(_0x12714c);})[_0x779d('0x16')](function(_0x2060d5){logger[_0x779d('0x12')](_0x779d('0x17'),_0x2060d5['message'],_0x373abb);_0x1ab255(_0x4553a2[_0x779d('0x12')](0x1f4,_0x2060d5[_0x779d('0x14')]));});});};exports[_0x779d('0x21')]=function(_0x15f656){var _0x18312f=this;return new Promise(function(_0x44ca8b,_0x1f3a67){return db[_0x779d('0x22')][_0x779d('0x23')]({'raw':_0x15f656['options']?_0x15f656[_0x779d('0x19')][_0x779d('0x1a')]===undefined?!![]:![]:!![],'where':_0x15f656[_0x779d('0x19')]?_0x15f656['options'][_0x779d('0x24')]||null:null,'attributes':_0x15f656[_0x779d('0x19')]?_0x15f656[_0x779d('0x19')][_0x779d('0x1b')]||null:null,'include':_0x15f656[_0x779d('0x19')]?_0x15f656[_0x779d('0x19')][_0x779d('0x1d')]?_['map'](_0x15f656[_0x779d('0x19')][_0x779d('0x1d')],function(_0x467755){return{'model':db[_0x467755['model']],'as':_0x467755['as'],'attributes':_0x467755[_0x779d('0x1b')],'include':_0x467755['include']?_[_0x779d('0x1e')](_0x467755[_0x779d('0x1d')],function(_0x1efda7){return{'model':db[_0x1efda7[_0x779d('0x1f')]],'as':_0x1efda7['as'],'attributes':_0x1efda7[_0x779d('0x1b')],'include':_0x1efda7[_0x779d('0x1d')]?_[_0x779d('0x1e')](_0x1efda7[_0x779d('0x1d')],function(_0x278ca3){return{'model':db[_0x278ca3[_0x779d('0x1f')]],'as':_0x278ca3['as'],'attributes':_0x278ca3[_0x779d('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x483cc1){logger['info'](_0x779d('0x21'),_0x15f656);logger[_0x779d('0x20')]('ShowUser',_0x15f656,JSON[_0x779d('0x11')](_0x483cc1));_0x44ca8b(_0x483cc1);})[_0x779d('0x16')](function(_0x5f05ca){logger[_0x779d('0x12')](_0x779d('0x21'),_0x5f05ca[_0x779d('0x14')],_0x15f656);_0x1f3a67(_0x18312f[_0x779d('0x12')](0x1f4,_0x5f05ca[_0x779d('0x14')]));});});};exports[_0x779d('0x25')]=function(_0x52f87d){var _0xda5dc6=this;return new Promise(function(_0x51958e,_0x23dbdc){var _0x17bf31;return db[_0x779d('0x22')][_0x779d('0x23')]({'where':_0x52f87d[_0x779d('0x19')]['where']||{},'attributes':['id',_0x779d('0x26'),_0x779d('0x27'),_0x779d('0x28'),_0x779d('0x29')]})[_0x779d('0xc')](function(_0x38813f){if(_0x38813f){_0x17bf31=_0x38813f;return db[_0x779d('0x2a')]['update']({'paused':0x1},{'where':{'UserId':_0x17bf31['id']},'individualHooks':!![]});}})[_0x779d('0xc')](function(){if(_0x17bf31){return db['MemberReport'][_0x779d('0x18')]({'where':{'membername':_0x17bf31[_0x779d('0x26')],'type':_0x779d('0x2b'),'exitAt':null}});}})['then'](function(_0x50c33b){if(_0x17bf31){if(_0x50c33b&&_0x50c33b[_0x779d('0x2c')]){var _0x4ad582=moment()['format'](_0x779d('0x2d'));for(var _0x5a78fd=0x0,_0x16ec97=_0x50c33b['length'];_0x5a78fd<_0x16ec97;_0x5a78fd++){_0x50c33b[_0x5a78fd][_0x779d('0x2e')]({'exitAt':_0x4ad582});}}}})['then'](function(){if(_0x17bf31){var _0xd9a93d=[];var _0x128d5a=utils[_0x779d('0x2f')]();_0x128d5a[_0x779d('0x30')](function(_0x1c3d14){_0xd9a93d[_0x779d('0x31')]({'channel':_0x1c3d14,'membername':_0x17bf31[_0x779d('0x26')],'interface':_[_0x779d('0x32')](_0x17bf31[_0x779d('0x29')])?util[_0x779d('0x33')](_0x779d('0x34'),_0x17bf31['name']):_0x17bf31[_0x779d('0x29')],'type':_0x779d('0x2b'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x52f87d[_0x779d('0x35')][_0x779d('0x36')]||'DEFAULT\x20PAUSE','role':_0x17bf31[_0x779d('0x27')],'internal':_0x17bf31[_0x779d('0x28')],'uniqueid':_0x52f87d[_0x779d('0x35')]['uniqueid']||null});});return db[_0x779d('0x37')][_0x779d('0x38')](_0xd9a93d,{'individualHooks':!![]});}})[_0x779d('0xc')](function(){if(_0x17bf31){return _0x17bf31[_0x779d('0x39')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x52f87d[_0x779d('0x35')][_0x779d('0x36')]||_0x779d('0x3a'),'lastPauseAt':moment()[_0x779d('0x33')](_0x779d('0x2d'))});}})[_0x779d('0xc')](function(_0x345d5e){_0x51958e(_0x345d5e);})[_0x779d('0x16')](function(_0x4afd54){_0x23dbdc(_0xda5dc6['error'](0x1f4,_0x4afd54[_0x779d('0x14')]));});});};exports[_0x779d('0x3b')]=function(_0x4cca7a){var _0x4ee07c=this;return new Promise(function(_0x208867,_0x36996f){var _0x2e2c07;return db[_0x779d('0x22')][_0x779d('0x3c')]({'where':_0x4cca7a['options'][_0x779d('0x24')]||{},'attributes':['id',_0x779d('0x26')]})[_0x779d('0xc')](function(_0x466cd5){if(_0x466cd5){_0x2e2c07=_0x466cd5;if(_0x4cca7a[_0x779d('0x35')][_0x779d('0x3d')]&&!utils['isValidChannel'](_0x4cca7a[_0x779d('0x35')][_0x779d('0x3d')])){throw new Error(_0x779d('0x3e'));}switch(_0x4cca7a[_0x779d('0x35')][_0x779d('0x3d')]){case _0x779d('0x3f'):return db['UserVoiceQueueRt'][_0x779d('0x39')]({'paused':0x0},{'where':{'UserId':_0x2e2c07['id']}})[_0x779d('0xc')](function(){return db[_0x779d('0x37')][_0x779d('0x23')]({'where':{'channel':_0x4cca7a[_0x779d('0x35')][_0x779d('0x3d')],'membername':_0x2e2c07[_0x779d('0x26')],'type':_0x779d('0x2b'),'exitAt':null}});})[_0x779d('0xc')](function(_0x3cd8ca){if(_0x3cd8ca){return _0x3cd8ca[_0x779d('0x39')]({'exitAt':moment()['format'](_0x779d('0x2d')),'data2':'system'},{'individualHooks':!![]});}return null;})[_0x779d('0xc')](function(){return _0x2e2c07[_0x779d('0x39')]({'voicePause':![]});});case'mail':case _0x779d('0x40'):case _0x779d('0x41'):case'sms':case _0x779d('0x42'):case _0x779d('0x43'):return db['MemberReport'][_0x779d('0x23')]({'where':{'channel':_0x4cca7a[_0x779d('0x35')]['channel'],'membername':_0x2e2c07['name'],'type':'PAUSE','exitAt':null}})[_0x779d('0xc')](function(_0x32b828){return _0x32b828[_0x779d('0x39')]({'exitAt':moment()[_0x779d('0x33')](_0x779d('0x2d')),'data2':_0x779d('0x44')},{'individualHooks':!![]});})[_0x779d('0xc')](function(){var _0x29d952={};_[_0x779d('0x45')](_0x29d952,util[_0x779d('0x33')](_0x779d('0x46'),_0x4cca7a[_0x779d('0x35')][_0x779d('0x3d')],_0x779d('0x47')),![]);return _0x2e2c07['update'](_0x29d952);});default:return db[_0x779d('0x2a')][_0x779d('0x39')]({'paused':0x0},{'where':{'UserId':_0x2e2c07['id']}})[_0x779d('0xc')](function(){return db[_0x779d('0x37')][_0x779d('0x18')]({'where':{'membername':_0x2e2c07[_0x779d('0x26')],'type':_0x779d('0x2b'),'exitAt':null}});})['then'](function(_0x54e069){var _0x5f5960=[];_0x54e069['forEach'](function(_0x44aef3){_0x5f5960['push'](_0x44aef3[_0x779d('0x39')]({'exitAt':moment()[_0x779d('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'}));});return BPromise[_0x779d('0x48')](_0x5f5960);})[_0x779d('0xc')](function(){return _0x2e2c07[_0x779d('0x39')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x779d('0xc')](function(_0x59d699){_0x208867(_0x59d699);})[_0x779d('0x16')](function(_0x4aa774){_0x36996f(_0x4ee07c[_0x779d('0x12')](0x1f4,_0x4aa774[_0x779d('0x14')]));});});};exports[_0x779d('0x49')]=function(_0x1c2320){var _0x44a004=this;return new Promise(function(_0x46f6c5,_0x3bfd90){var _0x3fe822;return db['User'][_0x779d('0x3c')]({'where':_0x1c2320['options']['where']||{},'attributes':['id',_0x779d('0x26')]})['then'](function(_0x6f9eeb){if(_0x6f9eeb){_0x3fe822=_0x6f9eeb;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x3fe822[_0x779d('0x26')]},'individualHooks':!![]});}})[_0x779d('0xc')](function(){if(_0x3fe822){return db[_0x779d('0x37')]['findAll']({'where':{'membername':_0x3fe822[_0x779d('0x26')],'exitAt':null}});}})[_0x779d('0xc')](function(_0x1e789a){if(_0x3fe822){if(_0x1e789a&&_0x1e789a['length']){var _0x33e151=[];_0x1e789a[_0x779d('0x30')](function(_0x295fd3){_0x33e151[_0x779d('0x31')](_0x295fd3[_0x779d('0x39')]({'exitAt':moment()[_0x779d('0x33')](_0x779d('0x2d'))}));});return BPromise[_0x779d('0x48')](_0x33e151);}}})[_0x779d('0xc')](function(){if(_0x3fe822){return _0x3fe822[_0x779d('0x39')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x779d('0xc')](function(_0x2c121b){_0x46f6c5(_0x2c121b);})[_0x779d('0x16')](function(_0x374432){_0x3bfd90(_0x44a004[_0x779d('0x12')](0x1f4,_0x374432[_0x779d('0x14')]));});});};exports['LoginUser']=function(_0x4d7251){var _0x22bc5f=this;return new Promise(function(_0x3741a4,_0x214dfe){var _0x2df1aa;var _0x1218ad;var _0x402555;var _0x5a9b30;return db[_0x779d('0x22')][_0x779d('0x3c')]({'where':_0x4d7251[_0x779d('0x19')][_0x779d('0x24')]||{},'attributes':['id',_0x779d('0x26'),_0x779d('0x27'),_0x779d('0x4a'),_0x779d('0x4b'),_0x779d('0x28'),_0x779d('0x4c'),_0x779d('0x29')]})[_0x779d('0xc')](function(_0x51cdc2){if(_0x51cdc2){_0x2df1aa=_0x51cdc2;_0x5a9b30=_0x4d7251[_0x779d('0x35')][_0x779d('0x29')]?_0x4d7251[_0x779d('0x35')][_0x779d('0x29')]:util[_0x779d('0x33')](_0x779d('0x34'),_0x2df1aa[_0x779d('0x26')]);return db[_0x779d('0x22')][_0x779d('0x4d')]({'where':{'role':_0x779d('0x4e'),'online':!![],'id':{'$ne':_0x2df1aa['id']}}});}})['then'](function(_0x3b9275){if(_0x3b9275){_0x402555=_0x3b9275;return require(_0x779d('0x4f'))['getLicense']();}})['then'](function(_0x4edc5b){if(_0x4edc5b&&_0x4edc5b[_0x779d('0x50')]&&_0x402555>=_0x4edc5b[_0x779d('0x50')]){throw new Error(_0x779d('0x51'));}})['then'](function(){if(_0x2df1aa){return db[_0x779d('0x2a')]['destroy']({'where':{'membername':_0x2df1aa[_0x779d('0x26')]},'individualHooks':!![]});}})[_0x779d('0xc')](function(){if(_0x2df1aa){return _0x2df1aa[_0x779d('0x52')]({'raw':!![]});}})[_0x779d('0xc')](function(_0x42f671){if(_0x2df1aa){if(_0x42f671){var _0xa91bea=[];_0x1218ad=_0x42f671;if(_0x1218ad[_0x779d('0x2c')]){for(var _0x58cdfc=0x0;_0x58cdfc<_0x1218ad[_0x779d('0x2c')];_0x58cdfc++){_0xa91bea[_0x779d('0x31')](db[_0x779d('0x2a')][_0x779d('0x53')]({'membername':_0x2df1aa[_0x779d('0x26')],'UserId':_0x2df1aa['id'],'queue_name':_0x1218ad[_0x58cdfc]['name'],'VoiceQueueId':_0x1218ad[_0x58cdfc]['id'],'interface':_0x5a9b30,'paused':_0x2df1aa[_0x779d('0x4c')]||![],'penalty':_0x1218ad[_0x58cdfc]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x779d('0x48')](_0xa91bea);}}}})[_0x779d('0xc')](function(){if(_0x2df1aa){return db[_0x779d('0x37')][_0x779d('0x18')]({'where':{'membername':_0x2df1aa[_0x779d('0x26')],'exitAt':null}});}})['then'](function(_0x47dc1b){if(_0x2df1aa){if(_0x47dc1b&&_0x47dc1b[_0x779d('0x2c')]){var _0x57c235=[];_0x47dc1b[_0x779d('0x30')](function(_0x4cf2fb){_0x57c235[_0x779d('0x31')](_0x4cf2fb['update']({'exitAt':moment()[_0x779d('0x33')](_0x779d('0x2d'))}));});return BPromise[_0x779d('0x48')](_0x57c235);}}})[_0x779d('0xc')](function(_0x369b5f){if(_0x2df1aa){var _0x45146d=[];var _0x5f02ed=[];var _0x3591e2=utils[_0x779d('0x2f')]();var _0x2e9fc9={'membername':_0x2df1aa['name'],'interface':_0x5a9b30,'enterAt':moment()[_0x779d('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x2df1aa[_0x779d('0x27')],'internal':_0x2df1aa[_0x779d('0x28')]};_0x3591e2[_0x779d('0x30')](function(_0x575d6c){_0x45146d[_0x779d('0x31')](_[_0x779d('0x54')]({'channel':_0x575d6c,'type':'LOGIN','data1':_0x779d('0x55'),'data2':_0x5a9b30},_0x2e9fc9));if(_0x2df1aa['loginInPause']){_0x5f02ed['push'](_['merge']({'channel':_0x575d6c,'type':_0x779d('0x2b'),'data1':_0x779d('0x56')},_0x2e9fc9));}});return db[_0x779d('0x37')]['bulkCreate'](_0x45146d[_0x779d('0x57')](_0x5f02ed),{'individualHooks':!![]});}})[_0x779d('0xc')](function(){if(_0x2df1aa){return _0x2df1aa[_0x779d('0x39')]({'online':!![],'lastLoginAt':moment()[_0x779d('0x33')](_0x779d('0x2d')),'voicePause':_0x2df1aa['loginInPause']||![],'mailPause':_0x2df1aa['loginInPause']||![],'chatPause':_0x2df1aa['loginInPause']||![],'faxPause':_0x2df1aa[_0x779d('0x4c')]||![],'smsPause':_0x2df1aa['loginInPause']||![],'openchannelPause':_0x2df1aa[_0x779d('0x4c')]||![],'pauseType':_0x2df1aa['loginInPause']?_0x779d('0x56'):null,'lastPauseAt':moment()[_0x779d('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x5a9b30});}})[_0x779d('0xc')](function(_0x4868cd){_0x3741a4(_0x4868cd);})[_0x779d('0x16')](function(_0x4c5df0){_0x214dfe(_0x22bc5f[_0x779d('0x12')](0x1f4,_0x4c5df0[_0x779d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 0c5719b..4f78c11 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 _0xff43=['register','length','user:','./user.events','remove','update','emit','removeListener'];(function(_0x558515,_0x473d57){var _0xd5cd2a=function(_0x14d7eb){while(--_0x14d7eb){_0x558515['push'](_0x558515['shift']());}};_0xd5cd2a(++_0x473d57);}(_0xff43,0x1a3));var _0x3ff4=function(_0x1bf672,_0xb8ba25){_0x1bf672=_0x1bf672-0x0;var _0x141d0b=_0xff43[_0x1bf672];return _0x141d0b;};'use strict';var UserEvents=require(_0x3ff4('0x0'));var events=['save',_0x3ff4('0x1'),_0x3ff4('0x2')];function createListener(_0x5dfc47,_0x4c7c2f){return function(_0x444fd2){_0x4c7c2f[_0x3ff4('0x3')](_0x5dfc47,_0x444fd2);};}function removeListener(_0x5d108a,_0x2969e8){return function(){UserEvents[_0x3ff4('0x4')](_0x5d108a,_0x2969e8);};}exports[_0x3ff4('0x5')]=function(_0xa9de48){for(var _0x4e79f5=0x0,_0x538b0b=events[_0x3ff4('0x6')];_0x4e79f5<_0x538b0b;_0x4e79f5++){var _0x37fe83=events[_0x4e79f5];var _0x249788=createListener(_0x3ff4('0x7')+_0x37fe83,_0xa9de48);UserEvents['on'](_0x37fe83,_0x249788);}}; \ No newline at end of file +var _0x77af=['./user.events','save','remove','update','emit','removeListener','register','user:'];(function(_0x3cb51c,_0x58b8e3){var _0x4e1fda=function(_0x2ccf50){while(--_0x2ccf50){_0x3cb51c['push'](_0x3cb51c['shift']());}};_0x4e1fda(++_0x58b8e3);}(_0x77af,0xd0));var _0xf77a=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x77af[_0x167cc1];return _0x10bc4b;};'use strict';var UserEvents=require(_0xf77a('0x0'));var events=[_0xf77a('0x1'),_0xf77a('0x2'),_0xf77a('0x3')];function createListener(_0x58bf56,_0x37088f){return function(_0x4caa0f){_0x37088f[_0xf77a('0x4')](_0x58bf56,_0x4caa0f);};}function removeListener(_0x53fd4a,_0x42d6f9){return function(){UserEvents[_0xf77a('0x5')](_0x53fd4a,_0x42d6f9);};}exports[_0xf77a('0x6')]=function(_0x45a7e3){for(var _0x3ac0f1=0x0,_0x13b5d4=events['length'];_0x3ac0f1<_0x13b5d4;_0x3ac0f1++){var _0x4bdab9=events[_0x3ac0f1];var _0x29ffb1=createListener(_0xf77a('0x7')+_0x4bdab9,_0x45a7e3);UserEvents['on'](_0x4bdab9,_0x29ffb1);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index a2d86db..cfe73f3 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 _0x087b=['../../config/environment','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x979fda,_0x1196bf){var _0x2f9216=function(_0x2f7104){while(--_0x2f7104){_0x979fda['push'](_0x979fda['shift']());}};_0x2f9216(++_0x1196bf);}(_0x087b,0x11a));var _0xb087=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x087b[_0x486f4a];return _0x135d99;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var fs_extra=require(_0xb087('0x3'));var auth=require(_0xb087('0x4'));var interaction=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));module[_0xb087('0x7')]=router; \ No newline at end of file +var _0x36ee=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x18d1c3,_0x62846b){var _0x2c00cb=function(_0x1e3b23){while(--_0x1e3b23){_0x18d1c3['push'](_0x18d1c3['shift']());}};_0x2c00cb(++_0x62846b);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var fs_extra=require(_0xe36e('0x3'));var auth=require(_0xe36e('0x4'));var interaction=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));module[_0xe36e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 4d14974..7f64101 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x58512a,_0x54f50f){var _0x153382=function(_0x1597a2){while(--_0x1597a2){_0x58512a['push'](_0x58512a['shift']());}};_0x153382(++_0x54f50f);}(_0xe706,0xa3));var _0x6e70=function(_0x57add2,_0x4f2b7d){_0x57add2=_0x57add2-0x0;var _0x4e3670=_0xe706[_0x57add2];return _0x4e3670;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x31b350,_0x5be290){var _0x1870dc=function(_0xbae48d){while(--_0xbae48d){_0x31b350['push'](_0x31b350['shift']());}};_0x1870dc(++_0x5be290);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('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 12f3e0b..e644465 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 _0xbd3a=['path','./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','bluebird'];(function(_0x50f0a9,_0x2b0c57){var _0x5a33d9=function(_0x40338e){while(--_0x40338e){_0x50f0a9['push'](_0x50f0a9['shift']());}};_0x5a33d9(++_0x2b0c57);}(_0xbd3a,0xb9));var _0xabd3=function(_0x1410a9,_0x2d4289){_0x1410a9=_0x1410a9-0x0;var _0x43339d=_0xbd3a[_0x1410a9];return _0x43339d;};'use strict';var _=require(_0xabd3('0x0'));var util=require(_0xabd3('0x1'));var logger=require(_0xabd3('0x2'))(_0xabd3('0x3'));var moment=require('moment');var BPromise=require(_0xabd3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xabd3('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xabd3('0x6'));module['exports']=function(_0x44e89a,_0x35f85f){return _0x44e89a[_0xabd3('0x7')](_0xabd3('0x8'),attributes,{'tableName':_0xabd3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9169=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger'];(function(_0x25b9f4,_0x150ea9){var _0x4f8504=function(_0xe62785){while(--_0xe62785){_0x25b9f4['push'](_0x25b9f4['shift']());}};_0x4f8504(++_0x150ea9);}(_0x9169,0xdd));var _0x9916=function(_0x577f15,_0x33bcb0){_0x577f15=_0x577f15-0x0;var _0x49d66d=_0x9169[_0x577f15];return _0x49d66d;};'use strict';var _=require(_0x9916('0x0'));var util=require(_0x9916('0x1'));var logger=require(_0x9916('0x2'))(_0x9916('0x3'));var moment=require(_0x9916('0x4'));var BPromise=require(_0x9916('0x5'));var rp=require(_0x9916('0x6'));var fs=require('fs');var path=require(_0x9916('0x7'));var rimraf=require(_0x9916('0x8'));var config=require(_0x9916('0x9'));var attributes=require(_0x9916('0xa'));module['exports']=function(_0x2f58cd,_0x44fb08){return _0x2f58cd[_0x9916('0xb')](_0x9916('0xc'),attributes,{'tableName':_0x9916('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 766177a..b23274d 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 _0x35ec=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x18b49a,_0x437ecd){var _0x400641=function(_0x4cc4df){while(--_0x4cc4df){_0x18b49a['push'](_0x18b49a['shift']());}};_0x400641(++_0x437ecd);}(_0x35ec,0x1d2));var _0xc35e=function(_0x4b7cbe,_0x391807){_0x4b7cbe=_0x4b7cbe-0x0;var _0xda26a7=_0x35ec[_0x4b7cbe];return _0xda26a7;};'use strict';var _=require(_0xc35e('0x0'));var util=require(_0xc35e('0x1'));var moment=require(_0xc35e('0x2'));var BPromise=require(_0xc35e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc35e('0x4'));var db=require(_0xc35e('0x5'))['db'];var utils=require(_0xc35e('0x6'));var logger=require(_0xc35e('0x7'))('rpc');var config=require(_0xc35e('0x8'));var jayson=require(_0xc35e('0x9'));var client=jayson[_0xc35e('0xa')][_0xc35e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a4743,_0x3fcdeb,_0x590753){return new BPromise(function(_0x140d78,_0x4560ce){return client[_0xc35e('0xc')](_0x2a4743,_0x590753)['then'](function(_0x50674b){logger[_0xc35e('0xd')](_0xc35e('0xe'),_0x3fcdeb,_0xc35e('0xf'));logger[_0xc35e('0x10')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x3fcdeb,'request\x20sent',JSON[_0xc35e('0x11')](_0x50674b));if(_0x50674b['error']){if(_0x50674b[_0xc35e('0x12')][_0xc35e('0x13')]===0x1f4){logger['error'](_0xc35e('0xe'),_0x3fcdeb,_0x50674b[_0xc35e('0x12')][_0xc35e('0x14')]);return _0x4560ce(_0x50674b[_0xc35e('0x12')][_0xc35e('0x14')]);}logger[_0xc35e('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x3fcdeb,_0x50674b[_0xc35e('0x12')][_0xc35e('0x14')]);return _0x140d78(_0x50674b['error']['message']);}else{logger[_0xc35e('0xd')](_0xc35e('0xe'),_0x3fcdeb,_0xc35e('0xf'));_0x140d78(_0x50674b[_0xc35e('0x15')][_0xc35e('0x14')]);}})[_0xc35e('0x16')](function(_0x2b5c20){logger[_0xc35e('0x12')](_0xc35e('0xe'),_0x3fcdeb,_0x2b5c20);_0x4560ce(_0x2b5c20);});});} \ No newline at end of file +var _0xe4ca=['debug','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x271650,_0x492d94){var _0x583344=function(_0xda8a39){while(--_0xda8a39){_0x271650['push'](_0x271650['shift']());}};_0x583344(++_0x492d94);}(_0xe4ca,0x1a8));var _0xae4c=function(_0x35939f,_0x1fdf17){_0x35939f=_0x35939f-0x0;var _0x30a32a=_0xe4ca[_0x35939f];return _0x30a32a;};'use strict';var _=require(_0xae4c('0x0'));var util=require('util');var moment=require(_0xae4c('0x1'));var BPromise=require(_0xae4c('0x2'));var rs=require(_0xae4c('0x3'));var fs=require('fs');var Redis=require(_0xae4c('0x4'));var db=require(_0xae4c('0x5'))['db'];var utils=require(_0xae4c('0x6'));var logger=require('../../config/logger')(_0xae4c('0x7'));var config=require('../../config/environment');var jayson=require(_0xae4c('0x8'));var client=jayson[_0xae4c('0x9')][_0xae4c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ddc85,_0x540deb,_0x293d1b){return new BPromise(function(_0x2f1337,_0x16f687){return client[_0xae4c('0xb')](_0x2ddc85,_0x293d1b)[_0xae4c('0xc')](function(_0x436d4f){logger[_0xae4c('0xd')](_0xae4c('0xe'),_0x540deb,_0xae4c('0xf'));logger[_0xae4c('0x10')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x540deb,_0xae4c('0xf'),JSON[_0xae4c('0x11')](_0x436d4f));if(_0x436d4f[_0xae4c('0x12')]){if(_0x436d4f[_0xae4c('0x12')][_0xae4c('0x13')]===0x1f4){logger[_0xae4c('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x540deb,_0x436d4f['error']['message']);return _0x16f687(_0x436d4f['error']['message']);}logger['error'](_0xae4c('0xe'),_0x540deb,_0x436d4f['error'][_0xae4c('0x14')]);return _0x2f1337(_0x436d4f[_0xae4c('0x12')][_0xae4c('0x14')]);}else{logger[_0xae4c('0xd')](_0xae4c('0xe'),_0x540deb,'request\x20sent');_0x2f1337(_0x436d4f['result'][_0xae4c('0x14')]);}})[_0xae4c('0x15')](function(_0x19c7be){logger[_0xae4c('0x12')](_0xae4c('0xe'),_0x540deb,_0x19c7be);_0x16f687(_0x19c7be);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index df30618..aa01b73 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 _0xd523=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','exports','multer','util','path'];(function(_0x61870c,_0x167b9d){var _0x4f05f5=function(_0x40954e){while(--_0x40954e){_0x61870c['push'](_0x61870c['shift']());}};_0x4f05f5(++_0x167b9d);}(_0xd523,0x153));var _0x3d52=function(_0x54971a,_0x417d23){_0x54971a=_0x54971a-0x0;var _0x459d8e=_0xd523[_0x54971a];return _0x459d8e;};'use strict';var multer=require(_0x3d52('0x0'));var util=require(_0x3d52('0x1'));var path=require(_0x3d52('0x2'));var timeout=require(_0x3d52('0x3'));var express=require('express');var router=express[_0x3d52('0x4')]();var fs_extra=require(_0x3d52('0x5'));var auth=require(_0x3d52('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3d52('0x7'));module[_0x3d52('0x8')]=router; \ No newline at end of file +var _0x2b4f=['../../config/environment','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2bbb60,_0x3eda72){var _0x155bc1=function(_0x46be1f){while(--_0x46be1f){_0x2bbb60['push'](_0x2bbb60['shift']());}};_0x155bc1(++_0x3eda72);}(_0x2b4f,0x142));var _0xf2b4=function(_0x29dde9,_0x24a1f9){_0x29dde9=_0x29dde9-0x0;var _0x641de3=_0x2b4f[_0x29dde9];return _0x641de3;};'use strict';var multer=require('multer');var util=require(_0xf2b4('0x0'));var path=require('path');var timeout=require(_0xf2b4('0x1'));var express=require(_0xf2b4('0x2'));var router=express[_0xf2b4('0x3')]();var fs_extra=require(_0xf2b4('0x4'));var auth=require(_0xf2b4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf2b4('0x6'));module[_0xf2b4('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 8dac102..6771ea5 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 _0x9354=['exports','INTEGER','STRING'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x9354,0x96));var _0x4935=function(_0x50d6d6,_0x189c68){_0x50d6d6=_0x50d6d6-0x0;var _0x5d9bb4=_0x9354[_0x50d6d6];return _0x5d9bb4;};'use strict';var Sequelize=require('sequelize');module[_0x4935('0x0')]={'penalty':{'type':Sequelize[_0x4935('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x4935('0x2')]}}; \ No newline at end of file +var _0xdd4f=['sequelize','STRING'];(function(_0x417d31,_0x25bf51){var _0x562c2a=function(_0x2ea6fc){while(--_0x2ea6fc){_0x417d31['push'](_0x417d31['shift']());}};_0x562c2a(++_0x25bf51);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x1bb532,_0x8fc8ab){_0x1bb532=_0x1bb532-0x0;var _0x285d13=_0xdd4f[_0x1bb532];return _0x285d13;};'use strict';var Sequelize=require(_0xfdd4('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xfdd4('0x1')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 8478a8a..5e91824 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 _0x8988=['lodash','api','moment','bluebird','request-promise','../../config/environment','exports','define','user_has_fax_queues'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x8988,0xcf));var _0x8898=function(_0x4d3062,_0x25b5bb){_0x4d3062=_0x4d3062-0x0;var _0x302c2e=_0x8988[_0x4d3062];return _0x302c2e;};'use strict';var _=require(_0x8898('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8898('0x1'));var moment=require(_0x8898('0x2'));var BPromise=require(_0x8898('0x3'));var rp=require(_0x8898('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8898('0x5'));var attributes=require('./userFaxQueue.attributes');module[_0x8898('0x6')]=function(_0x5e5f31,_0x25b56a){return _0x5e5f31[_0x8898('0x7')]('UserFaxQueue',attributes,{'tableName':_0x8898('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x172c=['util','api','moment','bluebird','request-promise','path','rimraf','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues'];(function(_0x4b5a90,_0x1af1ad){var _0x154029=function(_0x441715){while(--_0x441715){_0x4b5a90['push'](_0x4b5a90['shift']());}};_0x154029(++_0x1af1ad);}(_0x172c,0x1ad));var _0xc172=function(_0x8b8564,_0x162976){_0x8b8564=_0x8b8564-0x0;var _0x360c61=_0x172c[_0x8b8564];return _0x360c61;};'use strict';var _=require('lodash');var util=require(_0xc172('0x0'));var logger=require('../../config/logger')(_0xc172('0x1'));var moment=require(_0xc172('0x2'));var BPromise=require(_0xc172('0x3'));var rp=require(_0xc172('0x4'));var fs=require('fs');var path=require(_0xc172('0x5'));var rimraf=require(_0xc172('0x6'));var config=require('../../config/environment');var attributes=require(_0xc172('0x7'));module['exports']=function(_0x569a8d,_0x247556){return _0x569a8d[_0xc172('0x8')](_0xc172('0x9'),attributes,{'tableName':_0xc172('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 29c839f..19e4880 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 _0x6d88=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment','randomstring'];(function(_0x333fed,_0x3d2122){var _0x12cac2=function(_0x41d9af){while(--_0x41d9af){_0x333fed['push'](_0x333fed['shift']());}};_0x12cac2(++_0x3d2122);}(_0x6d88,0x9c));var _0x86d8=function(_0x3c9bdf,_0x3b30cd){_0x3c9bdf=_0x3c9bdf-0x0;var _0x5664a6=_0x6d88[_0x3c9bdf];return _0x5664a6;};'use strict';var _=require(_0x86d8('0x0'));var util=require(_0x86d8('0x1'));var moment=require(_0x86d8('0x2'));var BPromise=require('bluebird');var rs=require(_0x86d8('0x3'));var fs=require('fs');var Redis=require(_0x86d8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x86d8('0x5'));var logger=require(_0x86d8('0x6'))(_0x86d8('0x7'));var config=require('../../config/environment');var jayson=require(_0x86d8('0x8'));var client=jayson[_0x86d8('0x9')][_0x86d8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e1377,_0x12a1f4,_0x11ac30){return new BPromise(function(_0x56b9d3,_0x3d7469){return client['request'](_0x3e1377,_0x11ac30)['then'](function(_0x39e2d7){logger['info'](_0x86d8('0xb'),_0x12a1f4,_0x86d8('0xc'));logger[_0x86d8('0xd')](_0x86d8('0xe'),_0x12a1f4,_0x86d8('0xc'),JSON[_0x86d8('0xf')](_0x39e2d7));if(_0x39e2d7[_0x86d8('0x10')]){if(_0x39e2d7[_0x86d8('0x10')]['code']===0x1f4){logger['error'](_0x86d8('0xb'),_0x12a1f4,_0x39e2d7[_0x86d8('0x10')][_0x86d8('0x11')]);return _0x3d7469(_0x39e2d7[_0x86d8('0x10')]['message']);}logger[_0x86d8('0x10')](_0x86d8('0xb'),_0x12a1f4,_0x39e2d7['error'][_0x86d8('0x11')]);return _0x56b9d3(_0x39e2d7[_0x86d8('0x10')][_0x86d8('0x11')]);}else{logger[_0x86d8('0x12')](_0x86d8('0xb'),_0x12a1f4,_0x86d8('0xc'));_0x56b9d3(_0x39e2d7['result'][_0x86d8('0x11')]);}})[_0x86d8('0x13')](function(_0x8b8aef){logger[_0x86d8('0x10')](_0x86d8('0xb'),_0x12a1f4,_0x8b8aef);_0x3d7469(_0x8b8aef);});});} \ No newline at end of file +var _0x4012=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x360f76,_0x2a1361){var _0x4c3d88=function(_0x3e5ab1){while(--_0x3e5ab1){_0x360f76['push'](_0x360f76['shift']());}};_0x4c3d88(++_0x2a1361);}(_0x4012,0x1bf));var _0x2401=function(_0x20a7be,_0x57e651){_0x20a7be=_0x20a7be-0x0;var _0x483865=_0x4012[_0x20a7be];return _0x483865;};'use strict';var _=require(_0x2401('0x0'));var util=require(_0x2401('0x1'));var moment=require(_0x2401('0x2'));var BPromise=require(_0x2401('0x3'));var rs=require(_0x2401('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2401('0x5'))['db'];var utils=require(_0x2401('0x6'));var logger=require(_0x2401('0x7'))(_0x2401('0x8'));var config=require(_0x2401('0x9'));var jayson=require(_0x2401('0xa'));var client=jayson[_0x2401('0xb')][_0x2401('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd7e3ab,_0x244889,_0x2758d2){return new BPromise(function(_0x5e2762,_0x351588){return client['request'](_0xd7e3ab,_0x2758d2)[_0x2401('0xd')](function(_0x4026c2){logger[_0x2401('0xe')](_0x2401('0xf'),_0x244889,_0x2401('0x10'));logger[_0x2401('0x11')](_0x2401('0x12'),_0x244889,_0x2401('0x10'),JSON[_0x2401('0x13')](_0x4026c2));if(_0x4026c2[_0x2401('0x14')]){if(_0x4026c2[_0x2401('0x14')][_0x2401('0x15')]===0x1f4){logger[_0x2401('0x14')](_0x2401('0xf'),_0x244889,_0x4026c2['error'][_0x2401('0x16')]);return _0x351588(_0x4026c2['error'][_0x2401('0x16')]);}logger[_0x2401('0x14')](_0x2401('0xf'),_0x244889,_0x4026c2[_0x2401('0x14')][_0x2401('0x16')]);return _0x5e2762(_0x4026c2['error']['message']);}else{logger[_0x2401('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x244889,'request\x20sent');_0x5e2762(_0x4026c2[_0x2401('0x17')][_0x2401('0x16')]);}})[_0x2401('0x18')](function(_0xa2a4c1){logger[_0x2401('0x14')](_0x2401('0xf'),_0x244889,_0xa2a4c1);_0x351588(_0xa2a4c1);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index fa8f198..bf2ec25 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 _0x5eb1=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','exports','util','path'];(function(_0x4f03d0,_0x3143e2){var _0x1da666=function(_0x3d0a5b){while(--_0x3d0a5b){_0x4f03d0['push'](_0x4f03d0['shift']());}};_0x1da666(++_0x3143e2);}(_0x5eb1,0x7c));var _0x15eb=function(_0x5d6e30,_0xc21d51){_0x5d6e30=_0x5d6e30-0x0;var _0x3d3f3b=_0x5eb1[_0x5d6e30];return _0x3d3f3b;};'use strict';var multer=require('multer');var util=require(_0x15eb('0x0'));var path=require(_0x15eb('0x1'));var timeout=require(_0x15eb('0x2'));var express=require(_0x15eb('0x3'));var router=express[_0x15eb('0x4')]();var fs_extra=require(_0x15eb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x15eb('0x6'));var config=require(_0x15eb('0x7'));module[_0x15eb('0x8')]=router; \ No newline at end of file +var _0x0b63=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x380b39,_0x1026dd){var _0x4cacd1=function(_0x52c2b6){while(--_0x52c2b6){_0x380b39['push'](_0x380b39['shift']());}};_0x4cacd1(++_0x1026dd);}(_0x0b63,0xe7));var _0x30b6=function(_0x1beec3,_0x43b981){_0x1beec3=_0x1beec3-0x0;var _0x456c1e=_0x0b63[_0x1beec3];return _0x456c1e;};'use strict';var multer=require(_0x30b6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x30b6('0x1'));var express=require(_0x30b6('0x2'));var router=express[_0x30b6('0x3')]();var fs_extra=require(_0x30b6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x30b6('0x5'));var config=require(_0x30b6('0x6'));module[_0x30b6('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index b4a5611..a3e2b3b 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x2a6849,_0x1801ba){var _0x3fccaf=function(_0x5d57a2){while(--_0x5d57a2){_0x2a6849['push'](_0x2a6849['shift']());}};_0x3fccaf(++_0x1801ba);}(_0xe706,0xa3));var _0x6e70=function(_0x849e7c,_0x34014e){_0x849e7c=_0x849e7c-0x0;var _0x11722f=_0xe706[_0x849e7c];return _0x11722f;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x16acb7,_0x23f034){var _0x39bf39=function(_0x21281e){while(--_0x21281e){_0x16acb7['push'](_0x16acb7['shift']());}};_0x39bf39(++_0x23f034);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index cf7e1c0..58a70de 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 _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','../../config/logger'];(function(_0x374ccf,_0xa945c4){var _0x443cde=function(_0x27ff10){while(--_0x27ff10){_0x374ccf['push'](_0x374ccf['shift']());}};_0x443cde(++_0xa945c4);}(_0xb10b,0x12a));var _0xbb10=function(_0x5d30b4,_0x199248){_0x5d30b4=_0x5d30b4-0x0;var _0x1acfb8=_0xb10b[_0x5d30b4];return _0x1acfb8;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserMailQueue',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','../../config/logger'];(function(_0x5c365f,_0x3b40ed){var _0x295e1b=function(_0x226683){while(--_0x226683){_0x5c365f['push'](_0x5c365f['shift']());}};_0x295e1b(++_0x3b40ed);}(_0xb10b,0x12a));var _0xbb10=function(_0x4bea95,_0x2026cb){_0x4bea95=_0x4bea95-0x0;var _0x52aa29=_0xb10b[_0x4bea95];return _0x52aa29;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserMailQueue',attributes,{'tableName':_0xbb10('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 2e922e7..3d549d7 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 _0xf29c=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util'];(function(_0x2d4843,_0x2b5859){var _0x486c34=function(_0x35dcd6){while(--_0x35dcd6){_0x2d4843['push'](_0x2d4843['shift']());}};_0x486c34(++_0x2b5859);}(_0xf29c,0xc7));var _0xcf29=function(_0x5f572b,_0x3d090e){_0x5f572b=_0x5f572b-0x0;var _0x28e5da=_0xf29c[_0x5f572b];return _0x28e5da;};'use strict';var _=require('lodash');var util=require(_0xcf29('0x0'));var moment=require(_0xcf29('0x1'));var BPromise=require(_0xcf29('0x2'));var rs=require(_0xcf29('0x3'));var fs=require('fs');var Redis=require(_0xcf29('0x4'));var db=require(_0xcf29('0x5'))['db'];var utils=require(_0xcf29('0x6'));var logger=require(_0xcf29('0x7'))(_0xcf29('0x8'));var config=require(_0xcf29('0x9'));var jayson=require(_0xcf29('0xa'));var client=jayson[_0xcf29('0xb')][_0xcf29('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x157dfe,_0x15ab38,_0x435ced){return new BPromise(function(_0x4e6469,_0x5ec45f){return client[_0xcf29('0xd')](_0x157dfe,_0x435ced)[_0xcf29('0xe')](function(_0x2e9d52){logger[_0xcf29('0xf')](_0xcf29('0x10'),_0x15ab38,_0xcf29('0x11'));logger[_0xcf29('0x12')](_0xcf29('0x13'),_0x15ab38,_0xcf29('0x11'),JSON[_0xcf29('0x14')](_0x2e9d52));if(_0x2e9d52[_0xcf29('0x15')]){if(_0x2e9d52[_0xcf29('0x15')]['code']===0x1f4){logger[_0xcf29('0x15')](_0xcf29('0x10'),_0x15ab38,_0x2e9d52['error'][_0xcf29('0x16')]);return _0x5ec45f(_0x2e9d52['error'][_0xcf29('0x16')]);}logger[_0xcf29('0x15')](_0xcf29('0x10'),_0x15ab38,_0x2e9d52[_0xcf29('0x15')][_0xcf29('0x16')]);return _0x4e6469(_0x2e9d52[_0xcf29('0x15')][_0xcf29('0x16')]);}else{logger[_0xcf29('0xf')](_0xcf29('0x10'),_0x15ab38,'request\x20sent');_0x4e6469(_0x2e9d52[_0xcf29('0x17')]['message']);}})[_0xcf29('0x18')](function(_0x5f31f7){logger[_0xcf29('0x15')]('UserMailQueue,\x20%s,\x20%s',_0x15ab38,_0x5f31f7);_0x5ec45f(_0x5f31f7);});});} \ No newline at end of file +var _0xe685=['UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','code','error','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','info'];(function(_0x4035a9,_0x41019f){var _0x1e161b=function(_0x4d880e){while(--_0x4d880e){_0x4035a9['push'](_0x4035a9['shift']());}};_0x1e161b(++_0x41019f);}(_0xe685,0x1ed));var _0x5e68=function(_0xbc41b5,_0x31bfb2){_0xbc41b5=_0xbc41b5-0x0;var _0x1973ea=_0xe685[_0xbc41b5];return _0x1973ea;};'use strict';var _=require('lodash');var util=require(_0x5e68('0x0'));var moment=require(_0x5e68('0x1'));var BPromise=require('bluebird');var rs=require(_0x5e68('0x2'));var fs=require('fs');var Redis=require(_0x5e68('0x3'));var db=require(_0x5e68('0x4'))['db'];var utils=require(_0x5e68('0x5'));var logger=require(_0x5e68('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5e68('0x7'));var client=jayson[_0x5e68('0x8')][_0x5e68('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x310072,_0x47f58d,_0x47218c){return new BPromise(function(_0x1e8ac7,_0x165280){return client['request'](_0x310072,_0x47218c)['then'](function(_0x54b9c9){logger[_0x5e68('0xa')](_0x5e68('0xb'),_0x47f58d,_0x5e68('0xc'));logger[_0x5e68('0xd')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x47f58d,'request\x20sent',JSON['stringify'](_0x54b9c9));if(_0x54b9c9['error']){if(_0x54b9c9['error'][_0x5e68('0xe')]===0x1f4){logger[_0x5e68('0xf')](_0x5e68('0xb'),_0x47f58d,_0x54b9c9['error'][_0x5e68('0x10')]);return _0x165280(_0x54b9c9[_0x5e68('0xf')]['message']);}logger[_0x5e68('0xf')]('UserMailQueue,\x20%s,\x20%s',_0x47f58d,_0x54b9c9[_0x5e68('0xf')]['message']);return _0x1e8ac7(_0x54b9c9[_0x5e68('0xf')][_0x5e68('0x10')]);}else{logger[_0x5e68('0xa')]('UserMailQueue,\x20%s,\x20%s',_0x47f58d,_0x5e68('0xc'));_0x1e8ac7(_0x54b9c9['result']['message']);}})[_0x5e68('0x11')](function(_0x45f3c4){logger[_0x5e68('0xf')](_0x5e68('0xb'),_0x47f58d,_0x45f3c4);_0x165280(_0x45f3c4);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index ea1d848..590b026 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 _0x1958=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller'];(function(_0x3252b1,_0x54e32d){var _0x5f189d=function(_0x57e83a){while(--_0x57e83a){_0x3252b1['push'](_0x3252b1['shift']());}};_0x5f189d(++_0x54e32d);}(_0x1958,0x96));var _0x8195=function(_0xd816e2,_0x5edac2){_0xd816e2=_0xd816e2-0x0;var _0x1f5924=_0x1958[_0xd816e2];return _0x1f5924;};'use strict';var multer=require(_0x8195('0x0'));var util=require(_0x8195('0x1'));var path=require(_0x8195('0x2'));var timeout=require(_0x8195('0x3'));var express=require('express');var router=express[_0x8195('0x4')]();var fs_extra=require(_0x8195('0x5'));var auth=require(_0x8195('0x6'));var interaction=require(_0x8195('0x7'));var config=require(_0x8195('0x8'));var controller=require(_0x8195('0x9'));router['post']('/',auth['isAuthenticated'](),controller['sendUserNotification']);module['exports']=router; \ No newline at end of file +var _0x1776=['./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1776,0x71));var _0x6177=function(_0x3fbd52,_0x5b2799){_0x3fbd52=_0x3fbd52-0x0;var _0x52b3e3=_0x1776[_0x3fbd52];return _0x52b3e3;};'use strict';var multer=require(_0x6177('0x0'));var util=require(_0x6177('0x1'));var path=require('path');var timeout=require(_0x6177('0x2'));var express=require(_0x6177('0x3'));var router=express['Router']();var fs_extra=require(_0x6177('0x4'));var auth=require(_0x6177('0x5'));var interaction=require(_0x6177('0x6'));var config=require('../../config/environment');var controller=require(_0x6177('0x7'));router[_0x6177('0x8')]('/',auth[_0x6177('0x9')](),controller[_0x6177('0xa')]);module[_0x6177('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 55bf0df..f24377a 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 _0x8c64=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x8c64,0x115));var _0x48c6=function(_0x3f9ab3,_0x406f80){_0x3f9ab3=_0x3f9ab3-0x0;var _0x13905c=_0x8c64[_0x3f9ab3];return _0x13905c;};'use strict';var Sequelize=require(_0x48c6('0x0'));module[_0x48c6('0x1')]={'body':{'type':Sequelize[_0x48c6('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x48c6('0x2')]},'recipientsDescription':{'type':Sequelize[_0x48c6('0x3')]},'beep':{'type':Sequelize[_0x48c6('0x4')]}}; \ No newline at end of file +var _0xaa8e=['TEXT'];(function(_0x17c0d9,_0x19f78d){var _0x164907=function(_0xd62171){while(--_0xd62171){_0x17c0d9['push'](_0x17c0d9['shift']());}};_0x164907(++_0x19f78d);}(_0xaa8e,0x13e));var _0xeaa8=function(_0x4e1027,_0x811e4a){_0x4e1027=_0x4e1027-0x0;var _0x2c3210=_0xaa8e[_0x4e1027];return _0x2c3210;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xeaa8('0x0')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index bf2a3bc..d3f4bf7 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 _0xe8f1=['html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','view','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','chatqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','user','includes','toLowerCase','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','forEach','emit','userNotification:send','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','model','ids','Queue','push','all','union','flatten','catch','getAgents','map'];(function(_0x4d337e,_0x2f7eed){var _0x247963=function(_0x3d6564){while(--_0x3d6564){_0x4d337e['push'](_0x4d337e['shift']());}};_0x247963(++_0x2f7eed);}(_0xe8f1,0x11d));var _0x1e8f=function(_0x62afb1,_0x2d1ca8){_0x62afb1=_0x62afb1-0x0;var _0x45f320=_0xe8f1[_0x62afb1];return _0x45f320;};'use strict';var pdf=require(_0x1e8f('0x0'));var emlformat=require(_0x1e8f('0x1'));var rimraf=require(_0x1e8f('0x2'));var zipdir=require(_0x1e8f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1e8f('0x4'));var BPromise=require(_0x1e8f('0x5'));var Mustache=require(_0x1e8f('0x6'));var util=require('util');var path=require(_0x1e8f('0x7'));var sox=require(_0x1e8f('0x8'));var csv=require(_0x1e8f('0x9'));var ejs=require(_0x1e8f('0xa'));var fs=require('fs');var fs_extra=require(_0x1e8f('0xb'));var _=require(_0x1e8f('0xc'));var squel=require(_0x1e8f('0xd'));var crypto=require('crypto');var jsforce=require(_0x1e8f('0xe'));var deskjs=require(_0x1e8f('0xf'));var toCsv=require(_0x1e8f('0x9'));var querystring=require(_0x1e8f('0x10'));var Papa=require(_0x1e8f('0x11'));var Redis=require(_0x1e8f('0x12'));var authService=require(_0x1e8f('0x13'));var qs=require(_0x1e8f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e8f('0x15'))(_0x1e8f('0x16'));var utils=require('../../config/utils');var config=require(_0x1e8f('0x17'));var licenseUtil=require(_0x1e8f('0x18'));var db=require(_0x1e8f('0x19'))['db'];config['redis']=_[_0x1e8f('0x1a')](config[_0x1e8f('0x1b')],{'host':_0x1e8f('0x1c'),'port':0x18eb});var socket=require(_0x1e8f('0x1d'))(new Redis(config[_0x1e8f('0x1b')]));require(_0x1e8f('0x1e'))[_0x1e8f('0x1f')](socket);function respondWithStatusCode(_0x334229,_0x2ae9ba){_0x2ae9ba=_0x2ae9ba||0xcc;return function(_0x4156cd){if(_0x4156cd){return _0x334229[_0x1e8f('0x20')](_0x2ae9ba);}return _0x334229[_0x1e8f('0x21')](_0x2ae9ba)[_0x1e8f('0x22')]();};}function respondWithResult(_0x535f87,_0x2d7f7a){_0x2d7f7a=_0x2d7f7a||0xc8;return function(_0x30ee28){if(_0x30ee28){return _0x535f87[_0x1e8f('0x21')](_0x2d7f7a)[_0x1e8f('0x23')](_0x30ee28);}};}function respondWithFilteredResult(_0x30cba8,_0x5e60c5){return function(_0x34dc99){if(_0x34dc99){var _0x14ada1=_0x34dc99[_0x1e8f('0x24')],_0x206f0c=_0x5e60c5['offset'],_0x43721b=_0x5e60c5[_0x1e8f('0x25')]+_0x5e60c5[_0x1e8f('0x26')],_0x1d4cf1;if(_0x43721b>=_0x14ada1){_0x43721b=_0x14ada1;_0x1d4cf1=0xc8;}else{_0x1d4cf1=0xce;}_0x30cba8[_0x1e8f('0x21')](_0x1d4cf1);return _0x30cba8[_0x1e8f('0x27')](_0x1e8f('0x28'),_0x206f0c+'-'+_0x43721b+'/'+_0x14ada1)['json'](_0x34dc99);}return null;};}function patchUpdates(_0x46ef60){return function(_0x1ba001){try{jsonpatch[_0x1e8f('0x29')](_0x1ba001,_0x46ef60,!![]);}catch(_0x515198){return BPromise[_0x1e8f('0x2a')](_0x515198);}return _0x1ba001[_0x1e8f('0x2b')]();};}function saveUpdates(_0x453728,_0x19cf35){return function(_0x9a4593){if(_0x9a4593){return _0x9a4593['update'](_0x453728)[_0x1e8f('0x2c')](function(_0x2a980b){return _0x2a980b;});}return null;};}function removeEntity(_0x5b0a1b,_0x24c1ff){return function(_0x130a25){if(_0x130a25){return _0x130a25[_0x1e8f('0x2d')]()[_0x1e8f('0x2c')](function(){_0x5b0a1b[_0x1e8f('0x21')](0xcc)[_0x1e8f('0x22')]();});}};}function handleEntityNotFound(_0x35ae96,_0x98d4e3){return function(_0xe916d3){if(!_0xe916d3){_0x35ae96[_0x1e8f('0x20')](0x194);}return _0xe916d3;};}function handleError(_0x47c019,_0x4e983e){_0x4e983e=_0x4e983e||0x1f4;return function(_0x5ed4e9){logger['error'](_0x5ed4e9[_0x1e8f('0x2e')]);if(_0x5ed4e9[_0x1e8f('0x2f')]){delete _0x5ed4e9[_0x1e8f('0x2f')];}_0x47c019[_0x1e8f('0x21')](_0x4e983e)[_0x1e8f('0x30')](_0x5ed4e9);};}exports['sendUserNotification']=function(_0x4762cf,_0xfc6310,_0x4dd889){if(!_0x4762cf[_0x1e8f('0x31')][_0x1e8f('0x32')](_0x1e8f('0x33'))&&!_0x4762cf[_0x1e8f('0x31')]['hasOwnProperty'](_0x1e8f('0x34'))){throw new db[(_0x1e8f('0x35'))][(_0x1e8f('0x36'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x4762cf[_0x1e8f('0x31')][_0x1e8f('0x32')]('TemplateId')&&!_0x4762cf['body']['hasOwnProperty'](_0x1e8f('0x37'))){throw new db[(_0x1e8f('0x35'))][(_0x1e8f('0x36'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x4762cf[_0x1e8f('0x31')][_0x1e8f('0x32')](_0x1e8f('0x38'))){throw new db['Sequelize'][(_0x1e8f('0x36'))](_0x1e8f('0x39'));}else{try{var _0x520168=JSON[_0x1e8f('0x3a')](_0x4762cf[_0x1e8f('0x31')][_0x1e8f('0x38')]);}catch(_0x22545f){logger[_0x1e8f('0x3b')](_0x22545f);throw new db[(_0x1e8f('0x35'))][(_0x1e8f('0x36'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x2816e3=[_0x1e8f('0x3c'),'faxqueue',_0x1e8f('0x3d'),_0x1e8f('0x3e'),_0x1e8f('0x3f'),_0x1e8f('0x40'),'whatsappqueue','team',_0x1e8f('0x41')];if(_['some'](_0x520168,function(_0x1e4bf9){return!_[_0x1e8f('0x42')](_0x2816e3,_0x1e4bf9['model'][_0x1e8f('0x43')]());})){throw new db[(_0x1e8f('0x35'))][(_0x1e8f('0x36'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x46ac74={};_0x46ac74[_0x1e8f('0x44')]=_0x4762cf['body'][_0x1e8f('0x32')](_0x1e8f('0x44'))?_0x4762cf[_0x1e8f('0x31')][_0x1e8f('0x44')]:_0x4762cf[_0x1e8f('0x41')][_0x1e8f('0x45')];_0x46ac74[_0x1e8f('0x46')]=_[_0x1e8f('0x47')](_0x4762cf[_0x1e8f('0x31')]['recipientsDescription'])?null:_0x4762cf[_0x1e8f('0x31')][_0x1e8f('0x46')];_0x46ac74['beep']=_0x4762cf[_0x1e8f('0x31')][_0x1e8f('0x48')]||![];_0x46ac74[_0x1e8f('0x49')]=_0x4762cf['user']['id'];return getContent(_0x4762cf[_0x1e8f('0x31')])['then'](function(_0x41e6bb){_0x46ac74[_0x1e8f('0x31')]=_0x41e6bb;return getRecipients(_0x520168);})[_0x1e8f('0x2c')](function(_0x474945){_0x46ac74[_0x1e8f('0x4a')]=_[_0x1e8f('0x4b')](_0x474945)[_0x1e8f('0x4c')](',');return db[_0x1e8f('0x4d')]['transaction'](function(_0x2eee3b){return db['UserNotification']['create'](_0x46ac74,{'raw':!![],'transaction':_0x2eee3b})['then'](function(_0x1f0ff7){var _0x4ffc7a={'sender':_0x46ac74['senderName'],'description':_0x46ac74[_0x1e8f('0x46')],'content':_0x46ac74[_0x1e8f('0x31')],'beep':_0x46ac74[_0x1e8f('0x48')]};_0x474945[_0x1e8f('0x4e')](function(_0x3e290c){_0x4ffc7a['recipient']=_0x3e290c;socket[_0x1e8f('0x4f')](_0x1e8f('0x50'),_0x4ffc7a);});return _0x1f0ff7;});});})[_0x1e8f('0x2c')](respondWithResult(_0xfc6310,0xc9))['catch'](handleError(_0xfc6310,null));};function getContent(_0x1fb066){return new BPromise(function(_0x2c727e,_0x1ccde4){if(_0x1fb066['text']){_0x2c727e(_0x1fb066[_0x1e8f('0x33')]);return;}return db[_0x1e8f('0x51')]['findOne']({'attributes':[_0x1e8f('0x52')],'where':{'id':_0x1fb066[_0x1e8f('0x34')]},'raw':!![]})[_0x1e8f('0x2c')](function(_0x59f846){if(!_0x59f846)throw new db[(_0x1e8f('0x35'))][(_0x1e8f('0x36'))](_0x1e8f('0x53'));var _0x3097ee=Mustache['render'](_0x59f846['html'],_0x1fb066[_0x1e8f('0x37')]);_0x2c727e(_0x3097ee);})['catch'](function(_0x133448){_0x1ccde4(_0x133448);});});}function getRecipients(_0xbcd110){return new BPromise(function(_0x55af75,_0x33aa67){var _0x4ce8ed=[];var _0x1fe87e=[];_0xbcd110[_0x1e8f('0x4e')](function(_0x334860){var _0x2f3f64=_[_0x1e8f('0x54')](_0x334860[_0x1e8f('0x55')][_0x1e8f('0x43')]());if(_0x2f3f64==='User'){_0x4ce8ed=_['union'](_0x4ce8ed,_0x334860[_0x1e8f('0x56')]);}else{if(_[_0x1e8f('0x42')](_0x2f3f64,'queue'))_0x2f3f64=_0x2f3f64['replace']('queue',_0x1e8f('0x57'));_0x334860[_0x1e8f('0x56')]['forEach'](function(_0x20a41b){_0x1fe87e[_0x1e8f('0x58')](getAgents(_0x2f3f64,_0x20a41b));});}});return BPromise[_0x1e8f('0x59')](_0x1fe87e)[_0x1e8f('0x2c')](function(_0x4f497b){_0x4ce8ed=_[_0x1e8f('0x5a')](_0x4ce8ed,_[_0x1e8f('0x5b')](_0x4f497b));_0x55af75(_0x4ce8ed);})[_0x1e8f('0x5c')](function(_0x136283){_0x33aa67(_0x136283);});});}function getAgents(_0x21afb2,_0x1eb203){return new BPromise(function(_0x595dd9,_0xb1c1c9){return db[_0x21afb2]['findOne']({'where':{'id':_0x1eb203}})[_0x1e8f('0x2c')](function(_0x1148e4){return _0x1148e4[_0x1e8f('0x5d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x13f6ea){var _0xe04687=_[_0x1e8f('0x5e')](_0x13f6ea,'id');_0x595dd9(_0xe04687);});})[_0x1e8f('0x5c')](function(_0x26bcad){_0xb1c1c9(_0x26bcad);});});} \ No newline at end of file +var _0xec5b=['emit','Template','findOne','html','render','view','catch','User','union','ids','queue','replace','Queue','push','flatten','getAgents','map','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','offset','limit','set','reject','update','then','error','stack','name','send','sendUserNotification','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','smsqueue','voicequeue','team','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','forEach','recipient'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xec5b,0x137));var _0xbec5=function(_0x411d66,_0x418a17){_0x411d66=_0x411d66-0x0;var _0x273da0=_0xec5b[_0x411d66];return _0x273da0;};'use strict';var pdf=require(_0xbec5('0x0'));var emlformat=require(_0xbec5('0x1'));var rimraf=require(_0xbec5('0x2'));var zipdir=require(_0xbec5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbec5('0x4'));var moment=require(_0xbec5('0x5'));var BPromise=require(_0xbec5('0x6'));var Mustache=require(_0xbec5('0x7'));var util=require(_0xbec5('0x8'));var path=require(_0xbec5('0x9'));var sox=require(_0xbec5('0xa'));var csv=require(_0xbec5('0xb'));var ejs=require(_0xbec5('0xc'));var fs=require('fs');var fs_extra=require(_0xbec5('0xd'));var _=require(_0xbec5('0xe'));var squel=require('squel');var crypto=require(_0xbec5('0xf'));var jsforce=require(_0xbec5('0x10'));var deskjs=require(_0xbec5('0x11'));var toCsv=require(_0xbec5('0xb'));var querystring=require('querystring');var Papa=require(_0xbec5('0x12'));var Redis=require(_0xbec5('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xbec5('0x14'));var as=require(_0xbec5('0x15'));var hardwareService=require(_0xbec5('0x16'));var logger=require(_0xbec5('0x17'))('api');var utils=require(_0xbec5('0x18'));var config=require(_0xbec5('0x19'));var licenseUtil=require(_0xbec5('0x1a'));var db=require(_0xbec5('0x1b'))['db'];config[_0xbec5('0x1c')]=_[_0xbec5('0x1d')](config[_0xbec5('0x1c')],{'host':_0xbec5('0x1e'),'port':0x18eb});var socket=require(_0xbec5('0x1f'))(new Redis(config[_0xbec5('0x1c')]));require(_0xbec5('0x20'))[_0xbec5('0x21')](socket);function respondWithStatusCode(_0x128004,_0x43eef0){_0x43eef0=_0x43eef0||0xcc;return function(_0x575e83){if(_0x575e83){return _0x128004[_0xbec5('0x22')](_0x43eef0);}return _0x128004[_0xbec5('0x23')](_0x43eef0)[_0xbec5('0x24')]();};}function respondWithResult(_0x2f7ca6,_0x2eae18){_0x2eae18=_0x2eae18||0xc8;return function(_0xb832ac){if(_0xb832ac){return _0x2f7ca6[_0xbec5('0x23')](_0x2eae18)[_0xbec5('0x25')](_0xb832ac);}};}function respondWithFilteredResult(_0x126ea1,_0x47ebac){return function(_0x5c63e2){if(_0x5c63e2){var _0x573d18=_0x5c63e2['count'],_0x159985=_0x47ebac['offset'],_0x414e8b=_0x47ebac[_0xbec5('0x26')]+_0x47ebac[_0xbec5('0x27')],_0x113263;if(_0x414e8b>=_0x573d18){_0x414e8b=_0x573d18;_0x113263=0xc8;}else{_0x113263=0xce;}_0x126ea1['status'](_0x113263);return _0x126ea1[_0xbec5('0x28')]('Content-Range',_0x159985+'-'+_0x414e8b+'/'+_0x573d18)[_0xbec5('0x25')](_0x5c63e2);}return null;};}function patchUpdates(_0x5439eb){return function(_0x22686f){try{jsonpatch['apply'](_0x22686f,_0x5439eb,!![]);}catch(_0x310345){return BPromise[_0xbec5('0x29')](_0x310345);}return _0x22686f['save']();};}function saveUpdates(_0x1f1d12,_0x166e07){return function(_0x2c18ba){if(_0x2c18ba){return _0x2c18ba[_0xbec5('0x2a')](_0x1f1d12)[_0xbec5('0x2b')](function(_0x59ca98){return _0x59ca98;});}return null;};}function removeEntity(_0x5e5da5,_0x1a605a){return function(_0x1d61e1){if(_0x1d61e1){return _0x1d61e1['destroy']()[_0xbec5('0x2b')](function(){_0x5e5da5[_0xbec5('0x23')](0xcc)[_0xbec5('0x24')]();});}};}function handleEntityNotFound(_0x47afd5,_0x20d8b4){return function(_0x1f2545){if(!_0x1f2545){_0x47afd5[_0xbec5('0x22')](0x194);}return _0x1f2545;};}function handleError(_0x26dbd8,_0x25fbcd){_0x25fbcd=_0x25fbcd||0x1f4;return function(_0x51d2a1){logger[_0xbec5('0x2c')](_0x51d2a1[_0xbec5('0x2d')]);if(_0x51d2a1[_0xbec5('0x2e')]){delete _0x51d2a1[_0xbec5('0x2e')];}_0x26dbd8[_0xbec5('0x23')](_0x25fbcd)[_0xbec5('0x2f')](_0x51d2a1);};}exports[_0xbec5('0x30')]=function(_0x173682,_0x2fb6b7,_0x12b22a){if(!_0x173682['body'][_0xbec5('0x31')](_0xbec5('0x32'))&&!_0x173682[_0xbec5('0x33')][_0xbec5('0x31')](_0xbec5('0x34'))){throw new db[(_0xbec5('0x35'))][(_0xbec5('0x36'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x173682['body'][_0xbec5('0x31')](_0xbec5('0x34'))&&!_0x173682['body'][_0xbec5('0x31')]('view')){throw new db[(_0xbec5('0x35'))][(_0xbec5('0x36'))](_0xbec5('0x37'));}if(!_0x173682[_0xbec5('0x33')]['hasOwnProperty'](_0xbec5('0x38'))){throw new db[(_0xbec5('0x35'))][(_0xbec5('0x36'))](_0xbec5('0x39'));}else{try{var _0x15c18b=JSON[_0xbec5('0x3a')](_0x173682['body'][_0xbec5('0x38')]);}catch(_0x40b745){logger['error'](_0x40b745);throw new db[(_0xbec5('0x35'))][(_0xbec5('0x36'))](_0xbec5('0x3b'));}var _0x66afe5=['chatqueue','faxqueue','mailqueue','openchannelqueue',_0xbec5('0x3c'),_0xbec5('0x3d'),'whatsappqueue',_0xbec5('0x3e'),'user'];if(_[_0xbec5('0x3f')](_0x15c18b,function(_0x340c7e){return!_['includes'](_0x66afe5,_0x340c7e[_0xbec5('0x40')][_0xbec5('0x41')]());})){throw new db['Sequelize']['ValidationError'](_0xbec5('0x42'));}}}var _0x31dca5={};_0x31dca5[_0xbec5('0x43')]=_0x173682[_0xbec5('0x33')][_0xbec5('0x31')](_0xbec5('0x43'))?_0x173682[_0xbec5('0x33')][_0xbec5('0x43')]:_0x173682[_0xbec5('0x44')]['fullname'];_0x31dca5[_0xbec5('0x45')]=_[_0xbec5('0x46')](_0x173682[_0xbec5('0x33')][_0xbec5('0x45')])?null:_0x173682['body']['recipientsDescription'];_0x31dca5[_0xbec5('0x47')]=_0x173682[_0xbec5('0x33')][_0xbec5('0x47')]||![];_0x31dca5[_0xbec5('0x48')]=_0x173682[_0xbec5('0x44')]['id'];return getContent(_0x173682[_0xbec5('0x33')])['then'](function(_0x4c0b46){_0x31dca5[_0xbec5('0x33')]=_0x4c0b46;return getRecipients(_0x15c18b);})['then'](function(_0x41ced0){_0x31dca5[_0xbec5('0x49')]=_[_0xbec5('0x4a')](_0x41ced0)[_0xbec5('0x4b')](',');return db[_0xbec5('0x4c')][_0xbec5('0x4d')](function(_0x36f777){return db[_0xbec5('0x4e')]['create'](_0x31dca5,{'raw':!![],'transaction':_0x36f777})[_0xbec5('0x2b')](function(_0xa9bc08){var _0x3a2eb4={'sender':_0x31dca5[_0xbec5('0x43')],'description':_0x31dca5[_0xbec5('0x45')],'content':_0x31dca5['body'],'beep':_0x31dca5['beep']};_0x41ced0[_0xbec5('0x4f')](function(_0x58ea5e){_0x3a2eb4[_0xbec5('0x50')]=_0x58ea5e;socket[_0xbec5('0x51')]('userNotification:send',_0x3a2eb4);});return _0xa9bc08;});});})[_0xbec5('0x2b')](respondWithResult(_0x2fb6b7,0xc9))['catch'](handleError(_0x2fb6b7,null));};function getContent(_0x430e6e){return new BPromise(function(_0x43586c,_0x4dc5ff){if(_0x430e6e[_0xbec5('0x32')]){_0x43586c(_0x430e6e[_0xbec5('0x32')]);return;}return db[_0xbec5('0x52')][_0xbec5('0x53')]({'attributes':[_0xbec5('0x54')],'where':{'id':_0x430e6e[_0xbec5('0x34')]},'raw':!![]})[_0xbec5('0x2b')](function(_0x308e2d){if(!_0x308e2d)throw new db['Sequelize']['ValidationError']('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x3e5ea9=Mustache[_0xbec5('0x55')](_0x308e2d['html'],_0x430e6e[_0xbec5('0x56')]);_0x43586c(_0x3e5ea9);})[_0xbec5('0x57')](function(_0x4e9bbc){_0x4dc5ff(_0x4e9bbc);});});}function getRecipients(_0x100c6a){return new BPromise(function(_0x1eccd6,_0x58a4fd){var _0x22e209=[];var _0x4d98e3=[];_0x100c6a[_0xbec5('0x4f')](function(_0x269e9f){var _0x519ab7=_['startCase'](_0x269e9f['model'][_0xbec5('0x41')]());if(_0x519ab7===_0xbec5('0x58')){_0x22e209=_[_0xbec5('0x59')](_0x22e209,_0x269e9f[_0xbec5('0x5a')]);}else{if(_['includes'](_0x519ab7,_0xbec5('0x5b')))_0x519ab7=_0x519ab7[_0xbec5('0x5c')](_0xbec5('0x5b'),_0xbec5('0x5d'));_0x269e9f[_0xbec5('0x5a')]['forEach'](function(_0x44622d){_0x4d98e3[_0xbec5('0x5e')](getAgents(_0x519ab7,_0x44622d));});}});return BPromise['all'](_0x4d98e3)[_0xbec5('0x2b')](function(_0x17f736){_0x22e209=_[_0xbec5('0x59')](_0x22e209,_[_0xbec5('0x5f')](_0x17f736));_0x1eccd6(_0x22e209);})['catch'](function(_0x5f043b){_0x58a4fd(_0x5f043b);});});}function getAgents(_0x216bf3,_0x756335){return new BPromise(function(_0x3e6e1b,_0x215f9a){return db[_0x216bf3][_0xbec5('0x53')]({'where':{'id':_0x756335}})[_0xbec5('0x2b')](function(_0x106525){return _0x106525[_0xbec5('0x60')]({'attributes':['id'],'raw':!![]})[_0xbec5('0x2b')](function(_0x3c202c){var _0x1df2bd=_[_0xbec5('0x61')](_0x3c202c,'id');_0x3e6e1b(_0x1df2bd);});})[_0xbec5('0x57')](function(_0x122ddd){_0x215f9a(_0x122ddd);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index ef5aa5a..0f2f72c 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 _0xee14=['hook','exports','UserNotification','setMaxListeners','save','update','remove','emit'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xee14,0x13a));var _0x4ee1=function(_0x2c3442,_0x28849b){_0x2c3442=_0x2c3442-0x0;var _0x2fc42b=_0xee14[_0x2c3442];return _0x2fc42b;};'use strict';var EventEmitter=require('events');var UserNotification=require('../../mysqldb')['db'][_0x4ee1('0x0')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x4ee1('0x1')](0x0);var events={'afterCreate':_0x4ee1('0x2'),'afterUpdate':_0x4ee1('0x3'),'afterDestroy':_0x4ee1('0x4')};function emitEvent(_0x236ccd){return function(_0x34a0ae,_0x1e5fb6,_0x3ccbc6){UserNotificationEvents['emit'](_0x236ccd+':'+_0x34a0ae['id'],_0x34a0ae);UserNotificationEvents[_0x4ee1('0x5')](_0x236ccd,_0x34a0ae);_0x3ccbc6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x4ee1('0x6')](e,emitEvent(event));}}module[_0x4ee1('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserNotification','setMaxListeners'];(function(_0x33a01d,_0x44a200){var _0x19df5c=function(_0x36abed){while(--_0x36abed){_0x33a01d['push'](_0x33a01d['shift']());}};_0x19df5c(++_0x44a200);}(_0x008c,0x188));var _0xc008=function(_0x43b4b5,_0x3efc1b){_0x43b4b5=_0x43b4b5-0x0;var _0x2df432=_0x008c[_0x43b4b5];return _0x2df432;};'use strict';var EventEmitter=require(_0xc008('0x0'));var UserNotification=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){UserNotificationEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);UserNotificationEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];UserNotification[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 1b9ceb6..f77f6a4 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 _0x68a5=['../../config/logger','api','bluebird','request-promise','path','rimraf','./userNotification.attributes','define','UserNotification','utf8mb4','lodash'];(function(_0x188775,_0xedeb16){var _0x4ebc74=function(_0x3c40ca){while(--_0x3c40ca){_0x188775['push'](_0x188775['shift']());}};_0x4ebc74(++_0xedeb16);}(_0x68a5,0xfc));var _0x568a=function(_0x5f0eb9,_0x34711f){_0x5f0eb9=_0x5f0eb9-0x0;var _0x34991b=_0x68a5[_0x5f0eb9];return _0x34991b;};'use strict';var _=require(_0x568a('0x0'));var util=require('util');var logger=require(_0x568a('0x1'))(_0x568a('0x2'));var moment=require('moment');var BPromise=require(_0x568a('0x3'));var rp=require(_0x568a('0x4'));var fs=require('fs');var path=require(_0x568a('0x5'));var rimraf=require(_0x568a('0x6'));var config=require('../../config/environment');var attributes=require(_0x568a('0x7'));module['exports']=function(_0x26db0e,_0x467a4f){return _0x26db0e[_0x568a('0x8')](_0x568a('0x9'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x568a('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa1aa=['utf8mb4','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','UserNotification'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa1aa,0x19b));var _0xaa1a=function(_0x3dd62d,_0x1b8677){_0x3dd62d=_0x3dd62d-0x0;var _0x6e44ec=_0xa1aa[_0x3dd62d];return _0x6e44ec;};'use strict';var _=require('lodash');var util=require(_0xaa1a('0x0'));var logger=require(_0xaa1a('0x1'))(_0xaa1a('0x2'));var moment=require(_0xaa1a('0x3'));var BPromise=require(_0xaa1a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaa1a('0x5'));var config=require(_0xaa1a('0x6'));var attributes=require('./userNotification.attributes');module[_0xaa1a('0x7')]=function(_0x370a4e,_0x243c15){return _0x370a4e['define'](_0xaa1a('0x8'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xaa1a('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index cc89313..33849e8 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 _0x2fe4=['redis','socket.io-emitter','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','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2fe4,0x1c0));var _0x42fe=function(_0x56732b,_0x3b65f2){_0x56732b=_0x56732b-0x0;var _0x3f4b3a=_0x2fe4[_0x56732b];return _0x3f4b3a;};'use strict';var _=require(_0x42fe('0x0'));var util=require(_0x42fe('0x1'));var moment=require(_0x42fe('0x2'));var BPromise=require(_0x42fe('0x3'));var rs=require(_0x42fe('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x42fe('0x5'))['db'];var utils=require(_0x42fe('0x6'));var logger=require(_0x42fe('0x7'))(_0x42fe('0x8'));var config=require(_0x42fe('0x9'));var jayson=require(_0x42fe('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x42fe('0xb')]=_['defaults'](config[_0x42fe('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x42fe('0xc'))(new Redis(config['redis']));require('./userNotification.socket')[_0x42fe('0xd')](socket);function respondWithRpcPromise(_0x58c253,_0x462326,_0xa0ef69){return new BPromise(function(_0x57df29,_0x1282f6){return client[_0x42fe('0xe')](_0x58c253,_0xa0ef69)[_0x42fe('0xf')](function(_0x2775e3){logger[_0x42fe('0x10')](_0x42fe('0x11'),_0x462326,'request\x20sent');logger[_0x42fe('0x12')](_0x42fe('0x13'),_0x462326,_0x42fe('0x14'),JSON[_0x42fe('0x15')](_0x2775e3));if(_0x2775e3[_0x42fe('0x16')]){if(_0x2775e3[_0x42fe('0x16')][_0x42fe('0x17')]===0x1f4){logger[_0x42fe('0x16')]('UserNotification,\x20%s,\x20%s',_0x462326,_0x2775e3['error'][_0x42fe('0x18')]);return _0x1282f6(_0x2775e3[_0x42fe('0x16')][_0x42fe('0x18')]);}logger[_0x42fe('0x16')](_0x42fe('0x11'),_0x462326,_0x2775e3[_0x42fe('0x16')][_0x42fe('0x18')]);return _0x57df29(_0x2775e3[_0x42fe('0x16')][_0x42fe('0x18')]);}else{logger[_0x42fe('0x10')](_0x42fe('0x11'),_0x462326,_0x42fe('0x14'));_0x57df29(_0x2775e3[_0x42fe('0x19')][_0x42fe('0x18')]);}})[_0x42fe('0x1a')](function(_0x3f472e){logger[_0x42fe('0x16')]('UserNotification,\x20%s,\x20%s',_0x462326,_0x3f472e);_0x1282f6(_0x3f472e);});});} \ No newline at end of file +var _0x6be9=['client','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x26ab98,_0x540333){var _0x50d0a4=function(_0x4c21b7){while(--_0x4c21b7){_0x26ab98['push'](_0x26ab98['shift']());}};_0x50d0a4(++_0x540333);}(_0x6be9,0x1ec));var _0x96be=function(_0x2a22c6,_0x1b18bb){_0x2a22c6=_0x2a22c6-0x0;var _0x56162d=_0x6be9[_0x2a22c6];return _0x56162d;};'use strict';var _=require(_0x96be('0x0'));var util=require(_0x96be('0x1'));var moment=require('moment');var BPromise=require(_0x96be('0x2'));var rs=require(_0x96be('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x96be('0x4'));var logger=require(_0x96be('0x5'))('rpc');var config=require(_0x96be('0x6'));var jayson=require(_0x96be('0x7'));var client=jayson[_0x96be('0x8')]['http']({'port':0x232a});config['redis']=_[_0x96be('0x9')](config[_0x96be('0xa')],{'host':_0x96be('0xb'),'port':0x18eb});var socket=require(_0x96be('0xc'))(new Redis(config['redis']));require(_0x96be('0xd'))['register'](socket);function respondWithRpcPromise(_0x543082,_0x42c4b2,_0x43b3d4){return new BPromise(function(_0x14b3ba,_0x3d3e2d){return client[_0x96be('0xe')](_0x543082,_0x43b3d4)[_0x96be('0xf')](function(_0x1b685b){logger[_0x96be('0x10')](_0x96be('0x11'),_0x42c4b2,_0x96be('0x12'));logger['debug'](_0x96be('0x13'),_0x42c4b2,'request\x20sent',JSON[_0x96be('0x14')](_0x1b685b));if(_0x1b685b[_0x96be('0x15')]){if(_0x1b685b[_0x96be('0x15')][_0x96be('0x16')]===0x1f4){logger[_0x96be('0x15')]('UserNotification,\x20%s,\x20%s',_0x42c4b2,_0x1b685b[_0x96be('0x15')][_0x96be('0x17')]);return _0x3d3e2d(_0x1b685b[_0x96be('0x15')][_0x96be('0x17')]);}logger['error'](_0x96be('0x11'),_0x42c4b2,_0x1b685b[_0x96be('0x15')][_0x96be('0x17')]);return _0x14b3ba(_0x1b685b[_0x96be('0x15')]['message']);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x42c4b2,_0x96be('0x12'));_0x14b3ba(_0x1b685b['result'][_0x96be('0x17')]);}})[_0x96be('0x18')](function(_0x5d350a){logger[_0x96be('0x15')](_0x96be('0x11'),_0x42c4b2,_0x5d350a);_0x3d3e2d(_0x5d350a);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index cb49c6a..0730c1a 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 _0xaf79=['removeListener','register','length','userNotification:','save','remove','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf79,0x82));var _0x9af7=function(_0x5434b9,_0xade01c){_0x5434b9=_0x5434b9-0x0;var _0x4adbce=_0xaf79[_0x5434b9];return _0x4adbce;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x9af7('0x0'),_0x9af7('0x1'),_0x9af7('0x2')];function createListener(_0x19a247,_0x28627c){return function(_0x216de5){_0x28627c['emit'](_0x19a247,_0x216de5);};}function removeListener(_0x6e8099,_0xfa2a43){return function(){UserNotificationEvents[_0x9af7('0x3')](_0x6e8099,_0xfa2a43);};}exports[_0x9af7('0x4')]=function(_0x52cd01){for(var _0x577aeb=0x0,_0xbe8dda=events[_0x9af7('0x5')];_0x577aeb<_0xbe8dda;_0x577aeb++){var _0x14da14=events[_0x577aeb];var _0x217a38=createListener(_0x9af7('0x6')+_0x14da14,_0x52cd01);UserNotificationEvents['on'](_0x14da14,_0x217a38);}}; \ No newline at end of file +var _0x77f7=['update','emit','register','length','userNotification:','./userNotification.events','save','remove'];(function(_0x5d14c3,_0x2437f2){var _0x26fc55=function(_0x1e35ba){while(--_0x1e35ba){_0x5d14c3['push'](_0x5d14c3['shift']());}};_0x26fc55(++_0x2437f2);}(_0x77f7,0xbd));var _0x777f=function(_0x1494a0,_0xc46cf8){_0x1494a0=_0x1494a0-0x0;var _0x2627d9=_0x77f7[_0x1494a0];return _0x2627d9;};'use strict';var UserNotificationEvents=require(_0x777f('0x0'));var events=[_0x777f('0x1'),_0x777f('0x2'),_0x777f('0x3')];function createListener(_0x1f8adc,_0xcd0b99){return function(_0x1f15bf){_0xcd0b99[_0x777f('0x4')](_0x1f8adc,_0x1f15bf);};}function removeListener(_0x1f783b,_0x5a26ca){return function(){UserNotificationEvents['removeListener'](_0x1f783b,_0x5a26ca);};}exports[_0x777f('0x5')]=function(_0x188bf1){for(var _0x186afb=0x0,_0x16642d=events[_0x777f('0x6')];_0x186afb<_0x16642d;_0x186afb++){var _0x5bf11d=events[_0x186afb];var _0x12bff6=createListener(_0x777f('0x7')+_0x5bf11d,_0x188bf1);UserNotificationEvents['on'](_0x5bf11d,_0x12bff6);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 250a82a..fe4bdf8 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 _0xcecc=['multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1c36fb,_0x8acb0f){var _0x42f8a6=function(_0x1a8460){while(--_0x1a8460){_0x1c36fb['push'](_0x1c36fb['shift']());}};_0x42f8a6(++_0x8acb0f);}(_0xcecc,0x186));var _0xccec=function(_0x626293,_0x22f2d2){_0x626293=_0x626293-0x0;var _0x5aa0a1=_0xcecc[_0x626293];return _0x5aa0a1;};'use strict';var multer=require(_0xccec('0x0'));var util=require('util');var path=require(_0xccec('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xccec('0x2')]();var fs_extra=require(_0xccec('0x3'));var auth=require(_0xccec('0x4'));var interaction=require(_0xccec('0x5'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0xfbb4=['fs-extra','../../components/auth/service','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1481d2,_0x2c97b0){var _0xeaa21f=function(_0x3fe4c2){while(--_0x3fe4c2){_0x1481d2['push'](_0x1481d2['shift']());}};_0xeaa21f(++_0x2c97b0);}(_0xfbb4,0x186));var _0x4fbb=function(_0xbd8547,_0x2e0fd2){_0xbd8547=_0xbd8547-0x0;var _0x2cc550=_0xfbb4[_0xbd8547];return _0x2cc550;};'use strict';var multer=require(_0x4fbb('0x0'));var util=require(_0x4fbb('0x1'));var path=require(_0x4fbb('0x2'));var timeout=require(_0x4fbb('0x3'));var express=require(_0x4fbb('0x4'));var router=express[_0x4fbb('0x5')]();var fs_extra=require(_0x4fbb('0x6'));var auth=require(_0x4fbb('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x4fbb('0x8')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index c2a572f..c8e2f3e 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 _0xd8b0=['exports','sequelize'];(function(_0x19a4ae,_0x21054a){var _0x13b6c3=function(_0x4e3294){while(--_0x4e3294){_0x19a4ae['push'](_0x19a4ae['shift']());}};_0x13b6c3(++_0x21054a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x1fb4a0,_0x48a602){var _0x1094e7=function(_0x25fcd5){while(--_0x25fcd5){_0x1fb4a0['push'](_0x1fb4a0['shift']());}};_0x1094e7(++_0x48a602);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 1d9bd45..a0ac535 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 _0x7470=['user_has_openchannel_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue'];(function(_0x3020d5,_0x496039){var _0x4f1828=function(_0x2664a9){while(--_0x2664a9){_0x3020d5['push'](_0x3020d5['shift']());}};_0x4f1828(++_0x496039);}(_0x7470,0xb7));var _0x0747=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x7470[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0x0747('0x0'));var util=require(_0x0747('0x1'));var logger=require(_0x0747('0x2'))(_0x0747('0x3'));var moment=require('moment');var BPromise=require(_0x0747('0x4'));var rp=require(_0x0747('0x5'));var fs=require('fs');var path=require(_0x0747('0x6'));var rimraf=require(_0x0747('0x7'));var config=require(_0x0747('0x8'));var attributes=require(_0x0747('0x9'));module['exports']=function(_0x416216,_0x5079a5){return _0x416216[_0x0747('0xa')](_0x0747('0xb'),attributes,{'tableName':_0x0747('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9431=['./userOpenchannelQueue.attributes','define','lodash','util','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x48dca8,_0x59b0c9){var _0x595683=function(_0x3ff8d2){while(--_0x3ff8d2){_0x48dca8['push'](_0x48dca8['shift']());}};_0x595683(++_0x59b0c9);}(_0x9431,0xd1));var _0x1943=function(_0x361116,_0x389b79){_0x361116=_0x361116-0x0;var _0x412b65=_0x9431[_0x361116];return _0x412b65;};'use strict';var _=require(_0x1943('0x0'));var util=require(_0x1943('0x1'));var logger=require('../../config/logger')(_0x1943('0x2'));var moment=require(_0x1943('0x3'));var BPromise=require(_0x1943('0x4'));var rp=require(_0x1943('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1943('0x6'));var attributes=require(_0x1943('0x7'));module['exports']=function(_0x264963,_0x1184d3){return _0x264963[_0x1943('0x8')]('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','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 d03db34..0d5137e 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 _0xcf39=['catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x13eec2,_0xe78b42){var _0x46c367=function(_0x3f399a){while(--_0x3f399a){_0x13eec2['push'](_0x13eec2['shift']());}};_0x46c367(++_0xe78b42);}(_0xcf39,0xdd));var _0x9cf3=function(_0x13f7fe,_0x694584){_0x13f7fe=_0x13f7fe-0x0;var _0x662449=_0xcf39[_0x13f7fe];return _0x662449;};'use strict';var _=require('lodash');var util=require(_0x9cf3('0x0'));var moment=require(_0x9cf3('0x1'));var BPromise=require(_0x9cf3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9cf3('0x3'));var db=require(_0x9cf3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9cf3('0x5'))('rpc');var config=require(_0x9cf3('0x6'));var jayson=require(_0x9cf3('0x7'));var client=jayson[_0x9cf3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4064c6,_0x3b265e,_0x459d50){return new BPromise(function(_0x4a7025,_0x4c0930){return client[_0x9cf3('0x9')](_0x4064c6,_0x459d50)[_0x9cf3('0xa')](function(_0x178c26){logger[_0x9cf3('0xb')](_0x9cf3('0xc'),_0x3b265e,_0x9cf3('0xd'));logger[_0x9cf3('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x3b265e,_0x9cf3('0xd'),JSON[_0x9cf3('0xf')](_0x178c26));if(_0x178c26[_0x9cf3('0x10')]){if(_0x178c26[_0x9cf3('0x10')][_0x9cf3('0x11')]===0x1f4){logger[_0x9cf3('0x10')](_0x9cf3('0xc'),_0x3b265e,_0x178c26['error'][_0x9cf3('0x12')]);return _0x4c0930(_0x178c26[_0x9cf3('0x10')][_0x9cf3('0x12')]);}logger['error'](_0x9cf3('0xc'),_0x3b265e,_0x178c26[_0x9cf3('0x10')][_0x9cf3('0x12')]);return _0x4a7025(_0x178c26[_0x9cf3('0x10')][_0x9cf3('0x12')]);}else{logger[_0x9cf3('0xb')](_0x9cf3('0xc'),_0x3b265e,'request\x20sent');_0x4a7025(_0x178c26['result'][_0x9cf3('0x12')]);}})[_0x9cf3('0x13')](function(_0x2d82bd){logger[_0x9cf3('0x10')](_0x9cf3('0xc'),_0x3b265e,_0x2d82bd);_0x4c0930(_0x2d82bd);});});} \ No newline at end of file +var _0x723e=['debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x54e9a4,_0xe64888){var _0x55decf=function(_0x729265){while(--_0x729265){_0x54e9a4['push'](_0x54e9a4['shift']());}};_0x55decf(++_0xe64888);}(_0x723e,0xf7));var _0xe723=function(_0x4a4ff6,_0x2b0de3){_0x4a4ff6=_0x4a4ff6-0x0;var _0x55e8de=_0x723e[_0x4a4ff6];return _0x55e8de;};'use strict';var _=require('lodash');var util=require(_0xe723('0x0'));var moment=require(_0xe723('0x1'));var BPromise=require(_0xe723('0x2'));var rs=require(_0xe723('0x3'));var fs=require('fs');var Redis=require(_0xe723('0x4'));var db=require(_0xe723('0x5'))['db'];var utils=require(_0xe723('0x6'));var logger=require('../../config/logger')(_0xe723('0x7'));var config=require(_0xe723('0x8'));var jayson=require(_0xe723('0x9'));var client=jayson[_0xe723('0xa')][_0xe723('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2005d8,_0xd3e33a,_0x1ef316){return new BPromise(function(_0x4c2560,_0x176988){return client[_0xe723('0xc')](_0x2005d8,_0x1ef316)[_0xe723('0xd')](function(_0x10bd1e){logger[_0xe723('0xe')](_0xe723('0xf'),_0xd3e33a,_0xe723('0x10'));logger[_0xe723('0x11')](_0xe723('0x12'),_0xd3e33a,_0xe723('0x10'),JSON[_0xe723('0x13')](_0x10bd1e));if(_0x10bd1e['error']){if(_0x10bd1e[_0xe723('0x14')][_0xe723('0x15')]===0x1f4){logger[_0xe723('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0xd3e33a,_0x10bd1e[_0xe723('0x14')][_0xe723('0x16')]);return _0x176988(_0x10bd1e[_0xe723('0x14')][_0xe723('0x16')]);}logger[_0xe723('0x14')](_0xe723('0xf'),_0xd3e33a,_0x10bd1e[_0xe723('0x14')][_0xe723('0x16')]);return _0x4c2560(_0x10bd1e[_0xe723('0x14')][_0xe723('0x16')]);}else{logger[_0xe723('0xe')](_0xe723('0xf'),_0xd3e33a,'request\x20sent');_0x4c2560(_0x10bd1e['result']['message']);}})[_0xe723('0x17')](function(_0x1d9bc2){logger['error'](_0xe723('0xf'),_0xd3e33a,_0x1d9bc2);_0x176988(_0x1d9bc2);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index d84720d..e653f19 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 _0x7a54=['./userProfile.controller','get','index','/describe','isAuthenticated','/:id/sections','getSections','getResources','post','create','/:id/clone','clone','addSections','/:id/resources','put','/:id','update','delete','destroy','removeSections','removeResources','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7a54,0x106));var _0x47a5=function(_0x26d635,_0x27a99e){_0x26d635=_0x26d635-0x0;var _0xda5767=_0x7a54[_0x26d635];return _0xda5767;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/resources',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x10')](_0x47a5('0x12'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x10')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x14')]);router[_0x47a5('0x10')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['addResources']);router[_0x47a5('0x16')](_0x47a5('0x17'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x18')]);router[_0x47a5('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0x1a')]);router['delete']('/:id/sections',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x19')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);module[_0x47a5('0x1d')]=router; \ No newline at end of file +var _0x7a54=['./userProfile.controller','get','index','/describe','isAuthenticated','/:id/sections','getSections','getResources','post','create','/:id/clone','clone','addSections','/:id/resources','put','/:id','update','delete','destroy','removeSections','removeResources','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7a54,0x106));var _0x47a5=function(_0x4c6c3f,_0x45b36e){_0x4c6c3f=_0x4c6c3f-0x0;var _0x35fa1c=_0x7a54[_0x4c6c3f];return _0x35fa1c;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/resources',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x10')](_0x47a5('0x12'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x10')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x14')]);router[_0x47a5('0x10')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['addResources']);router[_0x47a5('0x16')](_0x47a5('0x17'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x18')]);router[_0x47a5('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0x1a')]);router['delete']('/:id/sections',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x19')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);module[_0x47a5('0x1d')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 9885c62..0a1bd69 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 _0x4458=['setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports','STRING','name'];(function(_0x207140,_0x4c6556){var _0x39e8cf=function(_0x16b730){while(--_0x16b730){_0x207140['push'](_0x207140['shift']());}};_0x39e8cf(++_0x4c6556);}(_0x4458,0xe6));var _0x8445=function(_0xcb3e33,_0xafcc3c){_0xcb3e33=_0xcb3e33-0x0;var _0x14622d=_0x4458[_0xcb3e33];return _0x14622d;};'use strict';var Sequelize=require(_0x8445('0x0'));module[_0x8445('0x1')]={'name':{'type':Sequelize[_0x8445('0x2')],'allowNull':![],'unique':_0x8445('0x3')},'crudPermissions':{'type':Sequelize[_0x8445('0x2')],'set':function(_0x579128){this[_0x8445('0x4')](_0x8445('0x5'),_0x579128?_0x579128[_0x8445('0x6')](''):[]);},'get':function(){return this[_0x8445('0x7')](_0x8445('0x5'))?this['getDataValue']('crudPermissions')[_0x8445('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x8445('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xe260=['sequelize','exports','STRING','name','setDataValue','crudPermissions','join','getDataValue'];(function(_0x2c28a2,_0x585c92){var _0x2407e0=function(_0x3e01ff){while(--_0x3e01ff){_0x2c28a2['push'](_0x2c28a2['shift']());}};_0x2407e0(++_0x585c92);}(_0xe260,0xb0));var _0x0e26=function(_0x38f791,_0x300012){_0x38f791=_0x38f791-0x0;var _0x4707ea=_0xe260[_0x38f791];return _0x4707ea;};'use strict';var Sequelize=require(_0x0e26('0x0'));module[_0x0e26('0x1')]={'name':{'type':Sequelize[_0x0e26('0x2')],'allowNull':![],'unique':_0x0e26('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x332d6e){this[_0x0e26('0x4')](_0x0e26('0x5'),_0x332d6e?_0x332d6e[_0x0e26('0x6')](''):[]);},'get':function(){return this[_0x0e26('0x7')](_0x0e26('0x5'))?this[_0x0e26('0x7')](_0x0e26('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x0e26('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index f50060f..7a661dc 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 _0x68e7=['localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','index','UserProfile','type','key','model','map','query','keys','filters','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','include','rows','show','rawAttributes','intersection','includeAll','create','catch','params','find','get','updatedAt','crudPermissions','body','omit','createdAt','sequelize','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','transaction','push','removeSections','destroy','enabled','includes','subsections','forEach','Plugin','addResources','bulkCreate','removeResources','getResources','section','undefined','ValidationError','mergeResources','childModel','Invalid\x20section\x20\x27','isEmpty','parentSections','findOne','all','union','ignore','hasOwnProperty','order','pick','field','AnalyticExtractedReport','associatedResources','reportType','default','custom','reportId','CustomReports','CmContact','Tag','Tags','color','ThroughTags','tag','value','resourceId','toLowerCase','squareprojects','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projects','JscriptyProject','contacts','Lists','ListId','lists','CmList','companies','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','outboundroutes','VoiceExtension','contexts','voicemails','VoiceMail','voicerecordings','membername','User','role','agent','telephone','queue','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','VoiceQueues','QueueCampaigns','users','telephones','Users','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','vtigeraccounts','CannedAnswer','dispositions','customdashboards','intervals','pauses','scheduler','Schedule','sounds','tags','templates','triggers','trunks','Trunk','variables','plugins','Reports','metrics','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','redis','defaults'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0x68e7,0xcc));var _0x768e=function(_0x202501,_0x497cc0){_0x202501=_0x202501-0x0;var _0xdbca9a=_0x68e7[_0x202501];return _0xdbca9a;};'use strict';var pdf=require(_0x768e('0x0'));var emlformat=require(_0x768e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x768e('0x2'));var jsonpatch=require(_0x768e('0x3'));var rp=require('request-promise');var moment=require(_0x768e('0x4'));var BPromise=require(_0x768e('0x5'));var Mustache=require(_0x768e('0x6'));var util=require(_0x768e('0x7'));var path=require(_0x768e('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x768e('0x9'));var fs=require('fs');var fs_extra=require(_0x768e('0xa'));var _=require(_0x768e('0xb'));var squel=require(_0x768e('0xc'));var crypto=require('crypto');var jsforce=require(_0x768e('0xd'));var deskjs=require(_0x768e('0xe'));var toCsv=require(_0x768e('0xf'));var querystring=require('querystring');var Papa=require(_0x768e('0x10'));var Redis=require(_0x768e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x768e('0x12'));var as=require(_0x768e('0x13'));var hardwareService=require(_0x768e('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x768e('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x768e('0x16'))['db'];config[_0x768e('0x17')]=_[_0x768e('0x18')](config['redis'],{'host':_0x768e('0x19'),'port':0x18eb});var socket=require(_0x768e('0x1a'))(new Redis(config[_0x768e('0x17')]));require(_0x768e('0x1b'))[_0x768e('0x1c')](socket);function respondWithStatusCode(_0x122b44,_0x4a6a9e){_0x4a6a9e=_0x4a6a9e||0xcc;return function(_0x41bd16){if(_0x41bd16){return _0x122b44[_0x768e('0x1d')](_0x4a6a9e);}return _0x122b44[_0x768e('0x1e')](_0x4a6a9e)['end']();};}function respondWithResult(_0x5a0311,_0x5c0811){_0x5c0811=_0x5c0811||0xc8;return function(_0x48caa5){if(_0x48caa5){return _0x5a0311[_0x768e('0x1e')](_0x5c0811)[_0x768e('0x1f')](_0x48caa5);}};}function respondWithFilteredResult(_0x2496a9,_0x297dcb){return function(_0x551c8b){if(_0x551c8b){var _0x1ea56b=_0x551c8b[_0x768e('0x20')],_0x49b35c=_0x297dcb[_0x768e('0x21')],_0x40c015=_0x297dcb[_0x768e('0x21')]+_0x297dcb[_0x768e('0x22')],_0x39b2c7;if(_0x40c015>=_0x1ea56b){_0x40c015=_0x1ea56b;_0x39b2c7=0xc8;}else{_0x39b2c7=0xce;}_0x2496a9['status'](_0x39b2c7);return _0x2496a9[_0x768e('0x23')](_0x768e('0x24'),_0x49b35c+'-'+_0x40c015+'/'+_0x1ea56b)[_0x768e('0x1f')](_0x551c8b);}return null;};}function patchUpdates(_0x1f1f1f){return function(_0x2f6eb9){try{jsonpatch[_0x768e('0x25')](_0x2f6eb9,_0x1f1f1f,!![]);}catch(_0x260f36){return BPromise[_0x768e('0x26')](_0x260f36);}return _0x2f6eb9[_0x768e('0x27')]();};}function saveUpdates(_0x575a26,_0x560115){return function(_0x20e925){if(_0x20e925){return _0x20e925[_0x768e('0x28')](_0x575a26)[_0x768e('0x29')](function(_0x33d11c){return _0x33d11c;});}return null;};}function removeEntity(_0x49444f,_0x373497){return function(_0x559915){if(_0x559915){return _0x559915['destroy']()[_0x768e('0x29')](function(){_0x49444f[_0x768e('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56a0a9,_0x1ccf36){return function(_0x411a07){if(!_0x411a07){_0x56a0a9['sendStatus'](0x194);}return _0x411a07;};}function handleError(_0x388767,_0x113e1f){_0x113e1f=_0x113e1f||0x1f4;return function(_0x24031a){logger['error'](_0x24031a[_0x768e('0x2a')]);if(_0x24031a[_0x768e('0x2b')]){delete _0x24031a[_0x768e('0x2b')];}_0x388767[_0x768e('0x1e')](_0x113e1f)['send'](_0x24031a);};}exports[_0x768e('0x2c')]=function(_0xae5dd0,_0x395039){var _0x5c7b50={},_0xdbc3e9={},_0x50db65={'count':0x0,'rows':[]};var _0x50bd98=_['map'](db[_0x768e('0x2d')]['rawAttributes'],function(_0x283ded){return{'name':_0x283ded['fieldName'],'type':_0x283ded[_0x768e('0x2e')][_0x768e('0x2f')]};});_0xdbc3e9[_0x768e('0x30')]=_[_0x768e('0x31')](_0x50bd98,_0x768e('0x2b'));_0xdbc3e9[_0x768e('0x32')]=_[_0x768e('0x33')](_0xae5dd0[_0x768e('0x32')]);_0xdbc3e9[_0x768e('0x34')]=_['intersection'](_0xdbc3e9[_0x768e('0x30')],_0xdbc3e9[_0x768e('0x32')]);_0x5c7b50[_0x768e('0x35')]=_['intersection'](_0xdbc3e9[_0x768e('0x30')],qs[_0x768e('0x36')](_0xae5dd0[_0x768e('0x32')][_0x768e('0x36')]));_0x5c7b50[_0x768e('0x35')]=_0x5c7b50[_0x768e('0x35')][_0x768e('0x37')]?_0x5c7b50[_0x768e('0x35')]:_0xdbc3e9['model'];if(!_0xae5dd0['query']['hasOwnProperty'](_0x768e('0x38'))){_0x5c7b50[_0x768e('0x22')]=qs['limit'](_0xae5dd0[_0x768e('0x32')]['limit']);_0x5c7b50[_0x768e('0x21')]=qs[_0x768e('0x21')](_0xae5dd0[_0x768e('0x32')][_0x768e('0x21')]);}_0x5c7b50['order']=qs['sort'](_0xae5dd0[_0x768e('0x32')][_0x768e('0x39')]);_0x5c7b50[_0x768e('0x3a')]=qs['filters'](_['pick'](_0xae5dd0[_0x768e('0x32')],_0xdbc3e9[_0x768e('0x34')]),_0x50bd98);if(_0xae5dd0[_0x768e('0x32')][_0x768e('0x3b')]){_0x5c7b50[_0x768e('0x3a')]=_[_0x768e('0x3c')](_0x5c7b50[_0x768e('0x3a')],{'$or':_[_0x768e('0x31')](_0x50bd98,function(_0x26848f){if(_0x26848f[_0x768e('0x2e')]!==_0x768e('0x3d')){var _0x11dae8={};_0x11dae8[_0x26848f['name']]={'$like':'%'+_0xae5dd0[_0x768e('0x32')][_0x768e('0x3b')]+'%'};return _0x11dae8;}})});}_0x5c7b50=_[_0x768e('0x3c')]({},_0x5c7b50,_0xae5dd0[_0x768e('0x3e')]);var _0x418a77={'where':_0x5c7b50[_0x768e('0x3a')]};return db[_0x768e('0x2d')]['count'](_0x418a77)[_0x768e('0x29')](function(_0x421d0b){_0x50db65[_0x768e('0x20')]=_0x421d0b;if(_0xae5dd0[_0x768e('0x32')]['includeAll']){_0x5c7b50[_0x768e('0x3f')]=[{'all':!![]}];}return db[_0x768e('0x2d')]['findAll'](_0x5c7b50);})[_0x768e('0x29')](function(_0x2bb2fd){_0x50db65[_0x768e('0x40')]=_0x2bb2fd;return _0x50db65;})[_0x768e('0x29')](respondWithFilteredResult(_0x395039,_0x5c7b50))['catch'](handleError(_0x395039,null));};exports[_0x768e('0x41')]=function(_0x5dfee1,_0x507a85){var _0x54e49d={'raw':![],'where':{'id':_0x5dfee1['params']['id']}},_0x51d115={};_0x51d115['model']=_['keys'](db[_0x768e('0x2d')][_0x768e('0x42')]);_0x51d115[_0x768e('0x32')]=_['keys'](_0x5dfee1[_0x768e('0x32')]);_0x51d115[_0x768e('0x34')]=_['intersection'](_0x51d115[_0x768e('0x30')],_0x51d115[_0x768e('0x32')]);_0x54e49d[_0x768e('0x35')]=_[_0x768e('0x43')](_0x51d115[_0x768e('0x30')],qs['fields'](_0x5dfee1['query']['fields']));_0x54e49d[_0x768e('0x35')]=_0x54e49d['attributes'][_0x768e('0x37')]?_0x54e49d[_0x768e('0x35')]:_0x51d115[_0x768e('0x30')];if(_0x5dfee1[_0x768e('0x32')][_0x768e('0x44')]){_0x54e49d[_0x768e('0x3f')]=[{'all':!![]}];}_0x54e49d=_[_0x768e('0x3c')]({},_0x54e49d,_0x5dfee1[_0x768e('0x3e')]);return db[_0x768e('0x2d')]['find'](_0x54e49d)['then'](handleEntityNotFound(_0x507a85,null))[_0x768e('0x29')](respondWithResult(_0x507a85,null))['catch'](handleError(_0x507a85,null));};exports[_0x768e('0x45')]=function(_0x2f5b39,_0x216b17){return db['UserProfile'][_0x768e('0x45')](_0x2f5b39['body'],{})[_0x768e('0x29')](respondWithResult(_0x216b17,0xc9))[_0x768e('0x46')](handleError(_0x216b17,null));};exports['clone']=function(_0xdcbce1,_0x111efe){var _0x4dae72={'where':{'id':_0xdcbce1[_0x768e('0x47')]['id']}},_0xfcf14f={};_0xfcf14f[_0x768e('0x30')]=_[_0x768e('0x33')](db['UserProfile'][_0x768e('0x42')]);_0x4dae72['attributes']=_['intersection'](_0xfcf14f[_0x768e('0x30')],qs['fields'](_0xdcbce1[_0x768e('0x32')]['fields']));_0x4dae72[_0x768e('0x35')]=_0x4dae72[_0x768e('0x35')][_0x768e('0x37')]?_0x4dae72['attributes']:_0xfcf14f[_0x768e('0x30')];if(_0xdcbce1[_0x768e('0x32')]['includeAll']){_0x4dae72[_0x768e('0x3f')]=[{'all':!![]}];}_0x4dae72=_[_0x768e('0x3c')]({},_0x4dae72,_0xdcbce1[_0x768e('0x3e')]);return db[_0x768e('0x2d')][_0x768e('0x48')](_0x4dae72)['then'](handleEntityNotFound(_0x111efe,null))['then'](function(_0x5c470f){if(_0x5c470f){var _0x3e37e0=_0x5c470f[_0x768e('0x49')]({'plain':!![]});_0x3e37e0=qs['omit'](_0x3e37e0,['id','createdAt',_0x768e('0x4a'),_0x768e('0x4b')]);_0xdcbce1[_0x768e('0x4c')]=_[_0x768e('0x4d')](_0xdcbce1[_0x768e('0x4c')],['id',_0x768e('0x4e'),'updatedAt']);return db[_0x768e('0x4f')]['transaction'](function(_0x44951d){return db[_0x768e('0x2d')]['create'](_[_0x768e('0x3c')](_0x3e37e0,_0xdcbce1['body']),{'include':_0xdcbce1[_0x768e('0x32')][_0x768e('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x44951d})[_0x768e('0x29')](function(_0x3e8e3a){var _0x41a3f3=_0x3e8e3a[_0x768e('0x49')]({'plain':!![]});return db[_0x768e('0x50')][_0x768e('0x51')]({'where':{'userProfileId':_0xdcbce1['params']['id']},'raw':!![]})[_0x768e('0x29')](function(_0x407f43){if(_0x407f43){return BPromise[_0x768e('0x52')](_0x407f43,function(_0x4f8a93){return new BPromise(function(_0x22e498,_0x2cd7c0){if(_0x4f8a93[_0x768e('0x53')]===null||_0x4f8a93[_0x768e('0x53')]===0x1)_0x22e498(null);return db[_0x768e('0x54')][_0x768e('0x51')]({'where':{'sectionId':_0x4f8a93['id']},'raw':!![]})[_0x768e('0x29')](function(_0x3a3c4a){var _0x43991a=_[_0x768e('0x31')](_0x3a3c4a,function(_0x3cdbbb){return qs[_0x768e('0x4d')](_0x3cdbbb,['id','createdAt',_0x768e('0x4a'),_0x768e('0x55')]);});_0x22e498(_0x43991a);})[_0x768e('0x46')](function(_0x3d57fa){_0x2cd7c0(_0x3d57fa);});})[_0x768e('0x29')](function(_0x43c692){var _0x4aae55=qs[_0x768e('0x4d')](_0x4f8a93,['id',_0x768e('0x4e'),_0x768e('0x4a')]);_0x4aae55[_0x768e('0x56')]=_0x41a3f3['id'];if(_0x43c692)_0x4aae55[_0x768e('0x57')]=_0x43c692;return _0x4aae55;})[_0x768e('0x29')](function(_0x356c5f){return db[_0x768e('0x50')][_0x768e('0x45')](_0x356c5f,{'include':[{'model':db[_0x768e('0x54')],'as':_0x768e('0x57')}],'raw':!![],'transaction':_0x44951d});});})[_0x768e('0x29')](function(){return _0x41a3f3;});}});});});}})[_0x768e('0x29')](respondWithResult(_0x111efe,0xc9))[_0x768e('0x46')](handleError(_0x111efe,null));};exports[_0x768e('0x28')]=function(_0x46d236,_0x4ff747){if(_0x46d236[_0x768e('0x4c')]['id']){delete _0x46d236[_0x768e('0x4c')]['id'];}return db[_0x768e('0x2d')][_0x768e('0x48')]({'where':{'id':_0x46d236[_0x768e('0x47')]['id']}})[_0x768e('0x29')](handleEntityNotFound(_0x4ff747,null))[_0x768e('0x29')](saveUpdates(_0x46d236[_0x768e('0x4c')],null))[_0x768e('0x29')](respondWithResult(_0x4ff747,null))[_0x768e('0x46')](handleError(_0x4ff747,null));};exports['destroy']=function(_0x15328c,_0x59e592){return db['UserProfile'][_0x768e('0x48')]({'where':{'id':_0x15328c[_0x768e('0x47')]['id']}})['then'](handleEntityNotFound(_0x59e592,null))[_0x768e('0x29')](removeEntity(_0x59e592,null))[_0x768e('0x46')](handleError(_0x59e592,null));};exports['describe']=function(_0x3a36b1,_0x59a36b){return db[_0x768e('0x2d')][_0x768e('0x58')]()[_0x768e('0x29')](respondWithResult(_0x59a36b,null))[_0x768e('0x46')](handleError(_0x59a36b,null));};exports[_0x768e('0x59')]=function(_0x421bb9,_0x1eb533){var _0x55bda4=_0x421bb9['body'];return db['UserProfile'][_0x768e('0x48')]({'where':{'id':_0x421bb9[_0x768e('0x47')]['id']}})[_0x768e('0x29')](handleEntityNotFound(_0x1eb533,null))['then'](function(_0x50ad69){if(_0x50ad69){return db[_0x768e('0x4f')][_0x768e('0x5a')](function(_0x111973){return db[_0x768e('0x50')]['destroy']({'where':{'userProfileId':_0x421bb9['params']['id'],'sectionId':_['map'](_0x55bda4,function(_0x58999c){return _0x58999c[_0x768e('0x55')];})},'transaction':_0x111973})[_0x768e('0x29')](function(){var _0x176d0f=_[_0x768e('0x31')](_0x55bda4,function(_0x38f5a4){_0x38f5a4[_0x768e('0x56')]=_0x421bb9[_0x768e('0x47')]['id'];return _0x38f5a4;});var _0x27703d=[];return BPromise['each'](_0x176d0f,function(_0x58fdfc){return db['UserProfileSection'][_0x768e('0x45')](_0x58fdfc,{'include':[{'model':db[_0x768e('0x54')],'as':_0x768e('0x57')}],'raw':!![],'transaction':_0x111973})[_0x768e('0x29')](function(_0x1eb404){_0x27703d[_0x768e('0x5b')](_0x1eb404['get']({'plain':!![]}));});})[_0x768e('0x29')](function(){return _0x27703d;});});});}})[_0x768e('0x29')](function(_0xe84d1a){return _0xe84d1a;})[_0x768e('0x29')](respondWithResult(_0x1eb533,null))['catch'](handleError(_0x1eb533,null));};exports[_0x768e('0x5c')]=function(_0x366b8a,_0x41d25b){var _0xb28c6c;return db[_0x768e('0x2d')]['find']({'where':{'id':_0x366b8a[_0x768e('0x47')]['id']},'attributes':['id','name']})[_0x768e('0x29')](handleEntityNotFound(_0x41d25b,null))['then'](function(_0x299727){if(_0x299727){_0xb28c6c=_0x299727;return db['UserProfileSection'][_0x768e('0x5d')]({'where':{'userProfileId':_0x366b8a['params']['id'],'sectionId':_0x366b8a['query']['ids']}});}})[_0x768e('0x29')](function(){return _0xb28c6c;})[_0x768e('0x29')](respondWithStatusCode(_0x41d25b,null))[_0x768e('0x46')](handleError(_0x41d25b,null));};exports['getSections']=function(_0x56fac4,_0x1903a4){var _0x586a12=[];var _0x3729ac=[];return db[_0x768e('0x50')][_0x768e('0x51')]({'where':{'userProfileId':_0x56fac4[_0x768e('0x47')]['id']},'raw':!![]})['then'](function(_0x2dab9a){_0x586a12=_[_0x768e('0x3b')](_0x2dab9a,function(_0x3970c8){return _0x3970c8[_0x768e('0x5e')]===0x1||_['includes']([0x3eb,0x709],_0x3970c8[_0x768e('0x55')]);});if(!_['isEmpty'](_0x586a12)){return _[_0x768e('0x31')](_0x586a12,function(_0x335904){return _0x335904[_0x768e('0x55')];});}else{return;}})[_0x768e('0x29')](function(_0x5f2924){if(_0x5f2924)_0x3729ac=_0x5f2924;if(_[_0x768e('0x5f')](_0x3729ac,0x64)){var _0x3c2d3d=_[_0x768e('0x48')](_0x586a12,{'sectionId':0x64});return hasDefaultDashboard(_0x3c2d3d)[_0x768e('0x29')](function(_0xefce0a){return _[_0x768e('0x31')](_0x586a12,function(_0x36b8eb){if(_0x36b8eb[_0x768e('0x55')]===0x64){_0x36b8eb[_0x768e('0x60')]=_0xefce0a;}return _0x36b8eb;});});}else{return;}})['then'](function(_0x1aecff){if(_0x1aecff)_0x586a12=_0x1aecff;if(_['includes'](_0x3729ac,0x3eb)){var _0x131076=_['find'](_0x586a12,{'sectionId':0x3eb});return getCustomDashboards(_0x131076)[_0x768e('0x29')](function(_0x59aca1){return _[_0x768e('0x31')](_0x586a12,function(_0x47809e){if(_0x131076[_0x768e('0x5e')]){if(_0x47809e[_0x768e('0x55')]===0x3eb){_0x47809e[_0x768e('0x60')]=_0x59aca1;}}else{if(_0x47809e[_0x768e('0x55')]===0x64){_0x47809e[_0x768e('0x60')]=_0x59aca1;}}return _0x47809e;});});}else{return;}})[_0x768e('0x29')](function(_0x4498d5){if(_0x4498d5)_0x586a12=_0x4498d5;if(_['includes'](_0x3729ac,0x709)){var _0x1d8a08=_['find'](_0x586a12,{'sectionId':0x709});return getPlugins(_0x1d8a08)[_0x768e('0x29')](function(_0x26ddcf){if(_0x1d8a08[_0x768e('0x5e')]){return _[_0x768e('0x31')](_0x586a12,function(_0x12b2d9){if(_0x12b2d9[_0x768e('0x55')]===0x709){_0x12b2d9['subsections']=_0x26ddcf;}return _0x12b2d9;});}else{var _0x103f56={'sectionId':0x76c,'enabled':0x1,'subsections':_0x26ddcf};var _0x1d781c=_[_0x768e('0x31')](_0x586a12);_0x1d781c[_0x768e('0x5b')](_0x103f56);return _0x1d781c;}});}else{return;}})[_0x768e('0x29')](function(_0x1fc9b0){if(_0x1fc9b0)_0x586a12=_0x1fc9b0;return _[_0x768e('0x3b')](_0x586a12,['enabled',0x1]);})['then'](respondWithResult(_0x1903a4,null))['catch'](handleError(_0x1903a4,null));};function hasDefaultDashboard(_0x2d4306){var _0x3f0232=[0x65];return new BPromise(function(_0x3d609e,_0x1ce6d0){try{if(_0x2d4306[_0x768e('0x53')]){_0x3d609e(_0x3f0232);}else{return db[_0x768e('0x54')]['findOne']({'where':{'sectionId':_0x2d4306['id']},'raw':!![]})[_0x768e('0x29')](function(_0x2e9a43){_0x2e9a43?_0x3d609e(_0x3f0232):_0x3d609e();});}}catch(_0x2a5fac){_0x1ce6d0(_0x2a5fac);}});}function getCustomDashboards(_0x424241){var _0x2e5305=[];return new BPromise(function(_0x5b62ce,_0x441560){try{if(_0x424241['autoAssociation']){return db['Dashboard'][_0x768e('0x51')]({'raw':!![]})[_0x768e('0x29')](function(_0x410d87){_0x410d87[_0x768e('0x61')](function(_0x239914){_0x2e5305['push'](_0x239914['id']+0x1869f);});_0x5b62ce(_0x2e5305);});}else{return db[_0x768e('0x54')][_0x768e('0x51')]({'where':{'sectionId':_0x424241['id']},'raw':!![]})[_0x768e('0x29')](function(_0x5b4ddb){_0x5b4ddb[_0x768e('0x61')](function(_0x45684c){_0x2e5305['push'](_0x45684c['resourceId']+0x1869f);});_0x5b62ce(_0x2e5305);});}}catch(_0x40c651){_0x441560(_0x40c651);}});}function getPlugins(_0xb2d7c9){var _0x37ee27=[];return new BPromise(function(_0x52e28a,_0x16651f){try{if(_0xb2d7c9[_0x768e('0x53')]){return db[_0x768e('0x62')][_0x768e('0x51')]({'raw':!![]})['then'](function(_0x5ca673){_0x5ca673[_0x768e('0x61')](function(_0x579194){_0x37ee27[_0x768e('0x5b')](_0x579194['id']+0x15b38);});_0x52e28a(_0x37ee27);});}else{return db['UserProfileResource'][_0x768e('0x51')]({'where':{'sectionId':_0xb2d7c9['id']},'raw':!![]})[_0x768e('0x29')](function(_0x7d3b61){_0x7d3b61[_0x768e('0x61')](function(_0x5253bb){_0x37ee27[_0x768e('0x5b')](_0x5253bb['resourceId']+0x15b38);});_0x52e28a(_0x37ee27);});}}catch(_0x13b3f3){_0x16651f(_0x13b3f3);}});}exports[_0x768e('0x63')]=function(_0x429326,_0x346ec8){return db[_0x768e('0x2d')][_0x768e('0x48')]({'where':{'id':_0x429326[_0x768e('0x47')]['id']}})[_0x768e('0x29')](handleEntityNotFound(_0x346ec8,null))[_0x768e('0x29')](function(_0x3045a4){if(_0x3045a4){return db[_0x768e('0x4f')][_0x768e('0x5a')](function(_0x4b7f86){return db[_0x768e('0x50')][_0x768e('0x51')]({'where':{'userProfileId':_0x429326[_0x768e('0x47')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x48a677){if(_0x48a677){return db[_0x768e('0x50')][_0x768e('0x5d')]({'where':{'userProfileId':_0x429326['params']['id'],'id':_['map'](_0x48a677,function(_0x5f0eb8){return _0x5f0eb8['id'];})},'transaction':_0x4b7f86});}})[_0x768e('0x29')](function(_0x5f1c01){var _0x5ec2f2=_['map'](_0x429326[_0x768e('0x4c')],function(_0x47853d){_0x47853d[_0x768e('0x56')]=_0x429326[_0x768e('0x47')]['id'];return _0x47853d;});return db[_0x768e('0x50')][_0x768e('0x64')](_0x5ec2f2,{'raw':!![],'transaction':_0x4b7f86});})[_0x768e('0x29')](function(_0x442ebe){var _0x2a9f3f=_[_0x768e('0x3b')](_[_0x768e('0x31')](_0x442ebe,function(_0xc72e1){return _0xc72e1[_0x768e('0x49')]({'plain':!![]});}),{'includeAll':![]});if(_0x2a9f3f){return db[_0x768e('0x50')]['findAll']({'where':{'userProfileId':_0x429326[_0x768e('0x47')]['id'],'sectionId':_[_0x768e('0x31')](_0x2a9f3f,function(_0x37dc9c){return _0x37dc9c['sectionId'];})},'attributes':['id',_0x768e('0x55')],'raw':!![]})[_0x768e('0x29')](function(_0x5cf741){var _0xd1af41=_[_0x768e('0x31')](_0x429326['body'],function(_0x24944a){_0x24944a[_0x768e('0x56')]=_0x429326[_0x768e('0x47')]['id'];return _0x24944a;});return db['UserProfileResource']['bulkCreate'](_0xd1af41,{'raw':!![],'transaction':_0x4b7f86});});}})['catch'](handleError(_0x346ec8,null));});}})['then'](function(_0x5c40cb){var _0x29bf1a=_[_0x768e('0x31')](_0x5c40cb,function(_0x14a051){return _0x14a051[_0x768e('0x49')]({'plain':!![]});});})['then'](respondWithResult(_0x346ec8,null))[_0x768e('0x46')](handleError(_0x346ec8,null));};exports['removeResources']=function(_0x1f7d26,_0x1bed6a,_0x34a692){return db[_0x768e('0x2d')][_0x768e('0x48')]({'where':{'id':_0x1f7d26['params']['id']}})['then'](handleEntityNotFound(_0x1bed6a,null))[_0x768e('0x29')](function(_0x4eea06){if(_0x4eea06){return _0x4eea06[_0x768e('0x65')](_0x1f7d26[_0x768e('0x32')]['ids']);}})[_0x768e('0x29')](respondWithStatusCode(_0x1bed6a,null))['catch'](handleError(_0x1bed6a,null));};exports[_0x768e('0x66')]=function(_0x3549bf,_0x137ee1){var _0x14a091={'raw':![],'where':{}};var _0x11222a={};var _0x45f634={'count':0x0,'rows':[]};var _0x3f462b=_0x3549bf[_0x768e('0x32')][_0x768e('0x67')];if(typeof _0x3f462b===_0x768e('0x68')){throw new db['Sequelize'][(_0x768e('0x69'))]('Unknown\x20section');}var _0xeb117d=_0x3549bf['query'][_0x768e('0x6a')]||![];var _0x2ab23d=getQueryModels(_0x3f462b,_0xeb117d);if(typeof _0x2ab23d[_0x768e('0x6b')]===_0x768e('0x68')){throw new db['Sequelize'][(_0x768e('0x69'))](_0x768e('0x6c')+_0x3f462b+'\x27');}var _0x1671ea=[];if(!_[_0x768e('0x6d')](_0x2ab23d[_0x768e('0x6e')])){_0x1671ea=_0x2ab23d[_0x768e('0x6e')];}else{_0x1671ea=[{'name':_0x3f462b}];}return db[_0x768e('0x2d')][_0x768e('0x6f')]({'where':{'id':_0x3549bf[_0x768e('0x47')]['id']}})[_0x768e('0x29')](handleEntityNotFound(_0x137ee1,null))[_0x768e('0x29')](function(_0x417a8a){if(_0x417a8a){var _0x1ed55d=[];for(var _0xfc9aa=0x0;_0xfc9aa<_0x1671ea['length'];_0xfc9aa++){_0x1ed55d[_0x768e('0x5b')](db['UserProfileSection'][_0x768e('0x6f')]({'where':{'userProfileId':_0x417a8a['id'],'name':_0x1671ea[_0xfc9aa][_0x768e('0x2b')]},'raw':!![]}));}return BPromise[_0x768e('0x70')](_0x1ed55d);}})[_0x768e('0x29')](function(_0x3c4228){var _0x1c7951=_['filter'](_0x3c4228,function(_0x1a0a9c){return _0x1a0a9c?_0x1a0a9c:undefined;});var _0x191262=_[_0x768e('0x3b')](_0x1671ea,['ignore',!![]]);var _0x35a790=_['isEmpty'](_0x1c7951)&&_[_0x768e('0x6d')](_0x191262)?null:_[_0x768e('0x71')](_0x191262,_0x1c7951);if(_0x35a790){var _0x4b9578=[];for(var _0xab3e3=0x0;_0xab3e3<_0x35a790[_0x768e('0x37')];_0xab3e3++){var _0x499738=_['find'](_0x1671ea,function(_0x461bda){return _0x35a790[_0xab3e3]?_0x461bda['name']===_0x35a790[_0xab3e3][_0x768e('0x2b')]:null;});if(_0x499738){if(_0x35a790[_0xab3e3][_0x768e('0x72')]){_0x4b9578[_0x768e('0x5b')](getAllResources(_0x2ab23d[_0x768e('0x6b')],_0x35a790[_0xab3e3]));}else{if(!_0x35a790[_0xab3e3]['autoAssociation']){_0x4b9578[_0x768e('0x5b')](getAllowedResources(_0x499738,_0x35a790[_0xab3e3],_0x2ab23d['childModel']));}else{if(_0x499738[_0x768e('0x30')]){_0x4b9578[_0x768e('0x5b')](getAllFilteredResources(_0x499738,_0x35a790[_0xab3e3]));}}}}}return BPromise[_0x768e('0x70')](_0x4b9578);}else{return null;}})['then'](function(_0x437885){var _0x294690=_0x437885;var _0x3bb9d8=null;if(_0x294690){_0x3bb9d8=_0x294690[_0x768e('0x37')]===0x1?_0x294690[0x0]:null;}if(_0x3bb9d8||_0x294690){var _0x5db82c=db[_0x2ab23d['childModel']][_0x768e('0x42')];_0x11222a[_0x768e('0x30')]=_[_0x768e('0x33')](_0x5db82c);_0x11222a[_0x768e('0x32')]=_[_0x768e('0x33')](_0x3549bf['query']);_0x11222a[_0x768e('0x34')]=_[_0x768e('0x43')](_0x11222a['model'],_0x11222a[_0x768e('0x32')]);_0x14a091[_0x768e('0x35')]=_[_0x768e('0x43')](_0x11222a[_0x768e('0x30')],qs[_0x768e('0x36')](_0x3549bf[_0x768e('0x32')][_0x768e('0x36')]));_0x14a091[_0x768e('0x35')]=_0x14a091['attributes'][_0x768e('0x37')]?_0x14a091[_0x768e('0x35')]:_0x11222a[_0x768e('0x30')];if(!_0x3549bf['query'][_0x768e('0x73')](_0x768e('0x38'))){_0x14a091[_0x768e('0x22')]=qs[_0x768e('0x22')](_0x3549bf[_0x768e('0x32')][_0x768e('0x22')]);_0x14a091[_0x768e('0x21')]=qs[_0x768e('0x21')](_0x3549bf[_0x768e('0x32')][_0x768e('0x21')]);}_0x14a091[_0x768e('0x74')]=qs['sort'](_0x3549bf[_0x768e('0x32')][_0x768e('0x39')]);_0x14a091[_0x768e('0x3a')]=qs[_0x768e('0x34')](_[_0x768e('0x75')](_0x3549bf[_0x768e('0x32')],_0x11222a['filters']));if(_0x3549bf[_0x768e('0x32')][_0x768e('0x3b')]){_0x14a091[_0x768e('0x3a')]=_[_0x768e('0x3c')](_0x14a091[_0x768e('0x3a')],{'$or':_[_0x768e('0x31')](_0x5db82c,function(_0x57cc66){if(_0x57cc66[_0x768e('0x2e')]['key']!==_0x768e('0x3d')){var _0x150545={};_0x150545[_0x57cc66['field']]={'$like':'%'+_0x3549bf[_0x768e('0x32')][_0x768e('0x3b')]+'%'};return _0x150545;}})});}var _0x3e8506=[];if(_0x3bb9d8){var _0x20224c=_['find'](_0x1671ea,[_0x768e('0x2b'),_0x3bb9d8[_0x768e('0x2b')]]);if(_0x20224c[_0x768e('0x76')]){var _0x543592={};if(_0x2ab23d[_0x768e('0x6b')]===_0x768e('0x77')){_0x543592[_0x20224c['foreignKey']]=_[_0x768e('0x31')](_0x3bb9d8[_0x768e('0x78')],'id');}else{_0x543592[_0x20224c['foreignKey']]=_0x3bb9d8['associatedResources'];}_0x3e8506[_0x768e('0x5b')](_0x543592);}else{_0x14a091[_0x768e('0x3a')]['id']=_0x3bb9d8['associatedResources'];}}else{for(var _0x5b7d63=0x0;_0x5b7d63<_0x294690[_0x768e('0x37')];_0x5b7d63++){var _0x20224c=_['find'](_0x1671ea,[_0x768e('0x2b'),_0x294690[_0x5b7d63][_0x768e('0x2b')]]);if(_0x20224c[_0x768e('0x76')]){var _0x543592={};_0x543592[_0x20224c['foreignKey']]=_0x294690[_0x5b7d63][_0x768e('0x78')];_0x3e8506[_0x768e('0x5b')](_0x543592);}else{if(!_0x14a091[_0x768e('0x3a')]['id'])_0x14a091[_0x768e('0x3a')]['id']=[];_0x294690[_0x5b7d63][_0x768e('0x78')][_0x768e('0x61')](function(_0x1f8858){_0x14a091[_0x768e('0x3a')]['id'][_0x768e('0x5b')](_0x1f8858);});}}}if(!_[_0x768e('0x6d')](_0x3e8506)){_0x14a091[_0x768e('0x3a')]=_[_0x768e('0x3c')](_0x14a091['where'],{'$and':{'$or':_0x3e8506}});}_0x14a091=_[_0x768e('0x3c')]({},_0x14a091,_0x3549bf[_0x768e('0x3e')]);if(_0x3bb9d8&&!_0x3bb9d8['autoAssociation']&&_0x2ab23d[_0x768e('0x6b')]===_0x768e('0x77')){if(_0x3549bf[_0x768e('0x32')][_0x768e('0x44')]){_0x14a091['include']=[{'all':!![]}];}return db[_0x2ab23d[_0x768e('0x6b')]][_0x768e('0x51')](_0x14a091)['then'](function(_0x1227c3){var _0x5b7ab8=[];_0x1227c3[_0x768e('0x61')](function(_0x6ad5e){var _0x351b9e;switch(_0x6ad5e[_0x768e('0x79')]){case _0x768e('0x7a'):_0x351b9e=_['find'](_0x3bb9d8[_0x768e('0x78')],function(_0x24703d){return _0x24703d['id']===_0x6ad5e['reportId']&&_0x24703d['type']==='DefaultReports';});break;case _0x768e('0x7b'):_0x351b9e=_[_0x768e('0x48')](_0x3bb9d8[_0x768e('0x78')],function(_0x3afa33){return _0x3afa33['id']===_0x6ad5e[_0x768e('0x7c')]&&_0x3afa33[_0x768e('0x2e')]===_0x768e('0x7d');});break;}if(_0x351b9e)_0x5b7ab8[_0x768e('0x5b')](_0x6ad5e);});_0x45f634[_0x768e('0x20')]=_0x5b7ab8[_0x768e('0x37')];_0x45f634[_0x768e('0x40')]=_0x5b7ab8;return _0x45f634;});}else{return db[_0x2ab23d[_0x768e('0x6b')]][_0x768e('0x20')]({'where':_0x14a091[_0x768e('0x3a')]})[_0x768e('0x29')](function(_0x20fdc9){_0x45f634[_0x768e('0x20')]=_0x20fdc9;if(_0x3549bf[_0x768e('0x32')][_0x768e('0x44')]){if(_0x2ab23d['childModel']===_0x768e('0x7e')){_0x14a091[_0x768e('0x3f')]=[{'model':db[_0x768e('0x7f')],'as':_0x768e('0x80'),'attributes':['id','name',_0x768e('0x81')],'required':_0x3549bf[_0x768e('0x32')]['tag']?!![]:![]},{'model':db[_0x768e('0x7f')],'as':_0x768e('0x82'),'attributes':['id','name',_0x768e('0x81')],'through':_0x3549bf[_0x768e('0x32')][_0x768e('0x83')]?{'attributes':[],'where':{'TagId':_0x3549bf[_0x768e('0x32')][_0x768e('0x83')]||undefined}}:{},'required':_0x3549bf['query'][_0x768e('0x83')]?!![]:![]}];}else{_0x14a091[_0x768e('0x3f')]=[{'all':!![]}];}}return db[_0x2ab23d[_0x768e('0x6b')]][_0x768e('0x51')](_0x14a091);})['then'](function(_0x25c3a1){_0x45f634['rows']=_0x25c3a1;return _0x45f634;});}}else{return _0x45f634;}})[_0x768e('0x29')](respondWithFilteredResult(_0x137ee1,_0x14a091))[_0x768e('0x46')](handleError(_0x137ee1,null));};function getAllResources(_0x42fe5e,_0x5a6ed1){return new BPromise(function(_0x3694e5,_0x5a0c7c){if(_0x5a6ed1){var _0x36a217=_0x5a6ed1[_0x768e('0x3b')]?{[_0x5a6ed1[_0x768e('0x3b')][_0x768e('0x76')]]:_0x5a6ed1[_0x768e('0x3b')]['value']}:undefined;return db[_0x42fe5e]['findAll']({'where':_0x36a217,'raw':!![]})[_0x768e('0x29')](function(_0x4218e0){_0x5a6ed1[_0x768e('0x78')]=_[_0x768e('0x31')](_0x4218e0,'id');_0x3694e5(_0x5a6ed1);})[_0x768e('0x46')](function(_0x27d101){_0x5a0c7c(_0x27d101);});}else{_0x3694e5(null);}});}function getAllFilteredResources(_0x492fb3,_0x3c15b5){return new BPromise(function(_0x24ced2,_0x345688){var _0x4f0a4a=_0x492fb3[_0x768e('0x3b')]?{[_0x492fb3[_0x768e('0x3b')][_0x768e('0x76')]]:_0x492fb3[_0x768e('0x3b')][_0x768e('0x84')]}:undefined;return db[_0x492fb3[_0x768e('0x30')]]['findAll']({'where':_0x4f0a4a,'raw':!![]})['then'](function(_0x447459){_0x3c15b5['associatedResources']=_[_0x768e('0x31')](_0x447459,function(_0x8dce01){return _0x8dce01['name'];});_0x24ced2(_0x3c15b5);})[_0x768e('0x46')](function(_0x3970cd){_0x345688(_0x3970cd);});});}function getAllowedResources(_0x44c9f1,_0x152f03,_0x5f06d1){return new BPromise(function(_0x512120,_0x139d88){if(_0x152f03){return db[_0x768e('0x54')]['findAll']({'where':{'sectionId':_0x152f03['id']},'raw':!![]})['then'](function(_0x49cf0){if(_0x44c9f1[_0x768e('0x76')]&&_0x44c9f1[_0x768e('0x76')]!=='id'){_0x152f03['associatedResources']=_[_0x768e('0x31')](_0x49cf0,function(_0x5d798c){return _0x5d798c[_0x44c9f1['field']];});}else{if(_0x5f06d1===_0x768e('0x77')){_0x152f03[_0x768e('0x78')]=_[_0x768e('0x31')](_0x49cf0,function(_0x199185){return{'id':_0x199185[_0x768e('0x85')],'type':_0x199185[_0x768e('0x2e')]};});}else{_0x152f03[_0x768e('0x78')]=_[_0x768e('0x31')](_0x49cf0,function(_0x56eb5d){return _0x56eb5d[_0x768e('0x85')];});}}_0x512120(_0x152f03);})[_0x768e('0x46')](function(_0x20e1be){_0x139d88(_0x20e1be);});}else{_0x512120(null);}});}function getQueryModels(_0x162908,_0x5863cb){var _0x37fbd8=_0x162908[_0x768e('0x86')]();var _0x1650e3={'childModel':undefined,'parentSections':[]};switch(_0x37fbd8){case _0x768e('0x87'):_0x1650e3[_0x768e('0x6b')]='SquareProject';break;case'odbc':_0x1650e3[_0x768e('0x6b')]=_0x768e('0x88');break;case _0x768e('0x89'):_0x1650e3[_0x768e('0x6b')]=_0x768e('0x8a');_0x1650e3['parentSections']=[{'name':_0x768e('0x8b'),'field':'name','foreignKey':'projectName'}];break;case _0x768e('0x8c'):_0x1650e3[_0x768e('0x6b')]=_0x768e('0x8d');break;case _0x768e('0x8e'):_0x1650e3[_0x768e('0x6b')]=_0x768e('0x7e');_0x1650e3[_0x768e('0x6e')]=[{'name':_0x768e('0x8f'),'field':'id','foreignKey':_0x768e('0x90')}];break;case _0x768e('0x91'):_0x1650e3['childModel']=_0x768e('0x92');break;case _0x768e('0x93'):_0x1650e3['childModel']='CmCompany';break;case'globalcustomfields':_0x1650e3[_0x768e('0x6b')]=_0x768e('0x94');break;case _0x768e('0x95'):_0x1650e3['childModel']=_0x768e('0x96');break;case _0x768e('0x97'):_0x1650e3[_0x768e('0x6b')]=_0x768e('0x98');break;case _0x768e('0x99'):_0x1650e3[_0x768e('0x6b')]=_0x768e('0x9a');break;case _0x768e('0x9b'):_0x1650e3[_0x768e('0x6b')]=_0x768e('0x9c');break;case'inboundroutes':case'internalroutes':case _0x768e('0x9d'):_0x1650e3['childModel']=_0x768e('0x9e');break;case _0x768e('0x9f'):_0x1650e3[_0x768e('0x6b')]='VoiceContext';break;case _0x768e('0xa0'):_0x1650e3[_0x768e('0x6b')]=_0x768e('0xa1');break;case _0x768e('0xa2'):_0x1650e3[_0x768e('0x6b')]='VoiceRecording';_0x1650e3[_0x768e('0x6e')]=[{'name':'Agents','field':'name','foreignKey':_0x768e('0xa3'),'model':_0x768e('0xa4'),'filter':{'field':_0x768e('0xa5'),'value':[_0x768e('0xa6')]}},{'name':'Telephones','field':'name','foreignKey':'membername','model':_0x768e('0xa4'),'filter':{'field':'role','value':[_0x768e('0xa7')]}},{'name':'VoiceQueues','field':'name','foreignKey':_0x768e('0xa8'),'model':_0x768e('0xa9'),'filter':{'field':'type','value':['inbound']}},{'name':'QueueCampaigns','field':_0x768e('0x2b'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x768e('0x2e'),'value':[_0x768e('0xaa')]}}];break;case _0x768e('0xab'):_0x1650e3[_0x768e('0x6b')]=_0x768e('0xac');break;case _0x768e('0xad'):_0x1650e3['childModel']=_0x768e('0xae');break;case _0x768e('0xaf'):_0x1650e3[_0x768e('0x6b')]=_0x768e('0xb0');break;case _0x768e('0xb1'):_0x1650e3[_0x768e('0x6b')]=_0x768e('0xb2');break;case'mailqueues':_0x1650e3[_0x768e('0x6b')]=_0x768e('0xb3');break;case'mailaccounts':_0x1650e3[_0x768e('0x6b')]=_0x768e('0xb4');break;case _0x768e('0xb5'):_0x1650e3[_0x768e('0x6b')]=_0x768e('0xb6');break;case _0x768e('0xb7'):_0x1650e3[_0x768e('0x6b')]=_0x768e('0xb8');break;case _0x768e('0xb9'):_0x1650e3[_0x768e('0x6b')]=_0x768e('0xba');break;case _0x768e('0xbb'):_0x1650e3['childModel']='SmsQueue';break;case _0x768e('0xbc'):_0x1650e3[_0x768e('0x6b')]=_0x768e('0xbd');break;case _0x768e('0xbe'):_0x1650e3[_0x768e('0x6b')]=_0x768e('0xbf');break;case _0x768e('0xc0'):_0x1650e3[_0x768e('0x6b')]='WhatsappAccount';break;case _0x768e('0xc1'):_0x1650e3[_0x768e('0x6b')]=_0x768e('0xc2');break;case _0x768e('0xc3'):case'queuecampaigns':_0x1650e3[_0x768e('0x6b')]=_0x768e('0xa9');if(_0x5863cb){_0x1650e3['parentSections']=[{'name':_0x768e('0xc4')},{'name':_0x768e('0xc5')}];}break;case _0x768e('0xc6'):case'agents':case _0x768e('0xc7'):_0x1650e3[_0x768e('0x6b')]='User';if(_0x5863cb){_0x1650e3[_0x768e('0x6e')]=[{'name':_0x768e('0xc8'),'filter':{'field':'role','value':['admin','user']},'ignore':!![]},{'name':'Agents'},{'name':_0x768e('0xc9')}];}break;case _0x768e('0xca'):_0x1650e3[_0x768e('0x6b')]=_0x768e('0xcb');break;case _0x768e('0xcc'):_0x1650e3['childModel']='SalesforceAccount';break;case _0x768e('0xcd'):_0x1650e3[_0x768e('0x6b')]=_0x768e('0xce');break;case _0x768e('0xcf'):_0x1650e3[_0x768e('0x6b')]=_0x768e('0xd0');break;case _0x768e('0xd1'):_0x1650e3[_0x768e('0x6b')]=_0x768e('0xd2');break;case'zohoaccounts':_0x1650e3[_0x768e('0x6b')]='ZohoAccount';break;case _0x768e('0xd3'):_0x1650e3[_0x768e('0x6b')]=_0x768e('0xa4');break;case'cannedanswers':_0x1650e3[_0x768e('0x6b')]=_0x768e('0xd4');break;case _0x768e('0xd5'):_0x1650e3[_0x768e('0x6b')]='Disposition';break;case _0x768e('0xd6'):_0x1650e3[_0x768e('0x6b')]='Dashboard';break;case _0x768e('0xd7'):_0x1650e3[_0x768e('0x6b')]='Interval';break;case _0x768e('0xd8'):_0x1650e3[_0x768e('0x6b')]='Pause';break;case _0x768e('0xd9'):_0x1650e3[_0x768e('0x6b')]=_0x768e('0xda');break;case _0x768e('0xdb'):_0x1650e3[_0x768e('0x6b')]='Sound';break;case _0x768e('0xdc'):_0x1650e3[_0x768e('0x6b')]=_0x768e('0x7f');break;case _0x768e('0xdd'):_0x1650e3[_0x768e('0x6b')]='Template';break;case _0x768e('0xde'):_0x1650e3[_0x768e('0x6b')]='Trigger';break;case _0x768e('0xdf'):_0x1650e3[_0x768e('0x6b')]=_0x768e('0xe0');break;case _0x768e('0xe1'):_0x1650e3[_0x768e('0x6b')]='Variable';break;case _0x768e('0xe2'):_0x1650e3[_0x768e('0x6b')]=_0x768e('0x62');break;case'extractedreports':_0x1650e3['childModel']='AnalyticExtractedReport';_0x1650e3[_0x768e('0x6e')]=[{'name':_0x768e('0xe3'),'field':'id','foreignKey':'reportId'}];break;case _0x768e('0xe4'):_0x1650e3[_0x768e('0x6b')]='AnalyticMetric';break;case _0x768e('0xc0'):_0x1650e3[_0x768e('0x6b')]='WhatsappAccount';break;default:return _0x1650e3;}return _0x1650e3;} \ No newline at end of file +var _0x83d2=['updatedAt','crudPermissions','createdAt','sequelize','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','sectionId','Resources','destroy','describe','addSections','push','getSections','includes','isEmpty','subsections','enabled','Dashboard','forEach','resourceId','Plugin','userProfileId','bulkCreate','removeResources','getResources','section','undefined','Sequelize','Unknown\x20section','mergeResources','childModel','ValidationError','Invalid\x20section\x20\x27','parentSections','findOne','all','ignore','field','AnalyticExtractedReport','associatedResources','foreignKey','reportType','default','reportId','DefaultReports','CustomReports','rows','CmContact','Tag','ThroughTags','color','tag','value','toLowerCase','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','contacts','Lists','ListId','CmList','companies','globalcustomfields','chatqueues','ChatQueue','chatwebsites','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','Telephones','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','outbound','musiconholds','chanspies','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','whatsappaccounts','users','agents','telephones','Users','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','templates','triggers','trunks','variables','Variable','plugins','Reports','metrics','AnalyticMetric','WhatsappAccount','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','then','error','stack','name','send','map','UserProfile','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','catch','show','params','rawAttributes','intersection','include','find','create','body','includeAll','get','omit'];(function(_0x523398,_0x19cc81){var _0x3f4002=function(_0x30ffa4){while(--_0x30ffa4){_0x523398['push'](_0x523398['shift']());}};_0x3f4002(++_0x19cc81);}(_0x83d2,0x98));var _0x283d=function(_0x15684a,_0x533afe){_0x15684a=_0x15684a-0x0;var _0x2ce52e=_0x83d2[_0x15684a];return _0x2ce52e;};'use strict';var pdf=require(_0x283d('0x0'));var emlformat=require(_0x283d('0x1'));var rimraf=require(_0x283d('0x2'));var zipdir=require(_0x283d('0x3'));var jsonpatch=require(_0x283d('0x4'));var rp=require(_0x283d('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x283d('0x6'));var sox=require(_0x283d('0x7'));var csv=require(_0x283d('0x8'));var ejs=require(_0x283d('0x9'));var fs=require('fs');var fs_extra=require(_0x283d('0xa'));var _=require(_0x283d('0xb'));var squel=require(_0x283d('0xc'));var crypto=require(_0x283d('0xd'));var jsforce=require(_0x283d('0xe'));var deskjs=require(_0x283d('0xf'));var toCsv=require(_0x283d('0x8'));var querystring=require(_0x283d('0x10'));var Papa=require(_0x283d('0x11'));var Redis=require(_0x283d('0x12'));var authService=require(_0x283d('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x283d('0x14'));var utils=require(_0x283d('0x15'));var config=require(_0x283d('0x16'));var licenseUtil=require(_0x283d('0x17'));var db=require('../../mysqldb')['db'];config[_0x283d('0x18')]=_[_0x283d('0x19')](config[_0x283d('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x283d('0x1a'))(new Redis(config[_0x283d('0x18')]));require(_0x283d('0x1b'))[_0x283d('0x1c')](socket);function respondWithStatusCode(_0x555ef6,_0x3b530d){_0x3b530d=_0x3b530d||0xcc;return function(_0x4556df){if(_0x4556df){return _0x555ef6[_0x283d('0x1d')](_0x3b530d);}return _0x555ef6[_0x283d('0x1e')](_0x3b530d)[_0x283d('0x1f')]();};}function respondWithResult(_0x5d2d9b,_0x2204a6){_0x2204a6=_0x2204a6||0xc8;return function(_0xfe9099){if(_0xfe9099){return _0x5d2d9b['status'](_0x2204a6)['json'](_0xfe9099);}};}function respondWithFilteredResult(_0x4ba757,_0x1e3174){return function(_0x55d0ca){if(_0x55d0ca){var _0xc88300=_0x55d0ca[_0x283d('0x20')],_0x1ab1a4=_0x1e3174[_0x283d('0x21')],_0x5c208e=_0x1e3174[_0x283d('0x21')]+_0x1e3174[_0x283d('0x22')],_0x5e0549;if(_0x5c208e>=_0xc88300){_0x5c208e=_0xc88300;_0x5e0549=0xc8;}else{_0x5e0549=0xce;}_0x4ba757[_0x283d('0x1e')](_0x5e0549);return _0x4ba757[_0x283d('0x23')]('Content-Range',_0x1ab1a4+'-'+_0x5c208e+'/'+_0xc88300)[_0x283d('0x24')](_0x55d0ca);}return null;};}function patchUpdates(_0x454b84){return function(_0x17b83f){try{jsonpatch[_0x283d('0x25')](_0x17b83f,_0x454b84,!![]);}catch(_0x58f9c0){return BPromise[_0x283d('0x26')](_0x58f9c0);}return _0x17b83f['save']();};}function saveUpdates(_0x2bb061,_0x360d46){return function(_0x712bc){if(_0x712bc){return _0x712bc[_0x283d('0x27')](_0x2bb061)[_0x283d('0x28')](function(_0x2da493){return _0x2da493;});}return null;};}function removeEntity(_0x132e3,_0x547e61){return function(_0x1e6ef2){if(_0x1e6ef2){return _0x1e6ef2['destroy']()[_0x283d('0x28')](function(){_0x132e3[_0x283d('0x1e')](0xcc)[_0x283d('0x1f')]();});}};}function handleEntityNotFound(_0x3bbe6f,_0x225ca3){return function(_0x2980d6){if(!_0x2980d6){_0x3bbe6f[_0x283d('0x1d')](0x194);}return _0x2980d6;};}function handleError(_0x68b400,_0x912b71){_0x912b71=_0x912b71||0x1f4;return function(_0x49259a){logger[_0x283d('0x29')](_0x49259a[_0x283d('0x2a')]);if(_0x49259a[_0x283d('0x2b')]){delete _0x49259a['name'];}_0x68b400[_0x283d('0x1e')](_0x912b71)[_0x283d('0x2c')](_0x49259a);};}exports['index']=function(_0x384f5a,_0x4daa18){var _0x712c97={},_0x551374={},_0x3b155f={'count':0x0,'rows':[]};var _0x158536=_[_0x283d('0x2d')](db[_0x283d('0x2e')]['rawAttributes'],function(_0x215869){return{'name':_0x215869[_0x283d('0x2f')],'type':_0x215869[_0x283d('0x30')]['key']};});_0x551374[_0x283d('0x31')]=_[_0x283d('0x2d')](_0x158536,_0x283d('0x2b'));_0x551374[_0x283d('0x32')]=_[_0x283d('0x33')](_0x384f5a[_0x283d('0x32')]);_0x551374[_0x283d('0x34')]=_['intersection'](_0x551374[_0x283d('0x31')],_0x551374[_0x283d('0x32')]);_0x712c97[_0x283d('0x35')]=_['intersection'](_0x551374[_0x283d('0x31')],qs['fields'](_0x384f5a[_0x283d('0x32')][_0x283d('0x36')]));_0x712c97[_0x283d('0x35')]=_0x712c97[_0x283d('0x35')][_0x283d('0x37')]?_0x712c97[_0x283d('0x35')]:_0x551374[_0x283d('0x31')];if(!_0x384f5a[_0x283d('0x32')][_0x283d('0x38')](_0x283d('0x39'))){_0x712c97[_0x283d('0x22')]=qs['limit'](_0x384f5a[_0x283d('0x32')][_0x283d('0x22')]);_0x712c97['offset']=qs['offset'](_0x384f5a[_0x283d('0x32')]['offset']);}_0x712c97[_0x283d('0x3a')]=qs[_0x283d('0x3b')](_0x384f5a[_0x283d('0x32')][_0x283d('0x3b')]);_0x712c97['where']=qs['filters'](_[_0x283d('0x3c')](_0x384f5a['query'],_0x551374[_0x283d('0x34')]),_0x158536);if(_0x384f5a[_0x283d('0x32')][_0x283d('0x3d')]){_0x712c97['where']=_[_0x283d('0x3e')](_0x712c97['where'],{'$or':_[_0x283d('0x2d')](_0x158536,function(_0x1b72d2){if(_0x1b72d2[_0x283d('0x30')]!==_0x283d('0x3f')){var _0x1228b6={};_0x1228b6[_0x1b72d2['name']]={'$like':'%'+_0x384f5a[_0x283d('0x32')]['filter']+'%'};return _0x1228b6;}})});}_0x712c97=_['merge']({},_0x712c97,_0x384f5a[_0x283d('0x40')]);var _0x1fa767={'where':_0x712c97[_0x283d('0x41')]};return db[_0x283d('0x2e')][_0x283d('0x20')](_0x1fa767)['then'](function(_0x5ecd11){_0x3b155f['count']=_0x5ecd11;if(_0x384f5a['query']['includeAll']){_0x712c97['include']=[{'all':!![]}];}return db['UserProfile']['findAll'](_0x712c97);})[_0x283d('0x28')](function(_0x99edd8){_0x3b155f['rows']=_0x99edd8;return _0x3b155f;})[_0x283d('0x28')](respondWithFilteredResult(_0x4daa18,_0x712c97))[_0x283d('0x42')](handleError(_0x4daa18,null));};exports[_0x283d('0x43')]=function(_0x2af141,_0x2e29a2){var _0x44cb31={'raw':![],'where':{'id':_0x2af141[_0x283d('0x44')]['id']}},_0x2a6722={};_0x2a6722['model']=_[_0x283d('0x33')](db[_0x283d('0x2e')][_0x283d('0x45')]);_0x2a6722['query']=_['keys'](_0x2af141[_0x283d('0x32')]);_0x2a6722['filters']=_[_0x283d('0x46')](_0x2a6722[_0x283d('0x31')],_0x2a6722[_0x283d('0x32')]);_0x44cb31['attributes']=_[_0x283d('0x46')](_0x2a6722[_0x283d('0x31')],qs[_0x283d('0x36')](_0x2af141[_0x283d('0x32')][_0x283d('0x36')]));_0x44cb31[_0x283d('0x35')]=_0x44cb31['attributes'][_0x283d('0x37')]?_0x44cb31[_0x283d('0x35')]:_0x2a6722['model'];if(_0x2af141[_0x283d('0x32')]['includeAll']){_0x44cb31[_0x283d('0x47')]=[{'all':!![]}];}_0x44cb31=_[_0x283d('0x3e')]({},_0x44cb31,_0x2af141[_0x283d('0x40')]);return db[_0x283d('0x2e')][_0x283d('0x48')](_0x44cb31)[_0x283d('0x28')](handleEntityNotFound(_0x2e29a2,null))[_0x283d('0x28')](respondWithResult(_0x2e29a2,null))[_0x283d('0x42')](handleError(_0x2e29a2,null));};exports[_0x283d('0x49')]=function(_0x3d177a,_0xd017e5){return db['UserProfile']['create'](_0x3d177a[_0x283d('0x4a')],{})['then'](respondWithResult(_0xd017e5,0xc9))[_0x283d('0x42')](handleError(_0xd017e5,null));};exports['clone']=function(_0x5961b2,_0x231897){var _0x6ba0a5={'where':{'id':_0x5961b2[_0x283d('0x44')]['id']}},_0x1b847a={};_0x1b847a['model']=_[_0x283d('0x33')](db[_0x283d('0x2e')][_0x283d('0x45')]);_0x6ba0a5[_0x283d('0x35')]=_['intersection'](_0x1b847a[_0x283d('0x31')],qs['fields'](_0x5961b2[_0x283d('0x32')][_0x283d('0x36')]));_0x6ba0a5[_0x283d('0x35')]=_0x6ba0a5[_0x283d('0x35')]['length']?_0x6ba0a5[_0x283d('0x35')]:_0x1b847a['model'];if(_0x5961b2['query'][_0x283d('0x4b')]){_0x6ba0a5[_0x283d('0x47')]=[{'all':!![]}];}_0x6ba0a5=_[_0x283d('0x3e')]({},_0x6ba0a5,_0x5961b2[_0x283d('0x40')]);return db[_0x283d('0x2e')][_0x283d('0x48')](_0x6ba0a5)[_0x283d('0x28')](handleEntityNotFound(_0x231897,null))[_0x283d('0x28')](function(_0xec0efe){if(_0xec0efe){var _0x23ab26=_0xec0efe[_0x283d('0x4c')]({'plain':!![]});_0x23ab26=qs[_0x283d('0x4d')](_0x23ab26,['id','createdAt',_0x283d('0x4e'),_0x283d('0x4f')]);_0x5961b2[_0x283d('0x4a')]=_[_0x283d('0x4d')](_0x5961b2['body'],['id',_0x283d('0x50'),_0x283d('0x4e')]);return db[_0x283d('0x51')]['transaction'](function(_0x35d41d){return db[_0x283d('0x2e')][_0x283d('0x49')](_[_0x283d('0x3e')](_0x23ab26,_0x5961b2[_0x283d('0x4a')]),{'include':_0x5961b2[_0x283d('0x32')][_0x283d('0x4b')]?[{'all':!![]}]:undefined,'transaction':_0x35d41d})['then'](function(_0x1a3219){var _0x40401e=_0x1a3219[_0x283d('0x4c')]({'plain':!![]});return db[_0x283d('0x52')][_0x283d('0x53')]({'where':{'userProfileId':_0x5961b2[_0x283d('0x44')]['id']},'raw':!![]})[_0x283d('0x28')](function(_0x521794){if(_0x521794){return BPromise[_0x283d('0x54')](_0x521794,function(_0x2cc6ab){return new BPromise(function(_0x107bc6,_0x3e84bc){if(_0x2cc6ab[_0x283d('0x55')]===null||_0x2cc6ab[_0x283d('0x55')]===0x1)_0x107bc6(null);return db[_0x283d('0x56')]['findAll']({'where':{'sectionId':_0x2cc6ab['id']},'raw':!![]})[_0x283d('0x28')](function(_0x9a3a34){var _0x5e4f9e=_[_0x283d('0x2d')](_0x9a3a34,function(_0x38ed37){return qs[_0x283d('0x4d')](_0x38ed37,['id',_0x283d('0x50'),'updatedAt',_0x283d('0x57')]);});_0x107bc6(_0x5e4f9e);})[_0x283d('0x42')](function(_0x388bba){_0x3e84bc(_0x388bba);});})[_0x283d('0x28')](function(_0x6f3fe7){var _0x267f9b=qs['omit'](_0x2cc6ab,['id',_0x283d('0x50'),_0x283d('0x4e')]);_0x267f9b['userProfileId']=_0x40401e['id'];if(_0x6f3fe7)_0x267f9b[_0x283d('0x58')]=_0x6f3fe7;return _0x267f9b;})['then'](function(_0x33c84e){return db[_0x283d('0x52')][_0x283d('0x49')](_0x33c84e,{'include':[{'model':db[_0x283d('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0x35d41d});});})[_0x283d('0x28')](function(){return _0x40401e;});}});});});}})['then'](respondWithResult(_0x231897,0xc9))[_0x283d('0x42')](handleError(_0x231897,null));};exports[_0x283d('0x27')]=function(_0x43ba2a,_0x4937f1){if(_0x43ba2a[_0x283d('0x4a')]['id']){delete _0x43ba2a['body']['id'];}return db[_0x283d('0x2e')][_0x283d('0x48')]({'where':{'id':_0x43ba2a[_0x283d('0x44')]['id']}})[_0x283d('0x28')](handleEntityNotFound(_0x4937f1,null))[_0x283d('0x28')](saveUpdates(_0x43ba2a['body'],null))['then'](respondWithResult(_0x4937f1,null))['catch'](handleError(_0x4937f1,null));};exports[_0x283d('0x59')]=function(_0x181aab,_0x3ddbc9){return db[_0x283d('0x2e')][_0x283d('0x48')]({'where':{'id':_0x181aab[_0x283d('0x44')]['id']}})['then'](handleEntityNotFound(_0x3ddbc9,null))[_0x283d('0x28')](removeEntity(_0x3ddbc9,null))[_0x283d('0x42')](handleError(_0x3ddbc9,null));};exports['describe']=function(_0x118152,_0x50a83e){return db[_0x283d('0x2e')][_0x283d('0x5a')]()[_0x283d('0x28')](respondWithResult(_0x50a83e,null))[_0x283d('0x42')](handleError(_0x50a83e,null));};exports[_0x283d('0x5b')]=function(_0x3879e9,_0x267650){var _0x46a765=_0x3879e9[_0x283d('0x4a')];return db[_0x283d('0x2e')][_0x283d('0x48')]({'where':{'id':_0x3879e9[_0x283d('0x44')]['id']}})['then'](handleEntityNotFound(_0x267650,null))[_0x283d('0x28')](function(_0x298184){if(_0x298184){return db[_0x283d('0x51')]['transaction'](function(_0x4147dc){return db['UserProfileSection'][_0x283d('0x59')]({'where':{'userProfileId':_0x3879e9[_0x283d('0x44')]['id'],'sectionId':_[_0x283d('0x2d')](_0x46a765,function(_0x45e8b7){return _0x45e8b7[_0x283d('0x57')];})},'transaction':_0x4147dc})[_0x283d('0x28')](function(){var _0x2fc652=_[_0x283d('0x2d')](_0x46a765,function(_0x179d66){_0x179d66['userProfileId']=_0x3879e9[_0x283d('0x44')]['id'];return _0x179d66;});var _0x354dc5=[];return BPromise[_0x283d('0x54')](_0x2fc652,function(_0x6c84a3){return db[_0x283d('0x52')]['create'](_0x6c84a3,{'include':[{'model':db[_0x283d('0x56')],'as':_0x283d('0x58')}],'raw':!![],'transaction':_0x4147dc})[_0x283d('0x28')](function(_0x129dea){_0x354dc5[_0x283d('0x5c')](_0x129dea[_0x283d('0x4c')]({'plain':!![]}));});})['then'](function(){return _0x354dc5;});});});}})['then'](function(_0x10b2ec){return _0x10b2ec;})[_0x283d('0x28')](respondWithResult(_0x267650,null))['catch'](handleError(_0x267650,null));};exports['removeSections']=function(_0x186d90,_0x29c005){var _0x2f1647;return db[_0x283d('0x2e')][_0x283d('0x48')]({'where':{'id':_0x186d90[_0x283d('0x44')]['id']},'attributes':['id','name']})[_0x283d('0x28')](handleEntityNotFound(_0x29c005,null))[_0x283d('0x28')](function(_0x5d393d){if(_0x5d393d){_0x2f1647=_0x5d393d;return db[_0x283d('0x52')][_0x283d('0x59')]({'where':{'userProfileId':_0x186d90[_0x283d('0x44')]['id'],'sectionId':_0x186d90[_0x283d('0x32')]['ids']}});}})['then'](function(){return _0x2f1647;})[_0x283d('0x28')](respondWithStatusCode(_0x29c005,null))[_0x283d('0x42')](handleError(_0x29c005,null));};exports[_0x283d('0x5d')]=function(_0x58192b,_0x1e563b){var _0x2987bc=[];var _0x21fb3b=[];return db[_0x283d('0x52')][_0x283d('0x53')]({'where':{'userProfileId':_0x58192b[_0x283d('0x44')]['id']},'raw':!![]})[_0x283d('0x28')](function(_0x14e19e){_0x2987bc=_[_0x283d('0x3d')](_0x14e19e,function(_0x2c84e8){return _0x2c84e8['enabled']===0x1||_[_0x283d('0x5e')]([0x3eb,0x709],_0x2c84e8[_0x283d('0x57')]);});if(!_[_0x283d('0x5f')](_0x2987bc)){return _[_0x283d('0x2d')](_0x2987bc,function(_0x51de93){return _0x51de93[_0x283d('0x57')];});}else{return;}})['then'](function(_0x5d8eec){if(_0x5d8eec)_0x21fb3b=_0x5d8eec;if(_['includes'](_0x21fb3b,0x64)){var _0x400126=_[_0x283d('0x48')](_0x2987bc,{'sectionId':0x64});return hasDefaultDashboard(_0x400126)[_0x283d('0x28')](function(_0x13f08c){return _['map'](_0x2987bc,function(_0x32d08a){if(_0x32d08a[_0x283d('0x57')]===0x64){_0x32d08a[_0x283d('0x60')]=_0x13f08c;}return _0x32d08a;});});}else{return;}})['then'](function(_0x2fa4dd){if(_0x2fa4dd)_0x2987bc=_0x2fa4dd;if(_[_0x283d('0x5e')](_0x21fb3b,0x3eb)){var _0x149f09=_[_0x283d('0x48')](_0x2987bc,{'sectionId':0x3eb});return getCustomDashboards(_0x149f09)[_0x283d('0x28')](function(_0x485204){return _[_0x283d('0x2d')](_0x2987bc,function(_0x32bd43){if(_0x149f09[_0x283d('0x61')]){if(_0x32bd43[_0x283d('0x57')]===0x3eb){_0x32bd43[_0x283d('0x60')]=_0x485204;}}else{if(_0x32bd43['sectionId']===0x64){_0x32bd43[_0x283d('0x60')]=_0x485204;}}return _0x32bd43;});});}else{return;}})[_0x283d('0x28')](function(_0x393778){if(_0x393778)_0x2987bc=_0x393778;if(_['includes'](_0x21fb3b,0x709)){var _0x2fcca4=_[_0x283d('0x48')](_0x2987bc,{'sectionId':0x709});return getPlugins(_0x2fcca4)[_0x283d('0x28')](function(_0x23b682){if(_0x2fcca4[_0x283d('0x61')]){return _['map'](_0x2987bc,function(_0x51ee27){if(_0x51ee27[_0x283d('0x57')]===0x709){_0x51ee27[_0x283d('0x60')]=_0x23b682;}return _0x51ee27;});}else{var _0x156230={'sectionId':0x76c,'enabled':0x1,'subsections':_0x23b682};var _0x26725a=_[_0x283d('0x2d')](_0x2987bc);_0x26725a[_0x283d('0x5c')](_0x156230);return _0x26725a;}});}else{return;}})[_0x283d('0x28')](function(_0x183e1d){if(_0x183e1d)_0x2987bc=_0x183e1d;return _[_0x283d('0x3d')](_0x2987bc,[_0x283d('0x61'),0x1]);})['then'](respondWithResult(_0x1e563b,null))[_0x283d('0x42')](handleError(_0x1e563b,null));};function hasDefaultDashboard(_0x27320f){var _0x57135e=[0x65];return new BPromise(function(_0x2879ab,_0x468f64){try{if(_0x27320f[_0x283d('0x55')]){_0x2879ab(_0x57135e);}else{return db[_0x283d('0x56')]['findOne']({'where':{'sectionId':_0x27320f['id']},'raw':!![]})[_0x283d('0x28')](function(_0xbadf96){_0xbadf96?_0x2879ab(_0x57135e):_0x2879ab();});}}catch(_0x3ea29d){_0x468f64(_0x3ea29d);}});}function getCustomDashboards(_0x5a72f6){var _0x2f14fe=[];return new BPromise(function(_0x28a59d,_0x56bd05){try{if(_0x5a72f6[_0x283d('0x55')]){return db[_0x283d('0x62')][_0x283d('0x53')]({'raw':!![]})[_0x283d('0x28')](function(_0x258e54){_0x258e54[_0x283d('0x63')](function(_0x5843e7){_0x2f14fe['push'](_0x5843e7['id']+0x1869f);});_0x28a59d(_0x2f14fe);});}else{return db['UserProfileResource'][_0x283d('0x53')]({'where':{'sectionId':_0x5a72f6['id']},'raw':!![]})[_0x283d('0x28')](function(_0x8e4e83){_0x8e4e83['forEach'](function(_0x28b6a9){_0x2f14fe[_0x283d('0x5c')](_0x28b6a9[_0x283d('0x64')]+0x1869f);});_0x28a59d(_0x2f14fe);});}}catch(_0x397e8f){_0x56bd05(_0x397e8f);}});}function getPlugins(_0x13a542){var _0x5cef5d=[];return new BPromise(function(_0x397c20,_0xf9ff4c){try{if(_0x13a542[_0x283d('0x55')]){return db[_0x283d('0x65')][_0x283d('0x53')]({'raw':!![]})[_0x283d('0x28')](function(_0x24bfa3){_0x24bfa3['forEach'](function(_0x5bc106){_0x5cef5d[_0x283d('0x5c')](_0x5bc106['id']+0x15b38);});_0x397c20(_0x5cef5d);});}else{return db[_0x283d('0x56')][_0x283d('0x53')]({'where':{'sectionId':_0x13a542['id']},'raw':!![]})[_0x283d('0x28')](function(_0x4249f5){_0x4249f5[_0x283d('0x63')](function(_0x226fbd){_0x5cef5d[_0x283d('0x5c')](_0x226fbd['resourceId']+0x15b38);});_0x397c20(_0x5cef5d);});}}catch(_0x57a4e2){_0xf9ff4c(_0x57a4e2);}});}exports['addResources']=function(_0x472d16,_0x4ff05d){return db[_0x283d('0x2e')][_0x283d('0x48')]({'where':{'id':_0x472d16[_0x283d('0x44')]['id']}})[_0x283d('0x28')](handleEntityNotFound(_0x4ff05d,null))[_0x283d('0x28')](function(_0x162bdc){if(_0x162bdc){return db[_0x283d('0x51')]['transaction'](function(_0x286dac){return db['UserProfileSection'][_0x283d('0x53')]({'where':{'userProfileId':_0x472d16[_0x283d('0x44')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0xcf74f9){if(_0xcf74f9){return db[_0x283d('0x52')][_0x283d('0x59')]({'where':{'userProfileId':_0x472d16[_0x283d('0x44')]['id'],'id':_['map'](_0xcf74f9,function(_0x56f338){return _0x56f338['id'];})},'transaction':_0x286dac});}})[_0x283d('0x28')](function(_0x4674f0){var _0x1977ed=_[_0x283d('0x2d')](_0x472d16[_0x283d('0x4a')],function(_0x268076){_0x268076[_0x283d('0x66')]=_0x472d16[_0x283d('0x44')]['id'];return _0x268076;});return db[_0x283d('0x52')][_0x283d('0x67')](_0x1977ed,{'raw':!![],'transaction':_0x286dac});})['then'](function(_0x77878c){var _0x27fb3f=_[_0x283d('0x3d')](_[_0x283d('0x2d')](_0x77878c,function(_0x28de5c){return _0x28de5c[_0x283d('0x4c')]({'plain':!![]});}),{'includeAll':![]});if(_0x27fb3f){return db[_0x283d('0x52')]['findAll']({'where':{'userProfileId':_0x472d16[_0x283d('0x44')]['id'],'sectionId':_[_0x283d('0x2d')](_0x27fb3f,function(_0x17a00e){return _0x17a00e['sectionId'];})},'attributes':['id',_0x283d('0x57')],'raw':!![]})['then'](function(_0x31f5c1){var _0x39eea7=_[_0x283d('0x2d')](_0x472d16[_0x283d('0x4a')],function(_0x53a2d6){_0x53a2d6['userProfileId']=_0x472d16[_0x283d('0x44')]['id'];return _0x53a2d6;});return db[_0x283d('0x56')][_0x283d('0x67')](_0x39eea7,{'raw':!![],'transaction':_0x286dac});});}})[_0x283d('0x42')](handleError(_0x4ff05d,null));});}})[_0x283d('0x28')](function(_0x540c26){var _0xc9691d=_['map'](_0x540c26,function(_0x982c57){return _0x982c57[_0x283d('0x4c')]({'plain':!![]});});})['then'](respondWithResult(_0x4ff05d,null))[_0x283d('0x42')](handleError(_0x4ff05d,null));};exports[_0x283d('0x68')]=function(_0x56b1d9,_0x339c12,_0x2b22b9){return db['UserProfile']['find']({'where':{'id':_0x56b1d9[_0x283d('0x44')]['id']}})[_0x283d('0x28')](handleEntityNotFound(_0x339c12,null))[_0x283d('0x28')](function(_0x157fc5){if(_0x157fc5){return _0x157fc5['removeResources'](_0x56b1d9['query']['ids']);}})[_0x283d('0x28')](respondWithStatusCode(_0x339c12,null))['catch'](handleError(_0x339c12,null));};exports[_0x283d('0x69')]=function(_0x1f7658,_0x2b370a){var _0x3ae099={'raw':![],'where':{}};var _0x5e1a63={};var _0x405b74={'count':0x0,'rows':[]};var _0x4cdbe0=_0x1f7658[_0x283d('0x32')][_0x283d('0x6a')];if(typeof _0x4cdbe0===_0x283d('0x6b')){throw new db[(_0x283d('0x6c'))]['ValidationError'](_0x283d('0x6d'));}var _0x591618=_0x1f7658[_0x283d('0x32')][_0x283d('0x6e')]||![];var _0x198a22=getQueryModels(_0x4cdbe0,_0x591618);if(typeof _0x198a22[_0x283d('0x6f')]==='undefined'){throw new db[(_0x283d('0x6c'))][(_0x283d('0x70'))](_0x283d('0x71')+_0x4cdbe0+'\x27');}var _0x54f83b=[];if(!_[_0x283d('0x5f')](_0x198a22['parentSections'])){_0x54f83b=_0x198a22[_0x283d('0x72')];}else{_0x54f83b=[{'name':_0x4cdbe0}];}return db['UserProfile'][_0x283d('0x73')]({'where':{'id':_0x1f7658[_0x283d('0x44')]['id']}})[_0x283d('0x28')](handleEntityNotFound(_0x2b370a,null))[_0x283d('0x28')](function(_0x33d092){if(_0x33d092){var _0x1ab28=[];for(var _0x5a5a7a=0x0;_0x5a5a7a<_0x54f83b[_0x283d('0x37')];_0x5a5a7a++){_0x1ab28[_0x283d('0x5c')](db[_0x283d('0x52')]['findOne']({'where':{'userProfileId':_0x33d092['id'],'name':_0x54f83b[_0x5a5a7a][_0x283d('0x2b')]},'raw':!![]}));}return BPromise[_0x283d('0x74')](_0x1ab28);}})['then'](function(_0x1dc004){var _0x19f66d=_[_0x283d('0x3d')](_0x1dc004,function(_0x23de38){return _0x23de38?_0x23de38:undefined;});var _0x37d86a=_['filter'](_0x54f83b,[_0x283d('0x75'),!![]]);var _0x3f7fa8=_[_0x283d('0x5f')](_0x19f66d)&&_[_0x283d('0x5f')](_0x37d86a)?null:_['union'](_0x37d86a,_0x19f66d);if(_0x3f7fa8){var _0xdecc8=[];for(var _0x47b56c=0x0;_0x47b56c<_0x3f7fa8[_0x283d('0x37')];_0x47b56c++){var _0x1802bf=_[_0x283d('0x48')](_0x54f83b,function(_0x47eae2){return _0x3f7fa8[_0x47b56c]?_0x47eae2[_0x283d('0x2b')]===_0x3f7fa8[_0x47b56c][_0x283d('0x2b')]:null;});if(_0x1802bf){if(_0x3f7fa8[_0x47b56c][_0x283d('0x75')]){_0xdecc8[_0x283d('0x5c')](getAllResources(_0x198a22[_0x283d('0x6f')],_0x3f7fa8[_0x47b56c]));}else{if(!_0x3f7fa8[_0x47b56c][_0x283d('0x55')]){_0xdecc8[_0x283d('0x5c')](getAllowedResources(_0x1802bf,_0x3f7fa8[_0x47b56c],_0x198a22[_0x283d('0x6f')]));}else{if(_0x1802bf[_0x283d('0x31')]){_0xdecc8[_0x283d('0x5c')](getAllFilteredResources(_0x1802bf,_0x3f7fa8[_0x47b56c]));}}}}}return BPromise[_0x283d('0x74')](_0xdecc8);}else{return null;}})[_0x283d('0x28')](function(_0x12109a){var _0x37a0da=_0x12109a;var _0x3f9ffa=null;if(_0x37a0da){_0x3f9ffa=_0x37a0da['length']===0x1?_0x37a0da[0x0]:null;}if(_0x3f9ffa||_0x37a0da){var _0xe2dc76=db[_0x198a22[_0x283d('0x6f')]][_0x283d('0x45')];_0x5e1a63[_0x283d('0x31')]=_[_0x283d('0x33')](_0xe2dc76);_0x5e1a63['query']=_[_0x283d('0x33')](_0x1f7658[_0x283d('0x32')]);_0x5e1a63['filters']=_[_0x283d('0x46')](_0x5e1a63[_0x283d('0x31')],_0x5e1a63[_0x283d('0x32')]);_0x3ae099[_0x283d('0x35')]=_[_0x283d('0x46')](_0x5e1a63['model'],qs[_0x283d('0x36')](_0x1f7658[_0x283d('0x32')][_0x283d('0x36')]));_0x3ae099[_0x283d('0x35')]=_0x3ae099[_0x283d('0x35')][_0x283d('0x37')]?_0x3ae099[_0x283d('0x35')]:_0x5e1a63['model'];if(!_0x1f7658[_0x283d('0x32')][_0x283d('0x38')](_0x283d('0x39'))){_0x3ae099[_0x283d('0x22')]=qs[_0x283d('0x22')](_0x1f7658[_0x283d('0x32')][_0x283d('0x22')]);_0x3ae099['offset']=qs[_0x283d('0x21')](_0x1f7658[_0x283d('0x32')][_0x283d('0x21')]);}_0x3ae099[_0x283d('0x3a')]=qs['sort'](_0x1f7658[_0x283d('0x32')]['sort']);_0x3ae099[_0x283d('0x41')]=qs[_0x283d('0x34')](_[_0x283d('0x3c')](_0x1f7658[_0x283d('0x32')],_0x5e1a63[_0x283d('0x34')]));if(_0x1f7658['query'][_0x283d('0x3d')]){_0x3ae099[_0x283d('0x41')]=_[_0x283d('0x3e')](_0x3ae099[_0x283d('0x41')],{'$or':_['map'](_0xe2dc76,function(_0x431a02){if(_0x431a02['type']['key']!==_0x283d('0x3f')){var _0x1c0e68={};_0x1c0e68[_0x431a02['field']]={'$like':'%'+_0x1f7658[_0x283d('0x32')]['filter']+'%'};return _0x1c0e68;}})});}var _0x4c294a=[];if(_0x3f9ffa){var _0x387b1f=_[_0x283d('0x48')](_0x54f83b,[_0x283d('0x2b'),_0x3f9ffa[_0x283d('0x2b')]]);if(_0x387b1f[_0x283d('0x76')]){var _0x1edc85={};if(_0x198a22['childModel']===_0x283d('0x77')){_0x1edc85[_0x387b1f['foreignKey']]=_[_0x283d('0x2d')](_0x3f9ffa[_0x283d('0x78')],'id');}else{_0x1edc85[_0x387b1f[_0x283d('0x79')]]=_0x3f9ffa[_0x283d('0x78')];}_0x4c294a['push'](_0x1edc85);}else{_0x3ae099['where']['id']=_0x3f9ffa[_0x283d('0x78')];}}else{for(var _0x2fa44f=0x0;_0x2fa44f<_0x37a0da[_0x283d('0x37')];_0x2fa44f++){var _0x387b1f=_[_0x283d('0x48')](_0x54f83b,['name',_0x37a0da[_0x2fa44f][_0x283d('0x2b')]]);if(_0x387b1f[_0x283d('0x76')]){var _0x1edc85={};_0x1edc85[_0x387b1f['foreignKey']]=_0x37a0da[_0x2fa44f]['associatedResources'];_0x4c294a[_0x283d('0x5c')](_0x1edc85);}else{if(!_0x3ae099[_0x283d('0x41')]['id'])_0x3ae099['where']['id']=[];_0x37a0da[_0x2fa44f][_0x283d('0x78')][_0x283d('0x63')](function(_0x1ca919){_0x3ae099['where']['id']['push'](_0x1ca919);});}}}if(!_['isEmpty'](_0x4c294a)){_0x3ae099['where']=_[_0x283d('0x3e')](_0x3ae099[_0x283d('0x41')],{'$and':{'$or':_0x4c294a}});}_0x3ae099=_[_0x283d('0x3e')]({},_0x3ae099,_0x1f7658[_0x283d('0x40')]);if(_0x3f9ffa&&!_0x3f9ffa['autoAssociation']&&_0x198a22['childModel']==='AnalyticExtractedReport'){if(_0x1f7658[_0x283d('0x32')][_0x283d('0x4b')]){_0x3ae099['include']=[{'all':!![]}];}return db[_0x198a22[_0x283d('0x6f')]][_0x283d('0x53')](_0x3ae099)[_0x283d('0x28')](function(_0x47053f){var _0xca5389=[];_0x47053f[_0x283d('0x63')](function(_0x3846de){var _0x5e578d;switch(_0x3846de[_0x283d('0x7a')]){case _0x283d('0x7b'):_0x5e578d=_['find'](_0x3f9ffa['associatedResources'],function(_0x423ca4){return _0x423ca4['id']===_0x3846de[_0x283d('0x7c')]&&_0x423ca4['type']===_0x283d('0x7d');});break;case'custom':_0x5e578d=_[_0x283d('0x48')](_0x3f9ffa[_0x283d('0x78')],function(_0x132f22){return _0x132f22['id']===_0x3846de[_0x283d('0x7c')]&&_0x132f22[_0x283d('0x30')]===_0x283d('0x7e');});break;}if(_0x5e578d)_0xca5389[_0x283d('0x5c')](_0x3846de);});_0x405b74[_0x283d('0x20')]=_0xca5389[_0x283d('0x37')];_0x405b74[_0x283d('0x7f')]=_0xca5389;return _0x405b74;});}else{return db[_0x198a22['childModel']][_0x283d('0x20')]({'where':_0x3ae099[_0x283d('0x41')]})[_0x283d('0x28')](function(_0x22eddb){_0x405b74['count']=_0x22eddb;if(_0x1f7658['query']['includeAll']){if(_0x198a22[_0x283d('0x6f')]===_0x283d('0x80')){_0x3ae099[_0x283d('0x47')]=[{'model':db[_0x283d('0x81')],'as':'Tags','attributes':['id',_0x283d('0x2b'),'color'],'required':_0x1f7658[_0x283d('0x32')]['tag']?!![]:![]},{'model':db[_0x283d('0x81')],'as':_0x283d('0x82'),'attributes':['id',_0x283d('0x2b'),_0x283d('0x83')],'through':_0x1f7658[_0x283d('0x32')][_0x283d('0x84')]?{'attributes':[],'where':{'TagId':_0x1f7658[_0x283d('0x32')]['tag']||undefined}}:{},'required':_0x1f7658[_0x283d('0x32')]['tag']?!![]:![]}];}else{_0x3ae099['include']=[{'all':!![]}];}}return db[_0x198a22[_0x283d('0x6f')]][_0x283d('0x53')](_0x3ae099);})['then'](function(_0x1fd434){_0x405b74[_0x283d('0x7f')]=_0x1fd434;return _0x405b74;});}}else{return _0x405b74;}})[_0x283d('0x28')](respondWithFilteredResult(_0x2b370a,_0x3ae099))['catch'](handleError(_0x2b370a,null));};function getAllResources(_0x22da5b,_0x3e2ebc){return new BPromise(function(_0x7558be,_0x4ba66e){if(_0x3e2ebc){var _0x28d026=_0x3e2ebc['filter']?{[_0x3e2ebc[_0x283d('0x3d')][_0x283d('0x76')]]:_0x3e2ebc['filter'][_0x283d('0x85')]}:undefined;return db[_0x22da5b][_0x283d('0x53')]({'where':_0x28d026,'raw':!![]})[_0x283d('0x28')](function(_0x473d50){_0x3e2ebc[_0x283d('0x78')]=_[_0x283d('0x2d')](_0x473d50,'id');_0x7558be(_0x3e2ebc);})[_0x283d('0x42')](function(_0x4ef55f){_0x4ba66e(_0x4ef55f);});}else{_0x7558be(null);}});}function getAllFilteredResources(_0x4e2950,_0x1fbaf){return new BPromise(function(_0x4f2083,_0x4005b5){var _0x147c61=_0x4e2950[_0x283d('0x3d')]?{[_0x4e2950[_0x283d('0x3d')][_0x283d('0x76')]]:_0x4e2950[_0x283d('0x3d')][_0x283d('0x85')]}:undefined;return db[_0x4e2950[_0x283d('0x31')]][_0x283d('0x53')]({'where':_0x147c61,'raw':!![]})[_0x283d('0x28')](function(_0x188a33){_0x1fbaf[_0x283d('0x78')]=_[_0x283d('0x2d')](_0x188a33,function(_0x37172a){return _0x37172a[_0x283d('0x2b')];});_0x4f2083(_0x1fbaf);})[_0x283d('0x42')](function(_0x455db2){_0x4005b5(_0x455db2);});});}function getAllowedResources(_0x30dc09,_0x47b957,_0x17766b){return new BPromise(function(_0x5dac2c,_0x1a4f4f){if(_0x47b957){return db[_0x283d('0x56')][_0x283d('0x53')]({'where':{'sectionId':_0x47b957['id']},'raw':!![]})[_0x283d('0x28')](function(_0x31baac){if(_0x30dc09[_0x283d('0x76')]&&_0x30dc09[_0x283d('0x76')]!=='id'){_0x47b957[_0x283d('0x78')]=_[_0x283d('0x2d')](_0x31baac,function(_0x36b068){return _0x36b068[_0x30dc09[_0x283d('0x76')]];});}else{if(_0x17766b===_0x283d('0x77')){_0x47b957[_0x283d('0x78')]=_['map'](_0x31baac,function(_0x4a6b5e){return{'id':_0x4a6b5e[_0x283d('0x64')],'type':_0x4a6b5e[_0x283d('0x30')]};});}else{_0x47b957['associatedResources']=_[_0x283d('0x2d')](_0x31baac,function(_0x298e6b){return _0x298e6b[_0x283d('0x64')];});}}_0x5dac2c(_0x47b957);})[_0x283d('0x42')](function(_0x555ca4){_0x1a4f4f(_0x555ca4);});}else{_0x5dac2c(null);}});}function getQueryModels(_0x22be98,_0x3feb44){var _0x46ba12=_0x22be98[_0x283d('0x86')]();var _0x24838={'childModel':undefined,'parentSections':[]};switch(_0x46ba12){case'squareprojects':_0x24838[_0x283d('0x6f')]=_0x283d('0x87');break;case _0x283d('0x88'):_0x24838[_0x283d('0x6f')]=_0x283d('0x89');break;case _0x283d('0x8a'):_0x24838['childModel']=_0x283d('0x8b');_0x24838['parentSections']=[{'name':_0x283d('0x8c'),'field':'name','foreignKey':_0x283d('0x8d')}];break;case _0x283d('0x8e'):_0x24838[_0x283d('0x6f')]='JscriptyProject';break;case _0x283d('0x8f'):_0x24838[_0x283d('0x6f')]=_0x283d('0x80');_0x24838[_0x283d('0x72')]=[{'name':_0x283d('0x90'),'field':'id','foreignKey':_0x283d('0x91')}];break;case'lists':_0x24838['childModel']=_0x283d('0x92');break;case _0x283d('0x93'):_0x24838[_0x283d('0x6f')]='CmCompany';break;case _0x283d('0x94'):_0x24838['childModel']='CmCustomField';break;case _0x283d('0x95'):_0x24838['childModel']=_0x283d('0x96');break;case _0x283d('0x97'):_0x24838[_0x283d('0x6f')]='ChatWebsite';break;case'faxqueues':_0x24838[_0x283d('0x6f')]='FaxQueue';break;case _0x283d('0x98'):_0x24838['childModel']='FaxAccount';break;case _0x283d('0x99'):case _0x283d('0x9a'):case _0x283d('0x9b'):_0x24838['childModel']=_0x283d('0x9c');break;case _0x283d('0x9d'):_0x24838['childModel']=_0x283d('0x9e');break;case'voicemails':_0x24838[_0x283d('0x6f')]=_0x283d('0x9f');break;case _0x283d('0xa0'):_0x24838[_0x283d('0x6f')]=_0x283d('0xa1');_0x24838[_0x283d('0x72')]=[{'name':_0x283d('0xa2'),'field':_0x283d('0x2b'),'foreignKey':_0x283d('0xa3'),'model':_0x283d('0xa4'),'filter':{'field':_0x283d('0xa5'),'value':['agent']}},{'name':_0x283d('0xa6'),'field':_0x283d('0x2b'),'foreignKey':_0x283d('0xa3'),'model':_0x283d('0xa4'),'filter':{'field':_0x283d('0xa5'),'value':[_0x283d('0xa7')]}},{'name':_0x283d('0xa8'),'field':_0x283d('0x2b'),'foreignKey':'queue','model':_0x283d('0xa9'),'filter':{'field':'type','value':[_0x283d('0xaa')]}},{'name':_0x283d('0xab'),'field':_0x283d('0x2b'),'foreignKey':_0x283d('0xac'),'model':_0x283d('0xa9'),'filter':{'field':_0x283d('0x30'),'value':[_0x283d('0xad')]}}];break;case _0x283d('0xae'):_0x24838[_0x283d('0x6f')]='VoiceMusicOnHold';break;case _0x283d('0xaf'):_0x24838[_0x283d('0x6f')]='VoiceChanSpy';break;case _0x283d('0xb0'):_0x24838['childModel']=_0x283d('0xb1');break;case _0x283d('0xb2'):_0x24838['childModel']=_0x283d('0xb3');break;case _0x283d('0xb4'):_0x24838[_0x283d('0x6f')]=_0x283d('0xb5');break;case _0x283d('0xb6'):_0x24838[_0x283d('0x6f')]=_0x283d('0xb7');break;case _0x283d('0xb8'):_0x24838[_0x283d('0x6f')]='MailSubstatus';break;case _0x283d('0xb9'):_0x24838[_0x283d('0x6f')]=_0x283d('0xba');break;case _0x283d('0xbb'):_0x24838[_0x283d('0x6f')]=_0x283d('0xbc');break;case'smsqueues':_0x24838[_0x283d('0x6f')]=_0x283d('0xbd');break;case'smsaccounts':_0x24838[_0x283d('0x6f')]='SmsAccount';break;case'whatsappqueues':_0x24838['childModel']='WhatsappQueue';break;case _0x283d('0xbe'):_0x24838['childModel']='WhatsappAccount';break;case'teams':_0x24838[_0x283d('0x6f')]='Team';break;case'voicequeues':case'queuecampaigns':_0x24838[_0x283d('0x6f')]='VoiceQueue';if(_0x3feb44){_0x24838['parentSections']=[{'name':_0x283d('0xa8')},{'name':'QueueCampaigns'}];}break;case _0x283d('0xbf'):case _0x283d('0xc0'):case _0x283d('0xc1'):_0x24838[_0x283d('0x6f')]=_0x283d('0xa4');if(_0x3feb44){_0x24838['parentSections']=[{'name':_0x283d('0xc2'),'filter':{'field':_0x283d('0xa5'),'value':[_0x283d('0xc3'),'user']},'ignore':!![]},{'name':_0x283d('0xa2')},{'name':_0x283d('0xa6')}];}break;case _0x283d('0xc4'):_0x24838['childModel']=_0x283d('0xc5');break;case _0x283d('0xc6'):_0x24838[_0x283d('0x6f')]=_0x283d('0xc7');break;case _0x283d('0xc8'):_0x24838[_0x283d('0x6f')]=_0x283d('0xc9');break;case _0x283d('0xca'):_0x24838[_0x283d('0x6f')]='SugarcrmAccount';break;case _0x283d('0xcb'):_0x24838[_0x283d('0x6f')]=_0x283d('0xcc');break;case'zohoaccounts':_0x24838['childModel']='ZohoAccount';break;case _0x283d('0xcd'):_0x24838['childModel']=_0x283d('0xa4');break;case _0x283d('0xce'):_0x24838[_0x283d('0x6f')]=_0x283d('0xcf');break;case _0x283d('0xd0'):_0x24838[_0x283d('0x6f')]=_0x283d('0xd1');break;case _0x283d('0xd2'):_0x24838[_0x283d('0x6f')]=_0x283d('0x62');break;case _0x283d('0xd3'):_0x24838[_0x283d('0x6f')]=_0x283d('0xd4');break;case _0x283d('0xd5'):_0x24838[_0x283d('0x6f')]=_0x283d('0xd6');break;case _0x283d('0xd7'):_0x24838['childModel']=_0x283d('0xd8');break;case _0x283d('0xd9'):_0x24838[_0x283d('0x6f')]=_0x283d('0xda');break;case _0x283d('0xdb'):_0x24838[_0x283d('0x6f')]='Tag';break;case _0x283d('0xdc'):_0x24838['childModel']='Template';break;case _0x283d('0xdd'):_0x24838[_0x283d('0x6f')]='Trigger';break;case _0x283d('0xde'):_0x24838[_0x283d('0x6f')]='Trunk';break;case _0x283d('0xdf'):_0x24838[_0x283d('0x6f')]=_0x283d('0xe0');break;case _0x283d('0xe1'):_0x24838['childModel']='Plugin';break;case'extractedreports':_0x24838[_0x283d('0x6f')]='AnalyticExtractedReport';_0x24838[_0x283d('0x72')]=[{'name':_0x283d('0xe2'),'field':'id','foreignKey':_0x283d('0x7c')}];break;case _0x283d('0xe3'):_0x24838[_0x283d('0x6f')]=_0x283d('0xe4');break;case _0x283d('0xbe'):_0x24838['childModel']=_0x283d('0xe5');break;default:return _0x24838;}return _0x24838;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index cfd793b..38b984b 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 _0xe812=['exports','events','../../mysqldb','UserProfile','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x47b04b,_0x4f8b08){var _0x4c0636=function(_0x277a47){while(--_0x277a47){_0x47b04b['push'](_0x47b04b['shift']());}};_0x4c0636(++_0x4f8b08);}(_0xe812,0xb5));var _0x2e81=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe812[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x2e81('0x0'));var UserProfile=require(_0x2e81('0x1'))['db'][_0x2e81('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x2e81('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2e81('0x4'),'afterDestroy':_0x2e81('0x5')};function emitEvent(_0x176a87){return function(_0x772aa8,_0x300282,_0x2343f3){UserProfileEvents['emit'](_0x176a87+':'+_0x772aa8['id'],_0x772aa8);UserProfileEvents[_0x2e81('0x6')](_0x176a87,_0x772aa8);_0x2343f3(null);};}for(var e in events){if(events[_0x2e81('0x7')](e)){var event=events[e];UserProfile[_0x2e81('0x8')](e,emitEvent(event));}}module[_0x2e81('0x9')]=UserProfileEvents; \ No newline at end of file +var _0xd4a8=['hook','exports','events','../../mysqldb','UserProfile','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd4a8,0x1ce));var _0x8d4a=function(_0x536bed,_0x17aea5){_0x536bed=_0x536bed-0x0;var _0x58f2cf=_0xd4a8[_0x536bed];return _0x58f2cf;};'use strict';var EventEmitter=require(_0x8d4a('0x0'));var UserProfile=require(_0x8d4a('0x1'))['db'][_0x8d4a('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x8d4a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8d4a('0x4'),'afterDestroy':_0x8d4a('0x5')};function emitEvent(_0x5e5fec){return function(_0x48f77d,_0x317404,_0x399762){UserProfileEvents['emit'](_0x5e5fec+':'+_0x48f77d['id'],_0x48f77d);UserProfileEvents[_0x8d4a('0x6')](_0x5e5fec,_0x48f77d);_0x399762(null);};}for(var e in events){if(events[_0x8d4a('0x7')](e)){var event=events[e];UserProfile[_0x8d4a('0x8')](e,emitEvent(event));}}module[_0x8d4a('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 38f5f38..b4a78bf 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 _0x1265=['bluebird','request-promise','path','rimraf','../../config/environment','./userProfile.attributes','exports','UserProfile','user_profiles','util','../../config/logger','moment'];(function(_0x2e2681,_0x4089c1){var _0x368a64=function(_0x267262){while(--_0x267262){_0x2e2681['push'](_0x2e2681['shift']());}};_0x368a64(++_0x4089c1);}(_0x1265,0x159));var _0x5126=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x1265[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var util=require(_0x5126('0x0'));var logger=require(_0x5126('0x1'))('api');var moment=require(_0x5126('0x2'));var BPromise=require(_0x5126('0x3'));var rp=require(_0x5126('0x4'));var fs=require('fs');var path=require(_0x5126('0x5'));var rimraf=require(_0x5126('0x6'));var config=require(_0x5126('0x7'));var attributes=require(_0x5126('0x8'));module[_0x5126('0x9')]=function(_0x1ae3ee,_0x28f540){return _0x1ae3ee['define'](_0x5126('0xa'),attributes,{'tableName':_0x5126('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4619=['./userProfile.attributes','exports','define','user_profiles','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x553930,_0x250d1e){var _0x41fb15=function(_0x4f34b4){while(--_0x4f34b4){_0x553930['push'](_0x553930['shift']());}};_0x41fb15(++_0x250d1e);}(_0x4619,0x64));var _0x9461=function(_0x309fc8,_0x238564){_0x309fc8=_0x309fc8-0x0;var _0x148b84=_0x4619[_0x309fc8];return _0x148b84;};'use strict';var _=require(_0x9461('0x0'));var util=require(_0x9461('0x1'));var logger=require(_0x9461('0x2'))(_0x9461('0x3'));var moment=require(_0x9461('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9461('0x5'));var rimraf=require(_0x9461('0x6'));var config=require(_0x9461('0x7'));var attributes=require(_0x9461('0x8'));module[_0x9461('0x9')]=function(_0x5d1fd2,_0x4e2113){return _0x5d1fd2[_0x9461('0xa')]('UserProfile',attributes,{'tableName':_0x9461('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index ccdbabe..592eade 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 _0x7dfd=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5f746f,_0x5b05ab){var _0x198d15=function(_0x58c7e7){while(--_0x58c7e7){_0x5f746f['push'](_0x5f746f['shift']());}};_0x198d15(++_0x5b05ab);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var moment=require(_0xd7df('0x2'));var BPromise=require(_0xd7df('0x3'));var rs=require(_0xd7df('0x4'));var fs=require('fs');var Redis=require(_0xd7df('0x5'));var db=require(_0xd7df('0x6'))['db'];var utils=require(_0xd7df('0x7'));var logger=require(_0xd7df('0x8'))(_0xd7df('0x9'));var config=require(_0xd7df('0xa'));var jayson=require(_0xd7df('0xb'));var client=jayson[_0xd7df('0xc')][_0xd7df('0xd')]({'port':0x232a});config[_0xd7df('0xe')]=_[_0xd7df('0xf')](config[_0xd7df('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xd7df('0x10'))(new Redis(config[_0xd7df('0xe')]));require(_0xd7df('0x11'))[_0xd7df('0x12')](socket);function respondWithRpcPromise(_0x5e59c3,_0x32c5b5,_0x532c14){return new BPromise(function(_0x183ace,_0x567e83){return client[_0xd7df('0x13')](_0x5e59c3,_0x532c14)[_0xd7df('0x14')](function(_0x28d358){logger[_0xd7df('0x15')](_0xd7df('0x16'),_0x32c5b5,_0xd7df('0x17'));logger[_0xd7df('0x18')](_0xd7df('0x19'),_0x32c5b5,_0xd7df('0x17'),JSON[_0xd7df('0x1a')](_0x28d358));if(_0x28d358[_0xd7df('0x1b')]){if(_0x28d358[_0xd7df('0x1b')][_0xd7df('0x1c')]===0x1f4){logger[_0xd7df('0x1b')](_0xd7df('0x16'),_0x32c5b5,_0x28d358[_0xd7df('0x1b')][_0xd7df('0x1d')]);return _0x567e83(_0x28d358['error'][_0xd7df('0x1d')]);}logger[_0xd7df('0x1b')]('UserProfile,\x20%s,\x20%s',_0x32c5b5,_0x28d358[_0xd7df('0x1b')][_0xd7df('0x1d')]);return _0x183ace(_0x28d358['error'][_0xd7df('0x1d')]);}else{logger[_0xd7df('0x15')](_0xd7df('0x16'),_0x32c5b5,'request\x20sent');_0x183ace(_0x28d358[_0xd7df('0x1e')][_0xd7df('0x1d')]);}})[_0xd7df('0x1f')](function(_0x5ba653){logger[_0xd7df('0x1b')](_0xd7df('0x16'),_0x32c5b5,_0x5ba653);_0x567e83(_0x5ba653);});});} \ No newline at end of file +var _0x5d58=['localhost','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d58,0x187));var _0x85d5=function(_0x4c3f5a,_0x336cf9){_0x4c3f5a=_0x4c3f5a-0x0;var _0xb41426=_0x5d58[_0x4c3f5a];return _0xb41426;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x85d5('0x0'));var db=require(_0x85d5('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x85d5('0x2'))(_0x85d5('0x3'));var config=require('../../config/environment');var jayson=require(_0x85d5('0x4'));var client=jayson[_0x85d5('0x5')][_0x85d5('0x6')]({'port':0x232a});config[_0x85d5('0x7')]=_['defaults'](config[_0x85d5('0x7')],{'host':_0x85d5('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x85d5('0x7')]));require('./userProfile.socket')[_0x85d5('0x9')](socket);function respondWithRpcPromise(_0x2ce6b9,_0x258f0c,_0x488dcb){return new BPromise(function(_0x499b36,_0x4e147a){return client[_0x85d5('0xa')](_0x2ce6b9,_0x488dcb)[_0x85d5('0xb')](function(_0xde1063){logger[_0x85d5('0xc')](_0x85d5('0xd'),_0x258f0c,_0x85d5('0xe'));logger[_0x85d5('0xf')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x258f0c,'request\x20sent',JSON['stringify'](_0xde1063));if(_0xde1063[_0x85d5('0x10')]){if(_0xde1063[_0x85d5('0x10')][_0x85d5('0x11')]===0x1f4){logger[_0x85d5('0x10')](_0x85d5('0xd'),_0x258f0c,_0xde1063[_0x85d5('0x10')][_0x85d5('0x12')]);return _0x4e147a(_0xde1063['error'][_0x85d5('0x12')]);}logger[_0x85d5('0x10')](_0x85d5('0xd'),_0x258f0c,_0xde1063[_0x85d5('0x10')][_0x85d5('0x12')]);return _0x499b36(_0xde1063[_0x85d5('0x10')][_0x85d5('0x12')]);}else{logger[_0x85d5('0xc')](_0x85d5('0xd'),_0x258f0c,_0x85d5('0xe'));_0x499b36(_0xde1063[_0x85d5('0x13')][_0x85d5('0x12')]);}})[_0x85d5('0x14')](function(_0x3df634){logger[_0x85d5('0x10')](_0x85d5('0xd'),_0x258f0c,_0x3df634);_0x4e147a(_0x3df634);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 56071ac..5c55b1c 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 _0x9ca9=['userProfile:','./userProfile.events','remove','update','emit','removeListener','register','length'];(function(_0x593769,_0x41eb5f){var _0x42af92=function(_0x349f5b){while(--_0x349f5b){_0x593769['push'](_0x593769['shift']());}};_0x42af92(++_0x41eb5f);}(_0x9ca9,0x101));var _0x99ca=function(_0x3a364a,_0x3a33a4){_0x3a364a=_0x3a364a-0x0;var _0x47ffdf=_0x9ca9[_0x3a364a];return _0x47ffdf;};'use strict';var UserProfileEvents=require(_0x99ca('0x0'));var events=['save',_0x99ca('0x1'),_0x99ca('0x2')];function createListener(_0x581507,_0x25017b){return function(_0xe02350){_0x25017b[_0x99ca('0x3')](_0x581507,_0xe02350);};}function removeListener(_0x5d02c7,_0x5695f0){return function(){UserProfileEvents[_0x99ca('0x4')](_0x5d02c7,_0x5695f0);};}exports[_0x99ca('0x5')]=function(_0x4bbbde){for(var _0x5139af=0x0,_0x41faf8=events[_0x99ca('0x6')];_0x5139af<_0x41faf8;_0x5139af++){var _0x141e2f=events[_0x5139af];var _0x361992=createListener(_0x99ca('0x7')+_0x141e2f,_0x4bbbde);UserProfileEvents['on'](_0x141e2f,_0x361992);}}; \ No newline at end of file +var _0xa176=['userProfile:','./userProfile.events','save','remove','update','removeListener','register','length'];(function(_0x291193,_0x463627){var _0x52fe0a=function(_0xc1f806){while(--_0xc1f806){_0x291193['push'](_0x291193['shift']());}};_0x52fe0a(++_0x463627);}(_0xa176,0x1a9));var _0x6a17=function(_0x388b68,_0x51ff9f){_0x388b68=_0x388b68-0x0;var _0x360229=_0xa176[_0x388b68];return _0x360229;};'use strict';var UserProfileEvents=require(_0x6a17('0x0'));var events=[_0x6a17('0x1'),_0x6a17('0x2'),_0x6a17('0x3')];function createListener(_0x18f92e,_0x173a7a){return function(_0x289f68){_0x173a7a['emit'](_0x18f92e,_0x289f68);};}function removeListener(_0x5e346c,_0x2985a7){return function(){UserProfileEvents[_0x6a17('0x4')](_0x5e346c,_0x2985a7);};}exports[_0x6a17('0x5')]=function(_0x239ce7){for(var _0x4a4eca=0x0,_0x5de02c=events[_0x6a17('0x6')];_0x4a4eca<_0x5de02c;_0x4a4eca++){var _0x2f93fc=events[_0x4a4eca];var _0x3f66a3=createListener(_0x6a17('0x7')+_0x2f93fc,_0x239ce7);UserProfileEvents['on'](_0x2f93fc,_0x3f66a3);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 8c9dabe..e5f8c02 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 _0xd3fb=['./userProfileResource.controller','get','isAuthenticated','index','/describe','post','create','put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x31fd58,_0xd2d9b4){var _0x1f562c=function(_0x5f09ac){while(--_0x5f09ac){_0x31fd58['push'](_0x31fd58['shift']());}};_0x1f562c(++_0xd2d9b4);}(_0xd3fb,0x1c4));var _0xbd3f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xd3fb[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xbd3f('0x0'));var util=require(_0xbd3f('0x1'));var path=require(_0xbd3f('0x2'));var timeout=require(_0xbd3f('0x3'));var express=require('express');var router=express[_0xbd3f('0x4')]();var fs_extra=require(_0xbd3f('0x5'));var auth=require(_0xbd3f('0x6'));var interaction=require(_0xbd3f('0x7'));var config=require('../../config/environment');var controller=require(_0xbd3f('0x8'));router[_0xbd3f('0x9')]('/',auth[_0xbd3f('0xa')](),controller[_0xbd3f('0xb')]);router[_0xbd3f('0x9')](_0xbd3f('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xbd3f('0x9')]('/:id',auth[_0xbd3f('0xa')](),controller['show']);router[_0xbd3f('0xd')]('/',auth['isAuthenticated'](),controller[_0xbd3f('0xe')]);router[_0xbd3f('0xf')]('/:id',auth[_0xbd3f('0xa')](),controller['update']);router[_0xbd3f('0x10')](_0xbd3f('0x11'),auth[_0xbd3f('0xa')](),controller[_0xbd3f('0x12')]);module[_0xbd3f('0x13')]=router; \ No newline at end of file +var _0x7246=['./userProfileResource.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x380236,_0x4e73eb){var _0x594b01=function(_0x40e98a){while(--_0x40e98a){_0x380236['push'](_0x380236['shift']());}};_0x594b01(++_0x4e73eb);}(_0x7246,0x1c2));var _0x6724=function(_0x5330e5,_0x56954a){_0x5330e5=_0x5330e5-0x0;var _0x49dcd6=_0x7246[_0x5330e5];return _0x49dcd6;};'use strict';var multer=require(_0x6724('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6724('0x1')]();var fs_extra=require(_0x6724('0x2'));var auth=require(_0x6724('0x3'));var interaction=require(_0x6724('0x4'));var config=require(_0x6724('0x5'));var controller=require(_0x6724('0x6'));router[_0x6724('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6724('0x7')](_0x6724('0x8'),auth[_0x6724('0x9')](),controller['describe']);router[_0x6724('0x7')](_0x6724('0xa'),auth[_0x6724('0x9')](),controller[_0x6724('0xb')]);router[_0x6724('0xc')]('/',auth[_0x6724('0x9')](),controller[_0x6724('0xd')]);router[_0x6724('0xe')]('/:id',auth[_0x6724('0x9')](),controller[_0x6724('0xf')]);router[_0x6724('0x10')](_0x6724('0xa'),auth['isAuthenticated'](),controller[_0x6724('0x11')]);module[_0x6724('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 80f2a3b..d72647b 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 _0xba5b=['INTEGER','sequelize','exports','STRING'];(function(_0x8cb2f9,_0x2b8706){var _0x164887=function(_0x1812cc){while(--_0x1812cc){_0x8cb2f9['push'](_0x8cb2f9['shift']());}};_0x164887(++_0x2b8706);}(_0xba5b,0xe9));var _0xbba5=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xba5b[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0xbba5('0x0'));module[_0xbba5('0x1')]={'name':{'type':Sequelize[_0xbba5('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xbba5('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xbba5('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xafa6=['sequelize','exports','STRING','INTEGER'];(function(_0x174eda,_0x41382b){var _0x3ad12f=function(_0x48f5b6){while(--_0x48f5b6){_0x174eda['push'](_0x174eda['shift']());}};_0x3ad12f(++_0x41382b);}(_0xafa6,0x168));var _0x6afa=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xafa6[_0x51020b];return _0x371e47;};'use strict';var Sequelize=require(_0x6afa('0x0'));module[_0x6afa('0x1')]={'name':{'type':Sequelize[_0x6afa('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x6afa('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x6afa('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 3a63237..291c329 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 _0xed81=['map','UserProfileResource','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index'];(function(_0x33de18,_0x23dbfd){var _0x463dfd=function(_0x4eae7d){while(--_0x4eae7d){_0x33de18['push'](_0x33de18['shift']());}};_0x463dfd(++_0x23dbfd);}(_0xed81,0x107));var _0x1ed8=function(_0xd286ff,_0x5ef098){_0xd286ff=_0xd286ff-0x0;var _0x1abfbe=_0xed81[_0xd286ff];return _0x1abfbe;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1ed8('0x0'));var rimraf=require(_0x1ed8('0x1'));var zipdir=require(_0x1ed8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1ed8('0x3'));var moment=require(_0x1ed8('0x4'));var BPromise=require(_0x1ed8('0x5'));var Mustache=require(_0x1ed8('0x6'));var util=require(_0x1ed8('0x7'));var path=require(_0x1ed8('0x8'));var sox=require(_0x1ed8('0x9'));var csv=require(_0x1ed8('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1ed8('0xb'));var _=require(_0x1ed8('0xc'));var squel=require(_0x1ed8('0xd'));var crypto=require(_0x1ed8('0xe'));var jsforce=require(_0x1ed8('0xf'));var deskjs=require(_0x1ed8('0x10'));var toCsv=require(_0x1ed8('0xa'));var querystring=require('querystring');var Papa=require(_0x1ed8('0x11'));var Redis=require(_0x1ed8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1ed8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1ed8('0x14'))(_0x1ed8('0x15'));var utils=require(_0x1ed8('0x16'));var config=require(_0x1ed8('0x17'));var licenseUtil=require(_0x1ed8('0x18'));var db=require(_0x1ed8('0x19'))['db'];function respondWithStatusCode(_0x4ca798,_0x17d322){_0x17d322=_0x17d322||0xcc;return function(_0x23a5db){if(_0x23a5db){return _0x4ca798[_0x1ed8('0x1a')](_0x17d322);}return _0x4ca798[_0x1ed8('0x1b')](_0x17d322)[_0x1ed8('0x1c')]();};}function respondWithResult(_0x5ea740,_0x3d93a1){_0x3d93a1=_0x3d93a1||0xc8;return function(_0x52681b){if(_0x52681b){return _0x5ea740[_0x1ed8('0x1b')](_0x3d93a1)[_0x1ed8('0x1d')](_0x52681b);}};}function respondWithFilteredResult(_0x33ecec,_0x47b899){return function(_0x1db16b){if(_0x1db16b){var _0x588f17=_0x1db16b[_0x1ed8('0x1e')],_0x2a339a=_0x47b899[_0x1ed8('0x1f')],_0x52263c=_0x47b899['offset']+_0x47b899[_0x1ed8('0x20')],_0x6b6254;if(_0x52263c>=_0x588f17){_0x52263c=_0x588f17;_0x6b6254=0xc8;}else{_0x6b6254=0xce;}_0x33ecec[_0x1ed8('0x1b')](_0x6b6254);return _0x33ecec[_0x1ed8('0x21')](_0x1ed8('0x22'),_0x2a339a+'-'+_0x52263c+'/'+_0x588f17)[_0x1ed8('0x1d')](_0x1db16b);}return null;};}function patchUpdates(_0x1d2d88){return function(_0x4c39c9){try{jsonpatch[_0x1ed8('0x23')](_0x4c39c9,_0x1d2d88,!![]);}catch(_0x182ada){return BPromise[_0x1ed8('0x24')](_0x182ada);}return _0x4c39c9[_0x1ed8('0x25')]();};}function saveUpdates(_0x4071c8,_0x399e5f){return function(_0xfae5b6){if(_0xfae5b6){return _0xfae5b6[_0x1ed8('0x26')](_0x4071c8)['then'](function(_0x5f2e25){return _0x5f2e25;});}return null;};}function removeEntity(_0x2f235c,_0x2abf54){return function(_0x3bf885){if(_0x3bf885){return _0x3bf885[_0x1ed8('0x27')]()[_0x1ed8('0x28')](function(){_0x2f235c[_0x1ed8('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44e230,_0x2d5e32){return function(_0x3ae434){if(!_0x3ae434){_0x44e230[_0x1ed8('0x1a')](0x194);}return _0x3ae434;};}function handleError(_0x20fdba,_0x3a9cf3){_0x3a9cf3=_0x3a9cf3||0x1f4;return function(_0x3cc53e){logger[_0x1ed8('0x29')](_0x3cc53e['stack']);if(_0x3cc53e[_0x1ed8('0x2a')]){delete _0x3cc53e[_0x1ed8('0x2a')];}_0x20fdba[_0x1ed8('0x1b')](_0x3a9cf3)[_0x1ed8('0x2b')](_0x3cc53e);};}exports[_0x1ed8('0x2c')]=function(_0x43716a,_0x387384){var _0x352825={},_0x2f51be={},_0x59f706={'count':0x0,'rows':[]};var _0x39476c=_[_0x1ed8('0x2d')](db[_0x1ed8('0x2e')][_0x1ed8('0x2f')],function(_0xcb2f34){return{'name':_0xcb2f34[_0x1ed8('0x30')],'type':_0xcb2f34['type'][_0x1ed8('0x31')]};});_0x2f51be[_0x1ed8('0x32')]=_[_0x1ed8('0x2d')](_0x39476c,'name');_0x2f51be[_0x1ed8('0x33')]=_[_0x1ed8('0x34')](_0x43716a[_0x1ed8('0x33')]);_0x2f51be[_0x1ed8('0x35')]=_['intersection'](_0x2f51be[_0x1ed8('0x32')],_0x2f51be['query']);_0x352825['attributes']=_[_0x1ed8('0x36')](_0x2f51be[_0x1ed8('0x32')],qs[_0x1ed8('0x37')](_0x43716a[_0x1ed8('0x33')][_0x1ed8('0x37')]));_0x352825[_0x1ed8('0x38')]=_0x352825[_0x1ed8('0x38')][_0x1ed8('0x39')]?_0x352825['attributes']:_0x2f51be[_0x1ed8('0x32')];if(!_0x43716a[_0x1ed8('0x33')][_0x1ed8('0x3a')](_0x1ed8('0x3b'))){_0x352825[_0x1ed8('0x20')]=qs['limit'](_0x43716a[_0x1ed8('0x33')][_0x1ed8('0x20')]);_0x352825[_0x1ed8('0x1f')]=qs['offset'](_0x43716a[_0x1ed8('0x33')]['offset']);}_0x352825[_0x1ed8('0x3c')]=qs['sort'](_0x43716a['query'][_0x1ed8('0x3d')]);_0x352825[_0x1ed8('0x3e')]=qs[_0x1ed8('0x35')](_[_0x1ed8('0x3f')](_0x43716a[_0x1ed8('0x33')],_0x2f51be[_0x1ed8('0x35')]),_0x39476c);if(_0x43716a['query'][_0x1ed8('0x40')]){_0x352825[_0x1ed8('0x3e')]=_[_0x1ed8('0x41')](_0x352825[_0x1ed8('0x3e')],{'$or':_['map'](_0x39476c,function(_0x16f476){if(_0x16f476['type']!==_0x1ed8('0x42')){var _0x50cd7e={};_0x50cd7e[_0x16f476[_0x1ed8('0x2a')]]={'$like':'%'+_0x43716a[_0x1ed8('0x33')][_0x1ed8('0x40')]+'%'};return _0x50cd7e;}})});}_0x352825=_[_0x1ed8('0x41')]({},_0x352825,_0x43716a[_0x1ed8('0x43')]);var _0x5ba73c={'where':_0x352825[_0x1ed8('0x3e')]};return db[_0x1ed8('0x2e')][_0x1ed8('0x1e')](_0x5ba73c)['then'](function(_0x1cbe59){_0x59f706[_0x1ed8('0x1e')]=_0x1cbe59;if(_0x43716a[_0x1ed8('0x33')][_0x1ed8('0x44')]){_0x352825[_0x1ed8('0x45')]=[{'all':!![]}];}return db[_0x1ed8('0x2e')][_0x1ed8('0x46')](_0x352825);})[_0x1ed8('0x28')](function(_0xdaeb3c){_0x59f706['rows']=_0xdaeb3c;return _0x59f706;})[_0x1ed8('0x28')](respondWithFilteredResult(_0x387384,_0x352825))[_0x1ed8('0x47')](handleError(_0x387384,null));};exports['show']=function(_0x1d1bc8,_0xe447e7){var _0x3fe0ed={'raw':![],'where':{'id':_0x1d1bc8['params']['id']}},_0x59d1f8={};_0x59d1f8[_0x1ed8('0x32')]=_[_0x1ed8('0x34')](db['UserProfileResource'][_0x1ed8('0x2f')]);_0x59d1f8[_0x1ed8('0x33')]=_[_0x1ed8('0x34')](_0x1d1bc8[_0x1ed8('0x33')]);_0x59d1f8['filters']=_[_0x1ed8('0x36')](_0x59d1f8[_0x1ed8('0x32')],_0x59d1f8['query']);_0x3fe0ed['attributes']=_[_0x1ed8('0x36')](_0x59d1f8[_0x1ed8('0x32')],qs[_0x1ed8('0x37')](_0x1d1bc8['query']['fields']));_0x3fe0ed[_0x1ed8('0x38')]=_0x3fe0ed[_0x1ed8('0x38')][_0x1ed8('0x39')]?_0x3fe0ed[_0x1ed8('0x38')]:_0x59d1f8[_0x1ed8('0x32')];if(_0x1d1bc8[_0x1ed8('0x33')][_0x1ed8('0x44')]){_0x3fe0ed[_0x1ed8('0x45')]=[{'all':!![]}];}_0x3fe0ed=_[_0x1ed8('0x41')]({},_0x3fe0ed,_0x1d1bc8[_0x1ed8('0x43')]);return db[_0x1ed8('0x2e')][_0x1ed8('0x48')](_0x3fe0ed)['then'](handleEntityNotFound(_0xe447e7,null))[_0x1ed8('0x28')](respondWithResult(_0xe447e7,null))['catch'](handleError(_0xe447e7,null));};exports[_0x1ed8('0x49')]=function(_0x210c8b,_0x693c3b){return db['UserProfileResource'][_0x1ed8('0x49')](_0x210c8b['body'],{})['then'](respondWithResult(_0x693c3b,0xc9))[_0x1ed8('0x47')](handleError(_0x693c3b,null));};exports[_0x1ed8('0x26')]=function(_0x4f87f8,_0x3fe5aa){if(_0x4f87f8['body']['id']){delete _0x4f87f8[_0x1ed8('0x4a')]['id'];}return db[_0x1ed8('0x2e')][_0x1ed8('0x48')]({'where':{'id':_0x4f87f8['params']['id']}})[_0x1ed8('0x28')](handleEntityNotFound(_0x3fe5aa,null))[_0x1ed8('0x28')](saveUpdates(_0x4f87f8['body'],null))[_0x1ed8('0x28')](respondWithResult(_0x3fe5aa,null))['catch'](handleError(_0x3fe5aa,null));};exports['destroy']=function(_0x22a817,_0x3bc649){return db['UserProfileResource'][_0x1ed8('0x48')]({'where':{'id':_0x22a817[_0x1ed8('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3bc649,null))['then'](removeEntity(_0x3bc649,null))[_0x1ed8('0x47')](handleError(_0x3bc649,null));};exports[_0x1ed8('0x4c')]=function(_0x10baca,_0x5ca926){return db[_0x1ed8('0x2e')][_0x1ed8('0x4c')]()[_0x1ed8('0x28')](respondWithResult(_0x5ca926,null))[_0x1ed8('0x47')](handleError(_0x5ca926,null));}; \ No newline at end of file +var _0x4621=['Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','VIRTUAL','filter','includeAll','findAll','rows','catch','params','options','create','body','update','find','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set'];(function(_0x1e13e6,_0x2575da){var _0xa63048=function(_0x1bd1a1){while(--_0x1bd1a1){_0x1e13e6['push'](_0x1e13e6['shift']());}};_0xa63048(++_0x2575da);}(_0x4621,0x78));var _0x1462=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x4621[_0x59ee6f];return _0x4c0979;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1462('0x0'));var rimraf=require(_0x1462('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1462('0x2'));var rp=require('request-promise');var moment=require(_0x1462('0x3'));var BPromise=require(_0x1462('0x4'));var Mustache=require(_0x1462('0x5'));var util=require(_0x1462('0x6'));var path=require('path');var sox=require(_0x1462('0x7'));var csv=require(_0x1462('0x8'));var ejs=require(_0x1462('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1462('0xa'));var squel=require(_0x1462('0xb'));var crypto=require(_0x1462('0xc'));var jsforce=require(_0x1462('0xd'));var deskjs=require(_0x1462('0xe'));var toCsv=require(_0x1462('0x8'));var querystring=require('querystring');var Papa=require(_0x1462('0xf'));var Redis=require(_0x1462('0x10'));var authService=require(_0x1462('0x11'));var qs=require(_0x1462('0x12'));var as=require(_0x1462('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1462('0x14'))('api');var utils=require(_0x1462('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1462('0x16'));var db=require(_0x1462('0x17'))['db'];function respondWithStatusCode(_0x41c618,_0x297b3c){_0x297b3c=_0x297b3c||0xcc;return function(_0x26e6be){if(_0x26e6be){return _0x41c618[_0x1462('0x18')](_0x297b3c);}return _0x41c618[_0x1462('0x19')](_0x297b3c)[_0x1462('0x1a')]();};}function respondWithResult(_0x50acb0,_0x1bbd19){_0x1bbd19=_0x1bbd19||0xc8;return function(_0xf5c841){if(_0xf5c841){return _0x50acb0[_0x1462('0x19')](_0x1bbd19)[_0x1462('0x1b')](_0xf5c841);}};}function respondWithFilteredResult(_0x1d6eca,_0x1f8c96){return function(_0x290c67){if(_0x290c67){var _0x2e11e8=_0x290c67[_0x1462('0x1c')],_0x515926=_0x1f8c96[_0x1462('0x1d')],_0x2eabe8=_0x1f8c96[_0x1462('0x1d')]+_0x1f8c96[_0x1462('0x1e')],_0x2493b6;if(_0x2eabe8>=_0x2e11e8){_0x2eabe8=_0x2e11e8;_0x2493b6=0xc8;}else{_0x2493b6=0xce;}_0x1d6eca[_0x1462('0x19')](_0x2493b6);return _0x1d6eca[_0x1462('0x1f')](_0x1462('0x20'),_0x515926+'-'+_0x2eabe8+'/'+_0x2e11e8)[_0x1462('0x1b')](_0x290c67);}return null;};}function patchUpdates(_0x4ca3fc){return function(_0x5ac421){try{jsonpatch[_0x1462('0x21')](_0x5ac421,_0x4ca3fc,!![]);}catch(_0x328ce1){return BPromise[_0x1462('0x22')](_0x328ce1);}return _0x5ac421[_0x1462('0x23')]();};}function saveUpdates(_0xf11e6c,_0x294d89){return function(_0x282acb){if(_0x282acb){return _0x282acb['update'](_0xf11e6c)[_0x1462('0x24')](function(_0x3c013a){return _0x3c013a;});}return null;};}function removeEntity(_0x5191d6,_0xc27f40){return function(_0x26d8a5){if(_0x26d8a5){return _0x26d8a5[_0x1462('0x25')]()[_0x1462('0x24')](function(){_0x5191d6[_0x1462('0x19')](0xcc)[_0x1462('0x1a')]();});}};}function handleEntityNotFound(_0x54d7dd,_0xdc2a9c){return function(_0x3792b2){if(!_0x3792b2){_0x54d7dd[_0x1462('0x18')](0x194);}return _0x3792b2;};}function handleError(_0x11dc2c,_0x4b033d){_0x4b033d=_0x4b033d||0x1f4;return function(_0x1ffa88){logger[_0x1462('0x26')](_0x1ffa88[_0x1462('0x27')]);if(_0x1ffa88[_0x1462('0x28')]){delete _0x1ffa88[_0x1462('0x28')];}_0x11dc2c['status'](_0x4b033d)[_0x1462('0x29')](_0x1ffa88);};}exports[_0x1462('0x2a')]=function(_0x1e09ba,_0x104362){var _0x4926b1={},_0x34c70a={},_0x2bb6ed={'count':0x0,'rows':[]};var _0x4abcc0=_['map'](db[_0x1462('0x2b')][_0x1462('0x2c')],function(_0x5a4aa5){return{'name':_0x5a4aa5[_0x1462('0x2d')],'type':_0x5a4aa5[_0x1462('0x2e')]['key']};});_0x34c70a[_0x1462('0x2f')]=_['map'](_0x4abcc0,_0x1462('0x28'));_0x34c70a[_0x1462('0x30')]=_[_0x1462('0x31')](_0x1e09ba['query']);_0x34c70a[_0x1462('0x32')]=_['intersection'](_0x34c70a[_0x1462('0x2f')],_0x34c70a[_0x1462('0x30')]);_0x4926b1[_0x1462('0x33')]=_[_0x1462('0x34')](_0x34c70a[_0x1462('0x2f')],qs['fields'](_0x1e09ba['query'][_0x1462('0x35')]));_0x4926b1['attributes']=_0x4926b1[_0x1462('0x33')][_0x1462('0x36')]?_0x4926b1[_0x1462('0x33')]:_0x34c70a[_0x1462('0x2f')];if(!_0x1e09ba['query'][_0x1462('0x37')](_0x1462('0x38'))){_0x4926b1[_0x1462('0x1e')]=qs[_0x1462('0x1e')](_0x1e09ba['query'][_0x1462('0x1e')]);_0x4926b1[_0x1462('0x1d')]=qs[_0x1462('0x1d')](_0x1e09ba['query'][_0x1462('0x1d')]);}_0x4926b1[_0x1462('0x39')]=qs[_0x1462('0x3a')](_0x1e09ba[_0x1462('0x30')][_0x1462('0x3a')]);_0x4926b1['where']=qs['filters'](_[_0x1462('0x3b')](_0x1e09ba[_0x1462('0x30')],_0x34c70a[_0x1462('0x32')]),_0x4abcc0);if(_0x1e09ba['query']['filter']){_0x4926b1[_0x1462('0x3c')]=_[_0x1462('0x3d')](_0x4926b1['where'],{'$or':_[_0x1462('0x3e')](_0x4abcc0,function(_0x6139b){if(_0x6139b['type']!==_0x1462('0x3f')){var _0x41224f={};_0x41224f[_0x6139b[_0x1462('0x28')]]={'$like':'%'+_0x1e09ba['query'][_0x1462('0x40')]+'%'};return _0x41224f;}})});}_0x4926b1=_[_0x1462('0x3d')]({},_0x4926b1,_0x1e09ba['options']);var _0x86915e={'where':_0x4926b1['where']};return db[_0x1462('0x2b')]['count'](_0x86915e)['then'](function(_0x5c05cc){_0x2bb6ed[_0x1462('0x1c')]=_0x5c05cc;if(_0x1e09ba[_0x1462('0x30')][_0x1462('0x41')]){_0x4926b1['include']=[{'all':!![]}];}return db[_0x1462('0x2b')][_0x1462('0x42')](_0x4926b1);})[_0x1462('0x24')](function(_0x2aa2c1){_0x2bb6ed[_0x1462('0x43')]=_0x2aa2c1;return _0x2bb6ed;})[_0x1462('0x24')](respondWithFilteredResult(_0x104362,_0x4926b1))[_0x1462('0x44')](handleError(_0x104362,null));};exports['show']=function(_0x45d937,_0x1cb52d){var _0x25591c={'raw':![],'where':{'id':_0x45d937[_0x1462('0x45')]['id']}},_0x139eca={};_0x139eca[_0x1462('0x2f')]=_['keys'](db[_0x1462('0x2b')][_0x1462('0x2c')]);_0x139eca['query']=_[_0x1462('0x31')](_0x45d937[_0x1462('0x30')]);_0x139eca[_0x1462('0x32')]=_['intersection'](_0x139eca[_0x1462('0x2f')],_0x139eca['query']);_0x25591c[_0x1462('0x33')]=_[_0x1462('0x34')](_0x139eca[_0x1462('0x2f')],qs[_0x1462('0x35')](_0x45d937[_0x1462('0x30')]['fields']));_0x25591c[_0x1462('0x33')]=_0x25591c[_0x1462('0x33')][_0x1462('0x36')]?_0x25591c['attributes']:_0x139eca[_0x1462('0x2f')];if(_0x45d937[_0x1462('0x30')][_0x1462('0x41')]){_0x25591c['include']=[{'all':!![]}];}_0x25591c=_[_0x1462('0x3d')]({},_0x25591c,_0x45d937[_0x1462('0x46')]);return db[_0x1462('0x2b')]['find'](_0x25591c)[_0x1462('0x24')](handleEntityNotFound(_0x1cb52d,null))[_0x1462('0x24')](respondWithResult(_0x1cb52d,null))[_0x1462('0x44')](handleError(_0x1cb52d,null));};exports[_0x1462('0x47')]=function(_0xd92f21,_0x434a9f){return db[_0x1462('0x2b')][_0x1462('0x47')](_0xd92f21[_0x1462('0x48')],{})[_0x1462('0x24')](respondWithResult(_0x434a9f,0xc9))[_0x1462('0x44')](handleError(_0x434a9f,null));};exports[_0x1462('0x49')]=function(_0x470a62,_0x583a36){if(_0x470a62[_0x1462('0x48')]['id']){delete _0x470a62[_0x1462('0x48')]['id'];}return db[_0x1462('0x2b')]['find']({'where':{'id':_0x470a62[_0x1462('0x45')]['id']}})['then'](handleEntityNotFound(_0x583a36,null))['then'](saveUpdates(_0x470a62[_0x1462('0x48')],null))[_0x1462('0x24')](respondWithResult(_0x583a36,null))[_0x1462('0x44')](handleError(_0x583a36,null));};exports['destroy']=function(_0x15f944,_0x162d30){return db[_0x1462('0x2b')][_0x1462('0x4a')]({'where':{'id':_0x15f944['params']['id']}})[_0x1462('0x24')](handleEntityNotFound(_0x162d30,null))[_0x1462('0x24')](removeEntity(_0x162d30,null))[_0x1462('0x44')](handleError(_0x162d30,null));};exports['describe']=function(_0x268341,_0x42ba0f){return db[_0x1462('0x2b')][_0x1462('0x4b')]()[_0x1462('0x24')](respondWithResult(_0x42ba0f,null))[_0x1462('0x44')](handleError(_0x42ba0f,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 748cff4..43b5931 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 _0xd535=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userProfileResource.attributes','define','user_profile_has_resources','resourceId','sectionId'];(function(_0x15ac38,_0x185f2e){var _0x29e92f=function(_0x50e670){while(--_0x50e670){_0x15ac38['push'](_0x15ac38['shift']());}};_0x29e92f(++_0x185f2e);}(_0xd535,0x82));var _0x5d53=function(_0x3f0d4d,_0x41824e){_0x3f0d4d=_0x3f0d4d-0x0;var _0x194976=_0xd535[_0x3f0d4d];return _0x194976;};'use strict';var _=require(_0x5d53('0x0'));var util=require('util');var logger=require(_0x5d53('0x1'))(_0x5d53('0x2'));var moment=require(_0x5d53('0x3'));var BPromise=require(_0x5d53('0x4'));var rp=require(_0x5d53('0x5'));var fs=require('fs');var path=require(_0x5d53('0x6'));var rimraf=require('rimraf');var config=require(_0x5d53('0x7'));var attributes=require(_0x5d53('0x8'));module['exports']=function(_0xb62d48,_0x4cecfe){return _0xb62d48[_0x5d53('0x9')]('UserProfileResource',attributes,{'tableName':_0x5d53('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x5d53('0xb'),_0x5d53('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e3=['define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','util','../../config/logger','api','moment','bluebird','request-promise','path','./userProfileResource.attributes','exports'];(function(_0x488818,_0x17c6de){var _0x30783c=function(_0x1b418c){while(--_0x1b418c){_0x488818['push'](_0x488818['shift']());}};_0x30783c(++_0x17c6de);}(_0xa9e3,0x17d));var _0x3a9e=function(_0x149f72,_0x113685){_0x149f72=_0x149f72-0x0;var _0x1fc2b5=_0xa9e3[_0x149f72];return _0x1fc2b5;};'use strict';var _=require('lodash');var util=require(_0x3a9e('0x0'));var logger=require(_0x3a9e('0x1'))(_0x3a9e('0x2'));var moment=require(_0x3a9e('0x3'));var BPromise=require(_0x3a9e('0x4'));var rp=require(_0x3a9e('0x5'));var fs=require('fs');var path=require(_0x3a9e('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3a9e('0x7'));module[_0x3a9e('0x8')]=function(_0x1f2a8a,_0x2dc9d5){return _0x1f2a8a[_0x3a9e('0x9')](_0x3a9e('0xa'),attributes,{'tableName':_0x3a9e('0xb'),'paranoid':![],'indexes':[{'name':_0x3a9e('0xc'),'fields':[_0x3a9e('0xd'),_0x3a9e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 2889ea6..4a9214c 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 _0x9515=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','client','then','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2bdc75,_0x1100ec){var _0x103e50=function(_0x29a0a0){while(--_0x29a0a0){_0x2bdc75['push'](_0x2bdc75['shift']());}};_0x103e50(++_0x1100ec);}(_0x9515,0x181));var _0x5951=function(_0x1fdf9d,_0x2701f9){_0x1fdf9d=_0x1fdf9d-0x0;var _0xfc041e=_0x9515[_0x1fdf9d];return _0xfc041e;};'use strict';var _=require(_0x5951('0x0'));var util=require(_0x5951('0x1'));var moment=require(_0x5951('0x2'));var BPromise=require(_0x5951('0x3'));var rs=require(_0x5951('0x4'));var fs=require('fs');var Redis=require(_0x5951('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5951('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5951('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48bcb0,_0x1a52fd,_0xe93aea){return new BPromise(function(_0x4fa79c,_0x2e158d){return client['request'](_0x48bcb0,_0xe93aea)[_0x5951('0x8')](function(_0xa57387){logger['info'](_0x5951('0x9'),_0x1a52fd,'request\x20sent');logger[_0x5951('0xa')](_0x5951('0xb'),_0x1a52fd,_0x5951('0xc'),JSON[_0x5951('0xd')](_0xa57387));if(_0xa57387[_0x5951('0xe')]){if(_0xa57387['error'][_0x5951('0xf')]===0x1f4){logger[_0x5951('0xe')](_0x5951('0x9'),_0x1a52fd,_0xa57387['error'][_0x5951('0x10')]);return _0x2e158d(_0xa57387[_0x5951('0xe')][_0x5951('0x10')]);}logger['error']('UserProfileResource,\x20%s,\x20%s',_0x1a52fd,_0xa57387['error'][_0x5951('0x10')]);return _0x4fa79c(_0xa57387[_0x5951('0xe')][_0x5951('0x10')]);}else{logger['info'](_0x5951('0x9'),_0x1a52fd,_0x5951('0xc'));_0x4fa79c(_0xa57387[_0x5951('0x11')][_0x5951('0x10')]);}})[_0x5951('0x12')](function(_0x4a9a4d){logger[_0x5951('0xe')](_0x5951('0x9'),_0x1a52fd,_0x4a9a4d);_0x2e158d(_0x4a9a4d);});});} \ No newline at end of file +var _0x5123=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x5123,0xeb));var _0x3512=function(_0x5d9f6d,_0x2f793b){_0x5d9f6d=_0x5d9f6d-0x0;var _0xe15257=_0x5123[_0x5d9f6d];return _0xe15257;};'use strict';var _=require('lodash');var util=require(_0x3512('0x0'));var moment=require(_0x3512('0x1'));var BPromise=require(_0x3512('0x2'));var rs=require(_0x3512('0x3'));var fs=require('fs');var Redis=require(_0x3512('0x4'));var db=require(_0x3512('0x5'))['db'];var utils=require(_0x3512('0x6'));var logger=require(_0x3512('0x7'))(_0x3512('0x8'));var config=require('../../config/environment');var jayson=require(_0x3512('0x9'));var client=jayson[_0x3512('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4114e3,_0x47db68,_0x4d5e3c){return new BPromise(function(_0x4a3c0b,_0x483f93){return client['request'](_0x4114e3,_0x4d5e3c)['then'](function(_0x506b53){logger[_0x3512('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x47db68,_0x3512('0xc'));logger[_0x3512('0xd')](_0x3512('0xe'),_0x47db68,'request\x20sent',JSON[_0x3512('0xf')](_0x506b53));if(_0x506b53[_0x3512('0x10')]){if(_0x506b53[_0x3512('0x10')][_0x3512('0x11')]===0x1f4){logger[_0x3512('0x10')](_0x3512('0x12'),_0x47db68,_0x506b53[_0x3512('0x10')][_0x3512('0x13')]);return _0x483f93(_0x506b53['error'][_0x3512('0x13')]);}logger[_0x3512('0x10')](_0x3512('0x12'),_0x47db68,_0x506b53[_0x3512('0x10')][_0x3512('0x13')]);return _0x4a3c0b(_0x506b53['error'][_0x3512('0x13')]);}else{logger[_0x3512('0xb')](_0x3512('0x12'),_0x47db68,_0x3512('0xc'));_0x4a3c0b(_0x506b53['result']['message']);}})['catch'](function(_0x34022c){logger[_0x3512('0x10')](_0x3512('0x12'),_0x47db68,_0x34022c);_0x483f93(_0x34022c);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 60e19c8..7a0b884 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 _0x3455=['fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','post','create','/:id','update','delete','destroy','exports','Router'];(function(_0x41cbb2,_0x57a2db){var _0x657e8a=function(_0x155933){while(--_0x155933){_0x41cbb2['push'](_0x41cbb2['shift']());}};_0x657e8a(++_0x57a2db);}(_0x3455,0x176));var _0x5345=function(_0x39428c,_0x34b23a){_0x39428c=_0x39428c-0x0;var _0x52d069=_0x3455[_0x39428c];return _0x52d069;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5345('0x0')]();var fs_extra=require(_0x5345('0x1'));var auth=require(_0x5345('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x5345('0x3'));var controller=require(_0x5345('0x4'));router[_0x5345('0x5')]('/',auth[_0x5345('0x6')](),controller[_0x5345('0x7')]);router['get']('/describe',auth[_0x5345('0x6')](),controller['describe']);router[_0x5345('0x5')]('/:id',auth[_0x5345('0x6')](),controller['show']);router[_0x5345('0x8')]('/',auth[_0x5345('0x6')](),controller[_0x5345('0x9')]);router['put'](_0x5345('0xa'),auth['isAuthenticated'](),controller[_0x5345('0xb')]);router[_0x5345('0xc')]('/:id',auth[_0x5345('0x6')](),controller[_0x5345('0xd')]);module[_0x5345('0xe')]=router; \ No newline at end of file +var _0xbe46=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','/describe','/:id','show','post','create','put','isAuthenticated','update','delete','path','express','Router','fs-extra'];(function(_0x48bb3e,_0x47f1e0){var _0x244da0=function(_0x1d2751){while(--_0x1d2751){_0x48bb3e['push'](_0x48bb3e['shift']());}};_0x244da0(++_0x47f1e0);}(_0xbe46,0x68));var _0x6be4=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xbe46[_0x521929];return _0x632436;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6be4('0x0'));var timeout=require('connect-timeout');var express=require(_0x6be4('0x1'));var router=express[_0x6be4('0x2')]();var fs_extra=require(_0x6be4('0x3'));var auth=require(_0x6be4('0x4'));var interaction=require(_0x6be4('0x5'));var config=require(_0x6be4('0x6'));var controller=require(_0x6be4('0x7'));router[_0x6be4('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6be4('0x8')](_0x6be4('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x6be4('0x8')](_0x6be4('0xa'),auth['isAuthenticated'](),controller[_0x6be4('0xb')]);router[_0x6be4('0xc')]('/',auth['isAuthenticated'](),controller[_0x6be4('0xd')]);router[_0x6be4('0xe')](_0x6be4('0xa'),auth[_0x6be4('0xf')](),controller[_0x6be4('0x10')]);router[_0x6be4('0x11')](_0x6be4('0xa'),auth[_0x6be4('0xf')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 487d71d..00093b9 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 _0xf725=['BOOLEAN','setDataValue','join','getDataValue','crudPermissions','split','sequelize','exports','STRING','INTEGER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf725,0x7e));var _0x5f72=function(_0xa8064d,_0x312553){_0xa8064d=_0xa8064d-0x0;var _0xdcaf7d=_0xf725[_0xa8064d];return _0xdcaf7d;};'use strict';var Sequelize=require(_0x5f72('0x0'));module[_0x5f72('0x1')]={'name':{'type':Sequelize[_0x5f72('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x5f72('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x5f72('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x5f72('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x5f72('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x5f72('0x2')],'set':function(_0x4200ff){this[_0x5f72('0x5')]('crudPermissions',_0x4200ff?_0x4200ff[_0x5f72('0x6')](''):[]);},'get':function(){return this[_0x5f72('0x7')](_0x5f72('0x8'))?this[_0x5f72('0x7')](_0x5f72('0x8'))[_0x5f72('0x9')](''):[];}}}; \ No newline at end of file +var _0x9ade=['getDataValue','split','sequelize','exports','INTEGER','BOOLEAN','STRING','crudPermissions','join'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x9ade,0x107));var _0xe9ad=function(_0x11e1ef,_0x3cbe5e){_0x11e1ef=_0x11e1ef-0x0;var _0x125d5b=_0x9ade[_0x11e1ef];return _0x125d5b;};'use strict';var Sequelize=require(_0xe9ad('0x0'));module[_0xe9ad('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xe9ad('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xe9ad('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xe9ad('0x4')],'set':function(_0x4d4ee0){this['setDataValue'](_0xe9ad('0x5'),_0x4d4ee0?_0x4d4ee0[_0xe9ad('0x6')](''):[]);},'get':function(){return this[_0xe9ad('0x7')](_0xe9ad('0x5'))?this[_0xe9ad('0x7')](_0xe9ad('0x5'))[_0xe9ad('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 4f6ae68..8a9e2a2 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 _0xdfb4=['sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','map','UserProfileSection','rawAttributes','fieldName','type','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','show','params','intersection','include','options','catch','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path'];(function(_0x24ee86,_0x33ad9d){var _0x107331=function(_0x56526c){while(--_0x56526c){_0x24ee86['push'](_0x24ee86['shift']());}};_0x107331(++_0x33ad9d);}(_0xdfb4,0xe4));var _0x4dfb=function(_0x43eeaa,_0x26de51){_0x43eeaa=_0x43eeaa-0x0;var _0x57a0ac=_0xdfb4[_0x43eeaa];return _0x57a0ac;};'use strict';var pdf=require(_0x4dfb('0x0'));var emlformat=require(_0x4dfb('0x1'));var rimraf=require(_0x4dfb('0x2'));var zipdir=require(_0x4dfb('0x3'));var jsonpatch=require(_0x4dfb('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4dfb('0x5'));var Mustache=require(_0x4dfb('0x6'));var util=require(_0x4dfb('0x7'));var path=require(_0x4dfb('0x8'));var sox=require(_0x4dfb('0x9'));var csv=require(_0x4dfb('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4dfb('0xb'));var _=require(_0x4dfb('0xc'));var squel=require(_0x4dfb('0xd'));var crypto=require(_0x4dfb('0xe'));var jsforce=require(_0x4dfb('0xf'));var deskjs=require(_0x4dfb('0x10'));var toCsv=require(_0x4dfb('0xa'));var querystring=require(_0x4dfb('0x11'));var Papa=require(_0x4dfb('0x12'));var Redis=require(_0x4dfb('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x4dfb('0x14'));var as=require(_0x4dfb('0x15'));var hardwareService=require(_0x4dfb('0x16'));var logger=require(_0x4dfb('0x17'))(_0x4dfb('0x18'));var utils=require(_0x4dfb('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x4dfb('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4565c5,_0x3485b0){_0x3485b0=_0x3485b0||0xcc;return function(_0x41fb2b){if(_0x41fb2b){return _0x4565c5['sendStatus'](_0x3485b0);}return _0x4565c5[_0x4dfb('0x1b')](_0x3485b0)[_0x4dfb('0x1c')]();};}function respondWithResult(_0x4d4422,_0x210f62){_0x210f62=_0x210f62||0xc8;return function(_0x380da7){if(_0x380da7){return _0x4d4422[_0x4dfb('0x1b')](_0x210f62)[_0x4dfb('0x1d')](_0x380da7);}};}function respondWithFilteredResult(_0x7cfd12,_0x49638d){return function(_0x33477c){if(_0x33477c){var _0x441a53=_0x33477c[_0x4dfb('0x1e')],_0x47234f=_0x49638d['offset'],_0x326e31=_0x49638d[_0x4dfb('0x1f')]+_0x49638d[_0x4dfb('0x20')],_0x1c94bb;if(_0x326e31>=_0x441a53){_0x326e31=_0x441a53;_0x1c94bb=0xc8;}else{_0x1c94bb=0xce;}_0x7cfd12[_0x4dfb('0x1b')](_0x1c94bb);return _0x7cfd12[_0x4dfb('0x21')](_0x4dfb('0x22'),_0x47234f+'-'+_0x326e31+'/'+_0x441a53)['json'](_0x33477c);}return null;};}function patchUpdates(_0x7c8f60){return function(_0x3cf3b3){try{jsonpatch[_0x4dfb('0x23')](_0x3cf3b3,_0x7c8f60,!![]);}catch(_0x423fef){return BPromise[_0x4dfb('0x24')](_0x423fef);}return _0x3cf3b3[_0x4dfb('0x25')]();};}function saveUpdates(_0x924723,_0xb15727){return function(_0x25f3fc){if(_0x25f3fc){return _0x25f3fc[_0x4dfb('0x26')](_0x924723)['then'](function(_0x333300){return _0x333300;});}return null;};}function removeEntity(_0x4311a7,_0x3257f8){return function(_0x1f96fc){if(_0x1f96fc){return _0x1f96fc['destroy']()[_0x4dfb('0x27')](function(){_0x4311a7[_0x4dfb('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19f67b,_0x56e94b){return function(_0x175f2d){if(!_0x175f2d){_0x19f67b[_0x4dfb('0x28')](0x194);}return _0x175f2d;};}function handleError(_0xd025c0,_0x88e9fd){_0x88e9fd=_0x88e9fd||0x1f4;return function(_0x506df3){logger[_0x4dfb('0x29')](_0x506df3[_0x4dfb('0x2a')]);if(_0x506df3[_0x4dfb('0x2b')]){delete _0x506df3[_0x4dfb('0x2b')];}_0xd025c0['status'](_0x88e9fd)[_0x4dfb('0x2c')](_0x506df3);};}exports['index']=function(_0x19fd14,_0x49dea2){var _0xc8fd03={},_0x4b7979={},_0x341522={'count':0x0,'rows':[]};var _0x15976a=_[_0x4dfb('0x2d')](db[_0x4dfb('0x2e')][_0x4dfb('0x2f')],function(_0x346fc8){return{'name':_0x346fc8[_0x4dfb('0x30')],'type':_0x346fc8[_0x4dfb('0x31')]['key']};});_0x4b7979['model']=_['map'](_0x15976a,'name');_0x4b7979[_0x4dfb('0x32')]=_[_0x4dfb('0x33')](_0x19fd14[_0x4dfb('0x32')]);_0x4b7979[_0x4dfb('0x34')]=_['intersection'](_0x4b7979[_0x4dfb('0x35')],_0x4b7979[_0x4dfb('0x32')]);_0xc8fd03['attributes']=_['intersection'](_0x4b7979['model'],qs[_0x4dfb('0x36')](_0x19fd14[_0x4dfb('0x32')][_0x4dfb('0x36')]));_0xc8fd03[_0x4dfb('0x37')]=_0xc8fd03[_0x4dfb('0x37')][_0x4dfb('0x38')]?_0xc8fd03['attributes']:_0x4b7979[_0x4dfb('0x35')];if(!_0x19fd14['query'][_0x4dfb('0x39')](_0x4dfb('0x3a'))){_0xc8fd03[_0x4dfb('0x20')]=qs[_0x4dfb('0x20')](_0x19fd14['query'][_0x4dfb('0x20')]);_0xc8fd03[_0x4dfb('0x1f')]=qs[_0x4dfb('0x1f')](_0x19fd14[_0x4dfb('0x32')][_0x4dfb('0x1f')]);}_0xc8fd03[_0x4dfb('0x3b')]=qs[_0x4dfb('0x3c')](_0x19fd14[_0x4dfb('0x32')][_0x4dfb('0x3c')]);_0xc8fd03[_0x4dfb('0x3d')]=qs[_0x4dfb('0x34')](_[_0x4dfb('0x3e')](_0x19fd14[_0x4dfb('0x32')],_0x4b7979[_0x4dfb('0x34')]),_0x15976a);if(_0x19fd14[_0x4dfb('0x32')][_0x4dfb('0x3f')]){_0xc8fd03[_0x4dfb('0x3d')]=_[_0x4dfb('0x40')](_0xc8fd03[_0x4dfb('0x3d')],{'$or':_[_0x4dfb('0x2d')](_0x15976a,function(_0x524556){if(_0x524556[_0x4dfb('0x31')]!=='VIRTUAL'){var _0x3cb04b={};_0x3cb04b[_0x524556[_0x4dfb('0x2b')]]={'$like':'%'+_0x19fd14[_0x4dfb('0x32')][_0x4dfb('0x3f')]+'%'};return _0x3cb04b;}})});}_0xc8fd03=_[_0x4dfb('0x40')]({},_0xc8fd03,_0x19fd14['options']);var _0x31d1b8={'where':_0xc8fd03[_0x4dfb('0x3d')]};return db['UserProfileSection'][_0x4dfb('0x1e')](_0x31d1b8)[_0x4dfb('0x27')](function(_0x162982){_0x341522[_0x4dfb('0x1e')]=_0x162982;if(_0x19fd14[_0x4dfb('0x32')][_0x4dfb('0x41')]){_0xc8fd03['include']=[{'all':!![]}];}return db[_0x4dfb('0x2e')][_0x4dfb('0x42')](_0xc8fd03);})[_0x4dfb('0x27')](function(_0x186a6c){_0x341522[_0x4dfb('0x43')]=_0x186a6c;return _0x341522;})['then'](respondWithFilteredResult(_0x49dea2,_0xc8fd03))['catch'](handleError(_0x49dea2,null));};exports[_0x4dfb('0x44')]=function(_0x450bb3,_0x21e104){var _0x316ab1={'raw':![],'where':{'id':_0x450bb3[_0x4dfb('0x45')]['id']}},_0x430a00={};_0x430a00[_0x4dfb('0x35')]=_[_0x4dfb('0x33')](db['UserProfileSection'][_0x4dfb('0x2f')]);_0x430a00['query']=_['keys'](_0x450bb3['query']);_0x430a00['filters']=_['intersection'](_0x430a00[_0x4dfb('0x35')],_0x430a00[_0x4dfb('0x32')]);_0x316ab1[_0x4dfb('0x37')]=_[_0x4dfb('0x46')](_0x430a00[_0x4dfb('0x35')],qs[_0x4dfb('0x36')](_0x450bb3['query']['fields']));_0x316ab1['attributes']=_0x316ab1[_0x4dfb('0x37')][_0x4dfb('0x38')]?_0x316ab1[_0x4dfb('0x37')]:_0x430a00[_0x4dfb('0x35')];if(_0x450bb3['query'][_0x4dfb('0x41')]){_0x316ab1[_0x4dfb('0x47')]=[{'all':!![]}];}_0x316ab1=_[_0x4dfb('0x40')]({},_0x316ab1,_0x450bb3[_0x4dfb('0x48')]);return db[_0x4dfb('0x2e')]['find'](_0x316ab1)[_0x4dfb('0x27')](handleEntityNotFound(_0x21e104,null))[_0x4dfb('0x27')](respondWithResult(_0x21e104,null))[_0x4dfb('0x49')](handleError(_0x21e104,null));};exports[_0x4dfb('0x4a')]=function(_0x423269,_0x562a33){return db['UserProfileSection'][_0x4dfb('0x4a')](_0x423269[_0x4dfb('0x4b')],{})[_0x4dfb('0x27')](respondWithResult(_0x562a33,0xc9))['catch'](handleError(_0x562a33,null));};exports['update']=function(_0x518b9b,_0x316c55){if(_0x518b9b[_0x4dfb('0x4b')]['id']){delete _0x518b9b[_0x4dfb('0x4b')]['id'];}return db['UserProfileSection'][_0x4dfb('0x4c')]({'where':{'id':_0x518b9b[_0x4dfb('0x45')]['id']}})[_0x4dfb('0x27')](handleEntityNotFound(_0x316c55,null))[_0x4dfb('0x27')](saveUpdates(_0x518b9b[_0x4dfb('0x4b')],null))[_0x4dfb('0x27')](respondWithResult(_0x316c55,null))[_0x4dfb('0x49')](handleError(_0x316c55,null));};exports[_0x4dfb('0x4d')]=function(_0x2ef609,_0x31dc55){return db[_0x4dfb('0x2e')][_0x4dfb('0x4c')]({'where':{'id':_0x2ef609[_0x4dfb('0x45')]['id']}})['then'](handleEntityNotFound(_0x31dc55,null))[_0x4dfb('0x27')](removeEntity(_0x31dc55,null))[_0x4dfb('0x49')](handleError(_0x31dc55,null));};exports[_0x4dfb('0x4e')]=function(_0x29029a,_0x49bffa){return db['UserProfileSection']['describe']()[_0x4dfb('0x27')](respondWithResult(_0x49bffa,null))['catch'](handleError(_0x49bffa,null));}; \ No newline at end of file +var _0x698b=['offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','UserProfileSection','rawAttributes','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','include','findAll','catch','show','params','intersection','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end'];(function(_0x6cbe6d,_0x37bba3){var _0x25e1c9=function(_0x2f8868){while(--_0x2f8868){_0x6cbe6d['push'](_0x6cbe6d['shift']());}};_0x25e1c9(++_0x37bba3);}(_0x698b,0x115));var _0xb698=function(_0x13b255,_0x2a3c52){_0x13b255=_0x13b255-0x0;var _0x48a5a6=_0x698b[_0x13b255];return _0x48a5a6;};'use strict';var pdf=require(_0xb698('0x0'));var emlformat=require(_0xb698('0x1'));var rimraf=require(_0xb698('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb698('0x3'));var rp=require('request-promise');var moment=require(_0xb698('0x4'));var BPromise=require(_0xb698('0x5'));var Mustache=require('mustache');var util=require(_0xb698('0x6'));var path=require(_0xb698('0x7'));var sox=require(_0xb698('0x8'));var csv=require(_0xb698('0x9'));var ejs=require(_0xb698('0xa'));var fs=require('fs');var fs_extra=require(_0xb698('0xb'));var _=require(_0xb698('0xc'));var squel=require(_0xb698('0xd'));var crypto=require(_0xb698('0xe'));var jsforce=require(_0xb698('0xf'));var deskjs=require(_0xb698('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb698('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb698('0x12'));var as=require(_0xb698('0x13'));var hardwareService=require(_0xb698('0x14'));var logger=require('../../config/logger')(_0xb698('0x15'));var utils=require('../../config/utils');var config=require(_0xb698('0x16'));var licenseUtil=require(_0xb698('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x471148,_0x48ed00){_0x48ed00=_0x48ed00||0xcc;return function(_0x57a86d){if(_0x57a86d){return _0x471148[_0xb698('0x18')](_0x48ed00);}return _0x471148[_0xb698('0x19')](_0x48ed00)[_0xb698('0x1a')]();};}function respondWithResult(_0x5929fd,_0x19142c){_0x19142c=_0x19142c||0xc8;return function(_0x2eddc9){if(_0x2eddc9){return _0x5929fd[_0xb698('0x19')](_0x19142c)['json'](_0x2eddc9);}};}function respondWithFilteredResult(_0x6663d5,_0x48089e){return function(_0x536a47){if(_0x536a47){var _0x5e8822=_0x536a47['count'],_0x51021a=_0x48089e[_0xb698('0x1b')],_0x7e9567=_0x48089e[_0xb698('0x1b')]+_0x48089e[_0xb698('0x1c')],_0x470ab2;if(_0x7e9567>=_0x5e8822){_0x7e9567=_0x5e8822;_0x470ab2=0xc8;}else{_0x470ab2=0xce;}_0x6663d5[_0xb698('0x19')](_0x470ab2);return _0x6663d5[_0xb698('0x1d')](_0xb698('0x1e'),_0x51021a+'-'+_0x7e9567+'/'+_0x5e8822)[_0xb698('0x1f')](_0x536a47);}return null;};}function patchUpdates(_0x3a739a){return function(_0x2cabed){try{jsonpatch[_0xb698('0x20')](_0x2cabed,_0x3a739a,!![]);}catch(_0x321e05){return BPromise[_0xb698('0x21')](_0x321e05);}return _0x2cabed[_0xb698('0x22')]();};}function saveUpdates(_0x503b63,_0xc13bd){return function(_0x5c6087){if(_0x5c6087){return _0x5c6087[_0xb698('0x23')](_0x503b63)[_0xb698('0x24')](function(_0x37e9c2){return _0x37e9c2;});}return null;};}function removeEntity(_0x565101,_0xa2a21c){return function(_0x1373a2){if(_0x1373a2){return _0x1373a2[_0xb698('0x25')]()[_0xb698('0x24')](function(){_0x565101[_0xb698('0x19')](0xcc)[_0xb698('0x1a')]();});}};}function handleEntityNotFound(_0x3fff57,_0x20e912){return function(_0x1a68c9){if(!_0x1a68c9){_0x3fff57[_0xb698('0x18')](0x194);}return _0x1a68c9;};}function handleError(_0x42e811,_0x31333b){_0x31333b=_0x31333b||0x1f4;return function(_0x55d9a3){logger[_0xb698('0x26')](_0x55d9a3[_0xb698('0x27')]);if(_0x55d9a3[_0xb698('0x28')]){delete _0x55d9a3[_0xb698('0x28')];}_0x42e811[_0xb698('0x19')](_0x31333b)[_0xb698('0x29')](_0x55d9a3);};}exports[_0xb698('0x2a')]=function(_0x35a2a3,_0x7f8e9){var _0x9d71d1={},_0xd1b89f={},_0x3e4e3a={'count':0x0,'rows':[]};var _0x5b3dbf=_['map'](db[_0xb698('0x2b')][_0xb698('0x2c')],function(_0x18aec4){return{'name':_0x18aec4['fieldName'],'type':_0x18aec4[_0xb698('0x2d')][_0xb698('0x2e')]};});_0xd1b89f[_0xb698('0x2f')]=_[_0xb698('0x30')](_0x5b3dbf,_0xb698('0x28'));_0xd1b89f[_0xb698('0x31')]=_[_0xb698('0x32')](_0x35a2a3[_0xb698('0x31')]);_0xd1b89f[_0xb698('0x33')]=_['intersection'](_0xd1b89f[_0xb698('0x2f')],_0xd1b89f[_0xb698('0x31')]);_0x9d71d1[_0xb698('0x34')]=_['intersection'](_0xd1b89f['model'],qs['fields'](_0x35a2a3[_0xb698('0x31')][_0xb698('0x35')]));_0x9d71d1[_0xb698('0x34')]=_0x9d71d1['attributes'][_0xb698('0x36')]?_0x9d71d1[_0xb698('0x34')]:_0xd1b89f[_0xb698('0x2f')];if(!_0x35a2a3[_0xb698('0x31')][_0xb698('0x37')](_0xb698('0x38'))){_0x9d71d1[_0xb698('0x1c')]=qs['limit'](_0x35a2a3[_0xb698('0x31')]['limit']);_0x9d71d1['offset']=qs[_0xb698('0x1b')](_0x35a2a3[_0xb698('0x31')]['offset']);}_0x9d71d1[_0xb698('0x39')]=qs[_0xb698('0x3a')](_0x35a2a3[_0xb698('0x31')][_0xb698('0x3a')]);_0x9d71d1[_0xb698('0x3b')]=qs['filters'](_['pick'](_0x35a2a3[_0xb698('0x31')],_0xd1b89f['filters']),_0x5b3dbf);if(_0x35a2a3[_0xb698('0x31')][_0xb698('0x3c')]){_0x9d71d1[_0xb698('0x3b')]=_[_0xb698('0x3d')](_0x9d71d1['where'],{'$or':_[_0xb698('0x30')](_0x5b3dbf,function(_0x51802e){if(_0x51802e[_0xb698('0x2d')]!==_0xb698('0x3e')){var _0x216b91={};_0x216b91[_0x51802e[_0xb698('0x28')]]={'$like':'%'+_0x35a2a3[_0xb698('0x31')][_0xb698('0x3c')]+'%'};return _0x216b91;}})});}_0x9d71d1=_[_0xb698('0x3d')]({},_0x9d71d1,_0x35a2a3[_0xb698('0x3f')]);var _0x420292={'where':_0x9d71d1[_0xb698('0x3b')]};return db['UserProfileSection'][_0xb698('0x40')](_0x420292)[_0xb698('0x24')](function(_0xa6d634){_0x3e4e3a['count']=_0xa6d634;if(_0x35a2a3[_0xb698('0x31')]['includeAll']){_0x9d71d1[_0xb698('0x41')]=[{'all':!![]}];}return db['UserProfileSection'][_0xb698('0x42')](_0x9d71d1);})[_0xb698('0x24')](function(_0x3c04e1){_0x3e4e3a['rows']=_0x3c04e1;return _0x3e4e3a;})[_0xb698('0x24')](respondWithFilteredResult(_0x7f8e9,_0x9d71d1))[_0xb698('0x43')](handleError(_0x7f8e9,null));};exports[_0xb698('0x44')]=function(_0x22be03,_0x536d2f){var _0x6c1522={'raw':![],'where':{'id':_0x22be03[_0xb698('0x45')]['id']}},_0x469129={};_0x469129[_0xb698('0x2f')]=_[_0xb698('0x32')](db['UserProfileSection'][_0xb698('0x2c')]);_0x469129['query']=_[_0xb698('0x32')](_0x22be03[_0xb698('0x31')]);_0x469129[_0xb698('0x33')]=_[_0xb698('0x46')](_0x469129['model'],_0x469129['query']);_0x6c1522[_0xb698('0x34')]=_[_0xb698('0x46')](_0x469129[_0xb698('0x2f')],qs[_0xb698('0x35')](_0x22be03['query'][_0xb698('0x35')]));_0x6c1522['attributes']=_0x6c1522[_0xb698('0x34')][_0xb698('0x36')]?_0x6c1522[_0xb698('0x34')]:_0x469129[_0xb698('0x2f')];if(_0x22be03[_0xb698('0x31')][_0xb698('0x47')]){_0x6c1522[_0xb698('0x41')]=[{'all':!![]}];}_0x6c1522=_[_0xb698('0x3d')]({},_0x6c1522,_0x22be03['options']);return db[_0xb698('0x2b')][_0xb698('0x48')](_0x6c1522)[_0xb698('0x24')](handleEntityNotFound(_0x536d2f,null))[_0xb698('0x24')](respondWithResult(_0x536d2f,null))['catch'](handleError(_0x536d2f,null));};exports[_0xb698('0x49')]=function(_0x441c1f,_0x597da5){return db[_0xb698('0x2b')][_0xb698('0x49')](_0x441c1f['body'],{})[_0xb698('0x24')](respondWithResult(_0x597da5,0xc9))[_0xb698('0x43')](handleError(_0x597da5,null));};exports[_0xb698('0x23')]=function(_0x5d5fdd,_0x41c234){if(_0x5d5fdd['body']['id']){delete _0x5d5fdd[_0xb698('0x4a')]['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x5d5fdd[_0xb698('0x45')]['id']}})[_0xb698('0x24')](handleEntityNotFound(_0x41c234,null))[_0xb698('0x24')](saveUpdates(_0x5d5fdd[_0xb698('0x4a')],null))['then'](respondWithResult(_0x41c234,null))[_0xb698('0x43')](handleError(_0x41c234,null));};exports[_0xb698('0x25')]=function(_0x20191e,_0x262e16){return db[_0xb698('0x2b')][_0xb698('0x48')]({'where':{'id':_0x20191e[_0xb698('0x45')]['id']}})[_0xb698('0x24')](handleEntityNotFound(_0x262e16,null))[_0xb698('0x24')](removeEntity(_0x262e16,null))['catch'](handleError(_0x262e16,null));};exports[_0xb698('0x4b')]=function(_0x1fe003,_0x42037b){return db[_0xb698('0x2b')][_0xb698('0x4b')]()['then'](respondWithResult(_0x42037b,null))[_0xb698('0x43')](handleError(_0x42037b,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index d75dcbb..5142f56 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 _0x2f03=['compositeIndex','sectionId','userProfileId','util','api','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x27d958,_0x29ef87){var _0x53e63e=function(_0x4130ec){while(--_0x4130ec){_0x27d958['push'](_0x27d958['shift']());}};_0x53e63e(++_0x29ef87);}(_0x2f03,0xfd));var _0x32f0=function(_0x30eb95,_0x206ba3){_0x30eb95=_0x30eb95-0x0;var _0x273d14=_0x2f03[_0x30eb95];return _0x273d14;};'use strict';var _=require('lodash');var util=require(_0x32f0('0x0'));var logger=require('../../config/logger')(_0x32f0('0x1'));var moment=require('moment');var BPromise=require(_0x32f0('0x2'));var rp=require(_0x32f0('0x3'));var fs=require('fs');var path=require(_0x32f0('0x4'));var rimraf=require('rimraf');var config=require(_0x32f0('0x5'));var attributes=require('./userProfileSection.attributes');module[_0x32f0('0x6')]=function(_0x4e13b1,_0x4e1582){return _0x4e13b1['define']('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x32f0('0x7'),'fields':[_0x32f0('0x8'),_0x32f0('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc48a=['request-promise','path','rimraf','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','util','../../config/logger','api','moment','bluebird'];(function(_0x5607f9,_0x2d9756){var _0xca6370=function(_0x1a057d){while(--_0x1a057d){_0x5607f9['push'](_0x5607f9['shift']());}};_0xca6370(++_0x2d9756);}(_0xc48a,0x1ea));var _0xac48=function(_0x3f78c1,_0xf47030){_0x3f78c1=_0x3f78c1-0x0;var _0x3e8c28=_0xc48a[_0x3f78c1];return _0x3e8c28;};'use strict';var _=require('lodash');var util=require(_0xac48('0x0'));var logger=require(_0xac48('0x1'))(_0xac48('0x2'));var moment=require(_0xac48('0x3'));var BPromise=require(_0xac48('0x4'));var rp=require(_0xac48('0x5'));var fs=require('fs');var path=require(_0xac48('0x6'));var rimraf=require(_0xac48('0x7'));var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module[_0xac48('0x8')]=function(_0x21efd1,_0x2e4321){return _0x21efd1[_0xac48('0x9')](_0xac48('0xa'),attributes,{'tableName':_0xac48('0xb'),'paranoid':![],'indexes':[{'name':_0xac48('0xc'),'fields':[_0xac48('0xd'),_0xac48('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index e063292..b333ba3 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 _0x2563=['stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5eb949,_0x373aba){var _0x340f76=function(_0x436690){while(--_0x436690){_0x5eb949['push'](_0x5eb949['shift']());}};_0x340f76(++_0x373aba);}(_0x2563,0x75));var _0x3256=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2563[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3256('0x0'));var util=require(_0x3256('0x1'));var moment=require(_0x3256('0x2'));var BPromise=require(_0x3256('0x3'));var rs=require(_0x3256('0x4'));var fs=require('fs');var Redis=require(_0x3256('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3256('0x6'));var logger=require(_0x3256('0x7'))('rpc');var config=require(_0x3256('0x8'));var jayson=require(_0x3256('0x9'));var client=jayson['client'][_0x3256('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31d4f2,_0x423121,_0x3c7b2e){return new BPromise(function(_0x47164f,_0x492ce6){return client['request'](_0x31d4f2,_0x3c7b2e)['then'](function(_0x49a81d){logger[_0x3256('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x423121,'request\x20sent');logger[_0x3256('0xc')](_0x3256('0xd'),_0x423121,_0x3256('0xe'),JSON[_0x3256('0xf')](_0x49a81d));if(_0x49a81d[_0x3256('0x10')]){if(_0x49a81d['error'][_0x3256('0x11')]===0x1f4){logger[_0x3256('0x10')](_0x3256('0x12'),_0x423121,_0x49a81d['error'][_0x3256('0x13')]);return _0x492ce6(_0x49a81d[_0x3256('0x10')][_0x3256('0x13')]);}logger['error'](_0x3256('0x12'),_0x423121,_0x49a81d[_0x3256('0x10')]['message']);return _0x47164f(_0x49a81d[_0x3256('0x10')][_0x3256('0x13')]);}else{logger[_0x3256('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x423121,_0x3256('0xe'));_0x47164f(_0x49a81d[_0x3256('0x14')]['message']);}})[_0x3256('0x15')](function(_0x160fb4){logger[_0x3256('0x10')](_0x3256('0x12'),_0x423121,_0x160fb4);_0x492ce6(_0x160fb4);});});} \ No newline at end of file +var _0x8ea3=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s'];(function(_0x120bc2,_0x57a253){var _0x454a41=function(_0x21adfe){while(--_0x21adfe){_0x120bc2['push'](_0x120bc2['shift']());}};_0x454a41(++_0x57a253);}(_0x8ea3,0x192));var _0x38ea=function(_0x307949,_0x128256){_0x307949=_0x307949-0x0;var _0x45b4f2=_0x8ea3[_0x307949];return _0x45b4f2;};'use strict';var _=require(_0x38ea('0x0'));var util=require(_0x38ea('0x1'));var moment=require(_0x38ea('0x2'));var BPromise=require('bluebird');var rs=require(_0x38ea('0x3'));var fs=require('fs');var Redis=require(_0x38ea('0x4'));var db=require(_0x38ea('0x5'))['db'];var utils=require(_0x38ea('0x6'));var logger=require(_0x38ea('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x38ea('0x8')][_0x38ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15fb5b,_0xe01583,_0xe218d9){return new BPromise(function(_0x40da8f,_0x2a2121){return client[_0x38ea('0xa')](_0x15fb5b,_0xe218d9)[_0x38ea('0xb')](function(_0x4518c5){logger[_0x38ea('0xc')](_0x38ea('0xd'),_0xe01583,_0x38ea('0xe'));logger['debug'](_0x38ea('0xf'),_0xe01583,_0x38ea('0xe'),JSON[_0x38ea('0x10')](_0x4518c5));if(_0x4518c5[_0x38ea('0x11')]){if(_0x4518c5[_0x38ea('0x11')][_0x38ea('0x12')]===0x1f4){logger[_0x38ea('0x11')](_0x38ea('0xd'),_0xe01583,_0x4518c5[_0x38ea('0x11')][_0x38ea('0x13')]);return _0x2a2121(_0x4518c5['error'][_0x38ea('0x13')]);}logger[_0x38ea('0x11')](_0x38ea('0xd'),_0xe01583,_0x4518c5[_0x38ea('0x11')]['message']);return _0x40da8f(_0x4518c5['error'][_0x38ea('0x13')]);}else{logger[_0x38ea('0xc')](_0x38ea('0xd'),_0xe01583,_0x38ea('0xe'));_0x40da8f(_0x4518c5[_0x38ea('0x14')]['message']);}})[_0x38ea('0x15')](function(_0x4f56a3){logger['error'](_0x38ea('0xd'),_0xe01583,_0x4f56a3);_0x2a2121(_0x4f56a3);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 257914a..1abfc8a 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 _0xd3a8=['../../components/interaction/service','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0xd39959,_0x302d09){var _0x1ff69c=function(_0x17c97f){while(--_0x17c97f){_0xd39959['push'](_0xd39959['shift']());}};_0x1ff69c(++_0x302d09);}(_0xd3a8,0x135));var _0x8d3a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd3a8[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x8d3a('0x0'));var util=require('util');var path=require(_0x8d3a('0x1'));var timeout=require(_0x8d3a('0x2'));var express=require(_0x8d3a('0x3'));var router=express[_0x8d3a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8d3a('0x5'));var interaction=require(_0x8d3a('0x6'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x5eef=['../../config/environment','exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4aa3f6,_0x4cb7a6){var _0x4a9302=function(_0x423f87){while(--_0x423f87){_0x4aa3f6['push'](_0x4aa3f6['shift']());}};_0x4a9302(++_0x4cb7a6);}(_0x5eef,0x9c));var _0xf5ee=function(_0x131ecb,_0xee3761){_0x131ecb=_0x131ecb-0x0;var _0x464e12=_0x5eef[_0x131ecb];return _0x464e12;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf5ee('0x0'));var timeout=require('connect-timeout');var express=require(_0xf5ee('0x1'));var router=express['Router']();var fs_extra=require(_0xf5ee('0x2'));var auth=require(_0xf5ee('0x3'));var interaction=require(_0xf5ee('0x4'));var config=require(_0xf5ee('0x5'));module[_0xf5ee('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 3564dfa..f32f80e 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 _0xbaf0=['exports','INTEGER'];(function(_0x4cfc1d,_0x2c0927){var _0x1c01a0=function(_0x264a74){while(--_0x264a74){_0x4cfc1d['push'](_0x4cfc1d['shift']());}};_0x1c01a0(++_0x2c0927);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x28a54a,_0x4b5999){var _0x2cfc12=function(_0x1396f6){while(--_0x1396f6){_0x28a54a['push'](_0x28a54a['shift']());}};_0x2cfc12(++_0x4b5999);}(_0xe706,0xa3));var _0x6e70=function(_0x4ab6a1,_0x4d64d5){_0x4ab6a1=_0x4ab6a1-0x0;var _0x2a24cc=_0xe706[_0x4ab6a1];return _0x2a24cc;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('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 a8797d1..343b291 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 _0x5775=['exports','define','UserSmsQueue','user_has_sms_queues','lodash','../../config/logger','path','rimraf','../../config/environment'];(function(_0x27ed41,_0xb780a1){var _0x507934=function(_0x1f09ab){while(--_0x1f09ab){_0x27ed41['push'](_0x27ed41['shift']());}};_0x507934(++_0xb780a1);}(_0x5775,0x1bd));var _0x5577=function(_0x1488cd,_0x25a893){_0x1488cd=_0x1488cd-0x0;var _0x63fa13=_0x5775[_0x1488cd];return _0x63fa13;};'use strict';var _=require(_0x5577('0x0'));var util=require('util');var logger=require(_0x5577('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5577('0x2'));var rimraf=require(_0x5577('0x3'));var config=require(_0x5577('0x4'));var attributes=require('./userSmsQueue.attributes');module[_0x5577('0x5')]=function(_0x2d8ee6,_0x3538f8){return _0x2d8ee6[_0x5577('0x6')](_0x5577('0x7'),attributes,{'tableName':_0x5577('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd87=['bluebird','request-promise','path','rimraf','./userSmsQueue.attributes','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment'];(function(_0xa42969,_0x2e6ecf){var _0x33d393=function(_0xbceca4){while(--_0xbceca4){_0xa42969['push'](_0xa42969['shift']());}};_0x33d393(++_0x2e6ecf);}(_0xbd87,0x1e7));var _0x7bd8=function(_0x290907,_0x1e8855){_0x290907=_0x290907-0x0;var _0x4d5e48=_0xbd87[_0x290907];return _0x4d5e48;};'use strict';var _=require(_0x7bd8('0x0'));var util=require(_0x7bd8('0x1'));var logger=require(_0x7bd8('0x2'))(_0x7bd8('0x3'));var moment=require(_0x7bd8('0x4'));var BPromise=require(_0x7bd8('0x5'));var rp=require(_0x7bd8('0x6'));var fs=require('fs');var path=require(_0x7bd8('0x7'));var rimraf=require(_0x7bd8('0x8'));var config=require('../../config/environment');var attributes=require(_0x7bd8('0x9'));module['exports']=function(_0x399a72,_0x4341b3){return _0x399a72['define'](_0x7bd8('0xa'),attributes,{'tableName':_0x7bd8('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 65625da..fe0399a 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 _0x439b=['rpc','../../config/environment','jayson/promise','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x4fce48,_0x2d5d19){var _0x1ce81f=function(_0x3bafab){while(--_0x3bafab){_0x4fce48['push'](_0x4fce48['shift']());}};_0x1ce81f(++_0x2d5d19);}(_0x439b,0x158));var _0xb439=function(_0x4f7757,_0x387028){_0x4f7757=_0x4f7757-0x0;var _0x5cfb87=_0x439b[_0x4f7757];return _0x5cfb87;};'use strict';var _=require(_0xb439('0x0'));var util=require(_0xb439('0x1'));var moment=require(_0xb439('0x2'));var BPromise=require(_0xb439('0x3'));var rs=require(_0xb439('0x4'));var fs=require('fs');var Redis=require(_0xb439('0x5'));var db=require(_0xb439('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb439('0x7'))(_0xb439('0x8'));var config=require(_0xb439('0x9'));var jayson=require(_0xb439('0xa'));var client=jayson['client'][_0xb439('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39cd40,_0x3cb97a,_0x1e0d38){return new BPromise(function(_0x17bbeb,_0x66213d){return client[_0xb439('0xc')](_0x39cd40,_0x1e0d38)[_0xb439('0xd')](function(_0x169394){logger[_0xb439('0xe')](_0xb439('0xf'),_0x3cb97a,_0xb439('0x10'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x3cb97a,_0xb439('0x10'),JSON[_0xb439('0x11')](_0x169394));if(_0x169394[_0xb439('0x12')]){if(_0x169394[_0xb439('0x12')]['code']===0x1f4){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x3cb97a,_0x169394[_0xb439('0x12')]['message']);return _0x66213d(_0x169394[_0xb439('0x12')]['message']);}logger['error'](_0xb439('0xf'),_0x3cb97a,_0x169394[_0xb439('0x12')][_0xb439('0x13')]);return _0x17bbeb(_0x169394[_0xb439('0x12')]['message']);}else{logger[_0xb439('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x3cb97a,'request\x20sent');_0x17bbeb(_0x169394[_0xb439('0x14')][_0xb439('0x13')]);}})[_0xb439('0x15')](function(_0x689880){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x3cb97a,_0x689880);_0x66213d(_0x689880);});});} \ No newline at end of file +var _0x38f0=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x53c4f8,_0x44ccaf){var _0x416458=function(_0x2632aa){while(--_0x2632aa){_0x53c4f8['push'](_0x53c4f8['shift']());}};_0x416458(++_0x44ccaf);}(_0x38f0,0x12c));var _0x038f=function(_0x59ad55,_0x30fb5e){_0x59ad55=_0x59ad55-0x0;var _0x39f7fe=_0x38f0[_0x59ad55];return _0x39f7fe;};'use strict';var _=require(_0x038f('0x0'));var util=require(_0x038f('0x1'));var moment=require(_0x038f('0x2'));var BPromise=require(_0x038f('0x3'));var rs=require(_0x038f('0x4'));var fs=require('fs');var Redis=require(_0x038f('0x5'));var db=require(_0x038f('0x6'))['db'];var utils=require(_0x038f('0x7'));var logger=require(_0x038f('0x8'))('rpc');var config=require(_0x038f('0x9'));var jayson=require(_0x038f('0xa'));var client=jayson[_0x038f('0xb')][_0x038f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4520f4,_0x33fb32,_0x42822d){return new BPromise(function(_0x4ebcab,_0x45054b){return client[_0x038f('0xd')](_0x4520f4,_0x42822d)[_0x038f('0xe')](function(_0x2ef034){logger[_0x038f('0xf')](_0x038f('0x10'),_0x33fb32,'request\x20sent');logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x33fb32,'request\x20sent',JSON[_0x038f('0x11')](_0x2ef034));if(_0x2ef034[_0x038f('0x12')]){if(_0x2ef034[_0x038f('0x12')][_0x038f('0x13')]===0x1f4){logger['error'](_0x038f('0x10'),_0x33fb32,_0x2ef034[_0x038f('0x12')][_0x038f('0x14')]);return _0x45054b(_0x2ef034[_0x038f('0x12')][_0x038f('0x14')]);}logger[_0x038f('0x12')](_0x038f('0x10'),_0x33fb32,_0x2ef034[_0x038f('0x12')][_0x038f('0x14')]);return _0x4ebcab(_0x2ef034['error'][_0x038f('0x14')]);}else{logger[_0x038f('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x33fb32,_0x038f('0x15'));_0x4ebcab(_0x2ef034[_0x038f('0x16')]['message']);}})['catch'](function(_0x1c8529){logger['error'](_0x038f('0x10'),_0x33fb32,_0x1c8529);_0x45054b(_0x1c8529);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 76923d6..78b29d5 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 _0xbd9f=['../../config/environment','exports','connect-timeout','Router','../../components/auth/service'];(function(_0x51878d,_0x4f6e34){var _0x4c1c75=function(_0x10a032){while(--_0x10a032){_0x51878d['push'](_0x51878d['shift']());}};_0x4c1c75(++_0x4f6e34);}(_0xbd9f,0x98));var _0xfbd9=function(_0x4b6413,_0x2720f4){_0x4b6413=_0x4b6413-0x0;var _0x37d105=_0xbd9f[_0x4b6413];return _0x37d105;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xfbd9('0x0'));var express=require('express');var router=express[_0xfbd9('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xfbd9('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xfbd9('0x3'));module[_0xfbd9('0x4')]=router; \ No newline at end of file +var _0x8227=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','exports','util','connect-timeout'];(function(_0x1c2b7c,_0x7d9049){var _0x342381=function(_0x3fd331){while(--_0x3fd331){_0x1c2b7c['push'](_0x1c2b7c['shift']());}};_0x342381(++_0x7d9049);}(_0x8227,0x146));var _0x7822=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8227[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x7822('0x0'));var path=require('path');var timeout=require(_0x7822('0x1'));var express=require(_0x7822('0x2'));var router=express[_0x7822('0x3')]();var fs_extra=require(_0x7822('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7822('0x5'));var config=require(_0x7822('0x6'));module[_0x7822('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index bc8eb77..c780892 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 _0xd8b0=['exports','sequelize'];(function(_0x2a6f78,_0x57aee6){var _0x37f15e=function(_0x154ef8){while(--_0x154ef8){_0x2a6f78['push'](_0x2a6f78['shift']());}};_0x37f15e(++_0x57aee6);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x247441,_0x100a24){var _0x1d7b2c=function(_0x4378b7){while(--_0x4378b7){_0x247441['push'](_0x247441['shift']());}};_0x1d7b2c(++_0x100a24);}(_0xe706,0xa3));var _0x6e70=function(_0x34ddf1,_0x494e77){_0x34ddf1=_0x34ddf1-0x0;var _0x264cd6=_0xe706[_0x34ddf1];return _0x264cd6;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'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 69b58e0..cc282e4 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 _0x4b84=['moment','path','rimraf','../../config/environment','UserVoiceQueue','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4b84,0x1cc));var _0x44b8=function(_0x11dc39,_0x491115){_0x11dc39=_0x11dc39-0x0;var _0x457277=_0x4b84[_0x11dc39];return _0x457277;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x44b8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x44b8('0x3'));var rimraf=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x55f25d,_0x996a8b){return _0x55f25d['define'](_0x44b8('0x6'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98a8=['user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define'];(function(_0x1196b0,_0x36c47a){var _0x111c52=function(_0x5604c7){while(--_0x5604c7){_0x1196b0['push'](_0x1196b0['shift']());}};_0x111c52(++_0x36c47a);}(_0x98a8,0x12c));var _0x898a=function(_0x339869,_0x1ba713){_0x339869=_0x339869-0x0;var _0x47bf43=_0x98a8[_0x339869];return _0x47bf43;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var logger=require(_0x898a('0x2'))(_0x898a('0x3'));var moment=require(_0x898a('0x4'));var BPromise=require(_0x898a('0x5'));var rp=require(_0x898a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x898a('0x7'));var config=require(_0x898a('0x8'));var attributes=require(_0x898a('0x9'));module[_0x898a('0xa')]=function(_0x3e7ddd,_0x5d7e59){return _0x3e7ddd[_0x898a('0xb')]('UserVoiceQueue',attributes,{'tableName':_0x898a('0xc'),'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 9cce871..d944412 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 _0xab57=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','../../mysqldb'];(function(_0x271523,_0x8ba8ed){var _0xb4d5f0=function(_0x1f0b44){while(--_0x1f0b44){_0x271523['push'](_0x271523['shift']());}};_0xb4d5f0(++_0x8ba8ed);}(_0xab57,0x10e));var _0x7ab5=function(_0x2db205,_0x145c37){_0x2db205=_0x2db205-0x0;var _0x4c8c4f=_0xab57[_0x2db205];return _0x4c8c4f;};'use strict';var _=require(_0x7ab5('0x0'));var util=require(_0x7ab5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7ab5('0x2'))['db'];var utils=require(_0x7ab5('0x3'));var logger=require(_0x7ab5('0x4'))(_0x7ab5('0x5'));var config=require(_0x7ab5('0x6'));var jayson=require(_0x7ab5('0x7'));var client=jayson[_0x7ab5('0x8')][_0x7ab5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x546fb6,_0x5f45a7,_0x37f89b){return new BPromise(function(_0x263632,_0x28f03b){return client[_0x7ab5('0xa')](_0x546fb6,_0x37f89b)[_0x7ab5('0xb')](function(_0x2c1980){logger[_0x7ab5('0xc')](_0x7ab5('0xd'),_0x5f45a7,_0x7ab5('0xe'));logger[_0x7ab5('0xf')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x5f45a7,_0x7ab5('0xe'),JSON[_0x7ab5('0x10')](_0x2c1980));if(_0x2c1980[_0x7ab5('0x11')]){if(_0x2c1980[_0x7ab5('0x11')][_0x7ab5('0x12')]===0x1f4){logger[_0x7ab5('0x11')](_0x7ab5('0xd'),_0x5f45a7,_0x2c1980[_0x7ab5('0x11')][_0x7ab5('0x13')]);return _0x28f03b(_0x2c1980[_0x7ab5('0x11')]['message']);}logger[_0x7ab5('0x11')](_0x7ab5('0xd'),_0x5f45a7,_0x2c1980[_0x7ab5('0x11')][_0x7ab5('0x13')]);return _0x263632(_0x2c1980['error'][_0x7ab5('0x13')]);}else{logger[_0x7ab5('0xc')](_0x7ab5('0xd'),_0x5f45a7,_0x7ab5('0xe'));_0x263632(_0x2c1980[_0x7ab5('0x14')]['message']);}})['catch'](function(_0x2110a5){logger[_0x7ab5('0x11')](_0x7ab5('0xd'),_0x5f45a7,_0x2110a5);_0x28f03b(_0x2110a5);});});} \ No newline at end of file +var _0x4f56=['code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3489d7,_0x57644d){var _0x21b195=function(_0x1600c6){while(--_0x1600c6){_0x3489d7['push'](_0x3489d7['shift']());}};_0x21b195(++_0x57644d);}(_0x4f56,0x1b4));var _0x64f5=function(_0x2a6698,_0x5c67ed){_0x2a6698=_0x2a6698-0x0;var _0x898048=_0x4f56[_0x2a6698];return _0x898048;};'use strict';var _=require('lodash');var util=require(_0x64f5('0x0'));var moment=require(_0x64f5('0x1'));var BPromise=require(_0x64f5('0x2'));var rs=require(_0x64f5('0x3'));var fs=require('fs');var Redis=require(_0x64f5('0x4'));var db=require(_0x64f5('0x5'))['db'];var utils=require(_0x64f5('0x6'));var logger=require(_0x64f5('0x7'))(_0x64f5('0x8'));var config=require(_0x64f5('0x9'));var jayson=require(_0x64f5('0xa'));var client=jayson[_0x64f5('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x387b67,_0x5f1120,_0x2a2e80){return new BPromise(function(_0x507bd8,_0x396f33){return client[_0x64f5('0xc')](_0x387b67,_0x2a2e80)[_0x64f5('0xd')](function(_0x4d6ed0){logger['info'](_0x64f5('0xe'),_0x5f1120,'request\x20sent');logger[_0x64f5('0xf')](_0x64f5('0x10'),_0x5f1120,_0x64f5('0x11'),JSON[_0x64f5('0x12')](_0x4d6ed0));if(_0x4d6ed0[_0x64f5('0x13')]){if(_0x4d6ed0[_0x64f5('0x13')][_0x64f5('0x14')]===0x1f4){logger[_0x64f5('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x5f1120,_0x4d6ed0[_0x64f5('0x13')][_0x64f5('0x15')]);return _0x396f33(_0x4d6ed0[_0x64f5('0x13')][_0x64f5('0x15')]);}logger[_0x64f5('0x13')](_0x64f5('0xe'),_0x5f1120,_0x4d6ed0[_0x64f5('0x13')][_0x64f5('0x15')]);return _0x507bd8(_0x4d6ed0[_0x64f5('0x13')]['message']);}else{logger[_0x64f5('0x16')](_0x64f5('0xe'),_0x5f1120,_0x64f5('0x11'));_0x507bd8(_0x4d6ed0['result']['message']);}})[_0x64f5('0x17')](function(_0x2e4473){logger[_0x64f5('0x13')](_0x64f5('0xe'),_0x5f1120,_0x2e4473);_0x396f33(_0x2e4473);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 4280486..e519ac5 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 _0x6df9=['multer','util','connect-timeout','fs-extra','../../components/interaction/service','exports'];(function(_0xb9ae1d,_0x1a2dfb){var _0x523341=function(_0x141ba6){while(--_0x141ba6){_0xb9ae1d['push'](_0xb9ae1d['shift']());}};_0x523341(++_0x1a2dfb);}(_0x6df9,0x84));var _0x96df=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x6df9[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x96df('0x0'));var util=require(_0x96df('0x1'));var path=require('path');var timeout=require(_0x96df('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x96df('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x96df('0x4'));var config=require('../../config/environment');module[_0x96df('0x5')]=router; \ No newline at end of file +var _0x585e=['../../components/interaction/service','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x32173d,_0x1989f3){var _0x441561=function(_0x4ce4a8){while(--_0x4ce4a8){_0x32173d['push'](_0x32173d['shift']());}};_0x441561(++_0x1989f3);}(_0x585e,0x1c2));var _0xe585=function(_0x14baf6,_0x4d133e){_0x14baf6=_0x14baf6-0x0;var _0x9442dd=_0x585e[_0x14baf6];return _0x9442dd;};'use strict';var multer=require(_0xe585('0x0'));var util=require(_0xe585('0x1'));var path=require(_0xe585('0x2'));var timeout=require(_0xe585('0x3'));var express=require(_0xe585('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe585('0x5'));var interaction=require(_0xe585('0x6'));var config=require('../../config/environment');module[_0xe585('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 89636bb..5064502 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 _0xb32e=['queue_interface','sequelize','INTEGER','STRING','Required\x20by\x20Asterisk'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xb32e,0x1be));var _0xeb32=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb32e[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xeb32('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xeb32('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xeb32('0x2')],'allowNull':![],'comment':_0xeb32('0x3')},'UserId':{'type':Sequelize[_0xeb32('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xeb32('0x2')],'allowNull':![],'unique':_0xeb32('0x4'),'comment':_0xeb32('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xeb32('0x2')],'allowNull':![],'unique':_0xeb32('0x4'),'comment':_0xeb32('0x3')},'penalty':{'type':Sequelize[_0xeb32('0x1')](0xb),'defaultValue':0x0,'comment':_0xeb32('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xeb32('0x3')}}; \ No newline at end of file +var _0x1e26=['STRING','queue_interface','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x503412,_0x263967){var _0xfec2e3=function(_0x2f80a0){while(--_0x2f80a0){_0x503412['push'](_0x503412['shift']());}};_0xfec2e3(++_0x263967);}(_0x1e26,0x110));var _0x61e2=function(_0x444090,_0x279677){_0x444090=_0x444090-0x0;var _0x4b97b3=_0x1e26[_0x444090];return _0x4b97b3;};'use strict';var Sequelize=require('sequelize');module[_0x61e2('0x0')]={'uniqueid':{'type':Sequelize[_0x61e2('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x61e2('0x2')},'membername':{'type':Sequelize[_0x61e2('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x61e2('0x3')],'allowNull':![],'unique':_0x61e2('0x4'),'comment':_0x61e2('0x2')},'VoiceQueueId':{'type':Sequelize[_0x61e2('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x61e2('0x3')],'allowNull':![],'unique':_0x61e2('0x4'),'comment':_0x61e2('0x2')},'penalty':{'type':Sequelize[_0x61e2('0x1')](0xb),'defaultValue':0x0,'comment':_0x61e2('0x2')},'paused':{'type':Sequelize[_0x61e2('0x1')](0xb),'defaultValue':0x0,'comment':_0x61e2('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 4294c4d..3616475 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 _0x2a2d=['UserVoiceQueueRt','save','emit','hasOwnProperty','hook','exports','events'];(function(_0x4a6045,_0x37294e){var _0x58c2cd=function(_0x3bcd93){while(--_0x3bcd93){_0x4a6045['push'](_0x4a6045['shift']());}};_0x58c2cd(++_0x37294e);}(_0x2a2d,0x1bf));var _0xd2a2=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x2a2d[_0x4709c0];return _0x13348b;};'use strict';var EventEmitter=require(_0xd2a2('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xd2a2('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd2a2('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2f2796){return function(_0x19a454,_0x557598,_0x20158b){UserVoiceQueueRtEvents[_0xd2a2('0x3')](_0x2f2796+':'+_0x19a454['id'],_0x19a454);UserVoiceQueueRtEvents[_0xd2a2('0x3')](_0x2f2796,_0x19a454);_0x20158b(null);};}for(var e in events){if(events[_0xd2a2('0x4')](e)){var event=events[e];UserVoiceQueueRt[_0xd2a2('0x5')](e,emitEvent(event));}}module[_0xd2a2('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xfdce=['hook','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners','update','emit','hasOwnProperty'];(function(_0xbae67,_0x3cbdc8){var _0x3a3580=function(_0x2ff693){while(--_0x2ff693){_0xbae67['push'](_0xbae67['shift']());}};_0x3a3580(++_0x3cbdc8);}(_0xfdce,0x1d2));var _0xefdc=function(_0x33af1c,_0x526259){_0x33af1c=_0x33af1c-0x0;var _0x5d5815=_0xfdce[_0x33af1c];return _0x5d5815;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xefdc('0x0'))['db'][_0xefdc('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xefdc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xefdc('0x3'),'afterDestroy':'remove'};function emitEvent(_0x322a8e){return function(_0x4d6369,_0x1be90a,_0x24bc8c){UserVoiceQueueRtEvents[_0xefdc('0x4')](_0x322a8e+':'+_0x4d6369['id'],_0x4d6369);UserVoiceQueueRtEvents['emit'](_0x322a8e,_0x4d6369);_0x24bc8c(null);};}for(var e in events){if(events[_0xefdc('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0xefdc('0x6')](e,emitEvent(event));}}module[_0xefdc('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index f8ad7bd..248aa06 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 _0x45c0=['./userVoiceQueueRt.attributes','exports','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1d69ba,_0x4090c9){var _0x8bab8c=function(_0x33ce38){while(--_0x33ce38){_0x1d69ba['push'](_0x1d69ba['shift']());}};_0x8bab8c(++_0x4090c9);}(_0x45c0,0xf3));var _0x045c=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x45c0[_0x521929];return _0x632436;};'use strict';var _=require(_0x045c('0x0'));var util=require(_0x045c('0x1'));var logger=require(_0x045c('0x2'))(_0x045c('0x3'));var moment=require(_0x045c('0x4'));var BPromise=require(_0x045c('0x5'));var rp=require(_0x045c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x045c('0x7'));var config=require(_0x045c('0x8'));var attributes=require(_0x045c('0x9'));module[_0x045c('0xa')]=function(_0x244cfb,_0x106c09){return _0x244cfb['define']('UserVoiceQueueRt',attributes,{'tableName':_0x045c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaeed=['bluebird','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','moment'];(function(_0x532850,_0x3a100a){var _0x4ea53f=function(_0x243531){while(--_0x243531){_0x532850['push'](_0x532850['shift']());}};_0x4ea53f(++_0x3a100a);}(_0xaeed,0xd4));var _0xdaee=function(_0x289ed5,_0x289c3c){_0x289ed5=_0x289ed5-0x0;var _0x53ba9e=_0xaeed[_0x289ed5];return _0x53ba9e;};'use strict';var _=require(_0xdaee('0x0'));var util=require(_0xdaee('0x1'));var logger=require(_0xdaee('0x2'))('api');var moment=require(_0xdaee('0x3'));var BPromise=require(_0xdaee('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdaee('0x5'));var config=require(_0xdaee('0x6'));var attributes=require(_0xdaee('0x7'));module[_0xdaee('0x8')]=function(_0x2b8a5f,_0x28fcff){return _0x2b8a5f[_0xdaee('0x9')](_0xdaee('0xa'),attributes,{'tableName':_0xdaee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 68a7a7a..4ccd3fe 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 _0xcc0e=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','./userVoiceQueueRt.socket','register','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','GetVoiceQueueRtPauses','findAll','options','raw','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','lodash','moment','bluebird','ioredis','../../config/utils'];(function(_0x4d2263,_0x3fbf0d){var _0x24aba0=function(_0x389a59){while(--_0x389a59){_0x4d2263['push'](_0x4d2263['shift']());}};_0x24aba0(++_0x3fbf0d);}(_0xcc0e,0x11b));var _0xecc0=function(_0x107713,_0x12ec50){_0x107713=_0x107713-0x0;var _0x12bc35=_0xcc0e[_0x107713];return _0x12bc35;};'use strict';var _=require(_0xecc0('0x0'));var util=require('util');var moment=require(_0xecc0('0x1'));var BPromise=require(_0xecc0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xecc0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xecc0('0x4'));var logger=require(_0xecc0('0x5'))('rpc');var config=require(_0xecc0('0x6'));var jayson=require(_0xecc0('0x7'));var client=jayson[_0xecc0('0x8')][_0xecc0('0x9')]({'port':0x232a});config[_0xecc0('0xa')]=_['defaults'](config[_0xecc0('0xa')],{'host':_0xecc0('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xecc0('0xc'))[_0xecc0('0xd')](socket);function respondWithRpcPromise(_0x2ac2e0,_0x2b3fa2,_0x4d36ff){return new BPromise(function(_0x338333,_0x2c1bb3){return client['request'](_0x2ac2e0,_0x4d36ff)[_0xecc0('0xe')](function(_0x16b044){logger['info'](_0xecc0('0xf'),_0x2b3fa2,_0xecc0('0x10'));logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x2b3fa2,_0xecc0('0x10'),JSON[_0xecc0('0x11')](_0x16b044));if(_0x16b044[_0xecc0('0x12')]){if(_0x16b044[_0xecc0('0x12')][_0xecc0('0x13')]===0x1f4){logger['error'](_0xecc0('0xf'),_0x2b3fa2,_0x16b044[_0xecc0('0x12')]['message']);return _0x2c1bb3(_0x16b044['error']['message']);}logger['error'](_0xecc0('0xf'),_0x2b3fa2,_0x16b044['error'][_0xecc0('0x14')]);return _0x338333(_0x16b044[_0xecc0('0x12')][_0xecc0('0x14')]);}else{logger[_0xecc0('0x15')](_0xecc0('0xf'),_0x2b3fa2,_0xecc0('0x10'));_0x338333(_0x16b044['result'][_0xecc0('0x14')]);}})[_0xecc0('0x16')](function(_0x9ce46f){logger[_0xecc0('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2b3fa2,_0x9ce46f);_0x2c1bb3(_0x9ce46f);});});}exports[_0xecc0('0x17')]=function(_0x4bf4e6){var _0x40a09a=this;return new Promise(function(_0x51f4ce,_0x471a6b){return db['UserVoiceQueueRt'][_0xecc0('0x18')]({'raw':_0x4bf4e6[_0xecc0('0x19')]?_0x4bf4e6[_0xecc0('0x19')][_0xecc0('0x1a')]===undefined?!![]:![]:!![],'where':_0x4bf4e6['options']?_0x4bf4e6[_0xecc0('0x19')]['where']||null:null,'attributes':[[db[_0xecc0('0x1b')]['fn']('COUNT',db[_0xecc0('0x1b')]['fn']('IF',db['sequelize'][_0xecc0('0x1c')](_0xecc0('0x1d')))),_0xecc0('0x1e')]]})[_0xecc0('0xe')](function(_0x31927f){logger[_0xecc0('0x15')](_0xecc0('0x17'),_0x4bf4e6);logger[_0xecc0('0x1f')](_0xecc0('0x17'),_0x4bf4e6,JSON['stringify'](_0x31927f));_0x51f4ce(_0x31927f);})[_0xecc0('0x16')](function(_0x1e55e2){logger[_0xecc0('0x12')](_0xecc0('0x17'),_0x1e55e2['message'],_0x4bf4e6);_0x471a6b(_0x40a09a['error'](0x1f4,_0x1e55e2[_0xecc0('0x14')]));});});}; \ No newline at end of file +var _0xf8ed=['result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','stringify','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./userVoiceQueueRt.socket','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x39ae1b,_0x18cfc0){var _0x539437=function(_0x5c9a4a){while(--_0x5c9a4a){_0x39ae1b['push'](_0x39ae1b['shift']());}};_0x539437(++_0x18cfc0);}(_0xf8ed,0x11d));var _0xdf8e=function(_0x3c2e4e,_0x357207){_0x3c2e4e=_0x3c2e4e-0x0;var _0x773c58=_0xf8ed[_0x3c2e4e];return _0x773c58;};'use strict';var _=require('lodash');var util=require(_0xdf8e('0x0'));var moment=require(_0xdf8e('0x1'));var BPromise=require('bluebird');var rs=require(_0xdf8e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf8e('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdf8e('0x4'));var config=require(_0xdf8e('0x5'));var jayson=require(_0xdf8e('0x6'));var client=jayson[_0xdf8e('0x7')][_0xdf8e('0x8')]({'port':0x232a});config[_0xdf8e('0x9')]=_['defaults'](config[_0xdf8e('0x9')],{'host':_0xdf8e('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdf8e('0xb'))[_0xdf8e('0xc')](socket);function respondWithRpcPromise(_0x51deb5,_0x41c8dd,_0x3c4825){return new BPromise(function(_0x248eba,_0x53a362){return client['request'](_0x51deb5,_0x3c4825)[_0xdf8e('0xd')](function(_0x544639){logger[_0xdf8e('0xe')](_0xdf8e('0xf'),_0x41c8dd,'request\x20sent');logger['debug'](_0xdf8e('0x10'),_0x41c8dd,_0xdf8e('0x11'),JSON['stringify'](_0x544639));if(_0x544639[_0xdf8e('0x12')]){if(_0x544639[_0xdf8e('0x12')][_0xdf8e('0x13')]===0x1f4){logger[_0xdf8e('0x12')](_0xdf8e('0xf'),_0x41c8dd,_0x544639[_0xdf8e('0x12')][_0xdf8e('0x14')]);return _0x53a362(_0x544639[_0xdf8e('0x12')][_0xdf8e('0x14')]);}logger[_0xdf8e('0x12')](_0xdf8e('0xf'),_0x41c8dd,_0x544639[_0xdf8e('0x12')]['message']);return _0x248eba(_0x544639[_0xdf8e('0x12')][_0xdf8e('0x14')]);}else{logger[_0xdf8e('0xe')](_0xdf8e('0xf'),_0x41c8dd,_0xdf8e('0x11'));_0x248eba(_0x544639[_0xdf8e('0x15')][_0xdf8e('0x14')]);}})[_0xdf8e('0x16')](function(_0x315ba4){logger[_0xdf8e('0x12')](_0xdf8e('0xf'),_0x41c8dd,_0x315ba4);_0x53a362(_0x315ba4);});});}exports[_0xdf8e('0x17')]=function(_0x2c2648){var _0x2bbed0=this;return new Promise(function(_0x5087fa,_0x2bd7ce){return db[_0xdf8e('0x18')][_0xdf8e('0x19')]({'raw':_0x2c2648[_0xdf8e('0x1a')]?_0x2c2648['options'][_0xdf8e('0x1b')]===undefined?!![]:![]:!![],'where':_0x2c2648[_0xdf8e('0x1a')]?_0x2c2648[_0xdf8e('0x1a')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xdf8e('0x1c'),db['sequelize']['fn']('IF',db['sequelize'][_0xdf8e('0x1d')](_0xdf8e('0x1e')))),_0xdf8e('0x1f')]]})[_0xdf8e('0xd')](function(_0x69ffb3){logger[_0xdf8e('0xe')](_0xdf8e('0x17'),_0x2c2648);logger[_0xdf8e('0x20')]('GetVoiceQueueRtPauses',_0x2c2648,JSON[_0xdf8e('0x21')](_0x69ffb3));_0x5087fa(_0x69ffb3);})[_0xdf8e('0x16')](function(_0x568457){logger['error'](_0xdf8e('0x17'),_0x568457[_0xdf8e('0x14')],_0x2c2648);_0x2bd7ce(_0x2bbed0[_0xdf8e('0x12')](0x1f4,_0x568457[_0xdf8e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 8835892..bd23dce 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 _0xfb1b=['save','remove','update','emit','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xfb1b,0x1ca));var _0xbfb1=function(_0x24c42f,_0x2d7800){_0x24c42f=_0x24c42f-0x0;var _0x47c6c3=_0xfb1b[_0x24c42f];return _0x47c6c3;};'use strict';var UserVoiceQueueRtEvents=require(_0xbfb1('0x0'));var events=[_0xbfb1('0x1'),_0xbfb1('0x2'),_0xbfb1('0x3')];function createListener(_0x92570d,_0x52ef0e){return function(_0x31901d){_0x52ef0e[_0xbfb1('0x4')](_0x92570d,_0x31901d);};}function removeListener(_0x3fa560,_0x4532cf){return function(){UserVoiceQueueRtEvents[_0xbfb1('0x5')](_0x3fa560,_0x4532cf);};}exports[_0xbfb1('0x6')]=function(_0x174670){for(var _0x54e82d=0x0,_0xb5403d=events[_0xbfb1('0x7')];_0x54e82d<_0xb5403d;_0x54e82d++){var _0x232aff=events[_0x54e82d];var _0x1a91d3=createListener(_0xbfb1('0x8')+_0x232aff,_0x174670);UserVoiceQueueRtEvents['on'](_0x232aff,_0x1a91d3);}}; \ No newline at end of file +var _0xb628=['userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit','register'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xb628,0xb7));var _0x8b62=function(_0x49e0f2,_0x53b037){_0x49e0f2=_0x49e0f2-0x0;var _0x765610=_0xb628[_0x49e0f2];return _0x765610;};'use strict';var UserVoiceQueueRtEvents=require(_0x8b62('0x0'));var events=[_0x8b62('0x1'),_0x8b62('0x2'),_0x8b62('0x3')];function createListener(_0xaf2bf5,_0x4360a5){return function(_0x3a4c0f){_0x4360a5[_0x8b62('0x4')](_0xaf2bf5,_0x3a4c0f);};}function removeListener(_0x1ef999,_0x48b253){return function(){UserVoiceQueueRtEvents['removeListener'](_0x1ef999,_0x48b253);};}exports[_0x8b62('0x5')]=function(_0x401bc0){for(var _0x4e08f5=0x0,_0x12a802=events['length'];_0x4e08f5<_0x12a802;_0x4e08f5++){var _0x80cee1=events[_0x4e08f5];var _0x27be8a=createListener(_0x8b62('0x6')+_0x80cee1,_0x401bc0);UserVoiceQueueRtEvents['on'](_0x80cee1,_0x27be8a);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index d1356f5..74075a6 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 _0xf12a=['path','connect-timeout','express','Router','fs-extra','../../config/environment','multer','util'];(function(_0x287a47,_0x2f731c){var _0x3fb726=function(_0xbedc33){while(--_0xbedc33){_0x287a47['push'](_0x287a47['shift']());}};_0x3fb726(++_0x2f731c);}(_0xf12a,0x8e));var _0xaf12=function(_0x32e865,_0x317078){_0x32e865=_0x32e865-0x0;var _0x850461=_0xf12a[_0x32e865];return _0x850461;};'use strict';var multer=require(_0xaf12('0x0'));var util=require(_0xaf12('0x1'));var path=require(_0xaf12('0x2'));var timeout=require(_0xaf12('0x3'));var express=require(_0xaf12('0x4'));var router=express[_0xaf12('0x5')]();var fs_extra=require(_0xaf12('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaf12('0x7'));module['exports']=router; \ No newline at end of file +var _0xf4f4=['fs-extra','../../components/auth/service','../../config/environment','multer','util','connect-timeout','express','Router'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x4ec8f4,_0x324d08){_0x4ec8f4=_0x4ec8f4-0x0;var _0x37f047=_0xf4f4[_0x4ec8f4];return _0x37f047;};'use strict';var multer=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var path=require('path');var timeout=require(_0x4f4f('0x2'));var express=require(_0x4f4f('0x3'));var router=express[_0x4f4f('0x4')]();var fs_extra=require(_0x4f4f('0x5'));var auth=require(_0x4f4f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4f4f('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 9fad9fe..44553d6 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x53a2cf,_0x5dac23){var _0x3f0e03=function(_0x418f9c){while(--_0x418f9c){_0x53a2cf['push'](_0x53a2cf['shift']());}};_0x3f0e03(++_0x5dac23);}(_0xe706,0xa3));var _0x6e70=function(_0x1730dd,_0x3cacb2){_0x1730dd=_0x1730dd-0x0;var _0x15a53c=_0xe706[_0x1730dd];return _0x15a53c;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x461a82,_0x2c47ad){var _0x284c25=function(_0x364e04){while(--_0x364e04){_0x461a82['push'](_0x461a82['shift']());}};_0x284c25(++_0x2c47ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index b348a65..866e3ad 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 _0x8f59=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','define','lodash'];(function(_0xa5ce71,_0x53efcc){var _0x382319=function(_0x2f6d0c){while(--_0x2f6d0c){_0xa5ce71['push'](_0xa5ce71['shift']());}};_0x382319(++_0x53efcc);}(_0x8f59,0x11d));var _0x98f5=function(_0x50392,_0x5f2c41){_0x50392=_0x50392-0x0;var _0x11d87b=_0x8f59[_0x50392];return _0x11d87b;};'use strict';var _=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var logger=require(_0x98f5('0x2'))(_0x98f5('0x3'));var moment=require(_0x98f5('0x4'));var BPromise=require(_0x98f5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x98f5('0x6'));var rimraf=require(_0x98f5('0x7'));var config=require(_0x98f5('0x8'));var attributes=require(_0x98f5('0x9'));module['exports']=function(_0xdcce7a,_0x358618){return _0xdcce7a[_0x98f5('0xa')]('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4a2=['UserWhatsappQueue','user_has_whatsapp_queues','lodash','api','bluebird','path','../../config/environment','./userWhatsappQueue.attributes','exports'];(function(_0x45982a,_0x1f2be4){var _0x59a372=function(_0x1f8ab2){while(--_0x1f8ab2){_0x45982a['push'](_0x45982a['shift']());}};_0x59a372(++_0x1f2be4);}(_0xd4a2,0x173));var _0x2d4a=function(_0x2872d1,_0x13e9fc){_0x2872d1=_0x2872d1-0x0;var _0x4ea0aa=_0xd4a2[_0x2872d1];return _0x4ea0aa;};'use strict';var _=require(_0x2d4a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2d4a('0x1'));var moment=require('moment');var BPromise=require(_0x2d4a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d4a('0x3'));var rimraf=require('rimraf');var config=require(_0x2d4a('0x4'));var attributes=require(_0x2d4a('0x5'));module[_0x2d4a('0x6')]=function(_0x3a88e2,_0x1ca10b){return _0x3a88e2['define'](_0x2d4a('0x7'),attributes,{'tableName':_0x2d4a('0x8'),'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 246c3ae..99cc5bc 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 _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\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(_0x15fb64,_0x2f209f){var _0xd53800=function(_0x24bc35){while(--_0x24bc35){_0x15fb64['push'](_0x15fb64['shift']());}};_0xd53800(++_0x2f209f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\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(_0x5d8b3a,_0x5e255b){var _0x33f08e=function(_0x2824a4){while(--_0x2824a4){_0x5d8b3a['push'](_0x5d8b3a['shift']());}};_0x33f08e(++_0x5e255b);}(_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 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/variable/index.js b/server/api/variable/index.js index 6a08bc3..a11ab0d 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 _0xbe6c=['exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','index','/:id','isAuthenticated','show','post','update','delete'];(function(_0x5aca71,_0x583dfa){var _0x375f79=function(_0x3b2d5e){while(--_0x3b2d5e){_0x5aca71['push'](_0x5aca71['shift']());}};_0x375f79(++_0x583dfa);}(_0xbe6c,0xd9));var _0xcbe6=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xbe6c[_0x2b5eae];return _0x5f3ac9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcbe6('0x0'));var timeout=require(_0xcbe6('0x1'));var express=require(_0xcbe6('0x2'));var router=express[_0xcbe6('0x3')]();var fs_extra=require(_0xcbe6('0x4'));var auth=require(_0xcbe6('0x5'));var interaction=require(_0xcbe6('0x6'));var config=require(_0xcbe6('0x7'));var controller=require(_0xcbe6('0x8'));router[_0xcbe6('0x9')]('/',auth['isAuthenticated'](),controller[_0xcbe6('0xa')]);router[_0xcbe6('0x9')](_0xcbe6('0xb'),auth[_0xcbe6('0xc')](),controller[_0xcbe6('0xd')]);router[_0xcbe6('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xcbe6('0xc')](),controller[_0xcbe6('0xf')]);router[_0xcbe6('0x10')](_0xcbe6('0xb'),auth[_0xcbe6('0xc')](),controller['destroy']);module[_0xcbe6('0x11')]=router; \ No newline at end of file +var _0xda67=['fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','index','/:id','isAuthenticated','show','create','put','update','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x1d9642,_0x2eb8a0){var _0x4fe6f1=function(_0x62ccbf){while(--_0x62ccbf){_0x1d9642['push'](_0x1d9642['shift']());}};_0x4fe6f1(++_0x2eb8a0);}(_0xda67,0x1e2));var _0x7da6=function(_0xf548e8,_0x3591e8){_0xf548e8=_0xf548e8-0x0;var _0x39827b=_0xda67[_0xf548e8];return _0x39827b;};'use strict';var multer=require(_0x7da6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7da6('0x1'));var express=require(_0x7da6('0x2'));var router=express[_0x7da6('0x3')]();var fs_extra=require(_0x7da6('0x4'));var auth=require(_0x7da6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7da6('0x6'));var controller=require(_0x7da6('0x7'));router[_0x7da6('0x8')]('/',auth['isAuthenticated'](),controller[_0x7da6('0x9')]);router[_0x7da6('0x8')](_0x7da6('0xa'),auth[_0x7da6('0xb')](),controller[_0x7da6('0xc')]);router['post']('/',auth[_0x7da6('0xb')](),controller[_0x7da6('0xd')]);router[_0x7da6('0xe')](_0x7da6('0xa'),auth['isAuthenticated'](),controller[_0x7da6('0xf')]);router['delete'](_0x7da6('0xa'),auth[_0x7da6('0xb')](),controller[_0x7da6('0x10')]);module[_0x7da6('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 e005e40..23c51bf 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 _0x3a7a=['exports','STRING'];(function(_0x2e7994,_0x1e2f7a){var _0x461e8f=function(_0x3b3f77){while(--_0x3b3f77){_0x2e7994['push'](_0x2e7994['shift']());}};_0x461e8f(++_0x1e2f7a);}(_0x3a7a,0x1ba));var _0xa3a7=function(_0x289842,_0x2d9db4){_0x289842=_0x289842-0x0;var _0x16155a=_0x3a7a[_0x289842];return _0x16155a;};'use strict';var Sequelize=require('sequelize');module[_0xa3a7('0x0')]={'name':{'type':Sequelize[_0xa3a7('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x22bc=['sequelize','exports','STRING'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x22bc,0x66));var _0xc22b=function(_0x2077ab,_0x2ed933){_0x2077ab=_0x2077ab-0x0;var _0x5db757=_0x22bc[_0x2077ab];return _0x5db757;};'use strict';var Sequelize=require(_0xc22b('0x0'));module[_0xc22b('0x1')]={'name':{'type':Sequelize[_0xc22b('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc22b('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 6a9506f..bca3022 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 _0x3a6f=['path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Variables','error','stack','name','send','index','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','Variable','include','findAll','rows','show','params','includeAll','find','catch','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','zip-dir','fast-json-patch','moment','util'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3a6f,0xf0));var _0xf3a6=function(_0x1df9f1,_0x9caabd){_0x1df9f1=_0x1df9f1-0x0;var _0x2f4b04=_0x3a6f[_0x1df9f1];return _0x2f4b04;};'use strict';var pdf=require(_0xf3a6('0x0'));var emlformat=require(_0xf3a6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf3a6('0x2'));var jsonpatch=require(_0xf3a6('0x3'));var rp=require('request-promise');var moment=require(_0xf3a6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf3a6('0x5'));var path=require(_0xf3a6('0x6'));var sox=require(_0xf3a6('0x7'));var csv=require(_0xf3a6('0x8'));var ejs=require(_0xf3a6('0x9'));var fs=require('fs');var fs_extra=require(_0xf3a6('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf3a6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf3a6('0xc'));var toCsv=require(_0xf3a6('0x8'));var querystring=require(_0xf3a6('0xd'));var Papa=require(_0xf3a6('0xe'));var Redis=require(_0xf3a6('0xf'));var authService=require(_0xf3a6('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf3a6('0x11'));var hardwareService=require(_0xf3a6('0x12'));var logger=require('../../config/logger')(_0xf3a6('0x13'));var utils=require(_0xf3a6('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf3a6('0x15'))['db'];function respondWithStatusCode(_0x31e747,_0x4c1f90){_0x4c1f90=_0x4c1f90||0xcc;return function(_0x593cdc){if(_0x593cdc){return _0x31e747[_0xf3a6('0x16')](_0x4c1f90);}return _0x31e747[_0xf3a6('0x17')](_0x4c1f90)[_0xf3a6('0x18')]();};}function respondWithResult(_0x1b462c,_0x437c05){_0x437c05=_0x437c05||0xc8;return function(_0x216f90){if(_0x216f90){return _0x1b462c[_0xf3a6('0x17')](_0x437c05)[_0xf3a6('0x19')](_0x216f90);}};}function respondWithFilteredResult(_0x1e1e69,_0x4a6a75){return function(_0x32e0ab){if(_0x32e0ab){var _0x4a25c0=_0x32e0ab[_0xf3a6('0x1a')],_0x26b15f=_0x4a6a75[_0xf3a6('0x1b')],_0x103fb3=_0x4a6a75['offset']+_0x4a6a75[_0xf3a6('0x1c')],_0x521e09;if(_0x103fb3>=_0x4a25c0){_0x103fb3=_0x4a25c0;_0x521e09=0xc8;}else{_0x521e09=0xce;}_0x1e1e69[_0xf3a6('0x17')](_0x521e09);return _0x1e1e69[_0xf3a6('0x1d')](_0xf3a6('0x1e'),_0x26b15f+'-'+_0x103fb3+'/'+_0x4a25c0)[_0xf3a6('0x19')](_0x32e0ab);}return null;};}function patchUpdates(_0x12d631){return function(_0xfa959c){try{jsonpatch[_0xf3a6('0x1f')](_0xfa959c,_0x12d631,!![]);}catch(_0x120e79){return BPromise[_0xf3a6('0x20')](_0x120e79);}return _0xfa959c[_0xf3a6('0x21')]();};}function saveUpdates(_0xbe4fbb,_0x3b47e7){return function(_0x51a6f0){if(_0x51a6f0){return _0x51a6f0[_0xf3a6('0x22')](_0xbe4fbb)[_0xf3a6('0x23')](function(_0x420ee8){return _0x420ee8;});}return null;};}function removeEntity(_0x5d55e0,_0x339beb){return function(_0x32bcab){if(_0x32bcab){return _0x32bcab[_0xf3a6('0x24')]()[_0xf3a6('0x23')](function(){var _0x2eb86d=_0x32bcab[_0xf3a6('0x25')]({'plain':!![]});var _0x346016=_0xf3a6('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x346016,'resourceId':_0x2eb86d['id']}})[_0xf3a6('0x23')](function(){return _0x32bcab;});})[_0xf3a6('0x23')](function(){_0x5d55e0[_0xf3a6('0x17')](0xcc)[_0xf3a6('0x18')]();});}};}function handleEntityNotFound(_0x1d163f,_0x56122a){return function(_0x2792d9){if(!_0x2792d9){_0x1d163f[_0xf3a6('0x16')](0x194);}return _0x2792d9;};}function handleError(_0x18b1ba,_0x3e96d5){_0x3e96d5=_0x3e96d5||0x1f4;return function(_0x7fec71){logger[_0xf3a6('0x27')](_0x7fec71[_0xf3a6('0x28')]);if(_0x7fec71['name']){delete _0x7fec71[_0xf3a6('0x29')];}_0x18b1ba[_0xf3a6('0x17')](_0x3e96d5)[_0xf3a6('0x2a')](_0x7fec71);};}exports[_0xf3a6('0x2b')]=function(_0x4ee7a9,_0x35bd01){var _0x34481b={},_0x58d23f={},_0x63eece={'count':0x0,'rows':[]};var _0x43fb2a=_['map'](db['Variable']['rawAttributes'],function(_0x5ae6ed){return{'name':_0x5ae6ed[_0xf3a6('0x2c')],'type':_0x5ae6ed[_0xf3a6('0x2d')][_0xf3a6('0x2e')]};});_0x58d23f[_0xf3a6('0x2f')]=_[_0xf3a6('0x30')](_0x43fb2a,_0xf3a6('0x29'));_0x58d23f[_0xf3a6('0x31')]=_[_0xf3a6('0x32')](_0x4ee7a9[_0xf3a6('0x31')]);_0x58d23f['filters']=_[_0xf3a6('0x33')](_0x58d23f['model'],_0x58d23f[_0xf3a6('0x31')]);_0x34481b[_0xf3a6('0x34')]=_['intersection'](_0x58d23f['model'],qs[_0xf3a6('0x35')](_0x4ee7a9['query'][_0xf3a6('0x35')]));_0x34481b[_0xf3a6('0x34')]=_0x34481b[_0xf3a6('0x34')][_0xf3a6('0x36')]?_0x34481b[_0xf3a6('0x34')]:_0x58d23f[_0xf3a6('0x2f')];if(!_0x4ee7a9[_0xf3a6('0x31')][_0xf3a6('0x37')](_0xf3a6('0x38'))){_0x34481b[_0xf3a6('0x1c')]=qs[_0xf3a6('0x1c')](_0x4ee7a9[_0xf3a6('0x31')][_0xf3a6('0x1c')]);_0x34481b['offset']=qs[_0xf3a6('0x1b')](_0x4ee7a9[_0xf3a6('0x31')][_0xf3a6('0x1b')]);}_0x34481b[_0xf3a6('0x39')]=qs[_0xf3a6('0x3a')](_0x4ee7a9['query'][_0xf3a6('0x3a')]);_0x34481b['where']=qs[_0xf3a6('0x3b')](_[_0xf3a6('0x3c')](_0x4ee7a9[_0xf3a6('0x31')],_0x58d23f[_0xf3a6('0x3b')]),_0x43fb2a);if(_0x4ee7a9[_0xf3a6('0x31')][_0xf3a6('0x3d')]){_0x34481b[_0xf3a6('0x3e')]=_['merge'](_0x34481b['where'],{'$or':_[_0xf3a6('0x30')](_0x43fb2a,function(_0x275d0e){if(_0x275d0e[_0xf3a6('0x2d')]!=='VIRTUAL'){var _0x3922fb={};_0x3922fb[_0x275d0e['name']]={'$like':'%'+_0x4ee7a9['query'][_0xf3a6('0x3d')]+'%'};return _0x3922fb;}})});}_0x34481b=_[_0xf3a6('0x3f')]({},_0x34481b,_0x4ee7a9['options']);var _0x9e8858={'where':_0x34481b[_0xf3a6('0x3e')]};return db[_0xf3a6('0x40')][_0xf3a6('0x1a')](_0x9e8858)['then'](function(_0x201d7a){_0x63eece['count']=_0x201d7a;if(_0x4ee7a9[_0xf3a6('0x31')]['includeAll']){_0x34481b[_0xf3a6('0x41')]=[{'all':!![]}];}return db[_0xf3a6('0x40')][_0xf3a6('0x42')](_0x34481b);})[_0xf3a6('0x23')](function(_0x3dc11b){_0x63eece[_0xf3a6('0x43')]=_0x3dc11b;return _0x63eece;})['then'](respondWithFilteredResult(_0x35bd01,_0x34481b))['catch'](handleError(_0x35bd01,null));};exports[_0xf3a6('0x44')]=function(_0x1516df,_0x40b92c){var _0x23bca1={'raw':!![],'where':{'id':_0x1516df[_0xf3a6('0x45')]['id']}},_0x36e453={};_0x36e453[_0xf3a6('0x2f')]=_[_0xf3a6('0x32')](db['Variable']['rawAttributes']);_0x36e453['query']=_[_0xf3a6('0x32')](_0x1516df[_0xf3a6('0x31')]);_0x36e453[_0xf3a6('0x3b')]=_[_0xf3a6('0x33')](_0x36e453[_0xf3a6('0x2f')],_0x36e453[_0xf3a6('0x31')]);_0x23bca1['attributes']=_[_0xf3a6('0x33')](_0x36e453[_0xf3a6('0x2f')],qs[_0xf3a6('0x35')](_0x1516df[_0xf3a6('0x31')][_0xf3a6('0x35')]));_0x23bca1['attributes']=_0x23bca1[_0xf3a6('0x34')][_0xf3a6('0x36')]?_0x23bca1[_0xf3a6('0x34')]:_0x36e453[_0xf3a6('0x2f')];if(_0x1516df[_0xf3a6('0x31')][_0xf3a6('0x46')]){_0x23bca1['include']=[{'all':!![]}];}_0x23bca1=_[_0xf3a6('0x3f')]({},_0x23bca1,_0x1516df['options']);return db['Variable'][_0xf3a6('0x47')](_0x23bca1)['then'](handleEntityNotFound(_0x40b92c,null))['then'](respondWithResult(_0x40b92c,null))[_0xf3a6('0x48')](handleError(_0x40b92c,null));};exports['create']=function(_0x3b56c3,_0x4f28f1){return db['Variable'][_0xf3a6('0x49')](_0x3b56c3['body'],{})['then'](function(_0x2000e9){var _0x5522b6=_0x3b56c3[_0xf3a6('0x4a')][_0xf3a6('0x25')]({'plain':!![]});if(!_0x5522b6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5522b6[_0xf3a6('0x4b')]===_0xf3a6('0x4a')){var _0x506918=_0x2000e9[_0xf3a6('0x25')]({'plain':!![]});var _0x45b78c=_0xf3a6('0x26');return db[_0xf3a6('0x4c')]['find']({'where':{'name':_0x45b78c,'userProfileId':_0x5522b6[_0xf3a6('0x4d')]},'raw':!![]})[_0xf3a6('0x23')](function(_0x4eceb3){if(_0x4eceb3&&_0x4eceb3[_0xf3a6('0x4e')]===0x0){return db[_0xf3a6('0x4f')]['create']({'name':_0x506918['name'],'resourceId':_0x506918['id'],'type':_0x4eceb3[_0xf3a6('0x29')],'sectionId':_0x4eceb3['id']},{})[_0xf3a6('0x23')](function(){return _0x2000e9;});}else{return _0x2000e9;}})[_0xf3a6('0x48')](function(_0x3eb4c8){logger[_0xf3a6('0x27')](_0xf3a6('0x50'),_0x3eb4c8);throw _0x3eb4c8;});}return _0x2000e9;})[_0xf3a6('0x23')](respondWithResult(_0x4f28f1,0xc9))[_0xf3a6('0x48')](handleError(_0x4f28f1,null));};exports['update']=function(_0x1ecdd,_0x31cadf){if(_0x1ecdd[_0xf3a6('0x51')]['id']){delete _0x1ecdd[_0xf3a6('0x51')]['id'];}return db[_0xf3a6('0x40')][_0xf3a6('0x47')]({'where':{'id':_0x1ecdd[_0xf3a6('0x45')]['id']}})[_0xf3a6('0x23')](handleEntityNotFound(_0x31cadf,null))['then'](saveUpdates(_0x1ecdd[_0xf3a6('0x51')],null))['then'](respondWithResult(_0x31cadf,null))['catch'](handleError(_0x31cadf,null));};exports[_0xf3a6('0x24')]=function(_0x3dced9,_0x43349d){return db[_0xf3a6('0x40')][_0xf3a6('0x47')]({'where':{'id':_0x3dced9['params']['id']}})[_0xf3a6('0x23')](handleEntityNotFound(_0x43349d,null))[_0xf3a6('0x23')](removeEntity(_0x43349d,null))[_0xf3a6('0x48')](handleError(_0x43349d,null));}; \ No newline at end of file +var _0x6fff=['Variable','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','find','catch','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Variables','UserProfileSection','create','update','params','html-pdf','eml-format','rimraf','zip-dir','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map'];(function(_0xe42b10,_0x3a1a35){var _0x504c6d=function(_0x5b85d0){while(--_0x5b85d0){_0xe42b10['push'](_0xe42b10['shift']());}};_0x504c6d(++_0x3a1a35);}(_0x6fff,0x194));var _0xf6ff=function(_0x46b9fc,_0x416f30){_0x46b9fc=_0x46b9fc-0x0;var _0x2c83d2=_0x6fff[_0x46b9fc];return _0x2c83d2;};'use strict';var pdf=require(_0xf6ff('0x0'));var emlformat=require(_0xf6ff('0x1'));var rimraf=require(_0xf6ff('0x2'));var zipdir=require(_0xf6ff('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf6ff('0x4'));var util=require('util');var path=require(_0xf6ff('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf6ff('0x6'));var fs=require('fs');var fs_extra=require(_0xf6ff('0x7'));var _=require(_0xf6ff('0x8'));var squel=require(_0xf6ff('0x9'));var crypto=require(_0xf6ff('0xa'));var jsforce=require(_0xf6ff('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf6ff('0xc'));var querystring=require('querystring');var Papa=require(_0xf6ff('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf6ff('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf6ff('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xf6ff('0x10'));var config=require(_0xf6ff('0x11'));var licenseUtil=require(_0xf6ff('0x12'));var db=require(_0xf6ff('0x13'))['db'];function respondWithStatusCode(_0x1a78e6,_0x374bb3){_0x374bb3=_0x374bb3||0xcc;return function(_0x5595c0){if(_0x5595c0){return _0x1a78e6[_0xf6ff('0x14')](_0x374bb3);}return _0x1a78e6[_0xf6ff('0x15')](_0x374bb3)['end']();};}function respondWithResult(_0x116171,_0x4a7cbd){_0x4a7cbd=_0x4a7cbd||0xc8;return function(_0x513ab8){if(_0x513ab8){return _0x116171['status'](_0x4a7cbd)['json'](_0x513ab8);}};}function respondWithFilteredResult(_0x3cb0a3,_0x2eec4d){return function(_0x2cbac1){if(_0x2cbac1){var _0x3206a1=_0x2cbac1[_0xf6ff('0x16')],_0x2d338a=_0x2eec4d[_0xf6ff('0x17')],_0x187342=_0x2eec4d[_0xf6ff('0x17')]+_0x2eec4d[_0xf6ff('0x18')],_0x2a2327;if(_0x187342>=_0x3206a1){_0x187342=_0x3206a1;_0x2a2327=0xc8;}else{_0x2a2327=0xce;}_0x3cb0a3[_0xf6ff('0x15')](_0x2a2327);return _0x3cb0a3['set'](_0xf6ff('0x19'),_0x2d338a+'-'+_0x187342+'/'+_0x3206a1)['json'](_0x2cbac1);}return null;};}function patchUpdates(_0x458145){return function(_0x59b38b){try{jsonpatch[_0xf6ff('0x1a')](_0x59b38b,_0x458145,!![]);}catch(_0x313140){return BPromise[_0xf6ff('0x1b')](_0x313140);}return _0x59b38b[_0xf6ff('0x1c')]();};}function saveUpdates(_0x3cd4e6,_0x4ce989){return function(_0x23e152){if(_0x23e152){return _0x23e152['update'](_0x3cd4e6)[_0xf6ff('0x1d')](function(_0x15ac75){return _0x15ac75;});}return null;};}function removeEntity(_0x329364,_0x4765ec){return function(_0x3a31fe){if(_0x3a31fe){return _0x3a31fe[_0xf6ff('0x1e')]()[_0xf6ff('0x1d')](function(){var _0x5f43c8=_0x3a31fe[_0xf6ff('0x1f')]({'plain':!![]});var _0x5eba91='Variables';return db[_0xf6ff('0x20')][_0xf6ff('0x1e')]({'where':{'type':_0x5eba91,'resourceId':_0x5f43c8['id']}})['then'](function(){return _0x3a31fe;});})[_0xf6ff('0x1d')](function(){_0x329364[_0xf6ff('0x15')](0xcc)[_0xf6ff('0x21')]();});}};}function handleEntityNotFound(_0x5a2f86,_0xfbb794){return function(_0x475fb8){if(!_0x475fb8){_0x5a2f86[_0xf6ff('0x14')](0x194);}return _0x475fb8;};}function handleError(_0x5810a1,_0x767b18){_0x767b18=_0x767b18||0x1f4;return function(_0x3ddfaa){logger[_0xf6ff('0x22')](_0x3ddfaa[_0xf6ff('0x23')]);if(_0x3ddfaa[_0xf6ff('0x24')]){delete _0x3ddfaa[_0xf6ff('0x24')];}_0x5810a1[_0xf6ff('0x15')](_0x767b18)[_0xf6ff('0x25')](_0x3ddfaa);};}exports[_0xf6ff('0x26')]=function(_0xd8a8e0,_0x5e7071){var _0x2f20c1={},_0x295ed7={},_0x4e5378={'count':0x0,'rows':[]};var _0x4bac1b=_[_0xf6ff('0x27')](db[_0xf6ff('0x28')][_0xf6ff('0x29')],function(_0x38691d){return{'name':_0x38691d['fieldName'],'type':_0x38691d[_0xf6ff('0x2a')][_0xf6ff('0x2b')]};});_0x295ed7[_0xf6ff('0x2c')]=_[_0xf6ff('0x27')](_0x4bac1b,_0xf6ff('0x24'));_0x295ed7['query']=_[_0xf6ff('0x2d')](_0xd8a8e0[_0xf6ff('0x2e')]);_0x295ed7[_0xf6ff('0x2f')]=_[_0xf6ff('0x30')](_0x295ed7[_0xf6ff('0x2c')],_0x295ed7[_0xf6ff('0x2e')]);_0x2f20c1[_0xf6ff('0x31')]=_[_0xf6ff('0x30')](_0x295ed7[_0xf6ff('0x2c')],qs[_0xf6ff('0x32')](_0xd8a8e0[_0xf6ff('0x2e')]['fields']));_0x2f20c1[_0xf6ff('0x31')]=_0x2f20c1[_0xf6ff('0x31')][_0xf6ff('0x33')]?_0x2f20c1[_0xf6ff('0x31')]:_0x295ed7[_0xf6ff('0x2c')];if(!_0xd8a8e0[_0xf6ff('0x2e')][_0xf6ff('0x34')]('nolimit')){_0x2f20c1['limit']=qs[_0xf6ff('0x18')](_0xd8a8e0['query']['limit']);_0x2f20c1['offset']=qs[_0xf6ff('0x17')](_0xd8a8e0[_0xf6ff('0x2e')][_0xf6ff('0x17')]);}_0x2f20c1['order']=qs[_0xf6ff('0x35')](_0xd8a8e0[_0xf6ff('0x2e')][_0xf6ff('0x35')]);_0x2f20c1[_0xf6ff('0x36')]=qs[_0xf6ff('0x2f')](_['pick'](_0xd8a8e0[_0xf6ff('0x2e')],_0x295ed7[_0xf6ff('0x2f')]),_0x4bac1b);if(_0xd8a8e0[_0xf6ff('0x2e')][_0xf6ff('0x37')]){_0x2f20c1['where']=_[_0xf6ff('0x38')](_0x2f20c1[_0xf6ff('0x36')],{'$or':_[_0xf6ff('0x27')](_0x4bac1b,function(_0x2495fa){if(_0x2495fa[_0xf6ff('0x2a')]!=='VIRTUAL'){var _0x2990a1={};_0x2990a1[_0x2495fa[_0xf6ff('0x24')]]={'$like':'%'+_0xd8a8e0[_0xf6ff('0x2e')][_0xf6ff('0x37')]+'%'};return _0x2990a1;}})});}_0x2f20c1=_[_0xf6ff('0x38')]({},_0x2f20c1,_0xd8a8e0[_0xf6ff('0x39')]);var _0x4eb16d={'where':_0x2f20c1[_0xf6ff('0x36')]};return db[_0xf6ff('0x28')][_0xf6ff('0x16')](_0x4eb16d)[_0xf6ff('0x1d')](function(_0x17fea8){_0x4e5378[_0xf6ff('0x16')]=_0x17fea8;if(_0xd8a8e0[_0xf6ff('0x2e')][_0xf6ff('0x3a')]){_0x2f20c1[_0xf6ff('0x3b')]=[{'all':!![]}];}return db[_0xf6ff('0x28')][_0xf6ff('0x3c')](_0x2f20c1);})['then'](function(_0x137e49){_0x4e5378[_0xf6ff('0x3d')]=_0x137e49;return _0x4e5378;})['then'](respondWithFilteredResult(_0x5e7071,_0x2f20c1))['catch'](handleError(_0x5e7071,null));};exports[_0xf6ff('0x3e')]=function(_0x2c5ad2,_0x5a0296){var _0x3f40fb={'raw':!![],'where':{'id':_0x2c5ad2['params']['id']}},_0x217b15={};_0x217b15[_0xf6ff('0x2c')]=_[_0xf6ff('0x2d')](db[_0xf6ff('0x28')][_0xf6ff('0x29')]);_0x217b15['query']=_[_0xf6ff('0x2d')](_0x2c5ad2[_0xf6ff('0x2e')]);_0x217b15[_0xf6ff('0x2f')]=_['intersection'](_0x217b15['model'],_0x217b15[_0xf6ff('0x2e')]);_0x3f40fb[_0xf6ff('0x31')]=_[_0xf6ff('0x30')](_0x217b15[_0xf6ff('0x2c')],qs[_0xf6ff('0x32')](_0x2c5ad2['query'][_0xf6ff('0x32')]));_0x3f40fb['attributes']=_0x3f40fb[_0xf6ff('0x31')][_0xf6ff('0x33')]?_0x3f40fb[_0xf6ff('0x31')]:_0x217b15['model'];if(_0x2c5ad2['query'][_0xf6ff('0x3a')]){_0x3f40fb[_0xf6ff('0x3b')]=[{'all':!![]}];}_0x3f40fb=_[_0xf6ff('0x38')]({},_0x3f40fb,_0x2c5ad2[_0xf6ff('0x39')]);return db[_0xf6ff('0x28')][_0xf6ff('0x3f')](_0x3f40fb)[_0xf6ff('0x1d')](handleEntityNotFound(_0x5a0296,null))[_0xf6ff('0x1d')](respondWithResult(_0x5a0296,null))[_0xf6ff('0x40')](handleError(_0x5a0296,null));};exports['create']=function(_0x450b73,_0x36ccda){return db[_0xf6ff('0x28')]['create'](_0x450b73[_0xf6ff('0x41')],{})[_0xf6ff('0x1d')](function(_0x593e36){var _0xf3eb94=_0x450b73['user'][_0xf6ff('0x1f')]({'plain':!![]});if(!_0xf3eb94)throw new Error(_0xf6ff('0x42'));if(_0xf3eb94[_0xf6ff('0x43')]===_0xf6ff('0x44')){var _0x278483=_0x593e36['get']({'plain':!![]});var _0x49de6a=_0xf6ff('0x45');return db[_0xf6ff('0x46')]['find']({'where':{'name':_0x49de6a,'userProfileId':_0xf3eb94['userProfileId']},'raw':!![]})[_0xf6ff('0x1d')](function(_0x2d9053){if(_0x2d9053&&_0x2d9053['autoAssociation']===0x0){return db[_0xf6ff('0x20')][_0xf6ff('0x47')]({'name':_0x278483['name'],'resourceId':_0x278483['id'],'type':_0x2d9053[_0xf6ff('0x24')],'sectionId':_0x2d9053['id']},{})[_0xf6ff('0x1d')](function(){return _0x593e36;});}else{return _0x593e36;}})[_0xf6ff('0x40')](function(_0x16dfd6){logger[_0xf6ff('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16dfd6);throw _0x16dfd6;});}return _0x593e36;})[_0xf6ff('0x1d')](respondWithResult(_0x36ccda,0xc9))[_0xf6ff('0x40')](handleError(_0x36ccda,null));};exports[_0xf6ff('0x48')]=function(_0x3e0a92,_0x10efd4){if(_0x3e0a92[_0xf6ff('0x41')]['id']){delete _0x3e0a92[_0xf6ff('0x41')]['id'];}return db[_0xf6ff('0x28')][_0xf6ff('0x3f')]({'where':{'id':_0x3e0a92[_0xf6ff('0x49')]['id']}})[_0xf6ff('0x1d')](handleEntityNotFound(_0x10efd4,null))[_0xf6ff('0x1d')](saveUpdates(_0x3e0a92['body'],null))[_0xf6ff('0x1d')](respondWithResult(_0x10efd4,null))[_0xf6ff('0x40')](handleError(_0x10efd4,null));};exports['destroy']=function(_0xa3408b,_0x56a51f){return db['Variable'][_0xf6ff('0x3f')]({'where':{'id':_0xa3408b[_0xf6ff('0x49')]['id']}})[_0xf6ff('0x1d')](handleEntityNotFound(_0x56a51f,null))[_0xf6ff('0x1d')](removeEntity(_0x56a51f,null))[_0xf6ff('0x40')](handleError(_0x56a51f,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index fe492e6..cec847c 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 _0x7be1=['exports','define','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./variable.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7be1,0x98));var _0x17be=function(_0x55677b,_0x3e5655){_0x55677b=_0x55677b-0x0;var _0x104b88=_0x7be1[_0x55677b];return _0x104b88;};'use strict';var _=require('lodash');var util=require(_0x17be('0x0'));var logger=require(_0x17be('0x1'))(_0x17be('0x2'));var moment=require(_0x17be('0x3'));var BPromise=require(_0x17be('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x17be('0x5'));var rimraf=require('rimraf');var config=require(_0x17be('0x6'));var attributes=require(_0x17be('0x7'));module[_0x17be('0x8')]=function(_0x108618,_0x4a9b31){return _0x108618[_0x17be('0x9')]('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb11e=['path','rimraf','../../config/environment','./variable.attributes','Variable','lodash','util','../../config/logger','api','moment'];(function(_0x245a77,_0x211139){var _0x4b8dab=function(_0x54b792){while(--_0x54b792){_0x245a77['push'](_0x245a77['shift']());}};_0x4b8dab(++_0x211139);}(_0xb11e,0x7d));var _0xeb11=function(_0x40568a,_0x382c00){_0x40568a=_0x40568a-0x0;var _0x477732=_0xb11e[_0x40568a];return _0x477732;};'use strict';var _=require(_0xeb11('0x0'));var util=require(_0xeb11('0x1'));var logger=require(_0xeb11('0x2'))(_0xeb11('0x3'));var moment=require(_0xeb11('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb11('0x5'));var rimraf=require(_0xeb11('0x6'));var config=require(_0xeb11('0x7'));var attributes=require(_0xeb11('0x8'));module['exports']=function(_0x252e4f,_0x5c54d8){return _0x252e4f['define'](_0xeb11('0x9'),attributes,{'tableName':'tools_variables','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 567ee06..3c6385e 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 _0xad05=['catch','Variable','find','options','where','attributes','include','map','model','then','ShowVariable','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','info','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','Variable,\x20%s,\x20%s','message','result'];(function(_0x1202c5,_0x5913ef){var _0x5345ec=function(_0x1e3f55){while(--_0x1e3f55){_0x1202c5['push'](_0x1202c5['shift']());}};_0x5345ec(++_0x5913ef);}(_0xad05,0x155));var _0x5ad0=function(_0x149ca0,_0x2ac7f5){_0x149ca0=_0x149ca0-0x0;var _0x56b6b9=_0xad05[_0x149ca0];return _0x56b6b9;};'use strict';var _=require(_0x5ad0('0x0'));var util=require('util');var moment=require(_0x5ad0('0x1'));var BPromise=require('bluebird');var rs=require(_0x5ad0('0x2'));var fs=require('fs');var Redis=require(_0x5ad0('0x3'));var db=require(_0x5ad0('0x4'))['db'];var utils=require(_0x5ad0('0x5'));var logger=require('../../config/logger')(_0x5ad0('0x6'));var config=require(_0x5ad0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5ad0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3dd710,_0x572988,_0x5c8535){return new BPromise(function(_0x53af08,_0x2f378d){return client[_0x5ad0('0x9')](_0x3dd710,_0x5c8535)['then'](function(_0x52ca5e){logger[_0x5ad0('0xa')]('Variable,\x20%s,\x20%s',_0x572988,_0x5ad0('0xb'));logger[_0x5ad0('0xc')](_0x5ad0('0xd'),_0x572988,_0x5ad0('0xb'),JSON[_0x5ad0('0xe')](_0x52ca5e));if(_0x52ca5e[_0x5ad0('0xf')]){if(_0x52ca5e['error']['code']===0x1f4){logger[_0x5ad0('0xf')](_0x5ad0('0x10'),_0x572988,_0x52ca5e[_0x5ad0('0xf')][_0x5ad0('0x11')]);return _0x2f378d(_0x52ca5e[_0x5ad0('0xf')][_0x5ad0('0x11')]);}logger['error'](_0x5ad0('0x10'),_0x572988,_0x52ca5e['error'][_0x5ad0('0x11')]);return _0x53af08(_0x52ca5e['error'][_0x5ad0('0x11')]);}else{logger[_0x5ad0('0xa')](_0x5ad0('0x10'),_0x572988,_0x5ad0('0xb'));_0x53af08(_0x52ca5e[_0x5ad0('0x12')][_0x5ad0('0x11')]);}})[_0x5ad0('0x13')](function(_0xde341a){logger[_0x5ad0('0xf')](_0x5ad0('0x10'),_0x572988,_0xde341a);_0x2f378d(_0xde341a);});});}exports['ShowVariable']=function(_0x5d23f3){var _0x508655=this;return new Promise(function(_0x121ad7,_0x56c5c6){return db[_0x5ad0('0x14')][_0x5ad0('0x15')]({'raw':_0x5d23f3[_0x5ad0('0x16')]?_0x5d23f3[_0x5ad0('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5d23f3[_0x5ad0('0x16')]?_0x5d23f3[_0x5ad0('0x16')][_0x5ad0('0x17')]||null:null,'attributes':_0x5d23f3[_0x5ad0('0x16')]?_0x5d23f3[_0x5ad0('0x16')][_0x5ad0('0x18')]||null:null,'include':_0x5d23f3[_0x5ad0('0x16')]?_0x5d23f3[_0x5ad0('0x16')][_0x5ad0('0x19')]?_[_0x5ad0('0x1a')](_0x5d23f3[_0x5ad0('0x16')][_0x5ad0('0x19')],function(_0x239360){return{'model':db[_0x239360[_0x5ad0('0x1b')]],'as':_0x239360['as'],'attributes':_0x239360[_0x5ad0('0x18')],'include':_0x239360[_0x5ad0('0x19')]?_[_0x5ad0('0x1a')](_0x239360[_0x5ad0('0x19')],function(_0x3c0328){return{'model':db[_0x3c0328[_0x5ad0('0x1b')]],'as':_0x3c0328['as'],'attributes':_0x3c0328[_0x5ad0('0x18')],'include':_0x3c0328[_0x5ad0('0x19')]?_['map'](_0x3c0328[_0x5ad0('0x19')],function(_0x262adc){return{'model':db[_0x262adc[_0x5ad0('0x1b')]],'as':_0x262adc['as'],'attributes':_0x262adc[_0x5ad0('0x18')]};}):[]};}):[]};}):[]:[]})[_0x5ad0('0x1c')](function(_0x10bf8e){logger[_0x5ad0('0xa')](_0x5ad0('0x1d'),_0x5d23f3);logger[_0x5ad0('0xc')](_0x5ad0('0x1d'),_0x5d23f3,JSON[_0x5ad0('0xe')](_0x10bf8e));_0x121ad7(_0x10bf8e);})[_0x5ad0('0x13')](function(_0x3abeeb){logger[_0x5ad0('0xf')](_0x5ad0('0x1d'),_0x3abeeb[_0x5ad0('0x11')],_0x5d23f3);_0x56c5c6(_0x508655[_0x5ad0('0xf')](0x1f4,_0x3abeeb[_0x5ad0('0x11')]));});});}; \ No newline at end of file +var _0x4350=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','find','options','raw','where','attributes','include','map','model'];(function(_0x5c5f74,_0x112d64){var _0x6f9650=function(_0x45aa87){while(--_0x45aa87){_0x5c5f74['push'](_0x5c5f74['shift']());}};_0x6f9650(++_0x112d64);}(_0x4350,0x1b2));var _0x0435=function(_0x1ef3bc,_0x5e1f83){_0x1ef3bc=_0x1ef3bc-0x0;var _0x111ede=_0x4350[_0x1ef3bc];return _0x111ede;};'use strict';var _=require(_0x0435('0x0'));var util=require(_0x0435('0x1'));var moment=require('moment');var BPromise=require(_0x0435('0x2'));var rs=require(_0x0435('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0435('0x4'))['db'];var utils=require(_0x0435('0x5'));var logger=require('../../config/logger')(_0x0435('0x6'));var config=require(_0x0435('0x7'));var jayson=require(_0x0435('0x8'));var client=jayson[_0x0435('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x434207,_0x191dc6,_0x4f2c28){return new BPromise(function(_0x296c67,_0x50a5a4){return client['request'](_0x434207,_0x4f2c28)[_0x0435('0xa')](function(_0x2bb378){logger[_0x0435('0xb')](_0x0435('0xc'),_0x191dc6,_0x0435('0xd'));logger[_0x0435('0xe')](_0x0435('0xf'),_0x191dc6,'request\x20sent',JSON[_0x0435('0x10')](_0x2bb378));if(_0x2bb378[_0x0435('0x11')]){if(_0x2bb378[_0x0435('0x11')]['code']===0x1f4){logger[_0x0435('0x11')](_0x0435('0xc'),_0x191dc6,_0x2bb378[_0x0435('0x11')]['message']);return _0x50a5a4(_0x2bb378[_0x0435('0x11')][_0x0435('0x12')]);}logger[_0x0435('0x11')]('Variable,\x20%s,\x20%s',_0x191dc6,_0x2bb378[_0x0435('0x11')][_0x0435('0x12')]);return _0x296c67(_0x2bb378[_0x0435('0x11')][_0x0435('0x12')]);}else{logger[_0x0435('0xb')]('Variable,\x20%s,\x20%s',_0x191dc6,_0x0435('0xd'));_0x296c67(_0x2bb378[_0x0435('0x13')]['message']);}})[_0x0435('0x14')](function(_0x136b49){logger[_0x0435('0x11')]('Variable,\x20%s,\x20%s',_0x191dc6,_0x136b49);_0x50a5a4(_0x136b49);});});}exports[_0x0435('0x15')]=function(_0x85075){var _0x5b9f61=this;return new Promise(function(_0x4636e6,_0x566b7f){return db[_0x0435('0x16')][_0x0435('0x17')]({'raw':_0x85075['options']?_0x85075[_0x0435('0x18')][_0x0435('0x19')]===undefined?!![]:![]:!![],'where':_0x85075['options']?_0x85075[_0x0435('0x18')][_0x0435('0x1a')]||null:null,'attributes':_0x85075[_0x0435('0x18')]?_0x85075[_0x0435('0x18')][_0x0435('0x1b')]||null:null,'include':_0x85075['options']?_0x85075[_0x0435('0x18')][_0x0435('0x1c')]?_[_0x0435('0x1d')](_0x85075[_0x0435('0x18')]['include'],function(_0x22ba83){return{'model':db[_0x22ba83[_0x0435('0x1e')]],'as':_0x22ba83['as'],'attributes':_0x22ba83[_0x0435('0x1b')],'include':_0x22ba83[_0x0435('0x1c')]?_[_0x0435('0x1d')](_0x22ba83[_0x0435('0x1c')],function(_0x1ed66c){return{'model':db[_0x1ed66c['model']],'as':_0x1ed66c['as'],'attributes':_0x1ed66c[_0x0435('0x1b')],'include':_0x1ed66c[_0x0435('0x1c')]?_[_0x0435('0x1d')](_0x1ed66c[_0x0435('0x1c')],function(_0x1f4162){return{'model':db[_0x1f4162[_0x0435('0x1e')]],'as':_0x1f4162['as'],'attributes':_0x1f4162[_0x0435('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0435('0xa')](function(_0x552914){logger['info'](_0x0435('0x15'),_0x85075);logger[_0x0435('0xe')]('ShowVariable',_0x85075,JSON[_0x0435('0x10')](_0x552914));_0x4636e6(_0x552914);})[_0x0435('0x14')](function(_0x1b107c){logger[_0x0435('0x11')](_0x0435('0x15'),_0x1b107c[_0x0435('0x12')],_0x85075);_0x566b7f(_0x5b9f61[_0x0435('0x11')](0x1f4,_0x1b107c[_0x0435('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 7a21f3e..527a939 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 _0xe84a=['./version.controller','index','get','isAuthenticated','canUpdate','fetch','reset','/pull','/restart','migrations','exports','express','Router','../../components/auth/service'];(function(_0x13ca65,_0x58e48e){var _0x48394f=function(_0x2675d2){while(--_0x2675d2){_0x13ca65['push'](_0x13ca65['shift']());}};_0x48394f(++_0x58e48e);}(_0xe84a,0x97));var _0xae84=function(_0x564527,_0x10a786){_0x564527=_0x564527-0x0;var _0x11909f=_0xe84a[_0x564527];return _0x11909f;};'use strict';var express=require(_0xae84('0x0'));var router=express[_0xae84('0x1')]();var auth=require(_0xae84('0x2'));var controller=require(_0xae84('0x3'));router['get']('/',controller[_0xae84('0x4')]);router[_0xae84('0x5')]('/fetch',auth[_0xae84('0x6')](),auth[_0xae84('0x7')](),controller[_0xae84('0x8')]);router[_0xae84('0x5')]('/reset',auth[_0xae84('0x6')](),auth[_0xae84('0x7')](),controller[_0xae84('0x9')]);router[_0xae84('0x5')](_0xae84('0xa'),auth[_0xae84('0x6')](),auth[_0xae84('0x7')](),controller['pull']);router['get'](_0xae84('0xb'),auth[_0xae84('0x6')](),controller['restart']);router[_0xae84('0x5')]('/migrations',controller[_0xae84('0xc')]);module[_0xae84('0xd')]=router; \ No newline at end of file +var _0xabca=['Router','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','reset','pull','/restart','restart','/migrations','migrations','exports','express'];(function(_0x423128,_0x523828){var _0x1665b3=function(_0x150419){while(--_0x150419){_0x423128['push'](_0x423128['shift']());}};_0x1665b3(++_0x523828);}(_0xabca,0x1af));var _0xaabc=function(_0x23dd1e,_0x1d2798){_0x23dd1e=_0x23dd1e-0x0;var _0x46df2e=_0xabca[_0x23dd1e];return _0x46df2e;};'use strict';var express=require(_0xaabc('0x0'));var router=express[_0xaabc('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xaabc('0x2'));router[_0xaabc('0x3')]('/',controller[_0xaabc('0x4')]);router[_0xaabc('0x3')](_0xaabc('0x5'),auth[_0xaabc('0x6')](),auth[_0xaabc('0x7')](),controller[_0xaabc('0x8')]);router[_0xaabc('0x3')]('/reset',auth[_0xaabc('0x6')](),auth['canUpdate'](),controller[_0xaabc('0x9')]);router['get']('/pull',auth['isAuthenticated'](),auth[_0xaabc('0x7')](),controller[_0xaabc('0xa')]);router[_0xaabc('0x3')](_0xaabc('0xb'),auth[_0xaabc('0x6')](),controller[_0xaabc('0xc')]);router[_0xaabc('0x3')](_0xaabc('0xd'),controller[_0xaabc('0xe')]);module[_0xaabc('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index b05f2ed..898a20b 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 _0xf777=['child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','simple-git','index','exports','query','fetch','tags','latest','2.0.0','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','readdirSync','join','root','server','length','replace','.js','sort','sequelize','Migration','getQueryInterface','constructor','migrations','map','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions'];(function(_0x546358,_0x3b7292){var _0xa95e60=function(_0x42157c){while(--_0x42157c){_0x546358['push'](_0x546358['shift']());}};_0xa95e60(++_0x3b7292);}(_0xf777,0x1e9));var _0x7f77=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf777[_0x20a584];return _0x4b41a8;};'use strict';var Umzug=require(_0x7f77('0x0'));var path=require(_0x7f77('0x1'));var fs=require('fs');var _=require(_0x7f77('0x2'));var pkginfo=require(_0x7f77('0x3'))(module,_0x7f77('0x4'));var compareVersions=require(_0x7f77('0x5'));var exec=require(_0x7f77('0x6'))[_0x7f77('0x7')];var db=require(_0x7f77('0x8'))['db'];var config=require('../../config/environment');var pm2=require(_0x7f77('0x9'));var logger=require(_0x7f77('0xa'))('update');var git=require(_0x7f77('0xb'))(config['root']);exports[_0x7f77('0xc')]=function(_0x598934,_0x87bd54){var _0x322466={'current':module[_0x7f77('0xd')][_0x7f77('0x4')],'phonebar':0x2};if(_0x598934[_0x7f77('0xe')]&&_0x598934['query']['latest']){return git[_0x7f77('0xf')]()[_0x7f77('0x10')](function(_0x284329,_0x110aaa){_0x322466[_0x7f77('0x11')]=(_0x284329?module['exports'][_0x7f77('0x4')]:_0x110aaa[_0x7f77('0x11')])||_0x7f77('0x12');return _0x87bd54[_0x7f77('0x13')](0xc8)[_0x7f77('0x14')](_0x322466);});}else{return _0x87bd54['status'](0xc8)['json'](_0x322466);}};exports[_0x7f77('0xf')]=function(_0x18f698,_0x3f7a60){return git[_0x7f77('0xf')]([_0x7f77('0x15'),_0x7f77('0x16')],function(_0x1f0729){if(_0x1f0729){logger[_0x7f77('0x17')](_0x1f0729);return _0x3f7a60[_0x7f77('0x13')](0x1f4)[_0x7f77('0x14')](_0x1f0729);}logger[_0x7f77('0x18')](_0x7f77('0x19'));return _0x3f7a60[_0x7f77('0x13')](0xc8)[_0x7f77('0x14')]({'output':_0x7f77('0x1a')});});};exports[_0x7f77('0x1b')]=function(_0x4a4e3b,_0x5b2c85){return git[_0x7f77('0x1b')](['--hard',_0x7f77('0x1c')],function(_0x50eb96){if(_0x50eb96){logger[_0x7f77('0x17')](_0x50eb96);return _0x5b2c85[_0x7f77('0x13')](0x1f4)[_0x7f77('0x14')](_0x50eb96);}logger['info'](_0x7f77('0x1d'));return _0x5b2c85[_0x7f77('0x13')](0xc8)['json']({'output':_0x7f77('0x1e')});});};exports[_0x7f77('0x1f')]=function(_0x2d7654,_0x48647f){exec(_0x7f77('0x20'),function(_0x5b869c,_0x5c4049,_0xcb6a79){logger[_0x7f77('0x18')](_0x5c4049);logger['info'](_0xcb6a79);if(_0x5b869c){logger['error'](_0x5b869c);return _0x48647f[_0x7f77('0x13')](0x1f4)[_0x7f77('0x14')](_0x5b869c);}return _0x48647f[_0x7f77('0x13')](0xc8)['json']({'output':_0x5c4049});});};exports['restart']=function(_0x13662c,_0x8cf65b){return pm2[_0x7f77('0x21')](_0x7f77('0x22'))[_0x7f77('0x23')](function(_0x110f46){logger['info'](_0x7f77('0x24'),_0x110f46);return _0x8cf65b['status'](0xc8)[_0x7f77('0x14')]({'output':_0x7f77('0x25')});})['catch'](function(_0x2bd7e0){logger[_0x7f77('0x17')](_0x2bd7e0);return _0x8cf65b['status'](0x1f4)[_0x7f77('0x14')](_0x2bd7e0);});};exports['migrations']=function(_0x341b5a,_0x25fcae){var _0x1bae99=fs[_0x7f77('0x26')](path[_0x7f77('0x27')](config[_0x7f77('0x28')],_0x7f77('0x29'),'migrations'));var _0x268c18=[];for(var _0x26c84c=0x0;_0x26c84c<_0x1bae99[_0x7f77('0x2a')];_0x26c84c++){var _0x41be46=_0x1bae99[_0x26c84c][_0x7f77('0x2b')](_0x7f77('0x2c'),'');if(compareVersions(module[_0x7f77('0xd')]['version'],_0x41be46)===-0x1){_0x268c18['push'](_0x41be46);}}if(_0x268c18['length']){var _0x11723e=_0x268c18[_0x7f77('0x2d')](compareVersions);var _0x2c43de=new Umzug({'storage':_0x7f77('0x2e'),'storageOptions':{'model':db[_0x7f77('0x2f')],'modelName':_0x7f77('0x2f'),'columnName':_0x7f77('0x4')},'migrations':{'params':[db[_0x7f77('0x2e')][_0x7f77('0x30')](),db[_0x7f77('0x2e')][_0x7f77('0x31')],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[_0x7f77('0x27')](config[_0x7f77('0x28')],_0x7f77('0x29'),_0x7f77('0x32')),'pattern':/\.js$/}});_0x2c43de['up']({'migrations':_[_0x7f77('0x33')](_0x11723e,function(_0x43b51f){return _0x43b51f+_0x7f77('0x2c');})})[_0x7f77('0x23')](function(){return _0x25fcae[_0x7f77('0x13')](0xc8)[_0x7f77('0x14')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x7f77('0xd')]['version']+_0x7f77('0x34')+_[_0x7f77('0x35')](_0x11723e),'migrations':_['join'](_0x11723e)});})['catch'](function(_0x4437a8){if(_0x4437a8 instanceof db[_0x7f77('0x2e')]['UniqueConstraintError']){return _0x25fcae[_0x7f77('0x13')](0xc8)['json']({'output':_0x7f77('0x36')});}else{return _0x25fcae[_0x7f77('0x13')](0x1f4)['json'](_0x4437a8);}});}else{return _0x25fcae[_0x7f77('0x13')](0xc8)[_0x7f77('0x14')]({'output':_0x7f77('0x36')});}}; \ No newline at end of file +var _0x24bb=['master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','root','server','length','.js','push','sort','Migration','sequelize','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','version','compare-versions','exec','../../config/pm2','../../config/logger','update','index','exports','query','fetch','tags','latest','status','json','origin'];(function(_0x4888b5,_0x329960){var _0x2dbf2b=function(_0x5f49c5){while(--_0x5f49c5){_0x4888b5['push'](_0x4888b5['shift']());}};_0x2dbf2b(++_0x329960);}(_0x24bb,0x19f));var _0xb24b=function(_0x4d2911,_0x60b9cd){_0x4d2911=_0x4d2911-0x0;var _0x336b92=_0x24bb[_0x4d2911];return _0x336b92;};'use strict';var Umzug=require(_0xb24b('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xb24b('0x1'));var pkginfo=require('pkginfo')(module,_0xb24b('0x2'));var compareVersions=require(_0xb24b('0x3'));var exec=require('child_process')[_0xb24b('0x4')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0xb24b('0x5'));var logger=require(_0xb24b('0x6'))(_0xb24b('0x7'));var git=require('simple-git')(config['root']);exports[_0xb24b('0x8')]=function(_0x3d19e7,_0x2860bb){var _0x8f07ac={'current':module[_0xb24b('0x9')][_0xb24b('0x2')],'phonebar':0x2};if(_0x3d19e7[_0xb24b('0xa')]&&_0x3d19e7[_0xb24b('0xa')]['latest']){return git[_0xb24b('0xb')]()[_0xb24b('0xc')](function(_0x3d68d3,_0x24a9c7){_0x8f07ac['latest']=(_0x3d68d3?module['exports'][_0xb24b('0x2')]:_0x24a9c7[_0xb24b('0xd')])||'2.0.0';return _0x2860bb[_0xb24b('0xe')](0xc8)[_0xb24b('0xf')](_0x8f07ac);});}else{return _0x2860bb[_0xb24b('0xe')](0xc8)['json'](_0x8f07ac);}};exports[_0xb24b('0xb')]=function(_0x1d7894,_0x4f93f6){return git[_0xb24b('0xb')]([_0xb24b('0x10'),_0xb24b('0x11')],function(_0x2f89f5){if(_0x2f89f5){logger[_0xb24b('0x12')](_0x2f89f5);return _0x4f93f6['status'](0x1f4)[_0xb24b('0xf')](_0x2f89f5);}logger[_0xb24b('0x13')](_0xb24b('0x14'));return _0x4f93f6[_0xb24b('0xe')](0xc8)[_0xb24b('0xf')]({'output':_0xb24b('0x15')});});};exports[_0xb24b('0x16')]=function(_0x5cf988,_0x3285c4){return git[_0xb24b('0x16')]([_0xb24b('0x17'),'FETCH_HEAD'],function(_0x70294){if(_0x70294){logger[_0xb24b('0x12')](_0x70294);return _0x3285c4['status'](0x1f4)[_0xb24b('0xf')](_0x70294);}logger[_0xb24b('0x13')](_0xb24b('0x18'));return _0x3285c4[_0xb24b('0xe')](0xc8)[_0xb24b('0xf')]({'output':_0xb24b('0x19')});});};exports['pull']=function(_0x163fd0,_0x37746f){exec(_0xb24b('0x1a'),function(_0x2e8664,_0xfc656d,_0x5cede6){logger[_0xb24b('0x13')](_0xfc656d);logger[_0xb24b('0x13')](_0x5cede6);if(_0x2e8664){logger[_0xb24b('0x12')](_0x2e8664);return _0x37746f[_0xb24b('0xe')](0x1f4)['json'](_0x2e8664);}return _0x37746f[_0xb24b('0xe')](0xc8)['json']({'output':_0xfc656d});});};exports['restart']=function(_0x3981c4,_0x360c3e){return pm2['restart'](_0xb24b('0x1b'))[_0xb24b('0x1c')](function(_0x1f7045){logger[_0xb24b('0x13')]('pm2\x20restart\x20motion\x20%s',_0x1f7045);return _0x360c3e['status'](0xc8)['json']({'output':_0xb24b('0x1d')});})[_0xb24b('0x1e')](function(_0x38975f){logger['error'](_0x38975f);return _0x360c3e[_0xb24b('0xe')](0x1f4)[_0xb24b('0xf')](_0x38975f);});};exports[_0xb24b('0x1f')]=function(_0x53888d,_0x112c4d){var _0x12d30a=fs[_0xb24b('0x20')](path['join'](config[_0xb24b('0x21')],_0xb24b('0x22'),_0xb24b('0x1f')));var _0x36c97e=[];for(var _0x4561b9=0x0;_0x4561b9<_0x12d30a[_0xb24b('0x23')];_0x4561b9++){var _0x1d2b34=_0x12d30a[_0x4561b9]['replace'](_0xb24b('0x24'),'');if(compareVersions(module[_0xb24b('0x9')][_0xb24b('0x2')],_0x1d2b34)===-0x1){_0x36c97e[_0xb24b('0x25')](_0x1d2b34);}}if(_0x36c97e[_0xb24b('0x23')]){var _0x1ee935=_0x36c97e[_0xb24b('0x26')](compareVersions);var _0x2fd3fe=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xb24b('0x27')],'modelName':_0xb24b('0x27'),'columnName':_0xb24b('0x2')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db[_0xb24b('0x28')][_0xb24b('0x29')],function(){throw new Error(_0xb24b('0x2a'));}],'path':path[_0xb24b('0x2b')](config[_0xb24b('0x21')],_0xb24b('0x22'),_0xb24b('0x1f')),'pattern':/\.js$/}});_0x2fd3fe['up']({'migrations':_['map'](_0x1ee935,function(_0x2c2add){return _0x2c2add+'.js';})})[_0xb24b('0x1c')](function(){return _0x112c4d[_0xb24b('0xe')](0xc8)[_0xb24b('0xf')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xb24b('0x9')]['version']+_0xb24b('0x2c')+_[_0xb24b('0x2d')](_0x1ee935),'migrations':_[_0xb24b('0x2b')](_0x1ee935)});})[_0xb24b('0x1e')](function(_0x1dc5e8){if(_0x1dc5e8 instanceof db['sequelize'][_0xb24b('0x2e')]){return _0x112c4d[_0xb24b('0xe')](0xc8)['json']({'output':_0xb24b('0x2f')});}else{return _0x112c4d[_0xb24b('0xe')](0x1f4)[_0xb24b('0xf')](_0x1dc5e8);}});}else{return _0x112c4d['status'](0xc8)['json']({'output':_0xb24b('0x2f')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 5be18df..8dea5e6 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 _0x0713=['delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update'];(function(_0x3a8324,_0x44ec1e){var _0x1e244a=function(_0x3a1bc0){while(--_0x3a1bc0){_0x3a8324['push'](_0x3a8324['shift']());}};_0x1e244a(++_0x44ec1e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x10')](_0x3071('0xd'),auth['isAuthenticated'](),controller[_0x3071('0x11')]);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);module['exports']=router; \ No newline at end of file +var _0x2032=['destroy','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','show','create','put','delete'];(function(_0x23942b,_0xfef9d3){var _0x46c97e=function(_0x403899){while(--_0x403899){_0x23942b['push'](_0x23942b['shift']());}};_0x46c97e(++_0xfef9d3);}(_0x2032,0xd9));var _0x2203=function(_0x5e21af,_0x4be76a){_0x5e21af=_0x5e21af-0x0;var _0x39cc91=_0x2032[_0x5e21af];return _0x39cc91;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post']('/',auth[_0x2203('0x9')](),controller[_0x2203('0xe')]);router[_0x2203('0xf')]('/:id',auth[_0x2203('0x9')](),controller['update']);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index b3d7c76..a29d096 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 _0xb138=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x4fba4e,_0x53774a){var _0xf0a188=function(_0x3f66c5){while(--_0x3f66c5){_0x4fba4e['push'](_0x4fba4e['shift']());}};_0xf0a188(++_0x53774a);}(_0xb138,0x1dd));var _0x8b13=function(_0x2962da,_0x4de77a){_0x2962da=_0x2962da-0x0;var _0x523244=_0xb138[_0x2962da];return _0x523244;};'use strict';var Sequelize=require(_0x8b13('0x0'));module[_0x8b13('0x1')]={'type':{'type':Sequelize[_0x8b13('0x2')]},'uniqueid':{'type':Sequelize[_0x8b13('0x2')]},'calleridnum':{'type':Sequelize[_0x8b13('0x2')]},'calleridname':{'type':Sequelize[_0x8b13('0x2')]},'queue':{'type':Sequelize[_0x8b13('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x8b13('0x2')]},'agentcalledAt':{'type':Sequelize[_0x8b13('0x3')]},'agentconnectAt':{'type':Sequelize[_0x8b13('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x8b13('0x3')]},'agentdumpAt':{'type':Sequelize[_0x8b13('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x8b13('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x8b13('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x8b13('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x8b13('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8b13('0x5')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8b13('0x2')]},'channelstate':{'type':Sequelize[_0x8b13('0x5')]},'channelstatedesc':{'type':Sequelize[_0x8b13('0x2')]},'connectedlinenum':{'type':Sequelize[_0x8b13('0x2')]},'connectedlinename':{'type':Sequelize[_0x8b13('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8b13('0x2')]},'context':{'type':Sequelize[_0x8b13('0x2')]},'exten':{'type':Sequelize[_0x8b13('0x2')]},'priority':{'type':Sequelize[_0x8b13('0x2')]},'destchannel':{'type':Sequelize[_0x8b13('0x2')]},'destchannelstate':{'type':Sequelize[_0x8b13('0x5')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x8b13('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x8b13('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x8b13('0x2')]},'destexten':{'type':Sequelize[_0x8b13('0x2')]},'destpriority':{'type':Sequelize[_0x8b13('0x2')]},'destuniqueid':{'type':Sequelize[_0x8b13('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x8b13('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x8b13('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8b13('0x2')],'comment':_0x8b13('0x6')},'transferexten':{'type':Sequelize[_0x8b13('0x2')]},'transferuniqueid':{'type':Sequelize[_0x8b13('0x2')]},'agententerreason':{'type':Sequelize[_0x8b13('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5d17=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5d17,0x114));var _0x75d1=function(_0x4ac31f,_0x3bf843){_0x4ac31f=_0x4ac31f-0x0;var _0x1f1926=_0x5d17[_0x4ac31f];return _0x1f1926;};'use strict';var Sequelize=require(_0x75d1('0x0'));module[_0x75d1('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x75d1('0x2')]},'calleridname':{'type':Sequelize[_0x75d1('0x2')]},'queue':{'type':Sequelize[_0x75d1('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x75d1('0x2')]},'agentcalledAt':{'type':Sequelize[_0x75d1('0x3')]},'agentconnectAt':{'type':Sequelize[_0x75d1('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x75d1('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x75d1('0x3')]},'holdtime':{'type':Sequelize[_0x75d1('0x4')]},'agentcomplete':{'type':Sequelize[_0x75d1('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x75d1('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x75d1('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x75d1('0x4')]},'agentacw':{'type':Sequelize[_0x75d1('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x75d1('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x75d1('0x2')]},'connectedlinenum':{'type':Sequelize[_0x75d1('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x75d1('0x2')]},'accountcode':{'type':Sequelize[_0x75d1('0x2')]},'context':{'type':Sequelize[_0x75d1('0x2')]},'exten':{'type':Sequelize[_0x75d1('0x2')]},'priority':{'type':Sequelize[_0x75d1('0x2')]},'destchannel':{'type':Sequelize[_0x75d1('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x75d1('0x2')]},'destcalleridnum':{'type':Sequelize[_0x75d1('0x2')]},'destcalleridname':{'type':Sequelize[_0x75d1('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x75d1('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x75d1('0x2')]},'destexten':{'type':Sequelize[_0x75d1('0x2')]},'destpriority':{'type':Sequelize[_0x75d1('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x75d1('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x75d1('0x2')]},'transfer':{'type':Sequelize[_0x75d1('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x75d1('0x2')],'comment':_0x75d1('0x6')},'transferexten':{'type':Sequelize[_0x75d1('0x2')]},'transferuniqueid':{'type':Sequelize[_0x75d1('0x2')]},'agententerreason':{'type':Sequelize[_0x75d1('0x4')],'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 0a9ce37..911ce56 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 _0xba2f=['then','sendStatus','error','stack','name','send','index','map','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','VoiceAgentReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','describe','rimraf','zip-dir','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','save'];(function(_0x1a3df8,_0xcf8361){var _0x2dee0a=function(_0x5da817){while(--_0x5da817){_0x1a3df8['push'](_0x1a3df8['shift']());}};_0x2dee0a(++_0xcf8361);}(_0xba2f,0x106));var _0xfba2=function(_0x3d844d,_0x398964){_0x3d844d=_0x3d844d-0x0;var _0x194a66=_0xba2f[_0x3d844d];return _0x194a66;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xfba2('0x0'));var zipdir=require(_0xfba2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfba2('0x2'));var moment=require(_0xfba2('0x3'));var BPromise=require(_0xfba2('0x4'));var Mustache=require('mustache');var util=require(_0xfba2('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xfba2('0x6'));var ejs=require(_0xfba2('0x7'));var fs=require('fs');var fs_extra=require(_0xfba2('0x8'));var _=require(_0xfba2('0x9'));var squel=require(_0xfba2('0xa'));var crypto=require(_0xfba2('0xb'));var jsforce=require(_0xfba2('0xc'));var deskjs=require(_0xfba2('0xd'));var toCsv=require(_0xfba2('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfba2('0xe'));var authService=require(_0xfba2('0xf'));var qs=require(_0xfba2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfba2('0x11'));var logger=require(_0xfba2('0x12'))(_0xfba2('0x13'));var utils=require(_0xfba2('0x14'));var config=require(_0xfba2('0x15'));var licenseUtil=require(_0xfba2('0x16'));var db=require(_0xfba2('0x17'))['db'];function respondWithStatusCode(_0x5978a9,_0x3c6fef){_0x3c6fef=_0x3c6fef||0xcc;return function(_0x51b4bb){if(_0x51b4bb){return _0x5978a9['sendStatus'](_0x3c6fef);}return _0x5978a9[_0xfba2('0x18')](_0x3c6fef)[_0xfba2('0x19')]();};}function respondWithResult(_0x5e5b62,_0x553570){_0x553570=_0x553570||0xc8;return function(_0x33a4e5){if(_0x33a4e5){return _0x5e5b62[_0xfba2('0x18')](_0x553570)[_0xfba2('0x1a')](_0x33a4e5);}};}function respondWithFilteredResult(_0x5bb724,_0x4db260){return function(_0x5bed09){if(_0x5bed09){var _0x51d510=_0x5bed09[_0xfba2('0x1b')],_0x5a98fe=_0x4db260['offset'],_0x304b85=_0x4db260[_0xfba2('0x1c')]+_0x4db260[_0xfba2('0x1d')],_0x5328d0;if(_0x304b85>=_0x51d510){_0x304b85=_0x51d510;_0x5328d0=0xc8;}else{_0x5328d0=0xce;}_0x5bb724[_0xfba2('0x18')](_0x5328d0);return _0x5bb724[_0xfba2('0x1e')]('Content-Range',_0x5a98fe+'-'+_0x304b85+'/'+_0x51d510)['json'](_0x5bed09);}return null;};}function patchUpdates(_0x3a1047){return function(_0x2975b7){try{jsonpatch[_0xfba2('0x1f')](_0x2975b7,_0x3a1047,!![]);}catch(_0x11f9b4){return BPromise[_0xfba2('0x20')](_0x11f9b4);}return _0x2975b7[_0xfba2('0x21')]();};}function saveUpdates(_0x438bfa,_0x8a2cf4){return function(_0x35cbbe){if(_0x35cbbe){return _0x35cbbe['update'](_0x438bfa)[_0xfba2('0x22')](function(_0x1e03cf){return _0x1e03cf;});}return null;};}function removeEntity(_0x2c2477,_0x37aca0){return function(_0x319be6){if(_0x319be6){return _0x319be6['destroy']()['then'](function(){_0x2c2477[_0xfba2('0x18')](0xcc)[_0xfba2('0x19')]();});}};}function handleEntityNotFound(_0x47ba83,_0xaf9fa9){return function(_0x44e0de){if(!_0x44e0de){_0x47ba83[_0xfba2('0x23')](0x194);}return _0x44e0de;};}function handleError(_0x528120,_0x51fb44){_0x51fb44=_0x51fb44||0x1f4;return function(_0x1e2830){logger[_0xfba2('0x24')](_0x1e2830[_0xfba2('0x25')]);if(_0x1e2830[_0xfba2('0x26')]){delete _0x1e2830[_0xfba2('0x26')];}_0x528120[_0xfba2('0x18')](_0x51fb44)[_0xfba2('0x27')](_0x1e2830);};}exports[_0xfba2('0x28')]=function(_0x136d0f,_0x4c098f){var _0x4ac020={},_0x18172d={},_0x35c3fd={'count':0x0,'rows':[]};var _0x1cff83=_[_0xfba2('0x29')](db['VoiceAgentReport']['rawAttributes'],function(_0x1d346d){return{'name':_0x1d346d['fieldName'],'type':_0x1d346d[_0xfba2('0x2a')][_0xfba2('0x2b')]};});_0x18172d[_0xfba2('0x2c')]=_[_0xfba2('0x29')](_0x1cff83,_0xfba2('0x26'));_0x18172d['query']=_[_0xfba2('0x2d')](_0x136d0f[_0xfba2('0x2e')]);_0x18172d[_0xfba2('0x2f')]=_[_0xfba2('0x30')](_0x18172d[_0xfba2('0x2c')],_0x18172d['query']);_0x4ac020[_0xfba2('0x31')]=_[_0xfba2('0x30')](_0x18172d[_0xfba2('0x2c')],qs[_0xfba2('0x32')](_0x136d0f['query'][_0xfba2('0x32')]));_0x4ac020[_0xfba2('0x31')]=_0x4ac020[_0xfba2('0x31')][_0xfba2('0x33')]?_0x4ac020[_0xfba2('0x31')]:_0x18172d[_0xfba2('0x2c')];if(!_0x136d0f[_0xfba2('0x2e')][_0xfba2('0x34')](_0xfba2('0x35'))){_0x4ac020[_0xfba2('0x1d')]=qs[_0xfba2('0x1d')](_0x136d0f['query'][_0xfba2('0x1d')]);_0x4ac020[_0xfba2('0x1c')]=qs['offset'](_0x136d0f[_0xfba2('0x2e')][_0xfba2('0x1c')]);}_0x4ac020[_0xfba2('0x36')]=qs[_0xfba2('0x37')](_0x136d0f[_0xfba2('0x2e')]['sort']);_0x4ac020[_0xfba2('0x38')]=qs[_0xfba2('0x2f')](_[_0xfba2('0x39')](_0x136d0f[_0xfba2('0x2e')],_0x18172d[_0xfba2('0x2f')]),_0x1cff83);if(_0x136d0f[_0xfba2('0x2e')]['filter']){_0x4ac020[_0xfba2('0x38')]=_[_0xfba2('0x3a')](_0x4ac020[_0xfba2('0x38')],{'$or':_['map'](_0x1cff83,function(_0x3f48d4){if(_0x3f48d4[_0xfba2('0x2a')]!=='VIRTUAL'){var _0x207423={};_0x207423[_0x3f48d4[_0xfba2('0x26')]]={'$like':'%'+_0x136d0f[_0xfba2('0x2e')]['filter']+'%'};return _0x207423;}})});}_0x4ac020=_['merge']({},_0x4ac020,_0x136d0f[_0xfba2('0x3b')]);var _0x4d3846={'where':_0x4ac020[_0xfba2('0x38')]};return db[_0xfba2('0x3c')]['count'](_0x4d3846)[_0xfba2('0x22')](function(_0x270a1b){_0x35c3fd['count']=_0x270a1b;if(_0x136d0f[_0xfba2('0x2e')][_0xfba2('0x3d')]){_0x4ac020[_0xfba2('0x3e')]=[{'all':!![]}];}return db[_0xfba2('0x3c')][_0xfba2('0x3f')](_0x4ac020);})['then'](function(_0x4bf10c){_0x35c3fd[_0xfba2('0x40')]=_0x4bf10c;return _0x35c3fd;})['then'](respondWithFilteredResult(_0x4c098f,_0x4ac020))[_0xfba2('0x41')](handleError(_0x4c098f,null));};exports[_0xfba2('0x42')]=function(_0x170cc1,_0x1f268c){var _0x5439cb={'raw':![],'where':{'id':_0x170cc1[_0xfba2('0x43')]['id']}},_0x38cc80={};_0x38cc80[_0xfba2('0x2c')]=_['keys'](db[_0xfba2('0x3c')][_0xfba2('0x44')]);_0x38cc80[_0xfba2('0x2e')]=_['keys'](_0x170cc1[_0xfba2('0x2e')]);_0x38cc80['filters']=_[_0xfba2('0x30')](_0x38cc80[_0xfba2('0x2c')],_0x38cc80[_0xfba2('0x2e')]);_0x5439cb[_0xfba2('0x31')]=_[_0xfba2('0x30')](_0x38cc80[_0xfba2('0x2c')],qs[_0xfba2('0x32')](_0x170cc1[_0xfba2('0x2e')]['fields']));_0x5439cb[_0xfba2('0x31')]=_0x5439cb[_0xfba2('0x31')][_0xfba2('0x33')]?_0x5439cb[_0xfba2('0x31')]:_0x38cc80['model'];if(_0x170cc1[_0xfba2('0x2e')][_0xfba2('0x3d')]){_0x5439cb[_0xfba2('0x3e')]=[{'all':!![]}];}_0x5439cb=_[_0xfba2('0x3a')]({},_0x5439cb,_0x170cc1[_0xfba2('0x3b')]);return db[_0xfba2('0x3c')][_0xfba2('0x45')](_0x5439cb)[_0xfba2('0x22')](handleEntityNotFound(_0x1f268c,null))[_0xfba2('0x22')](respondWithResult(_0x1f268c,null))[_0xfba2('0x41')](handleError(_0x1f268c,null));};exports[_0xfba2('0x46')]=function(_0x108a84,_0x568a8e){return db[_0xfba2('0x3c')]['create'](_0x108a84[_0xfba2('0x47')],{})[_0xfba2('0x22')](respondWithResult(_0x568a8e,0xc9))[_0xfba2('0x41')](handleError(_0x568a8e,null));};exports['update']=function(_0x368024,_0x215d1a){if(_0x368024[_0xfba2('0x47')]['id']){delete _0x368024['body']['id'];}return db[_0xfba2('0x3c')][_0xfba2('0x45')]({'where':{'id':_0x368024[_0xfba2('0x43')]['id']}})['then'](handleEntityNotFound(_0x215d1a,null))[_0xfba2('0x22')](saveUpdates(_0x368024['body'],null))[_0xfba2('0x22')](respondWithResult(_0x215d1a,null))[_0xfba2('0x41')](handleError(_0x215d1a,null));};exports[_0xfba2('0x48')]=function(_0x3d4f8e,_0x46c33d){return db[_0xfba2('0x3c')][_0xfba2('0x45')]({'where':{'id':_0x3d4f8e[_0xfba2('0x43')]['id']}})[_0xfba2('0x22')](handleEntityNotFound(_0x46c33d,null))['then'](removeEntity(_0x46c33d,null))[_0xfba2('0x41')](handleError(_0x46c33d,null));};exports[_0xfba2('0x49')]=function(_0x37782e,_0x330071){return db[_0xfba2('0x3c')]['describe']()[_0xfba2('0x22')](respondWithResult(_0x330071,null))[_0xfba2('0x41')](handleError(_0x330071,null));}; \ No newline at end of file +var _0x40df=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','where','filter','merge','VIRTUAL','options','includeAll','include','VoiceAgentReport','findAll','rows','catch','show','params','find','create','body','describe','html-pdf'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x40df,0x16c));var _0xf40d=function(_0x2bff88,_0x403bcf){_0x2bff88=_0x2bff88-0x0;var _0x302abc=_0x40df[_0x2bff88];return _0x302abc;};'use strict';var pdf=require(_0xf40d('0x0'));var emlformat=require(_0xf40d('0x1'));var rimraf=require(_0xf40d('0x2'));var zipdir=require(_0xf40d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf40d('0x4'));var moment=require(_0xf40d('0x5'));var BPromise=require(_0xf40d('0x6'));var Mustache=require('mustache');var util=require(_0xf40d('0x7'));var path=require(_0xf40d('0x8'));var sox=require(_0xf40d('0x9'));var csv=require(_0xf40d('0xa'));var ejs=require(_0xf40d('0xb'));var fs=require('fs');var fs_extra=require(_0xf40d('0xc'));var _=require(_0xf40d('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf40d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf40d('0xf'));var Papa=require('papaparse');var Redis=require(_0xf40d('0x10'));var authService=require(_0xf40d('0x11'));var qs=require(_0xf40d('0x12'));var as=require(_0xf40d('0x13'));var hardwareService=require(_0xf40d('0x14'));var logger=require(_0xf40d('0x15'))(_0xf40d('0x16'));var utils=require(_0xf40d('0x17'));var config=require(_0xf40d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf40d('0x19'))['db'];function respondWithStatusCode(_0x5f5c1b,_0x4f400e){_0x4f400e=_0x4f400e||0xcc;return function(_0x329b28){if(_0x329b28){return _0x5f5c1b['sendStatus'](_0x4f400e);}return _0x5f5c1b[_0xf40d('0x1a')](_0x4f400e)[_0xf40d('0x1b')]();};}function respondWithResult(_0x2ab870,_0x386831){_0x386831=_0x386831||0xc8;return function(_0x18dd56){if(_0x18dd56){return _0x2ab870[_0xf40d('0x1a')](_0x386831)[_0xf40d('0x1c')](_0x18dd56);}};}function respondWithFilteredResult(_0x3aa1bb,_0x42a60b){return function(_0x13c587){if(_0x13c587){var _0x576c10=_0x13c587[_0xf40d('0x1d')],_0x4be1e1=_0x42a60b['offset'],_0x3f38aa=_0x42a60b[_0xf40d('0x1e')]+_0x42a60b['limit'],_0x421db7;if(_0x3f38aa>=_0x576c10){_0x3f38aa=_0x576c10;_0x421db7=0xc8;}else{_0x421db7=0xce;}_0x3aa1bb[_0xf40d('0x1a')](_0x421db7);return _0x3aa1bb[_0xf40d('0x1f')](_0xf40d('0x20'),_0x4be1e1+'-'+_0x3f38aa+'/'+_0x576c10)['json'](_0x13c587);}return null;};}function patchUpdates(_0x266f24){return function(_0x18f36b){try{jsonpatch['apply'](_0x18f36b,_0x266f24,!![]);}catch(_0x545236){return BPromise['reject'](_0x545236);}return _0x18f36b['save']();};}function saveUpdates(_0x2dc396,_0x62c670){return function(_0x4dea06){if(_0x4dea06){return _0x4dea06['update'](_0x2dc396)[_0xf40d('0x21')](function(_0x3e0960){return _0x3e0960;});}return null;};}function removeEntity(_0xa65b45,_0xad8f35){return function(_0x4e2737){if(_0x4e2737){return _0x4e2737[_0xf40d('0x22')]()['then'](function(){_0xa65b45[_0xf40d('0x1a')](0xcc)[_0xf40d('0x1b')]();});}};}function handleEntityNotFound(_0x115c0e,_0x2e6b9b){return function(_0x16ef4f){if(!_0x16ef4f){_0x115c0e[_0xf40d('0x23')](0x194);}return _0x16ef4f;};}function handleError(_0x13e43f,_0x3d7612){_0x3d7612=_0x3d7612||0x1f4;return function(_0x201eac){logger[_0xf40d('0x24')](_0x201eac[_0xf40d('0x25')]);if(_0x201eac['name']){delete _0x201eac[_0xf40d('0x26')];}_0x13e43f[_0xf40d('0x1a')](_0x3d7612)['send'](_0x201eac);};}exports[_0xf40d('0x27')]=function(_0x200f5f,_0x1399fa){var _0x4f2806={},_0x9aa6a={},_0x5682dc={'count':0x0,'rows':[]};var _0x37d128=_[_0xf40d('0x28')](db['VoiceAgentReport'][_0xf40d('0x29')],function(_0x7a5b){return{'name':_0x7a5b[_0xf40d('0x2a')],'type':_0x7a5b[_0xf40d('0x2b')][_0xf40d('0x2c')]};});_0x9aa6a[_0xf40d('0x2d')]=_['map'](_0x37d128,_0xf40d('0x26'));_0x9aa6a['query']=_[_0xf40d('0x2e')](_0x200f5f[_0xf40d('0x2f')]);_0x9aa6a[_0xf40d('0x30')]=_[_0xf40d('0x31')](_0x9aa6a[_0xf40d('0x2d')],_0x9aa6a[_0xf40d('0x2f')]);_0x4f2806[_0xf40d('0x32')]=_[_0xf40d('0x31')](_0x9aa6a['model'],qs[_0xf40d('0x33')](_0x200f5f[_0xf40d('0x2f')][_0xf40d('0x33')]));_0x4f2806[_0xf40d('0x32')]=_0x4f2806[_0xf40d('0x32')][_0xf40d('0x34')]?_0x4f2806[_0xf40d('0x32')]:_0x9aa6a[_0xf40d('0x2d')];if(!_0x200f5f[_0xf40d('0x2f')][_0xf40d('0x35')]('nolimit')){_0x4f2806[_0xf40d('0x36')]=qs[_0xf40d('0x36')](_0x200f5f[_0xf40d('0x2f')][_0xf40d('0x36')]);_0x4f2806['offset']=qs[_0xf40d('0x1e')](_0x200f5f['query'][_0xf40d('0x1e')]);}_0x4f2806[_0xf40d('0x37')]=qs['sort'](_0x200f5f['query']['sort']);_0x4f2806[_0xf40d('0x38')]=qs['filters'](_['pick'](_0x200f5f[_0xf40d('0x2f')],_0x9aa6a[_0xf40d('0x30')]),_0x37d128);if(_0x200f5f[_0xf40d('0x2f')][_0xf40d('0x39')]){_0x4f2806[_0xf40d('0x38')]=_[_0xf40d('0x3a')](_0x4f2806[_0xf40d('0x38')],{'$or':_[_0xf40d('0x28')](_0x37d128,function(_0xe0789d){if(_0xe0789d[_0xf40d('0x2b')]!==_0xf40d('0x3b')){var _0x402073={};_0x402073[_0xe0789d['name']]={'$like':'%'+_0x200f5f['query']['filter']+'%'};return _0x402073;}})});}_0x4f2806=_[_0xf40d('0x3a')]({},_0x4f2806,_0x200f5f[_0xf40d('0x3c')]);var _0x225455={'where':_0x4f2806[_0xf40d('0x38')]};return db['VoiceAgentReport']['count'](_0x225455)[_0xf40d('0x21')](function(_0xea08d){_0x5682dc[_0xf40d('0x1d')]=_0xea08d;if(_0x200f5f[_0xf40d('0x2f')][_0xf40d('0x3d')]){_0x4f2806[_0xf40d('0x3e')]=[{'all':!![]}];}return db[_0xf40d('0x3f')][_0xf40d('0x40')](_0x4f2806);})[_0xf40d('0x21')](function(_0x5bee2f){_0x5682dc[_0xf40d('0x41')]=_0x5bee2f;return _0x5682dc;})[_0xf40d('0x21')](respondWithFilteredResult(_0x1399fa,_0x4f2806))[_0xf40d('0x42')](handleError(_0x1399fa,null));};exports[_0xf40d('0x43')]=function(_0x162b92,_0x4bf911){var _0x4dcee8={'raw':![],'where':{'id':_0x162b92[_0xf40d('0x44')]['id']}},_0x297bb8={};_0x297bb8[_0xf40d('0x2d')]=_[_0xf40d('0x2e')](db[_0xf40d('0x3f')][_0xf40d('0x29')]);_0x297bb8['query']=_['keys'](_0x162b92[_0xf40d('0x2f')]);_0x297bb8[_0xf40d('0x30')]=_[_0xf40d('0x31')](_0x297bb8['model'],_0x297bb8[_0xf40d('0x2f')]);_0x4dcee8[_0xf40d('0x32')]=_['intersection'](_0x297bb8['model'],qs[_0xf40d('0x33')](_0x162b92[_0xf40d('0x2f')][_0xf40d('0x33')]));_0x4dcee8[_0xf40d('0x32')]=_0x4dcee8[_0xf40d('0x32')]['length']?_0x4dcee8['attributes']:_0x297bb8[_0xf40d('0x2d')];if(_0x162b92[_0xf40d('0x2f')][_0xf40d('0x3d')]){_0x4dcee8['include']=[{'all':!![]}];}_0x4dcee8=_['merge']({},_0x4dcee8,_0x162b92['options']);return db[_0xf40d('0x3f')][_0xf40d('0x45')](_0x4dcee8)[_0xf40d('0x21')](handleEntityNotFound(_0x4bf911,null))[_0xf40d('0x21')](respondWithResult(_0x4bf911,null))[_0xf40d('0x42')](handleError(_0x4bf911,null));};exports[_0xf40d('0x46')]=function(_0xba7b11,_0x457718){return db['VoiceAgentReport'][_0xf40d('0x46')](_0xba7b11[_0xf40d('0x47')],{})[_0xf40d('0x21')](respondWithResult(_0x457718,0xc9))[_0xf40d('0x42')](handleError(_0x457718,null));};exports['update']=function(_0x2121e9,_0x25a7f3){if(_0x2121e9[_0xf40d('0x47')]['id']){delete _0x2121e9['body']['id'];}return db['VoiceAgentReport'][_0xf40d('0x45')]({'where':{'id':_0x2121e9[_0xf40d('0x44')]['id']}})[_0xf40d('0x21')](handleEntityNotFound(_0x25a7f3,null))[_0xf40d('0x21')](saveUpdates(_0x2121e9[_0xf40d('0x47')],null))[_0xf40d('0x21')](respondWithResult(_0x25a7f3,null))[_0xf40d('0x42')](handleError(_0x25a7f3,null));};exports[_0xf40d('0x22')]=function(_0x31f4d5,_0x5f4edf){return db[_0xf40d('0x3f')][_0xf40d('0x45')]({'where':{'id':_0x31f4d5[_0xf40d('0x44')]['id']}})[_0xf40d('0x21')](handleEntityNotFound(_0x5f4edf,null))['then'](removeEntity(_0x5f4edf,null))[_0xf40d('0x42')](handleError(_0x5f4edf,null));};exports[_0xf40d('0x48')]=function(_0x2a0c25,_0x26a6a3){return db[_0xf40d('0x3f')][_0xf40d('0x48')]()['then'](respondWithResult(_0x26a6a3,null))['catch'](handleError(_0x26a6a3,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 424e36b..95f06d6 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 _0x3451=['VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x2c5125,_0x4d269a){var _0x2ab0a6=function(_0x5d7132){while(--_0x5d7132){_0x2c5125['push'](_0x2c5125['shift']());}};_0x2ab0a6(++_0x4d269a);}(_0x3451,0x1a8));var _0x1345=function(_0x2fabee,_0x488f98){_0x2fabee=_0x2fabee-0x0;var _0x3452c2=_0x3451[_0x2fabee];return _0x3452c2;};'use strict';var _=require(_0x1345('0x0'));var util=require(_0x1345('0x1'));var logger=require(_0x1345('0x2'))(_0x1345('0x3'));var moment=require(_0x1345('0x4'));var BPromise=require(_0x1345('0x5'));var rp=require(_0x1345('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1345('0x7'));var config=require(_0x1345('0x8'));var attributes=require('./voiceAgentReport.attributes');module[_0x1345('0x9')]=function(_0x5e9095,_0x5bd430){return _0x5e9095['define'](_0x1345('0xa'),attributes,{'tableName':_0x1345('0xb'),'paranoid':![],'indexes':[{'fields':[_0x1345('0xc'),_0x1345('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x60a8=['api','bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util'];(function(_0x1ebeea,_0x2f54f4){var _0x576465=function(_0x47fc77){while(--_0x47fc77){_0x1ebeea['push'](_0x1ebeea['shift']());}};_0x576465(++_0x2f54f4);}(_0x60a8,0x108));var _0x860a=function(_0xd83b9b,_0x127a7e){_0xd83b9b=_0xd83b9b-0x0;var _0x5610e8=_0x60a8[_0xd83b9b];return _0x5610e8;};'use strict';var _=require(_0x860a('0x0'));var util=require(_0x860a('0x1'));var logger=require('../../config/logger')(_0x860a('0x2'));var moment=require('moment');var BPromise=require(_0x860a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x860a('0x4'));var rimraf=require(_0x860a('0x5'));var config=require(_0x860a('0x6'));var attributes=require(_0x860a('0x7'));module[_0x860a('0x8')]=function(_0x446bd0,_0x499907){return _0x446bd0[_0x860a('0x9')](_0x860a('0xa'),attributes,{'tableName':_0x860a('0xb'),'paranoid':![],'indexes':[{'fields':[_0x860a('0xc'),_0x860a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 520645f..80b3a68 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 _0x6b28=['attributes','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','CreateVoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','VoiceAgentReport'];(function(_0x324791,_0x409770){var _0x42fd9b=function(_0x37b295){while(--_0x37b295){_0x324791['push'](_0x324791['shift']());}};_0x42fd9b(++_0x409770);}(_0x6b28,0x14b));var _0x86b2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b28[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x86b2('0x0'));var moment=require(_0x86b2('0x1'));var BPromise=require(_0x86b2('0x2'));var rs=require(_0x86b2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86b2('0x4'))['db'];var utils=require(_0x86b2('0x5'));var logger=require(_0x86b2('0x6'))(_0x86b2('0x7'));var config=require(_0x86b2('0x8'));var jayson=require(_0x86b2('0x9'));var client=jayson[_0x86b2('0xa')][_0x86b2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c6448,_0x493e2a,_0x382959){return new BPromise(function(_0x4efc8c,_0x3b84ca){return client[_0x86b2('0xc')](_0x5c6448,_0x382959)[_0x86b2('0xd')](function(_0x652d0a){logger[_0x86b2('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x493e2a,_0x86b2('0xf'));logger[_0x86b2('0x10')](_0x86b2('0x11'),_0x493e2a,_0x86b2('0xf'),JSON[_0x86b2('0x12')](_0x652d0a));if(_0x652d0a['error']){if(_0x652d0a[_0x86b2('0x13')][_0x86b2('0x14')]===0x1f4){logger[_0x86b2('0x13')](_0x86b2('0x15'),_0x493e2a,_0x652d0a[_0x86b2('0x13')][_0x86b2('0x16')]);return _0x3b84ca(_0x652d0a[_0x86b2('0x13')]['message']);}logger['error'](_0x86b2('0x15'),_0x493e2a,_0x652d0a[_0x86b2('0x13')]['message']);return _0x4efc8c(_0x652d0a[_0x86b2('0x13')][_0x86b2('0x16')]);}else{logger[_0x86b2('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x493e2a,_0x86b2('0xf'));_0x4efc8c(_0x652d0a[_0x86b2('0x17')]['message']);}})[_0x86b2('0x18')](function(_0xda4d6d){logger[_0x86b2('0x13')](_0x86b2('0x15'),_0x493e2a,_0xda4d6d);_0x3b84ca(_0xda4d6d);});});}exports[_0x86b2('0x19')]=function(_0x134dc7){var _0x54b346=this;return new Promise(function(_0x18db70,_0x2d8f73){return db['VoiceAgentReport'][_0x86b2('0x1a')](_0x134dc7[_0x86b2('0x1b')],{'raw':_0x134dc7['options']?_0x134dc7[_0x86b2('0x1c')][_0x86b2('0x1d')]===undefined?!![]:![]:!![]})[_0x86b2('0xd')](function(_0x5d46be){logger[_0x86b2('0xe')](_0x86b2('0x19'),_0x134dc7);logger['debug'](_0x86b2('0x19'),_0x134dc7,JSON[_0x86b2('0x12')](_0x5d46be));_0x18db70(_0x5d46be);})[_0x86b2('0x18')](function(_0x35dd47){logger['error'](_0x86b2('0x19'),_0x35dd47[_0x86b2('0x16')],_0x134dc7);_0x2d8f73(_0x54b346[_0x86b2('0x13')](0x1f4,_0x35dd47[_0x86b2('0x16')]));});});};exports[_0x86b2('0x1e')]=function(_0x509649){var _0x5d2028=this;return new Promise(function(_0x5e7822,_0x2207db){return db[_0x86b2('0x1f')]['update'](_0x509649['body'],{'raw':_0x509649[_0x86b2('0x1c')]?_0x509649['options'][_0x86b2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x509649[_0x86b2('0x1c')]?_0x509649['options']['where']||null:null,'attributes':_0x509649['options']?_0x509649['options'][_0x86b2('0x20')]||null:null,'limit':_0x509649[_0x86b2('0x1c')]?_0x509649['options']['limit']||null:null})[_0x86b2('0xd')](function(_0x21396a){logger[_0x86b2('0xe')]('UpdateVoiceAgentReport',_0x509649);logger[_0x86b2('0x10')](_0x86b2('0x1e'),_0x509649,JSON[_0x86b2('0x12')](_0x21396a));_0x5e7822(_0x21396a);})[_0x86b2('0x18')](function(_0x753d5b){logger[_0x86b2('0x13')](_0x86b2('0x1e'),_0x753d5b[_0x86b2('0x16')],_0x509649);_0x2207db(_0x5d2028[_0x86b2('0x13')](0x1f4,_0x753d5b[_0x86b2('0x16')]));});});}; \ No newline at end of file +var _0x4e68=['debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','update','where','attributes','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2f9180,_0x2b57d1){var _0x260448=function(_0x49da51){while(--_0x49da51){_0x2f9180['push'](_0x2f9180['shift']());}};_0x260448(++_0x2b57d1);}(_0x4e68,0x6c));var _0x84e6=function(_0x457752,_0x1ee3d1){_0x457752=_0x457752-0x0;var _0x4e6e46=_0x4e68[_0x457752];return _0x4e6e46;};'use strict';var _=require(_0x84e6('0x0'));var util=require('util');var moment=require(_0x84e6('0x1'));var BPromise=require(_0x84e6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x84e6('0x3'));var db=require(_0x84e6('0x4'))['db'];var utils=require(_0x84e6('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x84e6('0x6'));var client=jayson[_0x84e6('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a13a1,_0x3ba57a,_0x2f4f80){return new BPromise(function(_0x579b66,_0x4a7cd4){return client[_0x84e6('0x8')](_0x4a13a1,_0x2f4f80)[_0x84e6('0x9')](function(_0x1c0543){logger['info'](_0x84e6('0xa'),_0x3ba57a,_0x84e6('0xb'));logger[_0x84e6('0xc')](_0x84e6('0xd'),_0x3ba57a,_0x84e6('0xb'),JSON[_0x84e6('0xe')](_0x1c0543));if(_0x1c0543[_0x84e6('0xf')]){if(_0x1c0543['error'][_0x84e6('0x10')]===0x1f4){logger[_0x84e6('0xf')](_0x84e6('0xa'),_0x3ba57a,_0x1c0543[_0x84e6('0xf')][_0x84e6('0x11')]);return _0x4a7cd4(_0x1c0543[_0x84e6('0xf')][_0x84e6('0x11')]);}logger['error'](_0x84e6('0xa'),_0x3ba57a,_0x1c0543[_0x84e6('0xf')][_0x84e6('0x11')]);return _0x579b66(_0x1c0543[_0x84e6('0xf')][_0x84e6('0x11')]);}else{logger[_0x84e6('0x12')](_0x84e6('0xa'),_0x3ba57a,_0x84e6('0xb'));_0x579b66(_0x1c0543['result'][_0x84e6('0x11')]);}})[_0x84e6('0x13')](function(_0x3c745d){logger[_0x84e6('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x3ba57a,_0x3c745d);_0x4a7cd4(_0x3c745d);});});}exports[_0x84e6('0x14')]=function(_0x188658){var _0x5477ed=this;return new Promise(function(_0x162025,_0x428cb4){return db[_0x84e6('0x15')][_0x84e6('0x16')](_0x188658[_0x84e6('0x17')],{'raw':_0x188658[_0x84e6('0x18')]?_0x188658['options'][_0x84e6('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x4423a8){logger[_0x84e6('0x12')](_0x84e6('0x14'),_0x188658);logger[_0x84e6('0xc')](_0x84e6('0x14'),_0x188658,JSON['stringify'](_0x4423a8));_0x162025(_0x4423a8);})[_0x84e6('0x13')](function(_0x2d58f1){logger[_0x84e6('0xf')](_0x84e6('0x14'),_0x2d58f1[_0x84e6('0x11')],_0x188658);_0x428cb4(_0x5477ed[_0x84e6('0xf')](0x1f4,_0x2d58f1[_0x84e6('0x11')]));});});};exports[_0x84e6('0x1a')]=function(_0x172b01){var _0x65e3bb=this;return new Promise(function(_0x21ce89,_0x58f6d5){return db['VoiceAgentReport'][_0x84e6('0x1b')](_0x172b01[_0x84e6('0x17')],{'raw':_0x172b01[_0x84e6('0x18')]?_0x172b01[_0x84e6('0x18')][_0x84e6('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x172b01[_0x84e6('0x18')]?_0x172b01[_0x84e6('0x18')][_0x84e6('0x1c')]||null:null,'attributes':_0x172b01[_0x84e6('0x18')]?_0x172b01[_0x84e6('0x18')][_0x84e6('0x1d')]||null:null,'limit':_0x172b01[_0x84e6('0x18')]?_0x172b01['options']['limit']||null:null})[_0x84e6('0x9')](function(_0x3f93d4){logger['info'](_0x84e6('0x1a'),_0x172b01);logger['debug']('UpdateVoiceAgentReport',_0x172b01,JSON[_0x84e6('0xe')](_0x3f93d4));_0x21ce89(_0x3f93d4);})[_0x84e6('0x13')](function(_0x3b1529){logger[_0x84e6('0xf')]('UpdateVoiceAgentReport',_0x3b1529[_0x84e6('0x11')],_0x172b01);_0x58f6d5(_0x65e3bb[_0x84e6('0xf')](0x1f4,_0x3b1529['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 976159a..0669ff5 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe','show','post'];(function(_0x4db46b,_0xadcb1a){var _0x565be8=function(_0x5d2e50){while(--_0x5d2e50){_0x4db46b['push'](_0x4db46b['shift']());}};_0x565be8(++_0xadcb1a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe','show','post'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 39ae577..aaeffac 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 _0x4fb4=['exports','STRING','ENUM','inbound','internal','outbound','outbound-fax','dialer','DATE','INTEGER'];(function(_0x16d5d7,_0x17d723){var _0x529846=function(_0x5a2f08){while(--_0x5a2f08){_0x16d5d7['push'](_0x16d5d7['shift']());}};_0x529846(++_0x17d723);}(_0x4fb4,0x190));var _0x44fb=function(_0x2a7989,_0x25556d){_0x2a7989=_0x2a7989-0x0;var _0x1885e7=_0x4fb4[_0x2a7989];return _0x1885e7;};'use strict';var Sequelize=require('sequelize');module[_0x44fb('0x0')]={'uniqueid':{'type':Sequelize[_0x44fb('0x1')]},'type':{'type':Sequelize[_0x44fb('0x2')](_0x44fb('0x3'),_0x44fb('0x4'),_0x44fb('0x5'),'inbound-fax',_0x44fb('0x6'),_0x44fb('0x7'))},'tag':{'type':Sequelize[_0x44fb('0x1')]},'accountcode':{'type':Sequelize[_0x44fb('0x1')]},'source':{'type':Sequelize[_0x44fb('0x1')]},'destination':{'type':Sequelize[_0x44fb('0x1')]},'destinationcontext':{'type':Sequelize[_0x44fb('0x1')]},'callerid':{'type':Sequelize[_0x44fb('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x44fb('0x1')]},'lastapplication':{'type':Sequelize[_0x44fb('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x44fb('0x8')]},'systemanswertime':{'type':Sequelize[_0x44fb('0x8')]},'answertime':{'type':Sequelize[_0x44fb('0x8')]},'endtime':{'type':Sequelize[_0x44fb('0x8')]},'duration':{'type':Sequelize[_0x44fb('0x9')]},'billableseconds':{'type':Sequelize[_0x44fb('0x9')]},'mohtime':{'type':Sequelize[_0x44fb('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x44fb('0x1')]},'amaflags':{'type':Sequelize[_0x44fb('0x1')]},'userfield':{'type':Sequelize[_0x44fb('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x44fb('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x44fb('0x1')]},'note':{'type':Sequelize[_0x44fb('0x1')]},'prefix':{'type':Sequelize[_0x44fb('0x1')]},'routeid':{'type':Sequelize[_0x44fb('0x9')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xda19=['outbound','outbound-fax','dialer','DATE','INTEGER','exports','STRING','inbound'];(function(_0x147e56,_0x2efae8){var _0x40c49c=function(_0x380aaa){while(--_0x380aaa){_0x147e56['push'](_0x147e56['shift']());}};_0x40c49c(++_0x2efae8);}(_0xda19,0xd5));var _0x9da1=function(_0x30d5c4,_0x48f423){_0x30d5c4=_0x30d5c4-0x0;var _0x20e7bc=_0xda19[_0x30d5c4];return _0x20e7bc;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'uniqueid':{'type':Sequelize[_0x9da1('0x1')]},'type':{'type':Sequelize['ENUM'](_0x9da1('0x2'),'internal',_0x9da1('0x3'),'inbound-fax',_0x9da1('0x4'),_0x9da1('0x5'))},'tag':{'type':Sequelize[_0x9da1('0x1')]},'accountcode':{'type':Sequelize[_0x9da1('0x1')]},'source':{'type':Sequelize[_0x9da1('0x1')]},'destination':{'type':Sequelize[_0x9da1('0x1')]},'destinationcontext':{'type':Sequelize[_0x9da1('0x1')]},'callerid':{'type':Sequelize[_0x9da1('0x1')]},'channel':{'type':Sequelize[_0x9da1('0x1')]},'destinationchannel':{'type':Sequelize[_0x9da1('0x1')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x9da1('0x6')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x9da1('0x6')]},'duration':{'type':Sequelize[_0x9da1('0x7')]},'billableseconds':{'type':Sequelize[_0x9da1('0x7')]},'mohtime':{'type':Sequelize[_0x9da1('0x7')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x9da1('0x1')]},'amaflags':{'type':Sequelize[_0x9da1('0x1')]},'userfield':{'type':Sequelize[_0x9da1('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x9da1('0x1')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x9da1('0x1')]},'routeid':{'type':Sequelize[_0x9da1('0x7')]},'sipcallid':{'type':Sequelize[_0x9da1('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 39e44ea..654af27 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 _0xc634=['then','destroy','sendStatus','error','stack','name','send','map','VoiceCallReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','User','catch','show','params','includeAll','find','body','describe','uniqueid','user','html-pdf','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','Content-Range','reject','save','update'];(function(_0x2a75cd,_0x247962){var _0x2319bc=function(_0x47d0c5){while(--_0x47d0c5){_0x2a75cd['push'](_0x2a75cd['shift']());}};_0x2319bc(++_0x247962);}(_0xc634,0xff));var _0x4c63=function(_0x49d940,_0x516f31){_0x49d940=_0x49d940-0x0;var _0x3201be=_0xc634[_0x49d940];return _0x3201be;};'use strict';var pdf=require(_0x4c63('0x0'));var emlformat=require(_0x4c63('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4c63('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4c63('0x3'));var Mustache=require(_0x4c63('0x4'));var util=require(_0x4c63('0x5'));var path=require(_0x4c63('0x6'));var sox=require(_0x4c63('0x7'));var csv=require(_0x4c63('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4c63('0x9'));var squel=require(_0x4c63('0xa'));var crypto=require('crypto');var jsforce=require(_0x4c63('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4c63('0x8'));var querystring=require(_0x4c63('0xc'));var Papa=require('papaparse');var Redis=require(_0x4c63('0xd'));var authService=require(_0x4c63('0xe'));var qs=require(_0x4c63('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4c63('0x10'));var logger=require(_0x4c63('0x11'))(_0x4c63('0x12'));var utils=require(_0x4c63('0x13'));var config=require(_0x4c63('0x14'));var licenseUtil=require(_0x4c63('0x15'));var db=require(_0x4c63('0x16'))['db'];function respondWithStatusCode(_0x439eac,_0x28f850){_0x28f850=_0x28f850||0xcc;return function(_0xb361ac){if(_0xb361ac){return _0x439eac['sendStatus'](_0x28f850);}return _0x439eac[_0x4c63('0x17')](_0x28f850)[_0x4c63('0x18')]();};}function respondWithResult(_0x24b2b2,_0x25db59){_0x25db59=_0x25db59||0xc8;return function(_0x2763f8){if(_0x2763f8){return _0x24b2b2['status'](_0x25db59)[_0x4c63('0x19')](_0x2763f8);}};}function respondWithFilteredResult(_0x4085fc,_0x4a0f12){return function(_0x34e0ff){if(_0x34e0ff){var _0x532be7=_0x34e0ff[_0x4c63('0x1a')],_0x1d2dc2=_0x4a0f12[_0x4c63('0x1b')],_0x116e15=_0x4a0f12[_0x4c63('0x1b')]+_0x4a0f12[_0x4c63('0x1c')],_0x10ffaa;if(_0x116e15>=_0x532be7){_0x116e15=_0x532be7;_0x10ffaa=0xc8;}else{_0x10ffaa=0xce;}_0x4085fc[_0x4c63('0x17')](_0x10ffaa);return _0x4085fc['set'](_0x4c63('0x1d'),_0x1d2dc2+'-'+_0x116e15+'/'+_0x532be7)[_0x4c63('0x19')](_0x34e0ff);}return null;};}function patchUpdates(_0x1d20ff){return function(_0x24e4b8){try{jsonpatch['apply'](_0x24e4b8,_0x1d20ff,!![]);}catch(_0x562326){return BPromise[_0x4c63('0x1e')](_0x562326);}return _0x24e4b8[_0x4c63('0x1f')]();};}function saveUpdates(_0x5ad2fe,_0x4d2d0f){return function(_0x36e046){if(_0x36e046){return _0x36e046[_0x4c63('0x20')](_0x5ad2fe)[_0x4c63('0x21')](function(_0x4aaae0){return _0x4aaae0;});}return null;};}function removeEntity(_0x263cd7,_0x1d2f06){return function(_0x233b67){if(_0x233b67){return _0x233b67[_0x4c63('0x22')]()[_0x4c63('0x21')](function(){_0x263cd7[_0x4c63('0x17')](0xcc)[_0x4c63('0x18')]();});}};}function handleEntityNotFound(_0x309e20,_0x4335d5){return function(_0x455bc6){if(!_0x455bc6){_0x309e20[_0x4c63('0x23')](0x194);}return _0x455bc6;};}function handleError(_0x3978c2,_0x129b05){_0x129b05=_0x129b05||0x1f4;return function(_0x2e0421){logger[_0x4c63('0x24')](_0x2e0421[_0x4c63('0x25')]);if(_0x2e0421[_0x4c63('0x26')]){delete _0x2e0421[_0x4c63('0x26')];}_0x3978c2[_0x4c63('0x17')](_0x129b05)[_0x4c63('0x27')](_0x2e0421);};}exports['index']=function(_0x309cd3,_0x4fb47c){var _0x4d6420={},_0x514bb2={},_0x3af7e4={'count':0x0,'rows':[]};var _0x326699=_[_0x4c63('0x28')](db[_0x4c63('0x29')][_0x4c63('0x2a')],function(_0x209ca7){return{'name':_0x209ca7[_0x4c63('0x2b')],'type':_0x209ca7[_0x4c63('0x2c')]['key']};});_0x514bb2[_0x4c63('0x2d')]=_[_0x4c63('0x28')](_0x326699,_0x4c63('0x26'));_0x514bb2['query']=_[_0x4c63('0x2e')](_0x309cd3[_0x4c63('0x2f')]);_0x514bb2[_0x4c63('0x30')]=_[_0x4c63('0x31')](_0x514bb2[_0x4c63('0x2d')],_0x514bb2[_0x4c63('0x2f')]);_0x4d6420[_0x4c63('0x32')]=_[_0x4c63('0x31')](_0x514bb2[_0x4c63('0x2d')],qs[_0x4c63('0x33')](_0x309cd3['query'][_0x4c63('0x33')]));_0x4d6420[_0x4c63('0x32')]=_0x4d6420[_0x4c63('0x32')]['length']?_0x4d6420[_0x4c63('0x32')]:_0x514bb2[_0x4c63('0x2d')];if(!_0x309cd3[_0x4c63('0x2f')][_0x4c63('0x34')](_0x4c63('0x35'))){_0x4d6420[_0x4c63('0x1c')]=qs['limit'](_0x309cd3[_0x4c63('0x2f')][_0x4c63('0x1c')]);_0x4d6420[_0x4c63('0x1b')]=qs['offset'](_0x309cd3[_0x4c63('0x2f')][_0x4c63('0x1b')]);}_0x4d6420[_0x4c63('0x36')]=qs['sort'](_0x309cd3[_0x4c63('0x2f')][_0x4c63('0x37')]);_0x4d6420[_0x4c63('0x38')]=qs['filters'](_[_0x4c63('0x39')](_0x309cd3[_0x4c63('0x2f')],_0x514bb2[_0x4c63('0x30')]),_0x326699);if(_0x309cd3['query'][_0x4c63('0x3a')]){_0x4d6420[_0x4c63('0x38')]=_[_0x4c63('0x3b')](_0x4d6420['where'],{'$or':_[_0x4c63('0x28')](_0x326699,function(_0x104ed7){if(_0x104ed7[_0x4c63('0x2c')]!=='VIRTUAL'){var _0x5109dd={};_0x5109dd[_0x104ed7['name']]={'$like':'%'+_0x309cd3[_0x4c63('0x2f')][_0x4c63('0x3a')]+'%'};return _0x5109dd;}})});}_0x4d6420=_['merge']({},_0x4d6420,_0x309cd3[_0x4c63('0x3c')]);var _0xa49f1e={'where':_0x4d6420[_0x4c63('0x38')]};return db[_0x4c63('0x29')][_0x4c63('0x1a')](_0xa49f1e)[_0x4c63('0x21')](function(_0x26c9f6){_0x3af7e4[_0x4c63('0x1a')]=_0x26c9f6;if(_0x309cd3['query']['includeAll']){_0x4d6420[_0x4c63('0x3d')]=[{'attributes':['id',_0x4c63('0x26'),'fullname','alias'],'model':db[_0x4c63('0x3e')],'as':_0x4c63('0x3e')}];}return db['VoiceCallReport']['findAll'](_0x4d6420);})[_0x4c63('0x21')](function(_0x48ff19){_0x3af7e4['rows']=_0x48ff19;return _0x3af7e4;})[_0x4c63('0x21')](respondWithFilteredResult(_0x4fb47c,_0x4d6420))[_0x4c63('0x3f')](handleError(_0x4fb47c,null));};exports[_0x4c63('0x40')]=function(_0x34ed7c,_0x542f1b){var _0x86438b={'raw':!![],'where':{'id':_0x34ed7c[_0x4c63('0x41')]['id']}},_0xeae9fc={};_0xeae9fc[_0x4c63('0x2d')]=_[_0x4c63('0x2e')](db['VoiceCallReport'][_0x4c63('0x2a')]);_0xeae9fc[_0x4c63('0x2f')]=_[_0x4c63('0x2e')](_0x34ed7c['query']);_0xeae9fc[_0x4c63('0x30')]=_[_0x4c63('0x31')](_0xeae9fc[_0x4c63('0x2d')],_0xeae9fc[_0x4c63('0x2f')]);_0x86438b[_0x4c63('0x32')]=_['intersection'](_0xeae9fc[_0x4c63('0x2d')],qs['fields'](_0x34ed7c[_0x4c63('0x2f')][_0x4c63('0x33')]));_0x86438b[_0x4c63('0x32')]=_0x86438b[_0x4c63('0x32')]['length']?_0x86438b['attributes']:_0xeae9fc[_0x4c63('0x2d')];if(_0x34ed7c[_0x4c63('0x2f')][_0x4c63('0x42')]){_0x86438b[_0x4c63('0x3d')]=[{'all':!![]}];}_0x86438b=_['merge']({},_0x86438b,_0x34ed7c[_0x4c63('0x3c')]);return db['VoiceCallReport'][_0x4c63('0x43')](_0x86438b)[_0x4c63('0x21')](handleEntityNotFound(_0x542f1b,null))['then'](respondWithResult(_0x542f1b,null))[_0x4c63('0x3f')](handleError(_0x542f1b,null));};exports['create']=function(_0x3f53bc,_0x4e7eac){return db[_0x4c63('0x29')]['create'](_0x3f53bc[_0x4c63('0x44')],{})['then'](respondWithResult(_0x4e7eac,0xc9))[_0x4c63('0x3f')](handleError(_0x4e7eac,null));};exports[_0x4c63('0x22')]=function(_0x12356a,_0xd8927d){return db[_0x4c63('0x29')]['find']({'where':{'id':_0x12356a[_0x4c63('0x41')]['id']}})[_0x4c63('0x21')](handleEntityNotFound(_0xd8927d,null))[_0x4c63('0x21')](removeEntity(_0xd8927d,null))[_0x4c63('0x3f')](handleError(_0xd8927d,null));};exports[_0x4c63('0x45')]=function(_0xc457d,_0x5b4317){return db[_0x4c63('0x29')]['describe']()[_0x4c63('0x21')](respondWithResult(_0x5b4317,null))[_0x4c63('0x3f')](handleError(_0x5b4317,null));};exports[_0x4c63('0x20')]=function(_0x4799b7,_0x10de83){if(_0x4799b7[_0x4c63('0x44')][_0x4c63('0x46')]){delete _0x4799b7[_0x4c63('0x44')]['uniqueid'];}return db[_0x4c63('0x29')]['find']({'where':{'uniqueid':_0x4799b7[_0x4c63('0x41')]['id'],'UserId':{'$or':[null,_0x4799b7[_0x4c63('0x47')]['id']]}}})[_0x4c63('0x21')](handleEntityNotFound(_0x10de83,null))[_0x4c63('0x21')](saveUpdates(_0x4799b7[_0x4c63('0x44')],null))[_0x4c63('0x21')](respondWithResult(_0x10de83,null))['catch'](handleError(_0x10de83,null));}; \ No newline at end of file +var _0xa72f=['stack','name','send','index','VoiceCallReport','rawAttributes','type','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','fullname','User','rows','catch','show','params','create','body','describe','uniqueid','find','user','zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error'];(function(_0x3e5295,_0x2347f6){var _0x2f90da=function(_0x48cbd3){while(--_0x48cbd3){_0x3e5295['push'](_0x3e5295['shift']());}};_0x2f90da(++_0x2347f6);}(_0xa72f,0x100));var _0xfa72=function(_0x24c135,_0xdb4450){_0x24c135=_0x24c135-0x0;var _0x290c66=_0xa72f[_0x24c135];return _0x290c66;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfa72('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfa72('0x1'));var moment=require('moment');var BPromise=require(_0xfa72('0x2'));var Mustache=require('mustache');var util=require(_0xfa72('0x3'));var path=require(_0xfa72('0x4'));var sox=require(_0xfa72('0x5'));var csv=require(_0xfa72('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa72('0x7'));var _=require(_0xfa72('0x8'));var squel=require(_0xfa72('0x9'));var crypto=require('crypto');var jsforce=require(_0xfa72('0xa'));var deskjs=require(_0xfa72('0xb'));var toCsv=require(_0xfa72('0x6'));var querystring=require(_0xfa72('0xc'));var Papa=require('papaparse');var Redis=require(_0xfa72('0xd'));var authService=require(_0xfa72('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfa72('0xf'));var hardwareService=require(_0xfa72('0x10'));var logger=require(_0xfa72('0x11'))(_0xfa72('0x12'));var utils=require('../../config/utils');var config=require(_0xfa72('0x13'));var licenseUtil=require(_0xfa72('0x14'));var db=require(_0xfa72('0x15'))['db'];function respondWithStatusCode(_0x11e98f,_0x4c2232){_0x4c2232=_0x4c2232||0xcc;return function(_0x20ac08){if(_0x20ac08){return _0x11e98f[_0xfa72('0x16')](_0x4c2232);}return _0x11e98f[_0xfa72('0x17')](_0x4c2232)[_0xfa72('0x18')]();};}function respondWithResult(_0x4e8fff,_0x522a73){_0x522a73=_0x522a73||0xc8;return function(_0x3681cc){if(_0x3681cc){return _0x4e8fff[_0xfa72('0x17')](_0x522a73)['json'](_0x3681cc);}};}function respondWithFilteredResult(_0x48016c,_0x2b68ee){return function(_0x2d9606){if(_0x2d9606){var _0x4c5d96=_0x2d9606[_0xfa72('0x19')],_0x38e509=_0x2b68ee[_0xfa72('0x1a')],_0x327da7=_0x2b68ee['offset']+_0x2b68ee[_0xfa72('0x1b')],_0x47f622;if(_0x327da7>=_0x4c5d96){_0x327da7=_0x4c5d96;_0x47f622=0xc8;}else{_0x47f622=0xce;}_0x48016c[_0xfa72('0x17')](_0x47f622);return _0x48016c[_0xfa72('0x1c')](_0xfa72('0x1d'),_0x38e509+'-'+_0x327da7+'/'+_0x4c5d96)['json'](_0x2d9606);}return null;};}function patchUpdates(_0x1a06e7){return function(_0x58e4cd){try{jsonpatch[_0xfa72('0x1e')](_0x58e4cd,_0x1a06e7,!![]);}catch(_0x430a88){return BPromise[_0xfa72('0x1f')](_0x430a88);}return _0x58e4cd['save']();};}function saveUpdates(_0x248c61,_0x29b7c0){return function(_0x29a41a){if(_0x29a41a){return _0x29a41a[_0xfa72('0x20')](_0x248c61)['then'](function(_0x69516c){return _0x69516c;});}return null;};}function removeEntity(_0x1ea4e7,_0x29b3fc){return function(_0x5adff7){if(_0x5adff7){return _0x5adff7[_0xfa72('0x21')]()[_0xfa72('0x22')](function(){_0x1ea4e7[_0xfa72('0x17')](0xcc)[_0xfa72('0x18')]();});}};}function handleEntityNotFound(_0x40cc9d,_0x275908){return function(_0x1ba30d){if(!_0x1ba30d){_0x40cc9d[_0xfa72('0x16')](0x194);}return _0x1ba30d;};}function handleError(_0xded18c,_0x111377){_0x111377=_0x111377||0x1f4;return function(_0x3aa2ce){logger[_0xfa72('0x23')](_0x3aa2ce[_0xfa72('0x24')]);if(_0x3aa2ce['name']){delete _0x3aa2ce[_0xfa72('0x25')];}_0xded18c[_0xfa72('0x17')](_0x111377)[_0xfa72('0x26')](_0x3aa2ce);};}exports[_0xfa72('0x27')]=function(_0x49885c,_0x38b44d){var _0x1d0374={},_0x547356={},_0x3836eb={'count':0x0,'rows':[]};var _0x433738=_['map'](db[_0xfa72('0x28')][_0xfa72('0x29')],function(_0x3702c8){return{'name':_0x3702c8['fieldName'],'type':_0x3702c8[_0xfa72('0x2a')]['key']};});_0x547356[_0xfa72('0x2b')]=_[_0xfa72('0x2c')](_0x433738,_0xfa72('0x25'));_0x547356[_0xfa72('0x2d')]=_[_0xfa72('0x2e')](_0x49885c['query']);_0x547356['filters']=_['intersection'](_0x547356['model'],_0x547356[_0xfa72('0x2d')]);_0x1d0374[_0xfa72('0x2f')]=_[_0xfa72('0x30')](_0x547356[_0xfa72('0x2b')],qs['fields'](_0x49885c[_0xfa72('0x2d')][_0xfa72('0x31')]));_0x1d0374[_0xfa72('0x2f')]=_0x1d0374['attributes'][_0xfa72('0x32')]?_0x1d0374[_0xfa72('0x2f')]:_0x547356[_0xfa72('0x2b')];if(!_0x49885c['query'][_0xfa72('0x33')]('nolimit')){_0x1d0374['limit']=qs[_0xfa72('0x1b')](_0x49885c[_0xfa72('0x2d')][_0xfa72('0x1b')]);_0x1d0374[_0xfa72('0x1a')]=qs[_0xfa72('0x1a')](_0x49885c[_0xfa72('0x2d')][_0xfa72('0x1a')]);}_0x1d0374[_0xfa72('0x34')]=qs[_0xfa72('0x35')](_0x49885c[_0xfa72('0x2d')][_0xfa72('0x35')]);_0x1d0374[_0xfa72('0x36')]=qs[_0xfa72('0x37')](_[_0xfa72('0x38')](_0x49885c['query'],_0x547356[_0xfa72('0x37')]),_0x433738);if(_0x49885c[_0xfa72('0x2d')][_0xfa72('0x39')]){_0x1d0374[_0xfa72('0x36')]=_[_0xfa72('0x3a')](_0x1d0374[_0xfa72('0x36')],{'$or':_['map'](_0x433738,function(_0xab798){if(_0xab798[_0xfa72('0x2a')]!==_0xfa72('0x3b')){var _0x1101fa={};_0x1101fa[_0xab798['name']]={'$like':'%'+_0x49885c['query'][_0xfa72('0x39')]+'%'};return _0x1101fa;}})});}_0x1d0374=_[_0xfa72('0x3a')]({},_0x1d0374,_0x49885c[_0xfa72('0x3c')]);var _0x4d7992={'where':_0x1d0374[_0xfa72('0x36')]};return db[_0xfa72('0x28')][_0xfa72('0x19')](_0x4d7992)[_0xfa72('0x22')](function(_0x308a12){_0x3836eb[_0xfa72('0x19')]=_0x308a12;if(_0x49885c[_0xfa72('0x2d')]['includeAll']){_0x1d0374['include']=[{'attributes':['id',_0xfa72('0x25'),_0xfa72('0x3d'),'alias'],'model':db[_0xfa72('0x3e')],'as':_0xfa72('0x3e')}];}return db[_0xfa72('0x28')]['findAll'](_0x1d0374);})[_0xfa72('0x22')](function(_0x78ebec){_0x3836eb[_0xfa72('0x3f')]=_0x78ebec;return _0x3836eb;})[_0xfa72('0x22')](respondWithFilteredResult(_0x38b44d,_0x1d0374))[_0xfa72('0x40')](handleError(_0x38b44d,null));};exports[_0xfa72('0x41')]=function(_0x3b28a7,_0x16998d){var _0x209ac8={'raw':!![],'where':{'id':_0x3b28a7[_0xfa72('0x42')]['id']}},_0x3620d4={};_0x3620d4[_0xfa72('0x2b')]=_[_0xfa72('0x2e')](db[_0xfa72('0x28')]['rawAttributes']);_0x3620d4[_0xfa72('0x2d')]=_[_0xfa72('0x2e')](_0x3b28a7[_0xfa72('0x2d')]);_0x3620d4[_0xfa72('0x37')]=_['intersection'](_0x3620d4[_0xfa72('0x2b')],_0x3620d4[_0xfa72('0x2d')]);_0x209ac8['attributes']=_[_0xfa72('0x30')](_0x3620d4[_0xfa72('0x2b')],qs[_0xfa72('0x31')](_0x3b28a7[_0xfa72('0x2d')]['fields']));_0x209ac8[_0xfa72('0x2f')]=_0x209ac8['attributes'][_0xfa72('0x32')]?_0x209ac8[_0xfa72('0x2f')]:_0x3620d4[_0xfa72('0x2b')];if(_0x3b28a7[_0xfa72('0x2d')]['includeAll']){_0x209ac8['include']=[{'all':!![]}];}_0x209ac8=_[_0xfa72('0x3a')]({},_0x209ac8,_0x3b28a7[_0xfa72('0x3c')]);return db[_0xfa72('0x28')]['find'](_0x209ac8)['then'](handleEntityNotFound(_0x16998d,null))['then'](respondWithResult(_0x16998d,null))[_0xfa72('0x40')](handleError(_0x16998d,null));};exports['create']=function(_0x5a2d9a,_0x298379){return db[_0xfa72('0x28')][_0xfa72('0x43')](_0x5a2d9a[_0xfa72('0x44')],{})[_0xfa72('0x22')](respondWithResult(_0x298379,0xc9))[_0xfa72('0x40')](handleError(_0x298379,null));};exports['destroy']=function(_0x16f3af,_0x3c2b51){return db[_0xfa72('0x28')]['find']({'where':{'id':_0x16f3af[_0xfa72('0x42')]['id']}})[_0xfa72('0x22')](handleEntityNotFound(_0x3c2b51,null))[_0xfa72('0x22')](removeEntity(_0x3c2b51,null))[_0xfa72('0x40')](handleError(_0x3c2b51,null));};exports[_0xfa72('0x45')]=function(_0x4f49f0,_0x8eeb84){return db['VoiceCallReport'][_0xfa72('0x45')]()[_0xfa72('0x22')](respondWithResult(_0x8eeb84,null))['catch'](handleError(_0x8eeb84,null));};exports[_0xfa72('0x20')]=function(_0x62e46e,_0x18027d){if(_0x62e46e[_0xfa72('0x44')][_0xfa72('0x46')]){delete _0x62e46e[_0xfa72('0x44')][_0xfa72('0x46')];}return db['VoiceCallReport'][_0xfa72('0x47')]({'where':{'uniqueid':_0x62e46e[_0xfa72('0x42')]['id'],'UserId':{'$or':[null,_0x62e46e[_0xfa72('0x48')]['id']]}}})[_0xfa72('0x22')](handleEntityNotFound(_0x18027d,null))[_0xfa72('0x22')](saveUpdates(_0x62e46e['body'],null))[_0xfa72('0x22')](respondWithResult(_0x18027d,null))[_0xfa72('0x40')](handleError(_0x18027d,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 410755d..a1e0776 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 _0x9f8a=['api','moment','request-promise','path','../../config/environment','exports','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger'];(function(_0x44e214,_0xe2298d){var _0x49753c=function(_0x366192){while(--_0x366192){_0x44e214['push'](_0x44e214['shift']());}};_0x49753c(++_0xe2298d);}(_0x9f8a,0x171));var _0xa9f8=function(_0x241c5d,_0x3ed23f){_0x241c5d=_0x241c5d-0x0;var _0x77650b=_0x9f8a[_0x241c5d];return _0x77650b;};'use strict';var _=require(_0xa9f8('0x0'));var util=require(_0xa9f8('0x1'));var logger=require(_0xa9f8('0x2'))(_0xa9f8('0x3'));var moment=require(_0xa9f8('0x4'));var BPromise=require('bluebird');var rp=require(_0xa9f8('0x5'));var fs=require('fs');var path=require(_0xa9f8('0x6'));var rimraf=require('rimraf');var config=require(_0xa9f8('0x7'));var attributes=require('./voiceCallReport.attributes');module[_0xa9f8('0x8')]=function(_0x4887b8,_0x2a0ce2){return _0x4887b8['define'](_0xa9f8('0x9'),attributes,{'tableName':_0xa9f8('0xa'),'paranoid':![],'indexes':[{'fields':[_0xa9f8('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xba89=['lodash','util','api','moment','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid'];(function(_0x58fea6,_0x185072){var _0x3c2b15=function(_0x1bcdd6){while(--_0x1bcdd6){_0x58fea6['push'](_0x58fea6['shift']());}};_0x3c2b15(++_0x185072);}(_0xba89,0x193));var _0x9ba8=function(_0x2718de,_0x3f3f35){_0x2718de=_0x2718de-0x0;var _0x5a27b3=_0xba89[_0x2718de];return _0x5a27b3;};'use strict';var _=require(_0x9ba8('0x0'));var util=require(_0x9ba8('0x1'));var logger=require('../../config/logger')(_0x9ba8('0x2'));var moment=require(_0x9ba8('0x3'));var BPromise=require('bluebird');var rp=require(_0x9ba8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ba8('0x5'));var config=require(_0x9ba8('0x6'));var attributes=require(_0x9ba8('0x7'));module[_0x9ba8('0x8')]=function(_0x97113f,_0x35950b){return _0x97113f[_0x9ba8('0x9')](_0x9ba8('0xa'),attributes,{'tableName':_0x9ba8('0xb'),'paranoid':![],'indexes':[{'fields':[_0x9ba8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 05f6986..6ac09cf 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 _0x9c95=['CreateVoiceCallReport','body','UpdateVoiceCallReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceCallReport'];(function(_0x770aae,_0x2fb4af){var _0x4b9b9f=function(_0x437234){while(--_0x437234){_0x770aae['push'](_0x770aae['shift']());}};_0x4b9b9f(++_0x2fb4af);}(_0x9c95,0x150));var _0x59c9=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x9c95[_0x368fb9];return _0x4892fb;};'use strict';var _=require(_0x59c9('0x0'));var util=require(_0x59c9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x59c9('0x2'));var fs=require('fs');var Redis=require(_0x59c9('0x3'));var db=require(_0x59c9('0x4'))['db'];var utils=require(_0x59c9('0x5'));var logger=require('../../config/logger')(_0x59c9('0x6'));var config=require(_0x59c9('0x7'));var jayson=require(_0x59c9('0x8'));var client=jayson[_0x59c9('0x9')][_0x59c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xdd920c,_0x34c634,_0x386c71){return new BPromise(function(_0x5cadee,_0x2038ab){return client[_0x59c9('0xb')](_0xdd920c,_0x386c71)[_0x59c9('0xc')](function(_0x4a1355){logger[_0x59c9('0xd')](_0x59c9('0xe'),_0x34c634,_0x59c9('0xf'));logger[_0x59c9('0x10')](_0x59c9('0x11'),_0x34c634,_0x59c9('0xf'),JSON[_0x59c9('0x12')](_0x4a1355));if(_0x4a1355[_0x59c9('0x13')]){if(_0x4a1355[_0x59c9('0x13')][_0x59c9('0x14')]===0x1f4){logger['error'](_0x59c9('0xe'),_0x34c634,_0x4a1355[_0x59c9('0x13')][_0x59c9('0x15')]);return _0x2038ab(_0x4a1355[_0x59c9('0x13')][_0x59c9('0x15')]);}logger[_0x59c9('0x13')](_0x59c9('0xe'),_0x34c634,_0x4a1355[_0x59c9('0x13')]['message']);return _0x5cadee(_0x4a1355[_0x59c9('0x13')][_0x59c9('0x15')]);}else{logger[_0x59c9('0xd')](_0x59c9('0xe'),_0x34c634,_0x59c9('0xf'));_0x5cadee(_0x4a1355['result'][_0x59c9('0x15')]);}})[_0x59c9('0x16')](function(_0x18ab87){logger[_0x59c9('0x13')](_0x59c9('0xe'),_0x34c634,_0x18ab87);_0x2038ab(_0x18ab87);});});}exports['GetVoiceCallReport']=function(_0x5e1890){var _0xe26773=this;return new Promise(function(_0x2eddb4,_0x4d4fa3){return db[_0x59c9('0x17')][_0x59c9('0x18')]({'raw':_0x5e1890[_0x59c9('0x19')]?_0x5e1890[_0x59c9('0x19')][_0x59c9('0x1a')]===undefined?!![]:![]:!![],'where':_0x5e1890['options']?_0x5e1890[_0x59c9('0x19')][_0x59c9('0x1b')]||null:null,'attributes':_0x5e1890[_0x59c9('0x19')]?_0x5e1890[_0x59c9('0x19')][_0x59c9('0x1c')]||null:null,'limit':_0x5e1890[_0x59c9('0x19')]?_0x5e1890['options'][_0x59c9('0x1d')]||null:null,'include':_0x5e1890[_0x59c9('0x19')]?_0x5e1890[_0x59c9('0x19')][_0x59c9('0x1e')]?_[_0x59c9('0x1f')](_0x5e1890[_0x59c9('0x19')][_0x59c9('0x1e')],function(_0xda8edf){return{'model':db[_0xda8edf[_0x59c9('0x20')]],'as':_0xda8edf['as'],'attributes':_0xda8edf[_0x59c9('0x1c')],'include':_0xda8edf[_0x59c9('0x1e')]?_['map'](_0xda8edf[_0x59c9('0x1e')],function(_0x290e0f){return{'model':db[_0x290e0f['model']],'as':_0x290e0f['as'],'attributes':_0x290e0f[_0x59c9('0x1c')],'include':_0x290e0f[_0x59c9('0x1e')]?_['map'](_0x290e0f['include'],function(_0x3a3cd8){return{'model':db[_0x3a3cd8[_0x59c9('0x20')]],'as':_0x3a3cd8['as'],'attributes':_0x3a3cd8[_0x59c9('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x25651a){logger[_0x59c9('0xd')](_0x59c9('0x21'),_0x5e1890);logger[_0x59c9('0x10')]('GetVoiceCallReport',_0x5e1890,JSON['stringify'](_0x25651a));_0x2eddb4(_0x25651a);})[_0x59c9('0x16')](function(_0x23bf26){logger['error']('GetVoiceCallReport',_0x23bf26[_0x59c9('0x15')],_0x5e1890);_0x4d4fa3(_0xe26773[_0x59c9('0x13')](0x1f4,_0x23bf26['message']));});});};exports[_0x59c9('0x22')]=function(_0x35a038){var _0x21fb2c=this;return new Promise(function(_0x2c72c9,_0x5ab519){return db[_0x59c9('0x17')]['create'](_0x35a038[_0x59c9('0x23')],{'raw':_0x35a038[_0x59c9('0x19')]?_0x35a038[_0x59c9('0x19')][_0x59c9('0x1a')]===undefined?!![]:![]:!![]})[_0x59c9('0xc')](function(_0x423feb){logger[_0x59c9('0xd')](_0x59c9('0x22'),_0x35a038);logger[_0x59c9('0x10')](_0x59c9('0x22'),_0x35a038,JSON[_0x59c9('0x12')](_0x423feb));_0x2c72c9(_0x423feb);})[_0x59c9('0x16')](function(_0x130fbb){logger[_0x59c9('0x13')](_0x59c9('0x22'),_0x130fbb['message'],_0x35a038);_0x5ab519(_0x21fb2c[_0x59c9('0x13')](0x1f4,_0x130fbb[_0x59c9('0x15')]));});});};exports[_0x59c9('0x24')]=function(_0x2ff65d){var _0x50487f=this;return new Promise(function(_0x542554,_0x2223f3){return db['VoiceCallReport']['update'](_0x2ff65d[_0x59c9('0x23')],{'raw':_0x2ff65d['options']?_0x2ff65d[_0x59c9('0x19')][_0x59c9('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ff65d[_0x59c9('0x19')]?_0x2ff65d[_0x59c9('0x19')][_0x59c9('0x1b')]||null:null,'attributes':_0x2ff65d[_0x59c9('0x19')]?_0x2ff65d[_0x59c9('0x19')]['attributes']||null:null,'limit':_0x2ff65d[_0x59c9('0x19')]?_0x2ff65d[_0x59c9('0x19')][_0x59c9('0x1d')]||null:null})['then'](function(_0xc23e3e){logger[_0x59c9('0xd')](_0x59c9('0x24'),_0x2ff65d);logger[_0x59c9('0x10')](_0x59c9('0x24'),_0x2ff65d,JSON[_0x59c9('0x12')](_0xc23e3e));_0x542554(_0xc23e3e);})['catch'](function(_0x546b47){logger[_0x59c9('0x13')](_0x59c9('0x24'),_0x546b47[_0x59c9('0x15')],_0x2ff65d);_0x2223f3(_0x50487f[_0x59c9('0x13')](0x1f4,_0x546b47[_0x59c9('0x15')]));});});}; \ No newline at end of file +var _0x680f=['VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VoiceCallReport,\x20%s,\x20%s','message','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','include','map','model','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','debug'];(function(_0x412e27,_0x20a978){var _0x53da42=function(_0x43cae5){while(--_0x43cae5){_0x412e27['push'](_0x412e27['shift']());}};_0x53da42(++_0x20a978);}(_0x680f,0x10b));var _0xf680=function(_0x4c278a,_0x48bbda){_0x4c278a=_0x4c278a-0x0;var _0x21d848=_0x680f[_0x4c278a];return _0x21d848;};'use strict';var _=require(_0xf680('0x0'));var util=require(_0xf680('0x1'));var moment=require(_0xf680('0x2'));var BPromise=require('bluebird');var rs=require(_0xf680('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf680('0x4'))['db'];var utils=require(_0xf680('0x5'));var logger=require(_0xf680('0x6'))(_0xf680('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf680('0x8')][_0xf680('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21923e,_0x58ce63,_0x5371e7){return new BPromise(function(_0x1b42c5,_0x418896){return client['request'](_0x21923e,_0x5371e7)[_0xf680('0xa')](function(_0x5f0050){logger[_0xf680('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x58ce63,'request\x20sent');logger[_0xf680('0xc')](_0xf680('0xd'),_0x58ce63,_0xf680('0xe'),JSON[_0xf680('0xf')](_0x5f0050));if(_0x5f0050['error']){if(_0x5f0050[_0xf680('0x10')]['code']===0x1f4){logger[_0xf680('0x10')](_0xf680('0x11'),_0x58ce63,_0x5f0050[_0xf680('0x10')][_0xf680('0x12')]);return _0x418896(_0x5f0050[_0xf680('0x10')][_0xf680('0x12')]);}logger[_0xf680('0x10')](_0xf680('0x11'),_0x58ce63,_0x5f0050[_0xf680('0x10')]['message']);return _0x1b42c5(_0x5f0050['error'][_0xf680('0x12')]);}else{logger[_0xf680('0xb')](_0xf680('0x11'),_0x58ce63,_0xf680('0xe'));_0x1b42c5(_0x5f0050['result'][_0xf680('0x12')]);}})[_0xf680('0x13')](function(_0x437e83){logger[_0xf680('0x10')](_0xf680('0x11'),_0x58ce63,_0x437e83);_0x418896(_0x437e83);});});}exports[_0xf680('0x14')]=function(_0xde177e){var _0x448128=this;return new Promise(function(_0xb03579,_0x4b3497){return db[_0xf680('0x15')]['findAll']({'raw':_0xde177e[_0xf680('0x16')]?_0xde177e[_0xf680('0x16')][_0xf680('0x17')]===undefined?!![]:![]:!![],'where':_0xde177e[_0xf680('0x16')]?_0xde177e[_0xf680('0x16')][_0xf680('0x18')]||null:null,'attributes':_0xde177e['options']?_0xde177e['options'][_0xf680('0x19')]||null:null,'limit':_0xde177e[_0xf680('0x16')]?_0xde177e[_0xf680('0x16')][_0xf680('0x1a')]||null:null,'include':_0xde177e[_0xf680('0x16')]?_0xde177e[_0xf680('0x16')][_0xf680('0x1b')]?_[_0xf680('0x1c')](_0xde177e[_0xf680('0x16')][_0xf680('0x1b')],function(_0x1b7120){return{'model':db[_0x1b7120[_0xf680('0x1d')]],'as':_0x1b7120['as'],'attributes':_0x1b7120[_0xf680('0x19')],'include':_0x1b7120[_0xf680('0x1b')]?_[_0xf680('0x1c')](_0x1b7120[_0xf680('0x1b')],function(_0x43184e){return{'model':db[_0x43184e['model']],'as':_0x43184e['as'],'attributes':_0x43184e[_0xf680('0x19')],'include':_0x43184e[_0xf680('0x1b')]?_[_0xf680('0x1c')](_0x43184e[_0xf680('0x1b')],function(_0x320c74){return{'model':db[_0x320c74['model']],'as':_0x320c74['as'],'attributes':_0x320c74[_0xf680('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf680('0xa')](function(_0x1280ec){logger['info']('GetVoiceCallReport',_0xde177e);logger[_0xf680('0xc')](_0xf680('0x14'),_0xde177e,JSON[_0xf680('0xf')](_0x1280ec));_0xb03579(_0x1280ec);})[_0xf680('0x13')](function(_0x12bbe2){logger[_0xf680('0x10')](_0xf680('0x14'),_0x12bbe2['message'],_0xde177e);_0x4b3497(_0x448128[_0xf680('0x10')](0x1f4,_0x12bbe2['message']));});});};exports['CreateVoiceCallReport']=function(_0x40cf2d){var _0x706456=this;return new Promise(function(_0x236717,_0x437556){return db['VoiceCallReport'][_0xf680('0x1e')](_0x40cf2d[_0xf680('0x1f')],{'raw':_0x40cf2d[_0xf680('0x16')]?_0x40cf2d['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x486ad2){logger['info'](_0xf680('0x20'),_0x40cf2d);logger[_0xf680('0xc')]('CreateVoiceCallReport',_0x40cf2d,JSON[_0xf680('0xf')](_0x486ad2));_0x236717(_0x486ad2);})[_0xf680('0x13')](function(_0x559f1a){logger[_0xf680('0x10')](_0xf680('0x20'),_0x559f1a['message'],_0x40cf2d);_0x437556(_0x706456[_0xf680('0x10')](0x1f4,_0x559f1a['message']));});});};exports[_0xf680('0x21')]=function(_0x2fcf86){var _0x121a75=this;return new Promise(function(_0x5ae5c7,_0x1f3f7c){return db[_0xf680('0x15')][_0xf680('0x22')](_0x2fcf86[_0xf680('0x1f')],{'raw':_0x2fcf86[_0xf680('0x16')]?_0x2fcf86['options'][_0xf680('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fcf86[_0xf680('0x16')]?_0x2fcf86[_0xf680('0x16')]['where']||null:null,'attributes':_0x2fcf86[_0xf680('0x16')]?_0x2fcf86[_0xf680('0x16')][_0xf680('0x19')]||null:null,'limit':_0x2fcf86[_0xf680('0x16')]?_0x2fcf86[_0xf680('0x16')][_0xf680('0x1a')]||null:null})[_0xf680('0xa')](function(_0x271619){logger[_0xf680('0xb')]('UpdateVoiceCallReport',_0x2fcf86);logger['debug']('UpdateVoiceCallReport',_0x2fcf86,JSON[_0xf680('0xf')](_0x271619));_0x5ae5c7(_0x271619);})['catch'](function(_0x5afdbc){logger[_0xf680('0x10')](_0xf680('0x21'),_0x5afdbc[_0xf680('0x12')],_0x2fcf86);_0x1f3f7c(_0x121a75[_0xf680('0x10')](0x1f4,_0x5afdbc[_0xf680('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 691fd55..6d5a122 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 _0x2061=['show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id'];(function(_0x3733a6,_0x3c9328){var _0x2b17ee=function(_0x5ca8b9){while(--_0x5ca8b9){_0x3733a6['push'](_0x3733a6['shift']());}};_0x2b17ee(++_0x3c9328);}(_0x2061,0x80));var _0x1206=function(_0x4432d1,_0x48415b){_0x4432d1=_0x4432d1-0x0;var _0x2b6bb0=_0x2061[_0x4432d1];return _0x2b6bb0;};'use strict';var multer=require(_0x1206('0x0'));var util=require(_0x1206('0x1'));var path=require('path');var timeout=require(_0x1206('0x2'));var express=require(_0x1206('0x3'));var router=express[_0x1206('0x4')]();var fs_extra=require(_0x1206('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1206('0x6'));var controller=require(_0x1206('0x7'));router[_0x1206('0x8')]('/',auth[_0x1206('0x9')](),controller[_0x1206('0xa')]);router['get'](_0x1206('0xb'),auth[_0x1206('0x9')](),controller[_0x1206('0xc')]);router[_0x1206('0xd')]('/',auth['isAuthenticated'](),controller[_0x1206('0xe')]);router[_0x1206('0xf')](_0x1206('0xb'),auth[_0x1206('0x9')](),controller[_0x1206('0x10')]);router[_0x1206('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x1206('0x12')]);module[_0x1206('0x13')]=router; \ No newline at end of file +var _0x120f=['exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id','show','put','update','delete','destroy'];(function(_0x5e8eae,_0x4f81e0){var _0xdd09cd=function(_0x28c85c){while(--_0x28c85c){_0x5e8eae['push'](_0x5e8eae['shift']());}};_0xdd09cd(++_0x4f81e0);}(_0x120f,0x161));var _0xf120=function(_0x4462d1,_0x2d89b1){_0x4462d1=_0x4462d1-0x0;var _0x3a100e=_0x120f[_0x4462d1];return _0x3a100e;};'use strict';var multer=require(_0xf120('0x0'));var util=require('util');var path=require(_0xf120('0x1'));var timeout=require(_0xf120('0x2'));var express=require(_0xf120('0x3'));var router=express['Router']();var fs_extra=require(_0xf120('0x4'));var auth=require(_0xf120('0x5'));var interaction=require(_0xf120('0x6'));var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router['get']('/',auth[_0xf120('0x7')](),controller[_0xf120('0x8')]);router['get'](_0xf120('0x9'),auth['isAuthenticated'](),controller[_0xf120('0xa')]);router['post']('/',auth[_0xf120('0x7')](),controller['create']);router[_0xf120('0xb')](_0xf120('0x9'),auth[_0xf120('0x7')](),controller[_0xf120('0xc')]);router[_0xf120('0xd')]('/:id',auth[_0xf120('0x7')](),controller[_0xf120('0xe')]);module[_0xf120('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 410be8f..dbed100 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 _0xee33=['setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize','STRING','name'];(function(_0x50bf5a,_0x807bba){var _0x4ddc1d=function(_0x349a61){while(--_0x349a61){_0x50bf5a['push'](_0x50bf5a['shift']());}};_0x4ddc1d(++_0x807bba);}(_0xee33,0xd5));var _0x3ee3=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xee33[_0x5b561d];return _0x431060;};'use strict';var Sequelize=require(_0x3ee3('0x0'));module['exports']={'name':{'type':Sequelize[_0x3ee3('0x1')]},'prefix':{'type':Sequelize[_0x3ee3('0x1')],'unique':_0x3ee3('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x3ee3('0x1')],'set':function(_0x34cc9b){this[_0x3ee3('0x3')](_0x3ee3('0x4'),_0x34cc9b?_0x34cc9b[_0x3ee3('0x5')](''):[]);},'get':function(){return this[_0x3ee3('0x6')]('options')?this[_0x3ee3('0x6')](_0x3ee3('0x4'))[_0x3ee3('0x7')](''):[];}},'auth':{'type':Sequelize[_0x3ee3('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x3ee3('0x1')]},'record':{'type':Sequelize[_0x3ee3('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x3ee3('0x1')]},'description':{'type':Sequelize[_0x3ee3('0x1')]}}; \ No newline at end of file +var _0x533a=['sequelize','exports','STRING','name','setDataValue','options','getDataValue','BOOLEAN'];(function(_0xd3bdab,_0x5d784a){var _0x1c3178=function(_0x4f7ef4){while(--_0x4f7ef4){_0xd3bdab['push'](_0xd3bdab['shift']());}};_0x1c3178(++_0x5d784a);}(_0x533a,0xd0));var _0xa533=function(_0x3124f8,_0x1a8b23){_0x3124f8=_0x3124f8-0x0;var _0x5bab5f=_0x533a[_0x3124f8];return _0x5bab5f;};'use strict';var Sequelize=require(_0xa533('0x0'));module[_0xa533('0x1')]={'name':{'type':Sequelize[_0xa533('0x2')]},'prefix':{'type':Sequelize[_0xa533('0x2')],'unique':_0xa533('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x37aa19){this[_0xa533('0x4')](_0xa533('0x5'),_0x37aa19?_0x37aa19['join'](''):[]);},'get':function(){return this[_0xa533('0x6')](_0xa533('0x5'))?this[_0xa533('0x6')](_0xa533('0x5'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xa533('0x2')]},'record':{'type':Sequelize[_0xa533('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xa533('0x2')]},'description':{'type':Sequelize[_0xa533('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index ccefffd..1585a3b 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 _0x27c7=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','update','destroy','then','get','ChanSpies','UserProfileResource','end','error','name','send','index','map','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','VoiceChanSpy','includeAll','include','findAll','rows','catch','show','params','create','body'];(function(_0x55fb65,_0x1c0931){var _0x41e7c1=function(_0x329dc2){while(--_0x329dc2){_0x55fb65['push'](_0x55fb65['shift']());}};_0x41e7c1(++_0x1c0931);}(_0x27c7,0x10d));var _0x727c=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x27c7[_0x618414];return _0x21c19a;};'use strict';var pdf=require(_0x727c('0x0'));var emlformat=require(_0x727c('0x1'));var rimraf=require(_0x727c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x727c('0x3'));var rp=require(_0x727c('0x4'));var moment=require(_0x727c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x727c('0x6'));var util=require(_0x727c('0x7'));var path=require(_0x727c('0x8'));var sox=require(_0x727c('0x9'));var csv=require('to-csv');var ejs=require(_0x727c('0xa'));var fs=require('fs');var fs_extra=require(_0x727c('0xb'));var _=require(_0x727c('0xc'));var squel=require(_0x727c('0xd'));var crypto=require('crypto');var jsforce=require(_0x727c('0xe'));var deskjs=require(_0x727c('0xf'));var toCsv=require(_0x727c('0x10'));var querystring=require('querystring');var Papa=require(_0x727c('0x11'));var Redis=require('ioredis');var authService=require(_0x727c('0x12'));var qs=require(_0x727c('0x13'));var as=require(_0x727c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x727c('0x15'))(_0x727c('0x16'));var utils=require(_0x727c('0x17'));var config=require(_0x727c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x727c('0x19'))['db'];function respondWithStatusCode(_0x12c5d9,_0x4eb1cd){_0x4eb1cd=_0x4eb1cd||0xcc;return function(_0x1ea810){if(_0x1ea810){return _0x12c5d9[_0x727c('0x1a')](_0x4eb1cd);}return _0x12c5d9[_0x727c('0x1b')](_0x4eb1cd)['end']();};}function respondWithResult(_0x411428,_0x196c0d){_0x196c0d=_0x196c0d||0xc8;return function(_0x3d2aae){if(_0x3d2aae){return _0x411428['status'](_0x196c0d)['json'](_0x3d2aae);}};}function respondWithFilteredResult(_0xa7dd67,_0x91a581){return function(_0x52e9f0){if(_0x52e9f0){var _0xf8729d=_0x52e9f0[_0x727c('0x1c')],_0x88d8a7=_0x91a581[_0x727c('0x1d')],_0x1633e8=_0x91a581['offset']+_0x91a581[_0x727c('0x1e')],_0x41d96a;if(_0x1633e8>=_0xf8729d){_0x1633e8=_0xf8729d;_0x41d96a=0xc8;}else{_0x41d96a=0xce;}_0xa7dd67[_0x727c('0x1b')](_0x41d96a);return _0xa7dd67[_0x727c('0x1f')](_0x727c('0x20'),_0x88d8a7+'-'+_0x1633e8+'/'+_0xf8729d)[_0x727c('0x21')](_0x52e9f0);}return null;};}function patchUpdates(_0x583b31){return function(_0x2b7b11){try{jsonpatch['apply'](_0x2b7b11,_0x583b31,!![]);}catch(_0x337037){return BPromise[_0x727c('0x22')](_0x337037);}return _0x2b7b11[_0x727c('0x23')]();};}function saveUpdates(_0x403aa2,_0x5db771){return function(_0x36d19c){if(_0x36d19c){return _0x36d19c[_0x727c('0x24')](_0x403aa2)['then'](function(_0x2937bc){return _0x2937bc;});}return null;};}function removeEntity(_0x54dcd4,_0x371d1f){return function(_0x14132e){if(_0x14132e){return _0x14132e[_0x727c('0x25')]()[_0x727c('0x26')](function(){var _0x3c6b66=_0x14132e[_0x727c('0x27')]({'plain':!![]});var _0x5a24db=_0x727c('0x28');return db[_0x727c('0x29')][_0x727c('0x25')]({'where':{'type':_0x5a24db,'resourceId':_0x3c6b66['id']}})[_0x727c('0x26')](function(){return _0x14132e;});})[_0x727c('0x26')](function(){_0x54dcd4[_0x727c('0x1b')](0xcc)[_0x727c('0x2a')]();});}};}function handleEntityNotFound(_0x1c78a6,_0x1ca28c){return function(_0x38a65d){if(!_0x38a65d){_0x1c78a6[_0x727c('0x1a')](0x194);}return _0x38a65d;};}function handleError(_0x2287b0,_0x488092){_0x488092=_0x488092||0x1f4;return function(_0x4da3e6){logger[_0x727c('0x2b')](_0x4da3e6['stack']);if(_0x4da3e6['name']){delete _0x4da3e6[_0x727c('0x2c')];}_0x2287b0['status'](_0x488092)[_0x727c('0x2d')](_0x4da3e6);};}exports[_0x727c('0x2e')]=function(_0x29f8db,_0x5d3f4b){var _0x483dfc={},_0x5ad577={},_0x1d2cf0={'count':0x0,'rows':[]};var _0x38f0a7=_[_0x727c('0x2f')](db['VoiceChanSpy'][_0x727c('0x30')],function(_0xc17b0c){return{'name':_0xc17b0c[_0x727c('0x31')],'type':_0xc17b0c[_0x727c('0x32')]['key']};});_0x5ad577['model']=_[_0x727c('0x2f')](_0x38f0a7,_0x727c('0x2c'));_0x5ad577['query']=_[_0x727c('0x33')](_0x29f8db[_0x727c('0x34')]);_0x5ad577[_0x727c('0x35')]=_[_0x727c('0x36')](_0x5ad577[_0x727c('0x37')],_0x5ad577[_0x727c('0x34')]);_0x483dfc[_0x727c('0x38')]=_[_0x727c('0x36')](_0x5ad577[_0x727c('0x37')],qs['fields'](_0x29f8db['query'][_0x727c('0x39')]));_0x483dfc[_0x727c('0x38')]=_0x483dfc[_0x727c('0x38')][_0x727c('0x3a')]?_0x483dfc['attributes']:_0x5ad577['model'];if(!_0x29f8db[_0x727c('0x34')][_0x727c('0x3b')](_0x727c('0x3c'))){_0x483dfc['limit']=qs[_0x727c('0x1e')](_0x29f8db[_0x727c('0x34')]['limit']);_0x483dfc[_0x727c('0x1d')]=qs[_0x727c('0x1d')](_0x29f8db[_0x727c('0x34')][_0x727c('0x1d')]);}_0x483dfc[_0x727c('0x3d')]=qs[_0x727c('0x3e')](_0x29f8db[_0x727c('0x34')]['sort']);_0x483dfc[_0x727c('0x3f')]=qs['filters'](_[_0x727c('0x40')](_0x29f8db[_0x727c('0x34')],_0x5ad577[_0x727c('0x35')]),_0x38f0a7);if(_0x29f8db['query']['filter']){_0x483dfc[_0x727c('0x3f')]=_[_0x727c('0x41')](_0x483dfc[_0x727c('0x3f')],{'$or':_['map'](_0x38f0a7,function(_0x5d4f55){if(_0x5d4f55[_0x727c('0x32')]!==_0x727c('0x42')){var _0x4a6739={};_0x4a6739[_0x5d4f55[_0x727c('0x2c')]]={'$like':'%'+_0x29f8db[_0x727c('0x34')][_0x727c('0x43')]+'%'};return _0x4a6739;}})});}_0x483dfc=_[_0x727c('0x41')]({},_0x483dfc,_0x29f8db[_0x727c('0x44')]);var _0x308881={'where':_0x483dfc['where']};return db[_0x727c('0x45')][_0x727c('0x1c')](_0x308881)['then'](function(_0x21d628){_0x1d2cf0['count']=_0x21d628;if(_0x29f8db['query'][_0x727c('0x46')]){_0x483dfc[_0x727c('0x47')]=[{'all':!![]}];}return db[_0x727c('0x45')][_0x727c('0x48')](_0x483dfc);})['then'](function(_0x4ff18c){_0x1d2cf0[_0x727c('0x49')]=_0x4ff18c;return _0x1d2cf0;})[_0x727c('0x26')](respondWithFilteredResult(_0x5d3f4b,_0x483dfc))[_0x727c('0x4a')](handleError(_0x5d3f4b,null));};exports[_0x727c('0x4b')]=function(_0x2e9c54,_0x2951f5){var _0x475180={'raw':![],'where':{'id':_0x2e9c54[_0x727c('0x4c')]['id']}},_0x1b86ac={};_0x1b86ac[_0x727c('0x37')]=_['keys'](db[_0x727c('0x45')]['rawAttributes']);_0x1b86ac[_0x727c('0x34')]=_[_0x727c('0x33')](_0x2e9c54[_0x727c('0x34')]);_0x1b86ac['filters']=_[_0x727c('0x36')](_0x1b86ac[_0x727c('0x37')],_0x1b86ac['query']);_0x475180['attributes']=_[_0x727c('0x36')](_0x1b86ac[_0x727c('0x37')],qs[_0x727c('0x39')](_0x2e9c54[_0x727c('0x34')][_0x727c('0x39')]));_0x475180[_0x727c('0x38')]=_0x475180[_0x727c('0x38')][_0x727c('0x3a')]?_0x475180['attributes']:_0x1b86ac['model'];if(_0x2e9c54[_0x727c('0x34')][_0x727c('0x46')]){_0x475180[_0x727c('0x47')]=[{'all':!![]}];}_0x475180=_[_0x727c('0x41')]({},_0x475180,_0x2e9c54[_0x727c('0x44')]);return db['VoiceChanSpy']['find'](_0x475180)[_0x727c('0x26')](handleEntityNotFound(_0x2951f5,null))[_0x727c('0x26')](respondWithResult(_0x2951f5,null))[_0x727c('0x4a')](handleError(_0x2951f5,null));};exports[_0x727c('0x4d')]=function(_0x40dec7,_0x139f4b){return db['VoiceChanSpy'][_0x727c('0x4d')](_0x40dec7[_0x727c('0x4e')],{})['then'](function(_0x494681){var _0x27c469=_0x40dec7['user'][_0x727c('0x27')]({'plain':!![]});if(!_0x27c469)throw new Error(_0x727c('0x4f'));if(_0x27c469[_0x727c('0x50')]===_0x727c('0x51')){var _0x5822a8=_0x494681[_0x727c('0x27')]({'plain':!![]});var _0x57d5bb=_0x727c('0x28');return db[_0x727c('0x52')][_0x727c('0x53')]({'where':{'name':_0x57d5bb,'userProfileId':_0x27c469[_0x727c('0x54')]},'raw':!![]})['then'](function(_0x8e4dbd){if(_0x8e4dbd&&_0x8e4dbd[_0x727c('0x55')]===0x0){return db[_0x727c('0x29')][_0x727c('0x4d')]({'name':_0x5822a8[_0x727c('0x2c')],'resourceId':_0x5822a8['id'],'type':_0x8e4dbd[_0x727c('0x2c')],'sectionId':_0x8e4dbd['id']},{})[_0x727c('0x26')](function(){return _0x494681;});}else{return _0x494681;}})['catch'](function(_0x3601fd){logger[_0x727c('0x2b')](_0x727c('0x56'),_0x3601fd);throw _0x3601fd;});}return _0x494681;})[_0x727c('0x26')](respondWithResult(_0x139f4b,0xc9))[_0x727c('0x4a')](handleError(_0x139f4b,null));};exports['update']=function(_0x386088,_0x260f05){if(_0x386088[_0x727c('0x4e')]['id']){delete _0x386088['body']['id'];}return db[_0x727c('0x45')][_0x727c('0x53')]({'where':{'id':_0x386088['params']['id']}})[_0x727c('0x26')](handleEntityNotFound(_0x260f05,null))[_0x727c('0x26')](saveUpdates(_0x386088[_0x727c('0x4e')],null))[_0x727c('0x26')](respondWithResult(_0x260f05,null))['catch'](handleError(_0x260f05,null));};exports['destroy']=function(_0x466f98,_0x549929){return db[_0x727c('0x45')][_0x727c('0x53')]({'where':{'id':_0x466f98[_0x727c('0x4c')]['id']}})[_0x727c('0x26')](handleEntityNotFound(_0x549929,null))[_0x727c('0x26')](removeEntity(_0x549929,null))[_0x727c('0x4a')](handleError(_0x549929,null));}; \ No newline at end of file +var _0xd13e=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','reject','update','then','get','ChanSpies','UserProfileResource','destroy','error','stack','name','index','map','VoiceChanSpy','fieldName','type','key','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','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','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd13e,0x193));var _0xed13=function(_0x7cc78a,_0x202096){_0x7cc78a=_0x7cc78a-0x0;var _0x470d11=_0xd13e[_0x7cc78a];return _0x470d11;};'use strict';var pdf=require(_0xed13('0x0'));var emlformat=require(_0xed13('0x1'));var rimraf=require(_0xed13('0x2'));var zipdir=require(_0xed13('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed13('0x4'));var moment=require('moment');var BPromise=require(_0xed13('0x5'));var Mustache=require('mustache');var util=require(_0xed13('0x6'));var path=require(_0xed13('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xed13('0x8'));var _=require(_0xed13('0x9'));var squel=require(_0xed13('0xa'));var crypto=require(_0xed13('0xb'));var jsforce=require(_0xed13('0xc'));var deskjs=require(_0xed13('0xd'));var toCsv=require(_0xed13('0xe'));var querystring=require(_0xed13('0xf'));var Papa=require(_0xed13('0x10'));var Redis=require('ioredis');var authService=require(_0xed13('0x11'));var qs=require(_0xed13('0x12'));var as=require(_0xed13('0x13'));var hardwareService=require(_0xed13('0x14'));var logger=require(_0xed13('0x15'))('api');var utils=require(_0xed13('0x16'));var config=require(_0xed13('0x17'));var licenseUtil=require(_0xed13('0x18'));var db=require(_0xed13('0x19'))['db'];function respondWithStatusCode(_0x936103,_0x3295ba){_0x3295ba=_0x3295ba||0xcc;return function(_0x5b950a){if(_0x5b950a){return _0x936103[_0xed13('0x1a')](_0x3295ba);}return _0x936103['status'](_0x3295ba)[_0xed13('0x1b')]();};}function respondWithResult(_0x56fdc6,_0x6e2978){_0x6e2978=_0x6e2978||0xc8;return function(_0x56108d){if(_0x56108d){return _0x56fdc6[_0xed13('0x1c')](_0x6e2978)['json'](_0x56108d);}};}function respondWithFilteredResult(_0x38901a,_0xf900d2){return function(_0x1d3d67){if(_0x1d3d67){var _0xa260ed=_0x1d3d67[_0xed13('0x1d')],_0x1d0ebf=_0xf900d2[_0xed13('0x1e')],_0x1f8585=_0xf900d2[_0xed13('0x1e')]+_0xf900d2[_0xed13('0x1f')],_0x3fef8d;if(_0x1f8585>=_0xa260ed){_0x1f8585=_0xa260ed;_0x3fef8d=0xc8;}else{_0x3fef8d=0xce;}_0x38901a[_0xed13('0x1c')](_0x3fef8d);return _0x38901a[_0xed13('0x20')](_0xed13('0x21'),_0x1d0ebf+'-'+_0x1f8585+'/'+_0xa260ed)[_0xed13('0x22')](_0x1d3d67);}return null;};}function patchUpdates(_0x2f38c9){return function(_0x580870){try{jsonpatch['apply'](_0x580870,_0x2f38c9,!![]);}catch(_0x1f3646){return BPromise[_0xed13('0x23')](_0x1f3646);}return _0x580870['save']();};}function saveUpdates(_0x40dd86,_0x4a85a3){return function(_0x4e9e3b){if(_0x4e9e3b){return _0x4e9e3b[_0xed13('0x24')](_0x40dd86)[_0xed13('0x25')](function(_0x2d62cd){return _0x2d62cd;});}return null;};}function removeEntity(_0x192d12,_0x1d7621){return function(_0x2fc1e4){if(_0x2fc1e4){return _0x2fc1e4['destroy']()['then'](function(){var _0x5d7ae1=_0x2fc1e4[_0xed13('0x26')]({'plain':!![]});var _0x3b1f23=_0xed13('0x27');return db[_0xed13('0x28')][_0xed13('0x29')]({'where':{'type':_0x3b1f23,'resourceId':_0x5d7ae1['id']}})[_0xed13('0x25')](function(){return _0x2fc1e4;});})[_0xed13('0x25')](function(){_0x192d12[_0xed13('0x1c')](0xcc)[_0xed13('0x1b')]();});}};}function handleEntityNotFound(_0x2f05f0,_0x1f064c){return function(_0x3bc666){if(!_0x3bc666){_0x2f05f0[_0xed13('0x1a')](0x194);}return _0x3bc666;};}function handleError(_0x322fc3,_0x4e03d1){_0x4e03d1=_0x4e03d1||0x1f4;return function(_0x5e399c){logger[_0xed13('0x2a')](_0x5e399c[_0xed13('0x2b')]);if(_0x5e399c['name']){delete _0x5e399c[_0xed13('0x2c')];}_0x322fc3[_0xed13('0x1c')](_0x4e03d1)['send'](_0x5e399c);};}exports[_0xed13('0x2d')]=function(_0x2066ca,_0x323156){var _0x570929={},_0x3a5387={},_0x3b2bf4={'count':0x0,'rows':[]};var _0x489840=_[_0xed13('0x2e')](db[_0xed13('0x2f')]['rawAttributes'],function(_0x11cb93){return{'name':_0x11cb93[_0xed13('0x30')],'type':_0x11cb93[_0xed13('0x31')][_0xed13('0x32')]};});_0x3a5387[_0xed13('0x33')]=_[_0xed13('0x2e')](_0x489840,_0xed13('0x2c'));_0x3a5387['query']=_[_0xed13('0x34')](_0x2066ca['query']);_0x3a5387['filters']=_[_0xed13('0x35')](_0x3a5387[_0xed13('0x33')],_0x3a5387[_0xed13('0x36')]);_0x570929['attributes']=_[_0xed13('0x35')](_0x3a5387[_0xed13('0x33')],qs[_0xed13('0x37')](_0x2066ca['query'][_0xed13('0x37')]));_0x570929[_0xed13('0x38')]=_0x570929[_0xed13('0x38')][_0xed13('0x39')]?_0x570929['attributes']:_0x3a5387[_0xed13('0x33')];if(!_0x2066ca[_0xed13('0x36')][_0xed13('0x3a')](_0xed13('0x3b'))){_0x570929[_0xed13('0x1f')]=qs[_0xed13('0x1f')](_0x2066ca[_0xed13('0x36')][_0xed13('0x1f')]);_0x570929[_0xed13('0x1e')]=qs[_0xed13('0x1e')](_0x2066ca['query'][_0xed13('0x1e')]);}_0x570929[_0xed13('0x3c')]=qs['sort'](_0x2066ca['query']['sort']);_0x570929[_0xed13('0x3d')]=qs[_0xed13('0x3e')](_['pick'](_0x2066ca['query'],_0x3a5387[_0xed13('0x3e')]),_0x489840);if(_0x2066ca[_0xed13('0x36')][_0xed13('0x3f')]){_0x570929[_0xed13('0x3d')]=_[_0xed13('0x40')](_0x570929['where'],{'$or':_['map'](_0x489840,function(_0x1e943a){if(_0x1e943a['type']!==_0xed13('0x41')){var _0x4da4ef={};_0x4da4ef[_0x1e943a[_0xed13('0x2c')]]={'$like':'%'+_0x2066ca['query']['filter']+'%'};return _0x4da4ef;}})});}_0x570929=_['merge']({},_0x570929,_0x2066ca[_0xed13('0x42')]);var _0x136fe0={'where':_0x570929[_0xed13('0x3d')]};return db[_0xed13('0x2f')][_0xed13('0x1d')](_0x136fe0)['then'](function(_0xb52363){_0x3b2bf4[_0xed13('0x1d')]=_0xb52363;if(_0x2066ca[_0xed13('0x36')][_0xed13('0x43')]){_0x570929[_0xed13('0x44')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0xed13('0x45')](_0x570929);})[_0xed13('0x25')](function(_0x24f4ba){_0x3b2bf4[_0xed13('0x46')]=_0x24f4ba;return _0x3b2bf4;})[_0xed13('0x25')](respondWithFilteredResult(_0x323156,_0x570929))[_0xed13('0x47')](handleError(_0x323156,null));};exports['show']=function(_0x2f04ef,_0x3262ac){var _0x4686f1={'raw':![],'where':{'id':_0x2f04ef[_0xed13('0x48')]['id']}},_0x3948ef={};_0x3948ef[_0xed13('0x33')]=_[_0xed13('0x34')](db[_0xed13('0x2f')][_0xed13('0x49')]);_0x3948ef[_0xed13('0x36')]=_[_0xed13('0x34')](_0x2f04ef[_0xed13('0x36')]);_0x3948ef[_0xed13('0x3e')]=_[_0xed13('0x35')](_0x3948ef['model'],_0x3948ef[_0xed13('0x36')]);_0x4686f1[_0xed13('0x38')]=_['intersection'](_0x3948ef[_0xed13('0x33')],qs[_0xed13('0x37')](_0x2f04ef[_0xed13('0x36')]['fields']));_0x4686f1[_0xed13('0x38')]=_0x4686f1[_0xed13('0x38')][_0xed13('0x39')]?_0x4686f1['attributes']:_0x3948ef['model'];if(_0x2f04ef[_0xed13('0x36')][_0xed13('0x43')]){_0x4686f1['include']=[{'all':!![]}];}_0x4686f1=_[_0xed13('0x40')]({},_0x4686f1,_0x2f04ef[_0xed13('0x42')]);return db[_0xed13('0x2f')][_0xed13('0x4a')](_0x4686f1)['then'](handleEntityNotFound(_0x3262ac,null))[_0xed13('0x25')](respondWithResult(_0x3262ac,null))[_0xed13('0x47')](handleError(_0x3262ac,null));};exports[_0xed13('0x4b')]=function(_0x7c4e19,_0x5e1417){return db[_0xed13('0x2f')]['create'](_0x7c4e19[_0xed13('0x4c')],{})['then'](function(_0x5a0828){var _0x45f643=_0x7c4e19[_0xed13('0x4d')]['get']({'plain':!![]});if(!_0x45f643)throw new Error(_0xed13('0x4e'));if(_0x45f643[_0xed13('0x4f')]===_0xed13('0x4d')){var _0x1f2116=_0x5a0828['get']({'plain':!![]});var _0x1d866d='ChanSpies';return db[_0xed13('0x50')][_0xed13('0x4a')]({'where':{'name':_0x1d866d,'userProfileId':_0x45f643[_0xed13('0x51')]},'raw':!![]})[_0xed13('0x25')](function(_0x29dab5){if(_0x29dab5&&_0x29dab5[_0xed13('0x52')]===0x0){return db[_0xed13('0x28')][_0xed13('0x4b')]({'name':_0x1f2116['name'],'resourceId':_0x1f2116['id'],'type':_0x29dab5[_0xed13('0x2c')],'sectionId':_0x29dab5['id']},{})[_0xed13('0x25')](function(){return _0x5a0828;});}else{return _0x5a0828;}})[_0xed13('0x47')](function(_0x30043f){logger['error'](_0xed13('0x53'),_0x30043f);throw _0x30043f;});}return _0x5a0828;})['then'](respondWithResult(_0x5e1417,0xc9))[_0xed13('0x47')](handleError(_0x5e1417,null));};exports['update']=function(_0x4bb9cc,_0x52ace8){if(_0x4bb9cc[_0xed13('0x4c')]['id']){delete _0x4bb9cc[_0xed13('0x4c')]['id'];}return db[_0xed13('0x2f')]['find']({'where':{'id':_0x4bb9cc[_0xed13('0x48')]['id']}})[_0xed13('0x25')](handleEntityNotFound(_0x52ace8,null))[_0xed13('0x25')](saveUpdates(_0x4bb9cc[_0xed13('0x4c')],null))[_0xed13('0x25')](respondWithResult(_0x52ace8,null))['catch'](handleError(_0x52ace8,null));};exports[_0xed13('0x29')]=function(_0x160e0b,_0x254052){return db[_0xed13('0x2f')]['find']({'where':{'id':_0x160e0b[_0xed13('0x48')]['id']}})[_0xed13('0x25')](handleEntityNotFound(_0x254052,null))[_0xed13('0x25')](removeEntity(_0x254052,null))[_0xed13('0x47')](handleError(_0x254052,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 35e15f6..66b6d21 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 _0x1d2d=['define','VoiceChanSpy','voice_chanspy','length','VoiceExtension','bulkCreate','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','internal','concat','agent','then','catch','exports','models'];(function(_0x49f30d,_0x50300a){var _0x2c75fa=function(_0x3a880a){while(--_0x3a880a){_0x49f30d['push'](_0x49f30d['shift']());}};_0x2c75fa(++_0x50300a);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x1a27a7,_0x4c20db){_0x1a27a7=_0x1a27a7-0x0;var _0x45f22c=_0x1d2d[_0x1a27a7];return _0x45f22c;};'use strict';var _=require(_0xd1d2('0x0'));var util=require(_0xd1d2('0x1'));var BPromise=require(_0xd1d2('0x2'));var attributes=require(_0xd1d2('0x3'));var getUserApplications=function(_0x3401a9,_0x4f5f7f,_0x32d884){var _0x4d6a83=0x1;var _0x5d3fac=[];var _0x3caa72={'context':_0x4f5f7f[_0xd1d2('0x4')]||_0xd1d2('0x5'),'exten':util[_0xd1d2('0x6')](_0xd1d2('0x7'),_0x3401a9[_0xd1d2('0x8')],_0x32d884),'type':'system','isApp':![],'ChanSpyId':_0x3401a9['id'],'UserId':_0x4f5f7f['id']};_0x5d3fac[_0xd1d2('0x9')](_[_0xd1d2('0xa')]({'app':_0xd1d2('0xb'),'appdata':util[_0xd1d2('0x6')](_0xd1d2('0xc'),_0xd1d2('0xd')),'priority':_0x4d6a83++},_0x3caa72));if(_0x3401a9[_0xd1d2('0xe')]){_0x5d3fac[_0xd1d2('0x9')](_[_0xd1d2('0xa')]({'app':_0xd1d2('0xf'),'appdata':util[_0xd1d2('0x6')](_0xd1d2('0x10'),_0x3401a9[_0xd1d2('0x11')]),'priority':_0x4d6a83++},_0x3caa72));}if(_0x3401a9['auth']){_0x5d3fac[_0xd1d2('0x9')](_[_0xd1d2('0xa')]({'app':_0xd1d2('0x12'),'appdata':_0x3401a9[_0xd1d2('0x13')],'priority':_0x4d6a83++},_0x3caa72));}_0x5d3fac[_0xd1d2('0x9')](_[_0xd1d2('0xa')]({'app':_0xd1d2('0x14'),'appdata':util[_0xd1d2('0x6')](_0xd1d2('0x15'),_0x4f5f7f[_0xd1d2('0x16')],_0x3401a9['options']?_0x3401a9[_0xd1d2('0x17')][_0xd1d2('0x18')](''):''),'priority':_0x4d6a83++},_0x3caa72));if(_0x3401a9[_0xd1d2('0xe')]){_0x5d3fac['push'](_[_0xd1d2('0xa')]({'app':_0xd1d2('0x19'),'priority':_0x4d6a83++},_0x3caa72));}return _0x5d3fac;};var getChanSpyApplications=function(_0x208425,_0x2f4cf9){var _0xecac1f=[];for(var _0x2723b3=0x0,_0x275996=0x1;_0x2723b3<_0x2f4cf9['length'];_0x2723b3++,_0x275996=0x1){_0xecac1f=_0xecac1f['concat'](getUserApplications(_0x208425,_0x2f4cf9[_0x2723b3],_0x2f4cf9[_0x2723b3][_0xd1d2('0x1a')]));if(_0x2f4cf9[_0x2723b3]['internal']!=_0x2f4cf9[_0x2723b3][_0xd1d2('0x16')]){_0xecac1f=_0xecac1f[_0xd1d2('0x1b')](getUserApplications(_0x208425,_0x2f4cf9[_0x2723b3],_0x2f4cf9[_0x2723b3][_0xd1d2('0x16')]));}}return _0xecac1f;};var getChanSpyPromise=function(_0x40d3dd,_0x4ab386){return new BPromise(function(_0x4f1201,_0xb43456){return _0x40d3dd['User']['findAll']({'attributes':['id',_0xd1d2('0x16'),_0xd1d2('0x1a')],'where':{'role':_0xd1d2('0x1c'),'chanspy':!![]},'raw':!![]})[_0xd1d2('0x1d')](function(_0x596cd8){if(_0x596cd8){return _0x4f1201(getChanSpyApplications(_0x4ab386,_0x596cd8));}return _0x4f1201([]);})[_0xd1d2('0x1e')](function(_0xbb4d27){_0xb43456(_0xbb4d27);});});};module[_0xd1d2('0x1f')]=function(_0x4eb082,_0x59e72c){var _0x31fee4=_0x4eb082[_0xd1d2('0x20')];return _0x4eb082[_0xd1d2('0x21')](_0xd1d2('0x22'),attributes,{'tableName':_0xd1d2('0x23'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x33a171,_0xe53fcd,_0x5df4af){return getChanSpyPromise(_0x31fee4,_0x33a171)[_0xd1d2('0x1d')](function(_0x42da6d){if(_0x42da6d&&_0x42da6d[_0xd1d2('0x24')]){return _0x31fee4[_0xd1d2('0x25')][_0xd1d2('0x26')](_0x42da6d);}})[_0xd1d2('0x1d')](function(){_0x5df4af();})[_0xd1d2('0x1e')](function(_0x34faf7){_0x5df4af(_0x34faf7);});},'afterUpdate':function(_0xe6ef3c,_0x384460,_0x3645e9){return _0x31fee4['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0xe6ef3c['id']}})[_0xd1d2('0x1d')](function(){return getChanSpyPromise(_0x31fee4,_0xe6ef3c);})[_0xd1d2('0x1d')](function(_0x1e6072){if(_0x1e6072&&_0x1e6072[_0xd1d2('0x24')]){return _0x31fee4[_0xd1d2('0x25')]['bulkCreate'](_0x1e6072);}})[_0xd1d2('0x1d')](function(){_0x3645e9();})[_0xd1d2('0x1e')](function(_0x383947){_0x3645e9(_0x383947);});},'afterDestroy':function(_0x4b4134,_0x19db00,_0x1db17f){return _0x31fee4[_0xd1d2('0x25')]['destroy']({'where':{'ChanSpyId':_0x4b4134['id']}})[_0xd1d2('0x1d')](function(){_0x1db17f();})[_0xd1d2('0x1e')](function(_0x1cc33b){_0x1db17f(_0x1cc33b);});}}});}; \ No newline at end of file +var _0x29a5=['lodash','util','bluebird','context','from-sip','format','%s%s','prefix','system','push','Set','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','merge','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','concat','internal','User','findAll','agent','then','catch','exports','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy'];(function(_0x1e32c9,_0x3501c5){var _0xa705a5=function(_0x194d30){while(--_0x194d30){_0x1e32c9['push'](_0x1e32c9['shift']());}};_0xa705a5(++_0x3501c5);}(_0x29a5,0x1e0));var _0x529a=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x29a5[_0xbf8ebe];return _0x1e25e8;};'use strict';var _=require(_0x529a('0x0'));var util=require(_0x529a('0x1'));var BPromise=require(_0x529a('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x27c562,_0x1eac25,_0x4c70fd){var _0x15be39=0x1;var _0x13dd75=[];var _0x5d0666={'context':_0x1eac25[_0x529a('0x3')]||_0x529a('0x4'),'exten':util[_0x529a('0x5')](_0x529a('0x6'),_0x27c562[_0x529a('0x7')],_0x4c70fd),'type':_0x529a('0x8'),'isApp':![],'ChanSpyId':_0x27c562['id'],'UserId':_0x1eac25['id']};_0x13dd75[_0x529a('0x9')](_['merge']({'app':_0x529a('0xa'),'appdata':util[_0x529a('0x5')](_0x529a('0xb'),'chanspy'),'priority':_0x15be39++},_0x5d0666));if(_0x27c562[_0x529a('0xc')]){_0x13dd75['push'](_['merge']({'app':_0x529a('0xd'),'appdata':util[_0x529a('0x5')](_0x529a('0xe'),_0x27c562[_0x529a('0xf')]),'priority':_0x15be39++},_0x5d0666));}if(_0x27c562[_0x529a('0x10')]){_0x13dd75[_0x529a('0x9')](_[_0x529a('0x11')]({'app':_0x529a('0x12'),'appdata':_0x27c562[_0x529a('0x13')],'priority':_0x15be39++},_0x5d0666));}_0x13dd75[_0x529a('0x9')](_[_0x529a('0x11')]({'app':_0x529a('0x14'),'appdata':util[_0x529a('0x5')](_0x529a('0x15'),_0x1eac25[_0x529a('0x16')],_0x27c562[_0x529a('0x17')]?_0x27c562['options'][_0x529a('0x18')](''):''),'priority':_0x15be39++},_0x5d0666));if(_0x27c562[_0x529a('0xc')]){_0x13dd75[_0x529a('0x9')](_['merge']({'app':_0x529a('0x19'),'priority':_0x15be39++},_0x5d0666));}return _0x13dd75;};var getChanSpyApplications=function(_0x155062,_0x42d7cc){var _0x42d818=[];for(var _0x36e235=0x0,_0x199cb1=0x1;_0x36e235<_0x42d7cc['length'];_0x36e235++,_0x199cb1=0x1){_0x42d818=_0x42d818[_0x529a('0x1a')](getUserApplications(_0x155062,_0x42d7cc[_0x36e235],_0x42d7cc[_0x36e235][_0x529a('0x1b')]));if(_0x42d7cc[_0x36e235][_0x529a('0x1b')]!=_0x42d7cc[_0x36e235]['name']){_0x42d818=_0x42d818[_0x529a('0x1a')](getUserApplications(_0x155062,_0x42d7cc[_0x36e235],_0x42d7cc[_0x36e235][_0x529a('0x16')]));}}return _0x42d818;};var getChanSpyPromise=function(_0x1a9e2c,_0x1b1093){return new BPromise(function(_0x4851b0,_0x5036bc){return _0x1a9e2c[_0x529a('0x1c')][_0x529a('0x1d')]({'attributes':['id',_0x529a('0x16'),_0x529a('0x1b')],'where':{'role':_0x529a('0x1e'),'chanspy':!![]},'raw':!![]})[_0x529a('0x1f')](function(_0x30e100){if(_0x30e100){return _0x4851b0(getChanSpyApplications(_0x1b1093,_0x30e100));}return _0x4851b0([]);})[_0x529a('0x20')](function(_0x4e748f){_0x5036bc(_0x4e748f);});});};module[_0x529a('0x21')]=function(_0x45448d,_0x224836){var _0x4c05b1=_0x45448d['models'];return _0x45448d[_0x529a('0x22')](_0x529a('0x23'),attributes,{'tableName':_0x529a('0x24'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x20aa30,_0x4049f5,_0x284cdc){return getChanSpyPromise(_0x4c05b1,_0x20aa30)[_0x529a('0x1f')](function(_0x40eac6){if(_0x40eac6&&_0x40eac6['length']){return _0x4c05b1[_0x529a('0x25')][_0x529a('0x26')](_0x40eac6);}})[_0x529a('0x1f')](function(){_0x284cdc();})[_0x529a('0x20')](function(_0x3d91f5){_0x284cdc(_0x3d91f5);});},'afterUpdate':function(_0x51c6ec,_0x3dad1b,_0x11f280){return _0x4c05b1[_0x529a('0x25')][_0x529a('0x27')]({'where':{'ChanSpyId':_0x51c6ec['id']}})[_0x529a('0x1f')](function(){return getChanSpyPromise(_0x4c05b1,_0x51c6ec);})[_0x529a('0x1f')](function(_0x4cb1cd){if(_0x4cb1cd&&_0x4cb1cd['length']){return _0x4c05b1[_0x529a('0x25')][_0x529a('0x26')](_0x4cb1cd);}})[_0x529a('0x1f')](function(){_0x11f280();})[_0x529a('0x20')](function(_0x3b73ed){_0x11f280(_0x3b73ed);});},'afterDestroy':function(_0x10535f,_0x916648,_0x15836b){return _0x4c05b1[_0x529a('0x25')][_0x529a('0x27')]({'where':{'ChanSpyId':_0x10535f['id']}})['then'](function(){_0x15836b();})[_0x529a('0x20')](function(_0x184838){_0x15836b(_0x184838);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 2d3cdb0..5e81890 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 _0x5454=['util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x5454,0xf1));var _0x4545=function(_0x21d395,_0x96b590){_0x21d395=_0x21d395-0x0;var _0x4ffc2b=_0x5454[_0x21d395];return _0x4ffc2b;};'use strict';var _=require(_0x4545('0x0'));var util=require(_0x4545('0x1'));var moment=require(_0x4545('0x2'));var BPromise=require('bluebird');var rs=require(_0x4545('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4545('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4545('0x5'));var config=require(_0x4545('0x6'));var jayson=require(_0x4545('0x7'));var client=jayson['client'][_0x4545('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51dd7f,_0x1249f8,_0x470504){return new BPromise(function(_0x47449d,_0x57af0d){return client[_0x4545('0x9')](_0x51dd7f,_0x470504)[_0x4545('0xa')](function(_0x3eb339){logger[_0x4545('0xb')](_0x4545('0xc'),_0x1249f8,_0x4545('0xd'));logger[_0x4545('0xe')](_0x4545('0xf'),_0x1249f8,_0x4545('0xd'),JSON[_0x4545('0x10')](_0x3eb339));if(_0x3eb339['error']){if(_0x3eb339[_0x4545('0x11')][_0x4545('0x12')]===0x1f4){logger[_0x4545('0x11')](_0x4545('0xc'),_0x1249f8,_0x3eb339[_0x4545('0x11')][_0x4545('0x13')]);return _0x57af0d(_0x3eb339[_0x4545('0x11')][_0x4545('0x13')]);}logger[_0x4545('0x11')](_0x4545('0xc'),_0x1249f8,_0x3eb339['error'][_0x4545('0x13')]);return _0x47449d(_0x3eb339[_0x4545('0x11')]['message']);}else{logger[_0x4545('0xb')](_0x4545('0xc'),_0x1249f8,_0x4545('0xd'));_0x47449d(_0x3eb339[_0x4545('0x14')]['message']);}})[_0x4545('0x15')](function(_0x37d0ba){logger['error'](_0x4545('0xc'),_0x1249f8,_0x37d0ba);_0x57af0d(_0x37d0ba);});});} \ No newline at end of file +var _0x2f9c=['request','then','info','request\x20sent','debug','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2f9c,0x1ae));var _0xc2f9=function(_0x3382fb,_0xf3de39){_0x3382fb=_0x3382fb-0x0;var _0x5e687e=_0x2f9c[_0x3382fb];return _0x5e687e;};'use strict';var _=require(_0xc2f9('0x0'));var util=require('util');var moment=require(_0xc2f9('0x1'));var BPromise=require(_0xc2f9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc2f9('0x3'))['db'];var utils=require(_0xc2f9('0x4'));var logger=require(_0xc2f9('0x5'))(_0xc2f9('0x6'));var config=require('../../config/environment');var jayson=require(_0xc2f9('0x7'));var client=jayson[_0xc2f9('0x8')][_0xc2f9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xed155a,_0x1c359f,_0x503a48){return new BPromise(function(_0xe33bf3,_0xd4eae2){return client[_0xc2f9('0xa')](_0xed155a,_0x503a48)[_0xc2f9('0xb')](function(_0x44a2f9){logger[_0xc2f9('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x1c359f,_0xc2f9('0xd'));logger[_0xc2f9('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x1c359f,_0xc2f9('0xd'),JSON[_0xc2f9('0xf')](_0x44a2f9));if(_0x44a2f9['error']){if(_0x44a2f9[_0xc2f9('0x10')][_0xc2f9('0x11')]===0x1f4){logger[_0xc2f9('0x10')](_0xc2f9('0x12'),_0x1c359f,_0x44a2f9[_0xc2f9('0x10')][_0xc2f9('0x13')]);return _0xd4eae2(_0x44a2f9[_0xc2f9('0x10')][_0xc2f9('0x13')]);}logger[_0xc2f9('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x1c359f,_0x44a2f9[_0xc2f9('0x10')]['message']);return _0xe33bf3(_0x44a2f9[_0xc2f9('0x10')][_0xc2f9('0x13')]);}else{logger[_0xc2f9('0xc')](_0xc2f9('0x12'),_0x1c359f,_0xc2f9('0xd'));_0xe33bf3(_0x44a2f9[_0xc2f9('0x14')][_0xc2f9('0x13')]);}})[_0xc2f9('0x15')](function(_0x4806fc){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x1c359f,_0x4806fc);_0xd4eae2(_0x4806fc);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 8d44681..fb2e03c 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 _0xf53f=['get','isAuthenticated','show','post','put','update','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller'];(function(_0x2b14fe,_0x10b97e){var _0x11a35e=function(_0x102ca9){while(--_0x102ca9){_0x2b14fe['push'](_0x2b14fe['shift']());}};_0x11a35e(++_0x10b97e);}(_0xf53f,0x8d));var _0xff53=function(_0x33b108,_0x2c16e6){_0x33b108=_0x33b108-0x0;var _0x2b63fe=_0xf53f[_0x33b108];return _0x2b63fe;};'use strict';var multer=require(_0xff53('0x0'));var util=require(_0xff53('0x1'));var path=require(_0xff53('0x2'));var timeout=require(_0xff53('0x3'));var express=require(_0xff53('0x4'));var router=express[_0xff53('0x5')]();var fs_extra=require(_0xff53('0x6'));var auth=require(_0xff53('0x7'));var interaction=require(_0xff53('0x8'));var config=require(_0xff53('0x9'));var controller=require(_0xff53('0xa'));router[_0xff53('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xff53('0xb')]('/:id',auth[_0xff53('0xc')](),controller[_0xff53('0xd')]);router[_0xff53('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xff53('0xf')]('/:id',auth[_0xff53('0xc')](),controller[_0xff53('0x10')]);router['delete'](_0xff53('0x11'),auth[_0xff53('0xc')](),controller['destroy']);module[_0xff53('0x12')]=router; \ No newline at end of file +var _0x1738=['fs-extra','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','put','destroy','exports','multer','util','express','Router'];(function(_0x4a2c65,_0x5c203b){var _0x546a1b=function(_0x7d9ac1){while(--_0x7d9ac1){_0x4a2c65['push'](_0x4a2c65['shift']());}};_0x546a1b(++_0x5c203b);}(_0x1738,0x1bc));var _0x8173=function(_0x137d0a,_0x5e2ba2){_0x137d0a=_0x137d0a-0x0;var _0x3d4f4e=_0x1738[_0x137d0a];return _0x3d4f4e;};'use strict';var multer=require(_0x8173('0x0'));var util=require(_0x8173('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8173('0x2'));var router=express[_0x8173('0x3')]();var fs_extra=require(_0x8173('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8173('0x5'));var controller=require(_0x8173('0x6'));router[_0x8173('0x7')]('/',auth[_0x8173('0x8')](),controller[_0x8173('0x9')]);router[_0x8173('0x7')](_0x8173('0xa'),auth[_0x8173('0x8')](),controller[_0x8173('0xb')]);router[_0x8173('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8173('0xd')](_0x8173('0xa'),auth[_0x8173('0x8')](),controller['update']);router['delete'](_0x8173('0xa'),auth[_0x8173('0x8')](),controller[_0x8173('0xe')]);module[_0x8173('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 1644f8d..3d40e3d 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 _0x3e74=['name','sequelize','STRING'];(function(_0x4360ce,_0xa1d8f4){var _0x47518=function(_0x4eb90f){while(--_0x4eb90f){_0x4360ce['push'](_0x4360ce['shift']());}};_0x47518(++_0xa1d8f4);}(_0x3e74,0x175));var _0x43e7=function(_0x2d5277,_0xee6e47){_0x2d5277=_0x2d5277-0x0;var _0xe36fe5=_0x3e74[_0x2d5277];return _0xe36fe5;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3e74=['name','sequelize','STRING'];(function(_0x673d68,_0x115d89){var _0x51b40b=function(_0x2278d0){while(--_0x2278d0){_0x673d68['push'](_0x673d68['shift']());}};_0x51b40b(++_0x115d89);}(_0x3e74,0x175));var _0x43e7=function(_0x41f068,_0x4365bd){_0x41f068=_0x41f068-0x0;var _0x363b1a=_0x3e74[_0x41f068];return _0x363b1a;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 9ad003a..086ce2b 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 _0xf391=['code','VoiceContext,\x20%s,\x20%s','message','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','Contexts','UserProfileResource','name','send','index','map','VoiceContext','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','sort','where','merge','filter','includeAll','rows','show','options','find','create','body','findAll','readFileSync','join','server/files/templates/context.ejs','utf8','render','chan_sip.so','user','get','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','update','root','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','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','info','debug','request\x20sent','stringify','error'];(function(_0x4ccba6,_0x450e38){var _0x1cd34b=function(_0x1a9b4c){while(--_0x1a9b4c){_0x4ccba6['push'](_0x4ccba6['shift']());}};_0x1cd34b(++_0x450e38);}(_0xf391,0x1b8));var _0x1f39=function(_0x5f36d5,_0x1e5044){_0x5f36d5=_0x5f36d5-0x0;var _0x220bca=_0xf391[_0x5f36d5];return _0x220bca;};'use strict';var pdf=require(_0x1f39('0x0'));var emlformat=require(_0x1f39('0x1'));var rimraf=require(_0x1f39('0x2'));var zipdir=require(_0x1f39('0x3'));var jsonpatch=require(_0x1f39('0x4'));var rp=require(_0x1f39('0x5'));var moment=require(_0x1f39('0x6'));var BPromise=require(_0x1f39('0x7'));var Mustache=require('mustache');var util=require(_0x1f39('0x8'));var path=require('path');var sox=require(_0x1f39('0x9'));var csv=require(_0x1f39('0xa'));var ejs=require(_0x1f39('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1f39('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1f39('0xd'));var deskjs=require(_0x1f39('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1f39('0xf'));var Papa=require(_0x1f39('0x10'));var Redis=require('ioredis');var authService=require(_0x1f39('0x11'));var qs=require(_0x1f39('0x12'));var as=require(_0x1f39('0x13'));var hardwareService=require(_0x1f39('0x14'));var logger=require('../../config/logger')(_0x1f39('0x15'));var utils=require(_0x1f39('0x16'));var config=require(_0x1f39('0x17'));var licenseUtil=require(_0x1f39('0x18'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x280f8a,_0x35d9c2,_0x49fa39,_0x175182){return new BPromise(function(_0x2968ae,_0x691afa){var _0x3449dd=_0x175182||client;return _0x3449dd['request'](_0x280f8a,_0x49fa39)['then'](function(_0x1791a0){logger[_0x1f39('0x19')]('VoiceContext,\x20%s,\x20%s',_0x35d9c2,'request\x20sent');logger[_0x1f39('0x1a')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x35d9c2,_0x1f39('0x1b'),JSON[_0x1f39('0x1c')](_0x1791a0));if(_0x1791a0[_0x1f39('0x1d')]){if(_0x1791a0[_0x1f39('0x1d')][_0x1f39('0x1e')]===0x1f4){logger[_0x1f39('0x1d')](_0x1f39('0x1f'),_0x35d9c2,_0x1791a0[_0x1f39('0x1d')][_0x1f39('0x20')]);return _0x691afa(_0x1791a0[_0x1f39('0x1d')][_0x1f39('0x20')]);}logger['error'](_0x1f39('0x1f'),_0x35d9c2,_0x1791a0[_0x1f39('0x1d')][_0x1f39('0x20')]);return _0x2968ae(_0x1791a0[_0x1f39('0x1d')]['message']);}else{logger[_0x1f39('0x19')](_0x1f39('0x1f'),_0x35d9c2,_0x1f39('0x1b'));_0x2968ae(_0x1791a0['result']['message']);}})[_0x1f39('0x21')](function(_0x384ab0){logger[_0x1f39('0x1d')](_0x1f39('0x1f'),_0x35d9c2,_0x384ab0);_0x691afa(_0x384ab0);});});}function respondWithStatusCode(_0x42c511,_0x580d33){_0x580d33=_0x580d33||0xcc;return function(_0x406fe0){if(_0x406fe0){return _0x42c511[_0x1f39('0x22')](_0x580d33);}return _0x42c511[_0x1f39('0x23')](_0x580d33)[_0x1f39('0x24')]();};}function respondWithResult(_0x38f757,_0x364060){_0x364060=_0x364060||0xc8;return function(_0x72b32e){if(_0x72b32e){return _0x38f757['status'](_0x364060)['json'](_0x72b32e);}};}function respondWithFilteredResult(_0x2e198b,_0x88f805){return function(_0x4e180d){if(_0x4e180d){var _0x3a517c=_0x4e180d['count'],_0x210000=_0x88f805[_0x1f39('0x25')],_0x2c27d9=_0x88f805[_0x1f39('0x25')]+_0x88f805[_0x1f39('0x26')],_0x1efa1b;if(_0x2c27d9>=_0x3a517c){_0x2c27d9=_0x3a517c;_0x1efa1b=0xc8;}else{_0x1efa1b=0xce;}_0x2e198b[_0x1f39('0x23')](_0x1efa1b);return _0x2e198b[_0x1f39('0x27')](_0x1f39('0x28'),_0x210000+'-'+_0x2c27d9+'/'+_0x3a517c)[_0x1f39('0x29')](_0x4e180d);}return null;};}function patchUpdates(_0x32b00f){return function(_0x3bdfe4){try{jsonpatch[_0x1f39('0x2a')](_0x3bdfe4,_0x32b00f,!![]);}catch(_0x3b87e2){return BPromise[_0x1f39('0x2b')](_0x3b87e2);}return _0x3bdfe4[_0x1f39('0x2c')]();};}function saveUpdates(_0x418793,_0xa05b2b){return function(_0x38a986){if(_0x38a986){return _0x38a986['update'](_0x418793)[_0x1f39('0x2d')](function(_0x3a239e){return _0x3a239e;});}return null;};}function removeEntity(_0x42378f,_0x149b02){return function(_0x2e71be){if(_0x2e71be){return _0x2e71be[_0x1f39('0x2e')]()[_0x1f39('0x2d')](function(){var _0x5b9918=_0x2e71be['get']({'plain':!![]});var _0xd82bc0=_0x1f39('0x2f');return db[_0x1f39('0x30')][_0x1f39('0x2e')]({'where':{'type':_0xd82bc0,'resourceId':_0x5b9918['id']}})[_0x1f39('0x2d')](function(){return _0x2e71be;});})['then'](function(){_0x42378f['status'](0xcc)[_0x1f39('0x24')]();});}};}function handleEntityNotFound(_0x254c49,_0x5d08e7){return function(_0x3730e9){if(!_0x3730e9){_0x254c49['sendStatus'](0x194);}return _0x3730e9;};}function handleError(_0x237639,_0x18cd9b){_0x18cd9b=_0x18cd9b||0x1f4;return function(_0x580e31){logger[_0x1f39('0x1d')](_0x580e31['stack']);if(_0x580e31[_0x1f39('0x31')]){delete _0x580e31[_0x1f39('0x31')];}_0x237639['status'](_0x18cd9b)[_0x1f39('0x32')](_0x580e31);};}exports[_0x1f39('0x33')]=function(_0x4df9c0,_0x3ec245){var _0x5098ec={},_0x56e136={},_0x2b29db={'count':0x0,'rows':[]};var _0x18d039=_[_0x1f39('0x34')](db[_0x1f39('0x35')][_0x1f39('0x36')],function(_0x2d47dd){return{'name':_0x2d47dd['fieldName'],'type':_0x2d47dd[_0x1f39('0x37')][_0x1f39('0x38')]};});_0x56e136[_0x1f39('0x39')]=_[_0x1f39('0x34')](_0x18d039,_0x1f39('0x31'));_0x56e136['query']=_[_0x1f39('0x3a')](_0x4df9c0[_0x1f39('0x3b')]);_0x56e136[_0x1f39('0x3c')]=_[_0x1f39('0x3d')](_0x56e136[_0x1f39('0x39')],_0x56e136['query']);_0x5098ec[_0x1f39('0x3e')]=_['intersection'](_0x56e136['model'],qs[_0x1f39('0x3f')](_0x4df9c0[_0x1f39('0x3b')][_0x1f39('0x3f')]));_0x5098ec['attributes']=_0x5098ec[_0x1f39('0x3e')][_0x1f39('0x40')]?_0x5098ec[_0x1f39('0x3e')]:_0x56e136['model'];if(!_0x4df9c0[_0x1f39('0x3b')]['hasOwnProperty']('nolimit')){_0x5098ec[_0x1f39('0x26')]=qs[_0x1f39('0x26')](_0x4df9c0[_0x1f39('0x3b')]['limit']);_0x5098ec[_0x1f39('0x25')]=qs[_0x1f39('0x25')](_0x4df9c0[_0x1f39('0x3b')][_0x1f39('0x25')]);}_0x5098ec['order']=qs['sort'](_0x4df9c0[_0x1f39('0x3b')][_0x1f39('0x41')]);_0x5098ec[_0x1f39('0x42')]=qs[_0x1f39('0x3c')](_['pick'](_0x4df9c0[_0x1f39('0x3b')],_0x56e136['filters']),_0x18d039);if(_0x4df9c0['query']['filter']){_0x5098ec['where']=_[_0x1f39('0x43')](_0x5098ec[_0x1f39('0x42')],{'$or':_[_0x1f39('0x34')](_0x18d039,function(_0x157224){if(_0x157224['type']!=='VIRTUAL'){var _0x33af0c={};_0x33af0c[_0x157224[_0x1f39('0x31')]]={'$like':'%'+_0x4df9c0[_0x1f39('0x3b')][_0x1f39('0x44')]+'%'};return _0x33af0c;}})});}_0x5098ec=_[_0x1f39('0x43')]({},_0x5098ec,_0x4df9c0['options']);var _0x2031d3={'where':_0x5098ec[_0x1f39('0x42')]};return db[_0x1f39('0x35')]['count'](_0x2031d3)['then'](function(_0x12afd8){_0x2b29db['count']=_0x12afd8;if(_0x4df9c0[_0x1f39('0x3b')][_0x1f39('0x45')]){_0x5098ec['include']=[{'all':!![]}];}return db['VoiceContext']['findAll'](_0x5098ec);})[_0x1f39('0x2d')](function(_0x51e5e6){_0x2b29db[_0x1f39('0x46')]=_0x51e5e6;return _0x2b29db;})['then'](respondWithFilteredResult(_0x3ec245,_0x5098ec))[_0x1f39('0x21')](handleError(_0x3ec245,null));};exports[_0x1f39('0x47')]=function(_0x17f1c6,_0x5f56af){var _0x16a96f={'raw':![],'where':{'id':_0x17f1c6['params']['id']}},_0x32b8c9={};_0x32b8c9[_0x1f39('0x39')]=_[_0x1f39('0x3a')](db[_0x1f39('0x35')][_0x1f39('0x36')]);_0x32b8c9[_0x1f39('0x3b')]=_[_0x1f39('0x3a')](_0x17f1c6['query']);_0x32b8c9[_0x1f39('0x3c')]=_['intersection'](_0x32b8c9[_0x1f39('0x39')],_0x32b8c9[_0x1f39('0x3b')]);_0x16a96f[_0x1f39('0x3e')]=_['intersection'](_0x32b8c9[_0x1f39('0x39')],qs[_0x1f39('0x3f')](_0x17f1c6['query'][_0x1f39('0x3f')]));_0x16a96f['attributes']=_0x16a96f[_0x1f39('0x3e')][_0x1f39('0x40')]?_0x16a96f[_0x1f39('0x3e')]:_0x32b8c9[_0x1f39('0x39')];if(_0x17f1c6[_0x1f39('0x3b')][_0x1f39('0x45')]){_0x16a96f['include']=[{'all':!![]}];}_0x16a96f=_['merge']({},_0x16a96f,_0x17f1c6[_0x1f39('0x48')]);return db[_0x1f39('0x35')][_0x1f39('0x49')](_0x16a96f)[_0x1f39('0x2d')](handleEntityNotFound(_0x5f56af,null))[_0x1f39('0x2d')](respondWithResult(_0x5f56af,null))[_0x1f39('0x21')](handleError(_0x5f56af,null));};exports[_0x1f39('0x4a')]=function(_0x51d47e,_0x3dd7db,_0xe5010){var _0x3e8c22;return db[_0x1f39('0x35')][_0x1f39('0x4a')](_0x51d47e[_0x1f39('0x4b')],{'raw':!![]})[_0x1f39('0x2d')](function(_0x44e394){_0x3e8c22=_0x44e394;return db['VoiceContext'][_0x1f39('0x4c')]({'raw':!![]});})['then'](function(_0x26be4a){var _0x23bdb4=fs[_0x1f39('0x4d')](path[_0x1f39('0x4e')](config['root'],_0x1f39('0x4f')),_0x1f39('0x50'));var _0x6fc04f=ejs[_0x1f39('0x51')](_0x23bdb4,{'contexts':_0x26be4a||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x6fc04f);})[_0x1f39('0x2d')](function(){return respondWithRpcPromise('Reload',_0x1f39('0x4a'),{'module':_0x1f39('0x52')});})[_0x1f39('0x2d')](function(){var _0x5cbd63=_0x51d47e[_0x1f39('0x53')][_0x1f39('0x54')]({'plain':!![]});if(!_0x5cbd63)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5cbd63[_0x1f39('0x55')]===_0x1f39('0x53')){var _0x411a98=_0x3e8c22[_0x1f39('0x54')]({'plain':!![]});return db[_0x1f39('0x56')]['find']({'where':{'name':'Contexts','userProfileId':_0x5cbd63['userProfileId']},'raw':!![]})[_0x1f39('0x2d')](function(_0x4606f8){if(_0x4606f8&&_0x4606f8['autoAssociation']===0x0){return db[_0x1f39('0x30')][_0x1f39('0x4a')]({'name':_0x411a98[_0x1f39('0x31')],'resourceId':_0x411a98['id'],'type':_0x4606f8[_0x1f39('0x31')],'sectionId':_0x4606f8['id']},{})[_0x1f39('0x2d')](function(){return _0x3e8c22;});}else{return _0x3e8c22;}})['catch'](function(_0x4ddbca){logger[_0x1f39('0x1d')](_0x1f39('0x57'),_0x4ddbca);throw _0x4ddbca;});}return _0x3e8c22;})[_0x1f39('0x2d')](respondWithResult(_0x3dd7db,0xc9))[_0x1f39('0x21')](handleError(_0x3dd7db,null));};exports['update']=function(_0x376340,_0x49523b,_0x3efe32){var _0x5ed0f6;return db[_0x1f39('0x35')][_0x1f39('0x49')]({'where':{'id':_0x376340[_0x1f39('0x58')]['id']}})['then'](handleEntityNotFound(_0x49523b,null))[_0x1f39('0x2d')](saveUpdates(_0x376340['body'],null))[_0x1f39('0x2d')](function(_0x1ac63b){if(_0x1ac63b){_0x5ed0f6=_0x1ac63b;return db[_0x1f39('0x35')]['findAll']({'raw':!![]});}})[_0x1f39('0x2d')](function(_0x32c366){var _0x42ae5b=fs['readFileSync'](path[_0x1f39('0x4e')](config['root'],_0x1f39('0x4f')),'utf8');var _0x539f44=ejs['render'](_0x42ae5b,{'contexts':_0x32c366||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x539f44);})[_0x1f39('0x2d')](function(){return respondWithRpcPromise('Reload',_0x1f39('0x59'),{'module':'chan_sip.so'});})['then'](function(){return _0x5ed0f6;})[_0x1f39('0x2d')](respondWithResult(_0x49523b,null))[_0x1f39('0x21')](handleError(_0x49523b,null));};exports[_0x1f39('0x2e')]=function(_0x18a649,_0x256780,_0xa18d0e){var _0x2d629a;return db[_0x1f39('0x35')][_0x1f39('0x49')]({'where':{'id':_0x18a649['params']['id']}})['then'](handleEntityNotFound(_0x256780,null))['then'](removeEntity(_0x256780,null))[_0x1f39('0x2d')](function(){return db[_0x1f39('0x35')][_0x1f39('0x4c')]({'raw':!![]});})[_0x1f39('0x2d')](function(_0x496efb){var _0x23cb76=fs[_0x1f39('0x4d')](path['join'](config[_0x1f39('0x5a')],_0x1f39('0x4f')),'utf8');var _0x13f83e=ejs[_0x1f39('0x51')](_0x23cb76,{'contexts':_0x496efb});fs[_0x1f39('0x5b')](_0x1f39('0x5c'),_0x13f83e);return respondWithRpcPromise(_0x1f39('0x5d'),'destroy',{'module':_0x1f39('0x52')});})['catch'](handleError(_0x256780,null));}; \ No newline at end of file +var _0x638a=['rows','show','params','intersection','fields','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','chan_sip.so','find','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','VoiceContext','includeAll','include','findAll'];(function(_0x3e21f4,_0x43d310){var _0x40fc49=function(_0x54a8f6){while(--_0x54a8f6){_0x3e21f4['push'](_0x3e21f4['shift']());}};_0x40fc49(++_0x43d310);}(_0x638a,0x80));var _0xa638=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x638a[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xa638('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa638('0x1'));var zipdir=require(_0xa638('0x2'));var jsonpatch=require(_0xa638('0x3'));var rp=require('request-promise');var moment=require(_0xa638('0x4'));var BPromise=require(_0xa638('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa638('0x6'));var sox=require(_0xa638('0x7'));var csv=require(_0xa638('0x8'));var ejs=require(_0xa638('0x9'));var fs=require('fs');var fs_extra=require(_0xa638('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa638('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa638('0x8'));var querystring=require(_0xa638('0xc'));var Papa=require(_0xa638('0xd'));var Redis=require(_0xa638('0xe'));var authService=require(_0xa638('0xf'));var qs=require(_0xa638('0x10'));var as=require(_0xa638('0x11'));var hardwareService=require(_0xa638('0x12'));var logger=require(_0xa638('0x13'))(_0xa638('0x14'));var utils=require(_0xa638('0x15'));var config=require(_0xa638('0x16'));var licenseUtil=require(_0xa638('0x17'));var db=require(_0xa638('0x18'))['db'];var jayson=require(_0xa638('0x19'));var client=jayson[_0xa638('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c895d,_0x2828a1,_0x5f3e1b,_0x1e17e6){return new BPromise(function(_0x46a339,_0x137c98){var _0x4a9c50=_0x1e17e6||client;return _0x4a9c50[_0xa638('0x1b')](_0x2c895d,_0x5f3e1b)[_0xa638('0x1c')](function(_0x37909b){logger['info'](_0xa638('0x1d'),_0x2828a1,_0xa638('0x1e'));logger[_0xa638('0x1f')](_0xa638('0x20'),_0x2828a1,_0xa638('0x1e'),JSON['stringify'](_0x37909b));if(_0x37909b['error']){if(_0x37909b['error'][_0xa638('0x21')]===0x1f4){logger[_0xa638('0x22')](_0xa638('0x1d'),_0x2828a1,_0x37909b[_0xa638('0x22')][_0xa638('0x23')]);return _0x137c98(_0x37909b[_0xa638('0x22')][_0xa638('0x23')]);}logger['error'](_0xa638('0x1d'),_0x2828a1,_0x37909b['error'][_0xa638('0x23')]);return _0x46a339(_0x37909b['error'][_0xa638('0x23')]);}else{logger[_0xa638('0x24')](_0xa638('0x1d'),_0x2828a1,'request\x20sent');_0x46a339(_0x37909b[_0xa638('0x25')][_0xa638('0x23')]);}})[_0xa638('0x26')](function(_0x14ff17){logger[_0xa638('0x22')](_0xa638('0x1d'),_0x2828a1,_0x14ff17);_0x137c98(_0x14ff17);});});}function respondWithStatusCode(_0x5d5282,_0x1e934a){_0x1e934a=_0x1e934a||0xcc;return function(_0x18a6d7){if(_0x18a6d7){return _0x5d5282[_0xa638('0x27')](_0x1e934a);}return _0x5d5282['status'](_0x1e934a)[_0xa638('0x28')]();};}function respondWithResult(_0x13761d,_0x4c3ea3){_0x4c3ea3=_0x4c3ea3||0xc8;return function(_0x5c4584){if(_0x5c4584){return _0x13761d[_0xa638('0x29')](_0x4c3ea3)[_0xa638('0x2a')](_0x5c4584);}};}function respondWithFilteredResult(_0x9bd3d0,_0x8a8f8d){return function(_0x2d48c6){if(_0x2d48c6){var _0x344e26=_0x2d48c6[_0xa638('0x2b')],_0x56eee4=_0x8a8f8d[_0xa638('0x2c')],_0x17ead0=_0x8a8f8d['offset']+_0x8a8f8d[_0xa638('0x2d')],_0x5f369c;if(_0x17ead0>=_0x344e26){_0x17ead0=_0x344e26;_0x5f369c=0xc8;}else{_0x5f369c=0xce;}_0x9bd3d0[_0xa638('0x29')](_0x5f369c);return _0x9bd3d0[_0xa638('0x2e')](_0xa638('0x2f'),_0x56eee4+'-'+_0x17ead0+'/'+_0x344e26)['json'](_0x2d48c6);}return null;};}function patchUpdates(_0x506e69){return function(_0x2e0aac){try{jsonpatch[_0xa638('0x30')](_0x2e0aac,_0x506e69,!![]);}catch(_0xe3aa0d){return BPromise[_0xa638('0x31')](_0xe3aa0d);}return _0x2e0aac['save']();};}function saveUpdates(_0x4cdb6f,_0x2c743a){return function(_0x369247){if(_0x369247){return _0x369247[_0xa638('0x32')](_0x4cdb6f)[_0xa638('0x1c')](function(_0xbbe971){return _0xbbe971;});}return null;};}function removeEntity(_0x1c1526,_0xdfe31c){return function(_0x1453e6){if(_0x1453e6){return _0x1453e6[_0xa638('0x33')]()[_0xa638('0x1c')](function(){var _0x252686=_0x1453e6['get']({'plain':!![]});var _0x39d11c='Contexts';return db['UserProfileResource'][_0xa638('0x33')]({'where':{'type':_0x39d11c,'resourceId':_0x252686['id']}})[_0xa638('0x1c')](function(){return _0x1453e6;});})['then'](function(){_0x1c1526[_0xa638('0x29')](0xcc)[_0xa638('0x28')]();});}};}function handleEntityNotFound(_0x2840ae,_0x968e52){return function(_0x38ffa9){if(!_0x38ffa9){_0x2840ae[_0xa638('0x27')](0x194);}return _0x38ffa9;};}function handleError(_0xf8b1e1,_0x1bc5ac){_0x1bc5ac=_0x1bc5ac||0x1f4;return function(_0x9ba463){logger[_0xa638('0x22')](_0x9ba463[_0xa638('0x34')]);if(_0x9ba463[_0xa638('0x35')]){delete _0x9ba463[_0xa638('0x35')];}_0xf8b1e1['status'](_0x1bc5ac)['send'](_0x9ba463);};}exports['index']=function(_0x445cd9,_0x390609){var _0x57d2c6={},_0x2196e7={},_0x36dc78={'count':0x0,'rows':[]};var _0x4f8857=_[_0xa638('0x36')](db['VoiceContext'][_0xa638('0x37')],function(_0x2ca630){return{'name':_0x2ca630[_0xa638('0x38')],'type':_0x2ca630[_0xa638('0x39')][_0xa638('0x3a')]};});_0x2196e7[_0xa638('0x3b')]=_['map'](_0x4f8857,_0xa638('0x35'));_0x2196e7[_0xa638('0x3c')]=_[_0xa638('0x3d')](_0x445cd9[_0xa638('0x3c')]);_0x2196e7['filters']=_['intersection'](_0x2196e7[_0xa638('0x3b')],_0x2196e7[_0xa638('0x3c')]);_0x57d2c6[_0xa638('0x3e')]=_['intersection'](_0x2196e7[_0xa638('0x3b')],qs['fields'](_0x445cd9['query']['fields']));_0x57d2c6[_0xa638('0x3e')]=_0x57d2c6[_0xa638('0x3e')]['length']?_0x57d2c6[_0xa638('0x3e')]:_0x2196e7['model'];if(!_0x445cd9[_0xa638('0x3c')]['hasOwnProperty'](_0xa638('0x3f'))){_0x57d2c6[_0xa638('0x2d')]=qs['limit'](_0x445cd9[_0xa638('0x3c')][_0xa638('0x2d')]);_0x57d2c6[_0xa638('0x2c')]=qs[_0xa638('0x2c')](_0x445cd9[_0xa638('0x3c')]['offset']);}_0x57d2c6[_0xa638('0x40')]=qs[_0xa638('0x41')](_0x445cd9[_0xa638('0x3c')][_0xa638('0x41')]);_0x57d2c6[_0xa638('0x42')]=qs['filters'](_['pick'](_0x445cd9[_0xa638('0x3c')],_0x2196e7[_0xa638('0x43')]),_0x4f8857);if(_0x445cd9[_0xa638('0x3c')][_0xa638('0x44')]){_0x57d2c6[_0xa638('0x42')]=_[_0xa638('0x45')](_0x57d2c6[_0xa638('0x42')],{'$or':_[_0xa638('0x36')](_0x4f8857,function(_0x747048){if(_0x747048[_0xa638('0x39')]!==_0xa638('0x46')){var _0x315f44={};_0x315f44[_0x747048[_0xa638('0x35')]]={'$like':'%'+_0x445cd9['query'][_0xa638('0x44')]+'%'};return _0x315f44;}})});}_0x57d2c6=_[_0xa638('0x45')]({},_0x57d2c6,_0x445cd9[_0xa638('0x47')]);var _0x40e91b={'where':_0x57d2c6[_0xa638('0x42')]};return db[_0xa638('0x48')]['count'](_0x40e91b)[_0xa638('0x1c')](function(_0x3701ba){_0x36dc78['count']=_0x3701ba;if(_0x445cd9[_0xa638('0x3c')][_0xa638('0x49')]){_0x57d2c6[_0xa638('0x4a')]=[{'all':!![]}];}return db['VoiceContext'][_0xa638('0x4b')](_0x57d2c6);})[_0xa638('0x1c')](function(_0x50af23){_0x36dc78[_0xa638('0x4c')]=_0x50af23;return _0x36dc78;})[_0xa638('0x1c')](respondWithFilteredResult(_0x390609,_0x57d2c6))[_0xa638('0x26')](handleError(_0x390609,null));};exports[_0xa638('0x4d')]=function(_0x40ef4b,_0x4a78ba){var _0x5918b3={'raw':![],'where':{'id':_0x40ef4b[_0xa638('0x4e')]['id']}},_0x4c9d12={};_0x4c9d12[_0xa638('0x3b')]=_['keys'](db['VoiceContext'][_0xa638('0x37')]);_0x4c9d12[_0xa638('0x3c')]=_[_0xa638('0x3d')](_0x40ef4b[_0xa638('0x3c')]);_0x4c9d12['filters']=_[_0xa638('0x4f')](_0x4c9d12[_0xa638('0x3b')],_0x4c9d12[_0xa638('0x3c')]);_0x5918b3['attributes']=_[_0xa638('0x4f')](_0x4c9d12['model'],qs['fields'](_0x40ef4b[_0xa638('0x3c')][_0xa638('0x50')]));_0x5918b3[_0xa638('0x3e')]=_0x5918b3[_0xa638('0x3e')]['length']?_0x5918b3[_0xa638('0x3e')]:_0x4c9d12[_0xa638('0x3b')];if(_0x40ef4b[_0xa638('0x3c')]['includeAll']){_0x5918b3['include']=[{'all':!![]}];}_0x5918b3=_[_0xa638('0x45')]({},_0x5918b3,_0x40ef4b[_0xa638('0x47')]);return db[_0xa638('0x48')]['find'](_0x5918b3)[_0xa638('0x1c')](handleEntityNotFound(_0x4a78ba,null))[_0xa638('0x1c')](respondWithResult(_0x4a78ba,null))['catch'](handleError(_0x4a78ba,null));};exports[_0xa638('0x51')]=function(_0x7eb257,_0x2cbd86,_0x103435){var _0x201af7;return db[_0xa638('0x48')][_0xa638('0x51')](_0x7eb257[_0xa638('0x52')],{'raw':!![]})[_0xa638('0x1c')](function(_0x272bb5){_0x201af7=_0x272bb5;return db['VoiceContext'][_0xa638('0x4b')]({'raw':!![]});})[_0xa638('0x1c')](function(_0x333def){var _0x1bbe93=fs[_0xa638('0x53')](path[_0xa638('0x54')](config[_0xa638('0x55')],_0xa638('0x56')),_0xa638('0x57'));var _0x46aba1=ejs[_0xa638('0x58')](_0x1bbe93,{'contexts':_0x333def||[]});fs[_0xa638('0x59')](_0xa638('0x5a'),_0x46aba1);})['then'](function(){return respondWithRpcPromise(_0xa638('0x5b'),'create',{'module':'chan_sip.so'});})[_0xa638('0x1c')](function(){var _0xcbfe62=_0x7eb257[_0xa638('0x5c')][_0xa638('0x5d')]({'plain':!![]});if(!_0xcbfe62)throw new Error(_0xa638('0x5e'));if(_0xcbfe62[_0xa638('0x5f')]===_0xa638('0x5c')){var _0x16605d=_0x201af7[_0xa638('0x5d')]({'plain':!![]});return db[_0xa638('0x60')]['find']({'where':{'name':'Contexts','userProfileId':_0xcbfe62['userProfileId']},'raw':!![]})[_0xa638('0x1c')](function(_0x433cc2){if(_0x433cc2&&_0x433cc2[_0xa638('0x61')]===0x0){return db[_0xa638('0x62')]['create']({'name':_0x16605d[_0xa638('0x35')],'resourceId':_0x16605d['id'],'type':_0x433cc2[_0xa638('0x35')],'sectionId':_0x433cc2['id']},{})['then'](function(){return _0x201af7;});}else{return _0x201af7;}})[_0xa638('0x26')](function(_0x464357){logger['error'](_0xa638('0x63'),_0x464357);throw _0x464357;});}return _0x201af7;})[_0xa638('0x1c')](respondWithResult(_0x2cbd86,0xc9))[_0xa638('0x26')](handleError(_0x2cbd86,null));};exports[_0xa638('0x32')]=function(_0xfe249e,_0x5b19d4,_0x520de6){var _0x36be5d;return db[_0xa638('0x48')]['find']({'where':{'id':_0xfe249e['params']['id']}})[_0xa638('0x1c')](handleEntityNotFound(_0x5b19d4,null))[_0xa638('0x1c')](saveUpdates(_0xfe249e[_0xa638('0x52')],null))[_0xa638('0x1c')](function(_0x5cd9ea){if(_0x5cd9ea){_0x36be5d=_0x5cd9ea;return db[_0xa638('0x48')]['findAll']({'raw':!![]});}})[_0xa638('0x1c')](function(_0x4ab3db){var _0x33b4c1=fs['readFileSync'](path[_0xa638('0x54')](config[_0xa638('0x55')],_0xa638('0x56')),_0xa638('0x57'));var _0x3a0e82=ejs[_0xa638('0x58')](_0x33b4c1,{'contexts':_0x4ab3db||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x3a0e82);})['then'](function(){return respondWithRpcPromise(_0xa638('0x5b'),_0xa638('0x32'),{'module':_0xa638('0x64')});})['then'](function(){return _0x36be5d;})[_0xa638('0x1c')](respondWithResult(_0x5b19d4,null))['catch'](handleError(_0x5b19d4,null));};exports[_0xa638('0x33')]=function(_0x16b716,_0x2de230,_0x6162ba){var _0x591a5b;return db[_0xa638('0x48')][_0xa638('0x65')]({'where':{'id':_0x16b716['params']['id']}})[_0xa638('0x1c')](handleEntityNotFound(_0x2de230,null))['then'](removeEntity(_0x2de230,null))[_0xa638('0x1c')](function(){return db[_0xa638('0x48')][_0xa638('0x4b')]({'raw':!![]});})[_0xa638('0x1c')](function(_0x3ce013){var _0x1e1a46=fs[_0xa638('0x53')](path[_0xa638('0x54')](config['root'],_0xa638('0x56')),_0xa638('0x57'));var _0x53d994=ejs[_0xa638('0x58')](_0x1e1a46,{'contexts':_0x3ce013});fs['writeFileSync'](_0xa638('0x5a'),_0x53d994);return respondWithRpcPromise(_0xa638('0x5b'),'destroy',{'module':'chan_sip.so'});})['catch'](handleError(_0x2de230,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 7893d24..53aafef 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 _0x6d41=['request-promise','path','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','api','moment','bluebird'];(function(_0x2e84ac,_0x3b7a03){var _0x20153f=function(_0x1a78a3){while(--_0x1a78a3){_0x2e84ac['push'](_0x2e84ac['shift']());}};_0x20153f(++_0x3b7a03);}(_0x6d41,0x16f));var _0x16d4=function(_0x4c007b,_0x16de7e){_0x4c007b=_0x4c007b-0x0;var _0x79fb29=_0x6d41[_0x4c007b];return _0x79fb29;};'use strict';var _=require(_0x16d4('0x0'));var util=require(_0x16d4('0x1'));var logger=require('../../config/logger')(_0x16d4('0x2'));var moment=require(_0x16d4('0x3'));var BPromise=require(_0x16d4('0x4'));var rp=require(_0x16d4('0x5'));var fs=require('fs');var path=require(_0x16d4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x16d4('0x7'));module[_0x16d4('0x8')]=function(_0xb4582f,_0x55365f){return _0xb4582f[_0x16d4('0x9')](_0x16d4('0xa'),attributes,{'tableName':_0x16d4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x623a=['rimraf','../../config/environment','define','VoiceContext','voice_contexts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xb55cf2,_0x1ae4e1){var _0x3ccb24=function(_0x5a7e1a){while(--_0x5a7e1a){_0xb55cf2['push'](_0xb55cf2['shift']());}};_0x3ccb24(++_0x1ae4e1);}(_0x623a,0xc0));var _0xa623=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x623a[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0xa623('0x0'));var util=require('util');var logger=require(_0xa623('0x1'))(_0xa623('0x2'));var moment=require(_0xa623('0x3'));var BPromise=require(_0xa623('0x4'));var rp=require(_0xa623('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa623('0x6'));var config=require(_0xa623('0x7'));var attributes=require('./voiceContext.attributes');module['exports']=function(_0x45c69a,_0x25da8a){return _0x45c69a[_0xa623('0x8')](_0xa623('0x9'),attributes,{'tableName':_0xa623('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 07aab72..17f9e64 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 _0x7114=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x33c42e,_0x170930){var _0xfddb2b=function(_0x382a0e){while(--_0x382a0e){_0x33c42e['push'](_0x33c42e['shift']());}};_0xfddb2b(++_0x170930);}(_0x7114,0xd2));var _0x4711=function(_0x3d595b,_0x4ab232){_0x3d595b=_0x3d595b-0x0;var _0x9b0e0=_0x7114[_0x3d595b];return _0x9b0e0;};'use strict';var _=require(_0x4711('0x0'));var util=require(_0x4711('0x1'));var moment=require(_0x4711('0x2'));var BPromise=require('bluebird');var rs=require(_0x4711('0x3'));var fs=require('fs');var Redis=require(_0x4711('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4711('0x5'));var logger=require(_0x4711('0x6'))(_0x4711('0x7'));var config=require(_0x4711('0x8'));var jayson=require(_0x4711('0x9'));var client=jayson[_0x4711('0xa')][_0x4711('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b7084,_0x5f59b0,_0xaf001f){return new BPromise(function(_0x482f47,_0x4e19ed){return client[_0x4711('0xc')](_0x2b7084,_0xaf001f)[_0x4711('0xd')](function(_0x45246a){logger[_0x4711('0xe')]('VoiceContext,\x20%s,\x20%s',_0x5f59b0,_0x4711('0xf'));logger[_0x4711('0x10')](_0x4711('0x11'),_0x5f59b0,_0x4711('0xf'),JSON[_0x4711('0x12')](_0x45246a));if(_0x45246a[_0x4711('0x13')]){if(_0x45246a[_0x4711('0x13')][_0x4711('0x14')]===0x1f4){logger[_0x4711('0x13')](_0x4711('0x15'),_0x5f59b0,_0x45246a[_0x4711('0x13')][_0x4711('0x16')]);return _0x4e19ed(_0x45246a[_0x4711('0x13')]['message']);}logger[_0x4711('0x13')](_0x4711('0x15'),_0x5f59b0,_0x45246a[_0x4711('0x13')][_0x4711('0x16')]);return _0x482f47(_0x45246a[_0x4711('0x13')]['message']);}else{logger[_0x4711('0xe')](_0x4711('0x15'),_0x5f59b0,'request\x20sent');_0x482f47(_0x45246a['result'][_0x4711('0x16')]);}})[_0x4711('0x17')](function(_0xfd1727){logger[_0x4711('0x13')](_0x4711('0x15'),_0x5f59b0,_0xfd1727);_0x4e19ed(_0xfd1727);});});} \ No newline at end of file +var _0x8f43=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x57c413,_0x37069e){var _0x24176e=function(_0x476717){while(--_0x476717){_0x57c413['push'](_0x57c413['shift']());}};_0x24176e(++_0x37069e);}(_0x8f43,0xd7));var _0x38f4=function(_0x961333,_0x4c183a){_0x961333=_0x961333-0x0;var _0x48d01d=_0x8f43[_0x961333];return _0x48d01d;};'use strict';var _=require(_0x38f4('0x0'));var util=require(_0x38f4('0x1'));var moment=require(_0x38f4('0x2'));var BPromise=require(_0x38f4('0x3'));var rs=require(_0x38f4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x38f4('0x5'))['db'];var utils=require(_0x38f4('0x6'));var logger=require(_0x38f4('0x7'))(_0x38f4('0x8'));var config=require(_0x38f4('0x9'));var jayson=require(_0x38f4('0xa'));var client=jayson['client'][_0x38f4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d4292,_0x1b11fd,_0x3bab34){return new BPromise(function(_0x2d4e62,_0x32ee45){return client[_0x38f4('0xc')](_0x4d4292,_0x3bab34)['then'](function(_0x6f7cff){logger[_0x38f4('0xd')](_0x38f4('0xe'),_0x1b11fd,_0x38f4('0xf'));logger[_0x38f4('0x10')](_0x38f4('0x11'),_0x1b11fd,'request\x20sent',JSON[_0x38f4('0x12')](_0x6f7cff));if(_0x6f7cff[_0x38f4('0x13')]){if(_0x6f7cff[_0x38f4('0x13')][_0x38f4('0x14')]===0x1f4){logger[_0x38f4('0x13')](_0x38f4('0xe'),_0x1b11fd,_0x6f7cff['error']['message']);return _0x32ee45(_0x6f7cff[_0x38f4('0x13')]['message']);}logger['error'](_0x38f4('0xe'),_0x1b11fd,_0x6f7cff[_0x38f4('0x13')][_0x38f4('0x15')]);return _0x2d4e62(_0x6f7cff[_0x38f4('0x13')][_0x38f4('0x15')]);}else{logger[_0x38f4('0xd')](_0x38f4('0xe'),_0x1b11fd,'request\x20sent');_0x2d4e62(_0x6f7cff[_0x38f4('0x16')][_0x38f4('0x15')]);}})[_0x38f4('0x17')](function(_0x5b7540){logger['error']('VoiceContext,\x20%s,\x20%s',_0x1b11fd,_0x5b7540);_0x32ee45(_0x5b7540);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index db88c87..4662dcf 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 _0xd2ea=['./voiceDialReport.controller','get','isAuthenticated','/describe','/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x50a348,_0x35c7fd){var _0x55407f=function(_0x596e11){while(--_0x596e11){_0x50a348['push'](_0x50a348['shift']());}};_0x55407f(++_0x35c7fd);}(_0xd2ea,0x15f));var _0xad2e=function(_0x55dd30,_0x4eab62){_0x55dd30=_0x55dd30-0x0;var _0x10677d=_0xd2ea[_0x55dd30];return _0x10677d;};'use strict';var multer=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var path=require(_0xad2e('0x2'));var timeout=require(_0xad2e('0x3'));var express=require(_0xad2e('0x4'));var router=express['Router']();var fs_extra=require(_0xad2e('0x5'));var auth=require(_0xad2e('0x6'));var interaction=require(_0xad2e('0x7'));var config=require(_0xad2e('0x8'));var controller=require(_0xad2e('0x9'));router[_0xad2e('0xa')]('/',auth[_0xad2e('0xb')](),controller['index']);router[_0xad2e('0xa')](_0xad2e('0xc'),auth[_0xad2e('0xb')](),controller['describe']);router[_0xad2e('0xa')](_0xad2e('0xd'),auth['isAuthenticated'](),controller[_0xad2e('0xe')]);router['post']('/',auth[_0xad2e('0xb')](),controller[_0xad2e('0xf')]);router[_0xad2e('0x10')](_0xad2e('0xd'),auth['isAuthenticated'](),controller[_0xad2e('0x11')]);router['delete'](_0xad2e('0xd'),auth[_0xad2e('0xb')](),controller[_0xad2e('0x12')]);module[_0xad2e('0x13')]=router; \ No newline at end of file +var _0x5db8=['describe','post','create','put','delete','/:id','destroy','multer','util','path','express','Router','fs-extra','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/describe'];(function(_0x2e9c28,_0x292ed7){var _0x1901f7=function(_0x3c6e41){while(--_0x3c6e41){_0x2e9c28['push'](_0x2e9c28['shift']());}};_0x1901f7(++_0x292ed7);}(_0x5db8,0xbb));var _0x85db=function(_0x20ae13,_0x2a0c8e){_0x20ae13=_0x20ae13-0x0;var _0x533fd5=_0x5db8[_0x20ae13];return _0x533fd5;};'use strict';var multer=require(_0x85db('0x0'));var util=require(_0x85db('0x1'));var path=require(_0x85db('0x2'));var timeout=require('connect-timeout');var express=require(_0x85db('0x3'));var router=express[_0x85db('0x4')]();var fs_extra=require(_0x85db('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x85db('0x6'));var controller=require(_0x85db('0x7'));router[_0x85db('0x8')]('/',auth[_0x85db('0x9')](),controller['index']);router['get'](_0x85db('0xa'),auth[_0x85db('0x9')](),controller[_0x85db('0xb')]);router[_0x85db('0x8')]('/:id',auth[_0x85db('0x9')](),controller['show']);router[_0x85db('0xc')]('/',auth[_0x85db('0x9')](),controller[_0x85db('0xd')]);router[_0x85db('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x85db('0xf')](_0x85db('0x10'),auth['isAuthenticated'](),controller[_0x85db('0x11')]);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 d7a456a..78602eb 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 _0x9396=['called,connect,complete','sequelize','STRING','INTEGER','DATE'];(function(_0x27f059,_0x47ed57){var _0x8b684e=function(_0x27e440){while(--_0x27e440){_0x27f059['push'](_0x27f059['shift']());}};_0x8b684e(++_0x47ed57);}(_0x9396,0xc4));var _0x6939=function(_0x2bfd4f,_0x1bbf2c){_0x2bfd4f=_0x2bfd4f-0x0;var _0x341849=_0x9396[_0x2bfd4f];return _0x341849;};'use strict';var Sequelize=require(_0x6939('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x6939('0x1')]},'channel':{'type':Sequelize[_0x6939('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6939('0x1')]},'calleridname':{'type':Sequelize[_0x6939('0x1')]},'connectedlinenum':{'type':Sequelize[_0x6939('0x1')]},'connectedlinename':{'type':Sequelize[_0x6939('0x1')]},'language':{'type':Sequelize[_0x6939('0x1')]},'accountcode':{'type':Sequelize[_0x6939('0x1')]},'context':{'type':Sequelize[_0x6939('0x1')]},'exten':{'type':Sequelize[_0x6939('0x1')]},'priority':{'type':Sequelize[_0x6939('0x2')]},'uniqueid':{'type':Sequelize[_0x6939('0x1')]},'linkedid':{'type':Sequelize[_0x6939('0x1')]},'destchannel':{'type':Sequelize[_0x6939('0x1')]},'destchannelstate':{'type':Sequelize[_0x6939('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x6939('0x1')]},'destcalleridnum':{'type':Sequelize[_0x6939('0x1')]},'destcalleridname':{'type':Sequelize[_0x6939('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x6939('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x6939('0x1')]},'destcontext':{'type':Sequelize[_0x6939('0x1')]},'destexten':{'type':Sequelize[_0x6939('0x1')]},'destpriority':{'type':Sequelize[_0x6939('0x2')]},'destuniqueid':{'type':Sequelize[_0x6939('0x1')]},'destlinkedid':{'type':Sequelize[_0x6939('0x1')]},'dialstring':{'type':Sequelize[_0x6939('0x1')]},'dialstatus':{'type':Sequelize[_0x6939('0x1')]},'starttime':{'type':Sequelize[_0x6939('0x3')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x6939('0x3')]},'lastevent':{'type':Sequelize[_0x6939('0x1')],'comment':_0x6939('0x4')},'routeId':{'type':Sequelize[_0x6939('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x6939('0x2')]},'billableseconds':{'type':Sequelize[_0x6939('0x2')]}}; \ No newline at end of file +var _0x5ba4=['STRING','INTEGER','DATE','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5ba4,0x170));var _0x45ba=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x5ba4[_0x5e3b04];return _0x1fc44d;};'use strict';var Sequelize=require(_0x45ba('0x0'));module[_0x45ba('0x1')]={'privilege':{'type':Sequelize[_0x45ba('0x2')]},'channel':{'type':Sequelize[_0x45ba('0x2')]},'channelstate':{'type':Sequelize[_0x45ba('0x3')]},'channelstatedesc':{'type':Sequelize[_0x45ba('0x2')]},'calleridnum':{'type':Sequelize[_0x45ba('0x2')]},'calleridname':{'type':Sequelize[_0x45ba('0x2')]},'connectedlinenum':{'type':Sequelize[_0x45ba('0x2')]},'connectedlinename':{'type':Sequelize[_0x45ba('0x2')]},'language':{'type':Sequelize[_0x45ba('0x2')]},'accountcode':{'type':Sequelize[_0x45ba('0x2')]},'context':{'type':Sequelize[_0x45ba('0x2')]},'exten':{'type':Sequelize[_0x45ba('0x2')]},'priority':{'type':Sequelize[_0x45ba('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x45ba('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x45ba('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x45ba('0x2')]},'destcalleridnum':{'type':Sequelize[_0x45ba('0x2')]},'destcalleridname':{'type':Sequelize[_0x45ba('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x45ba('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x45ba('0x2')]},'destlanguage':{'type':Sequelize[_0x45ba('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x45ba('0x2')]},'destexten':{'type':Sequelize[_0x45ba('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x45ba('0x2')]},'destlinkedid':{'type':Sequelize[_0x45ba('0x2')]},'dialstring':{'type':Sequelize[_0x45ba('0x2')]},'dialstatus':{'type':Sequelize[_0x45ba('0x2')]},'starttime':{'type':Sequelize[_0x45ba('0x4')]},'answertime':{'type':Sequelize[_0x45ba('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x45ba('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x45ba('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x45ba('0x3')]},'billableseconds':{'type':Sequelize[_0x45ba('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 2554609..c448a03 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 _0x6e6c=['Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','VoiceDialReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','include','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','offset','set'];(function(_0x5a4b42,_0x2b9c18){var _0x5e81d6=function(_0x595077){while(--_0x595077){_0x5a4b42['push'](_0x5a4b42['shift']());}};_0x5e81d6(++_0x2b9c18);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0xc6e6('0x0'));var emlformat=require(_0xc6e6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc6e6('0x2'));var jsonpatch=require(_0xc6e6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc6e6('0x4'));var Mustache=require('mustache');var util=require(_0xc6e6('0x5'));var path=require('path');var sox=require(_0xc6e6('0x6'));var csv=require(_0xc6e6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc6e6('0x8'));var _=require(_0xc6e6('0x9'));var squel=require('squel');var crypto=require(_0xc6e6('0xa'));var jsforce=require(_0xc6e6('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc6e6('0x7'));var querystring=require('querystring');var Papa=require(_0xc6e6('0xc'));var Redis=require(_0xc6e6('0xd'));var authService=require(_0xc6e6('0xe'));var qs=require(_0xc6e6('0xf'));var as=require(_0xc6e6('0x10'));var hardwareService=require(_0xc6e6('0x11'));var logger=require(_0xc6e6('0x12'))(_0xc6e6('0x13'));var utils=require(_0xc6e6('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc6e6('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a30ce,_0x314d0f){_0x314d0f=_0x314d0f||0xcc;return function(_0x33aea0){if(_0x33aea0){return _0x3a30ce[_0xc6e6('0x16')](_0x314d0f);}return _0x3a30ce['status'](_0x314d0f)[_0xc6e6('0x17')]();};}function respondWithResult(_0x2bfe7d,_0x13be73){_0x13be73=_0x13be73||0xc8;return function(_0x1b6ca9){if(_0x1b6ca9){return _0x2bfe7d[_0xc6e6('0x18')](_0x13be73)['json'](_0x1b6ca9);}};}function respondWithFilteredResult(_0x413cf8,_0x178b34){return function(_0x569474){if(_0x569474){var _0x2f11b0=_0x569474['count'],_0x144039=_0x178b34['offset'],_0xedf127=_0x178b34[_0xc6e6('0x19')]+_0x178b34['limit'],_0x4c978d;if(_0xedf127>=_0x2f11b0){_0xedf127=_0x2f11b0;_0x4c978d=0xc8;}else{_0x4c978d=0xce;}_0x413cf8[_0xc6e6('0x18')](_0x4c978d);return _0x413cf8[_0xc6e6('0x1a')](_0xc6e6('0x1b'),_0x144039+'-'+_0xedf127+'/'+_0x2f11b0)[_0xc6e6('0x1c')](_0x569474);}return null;};}function patchUpdates(_0x19e1e4){return function(_0x3a0d83){try{jsonpatch[_0xc6e6('0x1d')](_0x3a0d83,_0x19e1e4,!![]);}catch(_0x2761c4){return BPromise[_0xc6e6('0x1e')](_0x2761c4);}return _0x3a0d83[_0xc6e6('0x1f')]();};}function saveUpdates(_0x4a36b6,_0x428401){return function(_0x4ad70e){if(_0x4ad70e){return _0x4ad70e[_0xc6e6('0x20')](_0x4a36b6)[_0xc6e6('0x21')](function(_0x2be6fc){return _0x2be6fc;});}return null;};}function removeEntity(_0x2f69f1,_0x4f1d68){return function(_0x35253d){if(_0x35253d){return _0x35253d[_0xc6e6('0x22')]()[_0xc6e6('0x21')](function(){_0x2f69f1[_0xc6e6('0x18')](0xcc)[_0xc6e6('0x17')]();});}};}function handleEntityNotFound(_0x4c35ae,_0x41fe96){return function(_0x51fe51){if(!_0x51fe51){_0x4c35ae[_0xc6e6('0x16')](0x194);}return _0x51fe51;};}function handleError(_0x1ec62a,_0x2e5e0e){_0x2e5e0e=_0x2e5e0e||0x1f4;return function(_0x64e1dc){logger['error'](_0x64e1dc[_0xc6e6('0x23')]);if(_0x64e1dc['name']){delete _0x64e1dc[_0xc6e6('0x24')];}_0x1ec62a['status'](_0x2e5e0e)[_0xc6e6('0x25')](_0x64e1dc);};}exports[_0xc6e6('0x26')]=function(_0x348888,_0x41e7c2){var _0x66a240={},_0x5e34f6={},_0x346480={'count':0x0,'rows':[]};var _0x1501bd=_[_0xc6e6('0x27')](db[_0xc6e6('0x28')]['rawAttributes'],function(_0x34ae96){return{'name':_0x34ae96['fieldName'],'type':_0x34ae96[_0xc6e6('0x29')][_0xc6e6('0x2a')]};});_0x5e34f6[_0xc6e6('0x2b')]=_[_0xc6e6('0x27')](_0x1501bd,_0xc6e6('0x24'));_0x5e34f6[_0xc6e6('0x2c')]=_[_0xc6e6('0x2d')](_0x348888[_0xc6e6('0x2c')]);_0x5e34f6[_0xc6e6('0x2e')]=_[_0xc6e6('0x2f')](_0x5e34f6[_0xc6e6('0x2b')],_0x5e34f6[_0xc6e6('0x2c')]);_0x66a240[_0xc6e6('0x30')]=_[_0xc6e6('0x2f')](_0x5e34f6[_0xc6e6('0x2b')],qs[_0xc6e6('0x31')](_0x348888[_0xc6e6('0x2c')]['fields']));_0x66a240[_0xc6e6('0x30')]=_0x66a240[_0xc6e6('0x30')]['length']?_0x66a240['attributes']:_0x5e34f6[_0xc6e6('0x2b')];if(!_0x348888[_0xc6e6('0x2c')][_0xc6e6('0x32')](_0xc6e6('0x33'))){_0x66a240[_0xc6e6('0x34')]=qs[_0xc6e6('0x34')](_0x348888['query'][_0xc6e6('0x34')]);_0x66a240[_0xc6e6('0x19')]=qs[_0xc6e6('0x19')](_0x348888['query']['offset']);}_0x66a240[_0xc6e6('0x35')]=qs[_0xc6e6('0x36')](_0x348888[_0xc6e6('0x2c')][_0xc6e6('0x36')]);_0x66a240['where']=qs['filters'](_[_0xc6e6('0x37')](_0x348888['query'],_0x5e34f6[_0xc6e6('0x2e')]),_0x1501bd);if(_0x348888['query'][_0xc6e6('0x38')]){_0x66a240[_0xc6e6('0x39')]=_[_0xc6e6('0x3a')](_0x66a240[_0xc6e6('0x39')],{'$or':_['map'](_0x1501bd,function(_0x59ec4c){if(_0x59ec4c[_0xc6e6('0x29')]!==_0xc6e6('0x3b')){var _0x15d535={};_0x15d535[_0x59ec4c[_0xc6e6('0x24')]]={'$like':'%'+_0x348888['query']['filter']+'%'};return _0x15d535;}})});}_0x66a240=_[_0xc6e6('0x3a')]({},_0x66a240,_0x348888[_0xc6e6('0x3c')]);var _0x3a9104={'where':_0x66a240[_0xc6e6('0x39')]};return db['VoiceDialReport'][_0xc6e6('0x3d')](_0x3a9104)[_0xc6e6('0x21')](function(_0x5ddab4){_0x346480['count']=_0x5ddab4;if(_0x348888[_0xc6e6('0x2c')]['includeAll']){_0x66a240[_0xc6e6('0x3e')]=[{'all':!![]}];}return db[_0xc6e6('0x28')]['findAll'](_0x66a240);})[_0xc6e6('0x21')](function(_0x50c96d){_0x346480[_0xc6e6('0x3f')]=_0x50c96d;return _0x346480;})['then'](respondWithFilteredResult(_0x41e7c2,_0x66a240))[_0xc6e6('0x40')](handleError(_0x41e7c2,null));};exports[_0xc6e6('0x41')]=function(_0x247076,_0x2f7af9){var _0x101aa8={'raw':!![],'where':{'id':_0x247076[_0xc6e6('0x42')]['id']}},_0xcf70c8={};_0xcf70c8[_0xc6e6('0x2b')]=_[_0xc6e6('0x2d')](db['VoiceDialReport'][_0xc6e6('0x43')]);_0xcf70c8[_0xc6e6('0x2c')]=_[_0xc6e6('0x2d')](_0x247076[_0xc6e6('0x2c')]);_0xcf70c8['filters']=_[_0xc6e6('0x2f')](_0xcf70c8[_0xc6e6('0x2b')],_0xcf70c8[_0xc6e6('0x2c')]);_0x101aa8[_0xc6e6('0x30')]=_['intersection'](_0xcf70c8[_0xc6e6('0x2b')],qs[_0xc6e6('0x31')](_0x247076[_0xc6e6('0x2c')][_0xc6e6('0x31')]));_0x101aa8[_0xc6e6('0x30')]=_0x101aa8['attributes'][_0xc6e6('0x44')]?_0x101aa8['attributes']:_0xcf70c8[_0xc6e6('0x2b')];if(_0x247076['query'][_0xc6e6('0x45')]){_0x101aa8[_0xc6e6('0x3e')]=[{'all':!![]}];}_0x101aa8=_[_0xc6e6('0x3a')]({},_0x101aa8,_0x247076[_0xc6e6('0x3c')]);return db[_0xc6e6('0x28')][_0xc6e6('0x46')](_0x101aa8)[_0xc6e6('0x21')](handleEntityNotFound(_0x2f7af9,null))[_0xc6e6('0x21')](respondWithResult(_0x2f7af9,null))['catch'](handleError(_0x2f7af9,null));};exports[_0xc6e6('0x47')]=function(_0x23d741,_0x2fe3d4){return db['VoiceDialReport'][_0xc6e6('0x47')](_0x23d741[_0xc6e6('0x48')],{})[_0xc6e6('0x21')](respondWithResult(_0x2fe3d4,0xc9))[_0xc6e6('0x40')](handleError(_0x2fe3d4,null));};exports[_0xc6e6('0x20')]=function(_0xefd557,_0x10f407){if(_0xefd557[_0xc6e6('0x48')]['id']){delete _0xefd557[_0xc6e6('0x48')]['id'];}return db[_0xc6e6('0x28')][_0xc6e6('0x46')]({'where':{'id':_0xefd557[_0xc6e6('0x42')]['id']}})[_0xc6e6('0x21')](handleEntityNotFound(_0x10f407,null))[_0xc6e6('0x21')](saveUpdates(_0xefd557['body'],null))[_0xc6e6('0x21')](respondWithResult(_0x10f407,null))['catch'](handleError(_0x10f407,null));};exports[_0xc6e6('0x22')]=function(_0x45f4ee,_0x5a7330){return db['VoiceDialReport']['find']({'where':{'id':_0x45f4ee['params']['id']}})['then'](handleEntityNotFound(_0x5a7330,null))[_0xc6e6('0x21')](removeEntity(_0x5a7330,null))[_0xc6e6('0x40')](handleError(_0x5a7330,null));};exports[_0xc6e6('0x49')]=function(_0x310195,_0x3df97f){return db['VoiceDialReport']['describe']()[_0xc6e6('0x21')](respondWithResult(_0x3df97f,null))[_0xc6e6('0x40')](handleError(_0x3df97f,null));}; \ No newline at end of file +var _0xb903=['where','pick','merge','VIRTUAL','filter','options','VoiceDialReport','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','json','count','offset','limit','status','set','apply','reject','save','update','then','destroy','end','error','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort'];(function(_0x4b7487,_0xecd238){var _0x429988=function(_0x3491ec){while(--_0x3491ec){_0x4b7487['push'](_0x4b7487['shift']());}};_0x429988(++_0xecd238);}(_0xb903,0x185));var _0x3b90=function(_0x38e135,_0x14499c){_0x38e135=_0x38e135-0x0;var _0x1736e1=_0xb903[_0x38e135];return _0x1736e1;};'use strict';var pdf=require(_0x3b90('0x0'));var emlformat=require(_0x3b90('0x1'));var rimraf=require(_0x3b90('0x2'));var zipdir=require(_0x3b90('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3b90('0x4'));var moment=require(_0x3b90('0x5'));var BPromise=require(_0x3b90('0x6'));var Mustache=require(_0x3b90('0x7'));var util=require(_0x3b90('0x8'));var path=require(_0x3b90('0x9'));var sox=require(_0x3b90('0xa'));var csv=require('to-csv');var ejs=require(_0x3b90('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3b90('0xc'));var crypto=require(_0x3b90('0xd'));var jsforce=require(_0x3b90('0xe'));var deskjs=require(_0x3b90('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3b90('0x10'));var hardwareService=require(_0x3b90('0x11'));var logger=require('../../config/logger')(_0x3b90('0x12'));var utils=require(_0x3b90('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3b90('0x14'));var db=require(_0x3b90('0x15'))['db'];function respondWithStatusCode(_0x43c08c,_0x4badcb){_0x4badcb=_0x4badcb||0xcc;return function(_0x5447df){if(_0x5447df){return _0x43c08c[_0x3b90('0x16')](_0x4badcb);}return _0x43c08c['status'](_0x4badcb)['end']();};}function respondWithResult(_0x3a0a55,_0x2c72fb){_0x2c72fb=_0x2c72fb||0xc8;return function(_0x4824f9){if(_0x4824f9){return _0x3a0a55['status'](_0x2c72fb)[_0x3b90('0x17')](_0x4824f9);}};}function respondWithFilteredResult(_0x1b6349,_0x381a9e){return function(_0x1af265){if(_0x1af265){var _0x1efe01=_0x1af265[_0x3b90('0x18')],_0x529421=_0x381a9e['offset'],_0x494970=_0x381a9e[_0x3b90('0x19')]+_0x381a9e[_0x3b90('0x1a')],_0xd83280;if(_0x494970>=_0x1efe01){_0x494970=_0x1efe01;_0xd83280=0xc8;}else{_0xd83280=0xce;}_0x1b6349[_0x3b90('0x1b')](_0xd83280);return _0x1b6349[_0x3b90('0x1c')]('Content-Range',_0x529421+'-'+_0x494970+'/'+_0x1efe01)[_0x3b90('0x17')](_0x1af265);}return null;};}function patchUpdates(_0x5d140f){return function(_0xd8d873){try{jsonpatch[_0x3b90('0x1d')](_0xd8d873,_0x5d140f,!![]);}catch(_0x535894){return BPromise[_0x3b90('0x1e')](_0x535894);}return _0xd8d873[_0x3b90('0x1f')]();};}function saveUpdates(_0x3642c0,_0x3ce411){return function(_0xc74d57){if(_0xc74d57){return _0xc74d57[_0x3b90('0x20')](_0x3642c0)[_0x3b90('0x21')](function(_0x2f4270){return _0x2f4270;});}return null;};}function removeEntity(_0xa98414,_0x3e5bb8){return function(_0x4e2175){if(_0x4e2175){return _0x4e2175[_0x3b90('0x22')]()[_0x3b90('0x21')](function(){_0xa98414[_0x3b90('0x1b')](0xcc)[_0x3b90('0x23')]();});}};}function handleEntityNotFound(_0x1227ed,_0x93b8e7){return function(_0x58fa12){if(!_0x58fa12){_0x1227ed['sendStatus'](0x194);}return _0x58fa12;};}function handleError(_0x40955a,_0x29d472){_0x29d472=_0x29d472||0x1f4;return function(_0x103324){logger[_0x3b90('0x24')](_0x103324['stack']);if(_0x103324[_0x3b90('0x25')]){delete _0x103324[_0x3b90('0x25')];}_0x40955a[_0x3b90('0x1b')](_0x29d472)['send'](_0x103324);};}exports[_0x3b90('0x26')]=function(_0x138d79,_0x17ec7f){var _0x33c07a={},_0x153d7c={},_0x7adf75={'count':0x0,'rows':[]};var _0x4b4d33=_[_0x3b90('0x27')](db['VoiceDialReport'][_0x3b90('0x28')],function(_0x9891e4){return{'name':_0x9891e4[_0x3b90('0x29')],'type':_0x9891e4[_0x3b90('0x2a')][_0x3b90('0x2b')]};});_0x153d7c[_0x3b90('0x2c')]=_[_0x3b90('0x27')](_0x4b4d33,_0x3b90('0x25'));_0x153d7c['query']=_['keys'](_0x138d79[_0x3b90('0x2d')]);_0x153d7c[_0x3b90('0x2e')]=_[_0x3b90('0x2f')](_0x153d7c[_0x3b90('0x2c')],_0x153d7c['query']);_0x33c07a['attributes']=_[_0x3b90('0x2f')](_0x153d7c[_0x3b90('0x2c')],qs[_0x3b90('0x30')](_0x138d79['query'][_0x3b90('0x30')]));_0x33c07a['attributes']=_0x33c07a['attributes'][_0x3b90('0x31')]?_0x33c07a[_0x3b90('0x32')]:_0x153d7c['model'];if(!_0x138d79[_0x3b90('0x2d')][_0x3b90('0x33')](_0x3b90('0x34'))){_0x33c07a['limit']=qs['limit'](_0x138d79[_0x3b90('0x2d')][_0x3b90('0x1a')]);_0x33c07a[_0x3b90('0x19')]=qs[_0x3b90('0x19')](_0x138d79['query']['offset']);}_0x33c07a[_0x3b90('0x35')]=qs[_0x3b90('0x36')](_0x138d79['query']['sort']);_0x33c07a[_0x3b90('0x37')]=qs[_0x3b90('0x2e')](_[_0x3b90('0x38')](_0x138d79[_0x3b90('0x2d')],_0x153d7c['filters']),_0x4b4d33);if(_0x138d79[_0x3b90('0x2d')]['filter']){_0x33c07a[_0x3b90('0x37')]=_[_0x3b90('0x39')](_0x33c07a[_0x3b90('0x37')],{'$or':_[_0x3b90('0x27')](_0x4b4d33,function(_0x2cbae8){if(_0x2cbae8[_0x3b90('0x2a')]!==_0x3b90('0x3a')){var _0x534bea={};_0x534bea[_0x2cbae8[_0x3b90('0x25')]]={'$like':'%'+_0x138d79[_0x3b90('0x2d')][_0x3b90('0x3b')]+'%'};return _0x534bea;}})});}_0x33c07a=_[_0x3b90('0x39')]({},_0x33c07a,_0x138d79[_0x3b90('0x3c')]);var _0x390952={'where':_0x33c07a[_0x3b90('0x37')]};return db[_0x3b90('0x3d')][_0x3b90('0x18')](_0x390952)['then'](function(_0x369d0d){_0x7adf75[_0x3b90('0x18')]=_0x369d0d;if(_0x138d79[_0x3b90('0x2d')][_0x3b90('0x3e')]){_0x33c07a[_0x3b90('0x3f')]=[{'all':!![]}];}return db[_0x3b90('0x3d')][_0x3b90('0x40')](_0x33c07a);})[_0x3b90('0x21')](function(_0x30ff62){_0x7adf75[_0x3b90('0x41')]=_0x30ff62;return _0x7adf75;})[_0x3b90('0x21')](respondWithFilteredResult(_0x17ec7f,_0x33c07a))[_0x3b90('0x42')](handleError(_0x17ec7f,null));};exports[_0x3b90('0x43')]=function(_0x11285e,_0x3f3e6b){var _0x3d2680={'raw':!![],'where':{'id':_0x11285e[_0x3b90('0x44')]['id']}},_0x3a27cf={};_0x3a27cf[_0x3b90('0x2c')]=_[_0x3b90('0x45')](db[_0x3b90('0x3d')]['rawAttributes']);_0x3a27cf[_0x3b90('0x2d')]=_[_0x3b90('0x45')](_0x11285e[_0x3b90('0x2d')]);_0x3a27cf[_0x3b90('0x2e')]=_['intersection'](_0x3a27cf[_0x3b90('0x2c')],_0x3a27cf['query']);_0x3d2680['attributes']=_[_0x3b90('0x2f')](_0x3a27cf[_0x3b90('0x2c')],qs['fields'](_0x11285e[_0x3b90('0x2d')][_0x3b90('0x30')]));_0x3d2680[_0x3b90('0x32')]=_0x3d2680[_0x3b90('0x32')][_0x3b90('0x31')]?_0x3d2680[_0x3b90('0x32')]:_0x3a27cf[_0x3b90('0x2c')];if(_0x11285e[_0x3b90('0x2d')][_0x3b90('0x3e')]){_0x3d2680['include']=[{'all':!![]}];}_0x3d2680=_[_0x3b90('0x39')]({},_0x3d2680,_0x11285e[_0x3b90('0x3c')]);return db['VoiceDialReport'][_0x3b90('0x46')](_0x3d2680)[_0x3b90('0x21')](handleEntityNotFound(_0x3f3e6b,null))[_0x3b90('0x21')](respondWithResult(_0x3f3e6b,null))[_0x3b90('0x42')](handleError(_0x3f3e6b,null));};exports[_0x3b90('0x47')]=function(_0x4908ea,_0x5a0d4e){return db[_0x3b90('0x3d')]['create'](_0x4908ea[_0x3b90('0x48')],{})[_0x3b90('0x21')](respondWithResult(_0x5a0d4e,0xc9))[_0x3b90('0x42')](handleError(_0x5a0d4e,null));};exports[_0x3b90('0x20')]=function(_0x177234,_0x4b1634){if(_0x177234['body']['id']){delete _0x177234[_0x3b90('0x48')]['id'];}return db[_0x3b90('0x3d')][_0x3b90('0x46')]({'where':{'id':_0x177234['params']['id']}})[_0x3b90('0x21')](handleEntityNotFound(_0x4b1634,null))[_0x3b90('0x21')](saveUpdates(_0x177234[_0x3b90('0x48')],null))[_0x3b90('0x21')](respondWithResult(_0x4b1634,null))[_0x3b90('0x42')](handleError(_0x4b1634,null));};exports[_0x3b90('0x22')]=function(_0x44b01b,_0x13b364){return db[_0x3b90('0x3d')]['find']({'where':{'id':_0x44b01b[_0x3b90('0x44')]['id']}})[_0x3b90('0x21')](handleEntityNotFound(_0x13b364,null))[_0x3b90('0x21')](removeEntity(_0x13b364,null))['catch'](handleError(_0x13b364,null));};exports[_0x3b90('0x49')]=function(_0x4e9e75,_0x288fbb){return db[_0x3b90('0x3d')][_0x3b90('0x49')]()['then'](respondWithResult(_0x288fbb,null))[_0x3b90('0x42')](handleError(_0x288fbb,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index c77d996..9b8d3d1 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 _0x2338=['define','VoiceDialReport','report_dial','uniqueid','../../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);}(_0x2338,0xf6));var _0x8233=function(_0x5125da,_0x597a6b){_0x5125da=_0x5125da-0x0;var _0x273a7e=_0x2338[_0x5125da];return _0x273a7e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8233('0x0'))(_0x8233('0x1'));var moment=require(_0x8233('0x2'));var BPromise=require(_0x8233('0x3'));var rp=require(_0x8233('0x4'));var fs=require('fs');var path=require(_0x8233('0x5'));var rimraf=require('rimraf');var config=require(_0x8233('0x6'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x4b129b,_0xeb5c55){return _0x4b129b[_0x8233('0x7')](_0x8233('0x8'),attributes,{'tableName':_0x8233('0x9'),'paranoid':![],'indexes':[{'fields':[_0x8233('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x56b1=['path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4f4f75,_0x474840){var _0x35e7c5=function(_0x50db75){while(--_0x50db75){_0x4f4f75['push'](_0x4f4f75['shift']());}};_0x35e7c5(++_0x474840);}(_0x56b1,0x1e9));var _0x156b=function(_0xb693ae,_0x56c9fd){_0xb693ae=_0xb693ae-0x0;var _0x4fc992=_0x56b1[_0xb693ae];return _0x4fc992;};'use strict';var _=require(_0x156b('0x0'));var util=require(_0x156b('0x1'));var logger=require(_0x156b('0x2'))(_0x156b('0x3'));var moment=require(_0x156b('0x4'));var BPromise=require(_0x156b('0x5'));var rp=require(_0x156b('0x6'));var fs=require('fs');var path=require(_0x156b('0x7'));var rimraf=require(_0x156b('0x8'));var config=require(_0x156b('0x9'));var attributes=require(_0x156b('0xa'));module[_0x156b('0xb')]=function(_0x512e15,_0x30bfe0){return _0x512e15[_0x156b('0xc')](_0x156b('0xd'),attributes,{'tableName':_0x156b('0xe'),'paranoid':![],'indexes':[{'fields':[_0x156b('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 0622ee6..2fe3de3 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 _0x418f=['jayson/promise','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','UpdateVoiceDialReport','attributes','limit','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x418f,0x1b8));var _0xf418=function(_0x5c9d73,_0x5563dc){_0x5c9d73=_0x5c9d73-0x0;var _0x1f6e88=_0x418f[_0x5c9d73];return _0x1f6e88;};'use strict';var _=require(_0xf418('0x0'));var util=require(_0xf418('0x1'));var moment=require(_0xf418('0x2'));var BPromise=require('bluebird');var rs=require(_0xf418('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf418('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf418('0x5'))(_0xf418('0x6'));var config=require(_0xf418('0x7'));var jayson=require(_0xf418('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2096ac,_0xdd532d,_0x413f26){return new BPromise(function(_0x21bab2,_0x31672){return client[_0xf418('0x9')](_0x2096ac,_0x413f26)[_0xf418('0xa')](function(_0x32c60d){logger[_0xf418('0xb')](_0xf418('0xc'),_0xdd532d,_0xf418('0xd'));logger[_0xf418('0xe')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0xdd532d,_0xf418('0xd'),JSON[_0xf418('0xf')](_0x32c60d));if(_0x32c60d[_0xf418('0x10')]){if(_0x32c60d[_0xf418('0x10')]['code']===0x1f4){logger[_0xf418('0x10')](_0xf418('0xc'),_0xdd532d,_0x32c60d[_0xf418('0x10')]['message']);return _0x31672(_0x32c60d['error']['message']);}logger['error'](_0xf418('0xc'),_0xdd532d,_0x32c60d['error'][_0xf418('0x11')]);return _0x21bab2(_0x32c60d[_0xf418('0x10')][_0xf418('0x11')]);}else{logger[_0xf418('0xb')](_0xf418('0xc'),_0xdd532d,_0xf418('0xd'));_0x21bab2(_0x32c60d[_0xf418('0x12')][_0xf418('0x11')]);}})[_0xf418('0x13')](function(_0x478326){logger[_0xf418('0x10')](_0xf418('0xc'),_0xdd532d,_0x478326);_0x31672(_0x478326);});});}exports[_0xf418('0x14')]=function(_0x141e77){var _0x3dbeb7=this;return new Promise(function(_0x5be704,_0x26ccee){return db[_0xf418('0x15')][_0xf418('0x16')](_0x141e77[_0xf418('0x17')],{'raw':_0x141e77[_0xf418('0x18')]?_0x141e77[_0xf418('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xf418('0xa')](function(_0x40a302){logger[_0xf418('0xb')](_0xf418('0x14'),_0x141e77);logger[_0xf418('0xe')](_0xf418('0x14'),_0x141e77,JSON[_0xf418('0xf')](_0x40a302));_0x5be704(_0x40a302);})['catch'](function(_0x1a4242){logger['error']('CreateVoiceDialReport',_0x1a4242[_0xf418('0x11')],_0x141e77);_0x26ccee(_0x3dbeb7[_0xf418('0x10')](0x1f4,_0x1a4242['message']));});});};exports[_0xf418('0x19')]=function(_0x4b6fe6){var _0x2a4747=this;return new Promise(function(_0x3cff65,_0x12ebe6){return db[_0xf418('0x15')]['update'](_0x4b6fe6['body'],{'raw':_0x4b6fe6[_0xf418('0x18')]?_0x4b6fe6[_0xf418('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b6fe6[_0xf418('0x18')]?_0x4b6fe6[_0xf418('0x18')]['where']||null:null,'attributes':_0x4b6fe6[_0xf418('0x18')]?_0x4b6fe6['options'][_0xf418('0x1a')]||null:null,'limit':_0x4b6fe6[_0xf418('0x18')]?_0x4b6fe6['options'][_0xf418('0x1b')]||null:null})[_0xf418('0xa')](function(_0x3d749e){logger[_0xf418('0xb')]('UpdateVoiceDialReport',_0x4b6fe6);logger['debug'](_0xf418('0x19'),_0x4b6fe6,JSON['stringify'](_0x3d749e));_0x3cff65(_0x3d749e);})['catch'](function(_0x3adc7d){logger['error'](_0xf418('0x19'),_0x3adc7d[_0xf418('0x11')],_0x4b6fe6);_0x12ebe6(_0x2a4747[_0xf418('0x10')](0x1f4,_0x3adc7d[_0xf418('0x11')]));});});}; \ No newline at end of file +var _0x70a1=['VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','update','where','attributes','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug'];(function(_0x1b8982,_0x3ba392){var _0x575d69=function(_0x25db3d){while(--_0x25db3d){_0x1b8982['push'](_0x1b8982['shift']());}};_0x575d69(++_0x3ba392);}(_0x70a1,0x13a));var _0x170a=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x70a1[_0x1573ea];return _0x51c0e2;};'use strict';var _=require(_0x170a('0x0'));var util=require(_0x170a('0x1'));var moment=require('moment');var BPromise=require(_0x170a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x170a('0x3'));var db=require(_0x170a('0x4'))['db'];var utils=require(_0x170a('0x5'));var logger=require(_0x170a('0x6'))(_0x170a('0x7'));var config=require(_0x170a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x170a('0x9')][_0x170a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27b634,_0x313a54,_0x498ad6){return new BPromise(function(_0x357204,_0x1e679c){return client[_0x170a('0xb')](_0x27b634,_0x498ad6)[_0x170a('0xc')](function(_0x292520){logger[_0x170a('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x313a54,_0x170a('0xe'));logger[_0x170a('0xf')](_0x170a('0x10'),_0x313a54,_0x170a('0xe'),JSON[_0x170a('0x11')](_0x292520));if(_0x292520[_0x170a('0x12')]){if(_0x292520[_0x170a('0x12')][_0x170a('0x13')]===0x1f4){logger[_0x170a('0x12')](_0x170a('0x14'),_0x313a54,_0x292520['error'][_0x170a('0x15')]);return _0x1e679c(_0x292520[_0x170a('0x12')][_0x170a('0x15')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x313a54,_0x292520[_0x170a('0x12')][_0x170a('0x15')]);return _0x357204(_0x292520['error'][_0x170a('0x15')]);}else{logger[_0x170a('0xd')](_0x170a('0x14'),_0x313a54,_0x170a('0xe'));_0x357204(_0x292520['result'][_0x170a('0x15')]);}})[_0x170a('0x16')](function(_0x486089){logger[_0x170a('0x12')](_0x170a('0x14'),_0x313a54,_0x486089);_0x1e679c(_0x486089);});});}exports[_0x170a('0x17')]=function(_0x477f98){var _0x576be2=this;return new Promise(function(_0xa09dbc,_0x36db2e){return db[_0x170a('0x18')][_0x170a('0x19')](_0x477f98[_0x170a('0x1a')],{'raw':_0x477f98['options']?_0x477f98[_0x170a('0x1b')][_0x170a('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0xb5b97e){logger[_0x170a('0xd')](_0x170a('0x17'),_0x477f98);logger[_0x170a('0xf')](_0x170a('0x17'),_0x477f98,JSON[_0x170a('0x11')](_0xb5b97e));_0xa09dbc(_0xb5b97e);})['catch'](function(_0x2a35ef){logger[_0x170a('0x12')](_0x170a('0x17'),_0x2a35ef[_0x170a('0x15')],_0x477f98);_0x36db2e(_0x576be2[_0x170a('0x12')](0x1f4,_0x2a35ef['message']));});});};exports[_0x170a('0x1d')]=function(_0x4560da){var _0x28aade=this;return new Promise(function(_0x4325b4,_0x1b7c1e){return db['VoiceDialReport'][_0x170a('0x1e')](_0x4560da['body'],{'raw':_0x4560da['options']?_0x4560da[_0x170a('0x1b')][_0x170a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4560da[_0x170a('0x1b')]?_0x4560da[_0x170a('0x1b')][_0x170a('0x1f')]||null:null,'attributes':_0x4560da[_0x170a('0x1b')]?_0x4560da[_0x170a('0x1b')][_0x170a('0x20')]||null:null,'limit':_0x4560da['options']?_0x4560da[_0x170a('0x1b')]['limit']||null:null})[_0x170a('0xc')](function(_0x3ae042){logger['info']('UpdateVoiceDialReport',_0x4560da);logger[_0x170a('0xf')](_0x170a('0x1d'),_0x4560da,JSON[_0x170a('0x11')](_0x3ae042));_0x4325b4(_0x3ae042);})[_0x170a('0x16')](function(_0x2e6cd5){logger[_0x170a('0x12')](_0x170a('0x1d'),_0x2e6cd5[_0x170a('0x15')],_0x4560da);_0x1b7c1e(_0x28aade['error'](0x1f4,_0x2e6cd5['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index ca0aed9..f8cb863 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 _0xba61=['./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','/:id/applications','addApplications','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x1d1d02,_0x9ee6c){var _0x94915b=function(_0x84375f){while(--_0x84375f){_0x1d1d02['push'](_0x1d1d02['shift']());}};_0x94915b(++_0x9ee6c);}(_0xba61,0xcb));var _0x1ba6=function(_0x126888,_0x3da330){_0x126888=_0x126888-0x0;var _0x55323b=_0xba61[_0x126888];return _0x55323b;};'use strict';var multer=require(_0x1ba6('0x0'));var util=require(_0x1ba6('0x1'));var path=require(_0x1ba6('0x2'));var timeout=require(_0x1ba6('0x3'));var express=require(_0x1ba6('0x4'));var router=express['Router']();var fs_extra=require(_0x1ba6('0x5'));var auth=require(_0x1ba6('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1ba6('0x7'));router[_0x1ba6('0x8')]('/',auth[_0x1ba6('0x9')](),controller[_0x1ba6('0xa')]);router['get'](_0x1ba6('0xb'),auth[_0x1ba6('0x9')](),controller[_0x1ba6('0xc')]);router[_0x1ba6('0xd')]('/',auth[_0x1ba6('0x9')](),controller['create']);router['post'](_0x1ba6('0xe'),auth[_0x1ba6('0x9')](),controller[_0x1ba6('0xf')]);router[_0x1ba6('0x10')](_0x1ba6('0xb'),auth['isAuthenticated'](),controller[_0x1ba6('0x11')]);router[_0x1ba6('0x12')](_0x1ba6('0xb'),auth[_0x1ba6('0x9')](),controller[_0x1ba6('0x13')]);module[_0x1ba6('0x14')]=router; \ No newline at end of file +var _0xee19=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','put','delete','destroy','exports','path'];(function(_0x4958a0,_0x4a81d4){var _0x1ce89e=function(_0x8f5f00){while(--_0x8f5f00){_0x4958a0['push'](_0x4958a0['shift']());}};_0x1ce89e(++_0x4a81d4);}(_0xee19,0x1da));var _0x9ee1=function(_0x5e9a0e,_0x192bf9){_0x5e9a0e=_0x5e9a0e-0x0;var _0x38fa94=_0xee19[_0x5e9a0e];return _0x38fa94;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9ee1('0x0'));var timeout=require(_0x9ee1('0x1'));var express=require('express');var router=express[_0x9ee1('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x9ee1('0x3'));var interaction=require(_0x9ee1('0x4'));var config=require('../../config/environment');var controller=require(_0x9ee1('0x5'));router[_0x9ee1('0x6')]('/',auth[_0x9ee1('0x7')](),controller[_0x9ee1('0x8')]);router[_0x9ee1('0x6')](_0x9ee1('0x9'),auth[_0x9ee1('0x7')](),controller[_0x9ee1('0xa')]);router[_0x9ee1('0xb')]('/',auth['isAuthenticated'](),controller[_0x9ee1('0xc')]);router['post'](_0x9ee1('0xd'),auth[_0x9ee1('0x7')](),controller[_0x9ee1('0xe')]);router[_0x9ee1('0xf')]('/:id',auth[_0x9ee1('0x7')](),controller['update']);router[_0x9ee1('0x10')](_0x9ee1('0x9'),auth['isAuthenticated'](),controller[_0x9ee1('0x11')]);module[_0x9ee1('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 a41e54a..14a9a87 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 _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x23b1fd,_0x347756){var _0x2bac5d=function(_0x1a325e){while(--_0x1a325e){_0x23b1fd['push'](_0x23b1fd['shift']());}};_0x2bac5d(++_0x347756);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file +var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x146958,_0x572fc9){var _0x253f9d=function(_0x21390d){while(--_0x21390d){_0x146958['push'](_0x146958['shift']());}};_0x253f9d(++_0x572fc9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index f2c4134..35c9c5d 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 _0x1261=['userProfileId','context','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','transaction','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','json','count','offset','limit','Content-Range','apply','reject','update','destroy','then','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','filter','ignore','value','type','find','UserProfileResource','end','sendStatus','error','stack','send','index','map','rawAttributes','fieldName','name','keys','query','filters','attributes','intersection','model','length','hasOwnProperty','nolimit','order','sort','pick','VIRTUAL','merge','options','VoiceExtension','includeAll','findAll','catch','params','fields','create','startsWith','exten','body','concat','user','role','inbound','internal','UserProfileSection'];(function(_0x5be901,_0x3d0145){var _0x194714=function(_0x4e8d4d){while(--_0x4e8d4d){_0x5be901['push'](_0x5be901['shift']());}};_0x194714(++_0x3d0145);}(_0x1261,0x144));var _0x1126=function(_0x388914,_0x3c63f9){_0x388914=_0x388914-0x0;var _0x1f9111=_0x1261[_0x388914];return _0x1f9111;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1126('0x0'));var rimraf=require(_0x1126('0x1'));var zipdir=require(_0x1126('0x2'));var jsonpatch=require(_0x1126('0x3'));var rp=require(_0x1126('0x4'));var moment=require(_0x1126('0x5'));var BPromise=require(_0x1126('0x6'));var Mustache=require(_0x1126('0x7'));var util=require(_0x1126('0x8'));var path=require(_0x1126('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1126('0xa'));var fs=require('fs');var fs_extra=require(_0x1126('0xb'));var _=require('lodash');var squel=require(_0x1126('0xc'));var crypto=require(_0x1126('0xd'));var jsforce=require(_0x1126('0xe'));var deskjs=require(_0x1126('0xf'));var toCsv=require(_0x1126('0x10'));var querystring=require('querystring');var Papa=require(_0x1126('0x11'));var Redis=require(_0x1126('0x12'));var authService=require(_0x1126('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1126('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1126('0x15'));var utils=require('../../config/utils');var config=require(_0x1126('0x16'));var licenseUtil=require(_0x1126('0x17'));var db=require(_0x1126('0x18'))['db'];config[_0x1126('0x19')]=_[_0x1126('0x1a')](config[_0x1126('0x19')],{'host':_0x1126('0x1b'),'port':0x18eb});var socket=require(_0x1126('0x1c'))(new Redis(config[_0x1126('0x19')]));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x1af673,_0x154e20){_0x154e20=_0x154e20||0xcc;return function(_0x279455){if(_0x279455){return _0x1af673['sendStatus'](_0x154e20);}return _0x1af673[_0x1126('0x1d')](_0x154e20)['end']();};}function respondWithResult(_0x35fe9f,_0x42f379){_0x42f379=_0x42f379||0xc8;return function(_0x257b5f){if(_0x257b5f){return _0x35fe9f['status'](_0x42f379)[_0x1126('0x1e')](_0x257b5f);}};}function respondWithFilteredResult(_0x1695f6,_0x4a7b49){return function(_0x4d2b38){if(_0x4d2b38){var _0x22ae0b=_0x4d2b38[_0x1126('0x1f')],_0x2b2487=_0x4a7b49['offset'],_0x58d11a=_0x4a7b49[_0x1126('0x20')]+_0x4a7b49[_0x1126('0x21')],_0x548359;if(_0x58d11a>=_0x22ae0b){_0x58d11a=_0x22ae0b;_0x548359=0xc8;}else{_0x548359=0xce;}_0x1695f6[_0x1126('0x1d')](_0x548359);return _0x1695f6['set'](_0x1126('0x22'),_0x2b2487+'-'+_0x58d11a+'/'+_0x22ae0b)['json'](_0x4d2b38);}return null;};}function patchUpdates(_0x56efeb){return function(_0x30f6b3){try{jsonpatch[_0x1126('0x23')](_0x30f6b3,_0x56efeb,!![]);}catch(_0x25b24b){return BPromise[_0x1126('0x24')](_0x25b24b);}return _0x30f6b3['save']();};}function saveUpdates(_0x29ab60,_0x477e6a){return function(_0x48a08d){if(_0x48a08d){return _0x48a08d[_0x1126('0x25')](_0x29ab60)['then'](function(_0x529dd9){return _0x529dd9;});}return null;};}function removeEntity(_0x4b57ab,_0x2199d9){return function(_0x15bcc3){if(_0x15bcc3){return _0x15bcc3[_0x1126('0x26')]()[_0x1126('0x27')](function(){var _0x566c09=_0x15bcc3[_0x1126('0x28')]({'plain':!![]});var _0xea0971=[{'name':_0x1126('0x29'),'value':'inbound','ignore':![]},{'name':_0x1126('0x2a'),'value':_0x1126('0x2b'),'ignore':![]},{'name':_0x1126('0x2c'),'value':'internal','ignore':![]}];var _0x541bc9=_(_0xea0971)[_0x1126('0x2d')](_0x1126('0x2e'))['map'](_0x1126('0x2f'))[_0x1126('0x2f')]();if(_['includes'](_0x541bc9,_0x566c09[_0x1126('0x30')])){return;}var _0x4bf807=_[_0x1126('0x31')](_0xea0971,['value',_0x566c09[_0x1126('0x30')]])['name'];return db[_0x1126('0x32')]['destroy']({'where':{'type':_0x4bf807,'resourceId':_0x566c09['id']}})['then'](function(){return _0x15bcc3;});})['then'](function(){_0x4b57ab[_0x1126('0x1d')](0xcc)[_0x1126('0x33')]();});}};}function handleEntityNotFound(_0x1cef48,_0x5b8bea){return function(_0x2a3055){if(!_0x2a3055){_0x1cef48[_0x1126('0x34')](0x194);}return _0x2a3055;};}function handleError(_0x56f7f8,_0x3dd50e){_0x3dd50e=_0x3dd50e||0x1f4;return function(_0x1e80aa){logger[_0x1126('0x35')](_0x1e80aa[_0x1126('0x36')]);if(_0x1e80aa['name']){delete _0x1e80aa['name'];}_0x56f7f8[_0x1126('0x1d')](_0x3dd50e)[_0x1126('0x37')](_0x1e80aa);};}exports[_0x1126('0x38')]=function(_0x2c67eb,_0x55244a){var _0x145314={},_0x6f4312={},_0x313ebe={'count':0x0,'rows':[]};var _0x22436c=_[_0x1126('0x39')](db['VoiceExtension'][_0x1126('0x3a')],function(_0x457efd){return{'name':_0x457efd[_0x1126('0x3b')],'type':_0x457efd[_0x1126('0x30')]['key']};});_0x6f4312['model']=_[_0x1126('0x39')](_0x22436c,_0x1126('0x3c'));_0x6f4312['query']=_[_0x1126('0x3d')](_0x2c67eb[_0x1126('0x3e')]);_0x6f4312[_0x1126('0x3f')]=_['intersection'](_0x6f4312['model'],_0x6f4312[_0x1126('0x3e')]);_0x145314[_0x1126('0x40')]=_[_0x1126('0x41')](_0x6f4312[_0x1126('0x42')],qs['fields'](_0x2c67eb[_0x1126('0x3e')]['fields']));_0x145314[_0x1126('0x40')]=_0x145314[_0x1126('0x40')][_0x1126('0x43')]?_0x145314[_0x1126('0x40')]:_0x6f4312[_0x1126('0x42')];if(!_0x2c67eb['query'][_0x1126('0x44')](_0x1126('0x45'))){_0x145314[_0x1126('0x21')]=qs[_0x1126('0x21')](_0x2c67eb[_0x1126('0x3e')][_0x1126('0x21')]);_0x145314[_0x1126('0x20')]=qs['offset'](_0x2c67eb[_0x1126('0x3e')][_0x1126('0x20')]);}_0x145314[_0x1126('0x46')]=qs[_0x1126('0x47')](_0x2c67eb[_0x1126('0x3e')]['sort']);_0x145314['where']=qs[_0x1126('0x3f')](_[_0x1126('0x48')](_0x2c67eb[_0x1126('0x3e')],_0x6f4312[_0x1126('0x3f')]),_0x22436c);if(_0x2c67eb[_0x1126('0x3e')][_0x1126('0x2d')]){_0x145314['where']=_['merge'](_0x145314['where'],{'$or':_[_0x1126('0x39')](_0x22436c,function(_0x5d4194){if(_0x5d4194[_0x1126('0x30')]!==_0x1126('0x49')){var _0x3584a3={};_0x3584a3[_0x5d4194[_0x1126('0x3c')]]={'$like':'%'+_0x2c67eb['query']['filter']+'%'};return _0x3584a3;}})});}_0x145314=_[_0x1126('0x4a')]({},_0x145314,_0x2c67eb[_0x1126('0x4b')]);var _0x1d63b9={'where':_0x145314['where']};return db[_0x1126('0x4c')]['count'](_0x1d63b9)[_0x1126('0x27')](function(_0x51a5be){_0x313ebe[_0x1126('0x1f')]=_0x51a5be;if(_0x2c67eb[_0x1126('0x3e')][_0x1126('0x4d')]){_0x145314['include']=[{'all':!![]}];}return db[_0x1126('0x4c')][_0x1126('0x4e')](_0x145314);})[_0x1126('0x27')](function(_0x48c694){_0x313ebe['rows']=_0x48c694;return _0x313ebe;})['then'](respondWithFilteredResult(_0x55244a,_0x145314))[_0x1126('0x4f')](handleError(_0x55244a,null));};exports['show']=function(_0x1e197e,_0x507568){var _0x2f45b9={'raw':![],'where':{'id':_0x1e197e[_0x1126('0x50')]['id']}},_0x323499={};_0x323499[_0x1126('0x42')]=_[_0x1126('0x3d')](db['VoiceExtension'][_0x1126('0x3a')]);_0x323499[_0x1126('0x3e')]=_['keys'](_0x1e197e[_0x1126('0x3e')]);_0x323499[_0x1126('0x3f')]=_['intersection'](_0x323499[_0x1126('0x42')],_0x323499[_0x1126('0x3e')]);_0x2f45b9['attributes']=_[_0x1126('0x41')](_0x323499[_0x1126('0x42')],qs[_0x1126('0x51')](_0x1e197e['query'][_0x1126('0x51')]));_0x2f45b9[_0x1126('0x40')]=_0x2f45b9[_0x1126('0x40')][_0x1126('0x43')]?_0x2f45b9[_0x1126('0x40')]:_0x323499[_0x1126('0x42')];if(_0x1e197e[_0x1126('0x3e')][_0x1126('0x4d')]){_0x2f45b9['include']=[{'all':!![]}];}_0x2f45b9=_[_0x1126('0x4a')]({},_0x2f45b9,_0x1e197e['options']);return db[_0x1126('0x4c')][_0x1126('0x31')](_0x2f45b9)['then'](handleEntityNotFound(_0x507568,null))['then'](respondWithResult(_0x507568,null))[_0x1126('0x4f')](handleError(_0x507568,null));};exports[_0x1126('0x26')]=function(_0x387fe1,_0x52a9a4){return db[_0x1126('0x4c')][_0x1126('0x31')]({'where':{'id':_0x387fe1[_0x1126('0x50')]['id']}})[_0x1126('0x27')](handleEntityNotFound(_0x52a9a4,null))['then'](removeEntity(_0x52a9a4,null))[_0x1126('0x4f')](handleError(_0x52a9a4,null));};exports[_0x1126('0x52')]=function(_0x5c36b9,_0x4bcc08){if(_0x5c36b9['body']['type']===_0x1126('0x2b')&&!_[_0x1126('0x53')](_0x5c36b9['body'][_0x1126('0x54')],'_')){_0x5c36b9[_0x1126('0x55')][_0x1126('0x54')]='_'[_0x1126('0x56')](_0x5c36b9[_0x1126('0x55')]['exten']);}return db[_0x1126('0x4c')][_0x1126('0x52')](_0x5c36b9['body'],{'raw':![]})[_0x1126('0x27')](function(_0x476aca){var _0xcc9499=_0x5c36b9[_0x1126('0x57')][_0x1126('0x28')]({'plain':!![]});if(!_0xcc9499)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xcc9499[_0x1126('0x58')]==='user'){var _0x868b2c=_0x476aca[_0x1126('0x28')]({'plain':!![]});var _0x33c971=[{'name':'InboundRoutes','value':_0x1126('0x59')},{'name':_0x1126('0x2a'),'value':'outbound'},{'name':_0x1126('0x2c'),'value':_0x1126('0x5a')}];var _0x9bad53=_['find'](_0x33c971,[_0x1126('0x2f'),_0x868b2c[_0x1126('0x30')]])[_0x1126('0x3c')];return db[_0x1126('0x5b')][_0x1126('0x31')]({'where':{'name':_0x9bad53,'userProfileId':_0xcc9499[_0x1126('0x5c')]},'raw':!![]})[_0x1126('0x27')](function(_0x114be2){if(_0x114be2&&_0x114be2['autoAssociation']===0x0){return db[_0x1126('0x32')][_0x1126('0x52')]({'name':_0x868b2c[_0x1126('0x3c')],'resourceId':_0x868b2c['id'],'type':_0x114be2[_0x1126('0x3c')],'sectionId':_0x114be2['id']},{})[_0x1126('0x27')](function(){return _0x476aca;});}else{return _0x476aca;}})['catch'](function(_0xcc1a95){logger[_0x1126('0x35')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xcc1a95);throw _0xcc1a95;});}return _0x476aca;})[_0x1126('0x27')](respondWithResult(_0x4bcc08,0xc9))['catch'](handleError(_0x4bcc08,null));};exports[_0x1126('0x25')]=function(_0x10ff91,_0x478806){if(_0x10ff91[_0x1126('0x55')]['id']){delete _0x10ff91[_0x1126('0x55')]['id'];}return db[_0x1126('0x4c')]['find']({'where':{'id':_0x10ff91[_0x1126('0x50')]['id']}})['then'](handleEntityNotFound(_0x478806,null))['then'](function(_0xbdc58){if(_0xbdc58){return db[_0x1126('0x4c')][_0x1126('0x25')](_[_0x1126('0x48')](_0x10ff91[_0x1126('0x55')],[_0x1126('0x54'),_0x1126('0x5d'),'description',_0x1126('0x5e'),_0x1126('0x5f'),_0x1126('0x60')]),{'where':{'context':_0xbdc58[_0x1126('0x5d')],'exten':_0xbdc58[_0x1126('0x54')]},'individualHooks':!![]})[_0x1126('0x27')](function(_0x5a0804){return _0x5a0804;});}return null;})['then'](respondWithStatusCode(_0x478806,null))[_0x1126('0x4f')](handleError(_0x478806,null));};exports[_0x1126('0x61')]=function(_0x4bf2b3,_0x5ee130,_0x5e9260){return db['VoiceExtension'][_0x1126('0x62')]({'where':{'id':_0x4bf2b3[_0x1126('0x50')]['id']}})[_0x1126('0x27')](handleEntityNotFound(_0x5ee130,null))['then'](function(_0x30e32f){if(_0x30e32f){return db[_0x1126('0x63')][_0x1126('0x64')](function(_0x1bd093){return db[_0x1126('0x4c')][_0x1126('0x26')]({'where':{'VoiceExtensionId':_0x4bf2b3[_0x1126('0x50')]['id']},'transaction':_0x1bd093})['then'](function(_0x339aa6){var _0x390b69=_[_0x1126('0x39')](_0x4bf2b3[_0x1126('0x55')],function(_0x288b9b){_0x288b9b['VoiceExtensionId']=_0x4bf2b3['params']['id'];return _0x288b9b;});return db[_0x1126('0x4c')][_0x1126('0x65')](_0x390b69,{'transaction':_0x1bd093});});})['then'](function(){return db[_0x1126('0x4c')][_0x1126('0x66')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4bf2b3[_0x1126('0x50')]['id']},'order':_0x1126('0x67')});});}})[_0x1126('0x27')](respondWithResult(_0x5ee130,null))[_0x1126('0x4f')](handleError(_0x5ee130,null));}; \ No newline at end of file +var _0x2675=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','description','recordingFormat','mandatoryDisposition','addApplications','findOne','sequelize','transaction','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','destroy','then','get','OutboundRoutes','outbound','internal','ignore','map','value','includes','find','type','error','stack','name','send','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','VoiceExtension','count','include','findAll','show','params','includeAll','catch','create','body','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','InboundRoutes','inbound','UserProfileSection','userProfileId','autoAssociation','UserProfileResource'];(function(_0x45dee3,_0x5c4075){var _0x2d7c27=function(_0x38fd86){while(--_0x38fd86){_0x45dee3['push'](_0x45dee3['shift']());}};_0x2d7c27(++_0x5c4075);}(_0x2675,0x75));var _0x5267=function(_0x2fedf5,_0x24c746){_0x2fedf5=_0x2fedf5-0x0;var _0x5cb126=_0x2675[_0x2fedf5];return _0x5cb126;};'use strict';var pdf=require(_0x5267('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5267('0x1'));var rp=require(_0x5267('0x2'));var moment=require('moment');var BPromise=require(_0x5267('0x3'));var Mustache=require(_0x5267('0x4'));var util=require('util');var path=require(_0x5267('0x5'));var sox=require(_0x5267('0x6'));var csv=require(_0x5267('0x7'));var ejs=require(_0x5267('0x8'));var fs=require('fs');var fs_extra=require(_0x5267('0x9'));var _=require(_0x5267('0xa'));var squel=require('squel');var crypto=require(_0x5267('0xb'));var jsforce=require(_0x5267('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5267('0x7'));var querystring=require('querystring');var Papa=require(_0x5267('0xd'));var Redis=require(_0x5267('0xe'));var authService=require(_0x5267('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5267('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5267('0x11'))('api');var utils=require(_0x5267('0x12'));var config=require(_0x5267('0x13'));var licenseUtil=require(_0x5267('0x14'));var db=require(_0x5267('0x15'))['db'];config[_0x5267('0x16')]=_[_0x5267('0x17')](config[_0x5267('0x16')],{'host':_0x5267('0x18'),'port':0x18eb});var socket=require(_0x5267('0x19'))(new Redis(config[_0x5267('0x16')]));require(_0x5267('0x1a'))[_0x5267('0x1b')](socket);function respondWithStatusCode(_0x3e2bab,_0x548040){_0x548040=_0x548040||0xcc;return function(_0x52e24e){if(_0x52e24e){return _0x3e2bab[_0x5267('0x1c')](_0x548040);}return _0x3e2bab[_0x5267('0x1d')](_0x548040)[_0x5267('0x1e')]();};}function respondWithResult(_0x3f5344,_0x46b2c2){_0x46b2c2=_0x46b2c2||0xc8;return function(_0x27e5c6){if(_0x27e5c6){return _0x3f5344[_0x5267('0x1d')](_0x46b2c2)[_0x5267('0x1f')](_0x27e5c6);}};}function respondWithFilteredResult(_0x15d81e,_0xb1c97a){return function(_0x376387){if(_0x376387){var _0x1ab03=_0x376387['count'],_0x528d61=_0xb1c97a[_0x5267('0x20')],_0x18f32e=_0xb1c97a['offset']+_0xb1c97a[_0x5267('0x21')],_0x2afd38;if(_0x18f32e>=_0x1ab03){_0x18f32e=_0x1ab03;_0x2afd38=0xc8;}else{_0x2afd38=0xce;}_0x15d81e[_0x5267('0x1d')](_0x2afd38);return _0x15d81e[_0x5267('0x22')](_0x5267('0x23'),_0x528d61+'-'+_0x18f32e+'/'+_0x1ab03)[_0x5267('0x1f')](_0x376387);}return null;};}function patchUpdates(_0x4dd637){return function(_0x100fcd){try{jsonpatch['apply'](_0x100fcd,_0x4dd637,!![]);}catch(_0xa32663){return BPromise[_0x5267('0x24')](_0xa32663);}return _0x100fcd[_0x5267('0x25')]();};}function saveUpdates(_0x56dd95,_0x499f19){return function(_0x5546e2){if(_0x5546e2){return _0x5546e2['update'](_0x56dd95)['then'](function(_0x26c7f8){return _0x26c7f8;});}return null;};}function removeEntity(_0x399e64,_0x2d761d){return function(_0x279377){if(_0x279377){return _0x279377[_0x5267('0x26')]()[_0x5267('0x27')](function(){var _0x126a97=_0x279377[_0x5267('0x28')]({'plain':!![]});var _0x2cdc45=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0x5267('0x29'),'value':_0x5267('0x2a'),'ignore':![]},{'name':'InternalRoutes','value':_0x5267('0x2b'),'ignore':![]}];var _0x52504e=_(_0x2cdc45)['filter'](_0x5267('0x2c'))[_0x5267('0x2d')](_0x5267('0x2e'))[_0x5267('0x2e')]();if(_[_0x5267('0x2f')](_0x52504e,_0x126a97['type'])){return;}var _0x5e87eb=_[_0x5267('0x30')](_0x2cdc45,[_0x5267('0x2e'),_0x126a97[_0x5267('0x31')]])['name'];return db['UserProfileResource'][_0x5267('0x26')]({'where':{'type':_0x5e87eb,'resourceId':_0x126a97['id']}})[_0x5267('0x27')](function(){return _0x279377;});})[_0x5267('0x27')](function(){_0x399e64['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2249a1,_0xc7691d){return function(_0x40cec1){if(!_0x40cec1){_0x2249a1[_0x5267('0x1c')](0x194);}return _0x40cec1;};}function handleError(_0x5bbb83,_0x33e456){_0x33e456=_0x33e456||0x1f4;return function(_0x1a7f4b){logger[_0x5267('0x32')](_0x1a7f4b[_0x5267('0x33')]);if(_0x1a7f4b[_0x5267('0x34')]){delete _0x1a7f4b[_0x5267('0x34')];}_0x5bbb83[_0x5267('0x1d')](_0x33e456)[_0x5267('0x35')](_0x1a7f4b);};}exports['index']=function(_0x4f372c,_0x39e309){var _0x51c372={},_0x38c0b8={},_0x100097={'count':0x0,'rows':[]};var _0x2b963e=_[_0x5267('0x2d')](db['VoiceExtension'][_0x5267('0x36')],function(_0xdd06f){return{'name':_0xdd06f[_0x5267('0x37')],'type':_0xdd06f[_0x5267('0x31')][_0x5267('0x38')]};});_0x38c0b8[_0x5267('0x39')]=_[_0x5267('0x2d')](_0x2b963e,_0x5267('0x34'));_0x38c0b8['query']=_[_0x5267('0x3a')](_0x4f372c['query']);_0x38c0b8[_0x5267('0x3b')]=_[_0x5267('0x3c')](_0x38c0b8[_0x5267('0x39')],_0x38c0b8[_0x5267('0x3d')]);_0x51c372[_0x5267('0x3e')]=_[_0x5267('0x3c')](_0x38c0b8[_0x5267('0x39')],qs['fields'](_0x4f372c[_0x5267('0x3d')][_0x5267('0x3f')]));_0x51c372[_0x5267('0x3e')]=_0x51c372[_0x5267('0x3e')][_0x5267('0x40')]?_0x51c372[_0x5267('0x3e')]:_0x38c0b8[_0x5267('0x39')];if(!_0x4f372c['query'][_0x5267('0x41')]('nolimit')){_0x51c372[_0x5267('0x21')]=qs['limit'](_0x4f372c['query']['limit']);_0x51c372[_0x5267('0x20')]=qs['offset'](_0x4f372c[_0x5267('0x3d')][_0x5267('0x20')]);}_0x51c372[_0x5267('0x42')]=qs[_0x5267('0x43')](_0x4f372c['query'][_0x5267('0x43')]);_0x51c372[_0x5267('0x44')]=qs['filters'](_['pick'](_0x4f372c[_0x5267('0x3d')],_0x38c0b8['filters']),_0x2b963e);if(_0x4f372c[_0x5267('0x3d')][_0x5267('0x45')]){_0x51c372[_0x5267('0x44')]=_[_0x5267('0x46')](_0x51c372[_0x5267('0x44')],{'$or':_[_0x5267('0x2d')](_0x2b963e,function(_0x27add5){if(_0x27add5['type']!=='VIRTUAL'){var _0x28ea4a={};_0x28ea4a[_0x27add5['name']]={'$like':'%'+_0x4f372c[_0x5267('0x3d')][_0x5267('0x45')]+'%'};return _0x28ea4a;}})});}_0x51c372=_['merge']({},_0x51c372,_0x4f372c[_0x5267('0x47')]);var _0xc764cd={'where':_0x51c372[_0x5267('0x44')]};return db[_0x5267('0x48')][_0x5267('0x49')](_0xc764cd)[_0x5267('0x27')](function(_0x1abc62){_0x100097[_0x5267('0x49')]=_0x1abc62;if(_0x4f372c[_0x5267('0x3d')]['includeAll']){_0x51c372[_0x5267('0x4a')]=[{'all':!![]}];}return db[_0x5267('0x48')][_0x5267('0x4b')](_0x51c372);})[_0x5267('0x27')](function(_0x1270d4){_0x100097['rows']=_0x1270d4;return _0x100097;})[_0x5267('0x27')](respondWithFilteredResult(_0x39e309,_0x51c372))['catch'](handleError(_0x39e309,null));};exports[_0x5267('0x4c')]=function(_0x5cda8c,_0x4ae9f9){var _0x37ec6c={'raw':![],'where':{'id':_0x5cda8c[_0x5267('0x4d')]['id']}},_0x56d33f={};_0x56d33f[_0x5267('0x39')]=_[_0x5267('0x3a')](db[_0x5267('0x48')]['rawAttributes']);_0x56d33f[_0x5267('0x3d')]=_['keys'](_0x5cda8c['query']);_0x56d33f[_0x5267('0x3b')]=_[_0x5267('0x3c')](_0x56d33f['model'],_0x56d33f['query']);_0x37ec6c[_0x5267('0x3e')]=_[_0x5267('0x3c')](_0x56d33f[_0x5267('0x39')],qs[_0x5267('0x3f')](_0x5cda8c[_0x5267('0x3d')][_0x5267('0x3f')]));_0x37ec6c[_0x5267('0x3e')]=_0x37ec6c[_0x5267('0x3e')][_0x5267('0x40')]?_0x37ec6c[_0x5267('0x3e')]:_0x56d33f[_0x5267('0x39')];if(_0x5cda8c[_0x5267('0x3d')][_0x5267('0x4e')]){_0x37ec6c[_0x5267('0x4a')]=[{'all':!![]}];}_0x37ec6c=_['merge']({},_0x37ec6c,_0x5cda8c[_0x5267('0x47')]);return db[_0x5267('0x48')][_0x5267('0x30')](_0x37ec6c)['then'](handleEntityNotFound(_0x4ae9f9,null))[_0x5267('0x27')](respondWithResult(_0x4ae9f9,null))[_0x5267('0x4f')](handleError(_0x4ae9f9,null));};exports[_0x5267('0x26')]=function(_0x2a97f1,_0x119546){return db[_0x5267('0x48')]['find']({'where':{'id':_0x2a97f1[_0x5267('0x4d')]['id']}})['then'](handleEntityNotFound(_0x119546,null))[_0x5267('0x27')](removeEntity(_0x119546,null))[_0x5267('0x4f')](handleError(_0x119546,null));};exports[_0x5267('0x50')]=function(_0x348508,_0x91b932){if(_0x348508[_0x5267('0x51')][_0x5267('0x31')]==='outbound'&&!_['startsWith'](_0x348508[_0x5267('0x51')][_0x5267('0x52')],'_')){_0x348508['body'][_0x5267('0x52')]='_'['concat'](_0x348508['body'][_0x5267('0x52')]);}return db[_0x5267('0x48')][_0x5267('0x50')](_0x348508[_0x5267('0x51')],{'raw':![]})[_0x5267('0x27')](function(_0x3e7e6a){var _0xe33b95=_0x348508[_0x5267('0x53')][_0x5267('0x28')]({'plain':!![]});if(!_0xe33b95)throw new Error(_0x5267('0x54'));if(_0xe33b95['role']===_0x5267('0x53')){var _0xc50497=_0x3e7e6a[_0x5267('0x28')]({'plain':!![]});var _0x24f86a=[{'name':_0x5267('0x55'),'value':_0x5267('0x56')},{'name':'OutboundRoutes','value':_0x5267('0x2a')},{'name':'InternalRoutes','value':_0x5267('0x2b')}];var _0x3b0b6a=_[_0x5267('0x30')](_0x24f86a,['value',_0xc50497[_0x5267('0x31')]])[_0x5267('0x34')];return db[_0x5267('0x57')][_0x5267('0x30')]({'where':{'name':_0x3b0b6a,'userProfileId':_0xe33b95[_0x5267('0x58')]},'raw':!![]})[_0x5267('0x27')](function(_0x4e809c){if(_0x4e809c&&_0x4e809c[_0x5267('0x59')]===0x0){return db[_0x5267('0x5a')][_0x5267('0x50')]({'name':_0xc50497[_0x5267('0x34')],'resourceId':_0xc50497['id'],'type':_0x4e809c['name'],'sectionId':_0x4e809c['id']},{})['then'](function(){return _0x3e7e6a;});}else{return _0x3e7e6a;}})[_0x5267('0x4f')](function(_0x5393e9){logger[_0x5267('0x32')](_0x5267('0x5b'),_0x5393e9);throw _0x5393e9;});}return _0x3e7e6a;})['then'](respondWithResult(_0x91b932,0xc9))['catch'](handleError(_0x91b932,null));};exports[_0x5267('0x5c')]=function(_0x1f01e4,_0x1e1aa2){if(_0x1f01e4['body']['id']){delete _0x1f01e4[_0x5267('0x51')]['id'];}return db[_0x5267('0x48')][_0x5267('0x30')]({'where':{'id':_0x1f01e4[_0x5267('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1e1aa2,null))['then'](function(_0x540ab8){if(_0x540ab8){return db[_0x5267('0x48')][_0x5267('0x5c')](_[_0x5267('0x5d')](_0x1f01e4[_0x5267('0x51')],[_0x5267('0x52'),_0x5267('0x5e'),_0x5267('0x5f'),_0x5267('0x60'),'cutdigits',_0x5267('0x61')]),{'where':{'context':_0x540ab8[_0x5267('0x5e')],'exten':_0x540ab8['exten']},'individualHooks':!![]})[_0x5267('0x27')](function(_0x31eaaa){return _0x31eaaa;});}return null;})[_0x5267('0x27')](respondWithStatusCode(_0x1e1aa2,null))[_0x5267('0x4f')](handleError(_0x1e1aa2,null));};exports[_0x5267('0x62')]=function(_0xde1ecd,_0x4915f4,_0x2ca259){return db[_0x5267('0x48')][_0x5267('0x63')]({'where':{'id':_0xde1ecd[_0x5267('0x4d')]['id']}})[_0x5267('0x27')](handleEntityNotFound(_0x4915f4,null))[_0x5267('0x27')](function(_0x4aac32){if(_0x4aac32){return db[_0x5267('0x64')][_0x5267('0x65')](function(_0x30e8d5){return db[_0x5267('0x48')][_0x5267('0x26')]({'where':{'VoiceExtensionId':_0xde1ecd[_0x5267('0x4d')]['id']},'transaction':_0x30e8d5})['then'](function(_0x283423){var _0x41299c=_[_0x5267('0x2d')](_0xde1ecd[_0x5267('0x51')],function(_0x490b8c){_0x490b8c['VoiceExtensionId']=_0xde1ecd['params']['id'];return _0x490b8c;});return db[_0x5267('0x48')]['bulkCreate'](_0x41299c,{'transaction':_0x30e8d5});});})[_0x5267('0x27')](function(){return db['VoiceExtension'][_0x5267('0x66')]({'where':{'isApp':!![],'VoiceExtensionId':_0xde1ecd[_0x5267('0x4d')]['id']},'order':_0x5267('0x67')});});}})[_0x5267('0x27')](respondWithResult(_0x4915f4,null))[_0x5267('0x4f')](handleError(_0x4915f4,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 94a1e38..6948a5c 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 _0x6496=['hasOwnProperty','hook','exports','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit'];(function(_0x1b24e2,_0x57631b){var _0x1e541b=function(_0x4a3d99){while(--_0x4a3d99){_0x1b24e2['push'](_0x1b24e2['shift']());}};_0x1e541b(++_0x57631b);}(_0x6496,0xa3));var _0x6649=function(_0x7ad661,_0x1e4efa){_0x7ad661=_0x7ad661-0x0;var _0x363e14=_0x6496[_0x7ad661];return _0x363e14;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x6649('0x0'))['db'][_0x6649('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x6649('0x2')](0x0);var events={'afterCreate':_0x6649('0x3'),'afterUpdate':_0x6649('0x4'),'afterDestroy':_0x6649('0x5')};function emitEvent(_0x2cef07){return function(_0x467b9c,_0x37cfd5,_0x32d91e){VoiceExtensionEvents[_0x6649('0x6')](_0x2cef07+':'+_0x467b9c['id'],_0x467b9c);VoiceExtensionEvents[_0x6649('0x6')](_0x2cef07,_0x467b9c);_0x32d91e(null);};}for(var e in events){if(events[_0x6649('0x7')](e)){var event=events[e];VoiceExtension[_0x6649('0x8')](e,emitEvent(event));}}module[_0x6649('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0x657e=['events','../../mysqldb','VoiceExtension','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x657e,0x1c2));var _0xe657=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0x657e[_0x2d61b2];return _0x12df89;};'use strict';var EventEmitter=require(_0xe657('0x0'));var VoiceExtension=require(_0xe657('0x1'))['db'][_0xe657('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xe657('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe657('0x4'),'afterDestroy':_0xe657('0x5')};function emitEvent(_0x17cbf0){return function(_0xbbd887,_0x501b74,_0x5c7bb2){VoiceExtensionEvents[_0xe657('0x6')](_0x17cbf0+':'+_0xbbd887['id'],_0xbbd887);VoiceExtensionEvents[_0xe657('0x6')](_0x17cbf0,_0xbbd887);_0x5c7bb2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xe657('0x7')](e,emitEvent(event));}}module[_0xe657('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index b8eaef9..3533126 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 _0x0a96=['VoiceExtension','lodash','util','../../config/logger','api','bluebird','path','./voiceExtension.attributes','exports','define'];(function(_0x5149c7,_0xfd2f67){var _0x5010b0=function(_0x408cb0){while(--_0x408cb0){_0x5149c7['push'](_0x5149c7['shift']());}};_0x5010b0(++_0xfd2f67);}(_0x0a96,0x1af));var _0x60a9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0a96[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x60a9('0x0'));var util=require(_0x60a9('0x1'));var logger=require(_0x60a9('0x2'))(_0x60a9('0x3'));var moment=require('moment');var BPromise=require(_0x60a9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x60a9('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x60a9('0x6'));module[_0x60a9('0x7')]=function(_0x13a888,_0x503f1a){return _0x13a888[_0x60a9('0x8')](_0x60a9('0x9'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e05=['VoiceExtension','voice_extensions','lodash','util','api','moment','path','rimraf','../../config/environment','exports'];(function(_0x77ed9b,_0x2a1637){var _0x4ad51a=function(_0x2a84a5){while(--_0x2a84a5){_0x77ed9b['push'](_0x77ed9b['shift']());}};_0x4ad51a(++_0x2a1637);}(_0x9e05,0x1b0));var _0x59e0=function(_0x407292,_0x57465e){_0x407292=_0x407292-0x0;var _0x5576ef=_0x9e05[_0x407292];return _0x5576ef;};'use strict';var _=require(_0x59e0('0x0'));var util=require(_0x59e0('0x1'));var logger=require('../../config/logger')(_0x59e0('0x2'));var moment=require(_0x59e0('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x59e0('0x4'));var rimraf=require(_0x59e0('0x5'));var config=require(_0x59e0('0x6'));var attributes=require('./voiceExtension.attributes');module[_0x59e0('0x7')]=function(_0x556082,_0x405ed6){return _0x556082['define'](_0x59e0('0x8'),attributes,{'tableName':_0x59e0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index dd3acee..3b7deb8 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 _0xcbb5=['localhost','./voiceExtension.socket','request','then','info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','limit','include','model','attributes','map','util','randomstring','ioredis','../../config/utils','rpc','client','redis','defaults'];(function(_0x3f9fa2,_0x1fd8ff){var _0x1a9be8=function(_0xbee571){while(--_0xbee571){_0x3f9fa2['push'](_0x3f9fa2['shift']());}};_0x1a9be8(++_0x1fd8ff);}(_0xcbb5,0xdf));var _0x5cbb=function(_0x3710b2,_0x59d0dc){_0x3710b2=_0x3710b2-0x0;var _0x215a85=_0xcbb5[_0x3710b2];return _0x215a85;};'use strict';var _=require('lodash');var util=require(_0x5cbb('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5cbb('0x1'));var fs=require('fs');var Redis=require(_0x5cbb('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5cbb('0x3'));var logger=require('../../config/logger')(_0x5cbb('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5cbb('0x5')]['http']({'port':0x232a});config[_0x5cbb('0x6')]=_[_0x5cbb('0x7')](config[_0x5cbb('0x6')],{'host':_0x5cbb('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5cbb('0x9'))['register'](socket);function respondWithRpcPromise(_0x37b7e0,_0x13bd9c,_0x44f3d5){return new BPromise(function(_0x21aeba,_0x2617b3){return client[_0x5cbb('0xa')](_0x37b7e0,_0x44f3d5)[_0x5cbb('0xb')](function(_0x2828c9){logger[_0x5cbb('0xc')]('VoiceExtension,\x20%s,\x20%s',_0x13bd9c,_0x5cbb('0xd'));logger[_0x5cbb('0xe')](_0x5cbb('0xf'),_0x13bd9c,'request\x20sent',JSON[_0x5cbb('0x10')](_0x2828c9));if(_0x2828c9[_0x5cbb('0x11')]){if(_0x2828c9['error'][_0x5cbb('0x12')]===0x1f4){logger[_0x5cbb('0x11')](_0x5cbb('0x13'),_0x13bd9c,_0x2828c9[_0x5cbb('0x11')][_0x5cbb('0x14')]);return _0x2617b3(_0x2828c9[_0x5cbb('0x11')][_0x5cbb('0x14')]);}logger['error'](_0x5cbb('0x13'),_0x13bd9c,_0x2828c9[_0x5cbb('0x11')][_0x5cbb('0x14')]);return _0x21aeba(_0x2828c9[_0x5cbb('0x11')][_0x5cbb('0x14')]);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x13bd9c,'request\x20sent');_0x21aeba(_0x2828c9[_0x5cbb('0x15')]['message']);}})[_0x5cbb('0x16')](function(_0x369114){logger['error'](_0x5cbb('0x13'),_0x13bd9c,_0x369114);_0x2617b3(_0x369114);});});}exports[_0x5cbb('0x17')]=function(_0x1b073f){var _0xb1ca10=this;return new Promise(function(_0x33a2d7,_0xeb1514){return db[_0x5cbb('0x18')][_0x5cbb('0x19')]({'raw':_0x1b073f[_0x5cbb('0x1a')]?_0x1b073f['options'][_0x5cbb('0x1b')]===undefined?!![]:![]:!![],'where':_0x1b073f[_0x5cbb('0x1a')]?_0x1b073f[_0x5cbb('0x1a')]['where']||null:null,'attributes':_0x1b073f[_0x5cbb('0x1a')]?_0x1b073f[_0x5cbb('0x1a')]['attributes']||null:null,'limit':_0x1b073f['options']?_0x1b073f['options'][_0x5cbb('0x1c')]||null:null,'include':_0x1b073f['options']?_0x1b073f['options'][_0x5cbb('0x1d')]?_['map'](_0x1b073f[_0x5cbb('0x1a')][_0x5cbb('0x1d')],function(_0x2e640c){return{'model':db[_0x2e640c[_0x5cbb('0x1e')]],'as':_0x2e640c['as'],'attributes':_0x2e640c[_0x5cbb('0x1f')],'include':_0x2e640c[_0x5cbb('0x1d')]?_['map'](_0x2e640c[_0x5cbb('0x1d')],function(_0x3665f5){return{'model':db[_0x3665f5[_0x5cbb('0x1e')]],'as':_0x3665f5['as'],'attributes':_0x3665f5[_0x5cbb('0x1f')],'include':_0x3665f5[_0x5cbb('0x1d')]?_[_0x5cbb('0x20')](_0x3665f5['include'],function(_0x2fe11c){return{'model':db[_0x2fe11c['model']],'as':_0x2fe11c['as'],'attributes':_0x2fe11c['attributes']};}):[]};}):[]};}):[]:[]})[_0x5cbb('0xb')](function(_0x4de461){logger[_0x5cbb('0xc')]('GetVoiceExtension',_0x1b073f);logger[_0x5cbb('0xe')](_0x5cbb('0x17'),_0x1b073f,JSON['stringify'](_0x4de461));_0x33a2d7(_0x4de461);})['catch'](function(_0x439b20){logger[_0x5cbb('0x11')](_0x5cbb('0x17'),_0x439b20[_0x5cbb('0x14')],_0x1b073f);_0xeb1514(_0xb1ca10[_0x5cbb('0x11')](0x1f4,_0x439b20[_0x5cbb('0x14')]));});});}; \ No newline at end of file +var _0xaec7=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','localhost','./voiceExtension.socket','request','info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','limit','include','map','attributes','then','lodash','moment'];(function(_0x4b3e66,_0xecaee9){var _0x586765=function(_0xbcd530){while(--_0xbcd530){_0x4b3e66['push'](_0x4b3e66['shift']());}};_0x586765(++_0xecaee9);}(_0xaec7,0xa8));var _0x7aec=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xaec7[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x7aec('0x0'));var util=require('util');var moment=require(_0x7aec('0x1'));var BPromise=require('bluebird');var rs=require(_0x7aec('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7aec('0x3'))['db'];var utils=require(_0x7aec('0x4'));var logger=require(_0x7aec('0x5'))('rpc');var config=require(_0x7aec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7aec('0x7')]['http']({'port':0x232a});config[_0x7aec('0x8')]=_['defaults'](config[_0x7aec('0x8')],{'host':_0x7aec('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7aec('0x8')]));require(_0x7aec('0xa'))['register'](socket);function respondWithRpcPromise(_0x3fabcf,_0x4339da,_0x4e469b){return new BPromise(function(_0x35f183,_0x977a4){return client[_0x7aec('0xb')](_0x3fabcf,_0x4e469b)['then'](function(_0xb16332){logger[_0x7aec('0xc')]('VoiceExtension,\x20%s,\x20%s',_0x4339da,_0x7aec('0xd'));logger[_0x7aec('0xe')](_0x7aec('0xf'),_0x4339da,_0x7aec('0xd'),JSON[_0x7aec('0x10')](_0xb16332));if(_0xb16332['error']){if(_0xb16332[_0x7aec('0x11')][_0x7aec('0x12')]===0x1f4){logger[_0x7aec('0x11')](_0x7aec('0x13'),_0x4339da,_0xb16332['error'][_0x7aec('0x14')]);return _0x977a4(_0xb16332['error'][_0x7aec('0x14')]);}logger['error'](_0x7aec('0x13'),_0x4339da,_0xb16332[_0x7aec('0x11')][_0x7aec('0x14')]);return _0x35f183(_0xb16332['error'][_0x7aec('0x14')]);}else{logger[_0x7aec('0xc')](_0x7aec('0x13'),_0x4339da,'request\x20sent');_0x35f183(_0xb16332[_0x7aec('0x15')][_0x7aec('0x14')]);}})[_0x7aec('0x16')](function(_0x4fca48){logger[_0x7aec('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x4339da,_0x4fca48);_0x977a4(_0x4fca48);});});}exports[_0x7aec('0x17')]=function(_0x47c0d9){var _0x42d072=this;return new Promise(function(_0x5a8b9d,_0x13605c){return db[_0x7aec('0x18')][_0x7aec('0x19')]({'raw':_0x47c0d9[_0x7aec('0x1a')]?_0x47c0d9[_0x7aec('0x1a')][_0x7aec('0x1b')]===undefined?!![]:![]:!![],'where':_0x47c0d9[_0x7aec('0x1a')]?_0x47c0d9[_0x7aec('0x1a')][_0x7aec('0x1c')]||null:null,'attributes':_0x47c0d9[_0x7aec('0x1a')]?_0x47c0d9[_0x7aec('0x1a')]['attributes']||null:null,'limit':_0x47c0d9[_0x7aec('0x1a')]?_0x47c0d9['options'][_0x7aec('0x1d')]||null:null,'include':_0x47c0d9[_0x7aec('0x1a')]?_0x47c0d9['options'][_0x7aec('0x1e')]?_[_0x7aec('0x1f')](_0x47c0d9[_0x7aec('0x1a')][_0x7aec('0x1e')],function(_0xfa42e4){return{'model':db[_0xfa42e4['model']],'as':_0xfa42e4['as'],'attributes':_0xfa42e4[_0x7aec('0x20')],'include':_0xfa42e4[_0x7aec('0x1e')]?_[_0x7aec('0x1f')](_0xfa42e4[_0x7aec('0x1e')],function(_0x1628c1){return{'model':db[_0x1628c1['model']],'as':_0x1628c1['as'],'attributes':_0x1628c1[_0x7aec('0x20')],'include':_0x1628c1['include']?_[_0x7aec('0x1f')](_0x1628c1[_0x7aec('0x1e')],function(_0x334ab9){return{'model':db[_0x334ab9['model']],'as':_0x334ab9['as'],'attributes':_0x334ab9[_0x7aec('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7aec('0x21')](function(_0x18578e){logger[_0x7aec('0xc')](_0x7aec('0x17'),_0x47c0d9);logger['debug'](_0x7aec('0x17'),_0x47c0d9,JSON[_0x7aec('0x10')](_0x18578e));_0x5a8b9d(_0x18578e);})[_0x7aec('0x16')](function(_0x5a1cb8){logger['error'](_0x7aec('0x17'),_0x5a1cb8['message'],_0x47c0d9);_0x13605c(_0x42d072['error'](0x1f4,_0x5a1cb8[_0x7aec('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index c0f97f2..a018a9a 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 _0x5442=['emit','register','length','voiceExtension:','./voiceExtension.events','save','remove','update'];(function(_0x360baf,_0x39c5e7){var _0x38d920=function(_0x3c2b45){while(--_0x3c2b45){_0x360baf['push'](_0x360baf['shift']());}};_0x38d920(++_0x39c5e7);}(_0x5442,0x64));var _0x2544=function(_0x1f9503,_0x8e450b){_0x1f9503=_0x1f9503-0x0;var _0xaab94f=_0x5442[_0x1f9503];return _0xaab94f;};'use strict';var VoiceExtensionEvents=require(_0x2544('0x0'));var events=[_0x2544('0x1'),_0x2544('0x2'),_0x2544('0x3')];function createListener(_0x18165b,_0x37d9f0){return function(_0x32bc40){_0x37d9f0[_0x2544('0x4')](_0x18165b,_0x32bc40);};}function removeListener(_0x5d4b35,_0x3c4d83){return function(){VoiceExtensionEvents['removeListener'](_0x5d4b35,_0x3c4d83);};}exports[_0x2544('0x5')]=function(_0x2e7282){for(var _0x1d274c=0x0,_0x520487=events[_0x2544('0x6')];_0x1d274c<_0x520487;_0x1d274c++){var _0x38dfbe=events[_0x1d274c];var _0x2e136e=createListener(_0x2544('0x7')+_0x38dfbe,_0x2e7282);VoiceExtensionEvents['on'](_0x38dfbe,_0x2e136e);}}; \ No newline at end of file +var _0x82b4=['removeListener','register','length','voiceExtension:','./voiceExtension.events','remove','update','emit'];(function(_0x51b362,_0x2a3af3){var _0x18bd6=function(_0xd5fcdb){while(--_0xd5fcdb){_0x51b362['push'](_0x51b362['shift']());}};_0x18bd6(++_0x2a3af3);}(_0x82b4,0x94));var _0x482b=function(_0x4f2f4a,_0x218252){_0x4f2f4a=_0x4f2f4a-0x0;var _0x5e894f=_0x82b4[_0x4f2f4a];return _0x5e894f;};'use strict';var VoiceExtensionEvents=require(_0x482b('0x0'));var events=['save',_0x482b('0x1'),_0x482b('0x2')];function createListener(_0x3887b4,_0x5122fc){return function(_0x149aed){_0x5122fc[_0x482b('0x3')](_0x3887b4,_0x149aed);};}function removeListener(_0x4577fb,_0x51ba9e){return function(){VoiceExtensionEvents[_0x482b('0x4')](_0x4577fb,_0x51ba9e);};}exports[_0x482b('0x5')]=function(_0x3fb44d){for(var _0x2a32cc=0x0,_0x4d80e7=events[_0x482b('0x6')];_0x2a32cc<_0x4d80e7;_0x2a32cc++){var _0x50d9dd=events[_0x2a32cc];var _0x55f9d4=createListener(_0x482b('0x7')+_0x50d9dd,_0x3fb44d);VoiceExtensionEvents['on'](_0x50d9dd,_0x55f9d4);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 8f85355..f6a256e 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 _0x4e81=['put','update','delete','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','/:id','isAuthenticated','show','/:id/messages','getMessages','post','create'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4e81,0x1bc));var _0x14e8=function(_0x4d40dd,_0x39592b){_0x4d40dd=_0x4d40dd-0x0;var _0x1c51f2=_0x4e81[_0x4d40dd];return _0x1c51f2;};'use strict';var multer=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var path=require(_0x14e8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x14e8('0x3'));var auth=require(_0x14e8('0x4'));var interaction=require(_0x14e8('0x5'));var config=require(_0x14e8('0x6'));var controller=require(_0x14e8('0x7'));router[_0x14e8('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x14e8('0x8')](_0x14e8('0x9'),auth[_0x14e8('0xa')](),controller[_0x14e8('0xb')]);router[_0x14e8('0x8')](_0x14e8('0xc'),auth[_0x14e8('0xa')](),controller[_0x14e8('0xd')]);router[_0x14e8('0xe')]('/',auth['isAuthenticated'](),controller[_0x14e8('0xf')]);router[_0x14e8('0x10')](_0x14e8('0x9'),auth[_0x14e8('0xa')](),controller[_0x14e8('0x11')]);router[_0x14e8('0x12')](_0x14e8('0x9'),auth[_0x14e8('0xa')](),controller['destroy']);module[_0x14e8('0x13')]=router; \ No newline at end of file +var _0x78f0=['isAuthenticated','/:id','show','/:id/messages','getMessages','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMail.controller','get'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0x78f0,0x15d));var _0x078f=function(_0x1ca3e1,_0x1971c3){_0x1ca3e1=_0x1ca3e1-0x0;var _0x2217a1=_0x78f0[_0x1ca3e1];return _0x2217a1;};'use strict';var multer=require(_0x078f('0x0'));var util=require(_0x078f('0x1'));var path=require(_0x078f('0x2'));var timeout=require(_0x078f('0x3'));var express=require(_0x078f('0x4'));var router=express[_0x078f('0x5')]();var fs_extra=require(_0x078f('0x6'));var auth=require(_0x078f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x078f('0x8'));var controller=require(_0x078f('0x9'));router[_0x078f('0xa')]('/',auth[_0x078f('0xb')](),controller['index']);router[_0x078f('0xa')](_0x078f('0xc'),auth['isAuthenticated'](),controller[_0x078f('0xd')]);router[_0x078f('0xa')](_0x078f('0xe'),auth[_0x078f('0xb')](),controller[_0x078f('0xf')]);router[_0x078f('0x10')]('/',auth[_0x078f('0xb')](),controller[_0x078f('0x11')]);router['put'](_0x078f('0xc'),auth[_0x078f('0xb')](),controller['update']);router[_0x078f('0x12')](_0x078f('0xc'),auth[_0x078f('0xb')](),controller[_0x078f('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 68bbcc6..fceae6e 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 _0x9348=['exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','VIRTUAL','fullname','\x20-\x20','getDataValue','mailbox','sequelize'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x9348,0x10d));var _0x8934=function(_0x521847,_0x2812cb){_0x521847=_0x521847-0x0;var _0x17d69d=_0x9348[_0x521847];return _0x17d69d;};'use strict';var Sequelize=require(_0x8934('0x0'));module[_0x8934('0x1')]={'customer_id':{'type':Sequelize[_0x8934('0x2')]},'context':{'type':Sequelize[_0x8934('0x2')],'defaultValue':_0x8934('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x8934('0x2')],'defaultValue':'','allowNull':![],'unique':_0x8934('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x8934('0x2')]},'email':{'type':Sequelize[_0x8934('0x2')],'validate':{'isEmail':!![]},'set':function(_0xefbef9){this[_0x8934('0x5')](_0x8934('0x6'),typeof _0xefbef9===_0x8934('0x7')&&_0xefbef9['trim']()?_0xefbef9[_0x8934('0x8')]():null);}},'pager':{'type':Sequelize[_0x8934('0x2')]},'tz':{'type':Sequelize[_0x8934('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x8934('0x9')]('yes','no'),'defaultValue':_0x8934('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x8934('0x2')]},'callback':{'type':Sequelize[_0x8934('0x2')]},'review':{'type':Sequelize[_0x8934('0x9')](_0x8934('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x8934('0x9')](_0x8934('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x8934('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x8934('0x9')](_0x8934('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x8934('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x8934('0x9')](_0x8934('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x8934('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x8934('0x9')](_0x8934('0xa'),'no'),'defaultValue':_0x8934('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x8934('0x9')](_0x8934('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x8934('0x9')](_0x8934('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x8934('0x9')]('yes','no'),'defaultValue':_0x8934('0xa'),'allowNull':![]},'stamp':{'type':_0x8934('0xc')},'emailsubject':{'type':Sequelize[_0x8934('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x8934('0xd')],'get':function(){return this['getDataValue'](_0x8934('0xe'))+_0x8934('0xf')+this[_0x8934('0x10')](_0x8934('0x11'));}}}; \ No newline at end of file +var _0x8f4c=['fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','trim','central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue'];(function(_0x1e2bfb,_0x2c2e81){var _0x25b346=function(_0x23615f){while(--_0x23615f){_0x1e2bfb['push'](_0x1e2bfb['shift']());}};_0x25b346(++_0x2c2e81);}(_0x8f4c,0x113));var _0xc8f4=function(_0x449235,_0x567736){_0x449235=_0x449235-0x0;var _0x2446ad=_0x8f4c[_0x449235];return _0x2446ad;};'use strict';var Sequelize=require(_0xc8f4('0x0'));module[_0xc8f4('0x1')]={'customer_id':{'type':Sequelize[_0xc8f4('0x2')]},'context':{'type':Sequelize[_0xc8f4('0x2')],'defaultValue':_0xc8f4('0x3'),'unique':_0xc8f4('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xc8f4('0x4')},'password':{'type':Sequelize[_0xc8f4('0x2')]},'fullname':{'type':Sequelize[_0xc8f4('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x32cd80){this['setDataValue']('email',typeof _0x32cd80==='string'&&_0x32cd80[_0xc8f4('0x5')]()?_0x32cd80['trim']():null);}},'pager':{'type':Sequelize[_0xc8f4('0x2')]},'tz':{'type':Sequelize[_0xc8f4('0x2')],'defaultValue':_0xc8f4('0x6')},'attach':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':_0xc8f4('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0xc8f4('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xc8f4('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xc8f4('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xc8f4('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xc8f4('0x7')]('yes','no'),'defaultValue':_0xc8f4('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xc8f4('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xc8f4('0x2')]},'emailbody':{'type':Sequelize[_0xc8f4('0x2')]},'maxsecs':{'type':Sequelize[_0xc8f4('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xc8f4('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xc8f4('0xb')],'get':function(){return this[_0xc8f4('0xc')](_0xc8f4('0xd'))+_0xc8f4('0xe')+this[_0xc8f4('0xc')](_0xc8f4('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index ac80f01..b6fa00c 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 _0xac26=['../../config/license/util','../../mysqldb','status','json','count','offset','limit','apply','reject','update','then','destroy','UserProfileResource','end','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','VoiceMail','findAll','rows','catch','show','params','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','VoiceMailMessage','hasOwnProperty','mailbox','findAndCountAll','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','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'];(function(_0x3526d7,_0x3f2835){var _0x163b3c=function(_0x1e7e0d){while(--_0x1e7e0d){_0x3526d7['push'](_0x3526d7['shift']());}};_0x163b3c(++_0x3f2835);}(_0xac26,0x9c));var _0x6ac2=function(_0x4ad26c,_0x430a18){_0x4ad26c=_0x4ad26c-0x0;var _0x112f3e=_0xac26[_0x4ad26c];return _0x112f3e;};'use strict';var pdf=require(_0x6ac2('0x0'));var emlformat=require(_0x6ac2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6ac2('0x2'));var jsonpatch=require(_0x6ac2('0x3'));var rp=require(_0x6ac2('0x4'));var moment=require(_0x6ac2('0x5'));var BPromise=require(_0x6ac2('0x6'));var Mustache=require(_0x6ac2('0x7'));var util=require(_0x6ac2('0x8'));var path=require(_0x6ac2('0x9'));var sox=require('sox');var csv=require(_0x6ac2('0xa'));var ejs=require(_0x6ac2('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6ac2('0xc'));var squel=require(_0x6ac2('0xd'));var crypto=require(_0x6ac2('0xe'));var jsforce=require(_0x6ac2('0xf'));var deskjs=require(_0x6ac2('0x10'));var toCsv=require(_0x6ac2('0xa'));var querystring=require(_0x6ac2('0x11'));var Papa=require(_0x6ac2('0x12'));var Redis=require('ioredis');var authService=require(_0x6ac2('0x13'));var qs=require(_0x6ac2('0x14'));var as=require(_0x6ac2('0x15'));var hardwareService=require(_0x6ac2('0x16'));var logger=require(_0x6ac2('0x17'))('api');var utils=require(_0x6ac2('0x18'));var config=require(_0x6ac2('0x19'));var licenseUtil=require(_0x6ac2('0x1a'));var db=require(_0x6ac2('0x1b'))['db'];function respondWithStatusCode(_0x5273f0,_0x4d5e40){_0x4d5e40=_0x4d5e40||0xcc;return function(_0x23a4ea){if(_0x23a4ea){return _0x5273f0['sendStatus'](_0x4d5e40);}return _0x5273f0['status'](_0x4d5e40)['end']();};}function respondWithResult(_0x21316f,_0x2c9edf){_0x2c9edf=_0x2c9edf||0xc8;return function(_0x588e99){if(_0x588e99){return _0x21316f[_0x6ac2('0x1c')](_0x2c9edf)[_0x6ac2('0x1d')](_0x588e99);}};}function respondWithFilteredResult(_0x5d8696,_0x1a56ce){return function(_0x50cb75){if(_0x50cb75){var _0x56cca4=_0x50cb75[_0x6ac2('0x1e')],_0x20a26f=_0x1a56ce[_0x6ac2('0x1f')],_0x1d064d=_0x1a56ce['offset']+_0x1a56ce[_0x6ac2('0x20')],_0x5a7200;if(_0x1d064d>=_0x56cca4){_0x1d064d=_0x56cca4;_0x5a7200=0xc8;}else{_0x5a7200=0xce;}_0x5d8696[_0x6ac2('0x1c')](_0x5a7200);return _0x5d8696['set']('Content-Range',_0x20a26f+'-'+_0x1d064d+'/'+_0x56cca4)[_0x6ac2('0x1d')](_0x50cb75);}return null;};}function patchUpdates(_0x11f69a){return function(_0x380e30){try{jsonpatch[_0x6ac2('0x21')](_0x380e30,_0x11f69a,!![]);}catch(_0x496899){return BPromise[_0x6ac2('0x22')](_0x496899);}return _0x380e30['save']();};}function saveUpdates(_0xb5ab0,_0x271eaa){return function(_0x12bb61){if(_0x12bb61){return _0x12bb61[_0x6ac2('0x23')](_0xb5ab0)[_0x6ac2('0x24')](function(_0x33c0b5){return _0x33c0b5;});}return null;};}function removeEntity(_0x87ae78,_0x11fea4){return function(_0xbec9a3){if(_0xbec9a3){return _0xbec9a3[_0x6ac2('0x25')]()[_0x6ac2('0x24')](function(){var _0x28b68a=_0xbec9a3['get']({'plain':!![]});var _0x532d57='Voicemails';return db[_0x6ac2('0x26')]['destroy']({'where':{'type':_0x532d57,'resourceId':_0x28b68a['id']}})[_0x6ac2('0x24')](function(){return _0xbec9a3;});})['then'](function(){_0x87ae78['status'](0xcc)[_0x6ac2('0x27')]();});}};}function handleEntityNotFound(_0x44198f,_0x970b76){return function(_0x5e8c9d){if(!_0x5e8c9d){_0x44198f[_0x6ac2('0x28')](0x194);}return _0x5e8c9d;};}function handleError(_0x115cc3,_0x579cfc){_0x579cfc=_0x579cfc||0x1f4;return function(_0x68fc46){logger[_0x6ac2('0x29')](_0x68fc46[_0x6ac2('0x2a')]);if(_0x68fc46[_0x6ac2('0x2b')]){delete _0x68fc46[_0x6ac2('0x2b')];}_0x115cc3[_0x6ac2('0x1c')](_0x579cfc)['send'](_0x68fc46);};}exports[_0x6ac2('0x2c')]=function(_0x120561,_0x3197e5){var _0x46fddf={},_0x12e356={},_0x185fbb={'count':0x0,'rows':[]};var _0x5f1204=_[_0x6ac2('0x2d')](db['VoiceMail'][_0x6ac2('0x2e')],function(_0x2dba4c){return{'name':_0x2dba4c[_0x6ac2('0x2f')],'type':_0x2dba4c[_0x6ac2('0x30')][_0x6ac2('0x31')]};});_0x12e356[_0x6ac2('0x32')]=_[_0x6ac2('0x2d')](_0x5f1204,_0x6ac2('0x2b'));_0x12e356['query']=_[_0x6ac2('0x33')](_0x120561['query']);_0x12e356['filters']=_['intersection'](_0x12e356[_0x6ac2('0x32')],_0x12e356[_0x6ac2('0x34')]);_0x46fddf['attributes']=_[_0x6ac2('0x35')](_0x12e356[_0x6ac2('0x32')],qs[_0x6ac2('0x36')](_0x120561[_0x6ac2('0x34')][_0x6ac2('0x36')]));_0x46fddf[_0x6ac2('0x37')]=_0x46fddf[_0x6ac2('0x37')][_0x6ac2('0x38')]?_0x46fddf[_0x6ac2('0x37')]:_0x12e356[_0x6ac2('0x32')];if(!_0x120561[_0x6ac2('0x34')]['hasOwnProperty'](_0x6ac2('0x39'))){_0x46fddf['limit']=qs[_0x6ac2('0x20')](_0x120561['query'][_0x6ac2('0x20')]);_0x46fddf[_0x6ac2('0x1f')]=qs[_0x6ac2('0x1f')](_0x120561[_0x6ac2('0x34')]['offset']);}_0x46fddf[_0x6ac2('0x3a')]=qs[_0x6ac2('0x3b')](_0x120561['query']['sort']);_0x46fddf['where']=qs[_0x6ac2('0x3c')](_[_0x6ac2('0x3d')](_0x120561[_0x6ac2('0x34')],_0x12e356['filters']),_0x5f1204);if(_0x120561[_0x6ac2('0x34')][_0x6ac2('0x3e')]){_0x46fddf[_0x6ac2('0x3f')]=_[_0x6ac2('0x40')](_0x46fddf[_0x6ac2('0x3f')],{'$or':_[_0x6ac2('0x2d')](_0x5f1204,function(_0x986627){if(_0x986627[_0x6ac2('0x30')]!==_0x6ac2('0x41')){var _0xf89f6a={};_0xf89f6a[_0x986627[_0x6ac2('0x2b')]]={'$like':'%'+_0x120561['query']['filter']+'%'};return _0xf89f6a;}})});}_0x46fddf=_[_0x6ac2('0x40')]({},_0x46fddf,_0x120561[_0x6ac2('0x42')]);var _0x40c95d={'where':_0x46fddf[_0x6ac2('0x3f')]};return db[_0x6ac2('0x43')][_0x6ac2('0x1e')](_0x40c95d)[_0x6ac2('0x24')](function(_0x2a1375){_0x185fbb[_0x6ac2('0x1e')]=_0x2a1375;if(_0x120561[_0x6ac2('0x34')]['includeAll']){_0x46fddf['include']=[{'all':!![]}];}return db['VoiceMail'][_0x6ac2('0x44')](_0x46fddf);})[_0x6ac2('0x24')](function(_0x171e79){_0x185fbb[_0x6ac2('0x45')]=_0x171e79;return _0x185fbb;})[_0x6ac2('0x24')](respondWithFilteredResult(_0x3197e5,_0x46fddf))[_0x6ac2('0x46')](handleError(_0x3197e5,null));};exports[_0x6ac2('0x47')]=function(_0x3764c8,_0x151b4c){var _0x22f40f={'raw':!![],'where':{'id':_0x3764c8[_0x6ac2('0x48')]['id']}},_0x15bcf3={};_0x15bcf3['model']=_['keys'](db[_0x6ac2('0x43')][_0x6ac2('0x2e')]);_0x15bcf3[_0x6ac2('0x34')]=_[_0x6ac2('0x33')](_0x3764c8['query']);_0x15bcf3[_0x6ac2('0x3c')]=_['intersection'](_0x15bcf3[_0x6ac2('0x32')],_0x15bcf3[_0x6ac2('0x34')]);_0x22f40f['attributes']=_[_0x6ac2('0x35')](_0x15bcf3[_0x6ac2('0x32')],qs[_0x6ac2('0x36')](_0x3764c8[_0x6ac2('0x34')][_0x6ac2('0x36')]));_0x22f40f[_0x6ac2('0x37')]=_0x22f40f[_0x6ac2('0x37')]['length']?_0x22f40f[_0x6ac2('0x37')]:_0x15bcf3[_0x6ac2('0x32')];if(_0x3764c8[_0x6ac2('0x34')][_0x6ac2('0x49')]){_0x22f40f[_0x6ac2('0x4a')]=[{'all':!![]}];}_0x22f40f=_[_0x6ac2('0x40')]({},_0x22f40f,_0x3764c8['options']);return db['VoiceMail'][_0x6ac2('0x4b')](_0x22f40f)[_0x6ac2('0x24')](handleEntityNotFound(_0x151b4c,null))[_0x6ac2('0x24')](respondWithResult(_0x151b4c,null))['catch'](handleError(_0x151b4c,null));};exports[_0x6ac2('0x4c')]=function(_0x49165c,_0x4951e3){return db[_0x6ac2('0x43')][_0x6ac2('0x4c')](_0x49165c[_0x6ac2('0x4d')],{})[_0x6ac2('0x24')](function(_0x3dd40c){var _0x1e95af=_0x49165c[_0x6ac2('0x4e')][_0x6ac2('0x4f')]({'plain':!![]});if(!_0x1e95af)throw new Error(_0x6ac2('0x50'));if(_0x1e95af[_0x6ac2('0x51')]==='user'){var _0x26c84d=_0x3dd40c[_0x6ac2('0x4f')]({'plain':!![]});var _0x5a5395=_0x6ac2('0x52');return db['UserProfileSection'][_0x6ac2('0x4b')]({'where':{'name':_0x5a5395,'userProfileId':_0x1e95af[_0x6ac2('0x53')]},'raw':!![]})[_0x6ac2('0x24')](function(_0x149fb5){if(_0x149fb5&&_0x149fb5[_0x6ac2('0x54')]===0x0){return db['UserProfileResource'][_0x6ac2('0x4c')]({'name':_0x26c84d[_0x6ac2('0x2b')],'resourceId':_0x26c84d['id'],'type':_0x149fb5[_0x6ac2('0x2b')],'sectionId':_0x149fb5['id']},{})['then'](function(){return _0x3dd40c;});}else{return _0x3dd40c;}})[_0x6ac2('0x46')](function(_0x4e727a){logger[_0x6ac2('0x29')](_0x6ac2('0x55'),_0x4e727a);throw _0x4e727a;});}return _0x3dd40c;})[_0x6ac2('0x24')](respondWithResult(_0x4951e3,0xc9))[_0x6ac2('0x46')](handleError(_0x4951e3,null));};exports[_0x6ac2('0x23')]=function(_0x4b8bdc,_0x472142){if(_0x4b8bdc[_0x6ac2('0x4d')]['id']){delete _0x4b8bdc['body']['id'];}return db[_0x6ac2('0x43')][_0x6ac2('0x4b')]({'where':{'id':_0x4b8bdc[_0x6ac2('0x48')]['id']}})[_0x6ac2('0x24')](handleEntityNotFound(_0x472142,null))['then'](saveUpdates(_0x4b8bdc['body'],null))[_0x6ac2('0x24')](respondWithResult(_0x472142,null))[_0x6ac2('0x46')](handleError(_0x472142,null));};exports['destroy']=function(_0x2cb481,_0x201266){return db[_0x6ac2('0x43')][_0x6ac2('0x4b')]({'where':{'id':_0x2cb481[_0x6ac2('0x48')]['id']}})[_0x6ac2('0x24')](handleEntityNotFound(_0x201266,null))[_0x6ac2('0x24')](removeEntity(_0x201266,null))[_0x6ac2('0x46')](handleError(_0x201266,null));};exports['getMessages']=function(_0x1c5492,_0x4e9ed0,_0x17f1c5){return db[_0x6ac2('0x43')][_0x6ac2('0x56')]({'where':{'id':_0x1c5492[_0x6ac2('0x48')]['id']}})[_0x6ac2('0x24')](handleEntityNotFound(_0x4e9ed0,null))[_0x6ac2('0x24')](function(_0x3f927c){var _0x3fd49d;var _0x9fac32={},_0x2dee4a={};_0x2dee4a[_0x6ac2('0x32')]=_[_0x6ac2('0x33')](db[_0x6ac2('0x57')][_0x6ac2('0x2e')]);_0x2dee4a[_0x6ac2('0x34')]=_[_0x6ac2('0x33')](_0x1c5492[_0x6ac2('0x34')]);_0x2dee4a[_0x6ac2('0x3c')]=_[_0x6ac2('0x35')](_0x2dee4a[_0x6ac2('0x32')],_0x2dee4a[_0x6ac2('0x34')]);_0x9fac32[_0x6ac2('0x37')]=_[_0x6ac2('0x35')](_0x2dee4a[_0x6ac2('0x32')],qs['fields'](_0x1c5492['query'][_0x6ac2('0x36')]));_0x9fac32['attributes']=_0x9fac32['attributes'][_0x6ac2('0x38')]?_0x9fac32[_0x6ac2('0x37')]:_0x2dee4a['model'];if(!_0x1c5492[_0x6ac2('0x34')][_0x6ac2('0x58')]('nolimit')){_0x9fac32['limit']=qs[_0x6ac2('0x20')](_0x1c5492[_0x6ac2('0x34')][_0x6ac2('0x20')]);_0x9fac32[_0x6ac2('0x1f')]=qs[_0x6ac2('0x1f')](_0x1c5492[_0x6ac2('0x34')][_0x6ac2('0x1f')]);}_0x9fac32['order']=qs[_0x6ac2('0x3b')](_0x1c5492[_0x6ac2('0x34')][_0x6ac2('0x3b')]);_0x9fac32['where']=qs['filters'](_[_0x6ac2('0x3d')](_0x1c5492[_0x6ac2('0x34')],_0x2dee4a[_0x6ac2('0x3c')]));if(_0x1c5492[_0x6ac2('0x34')][_0x6ac2('0x3e')]){_0x9fac32['where']=_[_0x6ac2('0x40')](_0x9fac32[_0x6ac2('0x3f')],{'$or':_['map'](_0x9fac32[_0x6ac2('0x37')],function(_0x42c5df){var _0x3ec3de={};_0x3ec3de[_0x42c5df]={'$like':'%'+_0x1c5492[_0x6ac2('0x34')][_0x6ac2('0x3e')]+'%'};return _0x3ec3de;})});}_0x9fac32[_0x6ac2('0x3f')]=_[_0x6ac2('0x40')](_0x9fac32[_0x6ac2('0x3f')],{'mailboxuser':_0x3f927c[_0x6ac2('0x59')]});_0x9fac32=_['merge']({},_0x9fac32,_0x1c5492[_0x6ac2('0x42')]);return db['VoiceMailMessage'][_0x6ac2('0x5a')](_0x9fac32)['then'](respondWithFilteredResult(_0x4e9ed0,_0x9fac32));})['catch'](handleError(_0x4e9ed0,null));}; \ No newline at end of file +var _0xb53b=['where','filter','merge','options','count','includeAll','include','findAll','params','keys','find','catch','body','role','user','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','VoiceMailMessage','pick','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','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','limit','set','apply','reject','save','update','then','get','Voicemails','UserProfileResource','destroy','error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x4cb272,_0x52c0e9){var _0x57b4aa=function(_0x1efefb){while(--_0x1efefb){_0x4cb272['push'](_0x4cb272['shift']());}};_0x57b4aa(++_0x52c0e9);}(_0xb53b,0x1d4));var _0xbb53=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xb53b[_0xf71120];return _0xbe2fd3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbb53('0x0'));var rimraf=require(_0xbb53('0x1'));var zipdir=require(_0xbb53('0x2'));var jsonpatch=require(_0xbb53('0x3'));var rp=require(_0xbb53('0x4'));var moment=require(_0xbb53('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbb53('0x6'));var util=require('util');var path=require(_0xbb53('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbb53('0x8'));var fs=require('fs');var fs_extra=require(_0xbb53('0x9'));var _=require(_0xbb53('0xa'));var squel=require(_0xbb53('0xb'));var crypto=require(_0xbb53('0xc'));var jsforce=require(_0xbb53('0xd'));var deskjs=require(_0xbb53('0xe'));var toCsv=require(_0xbb53('0xf'));var querystring=require(_0xbb53('0x10'));var Papa=require(_0xbb53('0x11'));var Redis=require(_0xbb53('0x12'));var authService=require(_0xbb53('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xbb53('0x14'));var hardwareService=require(_0xbb53('0x15'));var logger=require(_0xbb53('0x16'))(_0xbb53('0x17'));var utils=require(_0xbb53('0x18'));var config=require(_0xbb53('0x19'));var licenseUtil=require(_0xbb53('0x1a'));var db=require(_0xbb53('0x1b'))['db'];function respondWithStatusCode(_0x37f124,_0x31c3bc){_0x31c3bc=_0x31c3bc||0xcc;return function(_0x3b0187){if(_0x3b0187){return _0x37f124[_0xbb53('0x1c')](_0x31c3bc);}return _0x37f124[_0xbb53('0x1d')](_0x31c3bc)[_0xbb53('0x1e')]();};}function respondWithResult(_0x264cc3,_0x359b99){_0x359b99=_0x359b99||0xc8;return function(_0x4cf87e){if(_0x4cf87e){return _0x264cc3[_0xbb53('0x1d')](_0x359b99)[_0xbb53('0x1f')](_0x4cf87e);}};}function respondWithFilteredResult(_0x4a5e48,_0x36c84c){return function(_0x9b101f){if(_0x9b101f){var _0x54f24d=_0x9b101f['count'],_0x2f4532=_0x36c84c[_0xbb53('0x20')],_0x265308=_0x36c84c['offset']+_0x36c84c[_0xbb53('0x21')],_0x565880;if(_0x265308>=_0x54f24d){_0x265308=_0x54f24d;_0x565880=0xc8;}else{_0x565880=0xce;}_0x4a5e48[_0xbb53('0x1d')](_0x565880);return _0x4a5e48[_0xbb53('0x22')]('Content-Range',_0x2f4532+'-'+_0x265308+'/'+_0x54f24d)[_0xbb53('0x1f')](_0x9b101f);}return null;};}function patchUpdates(_0x203a00){return function(_0x44b0a5){try{jsonpatch[_0xbb53('0x23')](_0x44b0a5,_0x203a00,!![]);}catch(_0x464ada){return BPromise[_0xbb53('0x24')](_0x464ada);}return _0x44b0a5[_0xbb53('0x25')]();};}function saveUpdates(_0x20ec73,_0x46e506){return function(_0x9dd8c5){if(_0x9dd8c5){return _0x9dd8c5[_0xbb53('0x26')](_0x20ec73)[_0xbb53('0x27')](function(_0x14635b){return _0x14635b;});}return null;};}function removeEntity(_0x1bb4ac,_0x44731a){return function(_0x16aa88){if(_0x16aa88){return _0x16aa88['destroy']()['then'](function(){var _0x490d62=_0x16aa88[_0xbb53('0x28')]({'plain':!![]});var _0x5ba377=_0xbb53('0x29');return db[_0xbb53('0x2a')][_0xbb53('0x2b')]({'where':{'type':_0x5ba377,'resourceId':_0x490d62['id']}})[_0xbb53('0x27')](function(){return _0x16aa88;});})[_0xbb53('0x27')](function(){_0x1bb4ac[_0xbb53('0x1d')](0xcc)[_0xbb53('0x1e')]();});}};}function handleEntityNotFound(_0x4ee9e8,_0x579850){return function(_0x2cfb22){if(!_0x2cfb22){_0x4ee9e8[_0xbb53('0x1c')](0x194);}return _0x2cfb22;};}function handleError(_0x4e5efc,_0x35c49a){_0x35c49a=_0x35c49a||0x1f4;return function(_0x3f3b68){logger[_0xbb53('0x2c')](_0x3f3b68[_0xbb53('0x2d')]);if(_0x3f3b68[_0xbb53('0x2e')]){delete _0x3f3b68[_0xbb53('0x2e')];}_0x4e5efc[_0xbb53('0x1d')](_0x35c49a)[_0xbb53('0x2f')](_0x3f3b68);};}exports[_0xbb53('0x30')]=function(_0x25ebd6,_0x2684ac){var _0x18d8ac={},_0x3c459c={},_0x5a38a6={'count':0x0,'rows':[]};var _0x5c06ea=_[_0xbb53('0x31')](db[_0xbb53('0x32')][_0xbb53('0x33')],function(_0xa8cd9a){return{'name':_0xa8cd9a[_0xbb53('0x34')],'type':_0xa8cd9a[_0xbb53('0x35')][_0xbb53('0x36')]};});_0x3c459c[_0xbb53('0x37')]=_[_0xbb53('0x31')](_0x5c06ea,_0xbb53('0x2e'));_0x3c459c[_0xbb53('0x38')]=_['keys'](_0x25ebd6[_0xbb53('0x38')]);_0x3c459c[_0xbb53('0x39')]=_['intersection'](_0x3c459c['model'],_0x3c459c[_0xbb53('0x38')]);_0x18d8ac['attributes']=_[_0xbb53('0x3a')](_0x3c459c[_0xbb53('0x37')],qs[_0xbb53('0x3b')](_0x25ebd6[_0xbb53('0x38')][_0xbb53('0x3b')]));_0x18d8ac[_0xbb53('0x3c')]=_0x18d8ac[_0xbb53('0x3c')][_0xbb53('0x3d')]?_0x18d8ac[_0xbb53('0x3c')]:_0x3c459c['model'];if(!_0x25ebd6['query'][_0xbb53('0x3e')](_0xbb53('0x3f'))){_0x18d8ac[_0xbb53('0x21')]=qs[_0xbb53('0x21')](_0x25ebd6[_0xbb53('0x38')][_0xbb53('0x21')]);_0x18d8ac['offset']=qs[_0xbb53('0x20')](_0x25ebd6[_0xbb53('0x38')][_0xbb53('0x20')]);}_0x18d8ac[_0xbb53('0x40')]=qs[_0xbb53('0x41')](_0x25ebd6[_0xbb53('0x38')][_0xbb53('0x41')]);_0x18d8ac[_0xbb53('0x42')]=qs['filters'](_['pick'](_0x25ebd6[_0xbb53('0x38')],_0x3c459c[_0xbb53('0x39')]),_0x5c06ea);if(_0x25ebd6[_0xbb53('0x38')][_0xbb53('0x43')]){_0x18d8ac[_0xbb53('0x42')]=_[_0xbb53('0x44')](_0x18d8ac[_0xbb53('0x42')],{'$or':_[_0xbb53('0x31')](_0x5c06ea,function(_0x4a0a90){if(_0x4a0a90[_0xbb53('0x35')]!=='VIRTUAL'){var _0x3baea0={};_0x3baea0[_0x4a0a90['name']]={'$like':'%'+_0x25ebd6[_0xbb53('0x38')][_0xbb53('0x43')]+'%'};return _0x3baea0;}})});}_0x18d8ac=_[_0xbb53('0x44')]({},_0x18d8ac,_0x25ebd6[_0xbb53('0x45')]);var _0x2f57a7={'where':_0x18d8ac['where']};return db[_0xbb53('0x32')][_0xbb53('0x46')](_0x2f57a7)[_0xbb53('0x27')](function(_0x476e0f){_0x5a38a6['count']=_0x476e0f;if(_0x25ebd6[_0xbb53('0x38')][_0xbb53('0x47')]){_0x18d8ac[_0xbb53('0x48')]=[{'all':!![]}];}return db['VoiceMail'][_0xbb53('0x49')](_0x18d8ac);})['then'](function(_0x1b01ac){_0x5a38a6['rows']=_0x1b01ac;return _0x5a38a6;})[_0xbb53('0x27')](respondWithFilteredResult(_0x2684ac,_0x18d8ac))['catch'](handleError(_0x2684ac,null));};exports['show']=function(_0x448531,_0x31de26){var _0x5b29bb={'raw':!![],'where':{'id':_0x448531[_0xbb53('0x4a')]['id']}},_0x25c520={};_0x25c520[_0xbb53('0x37')]=_[_0xbb53('0x4b')](db[_0xbb53('0x32')][_0xbb53('0x33')]);_0x25c520['query']=_[_0xbb53('0x4b')](_0x448531[_0xbb53('0x38')]);_0x25c520[_0xbb53('0x39')]=_[_0xbb53('0x3a')](_0x25c520[_0xbb53('0x37')],_0x25c520['query']);_0x5b29bb['attributes']=_[_0xbb53('0x3a')](_0x25c520[_0xbb53('0x37')],qs[_0xbb53('0x3b')](_0x448531[_0xbb53('0x38')][_0xbb53('0x3b')]));_0x5b29bb[_0xbb53('0x3c')]=_0x5b29bb[_0xbb53('0x3c')][_0xbb53('0x3d')]?_0x5b29bb[_0xbb53('0x3c')]:_0x25c520[_0xbb53('0x37')];if(_0x448531[_0xbb53('0x38')][_0xbb53('0x47')]){_0x5b29bb[_0xbb53('0x48')]=[{'all':!![]}];}_0x5b29bb=_[_0xbb53('0x44')]({},_0x5b29bb,_0x448531[_0xbb53('0x45')]);return db[_0xbb53('0x32')][_0xbb53('0x4c')](_0x5b29bb)[_0xbb53('0x27')](handleEntityNotFound(_0x31de26,null))[_0xbb53('0x27')](respondWithResult(_0x31de26,null))[_0xbb53('0x4d')](handleError(_0x31de26,null));};exports['create']=function(_0x9bbe97,_0x510ece){return db[_0xbb53('0x32')]['create'](_0x9bbe97[_0xbb53('0x4e')],{})[_0xbb53('0x27')](function(_0x434114){var _0x5a2012=_0x9bbe97['user']['get']({'plain':!![]});if(!_0x5a2012)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a2012[_0xbb53('0x4f')]===_0xbb53('0x50')){var _0x4c3e83=_0x434114[_0xbb53('0x28')]({'plain':!![]});var _0x252a80=_0xbb53('0x29');return db['UserProfileSection'][_0xbb53('0x4c')]({'where':{'name':_0x252a80,'userProfileId':_0x5a2012['userProfileId']},'raw':!![]})[_0xbb53('0x27')](function(_0x534bb4){if(_0x534bb4&&_0x534bb4[_0xbb53('0x51')]===0x0){return db[_0xbb53('0x2a')][_0xbb53('0x52')]({'name':_0x4c3e83[_0xbb53('0x2e')],'resourceId':_0x4c3e83['id'],'type':_0x534bb4[_0xbb53('0x2e')],'sectionId':_0x534bb4['id']},{})['then'](function(){return _0x434114;});}else{return _0x434114;}})[_0xbb53('0x4d')](function(_0x199cdb){logger[_0xbb53('0x2c')](_0xbb53('0x53'),_0x199cdb);throw _0x199cdb;});}return _0x434114;})[_0xbb53('0x27')](respondWithResult(_0x510ece,0xc9))['catch'](handleError(_0x510ece,null));};exports[_0xbb53('0x26')]=function(_0x269a38,_0x1efec6){if(_0x269a38[_0xbb53('0x4e')]['id']){delete _0x269a38[_0xbb53('0x4e')]['id'];}return db['VoiceMail']['find']({'where':{'id':_0x269a38[_0xbb53('0x4a')]['id']}})[_0xbb53('0x27')](handleEntityNotFound(_0x1efec6,null))['then'](saveUpdates(_0x269a38[_0xbb53('0x4e')],null))['then'](respondWithResult(_0x1efec6,null))[_0xbb53('0x4d')](handleError(_0x1efec6,null));};exports[_0xbb53('0x2b')]=function(_0x42b982,_0x18f9da){return db['VoiceMail'][_0xbb53('0x4c')]({'where':{'id':_0x42b982[_0xbb53('0x4a')]['id']}})[_0xbb53('0x27')](handleEntityNotFound(_0x18f9da,null))[_0xbb53('0x27')](removeEntity(_0x18f9da,null))[_0xbb53('0x4d')](handleError(_0x18f9da,null));};exports['getMessages']=function(_0x2904d9,_0x26ed35,_0x2bc564){return db[_0xbb53('0x32')][_0xbb53('0x54')]({'where':{'id':_0x2904d9[_0xbb53('0x4a')]['id']}})['then'](handleEntityNotFound(_0x26ed35,null))[_0xbb53('0x27')](function(_0x2d6539){var _0x30d1a3;var _0x80a03b={},_0x93e540={};_0x93e540[_0xbb53('0x37')]=_['keys'](db[_0xbb53('0x55')]['rawAttributes']);_0x93e540[_0xbb53('0x38')]=_[_0xbb53('0x4b')](_0x2904d9[_0xbb53('0x38')]);_0x93e540[_0xbb53('0x39')]=_[_0xbb53('0x3a')](_0x93e540[_0xbb53('0x37')],_0x93e540[_0xbb53('0x38')]);_0x80a03b[_0xbb53('0x3c')]=_[_0xbb53('0x3a')](_0x93e540[_0xbb53('0x37')],qs[_0xbb53('0x3b')](_0x2904d9[_0xbb53('0x38')][_0xbb53('0x3b')]));_0x80a03b[_0xbb53('0x3c')]=_0x80a03b[_0xbb53('0x3c')][_0xbb53('0x3d')]?_0x80a03b['attributes']:_0x93e540[_0xbb53('0x37')];if(!_0x2904d9['query']['hasOwnProperty'](_0xbb53('0x3f'))){_0x80a03b['limit']=qs[_0xbb53('0x21')](_0x2904d9[_0xbb53('0x38')][_0xbb53('0x21')]);_0x80a03b[_0xbb53('0x20')]=qs[_0xbb53('0x20')](_0x2904d9[_0xbb53('0x38')]['offset']);}_0x80a03b[_0xbb53('0x40')]=qs['sort'](_0x2904d9[_0xbb53('0x38')][_0xbb53('0x41')]);_0x80a03b['where']=qs['filters'](_[_0xbb53('0x56')](_0x2904d9[_0xbb53('0x38')],_0x93e540[_0xbb53('0x39')]));if(_0x2904d9['query'][_0xbb53('0x43')]){_0x80a03b[_0xbb53('0x42')]=_[_0xbb53('0x44')](_0x80a03b[_0xbb53('0x42')],{'$or':_[_0xbb53('0x31')](_0x80a03b['attributes'],function(_0x40d3bb){var _0x206c55={};_0x206c55[_0x40d3bb]={'$like':'%'+_0x2904d9[_0xbb53('0x38')]['filter']+'%'};return _0x206c55;})});}_0x80a03b[_0xbb53('0x42')]=_[_0xbb53('0x44')](_0x80a03b['where'],{'mailboxuser':_0x2d6539[_0xbb53('0x57')]});_0x80a03b=_['merge']({},_0x80a03b,_0x2904d9[_0xbb53('0x45')]);return db[_0xbb53('0x55')][_0xbb53('0x58')](_0x80a03b)[_0xbb53('0x27')](respondWithFilteredResult(_0x26ed35,_0x80a03b));})['catch'](handleError(_0x26ed35,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 0c28744..88235b5 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 _0xea32=['rimraf','./voiceMail.attributes','exports','define','voice_voicemail','mailbox_context','mailbox','context','util','api','moment','request-promise','path'];(function(_0x1d05b0,_0x45a400){var _0x304aa2=function(_0x52bcae){while(--_0x52bcae){_0x1d05b0['push'](_0x1d05b0['shift']());}};_0x304aa2(++_0x45a400);}(_0xea32,0xff));var _0x2ea3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xea32[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x2ea3('0x0'));var logger=require('../../config/logger')(_0x2ea3('0x1'));var moment=require(_0x2ea3('0x2'));var BPromise=require('bluebird');var rp=require(_0x2ea3('0x3'));var fs=require('fs');var path=require(_0x2ea3('0x4'));var rimraf=require(_0x2ea3('0x5'));var config=require('../../config/environment');var attributes=require(_0x2ea3('0x6'));module[_0x2ea3('0x7')]=function(_0x46c75b,_0xd4ad5b){return _0x46c75b[_0x2ea3('0x8')]('VoiceMail',attributes,{'tableName':_0x2ea3('0x9'),'paranoid':![],'indexes':[{'name':_0x2ea3('0xa'),'fields':[_0x2ea3('0xb'),_0x2ea3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0ab9=['define','VoiceMail','mailbox_context','mailbox','context','lodash','../../config/logger','bluebird','path','rimraf','../../config/environment','./voiceMail.attributes','exports'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0x0ab9,0x157));var _0x90ab=function(_0x3b8edb,_0x3ccc3f){_0x3b8edb=_0x3b8edb-0x0;var _0x2e42aa=_0x0ab9[_0x3b8edb];return _0x2e42aa;};'use strict';var _=require(_0x90ab('0x0'));var util=require('util');var logger=require(_0x90ab('0x1'))('api');var moment=require('moment');var BPromise=require(_0x90ab('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x90ab('0x3'));var rimraf=require(_0x90ab('0x4'));var config=require(_0x90ab('0x5'));var attributes=require(_0x90ab('0x6'));module[_0x90ab('0x7')]=function(_0x200245,_0x1b7760){return _0x200245[_0x90ab('0x8')](_0x90ab('0x9'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x90ab('0xa'),'fields':[_0x90ab('0xb'),_0x90ab('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index be24749..0e8bce6 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 _0xfce6=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x487ab4,_0x1e24e8){var _0x3bef77=function(_0x5ce664){while(--_0x5ce664){_0x487ab4['push'](_0x487ab4['shift']());}};_0x3bef77(++_0x1e24e8);}(_0xfce6,0xd5));var _0x6fce=function(_0x313677,_0xd1a9ed){_0x313677=_0x313677-0x0;var _0x53a1d2=_0xfce6[_0x313677];return _0x53a1d2;};'use strict';var _=require(_0x6fce('0x0'));var util=require(_0x6fce('0x1'));var moment=require(_0x6fce('0x2'));var BPromise=require('bluebird');var rs=require(_0x6fce('0x3'));var fs=require('fs');var Redis=require(_0x6fce('0x4'));var db=require(_0x6fce('0x5'))['db'];var utils=require(_0x6fce('0x6'));var logger=require(_0x6fce('0x7'))(_0x6fce('0x8'));var config=require(_0x6fce('0x9'));var jayson=require(_0x6fce('0xa'));var client=jayson['client'][_0x6fce('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xda9da1,_0x2d0f01,_0x5be94e){return new BPromise(function(_0x136a77,_0x3748e6){return client[_0x6fce('0xc')](_0xda9da1,_0x5be94e)[_0x6fce('0xd')](function(_0xd43812){logger['info'](_0x6fce('0xe'),_0x2d0f01,_0x6fce('0xf'));logger[_0x6fce('0x10')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x2d0f01,'request\x20sent',JSON[_0x6fce('0x11')](_0xd43812));if(_0xd43812[_0x6fce('0x12')]){if(_0xd43812[_0x6fce('0x12')]['code']===0x1f4){logger[_0x6fce('0x12')](_0x6fce('0xe'),_0x2d0f01,_0xd43812[_0x6fce('0x12')][_0x6fce('0x13')]);return _0x3748e6(_0xd43812[_0x6fce('0x12')][_0x6fce('0x13')]);}logger['error'](_0x6fce('0xe'),_0x2d0f01,_0xd43812[_0x6fce('0x12')][_0x6fce('0x13')]);return _0x136a77(_0xd43812[_0x6fce('0x12')][_0x6fce('0x13')]);}else{logger[_0x6fce('0x14')](_0x6fce('0xe'),_0x2d0f01,_0x6fce('0xf'));_0x136a77(_0xd43812[_0x6fce('0x15')][_0x6fce('0x13')]);}})['catch'](function(_0x16b8e1){logger['error']('VoiceMail,\x20%s,\x20%s',_0x2d0f01,_0x16b8e1);_0x3748e6(_0x16b8e1);});});} \ No newline at end of file +var _0x852d=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x31193e,_0x5a0185){var _0xc79fc4=function(_0x33015f){while(--_0x33015f){_0x31193e['push'](_0x31193e['shift']());}};_0xc79fc4(++_0x5a0185);}(_0x852d,0x178));var _0xd852=function(_0x409cc3,_0x37cf1f){_0x409cc3=_0x409cc3-0x0;var _0x2fbe31=_0x852d[_0x409cc3];return _0x2fbe31;};'use strict';var _=require('lodash');var util=require(_0xd852('0x0'));var moment=require(_0xd852('0x1'));var BPromise=require(_0xd852('0x2'));var rs=require(_0xd852('0x3'));var fs=require('fs');var Redis=require(_0xd852('0x4'));var db=require(_0xd852('0x5'))['db'];var utils=require(_0xd852('0x6'));var logger=require('../../config/logger')(_0xd852('0x7'));var config=require(_0xd852('0x8'));var jayson=require(_0xd852('0x9'));var client=jayson[_0xd852('0xa')][_0xd852('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbd0948,_0x58a494,_0x2d7d8f){return new BPromise(function(_0x11370c,_0x4e3a4c){return client[_0xd852('0xc')](_0xbd0948,_0x2d7d8f)[_0xd852('0xd')](function(_0x46db61){logger[_0xd852('0xe')](_0xd852('0xf'),_0x58a494,_0xd852('0x10'));logger[_0xd852('0x11')](_0xd852('0x12'),_0x58a494,_0xd852('0x10'),JSON[_0xd852('0x13')](_0x46db61));if(_0x46db61[_0xd852('0x14')]){if(_0x46db61[_0xd852('0x14')][_0xd852('0x15')]===0x1f4){logger['error'](_0xd852('0xf'),_0x58a494,_0x46db61[_0xd852('0x14')][_0xd852('0x16')]);return _0x4e3a4c(_0x46db61[_0xd852('0x14')][_0xd852('0x16')]);}logger[_0xd852('0x14')]('VoiceMail,\x20%s,\x20%s',_0x58a494,_0x46db61[_0xd852('0x14')][_0xd852('0x16')]);return _0x11370c(_0x46db61[_0xd852('0x14')][_0xd852('0x16')]);}else{logger[_0xd852('0xe')](_0xd852('0xf'),_0x58a494,_0xd852('0x10'));_0x11370c(_0x46db61[_0xd852('0x17')][_0xd852('0x16')]);}})[_0xd852('0x18')](function(_0x2c6f34){logger['error']('VoiceMail,\x20%s,\x20%s',_0x58a494,_0x2c6f34);_0x4e3a4c(_0x2c6f34);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index cc0a006..bd2143a 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 _0x52ef=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x10fb6a,_0x264e37){var _0x51818a=function(_0x3d97a7){while(--_0x3d97a7){_0x10fb6a['push'](_0x10fb6a['shift']());}};_0x51818a(++_0x264e37);}(_0x52ef,0x1d9));var _0xf52e=function(_0x35563c,_0x1393e9){_0x35563c=_0x35563c-0x0;var _0x2a763c=_0x52ef[_0x35563c];return _0x2a763c;};'use strict';var multer=require(_0xf52e('0x0'));var util=require(_0xf52e('0x1'));var path=require(_0xf52e('0x2'));var timeout=require(_0xf52e('0x3'));var express=require(_0xf52e('0x4'));var router=express[_0xf52e('0x5')]();var fs_extra=require(_0xf52e('0x6'));var auth=require(_0xf52e('0x7'));var interaction=require(_0xf52e('0x8'));var config=require(_0xf52e('0x9'));var controller=require('./voiceMailMessage.controller');router[_0xf52e('0xa')]('/',auth[_0xf52e('0xb')](),controller[_0xf52e('0xc')]);router[_0xf52e('0xa')](_0xf52e('0xd'),auth[_0xf52e('0xb')](),controller[_0xf52e('0xe')]);router['get'](_0xf52e('0xf'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0xf52e('0xb')](),controller['create']);router[_0xf52e('0x10')](_0xf52e('0xd'),auth['isAuthenticated'](),controller[_0xf52e('0x11')]);router[_0xf52e('0x12')](_0xf52e('0xd'),auth[_0xf52e('0xb')](),controller[_0xf52e('0x13')]);module['exports']=router; \ No newline at end of file +var _0x71b1=['post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/download','download'];(function(_0x1564c0,_0x5980c2){var _0x310ae7=function(_0x890a86){while(--_0x890a86){_0x1564c0['push'](_0x1564c0['shift']());}};_0x310ae7(++_0x5980c2);}(_0x71b1,0x166));var _0x171b=function(_0x3d5416,_0x28a599){_0x3d5416=_0x3d5416-0x0;var _0x17712c=_0x71b1[_0x3d5416];return _0x17712c;};'use strict';var multer=require(_0x171b('0x0'));var util=require(_0x171b('0x1'));var path=require(_0x171b('0x2'));var timeout=require(_0x171b('0x3'));var express=require(_0x171b('0x4'));var router=express[_0x171b('0x5')]();var fs_extra=require(_0x171b('0x6'));var auth=require(_0x171b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x171b('0x8'));var controller=require('./voiceMailMessage.controller');router['get']('/',auth[_0x171b('0x9')](),controller[_0x171b('0xa')]);router[_0x171b('0xb')](_0x171b('0xc'),auth[_0x171b('0x9')](),controller[_0x171b('0xd')]);router[_0x171b('0xb')](_0x171b('0xe'),auth[_0x171b('0x9')](),controller[_0x171b('0xf')]);router[_0x171b('0x10')]('/',auth[_0x171b('0x9')](),controller[_0x171b('0x11')]);router[_0x171b('0x12')]('/:id',auth[_0x171b('0x9')](),controller['update']);router[_0x171b('0x13')](_0x171b('0xc'),auth[_0x171b('0x9')](),controller[_0x171b('0x14')]);module[_0x171b('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index b87d549..2d0f114 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 _0x53d0=['STRING','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0x53d0,0x124));var _0x053d=function(_0x5bd3e5,_0x1fb5d5){_0x5bd3e5=_0x5bd3e5-0x0;var _0x4dca06=_0x53d0[_0x5bd3e5];return _0x4dca06;};'use strict';var Sequelize=require(_0x053d('0x0'));module[_0x053d('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x24db8d){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x053d('0x2')],'defaultValue':''},'context':{'type':Sequelize[_0x053d('0x2')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x053d('0x2')],'defaultValue':''},'callerid':{'type':Sequelize[_0x053d('0x2')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x053d('0x2')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x053d('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x053d('0x2')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x053d('0x3')),'defaultValue':null},'flag':{'type':Sequelize[_0x053d('0x2')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x053d('0x4'),'defaultValue':Sequelize[_0x053d('0x5')](_0x053d('0x6'))}}; \ No newline at end of file +var _0x67ca=['exports','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','sequelize'];(function(_0x1cd23d,_0xec4ea5){var _0x5e8ad5=function(_0x1603d8){while(--_0x1603d8){_0x1cd23d['push'](_0x1cd23d['shift']());}};_0x5e8ad5(++_0xec4ea5);}(_0x67ca,0x179));var _0xa67c=function(_0x5ab2c1,_0x503874){_0x5ab2c1=_0x5ab2c1-0x0;var _0x4da32d=_0x67ca[_0x5ab2c1];return _0x4da32d;};'use strict';var Sequelize=require(_0xa67c('0x0'));module[_0xa67c('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x13e752){return this[_0xa67c('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xa67c('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xa67c('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xa67c('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xa67c('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xa67c('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xa67c('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xa67c('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xa67c('0x5')](_0xa67c('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xa67c('0x4')],'defaultValue':''},'stamp':{'type':_0xa67c('0x7'),'defaultValue':Sequelize[_0xa67c('0x8')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index dbf6250..934e128 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 _0xb0ab=['fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','fields','include','find','create','body','download','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','html-pdf','rimraf','zip-dir','fast-json-patch','moment','util','sox','ejs'];(function(_0x5ad3d3,_0x2d400c){var _0x4344e7=function(_0x557356){while(--_0x557356){_0x5ad3d3['push'](_0x5ad3d3['shift']());}};_0x4344e7(++_0x2d400c);}(_0xb0ab,0xfa));var _0xbb0a=function(_0xcf6302,_0x4f64c4){_0xcf6302=_0xcf6302-0x0;var _0x29f243=_0xb0ab[_0xcf6302];return _0x29f243;};'use strict';var pdf=require(_0xbb0a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb0a('0x1'));var zipdir=require(_0xbb0a('0x2'));var jsonpatch=require(_0xbb0a('0x3'));var rp=require('request-promise');var moment=require(_0xbb0a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbb0a('0x5'));var path=require('path');var sox=require(_0xbb0a('0x6'));var csv=require('to-csv');var ejs=require(_0xbb0a('0x7'));var fs=require('fs');var fs_extra=require(_0xbb0a('0x8'));var _=require(_0xbb0a('0x9'));var squel=require(_0xbb0a('0xa'));var crypto=require(_0xbb0a('0xb'));var jsforce=require(_0xbb0a('0xc'));var deskjs=require(_0xbb0a('0xd'));var toCsv=require(_0xbb0a('0xe'));var querystring=require(_0xbb0a('0xf'));var Papa=require(_0xbb0a('0x10'));var Redis=require(_0xbb0a('0x11'));var authService=require(_0xbb0a('0x12'));var qs=require(_0xbb0a('0x13'));var as=require(_0xbb0a('0x14'));var hardwareService=require(_0xbb0a('0x15'));var logger=require(_0xbb0a('0x16'))(_0xbb0a('0x17'));var utils=require(_0xbb0a('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xbb0a('0x19'));var db=require(_0xbb0a('0x1a'))['db'];function respondWithStatusCode(_0x3457df,_0x223bbf){_0x223bbf=_0x223bbf||0xcc;return function(_0x19295c){if(_0x19295c){return _0x3457df[_0xbb0a('0x1b')](_0x223bbf);}return _0x3457df['status'](_0x223bbf)[_0xbb0a('0x1c')]();};}function respondWithResult(_0xe3b32e,_0x447e37){_0x447e37=_0x447e37||0xc8;return function(_0x325d2f){if(_0x325d2f){return _0xe3b32e[_0xbb0a('0x1d')](_0x447e37)[_0xbb0a('0x1e')](_0x325d2f);}};}function respondWithFilteredResult(_0x166d19,_0x52e449){return function(_0x7fcb82){if(_0x7fcb82){var _0x531e67=_0x7fcb82[_0xbb0a('0x1f')],_0x2b2d33=_0x52e449['offset'],_0x53cce1=_0x52e449[_0xbb0a('0x20')]+_0x52e449[_0xbb0a('0x21')],_0x1e2fe4;if(_0x53cce1>=_0x531e67){_0x53cce1=_0x531e67;_0x1e2fe4=0xc8;}else{_0x1e2fe4=0xce;}_0x166d19[_0xbb0a('0x1d')](_0x1e2fe4);return _0x166d19[_0xbb0a('0x22')](_0xbb0a('0x23'),_0x2b2d33+'-'+_0x53cce1+'/'+_0x531e67)[_0xbb0a('0x1e')](_0x7fcb82);}return null;};}function patchUpdates(_0x52cd70){return function(_0x3fc94d){try{jsonpatch[_0xbb0a('0x24')](_0x3fc94d,_0x52cd70,!![]);}catch(_0x54bdc4){return BPromise[_0xbb0a('0x25')](_0x54bdc4);}return _0x3fc94d[_0xbb0a('0x26')]();};}function saveUpdates(_0x43e6c3,_0x207edd){return function(_0xbd2a1e){if(_0xbd2a1e){return _0xbd2a1e[_0xbb0a('0x27')](_0x43e6c3)['then'](function(_0x801670){return _0x801670;});}return null;};}function removeEntity(_0x16f52b,_0x302258){return function(_0x5490b8){if(_0x5490b8){return _0x5490b8[_0xbb0a('0x28')]()[_0xbb0a('0x29')](function(){_0x16f52b[_0xbb0a('0x1d')](0xcc)[_0xbb0a('0x1c')]();});}};}function handleEntityNotFound(_0xb8dbd6,_0x45e4fd){return function(_0x4d39af){if(!_0x4d39af){_0xb8dbd6[_0xbb0a('0x1b')](0x194);}return _0x4d39af;};}function handleError(_0x423566,_0x471352){_0x471352=_0x471352||0x1f4;return function(_0x43af91){logger[_0xbb0a('0x2a')](_0x43af91['stack']);if(_0x43af91[_0xbb0a('0x2b')]){delete _0x43af91['name'];}_0x423566[_0xbb0a('0x1d')](_0x471352)[_0xbb0a('0x2c')](_0x43af91);};}exports['index']=function(_0x827712,_0x1dfad3){var _0x3d49d2={},_0x45ebf0={},_0x4b8b16={'count':0x0,'rows':[]};var _0x239755=_[_0xbb0a('0x2d')](db[_0xbb0a('0x2e')][_0xbb0a('0x2f')],function(_0x3dbd31){return{'name':_0x3dbd31[_0xbb0a('0x30')],'type':_0x3dbd31[_0xbb0a('0x31')][_0xbb0a('0x32')]};});_0x45ebf0[_0xbb0a('0x33')]=_[_0xbb0a('0x34')](_[_0xbb0a('0x2d')](_0x239755,_0xbb0a('0x2b')),[_0xbb0a('0x2b')]);_0x45ebf0[_0xbb0a('0x35')]=_[_0xbb0a('0x36')](_0x827712[_0xbb0a('0x35')]);_0x45ebf0[_0xbb0a('0x37')]=_[_0xbb0a('0x38')](_0x45ebf0[_0xbb0a('0x33')],_0x45ebf0[_0xbb0a('0x35')]);_0x3d49d2[_0xbb0a('0x39')]=_['intersection'](_0x45ebf0[_0xbb0a('0x33')],qs['fields'](_0x827712[_0xbb0a('0x35')]['fields']));_0x3d49d2[_0xbb0a('0x39')]=_0x3d49d2[_0xbb0a('0x39')][_0xbb0a('0x3a')]?_0x3d49d2[_0xbb0a('0x39')]:_0x45ebf0['model'];if(!_0x827712[_0xbb0a('0x35')][_0xbb0a('0x3b')](_0xbb0a('0x3c'))){_0x3d49d2['limit']=qs[_0xbb0a('0x21')](_0x827712[_0xbb0a('0x35')]['limit']);_0x3d49d2['offset']=qs[_0xbb0a('0x20')](_0x827712[_0xbb0a('0x35')][_0xbb0a('0x20')]);}_0x3d49d2['order']=qs[_0xbb0a('0x3d')](_0x827712['query']['sort']);_0x3d49d2[_0xbb0a('0x3e')]=qs['filters'](_[_0xbb0a('0x3f')](_0x827712[_0xbb0a('0x35')],_0x45ebf0[_0xbb0a('0x37')]),_0x239755);if(_0x827712['query'][_0xbb0a('0x40')]){_0x3d49d2['where']=_[_0xbb0a('0x41')](_0x3d49d2[_0xbb0a('0x3e')],{'$or':_['map'](_0x239755,function(_0x19721e){if(_0x19721e[_0xbb0a('0x31')]!=='VIRTUAL'){var _0x846365={};_0x846365[_0x19721e['name']]={'$like':'%'+_0x827712[_0xbb0a('0x35')]['filter']+'%'};return _0x846365;}})});}_0x3d49d2=_[_0xbb0a('0x41')]({},_0x3d49d2,_0x827712[_0xbb0a('0x42')]);var _0x5d15fa={'where':_0x3d49d2[_0xbb0a('0x3e')]};return db['VoiceMailMessage'][_0xbb0a('0x1f')](_0x5d15fa)[_0xbb0a('0x29')](function(_0x1e4f59){_0x4b8b16['count']=_0x1e4f59;if(_0x827712['query'][_0xbb0a('0x43')]){_0x3d49d2['include']=[{'all':!![]}];}return db['VoiceMailMessage'][_0xbb0a('0x44')](_0x3d49d2);})['then'](function(_0x9119f1){_0x4b8b16[_0xbb0a('0x45')]=_0x9119f1;return _0x4b8b16;})[_0xbb0a('0x29')](respondWithFilteredResult(_0x1dfad3,_0x3d49d2))[_0xbb0a('0x46')](handleError(_0x1dfad3,null));};exports['show']=function(_0x438b02,_0x52a965){var _0x3ca78a={'raw':!![],'where':{'id':_0x438b02[_0xbb0a('0x47')]['id']}},_0x1208f0={};_0x1208f0['model']=_[_0xbb0a('0x36')](db[_0xbb0a('0x2e')][_0xbb0a('0x2f')]);_0x1208f0[_0xbb0a('0x35')]=_['keys'](_0x438b02['query']);_0x1208f0['filters']=_[_0xbb0a('0x38')](_0x1208f0[_0xbb0a('0x33')],_0x1208f0['query']);_0x3ca78a[_0xbb0a('0x39')]=_['intersection'](_0x1208f0['model'],qs[_0xbb0a('0x48')](_0x438b02[_0xbb0a('0x35')][_0xbb0a('0x48')]));_0x3ca78a[_0xbb0a('0x39')]=_0x3ca78a['attributes'][_0xbb0a('0x3a')]?_0x3ca78a['attributes']:_0x1208f0['model'];if(_0x438b02['query']['includeAll']){_0x3ca78a[_0xbb0a('0x49')]=[{'all':!![]}];}_0x3ca78a=_[_0xbb0a('0x41')]({},_0x3ca78a,_0x438b02[_0xbb0a('0x42')]);return db['VoiceMailMessage'][_0xbb0a('0x4a')](_0x3ca78a)[_0xbb0a('0x29')](handleEntityNotFound(_0x52a965,null))[_0xbb0a('0x29')](respondWithResult(_0x52a965,null))[_0xbb0a('0x46')](handleError(_0x52a965,null));};exports[_0xbb0a('0x4b')]=function(_0x2948a7,_0x255546){return db[_0xbb0a('0x2e')][_0xbb0a('0x4b')](_0x2948a7[_0xbb0a('0x4c')],{})[_0xbb0a('0x29')](respondWithResult(_0x255546,0xc9))[_0xbb0a('0x46')](handleError(_0x255546,null));};exports[_0xbb0a('0x27')]=function(_0x34bb5d,_0x4b59bc){if(_0x34bb5d['body']['id']){delete _0x34bb5d[_0xbb0a('0x4c')]['id'];}return db[_0xbb0a('0x2e')][_0xbb0a('0x4a')]({'where':{'id':_0x34bb5d[_0xbb0a('0x47')]['id']}})['then'](handleEntityNotFound(_0x4b59bc,null))[_0xbb0a('0x29')](saveUpdates(_0x34bb5d[_0xbb0a('0x4c')],null))[_0xbb0a('0x29')](respondWithResult(_0x4b59bc,null))[_0xbb0a('0x46')](handleError(_0x4b59bc,null));};exports[_0xbb0a('0x28')]=function(_0x1c6532,_0x584062){return db['VoiceMailMessage']['find']({'where':{'id':_0x1c6532['params']['id']}})[_0xbb0a('0x29')](handleEntityNotFound(_0x584062,null))[_0xbb0a('0x29')](removeEntity(_0x584062,null))[_0xbb0a('0x46')](handleError(_0x584062,null));};exports[_0xbb0a('0x4d')]=function(_0x359fc0,_0x1523ef,_0x1e697d){return db['VoiceMailMessage']['find']({'where':{'id':_0x359fc0[_0xbb0a('0x47')]['id']},'attributes':['id',_0xbb0a('0x4e'),_0xbb0a('0x4f')]})[_0xbb0a('0x29')](handleEntityNotFound(_0x1523ef,null))[_0xbb0a('0x29')](function(_0x14fcf4){if(_0x14fcf4){if(!_0x14fcf4['recording']){throw new db['Sequelize'][(_0xbb0a('0x50'))](_0xbb0a('0x51'));}var _0x4faf69={'Content-Type':'audio/wav','Content-Disposition':_0xbb0a('0x52')};if(_0x14fcf4[_0xbb0a('0x4f')]){_0x4faf69[_0xbb0a('0x53')]=_0xbb0a('0x54')+_0x14fcf4['msg_id']+_0xbb0a('0x55');}_0x1523ef['set'](_0x4faf69);return _0x1523ef[_0xbb0a('0x2c')](new Buffer(_0x14fcf4[_0xbb0a('0x4e')]));}})[_0xbb0a('0x46')](handleError(_0x1523ef,null));}; \ No newline at end of file +var _0x6772=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','destroy','then','error','stack','send','map','VoiceMailMessage','fieldName','type','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','merge','filter','options','count','includeAll','include','catch','params','rawAttributes','find','body','update','download','msg_id','recording','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api'];(function(_0x435fd6,_0x401cbc){var _0x5c5944=function(_0x32f366){while(--_0x32f366){_0x435fd6['push'](_0x435fd6['shift']());}};_0x5c5944(++_0x401cbc);}(_0x6772,0x85));var _0x2677=function(_0x4261ab,_0x4757a9){_0x4261ab=_0x4261ab-0x0;var _0x5a20b9=_0x6772[_0x4261ab];return _0x5a20b9;};'use strict';var pdf=require(_0x2677('0x0'));var emlformat=require(_0x2677('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2677('0x2'));var jsonpatch=require(_0x2677('0x3'));var rp=require(_0x2677('0x4'));var moment=require(_0x2677('0x5'));var BPromise=require(_0x2677('0x6'));var Mustache=require(_0x2677('0x7'));var util=require(_0x2677('0x8'));var path=require('path');var sox=require(_0x2677('0x9'));var csv=require('to-csv');var ejs=require(_0x2677('0xa'));var fs=require('fs');var fs_extra=require(_0x2677('0xb'));var _=require(_0x2677('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2677('0xd'));var toCsv=require(_0x2677('0xe'));var querystring=require('querystring');var Papa=require(_0x2677('0xf'));var Redis=require(_0x2677('0x10'));var authService=require(_0x2677('0x11'));var qs=require(_0x2677('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2677('0x13'));var logger=require('../../config/logger')(_0x2677('0x14'));var utils=require(_0x2677('0x15'));var config=require(_0x2677('0x16'));var licenseUtil=require(_0x2677('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ca5a0,_0x64715e){_0x64715e=_0x64715e||0xcc;return function(_0x4218da){if(_0x4218da){return _0x3ca5a0[_0x2677('0x18')](_0x64715e);}return _0x3ca5a0[_0x2677('0x19')](_0x64715e)[_0x2677('0x1a')]();};}function respondWithResult(_0x2d8f47,_0x4f69a3){_0x4f69a3=_0x4f69a3||0xc8;return function(_0x495de0){if(_0x495de0){return _0x2d8f47['status'](_0x4f69a3)[_0x2677('0x1b')](_0x495de0);}};}function respondWithFilteredResult(_0x444b44,_0x20c1f2){return function(_0x25ccb0){if(_0x25ccb0){var _0x227d04=_0x25ccb0['count'],_0x5bb37b=_0x20c1f2[_0x2677('0x1c')],_0x383e05=_0x20c1f2[_0x2677('0x1c')]+_0x20c1f2[_0x2677('0x1d')],_0xac80d2;if(_0x383e05>=_0x227d04){_0x383e05=_0x227d04;_0xac80d2=0xc8;}else{_0xac80d2=0xce;}_0x444b44[_0x2677('0x19')](_0xac80d2);return _0x444b44[_0x2677('0x1e')](_0x2677('0x1f'),_0x5bb37b+'-'+_0x383e05+'/'+_0x227d04)['json'](_0x25ccb0);}return null;};}function patchUpdates(_0x3096a3){return function(_0x1379cf){try{jsonpatch[_0x2677('0x20')](_0x1379cf,_0x3096a3,!![]);}catch(_0x37729a){return BPromise['reject'](_0x37729a);}return _0x1379cf[_0x2677('0x21')]();};}function saveUpdates(_0x73107c,_0x5c1e85){return function(_0x556e18){if(_0x556e18){return _0x556e18['update'](_0x73107c)['then'](function(_0x33a61a){return _0x33a61a;});}return null;};}function removeEntity(_0x73eff9,_0x4514c1){return function(_0x6fcb91){if(_0x6fcb91){return _0x6fcb91[_0x2677('0x22')]()[_0x2677('0x23')](function(){_0x73eff9['status'](0xcc)[_0x2677('0x1a')]();});}};}function handleEntityNotFound(_0x409723,_0x101451){return function(_0x323048){if(!_0x323048){_0x409723['sendStatus'](0x194);}return _0x323048;};}function handleError(_0xf7b5ed,_0x3e63b1){_0x3e63b1=_0x3e63b1||0x1f4;return function(_0x16da56){logger[_0x2677('0x24')](_0x16da56[_0x2677('0x25')]);if(_0x16da56['name']){delete _0x16da56['name'];}_0xf7b5ed[_0x2677('0x19')](_0x3e63b1)[_0x2677('0x26')](_0x16da56);};}exports['index']=function(_0x460f37,_0x9963c8){var _0x5440c2={},_0x4f7c24={},_0x56143b={'count':0x0,'rows':[]};var _0x21dc2d=_[_0x2677('0x27')](db[_0x2677('0x28')]['rawAttributes'],function(_0x3d52a3){return{'name':_0x3d52a3[_0x2677('0x29')],'type':_0x3d52a3[_0x2677('0x2a')]['key']};});_0x4f7c24[_0x2677('0x2b')]=_['differenceBy'](_[_0x2677('0x27')](_0x21dc2d,_0x2677('0x2c')),[_0x2677('0x2c')]);_0x4f7c24[_0x2677('0x2d')]=_[_0x2677('0x2e')](_0x460f37['query']);_0x4f7c24['filters']=_[_0x2677('0x2f')](_0x4f7c24[_0x2677('0x2b')],_0x4f7c24['query']);_0x5440c2[_0x2677('0x30')]=_[_0x2677('0x2f')](_0x4f7c24['model'],qs[_0x2677('0x31')](_0x460f37['query'][_0x2677('0x31')]));_0x5440c2[_0x2677('0x30')]=_0x5440c2[_0x2677('0x30')][_0x2677('0x32')]?_0x5440c2['attributes']:_0x4f7c24['model'];if(!_0x460f37[_0x2677('0x2d')][_0x2677('0x33')](_0x2677('0x34'))){_0x5440c2[_0x2677('0x1d')]=qs[_0x2677('0x1d')](_0x460f37['query'][_0x2677('0x1d')]);_0x5440c2[_0x2677('0x1c')]=qs[_0x2677('0x1c')](_0x460f37['query'][_0x2677('0x1c')]);}_0x5440c2[_0x2677('0x35')]=qs['sort'](_0x460f37[_0x2677('0x2d')]['sort']);_0x5440c2[_0x2677('0x36')]=qs[_0x2677('0x37')](_['pick'](_0x460f37[_0x2677('0x2d')],_0x4f7c24[_0x2677('0x37')]),_0x21dc2d);if(_0x460f37[_0x2677('0x2d')]['filter']){_0x5440c2[_0x2677('0x36')]=_[_0x2677('0x38')](_0x5440c2[_0x2677('0x36')],{'$or':_[_0x2677('0x27')](_0x21dc2d,function(_0x320826){if(_0x320826[_0x2677('0x2a')]!=='VIRTUAL'){var _0x3e728e={};_0x3e728e[_0x320826[_0x2677('0x2c')]]={'$like':'%'+_0x460f37[_0x2677('0x2d')][_0x2677('0x39')]+'%'};return _0x3e728e;}})});}_0x5440c2=_[_0x2677('0x38')]({},_0x5440c2,_0x460f37[_0x2677('0x3a')]);var _0x556dc4={'where':_0x5440c2['where']};return db[_0x2677('0x28')][_0x2677('0x3b')](_0x556dc4)[_0x2677('0x23')](function(_0xd44e5e){_0x56143b[_0x2677('0x3b')]=_0xd44e5e;if(_0x460f37[_0x2677('0x2d')][_0x2677('0x3c')]){_0x5440c2[_0x2677('0x3d')]=[{'all':!![]}];}return db[_0x2677('0x28')]['findAll'](_0x5440c2);})[_0x2677('0x23')](function(_0x3ceb31){_0x56143b['rows']=_0x3ceb31;return _0x56143b;})[_0x2677('0x23')](respondWithFilteredResult(_0x9963c8,_0x5440c2))[_0x2677('0x3e')](handleError(_0x9963c8,null));};exports['show']=function(_0x330c12,_0x560d67){var _0x3550e1={'raw':!![],'where':{'id':_0x330c12[_0x2677('0x3f')]['id']}},_0x117567={};_0x117567[_0x2677('0x2b')]=_[_0x2677('0x2e')](db[_0x2677('0x28')][_0x2677('0x40')]);_0x117567[_0x2677('0x2d')]=_[_0x2677('0x2e')](_0x330c12[_0x2677('0x2d')]);_0x117567[_0x2677('0x37')]=_[_0x2677('0x2f')](_0x117567[_0x2677('0x2b')],_0x117567[_0x2677('0x2d')]);_0x3550e1['attributes']=_['intersection'](_0x117567[_0x2677('0x2b')],qs[_0x2677('0x31')](_0x330c12[_0x2677('0x2d')]['fields']));_0x3550e1[_0x2677('0x30')]=_0x3550e1[_0x2677('0x30')][_0x2677('0x32')]?_0x3550e1[_0x2677('0x30')]:_0x117567['model'];if(_0x330c12['query'][_0x2677('0x3c')]){_0x3550e1[_0x2677('0x3d')]=[{'all':!![]}];}_0x3550e1=_[_0x2677('0x38')]({},_0x3550e1,_0x330c12['options']);return db['VoiceMailMessage'][_0x2677('0x41')](_0x3550e1)[_0x2677('0x23')](handleEntityNotFound(_0x560d67,null))['then'](respondWithResult(_0x560d67,null))[_0x2677('0x3e')](handleError(_0x560d67,null));};exports['create']=function(_0x14a355,_0x4c584a){return db[_0x2677('0x28')]['create'](_0x14a355[_0x2677('0x42')],{})[_0x2677('0x23')](respondWithResult(_0x4c584a,0xc9))['catch'](handleError(_0x4c584a,null));};exports[_0x2677('0x43')]=function(_0x3d6f21,_0x169f1f){if(_0x3d6f21['body']['id']){delete _0x3d6f21[_0x2677('0x42')]['id'];}return db[_0x2677('0x28')][_0x2677('0x41')]({'where':{'id':_0x3d6f21[_0x2677('0x3f')]['id']}})[_0x2677('0x23')](handleEntityNotFound(_0x169f1f,null))[_0x2677('0x23')](saveUpdates(_0x3d6f21[_0x2677('0x42')],null))[_0x2677('0x23')](respondWithResult(_0x169f1f,null))['catch'](handleError(_0x169f1f,null));};exports['destroy']=function(_0x5b739b,_0x3ffa1e){return db[_0x2677('0x28')]['find']({'where':{'id':_0x5b739b[_0x2677('0x3f')]['id']}})[_0x2677('0x23')](handleEntityNotFound(_0x3ffa1e,null))[_0x2677('0x23')](removeEntity(_0x3ffa1e,null))['catch'](handleError(_0x3ffa1e,null));};exports[_0x2677('0x44')]=function(_0x58e23e,_0x2a96d4,_0x18ae54){return db[_0x2677('0x28')][_0x2677('0x41')]({'where':{'id':_0x58e23e['params']['id']},'attributes':['id','recording',_0x2677('0x45')]})[_0x2677('0x23')](handleEntityNotFound(_0x2a96d4,null))['then'](function(_0x801770){if(_0x801770){if(!_0x801770[_0x2677('0x46')]){throw new db[(_0x2677('0x47'))]['ValidationError'](_0x2677('0x48'));}var _0x12eda2={'Content-Type':_0x2677('0x49'),'Content-Disposition':'attachment'};if(_0x801770[_0x2677('0x45')]){_0x12eda2[_0x2677('0x4a')]=_0x2677('0x4b')+_0x801770[_0x2677('0x45')]+_0x2677('0x4c');}_0x2a96d4['set'](_0x12eda2);return _0x2a96d4[_0x2677('0x26')](new Buffer(_0x801770['recording']));}})[_0x2677('0x3e')](handleError(_0x2a96d4,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 63b39e6..ff06e17 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 _0x9e81=['exports','define','voice_voicemail_messages','dir','lodash','util','api','moment','bluebird','rimraf','./voiceMailMessage.attributes'];(function(_0x38b6e9,_0x3deeef){var _0x1abcb1=function(_0x5a6c5b){while(--_0x5a6c5b){_0x38b6e9['push'](_0x38b6e9['shift']());}};_0x1abcb1(++_0x3deeef);}(_0x9e81,0x1d2));var _0x19e8=function(_0x2f0496,_0x1b9148){_0x2f0496=_0x2f0496-0x0;var _0x4969df=_0x9e81[_0x2f0496];return _0x4969df;};'use strict';var _=require(_0x19e8('0x0'));var util=require(_0x19e8('0x1'));var logger=require('../../config/logger')(_0x19e8('0x2'));var moment=require(_0x19e8('0x3'));var BPromise=require(_0x19e8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x19e8('0x5'));var config=require('../../config/environment');var attributes=require(_0x19e8('0x6'));module[_0x19e8('0x7')]=function(_0x339f5a,_0x488f7c){return _0x339f5a[_0x19e8('0x8')]('VoiceMailMessage',attributes,{'tableName':_0x19e8('0x9'),'paranoid':![],'indexes':[{'name':_0x19e8('0xa'),'fields':[_0x19e8('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0xedd1=['../../config/logger','api','bluebird','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash'];(function(_0x52a6e8,_0x16240d){var _0x28a198=function(_0x16760e){while(--_0x16760e){_0x52a6e8['push'](_0x52a6e8['shift']());}};_0x28a198(++_0x16240d);}(_0xedd1,0xfb));var _0x1edd=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0xedd1[_0x5a79e2];return _0x266c45;};'use strict';var _=require(_0x1edd('0x0'));var util=require('util');var logger=require(_0x1edd('0x1'))(_0x1edd('0x2'));var moment=require('moment');var BPromise=require(_0x1edd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1edd('0x4'));var config=require(_0x1edd('0x5'));var attributes=require(_0x1edd('0x6'));module[_0x1edd('0x7')]=function(_0x10d74e,_0x1d053e){return _0x10d74e[_0x1edd('0x8')](_0x1edd('0x9'),attributes,{'tableName':_0x1edd('0xa'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x1edd('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 cba1987..eff00f5 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 _0x57ca=['client','http','request','info','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1eacec,_0x597eb3){var _0x14c91f=function(_0x1d46ed){while(--_0x1d46ed){_0x1eacec['push'](_0x1eacec['shift']());}};_0x14c91f(++_0x597eb3);}(_0x57ca,0x108));var _0xa57c=function(_0x30ac82,_0x37496d){_0x30ac82=_0x30ac82-0x0;var _0x5d44b2=_0x57ca[_0x30ac82];return _0x5d44b2;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ 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','VoiceMailMessage,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x4dde74,_0x2c4415){var _0x10fca6=function(_0x1e53bc){while(--_0x1e53bc){_0x4dde74['push'](_0x4dde74['shift']());}};_0x10fca6(++_0x2c4415);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5000be,_0x3f5754){_0x5000be=_0x5000be-0x0;var _0x24ca84=_0x5f2f[_0x5000be];return _0x24ca84;};'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')]('VoiceMailMessage,\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/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index ee78a40..b0eb7d0 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 _0xb109=['removeSound','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','get','/:id/sounds','getSounds','post','create','put','/:id','delete','/:id/sounds/:id2'];(function(_0x2b7a75,_0x5cab72){var _0x126307=function(_0x2e57a9){while(--_0x2e57a9){_0x2b7a75['push'](_0x2b7a75['shift']());}};_0x126307(++_0x5cab72);}(_0xb109,0xe9));var _0x9b10=function(_0x4ccbee,_0x4dee9c){_0x4ccbee=_0x4ccbee-0x0;var _0x1af9ba=_0xb109[_0x4ccbee];return _0x1af9ba;};'use strict';var multer=require(_0x9b10('0x0'));var util=require('util');var path=require(_0x9b10('0x1'));var timeout=require('connect-timeout');var express=require(_0x9b10('0x2'));var router=express[_0x9b10('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9b10('0x4'));var interaction=require(_0x9b10('0x5'));var config=require(_0x9b10('0x6'));var controller=require(_0x9b10('0x7'));router['get']('/',auth[_0x9b10('0x8')](),controller[_0x9b10('0x9')]);router[_0x9b10('0xa')]('/:id',auth[_0x9b10('0x8')](),controller['show']);router[_0x9b10('0xa')](_0x9b10('0xb'),auth[_0x9b10('0x8')](),controller[_0x9b10('0xc')]);router[_0x9b10('0xd')]('/',auth[_0x9b10('0x8')](),controller[_0x9b10('0xe')]);router[_0x9b10('0xd')](_0x9b10('0xb'),auth[_0x9b10('0x8')](),controller['addSound']);router[_0x9b10('0xf')](_0x9b10('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x9b10('0x11')](_0x9b10('0x10'),auth['isAuthenticated'](),controller['destroy']);router[_0x9b10('0x11')](_0x9b10('0x12'),auth['isAuthenticated'](),controller[_0x9b10('0x13')]);module[_0x9b10('0x14')]=router; \ No newline at end of file +var _0x1986=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','index','/:id','show','get','/:id/sounds','isAuthenticated','getSounds','post','addSound','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer'];(function(_0x4b5f87,_0x35de99){var _0x41cc50=function(_0x389330){while(--_0x389330){_0x4b5f87['push'](_0x4b5f87['shift']());}};_0x41cc50(++_0x35de99);}(_0x1986,0xf1));var _0x6198=function(_0x1bf20d,_0x3db96f){_0x1bf20d=_0x1bf20d-0x0;var _0x3d9fa1=_0x1986[_0x1bf20d];return _0x3d9fa1;};'use strict';var multer=require(_0x6198('0x0'));var util=require(_0x6198('0x1'));var path=require(_0x6198('0x2'));var timeout=require(_0x6198('0x3'));var express=require('express');var router=express[_0x6198('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6198('0x5'));var interaction=require(_0x6198('0x6'));var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x6198('0x7')]);router['get'](_0x6198('0x8'),auth['isAuthenticated'](),controller[_0x6198('0x9')]);router[_0x6198('0xa')](_0x6198('0xb'),auth[_0x6198('0xc')](),controller[_0x6198('0xd')]);router[_0x6198('0xe')]('/',auth[_0x6198('0xc')](),controller['create']);router[_0x6198('0xe')](_0x6198('0xb'),auth[_0x6198('0xc')](),controller[_0x6198('0xf')]);router['put'](_0x6198('0x8'),auth['isAuthenticated'](),controller[_0x6198('0x10')]);router[_0x6198('0x11')]('/:id',auth[_0x6198('0xc')](),controller[_0x6198('0x12')]);router[_0x6198('0x11')](_0x6198('0x13'),auth['isAuthenticated'](),controller[_0x6198('0x14')]);module[_0x6198('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 675f6c8..9c6fb7f 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 _0xab32=['sequelize','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','mp3','alpha','BOOLEAN'];(function(_0x65edf8,_0x3f5105){var _0x36601b=function(_0x157386){while(--_0x157386){_0x65edf8['push'](_0x65edf8['shift']());}};_0x36601b(++_0x3f5105);}(_0xab32,0x1e4));var _0x2ab3=function(_0x127783,_0x258715){_0x127783=_0x127783-0x0;var _0x14f298=_0xab32[_0x127783];return _0x14f298;};'use strict';var Sequelize=require(_0x2ab3('0x0'));module['exports']={'name':{'type':Sequelize[_0x2ab3('0x1')],'allowNull':![],'unique':_0x2ab3('0x2')},'mode':{'type':Sequelize[_0x2ab3('0x3')](_0x2ab3('0x4'),_0x2ab3('0x5'),_0x2ab3('0x6'),_0x2ab3('0x7'),'quietmp3',_0x2ab3('0x8')),'allowNull':!![],'defaultValue':_0x2ab3('0x5')},'directory':{'type':Sequelize[_0x2ab3('0x1')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x2ab3('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x2ab3('0x1')],'allowNull':!![],'defaultValue':_0x2ab3('0x9')},'format':{'type':Sequelize[_0x2ab3('0x1')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x2ab3('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3b4c=['custom','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM'];(function(_0x12adcf,_0x16d51f){var _0x4c0f37=function(_0x47beea){while(--_0x47beea){_0x12adcf['push'](_0x12adcf['shift']());}};_0x4c0f37(++_0x16d51f);}(_0x3b4c,0xf2));var _0xc3b4=function(_0xb8ace2,_0x4a96a3){_0xb8ace2=_0xb8ace2-0x0;var _0xe747d8=_0x3b4c[_0xb8ace2];return _0xe747d8;};'use strict';var Sequelize=require(_0xc3b4('0x0'));module[_0xc3b4('0x1')]={'name':{'type':Sequelize[_0xc3b4('0x2')],'allowNull':![],'unique':_0xc3b4('0x3')},'mode':{'type':Sequelize[_0xc3b4('0x4')](_0xc3b4('0x5'),'files',_0xc3b4('0x6'),_0xc3b4('0x7'),_0xc3b4('0x8'),_0xc3b4('0x9')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xc3b4('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xc3b4('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xc3b4('0x2')],'allowNull':!![],'defaultValue':_0xc3b4('0xa')},'format':{'type':Sequelize[_0xc3b4('0x2')],'allowNull':!![]},'stamp':{'type':_0xc3b4('0xb')},'defaultEntry':{'type':Sequelize[_0xc3b4('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index d91364a..121973e 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 _0x1ef9=['findOne','save_name','createdAt','format','basename','extname','converted_format','%s.%s','symlinkSync','ValidationError','removeSound','id2','Sound','getSounds','pick','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','name','send','index','map','VoiceMusicOnHold','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','type','options','includeAll','include','findAll','rows','show','rawAttributes','catch','body','find','params','create','transaction','mode','files','directory','join','root','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','sequelize','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','message','addSound'];(function(_0x46f5cc,_0x591fa7){var _0x4c215f=function(_0x11be76){while(--_0x11be76){_0x46f5cc['push'](_0x46f5cc['shift']());}};_0x4c215f(++_0x591fa7);}(_0x1ef9,0x16e));var _0x91ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1ef9[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x91ef('0x0'));var zipdir=require(_0x91ef('0x1'));var jsonpatch=require(_0x91ef('0x2'));var rp=require(_0x91ef('0x3'));var moment=require(_0x91ef('0x4'));var BPromise=require(_0x91ef('0x5'));var Mustache=require(_0x91ef('0x6'));var util=require(_0x91ef('0x7'));var path=require(_0x91ef('0x8'));var sox=require('sox');var csv=require(_0x91ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x91ef('0xa'));var _=require(_0x91ef('0xb'));var squel=require(_0x91ef('0xc'));var crypto=require('crypto');var jsforce=require(_0x91ef('0xd'));var deskjs=require(_0x91ef('0xe'));var toCsv=require(_0x91ef('0x9'));var querystring=require(_0x91ef('0xf'));var Papa=require(_0x91ef('0x10'));var Redis=require(_0x91ef('0x11'));var authService=require(_0x91ef('0x12'));var qs=require(_0x91ef('0x13'));var as=require(_0x91ef('0x14'));var hardwareService=require(_0x91ef('0x15'));var logger=require(_0x91ef('0x16'))(_0x91ef('0x17'));var utils=require(_0x91ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x91ef('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ac9f8,_0x249d79){_0x249d79=_0x249d79||0xcc;return function(_0xb97d1b){if(_0xb97d1b){return _0x2ac9f8[_0x91ef('0x1a')](_0x249d79);}return _0x2ac9f8['status'](_0x249d79)[_0x91ef('0x1b')]();};}function respondWithResult(_0x1bbe77,_0x7f5d9e){_0x7f5d9e=_0x7f5d9e||0xc8;return function(_0xe5ed87){if(_0xe5ed87){return _0x1bbe77[_0x91ef('0x1c')](_0x7f5d9e)[_0x91ef('0x1d')](_0xe5ed87);}};}function respondWithFilteredResult(_0x6ab298,_0x484cdd){return function(_0x38e520){if(_0x38e520){var _0x199f09=_0x38e520[_0x91ef('0x1e')],_0x79d823=_0x484cdd[_0x91ef('0x1f')],_0xaa5e04=_0x484cdd[_0x91ef('0x1f')]+_0x484cdd[_0x91ef('0x20')],_0xbcaf24;if(_0xaa5e04>=_0x199f09){_0xaa5e04=_0x199f09;_0xbcaf24=0xc8;}else{_0xbcaf24=0xce;}_0x6ab298[_0x91ef('0x1c')](_0xbcaf24);return _0x6ab298[_0x91ef('0x21')](_0x91ef('0x22'),_0x79d823+'-'+_0xaa5e04+'/'+_0x199f09)[_0x91ef('0x1d')](_0x38e520);}return null;};}function patchUpdates(_0x296531){return function(_0x2feb09){try{jsonpatch[_0x91ef('0x23')](_0x2feb09,_0x296531,!![]);}catch(_0x15a6d9){return BPromise[_0x91ef('0x24')](_0x15a6d9);}return _0x2feb09[_0x91ef('0x25')]();};}function saveUpdates(_0x590ffb,_0x39585b){return function(_0x1772e2){if(_0x1772e2){return _0x1772e2[_0x91ef('0x26')](_0x590ffb)[_0x91ef('0x27')](function(_0x5b149a){return _0x5b149a;});}return null;};}function removeEntity(_0x5cd0ab,_0x5a6275){return function(_0x25ba47){if(_0x25ba47){return _0x25ba47[_0x91ef('0x28')]()[_0x91ef('0x27')](function(){var _0x3d660f=_0x25ba47[_0x91ef('0x29')]({'plain':!![]});var _0x5f574b=_0x91ef('0x2a');return db[_0x91ef('0x2b')]['destroy']({'where':{'type':_0x5f574b,'resourceId':_0x3d660f['id']}})['then'](function(){return _0x25ba47;});})['then'](function(){_0x5cd0ab['status'](0xcc)[_0x91ef('0x1b')]();});}};}function handleEntityNotFound(_0x26def6,_0x2a03fe){return function(_0x5e9d97){if(!_0x5e9d97){_0x26def6[_0x91ef('0x1a')](0x194);}return _0x5e9d97;};}function handleError(_0x4ec69d,_0x3ae35f){_0x3ae35f=_0x3ae35f||0x1f4;return function(_0x565592){logger[_0x91ef('0x2c')](_0x565592['stack']);if(_0x565592[_0x91ef('0x2d')]){delete _0x565592[_0x91ef('0x2d')];}_0x4ec69d[_0x91ef('0x1c')](_0x3ae35f)[_0x91ef('0x2e')](_0x565592);};}exports[_0x91ef('0x2f')]=function(_0x45b624,_0x782aad){var _0x3caaab={},_0x9e512d={},_0x5b36af={'count':0x0,'rows':[]};var _0x3813f6=_[_0x91ef('0x30')](db[_0x91ef('0x31')]['rawAttributes'],function(_0x2aadcc){return{'name':_0x2aadcc[_0x91ef('0x32')],'type':_0x2aadcc['type'][_0x91ef('0x33')]};});_0x9e512d[_0x91ef('0x34')]=_[_0x91ef('0x30')](_0x3813f6,_0x91ef('0x2d'));_0x9e512d[_0x91ef('0x35')]=_[_0x91ef('0x36')](_0x45b624[_0x91ef('0x35')]);_0x9e512d['filters']=_[_0x91ef('0x37')](_0x9e512d['model'],_0x9e512d['query']);_0x3caaab['attributes']=_['intersection'](_0x9e512d[_0x91ef('0x34')],qs['fields'](_0x45b624[_0x91ef('0x35')][_0x91ef('0x38')]));_0x3caaab[_0x91ef('0x39')]=_0x3caaab[_0x91ef('0x39')][_0x91ef('0x3a')]?_0x3caaab[_0x91ef('0x39')]:_0x9e512d['model'];if(!_0x45b624[_0x91ef('0x35')][_0x91ef('0x3b')](_0x91ef('0x3c'))){_0x3caaab[_0x91ef('0x20')]=qs[_0x91ef('0x20')](_0x45b624['query'][_0x91ef('0x20')]);_0x3caaab[_0x91ef('0x1f')]=qs[_0x91ef('0x1f')](_0x45b624['query'][_0x91ef('0x1f')]);}_0x3caaab[_0x91ef('0x3d')]=qs['sort'](_0x45b624[_0x91ef('0x35')][_0x91ef('0x3e')]);_0x3caaab['where']=qs[_0x91ef('0x3f')](_['pick'](_0x45b624[_0x91ef('0x35')],_0x9e512d[_0x91ef('0x3f')]),_0x3813f6);if(_0x45b624[_0x91ef('0x35')][_0x91ef('0x40')]){_0x3caaab['where']=_[_0x91ef('0x41')](_0x3caaab[_0x91ef('0x42')],{'$or':_[_0x91ef('0x30')](_0x3813f6,function(_0x3dd956){if(_0x3dd956[_0x91ef('0x43')]!=='VIRTUAL'){var _0x48fb2b={};_0x48fb2b[_0x3dd956[_0x91ef('0x2d')]]={'$like':'%'+_0x45b624[_0x91ef('0x35')][_0x91ef('0x40')]+'%'};return _0x48fb2b;}})});}_0x3caaab=_['merge']({},_0x3caaab,_0x45b624[_0x91ef('0x44')]);var _0x1023a6={'where':_0x3caaab['where']};return db[_0x91ef('0x31')]['count'](_0x1023a6)[_0x91ef('0x27')](function(_0x1e54ea){_0x5b36af[_0x91ef('0x1e')]=_0x1e54ea;if(_0x45b624[_0x91ef('0x35')][_0x91ef('0x45')]){_0x3caaab[_0x91ef('0x46')]=[{'all':!![]}];}return db[_0x91ef('0x31')][_0x91ef('0x47')](_0x3caaab);})[_0x91ef('0x27')](function(_0x1919be){_0x5b36af[_0x91ef('0x48')]=_0x1919be;return _0x5b36af;})[_0x91ef('0x27')](respondWithFilteredResult(_0x782aad,_0x3caaab))['catch'](handleError(_0x782aad,null));};exports[_0x91ef('0x49')]=function(_0x3c04c4,_0x1c743d){var _0x54a8a1={'raw':![],'where':{'id':_0x3c04c4['params']['id']}},_0x5cb6da={};_0x5cb6da[_0x91ef('0x34')]=_[_0x91ef('0x36')](db['VoiceMusicOnHold'][_0x91ef('0x4a')]);_0x5cb6da[_0x91ef('0x35')]=_[_0x91ef('0x36')](_0x3c04c4['query']);_0x5cb6da['filters']=_[_0x91ef('0x37')](_0x5cb6da[_0x91ef('0x34')],_0x5cb6da['query']);_0x54a8a1[_0x91ef('0x39')]=_[_0x91ef('0x37')](_0x5cb6da[_0x91ef('0x34')],qs['fields'](_0x3c04c4[_0x91ef('0x35')]['fields']));_0x54a8a1['attributes']=_0x54a8a1[_0x91ef('0x39')][_0x91ef('0x3a')]?_0x54a8a1[_0x91ef('0x39')]:_0x5cb6da[_0x91ef('0x34')];if(_0x3c04c4[_0x91ef('0x35')]['includeAll']){_0x54a8a1[_0x91ef('0x46')]=[{'all':!![]}];}_0x54a8a1=_[_0x91ef('0x41')]({},_0x54a8a1,_0x3c04c4['options']);return db['VoiceMusicOnHold']['find'](_0x54a8a1)[_0x91ef('0x27')](handleEntityNotFound(_0x1c743d,null))['then'](respondWithResult(_0x1c743d,null))[_0x91ef('0x4b')](handleError(_0x1c743d,null));};exports[_0x91ef('0x26')]=function(_0x15ae1f,_0x1a0df1){if(_0x15ae1f[_0x91ef('0x4c')]['id']){delete _0x15ae1f[_0x91ef('0x4c')]['id'];}return db[_0x91ef('0x31')][_0x91ef('0x4d')]({'where':{'id':_0x15ae1f[_0x91ef('0x4e')]['id']}})[_0x91ef('0x27')](handleEntityNotFound(_0x1a0df1,null))[_0x91ef('0x27')](saveUpdates(_0x15ae1f[_0x91ef('0x4c')],null))[_0x91ef('0x27')](respondWithResult(_0x1a0df1,null))['catch'](handleError(_0x1a0df1,null));};exports[_0x91ef('0x4f')]=function(_0x362aec,_0x1938f3,_0xdfd860){return db['sequelize'][_0x91ef('0x50')](function(_0x1c8b37){if(_0x362aec[_0x91ef('0x4c')][_0x91ef('0x51')]===_0x91ef('0x52')){_0x362aec['body'][_0x91ef('0x53')]=path[_0x91ef('0x54')](config[_0x91ef('0x55')],'server/files/moh',_0x362aec[_0x91ef('0x4c')][_0x91ef('0x2d')]);}return db['VoiceMusicOnHold'][_0x91ef('0x4f')](_0x362aec[_0x91ef('0x4c')],{'transaction':_0x1c8b37})[_0x91ef('0x27')](function(_0x56e992){if(_0x362aec[_0x91ef('0x4c')]['mode']==='files'){fs[_0x91ef('0x56')](_0x56e992['directory'],parseInt(_0x91ef('0x57'),0x8));}var _0x3058c4=_0x362aec['user'][_0x91ef('0x29')]({'plain':!![]});if(!_0x3058c4)throw new Error(_0x91ef('0x58'));if(_0x3058c4[_0x91ef('0x59')]===_0x91ef('0x5a')){var _0x31dfa8=_0x56e992[_0x91ef('0x29')]({'plain':!![]});return db[_0x91ef('0x5b')][_0x91ef('0x4d')]({'where':{'name':_0x91ef('0x2a'),'userProfileId':_0x3058c4[_0x91ef('0x5c')]},'raw':!![]})[_0x91ef('0x27')](function(_0x3ae6d0){if(_0x3ae6d0&&_0x3ae6d0[_0x91ef('0x5d')]===0x0){return db[_0x91ef('0x2b')]['create']({'name':_0x31dfa8[_0x91ef('0x2d')],'resourceId':_0x31dfa8['id'],'type':_0x3ae6d0[_0x91ef('0x2d')],'sectionId':_0x3ae6d0['id']},{})['then'](function(){return _0x56e992;});}else{return _0x56e992;}})[_0x91ef('0x4b')](function(_0x4265fd){logger[_0x91ef('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4265fd);});}return _0x56e992;});})[_0x91ef('0x27')](respondWithResult(_0x1938f3,0xc9))[_0x91ef('0x4b')](handleError(_0x1938f3,null));};exports[_0x91ef('0x28')]=function(_0x383d03,_0x2a02dc,_0x30ac66){var _0x941b4c;return db[_0x91ef('0x31')][_0x91ef('0x4d')]({'where':{'id':_0x383d03[_0x91ef('0x4e')]['id']}})[_0x91ef('0x27')](function(_0x37a0e1){if(_0x37a0e1){return db[_0x91ef('0x5e')][_0x91ef('0x50')](function(_0xc8b988){return _0x37a0e1[_0x91ef('0x28')]({'transaction':_0xc8b988,'raw':!![]})[_0x91ef('0x27')](function(_0xef7a4){if(_0xef7a4[_0x91ef('0x53')]){fs[_0x91ef('0x5f')](_0xef7a4[_0x91ef('0x53')])[_0x91ef('0x60')](function(_0xfca2a){fs[_0x91ef('0x61')](path['join'](_0xef7a4[_0x91ef('0x53')],_0xfca2a));});fs[_0x91ef('0x62')](_0xef7a4[_0x91ef('0x53')]);}return _0xef7a4;});})[_0x91ef('0x4b')](function(_0x3b7fdc){throw new db[(_0x91ef('0x63'))]['ValidationError'](_0x3b7fdc[_0x91ef('0x64')]);});}})[_0x91ef('0x27')](handleEntityNotFound(_0x2a02dc,null))[_0x91ef('0x27')](removeEntity(_0x2a02dc,null))[_0x91ef('0x4b')](handleError(_0x2a02dc,null));};exports[_0x91ef('0x65')]=function(_0x1f9174,_0x56d868,_0x900519){return db[_0x91ef('0x5e')][_0x91ef('0x50')](function(_0x14c571){var _0x42cca4;return db[_0x91ef('0x31')][_0x91ef('0x4d')]({'where':{'id':_0x1f9174['params']['id']}})[_0x91ef('0x27')](function(_0x15379d){if(_0x15379d){_0x42cca4=_0x15379d;return _0x15379d[_0x91ef('0x65')](_0x1f9174[_0x91ef('0x4c')]['id'],{'transaction':_0x14c571});}})[_0x91ef('0x27')](function(_0xff154b){if(_0xff154b){return db['Sound'][_0x91ef('0x66')]({'where':{'id':_0x1f9174[_0x91ef('0x4c')]['id']},'attributes':['id',_0x91ef('0x2d'),_0x91ef('0x67'),'converted_format',_0x91ef('0x68')],'raw':!![]});}})[_0x91ef('0x27')](function(_0x4e58bc){if(_0x4e58bc){var _0x27cbd2=path[_0x91ef('0x54')](config[_0x91ef('0x55')],'server/files/sounds/converted',util[_0x91ef('0x69')]('%s.%s',path[_0x91ef('0x6a')](_0x4e58bc[_0x91ef('0x67')],path[_0x91ef('0x6b')](_0x4e58bc[_0x91ef('0x67')])),_0x4e58bc[_0x91ef('0x6c')]));var _0xe1df9d=path[_0x91ef('0x54')](config['root'],'server/files/moh',_0x42cca4['name'],util[_0x91ef('0x69')](_0x91ef('0x6d'),_0x4e58bc['name'],_0x4e58bc[_0x91ef('0x6c')]));fs[_0x91ef('0x6e')](_0x27cbd2,_0xe1df9d);return _0x4e58bc;}})[_0x91ef('0x4b')](function(_0x46b0fc){throw new db['Sequelize'][(_0x91ef('0x6f'))](_0x46b0fc['message']);});})[_0x91ef('0x27')](handleEntityNotFound(_0x56d868,null))[_0x91ef('0x27')](respondWithResult(_0x56d868,0xc9))[_0x91ef('0x4b')](handleError(_0x56d868,null));};exports[_0x91ef('0x70')]=function(_0x5f32fb,_0x3d3664,_0x48d685){return db[_0x91ef('0x5e')][_0x91ef('0x50')](function(_0x79dc24){var _0x46a367;return db['VoiceMusicOnHold'][_0x91ef('0x66')]({'where':{'id':_0x5f32fb[_0x91ef('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3d3664,null))[_0x91ef('0x27')](function(_0x1182cc){if(_0x1182cc){_0x46a367=_0x1182cc;return _0x1182cc[_0x91ef('0x70')](_0x5f32fb[_0x91ef('0x4e')][_0x91ef('0x71')]);}})[_0x91ef('0x27')](function(_0x17b1a3){if(_0x17b1a3){return db[_0x91ef('0x72')][_0x91ef('0x66')]({'where':{'id':_0x5f32fb[_0x91ef('0x4e')][_0x91ef('0x71')]},'attributes':['id',_0x91ef('0x2d'),_0x91ef('0x67'),_0x91ef('0x6c'),_0x91ef('0x68')],'raw':!![]});}})['then'](function(_0x2c05d8){if(_0x2c05d8){fs[_0x91ef('0x61')](path[_0x91ef('0x54')](_0x46a367[_0x91ef('0x53')],util[_0x91ef('0x69')]('%s.%s',_0x2c05d8[_0x91ef('0x2d')],_0x2c05d8[_0x91ef('0x6c')])));return _0x2c05d8;}})[_0x91ef('0x4b')](function(_0x3103dd){throw new db[(_0x91ef('0x63'))][(_0x91ef('0x6f'))](_0x3103dd[_0x91ef('0x64')]);});})[_0x91ef('0x27')](handleEntityNotFound(_0x3d3664,null))[_0x91ef('0x27')](respondWithStatusCode(_0x3d3664,0xcc))[_0x91ef('0x4b')](handleError(_0x3d3664,null));};exports[_0x91ef('0x73')]=function(_0xe01741,_0x28bf00,_0xc8a64b){var _0x32dd48={};var _0x42fd99={};var _0x511aba;var _0x1b009f;return db[_0x91ef('0x31')][_0x91ef('0x66')]({'where':{'id':_0xe01741['params']['id']}})['then'](handleEntityNotFound(_0x28bf00,null))[_0x91ef('0x27')](function(_0x2f966b){if(_0x2f966b){_0x511aba=_0x2f966b;_0x42fd99[_0x91ef('0x34')]=_[_0x91ef('0x36')](db[_0x91ef('0x72')][_0x91ef('0x4a')]);_0x42fd99[_0x91ef('0x35')]=_[_0x91ef('0x36')](_0xe01741[_0x91ef('0x35')]);_0x42fd99[_0x91ef('0x3f')]=_[_0x91ef('0x37')](_0x42fd99['model'],_0x42fd99[_0x91ef('0x35')]);_0x32dd48['attributes']=_[_0x91ef('0x37')](_0x42fd99['model'],qs[_0x91ef('0x38')](_0xe01741[_0x91ef('0x35')][_0x91ef('0x38')]));_0x32dd48[_0x91ef('0x39')]=_0x32dd48[_0x91ef('0x39')][_0x91ef('0x3a')]?_0x32dd48[_0x91ef('0x39')]:_0x42fd99[_0x91ef('0x34')];_0x32dd48[_0x91ef('0x3d')]=qs[_0x91ef('0x3e')](_0xe01741[_0x91ef('0x35')][_0x91ef('0x3e')]);_0x32dd48[_0x91ef('0x42')]=qs['filters'](_[_0x91ef('0x74')](_0xe01741[_0x91ef('0x35')],_0x42fd99[_0x91ef('0x3f')]));if(_0xe01741[_0x91ef('0x35')][_0x91ef('0x40')]){_0x32dd48[_0x91ef('0x42')]=_[_0x91ef('0x41')](_0x32dd48[_0x91ef('0x42')],{'$or':_[_0x91ef('0x30')](_0x32dd48['attributes'],function(_0x2c9ca6){var _0x47492b={};_0x47492b[_0x2c9ca6]={'$like':'%'+_0xe01741[_0x91ef('0x35')][_0x91ef('0x40')]+'%'};return _0x47492b;})});}_0x32dd48=_['merge']({},_0x32dd48,_0xe01741[_0x91ef('0x44')]);return _0x511aba[_0x91ef('0x73')](_0x32dd48);}})[_0x91ef('0x27')](function(_0x48f819){if(_0x48f819){_0x1b009f=_0x48f819[_0x91ef('0x3a')];if(!_0xe01741[_0x91ef('0x35')][_0x91ef('0x3b')](_0x91ef('0x3c'))){_0x32dd48[_0x91ef('0x20')]=qs[_0x91ef('0x20')](_0xe01741[_0x91ef('0x35')][_0x91ef('0x20')]);_0x32dd48[_0x91ef('0x1f')]=qs[_0x91ef('0x1f')](_0xe01741[_0x91ef('0x35')]['offset']);}return _0x511aba[_0x91ef('0x73')](_0x32dd48);}})['then'](function(_0x31ad70){if(_0x31ad70){return _0x31ad70?{'count':_0x1b009f,'rows':_0x31ad70}:null;}})[_0x91ef('0x27')](respondWithResult(_0x28bf00,null))[_0x91ef('0x4b')](handleError(_0x28bf00,null));}; \ No newline at end of file +var _0x570c=['basename','extname','converted_format','ValidationError','removeSound','createdAt','getSounds','Sound','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','save','update','then','destroy','get','MusicOnHolds','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','sequelize','transaction','mode','files','directory','join','root','server/files/moh','create','mkdirSync','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','message','addSound','findOne','save_name','server/files/sounds/converted','format','%s.%s'];(function(_0x33b5f1,_0x38811e){var _0x2802cf=function(_0x5d5891){while(--_0x5d5891){_0x33b5f1['push'](_0x33b5f1['shift']());}};_0x2802cf(++_0x38811e);}(_0x570c,0x1d0));var _0xc570=function(_0x12d33b,_0x38a281){_0x12d33b=_0x12d33b-0x0;var _0x5cc815=_0x570c[_0x12d33b];return _0x5cc815;};'use strict';var pdf=require(_0xc570('0x0'));var emlformat=require(_0xc570('0x1'));var rimraf=require(_0xc570('0x2'));var zipdir=require(_0xc570('0x3'));var jsonpatch=require(_0xc570('0x4'));var rp=require('request-promise');var moment=require(_0xc570('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc570('0x6'));var path=require('path');var sox=require(_0xc570('0x7'));var csv=require(_0xc570('0x8'));var ejs=require(_0xc570('0x9'));var fs=require('fs');var fs_extra=require(_0xc570('0xa'));var _=require(_0xc570('0xb'));var squel=require(_0xc570('0xc'));var crypto=require('crypto');var jsforce=require(_0xc570('0xd'));var deskjs=require(_0xc570('0xe'));var toCsv=require(_0xc570('0x8'));var querystring=require(_0xc570('0xf'));var Papa=require(_0xc570('0x10'));var Redis=require(_0xc570('0x11'));var authService=require(_0xc570('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc570('0x13'));var logger=require(_0xc570('0x14'))(_0xc570('0x15'));var utils=require(_0xc570('0x16'));var config=require(_0xc570('0x17'));var licenseUtil=require(_0xc570('0x18'));var db=require(_0xc570('0x19'))['db'];function respondWithStatusCode(_0x3e4faf,_0x10ee7f){_0x10ee7f=_0x10ee7f||0xcc;return function(_0x3c01fd){if(_0x3c01fd){return _0x3e4faf[_0xc570('0x1a')](_0x10ee7f);}return _0x3e4faf[_0xc570('0x1b')](_0x10ee7f)['end']();};}function respondWithResult(_0xf37fa2,_0x2a4c48){_0x2a4c48=_0x2a4c48||0xc8;return function(_0x3c32f0){if(_0x3c32f0){return _0xf37fa2[_0xc570('0x1b')](_0x2a4c48)[_0xc570('0x1c')](_0x3c32f0);}};}function respondWithFilteredResult(_0x3f6db6,_0xe158d){return function(_0x2d69e0){if(_0x2d69e0){var _0x1a66fa=_0x2d69e0[_0xc570('0x1d')],_0x389032=_0xe158d[_0xc570('0x1e')],_0x1d951d=_0xe158d[_0xc570('0x1e')]+_0xe158d[_0xc570('0x1f')],_0x9ac142;if(_0x1d951d>=_0x1a66fa){_0x1d951d=_0x1a66fa;_0x9ac142=0xc8;}else{_0x9ac142=0xce;}_0x3f6db6[_0xc570('0x1b')](_0x9ac142);return _0x3f6db6[_0xc570('0x20')]('Content-Range',_0x389032+'-'+_0x1d951d+'/'+_0x1a66fa)['json'](_0x2d69e0);}return null;};}function patchUpdates(_0x19e1ec){return function(_0x59cb11){try{jsonpatch[_0xc570('0x21')](_0x59cb11,_0x19e1ec,!![]);}catch(_0xc05f54){return BPromise['reject'](_0xc05f54);}return _0x59cb11[_0xc570('0x22')]();};}function saveUpdates(_0x3d1948,_0x3296b6){return function(_0x37a716){if(_0x37a716){return _0x37a716[_0xc570('0x23')](_0x3d1948)[_0xc570('0x24')](function(_0x4df93f){return _0x4df93f;});}return null;};}function removeEntity(_0x2d17c7,_0x154e5a){return function(_0x4fbff1){if(_0x4fbff1){return _0x4fbff1[_0xc570('0x25')]()[_0xc570('0x24')](function(){var _0x42f0b6=_0x4fbff1[_0xc570('0x26')]({'plain':!![]});var _0x1f28af=_0xc570('0x27');return db['UserProfileResource'][_0xc570('0x25')]({'where':{'type':_0x1f28af,'resourceId':_0x42f0b6['id']}})[_0xc570('0x24')](function(){return _0x4fbff1;});})[_0xc570('0x24')](function(){_0x2d17c7[_0xc570('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28877d,_0xa89d46){return function(_0x256723){if(!_0x256723){_0x28877d[_0xc570('0x1a')](0x194);}return _0x256723;};}function handleError(_0x11fdfd,_0x2e7701){_0x2e7701=_0x2e7701||0x1f4;return function(_0x4c9c8b){logger[_0xc570('0x28')](_0x4c9c8b[_0xc570('0x29')]);if(_0x4c9c8b['name']){delete _0x4c9c8b[_0xc570('0x2a')];}_0x11fdfd[_0xc570('0x1b')](_0x2e7701)[_0xc570('0x2b')](_0x4c9c8b);};}exports[_0xc570('0x2c')]=function(_0x2fdf5b,_0xcc80e0){var _0x4303ac={},_0x43c01f={},_0x3750e9={'count':0x0,'rows':[]};var _0x47c1cb=_[_0xc570('0x2d')](db[_0xc570('0x2e')][_0xc570('0x2f')],function(_0x3644d1){return{'name':_0x3644d1[_0xc570('0x30')],'type':_0x3644d1[_0xc570('0x31')][_0xc570('0x32')]};});_0x43c01f[_0xc570('0x33')]=_[_0xc570('0x2d')](_0x47c1cb,_0xc570('0x2a'));_0x43c01f['query']=_[_0xc570('0x34')](_0x2fdf5b[_0xc570('0x35')]);_0x43c01f['filters']=_[_0xc570('0x36')](_0x43c01f[_0xc570('0x33')],_0x43c01f[_0xc570('0x35')]);_0x4303ac[_0xc570('0x37')]=_[_0xc570('0x36')](_0x43c01f[_0xc570('0x33')],qs[_0xc570('0x38')](_0x2fdf5b[_0xc570('0x35')][_0xc570('0x38')]));_0x4303ac[_0xc570('0x37')]=_0x4303ac[_0xc570('0x37')][_0xc570('0x39')]?_0x4303ac['attributes']:_0x43c01f[_0xc570('0x33')];if(!_0x2fdf5b[_0xc570('0x35')][_0xc570('0x3a')](_0xc570('0x3b'))){_0x4303ac[_0xc570('0x1f')]=qs[_0xc570('0x1f')](_0x2fdf5b[_0xc570('0x35')][_0xc570('0x1f')]);_0x4303ac[_0xc570('0x1e')]=qs[_0xc570('0x1e')](_0x2fdf5b[_0xc570('0x35')][_0xc570('0x1e')]);}_0x4303ac[_0xc570('0x3c')]=qs[_0xc570('0x3d')](_0x2fdf5b[_0xc570('0x35')][_0xc570('0x3d')]);_0x4303ac[_0xc570('0x3e')]=qs['filters'](_[_0xc570('0x3f')](_0x2fdf5b[_0xc570('0x35')],_0x43c01f[_0xc570('0x40')]),_0x47c1cb);if(_0x2fdf5b[_0xc570('0x35')][_0xc570('0x41')]){_0x4303ac[_0xc570('0x3e')]=_[_0xc570('0x42')](_0x4303ac[_0xc570('0x3e')],{'$or':_[_0xc570('0x2d')](_0x47c1cb,function(_0x36d8ef){if(_0x36d8ef[_0xc570('0x31')]!==_0xc570('0x43')){var _0x15810e={};_0x15810e[_0x36d8ef[_0xc570('0x2a')]]={'$like':'%'+_0x2fdf5b[_0xc570('0x35')][_0xc570('0x41')]+'%'};return _0x15810e;}})});}_0x4303ac=_[_0xc570('0x42')]({},_0x4303ac,_0x2fdf5b[_0xc570('0x44')]);var _0x35a114={'where':_0x4303ac[_0xc570('0x3e')]};return db['VoiceMusicOnHold'][_0xc570('0x1d')](_0x35a114)['then'](function(_0x24a0cf){_0x3750e9['count']=_0x24a0cf;if(_0x2fdf5b[_0xc570('0x35')][_0xc570('0x45')]){_0x4303ac[_0xc570('0x46')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xc570('0x47')](_0x4303ac);})[_0xc570('0x24')](function(_0x17b672){_0x3750e9[_0xc570('0x48')]=_0x17b672;return _0x3750e9;})['then'](respondWithFilteredResult(_0xcc80e0,_0x4303ac))[_0xc570('0x49')](handleError(_0xcc80e0,null));};exports[_0xc570('0x4a')]=function(_0x3a2944,_0x1bf482){var _0x39af36={'raw':![],'where':{'id':_0x3a2944[_0xc570('0x4b')]['id']}},_0x23ef89={};_0x23ef89[_0xc570('0x33')]=_[_0xc570('0x34')](db[_0xc570('0x2e')]['rawAttributes']);_0x23ef89[_0xc570('0x35')]=_[_0xc570('0x34')](_0x3a2944[_0xc570('0x35')]);_0x23ef89[_0xc570('0x40')]=_[_0xc570('0x36')](_0x23ef89[_0xc570('0x33')],_0x23ef89[_0xc570('0x35')]);_0x39af36[_0xc570('0x37')]=_[_0xc570('0x36')](_0x23ef89[_0xc570('0x33')],qs[_0xc570('0x38')](_0x3a2944['query'][_0xc570('0x38')]));_0x39af36['attributes']=_0x39af36[_0xc570('0x37')][_0xc570('0x39')]?_0x39af36[_0xc570('0x37')]:_0x23ef89[_0xc570('0x33')];if(_0x3a2944['query'][_0xc570('0x45')]){_0x39af36[_0xc570('0x46')]=[{'all':!![]}];}_0x39af36=_[_0xc570('0x42')]({},_0x39af36,_0x3a2944[_0xc570('0x44')]);return db[_0xc570('0x2e')][_0xc570('0x4c')](_0x39af36)[_0xc570('0x24')](handleEntityNotFound(_0x1bf482,null))[_0xc570('0x24')](respondWithResult(_0x1bf482,null))[_0xc570('0x49')](handleError(_0x1bf482,null));};exports[_0xc570('0x23')]=function(_0x2c1abf,_0x34b57a){if(_0x2c1abf['body']['id']){delete _0x2c1abf[_0xc570('0x4d')]['id'];}return db[_0xc570('0x2e')][_0xc570('0x4c')]({'where':{'id':_0x2c1abf['params']['id']}})[_0xc570('0x24')](handleEntityNotFound(_0x34b57a,null))[_0xc570('0x24')](saveUpdates(_0x2c1abf['body'],null))[_0xc570('0x24')](respondWithResult(_0x34b57a,null))['catch'](handleError(_0x34b57a,null));};exports['create']=function(_0x4700f6,_0x467937,_0x194320){return db[_0xc570('0x4e')][_0xc570('0x4f')](function(_0x14f859){if(_0x4700f6[_0xc570('0x4d')][_0xc570('0x50')]===_0xc570('0x51')){_0x4700f6[_0xc570('0x4d')][_0xc570('0x52')]=path[_0xc570('0x53')](config[_0xc570('0x54')],_0xc570('0x55'),_0x4700f6[_0xc570('0x4d')]['name']);}return db['VoiceMusicOnHold'][_0xc570('0x56')](_0x4700f6['body'],{'transaction':_0x14f859})[_0xc570('0x24')](function(_0x5e6b7b){if(_0x4700f6[_0xc570('0x4d')][_0xc570('0x50')]===_0xc570('0x51')){fs[_0xc570('0x57')](_0x5e6b7b['directory'],parseInt('0777',0x8));}var _0x3b447e=_0x4700f6[_0xc570('0x58')][_0xc570('0x26')]({'plain':!![]});if(!_0x3b447e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b447e[_0xc570('0x59')]===_0xc570('0x58')){var _0xbeb980=_0x5e6b7b[_0xc570('0x26')]({'plain':!![]});return db[_0xc570('0x5a')][_0xc570('0x4c')]({'where':{'name':'MusicOnHolds','userProfileId':_0x3b447e[_0xc570('0x5b')]},'raw':!![]})[_0xc570('0x24')](function(_0x3c0800){if(_0x3c0800&&_0x3c0800[_0xc570('0x5c')]===0x0){return db[_0xc570('0x5d')][_0xc570('0x56')]({'name':_0xbeb980[_0xc570('0x2a')],'resourceId':_0xbeb980['id'],'type':_0x3c0800[_0xc570('0x2a')],'sectionId':_0x3c0800['id']},{})['then'](function(){return _0x5e6b7b;});}else{return _0x5e6b7b;}})[_0xc570('0x49')](function(_0x3fe756){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fe756);});}return _0x5e6b7b;});})[_0xc570('0x24')](respondWithResult(_0x467937,0xc9))[_0xc570('0x49')](handleError(_0x467937,null));};exports[_0xc570('0x25')]=function(_0x5aa28e,_0x4ba884,_0x190e4c){var _0x47e528;return db[_0xc570('0x2e')][_0xc570('0x4c')]({'where':{'id':_0x5aa28e['params']['id']}})[_0xc570('0x24')](function(_0x50fc8d){if(_0x50fc8d){return db['sequelize']['transaction'](function(_0x4293a8){return _0x50fc8d[_0xc570('0x25')]({'transaction':_0x4293a8,'raw':!![]})[_0xc570('0x24')](function(_0xe1db17){if(_0xe1db17[_0xc570('0x52')]){fs[_0xc570('0x5e')](_0xe1db17[_0xc570('0x52')])[_0xc570('0x5f')](function(_0x4a9bf7){fs[_0xc570('0x60')](path[_0xc570('0x53')](_0xe1db17['directory'],_0x4a9bf7));});fs[_0xc570('0x61')](_0xe1db17[_0xc570('0x52')]);}return _0xe1db17;});})[_0xc570('0x49')](function(_0x57e6ce){throw new db[(_0xc570('0x62'))]['ValidationError'](_0x57e6ce[_0xc570('0x63')]);});}})['then'](handleEntityNotFound(_0x4ba884,null))['then'](removeEntity(_0x4ba884,null))['catch'](handleError(_0x4ba884,null));};exports[_0xc570('0x64')]=function(_0x5b7d3f,_0x2504dc,_0x1a4ac2){return db[_0xc570('0x4e')][_0xc570('0x4f')](function(_0x334e00){var _0x2faf86;return db[_0xc570('0x2e')][_0xc570('0x4c')]({'where':{'id':_0x5b7d3f[_0xc570('0x4b')]['id']}})[_0xc570('0x24')](function(_0xf8e19f){if(_0xf8e19f){_0x2faf86=_0xf8e19f;return _0xf8e19f[_0xc570('0x64')](_0x5b7d3f[_0xc570('0x4d')]['id'],{'transaction':_0x334e00});}})['then'](function(_0x2f9161){if(_0x2f9161){return db['Sound'][_0xc570('0x65')]({'where':{'id':_0x5b7d3f[_0xc570('0x4d')]['id']},'attributes':['id',_0xc570('0x2a'),_0xc570('0x66'),'converted_format','createdAt'],'raw':!![]});}})[_0xc570('0x24')](function(_0xd3d9f0){if(_0xd3d9f0){var _0x587883=path['join'](config[_0xc570('0x54')],_0xc570('0x67'),util[_0xc570('0x68')](_0xc570('0x69'),path[_0xc570('0x6a')](_0xd3d9f0['save_name'],path[_0xc570('0x6b')](_0xd3d9f0[_0xc570('0x66')])),_0xd3d9f0[_0xc570('0x6c')]));var _0x5b3666=path[_0xc570('0x53')](config[_0xc570('0x54')],_0xc570('0x55'),_0x2faf86[_0xc570('0x2a')],util['format'](_0xc570('0x69'),_0xd3d9f0['name'],_0xd3d9f0[_0xc570('0x6c')]));fs['symlinkSync'](_0x587883,_0x5b3666);return _0xd3d9f0;}})[_0xc570('0x49')](function(_0x9f02c5){throw new db[(_0xc570('0x62'))][(_0xc570('0x6d'))](_0x9f02c5[_0xc570('0x63')]);});})[_0xc570('0x24')](handleEntityNotFound(_0x2504dc,null))[_0xc570('0x24')](respondWithResult(_0x2504dc,0xc9))['catch'](handleError(_0x2504dc,null));};exports[_0xc570('0x6e')]=function(_0x2b8c8b,_0x2cdbd0,_0x9b7015){return db[_0xc570('0x4e')][_0xc570('0x4f')](function(_0x344c37){var _0xd4ae6b;return db[_0xc570('0x2e')]['findOne']({'where':{'id':_0x2b8c8b[_0xc570('0x4b')]['id']}})[_0xc570('0x24')](handleEntityNotFound(_0x2cdbd0,null))[_0xc570('0x24')](function(_0x5e454b){if(_0x5e454b){_0xd4ae6b=_0x5e454b;return _0x5e454b['removeSound'](_0x2b8c8b['params']['id2']);}})[_0xc570('0x24')](function(_0x54c08f){if(_0x54c08f){return db['Sound'][_0xc570('0x65')]({'where':{'id':_0x2b8c8b[_0xc570('0x4b')]['id2']},'attributes':['id','name','save_name','converted_format',_0xc570('0x6f')],'raw':!![]});}})['then'](function(_0x14ed8a){if(_0x14ed8a){fs[_0xc570('0x60')](path[_0xc570('0x53')](_0xd4ae6b[_0xc570('0x52')],util[_0xc570('0x68')](_0xc570('0x69'),_0x14ed8a[_0xc570('0x2a')],_0x14ed8a[_0xc570('0x6c')])));return _0x14ed8a;}})['catch'](function(_0x265f96){throw new db['Sequelize'][(_0xc570('0x6d'))](_0x265f96[_0xc570('0x63')]);});})['then'](handleEntityNotFound(_0x2cdbd0,null))[_0xc570('0x24')](respondWithStatusCode(_0x2cdbd0,0xcc))[_0xc570('0x49')](handleError(_0x2cdbd0,null));};exports[_0xc570('0x70')]=function(_0x149715,_0xd0b7fb,_0x3bb999){var _0x4c46aa={};var _0x13861a={};var _0x38f62f;var _0x519b99;return db[_0xc570('0x2e')]['findOne']({'where':{'id':_0x149715[_0xc570('0x4b')]['id']}})[_0xc570('0x24')](handleEntityNotFound(_0xd0b7fb,null))[_0xc570('0x24')](function(_0x1522ef){if(_0x1522ef){_0x38f62f=_0x1522ef;_0x13861a['model']=_[_0xc570('0x34')](db[_0xc570('0x71')][_0xc570('0x2f')]);_0x13861a['query']=_[_0xc570('0x34')](_0x149715[_0xc570('0x35')]);_0x13861a[_0xc570('0x40')]=_['intersection'](_0x13861a[_0xc570('0x33')],_0x13861a['query']);_0x4c46aa[_0xc570('0x37')]=_[_0xc570('0x36')](_0x13861a[_0xc570('0x33')],qs[_0xc570('0x38')](_0x149715[_0xc570('0x35')][_0xc570('0x38')]));_0x4c46aa[_0xc570('0x37')]=_0x4c46aa['attributes'][_0xc570('0x39')]?_0x4c46aa[_0xc570('0x37')]:_0x13861a[_0xc570('0x33')];_0x4c46aa[_0xc570('0x3c')]=qs[_0xc570('0x3d')](_0x149715['query'][_0xc570('0x3d')]);_0x4c46aa['where']=qs['filters'](_[_0xc570('0x3f')](_0x149715[_0xc570('0x35')],_0x13861a[_0xc570('0x40')]));if(_0x149715[_0xc570('0x35')]['filter']){_0x4c46aa[_0xc570('0x3e')]=_[_0xc570('0x42')](_0x4c46aa[_0xc570('0x3e')],{'$or':_[_0xc570('0x2d')](_0x4c46aa[_0xc570('0x37')],function(_0x3c12c4){var _0x3400f8={};_0x3400f8[_0x3c12c4]={'$like':'%'+_0x149715[_0xc570('0x35')][_0xc570('0x41')]+'%'};return _0x3400f8;})});}_0x4c46aa=_[_0xc570('0x42')]({},_0x4c46aa,_0x149715[_0xc570('0x44')]);return _0x38f62f[_0xc570('0x70')](_0x4c46aa);}})[_0xc570('0x24')](function(_0x5ae686){if(_0x5ae686){_0x519b99=_0x5ae686[_0xc570('0x39')];if(!_0x149715[_0xc570('0x35')]['hasOwnProperty']('nolimit')){_0x4c46aa[_0xc570('0x1f')]=qs[_0xc570('0x1f')](_0x149715[_0xc570('0x35')][_0xc570('0x1f')]);_0x4c46aa[_0xc570('0x1e')]=qs[_0xc570('0x1e')](_0x149715[_0xc570('0x35')]['offset']);}return _0x38f62f[_0xc570('0x70')](_0x4c46aa);}})[_0xc570('0x24')](function(_0x6b9322){if(_0x6b9322){return _0x6b9322?{'count':_0x519b99,'rows':_0x6b9322}:null;}})[_0xc570('0x24')](respondWithResult(_0xd0b7fb,null))[_0xc570('0x49')](handleError(_0xd0b7fb,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 109d7a3..1ef9e48 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 _0xa46d=['rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x48b2ed,_0x958c61){var _0x56ed46=function(_0x2035ba){while(--_0x2035ba){_0x48b2ed['push'](_0x48b2ed['shift']());}};_0x56ed46(++_0x958c61);}(_0xa46d,0xe4));var _0xda46=function(_0x38ac9e,_0x4d0710){_0x38ac9e=_0x38ac9e-0x0;var _0xa45844=_0xa46d[_0x38ac9e];return _0xa45844;};'use strict';var _=require(_0xda46('0x0'));var util=require(_0xda46('0x1'));var logger=require(_0xda46('0x2'))('api');var moment=require(_0xda46('0x3'));var BPromise=require('bluebird');var rp=require(_0xda46('0x4'));var fs=require('fs');var path=require(_0xda46('0x5'));var rimraf=require(_0xda46('0x6'));var config=require(_0xda46('0x7'));var attributes=require(_0xda46('0x8'));module[_0xda46('0x9')]=function(_0x5abcb6,_0x2d05bf){return _0x5abcb6[_0xda46('0xa')](_0xda46('0xb'),attributes,{'tableName':_0xda46('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33e7=['api','moment','bluebird','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','voice_musiconhold','lodash','util'];(function(_0x2a84a3,_0x3a2bde){var _0x4e64f6=function(_0xfe45ca){while(--_0xfe45ca){_0x2a84a3['push'](_0x2a84a3['shift']());}};_0x4e64f6(++_0x3a2bde);}(_0x33e7,0xfa));var _0x733e=function(_0x986fb3,_0x1e8673){_0x986fb3=_0x986fb3-0x0;var _0xe0f1d=_0x33e7[_0x986fb3];return _0xe0f1d;};'use strict';var _=require(_0x733e('0x0'));var util=require(_0x733e('0x1'));var logger=require('../../config/logger')(_0x733e('0x2'));var moment=require(_0x733e('0x3'));var BPromise=require(_0x733e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x733e('0x5'));var rimraf=require(_0x733e('0x6'));var config=require(_0x733e('0x7'));var attributes=require(_0x733e('0x8'));module['exports']=function(_0x2485a7,_0x448370){return _0x2485a7[_0x733e('0x9')](_0x733e('0xa'),attributes,{'tableName':_0x733e('0xb'),'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 b76fc49..3c3bed9 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 _0xa8fb=['request','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3daa8c,_0x388a87){var _0x2b1bd7=function(_0xdb2963){while(--_0xdb2963){_0x3daa8c['push'](_0x3daa8c['shift']());}};_0x2b1bd7(++_0x388a87);}(_0xa8fb,0x1a9));var _0xba8f=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xa8fb[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0xba8f('0x0'));var util=require(_0xba8f('0x1'));var moment=require('moment');var BPromise=require(_0xba8f('0x2'));var rs=require(_0xba8f('0x3'));var fs=require('fs');var Redis=require(_0xba8f('0x4'));var db=require(_0xba8f('0x5'))['db'];var utils=require(_0xba8f('0x6'));var logger=require('../../config/logger')(_0xba8f('0x7'));var config=require(_0xba8f('0x8'));var jayson=require(_0xba8f('0x9'));var client=jayson[_0xba8f('0xa')][_0xba8f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17c7d0,_0x35dbca,_0x5115b7){return new BPromise(function(_0x14883b,_0xd8c6bc){return client[_0xba8f('0xc')](_0x17c7d0,_0x5115b7)['then'](function(_0x4daeca){logger['info'](_0xba8f('0xd'),_0x35dbca,_0xba8f('0xe'));logger['debug'](_0xba8f('0xf'),_0x35dbca,_0xba8f('0xe'),JSON[_0xba8f('0x10')](_0x4daeca));if(_0x4daeca[_0xba8f('0x11')]){if(_0x4daeca[_0xba8f('0x11')][_0xba8f('0x12')]===0x1f4){logger['error'](_0xba8f('0xd'),_0x35dbca,_0x4daeca['error'][_0xba8f('0x13')]);return _0xd8c6bc(_0x4daeca[_0xba8f('0x11')][_0xba8f('0x13')]);}logger['error'](_0xba8f('0xd'),_0x35dbca,_0x4daeca['error'][_0xba8f('0x13')]);return _0x14883b(_0x4daeca[_0xba8f('0x11')][_0xba8f('0x13')]);}else{logger[_0xba8f('0x14')](_0xba8f('0xd'),_0x35dbca,_0xba8f('0xe'));_0x14883b(_0x4daeca[_0xba8f('0x15')]['message']);}})[_0xba8f('0x16')](function(_0x3fa813){logger[_0xba8f('0x11')](_0xba8f('0xd'),_0x35dbca,_0x3fa813);_0xd8c6bc(_0x3fa813);});});} \ No newline at end of file +var _0xe51f=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','VoiceMusicOnHold,\x20%s,\x20%s','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0xe51f,0x10d));var _0xfe51=function(_0x17e707,_0x111af0){_0x17e707=_0x17e707-0x0;var _0x431b04=_0xe51f[_0x17e707];return _0x431b04;};'use strict';var _=require(_0xfe51('0x0'));var util=require(_0xfe51('0x1'));var moment=require(_0xfe51('0x2'));var BPromise=require('bluebird');var rs=require(_0xfe51('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfe51('0x4'))['db'];var utils=require(_0xfe51('0x5'));var logger=require('../../config/logger')(_0xfe51('0x6'));var config=require('../../config/environment');var jayson=require(_0xfe51('0x7'));var client=jayson[_0xfe51('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39cd37,_0x38ba52,_0x1a3fa2){return new BPromise(function(_0xdbf896,_0x3620c3){return client[_0xfe51('0x9')](_0x39cd37,_0x1a3fa2)['then'](function(_0x1f1ee6){logger[_0xfe51('0xa')](_0xfe51('0xb'),_0x38ba52,'request\x20sent');logger[_0xfe51('0xc')](_0xfe51('0xd'),_0x38ba52,_0xfe51('0xe'),JSON[_0xfe51('0xf')](_0x1f1ee6));if(_0x1f1ee6[_0xfe51('0x10')]){if(_0x1f1ee6[_0xfe51('0x10')][_0xfe51('0x11')]===0x1f4){logger[_0xfe51('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x38ba52,_0x1f1ee6['error'][_0xfe51('0x12')]);return _0x3620c3(_0x1f1ee6[_0xfe51('0x10')][_0xfe51('0x12')]);}logger[_0xfe51('0x10')](_0xfe51('0xb'),_0x38ba52,_0x1f1ee6[_0xfe51('0x10')][_0xfe51('0x12')]);return _0xdbf896(_0x1f1ee6[_0xfe51('0x10')][_0xfe51('0x12')]);}else{logger[_0xfe51('0xa')](_0xfe51('0xb'),_0x38ba52,_0xfe51('0xe'));_0xdbf896(_0x1f1ee6[_0xfe51('0x13')][_0xfe51('0x12')]);}})[_0xfe51('0x14')](function(_0x21a781){logger[_0xfe51('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x38ba52,_0x21a781);_0x3620c3(_0x21a781);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 5872ec5..7452932 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 _0x4819=['/describe','describe','get','/:id','show','/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated'];(function(_0x1f42bc,_0x208463){var _0x23f159=function(_0x3933bb){while(--_0x3933bb){_0x1f42bc['push'](_0x1f42bc['shift']());}};_0x23f159(++_0x208463);}(_0x4819,0xcd));var _0x9481=function(_0x269ee8,_0x477226){_0x269ee8=_0x269ee8-0x0;var _0x4d98bd=_0x4819[_0x269ee8];return _0x4d98bd;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var fs_extra=require(_0x9481('0x5'));var auth=require(_0x9481('0x6'));var interaction=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var controller=require(_0x9481('0x9'));router['get']('/',auth[_0x9481('0xa')](),controller['index']);router['get'](_0x9481('0xb'),auth[_0x9481('0xa')](),controller[_0x9481('0xc')]);router[_0x9481('0xd')](_0x9481('0xe'),auth['isAuthenticated'](),controller[_0x9481('0xf')]);router['get'](_0x9481('0x10'),auth['isAuthenticated'](),controller[_0x9481('0x11')]);router[_0x9481('0x12')]('/',auth[_0x9481('0xa')](),controller[_0x9481('0x13')]);router[_0x9481('0x12')](_0x9481('0x10'),auth[_0x9481('0xa')](),controller[_0x9481('0x14')]);router[_0x9481('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x9481('0x16')]);router[_0x9481('0x17')](_0x9481('0xe'),auth[_0x9481('0xa')](),controller[_0x9481('0x18')]);router[_0x9481('0x17')](_0x9481('0x10'),auth['isAuthenticated'](),controller[_0x9481('0x19')]);module[_0x9481('0x1a')]=router; \ No newline at end of file +var _0x7b84=['index','/describe','describe','/:id','show','/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated'];(function(_0x46ca03,_0x1e57bf){var _0x2f2e6b=function(_0x23e13a){while(--_0x23e13a){_0x46ca03['push'](_0x46ca03['shift']());}};_0x2f2e6b(++_0x1e57bf);}(_0x7b84,0x17c));var _0x47b8=function(_0xe2a103,_0x276709){_0xe2a103=_0xe2a103-0x0;var _0x5358e4=_0x7b84[_0xe2a103];return _0x5358e4;};'use strict';var multer=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var path=require(_0x47b8('0x2'));var timeout=require(_0x47b8('0x3'));var express=require(_0x47b8('0x4'));var router=express[_0x47b8('0x5')]();var fs_extra=require(_0x47b8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var controller=require(_0x47b8('0x9'));router[_0x47b8('0xa')]('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0xc')]);router['get'](_0x47b8('0xd'),auth[_0x47b8('0xb')](),controller[_0x47b8('0xe')]);router[_0x47b8('0xa')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x10')]);router[_0x47b8('0xa')](_0x47b8('0x11'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x12')]);router[_0x47b8('0x13')]('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0x14')]);router[_0x47b8('0x13')](_0x47b8('0x11'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x15')]);router[_0x47b8('0x16')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x17')]);router[_0x47b8('0x18')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x19')]);router[_0x47b8('0x18')]('/:id/users',auth[_0x47b8('0xb')](),controller[_0x47b8('0x1a')]);module[_0x47b8('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 7b8eebc..38e9f27 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 _0x8de8=['VIRTUAL','system-','getDataValue','name','sequelize','STRING'];(function(_0x17406e,_0x1049fd){var _0x2bfc5a=function(_0x2aae05){while(--_0x2aae05){_0x17406e['push'](_0x17406e['shift']());}};_0x2bfc5a(++_0x1049fd);}(_0x8de8,0x19c));var _0x88de=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8de8[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x88de('0x0'));module['exports']={'name':{'type':Sequelize[_0x88de('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x88de('0x2')],'get':function(_0x1552e0){return _0x88de('0x3')+this[_0x88de('0x4')](_0x88de('0x5'))+'-';}},'description':{'type':Sequelize[_0x88de('0x1')]},'callerIdAll':{'type':Sequelize[_0x88de('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xaa51=['getDataValue','STRING','INTEGER','sequelize','exports','name','VIRTUAL'];(function(_0x390ca2,_0x404738){var _0x46fa3a=function(_0x9ea992){while(--_0x9ea992){_0x390ca2['push'](_0x390ca2['shift']());}};_0x46fa3a(++_0x404738);}(_0xaa51,0xf8));var _0x1aa5=function(_0x223b96,_0x27e9e4){_0x223b96=_0x223b96-0x0;var _0x38fd4d=_0xaa51[_0x223b96];return _0x38fd4d;};'use strict';var Sequelize=require(_0x1aa5('0x0'));module[_0x1aa5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1aa5('0x2')},'prefix':{'type':Sequelize[_0x1aa5('0x3')],'get':function(_0x17b846){return'system-'+this[_0x1aa5('0x4')](_0x1aa5('0x2'))+'-';}},'description':{'type':Sequelize[_0x1aa5('0x5')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x1aa5('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 4f54a07..1317c45 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 _0x8aad=['name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','describe','create','transaction','get','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','VoiceExtensionId','bulkCreate','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','${EXTEN:','charAt','system-','findById','addAgents','body','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','User','nolimit','html-pdf','eml-format','zip-dir','request-promise','moment','util','to-csv','ejs','fs-extra','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','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','VoicePrefixes','UserProfileResource','error'];(function(_0x435dd2,_0x1ac0dc){var _0x5e9200=function(_0x27e908){while(--_0x27e908){_0x435dd2['push'](_0x435dd2['shift']());}};_0x5e9200(++_0x1ac0dc);}(_0x8aad,0x146));var _0xd8aa=function(_0x3196c4,_0x2eb9c7){_0x3196c4=_0x3196c4-0x0;var _0x578fb2=_0x8aad[_0x3196c4];return _0x578fb2;};'use strict';var pdf=require(_0xd8aa('0x0'));var emlformat=require(_0xd8aa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd8aa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd8aa('0x3'));var moment=require(_0xd8aa('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd8aa('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xd8aa('0x6'));var ejs=require(_0xd8aa('0x7'));var fs=require('fs');var fs_extra=require(_0xd8aa('0x8'));var _=require('lodash');var squel=require(_0xd8aa('0x9'));var crypto=require(_0xd8aa('0xa'));var jsforce=require(_0xd8aa('0xb'));var deskjs=require(_0xd8aa('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd8aa('0xd'));var Redis=require(_0xd8aa('0xe'));var authService=require(_0xd8aa('0xf'));var qs=require(_0xd8aa('0x10'));var as=require(_0xd8aa('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd8aa('0x12'))(_0xd8aa('0x13'));var utils=require(_0xd8aa('0x14'));var config=require(_0xd8aa('0x15'));var licenseUtil=require(_0xd8aa('0x16'));var db=require(_0xd8aa('0x17'))['db'];config[_0xd8aa('0x18')]=_[_0xd8aa('0x19')](config[_0xd8aa('0x18')],{'host':_0xd8aa('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd8aa('0x1b'))[_0xd8aa('0x1c')](socket);function respondWithStatusCode(_0x2bbd1e,_0x47c131){_0x47c131=_0x47c131||0xcc;return function(_0x2678ed){if(_0x2678ed){return _0x2bbd1e[_0xd8aa('0x1d')](_0x47c131);}return _0x2bbd1e[_0xd8aa('0x1e')](_0x47c131)[_0xd8aa('0x1f')]();};}function respondWithResult(_0x47a0e3,_0x476930){_0x476930=_0x476930||0xc8;return function(_0xa9ba1b){if(_0xa9ba1b){return _0x47a0e3['status'](_0x476930)[_0xd8aa('0x20')](_0xa9ba1b);}};}function respondWithFilteredResult(_0x223a34,_0x32e2cd){return function(_0x3a29ca){if(_0x3a29ca){var _0x2d34ac=_0x3a29ca[_0xd8aa('0x21')],_0x4953be=_0x32e2cd[_0xd8aa('0x22')],_0x43d3fa=_0x32e2cd['offset']+_0x32e2cd[_0xd8aa('0x23')],_0x266308;if(_0x43d3fa>=_0x2d34ac){_0x43d3fa=_0x2d34ac;_0x266308=0xc8;}else{_0x266308=0xce;}_0x223a34[_0xd8aa('0x1e')](_0x266308);return _0x223a34[_0xd8aa('0x24')](_0xd8aa('0x25'),_0x4953be+'-'+_0x43d3fa+'/'+_0x2d34ac)[_0xd8aa('0x20')](_0x3a29ca);}return null;};}function patchUpdates(_0x4fe5d8){return function(_0xe1219){try{jsonpatch[_0xd8aa('0x26')](_0xe1219,_0x4fe5d8,!![]);}catch(_0xc4f55c){return BPromise['reject'](_0xc4f55c);}return _0xe1219[_0xd8aa('0x27')]();};}function saveUpdates(_0x7a4ce7,_0x1d1f87){return function(_0x290849){if(_0x290849){return _0x290849[_0xd8aa('0x28')](_0x7a4ce7)[_0xd8aa('0x29')](function(_0x1f64f8){return _0x1f64f8;});}return null;};}function removeEntity(_0x34d957,_0x375f64){return function(_0x210176){if(_0x210176){return _0x210176[_0xd8aa('0x2a')]()[_0xd8aa('0x29')](function(){var _0x26cc66=_0x210176['get']({'plain':!![]});var _0x1f066a=_0xd8aa('0x2b');return db[_0xd8aa('0x2c')][_0xd8aa('0x2a')]({'where':{'type':_0x1f066a,'resourceId':_0x26cc66['id']}})[_0xd8aa('0x29')](function(){return _0x210176;});})[_0xd8aa('0x29')](function(){_0x34d957[_0xd8aa('0x1e')](0xcc)[_0xd8aa('0x1f')]();});}};}function handleEntityNotFound(_0x3bba1d,_0xbe531){return function(_0x4cdb90){if(!_0x4cdb90){_0x3bba1d[_0xd8aa('0x1d')](0x194);}return _0x4cdb90;};}function handleError(_0x34b792,_0x214393){_0x214393=_0x214393||0x1f4;return function(_0x49a7c8){logger[_0xd8aa('0x2d')](_0x49a7c8['stack']);if(_0x49a7c8[_0xd8aa('0x2e')]){delete _0x49a7c8[_0xd8aa('0x2e')];}_0x34b792[_0xd8aa('0x1e')](_0x214393)[_0xd8aa('0x2f')](_0x49a7c8);};}exports[_0xd8aa('0x30')]=function(_0x28f3cc,_0xd8d3b3){var _0x3cbe8d={},_0x5e41e6={},_0x459979={'count':0x0,'rows':[]};var _0x1c6fe6=_[_0xd8aa('0x31')](db[_0xd8aa('0x32')][_0xd8aa('0x33')],function(_0x3b8476){return{'name':_0x3b8476[_0xd8aa('0x34')],'type':_0x3b8476[_0xd8aa('0x35')]['key']};});_0x5e41e6[_0xd8aa('0x36')]=_[_0xd8aa('0x31')](_0x1c6fe6,_0xd8aa('0x2e'));_0x5e41e6['query']=_[_0xd8aa('0x37')](_0x28f3cc[_0xd8aa('0x38')]);_0x5e41e6[_0xd8aa('0x39')]=_[_0xd8aa('0x3a')](_0x5e41e6[_0xd8aa('0x36')],_0x5e41e6[_0xd8aa('0x38')]);_0x3cbe8d[_0xd8aa('0x3b')]=_[_0xd8aa('0x3a')](_0x5e41e6[_0xd8aa('0x36')],qs['fields'](_0x28f3cc[_0xd8aa('0x38')][_0xd8aa('0x3c')]));_0x3cbe8d[_0xd8aa('0x3b')]=_0x3cbe8d[_0xd8aa('0x3b')][_0xd8aa('0x3d')]?_0x3cbe8d[_0xd8aa('0x3b')]:_0x5e41e6[_0xd8aa('0x36')];if(!_0x28f3cc[_0xd8aa('0x38')][_0xd8aa('0x3e')]('nolimit')){_0x3cbe8d[_0xd8aa('0x23')]=qs['limit'](_0x28f3cc[_0xd8aa('0x38')][_0xd8aa('0x23')]);_0x3cbe8d['offset']=qs[_0xd8aa('0x22')](_0x28f3cc[_0xd8aa('0x38')][_0xd8aa('0x22')]);}_0x3cbe8d[_0xd8aa('0x3f')]=qs[_0xd8aa('0x40')](_0x28f3cc['query']['sort']);_0x3cbe8d[_0xd8aa('0x41')]=qs['filters'](_[_0xd8aa('0x42')](_0x28f3cc[_0xd8aa('0x38')],_0x5e41e6[_0xd8aa('0x39')]),_0x1c6fe6);if(_0x28f3cc[_0xd8aa('0x38')][_0xd8aa('0x43')]){_0x3cbe8d[_0xd8aa('0x41')]=_[_0xd8aa('0x44')](_0x3cbe8d[_0xd8aa('0x41')],{'$or':_[_0xd8aa('0x31')](_0x1c6fe6,function(_0xa34bea){if(_0xa34bea[_0xd8aa('0x35')]!=='VIRTUAL'){var _0x17ebb4={};_0x17ebb4[_0xa34bea[_0xd8aa('0x2e')]]={'$like':'%'+_0x28f3cc[_0xd8aa('0x38')]['filter']+'%'};return _0x17ebb4;}})});}_0x3cbe8d=_[_0xd8aa('0x44')]({},_0x3cbe8d,_0x28f3cc[_0xd8aa('0x45')]);var _0x417ff9={'where':_0x3cbe8d[_0xd8aa('0x41')]};return db[_0xd8aa('0x32')][_0xd8aa('0x21')](_0x417ff9)[_0xd8aa('0x29')](function(_0x4570b7){_0x459979[_0xd8aa('0x21')]=_0x4570b7;if(_0x28f3cc[_0xd8aa('0x38')][_0xd8aa('0x46')]){_0x3cbe8d[_0xd8aa('0x47')]=[{'all':!![]}];}return db[_0xd8aa('0x32')][_0xd8aa('0x48')](_0x3cbe8d);})[_0xd8aa('0x29')](function(_0x38b13e){_0x459979[_0xd8aa('0x49')]=_0x38b13e;return _0x459979;})[_0xd8aa('0x29')](respondWithFilteredResult(_0xd8d3b3,_0x3cbe8d))['catch'](handleError(_0xd8d3b3,null));};exports[_0xd8aa('0x4a')]=function(_0x22cce6,_0x146ebd){var _0x148c83={'raw':![],'where':{'id':_0x22cce6[_0xd8aa('0x4b')]['id']}},_0x16c38d={};_0x16c38d['model']=_[_0xd8aa('0x37')](db['VoicePrefix'][_0xd8aa('0x33')]);_0x16c38d['query']=_[_0xd8aa('0x37')](_0x22cce6['query']);_0x16c38d['filters']=_[_0xd8aa('0x3a')](_0x16c38d[_0xd8aa('0x36')],_0x16c38d[_0xd8aa('0x38')]);_0x148c83[_0xd8aa('0x3b')]=_[_0xd8aa('0x3a')](_0x16c38d[_0xd8aa('0x36')],qs['fields'](_0x22cce6[_0xd8aa('0x38')][_0xd8aa('0x3c')]));_0x148c83[_0xd8aa('0x3b')]=_0x148c83[_0xd8aa('0x3b')][_0xd8aa('0x3d')]?_0x148c83['attributes']:_0x16c38d['model'];if(_0x22cce6['query'][_0xd8aa('0x46')]){_0x148c83[_0xd8aa('0x47')]=[{'all':!![]}];}_0x148c83=_[_0xd8aa('0x44')]({},_0x148c83,_0x22cce6[_0xd8aa('0x45')]);return db[_0xd8aa('0x32')][_0xd8aa('0x4c')](_0x148c83)['then'](handleEntityNotFound(_0x146ebd,null))[_0xd8aa('0x29')](respondWithResult(_0x146ebd,null))[_0xd8aa('0x4d')](handleError(_0x146ebd,null));};exports['destroy']=function(_0x2ad21f,_0x10a63e){return db[_0xd8aa('0x32')]['find']({'where':{'id':_0x2ad21f[_0xd8aa('0x4b')]['id']}})[_0xd8aa('0x29')](handleEntityNotFound(_0x10a63e,null))[_0xd8aa('0x29')](removeEntity(_0x10a63e,null))[_0xd8aa('0x4d')](handleError(_0x10a63e,null));};exports[_0xd8aa('0x4e')]=function(_0x1be00f,_0x4f494d){return db['VoicePrefix'][_0xd8aa('0x4e')]()[_0xd8aa('0x29')](respondWithResult(_0x4f494d,null))[_0xd8aa('0x4d')](handleError(_0x4f494d,null));};exports[_0xd8aa('0x4f')]=function(_0xe810a1,_0x1295b5){var _0x1922dd;return db['sequelize'][_0xd8aa('0x50')](function(_0x4035c2){return db['VoicePrefix'][_0xd8aa('0x4f')](_0xe810a1['body'],{'transaction':_0x4035c2})[_0xd8aa('0x29')](function(_0x13f202){_0x1922dd=_0x13f202[_0xd8aa('0x51')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x1922dd['VoiceExtensionId']},'raw':!![]})['then'](function(_0x406472){return createVoicePrefixExtensions(_0x1922dd,_0x406472,_0x4035c2);});});})[_0xd8aa('0x29')](function(){var _0x36222e=_0xe810a1['user']['get']({'plain':!![]});if(!_0x36222e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36222e[_0xd8aa('0x52')]===_0xd8aa('0x53')){var _0x178775=_0x1922dd;return db[_0xd8aa('0x54')][_0xd8aa('0x4c')]({'where':{'name':_0xd8aa('0x2b'),'userProfileId':_0x36222e[_0xd8aa('0x55')]},'raw':!![]})[_0xd8aa('0x29')](function(_0x1503df){if(_0x1503df&&_0x1503df[_0xd8aa('0x56')]===0x0){return db[_0xd8aa('0x2c')][_0xd8aa('0x4f')]({'name':_0x178775[_0xd8aa('0x2e')],'resourceId':_0x178775['id'],'type':_0x1503df['name'],'sectionId':_0x1503df['id']},{})['then'](function(){return _0x1922dd;});}else{return _0x1922dd;}})[_0xd8aa('0x4d')](function(_0x361118){logger[_0xd8aa('0x2d')](_0xd8aa('0x57'),_0x361118);throw _0x361118;});}return _0x1922dd;})['then'](respondWithResult(_0x1295b5,null))[_0xd8aa('0x4d')](handleError(_0x1295b5,null));};function Extension(_0x34efde,_0x5875df,_0x53564e,_0x2c5650){this[_0xd8aa('0x58')]=_0xd8aa('0x59');this[_0xd8aa('0x5a')]=_0x34efde;this['app']=_0x53564e;this['type']=_0xd8aa('0x5b');this['description']=_0xd8aa('0x5c');this[_0xd8aa('0x5d')]=_0x5875df;this[_0xd8aa('0x5e')]=_0x2c5650;}function createVoicePrefixExtensions(_0x2d41c9,_0x158eee,_0x43115f){return new BPromise(function(_0x4e4a62,_0x45190f){var _0x349cf0=new Extension(formatPrefixName(_0x2d41c9[_0xd8aa('0x5f')]),0x1,_0xd8aa('0x60'),_0xd8aa('0x61'));_0x349cf0[_0xd8aa('0x62')]=_0x2d41c9['id'];return db[_0xd8aa('0x63')][_0xd8aa('0x4f')](_0x349cf0,{'transaction':_0x43115f})[_0xd8aa('0x29')](function(_0xe8d199){var _0x3970ea=_0xe8d199[_0xd8aa('0x51')]({'plain':!![]});var _0x167532=_[_0xd8aa('0x31')](addVoicePrefixExtensions(_0x2d41c9,_0x158eee),function(_0x477454){_0x477454[_0xd8aa('0x64')]=_0x3970ea['id'];_0x477454[_0xd8aa('0x62')]=_0x2d41c9['id'];return _0x477454;});return db[_0xd8aa('0x63')][_0xd8aa('0x65')](_0x167532,{'transaction':_0x43115f})[_0xd8aa('0x29')](function(_0x9ec7b9){if(!_0x9ec7b9){return _0x45190f('Extensions\x20creation\x20failed');}else{return _0x4e4a62(_0x9ec7b9);}})['catch'](function(_0x50ce81){return _0x45190f(_0x50ce81);});});;});};function addVoicePrefixExtensions(_0x2e0cfb,_0x5e3369){var _0xee4dc2=[];var _0xcda805=formatPrefixName(_0x2e0cfb[_0xd8aa('0x5f')]);_0xee4dc2[_0xd8aa('0x66')](new Extension(_0xcda805,0x2,_0xd8aa('0x67'),_0xd8aa('0x68')+_0x2e0cfb[_0xd8aa('0x2e')]));if(_0x2e0cfb[_0xd8aa('0x69')]){_0xee4dc2[_0xd8aa('0x66')](new Extension(_0xcda805,0x3,_0xd8aa('0x67'),_0xd8aa('0x6a')+_0x2e0cfb['callerIdAll']));}else{_0xee4dc2['push'](new Extension(_0xcda805,0x3,_0xd8aa('0x60'),'No\x20callerid\x20available'));}_0xee4dc2[_0xd8aa('0x66')](new Extension(_0xcda805,0x4,'goto',_0x5e3369['context']+','+_0xd8aa('0x6b')+(0x8+_0x2e0cfb[_0xd8aa('0x2e')][_0xd8aa('0x3d')])+'}'+','+0x1));return _0xee4dc2;}function formatPrefixName(_0x3ee72e){var _0x565409='_';for(var _0x29c3e8=0x0;_0x29c3e8<_0x3ee72e[_0xd8aa('0x3d')];_0x29c3e8++){if(_0x3ee72e[_0xd8aa('0x6c')](_0x29c3e8)=='-'){_0x565409+=_0x3ee72e[_0xd8aa('0x6c')](_0x29c3e8);}else{_0x565409+='['+_0x3ee72e[_0xd8aa('0x6c')](_0x29c3e8)+']';}}_0x565409+='.';return _0x565409;}exports[_0xd8aa('0x28')]=function(_0x20865a,_0x3689f1,_0x198984){var _0xf03ade=_0x20865a['body'];_0xf03ade[_0xd8aa('0x5f')]=_0xd8aa('0x6d')+_0xf03ade[_0xd8aa('0x2e')]+'-';return db['sequelize']['transaction'](function(_0x6a8bb1){return db[_0xd8aa('0x32')]['update'](_0xf03ade,{'where':{'id':_0xf03ade['id']},'transaction':_0x6a8bb1})[_0xd8aa('0x29')](function(){return db[_0xd8aa('0x63')][_0xd8aa('0x2a')]({'where':{'VoicePrefixId':_0xf03ade['id']},'transaction':_0x6a8bb1})[_0xd8aa('0x29')](function(){return db[_0xd8aa('0x63')][_0xd8aa('0x4c')]({'where':{'id':_0xf03ade[_0xd8aa('0x64')]},'raw':!![]})['then'](function(_0x2ff2ec){return createVoicePrefixExtensions(_0xf03ade,_0x2ff2ec,_0x6a8bb1);});});});})[_0xd8aa('0x29')](function(){return db[_0xd8aa('0x32')][_0xd8aa('0x6e')](_0xf03ade['id']);})[_0xd8aa('0x29')](respondWithResult(_0x3689f1,null))[_0xd8aa('0x4d')](handleError(_0x3689f1,null));};exports[_0xd8aa('0x6f')]=function(_0x3ea5a8,_0x56d58b,_0x3ba944){return db[_0xd8aa('0x32')][_0xd8aa('0x4c')]({'where':{'id':_0x3ea5a8['params']['id']}})[_0xd8aa('0x29')](handleEntityNotFound(_0x56d58b,null))[_0xd8aa('0x29')](function(_0x19aa56){if(_0x19aa56){return _0x19aa56[_0xd8aa('0x6f')](_0x3ea5a8[_0xd8aa('0x70')][_0xd8aa('0x71')],_[_0xd8aa('0x72')](_0x3ea5a8[_0xd8aa('0x70')],[_0xd8aa('0x71'),'id'])||{})[_0xd8aa('0x73')](function(_0x377a95){for(var _0x373194=0x0;_0x373194<_0x3ea5a8[_0xd8aa('0x70')][_0xd8aa('0x71')][_0xd8aa('0x3d')];_0x373194+=0x1){socket[_0xd8aa('0x74')](_0xd8aa('0x75'),{'UserId':_0x3ea5a8[_0xd8aa('0x70')]['ids'][_0x373194],'VoicePrefixId':_0x3ea5a8[_0xd8aa('0x4b')]['id']});}return _0x377a95;});}})[_0xd8aa('0x29')](respondWithResult(_0x56d58b,null))[_0xd8aa('0x4d')](handleError(_0x56d58b,null));};exports[_0xd8aa('0x76')]=function(_0x5f0a77,_0x228841,_0x160a59){return db[_0xd8aa('0x32')][_0xd8aa('0x4c')]({'where':{'id':_0x5f0a77['params']['id']}})[_0xd8aa('0x29')](handleEntityNotFound(_0x228841,null))['then'](function(_0x65fe75){if(_0x65fe75){return _0x65fe75[_0xd8aa('0x76')](_0x5f0a77[_0xd8aa('0x38')][_0xd8aa('0x71')])[_0xd8aa('0x29')](function(){if(_[_0xd8aa('0x77')](_0x5f0a77[_0xd8aa('0x38')]['ids'])){for(var _0x512c32=0x0;_0x512c32<_0x5f0a77[_0xd8aa('0x38')][_0xd8aa('0x71')][_0xd8aa('0x3d')];_0x512c32+=0x1){socket['emit'](_0xd8aa('0x78'),{'UserId':Number(_0x5f0a77[_0xd8aa('0x38')][_0xd8aa('0x71')][_0x512c32]),'VoicePrefixId':Number(_0x5f0a77[_0xd8aa('0x4b')]['id'])});}}else{socket[_0xd8aa('0x74')]('userVoicePrefix:remove',{'UserId':Number(_0x5f0a77['query'][_0xd8aa('0x71')]),'VoicePrefixId':Number(_0x5f0a77['params']['id'])});}});}})[_0xd8aa('0x29')](respondWithStatusCode(_0x228841,null))[_0xd8aa('0x4d')](handleError(_0x228841,null));};exports[_0xd8aa('0x79')]=function(_0x35bf15,_0xb8f3a6,_0x29bfd6){var _0x49d5ab={};var _0xd23e6b={};var _0x1faa83;var _0x3b574f;return db['VoicePrefix']['findOne']({'where':{'id':_0x35bf15['params']['id']}})['then'](handleEntityNotFound(_0xb8f3a6,null))[_0xd8aa('0x29')](function(_0x196418){if(_0x196418){_0x1faa83=_0x196418;_0xd23e6b['model']=_['keys'](db[_0xd8aa('0x7a')][_0xd8aa('0x33')]);_0xd23e6b['query']=_['keys'](_0x35bf15[_0xd8aa('0x38')]);_0xd23e6b[_0xd8aa('0x39')]=_[_0xd8aa('0x3a')](_0xd23e6b['model'],_0xd23e6b['query']);_0x49d5ab[_0xd8aa('0x3b')]=_[_0xd8aa('0x3a')](_0xd23e6b[_0xd8aa('0x36')],qs[_0xd8aa('0x3c')](_0x35bf15[_0xd8aa('0x38')][_0xd8aa('0x3c')]));_0x49d5ab[_0xd8aa('0x3b')]=_0x49d5ab[_0xd8aa('0x3b')][_0xd8aa('0x3d')]?_0x49d5ab[_0xd8aa('0x3b')]:_0xd23e6b[_0xd8aa('0x36')];_0x49d5ab[_0xd8aa('0x3f')]=qs[_0xd8aa('0x40')](_0x35bf15[_0xd8aa('0x38')][_0xd8aa('0x40')]);_0x49d5ab[_0xd8aa('0x41')]=qs['filters'](_[_0xd8aa('0x42')](_0x35bf15[_0xd8aa('0x38')],_0xd23e6b['filters']));if(_0x35bf15[_0xd8aa('0x38')][_0xd8aa('0x43')]){_0x49d5ab[_0xd8aa('0x41')]=_[_0xd8aa('0x44')](_0x49d5ab[_0xd8aa('0x41')],{'$or':_['map'](_0x49d5ab[_0xd8aa('0x3b')],function(_0xd9b3bb){var _0x57eaff={};_0x57eaff[_0xd9b3bb]={'$like':'%'+_0x35bf15[_0xd8aa('0x38')][_0xd8aa('0x43')]+'%'};return _0x57eaff;})});}_0x49d5ab=_['merge']({},_0x49d5ab,_0x35bf15[_0xd8aa('0x45')]);return _0x1faa83[_0xd8aa('0x79')](_0x49d5ab);}})[_0xd8aa('0x29')](function(_0x2c2915){if(_0x2c2915){_0x3b574f=_0x2c2915[_0xd8aa('0x3d')];if(!_0x35bf15[_0xd8aa('0x38')]['hasOwnProperty'](_0xd8aa('0x7b'))){_0x49d5ab[_0xd8aa('0x23')]=qs[_0xd8aa('0x23')](_0x35bf15[_0xd8aa('0x38')][_0xd8aa('0x23')]);_0x49d5ab['offset']=qs[_0xd8aa('0x22')](_0x35bf15['query'][_0xd8aa('0x22')]);}return _0x1faa83[_0xd8aa('0x79')](_0x49d5ab);}})[_0xd8aa('0x29')](function(_0xa94db7){if(_0xa94db7){return _0xa94db7?{'count':_0x3b574f,'rows':_0xa94db7}:null;}})['then'](respondWithResult(_0xb8f3a6,null))[_0xd8aa('0x4d')](handleError(_0xb8f3a6,null));}; \ No newline at end of file +var _0x13c5=['userVoicePrefix:remove','getAgents','findOne','sort','hasOwnProperty','html-pdf','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','redis','localhost','./voicePrefix.socket','register','sendStatus','end','count','offset','limit','status','set','Content-Range','json','reject','save','then','get','VoicePrefixes','UserProfileResource','destroy','error','stack','index','map','rawAttributes','type','key','name','query','keys','model','attributes','intersection','fields','length','nolimit','order','filters','pick','merge','where','VIRTUAL','filter','options','VoicePrefix','includeAll','include','findAll','rows','show','params','find','catch','describe','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','description','Voice\x20Prefix\x20Extension','priority','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','callerIdAll','NoOp','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','update','system-','sequelize','findById','addAgents','ids','omit','spread','removeAgents','isArray','emit'];(function(_0x1f6690,_0x22a6c8){var _0x3a78ea=function(_0x3b9a76){while(--_0x3b9a76){_0x1f6690['push'](_0x1f6690['shift']());}};_0x3a78ea(++_0x22a6c8);}(_0x13c5,0x7a));var _0x513c=function(_0x202f1a,_0x384924){_0x202f1a=_0x202f1a-0x0;var _0x4cdd89=_0x13c5[_0x202f1a];return _0x4cdd89;};'use strict';var pdf=require(_0x513c('0x0'));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('moment');var BPromise=require(_0x513c('0x1'));var Mustache=require('mustache');var util=require('util');var path=require(_0x513c('0x2'));var sox=require(_0x513c('0x3'));var csv=require(_0x513c('0x4'));var ejs=require(_0x513c('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x513c('0x6'));var crypto=require(_0x513c('0x7'));var jsforce=require(_0x513c('0x8'));var deskjs=require(_0x513c('0x9'));var toCsv=require(_0x513c('0x4'));var querystring=require(_0x513c('0xa'));var Papa=require(_0x513c('0xb'));var Redis=require(_0x513c('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x513c('0xd'));var as=require(_0x513c('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x513c('0xf'));var utils=require(_0x513c('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x513c('0x11')]=_['defaults'](config[_0x513c('0x11')],{'host':_0x513c('0x12'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x513c('0x11')]));require(_0x513c('0x13'))[_0x513c('0x14')](socket);function respondWithStatusCode(_0x402067,_0x31e044){_0x31e044=_0x31e044||0xcc;return function(_0x57f359){if(_0x57f359){return _0x402067[_0x513c('0x15')](_0x31e044);}return _0x402067['status'](_0x31e044)[_0x513c('0x16')]();};}function respondWithResult(_0x380a0a,_0x3d0a3f){_0x3d0a3f=_0x3d0a3f||0xc8;return function(_0x2fd03e){if(_0x2fd03e){return _0x380a0a['status'](_0x3d0a3f)['json'](_0x2fd03e);}};}function respondWithFilteredResult(_0x4c2247,_0x100bc7){return function(_0x341b20){if(_0x341b20){var _0x51196d=_0x341b20[_0x513c('0x17')],_0x58b89f=_0x100bc7[_0x513c('0x18')],_0x217e7a=_0x100bc7['offset']+_0x100bc7[_0x513c('0x19')],_0xaa7657;if(_0x217e7a>=_0x51196d){_0x217e7a=_0x51196d;_0xaa7657=0xc8;}else{_0xaa7657=0xce;}_0x4c2247[_0x513c('0x1a')](_0xaa7657);return _0x4c2247[_0x513c('0x1b')](_0x513c('0x1c'),_0x58b89f+'-'+_0x217e7a+'/'+_0x51196d)[_0x513c('0x1d')](_0x341b20);}return null;};}function patchUpdates(_0x52287b){return function(_0x153132){try{jsonpatch['apply'](_0x153132,_0x52287b,!![]);}catch(_0xea28b3){return BPromise[_0x513c('0x1e')](_0xea28b3);}return _0x153132[_0x513c('0x1f')]();};}function saveUpdates(_0xcd8a3b,_0x3661c7){return function(_0x5ac3be){if(_0x5ac3be){return _0x5ac3be['update'](_0xcd8a3b)[_0x513c('0x20')](function(_0x390f1e){return _0x390f1e;});}return null;};}function removeEntity(_0x58dea0,_0x435b57){return function(_0x28c0ee){if(_0x28c0ee){return _0x28c0ee['destroy']()[_0x513c('0x20')](function(){var _0x465522=_0x28c0ee[_0x513c('0x21')]({'plain':!![]});var _0x24cfa7=_0x513c('0x22');return db[_0x513c('0x23')][_0x513c('0x24')]({'where':{'type':_0x24cfa7,'resourceId':_0x465522['id']}})['then'](function(){return _0x28c0ee;});})[_0x513c('0x20')](function(){_0x58dea0[_0x513c('0x1a')](0xcc)[_0x513c('0x16')]();});}};}function handleEntityNotFound(_0x18dec2,_0xf324ee){return function(_0x4a2f3d){if(!_0x4a2f3d){_0x18dec2[_0x513c('0x15')](0x194);}return _0x4a2f3d;};}function handleError(_0x28de12,_0x3cbe93){_0x3cbe93=_0x3cbe93||0x1f4;return function(_0x308466){logger[_0x513c('0x25')](_0x308466[_0x513c('0x26')]);if(_0x308466['name']){delete _0x308466['name'];}_0x28de12[_0x513c('0x1a')](_0x3cbe93)['send'](_0x308466);};}exports[_0x513c('0x27')]=function(_0x2bd36b,_0xb087c2){var _0x5c906a={},_0x1546a7={},_0x24d971={'count':0x0,'rows':[]};var _0x38924e=_[_0x513c('0x28')](db['VoicePrefix'][_0x513c('0x29')],function(_0x198761){return{'name':_0x198761['fieldName'],'type':_0x198761[_0x513c('0x2a')][_0x513c('0x2b')]};});_0x1546a7['model']=_[_0x513c('0x28')](_0x38924e,_0x513c('0x2c'));_0x1546a7[_0x513c('0x2d')]=_[_0x513c('0x2e')](_0x2bd36b[_0x513c('0x2d')]);_0x1546a7['filters']=_['intersection'](_0x1546a7[_0x513c('0x2f')],_0x1546a7['query']);_0x5c906a[_0x513c('0x30')]=_[_0x513c('0x31')](_0x1546a7[_0x513c('0x2f')],qs[_0x513c('0x32')](_0x2bd36b[_0x513c('0x2d')][_0x513c('0x32')]));_0x5c906a[_0x513c('0x30')]=_0x5c906a['attributes'][_0x513c('0x33')]?_0x5c906a[_0x513c('0x30')]:_0x1546a7[_0x513c('0x2f')];if(!_0x2bd36b[_0x513c('0x2d')]['hasOwnProperty'](_0x513c('0x34'))){_0x5c906a['limit']=qs[_0x513c('0x19')](_0x2bd36b[_0x513c('0x2d')]['limit']);_0x5c906a['offset']=qs[_0x513c('0x18')](_0x2bd36b['query']['offset']);}_0x5c906a[_0x513c('0x35')]=qs['sort'](_0x2bd36b[_0x513c('0x2d')]['sort']);_0x5c906a['where']=qs[_0x513c('0x36')](_[_0x513c('0x37')](_0x2bd36b[_0x513c('0x2d')],_0x1546a7['filters']),_0x38924e);if(_0x2bd36b[_0x513c('0x2d')]['filter']){_0x5c906a['where']=_[_0x513c('0x38')](_0x5c906a[_0x513c('0x39')],{'$or':_['map'](_0x38924e,function(_0x3072e5){if(_0x3072e5[_0x513c('0x2a')]!==_0x513c('0x3a')){var _0x57d07f={};_0x57d07f[_0x3072e5[_0x513c('0x2c')]]={'$like':'%'+_0x2bd36b[_0x513c('0x2d')][_0x513c('0x3b')]+'%'};return _0x57d07f;}})});}_0x5c906a=_[_0x513c('0x38')]({},_0x5c906a,_0x2bd36b[_0x513c('0x3c')]);var _0x8b8d33={'where':_0x5c906a['where']};return db[_0x513c('0x3d')][_0x513c('0x17')](_0x8b8d33)[_0x513c('0x20')](function(_0x47f720){_0x24d971[_0x513c('0x17')]=_0x47f720;if(_0x2bd36b[_0x513c('0x2d')][_0x513c('0x3e')]){_0x5c906a[_0x513c('0x3f')]=[{'all':!![]}];}return db[_0x513c('0x3d')][_0x513c('0x40')](_0x5c906a);})['then'](function(_0x13cc1b){_0x24d971[_0x513c('0x41')]=_0x13cc1b;return _0x24d971;})[_0x513c('0x20')](respondWithFilteredResult(_0xb087c2,_0x5c906a))['catch'](handleError(_0xb087c2,null));};exports[_0x513c('0x42')]=function(_0x21acfc,_0x18841c){var _0x12b073={'raw':![],'where':{'id':_0x21acfc[_0x513c('0x43')]['id']}},_0x30b8c4={};_0x30b8c4['model']=_[_0x513c('0x2e')](db[_0x513c('0x3d')][_0x513c('0x29')]);_0x30b8c4[_0x513c('0x2d')]=_[_0x513c('0x2e')](_0x21acfc[_0x513c('0x2d')]);_0x30b8c4[_0x513c('0x36')]=_[_0x513c('0x31')](_0x30b8c4[_0x513c('0x2f')],_0x30b8c4['query']);_0x12b073['attributes']=_['intersection'](_0x30b8c4[_0x513c('0x2f')],qs[_0x513c('0x32')](_0x21acfc[_0x513c('0x2d')]['fields']));_0x12b073[_0x513c('0x30')]=_0x12b073[_0x513c('0x30')][_0x513c('0x33')]?_0x12b073[_0x513c('0x30')]:_0x30b8c4[_0x513c('0x2f')];if(_0x21acfc[_0x513c('0x2d')][_0x513c('0x3e')]){_0x12b073[_0x513c('0x3f')]=[{'all':!![]}];}_0x12b073=_['merge']({},_0x12b073,_0x21acfc[_0x513c('0x3c')]);return db[_0x513c('0x3d')][_0x513c('0x44')](_0x12b073)[_0x513c('0x20')](handleEntityNotFound(_0x18841c,null))[_0x513c('0x20')](respondWithResult(_0x18841c,null))[_0x513c('0x45')](handleError(_0x18841c,null));};exports[_0x513c('0x24')]=function(_0x5f320c,_0x3e87be){return db[_0x513c('0x3d')]['find']({'where':{'id':_0x5f320c['params']['id']}})[_0x513c('0x20')](handleEntityNotFound(_0x3e87be,null))[_0x513c('0x20')](removeEntity(_0x3e87be,null))[_0x513c('0x45')](handleError(_0x3e87be,null));};exports[_0x513c('0x46')]=function(_0x38d706,_0x42cf66){return db[_0x513c('0x3d')][_0x513c('0x46')]()[_0x513c('0x20')](respondWithResult(_0x42cf66,null))[_0x513c('0x45')](handleError(_0x42cf66,null));};exports['create']=function(_0x168ad6,_0x25900d){var _0x3b2dcc;return db['sequelize']['transaction'](function(_0x37671a){return db[_0x513c('0x3d')]['create'](_0x168ad6[_0x513c('0x47')],{'transaction':_0x37671a})['then'](function(_0x1a1242){_0x3b2dcc=_0x1a1242[_0x513c('0x21')]({'plain':!![]});return db[_0x513c('0x48')]['find']({'where':{'id':_0x3b2dcc[_0x513c('0x49')]},'raw':!![]})[_0x513c('0x20')](function(_0x208c04){return createVoicePrefixExtensions(_0x3b2dcc,_0x208c04,_0x37671a);});});})[_0x513c('0x20')](function(){var _0x5c9ba3=_0x168ad6[_0x513c('0x4a')]['get']({'plain':!![]});if(!_0x5c9ba3)throw new Error(_0x513c('0x4b'));if(_0x5c9ba3[_0x513c('0x4c')]==='user'){var _0xa1cceb=_0x3b2dcc;return db[_0x513c('0x4d')][_0x513c('0x44')]({'where':{'name':_0x513c('0x22'),'userProfileId':_0x5c9ba3[_0x513c('0x4e')]},'raw':!![]})[_0x513c('0x20')](function(_0xf30bf9){if(_0xf30bf9&&_0xf30bf9[_0x513c('0x4f')]===0x0){return db[_0x513c('0x23')][_0x513c('0x50')]({'name':_0xa1cceb[_0x513c('0x2c')],'resourceId':_0xa1cceb['id'],'type':_0xf30bf9[_0x513c('0x2c')],'sectionId':_0xf30bf9['id']},{})['then'](function(){return _0x3b2dcc;});}else{return _0x3b2dcc;}})[_0x513c('0x45')](function(_0x38e321){logger[_0x513c('0x25')](_0x513c('0x51'),_0x38e321);throw _0x38e321;});}return _0x3b2dcc;})[_0x513c('0x20')](respondWithResult(_0x25900d,null))[_0x513c('0x45')](handleError(_0x25900d,null));};function Extension(_0x1afff5,_0x2823f0,_0x546c17,_0x41b3b0){this['context']=_0x513c('0x52');this[_0x513c('0x53')]=_0x1afff5;this['app']=_0x546c17;this[_0x513c('0x2a')]='system';this[_0x513c('0x54')]=_0x513c('0x55');this[_0x513c('0x56')]=_0x2823f0;this['appdata']=_0x41b3b0;}function createVoicePrefixExtensions(_0xb457df,_0x4199d0,_0x4f1371){return new BPromise(function(_0x3fa25b,_0x2e54dd){var _0x140769=new Extension(formatPrefixName(_0xb457df[_0x513c('0x57')]),0x1,'NoOp',_0x513c('0x58'));_0x140769[_0x513c('0x59')]=_0xb457df['id'];return db[_0x513c('0x48')]['create'](_0x140769,{'transaction':_0x4f1371})['then'](function(_0x300eb0){var _0x170cc9=_0x300eb0['get']({'plain':!![]});var _0x2fee11=_[_0x513c('0x28')](addVoicePrefixExtensions(_0xb457df,_0x4199d0),function(_0x136f92){_0x136f92['VoiceExtensionId']=_0x170cc9['id'];_0x136f92[_0x513c('0x59')]=_0xb457df['id'];return _0x136f92;});return db[_0x513c('0x48')][_0x513c('0x5a')](_0x2fee11,{'transaction':_0x4f1371})[_0x513c('0x20')](function(_0x1e43ad){if(!_0x1e43ad){return _0x2e54dd(_0x513c('0x5b'));}else{return _0x3fa25b(_0x1e43ad);}})['catch'](function(_0x386ecb){return _0x2e54dd(_0x386ecb);});});;});};function addVoicePrefixExtensions(_0x3e4910,_0x4b3af2){var _0x575175=[];var _0x23f614=formatPrefixName(_0x3e4910[_0x513c('0x57')]);_0x575175[_0x513c('0x5c')](new Extension(_0x23f614,0x2,_0x513c('0x5d'),'CDR(prefix)='+_0x3e4910['name']));if(_0x3e4910[_0x513c('0x5e')]){_0x575175[_0x513c('0x5c')](new Extension(_0x23f614,0x3,_0x513c('0x5d'),'PREFIX-CALLERIDALL='+_0x3e4910[_0x513c('0x5e')]));}else{_0x575175[_0x513c('0x5c')](new Extension(_0x23f614,0x3,_0x513c('0x5f'),_0x513c('0x60')));}_0x575175['push'](new Extension(_0x23f614,0x4,_0x513c('0x61'),_0x4b3af2[_0x513c('0x62')]+','+_0x513c('0x63')+(0x8+_0x3e4910[_0x513c('0x2c')][_0x513c('0x33')])+'}'+','+0x1));return _0x575175;}function formatPrefixName(_0x58f44d){var _0x36544e='_';for(var _0x32dabd=0x0;_0x32dabd<_0x58f44d[_0x513c('0x33')];_0x32dabd++){if(_0x58f44d[_0x513c('0x64')](_0x32dabd)=='-'){_0x36544e+=_0x58f44d[_0x513c('0x64')](_0x32dabd);}else{_0x36544e+='['+_0x58f44d[_0x513c('0x64')](_0x32dabd)+']';}}_0x36544e+='.';return _0x36544e;}exports[_0x513c('0x65')]=function(_0x39192c,_0x5d20fe,_0x31c63f){var _0x4c605e=_0x39192c['body'];_0x4c605e[_0x513c('0x57')]=_0x513c('0x66')+_0x4c605e[_0x513c('0x2c')]+'-';return db[_0x513c('0x67')]['transaction'](function(_0x377a71){return db[_0x513c('0x3d')]['update'](_0x4c605e,{'where':{'id':_0x4c605e['id']},'transaction':_0x377a71})['then'](function(){return db['VoiceExtension'][_0x513c('0x24')]({'where':{'VoicePrefixId':_0x4c605e['id']},'transaction':_0x377a71})[_0x513c('0x20')](function(){return db[_0x513c('0x48')]['find']({'where':{'id':_0x4c605e[_0x513c('0x49')]},'raw':!![]})[_0x513c('0x20')](function(_0x3e442c){return createVoicePrefixExtensions(_0x4c605e,_0x3e442c,_0x377a71);});});});})['then'](function(){return db[_0x513c('0x3d')][_0x513c('0x68')](_0x4c605e['id']);})[_0x513c('0x20')](respondWithResult(_0x5d20fe,null))[_0x513c('0x45')](handleError(_0x5d20fe,null));};exports[_0x513c('0x69')]=function(_0x355703,_0x3aeddf,_0x1afb42){return db['VoicePrefix'][_0x513c('0x44')]({'where':{'id':_0x355703[_0x513c('0x43')]['id']}})[_0x513c('0x20')](handleEntityNotFound(_0x3aeddf,null))[_0x513c('0x20')](function(_0x5be333){if(_0x5be333){return _0x5be333[_0x513c('0x69')](_0x355703[_0x513c('0x47')][_0x513c('0x6a')],_[_0x513c('0x6b')](_0x355703[_0x513c('0x47')],['ids','id'])||{})[_0x513c('0x6c')](function(_0x5143bc){for(var _0x49e39f=0x0;_0x49e39f<_0x355703[_0x513c('0x47')][_0x513c('0x6a')][_0x513c('0x33')];_0x49e39f+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':_0x355703[_0x513c('0x47')][_0x513c('0x6a')][_0x49e39f],'VoicePrefixId':_0x355703[_0x513c('0x43')]['id']});}return _0x5143bc;});}})['then'](respondWithResult(_0x3aeddf,null))['catch'](handleError(_0x3aeddf,null));};exports[_0x513c('0x6d')]=function(_0x2b2072,_0x583355,_0x4c1aa3){return db[_0x513c('0x3d')]['find']({'where':{'id':_0x2b2072[_0x513c('0x43')]['id']}})[_0x513c('0x20')](handleEntityNotFound(_0x583355,null))[_0x513c('0x20')](function(_0x30a1c5){if(_0x30a1c5){return _0x30a1c5['removeAgents'](_0x2b2072[_0x513c('0x2d')][_0x513c('0x6a')])['then'](function(){if(_[_0x513c('0x6e')](_0x2b2072[_0x513c('0x2d')]['ids'])){for(var _0x16a608=0x0;_0x16a608<_0x2b2072[_0x513c('0x2d')][_0x513c('0x6a')][_0x513c('0x33')];_0x16a608+=0x1){socket[_0x513c('0x6f')]('userVoicePrefix:remove',{'UserId':Number(_0x2b2072[_0x513c('0x2d')][_0x513c('0x6a')][_0x16a608]),'VoicePrefixId':Number(_0x2b2072['params']['id'])});}}else{socket[_0x513c('0x6f')](_0x513c('0x70'),{'UserId':Number(_0x2b2072[_0x513c('0x2d')]['ids']),'VoicePrefixId':Number(_0x2b2072[_0x513c('0x43')]['id'])});}});}})['then'](respondWithStatusCode(_0x583355,null))[_0x513c('0x45')](handleError(_0x583355,null));};exports[_0x513c('0x71')]=function(_0x10bfeb,_0xc8705c,_0x4ffff0){var _0x343cad={};var _0x58f050={};var _0x3ca1db;var _0x1b60dc;return db['VoicePrefix'][_0x513c('0x72')]({'where':{'id':_0x10bfeb[_0x513c('0x43')]['id']}})[_0x513c('0x20')](handleEntityNotFound(_0xc8705c,null))[_0x513c('0x20')](function(_0x3abd8d){if(_0x3abd8d){_0x3ca1db=_0x3abd8d;_0x58f050[_0x513c('0x2f')]=_[_0x513c('0x2e')](db['User'][_0x513c('0x29')]);_0x58f050[_0x513c('0x2d')]=_[_0x513c('0x2e')](_0x10bfeb['query']);_0x58f050[_0x513c('0x36')]=_[_0x513c('0x31')](_0x58f050[_0x513c('0x2f')],_0x58f050['query']);_0x343cad[_0x513c('0x30')]=_['intersection'](_0x58f050[_0x513c('0x2f')],qs[_0x513c('0x32')](_0x10bfeb['query'][_0x513c('0x32')]));_0x343cad['attributes']=_0x343cad[_0x513c('0x30')][_0x513c('0x33')]?_0x343cad[_0x513c('0x30')]:_0x58f050[_0x513c('0x2f')];_0x343cad[_0x513c('0x35')]=qs[_0x513c('0x73')](_0x10bfeb[_0x513c('0x2d')][_0x513c('0x73')]);_0x343cad[_0x513c('0x39')]=qs[_0x513c('0x36')](_[_0x513c('0x37')](_0x10bfeb[_0x513c('0x2d')],_0x58f050[_0x513c('0x36')]));if(_0x10bfeb['query'][_0x513c('0x3b')]){_0x343cad['where']=_[_0x513c('0x38')](_0x343cad['where'],{'$or':_['map'](_0x343cad['attributes'],function(_0x125fbb){var _0x1670fc={};_0x1670fc[_0x125fbb]={'$like':'%'+_0x10bfeb[_0x513c('0x2d')][_0x513c('0x3b')]+'%'};return _0x1670fc;})});}_0x343cad=_[_0x513c('0x38')]({},_0x343cad,_0x10bfeb['options']);return _0x3ca1db[_0x513c('0x71')](_0x343cad);}})[_0x513c('0x20')](function(_0x9ef409){if(_0x9ef409){_0x1b60dc=_0x9ef409[_0x513c('0x33')];if(!_0x10bfeb[_0x513c('0x2d')][_0x513c('0x74')](_0x513c('0x34'))){_0x343cad[_0x513c('0x19')]=qs[_0x513c('0x19')](_0x10bfeb[_0x513c('0x2d')]['limit']);_0x343cad['offset']=qs['offset'](_0x10bfeb[_0x513c('0x2d')]['offset']);}return _0x3ca1db[_0x513c('0x71')](_0x343cad);}})[_0x513c('0x20')](function(_0x1cc13c){if(_0x1cc13c){return _0x1cc13c?{'count':_0x1b60dc,'rows':_0x1cc13c}:null;}})[_0x513c('0x20')](respondWithResult(_0xc8705c,null))[_0x513c('0x45')](handleError(_0xc8705c,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 0dfdac0..98d197f 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 _0x9c44=['save','update','remove','emit','hasOwnProperty','hook','exports','VoicePrefix','setMaxListeners'];(function(_0x36451b,_0x44693a){var _0x4126d8=function(_0x22fadb){while(--_0x22fadb){_0x36451b['push'](_0x36451b['shift']());}};_0x4126d8(++_0x44693a);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x49c4('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x49c4('0x1')](0x0);var events={'afterCreate':_0x49c4('0x2'),'afterUpdate':_0x49c4('0x3'),'afterDestroy':_0x49c4('0x4')};function emitEvent(_0x2ad237){return function(_0x4e0313,_0x4941f1,_0x41a183){VoicePrefixEvents['emit'](_0x2ad237+':'+_0x4e0313['id'],_0x4e0313);VoicePrefixEvents[_0x49c4('0x5')](_0x2ad237,_0x4e0313);_0x41a183(null);};}for(var e in events){if(events[_0x49c4('0x6')](e)){var event=events[e];VoicePrefix[_0x49c4('0x7')](e,emitEvent(event));}}module[_0x49c4('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0xa9e0=['hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','update','emit'];(function(_0x5c2e5e,_0x2bc00e){var _0x46a5da=function(_0xf0fa38){while(--_0xf0fa38){_0x5c2e5e['push'](_0x5c2e5e['shift']());}};_0x46a5da(++_0x2bc00e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var EventEmitter=require(_0x0a9e('0x0'));var VoicePrefix=require(_0x0a9e('0x1'))['db'][_0x0a9e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0a9e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x333808){return function(_0x432180,_0x2ab90b,_0x991246){VoicePrefixEvents[_0x0a9e('0x4')](_0x333808+':'+_0x432180['id'],_0x432180);VoicePrefixEvents['emit'](_0x333808,_0x432180);_0x991246(null);};}for(var e in events){if(events[_0x0a9e('0x5')](e)){var event=events[e];VoicePrefix[_0x0a9e('0x6')](e,emitEvent(event));}}module[_0x0a9e('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index fe8e4f9..897c639 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 _0xeff8=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','voice_prefixes','lodash'];(function(_0x2376bb,_0x3378be){var _0x4287fe=function(_0x3909c6){while(--_0x3909c6){_0x2376bb['push'](_0x2376bb['shift']());}};_0x4287fe(++_0x3378be);}(_0xeff8,0x8e));var _0x8eff=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0xeff8[_0x186376];return _0x2dbdd9;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var logger=require(_0x8eff('0x2'))('api');var moment=require(_0x8eff('0x3'));var BPromise=require(_0x8eff('0x4'));var rp=require(_0x8eff('0x5'));var fs=require('fs');var path=require(_0x8eff('0x6'));var rimraf=require(_0x8eff('0x7'));var config=require(_0x8eff('0x8'));var attributes=require(_0x8eff('0x9'));module[_0x8eff('0xa')]=function(_0x4aebda,_0x22b6de){return _0x4aebda[_0x8eff('0xb')]('VoicePrefix',attributes,{'tableName':_0x8eff('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc5b1=['exports','define','voice_prefixes','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes'];(function(_0xa93409,_0x1d4e75){var _0x1fb94f=function(_0x44f009){while(--_0x44f009){_0xa93409['push'](_0xa93409['shift']());}};_0x1fb94f(++_0x1d4e75);}(_0xc5b1,0x177));var _0x1c5b=function(_0x4414af,_0xb3054a){_0x4414af=_0x4414af-0x0;var _0x5dcee7=_0xc5b1[_0x4414af];return _0x5dcee7;};'use strict';var _=require('lodash');var util=require(_0x1c5b('0x0'));var logger=require(_0x1c5b('0x1'))(_0x1c5b('0x2'));var moment=require('moment');var BPromise=require(_0x1c5b('0x3'));var rp=require(_0x1c5b('0x4'));var fs=require('fs');var path=require(_0x1c5b('0x5'));var rimraf=require(_0x1c5b('0x6'));var config=require(_0x1c5b('0x7'));var attributes=require(_0x1c5b('0x8'));module[_0x1c5b('0x9')]=function(_0x59db38,_0x16c138){return _0x59db38[_0x1c5b('0xa')]('VoicePrefix',attributes,{'tableName':_0x1c5b('0xb'),'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 40f742f..1a0a4c4 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 _0x4a03=['http','defaults','redis','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x54ef77,_0x2f78da){var _0x489951=function(_0x4d0f70){while(--_0x4d0f70){_0x54ef77['push'](_0x54ef77['shift']());}};_0x489951(++_0x2f78da);}(_0x4a03,0x16e));var _0x34a0=function(_0x42abdd,_0x41fb04){_0x42abdd=_0x42abdd-0x0;var _0x575c95=_0x4a03[_0x42abdd];return _0x575c95;};'use strict';var _=require('lodash');var util=require(_0x34a0('0x0'));var moment=require(_0x34a0('0x1'));var BPromise=require(_0x34a0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34a0('0x3'));var db=require(_0x34a0('0x4'))['db'];var utils=require(_0x34a0('0x5'));var logger=require('../../config/logger')(_0x34a0('0x6'));var config=require(_0x34a0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x34a0('0x8')][_0x34a0('0x9')]({'port':0x232a});config['redis']=_[_0x34a0('0xa')](config[_0x34a0('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x34a0('0xc'))(new Redis(config[_0x34a0('0xb')]));require(_0x34a0('0xd'))[_0x34a0('0xe')](socket);function respondWithRpcPromise(_0x761a80,_0x4faf06,_0x40d73d){return new BPromise(function(_0x2c39bf,_0x21e702){return client[_0x34a0('0xf')](_0x761a80,_0x40d73d)[_0x34a0('0x10')](function(_0x343d24){logger[_0x34a0('0x11')](_0x34a0('0x12'),_0x4faf06,'request\x20sent');logger['debug'](_0x34a0('0x13'),_0x4faf06,_0x34a0('0x14'),JSON['stringify'](_0x343d24));if(_0x343d24[_0x34a0('0x15')]){if(_0x343d24[_0x34a0('0x15')][_0x34a0('0x16')]===0x1f4){logger[_0x34a0('0x15')](_0x34a0('0x12'),_0x4faf06,_0x343d24[_0x34a0('0x15')][_0x34a0('0x17')]);return _0x21e702(_0x343d24[_0x34a0('0x15')][_0x34a0('0x17')]);}logger[_0x34a0('0x15')](_0x34a0('0x12'),_0x4faf06,_0x343d24[_0x34a0('0x15')][_0x34a0('0x17')]);return _0x2c39bf(_0x343d24[_0x34a0('0x15')][_0x34a0('0x17')]);}else{logger[_0x34a0('0x11')](_0x34a0('0x12'),_0x4faf06,_0x34a0('0x14'));_0x2c39bf(_0x343d24[_0x34a0('0x18')][_0x34a0('0x17')]);}})['catch'](function(_0x466525){logger[_0x34a0('0x15')](_0x34a0('0x12'),_0x4faf06,_0x466525);_0x21e702(_0x466525);});});} \ No newline at end of file +var _0xdc1a=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xdc1a,0x12f));var _0xadc1=function(_0x2ff7d6,_0x3b84fb){_0x2ff7d6=_0x2ff7d6-0x0;var _0x4dfe51=_0xdc1a[_0x2ff7d6];return _0x4dfe51;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xadc1('0x0'));var BPromise=require(_0xadc1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xadc1('0x2'));var db=require(_0xadc1('0x3'))['db'];var utils=require(_0xadc1('0x4'));var logger=require('../../config/logger')(_0xadc1('0x5'));var config=require(_0xadc1('0x6'));var jayson=require(_0xadc1('0x7'));var client=jayson[_0xadc1('0x8')][_0xadc1('0x9')]({'port':0x232a});config[_0xadc1('0xa')]=_[_0xadc1('0xb')](config[_0xadc1('0xa')],{'host':_0xadc1('0xc'),'port':0x18eb});var socket=require(_0xadc1('0xd'))(new Redis(config[_0xadc1('0xa')]));require(_0xadc1('0xe'))[_0xadc1('0xf')](socket);function respondWithRpcPromise(_0x3d55f9,_0x2f8412,_0x121b67){return new BPromise(function(_0xe3de96,_0x4d086c){return client[_0xadc1('0x10')](_0x3d55f9,_0x121b67)[_0xadc1('0x11')](function(_0x5280ef){logger[_0xadc1('0x12')](_0xadc1('0x13'),_0x2f8412,_0xadc1('0x14'));logger['debug'](_0xadc1('0x15'),_0x2f8412,_0xadc1('0x14'),JSON[_0xadc1('0x16')](_0x5280ef));if(_0x5280ef[_0xadc1('0x17')]){if(_0x5280ef[_0xadc1('0x17')][_0xadc1('0x18')]===0x1f4){logger[_0xadc1('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x2f8412,_0x5280ef['error'][_0xadc1('0x19')]);return _0x4d086c(_0x5280ef[_0xadc1('0x17')]['message']);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x2f8412,_0x5280ef['error']['message']);return _0xe3de96(_0x5280ef[_0xadc1('0x17')][_0xadc1('0x19')]);}else{logger[_0xadc1('0x12')](_0xadc1('0x13'),_0x2f8412,'request\x20sent');_0xe3de96(_0x5280ef[_0xadc1('0x1a')][_0xadc1('0x19')]);}})[_0xadc1('0x1b')](function(_0xbe1dff){logger[_0xadc1('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x2f8412,_0xbe1dff);_0x4d086c(_0xbe1dff);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index e43ea8f..d4f21e9 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 _0x746f=['length','voicePrefix:','./voicePrefix.events','update','emit','register'];(function(_0x509d7b,_0x317e9d){var _0x29d0f3=function(_0x3c1052){while(--_0x3c1052){_0x509d7b['push'](_0x509d7b['shift']());}};_0x29d0f3(++_0x317e9d);}(_0x746f,0x176));var _0xf746=function(_0x3f7108,_0x1a4295){_0x3f7108=_0x3f7108-0x0;var _0x10e2b1=_0x746f[_0x3f7108];return _0x10e2b1;};'use strict';var VoicePrefixEvents=require(_0xf746('0x0'));var events=['save','remove',_0xf746('0x1')];function createListener(_0x4ab709,_0x21d19b){return function(_0x2571ec){_0x21d19b[_0xf746('0x2')](_0x4ab709,_0x2571ec);};}function removeListener(_0x3cf257,_0x264bfb){return function(){VoicePrefixEvents['removeListener'](_0x3cf257,_0x264bfb);};}exports[_0xf746('0x3')]=function(_0x185210){for(var _0x3925b6=0x0,_0x499565=events[_0xf746('0x4')];_0x3925b6<_0x499565;_0x3925b6++){var _0x216bce=events[_0x3925b6];var _0x5d20a6=createListener(_0xf746('0x5')+_0x216bce,_0x185210);VoicePrefixEvents['on'](_0x216bce,_0x5d20a6);}}; \ No newline at end of file +var _0x0f5e=['register','length','voicePrefix:','./voicePrefix.events','save','update','removeListener'];(function(_0x15f357,_0x56c58f){var _0x2be40f=function(_0x1b08a2){while(--_0x1b08a2){_0x15f357['push'](_0x15f357['shift']());}};_0x2be40f(++_0x56c58f);}(_0x0f5e,0x96));var _0xe0f5=function(_0x39ea0c,_0x3e248d){_0x39ea0c=_0x39ea0c-0x0;var _0x158c7e=_0x0f5e[_0x39ea0c];return _0x158c7e;};'use strict';var VoicePrefixEvents=require(_0xe0f5('0x0'));var events=[_0xe0f5('0x1'),'remove',_0xe0f5('0x2')];function createListener(_0x3a2917,_0x4ec436){return function(_0x1c70c0){_0x4ec436['emit'](_0x3a2917,_0x1c70c0);};}function removeListener(_0x137d9c,_0x409707){return function(){VoicePrefixEvents[_0xe0f5('0x3')](_0x137d9c,_0x409707);};}exports[_0xe0f5('0x4')]=function(_0x24dde7){for(var _0x102c3a=0x0,_0x3bb37a=events[_0xe0f5('0x5')];_0x102c3a<_0x3bb37a;_0x102c3a++){var _0x525b78=events[_0x102c3a];var _0x4aa43e=createListener(_0xe0f5('0x6')+_0x525b78,_0x24dde7);VoicePrefixEvents['on'](_0x525b78,_0x4aa43e);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index b4a9105..a94956f 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 _0x1239=['getBlackLists','post','clone','addLists','addBlackLists','put','delete','destroy','removeLists','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','index','/:id','isAuthenticated','show','get','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getMembers','/:id/lists','getLists','/:id/blacklists'];(function(_0x2b716b,_0x9001ae){var _0x4b4499=function(_0x3faaea){while(--_0x3faaea){_0x2b716b['push'](_0x2b716b['shift']());}};_0x4b4499(++_0x9001ae);}(_0x1239,0x114));var _0x9123=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1239[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x9123('0x0'));var util=require(_0x9123('0x1'));var path=require(_0x9123('0x2'));var timeout=require(_0x9123('0x3'));var express=require(_0x9123('0x4'));var router=express['Router']();var fs_extra=require(_0x9123('0x5'));var auth=require(_0x9123('0x6'));var interaction=require(_0x9123('0x7'));var config=require(_0x9123('0x8'));var controller=require(_0x9123('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x9123('0xa')]);router['get'](_0x9123('0xb'),auth[_0x9123('0xc')](),controller[_0x9123('0xd')]);router[_0x9123('0xe')](_0x9123('0xf'),auth[_0x9123('0xc')](),controller[_0x9123('0x10')]);router['get'](_0x9123('0x11'),auth[_0x9123('0xc')](),controller[_0x9123('0x12')]);router[_0x9123('0xe')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x9123('0x13')]);router[_0x9123('0xe')](_0x9123('0x14'),auth[_0x9123('0xc')](),controller[_0x9123('0x15')]);router[_0x9123('0xe')](_0x9123('0x16'),auth['isAuthenticated'](),controller['getTeams']);router[_0x9123('0xe')](_0x9123('0x17'),auth[_0x9123('0xc')](),controller['getAgents']);router['get']('/:id/members',auth[_0x9123('0xc')](),controller[_0x9123('0x18')]);router['get'](_0x9123('0x19'),auth[_0x9123('0xc')](),controller[_0x9123('0x1a')]);router[_0x9123('0xe')](_0x9123('0x1b'),auth['isAuthenticated'](),controller[_0x9123('0x1c')]);router[_0x9123('0x1d')]('/',auth[_0x9123('0xc')](),controller['create']);router[_0x9123('0x1d')]('/:id/clone',auth['isAuthenticated'](),controller[_0x9123('0x1e')]);router[_0x9123('0x1d')]('/:id/teams',auth[_0x9123('0xc')](),controller['addTeams']);router[_0x9123('0x1d')](_0x9123('0x17'),auth[_0x9123('0xc')](),controller['addAgents']);router['post'](_0x9123('0x19'),auth[_0x9123('0xc')](),controller[_0x9123('0x1f')]);router['post'](_0x9123('0x1b'),auth['isAuthenticated'](),controller[_0x9123('0x20')]);router[_0x9123('0x21')](_0x9123('0xb'),auth[_0x9123('0xc')](),controller['update']);router[_0x9123('0x22')]('/:id',auth['isAuthenticated'](),controller[_0x9123('0x23')]);router[_0x9123('0x22')](_0x9123('0x16'),auth[_0x9123('0xc')](),controller['removeTeams']);router[_0x9123('0x22')](_0x9123('0x17'),auth[_0x9123('0xc')](),controller['removeAgents']);router[_0x9123('0x22')](_0x9123('0x19'),auth['isAuthenticated'](),controller[_0x9123('0x24')]);router[_0x9123('0x22')]('/:id/blacklists',auth[_0x9123('0xc')](),controller['removeBlackLists']);module[_0x9123('0x25')]=router; \ No newline at end of file +var _0x19d1=['/:id/hopper_finals','getHopperFinals','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addAgents','addLists','/:id/blacklists','addBlackLists','delete','destroy','removeAgents','removeLists','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories'];(function(_0x57e00e,_0x36e79a){var _0x415e60=function(_0x5cd7fa){while(--_0x5cd7fa){_0x57e00e['push'](_0x57e00e['shift']());}};_0x415e60(++_0x36e79a);}(_0x19d1,0x16c));var _0x119d=function(_0x535382,_0x126fa5){_0x535382=_0x535382-0x0;var _0x1da79b=_0x19d1[_0x535382];return _0x1da79b;};'use strict';var multer=require(_0x119d('0x0'));var util=require(_0x119d('0x1'));var path=require('path');var timeout=require(_0x119d('0x2'));var express=require(_0x119d('0x3'));var router=express[_0x119d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x119d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x119d('0x6'));var controller=require(_0x119d('0x7'));router[_0x119d('0x8')]('/',auth[_0x119d('0x9')](),controller[_0x119d('0xa')]);router[_0x119d('0x8')](_0x119d('0xb'),auth['isAuthenticated'](),controller[_0x119d('0xc')]);router['get']('/:id/hoppers',auth['isAuthenticated'](),controller[_0x119d('0xd')]);router[_0x119d('0x8')](_0x119d('0xe'),auth['isAuthenticated'](),controller[_0x119d('0xf')]);router[_0x119d('0x8')](_0x119d('0x10'),auth[_0x119d('0x9')](),controller[_0x119d('0x11')]);router['get']('/:id/hopper_black',auth[_0x119d('0x9')](),controller['getHopperBlacks']);router[_0x119d('0x8')](_0x119d('0x12'),auth['isAuthenticated'](),controller[_0x119d('0x13')]);router[_0x119d('0x8')](_0x119d('0x14'),auth[_0x119d('0x9')](),controller[_0x119d('0x15')]);router[_0x119d('0x8')](_0x119d('0x16'),auth[_0x119d('0x9')](),controller[_0x119d('0x17')]);router[_0x119d('0x8')](_0x119d('0x18'),auth[_0x119d('0x9')](),controller[_0x119d('0x19')]);router['get']('/:id/blacklists',auth[_0x119d('0x9')](),controller['getBlackLists']);router[_0x119d('0x1a')]('/',auth[_0x119d('0x9')](),controller[_0x119d('0x1b')]);router[_0x119d('0x1a')](_0x119d('0x1c'),auth['isAuthenticated'](),controller[_0x119d('0x1d')]);router[_0x119d('0x1a')](_0x119d('0x12'),auth[_0x119d('0x9')](),controller['addTeams']);router[_0x119d('0x1a')](_0x119d('0x14'),auth[_0x119d('0x9')](),controller[_0x119d('0x1e')]);router[_0x119d('0x1a')](_0x119d('0x18'),auth['isAuthenticated'](),controller[_0x119d('0x1f')]);router[_0x119d('0x1a')](_0x119d('0x20'),auth[_0x119d('0x9')](),controller[_0x119d('0x21')]);router['put'](_0x119d('0xb'),auth[_0x119d('0x9')](),controller['update']);router[_0x119d('0x22')]('/:id',auth['isAuthenticated'](),controller[_0x119d('0x23')]);router[_0x119d('0x22')](_0x119d('0x12'),auth[_0x119d('0x9')](),controller['removeTeams']);router[_0x119d('0x22')](_0x119d('0x14'),auth[_0x119d('0x9')](),controller[_0x119d('0x24')]);router[_0x119d('0x22')](_0x119d('0x18'),auth[_0x119d('0x9')](),controller[_0x119d('0x25')]);router[_0x119d('0x22')]('/:id/blacklists',auth[_0x119d('0x9')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index ddcd219..f5ea43d 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 _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\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','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x1cd62a,_0x12233f){var _0x28c61d=function(_0x11893f){while(--_0x11893f){_0x1cd62a['push'](_0x1cd62a['shift']());}};_0x28c61d(++_0x12233f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\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','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x430cb0,_0x860700){var _0x4e21d5=function(_0x1369fd){while(--_0x1369fd){_0x430cb0['push'](_0x430cb0['shift']());}};_0x4e21d5(++_0x860700);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 87e353c..08ba796 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 _0x75ea=['fieldName','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','catch','rawAttributes','intersection','includeAll','create','body','user','role','VoiceQueues','inbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileResource','getHoppers','findOne','CmHopper','VoiceQueueId','rows','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','User','Agents','online','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','interface','SIP/%s','userVoiceQueue:save','removeTeams','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','push','QueryTypes','SELECT','all','union','compact','ids','isEmpty','emit','userVoiceQueue:remove','addAgents','spread','isNil','format','voicePause','removeAgents','isArray','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','CmListId','toString','cm_contacts','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','removeLists','getBlackLists','addBlackLists','removeBlackLists','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','status','end','json','count','limit','reject','save','update','destroy','then','get','QueueCampaigns','outbound','filter','ignore','map','value','includes','find','type','name','error','stack','send','index','VoiceQueue'];(function(_0x12ee9f,_0x272273){var _0x32b4f8=function(_0xd0ab90){while(--_0xd0ab90){_0x12ee9f['push'](_0x12ee9f['shift']());}};_0x32b4f8(++_0x272273);}(_0x75ea,0x7d));var _0xa75e=function(_0x237e11,_0x4772a8){_0x237e11=_0x237e11-0x0;var _0x219b44=_0x75ea[_0x237e11];return _0x219b44;};'use strict';var pdf=require(_0xa75e('0x0'));var emlformat=require(_0xa75e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa75e('0x2'));var jsonpatch=require(_0xa75e('0x3'));var rp=require('request-promise');var moment=require(_0xa75e('0x4'));var BPromise=require(_0xa75e('0x5'));var Mustache=require(_0xa75e('0x6'));var util=require(_0xa75e('0x7'));var path=require(_0xa75e('0x8'));var sox=require('sox');var csv=require(_0xa75e('0x9'));var ejs=require(_0xa75e('0xa'));var fs=require('fs');var fs_extra=require(_0xa75e('0xb'));var _=require(_0xa75e('0xc'));var squel=require(_0xa75e('0xd'));var crypto=require(_0xa75e('0xe'));var jsforce=require(_0xa75e('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa75e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa75e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa75e('0x12'));var logger=require(_0xa75e('0x13'))('api');var utils=require(_0xa75e('0x14'));var config=require(_0xa75e('0x15'));var licenseUtil=require(_0xa75e('0x16'));var db=require(_0xa75e('0x17'))['db'];config[_0xa75e('0x18')]=_[_0xa75e('0x19')](config[_0xa75e('0x18')],{'host':_0xa75e('0x1a'),'port':0x18eb});var socket=require(_0xa75e('0x1b'))(new Redis(config['redis']));require(_0xa75e('0x1c'))['register'](socket);function respondWithStatusCode(_0x30d9b1,_0x10a205){_0x10a205=_0x10a205||0xcc;return function(_0x530c38){if(_0x530c38){return _0x30d9b1[_0xa75e('0x1d')](_0x10a205);}return _0x30d9b1[_0xa75e('0x1e')](_0x10a205)[_0xa75e('0x1f')]();};}function respondWithResult(_0x49cbf7,_0xb55a6f){_0xb55a6f=_0xb55a6f||0xc8;return function(_0x315fde){if(_0x315fde){return _0x49cbf7[_0xa75e('0x1e')](_0xb55a6f)[_0xa75e('0x20')](_0x315fde);}};}function respondWithFilteredResult(_0x4291a5,_0x71fd71){return function(_0x34c0c2){if(_0x34c0c2){var _0x44a786=_0x34c0c2[_0xa75e('0x21')],_0x5812ba=_0x71fd71['offset'],_0x280491=_0x71fd71['offset']+_0x71fd71[_0xa75e('0x22')],_0xb8f964;if(_0x280491>=_0x44a786){_0x280491=_0x44a786;_0xb8f964=0xc8;}else{_0xb8f964=0xce;}_0x4291a5['status'](_0xb8f964);return _0x4291a5['set']('Content-Range',_0x5812ba+'-'+_0x280491+'/'+_0x44a786)[_0xa75e('0x20')](_0x34c0c2);}return null;};}function patchUpdates(_0x51279b){return function(_0x2e4f8c){try{jsonpatch['apply'](_0x2e4f8c,_0x51279b,!![]);}catch(_0x32766b){return BPromise[_0xa75e('0x23')](_0x32766b);}return _0x2e4f8c[_0xa75e('0x24')]();};}function saveUpdates(_0x531d7d,_0x7b8021){return function(_0x411d82){if(_0x411d82){return _0x411d82[_0xa75e('0x25')](_0x531d7d)['then'](function(_0x227d81){return _0x227d81;});}return null;};}function removeEntity(_0x71e02f,_0x1faeab){return function(_0x9add90){if(_0x9add90){return _0x9add90[_0xa75e('0x26')]()[_0xa75e('0x27')](function(){var _0x3c80e9=_0x9add90[_0xa75e('0x28')]({'plain':!![]});var _0x2064db=[{'name':'VoiceQueues','value':'inbound','ignore':![]},{'name':_0xa75e('0x29'),'value':_0xa75e('0x2a'),'ignore':![]}];var _0x58bfef=_(_0x2064db)[_0xa75e('0x2b')](_0xa75e('0x2c'))[_0xa75e('0x2d')](_0xa75e('0x2e'))[_0xa75e('0x2e')]();if(_[_0xa75e('0x2f')](_0x58bfef,_0x3c80e9['type'])){return;}var _0x455b8a=_[_0xa75e('0x30')](_0x2064db,[_0xa75e('0x2e'),_0x3c80e9[_0xa75e('0x31')]])[_0xa75e('0x32')];return db['UserProfileResource'][_0xa75e('0x26')]({'where':{'type':_0x455b8a,'resourceId':_0x3c80e9['id']}})['then'](function(){return _0x9add90;});})['then'](function(){_0x71e02f[_0xa75e('0x1e')](0xcc)[_0xa75e('0x1f')]();});}};}function handleEntityNotFound(_0x207be3,_0x83824a){return function(_0x164d64){if(!_0x164d64){_0x207be3[_0xa75e('0x1d')](0x194);}return _0x164d64;};}function handleError(_0x1fccbb,_0x1df3ec){_0x1df3ec=_0x1df3ec||0x1f4;return function(_0x3f7fc5){logger[_0xa75e('0x33')](_0x3f7fc5[_0xa75e('0x34')]);if(_0x3f7fc5[_0xa75e('0x32')]){delete _0x3f7fc5[_0xa75e('0x32')];}_0x1fccbb['status'](_0x1df3ec)[_0xa75e('0x35')](_0x3f7fc5);};}exports[_0xa75e('0x36')]=function(_0x3cefdd,_0x11b280){var _0x38ac6f={},_0x3f8d0f={},_0x5c1200={'count':0x0,'rows':[]};var _0x5265b7=_['map'](db[_0xa75e('0x37')]['rawAttributes'],function(_0x545339){return{'name':_0x545339[_0xa75e('0x38')],'type':_0x545339['type'][_0xa75e('0x39')]};});_0x3f8d0f[_0xa75e('0x3a')]=_[_0xa75e('0x2d')](_0x5265b7,_0xa75e('0x32'));_0x3f8d0f['query']=_[_0xa75e('0x3b')](_0x3cefdd[_0xa75e('0x3c')]);_0x3f8d0f[_0xa75e('0x3d')]=_['intersection'](_0x3f8d0f['model'],_0x3f8d0f[_0xa75e('0x3c')]);_0x38ac6f[_0xa75e('0x3e')]=_['intersection'](_0x3f8d0f[_0xa75e('0x3a')],qs[_0xa75e('0x3f')](_0x3cefdd['query'][_0xa75e('0x3f')]));_0x38ac6f[_0xa75e('0x3e')]=_0x38ac6f['attributes'][_0xa75e('0x40')]?_0x38ac6f[_0xa75e('0x3e')]:_0x3f8d0f[_0xa75e('0x3a')];if(!_0x3cefdd['query'][_0xa75e('0x41')](_0xa75e('0x42'))){_0x38ac6f[_0xa75e('0x22')]=qs[_0xa75e('0x22')](_0x3cefdd[_0xa75e('0x3c')]['limit']);_0x38ac6f[_0xa75e('0x43')]=qs['offset'](_0x3cefdd[_0xa75e('0x3c')][_0xa75e('0x43')]);}_0x38ac6f[_0xa75e('0x44')]=qs[_0xa75e('0x45')](_0x3cefdd[_0xa75e('0x3c')]['sort']);_0x38ac6f[_0xa75e('0x46')]=qs[_0xa75e('0x3d')](_[_0xa75e('0x47')](_0x3cefdd['query'],_0x3f8d0f[_0xa75e('0x3d')]),_0x5265b7);if(_0x3cefdd[_0xa75e('0x3c')]['filter']){_0x38ac6f[_0xa75e('0x46')]=_[_0xa75e('0x48')](_0x38ac6f['where'],{'$or':_[_0xa75e('0x2d')](_0x5265b7,function(_0x17964e){if(_0x17964e[_0xa75e('0x31')]!==_0xa75e('0x49')){var _0x2a0257={};_0x2a0257[_0x17964e[_0xa75e('0x32')]]={'$like':'%'+_0x3cefdd['query'][_0xa75e('0x2b')]+'%'};return _0x2a0257;}})});}_0x38ac6f=_[_0xa75e('0x48')]({},_0x38ac6f,_0x3cefdd[_0xa75e('0x4a')]);var _0xd44a55={'where':_0x38ac6f['where']};return db['VoiceQueue']['count'](_0xd44a55)[_0xa75e('0x27')](function(_0x1bd996){_0x5c1200[_0xa75e('0x21')]=_0x1bd996;if(_0x3cefdd[_0xa75e('0x3c')]['includeAll']){_0x38ac6f[_0xa75e('0x4b')]=[{'all':!![]}];}return db['VoiceQueue'][_0xa75e('0x4c')](_0x38ac6f);})[_0xa75e('0x27')](function(_0x1ce959){_0x5c1200['rows']=_0x1ce959;return _0x5c1200;})[_0xa75e('0x27')](respondWithFilteredResult(_0x11b280,_0x38ac6f))[_0xa75e('0x4d')](handleError(_0x11b280,null));};exports['show']=function(_0xe1420c,_0x1764a3){var _0x28cf19={'raw':![],'where':{'id':_0xe1420c['params']['id']}},_0x3e4bd5={};_0x3e4bd5[_0xa75e('0x3a')]=_[_0xa75e('0x3b')](db[_0xa75e('0x37')][_0xa75e('0x4e')]);_0x3e4bd5['query']=_[_0xa75e('0x3b')](_0xe1420c['query']);_0x3e4bd5[_0xa75e('0x3d')]=_[_0xa75e('0x4f')](_0x3e4bd5[_0xa75e('0x3a')],_0x3e4bd5['query']);_0x28cf19[_0xa75e('0x3e')]=_[_0xa75e('0x4f')](_0x3e4bd5[_0xa75e('0x3a')],qs['fields'](_0xe1420c[_0xa75e('0x3c')][_0xa75e('0x3f')]));_0x28cf19[_0xa75e('0x3e')]=_0x28cf19['attributes'][_0xa75e('0x40')]?_0x28cf19['attributes']:_0x3e4bd5[_0xa75e('0x3a')];if(_0xe1420c[_0xa75e('0x3c')][_0xa75e('0x50')]){_0x28cf19['include']=[{'all':!![]}];}_0x28cf19=_[_0xa75e('0x48')]({},_0x28cf19,_0xe1420c[_0xa75e('0x4a')]);return db['VoiceQueue'][_0xa75e('0x30')](_0x28cf19)[_0xa75e('0x27')](handleEntityNotFound(_0x1764a3,null))[_0xa75e('0x27')](respondWithResult(_0x1764a3,null))[_0xa75e('0x4d')](handleError(_0x1764a3,null));};exports[_0xa75e('0x51')]=function(_0xe2af81,_0x1d11dd){return db[_0xa75e('0x37')][_0xa75e('0x51')](_0xe2af81[_0xa75e('0x52')],{})[_0xa75e('0x27')](function(_0x1fec07){var _0x49f47d=_0xe2af81[_0xa75e('0x53')][_0xa75e('0x28')]({'plain':!![]});if(!_0x49f47d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49f47d[_0xa75e('0x54')]==='user'){var _0x1e5e4b=_0x1fec07[_0xa75e('0x28')]({'plain':!![]});var _0x12666d=[{'name':_0xa75e('0x55'),'value':_0xa75e('0x56')},{'name':_0xa75e('0x29'),'value':_0xa75e('0x2a')}];var _0x4a928c=_[_0xa75e('0x30')](_0x12666d,[_0xa75e('0x2e'),_0x1e5e4b[_0xa75e('0x31')]])[_0xa75e('0x32')];return db[_0xa75e('0x57')][_0xa75e('0x30')]({'where':{'name':_0x4a928c,'userProfileId':_0x49f47d[_0xa75e('0x58')]},'raw':!![]})['then'](function(_0xd1f9ab){if(_0xd1f9ab&&_0xd1f9ab[_0xa75e('0x59')]===0x0){return db['UserProfileResource'][_0xa75e('0x51')]({'name':_0x1e5e4b['name'],'resourceId':_0x1e5e4b['id'],'type':_0xd1f9ab['name'],'sectionId':_0xd1f9ab['id']},{})['then'](function(){return _0x1fec07;});}else{return _0x1fec07;}})[_0xa75e('0x4d')](function(_0x5b1102){logger[_0xa75e('0x33')](_0xa75e('0x5a'),_0x5b1102);throw _0x5b1102;});}return _0x1fec07;})['then'](respondWithResult(_0x1d11dd,0xc9))[_0xa75e('0x4d')](handleError(_0x1d11dd,null));};exports['clone']=function(_0x99813d,_0x255eca){var _0x234103={'where':{'id':_0x99813d[_0xa75e('0x5b')]['id']}},_0x5dd6c8={};_0x5dd6c8[_0xa75e('0x3a')]=_[_0xa75e('0x3b')](db[_0xa75e('0x37')][_0xa75e('0x4e')]);_0x234103[_0xa75e('0x3e')]=_['intersection'](_0x5dd6c8['model'],qs[_0xa75e('0x3f')](_0x99813d[_0xa75e('0x3c')][_0xa75e('0x3f')]));_0x234103['attributes']=_0x234103[_0xa75e('0x3e')][_0xa75e('0x40')]?_0x234103[_0xa75e('0x3e')]:_0x5dd6c8[_0xa75e('0x3a')];if(_0x99813d[_0xa75e('0x3c')][_0xa75e('0x50')]){_0x234103[_0xa75e('0x4b')]=[{'all':!![]}];}_0x234103=_[_0xa75e('0x48')]({},_0x234103,_0x99813d[_0xa75e('0x4a')]);return db[_0xa75e('0x37')][_0xa75e('0x30')](_0x234103)[_0xa75e('0x27')](handleEntityNotFound(_0x255eca,null))[_0xa75e('0x27')](function(_0x5d790d){if(_0x5d790d){var _0x47a94e=_0x5d790d[_0xa75e('0x28')]({'plain':!![]});_0x47a94e=qs[_0xa75e('0x5c')](_0x47a94e,['id',_0xa75e('0x5d'),_0xa75e('0x5e')]);_0x99813d[_0xa75e('0x52')]=_[_0xa75e('0x5c')](_0x99813d[_0xa75e('0x52')],['id',_0xa75e('0x5d'),_0xa75e('0x5e')]);return db[_0xa75e('0x37')][_0xa75e('0x51')](_[_0xa75e('0x48')](_0x47a94e,_0x99813d[_0xa75e('0x52')]),{'include':_0x99813d[_0xa75e('0x3c')][_0xa75e('0x50')]?[{'all':!![]}]:undefined})[_0xa75e('0x27')](function(_0x57f50d){var _0x598739=_0x99813d[_0xa75e('0x53')][_0xa75e('0x28')]({'plain':!![]});if(!_0x598739)throw new Error(_0xa75e('0x5f'));if(_0x598739[_0xa75e('0x54')]===_0xa75e('0x53')){var _0x204c3d=_0x57f50d[_0xa75e('0x28')]({'plain':!![]});var _0x3f12d8=[{'name':_0xa75e('0x55'),'value':_0xa75e('0x56')},{'name':_0xa75e('0x29'),'value':_0xa75e('0x2a')}];var _0x1e1a95=_[_0xa75e('0x30')](_0x3f12d8,[_0xa75e('0x2e'),_0x204c3d[_0xa75e('0x31')]])['name'];return db[_0xa75e('0x57')]['find']({'where':{'name':_0x1e1a95,'userProfileId':_0x598739['userProfileId']},'raw':!![]})['then'](function(_0xd9e34b){if(_0xd9e34b&&_0xd9e34b['autoAssociation']===0x0){return db[_0xa75e('0x60')][_0xa75e('0x51')]({'name':_0x204c3d[_0xa75e('0x32')],'resourceId':_0x204c3d['id'],'type':_0xd9e34b[_0xa75e('0x32')],'sectionId':_0xd9e34b['id']},{})['then'](function(){return _0x57f50d;});}else{return _0x57f50d;}})[_0xa75e('0x4d')](function(_0x322eec){logger[_0xa75e('0x33')](_0xa75e('0x5a'),_0x322eec);throw _0x322eec;});}return _0x57f50d;});}})[_0xa75e('0x27')](respondWithResult(_0x255eca,0xc9))[_0xa75e('0x4d')](handleError(_0x255eca,null));};exports[_0xa75e('0x25')]=function(_0x150c01,_0x2e919d){if(_0x150c01[_0xa75e('0x52')]['id']){delete _0x150c01[_0xa75e('0x52')]['id'];}return db[_0xa75e('0x37')][_0xa75e('0x30')]({'where':{'id':_0x150c01[_0xa75e('0x5b')]['id']}})[_0xa75e('0x27')](handleEntityNotFound(_0x2e919d,null))['then'](saveUpdates(_0x150c01['body'],null))[_0xa75e('0x27')](respondWithResult(_0x2e919d,null))[_0xa75e('0x4d')](handleError(_0x2e919d,null));};exports['destroy']=function(_0x359358,_0x1622fa){return db[_0xa75e('0x37')]['find']({'where':{'id':_0x359358['params']['id']}})[_0xa75e('0x27')](handleEntityNotFound(_0x1622fa,null))[_0xa75e('0x27')](removeEntity(_0x1622fa,null))[_0xa75e('0x4d')](handleError(_0x1622fa,null));};exports[_0xa75e('0x61')]=function(_0x58ca01,_0xa76316,_0x1379f1){var _0x51a055={'raw':![],'where':{}};var _0x1fe8d4={};var _0x2a9c79={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xa75e('0x62')]({'where':{'id':_0x58ca01[_0xa75e('0x5b')]['id']}})['then'](handleEntityNotFound(_0xa76316,null))[_0xa75e('0x27')](function(_0x15a428){if(_0x15a428){_0x1fe8d4[_0xa75e('0x3a')]=_[_0xa75e('0x3b')](db[_0xa75e('0x63')]['rawAttributes']);_0x1fe8d4[_0xa75e('0x3c')]=_['keys'](_0x58ca01[_0xa75e('0x3c')]);_0x1fe8d4[_0xa75e('0x3d')]=_[_0xa75e('0x4f')](_0x1fe8d4['model'],_0x1fe8d4[_0xa75e('0x3c')]);_0x51a055[_0xa75e('0x3e')]=_[_0xa75e('0x4f')](_0x1fe8d4[_0xa75e('0x3a')],qs[_0xa75e('0x3f')](_0x58ca01[_0xa75e('0x3c')][_0xa75e('0x3f')]));_0x51a055[_0xa75e('0x3e')]=_0x51a055[_0xa75e('0x3e')][_0xa75e('0x40')]?_0x51a055[_0xa75e('0x3e')]:_0x1fe8d4[_0xa75e('0x3a')];if(!_0x58ca01[_0xa75e('0x3c')][_0xa75e('0x41')]('nolimit')){_0x51a055['limit']=qs['limit'](_0x58ca01[_0xa75e('0x3c')][_0xa75e('0x22')]);_0x51a055[_0xa75e('0x43')]=qs['offset'](_0x58ca01[_0xa75e('0x3c')][_0xa75e('0x43')]);}_0x51a055[_0xa75e('0x44')]=qs[_0xa75e('0x45')](_0x58ca01[_0xa75e('0x3c')][_0xa75e('0x45')]);_0x51a055[_0xa75e('0x46')]=qs[_0xa75e('0x3d')](_[_0xa75e('0x47')](_0x58ca01[_0xa75e('0x3c')],_0x1fe8d4[_0xa75e('0x3d')]));_0x51a055[_0xa75e('0x46')][_0xa75e('0x64')]=_0x15a428['id'];if(_0x58ca01[_0xa75e('0x3c')]['filter']){_0x51a055['where']=_['merge'](_0x51a055[_0xa75e('0x46')],{'$or':_['map'](_0x51a055[_0xa75e('0x3e')],function(_0x527920){var _0x51651e={};_0x51651e[_0x527920]={'$like':'%'+_0x58ca01['query'][_0xa75e('0x2b')]+'%'};return _0x51651e;})});}_0x51a055=_[_0xa75e('0x48')]({},_0x51a055,_0x58ca01[_0xa75e('0x4a')]);return db[_0xa75e('0x63')][_0xa75e('0x21')]({'where':_0x51a055[_0xa75e('0x46')]})[_0xa75e('0x27')](function(_0x5456f6){_0x2a9c79[_0xa75e('0x21')]=_0x5456f6;if(_0x58ca01[_0xa75e('0x3c')][_0xa75e('0x50')]){_0x51a055['include']=[{'all':!![]}];}return db[_0xa75e('0x63')]['findAll'](_0x51a055);})[_0xa75e('0x27')](function(_0x37b4e5){_0x2a9c79[_0xa75e('0x65')]=_0x37b4e5;return _0x2a9c79;});}})[_0xa75e('0x27')](respondWithFilteredResult(_0xa76316,_0x51a055))[_0xa75e('0x4d')](handleError(_0xa76316,null));};exports['getHopperHistories']=function(_0x5f5c7d,_0x1bbc98,_0x45eff8){var _0x11ef47={'raw':!![],'where':{}};var _0x5bc5f4={};var _0x2436f3={'count':0x0,'rows':[]};return db[_0xa75e('0x37')][_0xa75e('0x62')]({'where':{'id':_0x5f5c7d[_0xa75e('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1bbc98,null))[_0xa75e('0x27')](function(_0x3d2f9f){if(_0x3d2f9f){_0x5bc5f4[_0xa75e('0x3a')]=_[_0xa75e('0x3b')](db[_0xa75e('0x66')][_0xa75e('0x4e')]);_0x5bc5f4[_0xa75e('0x3c')]=_['keys'](_0x5f5c7d[_0xa75e('0x3c')]);_0x5bc5f4[_0xa75e('0x3d')]=_[_0xa75e('0x4f')](_0x5bc5f4[_0xa75e('0x3a')],_0x5bc5f4[_0xa75e('0x3c')]);_0x11ef47[_0xa75e('0x3e')]=_[_0xa75e('0x4f')](_0x5bc5f4[_0xa75e('0x3a')],qs['fields'](_0x5f5c7d[_0xa75e('0x3c')][_0xa75e('0x3f')]));_0x11ef47['attributes']=_0x11ef47['attributes'][_0xa75e('0x40')]?_0x11ef47[_0xa75e('0x3e')]:_0x5bc5f4[_0xa75e('0x3a')];if(!_0x5f5c7d[_0xa75e('0x3c')][_0xa75e('0x41')](_0xa75e('0x42'))){_0x11ef47['limit']=qs[_0xa75e('0x22')](_0x5f5c7d[_0xa75e('0x3c')][_0xa75e('0x22')]);_0x11ef47[_0xa75e('0x43')]=qs[_0xa75e('0x43')](_0x5f5c7d['query']['offset']);}_0x11ef47['order']=qs[_0xa75e('0x45')](_0x5f5c7d[_0xa75e('0x3c')][_0xa75e('0x45')]);_0x11ef47['where']=qs[_0xa75e('0x3d')](_[_0xa75e('0x47')](_0x5f5c7d[_0xa75e('0x3c')],_0x5bc5f4[_0xa75e('0x3d')]));_0x11ef47['where']['VoiceQueueId']=_0x3d2f9f['id'];if(_0x5f5c7d[_0xa75e('0x3c')][_0xa75e('0x2b')]){_0x11ef47['where']=_[_0xa75e('0x48')](_0x11ef47[_0xa75e('0x46')],{'$or':_['map'](_0x11ef47[_0xa75e('0x3e')],function(_0x3d0d2d){var _0x9aea4b={};_0x9aea4b[_0x3d0d2d]={'$like':'%'+_0x5f5c7d['query'][_0xa75e('0x2b')]+'%'};return _0x9aea4b;})});}_0x11ef47=_[_0xa75e('0x48')]({},_0x11ef47,_0x5f5c7d[_0xa75e('0x4a')]);return db[_0xa75e('0x66')][_0xa75e('0x21')]({'where':_0x11ef47[_0xa75e('0x46')]})[_0xa75e('0x27')](function(_0x4f4318){_0x2436f3[_0xa75e('0x21')]=_0x4f4318;if(_0x5f5c7d['query'][_0xa75e('0x50')]){_0x11ef47[_0xa75e('0x4b')]=[{'all':!![]}];}return db[_0xa75e('0x66')]['findAll'](_0x11ef47);})[_0xa75e('0x27')](function(_0x51a8db){_0x2436f3[_0xa75e('0x65')]=_0x51a8db;return _0x2436f3;});}})[_0xa75e('0x27')](respondWithFilteredResult(_0x1bbc98,_0x11ef47))['catch'](handleError(_0x1bbc98,null));};exports[_0xa75e('0x67')]=function(_0x5199d1,_0x49dae2,_0x9d93dd){var _0x59114a={'raw':!![],'where':{}};var _0x1d92e2={};var _0x2a421f={'count':0x0,'rows':[]};return db[_0xa75e('0x37')]['findOne']({'where':{'id':_0x5199d1[_0xa75e('0x5b')]['id']}})['then'](handleEntityNotFound(_0x49dae2,null))[_0xa75e('0x27')](function(_0x4e3e0b){if(_0x4e3e0b){_0x1d92e2['model']=_[_0xa75e('0x3b')](db[_0xa75e('0x68')]['rawAttributes']);_0x1d92e2[_0xa75e('0x3c')]=_[_0xa75e('0x3b')](_0x5199d1[_0xa75e('0x3c')]);_0x1d92e2[_0xa75e('0x3d')]=_[_0xa75e('0x4f')](_0x1d92e2[_0xa75e('0x3a')],_0x1d92e2[_0xa75e('0x3c')]);_0x59114a[_0xa75e('0x3e')]=_[_0xa75e('0x4f')](_0x1d92e2[_0xa75e('0x3a')],qs[_0xa75e('0x3f')](_0x5199d1['query'][_0xa75e('0x3f')]));_0x59114a['attributes']=_0x59114a[_0xa75e('0x3e')][_0xa75e('0x40')]?_0x59114a[_0xa75e('0x3e')]:_0x1d92e2[_0xa75e('0x3a')];if(!_0x5199d1[_0xa75e('0x3c')][_0xa75e('0x41')](_0xa75e('0x42'))){_0x59114a[_0xa75e('0x22')]=qs[_0xa75e('0x22')](_0x5199d1[_0xa75e('0x3c')]['limit']);_0x59114a[_0xa75e('0x43')]=qs[_0xa75e('0x43')](_0x5199d1[_0xa75e('0x3c')]['offset']);}_0x59114a[_0xa75e('0x44')]=qs[_0xa75e('0x45')](_0x5199d1[_0xa75e('0x3c')][_0xa75e('0x45')]);_0x59114a[_0xa75e('0x46')]=qs[_0xa75e('0x3d')](_[_0xa75e('0x47')](_0x5199d1[_0xa75e('0x3c')],_0x1d92e2['filters']));_0x59114a[_0xa75e('0x46')]['VoiceQueueId']=_0x4e3e0b['id'];if(_0x5199d1[_0xa75e('0x3c')][_0xa75e('0x2b')]){_0x59114a[_0xa75e('0x46')]=_['merge'](_0x59114a['where'],{'$or':_[_0xa75e('0x2d')](_0x59114a[_0xa75e('0x3e')],function(_0x343a84){var _0x32c970={};_0x32c970[_0x343a84]={'$like':'%'+_0x5199d1[_0xa75e('0x3c')][_0xa75e('0x2b')]+'%'};return _0x32c970;})});}_0x59114a=_[_0xa75e('0x48')]({},_0x59114a,_0x5199d1[_0xa75e('0x4a')]);return db[_0xa75e('0x68')]['count']({'where':_0x59114a[_0xa75e('0x46')]})[_0xa75e('0x27')](function(_0x1230a4){_0x2a421f['count']=_0x1230a4;if(_0x5199d1['query'][_0xa75e('0x50')]){_0x59114a[_0xa75e('0x4b')]=[{'all':!![]}];}return db[_0xa75e('0x68')][_0xa75e('0x4c')](_0x59114a);})[_0xa75e('0x27')](function(_0x28c807){_0x2a421f['rows']=_0x28c807;return _0x2a421f;});}})[_0xa75e('0x27')](respondWithFilteredResult(_0x49dae2,_0x59114a))['catch'](handleError(_0x49dae2,null));};exports[_0xa75e('0x69')]=function(_0x3e2b25,_0x33f9e4,_0x560957){var _0x533236={'raw':!![],'where':{}};var _0x42980e={};var _0x50ef8f={'count':0x0,'rows':[]};return db[_0xa75e('0x37')][_0xa75e('0x62')]({'where':{'id':_0x3e2b25[_0xa75e('0x5b')]['id']}})[_0xa75e('0x27')](handleEntityNotFound(_0x33f9e4,null))[_0xa75e('0x27')](function(_0x1b2a87){if(_0x1b2a87){_0x42980e[_0xa75e('0x3a')]=_[_0xa75e('0x3b')](db[_0xa75e('0x6a')][_0xa75e('0x4e')]);_0x42980e['query']=_[_0xa75e('0x3b')](_0x3e2b25[_0xa75e('0x3c')]);_0x42980e['filters']=_['intersection'](_0x42980e[_0xa75e('0x3a')],_0x42980e[_0xa75e('0x3c')]);_0x533236[_0xa75e('0x3e')]=_[_0xa75e('0x4f')](_0x42980e[_0xa75e('0x3a')],qs[_0xa75e('0x3f')](_0x3e2b25[_0xa75e('0x3c')][_0xa75e('0x3f')]));_0x533236['attributes']=_0x533236[_0xa75e('0x3e')]['length']?_0x533236[_0xa75e('0x3e')]:_0x42980e[_0xa75e('0x3a')];if(!_0x3e2b25[_0xa75e('0x3c')][_0xa75e('0x41')](_0xa75e('0x42'))){_0x533236[_0xa75e('0x22')]=qs['limit'](_0x3e2b25[_0xa75e('0x3c')][_0xa75e('0x22')]);_0x533236[_0xa75e('0x43')]=qs[_0xa75e('0x43')](_0x3e2b25['query']['offset']);}_0x533236[_0xa75e('0x44')]=qs[_0xa75e('0x45')](_0x3e2b25[_0xa75e('0x3c')]['sort']);_0x533236[_0xa75e('0x46')]=qs[_0xa75e('0x3d')](_['pick'](_0x3e2b25[_0xa75e('0x3c')],_0x42980e[_0xa75e('0x3d')]));_0x533236['where'][_0xa75e('0x64')]=_0x1b2a87['id'];if(_0x3e2b25[_0xa75e('0x3c')][_0xa75e('0x2b')]){_0x533236[_0xa75e('0x46')]=_[_0xa75e('0x48')](_0x533236[_0xa75e('0x46')],{'$or':_[_0xa75e('0x2d')](_0x533236[_0xa75e('0x3e')],function(_0x1964d1){var _0x5ae569={};_0x5ae569[_0x1964d1]={'$like':'%'+_0x3e2b25[_0xa75e('0x3c')][_0xa75e('0x2b')]+'%'};return _0x5ae569;})});}_0x533236=_[_0xa75e('0x48')]({},_0x533236,_0x3e2b25[_0xa75e('0x4a')]);return db['CmHopperBlack'][_0xa75e('0x21')]({'where':_0x533236[_0xa75e('0x46')]})['then'](function(_0x6e1d82){_0x50ef8f[_0xa75e('0x21')]=_0x6e1d82;if(_0x3e2b25['query'][_0xa75e('0x50')]){_0x533236['include']=[{'all':!![]}];}return db[_0xa75e('0x6a')][_0xa75e('0x4c')](_0x533236);})[_0xa75e('0x27')](function(_0x37d648){_0x50ef8f[_0xa75e('0x65')]=_0x37d648;return _0x50ef8f;});}})[_0xa75e('0x27')](respondWithFilteredResult(_0x33f9e4,_0x533236))['catch'](handleError(_0x33f9e4,null));};exports[_0xa75e('0x6b')]=function(_0x5f0671,_0x223df8,_0x1a08bf){var _0x107ef3={};var _0x3ff271={};var _0x4ea66b;var _0x36f0b5;return db['VoiceQueue'][_0xa75e('0x62')]({'where':{'id':_0x5f0671[_0xa75e('0x5b')]['id']}})[_0xa75e('0x27')](handleEntityNotFound(_0x223df8,null))[_0xa75e('0x27')](function(_0x278224){if(_0x278224){_0x4ea66b=_0x278224;_0x3ff271['model']=_[_0xa75e('0x3b')](db[_0xa75e('0x6c')][_0xa75e('0x4e')]);_0x3ff271[_0xa75e('0x3c')]=_[_0xa75e('0x3b')](_0x5f0671[_0xa75e('0x3c')]);_0x3ff271[_0xa75e('0x3d')]=_[_0xa75e('0x4f')](_0x3ff271[_0xa75e('0x3a')],_0x3ff271[_0xa75e('0x3c')]);_0x107ef3[_0xa75e('0x3e')]=_[_0xa75e('0x4f')](_0x3ff271[_0xa75e('0x3a')],qs[_0xa75e('0x3f')](_0x5f0671['query'][_0xa75e('0x3f')]));_0x107ef3[_0xa75e('0x3e')]=_0x107ef3['attributes'][_0xa75e('0x40')]?_0x107ef3['attributes']:_0x3ff271[_0xa75e('0x3a')];_0x107ef3[_0xa75e('0x44')]=qs[_0xa75e('0x45')](_0x5f0671[_0xa75e('0x3c')][_0xa75e('0x45')]);_0x107ef3[_0xa75e('0x46')]=qs[_0xa75e('0x3d')](_['pick'](_0x5f0671['query'],_0x3ff271[_0xa75e('0x3d')]));if(_0x5f0671[_0xa75e('0x3c')][_0xa75e('0x2b')]){_0x107ef3[_0xa75e('0x46')]=_[_0xa75e('0x48')](_0x107ef3[_0xa75e('0x46')],{'$or':_[_0xa75e('0x2d')](_0x107ef3[_0xa75e('0x3e')],function(_0x203b81){var _0x9167fc={};_0x9167fc[_0x203b81]={'$like':'%'+_0x5f0671[_0xa75e('0x3c')][_0xa75e('0x2b')]+'%'};return _0x9167fc;})});}_0x107ef3=_[_0xa75e('0x48')]({},_0x107ef3,_0x5f0671[_0xa75e('0x4a')]);return _0x4ea66b[_0xa75e('0x6b')](_0x107ef3);}})[_0xa75e('0x27')](function(_0x1e488e){if(_0x1e488e){_0x36f0b5=_0x1e488e[_0xa75e('0x40')];if(!_0x5f0671[_0xa75e('0x3c')]['hasOwnProperty'](_0xa75e('0x42'))){_0x107ef3[_0xa75e('0x22')]=qs[_0xa75e('0x22')](_0x5f0671[_0xa75e('0x3c')][_0xa75e('0x22')]);_0x107ef3[_0xa75e('0x43')]=qs['offset'](_0x5f0671[_0xa75e('0x3c')][_0xa75e('0x43')]);}return _0x4ea66b['getTeams'](_0x107ef3);}})[_0xa75e('0x27')](function(_0xf9a8fd){if(_0xf9a8fd){return _0xf9a8fd?{'count':_0x36f0b5,'rows':_0xf9a8fd}:null;}})[_0xa75e('0x27')](respondWithResult(_0x223df8,null))[_0xa75e('0x4d')](handleError(_0x223df8,null));};exports[_0xa75e('0x6d')]=function(_0x1b0ce5,_0xb4c35c,_0x5a1ff6){var _0x52f187=_0x1b0ce5['body']['teams'];var _0x7021a5=_[_0xa75e('0x2d')](_0x52f187,'id');return db[_0xa75e('0x6c')][_0xa75e('0x4c')]({'where':{'id':_0x7021a5},'attributes':['id'],'include':[{'model':db[_0xa75e('0x6e')],'as':_0xa75e('0x6f'),'attributes':['id',_0xa75e('0x32'),_0xa75e('0x70'),'voicePause','interface'],'raw':!![]}]})[_0xa75e('0x27')](function(_0x3b1c96){if(_0x3b1c96){var _0x2242f3=_['flatMap'](_0x3b1c96,function(_0x2c829a){var _0x12182f=_0x2c829a[_0xa75e('0x28')]({'plain':!![]});_0x12182f[_0xa75e('0x6f')][_0xa75e('0x71')](function(_0x4097cf){_0x4097cf[_0xa75e('0x72')]=_[_0xa75e('0x30')](_0x52f187,{'id':_0x12182f['id']})[_0xa75e('0x72')];});return _0x12182f[_0xa75e('0x6f')];});return db[_0xa75e('0x37')][_0xa75e('0x30')]({'where':{'id':_0x1b0ce5[_0xa75e('0x5b')]['id']}})[_0xa75e('0x27')](function(_0xecdb73){return db[_0xa75e('0x73')][_0xa75e('0x74')](function(_0x44a94d){return _0xecdb73[_0xa75e('0x6d')](_0x7021a5,{'transaction':_0x44a94d})[_0xa75e('0x27')](function(){return BPromise[_0xa75e('0x75')](_0x52f187,function(_0x3809c1){return db[_0xa75e('0x76')]['upsert']({'TeamId':_0x3809c1['id'],'VoiceQueueId':_0x1b0ce5[_0xa75e('0x5b')]['id'],'penalty':_0x3809c1[_0xa75e('0x72')]},{'transaction':_0x44a94d});});})[_0xa75e('0x27')](function(){return BPromise[_0xa75e('0x75')](_0x2242f3,function(_0x38c8a0){return db[_0xa75e('0x77')][_0xa75e('0x78')]({'where':{'UserId':_0x38c8a0['id'],'VoiceQueueId':_0x1b0ce5[_0xa75e('0x5b')]['id']},'defaults':{'penalty':_0x38c8a0[_0xa75e('0x72')]},'transaction':_0x44a94d});});})[_0xa75e('0x27')](function(){return BPromise[_0xa75e('0x75')](_[_0xa75e('0x2b')](_0x2242f3,{'online':!![]}),function(_0x658ea2){return db[_0xa75e('0x79')][_0xa75e('0x7a')]({'membername':_0x658ea2['name'],'UserId':_0x658ea2['id'],'queue_name':_0xecdb73[_0xa75e('0x32')],'VoiceQueueId':_0xecdb73['id'],'interface':_['isNil'](_0x658ea2[_0xa75e('0x7b')])?util['format'](_0xa75e('0x7c'),_0x658ea2['name']):_0x658ea2[_0xa75e('0x7b')],'paused':_0x658ea2['voicePause']||![],'penalty':_0x658ea2[_0xa75e('0x72')]},{'transaction':_0x44a94d});});})[_0xa75e('0x27')](function(){_0x2242f3[_0xa75e('0x71')](function(_0x4458cc){socket['emit'](_0xa75e('0x7d'),{'UserId':_0x4458cc['id'],'VoiceQueueId':_0xecdb73['id']});});});});});}})['then'](respondWithStatusCode(_0xb4c35c,null))[_0xa75e('0x4d')](handleError(_0xb4c35c,null));};exports[_0xa75e('0x7e')]=function(_0xca11d8,_0x3ce4b6,_0xb3395){return db[_0xa75e('0x6c')]['findAll']({'where':{'id':_0xca11d8['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa75e('0x6f'),'attributes':['id'],'raw':!![]}]})[_0xa75e('0x27')](handleEntityNotFound(_0x3ce4b6,null))['then'](function(_0x421593){var _0x46321b=_['map'](_0x421593,'id');var _0x4d6796=[];var _0xdd08f9=[];var _0x45eef9=squel[_0xa75e('0x7f')]();_0x45eef9[_0xa75e('0x80')]('tq.TeamId')[_0xa75e('0x81')]('team_has_voice_queues','tq')[_0xa75e('0x82')](_0xa75e('0x83'),'ut',_0xa75e('0x84'))[_0xa75e('0x46')](_0xa75e('0x85'),_0xca11d8[_0xa75e('0x5b')]['id']);for(var _0x1ee4c3=0x0;_0x1ee4c3<_0x421593[_0xa75e('0x40')];_0x1ee4c3+=0x1){let _0x266682=_0x421593[_0x1ee4c3];for(var _0x22d5d5=0x0;_0x22d5d5<_0x266682[_0xa75e('0x6f')][_0xa75e('0x40')];_0x22d5d5+=0x1){let _0x4ae9d2=_0x266682['Agents'][_0x22d5d5];var _0x421f46=_0x45eef9[_0xa75e('0x86')]();_0x421f46[_0xa75e('0x46')]('ut.UserId\x20=\x20?',_0x4ae9d2['id']);_0xdd08f9[_0xa75e('0x87')](db[_0xa75e('0x73')]['query'](_0x421f46['toString'](),{'type':db[_0xa75e('0x73')][_0xa75e('0x88')][_0xa75e('0x89')]})[_0xa75e('0x27')](function(_0x4ab4f2){if(_0x4ab4f2[_0xa75e('0x40')]===0x1){return _0x4ae9d2['id'];}else{var _0x113be9=_['every'](_[_0xa75e('0x2d')](_0x4ab4f2,'TeamId'),function(_0x5db06f){return _['includes'](_0x46321b,_0x5db06f);});if(_0x113be9){return _0x4ae9d2['id'];}}}));}}return BPromise[_0xa75e('0x8a')](_0xdd08f9)['then'](function(_0x27bd55){_0x4d6796=_(_0x4d6796)[_0xa75e('0x8b')](_0x27bd55)[_0xa75e('0x8c')]()[_0xa75e('0x2e')]();return db[_0xa75e('0x37')][_0xa75e('0x30')]({'where':{'id':_0xca11d8[_0xa75e('0x5b')]['id']}})[_0xa75e('0x27')](function(_0x2a39b9){return db[_0xa75e('0x73')][_0xa75e('0x74')](function(_0x5cf042){return _0x2a39b9[_0xa75e('0x7e')](_0xca11d8[_0xa75e('0x3c')][_0xa75e('0x8d')],{'transaction':_0x5cf042})[_0xa75e('0x27')](function(){if(!_[_0xa75e('0x8e')](_0x4d6796)){return _0x2a39b9['removeAgents'](_0x4d6796,{'transaction':_0x5cf042})['then'](function(){return db[_0xa75e('0x79')][_0xa75e('0x26')]({'where':{'VoiceQueueId':_0xca11d8['params']['id'],'UserId':_0x4d6796},'transaction':_0x5cf042});});}})['then'](function(){_0x4d6796[_0xa75e('0x71')](function(_0xbe520a){socket[_0xa75e('0x8f')](_0xa75e('0x90'),{'UserId':_0xbe520a,'VoiceQueueId':_0x2a39b9['id']});});});});});});})[_0xa75e('0x27')](respondWithStatusCode(_0x3ce4b6,null))[_0xa75e('0x4d')](handleError(_0x3ce4b6,null));};exports[_0xa75e('0x91')]=function(_0x20a851,_0x1bc4c2,_0x507b49){var _0x37b7b6,_0x15a371;return db[_0xa75e('0x37')][_0xa75e('0x30')]({'where':{'id':_0x20a851['params']['id']}})[_0xa75e('0x27')](handleEntityNotFound(_0x1bc4c2,null))[_0xa75e('0x27')](function(_0x40993f){if(_0x40993f){_0x15a371=_0x40993f;return _0x40993f['addAgents'](_0x20a851[_0xa75e('0x52')]['ids'],_[_0xa75e('0x5c')](_0x20a851[_0xa75e('0x52')],[_0xa75e('0x8d'),'id'])||{})[_0xa75e('0x92')](function(_0x51a181){for(var _0x57758c=0x0;_0x57758c<_0x20a851[_0xa75e('0x52')]['ids']['length'];_0x57758c+=0x1){socket[_0xa75e('0x8f')](_0xa75e('0x7d'),{'UserId':_0x20a851[_0xa75e('0x52')][_0xa75e('0x8d')][_0x57758c],'VoiceQueueId':_0x20a851['params']['id']});}return _0x51a181;});}})[_0xa75e('0x27')](function(_0x2081a2){_0x37b7b6=_0x2081a2||[];if(_0x15a371){return db[_0xa75e('0x6e')][_0xa75e('0x4c')]({'where':{'id':_0x20a851[_0xa75e('0x52')][_0xa75e('0x8d')]},'attributes':['id',_0xa75e('0x32'),_0xa75e('0x70'),'voicePause',_0xa75e('0x7b')],'raw':!![]});}})[_0xa75e('0x27')](function(_0x204fe6){if(!_[_0xa75e('0x8e')](_0x204fe6)){var _0x12515a=[];for(var _0x3373ce=0x0;_0x3373ce<_0x204fe6['length'];_0x3373ce++){if(_0x204fe6[_0x3373ce][_0xa75e('0x70')]){_0x12515a[_0xa75e('0x87')](db[_0xa75e('0x79')][_0xa75e('0x7a')]({'membername':_0x204fe6[_0x3373ce][_0xa75e('0x32')],'UserId':_0x204fe6[_0x3373ce]['id'],'queue_name':_0x15a371[_0xa75e('0x32')],'VoiceQueueId':_0x15a371['id'],'interface':_[_0xa75e('0x93')](_0x204fe6[_0x3373ce][_0xa75e('0x7b')])?util[_0xa75e('0x94')]('SIP/%s',_0x204fe6[_0x3373ce][_0xa75e('0x32')]):_0x204fe6[_0x3373ce]['interface'],'paused':_0x204fe6[_0x3373ce][_0xa75e('0x95')]||![],'penalty':_0x20a851[_0xa75e('0x52')][_0xa75e('0x72')]||0x0}));}}return BPromise[_0xa75e('0x8a')](_0x12515a);}})[_0xa75e('0x27')](function(){return _0x37b7b6;})[_0xa75e('0x27')](respondWithResult(_0x1bc4c2,null))[_0xa75e('0x4d')](handleError(_0x1bc4c2,null));};exports[_0xa75e('0x96')]=function(_0x2d9627,_0x79cd74,_0x474234){return db[_0xa75e('0x37')][_0xa75e('0x30')]({'where':{'id':_0x2d9627[_0xa75e('0x5b')]['id']}})[_0xa75e('0x27')](handleEntityNotFound(_0x79cd74,null))['then'](function(_0x4613be){if(_0x4613be){return _0x4613be[_0xa75e('0x96')](_0x2d9627[_0xa75e('0x3c')][_0xa75e('0x8d')])[_0xa75e('0x27')](function(){if(_[_0xa75e('0x97')](_0x2d9627[_0xa75e('0x3c')]['ids'])){for(var _0x547bcd=0x0;_0x547bcd<_0x2d9627[_0xa75e('0x3c')][_0xa75e('0x8d')][_0xa75e('0x40')];_0x547bcd+=0x1){socket[_0xa75e('0x8f')](_0xa75e('0x90'),{'UserId':Number(_0x2d9627[_0xa75e('0x3c')][_0xa75e('0x8d')][_0x547bcd]),'VoiceQueueId':Number(_0x2d9627['params']['id'])});}}else{socket[_0xa75e('0x8f')](_0xa75e('0x90'),{'UserId':Number(_0x2d9627['query'][_0xa75e('0x8d')]),'VoiceQueueId':Number(_0x2d9627[_0xa75e('0x5b')]['id'])});}});}})[_0xa75e('0x27')](function(_0x323281){return db[_0xa75e('0x79')][_0xa75e('0x26')]({'where':{'VoiceQueueId':_0x2d9627[_0xa75e('0x5b')]['id'],'UserId':_0x2d9627[_0xa75e('0x3c')]['ids']}})[_0xa75e('0x27')](function(){return _0x323281;});})[_0xa75e('0x27')](respondWithStatusCode(_0x79cd74,null))[_0xa75e('0x4d')](handleError(_0x79cd74,null));};exports[_0xa75e('0x98')]=function(_0x26ebeb,_0x1dd755,_0x3dd6f9){var _0x275ec8={};var _0x3cd960={};var _0x12c917;var _0x136584;return db[_0xa75e('0x37')]['findOne']({'where':{'id':_0x26ebeb['params']['id']}})[_0xa75e('0x27')](handleEntityNotFound(_0x1dd755,null))['then'](function(_0x13b703){if(_0x13b703){_0x12c917=_0x13b703;_0x3cd960[_0xa75e('0x3a')]=_[_0xa75e('0x3b')](db['User'][_0xa75e('0x4e')]);_0x3cd960['query']=_[_0xa75e('0x3b')](_0x26ebeb[_0xa75e('0x3c')]);_0x3cd960[_0xa75e('0x3d')]=_[_0xa75e('0x4f')](_0x3cd960[_0xa75e('0x3a')],_0x3cd960['query']);_0x275ec8[_0xa75e('0x3e')]=_[_0xa75e('0x4f')](_0x3cd960[_0xa75e('0x3a')],qs['fields'](_0x26ebeb['query'][_0xa75e('0x3f')]));_0x275ec8['attributes']=_0x275ec8['attributes'][_0xa75e('0x40')]?_0x275ec8[_0xa75e('0x3e')]:_0x3cd960[_0xa75e('0x3a')];_0x275ec8['order']=qs[_0xa75e('0x45')](_0x26ebeb[_0xa75e('0x3c')]['sort']);_0x275ec8['where']=qs[_0xa75e('0x3d')](_['pick'](_0x26ebeb[_0xa75e('0x3c')],_0x3cd960[_0xa75e('0x3d')]));if(_0x26ebeb['query'][_0xa75e('0x2b')]){_0x275ec8['where']=_[_0xa75e('0x48')](_0x275ec8[_0xa75e('0x46')],{'$or':_['map'](_0x275ec8[_0xa75e('0x3e')],function(_0x50a52){var _0x1f43f6={};_0x1f43f6[_0x50a52]={'$like':'%'+_0x26ebeb[_0xa75e('0x3c')][_0xa75e('0x2b')]+'%'};return _0x1f43f6;})});}_0x275ec8=_[_0xa75e('0x48')]({},_0x275ec8,_0x26ebeb[_0xa75e('0x4a')]);return _0x12c917[_0xa75e('0x98')](_0x275ec8);}})[_0xa75e('0x27')](function(_0x56c9d1){if(_0x56c9d1){_0x136584=_0x56c9d1[_0xa75e('0x40')];if(!_0x26ebeb[_0xa75e('0x3c')][_0xa75e('0x41')](_0xa75e('0x42'))){_0x275ec8[_0xa75e('0x22')]=qs[_0xa75e('0x22')](_0x26ebeb[_0xa75e('0x3c')][_0xa75e('0x22')]);_0x275ec8[_0xa75e('0x43')]=qs['offset'](_0x26ebeb['query'][_0xa75e('0x43')]);}return _0x12c917[_0xa75e('0x98')](_0x275ec8);}})[_0xa75e('0x27')](function(_0x45cbfa){if(_0x45cbfa){return _0x45cbfa?{'count':_0x136584,'rows':_0x45cbfa}:null;}})['then'](respondWithResult(_0x1dd755,null))['catch'](handleError(_0x1dd755,null));};exports['getMembers']=function(_0x53a809,_0x3e0b6b,_0xe6ac48){var _0x1fb614={};var _0x4ebffa={};var _0x329d6e;var _0x301aa7;return db[_0xa75e('0x37')][_0xa75e('0x62')]({'where':{'id':_0x53a809['params']['id']}})['then'](handleEntityNotFound(_0x3e0b6b,null))['then'](function(_0x92b33c){if(_0x92b33c){_0x329d6e=_0x92b33c;_0x4ebffa[_0xa75e('0x3a')]=_[_0xa75e('0x3b')](db[_0xa75e('0x79')][_0xa75e('0x4e')]);_0x4ebffa['query']=_['keys'](_0x53a809[_0xa75e('0x3c')]);_0x4ebffa[_0xa75e('0x3d')]=_[_0xa75e('0x4f')](_0x4ebffa['model'],_0x4ebffa['query']);_0x1fb614[_0xa75e('0x3e')]=_[_0xa75e('0x4f')](_0x4ebffa[_0xa75e('0x3a')],qs[_0xa75e('0x3f')](_0x53a809[_0xa75e('0x3c')]['fields']));_0x1fb614[_0xa75e('0x3e')]=_0x1fb614[_0xa75e('0x3e')]['length']?_0x1fb614['attributes']:_0x4ebffa[_0xa75e('0x3a')];_0x1fb614['order']=qs[_0xa75e('0x45')](_0x53a809[_0xa75e('0x3c')][_0xa75e('0x45')]);_0x1fb614['where']=qs['filters'](_[_0xa75e('0x47')](_0x53a809[_0xa75e('0x3c')],_0x4ebffa[_0xa75e('0x3d')]));if(_0x53a809['query']['filter']){_0x1fb614['where']=_[_0xa75e('0x48')](_0x1fb614['where'],{'$or':_[_0xa75e('0x2d')](_0x1fb614[_0xa75e('0x3e')],function(_0x2ae75c){var _0x21f935={};_0x21f935[_0x2ae75c]={'$like':'%'+_0x53a809[_0xa75e('0x3c')][_0xa75e('0x2b')]+'%'};return _0x21f935;})});}_0x1fb614=_['merge']({},_0x1fb614,_0x53a809[_0xa75e('0x4a')]);return _0x329d6e[_0xa75e('0x99')](_0x1fb614);}})[_0xa75e('0x27')](function(_0xd8a5e3){if(_0xd8a5e3){_0x301aa7=_0xd8a5e3['length'];if(!_0x53a809[_0xa75e('0x3c')][_0xa75e('0x41')](_0xa75e('0x42'))){_0x1fb614[_0xa75e('0x22')]=qs[_0xa75e('0x22')](_0x53a809[_0xa75e('0x3c')][_0xa75e('0x22')]);_0x1fb614[_0xa75e('0x43')]=qs[_0xa75e('0x43')](_0x53a809[_0xa75e('0x3c')]['offset']);}return _0x329d6e['getMembers'](_0x1fb614);}})[_0xa75e('0x27')](function(_0x49cb40){return _0x49cb40?{'count':_0x301aa7,'rows':_0x49cb40}:null;})[_0xa75e('0x27')](respondWithResult(_0x3e0b6b,null))[_0xa75e('0x4d')](handleError(_0x3e0b6b,null));};exports['getLists']=function(_0x745a57,_0x207cc9,_0x34ab79){var _0x565f64={};var _0x5c91f2={};var _0x11549d;var _0x174f47;return db[_0xa75e('0x37')][_0xa75e('0x62')]({'where':{'id':_0x745a57['params']['id']}})['then'](handleEntityNotFound(_0x207cc9,null))[_0xa75e('0x27')](function(_0x313aa1){if(_0x313aa1){_0x11549d=_0x313aa1;_0x5c91f2['model']=_['keys'](db[_0xa75e('0x9a')][_0xa75e('0x4e')]);_0x5c91f2[_0xa75e('0x3c')]=_['keys'](_0x745a57[_0xa75e('0x3c')]);_0x5c91f2['filters']=_[_0xa75e('0x4f')](_0x5c91f2[_0xa75e('0x3a')],_0x5c91f2[_0xa75e('0x3c')]);_0x565f64['attributes']=_[_0xa75e('0x4f')](_0x5c91f2[_0xa75e('0x3a')],qs[_0xa75e('0x3f')](_0x745a57[_0xa75e('0x3c')]['fields']));_0x565f64[_0xa75e('0x3e')]=_0x565f64[_0xa75e('0x3e')][_0xa75e('0x40')]?_0x565f64[_0xa75e('0x3e')]:_0x5c91f2['model'];_0x565f64[_0xa75e('0x44')]=qs[_0xa75e('0x45')](_0x745a57[_0xa75e('0x3c')][_0xa75e('0x45')]);_0x565f64[_0xa75e('0x46')]=qs[_0xa75e('0x3d')](_[_0xa75e('0x47')](_0x745a57[_0xa75e('0x3c')],_0x5c91f2[_0xa75e('0x3d')]));if(_0x745a57[_0xa75e('0x3c')][_0xa75e('0x2b')]){_0x565f64['where']=_[_0xa75e('0x48')](_0x565f64[_0xa75e('0x46')],{'$or':_[_0xa75e('0x2d')](_0x565f64[_0xa75e('0x3e')],function(_0x53a3f4){var _0x301a81={};_0x301a81[_0x53a3f4]={'$like':'%'+_0x745a57[_0xa75e('0x3c')][_0xa75e('0x2b')]+'%'};return _0x301a81;})});}_0x565f64=_['merge']({},_0x565f64,_0x745a57[_0xa75e('0x4a')]);return _0x11549d[_0xa75e('0x9b')](_0x565f64);}})[_0xa75e('0x27')](function(_0x568736){if(_0x568736){_0x174f47=_0x568736['length'];if(!_0x745a57[_0xa75e('0x3c')][_0xa75e('0x41')]('nolimit')){_0x565f64[_0xa75e('0x22')]=qs[_0xa75e('0x22')](_0x745a57[_0xa75e('0x3c')]['limit']);_0x565f64['offset']=qs[_0xa75e('0x43')](_0x745a57[_0xa75e('0x3c')][_0xa75e('0x43')]);}return _0x11549d[_0xa75e('0x9b')](_0x565f64);}})[_0xa75e('0x27')](function(_0x4a4e1c){if(_0x4a4e1c){return _0x4a4e1c?{'count':_0x174f47,'rows':_0x4a4e1c}:null;}})[_0xa75e('0x27')](respondWithResult(_0x207cc9,null))[_0xa75e('0x4d')](handleError(_0x207cc9,null));};exports[_0xa75e('0x9c')]=function(_0x36b860,_0x3c0d7a,_0x530eba){var _0x5908a3,_0x1a0c58;return db['VoiceQueue']['find']({'where':{'id':_0x36b860[_0xa75e('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3c0d7a,null))[_0xa75e('0x27')](function(_0x42e0b4){if(_0x42e0b4){_0x1a0c58=_0x42e0b4;return _0x42e0b4['addLists'](_0x36b860[_0xa75e('0x52')][_0xa75e('0x8d')],_[_0xa75e('0x5c')](_0x36b860['body'],[_0xa75e('0x8d'),'id'])||{});}return null;})['spread'](function(_0x30de83){var _0x154d8c;_0x5908a3=_0x30de83||[];var _0x40f567=[];if(_0x30de83){for(var _0x17248e=0x0;_0x17248e<_0x30de83[_0xa75e('0x40')];_0x17248e+=0x1){var _0x4cc070=_0x30de83[_0x17248e][_0xa75e('0x28')]({'plain':!![]});_0x1a0c58[_0xa75e('0x9d')]=_0x36b860[_0xa75e('0x52')][_0xa75e('0x9d')]?_0x36b860[_0xa75e('0x52')][_0xa75e('0x9d')]:_0x1a0c58[_0xa75e('0x9d')];switch(_0x1a0c58[_0xa75e('0x9d')]){case _0xa75e('0x9e'):_0x154d8c=squel[_0xa75e('0x9f')]()[_0xa75e('0xa0')](_0xa75e('0xa1'))[_0xa75e('0xa2')]([_0xa75e('0xa3'),_0xa75e('0xa4'),_0xa75e('0xa5'),_0xa75e('0xa6'),'VoiceQueueId',_0xa75e('0x5d'),_0xa75e('0x5e')],squel[_0xa75e('0x7f')]()['field']('phone',_0xa75e('0xa3'))[_0xa75e('0x80')](_0xa75e('0xa7'),_0xa75e('0xa4'))[_0xa75e('0x80')]('id','ContactId')[_0xa75e('0x80')](_0x4cc070[_0xa75e('0xa8')][_0xa75e('0xa9')](),_0xa75e('0xa6'))['field'](_0x36b860[_0xa75e('0x5b')]['id']['toString'](),_0xa75e('0x64'))[_0xa75e('0x80')](_0xa75e('0xa7'),_0xa75e('0x5d'))['field'](_0xa75e('0xa7'),_0xa75e('0x5e'))[_0xa75e('0x81')](_0xa75e('0xaa'))[_0xa75e('0x46')]('deletedAt\x20IS\x20NULL')[_0xa75e('0x46')]('ListId\x20=\x20?',_0x4cc070[_0xa75e('0xa8')]['toString']())['where'](_0xa75e('0xab'))[_0xa75e('0x46')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xa75e('0x80')](_0xa75e('0xac'))[_0xa75e('0x81')](_0xa75e('0xad'))[_0xa75e('0x46')](_0xa75e('0x85'),_0x36b860[_0xa75e('0x5b')]['id'][_0xa75e('0xa9')]()))[_0xa75e('0x46')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xa75e('0x80')]('COALESCE(phone,\x27\x27)')[_0xa75e('0x81')](_0xa75e('0xa1'))[_0xa75e('0x46')](_0xa75e('0x85'),_0x36b860['params']['id']['toString']())))[_0xa75e('0xa9')]();break;case _0xa75e('0xae'):_0x154d8c=squel[_0xa75e('0x9f')]()['into']('cm_hopper')[_0xa75e('0xa2')](['phone',_0xa75e('0xa4'),_0xa75e('0xa5'),_0xa75e('0xa6'),_0xa75e('0x64'),_0xa75e('0x5d'),'updatedAt'],squel[_0xa75e('0x7f')]()[_0xa75e('0x80')](_0xa75e('0xa3'),'phone')[_0xa75e('0x80')](_0xa75e('0xa7'),_0xa75e('0xa4'))[_0xa75e('0x80')]('id',_0xa75e('0xa5'))[_0xa75e('0x80')](_0x4cc070['CmListId'][_0xa75e('0xa9')](),_0xa75e('0xa6'))['field'](_0x36b860[_0xa75e('0x5b')]['id'][_0xa75e('0xa9')](),_0xa75e('0x64'))[_0xa75e('0x80')](_0xa75e('0xa7'),_0xa75e('0x5d'))[_0xa75e('0x80')]('NOW()',_0xa75e('0x5e'))[_0xa75e('0x81')](_0xa75e('0xaa'))['where'](_0xa75e('0xaf'))[_0xa75e('0x46')](_0xa75e('0xb0'),_0x4cc070[_0xa75e('0xa8')][_0xa75e('0xa9')]())[_0xa75e('0x46')]('phone\x20IS\x20NOT\x20NULL')[_0xa75e('0x46')]('phone\x20NOT\x20IN\x20(?)',squel[_0xa75e('0x7f')]()['field']('COALESCE(phone,\x27\x27)')[_0xa75e('0x81')](_0xa75e('0xa1'))[_0xa75e('0x46')]('VoiceQueueId\x20=\x20?',_0x36b860['params']['id'][_0xa75e('0xa9')]())))['toString']();break;default:_0x154d8c=squel[_0xa75e('0x9f')]()['into'](_0xa75e('0xa1'))['fromQuery']([_0xa75e('0xa3'),_0xa75e('0xa4'),_0xa75e('0xa5'),'ListId',_0xa75e('0x64'),'createdAt',_0xa75e('0x5e')],squel[_0xa75e('0x7f')]()['field'](_0xa75e('0xa3'),_0xa75e('0xa3'))[_0xa75e('0x80')](_0xa75e('0xa7'),'scheduledAt')[_0xa75e('0x80')]('id',_0xa75e('0xa5'))[_0xa75e('0x80')](_0x4cc070[_0xa75e('0xa8')][_0xa75e('0xa9')](),_0xa75e('0xa6'))[_0xa75e('0x80')](_0x36b860[_0xa75e('0x5b')]['id'][_0xa75e('0xa9')](),_0xa75e('0x64'))['field'](_0xa75e('0xa7'),_0xa75e('0x5d'))['field'](_0xa75e('0xa7'),_0xa75e('0x5e'))[_0xa75e('0x81')]('cm_contacts')[_0xa75e('0x46')](_0xa75e('0xaf'))['where'](_0xa75e('0xb0'),_0x4cc070[_0xa75e('0xa8')][_0xa75e('0xa9')]())['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x40f567['push'](db[_0xa75e('0x73')]['query'](_0x154d8c));}return BPromise['all'](_0x40f567);}})[_0xa75e('0x27')](function(){return _0x5908a3;})['then'](respondWithResult(_0x3c0d7a,null))[_0xa75e('0x4d')](handleError(_0x3c0d7a,null));};exports[_0xa75e('0xb1')]=function(_0x194a99,_0x4b9ae4,_0x45b39c){return db[_0xa75e('0x37')][_0xa75e('0x30')]({'where':{'id':_0x194a99[_0xa75e('0x5b')]['id']}})[_0xa75e('0x27')](handleEntityNotFound(_0x4b9ae4,null))[_0xa75e('0x27')](function(_0x550b32){if(_0x550b32){return _0x550b32[_0xa75e('0xb1')](_0x194a99[_0xa75e('0x3c')][_0xa75e('0x8d')]);}})[_0xa75e('0x27')](function(_0x4a6373){if(_0x4a6373){return db[_0xa75e('0x63')][_0xa75e('0x26')]({'where':{'ListId':_0x194a99['query'][_0xa75e('0x8d')],'VoiceQueueId':_0x194a99[_0xa75e('0x5b')]['id']}})[_0xa75e('0x27')](function(){return _0x4a6373;});}})['then'](respondWithStatusCode(_0x4b9ae4,null))[_0xa75e('0x4d')](handleError(_0x4b9ae4,null));};exports['getBlackLists']=function(_0x3584d9,_0x1ad369,_0x3f6429){var _0x3d5c4d={};var _0x3eb729={};var _0x4dd1d1;var _0x1ff00c;return db['VoiceQueue'][_0xa75e('0x62')]({'where':{'id':_0x3584d9[_0xa75e('0x5b')]['id']}})[_0xa75e('0x27')](handleEntityNotFound(_0x1ad369,null))['then'](function(_0x4bc3c5){if(_0x4bc3c5){_0x4dd1d1=_0x4bc3c5;_0x3eb729['model']=_['keys'](db[_0xa75e('0x9a')][_0xa75e('0x4e')]);_0x3eb729[_0xa75e('0x3c')]=_[_0xa75e('0x3b')](_0x3584d9['query']);_0x3eb729[_0xa75e('0x3d')]=_['intersection'](_0x3eb729[_0xa75e('0x3a')],_0x3eb729[_0xa75e('0x3c')]);_0x3d5c4d[_0xa75e('0x3e')]=_[_0xa75e('0x4f')](_0x3eb729[_0xa75e('0x3a')],qs[_0xa75e('0x3f')](_0x3584d9[_0xa75e('0x3c')][_0xa75e('0x3f')]));_0x3d5c4d[_0xa75e('0x3e')]=_0x3d5c4d[_0xa75e('0x3e')][_0xa75e('0x40')]?_0x3d5c4d['attributes']:_0x3eb729['model'];_0x3d5c4d[_0xa75e('0x44')]=qs[_0xa75e('0x45')](_0x3584d9[_0xa75e('0x3c')]['sort']);_0x3d5c4d[_0xa75e('0x46')]=qs[_0xa75e('0x3d')](_['pick'](_0x3584d9[_0xa75e('0x3c')],_0x3eb729[_0xa75e('0x3d')]));if(_0x3584d9['query'][_0xa75e('0x2b')]){_0x3d5c4d[_0xa75e('0x46')]=_[_0xa75e('0x48')](_0x3d5c4d['where'],{'$or':_[_0xa75e('0x2d')](_0x3d5c4d[_0xa75e('0x3e')],function(_0x11f5a9){var _0x2364b3={};_0x2364b3[_0x11f5a9]={'$like':'%'+_0x3584d9[_0xa75e('0x3c')]['filter']+'%'};return _0x2364b3;})});}_0x3d5c4d=_['merge']({},_0x3d5c4d,_0x3584d9[_0xa75e('0x4a')]);return _0x4dd1d1[_0xa75e('0xb2')](_0x3d5c4d);}})[_0xa75e('0x27')](function(_0x21725f){if(_0x21725f){_0x1ff00c=_0x21725f['length'];if(!_0x3584d9[_0xa75e('0x3c')][_0xa75e('0x41')](_0xa75e('0x42'))){_0x3d5c4d['limit']=qs['limit'](_0x3584d9[_0xa75e('0x3c')][_0xa75e('0x22')]);_0x3d5c4d['offset']=qs[_0xa75e('0x43')](_0x3584d9['query'][_0xa75e('0x43')]);}return _0x4dd1d1[_0xa75e('0xb2')](_0x3d5c4d);}})[_0xa75e('0x27')](function(_0x2db78d){if(_0x2db78d){return _0x2db78d?{'count':_0x1ff00c,'rows':_0x2db78d}:null;}})[_0xa75e('0x27')](respondWithResult(_0x1ad369,null))[_0xa75e('0x4d')](handleError(_0x1ad369,null));};exports[_0xa75e('0xb3')]=function(_0x5023de,_0x4534db,_0x394c1c){var _0x7966f7,_0x28921e;return db['VoiceQueue']['find']({'where':{'id':_0x5023de['params']['id']}})[_0xa75e('0x27')](handleEntityNotFound(_0x4534db,null))[_0xa75e('0x27')](function(_0x2942cf){if(_0x2942cf){_0x28921e=_0x2942cf;return _0x2942cf['addBlackLists'](_0x5023de[_0xa75e('0x52')][_0xa75e('0x8d')],_[_0xa75e('0x5c')](_0x5023de[_0xa75e('0x52')],[_0xa75e('0x8d'),'id'])||{});}return null;})['spread'](function(_0x40d0a4){var _0xc965a8;_0x7966f7=_0x40d0a4||[];var _0x5c77a7=[];if(_0x40d0a4){for(var _0x2c2cf1=0x0;_0x2c2cf1<_0x40d0a4[_0xa75e('0x40')];_0x2c2cf1+=0x1){var _0x3edfdf=_0x40d0a4[_0x2c2cf1][_0xa75e('0x28')]({'plain':!![]});_0xc965a8=squel[_0xa75e('0x9f')]()[_0xa75e('0xa0')]('cm_hopper_black')[_0xa75e('0xa2')]([_0xa75e('0xa3'),'ContactId','ListId',_0xa75e('0x64'),_0xa75e('0x5d'),_0xa75e('0x5e')],squel[_0xa75e('0x7f')]()[_0xa75e('0x80')](_0xa75e('0xa3'),_0xa75e('0xa3'))['field']('id','ContactId')[_0xa75e('0x80')](_0x3edfdf['CmListId'][_0xa75e('0xa9')](),_0xa75e('0xa6'))[_0xa75e('0x80')](_0x5023de[_0xa75e('0x5b')]['id'][_0xa75e('0xa9')](),_0xa75e('0x64'))[_0xa75e('0x80')]('NOW()',_0xa75e('0x5d'))[_0xa75e('0x80')](_0xa75e('0xa7'),_0xa75e('0x5e'))['from'](_0xa75e('0xaa'))[_0xa75e('0x46')](_0xa75e('0xaf'))[_0xa75e('0x46')](_0xa75e('0xb0'),_0x3edfdf[_0xa75e('0xa8')][_0xa75e('0xa9')]())[_0xa75e('0x46')](_0xa75e('0xab')))[_0xa75e('0xa9')]();_0x5c77a7['push'](db['sequelize'][_0xa75e('0x3c')](_0xc965a8));}return BPromise[_0xa75e('0x8a')](_0x5c77a7);}})[_0xa75e('0x27')](function(){return _0x7966f7;})[_0xa75e('0x27')](respondWithResult(_0x4534db,null))[_0xa75e('0x4d')](handleError(_0x4534db,null));};exports[_0xa75e('0xb4')]=function(_0x2ff324,_0x324fee,_0x99a1fc){return db[_0xa75e('0x37')][_0xa75e('0x30')]({'where':{'id':_0x2ff324[_0xa75e('0x5b')]['id']}})[_0xa75e('0x27')](handleEntityNotFound(_0x324fee,null))[_0xa75e('0x27')](function(_0x1be8fc){if(_0x1be8fc){return _0x1be8fc['removeBlackLists'](_0x2ff324[_0xa75e('0x3c')][_0xa75e('0x8d')]);}})[_0xa75e('0x27')](function(_0x3bb361){if(_0x3bb361){return db[_0xa75e('0x6a')][_0xa75e('0x26')]({'where':{'ListId':_0x2ff324[_0xa75e('0x3c')][_0xa75e('0x8d')],'VoiceQueueId':_0x2ff324[_0xa75e('0x5b')]['id']}})[_0xa75e('0x27')](function(){return _0x3bb361;});}})['then'](respondWithStatusCode(_0x324fee,null))['catch'](handleError(_0x324fee,null));}; \ No newline at end of file +var _0x9ab9=['SELECT','every','all','union','transaction','userVoiceQueue:remove','addAgents','spread','online','isEmpty','push','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ListId','NOW()','ContactId','CmListId','toString','cm_contacts','phone\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','onlyIfOpen','cm_hopper','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','addBlackLists','cm_hopper_black','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','end','status','json','count','offset','limit','reject','save','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','destroy','error','stack','send','index','VoiceQueue','rawAttributes','fieldName','key','name','query','keys','filters','intersection','attributes','fields','length','model','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileResource','getHoppers','CmHopper','hasOwnProperty','pick','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','voicePause','interface','flatMap','forEach','penalty','sequelize','TeamVoiceQueue','each','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?'];(function(_0x598f9a,_0x3a5e55){var _0x23ffa5=function(_0x5607a7){while(--_0x5607a7){_0x598f9a['push'](_0x598f9a['shift']());}};_0x23ffa5(++_0x3a5e55);}(_0x9ab9,0x19d));var _0x99ab=function(_0x29393a,_0x53706c){_0x29393a=_0x29393a-0x0;var _0x2ab78a=_0x9ab9[_0x29393a];return _0x2ab78a;};'use strict';var pdf=require(_0x99ab('0x0'));var emlformat=require(_0x99ab('0x1'));var rimraf=require(_0x99ab('0x2'));var zipdir=require(_0x99ab('0x3'));var jsonpatch=require(_0x99ab('0x4'));var rp=require('request-promise');var moment=require(_0x99ab('0x5'));var BPromise=require(_0x99ab('0x6'));var Mustache=require('mustache');var util=require(_0x99ab('0x7'));var path=require('path');var sox=require(_0x99ab('0x8'));var csv=require(_0x99ab('0x9'));var ejs=require(_0x99ab('0xa'));var fs=require('fs');var fs_extra=require(_0x99ab('0xb'));var _=require(_0x99ab('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x99ab('0xd'));var deskjs=require(_0x99ab('0xe'));var toCsv=require('to-csv');var querystring=require(_0x99ab('0xf'));var Papa=require(_0x99ab('0x10'));var Redis=require(_0x99ab('0x11'));var authService=require(_0x99ab('0x12'));var qs=require(_0x99ab('0x13'));var as=require(_0x99ab('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x99ab('0x15'))(_0x99ab('0x16'));var utils=require(_0x99ab('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x99ab('0x18'))['db'];config[_0x99ab('0x19')]=_[_0x99ab('0x1a')](config[_0x99ab('0x19')],{'host':_0x99ab('0x1b'),'port':0x18eb});var socket=require(_0x99ab('0x1c'))(new Redis(config['redis']));require(_0x99ab('0x1d'))[_0x99ab('0x1e')](socket);function respondWithStatusCode(_0x5e51ab,_0x381959){_0x381959=_0x381959||0xcc;return function(_0x36d89e){if(_0x36d89e){return _0x5e51ab[_0x99ab('0x1f')](_0x381959);}return _0x5e51ab['status'](_0x381959)[_0x99ab('0x20')]();};}function respondWithResult(_0x13b9aa,_0x1c52a6){_0x1c52a6=_0x1c52a6||0xc8;return function(_0x31b340){if(_0x31b340){return _0x13b9aa[_0x99ab('0x21')](_0x1c52a6)[_0x99ab('0x22')](_0x31b340);}};}function respondWithFilteredResult(_0x1d841c,_0x2c24c9){return function(_0x478b37){if(_0x478b37){var _0x14a515=_0x478b37[_0x99ab('0x23')],_0x368b52=_0x2c24c9[_0x99ab('0x24')],_0x4193c0=_0x2c24c9[_0x99ab('0x24')]+_0x2c24c9[_0x99ab('0x25')],_0x1cdd6d;if(_0x4193c0>=_0x14a515){_0x4193c0=_0x14a515;_0x1cdd6d=0xc8;}else{_0x1cdd6d=0xce;}_0x1d841c[_0x99ab('0x21')](_0x1cdd6d);return _0x1d841c['set']('Content-Range',_0x368b52+'-'+_0x4193c0+'/'+_0x14a515)[_0x99ab('0x22')](_0x478b37);}return null;};}function patchUpdates(_0x26d94a){return function(_0x194f39){try{jsonpatch['apply'](_0x194f39,_0x26d94a,!![]);}catch(_0x2e0464){return BPromise[_0x99ab('0x26')](_0x2e0464);}return _0x194f39[_0x99ab('0x27')]();};}function saveUpdates(_0x2604ee,_0x624e9b){return function(_0x15fea0){if(_0x15fea0){return _0x15fea0[_0x99ab('0x28')](_0x2604ee)['then'](function(_0x5de675){return _0x5de675;});}return null;};}function removeEntity(_0x4cd112,_0x461f2f){return function(_0x56bdb7){if(_0x56bdb7){return _0x56bdb7['destroy']()[_0x99ab('0x29')](function(){var _0x17df1e=_0x56bdb7[_0x99ab('0x2a')]({'plain':!![]});var _0x570bed=[{'name':_0x99ab('0x2b'),'value':_0x99ab('0x2c'),'ignore':![]},{'name':_0x99ab('0x2d'),'value':_0x99ab('0x2e'),'ignore':![]}];var _0x36414c=_(_0x570bed)[_0x99ab('0x2f')](_0x99ab('0x30'))[_0x99ab('0x31')](_0x99ab('0x32'))['value']();if(_[_0x99ab('0x33')](_0x36414c,_0x17df1e[_0x99ab('0x34')])){return;}var _0x50ffdc=_[_0x99ab('0x35')](_0x570bed,[_0x99ab('0x32'),_0x17df1e[_0x99ab('0x34')]])['name'];return db['UserProfileResource'][_0x99ab('0x36')]({'where':{'type':_0x50ffdc,'resourceId':_0x17df1e['id']}})[_0x99ab('0x29')](function(){return _0x56bdb7;});})[_0x99ab('0x29')](function(){_0x4cd112[_0x99ab('0x21')](0xcc)[_0x99ab('0x20')]();});}};}function handleEntityNotFound(_0x36c0f1,_0x2213e9){return function(_0x85bf48){if(!_0x85bf48){_0x36c0f1['sendStatus'](0x194);}return _0x85bf48;};}function handleError(_0x44bf54,_0x453138){_0x453138=_0x453138||0x1f4;return function(_0x58c8d3){logger[_0x99ab('0x37')](_0x58c8d3[_0x99ab('0x38')]);if(_0x58c8d3['name']){delete _0x58c8d3['name'];}_0x44bf54[_0x99ab('0x21')](_0x453138)[_0x99ab('0x39')](_0x58c8d3);};}exports[_0x99ab('0x3a')]=function(_0x56a440,_0x4eee06){var _0x5ec3fa={},_0x4c086e={},_0x5507b6={'count':0x0,'rows':[]};var _0x482255=_[_0x99ab('0x31')](db[_0x99ab('0x3b')][_0x99ab('0x3c')],function(_0x4a2fea){return{'name':_0x4a2fea[_0x99ab('0x3d')],'type':_0x4a2fea[_0x99ab('0x34')][_0x99ab('0x3e')]};});_0x4c086e['model']=_[_0x99ab('0x31')](_0x482255,_0x99ab('0x3f'));_0x4c086e[_0x99ab('0x40')]=_[_0x99ab('0x41')](_0x56a440[_0x99ab('0x40')]);_0x4c086e[_0x99ab('0x42')]=_[_0x99ab('0x43')](_0x4c086e['model'],_0x4c086e['query']);_0x5ec3fa[_0x99ab('0x44')]=_[_0x99ab('0x43')](_0x4c086e['model'],qs[_0x99ab('0x45')](_0x56a440[_0x99ab('0x40')][_0x99ab('0x45')]));_0x5ec3fa['attributes']=_0x5ec3fa[_0x99ab('0x44')][_0x99ab('0x46')]?_0x5ec3fa[_0x99ab('0x44')]:_0x4c086e[_0x99ab('0x47')];if(!_0x56a440[_0x99ab('0x40')]['hasOwnProperty'](_0x99ab('0x48'))){_0x5ec3fa[_0x99ab('0x25')]=qs['limit'](_0x56a440[_0x99ab('0x40')]['limit']);_0x5ec3fa[_0x99ab('0x24')]=qs[_0x99ab('0x24')](_0x56a440[_0x99ab('0x40')][_0x99ab('0x24')]);}_0x5ec3fa[_0x99ab('0x49')]=qs[_0x99ab('0x4a')](_0x56a440[_0x99ab('0x40')][_0x99ab('0x4a')]);_0x5ec3fa[_0x99ab('0x4b')]=qs[_0x99ab('0x42')](_['pick'](_0x56a440[_0x99ab('0x40')],_0x4c086e[_0x99ab('0x42')]),_0x482255);if(_0x56a440['query'][_0x99ab('0x2f')]){_0x5ec3fa['where']=_[_0x99ab('0x4c')](_0x5ec3fa['where'],{'$or':_[_0x99ab('0x31')](_0x482255,function(_0x17c331){if(_0x17c331[_0x99ab('0x34')]!==_0x99ab('0x4d')){var _0x5aac8f={};_0x5aac8f[_0x17c331[_0x99ab('0x3f')]]={'$like':'%'+_0x56a440[_0x99ab('0x40')][_0x99ab('0x2f')]+'%'};return _0x5aac8f;}})});}_0x5ec3fa=_[_0x99ab('0x4c')]({},_0x5ec3fa,_0x56a440[_0x99ab('0x4e')]);var _0x3bdfbc={'where':_0x5ec3fa[_0x99ab('0x4b')]};return db[_0x99ab('0x3b')][_0x99ab('0x23')](_0x3bdfbc)[_0x99ab('0x29')](function(_0x229840){_0x5507b6[_0x99ab('0x23')]=_0x229840;if(_0x56a440[_0x99ab('0x40')][_0x99ab('0x4f')]){_0x5ec3fa[_0x99ab('0x50')]=[{'all':!![]}];}return db['VoiceQueue'][_0x99ab('0x51')](_0x5ec3fa);})[_0x99ab('0x29')](function(_0x5c1695){_0x5507b6[_0x99ab('0x52')]=_0x5c1695;return _0x5507b6;})[_0x99ab('0x29')](respondWithFilteredResult(_0x4eee06,_0x5ec3fa))[_0x99ab('0x53')](handleError(_0x4eee06,null));};exports[_0x99ab('0x54')]=function(_0x63b31b,_0xa73fc3){var _0x33bd1c={'raw':![],'where':{'id':_0x63b31b[_0x99ab('0x55')]['id']}},_0x2a6e69={};_0x2a6e69[_0x99ab('0x47')]=_[_0x99ab('0x41')](db['VoiceQueue'][_0x99ab('0x3c')]);_0x2a6e69[_0x99ab('0x40')]=_[_0x99ab('0x41')](_0x63b31b[_0x99ab('0x40')]);_0x2a6e69['filters']=_['intersection'](_0x2a6e69[_0x99ab('0x47')],_0x2a6e69['query']);_0x33bd1c[_0x99ab('0x44')]=_[_0x99ab('0x43')](_0x2a6e69[_0x99ab('0x47')],qs[_0x99ab('0x45')](_0x63b31b[_0x99ab('0x40')][_0x99ab('0x45')]));_0x33bd1c[_0x99ab('0x44')]=_0x33bd1c['attributes'][_0x99ab('0x46')]?_0x33bd1c[_0x99ab('0x44')]:_0x2a6e69[_0x99ab('0x47')];if(_0x63b31b[_0x99ab('0x40')][_0x99ab('0x4f')]){_0x33bd1c[_0x99ab('0x50')]=[{'all':!![]}];}_0x33bd1c=_[_0x99ab('0x4c')]({},_0x33bd1c,_0x63b31b[_0x99ab('0x4e')]);return db[_0x99ab('0x3b')][_0x99ab('0x35')](_0x33bd1c)['then'](handleEntityNotFound(_0xa73fc3,null))[_0x99ab('0x29')](respondWithResult(_0xa73fc3,null))[_0x99ab('0x53')](handleError(_0xa73fc3,null));};exports['create']=function(_0x271ff5,_0x149588){return db[_0x99ab('0x3b')][_0x99ab('0x56')](_0x271ff5[_0x99ab('0x57')],{})[_0x99ab('0x29')](function(_0x135cd6){var _0x530dbb=_0x271ff5[_0x99ab('0x58')][_0x99ab('0x2a')]({'plain':!![]});if(!_0x530dbb)throw new Error(_0x99ab('0x59'));if(_0x530dbb[_0x99ab('0x5a')]===_0x99ab('0x58')){var _0x53dde8=_0x135cd6['get']({'plain':!![]});var _0x10e945=[{'name':_0x99ab('0x2b'),'value':_0x99ab('0x2c')},{'name':_0x99ab('0x2d'),'value':'outbound'}];var _0x3902eb=_['find'](_0x10e945,[_0x99ab('0x32'),_0x53dde8[_0x99ab('0x34')]])['name'];return db[_0x99ab('0x5b')][_0x99ab('0x35')]({'where':{'name':_0x3902eb,'userProfileId':_0x530dbb[_0x99ab('0x5c')]},'raw':!![]})['then'](function(_0x3f0d66){if(_0x3f0d66&&_0x3f0d66[_0x99ab('0x5d')]===0x0){return db['UserProfileResource'][_0x99ab('0x56')]({'name':_0x53dde8[_0x99ab('0x3f')],'resourceId':_0x53dde8['id'],'type':_0x3f0d66[_0x99ab('0x3f')],'sectionId':_0x3f0d66['id']},{})[_0x99ab('0x29')](function(){return _0x135cd6;});}else{return _0x135cd6;}})[_0x99ab('0x53')](function(_0xd646a4){logger[_0x99ab('0x37')](_0x99ab('0x5e'),_0xd646a4);throw _0xd646a4;});}return _0x135cd6;})[_0x99ab('0x29')](respondWithResult(_0x149588,0xc9))[_0x99ab('0x53')](handleError(_0x149588,null));};exports[_0x99ab('0x5f')]=function(_0x283cc6,_0x545df5){var _0x59d71d={'where':{'id':_0x283cc6[_0x99ab('0x55')]['id']}},_0x1099aa={};_0x1099aa[_0x99ab('0x47')]=_['keys'](db[_0x99ab('0x3b')][_0x99ab('0x3c')]);_0x59d71d[_0x99ab('0x44')]=_[_0x99ab('0x43')](_0x1099aa[_0x99ab('0x47')],qs[_0x99ab('0x45')](_0x283cc6[_0x99ab('0x40')][_0x99ab('0x45')]));_0x59d71d[_0x99ab('0x44')]=_0x59d71d[_0x99ab('0x44')][_0x99ab('0x46')]?_0x59d71d[_0x99ab('0x44')]:_0x1099aa['model'];if(_0x283cc6[_0x99ab('0x40')][_0x99ab('0x4f')]){_0x59d71d[_0x99ab('0x50')]=[{'all':!![]}];}_0x59d71d=_[_0x99ab('0x4c')]({},_0x59d71d,_0x283cc6['options']);return db[_0x99ab('0x3b')][_0x99ab('0x35')](_0x59d71d)[_0x99ab('0x29')](handleEntityNotFound(_0x545df5,null))['then'](function(_0x32f963){if(_0x32f963){var _0x34846d=_0x32f963['get']({'plain':!![]});_0x34846d=qs[_0x99ab('0x60')](_0x34846d,['id',_0x99ab('0x61'),'updatedAt']);_0x283cc6[_0x99ab('0x57')]=_[_0x99ab('0x60')](_0x283cc6[_0x99ab('0x57')],['id',_0x99ab('0x61'),_0x99ab('0x62')]);return db['VoiceQueue']['create'](_[_0x99ab('0x4c')](_0x34846d,_0x283cc6[_0x99ab('0x57')]),{'include':_0x283cc6['query'][_0x99ab('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x2bbea0){var _0x28c9ec=_0x283cc6[_0x99ab('0x58')][_0x99ab('0x2a')]({'plain':!![]});if(!_0x28c9ec)throw new Error(_0x99ab('0x59'));if(_0x28c9ec[_0x99ab('0x5a')]==='user'){var _0x34ccaa=_0x2bbea0[_0x99ab('0x2a')]({'plain':!![]});var _0x65c456=[{'name':_0x99ab('0x2b'),'value':'inbound'},{'name':_0x99ab('0x2d'),'value':'outbound'}];var _0x42ece6=_[_0x99ab('0x35')](_0x65c456,[_0x99ab('0x32'),_0x34ccaa[_0x99ab('0x34')]])['name'];return db[_0x99ab('0x5b')][_0x99ab('0x35')]({'where':{'name':_0x42ece6,'userProfileId':_0x28c9ec['userProfileId']},'raw':!![]})[_0x99ab('0x29')](function(_0x3cec53){if(_0x3cec53&&_0x3cec53[_0x99ab('0x5d')]===0x0){return db[_0x99ab('0x63')][_0x99ab('0x56')]({'name':_0x34ccaa[_0x99ab('0x3f')],'resourceId':_0x34ccaa['id'],'type':_0x3cec53[_0x99ab('0x3f')],'sectionId':_0x3cec53['id']},{})[_0x99ab('0x29')](function(){return _0x2bbea0;});}else{return _0x2bbea0;}})[_0x99ab('0x53')](function(_0x3312a6){logger[_0x99ab('0x37')](_0x99ab('0x5e'),_0x3312a6);throw _0x3312a6;});}return _0x2bbea0;});}})[_0x99ab('0x29')](respondWithResult(_0x545df5,0xc9))[_0x99ab('0x53')](handleError(_0x545df5,null));};exports[_0x99ab('0x28')]=function(_0x511423,_0x30eb64){if(_0x511423[_0x99ab('0x57')]['id']){delete _0x511423[_0x99ab('0x57')]['id'];}return db[_0x99ab('0x3b')]['find']({'where':{'id':_0x511423[_0x99ab('0x55')]['id']}})['then'](handleEntityNotFound(_0x30eb64,null))[_0x99ab('0x29')](saveUpdates(_0x511423['body'],null))['then'](respondWithResult(_0x30eb64,null))[_0x99ab('0x53')](handleError(_0x30eb64,null));};exports[_0x99ab('0x36')]=function(_0x3f9eb1,_0x3a8d8c){return db[_0x99ab('0x3b')][_0x99ab('0x35')]({'where':{'id':_0x3f9eb1['params']['id']}})['then'](handleEntityNotFound(_0x3a8d8c,null))[_0x99ab('0x29')](removeEntity(_0x3a8d8c,null))[_0x99ab('0x53')](handleError(_0x3a8d8c,null));};exports[_0x99ab('0x64')]=function(_0x7ed2e5,_0x4d3062,_0x2f16e6){var _0x4f11c5={'raw':![],'where':{}};var _0x55992e={};var _0x1e7c7e={'count':0x0,'rows':[]};return db[_0x99ab('0x3b')]['findOne']({'where':{'id':_0x7ed2e5[_0x99ab('0x55')]['id']}})[_0x99ab('0x29')](handleEntityNotFound(_0x4d3062,null))[_0x99ab('0x29')](function(_0xd96882){if(_0xd96882){_0x55992e[_0x99ab('0x47')]=_[_0x99ab('0x41')](db[_0x99ab('0x65')][_0x99ab('0x3c')]);_0x55992e[_0x99ab('0x40')]=_['keys'](_0x7ed2e5[_0x99ab('0x40')]);_0x55992e['filters']=_[_0x99ab('0x43')](_0x55992e[_0x99ab('0x47')],_0x55992e[_0x99ab('0x40')]);_0x4f11c5['attributes']=_[_0x99ab('0x43')](_0x55992e[_0x99ab('0x47')],qs[_0x99ab('0x45')](_0x7ed2e5[_0x99ab('0x40')][_0x99ab('0x45')]));_0x4f11c5[_0x99ab('0x44')]=_0x4f11c5['attributes'][_0x99ab('0x46')]?_0x4f11c5[_0x99ab('0x44')]:_0x55992e[_0x99ab('0x47')];if(!_0x7ed2e5[_0x99ab('0x40')][_0x99ab('0x66')](_0x99ab('0x48'))){_0x4f11c5[_0x99ab('0x25')]=qs[_0x99ab('0x25')](_0x7ed2e5['query'][_0x99ab('0x25')]);_0x4f11c5[_0x99ab('0x24')]=qs['offset'](_0x7ed2e5[_0x99ab('0x40')][_0x99ab('0x24')]);}_0x4f11c5[_0x99ab('0x49')]=qs[_0x99ab('0x4a')](_0x7ed2e5[_0x99ab('0x40')]['sort']);_0x4f11c5[_0x99ab('0x4b')]=qs[_0x99ab('0x42')](_[_0x99ab('0x67')](_0x7ed2e5[_0x99ab('0x40')],_0x55992e[_0x99ab('0x42')]));_0x4f11c5['where'][_0x99ab('0x68')]=_0xd96882['id'];if(_0x7ed2e5[_0x99ab('0x40')][_0x99ab('0x2f')]){_0x4f11c5['where']=_[_0x99ab('0x4c')](_0x4f11c5['where'],{'$or':_['map'](_0x4f11c5[_0x99ab('0x44')],function(_0x4552f1){var _0x52e936={};_0x52e936[_0x4552f1]={'$like':'%'+_0x7ed2e5[_0x99ab('0x40')][_0x99ab('0x2f')]+'%'};return _0x52e936;})});}_0x4f11c5=_[_0x99ab('0x4c')]({},_0x4f11c5,_0x7ed2e5[_0x99ab('0x4e')]);return db[_0x99ab('0x65')]['count']({'where':_0x4f11c5[_0x99ab('0x4b')]})[_0x99ab('0x29')](function(_0x11415c){_0x1e7c7e[_0x99ab('0x23')]=_0x11415c;if(_0x7ed2e5[_0x99ab('0x40')][_0x99ab('0x4f')]){_0x4f11c5[_0x99ab('0x50')]=[{'all':!![]}];}return db[_0x99ab('0x65')][_0x99ab('0x51')](_0x4f11c5);})['then'](function(_0x56101f){_0x1e7c7e[_0x99ab('0x52')]=_0x56101f;return _0x1e7c7e;});}})['then'](respondWithFilteredResult(_0x4d3062,_0x4f11c5))[_0x99ab('0x53')](handleError(_0x4d3062,null));};exports[_0x99ab('0x69')]=function(_0x1e2c1e,_0x19c5d1,_0x242159){var _0x4b2b40={'raw':!![],'where':{}};var _0xb5c299={};var _0x1de830={'count':0x0,'rows':[]};return db[_0x99ab('0x3b')][_0x99ab('0x6a')]({'where':{'id':_0x1e2c1e[_0x99ab('0x55')]['id']}})['then'](handleEntityNotFound(_0x19c5d1,null))['then'](function(_0x4c7afe){if(_0x4c7afe){_0xb5c299['model']=_[_0x99ab('0x41')](db[_0x99ab('0x6b')][_0x99ab('0x3c')]);_0xb5c299[_0x99ab('0x40')]=_[_0x99ab('0x41')](_0x1e2c1e[_0x99ab('0x40')]);_0xb5c299[_0x99ab('0x42')]=_['intersection'](_0xb5c299[_0x99ab('0x47')],_0xb5c299[_0x99ab('0x40')]);_0x4b2b40[_0x99ab('0x44')]=_[_0x99ab('0x43')](_0xb5c299[_0x99ab('0x47')],qs['fields'](_0x1e2c1e[_0x99ab('0x40')]['fields']));_0x4b2b40['attributes']=_0x4b2b40[_0x99ab('0x44')]['length']?_0x4b2b40[_0x99ab('0x44')]:_0xb5c299['model'];if(!_0x1e2c1e['query'][_0x99ab('0x66')](_0x99ab('0x48'))){_0x4b2b40['limit']=qs[_0x99ab('0x25')](_0x1e2c1e[_0x99ab('0x40')][_0x99ab('0x25')]);_0x4b2b40[_0x99ab('0x24')]=qs['offset'](_0x1e2c1e[_0x99ab('0x40')][_0x99ab('0x24')]);}_0x4b2b40['order']=qs[_0x99ab('0x4a')](_0x1e2c1e[_0x99ab('0x40')][_0x99ab('0x4a')]);_0x4b2b40[_0x99ab('0x4b')]=qs[_0x99ab('0x42')](_['pick'](_0x1e2c1e[_0x99ab('0x40')],_0xb5c299[_0x99ab('0x42')]));_0x4b2b40['where'][_0x99ab('0x68')]=_0x4c7afe['id'];if(_0x1e2c1e['query'][_0x99ab('0x2f')]){_0x4b2b40['where']=_['merge'](_0x4b2b40[_0x99ab('0x4b')],{'$or':_['map'](_0x4b2b40[_0x99ab('0x44')],function(_0x1365e1){var _0x4845c7={};_0x4845c7[_0x1365e1]={'$like':'%'+_0x1e2c1e['query'][_0x99ab('0x2f')]+'%'};return _0x4845c7;})});}_0x4b2b40=_[_0x99ab('0x4c')]({},_0x4b2b40,_0x1e2c1e[_0x99ab('0x4e')]);return db[_0x99ab('0x6b')][_0x99ab('0x23')]({'where':_0x4b2b40[_0x99ab('0x4b')]})[_0x99ab('0x29')](function(_0x5310d4){_0x1de830[_0x99ab('0x23')]=_0x5310d4;if(_0x1e2c1e['query'][_0x99ab('0x4f')]){_0x4b2b40['include']=[{'all':!![]}];}return db[_0x99ab('0x6b')][_0x99ab('0x51')](_0x4b2b40);})[_0x99ab('0x29')](function(_0x9e4751){_0x1de830[_0x99ab('0x52')]=_0x9e4751;return _0x1de830;});}})[_0x99ab('0x29')](respondWithFilteredResult(_0x19c5d1,_0x4b2b40))[_0x99ab('0x53')](handleError(_0x19c5d1,null));};exports[_0x99ab('0x6c')]=function(_0x45da58,_0x11bf37,_0x63e6a7){var _0x475a8d={'raw':!![],'where':{}};var _0x4ad5c1={};var _0x473b06={'count':0x0,'rows':[]};return db[_0x99ab('0x3b')]['findOne']({'where':{'id':_0x45da58[_0x99ab('0x55')]['id']}})[_0x99ab('0x29')](handleEntityNotFound(_0x11bf37,null))[_0x99ab('0x29')](function(_0x1dbff3){if(_0x1dbff3){_0x4ad5c1[_0x99ab('0x47')]=_[_0x99ab('0x41')](db[_0x99ab('0x6d')]['rawAttributes']);_0x4ad5c1['query']=_[_0x99ab('0x41')](_0x45da58[_0x99ab('0x40')]);_0x4ad5c1[_0x99ab('0x42')]=_['intersection'](_0x4ad5c1[_0x99ab('0x47')],_0x4ad5c1[_0x99ab('0x40')]);_0x475a8d[_0x99ab('0x44')]=_[_0x99ab('0x43')](_0x4ad5c1[_0x99ab('0x47')],qs[_0x99ab('0x45')](_0x45da58[_0x99ab('0x40')][_0x99ab('0x45')]));_0x475a8d[_0x99ab('0x44')]=_0x475a8d['attributes'][_0x99ab('0x46')]?_0x475a8d[_0x99ab('0x44')]:_0x4ad5c1[_0x99ab('0x47')];if(!_0x45da58[_0x99ab('0x40')][_0x99ab('0x66')](_0x99ab('0x48'))){_0x475a8d[_0x99ab('0x25')]=qs['limit'](_0x45da58['query']['limit']);_0x475a8d[_0x99ab('0x24')]=qs['offset'](_0x45da58[_0x99ab('0x40')]['offset']);}_0x475a8d['order']=qs[_0x99ab('0x4a')](_0x45da58[_0x99ab('0x40')][_0x99ab('0x4a')]);_0x475a8d[_0x99ab('0x4b')]=qs[_0x99ab('0x42')](_['pick'](_0x45da58[_0x99ab('0x40')],_0x4ad5c1[_0x99ab('0x42')]));_0x475a8d[_0x99ab('0x4b')][_0x99ab('0x68')]=_0x1dbff3['id'];if(_0x45da58[_0x99ab('0x40')][_0x99ab('0x2f')]){_0x475a8d['where']=_[_0x99ab('0x4c')](_0x475a8d[_0x99ab('0x4b')],{'$or':_[_0x99ab('0x31')](_0x475a8d[_0x99ab('0x44')],function(_0x44a896){var _0x213fc4={};_0x213fc4[_0x44a896]={'$like':'%'+_0x45da58[_0x99ab('0x40')][_0x99ab('0x2f')]+'%'};return _0x213fc4;})});}_0x475a8d=_[_0x99ab('0x4c')]({},_0x475a8d,_0x45da58[_0x99ab('0x4e')]);return db[_0x99ab('0x6d')][_0x99ab('0x23')]({'where':_0x475a8d[_0x99ab('0x4b')]})[_0x99ab('0x29')](function(_0x37b699){_0x473b06[_0x99ab('0x23')]=_0x37b699;if(_0x45da58[_0x99ab('0x40')][_0x99ab('0x4f')]){_0x475a8d['include']=[{'all':!![]}];}return db[_0x99ab('0x6d')][_0x99ab('0x51')](_0x475a8d);})['then'](function(_0x5c581b){_0x473b06[_0x99ab('0x52')]=_0x5c581b;return _0x473b06;});}})['then'](respondWithFilteredResult(_0x11bf37,_0x475a8d))[_0x99ab('0x53')](handleError(_0x11bf37,null));};exports[_0x99ab('0x6e')]=function(_0x198f25,_0x24215a,_0x38ff92){var _0x68b7b7={'raw':!![],'where':{}};var _0x3b5858={};var _0x3c58a0={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x99ab('0x6a')]({'where':{'id':_0x198f25['params']['id']}})[_0x99ab('0x29')](handleEntityNotFound(_0x24215a,null))['then'](function(_0x31d59b){if(_0x31d59b){_0x3b5858[_0x99ab('0x47')]=_[_0x99ab('0x41')](db[_0x99ab('0x6f')][_0x99ab('0x3c')]);_0x3b5858['query']=_[_0x99ab('0x41')](_0x198f25[_0x99ab('0x40')]);_0x3b5858[_0x99ab('0x42')]=_[_0x99ab('0x43')](_0x3b5858[_0x99ab('0x47')],_0x3b5858['query']);_0x68b7b7[_0x99ab('0x44')]=_['intersection'](_0x3b5858['model'],qs[_0x99ab('0x45')](_0x198f25[_0x99ab('0x40')]['fields']));_0x68b7b7['attributes']=_0x68b7b7['attributes'][_0x99ab('0x46')]?_0x68b7b7['attributes']:_0x3b5858[_0x99ab('0x47')];if(!_0x198f25[_0x99ab('0x40')][_0x99ab('0x66')](_0x99ab('0x48'))){_0x68b7b7[_0x99ab('0x25')]=qs[_0x99ab('0x25')](_0x198f25['query'][_0x99ab('0x25')]);_0x68b7b7[_0x99ab('0x24')]=qs['offset'](_0x198f25[_0x99ab('0x40')]['offset']);}_0x68b7b7['order']=qs[_0x99ab('0x4a')](_0x198f25[_0x99ab('0x40')]['sort']);_0x68b7b7[_0x99ab('0x4b')]=qs[_0x99ab('0x42')](_[_0x99ab('0x67')](_0x198f25[_0x99ab('0x40')],_0x3b5858['filters']));_0x68b7b7['where'][_0x99ab('0x68')]=_0x31d59b['id'];if(_0x198f25[_0x99ab('0x40')][_0x99ab('0x2f')]){_0x68b7b7['where']=_[_0x99ab('0x4c')](_0x68b7b7['where'],{'$or':_['map'](_0x68b7b7['attributes'],function(_0x421570){var _0x36495c={};_0x36495c[_0x421570]={'$like':'%'+_0x198f25['query'][_0x99ab('0x2f')]+'%'};return _0x36495c;})});}_0x68b7b7=_[_0x99ab('0x4c')]({},_0x68b7b7,_0x198f25[_0x99ab('0x4e')]);return db[_0x99ab('0x6f')]['count']({'where':_0x68b7b7['where']})[_0x99ab('0x29')](function(_0x8cc85c){_0x3c58a0[_0x99ab('0x23')]=_0x8cc85c;if(_0x198f25[_0x99ab('0x40')][_0x99ab('0x4f')]){_0x68b7b7[_0x99ab('0x50')]=[{'all':!![]}];}return db[_0x99ab('0x6f')][_0x99ab('0x51')](_0x68b7b7);})[_0x99ab('0x29')](function(_0x65a22f){_0x3c58a0[_0x99ab('0x52')]=_0x65a22f;return _0x3c58a0;});}})['then'](respondWithFilteredResult(_0x24215a,_0x68b7b7))[_0x99ab('0x53')](handleError(_0x24215a,null));};exports[_0x99ab('0x70')]=function(_0x341ea8,_0x51d364,_0x37db7a){var _0x47a942={};var _0x5d1e26={};var _0x5a733d;var _0xd51728;return db[_0x99ab('0x3b')][_0x99ab('0x6a')]({'where':{'id':_0x341ea8[_0x99ab('0x55')]['id']}})[_0x99ab('0x29')](handleEntityNotFound(_0x51d364,null))[_0x99ab('0x29')](function(_0x388eee){if(_0x388eee){_0x5a733d=_0x388eee;_0x5d1e26[_0x99ab('0x47')]=_[_0x99ab('0x41')](db[_0x99ab('0x71')][_0x99ab('0x3c')]);_0x5d1e26[_0x99ab('0x40')]=_[_0x99ab('0x41')](_0x341ea8[_0x99ab('0x40')]);_0x5d1e26[_0x99ab('0x42')]=_[_0x99ab('0x43')](_0x5d1e26[_0x99ab('0x47')],_0x5d1e26[_0x99ab('0x40')]);_0x47a942['attributes']=_['intersection'](_0x5d1e26[_0x99ab('0x47')],qs['fields'](_0x341ea8[_0x99ab('0x40')][_0x99ab('0x45')]));_0x47a942[_0x99ab('0x44')]=_0x47a942[_0x99ab('0x44')][_0x99ab('0x46')]?_0x47a942[_0x99ab('0x44')]:_0x5d1e26[_0x99ab('0x47')];_0x47a942['order']=qs[_0x99ab('0x4a')](_0x341ea8['query'][_0x99ab('0x4a')]);_0x47a942['where']=qs[_0x99ab('0x42')](_['pick'](_0x341ea8[_0x99ab('0x40')],_0x5d1e26[_0x99ab('0x42')]));if(_0x341ea8[_0x99ab('0x40')][_0x99ab('0x2f')]){_0x47a942[_0x99ab('0x4b')]=_[_0x99ab('0x4c')](_0x47a942[_0x99ab('0x4b')],{'$or':_[_0x99ab('0x31')](_0x47a942[_0x99ab('0x44')],function(_0x2eb546){var _0x3c7d3c={};_0x3c7d3c[_0x2eb546]={'$like':'%'+_0x341ea8[_0x99ab('0x40')][_0x99ab('0x2f')]+'%'};return _0x3c7d3c;})});}_0x47a942=_[_0x99ab('0x4c')]({},_0x47a942,_0x341ea8[_0x99ab('0x4e')]);return _0x5a733d['getTeams'](_0x47a942);}})[_0x99ab('0x29')](function(_0x16af3a){if(_0x16af3a){_0xd51728=_0x16af3a[_0x99ab('0x46')];if(!_0x341ea8[_0x99ab('0x40')]['hasOwnProperty'](_0x99ab('0x48'))){_0x47a942[_0x99ab('0x25')]=qs['limit'](_0x341ea8[_0x99ab('0x40')]['limit']);_0x47a942['offset']=qs[_0x99ab('0x24')](_0x341ea8[_0x99ab('0x40')][_0x99ab('0x24')]);}return _0x5a733d[_0x99ab('0x70')](_0x47a942);}})[_0x99ab('0x29')](function(_0x469e00){if(_0x469e00){return _0x469e00?{'count':_0xd51728,'rows':_0x469e00}:null;}})[_0x99ab('0x29')](respondWithResult(_0x51d364,null))[_0x99ab('0x53')](handleError(_0x51d364,null));};exports[_0x99ab('0x72')]=function(_0x4a3df5,_0x10d553,_0x3673e9){var _0x1477a7=_0x4a3df5['body'][_0x99ab('0x73')];var _0x2e650a=_[_0x99ab('0x31')](_0x1477a7,'id');return db[_0x99ab('0x71')]['findAll']({'where':{'id':_0x2e650a},'attributes':['id'],'include':[{'model':db[_0x99ab('0x74')],'as':_0x99ab('0x75'),'attributes':['id',_0x99ab('0x3f'),'online',_0x99ab('0x76'),_0x99ab('0x77')],'raw':!![]}]})[_0x99ab('0x29')](function(_0x131134){if(_0x131134){var _0x923bdb=_[_0x99ab('0x78')](_0x131134,function(_0x52ae3e){var _0x413c95=_0x52ae3e[_0x99ab('0x2a')]({'plain':!![]});_0x413c95[_0x99ab('0x75')][_0x99ab('0x79')](function(_0x1e673a){_0x1e673a['penalty']=_['find'](_0x1477a7,{'id':_0x413c95['id']})[_0x99ab('0x7a')];});return _0x413c95['Agents'];});return db[_0x99ab('0x3b')][_0x99ab('0x35')]({'where':{'id':_0x4a3df5[_0x99ab('0x55')]['id']}})['then'](function(_0x1fa172){return db[_0x99ab('0x7b')]['transaction'](function(_0x30968a){return _0x1fa172[_0x99ab('0x72')](_0x2e650a,{'transaction':_0x30968a})['then'](function(){return BPromise['each'](_0x1477a7,function(_0x21523d){return db[_0x99ab('0x7c')]['upsert']({'TeamId':_0x21523d['id'],'VoiceQueueId':_0x4a3df5[_0x99ab('0x55')]['id'],'penalty':_0x21523d['penalty']},{'transaction':_0x30968a});});})[_0x99ab('0x29')](function(){return BPromise[_0x99ab('0x7d')](_0x923bdb,function(_0x15808d){return db[_0x99ab('0x7e')]['findOrCreate']({'where':{'UserId':_0x15808d['id'],'VoiceQueueId':_0x4a3df5['params']['id']},'defaults':{'penalty':_0x15808d[_0x99ab('0x7a')]},'transaction':_0x30968a});});})[_0x99ab('0x29')](function(){return BPromise[_0x99ab('0x7d')](_[_0x99ab('0x2f')](_0x923bdb,{'online':!![]}),function(_0x2aa041){return db[_0x99ab('0x7f')][_0x99ab('0x80')]({'membername':_0x2aa041[_0x99ab('0x3f')],'UserId':_0x2aa041['id'],'queue_name':_0x1fa172[_0x99ab('0x3f')],'VoiceQueueId':_0x1fa172['id'],'interface':_[_0x99ab('0x81')](_0x2aa041[_0x99ab('0x77')])?util[_0x99ab('0x82')](_0x99ab('0x83'),_0x2aa041[_0x99ab('0x3f')]):_0x2aa041['interface'],'paused':_0x2aa041['voicePause']||![],'penalty':_0x2aa041[_0x99ab('0x7a')]},{'transaction':_0x30968a});});})[_0x99ab('0x29')](function(){_0x923bdb[_0x99ab('0x79')](function(_0x3654fa){socket[_0x99ab('0x84')](_0x99ab('0x85'),{'UserId':_0x3654fa['id'],'VoiceQueueId':_0x1fa172['id']});});});});});}})[_0x99ab('0x29')](respondWithStatusCode(_0x10d553,null))[_0x99ab('0x53')](handleError(_0x10d553,null));};exports[_0x99ab('0x86')]=function(_0x4b5da5,_0x2a69f8,_0xf95dce){return db[_0x99ab('0x71')][_0x99ab('0x51')]({'where':{'id':_0x4b5da5['query'][_0x99ab('0x87')]},'attributes':['id'],'include':[{'model':db[_0x99ab('0x74')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x99ab('0x29')](handleEntityNotFound(_0x2a69f8,null))[_0x99ab('0x29')](function(_0x453cc5){var _0xef87c=_[_0x99ab('0x31')](_0x453cc5,'id');var _0x65a389=[];var _0x45aa1c=[];var _0x2c5ad8=squel[_0x99ab('0x88')]();_0x2c5ad8[_0x99ab('0x89')](_0x99ab('0x8a'))[_0x99ab('0x8b')](_0x99ab('0x8c'),'tq')[_0x99ab('0x8d')](_0x99ab('0x8e'),'ut',_0x99ab('0x8f'))[_0x99ab('0x4b')]('VoiceQueueId\x20=\x20?',_0x4b5da5['params']['id']);for(var _0x4641f8=0x0;_0x4641f8<_0x453cc5[_0x99ab('0x46')];_0x4641f8+=0x1){let _0x1a082c=_0x453cc5[_0x4641f8];for(var _0x96e23=0x0;_0x96e23<_0x1a082c[_0x99ab('0x75')][_0x99ab('0x46')];_0x96e23+=0x1){let _0xd72e60=_0x1a082c[_0x99ab('0x75')][_0x96e23];var _0xb40ceb=_0x2c5ad8[_0x99ab('0x5f')]();_0xb40ceb['where'](_0x99ab('0x90'),_0xd72e60['id']);_0x45aa1c['push'](db[_0x99ab('0x7b')]['query'](_0xb40ceb['toString'](),{'type':db[_0x99ab('0x7b')]['QueryTypes'][_0x99ab('0x91')]})[_0x99ab('0x29')](function(_0x28ad32){if(_0x28ad32[_0x99ab('0x46')]===0x1){return _0xd72e60['id'];}else{var _0x33c5f9=_[_0x99ab('0x92')](_['map'](_0x28ad32,'TeamId'),function(_0x10e52d){return _['includes'](_0xef87c,_0x10e52d);});if(_0x33c5f9){return _0xd72e60['id'];}}}));}}return BPromise[_0x99ab('0x93')](_0x45aa1c)[_0x99ab('0x29')](function(_0x49d52d){_0x65a389=_(_0x65a389)[_0x99ab('0x94')](_0x49d52d)['compact']()[_0x99ab('0x32')]();return db[_0x99ab('0x3b')][_0x99ab('0x35')]({'where':{'id':_0x4b5da5[_0x99ab('0x55')]['id']}})[_0x99ab('0x29')](function(_0xcfd8a9){return db[_0x99ab('0x7b')][_0x99ab('0x95')](function(_0x254452){return _0xcfd8a9[_0x99ab('0x86')](_0x4b5da5[_0x99ab('0x40')]['ids'],{'transaction':_0x254452})[_0x99ab('0x29')](function(){if(!_['isEmpty'](_0x65a389)){return _0xcfd8a9['removeAgents'](_0x65a389,{'transaction':_0x254452})[_0x99ab('0x29')](function(){return db[_0x99ab('0x7f')]['destroy']({'where':{'VoiceQueueId':_0x4b5da5['params']['id'],'UserId':_0x65a389},'transaction':_0x254452});});}})[_0x99ab('0x29')](function(){_0x65a389['forEach'](function(_0x2a822a){socket['emit'](_0x99ab('0x96'),{'UserId':_0x2a822a,'VoiceQueueId':_0xcfd8a9['id']});});});});});});})[_0x99ab('0x29')](respondWithStatusCode(_0x2a69f8,null))[_0x99ab('0x53')](handleError(_0x2a69f8,null));};exports[_0x99ab('0x97')]=function(_0x33498f,_0x236124,_0x583843){var _0x1ffddf,_0x28ece3;return db['VoiceQueue'][_0x99ab('0x35')]({'where':{'id':_0x33498f[_0x99ab('0x55')]['id']}})[_0x99ab('0x29')](handleEntityNotFound(_0x236124,null))[_0x99ab('0x29')](function(_0x40bc73){if(_0x40bc73){_0x28ece3=_0x40bc73;return _0x40bc73[_0x99ab('0x97')](_0x33498f[_0x99ab('0x57')][_0x99ab('0x87')],_[_0x99ab('0x60')](_0x33498f[_0x99ab('0x57')],[_0x99ab('0x87'),'id'])||{})[_0x99ab('0x98')](function(_0x6749ed){for(var _0x5f543d=0x0;_0x5f543d<_0x33498f[_0x99ab('0x57')][_0x99ab('0x87')][_0x99ab('0x46')];_0x5f543d+=0x1){socket[_0x99ab('0x84')](_0x99ab('0x85'),{'UserId':_0x33498f[_0x99ab('0x57')][_0x99ab('0x87')][_0x5f543d],'VoiceQueueId':_0x33498f[_0x99ab('0x55')]['id']});}return _0x6749ed;});}})[_0x99ab('0x29')](function(_0x536f00){_0x1ffddf=_0x536f00||[];if(_0x28ece3){return db['User'][_0x99ab('0x51')]({'where':{'id':_0x33498f[_0x99ab('0x57')][_0x99ab('0x87')]},'attributes':['id',_0x99ab('0x3f'),_0x99ab('0x99'),_0x99ab('0x76'),_0x99ab('0x77')],'raw':!![]});}})[_0x99ab('0x29')](function(_0x2ef4b2){if(!_[_0x99ab('0x9a')](_0x2ef4b2)){var _0x2ebeb6=[];for(var _0x12cba7=0x0;_0x12cba7<_0x2ef4b2[_0x99ab('0x46')];_0x12cba7++){if(_0x2ef4b2[_0x12cba7][_0x99ab('0x99')]){_0x2ebeb6[_0x99ab('0x9b')](db[_0x99ab('0x7f')][_0x99ab('0x80')]({'membername':_0x2ef4b2[_0x12cba7]['name'],'UserId':_0x2ef4b2[_0x12cba7]['id'],'queue_name':_0x28ece3['name'],'VoiceQueueId':_0x28ece3['id'],'interface':_[_0x99ab('0x81')](_0x2ef4b2[_0x12cba7][_0x99ab('0x77')])?util[_0x99ab('0x82')](_0x99ab('0x83'),_0x2ef4b2[_0x12cba7][_0x99ab('0x3f')]):_0x2ef4b2[_0x12cba7][_0x99ab('0x77')],'paused':_0x2ef4b2[_0x12cba7]['voicePause']||![],'penalty':_0x33498f[_0x99ab('0x57')]['penalty']||0x0}));}}return BPromise['all'](_0x2ebeb6);}})[_0x99ab('0x29')](function(){return _0x1ffddf;})['then'](respondWithResult(_0x236124,null))[_0x99ab('0x53')](handleError(_0x236124,null));};exports['removeAgents']=function(_0x455847,_0x42bedb,_0x43d79d){return db[_0x99ab('0x3b')]['find']({'where':{'id':_0x455847[_0x99ab('0x55')]['id']}})[_0x99ab('0x29')](handleEntityNotFound(_0x42bedb,null))['then'](function(_0x5ecf2c){if(_0x5ecf2c){return _0x5ecf2c['removeAgents'](_0x455847[_0x99ab('0x40')][_0x99ab('0x87')])[_0x99ab('0x29')](function(){if(_[_0x99ab('0x9c')](_0x455847['query'][_0x99ab('0x87')])){for(var _0x4bf2e6=0x0;_0x4bf2e6<_0x455847[_0x99ab('0x40')]['ids'][_0x99ab('0x46')];_0x4bf2e6+=0x1){socket[_0x99ab('0x84')](_0x99ab('0x96'),{'UserId':Number(_0x455847[_0x99ab('0x40')]['ids'][_0x4bf2e6]),'VoiceQueueId':Number(_0x455847[_0x99ab('0x55')]['id'])});}}else{socket[_0x99ab('0x84')]('userVoiceQueue:remove',{'UserId':Number(_0x455847[_0x99ab('0x40')]['ids']),'VoiceQueueId':Number(_0x455847[_0x99ab('0x55')]['id'])});}});}})[_0x99ab('0x29')](function(_0x225063){return db[_0x99ab('0x7f')]['destroy']({'where':{'VoiceQueueId':_0x455847['params']['id'],'UserId':_0x455847['query'][_0x99ab('0x87')]}})[_0x99ab('0x29')](function(){return _0x225063;});})[_0x99ab('0x29')](respondWithStatusCode(_0x42bedb,null))[_0x99ab('0x53')](handleError(_0x42bedb,null));};exports[_0x99ab('0x9d')]=function(_0x1e532f,_0x34797f,_0x5914e9){var _0x3023f7={};var _0x2411c8={};var _0x38f165;var _0x2bb6b7;return db[_0x99ab('0x3b')][_0x99ab('0x6a')]({'where':{'id':_0x1e532f[_0x99ab('0x55')]['id']}})['then'](handleEntityNotFound(_0x34797f,null))[_0x99ab('0x29')](function(_0x33d70d){if(_0x33d70d){_0x38f165=_0x33d70d;_0x2411c8[_0x99ab('0x47')]=_[_0x99ab('0x41')](db[_0x99ab('0x74')][_0x99ab('0x3c')]);_0x2411c8['query']=_['keys'](_0x1e532f[_0x99ab('0x40')]);_0x2411c8[_0x99ab('0x42')]=_[_0x99ab('0x43')](_0x2411c8['model'],_0x2411c8[_0x99ab('0x40')]);_0x3023f7[_0x99ab('0x44')]=_[_0x99ab('0x43')](_0x2411c8[_0x99ab('0x47')],qs[_0x99ab('0x45')](_0x1e532f[_0x99ab('0x40')][_0x99ab('0x45')]));_0x3023f7[_0x99ab('0x44')]=_0x3023f7[_0x99ab('0x44')]['length']?_0x3023f7[_0x99ab('0x44')]:_0x2411c8['model'];_0x3023f7[_0x99ab('0x49')]=qs[_0x99ab('0x4a')](_0x1e532f[_0x99ab('0x40')][_0x99ab('0x4a')]);_0x3023f7['where']=qs[_0x99ab('0x42')](_[_0x99ab('0x67')](_0x1e532f[_0x99ab('0x40')],_0x2411c8[_0x99ab('0x42')]));if(_0x1e532f[_0x99ab('0x40')]['filter']){_0x3023f7[_0x99ab('0x4b')]=_[_0x99ab('0x4c')](_0x3023f7[_0x99ab('0x4b')],{'$or':_[_0x99ab('0x31')](_0x3023f7['attributes'],function(_0x1bf119){var _0x25bbff={};_0x25bbff[_0x1bf119]={'$like':'%'+_0x1e532f['query']['filter']+'%'};return _0x25bbff;})});}_0x3023f7=_[_0x99ab('0x4c')]({},_0x3023f7,_0x1e532f[_0x99ab('0x4e')]);return _0x38f165[_0x99ab('0x9d')](_0x3023f7);}})[_0x99ab('0x29')](function(_0x2ff4e5){if(_0x2ff4e5){_0x2bb6b7=_0x2ff4e5[_0x99ab('0x46')];if(!_0x1e532f['query'][_0x99ab('0x66')](_0x99ab('0x48'))){_0x3023f7[_0x99ab('0x25')]=qs['limit'](_0x1e532f[_0x99ab('0x40')]['limit']);_0x3023f7[_0x99ab('0x24')]=qs[_0x99ab('0x24')](_0x1e532f[_0x99ab('0x40')]['offset']);}return _0x38f165['getAgents'](_0x3023f7);}})[_0x99ab('0x29')](function(_0xf783dc){if(_0xf783dc){return _0xf783dc?{'count':_0x2bb6b7,'rows':_0xf783dc}:null;}})[_0x99ab('0x29')](respondWithResult(_0x34797f,null))['catch'](handleError(_0x34797f,null));};exports[_0x99ab('0x9e')]=function(_0x548012,_0x2118d3,_0x22a6b6){var _0x401ac9={};var _0x1bca05={};var _0x2d0cb1;var _0x89243d;return db[_0x99ab('0x3b')][_0x99ab('0x6a')]({'where':{'id':_0x548012[_0x99ab('0x55')]['id']}})[_0x99ab('0x29')](handleEntityNotFound(_0x2118d3,null))[_0x99ab('0x29')](function(_0x260a1e){if(_0x260a1e){_0x2d0cb1=_0x260a1e;_0x1bca05[_0x99ab('0x47')]=_['keys'](db[_0x99ab('0x7f')]['rawAttributes']);_0x1bca05[_0x99ab('0x40')]=_[_0x99ab('0x41')](_0x548012[_0x99ab('0x40')]);_0x1bca05[_0x99ab('0x42')]=_[_0x99ab('0x43')](_0x1bca05[_0x99ab('0x47')],_0x1bca05['query']);_0x401ac9[_0x99ab('0x44')]=_['intersection'](_0x1bca05[_0x99ab('0x47')],qs[_0x99ab('0x45')](_0x548012[_0x99ab('0x40')][_0x99ab('0x45')]));_0x401ac9[_0x99ab('0x44')]=_0x401ac9[_0x99ab('0x44')][_0x99ab('0x46')]?_0x401ac9[_0x99ab('0x44')]:_0x1bca05[_0x99ab('0x47')];_0x401ac9[_0x99ab('0x49')]=qs['sort'](_0x548012['query'][_0x99ab('0x4a')]);_0x401ac9[_0x99ab('0x4b')]=qs[_0x99ab('0x42')](_['pick'](_0x548012['query'],_0x1bca05['filters']));if(_0x548012[_0x99ab('0x40')][_0x99ab('0x2f')]){_0x401ac9['where']=_[_0x99ab('0x4c')](_0x401ac9['where'],{'$or':_[_0x99ab('0x31')](_0x401ac9[_0x99ab('0x44')],function(_0x2d15f5){var _0xcf9ee9={};_0xcf9ee9[_0x2d15f5]={'$like':'%'+_0x548012[_0x99ab('0x40')][_0x99ab('0x2f')]+'%'};return _0xcf9ee9;})});}_0x401ac9=_[_0x99ab('0x4c')]({},_0x401ac9,_0x548012[_0x99ab('0x4e')]);return _0x2d0cb1[_0x99ab('0x9e')](_0x401ac9);}})[_0x99ab('0x29')](function(_0x4f36ed){if(_0x4f36ed){_0x89243d=_0x4f36ed[_0x99ab('0x46')];if(!_0x548012['query'][_0x99ab('0x66')](_0x99ab('0x48'))){_0x401ac9['limit']=qs[_0x99ab('0x25')](_0x548012['query']['limit']);_0x401ac9['offset']=qs['offset'](_0x548012[_0x99ab('0x40')][_0x99ab('0x24')]);}return _0x2d0cb1[_0x99ab('0x9e')](_0x401ac9);}})[_0x99ab('0x29')](function(_0x1c0598){return _0x1c0598?{'count':_0x89243d,'rows':_0x1c0598}:null;})[_0x99ab('0x29')](respondWithResult(_0x2118d3,null))[_0x99ab('0x53')](handleError(_0x2118d3,null));};exports['getLists']=function(_0x45b14d,_0x141765,_0x454f4e){var _0x15070e={};var _0x76e812={};var _0x30de6c;var _0x35e29f;return db['VoiceQueue'][_0x99ab('0x6a')]({'where':{'id':_0x45b14d[_0x99ab('0x55')]['id']}})[_0x99ab('0x29')](handleEntityNotFound(_0x141765,null))[_0x99ab('0x29')](function(_0x57fc5d){if(_0x57fc5d){_0x30de6c=_0x57fc5d;_0x76e812['model']=_[_0x99ab('0x41')](db['CmList']['rawAttributes']);_0x76e812[_0x99ab('0x40')]=_['keys'](_0x45b14d[_0x99ab('0x40')]);_0x76e812['filters']=_[_0x99ab('0x43')](_0x76e812[_0x99ab('0x47')],_0x76e812[_0x99ab('0x40')]);_0x15070e[_0x99ab('0x44')]=_[_0x99ab('0x43')](_0x76e812[_0x99ab('0x47')],qs[_0x99ab('0x45')](_0x45b14d[_0x99ab('0x40')][_0x99ab('0x45')]));_0x15070e[_0x99ab('0x44')]=_0x15070e[_0x99ab('0x44')]['length']?_0x15070e['attributes']:_0x76e812['model'];_0x15070e['order']=qs['sort'](_0x45b14d[_0x99ab('0x40')][_0x99ab('0x4a')]);_0x15070e[_0x99ab('0x4b')]=qs[_0x99ab('0x42')](_[_0x99ab('0x67')](_0x45b14d['query'],_0x76e812[_0x99ab('0x42')]));if(_0x45b14d[_0x99ab('0x40')][_0x99ab('0x2f')]){_0x15070e['where']=_[_0x99ab('0x4c')](_0x15070e[_0x99ab('0x4b')],{'$or':_[_0x99ab('0x31')](_0x15070e[_0x99ab('0x44')],function(_0x233285){var _0x13fb6d={};_0x13fb6d[_0x233285]={'$like':'%'+_0x45b14d['query'][_0x99ab('0x2f')]+'%'};return _0x13fb6d;})});}_0x15070e=_[_0x99ab('0x4c')]({},_0x15070e,_0x45b14d[_0x99ab('0x4e')]);return _0x30de6c[_0x99ab('0x9f')](_0x15070e);}})[_0x99ab('0x29')](function(_0x174cd3){if(_0x174cd3){_0x35e29f=_0x174cd3[_0x99ab('0x46')];if(!_0x45b14d['query'][_0x99ab('0x66')](_0x99ab('0x48'))){_0x15070e['limit']=qs[_0x99ab('0x25')](_0x45b14d[_0x99ab('0x40')]['limit']);_0x15070e[_0x99ab('0x24')]=qs['offset'](_0x45b14d[_0x99ab('0x40')]['offset']);}return _0x30de6c[_0x99ab('0x9f')](_0x15070e);}})[_0x99ab('0x29')](function(_0x24a59a){if(_0x24a59a){return _0x24a59a?{'count':_0x35e29f,'rows':_0x24a59a}:null;}})[_0x99ab('0x29')](respondWithResult(_0x141765,null))[_0x99ab('0x53')](handleError(_0x141765,null));};exports[_0x99ab('0xa0')]=function(_0x1f3040,_0x7ca27e,_0x1fe0af){var _0x5464b1,_0x3a6322;return db[_0x99ab('0x3b')]['find']({'where':{'id':_0x1f3040[_0x99ab('0x55')]['id']}})['then'](handleEntityNotFound(_0x7ca27e,null))[_0x99ab('0x29')](function(_0x2bb53b){if(_0x2bb53b){_0x3a6322=_0x2bb53b;return _0x2bb53b[_0x99ab('0xa0')](_0x1f3040[_0x99ab('0x57')][_0x99ab('0x87')],_[_0x99ab('0x60')](_0x1f3040[_0x99ab('0x57')],['ids','id'])||{});}return null;})[_0x99ab('0x98')](function(_0x1bf34d){var _0x7c4c12;_0x5464b1=_0x1bf34d||[];var _0x37a554=[];if(_0x1bf34d){for(var _0x3d1f19=0x0;_0x3d1f19<_0x1bf34d['length'];_0x3d1f19+=0x1){var _0x1bd031=_0x1bf34d[_0x3d1f19][_0x99ab('0x2a')]({'plain':!![]});_0x3a6322[_0x99ab('0xa1')]=_0x1f3040['body'][_0x99ab('0xa1')]?_0x1f3040[_0x99ab('0x57')][_0x99ab('0xa1')]:_0x3a6322[_0x99ab('0xa1')];switch(_0x3a6322['dialCheckDuplicateType']){case _0x99ab('0xa2'):_0x7c4c12=squel[_0x99ab('0xa3')]()[_0x99ab('0xa4')]('cm_hopper')[_0x99ab('0xa5')]([_0x99ab('0xa6'),_0x99ab('0xa7'),'ContactId',_0x99ab('0xa8'),_0x99ab('0x68'),_0x99ab('0x61'),'updatedAt'],squel[_0x99ab('0x88')]()[_0x99ab('0x89')]('phone',_0x99ab('0xa6'))[_0x99ab('0x89')](_0x99ab('0xa9'),_0x99ab('0xa7'))[_0x99ab('0x89')]('id',_0x99ab('0xaa'))[_0x99ab('0x89')](_0x1bd031[_0x99ab('0xab')]['toString'](),_0x99ab('0xa8'))[_0x99ab('0x89')](_0x1f3040[_0x99ab('0x55')]['id'][_0x99ab('0xac')](),_0x99ab('0x68'))[_0x99ab('0x89')](_0x99ab('0xa9'),'createdAt')[_0x99ab('0x89')](_0x99ab('0xa9'),_0x99ab('0x62'))[_0x99ab('0x8b')](_0x99ab('0xad'))['where']('deletedAt\x20IS\x20NULL')[_0x99ab('0x4b')]('ListId\x20=\x20?',_0x1bd031[_0x99ab('0xab')][_0x99ab('0xac')]())[_0x99ab('0x4b')]('phone\x20IS\x20NOT\x20NULL')[_0x99ab('0x4b')](_0x99ab('0xae'),squel[_0x99ab('0x88')]()[_0x99ab('0x89')]('COALESCE(calleridnum,\x27\x27)')[_0x99ab('0x8b')]('cm_hopper_final')[_0x99ab('0x4b')]('VoiceQueueId\x20=\x20?',_0x1f3040[_0x99ab('0x55')]['id'][_0x99ab('0xac')]()))[_0x99ab('0x4b')](_0x99ab('0xae'),squel[_0x99ab('0x88')]()[_0x99ab('0x89')]('COALESCE(phone,\x27\x27)')[_0x99ab('0x8b')]('cm_hopper')[_0x99ab('0x4b')](_0x99ab('0xaf'),_0x1f3040[_0x99ab('0x55')]['id']['toString']())))[_0x99ab('0xac')]();break;case _0x99ab('0xb0'):_0x7c4c12=squel[_0x99ab('0xa3')]()[_0x99ab('0xa4')](_0x99ab('0xb1'))[_0x99ab('0xa5')]([_0x99ab('0xa6'),_0x99ab('0xa7'),'ContactId',_0x99ab('0xa8'),_0x99ab('0x68'),_0x99ab('0x61'),_0x99ab('0x62')],squel[_0x99ab('0x88')]()[_0x99ab('0x89')](_0x99ab('0xa6'),'phone')[_0x99ab('0x89')](_0x99ab('0xa9'),_0x99ab('0xa7'))[_0x99ab('0x89')]('id',_0x99ab('0xaa'))['field'](_0x1bd031['CmListId'][_0x99ab('0xac')](),_0x99ab('0xa8'))[_0x99ab('0x89')](_0x1f3040[_0x99ab('0x55')]['id'][_0x99ab('0xac')](),'VoiceQueueId')[_0x99ab('0x89')](_0x99ab('0xa9'),_0x99ab('0x61'))[_0x99ab('0x89')](_0x99ab('0xa9'),_0x99ab('0x62'))[_0x99ab('0x8b')](_0x99ab('0xad'))['where'](_0x99ab('0xb2'))[_0x99ab('0x4b')](_0x99ab('0xb3'),_0x1bd031[_0x99ab('0xab')][_0x99ab('0xac')]())['where'](_0x99ab('0xb4'))[_0x99ab('0x4b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x99ab('0x88')]()[_0x99ab('0x89')](_0x99ab('0xb5'))[_0x99ab('0x8b')](_0x99ab('0xb1'))['where'](_0x99ab('0xaf'),_0x1f3040[_0x99ab('0x55')]['id']['toString']())))[_0x99ab('0xac')]();break;default:_0x7c4c12=squel[_0x99ab('0xa3')]()[_0x99ab('0xa4')]('cm_hopper')[_0x99ab('0xa5')]([_0x99ab('0xa6'),_0x99ab('0xa7'),_0x99ab('0xaa'),_0x99ab('0xa8'),_0x99ab('0x68'),'createdAt','updatedAt'],squel['select']()[_0x99ab('0x89')](_0x99ab('0xa6'),_0x99ab('0xa6'))[_0x99ab('0x89')](_0x99ab('0xa9'),_0x99ab('0xa7'))[_0x99ab('0x89')]('id',_0x99ab('0xaa'))[_0x99ab('0x89')](_0x1bd031[_0x99ab('0xab')][_0x99ab('0xac')](),_0x99ab('0xa8'))[_0x99ab('0x89')](_0x1f3040[_0x99ab('0x55')]['id'][_0x99ab('0xac')](),_0x99ab('0x68'))[_0x99ab('0x89')](_0x99ab('0xa9'),_0x99ab('0x61'))[_0x99ab('0x89')](_0x99ab('0xa9'),'updatedAt')[_0x99ab('0x8b')](_0x99ab('0xad'))[_0x99ab('0x4b')]('deletedAt\x20IS\x20NULL')[_0x99ab('0x4b')](_0x99ab('0xb3'),_0x1bd031[_0x99ab('0xab')][_0x99ab('0xac')]())['where'](_0x99ab('0xb4')))[_0x99ab('0xac')]();}_0x37a554['push'](db[_0x99ab('0x7b')][_0x99ab('0x40')](_0x7c4c12));}return BPromise['all'](_0x37a554);}})[_0x99ab('0x29')](function(){return _0x5464b1;})[_0x99ab('0x29')](respondWithResult(_0x7ca27e,null))['catch'](handleError(_0x7ca27e,null));};exports[_0x99ab('0xb6')]=function(_0x52e1a7,_0xb2b2b7,_0x554a22){return db['VoiceQueue'][_0x99ab('0x35')]({'where':{'id':_0x52e1a7[_0x99ab('0x55')]['id']}})[_0x99ab('0x29')](handleEntityNotFound(_0xb2b2b7,null))[_0x99ab('0x29')](function(_0x1e4024){if(_0x1e4024){return _0x1e4024[_0x99ab('0xb6')](_0x52e1a7[_0x99ab('0x40')][_0x99ab('0x87')]);}})[_0x99ab('0x29')](function(_0x493919){if(_0x493919){return db[_0x99ab('0x65')][_0x99ab('0x36')]({'where':{'ListId':_0x52e1a7[_0x99ab('0x40')][_0x99ab('0x87')],'VoiceQueueId':_0x52e1a7['params']['id']}})[_0x99ab('0x29')](function(){return _0x493919;});}})[_0x99ab('0x29')](respondWithStatusCode(_0xb2b2b7,null))[_0x99ab('0x53')](handleError(_0xb2b2b7,null));};exports[_0x99ab('0xb7')]=function(_0x29c956,_0x5db0c6,_0x1cd46a){var _0x33f2e7={};var _0x32074e={};var _0x431da5;var _0x2f6273;return db[_0x99ab('0x3b')][_0x99ab('0x6a')]({'where':{'id':_0x29c956['params']['id']}})['then'](handleEntityNotFound(_0x5db0c6,null))[_0x99ab('0x29')](function(_0x2c15b4){if(_0x2c15b4){_0x431da5=_0x2c15b4;_0x32074e['model']=_['keys'](db['CmList']['rawAttributes']);_0x32074e[_0x99ab('0x40')]=_[_0x99ab('0x41')](_0x29c956[_0x99ab('0x40')]);_0x32074e[_0x99ab('0x42')]=_[_0x99ab('0x43')](_0x32074e[_0x99ab('0x47')],_0x32074e[_0x99ab('0x40')]);_0x33f2e7[_0x99ab('0x44')]=_[_0x99ab('0x43')](_0x32074e[_0x99ab('0x47')],qs[_0x99ab('0x45')](_0x29c956[_0x99ab('0x40')][_0x99ab('0x45')]));_0x33f2e7[_0x99ab('0x44')]=_0x33f2e7[_0x99ab('0x44')][_0x99ab('0x46')]?_0x33f2e7[_0x99ab('0x44')]:_0x32074e['model'];_0x33f2e7[_0x99ab('0x49')]=qs[_0x99ab('0x4a')](_0x29c956[_0x99ab('0x40')][_0x99ab('0x4a')]);_0x33f2e7[_0x99ab('0x4b')]=qs[_0x99ab('0x42')](_['pick'](_0x29c956[_0x99ab('0x40')],_0x32074e[_0x99ab('0x42')]));if(_0x29c956[_0x99ab('0x40')][_0x99ab('0x2f')]){_0x33f2e7['where']=_[_0x99ab('0x4c')](_0x33f2e7[_0x99ab('0x4b')],{'$or':_[_0x99ab('0x31')](_0x33f2e7[_0x99ab('0x44')],function(_0x243b5c){var _0x56d550={};_0x56d550[_0x243b5c]={'$like':'%'+_0x29c956[_0x99ab('0x40')]['filter']+'%'};return _0x56d550;})});}_0x33f2e7=_[_0x99ab('0x4c')]({},_0x33f2e7,_0x29c956[_0x99ab('0x4e')]);return _0x431da5[_0x99ab('0xb7')](_0x33f2e7);}})[_0x99ab('0x29')](function(_0x23f72a){if(_0x23f72a){_0x2f6273=_0x23f72a[_0x99ab('0x46')];if(!_0x29c956[_0x99ab('0x40')][_0x99ab('0x66')](_0x99ab('0x48'))){_0x33f2e7['limit']=qs[_0x99ab('0x25')](_0x29c956['query']['limit']);_0x33f2e7[_0x99ab('0x24')]=qs[_0x99ab('0x24')](_0x29c956['query'][_0x99ab('0x24')]);}return _0x431da5[_0x99ab('0xb7')](_0x33f2e7);}})[_0x99ab('0x29')](function(_0x446a17){if(_0x446a17){return _0x446a17?{'count':_0x2f6273,'rows':_0x446a17}:null;}})[_0x99ab('0x29')](respondWithResult(_0x5db0c6,null))[_0x99ab('0x53')](handleError(_0x5db0c6,null));};exports[_0x99ab('0xb8')]=function(_0x1a99d4,_0xb87da,_0x55177d){var _0x273e9e,_0x4fce5d;return db['VoiceQueue']['find']({'where':{'id':_0x1a99d4[_0x99ab('0x55')]['id']}})[_0x99ab('0x29')](handleEntityNotFound(_0xb87da,null))[_0x99ab('0x29')](function(_0x56468d){if(_0x56468d){_0x4fce5d=_0x56468d;return _0x56468d[_0x99ab('0xb8')](_0x1a99d4[_0x99ab('0x57')][_0x99ab('0x87')],_[_0x99ab('0x60')](_0x1a99d4[_0x99ab('0x57')],[_0x99ab('0x87'),'id'])||{});}return null;})[_0x99ab('0x98')](function(_0x4dcd59){var _0x41a3ec;_0x273e9e=_0x4dcd59||[];var _0x19e11c=[];if(_0x4dcd59){for(var _0x2e6504=0x0;_0x2e6504<_0x4dcd59[_0x99ab('0x46')];_0x2e6504+=0x1){var _0x5eee34=_0x4dcd59[_0x2e6504][_0x99ab('0x2a')]({'plain':!![]});_0x41a3ec=squel['insert']()[_0x99ab('0xa4')](_0x99ab('0xb9'))[_0x99ab('0xa5')]([_0x99ab('0xa6'),'ContactId',_0x99ab('0xa8'),_0x99ab('0x68'),_0x99ab('0x61'),_0x99ab('0x62')],squel[_0x99ab('0x88')]()[_0x99ab('0x89')](_0x99ab('0xa6'),_0x99ab('0xa6'))[_0x99ab('0x89')]('id',_0x99ab('0xaa'))[_0x99ab('0x89')](_0x5eee34[_0x99ab('0xab')]['toString'](),_0x99ab('0xa8'))['field'](_0x1a99d4[_0x99ab('0x55')]['id'][_0x99ab('0xac')](),_0x99ab('0x68'))[_0x99ab('0x89')](_0x99ab('0xa9'),'createdAt')[_0x99ab('0x89')]('NOW()',_0x99ab('0x62'))[_0x99ab('0x8b')]('cm_contacts')[_0x99ab('0x4b')](_0x99ab('0xb2'))[_0x99ab('0x4b')]('ListId\x20=\x20?',_0x5eee34[_0x99ab('0xab')][_0x99ab('0xac')]())[_0x99ab('0x4b')]('phone\x20IS\x20NOT\x20NULL'))[_0x99ab('0xac')]();_0x19e11c[_0x99ab('0x9b')](db[_0x99ab('0x7b')][_0x99ab('0x40')](_0x41a3ec));}return BPromise[_0x99ab('0x93')](_0x19e11c);}})[_0x99ab('0x29')](function(){return _0x273e9e;})[_0x99ab('0x29')](respondWithResult(_0xb87da,null))[_0x99ab('0x53')](handleError(_0xb87da,null));};exports['removeBlackLists']=function(_0x18dc5f,_0x2cbd65,_0x21db39){return db[_0x99ab('0x3b')][_0x99ab('0x35')]({'where':{'id':_0x18dc5f[_0x99ab('0x55')]['id']}})[_0x99ab('0x29')](handleEntityNotFound(_0x2cbd65,null))[_0x99ab('0x29')](function(_0x2ea998){if(_0x2ea998){return _0x2ea998['removeBlackLists'](_0x18dc5f[_0x99ab('0x40')][_0x99ab('0x87')]);}})[_0x99ab('0x29')](function(_0x18e1fc){if(_0x18e1fc){return db['CmHopperBlack'][_0x99ab('0x36')]({'where':{'ListId':_0x18dc5f[_0x99ab('0x40')][_0x99ab('0x87')],'VoiceQueueId':_0x18dc5f[_0x99ab('0x55')]['id']}})['then'](function(){return _0x18e1fc;});}})[_0x99ab('0x29')](respondWithStatusCode(_0x2cbd65,null))[_0x99ab('0x53')](handleError(_0x2cbd65,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 1e32c55..8172c71 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 _0xbf02=['events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x136290,_0x3e6b8f){var _0x290e92=function(_0x4095d6){while(--_0x4095d6){_0x136290['push'](_0x136290['shift']());}};_0x290e92(++_0x3e6b8f);}(_0xbf02,0x176));var _0x2bf0=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xbf02[_0x243b59];return _0x3e1676;};'use strict';var EventEmitter=require(_0x2bf0('0x0'));var VoiceQueue=require(_0x2bf0('0x1'))['db'][_0x2bf0('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x2bf0('0x3')](0x0);var events={'afterCreate':_0x2bf0('0x4'),'afterUpdate':_0x2bf0('0x5'),'afterDestroy':_0x2bf0('0x6')};function emitEvent(_0x237571){return function(_0x227016,_0x524c98,_0x522c43){VoiceQueueEvents[_0x2bf0('0x7')](_0x237571+':'+_0x227016['id'],_0x227016);VoiceQueueEvents[_0x2bf0('0x7')](_0x237571,_0x227016);_0x522c43(null);};}for(var e in events){if(events[_0x2bf0('0x8')](e)){var event=events[e];VoiceQueue[_0x2bf0('0x9')](e,emitEvent(event));}}module[_0x2bf0('0xa')]=VoiceQueueEvents; \ No newline at end of file +var _0x00ba=['../../mysqldb','VoiceQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x18e93d,_0x296082){var _0x15ee08=function(_0x4afacf){while(--_0x4afacf){_0x18e93d['push'](_0x18e93d['shift']());}};_0x15ee08(++_0x296082);}(_0x00ba,0x18f));var _0xa00b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x00ba[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xa00b('0x0'));var VoiceQueue=require(_0xa00b('0x1'))['db'][_0xa00b('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xa00b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa00b('0x4'),'afterDestroy':_0xa00b('0x5')};function emitEvent(_0x1aea9c){return function(_0x320004,_0x166846,_0x2152e9){VoiceQueueEvents[_0xa00b('0x6')](_0x1aea9c+':'+_0x320004['id'],_0x320004);VoiceQueueEvents['emit'](_0x1aea9c,_0x320004);_0x2152e9(null);};}for(var e in events){if(events[_0xa00b('0x7')](e)){var event=events[e];VoiceQueue[_0xa00b('0x8')](e,emitEvent(event));}}module[_0xa00b('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 0492bb3..d2aa0ab 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 _0x1f96=['rimraf','../../config/environment','./voiceQueue.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x1b0643,_0x2a782f){var _0x215609=function(_0x466756){while(--_0x466756){_0x1b0643['push'](_0x1b0643['shift']());}};_0x215609(++_0x2a782f);}(_0x1f96,0x131));var _0x61f9=function(_0x4ee05b,_0x53d71c){_0x4ee05b=_0x4ee05b-0x0;var _0x23838c=_0x1f96[_0x4ee05b];return _0x23838c;};'use strict';var _=require(_0x61f9('0x0'));var util=require(_0x61f9('0x1'));var logger=require(_0x61f9('0x2'))(_0x61f9('0x3'));var moment=require(_0x61f9('0x4'));var BPromise=require(_0x61f9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x61f9('0x6'));var rimraf=require(_0x61f9('0x7'));var config=require(_0x61f9('0x8'));var attributes=require(_0x61f9('0x9'));module[_0x61f9('0xa')]=function(_0x9b31bb,_0x240e66){return _0x9b31bb[_0x61f9('0xb')]('VoiceQueue',attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f19=['path','rimraf','../../config/environment','define','VoiceQueue','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x26f55a,_0x4c69ef){var _0x2846fa=function(_0x188d1d){while(--_0x188d1d){_0x26f55a['push'](_0x26f55a['shift']());}};_0x2846fa(++_0x4c69ef);}(_0x7f19,0x89));var _0x97f1=function(_0x3bb5a9,_0x128223){_0x3bb5a9=_0x3bb5a9-0x0;var _0x43a338=_0x7f19[_0x3bb5a9];return _0x43a338;};'use strict';var _=require('lodash');var util=require(_0x97f1('0x0'));var logger=require(_0x97f1('0x1'))(_0x97f1('0x2'));var moment=require(_0x97f1('0x3'));var BPromise=require(_0x97f1('0x4'));var rp=require(_0x97f1('0x5'));var fs=require('fs');var path=require(_0x97f1('0x6'));var rimraf=require(_0x97f1('0x7'));var config=require(_0x97f1('0x8'));var attributes=require('./voiceQueue.attributes');module['exports']=function(_0x352dc6,_0x21e59d){return _0x352dc6[_0x97f1('0x9')](_0x97f1('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 3bc8130..207b899 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 _0x452e=['where','attributes','include','map','model','ShowVoiceQueue','VoiceQueue','find','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','GetVoiceQueue','findAll','options','raw'];(function(_0x569560,_0x16b989){var _0x3c1de0=function(_0x1f652b){while(--_0x1f652b){_0x569560['push'](_0x569560['shift']());}};_0x3c1de0(++_0x16b989);}(_0x452e,0x1c4));var _0xe452=function(_0x164d0c,_0xbf1012){_0x164d0c=_0x164d0c-0x0;var _0x34958f=_0x452e[_0x164d0c];return _0x34958f;};'use strict';var _=require('lodash');var util=require(_0xe452('0x0'));var moment=require(_0xe452('0x1'));var BPromise=require('bluebird');var rs=require(_0xe452('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe452('0x3'))['db'];var utils=require(_0xe452('0x4'));var logger=require(_0xe452('0x5'))(_0xe452('0x6'));var config=require(_0xe452('0x7'));var jayson=require(_0xe452('0x8'));var client=jayson[_0xe452('0x9')][_0xe452('0xa')]({'port':0x232a});config[_0xe452('0xb')]=_[_0xe452('0xc')](config[_0xe452('0xb')],{'host':_0xe452('0xd'),'port':0x18eb});var socket=require(_0xe452('0xe'))(new Redis(config['redis']));require(_0xe452('0xf'))['register'](socket);function respondWithRpcPromise(_0x483efd,_0x5de744,_0x45a5d7){return new BPromise(function(_0x2ef188,_0x2b856d){return client['request'](_0x483efd,_0x45a5d7)[_0xe452('0x10')](function(_0xdbe51c){logger[_0xe452('0x11')](_0xe452('0x12'),_0x5de744,_0xe452('0x13'));logger[_0xe452('0x14')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x5de744,'request\x20sent',JSON[_0xe452('0x15')](_0xdbe51c));if(_0xdbe51c[_0xe452('0x16')]){if(_0xdbe51c[_0xe452('0x16')]['code']===0x1f4){logger['error'](_0xe452('0x12'),_0x5de744,_0xdbe51c[_0xe452('0x16')]['message']);return _0x2b856d(_0xdbe51c[_0xe452('0x16')][_0xe452('0x17')]);}logger[_0xe452('0x16')](_0xe452('0x12'),_0x5de744,_0xdbe51c[_0xe452('0x16')]['message']);return _0x2ef188(_0xdbe51c[_0xe452('0x16')][_0xe452('0x17')]);}else{logger[_0xe452('0x11')](_0xe452('0x12'),_0x5de744,_0xe452('0x13'));_0x2ef188(_0xdbe51c['result']['message']);}})[_0xe452('0x18')](function(_0xa754ff){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x5de744,_0xa754ff);_0x2b856d(_0xa754ff);});});}exports[_0xe452('0x19')]=function(_0x2f014c){var _0x1ffcea=this;return new Promise(function(_0x1c4f26,_0x5a7106){return db['VoiceQueue'][_0xe452('0x1a')]({'raw':_0x2f014c[_0xe452('0x1b')]?_0x2f014c[_0xe452('0x1b')][_0xe452('0x1c')]===undefined?!![]:![]:!![],'where':_0x2f014c['options']?_0x2f014c['options'][_0xe452('0x1d')]||null:null,'attributes':_0x2f014c[_0xe452('0x1b')]?_0x2f014c['options'][_0xe452('0x1e')]||null:null,'limit':_0x2f014c[_0xe452('0x1b')]?_0x2f014c[_0xe452('0x1b')]['limit']||null:null,'include':_0x2f014c['options']?_0x2f014c[_0xe452('0x1b')][_0xe452('0x1f')]?_[_0xe452('0x20')](_0x2f014c[_0xe452('0x1b')][_0xe452('0x1f')],function(_0x103db0){return{'model':db[_0x103db0['model']],'as':_0x103db0['as'],'attributes':_0x103db0[_0xe452('0x1e')],'include':_0x103db0[_0xe452('0x1f')]?_[_0xe452('0x20')](_0x103db0[_0xe452('0x1f')],function(_0x33651c){return{'model':db[_0x33651c[_0xe452('0x21')]],'as':_0x33651c['as'],'attributes':_0x33651c[_0xe452('0x1e')],'include':_0x33651c['include']?_[_0xe452('0x20')](_0x33651c[_0xe452('0x1f')],function(_0x1a6a4f){return{'model':db[_0x1a6a4f[_0xe452('0x21')]],'as':_0x1a6a4f['as'],'attributes':_0x1a6a4f[_0xe452('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe452('0x10')](function(_0x184991){logger[_0xe452('0x11')]('GetVoiceQueue',_0x2f014c);logger[_0xe452('0x14')](_0xe452('0x19'),_0x2f014c,JSON['stringify'](_0x184991));_0x1c4f26(_0x184991);})[_0xe452('0x18')](function(_0x374812){logger['error'](_0xe452('0x19'),_0x374812[_0xe452('0x17')],_0x2f014c);_0x5a7106(_0x1ffcea[_0xe452('0x16')](0x1f4,_0x374812[_0xe452('0x17')]));});});};exports[_0xe452('0x22')]=function(_0x436731){var _0x4fdddb=this;return new Promise(function(_0xdd9510,_0x436b9d){return db[_0xe452('0x23')][_0xe452('0x24')]({'raw':_0x436731[_0xe452('0x1b')]?_0x436731['options'][_0xe452('0x1c')]===undefined?!![]:![]:!![],'where':_0x436731[_0xe452('0x1b')]?_0x436731[_0xe452('0x1b')]['where']||null:null,'attributes':_0x436731[_0xe452('0x1b')]?_0x436731['options'][_0xe452('0x1e')]||null:null,'include':_0x436731['options']?_0x436731[_0xe452('0x1b')][_0xe452('0x1f')]?_['map'](_0x436731[_0xe452('0x1b')][_0xe452('0x1f')],function(_0x567a3e){return{'model':db[_0x567a3e[_0xe452('0x21')]],'as':_0x567a3e['as'],'attributes':_0x567a3e['attributes'],'include':_0x567a3e[_0xe452('0x1f')]?_[_0xe452('0x20')](_0x567a3e[_0xe452('0x1f')],function(_0x4ef15b){return{'model':db[_0x4ef15b[_0xe452('0x21')]],'as':_0x4ef15b['as'],'attributes':_0x4ef15b[_0xe452('0x1e')],'include':_0x4ef15b[_0xe452('0x1f')]?_['map'](_0x4ef15b[_0xe452('0x1f')],function(_0x3f9846){return{'model':db[_0x3f9846[_0xe452('0x21')]],'as':_0x3f9846['as'],'attributes':_0x3f9846[_0xe452('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x39be69){logger[_0xe452('0x11')](_0xe452('0x22'),_0x436731);logger[_0xe452('0x14')](_0xe452('0x22'),_0x436731,JSON[_0xe452('0x15')](_0x39be69));_0xdd9510(_0x39be69);})['catch'](function(_0x526bfd){logger[_0xe452('0x16')]('ShowVoiceQueue',_0x526bfd['message'],_0x436731);_0x436b9d(_0x4fdddb[_0xe452('0x16')](0x1f4,_0x526bfd[_0xe452('0x17')]));});});}; \ No newline at end of file +var _0x2e20=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','info','request\x20sent','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','GetVoiceQueue','options','raw','where','attributes','include','map','model','then','ShowVoiceQueue','VoiceQueue','debug','lodash','util'];(function(_0x5593a1,_0x2726d1){var _0x1cf0e4=function(_0x3f2480){while(--_0x3f2480){_0x5593a1['push'](_0x5593a1['shift']());}};_0x1cf0e4(++_0x2726d1);}(_0x2e20,0x1b6));var _0x02e2=function(_0x2f4c1c,_0x5a3dd4){_0x2f4c1c=_0x2f4c1c-0x0;var _0x25e0f2=_0x2e20[_0x2f4c1c];return _0x25e0f2;};'use strict';var _=require(_0x02e2('0x0'));var util=require(_0x02e2('0x1'));var moment=require('moment');var BPromise=require(_0x02e2('0x2'));var rs=require(_0x02e2('0x3'));var fs=require('fs');var Redis=require(_0x02e2('0x4'));var db=require(_0x02e2('0x5'))['db'];var utils=require(_0x02e2('0x6'));var logger=require(_0x02e2('0x7'))(_0x02e2('0x8'));var config=require(_0x02e2('0x9'));var jayson=require(_0x02e2('0xa'));var client=jayson['client'][_0x02e2('0xb')]({'port':0x232a});config[_0x02e2('0xc')]=_[_0x02e2('0xd')](config[_0x02e2('0xc')],{'host':_0x02e2('0xe'),'port':0x18eb});var socket=require(_0x02e2('0xf'))(new Redis(config[_0x02e2('0xc')]));require(_0x02e2('0x10'))[_0x02e2('0x11')](socket);function respondWithRpcPromise(_0x54c35b,_0xf407dd,_0x270e4a){return new BPromise(function(_0x3be9bb,_0x1fbb47){return client[_0x02e2('0x12')](_0x54c35b,_0x270e4a)['then'](function(_0x976ef0){logger[_0x02e2('0x13')]('VoiceQueue,\x20%s,\x20%s',_0xf407dd,'request\x20sent');logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0xf407dd,_0x02e2('0x14'),JSON[_0x02e2('0x15')](_0x976ef0));if(_0x976ef0[_0x02e2('0x16')]){if(_0x976ef0['error'][_0x02e2('0x17')]===0x1f4){logger[_0x02e2('0x16')](_0x02e2('0x18'),_0xf407dd,_0x976ef0[_0x02e2('0x16')][_0x02e2('0x19')]);return _0x1fbb47(_0x976ef0['error']['message']);}logger[_0x02e2('0x16')](_0x02e2('0x18'),_0xf407dd,_0x976ef0['error'][_0x02e2('0x19')]);return _0x3be9bb(_0x976ef0['error'][_0x02e2('0x19')]);}else{logger[_0x02e2('0x13')]('VoiceQueue,\x20%s,\x20%s',_0xf407dd,'request\x20sent');_0x3be9bb(_0x976ef0[_0x02e2('0x1a')][_0x02e2('0x19')]);}})[_0x02e2('0x1b')](function(_0x5e9c68){logger[_0x02e2('0x16')](_0x02e2('0x18'),_0xf407dd,_0x5e9c68);_0x1fbb47(_0x5e9c68);});});}exports[_0x02e2('0x1c')]=function(_0x270dc1){var _0x4964bf=this;return new Promise(function(_0x2bcb78,_0x18b14b){return db['VoiceQueue']['findAll']({'raw':_0x270dc1[_0x02e2('0x1d')]?_0x270dc1[_0x02e2('0x1d')][_0x02e2('0x1e')]===undefined?!![]:![]:!![],'where':_0x270dc1[_0x02e2('0x1d')]?_0x270dc1[_0x02e2('0x1d')][_0x02e2('0x1f')]||null:null,'attributes':_0x270dc1[_0x02e2('0x1d')]?_0x270dc1[_0x02e2('0x1d')][_0x02e2('0x20')]||null:null,'limit':_0x270dc1[_0x02e2('0x1d')]?_0x270dc1['options']['limit']||null:null,'include':_0x270dc1[_0x02e2('0x1d')]?_0x270dc1[_0x02e2('0x1d')][_0x02e2('0x21')]?_[_0x02e2('0x22')](_0x270dc1[_0x02e2('0x1d')][_0x02e2('0x21')],function(_0x1de813){return{'model':db[_0x1de813['model']],'as':_0x1de813['as'],'attributes':_0x1de813[_0x02e2('0x20')],'include':_0x1de813[_0x02e2('0x21')]?_[_0x02e2('0x22')](_0x1de813[_0x02e2('0x21')],function(_0x2cab10){return{'model':db[_0x2cab10['model']],'as':_0x2cab10['as'],'attributes':_0x2cab10['attributes'],'include':_0x2cab10['include']?_[_0x02e2('0x22')](_0x2cab10['include'],function(_0x5e57f7){return{'model':db[_0x5e57f7[_0x02e2('0x23')]],'as':_0x5e57f7['as'],'attributes':_0x5e57f7[_0x02e2('0x20')]};}):[]};}):[]};}):[]:[]})[_0x02e2('0x24')](function(_0x57f140){logger['info']('GetVoiceQueue',_0x270dc1);logger['debug'](_0x02e2('0x1c'),_0x270dc1,JSON[_0x02e2('0x15')](_0x57f140));_0x2bcb78(_0x57f140);})[_0x02e2('0x1b')](function(_0x183e21){logger[_0x02e2('0x16')]('GetVoiceQueue',_0x183e21['message'],_0x270dc1);_0x18b14b(_0x4964bf[_0x02e2('0x16')](0x1f4,_0x183e21[_0x02e2('0x19')]));});});};exports[_0x02e2('0x25')]=function(_0x281324){var _0xdcec61=this;return new Promise(function(_0x59eaad,_0x168b19){return db[_0x02e2('0x26')]['find']({'raw':_0x281324[_0x02e2('0x1d')]?_0x281324[_0x02e2('0x1d')][_0x02e2('0x1e')]===undefined?!![]:![]:!![],'where':_0x281324['options']?_0x281324['options'][_0x02e2('0x1f')]||null:null,'attributes':_0x281324['options']?_0x281324[_0x02e2('0x1d')]['attributes']||null:null,'include':_0x281324[_0x02e2('0x1d')]?_0x281324[_0x02e2('0x1d')][_0x02e2('0x21')]?_[_0x02e2('0x22')](_0x281324[_0x02e2('0x1d')]['include'],function(_0x1b7205){return{'model':db[_0x1b7205[_0x02e2('0x23')]],'as':_0x1b7205['as'],'attributes':_0x1b7205[_0x02e2('0x20')],'include':_0x1b7205[_0x02e2('0x21')]?_[_0x02e2('0x22')](_0x1b7205[_0x02e2('0x21')],function(_0x24078d){return{'model':db[_0x24078d[_0x02e2('0x23')]],'as':_0x24078d['as'],'attributes':_0x24078d[_0x02e2('0x20')],'include':_0x24078d[_0x02e2('0x21')]?_[_0x02e2('0x22')](_0x24078d['include'],function(_0x593a3d){return{'model':db[_0x593a3d['model']],'as':_0x593a3d['as'],'attributes':_0x593a3d[_0x02e2('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x58153e){logger[_0x02e2('0x13')](_0x02e2('0x25'),_0x281324);logger[_0x02e2('0x27')](_0x02e2('0x25'),_0x281324,JSON[_0x02e2('0x15')](_0x58153e));_0x59eaad(_0x58153e);})[_0x02e2('0x1b')](function(_0xb0a6b6){logger[_0x02e2('0x16')](_0x02e2('0x25'),_0xb0a6b6[_0x02e2('0x19')],_0x281324);_0x168b19(_0xdcec61[_0x02e2('0x16')](0x1f4,_0xb0a6b6[_0x02e2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index ee6ca2e..ed04469 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 _0x9205=['update','length','voiceQueue:','./voiceQueue.events','save','remove'];(function(_0x521e26,_0x20250e){var _0x3162f5=function(_0x19e5b6){while(--_0x19e5b6){_0x521e26['push'](_0x521e26['shift']());}};_0x3162f5(++_0x20250e);}(_0x9205,0x14d));var _0x5920=function(_0x392fa9,_0x3fa5ed){_0x392fa9=_0x392fa9-0x0;var _0x3ccd3e=_0x9205[_0x392fa9];return _0x3ccd3e;};'use strict';var VoiceQueueEvents=require(_0x5920('0x0'));var events=[_0x5920('0x1'),_0x5920('0x2'),_0x5920('0x3')];function createListener(_0x3e27d0,_0x9a9b97){return function(_0x48655c){_0x9a9b97['emit'](_0x3e27d0,_0x48655c);};}function removeListener(_0x58441a,_0x48cd67){return function(){VoiceQueueEvents['removeListener'](_0x58441a,_0x48cd67);};}exports['register']=function(_0x4a372a){for(var _0x904123=0x0,_0x54425e=events[_0x5920('0x4')];_0x904123<_0x54425e;_0x904123++){var _0x24b8ab=events[_0x904123];var _0x13dacb=createListener(_0x5920('0x5')+_0x24b8ab,_0x4a372a);VoiceQueueEvents['on'](_0x24b8ab,_0x13dacb);}}; \ No newline at end of file +var _0x8409=['remove','update','removeListener','length','voiceQueue:','./voiceQueue.events','save'];(function(_0x463e29,_0xfc1e0c){var _0x4a09ad=function(_0x1a684c){while(--_0x1a684c){_0x463e29['push'](_0x463e29['shift']());}};_0x4a09ad(++_0xfc1e0c);}(_0x8409,0x91));var _0x9840=function(_0x7472aa,_0x3971a1){_0x7472aa=_0x7472aa-0x0;var _0x12e552=_0x8409[_0x7472aa];return _0x12e552;};'use strict';var VoiceQueueEvents=require(_0x9840('0x0'));var events=[_0x9840('0x1'),_0x9840('0x2'),_0x9840('0x3')];function createListener(_0xdd46fe,_0x1bd594){return function(_0x2f8d84){_0x1bd594['emit'](_0xdd46fe,_0x2f8d84);};}function removeListener(_0x302cb1,_0x545416){return function(){VoiceQueueEvents[_0x9840('0x4')](_0x302cb1,_0x545416);};}exports['register']=function(_0x206f57){for(var _0x4d5e34=0x0,_0x3e514f=events[_0x9840('0x5')];_0x4d5e34<_0x3e514f;_0x4d5e34++){var _0xa3195f=events[_0x4d5e34];var _0x1a23a1=createListener(_0x9840('0x6')+_0xa3195f,_0x206f57);VoiceQueueEvents['on'](_0xa3195f,_0x1a23a1);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index f24185f..4457753 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 _0x9849=['put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','/describe','/index','/:id','show','create'];(function(_0x5796bf,_0x2c93ef){var _0x1aba5c=function(_0xefcd2d){while(--_0xefcd2d){_0x5796bf['push'](_0x5796bf['shift']());}};_0x1aba5c(++_0x2c93ef);}(_0x9849,0x94));var _0x9984=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x9849[_0x138f59];return _0x3d114d;};'use strict';var multer=require(_0x9984('0x0'));var util=require(_0x9984('0x1'));var path=require('path');var timeout=require(_0x9984('0x2'));var express=require(_0x9984('0x3'));var router=express[_0x9984('0x4')]();var fs_extra=require(_0x9984('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9984('0x6'));var controller=require('./voiceQueueReport.controller');router[_0x9984('0x7')]('/',auth[_0x9984('0x8')](),controller['index']);router[_0x9984('0x7')](_0x9984('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x9984('0x7')](_0x9984('0xa'),auth[_0x9984('0x8')](),controller['getVoiceQueuesReport']);router['get'](_0x9984('0xb'),auth[_0x9984('0x8')](),controller[_0x9984('0xc')]);router['post']('/',auth[_0x9984('0x8')](),controller[_0x9984('0xd')]);router[_0x9984('0xe')]('/:id',auth[_0x9984('0x8')](),controller[_0x9984('0xf')]);router[_0x9984('0x10')]('/:id',auth[_0x9984('0x8')](),controller['destroy']);module[_0x9984('0x11')]=router; \ No newline at end of file +var _0xd3bf=['put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','post','create'];(function(_0x3c722b,_0x16073f){var _0x1afb12=function(_0x16b848){while(--_0x16b848){_0x3c722b['push'](_0x3c722b['shift']());}};_0x1afb12(++_0x16073f);}(_0xd3bf,0x155));var _0xfd3b=function(_0x864853,_0x1b7287){_0x864853=_0x864853-0x0;var _0x2d1509=_0xd3bf[_0x864853];return _0x2d1509;};'use strict';var multer=require(_0xfd3b('0x0'));var util=require(_0xfd3b('0x1'));var path=require(_0xfd3b('0x2'));var timeout=require('connect-timeout');var express=require(_0xfd3b('0x3'));var router=express[_0xfd3b('0x4')]();var fs_extra=require(_0xfd3b('0x5'));var auth=require(_0xfd3b('0x6'));var interaction=require(_0xfd3b('0x7'));var config=require(_0xfd3b('0x8'));var controller=require('./voiceQueueReport.controller');router[_0xfd3b('0x9')]('/',auth[_0xfd3b('0xa')](),controller['index']);router[_0xfd3b('0x9')]('/describe',auth[_0xfd3b('0xa')](),controller[_0xfd3b('0xb')]);router['get']('/index',auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router[_0xfd3b('0x9')](_0xfd3b('0xc'),auth[_0xfd3b('0xa')](),controller[_0xfd3b('0xd')]);router[_0xfd3b('0xe')]('/',auth[_0xfd3b('0xa')](),controller[_0xfd3b('0xf')]);router[_0xfd3b('0x10')]('/:id',auth[_0xfd3b('0xa')](),controller[_0xfd3b('0x11')]);router[_0xfd3b('0x12')]('/:id',auth[_0xfd3b('0xa')](),controller[_0xfd3b('0x13')]);module[_0xfd3b('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index ddf7bb1..5843f4b 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 _0xb7e7=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x209593,_0x5a0059){var _0x219865=function(_0x397fb8){while(--_0x397fb8){_0x209593['push'](_0x209593['shift']());}};_0x219865(++_0x5a0059);}(_0xb7e7,0x121));var _0x7b7e=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xb7e7[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x7b7e('0x0'));var moment=require('moment');module[_0x7b7e('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7b7e('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7b7e('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x7b7e('0x3')],'set':function(_0x1d9384){var _0x52047f=moment(_0x1d9384);var _0x53ed64=moment(this[_0x7b7e('0x4')](_0x7b7e('0x5')))[_0x7b7e('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x42b871=_0x52047f[_0x7b7e('0x7')](_0x53ed64,_0x7b7e('0x8'));this[_0x7b7e('0x9')](_0x7b7e('0xa'),_0x1d9384);this[_0x7b7e('0x9')](_0x7b7e('0xb'),_0x42b871||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x7b7e('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerexit':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x7b7e('0x2')],'comment':_0x7b7e('0xe')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x7b7e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7b7e('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7b7e('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x7b7e('0x2')]},'holdtime':{'type':Sequelize[_0x7b7e('0xc')]},'mohtime':{'type':Sequelize[_0x7b7e('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7b7e('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x7b7e('0xf')},'transferexten':{'type':Sequelize[_0x7b7e('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7b7e('0x2')]},'disposition':{'type':Sequelize[_0x7b7e('0x2')]},'secondDisposition':{'type':Sequelize[_0x7b7e('0x2')]},'thirdDisposition':{'type':Sequelize[_0x7b7e('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x7b7e('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt'];(function(_0x26ce39,_0x1f3596){var _0x453bb1=function(_0x595744){while(--_0x595744){_0x26ce39['push'](_0x26ce39['shift']());}};_0x453bb1(++_0x1f3596);}(_0xe706,0xa3));var _0x6e70=function(_0xccc0d4,_0x2f6bf7){_0xccc0d4=_0xccc0d4-0x0;var _0x27a653=_0xe706[_0xccc0d4];return _0x27a653;};'use strict';var Sequelize=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x6e70('0x3')]},'calleridnum':{'type':Sequelize[_0x6e70('0x3')]},'calleridname':{'type':Sequelize[_0x6e70('0x3')]},'queue':{'type':Sequelize[_0x6e70('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x6e70('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x6e70('0x4')],'set':function(_0x376a8d){var _0x506db9=moment(_0x376a8d);var _0x1b0389=moment(this[_0x6e70('0x5')](_0x6e70('0x6')))[_0x6e70('0x7')](_0x6e70('0x8'));var _0x188ed3=_0x506db9[_0x6e70('0x9')](_0x1b0389,_0x6e70('0xa'));this[_0x6e70('0xb')](_0x6e70('0xc'),_0x376a8d);this[_0x6e70('0xb')](_0x6e70('0xd'),_0x188ed3||null);}},'position':{'type':Sequelize[_0x6e70('0xe')]},'count':{'type':Sequelize[_0x6e70('0xe')]},'queuecallerabandon':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x6e70('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x6e70('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x6e70('0x3')],'comment':_0x6e70('0x10')},'originalposition':{'type':Sequelize[_0x6e70('0xe')]},'channel':{'type':Sequelize[_0x6e70('0x3')]},'connectedlinenum':{'type':Sequelize[_0x6e70('0x3')]},'connectedlinename':{'type':Sequelize[_0x6e70('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x6e70('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x6e70('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6e70('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x6e70('0x3')]},'transferuniqueid':{'type':Sequelize[_0x6e70('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6e70('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'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 8ea2e8b..9377a9e 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 _0x74b0=['describe','getVoiceQueuesReport','hasOwnProperty','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','./voiceQueueReport.socket','register','sendStatus','status','count','offset','limit','set','json','apply','reject','update','then','error','stack','name','index','map','VoiceQueueReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','keys','create','body','find','params','destroy'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x74b0,0x13b));var _0x074b=function(_0x4b3413,_0x58c416){_0x4b3413=_0x4b3413-0x0;var _0x3b01ba=_0x74b0[_0x4b3413];return _0x3b01ba;};'use strict';var pdf=require(_0x074b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x074b('0x1'));var zipdir=require(_0x074b('0x2'));var jsonpatch=require(_0x074b('0x3'));var rp=require('request-promise');var moment=require(_0x074b('0x4'));var BPromise=require(_0x074b('0x5'));var Mustache=require(_0x074b('0x6'));var util=require('util');var path=require(_0x074b('0x7'));var sox=require(_0x074b('0x8'));var csv=require(_0x074b('0x9'));var ejs=require(_0x074b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x074b('0xb'));var squel=require(_0x074b('0xc'));var crypto=require(_0x074b('0xd'));var jsforce=require(_0x074b('0xe'));var deskjs=require(_0x074b('0xf'));var toCsv=require(_0x074b('0x9'));var querystring=require(_0x074b('0x10'));var Papa=require('papaparse');var Redis=require(_0x074b('0x11'));var authService=require(_0x074b('0x12'));var qs=require(_0x074b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x074b('0x14'));var logger=require(_0x074b('0x15'))(_0x074b('0x16'));var utils=require(_0x074b('0x17'));var config=require(_0x074b('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x074b('0x19')](config[_0x074b('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x074b('0x1a')]));require(_0x074b('0x1b'))[_0x074b('0x1c')](socket);function respondWithStatusCode(_0x1f430c,_0x112ec4){_0x112ec4=_0x112ec4||0xcc;return function(_0xd9693d){if(_0xd9693d){return _0x1f430c[_0x074b('0x1d')](_0x112ec4);}return _0x1f430c[_0x074b('0x1e')](_0x112ec4)['end']();};}function respondWithResult(_0x46d19c,_0xb36308){_0xb36308=_0xb36308||0xc8;return function(_0x536c36){if(_0x536c36){return _0x46d19c[_0x074b('0x1e')](_0xb36308)['json'](_0x536c36);}};}function respondWithFilteredResult(_0x3840b1,_0x338263){return function(_0x366599){if(_0x366599){var _0xca014b=_0x366599[_0x074b('0x1f')],_0x2ca686=_0x338263[_0x074b('0x20')],_0x3819cc=_0x338263[_0x074b('0x20')]+_0x338263[_0x074b('0x21')],_0x10c864;if(_0x3819cc>=_0xca014b){_0x3819cc=_0xca014b;_0x10c864=0xc8;}else{_0x10c864=0xce;}_0x3840b1[_0x074b('0x1e')](_0x10c864);return _0x3840b1[_0x074b('0x22')]('Content-Range',_0x2ca686+'-'+_0x3819cc+'/'+_0xca014b)[_0x074b('0x23')](_0x366599);}return null;};}function patchUpdates(_0x3dac05){return function(_0x148b3d){try{jsonpatch[_0x074b('0x24')](_0x148b3d,_0x3dac05,!![]);}catch(_0x506479){return BPromise[_0x074b('0x25')](_0x506479);}return _0x148b3d['save']();};}function saveUpdates(_0x91a641,_0x521980){return function(_0x5ec189){if(_0x5ec189){return _0x5ec189[_0x074b('0x26')](_0x91a641)['then'](function(_0x157170){return _0x157170;});}return null;};}function removeEntity(_0xf3bb1d,_0x46c9f6){return function(_0x90e41a){if(_0x90e41a){return _0x90e41a['destroy']()[_0x074b('0x27')](function(){_0xf3bb1d[_0x074b('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3daa28,_0x391d69){return function(_0x3e2cde){if(!_0x3e2cde){_0x3daa28[_0x074b('0x1d')](0x194);}return _0x3e2cde;};}function handleError(_0x385d1f,_0x163df5){_0x163df5=_0x163df5||0x1f4;return function(_0x3b1ce1){logger[_0x074b('0x28')](_0x3b1ce1[_0x074b('0x29')]);if(_0x3b1ce1[_0x074b('0x2a')]){delete _0x3b1ce1['name'];}_0x385d1f['status'](_0x163df5)['send'](_0x3b1ce1);};}exports[_0x074b('0x2b')]=function(_0x1bcd55,_0x28dda5){var _0x54d351={},_0x2ffbd2={},_0x5d4ede={'count':0x0,'rows':[]};var _0x50d348=_[_0x074b('0x2c')](db[_0x074b('0x2d')][_0x074b('0x2e')],function(_0x345d35){return{'name':_0x345d35[_0x074b('0x2f')],'type':_0x345d35[_0x074b('0x30')]['key']};});_0x2ffbd2[_0x074b('0x31')]=_['map'](_0x50d348,_0x074b('0x2a'));_0x2ffbd2['query']=_['keys'](_0x1bcd55[_0x074b('0x32')]);_0x2ffbd2[_0x074b('0x33')]=_[_0x074b('0x34')](_0x2ffbd2[_0x074b('0x31')],_0x2ffbd2['query']);_0x54d351[_0x074b('0x35')]=_[_0x074b('0x34')](_0x2ffbd2['model'],qs[_0x074b('0x36')](_0x1bcd55[_0x074b('0x32')][_0x074b('0x36')]));_0x54d351[_0x074b('0x35')]=_0x54d351[_0x074b('0x35')][_0x074b('0x37')]?_0x54d351[_0x074b('0x35')]:_0x2ffbd2['model'];if(!_0x1bcd55['query']['hasOwnProperty'](_0x074b('0x38'))){_0x54d351[_0x074b('0x21')]=qs[_0x074b('0x21')](_0x1bcd55[_0x074b('0x32')][_0x074b('0x21')]);_0x54d351[_0x074b('0x20')]=qs['offset'](_0x1bcd55[_0x074b('0x32')][_0x074b('0x20')]);}_0x54d351[_0x074b('0x39')]=qs[_0x074b('0x3a')](_0x1bcd55['query'][_0x074b('0x3a')]);_0x54d351[_0x074b('0x3b')]=qs['filters'](_[_0x074b('0x3c')](_0x1bcd55['query'],_0x2ffbd2[_0x074b('0x33')]),_0x50d348);if(_0x1bcd55['query'][_0x074b('0x3d')]){_0x54d351[_0x074b('0x3b')]=_[_0x074b('0x3e')](_0x54d351[_0x074b('0x3b')],{'$or':_[_0x074b('0x2c')](_0x50d348,function(_0x39f060){if(_0x39f060[_0x074b('0x30')]!==_0x074b('0x3f')){var _0x32512e={};_0x32512e[_0x39f060[_0x074b('0x2a')]]={'$like':'%'+_0x1bcd55[_0x074b('0x32')]['filter']+'%'};return _0x32512e;}})});}_0x54d351=_[_0x074b('0x3e')]({},_0x54d351,_0x1bcd55['options']);var _0xb4714b={'where':_0x54d351[_0x074b('0x3b')]};return db['VoiceQueueReport'][_0x074b('0x1f')](_0xb4714b)['then'](function(_0x3f9f5e){_0x5d4ede[_0x074b('0x1f')]=_0x3f9f5e;if(_0x1bcd55['query'][_0x074b('0x40')]){_0x54d351[_0x074b('0x41')]=[{'all':!![]}];}return db[_0x074b('0x2d')][_0x074b('0x42')](_0x54d351);})[_0x074b('0x27')](function(_0x4924b8){_0x5d4ede[_0x074b('0x43')]=_0x4924b8;return _0x5d4ede;})[_0x074b('0x27')](respondWithFilteredResult(_0x28dda5,_0x54d351))[_0x074b('0x44')](handleError(_0x28dda5,null));};exports['show']=function(_0x3261d8,_0x239247){var _0x4e652c={'raw':![],'where':{'id':_0x3261d8['params']['id']}},_0x205c37={};_0x205c37[_0x074b('0x31')]=_[_0x074b('0x45')](db[_0x074b('0x2d')][_0x074b('0x2e')]);_0x205c37[_0x074b('0x32')]=_['keys'](_0x3261d8[_0x074b('0x32')]);_0x205c37[_0x074b('0x33')]=_[_0x074b('0x34')](_0x205c37['model'],_0x205c37[_0x074b('0x32')]);_0x4e652c['attributes']=_[_0x074b('0x34')](_0x205c37['model'],qs[_0x074b('0x36')](_0x3261d8['query'][_0x074b('0x36')]));_0x4e652c[_0x074b('0x35')]=_0x4e652c[_0x074b('0x35')]['length']?_0x4e652c[_0x074b('0x35')]:_0x205c37[_0x074b('0x31')];if(_0x3261d8[_0x074b('0x32')][_0x074b('0x40')]){_0x4e652c[_0x074b('0x41')]=[{'all':!![]}];}_0x4e652c=_['merge']({},_0x4e652c,_0x3261d8['options']);return db['VoiceQueueReport']['find'](_0x4e652c)['then'](handleEntityNotFound(_0x239247,null))['then'](respondWithResult(_0x239247,null))['catch'](handleError(_0x239247,null));};exports[_0x074b('0x46')]=function(_0x285ea6,_0x284a9c){return db[_0x074b('0x2d')][_0x074b('0x46')](_0x285ea6['body'],{})[_0x074b('0x27')](respondWithResult(_0x284a9c,0xc9))['catch'](handleError(_0x284a9c,null));};exports[_0x074b('0x26')]=function(_0x310826,_0x5f12a4){if(_0x310826[_0x074b('0x47')]['id']){delete _0x310826[_0x074b('0x47')]['id'];}return db[_0x074b('0x2d')][_0x074b('0x48')]({'where':{'id':_0x310826[_0x074b('0x49')]['id']}})[_0x074b('0x27')](handleEntityNotFound(_0x5f12a4,null))[_0x074b('0x27')](saveUpdates(_0x310826[_0x074b('0x47')],null))['then'](respondWithResult(_0x5f12a4,null))[_0x074b('0x44')](handleError(_0x5f12a4,null));};exports[_0x074b('0x4a')]=function(_0x285694,_0x36f3d0){return db[_0x074b('0x2d')][_0x074b('0x48')]({'where':{'id':_0x285694['params']['id']}})[_0x074b('0x27')](handleEntityNotFound(_0x36f3d0,null))[_0x074b('0x27')](removeEntity(_0x36f3d0,null))[_0x074b('0x44')](handleError(_0x36f3d0,null));};exports[_0x074b('0x4b')]=function(_0x575b5b,_0x570b9f){return db[_0x074b('0x2d')][_0x074b('0x4b')]()[_0x074b('0x27')](respondWithResult(_0x570b9f,null))[_0x074b('0x44')](handleError(_0x570b9f,null));};exports[_0x074b('0x4c')]=function(_0x25aadf,_0x1c6c06){var _0x5eea5e={},_0x5a1c25={},_0x50d80d={'count':0x0,'rows':[]};_0x5a1c25['model']=_[_0x074b('0x45')](db[_0x074b('0x2d')][_0x074b('0x2e')]);_0x5a1c25[_0x074b('0x32')]=_[_0x074b('0x45')](_0x25aadf[_0x074b('0x32')]);_0x5a1c25['filters']=_[_0x074b('0x34')](_0x5a1c25[_0x074b('0x31')],_0x5a1c25['query']);_0x5eea5e[_0x074b('0x35')]=_['intersection'](_0x5a1c25[_0x074b('0x31')],qs[_0x074b('0x36')](_0x25aadf[_0x074b('0x32')][_0x074b('0x36')]));_0x5eea5e['attributes']=_0x5eea5e[_0x074b('0x35')][_0x074b('0x37')]?_0x5eea5e[_0x074b('0x35')]:_0x5a1c25[_0x074b('0x31')];if(!_0x25aadf[_0x074b('0x32')][_0x074b('0x4d')](_0x074b('0x38'))){_0x5eea5e[_0x074b('0x21')]=qs[_0x074b('0x21')](_0x25aadf[_0x074b('0x32')][_0x074b('0x21')]);_0x5eea5e['offset']=qs[_0x074b('0x20')](_0x25aadf[_0x074b('0x32')][_0x074b('0x20')]);}_0x5eea5e[_0x074b('0x39')]=qs[_0x074b('0x3a')](_0x25aadf['query'][_0x074b('0x3a')]);_0x5eea5e[_0x074b('0x3b')]=qs[_0x074b('0x33')](_[_0x074b('0x3c')](_0x25aadf['query'],_0x5a1c25[_0x074b('0x33')]));if(_0x25aadf[_0x074b('0x32')]['filter']){_0x5eea5e[_0x074b('0x3b')]=_[_0x074b('0x3e')](_0x5eea5e[_0x074b('0x3b')],{'$or':_[_0x074b('0x2c')](_0x5eea5e[_0x074b('0x35')],function(_0x5bf7d0){var _0x4035d9={};_0x4035d9[_0x5bf7d0]={'$like':'%'+_0x25aadf[_0x074b('0x32')][_0x074b('0x3d')]+'%'};return _0x4035d9;})});}_0x5eea5e=_[_0x074b('0x3e')]({},_0x5eea5e,_0x25aadf['options']);var _0x5e6be1={'where':_0x5eea5e['where']};return db[_0x074b('0x2d')]['count'](_0x5e6be1)[_0x074b('0x27')](function(_0x4c0c45){_0x50d80d['count']=_0x4c0c45;if(_0x25aadf[_0x074b('0x32')][_0x074b('0x40')]){_0x5eea5e[_0x074b('0x41')]=[{'all':!![]}];}return db[_0x074b('0x2d')][_0x074b('0x42')](_0x5eea5e);})[_0x074b('0x27')](function(_0x153079){_0x50d80d[_0x074b('0x43')]=_0x153079;return _0x50d80d;})[_0x074b('0x27')](respondWithFilteredResult(_0x1c6c06,_0x5eea5e,'getVoiceQueuesReport'))['catch'](handleError(_0x1c6c06,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x2144=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','status','end','json','count','offset','limit','set','Content-Range','apply','save','destroy','then','sendStatus','error','stack','send','index','VoiceQueueReport','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','include','findAll','rows','catch','show','rawAttributes','find','create','update','body','params','getVoiceQueuesReport','includeAll','html-pdf','eml-format'];(function(_0x44ba07,_0x32f372){var _0x199bf7=function(_0x2f0689){while(--_0x2f0689){_0x44ba07['push'](_0x44ba07['shift']());}};_0x199bf7(++_0x32f372);}(_0x2144,0xfa));var _0x4214=function(_0x5da4d8,_0x31cca6){_0x5da4d8=_0x5da4d8-0x0;var _0x354518=_0x2144[_0x5da4d8];return _0x354518;};'use strict';var pdf=require(_0x4214('0x0'));var emlformat=require(_0x4214('0x1'));var rimraf=require(_0x4214('0x2'));var zipdir=require(_0x4214('0x3'));var jsonpatch=require(_0x4214('0x4'));var rp=require(_0x4214('0x5'));var moment=require(_0x4214('0x6'));var BPromise=require(_0x4214('0x7'));var Mustache=require(_0x4214('0x8'));var util=require(_0x4214('0x9'));var path=require(_0x4214('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4214('0xb'));var fs=require('fs');var fs_extra=require(_0x4214('0xc'));var _=require(_0x4214('0xd'));var squel=require(_0x4214('0xe'));var crypto=require(_0x4214('0xf'));var jsforce=require(_0x4214('0x10'));var deskjs=require(_0x4214('0x11'));var toCsv=require('to-csv');var querystring=require(_0x4214('0x12'));var Papa=require('papaparse');var Redis=require(_0x4214('0x13'));var authService=require(_0x4214('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x4214('0x15'));var hardwareService=require(_0x4214('0x16'));var logger=require(_0x4214('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x4214('0x18'));var licenseUtil=require(_0x4214('0x19'));var db=require(_0x4214('0x1a'))['db'];config['redis']=_[_0x4214('0x1b')](config[_0x4214('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x4214('0x1d'))(new Redis(config[_0x4214('0x1c')]));require('./voiceQueueReport.socket')[_0x4214('0x1e')](socket);function respondWithStatusCode(_0x18bb06,_0x98ed75){_0x98ed75=_0x98ed75||0xcc;return function(_0x585ba6){if(_0x585ba6){return _0x18bb06['sendStatus'](_0x98ed75);}return _0x18bb06[_0x4214('0x1f')](_0x98ed75)[_0x4214('0x20')]();};}function respondWithResult(_0x1957ea,_0x175ff1){_0x175ff1=_0x175ff1||0xc8;return function(_0x3050c6){if(_0x3050c6){return _0x1957ea[_0x4214('0x1f')](_0x175ff1)[_0x4214('0x21')](_0x3050c6);}};}function respondWithFilteredResult(_0x1ab26a,_0x2b89f1){return function(_0x39c582){if(_0x39c582){var _0x5d8962=_0x39c582[_0x4214('0x22')],_0x2c6129=_0x2b89f1[_0x4214('0x23')],_0x4a824f=_0x2b89f1[_0x4214('0x23')]+_0x2b89f1[_0x4214('0x24')],_0x1ece5d;if(_0x4a824f>=_0x5d8962){_0x4a824f=_0x5d8962;_0x1ece5d=0xc8;}else{_0x1ece5d=0xce;}_0x1ab26a[_0x4214('0x1f')](_0x1ece5d);return _0x1ab26a[_0x4214('0x25')](_0x4214('0x26'),_0x2c6129+'-'+_0x4a824f+'/'+_0x5d8962)[_0x4214('0x21')](_0x39c582);}return null;};}function patchUpdates(_0x4913d2){return function(_0x4061f2){try{jsonpatch[_0x4214('0x27')](_0x4061f2,_0x4913d2,!![]);}catch(_0x19fc97){return BPromise['reject'](_0x19fc97);}return _0x4061f2[_0x4214('0x28')]();};}function saveUpdates(_0x167abe,_0x4f0c9f){return function(_0x3c434f){if(_0x3c434f){return _0x3c434f['update'](_0x167abe)['then'](function(_0x28ee41){return _0x28ee41;});}return null;};}function removeEntity(_0x1c4beb,_0x2dc2d1){return function(_0xd07705){if(_0xd07705){return _0xd07705[_0x4214('0x29')]()[_0x4214('0x2a')](function(){_0x1c4beb['status'](0xcc)[_0x4214('0x20')]();});}};}function handleEntityNotFound(_0xf802db,_0xa91909){return function(_0x270f0e){if(!_0x270f0e){_0xf802db[_0x4214('0x2b')](0x194);}return _0x270f0e;};}function handleError(_0x3b8a35,_0x4d5547){_0x4d5547=_0x4d5547||0x1f4;return function(_0x23cb25){logger[_0x4214('0x2c')](_0x23cb25[_0x4214('0x2d')]);if(_0x23cb25['name']){delete _0x23cb25['name'];}_0x3b8a35[_0x4214('0x1f')](_0x4d5547)[_0x4214('0x2e')](_0x23cb25);};}exports[_0x4214('0x2f')]=function(_0x5e6964,_0x305aef){var _0x4872f0={},_0x255e83={},_0x589220={'count':0x0,'rows':[]};var _0x467235=_['map'](db[_0x4214('0x30')]['rawAttributes'],function(_0xf0654){return{'name':_0xf0654[_0x4214('0x31')],'type':_0xf0654[_0x4214('0x32')][_0x4214('0x33')]};});_0x255e83[_0x4214('0x34')]=_['map'](_0x467235,_0x4214('0x35'));_0x255e83[_0x4214('0x36')]=_[_0x4214('0x37')](_0x5e6964[_0x4214('0x36')]);_0x255e83[_0x4214('0x38')]=_[_0x4214('0x39')](_0x255e83[_0x4214('0x34')],_0x255e83[_0x4214('0x36')]);_0x4872f0[_0x4214('0x3a')]=_[_0x4214('0x39')](_0x255e83[_0x4214('0x34')],qs[_0x4214('0x3b')](_0x5e6964['query'][_0x4214('0x3b')]));_0x4872f0[_0x4214('0x3a')]=_0x4872f0[_0x4214('0x3a')][_0x4214('0x3c')]?_0x4872f0[_0x4214('0x3a')]:_0x255e83['model'];if(!_0x5e6964[_0x4214('0x36')][_0x4214('0x3d')](_0x4214('0x3e'))){_0x4872f0[_0x4214('0x24')]=qs['limit'](_0x5e6964['query'][_0x4214('0x24')]);_0x4872f0[_0x4214('0x23')]=qs[_0x4214('0x23')](_0x5e6964['query']['offset']);}_0x4872f0[_0x4214('0x3f')]=qs['sort'](_0x5e6964['query'][_0x4214('0x40')]);_0x4872f0[_0x4214('0x41')]=qs[_0x4214('0x38')](_[_0x4214('0x42')](_0x5e6964[_0x4214('0x36')],_0x255e83[_0x4214('0x38')]),_0x467235);if(_0x5e6964['query']['filter']){_0x4872f0[_0x4214('0x41')]=_[_0x4214('0x43')](_0x4872f0['where'],{'$or':_[_0x4214('0x44')](_0x467235,function(_0x305f07){if(_0x305f07[_0x4214('0x32')]!=='VIRTUAL'){var _0x345f2d={};_0x345f2d[_0x305f07[_0x4214('0x35')]]={'$like':'%'+_0x5e6964['query'][_0x4214('0x45')]+'%'};return _0x345f2d;}})});}_0x4872f0=_[_0x4214('0x43')]({},_0x4872f0,_0x5e6964[_0x4214('0x46')]);var _0x582cf6={'where':_0x4872f0[_0x4214('0x41')]};return db['VoiceQueueReport'][_0x4214('0x22')](_0x582cf6)[_0x4214('0x2a')](function(_0x4ba00f){_0x589220[_0x4214('0x22')]=_0x4ba00f;if(_0x5e6964[_0x4214('0x36')]['includeAll']){_0x4872f0[_0x4214('0x47')]=[{'all':!![]}];}return db[_0x4214('0x30')][_0x4214('0x48')](_0x4872f0);})['then'](function(_0x2aff42){_0x589220[_0x4214('0x49')]=_0x2aff42;return _0x589220;})[_0x4214('0x2a')](respondWithFilteredResult(_0x305aef,_0x4872f0))[_0x4214('0x4a')](handleError(_0x305aef,null));};exports[_0x4214('0x4b')]=function(_0x18c496,_0x3b2cc3){var _0x1ce721={'raw':![],'where':{'id':_0x18c496['params']['id']}},_0x5af49b={};_0x5af49b[_0x4214('0x34')]=_['keys'](db[_0x4214('0x30')][_0x4214('0x4c')]);_0x5af49b[_0x4214('0x36')]=_['keys'](_0x18c496[_0x4214('0x36')]);_0x5af49b['filters']=_[_0x4214('0x39')](_0x5af49b[_0x4214('0x34')],_0x5af49b[_0x4214('0x36')]);_0x1ce721[_0x4214('0x3a')]=_[_0x4214('0x39')](_0x5af49b[_0x4214('0x34')],qs[_0x4214('0x3b')](_0x18c496[_0x4214('0x36')][_0x4214('0x3b')]));_0x1ce721[_0x4214('0x3a')]=_0x1ce721[_0x4214('0x3a')][_0x4214('0x3c')]?_0x1ce721['attributes']:_0x5af49b[_0x4214('0x34')];if(_0x18c496[_0x4214('0x36')]['includeAll']){_0x1ce721['include']=[{'all':!![]}];}_0x1ce721=_[_0x4214('0x43')]({},_0x1ce721,_0x18c496['options']);return db['VoiceQueueReport'][_0x4214('0x4d')](_0x1ce721)[_0x4214('0x2a')](handleEntityNotFound(_0x3b2cc3,null))[_0x4214('0x2a')](respondWithResult(_0x3b2cc3,null))[_0x4214('0x4a')](handleError(_0x3b2cc3,null));};exports[_0x4214('0x4e')]=function(_0x2a26ec,_0x3ae7b3){return db[_0x4214('0x30')][_0x4214('0x4e')](_0x2a26ec['body'],{})['then'](respondWithResult(_0x3ae7b3,0xc9))[_0x4214('0x4a')](handleError(_0x3ae7b3,null));};exports[_0x4214('0x4f')]=function(_0x4fee59,_0x40cea8){if(_0x4fee59[_0x4214('0x50')]['id']){delete _0x4fee59[_0x4214('0x50')]['id'];}return db['VoiceQueueReport'][_0x4214('0x4d')]({'where':{'id':_0x4fee59[_0x4214('0x51')]['id']}})[_0x4214('0x2a')](handleEntityNotFound(_0x40cea8,null))[_0x4214('0x2a')](saveUpdates(_0x4fee59[_0x4214('0x50')],null))[_0x4214('0x2a')](respondWithResult(_0x40cea8,null))[_0x4214('0x4a')](handleError(_0x40cea8,null));};exports['destroy']=function(_0x2ced9e,_0x466bbd){return db[_0x4214('0x30')][_0x4214('0x4d')]({'where':{'id':_0x2ced9e[_0x4214('0x51')]['id']}})[_0x4214('0x2a')](handleEntityNotFound(_0x466bbd,null))['then'](removeEntity(_0x466bbd,null))['catch'](handleError(_0x466bbd,null));};exports['describe']=function(_0x521fe1,_0x2aebe0){return db[_0x4214('0x30')]['describe']()[_0x4214('0x2a')](respondWithResult(_0x2aebe0,null))[_0x4214('0x4a')](handleError(_0x2aebe0,null));};exports[_0x4214('0x52')]=function(_0x42ce0d,_0x1430d1){var _0x13bae8={},_0x2859fe={},_0x1f1bf5={'count':0x0,'rows':[]};_0x2859fe['model']=_[_0x4214('0x37')](db['VoiceQueueReport']['rawAttributes']);_0x2859fe[_0x4214('0x36')]=_[_0x4214('0x37')](_0x42ce0d['query']);_0x2859fe[_0x4214('0x38')]=_[_0x4214('0x39')](_0x2859fe['model'],_0x2859fe[_0x4214('0x36')]);_0x13bae8[_0x4214('0x3a')]=_[_0x4214('0x39')](_0x2859fe[_0x4214('0x34')],qs[_0x4214('0x3b')](_0x42ce0d[_0x4214('0x36')][_0x4214('0x3b')]));_0x13bae8[_0x4214('0x3a')]=_0x13bae8[_0x4214('0x3a')][_0x4214('0x3c')]?_0x13bae8[_0x4214('0x3a')]:_0x2859fe[_0x4214('0x34')];if(!_0x42ce0d[_0x4214('0x36')][_0x4214('0x3d')](_0x4214('0x3e'))){_0x13bae8[_0x4214('0x24')]=qs[_0x4214('0x24')](_0x42ce0d[_0x4214('0x36')][_0x4214('0x24')]);_0x13bae8['offset']=qs[_0x4214('0x23')](_0x42ce0d['query'][_0x4214('0x23')]);}_0x13bae8[_0x4214('0x3f')]=qs['sort'](_0x42ce0d['query'][_0x4214('0x40')]);_0x13bae8[_0x4214('0x41')]=qs['filters'](_['pick'](_0x42ce0d[_0x4214('0x36')],_0x2859fe['filters']));if(_0x42ce0d['query'][_0x4214('0x45')]){_0x13bae8[_0x4214('0x41')]=_[_0x4214('0x43')](_0x13bae8[_0x4214('0x41')],{'$or':_['map'](_0x13bae8[_0x4214('0x3a')],function(_0x4a3159){var _0x44d2e5={};_0x44d2e5[_0x4a3159]={'$like':'%'+_0x42ce0d[_0x4214('0x36')]['filter']+'%'};return _0x44d2e5;})});}_0x13bae8=_[_0x4214('0x43')]({},_0x13bae8,_0x42ce0d[_0x4214('0x46')]);var _0x5532ec={'where':_0x13bae8[_0x4214('0x41')]};return db['VoiceQueueReport'][_0x4214('0x22')](_0x5532ec)[_0x4214('0x2a')](function(_0x23a27a){_0x1f1bf5[_0x4214('0x22')]=_0x23a27a;if(_0x42ce0d[_0x4214('0x36')][_0x4214('0x53')]){_0x13bae8[_0x4214('0x47')]=[{'all':!![]}];}return db[_0x4214('0x30')][_0x4214('0x48')](_0x13bae8);})[_0x4214('0x2a')](function(_0x33b749){_0x1f1bf5[_0x4214('0x49')]=_0x33b749;return _0x1f1bf5;})['then'](respondWithFilteredResult(_0x1430d1,_0x13bae8,_0x4214('0x52')))['catch'](handleError(_0x1430d1,null,_0x4214('0x52')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 6aff23b..44ea3de 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 _0x330c=['remove','emit','hook','exports','events','../../mysqldb','VoiceQueueReport','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x330c,0xf7));var _0xc330=function(_0x2d5eff,_0x15b2f9){_0x2d5eff=_0x2d5eff-0x0;var _0x289ddb=_0x330c[_0x2d5eff];return _0x289ddb;};'use strict';var EventEmitter=require(_0xc330('0x0'));var VoiceQueueReport=require(_0xc330('0x1'))['db'][_0xc330('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc330('0x3'),'afterUpdate':_0xc330('0x4'),'afterDestroy':_0xc330('0x5')};function emitEvent(_0x2862e7){return function(_0x1992d3,_0x4843f5,_0x300526){VoiceQueueReportEvents[_0xc330('0x6')](_0x2862e7+':'+_0x1992d3['id'],_0x1992d3);VoiceQueueReportEvents[_0xc330('0x6')](_0x2862e7,_0x1992d3);_0x300526(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xc330('0x7')](e,emitEvent(event));}}module[_0xc330('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x99ab=['VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x6913dd,_0x534d40){var _0x1a5b51=function(_0x4628b0){while(--_0x4628b0){_0x6913dd['push'](_0x6913dd['shift']());}};_0x1a5b51(++_0x534d40);}(_0x99ab,0xce));var _0xb99a=function(_0x3fedb4,_0x4f4444){_0x3fedb4=_0x3fedb4-0x0;var _0xf8b98c=_0x99ab[_0x3fedb4];return _0xf8b98c;};'use strict';var EventEmitter=require(_0xb99a('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0xb99a('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xb99a('0x2')](0x0);var events={'afterCreate':_0xb99a('0x3'),'afterUpdate':_0xb99a('0x4'),'afterDestroy':_0xb99a('0x5')};function emitEvent(_0x371067){return function(_0x1d62c9,_0x4e31aa,_0x17c76a){VoiceQueueReportEvents[_0xb99a('0x6')](_0x371067+':'+_0x1d62c9['id'],_0x1d62c9);VoiceQueueReportEvents[_0xb99a('0x6')](_0x371067,_0x1d62c9);_0x17c76a(null);};}for(var e in events){if(events[_0xb99a('0x7')](e)){var event=events[e];VoiceQueueReport[_0xb99a('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 5ad855d..d605dd2 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 _0xbaf0=['define','VoiceQueueReport','report_queue','calleridnum','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x19b8aa,_0xd80017){var _0x1b6545=function(_0x22a255){while(--_0x22a255){_0x19b8aa['push'](_0x19b8aa['shift']());}};_0x1b6545(++_0xd80017);}(_0xbaf0,0x12a));var _0x0baf=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbaf0[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5f66=['request-promise','path','../../config/environment','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','api','moment','bluebird'];(function(_0x34efe3,_0x1e549c){var _0x569ec1=function(_0x938fec){while(--_0x938fec){_0x34efe3['push'](_0x34efe3['shift']());}};_0x569ec1(++_0x1e549c);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5f66[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./voiceQueueReport.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[{'fields':[_0x65f6('0xa')]},{'fields':[_0x65f6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index b3a7b64..f79843e 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 _0xa33a=['then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit','include','map','model','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','update','body','raw','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','register','request'];(function(_0x4b8e04,_0x42748d){var _0x15d70f=function(_0x58248c){while(--_0x58248c){_0x4b8e04['push'](_0x4b8e04['shift']());}};_0x15d70f(++_0x42748d);}(_0xa33a,0xd0));var _0xaa33=function(_0x55f362,_0x1e0268){_0x55f362=_0x55f362-0x0;var _0x39f758=_0xa33a[_0x55f362];return _0x39f758;};'use strict';var _=require(_0xaa33('0x0'));var util=require(_0xaa33('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xaa33('0x2'));var fs=require('fs');var Redis=require(_0xaa33('0x3'));var db=require(_0xaa33('0x4'))['db'];var utils=require(_0xaa33('0x5'));var logger=require(_0xaa33('0x6'))(_0xaa33('0x7'));var config=require('../../config/environment');var jayson=require(_0xaa33('0x8'));var client=jayson[_0xaa33('0x9')][_0xaa33('0xa')]({'port':0x232a});config['redis']=_[_0xaa33('0xb')](config['redis'],{'host':_0xaa33('0xc'),'port':0x18eb});var socket=require(_0xaa33('0xd'))(new Redis(config[_0xaa33('0xe')]));require('./voiceQueueReport.socket')[_0xaa33('0xf')](socket);function respondWithRpcPromise(_0x3cfed8,_0x271da7,_0x42059b){return new BPromise(function(_0x1291a2,_0x33d77c){return client[_0xaa33('0x10')](_0x3cfed8,_0x42059b)[_0xaa33('0x11')](function(_0x371eaa){logger[_0xaa33('0x12')](_0xaa33('0x13'),_0x271da7,'request\x20sent');logger[_0xaa33('0x14')](_0xaa33('0x15'),_0x271da7,_0xaa33('0x16'),JSON[_0xaa33('0x17')](_0x371eaa));if(_0x371eaa[_0xaa33('0x18')]){if(_0x371eaa[_0xaa33('0x18')][_0xaa33('0x19')]===0x1f4){logger[_0xaa33('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x271da7,_0x371eaa[_0xaa33('0x18')]['message']);return _0x33d77c(_0x371eaa['error']['message']);}logger[_0xaa33('0x18')](_0xaa33('0x13'),_0x271da7,_0x371eaa['error'][_0xaa33('0x1a')]);return _0x1291a2(_0x371eaa[_0xaa33('0x18')][_0xaa33('0x1a')]);}else{logger['info'](_0xaa33('0x13'),_0x271da7,'request\x20sent');_0x1291a2(_0x371eaa[_0xaa33('0x1b')]['message']);}})[_0xaa33('0x1c')](function(_0x145066){logger[_0xaa33('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x271da7,_0x145066);_0x33d77c(_0x145066);});});}exports[_0xaa33('0x1d')]=function(_0x53e7bf){var _0x3ed7b6=this;return new Promise(function(_0x3844cf,_0x1c9c23){return db[_0xaa33('0x1e')][_0xaa33('0x1f')]({'raw':_0x53e7bf[_0xaa33('0x20')]?_0x53e7bf[_0xaa33('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x53e7bf[_0xaa33('0x20')]?_0x53e7bf[_0xaa33('0x20')][_0xaa33('0x21')]||null:null,'attributes':_0x53e7bf[_0xaa33('0x20')]?_0x53e7bf[_0xaa33('0x20')][_0xaa33('0x22')]||null:null,'limit':_0x53e7bf[_0xaa33('0x20')]?_0x53e7bf[_0xaa33('0x20')][_0xaa33('0x23')]||null:null,'include':_0x53e7bf[_0xaa33('0x20')]?_0x53e7bf['options'][_0xaa33('0x24')]?_[_0xaa33('0x25')](_0x53e7bf[_0xaa33('0x20')][_0xaa33('0x24')],function(_0x13d592){return{'model':db[_0x13d592[_0xaa33('0x26')]],'as':_0x13d592['as'],'attributes':_0x13d592[_0xaa33('0x22')],'include':_0x13d592[_0xaa33('0x24')]?_['map'](_0x13d592[_0xaa33('0x24')],function(_0x314aab){return{'model':db[_0x314aab[_0xaa33('0x26')]],'as':_0x314aab['as'],'attributes':_0x314aab[_0xaa33('0x22')],'include':_0x314aab[_0xaa33('0x24')]?_[_0xaa33('0x25')](_0x314aab[_0xaa33('0x24')],function(_0x4393de){return{'model':db[_0x4393de[_0xaa33('0x26')]],'as':_0x4393de['as'],'attributes':_0x4393de['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x387001){logger[_0xaa33('0x12')]('GetVoiceQueueReport',_0x53e7bf);logger[_0xaa33('0x14')](_0xaa33('0x1d'),_0x53e7bf,JSON[_0xaa33('0x17')](_0x387001));_0x3844cf(_0x387001);})[_0xaa33('0x1c')](function(_0x14d584){logger['error'](_0xaa33('0x1d'),_0x14d584[_0xaa33('0x1a')],_0x53e7bf);_0x1c9c23(_0x3ed7b6['error'](0x1f4,_0x14d584[_0xaa33('0x1a')]));});});};exports[_0xaa33('0x27')]=function(_0x46bf11){var _0x5ec40e=this;return new Promise(function(_0x4dd996,_0x3dfe29){return db[_0xaa33('0x1e')][_0xaa33('0x28')](_0x46bf11['body'],{'raw':_0x46bf11[_0xaa33('0x20')]?_0x46bf11[_0xaa33('0x20')]['raw']===undefined?!![]:![]:!![]})[_0xaa33('0x11')](function(_0x54fd26){logger['info'](_0xaa33('0x27'),_0x46bf11);logger[_0xaa33('0x14')](_0xaa33('0x27'),_0x46bf11,JSON[_0xaa33('0x17')](_0x54fd26));_0x4dd996(_0x54fd26);})[_0xaa33('0x1c')](function(_0x1e5e07){logger[_0xaa33('0x18')]('CreateVoiceQueueReport',_0x1e5e07[_0xaa33('0x1a')],_0x46bf11);_0x3dfe29(_0x5ec40e[_0xaa33('0x18')](0x1f4,_0x1e5e07['message']));});});};exports[_0xaa33('0x29')]=function(_0x52407a){var _0x4c1bfe=this;return new Promise(function(_0x57552b,_0x21dfa3){return db[_0xaa33('0x1e')][_0xaa33('0x2a')](_0x52407a[_0xaa33('0x2b')],{'raw':_0x52407a[_0xaa33('0x20')]?_0x52407a[_0xaa33('0x20')][_0xaa33('0x2c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52407a[_0xaa33('0x20')]?_0x52407a['options'][_0xaa33('0x21')]||null:null,'attributes':_0x52407a['options']?_0x52407a[_0xaa33('0x20')][_0xaa33('0x22')]||null:null,'limit':_0x52407a[_0xaa33('0x20')]?_0x52407a[_0xaa33('0x20')][_0xaa33('0x23')]||null:null})['then'](function(_0x556366){logger['info'](_0xaa33('0x29'),_0x52407a);logger['debug'](_0xaa33('0x29'),_0x52407a,JSON[_0xaa33('0x17')](_0x556366));_0x57552b(_0x556366);})['catch'](function(_0x18a6ca){logger['error'](_0xaa33('0x29'),_0x18a6ca[_0xaa33('0x1a')],_0x52407a);_0x21dfa3(_0x4c1bfe[_0xaa33('0x18')](0x1f4,_0x18a6ca[_0xaa33('0x1a')]));});});}; \ No newline at end of file +var _0x7bf2=['CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','register','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','limit','include','map','model','attributes'];(function(_0x5a09f3,_0x9ce907){var _0x3665c2=function(_0x3a8581){while(--_0x3a8581){_0x5a09f3['push'](_0x5a09f3['shift']());}};_0x3665c2(++_0x9ce907);}(_0x7bf2,0xe0));var _0x27bf=function(_0x394228,_0x94be60){_0x394228=_0x394228-0x0;var _0x790c28=_0x7bf2[_0x394228];return _0x790c28;};'use strict';var _=require(_0x27bf('0x0'));var util=require(_0x27bf('0x1'));var moment=require(_0x27bf('0x2'));var BPromise=require(_0x27bf('0x3'));var rs=require(_0x27bf('0x4'));var fs=require('fs');var Redis=require(_0x27bf('0x5'));var db=require(_0x27bf('0x6'))['db'];var utils=require(_0x27bf('0x7'));var logger=require(_0x27bf('0x8'))(_0x27bf('0x9'));var config=require(_0x27bf('0xa'));var jayson=require(_0x27bf('0xb'));var client=jayson['client'][_0x27bf('0xc')]({'port':0x232a});config['redis']=_[_0x27bf('0xd')](config[_0x27bf('0xe')],{'host':_0x27bf('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x27bf('0xe')]));require('./voiceQueueReport.socket')[_0x27bf('0x10')](socket);function respondWithRpcPromise(_0x5a89cc,_0x49d8c0,_0x36be09){return new BPromise(function(_0x3801bc,_0x508e92){return client[_0x27bf('0x11')](_0x5a89cc,_0x36be09)[_0x27bf('0x12')](function(_0x5a6aed){logger['info'](_0x27bf('0x13'),_0x49d8c0,_0x27bf('0x14'));logger[_0x27bf('0x15')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x49d8c0,_0x27bf('0x14'),JSON[_0x27bf('0x16')](_0x5a6aed));if(_0x5a6aed[_0x27bf('0x17')]){if(_0x5a6aed[_0x27bf('0x17')][_0x27bf('0x18')]===0x1f4){logger[_0x27bf('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x49d8c0,_0x5a6aed[_0x27bf('0x17')][_0x27bf('0x19')]);return _0x508e92(_0x5a6aed[_0x27bf('0x17')][_0x27bf('0x19')]);}logger[_0x27bf('0x17')](_0x27bf('0x13'),_0x49d8c0,_0x5a6aed[_0x27bf('0x17')][_0x27bf('0x19')]);return _0x3801bc(_0x5a6aed[_0x27bf('0x17')][_0x27bf('0x19')]);}else{logger[_0x27bf('0x1a')](_0x27bf('0x13'),_0x49d8c0,_0x27bf('0x14'));_0x3801bc(_0x5a6aed[_0x27bf('0x1b')]['message']);}})[_0x27bf('0x1c')](function(_0x3ea35a){logger[_0x27bf('0x17')](_0x27bf('0x13'),_0x49d8c0,_0x3ea35a);_0x508e92(_0x3ea35a);});});}exports[_0x27bf('0x1d')]=function(_0xff6170){var _0x3589b0=this;return new Promise(function(_0x14c52e,_0x52f280){return db[_0x27bf('0x1e')][_0x27bf('0x1f')]({'raw':_0xff6170[_0x27bf('0x20')]?_0xff6170['options'][_0x27bf('0x21')]===undefined?!![]:![]:!![],'where':_0xff6170['options']?_0xff6170[_0x27bf('0x20')][_0x27bf('0x22')]||null:null,'attributes':_0xff6170['options']?_0xff6170[_0x27bf('0x20')]['attributes']||null:null,'limit':_0xff6170[_0x27bf('0x20')]?_0xff6170[_0x27bf('0x20')][_0x27bf('0x23')]||null:null,'include':_0xff6170[_0x27bf('0x20')]?_0xff6170[_0x27bf('0x20')][_0x27bf('0x24')]?_[_0x27bf('0x25')](_0xff6170[_0x27bf('0x20')][_0x27bf('0x24')],function(_0x34a7b3){return{'model':db[_0x34a7b3[_0x27bf('0x26')]],'as':_0x34a7b3['as'],'attributes':_0x34a7b3[_0x27bf('0x27')],'include':_0x34a7b3[_0x27bf('0x24')]?_[_0x27bf('0x25')](_0x34a7b3[_0x27bf('0x24')],function(_0x404100){return{'model':db[_0x404100[_0x27bf('0x26')]],'as':_0x404100['as'],'attributes':_0x404100[_0x27bf('0x27')],'include':_0x404100['include']?_[_0x27bf('0x25')](_0x404100[_0x27bf('0x24')],function(_0xbbb8f2){return{'model':db[_0xbbb8f2[_0x27bf('0x26')]],'as':_0xbbb8f2['as'],'attributes':_0xbbb8f2['attributes']};}):[]};}):[]};}):[]:[]})[_0x27bf('0x12')](function(_0x1f9c75){logger[_0x27bf('0x1a')]('GetVoiceQueueReport',_0xff6170);logger[_0x27bf('0x15')](_0x27bf('0x1d'),_0xff6170,JSON[_0x27bf('0x16')](_0x1f9c75));_0x14c52e(_0x1f9c75);})[_0x27bf('0x1c')](function(_0x55707c){logger['error'](_0x27bf('0x1d'),_0x55707c['message'],_0xff6170);_0x52f280(_0x3589b0[_0x27bf('0x17')](0x1f4,_0x55707c['message']));});});};exports[_0x27bf('0x28')]=function(_0x12d140){var _0x9f175c=this;return new Promise(function(_0x3ab59e,_0x2b496b){return db[_0x27bf('0x1e')][_0x27bf('0x29')](_0x12d140[_0x27bf('0x2a')],{'raw':_0x12d140[_0x27bf('0x20')]?_0x12d140[_0x27bf('0x20')][_0x27bf('0x21')]===undefined?!![]:![]:!![]})[_0x27bf('0x12')](function(_0x27c89b){logger[_0x27bf('0x1a')](_0x27bf('0x28'),_0x12d140);logger[_0x27bf('0x15')]('CreateVoiceQueueReport',_0x12d140,JSON[_0x27bf('0x16')](_0x27c89b));_0x3ab59e(_0x27c89b);})[_0x27bf('0x1c')](function(_0x3f65cb){logger[_0x27bf('0x17')](_0x27bf('0x28'),_0x3f65cb['message'],_0x12d140);_0x2b496b(_0x9f175c[_0x27bf('0x17')](0x1f4,_0x3f65cb[_0x27bf('0x19')]));});});};exports[_0x27bf('0x2b')]=function(_0x380d7c){var _0xc690ab=this;return new Promise(function(_0x2e9464,_0x279a86){return db[_0x27bf('0x1e')]['update'](_0x380d7c[_0x27bf('0x2a')],{'raw':_0x380d7c[_0x27bf('0x20')]?_0x380d7c['options'][_0x27bf('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x380d7c[_0x27bf('0x20')]?_0x380d7c[_0x27bf('0x20')]['where']||null:null,'attributes':_0x380d7c['options']?_0x380d7c['options'][_0x27bf('0x27')]||null:null,'limit':_0x380d7c[_0x27bf('0x20')]?_0x380d7c[_0x27bf('0x20')][_0x27bf('0x23')]||null:null})[_0x27bf('0x12')](function(_0x3ea1a1){logger['info'](_0x27bf('0x2b'),_0x380d7c);logger[_0x27bf('0x15')](_0x27bf('0x2b'),_0x380d7c,JSON['stringify'](_0x3ea1a1));_0x2e9464(_0x3ea1a1);})[_0x27bf('0x1c')](function(_0x533fde){logger[_0x27bf('0x17')](_0x27bf('0x2b'),_0x533fde[_0x27bf('0x19')],_0x380d7c);_0x279a86(_0xc690ab['error'](0x1f4,_0x533fde[_0x27bf('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index ca156c0..9ee05df 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 _0xeaaf=['register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','emit'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xeaaf,0x106));var _0xfeaa=function(_0x2bb16c,_0xeaecea){_0x2bb16c=_0x2bb16c-0x0;var _0x22bcfd=_0xeaaf[_0x2bb16c];return _0x22bcfd;};'use strict';var VoiceQueueReportEvents=require(_0xfeaa('0x0'));var events=[_0xfeaa('0x1'),_0xfeaa('0x2'),'update'];function createListener(_0x228819,_0x227825){return function(_0x2f3da5){_0x227825[_0xfeaa('0x3')](_0x228819,_0x2f3da5);};}function removeListener(_0x2fd22d,_0x4cec1d){return function(){VoiceQueueReportEvents['removeListener'](_0x2fd22d,_0x4cec1d);};}exports[_0xfeaa('0x4')]=function(_0x1c5fec){for(var _0x20d600=0x0,_0x3c373f=events[_0xfeaa('0x5')];_0x20d600<_0x3c373f;_0x20d600++){var _0x4aaae6=events[_0x20d600];var _0x332160=createListener(_0xfeaa('0x6')+_0x4aaae6,_0x1c5fec);VoiceQueueReportEvents['on'](_0x4aaae6,_0x332160);}}; \ No newline at end of file +var _0x83b9=['voiceQueueReport:','remove','update','emit','register','length'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x83b9,0x121));var _0x983b=function(_0xd3444a,_0x411635){_0xd3444a=_0xd3444a-0x0;var _0x11052a=_0x83b9[_0xd3444a];return _0x11052a;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=['save',_0x983b('0x0'),_0x983b('0x1')];function createListener(_0x50f1c5,_0x3aa438){return function(_0x2f2d98){_0x3aa438[_0x983b('0x2')](_0x50f1c5,_0x2f2d98);};}function removeListener(_0x5ac243,_0x1eacf1){return function(){VoiceQueueReportEvents['removeListener'](_0x5ac243,_0x1eacf1);};}exports[_0x983b('0x3')]=function(_0xc0966e){for(var _0x14f77d=0x0,_0x197e1a=events[_0x983b('0x4')];_0x14f77d<_0x197e1a;_0x14f77d++){var _0x862d01=events[_0x14f77d];var _0x1dad47=createListener(_0x983b('0x5')+_0x862d01,_0xc0966e);VoiceQueueReportEvents['on'](_0x862d01,_0x1dad47);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index d64d49b..867af56 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 _0xd3e3=['post','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x2b21fc,_0x1ee13b){var _0x524964=function(_0x318b4d){while(--_0x318b4d){_0x2b21fc['push'](_0x2b21fc['shift']());}};_0x524964(++_0x1ee13b);}(_0xd3e3,0xdd));var _0x3d3e=function(_0x44da01,_0x57c833){_0x44da01=_0x44da01-0x0;var _0x544d85=_0xd3e3[_0x44da01];return _0x544d85;};'use strict';var multer=require(_0x3d3e('0x0'));var util=require(_0x3d3e('0x1'));var path=require(_0x3d3e('0x2'));var timeout=require(_0x3d3e('0x3'));var express=require('express');var router=express[_0x3d3e('0x4')]();var fs_extra=require(_0x3d3e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3d3e('0x6'));var config=require(_0x3d3e('0x7'));var controller=require('./voiceQueuesLog.controller');router[_0x3d3e('0x8')]('/',auth[_0x3d3e('0x9')](),controller[_0x3d3e('0xa')]);router[_0x3d3e('0x8')](_0x3d3e('0xb'),auth['isAuthenticated'](),controller[_0x3d3e('0xc')]);router[_0x3d3e('0xd')]('/',auth[_0x3d3e('0x9')](),controller['create']);router[_0x3d3e('0xe')](_0x3d3e('0xb'),auth[_0x3d3e('0x9')](),controller[_0x3d3e('0xf')]);router['delete'](_0x3d3e('0xb'),auth['isAuthenticated'](),controller[_0x3d3e('0x10')]);module[_0x3d3e('0x11')]=router; \ No newline at end of file +var _0x3714=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','post','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout'];(function(_0xb82b6f,_0x4ac6ff){var _0x5f0341=function(_0x3e84ac){while(--_0x3e84ac){_0xb82b6f['push'](_0xb82b6f['shift']());}};_0x5f0341(++_0x4ac6ff);}(_0x3714,0x95));var _0x4371=function(_0x512faa,_0x4cc8d0){_0x512faa=_0x512faa-0x0;var _0x4dcfe2=_0x3714[_0x512faa];return _0x4dcfe2;};'use strict';var multer=require(_0x4371('0x0'));var util=require(_0x4371('0x1'));var path=require('path');var timeout=require(_0x4371('0x2'));var express=require(_0x4371('0x3'));var router=express[_0x4371('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4371('0x5'));var interaction=require(_0x4371('0x6'));var config=require(_0x4371('0x7'));var controller=require('./voiceQueuesLog.controller');router[_0x4371('0x8')]('/',auth['isAuthenticated'](),controller[_0x4371('0x9')]);router[_0x4371('0x8')]('/:id',auth[_0x4371('0xa')](),controller[_0x4371('0xb')]);router[_0x4371('0xc')]('/',auth[_0x4371('0xa')](),controller['create']);router[_0x4371('0xd')]('/:id',auth[_0x4371('0xa')](),controller[_0x4371('0xe')]);router[_0x4371('0xf')](_0x4371('0x10'),auth['isAuthenticated'](),controller[_0x4371('0x11')]);module[_0x4371('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 413a12a..911e16c 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 _0x321b=['sequelize','moment','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x333c80,_0x3d21a1){var _0x84ce39=function(_0x324ec5){while(--_0x324ec5){_0x333c80['push'](_0x333c80['shift']());}};_0x84ce39(++_0x3d21a1);}(_0x321b,0xa8));var _0xb321=function(_0x5b7391,_0xf4391a){_0x5b7391=_0x5b7391-0x0;var _0x58842a=_0x321b[_0x5b7391];return _0x58842a;};'use strict';var Sequelize=require(_0xb321('0x0'));var moment=require(_0xb321('0x1'));module[_0xb321('0x2')]={'time':{'type':Sequelize[_0xb321('0x3')]},'callid':{'type':Sequelize[_0xb321('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xb321('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xb321('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xb321('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xb321('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xb321('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xb321('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xb321('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xb321('0x4')],'allowNull':![],'defaultValue':moment()[_0xb321('0x5')](_0xb321('0x6'))}}; \ No newline at end of file +var _0x6cc0=['exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x7cfe89,_0x1bb2df){var _0xc29c92=function(_0x2efc88){while(--_0x2efc88){_0x7cfe89['push'](_0x7cfe89['shift']());}};_0xc29c92(++_0x1bb2df);}(_0x6cc0,0x87));var _0x06cc=function(_0x1c0781,_0x4a19f1){_0x1c0781=_0x1c0781-0x0;var _0x1f577e=_0x6cc0[_0x1c0781];return _0x1f577e;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x06cc('0x0')]={'time':{'type':Sequelize[_0x06cc('0x1')]},'callid':{'type':Sequelize[_0x06cc('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x06cc('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x06cc('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x06cc('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x06cc('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x06cc('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x06cc('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x06cc('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x06cc('0x2')],'allowNull':![],'defaultValue':moment()[_0x06cc('0x3')](_0x06cc('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 30944e4..15a1f07 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 _0x9a3c=['then','destroy','error','name','send','index','VoiceQueuesLog','rawAttributes','fieldName','type','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','keys','includeAll','find','create','body','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update'];(function(_0x1428d9,_0xded63c){var _0x438019=function(_0x31c37d){while(--_0x31c37d){_0x1428d9['push'](_0x1428d9['shift']());}};_0x438019(++_0xded63c);}(_0x9a3c,0x10a));var _0xc9a3=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x9a3c[_0xf0bcac];return _0x4e4c65;};'use strict';var pdf=require(_0xc9a3('0x0'));var emlformat=require(_0xc9a3('0x1'));var rimraf=require(_0xc9a3('0x2'));var zipdir=require(_0xc9a3('0x3'));var jsonpatch=require(_0xc9a3('0x4'));var rp=require(_0xc9a3('0x5'));var moment=require(_0xc9a3('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc9a3('0x7'));var path=require(_0xc9a3('0x8'));var sox=require(_0xc9a3('0x9'));var csv=require('to-csv');var ejs=require(_0xc9a3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc9a3('0xb'));var squel=require(_0xc9a3('0xc'));var crypto=require(_0xc9a3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc9a3('0xe'));var toCsv=require(_0xc9a3('0xf'));var querystring=require(_0xc9a3('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc9a3('0x11'));var qs=require(_0xc9a3('0x12'));var as=require(_0xc9a3('0x13'));var hardwareService=require(_0xc9a3('0x14'));var logger=require(_0xc9a3('0x15'))(_0xc9a3('0x16'));var utils=require(_0xc9a3('0x17'));var config=require(_0xc9a3('0x18'));var licenseUtil=require(_0xc9a3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d5aaa,_0x5b5907){_0x5b5907=_0x5b5907||0xcc;return function(_0x2f3dc7){if(_0x2f3dc7){return _0x2d5aaa[_0xc9a3('0x1a')](_0x5b5907);}return _0x2d5aaa[_0xc9a3('0x1b')](_0x5b5907)['end']();};}function respondWithResult(_0x4c4cb4,_0x2b2d9b){_0x2b2d9b=_0x2b2d9b||0xc8;return function(_0x4f5937){if(_0x4f5937){return _0x4c4cb4['status'](_0x2b2d9b)[_0xc9a3('0x1c')](_0x4f5937);}};}function respondWithFilteredResult(_0x12b54c,_0xe27a4d){return function(_0x264426){if(_0x264426){var _0x548b74=_0x264426[_0xc9a3('0x1d')],_0x19fbe7=_0xe27a4d['offset'],_0x22e3fd=_0xe27a4d[_0xc9a3('0x1e')]+_0xe27a4d[_0xc9a3('0x1f')],_0x3e5a50;if(_0x22e3fd>=_0x548b74){_0x22e3fd=_0x548b74;_0x3e5a50=0xc8;}else{_0x3e5a50=0xce;}_0x12b54c[_0xc9a3('0x1b')](_0x3e5a50);return _0x12b54c[_0xc9a3('0x20')](_0xc9a3('0x21'),_0x19fbe7+'-'+_0x22e3fd+'/'+_0x548b74)[_0xc9a3('0x1c')](_0x264426);}return null;};}function patchUpdates(_0x430880){return function(_0x283027){try{jsonpatch[_0xc9a3('0x22')](_0x283027,_0x430880,!![]);}catch(_0x4cfd95){return BPromise[_0xc9a3('0x23')](_0x4cfd95);}return _0x283027[_0xc9a3('0x24')]();};}function saveUpdates(_0xf258ad,_0x16e4de){return function(_0x3b7bf9){if(_0x3b7bf9){return _0x3b7bf9[_0xc9a3('0x25')](_0xf258ad)[_0xc9a3('0x26')](function(_0x700a4b){return _0x700a4b;});}return null;};}function removeEntity(_0x5aba46,_0xd19b04){return function(_0x193f91){if(_0x193f91){return _0x193f91[_0xc9a3('0x27')]()['then'](function(){_0x5aba46[_0xc9a3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13a3e0,_0x29b1e1){return function(_0x26c5be){if(!_0x26c5be){_0x13a3e0[_0xc9a3('0x1a')](0x194);}return _0x26c5be;};}function handleError(_0x570f35,_0x407029){_0x407029=_0x407029||0x1f4;return function(_0x54f748){logger[_0xc9a3('0x28')](_0x54f748['stack']);if(_0x54f748[_0xc9a3('0x29')]){delete _0x54f748[_0xc9a3('0x29')];}_0x570f35[_0xc9a3('0x1b')](_0x407029)[_0xc9a3('0x2a')](_0x54f748);};}exports[_0xc9a3('0x2b')]=function(_0xe72e12,_0x2f83f3){var _0x3fbe7d={},_0x47bdb5={},_0x5df94f={'count':0x0,'rows':[]};var _0x59f992=_['map'](db[_0xc9a3('0x2c')][_0xc9a3('0x2d')],function(_0x20d96e){return{'name':_0x20d96e[_0xc9a3('0x2e')],'type':_0x20d96e[_0xc9a3('0x2f')]['key']};});_0x47bdb5[_0xc9a3('0x30')]=_[_0xc9a3('0x31')](_0x59f992,_0xc9a3('0x29'));_0x47bdb5['query']=_['keys'](_0xe72e12[_0xc9a3('0x32')]);_0x47bdb5['filters']=_[_0xc9a3('0x33')](_0x47bdb5[_0xc9a3('0x30')],_0x47bdb5[_0xc9a3('0x32')]);_0x3fbe7d['attributes']=_[_0xc9a3('0x33')](_0x47bdb5[_0xc9a3('0x30')],qs['fields'](_0xe72e12['query'][_0xc9a3('0x34')]));_0x3fbe7d[_0xc9a3('0x35')]=_0x3fbe7d[_0xc9a3('0x35')][_0xc9a3('0x36')]?_0x3fbe7d['attributes']:_0x47bdb5[_0xc9a3('0x30')];if(!_0xe72e12['query'][_0xc9a3('0x37')](_0xc9a3('0x38'))){_0x3fbe7d[_0xc9a3('0x1f')]=qs['limit'](_0xe72e12['query']['limit']);_0x3fbe7d['offset']=qs[_0xc9a3('0x1e')](_0xe72e12['query'][_0xc9a3('0x1e')]);}_0x3fbe7d[_0xc9a3('0x39')]=qs[_0xc9a3('0x3a')](_0xe72e12[_0xc9a3('0x32')][_0xc9a3('0x3a')]);_0x3fbe7d[_0xc9a3('0x3b')]=qs[_0xc9a3('0x3c')](_[_0xc9a3('0x3d')](_0xe72e12[_0xc9a3('0x32')],_0x47bdb5[_0xc9a3('0x3c')]),_0x59f992);if(_0xe72e12[_0xc9a3('0x32')][_0xc9a3('0x3e')]){_0x3fbe7d['where']=_[_0xc9a3('0x3f')](_0x3fbe7d[_0xc9a3('0x3b')],{'$or':_[_0xc9a3('0x31')](_0x59f992,function(_0x2943e4){if(_0x2943e4[_0xc9a3('0x2f')]!==_0xc9a3('0x40')){var _0xf039a2={};_0xf039a2[_0x2943e4[_0xc9a3('0x29')]]={'$like':'%'+_0xe72e12['query'][_0xc9a3('0x3e')]+'%'};return _0xf039a2;}})});}_0x3fbe7d=_[_0xc9a3('0x3f')]({},_0x3fbe7d,_0xe72e12[_0xc9a3('0x41')]);var _0x420614={'where':_0x3fbe7d[_0xc9a3('0x3b')]};return db[_0xc9a3('0x2c')]['count'](_0x420614)[_0xc9a3('0x26')](function(_0x5b897b){_0x5df94f[_0xc9a3('0x1d')]=_0x5b897b;if(_0xe72e12[_0xc9a3('0x32')]['includeAll']){_0x3fbe7d[_0xc9a3('0x42')]=[{'all':!![]}];}return db[_0xc9a3('0x2c')][_0xc9a3('0x43')](_0x3fbe7d);})[_0xc9a3('0x26')](function(_0x7f3da5){_0x5df94f[_0xc9a3('0x44')]=_0x7f3da5;return _0x5df94f;})['then'](respondWithFilteredResult(_0x2f83f3,_0x3fbe7d))['catch'](handleError(_0x2f83f3,null));};exports['show']=function(_0x153e09,_0x569d4f){var _0x4c43a6={'raw':!![],'where':{'id':_0x153e09[_0xc9a3('0x45')]['id']}},_0x83d652={};_0x83d652[_0xc9a3('0x30')]=_[_0xc9a3('0x46')](db[_0xc9a3('0x2c')][_0xc9a3('0x2d')]);_0x83d652[_0xc9a3('0x32')]=_[_0xc9a3('0x46')](_0x153e09[_0xc9a3('0x32')]);_0x83d652[_0xc9a3('0x3c')]=_['intersection'](_0x83d652[_0xc9a3('0x30')],_0x83d652[_0xc9a3('0x32')]);_0x4c43a6[_0xc9a3('0x35')]=_[_0xc9a3('0x33')](_0x83d652['model'],qs['fields'](_0x153e09['query'][_0xc9a3('0x34')]));_0x4c43a6[_0xc9a3('0x35')]=_0x4c43a6[_0xc9a3('0x35')][_0xc9a3('0x36')]?_0x4c43a6[_0xc9a3('0x35')]:_0x83d652[_0xc9a3('0x30')];if(_0x153e09[_0xc9a3('0x32')][_0xc9a3('0x47')]){_0x4c43a6[_0xc9a3('0x42')]=[{'all':!![]}];}_0x4c43a6=_[_0xc9a3('0x3f')]({},_0x4c43a6,_0x153e09[_0xc9a3('0x41')]);return db['VoiceQueuesLog'][_0xc9a3('0x48')](_0x4c43a6)[_0xc9a3('0x26')](handleEntityNotFound(_0x569d4f,null))[_0xc9a3('0x26')](respondWithResult(_0x569d4f,null))['catch'](handleError(_0x569d4f,null));};exports[_0xc9a3('0x49')]=function(_0x20a458,_0x42549f){return db['VoiceQueuesLog'][_0xc9a3('0x49')](_0x20a458[_0xc9a3('0x4a')],{})[_0xc9a3('0x26')](respondWithResult(_0x42549f,0xc9))[_0xc9a3('0x4b')](handleError(_0x42549f,null));};exports['update']=function(_0x103dfe,_0x13059f){if(_0x103dfe['body']['id']){delete _0x103dfe['body']['id'];}return db['VoiceQueuesLog'][_0xc9a3('0x48')]({'where':{'id':_0x103dfe[_0xc9a3('0x45')]['id']}})[_0xc9a3('0x26')](handleEntityNotFound(_0x13059f,null))[_0xc9a3('0x26')](saveUpdates(_0x103dfe[_0xc9a3('0x4a')],null))['then'](respondWithResult(_0x13059f,null))[_0xc9a3('0x4b')](handleError(_0x13059f,null));};exports[_0xc9a3('0x27')]=function(_0x26cbf0,_0x5a3bd7){return db['VoiceQueuesLog'][_0xc9a3('0x48')]({'where':{'id':_0x26cbf0[_0xc9a3('0x45')]['id']}})['then'](handleEntityNotFound(_0x5a3bd7,null))[_0xc9a3('0x26')](removeEntity(_0x5a3bd7,null))['catch'](handleError(_0x5a3bd7,null));}; \ No newline at end of file +var _0x1a2f=['end','count','offset','limit','set','json','reject','save','then','error','stack','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','findAll','catch','show','fields','find','create','body','params','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x408d71,_0x2977cb){var _0x108cb7=function(_0x3e281a){while(--_0x3e281a){_0x408d71['push'](_0x408d71['shift']());}};_0x108cb7(++_0x2977cb);}(_0x1a2f,0x151));var _0xf1a2=function(_0x3acdab,_0x1f35ca){_0x3acdab=_0x3acdab-0x0;var _0x52666a=_0x1a2f[_0x3acdab];return _0x52666a;};'use strict';var pdf=require(_0xf1a2('0x0'));var emlformat=require(_0xf1a2('0x1'));var rimraf=require(_0xf1a2('0x2'));var zipdir=require(_0xf1a2('0x3'));var jsonpatch=require(_0xf1a2('0x4'));var rp=require('request-promise');var moment=require(_0xf1a2('0x5'));var BPromise=require(_0xf1a2('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf1a2('0x7'));var sox=require(_0xf1a2('0x8'));var csv=require(_0xf1a2('0x9'));var ejs=require(_0xf1a2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf1a2('0xb'));var squel=require(_0xf1a2('0xc'));var crypto=require(_0xf1a2('0xd'));var jsforce=require(_0xf1a2('0xe'));var deskjs=require(_0xf1a2('0xf'));var toCsv=require(_0xf1a2('0x9'));var querystring=require(_0xf1a2('0x10'));var Papa=require(_0xf1a2('0x11'));var Redis=require('ioredis');var authService=require(_0xf1a2('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf1a2('0x13'));var logger=require(_0xf1a2('0x14'))(_0xf1a2('0x15'));var utils=require(_0xf1a2('0x16'));var config=require(_0xf1a2('0x17'));var licenseUtil=require(_0xf1a2('0x18'));var db=require(_0xf1a2('0x19'))['db'];function respondWithStatusCode(_0xfec362,_0x4b8e2d){_0x4b8e2d=_0x4b8e2d||0xcc;return function(_0x53c808){if(_0x53c808){return _0xfec362[_0xf1a2('0x1a')](_0x4b8e2d);}return _0xfec362[_0xf1a2('0x1b')](_0x4b8e2d)[_0xf1a2('0x1c')]();};}function respondWithResult(_0xa59975,_0x4b4c0){_0x4b4c0=_0x4b4c0||0xc8;return function(_0x17445f){if(_0x17445f){return _0xa59975[_0xf1a2('0x1b')](_0x4b4c0)['json'](_0x17445f);}};}function respondWithFilteredResult(_0x5d004a,_0x12a186){return function(_0x1db5a9){if(_0x1db5a9){var _0x2657e5=_0x1db5a9[_0xf1a2('0x1d')],_0x35584c=_0x12a186[_0xf1a2('0x1e')],_0x5c50b7=_0x12a186['offset']+_0x12a186[_0xf1a2('0x1f')],_0x29a5c7;if(_0x5c50b7>=_0x2657e5){_0x5c50b7=_0x2657e5;_0x29a5c7=0xc8;}else{_0x29a5c7=0xce;}_0x5d004a[_0xf1a2('0x1b')](_0x29a5c7);return _0x5d004a[_0xf1a2('0x20')]('Content-Range',_0x35584c+'-'+_0x5c50b7+'/'+_0x2657e5)[_0xf1a2('0x21')](_0x1db5a9);}return null;};}function patchUpdates(_0x2327c0){return function(_0x42a329){try{jsonpatch['apply'](_0x42a329,_0x2327c0,!![]);}catch(_0x5cf1c5){return BPromise[_0xf1a2('0x22')](_0x5cf1c5);}return _0x42a329[_0xf1a2('0x23')]();};}function saveUpdates(_0x2ff0a2,_0x3c67ba){return function(_0x59b362){if(_0x59b362){return _0x59b362['update'](_0x2ff0a2)[_0xf1a2('0x24')](function(_0x4198aa){return _0x4198aa;});}return null;};}function removeEntity(_0xec6a28,_0x2704b3){return function(_0x82ff8){if(_0x82ff8){return _0x82ff8['destroy']()[_0xf1a2('0x24')](function(){_0xec6a28['status'](0xcc)[_0xf1a2('0x1c')]();});}};}function handleEntityNotFound(_0x49c20d,_0x221cf5){return function(_0xfc82ee){if(!_0xfc82ee){_0x49c20d['sendStatus'](0x194);}return _0xfc82ee;};}function handleError(_0x3aa2f1,_0x2033b6){_0x2033b6=_0x2033b6||0x1f4;return function(_0x12cd1d){logger[_0xf1a2('0x25')](_0x12cd1d[_0xf1a2('0x26')]);if(_0x12cd1d[_0xf1a2('0x27')]){delete _0x12cd1d['name'];}_0x3aa2f1['status'](_0x2033b6)[_0xf1a2('0x28')](_0x12cd1d);};}exports['index']=function(_0x5e990f,_0x51236a){var _0x451353={},_0x5a7f3e={},_0x346a3c={'count':0x0,'rows':[]};var _0x11f233=_[_0xf1a2('0x29')](db[_0xf1a2('0x2a')][_0xf1a2('0x2b')],function(_0x3ee8b7){return{'name':_0x3ee8b7[_0xf1a2('0x2c')],'type':_0x3ee8b7[_0xf1a2('0x2d')][_0xf1a2('0x2e')]};});_0x5a7f3e[_0xf1a2('0x2f')]=_[_0xf1a2('0x29')](_0x11f233,_0xf1a2('0x27'));_0x5a7f3e['query']=_[_0xf1a2('0x30')](_0x5e990f[_0xf1a2('0x31')]);_0x5a7f3e[_0xf1a2('0x32')]=_[_0xf1a2('0x33')](_0x5a7f3e['model'],_0x5a7f3e['query']);_0x451353[_0xf1a2('0x34')]=_['intersection'](_0x5a7f3e[_0xf1a2('0x2f')],qs['fields'](_0x5e990f[_0xf1a2('0x31')]['fields']));_0x451353[_0xf1a2('0x34')]=_0x451353[_0xf1a2('0x34')][_0xf1a2('0x35')]?_0x451353[_0xf1a2('0x34')]:_0x5a7f3e[_0xf1a2('0x2f')];if(!_0x5e990f[_0xf1a2('0x31')][_0xf1a2('0x36')](_0xf1a2('0x37'))){_0x451353['limit']=qs[_0xf1a2('0x1f')](_0x5e990f[_0xf1a2('0x31')][_0xf1a2('0x1f')]);_0x451353['offset']=qs[_0xf1a2('0x1e')](_0x5e990f['query'][_0xf1a2('0x1e')]);}_0x451353[_0xf1a2('0x38')]=qs[_0xf1a2('0x39')](_0x5e990f[_0xf1a2('0x31')]['sort']);_0x451353[_0xf1a2('0x3a')]=qs['filters'](_['pick'](_0x5e990f[_0xf1a2('0x31')],_0x5a7f3e[_0xf1a2('0x32')]),_0x11f233);if(_0x5e990f[_0xf1a2('0x31')][_0xf1a2('0x3b')]){_0x451353[_0xf1a2('0x3a')]=_['merge'](_0x451353['where'],{'$or':_[_0xf1a2('0x29')](_0x11f233,function(_0x265f15){if(_0x265f15[_0xf1a2('0x2d')]!==_0xf1a2('0x3c')){var _0x144c1f={};_0x144c1f[_0x265f15[_0xf1a2('0x27')]]={'$like':'%'+_0x5e990f[_0xf1a2('0x31')][_0xf1a2('0x3b')]+'%'};return _0x144c1f;}})});}_0x451353=_[_0xf1a2('0x3d')]({},_0x451353,_0x5e990f[_0xf1a2('0x3e')]);var _0x1c0cba={'where':_0x451353[_0xf1a2('0x3a')]};return db[_0xf1a2('0x2a')]['count'](_0x1c0cba)['then'](function(_0x3459bd){_0x346a3c[_0xf1a2('0x1d')]=_0x3459bd;if(_0x5e990f[_0xf1a2('0x31')]['includeAll']){_0x451353[_0xf1a2('0x3f')]=[{'all':!![]}];}return db[_0xf1a2('0x2a')][_0xf1a2('0x40')](_0x451353);})['then'](function(_0x4527ea){_0x346a3c['rows']=_0x4527ea;return _0x346a3c;})[_0xf1a2('0x24')](respondWithFilteredResult(_0x51236a,_0x451353))[_0xf1a2('0x41')](handleError(_0x51236a,null));};exports[_0xf1a2('0x42')]=function(_0x8ee3a3,_0x37a3f8){var _0x355dfd={'raw':!![],'where':{'id':_0x8ee3a3['params']['id']}},_0x268a91={};_0x268a91['model']=_[_0xf1a2('0x30')](db[_0xf1a2('0x2a')][_0xf1a2('0x2b')]);_0x268a91[_0xf1a2('0x31')]=_[_0xf1a2('0x30')](_0x8ee3a3[_0xf1a2('0x31')]);_0x268a91[_0xf1a2('0x32')]=_['intersection'](_0x268a91[_0xf1a2('0x2f')],_0x268a91[_0xf1a2('0x31')]);_0x355dfd['attributes']=_[_0xf1a2('0x33')](_0x268a91[_0xf1a2('0x2f')],qs[_0xf1a2('0x43')](_0x8ee3a3[_0xf1a2('0x31')][_0xf1a2('0x43')]));_0x355dfd['attributes']=_0x355dfd[_0xf1a2('0x34')][_0xf1a2('0x35')]?_0x355dfd[_0xf1a2('0x34')]:_0x268a91['model'];if(_0x8ee3a3[_0xf1a2('0x31')]['includeAll']){_0x355dfd[_0xf1a2('0x3f')]=[{'all':!![]}];}_0x355dfd=_[_0xf1a2('0x3d')]({},_0x355dfd,_0x8ee3a3[_0xf1a2('0x3e')]);return db[_0xf1a2('0x2a')][_0xf1a2('0x44')](_0x355dfd)['then'](handleEntityNotFound(_0x37a3f8,null))[_0xf1a2('0x24')](respondWithResult(_0x37a3f8,null))[_0xf1a2('0x41')](handleError(_0x37a3f8,null));};exports[_0xf1a2('0x45')]=function(_0x261dd8,_0x28bb60){return db[_0xf1a2('0x2a')][_0xf1a2('0x45')](_0x261dd8[_0xf1a2('0x46')],{})[_0xf1a2('0x24')](respondWithResult(_0x28bb60,0xc9))[_0xf1a2('0x41')](handleError(_0x28bb60,null));};exports['update']=function(_0x39f586,_0x2b3a79){if(_0x39f586[_0xf1a2('0x46')]['id']){delete _0x39f586[_0xf1a2('0x46')]['id'];}return db['VoiceQueuesLog'][_0xf1a2('0x44')]({'where':{'id':_0x39f586[_0xf1a2('0x47')]['id']}})[_0xf1a2('0x24')](handleEntityNotFound(_0x2b3a79,null))['then'](saveUpdates(_0x39f586['body'],null))[_0xf1a2('0x24')](respondWithResult(_0x2b3a79,null))[_0xf1a2('0x41')](handleError(_0x2b3a79,null));};exports[_0xf1a2('0x48')]=function(_0x4334f4,_0x3cff5e){return db[_0xf1a2('0x2a')][_0xf1a2('0x44')]({'where':{'id':_0x4334f4['params']['id']}})['then'](handleEntityNotFound(_0x3cff5e,null))[_0xf1a2('0x24')](removeEntity(_0x3cff5e,null))[_0xf1a2('0x41')](handleError(_0x3cff5e,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 65e1bc9..21deeee 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 _0x4487=['../../config/logger','api','moment','request-promise','rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util'];(function(_0x493b00,_0x58db39){var _0x39b74=function(_0x377e13){while(--_0x377e13){_0x493b00['push'](_0x493b00['shift']());}};_0x39b74(++_0x58db39);}(_0x4487,0xdf));var _0x7448=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4487[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7448('0x0'));var util=require(_0x7448('0x1'));var logger=require(_0x7448('0x2'))(_0x7448('0x3'));var moment=require(_0x7448('0x4'));var BPromise=require('bluebird');var rp=require(_0x7448('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7448('0x6'));var config=require('../../config/environment');var attributes=require(_0x7448('0x7'));module[_0x7448('0x8')]=function(_0xa13b52,_0x5c9074){return _0xa13b52[_0x7448('0x9')](_0x7448('0xa'),attributes,{'tableName':_0x7448('0xb'),'paranoid':![],'indexes':[{'name':_0x7448('0xc'),'fields':[_0x7448('0xd'),_0x7448('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0xeddc=['util','api','bluebird','request-promise','path','../../config/environment','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event','dtm','lodash'];(function(_0x3fec33,_0x3ab7f1){var _0x576dac=function(_0x5a12d3){while(--_0x5a12d3){_0x3fec33['push'](_0x3fec33['shift']());}};_0x576dac(++_0x3ab7f1);}(_0xeddc,0xcf));var _0xcedd=function(_0x793b88,_0x2131d0){_0x793b88=_0x793b88-0x0;var _0x341475=_0xeddc[_0x793b88];return _0x341475;};'use strict';var _=require(_0xcedd('0x0'));var util=require(_0xcedd('0x1'));var logger=require('../../config/logger')(_0xcedd('0x2'));var moment=require('moment');var BPromise=require(_0xcedd('0x3'));var rp=require(_0xcedd('0x4'));var fs=require('fs');var path=require(_0xcedd('0x5'));var rimraf=require('rimraf');var config=require(_0xcedd('0x6'));var attributes=require(_0xcedd('0x7'));module[_0xcedd('0x8')]=function(_0x383cc4,_0x9bebc8){return _0x383cc4['define'](_0xcedd('0x9'),attributes,{'tableName':_0xcedd('0xa'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0xcedd('0xb'),_0xcedd('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index a5afe35..e076adf 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 _0xcecc=['info','VoiceQueuesLog,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcecc,0x186));var _0xccec=function(_0x4f214e,_0x21f498){_0x4f214e=_0x4f214e-0x0;var _0x65c825=_0xcecc[_0x4f214e];return _0x65c825;};'use strict';var _=require(_0xccec('0x0'));var util=require('util');var moment=require(_0xccec('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xccec('0x2'));var db=require(_0xccec('0x3'))['db'];var utils=require(_0xccec('0x4'));var logger=require(_0xccec('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xccec('0x6'));var client=jayson['client'][_0xccec('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x44ed01,_0x2a66e5,_0x5788aa){return new BPromise(function(_0x372ea6,_0x3d7b1a){return client['request'](_0x44ed01,_0x5788aa)[_0xccec('0x8')](function(_0xbbf504){logger[_0xccec('0x9')](_0xccec('0xa'),_0x2a66e5,'request\x20sent');logger[_0xccec('0xb')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x2a66e5,_0xccec('0xc'),JSON[_0xccec('0xd')](_0xbbf504));if(_0xbbf504['error']){if(_0xbbf504[_0xccec('0xe')][_0xccec('0xf')]===0x1f4){logger[_0xccec('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2a66e5,_0xbbf504[_0xccec('0xe')][_0xccec('0x10')]);return _0x3d7b1a(_0xbbf504[_0xccec('0xe')][_0xccec('0x10')]);}logger[_0xccec('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2a66e5,_0xbbf504[_0xccec('0xe')]['message']);return _0x372ea6(_0xbbf504['error']['message']);}else{logger[_0xccec('0x9')](_0xccec('0xa'),_0x2a66e5,_0xccec('0xc'));_0x372ea6(_0xbbf504[_0xccec('0x11')][_0xccec('0x10')]);}})[_0xccec('0x12')](function(_0x7abe38){logger[_0xccec('0xe')](_0xccec('0xa'),_0x2a66e5,_0x7abe38);_0x3d7b1a(_0x7abe38);});});} \ No newline at end of file +var _0x7d25=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','request','info','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment'];(function(_0x553a80,_0x29f90d){var _0x4e7151=function(_0xc9fd4b){while(--_0xc9fd4b){_0x553a80['push'](_0x553a80['shift']());}};_0x4e7151(++_0x29f90d);}(_0x7d25,0x8a));var _0x57d2=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x7d25[_0x172747];return _0x509692;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var moment=require(_0x57d2('0x1'));var BPromise=require(_0x57d2('0x2'));var rs=require(_0x57d2('0x3'));var fs=require('fs');var Redis=require(_0x57d2('0x4'));var db=require(_0x57d2('0x5'))['db'];var utils=require(_0x57d2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x57d2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f43b2,_0x263d35,_0x147194){return new BPromise(function(_0x59ae87,_0x49e3e5){return client[_0x57d2('0x8')](_0x1f43b2,_0x147194)['then'](function(_0x3a1ec5){logger[_0x57d2('0x9')](_0x57d2('0xa'),_0x263d35,'request\x20sent');logger[_0x57d2('0xb')](_0x57d2('0xc'),_0x263d35,_0x57d2('0xd'),JSON[_0x57d2('0xe')](_0x3a1ec5));if(_0x3a1ec5[_0x57d2('0xf')]){if(_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x10')]===0x1f4){logger[_0x57d2('0xf')](_0x57d2('0xa'),_0x263d35,_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x11')]);return _0x49e3e5(_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x11')]);}logger[_0x57d2('0xf')](_0x57d2('0xa'),_0x263d35,_0x3a1ec5[_0x57d2('0xf')]['message']);return _0x59ae87(_0x3a1ec5['error'][_0x57d2('0x11')]);}else{logger[_0x57d2('0x9')]('VoiceQueuesLog,\x20%s,\x20%s',_0x263d35,_0x57d2('0xd'));_0x59ae87(_0x3a1ec5[_0x57d2('0x12')]['message']);}})[_0x57d2('0x13')](function(_0x4986ad){logger[_0x57d2('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x263d35,_0x4986ad);_0x49e3e5(_0x4986ad);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 577cffc..fb2e78f 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 _0x3a31=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','download','downloads','downloadTranscribe','post','create','/:id/transcribe','put','update','destroy','multer','util','path','connect-timeout','Router'];(function(_0x2b71e0,_0x313267){var _0x36ca99=function(_0x3bf6ee){while(--_0x3bf6ee){_0x2b71e0['push'](_0x2b71e0['shift']());}};_0x36ca99(++_0x313267);}(_0x3a31,0x97));var _0x13a3=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3a31[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x13a3('0x0'));var util=require(_0x13a3('0x1'));var path=require(_0x13a3('0x2'));var timeout=require(_0x13a3('0x3'));var express=require('express');var router=express[_0x13a3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x13a3('0x5'));var interaction=require(_0x13a3('0x6'));var config=require(_0x13a3('0x7'));var controller=require(_0x13a3('0x8'));router['get']('/',auth[_0x13a3('0x9')](),controller[_0x13a3('0xa')]);router[_0x13a3('0xb')](_0x13a3('0xc'),auth[_0x13a3('0x9')](),controller[_0x13a3('0xd')]);router[_0x13a3('0xb')](_0x13a3('0xe'),auth['isAuthenticated'](),controller[_0x13a3('0xf')]);router[_0x13a3('0xb')](_0x13a3('0x10'),auth[_0x13a3('0x9')](),controller[_0x13a3('0x11')]);router[_0x13a3('0xb')]('/:id/downloads',controller[_0x13a3('0x12')]);router[_0x13a3('0xb')]('/:id/transcribe',auth[_0x13a3('0x9')](),controller[_0x13a3('0x13')]);router[_0x13a3('0x14')]('/',auth[_0x13a3('0x9')](),controller[_0x13a3('0x15')]);router[_0x13a3('0x14')](_0x13a3('0x16'),auth['isAuthenticated'](),controller['runTranscribe']);router[_0x13a3('0x17')](_0x13a3('0xe'),auth[_0x13a3('0x9')](),controller[_0x13a3('0x18')]);router['delete'](_0x13a3('0xe'),auth['isAuthenticated'](),controller[_0x13a3('0x19')]);module['exports']=router; \ No newline at end of file +var _0xbeaf=['exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','create','post','runTranscribe','put','update','destroy'];(function(_0x222efe,_0x350c67){var _0xe44156=function(_0x3591e1){while(--_0x3591e1){_0x222efe['push'](_0x222efe['shift']());}};_0xe44156(++_0x350c67);}(_0xbeaf,0xeb));var _0xfbea=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbeaf[_0x126558];return _0x1f6d14;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xfbea('0x0'));var express=require(_0xfbea('0x1'));var router=express[_0xfbea('0x2')]();var fs_extra=require(_0xfbea('0x3'));var auth=require(_0xfbea('0x4'));var interaction=require(_0xfbea('0x5'));var config=require('../../config/environment');var controller=require(_0xfbea('0x6'));router[_0xfbea('0x7')]('/',auth[_0xfbea('0x8')](),controller[_0xfbea('0x9')]);router[_0xfbea('0x7')](_0xfbea('0xa'),auth['isAuthenticated'](),controller[_0xfbea('0xb')]);router[_0xfbea('0x7')](_0xfbea('0xc'),auth[_0xfbea('0x8')](),controller[_0xfbea('0xd')]);router[_0xfbea('0x7')](_0xfbea('0xe'),auth[_0xfbea('0x8')](),controller['download']);router[_0xfbea('0x7')](_0xfbea('0xf'),controller[_0xfbea('0x10')]);router['get'](_0xfbea('0x11'),auth[_0xfbea('0x8')](),controller[_0xfbea('0x12')]);router['post']('/',auth[_0xfbea('0x8')](),controller[_0xfbea('0x13')]);router[_0xfbea('0x14')](_0xfbea('0x11'),auth['isAuthenticated'](),controller[_0xfbea('0x15')]);router[_0xfbea('0x16')]('/:id',auth[_0xfbea('0x8')](),controller[_0xfbea('0x17')]);router['delete'](_0xfbea('0xc'),auth[_0xfbea('0x8')](),controller[_0xfbea('0x18')]);module[_0xfbea('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index d75f4cd..62629bb 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 _0x2e6b=['getDataValue','value','extname','STRING','setDataValue','channel','membername','split','INTEGER','TEXT','NEW','FLOAT','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','moment','path','exports'];(function(_0x16e7a7,_0x17e3d1){var _0x23d992=function(_0x1724c4){while(--_0x1724c4){_0x16e7a7['push'](_0x16e7a7['shift']());}};_0x23d992(++_0x17e3d1);}(_0x2e6b,0x1a1));var _0xb2e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2e6b[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb2e6('0x0'));var path=require(_0xb2e6('0x1'));module[_0xb2e6('0x2')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xb2e6('0x3')](_0xb2e6('0x4'))?path[_0xb2e6('0x5')](this[_0xb2e6('0x3')]('value')):undefined;}},'uniqueid':{'type':Sequelize[_0xb2e6('0x6')]},'channel':{'type':Sequelize[_0xb2e6('0x6')],'set':function(_0x29e55f){if(_0x29e55f){this[_0xb2e6('0x7')](_0xb2e6('0x8'),_0x29e55f);this['setDataValue'](_0xb2e6('0x9'),_0x29e55f[_0xb2e6('0xa')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xb2e6('0x6')]},'calleridnum':{'type':Sequelize[_0xb2e6('0x6')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xb2e6('0x6')]},'connectedlinename':{'type':Sequelize[_0xb2e6('0x6')]},'accountcode':{'type':Sequelize[_0xb2e6('0x6')]},'context':{'type':Sequelize[_0xb2e6('0x6')]},'exten':{'type':Sequelize[_0xb2e6('0x6')]},'value':{'type':Sequelize[_0xb2e6('0x6')]},'type':{'type':Sequelize[_0xb2e6('0x6')]},'rating':{'type':Sequelize[_0xb2e6('0xb')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xb2e6('0x6')]},'userDisposition':{'type':Sequelize[_0xb2e6('0x6')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize[_0xb2e6('0xc')]},'transcribeName':{'type':Sequelize[_0xb2e6('0x6')]},'transcribeStatus':{'type':Sequelize[_0xb2e6('0x6')],'defaultValue':_0xb2e6('0xd')},'fileUri':{'type':Sequelize[_0xb2e6('0xc')]},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize[_0xb2e6('0xc')]},'sentiment':{'type':Sequelize['STRING']},'sPositive':{'type':Sequelize[_0xb2e6('0xe')]},'sNegative':{'type':Sequelize[_0xb2e6('0xe')]},'sNeutral':{'type':Sequelize[_0xb2e6('0xe')]},'sMixed':{'type':Sequelize[_0xb2e6('0xe')]},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize[_0xb2e6('0xf')],'get':function(){return moment(this[_0xb2e6('0x3')](_0xb2e6('0x10')))[_0xb2e6('0x11')](_0xb2e6('0x12'))[_0xb2e6('0x13')]();}},'updatedAt':{'type':Sequelize[_0xb2e6('0xf')],'get':function(){return moment(this[_0xb2e6('0x3')](_0xb2e6('0x14')))[_0xb2e6('0x11')]('MM-DD-YYYY\x20HH:mm')[_0xb2e6('0x13')]();}}}; \ No newline at end of file +var _0x8a06=['channel','membername','split','INTEGER','TEXT','NEW','FLOAT','BOOLEAN','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','exports','getDataValue','value','STRING','setDataValue'];(function(_0x36a5d5,_0xf25c69){var _0x1c356e=function(_0x106192){while(--_0x106192){_0x36a5d5['push'](_0x36a5d5['shift']());}};_0x1c356e(++_0xf25c69);}(_0x8a06,0x160));var _0x68a0=function(_0x332109,_0x474add){_0x332109=_0x332109-0x0;var _0x7a6ab2=_0x8a06[_0x332109];return _0x7a6ab2;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require('path');module[_0x68a0('0x0')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x68a0('0x1')](_0x68a0('0x2'))?path['extname'](this['getDataValue'](_0x68a0('0x2'))):undefined;}},'uniqueid':{'type':Sequelize[_0x68a0('0x3')]},'channel':{'type':Sequelize[_0x68a0('0x3')],'set':function(_0x3fe37e){if(_0x3fe37e){this[_0x68a0('0x4')](_0x68a0('0x5'),_0x3fe37e);this['setDataValue'](_0x68a0('0x6'),_0x3fe37e[_0x68a0('0x7')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x68a0('0x3')]},'calleridname':{'type':Sequelize[_0x68a0('0x3')]},'connectedlinenum':{'type':Sequelize[_0x68a0('0x3')]},'connectedlinename':{'type':Sequelize[_0x68a0('0x3')]},'accountcode':{'type':Sequelize[_0x68a0('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x68a0('0x3')]},'value':{'type':Sequelize[_0x68a0('0x3')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0x68a0('0x8')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x68a0('0x3')]},'userSecondDisposition':{'type':Sequelize[_0x68a0('0x3')]},'userThirdDisposition':{'type':Sequelize[_0x68a0('0x3')]},'location':{'type':Sequelize[_0x68a0('0x9')]},'transcribeName':{'type':Sequelize[_0x68a0('0x3')]},'transcribeStatus':{'type':Sequelize[_0x68a0('0x3')],'defaultValue':_0x68a0('0xa')},'fileUri':{'type':Sequelize[_0x68a0('0x9')]},'fileText':{'type':Sequelize[_0x68a0('0x9')]},'failureReason':{'type':Sequelize[_0x68a0('0x9')]},'sentiment':{'type':Sequelize[_0x68a0('0x3')]},'sPositive':{'type':Sequelize[_0x68a0('0xb')]},'sNegative':{'type':Sequelize[_0x68a0('0xb')]},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize[_0x68a0('0xb')]},'tempSentiment':{'type':Sequelize[_0x68a0('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x68a0('0x1')](_0x68a0('0xd')))[_0x68a0('0xe')](_0x68a0('0xf'))[_0x68a0('0x10')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x68a0('0x1')]('updatedAt'))[_0x68a0('0xe')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 3d07551..a0c9f7d 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 _0x583c=['moment','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','VoiceRecording','rawAttributes','fieldName','key','model','differenceBy','format','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','find','create','body','params','describe','download','../../components/encryptor','type','uniqueid','%s.cypher','existsSync','recording','value','Sequelize','VoiceRecording\x20not\x20found','filename','unlink','message','downloads','sequelize','col','token','push','$and','decryptFile','ValidationError','extname','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','unlinkSync','.cypher','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJob','runTranscribe','secrets','Voice\x20Recording\x20not\x20found','findOne','language','Transcribe\x20not\x20configured','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','html-pdf','eml-format','rimraf','zip-dir','request-promise'];(function(_0xb46ca8,_0x4f87be){var _0x52ed62=function(_0x48e5e0){while(--_0x48e5e0){_0xb46ca8['push'](_0xb46ca8['shift']());}};_0x52ed62(++_0x4f87be);}(_0x583c,0x12b));var _0xc583=function(_0x487496,_0x249683){_0x487496=_0x487496-0x0;var _0x539dc8=_0x583c[_0x487496];return _0x539dc8;};'use strict';var pdf=require(_0xc583('0x0'));var emlformat=require(_0xc583('0x1'));var rimraf=require(_0xc583('0x2'));var zipdir=require(_0xc583('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc583('0x4'));var moment=require(_0xc583('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc583('0x6'));var path=require(_0xc583('0x7'));var sox=require('sox');var csv=require(_0xc583('0x8'));var ejs=require(_0xc583('0x9'));var fs=require('fs');var fs_extra=require(_0xc583('0xa'));var _=require(_0xc583('0xb'));var squel=require('squel');var crypto=require(_0xc583('0xc'));var jsforce=require(_0xc583('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc583('0x8'));var querystring=require(_0xc583('0xe'));var Papa=require(_0xc583('0xf'));var AWS=require(_0xc583('0x10'));var uuidv4=require(_0xc583('0x11'));var Redis=require('ioredis');var authService=require(_0xc583('0x12'));var qs=require(_0xc583('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc583('0x14'));var logger=require(_0xc583('0x15'))('api');var utils=require(_0xc583('0x16'));var config=require(_0xc583('0x17'));var licenseUtil=require(_0xc583('0x18'));var db=require(_0xc583('0x19'))['db'];function respondWithStatusCode(_0x33c2c5,_0xd28e44){_0xd28e44=_0xd28e44||0xcc;return function(_0x183cca){if(_0x183cca){return _0x33c2c5[_0xc583('0x1a')](_0xd28e44);}return _0x33c2c5[_0xc583('0x1b')](_0xd28e44)['end']();};}function respondWithResult(_0x21cf25,_0x51ecd7){_0x51ecd7=_0x51ecd7||0xc8;return function(_0x19f46a){if(_0x19f46a){return _0x21cf25[_0xc583('0x1b')](_0x51ecd7)['json'](_0x19f46a);}};}function respondWithFilteredResult(_0x263552,_0x311ad5){return function(_0x5b1871){if(_0x5b1871){var _0x7d1690=_0x5b1871[_0xc583('0x1c')],_0x4ca776=_0x311ad5[_0xc583('0x1d')],_0x5127fa=_0x311ad5[_0xc583('0x1d')]+_0x311ad5['limit'],_0x21cf22;if(_0x5127fa>=_0x7d1690){_0x5127fa=_0x7d1690;_0x21cf22=0xc8;}else{_0x21cf22=0xce;}_0x263552[_0xc583('0x1b')](_0x21cf22);return _0x263552['set'](_0xc583('0x1e'),_0x4ca776+'-'+_0x5127fa+'/'+_0x7d1690)[_0xc583('0x1f')](_0x5b1871);}return null;};}function patchUpdates(_0xfd9a60){return function(_0x774f4c){try{jsonpatch[_0xc583('0x20')](_0x774f4c,_0xfd9a60,!![]);}catch(_0x12b910){return BPromise[_0xc583('0x21')](_0x12b910);}return _0x774f4c[_0xc583('0x22')]();};}function saveUpdates(_0x37fcd4,_0x197b0a){return function(_0x29a9be){if(_0x29a9be){return _0x29a9be[_0xc583('0x23')](_0x37fcd4)[_0xc583('0x24')](function(_0x478ee1){return _0x478ee1;});}return null;};}function removeEntity(_0x542256,_0x34b353){return function(_0x3e075c){if(_0x3e075c){return _0x3e075c[_0xc583('0x25')]()['then'](function(){_0x542256[_0xc583('0x1b')](0xcc)[_0xc583('0x26')]();});}};}function handleEntityNotFound(_0x37f156,_0x4688bd){return function(_0x25c5af){if(!_0x25c5af){_0x37f156['sendStatus'](0x194);}return _0x25c5af;};}function handleError(_0x4cad36,_0x45871c){_0x45871c=_0x45871c||0x1f4;return function(_0x4f366b){logger[_0xc583('0x27')](_0x4f366b[_0xc583('0x28')]);if(_0x4f366b[_0xc583('0x29')]){delete _0x4f366b[_0xc583('0x29')];}_0x4cad36[_0xc583('0x1b')](_0x45871c)['send'](_0x4f366b);};}exports[_0xc583('0x2a')]=function(_0x44f76a,_0x4adde3){var _0x162c85={},_0x483357={},_0x2c9088={'count':0x0,'rows':[]};var _0x8d4ecb=_[_0xc583('0x2b')](db[_0xc583('0x2c')][_0xc583('0x2d')],function(_0x19079b){return{'name':_0x19079b[_0xc583('0x2e')],'type':_0x19079b['type'][_0xc583('0x2f')]};});_0x483357[_0xc583('0x30')]=_[_0xc583('0x31')](_[_0xc583('0x2b')](_0x8d4ecb,_0xc583('0x29')),[_0xc583('0x32')]);_0x483357['query']=_[_0xc583('0x33')](_0x44f76a['query']);_0x483357['filters']=_[_0xc583('0x34')](_0x483357[_0xc583('0x30')],_0x483357[_0xc583('0x35')]);_0x162c85[_0xc583('0x36')]=_[_0xc583('0x34')](_0x483357['model'],qs[_0xc583('0x37')](_0x44f76a[_0xc583('0x35')][_0xc583('0x37')]));_0x162c85['attributes']=_0x162c85[_0xc583('0x36')]['length']?_0x162c85[_0xc583('0x36')]:_0x483357[_0xc583('0x30')];if(!_0x44f76a[_0xc583('0x35')][_0xc583('0x38')](_0xc583('0x39'))){_0x162c85['limit']=qs[_0xc583('0x3a')](_0x44f76a['query'][_0xc583('0x3a')]);_0x162c85['offset']=qs[_0xc583('0x1d')](_0x44f76a[_0xc583('0x35')][_0xc583('0x1d')]);}_0x162c85[_0xc583('0x3b')]=qs[_0xc583('0x3c')](_0x44f76a[_0xc583('0x35')]['sort']);_0x162c85['where']=qs[_0xc583('0x3d')](_[_0xc583('0x3e')](_0x44f76a['query'],_0x483357[_0xc583('0x3d')]),_0x8d4ecb);if(_0x44f76a[_0xc583('0x35')][_0xc583('0x3f')]){_0x162c85[_0xc583('0x40')]=_[_0xc583('0x41')](_0x162c85[_0xc583('0x40')],{'$or':_['map'](_0x8d4ecb,function(_0x192a11){if(_0x192a11['type']!==_0xc583('0x42')){var _0x22cc57={};_0x22cc57[_0x192a11[_0xc583('0x29')]]={'$like':'%'+_0x44f76a['query']['filter']+'%'};return _0x22cc57;}})});}_0x162c85=_['merge']({},_0x162c85,_0x44f76a[_0xc583('0x43')]);var _0x46b31f={'where':_0x162c85[_0xc583('0x40')]};return db[_0xc583('0x2c')]['count'](_0x46b31f)[_0xc583('0x24')](function(_0x136776){_0x2c9088['count']=_0x136776;if(_0x44f76a['query'][_0xc583('0x44')]){_0x162c85['include']=[{'all':!![]}];}return db[_0xc583('0x2c')][_0xc583('0x45')](_0x162c85);})[_0xc583('0x24')](function(_0x40b888){_0x2c9088['rows']=_0x40b888;return _0x2c9088;})[_0xc583('0x24')](respondWithFilteredResult(_0x4adde3,_0x162c85))[_0xc583('0x46')](handleError(_0x4adde3,null));};exports[_0xc583('0x47')]=function(_0x164133,_0x2c1c22){var _0x5e6e7e={'raw':![],'where':{'id':_0x164133['params']['id']}},_0x3ffeb7={};_0x3ffeb7['model']=_[_0xc583('0x33')](db[_0xc583('0x2c')]['rawAttributes']);_0x3ffeb7['query']=_[_0xc583('0x33')](_0x164133[_0xc583('0x35')]);_0x3ffeb7[_0xc583('0x3d')]=_[_0xc583('0x34')](_0x3ffeb7['model'],_0x3ffeb7[_0xc583('0x35')]);_0x5e6e7e['attributes']=_[_0xc583('0x34')](_0x3ffeb7['model'],qs[_0xc583('0x37')](_0x164133[_0xc583('0x35')][_0xc583('0x37')]));_0x5e6e7e[_0xc583('0x36')]=_0x5e6e7e[_0xc583('0x36')]['length']?_0x5e6e7e[_0xc583('0x36')]:_0x3ffeb7[_0xc583('0x30')];if(_0x164133[_0xc583('0x35')]['includeAll']){_0x5e6e7e['include']=[{'all':!![]}];}_0x5e6e7e=_['merge']({},_0x5e6e7e,_0x164133[_0xc583('0x43')]);return db['VoiceRecording'][_0xc583('0x48')](_0x5e6e7e)[_0xc583('0x24')](handleEntityNotFound(_0x2c1c22,null))[_0xc583('0x24')](respondWithResult(_0x2c1c22,null))[_0xc583('0x46')](handleError(_0x2c1c22,null));};exports[_0xc583('0x49')]=function(_0x41c6ea,_0x302038){return db[_0xc583('0x2c')][_0xc583('0x49')](_0x41c6ea[_0xc583('0x4a')],{})[_0xc583('0x24')](respondWithResult(_0x302038,0xc9))['catch'](handleError(_0x302038,null));};exports[_0xc583('0x23')]=function(_0x121262,_0x453df7){if(_0x121262[_0xc583('0x4a')]['id']){delete _0x121262['body']['id'];}return db[_0xc583('0x2c')][_0xc583('0x48')]({'where':{'id':_0x121262[_0xc583('0x4b')]['id']}})[_0xc583('0x24')](handleEntityNotFound(_0x453df7,null))[_0xc583('0x24')](saveUpdates(_0x121262[_0xc583('0x4a')],null))[_0xc583('0x24')](respondWithResult(_0x453df7,null))[_0xc583('0x46')](handleError(_0x453df7,null));};exports[_0xc583('0x4c')]=function(_0x5b2fcc,_0x1f4901){return db[_0xc583('0x2c')][_0xc583('0x4c')]()[_0xc583('0x24')](respondWithResult(_0x1f4901,null))[_0xc583('0x46')](handleError(_0x1f4901,null));};exports[_0xc583('0x4d')]=function(_0x6dbd82,_0x465c71,_0x21a956){var _0xa03d53=require(_0xc583('0x4e'));var _0x7be0b3=![];var _0x305239={};if(_0x6dbd82['query'][_0xc583('0x4f')]&&_0x6dbd82[_0xc583('0x35')][_0xc583('0x4f')]===_0xc583('0x50')){_0x305239[_0xc583('0x50')]=_0x6dbd82[_0xc583('0x4b')]['id'];}else{_0x305239['id']=_0x6dbd82[_0xc583('0x4b')]['id'];}return db[_0xc583('0x2c')][_0xc583('0x48')]({'where':_0x305239,'attributes':['id','value'],'raw':!![]})[_0xc583('0x24')](handleEntityNotFound(_0x465c71,null))[_0xc583('0x24')](function(_0x56eb65){if(_0x56eb65){var _0x59ce34=_0x56eb65['value'];var _0x2bb764=util['format'](_0xc583('0x51'),_0x59ce34);if(fs[_0xc583('0x52')](_0x2bb764)){_0x7be0b3=!![];return _0xa03d53['decryptFile'](_0x2bb764,_0x59ce34,config['secrets'][_0xc583('0x53')])[_0xc583('0x24')](function(){return _0x56eb65;});}return _0x56eb65;}})[_0xc583('0x24')](function(_0x30e9ef){if(_0x30e9ef){var _0x176fac=_0x30e9ef[_0xc583('0x54')];if(!fs[_0xc583('0x52')](_0x176fac)){throw new db[(_0xc583('0x55'))]['ValidationError'](_0xc583('0x56'));}if(_0x30e9ef[_0xc583('0x57')]){return _0x465c71[_0xc583('0x4d')](_0x176fac,_0x30e9ef[_0xc583('0x57')]+path['extname'](_0x176fac),function(){if(_0x7be0b3){fs[_0xc583('0x58')](_0x176fac);}});}else{return _0x465c71[_0xc583('0x4d')](_0x176fac,function(_0x54332e){if(_0x7be0b3){fs['unlink'](_0x176fac);}});}}})[_0xc583('0x46')](function(_0x5ccfe7){if(_0x5ccfe7[_0xc583('0x59')]===_0xc583('0x56')){_0x465c71[_0xc583('0x1b')](0x194)['send']('Not\x20found');}else{return handleError(_0x465c71,null);}});};exports[_0xc583('0x5a')]=function(_0x3a5033,_0x4276d9,_0xd85099){var _0x52aa76=require(_0xc583('0x4e'));var _0x2e3005=![];var _0x4a664f={'$and':[db['sequelize'][_0xc583('0x40')](db['sequelize']['fn']('MD5',db[_0xc583('0x5b')][_0xc583('0x5c')](_0xc583('0x50'))),_0x3a5033[_0xc583('0x35')][_0xc583('0x5d')])]};if(_0x3a5033['query']['type']&&_0x3a5033[_0xc583('0x35')][_0xc583('0x4f')]==='uniqueid'){_0x4a664f['$and'][_0xc583('0x5e')]({'uniqueid':_0x3a5033['params']['id']});}else{_0x4a664f[_0xc583('0x5f')][_0xc583('0x5e')]({'id':_0x3a5033['params']['id']});}return db[_0xc583('0x2c')]['find']({'where':_0x4a664f,'attributes':['id',_0xc583('0x54')],'raw':!![]})[_0xc583('0x24')](handleEntityNotFound(_0x4276d9,null))['then'](function(_0xf672d1){if(_0xf672d1){var _0x10bd9f=util[_0xc583('0x32')](_0xc583('0x51'),_0xf672d1[_0xc583('0x54')]);if(fs[_0xc583('0x52')](_0x10bd9f)){_0x2e3005=!![];return _0x52aa76[_0xc583('0x60')](_0x10bd9f,_0xf672d1[_0xc583('0x54')],config['secrets']['recording'])['then'](function(){return _0xf672d1;});}return _0xf672d1;}})[_0xc583('0x24')](function(_0x4d498b){if(_0x4d498b){if(!fs[_0xc583('0x52')](_0x4d498b[_0xc583('0x54')])){throw new db[(_0xc583('0x55'))][(_0xc583('0x61'))](_0xc583('0x56'));}if(_0x4d498b[_0xc583('0x57')]){return _0x4276d9[_0xc583('0x4d')](_0x4d498b[_0xc583('0x54')],_0x4d498b['filename']+path[_0xc583('0x62')](_0x4d498b[_0xc583('0x54')]),function(){if(_0x2e3005){fs[_0xc583('0x58')](_0x4d498b[_0xc583('0x54')]);}});}else{return _0x4276d9[_0xc583('0x4d')](_0x4d498b[_0xc583('0x54')],function(_0x548f1c){if(_0x2e3005){fs[_0xc583('0x58')](_0x4d498b[_0xc583('0x54')]);}});}}})[_0xc583('0x46')](handleError(_0x4276d9,null));};exports[_0xc583('0x25')]=function(_0x3b3a3a,_0x2b719f){return db['VoiceRecording'][_0xc583('0x48')]({'where':{'id':_0x3b3a3a[_0xc583('0x4b')]['id']}})[_0xc583('0x24')](function(_0x54e331){if(!_0x54e331)throw new ReferenceError(_0xc583('0x63'));return _0x54e331;})['then'](function(_0x326ee3){var _0x26d063=_0x326ee3[_0xc583('0x54')];logger[_0xc583('0x64')](_0xc583('0x65'),_0x26d063);if(!_[_0xc583('0x66')](_0x326ee3[_0xc583('0x54')])&&fs['existsSync'](_0x26d063)){logger['info']('File:\x20\x22'+_0x26d063+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xc583('0x67')](_0x26d063);}_0x26d063=_0x26d063+_0xc583('0x68');if(!_[_0xc583('0x66')](_0x326ee3[_0xc583('0x54')])&&fs[_0xc583('0x52')](_0x26d063)){logger[_0xc583('0x64')](_0xc583('0x69')+_0x26d063+_0xc583('0x6a'));fs[_0xc583('0x67')](_0x26d063);}return _0x326ee3;})[_0xc583('0x24')](function(_0x4c9516){if(!_0x4c9516)throw new InternalError();return _0x4c9516[_0xc583('0x25')]();})[_0xc583('0x24')](function(){_0x2b719f['status'](0xcc)['end']();})['catch'](handleError(_0x2b719f,null));};function getBucketslist(_0x118682,_0x10037e,_0x3d884e){return new Promise(function(_0x3436b5,_0x2c992f){var _0x1e6cc3=new AWS['S3']({'accessKeyId':_0x10037e,'secretAccessKey':_0x118682,'region':_0x3d884e});_0x1e6cc3[_0xc583('0x6b')]({},function(_0x333ae9,_0x18a05e){if(_0x333ae9){return _0x2c992f(_0x333ae9);}else{return _0x3436b5(_0x18a05e);}});});}function createBucket(_0x516fcb,_0x442844,_0x4361c8,_0x5003ed){return new Promise(function(_0x5ba55,_0x1cd93a){var _0x8536e5=new AWS['S3']({'accessKeyId':_0x442844,'secretAccessKey':_0x516fcb,'region':_0x4361c8});_0x8536e5[_0xc583('0x6c')]({'Bucket':_0x5003ed},function(_0x3658d0,_0x562135){if(_0x3658d0){return _0x1cd93a(_0x3658d0);}else{return _0x5ba55(_0x562135);}});});}function uploadFile(_0x5739c9,_0x39cee2,_0x2531e9,_0x2f0aa9,_0x50ef13,_0x4d6582){return new Promise(function(_0x526a7e,_0x429a0e){var _0x498c19=new AWS['S3']({'accessKeyId':_0x39cee2,'secretAccessKey':_0x5739c9,'region':_0x2531e9});_0x498c19['upload']({'Bucket':_0x2f0aa9,'Key':_0x50ef13,'Body':_0x4d6582},function(_0x4fb621,_0x1c7323){if(_0x4fb621){return _0x429a0e(_0x4fb621);}else{return _0x526a7e(_0x1c7323);}});});}function startTranscribe(_0x3e8319,_0x3cd0fb,_0x397355,_0x40796c,_0x5150b4,_0x452a3e){return new Promise(function(_0x14d6aa,_0x9a09b0){var _0x4dcde0=new AWS[(_0xc583('0x6d'))]({'accessKeyId':_0x3cd0fb,'secretAccessKey':_0x3e8319,'region':_0x397355});_0x4dcde0[_0xc583('0x6e')]({'TranscriptionJobName':_0x40796c,'LanguageCode':_0x5150b4,'Media':{'MediaFileUri':_0x452a3e}},function(_0x4ce2e3,_0x527e77){if(_0x4ce2e3){return _0x9a09b0(_0x4ce2e3);}else{return _0x14d6aa(_0x527e77);}});});}function transcribe(_0x41647a,_0x1e4691,_0x383b93,_0x369d20,_0x3f0582,_0x10651c,_0x222e84){return new Promise(function(_0x335e18,_0x4dfd7f){var _0x288c4e={};logger[_0xc583('0x64')](util[_0xc583('0x32')](_0xc583('0x6f'),_0x41647a,_0x3f0582));return uploadFile(_0x1e4691,_0x383b93,_0x369d20,_0x3f0582,path[_0xc583('0x70')](_0x10651c),fs[_0xc583('0x71')](_0x10651c))[_0xc583('0x24')](function(_0x149051){logger[_0xc583('0x64')](util[_0xc583('0x32')](_0xc583('0x72'),_0x41647a,_0x3f0582,_0x149051[_0xc583('0x73')]));_0x288c4e[_0xc583('0x74')]=_0x149051[_0xc583('0x75')];_0x288c4e[_0xc583('0x76')]=_0x149051[_0xc583('0x73')];logger[_0xc583('0x64')](util[_0xc583('0x32')](_0xc583('0x77'),_0x41647a));return startTranscribe(_0x1e4691,_0x383b93,_0x369d20,uuidv4(),_0x222e84,_0x149051[_0xc583('0x73')]);})[_0xc583('0x24')](function(_0xb89d97){logger[_0xc583('0x64')](util[_0xc583('0x32')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x41647a,_0xb89d97['TranscriptionJob'][_0xc583('0x78')]));_0x288c4e[_0xc583('0x79')]=_0xb89d97['TranscriptionJob']['TranscriptionJobName'];_0x288c4e[_0xc583('0x7a')]=_0xb89d97[_0xc583('0x7b')]['TranscriptionJobStatus'];return _0x335e18(_0x288c4e);})['catch'](function(_0x21b3ac){return _0x4dfd7f(_0x21b3ac);});});}exports[_0xc583('0x7c')]=function(_0x38b976,_0x5e28ab,_0x53bb85){var _0xcb06d4;var _0x125abc;var _0x4050d2;var _0x55c679=require(_0xc583('0x4e'));return db[_0xc583('0x2c')]['findOne']({'where':{'id':_0x38b976[_0xc583('0x4b')]['id']}})[_0xc583('0x24')](function(_0x37734f){if(_0x37734f){var _0x429970=util[_0xc583('0x32')](_0xc583('0x51'),_0x37734f[_0xc583('0x54')]);if(fs['existsSync'](_0x429970)){cypher=!![];return _0x55c679['decryptFile'](_0x429970,_0x37734f['value'],config[_0xc583('0x7d')][_0xc583('0x53')])[_0xc583('0x24')](function(){return _0x37734f;});}return _0x37734f;}})[_0xc583('0x24')](function(_0xda5f7b){if(!_0xda5f7b){throw new db[(_0xc583('0x55'))][(_0xc583('0x61'))](_0xc583('0x7e'));}_0x125abc=_0xda5f7b;return db['Setting'][_0xc583('0x7f')]({'where':{'id':0x1}});})[_0xc583('0x24')](handleEntityNotFound(_0x5e28ab,null))[_0xc583('0x24')](function(_0x1f2d3d){if(_0x1f2d3d){_0xcb06d4=_0x1f2d3d;if(!_0xcb06d4['transcribe']||!_0xcb06d4['transcribeAccountId']||!_0xcb06d4['transcribeRegion']||!_0xcb06d4[_0xc583('0x80')]||!_0xcb06d4[_0xc583('0x74')]){throw new db[(_0xc583('0x55'))][(_0xc583('0x61'))](_0xc583('0x81'));}if(_0x38b976[_0xc583('0x4a')]['runSentiment']&&(!_0xcb06d4['sentiment']||!_0xcb06d4[_0xc583('0x82')]||!_0xcb06d4[_0xc583('0x83')]||!_0xcb06d4['language']||!_0xcb06d4[_0xc583('0x74')])){throw new db[(_0xc583('0x55'))][(_0xc583('0x61'))](_0xc583('0x84'));}return db[_0xc583('0x85')][_0xc583('0x7f')]({'where':{'id':_0xcb06d4['transcribeAccountId']}});}})[_0xc583('0x24')](function(_0x281210){if(!_0x281210){throw new db[(_0xc583('0x55'))][(_0xc583('0x61'))](_0xc583('0x86'));}if(!_0x281210[_0xc583('0x87')]||!_0x281210[_0xc583('0x88')]){throw new db[(_0xc583('0x55'))][(_0xc583('0x61'))](_0xc583('0x89'));}_0x4050d2=_0x281210;return getBucketslist(_0x4050d2['data1'],_0x4050d2[_0xc583('0x88')],_0xcb06d4[_0xc583('0x8a')]);})[_0xc583('0x24')](function(_0x50c7d0){if(_0x50c7d0&&_0x50c7d0[_0xc583('0x8b')]){var _0x56de40=_[_0xc583('0x48')](_0x50c7d0[_0xc583('0x8b')],function(_0x1cfb53){return _0x1cfb53[_0xc583('0x8c')]===_0xcb06d4[_0xc583('0x74')];});if(!_0x56de40){logger[_0xc583('0x64')](util[_0xc583('0x32')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x38b976[_0xc583('0x4b')]['id'],_0xcb06d4['bucket']));return createBucket(_0x4050d2[_0xc583('0x87')],_0x4050d2['data2'],_0xcb06d4[_0xc583('0x8a')],_0xcb06d4[_0xc583('0x74')]);}logger[_0xc583('0x64')](util[_0xc583('0x32')](_0xc583('0x8d'),_0x38b976[_0xc583('0x4b')]['id'],_0xcb06d4[_0xc583('0x74')]));return;}})[_0xc583('0x24')](function(_0x53f66a){if(_0x125abc[_0xc583('0x7a')]===_0xc583('0x8e')){return transcribe(_0x38b976[_0xc583('0x4b')]['id'],_0x4050d2[_0xc583('0x87')],_0x4050d2[_0xc583('0x88')],_0xcb06d4['transcribeRegion'],_0xcb06d4[_0xc583('0x74')],_0x125abc[_0xc583('0x54')],_0xcb06d4[_0xc583('0x80')]);}else{logger['info'](util['format'](_0xc583('0x8f'),_0x38b976[_0xc583('0x4b')]['id']));return{'transcribeStatus':_0xc583('0x90')};}})[_0xc583('0x24')](function(_0x827154){if(_0x827154){_0x827154[_0xc583('0x91')]=_0x38b976['body'][_0xc583('0x92')];return _0x125abc[_0xc583('0x93')](_0x827154);}})[_0xc583('0x24')](respondWithResult(_0x5e28ab,null))[_0xc583('0x46')](handleError(_0x5e28ab,null));};function writeFile(_0x56c368,_0x519375){return new Promise(function(_0x49766b,_0x558345){fs[_0xc583('0x94')](_0x519375,_0x56c368,function(_0x5f56be,_0x2628a3){if(_0x5f56be){return _0x558345(_0x5f56be);}else{return _0x49766b(_0x2628a3);}});});}exports[_0xc583('0x95')]=function(_0x5b9b20,_0x5ebdb6,_0x1f1dfc){return db[_0xc583('0x2c')][_0xc583('0x7f')]({'where':{'id':_0x5b9b20[_0xc583('0x4b')]['id']}})[_0xc583('0x24')](handleEntityNotFound(_0x5ebdb6))['then'](function(_0x46e052){if(_0x46e052&&_0x46e052['fileText']){var _0xeed0a4=_0x46e052[_0xc583('0x96')];var _0x28cca4=config[_0xc583('0x97')]+'/server/files/transcribes/transcribe_'+_0x46e052['id']+'.txt';if(fs['existsSync'](_0x28cca4)){return _0x28cca4;}return writeFile(_0xeed0a4,_0x28cca4)[_0xc583('0x24')](function(){return _0x28cca4;});}else{throw new db[(_0xc583('0x55'))][(_0xc583('0x61'))]('Transcript\x20not\x20available');}})[_0xc583('0x24')](function(_0x1d4b7c){return _0x5ebdb6['download'](_0x1d4b7c);})[_0xc583('0x46')](handleError(_0x5ebdb6));}; \ No newline at end of file +var _0x056b=['[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','language','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','findOne','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','then','destroy','error','stack','name','send','index','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','filters','pick','filter','where','merge','map','options','includeAll','include','findAll','rows','catch','params','find','create','body','update','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','sequelize','MD5','col','token','$and','push','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','TranscribeService','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request'];(function(_0x4d0df6,_0x4634f3){var _0x4e2615=function(_0x5285e2){while(--_0x5285e2){_0x4d0df6['push'](_0x4d0df6['shift']());}};_0x4e2615(++_0x4634f3);}(_0x056b,0xb6));var _0xb056=function(_0x34e51c,_0x1f46b0){_0x34e51c=_0x34e51c-0x0;var _0x31643c=_0x056b[_0x34e51c];return _0x31643c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb056('0x0'));var rimraf=require(_0xb056('0x1'));var zipdir=require(_0xb056('0x2'));var jsonpatch=require(_0xb056('0x3'));var rp=require(_0xb056('0x4'));var moment=require(_0xb056('0x5'));var BPromise=require(_0xb056('0x6'));var Mustache=require(_0xb056('0x7'));var util=require(_0xb056('0x8'));var path=require(_0xb056('0x9'));var sox=require(_0xb056('0xa'));var csv=require('to-csv');var ejs=require(_0xb056('0xb'));var fs=require('fs');var fs_extra=require(_0xb056('0xc'));var _=require(_0xb056('0xd'));var squel=require(_0xb056('0xe'));var crypto=require(_0xb056('0xf'));var jsforce=require(_0xb056('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb056('0x11'));var Papa=require(_0xb056('0x12'));var AWS=require(_0xb056('0x13'));var uuidv4=require(_0xb056('0x14'));var Redis=require('ioredis');var authService=require(_0xb056('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xb056('0x16'));var hardwareService=require(_0xb056('0x17'));var logger=require(_0xb056('0x18'))(_0xb056('0x19'));var utils=require(_0xb056('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb056('0x1b'))['db'];function respondWithStatusCode(_0x33acb2,_0x51999c){_0x51999c=_0x51999c||0xcc;return function(_0x81c9fc){if(_0x81c9fc){return _0x33acb2[_0xb056('0x1c')](_0x51999c);}return _0x33acb2[_0xb056('0x1d')](_0x51999c)[_0xb056('0x1e')]();};}function respondWithResult(_0x10dd19,_0x3776a1){_0x3776a1=_0x3776a1||0xc8;return function(_0x179e49){if(_0x179e49){return _0x10dd19['status'](_0x3776a1)[_0xb056('0x1f')](_0x179e49);}};}function respondWithFilteredResult(_0x43565e,_0x9e2eed){return function(_0x65d7ca){if(_0x65d7ca){var _0x5a4ef1=_0x65d7ca[_0xb056('0x20')],_0x16085d=_0x9e2eed['offset'],_0x4e501a=_0x9e2eed[_0xb056('0x21')]+_0x9e2eed['limit'],_0x2daffc;if(_0x4e501a>=_0x5a4ef1){_0x4e501a=_0x5a4ef1;_0x2daffc=0xc8;}else{_0x2daffc=0xce;}_0x43565e[_0xb056('0x1d')](_0x2daffc);return _0x43565e[_0xb056('0x22')]('Content-Range',_0x16085d+'-'+_0x4e501a+'/'+_0x5a4ef1)[_0xb056('0x1f')](_0x65d7ca);}return null;};}function patchUpdates(_0x48cdaf){return function(_0x2107ee){try{jsonpatch[_0xb056('0x23')](_0x2107ee,_0x48cdaf,!![]);}catch(_0x457b54){return BPromise[_0xb056('0x24')](_0x457b54);}return _0x2107ee['save']();};}function saveUpdates(_0x1db585,_0x5b481c){return function(_0x1565d8){if(_0x1565d8){return _0x1565d8['update'](_0x1db585)[_0xb056('0x25')](function(_0x40ac2d){return _0x40ac2d;});}return null;};}function removeEntity(_0x1de11b,_0x3e0298){return function(_0x36e539){if(_0x36e539){return _0x36e539[_0xb056('0x26')]()['then'](function(){_0x1de11b[_0xb056('0x1d')](0xcc)[_0xb056('0x1e')]();});}};}function handleEntityNotFound(_0x341544,_0x1bd6ac){return function(_0x5577a9){if(!_0x5577a9){_0x341544[_0xb056('0x1c')](0x194);}return _0x5577a9;};}function handleError(_0x10b9b3,_0x5c39db){_0x5c39db=_0x5c39db||0x1f4;return function(_0x6d0483){logger[_0xb056('0x27')](_0x6d0483[_0xb056('0x28')]);if(_0x6d0483[_0xb056('0x29')]){delete _0x6d0483[_0xb056('0x29')];}_0x10b9b3[_0xb056('0x1d')](_0x5c39db)[_0xb056('0x2a')](_0x6d0483);};}exports[_0xb056('0x2b')]=function(_0x571e54,_0x29fbc1){var _0x51b06b={},_0x3d83d3={},_0x9c6f4a={'count':0x0,'rows':[]};var _0x294874=_['map'](db[_0xb056('0x2c')][_0xb056('0x2d')],function(_0x4ba5f8){return{'name':_0x4ba5f8[_0xb056('0x2e')],'type':_0x4ba5f8[_0xb056('0x2f')][_0xb056('0x30')]};});_0x3d83d3[_0xb056('0x31')]=_[_0xb056('0x32')](_['map'](_0x294874,_0xb056('0x29')),[_0xb056('0x33')]);_0x3d83d3[_0xb056('0x34')]=_[_0xb056('0x35')](_0x571e54[_0xb056('0x34')]);_0x3d83d3['filters']=_[_0xb056('0x36')](_0x3d83d3[_0xb056('0x31')],_0x3d83d3[_0xb056('0x34')]);_0x51b06b[_0xb056('0x37')]=_[_0xb056('0x36')](_0x3d83d3[_0xb056('0x31')],qs[_0xb056('0x38')](_0x571e54[_0xb056('0x34')]['fields']));_0x51b06b[_0xb056('0x37')]=_0x51b06b['attributes'][_0xb056('0x39')]?_0x51b06b['attributes']:_0x3d83d3['model'];if(!_0x571e54[_0xb056('0x34')][_0xb056('0x3a')](_0xb056('0x3b'))){_0x51b06b[_0xb056('0x3c')]=qs[_0xb056('0x3c')](_0x571e54[_0xb056('0x34')][_0xb056('0x3c')]);_0x51b06b['offset']=qs[_0xb056('0x21')](_0x571e54[_0xb056('0x34')]['offset']);}_0x51b06b['order']=qs[_0xb056('0x3d')](_0x571e54[_0xb056('0x34')][_0xb056('0x3d')]);_0x51b06b['where']=qs[_0xb056('0x3e')](_[_0xb056('0x3f')](_0x571e54[_0xb056('0x34')],_0x3d83d3[_0xb056('0x3e')]),_0x294874);if(_0x571e54[_0xb056('0x34')][_0xb056('0x40')]){_0x51b06b[_0xb056('0x41')]=_[_0xb056('0x42')](_0x51b06b[_0xb056('0x41')],{'$or':_[_0xb056('0x43')](_0x294874,function(_0x3a4549){if(_0x3a4549[_0xb056('0x2f')]!=='VIRTUAL'){var _0x40d1cf={};_0x40d1cf[_0x3a4549['name']]={'$like':'%'+_0x571e54[_0xb056('0x34')][_0xb056('0x40')]+'%'};return _0x40d1cf;}})});}_0x51b06b=_[_0xb056('0x42')]({},_0x51b06b,_0x571e54[_0xb056('0x44')]);var _0x460f28={'where':_0x51b06b[_0xb056('0x41')]};return db[_0xb056('0x2c')][_0xb056('0x20')](_0x460f28)['then'](function(_0x3ffd4e){_0x9c6f4a[_0xb056('0x20')]=_0x3ffd4e;if(_0x571e54[_0xb056('0x34')][_0xb056('0x45')]){_0x51b06b[_0xb056('0x46')]=[{'all':!![]}];}return db['VoiceRecording'][_0xb056('0x47')](_0x51b06b);})[_0xb056('0x25')](function(_0x17eb0f){_0x9c6f4a[_0xb056('0x48')]=_0x17eb0f;return _0x9c6f4a;})[_0xb056('0x25')](respondWithFilteredResult(_0x29fbc1,_0x51b06b))[_0xb056('0x49')](handleError(_0x29fbc1,null));};exports['show']=function(_0x29b6c2,_0x5040f6){var _0x3bcc3d={'raw':![],'where':{'id':_0x29b6c2[_0xb056('0x4a')]['id']}},_0xc729f3={};_0xc729f3[_0xb056('0x31')]=_[_0xb056('0x35')](db[_0xb056('0x2c')][_0xb056('0x2d')]);_0xc729f3[_0xb056('0x34')]=_[_0xb056('0x35')](_0x29b6c2[_0xb056('0x34')]);_0xc729f3['filters']=_[_0xb056('0x36')](_0xc729f3[_0xb056('0x31')],_0xc729f3[_0xb056('0x34')]);_0x3bcc3d['attributes']=_[_0xb056('0x36')](_0xc729f3[_0xb056('0x31')],qs['fields'](_0x29b6c2['query'][_0xb056('0x38')]));_0x3bcc3d[_0xb056('0x37')]=_0x3bcc3d[_0xb056('0x37')][_0xb056('0x39')]?_0x3bcc3d['attributes']:_0xc729f3['model'];if(_0x29b6c2['query']['includeAll']){_0x3bcc3d['include']=[{'all':!![]}];}_0x3bcc3d=_['merge']({},_0x3bcc3d,_0x29b6c2[_0xb056('0x44')]);return db['VoiceRecording'][_0xb056('0x4b')](_0x3bcc3d)[_0xb056('0x25')](handleEntityNotFound(_0x5040f6,null))[_0xb056('0x25')](respondWithResult(_0x5040f6,null))[_0xb056('0x49')](handleError(_0x5040f6,null));};exports[_0xb056('0x4c')]=function(_0x240e27,_0x45b4aa){return db[_0xb056('0x2c')]['create'](_0x240e27[_0xb056('0x4d')],{})[_0xb056('0x25')](respondWithResult(_0x45b4aa,0xc9))['catch'](handleError(_0x45b4aa,null));};exports[_0xb056('0x4e')]=function(_0x36c472,_0xe40439){if(_0x36c472[_0xb056('0x4d')]['id']){delete _0x36c472[_0xb056('0x4d')]['id'];}return db[_0xb056('0x2c')]['find']({'where':{'id':_0x36c472[_0xb056('0x4a')]['id']}})['then'](handleEntityNotFound(_0xe40439,null))[_0xb056('0x25')](saveUpdates(_0x36c472[_0xb056('0x4d')],null))[_0xb056('0x25')](respondWithResult(_0xe40439,null))[_0xb056('0x49')](handleError(_0xe40439,null));};exports[_0xb056('0x4f')]=function(_0x26cebb,_0x2b6733){return db[_0xb056('0x2c')]['describe']()[_0xb056('0x25')](respondWithResult(_0x2b6733,null))[_0xb056('0x49')](handleError(_0x2b6733,null));};exports[_0xb056('0x50')]=function(_0x26708f,_0x2015b9,_0x35acab){var _0x3de967=require(_0xb056('0x51'));var _0x4a9968=![];var _0x122ed7={};if(_0x26708f[_0xb056('0x34')][_0xb056('0x2f')]&&_0x26708f[_0xb056('0x34')][_0xb056('0x2f')]===_0xb056('0x52')){_0x122ed7['uniqueid']=_0x26708f[_0xb056('0x4a')]['id'];}else{_0x122ed7['id']=_0x26708f[_0xb056('0x4a')]['id'];}return db[_0xb056('0x2c')]['find']({'where':_0x122ed7,'attributes':['id',_0xb056('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x2015b9,null))[_0xb056('0x25')](function(_0x8682d4){if(_0x8682d4){var _0x2a064f=_0x8682d4[_0xb056('0x53')];var _0x58c533=util[_0xb056('0x33')](_0xb056('0x54'),_0x2a064f);if(fs['existsSync'](_0x58c533)){_0x4a9968=!![];return _0x3de967[_0xb056('0x55')](_0x58c533,_0x2a064f,config[_0xb056('0x56')][_0xb056('0x57')])[_0xb056('0x25')](function(){return _0x8682d4;});}return _0x8682d4;}})[_0xb056('0x25')](function(_0x51bd1b){if(_0x51bd1b){var _0x3a0854=_0x51bd1b[_0xb056('0x53')];if(!fs[_0xb056('0x58')](_0x3a0854)){throw new db[(_0xb056('0x59'))][(_0xb056('0x5a'))](_0xb056('0x5b'));}if(_0x51bd1b[_0xb056('0x5c')]){return _0x2015b9[_0xb056('0x50')](_0x3a0854,_0x51bd1b[_0xb056('0x5c')]+path[_0xb056('0x5d')](_0x3a0854),function(){if(_0x4a9968){fs[_0xb056('0x5e')](_0x3a0854);}});}else{return _0x2015b9[_0xb056('0x50')](_0x3a0854,function(_0x2ab5a8){if(_0x4a9968){fs[_0xb056('0x5e')](_0x3a0854);}});}}})[_0xb056('0x49')](function(_0x282c31){if(_0x282c31[_0xb056('0x5f')]===_0xb056('0x5b')){_0x2015b9[_0xb056('0x1d')](0x194)[_0xb056('0x2a')](_0xb056('0x60'));}else{return handleError(_0x2015b9,null);}});};exports['downloads']=function(_0x249d51,_0x39b34d,_0x41ae10){var _0x1ffa10=require(_0xb056('0x51'));var _0x2ee6ca=![];var _0x2012b5={'$and':[db['sequelize']['where'](db[_0xb056('0x61')]['fn'](_0xb056('0x62'),db[_0xb056('0x61')][_0xb056('0x63')](_0xb056('0x52'))),_0x249d51['query'][_0xb056('0x64')])]};if(_0x249d51[_0xb056('0x34')][_0xb056('0x2f')]&&_0x249d51[_0xb056('0x34')]['type']===_0xb056('0x52')){_0x2012b5[_0xb056('0x65')][_0xb056('0x66')]({'uniqueid':_0x249d51['params']['id']});}else{_0x2012b5[_0xb056('0x65')][_0xb056('0x66')]({'id':_0x249d51[_0xb056('0x4a')]['id']});}return db['VoiceRecording'][_0xb056('0x4b')]({'where':_0x2012b5,'attributes':['id',_0xb056('0x53')],'raw':!![]})[_0xb056('0x25')](handleEntityNotFound(_0x39b34d,null))['then'](function(_0x415de6){if(_0x415de6){var _0x544cbb=util[_0xb056('0x33')](_0xb056('0x54'),_0x415de6[_0xb056('0x53')]);if(fs['existsSync'](_0x544cbb)){_0x2ee6ca=!![];return _0x1ffa10[_0xb056('0x55')](_0x544cbb,_0x415de6[_0xb056('0x53')],config['secrets'][_0xb056('0x57')])[_0xb056('0x25')](function(){return _0x415de6;});}return _0x415de6;}})[_0xb056('0x25')](function(_0x31a0d1){if(_0x31a0d1){if(!fs[_0xb056('0x58')](_0x31a0d1['value'])){throw new db['Sequelize'][(_0xb056('0x5a'))]('VoiceRecording\x20not\x20found');}if(_0x31a0d1[_0xb056('0x5c')]){return _0x39b34d['download'](_0x31a0d1[_0xb056('0x53')],_0x31a0d1[_0xb056('0x5c')]+path[_0xb056('0x5d')](_0x31a0d1[_0xb056('0x53')]),function(){if(_0x2ee6ca){fs['unlink'](_0x31a0d1['value']);}});}else{return _0x39b34d[_0xb056('0x50')](_0x31a0d1[_0xb056('0x53')],function(_0x3b3bbf){if(_0x2ee6ca){fs[_0xb056('0x5e')](_0x31a0d1['value']);}});}}})[_0xb056('0x49')](handleError(_0x39b34d,null));};exports['destroy']=function(_0x349d7e,_0x5f0278){return db[_0xb056('0x2c')]['find']({'where':{'id':_0x349d7e[_0xb056('0x4a')]['id']}})[_0xb056('0x25')](function(_0x2bff6b){if(!_0x2bff6b)throw new ReferenceError(_0xb056('0x67'));return _0x2bff6b;})['then'](function(_0x272534){var _0x479332=_0x272534[_0xb056('0x53')];logger[_0xb056('0x68')](_0xb056('0x69'),_0x479332);if(!_[_0xb056('0x6a')](_0x272534[_0xb056('0x53')])&&fs[_0xb056('0x58')](_0x479332)){logger[_0xb056('0x68')](_0xb056('0x6b')+_0x479332+_0xb056('0x6c'));fs[_0xb056('0x6d')](_0x479332);}_0x479332=_0x479332+_0xb056('0x6e');if(!_[_0xb056('0x6a')](_0x272534['value'])&&fs['existsSync'](_0x479332)){logger[_0xb056('0x68')]('File:\x20\x22'+_0x479332+_0xb056('0x6c'));fs['unlinkSync'](_0x479332);}return _0x272534;})[_0xb056('0x25')](function(_0x5df962){if(!_0x5df962)throw new InternalError();return _0x5df962['destroy']();})['then'](function(){_0x5f0278[_0xb056('0x1d')](0xcc)['end']();})['catch'](handleError(_0x5f0278,null));};function getBucketslist(_0x3c9d5a,_0xb6fd9b,_0x343326){return new Promise(function(_0x4ca52b,_0x547cb4){var _0x5b9442=new AWS['S3']({'accessKeyId':_0xb6fd9b,'secretAccessKey':_0x3c9d5a,'region':_0x343326});_0x5b9442[_0xb056('0x6f')]({},function(_0x15b074,_0x396d52){if(_0x15b074){return _0x547cb4(_0x15b074);}else{return _0x4ca52b(_0x396d52);}});});}function createBucket(_0x13bd5f,_0x9185c,_0x6a0bfc,_0x627a5e){return new Promise(function(_0x377cd6,_0x2dec80){var _0xd88228=new AWS['S3']({'accessKeyId':_0x9185c,'secretAccessKey':_0x13bd5f,'region':_0x6a0bfc});_0xd88228[_0xb056('0x70')]({'Bucket':_0x627a5e},function(_0x366cba,_0x216920){if(_0x366cba){return _0x2dec80(_0x366cba);}else{return _0x377cd6(_0x216920);}});});}function uploadFile(_0x19243d,_0x4dbd50,_0x5def29,_0x18feb4,_0x5ef886,_0x11ef5f){return new Promise(function(_0x4532ad,_0x2a737f){var _0xc2833b=new AWS['S3']({'accessKeyId':_0x4dbd50,'secretAccessKey':_0x19243d,'region':_0x5def29});_0xc2833b['upload']({'Bucket':_0x18feb4,'Key':_0x5ef886,'Body':_0x11ef5f},function(_0x5d84ff,_0x2e027a){if(_0x5d84ff){return _0x2a737f(_0x5d84ff);}else{return _0x4532ad(_0x2e027a);}});});}function startTranscribe(_0x13a0f1,_0x131cef,_0x5aa3f5,_0x53e1a5,_0x3a14f3,_0x72b81d){return new Promise(function(_0x5dc3b5,_0x345cf9){var _0x456588=new AWS[(_0xb056('0x71'))]({'accessKeyId':_0x131cef,'secretAccessKey':_0x13a0f1,'region':_0x5aa3f5});_0x456588[_0xb056('0x72')]({'TranscriptionJobName':_0x53e1a5,'LanguageCode':_0x3a14f3,'Media':{'MediaFileUri':_0x72b81d}},function(_0xf637bd,_0x315b19){if(_0xf637bd){return _0x345cf9(_0xf637bd);}else{return _0x5dc3b5(_0x315b19);}});});}function transcribe(_0xb96f3c,_0x27b31f,_0x141634,_0x416d33,_0xfad362,_0x5a7a61,_0x394224){return new Promise(function(_0x2d0d1e,_0x397617){var _0x4dda81={};logger[_0xb056('0x68')](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0xb96f3c,_0xfad362));return uploadFile(_0x27b31f,_0x141634,_0x416d33,_0xfad362,path[_0xb056('0x73')](_0x5a7a61),fs[_0xb056('0x74')](_0x5a7a61))[_0xb056('0x25')](function(_0x56578e){logger['info'](util[_0xb056('0x33')](_0xb056('0x75'),_0xb96f3c,_0xfad362,_0x56578e['Location']));_0x4dda81[_0xb056('0x76')]=_0x56578e['Bucket'];_0x4dda81[_0xb056('0x77')]=_0x56578e[_0xb056('0x78')];logger['info'](util['format'](_0xb056('0x79'),_0xb96f3c));return startTranscribe(_0x27b31f,_0x141634,_0x416d33,uuidv4(),_0x394224,_0x56578e[_0xb056('0x78')]);})['then'](function(_0x1cc5b1){logger['info'](util['format'](_0xb056('0x7a'),_0xb96f3c,_0x1cc5b1[_0xb056('0x7b')][_0xb056('0x7c')]));_0x4dda81[_0xb056('0x7d')]=_0x1cc5b1[_0xb056('0x7b')][_0xb056('0x7c')];_0x4dda81['transcribeStatus']=_0x1cc5b1[_0xb056('0x7b')]['TranscriptionJobStatus'];return _0x2d0d1e(_0x4dda81);})[_0xb056('0x49')](function(_0x3efaf6){return _0x397617(_0x3efaf6);});});}exports['runTranscribe']=function(_0xdb2025,_0x2e92ee,_0x4d7f67){var _0x6751b0;var _0x5bbe03;var _0x449637;var _0x4fdcbd=require(_0xb056('0x51'));return db[_0xb056('0x2c')]['findOne']({'where':{'id':_0xdb2025[_0xb056('0x4a')]['id']}})['then'](function(_0x2d51af){if(_0x2d51af){var _0x1c81ce=util[_0xb056('0x33')](_0xb056('0x54'),_0x2d51af[_0xb056('0x53')]);if(fs[_0xb056('0x58')](_0x1c81ce)){cypher=!![];return _0x4fdcbd[_0xb056('0x55')](_0x1c81ce,_0x2d51af[_0xb056('0x53')],config['secrets'][_0xb056('0x57')])['then'](function(){return _0x2d51af;});}return _0x2d51af;}})['then'](function(_0x5dd905){if(!_0x5dd905){throw new db[(_0xb056('0x59'))][(_0xb056('0x5a'))](_0xb056('0x7e'));}_0x5bbe03=_0x5dd905;return db[_0xb056('0x7f')]['findOne']({'where':{'id':0x1}});})[_0xb056('0x25')](handleEntityNotFound(_0x2e92ee,null))[_0xb056('0x25')](function(_0x7d93d0){if(_0x7d93d0){_0x6751b0=_0x7d93d0;if(!_0x6751b0[_0xb056('0x80')]||!_0x6751b0[_0xb056('0x81')]||!_0x6751b0['transcribeRegion']||!_0x6751b0[_0xb056('0x82')]||!_0x6751b0[_0xb056('0x76')]){throw new db[(_0xb056('0x59'))]['ValidationError']('Transcribe\x20not\x20configured');}if(_0xdb2025['body']['runSentiment']&&(!_0x6751b0['sentiment']||!_0x6751b0['sentimentAccountId']||!_0x6751b0[_0xb056('0x83')]||!_0x6751b0[_0xb056('0x82')]||!_0x6751b0[_0xb056('0x76')])){throw new db[(_0xb056('0x59'))][(_0xb056('0x5a'))](_0xb056('0x84'));}return db['CloudProvider'][_0xb056('0x85')]({'where':{'id':_0x6751b0[_0xb056('0x81')]}});}})[_0xb056('0x25')](function(_0x3e4ba5){if(!_0x3e4ba5){throw new db[(_0xb056('0x59'))][(_0xb056('0x5a'))](_0xb056('0x86'));}if(!_0x3e4ba5[_0xb056('0x87')]||!_0x3e4ba5[_0xb056('0x88')]){throw new db[(_0xb056('0x59'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x449637=_0x3e4ba5;return getBucketslist(_0x449637['data1'],_0x449637[_0xb056('0x88')],_0x6751b0['transcribeRegion']);})[_0xb056('0x25')](function(_0x1851b8){if(_0x1851b8&&_0x1851b8[_0xb056('0x89')]){var _0x189f33=_[_0xb056('0x4b')](_0x1851b8[_0xb056('0x89')],function(_0x34702f){return _0x34702f[_0xb056('0x8a')]===_0x6751b0[_0xb056('0x76')];});if(!_0x189f33){logger['info'](util[_0xb056('0x33')](_0xb056('0x8b'),_0xdb2025[_0xb056('0x4a')]['id'],_0x6751b0[_0xb056('0x76')]));return createBucket(_0x449637['data1'],_0x449637['data2'],_0x6751b0[_0xb056('0x8c')],_0x6751b0[_0xb056('0x76')]);}logger[_0xb056('0x68')](util[_0xb056('0x33')](_0xb056('0x8d'),_0xdb2025[_0xb056('0x4a')]['id'],_0x6751b0[_0xb056('0x76')]));return;}})['then'](function(_0x2b6ac8){if(_0x5bbe03['transcribeStatus']===_0xb056('0x8e')){return transcribe(_0xdb2025[_0xb056('0x4a')]['id'],_0x449637['data1'],_0x449637[_0xb056('0x88')],_0x6751b0['transcribeRegion'],_0x6751b0[_0xb056('0x76')],_0x5bbe03[_0xb056('0x53')],_0x6751b0[_0xb056('0x82')]);}else{logger[_0xb056('0x68')](util[_0xb056('0x33')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0xdb2025[_0xb056('0x4a')]['id']));return{'transcribeStatus':_0xb056('0x8f')};}})[_0xb056('0x25')](function(_0xca6cf7){if(_0xca6cf7){_0xca6cf7[_0xb056('0x90')]=_0xdb2025[_0xb056('0x4d')][_0xb056('0x91')];return _0x5bbe03[_0xb056('0x92')](_0xca6cf7);}})[_0xb056('0x25')](respondWithResult(_0x2e92ee,null))[_0xb056('0x49')](handleError(_0x2e92ee,null));};function writeFile(_0x62da08,_0x1636e0){return new Promise(function(_0x44a1de,_0x19990d){fs[_0xb056('0x93')](_0x1636e0,_0x62da08,function(_0x40ae8d,_0x10e3b2){if(_0x40ae8d){return _0x19990d(_0x40ae8d);}else{return _0x44a1de(_0x10e3b2);}});});}exports[_0xb056('0x94')]=function(_0x1a8d5b,_0x341a86,_0x506e61){return db[_0xb056('0x2c')][_0xb056('0x85')]({'where':{'id':_0x1a8d5b[_0xb056('0x4a')]['id']}})[_0xb056('0x25')](handleEntityNotFound(_0x341a86))[_0xb056('0x25')](function(_0x430cba){if(_0x430cba&&_0x430cba[_0xb056('0x95')]){var _0xab1c91=_0x430cba[_0xb056('0x95')];var _0xa49c52=config[_0xb056('0x96')]+'/server/files/transcribes/transcribe_'+_0x430cba['id']+'.txt';if(fs[_0xb056('0x58')](_0xa49c52)){return _0xa49c52;}return writeFile(_0xab1c91,_0xa49c52)['then'](function(){return _0xa49c52;});}else{throw new db[(_0xb056('0x59'))][(_0xb056('0x5a'))](_0xb056('0x97'));}})['then'](function(_0x41bbff){return _0x341a86[_0xb056('0x50')](_0x41bbff);})['catch'](handleError(_0x341a86));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 8c77189..6ca5e0b 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 _0xb598=['request-promise','rimraf','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb598,0xa2));var _0x8b59=function(_0x4388da,_0x47ba7c){_0x4388da=_0x4388da-0x0;var _0x52dd6a=_0xb598[_0x4388da];return _0x52dd6a;};'use strict';var _=require(_0x8b59('0x0'));var util=require(_0x8b59('0x1'));var logger=require(_0x8b59('0x2'))(_0x8b59('0x3'));var moment=require(_0x8b59('0x4'));var BPromise=require(_0x8b59('0x5'));var rp=require(_0x8b59('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b59('0x7'));var config=require('../../config/environment');var attributes=require(_0x8b59('0x8'));module[_0x8b59('0x9')]=function(_0x4a2cbb,_0xb1bb45){return _0x4a2cbb[_0x8b59('0xa')](_0x8b59('0xb'),attributes,{'tableName':_0x8b59('0xc'),'paranoid':![],'indexes':[{'name':_0x8b59('0xd'),'fields':[_0x8b59('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc095=['bluebird','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','util','api','moment'];(function(_0x385a99,_0x486c59){var _0x4731e3=function(_0x200222){while(--_0x200222){_0x385a99['push'](_0x385a99['shift']());}};_0x4731e3(++_0x486c59);}(_0xc095,0x10e));var _0x5c09=function(_0x491915,_0x56d66f){_0x491915=_0x491915-0x0;var _0x14fb36=_0xc095[_0x491915];return _0x14fb36;};'use strict';var _=require('lodash');var util=require(_0x5c09('0x0'));var logger=require('../../config/logger')(_0x5c09('0x1'));var moment=require(_0x5c09('0x2'));var BPromise=require(_0x5c09('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c09('0x4'));var rimraf=require(_0x5c09('0x5'));var config=require(_0x5c09('0x6'));var attributes=require(_0x5c09('0x7'));module[_0x5c09('0x8')]=function(_0x335548,_0x586469){return _0x335548[_0x5c09('0x9')](_0x5c09('0xa'),attributes,{'tableName':_0x5c09('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5c09('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 673c7f0..4e1f4e7 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 _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x164e8f,_0xdba27a){var _0x2b2840=function(_0x4458f0){while(--_0x4458f0){_0x164e8f['push'](_0x164e8f['shift']());}};_0x2b2840(++_0xdba27a);}(_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 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['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x4da196,_0x357dc9){var _0x375df3=function(_0x366603){while(--_0x366603){_0x4da196['push'](_0x4da196['shift']());}};_0x375df3(++_0x357dc9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 2d26806..bb2555c 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 _0xa38b=['create','delete','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x2eba96,_0x45156a){var _0x22d33a=function(_0x1f6f5f){while(--_0x1f6f5f){_0x2eba96['push'](_0x2eba96['shift']());}};_0x22d33a(++_0x45156a);}(_0xa38b,0x1b3));var _0xba38=function(_0x53a391,_0x40c379){_0x53a391=_0x53a391-0x0;var _0xe8e538=_0xa38b[_0x53a391];return _0xe8e538;};'use strict';var multer=require(_0xba38('0x0'));var util=require(_0xba38('0x1'));var path=require(_0xba38('0x2'));var timeout=require('connect-timeout');var express=require(_0xba38('0x3'));var router=express[_0xba38('0x4')]();var fs_extra=require(_0xba38('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xba38('0x6'));var controller=require(_0xba38('0x7'));router[_0xba38('0x8')]('/',auth[_0xba38('0x9')](),controller[_0xba38('0xa')]);router[_0xba38('0x8')](_0xba38('0xb'),auth[_0xba38('0x9')](),controller[_0xba38('0xc')]);router[_0xba38('0x8')](_0xba38('0xd'),auth[_0xba38('0x9')](),controller['show']);router[_0xba38('0xe')]('/',auth[_0xba38('0x9')](),controller[_0xba38('0xf')]);router['put'](_0xba38('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xba38('0x10')](_0xba38('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xba38('0x11')]=router; \ No newline at end of file +var _0xe05e=['index','/describe','describe','show','create','put','/:id','delete','util','express','../../components/auth/service','./voiceTransferReport.controller','get','isAuthenticated'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0xe05e,0x158));var _0xee05=function(_0x32f9ca,_0x2fa8bc){_0x32f9ca=_0x32f9ca-0x0;var _0x52e083=_0xe05e[_0x32f9ca];return _0x52e083;};'use strict';var multer=require('multer');var util=require(_0xee05('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xee05('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xee05('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xee05('0x3'));router[_0xee05('0x4')]('/',auth[_0xee05('0x5')](),controller[_0xee05('0x6')]);router[_0xee05('0x4')](_0xee05('0x7'),auth[_0xee05('0x5')](),controller[_0xee05('0x8')]);router[_0xee05('0x4')]('/:id',auth[_0xee05('0x5')](),controller[_0xee05('0x9')]);router['post']('/',auth[_0xee05('0x5')](),controller[_0xee05('0xa')]);router[_0xee05('0xb')](_0xee05('0xc'),auth[_0xee05('0x5')](),controller['update']);router[_0xee05('0xd')](_0xee05('0xc'),auth[_0xee05('0x5')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index af992f8..a6e2232 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 _0x357c=['Yes','sequelize','moment','exports','ENUM','attended','STRING'];(function(_0x251d39,_0x50b8bd){var _0x167d0a=function(_0x58fa0d){while(--_0x58fa0d){_0x251d39['push'](_0x251d39['shift']());}};_0x167d0a(++_0x50b8bd);}(_0x357c,0x16d));var _0xc357=function(_0x1afabf,_0x56fdcc){_0x1afabf=_0x1afabf-0x0;var _0x497ff1=_0x357c[_0x1afabf];return _0x497ff1;};'use strict';var Sequelize=require(_0xc357('0x0'));var moment=require(_0xc357('0x1'));module[_0xc357('0x2')]={'type':{'type':Sequelize[_0xc357('0x3')]('blind',_0xc357('0x4'))},'result':{'type':Sequelize[_0xc357('0x5')]},'transfererchannel':{'type':Sequelize[_0xc357('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xc357('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xc357('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xc357('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xc357('0x5')]},'transferercontext':{'type':Sequelize[_0xc357('0x5')]},'transfererexten':{'type':Sequelize[_0xc357('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xc357('0x5')]},'transfereechannel':{'type':Sequelize[_0xc357('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xc357('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xc357('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xc357('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xc357('0x5')]},'transfereeexten':{'type':Sequelize[_0xc357('0x5')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xc357('0x3')](_0xc357('0x6'),'No')},'context':{'type':Sequelize[_0xc357('0x5')]},'extension':{'type':Sequelize[_0xc357('0x5')]}}; \ No newline at end of file +var _0xc3ba=['attended','STRING','ENUM','Yes','sequelize','moment','exports','blind'];(function(_0x3943fe,_0x553e86){var _0x3193d6=function(_0x8fdf1e){while(--_0x8fdf1e){_0x3943fe['push'](_0x3943fe['shift']());}};_0x3193d6(++_0x553e86);}(_0xc3ba,0x1b4));var _0xac3b=function(_0x2d340c,_0x28a8f7){_0x2d340c=_0x2d340c-0x0;var _0x2c1a32=_0xc3ba[_0x2d340c];return _0x2c1a32;};'use strict';var Sequelize=require(_0xac3b('0x0'));var moment=require(_0xac3b('0x1'));module[_0xac3b('0x2')]={'type':{'type':Sequelize['ENUM'](_0xac3b('0x3'),_0xac3b('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xac3b('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xac3b('0x5')]},'transferercalleridname':{'type':Sequelize[_0xac3b('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xac3b('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xac3b('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xac3b('0x5')]},'transferercontext':{'type':Sequelize[_0xac3b('0x5')]},'transfererexten':{'type':Sequelize[_0xac3b('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xac3b('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xac3b('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xac3b('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xac3b('0x5')]},'transfereecontext':{'type':Sequelize[_0xac3b('0x5')]},'transfereeexten':{'type':Sequelize[_0xac3b('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xac3b('0x5')]},'isexternal':{'type':Sequelize[_0xac3b('0x6')](_0xac3b('0x7'),'No')},'context':{'type':Sequelize[_0xac3b('0x5')]},'extension':{'type':Sequelize[_0xac3b('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index b3bc886..9c32815 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 _0xc94f=['merge','where','VIRTUAL','options','include','catch','show','params','rawAttributes','length','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','stack','name','send','index','map','VoiceTransferReport','fieldName','type','key','keys','query','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','order','sort','pick','filter'];(function(_0x18c683,_0x21e813){var _0x2ecc4d=function(_0x141ede){while(--_0x141ede){_0x18c683['push'](_0x18c683['shift']());}};_0x2ecc4d(++_0x21e813);}(_0xc94f,0x181));var _0xfc94=function(_0x4ee698,_0x4b588f){_0x4ee698=_0x4ee698-0x0;var _0x503343=_0xc94f[_0x4ee698];return _0x503343;};'use strict';var pdf=require(_0xfc94('0x0'));var emlformat=require(_0xfc94('0x1'));var rimraf=require(_0xfc94('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfc94('0x3'));var rp=require(_0xfc94('0x4'));var moment=require(_0xfc94('0x5'));var BPromise=require(_0xfc94('0x6'));var Mustache=require('mustache');var util=require(_0xfc94('0x7'));var path=require(_0xfc94('0x8'));var sox=require(_0xfc94('0x9'));var csv=require(_0xfc94('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfc94('0xb'));var squel=require(_0xfc94('0xc'));var crypto=require(_0xfc94('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xfc94('0xe'));var toCsv=require(_0xfc94('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfc94('0xf'));var authService=require(_0xfc94('0x10'));var qs=require(_0xfc94('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc94('0x12'));var logger=require(_0xfc94('0x13'))(_0xfc94('0x14'));var utils=require(_0xfc94('0x15'));var config=require(_0xfc94('0x16'));var licenseUtil=require(_0xfc94('0x17'));var db=require(_0xfc94('0x18'))['db'];function respondWithStatusCode(_0xa8319c,_0x1030ce){_0x1030ce=_0x1030ce||0xcc;return function(_0x466b13){if(_0x466b13){return _0xa8319c['sendStatus'](_0x1030ce);}return _0xa8319c[_0xfc94('0x19')](_0x1030ce)[_0xfc94('0x1a')]();};}function respondWithResult(_0x31ad3f,_0x7d3840){_0x7d3840=_0x7d3840||0xc8;return function(_0x3e20bb){if(_0x3e20bb){return _0x31ad3f['status'](_0x7d3840)[_0xfc94('0x1b')](_0x3e20bb);}};}function respondWithFilteredResult(_0x5b486b,_0x2554d4){return function(_0x352744){if(_0x352744){var _0x4d7e1a=_0x352744[_0xfc94('0x1c')],_0x107abb=_0x2554d4[_0xfc94('0x1d')],_0x23b45b=_0x2554d4[_0xfc94('0x1d')]+_0x2554d4[_0xfc94('0x1e')],_0x7fe860;if(_0x23b45b>=_0x4d7e1a){_0x23b45b=_0x4d7e1a;_0x7fe860=0xc8;}else{_0x7fe860=0xce;}_0x5b486b[_0xfc94('0x19')](_0x7fe860);return _0x5b486b[_0xfc94('0x1f')]('Content-Range',_0x107abb+'-'+_0x23b45b+'/'+_0x4d7e1a)[_0xfc94('0x1b')](_0x352744);}return null;};}function patchUpdates(_0x22396d){return function(_0x1df6be){try{jsonpatch[_0xfc94('0x20')](_0x1df6be,_0x22396d,!![]);}catch(_0x449492){return BPromise['reject'](_0x449492);}return _0x1df6be[_0xfc94('0x21')]();};}function saveUpdates(_0x2a9d20,_0x35db7b){return function(_0xd3fa35){if(_0xd3fa35){return _0xd3fa35[_0xfc94('0x22')](_0x2a9d20)[_0xfc94('0x23')](function(_0x585ee5){return _0x585ee5;});}return null;};}function removeEntity(_0x12d38e,_0x545c03){return function(_0x4a64f8){if(_0x4a64f8){return _0x4a64f8[_0xfc94('0x24')]()['then'](function(){_0x12d38e['status'](0xcc)[_0xfc94('0x1a')]();});}};}function handleEntityNotFound(_0xc58c1c,_0x49c9c5){return function(_0x19d0d0){if(!_0x19d0d0){_0xc58c1c['sendStatus'](0x194);}return _0x19d0d0;};}function handleError(_0xf6ab0d,_0x30bdcf){_0x30bdcf=_0x30bdcf||0x1f4;return function(_0x268f7a){logger['error'](_0x268f7a[_0xfc94('0x25')]);if(_0x268f7a['name']){delete _0x268f7a[_0xfc94('0x26')];}_0xf6ab0d[_0xfc94('0x19')](_0x30bdcf)[_0xfc94('0x27')](_0x268f7a);};}exports[_0xfc94('0x28')]=function(_0x17f6de,_0x5c8dd0){var _0x257576={},_0x3e4bfd={},_0x4f26f4={'count':0x0,'rows':[]};var _0x14d512=_[_0xfc94('0x29')](db[_0xfc94('0x2a')]['rawAttributes'],function(_0x594ea0){return{'name':_0x594ea0[_0xfc94('0x2b')],'type':_0x594ea0[_0xfc94('0x2c')][_0xfc94('0x2d')]};});_0x3e4bfd['model']=_[_0xfc94('0x29')](_0x14d512,_0xfc94('0x26'));_0x3e4bfd['query']=_[_0xfc94('0x2e')](_0x17f6de[_0xfc94('0x2f')]);_0x3e4bfd[_0xfc94('0x30')]=_['intersection'](_0x3e4bfd['model'],_0x3e4bfd[_0xfc94('0x2f')]);_0x257576[_0xfc94('0x31')]=_[_0xfc94('0x32')](_0x3e4bfd[_0xfc94('0x33')],qs[_0xfc94('0x34')](_0x17f6de['query'][_0xfc94('0x34')]));_0x257576[_0xfc94('0x31')]=_0x257576[_0xfc94('0x31')]['length']?_0x257576['attributes']:_0x3e4bfd[_0xfc94('0x33')];if(!_0x17f6de[_0xfc94('0x2f')][_0xfc94('0x35')](_0xfc94('0x36'))){_0x257576['limit']=qs[_0xfc94('0x1e')](_0x17f6de[_0xfc94('0x2f')][_0xfc94('0x1e')]);_0x257576[_0xfc94('0x1d')]=qs[_0xfc94('0x1d')](_0x17f6de['query'][_0xfc94('0x1d')]);}_0x257576[_0xfc94('0x37')]=qs[_0xfc94('0x38')](_0x17f6de[_0xfc94('0x2f')][_0xfc94('0x38')]);_0x257576['where']=qs[_0xfc94('0x30')](_[_0xfc94('0x39')](_0x17f6de['query'],_0x3e4bfd[_0xfc94('0x30')]),_0x14d512);if(_0x17f6de[_0xfc94('0x2f')][_0xfc94('0x3a')]){_0x257576['where']=_[_0xfc94('0x3b')](_0x257576[_0xfc94('0x3c')],{'$or':_['map'](_0x14d512,function(_0x4f66d7){if(_0x4f66d7[_0xfc94('0x2c')]!==_0xfc94('0x3d')){var _0x26dde2={};_0x26dde2[_0x4f66d7[_0xfc94('0x26')]]={'$like':'%'+_0x17f6de['query'][_0xfc94('0x3a')]+'%'};return _0x26dde2;}})});}_0x257576=_[_0xfc94('0x3b')]({},_0x257576,_0x17f6de[_0xfc94('0x3e')]);var _0x536463={'where':_0x257576[_0xfc94('0x3c')]};return db[_0xfc94('0x2a')][_0xfc94('0x1c')](_0x536463)[_0xfc94('0x23')](function(_0x2b1672){_0x4f26f4['count']=_0x2b1672;if(_0x17f6de['query']['includeAll']){_0x257576[_0xfc94('0x3f')]=[{'all':!![]}];}return db[_0xfc94('0x2a')]['findAll'](_0x257576);})['then'](function(_0x1f33fc){_0x4f26f4['rows']=_0x1f33fc;return _0x4f26f4;})[_0xfc94('0x23')](respondWithFilteredResult(_0x5c8dd0,_0x257576))[_0xfc94('0x40')](handleError(_0x5c8dd0,null));};exports[_0xfc94('0x41')]=function(_0x3f0ee1,_0x5e2657){var _0x27f07c={'raw':!![],'where':{'id':_0x3f0ee1[_0xfc94('0x42')]['id']}},_0x390eed={};_0x390eed[_0xfc94('0x33')]=_[_0xfc94('0x2e')](db['VoiceTransferReport'][_0xfc94('0x43')]);_0x390eed[_0xfc94('0x2f')]=_[_0xfc94('0x2e')](_0x3f0ee1[_0xfc94('0x2f')]);_0x390eed['filters']=_[_0xfc94('0x32')](_0x390eed[_0xfc94('0x33')],_0x390eed['query']);_0x27f07c[_0xfc94('0x31')]=_[_0xfc94('0x32')](_0x390eed[_0xfc94('0x33')],qs[_0xfc94('0x34')](_0x3f0ee1[_0xfc94('0x2f')]['fields']));_0x27f07c[_0xfc94('0x31')]=_0x27f07c[_0xfc94('0x31')][_0xfc94('0x44')]?_0x27f07c[_0xfc94('0x31')]:_0x390eed[_0xfc94('0x33')];if(_0x3f0ee1['query'][_0xfc94('0x45')]){_0x27f07c['include']=[{'all':!![]}];}_0x27f07c=_['merge']({},_0x27f07c,_0x3f0ee1[_0xfc94('0x3e')]);return db['VoiceTransferReport'][_0xfc94('0x46')](_0x27f07c)[_0xfc94('0x23')](handleEntityNotFound(_0x5e2657,null))[_0xfc94('0x23')](respondWithResult(_0x5e2657,null))[_0xfc94('0x40')](handleError(_0x5e2657,null));};exports[_0xfc94('0x47')]=function(_0x2f3dd6,_0x3f11a6){return db['VoiceTransferReport']['create'](_0x2f3dd6['body'],{})[_0xfc94('0x23')](respondWithResult(_0x3f11a6,0xc9))[_0xfc94('0x40')](handleError(_0x3f11a6,null));};exports[_0xfc94('0x22')]=function(_0xffb475,_0x26a51d){if(_0xffb475[_0xfc94('0x48')]['id']){delete _0xffb475[_0xfc94('0x48')]['id'];}return db[_0xfc94('0x2a')]['find']({'where':{'id':_0xffb475[_0xfc94('0x42')]['id']}})['then'](handleEntityNotFound(_0x26a51d,null))[_0xfc94('0x23')](saveUpdates(_0xffb475[_0xfc94('0x48')],null))[_0xfc94('0x23')](respondWithResult(_0x26a51d,null))[_0xfc94('0x40')](handleError(_0x26a51d,null));};exports[_0xfc94('0x24')]=function(_0x57567c,_0x418a24){return db['VoiceTransferReport'][_0xfc94('0x46')]({'where':{'id':_0x57567c[_0xfc94('0x42')]['id']}})[_0xfc94('0x23')](handleEntityNotFound(_0x418a24,null))[_0xfc94('0x23')](removeEntity(_0x418a24,null))[_0xfc94('0x40')](handleError(_0x418a24,null));};exports[_0xfc94('0x49')]=function(_0x457a7b,_0x2a4fe0){return db[_0xfc94('0x2a')][_0xfc94('0x49')]()[_0xfc94('0x23')](respondWithResult(_0x2a4fe0,null))['catch'](handleError(_0x2a4fe0,null));}; \ No newline at end of file +var _0xd0fa=['query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','catch','show','rawAttributes','keys','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','count','offset','limit','set','json','apply','reject','update','then','destroy','end','sendStatus','stack','name','send','index','map','VoiceTransferReport','fieldName','type','key','model'];(function(_0x50c29c,_0x3ab851){var _0x30cec4=function(_0xaaf6d3){while(--_0xaaf6d3){_0x50c29c['push'](_0x50c29c['shift']());}};_0x30cec4(++_0x3ab851);}(_0xd0fa,0x191));var _0xad0f=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xd0fa[_0x8c43de];return _0xa6591b;};'use strict';var pdf=require(_0xad0f('0x0'));var emlformat=require(_0xad0f('0x1'));var rimraf=require(_0xad0f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xad0f('0x3'));var rp=require(_0xad0f('0x4'));var moment=require(_0xad0f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xad0f('0x6'));var util=require(_0xad0f('0x7'));var path=require(_0xad0f('0x8'));var sox=require(_0xad0f('0x9'));var csv=require(_0xad0f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xad0f('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xad0f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xad0f('0xd'));var toCsv=require('to-csv');var querystring=require(_0xad0f('0xe'));var Papa=require(_0xad0f('0xf'));var Redis=require(_0xad0f('0x10'));var authService=require(_0xad0f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xad0f('0x12'));var hardwareService=require(_0xad0f('0x13'));var logger=require(_0xad0f('0x14'))(_0xad0f('0x15'));var utils=require(_0xad0f('0x16'));var config=require(_0xad0f('0x17'));var licenseUtil=require(_0xad0f('0x18'));var db=require(_0xad0f('0x19'))['db'];function respondWithStatusCode(_0x453645,_0x1cc6f4){_0x1cc6f4=_0x1cc6f4||0xcc;return function(_0x8ae605){if(_0x8ae605){return _0x453645['sendStatus'](_0x1cc6f4);}return _0x453645[_0xad0f('0x1a')](_0x1cc6f4)['end']();};}function respondWithResult(_0x3a8fbe,_0x10e201){_0x10e201=_0x10e201||0xc8;return function(_0x51c705){if(_0x51c705){return _0x3a8fbe[_0xad0f('0x1a')](_0x10e201)['json'](_0x51c705);}};}function respondWithFilteredResult(_0x43721f,_0x517476){return function(_0x549956){if(_0x549956){var _0x38526f=_0x549956[_0xad0f('0x1b')],_0x4b2ad8=_0x517476[_0xad0f('0x1c')],_0x579a66=_0x517476['offset']+_0x517476[_0xad0f('0x1d')],_0x14dbbe;if(_0x579a66>=_0x38526f){_0x579a66=_0x38526f;_0x14dbbe=0xc8;}else{_0x14dbbe=0xce;}_0x43721f[_0xad0f('0x1a')](_0x14dbbe);return _0x43721f[_0xad0f('0x1e')]('Content-Range',_0x4b2ad8+'-'+_0x579a66+'/'+_0x38526f)[_0xad0f('0x1f')](_0x549956);}return null;};}function patchUpdates(_0x1ddc73){return function(_0x415530){try{jsonpatch[_0xad0f('0x20')](_0x415530,_0x1ddc73,!![]);}catch(_0x27ceb2){return BPromise[_0xad0f('0x21')](_0x27ceb2);}return _0x415530['save']();};}function saveUpdates(_0xd3ddd,_0x4e210){return function(_0x219b78){if(_0x219b78){return _0x219b78[_0xad0f('0x22')](_0xd3ddd)[_0xad0f('0x23')](function(_0x125feb){return _0x125feb;});}return null;};}function removeEntity(_0x1e4e18,_0x5c9153){return function(_0x508ba3){if(_0x508ba3){return _0x508ba3[_0xad0f('0x24')]()[_0xad0f('0x23')](function(){_0x1e4e18[_0xad0f('0x1a')](0xcc)[_0xad0f('0x25')]();});}};}function handleEntityNotFound(_0x44d9a4,_0x527b2a){return function(_0x4b6912){if(!_0x4b6912){_0x44d9a4[_0xad0f('0x26')](0x194);}return _0x4b6912;};}function handleError(_0x7fda1d,_0x4b5fb4){_0x4b5fb4=_0x4b5fb4||0x1f4;return function(_0x272291){logger['error'](_0x272291[_0xad0f('0x27')]);if(_0x272291[_0xad0f('0x28')]){delete _0x272291[_0xad0f('0x28')];}_0x7fda1d['status'](_0x4b5fb4)[_0xad0f('0x29')](_0x272291);};}exports[_0xad0f('0x2a')]=function(_0x2280f2,_0x381ae0){var _0xa653ff={},_0x548e6b={},_0x351809={'count':0x0,'rows':[]};var _0x26889b=_[_0xad0f('0x2b')](db[_0xad0f('0x2c')]['rawAttributes'],function(_0x41377f){return{'name':_0x41377f[_0xad0f('0x2d')],'type':_0x41377f[_0xad0f('0x2e')][_0xad0f('0x2f')]};});_0x548e6b[_0xad0f('0x30')]=_[_0xad0f('0x2b')](_0x26889b,_0xad0f('0x28'));_0x548e6b['query']=_['keys'](_0x2280f2[_0xad0f('0x31')]);_0x548e6b['filters']=_[_0xad0f('0x32')](_0x548e6b['model'],_0x548e6b[_0xad0f('0x31')]);_0xa653ff[_0xad0f('0x33')]=_['intersection'](_0x548e6b[_0xad0f('0x30')],qs[_0xad0f('0x34')](_0x2280f2[_0xad0f('0x31')][_0xad0f('0x34')]));_0xa653ff[_0xad0f('0x33')]=_0xa653ff[_0xad0f('0x33')][_0xad0f('0x35')]?_0xa653ff[_0xad0f('0x33')]:_0x548e6b[_0xad0f('0x30')];if(!_0x2280f2[_0xad0f('0x31')]['hasOwnProperty'](_0xad0f('0x36'))){_0xa653ff['limit']=qs[_0xad0f('0x1d')](_0x2280f2[_0xad0f('0x31')][_0xad0f('0x1d')]);_0xa653ff[_0xad0f('0x1c')]=qs[_0xad0f('0x1c')](_0x2280f2[_0xad0f('0x31')]['offset']);}_0xa653ff[_0xad0f('0x37')]=qs[_0xad0f('0x38')](_0x2280f2[_0xad0f('0x31')][_0xad0f('0x38')]);_0xa653ff[_0xad0f('0x39')]=qs[_0xad0f('0x3a')](_[_0xad0f('0x3b')](_0x2280f2['query'],_0x548e6b[_0xad0f('0x3a')]),_0x26889b);if(_0x2280f2[_0xad0f('0x31')]['filter']){_0xa653ff['where']=_[_0xad0f('0x3c')](_0xa653ff[_0xad0f('0x39')],{'$or':_[_0xad0f('0x2b')](_0x26889b,function(_0x3d7d29){if(_0x3d7d29[_0xad0f('0x2e')]!==_0xad0f('0x3d')){var _0x2cad23={};_0x2cad23[_0x3d7d29['name']]={'$like':'%'+_0x2280f2[_0xad0f('0x31')][_0xad0f('0x3e')]+'%'};return _0x2cad23;}})});}_0xa653ff=_['merge']({},_0xa653ff,_0x2280f2['options']);var _0x49847c={'where':_0xa653ff[_0xad0f('0x39')]};return db[_0xad0f('0x2c')][_0xad0f('0x1b')](_0x49847c)[_0xad0f('0x23')](function(_0x3625d1){_0x351809['count']=_0x3625d1;if(_0x2280f2[_0xad0f('0x31')][_0xad0f('0x3f')]){_0xa653ff[_0xad0f('0x40')]=[{'all':!![]}];}return db[_0xad0f('0x2c')]['findAll'](_0xa653ff);})[_0xad0f('0x23')](function(_0x1b6e1f){_0x351809['rows']=_0x1b6e1f;return _0x351809;})[_0xad0f('0x23')](respondWithFilteredResult(_0x381ae0,_0xa653ff))[_0xad0f('0x41')](handleError(_0x381ae0,null));};exports[_0xad0f('0x42')]=function(_0x24d163,_0x55e89d){var _0x3d9ead={'raw':!![],'where':{'id':_0x24d163['params']['id']}},_0x3352be={};_0x3352be[_0xad0f('0x30')]=_['keys'](db[_0xad0f('0x2c')][_0xad0f('0x43')]);_0x3352be['query']=_[_0xad0f('0x44')](_0x24d163['query']);_0x3352be['filters']=_[_0xad0f('0x32')](_0x3352be[_0xad0f('0x30')],_0x3352be['query']);_0x3d9ead[_0xad0f('0x33')]=_[_0xad0f('0x32')](_0x3352be['model'],qs['fields'](_0x24d163[_0xad0f('0x31')]['fields']));_0x3d9ead[_0xad0f('0x33')]=_0x3d9ead[_0xad0f('0x33')]['length']?_0x3d9ead[_0xad0f('0x33')]:_0x3352be[_0xad0f('0x30')];if(_0x24d163['query'][_0xad0f('0x3f')]){_0x3d9ead[_0xad0f('0x40')]=[{'all':!![]}];}_0x3d9ead=_['merge']({},_0x3d9ead,_0x24d163[_0xad0f('0x45')]);return db[_0xad0f('0x2c')][_0xad0f('0x46')](_0x3d9ead)[_0xad0f('0x23')](handleEntityNotFound(_0x55e89d,null))[_0xad0f('0x23')](respondWithResult(_0x55e89d,null))[_0xad0f('0x41')](handleError(_0x55e89d,null));};exports[_0xad0f('0x47')]=function(_0x5f11b2,_0x5930d8){return db[_0xad0f('0x2c')][_0xad0f('0x47')](_0x5f11b2['body'],{})[_0xad0f('0x23')](respondWithResult(_0x5930d8,0xc9))[_0xad0f('0x41')](handleError(_0x5930d8,null));};exports[_0xad0f('0x22')]=function(_0x570674,_0x275eca){if(_0x570674[_0xad0f('0x48')]['id']){delete _0x570674[_0xad0f('0x48')]['id'];}return db['VoiceTransferReport'][_0xad0f('0x46')]({'where':{'id':_0x570674['params']['id']}})[_0xad0f('0x23')](handleEntityNotFound(_0x275eca,null))['then'](saveUpdates(_0x570674['body'],null))[_0xad0f('0x23')](respondWithResult(_0x275eca,null))[_0xad0f('0x41')](handleError(_0x275eca,null));};exports[_0xad0f('0x24')]=function(_0x5de315,_0x2ae1df){return db[_0xad0f('0x2c')][_0xad0f('0x46')]({'where':{'id':_0x5de315[_0xad0f('0x49')]['id']}})[_0xad0f('0x23')](handleEntityNotFound(_0x2ae1df,null))[_0xad0f('0x23')](removeEntity(_0x2ae1df,null))[_0xad0f('0x41')](handleError(_0x2ae1df,null));};exports['describe']=function(_0x3245fd,_0x2fc5f6){return db['VoiceTransferReport'][_0xad0f('0x4a')]()[_0xad0f('0x23')](respondWithResult(_0x2fc5f6,null))[_0xad0f('0x41')](handleError(_0x2fc5f6,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 11cec17..e9e3957 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 _0x5227=['api','moment','bluebird','path','rimraf','../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger'];(function(_0x734063,_0x1addba){var _0x57b7e7=function(_0x10cf73){while(--_0x10cf73){_0x734063['push'](_0x734063['shift']());}};_0x57b7e7(++_0x1addba);}(_0x5227,0x1d1));var _0x7522=function(_0xa121d2,_0x53bf78){_0xa121d2=_0xa121d2-0x0;var _0x4fd840=_0x5227[_0xa121d2];return _0x4fd840;};'use strict';var _=require(_0x7522('0x0'));var util=require(_0x7522('0x1'));var logger=require(_0x7522('0x2'))(_0x7522('0x3'));var moment=require(_0x7522('0x4'));var BPromise=require(_0x7522('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7522('0x6'));var rimraf=require(_0x7522('0x7'));var config=require(_0x7522('0x8'));var attributes=require(_0x7522('0x9'));module['exports']=function(_0xa19d9a,_0x15e038){return _0xa19d9a[_0x7522('0xa')](_0x7522('0xb'),attributes,{'tableName':_0x7522('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46a7=['define','report_call_transfer','../../config/logger','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes'];(function(_0x323021,_0x30f030){var _0x52cb3e=function(_0x3b5a4e){while(--_0x3b5a4e){_0x323021['push'](_0x323021['shift']());}};_0x52cb3e(++_0x30f030);}(_0x46a7,0x92));var _0x746a=function(_0x208e8f,_0x830c3e){_0x208e8f=_0x208e8f-0x0;var _0x283291=_0x46a7[_0x208e8f];return _0x283291;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x746a('0x0'))('api');var moment=require('moment');var BPromise=require(_0x746a('0x1'));var rp=require(_0x746a('0x2'));var fs=require('fs');var path=require(_0x746a('0x3'));var rimraf=require('rimraf');var config=require(_0x746a('0x4'));var attributes=require(_0x746a('0x5'));module['exports']=function(_0x46d6fe,_0xbb31d7){return _0x46d6fe[_0x746a('0x6')]('VoiceTransferReport',attributes,{'tableName':_0x746a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 54ec80a..7f4f7ca 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 _0x51ac=['jayson/promise','http','request','then','info','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','VoiceTransferReport','create','body','options','raw','CreateVoiceTransferReport','debug','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x17238b,_0xd19486){var _0x3f31f9=function(_0x3c527a){while(--_0x3c527a){_0x17238b['push'](_0x17238b['shift']());}};_0x3f31f9(++_0xd19486);}(_0x51ac,0x6c));var _0xc51a=function(_0x133937,_0x2ebfad){_0x133937=_0x133937-0x0;var _0x5e8947=_0x51ac[_0x133937];return _0x5e8947;};'use strict';var _=require(_0xc51a('0x0'));var util=require(_0xc51a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc51a('0x2'));var fs=require('fs');var Redis=require(_0xc51a('0x3'));var db=require(_0xc51a('0x4'))['db'];var utils=require(_0xc51a('0x5'));var logger=require(_0xc51a('0x6'))(_0xc51a('0x7'));var config=require('../../config/environment');var jayson=require(_0xc51a('0x8'));var client=jayson['client'][_0xc51a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x454aca,_0x5badbd,_0x561d20){return new BPromise(function(_0x2cda37,_0x1598bf){return client[_0xc51a('0xa')](_0x454aca,_0x561d20)[_0xc51a('0xb')](function(_0x62cce1){logger[_0xc51a('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x5badbd,_0xc51a('0xd'));logger['debug'](_0xc51a('0xe'),_0x5badbd,_0xc51a('0xd'),JSON[_0xc51a('0xf')](_0x62cce1));if(_0x62cce1[_0xc51a('0x10')]){if(_0x62cce1[_0xc51a('0x10')][_0xc51a('0x11')]===0x1f4){logger[_0xc51a('0x10')](_0xc51a('0x12'),_0x5badbd,_0x62cce1[_0xc51a('0x10')][_0xc51a('0x13')]);return _0x1598bf(_0x62cce1[_0xc51a('0x10')][_0xc51a('0x13')]);}logger['error'](_0xc51a('0x12'),_0x5badbd,_0x62cce1['error'][_0xc51a('0x13')]);return _0x2cda37(_0x62cce1[_0xc51a('0x10')]['message']);}else{logger[_0xc51a('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x5badbd,_0xc51a('0xd'));_0x2cda37(_0x62cce1[_0xc51a('0x14')][_0xc51a('0x13')]);}})[_0xc51a('0x15')](function(_0x2ea6b0){logger[_0xc51a('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x5badbd,_0x2ea6b0);_0x1598bf(_0x2ea6b0);});});}exports['CreateVoiceTransferReport']=function(_0xbd57bb){var _0x260af1=this;return new Promise(function(_0x12e68d,_0x15a9f0){return db[_0xc51a('0x16')][_0xc51a('0x17')](_0xbd57bb[_0xc51a('0x18')],{'raw':_0xbd57bb[_0xc51a('0x19')]?_0xbd57bb['options'][_0xc51a('0x1a')]===undefined?!![]:![]:!![]})[_0xc51a('0xb')](function(_0x26f37e){logger[_0xc51a('0xc')](_0xc51a('0x1b'),_0xbd57bb);logger[_0xc51a('0x1c')]('CreateVoiceTransferReport',_0xbd57bb,JSON['stringify'](_0x26f37e));_0x12e68d(_0x26f37e);})['catch'](function(_0xf1c12c){logger['error'](_0xc51a('0x1b'),_0xf1c12c[_0xc51a('0x13')],_0xbd57bb);_0x15a9f0(_0x260af1[_0xc51a('0x10')](0x1f4,_0xf1c12c[_0xc51a('0x13')]));});});}; \ No newline at end of file +var _0x3f49=['VoiceTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','body','options','raw','CreateVoiceTransferReport','debug','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info'];(function(_0xf5f512,_0x131ec0){var _0x1940c9=function(_0x3e6795){while(--_0x3e6795){_0xf5f512['push'](_0xf5f512['shift']());}};_0x1940c9(++_0x131ec0);}(_0x3f49,0x11f));var _0x93f4=function(_0x232c58,_0x3c3b08){_0x232c58=_0x232c58-0x0;var _0x211154=_0x3f49[_0x232c58];return _0x211154;};'use strict';var _=require(_0x93f4('0x0'));var util=require(_0x93f4('0x1'));var moment=require('moment');var BPromise=require(_0x93f4('0x2'));var rs=require(_0x93f4('0x3'));var fs=require('fs');var Redis=require(_0x93f4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x93f4('0x5'));var logger=require(_0x93f4('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x93f4('0x7'));var client=jayson[_0x93f4('0x8')][_0x93f4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a86ad,_0x956b50,_0x5d22d9){return new BPromise(function(_0x144f31,_0x5e5b4d){return client[_0x93f4('0xa')](_0x5a86ad,_0x5d22d9)[_0x93f4('0xb')](function(_0x325984){logger[_0x93f4('0xc')](_0x93f4('0xd'),_0x956b50,_0x93f4('0xe'));logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x956b50,_0x93f4('0xe'),JSON[_0x93f4('0xf')](_0x325984));if(_0x325984[_0x93f4('0x10')]){if(_0x325984[_0x93f4('0x10')][_0x93f4('0x11')]===0x1f4){logger[_0x93f4('0x10')](_0x93f4('0xd'),_0x956b50,_0x325984[_0x93f4('0x10')]['message']);return _0x5e5b4d(_0x325984[_0x93f4('0x10')]['message']);}logger['error'](_0x93f4('0xd'),_0x956b50,_0x325984[_0x93f4('0x10')][_0x93f4('0x12')]);return _0x144f31(_0x325984['error']['message']);}else{logger[_0x93f4('0xc')](_0x93f4('0xd'),_0x956b50,_0x93f4('0xe'));_0x144f31(_0x325984['result'][_0x93f4('0x12')]);}})[_0x93f4('0x13')](function(_0x53151e){logger[_0x93f4('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x956b50,_0x53151e);_0x5e5b4d(_0x53151e);});});}exports['CreateVoiceTransferReport']=function(_0x1d4773){var _0x5b6488=this;return new Promise(function(_0x38d8b6,_0x556fc6){return db['VoiceTransferReport']['create'](_0x1d4773[_0x93f4('0x14')],{'raw':_0x1d4773[_0x93f4('0x15')]?_0x1d4773['options'][_0x93f4('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x3ead08){logger[_0x93f4('0xc')](_0x93f4('0x17'),_0x1d4773);logger[_0x93f4('0x18')]('CreateVoiceTransferReport',_0x1d4773,JSON['stringify'](_0x3ead08));_0x38d8b6(_0x3ead08);})[_0x93f4('0x13')](function(_0x432f99){logger['error']('CreateVoiceTransferReport',_0x432f99['message'],_0x1d4773);_0x556fc6(_0x5b6488[_0x93f4('0x10')](0x1f4,_0x432f99[_0x93f4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index d24715e..c039256 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 _0x765b=['/hold','unhold','calls','/transfer','transfer','exports','./webbar.controller','/originate','canUpdate','originate','post','isAuthenticated','answer'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x765b,0x18c));var _0xb765=function(_0x1488cd,_0x25a893){_0x1488cd=_0x1488cd-0x0;var _0x63fa13=_0x765b[_0x1488cd];return _0x63fa13;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xb765('0x0'));router['post'](_0xb765('0x1'),auth['isAuthenticated'](),auth[_0xb765('0x2')](),controller[_0xb765('0x3')]);router[_0xb765('0x4')]('/hangup',auth['isAuthenticated'](),auth['canUpdate'](),controller['hangup']);router[_0xb765('0x4')]('/answer',auth[_0xb765('0x5')](),auth[_0xb765('0x2')](),controller[_0xb765('0x6')]);router['post'](_0xb765('0x7'),auth[_0xb765('0x5')](),auth[_0xb765('0x2')](),controller['hold']);router['post']('/unhold',auth[_0xb765('0x5')](),auth[_0xb765('0x2')](),controller[_0xb765('0x8')]);router[_0xb765('0x4')]('/calls',auth[_0xb765('0x5')](),auth[_0xb765('0x2')](),controller[_0xb765('0x9')]);router[_0xb765('0x4')](_0xb765('0xa'),auth[_0xb765('0x5')](),auth[_0xb765('0x2')](),controller[_0xb765('0xb')]);module[_0xb765('0xc')]=router; \ No newline at end of file +var _0x6183=['/originate','isAuthenticated','canUpdate','originate','post','/hangup','hangup','answer','/hold','hold','/unhold','unhold','calls','transfer','exports','Router','../../components/auth/service','./webbar.controller'];(function(_0x287059,_0x499940){var _0x225c79=function(_0x3aa36e){while(--_0x3aa36e){_0x287059['push'](_0x287059['shift']());}};_0x225c79(++_0x499940);}(_0x6183,0x19b));var _0x3618=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x6183[_0x44bcb0];return _0xfaf881;};'use strict';var express=require('express');var router=express[_0x3618('0x0')]();var auth=require(_0x3618('0x1'));var controller=require(_0x3618('0x2'));router['post'](_0x3618('0x3'),auth[_0x3618('0x4')](),auth[_0x3618('0x5')](),controller[_0x3618('0x6')]);router[_0x3618('0x7')](_0x3618('0x8'),auth[_0x3618('0x4')](),auth[_0x3618('0x5')](),controller[_0x3618('0x9')]);router[_0x3618('0x7')]('/answer',auth['isAuthenticated'](),auth[_0x3618('0x5')](),controller[_0x3618('0xa')]);router[_0x3618('0x7')](_0x3618('0xb'),auth[_0x3618('0x4')](),auth[_0x3618('0x5')](),controller[_0x3618('0xc')]);router[_0x3618('0x7')](_0x3618('0xd'),auth[_0x3618('0x4')](),auth[_0x3618('0x5')](),controller[_0x3618('0xe')]);router['post']('/calls',auth[_0x3618('0x4')](),auth['canUpdate'](),controller[_0x3618('0xf')]);router[_0x3618('0x7')]('/transfer',auth[_0x3618('0x4')](),auth[_0x3618('0x5')](),controller[_0x3618('0x10')]);module[_0x3618('0x11')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 189bca9..e2d1146 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 _0x8f69=['stack','status','send','name','NotFound','request','code','message','catch','User','VoiceChannels','all','then','filter','rows','sessionId','\x20not\x20found!','originate','body','length','userId','callbackUrl','format','user:%s','webbar:originate','json','entityFound:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','UserId','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','transfer\x20executed!','path','lodash','../../mysqldb','util','bluebird','jayson/promise','../../config/logger','ioredis','redis','defaults','socket.io-emitter','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','transferNumber\x20is\x20required','info','stringify','emit','log','error'];(function(_0x47e74f,_0x15a10c){var _0x1f0557=function(_0x2c3396){while(--_0x2c3396){_0x47e74f['push'](_0x47e74f['shift']());}};_0x1f0557(++_0x15a10c);}(_0x8f69,0xfa));var _0x98f6=function(_0x5d860f,_0x467498){_0x5d860f=_0x5d860f-0x0;var _0x236490=_0x8f69[_0x5d860f];return _0x236490;};'use strict';var path=require(_0x98f6('0x0'));var fs=require('fs');var _=require(_0x98f6('0x1'));var db=require(_0x98f6('0x2'))['db'];var config=require('../../config/environment');var util=require(_0x98f6('0x3'));var BPromise=require(_0x98f6('0x4'));var jayson=require(_0x98f6('0x5'));var amiClient=jayson['client']['http']({'port':0x232a});var logger=require(_0x98f6('0x6'))('webbarapi');var Redis=require(_0x98f6('0x7'));config[_0x98f6('0x8')]=_[_0x98f6('0x9')](config[_0x98f6('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x98f6('0xa'))(new Redis(config[_0x98f6('0x8')]));var Schema=require(_0x98f6('0xb'));var originateValidation=new Schema({'userId':{'type':_0x98f6('0xc'),'required':[!![],_0x98f6('0xd')]},'callNumber':{'type':'string','required':[!![],_0x98f6('0xe')]},'callerId':{'type':_0x98f6('0xf')},'callbackUrl':{'type':_0x98f6('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x98f6('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x98f6('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x98f6('0xc'),'required':[!![],_0x98f6('0xd')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x98f6('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x98f6('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x98f6('0xf'),'required':[!![],_0x98f6('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0x98f6('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x98f6('0xd')]},'sessionId':{'type':_0x98f6('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x98f6('0xc'),'required':[!![],_0x98f6('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0x98f6('0xc'),'required':[!![],_0x98f6('0xd')]}});function emit(_0x19b67c,_0x328c95,_0x4649fd){logger[_0x98f6('0x11')](_0x19b67c,_0x328c95,JSON[_0x98f6('0x12')](_0x4649fd));io['to'](_0x19b67c)[_0x98f6('0x13')](_0x328c95,_0x4649fd);}function handleError(_0x2b7cf6){return function(_0x2b585a){console[_0x98f6('0x14')]('handleError:',_0x2b585a,_0x2b585a instanceof RangeError);logger[_0x98f6('0x15')](_0x2b585a[_0x98f6('0x16')]);if(_0x2b585a instanceof RangeError){if(_0x2b585a['name']){delete _0x2b585a['name'];}_0x2b7cf6[_0x98f6('0x17')](0x194)[_0x98f6('0x18')](_0x2b585a);}else{if(_0x2b585a[_0x98f6('0x19')]){delete _0x2b585a[_0x98f6('0x19')];}_0x2b7cf6[_0x98f6('0x17')](0x1f4)[_0x98f6('0x18')](_0x2b585a);}};}function checkError(){return function(_0x48f47e){if(!_0x48f47e){throw new RangeError(_0x98f6('0x1a'));}return _0x48f47e;};}function respondWithRpcPromise(_0x2c4b65,_0x1f0ba6){return new BPromise(function(_0x4e7a79,_0x5d7807){var _0x15152c=amiClient;return _0x15152c[_0x98f6('0x1b')](_0x2c4b65,_0x1f0ba6)['then'](function(_0x5fc7ba){if(_0x5fc7ba[_0x98f6('0x15')]){if(_0x5fc7ba[_0x98f6('0x15')][_0x98f6('0x1c')]===0x1f4){return _0x5d7807(_0x5fc7ba[_0x98f6('0x15')][_0x98f6('0x1d')]);}return _0x4e7a79(_0x5fc7ba[_0x98f6('0x15')][_0x98f6('0x1d')]);}else{_0x4e7a79(_0x5fc7ba['result']);}})[_0x98f6('0x1e')](function(_0x24399f){_0x5d7807(_0x24399f);});});}function getAgent(_0xff481e){return db[_0x98f6('0x1f')]['findOne']({'where':{'id':_0xff481e,'role':'agent'}})['then'](checkError());}function getAgentCheckSession(_0x5643ed,_0x224c13){return new BPromise(function(_0x53368e,_0x2420d0){var _0xd36ee7=respondWithRpcPromise(_0x98f6('0x20'));var _0x417e47=getAgent(_0x5643ed);Promise[_0x98f6('0x21')]([_0xd36ee7,_0x417e47])[_0x98f6('0x22')](function(_0x58ed7){var _0x5877ea=_0x58ed7[0x0];var _0x67bd69=_0x58ed7[0x1];var _0x51b3ed=_[_0x98f6('0x23')](_0x5877ea[_0x98f6('0x24')],function(_0x2a2dd0){return _0x2a2dd0['UserId']==_0x67bd69['id']&&_0x2a2dd0[_0x98f6('0x25')]==_0x224c13;});if(_0x51b3ed['length']==0x1){_0x53368e(_0x67bd69);}else{_0x2420d0(new RangeError('sessionId\x20'+_0x224c13+_0x98f6('0x26')));}});});}exports[_0x98f6('0x27')]=function(_0x24c632,_0x3aed96){logger[_0x98f6('0x11')]('originate\x20fired:',_0x24c632[_0x98f6('0x28')]);var _0x20d902=originateValidation[_0x98f6('0xb')](_0x24c632['body']);if(_0x20d902[_0x98f6('0x29')]>0x0){return _0x3aed96['status'](0x190)['json'](_0x20d902);}var _0x3f3ff2=_0x24c632['body'][_0x98f6('0x2a')];var _0x3ebd25=_0x24c632['body']['callNumber'];var _0x33d4b5=_0x24c632[_0x98f6('0x28')]['callerId'];var _0x3ade57=_0x24c632[_0x98f6('0x28')][_0x98f6('0x2b')];return getAgent(_0x3f3ff2)[_0x98f6('0x22')](function(_0xa630be){logger[_0x98f6('0x11')]('entityFound:',_0xa630be[_0x98f6('0x19')]);emit(util[_0x98f6('0x2c')](_0x98f6('0x2d'),_0xa630be[_0x98f6('0x19')]),_0x98f6('0x2e'),{'callNumber':_0x3ebd25,'callerId':_0x33d4b5,'callbackUrl':_0x3ade57});return _0x3aed96['status'](0xc8)[_0x98f6('0x2f')]({'error':![],'message':'originate\x20executed!'});})[_0x98f6('0x1e')](handleError(_0x3aed96));};exports['hangup']=function(_0x4dd96a,_0x2b82fd){logger['info']('hangup\x20fired:',_0x4dd96a['body']);var _0x183441=hangupValidation[_0x98f6('0xb')](_0x4dd96a['body']);if(_0x183441[_0x98f6('0x29')]>0x0){return _0x2b82fd['status'](0x190)[_0x98f6('0x2f')](_0x183441);}var _0x38b1e1=_0x4dd96a['body']['userId'];var _0x409f5a=_0x4dd96a['body']['sessionId'];return getAgent(_0x38b1e1)[_0x98f6('0x22')](function(_0x3312ef){logger['info'](_0x98f6('0x30'),_0x3312ef[_0x98f6('0x19')]);emit(util[_0x98f6('0x2c')]('user:%s',_0x3312ef['name']),_0x98f6('0x31'),{'sessionId':_0x409f5a});return _0x2b82fd[_0x98f6('0x17')](0xc8)['json']({'error':![],'message':_0x98f6('0x32')});})[_0x98f6('0x1e')](handleError(_0x2b82fd));};exports[_0x98f6('0x33')]=function(_0x3a941e,_0x574e69){logger[_0x98f6('0x11')](_0x98f6('0x34'),_0x3a941e[_0x98f6('0x28')]);var _0x5d6a69=answerValidation[_0x98f6('0xb')](_0x3a941e[_0x98f6('0x28')]);if(_0x5d6a69['length']>0x0){return _0x574e69[_0x98f6('0x17')](0x190)[_0x98f6('0x2f')](_0x5d6a69);}var _0x13f40c=_0x3a941e[_0x98f6('0x28')][_0x98f6('0x2a')];var _0x5a8408=_0x3a941e[_0x98f6('0x28')][_0x98f6('0x25')];return getAgent(_0x13f40c)[_0x98f6('0x22')](function(_0x46d914){logger[_0x98f6('0x11')]('entityFound:',_0x46d914[_0x98f6('0x19')]);emit(util[_0x98f6('0x2c')](_0x98f6('0x2d'),_0x46d914[_0x98f6('0x19')]),_0x98f6('0x35'),{'sessionId':_0x5a8408});return _0x574e69[_0x98f6('0x17')](0xc8)[_0x98f6('0x2f')]({'error':![],'message':_0x98f6('0x36')});})[_0x98f6('0x1e')](handleError(_0x574e69));};exports[_0x98f6('0x37')]=function(_0x4705a2,_0x1ef445){logger[_0x98f6('0x11')]('hold\x20fired:',_0x4705a2['body']);var _0x320bf5=holdValidation[_0x98f6('0xb')](_0x4705a2[_0x98f6('0x28')]);if(_0x320bf5[_0x98f6('0x29')]>0x0){return _0x1ef445[_0x98f6('0x17')](0x190)[_0x98f6('0x2f')](_0x320bf5);}var _0x555efe=_0x4705a2['body'][_0x98f6('0x2a')];var _0x5dee42=_0x4705a2['body']['sessionId'];return getAgent(_0x555efe)[_0x98f6('0x22')](function(_0x1c429c){logger['info'](_0x98f6('0x30'),_0x1c429c[_0x98f6('0x19')]);emit(util[_0x98f6('0x2c')]('user:%s',_0x1c429c['name']),'webbar:hold',{'sessionId':_0x5dee42});return _0x1ef445['status'](0xc8)[_0x98f6('0x2f')]({'error':![],'message':_0x98f6('0x38')});})[_0x98f6('0x1e')](handleError(_0x1ef445));};exports['unhold']=function(_0x4ff228,_0x4200f1){logger[_0x98f6('0x11')](_0x98f6('0x39'),_0x4ff228[_0x98f6('0x28')]);var _0x4c8c04=unholdValidation[_0x98f6('0xb')](_0x4ff228[_0x98f6('0x28')]);if(_0x4c8c04[_0x98f6('0x29')]>0x0){return _0x4200f1[_0x98f6('0x17')](0x190)[_0x98f6('0x2f')](_0x4c8c04);}var _0xa97ea6=_0x4ff228[_0x98f6('0x28')][_0x98f6('0x2a')];var _0xd9a100=_0x4ff228[_0x98f6('0x28')][_0x98f6('0x25')];return getAgent(_0xa97ea6)['then'](function(_0x29df99){logger['info'](_0x98f6('0x30'),_0x29df99[_0x98f6('0x19')]);emit(util[_0x98f6('0x2c')](_0x98f6('0x2d'),_0x29df99['name']),_0x98f6('0x3a'),{'sessionId':_0xd9a100});return _0x4200f1[_0x98f6('0x17')](0xc8)[_0x98f6('0x2f')]({'error':![],'message':_0x98f6('0x3b')});})[_0x98f6('0x1e')](handleError(_0x4200f1));};exports['calls']=function(_0x224d95,_0x2449dd){logger[_0x98f6('0x11')](_0x98f6('0x3c'),_0x2449dd[_0x98f6('0x28')]);var _0x59df3b=callsValidation[_0x98f6('0xb')](_0x224d95[_0x98f6('0x28')]);if(_0x59df3b[_0x98f6('0x29')]>0x0){return _0x2449dd['status'](0x190)[_0x98f6('0x2f')](_0x59df3b);}var _0x32bfda=_0x224d95[_0x98f6('0x28')][_0x98f6('0x2a')];var _0x1d3064=respondWithRpcPromise('VoiceChannels');var _0x482552=getAgent(_0x32bfda);return Promise['all']([_0x1d3064,_0x482552])[_0x98f6('0x22')](function(_0x2ed29f){var _0x4fb09b=_0x2ed29f[0x0];var _0x1c59ef=_0x2ed29f[0x1];var _0x56d695=_[_0x98f6('0x23')](_0x4fb09b['rows'],function(_0xb13417){return _0xb13417[_0x98f6('0x3d')]==_0x1c59ef['id'];});return _0x2449dd['status'](0xc8)[_0x98f6('0x2f')]({'count':_0x56d695[_0x98f6('0x29')],'rows':_0x56d695});})[_0x98f6('0x1e')](handleError(_0x2449dd));};exports[_0x98f6('0x3e')]=function(_0x9dc60e,_0x13a7be){logger[_0x98f6('0x11')](_0x98f6('0x3f'),_0x9dc60e[_0x98f6('0x28')]);var _0x322315=conferenceValidation['validate'](_0x9dc60e[_0x98f6('0x28')]);if(_0x322315[_0x98f6('0x29')]>0x0){return _0x13a7be['status'](0x190)[_0x98f6('0x2f')](_0x322315);}var _0x4d20a1=_0x9dc60e[_0x98f6('0x28')][_0x98f6('0x2a')];return getAgent(_0x4d20a1)[_0x98f6('0x22')](function(_0x128f8a){logger[_0x98f6('0x11')]('entityFound:',_0x128f8a[_0x98f6('0x19')]);emit(util['format'](_0x98f6('0x2d'),_0x128f8a[_0x98f6('0x19')]),_0x98f6('0x40'));return _0x13a7be[_0x98f6('0x17')](0xc8)[_0x98f6('0x2f')]({'error':![],'message':_0x98f6('0x41')});})[_0x98f6('0x1e')](handleError(_0x13a7be));};exports['transfer']=function(_0x6a4c6b,_0x72e100){logger[_0x98f6('0x11')](_0x98f6('0x42'),_0x6a4c6b[_0x98f6('0x28')]);var _0x4fbc2e=transferValidation[_0x98f6('0xb')](_0x6a4c6b[_0x98f6('0x28')]);if(_0x4fbc2e['length']>0x0){return _0x72e100[_0x98f6('0x17')](0x190)['json'](_0x4fbc2e);}var _0x3a12f3=_0x6a4c6b[_0x98f6('0x28')][_0x98f6('0x2a')];var _0x1998bb=_0x6a4c6b['body'][_0x98f6('0x25')];var _0x4a80a9=_0x6a4c6b[_0x98f6('0x28')]['transferNumber'];return getAgent(_0x3a12f3)[_0x98f6('0x22')](function(_0x4587f6){logger[_0x98f6('0x11')](_0x98f6('0x30'),_0x4587f6[_0x98f6('0x19')]);emit(util['format']('user:%s',_0x4587f6[_0x98f6('0x19')]),'webbar:transfer',{'sessionId':_0x1998bb,'transferNumber':_0x4a80a9});return _0x72e100[_0x98f6('0x17')](0xc8)[_0x98f6('0x2f')]({'error':![],'message':_0x98f6('0x43')});})['catch'](handleError(_0x72e100));}; \ No newline at end of file +var _0x34ea=['catch','hangup','hangup\x20fired:','entityFound:','webbar:hangup','answer','answer\x20fired:','answer\x20executed!','hold','hold\x20fired:','userId','hold\x20executed!','unhold','unhold\x20executed!','calls','conference\x20executed!','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','ioredis','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','NotFound','code','message','result','agent','then','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','callNumber','callbackUrl','format','user:%s','webbar:originate','originate\x20executed!'];(function(_0x49e58d,_0x5393ab){var _0x432667=function(_0x306803){while(--_0x306803){_0x49e58d['push'](_0x49e58d['shift']());}};_0x432667(++_0x5393ab);}(_0x34ea,0xa8));var _0xa34e=function(_0x31ab6c,_0x1e2c45){_0x31ab6c=_0x31ab6c-0x0;var _0x1f63ea=_0x34ea[_0x31ab6c];return _0x1f63ea;};'use strict';var path=require(_0xa34e('0x0'));var fs=require('fs');var _=require(_0xa34e('0x1'));var db=require(_0xa34e('0x2'))['db'];var config=require(_0xa34e('0x3'));var util=require(_0xa34e('0x4'));var BPromise=require(_0xa34e('0x5'));var jayson=require(_0xa34e('0x6'));var amiClient=jayson[_0xa34e('0x7')][_0xa34e('0x8')]({'port':0x232a});var logger=require(_0xa34e('0x9'))('webbarapi');var Redis=require(_0xa34e('0xa'));config['redis']=_['defaults'](config[_0xa34e('0xb')],{'host':_0xa34e('0xc'),'port':0x18eb});var io=require(_0xa34e('0xd'))(new Redis(config['redis']));var Schema=require(_0xa34e('0xe'));var originateValidation=new Schema({'userId':{'type':_0xa34e('0xf'),'required':[!![],_0xa34e('0x10')]},'callNumber':{'type':_0xa34e('0x11'),'required':[!![],_0xa34e('0x12')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xa34e('0x11')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xa34e('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa34e('0x10')]},'sessionId':{'type':_0xa34e('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xa34e('0xf'),'required':[!![],_0xa34e('0x10')]},'sessionId':{'type':_0xa34e('0x11'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xa34e('0x11'),'required':[!![],_0xa34e('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0xa34e('0xf'),'required':[!![],_0xa34e('0x10')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa34e('0x10')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xa34e('0xf'),'required':[!![],_0xa34e('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0xa34e('0xf'),'required':[!![],_0xa34e('0x10')]}});function emit(_0x121383,_0x51a28f,_0x54cc26){logger[_0xa34e('0x14')](_0x121383,_0x51a28f,JSON[_0xa34e('0x15')](_0x54cc26));io['to'](_0x121383)[_0xa34e('0x16')](_0x51a28f,_0x54cc26);}function handleError(_0x1b94cc){return function(_0x1d5cf5){console[_0xa34e('0x17')](_0xa34e('0x18'),_0x1d5cf5,_0x1d5cf5 instanceof RangeError);logger[_0xa34e('0x19')](_0x1d5cf5[_0xa34e('0x1a')]);if(_0x1d5cf5 instanceof RangeError){if(_0x1d5cf5[_0xa34e('0x1b')]){delete _0x1d5cf5[_0xa34e('0x1b')];}_0x1b94cc[_0xa34e('0x1c')](0x194)['send'](_0x1d5cf5);}else{if(_0x1d5cf5['name']){delete _0x1d5cf5[_0xa34e('0x1b')];}_0x1b94cc[_0xa34e('0x1c')](0x1f4)['send'](_0x1d5cf5);}};}function checkError(){return function(_0x19cd49){if(!_0x19cd49){throw new RangeError(_0xa34e('0x1d'));}return _0x19cd49;};}function respondWithRpcPromise(_0x521e1b,_0x4c4258){return new BPromise(function(_0x3d5795,_0x1ce637){var _0x99801=amiClient;return _0x99801['request'](_0x521e1b,_0x4c4258)['then'](function(_0xcc8b78){if(_0xcc8b78[_0xa34e('0x19')]){if(_0xcc8b78[_0xa34e('0x19')][_0xa34e('0x1e')]===0x1f4){return _0x1ce637(_0xcc8b78[_0xa34e('0x19')][_0xa34e('0x1f')]);}return _0x3d5795(_0xcc8b78[_0xa34e('0x19')]['message']);}else{_0x3d5795(_0xcc8b78[_0xa34e('0x20')]);}})['catch'](function(_0x2cb68f){_0x1ce637(_0x2cb68f);});});}function getAgent(_0x13fbfc){return db['User']['findOne']({'where':{'id':_0x13fbfc,'role':_0xa34e('0x21')}})[_0xa34e('0x22')](checkError());}function getAgentCheckSession(_0x594878,_0x10563c){return new BPromise(function(_0x5abd21,_0x334073){var _0xbb76ec=respondWithRpcPromise(_0xa34e('0x23'));var _0x4c7e10=getAgent(_0x594878);Promise[_0xa34e('0x24')]([_0xbb76ec,_0x4c7e10])['then'](function(_0x5d0ab5){var _0x50c65f=_0x5d0ab5[0x0];var _0x5d4c63=_0x5d0ab5[0x1];var _0x1cea47=_[_0xa34e('0x25')](_0x50c65f[_0xa34e('0x26')],function(_0x1ee157){return _0x1ee157[_0xa34e('0x27')]==_0x5d4c63['id']&&_0x1ee157[_0xa34e('0x28')]==_0x10563c;});if(_0x1cea47[_0xa34e('0x29')]==0x1){_0x5abd21(_0x5d4c63);}else{_0x334073(new RangeError(_0xa34e('0x2a')+_0x10563c+_0xa34e('0x2b')));}});});}exports[_0xa34e('0x2c')]=function(_0x4b7716,_0x374fbb){logger[_0xa34e('0x14')](_0xa34e('0x2d'),_0x4b7716[_0xa34e('0x2e')]);var _0x485df8=originateValidation['validate'](_0x4b7716[_0xa34e('0x2e')]);if(_0x485df8[_0xa34e('0x29')]>0x0){return _0x374fbb[_0xa34e('0x1c')](0x190)[_0xa34e('0x2f')](_0x485df8);}var _0x1da873=_0x4b7716[_0xa34e('0x2e')]['userId'];var _0x32b7ea=_0x4b7716[_0xa34e('0x2e')][_0xa34e('0x30')];var _0x3623ff=_0x4b7716[_0xa34e('0x2e')]['callerId'];var _0x316260=_0x4b7716[_0xa34e('0x2e')][_0xa34e('0x31')];return getAgent(_0x1da873)[_0xa34e('0x22')](function(_0x217081){logger[_0xa34e('0x14')]('entityFound:',_0x217081[_0xa34e('0x1b')]);emit(util[_0xa34e('0x32')](_0xa34e('0x33'),_0x217081[_0xa34e('0x1b')]),_0xa34e('0x34'),{'callNumber':_0x32b7ea,'callerId':_0x3623ff,'callbackUrl':_0x316260});return _0x374fbb[_0xa34e('0x1c')](0xc8)['json']({'error':![],'message':_0xa34e('0x35')});})[_0xa34e('0x36')](handleError(_0x374fbb));};exports[_0xa34e('0x37')]=function(_0x33cac2,_0x4a11be){logger[_0xa34e('0x14')](_0xa34e('0x38'),_0x33cac2[_0xa34e('0x2e')]);var _0x2db59e=hangupValidation[_0xa34e('0xe')](_0x33cac2[_0xa34e('0x2e')]);if(_0x2db59e[_0xa34e('0x29')]>0x0){return _0x4a11be[_0xa34e('0x1c')](0x190)[_0xa34e('0x2f')](_0x2db59e);}var _0x2d8484=_0x33cac2[_0xa34e('0x2e')]['userId'];var _0x55d9a8=_0x33cac2['body'][_0xa34e('0x28')];return getAgent(_0x2d8484)[_0xa34e('0x22')](function(_0x1fc253){logger[_0xa34e('0x14')](_0xa34e('0x39'),_0x1fc253[_0xa34e('0x1b')]);emit(util[_0xa34e('0x32')](_0xa34e('0x33'),_0x1fc253['name']),_0xa34e('0x3a'),{'sessionId':_0x55d9a8});return _0x4a11be['status'](0xc8)[_0xa34e('0x2f')]({'error':![],'message':'hangup\x20executed!'});})[_0xa34e('0x36')](handleError(_0x4a11be));};exports[_0xa34e('0x3b')]=function(_0x906f0c,_0x227666){logger[_0xa34e('0x14')](_0xa34e('0x3c'),_0x906f0c['body']);var _0x478b44=answerValidation['validate'](_0x906f0c[_0xa34e('0x2e')]);if(_0x478b44[_0xa34e('0x29')]>0x0){return _0x227666[_0xa34e('0x1c')](0x190)[_0xa34e('0x2f')](_0x478b44);}var _0x505b73=_0x906f0c[_0xa34e('0x2e')]['userId'];var _0x16bbfc=_0x906f0c[_0xa34e('0x2e')]['sessionId'];return getAgent(_0x505b73)[_0xa34e('0x22')](function(_0xbb253b){logger[_0xa34e('0x14')](_0xa34e('0x39'),_0xbb253b[_0xa34e('0x1b')]);emit(util['format'](_0xa34e('0x33'),_0xbb253b['name']),'webbar:answer',{'sessionId':_0x16bbfc});return _0x227666['status'](0xc8)[_0xa34e('0x2f')]({'error':![],'message':_0xa34e('0x3d')});})[_0xa34e('0x36')](handleError(_0x227666));};exports[_0xa34e('0x3e')]=function(_0x2f6f9d,_0x5e2372){logger['info'](_0xa34e('0x3f'),_0x2f6f9d[_0xa34e('0x2e')]);var _0x30c317=holdValidation[_0xa34e('0xe')](_0x2f6f9d[_0xa34e('0x2e')]);if(_0x30c317[_0xa34e('0x29')]>0x0){return _0x5e2372[_0xa34e('0x1c')](0x190)[_0xa34e('0x2f')](_0x30c317);}var _0x444f6a=_0x2f6f9d[_0xa34e('0x2e')][_0xa34e('0x40')];var _0x318adb=_0x2f6f9d[_0xa34e('0x2e')]['sessionId'];return getAgent(_0x444f6a)['then'](function(_0xcf6e73){logger[_0xa34e('0x14')](_0xa34e('0x39'),_0xcf6e73['name']);emit(util[_0xa34e('0x32')](_0xa34e('0x33'),_0xcf6e73[_0xa34e('0x1b')]),'webbar:hold',{'sessionId':_0x318adb});return _0x5e2372[_0xa34e('0x1c')](0xc8)['json']({'error':![],'message':_0xa34e('0x41')});})['catch'](handleError(_0x5e2372));};exports[_0xa34e('0x42')]=function(_0x3c3aa9,_0x5709e8){logger[_0xa34e('0x14')]('unhold\x20fired:',_0x3c3aa9[_0xa34e('0x2e')]);var _0x2e086c=unholdValidation['validate'](_0x3c3aa9[_0xa34e('0x2e')]);if(_0x2e086c[_0xa34e('0x29')]>0x0){return _0x5709e8['status'](0x190)[_0xa34e('0x2f')](_0x2e086c);}var _0x290aa6=_0x3c3aa9[_0xa34e('0x2e')][_0xa34e('0x40')];var _0x203a87=_0x3c3aa9[_0xa34e('0x2e')][_0xa34e('0x28')];return getAgent(_0x290aa6)['then'](function(_0x570736){logger[_0xa34e('0x14')]('entityFound:',_0x570736[_0xa34e('0x1b')]);emit(util[_0xa34e('0x32')]('user:%s',_0x570736[_0xa34e('0x1b')]),'webbar:unhold',{'sessionId':_0x203a87});return _0x5709e8[_0xa34e('0x1c')](0xc8)[_0xa34e('0x2f')]({'error':![],'message':_0xa34e('0x43')});})[_0xa34e('0x36')](handleError(_0x5709e8));};exports[_0xa34e('0x44')]=function(_0x5d1890,_0x944ada){logger[_0xa34e('0x14')]('calls\x20fired:',_0x944ada['body']);var _0x138ab1=callsValidation[_0xa34e('0xe')](_0x5d1890[_0xa34e('0x2e')]);if(_0x138ab1[_0xa34e('0x29')]>0x0){return _0x944ada[_0xa34e('0x1c')](0x190)[_0xa34e('0x2f')](_0x138ab1);}var _0x49b3b2=_0x5d1890[_0xa34e('0x2e')][_0xa34e('0x40')];var _0x3769de=respondWithRpcPromise(_0xa34e('0x23'));var _0x46766b=getAgent(_0x49b3b2);return Promise[_0xa34e('0x24')]([_0x3769de,_0x46766b])[_0xa34e('0x22')](function(_0x46fa75){var _0x545bf9=_0x46fa75[0x0];var _0xcd0f89=_0x46fa75[0x1];var _0x23e4c6=_[_0xa34e('0x25')](_0x545bf9[_0xa34e('0x26')],function(_0x4d1680){return _0x4d1680[_0xa34e('0x27')]==_0xcd0f89['id'];});return _0x944ada[_0xa34e('0x1c')](0xc8)[_0xa34e('0x2f')]({'count':_0x23e4c6['length'],'rows':_0x23e4c6});})[_0xa34e('0x36')](handleError(_0x944ada));};exports['conference']=function(_0x35bfd5,_0x46b047){logger[_0xa34e('0x14')]('conference\x20fired:',_0x35bfd5['body']);var _0x420bca=conferenceValidation['validate'](_0x35bfd5[_0xa34e('0x2e')]);if(_0x420bca[_0xa34e('0x29')]>0x0){return _0x46b047[_0xa34e('0x1c')](0x190)[_0xa34e('0x2f')](_0x420bca);}var _0x4fd092=_0x35bfd5['body'][_0xa34e('0x40')];return getAgent(_0x4fd092)['then'](function(_0xd9d7d0){logger[_0xa34e('0x14')](_0xa34e('0x39'),_0xd9d7d0['name']);emit(util['format'](_0xa34e('0x33'),_0xd9d7d0['name']),'webbar:conference');return _0x46b047[_0xa34e('0x1c')](0xc8)[_0xa34e('0x2f')]({'error':![],'message':_0xa34e('0x45')});})[_0xa34e('0x36')](handleError(_0x46b047));};exports[_0xa34e('0x46')]=function(_0x34ef83,_0x248635){logger[_0xa34e('0x14')]('transfer\x20fired:',_0x34ef83[_0xa34e('0x2e')]);var _0x5ac1e2=transferValidation[_0xa34e('0xe')](_0x34ef83[_0xa34e('0x2e')]);if(_0x5ac1e2[_0xa34e('0x29')]>0x0){return _0x248635['status'](0x190)['json'](_0x5ac1e2);}var _0xa72124=_0x34ef83[_0xa34e('0x2e')][_0xa34e('0x40')];var _0x3ec4cb=_0x34ef83['body'][_0xa34e('0x28')];var _0x577996=_0x34ef83[_0xa34e('0x2e')][_0xa34e('0x47')];return getAgent(_0xa72124)[_0xa34e('0x22')](function(_0x311ecc){logger['info']('entityFound:',_0x311ecc[_0xa34e('0x1b')]);emit(util['format'](_0xa34e('0x33'),_0x311ecc[_0xa34e('0x1b')]),_0xa34e('0x48'),{'sessionId':_0x3ec4cb,'transferNumber':_0x577996});return _0x248635['status'](0xc8)[_0xa34e('0x2f')]({'error':![],'message':_0xa34e('0x49')});})[_0xa34e('0x36')](handleError(_0x248635));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 6345026..53cd02b 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 _0x60ce=['addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','index','get','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/users','getAgents','/:id/applications','create','post','/:id/canned_answers','addAnswer'];(function(_0x351bb4,_0x36b3af){var _0x58f5f2=function(_0x3aed7a){while(--_0x3aed7a){_0x351bb4['push'](_0x351bb4['shift']());}};_0x58f5f2(++_0x36b3af);}(_0x60ce,0xc6));var _0xe60c=function(_0x4bd796,_0x4796cc){_0x4bd796=_0x4bd796-0x0;var _0x4bc9fb=_0x60ce[_0x4bd796];return _0x4bc9fb;};'use strict';var multer=require(_0xe60c('0x0'));var util=require('util');var path=require(_0xe60c('0x1'));var timeout=require(_0xe60c('0x2'));var express=require(_0xe60c('0x3'));var router=express[_0xe60c('0x4')]();var fs_extra=require(_0xe60c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe60c('0x6'));var config=require(_0xe60c('0x7'));var controller=require(_0xe60c('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xe60c('0x9')]);router[_0xe60c('0xa')]('/describe',auth[_0xe60c('0xb')](),controller[_0xe60c('0xc')]);router[_0xe60c('0xa')](_0xe60c('0xd'),auth[_0xe60c('0xb')](),controller[_0xe60c('0xe')]);router[_0xe60c('0xa')](_0xe60c('0xf'),auth['isAuthenticated'](),controller[_0xe60c('0x10')]);router[_0xe60c('0xa')]('/:id/canned_answers',auth[_0xe60c('0xb')](),controller['getAnswers']);router['get'](_0xe60c('0x11'),auth['isAuthenticated'](),controller[_0xe60c('0x12')]);router['get'](_0xe60c('0x13'),auth[_0xe60c('0xb')](),controller['getApplications']);router['post']('/',auth[_0xe60c('0xb')](),controller[_0xe60c('0x14')]);router[_0xe60c('0x15')](_0xe60c('0xf'),auth[_0xe60c('0xb')](),controller['addDisposition']);router[_0xe60c('0x15')](_0xe60c('0x16'),auth[_0xe60c('0xb')](),controller[_0xe60c('0x17')]);router['post'](_0xe60c('0x11'),auth[_0xe60c('0xb')](),controller[_0xe60c('0x18')]);router[_0xe60c('0x15')](_0xe60c('0x13'),auth[_0xe60c('0xb')](),controller[_0xe60c('0x19')]);router[_0xe60c('0x15')](_0xe60c('0x1a'),controller[_0xe60c('0x1b')]);router[_0xe60c('0x15')](_0xe60c('0x1c'),auth[_0xe60c('0xb')](),controller[_0xe60c('0x1d')]);router[_0xe60c('0x1e')](_0xe60c('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xe60c('0x1f')](_0xe60c('0xd'),auth['isAuthenticated'](),controller[_0xe60c('0x20')]);router[_0xe60c('0x1f')](_0xe60c('0xf'),auth[_0xe60c('0xb')](),controller[_0xe60c('0x21')]);router[_0xe60c('0x1f')](_0xe60c('0x16'),auth[_0xe60c('0xb')](),controller[_0xe60c('0x22')]);router['delete'](_0xe60c('0x11'),auth[_0xe60c('0xb')](),controller[_0xe60c('0x23')]);module[_0xe60c('0x24')]=router; \ No newline at end of file +var _0xf6ba=['/:id/applications','getApplications','post','create','addAnswer','addAgents','notify','/:id/send','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users'];(function(_0x656c0e,_0x1bfe70){var _0x579406=function(_0x492213){while(--_0x492213){_0x656c0e['push'](_0x656c0e['shift']());}};_0x579406(++_0x1bfe70);}(_0xf6ba,0xae));var _0xaf6b=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xf6ba[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0xaf6b('0x0'));var util=require(_0xaf6b('0x1'));var path=require('path');var timeout=require(_0xaf6b('0x2'));var express=require(_0xaf6b('0x3'));var router=express['Router']();var fs_extra=require(_0xaf6b('0x4'));var auth=require(_0xaf6b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaf6b('0x6'));var controller=require(_0xaf6b('0x7'));router[_0xaf6b('0x8')]('/',auth[_0xaf6b('0x9')](),controller[_0xaf6b('0xa')]);router[_0xaf6b('0x8')]('/describe',auth[_0xaf6b('0x9')](),controller['describe']);router['get'](_0xaf6b('0xb'),auth[_0xaf6b('0x9')](),controller[_0xaf6b('0xc')]);router[_0xaf6b('0x8')](_0xaf6b('0xd'),auth['isAuthenticated'](),controller[_0xaf6b('0xe')]);router['get'](_0xaf6b('0xf'),auth[_0xaf6b('0x9')](),controller[_0xaf6b('0x10')]);router[_0xaf6b('0x8')](_0xaf6b('0x11'),auth[_0xaf6b('0x9')](),controller['getAgents']);router[_0xaf6b('0x8')](_0xaf6b('0x12'),auth[_0xaf6b('0x9')](),controller[_0xaf6b('0x13')]);router[_0xaf6b('0x14')]('/',auth['isAuthenticated'](),controller[_0xaf6b('0x15')]);router['post']('/:id/dispositions',auth[_0xaf6b('0x9')](),controller['addDisposition']);router[_0xaf6b('0x14')](_0xaf6b('0xf'),auth['isAuthenticated'](),controller[_0xaf6b('0x16')]);router[_0xaf6b('0x14')]('/:id/users',auth[_0xaf6b('0x9')](),controller[_0xaf6b('0x17')]);router[_0xaf6b('0x14')](_0xaf6b('0x12'),auth[_0xaf6b('0x9')](),controller['addApplications']);router[_0xaf6b('0x14')]('/:id/notify',controller[_0xaf6b('0x18')]);router['post'](_0xaf6b('0x19'),auth[_0xaf6b('0x9')](),controller['send']);router['put'](_0xaf6b('0xb'),auth['isAuthenticated'](),controller[_0xaf6b('0x1a')]);router[_0xaf6b('0x1b')](_0xaf6b('0xb'),auth[_0xaf6b('0x9')](),controller['destroy']);router[_0xaf6b('0x1b')](_0xaf6b('0xd'),auth[_0xaf6b('0x9')](),controller[_0xaf6b('0x1c')]);router['delete'](_0xaf6b('0xf'),auth[_0xaf6b('0x9')](),controller[_0xaf6b('0x1d')]);router[_0xaf6b('0x1b')](_0xaf6b('0x11'),auth[_0xaf6b('0x9')](),controller[_0xaf6b('0x1e')]);module[_0xaf6b('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 2843c07..b11b52d 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 _0x81ad=['mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue'];(function(_0x2c0be1,_0x1e88f2){var _0x3d4bd2=function(_0x2b5497){while(--_0x2b5497){_0x2c0be1['push'](_0x2c0be1['shift']());}};_0x3d4bd2(++_0x1e88f2);}(_0x81ad,0xce));var _0xd81a=function(_0x44268d,_0xad8443){_0x44268d=_0x44268d-0x0;var _0x4be92d=_0x81ad[_0x44268d];return _0x4be92d;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xd81a('0x0'));module[_0xd81a('0x1')]={'name':{'type':Sequelize[_0xd81a('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xd81a('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xd81a('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xd81a('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xd81a('0x2')]},'type':{'type':Sequelize[_0xd81a('0x3')]('twilio')},'accountSid':{'type':Sequelize[_0xd81a('0x2')]},'authToken':{'type':Sequelize[_0xd81a('0x2')]},'notificationTemplate':{'type':Sequelize[_0xd81a('0x4')],'defaultValue':function(){return _0xd81a('0x5');}},'notificationSound':{'type':Sequelize[_0xd81a('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xd81a('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd81a('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd81a('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd81a('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd81a('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd81a('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd81a('0x7')],'comment':_0xd81a('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xd81a('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x150231){if(!_0x150231){this[_0xd81a('0x9')](_0xd81a('0xa'),null);}this[_0xd81a('0x9')](_0xd81a('0xb'),_0x150231);}},'description':{'type':Sequelize[_0xd81a('0x2')]}}; \ No newline at end of file +var _0x2255=['sequelize','randomstring','exports','STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x345154,_0x5cc6e4){var _0x28656b=function(_0x41d538){while(--_0x41d538){_0x345154['push'](_0x345154['shift']());}};_0x28656b(++_0x5cc6e4);}(_0x2255,0x1ec));var _0x5225=function(_0x5c016e,_0x259842){_0x5c016e=_0x5c016e-0x0;var _0x988385=_0x2255[_0x5c016e];return _0x988385;};'use strict';var Sequelize=require(_0x5225('0x0'));var rs=require(_0x5225('0x1'));module[_0x5225('0x2')]={'name':{'type':Sequelize[_0x5225('0x3')],'unique':_0x5225('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x5225('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x5225('0x3')],'defaultValue':function(){return rs[_0x5225('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM']('twilio')},'accountSid':{'type':Sequelize[_0x5225('0x3')]},'authToken':{'type':Sequelize[_0x5225('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x5225('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5225('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5225('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x5225('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x5225('0x7')],'defaultValue':![],'comment':_0x5225('0x9'),'set':function(_0x22ac64){if(!_0x22ac64){this[_0x5225('0xa')](_0x5225('0xb'),null);}this[_0x5225('0xa')]('mandatoryDisposition',_0x22ac64);}},'description':{'type':Sequelize[_0x5225('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index aae82cf..c03f6e6 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 _0x3cb2=['rawAttributes','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','keys','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addDisposition','WhatsappAccountId','Disposition','findOne','include','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','transaction','WhatsappApplication','priority','getApplications','hasOwnProperty','whatsapp','account','applications','orderBy','Applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','mobile','type','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','ListId','Contacts','DESC','list','defaults','WhatsappInteraction','spread','interaction','get','created','autoclose','push','unmanaged','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','Content-Type','text/xml','\x0a','List','out','Messages','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','status','end','json','count','offset','limit','set','Content-Range','reject','save','destroy','WhatsappAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x3cb2,0x77));var _0x23cb=function(_0x5d1d99,_0x10ca23){_0x5d1d99=_0x5d1d99-0x0;var _0x2957ec=_0x3cb2[_0x5d1d99];return _0x2957ec;};'use strict';var pdf=require(_0x23cb('0x0'));var emlformat=require(_0x23cb('0x1'));var rimraf=require(_0x23cb('0x2'));var zipdir=require(_0x23cb('0x3'));var jsonpatch=require(_0x23cb('0x4'));var rp=require(_0x23cb('0x5'));var moment=require('moment');var BPromise=require(_0x23cb('0x6'));var Mustache=require('mustache');var util=require(_0x23cb('0x7'));var path=require(_0x23cb('0x8'));var sox=require(_0x23cb('0x9'));var csv=require(_0x23cb('0xa'));var ejs=require(_0x23cb('0xb'));var fs=require('fs');var fs_extra=require(_0x23cb('0xc'));var _=require(_0x23cb('0xd'));var squel=require(_0x23cb('0xe'));var crypto=require(_0x23cb('0xf'));var jsforce=require(_0x23cb('0x10'));var deskjs=require(_0x23cb('0x11'));var toCsv=require(_0x23cb('0xa'));var querystring=require('querystring');var Papa=require(_0x23cb('0x12'));var Redis=require(_0x23cb('0x13'));var authService=require(_0x23cb('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x23cb('0x15'));var hardwareService=require(_0x23cb('0x16'));var logger=require('../../config/logger')(_0x23cb('0x17'));var utils=require(_0x23cb('0x18'));var config=require(_0x23cb('0x19'));var licenseUtil=require(_0x23cb('0x1a'));var db=require(_0x23cb('0x1b'))['db'];config['redis']=_['defaults'](config[_0x23cb('0x1c')],{'host':_0x23cb('0x1d'),'port':0x18eb});var socket=require(_0x23cb('0x1e'))(new Redis(config['redis']));require(_0x23cb('0x1f'))[_0x23cb('0x20')](socket);var jayson=require(_0x23cb('0x21'));var client=jayson[_0x23cb('0x22')][_0x23cb('0x23')]({'port':0x232c});function respondWithRpcPromise(_0xdba5a0,_0x38a638,_0x37709e,_0x38b2fc){return new BPromise(function(_0x273cb5,_0x5addd2){var _0x21dbeb=_0x38b2fc||client;return _0x21dbeb[_0x23cb('0x24')](_0xdba5a0,_0x37709e)[_0x23cb('0x25')](function(_0x1ae053){logger[_0x23cb('0x26')](_0x23cb('0x27'),_0x38a638,_0x23cb('0x28'));logger[_0x23cb('0x29')](_0x23cb('0x2a'),_0x38a638,_0x23cb('0x28'),JSON['stringify'](_0x1ae053));if(_0x1ae053['error']){if(_0x1ae053[_0x23cb('0x2b')]['code']===0x1f4){logger['error'](_0x23cb('0x27'),_0x38a638,_0x1ae053[_0x23cb('0x2b')][_0x23cb('0x2c')]);return _0x5addd2(_0x1ae053['error'][_0x23cb('0x2c')]);}logger[_0x23cb('0x2b')](_0x23cb('0x27'),_0x38a638,_0x1ae053['error'][_0x23cb('0x2c')]);return _0x273cb5(_0x1ae053[_0x23cb('0x2b')][_0x23cb('0x2c')]);}else{logger[_0x23cb('0x26')](_0x23cb('0x27'),_0x38a638,'request\x20sent');_0x273cb5(_0x1ae053['result'][_0x23cb('0x2c')]);}})['catch'](function(_0xff2028){logger[_0x23cb('0x2b')](_0x23cb('0x27'),_0x38a638,_0xff2028);_0x5addd2(_0xff2028);});});}function respondWithStatusCode(_0x3b44d0,_0x353d73){_0x353d73=_0x353d73||0xcc;return function(_0x54d28d){if(_0x54d28d){return _0x3b44d0['sendStatus'](_0x353d73);}return _0x3b44d0[_0x23cb('0x2d')](_0x353d73)[_0x23cb('0x2e')]();};}function respondWithResult(_0x19b6f1,_0x415cfe){_0x415cfe=_0x415cfe||0xc8;return function(_0x130360){if(_0x130360){return _0x19b6f1[_0x23cb('0x2d')](_0x415cfe)[_0x23cb('0x2f')](_0x130360);}};}function respondWithFilteredResult(_0x5c3cdf,_0x1bb795){return function(_0x375216){if(_0x375216){var _0x2ba70b=_0x375216[_0x23cb('0x30')],_0x2539c7=_0x1bb795[_0x23cb('0x31')],_0x12b7c5=_0x1bb795[_0x23cb('0x31')]+_0x1bb795[_0x23cb('0x32')],_0x147d17;if(_0x12b7c5>=_0x2ba70b){_0x12b7c5=_0x2ba70b;_0x147d17=0xc8;}else{_0x147d17=0xce;}_0x5c3cdf[_0x23cb('0x2d')](_0x147d17);return _0x5c3cdf[_0x23cb('0x33')](_0x23cb('0x34'),_0x2539c7+'-'+_0x12b7c5+'/'+_0x2ba70b)[_0x23cb('0x2f')](_0x375216);}return null;};}function patchUpdates(_0x540db6){return function(_0x1d3fd9){try{jsonpatch['apply'](_0x1d3fd9,_0x540db6,!![]);}catch(_0x964a70){return BPromise[_0x23cb('0x35')](_0x964a70);}return _0x1d3fd9[_0x23cb('0x36')]();};}function saveUpdates(_0x51c334,_0x4011ac){return function(_0x1730dc){if(_0x1730dc){return _0x1730dc['update'](_0x51c334)[_0x23cb('0x25')](function(_0x544603){return _0x544603;});}return null;};}function removeEntity(_0x2796b2,_0x14e38b){return function(_0x191671){if(_0x191671){return _0x191671[_0x23cb('0x37')]()['then'](function(){var _0x3ec5a4=_0x191671['get']({'plain':!![]});var _0x5c494f=_0x23cb('0x38');return db[_0x23cb('0x39')][_0x23cb('0x37')]({'where':{'type':_0x5c494f,'resourceId':_0x3ec5a4['id']}})[_0x23cb('0x25')](function(){return _0x191671;});})['then'](function(){_0x2796b2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xf9f05b,_0x4c3ea6){return function(_0xec4982){if(!_0xec4982){_0xf9f05b[_0x23cb('0x3a')](0x194);}return _0xec4982;};}function handleError(_0xda668b,_0x2055d4){_0x2055d4=_0x2055d4||0x1f4;return function(_0x22a844){logger['error'](_0x22a844[_0x23cb('0x3b')]);if(_0x22a844[_0x23cb('0x3c')]){delete _0x22a844['name'];}_0xda668b[_0x23cb('0x2d')](_0x2055d4)[_0x23cb('0x3d')](_0x22a844);};}exports[_0x23cb('0x3e')]=function(_0x24f622,_0x280532){var _0x4945d2={'include':[{'model':db[_0x23cb('0x3f')],'as':_0x23cb('0x40')}]},_0x7af08b={},_0x29f5cd={'count':0x0,'rows':[]};var _0x13c5b1=_['map'](db[_0x23cb('0x41')][_0x23cb('0x42')],function(_0x350165){return{'name':_0x350165['fieldName'],'type':_0x350165['type'][_0x23cb('0x43')]};});_0x7af08b[_0x23cb('0x44')]=_[_0x23cb('0x45')](_0x13c5b1,_0x23cb('0x3c'));_0x7af08b[_0x23cb('0x46')]=_['keys'](_0x24f622[_0x23cb('0x46')]);_0x7af08b[_0x23cb('0x47')]=_[_0x23cb('0x48')](_0x7af08b[_0x23cb('0x44')],_0x7af08b[_0x23cb('0x46')]);_0x4945d2[_0x23cb('0x49')]=_[_0x23cb('0x48')](_0x7af08b['model'],qs[_0x23cb('0x4a')](_0x24f622[_0x23cb('0x46')][_0x23cb('0x4a')]));_0x4945d2[_0x23cb('0x49')]=_0x4945d2['attributes'][_0x23cb('0x4b')]?_0x4945d2[_0x23cb('0x49')]:_0x7af08b[_0x23cb('0x44')];if(!_0x24f622['query']['hasOwnProperty'](_0x23cb('0x4c'))){_0x4945d2['limit']=qs['limit'](_0x24f622['query'][_0x23cb('0x32')]);_0x4945d2[_0x23cb('0x31')]=qs[_0x23cb('0x31')](_0x24f622[_0x23cb('0x46')][_0x23cb('0x31')]);}_0x4945d2[_0x23cb('0x4d')]=qs['sort'](_0x24f622[_0x23cb('0x46')][_0x23cb('0x4e')]);_0x4945d2[_0x23cb('0x4f')]=qs[_0x23cb('0x47')](_[_0x23cb('0x50')](_0x24f622[_0x23cb('0x46')],_0x7af08b['filters']),_0x13c5b1);if(_0x24f622['query'][_0x23cb('0x51')]){_0x4945d2[_0x23cb('0x4f')]=_[_0x23cb('0x52')](_0x4945d2[_0x23cb('0x4f')],{'$or':_['map'](_0x13c5b1,function(_0x33c024){if(_0x33c024['type']!=='VIRTUAL'){var _0x5ef90e={};_0x5ef90e[_0x33c024[_0x23cb('0x3c')]]={'$like':'%'+_0x24f622[_0x23cb('0x46')]['filter']+'%'};return _0x5ef90e;}})});}_0x4945d2=_[_0x23cb('0x52')]({},_0x4945d2,_0x24f622[_0x23cb('0x53')]);var _0x37618d={'where':_0x4945d2['where']};return db[_0x23cb('0x41')][_0x23cb('0x30')](_0x37618d)[_0x23cb('0x25')](function(_0x3bb7da){_0x29f5cd[_0x23cb('0x30')]=_0x3bb7da;if(_0x24f622['query'][_0x23cb('0x54')]){_0x4945d2['include']=[{'all':!![]}];}return db[_0x23cb('0x41')][_0x23cb('0x55')](_0x4945d2);})[_0x23cb('0x25')](function(_0x595c8a){_0x29f5cd[_0x23cb('0x56')]=_0x595c8a;return _0x29f5cd;})[_0x23cb('0x25')](respondWithFilteredResult(_0x280532,_0x4945d2))[_0x23cb('0x57')](handleError(_0x280532,null));};exports['show']=function(_0x18fcc8,_0x10c1a2){var _0x37bf46={'raw':![],'where':{'id':_0x18fcc8[_0x23cb('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x23cb('0x40')}]},_0x23573e={};_0x23573e['model']=_[_0x23cb('0x59')](db[_0x23cb('0x41')][_0x23cb('0x42')]);_0x23573e[_0x23cb('0x46')]=_[_0x23cb('0x59')](_0x18fcc8['query']);_0x23573e[_0x23cb('0x47')]=_[_0x23cb('0x48')](_0x23573e[_0x23cb('0x44')],_0x23573e['query']);_0x37bf46[_0x23cb('0x49')]=_[_0x23cb('0x48')](_0x23573e[_0x23cb('0x44')],qs[_0x23cb('0x4a')](_0x18fcc8['query'][_0x23cb('0x4a')]));_0x37bf46['attributes']=_0x37bf46[_0x23cb('0x49')][_0x23cb('0x4b')]?_0x37bf46[_0x23cb('0x49')]:_0x23573e[_0x23cb('0x44')];if(_0x18fcc8[_0x23cb('0x46')][_0x23cb('0x54')]){_0x37bf46['include']=[{'all':!![]}];}_0x37bf46=_['merge']({},_0x37bf46,_0x18fcc8[_0x23cb('0x53')]);return db[_0x23cb('0x41')]['find'](_0x37bf46)['then'](handleEntityNotFound(_0x10c1a2,null))[_0x23cb('0x25')](respondWithResult(_0x10c1a2,null))['catch'](handleError(_0x10c1a2,null));};exports['create']=function(_0x4894b7,_0x2da546){return db[_0x23cb('0x41')][_0x23cb('0x5a')](_0x4894b7['body'],{})['then'](function(_0x1c1917){var _0x46da8d=_0x4894b7[_0x23cb('0x5b')]['get']({'plain':!![]});if(!_0x46da8d)throw new Error(_0x23cb('0x5c'));if(_0x46da8d['role']==='user'){var _0x21588d=_0x1c1917['get']({'plain':!![]});var _0x6ee3d0=_0x23cb('0x38');return db[_0x23cb('0x5d')][_0x23cb('0x5e')]({'where':{'name':_0x6ee3d0,'userProfileId':_0x46da8d[_0x23cb('0x5f')]},'raw':!![]})[_0x23cb('0x25')](function(_0xf7f46f){if(_0xf7f46f&&_0xf7f46f[_0x23cb('0x60')]===0x0){return db[_0x23cb('0x39')]['create']({'name':_0x21588d['name'],'resourceId':_0x21588d['id'],'type':_0xf7f46f[_0x23cb('0x3c')],'sectionId':_0xf7f46f['id']},{})[_0x23cb('0x25')](function(){return _0x1c1917;});}else{return _0x1c1917;}})[_0x23cb('0x57')](function(_0xb7dd6d){logger[_0x23cb('0x2b')](_0x23cb('0x61'),_0xb7dd6d);throw _0xb7dd6d;});}return _0x1c1917;})[_0x23cb('0x25')](respondWithResult(_0x2da546,0xc9))[_0x23cb('0x57')](handleError(_0x2da546,null));};exports[_0x23cb('0x62')]=function(_0x19a482,_0x27cb0c){if(_0x19a482[_0x23cb('0x63')]['id']){delete _0x19a482[_0x23cb('0x63')]['id'];}return db[_0x23cb('0x41')][_0x23cb('0x5e')]({'where':{'id':_0x19a482[_0x23cb('0x58')]['id']},'include':[{'model':db[_0x23cb('0x3f')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x27cb0c,null))[_0x23cb('0x25')](saveUpdates(_0x19a482['body'],null))['then'](respondWithResult(_0x27cb0c,null))['catch'](handleError(_0x27cb0c,null));};exports[_0x23cb('0x37')]=function(_0x4e6c5a,_0x53b395){return db[_0x23cb('0x41')][_0x23cb('0x5e')]({'where':{'id':_0x4e6c5a[_0x23cb('0x58')]['id']}})[_0x23cb('0x25')](handleEntityNotFound(_0x53b395,null))[_0x23cb('0x25')](removeEntity(_0x53b395,null))['catch'](handleError(_0x53b395,null));};exports['describe']=function(_0x423620,_0x19267b){return db[_0x23cb('0x41')]['describe']()[_0x23cb('0x25')](respondWithResult(_0x19267b,null))[_0x23cb('0x57')](handleError(_0x19267b,null));};exports[_0x23cb('0x64')]=function(_0x4aea94,_0x33dcf2,_0x3e434e){if(_0x4aea94[_0x23cb('0x63')]['id']){delete _0x4aea94[_0x23cb('0x63')]['id'];}return db[_0x23cb('0x41')][_0x23cb('0x5e')]({'where':{'id':_0x4aea94[_0x23cb('0x58')]['id']}})['then'](handleEntityNotFound(_0x33dcf2,null))[_0x23cb('0x25')](function(_0x3f2f50){if(_0x3f2f50){_0x4aea94[_0x23cb('0x63')][_0x23cb('0x65')]=_0x3f2f50['id'];return db[_0x23cb('0x66')][_0x23cb('0x5a')](_0x4aea94[_0x23cb('0x63')]);}})[_0x23cb('0x25')](respondWithResult(_0x33dcf2,null))['catch'](handleError(_0x33dcf2,null));};exports['getDispositions']=function(_0x3137dc,_0x46aa6b,_0x3b83e1){var _0x390e9f={'raw':![],'where':{}};var _0x3856e3={};var _0x4206c7={'count':0x0,'rows':[]};return db[_0x23cb('0x41')][_0x23cb('0x67')]({'where':{'id':_0x3137dc['params']['id']}})[_0x23cb('0x25')](handleEntityNotFound(_0x46aa6b,null))[_0x23cb('0x25')](function(_0x3a6475){if(_0x3a6475){_0x3856e3['model']=_[_0x23cb('0x59')](db[_0x23cb('0x66')][_0x23cb('0x42')]);_0x3856e3['query']=_[_0x23cb('0x59')](_0x3137dc[_0x23cb('0x46')]);_0x3856e3['filters']=_['intersection'](_0x3856e3[_0x23cb('0x44')],_0x3856e3[_0x23cb('0x46')]);_0x390e9f['attributes']=_[_0x23cb('0x48')](_0x3856e3[_0x23cb('0x44')],qs[_0x23cb('0x4a')](_0x3137dc[_0x23cb('0x46')][_0x23cb('0x4a')]));_0x390e9f[_0x23cb('0x49')]=_0x390e9f[_0x23cb('0x49')][_0x23cb('0x4b')]?_0x390e9f[_0x23cb('0x49')]:_0x3856e3[_0x23cb('0x44')];if(!_0x3137dc[_0x23cb('0x46')]['hasOwnProperty'](_0x23cb('0x4c'))){_0x390e9f['limit']=qs['limit'](_0x3137dc[_0x23cb('0x46')][_0x23cb('0x32')]);_0x390e9f[_0x23cb('0x31')]=qs[_0x23cb('0x31')](_0x3137dc[_0x23cb('0x46')][_0x23cb('0x31')]);}_0x390e9f[_0x23cb('0x4d')]=qs[_0x23cb('0x4e')](_0x3137dc[_0x23cb('0x46')][_0x23cb('0x4e')]);_0x390e9f[_0x23cb('0x4f')]=qs['filters'](_['pick'](_0x3137dc[_0x23cb('0x46')],_0x3856e3[_0x23cb('0x47')]));_0x390e9f[_0x23cb('0x4f')][_0x23cb('0x65')]=_0x3a6475['id'];if(_0x3137dc['query'][_0x23cb('0x51')]){_0x390e9f[_0x23cb('0x4f')]=_[_0x23cb('0x52')](_0x390e9f['where'],{'$or':_[_0x23cb('0x45')](_0x390e9f[_0x23cb('0x49')],function(_0x463010){var _0x858820={};_0x858820[_0x463010]={'$like':'%'+_0x3137dc['query'][_0x23cb('0x51')]+'%'};return _0x858820;})});}_0x390e9f=_['merge']({},_0x390e9f,_0x3137dc['options']);return db[_0x23cb('0x66')][_0x23cb('0x30')]({'where':_0x390e9f[_0x23cb('0x4f')]})['then'](function(_0x116690){_0x4206c7[_0x23cb('0x30')]=_0x116690;if(_0x3137dc['query'][_0x23cb('0x54')]){_0x390e9f[_0x23cb('0x68')]=[{'all':!![]}];}return db[_0x23cb('0x66')]['findAll'](_0x390e9f);})[_0x23cb('0x25')](function(_0x50c76e){_0x4206c7['rows']=_0x50c76e;return _0x4206c7;});}})['then'](respondWithFilteredResult(_0x46aa6b,_0x390e9f))[_0x23cb('0x57')](handleError(_0x46aa6b,null));};exports[_0x23cb('0x69')]=function(_0x14e863,_0x254515,_0x3037bf){return db[_0x23cb('0x41')][_0x23cb('0x5e')]({'where':{'id':_0x14e863[_0x23cb('0x58')]['id']}})[_0x23cb('0x25')](handleEntityNotFound(_0x254515,null))['then'](function(_0x151694){if(_0x151694){return _0x151694[_0x23cb('0x69')](_0x14e863[_0x23cb('0x46')][_0x23cb('0x6a')]);}})[_0x23cb('0x25')](respondWithStatusCode(_0x254515,null))[_0x23cb('0x57')](handleError(_0x254515,null));};exports[_0x23cb('0x6b')]=function(_0x8abad1,_0xbd9842,_0x1d939f){if(_0x8abad1[_0x23cb('0x63')]['id']){delete _0x8abad1[_0x23cb('0x63')]['id'];}return db[_0x23cb('0x41')][_0x23cb('0x5e')]({'where':{'id':_0x8abad1['params']['id']}})['then'](handleEntityNotFound(_0xbd9842,null))['then'](function(_0x12b723){if(_0x12b723){_0x8abad1[_0x23cb('0x63')][_0x23cb('0x65')]=_0x12b723['id'];return db[_0x23cb('0x6c')][_0x23cb('0x5a')](_0x8abad1[_0x23cb('0x63')]);}})[_0x23cb('0x25')](respondWithResult(_0xbd9842,null))[_0x23cb('0x57')](handleError(_0xbd9842,null));};exports['getAnswers']=function(_0xdd6bdc,_0x2433dd,_0x46564c){var _0x24294c={'raw':![],'where':{}};var _0x1c0c2d={};var _0x149f47={'count':0x0,'rows':[]};return db[_0x23cb('0x41')]['findOne']({'where':{'id':_0xdd6bdc[_0x23cb('0x58')]['id']}})[_0x23cb('0x25')](handleEntityNotFound(_0x2433dd,null))[_0x23cb('0x25')](function(_0x1ce63d){if(_0x1ce63d){_0x1c0c2d['model']=_[_0x23cb('0x59')](db[_0x23cb('0x6c')][_0x23cb('0x42')]);_0x1c0c2d[_0x23cb('0x46')]=_[_0x23cb('0x59')](_0xdd6bdc[_0x23cb('0x46')]);_0x1c0c2d['filters']=_['intersection'](_0x1c0c2d[_0x23cb('0x44')],_0x1c0c2d['query']);_0x24294c['attributes']=_[_0x23cb('0x48')](_0x1c0c2d[_0x23cb('0x44')],qs[_0x23cb('0x4a')](_0xdd6bdc[_0x23cb('0x46')]['fields']));_0x24294c[_0x23cb('0x49')]=_0x24294c[_0x23cb('0x49')][_0x23cb('0x4b')]?_0x24294c[_0x23cb('0x49')]:_0x1c0c2d[_0x23cb('0x44')];if(!_0xdd6bdc[_0x23cb('0x46')]['hasOwnProperty'](_0x23cb('0x4c'))){_0x24294c[_0x23cb('0x32')]=qs['limit'](_0xdd6bdc[_0x23cb('0x46')]['limit']);_0x24294c[_0x23cb('0x31')]=qs[_0x23cb('0x31')](_0xdd6bdc[_0x23cb('0x46')][_0x23cb('0x31')]);}_0x24294c[_0x23cb('0x4d')]=qs[_0x23cb('0x4e')](_0xdd6bdc[_0x23cb('0x46')][_0x23cb('0x4e')]);_0x24294c[_0x23cb('0x4f')]=qs['filters'](_['pick'](_0xdd6bdc[_0x23cb('0x46')],_0x1c0c2d[_0x23cb('0x47')]));_0x24294c[_0x23cb('0x4f')][_0x23cb('0x65')]=_0x1ce63d['id'];if(_0xdd6bdc[_0x23cb('0x46')][_0x23cb('0x51')]){_0x24294c[_0x23cb('0x4f')]=_['merge'](_0x24294c[_0x23cb('0x4f')],{'$or':_['map'](_0x24294c[_0x23cb('0x49')],function(_0x13321d){var _0x49b0cd={};_0x49b0cd[_0x13321d]={'$like':'%'+_0xdd6bdc[_0x23cb('0x46')][_0x23cb('0x51')]+'%'};return _0x49b0cd;})});}_0x24294c=_[_0x23cb('0x52')]({},_0x24294c,_0xdd6bdc[_0x23cb('0x53')]);return db[_0x23cb('0x6c')][_0x23cb('0x30')]({'where':_0x24294c[_0x23cb('0x4f')]})[_0x23cb('0x25')](function(_0x1cf16f){_0x149f47[_0x23cb('0x30')]=_0x1cf16f;if(_0xdd6bdc[_0x23cb('0x46')][_0x23cb('0x54')]){_0x24294c[_0x23cb('0x68')]=[{'all':!![]}];}return db[_0x23cb('0x6c')][_0x23cb('0x55')](_0x24294c);})['then'](function(_0x5c62bb){_0x149f47[_0x23cb('0x56')]=_0x5c62bb;return _0x149f47;});}})[_0x23cb('0x25')](respondWithFilteredResult(_0x2433dd,_0x24294c))[_0x23cb('0x57')](handleError(_0x2433dd,null));};exports[_0x23cb('0x6d')]=function(_0x3c81c7,_0x54a3a2,_0x57df12){return db['WhatsappAccount'][_0x23cb('0x5e')]({'where':{'id':_0x3c81c7['params']['id']}})[_0x23cb('0x25')](handleEntityNotFound(_0x54a3a2,null))[_0x23cb('0x25')](function(_0x1ea61b){if(_0x1ea61b){return _0x1ea61b[_0x23cb('0x6d')](_0x3c81c7[_0x23cb('0x46')][_0x23cb('0x6a')]);}})[_0x23cb('0x25')](respondWithStatusCode(_0x54a3a2,null))[_0x23cb('0x57')](handleError(_0x54a3a2,null));};exports[_0x23cb('0x6e')]=function(_0x199d6d,_0x90220d,_0x32760e){return db[_0x23cb('0x41')][_0x23cb('0x5e')]({'where':{'id':_0x199d6d[_0x23cb('0x58')]['id']}})['then'](handleEntityNotFound(_0x90220d,null))[_0x23cb('0x25')](function(_0x3c5b8a){if(_0x3c5b8a){return _0x3c5b8a[_0x23cb('0x6e')](_0x199d6d[_0x23cb('0x63')]['ids'],_[_0x23cb('0x6f')](_0x199d6d[_0x23cb('0x63')],[_0x23cb('0x6a'),'id'])||{})['spread'](function(_0x2105e2){for(var _0x41144d=0x0;_0x41144d<_0x199d6d[_0x23cb('0x63')]['ids'][_0x23cb('0x4b')];_0x41144d+=0x1){socket[_0x23cb('0x70')](_0x23cb('0x71'),{'UserId':_0x199d6d['body'][_0x23cb('0x6a')][_0x41144d],'WhatsappAccountId':_0x199d6d['params']['id']});}return _0x2105e2;});}})['then'](respondWithResult(_0x90220d,null))[_0x23cb('0x57')](handleError(_0x90220d,null));};exports[_0x23cb('0x72')]=function(_0x2cbe4f,_0x469599,_0x50b009){return db[_0x23cb('0x41')]['find']({'where':{'id':_0x2cbe4f['params']['id']}})[_0x23cb('0x25')](handleEntityNotFound(_0x469599,null))[_0x23cb('0x25')](function(_0x559f50){if(_0x559f50){return _0x559f50[_0x23cb('0x72')](_0x2cbe4f[_0x23cb('0x46')][_0x23cb('0x6a')])['then'](function(){if(_[_0x23cb('0x73')](_0x2cbe4f['query'][_0x23cb('0x6a')])){for(var _0x47cea8=0x0;_0x47cea8<_0x2cbe4f['query'][_0x23cb('0x6a')][_0x23cb('0x4b')];_0x47cea8+=0x1){socket[_0x23cb('0x70')](_0x23cb('0x74'),{'UserId':Number(_0x2cbe4f['query'][_0x23cb('0x6a')][_0x47cea8]),'WhatsappAccountId':Number(_0x2cbe4f['params']['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x2cbe4f[_0x23cb('0x46')][_0x23cb('0x6a')]),'WhatsappAccountId':Number(_0x2cbe4f[_0x23cb('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x469599,null))[_0x23cb('0x57')](handleError(_0x469599,null));};exports['getAgents']=function(_0x42be49,_0x2dc018,_0x23ed62){var _0xaea996={};var _0x3b8829={};var _0x2930db;var _0x119c84;return db[_0x23cb('0x41')]['findOne']({'where':{'id':_0x42be49[_0x23cb('0x58')]['id']}})[_0x23cb('0x25')](handleEntityNotFound(_0x2dc018,null))['then'](function(_0x1bd121){if(_0x1bd121){_0x2930db=_0x1bd121;_0x3b8829[_0x23cb('0x44')]=_['keys'](db[_0x23cb('0x75')][_0x23cb('0x42')]);_0x3b8829[_0x23cb('0x46')]=_[_0x23cb('0x59')](_0x42be49[_0x23cb('0x46')]);_0x3b8829[_0x23cb('0x47')]=_[_0x23cb('0x48')](_0x3b8829[_0x23cb('0x44')],_0x3b8829[_0x23cb('0x46')]);_0xaea996[_0x23cb('0x49')]=_[_0x23cb('0x48')](_0x3b8829[_0x23cb('0x44')],qs[_0x23cb('0x4a')](_0x42be49[_0x23cb('0x46')]['fields']));_0xaea996[_0x23cb('0x49')]=_0xaea996['attributes']['length']?_0xaea996[_0x23cb('0x49')]:_0x3b8829['model'];_0xaea996[_0x23cb('0x4d')]=qs[_0x23cb('0x4e')](_0x42be49[_0x23cb('0x46')][_0x23cb('0x4e')]);_0xaea996[_0x23cb('0x4f')]=qs[_0x23cb('0x47')](_[_0x23cb('0x50')](_0x42be49['query'],_0x3b8829[_0x23cb('0x47')]));if(_0x42be49[_0x23cb('0x46')][_0x23cb('0x51')]){_0xaea996['where']=_[_0x23cb('0x52')](_0xaea996[_0x23cb('0x4f')],{'$or':_['map'](_0xaea996['attributes'],function(_0xfc226){var _0x26ed99={};_0x26ed99[_0xfc226]={'$like':'%'+_0x42be49[_0x23cb('0x46')][_0x23cb('0x51')]+'%'};return _0x26ed99;})});}_0xaea996=_[_0x23cb('0x52')]({},_0xaea996,_0x42be49[_0x23cb('0x53')]);return _0x2930db[_0x23cb('0x76')](_0xaea996);}})[_0x23cb('0x25')](function(_0x1c2707){if(_0x1c2707){_0x119c84=_0x1c2707[_0x23cb('0x4b')];if(!_0x42be49[_0x23cb('0x46')]['hasOwnProperty'](_0x23cb('0x4c'))){_0xaea996[_0x23cb('0x32')]=qs[_0x23cb('0x32')](_0x42be49[_0x23cb('0x46')]['limit']);_0xaea996[_0x23cb('0x31')]=qs[_0x23cb('0x31')](_0x42be49[_0x23cb('0x46')]['offset']);}return _0x2930db['getAgents'](_0xaea996);}})[_0x23cb('0x25')](function(_0x415d76){if(_0x415d76){return _0x415d76?{'count':_0x119c84,'rows':_0x415d76}:null;}})['then'](respondWithResult(_0x2dc018,null))['catch'](handleError(_0x2dc018,null));};exports[_0x23cb('0x77')]=function(_0x38c55c,_0x2cf239,_0x46e54c){return db[_0x23cb('0x41')]['findOne']({'where':{'id':_0x38c55c[_0x23cb('0x58')]['id']}})['then'](handleEntityNotFound(_0x2cf239,null))[_0x23cb('0x25')](function(_0x358e1b){if(_0x358e1b){return db[_0x23cb('0x78')][_0x23cb('0x79')](function(_0x1d690a){return db[_0x23cb('0x7a')][_0x23cb('0x37')]({'where':{'WhatsappAccountId':_0x38c55c['params']['id']},'transaction':_0x1d690a})[_0x23cb('0x25')](function(_0x3c9a43){var _0x297597=_[_0x23cb('0x45')](_0x38c55c[_0x23cb('0x63')],function(_0x4480f0){_0x4480f0['WhatsappAccountId']=_0x38c55c['params']['id'];return _0x4480f0;});return db[_0x23cb('0x7a')]['bulkCreate'](_0x297597,{'transaction':_0x1d690a});});})[_0x23cb('0x25')](function(){return db[_0x23cb('0x7a')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x38c55c[_0x23cb('0x58')]['id']},'order':_0x23cb('0x7b')});});}})['then'](respondWithResult(_0x2cf239,null))[_0x23cb('0x57')](handleError(_0x2cf239,null));};exports['getApplications']=function(_0x66adb3,_0x12e53f,_0xa7ed1c){var _0x32bfc8={};var _0x3bb169={};var _0x52e3e5;var _0x1f2344;return db['WhatsappAccount'][_0x23cb('0x67')]({'where':{'id':_0x66adb3[_0x23cb('0x58')]['id']}})[_0x23cb('0x25')](handleEntityNotFound(_0x12e53f,null))['then'](function(_0xf65f07){if(_0xf65f07){_0x52e3e5=_0xf65f07;_0x3bb169[_0x23cb('0x44')]=_[_0x23cb('0x59')](db['WhatsappApplication']['rawAttributes']);_0x3bb169[_0x23cb('0x46')]=_[_0x23cb('0x59')](_0x66adb3['query']);_0x3bb169[_0x23cb('0x47')]=_[_0x23cb('0x48')](_0x3bb169[_0x23cb('0x44')],_0x3bb169[_0x23cb('0x46')]);_0x32bfc8[_0x23cb('0x49')]=_[_0x23cb('0x48')](_0x3bb169[_0x23cb('0x44')],qs[_0x23cb('0x4a')](_0x66adb3[_0x23cb('0x46')][_0x23cb('0x4a')]));_0x32bfc8[_0x23cb('0x49')]=_0x32bfc8[_0x23cb('0x49')][_0x23cb('0x4b')]?_0x32bfc8[_0x23cb('0x49')]:_0x3bb169['model'];_0x32bfc8[_0x23cb('0x4d')]=qs['sort'](_0x66adb3[_0x23cb('0x46')][_0x23cb('0x4e')]);_0x32bfc8[_0x23cb('0x4f')]=qs[_0x23cb('0x47')](_[_0x23cb('0x50')](_0x66adb3[_0x23cb('0x46')],_0x3bb169[_0x23cb('0x47')]));if(_0x66adb3[_0x23cb('0x46')][_0x23cb('0x51')]){_0x32bfc8[_0x23cb('0x4f')]=_[_0x23cb('0x52')](_0x32bfc8[_0x23cb('0x4f')],{'$or':_['map'](_0x32bfc8[_0x23cb('0x49')],function(_0x932130){var _0x42dc4e={};_0x42dc4e[_0x932130]={'$like':'%'+_0x66adb3[_0x23cb('0x46')][_0x23cb('0x51')]+'%'};return _0x42dc4e;})});}_0x32bfc8=_[_0x23cb('0x52')]({},_0x32bfc8,_0x66adb3['options']);return _0x52e3e5[_0x23cb('0x7c')](_0x32bfc8);}})[_0x23cb('0x25')](function(_0x23109e){if(_0x23109e){_0x1f2344=_0x23109e[_0x23cb('0x4b')];if(!_0x66adb3[_0x23cb('0x46')][_0x23cb('0x7d')](_0x23cb('0x4c'))){_0x32bfc8[_0x23cb('0x32')]=qs['limit'](_0x66adb3[_0x23cb('0x46')][_0x23cb('0x32')]);_0x32bfc8[_0x23cb('0x31')]=qs[_0x23cb('0x31')](_0x66adb3[_0x23cb('0x46')][_0x23cb('0x31')]);}return _0x52e3e5[_0x23cb('0x7c')](_0x32bfc8);}})[_0x23cb('0x25')](function(_0x589088){if(_0x589088){return _0x589088?{'count':_0x1f2344,'rows':_0x589088}:null;}})['then'](respondWithResult(_0x12e53f,null))['catch'](handleError(_0x12e53f,null));};exports['notify']=function(_0x56b2b2,_0x128ac8,_0x58605c){var _0x43d662={'channel':_0x23cb('0x7e')};var _0x487e42=[];var _0x265fe3=[];var _0x36901e={};return db['WhatsappAccount'][_0x23cb('0x5e')]({'where':{'id':_0x56b2b2[_0x23cb('0x58')]['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})[_0x23cb('0x25')](handleEntityNotFound(_0x128ac8,null))['then'](function(_0x77af6f){_0x43d662[_0x23cb('0x7f')]=_0x77af6f;_0x43d662[_0x23cb('0x80')]=_[_0x23cb('0x81')](_0x77af6f[_0x23cb('0x82')],['priority'],[_0x23cb('0x83')]);if(_0x43d662[_0x23cb('0x7f')][_0x23cb('0x82')]){delete _0x43d662[_0x23cb('0x7f')][_0x23cb('0x82')];}return db[_0x23cb('0x84')]['describe']();})[_0x23cb('0x25')](function(_0x58bfc7){if(!_0x58bfc7){throw new db[(_0x23cb('0x85'))][(_0x23cb('0x86'))](_0x23cb('0x87'));}_0x487e42=_['difference'](_['keys'](_0x58bfc7),[_0x23cb('0x88'),'updatedAt']);_0x265fe3=_['difference'](_[_0x23cb('0x59')](_0x58bfc7),[_0x23cb('0x88'),_0x23cb('0x89'),_0x23cb('0x8a'),'ListId']);_0x43d662[_0x23cb('0x63')]={'mapKey':_0x23cb('0x8b')};if(_0x43d662[_0x23cb('0x7f')][_0x23cb('0x8c')]&&_0x43d662[_0x23cb('0x7f')][_0x23cb('0x8c')]===_0x23cb('0x8d')){_0x43d662[_0x23cb('0x63')][_0x23cb('0x8e')]=_0x56b2b2[_0x23cb('0x63')][_0x23cb('0x8f')][_0x23cb('0x90')](_0x23cb('0x91'),'');_0x43d662[_0x23cb('0x63')][_0x23cb('0x63')]=_0x56b2b2['body'][_0x23cb('0x92')];_0x43d662[_0x23cb('0x63')][_0x23cb('0x93')]=_0x56b2b2['body'][_0x23cb('0x94')];}if(_0x43d662[_0x23cb('0x63')]['id']){delete _0x43d662[_0x23cb('0x63')]['id'];}if(_['isNil'](_0x43d662[_0x23cb('0x63')][_0x23cb('0x8e')])){throw new db['Sequelize'][(_0x23cb('0x86'))]('from\x20is\x20mandatory');}if(_[_0x23cb('0x95')](_0x43d662['body'][_0x23cb('0x63')])||_0x43d662[_0x23cb('0x63')][_0x23cb('0x63')]===''){throw new db[(_0x23cb('0x85'))][(_0x23cb('0x86'))](_0x23cb('0x96'));}if(_[_0x23cb('0x95')](_0x43d662[_0x23cb('0x63')][_0x23cb('0x97')])){throw new db[(_0x23cb('0x85'))][(_0x23cb('0x86'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x265fe3);}if(!_[_0x23cb('0x98')](_0x265fe3,_0x43d662['body'][_0x23cb('0x97')])){throw new db['Sequelize'][(_0x23cb('0x86'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x265fe3);}_0x36901e[_0x43d662['body'][_0x23cb('0x97')]]=_0x43d662[_0x23cb('0x63')][_0x23cb('0x8e')];return db[_0x23cb('0x99')][_0x23cb('0x5e')]({'where':{'id':_0x43d662[_0x23cb('0x7f')][_0x23cb('0x9a')]},'include':[{'model':db[_0x23cb('0x84')],'as':_0x23cb('0x9b'),'where':_0x36901e,'limit':0x1,'order':[[_0x23cb('0x89'),_0x23cb('0x9c')]]}]});})[_0x23cb('0x25')](handleEntityNotFound(_0x128ac8,null))[_0x23cb('0x25')](function(_0x157595){if(_0x157595){_0x43d662[_0x23cb('0x9d')]=_['omit'](_0x157595,[_0x23cb('0x9b')]);if(_0x157595['Contacts'][_0x23cb('0x4b')]){return _0x157595[_0x23cb('0x9b')][0x0];}var _0x92d091=_[_0x23cb('0x9e')](_0x43d662[_0x23cb('0x63')],{'firstName':_0x43d662[_0x23cb('0x63')][_0x23cb('0x8e')],'ListId':_0x157595['id']});_0x92d091[_0x43d662[_0x23cb('0x63')]['mapKey']]=_0x43d662['body'][_0x23cb('0x8e')];return db[_0x23cb('0x84')][_0x23cb('0x5a')](_0x92d091,{'fields':_0x487e42,'raw':!![]});}})[_0x23cb('0x25')](handleEntityNotFound(_0x128ac8,null))[_0x23cb('0x25')](function(_0xbc37b){if(_0xbc37b){_0x43d662['contact']=_0xbc37b;var _0x26f22e={'ContactId':_0xbc37b['id'],'phone':_0x43d662[_0x23cb('0x63')][_0x23cb('0x8e')],'WhatsappAccountId':_0x56b2b2[_0x23cb('0x58')]['id']};var _0x4276aa={'ContactId':_0xbc37b['id'],'WhatsappAccountId':_0x56b2b2[_0x23cb('0x58')]['id'],'closed':![]};return db[_0x23cb('0x9f')][_0x23cb('0x5e')]({'where':_0x4276aa})[_0x23cb('0x25')](function(_0x240e15){if(_0x240e15){return[_0x240e15,![]];}return db[_0x23cb('0x9f')][_0x23cb('0x5a')](_0x26f22e)[_0x23cb('0x25')](function(_0x523941){return[_0x523941,!![]];});});}})[_0x23cb('0xa0')](function(_0x23c5cd,_0x19ee84){_0x43d662[_0x23cb('0xa1')]=_0x23c5cd[_0x23cb('0xa2')]({'plain':!![]});_0x43d662[_0x23cb('0xa1')][_0x23cb('0xa3')]=![];if(_0x19ee84){if(_0x43d662[_0x23cb('0x7f')][_0x23cb('0xa4')]){_0x43d662[_0x23cb('0x80')][_0x23cb('0xa5')]({'id':0x0,'priority':_0x43d662[_0x23cb('0x80')][_0x23cb('0x4b')]+0x1,'app':'close','appdata':_0x23cb('0xa6'),'interval':'*,*,*,*'});}_0x43d662[_0x23cb('0xa1')][_0x23cb('0xa3')]=!![];}return db[_0x23cb('0xa7')][_0x23cb('0x5a')]({'phone':_0x43d662[_0x23cb('0x63')][_0x23cb('0x8e')],'messageId':_0x43d662[_0x23cb('0x63')][_0x23cb('0x93')],'body':_0x43d662['body'][_0x23cb('0x63')],'WhatsappAccountId':_0x56b2b2[_0x23cb('0x58')]['id'],'WhatsappInteractionId':_0x23c5cd['id'],'direction':'in','ContactId':_0x23c5cd[_0x23cb('0xa8')],'AttachmentId':_0x43d662['body'][_0x23cb('0xa9')]});})[_0x23cb('0x25')](function(_0x47202d){_0x43d662['message']=_0x47202d;if(_0x43d662[_0x23cb('0xa1')]['UserId']){return db['User'][_0x23cb('0x5e')]({'attributes':['id',_0x23cb('0x3c')],'where':{'id':_0x43d662['interaction'][_0x23cb('0xaa')]}})[_0x23cb('0x25')](function(_0x292f31){if(_0x292f31){_0x43d662[_0x23cb('0x80')][_0x23cb('0xab')]({'id':0x0,'priority':0x0,'app':_0x23cb('0xac'),'appdata':_0x292f31[_0x23cb('0x3c')]+','+(_0x43d662[_0x23cb('0x7f')][_0x23cb('0xad')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x23cb('0xae'),_0x23cb('0xaf'),_0x43d662);});}return respondWithRpcPromise(_0x23cb('0xae'),_0x23cb('0xaf'),_0x43d662);})[_0x23cb('0x25')](function(_0x1e094b){if(_0x1e094b){var _0x487286=0xc8;var _0x12519d='receiveMessage';logger[_0x23cb('0x26')](_0x23cb('0x2a'),_0x12519d,_0x487286,'entity\x20found');logger[_0x23cb('0x29')](_0x23cb('0xb0'),_0x12519d,_0x487286,_0x23cb('0xb1'),JSON[_0x23cb('0xb2')](_0x1e094b));if(_0x43d662[_0x23cb('0x7f')][_0x23cb('0x8c')]===_0x23cb('0x8d')){return _0x128ac8['status'](_0x487286)[_0x23cb('0x33')](_0x23cb('0xb3'),_0x23cb('0xb4'))[_0x23cb('0x3d')](_0x23cb('0xb5'));}else{return _0x128ac8[_0x23cb('0x2d')](_0x487286)[_0x23cb('0x2f')](_0x1e094b);}}})[_0x23cb('0x57')](handleError(_0x128ac8,null));};exports['send']=function(_0x15ba98,_0x307f37,_0x4b1a1a){var _0x5c2bb1,_0x42ceb0,_0x52f11d;if(_['isNil'](_0x15ba98[_0x23cb('0x63')][_0x23cb('0x63')])||_0x15ba98[_0x23cb('0x63')][_0x23cb('0x63')]===''){throw new db['Sequelize'][(_0x23cb('0x86'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x15ba98[_0x23cb('0x63')]['to'])){throw new db[(_0x23cb('0x85'))][(_0x23cb('0x86'))]('to\x20is\x20mandatory');}_0x5c2bb1=_0x15ba98[_0x23cb('0x63')]['to'];return db[_0x23cb('0x41')]['find']({'where':{'id':_0x15ba98['params']['id']},'include':[{'model':db[_0x23cb('0x99')],'as':'List','include':[{'model':db[_0x23cb('0x84')],'as':_0x23cb('0x9b'),'where':{'mobile':_0x5c2bb1},'limit':0x1,'order':[['updatedAt',_0x23cb('0x9c')]]}]}]})['then'](handleEntityNotFound(_0x307f37,null))[_0x23cb('0x25')](function(_0x64705a){if(_0x64705a&&_0x64705a[_0x23cb('0xb6')]){_0x42ceb0=_0x64705a[_0x23cb('0xa2')]({'plain':!![]});if(_0x42ceb0[_0x23cb('0xb6')]&&_0x42ceb0[_0x23cb('0xb6')]['Contacts'][_0x23cb('0x4b')]){return _0x42ceb0[_0x23cb('0xb6')][_0x23cb('0x9b')][0x0];}return db[_0x23cb('0x84')]['create'](_[_0x23cb('0x9e')](_0x15ba98[_0x23cb('0x63')],{'firstName':_0x5c2bb1,'mobile':_0x5c2bb1,'phone':_0x5c2bb1,'ListId':_0x42ceb0['ListId']}));}})[_0x23cb('0x25')](handleEntityNotFound(_0x307f37,null))['then'](function(_0x4310b7){if(_0x4310b7){_0x52f11d=_0x4310b7;return db[_0x23cb('0x9f')][_0x23cb('0x5e')]({'where':{'ContactId':_0x52f11d['id'],'closed':![],'WhatsappAccountId':_0x42ceb0['id']}})[_0x23cb('0x25')](function(_0x5d3438){if(_0x5d3438){return[_0x5d3438,![]];}return db['WhatsappInteraction'][_0x23cb('0x5a')]({'UserId':_0x15ba98[_0x23cb('0x5b')]['id'],'ContactId':_0x52f11d['id'],'WhatsappAccountId':_0x42ceb0['id'],'phone':_0x5c2bb1,'firstMsgDirection':_0x23cb('0xb7'),'Messages':[_[_0x23cb('0x52')](_0x15ba98['body'],{'read':![],'body':_0x15ba98['body']['body'],'phone':_0x5c2bb1,'WhatsappAccountId':_0x42ceb0['id'],'UserId':_0x15ba98[_0x23cb('0x5b')]['id'],'ContactId':_0x52f11d['id']})]},{'include':[{'model':db[_0x23cb('0xa7')],'as':_0x23cb('0xb8')}]})['then'](function(_0x4ae300){return[_0x4ae300,!![]];});});}})[_0x23cb('0xa0')](function(_0x3fbf8a,_0x5065a8){if(_0x5065a8){return _0x3fbf8a;}return db[_0x23cb('0xa7')][_0x23cb('0x5a')](_[_0x23cb('0x52')](_0x15ba98[_0x23cb('0x63')],{'read':![],'body':_0x15ba98[_0x23cb('0x63')][_0x23cb('0x63')],'phone':_0x5c2bb1,'WhatsappAccountId':_0x42ceb0['id'],'WhatsappInteractionId':_0x3fbf8a['id'],'UserId':_0x15ba98[_0x23cb('0x5b')]['id'],'ContactId':_0x52f11d['id']}))[_0x23cb('0x25')](function(_0x7a21d5){_0x3fbf8a['dataValues'][_0x23cb('0xb8')]=[];_0x3fbf8a['dataValues'][_0x23cb('0xb8')]['push'](_0x7a21d5['dataValues']);return _0x3fbf8a;});})['then'](respondWithResult(_0x307f37,null))[_0x23cb('0x57')](handleError(_0x307f37,null));}; \ No newline at end of file +var _0xb098=['waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','Content-Type','send','\x0a','to\x20is\x20mandatory','List','dataValues','Messages','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','includeAll','include','rows','show','params','find','create','body','user','role','WhatsappAccounts','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','WhatsappAccountId','Disposition','getDispositions','length','findAll','removeDispositions','CannedAnswer','getAnswers','findOne','order','options','removeAnswers','addAgents','ids','omit','spread','emit','userWhatsappAccount:save','getAgents','addApplications','sequelize','transaction','WhatsappApplication','findAndCountAll','priority','getApplications','notify','Applications','account','applications','orderBy','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','From','replace','whatsapp:','messageId','MessageSid','ValidationError','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','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','push','close','WhatsappMessage','UserId','unshift','agent'];(function(_0xe437db,_0x424765){var _0x36efba=function(_0x16d06e){while(--_0x16d06e){_0xe437db['push'](_0xe437db['shift']());}};_0x36efba(++_0x424765);}(_0xb098,0x173));var _0x8b09=function(_0xe12f46,_0x3b5866){_0xe12f46=_0xe12f46-0x0;var _0x464bb4=_0xb098[_0xe12f46];return _0x464bb4;};'use strict';var pdf=require(_0x8b09('0x0'));var emlformat=require(_0x8b09('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8b09('0x2'));var jsonpatch=require(_0x8b09('0x3'));var rp=require('request-promise');var moment=require(_0x8b09('0x4'));var BPromise=require(_0x8b09('0x5'));var Mustache=require('mustache');var util=require(_0x8b09('0x6'));var path=require(_0x8b09('0x7'));var sox=require(_0x8b09('0x8'));var csv=require(_0x8b09('0x9'));var ejs=require(_0x8b09('0xa'));var fs=require('fs');var fs_extra=require(_0x8b09('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8b09('0xc'));var jsforce=require(_0x8b09('0xd'));var deskjs=require(_0x8b09('0xe'));var toCsv=require(_0x8b09('0x9'));var querystring=require('querystring');var Papa=require(_0x8b09('0xf'));var Redis=require(_0x8b09('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8b09('0x11'));var as=require(_0x8b09('0x12'));var hardwareService=require(_0x8b09('0x13'));var logger=require(_0x8b09('0x14'))('api');var utils=require(_0x8b09('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8b09('0x16'));var db=require('../../mysqldb')['db'];config[_0x8b09('0x17')]=_[_0x8b09('0x18')](config[_0x8b09('0x17')],{'host':_0x8b09('0x19'),'port':0x18eb});var socket=require(_0x8b09('0x1a'))(new Redis(config['redis']));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0x8b09('0x1b'));var client=jayson[_0x8b09('0x1c')]['http']({'port':0x232c});function respondWithRpcPromise(_0xb9cad8,_0x2bbf42,_0x281145,_0x55e41a){return new BPromise(function(_0x5195c5,_0x5897cc){var _0x261340=_0x55e41a||client;return _0x261340['request'](_0xb9cad8,_0x281145)[_0x8b09('0x1d')](function(_0x298c45){logger[_0x8b09('0x1e')](_0x8b09('0x1f'),_0x2bbf42,_0x8b09('0x20'));logger[_0x8b09('0x21')](_0x8b09('0x22'),_0x2bbf42,'request\x20sent',JSON[_0x8b09('0x23')](_0x298c45));if(_0x298c45[_0x8b09('0x24')]){if(_0x298c45[_0x8b09('0x24')][_0x8b09('0x25')]===0x1f4){logger[_0x8b09('0x24')](_0x8b09('0x1f'),_0x2bbf42,_0x298c45[_0x8b09('0x24')][_0x8b09('0x26')]);return _0x5897cc(_0x298c45[_0x8b09('0x24')][_0x8b09('0x26')]);}logger[_0x8b09('0x24')](_0x8b09('0x1f'),_0x2bbf42,_0x298c45[_0x8b09('0x24')][_0x8b09('0x26')]);return _0x5195c5(_0x298c45[_0x8b09('0x24')][_0x8b09('0x26')]);}else{logger[_0x8b09('0x1e')](_0x8b09('0x1f'),_0x2bbf42,_0x8b09('0x20'));_0x5195c5(_0x298c45[_0x8b09('0x27')][_0x8b09('0x26')]);}})[_0x8b09('0x28')](function(_0x1fb92e){logger[_0x8b09('0x24')](_0x8b09('0x1f'),_0x2bbf42,_0x1fb92e);_0x5897cc(_0x1fb92e);});});}function respondWithStatusCode(_0x40d5a9,_0xe43df8){_0xe43df8=_0xe43df8||0xcc;return function(_0x5db37f){if(_0x5db37f){return _0x40d5a9['sendStatus'](_0xe43df8);}return _0x40d5a9['status'](_0xe43df8)[_0x8b09('0x29')]();};}function respondWithResult(_0xe7848,_0x409055){_0x409055=_0x409055||0xc8;return function(_0x44c42d){if(_0x44c42d){return _0xe7848[_0x8b09('0x2a')](_0x409055)[_0x8b09('0x2b')](_0x44c42d);}};}function respondWithFilteredResult(_0x5debff,_0x3a67ac){return function(_0x561564){if(_0x561564){var _0x9acbc2=_0x561564[_0x8b09('0x2c')],_0x30649c=_0x3a67ac[_0x8b09('0x2d')],_0x55c0c6=_0x3a67ac[_0x8b09('0x2d')]+_0x3a67ac[_0x8b09('0x2e')],_0x20d8eb;if(_0x55c0c6>=_0x9acbc2){_0x55c0c6=_0x9acbc2;_0x20d8eb=0xc8;}else{_0x20d8eb=0xce;}_0x5debff[_0x8b09('0x2a')](_0x20d8eb);return _0x5debff[_0x8b09('0x2f')](_0x8b09('0x30'),_0x30649c+'-'+_0x55c0c6+'/'+_0x9acbc2)[_0x8b09('0x2b')](_0x561564);}return null;};}function patchUpdates(_0x45ee34){return function(_0x26090f){try{jsonpatch[_0x8b09('0x31')](_0x26090f,_0x45ee34,!![]);}catch(_0x3f27a){return BPromise[_0x8b09('0x32')](_0x3f27a);}return _0x26090f[_0x8b09('0x33')]();};}function saveUpdates(_0x489120,_0x2389cc){return function(_0x559eea){if(_0x559eea){return _0x559eea['update'](_0x489120)[_0x8b09('0x1d')](function(_0x40098d){return _0x40098d;});}return null;};}function removeEntity(_0x3305d5,_0xdca075){return function(_0x549471){if(_0x549471){return _0x549471[_0x8b09('0x34')]()[_0x8b09('0x1d')](function(){var _0x49cb75=_0x549471[_0x8b09('0x35')]({'plain':!![]});var _0x67bcff='WhatsappAccounts';return db[_0x8b09('0x36')][_0x8b09('0x34')]({'where':{'type':_0x67bcff,'resourceId':_0x49cb75['id']}})[_0x8b09('0x1d')](function(){return _0x549471;});})[_0x8b09('0x1d')](function(){_0x3305d5[_0x8b09('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10a501,_0x5514ce){return function(_0x3b21f2){if(!_0x3b21f2){_0x10a501['sendStatus'](0x194);}return _0x3b21f2;};}function handleError(_0x42fc6b,_0x20f06){_0x20f06=_0x20f06||0x1f4;return function(_0x1bd862){logger[_0x8b09('0x24')](_0x1bd862[_0x8b09('0x37')]);if(_0x1bd862['name']){delete _0x1bd862[_0x8b09('0x38')];}_0x42fc6b[_0x8b09('0x2a')](_0x20f06)['send'](_0x1bd862);};}exports[_0x8b09('0x39')]=function(_0x14930c,_0x15a604){var _0x1d0c4e={'include':[{'model':db[_0x8b09('0x3a')],'as':_0x8b09('0x3b')}]},_0x146e3e={},_0x13058e={'count':0x0,'rows':[]};var _0x5f2aeb=_[_0x8b09('0x3c')](db[_0x8b09('0x3d')][_0x8b09('0x3e')],function(_0x1f6755){return{'name':_0x1f6755[_0x8b09('0x3f')],'type':_0x1f6755[_0x8b09('0x40')][_0x8b09('0x41')]};});_0x146e3e['model']=_[_0x8b09('0x3c')](_0x5f2aeb,_0x8b09('0x38'));_0x146e3e[_0x8b09('0x42')]=_[_0x8b09('0x43')](_0x14930c[_0x8b09('0x42')]);_0x146e3e['filters']=_[_0x8b09('0x44')](_0x146e3e['model'],_0x146e3e[_0x8b09('0x42')]);_0x1d0c4e[_0x8b09('0x45')]=_[_0x8b09('0x44')](_0x146e3e[_0x8b09('0x46')],qs[_0x8b09('0x47')](_0x14930c[_0x8b09('0x42')][_0x8b09('0x47')]));_0x1d0c4e[_0x8b09('0x45')]=_0x1d0c4e[_0x8b09('0x45')]['length']?_0x1d0c4e['attributes']:_0x146e3e[_0x8b09('0x46')];if(!_0x14930c[_0x8b09('0x42')][_0x8b09('0x48')](_0x8b09('0x49'))){_0x1d0c4e[_0x8b09('0x2e')]=qs[_0x8b09('0x2e')](_0x14930c['query'][_0x8b09('0x2e')]);_0x1d0c4e['offset']=qs[_0x8b09('0x2d')](_0x14930c[_0x8b09('0x42')][_0x8b09('0x2d')]);}_0x1d0c4e['order']=qs[_0x8b09('0x4a')](_0x14930c['query'][_0x8b09('0x4a')]);_0x1d0c4e[_0x8b09('0x4b')]=qs[_0x8b09('0x4c')](_[_0x8b09('0x4d')](_0x14930c[_0x8b09('0x42')],_0x146e3e[_0x8b09('0x4c')]),_0x5f2aeb);if(_0x14930c[_0x8b09('0x42')]['filter']){_0x1d0c4e[_0x8b09('0x4b')]=_['merge'](_0x1d0c4e[_0x8b09('0x4b')],{'$or':_['map'](_0x5f2aeb,function(_0x382dda){if(_0x382dda[_0x8b09('0x40')]!==_0x8b09('0x4e')){var _0x477f82={};_0x477f82[_0x382dda[_0x8b09('0x38')]]={'$like':'%'+_0x14930c['query'][_0x8b09('0x4f')]+'%'};return _0x477f82;}})});}_0x1d0c4e=_[_0x8b09('0x50')]({},_0x1d0c4e,_0x14930c['options']);var _0x464098={'where':_0x1d0c4e[_0x8b09('0x4b')]};return db[_0x8b09('0x3d')][_0x8b09('0x2c')](_0x464098)[_0x8b09('0x1d')](function(_0x43b7bd){_0x13058e['count']=_0x43b7bd;if(_0x14930c[_0x8b09('0x42')][_0x8b09('0x51')]){_0x1d0c4e[_0x8b09('0x52')]=[{'all':!![]}];}return db[_0x8b09('0x3d')]['findAll'](_0x1d0c4e);})[_0x8b09('0x1d')](function(_0x2a5b16){_0x13058e[_0x8b09('0x53')]=_0x2a5b16;return _0x13058e;})[_0x8b09('0x1d')](respondWithFilteredResult(_0x15a604,_0x1d0c4e))[_0x8b09('0x28')](handleError(_0x15a604,null));};exports[_0x8b09('0x54')]=function(_0x13cbed,_0x371775){var _0xa83315={'raw':![],'where':{'id':_0x13cbed[_0x8b09('0x55')]['id']},'include':[{'model':db[_0x8b09('0x3a')],'as':_0x8b09('0x3b')}]},_0x21539a={};_0x21539a[_0x8b09('0x46')]=_[_0x8b09('0x43')](db[_0x8b09('0x3d')][_0x8b09('0x3e')]);_0x21539a['query']=_[_0x8b09('0x43')](_0x13cbed[_0x8b09('0x42')]);_0x21539a[_0x8b09('0x4c')]=_[_0x8b09('0x44')](_0x21539a[_0x8b09('0x46')],_0x21539a[_0x8b09('0x42')]);_0xa83315[_0x8b09('0x45')]=_[_0x8b09('0x44')](_0x21539a[_0x8b09('0x46')],qs['fields'](_0x13cbed['query'][_0x8b09('0x47')]));_0xa83315[_0x8b09('0x45')]=_0xa83315['attributes']['length']?_0xa83315[_0x8b09('0x45')]:_0x21539a['model'];if(_0x13cbed['query'][_0x8b09('0x51')]){_0xa83315[_0x8b09('0x52')]=[{'all':!![]}];}_0xa83315=_[_0x8b09('0x50')]({},_0xa83315,_0x13cbed['options']);return db[_0x8b09('0x3d')][_0x8b09('0x56')](_0xa83315)[_0x8b09('0x1d')](handleEntityNotFound(_0x371775,null))['then'](respondWithResult(_0x371775,null))[_0x8b09('0x28')](handleError(_0x371775,null));};exports['create']=function(_0xf3566,_0x566dad){return db[_0x8b09('0x3d')][_0x8b09('0x57')](_0xf3566[_0x8b09('0x58')],{})['then'](function(_0x580143){var _0x338799=_0xf3566[_0x8b09('0x59')][_0x8b09('0x35')]({'plain':!![]});if(!_0x338799)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x338799[_0x8b09('0x5a')]==='user'){var _0x3986be=_0x580143[_0x8b09('0x35')]({'plain':!![]});var _0x6418d0=_0x8b09('0x5b');return db[_0x8b09('0x5c')]['find']({'where':{'name':_0x6418d0,'userProfileId':_0x338799[_0x8b09('0x5d')]},'raw':!![]})['then'](function(_0x21b1bf){if(_0x21b1bf&&_0x21b1bf['autoAssociation']===0x0){return db[_0x8b09('0x36')][_0x8b09('0x57')]({'name':_0x3986be['name'],'resourceId':_0x3986be['id'],'type':_0x21b1bf['name'],'sectionId':_0x21b1bf['id']},{})[_0x8b09('0x1d')](function(){return _0x580143;});}else{return _0x580143;}})[_0x8b09('0x28')](function(_0x29ea9c){logger[_0x8b09('0x24')](_0x8b09('0x5e'),_0x29ea9c);throw _0x29ea9c;});}return _0x580143;})['then'](respondWithResult(_0x566dad,0xc9))[_0x8b09('0x28')](handleError(_0x566dad,null));};exports[_0x8b09('0x5f')]=function(_0x4d7d2f,_0x339a09){if(_0x4d7d2f[_0x8b09('0x58')]['id']){delete _0x4d7d2f[_0x8b09('0x58')]['id'];}return db[_0x8b09('0x3d')][_0x8b09('0x56')]({'where':{'id':_0x4d7d2f[_0x8b09('0x55')]['id']},'include':[{'model':db[_0x8b09('0x3a')],'as':_0x8b09('0x3b')}]})[_0x8b09('0x1d')](handleEntityNotFound(_0x339a09,null))[_0x8b09('0x1d')](saveUpdates(_0x4d7d2f[_0x8b09('0x58')],null))['then'](respondWithResult(_0x339a09,null))[_0x8b09('0x28')](handleError(_0x339a09,null));};exports[_0x8b09('0x34')]=function(_0x5a5a0e,_0x5a5b29){return db[_0x8b09('0x3d')]['find']({'where':{'id':_0x5a5a0e[_0x8b09('0x55')]['id']}})[_0x8b09('0x1d')](handleEntityNotFound(_0x5a5b29,null))[_0x8b09('0x1d')](removeEntity(_0x5a5b29,null))[_0x8b09('0x28')](handleError(_0x5a5b29,null));};exports['describe']=function(_0x45bd45,_0x13f607){return db[_0x8b09('0x3d')][_0x8b09('0x60')]()[_0x8b09('0x1d')](respondWithResult(_0x13f607,null))[_0x8b09('0x28')](handleError(_0x13f607,null));};exports['addDisposition']=function(_0x488104,_0x3abf72,_0x3cb2af){if(_0x488104[_0x8b09('0x58')]['id']){delete _0x488104['body']['id'];}return db[_0x8b09('0x3d')][_0x8b09('0x56')]({'where':{'id':_0x488104['params']['id']}})['then'](handleEntityNotFound(_0x3abf72,null))['then'](function(_0x263a6b){if(_0x263a6b){_0x488104[_0x8b09('0x58')][_0x8b09('0x61')]=_0x263a6b['id'];return db[_0x8b09('0x62')][_0x8b09('0x57')](_0x488104[_0x8b09('0x58')]);}})[_0x8b09('0x1d')](respondWithResult(_0x3abf72,null))[_0x8b09('0x28')](handleError(_0x3abf72,null));};exports[_0x8b09('0x63')]=function(_0x4b7313,_0x402e0f,_0x1dada8){var _0x203dc2={'raw':![],'where':{}};var _0x13ab48={};var _0x264f50={'count':0x0,'rows':[]};return db[_0x8b09('0x3d')]['findOne']({'where':{'id':_0x4b7313[_0x8b09('0x55')]['id']}})[_0x8b09('0x1d')](handleEntityNotFound(_0x402e0f,null))[_0x8b09('0x1d')](function(_0xc41f1c){if(_0xc41f1c){_0x13ab48[_0x8b09('0x46')]=_[_0x8b09('0x43')](db[_0x8b09('0x62')][_0x8b09('0x3e')]);_0x13ab48['query']=_[_0x8b09('0x43')](_0x4b7313[_0x8b09('0x42')]);_0x13ab48['filters']=_['intersection'](_0x13ab48[_0x8b09('0x46')],_0x13ab48[_0x8b09('0x42')]);_0x203dc2[_0x8b09('0x45')]=_[_0x8b09('0x44')](_0x13ab48[_0x8b09('0x46')],qs['fields'](_0x4b7313[_0x8b09('0x42')]['fields']));_0x203dc2[_0x8b09('0x45')]=_0x203dc2[_0x8b09('0x45')][_0x8b09('0x64')]?_0x203dc2[_0x8b09('0x45')]:_0x13ab48['model'];if(!_0x4b7313['query'][_0x8b09('0x48')](_0x8b09('0x49'))){_0x203dc2[_0x8b09('0x2e')]=qs[_0x8b09('0x2e')](_0x4b7313[_0x8b09('0x42')][_0x8b09('0x2e')]);_0x203dc2[_0x8b09('0x2d')]=qs[_0x8b09('0x2d')](_0x4b7313['query'][_0x8b09('0x2d')]);}_0x203dc2['order']=qs['sort'](_0x4b7313['query'][_0x8b09('0x4a')]);_0x203dc2[_0x8b09('0x4b')]=qs['filters'](_[_0x8b09('0x4d')](_0x4b7313[_0x8b09('0x42')],_0x13ab48[_0x8b09('0x4c')]));_0x203dc2[_0x8b09('0x4b')][_0x8b09('0x61')]=_0xc41f1c['id'];if(_0x4b7313[_0x8b09('0x42')][_0x8b09('0x4f')]){_0x203dc2[_0x8b09('0x4b')]=_[_0x8b09('0x50')](_0x203dc2[_0x8b09('0x4b')],{'$or':_['map'](_0x203dc2[_0x8b09('0x45')],function(_0xb2265c){var _0x2a1b8e={};_0x2a1b8e[_0xb2265c]={'$like':'%'+_0x4b7313['query'][_0x8b09('0x4f')]+'%'};return _0x2a1b8e;})});}_0x203dc2=_[_0x8b09('0x50')]({},_0x203dc2,_0x4b7313['options']);return db['Disposition'][_0x8b09('0x2c')]({'where':_0x203dc2[_0x8b09('0x4b')]})[_0x8b09('0x1d')](function(_0xddcefb){_0x264f50[_0x8b09('0x2c')]=_0xddcefb;if(_0x4b7313[_0x8b09('0x42')][_0x8b09('0x51')]){_0x203dc2[_0x8b09('0x52')]=[{'all':!![]}];}return db[_0x8b09('0x62')][_0x8b09('0x65')](_0x203dc2);})[_0x8b09('0x1d')](function(_0x31ce7d){_0x264f50[_0x8b09('0x53')]=_0x31ce7d;return _0x264f50;});}})['then'](respondWithFilteredResult(_0x402e0f,_0x203dc2))['catch'](handleError(_0x402e0f,null));};exports[_0x8b09('0x66')]=function(_0xd1deb3,_0xa0e629,_0x764fb4){return db[_0x8b09('0x3d')][_0x8b09('0x56')]({'where':{'id':_0xd1deb3[_0x8b09('0x55')]['id']}})[_0x8b09('0x1d')](handleEntityNotFound(_0xa0e629,null))[_0x8b09('0x1d')](function(_0x6cc33d){if(_0x6cc33d){return _0x6cc33d[_0x8b09('0x66')](_0xd1deb3[_0x8b09('0x42')]['ids']);}})[_0x8b09('0x1d')](respondWithStatusCode(_0xa0e629,null))[_0x8b09('0x28')](handleError(_0xa0e629,null));};exports['addAnswer']=function(_0x2365f0,_0xec117,_0xdc5fd1){if(_0x2365f0[_0x8b09('0x58')]['id']){delete _0x2365f0[_0x8b09('0x58')]['id'];}return db[_0x8b09('0x3d')][_0x8b09('0x56')]({'where':{'id':_0x2365f0['params']['id']}})[_0x8b09('0x1d')](handleEntityNotFound(_0xec117,null))[_0x8b09('0x1d')](function(_0x10052a){if(_0x10052a){_0x2365f0['body'][_0x8b09('0x61')]=_0x10052a['id'];return db[_0x8b09('0x67')]['create'](_0x2365f0[_0x8b09('0x58')]);}})['then'](respondWithResult(_0xec117,null))[_0x8b09('0x28')](handleError(_0xec117,null));};exports[_0x8b09('0x68')]=function(_0x56fa83,_0x766464,_0x425671){var _0x266736={'raw':![],'where':{}};var _0x70f86c={};var _0x290ff0={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x8b09('0x69')]({'where':{'id':_0x56fa83[_0x8b09('0x55')]['id']}})[_0x8b09('0x1d')](handleEntityNotFound(_0x766464,null))[_0x8b09('0x1d')](function(_0x5ebe3a){if(_0x5ebe3a){_0x70f86c[_0x8b09('0x46')]=_[_0x8b09('0x43')](db[_0x8b09('0x67')]['rawAttributes']);_0x70f86c[_0x8b09('0x42')]=_['keys'](_0x56fa83[_0x8b09('0x42')]);_0x70f86c[_0x8b09('0x4c')]=_[_0x8b09('0x44')](_0x70f86c[_0x8b09('0x46')],_0x70f86c[_0x8b09('0x42')]);_0x266736[_0x8b09('0x45')]=_['intersection'](_0x70f86c[_0x8b09('0x46')],qs[_0x8b09('0x47')](_0x56fa83[_0x8b09('0x42')][_0x8b09('0x47')]));_0x266736[_0x8b09('0x45')]=_0x266736[_0x8b09('0x45')]['length']?_0x266736[_0x8b09('0x45')]:_0x70f86c['model'];if(!_0x56fa83[_0x8b09('0x42')][_0x8b09('0x48')](_0x8b09('0x49'))){_0x266736['limit']=qs['limit'](_0x56fa83[_0x8b09('0x42')][_0x8b09('0x2e')]);_0x266736['offset']=qs['offset'](_0x56fa83['query'][_0x8b09('0x2d')]);}_0x266736[_0x8b09('0x6a')]=qs['sort'](_0x56fa83[_0x8b09('0x42')]['sort']);_0x266736['where']=qs[_0x8b09('0x4c')](_[_0x8b09('0x4d')](_0x56fa83[_0x8b09('0x42')],_0x70f86c[_0x8b09('0x4c')]));_0x266736[_0x8b09('0x4b')][_0x8b09('0x61')]=_0x5ebe3a['id'];if(_0x56fa83[_0x8b09('0x42')][_0x8b09('0x4f')]){_0x266736[_0x8b09('0x4b')]=_[_0x8b09('0x50')](_0x266736['where'],{'$or':_[_0x8b09('0x3c')](_0x266736[_0x8b09('0x45')],function(_0x15fbb3){var _0x4aba70={};_0x4aba70[_0x15fbb3]={'$like':'%'+_0x56fa83[_0x8b09('0x42')][_0x8b09('0x4f')]+'%'};return _0x4aba70;})});}_0x266736=_[_0x8b09('0x50')]({},_0x266736,_0x56fa83[_0x8b09('0x6b')]);return db['CannedAnswer'][_0x8b09('0x2c')]({'where':_0x266736['where']})[_0x8b09('0x1d')](function(_0x38e0e4){_0x290ff0[_0x8b09('0x2c')]=_0x38e0e4;if(_0x56fa83[_0x8b09('0x42')][_0x8b09('0x51')]){_0x266736[_0x8b09('0x52')]=[{'all':!![]}];}return db[_0x8b09('0x67')][_0x8b09('0x65')](_0x266736);})[_0x8b09('0x1d')](function(_0x2d6f2e){_0x290ff0['rows']=_0x2d6f2e;return _0x290ff0;});}})[_0x8b09('0x1d')](respondWithFilteredResult(_0x766464,_0x266736))[_0x8b09('0x28')](handleError(_0x766464,null));};exports[_0x8b09('0x6c')]=function(_0x34d093,_0x4d576b,_0x1afd35){return db['WhatsappAccount'][_0x8b09('0x56')]({'where':{'id':_0x34d093[_0x8b09('0x55')]['id']}})['then'](handleEntityNotFound(_0x4d576b,null))[_0x8b09('0x1d')](function(_0x3fb537){if(_0x3fb537){return _0x3fb537[_0x8b09('0x6c')](_0x34d093[_0x8b09('0x42')]['ids']);}})['then'](respondWithStatusCode(_0x4d576b,null))[_0x8b09('0x28')](handleError(_0x4d576b,null));};exports[_0x8b09('0x6d')]=function(_0x109a1e,_0x19e543,_0x51c92f){return db[_0x8b09('0x3d')][_0x8b09('0x56')]({'where':{'id':_0x109a1e[_0x8b09('0x55')]['id']}})['then'](handleEntityNotFound(_0x19e543,null))['then'](function(_0x2469e3){if(_0x2469e3){return _0x2469e3[_0x8b09('0x6d')](_0x109a1e[_0x8b09('0x58')][_0x8b09('0x6e')],_[_0x8b09('0x6f')](_0x109a1e[_0x8b09('0x58')],[_0x8b09('0x6e'),'id'])||{})[_0x8b09('0x70')](function(_0x45950c){for(var _0x164bb9=0x0;_0x164bb9<_0x109a1e['body'][_0x8b09('0x6e')][_0x8b09('0x64')];_0x164bb9+=0x1){socket[_0x8b09('0x71')](_0x8b09('0x72'),{'UserId':_0x109a1e[_0x8b09('0x58')][_0x8b09('0x6e')][_0x164bb9],'WhatsappAccountId':_0x109a1e[_0x8b09('0x55')]['id']});}return _0x45950c;});}})[_0x8b09('0x1d')](respondWithResult(_0x19e543,null))[_0x8b09('0x28')](handleError(_0x19e543,null));};exports['removeAgents']=function(_0x3e0afc,_0x3816a4,_0x4e79f1){return db[_0x8b09('0x3d')][_0x8b09('0x56')]({'where':{'id':_0x3e0afc[_0x8b09('0x55')]['id']}})[_0x8b09('0x1d')](handleEntityNotFound(_0x3816a4,null))[_0x8b09('0x1d')](function(_0xea092b){if(_0xea092b){return _0xea092b['removeAgents'](_0x3e0afc[_0x8b09('0x42')][_0x8b09('0x6e')])[_0x8b09('0x1d')](function(){if(_['isArray'](_0x3e0afc[_0x8b09('0x42')][_0x8b09('0x6e')])){for(var _0x13f8f2=0x0;_0x13f8f2<_0x3e0afc[_0x8b09('0x42')][_0x8b09('0x6e')]['length'];_0x13f8f2+=0x1){socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x3e0afc[_0x8b09('0x42')]['ids'][_0x13f8f2]),'WhatsappAccountId':Number(_0x3e0afc[_0x8b09('0x55')]['id'])});}}else{socket[_0x8b09('0x71')]('userWhatsappAccount:remove',{'UserId':Number(_0x3e0afc[_0x8b09('0x42')][_0x8b09('0x6e')]),'WhatsappAccountId':Number(_0x3e0afc[_0x8b09('0x55')]['id'])});}});}})[_0x8b09('0x1d')](respondWithStatusCode(_0x3816a4,null))[_0x8b09('0x28')](handleError(_0x3816a4,null));};exports[_0x8b09('0x73')]=function(_0x50cf45,_0x3b8356,_0x392efa){var _0x1fdd48={};var _0x59de86={};var _0x522593;var _0x575487;return db[_0x8b09('0x3d')][_0x8b09('0x69')]({'where':{'id':_0x50cf45[_0x8b09('0x55')]['id']}})[_0x8b09('0x1d')](handleEntityNotFound(_0x3b8356,null))[_0x8b09('0x1d')](function(_0x40d3d2){if(_0x40d3d2){_0x522593=_0x40d3d2;_0x59de86[_0x8b09('0x46')]=_[_0x8b09('0x43')](db['User'][_0x8b09('0x3e')]);_0x59de86['query']=_[_0x8b09('0x43')](_0x50cf45[_0x8b09('0x42')]);_0x59de86[_0x8b09('0x4c')]=_[_0x8b09('0x44')](_0x59de86[_0x8b09('0x46')],_0x59de86[_0x8b09('0x42')]);_0x1fdd48[_0x8b09('0x45')]=_['intersection'](_0x59de86[_0x8b09('0x46')],qs[_0x8b09('0x47')](_0x50cf45[_0x8b09('0x42')][_0x8b09('0x47')]));_0x1fdd48[_0x8b09('0x45')]=_0x1fdd48['attributes']['length']?_0x1fdd48['attributes']:_0x59de86['model'];_0x1fdd48[_0x8b09('0x6a')]=qs[_0x8b09('0x4a')](_0x50cf45[_0x8b09('0x42')][_0x8b09('0x4a')]);_0x1fdd48['where']=qs[_0x8b09('0x4c')](_[_0x8b09('0x4d')](_0x50cf45[_0x8b09('0x42')],_0x59de86[_0x8b09('0x4c')]));if(_0x50cf45[_0x8b09('0x42')]['filter']){_0x1fdd48[_0x8b09('0x4b')]=_[_0x8b09('0x50')](_0x1fdd48['where'],{'$or':_[_0x8b09('0x3c')](_0x1fdd48[_0x8b09('0x45')],function(_0x2b2ee6){var _0xc08656={};_0xc08656[_0x2b2ee6]={'$like':'%'+_0x50cf45[_0x8b09('0x42')]['filter']+'%'};return _0xc08656;})});}_0x1fdd48=_[_0x8b09('0x50')]({},_0x1fdd48,_0x50cf45['options']);return _0x522593[_0x8b09('0x73')](_0x1fdd48);}})[_0x8b09('0x1d')](function(_0x28af05){if(_0x28af05){_0x575487=_0x28af05[_0x8b09('0x64')];if(!_0x50cf45['query'][_0x8b09('0x48')](_0x8b09('0x49'))){_0x1fdd48[_0x8b09('0x2e')]=qs['limit'](_0x50cf45[_0x8b09('0x42')][_0x8b09('0x2e')]);_0x1fdd48[_0x8b09('0x2d')]=qs['offset'](_0x50cf45[_0x8b09('0x42')]['offset']);}return _0x522593[_0x8b09('0x73')](_0x1fdd48);}})[_0x8b09('0x1d')](function(_0x3cd7f0){if(_0x3cd7f0){return _0x3cd7f0?{'count':_0x575487,'rows':_0x3cd7f0}:null;}})[_0x8b09('0x1d')](respondWithResult(_0x3b8356,null))[_0x8b09('0x28')](handleError(_0x3b8356,null));};exports[_0x8b09('0x74')]=function(_0x4ea0e8,_0x2c02ea,_0x196776){return db[_0x8b09('0x3d')][_0x8b09('0x69')]({'where':{'id':_0x4ea0e8[_0x8b09('0x55')]['id']}})[_0x8b09('0x1d')](handleEntityNotFound(_0x2c02ea,null))[_0x8b09('0x1d')](function(_0x225c6e){if(_0x225c6e){return db[_0x8b09('0x75')][_0x8b09('0x76')](function(_0x2517f6){return db[_0x8b09('0x77')][_0x8b09('0x34')]({'where':{'WhatsappAccountId':_0x4ea0e8[_0x8b09('0x55')]['id']},'transaction':_0x2517f6})[_0x8b09('0x1d')](function(_0x48ac8b){var _0x120da4=_['map'](_0x4ea0e8[_0x8b09('0x58')],function(_0x3676ce){_0x3676ce[_0x8b09('0x61')]=_0x4ea0e8[_0x8b09('0x55')]['id'];return _0x3676ce;});return db[_0x8b09('0x77')]['bulkCreate'](_0x120da4,{'transaction':_0x2517f6});});})[_0x8b09('0x1d')](function(){return db['WhatsappApplication'][_0x8b09('0x78')]({'where':{'WhatsappAccountId':_0x4ea0e8['params']['id']},'order':_0x8b09('0x79')});});}})[_0x8b09('0x1d')](respondWithResult(_0x2c02ea,null))['catch'](handleError(_0x2c02ea,null));};exports[_0x8b09('0x7a')]=function(_0x342d25,_0x54d442,_0x71550b){var _0x326097={};var _0x144192={};var _0x473510;var _0x52ecab;return db[_0x8b09('0x3d')][_0x8b09('0x69')]({'where':{'id':_0x342d25[_0x8b09('0x55')]['id']}})[_0x8b09('0x1d')](handleEntityNotFound(_0x54d442,null))['then'](function(_0xc78d32){if(_0xc78d32){_0x473510=_0xc78d32;_0x144192['model']=_[_0x8b09('0x43')](db[_0x8b09('0x77')]['rawAttributes']);_0x144192[_0x8b09('0x42')]=_[_0x8b09('0x43')](_0x342d25[_0x8b09('0x42')]);_0x144192[_0x8b09('0x4c')]=_[_0x8b09('0x44')](_0x144192[_0x8b09('0x46')],_0x144192[_0x8b09('0x42')]);_0x326097[_0x8b09('0x45')]=_['intersection'](_0x144192['model'],qs[_0x8b09('0x47')](_0x342d25[_0x8b09('0x42')][_0x8b09('0x47')]));_0x326097[_0x8b09('0x45')]=_0x326097[_0x8b09('0x45')][_0x8b09('0x64')]?_0x326097[_0x8b09('0x45')]:_0x144192[_0x8b09('0x46')];_0x326097['order']=qs[_0x8b09('0x4a')](_0x342d25[_0x8b09('0x42')][_0x8b09('0x4a')]);_0x326097['where']=qs['filters'](_[_0x8b09('0x4d')](_0x342d25[_0x8b09('0x42')],_0x144192[_0x8b09('0x4c')]));if(_0x342d25['query'][_0x8b09('0x4f')]){_0x326097[_0x8b09('0x4b')]=_[_0x8b09('0x50')](_0x326097[_0x8b09('0x4b')],{'$or':_[_0x8b09('0x3c')](_0x326097['attributes'],function(_0x5cb650){var _0x572988={};_0x572988[_0x5cb650]={'$like':'%'+_0x342d25[_0x8b09('0x42')]['filter']+'%'};return _0x572988;})});}_0x326097=_[_0x8b09('0x50')]({},_0x326097,_0x342d25[_0x8b09('0x6b')]);return _0x473510[_0x8b09('0x7a')](_0x326097);}})[_0x8b09('0x1d')](function(_0xf5d72c){if(_0xf5d72c){_0x52ecab=_0xf5d72c[_0x8b09('0x64')];if(!_0x342d25[_0x8b09('0x42')][_0x8b09('0x48')](_0x8b09('0x49'))){_0x326097['limit']=qs[_0x8b09('0x2e')](_0x342d25[_0x8b09('0x42')][_0x8b09('0x2e')]);_0x326097[_0x8b09('0x2d')]=qs[_0x8b09('0x2d')](_0x342d25['query'][_0x8b09('0x2d')]);}return _0x473510['getApplications'](_0x326097);}})[_0x8b09('0x1d')](function(_0x122a8c){if(_0x122a8c){return _0x122a8c?{'count':_0x52ecab,'rows':_0x122a8c}:null;}})[_0x8b09('0x1d')](respondWithResult(_0x54d442,null))['catch'](handleError(_0x54d442,null));};exports[_0x8b09('0x7b')]=function(_0x4c0f4c,_0x5329fa,_0x435e52){var _0x2e7dad={'channel':'whatsapp'};var _0x3b49d2=[];var _0x2e796a=[];var _0x10809a={};return db[_0x8b09('0x3d')][_0x8b09('0x56')]({'where':{'id':_0x4c0f4c[_0x8b09('0x55')]['id']},'include':[{'model':db[_0x8b09('0x77')],'as':_0x8b09('0x7c')}]})[_0x8b09('0x1d')](handleEntityNotFound(_0x5329fa,null))[_0x8b09('0x1d')](function(_0x321329){_0x2e7dad[_0x8b09('0x7d')]=_0x321329;_0x2e7dad[_0x8b09('0x7e')]=_[_0x8b09('0x7f')](_0x321329['Applications'],['priority'],[_0x8b09('0x80')]);if(_0x2e7dad[_0x8b09('0x7d')][_0x8b09('0x7c')]){delete _0x2e7dad[_0x8b09('0x7d')][_0x8b09('0x7c')];}return db[_0x8b09('0x81')][_0x8b09('0x60')]();})[_0x8b09('0x1d')](function(_0x5b8b08){if(!_0x5b8b08){throw new db[(_0x8b09('0x82'))]['ValidationError'](_0x8b09('0x83'));}_0x3b49d2=_[_0x8b09('0x84')](_[_0x8b09('0x43')](_0x5b8b08),[_0x8b09('0x85'),'updatedAt']);_0x2e796a=_[_0x8b09('0x84')](_[_0x8b09('0x43')](_0x5b8b08),[_0x8b09('0x85'),_0x8b09('0x86'),_0x8b09('0x87'),_0x8b09('0x88')]);_0x2e7dad['body']={'mapKey':'mobile'};if(_0x2e7dad['account'][_0x8b09('0x40')]&&_0x2e7dad[_0x8b09('0x7d')][_0x8b09('0x40')]===_0x8b09('0x89')){_0x2e7dad['body'][_0x8b09('0x8a')]=_0x4c0f4c[_0x8b09('0x58')][_0x8b09('0x8b')][_0x8b09('0x8c')](_0x8b09('0x8d'),'');_0x2e7dad[_0x8b09('0x58')]['body']=_0x4c0f4c[_0x8b09('0x58')]['Body'];_0x2e7dad['body'][_0x8b09('0x8e')]=_0x4c0f4c[_0x8b09('0x58')][_0x8b09('0x8f')];}if(_0x2e7dad[_0x8b09('0x58')]['id']){delete _0x2e7dad[_0x8b09('0x58')]['id'];}if(_['isNil'](_0x2e7dad[_0x8b09('0x58')][_0x8b09('0x8a')])){throw new db['Sequelize'][(_0x8b09('0x90'))]('from\x20is\x20mandatory');}if(_[_0x8b09('0x91')](_0x2e7dad[_0x8b09('0x58')]['body'])||_0x2e7dad[_0x8b09('0x58')]['body']===''){throw new db[(_0x8b09('0x82'))]['ValidationError'](_0x8b09('0x92'));}if(_['isNil'](_0x2e7dad['body'][_0x8b09('0x93')])){throw new db[(_0x8b09('0x82'))][(_0x8b09('0x90'))](_0x8b09('0x94')+_0x2e796a);}if(!_[_0x8b09('0x95')](_0x2e796a,_0x2e7dad[_0x8b09('0x58')][_0x8b09('0x93')])){throw new db[(_0x8b09('0x82'))][(_0x8b09('0x90'))](_0x8b09('0x96')+_0x2e796a);}_0x10809a[_0x2e7dad['body'][_0x8b09('0x93')]]=_0x2e7dad[_0x8b09('0x58')][_0x8b09('0x8a')];return db[_0x8b09('0x97')]['find']({'where':{'id':_0x2e7dad[_0x8b09('0x7d')]['ListId']},'include':[{'model':db[_0x8b09('0x81')],'as':_0x8b09('0x98'),'where':_0x10809a,'limit':0x1,'order':[[_0x8b09('0x86'),_0x8b09('0x99')]]}]});})['then'](handleEntityNotFound(_0x5329fa,null))[_0x8b09('0x1d')](function(_0x269bd5){if(_0x269bd5){_0x2e7dad[_0x8b09('0x9a')]=_['omit'](_0x269bd5,[_0x8b09('0x98')]);if(_0x269bd5[_0x8b09('0x98')][_0x8b09('0x64')]){return _0x269bd5[_0x8b09('0x98')][0x0];}var _0x3ac077=_[_0x8b09('0x18')](_0x2e7dad[_0x8b09('0x58')],{'firstName':_0x2e7dad[_0x8b09('0x58')][_0x8b09('0x8a')],'ListId':_0x269bd5['id']});_0x3ac077[_0x2e7dad[_0x8b09('0x58')]['mapKey']]=_0x2e7dad[_0x8b09('0x58')][_0x8b09('0x8a')];return db[_0x8b09('0x81')][_0x8b09('0x57')](_0x3ac077,{'fields':_0x3b49d2,'raw':!![]});}})['then'](handleEntityNotFound(_0x5329fa,null))[_0x8b09('0x1d')](function(_0x325a38){if(_0x325a38){_0x2e7dad[_0x8b09('0x9b')]=_0x325a38;var _0x48ea62={'ContactId':_0x325a38['id'],'phone':_0x2e7dad[_0x8b09('0x58')]['from'],'WhatsappAccountId':_0x4c0f4c[_0x8b09('0x55')]['id']};var _0x34512f={'ContactId':_0x325a38['id'],'WhatsappAccountId':_0x4c0f4c[_0x8b09('0x55')]['id'],'closed':![]};return db[_0x8b09('0x9c')][_0x8b09('0x56')]({'where':_0x34512f})[_0x8b09('0x1d')](function(_0x577dfb){if(_0x577dfb){return[_0x577dfb,![]];}return db[_0x8b09('0x9c')][_0x8b09('0x57')](_0x48ea62)[_0x8b09('0x1d')](function(_0x3da27c){return[_0x3da27c,!![]];});});}})[_0x8b09('0x70')](function(_0x212d3a,_0x270253){_0x2e7dad[_0x8b09('0x9d')]=_0x212d3a[_0x8b09('0x35')]({'plain':!![]});_0x2e7dad[_0x8b09('0x9d')][_0x8b09('0x9e')]=![];if(_0x270253){if(_0x2e7dad[_0x8b09('0x7d')][_0x8b09('0x9f')]){_0x2e7dad[_0x8b09('0x7e')][_0x8b09('0xa0')]({'id':0x0,'priority':_0x2e7dad['applications'][_0x8b09('0x64')]+0x1,'app':_0x8b09('0xa1'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x2e7dad[_0x8b09('0x9d')]['created']=!![];}return db[_0x8b09('0xa2')][_0x8b09('0x57')]({'phone':_0x2e7dad['body']['from'],'messageId':_0x2e7dad[_0x8b09('0x58')][_0x8b09('0x8e')],'body':_0x2e7dad[_0x8b09('0x58')][_0x8b09('0x58')],'WhatsappAccountId':_0x4c0f4c[_0x8b09('0x55')]['id'],'WhatsappInteractionId':_0x212d3a['id'],'direction':'in','ContactId':_0x212d3a['ContactId'],'AttachmentId':_0x2e7dad[_0x8b09('0x58')]['AttachmentId']});})['then'](function(_0x54993d){_0x2e7dad[_0x8b09('0x26')]=_0x54993d;if(_0x2e7dad[_0x8b09('0x9d')][_0x8b09('0xa3')]){return db['User'][_0x8b09('0x56')]({'attributes':['id',_0x8b09('0x38')],'where':{'id':_0x2e7dad[_0x8b09('0x9d')][_0x8b09('0xa3')]}})['then'](function(_0x9116f3){if(_0x9116f3){_0x2e7dad[_0x8b09('0x7e')][_0x8b09('0xa4')]({'id':0x0,'priority':0x0,'app':_0x8b09('0xa5'),'appdata':_0x9116f3[_0x8b09('0x38')]+','+(_0x2e7dad[_0x8b09('0x7d')][_0x8b09('0xa6')]||0xa),'interval':_0x8b09('0xa7')});}return respondWithRpcPromise(_0x8b09('0xa8'),'startRouting',_0x2e7dad);});}return respondWithRpcPromise(_0x8b09('0xa8'),_0x8b09('0xa9'),_0x2e7dad);})[_0x8b09('0x1d')](function(_0x5911c2){if(_0x5911c2){var _0x3d0d65=0xc8;var _0x359c77=_0x8b09('0xaa');logger[_0x8b09('0x1e')](_0x8b09('0x22'),_0x359c77,_0x3d0d65,_0x8b09('0xab'));logger[_0x8b09('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x359c77,_0x3d0d65,'entity\x20found',JSON[_0x8b09('0x23')](_0x5911c2));if(_0x2e7dad['account'][_0x8b09('0x40')]===_0x8b09('0x89')){return _0x5329fa[_0x8b09('0x2a')](_0x3d0d65)[_0x8b09('0x2f')](_0x8b09('0xac'),'text/xml')[_0x8b09('0xad')](_0x8b09('0xae'));}else{return _0x5329fa[_0x8b09('0x2a')](_0x3d0d65)[_0x8b09('0x2b')](_0x5911c2);}}})[_0x8b09('0x28')](handleError(_0x5329fa,null));};exports[_0x8b09('0xad')]=function(_0x29db92,_0x1091fd,_0x15fbc0){var _0x2bede1,_0x549bc2,_0x4bcacf;if(_[_0x8b09('0x91')](_0x29db92[_0x8b09('0x58')][_0x8b09('0x58')])||_0x29db92[_0x8b09('0x58')][_0x8b09('0x58')]===''){throw new db[(_0x8b09('0x82'))][(_0x8b09('0x90'))](_0x8b09('0x92'));}if(_['isNil'](_0x29db92[_0x8b09('0x58')]['to'])){throw new db[(_0x8b09('0x82'))][(_0x8b09('0x90'))](_0x8b09('0xaf'));}_0x2bede1=_0x29db92[_0x8b09('0x58')]['to'];return db[_0x8b09('0x3d')][_0x8b09('0x56')]({'where':{'id':_0x29db92[_0x8b09('0x55')]['id']},'include':[{'model':db[_0x8b09('0x97')],'as':_0x8b09('0xb0'),'include':[{'model':db['CmContact'],'as':_0x8b09('0x98'),'where':{'mobile':_0x2bede1},'limit':0x1,'order':[[_0x8b09('0x86'),_0x8b09('0x99')]]}]}]})[_0x8b09('0x1d')](handleEntityNotFound(_0x1091fd,null))[_0x8b09('0x1d')](function(_0x252734){if(_0x252734&&_0x252734[_0x8b09('0xb0')]){_0x549bc2=_0x252734[_0x8b09('0x35')]({'plain':!![]});if(_0x549bc2[_0x8b09('0xb0')]&&_0x549bc2[_0x8b09('0xb0')][_0x8b09('0x98')][_0x8b09('0x64')]){return _0x549bc2['List'][_0x8b09('0x98')][0x0];}return db[_0x8b09('0x81')]['create'](_[_0x8b09('0x18')](_0x29db92[_0x8b09('0x58')],{'firstName':_0x2bede1,'mobile':_0x2bede1,'phone':_0x2bede1,'ListId':_0x549bc2[_0x8b09('0x88')]}));}})[_0x8b09('0x1d')](handleEntityNotFound(_0x1091fd,null))[_0x8b09('0x1d')](function(_0x40cb1c){if(_0x40cb1c){_0x4bcacf=_0x40cb1c;return db[_0x8b09('0x9c')][_0x8b09('0x56')]({'where':{'ContactId':_0x4bcacf['id'],'closed':![],'WhatsappAccountId':_0x549bc2['id']}})[_0x8b09('0x1d')](function(_0x48f76c){if(_0x48f76c){return[_0x48f76c,![]];}return db[_0x8b09('0x9c')][_0x8b09('0x57')]({'UserId':_0x29db92[_0x8b09('0x59')]['id'],'ContactId':_0x4bcacf['id'],'WhatsappAccountId':_0x549bc2['id'],'phone':_0x2bede1,'firstMsgDirection':'out','Messages':[_['merge'](_0x29db92[_0x8b09('0x58')],{'read':![],'body':_0x29db92[_0x8b09('0x58')][_0x8b09('0x58')],'phone':_0x2bede1,'WhatsappAccountId':_0x549bc2['id'],'UserId':_0x29db92[_0x8b09('0x59')]['id'],'ContactId':_0x4bcacf['id']})]},{'include':[{'model':db[_0x8b09('0xa2')],'as':'Messages'}]})[_0x8b09('0x1d')](function(_0x47045e){return[_0x47045e,!![]];});});}})[_0x8b09('0x70')](function(_0x506817,_0x208a88){if(_0x208a88){return _0x506817;}return db[_0x8b09('0xa2')][_0x8b09('0x57')](_[_0x8b09('0x50')](_0x29db92[_0x8b09('0x58')],{'read':![],'body':_0x29db92[_0x8b09('0x58')]['body'],'phone':_0x2bede1,'WhatsappAccountId':_0x549bc2['id'],'WhatsappInteractionId':_0x506817['id'],'UserId':_0x29db92[_0x8b09('0x59')]['id'],'ContactId':_0x4bcacf['id']}))[_0x8b09('0x1d')](function(_0x461527){_0x506817[_0x8b09('0xb1')][_0x8b09('0xb2')]=[];_0x506817['dataValues'][_0x8b09('0xb2')]['push'](_0x461527['dataValues']);return _0x506817;});})[_0x8b09('0x1d')](respondWithResult(_0x1091fd,null))[_0x8b09('0x28')](handleError(_0x1091fd,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 626d407..d836f6f 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 _0xef17=['update','remove','emit','hook','events','../../mysqldb','WhatsappAccount','setMaxListeners','save'];(function(_0x31aba2,_0x4fa382){var _0x44dae7=function(_0x4aa074){while(--_0x4aa074){_0x31aba2['push'](_0x31aba2['shift']());}};_0x44dae7(++_0x4fa382);}(_0xef17,0x136));var _0x7ef1=function(_0x49a2ca,_0x1aebd4){_0x49a2ca=_0x49a2ca-0x0;var _0x10e315=_0xef17[_0x49a2ca];return _0x10e315;};'use strict';var EventEmitter=require(_0x7ef1('0x0'));var WhatsappAccount=require(_0x7ef1('0x1'))['db'][_0x7ef1('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x7ef1('0x3')](0x0);var events={'afterCreate':_0x7ef1('0x4'),'afterUpdate':_0x7ef1('0x5'),'afterDestroy':_0x7ef1('0x6')};function emitEvent(_0x19a10d){return function(_0x2daaa6,_0x538a0a,_0x1d2f83){WhatsappAccountEvents['emit'](_0x19a10d+':'+_0x2daaa6['id'],_0x2daaa6);WhatsappAccountEvents[_0x7ef1('0x7')](_0x19a10d,_0x2daaa6);_0x1d2f83(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x7ef1('0x8')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x7046=['events','../../mysqldb','WhatsappAccount','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0xe4a604,_0x225d31){var _0x240f2f=function(_0x34d36e){while(--_0x34d36e){_0xe4a604['push'](_0xe4a604['shift']());}};_0x240f2f(++_0x225d31);}(_0x7046,0x144));var _0x6704=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7046[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x6704('0x0'));var WhatsappAccount=require(_0x6704('0x1'))['db'][_0x6704('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x6704('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6704('0x4'),'afterDestroy':_0x6704('0x5')};function emitEvent(_0x2899c5){return function(_0x5258e7,_0x1e9b2a,_0x35bcc6){WhatsappAccountEvents[_0x6704('0x6')](_0x2899c5+':'+_0x5258e7['id'],_0x5258e7);WhatsappAccountEvents[_0x6704('0x6')](_0x2899c5,_0x5258e7);_0x35bcc6(null);};}for(var e in events){if(events[_0x6704('0x7')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x6704('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 1e67881..b59c10b 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 _0xf2b8=['WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define'];(function(_0x18e52b,_0x1fae35){var _0x3d3062=function(_0x133b14){while(--_0x133b14){_0x18e52b['push'](_0x18e52b['shift']());}};_0x3d3062(++_0x1fae35);}(_0xf2b8,0x16a));var _0x8f2b=function(_0x1f3aaa,_0x39e5b1){_0x1f3aaa=_0x1f3aaa-0x0;var _0x420625=_0xf2b8[_0x1f3aaa];return _0x420625;};'use strict';var _=require(_0x8f2b('0x0'));var util=require(_0x8f2b('0x1'));var logger=require(_0x8f2b('0x2'))(_0x8f2b('0x3'));var moment=require(_0x8f2b('0x4'));var BPromise=require(_0x8f2b('0x5'));var rp=require(_0x8f2b('0x6'));var fs=require('fs');var path=require(_0x8f2b('0x7'));var rimraf=require(_0x8f2b('0x8'));var config=require(_0x8f2b('0x9'));var attributes=require(_0x8f2b('0xa'));module[_0x8f2b('0xb')]=function(_0x293f4b,_0x3b8cd8){return _0x293f4b[_0x8f2b('0xc')](_0x8f2b('0xd'),attributes,{'tableName':_0x8f2b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3439=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappAccount','whatsapp_accounts'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3439,0xd8));var _0x9343=function(_0x1f39da,_0x3be429){_0x1f39da=_0x1f39da-0x0;var _0x321255=_0x3439[_0x1f39da];return _0x321255;};'use strict';var _=require(_0x9343('0x0'));var util=require(_0x9343('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9343('0x2'));var BPromise=require(_0x9343('0x3'));var rp=require(_0x9343('0x4'));var fs=require('fs');var path=require(_0x9343('0x5'));var rimraf=require(_0x9343('0x6'));var config=require(_0x9343('0x7'));var attributes=require('./whatsappAccount.attributes');module[_0x9343('0x8')]=function(_0x137d4b,_0x1f34f0){return _0x137d4b[_0x9343('0x9')](_0x9343('0xa'),attributes,{'tableName':_0x9343('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index b5c92d8..ab6de42 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 _0x07f5=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','request','request\x20sent','debug','stringify','code','error','WhatsappAccount,\x20%s,\x20%s','message','info','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','model','map','then','lodash','util'];(function(_0x51879a,_0x56b6f4){var _0x37ef2c=function(_0x11399a){while(--_0x11399a){_0x51879a['push'](_0x51879a['shift']());}};_0x37ef2c(++_0x56b6f4);}(_0x07f5,0xc1));var _0x507f=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x07f5[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x507f('0x0'));var util=require(_0x507f('0x1'));var moment=require(_0x507f('0x2'));var BPromise=require(_0x507f('0x3'));var rs=require(_0x507f('0x4'));var fs=require('fs');var Redis=require(_0x507f('0x5'));var db=require(_0x507f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x507f('0x7'))(_0x507f('0x8'));var config=require(_0x507f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x507f('0xa')][_0x507f('0xb')]({'port':0x232a});config[_0x507f('0xc')]=_[_0x507f('0xd')](config[_0x507f('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x507f('0xe'))(new Redis(config[_0x507f('0xc')]));require(_0x507f('0xf'))[_0x507f('0x10')](socket);function respondWithRpcPromise(_0x4fd84c,_0x6633f0,_0x48d3f3){return new BPromise(function(_0x738740,_0x54c9db){return client[_0x507f('0x11')](_0x4fd84c,_0x48d3f3)['then'](function(_0x343c93){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x6633f0,_0x507f('0x12'));logger[_0x507f('0x13')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x6633f0,_0x507f('0x12'),JSON[_0x507f('0x14')](_0x343c93));if(_0x343c93['error']){if(_0x343c93['error'][_0x507f('0x15')]===0x1f4){logger[_0x507f('0x16')](_0x507f('0x17'),_0x6633f0,_0x343c93[_0x507f('0x16')][_0x507f('0x18')]);return _0x54c9db(_0x343c93[_0x507f('0x16')][_0x507f('0x18')]);}logger[_0x507f('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x6633f0,_0x343c93[_0x507f('0x16')][_0x507f('0x18')]);return _0x738740(_0x343c93[_0x507f('0x16')][_0x507f('0x18')]);}else{logger[_0x507f('0x19')](_0x507f('0x17'),_0x6633f0,_0x507f('0x12'));_0x738740(_0x343c93[_0x507f('0x1a')][_0x507f('0x18')]);}})[_0x507f('0x1b')](function(_0x329dbd){logger[_0x507f('0x16')](_0x507f('0x17'),_0x6633f0,_0x329dbd);_0x54c9db(_0x329dbd);});});}exports[_0x507f('0x1c')]=function(_0x521884){var _0xf4190a=this;return new Promise(function(_0x167d0c,_0x59d1fe){return db[_0x507f('0x1d')][_0x507f('0x1e')]({'raw':_0x521884['options']?_0x521884[_0x507f('0x1f')][_0x507f('0x20')]===undefined?!![]:![]:!![],'where':_0x521884['options']?_0x521884[_0x507f('0x1f')][_0x507f('0x21')]||null:null,'attributes':_0x521884[_0x507f('0x1f')]?_0x521884['options'][_0x507f('0x22')]||null:null,'include':_0x521884[_0x507f('0x1f')]?_0x521884[_0x507f('0x1f')]['include']?_['map'](_0x521884[_0x507f('0x1f')][_0x507f('0x23')],function(_0x5aee21){return{'model':db[_0x5aee21[_0x507f('0x24')]],'as':_0x5aee21['as'],'attributes':_0x5aee21[_0x507f('0x22')],'include':_0x5aee21['include']?_[_0x507f('0x25')](_0x5aee21[_0x507f('0x23')],function(_0x34269a){return{'model':db[_0x34269a[_0x507f('0x24')]],'as':_0x34269a['as'],'attributes':_0x34269a[_0x507f('0x22')],'include':_0x34269a[_0x507f('0x23')]?_[_0x507f('0x25')](_0x34269a[_0x507f('0x23')],function(_0x534ea2){return{'model':db[_0x534ea2[_0x507f('0x24')]],'as':_0x534ea2['as'],'attributes':_0x534ea2[_0x507f('0x22')]};}):[]};}):[]};}):[]:[]})[_0x507f('0x26')](function(_0x5d03a6){logger[_0x507f('0x19')](_0x507f('0x1c'),_0x521884);logger[_0x507f('0x13')](_0x507f('0x1c'),_0x521884,JSON[_0x507f('0x14')](_0x5d03a6));_0x167d0c(_0x5d03a6);})[_0x507f('0x1b')](function(_0x1b88ed){logger[_0x507f('0x16')](_0x507f('0x1c'),_0x1b88ed[_0x507f('0x18')],_0x521884);_0x59d1fe(_0xf4190a[_0x507f('0x16')](0x1f4,_0x1b88ed[_0x507f('0x18')]));});});}; \ No newline at end of file +var _0x1305=['info','WhatsappAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','find','options','raw','where','attributes','include','model','map','ShowWhatsappAccount','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1305,0x172));var _0x5130=function(_0x4d5409,_0x47fde8){_0x4d5409=_0x4d5409-0x0;var _0x14e175=_0x1305[_0x4d5409];return _0x14e175;};'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(_0x5130('0x8'))('rpc');var config=require(_0x5130('0x9'));var jayson=require(_0x5130('0xa'));var client=jayson[_0x5130('0xb')]['http']({'port':0x232a});config[_0x5130('0xc')]=_[_0x5130('0xd')](config['redis'],{'host':_0x5130('0xe'),'port':0x18eb});var socket=require(_0x5130('0xf'))(new Redis(config[_0x5130('0xc')]));require(_0x5130('0x10'))[_0x5130('0x11')](socket);function respondWithRpcPromise(_0x4c402c,_0x165e2c,_0x462f3){return new BPromise(function(_0xba8a9e,_0x3950cf){return client[_0x5130('0x12')](_0x4c402c,_0x462f3)[_0x5130('0x13')](function(_0x28dde7){logger[_0x5130('0x14')](_0x5130('0x15'),_0x165e2c,'request\x20sent');logger[_0x5130('0x16')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x165e2c,_0x5130('0x17'),JSON[_0x5130('0x18')](_0x28dde7));if(_0x28dde7[_0x5130('0x19')]){if(_0x28dde7[_0x5130('0x19')][_0x5130('0x1a')]===0x1f4){logger[_0x5130('0x19')](_0x5130('0x15'),_0x165e2c,_0x28dde7[_0x5130('0x19')][_0x5130('0x1b')]);return _0x3950cf(_0x28dde7[_0x5130('0x19')]['message']);}logger[_0x5130('0x19')]('WhatsappAccount,\x20%s,\x20%s',_0x165e2c,_0x28dde7['error'][_0x5130('0x1b')]);return _0xba8a9e(_0x28dde7[_0x5130('0x19')][_0x5130('0x1b')]);}else{logger[_0x5130('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x165e2c,_0x5130('0x17'));_0xba8a9e(_0x28dde7[_0x5130('0x1c')][_0x5130('0x1b')]);}})['catch'](function(_0x227ede){logger[_0x5130('0x19')]('WhatsappAccount,\x20%s,\x20%s',_0x165e2c,_0x227ede);_0x3950cf(_0x227ede);});});}exports['ShowWhatsappAccount']=function(_0x1959be){var _0x48ae56=this;return new Promise(function(_0x41cb81,_0x3e8568){return db['WhatsappAccount'][_0x5130('0x1d')]({'raw':_0x1959be[_0x5130('0x1e')]?_0x1959be[_0x5130('0x1e')][_0x5130('0x1f')]===undefined?!![]:![]:!![],'where':_0x1959be[_0x5130('0x1e')]?_0x1959be[_0x5130('0x1e')][_0x5130('0x20')]||null:null,'attributes':_0x1959be['options']?_0x1959be['options'][_0x5130('0x21')]||null:null,'include':_0x1959be[_0x5130('0x1e')]?_0x1959be[_0x5130('0x1e')][_0x5130('0x22')]?_['map'](_0x1959be['options'][_0x5130('0x22')],function(_0x57c4a8){return{'model':db[_0x57c4a8[_0x5130('0x23')]],'as':_0x57c4a8['as'],'attributes':_0x57c4a8[_0x5130('0x21')],'include':_0x57c4a8[_0x5130('0x22')]?_[_0x5130('0x24')](_0x57c4a8['include'],function(_0x33c121){return{'model':db[_0x33c121[_0x5130('0x23')]],'as':_0x33c121['as'],'attributes':_0x33c121[_0x5130('0x21')],'include':_0x33c121['include']?_[_0x5130('0x24')](_0x33c121[_0x5130('0x22')],function(_0x39e539){return{'model':db[_0x39e539[_0x5130('0x23')]],'as':_0x39e539['as'],'attributes':_0x39e539[_0x5130('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e76a9){logger['info'](_0x5130('0x25'),_0x1959be);logger[_0x5130('0x16')](_0x5130('0x25'),_0x1959be,JSON[_0x5130('0x18')](_0x3e76a9));_0x41cb81(_0x3e76a9);})[_0x5130('0x26')](function(_0x410942){logger[_0x5130('0x19')](_0x5130('0x25'),_0x410942[_0x5130('0x1b')],_0x1959be);_0x3e8568(_0x48ae56[_0x5130('0x19')](0x1f4,_0x410942[_0x5130('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 7a44651..b64aaa5 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 _0x55c2=['./whatsappAccount.events','save','remove','update','emit','removeListener','register','length','whatsappAccount:'];(function(_0x16ec00,_0x31bdf2){var _0x34e783=function(_0x2e49b2){while(--_0x2e49b2){_0x16ec00['push'](_0x16ec00['shift']());}};_0x34e783(++_0x31bdf2);}(_0x55c2,0x129));var _0x255c=function(_0x39c4b6,_0x394a3b){_0x39c4b6=_0x39c4b6-0x0;var _0x2562ba=_0x55c2[_0x39c4b6];return _0x2562ba;};'use strict';var WhatsappAccountEvents=require(_0x255c('0x0'));var events=[_0x255c('0x1'),_0x255c('0x2'),_0x255c('0x3')];function createListener(_0x249c78,_0x3f8e9a){return function(_0x468740){_0x3f8e9a[_0x255c('0x4')](_0x249c78,_0x468740);};}function removeListener(_0x472852,_0x186096){return function(){WhatsappAccountEvents[_0x255c('0x5')](_0x472852,_0x186096);};}exports[_0x255c('0x6')]=function(_0x41089b){for(var _0x350b48=0x0,_0x5000b6=events[_0x255c('0x7')];_0x350b48<_0x5000b6;_0x350b48++){var _0x16327f=events[_0x350b48];var _0x531dc5=createListener(_0x255c('0x8')+_0x16327f,_0x41089b);WhatsappAccountEvents['on'](_0x16327f,_0x531dc5);}}; \ No newline at end of file +var _0xc837=['register','whatsappAccount:','./whatsappAccount.events','save','remove','emit'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xc837,0xa4));var _0x7c83=function(_0x104297,_0x45200f){_0x104297=_0x104297-0x0;var _0x194246=_0xc837[_0x104297];return _0x194246;};'use strict';var WhatsappAccountEvents=require(_0x7c83('0x0'));var events=[_0x7c83('0x1'),_0x7c83('0x2'),'update'];function createListener(_0x587af2,_0x337a62){return function(_0x1e17b7){_0x337a62[_0x7c83('0x3')](_0x587af2,_0x1e17b7);};}function removeListener(_0x32fc84,_0xc0a76a){return function(){WhatsappAccountEvents['removeListener'](_0x32fc84,_0xc0a76a);};}exports[_0x7c83('0x4')]=function(_0xda4488){for(var _0x1d3133=0x0,_0x5033d3=events['length'];_0x1d3133<_0x5033d3;_0x1d3133++){var _0x23f477=events[_0x1d3133];var _0x381a29=createListener(_0x7c83('0x5')+_0x23f477,_0xda4488);WhatsappAccountEvents['on'](_0x23f477,_0x381a29);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index fb6b081..f5da596 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 _0x513b=['create','put','update','delete','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post'];(function(_0x130578,_0x593b0e){var _0x4eaae3=function(_0x1a6cfb){while(--_0x1a6cfb){_0x130578['push'](_0x130578['shift']());}};_0x4eaae3(++_0x593b0e);}(_0x513b,0x1e1));var _0xb513=function(_0x28e7fb,_0x5f4ef3){_0x28e7fb=_0x28e7fb-0x0;var _0x1865ea=_0x513b[_0x28e7fb];return _0x1865ea;};'use strict';var multer=require('multer');var util=require(_0xb513('0x0'));var path=require(_0xb513('0x1'));var timeout=require('connect-timeout');var express=require(_0xb513('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb513('0x3'));var interaction=require(_0xb513('0x4'));var config=require(_0xb513('0x5'));var controller=require('./whatsappApplication.controller');router[_0xb513('0x6')]('/',auth[_0xb513('0x7')](),controller[_0xb513('0x8')]);router[_0xb513('0x6')](_0xb513('0x9'),auth[_0xb513('0x7')](),controller[_0xb513('0xa')]);router[_0xb513('0xb')]('/',auth[_0xb513('0x7')](),controller[_0xb513('0xc')]);router[_0xb513('0xd')](_0xb513('0x9'),auth[_0xb513('0x7')](),controller[_0xb513('0xe')]);router[_0xb513('0xf')](_0xb513('0x9'),auth[_0xb513('0x7')](),controller['destroy']);module[_0xb513('0x10')]=router; \ No newline at end of file +var _0xbb35=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x310ad9,_0x3e1e8b){var _0x22fc69=function(_0x254949){while(--_0x254949){_0x310ad9['push'](_0x310ad9['shift']());}};_0x22fc69(++_0x3e1e8b);}(_0xbb35,0x11e));var _0x5bb3=function(_0x5cdade,_0x51e89c){_0x5cdade=_0x5cdade-0x0;var _0x41da1c=_0xbb35[_0x5cdade];return _0x41da1c;};'use strict';var multer=require(_0x5bb3('0x0'));var util=require(_0x5bb3('0x1'));var path=require(_0x5bb3('0x2'));var timeout=require(_0x5bb3('0x3'));var express=require(_0x5bb3('0x4'));var router=express['Router']();var fs_extra=require(_0x5bb3('0x5'));var auth=require(_0x5bb3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5bb3('0x7'));var controller=require('./whatsappApplication.controller');router[_0x5bb3('0x8')]('/',auth[_0x5bb3('0x9')](),controller['index']);router[_0x5bb3('0x8')](_0x5bb3('0xa'),auth[_0x5bb3('0x9')](),controller['show']);router[_0x5bb3('0xb')]('/',auth[_0x5bb3('0x9')](),controller[_0x5bb3('0xc')]);router[_0x5bb3('0xd')](_0x5bb3('0xa'),auth[_0x5bb3('0x9')](),controller[_0x5bb3('0xe')]);router[_0x5bb3('0xf')](_0x5bb3('0xa'),auth[_0x5bb3('0x9')](),controller[_0x5bb3('0x10')]);module[_0x5bb3('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 8a248e1..4f08f7b 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 _0x31a9=['TEXT','STRING','*,*,*,*','exports','INTEGER','noop'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x31a9,0x16b));var _0x931a=function(_0x2c87dc,_0x139292){_0x2c87dc=_0x2c87dc-0x0;var _0x2b78ec=_0x31a9[_0x2c87dc];return _0x2b78ec;};'use strict';var Sequelize=require('sequelize');module[_0x931a('0x0')]={'priority':{'type':Sequelize[_0x931a('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x931a('0x2')},'appdata':{'type':Sequelize[_0x931a('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x931a('0x4')],'defaultValue':_0x931a('0x5')}}; \ No newline at end of file +var _0x7887=['sequelize','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x1b0eb6,_0x2bc619){var _0x62a560=function(_0x1af811){while(--_0x1af811){_0x1b0eb6['push'](_0x1b0eb6['shift']());}};_0x62a560(++_0x2bc619);}(_0x7887,0x91));var _0x7788=function(_0xc58a29,_0x384afa){_0xc58a29=_0xc58a29-0x0;var _0x2f8cf3=_0x7887[_0xc58a29];return _0x2f8cf3;};'use strict';var Sequelize=require(_0x7788('0x0'));module['exports']={'priority':{'type':Sequelize[_0x7788('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x7788('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7788('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7788('0x2')],'defaultValue':_0x7788('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 709cc77..fa39b22 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 _0x50d1=['map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','includeAll','WhatsappApplication','rows','catch','show','params','keys','fields','include','options','find','create','update','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','destroy','then','name','send'];(function(_0x456465,_0x477fc1){var _0x282d42=function(_0x42cb83){while(--_0x42cb83){_0x456465['push'](_0x456465['shift']());}};_0x282d42(++_0x477fc1);}(_0x50d1,0xf3));var _0x150d=function(_0xb31c7d,_0x3bcfa6){_0xb31c7d=_0xb31c7d-0x0;var _0x2f8964=_0x50d1[_0xb31c7d];return _0x2f8964;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x150d('0x0'));var rimraf=require(_0x150d('0x1'));var zipdir=require(_0x150d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x150d('0x3'));var moment=require(_0x150d('0x4'));var BPromise=require(_0x150d('0x5'));var Mustache=require(_0x150d('0x6'));var util=require(_0x150d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x150d('0x8'));var ejs=require(_0x150d('0x9'));var fs=require('fs');var fs_extra=require(_0x150d('0xa'));var _=require(_0x150d('0xb'));var squel=require(_0x150d('0xc'));var crypto=require(_0x150d('0xd'));var jsforce=require(_0x150d('0xe'));var deskjs=require(_0x150d('0xf'));var toCsv=require(_0x150d('0x8'));var querystring=require(_0x150d('0x10'));var Papa=require('papaparse');var Redis=require(_0x150d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x150d('0x12'));var as=require(_0x150d('0x13'));var hardwareService=require(_0x150d('0x14'));var logger=require(_0x150d('0x15'))(_0x150d('0x16'));var utils=require(_0x150d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x150d('0x18'));var db=require(_0x150d('0x19'))['db'];function respondWithStatusCode(_0x46a06b,_0x22092a){_0x22092a=_0x22092a||0xcc;return function(_0x46ff7f){if(_0x46ff7f){return _0x46a06b[_0x150d('0x1a')](_0x22092a);}return _0x46a06b['status'](_0x22092a)[_0x150d('0x1b')]();};}function respondWithResult(_0x297b1c,_0x19a5cb){_0x19a5cb=_0x19a5cb||0xc8;return function(_0x51039f){if(_0x51039f){return _0x297b1c[_0x150d('0x1c')](_0x19a5cb)[_0x150d('0x1d')](_0x51039f);}};}function respondWithFilteredResult(_0x2cd267,_0x5888f2){return function(_0x306522){if(_0x306522){var _0x22debf=_0x306522[_0x150d('0x1e')],_0x36d0c7=_0x5888f2[_0x150d('0x1f')],_0x3e7ac0=_0x5888f2[_0x150d('0x1f')]+_0x5888f2[_0x150d('0x20')],_0x2a36df;if(_0x3e7ac0>=_0x22debf){_0x3e7ac0=_0x22debf;_0x2a36df=0xc8;}else{_0x2a36df=0xce;}_0x2cd267['status'](_0x2a36df);return _0x2cd267[_0x150d('0x21')]('Content-Range',_0x36d0c7+'-'+_0x3e7ac0+'/'+_0x22debf)[_0x150d('0x1d')](_0x306522);}return null;};}function patchUpdates(_0x251f04){return function(_0x1e4266){try{jsonpatch[_0x150d('0x22')](_0x1e4266,_0x251f04,!![]);}catch(_0x5351f9){return BPromise[_0x150d('0x23')](_0x5351f9);}return _0x1e4266[_0x150d('0x24')]();};}function saveUpdates(_0x293e2a,_0x49ea83){return function(_0x3a01da){if(_0x3a01da){return _0x3a01da['update'](_0x293e2a)['then'](function(_0x4524bf){return _0x4524bf;});}return null;};}function removeEntity(_0x2b20f1,_0x31d188){return function(_0x2e0d3a){if(_0x2e0d3a){return _0x2e0d3a[_0x150d('0x25')]()[_0x150d('0x26')](function(){_0x2b20f1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28bdf6,_0x2276d4){return function(_0x50dfce){if(!_0x50dfce){_0x28bdf6[_0x150d('0x1a')](0x194);}return _0x50dfce;};}function handleError(_0x119382,_0xd647f4){_0xd647f4=_0xd647f4||0x1f4;return function(_0x415713){logger['error'](_0x415713['stack']);if(_0x415713['name']){delete _0x415713[_0x150d('0x27')];}_0x119382[_0x150d('0x1c')](_0xd647f4)[_0x150d('0x28')](_0x415713);};}exports['index']=function(_0x223951,_0x5bbc9f){var _0x59b466={},_0x3451d5={},_0x501947={'count':0x0,'rows':[]};var _0x565cdd=_[_0x150d('0x29')](db['WhatsappApplication'][_0x150d('0x2a')],function(_0x4927ab){return{'name':_0x4927ab[_0x150d('0x2b')],'type':_0x4927ab[_0x150d('0x2c')]['key']};});_0x3451d5[_0x150d('0x2d')]=_['map'](_0x565cdd,'name');_0x3451d5[_0x150d('0x2e')]=_['keys'](_0x223951[_0x150d('0x2e')]);_0x3451d5[_0x150d('0x2f')]=_[_0x150d('0x30')](_0x3451d5[_0x150d('0x2d')],_0x3451d5[_0x150d('0x2e')]);_0x59b466[_0x150d('0x31')]=_[_0x150d('0x30')](_0x3451d5[_0x150d('0x2d')],qs['fields'](_0x223951['query']['fields']));_0x59b466[_0x150d('0x31')]=_0x59b466[_0x150d('0x31')]['length']?_0x59b466[_0x150d('0x31')]:_0x3451d5[_0x150d('0x2d')];if(!_0x223951['query'][_0x150d('0x32')](_0x150d('0x33'))){_0x59b466['limit']=qs[_0x150d('0x20')](_0x223951[_0x150d('0x2e')][_0x150d('0x20')]);_0x59b466[_0x150d('0x1f')]=qs[_0x150d('0x1f')](_0x223951[_0x150d('0x2e')][_0x150d('0x1f')]);}_0x59b466[_0x150d('0x34')]=qs[_0x150d('0x35')](_0x223951[_0x150d('0x2e')]['sort']);_0x59b466[_0x150d('0x36')]=qs['filters'](_[_0x150d('0x37')](_0x223951[_0x150d('0x2e')],_0x3451d5[_0x150d('0x2f')]),_0x565cdd);if(_0x223951[_0x150d('0x2e')]['filter']){_0x59b466['where']=_[_0x150d('0x38')](_0x59b466['where'],{'$or':_[_0x150d('0x29')](_0x565cdd,function(_0x1ad5d9){if(_0x1ad5d9[_0x150d('0x2c')]!=='VIRTUAL'){var _0x44e2ed={};_0x44e2ed[_0x1ad5d9[_0x150d('0x27')]]={'$like':'%'+_0x223951['query']['filter']+'%'};return _0x44e2ed;}})});}_0x59b466=_[_0x150d('0x38')]({},_0x59b466,_0x223951['options']);var _0x47816d={'where':_0x59b466[_0x150d('0x36')]};return db['WhatsappApplication'][_0x150d('0x1e')](_0x47816d)[_0x150d('0x26')](function(_0x4ff6b8){_0x501947[_0x150d('0x1e')]=_0x4ff6b8;if(_0x223951['query'][_0x150d('0x39')]){_0x59b466['include']=[{'all':!![]}];}return db[_0x150d('0x3a')]['findAll'](_0x59b466);})[_0x150d('0x26')](function(_0x243d8a){_0x501947[_0x150d('0x3b')]=_0x243d8a;return _0x501947;})[_0x150d('0x26')](respondWithFilteredResult(_0x5bbc9f,_0x59b466))[_0x150d('0x3c')](handleError(_0x5bbc9f,null));};exports[_0x150d('0x3d')]=function(_0x32c70d,_0x13804d){var _0x139219={'raw':!![],'where':{'id':_0x32c70d[_0x150d('0x3e')]['id']}},_0x560b51={};_0x560b51[_0x150d('0x2d')]=_[_0x150d('0x3f')](db[_0x150d('0x3a')][_0x150d('0x2a')]);_0x560b51[_0x150d('0x2e')]=_[_0x150d('0x3f')](_0x32c70d['query']);_0x560b51[_0x150d('0x2f')]=_[_0x150d('0x30')](_0x560b51[_0x150d('0x2d')],_0x560b51['query']);_0x139219[_0x150d('0x31')]=_[_0x150d('0x30')](_0x560b51['model'],qs[_0x150d('0x40')](_0x32c70d['query'][_0x150d('0x40')]));_0x139219[_0x150d('0x31')]=_0x139219[_0x150d('0x31')]['length']?_0x139219[_0x150d('0x31')]:_0x560b51[_0x150d('0x2d')];if(_0x32c70d[_0x150d('0x2e')][_0x150d('0x39')]){_0x139219[_0x150d('0x41')]=[{'all':!![]}];}_0x139219=_[_0x150d('0x38')]({},_0x139219,_0x32c70d[_0x150d('0x42')]);return db[_0x150d('0x3a')][_0x150d('0x43')](_0x139219)[_0x150d('0x26')](handleEntityNotFound(_0x13804d,null))['then'](respondWithResult(_0x13804d,null))[_0x150d('0x3c')](handleError(_0x13804d,null));};exports['create']=function(_0x546694,_0x15fb01){return db[_0x150d('0x3a')][_0x150d('0x44')](_0x546694['body'],{})[_0x150d('0x26')](respondWithResult(_0x15fb01,0xc9))[_0x150d('0x3c')](handleError(_0x15fb01,null));};exports[_0x150d('0x45')]=function(_0x43f1f4,_0x2633f6){if(_0x43f1f4[_0x150d('0x46')]['id']){delete _0x43f1f4['body']['id'];}return db[_0x150d('0x3a')]['find']({'where':{'id':_0x43f1f4[_0x150d('0x3e')]['id']}})[_0x150d('0x26')](handleEntityNotFound(_0x2633f6,null))['then'](saveUpdates(_0x43f1f4[_0x150d('0x46')],null))[_0x150d('0x26')](respondWithResult(_0x2633f6,null))[_0x150d('0x3c')](handleError(_0x2633f6,null));};exports[_0x150d('0x25')]=function(_0x20b22e,_0x175187){return db['WhatsappApplication'][_0x150d('0x43')]({'where':{'id':_0x20b22e[_0x150d('0x3e')]['id']}})[_0x150d('0x26')](handleEntityNotFound(_0x175187,null))[_0x150d('0x26')](removeEntity(_0x175187,null))[_0x150d('0x3c')](handleError(_0x175187,null));}; \ No newline at end of file +var _0x9e68=['request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','merge','VIRTUAL','options','WhatsappApplication','includeAll','findAll','rows','catch','show','params','filters','include','find','create','body','zip-dir','fast-json-patch'];(function(_0x2cb373,_0x187773){var _0x4e8335=function(_0x226eea){while(--_0x226eea){_0x2cb373['push'](_0x2cb373['shift']());}};_0x4e8335(++_0x187773);}(_0x9e68,0x16b));var _0x89e6=function(_0x2e1c23,_0x8ae59e){_0x2e1c23=_0x2e1c23-0x0;var _0x30a785=_0x9e68[_0x2e1c23];return _0x30a785;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x89e6('0x0'));var jsonpatch=require(_0x89e6('0x1'));var rp=require(_0x89e6('0x2'));var moment=require(_0x89e6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x89e6('0x4'));var util=require('util');var path=require(_0x89e6('0x5'));var sox=require(_0x89e6('0x6'));var csv=require(_0x89e6('0x7'));var ejs=require(_0x89e6('0x8'));var fs=require('fs');var fs_extra=require(_0x89e6('0x9'));var _=require(_0x89e6('0xa'));var squel=require(_0x89e6('0xb'));var crypto=require('crypto');var jsforce=require(_0x89e6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x89e6('0x7'));var querystring=require(_0x89e6('0xd'));var Papa=require(_0x89e6('0xe'));var Redis=require(_0x89e6('0xf'));var authService=require(_0x89e6('0x10'));var qs=require(_0x89e6('0x11'));var as=require(_0x89e6('0x12'));var hardwareService=require(_0x89e6('0x13'));var logger=require('../../config/logger')(_0x89e6('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x89e6('0x15'));var db=require(_0x89e6('0x16'))['db'];function respondWithStatusCode(_0xc1ab28,_0x556b60){_0x556b60=_0x556b60||0xcc;return function(_0x29173b){if(_0x29173b){return _0xc1ab28[_0x89e6('0x17')](_0x556b60);}return _0xc1ab28[_0x89e6('0x18')](_0x556b60)[_0x89e6('0x19')]();};}function respondWithResult(_0x4e1fe7,_0xc14aea){_0xc14aea=_0xc14aea||0xc8;return function(_0x495a9c){if(_0x495a9c){return _0x4e1fe7[_0x89e6('0x18')](_0xc14aea)[_0x89e6('0x1a')](_0x495a9c);}};}function respondWithFilteredResult(_0x425c2d,_0x4438a0){return function(_0xe2b76e){if(_0xe2b76e){var _0x4f6880=_0xe2b76e[_0x89e6('0x1b')],_0x1d5848=_0x4438a0[_0x89e6('0x1c')],_0x32d8e2=_0x4438a0['offset']+_0x4438a0[_0x89e6('0x1d')],_0x11714b;if(_0x32d8e2>=_0x4f6880){_0x32d8e2=_0x4f6880;_0x11714b=0xc8;}else{_0x11714b=0xce;}_0x425c2d['status'](_0x11714b);return _0x425c2d[_0x89e6('0x1e')](_0x89e6('0x1f'),_0x1d5848+'-'+_0x32d8e2+'/'+_0x4f6880)['json'](_0xe2b76e);}return null;};}function patchUpdates(_0x246d20){return function(_0x4f4dca){try{jsonpatch[_0x89e6('0x20')](_0x4f4dca,_0x246d20,!![]);}catch(_0x3c5834){return BPromise[_0x89e6('0x21')](_0x3c5834);}return _0x4f4dca[_0x89e6('0x22')]();};}function saveUpdates(_0x3d6f27,_0x442a45){return function(_0x55d4ad){if(_0x55d4ad){return _0x55d4ad[_0x89e6('0x23')](_0x3d6f27)[_0x89e6('0x24')](function(_0x123c4d){return _0x123c4d;});}return null;};}function removeEntity(_0x2fe574,_0x4b275b){return function(_0x42df01){if(_0x42df01){return _0x42df01[_0x89e6('0x25')]()[_0x89e6('0x24')](function(){_0x2fe574[_0x89e6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1deb92,_0x13b7e8){return function(_0x38fc44){if(!_0x38fc44){_0x1deb92['sendStatus'](0x194);}return _0x38fc44;};}function handleError(_0x2b99d8,_0x13268f){_0x13268f=_0x13268f||0x1f4;return function(_0x587ed5){logger[_0x89e6('0x26')](_0x587ed5[_0x89e6('0x27')]);if(_0x587ed5[_0x89e6('0x28')]){delete _0x587ed5['name'];}_0x2b99d8[_0x89e6('0x18')](_0x13268f)['send'](_0x587ed5);};}exports[_0x89e6('0x29')]=function(_0x319320,_0x395c5b){var _0x3456d={},_0x5cac2c={},_0x20286c={'count':0x0,'rows':[]};var _0x44c423=_[_0x89e6('0x2a')](db['WhatsappApplication'][_0x89e6('0x2b')],function(_0x1ba943){return{'name':_0x1ba943[_0x89e6('0x2c')],'type':_0x1ba943[_0x89e6('0x2d')][_0x89e6('0x2e')]};});_0x5cac2c[_0x89e6('0x2f')]=_['map'](_0x44c423,_0x89e6('0x28'));_0x5cac2c[_0x89e6('0x30')]=_[_0x89e6('0x31')](_0x319320[_0x89e6('0x30')]);_0x5cac2c['filters']=_['intersection'](_0x5cac2c[_0x89e6('0x2f')],_0x5cac2c[_0x89e6('0x30')]);_0x3456d[_0x89e6('0x32')]=_[_0x89e6('0x33')](_0x5cac2c['model'],qs[_0x89e6('0x34')](_0x319320[_0x89e6('0x30')][_0x89e6('0x34')]));_0x3456d[_0x89e6('0x32')]=_0x3456d[_0x89e6('0x32')][_0x89e6('0x35')]?_0x3456d[_0x89e6('0x32')]:_0x5cac2c['model'];if(!_0x319320[_0x89e6('0x30')]['hasOwnProperty'](_0x89e6('0x36'))){_0x3456d[_0x89e6('0x1d')]=qs[_0x89e6('0x1d')](_0x319320[_0x89e6('0x30')]['limit']);_0x3456d['offset']=qs[_0x89e6('0x1c')](_0x319320[_0x89e6('0x30')]['offset']);}_0x3456d[_0x89e6('0x37')]=qs[_0x89e6('0x38')](_0x319320['query'][_0x89e6('0x38')]);_0x3456d[_0x89e6('0x39')]=qs['filters'](_['pick'](_0x319320['query'],_0x5cac2c['filters']),_0x44c423);if(_0x319320[_0x89e6('0x30')]['filter']){_0x3456d[_0x89e6('0x39')]=_[_0x89e6('0x3a')](_0x3456d[_0x89e6('0x39')],{'$or':_[_0x89e6('0x2a')](_0x44c423,function(_0x3aaa13){if(_0x3aaa13[_0x89e6('0x2d')]!==_0x89e6('0x3b')){var _0x1e2f8f={};_0x1e2f8f[_0x3aaa13['name']]={'$like':'%'+_0x319320[_0x89e6('0x30')]['filter']+'%'};return _0x1e2f8f;}})});}_0x3456d=_[_0x89e6('0x3a')]({},_0x3456d,_0x319320[_0x89e6('0x3c')]);var _0x468582={'where':_0x3456d[_0x89e6('0x39')]};return db[_0x89e6('0x3d')][_0x89e6('0x1b')](_0x468582)[_0x89e6('0x24')](function(_0x3b9250){_0x20286c[_0x89e6('0x1b')]=_0x3b9250;if(_0x319320[_0x89e6('0x30')][_0x89e6('0x3e')]){_0x3456d['include']=[{'all':!![]}];}return db[_0x89e6('0x3d')][_0x89e6('0x3f')](_0x3456d);})[_0x89e6('0x24')](function(_0x5a29be){_0x20286c[_0x89e6('0x40')]=_0x5a29be;return _0x20286c;})[_0x89e6('0x24')](respondWithFilteredResult(_0x395c5b,_0x3456d))[_0x89e6('0x41')](handleError(_0x395c5b,null));};exports[_0x89e6('0x42')]=function(_0x44b9ef,_0x7c7bbf){var _0x23e0ef={'raw':!![],'where':{'id':_0x44b9ef[_0x89e6('0x43')]['id']}},_0x42dd38={};_0x42dd38[_0x89e6('0x2f')]=_[_0x89e6('0x31')](db[_0x89e6('0x3d')][_0x89e6('0x2b')]);_0x42dd38[_0x89e6('0x30')]=_['keys'](_0x44b9ef[_0x89e6('0x30')]);_0x42dd38[_0x89e6('0x44')]=_[_0x89e6('0x33')](_0x42dd38[_0x89e6('0x2f')],_0x42dd38[_0x89e6('0x30')]);_0x23e0ef[_0x89e6('0x32')]=_[_0x89e6('0x33')](_0x42dd38[_0x89e6('0x2f')],qs[_0x89e6('0x34')](_0x44b9ef[_0x89e6('0x30')][_0x89e6('0x34')]));_0x23e0ef['attributes']=_0x23e0ef[_0x89e6('0x32')][_0x89e6('0x35')]?_0x23e0ef[_0x89e6('0x32')]:_0x42dd38['model'];if(_0x44b9ef[_0x89e6('0x30')][_0x89e6('0x3e')]){_0x23e0ef[_0x89e6('0x45')]=[{'all':!![]}];}_0x23e0ef=_[_0x89e6('0x3a')]({},_0x23e0ef,_0x44b9ef['options']);return db[_0x89e6('0x3d')][_0x89e6('0x46')](_0x23e0ef)[_0x89e6('0x24')](handleEntityNotFound(_0x7c7bbf,null))[_0x89e6('0x24')](respondWithResult(_0x7c7bbf,null))[_0x89e6('0x41')](handleError(_0x7c7bbf,null));};exports[_0x89e6('0x47')]=function(_0x15c228,_0x339479){return db[_0x89e6('0x3d')]['create'](_0x15c228[_0x89e6('0x48')],{})['then'](respondWithResult(_0x339479,0xc9))[_0x89e6('0x41')](handleError(_0x339479,null));};exports['update']=function(_0x32d634,_0x24f982){if(_0x32d634[_0x89e6('0x48')]['id']){delete _0x32d634['body']['id'];}return db[_0x89e6('0x3d')][_0x89e6('0x46')]({'where':{'id':_0x32d634[_0x89e6('0x43')]['id']}})[_0x89e6('0x24')](handleEntityNotFound(_0x24f982,null))[_0x89e6('0x24')](saveUpdates(_0x32d634[_0x89e6('0x48')],null))['then'](respondWithResult(_0x24f982,null))[_0x89e6('0x41')](handleError(_0x24f982,null));};exports[_0x89e6('0x25')]=function(_0x5c0f66,_0x30461e){return db[_0x89e6('0x3d')]['find']({'where':{'id':_0x5c0f66[_0x89e6('0x43')]['id']}})[_0x89e6('0x24')](handleEntityNotFound(_0x30461e,null))[_0x89e6('0x24')](removeEntity(_0x30461e,null))[_0x89e6('0x41')](handleError(_0x30461e,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index a5be833..f8a6085 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 _0x81d5=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','WhatsappApplication','whatsapp_applications','utf8mb4'];(function(_0x282961,_0x6142c5){var _0x33b900=function(_0x47d1e7){while(--_0x47d1e7){_0x282961['push'](_0x282961['shift']());}};_0x33b900(++_0x6142c5);}(_0x81d5,0x177));var _0x581d=function(_0x3d481f,_0x11ae23){_0x3d481f=_0x3d481f-0x0;var _0x232faf=_0x81d5[_0x3d481f];return _0x232faf;};'use strict';var _=require(_0x581d('0x0'));var util=require(_0x581d('0x1'));var logger=require(_0x581d('0x2'))(_0x581d('0x3'));var moment=require(_0x581d('0x4'));var BPromise=require(_0x581d('0x5'));var rp=require(_0x581d('0x6'));var fs=require('fs');var path=require(_0x581d('0x7'));var rimraf=require(_0x581d('0x8'));var config=require(_0x581d('0x9'));var attributes=require(_0x581d('0xa'));module[_0x581d('0xb')]=function(_0xee3431,_0x551e5c){return _0xee3431['define'](_0x581d('0xc'),attributes,{'tableName':_0x581d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x581d('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2bd1=['request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird'];(function(_0x44039a,_0x2ac8a8){var _0x525de5=function(_0x1dc635){while(--_0x1dc635){_0x44039a['push'](_0x44039a['shift']());}};_0x525de5(++_0x2ac8a8);}(_0x2bd1,0x136));var _0x12bd=function(_0x4bb396,_0x4113c9){_0x4bb396=_0x4bb396-0x0;var _0x4003af=_0x2bd1[_0x4bb396];return _0x4003af;};'use strict';var _=require(_0x12bd('0x0'));var util=require('util');var logger=require(_0x12bd('0x1'))(_0x12bd('0x2'));var moment=require(_0x12bd('0x3'));var BPromise=require(_0x12bd('0x4'));var rp=require(_0x12bd('0x5'));var fs=require('fs');var path=require(_0x12bd('0x6'));var rimraf=require(_0x12bd('0x7'));var config=require(_0x12bd('0x8'));var attributes=require(_0x12bd('0x9'));module[_0x12bd('0xa')]=function(_0x29072d,_0x695b9){return _0x29072d[_0x12bd('0xb')](_0x12bd('0xc'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x12bd('0xd'),'collate':_0x12bd('0xe')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 91ce7c2..ac1f261 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 _0x6333=['../../config/environment','jayson/promise','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','message','result','catch','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x1b68ff,_0x5e68a2){var _0x4b3b07=function(_0x465dd9){while(--_0x465dd9){_0x1b68ff['push'](_0x1b68ff['shift']());}};_0x4b3b07(++_0x5e68a2);}(_0x6333,0x83));var _0x3633=function(_0x3b05a2,_0x4833c5){_0x3b05a2=_0x3b05a2-0x0;var _0x309051=_0x6333[_0x3b05a2];return _0x309051;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3633('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3633('0x1'));var db=require(_0x3633('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x3633('0x3'))('rpc');var config=require(_0x3633('0x4'));var jayson=require(_0x3633('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x23c014,_0x1c4c20,_0x272da5){return new BPromise(function(_0x5c35ba,_0x5b5055){return client[_0x3633('0x6')](_0x23c014,_0x272da5)['then'](function(_0x4ee8e3){logger[_0x3633('0x7')](_0x3633('0x8'),_0x1c4c20,_0x3633('0x9'));logger['debug'](_0x3633('0xa'),_0x1c4c20,_0x3633('0x9'),JSON['stringify'](_0x4ee8e3));if(_0x4ee8e3['error']){if(_0x4ee8e3[_0x3633('0xb')]['code']===0x1f4){logger['error'](_0x3633('0x8'),_0x1c4c20,_0x4ee8e3[_0x3633('0xb')][_0x3633('0xc')]);return _0x5b5055(_0x4ee8e3[_0x3633('0xb')][_0x3633('0xc')]);}logger['error'](_0x3633('0x8'),_0x1c4c20,_0x4ee8e3[_0x3633('0xb')][_0x3633('0xc')]);return _0x5c35ba(_0x4ee8e3[_0x3633('0xb')]['message']);}else{logger['info'](_0x3633('0x8'),_0x1c4c20,_0x3633('0x9'));_0x5c35ba(_0x4ee8e3[_0x3633('0xd')][_0x3633('0xc')]);}})[_0x3633('0xe')](function(_0x3b0fd7){logger['error'](_0x3633('0x8'),_0x1c4c20,_0x3b0fd7);_0x5b5055(_0x3b0fd7);});});} \ No newline at end of file +var _0x7c49=['randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x420123,_0x11f9c3){var _0x1948e4=function(_0x2c5d01){while(--_0x2c5d01){_0x420123['push'](_0x420123['shift']());}};_0x1948e4(++_0x11f9c3);}(_0x7c49,0x141));var _0x97c4=function(_0x1e832e,_0x513d0a){_0x1e832e=_0x1e832e-0x0;var _0x2da441=_0x7c49[_0x1e832e];return _0x2da441;};'use strict';var _=require(_0x97c4('0x0'));var util=require(_0x97c4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x97c4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x97c4('0x3'))['db'];var utils=require(_0x97c4('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x97c4('0x5'));var jayson=require(_0x97c4('0x6'));var client=jayson[_0x97c4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x249c86,_0x165334,_0x585222){return new BPromise(function(_0x373855,_0x339817){return client[_0x97c4('0x8')](_0x249c86,_0x585222)[_0x97c4('0x9')](function(_0x12e98d){logger[_0x97c4('0xa')](_0x97c4('0xb'),_0x165334,_0x97c4('0xc'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x165334,_0x97c4('0xc'),JSON[_0x97c4('0xd')](_0x12e98d));if(_0x12e98d['error']){if(_0x12e98d[_0x97c4('0xe')][_0x97c4('0xf')]===0x1f4){logger[_0x97c4('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x165334,_0x12e98d['error'][_0x97c4('0x10')]);return _0x339817(_0x12e98d[_0x97c4('0xe')]['message']);}logger[_0x97c4('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x165334,_0x12e98d[_0x97c4('0xe')][_0x97c4('0x10')]);return _0x373855(_0x12e98d[_0x97c4('0xe')][_0x97c4('0x10')]);}else{logger[_0x97c4('0xa')](_0x97c4('0xb'),_0x165334,'request\x20sent');_0x373855(_0x12e98d[_0x97c4('0x11')]['message']);}})[_0x97c4('0x12')](function(_0x465c79){logger[_0x97c4('0xe')](_0x97c4('0xb'),_0x165334,_0x465c79);_0x339817(_0x465c79);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 25764d1..1633739 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 _0xc8d3=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','isAuthenticated','/:id','/:id/messages','getMessages','/:id/download','post','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util'];(function(_0x41cd93,_0x382eb8){var _0x58a7f8=function(_0x19e25f){while(--_0x19e25f){_0x41cd93['push'](_0x41cd93['shift']());}};_0x58a7f8(++_0x382eb8);}(_0xc8d3,0x12a));var _0x3c8d=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0xc8d3[_0x20589d];return _0x422de9;};'use strict';var multer=require(_0x3c8d('0x0'));var util=require(_0x3c8d('0x1'));var path=require('path');var timeout=require(_0x3c8d('0x2'));var express=require(_0x3c8d('0x3'));var router=express['Router']();var fs_extra=require(_0x3c8d('0x4'));var auth=require(_0x3c8d('0x5'));var interaction=require(_0x3c8d('0x6'));var config=require(_0x3c8d('0x7'));var controller=require(_0x3c8d('0x8'));router[_0x3c8d('0x9')]('/',auth['isAuthenticated'](),controller[_0x3c8d('0xa')]);router[_0x3c8d('0x9')]('/describe',auth[_0x3c8d('0xb')](),controller['describe']);router[_0x3c8d('0x9')](_0x3c8d('0xc'),auth[_0x3c8d('0xb')](),controller['show']);router[_0x3c8d('0x9')](_0x3c8d('0xd'),auth[_0x3c8d('0xb')](),controller[_0x3c8d('0xe')]);router[_0x3c8d('0x9')](_0x3c8d('0xf'),auth[_0x3c8d('0xb')](),controller['download']);router[_0x3c8d('0x10')]('/',auth[_0x3c8d('0xb')](),controller['create']);router[_0x3c8d('0x10')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router['post'](_0x3c8d('0x11'),auth[_0x3c8d('0xb')](),interaction[_0x3c8d('0x12')](_0x3c8d('0x13'),_0x3c8d('0x14')),controller[_0x3c8d('0x15')]);router[_0x3c8d('0x16')](_0x3c8d('0xc'),auth[_0x3c8d('0xb')](),interaction['tracked'](_0x3c8d('0x13'),_0x3c8d('0x17')),controller[_0x3c8d('0x18')]);router[_0x3c8d('0x19')](_0x3c8d('0xc'),auth[_0x3c8d('0xb')](),interaction[_0x3c8d('0x12')](_0x3c8d('0x13'),_0x3c8d('0x1a')),controller[_0x3c8d('0x1b')]);router[_0x3c8d('0x19')](_0x3c8d('0x11'),auth[_0x3c8d('0xb')](),controller[_0x3c8d('0x1c')]);module[_0x3c8d('0x1d')]=router; \ No newline at end of file +var _0x6b2c=['../../config/environment','./whatsappInteraction.controller','get','/describe','isAuthenticated','/:id','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','addTags','put','tracked','whatsappinteraction:update','whatsappinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6b2c,0x17e));var _0xc6b2=function(_0x2b7f96,_0x4dba87){_0x2b7f96=_0x2b7f96-0x0;var _0x58fbde=_0x6b2c[_0x2b7f96];return _0x58fbde;};'use strict';var multer=require(_0xc6b2('0x0'));var util=require(_0xc6b2('0x1'));var path=require(_0xc6b2('0x2'));var timeout=require('connect-timeout');var express=require(_0xc6b2('0x3'));var router=express[_0xc6b2('0x4')]();var fs_extra=require(_0xc6b2('0x5'));var auth=require(_0xc6b2('0x6'));var interaction=require(_0xc6b2('0x7'));var config=require(_0xc6b2('0x8'));var controller=require(_0xc6b2('0x9'));router[_0xc6b2('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc6b2('0xa')](_0xc6b2('0xb'),auth[_0xc6b2('0xc')](),controller['describe']);router[_0xc6b2('0xa')](_0xc6b2('0xd'),auth[_0xc6b2('0xc')](),controller['show']);router[_0xc6b2('0xa')](_0xc6b2('0xe'),auth['isAuthenticated'](),controller[_0xc6b2('0xf')]);router[_0xc6b2('0xa')](_0xc6b2('0x10'),auth[_0xc6b2('0xc')](),controller[_0xc6b2('0x11')]);router[_0xc6b2('0x12')]('/',auth[_0xc6b2('0xc')](),controller['create']);router[_0xc6b2('0x12')](_0xc6b2('0xe'),auth[_0xc6b2('0xc')](),controller[_0xc6b2('0x13')]);router[_0xc6b2('0x12')](_0xc6b2('0x14'),auth[_0xc6b2('0xc')](),interaction['tracked']('whatsapp','whatsappinteraction:addtags'),controller[_0xc6b2('0x15')]);router[_0xc6b2('0x16')](_0xc6b2('0xd'),auth[_0xc6b2('0xc')](),interaction[_0xc6b2('0x17')]('whatsapp',_0xc6b2('0x18')),controller['update']);router['delete']('/:id',auth[_0xc6b2('0xc')](),interaction[_0xc6b2('0x17')]('whatsapp',_0xc6b2('0x19')),controller[_0xc6b2('0x1a')]);router[_0xc6b2('0x1b')]('/:id/tags',auth[_0xc6b2('0xc')](),controller[_0xc6b2('0x1c')]);module[_0xc6b2('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 78c5a15..b3a9215 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 _0x4c6b=['DATE','STRING','ENUM','out','sequelize','moment','exports','BOOLEAN'];(function(_0x15dbca,_0x1d7c3c){var _0x326533=function(_0x507ee2){while(--_0x507ee2){_0x15dbca['push'](_0x15dbca['shift']());}};_0x326533(++_0x1d7c3c);}(_0x4c6b,0xe4));var _0xb4c6=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x4c6b[_0x2235bf];return _0x4c3a64;};'use strict';var Sequelize=require(_0xb4c6('0x0'));var moment=require(_0xb4c6('0x1'));module[_0xb4c6('0x2')]={'closed':{'type':Sequelize[_0xb4c6('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb4c6('0x4')]},'disposition':{'type':Sequelize[_0xb4c6('0x5')]},'secondDisposition':{'type':Sequelize[_0xb4c6('0x5')]},'thirdDisposition':{'type':Sequelize[_0xb4c6('0x5')]},'note':{'type':Sequelize[_0xb4c6('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xb4c6('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xb4c6('0x6')]('in',_0xb4c6('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb4c6('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xb4c6('0x6')]('in',_0xb4c6('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x74ca=['ENUM','out','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x3e6854,_0x5b37dc){var _0x238a93=function(_0x16193d){while(--_0x16193d){_0x3e6854['push'](_0x3e6854['shift']());}};_0x238a93(++_0x5b37dc);}(_0x74ca,0xfa));var _0xa74c=function(_0xab7458,_0x3f7578){_0xab7458=_0xab7458-0x0;var _0x3be2c=_0x74ca[_0xab7458];return _0x3be2c;};'use strict';var Sequelize=require(_0xa74c('0x0'));var moment=require(_0xa74c('0x1'));module[_0xa74c('0x2')]={'closed':{'type':Sequelize[_0xa74c('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa74c('0x4')]},'disposition':{'type':Sequelize[_0xa74c('0x5')]},'secondDisposition':{'type':Sequelize[_0xa74c('0x5')]},'thirdDisposition':{'type':Sequelize[_0xa74c('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xa74c('0x5')]},'read1stAt':{'type':Sequelize[_0xa74c('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xa74c('0x6')]('in',_0xa74c('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xa74c('0x6')]('in',_0xa74c('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index cdca7c4..b6b65e6 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 _0xd87e=['TagIds','Tags','split','forEach','push','catch','index','WhatsappInteraction','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','field','color','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','from','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','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','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','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','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','body','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','agent','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','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','all','rows','keys','includeAll','include','merge','options','create','params','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','findAll','setTags','spread','emit','removeTags','join','root','server','tmp','files','attachments','format','firstName','lastName','Attachment','Messages','createdAt','secret','WhatsappAccount','Account','Owner','get','mkdirSync','10px','40px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','%s\x20#%d','Whatsapp','YYYY-MM-DD','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','basename','existsSync','createReadStream','createWriteStream','out','System','direction','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','fullname'];(function(_0x354270,_0x241e0d){var _0x3acaed=function(_0x12d34d){while(--_0x12d34d){_0x354270['push'](_0x354270['shift']());}};_0x3acaed(++_0x241e0d);}(_0xd87e,0x1bf));var _0xed87=function(_0x1334d5,_0x3f368c){_0x1334d5=_0x1334d5-0x0;var _0x14146b=_0xd87e[_0x1334d5];return _0x14146b;};'use strict';var pdf=require(_0xed87('0x0'));var emlformat=require(_0xed87('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xed87('0x2'));var jsonpatch=require(_0xed87('0x3'));var rp=require(_0xed87('0x4'));var moment=require('moment');var BPromise=require(_0xed87('0x5'));var Mustache=require('mustache');var util=require(_0xed87('0x6'));var path=require(_0xed87('0x7'));var sox=require('sox');var csv=require(_0xed87('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed87('0x9'));var squel=require(_0xed87('0xa'));var crypto=require(_0xed87('0xb'));var jsforce=require(_0xed87('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xed87('0x8'));var querystring=require(_0xed87('0xd'));var Papa=require(_0xed87('0xe'));var Redis=require(_0xed87('0xf'));var authService=require(_0xed87('0x10'));var qs=require(_0xed87('0x11'));var as=require(_0xed87('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xed87('0x13'))(_0xed87('0x14'));var utils=require('../../config/utils');var config=require(_0xed87('0x15'));var licenseUtil=require(_0xed87('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xed87('0x17')](config[_0xed87('0x18')],{'host':_0xed87('0x19'),'port':0x18eb});var socket=require(_0xed87('0x1a'))(new Redis(config[_0xed87('0x18')]));require(_0xed87('0x1b'))['register'](socket);function respondWithStatusCode(_0x4494da,_0x19b283){_0x19b283=_0x19b283||0xcc;return function(_0x1722a6){if(_0x1722a6){return _0x4494da[_0xed87('0x1c')](_0x19b283);}return _0x4494da[_0xed87('0x1d')](_0x19b283)[_0xed87('0x1e')]();};}function respondWithResult(_0x173413,_0x2563e4){_0x2563e4=_0x2563e4||0xc8;return function(_0x385859){if(_0x385859){return _0x173413['status'](_0x2563e4)[_0xed87('0x1f')](_0x385859);}};}function respondWithFilteredResult(_0x18ab7d,_0x2c386a){return function(_0xfb8a44){if(_0xfb8a44){var _0x5f4076=_0xfb8a44[_0xed87('0x20')],_0x211085=_0x2c386a[_0xed87('0x21')],_0x473f00=_0x2c386a[_0xed87('0x21')]+_0x2c386a[_0xed87('0x22')],_0x8920a1;if(_0x473f00>=_0x5f4076){_0x473f00=_0x5f4076;_0x8920a1=0xc8;}else{_0x8920a1=0xce;}_0x18ab7d[_0xed87('0x1d')](_0x8920a1);return _0x18ab7d[_0xed87('0x23')]('Content-Range',_0x211085+'-'+_0x473f00+'/'+_0x5f4076)['json'](_0xfb8a44);}return null;};}function patchUpdates(_0x5db546){return function(_0x47c121){try{jsonpatch[_0xed87('0x24')](_0x47c121,_0x5db546,!![]);}catch(_0x5d3ec8){return BPromise[_0xed87('0x25')](_0x5d3ec8);}return _0x47c121[_0xed87('0x26')]();};}function saveUpdates(_0x5b1659,_0x2bab5b){return function(_0x505733){if(_0x505733){return _0x505733[_0xed87('0x27')](_0x5b1659)[_0xed87('0x28')](function(_0x27799a){return _0x27799a;});}return null;};}function removeEntity(_0x2a8733,_0x23ea90){return function(_0x5d15b3){if(_0x5d15b3){return _0x5d15b3[_0xed87('0x29')]()[_0xed87('0x28')](function(){_0x2a8733[_0xed87('0x1d')](0xcc)[_0xed87('0x1e')]();});}};}function handleEntityNotFound(_0x31c600,_0x289e38){return function(_0x25a6f7){if(!_0x25a6f7){_0x31c600[_0xed87('0x1c')](0x194);}return _0x25a6f7;};}function handleError(_0x40b2fa,_0x38f5c){_0x38f5c=_0x38f5c||0x1f4;return function(_0x469181){logger[_0xed87('0x2a')](_0x469181[_0xed87('0x2b')]);if(_0x469181[_0xed87('0x2c')]){delete _0x469181['name'];}_0x40b2fa[_0xed87('0x1d')](_0x38f5c)[_0xed87('0x2d')](_0x469181);};}function getInteractionUsers(_0x4eaa44,_0x3dff74){return new BPromise(function(_0x33c367,_0x21c93b){try{if(_0x3dff74[_0x4eaa44['id']]){_0x4eaa44['Users']=_['map'](_0x3dff74[_0x4eaa44['id']],function(_0xd0efba){return{'id':_0xd0efba['id'],'fullname':_0xd0efba[_0xed87('0x2e')]};});}}catch(_0x21ab8a){_0x21c93b(_0x21ab8a);}_0x33c367(_0x4eaa44);});}function getInteractionTags(_0x549a19,_0x37d45a){return new BPromise(function(_0x3b87e3,_0x44bb05){try{if(_0x549a19[_0xed87('0x2f')]){_0x549a19[_0xed87('0x30')]=[];_0x549a19[_0xed87('0x2f')][_0xed87('0x31')](',')[_0xed87('0x32')](function(_0xfdcba4){_0x549a19['Tags'][_0xed87('0x33')](_0x37d45a[_0xfdcba4]);});}delete _0x549a19[_0xed87('0x2f')];}catch(_0x479b69){_0x44bb05(_0x479b69);}_0x3b87e3(_0x549a19);});}function updateWhatsappInteraction(_0x47b0f,_0x59d84b,_0x4430aa){return new BPromise(function(_0x18dca9,_0x43b749){return getInteractionUsers(_0x47b0f,_0x4430aa)[_0xed87('0x28')](function(_0x103b34){return getInteractionTags(_0x103b34,_0x59d84b);})[_0xed87('0x28')](function(_0xbd7b69){_0x18dca9(_0xbd7b69);})[_0xed87('0x34')](function(_0x9f4b1f){_0x43b749(_0x9f4b1f);});});}exports[_0xed87('0x35')]=function(_0x35c9aa,_0x544247){var _0x3763a9={},_0x167de8={},_0x584918={'count':0x0,'rows':[]};var _0x2513bf=_['map'](db[_0xed87('0x36')][_0xed87('0x37')],function(_0x5ee114){return{'name':_0x5ee114[_0xed87('0x38')],'type':_0x5ee114[_0xed87('0x39')][_0xed87('0x3a')]};});_0x167de8[_0xed87('0x3b')]=_[_0xed87('0x3c')](_0x2513bf,'name');_0x167de8[_0xed87('0x3d')]=_['keys'](_0x35c9aa[_0xed87('0x3d')]);_0x167de8['filters']=_[_0xed87('0x3e')](_0x167de8[_0xed87('0x3b')],_0x167de8[_0xed87('0x3d')]);_0x3763a9[_0xed87('0x3f')]=_[_0xed87('0x3e')](_0x167de8[_0xed87('0x3b')],qs[_0xed87('0x40')](_0x35c9aa[_0xed87('0x3d')][_0xed87('0x40')]));_0x3763a9['attributes']=_0x3763a9['attributes'][_0xed87('0x41')]?_0x3763a9[_0xed87('0x3f')]:_0x167de8[_0xed87('0x3b')];if(!_0x35c9aa[_0xed87('0x3d')][_0xed87('0x42')](_0xed87('0x43'))){_0x3763a9['limit']=qs[_0xed87('0x22')](_0x35c9aa[_0xed87('0x3d')][_0xed87('0x22')]);_0x3763a9['offset']=qs[_0xed87('0x21')](_0x35c9aa[_0xed87('0x3d')][_0xed87('0x21')]);}_0x3763a9[_0xed87('0x44')]=qs[_0xed87('0x45')](_0x35c9aa[_0xed87('0x3d')][_0xed87('0x45')]);_0x3763a9[_0xed87('0x46')]=qs[_0xed87('0x47')](_[_0xed87('0x48')](_0x35c9aa['query'],_0x167de8[_0xed87('0x47')]),_0x2513bf);var _0x3c7fcc=[];var _0xd6210f=squel['select']()['field']('id')[_0xed87('0x49')](_0xed87('0x2c'))[_0xed87('0x49')](_0xed87('0x4a'))['from'](_0xed87('0x4b'));var _0x3b49a6=squel['select']()[_0xed87('0x49')](_0xed87('0x4c'))[_0xed87('0x49')](_0xed87('0x4d'))[_0xed87('0x49')](_0xed87('0x4e'))[_0xed87('0x4f')](_0xed87('0x50'),'ui')[_0xed87('0x51')](_0xed87('0x52'),'u',_0xed87('0x53'));var _0x5320b4=squel[_0xed87('0x54')]()[_0xed87('0x4f')](_0xed87('0x55'),'i')[_0xed87('0x51')](_0xed87('0x56'),'c',_0xed87('0x57'))[_0xed87('0x51')](_0xed87('0x52'),'o',_0xed87('0x58'))[_0xed87('0x51')](_0xed87('0x59'),'a',_0xed87('0x5a'))[_0xed87('0x51')](_0xed87('0x5b'),'me',_0xed87('0x5c'))[_0xed87('0x51')](_0xed87('0x5d'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0xed87('0x51')](_0xed87('0x4b'),'t',_0xed87('0x5e'));var _0x557540=squel[_0xed87('0x5f')]();var _0x1adb7a=[];var _0x54bc95=squel[_0xed87('0x5f')]();var _0xbd00d;if(_0x35c9aa[_0xed87('0x3d')][_0xed87('0x60')]){_0xbd00d=as['parseSearch'](_0x35c9aa[_0xed87('0x3d')][_0xed87('0x60')]);var _0x3ca34c=_0xbd00d[_0xed87('0x61')];for(var _0x3ef093=0x0;_0x3ef093<_0xbd00d[_0xed87('0x62')][_0xed87('0x41')];_0x3ef093++){var _0x33fba4=_0xbd00d[_0xed87('0x62')][_0x3ef093];var _0x251d4e='i';var _0x25a514=_[_0xed87('0x63')](_0x2513bf,[_0xed87('0x2c'),_0x33fba4['field']]);if(!_0x25a514){switch(_0x33fba4[_0xed87('0x49')]){case'unreadMessages':if(_0x33fba4[_0xed87('0x64')]==0x1){_0x5320b4[_0xed87('0x65')]('`'+_0x33fba4[_0xed87('0x49')]+_0xed87('0x66'));}else{_0x5320b4[_0xed87('0x65')]('`'+_0x33fba4[_0xed87('0x49')]+_0xed87('0x67'));}break;case _0xed87('0x68'):if(_0x33fba4[_0xed87('0x69')]===_0xed87('0x6a')){if(_0x33fba4['value'][_0xed87('0x31')]('\x20')[_0xed87('0x41')]>0x1){_0x557540[_0x3ca34c](_0xed87('0x6b'),qs[_0xed87('0x6c')](_0x33fba4[_0xed87('0x64')]),null);}else{var _0x44b176='%'+_0x33fba4[_0xed87('0x64')]+'%';_0x557540[_0x3ca34c](_0xed87('0x6d'),_0x44b176,_0x44b176,_0x44b176);}}else{_0x25a514=_[_0xed87('0x63')](_0x2513bf,[_0xed87('0x2c'),_0xed87('0x6e')]);_0x33fba4['field']='ContactId';_0x2a30b4=as[_0xed87('0x6f')](_0x251d4e,_0x25a514[_0xed87('0x39')],_0x33fba4);_0x557540[_0x3ca34c](_0x2a30b4[_0xed87('0x70')],_0x2a30b4[_0xed87('0x64')][_0xed87('0x71')],_0x2a30b4['value'][_0xed87('0x1e')]);}break;case _0xed87('0x72'):var _0x184e99=_0x33fba4[_0xed87('0x64')][_0xed87('0x31')](',')[_0xed87('0x3c')](function(_0x15e3bc){return Number(_0x15e3bc);});_0x184e99[_0xed87('0x32')](function(_0x2ffffa){_0x54bc95['or'](_0xed87('0x73'),'%,'+_0x2ffffa+',%');});_0x1adb7a=_[_0xed87('0x74')](_0x1adb7a,_0x184e99);break;case _0xed87('0x75'):if(_0x33fba4[_0xed87('0x69')]===_0xed87('0x6a')){_0x557540[_0x3ca34c]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x33fba4[_0xed87('0x64')]+'%',null);}else{_0x25a514=_[_0xed87('0x63')](_0x2513bf,[_0xed87('0x2c'),_0xed87('0x76')]);_0x33fba4[_0xed87('0x49')]=_0xed87('0x76');_0x2a30b4=as[_0xed87('0x6f')](_0x251d4e,_0x25a514[_0xed87('0x39')],_0x33fba4);_0x557540[_0x3ca34c](_0x2a30b4['text'],_0x2a30b4[_0xed87('0x64')][_0xed87('0x71')],_0x2a30b4[_0xed87('0x64')][_0xed87('0x1e')]);}break;case _0xed87('0x77'):_0x2a30b4=as[_0xed87('0x6f')]('me',null,_0x33fba4);_0x557540[_0x3ca34c](_0x2a30b4['text'],_0x2a30b4['value'][_0xed87('0x71')],_0x2a30b4[_0xed87('0x64')][_0xed87('0x1e')]);break;}}else{var _0x2a30b4=as[_0xed87('0x6f')](_0x251d4e,_0x25a514[_0xed87('0x39')],_0x33fba4);_0x557540[_0x3ca34c](_0x2a30b4[_0xed87('0x70')],_0x2a30b4[_0xed87('0x64')]['start'],_0x2a30b4[_0xed87('0x64')]['end']);}}}else{var _0xd3b300=_(_0x35c9aa[_0xed87('0x3d')])['keys']()[_0xed87('0x3c')](function(_0x30f9d0){return _['some'](_0x2513bf,[_0xed87('0x2c'),_0x30f9d0])?_0x30f9d0:undefined;})[_0xed87('0x78')]()[_0xed87('0x64')]();if(!_[_0xed87('0x79')](_0xd3b300)){_0xd3b300[_0xed87('0x32')](function(_0x593542){if(_0x593542===_0xed87('0x7a')){_0x5320b4[_0xed87('0x46')](_0xed87('0x7b'),[][_0xed87('0x7c')](_0x35c9aa['query'][_0x593542]));}else if(_0x593542==='createdAt'){var _0x3a6ab6=JSON[_0xed87('0x7d')](_0x35c9aa['query'][_0x593542])[_0xed87('0x7e')];var _0x40d5f6=JSON[_0xed87('0x7d')](_0x35c9aa[_0xed87('0x3d')][_0x593542])[_0xed87('0x7f')];_0x5320b4[_0xed87('0x46')](_0xed87('0x80'),_0x3a6ab6,_0x40d5f6);}else{if(_0x35c9aa[_0xed87('0x3d')][_0x593542]===_0xed87('0x81')){_0x5320b4[_0xed87('0x46')]('i.'+_0x593542+_0xed87('0x82'));}else{_0x5320b4[_0xed87('0x46')]('i.'+_0x593542+_0xed87('0x83'),_0x35c9aa[_0xed87('0x3d')][_0x593542]);}}});}if(_0x35c9aa['query'][_0xed87('0x84')]){if(_0x35c9aa[_0xed87('0x3d')]['read']==0x1){_0x5320b4['having'](_0xed87('0x85'));}else{_0x5320b4[_0xed87('0x65')](_0xed87('0x86'));}}if(_0x35c9aa[_0xed87('0x3d')][_0xed87('0x87')]){_0x1adb7a=_[_0xed87('0x88')](_0x35c9aa[_0xed87('0x3d')][_0xed87('0x87')])?_0x35c9aa['query'][_0xed87('0x87')]:new Array(_0x35c9aa[_0xed87('0x3d')][_0xed87('0x87')]);_0x1adb7a[_0xed87('0x32')](function(_0xc35cab){_0x54bc95['or'](_0xed87('0x73'),'%,'+_0xc35cab+',%');});}if(_0x35c9aa[_0xed87('0x3d')][_0xed87('0x89')]){var _0x116198=_0x35c9aa[_0xed87('0x3d')]['filter']['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xed87('0x8a')](_0x116198)){_0x557540['or'](_0xed87('0x8b'),_0x116198+'%')['or'](_0xed87('0x8c'),_0x116198+'%');}else{_0x557540['or'](_0xed87('0x8d'),qs[_0xed87('0x6c')](_0x116198))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x116198+'%');}}}_0x5320b4[_0xed87('0x46')](_0x557540);_0x5320b4[_0xed87('0x8e')](_0xed87('0x8f'));var _0x1a925d={'type':db[_0xed87('0x90')][_0xed87('0x91')]['SELECT'],'raw':!![]};var _0x559b52=_0x5320b4[_0xed87('0x92')]();_0x559b52[_0xed87('0x49')](_0xed87('0x8f'));_0x559b52[_0xed87('0x49')](_0xed87('0x93'),_0xed87('0x94'));if(_0x3763a9[_0xed87('0x44')]){_0x3763a9[_0xed87('0x44')][_0xed87('0x32')](function(_0x2a4781){var _0x25e736=_0x2a4781[0x0]===_0xed87('0x95')?_0x2a4781[0x0]:'i.'+_0x2a4781[0x0];_0x5320b4['order'](_0x25e736,_0x2a4781[0x1]===_0xed87('0x96')?![]:!![]);});}if(!_[_0xed87('0x79')](_0x1adb7a)){_0x5320b4[_0xed87('0x65')](_0x54bc95);_0x559b52[_0xed87('0x46')](_0xed87('0x97'),_0x1adb7a);}BPromise[_0xed87('0x98')]()['then'](function(){if(!_0xbd00d){if(_0x35c9aa[_0xed87('0x3d')][_0xed87('0x7a')])return;_0x559b52[_0xed87('0x46')](_0xed87('0x99'));_0x5320b4['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x35c9aa['user']['role']!=='agent')return;return _0x35c9aa[_0xed87('0x9a')][_0xed87('0x9b')]({'attributes':['id'],'raw':!![]})[_0xed87('0x28')](function(_0x1ba924){if(_[_0xed87('0x79')](_0x1ba924)){_0x559b52[_0xed87('0x46')](_0xed87('0x9c'));_0x5320b4[_0xed87('0x46')](_0xed87('0x9c'));}else{_0x559b52['where']('i.WhatsappAccountId\x20IN\x20?',_[_0xed87('0x3c')](_0x1ba924,'id'));_0x5320b4[_0xed87('0x46')](_0xed87('0x7b'),_[_0xed87('0x3c')](_0x1ba924,'id'));}});})[_0xed87('0x28')](function(){if(_0x35c9aa['user']['role']===_0xed87('0x9d')&&!_0xbd00d&&!_0x35c9aa[_0xed87('0x3d')]['WhatsappAccountId'])return[];return db[_0xed87('0x9e')]['query'](_0x559b52[_0xed87('0x9f')](),_0x1a925d);})['then'](function(_0x32446d){_0x584918[_0xed87('0x20')]=_0x32446d[_0xed87('0x41')];if(_0x584918[_0xed87('0x20')]===0x0)return[];return db[_0xed87('0x9e')]['query'](_0xd6210f[_0xed87('0x9f')](),_0x1a925d)[_0xed87('0x28')](function(_0x5f5391){_0x3c7fcc=_[_0xed87('0xa0')](_0x5f5391,'id');_0x1a925d=_['merge'](_0x1a925d,{'model':db[_0xed87('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x35c9aa[_0xed87('0x3d')]['fields']){_0x3763a9[_0xed87('0x3f')][_0xed87('0x32')](function(_0x5e7813){_0x5320b4[_0xed87('0x49')]('i.'+_0x5e7813);});}else{_0x5320b4[_0xed87('0x49')](_0xed87('0x93'),_0xed87('0x94'));_0x5320b4['field'](_0xed87('0xa1'),_0xed87('0xa2'));_0x5320b4[_0xed87('0x49')](_0xed87('0xa3'),_0xed87('0xa4'));_0x5320b4[_0xed87('0x49')](_0xed87('0xa5'),_0xed87('0x95'));_0x5320b4[_0xed87('0x49')](_0xed87('0xa6'));_0x5320b4[_0xed87('0x49')](_0xed87('0xa7'),_0xed87('0xa8'));_0x5320b4[_0xed87('0x49')](_0xed87('0xa9'),_0xed87('0xaa'));_0x5320b4[_0xed87('0x49')](_0xed87('0xab'),_0xed87('0xac'));_0x5320b4[_0xed87('0x49')](_0xed87('0xad'),'Contact.phone');_0x5320b4[_0xed87('0x49')](_0xed87('0xae'),_0xed87('0xaf'));_0x5320b4[_0xed87('0x49')](_0xed87('0xb0'),_0xed87('0xb1'));_0x5320b4[_0xed87('0x49')](_0xed87('0xb2'),_0xed87('0xb3'));_0x5320b4['field'](_0xed87('0xb4'),_0xed87('0xb5'));_0x5320b4[_0xed87('0x49')](_0xed87('0xb6'),_0xed87('0x2f'));}if(_0x3763a9[_0xed87('0x22')])_0x5320b4['limit'](_0x3763a9['limit']);if(_0x3763a9['offset'])_0x5320b4[_0xed87('0x21')](_0x3763a9['offset']);return db['sequelize'][_0xed87('0x3d')](_0x5320b4[_0xed87('0x9f')](),_0x1a925d);})[_0xed87('0x28')](function(_0x550fd6){_0x3b49a6['where'](_0xed87('0xb7'),_[_0xed87('0x3c')](_0x550fd6,'id'));return db['sequelize'][_0xed87('0x3d')](_0x3b49a6[_0xed87('0x9f')](),_0x1a925d)[_0xed87('0x28')](function(_0x36defd){var _0x5e2d21=_['groupBy'](_0x36defd,_0xed87('0xb8'));var _0x57e53c=[];_0x550fd6['forEach'](function(_0x412415){_0x57e53c['push'](updateWhatsappInteraction(_0x412415,_0x3c7fcc,_0x5e2d21));});return BPromise[_0xed87('0xb9')](_0x57e53c);});});})[_0xed87('0x28')](function(_0xf35eda){_0x584918[_0xed87('0xba')]=_0xf35eda;return _0x584918;})[_0xed87('0x28')](respondWithFilteredResult(_0x544247,_0x3763a9))[_0xed87('0x34')](handleError(_0x544247,null));};exports['show']=function(_0x56aacb,_0x17db49){var _0x169861={'raw':![],'where':{'id':_0x56aacb['params']['id']}},_0x36232c={};_0x36232c[_0xed87('0x3b')]=_['keys'](db[_0xed87('0x36')]['rawAttributes']);_0x36232c['query']=_[_0xed87('0xbb')](_0x56aacb[_0xed87('0x3d')]);_0x36232c[_0xed87('0x47')]=_[_0xed87('0x3e')](_0x36232c[_0xed87('0x3b')],_0x36232c[_0xed87('0x3d')]);_0x169861[_0xed87('0x3f')]=_[_0xed87('0x3e')](_0x36232c['model'],qs['fields'](_0x56aacb['query']['fields']));_0x169861[_0xed87('0x3f')]=_0x169861[_0xed87('0x3f')][_0xed87('0x41')]?_0x169861[_0xed87('0x3f')]:_0x36232c['model'];if(_0x56aacb[_0xed87('0x3d')][_0xed87('0xbc')]){_0x169861[_0xed87('0xbd')]=[{'all':!![]}];}_0x169861=_[_0xed87('0xbe')]({},_0x169861,_0x56aacb[_0xed87('0xbf')]);return db['WhatsappInteraction'][_0xed87('0x63')](_0x169861)[_0xed87('0x28')](handleEntityNotFound(_0x17db49,null))[_0xed87('0x28')](respondWithResult(_0x17db49,null))[_0xed87('0x34')](handleError(_0x17db49,null));};exports[_0xed87('0xc0')]=function(_0x1b50df,_0x4d3bd4){return db['WhatsappInteraction'][_0xed87('0xc0')](_0x1b50df[_0xed87('0x77')],{})[_0xed87('0x28')](respondWithResult(_0x4d3bd4,0xc9))[_0xed87('0x34')](handleError(_0x4d3bd4,null));};exports['update']=function(_0x15e01e,_0x30b747){if(_0x15e01e[_0xed87('0x77')]['id']){delete _0x15e01e[_0xed87('0x77')]['id'];}return db[_0xed87('0x36')]['find']({'where':{'id':_0x15e01e['params']['id']}})[_0xed87('0x28')](handleEntityNotFound(_0x30b747,null))['then'](saveUpdates(_0x15e01e['body'],null))[_0xed87('0x28')](respondWithResult(_0x30b747,null))[_0xed87('0x34')](handleError(_0x30b747,null));};exports[_0xed87('0x29')]=function(_0x1bf5a3,_0x5989f2){return db['WhatsappInteraction']['find']({'where':{'id':_0x1bf5a3[_0xed87('0xc1')]['id']}})[_0xed87('0x28')](handleEntityNotFound(_0x5989f2,null))[_0xed87('0x28')](removeEntity(_0x5989f2,null))[_0xed87('0x34')](handleError(_0x5989f2,null));};exports['describe']=function(_0x4fd34c,_0x5bced7){return db['WhatsappInteraction']['describe']()[_0xed87('0x28')](respondWithResult(_0x5bced7,null))['catch'](handleError(_0x5bced7,null));};exports[_0xed87('0xc2')]=function(_0x46e11e,_0xcbb2dd,_0x31f640){return db['WhatsappMessage'][_0xed87('0x63')]({'where':{'id':_0x46e11e[_0xed87('0xc1')]['id']}})['then'](handleEntityNotFound(_0xcbb2dd,null))[_0xed87('0x28')](function(_0xd0a4e4){if(_0xd0a4e4){return _0xd0a4e4[_0xed87('0xc2')](_0x46e11e['body'][_0xed87('0xc3')],_[_0xed87('0xc4')](_0x46e11e[_0xed87('0x77')],[_0xed87('0xc3'),'id'])||{});}})[_0xed87('0x28')](respondWithResult(_0xcbb2dd,null))[_0xed87('0x34')](handleError(_0xcbb2dd,null));};exports[_0xed87('0xc5')]=function(_0x5dd870,_0x457659,_0x1ba77d){var _0x9b573e={'raw':![],'where':{}};var _0x5f12a0={};var _0xc39e1b={'count':0x0,'rows':[]};return db[_0xed87('0x36')][_0xed87('0xc6')]({'where':{'id':_0x5dd870[_0xed87('0xc1')]['id']}})[_0xed87('0x28')](handleEntityNotFound(_0x457659,null))[_0xed87('0x28')](function(_0x8cfc){if(_0x8cfc){_0x5f12a0[_0xed87('0x3b')]=_[_0xed87('0xbb')](db[_0xed87('0xc7')][_0xed87('0x37')]);_0x5f12a0[_0xed87('0x3d')]=_[_0xed87('0xbb')](_0x5dd870['query']);_0x5f12a0['filters']=_[_0xed87('0x3e')](_0x5f12a0['model'],_0x5f12a0[_0xed87('0x3d')]);_0x9b573e[_0xed87('0x3f')]=_['intersection'](_0x5f12a0[_0xed87('0x3b')],qs[_0xed87('0x40')](_0x5dd870[_0xed87('0x3d')][_0xed87('0x40')]));_0x9b573e['attributes']=_0x9b573e['attributes'][_0xed87('0x41')]?_0x9b573e['attributes']:_0x5f12a0['model'];if(!_0x5dd870[_0xed87('0x3d')]['hasOwnProperty'](_0xed87('0x43'))){_0x9b573e[_0xed87('0x22')]=qs[_0xed87('0x22')](_0x5dd870[_0xed87('0x3d')][_0xed87('0x22')]);_0x9b573e['offset']=qs[_0xed87('0x21')](_0x5dd870[_0xed87('0x3d')][_0xed87('0x21')]);}_0x9b573e[_0xed87('0x44')]=qs[_0xed87('0x45')](_0x5dd870['query'][_0xed87('0x45')]);_0x9b573e['where']=qs['filters'](_[_0xed87('0x48')](_0x5dd870[_0xed87('0x3d')],_0x5f12a0[_0xed87('0x47')]));_0x9b573e[_0xed87('0x46')][_0xed87('0xb8')]=_0x8cfc['id'];if(_0x5dd870['query']['filter']){_0x9b573e[_0xed87('0x46')]=_[_0xed87('0xbe')](_0x9b573e[_0xed87('0x46')],{'$or':_['map'](_0x9b573e['attributes'],function(_0xf53b1c){var _0x227cc2={};_0x227cc2[_0xf53b1c]={'$like':'%'+_0x5dd870['query'][_0xed87('0x89')]+'%'};return _0x227cc2;})});}if(_0x5dd870[_0xed87('0x3d')][_0xed87('0x7e')]){var _0x1a5ac0=_0x5dd870['query'][_0xed87('0x7e')][_0xed87('0x31')](',');var _0x5768c0={};_0x5768c0[_0x1a5ac0[0x0]]={'$gte':moment(_0x1a5ac0[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x9b573e['where']=_[_0xed87('0xbe')](_0x9b573e['where'],_0x5768c0);}_0x9b573e=_[_0xed87('0xbe')]({},_0x9b573e,_0x5dd870[_0xed87('0xbf')]);return db[_0xed87('0xc7')]['count']({'where':_0x9b573e[_0xed87('0x46')]})[_0xed87('0x28')](function(_0x49c580){_0xc39e1b[_0xed87('0x20')]=_0x49c580;if(_0x5dd870['query'][_0xed87('0xbc')]){_0x9b573e[_0xed87('0xbd')]=[{'all':!![]}];}return db[_0xed87('0xc7')][_0xed87('0xc8')](_0x9b573e);})[_0xed87('0x28')](function(_0x189ed5){_0xc39e1b[_0xed87('0xba')]=_0x189ed5;return _0xc39e1b;});}})['then'](respondWithFilteredResult(_0x457659,_0x9b573e))[_0xed87('0x34')](handleError(_0x457659,null));};exports['addTags']=function(_0x2398ec,_0x22bcba,_0x37743b){return db[_0xed87('0x36')][_0xed87('0x63')]({'where':{'id':_0x2398ec[_0xed87('0xc1')]['id']}})[_0xed87('0x28')](handleEntityNotFound(_0x22bcba,null))[_0xed87('0x28')](function(_0xd6bde5){if(_0xd6bde5){return _0xd6bde5[_0xed87('0xc9')](_0x2398ec[_0xed87('0x77')][_0xed87('0xc3')],_[_0xed87('0xc4')](_0x2398ec[_0xed87('0x77')],['ids','id'])||{})[_0xed87('0xca')](function(){return db[_0xed87('0x72')][_0xed87('0xc8')]({'attributes':['id',_0xed87('0x2c'),_0xed87('0x4a')],'where':{'id':_0x2398ec['body']['ids']}});})['then'](function(_0x24f6dc){socket[_0xed87('0xcb')]('whatsappInteractionTags:save',{'id':Number(_0x2398ec[_0xed87('0xc1')]['id']),'tags':_0x24f6dc||[]});return{'id':Number(_0x2398ec[_0xed87('0xc1')]['id']),'tags':_0x24f6dc||[]};});}})[_0xed87('0x28')](respondWithResult(_0x22bcba,null))[_0xed87('0x34')](handleError(_0x22bcba,null));};exports['removeTags']=function(_0x158797,_0x24fb51,_0xe3fd63){return db[_0xed87('0x36')]['find']({'where':{'id':_0x158797[_0xed87('0xc1')]['id']}})[_0xed87('0x28')](handleEntityNotFound(_0x24fb51,null))['then'](function(_0x1427a4){if(_0x1427a4){return _0x1427a4[_0xed87('0xcc')](_0x158797[_0xed87('0x3d')]['ids']);}})[_0xed87('0x28')](respondWithStatusCode(_0x24fb51,null))[_0xed87('0x34')](handleError(_0x24fb51,null));};exports['download']=function(_0x23bb74,_0xaf3377){var _0x38ce65=moment()['unix']()['toString']();var _0x27b74d=path[_0xed87('0xcd')](config[_0xed87('0xce')],_0xed87('0xcf'),'files',_0xed87('0xd0'));var _0x30b248=path['join'](config[_0xed87('0xce')],_0xed87('0xcf'),_0xed87('0xd1'),_0xed87('0xd2'));var _0x416391=path['join'](_0x27b74d,_0x38ce65);var _0x5e6ba4=util[_0xed87('0xd3')]('transcript-%d-%s.zip',_0x23bb74[_0xed87('0xc1')]['id'],_0x38ce65);var _0x546e6a=path[_0xed87('0xcd')](_0x27b74d,_0x5e6ba4);var _0x1276c8=[];_0x1276c8[_0xed87('0x33')]({'model':db['User'],'as':_0xed87('0x75'),'attributes':['id',_0xed87('0x2e')],'raw':!![]});_0x1276c8[_0xed87('0x33')]({'model':db['CmContact'],'as':_0xed87('0x68'),'attributes':['id',_0xed87('0xd4'),_0xed87('0xd5')],'raw':!![]});if(_0x23bb74[_0xed87('0x3d')][_0xed87('0xd2')]){_0x1276c8[_0xed87('0x33')]({'model':db[_0xed87('0xd6')],'as':'Attachment','raw':!![]});}var _0x5b59ef=[{'model':db[_0xed87('0xc7')],'as':_0xed87('0xd7'),'attributes':['id',_0xed87('0x77'),_0xed87('0xd8'),'direction',_0xed87('0xd9'),'read'],'include':_0x1276c8}];_0x5b59ef[_0xed87('0x33')]({'model':db[_0xed87('0xda')],'as':_0xed87('0xdb'),'attributes':['id',_0xed87('0x2c')]});_0x5b59ef[_0xed87('0x33')]({'model':db[_0xed87('0x75')],'as':_0xed87('0xdc'),'attributes':['id',_0xed87('0x2e')]});return db['WhatsappInteraction'][_0xed87('0x63')]({'where':{'id':_0x23bb74[_0xed87('0xc1')]['id']},'include':_0x5b59ef})['then'](handleEntityNotFound(_0xaf3377,null))[_0xed87('0x28')](function(_0x2c4a1f){if(_0x2c4a1f){var _0xfc047b=_0x2c4a1f[_0xed87('0xdd')]({'plain':!![]});fs[_0xed87('0xde')](_0x416391);var _0x4434d7={'format':'A4','border':_0xed87('0xdf'),'header':{'height':_0xed87('0xe0'),'contents':{'first':_0xed87('0xe1')}},'footer':{'height':_0xed87('0xe2'),'contents':{'default':util[_0xed87('0xd3')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util['format'](_0xed87('0xe3'),_0xed87('0xe4'),_0xfc047b['id']),moment()[_0xed87('0xd3')](_0xed87('0xe5'))[_0xed87('0x9f')]())}}};var _0x220c40={'channel':_0xed87('0xe4'),'account':_0xfc047b[_0xed87('0xdb')][_0xed87('0x2c')],'agent':_0xfc047b[_0xed87('0xdc')]?_0xfc047b['Owner']['fullname']:'N.A.','createdAt':moment(_0xfc047b[_0xed87('0xd8')])[_0xed87('0xd3')](_0xed87('0xe6'))[_0xed87('0x9f')](),'closedAt':_0xfc047b['closed']?moment(_0xfc047b[_0xed87('0xe7')])[_0xed87('0xd3')]('YYYY-MM-DD\x20HH:mm:ss')[_0xed87('0x9f')]():'','disposition':_0xfc047b[_0xed87('0xe8')],'messages':_(_0xfc047b[_0xed87('0xd7')])[_0xed87('0x89')]({'secret':![]})[_0xed87('0x3c')](function(_0x367de3){if(_0x367de3[_0xed87('0xd6')]){var _0xb2db6d=path[_0xed87('0xcd')](_0x30b248,_0x367de3[_0xed87('0xd6')][_0xed87('0xe9')]);if(fs[_0xed87('0xea')](_0xb2db6d)){fs[_0xed87('0xeb')](_0xb2db6d)['pipe'](fs[_0xed87('0xec')](path[_0xed87('0xcd')](_0x416391,_0x367de3['Attachment'][_0xed87('0xe9')])));}}return{'date':moment(_0x367de3['createdAt'])['format'](_0xed87('0xe6'))[_0xed87('0x9f')](),'sender':_0x367de3['direction']===_0xed87('0xed')?_0x367de3[_0xed87('0x75')]?_0x367de3[_0xed87('0x75')][_0xed87('0x2e')]:_0xed87('0xee'):_0x367de3['Contact']['firstName']+(_0x367de3['Contact'][_0xed87('0xd5')]?'\x20'+_0x367de3[_0xed87('0x68')]['lastName']:''),'body':_0x367de3[_0xed87('0xd6')]?_0x367de3[_0xed87('0xd6')][_0xed87('0xe9')]:_0x367de3['body'],'direction':_0x367de3[_0xed87('0xef')]===_0xed87('0xed')?'A':'C','secret':_0x367de3[_0xed87('0xd9')],'read':_0x367de3[_0xed87('0x84')],'attachment':_0x367de3[_0xed87('0xd6')]};})['value']()};return ejs[_0xed87('0xf0')](path[_0xed87('0xcd')](config[_0xed87('0xce')],_0xed87('0xcf'),_0xed87('0xf1'),_0xed87('0xf2')),{'interaction':_0x220c40})[_0xed87('0x28')](function(_0x33d455){return new BPromise(function(_0x2f5401,_0x1961e8){pdf['create'](_0x33d455,_0x4434d7)[_0xed87('0xf3')](path['join'](_0x416391,_0xed87('0xf4')+_0xfc047b['id']+'-'+_0x38ce65+_0xed87('0xf5')),function(_0x1f1b6a,_0x1bf1c4){if(_0x1f1b6a)return _0x1961e8(_0x1f1b6a);_0x2f5401(_0x1bf1c4);});});})[_0xed87('0x28')](function(){return new BPromise(function(_0x2d7fcb,_0x459df4){zipdir(_0x416391,{'saveTo':_0x546e6a},function(_0x266ec9,_0x320e7a){if(_0x266ec9)return _0x459df4(_0x266ec9);return _0x2d7fcb(_0x320e7a);});})[_0xed87('0x28')](function(){return new BPromise(function(_0x2feb9c,_0x2294d6){rimraf(_0x416391,function(_0x20eaeb){if(_0x20eaeb)_0x2294d6(_0x20eaeb);return _0x2feb9c();});});})[_0xed87('0x28')](function(){return _0xaf3377['download'](_0x546e6a,_0x5e6ba4,function(_0x32dc5f){if(_0x32dc5f){console[_0xed87('0xf6')]('err',_0x32dc5f);}else{fs['unlinkSync'](_0x546e6a);}});});});}else{return _0xaf3377[_0xed87('0x1c')](0xc8);}})[_0xed87('0x34')](handleError(_0xaf3377,null));}; \ No newline at end of file +var _0xee11=['toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','all','rows','show','params','includeAll','create','describe','addMessage','omit','ids','getMessages','findOne','nolimit','options','WhatsappMessage','include','addTags','setTags','spread','Tag','findAll','removeTags','root','tmp','join','server','files','attachments','format','CmContact','Contact','firstName','lastName','Attachment','Messages','secret','Account','10px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','%s\x20#%d','Whatsapp','YYYY-MM-DD','Owner','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','basename','existsSync','createReadStream','pipe','direction','out','views','toFile','transcript-','.pdf','download','err','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','fullname','TagIds','Tags','push','catch','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','pick','select','field','color','from','tools_tags','u.id','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','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\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','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','start','body','text','some','compact','isEmpty','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','createdAt','$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?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','i.WhatsappAccountId\x20IS\x20NULL','role','agent','sequelize'];(function(_0x4bae70,_0x46d7ea){var _0x32deb6=function(_0x13c410){while(--_0x13c410){_0x4bae70['push'](_0x4bae70['shift']());}};_0x32deb6(++_0x46d7ea);}(_0xee11,0x146));var _0x1ee1=function(_0x1163c3,_0x3aedc6){_0x1163c3=_0x1163c3-0x0;var _0x7a7cb5=_0xee11[_0x1163c3];return _0x7a7cb5;};'use strict';var pdf=require(_0x1ee1('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1ee1('0x1'));var jsonpatch=require(_0x1ee1('0x2'));var rp=require(_0x1ee1('0x3'));var moment=require(_0x1ee1('0x4'));var BPromise=require(_0x1ee1('0x5'));var Mustache=require(_0x1ee1('0x6'));var util=require(_0x1ee1('0x7'));var path=require(_0x1ee1('0x8'));var sox=require('sox');var csv=require(_0x1ee1('0x9'));var ejs=require(_0x1ee1('0xa'));var fs=require('fs');var fs_extra=require(_0x1ee1('0xb'));var _=require(_0x1ee1('0xc'));var squel=require(_0x1ee1('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1ee1('0xe'));var toCsv=require(_0x1ee1('0x9'));var querystring=require(_0x1ee1('0xf'));var Papa=require(_0x1ee1('0x10'));var Redis=require('ioredis');var authService=require(_0x1ee1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1ee1('0x12'));var hardwareService=require(_0x1ee1('0x13'));var logger=require(_0x1ee1('0x14'))(_0x1ee1('0x15'));var utils=require('../../config/utils');var config=require(_0x1ee1('0x16'));var licenseUtil=require(_0x1ee1('0x17'));var db=require('../../mysqldb')['db'];config[_0x1ee1('0x18')]=_[_0x1ee1('0x19')](config[_0x1ee1('0x18')],{'host':_0x1ee1('0x1a'),'port':0x18eb});var socket=require(_0x1ee1('0x1b'))(new Redis(config[_0x1ee1('0x18')]));require(_0x1ee1('0x1c'))[_0x1ee1('0x1d')](socket);function respondWithStatusCode(_0x2f4c8d,_0x189191){_0x189191=_0x189191||0xcc;return function(_0x2bc943){if(_0x2bc943){return _0x2f4c8d[_0x1ee1('0x1e')](_0x189191);}return _0x2f4c8d[_0x1ee1('0x1f')](_0x189191)[_0x1ee1('0x20')]();};}function respondWithResult(_0x4828ba,_0x4f4d55){_0x4f4d55=_0x4f4d55||0xc8;return function(_0x7ff856){if(_0x7ff856){return _0x4828ba[_0x1ee1('0x1f')](_0x4f4d55)[_0x1ee1('0x21')](_0x7ff856);}};}function respondWithFilteredResult(_0x2752ba,_0x1e18b9){return function(_0xff3d76){if(_0xff3d76){var _0x55abff=_0xff3d76[_0x1ee1('0x22')],_0x39229e=_0x1e18b9[_0x1ee1('0x23')],_0x3c97aa=_0x1e18b9['offset']+_0x1e18b9['limit'],_0x5c380f;if(_0x3c97aa>=_0x55abff){_0x3c97aa=_0x55abff;_0x5c380f=0xc8;}else{_0x5c380f=0xce;}_0x2752ba[_0x1ee1('0x1f')](_0x5c380f);return _0x2752ba[_0x1ee1('0x24')](_0x1ee1('0x25'),_0x39229e+'-'+_0x3c97aa+'/'+_0x55abff)[_0x1ee1('0x21')](_0xff3d76);}return null;};}function patchUpdates(_0x47eb1a){return function(_0x1c3851){try{jsonpatch[_0x1ee1('0x26')](_0x1c3851,_0x47eb1a,!![]);}catch(_0x482d0){return BPromise['reject'](_0x482d0);}return _0x1c3851[_0x1ee1('0x27')]();};}function saveUpdates(_0x277cd8,_0x28c0e9){return function(_0x307672){if(_0x307672){return _0x307672[_0x1ee1('0x28')](_0x277cd8)[_0x1ee1('0x29')](function(_0x55921f){return _0x55921f;});}return null;};}function removeEntity(_0x1142fd,_0x5d1948){return function(_0x4932cd){if(_0x4932cd){return _0x4932cd[_0x1ee1('0x2a')]()[_0x1ee1('0x29')](function(){_0x1142fd['status'](0xcc)[_0x1ee1('0x20')]();});}};}function handleEntityNotFound(_0x1a90b3,_0x1036f5){return function(_0x31ede7){if(!_0x31ede7){_0x1a90b3[_0x1ee1('0x1e')](0x194);}return _0x31ede7;};}function handleError(_0x12c583,_0x56a1e3){_0x56a1e3=_0x56a1e3||0x1f4;return function(_0x14f388){logger[_0x1ee1('0x2b')](_0x14f388[_0x1ee1('0x2c')]);if(_0x14f388[_0x1ee1('0x2d')]){delete _0x14f388[_0x1ee1('0x2d')];}_0x12c583[_0x1ee1('0x1f')](_0x56a1e3)['send'](_0x14f388);};}function getInteractionUsers(_0x19e4cc,_0x576bf4){return new BPromise(function(_0x1fab9d,_0x153731){try{if(_0x576bf4[_0x19e4cc['id']]){_0x19e4cc['Users']=_['map'](_0x576bf4[_0x19e4cc['id']],function(_0x444ed9){return{'id':_0x444ed9['id'],'fullname':_0x444ed9[_0x1ee1('0x2e')]};});}}catch(_0xf63d67){_0x153731(_0xf63d67);}_0x1fab9d(_0x19e4cc);});}function getInteractionTags(_0x209592,_0x49241e){return new BPromise(function(_0x4b9ea4,_0x1b8205){try{if(_0x209592[_0x1ee1('0x2f')]){_0x209592[_0x1ee1('0x30')]=[];_0x209592[_0x1ee1('0x2f')]['split'](',')['forEach'](function(_0x100e42){_0x209592['Tags'][_0x1ee1('0x31')](_0x49241e[_0x100e42]);});}delete _0x209592[_0x1ee1('0x2f')];}catch(_0x5b6a17){_0x1b8205(_0x5b6a17);}_0x4b9ea4(_0x209592);});}function updateWhatsappInteraction(_0x2fe0a8,_0x556191,_0x4c99f9){return new BPromise(function(_0x4866a9,_0x285110){return getInteractionUsers(_0x2fe0a8,_0x4c99f9)['then'](function(_0x4699f8){return getInteractionTags(_0x4699f8,_0x556191);})[_0x1ee1('0x29')](function(_0x513124){_0x4866a9(_0x513124);})[_0x1ee1('0x32')](function(_0x3a2746){_0x285110(_0x3a2746);});});}exports[_0x1ee1('0x33')]=function(_0x50340c,_0x208845){var _0xc72d91={},_0x80fbc={},_0x3d9e0a={'count':0x0,'rows':[]};var _0x40964d=_[_0x1ee1('0x34')](db[_0x1ee1('0x35')][_0x1ee1('0x36')],function(_0x24ca9e){return{'name':_0x24ca9e[_0x1ee1('0x37')],'type':_0x24ca9e[_0x1ee1('0x38')][_0x1ee1('0x39')]};});_0x80fbc[_0x1ee1('0x3a')]=_[_0x1ee1('0x34')](_0x40964d,_0x1ee1('0x2d'));_0x80fbc[_0x1ee1('0x3b')]=_[_0x1ee1('0x3c')](_0x50340c[_0x1ee1('0x3b')]);_0x80fbc[_0x1ee1('0x3d')]=_[_0x1ee1('0x3e')](_0x80fbc[_0x1ee1('0x3a')],_0x80fbc[_0x1ee1('0x3b')]);_0xc72d91['attributes']=_[_0x1ee1('0x3e')](_0x80fbc[_0x1ee1('0x3a')],qs[_0x1ee1('0x3f')](_0x50340c[_0x1ee1('0x3b')][_0x1ee1('0x3f')]));_0xc72d91[_0x1ee1('0x40')]=_0xc72d91[_0x1ee1('0x40')][_0x1ee1('0x41')]?_0xc72d91[_0x1ee1('0x40')]:_0x80fbc[_0x1ee1('0x3a')];if(!_0x50340c[_0x1ee1('0x3b')][_0x1ee1('0x42')]('nolimit')){_0xc72d91[_0x1ee1('0x43')]=qs[_0x1ee1('0x43')](_0x50340c[_0x1ee1('0x3b')][_0x1ee1('0x43')]);_0xc72d91[_0x1ee1('0x23')]=qs[_0x1ee1('0x23')](_0x50340c[_0x1ee1('0x3b')]['offset']);}_0xc72d91[_0x1ee1('0x44')]=qs[_0x1ee1('0x45')](_0x50340c['query'][_0x1ee1('0x45')]);_0xc72d91['where']=qs['filters'](_[_0x1ee1('0x46')](_0x50340c[_0x1ee1('0x3b')],_0x80fbc['filters']),_0x40964d);var _0x1b5f05=[];var _0x395f8b=squel[_0x1ee1('0x47')]()[_0x1ee1('0x48')]('id')[_0x1ee1('0x48')]('name')['field'](_0x1ee1('0x49'))[_0x1ee1('0x4a')](_0x1ee1('0x4b'));var _0x51d960=squel[_0x1ee1('0x47')]()[_0x1ee1('0x48')](_0x1ee1('0x4c'))['field'](_0x1ee1('0x4d'))['field'](_0x1ee1('0x4e'))[_0x1ee1('0x4a')](_0x1ee1('0x4f'),'ui')[_0x1ee1('0x50')](_0x1ee1('0x51'),'u',_0x1ee1('0x52'));var _0x28a29c=squel[_0x1ee1('0x47')]()[_0x1ee1('0x4a')](_0x1ee1('0x53'),'i')['left_join'](_0x1ee1('0x54'),'c',_0x1ee1('0x55'))[_0x1ee1('0x50')]('users','o',_0x1ee1('0x56'))[_0x1ee1('0x50')](_0x1ee1('0x57'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0x1ee1('0x50')](_0x1ee1('0x58'),'me',_0x1ee1('0x59'))[_0x1ee1('0x50')]('whatsapp_interaction_has_tags','it',_0x1ee1('0x5a'))[_0x1ee1('0x50')](_0x1ee1('0x4b'),'t',_0x1ee1('0x5b'));var _0x58f7c6=squel['expr']();var _0x5ffe26=[];var _0x13462f=squel[_0x1ee1('0x5c')]();var _0x2798fb;if(_0x50340c['query'][_0x1ee1('0x5d')]){_0x2798fb=as[_0x1ee1('0x5e')](_0x50340c['query'][_0x1ee1('0x5d')]);var _0x345991=_0x2798fb[_0x1ee1('0x5f')];for(var _0x2f9049=0x0;_0x2f9049<_0x2798fb[_0x1ee1('0x60')][_0x1ee1('0x41')];_0x2f9049++){var _0x53287c=_0x2798fb[_0x1ee1('0x60')][_0x2f9049];var _0xb894af='i';var _0x40b8ff=_[_0x1ee1('0x61')](_0x40964d,[_0x1ee1('0x2d'),_0x53287c[_0x1ee1('0x48')]]);if(!_0x40b8ff){switch(_0x53287c['field']){case'unreadMessages':if(_0x53287c[_0x1ee1('0x62')]==0x1){_0x28a29c[_0x1ee1('0x63')]('`'+_0x53287c['field']+'`\x20=\x200');}else{_0x28a29c[_0x1ee1('0x63')]('`'+_0x53287c[_0x1ee1('0x48')]+_0x1ee1('0x64'));}break;case'Contact':if(_0x53287c[_0x1ee1('0x65')]===_0x1ee1('0x66')){if(_0x53287c[_0x1ee1('0x62')][_0x1ee1('0x67')]('\x20')[_0x1ee1('0x41')]>0x1){_0x58f7c6[_0x345991](_0x1ee1('0x68'),qs[_0x1ee1('0x69')](_0x53287c[_0x1ee1('0x62')]),null);}else{var _0x51a643='%'+_0x53287c['value']+'%';_0x58f7c6[_0x345991](_0x1ee1('0x6a'),_0x51a643,_0x51a643,_0x51a643);}}else{_0x40b8ff=_['find'](_0x40964d,['name',_0x1ee1('0x6b')]);_0x53287c['field']='ContactId';_0x229639=as[_0x1ee1('0x6c')](_0xb894af,_0x40b8ff[_0x1ee1('0x38')],_0x53287c);_0x58f7c6[_0x345991](_0x229639['text'],_0x229639[_0x1ee1('0x62')]['start'],_0x229639[_0x1ee1('0x62')][_0x1ee1('0x20')]);}break;case'Tag':var _0x117f90=_0x53287c[_0x1ee1('0x62')][_0x1ee1('0x67')](',')[_0x1ee1('0x34')](function(_0xf6499d){return Number(_0xf6499d);});_0x117f90[_0x1ee1('0x6d')](function(_0x3e0d09){_0x13462f['or'](_0x1ee1('0x6e'),'%,'+_0x3e0d09+',%');});_0x5ffe26=_[_0x1ee1('0x6f')](_0x5ffe26,_0x117f90);break;case _0x1ee1('0x70'):if(_0x53287c[_0x1ee1('0x65')]===_0x1ee1('0x66')){_0x58f7c6[_0x345991]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x53287c[_0x1ee1('0x62')]+'%',null);}else{_0x40b8ff=_[_0x1ee1('0x61')](_0x40964d,['name','UserId']);_0x53287c[_0x1ee1('0x48')]=_0x1ee1('0x71');_0x229639=as['buildExpression'](_0xb894af,_0x40b8ff[_0x1ee1('0x38')],_0x53287c);_0x58f7c6[_0x345991](_0x229639['text'],_0x229639[_0x1ee1('0x62')][_0x1ee1('0x72')],_0x229639[_0x1ee1('0x62')][_0x1ee1('0x20')]);}break;case _0x1ee1('0x73'):_0x229639=as[_0x1ee1('0x6c')]('me',null,_0x53287c);_0x58f7c6[_0x345991](_0x229639['text'],_0x229639[_0x1ee1('0x62')]['start'],_0x229639[_0x1ee1('0x62')][_0x1ee1('0x20')]);break;}}else{var _0x229639=as[_0x1ee1('0x6c')](_0xb894af,_0x40b8ff[_0x1ee1('0x38')],_0x53287c);_0x58f7c6[_0x345991](_0x229639[_0x1ee1('0x74')],_0x229639[_0x1ee1('0x62')][_0x1ee1('0x72')],_0x229639[_0x1ee1('0x62')]['end']);}}}else{var _0x4095d5=_(_0x50340c[_0x1ee1('0x3b')])[_0x1ee1('0x3c')]()['map'](function(_0xa91b85){return _[_0x1ee1('0x75')](_0x40964d,[_0x1ee1('0x2d'),_0xa91b85])?_0xa91b85:undefined;})[_0x1ee1('0x76')]()[_0x1ee1('0x62')]();if(!_[_0x1ee1('0x77')](_0x4095d5)){_0x4095d5[_0x1ee1('0x6d')](function(_0x37a6bd){if(_0x37a6bd===_0x1ee1('0x78')){_0x28a29c[_0x1ee1('0x79')](_0x1ee1('0x7a'),[]['concat'](_0x50340c['query'][_0x37a6bd]));}else if(_0x37a6bd===_0x1ee1('0x7b')){var _0x4d63b4=JSON['parse'](_0x50340c[_0x1ee1('0x3b')][_0x37a6bd])[_0x1ee1('0x7c')];var _0x58eec7=JSON['parse'](_0x50340c[_0x1ee1('0x3b')][_0x37a6bd])[_0x1ee1('0x7d')];_0x28a29c[_0x1ee1('0x79')](_0x1ee1('0x7e'),_0x4d63b4,_0x58eec7);}else{if(_0x50340c[_0x1ee1('0x3b')][_0x37a6bd]===_0x1ee1('0x7f')){_0x28a29c['where']('i.'+_0x37a6bd+_0x1ee1('0x80'));}else{_0x28a29c[_0x1ee1('0x79')]('i.'+_0x37a6bd+_0x1ee1('0x81'),_0x50340c[_0x1ee1('0x3b')][_0x37a6bd]);}}});}if(_0x50340c[_0x1ee1('0x3b')]['read']){if(_0x50340c[_0x1ee1('0x3b')][_0x1ee1('0x82')]==0x1){_0x28a29c['having'](_0x1ee1('0x83'));}else{_0x28a29c['having'](_0x1ee1('0x84'));}}if(_0x50340c[_0x1ee1('0x3b')]['tag']){_0x5ffe26=_['isArray'](_0x50340c[_0x1ee1('0x3b')][_0x1ee1('0x85')])?_0x50340c[_0x1ee1('0x3b')][_0x1ee1('0x85')]:new Array(_0x50340c[_0x1ee1('0x3b')][_0x1ee1('0x85')]);_0x5ffe26[_0x1ee1('0x6d')](function(_0x5eb139){_0x13462f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5eb139+',%');});}if(_0x50340c[_0x1ee1('0x3b')][_0x1ee1('0x86')]){var _0x4c6ba0=_0x50340c[_0x1ee1('0x3b')]['filter'][_0x1ee1('0x87')]('\x5c','\x5c\x5c')[_0x1ee1('0x87')](/'/g,'\x27\x27');if(qs[_0x1ee1('0x88')](_0x4c6ba0)){_0x58f7c6['or'](_0x1ee1('0x89'),_0x4c6ba0+'%')['or'](_0x1ee1('0x8a'),_0x4c6ba0+'%');}else{_0x58f7c6['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x1ee1('0x69')](_0x4c6ba0))['or'](_0x1ee1('0x8b'),_0x4c6ba0+'%');}}}_0x28a29c[_0x1ee1('0x79')](_0x58f7c6);_0x28a29c[_0x1ee1('0x8c')](_0x1ee1('0x8d'));var _0x45e580={'type':db['Sequelize'][_0x1ee1('0x8e')]['SELECT'],'raw':!![]};var _0x12394e=_0x28a29c[_0x1ee1('0x8f')]();_0x12394e['field']('i.id');_0x12394e[_0x1ee1('0x48')](_0x1ee1('0x90'),_0x1ee1('0x91'));if(_0xc72d91[_0x1ee1('0x44')]){_0xc72d91[_0x1ee1('0x44')][_0x1ee1('0x6d')](function(_0x435730){var _0x3d6edc=_0x435730[0x0]===_0x1ee1('0x92')?_0x435730[0x0]:'i.'+_0x435730[0x0];_0x28a29c[_0x1ee1('0x44')](_0x3d6edc,_0x435730[0x1]===_0x1ee1('0x93')?![]:!![]);});}if(!_[_0x1ee1('0x77')](_0x5ffe26)){_0x28a29c[_0x1ee1('0x63')](_0x13462f);_0x12394e[_0x1ee1('0x79')](_0x1ee1('0x94'),_0x5ffe26);}BPromise[_0x1ee1('0x95')]()[_0x1ee1('0x29')](function(){if(!_0x2798fb){if(_0x50340c[_0x1ee1('0x3b')][_0x1ee1('0x78')])return;_0x12394e['where'](_0x1ee1('0x96'));_0x28a29c[_0x1ee1('0x79')](_0x1ee1('0x96'));return;}if(_0x50340c[_0x1ee1('0x97')]['role']!=='agent')return;return _0x50340c[_0x1ee1('0x97')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x1ee1('0x29')](function(_0x3e78d6){if(_[_0x1ee1('0x77')](_0x3e78d6)){_0x12394e[_0x1ee1('0x79')](_0x1ee1('0x98'));_0x28a29c[_0x1ee1('0x79')](_0x1ee1('0x98'));}else{_0x12394e['where'](_0x1ee1('0x7a'),_[_0x1ee1('0x34')](_0x3e78d6,'id'));_0x28a29c[_0x1ee1('0x79')](_0x1ee1('0x7a'),_['map'](_0x3e78d6,'id'));}});})['then'](function(){if(_0x50340c[_0x1ee1('0x97')][_0x1ee1('0x99')]===_0x1ee1('0x9a')&&!_0x2798fb&&!_0x50340c['query']['WhatsappAccountId'])return[];return db[_0x1ee1('0x9b')][_0x1ee1('0x3b')](_0x12394e[_0x1ee1('0x9c')](),_0x45e580);})['then'](function(_0x2ec43e){_0x3d9e0a['count']=_0x2ec43e[_0x1ee1('0x41')];if(_0x3d9e0a['count']===0x0)return[];return db[_0x1ee1('0x9b')][_0x1ee1('0x3b')](_0x395f8b[_0x1ee1('0x9c')](),_0x45e580)[_0x1ee1('0x29')](function(_0x151096){_0x1b5f05=_[_0x1ee1('0x9d')](_0x151096,'id');_0x45e580=_[_0x1ee1('0x9e')](_0x45e580,{'model':db[_0x1ee1('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x50340c['query'][_0x1ee1('0x3f')]){_0xc72d91[_0x1ee1('0x40')][_0x1ee1('0x6d')](function(_0x31bc79){_0x28a29c[_0x1ee1('0x48')]('i.'+_0x31bc79);});}else{_0x28a29c[_0x1ee1('0x48')](_0x1ee1('0x90'),_0x1ee1('0x91'));_0x28a29c[_0x1ee1('0x48')](_0x1ee1('0x9f'),_0x1ee1('0xa0'));_0x28a29c[_0x1ee1('0x48')]('a.mandatoryDisposition',_0x1ee1('0xa1'));_0x28a29c[_0x1ee1('0x48')](_0x1ee1('0xa2'),'contactName');_0x28a29c[_0x1ee1('0x48')](_0x1ee1('0xa3'));_0x28a29c[_0x1ee1('0x48')](_0x1ee1('0xa4'),_0x1ee1('0xa5'));_0x28a29c[_0x1ee1('0x48')](_0x1ee1('0xa6'),_0x1ee1('0xa7'));_0x28a29c[_0x1ee1('0x48')](_0x1ee1('0xa8'),_0x1ee1('0xa9'));_0x28a29c[_0x1ee1('0x48')](_0x1ee1('0xaa'),_0x1ee1('0xab'));_0x28a29c[_0x1ee1('0x48')](_0x1ee1('0xac'),_0x1ee1('0xad'));_0x28a29c[_0x1ee1('0x48')](_0x1ee1('0xae'),_0x1ee1('0xaf'));_0x28a29c['field'](_0x1ee1('0xb0'),_0x1ee1('0xb1'));_0x28a29c[_0x1ee1('0x48')](_0x1ee1('0xb2'),_0x1ee1('0xb3'));_0x28a29c[_0x1ee1('0x48')](_0x1ee1('0xb4'),'TagIds');}if(_0xc72d91[_0x1ee1('0x43')])_0x28a29c[_0x1ee1('0x43')](_0xc72d91['limit']);if(_0xc72d91[_0x1ee1('0x23')])_0x28a29c[_0x1ee1('0x23')](_0xc72d91[_0x1ee1('0x23')]);return db['sequelize'][_0x1ee1('0x3b')](_0x28a29c['toString'](),_0x45e580);})[_0x1ee1('0x29')](function(_0x4db77b){_0x51d960['where'](_0x1ee1('0xb5'),_[_0x1ee1('0x34')](_0x4db77b,'id'));return db[_0x1ee1('0x9b')][_0x1ee1('0x3b')](_0x51d960[_0x1ee1('0x9c')](),_0x45e580)['then'](function(_0x3cd870){var _0x1e80ec=_['groupBy'](_0x3cd870,_0x1ee1('0xb6'));var _0x5e7764=[];_0x4db77b[_0x1ee1('0x6d')](function(_0x3d416a){_0x5e7764[_0x1ee1('0x31')](updateWhatsappInteraction(_0x3d416a,_0x1b5f05,_0x1e80ec));});return BPromise[_0x1ee1('0xb7')](_0x5e7764);});});})['then'](function(_0x3e3027){_0x3d9e0a[_0x1ee1('0xb8')]=_0x3e3027;return _0x3d9e0a;})[_0x1ee1('0x29')](respondWithFilteredResult(_0x208845,_0xc72d91))[_0x1ee1('0x32')](handleError(_0x208845,null));};exports[_0x1ee1('0xb9')]=function(_0x757adb,_0x2756b9){var _0x444ea1={'raw':![],'where':{'id':_0x757adb[_0x1ee1('0xba')]['id']}},_0xfa5bbb={};_0xfa5bbb[_0x1ee1('0x3a')]=_[_0x1ee1('0x3c')](db[_0x1ee1('0x35')]['rawAttributes']);_0xfa5bbb[_0x1ee1('0x3b')]=_[_0x1ee1('0x3c')](_0x757adb['query']);_0xfa5bbb[_0x1ee1('0x3d')]=_[_0x1ee1('0x3e')](_0xfa5bbb[_0x1ee1('0x3a')],_0xfa5bbb[_0x1ee1('0x3b')]);_0x444ea1[_0x1ee1('0x40')]=_['intersection'](_0xfa5bbb[_0x1ee1('0x3a')],qs[_0x1ee1('0x3f')](_0x757adb[_0x1ee1('0x3b')]['fields']));_0x444ea1['attributes']=_0x444ea1['attributes'][_0x1ee1('0x41')]?_0x444ea1[_0x1ee1('0x40')]:_0xfa5bbb[_0x1ee1('0x3a')];if(_0x757adb['query'][_0x1ee1('0xbb')]){_0x444ea1['include']=[{'all':!![]}];}_0x444ea1=_[_0x1ee1('0x9e')]({},_0x444ea1,_0x757adb['options']);return db[_0x1ee1('0x35')][_0x1ee1('0x61')](_0x444ea1)['then'](handleEntityNotFound(_0x2756b9,null))[_0x1ee1('0x29')](respondWithResult(_0x2756b9,null))['catch'](handleError(_0x2756b9,null));};exports[_0x1ee1('0xbc')]=function(_0x3a36c0,_0x29071a){return db[_0x1ee1('0x35')][_0x1ee1('0xbc')](_0x3a36c0[_0x1ee1('0x73')],{})['then'](respondWithResult(_0x29071a,0xc9))[_0x1ee1('0x32')](handleError(_0x29071a,null));};exports[_0x1ee1('0x28')]=function(_0x5991df,_0x50aa00){if(_0x5991df['body']['id']){delete _0x5991df[_0x1ee1('0x73')]['id'];}return db[_0x1ee1('0x35')]['find']({'where':{'id':_0x5991df[_0x1ee1('0xba')]['id']}})[_0x1ee1('0x29')](handleEntityNotFound(_0x50aa00,null))['then'](saveUpdates(_0x5991df[_0x1ee1('0x73')],null))[_0x1ee1('0x29')](respondWithResult(_0x50aa00,null))[_0x1ee1('0x32')](handleError(_0x50aa00,null));};exports[_0x1ee1('0x2a')]=function(_0x2cfb84,_0x4d26e9){return db['WhatsappInteraction'][_0x1ee1('0x61')]({'where':{'id':_0x2cfb84[_0x1ee1('0xba')]['id']}})[_0x1ee1('0x29')](handleEntityNotFound(_0x4d26e9,null))['then'](removeEntity(_0x4d26e9,null))[_0x1ee1('0x32')](handleError(_0x4d26e9,null));};exports[_0x1ee1('0xbd')]=function(_0x443e49,_0x3f2ab0){return db[_0x1ee1('0x35')][_0x1ee1('0xbd')]()['then'](respondWithResult(_0x3f2ab0,null))['catch'](handleError(_0x3f2ab0,null));};exports[_0x1ee1('0xbe')]=function(_0x3a073f,_0x2b43c7,_0x7167ed){return db['WhatsappMessage'][_0x1ee1('0x61')]({'where':{'id':_0x3a073f['params']['id']}})[_0x1ee1('0x29')](handleEntityNotFound(_0x2b43c7,null))[_0x1ee1('0x29')](function(_0x1364aa){if(_0x1364aa){return _0x1364aa[_0x1ee1('0xbe')](_0x3a073f[_0x1ee1('0x73')]['ids'],_[_0x1ee1('0xbf')](_0x3a073f[_0x1ee1('0x73')],[_0x1ee1('0xc0'),'id'])||{});}})['then'](respondWithResult(_0x2b43c7,null))[_0x1ee1('0x32')](handleError(_0x2b43c7,null));};exports[_0x1ee1('0xc1')]=function(_0x18d182,_0xd185dc,_0x3a0c1d){var _0x2abd29={'raw':![],'where':{}};var _0x483fbe={};var _0x390100={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x1ee1('0xc2')]({'where':{'id':_0x18d182[_0x1ee1('0xba')]['id']}})[_0x1ee1('0x29')](handleEntityNotFound(_0xd185dc,null))[_0x1ee1('0x29')](function(_0xb5cfde){if(_0xb5cfde){_0x483fbe[_0x1ee1('0x3a')]=_[_0x1ee1('0x3c')](db['WhatsappMessage'][_0x1ee1('0x36')]);_0x483fbe[_0x1ee1('0x3b')]=_['keys'](_0x18d182[_0x1ee1('0x3b')]);_0x483fbe['filters']=_[_0x1ee1('0x3e')](_0x483fbe[_0x1ee1('0x3a')],_0x483fbe[_0x1ee1('0x3b')]);_0x2abd29['attributes']=_[_0x1ee1('0x3e')](_0x483fbe[_0x1ee1('0x3a')],qs[_0x1ee1('0x3f')](_0x18d182['query'][_0x1ee1('0x3f')]));_0x2abd29[_0x1ee1('0x40')]=_0x2abd29[_0x1ee1('0x40')]['length']?_0x2abd29[_0x1ee1('0x40')]:_0x483fbe[_0x1ee1('0x3a')];if(!_0x18d182[_0x1ee1('0x3b')]['hasOwnProperty'](_0x1ee1('0xc3'))){_0x2abd29[_0x1ee1('0x43')]=qs[_0x1ee1('0x43')](_0x18d182['query'][_0x1ee1('0x43')]);_0x2abd29[_0x1ee1('0x23')]=qs[_0x1ee1('0x23')](_0x18d182[_0x1ee1('0x3b')][_0x1ee1('0x23')]);}_0x2abd29[_0x1ee1('0x44')]=qs[_0x1ee1('0x45')](_0x18d182[_0x1ee1('0x3b')]['sort']);_0x2abd29[_0x1ee1('0x79')]=qs[_0x1ee1('0x3d')](_['pick'](_0x18d182[_0x1ee1('0x3b')],_0x483fbe[_0x1ee1('0x3d')]));_0x2abd29[_0x1ee1('0x79')][_0x1ee1('0xb6')]=_0xb5cfde['id'];if(_0x18d182[_0x1ee1('0x3b')][_0x1ee1('0x86')]){_0x2abd29[_0x1ee1('0x79')]=_[_0x1ee1('0x9e')](_0x2abd29[_0x1ee1('0x79')],{'$or':_[_0x1ee1('0x34')](_0x2abd29[_0x1ee1('0x40')],function(_0x42c283){var _0x585ad3={};_0x585ad3[_0x42c283]={'$like':'%'+_0x18d182[_0x1ee1('0x3b')]['filter']+'%'};return _0x585ad3;})});}if(_0x18d182[_0x1ee1('0x3b')]['$gte']){var _0x44b353=_0x18d182[_0x1ee1('0x3b')][_0x1ee1('0x7c')][_0x1ee1('0x67')](',');var _0x57afeb={};_0x57afeb[_0x44b353[0x0]]={'$gte':moment(_0x44b353[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2abd29[_0x1ee1('0x79')]=_[_0x1ee1('0x9e')](_0x2abd29[_0x1ee1('0x79')],_0x57afeb);}_0x2abd29=_['merge']({},_0x2abd29,_0x18d182[_0x1ee1('0xc4')]);return db[_0x1ee1('0xc5')][_0x1ee1('0x22')]({'where':_0x2abd29['where']})['then'](function(_0x2f9b36){_0x390100[_0x1ee1('0x22')]=_0x2f9b36;if(_0x18d182['query']['includeAll']){_0x2abd29[_0x1ee1('0xc6')]=[{'all':!![]}];}return db[_0x1ee1('0xc5')]['findAll'](_0x2abd29);})[_0x1ee1('0x29')](function(_0x57747d){_0x390100['rows']=_0x57747d;return _0x390100;});}})[_0x1ee1('0x29')](respondWithFilteredResult(_0xd185dc,_0x2abd29))[_0x1ee1('0x32')](handleError(_0xd185dc,null));};exports[_0x1ee1('0xc7')]=function(_0x1acbf6,_0xd318fa,_0x17165f){return db[_0x1ee1('0x35')]['find']({'where':{'id':_0x1acbf6[_0x1ee1('0xba')]['id']}})['then'](handleEntityNotFound(_0xd318fa,null))[_0x1ee1('0x29')](function(_0x499866){if(_0x499866){return _0x499866[_0x1ee1('0xc8')](_0x1acbf6[_0x1ee1('0x73')][_0x1ee1('0xc0')],_[_0x1ee1('0xbf')](_0x1acbf6[_0x1ee1('0x73')],[_0x1ee1('0xc0'),'id'])||{})[_0x1ee1('0xc9')](function(){return db[_0x1ee1('0xca')][_0x1ee1('0xcb')]({'attributes':['id',_0x1ee1('0x2d'),_0x1ee1('0x49')],'where':{'id':_0x1acbf6[_0x1ee1('0x73')][_0x1ee1('0xc0')]}});})[_0x1ee1('0x29')](function(_0x2a121d){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x1acbf6['params']['id']),'tags':_0x2a121d||[]});return{'id':Number(_0x1acbf6['params']['id']),'tags':_0x2a121d||[]};});}})[_0x1ee1('0x29')](respondWithResult(_0xd318fa,null))[_0x1ee1('0x32')](handleError(_0xd318fa,null));};exports['removeTags']=function(_0x1797af,_0x42e7e7,_0x4ed766){return db['WhatsappInteraction'][_0x1ee1('0x61')]({'where':{'id':_0x1797af['params']['id']}})[_0x1ee1('0x29')](handleEntityNotFound(_0x42e7e7,null))['then'](function(_0x1c07b2){if(_0x1c07b2){return _0x1c07b2[_0x1ee1('0xcc')](_0x1797af[_0x1ee1('0x3b')]['ids']);}})[_0x1ee1('0x29')](respondWithStatusCode(_0x42e7e7,null))['catch'](handleError(_0x42e7e7,null));};exports['download']=function(_0x1f5bd4,_0x2229ac){var _0x3a2432=moment()['unix']()[_0x1ee1('0x9c')]();var _0x39f6ae=path['join'](config[_0x1ee1('0xcd')],'server','files',_0x1ee1('0xce'));var _0x480fcc=path[_0x1ee1('0xcf')](config[_0x1ee1('0xcd')],_0x1ee1('0xd0'),_0x1ee1('0xd1'),_0x1ee1('0xd2'));var _0x143217=path[_0x1ee1('0xcf')](_0x39f6ae,_0x3a2432);var _0x1b8cb8=util[_0x1ee1('0xd3')]('transcript-%d-%s.zip',_0x1f5bd4[_0x1ee1('0xba')]['id'],_0x3a2432);var _0x9cf71f=path[_0x1ee1('0xcf')](_0x39f6ae,_0x1b8cb8);var _0x1ee2b4=[];_0x1ee2b4[_0x1ee1('0x31')]({'model':db[_0x1ee1('0x70')],'as':_0x1ee1('0x70'),'attributes':['id',_0x1ee1('0x2e')],'raw':!![]});_0x1ee2b4['push']({'model':db[_0x1ee1('0xd4')],'as':_0x1ee1('0xd5'),'attributes':['id',_0x1ee1('0xd6'),_0x1ee1('0xd7')],'raw':!![]});if(_0x1f5bd4[_0x1ee1('0x3b')][_0x1ee1('0xd2')]){_0x1ee2b4[_0x1ee1('0x31')]({'model':db[_0x1ee1('0xd8')],'as':_0x1ee1('0xd8'),'raw':!![]});}var _0x40de9e=[{'model':db[_0x1ee1('0xc5')],'as':_0x1ee1('0xd9'),'attributes':['id',_0x1ee1('0x73'),_0x1ee1('0x7b'),'direction',_0x1ee1('0xda'),_0x1ee1('0x82')],'include':_0x1ee2b4}];_0x40de9e['push']({'model':db['WhatsappAccount'],'as':_0x1ee1('0xdb'),'attributes':['id','name']});_0x40de9e[_0x1ee1('0x31')]({'model':db[_0x1ee1('0x70')],'as':'Owner','attributes':['id',_0x1ee1('0x2e')]});return db[_0x1ee1('0x35')][_0x1ee1('0x61')]({'where':{'id':_0x1f5bd4[_0x1ee1('0xba')]['id']},'include':_0x40de9e})['then'](handleEntityNotFound(_0x2229ac,null))[_0x1ee1('0x29')](function(_0x36a848){if(_0x36a848){var _0x24a1e9=_0x36a848['get']({'plain':!![]});fs['mkdirSync'](_0x143217);var _0x42184c={'format':'A4','border':_0x1ee1('0xdc'),'header':{'height':'40px','contents':{'first':_0x1ee1('0xdd')}},'footer':{'height':'30px','contents':{'default':util[_0x1ee1('0xd3')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0x1ee1('0xd3')](_0x1ee1('0xde'),_0x1ee1('0xdf'),_0x24a1e9['id']),moment()[_0x1ee1('0xd3')](_0x1ee1('0xe0'))[_0x1ee1('0x9c')]())}}};var _0x19546d={'channel':_0x1ee1('0xdf'),'account':_0x24a1e9['Account']['name'],'agent':_0x24a1e9[_0x1ee1('0xe1')]?_0x24a1e9[_0x1ee1('0xe1')]['fullname']:'N.A.','createdAt':moment(_0x24a1e9[_0x1ee1('0x7b')])[_0x1ee1('0xd3')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x24a1e9[_0x1ee1('0xe2')]?moment(_0x24a1e9[_0x1ee1('0xe3')])[_0x1ee1('0xd3')](_0x1ee1('0xe4'))[_0x1ee1('0x9c')]():'','disposition':_0x24a1e9['disposition'],'messages':_(_0x24a1e9[_0x1ee1('0xd9')])[_0x1ee1('0x86')]({'secret':![]})[_0x1ee1('0x34')](function(_0x274b3b){if(_0x274b3b['Attachment']){var _0x2a7e02=path[_0x1ee1('0xcf')](_0x480fcc,_0x274b3b[_0x1ee1('0xd8')][_0x1ee1('0xe5')]);if(fs[_0x1ee1('0xe6')](_0x2a7e02)){fs[_0x1ee1('0xe7')](_0x2a7e02)[_0x1ee1('0xe8')](fs['createWriteStream'](path['join'](_0x143217,_0x274b3b[_0x1ee1('0xd8')]['basename'])));}}return{'date':moment(_0x274b3b['createdAt'])[_0x1ee1('0xd3')](_0x1ee1('0xe4'))[_0x1ee1('0x9c')](),'sender':_0x274b3b[_0x1ee1('0xe9')]===_0x1ee1('0xea')?_0x274b3b[_0x1ee1('0x70')]?_0x274b3b[_0x1ee1('0x70')]['fullname']:'System':_0x274b3b[_0x1ee1('0xd5')][_0x1ee1('0xd6')]+(_0x274b3b[_0x1ee1('0xd5')][_0x1ee1('0xd7')]?'\x20'+_0x274b3b[_0x1ee1('0xd5')][_0x1ee1('0xd7')]:''),'body':_0x274b3b[_0x1ee1('0xd8')]?_0x274b3b[_0x1ee1('0xd8')][_0x1ee1('0xe5')]:_0x274b3b['body'],'direction':_0x274b3b[_0x1ee1('0xe9')]===_0x1ee1('0xea')?'A':'C','secret':_0x274b3b[_0x1ee1('0xda')],'read':_0x274b3b[_0x1ee1('0x82')],'attachment':_0x274b3b['Attachment']};})['value']()};return ejs['renderFile'](path[_0x1ee1('0xcf')](config[_0x1ee1('0xcd')],_0x1ee1('0xd0'),_0x1ee1('0xeb'),'downloadInteraction.html'),{'interaction':_0x19546d})[_0x1ee1('0x29')](function(_0x398b83){return new BPromise(function(_0x214b04,_0x30ade6){pdf['create'](_0x398b83,_0x42184c)[_0x1ee1('0xec')](path[_0x1ee1('0xcf')](_0x143217,_0x1ee1('0xed')+_0x24a1e9['id']+'-'+_0x3a2432+_0x1ee1('0xee')),function(_0x3d8b7e,_0x23f265){if(_0x3d8b7e)return _0x30ade6(_0x3d8b7e);_0x214b04(_0x23f265);});});})['then'](function(){return new BPromise(function(_0xfd57ef,_0x4fb42d){zipdir(_0x143217,{'saveTo':_0x9cf71f},function(_0x2ff53a,_0x152f9f){if(_0x2ff53a)return _0x4fb42d(_0x2ff53a);return _0xfd57ef(_0x152f9f);});})[_0x1ee1('0x29')](function(){return new BPromise(function(_0x52cec6,_0x4a7213){rimraf(_0x143217,function(_0x553486){if(_0x553486)_0x4a7213(_0x553486);return _0x52cec6();});});})[_0x1ee1('0x29')](function(){return _0x2229ac[_0x1ee1('0xef')](_0x9cf71f,_0x1b8cb8,function(_0x36a211){if(_0x36a211){console['log'](_0x1ee1('0xf0'),_0x36a211);}else{fs['unlinkSync'](_0x9cf71f);}});});});}else{return _0x2229ac['sendStatus'](0xc8);}})[_0x1ee1('0x32')](handleError(_0x2229ac,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 674c436..f695e93 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 _0x74bd=['WhatsappInteraction','../../mysqldb','WhatsappMessage','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hook','exports','events'];(function(_0x171b2f,_0x337677){var _0x4678d8=function(_0x160fce){while(--_0x160fce){_0x171b2f['push'](_0x171b2f['shift']());}};_0x4678d8(++_0x337677);}(_0x74bd,0xdc));var _0xd74b=function(_0x487496,_0x249683){_0x487496=_0x487496-0x0;var _0x539dc8=_0x74bd[_0x487496];return _0x539dc8;};'use strict';var EventEmitter=require(_0xd74b('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xd74b('0x1')];var WhatsappMessage=require(_0xd74b('0x2'))['db'][_0xd74b('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd74b('0x4'),'afterDestroy':_0xd74b('0x5')};function emitEvent(_0x44a9a5){return function(_0x225139,_0xf3a0bb,_0x3ce21a){_0x225139[_0xd74b('0x6')]({'attributes':['id'],'raw':!![]})[_0xd74b('0x7')](function(_0x3c95ee){_0x225139[_0xd74b('0x8')](_0xd74b('0x9'),_0x3c95ee[_0xd74b('0xa')](function(_0xb33ed1){return{'id':_0xb33ed1['id']};}));return WhatsappMessage[_0xd74b('0xb')]({'where':{'WhatsappInteractionId':_0x225139['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4b60c0){_0x225139[_0xd74b('0x8')](_0xd74b('0xc'),_0x4b60c0[_0xd74b('0xd')]);WhatsappInteractionEvents[_0xd74b('0xe')](_0x44a9a5+':'+_0x225139['id'],_0x225139);WhatsappInteractionEvents[_0xd74b('0xe')](_0x44a9a5,_0x225139);_0x3ce21a(null);})['catch'](_0x3ce21a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0xd74b('0xf')](e,emitEvent(event));}}module[_0xd74b('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x9ddc=['map','findAll','emit','hook','exports','events','../../mysqldb','WhatsappInteraction','setMaxListeners','save','remove','getUsers','then','setDataValue'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9ddc,0x171));var _0xc9dd=function(_0x4743d3,_0x6735a0){_0x4743d3=_0x4743d3-0x0;var _0x1197f7=_0x9ddc[_0x4743d3];return _0x1197f7;};'use strict';var EventEmitter=require(_0xc9dd('0x0'));var WhatsappInteraction=require(_0xc9dd('0x1'))['db'][_0xc9dd('0x2')];var WhatsappMessage=require(_0xc9dd('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xc9dd('0x3')](0x0);var events={'afterCreate':_0xc9dd('0x4'),'afterUpdate':'update','afterDestroy':_0xc9dd('0x5')};function emitEvent(_0x4157c8){return function(_0x25e0ae,_0x136820,_0x280fdd){_0x25e0ae[_0xc9dd('0x6')]({'attributes':['id'],'raw':!![]})[_0xc9dd('0x7')](function(_0x676a8){_0x25e0ae[_0xc9dd('0x8')]('Users',_0x676a8[_0xc9dd('0x9')](function(_0x32715c){return{'id':_0x32715c['id']};}));return WhatsappMessage[_0xc9dd('0xa')]({'where':{'WhatsappInteractionId':_0x25e0ae['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc9dd('0x7')](function(_0x294459){_0x25e0ae['setDataValue']('unreadMessages',_0x294459['length']);WhatsappInteractionEvents['emit'](_0x4157c8+':'+_0x25e0ae['id'],_0x25e0ae);WhatsappInteractionEvents[_0xc9dd('0xb')](_0x4157c8,_0x25e0ae);_0x280fdd(null);})['catch'](_0x280fdd(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0xc9dd('0xc')](e,emitEvent(event));}}module[_0xc9dd('0xd')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index c469817..910cf62 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 _0x9e7b=['whatsapp_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','./whatsappInteraction.attributes','define','WhatsappInteraction'];(function(_0x5883ee,_0x5f0294){var _0x40b7cc=function(_0x362f78){while(--_0x362f78){_0x5883ee['push'](_0x5883ee['shift']());}};_0x40b7cc(++_0x5f0294);}(_0x9e7b,0x19b));var _0xb9e7=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x9e7b[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0xb9e7('0x0'));var util=require('util');var logger=require(_0xb9e7('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb9e7('0x2'));var rp=require(_0xb9e7('0x3'));var fs=require('fs');var path=require(_0xb9e7('0x4'));var rimraf=require('rimraf');var config=require(_0xb9e7('0x5'));var attributes=require(_0xb9e7('0x6'));module['exports']=function(_0x4f390a,_0x3d0b6e){return _0x4f390a[_0xb9e7('0x7')](_0xb9e7('0x8'),attributes,{'tableName':_0xb9e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5af037,_0x278c4c,_0x2d566b){if(_0x5af037[_0xb9e7('0xa')](_0xb9e7('0xb'))){_0x5af037['closedAt']=moment()[_0xb9e7('0xc')](_0xb9e7('0xd'));}_0x2d566b(null,_0x5af037);}}});}; \ No newline at end of file +var _0x2f59=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','changed','closed','format'];(function(_0x458775,_0x523411){var _0x48eb06=function(_0x98a4ac){while(--_0x98a4ac){_0x458775['push'](_0x458775['shift']());}};_0x48eb06(++_0x523411);}(_0x2f59,0x96));var _0x92f5=function(_0xfbc931,_0x2fb6bc){_0xfbc931=_0xfbc931-0x0;var _0x4e11f8=_0x2f59[_0xfbc931];return _0x4e11f8;};'use strict';var _=require(_0x92f5('0x0'));var util=require(_0x92f5('0x1'));var logger=require('../../config/logger')(_0x92f5('0x2'));var moment=require(_0x92f5('0x3'));var BPromise=require(_0x92f5('0x4'));var rp=require(_0x92f5('0x5'));var fs=require('fs');var path=require(_0x92f5('0x6'));var rimraf=require(_0x92f5('0x7'));var config=require('../../config/environment');var attributes=require(_0x92f5('0x8'));module[_0x92f5('0x9')]=function(_0x2ba22c,_0x27a8c3){return _0x2ba22c[_0x92f5('0xa')](_0x92f5('0xb'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x30ec69,_0x39ab1b,_0x14f835){if(_0x30ec69[_0x92f5('0xc')](_0x92f5('0xd'))){_0x30ec69['closedAt']=moment()[_0x92f5('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x14f835(null,_0x30ec69);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 2533cc9..9cabeaf 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 _0xa354=['request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateWhatsappInteraction','WhatsappInteraction','body','options','raw','attributes','limit','debug','catch','AddTagsToWhatsappInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','./whatsappInteraction.socket','register'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xa354,0xc4));var _0x4a35=function(_0x51b3f8,_0x3af09f){_0x51b3f8=_0x51b3f8-0x0;var _0x261fa3=_0xa354[_0x51b3f8];return _0x261fa3;};'use strict';var _=require(_0x4a35('0x0'));var util=require(_0x4a35('0x1'));var moment=require(_0x4a35('0x2'));var BPromise=require(_0x4a35('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4a35('0x4'));var logger=require(_0x4a35('0x5'))('rpc');var config=require(_0x4a35('0x6'));var jayson=require(_0x4a35('0x7'));var client=jayson[_0x4a35('0x8')][_0x4a35('0x9')]({'port':0x232a});config[_0x4a35('0xa')]=_[_0x4a35('0xb')](config[_0x4a35('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4a35('0xa')]));require(_0x4a35('0xc'))[_0x4a35('0xd')](socket);function respondWithRpcPromise(_0xa5046d,_0x5b2535,_0x1110f0){return new BPromise(function(_0x2ecadf,_0x234711){return client[_0x4a35('0xe')](_0xa5046d,_0x1110f0)[_0x4a35('0xf')](function(_0x7527b8){logger[_0x4a35('0x10')](_0x4a35('0x11'),_0x5b2535,_0x4a35('0x12'));logger['debug'](_0x4a35('0x13'),_0x5b2535,'request\x20sent',JSON[_0x4a35('0x14')](_0x7527b8));if(_0x7527b8[_0x4a35('0x15')]){if(_0x7527b8[_0x4a35('0x15')][_0x4a35('0x16')]===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x5b2535,_0x7527b8[_0x4a35('0x15')][_0x4a35('0x17')]);return _0x234711(_0x7527b8[_0x4a35('0x15')]['message']);}logger['error'](_0x4a35('0x11'),_0x5b2535,_0x7527b8['error']['message']);return _0x2ecadf(_0x7527b8[_0x4a35('0x15')]['message']);}else{logger[_0x4a35('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x5b2535,_0x4a35('0x12'));_0x2ecadf(_0x7527b8[_0x4a35('0x18')][_0x4a35('0x17')]);}})['catch'](function(_0x4122e7){logger['error'](_0x4a35('0x11'),_0x5b2535,_0x4122e7);_0x234711(_0x4122e7);});});}exports[_0x4a35('0x19')]=function(_0xe9c6c4){var _0x50249e=this;return new Promise(function(_0x5c431d,_0x5613a0){return db[_0x4a35('0x1a')]['update'](_0xe9c6c4[_0x4a35('0x1b')],{'raw':_0xe9c6c4[_0x4a35('0x1c')]?_0xe9c6c4[_0x4a35('0x1c')][_0x4a35('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe9c6c4[_0x4a35('0x1c')]?_0xe9c6c4[_0x4a35('0x1c')]['where']||null:null,'attributes':_0xe9c6c4[_0x4a35('0x1c')]?_0xe9c6c4[_0x4a35('0x1c')][_0x4a35('0x1e')]||null:null,'limit':_0xe9c6c4['options']?_0xe9c6c4[_0x4a35('0x1c')][_0x4a35('0x1f')]||null:null})[_0x4a35('0xf')](function(_0x59f954){logger['info']('UpdateWhatsappInteraction',_0xe9c6c4);logger[_0x4a35('0x20')](_0x4a35('0x19'),_0xe9c6c4,JSON[_0x4a35('0x14')](_0x59f954));_0x5c431d(_0x59f954);})[_0x4a35('0x21')](function(_0x172103){logger[_0x4a35('0x15')](_0x4a35('0x19'),_0x172103[_0x4a35('0x17')],_0xe9c6c4);_0x5613a0(_0x50249e[_0x4a35('0x15')](0x1f4,_0x172103['message']));});});};exports[_0x4a35('0x22')]=function(_0x1ebdc0){return new Promise(function(_0x2147b6,_0x24c71e){return db[_0x4a35('0x1a')][_0x4a35('0x23')]({'where':_0x1ebdc0[_0x4a35('0x1c')]?_0x1ebdc0[_0x4a35('0x1c')][_0x4a35('0x24')]||null:null})['then'](function(_0x4ddac3){if(_0x4ddac3){return _0x4ddac3[_0x4a35('0x25')](_0x1ebdc0[_0x4a35('0x1b')][_0x4a35('0x26')],_[_0x4a35('0x27')](_0x1ebdc0[_0x4a35('0x1b')],['ids','id'])||{});}})[_0x4a35('0x28')](function(_0x2816a1){logger['info'](_0x4a35('0x29'),_0x1ebdc0);logger[_0x4a35('0x20')]('AddTags',_0x1ebdc0,JSON[_0x4a35('0x14')](_0x2816a1));_0x2147b6(_0x2816a1);})[_0x4a35('0x21')](function(_0x492c09){logger['error'](_0x4a35('0x29'),_0x492c09[_0x4a35('0x17')],_0x1ebdc0);_0x24c71e(_this[_0x4a35('0x15')](0x1f4,_0x492c09['message']));});});}; \ No newline at end of file +var _0x21a6=['redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','AddTagsToWhatsappInteraction','find','addTags','ids','omit','AddTags','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xce4c29,_0x4029e5){var _0x3e7922=function(_0x17c742){while(--_0x17c742){_0xce4c29['push'](_0xce4c29['shift']());}};_0x3e7922(++_0x4029e5);}(_0x21a6,0x1c4));var _0x621a=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x21a6[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x621a('0x0'));var util=require(_0x621a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x621a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x621a('0x3'))['db'];var utils=require(_0x621a('0x4'));var logger=require(_0x621a('0x5'))(_0x621a('0x6'));var config=require(_0x621a('0x7'));var jayson=require(_0x621a('0x8'));var client=jayson[_0x621a('0x9')]['http']({'port':0x232a});config[_0x621a('0xa')]=_[_0x621a('0xb')](config[_0x621a('0xa')],{'host':_0x621a('0xc'),'port':0x18eb});var socket=require(_0x621a('0xd'))(new Redis(config['redis']));require(_0x621a('0xe'))[_0x621a('0xf')](socket);function respondWithRpcPromise(_0x4b6ef2,_0xfbe0db,_0x1f83b0){return new BPromise(function(_0x1cdda2,_0x2c7151){return client[_0x621a('0x10')](_0x4b6ef2,_0x1f83b0)[_0x621a('0x11')](function(_0x47fd15){logger['info'](_0x621a('0x12'),_0xfbe0db,'request\x20sent');logger[_0x621a('0x13')](_0x621a('0x14'),_0xfbe0db,_0x621a('0x15'),JSON[_0x621a('0x16')](_0x47fd15));if(_0x47fd15[_0x621a('0x17')]){if(_0x47fd15[_0x621a('0x17')]['code']===0x1f4){logger[_0x621a('0x17')](_0x621a('0x12'),_0xfbe0db,_0x47fd15[_0x621a('0x17')][_0x621a('0x18')]);return _0x2c7151(_0x47fd15[_0x621a('0x17')]['message']);}logger['error'](_0x621a('0x12'),_0xfbe0db,_0x47fd15[_0x621a('0x17')][_0x621a('0x18')]);return _0x1cdda2(_0x47fd15[_0x621a('0x17')][_0x621a('0x18')]);}else{logger[_0x621a('0x19')]('WhatsappInteraction,\x20%s,\x20%s',_0xfbe0db,_0x621a('0x15'));_0x1cdda2(_0x47fd15[_0x621a('0x1a')][_0x621a('0x18')]);}})[_0x621a('0x1b')](function(_0x2ef751){logger['error'](_0x621a('0x12'),_0xfbe0db,_0x2ef751);_0x2c7151(_0x2ef751);});});}exports[_0x621a('0x1c')]=function(_0x1c7935){var _0x438d1c=this;return new Promise(function(_0x27579f,_0x32a7e1){return db[_0x621a('0x1d')][_0x621a('0x1e')](_0x1c7935[_0x621a('0x1f')],{'raw':_0x1c7935[_0x621a('0x20')]?_0x1c7935[_0x621a('0x20')][_0x621a('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c7935['options']?_0x1c7935[_0x621a('0x20')][_0x621a('0x22')]||null:null,'attributes':_0x1c7935[_0x621a('0x20')]?_0x1c7935[_0x621a('0x20')][_0x621a('0x23')]||null:null,'limit':_0x1c7935['options']?_0x1c7935[_0x621a('0x20')]['limit']||null:null})[_0x621a('0x11')](function(_0x19fcd9){logger[_0x621a('0x19')]('UpdateWhatsappInteraction',_0x1c7935);logger[_0x621a('0x13')](_0x621a('0x1c'),_0x1c7935,JSON[_0x621a('0x16')](_0x19fcd9));_0x27579f(_0x19fcd9);})['catch'](function(_0x2bfd00){logger[_0x621a('0x17')](_0x621a('0x1c'),_0x2bfd00[_0x621a('0x18')],_0x1c7935);_0x32a7e1(_0x438d1c[_0x621a('0x17')](0x1f4,_0x2bfd00[_0x621a('0x18')]));});});};exports[_0x621a('0x24')]=function(_0x43f491){return new Promise(function(_0x593ea2,_0x318326){return db['WhatsappInteraction'][_0x621a('0x25')]({'where':_0x43f491[_0x621a('0x20')]?_0x43f491[_0x621a('0x20')][_0x621a('0x22')]||null:null})[_0x621a('0x11')](function(_0x49aaf2){if(_0x49aaf2){return _0x49aaf2[_0x621a('0x26')](_0x43f491[_0x621a('0x1f')][_0x621a('0x27')],_[_0x621a('0x28')](_0x43f491[_0x621a('0x1f')],[_0x621a('0x27'),'id'])||{});}})['spread'](function(_0x5ac564){logger[_0x621a('0x19')](_0x621a('0x29'),_0x43f491);logger[_0x621a('0x13')](_0x621a('0x29'),_0x43f491,JSON[_0x621a('0x16')](_0x5ac564));_0x593ea2(_0x5ac564);})[_0x621a('0x1b')](function(_0x5457fe){logger['error']('AddTags',_0x5457fe[_0x621a('0x18')],_0x43f491);_0x318326(_this[_0x621a('0x17')](0x1f4,_0x5457fe['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index bc12989..8d8f49e 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 _0x1cf4=['register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit','removeListener'];(function(_0x399388,_0x378aeb){var _0x41b8a2=function(_0xdfb5a1){while(--_0xdfb5a1){_0x399388['push'](_0x399388['shift']());}};_0x41b8a2(++_0x378aeb);}(_0x1cf4,0x174));var _0x41cf=function(_0x493389,_0x18102d){_0x493389=_0x493389-0x0;var _0x502246=_0x1cf4[_0x493389];return _0x502246;};'use strict';var WhatsappInteractionEvents=require(_0x41cf('0x0'));var events=[_0x41cf('0x1'),_0x41cf('0x2'),_0x41cf('0x3')];function createListener(_0x5724b5,_0x3c9c4a){return function(_0x352fc1){_0x3c9c4a[_0x41cf('0x4')](_0x5724b5,_0x352fc1);};}function removeListener(_0x31f460,_0x39f512){return function(){WhatsappInteractionEvents[_0x41cf('0x5')](_0x31f460,_0x39f512);};}exports[_0x41cf('0x6')]=function(_0x52a58d){for(var _0x1b91c7=0x0,_0x39475a=events[_0x41cf('0x7')];_0x1b91c7<_0x39475a;_0x1b91c7++){var _0x12c023=events[_0x1b91c7];var _0x117d22=createListener(_0x41cf('0x8')+_0x12c023,_0x52a58d);WhatsappInteractionEvents['on'](_0x12c023,_0x117d22);}}; \ No newline at end of file +var _0x0f5e=['removeListener','register','length','save','remove','update','emit'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x0f5e,0x184));var _0xe0f5=function(_0x569bd0,_0x4766e){_0x569bd0=_0x569bd0-0x0;var _0x42c0fc=_0x0f5e[_0x569bd0];return _0x42c0fc;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xe0f5('0x0'),_0xe0f5('0x1'),_0xe0f5('0x2')];function createListener(_0x1acaa0,_0x3a5a06){return function(_0x3946ea){_0x3a5a06[_0xe0f5('0x3')](_0x1acaa0,_0x3946ea);};}function removeListener(_0x5616e5,_0x39d82d){return function(){WhatsappInteractionEvents[_0xe0f5('0x4')](_0x5616e5,_0x39d82d);};}exports[_0xe0f5('0x5')]=function(_0x7f38d7){for(var _0x2a17ba=0x0,_0x5c3ea5=events[_0xe0f5('0x6')];_0x2a17ba<_0x5c3ea5;_0x2a17ba++){var _0x1c5599=events[_0x2a17ba];var _0x4b8272=createListener('whatsappInteraction:'+_0x1c5599,_0x7f38d7);WhatsappInteractionEvents['on'](_0x1c5599,_0x4b8272);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 6f21e78..44fed83 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 _0x1cb9=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','/:id/accept','accept','reject','destroy','exports','multer','path'];(function(_0x3c4276,_0x21d8b0){var _0x31e4ab=function(_0x332a82){while(--_0x332a82){_0x3c4276['push'](_0x3c4276['shift']());}};_0x31e4ab(++_0x21d8b0);}(_0x1cb9,0x14e));var _0x91cb=function(_0x374447,_0x48f219){_0x374447=_0x374447-0x0;var _0x8509e9=_0x1cb9[_0x374447];return _0x8509e9;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')]('/',auth[_0x91cb('0x9')](),interaction[_0x91cb('0x10')](_0x91cb('0x11'),_0x91cb('0x12')),controller[_0x91cb('0x13')]);router[_0x91cb('0xf')](_0x91cb('0x14'),controller[_0x91cb('0x15')]);router['put'](_0x91cb('0xd'),auth[_0x91cb('0x9')](),controller['update']);router[_0x91cb('0x16')](_0x91cb('0x17'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x18')]);router['put']('/:id/reject',auth[_0x91cb('0x9')](),controller[_0x91cb('0x19')]);router['delete']('/:id',auth[_0x91cb('0x9')](),controller[_0x91cb('0x1a')]);module[_0x91cb('0x1b')]=router; \ No newline at end of file +var _0x2d17=['describe','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','/:id','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated'];(function(_0x4467c4,_0x582fbd){var _0x3085ec=function(_0x418196){while(--_0x418196){_0x4467c4['push'](_0x4467c4['shift']());}};_0x3085ec(++_0x582fbd);}(_0x2d17,0x17e));var _0x72d1=function(_0x495320,_0x54e457){_0x495320=_0x495320-0x0;var _0x2d4e9d=_0x2d17[_0x495320];return _0x2d4e9d;};'use strict';var multer=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var path=require('path');var timeout=require(_0x72d1('0x2'));var express=require(_0x72d1('0x3'));var router=express['Router']();var fs_extra=require(_0x72d1('0x4'));var auth=require(_0x72d1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x72d1('0x6'));var controller=require('./whatsappMessage.controller');router[_0x72d1('0x7')]('/',auth['isAuthenticated'](),controller[_0x72d1('0x8')]);router[_0x72d1('0x7')]('/describe',auth[_0x72d1('0x9')](),controller[_0x72d1('0xa')]);router[_0x72d1('0x7')]('/:id',auth[_0x72d1('0x9')](),controller[_0x72d1('0xb')]);router[_0x72d1('0xc')]('/',auth['isAuthenticated'](),interaction[_0x72d1('0xd')](_0x72d1('0xe'),_0x72d1('0xf')),controller[_0x72d1('0x10')]);router[_0x72d1('0xc')](_0x72d1('0x11'),controller[_0x72d1('0x12')]);router[_0x72d1('0x13')](_0x72d1('0x14'),auth[_0x72d1('0x9')](),controller['update']);router[_0x72d1('0x13')](_0x72d1('0x15'),auth[_0x72d1('0x9')](),controller[_0x72d1('0x16')]);router[_0x72d1('0x13')](_0x72d1('0x17'),auth[_0x72d1('0x9')](),controller[_0x72d1('0x18')]);router[_0x72d1('0x19')](_0x72d1('0x14'),auth[_0x72d1('0x9')](),controller[_0x72d1('0x1a')]);module[_0x72d1('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 90e5bfa..6835d2d 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 _0x61e8=['BOOLEAN','ENUM','out','STRING','DATE','TEXT','sequelize','exports','medium'];(function(_0x2534cf,_0x545be6){var _0x221461=function(_0x379e83){while(--_0x379e83){_0x2534cf['push'](_0x2534cf['shift']());}};_0x221461(++_0x545be6);}(_0x61e8,0x14a));var _0x861e=function(_0x293218,_0x444d81){_0x293218=_0x293218-0x0;var _0x1bf716=_0x61e8[_0x293218];return _0x1bf716;};'use strict';var Sequelize=require(_0x861e('0x0'));module[_0x861e('0x1')]={'body':{'type':Sequelize['TEXT'](_0x861e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x861e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x861e('0x4')]('in',_0x861e('0x5')),'defaultValue':_0x861e('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x861e('0x6')](0xbe)},'phone':{'type':Sequelize[_0x861e('0x6')]},'readAt':{'type':Sequelize[_0x861e('0x7')]},'secret':{'type':Sequelize[_0x861e('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x861e('0x6')]},'providerResponse':{'type':Sequelize[_0x861e('0x8')]}}; \ No newline at end of file +var _0x2f16=['sequelize','exports','TEXT','medium','BOOLEAN','out','STRING','DATE'];(function(_0x2b7b9d,_0x89a529){var _0x57e721=function(_0x3ee189){while(--_0x3ee189){_0x2b7b9d['push'](_0x2b7b9d['shift']());}};_0x57e721(++_0x89a529);}(_0x2f16,0x178));var _0x62f1=function(_0x21e6ef,_0x54469c){_0x21e6ef=_0x21e6ef-0x0;var _0x12c919=_0x2f16[_0x21e6ef];return _0x12c919;};'use strict';var Sequelize=require(_0x62f1('0x0'));module[_0x62f1('0x1')]={'body':{'type':Sequelize[_0x62f1('0x2')](_0x62f1('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x62f1('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x62f1('0x5')),'defaultValue':_0x62f1('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x62f1('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x62f1('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x62f1('0x6')]},'providerResponse':{'type':Sequelize[_0x62f1('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 8028561..6e6177e 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 _0x8d66=['localhost','socket.io-emitter','jayson/promise','http','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','then','sendStatus','name','send','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','WhatsappMessage','findAll','rows','show','find','create','update','body','params','describe','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','WhatsappInteraction','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','channel','event','accept','whatsapp-interactions','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SIP/%s','EventManager','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x546274,_0x206dd6){var _0x4e63f4=function(_0x3e3049){while(--_0x3e3049){_0x546274['push'](_0x546274['shift']());}};_0x4e63f4(++_0x206dd6);}(_0x8d66,0x1e1));var _0x68d6=function(_0xbfe236,_0x36b812){_0xbfe236=_0xbfe236-0x0;var _0x2831f0=_0x8d66[_0xbfe236];return _0x2831f0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x68d6('0x0'));var rimraf=require(_0x68d6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x68d6('0x2'));var rp=require(_0x68d6('0x3'));var moment=require(_0x68d6('0x4'));var BPromise=require(_0x68d6('0x5'));var Mustache=require(_0x68d6('0x6'));var util=require(_0x68d6('0x7'));var path=require(_0x68d6('0x8'));var sox=require(_0x68d6('0x9'));var csv=require(_0x68d6('0xa'));var ejs=require(_0x68d6('0xb'));var fs=require('fs');var fs_extra=require(_0x68d6('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x68d6('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x68d6('0xe'));var Papa=require(_0x68d6('0xf'));var Redis=require(_0x68d6('0x10'));var authService=require(_0x68d6('0x11'));var qs=require(_0x68d6('0x12'));var as=require(_0x68d6('0x13'));var hardwareService=require(_0x68d6('0x14'));var logger=require(_0x68d6('0x15'))('api');var utils=require(_0x68d6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x68d6('0x17'));var db=require(_0x68d6('0x18'))['db'];config[_0x68d6('0x19')]=_[_0x68d6('0x1a')](config[_0x68d6('0x19')],{'host':_0x68d6('0x1b'),'port':0x18eb});var socket=require(_0x68d6('0x1c'))(new Redis(config[_0x68d6('0x19')]));require('./whatsappMessage.socket')['register'](socket);var jayson=require(_0x68d6('0x1d'));var client=jayson['client'][_0x68d6('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x68d6('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4b7564,_0x5d7bec,_0x5f4a1d,_0x5eb05b){return new BPromise(function(_0x580982,_0x499cdc){var _0x3270f2=_0x5eb05b||client;return _0x3270f2['request'](_0x4b7564,_0x5f4a1d)['then'](function(_0x3e0078){logger['info'](_0x68d6('0x1f'),_0x5d7bec,_0x68d6('0x20'));logger[_0x68d6('0x21')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x5d7bec,_0x68d6('0x20'),JSON[_0x68d6('0x22')](_0x3e0078));if(_0x3e0078['error']){if(_0x3e0078[_0x68d6('0x23')][_0x68d6('0x24')]===0x1f4){logger[_0x68d6('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x5d7bec,_0x3e0078[_0x68d6('0x23')]['message']);return _0x499cdc(_0x3e0078[_0x68d6('0x23')][_0x68d6('0x25')]);}logger[_0x68d6('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x5d7bec,_0x3e0078[_0x68d6('0x23')][_0x68d6('0x25')]);return _0x580982(_0x3e0078[_0x68d6('0x23')][_0x68d6('0x25')]);}else{logger[_0x68d6('0x26')](_0x68d6('0x1f'),_0x5d7bec,_0x68d6('0x20'));_0x580982(_0x3e0078[_0x68d6('0x27')][_0x68d6('0x25')]);}})[_0x68d6('0x28')](function(_0x5a1628){logger[_0x68d6('0x23')](_0x68d6('0x1f'),_0x5d7bec,_0x5a1628);_0x499cdc(_0x5a1628);});});}function respondWithStatusCode(_0x45a36b,_0x3d703e){_0x3d703e=_0x3d703e||0xcc;return function(_0x37f50c){if(_0x37f50c){return _0x45a36b['sendStatus'](_0x3d703e);}return _0x45a36b[_0x68d6('0x29')](_0x3d703e)[_0x68d6('0x2a')]();};}function respondWithResult(_0x2b0b5f,_0x53ec47){_0x53ec47=_0x53ec47||0xc8;return function(_0x2c3a8c){if(_0x2c3a8c){return _0x2b0b5f[_0x68d6('0x29')](_0x53ec47)[_0x68d6('0x2b')](_0x2c3a8c);}};}function respondWithFilteredResult(_0x12369f,_0x494fa5){return function(_0x41f596){if(_0x41f596){var _0x244134=_0x41f596[_0x68d6('0x2c')],_0x1b23a5=_0x494fa5['offset'],_0x5696b9=_0x494fa5[_0x68d6('0x2d')]+_0x494fa5['limit'],_0x46e2fa;if(_0x5696b9>=_0x244134){_0x5696b9=_0x244134;_0x46e2fa=0xc8;}else{_0x46e2fa=0xce;}_0x12369f[_0x68d6('0x29')](_0x46e2fa);return _0x12369f[_0x68d6('0x2e')](_0x68d6('0x2f'),_0x1b23a5+'-'+_0x5696b9+'/'+_0x244134)[_0x68d6('0x2b')](_0x41f596);}return null;};}function patchUpdates(_0x5b6fa2){return function(_0x1a395f){try{jsonpatch[_0x68d6('0x30')](_0x1a395f,_0x5b6fa2,!![]);}catch(_0x2d1794){return BPromise[_0x68d6('0x31')](_0x2d1794);}return _0x1a395f[_0x68d6('0x32')]();};}function saveUpdates(_0x529747,_0x143e34){return function(_0x34eb3b){if(_0x34eb3b){return _0x34eb3b['update'](_0x529747)['then'](function(_0x23b419){return _0x23b419;});}return null;};}function removeEntity(_0x56f189,_0x3a9f02){return function(_0x29b729){if(_0x29b729){return _0x29b729[_0x68d6('0x33')]()[_0x68d6('0x34')](function(){_0x56f189[_0x68d6('0x29')](0xcc)[_0x68d6('0x2a')]();});}};}function handleEntityNotFound(_0x3ac94f,_0x4074c4){return function(_0xb25f97){if(!_0xb25f97){_0x3ac94f[_0x68d6('0x35')](0x194);}return _0xb25f97;};}function handleError(_0x239b0a,_0x40f5c1){_0x40f5c1=_0x40f5c1||0x1f4;return function(_0xe10b95){logger['error'](_0xe10b95['stack']);if(_0xe10b95[_0x68d6('0x36')]){delete _0xe10b95['name'];}_0x239b0a['status'](_0x40f5c1)[_0x68d6('0x37')](_0xe10b95);};}exports['index']=function(_0x4820ac,_0x172fe9){var _0x17e2d8={},_0x187c8a={},_0x58d752={'count':0x0,'rows':[]};var _0x46f8f1=_['map'](db['WhatsappMessage'][_0x68d6('0x38')],function(_0x5c1e39){return{'name':_0x5c1e39['fieldName'],'type':_0x5c1e39[_0x68d6('0x39')][_0x68d6('0x3a')]};});_0x187c8a['model']=_[_0x68d6('0x3b')](_0x46f8f1,_0x68d6('0x36'));_0x187c8a[_0x68d6('0x3c')]=_[_0x68d6('0x3d')](_0x4820ac[_0x68d6('0x3c')]);_0x187c8a[_0x68d6('0x3e')]=_[_0x68d6('0x3f')](_0x187c8a[_0x68d6('0x40')],_0x187c8a['query']);_0x17e2d8[_0x68d6('0x41')]=_['intersection'](_0x187c8a[_0x68d6('0x40')],qs['fields'](_0x4820ac[_0x68d6('0x3c')][_0x68d6('0x42')]));_0x17e2d8['attributes']=_0x17e2d8['attributes']['length']?_0x17e2d8[_0x68d6('0x41')]:_0x187c8a[_0x68d6('0x40')];if(!_0x4820ac[_0x68d6('0x3c')][_0x68d6('0x43')](_0x68d6('0x44'))){_0x17e2d8['limit']=qs[_0x68d6('0x45')](_0x4820ac['query'][_0x68d6('0x45')]);_0x17e2d8[_0x68d6('0x2d')]=qs[_0x68d6('0x2d')](_0x4820ac['query'][_0x68d6('0x2d')]);}_0x17e2d8[_0x68d6('0x46')]=qs['sort'](_0x4820ac[_0x68d6('0x3c')][_0x68d6('0x47')]);_0x17e2d8[_0x68d6('0x48')]=qs[_0x68d6('0x3e')](_[_0x68d6('0x49')](_0x4820ac['query'],_0x187c8a[_0x68d6('0x3e')]),_0x46f8f1);if(_0x4820ac[_0x68d6('0x3c')][_0x68d6('0x4a')]){_0x17e2d8[_0x68d6('0x48')]=_[_0x68d6('0x4b')](_0x17e2d8[_0x68d6('0x48')],{'$or':_[_0x68d6('0x3b')](_0x46f8f1,function(_0x3c047c){if(_0x3c047c['type']!==_0x68d6('0x4c')){var _0x47fd42={};_0x47fd42[_0x3c047c[_0x68d6('0x36')]]={'$like':'%'+_0x4820ac[_0x68d6('0x3c')][_0x68d6('0x4a')]+'%'};return _0x47fd42;}})});}_0x17e2d8=_[_0x68d6('0x4b')]({},_0x17e2d8,_0x4820ac[_0x68d6('0x4d')]);var _0x1aa5f9={'where':_0x17e2d8['where']};return db['WhatsappMessage']['count'](_0x1aa5f9)[_0x68d6('0x34')](function(_0x357b53){_0x58d752[_0x68d6('0x2c')]=_0x357b53;if(_0x4820ac[_0x68d6('0x3c')][_0x68d6('0x4e')]){_0x17e2d8[_0x68d6('0x4f')]=[{'all':!![]}];}return db[_0x68d6('0x50')][_0x68d6('0x51')](_0x17e2d8);})[_0x68d6('0x34')](function(_0x4a67f3){_0x58d752[_0x68d6('0x52')]=_0x4a67f3;return _0x58d752;})[_0x68d6('0x34')](respondWithFilteredResult(_0x172fe9,_0x17e2d8))[_0x68d6('0x28')](handleError(_0x172fe9,null));};exports[_0x68d6('0x53')]=function(_0x51e10d,_0x1b7c5b){var _0x31b802={'raw':!![],'where':{'id':_0x51e10d['params']['id']}},_0x5833cc={};_0x5833cc['model']=_[_0x68d6('0x3d')](db[_0x68d6('0x50')]['rawAttributes']);_0x5833cc['query']=_[_0x68d6('0x3d')](_0x51e10d[_0x68d6('0x3c')]);_0x5833cc[_0x68d6('0x3e')]=_[_0x68d6('0x3f')](_0x5833cc[_0x68d6('0x40')],_0x5833cc[_0x68d6('0x3c')]);_0x31b802[_0x68d6('0x41')]=_[_0x68d6('0x3f')](_0x5833cc['model'],qs[_0x68d6('0x42')](_0x51e10d[_0x68d6('0x3c')][_0x68d6('0x42')]));_0x31b802[_0x68d6('0x41')]=_0x31b802[_0x68d6('0x41')]['length']?_0x31b802['attributes']:_0x5833cc[_0x68d6('0x40')];if(_0x51e10d[_0x68d6('0x3c')][_0x68d6('0x4e')]){_0x31b802[_0x68d6('0x4f')]=[{'all':!![]}];}_0x31b802=_[_0x68d6('0x4b')]({},_0x31b802,_0x51e10d['options']);return db[_0x68d6('0x50')][_0x68d6('0x54')](_0x31b802)[_0x68d6('0x34')](handleEntityNotFound(_0x1b7c5b,null))[_0x68d6('0x34')](respondWithResult(_0x1b7c5b,null))[_0x68d6('0x28')](handleError(_0x1b7c5b,null));};exports[_0x68d6('0x55')]=function(_0x27d30f,_0x9325c4){return db['WhatsappMessage']['create'](_0x27d30f['body'],{})[_0x68d6('0x34')](respondWithResult(_0x9325c4,0xc9))['catch'](handleError(_0x9325c4,null));};exports[_0x68d6('0x56')]=function(_0x16c183,_0xb21f9a){if(_0x16c183[_0x68d6('0x57')]['id']){delete _0x16c183[_0x68d6('0x57')]['id'];}return db[_0x68d6('0x50')]['find']({'where':{'id':_0x16c183[_0x68d6('0x58')]['id']}})[_0x68d6('0x34')](handleEntityNotFound(_0xb21f9a,null))['then'](saveUpdates(_0x16c183['body'],null))[_0x68d6('0x34')](respondWithResult(_0xb21f9a,null))[_0x68d6('0x28')](handleError(_0xb21f9a,null));};exports[_0x68d6('0x33')]=function(_0x1db697,_0x371c75){return db[_0x68d6('0x50')][_0x68d6('0x54')]({'where':{'id':_0x1db697[_0x68d6('0x58')]['id']}})[_0x68d6('0x34')](handleEntityNotFound(_0x371c75,null))[_0x68d6('0x34')](removeEntity(_0x371c75,null))[_0x68d6('0x28')](handleError(_0x371c75,null));};exports[_0x68d6('0x59')]=function(_0x416ff8,_0x10d156){return db[_0x68d6('0x50')][_0x68d6('0x59')]()[_0x68d6('0x34')](respondWithResult(_0x10d156,null))[_0x68d6('0x28')](handleError(_0x10d156,null));};var interaction_log=require(_0x68d6('0x15'))('whatsapp-interactions');exports['accept']=function(_0x30f8b2,_0x295897,_0x4b2815){var _0x5e736b={'agent':{},'channel':_0x68d6('0x5a')};if(_0x30f8b2[_0x68d6('0x57')]['id']){delete _0x30f8b2[_0x68d6('0x57')]['id'];}_0x30f8b2[_0x68d6('0x57')][_0x68d6('0x5b')]=!![];_0x30f8b2[_0x68d6('0x57')][_0x68d6('0x5c')]=moment()[_0x68d6('0x5d')](_0x68d6('0x5e'));_0x30f8b2[_0x68d6('0x57')][_0x68d6('0x5f')]=_0x30f8b2[_0x68d6('0x57')][_0x68d6('0x5f')]||_0x30f8b2[_0x68d6('0x60')]['id'];_0x5e736b[_0x68d6('0x61')]['id']=_0x30f8b2[_0x68d6('0x57')]['UserId'];return db['WhatsappMessage'][_0x68d6('0x54')]({'where':{'id':_0x30f8b2[_0x68d6('0x58')]['id'],'UserId':null},'include':[{'model':db[_0x68d6('0x62')],'as':_0x68d6('0x63')}]})[_0x68d6('0x34')](handleEntityNotFound(_0x295897,null))[_0x68d6('0x34')](saveUpdates(_0x30f8b2['body'],null))[_0x68d6('0x34')](function(_0x67c893){if(_0x67c893){_0x5e736b[_0x68d6('0x25')]=_0x67c893[_0x68d6('0x64')]({'plain':!![]});return db[_0x68d6('0x65')][_0x68d6('0x54')]({'where':{'id':_0x67c893['WhatsappInteractionId']}});}return null;})[_0x68d6('0x34')](handleEntityNotFound(_0x295897,null))[_0x68d6('0x34')](function(_0x12ad5d){if(_0x12ad5d){return _0x12ad5d[_0x68d6('0x56')]({'UserId':_0x30f8b2[_0x68d6('0x57')][_0x68d6('0x5f')],'read1stAt':_[_0x68d6('0x66')](_0x12ad5d[_0x68d6('0x67')])?moment()[_0x68d6('0x5d')](_0x68d6('0x5e')):undefined});}return null;})[_0x68d6('0x34')](function(_0x1b85dd){if(_0x1b85dd){_0x5e736b[_0x68d6('0x68')]=_0x1b85dd[_0x68d6('0x64')]({'plain':!![]});interaction_log[_0x68d6('0x26')](_0x68d6('0x69'),_0x30f8b2[_0x68d6('0x60')]['id'],_0x30f8b2['user'][_0x68d6('0x36')],_0x30f8b2[_0x68d6('0x60')][_0x68d6('0x6a')],_0x5e736b[_0x68d6('0x68')]['id'],_0x30f8b2[_0x68d6('0x57')]?JSON[_0x68d6('0x22')](_0x30f8b2[_0x68d6('0x57')]):_0x68d6('0x6b'));return respondWithRpcPromise(_0x68d6('0x6c'),'acceptMessage',_0x5e736b);}return null;})['then'](function(_0x4d6f70){if(_0x4d6f70){if(_0x30f8b2[_0x68d6('0x57')][_0x68d6('0x6d')]){_0x5e736b[_0x68d6('0x25')][_0x68d6('0x6e')]=util[_0x68d6('0x5d')]('SIP/%s',_0x30f8b2[_0x68d6('0x60')][_0x68d6('0x36')]);_0x5e736b['message'][_0x68d6('0x6f')]=_0x5e736b['channel'];_0x5e736b[_0x68d6('0x25')][_0x68d6('0x70')]=_0x68d6('0x71');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x5e736b[_0x68d6('0x25')]},client9002)[_0x68d6('0x34')](function(){return _0x5e736b;});}return _0x5e736b;}return null;})[_0x68d6('0x34')](respondWithResult(_0x295897,null))['catch'](handleError(_0x295897,null));};var interaction_log=require(_0x68d6('0x15'))(_0x68d6('0x72'));exports[_0x68d6('0x31')]=function(_0x46b782,_0x5b5a02,_0x9c212b){var _0x9c9aa1={'agent':{},'channel':_0x68d6('0x5a')};if(_0x46b782['body']['id']){delete _0x46b782[_0x68d6('0x57')]['id'];}_0x46b782[_0x68d6('0x57')][_0x68d6('0x5f')]=_0x46b782[_0x68d6('0x57')][_0x68d6('0x5f')]||_0x46b782[_0x68d6('0x60')]['id'];_0x9c9aa1[_0x68d6('0x61')]['id']=_0x46b782[_0x68d6('0x57')][_0x68d6('0x5f')];return db[_0x68d6('0x50')][_0x68d6('0x54')]({'where':{'id':_0x46b782['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5b5a02,null))['then'](function(_0x21704e){if(_0x21704e){_0x9c9aa1[_0x68d6('0x25')]=_0x21704e[_0x68d6('0x64')]({'plain':!![]});return db[_0x68d6('0x65')]['find']({'where':{'id':_0x21704e['WhatsappInteractionId']}});}return null;})[_0x68d6('0x34')](handleEntityNotFound(_0x5b5a02,null))[_0x68d6('0x34')](function(_0x306445){if(_0x306445){_0x9c9aa1[_0x68d6('0x68')]=_0x306445['get']({'plain':!![]});interaction_log[_0x68d6('0x26')](_0x68d6('0x73'),_0x46b782['user']['id'],_0x46b782[_0x68d6('0x60')][_0x68d6('0x36')],_0x46b782['user'][_0x68d6('0x6a')],_0x9c9aa1[_0x68d6('0x68')]['id'],_0x46b782[_0x68d6('0x57')]?JSON[_0x68d6('0x22')](_0x46b782['body']):_0x68d6('0x6b'));return respondWithRpcPromise(_0x68d6('0x74'),'rejectMessage',_0x9c9aa1);}return null;})[_0x68d6('0x34')](function(_0x1acf77){if(_0x1acf77){_0x1acf77[_0x68d6('0x25')][_0x68d6('0x6e')]=util[_0x68d6('0x5d')](_0x68d6('0x75'),_0x46b782['user'][_0x68d6('0x36')]);_0x1acf77[_0x68d6('0x25')][_0x68d6('0x6f')]=_0x9c9aa1[_0x68d6('0x6f')];_0x1acf77[_0x68d6('0x25')][_0x68d6('0x70')]=_0x68d6('0x31');respondWithRpcPromise(_0x68d6('0x76'),_0x68d6('0x76'),{'event':_0x68d6('0x77'),'message':_0x1acf77[_0x68d6('0x25')]},client9002);return _0x9c9aa1;}return null;})[_0x68d6('0x34')](respondWithResult(_0x5b5a02,null))[_0x68d6('0x28')](handleError(_0x5b5a02,null));};exports['status']=function(_0x362cc6,_0x46df9f,_0x407496){if(_0x362cc6['body']['id']){delete _0x362cc6['body']['id'];}var _0xb711f2;return db[_0x68d6('0x50')][_0x68d6('0x54')]({'where':{'id':_0x362cc6[_0x68d6('0x58')]['id']}})[_0x68d6('0x34')](handleEntityNotFound(_0x46df9f,null))[_0x68d6('0x34')](function(_0x5f4393){if(_0x5f4393){_0xb711f2=_0x5f4393;return db['WhatsappAccount'][_0x68d6('0x54')]({'where':{'id':_0x5f4393[_0x68d6('0x78')]}});}})[_0x68d6('0x34')](handleEntityNotFound(_0x46df9f,null))[_0x68d6('0x34')](function(_0x119c12){if(_0x119c12){logger[_0x68d6('0x21')](_0x68d6('0x79'),_0x68d6('0x29'),_0x68d6('0x7a'),_0x119c12[_0x68d6('0x39')],util[_0x68d6('0x7b')](_0x362cc6['body'],{'showHidden':![],'depth':null}));switch(_0x119c12[_0x68d6('0x39')]){case _0x68d6('0x7c'):if(_0x362cc6[_0x68d6('0x57')]['MessageSid']&&_0x362cc6[_0x68d6('0x57')]['MessageSid']===_0xb711f2['messageId']&&_0x362cc6[_0x68d6('0x57')][_0x68d6('0x7d')]&&_0x362cc6['body'][_0x68d6('0x7d')]===_0x68d6('0x5b')){return _0xb711f2['update']({'read':!![]});}else{logger[_0x68d6('0x23')](_0x68d6('0x7e'),_0x68d6('0x29'),_0x68d6('0x7c'),util[_0x68d6('0x7b')](_0x362cc6[_0x68d6('0x57')],{'showHidden':![],'depth':null}));}break;}return _0xb711f2;}})['then'](respondWithResult(_0x46df9f,null))[_0x68d6('0x28')](handleError(_0x46df9f,null));}; \ No newline at end of file +var _0x74a1=['sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','WhatsappMessage','findAll','rows','show','includeAll','find','create','body','params','accept','read','readAt','format','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','../../config/logger','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectmessage','WhatsappAccountId','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x39f4b7,_0x4d299e){var _0x3d3dc2=function(_0x15c21d){while(--_0x15c21d){_0x39f4b7['push'](_0x39f4b7['shift']());}};_0x3d3dc2(++_0x4d299e);}(_0x74a1,0x16e));var _0x174a=function(_0x4a8893,_0x38f6ee){_0x4a8893=_0x4a8893-0x0;var _0x2b6e06=_0x74a1[_0x4a8893];return _0x2b6e06;};'use strict';var pdf=require(_0x174a('0x0'));var emlformat=require(_0x174a('0x1'));var rimraf=require(_0x174a('0x2'));var zipdir=require(_0x174a('0x3'));var jsonpatch=require(_0x174a('0x4'));var rp=require(_0x174a('0x5'));var moment=require(_0x174a('0x6'));var BPromise=require(_0x174a('0x7'));var Mustache=require('mustache');var util=require(_0x174a('0x8'));var path=require('path');var sox=require(_0x174a('0x9'));var csv=require(_0x174a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x174a('0xb'));var crypto=require('crypto');var jsforce=require(_0x174a('0xc'));var deskjs=require(_0x174a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x174a('0xe'));var Papa=require(_0x174a('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x174a('0x10'));var as=require(_0x174a('0x11'));var hardwareService=require(_0x174a('0x12'));var logger=require('../../config/logger')(_0x174a('0x13'));var utils=require('../../config/utils');var config=require(_0x174a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x174a('0x15'))['db'];config['redis']=_['defaults'](config[_0x174a('0x16')],{'host':_0x174a('0x17'),'port':0x18eb});var socket=require(_0x174a('0x18'))(new Redis(config['redis']));require(_0x174a('0x19'))[_0x174a('0x1a')](socket);var jayson=require(_0x174a('0x1b'));var client=jayson[_0x174a('0x1c')][_0x174a('0x1d')]({'port':0x232c});var client9002=jayson[_0x174a('0x1c')][_0x174a('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x9304ce,_0x10456a,_0x5ddb10,_0x3ca4f6){return new BPromise(function(_0xa1de5f,_0x12fc6a){var _0x378bb7=_0x3ca4f6||client;return _0x378bb7[_0x174a('0x1e')](_0x9304ce,_0x5ddb10)[_0x174a('0x1f')](function(_0x53c3d1){logger[_0x174a('0x20')](_0x174a('0x21'),_0x10456a,'request\x20sent');logger[_0x174a('0x22')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x10456a,_0x174a('0x23'),JSON[_0x174a('0x24')](_0x53c3d1));if(_0x53c3d1[_0x174a('0x25')]){if(_0x53c3d1['error'][_0x174a('0x26')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x10456a,_0x53c3d1['error'][_0x174a('0x27')]);return _0x12fc6a(_0x53c3d1['error']['message']);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x10456a,_0x53c3d1['error']['message']);return _0xa1de5f(_0x53c3d1[_0x174a('0x25')][_0x174a('0x27')]);}else{logger[_0x174a('0x20')](_0x174a('0x21'),_0x10456a,_0x174a('0x23'));_0xa1de5f(_0x53c3d1[_0x174a('0x28')][_0x174a('0x27')]);}})[_0x174a('0x29')](function(_0x1d28f5){logger[_0x174a('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x10456a,_0x1d28f5);_0x12fc6a(_0x1d28f5);});});}function respondWithStatusCode(_0x200b3b,_0x29c83a){_0x29c83a=_0x29c83a||0xcc;return function(_0x43cd41){if(_0x43cd41){return _0x200b3b[_0x174a('0x2a')](_0x29c83a);}return _0x200b3b[_0x174a('0x2b')](_0x29c83a)[_0x174a('0x2c')]();};}function respondWithResult(_0x96ae3c,_0x4af617){_0x4af617=_0x4af617||0xc8;return function(_0x2a9979){if(_0x2a9979){return _0x96ae3c[_0x174a('0x2b')](_0x4af617)['json'](_0x2a9979);}};}function respondWithFilteredResult(_0x571e36,_0x30d78e){return function(_0x53bbd2){if(_0x53bbd2){var _0x3472b8=_0x53bbd2[_0x174a('0x2d')],_0x1448f5=_0x30d78e[_0x174a('0x2e')],_0x18152d=_0x30d78e[_0x174a('0x2e')]+_0x30d78e[_0x174a('0x2f')],_0xaa38d;if(_0x18152d>=_0x3472b8){_0x18152d=_0x3472b8;_0xaa38d=0xc8;}else{_0xaa38d=0xce;}_0x571e36[_0x174a('0x2b')](_0xaa38d);return _0x571e36[_0x174a('0x30')](_0x174a('0x31'),_0x1448f5+'-'+_0x18152d+'/'+_0x3472b8)[_0x174a('0x32')](_0x53bbd2);}return null;};}function patchUpdates(_0x5106f8){return function(_0x3bc8ce){try{jsonpatch[_0x174a('0x33')](_0x3bc8ce,_0x5106f8,!![]);}catch(_0x2eafbc){return BPromise['reject'](_0x2eafbc);}return _0x3bc8ce[_0x174a('0x34')]();};}function saveUpdates(_0x453257,_0x5b54bc){return function(_0x18460f){if(_0x18460f){return _0x18460f[_0x174a('0x35')](_0x453257)[_0x174a('0x1f')](function(_0x20b93a){return _0x20b93a;});}return null;};}function removeEntity(_0x3a8202,_0x1adef8){return function(_0x39d39a){if(_0x39d39a){return _0x39d39a[_0x174a('0x36')]()['then'](function(){_0x3a8202[_0x174a('0x2b')](0xcc)[_0x174a('0x2c')]();});}};}function handleEntityNotFound(_0x4294b9,_0x3c0568){return function(_0x5af3d7){if(!_0x5af3d7){_0x4294b9[_0x174a('0x2a')](0x194);}return _0x5af3d7;};}function handleError(_0x2a911c,_0x236235){_0x236235=_0x236235||0x1f4;return function(_0x55c070){logger[_0x174a('0x25')](_0x55c070[_0x174a('0x37')]);if(_0x55c070[_0x174a('0x38')]){delete _0x55c070[_0x174a('0x38')];}_0x2a911c['status'](_0x236235)[_0x174a('0x39')](_0x55c070);};}exports[_0x174a('0x3a')]=function(_0x5dd675,_0x2428ea){var _0x22eb85={},_0xc84d5c={},_0x543cf9={'count':0x0,'rows':[]};var _0x4ddfb5=_['map'](db['WhatsappMessage'][_0x174a('0x3b')],function(_0x457724){return{'name':_0x457724[_0x174a('0x3c')],'type':_0x457724[_0x174a('0x3d')]['key']};});_0xc84d5c[_0x174a('0x3e')]=_[_0x174a('0x3f')](_0x4ddfb5,_0x174a('0x38'));_0xc84d5c[_0x174a('0x40')]=_[_0x174a('0x41')](_0x5dd675[_0x174a('0x40')]);_0xc84d5c[_0x174a('0x42')]=_[_0x174a('0x43')](_0xc84d5c[_0x174a('0x3e')],_0xc84d5c[_0x174a('0x40')]);_0x22eb85[_0x174a('0x44')]=_[_0x174a('0x43')](_0xc84d5c[_0x174a('0x3e')],qs[_0x174a('0x45')](_0x5dd675[_0x174a('0x40')][_0x174a('0x45')]));_0x22eb85[_0x174a('0x44')]=_0x22eb85['attributes'][_0x174a('0x46')]?_0x22eb85[_0x174a('0x44')]:_0xc84d5c[_0x174a('0x3e')];if(!_0x5dd675[_0x174a('0x40')][_0x174a('0x47')](_0x174a('0x48'))){_0x22eb85[_0x174a('0x2f')]=qs[_0x174a('0x2f')](_0x5dd675['query'][_0x174a('0x2f')]);_0x22eb85[_0x174a('0x2e')]=qs['offset'](_0x5dd675[_0x174a('0x40')]['offset']);}_0x22eb85[_0x174a('0x49')]=qs[_0x174a('0x4a')](_0x5dd675[_0x174a('0x40')][_0x174a('0x4a')]);_0x22eb85[_0x174a('0x4b')]=qs[_0x174a('0x42')](_[_0x174a('0x4c')](_0x5dd675[_0x174a('0x40')],_0xc84d5c[_0x174a('0x42')]),_0x4ddfb5);if(_0x5dd675[_0x174a('0x40')]['filter']){_0x22eb85[_0x174a('0x4b')]=_[_0x174a('0x4d')](_0x22eb85[_0x174a('0x4b')],{'$or':_['map'](_0x4ddfb5,function(_0x47951f){if(_0x47951f[_0x174a('0x3d')]!==_0x174a('0x4e')){var _0x307419={};_0x307419[_0x47951f[_0x174a('0x38')]]={'$like':'%'+_0x5dd675[_0x174a('0x40')][_0x174a('0x4f')]+'%'};return _0x307419;}})});}_0x22eb85=_['merge']({},_0x22eb85,_0x5dd675[_0x174a('0x50')]);var _0x3c5e74={'where':_0x22eb85[_0x174a('0x4b')]};return db[_0x174a('0x51')][_0x174a('0x2d')](_0x3c5e74)[_0x174a('0x1f')](function(_0x28dcb0){_0x543cf9[_0x174a('0x2d')]=_0x28dcb0;if(_0x5dd675[_0x174a('0x40')]['includeAll']){_0x22eb85['include']=[{'all':!![]}];}return db[_0x174a('0x51')][_0x174a('0x52')](_0x22eb85);})[_0x174a('0x1f')](function(_0x418e35){_0x543cf9[_0x174a('0x53')]=_0x418e35;return _0x543cf9;})['then'](respondWithFilteredResult(_0x2428ea,_0x22eb85))[_0x174a('0x29')](handleError(_0x2428ea,null));};exports[_0x174a('0x54')]=function(_0x7268d2,_0x2f7ce1){var _0x4b5da1={'raw':!![],'where':{'id':_0x7268d2['params']['id']}},_0x358858={};_0x358858['model']=_['keys'](db[_0x174a('0x51')][_0x174a('0x3b')]);_0x358858[_0x174a('0x40')]=_['keys'](_0x7268d2[_0x174a('0x40')]);_0x358858[_0x174a('0x42')]=_['intersection'](_0x358858['model'],_0x358858[_0x174a('0x40')]);_0x4b5da1[_0x174a('0x44')]=_[_0x174a('0x43')](_0x358858[_0x174a('0x3e')],qs[_0x174a('0x45')](_0x7268d2[_0x174a('0x40')][_0x174a('0x45')]));_0x4b5da1[_0x174a('0x44')]=_0x4b5da1[_0x174a('0x44')][_0x174a('0x46')]?_0x4b5da1[_0x174a('0x44')]:_0x358858[_0x174a('0x3e')];if(_0x7268d2['query'][_0x174a('0x55')]){_0x4b5da1['include']=[{'all':!![]}];}_0x4b5da1=_[_0x174a('0x4d')]({},_0x4b5da1,_0x7268d2[_0x174a('0x50')]);return db['WhatsappMessage'][_0x174a('0x56')](_0x4b5da1)['then'](handleEntityNotFound(_0x2f7ce1,null))[_0x174a('0x1f')](respondWithResult(_0x2f7ce1,null))['catch'](handleError(_0x2f7ce1,null));};exports[_0x174a('0x57')]=function(_0x62018a,_0x8e12c3){return db[_0x174a('0x51')][_0x174a('0x57')](_0x62018a[_0x174a('0x58')],{})[_0x174a('0x1f')](respondWithResult(_0x8e12c3,0xc9))[_0x174a('0x29')](handleError(_0x8e12c3,null));};exports[_0x174a('0x35')]=function(_0x4b11ef,_0x7a434b){if(_0x4b11ef[_0x174a('0x58')]['id']){delete _0x4b11ef[_0x174a('0x58')]['id'];}return db[_0x174a('0x51')][_0x174a('0x56')]({'where':{'id':_0x4b11ef[_0x174a('0x59')]['id']}})[_0x174a('0x1f')](handleEntityNotFound(_0x7a434b,null))[_0x174a('0x1f')](saveUpdates(_0x4b11ef['body'],null))['then'](respondWithResult(_0x7a434b,null))[_0x174a('0x29')](handleError(_0x7a434b,null));};exports[_0x174a('0x36')]=function(_0xe4756a,_0x510e08){return db[_0x174a('0x51')][_0x174a('0x56')]({'where':{'id':_0xe4756a['params']['id']}})[_0x174a('0x1f')](handleEntityNotFound(_0x510e08,null))['then'](removeEntity(_0x510e08,null))[_0x174a('0x29')](handleError(_0x510e08,null));};exports['describe']=function(_0x4768f1,_0x183c1c){return db[_0x174a('0x51')]['describe']()[_0x174a('0x1f')](respondWithResult(_0x183c1c,null))[_0x174a('0x29')](handleError(_0x183c1c,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0x174a('0x5a')]=function(_0x2a19c4,_0x4a1454,_0x38566e){var _0x1381d2={'agent':{},'channel':'whatsapp'};if(_0x2a19c4[_0x174a('0x58')]['id']){delete _0x2a19c4[_0x174a('0x58')]['id'];}_0x2a19c4[_0x174a('0x58')][_0x174a('0x5b')]=!![];_0x2a19c4['body'][_0x174a('0x5c')]=moment()[_0x174a('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x2a19c4[_0x174a('0x58')]['UserId']=_0x2a19c4['body'][_0x174a('0x5e')]||_0x2a19c4[_0x174a('0x5f')]['id'];_0x1381d2[_0x174a('0x60')]['id']=_0x2a19c4[_0x174a('0x58')][_0x174a('0x5e')];return db[_0x174a('0x51')][_0x174a('0x56')]({'where':{'id':_0x2a19c4[_0x174a('0x59')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x174a('0x1f')](handleEntityNotFound(_0x4a1454,null))['then'](saveUpdates(_0x2a19c4['body'],null))[_0x174a('0x1f')](function(_0x32e0d9){if(_0x32e0d9){_0x1381d2['message']=_0x32e0d9[_0x174a('0x61')]({'plain':!![]});return db[_0x174a('0x62')]['find']({'where':{'id':_0x32e0d9[_0x174a('0x63')]}});}return null;})[_0x174a('0x1f')](handleEntityNotFound(_0x4a1454,null))['then'](function(_0x459b54){if(_0x459b54){return _0x459b54[_0x174a('0x35')]({'UserId':_0x2a19c4[_0x174a('0x58')][_0x174a('0x5e')],'read1stAt':_[_0x174a('0x64')](_0x459b54[_0x174a('0x65')])?moment()[_0x174a('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x174a('0x1f')](function(_0x9549c7){if(_0x9549c7){_0x1381d2['interaction']=_0x9549c7['get']({'plain':!![]});interaction_log[_0x174a('0x20')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2a19c4['user']['id'],_0x2a19c4['user'][_0x174a('0x38')],_0x2a19c4[_0x174a('0x5f')]['role'],_0x1381d2[_0x174a('0x66')]['id'],_0x2a19c4['body']?JSON[_0x174a('0x24')](_0x2a19c4['body']):_0x174a('0x67'));return respondWithRpcPromise(_0x174a('0x68'),_0x174a('0x69'),_0x1381d2);}return null;})[_0x174a('0x1f')](function(_0x500b3c){if(_0x500b3c){if(_0x2a19c4[_0x174a('0x58')][_0x174a('0x6a')]){_0x1381d2[_0x174a('0x27')][_0x174a('0x6b')]=util[_0x174a('0x5d')](_0x174a('0x6c'),_0x2a19c4[_0x174a('0x5f')][_0x174a('0x38')]);_0x1381d2['message'][_0x174a('0x6d')]=_0x1381d2[_0x174a('0x6d')];_0x1381d2[_0x174a('0x27')][_0x174a('0x6e')]=_0x174a('0x5a');return respondWithRpcPromise(_0x174a('0x6f'),_0x174a('0x6f'),{'event':_0x174a('0x70'),'message':_0x1381d2[_0x174a('0x27')]},client9002)[_0x174a('0x1f')](function(){return _0x1381d2;});}return _0x1381d2;}return null;})[_0x174a('0x1f')](respondWithResult(_0x4a1454,null))[_0x174a('0x29')](handleError(_0x4a1454,null));};var interaction_log=require(_0x174a('0x71'))('whatsapp-interactions');exports[_0x174a('0x72')]=function(_0x436553,_0x47e6cf,_0xe1f368){var _0x4df24b={'agent':{},'channel':'whatsapp'};if(_0x436553[_0x174a('0x58')]['id']){delete _0x436553[_0x174a('0x58')]['id'];}_0x436553[_0x174a('0x58')][_0x174a('0x5e')]=_0x436553[_0x174a('0x58')][_0x174a('0x5e')]||_0x436553[_0x174a('0x5f')]['id'];_0x4df24b[_0x174a('0x60')]['id']=_0x436553[_0x174a('0x58')][_0x174a('0x5e')];return db[_0x174a('0x51')]['find']({'where':{'id':_0x436553[_0x174a('0x59')]['id'],'UserId':null}})[_0x174a('0x1f')](handleEntityNotFound(_0x47e6cf,null))['then'](function(_0xeb1789){if(_0xeb1789){_0x4df24b[_0x174a('0x27')]=_0xeb1789[_0x174a('0x61')]({'plain':!![]});return db[_0x174a('0x62')][_0x174a('0x56')]({'where':{'id':_0xeb1789[_0x174a('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x47e6cf,null))[_0x174a('0x1f')](function(_0x526fcb){if(_0x526fcb){_0x4df24b[_0x174a('0x66')]=_0x526fcb[_0x174a('0x61')]({'plain':!![]});interaction_log[_0x174a('0x20')](_0x174a('0x73'),_0x436553[_0x174a('0x5f')]['id'],_0x436553[_0x174a('0x5f')]['name'],_0x436553[_0x174a('0x5f')][_0x174a('0x74')],_0x4df24b['interaction']['id'],_0x436553[_0x174a('0x58')]?JSON[_0x174a('0x24')](_0x436553[_0x174a('0x58')]):_0x174a('0x67'));return respondWithRpcPromise(_0x174a('0x75'),'rejectMessage',_0x4df24b);}return null;})[_0x174a('0x1f')](function(_0x50a46f){if(_0x50a46f){_0x50a46f[_0x174a('0x27')][_0x174a('0x6b')]=util[_0x174a('0x5d')](_0x174a('0x6c'),_0x436553[_0x174a('0x5f')][_0x174a('0x38')]);_0x50a46f[_0x174a('0x27')][_0x174a('0x6d')]=_0x4df24b[_0x174a('0x6d')];_0x50a46f['message'][_0x174a('0x6e')]=_0x174a('0x72');respondWithRpcPromise(_0x174a('0x6f'),_0x174a('0x6f'),{'event':_0x174a('0x76'),'message':_0x50a46f['message']},client9002);return _0x4df24b;}return null;})[_0x174a('0x1f')](respondWithResult(_0x47e6cf,null))[_0x174a('0x29')](handleError(_0x47e6cf,null));};exports['status']=function(_0x3617fb,_0x555403,_0x3ebbe0){if(_0x3617fb[_0x174a('0x58')]['id']){delete _0x3617fb[_0x174a('0x58')]['id'];}var _0x338814;return db[_0x174a('0x51')][_0x174a('0x56')]({'where':{'id':_0x3617fb[_0x174a('0x59')]['id']}})['then'](handleEntityNotFound(_0x555403,null))[_0x174a('0x1f')](function(_0xa52f09){if(_0xa52f09){_0x338814=_0xa52f09;return db['WhatsappAccount'][_0x174a('0x56')]({'where':{'id':_0xa52f09[_0x174a('0x77')]}});}})['then'](handleEntityNotFound(_0x555403,null))[_0x174a('0x1f')](function(_0x28cd15){if(_0x28cd15){logger[_0x174a('0x22')]('WhatsppMessage,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0x28cd15[_0x174a('0x3d')],util['inspect'](_0x3617fb[_0x174a('0x58')],{'showHidden':![],'depth':null}));switch(_0x28cd15[_0x174a('0x3d')]){case _0x174a('0x78'):if(_0x3617fb[_0x174a('0x58')][_0x174a('0x79')]&&_0x3617fb[_0x174a('0x58')]['MessageSid']===_0x338814['messageId']&&_0x3617fb[_0x174a('0x58')][_0x174a('0x7a')]&&_0x3617fb[_0x174a('0x58')][_0x174a('0x7a')]===_0x174a('0x5b')){return _0x338814['update']({'read':!![]});}else{logger[_0x174a('0x25')](_0x174a('0x7b'),_0x174a('0x2b'),_0x174a('0x78'),util[_0x174a('0x7c')](_0x3617fb[_0x174a('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x338814;}})[_0x174a('0x1f')](respondWithResult(_0x555403,null))['catch'](handleError(_0x555403,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 0bee528..c7713a3 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x361d52,_0x53e6d5){var _0x20e299=function(_0x2726af){while(--_0x2726af){_0x361d52['push'](_0x361d52['shift']());}};_0x20e299(++_0x53e6d5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3b01af,_0x295155){_0x3b01af=_0x3b01af-0x0;var _0x418e36=_0x5f2f[_0x3b01af];return _0x418e36;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0xc9bed8,_0x1c04b6){var _0x243eb8=function(_0x254af6){while(--_0x254af6){_0xc9bed8['push'](_0xc9bed8['shift']());}};_0x243eb8(++_0x1c04b6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2ab089,_0x5cf7d4){_0x2ab089=_0x2ab089-0x0;var _0x1c8e3d=_0x5f2f[_0x2ab089];return _0x1c8e3d;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('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 9f05c0f..c25edfa 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 _0xf07f=['authToken','messages','create','whatsapp:','remote','/status?token=','token','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','get','toLowerCase','direction','secret','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','WhatsappAccountId','type','twilio','accountSid','phone'];(function(_0xa9951a,_0x1ce269){var _0xc0e323=function(_0x305ebf){while(--_0x305ebf){_0xa9951a['push'](_0xa9951a['shift']());}};_0xc0e323(++_0x1ce269);}(_0xf07f,0x1a8));var _0xff07=function(_0x1ab365,_0x376072){_0x1ab365=_0x1ab365-0x0;var _0x41e7fe=_0xf07f[_0x1ab365];return _0x41e7fe;};'use strict';var _=require(_0xff07('0x0'));var util=require(_0xff07('0x1'));var logger=require(_0xff07('0x2'))(_0xff07('0x3'));var moment=require(_0xff07('0x4'));var BPromise=require(_0xff07('0x5'));var rp=require(_0xff07('0x6'));var fs=require('fs');var path=require(_0xff07('0x7'));var rimraf=require(_0xff07('0x8'));var config=require(_0xff07('0x9'));var attributes=require(_0xff07('0xa'));module[_0xff07('0xb')]=function(_0x3b13e7,_0x32370e){return _0x3b13e7[_0xff07('0xc')]('WhatsappMessage',attributes,{'tableName':_0xff07('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xff07('0xe')]},{'name':_0xff07('0xf'),'fields':[_0xff07('0x10')],'type':_0xff07('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xc59ca5,_0x4df0fa,_0x4e958b){var _0x4d047f=_0x3b13e7['models'];var _0x4b04d8=_0xc59ca5[_0xff07('0x12')]({'plain':!![]});if(_0x4b04d8['direction'][_0xff07('0x13')]()==='in'||_0x4b04d8[_0xff07('0x14')][_0xff07('0x13')]()==='out'&&!_0x4b04d8[_0xff07('0x15')]&&!_['isNil'](_0x4b04d8[_0xff07('0x16')])){_0x4d047f[_0xff07('0x17')][_0xff07('0x18')]({'where':{'id':_0x4b04d8[_0xff07('0x19')]}})[_0xff07('0x1a')](function(_0x4121b8){if(_0x4121b8){_0x4121b8[_0xff07('0x1b')]({'lastMsgAt':_0x4b04d8[_0xff07('0x1c')],'lastMsgDirection':_0x4b04d8[_0xff07('0x14')]['toLowerCase']()});}})[_0xff07('0x1d')](function(_0x468462){console['error'](_0x468462);});}if(_0x4b04d8[_0xff07('0x14')]==='out'&&!_0x4b04d8[_0xff07('0x15')]){var _0x4980e9;_0x4d047f['WhatsappAccount']['find']({'where':{'id':_0x4b04d8[_0xff07('0x1e')]},'raw':!![]})[_0xff07('0x1a')](function(_0x101d66){_0x4980e9=_0x101d66;if(_0x4980e9&&_0x4980e9[_0xff07('0x1f')]){switch(_0x4980e9[_0xff07('0x1f')]){case'twilio':var _0x4210e0=require(_0xff07('0x20'));if(_0x4980e9[_0xff07('0x21')]&&_0x4980e9['authToken']&&_0x4980e9[_0xff07('0x22')]){var _0x438c89=new _0x4210e0(_0x4980e9[_0xff07('0x21')],_0x4980e9[_0xff07('0x23')]);_0x438c89[_0xff07('0x24')][_0xff07('0x25')]({'body':_0x4b04d8[_0xff07('0x10')],'to':_0xff07('0x26')+_0x4b04d8['phone'],'from':_0xff07('0x26')+_0x4980e9[_0xff07('0x22')],'statusCallback':_0x4980e9[_0xff07('0x27')]+'/api/whatsapp/messages/'+_0x4b04d8['id']+_0xff07('0x28')+_0x4980e9[_0xff07('0x29')]})[_0xff07('0x1a')](function(_0x3b811d){if(_0x3b811d[_0xff07('0x2a')]){return _0xc59ca5[_0xff07('0x1b')]({'messageId':_0x3b811d[_0xff07('0x2a')]});}})[_0xff07('0x1d')](function(_0x3ff15f){logger[_0xff07('0x2b')](_0xff07('0x2c'),_0xff07('0x2d'),_0xff07('0x20'),util[_0xff07('0x2e')](_0x3ff15f,{'showHidden':![],'depth':null}));});}else{logger[_0xff07('0x2b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xff07('0x2d'),_0xff07('0x20'),_0xff07('0x2f'));}break;}}})[_0xff07('0x30')](function(){_0x4e958b();});}else{_0x4e958b();}}},'charset':_0xff07('0x31'),'collate':_0xff07('0x32')});}; \ No newline at end of file +var _0xb4de=['catch','error','out','secret','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','phone','authToken','messages','create','whatsapp:','/api/whatsapp/messages/','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','toLowerCase','direction','isNil','UserId','findOne','then','update'];(function(_0x3e5457,_0xd17e2d){var _0x1503b9=function(_0x287543){while(--_0x287543){_0x3e5457['push'](_0x3e5457['shift']());}};_0x1503b9(++_0xd17e2d);}(_0xb4de,0xa2));var _0xeb4d=function(_0x25aafd,_0x1e7727){_0x25aafd=_0x25aafd-0x0;var _0x369433=_0xb4de[_0x25aafd];return _0x369433;};'use strict';var _=require('lodash');var util=require(_0xeb4d('0x0'));var logger=require(_0xeb4d('0x1'))(_0xeb4d('0x2'));var moment=require(_0xeb4d('0x3'));var BPromise=require(_0xeb4d('0x4'));var rp=require(_0xeb4d('0x5'));var fs=require('fs');var path=require(_0xeb4d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module[_0xeb4d('0x7')]=function(_0x3b93b4,_0x10815e){return _0x3b93b4[_0xeb4d('0x8')]('WhatsappMessage',attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xeb4d('0x9'),'fields':['messageId']},{'name':_0xeb4d('0xa'),'fields':[_0xeb4d('0xb')],'type':_0xeb4d('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x391dea,_0x39c47c,_0x19f3b7){var _0x5ed494=_0x3b93b4[_0xeb4d('0xd')];var _0x139f22=_0x391dea[_0xeb4d('0xe')]({'plain':!![]});if(_0x139f22['direction'][_0xeb4d('0xf')]()==='in'||_0x139f22[_0xeb4d('0x10')][_0xeb4d('0xf')]()==='out'&&!_0x139f22['secret']&&!_[_0xeb4d('0x11')](_0x139f22[_0xeb4d('0x12')])){_0x5ed494['WhatsappInteraction'][_0xeb4d('0x13')]({'where':{'id':_0x139f22['WhatsappInteractionId']}})[_0xeb4d('0x14')](function(_0xcafdb9){if(_0xcafdb9){_0xcafdb9[_0xeb4d('0x15')]({'lastMsgAt':_0x139f22['createdAt'],'lastMsgDirection':_0x139f22[_0xeb4d('0x10')][_0xeb4d('0xf')]()});}})[_0xeb4d('0x16')](function(_0x5edd47){console[_0xeb4d('0x17')](_0x5edd47);});}if(_0x139f22[_0xeb4d('0x10')]===_0xeb4d('0x18')&&!_0x139f22[_0xeb4d('0x19')]){var _0x1a0359;_0x5ed494[_0xeb4d('0x1a')][_0xeb4d('0x1b')]({'where':{'id':_0x139f22[_0xeb4d('0x1c')]},'raw':!![]})[_0xeb4d('0x14')](function(_0x2c496c){_0x1a0359=_0x2c496c;if(_0x1a0359&&_0x1a0359[_0xeb4d('0x1d')]){switch(_0x1a0359[_0xeb4d('0x1d')]){case _0xeb4d('0x1e'):var _0x401d33=require('twilio');if(_0x1a0359[_0xeb4d('0x1f')]&&_0x1a0359['authToken']&&_0x1a0359[_0xeb4d('0x20')]){var _0x50242b=new _0x401d33(_0x1a0359[_0xeb4d('0x1f')],_0x1a0359[_0xeb4d('0x21')]);_0x50242b[_0xeb4d('0x22')][_0xeb4d('0x23')]({'body':_0x139f22['body'],'to':_0xeb4d('0x24')+_0x139f22[_0xeb4d('0x20')],'from':_0xeb4d('0x24')+_0x1a0359[_0xeb4d('0x20')],'statusCallback':_0x1a0359['remote']+_0xeb4d('0x25')+_0x139f22['id']+'/status?token='+_0x1a0359[_0xeb4d('0x26')]})['then'](function(_0x179e55){if(_0x179e55[_0xeb4d('0x27')]){return _0x391dea['update']({'messageId':_0x179e55[_0xeb4d('0x27')]});}})[_0xeb4d('0x16')](function(_0xeb18b2){logger[_0xeb4d('0x17')](_0xeb4d('0x28'),'afterCreate',_0xeb4d('0x1e'),util[_0xeb4d('0x29')](_0xeb18b2,{'showHidden':![],'depth':null}));});}else{logger[_0xeb4d('0x17')](_0xeb4d('0x28'),'afterCreate',_0xeb4d('0x1e'),_0xeb4d('0x2a'));}break;}}})[_0xeb4d('0x2b')](function(){_0x19f3b7();});}else{_0x19f3b7();}}},'charset':_0xeb4d('0x2c'),'collate':_0xeb4d('0x2d')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 90b8fa5..5fe69b7 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 _0xefd3=['../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateWhatsappMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xefd3,0x132));var _0x3efd=function(_0x58af52,_0x3a8b38){_0x58af52=_0x58af52-0x0;var _0x202c80=_0xefd3[_0x58af52];return _0x202c80;};'use strict';var _=require(_0x3efd('0x0'));var util=require(_0x3efd('0x1'));var moment=require(_0x3efd('0x2'));var BPromise=require(_0x3efd('0x3'));var rs=require(_0x3efd('0x4'));var fs=require('fs');var Redis=require(_0x3efd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3efd('0x6'));var logger=require(_0x3efd('0x7'))(_0x3efd('0x8'));var config=require(_0x3efd('0x9'));var jayson=require(_0x3efd('0xa'));var client=jayson[_0x3efd('0xb')][_0x3efd('0xc')]({'port':0x232a});config[_0x3efd('0xd')]=_[_0x3efd('0xe')](config[_0x3efd('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x3efd('0xf'))(new Redis(config['redis']));require(_0x3efd('0x10'))[_0x3efd('0x11')](socket);function respondWithRpcPromise(_0x3a35b2,_0x5da7be,_0x155dc8){return new BPromise(function(_0x20071e,_0x5bbec7){return client[_0x3efd('0x12')](_0x3a35b2,_0x155dc8)[_0x3efd('0x13')](function(_0x1c928f){logger[_0x3efd('0x14')](_0x3efd('0x15'),_0x5da7be,_0x3efd('0x16'));logger[_0x3efd('0x17')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x5da7be,'request\x20sent',JSON[_0x3efd('0x18')](_0x1c928f));if(_0x1c928f['error']){if(_0x1c928f[_0x3efd('0x19')][_0x3efd('0x1a')]===0x1f4){logger[_0x3efd('0x19')]('WhatsappMessage,\x20%s,\x20%s',_0x5da7be,_0x1c928f[_0x3efd('0x19')][_0x3efd('0x1b')]);return _0x5bbec7(_0x1c928f['error'][_0x3efd('0x1b')]);}logger[_0x3efd('0x19')](_0x3efd('0x15'),_0x5da7be,_0x1c928f[_0x3efd('0x19')][_0x3efd('0x1b')]);return _0x20071e(_0x1c928f[_0x3efd('0x19')][_0x3efd('0x1b')]);}else{logger['info'](_0x3efd('0x15'),_0x5da7be,_0x3efd('0x16'));_0x20071e(_0x1c928f[_0x3efd('0x1c')][_0x3efd('0x1b')]);}})[_0x3efd('0x1d')](function(_0xa83e3d){logger[_0x3efd('0x19')](_0x3efd('0x15'),_0x5da7be,_0xa83e3d);_0x5bbec7(_0xa83e3d);});});}exports[_0x3efd('0x1e')]=function(_0x2e3113){var _0x1a924f=this;return new Promise(function(_0x25a363,_0x2bd76a){return db['WhatsappMessage'][_0x3efd('0x1f')](_0x2e3113[_0x3efd('0x20')],{'raw':_0x2e3113[_0x3efd('0x21')]?_0x2e3113[_0x3efd('0x21')][_0x3efd('0x22')]===undefined?!![]:![]:!![]})[_0x3efd('0x13')](function(_0x2c6759){logger[_0x3efd('0x14')](_0x3efd('0x1e'),_0x2e3113);logger['debug'](_0x3efd('0x1e'),_0x2e3113,JSON[_0x3efd('0x18')](_0x2c6759));_0x25a363(_0x2c6759);})[_0x3efd('0x1d')](function(_0x566382){logger['error'](_0x3efd('0x1e'),_0x566382['message'],_0x2e3113);_0x2bd76a(_0x1a924f[_0x3efd('0x19')](0x1f4,_0x566382[_0x3efd('0x1b')]));});});}; \ No newline at end of file +var _0x23f2=['options','raw','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./whatsappMessage.socket','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body'];(function(_0x2ab97a,_0x36f9ed){var _0xfc17b5=function(_0x6bf21e){while(--_0x6bf21e){_0x2ab97a['push'](_0x2ab97a['shift']());}};_0xfc17b5(++_0x36f9ed);}(_0x23f2,0x176));var _0x223f=function(_0x5e27b3,_0x313962){_0x5e27b3=_0x5e27b3-0x0;var _0x333a24=_0x23f2[_0x5e27b3];return _0x333a24;};'use strict';var _=require(_0x223f('0x0'));var util=require(_0x223f('0x1'));var moment=require('moment');var BPromise=require(_0x223f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x223f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x223f('0x4'));var logger=require(_0x223f('0x5'))(_0x223f('0x6'));var config=require(_0x223f('0x7'));var jayson=require(_0x223f('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x223f('0x9')]=_[_0x223f('0xa')](config['redis'],{'host':_0x223f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x223f('0x9')]));require(_0x223f('0xc'))['register'](socket);function respondWithRpcPromise(_0x50f3ee,_0xf64ecb,_0x53c8a9){return new BPromise(function(_0x12fb7b,_0x21bce5){return client[_0x223f('0xd')](_0x50f3ee,_0x53c8a9)[_0x223f('0xe')](function(_0x5d494b){logger[_0x223f('0xf')](_0x223f('0x10'),_0xf64ecb,_0x223f('0x11'));logger[_0x223f('0x12')](_0x223f('0x13'),_0xf64ecb,'request\x20sent',JSON['stringify'](_0x5d494b));if(_0x5d494b[_0x223f('0x14')]){if(_0x5d494b[_0x223f('0x14')][_0x223f('0x15')]===0x1f4){logger[_0x223f('0x14')](_0x223f('0x10'),_0xf64ecb,_0x5d494b['error'][_0x223f('0x16')]);return _0x21bce5(_0x5d494b[_0x223f('0x14')]['message']);}logger['error'](_0x223f('0x10'),_0xf64ecb,_0x5d494b[_0x223f('0x14')][_0x223f('0x16')]);return _0x12fb7b(_0x5d494b['error'][_0x223f('0x16')]);}else{logger[_0x223f('0xf')]('WhatsappMessage,\x20%s,\x20%s',_0xf64ecb,_0x223f('0x11'));_0x12fb7b(_0x5d494b[_0x223f('0x17')][_0x223f('0x16')]);}})[_0x223f('0x18')](function(_0x57fb2f){logger[_0x223f('0x14')](_0x223f('0x10'),_0xf64ecb,_0x57fb2f);_0x21bce5(_0x57fb2f);});});}exports[_0x223f('0x19')]=function(_0x28d31d){var _0x37723b=this;return new Promise(function(_0x4b57c5,_0x582432){return db[_0x223f('0x1a')][_0x223f('0x1b')](_0x28d31d[_0x223f('0x1c')],{'raw':_0x28d31d[_0x223f('0x1d')]?_0x28d31d[_0x223f('0x1d')][_0x223f('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x3dc997){logger['info']('CreateWhatsappMessage',_0x28d31d);logger['debug']('CreateWhatsappMessage',_0x28d31d,JSON['stringify'](_0x3dc997));_0x4b57c5(_0x3dc997);})['catch'](function(_0x3b8b5f){logger[_0x223f('0x14')]('CreateWhatsappMessage',_0x3b8b5f[_0x223f('0x16')],_0x28d31d);_0x582432(_0x37723b['error'](0x1f4,_0x3b8b5f['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index b4c732b..b87effb 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 _0x74e2=['./whatsappMessage.events','save','remove','update','emit','length'];(function(_0x52b844,_0x434e67){var _0x14432f=function(_0x6b692a){while(--_0x6b692a){_0x52b844['push'](_0x52b844['shift']());}};_0x14432f(++_0x434e67);}(_0x74e2,0x1d4));var _0x274e=function(_0x2e8e93,_0x1b289f){_0x2e8e93=_0x2e8e93-0x0;var _0x33030c=_0x74e2[_0x2e8e93];return _0x33030c;};'use strict';var WhatsappMessageEvents=require(_0x274e('0x0'));var events=[_0x274e('0x1'),_0x274e('0x2'),_0x274e('0x3')];function createListener(_0x15627c,_0x39bae3){return function(_0x8b43c1){_0x39bae3[_0x274e('0x4')](_0x15627c,_0x8b43c1);};}function removeListener(_0x3e5dcf,_0xd37e43){return function(){WhatsappMessageEvents['removeListener'](_0x3e5dcf,_0xd37e43);};}exports['register']=function(_0x631973){for(var _0xc246f1=0x0,_0x41273a=events[_0x274e('0x5')];_0xc246f1<_0x41273a;_0xc246f1++){var _0x332590=events[_0xc246f1];var _0x4aa79e=createListener('whatsappMessage:'+_0x332590,_0x631973);WhatsappMessageEvents['on'](_0x332590,_0x4aa79e);}}; \ No newline at end of file +var _0x3bda=['emit','length','save'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x3bda,0x143));var _0xa3bd=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x3bda[_0x1928c9];return _0x51b5fb;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xa3bd('0x0'),'remove','update'];function createListener(_0x3ebc9a,_0x148ad7){return function(_0x11ba90){_0x148ad7[_0xa3bd('0x1')](_0x3ebc9a,_0x11ba90);};}function removeListener(_0x3e7b4a,_0x4e5409){return function(){WhatsappMessageEvents['removeListener'](_0x3e7b4a,_0x4e5409);};}exports['register']=function(_0x934af5){for(var _0x2c5625=0x0,_0x17e659=events[_0xa3bd('0x2')];_0x2c5625<_0x17e659;_0x2c5625++){var _0x31d1f4=events[_0x2c5625];var _0xd47cd8=createListener('whatsappMessage:'+_0x31d1f4,_0x934af5);WhatsappMessageEvents['on'](_0x31d1f4,_0xd47cd8);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index c43ea39..f0343d6 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 _0xcfb6=['../../config/environment','./whatsappQueue.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','getTeams','getAgents','post','create','/:id/teams','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x404957,_0x5192a4){var _0x4e0365=function(_0x4f6cd7){while(--_0x4f6cd7){_0x404957['push'](_0x404957['shift']());}};_0x4e0365(++_0x5192a4);}(_0xcfb6,0x79));var _0x6cfb=function(_0x35a140,_0x3aeac6){_0x35a140=_0x35a140-0x0;var _0x30ab82=_0xcfb6[_0x35a140];return _0x30ab82;};'use strict';var multer=require(_0x6cfb('0x0'));var util=require(_0x6cfb('0x1'));var path=require(_0x6cfb('0x2'));var timeout=require(_0x6cfb('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6cfb('0x4'));var auth=require(_0x6cfb('0x5'));var interaction=require(_0x6cfb('0x6'));var config=require(_0x6cfb('0x7'));var controller=require(_0x6cfb('0x8'));router[_0x6cfb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x6cfb('0xa'),auth[_0x6cfb('0xb')](),controller[_0x6cfb('0xc')]);router[_0x6cfb('0x9')](_0x6cfb('0xd'),auth[_0x6cfb('0xb')](),controller[_0x6cfb('0xe')]);router['get'](_0x6cfb('0xf'),auth[_0x6cfb('0xb')](),controller[_0x6cfb('0x10')]);router[_0x6cfb('0x9')]('/:id/teams',auth[_0x6cfb('0xb')](),controller[_0x6cfb('0x11')]);router[_0x6cfb('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x6cfb('0x12')]);router[_0x6cfb('0x13')]('/',auth[_0x6cfb('0xb')](),controller[_0x6cfb('0x14')]);router[_0x6cfb('0x13')](_0x6cfb('0x15'),auth[_0x6cfb('0xb')](),controller[_0x6cfb('0x16')]);router[_0x6cfb('0x13')](_0x6cfb('0x17'),auth[_0x6cfb('0xb')](),controller[_0x6cfb('0x18')]);router[_0x6cfb('0x19')]('/:id',auth[_0x6cfb('0xb')](),controller[_0x6cfb('0x1a')]);router[_0x6cfb('0x1b')](_0x6cfb('0xd'),auth[_0x6cfb('0xb')](),controller[_0x6cfb('0x1c')]);router[_0x6cfb('0x1b')](_0x6cfb('0x15'),auth['isAuthenticated'](),controller[_0x6cfb('0x1d')]);router['delete'](_0x6cfb('0x17'),auth['isAuthenticated'](),controller[_0x6cfb('0x1e')]);module[_0x6cfb('0x1f')]=router; \ No newline at end of file +var _0xe0eb=['removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./whatsappQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','put','update','delete','destroy'];(function(_0x4dc2f7,_0x68dbab){var _0x2e483e=function(_0x1eeb6c){while(--_0x1eeb6c){_0x4dc2f7['push'](_0x4dc2f7['shift']());}};_0x2e483e(++_0x68dbab);}(_0xe0eb,0x1a7));var _0xbe0e=function(_0x5b3820,_0x51889c){_0x5b3820=_0x5b3820-0x0;var _0x442af8=_0xe0eb[_0x5b3820];return _0x442af8;};'use strict';var multer=require(_0xbe0e('0x0'));var util=require(_0xbe0e('0x1'));var path=require(_0xbe0e('0x2'));var timeout=require(_0xbe0e('0x3'));var express=require(_0xbe0e('0x4'));var router=express[_0xbe0e('0x5')]();var fs_extra=require(_0xbe0e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xbe0e('0x7'));var config=require('../../config/environment');var controller=require(_0xbe0e('0x8'));router['get']('/',auth[_0xbe0e('0x9')](),controller[_0xbe0e('0xa')]);router[_0xbe0e('0xb')](_0xbe0e('0xc'),auth[_0xbe0e('0x9')](),controller[_0xbe0e('0xd')]);router[_0xbe0e('0xb')](_0xbe0e('0xe'),auth[_0xbe0e('0x9')](),controller[_0xbe0e('0xf')]);router[_0xbe0e('0xb')](_0xbe0e('0x10'),auth[_0xbe0e('0x9')](),controller[_0xbe0e('0x11')]);router[_0xbe0e('0xb')]('/:id/teams',auth['isAuthenticated'](),controller[_0xbe0e('0x12')]);router['get'](_0xbe0e('0x13'),auth['isAuthenticated'](),controller[_0xbe0e('0x14')]);router[_0xbe0e('0x15')]('/',auth[_0xbe0e('0x9')](),controller['create']);router[_0xbe0e('0x15')](_0xbe0e('0x16'),auth[_0xbe0e('0x9')](),controller['addTeams']);router[_0xbe0e('0x15')](_0xbe0e('0x13'),auth['isAuthenticated'](),controller['addAgents']);router[_0xbe0e('0x17')](_0xbe0e('0xe'),auth['isAuthenticated'](),controller[_0xbe0e('0x18')]);router[_0xbe0e('0x19')](_0xbe0e('0xe'),auth[_0xbe0e('0x9')](),controller[_0xbe0e('0x1a')]);router[_0xbe0e('0x19')](_0xbe0e('0x16'),auth['isAuthenticated'](),controller[_0xbe0e('0x1b')]);router[_0xbe0e('0x19')]('/:id/users',auth[_0xbe0e('0x9')](),controller[_0xbe0e('0x1c')]);module[_0xbe0e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 1ebdae2..3150b8b 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 _0xf51f=['roundrobin','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf51f,0x191));var _0xff51=function(_0xf2662b,_0x4d8f41){_0xf2662b=_0xf2662b-0x0;var _0x257dc7=_0xf51f[_0xf2662b];return _0x257dc7;};'use strict';var Sequelize=require('sequelize');module[_0xff51('0x0')]={'name':{'type':Sequelize[_0xff51('0x1')],'unique':_0xff51('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xff51('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xff51('0x4')](_0xff51('0x5'),_0xff51('0x6'),_0xff51('0x7'))},'description':{'type':Sequelize[_0xff51('0x1')]}}; \ No newline at end of file +var _0x0f09=['ENUM','rrmemory','beepall','roundrobin','exports','STRING','name'];(function(_0x267767,_0x47ad13){var _0x19b874=function(_0x5386e9){while(--_0x5386e9){_0x267767['push'](_0x267767['shift']());}};_0x19b874(++_0x47ad13);}(_0x0f09,0xe4));var _0x90f0=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0f09[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require('sequelize');module[_0x90f0('0x0')]={'name':{'type':Sequelize[_0x90f0('0x1')],'unique':_0x90f0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x90f0('0x3')](_0x90f0('0x4'),_0x90f0('0x5'),_0x90f0('0x6'))},'description':{'type':Sequelize[_0x90f0('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 0ebd8ab..6ff8699 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 _0xbd5f=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','save','then','destroy','WhatsappQueues','UserProfileResource','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','options','WhatsappQueue','findAll','rows','catch','show','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','nolimit','order','WhatsappQueueId','UserWhatsappQueue','User','findAndCountAll','UserId','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','emit','userWhatsappQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x452037,_0x4c09fd){var _0x2b18b5=function(_0x49d716){while(--_0x49d716){_0x452037['push'](_0x452037['shift']());}};_0x2b18b5(++_0x4c09fd);}(_0xbd5f,0x18d));var _0xfbd5=function(_0x53e3fa,_0x50c5f2){_0x53e3fa=_0x53e3fa-0x0;var _0xe8584a=_0xbd5f[_0x53e3fa];return _0xe8584a;};'use strict';var pdf=require(_0xfbd5('0x0'));var emlformat=require(_0xfbd5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfbd5('0x2'));var jsonpatch=require(_0xfbd5('0x3'));var rp=require(_0xfbd5('0x4'));var moment=require(_0xfbd5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfbd5('0x6'));var util=require(_0xfbd5('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfbd5('0x8'));var fs=require('fs');var fs_extra=require(_0xfbd5('0x9'));var _=require(_0xfbd5('0xa'));var squel=require(_0xfbd5('0xb'));var crypto=require(_0xfbd5('0xc'));var jsforce=require(_0xfbd5('0xd'));var deskjs=require(_0xfbd5('0xe'));var toCsv=require(_0xfbd5('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfbd5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xfbd5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfbd5('0x12'))(_0xfbd5('0x13'));var utils=require('../../config/utils');var config=require(_0xfbd5('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xfbd5('0x15'))['db'];config[_0xfbd5('0x16')]=_[_0xfbd5('0x17')](config[_0xfbd5('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xfbd5('0x18'))(new Redis(config[_0xfbd5('0x16')]));require(_0xfbd5('0x19'))[_0xfbd5('0x1a')](socket);function respondWithStatusCode(_0x2d35c4,_0x3eb9ac){_0x3eb9ac=_0x3eb9ac||0xcc;return function(_0x5ca68d){if(_0x5ca68d){return _0x2d35c4[_0xfbd5('0x1b')](_0x3eb9ac);}return _0x2d35c4[_0xfbd5('0x1c')](_0x3eb9ac)[_0xfbd5('0x1d')]();};}function respondWithResult(_0x81cbb1,_0x446d2e){_0x446d2e=_0x446d2e||0xc8;return function(_0x5bb30b){if(_0x5bb30b){return _0x81cbb1[_0xfbd5('0x1c')](_0x446d2e)['json'](_0x5bb30b);}};}function respondWithFilteredResult(_0x188566,_0x3073d0){return function(_0x2fe6ab){if(_0x2fe6ab){var _0x3bd872=_0x2fe6ab[_0xfbd5('0x1e')],_0x4fbb94=_0x3073d0[_0xfbd5('0x1f')],_0xfc5ce1=_0x3073d0[_0xfbd5('0x1f')]+_0x3073d0[_0xfbd5('0x20')],_0x56c44d;if(_0xfc5ce1>=_0x3bd872){_0xfc5ce1=_0x3bd872;_0x56c44d=0xc8;}else{_0x56c44d=0xce;}_0x188566['status'](_0x56c44d);return _0x188566[_0xfbd5('0x21')](_0xfbd5('0x22'),_0x4fbb94+'-'+_0xfc5ce1+'/'+_0x3bd872)['json'](_0x2fe6ab);}return null;};}function patchUpdates(_0x537c74){return function(_0x4e3f97){try{jsonpatch['apply'](_0x4e3f97,_0x537c74,!![]);}catch(_0xe968b1){return BPromise[_0xfbd5('0x23')](_0xe968b1);}return _0x4e3f97[_0xfbd5('0x24')]();};}function saveUpdates(_0x5ed545,_0x5e90cc){return function(_0x4f95c3){if(_0x4f95c3){return _0x4f95c3['update'](_0x5ed545)[_0xfbd5('0x25')](function(_0xe5fb2e){return _0xe5fb2e;});}return null;};}function removeEntity(_0x3063f6,_0x2d8c5b){return function(_0x992da2){if(_0x992da2){return _0x992da2[_0xfbd5('0x26')]()[_0xfbd5('0x25')](function(){var _0xbd4d84=_0x992da2['get']({'plain':!![]});var _0x9cb2e0=_0xfbd5('0x27');return db[_0xfbd5('0x28')][_0xfbd5('0x26')]({'where':{'type':_0x9cb2e0,'resourceId':_0xbd4d84['id']}})['then'](function(){return _0x992da2;});})[_0xfbd5('0x25')](function(){_0x3063f6['status'](0xcc)[_0xfbd5('0x1d')]();});}};}function handleEntityNotFound(_0x4325e4,_0x5a5647){return function(_0x5279e0){if(!_0x5279e0){_0x4325e4[_0xfbd5('0x1b')](0x194);}return _0x5279e0;};}function handleError(_0x2c81d4,_0x39a091){_0x39a091=_0x39a091||0x1f4;return function(_0xb81845){logger['error'](_0xb81845['stack']);if(_0xb81845[_0xfbd5('0x29')]){delete _0xb81845[_0xfbd5('0x29')];}_0x2c81d4[_0xfbd5('0x1c')](_0x39a091)[_0xfbd5('0x2a')](_0xb81845);};}exports[_0xfbd5('0x2b')]=function(_0x2842e1,_0x149182){var _0x2ff058={},_0x178862={},_0x3776a0={'count':0x0,'rows':[]};var _0x43134a=_[_0xfbd5('0x2c')](db['WhatsappQueue'][_0xfbd5('0x2d')],function(_0x35f7de){return{'name':_0x35f7de['fieldName'],'type':_0x35f7de[_0xfbd5('0x2e')][_0xfbd5('0x2f')]};});_0x178862[_0xfbd5('0x30')]=_[_0xfbd5('0x2c')](_0x43134a,_0xfbd5('0x29'));_0x178862[_0xfbd5('0x31')]=_[_0xfbd5('0x32')](_0x2842e1[_0xfbd5('0x31')]);_0x178862[_0xfbd5('0x33')]=_[_0xfbd5('0x34')](_0x178862[_0xfbd5('0x30')],_0x178862[_0xfbd5('0x31')]);_0x2ff058[_0xfbd5('0x35')]=_[_0xfbd5('0x34')](_0x178862[_0xfbd5('0x30')],qs['fields'](_0x2842e1['query'][_0xfbd5('0x36')]));_0x2ff058[_0xfbd5('0x35')]=_0x2ff058['attributes']['length']?_0x2ff058['attributes']:_0x178862['model'];if(!_0x2842e1[_0xfbd5('0x31')][_0xfbd5('0x37')]('nolimit')){_0x2ff058[_0xfbd5('0x20')]=qs['limit'](_0x2842e1[_0xfbd5('0x31')][_0xfbd5('0x20')]);_0x2ff058[_0xfbd5('0x1f')]=qs[_0xfbd5('0x1f')](_0x2842e1['query'][_0xfbd5('0x1f')]);}_0x2ff058['order']=qs['sort'](_0x2842e1[_0xfbd5('0x31')][_0xfbd5('0x38')]);_0x2ff058[_0xfbd5('0x39')]=qs[_0xfbd5('0x33')](_[_0xfbd5('0x3a')](_0x2842e1[_0xfbd5('0x31')],_0x178862[_0xfbd5('0x33')]),_0x43134a);if(_0x2842e1[_0xfbd5('0x31')][_0xfbd5('0x3b')]){_0x2ff058[_0xfbd5('0x39')]=_[_0xfbd5('0x3c')](_0x2ff058['where'],{'$or':_[_0xfbd5('0x2c')](_0x43134a,function(_0x21fb65){if(_0x21fb65[_0xfbd5('0x2e')]!=='VIRTUAL'){var _0x32991f={};_0x32991f[_0x21fb65[_0xfbd5('0x29')]]={'$like':'%'+_0x2842e1[_0xfbd5('0x31')][_0xfbd5('0x3b')]+'%'};return _0x32991f;}})});}_0x2ff058=_[_0xfbd5('0x3c')]({},_0x2ff058,_0x2842e1[_0xfbd5('0x3d')]);var _0x1513e4={'where':_0x2ff058[_0xfbd5('0x39')]};return db['WhatsappQueue'][_0xfbd5('0x1e')](_0x1513e4)['then'](function(_0x481294){_0x3776a0['count']=_0x481294;if(_0x2842e1['query']['includeAll']){_0x2ff058['include']=[{'all':!![]}];}return db[_0xfbd5('0x3e')][_0xfbd5('0x3f')](_0x2ff058);})[_0xfbd5('0x25')](function(_0x504b7c){_0x3776a0[_0xfbd5('0x40')]=_0x504b7c;return _0x3776a0;})[_0xfbd5('0x25')](respondWithFilteredResult(_0x149182,_0x2ff058))[_0xfbd5('0x41')](handleError(_0x149182,null));};exports[_0xfbd5('0x42')]=function(_0xe8dd23,_0x2b50f4){var _0x1b6fef={'raw':!![],'where':{'id':_0xe8dd23[_0xfbd5('0x43')]['id']}},_0xd34e91={};_0xd34e91[_0xfbd5('0x30')]=_[_0xfbd5('0x32')](db['WhatsappQueue'][_0xfbd5('0x2d')]);_0xd34e91[_0xfbd5('0x31')]=_[_0xfbd5('0x32')](_0xe8dd23['query']);_0xd34e91[_0xfbd5('0x33')]=_['intersection'](_0xd34e91['model'],_0xd34e91[_0xfbd5('0x31')]);_0x1b6fef[_0xfbd5('0x35')]=_[_0xfbd5('0x34')](_0xd34e91[_0xfbd5('0x30')],qs[_0xfbd5('0x36')](_0xe8dd23[_0xfbd5('0x31')][_0xfbd5('0x36')]));_0x1b6fef[_0xfbd5('0x35')]=_0x1b6fef[_0xfbd5('0x35')][_0xfbd5('0x44')]?_0x1b6fef['attributes']:_0xd34e91[_0xfbd5('0x30')];if(_0xe8dd23[_0xfbd5('0x31')][_0xfbd5('0x45')]){_0x1b6fef['include']=[{'all':!![]}];}_0x1b6fef=_[_0xfbd5('0x3c')]({},_0x1b6fef,_0xe8dd23[_0xfbd5('0x3d')]);return db['WhatsappQueue'][_0xfbd5('0x46')](_0x1b6fef)[_0xfbd5('0x25')](handleEntityNotFound(_0x2b50f4,null))[_0xfbd5('0x25')](respondWithResult(_0x2b50f4,null))['catch'](handleError(_0x2b50f4,null));};exports[_0xfbd5('0x47')]=function(_0x4d8094,_0x3464da){return db[_0xfbd5('0x3e')]['create'](_0x4d8094[_0xfbd5('0x48')],{})[_0xfbd5('0x25')](function(_0xc16b0c){var _0x4a9b7a=_0x4d8094[_0xfbd5('0x49')]['get']({'plain':!![]});if(!_0x4a9b7a)throw new Error(_0xfbd5('0x4a'));if(_0x4a9b7a['role']===_0xfbd5('0x49')){var _0x854a31=_0xc16b0c[_0xfbd5('0x4b')]({'plain':!![]});var _0x47500f=_0xfbd5('0x27');return db['UserProfileSection'][_0xfbd5('0x46')]({'where':{'name':_0x47500f,'userProfileId':_0x4a9b7a[_0xfbd5('0x4c')]},'raw':!![]})['then'](function(_0xfdc6a8){if(_0xfdc6a8&&_0xfdc6a8[_0xfbd5('0x4d')]===0x0){return db[_0xfbd5('0x28')][_0xfbd5('0x47')]({'name':_0x854a31['name'],'resourceId':_0x854a31['id'],'type':_0xfdc6a8['name'],'sectionId':_0xfdc6a8['id']},{})[_0xfbd5('0x25')](function(){return _0xc16b0c;});}else{return _0xc16b0c;}})[_0xfbd5('0x41')](function(_0x3924d3){logger['error'](_0xfbd5('0x4e'),_0x3924d3);throw _0x3924d3;});}return _0xc16b0c;})[_0xfbd5('0x25')](respondWithResult(_0x3464da,0xc9))[_0xfbd5('0x41')](handleError(_0x3464da,null));};exports['update']=function(_0x10390e,_0x4469c9){if(_0x10390e[_0xfbd5('0x48')]['id']){delete _0x10390e[_0xfbd5('0x48')]['id'];}return db[_0xfbd5('0x3e')][_0xfbd5('0x46')]({'where':{'id':_0x10390e['params']['id']}})['then'](handleEntityNotFound(_0x4469c9,null))[_0xfbd5('0x25')](saveUpdates(_0x10390e['body'],null))[_0xfbd5('0x25')](respondWithResult(_0x4469c9,null))[_0xfbd5('0x41')](handleError(_0x4469c9,null));};exports[_0xfbd5('0x26')]=function(_0x5bd48a,_0x625a04){return db[_0xfbd5('0x3e')][_0xfbd5('0x46')]({'where':{'id':_0x5bd48a[_0xfbd5('0x43')]['id']}})[_0xfbd5('0x25')](handleEntityNotFound(_0x625a04,null))[_0xfbd5('0x25')](removeEntity(_0x625a04,null))[_0xfbd5('0x41')](handleError(_0x625a04,null));};exports['describe']=function(_0x543a8e,_0x5341b3){return db['WhatsappQueue'][_0xfbd5('0x4f')]()[_0xfbd5('0x25')](respondWithResult(_0x5341b3,null))[_0xfbd5('0x41')](handleError(_0x5341b3,null));};exports['getMembers']=function(_0x30c12f,_0x3d9d1e,_0x1e4c43){var _0x17024f={'raw':!![],'where':{}},_0x3a1f60={},_0x19993b;return db[_0xfbd5('0x3e')][_0xfbd5('0x50')]({'where':{'id':_0x30c12f[_0xfbd5('0x43')]['id']}})[_0xfbd5('0x25')](handleEntityNotFound(_0x3d9d1e,null))[_0xfbd5('0x25')](function(_0x36eace){if(_0x36eace){_0x19993b=_0x36eace[_0xfbd5('0x4b')]({'plain':!![]});_0x3a1f60[_0xfbd5('0x30')]=_[_0xfbd5('0x32')](db['UserWhatsappQueue'][_0xfbd5('0x2d')]);_0x3a1f60[_0xfbd5('0x31')]=_[_0xfbd5('0x32')](_0x30c12f[_0xfbd5('0x31')]);_0x3a1f60['filters']=_[_0xfbd5('0x34')](_0x3a1f60[_0xfbd5('0x30')],_0x3a1f60[_0xfbd5('0x31')]);_0x17024f[_0xfbd5('0x35')]=_[_0xfbd5('0x34')](_0x3a1f60[_0xfbd5('0x30')],qs[_0xfbd5('0x36')](_0x30c12f[_0xfbd5('0x31')]['fields']));_0x17024f[_0xfbd5('0x35')]=_0x17024f[_0xfbd5('0x35')][_0xfbd5('0x44')]?_0x17024f[_0xfbd5('0x35')]:_0x3a1f60['model'];if(!_0x30c12f['query'][_0xfbd5('0x37')](_0xfbd5('0x51'))){_0x17024f[_0xfbd5('0x20')]=qs['limit'](_0x30c12f['query'][_0xfbd5('0x20')]);_0x17024f[_0xfbd5('0x1f')]=qs[_0xfbd5('0x1f')](_0x30c12f[_0xfbd5('0x31')][_0xfbd5('0x1f')]);}_0x17024f[_0xfbd5('0x52')]=qs[_0xfbd5('0x38')](_0x30c12f[_0xfbd5('0x31')]['sort']);_0x17024f[_0xfbd5('0x39')]=qs[_0xfbd5('0x33')](_[_0xfbd5('0x3a')](_0x30c12f[_0xfbd5('0x31')],_0x3a1f60[_0xfbd5('0x33')]));_0x17024f[_0xfbd5('0x39')][_0xfbd5('0x53')]=_0x36eace['id'];if(_0x30c12f[_0xfbd5('0x31')][_0xfbd5('0x3b')]){_0x17024f[_0xfbd5('0x39')]=_['merge'](_0x17024f[_0xfbd5('0x39')],{'$or':_[_0xfbd5('0x2c')](_0x17024f['attributes'],function(_0x139f75){var _0x4265ef={};_0x4265ef[_0x139f75]={'$like':'%'+_0x30c12f['query']['filter']+'%'};return _0x4265ef;})});}_0x17024f=_[_0xfbd5('0x3c')]({},_0x17024f,_0x30c12f[_0xfbd5('0x3d')]);return db[_0xfbd5('0x54')]['findAll'](_0x17024f);}})[_0xfbd5('0x25')](function(_0x59de9d){if(_0x59de9d){return db[_0xfbd5('0x55')][_0xfbd5('0x56')]({'where':{'id':_[_0xfbd5('0x2c')](_0x59de9d,_0xfbd5('0x57')),'role':'agent'},'attributes':['id',_0xfbd5('0x29'),_0xfbd5('0x58'),_0xfbd5('0x59'),_0xfbd5('0x5a')]});}})['then'](function(_0x1c425e){if(_0x1c425e){return{'count':_0x1c425e[_0xfbd5('0x1e')],'rows':_[_0xfbd5('0x2c')](_0x1c425e[_0xfbd5('0x40')],function(_0x5169ff){return{'membername':_0x5169ff[_0xfbd5('0x29')],'UserId':_0x5169ff['id'],'queue_name':_0x19993b['name'],'WhatsappQueueId':_0x19993b['id'],'interface':util[_0xfbd5('0x5b')](_0xfbd5('0x5c'),_0xfbd5('0x5d'),_0x5169ff[_0xfbd5('0x29')]),'penalty':0x0,'paused':_0x5169ff[_0xfbd5('0x58')],'createdAt':_0x5169ff[_0xfbd5('0x5a')],'updatedAt':_0x5169ff[_0xfbd5('0x59')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3d9d1e,_0x17024f))['catch'](handleError(_0x3d9d1e,null));};exports['getTeams']=function(_0x2b07d9,_0x5651b5,_0x20a3ce){var _0x4c7b6e={};var _0x14d2ba={};var _0x31291d;var _0x1541ce;return db[_0xfbd5('0x3e')][_0xfbd5('0x50')]({'where':{'id':_0x2b07d9[_0xfbd5('0x43')]['id']}})['then'](handleEntityNotFound(_0x5651b5,null))['then'](function(_0x20027a){if(_0x20027a){_0x31291d=_0x20027a;_0x14d2ba['model']=_['keys'](db[_0xfbd5('0x5e')][_0xfbd5('0x2d')]);_0x14d2ba[_0xfbd5('0x31')]=_['keys'](_0x2b07d9[_0xfbd5('0x31')]);_0x14d2ba[_0xfbd5('0x33')]=_[_0xfbd5('0x34')](_0x14d2ba[_0xfbd5('0x30')],_0x14d2ba[_0xfbd5('0x31')]);_0x4c7b6e[_0xfbd5('0x35')]=_[_0xfbd5('0x34')](_0x14d2ba[_0xfbd5('0x30')],qs['fields'](_0x2b07d9['query'][_0xfbd5('0x36')]));_0x4c7b6e[_0xfbd5('0x35')]=_0x4c7b6e['attributes']['length']?_0x4c7b6e[_0xfbd5('0x35')]:_0x14d2ba[_0xfbd5('0x30')];_0x4c7b6e['order']=qs['sort'](_0x2b07d9[_0xfbd5('0x31')][_0xfbd5('0x38')]);_0x4c7b6e[_0xfbd5('0x39')]=qs['filters'](_[_0xfbd5('0x3a')](_0x2b07d9['query'],_0x14d2ba['filters']));if(_0x2b07d9[_0xfbd5('0x31')]['filter']){_0x4c7b6e[_0xfbd5('0x39')]=_['merge'](_0x4c7b6e[_0xfbd5('0x39')],{'$or':_[_0xfbd5('0x2c')](_0x4c7b6e['attributes'],function(_0x3c2c15){var _0x349083={};_0x349083[_0x3c2c15]={'$like':'%'+_0x2b07d9[_0xfbd5('0x31')][_0xfbd5('0x3b')]+'%'};return _0x349083;})});}_0x4c7b6e=_[_0xfbd5('0x3c')]({},_0x4c7b6e,_0x2b07d9[_0xfbd5('0x3d')]);return _0x31291d['getTeams'](_0x4c7b6e);}})[_0xfbd5('0x25')](function(_0x1da67d){if(_0x1da67d){_0x1541ce=_0x1da67d['length'];if(!_0x2b07d9['query'][_0xfbd5('0x37')](_0xfbd5('0x51'))){_0x4c7b6e[_0xfbd5('0x20')]=qs[_0xfbd5('0x20')](_0x2b07d9[_0xfbd5('0x31')][_0xfbd5('0x20')]);_0x4c7b6e['offset']=qs['offset'](_0x2b07d9[_0xfbd5('0x31')][_0xfbd5('0x1f')]);}return _0x31291d[_0xfbd5('0x5f')](_0x4c7b6e);}})[_0xfbd5('0x25')](function(_0x21e296){if(_0x21e296){return _0x21e296?{'count':_0x1541ce,'rows':_0x21e296}:null;}})['then'](respondWithResult(_0x5651b5,null))[_0xfbd5('0x41')](handleError(_0x5651b5,null));};exports[_0xfbd5('0x60')]=function(_0x2e74f1,_0x72d5b8,_0xc52d20){var _0x5413de=_0x2e74f1[_0xfbd5('0x48')]['ids'];return db['Team'][_0xfbd5('0x3f')]({'where':{'id':_0x5413de},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfbd5('0x61'),'attributes':['id',_0xfbd5('0x29'),_0xfbd5('0x62'),_0xfbd5('0x63'),_0xfbd5('0x64')],'raw':!![]}]})[_0xfbd5('0x25')](function(_0x79d43b){if(_0x79d43b){var _0x42191f=_[_0xfbd5('0x65')](_0x79d43b,function(_0x1e75a8){var _0x4809e7=_0x1e75a8['get']({'plain':!![]});return _0x4809e7[_0xfbd5('0x61')];});return db[_0xfbd5('0x3e')][_0xfbd5('0x46')]({'where':{'id':_0x2e74f1[_0xfbd5('0x43')]['id']}})[_0xfbd5('0x25')](function(_0x41e74a){return db[_0xfbd5('0x66')][_0xfbd5('0x67')](function(_0x1f8934){return _0x41e74a['addTeams'](_0x5413de,{'transaction':_0x1f8934})['then'](function(){return BPromise[_0xfbd5('0x68')](_0x42191f,function(_0x591880){return db[_0xfbd5('0x54')]['findOrCreate']({'where':{'UserId':_0x591880['id'],'WhatsappQueueId':_0x2e74f1[_0xfbd5('0x43')]['id']},'transaction':_0x1f8934});});})['then'](function(){_0x42191f[_0xfbd5('0x69')](function(_0x3843d8){socket[_0xfbd5('0x6a')](_0xfbd5('0x6b'),{'UserId':_0x3843d8['id'],'WhatsappQueueId':_0x41e74a['id']});});});});});}})['then'](respondWithStatusCode(_0x72d5b8,null))[_0xfbd5('0x41')](handleError(_0x72d5b8,null));};exports[_0xfbd5('0x6c')]=function(_0x40707d,_0x4c9198,_0x18419d){return db[_0xfbd5('0x5e')][_0xfbd5('0x3f')]({'where':{'id':_0x40707d[_0xfbd5('0x31')][_0xfbd5('0x6d')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xfbd5('0x25')](handleEntityNotFound(_0x4c9198,null))[_0xfbd5('0x25')](function(_0x2b05a8){var _0x242a20=_[_0xfbd5('0x2c')](_0x2b05a8,'id');var _0x198566=[];var _0x531336=[];var _0x2ce5bb=squel[_0xfbd5('0x6e')]();_0x2ce5bb[_0xfbd5('0x6f')](_0xfbd5('0x70'))[_0xfbd5('0x71')](_0xfbd5('0x72'),'tq')[_0xfbd5('0x73')](_0xfbd5('0x74'),'ut',_0xfbd5('0x75'))['where']('WhatsappQueueId\x20=\x20?',_0x40707d[_0xfbd5('0x43')]['id']);for(var _0x1cf037=0x0;_0x1cf037<_0x2b05a8[_0xfbd5('0x44')];_0x1cf037+=0x1){let _0x4bee76=_0x2b05a8[_0x1cf037];for(var _0x4de158=0x0;_0x4de158<_0x4bee76[_0xfbd5('0x61')][_0xfbd5('0x44')];_0x4de158+=0x1){let _0x5da65f=_0x4bee76[_0xfbd5('0x61')][_0x4de158];var _0x4b4960=_0x2ce5bb[_0xfbd5('0x76')]();_0x4b4960[_0xfbd5('0x39')](_0xfbd5('0x77'),_0x5da65f['id']);_0x531336['push'](db[_0xfbd5('0x66')]['query'](_0x4b4960['toString'](),{'type':db[_0xfbd5('0x66')][_0xfbd5('0x78')][_0xfbd5('0x79')]})['then'](function(_0x58f271){if(_0x58f271[_0xfbd5('0x44')]===0x1){return _0x5da65f['id'];}else{var _0x4aa001=_[_0xfbd5('0x7a')](_[_0xfbd5('0x2c')](_0x58f271,_0xfbd5('0x7b')),function(_0x43e9af){return _['includes'](_0x242a20,_0x43e9af);});if(_0x4aa001){return _0x5da65f['id'];}}}));}}return BPromise[_0xfbd5('0x7c')](_0x531336)[_0xfbd5('0x25')](function(_0x1edb3b){_0x198566=_(_0x198566)[_0xfbd5('0x7d')](_0x1edb3b)[_0xfbd5('0x7e')]()[_0xfbd5('0x7f')]();return db['WhatsappQueue'][_0xfbd5('0x46')]({'where':{'id':_0x40707d[_0xfbd5('0x43')]['id']}})[_0xfbd5('0x25')](function(_0x2306ad){return db[_0xfbd5('0x66')]['transaction'](function(_0x17781d){return _0x2306ad[_0xfbd5('0x6c')](_0x40707d[_0xfbd5('0x31')][_0xfbd5('0x6d')],{'transaction':_0x17781d})['then'](function(){if(!_[_0xfbd5('0x80')](_0x198566)){return _0x2306ad[_0xfbd5('0x81')](_0x198566,{'transaction':_0x17781d});}})[_0xfbd5('0x25')](function(){_0x198566[_0xfbd5('0x69')](function(_0x283ec5){socket[_0xfbd5('0x6a')](_0xfbd5('0x82'),{'UserId':_0x283ec5,'WhatsappQueueId':_0x2306ad['id']});});});});});});})['then'](respondWithStatusCode(_0x4c9198,null))[_0xfbd5('0x41')](handleError(_0x4c9198,null));};exports[_0xfbd5('0x83')]=function(_0x55f00f,_0x4010cc,_0x17b3a3){return db[_0xfbd5('0x3e')][_0xfbd5('0x46')]({'where':{'id':_0x55f00f[_0xfbd5('0x43')]['id']}})[_0xfbd5('0x25')](handleEntityNotFound(_0x4010cc,null))[_0xfbd5('0x25')](function(_0x23fac6){if(_0x23fac6){return _0x23fac6[_0xfbd5('0x83')](_0x55f00f[_0xfbd5('0x48')][_0xfbd5('0x6d')],_[_0xfbd5('0x84')](_0x55f00f['body'],['ids','id'])||{})[_0xfbd5('0x85')](function(_0x170bde){for(var _0x35cb9a=0x0;_0x35cb9a<_0x55f00f['body'][_0xfbd5('0x6d')]['length'];_0x35cb9a+=0x1){socket[_0xfbd5('0x6a')](_0xfbd5('0x6b'),{'UserId':_0x55f00f[_0xfbd5('0x48')][_0xfbd5('0x6d')][_0x35cb9a],'WhatsappQueueId':_0x55f00f[_0xfbd5('0x43')]['id']});}return _0x170bde;});}})[_0xfbd5('0x25')](respondWithResult(_0x4010cc,null))[_0xfbd5('0x41')](handleError(_0x4010cc,null));};exports[_0xfbd5('0x81')]=function(_0x865156,_0x42c07f,_0x445597){return db[_0xfbd5('0x3e')][_0xfbd5('0x46')]({'where':{'id':_0x865156[_0xfbd5('0x43')]['id']}})[_0xfbd5('0x25')](handleEntityNotFound(_0x42c07f,null))[_0xfbd5('0x25')](function(_0x1a56fe){if(_0x1a56fe){return _0x1a56fe['removeAgents'](_0x865156[_0xfbd5('0x31')][_0xfbd5('0x6d')])['then'](function(){if(_['isArray'](_0x865156[_0xfbd5('0x31')][_0xfbd5('0x6d')])){for(var _0x4d4afa=0x0;_0x4d4afa<_0x865156[_0xfbd5('0x31')]['ids'][_0xfbd5('0x44')];_0x4d4afa+=0x1){socket['emit'](_0xfbd5('0x82'),{'UserId':Number(_0x865156[_0xfbd5('0x31')]['ids'][_0x4d4afa]),'WhatsappQueueId':Number(_0x865156[_0xfbd5('0x43')]['id'])});}}else{socket[_0xfbd5('0x6a')]('userWhatsappQueue:remove',{'UserId':Number(_0x865156[_0xfbd5('0x31')][_0xfbd5('0x6d')]),'WhatsappQueueId':Number(_0x865156[_0xfbd5('0x43')]['id'])});}});}})[_0xfbd5('0x25')](respondWithStatusCode(_0x42c07f,null))[_0xfbd5('0x41')](handleError(_0x42c07f,null));};exports[_0xfbd5('0x86')]=function(_0x31222e,_0x5638e6,_0x20b8a0){var _0x2decfc={};var _0x12f36f={};var _0x38b934;var _0x2eaf83;return db[_0xfbd5('0x3e')][_0xfbd5('0x50')]({'where':{'id':_0x31222e[_0xfbd5('0x43')]['id']}})[_0xfbd5('0x25')](handleEntityNotFound(_0x5638e6,null))['then'](function(_0x530df6){if(_0x530df6){_0x38b934=_0x530df6;_0x12f36f[_0xfbd5('0x30')]=_['keys'](db[_0xfbd5('0x55')]['rawAttributes']);_0x12f36f[_0xfbd5('0x31')]=_['keys'](_0x31222e['query']);_0x12f36f[_0xfbd5('0x33')]=_[_0xfbd5('0x34')](_0x12f36f['model'],_0x12f36f[_0xfbd5('0x31')]);_0x2decfc[_0xfbd5('0x35')]=_[_0xfbd5('0x34')](_0x12f36f[_0xfbd5('0x30')],qs['fields'](_0x31222e[_0xfbd5('0x31')][_0xfbd5('0x36')]));_0x2decfc[_0xfbd5('0x35')]=_0x2decfc[_0xfbd5('0x35')][_0xfbd5('0x44')]?_0x2decfc[_0xfbd5('0x35')]:_0x12f36f[_0xfbd5('0x30')];_0x2decfc[_0xfbd5('0x52')]=qs[_0xfbd5('0x38')](_0x31222e[_0xfbd5('0x31')][_0xfbd5('0x38')]);_0x2decfc[_0xfbd5('0x39')]=qs['filters'](_[_0xfbd5('0x3a')](_0x31222e[_0xfbd5('0x31')],_0x12f36f[_0xfbd5('0x33')]));if(_0x31222e[_0xfbd5('0x31')][_0xfbd5('0x3b')]){_0x2decfc[_0xfbd5('0x39')]=_[_0xfbd5('0x3c')](_0x2decfc[_0xfbd5('0x39')],{'$or':_[_0xfbd5('0x2c')](_0x2decfc[_0xfbd5('0x35')],function(_0x82297a){var _0x546877={};_0x546877[_0x82297a]={'$like':'%'+_0x31222e[_0xfbd5('0x31')][_0xfbd5('0x3b')]+'%'};return _0x546877;})});}_0x2decfc=_[_0xfbd5('0x3c')]({},_0x2decfc,_0x31222e[_0xfbd5('0x3d')]);return _0x38b934[_0xfbd5('0x86')](_0x2decfc);}})['then'](function(_0x2a9b65){if(_0x2a9b65){_0x2eaf83=_0x2a9b65['length'];if(!_0x31222e[_0xfbd5('0x31')][_0xfbd5('0x37')](_0xfbd5('0x51'))){_0x2decfc['limit']=qs[_0xfbd5('0x20')](_0x31222e[_0xfbd5('0x31')]['limit']);_0x2decfc[_0xfbd5('0x1f')]=qs['offset'](_0x31222e['query']['offset']);}return _0x38b934[_0xfbd5('0x86')](_0x2decfc);}})[_0xfbd5('0x25')](function(_0x28a84a){if(_0x28a84a){return _0x28a84a?{'count':_0x2eaf83,'rows':_0x28a84a}:null;}})['then'](respondWithResult(_0x5638e6,null))['catch'](handleError(_0x5638e6,null));}; \ No newline at end of file +var _0x6ae0=['filter','merge','type','VIRTUAL','options','count','include','findAll','rows','catch','show','params','filters','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','nolimit','map','UserWhatsappQueue','User','findAndCountAll','UserId','agent','whatsappPause','createdAt','%s/%s','SIP','updatedAt','Team','order','getTeams','addTeams','ids','Agents','voicePause','interface','each','forEach','emit','userWhatsappQueue:save','removeTeams','field','tq.TeamId','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','transaction','removeAgents','userWhatsappQueue:remove','addAgents','omit','getAgents','eml-format','rimraf','zip-dir','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','WhatsappQueues','end','stack','name','WhatsappQueue','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick'];(function(_0x516fa4,_0x3a79c9){var _0x42126a=function(_0x4f9b18){while(--_0x4f9b18){_0x516fa4['push'](_0x516fa4['shift']());}};_0x42126a(++_0x3a79c9);}(_0x6ae0,0xd3));var _0x06ae=function(_0x4ce02e,_0x4486a9){_0x4ce02e=_0x4ce02e-0x0;var _0x4aab50=_0x6ae0[_0x4ce02e];return _0x4aab50;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x06ae('0x0'));var rimraf=require(_0x06ae('0x1'));var zipdir=require(_0x06ae('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x06ae('0x3'));var Mustache=require(_0x06ae('0x4'));var util=require('util');var path=require(_0x06ae('0x5'));var sox=require('sox');var csv=require(_0x06ae('0x6'));var ejs=require(_0x06ae('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x06ae('0x8'));var squel=require(_0x06ae('0x9'));var crypto=require(_0x06ae('0xa'));var jsforce=require(_0x06ae('0xb'));var deskjs=require(_0x06ae('0xc'));var toCsv=require(_0x06ae('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x06ae('0xd'));var authService=require(_0x06ae('0xe'));var qs=require(_0x06ae('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x06ae('0x10'));var logger=require(_0x06ae('0x11'))(_0x06ae('0x12'));var utils=require(_0x06ae('0x13'));var config=require(_0x06ae('0x14'));var licenseUtil=require(_0x06ae('0x15'));var db=require(_0x06ae('0x16'))['db'];config[_0x06ae('0x17')]=_[_0x06ae('0x18')](config[_0x06ae('0x17')],{'host':_0x06ae('0x19'),'port':0x18eb});var socket=require(_0x06ae('0x1a'))(new Redis(config['redis']));require(_0x06ae('0x1b'))[_0x06ae('0x1c')](socket);function respondWithStatusCode(_0x3507b4,_0x428e70){_0x428e70=_0x428e70||0xcc;return function(_0x4d4fd8){if(_0x4d4fd8){return _0x3507b4[_0x06ae('0x1d')](_0x428e70);}return _0x3507b4[_0x06ae('0x1e')](_0x428e70)['end']();};}function respondWithResult(_0xeee41f,_0x3a59bc){_0x3a59bc=_0x3a59bc||0xc8;return function(_0x551c40){if(_0x551c40){return _0xeee41f[_0x06ae('0x1e')](_0x3a59bc)[_0x06ae('0x1f')](_0x551c40);}};}function respondWithFilteredResult(_0x35ff9f,_0x1eadcb){return function(_0x3b36c7){if(_0x3b36c7){var _0x1aa551=_0x3b36c7['count'],_0x14afea=_0x1eadcb[_0x06ae('0x20')],_0x2c3a9b=_0x1eadcb[_0x06ae('0x20')]+_0x1eadcb[_0x06ae('0x21')],_0x3cafe4;if(_0x2c3a9b>=_0x1aa551){_0x2c3a9b=_0x1aa551;_0x3cafe4=0xc8;}else{_0x3cafe4=0xce;}_0x35ff9f[_0x06ae('0x1e')](_0x3cafe4);return _0x35ff9f[_0x06ae('0x22')](_0x06ae('0x23'),_0x14afea+'-'+_0x2c3a9b+'/'+_0x1aa551)[_0x06ae('0x1f')](_0x3b36c7);}return null;};}function patchUpdates(_0x6087ea){return function(_0x2bc007){try{jsonpatch[_0x06ae('0x24')](_0x2bc007,_0x6087ea,!![]);}catch(_0x16840a){return BPromise[_0x06ae('0x25')](_0x16840a);}return _0x2bc007[_0x06ae('0x26')]();};}function saveUpdates(_0x446e89,_0x3e54f8){return function(_0x1ab241){if(_0x1ab241){return _0x1ab241[_0x06ae('0x27')](_0x446e89)[_0x06ae('0x28')](function(_0x4ba0ba){return _0x4ba0ba;});}return null;};}function removeEntity(_0x25023a,_0x177dde){return function(_0xd51d34){if(_0xd51d34){return _0xd51d34[_0x06ae('0x29')]()['then'](function(){var _0x178d2f=_0xd51d34['get']({'plain':!![]});var _0x83f3dc=_0x06ae('0x2a');return db['UserProfileResource'][_0x06ae('0x29')]({'where':{'type':_0x83f3dc,'resourceId':_0x178d2f['id']}})['then'](function(){return _0xd51d34;});})['then'](function(){_0x25023a[_0x06ae('0x1e')](0xcc)[_0x06ae('0x2b')]();});}};}function handleEntityNotFound(_0x3a84fd,_0x3a2f1c){return function(_0x3aca51){if(!_0x3aca51){_0x3a84fd[_0x06ae('0x1d')](0x194);}return _0x3aca51;};}function handleError(_0x31340c,_0x9f81fb){_0x9f81fb=_0x9f81fb||0x1f4;return function(_0x1481f3){logger['error'](_0x1481f3[_0x06ae('0x2c')]);if(_0x1481f3[_0x06ae('0x2d')]){delete _0x1481f3['name'];}_0x31340c[_0x06ae('0x1e')](_0x9f81fb)['send'](_0x1481f3);};}exports['index']=function(_0x1594cc,_0x151214){var _0x13b713={},_0x3a66ed={},_0x145b8f={'count':0x0,'rows':[]};var _0x254134=_['map'](db[_0x06ae('0x2e')][_0x06ae('0x2f')],function(_0x2f578f){return{'name':_0x2f578f[_0x06ae('0x30')],'type':_0x2f578f['type'][_0x06ae('0x31')]};});_0x3a66ed['model']=_['map'](_0x254134,_0x06ae('0x2d'));_0x3a66ed[_0x06ae('0x32')]=_[_0x06ae('0x33')](_0x1594cc[_0x06ae('0x32')]);_0x3a66ed['filters']=_[_0x06ae('0x34')](_0x3a66ed[_0x06ae('0x35')],_0x3a66ed[_0x06ae('0x32')]);_0x13b713[_0x06ae('0x36')]=_[_0x06ae('0x34')](_0x3a66ed[_0x06ae('0x35')],qs[_0x06ae('0x37')](_0x1594cc['query'][_0x06ae('0x37')]));_0x13b713[_0x06ae('0x36')]=_0x13b713[_0x06ae('0x36')][_0x06ae('0x38')]?_0x13b713['attributes']:_0x3a66ed[_0x06ae('0x35')];if(!_0x1594cc[_0x06ae('0x32')][_0x06ae('0x39')]('nolimit')){_0x13b713['limit']=qs[_0x06ae('0x21')](_0x1594cc[_0x06ae('0x32')][_0x06ae('0x21')]);_0x13b713[_0x06ae('0x20')]=qs[_0x06ae('0x20')](_0x1594cc[_0x06ae('0x32')][_0x06ae('0x20')]);}_0x13b713['order']=qs['sort'](_0x1594cc[_0x06ae('0x32')][_0x06ae('0x3a')]);_0x13b713[_0x06ae('0x3b')]=qs['filters'](_[_0x06ae('0x3c')](_0x1594cc['query'],_0x3a66ed['filters']),_0x254134);if(_0x1594cc[_0x06ae('0x32')][_0x06ae('0x3d')]){_0x13b713['where']=_[_0x06ae('0x3e')](_0x13b713['where'],{'$or':_['map'](_0x254134,function(_0x930dba){if(_0x930dba[_0x06ae('0x3f')]!==_0x06ae('0x40')){var _0x587c61={};_0x587c61[_0x930dba[_0x06ae('0x2d')]]={'$like':'%'+_0x1594cc[_0x06ae('0x32')][_0x06ae('0x3d')]+'%'};return _0x587c61;}})});}_0x13b713=_['merge']({},_0x13b713,_0x1594cc[_0x06ae('0x41')]);var _0x4ca717={'where':_0x13b713['where']};return db[_0x06ae('0x2e')][_0x06ae('0x42')](_0x4ca717)[_0x06ae('0x28')](function(_0x3d95c9){_0x145b8f[_0x06ae('0x42')]=_0x3d95c9;if(_0x1594cc[_0x06ae('0x32')]['includeAll']){_0x13b713[_0x06ae('0x43')]=[{'all':!![]}];}return db[_0x06ae('0x2e')][_0x06ae('0x44')](_0x13b713);})['then'](function(_0x4b5012){_0x145b8f[_0x06ae('0x45')]=_0x4b5012;return _0x145b8f;})[_0x06ae('0x28')](respondWithFilteredResult(_0x151214,_0x13b713))[_0x06ae('0x46')](handleError(_0x151214,null));};exports[_0x06ae('0x47')]=function(_0x30dd58,_0x49f266){var _0x84bad1={'raw':!![],'where':{'id':_0x30dd58[_0x06ae('0x48')]['id']}},_0x4515b3={};_0x4515b3[_0x06ae('0x35')]=_[_0x06ae('0x33')](db[_0x06ae('0x2e')][_0x06ae('0x2f')]);_0x4515b3['query']=_[_0x06ae('0x33')](_0x30dd58[_0x06ae('0x32')]);_0x4515b3[_0x06ae('0x49')]=_[_0x06ae('0x34')](_0x4515b3['model'],_0x4515b3[_0x06ae('0x32')]);_0x84bad1[_0x06ae('0x36')]=_[_0x06ae('0x34')](_0x4515b3[_0x06ae('0x35')],qs['fields'](_0x30dd58[_0x06ae('0x32')][_0x06ae('0x37')]));_0x84bad1[_0x06ae('0x36')]=_0x84bad1[_0x06ae('0x36')]['length']?_0x84bad1[_0x06ae('0x36')]:_0x4515b3['model'];if(_0x30dd58['query'][_0x06ae('0x4a')]){_0x84bad1[_0x06ae('0x43')]=[{'all':!![]}];}_0x84bad1=_['merge']({},_0x84bad1,_0x30dd58['options']);return db[_0x06ae('0x2e')][_0x06ae('0x4b')](_0x84bad1)[_0x06ae('0x28')](handleEntityNotFound(_0x49f266,null))[_0x06ae('0x28')](respondWithResult(_0x49f266,null))[_0x06ae('0x46')](handleError(_0x49f266,null));};exports['create']=function(_0x323aac,_0x492ebf){return db[_0x06ae('0x2e')][_0x06ae('0x4c')](_0x323aac[_0x06ae('0x4d')],{})['then'](function(_0x136fda){var _0x1065ce=_0x323aac['user'][_0x06ae('0x4e')]({'plain':!![]});if(!_0x1065ce)throw new Error(_0x06ae('0x4f'));if(_0x1065ce[_0x06ae('0x50')]===_0x06ae('0x51')){var _0x5762de=_0x136fda[_0x06ae('0x4e')]({'plain':!![]});var _0x4852a3=_0x06ae('0x2a');return db[_0x06ae('0x52')]['find']({'where':{'name':_0x4852a3,'userProfileId':_0x1065ce['userProfileId']},'raw':!![]})[_0x06ae('0x28')](function(_0x36dd0a){if(_0x36dd0a&&_0x36dd0a['autoAssociation']===0x0){return db['UserProfileResource'][_0x06ae('0x4c')]({'name':_0x5762de[_0x06ae('0x2d')],'resourceId':_0x5762de['id'],'type':_0x36dd0a['name'],'sectionId':_0x36dd0a['id']},{})[_0x06ae('0x28')](function(){return _0x136fda;});}else{return _0x136fda;}})[_0x06ae('0x46')](function(_0x1b9b1b){logger[_0x06ae('0x53')](_0x06ae('0x54'),_0x1b9b1b);throw _0x1b9b1b;});}return _0x136fda;})[_0x06ae('0x28')](respondWithResult(_0x492ebf,0xc9))['catch'](handleError(_0x492ebf,null));};exports[_0x06ae('0x27')]=function(_0x11b0d1,_0x3970f8){if(_0x11b0d1[_0x06ae('0x4d')]['id']){delete _0x11b0d1[_0x06ae('0x4d')]['id'];}return db[_0x06ae('0x2e')][_0x06ae('0x4b')]({'where':{'id':_0x11b0d1[_0x06ae('0x48')]['id']}})['then'](handleEntityNotFound(_0x3970f8,null))[_0x06ae('0x28')](saveUpdates(_0x11b0d1['body'],null))['then'](respondWithResult(_0x3970f8,null))['catch'](handleError(_0x3970f8,null));};exports['destroy']=function(_0x148da4,_0xdf817a){return db[_0x06ae('0x2e')][_0x06ae('0x4b')]({'where':{'id':_0x148da4[_0x06ae('0x48')]['id']}})['then'](handleEntityNotFound(_0xdf817a,null))[_0x06ae('0x28')](removeEntity(_0xdf817a,null))[_0x06ae('0x46')](handleError(_0xdf817a,null));};exports['describe']=function(_0x32f702,_0x2f3892){return db['WhatsappQueue'][_0x06ae('0x55')]()[_0x06ae('0x28')](respondWithResult(_0x2f3892,null))[_0x06ae('0x46')](handleError(_0x2f3892,null));};exports[_0x06ae('0x56')]=function(_0x5315bb,_0x314e7e,_0x4cc2e8){var _0x2a1542={'raw':!![],'where':{}},_0x419ac7={},_0x34a4b7;return db[_0x06ae('0x2e')][_0x06ae('0x57')]({'where':{'id':_0x5315bb[_0x06ae('0x48')]['id']}})[_0x06ae('0x28')](handleEntityNotFound(_0x314e7e,null))['then'](function(_0xfb779){if(_0xfb779){_0x34a4b7=_0xfb779[_0x06ae('0x4e')]({'plain':!![]});_0x419ac7[_0x06ae('0x35')]=_['keys'](db['UserWhatsappQueue'][_0x06ae('0x2f')]);_0x419ac7[_0x06ae('0x32')]=_[_0x06ae('0x33')](_0x5315bb['query']);_0x419ac7[_0x06ae('0x49')]=_[_0x06ae('0x34')](_0x419ac7[_0x06ae('0x35')],_0x419ac7[_0x06ae('0x32')]);_0x2a1542['attributes']=_[_0x06ae('0x34')](_0x419ac7[_0x06ae('0x35')],qs['fields'](_0x5315bb[_0x06ae('0x32')][_0x06ae('0x37')]));_0x2a1542[_0x06ae('0x36')]=_0x2a1542[_0x06ae('0x36')][_0x06ae('0x38')]?_0x2a1542[_0x06ae('0x36')]:_0x419ac7[_0x06ae('0x35')];if(!_0x5315bb[_0x06ae('0x32')]['hasOwnProperty'](_0x06ae('0x58'))){_0x2a1542[_0x06ae('0x21')]=qs['limit'](_0x5315bb[_0x06ae('0x32')][_0x06ae('0x21')]);_0x2a1542[_0x06ae('0x20')]=qs['offset'](_0x5315bb['query'][_0x06ae('0x20')]);}_0x2a1542['order']=qs[_0x06ae('0x3a')](_0x5315bb[_0x06ae('0x32')][_0x06ae('0x3a')]);_0x2a1542[_0x06ae('0x3b')]=qs[_0x06ae('0x49')](_['pick'](_0x5315bb['query'],_0x419ac7[_0x06ae('0x49')]));_0x2a1542['where']['WhatsappQueueId']=_0xfb779['id'];if(_0x5315bb[_0x06ae('0x32')][_0x06ae('0x3d')]){_0x2a1542[_0x06ae('0x3b')]=_[_0x06ae('0x3e')](_0x2a1542[_0x06ae('0x3b')],{'$or':_[_0x06ae('0x59')](_0x2a1542['attributes'],function(_0x297dc5){var _0x3e9263={};_0x3e9263[_0x297dc5]={'$like':'%'+_0x5315bb[_0x06ae('0x32')]['filter']+'%'};return _0x3e9263;})});}_0x2a1542=_['merge']({},_0x2a1542,_0x5315bb[_0x06ae('0x41')]);return db[_0x06ae('0x5a')][_0x06ae('0x44')](_0x2a1542);}})['then'](function(_0x5c4d8c){if(_0x5c4d8c){return db[_0x06ae('0x5b')][_0x06ae('0x5c')]({'where':{'id':_[_0x06ae('0x59')](_0x5c4d8c,_0x06ae('0x5d')),'role':_0x06ae('0x5e')},'attributes':['id','name',_0x06ae('0x5f'),'updatedAt',_0x06ae('0x60')]});}})[_0x06ae('0x28')](function(_0xc68eb3){if(_0xc68eb3){return{'count':_0xc68eb3[_0x06ae('0x42')],'rows':_['map'](_0xc68eb3[_0x06ae('0x45')],function(_0x5cbd8a){return{'membername':_0x5cbd8a[_0x06ae('0x2d')],'UserId':_0x5cbd8a['id'],'queue_name':_0x34a4b7[_0x06ae('0x2d')],'WhatsappQueueId':_0x34a4b7['id'],'interface':util['format'](_0x06ae('0x61'),_0x06ae('0x62'),_0x5cbd8a[_0x06ae('0x2d')]),'penalty':0x0,'paused':_0x5cbd8a['whatsappPause'],'createdAt':_0x5cbd8a[_0x06ae('0x60')],'updatedAt':_0x5cbd8a[_0x06ae('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x314e7e,_0x2a1542))[_0x06ae('0x46')](handleError(_0x314e7e,null));};exports['getTeams']=function(_0x292445,_0x352a4f,_0x4d7f3f){var _0x1dc307={};var _0x3823f3={};var _0x4a3dac;var _0x1116b6;return db[_0x06ae('0x2e')][_0x06ae('0x57')]({'where':{'id':_0x292445['params']['id']}})[_0x06ae('0x28')](handleEntityNotFound(_0x352a4f,null))[_0x06ae('0x28')](function(_0xd2b677){if(_0xd2b677){_0x4a3dac=_0xd2b677;_0x3823f3[_0x06ae('0x35')]=_['keys'](db[_0x06ae('0x64')][_0x06ae('0x2f')]);_0x3823f3[_0x06ae('0x32')]=_[_0x06ae('0x33')](_0x292445[_0x06ae('0x32')]);_0x3823f3[_0x06ae('0x49')]=_[_0x06ae('0x34')](_0x3823f3[_0x06ae('0x35')],_0x3823f3[_0x06ae('0x32')]);_0x1dc307[_0x06ae('0x36')]=_['intersection'](_0x3823f3[_0x06ae('0x35')],qs[_0x06ae('0x37')](_0x292445['query'][_0x06ae('0x37')]));_0x1dc307[_0x06ae('0x36')]=_0x1dc307[_0x06ae('0x36')][_0x06ae('0x38')]?_0x1dc307['attributes']:_0x3823f3[_0x06ae('0x35')];_0x1dc307[_0x06ae('0x65')]=qs['sort'](_0x292445['query'][_0x06ae('0x3a')]);_0x1dc307['where']=qs[_0x06ae('0x49')](_[_0x06ae('0x3c')](_0x292445[_0x06ae('0x32')],_0x3823f3['filters']));if(_0x292445[_0x06ae('0x32')]['filter']){_0x1dc307['where']=_['merge'](_0x1dc307['where'],{'$or':_[_0x06ae('0x59')](_0x1dc307['attributes'],function(_0x505e6c){var _0x2dc67b={};_0x2dc67b[_0x505e6c]={'$like':'%'+_0x292445['query']['filter']+'%'};return _0x2dc67b;})});}_0x1dc307=_[_0x06ae('0x3e')]({},_0x1dc307,_0x292445[_0x06ae('0x41')]);return _0x4a3dac[_0x06ae('0x66')](_0x1dc307);}})[_0x06ae('0x28')](function(_0x485bb5){if(_0x485bb5){_0x1116b6=_0x485bb5[_0x06ae('0x38')];if(!_0x292445[_0x06ae('0x32')]['hasOwnProperty']('nolimit')){_0x1dc307[_0x06ae('0x21')]=qs[_0x06ae('0x21')](_0x292445[_0x06ae('0x32')][_0x06ae('0x21')]);_0x1dc307[_0x06ae('0x20')]=qs['offset'](_0x292445['query'][_0x06ae('0x20')]);}return _0x4a3dac['getTeams'](_0x1dc307);}})[_0x06ae('0x28')](function(_0x2c72fc){if(_0x2c72fc){return _0x2c72fc?{'count':_0x1116b6,'rows':_0x2c72fc}:null;}})[_0x06ae('0x28')](respondWithResult(_0x352a4f,null))[_0x06ae('0x46')](handleError(_0x352a4f,null));};exports[_0x06ae('0x67')]=function(_0x4c9006,_0x2a0306,_0x105a10){var _0x571a88=_0x4c9006[_0x06ae('0x4d')][_0x06ae('0x68')];return db['Team'][_0x06ae('0x44')]({'where':{'id':_0x571a88},'attributes':['id'],'include':[{'model':db[_0x06ae('0x5b')],'as':_0x06ae('0x69'),'attributes':['id',_0x06ae('0x2d'),'online',_0x06ae('0x6a'),_0x06ae('0x6b')],'raw':!![]}]})[_0x06ae('0x28')](function(_0x131480){if(_0x131480){var _0x5666e9=_['flatMap'](_0x131480,function(_0x5aa344){var _0x45eca4=_0x5aa344[_0x06ae('0x4e')]({'plain':!![]});return _0x45eca4[_0x06ae('0x69')];});return db[_0x06ae('0x2e')][_0x06ae('0x4b')]({'where':{'id':_0x4c9006[_0x06ae('0x48')]['id']}})[_0x06ae('0x28')](function(_0x40fde1){return db['sequelize']['transaction'](function(_0x4dc9cd){return _0x40fde1['addTeams'](_0x571a88,{'transaction':_0x4dc9cd})[_0x06ae('0x28')](function(){return BPromise[_0x06ae('0x6c')](_0x5666e9,function(_0x39db3c){return db[_0x06ae('0x5a')]['findOrCreate']({'where':{'UserId':_0x39db3c['id'],'WhatsappQueueId':_0x4c9006[_0x06ae('0x48')]['id']},'transaction':_0x4dc9cd});});})[_0x06ae('0x28')](function(){_0x5666e9[_0x06ae('0x6d')](function(_0x24f8c6){socket[_0x06ae('0x6e')](_0x06ae('0x6f'),{'UserId':_0x24f8c6['id'],'WhatsappQueueId':_0x40fde1['id']});});});});});}})['then'](respondWithStatusCode(_0x2a0306,null))[_0x06ae('0x46')](handleError(_0x2a0306,null));};exports[_0x06ae('0x70')]=function(_0x10a684,_0x34d001,_0x1ff64f){return db[_0x06ae('0x64')][_0x06ae('0x44')]({'where':{'id':_0x10a684['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x06ae('0x28')](handleEntityNotFound(_0x34d001,null))['then'](function(_0x1aab62){var _0x37652a=_[_0x06ae('0x59')](_0x1aab62,'id');var _0x31bce7=[];var _0x20a1ba=[];var _0x36ff0e=squel['select']();_0x36ff0e[_0x06ae('0x71')](_0x06ae('0x72'))['from']('team_has_whatsapp_queues','tq')['join']('user_has_teams','ut',_0x06ae('0x73'))[_0x06ae('0x3b')](_0x06ae('0x74'),_0x10a684['params']['id']);for(var _0x3bbd60=0x0;_0x3bbd60<_0x1aab62[_0x06ae('0x38')];_0x3bbd60+=0x1){let _0xfc03b9=_0x1aab62[_0x3bbd60];for(var _0x2779ad=0x0;_0x2779ad<_0xfc03b9[_0x06ae('0x69')][_0x06ae('0x38')];_0x2779ad+=0x1){let _0x47a752=_0xfc03b9[_0x06ae('0x69')][_0x2779ad];var _0x59791b=_0x36ff0e[_0x06ae('0x75')]();_0x59791b[_0x06ae('0x3b')](_0x06ae('0x76'),_0x47a752['id']);_0x20a1ba[_0x06ae('0x77')](db[_0x06ae('0x78')][_0x06ae('0x32')](_0x59791b[_0x06ae('0x79')](),{'type':db[_0x06ae('0x78')][_0x06ae('0x7a')]['SELECT']})['then'](function(_0x36c1e5){if(_0x36c1e5[_0x06ae('0x38')]===0x1){return _0x47a752['id'];}else{var _0x77de6d=_[_0x06ae('0x7b')](_['map'](_0x36c1e5,_0x06ae('0x7c')),function(_0x210ab2){return _[_0x06ae('0x7d')](_0x37652a,_0x210ab2);});if(_0x77de6d){return _0x47a752['id'];}}}));}}return BPromise[_0x06ae('0x7e')](_0x20a1ba)[_0x06ae('0x28')](function(_0x5d318f){_0x31bce7=_(_0x31bce7)[_0x06ae('0x7f')](_0x5d318f)[_0x06ae('0x80')]()[_0x06ae('0x81')]();return db[_0x06ae('0x2e')][_0x06ae('0x4b')]({'where':{'id':_0x10a684['params']['id']}})[_0x06ae('0x28')](function(_0x5d15ab){return db['sequelize'][_0x06ae('0x82')](function(_0x59a4d0){return _0x5d15ab[_0x06ae('0x70')](_0x10a684[_0x06ae('0x32')][_0x06ae('0x68')],{'transaction':_0x59a4d0})[_0x06ae('0x28')](function(){if(!_['isEmpty'](_0x31bce7)){return _0x5d15ab[_0x06ae('0x83')](_0x31bce7,{'transaction':_0x59a4d0});}})[_0x06ae('0x28')](function(){_0x31bce7[_0x06ae('0x6d')](function(_0xb251fa){socket[_0x06ae('0x6e')](_0x06ae('0x84'),{'UserId':_0xb251fa,'WhatsappQueueId':_0x5d15ab['id']});});});});});});})[_0x06ae('0x28')](respondWithStatusCode(_0x34d001,null))[_0x06ae('0x46')](handleError(_0x34d001,null));};exports[_0x06ae('0x85')]=function(_0x194ccc,_0x58fea0,_0x1983a0){return db[_0x06ae('0x2e')]['find']({'where':{'id':_0x194ccc[_0x06ae('0x48')]['id']}})[_0x06ae('0x28')](handleEntityNotFound(_0x58fea0,null))[_0x06ae('0x28')](function(_0x2ff426){if(_0x2ff426){return _0x2ff426[_0x06ae('0x85')](_0x194ccc['body'][_0x06ae('0x68')],_[_0x06ae('0x86')](_0x194ccc['body'],[_0x06ae('0x68'),'id'])||{})['spread'](function(_0x466f98){for(var _0xa3a764=0x0;_0xa3a764<_0x194ccc[_0x06ae('0x4d')][_0x06ae('0x68')]['length'];_0xa3a764+=0x1){socket[_0x06ae('0x6e')](_0x06ae('0x6f'),{'UserId':_0x194ccc[_0x06ae('0x4d')][_0x06ae('0x68')][_0xa3a764],'WhatsappQueueId':_0x194ccc['params']['id']});}return _0x466f98;});}})[_0x06ae('0x28')](respondWithResult(_0x58fea0,null))[_0x06ae('0x46')](handleError(_0x58fea0,null));};exports[_0x06ae('0x83')]=function(_0x32baaf,_0x25a7f2,_0x576832){return db[_0x06ae('0x2e')][_0x06ae('0x4b')]({'where':{'id':_0x32baaf[_0x06ae('0x48')]['id']}})[_0x06ae('0x28')](handleEntityNotFound(_0x25a7f2,null))['then'](function(_0x3bb446){if(_0x3bb446){return _0x3bb446[_0x06ae('0x83')](_0x32baaf['query'][_0x06ae('0x68')])[_0x06ae('0x28')](function(){if(_['isArray'](_0x32baaf[_0x06ae('0x32')][_0x06ae('0x68')])){for(var _0x1b1708=0x0;_0x1b1708<_0x32baaf[_0x06ae('0x32')][_0x06ae('0x68')][_0x06ae('0x38')];_0x1b1708+=0x1){socket[_0x06ae('0x6e')](_0x06ae('0x84'),{'UserId':Number(_0x32baaf[_0x06ae('0x32')]['ids'][_0x1b1708]),'WhatsappQueueId':Number(_0x32baaf['params']['id'])});}}else{socket[_0x06ae('0x6e')](_0x06ae('0x84'),{'UserId':Number(_0x32baaf[_0x06ae('0x32')][_0x06ae('0x68')]),'WhatsappQueueId':Number(_0x32baaf['params']['id'])});}});}})[_0x06ae('0x28')](respondWithStatusCode(_0x25a7f2,null))[_0x06ae('0x46')](handleError(_0x25a7f2,null));};exports[_0x06ae('0x87')]=function(_0x2e0966,_0x442c5b,_0x14b2be){var _0xc0021c={};var _0x12c270={};var _0x511d23;var _0x50446f;return db[_0x06ae('0x2e')]['findOne']({'where':{'id':_0x2e0966['params']['id']}})[_0x06ae('0x28')](handleEntityNotFound(_0x442c5b,null))[_0x06ae('0x28')](function(_0x1736f3){if(_0x1736f3){_0x511d23=_0x1736f3;_0x12c270[_0x06ae('0x35')]=_[_0x06ae('0x33')](db[_0x06ae('0x5b')][_0x06ae('0x2f')]);_0x12c270['query']=_[_0x06ae('0x33')](_0x2e0966[_0x06ae('0x32')]);_0x12c270[_0x06ae('0x49')]=_['intersection'](_0x12c270[_0x06ae('0x35')],_0x12c270[_0x06ae('0x32')]);_0xc0021c[_0x06ae('0x36')]=_['intersection'](_0x12c270[_0x06ae('0x35')],qs['fields'](_0x2e0966['query']['fields']));_0xc0021c[_0x06ae('0x36')]=_0xc0021c['attributes'][_0x06ae('0x38')]?_0xc0021c[_0x06ae('0x36')]:_0x12c270[_0x06ae('0x35')];_0xc0021c[_0x06ae('0x65')]=qs['sort'](_0x2e0966[_0x06ae('0x32')][_0x06ae('0x3a')]);_0xc0021c['where']=qs[_0x06ae('0x49')](_['pick'](_0x2e0966[_0x06ae('0x32')],_0x12c270[_0x06ae('0x49')]));if(_0x2e0966[_0x06ae('0x32')][_0x06ae('0x3d')]){_0xc0021c[_0x06ae('0x3b')]=_['merge'](_0xc0021c['where'],{'$or':_[_0x06ae('0x59')](_0xc0021c['attributes'],function(_0x5b7619){var _0x2d7e66={};_0x2d7e66[_0x5b7619]={'$like':'%'+_0x2e0966[_0x06ae('0x32')][_0x06ae('0x3d')]+'%'};return _0x2d7e66;})});}_0xc0021c=_[_0x06ae('0x3e')]({},_0xc0021c,_0x2e0966[_0x06ae('0x41')]);return _0x511d23['getAgents'](_0xc0021c);}})[_0x06ae('0x28')](function(_0x1f0b92){if(_0x1f0b92){_0x50446f=_0x1f0b92[_0x06ae('0x38')];if(!_0x2e0966[_0x06ae('0x32')]['hasOwnProperty'](_0x06ae('0x58'))){_0xc0021c[_0x06ae('0x21')]=qs[_0x06ae('0x21')](_0x2e0966[_0x06ae('0x32')][_0x06ae('0x21')]);_0xc0021c[_0x06ae('0x20')]=qs['offset'](_0x2e0966[_0x06ae('0x32')][_0x06ae('0x20')]);}return _0x511d23['getAgents'](_0xc0021c);}})['then'](function(_0x2ac969){if(_0x2ac969){return _0x2ac969?{'count':_0x50446f,'rows':_0x2ac969}:null;}})[_0x06ae('0x28')](respondWithResult(_0x442c5b,null))[_0x06ae('0x46')](handleError(_0x442c5b,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 72536e5..61dc503 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 _0xd755=['hook','events','WhatsappQueue','save','update','remove','emit','hasOwnProperty'];(function(_0x3124f8,_0x1a8b23){var _0x5bab5f=function(_0x18b09b){while(--_0x18b09b){_0x3124f8['push'](_0x3124f8['shift']());}};_0x5bab5f(++_0x1a8b23);}(_0xd755,0xe9));var _0x5d75=function(_0x3cba1d,_0x2825ae){_0x3cba1d=_0x3cba1d-0x0;var _0x5f192b=_0xd755[_0x3cba1d];return _0x5f192b;};'use strict';var EventEmitter=require(_0x5d75('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x5d75('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5d75('0x2'),'afterUpdate':_0x5d75('0x3'),'afterDestroy':_0x5d75('0x4')};function emitEvent(_0x57bc7a){return function(_0x44992c,_0x44cb09,_0x2c1d7a){WhatsappQueueEvents[_0x5d75('0x5')](_0x57bc7a+':'+_0x44992c['id'],_0x44992c);WhatsappQueueEvents['emit'](_0x57bc7a,_0x44992c);_0x2c1d7a(null);};}for(var e in events){if(events[_0x5d75('0x6')](e)){var event=events[e];WhatsappQueue[_0x5d75('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x5b5d=['events','WhatsappQueue','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x3b36d7,_0x1c9225){var _0xaa920f=function(_0x2bf842){while(--_0x2bf842){_0x3b36d7['push'](_0x3b36d7['shift']());}};_0xaa920f(++_0x1c9225);}(_0x5b5d,0x88));var _0xd5b5=function(_0xdc953c,_0xf75325){_0xdc953c=_0xdc953c-0x0;var _0x16ac24=_0x5b5d[_0xdc953c];return _0x16ac24;};'use strict';var EventEmitter=require(_0xd5b5('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0xd5b5('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd5b5('0x2'),'afterUpdate':_0xd5b5('0x3'),'afterDestroy':_0xd5b5('0x4')};function emitEvent(_0x47f670){return function(_0x392ab6,_0x36b5db,_0x265f27){WhatsappQueueEvents[_0xd5b5('0x5')](_0x47f670+':'+_0x392ab6['id'],_0x392ab6);WhatsappQueueEvents[_0xd5b5('0x5')](_0x47f670,_0x392ab6);_0x265f27(null);};}for(var e in events){if(events[_0xd5b5('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xd5b5('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index ccf7035..6f28a9c 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 _0x7e06=['api','moment','request-promise','path','rimraf','exports','define','WhatsappQueue','lodash','util','../../config/logger'];(function(_0x2df902,_0x479b19){var _0x13683c=function(_0x586060){while(--_0x586060){_0x2df902['push'](_0x2df902['shift']());}};_0x13683c(++_0x479b19);}(_0x7e06,0x1d6));var _0x67e0=function(_0x312835,_0xff273e){_0x312835=_0x312835-0x0;var _0x1da8b9=_0x7e06[_0x312835];return _0x1da8b9;};'use strict';var _=require(_0x67e0('0x0'));var util=require(_0x67e0('0x1'));var logger=require(_0x67e0('0x2'))(_0x67e0('0x3'));var moment=require(_0x67e0('0x4'));var BPromise=require('bluebird');var rp=require(_0x67e0('0x5'));var fs=require('fs');var path=require(_0x67e0('0x6'));var rimraf=require(_0x67e0('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module[_0x67e0('0x8')]=function(_0x476543,_0x4e34b2){return _0x476543[_0x67e0('0x9')](_0x67e0('0xa'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5118=['rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','whatsapp_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x19de7a,_0x53cac4){var _0x43b8b2=function(_0x1e5da6){while(--_0x1e5da6){_0x19de7a['push'](_0x19de7a['shift']());}};_0x43b8b2(++_0x53cac4);}(_0x5118,0x14b));var _0x8511=function(_0x4ae63d,_0x152404){_0x4ae63d=_0x4ae63d-0x0;var _0x4c1e01=_0x5118[_0x4ae63d];return _0x4c1e01;};'use strict';var _=require(_0x8511('0x0'));var util=require(_0x8511('0x1'));var logger=require(_0x8511('0x2'))('api');var moment=require(_0x8511('0x3'));var BPromise=require(_0x8511('0x4'));var rp=require(_0x8511('0x5'));var fs=require('fs');var path=require(_0x8511('0x6'));var rimraf=require(_0x8511('0x7'));var config=require(_0x8511('0x8'));var attributes=require(_0x8511('0x9'));module[_0x8511('0xa')]=function(_0x254134,_0xaa3197){return _0x254134[_0x8511('0xb')]('WhatsappQueue',attributes,{'tableName':_0x8511('0xc'),'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 9d3e3b8..8780fb4 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 _0x025c=['attributes','limit','map','model','include','catch','find','ShowWhatsappQueue','debug','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where'];(function(_0x52c574,_0x1ad43a){var _0x5b88af=function(_0x40cf4a){while(--_0x40cf4a){_0x52c574['push'](_0x52c574['shift']());}};_0x5b88af(++_0x1ad43a);}(_0x025c,0xa5));var _0xc025=function(_0x1f1ec0,_0x49e721){_0x1f1ec0=_0x1f1ec0-0x0;var _0x1ecce4=_0x025c[_0x1f1ec0];return _0x1ecce4;};'use strict';var _=require(_0xc025('0x0'));var util=require('util');var moment=require(_0xc025('0x1'));var BPromise=require(_0xc025('0x2'));var rs=require(_0xc025('0x3'));var fs=require('fs');var Redis=require(_0xc025('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc025('0x5'));var logger=require(_0xc025('0x6'))(_0xc025('0x7'));var config=require(_0xc025('0x8'));var jayson=require(_0xc025('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xc025('0xa')]=_[_0xc025('0xb')](config[_0xc025('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xc025('0xc'))(new Redis(config[_0xc025('0xa')]));require(_0xc025('0xd'))[_0xc025('0xe')](socket);function respondWithRpcPromise(_0x2c4410,_0x1186d6,_0xa9499f){return new BPromise(function(_0x3ef3a5,_0x427074){return client[_0xc025('0xf')](_0x2c4410,_0xa9499f)[_0xc025('0x10')](function(_0x1aadb3){logger['info'](_0xc025('0x11'),_0x1186d6,_0xc025('0x12'));logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x1186d6,_0xc025('0x12'),JSON['stringify'](_0x1aadb3));if(_0x1aadb3[_0xc025('0x13')]){if(_0x1aadb3[_0xc025('0x13')][_0xc025('0x14')]===0x1f4){logger[_0xc025('0x13')](_0xc025('0x11'),_0x1186d6,_0x1aadb3['error'][_0xc025('0x15')]);return _0x427074(_0x1aadb3['error'][_0xc025('0x15')]);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x1186d6,_0x1aadb3['error'][_0xc025('0x15')]);return _0x3ef3a5(_0x1aadb3[_0xc025('0x13')]['message']);}else{logger[_0xc025('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x1186d6,_0xc025('0x12'));_0x3ef3a5(_0x1aadb3[_0xc025('0x17')][_0xc025('0x15')]);}})['catch'](function(_0x2ff7c4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x1186d6,_0x2ff7c4);_0x427074(_0x2ff7c4);});});}exports[_0xc025('0x18')]=function(_0x1ef7cf){var _0x1be458=this;return new Promise(function(_0x4ea2b7,_0x362108){return db[_0xc025('0x19')][_0xc025('0x1a')]({'raw':_0x1ef7cf[_0xc025('0x1b')]?_0x1ef7cf[_0xc025('0x1b')][_0xc025('0x1c')]===undefined?!![]:![]:!![],'where':_0x1ef7cf['options']?_0x1ef7cf['options'][_0xc025('0x1d')]||null:null,'attributes':_0x1ef7cf[_0xc025('0x1b')]?_0x1ef7cf[_0xc025('0x1b')][_0xc025('0x1e')]||null:null,'limit':_0x1ef7cf[_0xc025('0x1b')]?_0x1ef7cf[_0xc025('0x1b')][_0xc025('0x1f')]||null:null,'include':_0x1ef7cf[_0xc025('0x1b')]?_0x1ef7cf[_0xc025('0x1b')]['include']?_[_0xc025('0x20')](_0x1ef7cf[_0xc025('0x1b')]['include'],function(_0x14be16){return{'model':db[_0x14be16[_0xc025('0x21')]],'as':_0x14be16['as'],'attributes':_0x14be16['attributes'],'include':_0x14be16[_0xc025('0x22')]?_[_0xc025('0x20')](_0x14be16[_0xc025('0x22')],function(_0x122efc){return{'model':db[_0x122efc[_0xc025('0x21')]],'as':_0x122efc['as'],'attributes':_0x122efc[_0xc025('0x1e')],'include':_0x122efc[_0xc025('0x22')]?_[_0xc025('0x20')](_0x122efc[_0xc025('0x22')],function(_0x1a7d06){return{'model':db[_0x1a7d06[_0xc025('0x21')]],'as':_0x1a7d06['as'],'attributes':_0x1a7d06[_0xc025('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc025('0x10')](function(_0x27445b){logger['info'](_0xc025('0x18'),_0x1ef7cf);logger['debug'](_0xc025('0x18'),_0x1ef7cf,JSON['stringify'](_0x27445b));_0x4ea2b7(_0x27445b);})[_0xc025('0x23')](function(_0x4d0c44){logger[_0xc025('0x13')]('GetWhatsappQueue',_0x4d0c44[_0xc025('0x15')],_0x1ef7cf);_0x362108(_0x1be458[_0xc025('0x13')](0x1f4,_0x4d0c44[_0xc025('0x15')]));});});};exports['ShowWhatsappQueue']=function(_0x28f7c9){var _0x4e817a=this;return new Promise(function(_0x219f4d,_0x3db56e){return db[_0xc025('0x19')][_0xc025('0x24')]({'raw':_0x28f7c9['options']?_0x28f7c9['options'][_0xc025('0x1c')]===undefined?!![]:![]:!![],'where':_0x28f7c9[_0xc025('0x1b')]?_0x28f7c9[_0xc025('0x1b')][_0xc025('0x1d')]||null:null,'attributes':_0x28f7c9[_0xc025('0x1b')]?_0x28f7c9[_0xc025('0x1b')][_0xc025('0x1e')]||null:null,'include':_0x28f7c9[_0xc025('0x1b')]?_0x28f7c9[_0xc025('0x1b')][_0xc025('0x22')]?_['map'](_0x28f7c9['options'][_0xc025('0x22')],function(_0x14f4fb){return{'model':db[_0x14f4fb[_0xc025('0x21')]],'as':_0x14f4fb['as'],'attributes':_0x14f4fb[_0xc025('0x1e')],'include':_0x14f4fb[_0xc025('0x22')]?_[_0xc025('0x20')](_0x14f4fb[_0xc025('0x22')],function(_0x3bd2e4){return{'model':db[_0x3bd2e4[_0xc025('0x21')]],'as':_0x3bd2e4['as'],'attributes':_0x3bd2e4[_0xc025('0x1e')],'include':_0x3bd2e4[_0xc025('0x22')]?_['map'](_0x3bd2e4['include'],function(_0x33d17a){return{'model':db[_0x33d17a[_0xc025('0x21')]],'as':_0x33d17a['as'],'attributes':_0x33d17a[_0xc025('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc025('0x10')](function(_0x2746dd){logger[_0xc025('0x16')](_0xc025('0x25'),_0x28f7c9);logger[_0xc025('0x26')](_0xc025('0x25'),_0x28f7c9,JSON['stringify'](_0x2746dd));_0x219f4d(_0x2746dd);})[_0xc025('0x23')](function(_0x58ffcd){logger[_0xc025('0x13')]('ShowWhatsappQueue',_0x58ffcd[_0xc025('0x15')],_0x28f7c9);_0x3db56e(_0x4e817a[_0xc025('0x13')](0x1f4,_0x58ffcd[_0xc025('0x15')]));});});}; \ No newline at end of file +var _0x359e=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','model','map','ShowWhatsappQueue','find','lodash','util'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x359e,0x10f));var _0xe359=function(_0xda8417,_0x169bff){_0xda8417=_0xda8417-0x0;var _0x5f48bd=_0x359e[_0xda8417];return _0x5f48bd;};'use strict';var _=require(_0xe359('0x0'));var util=require(_0xe359('0x1'));var moment=require(_0xe359('0x2'));var BPromise=require(_0xe359('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe359('0x4'));var db=require(_0xe359('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe359('0x6'))(_0xe359('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe359('0x8')][_0xe359('0x9')]({'port':0x232a});config[_0xe359('0xa')]=_[_0xe359('0xb')](config[_0xe359('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xe359('0xc'))(new Redis(config[_0xe359('0xa')]));require(_0xe359('0xd'))[_0xe359('0xe')](socket);function respondWithRpcPromise(_0x12902a,_0x16b7ed,_0x3b57be){return new BPromise(function(_0x534c30,_0x36c137){return client['request'](_0x12902a,_0x3b57be)[_0xe359('0xf')](function(_0x556ba2){logger[_0xe359('0x10')](_0xe359('0x11'),_0x16b7ed,_0xe359('0x12'));logger[_0xe359('0x13')](_0xe359('0x14'),_0x16b7ed,_0xe359('0x12'),JSON[_0xe359('0x15')](_0x556ba2));if(_0x556ba2[_0xe359('0x16')]){if(_0x556ba2[_0xe359('0x16')][_0xe359('0x17')]===0x1f4){logger['error'](_0xe359('0x11'),_0x16b7ed,_0x556ba2[_0xe359('0x16')][_0xe359('0x18')]);return _0x36c137(_0x556ba2['error'][_0xe359('0x18')]);}logger[_0xe359('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x16b7ed,_0x556ba2['error']['message']);return _0x534c30(_0x556ba2[_0xe359('0x16')][_0xe359('0x18')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x16b7ed,_0xe359('0x12'));_0x534c30(_0x556ba2['result']['message']);}})[_0xe359('0x19')](function(_0xd5984){logger[_0xe359('0x16')](_0xe359('0x11'),_0x16b7ed,_0xd5984);_0x36c137(_0xd5984);});});}exports[_0xe359('0x1a')]=function(_0x3297f6){var _0x2851ac=this;return new Promise(function(_0x201206,_0x2c90ea){return db[_0xe359('0x1b')][_0xe359('0x1c')]({'raw':_0x3297f6[_0xe359('0x1d')]?_0x3297f6[_0xe359('0x1d')][_0xe359('0x1e')]===undefined?!![]:![]:!![],'where':_0x3297f6['options']?_0x3297f6[_0xe359('0x1d')][_0xe359('0x1f')]||null:null,'attributes':_0x3297f6['options']?_0x3297f6[_0xe359('0x1d')][_0xe359('0x20')]||null:null,'limit':_0x3297f6['options']?_0x3297f6[_0xe359('0x1d')][_0xe359('0x21')]||null:null,'include':_0x3297f6[_0xe359('0x1d')]?_0x3297f6['options'][_0xe359('0x22')]?_['map'](_0x3297f6[_0xe359('0x1d')]['include'],function(_0x43d476){return{'model':db[_0x43d476[_0xe359('0x23')]],'as':_0x43d476['as'],'attributes':_0x43d476[_0xe359('0x20')],'include':_0x43d476[_0xe359('0x22')]?_[_0xe359('0x24')](_0x43d476[_0xe359('0x22')],function(_0x21b06b){return{'model':db[_0x21b06b[_0xe359('0x23')]],'as':_0x21b06b['as'],'attributes':_0x21b06b['attributes'],'include':_0x21b06b[_0xe359('0x22')]?_[_0xe359('0x24')](_0x21b06b[_0xe359('0x22')],function(_0x3d28a5){return{'model':db[_0x3d28a5[_0xe359('0x23')]],'as':_0x3d28a5['as'],'attributes':_0x3d28a5[_0xe359('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x537b54){logger[_0xe359('0x10')]('GetWhatsappQueue',_0x3297f6);logger[_0xe359('0x13')](_0xe359('0x1a'),_0x3297f6,JSON[_0xe359('0x15')](_0x537b54));_0x201206(_0x537b54);})['catch'](function(_0x3bea2e){logger['error']('GetWhatsappQueue',_0x3bea2e[_0xe359('0x18')],_0x3297f6);_0x2c90ea(_0x2851ac['error'](0x1f4,_0x3bea2e[_0xe359('0x18')]));});});};exports[_0xe359('0x25')]=function(_0x3713e3){var _0x4cdd42=this;return new Promise(function(_0x1eb530,_0x3b41da){return db[_0xe359('0x1b')][_0xe359('0x26')]({'raw':_0x3713e3['options']?_0x3713e3['options'][_0xe359('0x1e')]===undefined?!![]:![]:!![],'where':_0x3713e3[_0xe359('0x1d')]?_0x3713e3[_0xe359('0x1d')][_0xe359('0x1f')]||null:null,'attributes':_0x3713e3[_0xe359('0x1d')]?_0x3713e3[_0xe359('0x1d')][_0xe359('0x20')]||null:null,'include':_0x3713e3['options']?_0x3713e3[_0xe359('0x1d')][_0xe359('0x22')]?_['map'](_0x3713e3[_0xe359('0x1d')][_0xe359('0x22')],function(_0x297d07){return{'model':db[_0x297d07[_0xe359('0x23')]],'as':_0x297d07['as'],'attributes':_0x297d07[_0xe359('0x20')],'include':_0x297d07['include']?_[_0xe359('0x24')](_0x297d07[_0xe359('0x22')],function(_0x3f888a){return{'model':db[_0x3f888a[_0xe359('0x23')]],'as':_0x3f888a['as'],'attributes':_0x3f888a['attributes'],'include':_0x3f888a[_0xe359('0x22')]?_[_0xe359('0x24')](_0x3f888a[_0xe359('0x22')],function(_0x29a17d){return{'model':db[_0x29a17d[_0xe359('0x23')]],'as':_0x29a17d['as'],'attributes':_0x29a17d[_0xe359('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x154f74){logger[_0xe359('0x10')]('ShowWhatsappQueue',_0x3713e3);logger[_0xe359('0x13')](_0xe359('0x25'),_0x3713e3,JSON[_0xe359('0x15')](_0x154f74));_0x1eb530(_0x154f74);})[_0xe359('0x19')](function(_0x2e9d43){logger['error'](_0xe359('0x25'),_0x2e9d43[_0xe359('0x18')],_0x3713e3);_0x3b41da(_0x4cdd42[_0xe359('0x16')](0x1f4,_0x2e9d43[_0xe359('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 5dc6fc0..13e72a0 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 _0xd076=['emit','removeListener','register','whatsappQueue:','save','remove','update'];(function(_0x33b928,_0xfd3a99){var _0x2401e6=function(_0x45c468){while(--_0x45c468){_0x33b928['push'](_0x33b928['shift']());}};_0x2401e6(++_0xfd3a99);}(_0xd076,0x146));var _0x6d07=function(_0x595321,_0x3ec7d3){_0x595321=_0x595321-0x0;var _0x418917=_0xd076[_0x595321];return _0x418917;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x6d07('0x0'),_0x6d07('0x1'),_0x6d07('0x2')];function createListener(_0x543e53,_0x182278){return function(_0x2a1e53){_0x182278[_0x6d07('0x3')](_0x543e53,_0x2a1e53);};}function removeListener(_0x50edd9,_0x2ed7bc){return function(){WhatsappQueueEvents[_0x6d07('0x4')](_0x50edd9,_0x2ed7bc);};}exports[_0x6d07('0x5')]=function(_0x5e650){for(var _0x470aac=0x0,_0x4f9837=events['length'];_0x470aac<_0x4f9837;_0x470aac++){var _0x177cf6=events[_0x470aac];var _0xe82a23=createListener(_0x6d07('0x6')+_0x177cf6,_0x5e650);WhatsappQueueEvents['on'](_0x177cf6,_0xe82a23);}}; \ No newline at end of file +var _0xff58=['whatsappQueue:','./whatsappQueue.events','save','update','removeListener','length'];(function(_0x543268,_0x13a058){var _0x2a726a=function(_0xedf073){while(--_0xedf073){_0x543268['push'](_0x543268['shift']());}};_0x2a726a(++_0x13a058);}(_0xff58,0x7f));var _0x8ff5=function(_0x56de9d,_0x413b89){_0x56de9d=_0x56de9d-0x0;var _0x5b63fd=_0xff58[_0x56de9d];return _0x5b63fd;};'use strict';var WhatsappQueueEvents=require(_0x8ff5('0x0'));var events=[_0x8ff5('0x1'),'remove',_0x8ff5('0x2')];function createListener(_0x527540,_0x548d51){return function(_0x5f2f8e){_0x548d51['emit'](_0x527540,_0x5f2f8e);};}function removeListener(_0x201ced,_0x4e431f){return function(){WhatsappQueueEvents[_0x8ff5('0x3')](_0x201ced,_0x4e431f);};}exports['register']=function(_0x16795a){for(var _0x5417be=0x0,_0x565db1=events[_0x8ff5('0x4')];_0x5417be<_0x565db1;_0x5417be++){var _0x479642=events[_0x5417be];var _0x10f861=createListener(_0x8ff5('0x5')+_0x479642,_0x16795a);WhatsappQueueEvents['on'](_0x479642,_0x10f861);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 1d96592..ca94a7b 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 _0xe493=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x5774af,_0x411c94){var _0x480589=function(_0x414114){while(--_0x414114){_0x5774af['push'](_0x5774af['shift']());}};_0x480589(++_0x411c94);}(_0xe493,0x7e));var _0x3e49=function(_0x27e9a9,_0x4eb2b0){_0x27e9a9=_0x27e9a9-0x0;var _0xd3848c=_0xe493[_0x27e9a9];return _0xd3848c;};'use strict';var multer=require(_0x3e49('0x0'));var util=require(_0x3e49('0x1'));var path=require(_0x3e49('0x2'));var timeout=require(_0x3e49('0x3'));var express=require(_0x3e49('0x4'));var router=express['Router']();var fs_extra=require(_0x3e49('0x5'));var auth=require(_0x3e49('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3e49('0x7'));var controller=require('./whatsappQueueReport.controller');router[_0x3e49('0x8')]('/',auth[_0x3e49('0x9')](),controller[_0x3e49('0xa')]);router[_0x3e49('0x8')](_0x3e49('0xb'),auth[_0x3e49('0x9')](),controller['describe']);router['get']('/:id',auth[_0x3e49('0x9')](),controller[_0x3e49('0xc')]);router[_0x3e49('0xd')]('/',auth[_0x3e49('0x9')](),controller[_0x3e49('0xe')]);router[_0x3e49('0xf')](_0x3e49('0x10'),auth[_0x3e49('0x9')](),controller[_0x3e49('0x11')]);router[_0x3e49('0x12')](_0x3e49('0x10'),auth['isAuthenticated'](),controller[_0x3e49('0x13')]);module[_0x3e49('0x14')]=router; \ No newline at end of file +var _0x3299=['put','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x1c5142,_0x30ea72){var _0x1268cb=function(_0xaa2299){while(--_0xaa2299){_0x1c5142['push'](_0x1c5142['shift']());}};_0x1268cb(++_0x30ea72);}(_0x3299,0x1bc));var _0x9329=function(_0x269b36,_0x3290fb){_0x269b36=_0x269b36-0x0;var _0x27755d=_0x3299[_0x269b36];return _0x27755d;};'use strict';var multer=require('multer');var util=require(_0x9329('0x0'));var path=require(_0x9329('0x1'));var timeout=require(_0x9329('0x2'));var express=require(_0x9329('0x3'));var router=express[_0x9329('0x4')]();var fs_extra=require(_0x9329('0x5'));var auth=require(_0x9329('0x6'));var interaction=require(_0x9329('0x7'));var config=require(_0x9329('0x8'));var controller=require(_0x9329('0x9'));router[_0x9329('0xa')]('/',auth[_0x9329('0xb')](),controller[_0x9329('0xc')]);router[_0x9329('0xa')](_0x9329('0xd'),auth[_0x9329('0xb')](),controller[_0x9329('0xe')]);router['get'](_0x9329('0xf'),auth[_0x9329('0xb')](),controller[_0x9329('0x10')]);router[_0x9329('0x11')]('/',auth[_0x9329('0xb')](),controller['create']);router[_0x9329('0x12')](_0x9329('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x9329('0xf'),auth[_0x9329('0xb')](),controller[_0x9329('0x13')]);module[_0x9329('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 19485b6..249e43e 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 _0x4b84=['sequelize','exports','DATE','STRING'];(function(_0xbc1102,_0x4c7f00){var _0x3d25ef=function(_0xa100a3){while(--_0xa100a3){_0xbc1102['push'](_0xbc1102['shift']());}};_0x3d25ef(++_0x4c7f00);}(_0x4b84,0x1cc));var _0x44b8=function(_0x5471ec,_0x1ce81a){_0x5471ec=_0x5471ec-0x0;var _0x121d4c=_0x4b84[_0x5471ec];return _0x121d4c;};'use strict';var Sequelize=require(_0x44b8('0x0'));module[_0x44b8('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x44b8('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x44b8('0x2')]},'reason':{'type':Sequelize[_0x44b8('0x3')]}}; \ No newline at end of file +var _0x3e74=['DATE','sequelize','STRING'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0x3e74,0x175));var _0x43e7=function(_0x5d3473,_0x58421f){_0x5d3473=_0x5d3473-0x0;var _0x1c44c8=_0x3e74[_0x5d3473];return _0x1c44c8;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x43e7('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x43e7('0x1')]},'joinAt':{'type':Sequelize[_0x43e7('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x43e7('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index bb99e35..56cb65f 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 _0x13a0=['rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','send','index','map','WhatsappQueueReport'];(function(_0x50b337,_0x5013a6){var _0x35dd41=function(_0x10a106){while(--_0x10a106){_0x50b337['push'](_0x50b337['shift']());}};_0x35dd41(++_0x5013a6);}(_0x13a0,0x73));var _0x013a=function(_0x51beba,_0x202d19){_0x51beba=_0x51beba-0x0;var _0x167ee0=_0x13a0[_0x51beba];return _0x167ee0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x013a('0x0'));var rimraf=require(_0x013a('0x1'));var zipdir=require(_0x013a('0x2'));var jsonpatch=require(_0x013a('0x3'));var rp=require(_0x013a('0x4'));var moment=require(_0x013a('0x5'));var BPromise=require(_0x013a('0x6'));var Mustache=require(_0x013a('0x7'));var util=require(_0x013a('0x8'));var path=require(_0x013a('0x9'));var sox=require('sox');var csv=require(_0x013a('0xa'));var ejs=require(_0x013a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x013a('0xc'));var crypto=require(_0x013a('0xd'));var jsforce=require(_0x013a('0xe'));var deskjs=require(_0x013a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x013a('0x10'));var Papa=require(_0x013a('0x11'));var Redis=require(_0x013a('0x12'));var authService=require(_0x013a('0x13'));var qs=require(_0x013a('0x14'));var as=require(_0x013a('0x15'));var hardwareService=require(_0x013a('0x16'));var logger=require(_0x013a('0x17'))(_0x013a('0x18'));var utils=require(_0x013a('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x013a('0x1a'));var db=require(_0x013a('0x1b'))['db'];function respondWithStatusCode(_0x27c7bc,_0x58c8a6){_0x58c8a6=_0x58c8a6||0xcc;return function(_0x52363c){if(_0x52363c){return _0x27c7bc[_0x013a('0x1c')](_0x58c8a6);}return _0x27c7bc[_0x013a('0x1d')](_0x58c8a6)[_0x013a('0x1e')]();};}function respondWithResult(_0x5cd030,_0x11670e){_0x11670e=_0x11670e||0xc8;return function(_0x6a3436){if(_0x6a3436){return _0x5cd030['status'](_0x11670e)[_0x013a('0x1f')](_0x6a3436);}};}function respondWithFilteredResult(_0x27ba79,_0xdd5b12){return function(_0x1dd5b2){if(_0x1dd5b2){var _0x181b9c=_0x1dd5b2[_0x013a('0x20')],_0xd25429=_0xdd5b12[_0x013a('0x21')],_0x1e4beb=_0xdd5b12[_0x013a('0x21')]+_0xdd5b12[_0x013a('0x22')],_0x1d8b6b;if(_0x1e4beb>=_0x181b9c){_0x1e4beb=_0x181b9c;_0x1d8b6b=0xc8;}else{_0x1d8b6b=0xce;}_0x27ba79[_0x013a('0x1d')](_0x1d8b6b);return _0x27ba79[_0x013a('0x23')](_0x013a('0x24'),_0xd25429+'-'+_0x1e4beb+'/'+_0x181b9c)[_0x013a('0x1f')](_0x1dd5b2);}return null;};}function patchUpdates(_0x46b4da){return function(_0x1ec93f){try{jsonpatch[_0x013a('0x25')](_0x1ec93f,_0x46b4da,!![]);}catch(_0x87c4f3){return BPromise[_0x013a('0x26')](_0x87c4f3);}return _0x1ec93f[_0x013a('0x27')]();};}function saveUpdates(_0x73890d,_0x554385){return function(_0x54ed8c){if(_0x54ed8c){return _0x54ed8c[_0x013a('0x28')](_0x73890d)['then'](function(_0x9974a5){return _0x9974a5;});}return null;};}function removeEntity(_0x224641,_0x4681de){return function(_0x19efff){if(_0x19efff){return _0x19efff[_0x013a('0x29')]()[_0x013a('0x2a')](function(){_0x224641['status'](0xcc)[_0x013a('0x1e')]();});}};}function handleEntityNotFound(_0x4d180b,_0x36fef7){return function(_0x5e136e){if(!_0x5e136e){_0x4d180b[_0x013a('0x1c')](0x194);}return _0x5e136e;};}function handleError(_0x1d864c,_0xd64313){_0xd64313=_0xd64313||0x1f4;return function(_0x36fd20){logger[_0x013a('0x2b')](_0x36fd20[_0x013a('0x2c')]);if(_0x36fd20['name']){delete _0x36fd20['name'];}_0x1d864c[_0x013a('0x1d')](_0xd64313)[_0x013a('0x2d')](_0x36fd20);};}exports[_0x013a('0x2e')]=function(_0x342169,_0xbbf749){var _0x4ba64d={},_0x250ae0={},_0x36f4d9={'count':0x0,'rows':[]};var _0x578541=_[_0x013a('0x2f')](db[_0x013a('0x30')][_0x013a('0x31')],function(_0x1b02bc){return{'name':_0x1b02bc[_0x013a('0x32')],'type':_0x1b02bc[_0x013a('0x33')][_0x013a('0x34')]};});_0x250ae0[_0x013a('0x35')]=_[_0x013a('0x2f')](_0x578541,_0x013a('0x36'));_0x250ae0[_0x013a('0x37')]=_[_0x013a('0x38')](_0x342169['query']);_0x250ae0['filters']=_[_0x013a('0x39')](_0x250ae0['model'],_0x250ae0[_0x013a('0x37')]);_0x4ba64d[_0x013a('0x3a')]=_[_0x013a('0x39')](_0x250ae0[_0x013a('0x35')],qs[_0x013a('0x3b')](_0x342169[_0x013a('0x37')][_0x013a('0x3b')]));_0x4ba64d[_0x013a('0x3a')]=_0x4ba64d['attributes'][_0x013a('0x3c')]?_0x4ba64d[_0x013a('0x3a')]:_0x250ae0[_0x013a('0x35')];if(!_0x342169[_0x013a('0x37')]['hasOwnProperty'](_0x013a('0x3d'))){_0x4ba64d[_0x013a('0x22')]=qs[_0x013a('0x22')](_0x342169[_0x013a('0x37')][_0x013a('0x22')]);_0x4ba64d[_0x013a('0x21')]=qs[_0x013a('0x21')](_0x342169['query'][_0x013a('0x21')]);}_0x4ba64d[_0x013a('0x3e')]=qs[_0x013a('0x3f')](_0x342169[_0x013a('0x37')][_0x013a('0x3f')]);_0x4ba64d[_0x013a('0x40')]=qs[_0x013a('0x41')](_[_0x013a('0x42')](_0x342169['query'],_0x250ae0[_0x013a('0x41')]),_0x578541);if(_0x342169[_0x013a('0x37')][_0x013a('0x43')]){_0x4ba64d[_0x013a('0x40')]=_[_0x013a('0x44')](_0x4ba64d[_0x013a('0x40')],{'$or':_['map'](_0x578541,function(_0x5e5c3e){if(_0x5e5c3e['type']!==_0x013a('0x45')){var _0x32cfbf={};_0x32cfbf[_0x5e5c3e[_0x013a('0x36')]]={'$like':'%'+_0x342169['query'][_0x013a('0x43')]+'%'};return _0x32cfbf;}})});}_0x4ba64d=_['merge']({},_0x4ba64d,_0x342169[_0x013a('0x46')]);var _0x37dab5={'where':_0x4ba64d[_0x013a('0x40')]};return db[_0x013a('0x30')][_0x013a('0x20')](_0x37dab5)[_0x013a('0x2a')](function(_0x1d7b70){_0x36f4d9['count']=_0x1d7b70;if(_0x342169[_0x013a('0x37')]['includeAll']){_0x4ba64d[_0x013a('0x47')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x013a('0x48')](_0x4ba64d);})[_0x013a('0x2a')](function(_0x40c9c9){_0x36f4d9[_0x013a('0x49')]=_0x40c9c9;return _0x36f4d9;})[_0x013a('0x2a')](respondWithFilteredResult(_0xbbf749,_0x4ba64d))[_0x013a('0x4a')](handleError(_0xbbf749,null));};exports[_0x013a('0x4b')]=function(_0x4cc6fc,_0x3cdd12){var _0x4fab1e={'raw':!![],'where':{'id':_0x4cc6fc[_0x013a('0x4c')]['id']}},_0x3ad4ba={};_0x3ad4ba[_0x013a('0x35')]=_[_0x013a('0x38')](db['WhatsappQueueReport'][_0x013a('0x31')]);_0x3ad4ba[_0x013a('0x37')]=_[_0x013a('0x38')](_0x4cc6fc[_0x013a('0x37')]);_0x3ad4ba[_0x013a('0x41')]=_[_0x013a('0x39')](_0x3ad4ba[_0x013a('0x35')],_0x3ad4ba[_0x013a('0x37')]);_0x4fab1e[_0x013a('0x3a')]=_[_0x013a('0x39')](_0x3ad4ba['model'],qs[_0x013a('0x3b')](_0x4cc6fc[_0x013a('0x37')][_0x013a('0x3b')]));_0x4fab1e[_0x013a('0x3a')]=_0x4fab1e['attributes'][_0x013a('0x3c')]?_0x4fab1e[_0x013a('0x3a')]:_0x3ad4ba[_0x013a('0x35')];if(_0x4cc6fc[_0x013a('0x37')][_0x013a('0x4d')]){_0x4fab1e[_0x013a('0x47')]=[{'all':!![]}];}_0x4fab1e=_['merge']({},_0x4fab1e,_0x4cc6fc[_0x013a('0x46')]);return db['WhatsappQueueReport'][_0x013a('0x4e')](_0x4fab1e)['then'](handleEntityNotFound(_0x3cdd12,null))['then'](respondWithResult(_0x3cdd12,null))[_0x013a('0x4a')](handleError(_0x3cdd12,null));};exports[_0x013a('0x4f')]=function(_0x35773f,_0x5573ae){return db[_0x013a('0x30')][_0x013a('0x4f')](_0x35773f[_0x013a('0x50')],{})[_0x013a('0x2a')](respondWithResult(_0x5573ae,0xc9))[_0x013a('0x4a')](handleError(_0x5573ae,null));};exports[_0x013a('0x28')]=function(_0x44189c,_0x21de0d){if(_0x44189c[_0x013a('0x50')]['id']){delete _0x44189c[_0x013a('0x50')]['id'];}return db[_0x013a('0x30')][_0x013a('0x4e')]({'where':{'id':_0x44189c['params']['id']}})[_0x013a('0x2a')](handleEntityNotFound(_0x21de0d,null))[_0x013a('0x2a')](saveUpdates(_0x44189c['body'],null))[_0x013a('0x2a')](respondWithResult(_0x21de0d,null))[_0x013a('0x4a')](handleError(_0x21de0d,null));};exports[_0x013a('0x29')]=function(_0x54ba13,_0x6bc9c){return db[_0x013a('0x30')][_0x013a('0x4e')]({'where':{'id':_0x54ba13[_0x013a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x6bc9c,null))['then'](removeEntity(_0x6bc9c,null))['catch'](handleError(_0x6bc9c,null));};exports[_0x013a('0x51')]=function(_0x680ddb,_0x22c9e7){return db['WhatsappQueueReport'][_0x013a('0x51')]()[_0x013a('0x2a')](respondWithResult(_0x22c9e7,null))['catch'](handleError(_0x22c9e7,null));}; \ No newline at end of file +var _0x88ba=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','include','rows','catch','show','params','length','includeAll','create','body','update','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x4eafed,_0x26e2bc){var _0x159c85=function(_0x6f129f){while(--_0x6f129f){_0x4eafed['push'](_0x4eafed['shift']());}};_0x159c85(++_0x26e2bc);}(_0x88ba,0x12d));var _0xa88b=function(_0x26d9b3,_0x591f4e){_0x26d9b3=_0x26d9b3-0x0;var _0x15c226=_0x88ba[_0x26d9b3];return _0x15c226;};'use strict';var pdf=require(_0xa88b('0x0'));var emlformat=require(_0xa88b('0x1'));var rimraf=require(_0xa88b('0x2'));var zipdir=require(_0xa88b('0x3'));var jsonpatch=require(_0xa88b('0x4'));var rp=require(_0xa88b('0x5'));var moment=require('moment');var BPromise=require(_0xa88b('0x6'));var Mustache=require('mustache');var util=require(_0xa88b('0x7'));var path=require(_0xa88b('0x8'));var sox=require(_0xa88b('0x9'));var csv=require(_0xa88b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa88b('0xb'));var _=require(_0xa88b('0xc'));var squel=require(_0xa88b('0xd'));var crypto=require(_0xa88b('0xe'));var jsforce=require(_0xa88b('0xf'));var deskjs=require(_0xa88b('0x10'));var toCsv=require(_0xa88b('0xa'));var querystring=require(_0xa88b('0x11'));var Papa=require(_0xa88b('0x12'));var Redis=require(_0xa88b('0x13'));var authService=require(_0xa88b('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xa88b('0x15'));var hardwareService=require(_0xa88b('0x16'));var logger=require(_0xa88b('0x17'))(_0xa88b('0x18'));var utils=require(_0xa88b('0x19'));var config=require(_0xa88b('0x1a'));var licenseUtil=require(_0xa88b('0x1b'));var db=require(_0xa88b('0x1c'))['db'];function respondWithStatusCode(_0x10d37e,_0x15c920){_0x15c920=_0x15c920||0xcc;return function(_0x26236d){if(_0x26236d){return _0x10d37e[_0xa88b('0x1d')](_0x15c920);}return _0x10d37e[_0xa88b('0x1e')](_0x15c920)[_0xa88b('0x1f')]();};}function respondWithResult(_0x4f679f,_0x29aa65){_0x29aa65=_0x29aa65||0xc8;return function(_0x43f32f){if(_0x43f32f){return _0x4f679f[_0xa88b('0x1e')](_0x29aa65)['json'](_0x43f32f);}};}function respondWithFilteredResult(_0x14fd12,_0x532dec){return function(_0x376af8){if(_0x376af8){var _0x216b67=_0x376af8[_0xa88b('0x20')],_0x502732=_0x532dec[_0xa88b('0x21')],_0x5c4fc4=_0x532dec[_0xa88b('0x21')]+_0x532dec[_0xa88b('0x22')],_0x13231d;if(_0x5c4fc4>=_0x216b67){_0x5c4fc4=_0x216b67;_0x13231d=0xc8;}else{_0x13231d=0xce;}_0x14fd12[_0xa88b('0x1e')](_0x13231d);return _0x14fd12[_0xa88b('0x23')](_0xa88b('0x24'),_0x502732+'-'+_0x5c4fc4+'/'+_0x216b67)[_0xa88b('0x25')](_0x376af8);}return null;};}function patchUpdates(_0x3a8b06){return function(_0x4dd9ac){try{jsonpatch[_0xa88b('0x26')](_0x4dd9ac,_0x3a8b06,!![]);}catch(_0x5daf13){return BPromise[_0xa88b('0x27')](_0x5daf13);}return _0x4dd9ac[_0xa88b('0x28')]();};}function saveUpdates(_0xc76459,_0x593e0f){return function(_0x3eaf0b){if(_0x3eaf0b){return _0x3eaf0b['update'](_0xc76459)[_0xa88b('0x29')](function(_0x34713c){return _0x34713c;});}return null;};}function removeEntity(_0x5d38af,_0x1ff913){return function(_0x1e272b){if(_0x1e272b){return _0x1e272b[_0xa88b('0x2a')]()[_0xa88b('0x29')](function(){_0x5d38af['status'](0xcc)[_0xa88b('0x1f')]();});}};}function handleEntityNotFound(_0x42fbad,_0x5cbdc0){return function(_0x1aacd5){if(!_0x1aacd5){_0x42fbad['sendStatus'](0x194);}return _0x1aacd5;};}function handleError(_0x1dc10d,_0x456a20){_0x456a20=_0x456a20||0x1f4;return function(_0x414f93){logger[_0xa88b('0x2b')](_0x414f93[_0xa88b('0x2c')]);if(_0x414f93['name']){delete _0x414f93[_0xa88b('0x2d')];}_0x1dc10d[_0xa88b('0x1e')](_0x456a20)[_0xa88b('0x2e')](_0x414f93);};}exports[_0xa88b('0x2f')]=function(_0x121a44,_0x317d37){var _0x508a69={},_0xbc8262={},_0x186bc9={'count':0x0,'rows':[]};var _0x351e4a=_[_0xa88b('0x30')](db[_0xa88b('0x31')][_0xa88b('0x32')],function(_0x5a00dd){return{'name':_0x5a00dd[_0xa88b('0x33')],'type':_0x5a00dd['type']['key']};});_0xbc8262[_0xa88b('0x34')]=_[_0xa88b('0x30')](_0x351e4a,_0xa88b('0x2d'));_0xbc8262[_0xa88b('0x35')]=_[_0xa88b('0x36')](_0x121a44[_0xa88b('0x35')]);_0xbc8262[_0xa88b('0x37')]=_[_0xa88b('0x38')](_0xbc8262[_0xa88b('0x34')],_0xbc8262['query']);_0x508a69[_0xa88b('0x39')]=_[_0xa88b('0x38')](_0xbc8262['model'],qs[_0xa88b('0x3a')](_0x121a44[_0xa88b('0x35')][_0xa88b('0x3a')]));_0x508a69[_0xa88b('0x39')]=_0x508a69[_0xa88b('0x39')]['length']?_0x508a69[_0xa88b('0x39')]:_0xbc8262[_0xa88b('0x34')];if(!_0x121a44[_0xa88b('0x35')][_0xa88b('0x3b')](_0xa88b('0x3c'))){_0x508a69[_0xa88b('0x22')]=qs[_0xa88b('0x22')](_0x121a44[_0xa88b('0x35')][_0xa88b('0x22')]);_0x508a69[_0xa88b('0x21')]=qs['offset'](_0x121a44['query']['offset']);}_0x508a69[_0xa88b('0x3d')]=qs['sort'](_0x121a44['query'][_0xa88b('0x3e')]);_0x508a69['where']=qs[_0xa88b('0x37')](_['pick'](_0x121a44['query'],_0xbc8262['filters']),_0x351e4a);if(_0x121a44[_0xa88b('0x35')][_0xa88b('0x3f')]){_0x508a69['where']=_[_0xa88b('0x40')](_0x508a69[_0xa88b('0x41')],{'$or':_[_0xa88b('0x30')](_0x351e4a,function(_0x2e5c92){if(_0x2e5c92['type']!==_0xa88b('0x42')){var _0x4a4de={};_0x4a4de[_0x2e5c92[_0xa88b('0x2d')]]={'$like':'%'+_0x121a44[_0xa88b('0x35')]['filter']+'%'};return _0x4a4de;}})});}_0x508a69=_['merge']({},_0x508a69,_0x121a44[_0xa88b('0x43')]);var _0x2c977d={'where':_0x508a69[_0xa88b('0x41')]};return db[_0xa88b('0x31')][_0xa88b('0x20')](_0x2c977d)[_0xa88b('0x29')](function(_0x801b12){_0x186bc9[_0xa88b('0x20')]=_0x801b12;if(_0x121a44[_0xa88b('0x35')]['includeAll']){_0x508a69[_0xa88b('0x44')]=[{'all':!![]}];}return db[_0xa88b('0x31')]['findAll'](_0x508a69);})[_0xa88b('0x29')](function(_0x2a8adc){_0x186bc9[_0xa88b('0x45')]=_0x2a8adc;return _0x186bc9;})[_0xa88b('0x29')](respondWithFilteredResult(_0x317d37,_0x508a69))[_0xa88b('0x46')](handleError(_0x317d37,null));};exports[_0xa88b('0x47')]=function(_0x2eaf0c,_0x517f63){var _0x4a38be={'raw':!![],'where':{'id':_0x2eaf0c[_0xa88b('0x48')]['id']}},_0x5df135={};_0x5df135[_0xa88b('0x34')]=_[_0xa88b('0x36')](db[_0xa88b('0x31')][_0xa88b('0x32')]);_0x5df135[_0xa88b('0x35')]=_[_0xa88b('0x36')](_0x2eaf0c[_0xa88b('0x35')]);_0x5df135[_0xa88b('0x37')]=_[_0xa88b('0x38')](_0x5df135[_0xa88b('0x34')],_0x5df135[_0xa88b('0x35')]);_0x4a38be[_0xa88b('0x39')]=_[_0xa88b('0x38')](_0x5df135['model'],qs['fields'](_0x2eaf0c[_0xa88b('0x35')][_0xa88b('0x3a')]));_0x4a38be['attributes']=_0x4a38be[_0xa88b('0x39')][_0xa88b('0x49')]?_0x4a38be[_0xa88b('0x39')]:_0x5df135[_0xa88b('0x34')];if(_0x2eaf0c['query'][_0xa88b('0x4a')]){_0x4a38be[_0xa88b('0x44')]=[{'all':!![]}];}_0x4a38be=_['merge']({},_0x4a38be,_0x2eaf0c[_0xa88b('0x43')]);return db[_0xa88b('0x31')]['find'](_0x4a38be)[_0xa88b('0x29')](handleEntityNotFound(_0x517f63,null))[_0xa88b('0x29')](respondWithResult(_0x517f63,null))['catch'](handleError(_0x517f63,null));};exports[_0xa88b('0x4b')]=function(_0x1db5d8,_0x2f5797){return db['WhatsappQueueReport']['create'](_0x1db5d8[_0xa88b('0x4c')],{})[_0xa88b('0x29')](respondWithResult(_0x2f5797,0xc9))[_0xa88b('0x46')](handleError(_0x2f5797,null));};exports[_0xa88b('0x4d')]=function(_0xaf7f69,_0xb28f64){if(_0xaf7f69[_0xa88b('0x4c')]['id']){delete _0xaf7f69[_0xa88b('0x4c')]['id'];}return db['WhatsappQueueReport'][_0xa88b('0x4e')]({'where':{'id':_0xaf7f69[_0xa88b('0x48')]['id']}})[_0xa88b('0x29')](handleEntityNotFound(_0xb28f64,null))[_0xa88b('0x29')](saveUpdates(_0xaf7f69['body'],null))[_0xa88b('0x29')](respondWithResult(_0xb28f64,null))[_0xa88b('0x46')](handleError(_0xb28f64,null));};exports[_0xa88b('0x2a')]=function(_0x5e28ec,_0x4512db){return db['WhatsappQueueReport'][_0xa88b('0x4e')]({'where':{'id':_0x5e28ec[_0xa88b('0x48')]['id']}})[_0xa88b('0x29')](handleEntityNotFound(_0x4512db,null))[_0xa88b('0x29')](removeEntity(_0x4512db,null))[_0xa88b('0x46')](handleError(_0x4512db,null));};exports[_0xa88b('0x4f')]=function(_0x36841c,_0x14e595){return db[_0xa88b('0x31')]['describe']()[_0xa88b('0x29')](respondWithResult(_0x14e595,null))['catch'](handleError(_0x14e595,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 3305905..43d82cf 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 _0x2d45=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid'];(function(_0x45b8e0,_0x24100e){var _0x37fab8=function(_0xe4c781){while(--_0xe4c781){_0x45b8e0['push'](_0x45b8e0['shift']());}};_0x37fab8(++_0x24100e);}(_0x2d45,0x168));var _0x52d4=function(_0x33c8f4,_0x53f89c){_0x33c8f4=_0x33c8f4-0x0;var _0x576cde=_0x2d45[_0x33c8f4];return _0x576cde;};'use strict';var _=require(_0x52d4('0x0'));var util=require(_0x52d4('0x1'));var logger=require(_0x52d4('0x2'))(_0x52d4('0x3'));var moment=require('moment');var BPromise=require(_0x52d4('0x4'));var rp=require(_0x52d4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x52d4('0x6'));var config=require('../../config/environment');var attributes=require(_0x52d4('0x7'));module[_0x52d4('0x8')]=function(_0x19aa7e,_0xb19cbf){return _0x19aa7e[_0x52d4('0x9')]('WhatsappQueueReport',attributes,{'tableName':_0x52d4('0xa'),'paranoid':![],'indexes':[{'name':_0x52d4('0xb'),'fields':[_0x52d4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb067=['moment','bluebird','request-promise','rimraf','./whatsappQueueReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger','api'];(function(_0x3c2e6b,_0x12f686){var _0x4ddeb7=function(_0x5d8a22){while(--_0x5d8a22){_0x3c2e6b['push'](_0x3c2e6b['shift']());}};_0x4ddeb7(++_0x12f686);}(_0xb067,0xc8));var _0x7b06=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb067[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7b06('0x0'));var util=require(_0x7b06('0x1'));var logger=require(_0x7b06('0x2'))(_0x7b06('0x3'));var moment=require(_0x7b06('0x4'));var BPromise=require(_0x7b06('0x5'));var rp=require(_0x7b06('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b06('0x7'));var config=require('../../config/environment');var attributes=require(_0x7b06('0x8'));module[_0x7b06('0x9')]=function(_0x15f511,_0x4261c6){return _0x15f511[_0x7b06('0xa')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7b06('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 0d246a3..006c1e1 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 _0x415f=['options','raw','stringify','catch','UpdateWhatsappQueueReport','WhatsappQueueReport','update','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateWhatsappQueueReport','create','body'];(function(_0x38b2d9,_0x19fd42){var _0x23a3e1=function(_0xd8192f){while(--_0xd8192f){_0x38b2d9['push'](_0x38b2d9['shift']());}};_0x23a3e1(++_0x19fd42);}(_0x415f,0x1cf));var _0xf415=function(_0x333160,_0x6ba536){_0x333160=_0x333160-0x0;var _0x131ffb=_0x415f[_0x333160];return _0x131ffb;};'use strict';var _=require(_0xf415('0x0'));var util=require(_0xf415('0x1'));var moment=require(_0xf415('0x2'));var BPromise=require(_0xf415('0x3'));var rs=require(_0xf415('0x4'));var fs=require('fs');var Redis=require(_0xf415('0x5'));var db=require(_0xf415('0x6'))['db'];var utils=require(_0xf415('0x7'));var logger=require(_0xf415('0x8'))(_0xf415('0x9'));var config=require(_0xf415('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xf415('0xb')][_0xf415('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x51a90f,_0x8f2131,_0x321eb8){return new BPromise(function(_0x1550fe,_0x58b55e){return client[_0xf415('0xd')](_0x51a90f,_0x321eb8)[_0xf415('0xe')](function(_0x5e43d6){logger[_0xf415('0xf')](_0xf415('0x10'),_0x8f2131,_0xf415('0x11'));logger[_0xf415('0x12')](_0xf415('0x13'),_0x8f2131,_0xf415('0x11'),JSON['stringify'](_0x5e43d6));if(_0x5e43d6[_0xf415('0x14')]){if(_0x5e43d6[_0xf415('0x14')][_0xf415('0x15')]===0x1f4){logger[_0xf415('0x14')](_0xf415('0x10'),_0x8f2131,_0x5e43d6[_0xf415('0x14')][_0xf415('0x16')]);return _0x58b55e(_0x5e43d6['error']['message']);}logger['error'](_0xf415('0x10'),_0x8f2131,_0x5e43d6[_0xf415('0x14')][_0xf415('0x16')]);return _0x1550fe(_0x5e43d6[_0xf415('0x14')][_0xf415('0x16')]);}else{logger[_0xf415('0xf')](_0xf415('0x10'),_0x8f2131,_0xf415('0x11'));_0x1550fe(_0x5e43d6[_0xf415('0x17')]['message']);}})['catch'](function(_0x55221f){logger['error'](_0xf415('0x10'),_0x8f2131,_0x55221f);_0x58b55e(_0x55221f);});});}exports[_0xf415('0x18')]=function(_0x4408b4){var _0x21a21a=this;return new Promise(function(_0xcf91d3,_0x3bb764){return db['WhatsappQueueReport'][_0xf415('0x19')](_0x4408b4[_0xf415('0x1a')],{'raw':_0x4408b4[_0xf415('0x1b')]?_0x4408b4['options'][_0xf415('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x32cef1){logger[_0xf415('0xf')](_0xf415('0x18'),_0x4408b4);logger[_0xf415('0x12')](_0xf415('0x18'),_0x4408b4,JSON[_0xf415('0x1d')](_0x32cef1));_0xcf91d3(_0x32cef1);})[_0xf415('0x1e')](function(_0x2b2a37){logger[_0xf415('0x14')](_0xf415('0x18'),_0x2b2a37[_0xf415('0x16')],_0x4408b4);_0x3bb764(_0x21a21a[_0xf415('0x14')](0x1f4,_0x2b2a37[_0xf415('0x16')]));});});};exports[_0xf415('0x1f')]=function(_0x5dca0e){var _0x2d6abe=this;return new Promise(function(_0x3e7f3c,_0x4a996e){return db[_0xf415('0x20')][_0xf415('0x21')](_0x5dca0e['body'],{'raw':_0x5dca0e[_0xf415('0x1b')]?_0x5dca0e[_0xf415('0x1b')][_0xf415('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5dca0e[_0xf415('0x1b')]?_0x5dca0e[_0xf415('0x1b')]['where']||null:null,'attributes':_0x5dca0e['options']?_0x5dca0e[_0xf415('0x1b')]['attributes']||null:null,'limit':_0x5dca0e[_0xf415('0x1b')]?_0x5dca0e[_0xf415('0x1b')][_0xf415('0x22')]||null:null})[_0xf415('0xe')](function(_0x3b5247){logger[_0xf415('0xf')]('UpdateWhatsappQueueReport',_0x5dca0e);logger[_0xf415('0x12')](_0xf415('0x1f'),_0x5dca0e,JSON['stringify'](_0x3b5247));_0x3e7f3c(_0x3b5247);})[_0xf415('0x1e')](function(_0x1fc617){logger[_0xf415('0x14')](_0xf415('0x1f'),_0x1fc617[_0xf415('0x16')],_0x5dca0e);_0x4a996e(_0x2d6abe['error'](0x1f4,_0x1fc617[_0xf415('0x16')]));});});}; \ No newline at end of file +var _0xc962=['WhatsappQueueReport','create','body','options','UpdateWhatsappQueueReport','update','raw','where','attributes','limit','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateWhatsappQueueReport'];(function(_0x208a09,_0x1952ec){var _0x54fbb4=function(_0x5920ff){while(--_0x5920ff){_0x208a09['push'](_0x208a09['shift']());}};_0x54fbb4(++_0x1952ec);}(_0xc962,0x18a));var _0x2c96=function(_0x386f0b,_0x3ad023){_0x386f0b=_0x386f0b-0x0;var _0x48227a=_0xc962[_0x386f0b];return _0x48227a;};'use strict';var _=require(_0x2c96('0x0'));var util=require(_0x2c96('0x1'));var moment=require(_0x2c96('0x2'));var BPromise=require('bluebird');var rs=require(_0x2c96('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2c96('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2c96('0x5'));var config=require(_0x2c96('0x6'));var jayson=require(_0x2c96('0x7'));var client=jayson[_0x2c96('0x8')][_0x2c96('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x551f70,_0x21bfb6,_0x5d2a27){return new BPromise(function(_0x5e13d2,_0x55acd5){return client['request'](_0x551f70,_0x5d2a27)[_0x2c96('0xa')](function(_0x19c433){logger[_0x2c96('0xb')](_0x2c96('0xc'),_0x21bfb6,_0x2c96('0xd'));logger[_0x2c96('0xe')](_0x2c96('0xf'),_0x21bfb6,'request\x20sent',JSON[_0x2c96('0x10')](_0x19c433));if(_0x19c433['error']){if(_0x19c433[_0x2c96('0x11')][_0x2c96('0x12')]===0x1f4){logger[_0x2c96('0x11')](_0x2c96('0xc'),_0x21bfb6,_0x19c433[_0x2c96('0x11')]['message']);return _0x55acd5(_0x19c433[_0x2c96('0x11')][_0x2c96('0x13')]);}logger[_0x2c96('0x11')](_0x2c96('0xc'),_0x21bfb6,_0x19c433[_0x2c96('0x11')][_0x2c96('0x13')]);return _0x5e13d2(_0x19c433[_0x2c96('0x11')][_0x2c96('0x13')]);}else{logger[_0x2c96('0xb')](_0x2c96('0xc'),_0x21bfb6,_0x2c96('0xd'));_0x5e13d2(_0x19c433[_0x2c96('0x14')]['message']);}})['catch'](function(_0x5d8637){logger[_0x2c96('0x11')](_0x2c96('0xc'),_0x21bfb6,_0x5d8637);_0x55acd5(_0x5d8637);});});}exports[_0x2c96('0x15')]=function(_0x349906){var _0x4b1294=this;return new Promise(function(_0x9783c6,_0x30dbbf){return db[_0x2c96('0x16')][_0x2c96('0x17')](_0x349906[_0x2c96('0x18')],{'raw':_0x349906[_0x2c96('0x19')]?_0x349906[_0x2c96('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x2c96('0xa')](function(_0x20e2a9){logger['info'](_0x2c96('0x15'),_0x349906);logger[_0x2c96('0xe')]('CreateWhatsappQueueReport',_0x349906,JSON[_0x2c96('0x10')](_0x20e2a9));_0x9783c6(_0x20e2a9);})['catch'](function(_0x3a033f){logger['error']('CreateWhatsappQueueReport',_0x3a033f[_0x2c96('0x13')],_0x349906);_0x30dbbf(_0x4b1294['error'](0x1f4,_0x3a033f[_0x2c96('0x13')]));});});};exports[_0x2c96('0x1a')]=function(_0x133505){var _0x1c3586=this;return new Promise(function(_0x4ee5c4,_0x5389f0){return db[_0x2c96('0x16')][_0x2c96('0x1b')](_0x133505[_0x2c96('0x18')],{'raw':_0x133505[_0x2c96('0x19')]?_0x133505[_0x2c96('0x19')][_0x2c96('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x133505[_0x2c96('0x19')]?_0x133505[_0x2c96('0x19')][_0x2c96('0x1d')]||null:null,'attributes':_0x133505[_0x2c96('0x19')]?_0x133505[_0x2c96('0x19')][_0x2c96('0x1e')]||null:null,'limit':_0x133505[_0x2c96('0x19')]?_0x133505[_0x2c96('0x19')][_0x2c96('0x1f')]||null:null})[_0x2c96('0xa')](function(_0x130400){logger['info']('UpdateWhatsappQueueReport',_0x133505);logger[_0x2c96('0xe')]('UpdateWhatsappQueueReport',_0x133505,JSON[_0x2c96('0x10')](_0x130400));_0x4ee5c4(_0x130400);})['catch'](function(_0x30db66){logger[_0x2c96('0x11')](_0x2c96('0x1a'),_0x30db66['message'],_0x133505);_0x5389f0(_0x1c3586[_0x2c96('0x11')](0x1f4,_0x30db66[_0x2c96('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 323aa19..eb9b451 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 _0x196c=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','describe','/:id','show'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x196c,0x15b));var _0xc196=function(_0x20a602,_0x3dce15){_0x20a602=_0x20a602-0x0;var _0x30d868=_0x196c[_0x20a602];return _0x30d868;};'use strict';var multer=require(_0xc196('0x0'));var util=require(_0xc196('0x1'));var path=require('path');var timeout=require(_0xc196('0x2'));var express=require(_0xc196('0x3'));var router=express[_0xc196('0x4')]();var fs_extra=require(_0xc196('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc196('0x6'));var config=require('../../config/environment');var controller=require(_0xc196('0x7'));router[_0xc196('0x8')]('/',auth[_0xc196('0x9')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xc196('0xa')]);router[_0xc196('0x8')](_0xc196('0xb'),auth[_0xc196('0x9')](),controller[_0xc196('0xc')]);router['post']('/',auth[_0xc196('0x9')](),controller['create']);router[_0xc196('0xd')]('/:id',auth[_0xc196('0x9')](),controller[_0xc196('0xe')]);router[_0xc196('0xf')](_0xc196('0xb'),auth[_0xc196('0x9')](),controller[_0xc196('0x10')]);module[_0xc196('0x11')]=router; \ No newline at end of file +var _0x0085=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','exports','multer','connect-timeout','express','fs-extra'];(function(_0xe8129c,_0x2fb03c){var _0x709fc5=function(_0xb8e0c6){while(--_0xb8e0c6){_0xe8129c['push'](_0xe8129c['shift']());}};_0x709fc5(++_0x2fb03c);}(_0x0085,0x150));var _0x5008=function(_0x2821a9,_0x54d53f){_0x2821a9=_0x2821a9-0x0;var _0x30bf24=_0x0085[_0x2821a9];return _0x30bf24;};'use strict';var multer=require(_0x5008('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5008('0x1'));var express=require(_0x5008('0x2'));var router=express['Router']();var fs_extra=require(_0x5008('0x3'));var auth=require(_0x5008('0x4'));var interaction=require(_0x5008('0x5'));var config=require(_0x5008('0x6'));var controller=require(_0x5008('0x7'));router[_0x5008('0x8')]('/',auth[_0x5008('0x9')](),controller[_0x5008('0xa')]);router[_0x5008('0x8')](_0x5008('0xb'),auth[_0x5008('0x9')](),controller[_0x5008('0xc')]);router[_0x5008('0x8')](_0x5008('0xd'),auth['isAuthenticated'](),controller[_0x5008('0xe')]);router['post']('/',auth[_0x5008('0x9')](),controller['create']);router[_0x5008('0xf')](_0x5008('0xd'),auth[_0x5008('0x9')](),controller['update']);router['delete'](_0x5008('0xd'),auth[_0x5008('0x9')](),controller['destroy']);module[_0x5008('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index c2b426f..16ec971 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 _0xbaf0=['ENUM','account','agent','queue','exports','STRING'];(function(_0x3dfc46,_0x2a3a39){var _0x13d923=function(_0x1f0df8){while(--_0x1f0df8){_0x3dfc46['push'](_0x3dfc46['shift']());}};_0x13d923(++_0x2a3a39);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'uniqueid':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0baf('0x2')](_0x0baf('0x3'),_0x0baf('0x4'),_0x0baf('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x5f66=['queue','DATE','exports','ENUM','account','agent'];(function(_0xd13a88,_0x3c5269){var _0x1c993c=function(_0x245af5){while(--_0x245af5){_0xd13a88['push'](_0xd13a88['shift']());}};_0x1c993c(++_0x3c5269);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x65f6('0x1')](_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x65f6('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index a48f5ae..14609e7 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 _0x8d0a=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','length','include','find','create','body','update','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x4a5494,_0x3ad336){var _0x57cbb5=function(_0xa5a1ac){while(--_0xa5a1ac){_0x4a5494['push'](_0x4a5494['shift']());}};_0x57cbb5(++_0x3ad336);}(_0x8d0a,0x65));var _0xa8d0=function(_0x211361,_0x1a2aa6){_0x211361=_0x211361-0x0;var _0x57a45e=_0x8d0a[_0x211361];return _0x57a45e;};'use strict';var pdf=require(_0xa8d0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa8d0('0x1'));var zipdir=require(_0xa8d0('0x2'));var jsonpatch=require(_0xa8d0('0x3'));var rp=require(_0xa8d0('0x4'));var moment=require(_0xa8d0('0x5'));var BPromise=require(_0xa8d0('0x6'));var Mustache=require(_0xa8d0('0x7'));var util=require(_0xa8d0('0x8'));var path=require(_0xa8d0('0x9'));var sox=require('sox');var csv=require(_0xa8d0('0xa'));var ejs=require(_0xa8d0('0xb'));var fs=require('fs');var fs_extra=require(_0xa8d0('0xc'));var _=require(_0xa8d0('0xd'));var squel=require(_0xa8d0('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa8d0('0xf'));var toCsv=require(_0xa8d0('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa8d0('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa8d0('0x11'));var hardwareService=require(_0xa8d0('0x12'));var logger=require(_0xa8d0('0x13'))(_0xa8d0('0x14'));var utils=require(_0xa8d0('0x15'));var config=require(_0xa8d0('0x16'));var licenseUtil=require(_0xa8d0('0x17'));var db=require(_0xa8d0('0x18'))['db'];function respondWithStatusCode(_0x329583,_0x1bfcb6){_0x1bfcb6=_0x1bfcb6||0xcc;return function(_0x224564){if(_0x224564){return _0x329583['sendStatus'](_0x1bfcb6);}return _0x329583[_0xa8d0('0x19')](_0x1bfcb6)['end']();};}function respondWithResult(_0x5a9193,_0x32ea3e){_0x32ea3e=_0x32ea3e||0xc8;return function(_0x2816d1){if(_0x2816d1){return _0x5a9193['status'](_0x32ea3e)[_0xa8d0('0x1a')](_0x2816d1);}};}function respondWithFilteredResult(_0x459e9d,_0x2946d5){return function(_0x44a48e){if(_0x44a48e){var _0x10ec3c=_0x44a48e[_0xa8d0('0x1b')],_0x3a5fe3=_0x2946d5['offset'],_0x4ef7bf=_0x2946d5[_0xa8d0('0x1c')]+_0x2946d5[_0xa8d0('0x1d')],_0x9d918a;if(_0x4ef7bf>=_0x10ec3c){_0x4ef7bf=_0x10ec3c;_0x9d918a=0xc8;}else{_0x9d918a=0xce;}_0x459e9d['status'](_0x9d918a);return _0x459e9d[_0xa8d0('0x1e')](_0xa8d0('0x1f'),_0x3a5fe3+'-'+_0x4ef7bf+'/'+_0x10ec3c)['json'](_0x44a48e);}return null;};}function patchUpdates(_0x582a54){return function(_0xd29b28){try{jsonpatch[_0xa8d0('0x20')](_0xd29b28,_0x582a54,!![]);}catch(_0x5c597a){return BPromise[_0xa8d0('0x21')](_0x5c597a);}return _0xd29b28[_0xa8d0('0x22')]();};}function saveUpdates(_0x446e6f,_0x589902){return function(_0x36891d){if(_0x36891d){return _0x36891d['update'](_0x446e6f)[_0xa8d0('0x23')](function(_0x4df8a9){return _0x4df8a9;});}return null;};}function removeEntity(_0x337677,_0x27c798){return function(_0x92d065){if(_0x92d065){return _0x92d065[_0xa8d0('0x24')]()[_0xa8d0('0x23')](function(){_0x337677['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x265dce,_0x486422){return function(_0x3ec672){if(!_0x3ec672){_0x265dce[_0xa8d0('0x25')](0x194);}return _0x3ec672;};}function handleError(_0x400ac1,_0x1ddb63){_0x1ddb63=_0x1ddb63||0x1f4;return function(_0x17bdfc){logger['error'](_0x17bdfc[_0xa8d0('0x26')]);if(_0x17bdfc[_0xa8d0('0x27')]){delete _0x17bdfc[_0xa8d0('0x27')];}_0x400ac1[_0xa8d0('0x19')](_0x1ddb63)[_0xa8d0('0x28')](_0x17bdfc);};}exports[_0xa8d0('0x29')]=function(_0x80390d,_0x28ba73){var _0x5127cb={},_0x195dae={},_0xc7761d={'count':0x0,'rows':[]};var _0xd7943a=_[_0xa8d0('0x2a')](db[_0xa8d0('0x2b')][_0xa8d0('0x2c')],function(_0x573641){return{'name':_0x573641[_0xa8d0('0x2d')],'type':_0x573641[_0xa8d0('0x2e')][_0xa8d0('0x2f')]};});_0x195dae[_0xa8d0('0x30')]=_['map'](_0xd7943a,_0xa8d0('0x27'));_0x195dae[_0xa8d0('0x31')]=_['keys'](_0x80390d['query']);_0x195dae[_0xa8d0('0x32')]=_[_0xa8d0('0x33')](_0x195dae[_0xa8d0('0x30')],_0x195dae[_0xa8d0('0x31')]);_0x5127cb[_0xa8d0('0x34')]=_[_0xa8d0('0x33')](_0x195dae[_0xa8d0('0x30')],qs[_0xa8d0('0x35')](_0x80390d[_0xa8d0('0x31')][_0xa8d0('0x35')]));_0x5127cb[_0xa8d0('0x34')]=_0x5127cb[_0xa8d0('0x34')]['length']?_0x5127cb['attributes']:_0x195dae[_0xa8d0('0x30')];if(!_0x80390d['query'][_0xa8d0('0x36')](_0xa8d0('0x37'))){_0x5127cb[_0xa8d0('0x1d')]=qs[_0xa8d0('0x1d')](_0x80390d[_0xa8d0('0x31')]['limit']);_0x5127cb['offset']=qs[_0xa8d0('0x1c')](_0x80390d[_0xa8d0('0x31')][_0xa8d0('0x1c')]);}_0x5127cb[_0xa8d0('0x38')]=qs[_0xa8d0('0x39')](_0x80390d[_0xa8d0('0x31')]['sort']);_0x5127cb[_0xa8d0('0x3a')]=qs[_0xa8d0('0x32')](_[_0xa8d0('0x3b')](_0x80390d['query'],_0x195dae[_0xa8d0('0x32')]),_0xd7943a);if(_0x80390d[_0xa8d0('0x31')][_0xa8d0('0x3c')]){_0x5127cb[_0xa8d0('0x3a')]=_[_0xa8d0('0x3d')](_0x5127cb[_0xa8d0('0x3a')],{'$or':_[_0xa8d0('0x2a')](_0xd7943a,function(_0x4e0023){if(_0x4e0023[_0xa8d0('0x2e')]!==_0xa8d0('0x3e')){var _0x2e6bc5={};_0x2e6bc5[_0x4e0023[_0xa8d0('0x27')]]={'$like':'%'+_0x80390d[_0xa8d0('0x31')][_0xa8d0('0x3c')]+'%'};return _0x2e6bc5;}})});}_0x5127cb=_['merge']({},_0x5127cb,_0x80390d[_0xa8d0('0x3f')]);var _0x377949={'where':_0x5127cb[_0xa8d0('0x3a')]};return db[_0xa8d0('0x2b')][_0xa8d0('0x1b')](_0x377949)[_0xa8d0('0x23')](function(_0x1c1e05){_0xc7761d[_0xa8d0('0x1b')]=_0x1c1e05;if(_0x80390d['query'][_0xa8d0('0x40')]){_0x5127cb['include']=[{'all':!![]}];}return db[_0xa8d0('0x2b')][_0xa8d0('0x41')](_0x5127cb);})[_0xa8d0('0x23')](function(_0x16dc20){_0xc7761d[_0xa8d0('0x42')]=_0x16dc20;return _0xc7761d;})[_0xa8d0('0x23')](respondWithFilteredResult(_0x28ba73,_0x5127cb))[_0xa8d0('0x43')](handleError(_0x28ba73,null));};exports[_0xa8d0('0x44')]=function(_0x2f563a,_0x39ca80){var _0x812048={'raw':!![],'where':{'id':_0x2f563a['params']['id']}},_0x35a98e={};_0x35a98e[_0xa8d0('0x30')]=_[_0xa8d0('0x45')](db[_0xa8d0('0x2b')][_0xa8d0('0x2c')]);_0x35a98e[_0xa8d0('0x31')]=_[_0xa8d0('0x45')](_0x2f563a['query']);_0x35a98e[_0xa8d0('0x32')]=_[_0xa8d0('0x33')](_0x35a98e[_0xa8d0('0x30')],_0x35a98e[_0xa8d0('0x31')]);_0x812048[_0xa8d0('0x34')]=_[_0xa8d0('0x33')](_0x35a98e[_0xa8d0('0x30')],qs[_0xa8d0('0x35')](_0x2f563a['query'][_0xa8d0('0x35')]));_0x812048['attributes']=_0x812048[_0xa8d0('0x34')][_0xa8d0('0x46')]?_0x812048[_0xa8d0('0x34')]:_0x35a98e[_0xa8d0('0x30')];if(_0x2f563a['query'][_0xa8d0('0x40')]){_0x812048[_0xa8d0('0x47')]=[{'all':!![]}];}_0x812048=_['merge']({},_0x812048,_0x2f563a[_0xa8d0('0x3f')]);return db[_0xa8d0('0x2b')][_0xa8d0('0x48')](_0x812048)['then'](handleEntityNotFound(_0x39ca80,null))['then'](respondWithResult(_0x39ca80,null))[_0xa8d0('0x43')](handleError(_0x39ca80,null));};exports[_0xa8d0('0x49')]=function(_0x239400,_0x1f936a){return db['WhatsappTransferReport'][_0xa8d0('0x49')](_0x239400[_0xa8d0('0x4a')],{})[_0xa8d0('0x23')](respondWithResult(_0x1f936a,0xc9))[_0xa8d0('0x43')](handleError(_0x1f936a,null));};exports[_0xa8d0('0x4b')]=function(_0x4eda65,_0x1161bf){if(_0x4eda65['body']['id']){delete _0x4eda65[_0xa8d0('0x4a')]['id'];}return db[_0xa8d0('0x2b')][_0xa8d0('0x48')]({'where':{'id':_0x4eda65['params']['id']}})[_0xa8d0('0x23')](handleEntityNotFound(_0x1161bf,null))[_0xa8d0('0x23')](saveUpdates(_0x4eda65[_0xa8d0('0x4a')],null))[_0xa8d0('0x23')](respondWithResult(_0x1161bf,null))[_0xa8d0('0x43')](handleError(_0x1161bf,null));};exports['destroy']=function(_0x2e4fce,_0x2283cc){return db['WhatsappTransferReport'][_0xa8d0('0x48')]({'where':{'id':_0x2e4fce[_0xa8d0('0x4c')]['id']}})[_0xa8d0('0x23')](handleEntityNotFound(_0x2283cc,null))[_0xa8d0('0x23')](removeEntity(_0x2283cc,null))[_0xa8d0('0x43')](handleError(_0x2283cc,null));};exports[_0xa8d0('0x4d')]=function(_0xb59473,_0x4e4ee3){return db[_0xa8d0('0x2b')]['describe']()['then'](respondWithResult(_0x4e4ee3,null))[_0xa8d0('0x43')](handleError(_0x4e4ee3,null));}; \ No newline at end of file +var _0xde81=['offset','set','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','includeAll','find','body','params','describe','html-pdf','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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count'];(function(_0x23d13d,_0x41c91a){var _0x32a174=function(_0x5e3f7d){while(--_0x5e3f7d){_0x23d13d['push'](_0x23d13d['shift']());}};_0x32a174(++_0x41c91a);}(_0xde81,0x109));var _0x1de8=function(_0x5567dd,_0x35d872){_0x5567dd=_0x5567dd-0x0;var _0x11f96c=_0xde81[_0x5567dd];return _0x11f96c;};'use strict';var pdf=require(_0x1de8('0x0'));var emlformat=require(_0x1de8('0x1'));var rimraf=require(_0x1de8('0x2'));var zipdir=require(_0x1de8('0x3'));var jsonpatch=require(_0x1de8('0x4'));var rp=require(_0x1de8('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1de8('0x6'));var util=require('util');var path=require(_0x1de8('0x7'));var sox=require(_0x1de8('0x8'));var csv=require(_0x1de8('0x9'));var ejs=require(_0x1de8('0xa'));var fs=require('fs');var fs_extra=require(_0x1de8('0xb'));var _=require(_0x1de8('0xc'));var squel=require(_0x1de8('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1de8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1de8('0xf'));var Papa=require(_0x1de8('0x10'));var Redis=require(_0x1de8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1de8('0x12'));var as=require(_0x1de8('0x13'));var hardwareService=require(_0x1de8('0x14'));var logger=require(_0x1de8('0x15'))(_0x1de8('0x16'));var utils=require(_0x1de8('0x17'));var config=require(_0x1de8('0x18'));var licenseUtil=require(_0x1de8('0x19'));var db=require(_0x1de8('0x1a'))['db'];function respondWithStatusCode(_0x430fcf,_0x56126e){_0x56126e=_0x56126e||0xcc;return function(_0x389e31){if(_0x389e31){return _0x430fcf['sendStatus'](_0x56126e);}return _0x430fcf[_0x1de8('0x1b')](_0x56126e)[_0x1de8('0x1c')]();};}function respondWithResult(_0x4d0ed6,_0x547627){_0x547627=_0x547627||0xc8;return function(_0xd1dc7){if(_0xd1dc7){return _0x4d0ed6[_0x1de8('0x1b')](_0x547627)[_0x1de8('0x1d')](_0xd1dc7);}};}function respondWithFilteredResult(_0x1b6ca1,_0x578dbc){return function(_0x297130){if(_0x297130){var _0x44516f=_0x297130[_0x1de8('0x1e')],_0x407a54=_0x578dbc['offset'],_0x4d5fbc=_0x578dbc[_0x1de8('0x1f')]+_0x578dbc['limit'],_0x10efc1;if(_0x4d5fbc>=_0x44516f){_0x4d5fbc=_0x44516f;_0x10efc1=0xc8;}else{_0x10efc1=0xce;}_0x1b6ca1['status'](_0x10efc1);return _0x1b6ca1[_0x1de8('0x20')]('Content-Range',_0x407a54+'-'+_0x4d5fbc+'/'+_0x44516f)[_0x1de8('0x1d')](_0x297130);}return null;};}function patchUpdates(_0x475c40){return function(_0x2bf1b6){try{jsonpatch['apply'](_0x2bf1b6,_0x475c40,!![]);}catch(_0x3f0a5f){return BPromise[_0x1de8('0x21')](_0x3f0a5f);}return _0x2bf1b6[_0x1de8('0x22')]();};}function saveUpdates(_0x1e0dcf,_0x3b38ef){return function(_0x307426){if(_0x307426){return _0x307426[_0x1de8('0x23')](_0x1e0dcf)[_0x1de8('0x24')](function(_0x4af449){return _0x4af449;});}return null;};}function removeEntity(_0x9d0996,_0x441fcd){return function(_0x404696){if(_0x404696){return _0x404696[_0x1de8('0x25')]()[_0x1de8('0x24')](function(){_0x9d0996[_0x1de8('0x1b')](0xcc)[_0x1de8('0x1c')]();});}};}function handleEntityNotFound(_0x4ee74f,_0x43fe66){return function(_0x5051f6){if(!_0x5051f6){_0x4ee74f['sendStatus'](0x194);}return _0x5051f6;};}function handleError(_0xb6b4ce,_0x4600c7){_0x4600c7=_0x4600c7||0x1f4;return function(_0x1a4f2f){logger[_0x1de8('0x26')](_0x1a4f2f[_0x1de8('0x27')]);if(_0x1a4f2f[_0x1de8('0x28')]){delete _0x1a4f2f[_0x1de8('0x28')];}_0xb6b4ce[_0x1de8('0x1b')](_0x4600c7)[_0x1de8('0x29')](_0x1a4f2f);};}exports[_0x1de8('0x2a')]=function(_0x3b2ef5,_0x1b8870){var _0x2f207a={},_0x5a13b1={},_0x5e5156={'count':0x0,'rows':[]};var _0x9fcd44=_[_0x1de8('0x2b')](db[_0x1de8('0x2c')][_0x1de8('0x2d')],function(_0x5aee91){return{'name':_0x5aee91[_0x1de8('0x2e')],'type':_0x5aee91[_0x1de8('0x2f')]['key']};});_0x5a13b1[_0x1de8('0x30')]=_[_0x1de8('0x2b')](_0x9fcd44,_0x1de8('0x28'));_0x5a13b1[_0x1de8('0x31')]=_[_0x1de8('0x32')](_0x3b2ef5[_0x1de8('0x31')]);_0x5a13b1[_0x1de8('0x33')]=_[_0x1de8('0x34')](_0x5a13b1[_0x1de8('0x30')],_0x5a13b1[_0x1de8('0x31')]);_0x2f207a[_0x1de8('0x35')]=_[_0x1de8('0x34')](_0x5a13b1[_0x1de8('0x30')],qs[_0x1de8('0x36')](_0x3b2ef5[_0x1de8('0x31')]['fields']));_0x2f207a[_0x1de8('0x35')]=_0x2f207a[_0x1de8('0x35')][_0x1de8('0x37')]?_0x2f207a[_0x1de8('0x35')]:_0x5a13b1[_0x1de8('0x30')];if(!_0x3b2ef5[_0x1de8('0x31')]['hasOwnProperty']('nolimit')){_0x2f207a[_0x1de8('0x38')]=qs[_0x1de8('0x38')](_0x3b2ef5[_0x1de8('0x31')][_0x1de8('0x38')]);_0x2f207a[_0x1de8('0x1f')]=qs['offset'](_0x3b2ef5[_0x1de8('0x31')]['offset']);}_0x2f207a[_0x1de8('0x39')]=qs[_0x1de8('0x3a')](_0x3b2ef5[_0x1de8('0x31')]['sort']);_0x2f207a['where']=qs[_0x1de8('0x33')](_[_0x1de8('0x3b')](_0x3b2ef5[_0x1de8('0x31')],_0x5a13b1['filters']),_0x9fcd44);if(_0x3b2ef5['query'][_0x1de8('0x3c')]){_0x2f207a[_0x1de8('0x3d')]=_[_0x1de8('0x3e')](_0x2f207a[_0x1de8('0x3d')],{'$or':_['map'](_0x9fcd44,function(_0x40d62d){if(_0x40d62d[_0x1de8('0x2f')]!==_0x1de8('0x3f')){var _0x4775df={};_0x4775df[_0x40d62d[_0x1de8('0x28')]]={'$like':'%'+_0x3b2ef5[_0x1de8('0x31')][_0x1de8('0x3c')]+'%'};return _0x4775df;}})});}_0x2f207a=_['merge']({},_0x2f207a,_0x3b2ef5[_0x1de8('0x40')]);var _0x5bb7e4={'where':_0x2f207a['where']};return db[_0x1de8('0x2c')][_0x1de8('0x1e')](_0x5bb7e4)[_0x1de8('0x24')](function(_0x319034){_0x5e5156['count']=_0x319034;if(_0x3b2ef5[_0x1de8('0x31')]['includeAll']){_0x2f207a[_0x1de8('0x41')]=[{'all':!![]}];}return db[_0x1de8('0x2c')][_0x1de8('0x42')](_0x2f207a);})[_0x1de8('0x24')](function(_0x2cb2c7){_0x5e5156[_0x1de8('0x43')]=_0x2cb2c7;return _0x5e5156;})[_0x1de8('0x24')](respondWithFilteredResult(_0x1b8870,_0x2f207a))[_0x1de8('0x44')](handleError(_0x1b8870,null));};exports['show']=function(_0x5bba82,_0x131188){var _0x5038d6={'raw':!![],'where':{'id':_0x5bba82['params']['id']}},_0x356f36={};_0x356f36[_0x1de8('0x30')]=_['keys'](db[_0x1de8('0x2c')][_0x1de8('0x2d')]);_0x356f36['query']=_['keys'](_0x5bba82[_0x1de8('0x31')]);_0x356f36[_0x1de8('0x33')]=_[_0x1de8('0x34')](_0x356f36[_0x1de8('0x30')],_0x356f36[_0x1de8('0x31')]);_0x5038d6[_0x1de8('0x35')]=_[_0x1de8('0x34')](_0x356f36[_0x1de8('0x30')],qs['fields'](_0x5bba82[_0x1de8('0x31')]['fields']));_0x5038d6[_0x1de8('0x35')]=_0x5038d6[_0x1de8('0x35')][_0x1de8('0x37')]?_0x5038d6['attributes']:_0x356f36[_0x1de8('0x30')];if(_0x5bba82[_0x1de8('0x31')][_0x1de8('0x45')]){_0x5038d6['include']=[{'all':!![]}];}_0x5038d6=_['merge']({},_0x5038d6,_0x5bba82[_0x1de8('0x40')]);return db[_0x1de8('0x2c')][_0x1de8('0x46')](_0x5038d6)[_0x1de8('0x24')](handleEntityNotFound(_0x131188,null))[_0x1de8('0x24')](respondWithResult(_0x131188,null))[_0x1de8('0x44')](handleError(_0x131188,null));};exports['create']=function(_0x5e6450,_0x3bc48c){return db['WhatsappTransferReport']['create'](_0x5e6450[_0x1de8('0x47')],{})[_0x1de8('0x24')](respondWithResult(_0x3bc48c,0xc9))[_0x1de8('0x44')](handleError(_0x3bc48c,null));};exports['update']=function(_0x420782,_0x3d4d8f){if(_0x420782[_0x1de8('0x47')]['id']){delete _0x420782['body']['id'];}return db[_0x1de8('0x2c')][_0x1de8('0x46')]({'where':{'id':_0x420782['params']['id']}})['then'](handleEntityNotFound(_0x3d4d8f,null))[_0x1de8('0x24')](saveUpdates(_0x420782['body'],null))[_0x1de8('0x24')](respondWithResult(_0x3d4d8f,null))['catch'](handleError(_0x3d4d8f,null));};exports[_0x1de8('0x25')]=function(_0x581683,_0x56fa7c){return db['WhatsappTransferReport']['find']({'where':{'id':_0x581683[_0x1de8('0x48')]['id']}})[_0x1de8('0x24')](handleEntityNotFound(_0x56fa7c,null))[_0x1de8('0x24')](removeEntity(_0x56fa7c,null))['catch'](handleError(_0x56fa7c,null));};exports[_0x1de8('0x49')]=function(_0x1bb02a,_0x27a96e){return db[_0x1de8('0x2c')][_0x1de8('0x49')]()[_0x1de8('0x24')](respondWithResult(_0x27a96e,null))[_0x1de8('0x44')](handleError(_0x27a96e,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index a074cf5..055f000 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 _0xf897=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','define','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xf897,0x14c));var _0x7f89=function(_0x14e6b1,_0x27757a){_0x14e6b1=_0x14e6b1-0x0;var _0x4dba9c=_0xf897[_0x14e6b1];return _0x4dba9c;};'use strict';var _=require(_0x7f89('0x0'));var util=require(_0x7f89('0x1'));var logger=require(_0x7f89('0x2'))(_0x7f89('0x3'));var moment=require(_0x7f89('0x4'));var BPromise=require(_0x7f89('0x5'));var rp=require(_0x7f89('0x6'));var fs=require('fs');var path=require(_0x7f89('0x7'));var rimraf=require(_0x7f89('0x8'));var config=require(_0x7f89('0x9'));var attributes=require(_0x7f89('0xa'));module['exports']=function(_0x4e1248,_0x45f3a5){return _0x4e1248[_0x7f89('0xb')]('WhatsappTransferReport',attributes,{'tableName':_0x7f89('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7f89('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x105f=['report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','request-promise','../../config/environment','./whatsappTransferReport.attributes','exports','define'];(function(_0x3637a2,_0x3de087){var _0x439550=function(_0x5e5c26){while(--_0x5e5c26){_0x3637a2['push'](_0x3637a2['shift']());}};_0x439550(++_0x3de087);}(_0x105f,0x188));var _0xf105=function(_0x2068f7,_0x45455d){_0x2068f7=_0x2068f7-0x0;var _0x593fd5=_0x105f[_0x2068f7];return _0x593fd5;};'use strict';var _=require(_0xf105('0x0'));var util=require(_0xf105('0x1'));var logger=require(_0xf105('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf105('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf105('0x4'));var attributes=require(_0xf105('0x5'));module[_0xf105('0x6')]=function(_0x15c899,_0xe3df76){return _0x15c899[_0xf105('0x7')]('WhatsappTransferReport',attributes,{'tableName':_0xf105('0x8'),'paranoid':![],'indexes':[{'name':_0xf105('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 0656688..88a5808 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 _0xa9e0=['http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\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(_0x1b2734,_0x3c18d8){var _0x29e5f3=function(_0x2f2479){while(--_0x2f2479){_0x1b2734['push'](_0x1b2734['shift']());}};_0x29e5f3(++_0x3c18d8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\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(_0x3ab1c8,_0x4932e3){var _0x5992f3=function(_0x3072a9){while(--_0x3072a9){_0x3ab1c8['push'](_0x3ab1c8['shift']());}};_0x5992f3(++_0x4932e3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index ac1c745..92276ca 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x06ae=['start','info','Online\x20apps:','map','filter','name','join','Offline\x20apps:','status','online','None','./config/seedDB','catch','error','exit','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','sync','then','listen'];(function(_0x55557c,_0x2d6887){var _0x35bb6d=function(_0x43c778){while(--_0x43c778){_0x55557c['push'](_0x55557c['shift']());}};_0x35bb6d(++_0x2d6887);}(_0x06ae,0x16e));var _0xe06a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x06ae[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var mysqldb=require(_0xe06a('0x0'));var rpc=require(_0xe06a('0x1'));var config=require(_0xe06a('0x2'));var logger=require(_0xe06a('0x3'))(_0xe06a('0x4'));var pm2=require(_0xe06a('0x5'));var pm2Config=require(_0xe06a('0x6'));var schedule=require(_0xe06a('0x7'));var chat=require(_0xe06a('0x8'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db']['sequelize'][_0xe06a('0x9')]()[_0xe06a('0xa')](function(){return rpc[_0xe06a('0xb')]();})[_0xe06a('0xa')](function(_0x1ea66c){logger['info'](_0x1ea66c);return chat[_0xe06a('0xc')]();})['then'](function(){return whatsapp['start']();})[_0xe06a('0xa')](function(){return schedule['start']();})[_0xe06a('0xa')](function(){return transcribe['start']();})['then'](function(_0xb420d2){logger[_0xe06a('0xd')](_0xb420d2);return pm2['start'](pm2Config);})[_0xe06a('0xa')](function(_0x11afc9){logger['info'](_0xe06a('0xe'),_[_0xe06a('0xf')](_[_0xe06a('0x10')](_0x11afc9,{'status':'online'}),_0xe06a('0x11'))[_0xe06a('0x12')]());logger[_0xe06a('0xd')](_0xe06a('0x13'),_[_0xe06a('0xf')](_['filter'](_0x11afc9,function(_0x1284bf){return _0x1284bf[_0xe06a('0x14')]!==_0xe06a('0x15');}),_0xe06a('0x11'))[_0xe06a('0x12')]()||_0xe06a('0x16'));config['seedDB']&&require(_0xe06a('0x17'))['default']();require('./config/license')['default']();})[_0xe06a('0x18')](function(_0x43ce7b){logger[_0xe06a('0x19')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x43ce7b);process[_0xe06a('0x1a')](0x1);});}main(); \ No newline at end of file +var _0xf3a8=['seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./rpc','./config/logger','./config/pm2/config','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','then','listen','info','start','filter','online','join','Offline\x20apps:','name','None'];(function(_0x2fc7fa,_0x3281fe){var _0x19b421=function(_0x8810b5){while(--_0x8810b5){_0x2fc7fa['push'](_0x2fc7fa['shift']());}};_0x19b421(++_0x3281fe);}(_0xf3a8,0xf2));var _0x8f3a=function(_0x579bb4,_0xe79966){_0x579bb4=_0x579bb4-0x0;var _0x1e66e4=_0xf3a8[_0x579bb4];return _0x1e66e4;};'use strict';var _=require('lodash');var mysqldb=require(_0x8f3a('0x0'));var rpc=require(_0x8f3a('0x1'));var config=require('./config/environment');var logger=require(_0x8f3a('0x2'))('app');var pm2=require('./config/pm2');var pm2Config=require(_0x8f3a('0x3'));var schedule=require('./config/schedule');var chat=require(_0x8f3a('0x4'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x8f3a('0x5'));function main(){return mysqldb['db'][_0x8f3a('0x6')][_0x8f3a('0x7')]()[_0x8f3a('0x8')](function(){return rpc[_0x8f3a('0x9')]();})[_0x8f3a('0x8')](function(_0x3dc1ea){logger[_0x8f3a('0xa')](_0x3dc1ea);return chat[_0x8f3a('0xb')]();})['then'](function(){return whatsapp[_0x8f3a('0xb')]();})['then'](function(){return schedule[_0x8f3a('0xb')]();})[_0x8f3a('0x8')](function(){return transcribe[_0x8f3a('0xb')]();})[_0x8f3a('0x8')](function(_0x1d3385){logger['info'](_0x1d3385);return pm2[_0x8f3a('0xb')](pm2Config);})[_0x8f3a('0x8')](function(_0x594252){logger[_0x8f3a('0xa')]('Online\x20apps:',_['map'](_[_0x8f3a('0xc')](_0x594252,{'status':_0x8f3a('0xd')}),'name')[_0x8f3a('0xe')]());logger[_0x8f3a('0xa')](_0x8f3a('0xf'),_['map'](_[_0x8f3a('0xc')](_0x594252,function(_0x475f2a){return _0x475f2a['status']!==_0x8f3a('0xd');}),_0x8f3a('0x10'))['join']()||_0x8f3a('0x11'));config[_0x8f3a('0x12')]&&require(_0x8f3a('0x13'))[_0x8f3a('0x14')]();require(_0x8f3a('0x15'))['default']();})[_0x8f3a('0x16')](function(_0x2b05ef){logger[_0x8f3a('0x17')](_0x8f3a('0x18'),_0x2b05ef);process[_0x8f3a('0x19')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 9bccaee..a89a5c1 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 _0xf8b3=['hex','now','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','crypto','bluebird','util','moment','secrets','session','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','openchannelPause','showWebBar','lastPauseAt','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','findOne','disposition','json','unmanaged','Unmanaged.','Forbidden.','use','authorization','headers','Basic','find','authenticate','pass','Bearer','status','Unknown\x20authorization\x20format','getUuid','query','apikey','then','User','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','add','catch','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','split','splice','unshift','encryptString','join','promisify','sign','secret','payload','options','verify','randomBytes','toString'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf8b3,0x7d));var _0x3f8b=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xf8b3[_0x1c546c];return _0x2cc384;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x3f8b('0x0'));var hardwareConf=require(_0x3f8b('0x1'));var licenseUtil=require(_0x3f8b('0x2'));var encryptor=require(_0x3f8b('0x3'));var _=require('lodash');var jwt=require(_0x3f8b('0x4'));var expressJwt=require(_0x3f8b('0x5'));var compose=require('composable-middleware');var basicAuth=require('basic-auth');var crypto=require(_0x3f8b('0x6'));var BPromise=require(_0x3f8b('0x7'));var util=require(_0x3f8b('0x8'));var moment=require(_0x3f8b('0x9'));var validateJwt=expressJwt({'secret':config[_0x3f8b('0xa')][_0x3f8b('0xb')]});var userAttributes=['id',_0x3f8b('0xc'),_0x3f8b('0xd'),_0x3f8b('0xe'),_0x3f8b('0xf'),_0x3f8b('0x10'),_0x3f8b('0x11'),_0x3f8b('0x12'),_0x3f8b('0x13'),_0x3f8b('0x14'),_0x3f8b('0x15'),_0x3f8b('0x16'),_0x3f8b('0x17'),'smsPause',_0x3f8b('0x18'),'pauseType',_0x3f8b('0x19'),'lastLoginAt',_0x3f8b('0x1a'),'crudPermissions','allowmessenger',_0x3f8b('0x1b'),_0x3f8b('0x1c'),_0x3f8b('0x1d'),_0x3f8b('0x1e'),_0x3f8b('0x1f'),_0x3f8b('0x20'),_0x3f8b('0x21'),_0x3f8b('0x22'),_0x3f8b('0x23'),_0x3f8b('0x24'),_0x3f8b('0x25'),_0x3f8b('0x26'),_0x3f8b('0x27'),'interface',_0x3f8b('0x28'),'settingsEnabled'];exports[_0x3f8b('0x29')]=function(){return this[_0x3f8b('0x2a')](!![])['use'](function(_0x2221f0,_0x311596,_0x57661a){if(_0x2221f0[_0x3f8b('0x2b')]){_0x57661a();}else{return db[_0x3f8b('0x2c')][_0x3f8b('0x2d')]({'where':{'id':_0x2221f0['params']['id']},'attributes':['id','closed',_0x3f8b('0x2e')],'raw':!![]})['then'](function(_0x10ce3c){if(_0x10ce3c&&_0x10ce3c['closed']){return _0x311596['status'](_0x10ce3c[_0x3f8b('0x2e')]==='unmanaged'?0x195:0x193)[_0x3f8b('0x2f')]({'message':_0x10ce3c[_0x3f8b('0x2e')]===_0x3f8b('0x30')?_0x3f8b('0x31'):_0x3f8b('0x32')});}else{_0x57661a();}})['catch'](function(_0x1efe8f){_0x57661a(_0x1efe8f);});}});};exports[_0x3f8b('0x2a')]=function isAuthenticated(_0x99ab52){return compose()[_0x3f8b('0x33')](function(_0x22369b,_0x4be810,_0x19bce5){var _0x120cda;if(_0x22369b['headers'][_0x3f8b('0x34')]){if(_['startsWith'](_0x22369b[_0x3f8b('0x35')]['authorization'],_0x3f8b('0x36'))){var _0x1f23d5=basicAuth(_0x22369b);db['User'][_0x3f8b('0x37')]({'where':{'name':_0x1f23d5[_0x3f8b('0xe')]}})['then'](function(_0x55ccae){if(!_0x55ccae||!_0x55ccae[_0x3f8b('0x38')](_0x1f23d5[_0x3f8b('0x39')])){return _0x4be810['status'](0x191)[_0x3f8b('0x2f')]({'message':'Wrong\x20credentials.'});}_0x22369b[_0x3f8b('0x2b')]={'id':_0x55ccae['id']};_0x19bce5();})['catch'](function(_0x53f89a){_0x19bce5(_0x53f89a);});}else if(_['startsWith'](_0x22369b[_0x3f8b('0x35')]['authorization'],_0x3f8b('0x3a'))){validateJwt(_0x22369b,_0x4be810,_0x19bce5);}else{if(_0x99ab52){_0x19bce5();}else{return _0x4be810[_0x3f8b('0x3b')](0x193)[_0x3f8b('0x2f')]({'message':_0x3f8b('0x3c')});}}}else if(_0x22369b['query']['apikey']){try{var _0x6fc002={'audience':hardwareConf[_0x3f8b('0x3d')](),'issuer':hardwareConf[_0x3f8b('0x3d')]()};verifyJwt(_0x22369b[_0x3f8b('0x3e')][_0x3f8b('0x3f')],_0x6fc002)[_0x3f8b('0x40')](function(_0xe63425){return db[_0x3f8b('0x41')]['find']({'where':{'id':_0xe63425[_0x3f8b('0x42')]}})[_0x3f8b('0x40')](function(_0x3827f5){_0x120cda=_0x3827f5;return db[_0x3f8b('0x43')][_0x3f8b('0x2d')]({'where':{'id':0x1},'attributes':[_0x3f8b('0x44'),_0x3f8b('0x45')],'raw':!![]});})[_0x3f8b('0x40')](function(_0x134faf){if(!_0x120cda||!_[_0x3f8b('0x46')](_0x120cda['apiKeyNonce'],_0xe63425[_0x3f8b('0x47')])){return _0x4be810['status'](0x191)[_0x3f8b('0x2f')]({'message':_0x3f8b('0x48')});}if(_0x120cda[_0x3f8b('0x49')]){return _0x4be810[_0x3f8b('0x3b')](0x191)[_0x3f8b('0x2f')]({'message':_0x3f8b('0x4a')});}if(_0x120cda['blocked']){if(_0x134faf['blockDuration']>0x0){if(moment(_0x120cda[_0x3f8b('0x4b')])[_0x3f8b('0x4c')](_0x134faf[_0x3f8b('0x45')],'minutes')>moment()){return _0x4be810[_0x3f8b('0x3b')](0x191)[_0x3f8b('0x2f')]({'message':_0x3f8b('0x4a')});}}else{return _0x4be810[_0x3f8b('0x3b')](0x191)[_0x3f8b('0x2f')]({'message':_0x3f8b('0x4a')});}}_0x22369b['user']={'id':_0x120cda['id']};_0x19bce5();});})[_0x3f8b('0x4d')](function(){return _0x4be810['status'](0x191)['json']({'message':_0x3f8b('0x4a')});});}catch(_0xe2eb6b){_0x19bce5(_0xe2eb6b);}}else if(_0x99ab52){_0x19bce5();}else{return _0x4be810['status'](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})[_0x3f8b('0x33')](function(_0x4e59c3,_0x40ecb5,_0x5d43e0){if(_0x4e59c3[_0x3f8b('0x2b')]){db[_0x3f8b('0x41')][_0x3f8b('0x37')]({'where':{'id':_0x4e59c3['user']['id']},'attributes':userAttributes})[_0x3f8b('0x40')](function(_0x32bb4e){if(!_0x32bb4e){return _0x40ecb5[_0x3f8b('0x3b')](0x194)[_0x3f8b('0x2f')]({'message':_0x3f8b('0x4e')});}_0x4e59c3['user']=_0x32bb4e;_0x5d43e0();})[_0x3f8b('0x4d')](function(_0x9d4e45){_0x5d43e0(_0x9d4e45);});}else if(_0x99ab52){_0x5d43e0();}else{return _0x40ecb5[_0x3f8b('0x3b')](0x194)['json']({'message':_0x3f8b('0x4f')});}});};exports[_0x3f8b('0x50')]=function canUpdate(){return compose()[_0x3f8b('0x33')](function(_0x315b6e,_0x1465df,_0xe15913){return licenseUtil[_0x3f8b('0x51')]()[_0x3f8b('0x40')](function(_0x3dd129){if(_0x3dd129[_0x3f8b('0x52')]){_0xe15913();}else{return _0x1465df[_0x3f8b('0x3b')](0x193)[_0x3f8b('0x2f')]({'message':_0x3f8b('0x53')});}})[_0x3f8b('0x4d')](function(_0x23b84a){_0xe15913(_0x23b84a);});});};exports[_0x3f8b('0x54')]=function(_0x2b2acb,_0x5e2dec,_0x5fe11){_0x2b2acb[_0x3f8b('0x54')]=!![];return _0x5fe11();};exports[_0x3f8b('0x55')]=function signToken(_0x17db60){return signJwt(_0x17db60);};exports[_0x3f8b('0x56')]=function(_0xb132dd,_0x2978a8){if(!_0xb132dd[_0x3f8b('0x2b')]){return _0x2978a8[_0x3f8b('0x3b')](0x194)[_0x3f8b('0x2f')]({'message':_0x3f8b('0x57')});}var _0x562e34={'payload':{'id':_0xb132dd[_0x3f8b('0x2b')]['id'],'role':_0xb132dd['user'][_0x3f8b('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x562e34)[_0x3f8b('0x40')](function(_0x5e6fef){_0x2978a8[_0x3f8b('0x58')]('motion.token',_0x5e6fef);_0x2978a8[_0x3f8b('0x59')](_0x3f8b('0x5a'));})[_0x3f8b('0x4d')](function(_0x1529ce){return _0x2978a8[_0x3f8b('0x3b')](0x1f4)['send'](_0x1529ce);});};exports[_0x3f8b('0x5b')]=function(_0x3c0a7e){if(_[_0x3f8b('0x5c')](_0x3c0a7e[_0x3f8b('0x5d')])||_[_0x3f8b('0x5c')](_0x3c0a7e[_0x3f8b('0x5e')])){return null;}else{return createJwt(_0x3c0a7e);}};exports[_0x3f8b('0x5f')]=function(_0x570a34){_0x570a34['apiKeyNonce']=generateNonce();_0x570a34['apiKeyIat']=generateIssuedAt();return createJwt(_0x570a34);};exports[_0x3f8b('0x60')]=function(_0x472a05,_0x40a9fb){var _0x5a5be6=_0x472a05['query'][_0x3f8b('0x3f')];if(_0x5a5be6){var _0x22e095={'nonce':_0x40a9fb[_0x3f8b('0x5d')],'iat':_0x40a9fb['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x5a5be6,_0x22e095)[_0x3f8b('0x40')](function(){return generateApiKey(_0x40a9fb);});}else{throw{'message':_0x3f8b('0x61')};}};exports[_0x3f8b('0x62')]=function(_0x159bc9){var _0x219090=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x219090[_0x3f8b('0x63')](_0x159bc9))throw new db['Sequelize'][(_0x3f8b('0x64'))](_0x3f8b('0x65'));return;};exports[_0x3f8b('0x66')]=function(_0x10668e,_0x42df57,_0x354c00){var _0x4c2ca0=encryptor['decryptString'](_0x42df57)['split'](',');for(var _0x4f71dd=0x0;_0x4f71dd<_0x354c00;_0x4f71dd++){if(!_0x4c2ca0[_0x4f71dd])break;if(_0x10668e['toLowerCase']()===_0x4c2ca0[_0x4f71dd][_0x3f8b('0x67')]()){var _0x6e75d1=util[_0x3f8b('0x68')](_0x3f8b('0x69'),_0x354c00);if(_0x354c00===0x1){_0x6e75d1='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x3f8b('0x6a'))][(_0x3f8b('0x64'))](_0x6e75d1);}}return;};exports[_0x3f8b('0x6b')]=function(_0x535b2f,_0x199bac){var _0x367bef=_0x199bac?encryptor['decryptString'](_0x199bac)[_0x3f8b('0x6c')](','):[];if(_0x367bef['length']===0x5){_0x367bef[_0x3f8b('0x6d')](-0x1,0x1);}_0x367bef[_0x3f8b('0x6e')](_0x535b2f);return encryptor[_0x3f8b('0x6f')](_0x367bef[_0x3f8b('0x70')](','));};function signJwt(_0x9c4c7d){var _0x439274=BPromise[_0x3f8b('0x71')](jwt[_0x3f8b('0x72')],{'context':jwt});var _0x56bf6f=_0x9c4c7d[_0x3f8b('0x73')]||config[_0x3f8b('0xa')][_0x3f8b('0xb')];return new BPromise(function(_0x29ffa3,_0x2e1e11){_0x439274(_0x9c4c7d[_0x3f8b('0x74')],_0x56bf6f,_0x9c4c7d[_0x3f8b('0x75')])[_0x3f8b('0x40')](function(_0x5a7ec3){_0x29ffa3(_0x5a7ec3);})[_0x3f8b('0x4d')](function(_0x242779){_0x2e1e11(_0x242779);});});}function verifyJwt(_0x282c9b,_0x791182,_0x567262){var _0x66257f=BPromise['promisify'](jwt[_0x3f8b('0x76')],{'context':jwt});var _0x8c989d=_0x567262||config[_0x3f8b('0xa')][_0x3f8b('0xb')];return new BPromise(function(_0x5af8b8,_0x1e355a){_0x66257f(_0x282c9b,_0x8c989d,_0x791182)['then'](function(_0x242f22){_0x5af8b8(_0x242f22);})[_0x3f8b('0x4d')](function(_0x11ac9e){_0x1e355a(_0x11ac9e);});});}function generateNonce(){return crypto[_0x3f8b('0x77')](0x10)[_0x3f8b('0x78')](_0x3f8b('0x79'));}function generateIssuedAt(){return Math['floor'](Date[_0x3f8b('0x7a')]()/0x3e8)[_0x3f8b('0x78')]();}function createJwt(_0xdec18d){var _0x4c4a40={'payload':{'iat':_0xdec18d[_0x3f8b('0x5e')],'nonce':_0xdec18d[_0x3f8b('0x5d')]},'options':{'algorithm':'HS512','subject':_0xdec18d['id'][_0x3f8b('0x78')](),'issuer':hardwareConf[_0x3f8b('0x3d')](),'audience':hardwareConf[_0x3f8b('0x3d')]()}};return signJwt(_0x4c4a40)[_0x3f8b('0x40')](function(_0x7d5b3a){return{'iat':_0xdec18d[_0x3f8b('0x5e')],'nonce':_0xdec18d[_0x3f8b('0x5d')],'token':_0x7d5b3a};});} \ No newline at end of file +var _0x988b=['toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','bluebird','secrets','fullname','internal','email','userpic','md5secret','voicePause','chatPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','userProfileId','settingsEnabled','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','Forbidden.','catch','headers','authorization','startsWith','User','find','pass','Wrong\x20credentials.','apikey','getUuid','query','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','sign','session','payload','options','verify','randomBytes'];(function(_0x1ee351,_0x54261b){var _0x245aaf=function(_0x3e4b65){while(--_0x3e4b65){_0x1ee351['push'](_0x1ee351['shift']());}};_0x245aaf(++_0x54261b);}(_0x988b,0x16d));var _0xb988=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x988b[_0x28d18d];return _0x470640;};'use strict';var db=require(_0xb988('0x0'))['db'];var config=require(_0xb988('0x1'));var hardwareConf=require(_0xb988('0x2'));var licenseUtil=require(_0xb988('0x3'));var encryptor=require('../encryptor');var _=require(_0xb988('0x4'));var jwt=require(_0xb988('0x5'));var expressJwt=require(_0xb988('0x6'));var compose=require(_0xb988('0x7'));var basicAuth=require('basic-auth');var crypto=require('crypto');var BPromise=require(_0xb988('0x8'));var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xb988('0x9')]['session']});var userAttributes=['id','role',_0xb988('0xa'),'name',_0xb988('0xb'),_0xb988('0xc'),_0xb988('0xd'),'permissions',_0xb988('0xe'),_0xb988('0xf'),_0xb988('0x10'),'mailPause','faxPause','smsPause',_0xb988('0x11'),_0xb988('0x12'),_0xb988('0x13'),_0xb988('0x14'),_0xb988('0x15'),_0xb988('0x16'),_0xb988('0x17'),_0xb988('0x18'),_0xb988('0x19'),'phoneBarAutoAnswer','phoneBarAutoAnswerDelay',_0xb988('0x1a'),_0xb988('0x1b'),_0xb988('0x1c'),'phoneBarEnableSettings',_0xb988('0x1d'),_0xb988('0x1e'),_0xb988('0x1f'),'phoneBarRemoteControlPort',_0xb988('0x20'),_0xb988('0x21'),_0xb988('0x22'),_0xb988('0x23')];exports[_0xb988('0x24')]=function(){return this[_0xb988('0x25')](!![])[_0xb988('0x26')](function(_0x461bde,_0x45de18,_0x9bdd21){if(_0x461bde[_0xb988('0x27')]){_0x9bdd21();}else{return db[_0xb988('0x28')][_0xb988('0x29')]({'where':{'id':_0x461bde[_0xb988('0x2a')]['id']},'attributes':['id',_0xb988('0x2b'),_0xb988('0x2c')],'raw':!![]})[_0xb988('0x2d')](function(_0x44abc3){if(_0x44abc3&&_0x44abc3[_0xb988('0x2b')]){return _0x45de18[_0xb988('0x2e')](_0x44abc3['disposition']===_0xb988('0x2f')?0x195:0x193)[_0xb988('0x30')]({'message':_0x44abc3[_0xb988('0x2c')]===_0xb988('0x2f')?'Unmanaged.':_0xb988('0x31')});}else{_0x9bdd21();}})[_0xb988('0x32')](function(_0x5c87ad){_0x9bdd21(_0x5c87ad);});}});};exports[_0xb988('0x25')]=function isAuthenticated(_0x44e177){return compose()[_0xb988('0x26')](function(_0x1444cb,_0x4e3e51,_0x6d6d55){var _0x2d2018;if(_0x1444cb[_0xb988('0x33')][_0xb988('0x34')]){if(_[_0xb988('0x35')](_0x1444cb[_0xb988('0x33')][_0xb988('0x34')],'Basic')){var _0x346dc5=basicAuth(_0x1444cb);db[_0xb988('0x36')][_0xb988('0x37')]({'where':{'name':_0x346dc5['name']}})[_0xb988('0x2d')](function(_0x568af1){if(!_0x568af1||!_0x568af1['authenticate'](_0x346dc5[_0xb988('0x38')])){return _0x4e3e51[_0xb988('0x2e')](0x191)[_0xb988('0x30')]({'message':_0xb988('0x39')});}_0x1444cb['user']={'id':_0x568af1['id']};_0x6d6d55();})[_0xb988('0x32')](function(_0x41e823){_0x6d6d55(_0x41e823);});}else if(_[_0xb988('0x35')](_0x1444cb['headers'][_0xb988('0x34')],'Bearer')){validateJwt(_0x1444cb,_0x4e3e51,_0x6d6d55);}else{if(_0x44e177){_0x6d6d55();}else{return _0x4e3e51[_0xb988('0x2e')](0x193)[_0xb988('0x30')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x1444cb['query'][_0xb988('0x3a')]){try{var _0x456ddc={'audience':hardwareConf[_0xb988('0x3b')](),'issuer':hardwareConf[_0xb988('0x3b')]()};verifyJwt(_0x1444cb[_0xb988('0x3c')][_0xb988('0x3a')],_0x456ddc)[_0xb988('0x2d')](function(_0x1bf1f9){return db[_0xb988('0x36')][_0xb988('0x37')]({'where':{'id':_0x1bf1f9[_0xb988('0x3d')]}})[_0xb988('0x2d')](function(_0x3b0171){_0x2d2018=_0x3b0171;return db[_0xb988('0x3e')]['findOne']({'where':{'id':0x1},'attributes':[_0xb988('0x3f'),_0xb988('0x40')],'raw':!![]});})['then'](function(_0x475b87){if(!_0x2d2018||!_[_0xb988('0x41')](_0x2d2018[_0xb988('0x42')],_0x1bf1f9['nonce'])){return _0x4e3e51[_0xb988('0x2e')](0x191)[_0xb988('0x30')]({'message':_0xb988('0x43')});}if(_0x2d2018[_0xb988('0x44')]){return _0x4e3e51[_0xb988('0x2e')](0x191)[_0xb988('0x30')]({'message':_0xb988('0x45')});}if(_0x2d2018[_0xb988('0x46')]){if(_0x475b87[_0xb988('0x40')]>0x0){if(moment(_0x2d2018[_0xb988('0x47')])[_0xb988('0x48')](_0x475b87[_0xb988('0x40')],_0xb988('0x49'))>moment()){return _0x4e3e51[_0xb988('0x2e')](0x191)[_0xb988('0x30')]({'message':_0xb988('0x45')});}}else{return _0x4e3e51[_0xb988('0x2e')](0x191)[_0xb988('0x30')]({'message':_0xb988('0x45')});}}_0x1444cb[_0xb988('0x27')]={'id':_0x2d2018['id']};_0x6d6d55();});})['catch'](function(){return _0x4e3e51[_0xb988('0x2e')](0x191)['json']({'message':_0xb988('0x45')});});}catch(_0x326af5){_0x6d6d55(_0x326af5);}}else if(_0x44e177){_0x6d6d55();}else{return _0x4e3e51[_0xb988('0x2e')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})['use'](function(_0x42a862,_0x4e74dc,_0x3aa23e){if(_0x42a862[_0xb988('0x27')]){db['User'][_0xb988('0x37')]({'where':{'id':_0x42a862['user']['id']},'attributes':userAttributes})[_0xb988('0x2d')](function(_0x1d7589){if(!_0x1d7589){return _0x4e74dc['status'](0x194)[_0xb988('0x30')]({'message':_0xb988('0x4a')});}_0x42a862[_0xb988('0x27')]=_0x1d7589;_0x3aa23e();})[_0xb988('0x32')](function(_0x40018a){_0x3aa23e(_0x40018a);});}else if(_0x44e177){_0x3aa23e();}else{return _0x4e74dc[_0xb988('0x2e')](0x194)[_0xb988('0x30')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xb988('0x4b')]=function canUpdate(){return compose()['use'](function(_0x55310f,_0x40f0e1,_0x5cea91){return licenseUtil[_0xb988('0x4c')]()[_0xb988('0x2d')](function(_0x6aa4b3){if(_0x6aa4b3[_0xb988('0x4d')]){_0x5cea91();}else{return _0x40f0e1[_0xb988('0x2e')](0x193)['json']({'message':_0xb988('0x4e')});}})[_0xb988('0x32')](function(_0x203e2){_0x5cea91(_0x203e2);});});};exports[_0xb988('0x4f')]=function(_0x6b901d,_0x23975c,_0x56e3b7){_0x6b901d[_0xb988('0x4f')]=!![];return _0x56e3b7();};exports['signToken']=function signToken(_0x5c4588){return signJwt(_0x5c4588);};exports[_0xb988('0x50')]=function(_0x27368f,_0x5ccd19){if(!_0x27368f[_0xb988('0x27')]){return _0x5ccd19[_0xb988('0x2e')](0x194)[_0xb988('0x30')]({'message':_0xb988('0x51')});}var _0x19cbe6={'payload':{'id':_0x27368f[_0xb988('0x27')]['id'],'role':_0x27368f[_0xb988('0x27')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x19cbe6)[_0xb988('0x2d')](function(_0x44106d){_0x5ccd19[_0xb988('0x52')](_0xb988('0x53'),_0x44106d);_0x5ccd19[_0xb988('0x54')](_0xb988('0x55'));})['catch'](function(_0x44bbd7){return _0x5ccd19[_0xb988('0x2e')](0x1f4)[_0xb988('0x56')](_0x44bbd7);});};exports[_0xb988('0x57')]=function(_0x42d200){if(_[_0xb988('0x58')](_0x42d200['apiKeyNonce'])||_['isNil'](_0x42d200[_0xb988('0x59')])){return null;}else{return createJwt(_0x42d200);}};exports[_0xb988('0x5a')]=function(_0x11c0ba){_0x11c0ba['apiKeyNonce']=generateNonce();_0x11c0ba[_0xb988('0x59')]=generateIssuedAt();return createJwt(_0x11c0ba);};exports['regenerateApiKey']=function(_0x48e493,_0x48f3ff){var _0x5c94d1=_0x48e493[_0xb988('0x3c')][_0xb988('0x3a')];if(_0x5c94d1){var _0x4de21c={'nonce':_0x48f3ff[_0xb988('0x42')],'iat':_0x48f3ff['apiKeyIat'],'audience':hardwareConf[_0xb988('0x3b')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x5c94d1,_0x4de21c)[_0xb988('0x2d')](function(){return generateApiKey(_0x48f3ff);});}else{throw{'message':_0xb988('0x5b')};}};exports[_0xb988('0x5c')]=function(_0x5955b6){var _0x21dd13=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x21dd13['test'](_0x5955b6))throw new db[(_0xb988('0x5d'))][(_0xb988('0x5e'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0xb988('0x5f')]=function(_0x51c76e,_0x5841c0,_0x2c514d){var _0x46e252=encryptor[_0xb988('0x60')](_0x5841c0)[_0xb988('0x61')](',');for(var _0x2b0da1=0x0;_0x2b0da1<_0x2c514d;_0x2b0da1++){if(!_0x46e252[_0x2b0da1])break;if(_0x51c76e[_0xb988('0x62')]()===_0x46e252[_0x2b0da1][_0xb988('0x62')]()){var _0x2138ef=util[_0xb988('0x63')](_0xb988('0x64'),_0x2c514d);if(_0x2c514d===0x1){_0x2138ef=_0xb988('0x65');}throw new db[(_0xb988('0x5d'))][(_0xb988('0x5e'))](_0x2138ef);}}return;};exports[_0xb988('0x66')]=function(_0x96ab6e,_0x38b4db){var _0x4c2688=_0x38b4db?encryptor[_0xb988('0x60')](_0x38b4db)[_0xb988('0x61')](','):[];if(_0x4c2688[_0xb988('0x67')]===0x5){_0x4c2688[_0xb988('0x68')](-0x1,0x1);}_0x4c2688[_0xb988('0x69')](_0x96ab6e);return encryptor[_0xb988('0x6a')](_0x4c2688[_0xb988('0x6b')](','));};function signJwt(_0xa7c29){var _0xed0028=BPromise[_0xb988('0x6c')](jwt[_0xb988('0x6d')],{'context':jwt});var _0x530d8a=_0xa7c29['secret']||config[_0xb988('0x9')][_0xb988('0x6e')];return new BPromise(function(_0x5ccd74,_0x28a86f){_0xed0028(_0xa7c29[_0xb988('0x6f')],_0x530d8a,_0xa7c29[_0xb988('0x70')])[_0xb988('0x2d')](function(_0x13ecd5){_0x5ccd74(_0x13ecd5);})[_0xb988('0x32')](function(_0xfeb5d3){_0x28a86f(_0xfeb5d3);});});}function verifyJwt(_0x437d2a,_0x20f05d,_0x547658){var _0x3df612=BPromise[_0xb988('0x6c')](jwt[_0xb988('0x71')],{'context':jwt});var _0x1efab7=_0x547658||config[_0xb988('0x9')][_0xb988('0x6e')];return new BPromise(function(_0x290407,_0x13b0b5){_0x3df612(_0x437d2a,_0x1efab7,_0x20f05d)['then'](function(_0x1d787c){_0x290407(_0x1d787c);})[_0xb988('0x32')](function(_0x585344){_0x13b0b5(_0x585344);});});}function generateNonce(){return crypto[_0xb988('0x72')](0x10)[_0xb988('0x73')](_0xb988('0x74'));}function generateIssuedAt(){return Math[_0xb988('0x75')](Date[_0xb988('0x76')]()/0x3e8)['toString']();}function createJwt(_0x23264c){var _0x2131a1={'payload':{'iat':_0x23264c[_0xb988('0x59')],'nonce':_0x23264c[_0xb988('0x42')]},'options':{'algorithm':_0xb988('0x77'),'subject':_0x23264c['id']['toString'](),'issuer':hardwareConf[_0xb988('0x3b')](),'audience':hardwareConf[_0xb988('0x3b')]()}};return signJwt(_0x2131a1)[_0xb988('0x2d')](function(_0x853ccd){return{'iat':_0x23264c[_0xb988('0x59')],'nonce':_0x23264c[_0xb988('0x42')],'token':_0x853ccd};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 6bf281b..7b7ac46 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 _0x8ca9=['update','encryptString','secret','utf8','base64','final','crypto','bluebird','../../config/environment','secrets','session','aes-256-ctr','aes192','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','binary','write','end','close','unlink','createDecipher'];(function(_0x406c22,_0x178a8c){var _0x50af16=function(_0x6be99){while(--_0x6be99){_0x406c22['push'](_0x406c22['shift']());}};_0x50af16(++_0x178a8c);}(_0x8ca9,0x9c));var _0x98ca=function(_0x5a7c2c,_0x118769){_0x5a7c2c=_0x5a7c2c-0x0;var _0x5a891e=_0x8ca9[_0x5a7c2c];return _0x5a891e;};'use strict';var crypto=require(_0x98ca('0x0'));var fs=require('fs');var BPromise=require(_0x98ca('0x1'));var config=require(_0x98ca('0x2'));const stringOptions={'secret':config[_0x98ca('0x3')][_0x98ca('0x4')],'algorithm':_0x98ca('0x5')};const fileOptions={'algorithm':_0x98ca('0x6')};function combineOptions(_0x4af83a){var _0x4c230f={};for(var _0x142793 in fileOptions){if(fileOptions['hasOwnProperty'](_0x142793)){_0x4c230f[_0x142793]=fileOptions[_0x142793];}}if(_0x4af83a){for(var _0x442519 in _0x4af83a){if(_0x4af83a['hasOwnProperty'](_0x442519)){_0x4c230f[_0x442519]=_0x4af83a[_0x442519];}}}return _0x4c230f;}exports[_0x98ca('0x7')]=function(_0xca4097,_0x18c349,_0x2852a0,_0x323c95){return new BPromise(function(_0x28a37a,_0x162bd0){_0x323c95=combineOptions(_0x323c95);var _0x210234=new Buffer(_0x2852a0);var _0x277c29=fs[_0x98ca('0x8')](_0xca4097);var _0x572858=fs[_0x98ca('0x9')](_0x18c349);var _0x25b06a=crypto[_0x98ca('0xa')](_0x323c95[_0x98ca('0xb')],_0x210234);_0x277c29['on'](_0x98ca('0xc'),function(_0x276213){var _0x17ee87=new Buffer(_0x25b06a['update'](_0x276213),_0x98ca('0xd'));_0x572858[_0x98ca('0xe')](_0x17ee87);});_0x277c29['on'](_0x98ca('0xf'),function(){try{var _0x472e13=new Buffer(_0x25b06a['final'](_0x98ca('0xd')),_0x98ca('0xd'));_0x572858[_0x98ca('0xe')](_0x472e13);_0x572858[_0x98ca('0xf')]();_0x572858['on'](_0x98ca('0x10'),function(){return _0x28a37a(_0x18c349);});}catch(_0x1f7590){fs[_0x98ca('0x11')](_0x18c349);return _0x162bd0(_0x1f7590);}});});};exports['decryptFile']=function(_0x330713,_0x29df1b,_0x29f46b,_0x398171){return new BPromise(function(_0x52e9c8,_0x238c1a){_0x398171=combineOptions(_0x398171);var _0x3c2f65=new Buffer(_0x29f46b);var _0xe9f8ad=fs[_0x98ca('0x8')](_0x330713);var _0x4523bb=fs[_0x98ca('0x9')](_0x29df1b);var _0x28c8a6=crypto[_0x98ca('0x12')](_0x398171[_0x98ca('0xb')],_0x3c2f65);_0xe9f8ad['on'](_0x98ca('0xc'),function(_0x1b2c69){var _0x4806a3=new Buffer(_0x28c8a6[_0x98ca('0x13')](_0x1b2c69),'binary');_0x4523bb[_0x98ca('0xe')](_0x4806a3);});_0xe9f8ad['on'](_0x98ca('0xf'),function(){try{var _0x50f8b4=new Buffer(_0x28c8a6['final'](_0x98ca('0xd')),_0x98ca('0xd'));_0x4523bb[_0x98ca('0xe')](_0x50f8b4);_0x4523bb['end']();_0x4523bb['on'](_0x98ca('0x10'),function(){return _0x52e9c8(_0x29df1b);});}catch(_0xc23332){fs['unlink'](_0x29df1b);return _0x238c1a(_0xc23332);}});});};exports[_0x98ca('0x14')]=function(_0x5dc400,_0x3fd0bd,_0x323cdb){var _0x430d16=_0x323cdb||stringOptions[_0x98ca('0xb')];var _0x8d669d=_0x3fd0bd||stringOptions[_0x98ca('0x15')];var _0x2a59e3=crypto['createCipher'](_0x430d16,_0x8d669d);var _0x2029cb=_0x2a59e3['update'](_0x5dc400,_0x98ca('0x16'),_0x98ca('0x17'));_0x2029cb+=_0x2a59e3['final'](_0x98ca('0x17'));return _0x2029cb;};exports['decryptString']=function(_0x214649,_0x4f48db,_0x5bf77d){var _0x14bfb4=_0x5bf77d||stringOptions['algorithm'];var _0x342a83=_0x4f48db||stringOptions[_0x98ca('0x15')];var _0x13f766=crypto[_0x98ca('0x12')](_0x14bfb4,_0x342a83);var _0x3b3e60=_0x13f766[_0x98ca('0x13')](_0x214649,_0x98ca('0x17'),_0x98ca('0x16'));_0x3b3e60+=_0x13f766[_0x98ca('0x18')]('utf8');return _0x3b3e60;}; \ No newline at end of file +var _0x5334=['write','end','createWriteStream','createDecipher','final','close','unlink','secret','update','utf8','base64','decryptString','crypto','bluebird','../../config/environment','secrets','session','aes192','encryptFile','createReadStream','createCipher','algorithm','data','binary'];(function(_0x4b9a8d,_0x12b15b){var _0x19c1d1=function(_0x218fde){while(--_0x218fde){_0x4b9a8d['push'](_0x4b9a8d['shift']());}};_0x19c1d1(++_0x12b15b);}(_0x5334,0x84));var _0x4533=function(_0x2b5b07,_0x2f7762){_0x2b5b07=_0x2b5b07-0x0;var _0x46f2ec=_0x5334[_0x2b5b07];return _0x46f2ec;};'use strict';var crypto=require(_0x4533('0x0'));var fs=require('fs');var BPromise=require(_0x4533('0x1'));var config=require(_0x4533('0x2'));const stringOptions={'secret':config[_0x4533('0x3')][_0x4533('0x4')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x4533('0x5')};function combineOptions(_0x5176b5){var _0x42184d={};for(var _0x11ce61 in fileOptions){if(fileOptions['hasOwnProperty'](_0x11ce61)){_0x42184d[_0x11ce61]=fileOptions[_0x11ce61];}}if(_0x5176b5){for(var _0x4a576a in _0x5176b5){if(_0x5176b5['hasOwnProperty'](_0x4a576a)){_0x42184d[_0x4a576a]=_0x5176b5[_0x4a576a];}}}return _0x42184d;}exports[_0x4533('0x6')]=function(_0x4dea06,_0x4d89e7,_0x487906,_0x3fbdc3){return new BPromise(function(_0x42f94b,_0x300877){_0x3fbdc3=combineOptions(_0x3fbdc3);var _0x2489b6=new Buffer(_0x487906);var _0x31018b=fs[_0x4533('0x7')](_0x4dea06);var _0xd417=fs['createWriteStream'](_0x4d89e7);var _0x5533=crypto[_0x4533('0x8')](_0x3fbdc3[_0x4533('0x9')],_0x2489b6);_0x31018b['on'](_0x4533('0xa'),function(_0x5465bf){var _0x7b2420=new Buffer(_0x5533['update'](_0x5465bf),_0x4533('0xb'));_0xd417[_0x4533('0xc')](_0x7b2420);});_0x31018b['on'](_0x4533('0xd'),function(){try{var _0x19b74e=new Buffer(_0x5533['final'](_0x4533('0xb')),_0x4533('0xb'));_0xd417[_0x4533('0xc')](_0x19b74e);_0xd417[_0x4533('0xd')]();_0xd417['on']('close',function(){return _0x42f94b(_0x4d89e7);});}catch(_0xe47213){fs['unlink'](_0x4d89e7);return _0x300877(_0xe47213);}});});};exports['decryptFile']=function(_0x466545,_0x34dea9,_0x5da8b8,_0x30c68c){return new BPromise(function(_0x1e6a1a,_0x2a9877){_0x30c68c=combineOptions(_0x30c68c);var _0x551b0d=new Buffer(_0x5da8b8);var _0x3ed873=fs['createReadStream'](_0x466545);var _0x3ddb36=fs[_0x4533('0xe')](_0x34dea9);var _0x56ab4f=crypto[_0x4533('0xf')](_0x30c68c['algorithm'],_0x551b0d);_0x3ed873['on']('data',function(_0x1c5cdd){var _0x9740a6=new Buffer(_0x56ab4f['update'](_0x1c5cdd),'binary');_0x3ddb36[_0x4533('0xc')](_0x9740a6);});_0x3ed873['on'](_0x4533('0xd'),function(){try{var _0x3467ba=new Buffer(_0x56ab4f[_0x4533('0x10')](_0x4533('0xb')),_0x4533('0xb'));_0x3ddb36[_0x4533('0xc')](_0x3467ba);_0x3ddb36['end']();_0x3ddb36['on'](_0x4533('0x11'),function(){return _0x1e6a1a(_0x34dea9);});}catch(_0xd55c04){fs[_0x4533('0x12')](_0x34dea9);return _0x2a9877(_0xd55c04);}});});};exports['encryptString']=function(_0x513011,_0x138fd9,_0x11e93a){var _0x4c640c=_0x11e93a||stringOptions['algorithm'];var _0x307bdd=_0x138fd9||stringOptions[_0x4533('0x13')];var _0xfd9409=crypto['createCipher'](_0x4c640c,_0x307bdd);var _0x44786f=_0xfd9409[_0x4533('0x14')](_0x513011,_0x4533('0x15'),_0x4533('0x16'));_0x44786f+=_0xfd9409[_0x4533('0x10')](_0x4533('0x16'));return _0x44786f;};exports[_0x4533('0x17')]=function(_0x27b653,_0x45ad98,_0x5f16bb){var _0x5c1e24=_0x5f16bb||stringOptions[_0x4533('0x9')];var _0x5aaf2d=_0x45ad98||stringOptions[_0x4533('0x13')];var _0x4e2b80=crypto[_0x4533('0xf')](_0x5c1e24,_0x5aaf2d);var _0x42ba2d=_0x4e2b80[_0x4533('0x14')](_0x27b653,_0x4533('0x16'),_0x4533('0x15'));_0x42ba2d+=_0x4e2b80[_0x4533('0x10')](_0x4533('0x15'));return _0x42ba2d;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 8045a11..6758eb1 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 _0x2750=['.csv','split','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','inspect','util','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','Empty','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT'];(function(_0x55ef8b,_0x5deb5e){var _0x359c84=function(_0x437673){while(--_0x437673){_0x55ef8b['push'](_0x55ef8b['shift']());}};_0x359c84(++_0x5deb5e);}(_0x2750,0x13b));var _0x0275=function(_0x2b1a4d,_0x4752cd){_0x2b1a4d=_0x2b1a4d-0x0;var _0x402a50=_0x2750[_0x2b1a4d];return _0x402a50;};'use strict';var util=require(_0x0275('0x0'));var path=require('path');var _=require(_0x0275('0x1'));var csv=require(_0x0275('0x2'));var fs=require('fs');var BPromise=require(_0x0275('0x3'));var zipdir=require(_0x0275('0x4'));var rimraf=require(_0x0275('0x5'));var db=require(_0x0275('0x6'))['db'];var dbH=require(_0x0275('0x6'))[_0x0275('0x7')];var logger=require(_0x0275('0x8'))(_0x0275('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x0275('0xa')][0x3];var PATH=process[_0x0275('0xa')][0x4];function analyticExtractedReport(_0x2fa0eb,_0x2e4b5c){var _0x4dffd1={'status':_0x2fa0eb};var _0x1f7c4a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2e4b5c){_0x4dffd1[_0x0275('0xb')]=_0x2e4b5c;}return db[_0x0275('0xc')]['update'](_0x4dffd1,_0x1f7c4a);}function main(){var _0x5ae225=0x1388;var _0x224e0f;logger['info'](util[_0x0275('0xd')](_0x0275('0xe'),EXTRACTED_REPORT_ID,_0x0275('0xf')));return db[_0x0275('0x10')][_0x0275('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x0275('0x12')]})[_0x0275('0x13')](function(_0x1f128d){if(_0x1f128d){_0x224e0f=_0x1f128d;_0x5ae225=_0x224e0f['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0x0275('0x14')][_0x0275('0x15')](util[_0x0275('0xd')](_0x0275('0x16'),QUERY),{'type':dbH[_0x0275('0x14')][_0x0275('0x17')]['SELECT']});})[_0x0275('0x13')](function(_0x3030c0){if(!_0x3030c0[0x0]['num']){return analyticExtractedReport(_0x0275('0x18'));}var _0xaae367=[];var _0x4a40da=0x0;var _0x10dd2c=!![];if(_0x3030c0&&_0x3030c0[_0x0275('0x19')]){var _0x4a5578=_0x3030c0[0x0]['num']%(_0x4a40da+_0x5ae225);if(_0x224e0f['split']){for(;_0x10dd2c;_0x4a40da+=_0x5ae225,_0x4a5578=_0x3030c0[0x0]['num']%(_0x4a40da+_0x5ae225)){if(_0x4a5578==0x0||_0x4a5578==_0x3030c0[0x0]['num']){_0x10dd2c=![];}_0xaae367[_0x0275('0x1a')](dbH[_0x0275('0x14')][_0x0275('0x15')](util['format'](_0x0275('0x1b'),QUERY,_0x5ae225,_0x4a40da),{'type':dbH[_0x0275('0x14')][_0x0275('0x17')]['SELECT']}));}}else{_0xaae367[_0x0275('0x1a')](dbH[_0x0275('0x14')]['query'](QUERY,{'type':dbH['sequelize'][_0x0275('0x17')][_0x0275('0x1c')]}));}}var _0x562c82=path['dirname'](PATH);var _0xf3b68e=path['basename'](PATH,_0x0275('0x1d'));var _0x5c75f1=_0x224e0f[_0x0275('0x1e')]&&_0xaae367[_0x0275('0x19')]>0x1;var _0x594321=[];if(!fs[_0x0275('0x1f')](path[_0x0275('0x20')](_0x562c82,_0xf3b68e))&&_0x5c75f1){fs[_0x0275('0x21')](path['join'](_0x562c82,_0xf3b68e));}return BPromise[_0x0275('0x22')](_0xaae367,function(_0x44bbf8){_0x594321[_0x0275('0x1a')](_0x44bbf8);})[_0x0275('0x13')](function(){for(var _0x1a2024=0x0;_0x1a2024<_0x594321[_0x0275('0x19')];_0x1a2024+=0x1){var _0x56f26c;var _0x35343c=_0x594321[_0x1a2024];if(_0x5c75f1){_0x56f26c=path[_0x0275('0x20')](_0x562c82,_0xf3b68e,util[_0x0275('0xd')](_0x0275('0x23'),_0xf3b68e,_0x1a2024,_0x0275('0x24')));}else{_0x56f26c=path['join'](_0x562c82,util[_0x0275('0xd')](_0x0275('0x25'),_0xf3b68e,_0x0275('0x24')));}fs[_0x0275('0x26')](_0x56f26c,csv(_0x35343c));}})[_0x0275('0x13')](function(){if(_0x5c75f1){zipdir(path['join'](_0x562c82,_0xf3b68e),{'saveTo':path[_0x0275('0x20')](_0x562c82,util[_0x0275('0xd')](_0x0275('0x25'),_0xf3b68e,'zip'))},function(_0x5e2e22,_0x3cb2d7){});rimraf(path[_0x0275('0x20')](_0x562c82,_0xf3b68e),function(){});}})['then'](function(){logger[_0x0275('0x27')](util[_0x0275('0xd')](_0x0275('0x28'),EXTRACTED_REPORT_ID,_0x0275('0xf')));return analyticExtractedReport('Completed',_0x5c75f1?util[_0x0275('0xd')](_0x0275('0x25'),_0xf3b68e,_0x5c75f1?_0x0275('0x29'):_0x0275('0x24')):null);});})['catch'](function(_0x134f12){logger['info'](util[_0x0275('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x0275('0xf')),util[_0x0275('0x2a')](_0x134f12,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0x5636=['mkdirSync','csv','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','num','%s\x20limit\x20%d\x20OFFSET\x20%d','push','.csv','join'];(function(_0x2478df,_0x4f96ed){var _0x396975=function(_0x1497bb){while(--_0x1497bb){_0x2478df['push'](_0x2478df['shift']());}};_0x396975(++_0x4f96ed);}(_0x5636,0x102));var _0x6563=function(_0x2e3919,_0x2f9b84){_0x2e3919=_0x2e3919-0x0;var _0x43c861=_0x5636[_0x2e3919];return _0x43c861;};'use strict';var util=require(_0x6563('0x0'));var path=require(_0x6563('0x1'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x6563('0x2'));var rimraf=require(_0x6563('0x3'));var db=require(_0x6563('0x4'))['db'];var dbH=require('../../mysqldb')[_0x6563('0x5')];var logger=require(_0x6563('0x6'))(_0x6563('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x6563('0x8')][0x2]);var QUERY=process[_0x6563('0x8')][0x3];var PATH=process[_0x6563('0x8')][0x4];function analyticExtractedReport(_0x9884a9,_0x2d57d5){var _0x2d0d5b={'status':_0x9884a9};var _0x98fcd4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2d57d5){_0x2d0d5b[_0x6563('0x9')]=_0x2d57d5;}return db[_0x6563('0xa')][_0x6563('0xb')](_0x2d0d5b,_0x98fcd4);}function main(){var _0x516d1a=0x1388;var _0x51fdc2;logger[_0x6563('0xc')](util[_0x6563('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0x6563('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6563('0xf'),_0x6563('0x10')]})[_0x6563('0x11')](function(_0x33816e){if(_0x33816e){_0x51fdc2=_0x33816e;_0x516d1a=_0x51fdc2[_0x6563('0x10')]||0x1388;}})[_0x6563('0x11')](function(){return dbH[_0x6563('0x12')][_0x6563('0x13')](util['format'](_0x6563('0x14'),QUERY),{'type':dbH['sequelize'][_0x6563('0x15')][_0x6563('0x16')]});})[_0x6563('0x11')](function(_0x10d08c){if(!_0x10d08c[0x0]['num']){return analyticExtractedReport(_0x6563('0x17'));}var _0x11baa2=[];var _0x477d9b=0x0;var _0xd398ce=!![];if(_0x10d08c&&_0x10d08c['length']){var _0x3563fd=_0x10d08c[0x0]['num']%(_0x477d9b+_0x516d1a);if(_0x51fdc2['split']){for(;_0xd398ce;_0x477d9b+=_0x516d1a,_0x3563fd=_0x10d08c[0x0]['num']%(_0x477d9b+_0x516d1a)){if(_0x3563fd==0x0||_0x3563fd==_0x10d08c[0x0][_0x6563('0x18')]){_0xd398ce=![];}_0x11baa2['push'](dbH['sequelize'][_0x6563('0x13')](util[_0x6563('0xd')](_0x6563('0x19'),QUERY,_0x516d1a,_0x477d9b),{'type':dbH[_0x6563('0x12')][_0x6563('0x15')][_0x6563('0x16')]}));}}else{_0x11baa2[_0x6563('0x1a')](dbH[_0x6563('0x12')][_0x6563('0x13')](QUERY,{'type':dbH['sequelize'][_0x6563('0x15')][_0x6563('0x16')]}));}}var _0x20b478=path['dirname'](PATH);var _0x293db2=path['basename'](PATH,_0x6563('0x1b'));var _0x105379=_0x51fdc2['split']&&_0x11baa2['length']>0x1;var _0x3ab7f6=[];if(!fs['existsSync'](path[_0x6563('0x1c')](_0x20b478,_0x293db2))&&_0x105379){fs[_0x6563('0x1d')](path[_0x6563('0x1c')](_0x20b478,_0x293db2));}return BPromise['each'](_0x11baa2,function(_0xd860d5){_0x3ab7f6['push'](_0xd860d5);})[_0x6563('0x11')](function(){for(var _0x1590e6=0x0;_0x1590e6<_0x3ab7f6['length'];_0x1590e6+=0x1){var _0x365b16;var _0x28252d=_0x3ab7f6[_0x1590e6];if(_0x105379){_0x365b16=path['join'](_0x20b478,_0x293db2,util[_0x6563('0xd')]('%s%d.%s',_0x293db2,_0x1590e6,_0x6563('0x1e')));}else{_0x365b16=path['join'](_0x20b478,util['format'](_0x6563('0x1f'),_0x293db2,_0x6563('0x1e')));}fs[_0x6563('0x20')](_0x365b16,csv(_0x28252d));}})[_0x6563('0x11')](function(){if(_0x105379){zipdir(path[_0x6563('0x1c')](_0x20b478,_0x293db2),{'saveTo':path['join'](_0x20b478,util[_0x6563('0xd')]('%s.%s',_0x293db2,'zip'))},function(_0x3582c9,_0x35af37){});rimraf(path[_0x6563('0x1c')](_0x20b478,_0x293db2),function(){});}})[_0x6563('0x11')](function(){logger[_0x6563('0xc')](util[_0x6563('0xd')](_0x6563('0x21'),EXTRACTED_REPORT_ID,_0x6563('0x22')));return analyticExtractedReport(_0x6563('0x23'),_0x105379?util[_0x6563('0xd')]('%s.%s',_0x293db2,_0x105379?_0x6563('0x24'):_0x6563('0x1e')):null);});})[_0x6563('0x25')](function(_0x1558fb){logger[_0x6563('0xc')](util[_0x6563('0xd')](_0x6563('0x26'),EXTRACTED_REPORT_ID,'CSV'),util[_0x6563('0x27')](_0x1558fb,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x6563('0x28'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 7003885..fe4c044 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 _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0x512433,_0x2c9a01){var _0x6ea5ad=function(_0x252457){while(--_0x252457){_0x512433['push'](_0x512433['shift']());}};_0x6ea5ad(++_0x2c9a01);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file +var _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0x19e923,_0x2c63e1){var _0x3e9a29=function(_0x46f59a){while(--_0x46f59a){_0x19e923['push'](_0x19e923['shift']());}};_0x3e9a29(++_0x2c63e1);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 923ee67..61af2c3 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 _0x2317=['zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','push','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','.xlsx','existsSync','join','each','%s%d.%s','xlsx','%s.%s','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','path','lodash','bluebird'];(function(_0x3cfabc,_0x3689e1){var _0x320094=function(_0x5210c6){while(--_0x5210c6){_0x3cfabc['push'](_0x3cfabc['shift']());}};_0x320094(++_0x3689e1);}(_0x2317,0x16d));var _0x7231=function(_0x112e83,_0x647026){_0x112e83=_0x112e83-0x0;var _0x4bdd5a=_0x2317[_0x112e83];return _0x4bdd5a;};'use strict';var util=require('util');var path=require(_0x7231('0x0'));var _=require(_0x7231('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x7231('0x2'));var zipdir=require(_0x7231('0x3'));var rimraf=require(_0x7231('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0x7231('0x5'))['dbH'];var logger=require(_0x7231('0x6'))(_0x7231('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x7231('0x8')][0x3];var PATH=process[_0x7231('0x8')][0x4];function analyticExtractedReport(_0x7dbdc1,_0x5417ee){var _0x5c7b27={'status':_0x7dbdc1};var _0x447c33={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5417ee){_0x5c7b27[_0x7231('0x9')]=_0x5417ee;}return db[_0x7231('0xa')][_0x7231('0xb')](_0x5c7b27,_0x447c33);}function main(){var _0x5d2135=0x1388;var _0x3c5e23;logger[_0x7231('0xc')](util['format'](_0x7231('0xd'),EXTRACTED_REPORT_ID,_0x7231('0xe')));return db[_0x7231('0xf')][_0x7231('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7231('0x11'),_0x7231('0x12')]})[_0x7231('0x13')](function(_0x4e6e16){if(_0x4e6e16){_0x3c5e23=_0x4e6e16;_0x5d2135=_0x3c5e23[_0x7231('0x12')]||0x1388;}})[_0x7231('0x13')](function(){return dbH['sequelize']['query'](util[_0x7231('0x14')](_0x7231('0x15'),QUERY),{'type':dbH['sequelize'][_0x7231('0x16')][_0x7231('0x17')]});})[_0x7231('0x13')](function(_0x5a2baa){if(!_0x5a2baa[0x0][_0x7231('0x18')]){return analyticExtractedReport(_0x7231('0x19'));}var _0x4a84b3=[];var _0x1681ea=0x0;var _0x44d082=!![];if(_0x3c5e23['split']){if(_0x5a2baa&&_0x5a2baa[_0x7231('0x1a')]){var _0x3fd9d2=_0x5a2baa[0x0][_0x7231('0x18')]%(_0x1681ea+_0x5d2135);for(;_0x44d082;_0x1681ea+=_0x5d2135,_0x3fd9d2=_0x5a2baa[0x0][_0x7231('0x18')]%(_0x1681ea+_0x5d2135)){if(_0x3fd9d2==0x0||_0x3fd9d2==_0x5a2baa[0x0][_0x7231('0x18')]){_0x44d082=![];}_0x4a84b3[_0x7231('0x1b')](dbH[_0x7231('0x1c')][_0x7231('0x1d')](util[_0x7231('0x14')](_0x7231('0x1e'),QUERY,_0x5d2135,_0x1681ea),{'type':dbH['sequelize'][_0x7231('0x16')]['SELECT']}));}}}else{_0x4a84b3[_0x7231('0x1b')](dbH[_0x7231('0x1c')][_0x7231('0x1d')](QUERY,{'type':dbH[_0x7231('0x1c')][_0x7231('0x16')][_0x7231('0x17')]}));}var _0x3f9278=path['dirname'](PATH);var _0x5ebd00=path['basename'](PATH,_0x7231('0x1f'));var _0x412f57=_0x3c5e23[_0x7231('0x11')]&&_0x4a84b3['length']>0x1;var _0x4984e0=[];if(!fs[_0x7231('0x20')](path[_0x7231('0x21')](_0x3f9278,_0x5ebd00))&&_0x412f57){fs['mkdirSync'](path[_0x7231('0x21')](_0x3f9278,_0x5ebd00));}return BPromise[_0x7231('0x22')](_0x4a84b3,function(_0x5a1054){_0x4984e0[_0x7231('0x1b')](_0x5a1054);})[_0x7231('0x13')](function(){for(var _0x1005e4=0x0;_0x1005e4<_0x4984e0[_0x7231('0x1a')];_0x1005e4+=0x1){var _0x43e4c0;var _0x8172d2=_0x4984e0[_0x1005e4];if(_0x412f57){_0x43e4c0=path[_0x7231('0x21')](_0x3f9278,_0x5ebd00,util['format'](_0x7231('0x23'),_0x5ebd00,_0x1005e4,_0x7231('0x24')));}else{_0x43e4c0=path[_0x7231('0x21')](_0x3f9278,util[_0x7231('0x14')](_0x7231('0x25'),_0x5ebd00,_0x7231('0x24')));}fs['writeFileSync'](_0x43e4c0,json2xls(_0x8172d2),_0x7231('0x26'));}})['then'](function(){if(_0x412f57){zipdir(path[_0x7231('0x21')](_0x3f9278,_0x5ebd00),{'saveTo':path[_0x7231('0x21')](_0x3f9278,util[_0x7231('0x14')](_0x7231('0x25'),_0x5ebd00,_0x7231('0x27')))},function(_0x3dd8f4,_0x159a5f){});rimraf(path['join'](_0x3f9278,_0x5ebd00),function(){});}})[_0x7231('0x13')](function(){logger[_0x7231('0xc')](util[_0x7231('0x14')](_0x7231('0x28'),EXTRACTED_REPORT_ID,_0x7231('0xe')));return analyticExtractedReport(_0x7231('0x29'),_0x412f57?util[_0x7231('0x14')]('%s.%s',_0x5ebd00,_0x412f57?_0x7231('0x27'):_0x7231('0x24')):null);});})[_0x7231('0x2a')](function(_0x133845){logger[_0x7231('0xc')](util['format'](_0x7231('0x2b'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x7231('0x2c')](_0x133845,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x7231('0x2d'));});}main(); \ No newline at end of file +var _0x1261=['%s.%s','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','inspect','Failed','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','splitSizeXlsx','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','Empty','split','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','.xlsx','length','mkdirSync','join','each','xlsx','writeFileSync'];(function(_0xeb3a70,_0x37fdd7){var _0x1e34db=function(_0x2b269a){while(--_0x2b269a){_0xeb3a70['push'](_0xeb3a70['shift']());}};_0x1e34db(++_0x37fdd7);}(_0x1261,0x144));var _0x1126=function(_0xd67723,_0x1e576f){_0xd67723=_0xd67723-0x0;var _0x53b62b=_0x1261[_0xd67723];return _0x53b62b;};'use strict';var util=require('util');var path=require(_0x1126('0x0'));var _=require(_0x1126('0x1'));var fs=require('fs');var json2xls=require(_0x1126('0x2'));var BPromise=require(_0x1126('0x3'));var zipdir=require(_0x1126('0x4'));var rimraf=require(_0x1126('0x5'));var db=require(_0x1126('0x6'))['db'];var dbH=require(_0x1126('0x6'))[_0x1126('0x7')];var logger=require(_0x1126('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x1126('0x9')][0x3];var PATH=process[_0x1126('0x9')][0x4];function analyticExtractedReport(_0x4f239c,_0x17e5f0){var _0x28772d={'status':_0x4f239c};var _0x245be9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x17e5f0){_0x28772d[_0x1126('0xa')]=_0x17e5f0;}return db[_0x1126('0xb')]['update'](_0x28772d,_0x245be9);}function main(){var _0x3f09ac=0x1388;var _0x18dbe6;logger[_0x1126('0xc')](util['format'](_0x1126('0xd'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting'][_0x1126('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x1126('0xf')]})[_0x1126('0x10')](function(_0xd26a32){if(_0xd26a32){_0x18dbe6=_0xd26a32;_0x3f09ac=_0x18dbe6[_0x1126('0xf')]||0x1388;}})[_0x1126('0x10')](function(){return dbH[_0x1126('0x11')][_0x1126('0x12')](util[_0x1126('0x13')](_0x1126('0x14'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x1126('0x15')]});})[_0x1126('0x10')](function(_0x279455){if(!_0x279455[0x0]['num']){return analyticExtractedReport(_0x1126('0x16'));}var _0x4794a7=[];var _0x35fe9f=0x0;var _0x42f379=!![];if(_0x18dbe6[_0x1126('0x17')]){if(_0x279455&&_0x279455['length']){var _0x245cd7=_0x279455[0x0][_0x1126('0x18')]%(_0x35fe9f+_0x3f09ac);for(;_0x42f379;_0x35fe9f+=_0x3f09ac,_0x245cd7=_0x279455[0x0]['num']%(_0x35fe9f+_0x3f09ac)){if(_0x245cd7==0x0||_0x245cd7==_0x279455[0x0]['num']){_0x42f379=![];}_0x4794a7[_0x1126('0x19')](dbH[_0x1126('0x11')]['query'](util['format'](_0x1126('0x1a'),QUERY,_0x3f09ac,_0x35fe9f),{'type':dbH['sequelize'][_0x1126('0x1b')][_0x1126('0x15')]}));}}}else{_0x4794a7[_0x1126('0x19')](dbH['sequelize'][_0x1126('0x12')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x1126('0x15')]}));}var _0x3a9bed=path[_0x1126('0x1c')](PATH);var _0x36d254=path['basename'](PATH,_0x1126('0x1d'));var _0x477e6a=_0x18dbe6['split']&&_0x4794a7[_0x1126('0x1e')]>0x1;var _0x59cd8e=[];if(!fs['existsSync'](path['join'](_0x3a9bed,_0x36d254))&&_0x477e6a){fs[_0x1126('0x1f')](path[_0x1126('0x20')](_0x3a9bed,_0x36d254));}return BPromise[_0x1126('0x21')](_0x4794a7,function(_0x34bcf1){_0x59cd8e[_0x1126('0x19')](_0x34bcf1);})[_0x1126('0x10')](function(){for(var _0xea0971=0x0;_0xea0971<_0x59cd8e[_0x1126('0x1e')];_0xea0971+=0x1){var _0x589725;var _0x35eec3=_0x59cd8e[_0xea0971];if(_0x477e6a){_0x589725=path[_0x1126('0x20')](_0x3a9bed,_0x36d254,util[_0x1126('0x13')]('%s%d.%s',_0x36d254,_0xea0971,'xlsx'));}else{_0x589725=path[_0x1126('0x20')](_0x3a9bed,util[_0x1126('0x13')]('%s.%s',_0x36d254,_0x1126('0x22')));}fs[_0x1126('0x23')](_0x589725,json2xls(_0x35eec3),'binary');}})[_0x1126('0x10')](function(){if(_0x477e6a){zipdir(path['join'](_0x3a9bed,_0x36d254),{'saveTo':path[_0x1126('0x20')](_0x3a9bed,util['format'](_0x1126('0x24'),_0x36d254,'zip'))},function(_0x378f4d,_0x5f2611){});rimraf(path['join'](_0x3a9bed,_0x36d254),function(){});}})['then'](function(){logger[_0x1126('0xc')](util[_0x1126('0x13')](_0x1126('0x25'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x1126('0x26'),_0x477e6a?util[_0x1126('0x13')]('%s.%s',_0x36d254,_0x477e6a?_0x1126('0x27'):_0x1126('0x22')):null);});})[_0x1126('0x28')](function(_0x29fbfa){logger['info'](util['format'](_0x1126('0x29'),EXTRACTED_REPORT_ID,_0x1126('0x2a')),util[_0x1126('0x2b')](_0x29fbfa,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x1126('0x2c'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 8a83d1d..c007970 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 _0xf79b=['$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','destroy','bulkCreate','sortBy','catch','error','rewrite','util','models','Interval','then','intervals','VoiceExtension','findAll','IntervalId','uniq','exten','filter','groupBy','queue','playback','hasOwnProperty','priority','extension','find','extensions','Set','CDR(type)=%s','type','context','VoiceExtensionId','push','CDR(destination)=','cutdigits','${EXTEN:','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','map','tag','CDR(tag)=','outbound','callerID','ExecIf'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf79b,0xa0));var _0xbf79=function(_0x514333,_0x419d86){_0x514333=_0x514333-0x0;var _0x1cc03b=_0xf79b[_0x514333];return _0x1cc03b;};'use strict';var _=require('lodash');var util=require(_0xbf79('0x0'));function rewrite(_0x15d780,_0x5389ed){var _0x1426f5=this;return _0x15d780[_0xbf79('0x1')][_0xbf79('0x2')]['findAll']({'raw':!![]})[_0xbf79('0x3')](function(_0x3ef1bb){_0x1426f5[_0xbf79('0x4')]=_0x3ef1bb;return _0x15d780[_0xbf79('0x1')][_0xbf79('0x5')][_0xbf79('0x6')]({'where':{'IntervalId':_0x5389ed[_0xbf79('0x7')]},'raw':!![]});})[_0xbf79('0x3')](function(_0x4b7deb){return _0x15d780[_0xbf79('0x1')][_0xbf79('0x5')]['findAll']({'where':{'exten':{'$in':_[_0xbf79('0x8')](_['map'](_0x4b7deb,_0xbf79('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xbf79('0x3')](function(_0x53ca23){var _0x484dae=_[_0xbf79('0xa')](_0x53ca23,{'priority':'1'});var _0x30f8cf=_[_0xbf79('0xa')](_0x53ca23,{'isApp':0x1});var _0x25a617=_[_0xbf79('0xb')](_0x30f8cf,_0xbf79('0x9'));var _0x27ac2e=[_0xbf79('0xc'),_0xbf79('0xd')];var _0xa36c06=[];var _0x1eb9ef=[];for(var _0x97f300 in _0x25a617){if(_0x25a617[_0xbf79('0xe')](_0x97f300)){_0x1426f5[_0xbf79('0xf')]=0x2;_0x1426f5['extensions']=[];_0x1426f5[_0xbf79('0x10')]=_[_0xbf79('0x11')](_0x484dae,{'exten':_0x25a617[_0x97f300][0x0][_0xbf79('0x9')]});_0x1426f5[_0xbf79('0x12')]['push']({'type':_0x25a617[_0x97f300][0x0]['type'],'app':_0xbf79('0x13'),'appdata':util['format'](_0xbf79('0x14'),_0x25a617[_0x97f300][0x0][_0xbf79('0x15')]),'context':_0x25a617[_0x97f300][0x0][_0xbf79('0x16')],'exten':_0x25a617[_0x97f300][0x0]['exten'],'priority':_0x1426f5[_0xbf79('0xf')]++,'VoiceExtensionId':_0x25a617[_0x97f300][0x0][_0xbf79('0x17')]});if(_0x25a617[_0x97f300][0x0][_0xbf79('0x15')]==='outbound'){if(_0x1426f5[_0xbf79('0x10')]){_0x1426f5[_0xbf79('0x12')][_0xbf79('0x18')]({'type':_0x25a617[_0x97f300][0x0][_0xbf79('0x15')],'app':_0xbf79('0x13'),'appdata':_0xbf79('0x19')+(_0x1426f5[_0xbf79('0x10')][_0xbf79('0x1a')]?_0xbf79('0x1b')+_0x1426f5[_0xbf79('0x10')][_0xbf79('0x1a')]+'}':'${EXTEN}'),'context':_0x25a617[_0x97f300][0x0][_0xbf79('0x16')],'exten':_0x25a617[_0x97f300][0x0][_0xbf79('0x9')],'priority':_0x1426f5[_0xbf79('0xf')]++,'VoiceExtensionId':_0x25a617[_0x97f300][0x0]['VoiceExtensionId']});}_0x1426f5['extensions'][_0xbf79('0x18')]({'type':_0x25a617[_0x97f300][0x0][_0xbf79('0x15')],'app':'Set','appdata':'CDR(routeid)='+_0x25a617[_0x97f300][0x0][_0xbf79('0x17')],'context':_0x25a617[_0x97f300][0x0]['context'],'exten':_0x25a617[_0x97f300][0x0][_0xbf79('0x9')],'priority':_0x1426f5[_0xbf79('0xf')]++,'VoiceExtensionId':_0x25a617[_0x97f300][0x0][_0xbf79('0x17')]});var _0x143e96=_0x1426f5[_0xbf79('0xf')]++;_0x1426f5['extensions'][_0xbf79('0x18')]({'type':_0x25a617[_0x97f300][0x0]['type'],'app':'ExecIf','appdata':_0xbf79('0x1c')+(_0x143e96+0x2)+'):Goto('+(_0x143e96+0x1)+')','context':_0x25a617[_0x97f300][0x0][_0xbf79('0x16')],'exten':_0x25a617[_0x97f300][0x0][_0xbf79('0x9')],'priority':_0x143e96,'VoiceExtensionId':_0x25a617[_0x97f300][0x0]['VoiceExtensionId']});if(_0x1426f5[_0xbf79('0x10')]){_0x1426f5['extensions'][_0xbf79('0x18')]({'type':_0x25a617[_0x97f300][0x0][_0xbf79('0x15')],'app':_0xbf79('0x13'),'appdata':_0x1426f5[_0xbf79('0x10')][_0xbf79('0x1a')]?'CDR(prefix)=${EXTEN:0:'+_0x1426f5['extension'][_0xbf79('0x1a')]+'}':_0xbf79('0x1d'),'context':_0x25a617[_0x97f300][0x0][_0xbf79('0x16')],'exten':_0x25a617[_0x97f300][0x0]['exten'],'priority':_0x1426f5['priority']++,'VoiceExtensionId':_0x25a617[_0x97f300][0x0][_0xbf79('0x17')]});}_0x1426f5[_0xbf79('0x12')][_0xbf79('0x18')]({'type':_0x25a617[_0x97f300][0x0][_0xbf79('0x15')],'app':_0xbf79('0x13'),'appdata':_0xbf79('0x1e')+_0x25a617[_0x97f300][0x0][_0xbf79('0x17')],'context':_0x25a617[_0x97f300][0x0][_0xbf79('0x16')],'exten':_0x25a617[_0x97f300][0x0][_0xbf79('0x9')],'priority':_0x1426f5[_0xbf79('0xf')]++,'VoiceExtensionId':_0x25a617[_0x97f300][0x0][_0xbf79('0x17')]});if(_0x1426f5[_0xbf79('0x10')]&&_0x1426f5[_0xbf79('0x10')][_0xbf79('0xe')](_0xbf79('0x1f'))&&_0x1426f5[_0xbf79('0x10')][_0xbf79('0x1f')]!==_0xbf79('0x20')){_0x1426f5[_0xbf79('0x12')][_0xbf79('0x18')]({'type':_0x25a617[_0x97f300][0x0][_0xbf79('0x15')],'app':_0xbf79('0x13'),'appdata':_0xbf79('0x21'),'context':_0x25a617[_0x97f300][0x0]['context'],'exten':_0x25a617[_0x97f300][0x0][_0xbf79('0x9')],'priority':_0x1426f5[_0xbf79('0xf')]++,'VoiceExtensionId':_0x25a617[_0x97f300][0x0][_0xbf79('0x17')]});_0x1426f5[_0xbf79('0x12')][_0xbf79('0x18')]({'type':_0x25a617[_0x97f300][0x0][_0xbf79('0x15')],'app':_0xbf79('0x13'),'appdata':_0xbf79('0x22')+_0x1426f5['extension'][_0xbf79('0x1f')]||_0xbf79('0x23'),'context':_0x25a617[_0x97f300][0x0]['context'],'exten':_0x25a617[_0x97f300][0x0]['exten'],'priority':_0x1426f5['priority']++,'VoiceExtensionId':_0x25a617[_0x97f300][0x0][_0xbf79('0x17')]});}}_0x1426f5[_0xbf79('0x12')]['push']({'type':_0x25a617[_0x97f300][0x0]['type'],'app':_0xbf79('0x13'),'appdata':_0xbf79('0x24'),'context':_0x25a617[_0x97f300][0x0][_0xbf79('0x16')],'exten':_0x25a617[_0x97f300][0x0][_0xbf79('0x9')],'priority':_0x1426f5[_0xbf79('0xf')]++,'VoiceExtensionId':_0x25a617[_0x97f300][0x0]['VoiceExtensionId']});_0x1426f5[_0xbf79('0x12')][_0xbf79('0x18')]({'type':_0x25a617[_0x97f300][0x0]['type'],'app':_0xbf79('0x13'),'appdata':_0xbf79('0x25'),'context':_0x25a617[_0x97f300][0x0]['context'],'exten':_0x25a617[_0x97f300][0x0][_0xbf79('0x9')],'priority':_0x1426f5[_0xbf79('0xf')]++,'VoiceExtensionId':_0x25a617[_0x97f300][0x0]['VoiceExtensionId']});_0x1426f5['extensions'][_0xbf79('0x18')]({'type':_0x25a617[_0x97f300][0x0]['type'],'app':'Set','appdata':_0xbf79('0x26'),'context':_0x25a617[_0x97f300][0x0][_0xbf79('0x16')],'exten':_0x25a617[_0x97f300][0x0]['exten'],'priority':_0x1426f5[_0xbf79('0xf')]++,'VoiceExtensionId':_0x25a617[_0x97f300][0x0][_0xbf79('0x17')]});for(var _0x5565d3=0x0,_0x456d2b=0x0;_0x5565d3<_0x25a617[_0x97f300][_0xbf79('0x27')];_0x5565d3+=0x1,_0x456d2b=0x0){var _0x3e6eff=_0x25a617[_0x97f300][_0x5565d3];if(_0x3e6eff[_0xbf79('0x15')]){_0x3e6eff[_0xbf79('0x15')]=_0x3e6eff[_0xbf79('0x15')][_0xbf79('0x28')]();}var _0x3dc392=[];var _0x3d8934=[];delete _0x3e6eff['id'];delete _0x3e6eff[_0xbf79('0x29')];delete _0x3e6eff[_0xbf79('0x2a')];var _0xe8a4f7=_0x3e6eff[_0xbf79('0x2b')]!=='*,*,*,*'?[_0x3e6eff[_0xbf79('0x2b')]]:_0x3e6eff[_0xbf79('0x7')]?_[_0xbf79('0x2c')](_[_0xbf79('0xa')](_0x1426f5[_0xbf79('0x4')],{'IntervalId':_0x3e6eff[_0xbf79('0x7')]}),_0xbf79('0x2b')):[];if(_0x3e6eff['hasOwnProperty'](_0xbf79('0x2d'))){if(_0x3e6eff['tag']&&_0x3e6eff['tag']!=='--'){_0x3dc392[_0xbf79('0x18')]({'type':_0x3e6eff[_0xbf79('0x15')],'app':_0xbf79('0x13'),'appdata':_0xbf79('0x2e')+_0x3e6eff['tag'],'context':_0x3e6eff[_0xbf79('0x16')],'exten':_0x3e6eff[_0xbf79('0x9')],'priority':_0xe8a4f7['length']+_0x1426f5[_0xbf79('0xf')]+_0x456d2b++,'VoiceExtensionId':_0x3e6eff[_0xbf79('0x17')]});}}if(_0x3e6eff[_0xbf79('0x15')]===_0xbf79('0x2f')&&_0x3e6eff[_0xbf79('0xe')]('callerID')){if(_0x3e6eff[_0xbf79('0x30')]){_0x3dc392[_0xbf79('0x18')]({'type':_0x3e6eff['type'],'app':_0xbf79('0x31'),'appdata':_0xbf79('0x32')+_0x3e6eff[_0xbf79('0x30')]+')','context':_0x3e6eff[_0xbf79('0x16')],'exten':_0x3e6eff[_0xbf79('0x9')],'priority':_0xe8a4f7['length']+_0x1426f5['priority']+_0x456d2b++,'VoiceExtensionId':_0x3e6eff[_0xbf79('0x17')]});}else{_0x3dc392[_0xbf79('0x18')]({'type':_0x3e6eff[_0xbf79('0x15')],'app':'ExecIf','appdata':_0xbf79('0x33'),'context':_0x3e6eff[_0xbf79('0x16')],'exten':_0x3e6eff[_0xbf79('0x9')],'priority':_0xe8a4f7[_0xbf79('0x27')]+_0x1426f5[_0xbf79('0xf')]+_0x456d2b++,'VoiceExtensionId':_0x3e6eff[_0xbf79('0x17')]});}}if(_0x3e6eff['hasOwnProperty']('answer')){if(_0x27ac2e[_0xbf79('0x34')](_0x3e6eff[_0xbf79('0x35')][_0xbf79('0x28')]())>=0x0&&_0x3e6eff['appType']!==_0xbf79('0x36')){if(_0x3e6eff[_0xbf79('0x37')]){_0x3dc392[_0xbf79('0x18')]({'type':_0x3e6eff['type'],'app':_0xbf79('0x31'),'appdata':_0xbf79('0x38'),'context':_0x3e6eff[_0xbf79('0x16')],'exten':_0x3e6eff['exten'],'priority':_0xe8a4f7[_0xbf79('0x27')]+_0x1426f5['priority']+_0x456d2b++,'VoiceExtensionId':_0x3e6eff[_0xbf79('0x17')]});_0x3dc392['push']({'type':_0x3e6eff['type'],'app':_0xbf79('0x13'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x3e6eff[_0xbf79('0x16')],'exten':_0x3e6eff[_0xbf79('0x9')],'priority':_0xe8a4f7[_0xbf79('0x27')]+_0x1426f5[_0xbf79('0xf')]+_0x456d2b++,'VoiceExtensionId':_0x3e6eff['VoiceExtensionId']});}else{_0x3dc392[_0xbf79('0x18')]({'type':_0x3e6eff[_0xbf79('0x15')],'app':_0xbf79('0x31'),'appdata':_0xbf79('0x39'),'context':_0x3e6eff[_0xbf79('0x16')],'exten':_0x3e6eff[_0xbf79('0x9')],'priority':_0xe8a4f7[_0xbf79('0x27')]+_0x1426f5['priority']+_0x456d2b++,'VoiceExtensionId':_0x3e6eff[_0xbf79('0x17')]});_0x3dc392[_0xbf79('0x18')]({'type':_0x3e6eff[_0xbf79('0x15')],'app':_0xbf79('0x13'),'appdata':_0xbf79('0x3a'),'context':_0x3e6eff['context'],'exten':_0x3e6eff[_0xbf79('0x9')],'priority':_0xe8a4f7[_0xbf79('0x27')]+_0x1426f5[_0xbf79('0xf')]+_0x456d2b++,'VoiceExtensionId':_0x3e6eff[_0xbf79('0x17')]});}}}for(var _0x233ae4=0x0;_0x233ae4<_0xe8a4f7[_0xbf79('0x27')];_0x233ae4+=0x1){var _0x58c09e=_0x1426f5['priority']+_0xe8a4f7['length'];var _0x53e592=_0x233ae4===_0xe8a4f7[_0xbf79('0x27')]-0x1?_0x1426f5[_0xbf79('0xf')]+_0x3dc392[_0xbf79('0x27')]+_0x3d8934[_0xbf79('0x27')]+0x2:_0x1426f5[_0xbf79('0xf')]+_0x233ae4+0x1;_0x3dc392[_0xbf79('0x3b')](_0x233ae4,0x0,{'type':_0x3e6eff[_0xbf79('0x15')],'app':_0xbf79('0x3c'),'appdata':_0xe8a4f7[_0x233ae4]+'?'+_0x3e6eff[_0xbf79('0x16')]+_0xbf79('0x3d')+_0x58c09e+':'+_0x3e6eff['context']+_0xbf79('0x3d')+_0x53e592,'exten':_0x3e6eff[_0xbf79('0x9')],'context':_0x3e6eff['context'],'priority':_0x1426f5['priority']+_0x233ae4,'VoiceExtensionId':_0x25a617[_0x97f300][0x0][_0xbf79('0x17')]});}_0x3e6eff[_0xbf79('0xf')]=_0x3dc392[_0xbf79('0x27')]?_['last'](_0x3dc392)[_0xbf79('0xf')]+0x1:_0x1426f5[_0xbf79('0xf')];_0x1426f5['priority']=(_0x3d8934[_0xbf79('0x27')]?_[_0xbf79('0x3e')](_0x3d8934)['priority']:_0x3e6eff['priority'])+0x1;_0x1426f5['extensions']=_[_0xbf79('0x3f')](_0x1426f5[_0xbf79('0x12')],_0x3dc392,[_0x3e6eff],_0x3d8934);}_0x1426f5[_0xbf79('0x12')][_0xbf79('0x18')]({'type':_0x25a617[_0x97f300][0x0][_0xbf79('0x15')],'app':'Hangup','exten':_0x25a617[_0x97f300][0x0][_0xbf79('0x9')],'context':_0x25a617[_0x97f300][0x0][_0xbf79('0x16')],'priority':_0x1426f5[_0xbf79('0xf')],'VoiceExtensionId':_0x25a617[_0x97f300][0x0][_0xbf79('0x17')]});_0xa36c06[_0xbf79('0x18')](_0x25a617[_0x97f300][0x0][_0xbf79('0x17')]);_0x1eb9ef=_[_0xbf79('0x3f')](_0x1eb9ef,_0x1426f5[_0xbf79('0x12')]);}}return _0x15d780['transaction'](function(_0x303137){return _0x15d780['models']['VoiceExtension'][_0xbf79('0x40')]({'where':{'VoiceExtensionId':{'$in':_0xa36c06}},'transaction':_0x303137})[_0xbf79('0x3')](function(_0x11a20f){return _0x15d780[_0xbf79('0x1')]['VoiceExtension'][_0xbf79('0x41')](_[_0xbf79('0x42')](_0x1eb9ef,_0xbf79('0xf')),{'transaction':_0x303137});});});})[_0xbf79('0x43')](function(_0x3d6e38){console[_0xbf79('0x44')](_0x3d6e38);});}exports[_0xbf79('0x45')]=rewrite; \ No newline at end of file +var _0xfbac=['ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','toLowerCase','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','Hangup','destroy','bulkCreate','sortBy','catch','error','util','models','Interval','intervals','findAll','then','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format','context','VoiceExtensionId','outbound','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','):Goto(','outboundrouteid=','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','*,*,*,*','IntervalId','tag','CDR(tag)=','callerID'];(function(_0x1f4345,_0x2819fc){var _0x4a7fb6=function(_0x303d17){while(--_0x303d17){_0x1f4345['push'](_0x1f4345['shift']());}};_0x4a7fb6(++_0x2819fc);}(_0xfbac,0x167));var _0xcfba=function(_0x101e91,_0x33db0d){_0x101e91=_0x101e91-0x0;var _0xe515ed=_0xfbac[_0x101e91];return _0xe515ed;};'use strict';var _=require('lodash');var util=require(_0xcfba('0x0'));function rewrite(_0x45553f,_0x314f02){var _0x2f647e=this;return _0x45553f[_0xcfba('0x1')][_0xcfba('0x2')]['findAll']({'raw':!![]})['then'](function(_0x37dc6e){_0x2f647e[_0xcfba('0x3')]=_0x37dc6e;return _0x45553f['models']['VoiceExtension'][_0xcfba('0x4')]({'where':{'IntervalId':_0x314f02['IntervalId']},'raw':!![]});})[_0xcfba('0x5')](function(_0x5b7669){return _0x45553f[_0xcfba('0x1')][_0xcfba('0x6')]['findAll']({'where':{'exten':{'$in':_[_0xcfba('0x7')](_[_0xcfba('0x8')](_0x5b7669,_0xcfba('0x9')))}},'order':[{'raw':_0xcfba('0xa')}],'raw':!![]});})[_0xcfba('0x5')](function(_0x44af2e){var _0x37ed2d=_[_0xcfba('0xb')](_0x44af2e,{'priority':'1'});var _0x3b3a64=_[_0xcfba('0xb')](_0x44af2e,{'isApp':0x1});var _0x3e0c34=_[_0xcfba('0xc')](_0x3b3a64,'exten');var _0x48d6f1=[_0xcfba('0xd'),_0xcfba('0xe')];var _0x4c2ae0=[];var _0x42691d=[];for(var _0xf4a1db in _0x3e0c34){if(_0x3e0c34[_0xcfba('0xf')](_0xf4a1db)){_0x2f647e[_0xcfba('0x10')]=0x2;_0x2f647e[_0xcfba('0x11')]=[];_0x2f647e[_0xcfba('0x12')]=_[_0xcfba('0x13')](_0x37ed2d,{'exten':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x9')]});_0x2f647e[_0xcfba('0x11')][_0xcfba('0x14')]({'type':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x15')],'app':_0xcfba('0x16'),'appdata':util[_0xcfba('0x17')]('CDR(type)=%s',_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x15')]),'context':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x18')],'exten':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x9')],'priority':_0x2f647e[_0xcfba('0x10')]++,'VoiceExtensionId':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x19')]});if(_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x15')]===_0xcfba('0x1a')){if(_0x2f647e['extension']){_0x2f647e[_0xcfba('0x11')][_0xcfba('0x14')]({'type':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x15')],'app':'Set','appdata':'CDR(destination)='+(_0x2f647e[_0xcfba('0x12')][_0xcfba('0x1b')]?_0xcfba('0x1c')+_0x2f647e[_0xcfba('0x12')][_0xcfba('0x1b')]+'}':_0xcfba('0x1d')),'context':_0x3e0c34[_0xf4a1db][0x0]['context'],'exten':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x9')],'priority':_0x2f647e['priority']++,'VoiceExtensionId':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x19')]});}_0x2f647e[_0xcfba('0x11')]['push']({'type':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x15')],'app':_0xcfba('0x16'),'appdata':_0xcfba('0x1e')+_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x19')],'context':_0x3e0c34[_0xf4a1db][0x0]['context'],'exten':_0x3e0c34[_0xf4a1db][0x0]['exten'],'priority':_0x2f647e[_0xcfba('0x10')]++,'VoiceExtensionId':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x19')]});var _0x200a77=_0x2f647e['priority']++;_0x2f647e[_0xcfba('0x11')]['push']({'type':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x15')],'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x200a77+0x2)+_0xcfba('0x1f')+(_0x200a77+0x1)+')','context':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x18')],'exten':_0x3e0c34[_0xf4a1db][0x0]['exten'],'priority':_0x200a77,'VoiceExtensionId':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x19')]});if(_0x2f647e[_0xcfba('0x12')]){_0x2f647e[_0xcfba('0x11')][_0xcfba('0x14')]({'type':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x15')],'app':_0xcfba('0x16'),'appdata':_0x2f647e[_0xcfba('0x12')][_0xcfba('0x1b')]?'CDR(prefix)=${EXTEN:0:'+_0x2f647e[_0xcfba('0x12')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x18')],'exten':_0x3e0c34[_0xf4a1db][0x0]['exten'],'priority':_0x2f647e[_0xcfba('0x10')]++,'VoiceExtensionId':_0x3e0c34[_0xf4a1db][0x0]['VoiceExtensionId']});}_0x2f647e[_0xcfba('0x11')][_0xcfba('0x14')]({'type':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x15')],'app':_0xcfba('0x16'),'appdata':_0xcfba('0x20')+_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x19')],'context':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x18')],'exten':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x9')],'priority':_0x2f647e['priority']++,'VoiceExtensionId':_0x3e0c34[_0xf4a1db][0x0]['VoiceExtensionId']});if(_0x2f647e['extension']&&_0x2f647e[_0xcfba('0x12')][_0xcfba('0xf')]('recordingFormat')&&_0x2f647e[_0xcfba('0x12')]['recordingFormat']!==_0xcfba('0x21')){_0x2f647e[_0xcfba('0x11')][_0xcfba('0x14')]({'type':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x15')],'app':_0xcfba('0x16'),'appdata':_0xcfba('0x22'),'context':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x18')],'exten':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x9')],'priority':_0x2f647e['priority']++,'VoiceExtensionId':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x19')]});_0x2f647e[_0xcfba('0x11')][_0xcfba('0x14')]({'type':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x15')],'app':_0xcfba('0x16'),'appdata':_0xcfba('0x23')+_0x2f647e[_0xcfba('0x12')]['recordingFormat']||_0xcfba('0x24'),'context':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x18')],'exten':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x9')],'priority':_0x2f647e[_0xcfba('0x10')]++,'VoiceExtensionId':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x19')]});}}_0x2f647e['extensions']['push']({'type':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x15')],'app':_0xcfba('0x16'),'appdata':_0xcfba('0x25'),'context':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x18')],'exten':_0x3e0c34[_0xf4a1db][0x0]['exten'],'priority':_0x2f647e[_0xcfba('0x10')]++,'VoiceExtensionId':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x19')]});_0x2f647e['extensions']['push']({'type':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x15')],'app':_0xcfba('0x16'),'appdata':_0xcfba('0x26'),'context':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x18')],'exten':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x9')],'priority':_0x2f647e[_0xcfba('0x10')]++,'VoiceExtensionId':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x19')]});_0x2f647e['extensions'][_0xcfba('0x14')]({'type':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x15')],'app':'Set','appdata':_0xcfba('0x27'),'context':_0x3e0c34[_0xf4a1db][0x0]['context'],'exten':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x9')],'priority':_0x2f647e['priority']++,'VoiceExtensionId':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x19')]});for(var _0xd7d697=0x0,_0x2d24ea=0x0;_0xd7d697<_0x3e0c34[_0xf4a1db][_0xcfba('0x28')];_0xd7d697+=0x1,_0x2d24ea=0x0){var _0x7c4eeb=_0x3e0c34[_0xf4a1db][_0xd7d697];if(_0x7c4eeb[_0xcfba('0x15')]){_0x7c4eeb['type']=_0x7c4eeb[_0xcfba('0x15')]['toLowerCase']();}var _0x59c5bd=[];var _0x1ff57d=[];delete _0x7c4eeb['id'];delete _0x7c4eeb[_0xcfba('0x29')];delete _0x7c4eeb[_0xcfba('0x2a')];var _0x237015=_0x7c4eeb[_0xcfba('0x2b')]!==_0xcfba('0x2c')?[_0x7c4eeb['interval']]:_0x7c4eeb['IntervalId']?_['map'](_[_0xcfba('0xb')](_0x2f647e[_0xcfba('0x3')],{'IntervalId':_0x7c4eeb[_0xcfba('0x2d')]}),_0xcfba('0x2b')):[];if(_0x7c4eeb[_0xcfba('0xf')](_0xcfba('0x2e'))){if(_0x7c4eeb[_0xcfba('0x2e')]&&_0x7c4eeb[_0xcfba('0x2e')]!=='--'){_0x59c5bd[_0xcfba('0x14')]({'type':_0x7c4eeb['type'],'app':_0xcfba('0x16'),'appdata':_0xcfba('0x2f')+_0x7c4eeb[_0xcfba('0x2e')],'context':_0x7c4eeb[_0xcfba('0x18')],'exten':_0x7c4eeb[_0xcfba('0x9')],'priority':_0x237015[_0xcfba('0x28')]+_0x2f647e[_0xcfba('0x10')]+_0x2d24ea++,'VoiceExtensionId':_0x7c4eeb['VoiceExtensionId']});}}if(_0x7c4eeb[_0xcfba('0x15')]===_0xcfba('0x1a')&&_0x7c4eeb[_0xcfba('0xf')](_0xcfba('0x30'))){if(_0x7c4eeb['callerID']){_0x59c5bd[_0xcfba('0x14')]({'type':_0x7c4eeb[_0xcfba('0x15')],'app':_0xcfba('0x31'),'appdata':_0xcfba('0x32')+_0x7c4eeb[_0xcfba('0x30')]+')','context':_0x7c4eeb[_0xcfba('0x18')],'exten':_0x7c4eeb[_0xcfba('0x9')],'priority':_0x237015['length']+_0x2f647e['priority']+_0x2d24ea++,'VoiceExtensionId':_0x7c4eeb[_0xcfba('0x19')]});}else{_0x59c5bd[_0xcfba('0x14')]({'type':_0x7c4eeb[_0xcfba('0x15')],'app':_0xcfba('0x31'),'appdata':_0xcfba('0x33'),'context':_0x7c4eeb[_0xcfba('0x18')],'exten':_0x7c4eeb['exten'],'priority':_0x237015['length']+_0x2f647e['priority']+_0x2d24ea++,'VoiceExtensionId':_0x7c4eeb[_0xcfba('0x19')]});}}if(_0x7c4eeb['hasOwnProperty'](_0xcfba('0x34'))){if(_0x48d6f1[_0xcfba('0x35')](_0x7c4eeb[_0xcfba('0x36')][_0xcfba('0x37')]())>=0x0&&_0x7c4eeb['appType']!=='custom'){if(_0x7c4eeb[_0xcfba('0x34')]){_0x59c5bd[_0xcfba('0x14')]({'type':_0x7c4eeb[_0xcfba('0x15')],'app':_0xcfba('0x31'),'appdata':_0xcfba('0x38'),'context':_0x7c4eeb[_0xcfba('0x18')],'exten':_0x7c4eeb[_0xcfba('0x9')],'priority':_0x237015[_0xcfba('0x28')]+_0x2f647e['priority']+_0x2d24ea++,'VoiceExtensionId':_0x7c4eeb['VoiceExtensionId']});_0x59c5bd[_0xcfba('0x14')]({'type':_0x7c4eeb[_0xcfba('0x15')],'app':_0xcfba('0x16'),'appdata':_0xcfba('0x39'),'context':_0x7c4eeb[_0xcfba('0x18')],'exten':_0x7c4eeb[_0xcfba('0x9')],'priority':_0x237015[_0xcfba('0x28')]+_0x2f647e[_0xcfba('0x10')]+_0x2d24ea++,'VoiceExtensionId':_0x7c4eeb[_0xcfba('0x19')]});}else{_0x59c5bd[_0xcfba('0x14')]({'type':_0x7c4eeb[_0xcfba('0x15')],'app':_0xcfba('0x31'),'appdata':_0xcfba('0x3a'),'context':_0x7c4eeb[_0xcfba('0x18')],'exten':_0x7c4eeb['exten'],'priority':_0x237015['length']+_0x2f647e[_0xcfba('0x10')]+_0x2d24ea++,'VoiceExtensionId':_0x7c4eeb[_0xcfba('0x19')]});_0x59c5bd[_0xcfba('0x14')]({'type':_0x7c4eeb[_0xcfba('0x15')],'app':'Set','appdata':_0xcfba('0x3b'),'context':_0x7c4eeb[_0xcfba('0x18')],'exten':_0x7c4eeb[_0xcfba('0x9')],'priority':_0x237015['length']+_0x2f647e[_0xcfba('0x10')]+_0x2d24ea++,'VoiceExtensionId':_0x7c4eeb[_0xcfba('0x19')]});}}}for(var _0x21ee2b=0x0;_0x21ee2b<_0x237015['length'];_0x21ee2b+=0x1){var _0x13e20e=_0x2f647e[_0xcfba('0x10')]+_0x237015[_0xcfba('0x28')];var _0x35c6dc=_0x21ee2b===_0x237015['length']-0x1?_0x2f647e['priority']+_0x59c5bd[_0xcfba('0x28')]+_0x1ff57d[_0xcfba('0x28')]+0x2:_0x2f647e['priority']+_0x21ee2b+0x1;_0x59c5bd['splice'](_0x21ee2b,0x0,{'type':_0x7c4eeb[_0xcfba('0x15')],'app':'GotoIfTime','appdata':_0x237015[_0x21ee2b]+'?'+_0x7c4eeb[_0xcfba('0x18')]+_0xcfba('0x3c')+_0x13e20e+':'+_0x7c4eeb[_0xcfba('0x18')]+',${EXTEN},'+_0x35c6dc,'exten':_0x7c4eeb[_0xcfba('0x9')],'context':_0x7c4eeb[_0xcfba('0x18')],'priority':_0x2f647e[_0xcfba('0x10')]+_0x21ee2b,'VoiceExtensionId':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x19')]});}_0x7c4eeb['priority']=_0x59c5bd[_0xcfba('0x28')]?_[_0xcfba('0x3d')](_0x59c5bd)[_0xcfba('0x10')]+0x1:_0x2f647e[_0xcfba('0x10')];_0x2f647e[_0xcfba('0x10')]=(_0x1ff57d[_0xcfba('0x28')]?_['last'](_0x1ff57d)[_0xcfba('0x10')]:_0x7c4eeb[_0xcfba('0x10')])+0x1;_0x2f647e[_0xcfba('0x11')]=_['concat'](_0x2f647e[_0xcfba('0x11')],_0x59c5bd,[_0x7c4eeb],_0x1ff57d);}_0x2f647e['extensions'][_0xcfba('0x14')]({'type':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x15')],'app':_0xcfba('0x3e'),'exten':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x9')],'context':_0x3e0c34[_0xf4a1db][0x0]['context'],'priority':_0x2f647e[_0xcfba('0x10')],'VoiceExtensionId':_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x19')]});_0x4c2ae0[_0xcfba('0x14')](_0x3e0c34[_0xf4a1db][0x0][_0xcfba('0x19')]);_0x42691d=_['concat'](_0x42691d,_0x2f647e[_0xcfba('0x11')]);}}return _0x45553f['transaction'](function(_0xb9d1bf){return _0x45553f[_0xcfba('0x1')][_0xcfba('0x6')][_0xcfba('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x4c2ae0}},'transaction':_0xb9d1bf})[_0xcfba('0x5')](function(_0x4f352b){return _0x45553f[_0xcfba('0x1')]['VoiceExtension'][_0xcfba('0x40')](_[_0xcfba('0x41')](_0x42691d,_0xcfba('0x10')),{'transaction':_0xb9d1bf});});});})[_0xcfba('0x42')](function(_0x5a3251){console[_0xcfba('0x43')](_0x5a3251);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index ed38cec..7860929 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 _0xd8b0=['find','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','ListId','toString','NOW()','from','cm_contacts','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','insert','deletedAt\x20IS\x20NULL','str','cm_hopper_black','VoiceQueue','outbound','Lists','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','CmList','Campaign','findAll','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','CompanyId','length'];(function(_0x178e2b,_0x3ca803){var _0x3727dc=function(_0x221608){while(--_0x221608){_0x178e2b['push'](_0x178e2b['shift']());}};_0x3727dc(++_0x3ca803);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var socket=require(_0x0d8b('0x9'))(new Redis(config['redis']));require(_0x0d8b('0xa'))[_0x0d8b('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0xf'));}var FILEPATH=process[_0x0d8b('0xc')][0x2];if(!process[_0x0d8b('0xc')][0x3]||process[_0x0d8b('0xc')][0x3]==='undefined'||process[_0x0d8b('0xc')][0x3]==='null'||!process[_0x0d8b('0xc')][0x4]||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x10'));}var FIELDS=_[_0x0d8b('0x11')](process[_0x0d8b('0xc')][0x3][_0x0d8b('0x12')](','),process[_0x0d8b('0xc')][0x4][_0x0d8b('0x12')](','));if(!process[_0x0d8b('0xc')][0x5]||process[_0x0d8b('0xc')][0x5]===_0x0d8b('0xd')||process['argv'][0x5]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x13'));}var LISTID=process[_0x0d8b('0xc')][0x5];var COMPANYID=process[_0x0d8b('0xc')][0x6]&&process[_0x0d8b('0xc')][0x6]!=='undefined'&&process[_0x0d8b('0xc')][0x6]!==_0x0d8b('0xe')?process[_0x0d8b('0xc')][0x6]:null;var DUPLICATES=process[_0x0d8b('0xc')][0x7]&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xd')&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xe')?process['argv'][0x7]:null;if(!process[_0x0d8b('0xc')][0x8]||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x14'));}var SOCKET_TIMESTAMP=process[_0x0d8b('0xc')][0x8];}catch(_0x352c17){logger['error'](_0x352c17);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(_0x4f0a1a,_0x33fb87,_0x54a9a7,_0x56c729){var _0x5527d8={'message':_0x33fb87};_0x5527d8[_0x4f0a1a]=!![];if(_0x54a9a7){_0x5527d8[_0x0d8b('0x15')]=_0x54a9a7;}if(_0x56c729){_0x5527d8[_0x0d8b('0x16')]=_0x56c729;}return _0x5527d8;}function isEmail(_0x214778){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))*$/[_0x0d8b('0x17')](_0x214778);}function checkRow(_0x221071,_0x2c64e2,_0x30980c){return new BPromise(function(_0x4562cb,_0x27b695){if(_['isNil'](_0x221071)){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x0d8b('0x19'),null,_0x30980c));}if(_0x221071['errors']&&_0x221071[_0x0d8b('0x1a')]['length']){var _0x3dd149=_[_0x0d8b('0x1b')](_0x221071[_0x0d8b('0x1a')],'message')['join'](';');return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x3dd149,null,_0x30980c));}var _0x3ef745={};for(var _0x4c05ee in FIELDS){if(FIELDS[_0x0d8b('0x1c')](_0x4c05ee)&&FIELDS[_0x4c05ee]){_0x3ef745[_0x4c05ee]=_0x221071['data'][0x0][FIELDS[_0x4c05ee]]||_0x221071[_0x0d8b('0x1d')][0x0]['\ufeff'+FIELDS[_0x4c05ee]];}}if(!_0x3ef745['firstName']){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'firstName\x20not\x20specified!',null,_0x30980c));}if(!_0x3ef745[_0x0d8b('0x1e')]){return _0x27b695(handleCheckRowError('error',_0x0d8b('0x1f'),null,_0x30980c));}if(_0x3ef745['birthDate']){var _0x3c8887=moment(_0x3ef745[_0x0d8b('0x20')],_0x0d8b('0x21'));if(!_0x3c8887['isValid']()){return _0x27b695(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x30980c));}}if(_0x3ef745[_0x0d8b('0x22')]){if(!isEmail(_0x3ef745['email'])){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'email\x20format\x20is\x20not\x20valid!',null,_0x30980c));}}_0x3ef745['ListId']=LISTID;_0x3ef745[_0x0d8b('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0d8b('0x24')]&&_0x2c64e2){var _0x109c14={};for(var _0xdeee5d=0x0,_0x183220=DUPLICATES[_0x0d8b('0x24')];_0xdeee5d<_0x183220;_0xdeee5d+=0x1){_0x109c14[DUPLICATES[_0xdeee5d]]=_0x3ef745[DUPLICATES[_0xdeee5d]];}var _0x4a99d3=_[_0x0d8b('0x25')](_0x2c64e2,_0x109c14);if(_0x4a99d3){return _0x27b695(handleCheckRowError('duplicate',_0x0d8b('0x26'),_0x4a99d3,_0x30980c));}}return db[_0x0d8b('0x27')]['create'](_0x3ef745,{'raw':!![],'hooks':![],'fields':_[_0x0d8b('0x28')](_0x3ef745)})[_0x0d8b('0x29')](function(_0x18a905){if(DUPLICATES&&DUPLICATES['length']&&_0x2c64e2){_0x2c64e2[_0x0d8b('0x2a')](_[_0x0d8b('0x2b')](_0x3ef745,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x18a905['id'];return _0x4562cb();})[_0x0d8b('0x2c')](function(_0x31ceba){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'Error\x20while\x20creating\x20contact:\x20'+(_0x31ceba[_0x0d8b('0x2d')]||JSON[_0x0d8b('0x2e')](_0x31ceba)),null,_0x30980c));});});}function checkHopper(){function _0x5ad0fe(){return function(_0x1180ac){logger[_0x0d8b('0x18')](_0x0d8b('0x2f'),_0x0d8b('0x30'),util[_0x0d8b('0x31')](_0x1180ac,{'showHidden':![],'depth':null}));};}var _0x519088=function(_0x497a71,_0x41b4f9){var _0x5c2c04=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x33'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),'ListId',_0x41b4f9,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()[_0x0d8b('0x3a')](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID['toString'](),_0x0d8b('0x3b'))['field'](_0x497a71['id'][_0x0d8b('0x3c')](),_0x41b4f9)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID['toString']())['where'](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel['select']()['field'](_0x0d8b('0x1e'))[_0x0d8b('0x3e')](_0x0d8b('0x33'))['where'](_0x41b4f9+_0x0d8b('0x43'),_0x497a71['id'][_0x0d8b('0x3c')]())))['toString']();return _0x5c2c04;};var _0x4d7bb0=function(_0x372740,_0x495870){var _0x1e22e5=squel['insert']()['into'](_0x0d8b('0x33'))[_0x0d8b('0x34')](['phone','scheduledAt','ContactId','ListId',_0x495870,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x372740['id'][_0x0d8b('0x3c')](),_0x495870)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')]('cm_contacts')[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel['str'](hopperContacts))[_0x0d8b('0x40')](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('calleridnum')['from']('cm_hopper_final')[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id']['toString']()))['where'](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('phone')[_0x0d8b('0x3e')](_0x0d8b('0x33'))[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id'][_0x0d8b('0x3c')]())))['toString']();return _0x1e22e5;};function _0x2de903(_0x2afe34,_0x5481fc){var _0x580580=squel[_0x0d8b('0x46')]()[_0x0d8b('0x32')]('cm_hopper')['fromQuery']([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),_0x0d8b('0x3b'),_0x5481fc,'createdAt',_0x0d8b('0x38')],squel['select']()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))['field']('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x2afe34['id'][_0x0d8b('0x3c')](),_0x5481fc)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where'](_0x0d8b('0x41')))[_0x0d8b('0x3c')]();return _0x580580;}function _0x181d49(_0x17a87f,_0x1d6cd4){var _0x59ada2=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x49'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),'ContactId',_0x0d8b('0x3b'),_0x1d6cd4,_0x0d8b('0x37'),_0x0d8b('0x38')],squel['select']()[_0x0d8b('0x3a')]('phone',_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))['field'](_0x17a87f['id'][_0x0d8b('0x3c')](),_0x1d6cd4)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),'updatedAt')[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))[_0x0d8b('0x40')](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x0d8b('0x3c')]();return _0x59ada2;}return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x4f4b4d){var _0x587128=[];if(_0x4f4b4d){var _0x1900e3;for(var _0x1c007b=0x0,_0x70e4b2;_0x1c007b<_0x4f4b4d[_0x0d8b('0x24')];_0x1c007b+=0x1){_0x70e4b2=_0x4f4b4d[_0x1c007b][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x70e4b2[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x4d7bb0(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;case _0x0d8b('0x52'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x519088(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x587128[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x587128;})[_0x0d8b('0x54')]()['then'](function(){return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x56e03c){var _0x10c318=[];if(_0x56e03c){var _0x445a00;for(var _0x24f75=0x0,_0x259ac9;_0x24f75<_0x56e03c[_0x0d8b('0x24')];_0x24f75+=0x1){_0x259ac9=_0x56e03c[_0x24f75][_0x0d8b('0x4d')]({'plain':!![]});_0x10c318[_0x0d8b('0x2a')](db[_0x0d8b('0x50')]['query'](_0x181d49(_0x259ac9,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));}}return _0x10c318;})[_0x0d8b('0x54')]();})[_0x0d8b('0x29')](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id',_0x0d8b('0x4e')],'include':[{'model':db[_0x0d8b('0x55')],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x466082){var _0x5007c0=[];if(_0x466082){for(var _0xe35028=0x0,_0x16df83;_0xe35028<_0x466082['length'];_0xe35028+=0x1){_0x16df83=_0x466082[_0xe35028][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x16df83[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x5007c0['push'](db['sequelize'][_0x0d8b('0x53')](_0x4d7bb0(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));break;case'onlyIfOpen':_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x519088(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x5007c0;})[_0x0d8b('0x54')]();})['then'](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x1dad9f){var _0x3573b4=[];if(_0x1dad9f){for(var _0x14b1b8=0x0,_0x23e2e0;_0x14b1b8<_0x1dad9f[_0x0d8b('0x24')];_0x14b1b8+=0x1){_0x23e2e0=_0x1dad9f[_0x14b1b8]['get']({'plain':!![]});_0x3573b4['push'](db['sequelize'][_0x0d8b('0x53')](_0x181d49(_0x23e2e0,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}return _0x3573b4;})[_0x0d8b('0x54')]();})[_0x0d8b('0x2c')](function(_0x5ef461){logger[_0x0d8b('0x18')](_0x0d8b('0x59'),'generalCheckHopper',_0x5ef461[_0x0d8b('0x2d')]);});}var processPromises=function(_0x57e3c2){return BPromise[_0x0d8b('0x54')](promises)[_0x0d8b('0x29')](function(_0x9dfa5a){})[_0x0d8b('0x2c')](function(_0x10c7ab){logger[_0x0d8b('0x18')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x2e')](_0x10c7ab));})[_0x0d8b('0x5b')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x57e3c2){return _0x57e3c2[_0x0d8b('0x5e')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0d8b('0x29')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0d8b('0x5f')](FILEPATH);}catch(_0xf91ecd){logger[_0x0d8b('0x18')](_0x0d8b('0x60'),JSON['stringify'](_0xf91ecd));}finally{process[_0x0d8b('0x61')](0x0);}});};process['on']('SIGINT',function(){logger[_0x0d8b('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x0d8b('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0d8b('0x12')](',');return db[_0x0d8b('0x27')][_0x0d8b('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0d8b('0x29')](function(_0x2eece2){var _0x3c7b9b=fs[_0x0d8b('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0d8b('0x64')](_0x3c7b9b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x20a8b6,_0x3a6014){total+=0x1;var _0x180539=total;promises['push'](checkRow(_0x20a8b6,_0x2eece2,_0x180539)[_0x0d8b('0x29')](function(){success+=0x1;})[_0x0d8b('0x2c')](function(_0x8be77c){if(_0x8be77c['error']){errors+=0x1;delete _0x8be77c['error'];}else if(_0x8be77c[_0x0d8b('0x65')]){duplicates+=0x1;delete _0x8be77c[_0x0d8b('0x65')];}rows[_0x0d8b('0x2a')](_0x8be77c);}));if(total%0xc8===0x0){_0x3a6014[_0x0d8b('0x66')]();return processPromises(_0x3a6014);}},'complete':function(){return processPromises()[_0x0d8b('0x29')](function(){logger[_0x0d8b('0x62')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x1a96ce,_0x3d6267){logger[_0x0d8b('0x62')](_0x0d8b('0x67'),JSON[_0x0d8b('0x2e')](_0x1a96ce));endCsv();}});})['catch'](function(_0x4dbcfc){logger[_0x0d8b('0x18')](_0x0d8b('0x68'),JSON[_0x0d8b('0x2e')](_0x4dbcfc));});}main(); \ No newline at end of file +var _0xb7e7=['birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','CmContact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt','createdAt','updatedAt','select','field','toString','NOW()','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ContactId','cm_contacts','where','str','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','query','VoiceQueueId','onlyIfOpen','sequelize','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','createReadStream','parse','duplicate','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','papaparse','../../../mysqldb','../../../config/logger','api','redis','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','error','contact','index','test','isNil','errors','length','map','join','data','phone','phone\x20not\x20specified!'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb7e7[_0x3947c9];return _0x2e7871;};'use strict';var BPromise=require(_0x7b7e('0x0'));var util=require('util');var _=require(_0x7b7e('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x7b7e('0x2'));var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var config=require('../../../config/environment');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));config[_0x7b7e('0x6')]=_['defaults'](config['redis'],{'host':_0x7b7e('0x7'),'port':0x18eb});var socket=require(_0x7b7e('0x8'))(new Redis(config[_0x7b7e('0x6')]));require('../../../api/cmContact/cmContact.socket')[_0x7b7e('0x9')](socket);try{if(!process[_0x7b7e('0xa')][0x2]||process[_0x7b7e('0xa')][0x2]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x2]===_0x7b7e('0xc')){throw new Error(_0x7b7e('0xd'));}var FILEPATH=process['argv'][0x2];if(!process[_0x7b7e('0xa')][0x3]||process[_0x7b7e('0xa')][0x3]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x3]===_0x7b7e('0xc')||!process[_0x7b7e('0xa')][0x4]||process[_0x7b7e('0xa')][0x4]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x4]==='null'){throw new Error(_0x7b7e('0xe'));}var FIELDS=_[_0x7b7e('0xf')](process['argv'][0x3][_0x7b7e('0x10')](','),process['argv'][0x4]['split'](','));if(!process[_0x7b7e('0xa')][0x5]||process[_0x7b7e('0xa')][0x5]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x5]===_0x7b7e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x7b7e('0xa')][0x6]&&process[_0x7b7e('0xa')][0x6]!==_0x7b7e('0xb')&&process[_0x7b7e('0xa')][0x6]!==_0x7b7e('0xc')?process[_0x7b7e('0xa')][0x6]:null;var DUPLICATES=process[_0x7b7e('0xa')][0x7]&&process[_0x7b7e('0xa')][0x7]!==_0x7b7e('0xb')&&process[_0x7b7e('0xa')][0x7]!==_0x7b7e('0xc')?process[_0x7b7e('0xa')][0x7]:null;if(!process[_0x7b7e('0xa')][0x8]||process[_0x7b7e('0xa')][0x8]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x8]===_0x7b7e('0xc')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x7b7e('0xa')][0x8];}catch(_0x43db4f){logger[_0x7b7e('0x11')](_0x43db4f);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(_0x4c0647,_0x313122,_0xbf0cb3,_0x14243b){var _0x200156={'message':_0x313122};_0x200156[_0x4c0647]=!![];if(_0xbf0cb3){_0x200156[_0x7b7e('0x12')]=_0xbf0cb3;}if(_0x14243b){_0x200156[_0x7b7e('0x13')]=_0x14243b;}return _0x200156;}function isEmail(_0x28bf43){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))*$/[_0x7b7e('0x14')](_0x28bf43);}function checkRow(_0x53bbb3,_0x5d6215,_0x4a836a){return new BPromise(function(_0x26ee14,_0x22598e){if(_[_0x7b7e('0x15')](_0x53bbb3)){return _0x22598e(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x4a836a));}if(_0x53bbb3['errors']&&_0x53bbb3[_0x7b7e('0x16')][_0x7b7e('0x17')]){var _0x16a3c7=_[_0x7b7e('0x18')](_0x53bbb3[_0x7b7e('0x16')],'message')[_0x7b7e('0x19')](';');return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x16a3c7,null,_0x4a836a));}var _0x4c46b8={};for(var _0x57b9da in FIELDS){if(FIELDS['hasOwnProperty'](_0x57b9da)&&FIELDS[_0x57b9da]){_0x4c46b8[_0x57b9da]=_0x53bbb3[_0x7b7e('0x1a')][0x0][FIELDS[_0x57b9da]]||_0x53bbb3[_0x7b7e('0x1a')][0x0]['\ufeff'+FIELDS[_0x57b9da]];}}if(!_0x4c46b8['firstName']){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),'firstName\x20not\x20specified!',null,_0x4a836a));}if(!_0x4c46b8[_0x7b7e('0x1b')]){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x1c'),null,_0x4a836a));}if(_0x4c46b8['birthDate']){var _0x3960b8=moment(_0x4c46b8[_0x7b7e('0x1d')],_0x7b7e('0x1e'));if(!_0x3960b8[_0x7b7e('0x1f')]()){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x4a836a));}}if(_0x4c46b8[_0x7b7e('0x20')]){if(!isEmail(_0x4c46b8['email'])){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x21'),null,_0x4a836a));}}_0x4c46b8[_0x7b7e('0x22')]=LISTID;_0x4c46b8[_0x7b7e('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7b7e('0x17')]&&_0x5d6215){var _0x247ea0={};for(var _0x29cb58=0x0,_0x4bfe7f=DUPLICATES['length'];_0x29cb58<_0x4bfe7f;_0x29cb58+=0x1){_0x247ea0[DUPLICATES[_0x29cb58]]=_0x4c46b8[DUPLICATES[_0x29cb58]];}var _0xebcdbc=_[_0x7b7e('0x24')](_0x5d6215,_0x247ea0);if(_0xebcdbc){return _0x22598e(handleCheckRowError('duplicate',_0x7b7e('0x25'),_0xebcdbc,_0x4a836a));}}return db[_0x7b7e('0x26')][_0x7b7e('0x27')](_0x4c46b8,{'raw':!![],'hooks':![],'fields':_['keys'](_0x4c46b8)})[_0x7b7e('0x28')](function(_0x256908){if(DUPLICATES&&DUPLICATES[_0x7b7e('0x17')]&&_0x5d6215){_0x5d6215[_0x7b7e('0x29')](_[_0x7b7e('0x2a')](_0x4c46b8,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x256908['id'];return _0x26ee14();})[_0x7b7e('0x2b')](function(_0x3e8cf4){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x2c')+(_0x3e8cf4[_0x7b7e('0x2d')]||JSON[_0x7b7e('0x2e')](_0x3e8cf4)),null,_0x4a836a));});});}function checkHopper(){function _0x2d0620(){return function(_0x442366){logger[_0x7b7e('0x11')](_0x7b7e('0x2f'),_0x7b7e('0x30'),util['inspect'](_0x442366,{'showHidden':![],'depth':null}));};}var _0x8c80d5=function(_0x156dca,_0xb20532){var _0x242609=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x33'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x35'),'ContactId',_0x7b7e('0x22'),_0xb20532,_0x7b7e('0x36'),_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field'](_0x7b7e('0x1b'),_0x7b7e('0x1b'))[_0x7b7e('0x39')]('NOW()','scheduledAt')[_0x7b7e('0x39')]('id','ContactId')[_0x7b7e('0x39')](LISTID[_0x7b7e('0x3a')](),'ListId')[_0x7b7e('0x39')](_0x156dca['id'][_0x7b7e('0x3a')](),_0xb20532)[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x36'))[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')]('cm_contacts')['where'](_0x7b7e('0x3d'))['where'](_0x7b7e('0x3e'),LISTID['toString']())['where'](_0x7b7e('0x3f'))['where'](_0x7b7e('0x40'),squel['select']()[_0x7b7e('0x39')](_0x7b7e('0x1b'))[_0x7b7e('0x3c')](_0x7b7e('0x33'))['where'](_0xb20532+_0x7b7e('0x41'),_0x156dca['id'][_0x7b7e('0x3a')]())))[_0x7b7e('0x3a')]();return _0x242609;};var _0x37895a=function(_0x3e4f21,_0xccdfc7){var _0x5e8572=squel['insert']()['into'](_0x7b7e('0x33'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x35'),_0x7b7e('0x42'),_0x7b7e('0x22'),_0xccdfc7,'createdAt',_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field']('phone',_0x7b7e('0x1b'))[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x35'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))['field'](LISTID[_0x7b7e('0x3a')](),'ListId')[_0x7b7e('0x39')](_0x3e4f21['id'][_0x7b7e('0x3a')](),_0xccdfc7)[_0x7b7e('0x39')](_0x7b7e('0x3b'),'createdAt')[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')](_0x7b7e('0x43'))['where'](_0x7b7e('0x3d'))[_0x7b7e('0x44')](_0x7b7e('0x3e'),LISTID[_0x7b7e('0x3a')]())[_0x7b7e('0x44')]('id\x20IN\x20?',squel[_0x7b7e('0x45')](hopperContacts))[_0x7b7e('0x44')](_0x7b7e('0x3f'))[_0x7b7e('0x44')](_0x7b7e('0x40'),squel[_0x7b7e('0x38')]()[_0x7b7e('0x39')]('calleridnum')[_0x7b7e('0x3c')]('cm_hopper_final')[_0x7b7e('0x44')](_0xccdfc7+_0x7b7e('0x41'),_0x3e4f21['id']['toString']()))[_0x7b7e('0x44')](_0x7b7e('0x40'),squel[_0x7b7e('0x38')]()[_0x7b7e('0x39')](_0x7b7e('0x1b'))[_0x7b7e('0x3c')](_0x7b7e('0x33'))['where'](_0xccdfc7+_0x7b7e('0x41'),_0x3e4f21['id'][_0x7b7e('0x3a')]())))[_0x7b7e('0x3a')]();return _0x5e8572;};function _0x24481a(_0x5b9ab5,_0x527403){var _0x5bdf1d=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x33'))['fromQuery'](['phone',_0x7b7e('0x35'),_0x7b7e('0x42'),'ListId',_0x527403,_0x7b7e('0x36'),_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field'](_0x7b7e('0x1b'),_0x7b7e('0x1b'))['field'](_0x7b7e('0x3b'),_0x7b7e('0x35'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))[_0x7b7e('0x39')](LISTID[_0x7b7e('0x3a')](),_0x7b7e('0x22'))[_0x7b7e('0x39')](_0x5b9ab5['id'][_0x7b7e('0x3a')](),_0x527403)['field'](_0x7b7e('0x3b'),_0x7b7e('0x36'))['field'](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')]('cm_contacts')[_0x7b7e('0x44')]('deletedAt\x20IS\x20NULL')[_0x7b7e('0x44')](_0x7b7e('0x3e'),LISTID['toString']())[_0x7b7e('0x44')](_0x7b7e('0x46'),squel['str'](hopperContacts))[_0x7b7e('0x44')](_0x7b7e('0x3f')))[_0x7b7e('0x3a')]();return _0x5bdf1d;}function _0x3b1adb(_0x5eb32c,_0x101896){var _0x73904d=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x47'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x42'),_0x7b7e('0x22'),_0x101896,_0x7b7e('0x36'),'updatedAt'],squel[_0x7b7e('0x38')]()['field']('phone',_0x7b7e('0x1b'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))[_0x7b7e('0x39')](LISTID['toString'](),_0x7b7e('0x22'))[_0x7b7e('0x39')](_0x5eb32c['id'][_0x7b7e('0x3a')](),_0x101896)[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x36'))['field'](_0x7b7e('0x3b'),'updatedAt')['from'](_0x7b7e('0x43'))['where'](_0x7b7e('0x3d'))['where'](_0x7b7e('0x3e'),LISTID[_0x7b7e('0x3a')]())['where'](_0x7b7e('0x46'),squel[_0x7b7e('0x45')](hopperContacts))['where'](_0x7b7e('0x3f')))[_0x7b7e('0x3a')]();return _0x73904d;}return db[_0x7b7e('0x48')][_0x7b7e('0x49')]({'where':{'type':_0x7b7e('0x4a')},'attributes':['id',_0x7b7e('0x4b')],'include':[{'model':db[_0x7b7e('0x4c')],'as':_0x7b7e('0x4d'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x17e5ba){var _0x589b02=[];if(_0x17e5ba){var _0x59ecf9;for(var _0x34e7df=0x0,_0x46ac1f;_0x34e7df<_0x17e5ba[_0x7b7e('0x17')];_0x34e7df+=0x1){_0x46ac1f=_0x17e5ba[_0x34e7df][_0x7b7e('0x4e')]({'plain':!![]});switch(_0x46ac1f[_0x7b7e('0x4b')]){case _0x7b7e('0x4f'):_0x589b02[_0x7b7e('0x29')](db['sequelize'][_0x7b7e('0x50')](_0x37895a(_0x46ac1f,_0x7b7e('0x51')))['then'](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;case _0x7b7e('0x52'):_0x589b02[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x8c80d5(_0x46ac1f,_0x7b7e('0x51')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;default:_0x589b02[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x24481a(_0x46ac1f,'VoiceQueueId'))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}}return _0x589b02;})[_0x7b7e('0x54')]()[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x48')][_0x7b7e('0x49')]({'where':{'type':_0x7b7e('0x4a')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7b7e('0x55'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x1eb5ce){var _0x49f0a4=[];if(_0x1eb5ce){var _0x1d6aa4;for(var _0x195ae2=0x0,_0x381ee6;_0x195ae2<_0x1eb5ce[_0x7b7e('0x17')];_0x195ae2+=0x1){_0x381ee6=_0x1eb5ce[_0x195ae2][_0x7b7e('0x4e')]({'plain':!![]});_0x49f0a4['push'](db['sequelize']['query'](_0x3b1adb(_0x381ee6,_0x7b7e('0x51')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}return _0x49f0a4;})['all']();})[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x56')][_0x7b7e('0x49')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x7b7e('0x4c')],'as':_0x7b7e('0x4d'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x34a06c){var _0x538c5f=[];if(_0x34a06c){for(var _0x315923=0x0,_0x40b4ae;_0x315923<_0x34a06c[_0x7b7e('0x17')];_0x315923+=0x1){_0x40b4ae=_0x34a06c[_0x315923][_0x7b7e('0x4e')]({'plain':!![]});switch(_0x40b4ae['dialCheckDuplicateType']){case'always':_0x538c5f[_0x7b7e('0x29')](db['sequelize'][_0x7b7e('0x50')](_0x37895a(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;case'onlyIfOpen':_0x538c5f[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x8c80d5(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;default:_0x538c5f[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x24481a(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}}return _0x538c5f;})[_0x7b7e('0x54')]();})[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x56')][_0x7b7e('0x49')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7b7e('0x55'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x1d9e08){var _0xa03d7a=[];if(_0x1d9e08){for(var _0x10c35e=0x0,_0x302462;_0x10c35e<_0x1d9e08[_0x7b7e('0x17')];_0x10c35e+=0x1){_0x302462=_0x1d9e08[_0x10c35e]['get']({'plain':!![]});_0xa03d7a[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x3b1adb(_0x302462,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})['catch'](_0x2d0620()));}}return _0xa03d7a;})['all']();})[_0x7b7e('0x2b')](function(_0x110f2b){logger[_0x7b7e('0x11')](_0x7b7e('0x58'),_0x7b7e('0x59'),_0x110f2b[_0x7b7e('0x2d')]);});}var processPromises=function(_0x2c65b8){return BPromise[_0x7b7e('0x54')](promises)[_0x7b7e('0x28')](function(_0x850d0f){})['catch'](function(_0x27402a){logger[_0x7b7e('0x11')](_0x7b7e('0x5a'),JSON[_0x7b7e('0x2e')](_0x27402a));})[_0x7b7e('0x5b')](function(){socket[_0x7b7e('0x5c')](_0x7b7e('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2c65b8){return _0x2c65b8['resume']();}});};var endCsv=function(){return BPromise[_0x7b7e('0x5e')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x7b7e('0x28')](function(){socket[_0x7b7e('0x5c')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7b7e('0x5f')](FILEPATH);}catch(_0x38fd40){logger[_0x7b7e('0x11')](_0x7b7e('0x60'),JSON[_0x7b7e('0x2e')](_0x38fd40));}finally{process['exit'](0x0);}});};process['on'](_0x7b7e('0x61'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x7b7e('0x5e')]()[_0x7b7e('0x28')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7b7e('0x10')](',');return db[_0x7b7e('0x26')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7b7e('0x28')](function(_0x5cedd4){var _0x25233a=fs[_0x7b7e('0x62')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x7b7e('0x63')](_0x25233a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1e71ab,_0x11d615){total+=0x1;var _0x3afd15=total;promises[_0x7b7e('0x29')](checkRow(_0x1e71ab,_0x5cedd4,_0x3afd15)['then'](function(){success+=0x1;})[_0x7b7e('0x2b')](function(_0x30eeee){if(_0x30eeee['error']){errors+=0x1;delete _0x30eeee[_0x7b7e('0x11')];}else if(_0x30eeee[_0x7b7e('0x64')]){duplicates+=0x1;delete _0x30eeee[_0x7b7e('0x64')];}rows[_0x7b7e('0x29')](_0x30eeee);}));if(total%0xc8===0x0){_0x11d615[_0x7b7e('0x65')]();return processPromises(_0x11d615);}},'complete':function(){return processPromises()[_0x7b7e('0x28')](function(){logger[_0x7b7e('0x66')](_0x7b7e('0x67'));endCsv();});},'error':function(_0x41e2b5,_0x97232d){logger[_0x7b7e('0x66')](_0x7b7e('0x68'),JSON[_0x7b7e('0x2e')](_0x41e2b5));endCsv();}});})[_0x7b7e('0x2b')](function(_0x12d0cb){logger[_0x7b7e('0x11')](_0x7b7e('0x69'),JSON[_0x7b7e('0x2e')](_0x12d0cb));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 3f17ebd..1819740 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 _0x8184=['map','No\x20agent\x20available','SIGINT','path','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','field','phone','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','into','ContactId','ListId','createdAt','updatedAt','priority','recallme','select','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_hopper','\x22always\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.phone','cm_contacts.updatedAt','insert','cm_hopper_black','fromQuery','fields','from','ListId\x20=\x20?','keys','CompanyId','cm_contacts',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','info','error','exit','errors','push','code','message','sequelize','spread','catch','main','send','start','socket_timestamp','root','server/files/tmp','.csv','header','writeFileSync','parse','createReadStream','data','length','rows','trim','replace','scheduledat','isValid','isNaN','UserId','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','appendFileSync','emit','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','isNil','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','campaigns','each','then','affectedRows','contact:import:','unlink','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory'];(function(_0x4d9ac0,_0x5dbb5b){var _0x29d54f=function(_0x24400f){while(--_0x24400f){_0x4d9ac0['push'](_0x4d9ac0['shift']());}};_0x29d54f(++_0x5dbb5b);}(_0x8184,0x8a));var _0x4818=function(_0x259359,_0x1aa089){_0x259359=_0x259359-0x0;var _0x591b7d=_0x8184[_0x259359];return _0x591b7d;};'use strict';var fs=require('fs');var path=require(_0x4818('0x0'));var _=require('lodash');var Papa=require(_0x4818('0x1'));var util=require(_0x4818('0x2'));var BPromise=require(_0x4818('0x3'));var moment=require(_0x4818('0x4'));var squel=require(_0x4818('0x5'));var Redis=require(_0x4818('0x6'));var db=require(_0x4818('0x7'))['db'];var config=require(_0x4818('0x8'));var logger=require(_0x4818('0x9'))(_0x4818('0xa'));config[_0x4818('0xb')]=_[_0x4818('0xc')](config[_0x4818('0xb')],{'host':_0x4818('0xd'),'port':0x18eb});var socket=require(_0x4818('0xe'))(new Redis(config[_0x4818('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x4818('0xf')](_0x4818('0x10'));function isEmail(_0x446b40){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'](_0x446b40);}function selectNotIn(_0x3d6377,_0x14188d,_0x1058e0,_0x1ab54f,_0x205899){return squel['select']()[_0x4818('0x11')](_0x4818('0x12'))['from'](_0x1ab54f)['join'](_0x14188d,null,_0x14188d+_0x4818('0x13')+_0x1ab54f+'.'+_0x1058e0)[_0x4818('0x14')](_0x1ab54f+'.'+_0x1058e0+_0x4818('0x15')+_0x3d6377+'.'+_0x1058e0)[_0x4818('0x14')](_0x14188d+_0x4818('0x16')+_0x205899[_0x4818('0x17')]()+')');}function insertCmHopper(_0xb444b1,_0x2343b7,_0x158aeb,_0x577a60,_0xa52bfc){var _0x211692=['cm_contacts.phone',_0x4818('0x18'),_0x4818('0x19'),_0x4818('0x1a'),_0x2343b7+'.'+_0x577a60,_0x4818('0x1b'),'cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','\x22'+_0xa52bfc+'\x22'];return squel['insert']()[_0x4818('0x1c')]('cm_hopper')['fromQuery']([_0x4818('0x12'),'scheduledat',_0x4818('0x1d'),_0x4818('0x1e'),_0x577a60,_0x4818('0x1f'),_0x4818('0x20'),_0x4818('0x21'),'UserId',_0x4818('0x22')],squel[_0x4818('0x23')]()['fields'](_0x211692)['from'](_0x2343b7)[_0x4818('0x17')]('cm_contacts',null,_0x4818('0x24')+_0x2343b7+_0x4818('0x25'))['join'](_0x158aeb,null,_0x158aeb+_0x4818('0x13')+_0x2343b7+'.'+_0x577a60)[_0x4818('0x14')](_0x2343b7+_0x4818('0x26'),_0xb444b1)['where'](_0x4818('0x27'),NOW)[_0x4818('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2343b7,_0x158aeb,_0x577a60,_0x4818('0x28'),[_0x4818('0x29'),'\x22onlyIfOpen\x22']))['where'](_0x4818('0x2a'),selectNotIn(_0x2343b7,_0x158aeb,_0x577a60,_0x4818('0x28'),[_0x4818('0x29')])))[_0x4818('0x2b')]();}function insertCmHopperBlack(_0x3a8b56,_0xc03c07,_0x3f4274,_0x1dc5c5){var _0x59384f=[_0x4818('0x2c'),_0x4818('0x19'),_0x4818('0x1a'),_0xc03c07+'.'+_0x1dc5c5,_0x4818('0x1b'),_0x4818('0x2d')];return squel[_0x4818('0x2e')]()[_0x4818('0x1c')](_0x4818('0x2f'))[_0x4818('0x30')]([_0x4818('0x12'),_0x4818('0x1d'),_0x4818('0x1e'),_0x1dc5c5,_0x4818('0x1f'),_0x4818('0x20')],squel[_0x4818('0x23')]()[_0x4818('0x31')](_0x59384f)[_0x4818('0x32')](_0xc03c07)['join']('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0xc03c07+_0x4818('0x25'))[_0x4818('0x17')](_0x3f4274,null,_0x3f4274+_0x4818('0x13')+_0xc03c07+'.'+_0x1dc5c5)[_0x4818('0x14')](_0xc03c07+_0x4818('0x26'),_0x3a8b56)[_0x4818('0x14')](_0x4818('0x27'),NOW)[_0x4818('0x14')](_0x4818('0x2a'),squel[_0x4818('0x23')]()[_0x4818('0x11')](_0x4818('0x12'))[_0x4818('0x32')]('cm_hopper_black')[_0x4818('0x14')](_0x4818('0x33'),_0x3a8b56)[_0x4818('0x14')](_0x1dc5c5+'\x20=\x20?',_0xc03c07+'.'+_0x1dc5c5)))['toString']();}function insertCmContact(_0xcb0b85,_0x16a9b9,_0x4fe4cb,_0x3afa18){var _0x3942c0=_['concat'](_[_0x4818('0x34')](_0x3afa18),[_0x4818('0x1e'),_0x4818('0x35'),_0x4818('0x1f'),_0x4818('0x20')]);return squel['insert']()[_0x4818('0x1c')](_0x4818('0x36'))[_0x4818('0x30')](_0x3942c0,squel['select']()[_0x4818('0x31')](_0x3942c0)[_0x4818('0x32')](_0x16a9b9)[_0x4818('0x14')]('('+_0x4fe4cb[_0x4818('0x17')](',')+_0x4818('0x37'),squel['select']()[_0x4818('0x31')](_0x4fe4cb)[_0x4818('0x32')](_0x4818('0x36'))[_0x4818('0x14')](_0x4818('0x33'),_0xcb0b85)[_0x4818('0x14')](_0x4818('0x38')))[_0x4818('0x14')](_0x4818('0x39'),squel[_0x4818('0x23')]()[_0x4818('0x11')]('MIN(id)',_0x4818('0x3a'))[_0x4818('0x32')](_0x16a9b9)['group'](_0x4fe4cb[_0x4818('0x17')](','))))[_0x4818('0x2b')]();}function handleStop(){logger[_0x4818('0x3b')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x45c130){logger[_0x4818('0x3c')](_0x45c130['message']);process[_0x4818('0x3d')](0x1);}function handleError(_0x58dfcb,_0x5b6df8){stats[_0x4818('0x3e')][_0x4818('0x3f')]({'name':_0x5b6df8[_0x4818('0x40')],'message':_0x5b6df8[_0x4818('0x41')],'row':_0x58dfcb});}function handleQuery(_0x2864b9){logger[_0x4818('0x3b')](_0x2864b9);return db[_0x4818('0x42')]['query'](_0x2864b9)[_0x4818('0x43')](function(_0x1e597c){results[_0x4818('0x3f')](_0x1e597c);})[_0x4818('0x44')](function(_0x19dca5){logger[_0x4818('0x3c')](_0x19dca5['message']);});}function main(_0x268a70,_0x55556a,_0x509d3b,_0x254fbc){logger[_0x4818('0x3b')](_0x4818('0x45'),_0x268a70,JSON['stringify'](_0x55556a));process[_0x4818('0x46')](_0x4818('0x47'));var _0x4838f4=_0x55556a['binding'];var _0x1a6bf5=_0x55556a[_0x4818('0x48')];var _0x748f20=path[_0x4818('0x17')](config[_0x4818('0x49')],_0x4818('0x4a'),_0x1a6bf5+_0x4818('0x4b'));var _0x12bec9=_[_0x4818('0x34')](_0x4838f4)[_0x4818('0x17')]();logger[_0x4818('0x3b')](_0x4818('0x4c'),_0x12bec9);fs[_0x4818('0x4d')](_0x748f20,_0x12bec9+'\x0a');Papa[_0x4818('0x4e')](fs[_0x4818('0x4f')](_0x268a70),{'header':!![],'skipEmptyLines':!![],'step':function(_0x194d05,_0xd8f8c2){try{for(var _0x73b7f8=0x0,_0x5162b9=[];_0x73b7f8<_0x194d05[_0x4818('0x50')][_0x4818('0x51')];_0x73b7f8++){stats[_0x4818('0x52')]+=0x1;if(_0x194d05['errors'][_0x73b7f8]){handleError(_0x194d05[_0x4818('0x50')][_0x73b7f8],_0x194d05[_0x4818('0x3e')][_0x73b7f8]);}else{var _0x2fe7df=[];for(var _0x2e529d in _0x4838f4){if(_0x4838f4['hasOwnProperty'](_0x2e529d)){if(_0x194d05[_0x4818('0x50')][_0x73b7f8][_0x4838f4[_0x2e529d]]){var _0x54e358=_[_0x4818('0x53')](_0x194d05['data'][_0x73b7f8][_0x4838f4[_0x2e529d]][_0x4818('0x54')](/"/g,'\x27'));switch(_0x2e529d){case _0x4818('0x55'):var _0x57eeaf=moment(_0x54e358,_0x4818('0x10'),!![]);if(_0x57eeaf[_0x4818('0x56')]()){_0x5162b9[_0x4818('0x3f')]('\x22'+_0x54e358+'\x22');}else{_0x2fe7df[_0x4818('0x3f')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x54edb1=parseInt(_0x54e358);_0x54e358=_[_0x4818('0x57')](_0x54edb1)||_0x54edb1<0x0||_0x54edb1>0x4?_0x254fbc?0x3:0x2:_0x54edb1;_0x5162b9[_0x4818('0x3f')]('\x22'+_0x54e358+'\x22');break;case _0x4818('0x58'):var _0x60eefc=parseInt(_0x54e358);if(_[_0x4818('0x59')](_0x60eefc)&&_[_0x4818('0x5a')](_0x509d3b,_0x60eefc)){_0x5162b9[_0x4818('0x3f')]('\x22'+_0x60eefc+'\x22');}else{_0x2fe7df[_0x4818('0x3f')](_0x4818('0x5b'));}break;case _0x4818('0x5c'):if(isEmail(_0x54e358)){_0x5162b9[_0x4818('0x3f')]('\x22'+_0x54e358+'\x22');}else{_0x2fe7df['push']('email\x20wrong\x20format');}break;case _0x4818('0x5d'):var _0x2fb35b=moment(_0x54e358,_0x4818('0x5e'),!![]);if(_0x2fb35b[_0x4818('0x56')]()){_0x5162b9[_0x4818('0x3f')]('\x22'+_0x54e358+'\x22');}else{_0x2fe7df['push'](_0x4818('0x5f'));}break;default:_0x5162b9[_0x4818('0x3f')]('\x22'+_0x54e358+'\x22');}}else{switch(_0x2e529d){case _0x4818('0x60'):case _0x4818('0x12'):_0x2fe7df[_0x4818('0x3f')](_0x2e529d+_0x4818('0x61'));break;default:_0x5162b9[_0x4818('0x3f')]('\x22\x22');}}}}if(_0x2fe7df['length']){handleError(_0x194d05[_0x4818('0x50')][_0x73b7f8],{'code':'SystemRow','message':_0x2fe7df[_0x4818('0x17')]()});}else{fs[_0x4818('0x62')](_0x748f20,_0x5162b9['join']()+'\x0a');}_0x5162b9=[];}if(!(stats[_0x4818('0x52')]%0xc8)){socket[_0x4818('0x63')]('contact:import:'+_0x1a6bf5,stats);stats[_0x4818('0x3e')]=[];}}if(stopped){logger[_0x4818('0x3b')](_0x4818('0x64'));_0xd8f8c2[_0x4818('0x65')]();}}catch(_0x1e4ec0){handleError(_0x194d05[_0x4818('0x50')][_0x73b7f8],{'code':_0x4818('0x66'),'message':_0x1e4ec0[_0x4818('0x41')]});logger[_0x4818('0x3c')](_0x4818('0x67'),_0x1e4ec0[_0x4818('0x41')]);}},'complete':function(){try{var _0x435300=[];var _0x5c5966=_0x4818('0x36');if(_0x55556a[_0x4818('0x68')]&&_0x55556a[_0x4818('0x68')][_0x4818('0x51')]){_0x5c5966=_0x4818('0x69')+_0x1a6bf5;_0x435300['push'](_0x4818('0x6a')+_0x5c5966+_0x4818('0x6b'));}var _0x4b798f=util[_0x4818('0xf')]('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',_0x748f20,_0x5c5966,_0x12bec9,_0x55556a[_0x4818('0x1e')],_0x55556a[_0x4818('0x35')]||null,NOW,NOW);if(_[_0x4818('0x6c')](_0x4838f4[_0x4818('0x55')])){_0x4b798f+=',\x20scheduledAt\x20=\x20NOW()';}_0x435300[_0x4818('0x3f')](_0x4b798f);if(_0x55556a[_0x4818('0x68')]&&_0x55556a['duplicates'][_0x4818('0x51')]){_0x435300[_0x4818('0x3f')](insertCmContact(_0x55556a[_0x4818('0x1e')],_0x5c5966,_0x55556a[_0x4818('0x68')],_0x4838f4));_0x435300['push'](_0x4818('0x6d')+_0x5c5966+';');}_0x435300[_0x4818('0x3f')](insertCmHopper(_0x55556a[_0x4818('0x1e')],_0x4818('0x6e'),_0x4818('0x6f'),_0x4818('0x70'),_0x254fbc));_0x435300[_0x4818('0x3f')](insertCmHopperBlack(_0x55556a['ListId'],_0x4818('0x71'),_0x4818('0x6f'),_0x4818('0x70')));_0x435300['push'](insertCmHopper(_0x55556a[_0x4818('0x1e')],_0x4818('0x72'),'campaigns',_0x4818('0x73'),_0x254fbc));_0x435300[_0x4818('0x3f')](insertCmHopperBlack(_0x55556a[_0x4818('0x1e')],_0x4818('0x74'),_0x4818('0x75'),_0x4818('0x73')));BPromise[_0x4818('0x76')](_0x435300,handleQuery)[_0x4818('0x77')](function(_0x362376){stats['finish']=!![];stats[_0x4818('0x78')]=_0x55556a['duplicates']&&_0x55556a[_0x4818('0x68')]['length']?results[0x2][_0x4818('0x78')]:results[0x0][_0x4818('0x78')];socket[_0x4818('0x63')](_0x4818('0x79')+_0x1a6bf5,stats);fs[_0x4818('0x7a')](_0x268a70);fs[_0x4818('0x7a')](_0x748f20);process[_0x4818('0x3d')](0x0);})['catch'](function(_0x1a0320){logger['error'](_0x1a0320[_0x4818('0x41')]);process['exit'](0x1);});}catch(_0x2d165e){logger[_0x4818('0x3c')]('complete',_0x2d165e['message']);process['exit'](0x1);}},'error':function(_0x15b54d,_0xdabe9,_0x9be591,_0x4b6756){throw new Error(_0x4b6756);}});}function validate(){if(process[_0x4818('0x7b')]&&process[_0x4818('0x7b')][_0x4818('0x51')]<0x4){throw new Error(_0x4818('0x7c'));}var _0x1072bd=path[_0x4818('0x17')](config['root'],'server/files/tmp',process[_0x4818('0x7b')][0x2]);if(!fs[_0x4818('0x7d')](_0x1072bd)){throw new Error(_0x4818('0x7e'));}var _0x54e68f={};try{_0x54e68f=JSON[_0x4818('0x4e')](process[_0x4818('0x7b')][0x3]);if(!_0x54e68f[_0x4818('0x7f')]){throw new Error(_0x4818('0x80'));}if(!_0x54e68f['binding'][_0x4818('0x12')]){throw new Error(_0x4818('0x81'));}if(!_0x54e68f[_0x4818('0x7f')][_0x4818('0x60')]){throw new Error(_0x4818('0x82'));}var _0x330bbc=0x0;if(_0x54e68f[_0x4818('0x7f')][_0x4818('0x58')]){_0x330bbc=0x1;}if(!_0x54e68f['ListId']){throw new Error(_0x4818('0x83'));}}catch(_0x3ad4fd){throw new Error('body\x20id\x20mandatory');}var _0x342f83=[];try{_0x342f83=_[_0x4818('0x84')](JSON[_0x4818('0x4e')](process['argv'][0x4]),'id');}catch(_0x534c7d){logger[_0x4818('0x3b')](_0x4818('0x85'));}main(_0x1072bd,_0x54e68f,_0x342f83,_0x330bbc);}validate();process['on'](_0x4818('0x86'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x8abb=['bluebird','moment','../../../config/environment','../../../config/logger','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','cm_hopper','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','insert','into','cm_hopper_black','fromQuery','fields','\x20=\x20?','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','error','errors','code','message','info','sequelize','query','spread','catch','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','header','writeFileSync','parse','createReadStream','data','length','rows','hasOwnProperty','trim','replace','push','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','UserId','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','voice_queues','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','lodash','papaparse','util'];(function(_0x799197,_0x667c04){var _0x26444e=function(_0x41089f){while(--_0x41089f){_0x799197['push'](_0x799197['shift']());}};_0x26444e(++_0x667c04);}(_0x8abb,0x195));var _0xb8ab=function(_0x5bd018,_0x489e23){_0x5bd018=_0x5bd018-0x0;var _0x225ff3=_0x8abb[_0x5bd018];return _0x225ff3;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xb8ab('0x0'));var Papa=require(_0xb8ab('0x1'));var util=require(_0xb8ab('0x2'));var BPromise=require(_0xb8ab('0x3'));var moment=require(_0xb8ab('0x4'));var squel=require('squel');var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0xb8ab('0x5'));var logger=require(_0xb8ab('0x6'))(_0xb8ab('0x7'));config[_0xb8ab('0x8')]=_[_0xb8ab('0x9')](config[_0xb8ab('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xb8ab('0xa'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xb8ab('0xb')](_0xb8ab('0xc'));function isEmail(_0x1fbd5e){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'](_0x1fbd5e);}function selectNotIn(_0x5a70f3,_0x5504b8,_0x2cc4ff,_0x103720,_0x1eeb15){return squel[_0xb8ab('0xd')]()[_0xb8ab('0xe')](_0xb8ab('0xf'))[_0xb8ab('0x10')](_0x103720)['join'](_0x5504b8,null,_0x5504b8+_0xb8ab('0x11')+_0x103720+'.'+_0x2cc4ff)[_0xb8ab('0x12')](_0x103720+'.'+_0x2cc4ff+'\x20=\x20'+_0x5a70f3+'.'+_0x2cc4ff)['where'](_0x5504b8+_0xb8ab('0x13')+_0x1eeb15[_0xb8ab('0x14')]()+')');}function insertCmHopper(_0x5ce789,_0x578195,_0xba7205,_0x9d7b51,_0x38dd6b){var _0x5d3bf1=[_0xb8ab('0x15'),'cm_contacts.scheduledat',_0xb8ab('0x16'),_0xb8ab('0x17'),_0x578195+'.'+_0x9d7b51,_0xb8ab('0x18'),_0xb8ab('0x19'),_0xb8ab('0x1a'),_0xb8ab('0x1b'),'\x22'+_0x38dd6b+'\x22'];return squel['insert']()['into'](_0xb8ab('0x1c'))['fromQuery']([_0xb8ab('0xf'),_0xb8ab('0x1d'),_0xb8ab('0x1e'),_0xb8ab('0x1f'),_0x9d7b51,_0xb8ab('0x20'),_0xb8ab('0x21'),_0xb8ab('0x22'),'UserId','recallme'],squel[_0xb8ab('0xd')]()['fields'](_0x5d3bf1)[_0xb8ab('0x10')](_0x578195)[_0xb8ab('0x14')](_0xb8ab('0x23'),null,_0xb8ab('0x24')+_0x578195+_0xb8ab('0x25'))[_0xb8ab('0x14')](_0xba7205,null,_0xba7205+_0xb8ab('0x11')+_0x578195+'.'+_0x9d7b51)['where'](_0x578195+_0xb8ab('0x26'),_0x5ce789)[_0xb8ab('0x12')](_0xb8ab('0x27'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x578195,_0xba7205,_0x9d7b51,'cm_hopper',[_0xb8ab('0x28'),_0xb8ab('0x29')]))[_0xb8ab('0x12')](_0xb8ab('0x2a'),selectNotIn(_0x578195,_0xba7205,_0x9d7b51,_0xb8ab('0x1c'),['\x22always\x22'])))[_0xb8ab('0x2b')]();}function insertCmHopperBlack(_0x52737b,_0x3a9e29,_0x1851df,_0x242449){var _0x13f64c=[_0xb8ab('0x15'),_0xb8ab('0x16'),_0xb8ab('0x17'),_0x3a9e29+'.'+_0x242449,_0xb8ab('0x18'),_0xb8ab('0x19')];return squel[_0xb8ab('0x2c')]()[_0xb8ab('0x2d')](_0xb8ab('0x2e'))[_0xb8ab('0x2f')]([_0xb8ab('0xf'),_0xb8ab('0x1e'),'ListId',_0x242449,_0xb8ab('0x20'),'updatedAt'],squel['select']()[_0xb8ab('0x30')](_0x13f64c)[_0xb8ab('0x10')](_0x3a9e29)['join'](_0xb8ab('0x23'),null,_0xb8ab('0x24')+_0x3a9e29+_0xb8ab('0x25'))[_0xb8ab('0x14')](_0x1851df,null,_0x1851df+_0xb8ab('0x11')+_0x3a9e29+'.'+_0x242449)[_0xb8ab('0x12')](_0x3a9e29+_0xb8ab('0x26'),_0x52737b)[_0xb8ab('0x12')](_0xb8ab('0x27'),NOW)[_0xb8ab('0x12')](_0xb8ab('0x2a'),squel[_0xb8ab('0xd')]()[_0xb8ab('0xe')](_0xb8ab('0xf'))[_0xb8ab('0x10')](_0xb8ab('0x2e'))[_0xb8ab('0x12')]('ListId\x20=\x20?',_0x52737b)[_0xb8ab('0x12')](_0x242449+_0xb8ab('0x31'),_0x3a9e29+'.'+_0x242449)))['toString']();}function insertCmContact(_0x3e8ec9,_0x39dd3b,_0x2a4ef9,_0xd8f502){var _0x3bd9f5=_['concat'](_[_0xb8ab('0x32')](_0xd8f502),['ListId',_0xb8ab('0x33'),'createdAt',_0xb8ab('0x21')]);return squel[_0xb8ab('0x2c')]()[_0xb8ab('0x2d')](_0xb8ab('0x23'))['fromQuery'](_0x3bd9f5,squel[_0xb8ab('0xd')]()[_0xb8ab('0x30')](_0x3bd9f5)[_0xb8ab('0x10')](_0x39dd3b)[_0xb8ab('0x12')]('('+_0x2a4ef9[_0xb8ab('0x14')](',')+_0xb8ab('0x34'),squel[_0xb8ab('0xd')]()[_0xb8ab('0x30')](_0x2a4ef9)[_0xb8ab('0x10')]('cm_contacts')[_0xb8ab('0x12')]('ListId\x20=\x20?',_0x3e8ec9)[_0xb8ab('0x12')](_0xb8ab('0x35')))['where'](_0xb8ab('0x36'),squel[_0xb8ab('0xd')]()['field']('MIN(id)',_0xb8ab('0x37'))['from'](_0x39dd3b)[_0xb8ab('0x38')](_0x2a4ef9[_0xb8ab('0x14')](','))))[_0xb8ab('0x2b')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x18c3d3){logger[_0xb8ab('0x39')](_0x18c3d3['message']);process['exit'](0x1);}function handleError(_0x288977,_0x155c20){stats[_0xb8ab('0x3a')]['push']({'name':_0x155c20[_0xb8ab('0x3b')],'message':_0x155c20[_0xb8ab('0x3c')],'row':_0x288977});}function handleQuery(_0x2f5729){logger[_0xb8ab('0x3d')](_0x2f5729);return db[_0xb8ab('0x3e')][_0xb8ab('0x3f')](_0x2f5729)[_0xb8ab('0x40')](function(_0xabe361){results['push'](_0xabe361);})[_0xb8ab('0x41')](function(_0x58ff33){logger[_0xb8ab('0x39')](_0x58ff33[_0xb8ab('0x3c')]);});}function main(_0xf32136,_0x272de0,_0x5421ef,_0x4ef2ed){logger[_0xb8ab('0x3d')](_0xb8ab('0x42'),_0xf32136,JSON[_0xb8ab('0x43')](_0x272de0));process[_0xb8ab('0x44')](_0xb8ab('0x45'));var _0x3e2a69=_0x272de0[_0xb8ab('0x46')];var _0x483bf6=_0x272de0[_0xb8ab('0x47')];var _0x3742b5=path[_0xb8ab('0x14')](config[_0xb8ab('0x48')],_0xb8ab('0x49'),_0x483bf6+'.csv');var _0xd77a67=_[_0xb8ab('0x32')](_0x3e2a69)[_0xb8ab('0x14')]();logger['info'](_0xb8ab('0x4a'),_0xd77a67);fs[_0xb8ab('0x4b')](_0x3742b5,_0xd77a67+'\x0a');Papa[_0xb8ab('0x4c')](fs[_0xb8ab('0x4d')](_0xf32136),{'header':!![],'skipEmptyLines':!![],'step':function(_0x57089b,_0x514299){try{for(var _0x307f87=0x0,_0x1f6f8f=[];_0x307f87<_0x57089b[_0xb8ab('0x4e')][_0xb8ab('0x4f')];_0x307f87++){stats[_0xb8ab('0x50')]+=0x1;if(_0x57089b[_0xb8ab('0x3a')][_0x307f87]){handleError(_0x57089b[_0xb8ab('0x4e')][_0x307f87],_0x57089b[_0xb8ab('0x3a')][_0x307f87]);}else{var _0x3a12de=[];for(var _0x337c8b in _0x3e2a69){if(_0x3e2a69[_0xb8ab('0x51')](_0x337c8b)){if(_0x57089b[_0xb8ab('0x4e')][_0x307f87][_0x3e2a69[_0x337c8b]]){var _0x5d41cd=_[_0xb8ab('0x52')](_0x57089b[_0xb8ab('0x4e')][_0x307f87][_0x3e2a69[_0x337c8b]][_0xb8ab('0x53')](/"/g,'\x27'));switch(_0x337c8b){case _0xb8ab('0x1d'):var _0x1f0366=moment(_0x5d41cd,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x1f0366['isValid']()){_0x1f6f8f[_0xb8ab('0x54')]('\x22'+_0x5d41cd+'\x22');}else{_0x3a12de['push'](_0xb8ab('0x55'));}break;case _0xb8ab('0x22'):var _0x4ea3cd=parseInt(_0x5d41cd);_0x5d41cd=_['isNaN'](_0x4ea3cd)||_0x4ea3cd<0x0||_0x4ea3cd>0x4?_0x4ef2ed?0x3:0x2:_0x4ea3cd;_0x1f6f8f[_0xb8ab('0x54')]('\x22'+_0x5d41cd+'\x22');break;case _0xb8ab('0x56'):var _0x27b230=parseInt(_0x5d41cd);if(_[_0xb8ab('0x57')](_0x27b230)&&_[_0xb8ab('0x58')](_0x5421ef,_0x27b230)){_0x1f6f8f[_0xb8ab('0x54')]('\x22'+_0x27b230+'\x22');}else{_0x3a12de[_0xb8ab('0x54')](_0xb8ab('0x59'));}break;case _0xb8ab('0x5a'):if(isEmail(_0x5d41cd)){_0x1f6f8f[_0xb8ab('0x54')]('\x22'+_0x5d41cd+'\x22');}else{_0x3a12de['push']('email\x20wrong\x20format');}break;case _0xb8ab('0x5b'):var _0x4eaa20=moment(_0x5d41cd,_0xb8ab('0x5c'),!![]);if(_0x4eaa20[_0xb8ab('0x5d')]()){_0x1f6f8f[_0xb8ab('0x54')]('\x22'+_0x5d41cd+'\x22');}else{_0x3a12de[_0xb8ab('0x54')](_0xb8ab('0x5e'));}break;default:_0x1f6f8f['push']('\x22'+_0x5d41cd+'\x22');}}else{switch(_0x337c8b){case'firstName':case _0xb8ab('0xf'):_0x3a12de[_0xb8ab('0x54')](_0x337c8b+_0xb8ab('0x5f'));break;default:_0x1f6f8f[_0xb8ab('0x54')]('\x22\x22');}}}}if(_0x3a12de['length']){handleError(_0x57089b[_0xb8ab('0x4e')][_0x307f87],{'code':_0xb8ab('0x60'),'message':_0x3a12de[_0xb8ab('0x14')]()});}else{fs[_0xb8ab('0x61')](_0x3742b5,_0x1f6f8f[_0xb8ab('0x14')]()+'\x0a');}_0x1f6f8f=[];}if(!(stats[_0xb8ab('0x50')]%0xc8)){socket[_0xb8ab('0x62')](_0xb8ab('0x63')+_0x483bf6,stats);stats[_0xb8ab('0x3a')]=[];}}if(stopped){logger[_0xb8ab('0x3d')](_0xb8ab('0x64'));_0x514299[_0xb8ab('0x65')]();}}catch(_0x3f0bd7){handleError(_0x57089b[_0xb8ab('0x4e')][_0x307f87],{'code':_0xb8ab('0x66'),'message':_0x3f0bd7['message']});logger[_0xb8ab('0x39')](_0xb8ab('0x67'),_0x3f0bd7[_0xb8ab('0x3c')]);}},'complete':function(){try{var _0x467400=[];var _0x25b697=_0xb8ab('0x23');if(_0x272de0[_0xb8ab('0x68')]&&_0x272de0[_0xb8ab('0x68')][_0xb8ab('0x4f')]){_0x25b697=_0xb8ab('0x69')+_0x483bf6;_0x467400[_0xb8ab('0x54')](_0xb8ab('0x6a')+_0x25b697+_0xb8ab('0x6b'));}var _0x5660c6=util[_0xb8ab('0xb')](_0xb8ab('0x6c'),_0x3742b5,_0x25b697,_0xd77a67,_0x272de0[_0xb8ab('0x1f')],_0x272de0[_0xb8ab('0x33')]||null,NOW,NOW);if(_[_0xb8ab('0x6d')](_0x3e2a69[_0xb8ab('0x1d')])){_0x5660c6+=_0xb8ab('0x6e');}_0x467400[_0xb8ab('0x54')](_0x5660c6);if(_0x272de0[_0xb8ab('0x68')]&&_0x272de0[_0xb8ab('0x68')][_0xb8ab('0x4f')]){_0x467400[_0xb8ab('0x54')](insertCmContact(_0x272de0[_0xb8ab('0x1f')],_0x25b697,_0x272de0[_0xb8ab('0x68')],_0x3e2a69));_0x467400[_0xb8ab('0x54')](_0xb8ab('0x6f')+_0x25b697+';');}_0x467400[_0xb8ab('0x54')](insertCmHopper(_0x272de0['ListId'],_0xb8ab('0x70'),'voice_queues',_0xb8ab('0x71'),_0x4ef2ed));_0x467400[_0xb8ab('0x54')](insertCmHopperBlack(_0x272de0[_0xb8ab('0x1f')],_0xb8ab('0x72'),_0xb8ab('0x73'),'VoiceQueueId'));_0x467400['push'](insertCmHopper(_0x272de0[_0xb8ab('0x1f')],_0xb8ab('0x74'),_0xb8ab('0x75'),_0xb8ab('0x76'),_0x4ef2ed));_0x467400[_0xb8ab('0x54')](insertCmHopperBlack(_0x272de0[_0xb8ab('0x1f')],_0xb8ab('0x77'),_0xb8ab('0x75'),_0xb8ab('0x76')));BPromise[_0xb8ab('0x78')](_0x467400,handleQuery)[_0xb8ab('0x79')](function(_0x40ba34){stats['finish']=!![];stats['affectedRows']=_0x272de0[_0xb8ab('0x68')]&&_0x272de0['duplicates'][_0xb8ab('0x4f')]?results[0x2][_0xb8ab('0x7a')]:results[0x0][_0xb8ab('0x7a')];socket[_0xb8ab('0x62')]('contact:import:'+_0x483bf6,stats);fs[_0xb8ab('0x7b')](_0xf32136);fs['unlink'](_0x3742b5);process[_0xb8ab('0x7c')](0x0);})[_0xb8ab('0x41')](function(_0x291f7c){logger['error'](_0x291f7c[_0xb8ab('0x3c')]);process[_0xb8ab('0x7c')](0x1);});}catch(_0x4f2484){logger['error'](_0xb8ab('0x7d'),_0x4f2484[_0xb8ab('0x3c')]);process[_0xb8ab('0x7c')](0x1);}},'error':function(_0x51f411,_0x14f0b1,_0x19f654,_0x3903af){throw new Error(_0x3903af);}});}function validate(){if(process[_0xb8ab('0x7e')]&&process[_0xb8ab('0x7e')][_0xb8ab('0x4f')]<0x4){throw new Error(_0xb8ab('0x7f'));}var _0x282c6b=path[_0xb8ab('0x14')](config[_0xb8ab('0x48')],_0xb8ab('0x49'),process['argv'][0x2]);if(!fs['existsSync'](_0x282c6b)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x59902a={};try{_0x59902a=JSON[_0xb8ab('0x4c')](process[_0xb8ab('0x7e')][0x3]);if(!_0x59902a['binding']){throw new Error(_0xb8ab('0x80'));}if(!_0x59902a[_0xb8ab('0x46')][_0xb8ab('0xf')]){throw new Error(_0xb8ab('0x81'));}if(!_0x59902a[_0xb8ab('0x46')]['firstName']){throw new Error(_0xb8ab('0x82'));}var _0x5b8446=0x0;if(_0x59902a['binding'][_0xb8ab('0x56')]){_0x5b8446=0x1;}if(!_0x59902a['ListId']){throw new Error(_0xb8ab('0x83'));}}catch(_0x34d9ea){throw new Error(_0xb8ab('0x84'));}var _0x56a38a=[];try{_0x56a38a=_[_0xb8ab('0x85')](JSON['parse'](process[_0xb8ab('0x7e')][0x4]),'id');}catch(_0x257d6f){logger[_0xb8ab('0x3d')](_0xb8ab('0x86'));}main(_0x282c6b,_0x59902a,_0x56a38a,_0x5b8446);}validate();process['on'](_0xb8ab('0x87'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index d024573..35ea1cc 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 _0x7708=['Caller\x20Number','keyValue','Caller\x20Name','calleridname','destexten','Queue','queue','uniqueid','Date','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','Agent\x20Ring','agentcalledAt','Agent\x20Connect','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','starttime','Answer\x20Time','answertime','Complete\x20Time','duration','Billable\x20Time','billableseconds','getSubjects','toLowerCase','inbound','variable','push','calleridnum','outbound','string','Outbound\x20Call','destcalleridnum','getDescriptions','voice','***\x20Call\x20Info\x20***'];(function(_0x4f240d,_0x13a89a){var _0x5b92cc=function(_0x33fb91){while(--_0x33fb91){_0x4f240d['push'](_0x4f240d['shift']());}};_0x5b92cc(++_0x13a89a);}(_0x7708,0x188));var _0x8770=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0x7708[_0x102ff9];return _0x24fa97;};'use strict';exports[_0x8770('0x0')]=function(_0x24909b,_0x5ce108){var _0x141ddf=[{'type':'string','content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x24909b['toLowerCase']()){case'voice':switch(_0x5ce108[_0x8770('0x1')]()){case _0x8770('0x2'):_0x141ddf['push']({'type':_0x8770('0x3'),'content':'','variableName':'queue'});_0x141ddf[_0x8770('0x4')]({'type':_0x8770('0x3'),'content':'','variableName':_0x8770('0x5')});break;case _0x8770('0x6'):_0x141ddf[_0x8770('0x4')]({'type':_0x8770('0x7'),'content':_0x8770('0x8'),'variableName':null});_0x141ddf['push']({'type':_0x8770('0x3'),'content':'','variableName':_0x8770('0x9')});break;}}return _0x141ddf;};exports[_0x8770('0xa')]=function(_0x4e4551,_0x390af0){var _0x10e4a3=[];switch(_0x4e4551[_0x8770('0x1')]()){case _0x8770('0xb'):switch(_0x390af0['toLowerCase']()){case _0x8770('0x2'):_0x10e4a3=[{'type':_0x8770('0x7'),'content':_0x8770('0xc'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x8770('0xd'),'keyType':_0x8770('0x3'),'variableName':_0x8770('0x5')},{'type':_0x8770('0xe'),'content':'','key':_0x8770('0xf'),'keyType':_0x8770('0x3'),'variableName':_0x8770('0x10')},{'type':_0x8770('0xe'),'content':'','key':'Call\x20To','keyType':_0x8770('0x3'),'variableName':_0x8770('0x11')},{'type':'keyValue','content':'','key':_0x8770('0x12'),'keyType':'variable','variableName':_0x8770('0x13')},{'type':'keyValue','content':'','key':'UniqueId','keyType':'variable','variableName':_0x8770('0x14')},{'type':_0x8770('0xe'),'content':'','key':_0x8770('0x15'),'keyType':_0x8770('0x3'),'variableName':'agentcalledAt'},{'type':'string','content':_0x8770('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0x8770('0xe'),'content':'','key':_0x8770('0x17'),'keyType':_0x8770('0x3'),'variableName':_0x8770('0x18')},{'type':'keyValue','content':'','key':_0x8770('0x19'),'keyType':_0x8770('0x3'),'variableName':_0x8770('0x9')},{'type':_0x8770('0x7'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x8770('0x1a'),'keyType':_0x8770('0x3'),'variableName':_0x8770('0x1b')},{'type':_0x8770('0xe'),'content':'','key':_0x8770('0x1c'),'keyType':_0x8770('0x3'),'variableName':'agentconnectAt'},{'type':_0x8770('0xe'),'content':'','key':_0x8770('0x1d'),'keyType':_0x8770('0x3'),'variableName':_0x8770('0x1e')},{'type':'keyValue','content':'','key':_0x8770('0x1f'),'keyType':'variable','variableName':_0x8770('0x20')},{'type':_0x8770('0xe'),'content':'','key':_0x8770('0x21'),'keyType':_0x8770('0x3'),'variableName':_0x8770('0x22')}];break;case _0x8770('0x6'):_0x10e4a3=[{'type':_0x8770('0x7'),'content':_0x8770('0xc'),'variableName':null},{'type':_0x8770('0xe'),'content':'','key':_0x8770('0x23'),'keyType':'variable','keyContent':'','variableName':_0x8770('0x9')},{'type':_0x8770('0xe'),'content':'','key':_0x8770('0x24'),'keyType':_0x8770('0x3'),'keyContent':'','variableName':_0x8770('0x25')},{'type':_0x8770('0xe'),'content':'','key':'UniqueId','keyType':'variable','keyContent':'','variableName':_0x8770('0x14')},{'type':_0x8770('0xe'),'content':'','key':_0x8770('0x15'),'keyType':_0x8770('0x3'),'keyContent':'','variableName':_0x8770('0x26')},{'type':'string','content':'***\x20Time\x20Info\x20***'},{'type':_0x8770('0xe'),'content':'','key':_0x8770('0x27'),'keyType':_0x8770('0x3'),'keyContent':'','variableName':_0x8770('0x28')},{'type':'keyValue','content':'','key':_0x8770('0x29'),'keyType':'variable','keyContent':'','variableName':'endtime'},{'type':_0x8770('0xe'),'content':'','key':'Duration','keyType':_0x8770('0x3'),'keyContent':'','variableName':_0x8770('0x2a')},{'type':_0x8770('0xe'),'content':'','key':_0x8770('0x2b'),'keyType':_0x8770('0x3'),'keyContent':'','variableName':_0x8770('0x2c')}];break;}}return _0x10e4a3;}; \ No newline at end of file +var _0xfff0=['agentconnectAt','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','destcalleridnum','Member\x20Name','membername','uniqueid','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','billableseconds','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','queue','variable','outbound','string','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Name','calleridname','UniqueId','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xfff0,0x139));var _0x0fff=function(_0x95a588,_0x3c4938){_0x95a588=_0x95a588-0x0;var _0x304d9e=_0xfff0[_0x95a588];return _0x304d9e;};'use strict';exports['getSubjects']=function(_0x960312,_0x2b95e0){var _0x148db8=[{'type':'string','content':_0x0fff('0x0'),'variableName':null}];switch(_0x960312[_0x0fff('0x1')]()){case _0x0fff('0x2'):switch(_0x2b95e0['toLowerCase']()){case _0x0fff('0x3'):_0x148db8[_0x0fff('0x4')]({'type':'variable','content':'','variableName':_0x0fff('0x5')});_0x148db8[_0x0fff('0x4')]({'type':_0x0fff('0x6'),'content':'','variableName':'calleridnum'});break;case _0x0fff('0x7'):_0x148db8['push']({'type':_0x0fff('0x8'),'content':'Outbound\x20Call','variableName':null});_0x148db8[_0x0fff('0x4')]({'type':_0x0fff('0x6'),'content':'','variableName':'destcalleridnum'});break;}}return _0x148db8;};exports[_0x0fff('0x9')]=function(_0x377b2f,_0x1de923){var _0x289e01=[];switch(_0x377b2f[_0x0fff('0x1')]()){case _0x0fff('0x2'):switch(_0x1de923[_0x0fff('0x1')]()){case _0x0fff('0x3'):_0x289e01=[{'type':_0x0fff('0x8'),'content':_0x0fff('0xa'),'key':null,'keyType':null,'variableName':null},{'type':_0x0fff('0xb'),'content':'','key':'Caller\x20Number','keyType':_0x0fff('0x6'),'variableName':'calleridnum'},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0xc'),'keyType':_0x0fff('0x6'),'variableName':_0x0fff('0xd')},{'type':'keyValue','content':'','key':'Call\x20To','keyType':_0x0fff('0x6'),'variableName':'destexten'},{'type':'keyValue','content':'','key':'Queue','keyType':_0x0fff('0x6'),'variableName':_0x0fff('0x5')},{'type':'keyValue','content':'','key':_0x0fff('0xe'),'keyType':_0x0fff('0x6'),'variableName':'uniqueid'},{'type':'keyValue','content':'','key':'Date','keyType':_0x0fff('0x6'),'variableName':_0x0fff('0xf')},{'type':_0x0fff('0x8'),'content':_0x0fff('0x10'),'key':null,'keyType':null,'variableName':null},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x11'),'keyType':'variable','variableName':_0x0fff('0x12')},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x13'),'keyType':'variable','variableName':'destcalleridnum'},{'type':_0x0fff('0x8'),'content':_0x0fff('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x15'),'keyType':'variable','variableName':_0x0fff('0xf')},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x16'),'keyType':_0x0fff('0x6'),'variableName':_0x0fff('0x17')},{'type':_0x0fff('0xb'),'content':'','key':'Agent\x20Complete','keyType':_0x0fff('0x6'),'variableName':_0x0fff('0x18')},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x19'),'keyType':_0x0fff('0x6'),'variableName':_0x0fff('0x1a')},{'type':'keyValue','content':'','key':_0x0fff('0x1b'),'keyType':_0x0fff('0x6'),'variableName':_0x0fff('0x1c')}];break;case _0x0fff('0x7'):_0x289e01=[{'type':_0x0fff('0x8'),'content':_0x0fff('0xa'),'variableName':null},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x1d'),'keyType':_0x0fff('0x6'),'keyContent':'','variableName':_0x0fff('0x1e')},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x1f'),'keyType':'variable','keyContent':'','variableName':_0x0fff('0x20')},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0xe'),'keyType':_0x0fff('0x6'),'keyContent':'','variableName':_0x0fff('0x21')},{'type':_0x0fff('0xb'),'content':'','key':'Date','keyType':_0x0fff('0x6'),'keyContent':'','variableName':_0x0fff('0x22')},{'type':_0x0fff('0x8'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x23'),'keyType':'variable','keyContent':'','variableName':_0x0fff('0x24')},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x25'),'keyType':_0x0fff('0x6'),'keyContent':'','variableName':_0x0fff('0x26')},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x27'),'keyType':_0x0fff('0x6'),'keyContent':'','variableName':_0x0fff('0x28')},{'type':_0x0fff('0xb'),'content':'','key':'Billable\x20Time','keyType':_0x0fff('0x6'),'keyContent':'','variableName':_0x0fff('0x29')}];break;}}return _0x289e01;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 6e84a7b..a5f9404 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 _0xd9d9=['name','stringify','then','catch','error','tracked','user','query','clone','body','omit','html','phone','fax','mobile','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','toUpperCase'];(function(_0x56bc53,_0x9b9958){var _0x4a9487=function(_0x4664cf){while(--_0x4664cf){_0x56bc53['push'](_0x56bc53['shift']());}};_0x4a9487(++_0x9b9958);}(_0xd9d9,0x11d));var _0x9d9d=function(_0x414655,_0x79d916){_0x414655=_0x414655-0x0;var _0x237884=_0xd9d9[_0x414655];return _0x237884;};'use strict';var _=require('lodash');var db=require(_0x9d9d('0x0'))['db'];var loggers={'openchannel':require(_0x9d9d('0x1'))(_0x9d9d('0x2')),'mail':require(_0x9d9d('0x1'))(_0x9d9d('0x3')),'fax':require(_0x9d9d('0x1'))(_0x9d9d('0x4')),'sms':require(_0x9d9d('0x1'))('sms-interactions'),'chat':require('../../config/logger')(_0x9d9d('0x5')),'whatsapp':require('../../config/logger')(_0x9d9d('0x6'))};function getInteractionId(_0x577bb3,_0x2d05bb,_0x2d1419){if(_0x577bb3&&_0x577bb3[_[_0x9d9d('0x7')](_0x2d1419)+'InteractionId']){return _0x577bb3[_[_0x9d9d('0x7')](_0x2d1419)+_0x9d9d('0x8')];}else if(_0x577bb3&&_0x577bb3['id']){return _0x577bb3['id'];}else if(_0x2d05bb&&_0x2d05bb['id']){return _0x2d05bb['id'];}else{return _0x9d9d('0x9');}}function log(_0x51b244,_0x53b543,_0x39c9e1,_0x72ed8b,_0xc3674c,_0x561fc2){loggers[_0xc3674c[_0x9d9d('0xa')]()][_0x51b244]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x561fc2[_0x9d9d('0xb')](),_0x53b543?_0x53b543['id']:null,_0x53b543?_0x53b543[_0x9d9d('0xc')]:null,_0x53b543?_0x53b543['role']:null,getInteractionId(_0x39c9e1,_0x72ed8b,_0xc3674c),_0x39c9e1?JSON[_0x9d9d('0xd')](_0x39c9e1):'null');}function updateUser(_0x5e0dda,_0x4609f4,_0x41ba97,_0x491c71,_0x2fe736){db[_[_0x9d9d('0x7')](_0x491c71)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x4609f4,_0x41ba97,_0x491c71)}})[_0x9d9d('0xe')](function(_0x4f81e1){if(_0x4f81e1){return _0x4f81e1['update']({'UserId':_0x5e0dda?_0x5e0dda['id']:null});}})['then'](function(_0x367ab0){if(_0x367ab0){log('info',_0x5e0dda,_0x4609f4,_0x41ba97,_0x491c71,_0x2fe736);}})[_0x9d9d('0xf')](function(){log(_0x9d9d('0x10'),_0x5e0dda,_0x4609f4,_0x41ba97,_0x491c71,_0x2fe736);});}exports[_0x9d9d('0x11')]=function(_0x27bbb3,_0x530ad4){return function(_0xb21adf,_0x7825d4,_0x302071){var _0x435f06=_0xb21adf[_0x9d9d('0x12')];var _0x52b7fb={};var _0x38bc09=_0xb21adf[_0x9d9d('0x13')];if(_0x52b7fb){_0x52b7fb=_[_0x9d9d('0x14')](_0xb21adf[_0x9d9d('0x15')]);_0x52b7fb=_[_0x9d9d('0x16')](_0x52b7fb,[_0x9d9d('0x15'),_0x9d9d('0x17'),_0x9d9d('0x18'),_0x9d9d('0x19'),_0x9d9d('0x1a')]);}updateUser(_0x435f06,_0x52b7fb,_0x38bc09,_0x27bbb3,_0x530ad4);_0x302071(null);};}; \ No newline at end of file +var _0xf3a7=['query','clone','body','omit','html','phone','fax','mobile','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','null','Interaction','then','update','info','catch','tracked'];(function(_0x302d1a,_0x387081){var _0xd82ca=function(_0x24912b){while(--_0x24912b){_0x302d1a['push'](_0x302d1a['shift']());}};_0xd82ca(++_0x387081);}(_0xf3a7,0x99));var _0x7f3a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf3a7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var db=require(_0x7f3a('0x0'))['db'];var loggers={'openchannel':require(_0x7f3a('0x1'))(_0x7f3a('0x2')),'mail':require(_0x7f3a('0x1'))(_0x7f3a('0x3')),'fax':require(_0x7f3a('0x1'))(_0x7f3a('0x4')),'sms':require(_0x7f3a('0x1'))(_0x7f3a('0x5')),'chat':require(_0x7f3a('0x1'))('chat-interactions'),'whatsapp':require(_0x7f3a('0x1'))(_0x7f3a('0x6'))};function getInteractionId(_0x2a7d66,_0x2c6b8b,_0x1dd804){if(_0x2a7d66&&_0x2a7d66[_[_0x7f3a('0x7')](_0x1dd804)+_0x7f3a('0x8')]){return _0x2a7d66[_['upperFirst'](_0x1dd804)+_0x7f3a('0x8')];}else if(_0x2a7d66&&_0x2a7d66['id']){return _0x2a7d66['id'];}else if(_0x2c6b8b&&_0x2c6b8b['id']){return _0x2c6b8b['id'];}else{return _0x7f3a('0x9');}}function log(_0x59a5dc,_0x5abe24,_0x265fb7,_0x2c9726,_0x5e8521,_0xe9c398){loggers[_0x5e8521['toLowerCase']()][_0x59a5dc](_0x7f3a('0xa'),_0xe9c398['toUpperCase'](),_0x5abe24?_0x5abe24['id']:null,_0x5abe24?_0x5abe24[_0x7f3a('0xb')]:null,_0x5abe24?_0x5abe24[_0x7f3a('0xc')]:null,getInteractionId(_0x265fb7,_0x2c9726,_0x5e8521),_0x265fb7?JSON[_0x7f3a('0xd')](_0x265fb7):_0x7f3a('0xe'));}function updateUser(_0x46b8e3,_0x1ac26c,_0x3edf35,_0x14c307,_0x42b28f){db[_['upperFirst'](_0x14c307)+_0x7f3a('0xf')]['findOne']({'where':{'id':getInteractionId(_0x1ac26c,_0x3edf35,_0x14c307)}})[_0x7f3a('0x10')](function(_0x238e50){if(_0x238e50){return _0x238e50[_0x7f3a('0x11')]({'UserId':_0x46b8e3?_0x46b8e3['id']:null});}})[_0x7f3a('0x10')](function(_0x22112c){if(_0x22112c){log(_0x7f3a('0x12'),_0x46b8e3,_0x1ac26c,_0x3edf35,_0x14c307,_0x42b28f);}})[_0x7f3a('0x13')](function(){log('error',_0x46b8e3,_0x1ac26c,_0x3edf35,_0x14c307,_0x42b28f);});}exports[_0x7f3a('0x14')]=function(_0x1a9dab,_0x512762){return function(_0x2eefb1,_0x2f46fb,_0x235e64){var _0xe5faef=_0x2eefb1['user'];var _0x5a678d={};var _0x2d2164=_0x2eefb1[_0x7f3a('0x15')];if(_0x5a678d){_0x5a678d=_[_0x7f3a('0x16')](_0x2eefb1[_0x7f3a('0x17')]);_0x5a678d=_[_0x7f3a('0x18')](_0x5a678d,['body',_0x7f3a('0x19'),_0x7f3a('0x1a'),_0x7f3a('0x1b'),_0x7f3a('0x1c')]);}updateUser(_0xe5faef,_0x5a678d,_0x2d2164,_0x1a9dab,_0x512762);_0x235e64(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index e192339..5e3a295 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 _0x1142=['then','count','status','catch','User','admin','isUserLimit','crypto','util','composable-middleware','../../mysqldb','license','createDecipher','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','findOne'];(function(_0x1d8f95,_0xcd1d0e){var _0x4cb618=function(_0xddea13){while(--_0xddea13){_0x1d8f95['push'](_0x1d8f95['shift']());}};_0x4cb618(++_0xcd1d0e);}(_0x1142,0x16f));var _0x2114=function(_0x42eb0a,_0x24f2a1){_0x42eb0a=_0x42eb0a-0x0;var _0x47ced7=_0x1142[_0x42eb0a];return _0x47ced7;};'use strict';var crypto=require(_0x2114('0x0'));var util=require(_0x2114('0x1'));var compose=require(_0x2114('0x2'));var db=require(_0x2114('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x414277,_0x46010b){if(_0x414277&&_0x46010b){if(_0x46010b['data1']&&_0x46010b[_0x2114('0x4')]){var _0x15638f=_0x46010b['data1'];var _0x62c37e=_0x46010b['license'];var _0x34bf4a=_0x15638f['split']('-')[0x4];var _0x203858=_0x15638f['split']('-')[0x0];var _0x48b57f=crypto[_0x2114('0x5')]('aes-256-ctr',util[_0x2114('0x6')](_0x2114('0x7'),_0x34bf4a,_0x15638f,_0x203858));var _0x5dfc18=_0x48b57f[_0x2114('0x8')](_0x62c37e,_0x2114('0x9'),_0x2114('0xa'));_0x5dfc18+=_0x48b57f[_0x2114('0xb')](_0x2114('0xa'));var _0x241dc6=JSON[_0x2114('0xc')](_0x5dfc18);return _0x241dc6[_0x2114('0xd')](_0x414277)?_0x241dc6[_0x414277]:null;}}return null;}function isLimit(_0x1e7149,_0x15f03e,_0x40c9b2,_0x45ed96){var _0x53e0b2=_0x15f03e;return compose()[_0x2114('0xe')](function(_0x409aa8,_0x5404cc,_0x3420b2){return db[_0x2114('0xf')][_0x2114('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x2114('0x11')](function(_0x5330ff){var _0x400122=getValueFromLicense(_0x1e7149,_0x5330ff);return _0x400122?_0x400122:_0x53e0b2;})['then'](function(_0x1203cd){_0x53e0b2=_0x1203cd;return _0x40c9b2[_0x2114('0x12')](_0x45ed96);})[_0x2114('0x11')](function(_0x471ff4){if(_0x471ff4>=_0x53e0b2){return _0x5404cc[_0x2114('0x13')](0x193)['json']({'message':util[_0x2114('0x6')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x1e7149)});}_0x3420b2();})[_0x2114('0x14')](function(_0x1292d3){_0x3420b2(_0x1292d3);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x2114('0x15')],{'where':{'$or':[{'role':_0x2114('0x16')},{'role':'user'}]}});}exports[_0x2114('0x17')]=isUserLimit; \ No newline at end of file +var _0xf204=['hasOwnProperty','use','License','findOne','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','user','crypto','util','composable-middleware','../../mysqldb','data1','license','aes-256-ctr','format','%s:%s:%s','base64','utf8','parse'];(function(_0x54b062,_0x264bb5){var _0x255e41=function(_0x3c7e6f){while(--_0x3c7e6f){_0x54b062['push'](_0x54b062['shift']());}};_0x255e41(++_0x264bb5);}(_0xf204,0x14d));var _0x4f20=function(_0x379ab0,_0x34dfe1){_0x379ab0=_0x379ab0-0x0;var _0x3ccfbb=_0xf204[_0x379ab0];return _0x3ccfbb;};'use strict';var crypto=require(_0x4f20('0x0'));var util=require(_0x4f20('0x1'));var compose=require(_0x4f20('0x2'));var db=require(_0x4f20('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x31837d,_0x4af1fa){if(_0x31837d&&_0x4af1fa){if(_0x4af1fa[_0x4f20('0x4')]&&_0x4af1fa[_0x4f20('0x5')]){var _0x36cae9=_0x4af1fa['data1'];var _0x40bdfc=_0x4af1fa[_0x4f20('0x5')];var _0x36a102=_0x36cae9['split']('-')[0x4];var _0x54057a=_0x36cae9['split']('-')[0x0];var _0x30f75d=crypto['createDecipher'](_0x4f20('0x6'),util[_0x4f20('0x7')](_0x4f20('0x8'),_0x36a102,_0x36cae9,_0x54057a));var _0x200af4=_0x30f75d['update'](_0x40bdfc,_0x4f20('0x9'),_0x4f20('0xa'));_0x200af4+=_0x30f75d['final']('utf8');var _0x4c30b6=JSON[_0x4f20('0xb')](_0x200af4);return _0x4c30b6[_0x4f20('0xc')](_0x31837d)?_0x4c30b6[_0x31837d]:null;}}return null;}function isLimit(_0x3c1b4e,_0x14bf6c,_0xfbcdd3,_0x44eb3d){var _0x4f6044=_0x14bf6c;return compose()[_0x4f20('0xd')](function(_0x2f84be,_0x566d74,_0x477712){return db[_0x4f20('0xe')][_0x4f20('0xf')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x3c5111){var _0x219d24=getValueFromLicense(_0x3c1b4e,_0x3c5111);return _0x219d24?_0x219d24:_0x4f6044;})[_0x4f20('0x10')](function(_0x5dc483){_0x4f6044=_0x5dc483;return _0xfbcdd3[_0x4f20('0x11')](_0x44eb3d);})[_0x4f20('0x10')](function(_0x3e72b5){if(_0x3e72b5>=_0x4f6044){return _0x566d74[_0x4f20('0x12')](0x193)['json']({'message':util[_0x4f20('0x7')](_0x4f20('0x13'),_0x3c1b4e)});}_0x477712();})[_0x4f20('0x14')](function(_0x2b0884){_0x477712(_0x2b0884);});});}function isUserLimit(){return isLimit(_0x4f20('0x15'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0x4f20('0x16')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 4af63e6..f45f2da 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 _0x572f=['format','YYYY-MM-DD','castTo','text','CAST(','\x20AS\x20','field','includes','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','$ne','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','$gte','>=\x20?','$between','start','utcOffset','add','minutes','seconds','moment','parseSearch','sqlOperator','startsWith','replace','[$and]','length','split','slice','forEach','shift','match','filter','map','buildExpression','operator','value','$lte','days'];(function(_0x351509,_0x54725c){var _0x4e9861=function(_0x54f92c){while(--_0x54f92c){_0x351509['push'](_0x351509['shift']());}};_0x4e9861(++_0x54725c);}(_0x572f,0x195));var _0xf572=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x572f[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var moment=require(_0xf572('0x0'));exports[_0xf572('0x1')]=function(_0x5c76e4){var _0x576ca7={'conditions':[]};_0x576ca7[_0xf572('0x2')]=_[_0xf572('0x3')](_0x5c76e4,'[$or]')?'or':'and';var _0x57dcb=_0x5c76e4[_0xf572('0x4')](_0xf572('0x5'),'')['replace']('[$or]','')['split']('||');for(var _0x13829e=0x0;_0x13829e<_0x57dcb[_0xf572('0x6')];_0x13829e++){var _0x488a88=_0x57dcb[_0x13829e][_0xf572('0x7')](':=');var _0x7d149e=_0x488a88[0x0];var _0x595958=_0x488a88[_0xf572('0x8')](0x1);_0x595958[_0xf572('0x9')](function(_0x4b447c){var _0xdeae41=_0x4b447c['split']('[')[_0xf572('0xa')]();var _0x38d643=_0x4b447c[_0xf572('0xb')](/\[(.*?)\]/g);_0x38d643[_0xf572('0x9')](function(_0x293536){var _0x4c70fc=_0x293536[_0xf572('0x7')]('[')[_0xf572('0xc')](function(_0x53edef){return _0x53edef['indexOf'](']')>-0x1;})[_0xf572('0xd')](function(_0x47ebc2){return _0x47ebc2[_0xf572('0x7')](']')[0x0];})[0x0];_0x576ca7['conditions']['push']({'field':_0x7d149e,'operator':_0xdeae41,'value':_0x4c70fc});});});}return _0x576ca7;};exports[_0xf572('0xe')]=function(_0x55f089,_0x2117f1,_0x19b7f1){var _0x4e2bd0={};if(_0x2117f1==='DATE'){if(_0x19b7f1[_0xf572('0xf')]==='$eq'){_0x19b7f1[_0xf572('0xf')]='$between';_0x19b7f1['value']+=','+_0x19b7f1[_0xf572('0x10')];}else if(_['includes'](['$gt',_0xf572('0x11')],_0x19b7f1[_0xf572('0xf')])){_0x19b7f1[_0xf572('0x10')]=moment(_0x19b7f1[_0xf572('0x10')])['add'](0x1,_0xf572('0x12'))[_0xf572('0x13')](_0xf572('0x14'));}}if(_0x19b7f1[_0xf572('0x15')]){_0x2117f1=_0x19b7f1[_0xf572('0x15')];_0x4e2bd0[_0xf572('0x16')]=_0xf572('0x17')+_0x55f089+'.'+_0x19b7f1['field']+_0xf572('0x18')+_0x19b7f1[_0xf572('0x15')]+')\x20'+parseOperator(_0x19b7f1[_0xf572('0xf')]);}else{_0x4e2bd0['text']=_0x55f089+'.'+_0x19b7f1[_0xf572('0x19')]+'\x20'+parseOperator(_0x19b7f1['operator']);}if(_[_0xf572('0x1a')](['$ne',_0xf572('0x1b')],_0x19b7f1[_0xf572('0xf')]))_0x4e2bd0[_0xf572('0x16')]='('+_0x4e2bd0[_0xf572('0x16')]+_0xf572('0x1c')+_0x55f089+'.'+_0x19b7f1[_0xf572('0x19')]+_0xf572('0x1d');_0x4e2bd0['value']=parseValue(_0x2117f1,_0x19b7f1[_0xf572('0xf')],_0x19b7f1[_0xf572('0x10')]);return _0x4e2bd0;};function parseOperator(_0x761a0b){var _0x18f343;switch(_0x761a0b){case _0xf572('0x1e'):_0x18f343=_0xf572('0x1f');break;case _0xf572('0x1b'):_0x18f343=_0xf572('0x20');break;case _0xf572('0x21'):_0x18f343=_0xf572('0x22');break;case _0xf572('0x23'):_0x18f343=_0xf572('0x24');break;case _0xf572('0x25'):case _0xf572('0x26'):case _0xf572('0x27'):_0x18f343=_0xf572('0x28');break;case _0xf572('0x29'):_0x18f343=_0xf572('0x2a');break;case _0xf572('0x2b'):_0x18f343=_0xf572('0x2c');break;case _0xf572('0x11'):_0x18f343='<=\x20?';break;case _0xf572('0x2d'):_0x18f343=_0xf572('0x2e');break;case _0xf572('0x2f'):_0x18f343='BETWEEN\x20?\x20AND\x20?';break;}return _0x18f343;}function parseValue(_0x318bc2,_0x41b112,_0x153557){var _0x592959={'start':undefined,'end':undefined};switch(_0x41b112){case _0xf572('0x1e'):case _0xf572('0x1b'):_0x592959[_0xf572('0x30')]=_0x153557['split'](',');break;case _0xf572('0x25'):_0x592959[_0xf572('0x30')]='%'+_0x153557+'%';break;case _0xf572('0x26'):_0x592959[_0xf572('0x30')]=_0x153557+'%';break;case _0xf572('0x27'):_0x592959[_0xf572('0x30')]='%'+_0x153557;break;case'$between':var _0x303098=_0x153557[_0xf572('0x7')](',');var _0x153557=_0x303098['shift']();var _0x36a5d6=_0x303098['pop']();if(_0x318bc2==='DATE'){_0x153557=moment(_0x153557)[_0xf572('0x31')](0x0,!![])[_0xf572('0x13')]();_0x36a5d6=moment(_0x36a5d6)[_0xf572('0x31')](0x0,!![])[_0xf572('0x32')](0x17,'hours')['add'](0x3b,_0xf572('0x33'))[_0xf572('0x32')](0x3b,_0xf572('0x34'))['format']();}_0x592959={'start':_0x153557,'end':_0x36a5d6};break;default:_0x592959['start']=_0x153557;break;}return _0x592959;} \ No newline at end of file +var _0x0aad=['YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','includes','$ne','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','=\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','$gt','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','$notIn','start','$endsWith','pop','utcOffset','add','hours','minutes','seconds','moment','sqlOperator','startsWith','[$or]','and','replace','[$and]','slice','forEach','split','shift','match','indexOf','map','conditions','DATE','operator','$eq','$between','value','$lte','days','format'];(function(_0x202d43,_0x47dc6d){var _0x2e77af=function(_0x1eefeb){while(--_0x1eefeb){_0x202d43['push'](_0x202d43['shift']());}};_0x2e77af(++_0x47dc6d);}(_0x0aad,0x16a));var _0xd0aa=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0aad[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var moment=require(_0xd0aa('0x0'));exports['parseSearch']=function(_0x224ba2){var _0x3469e4={'conditions':[]};_0x3469e4[_0xd0aa('0x1')]=_[_0xd0aa('0x2')](_0x224ba2,_0xd0aa('0x3'))?'or':_0xd0aa('0x4');var _0x47c75c=_0x224ba2[_0xd0aa('0x5')](_0xd0aa('0x6'),'')['replace'](_0xd0aa('0x3'),'')['split']('||');for(var _0x4c6497=0x0;_0x4c6497<_0x47c75c['length'];_0x4c6497++){var _0x3042d8=_0x47c75c[_0x4c6497]['split'](':=');var _0x3612e3=_0x3042d8[0x0];var _0x1be0d5=_0x3042d8[_0xd0aa('0x7')](0x1);_0x1be0d5[_0xd0aa('0x8')](function(_0x41d5ad){var _0x446b07=_0x41d5ad[_0xd0aa('0x9')]('[')[_0xd0aa('0xa')]();var _0x57a2dc=_0x41d5ad[_0xd0aa('0xb')](/\[(.*?)\]/g);_0x57a2dc['forEach'](function(_0x19de80){var _0x5c41ae=_0x19de80[_0xd0aa('0x9')]('[')['filter'](function(_0x580529){return _0x580529[_0xd0aa('0xc')](']')>-0x1;})[_0xd0aa('0xd')](function(_0x52cc6b){return _0x52cc6b['split'](']')[0x0];})[0x0];_0x3469e4[_0xd0aa('0xe')]['push']({'field':_0x3612e3,'operator':_0x446b07,'value':_0x5c41ae});});});}return _0x3469e4;};exports['buildExpression']=function(_0x535ae9,_0xdfbe48,_0x16566b){var _0x5b9a9c={};if(_0xdfbe48===_0xd0aa('0xf')){if(_0x16566b[_0xd0aa('0x10')]===_0xd0aa('0x11')){_0x16566b[_0xd0aa('0x10')]=_0xd0aa('0x12');_0x16566b[_0xd0aa('0x13')]+=','+_0x16566b[_0xd0aa('0x13')];}else if(_['includes'](['$gt',_0xd0aa('0x14')],_0x16566b[_0xd0aa('0x10')])){_0x16566b[_0xd0aa('0x13')]=moment(_0x16566b[_0xd0aa('0x13')])['add'](0x1,_0xd0aa('0x15'))[_0xd0aa('0x16')](_0xd0aa('0x17'));}}if(_0x16566b[_0xd0aa('0x18')]){_0xdfbe48=_0x16566b[_0xd0aa('0x18')];_0x5b9a9c[_0xd0aa('0x19')]=_0xd0aa('0x1a')+_0x535ae9+'.'+_0x16566b[_0xd0aa('0x1b')]+_0xd0aa('0x1c')+_0x16566b[_0xd0aa('0x18')]+')\x20'+parseOperator(_0x16566b[_0xd0aa('0x10')]);}else{_0x5b9a9c[_0xd0aa('0x19')]=_0x535ae9+'.'+_0x16566b['field']+'\x20'+parseOperator(_0x16566b[_0xd0aa('0x10')]);}if(_[_0xd0aa('0x1d')]([_0xd0aa('0x1e'),'$notIn'],_0x16566b[_0xd0aa('0x10')]))_0x5b9a9c['text']='('+_0x5b9a9c[_0xd0aa('0x19')]+_0xd0aa('0x1f')+_0x535ae9+'.'+_0x16566b['field']+_0xd0aa('0x20');_0x5b9a9c[_0xd0aa('0x13')]=parseValue(_0xdfbe48,_0x16566b['operator'],_0x16566b[_0xd0aa('0x13')]);return _0x5b9a9c;};function parseOperator(_0x46ef0a){var _0x189baf;switch(_0x46ef0a){case'$in':_0x189baf=_0xd0aa('0x21');break;case'$notIn':_0x189baf=_0xd0aa('0x22');break;case _0xd0aa('0x11'):_0x189baf=_0xd0aa('0x23');break;case _0xd0aa('0x1e'):_0x189baf='<>\x20?';break;case _0xd0aa('0x24'):case _0xd0aa('0x25'):case'$endsWith':_0x189baf=_0xd0aa('0x26');break;case _0xd0aa('0x27'):_0x189baf=_0xd0aa('0x28');break;case _0xd0aa('0x29'):_0x189baf='>\x20?';break;case _0xd0aa('0x14'):_0x189baf=_0xd0aa('0x2a');break;case'$gte':_0x189baf=_0xd0aa('0x2b');break;case _0xd0aa('0x12'):_0x189baf=_0xd0aa('0x2c');break;}return _0x189baf;}function parseValue(_0x499f71,_0x25a3f2,_0x2e7178){var _0xdd4ab8={'start':undefined,'end':undefined};switch(_0x25a3f2){case _0xd0aa('0x2d'):case _0xd0aa('0x2e'):_0xdd4ab8[_0xd0aa('0x2f')]=_0x2e7178[_0xd0aa('0x9')](',');break;case _0xd0aa('0x24'):_0xdd4ab8['start']='%'+_0x2e7178+'%';break;case _0xd0aa('0x25'):_0xdd4ab8[_0xd0aa('0x2f')]=_0x2e7178+'%';break;case _0xd0aa('0x30'):_0xdd4ab8['start']='%'+_0x2e7178;break;case _0xd0aa('0x12'):var _0x45adc3=_0x2e7178[_0xd0aa('0x9')](',');var _0x2e7178=_0x45adc3[_0xd0aa('0xa')]();var _0x28f9f3=_0x45adc3[_0xd0aa('0x31')]();if(_0x499f71===_0xd0aa('0xf')){_0x2e7178=moment(_0x2e7178)['utcOffset'](0x0,!![])[_0xd0aa('0x16')]();_0x28f9f3=moment(_0x28f9f3)[_0xd0aa('0x32')](0x0,!![])[_0xd0aa('0x33')](0x17,_0xd0aa('0x34'))['add'](0x3b,_0xd0aa('0x35'))['add'](0x3b,_0xd0aa('0x36'))['format']();}_0xdd4ab8={'start':_0x2e7178,'end':_0x28f9f3};break;default:_0xdd4ab8[_0xd0aa('0x2f')]=_0x2e7178;break;}return _0xdd4ab8;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 7986ad2..4a71895 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 _0x12e0=['isEmail','getFullTextValue','forEach','replace','includes','push','join','sequelize','moment','fields','split','filters','forOwn','DATE','parse','$gte','format','YYYY-MM-DD','$lte','subtract','name','uniqueid','isArray','limit','offset','sort','map','indexOf','cast','col','priority','unsigned','substr','DESC','ASC','omit','isEmpty','length','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$'];(function(_0x3349fe,_0x111770){var _0x3f8bc5=function(_0x370a1b){while(--_0x370a1b){_0x3349fe['push'](_0x3349fe['shift']());}};_0x3f8bc5(++_0x111770);}(_0x12e0,0x88));var _0x012e=function(_0x42dbb4,_0x2c3b51){_0x42dbb4=_0x42dbb4-0x0;var _0x56f04f=_0x12e0[_0x42dbb4];return _0x56f04f;};'use strict';var _=require('lodash');var sequelize=require(_0x012e('0x0'));var moment=require(_0x012e('0x1'));var LIMIT_VALUE=0xfa;exports[_0x012e('0x2')]=function(_0x461d65){var _0x518dba=null;if(_0x461d65){_0x518dba=_0x461d65[_0x012e('0x3')](',');}return _0x518dba;};exports[_0x012e('0x4')]=function(_0x238a5e,_0x2baf97){var _0x26865f={};if(!_['isEmpty'](_0x238a5e)){_[_0x012e('0x5')](_0x238a5e,function(_0x463fb3,_0x438afb){try{if(_0x2baf97){var _0x3abb6a=_['find'](_0x2baf97,{'name':_0x438afb})||{};if(_0x3abb6a['type']===_0x012e('0x6')&&_['isPlainObject'](_0x463fb3)){var _0x34c685=JSON[_0x012e('0x7')](_0x463fb3);var _0x42e37f={'$gte':moment(moment(_0x34c685[_0x012e('0x8')])[_0x012e('0x9')](_0x012e('0xa')))['utc']()[_0x012e('0x9')](),'$lte':moment(moment(_0x34c685[_0x012e('0xb')])[_0x012e('0x9')](_0x012e('0xa')))['utc']()[_0x012e('0xc')](0x1,'s')[_0x012e('0x9')]()};_0x26865f[_0x438afb]=_0x42e37f;}else if(_0x3abb6a[_0x012e('0xd')]===_0x012e('0xe')){_0x26865f[_0x438afb]=_0x463fb3;}else{_0x26865f[_0x438afb]=_[_0x012e('0xf')](_0x463fb3)?_0x463fb3:JSON[_0x012e('0x7')](_0x463fb3);}}else{_0x26865f[_0x438afb]=_[_0x012e('0xf')](_0x463fb3)?_0x463fb3:JSON[_0x012e('0x7')](_0x463fb3);}}catch(_0x3060b5){_0x26865f[_0x438afb]=_0x463fb3[_0x012e('0x3')](',');}});}return _0x26865f;};exports[_0x012e('0x10')]=function(_0x3c7e49){_0x3c7e49=parseInt(_0x3c7e49,0xa);if(!_0x3c7e49||_0x3c7e49<0x0){_0x3c7e49=LIMIT_VALUE;}return _0x3c7e49;};exports[_0x012e('0x11')]=function(_0x4f29d1){_0x4f29d1=parseInt(_0x4f29d1,0xa);if(!_0x4f29d1||_0x4f29d1<0x0){_0x4f29d1=0x0;}return _0x4f29d1;};exports[_0x012e('0x12')]=function(_0xbfde50){var _0x1228b4,_0x294c2c=null;if(_0xbfde50){_0x1228b4=_0xbfde50[_0x012e('0x3')](',');_0x294c2c=_[_0x012e('0x13')](_0x1228b4,function(_0xd34189){if(_0xd34189[_0x012e('0x14')]('-')===0x0){return[_0xd34189==='priority'?sequelize[_0x012e('0x15')](sequelize[_0x012e('0x16')](_0x012e('0x17')),_0x012e('0x18')):_0xd34189[_0x012e('0x19')](0x1),_0x012e('0x1a')];}else{return[_0xd34189==='priority'?sequelize['cast'](sequelize['col'](_0x012e('0x17')),'unsigned'):_0xd34189,_0x012e('0x1b')];}});}return _0x294c2c;};exports[_0x012e('0x1c')]=function(_0x1fc9b3,_0x430619){if(_[_0x012e('0x1d')](_0x1fc9b3)){return _0x1fc9b3;}if(_[_0x012e('0xf')](_0x1fc9b3)){for(var _0x30b67c=0x0;_0x30b67c<_0x1fc9b3[_0x012e('0x1e')];_0x30b67c+=0x1){_0x1fc9b3[_0x30b67c]=this['omit'](_0x1fc9b3[_0x30b67c],_0x430619);}return _0x1fc9b3;}if(!_['isObject'](_0x1fc9b3)){return _0x1fc9b3;}if(_['isString'](_0x430619)){_0x430619=[_0x430619];}if(!_['isArray'](_0x430619)){return _0x1fc9b3;}for(var _0x440c5a=0x0;_0x440c5a<_0x430619['length'];_0x440c5a+=0x1){_[_0x012e('0x1f')](_0x1fc9b3,_0x430619[_0x440c5a]);}for(var _0x250aef in _0x1fc9b3){if(_0x1fc9b3[_0x012e('0x20')](_0x250aef)){_0x1fc9b3[_0x250aef]=this[_0x012e('0x1c')](_0x1fc9b3[_0x250aef],_0x430619);}}return _0x1fc9b3;};exports[_0x012e('0x21')]=function(_0x2015fe){return _0x2015fe[_0x012e('0x22')](RegExp(_0x012e('0x23')))?!![]:![];};exports[_0x012e('0x24')]=function(_0x4dc749){return _0x4dc749[_0x012e('0x22')](/^\S+@\S+$/)?!![]:![];};exports[_0x012e('0x25')]=function(_0x4ba92d){var _0x397f13=[];_0x4ba92d['split'](/[ ,]+/)[_0x012e('0x26')](function(_0xfa3db4){_0xfa3db4=_0xfa3db4[_0x012e('0x27')](/([^:]")"+/g,'$1');_0xfa3db4='+'+_0xfa3db4+'*';if(_0xfa3db4[_0x012e('0x28')]('@'))_0xfa3db4='\x22'+_0xfa3db4+'\x22';_0x397f13[_0x012e('0x29')](_0xfa3db4);});return _0x397f13[_0x012e('0x2a')]('\x20');}; \ No newline at end of file +var _0x9cad=['DESC','omit','isEmpty','length','isObject','isString','unset','isNumeric','isEmail','match','getFullTextValue','forEach','replace','includes','push','join','moment','fields','split','filters','find','type','DATE','isPlainObject','parse','$gte','YYYY-MM-DD','utc','$lte','format','name','uniqueid','isArray','map','indexOf','priority','cast','col','unsigned','substr'];(function(_0x421216,_0x2b81c9){var _0x4f9d5c=function(_0x54a147){while(--_0x54a147){_0x421216['push'](_0x421216['shift']());}};_0x4f9d5c(++_0x2b81c9);}(_0x9cad,0xd8));var _0xd9ca=function(_0x4afe3b,_0x255e0d){_0x4afe3b=_0x4afe3b-0x0;var _0x2c22d1=_0x9cad[_0x4afe3b];return _0x2c22d1;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require(_0xd9ca('0x0'));var LIMIT_VALUE=0xfa;exports[_0xd9ca('0x1')]=function(_0x10c2d8){var _0x137b0b=null;if(_0x10c2d8){_0x137b0b=_0x10c2d8[_0xd9ca('0x2')](',');}return _0x137b0b;};exports[_0xd9ca('0x3')]=function(_0x1a9b72,_0x260390){var _0x775865={};if(!_['isEmpty'](_0x1a9b72)){_['forOwn'](_0x1a9b72,function(_0xda11b9,_0x1b8d85){try{if(_0x260390){var _0x473d2e=_[_0xd9ca('0x4')](_0x260390,{'name':_0x1b8d85})||{};if(_0x473d2e[_0xd9ca('0x5')]===_0xd9ca('0x6')&&_[_0xd9ca('0x7')](_0xda11b9)){var _0x5bb31f=JSON[_0xd9ca('0x8')](_0xda11b9);var _0x1a510a={'$gte':moment(moment(_0x5bb31f[_0xd9ca('0x9')])['format'](_0xd9ca('0xa')))[_0xd9ca('0xb')]()['format'](),'$lte':moment(moment(_0x5bb31f[_0xd9ca('0xc')])[_0xd9ca('0xd')](_0xd9ca('0xa')))[_0xd9ca('0xb')]()['subtract'](0x1,'s')[_0xd9ca('0xd')]()};_0x775865[_0x1b8d85]=_0x1a510a;}else if(_0x473d2e[_0xd9ca('0xe')]===_0xd9ca('0xf')){_0x775865[_0x1b8d85]=_0xda11b9;}else{_0x775865[_0x1b8d85]=_[_0xd9ca('0x10')](_0xda11b9)?_0xda11b9:JSON[_0xd9ca('0x8')](_0xda11b9);}}else{_0x775865[_0x1b8d85]=_[_0xd9ca('0x10')](_0xda11b9)?_0xda11b9:JSON[_0xd9ca('0x8')](_0xda11b9);}}catch(_0x46bdfd){_0x775865[_0x1b8d85]=_0xda11b9[_0xd9ca('0x2')](',');}});}return _0x775865;};exports['limit']=function(_0x30fe69){_0x30fe69=parseInt(_0x30fe69,0xa);if(!_0x30fe69||_0x30fe69<0x0){_0x30fe69=LIMIT_VALUE;}return _0x30fe69;};exports['offset']=function(_0x29236c){_0x29236c=parseInt(_0x29236c,0xa);if(!_0x29236c||_0x29236c<0x0){_0x29236c=0x0;}return _0x29236c;};exports['sort']=function(_0x37e36c){var _0x46e4ff,_0x5deb17=null;if(_0x37e36c){_0x46e4ff=_0x37e36c[_0xd9ca('0x2')](',');_0x5deb17=_[_0xd9ca('0x11')](_0x46e4ff,function(_0x7aef94){if(_0x7aef94[_0xd9ca('0x12')]('-')===0x0){return[_0x7aef94===_0xd9ca('0x13')?sequelize[_0xd9ca('0x14')](sequelize[_0xd9ca('0x15')](_0xd9ca('0x13')),_0xd9ca('0x16')):_0x7aef94[_0xd9ca('0x17')](0x1),_0xd9ca('0x18')];}else{return[_0x7aef94===_0xd9ca('0x13')?sequelize[_0xd9ca('0x14')](sequelize[_0xd9ca('0x15')]('priority'),'unsigned'):_0x7aef94,'ASC'];}});}return _0x5deb17;};exports[_0xd9ca('0x19')]=function(_0x5ce5b9,_0x473254){if(_[_0xd9ca('0x1a')](_0x5ce5b9)){return _0x5ce5b9;}if(_[_0xd9ca('0x10')](_0x5ce5b9)){for(var _0x2866cf=0x0;_0x2866cf<_0x5ce5b9[_0xd9ca('0x1b')];_0x2866cf+=0x1){_0x5ce5b9[_0x2866cf]=this[_0xd9ca('0x19')](_0x5ce5b9[_0x2866cf],_0x473254);}return _0x5ce5b9;}if(!_[_0xd9ca('0x1c')](_0x5ce5b9)){return _0x5ce5b9;}if(_[_0xd9ca('0x1d')](_0x473254)){_0x473254=[_0x473254];}if(!_[_0xd9ca('0x10')](_0x473254)){return _0x5ce5b9;}for(var _0xbe3f38=0x0;_0xbe3f38<_0x473254[_0xd9ca('0x1b')];_0xbe3f38+=0x1){_[_0xd9ca('0x1e')](_0x5ce5b9,_0x473254[_0xbe3f38]);}for(var _0x11019c in _0x5ce5b9){if(_0x5ce5b9['hasOwnProperty'](_0x11019c)){_0x5ce5b9[_0x11019c]=this[_0xd9ca('0x19')](_0x5ce5b9[_0x11019c],_0x473254);}}return _0x5ce5b9;};exports[_0xd9ca('0x1f')]=function(_0x38e972){return _0x38e972['match'](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0xd9ca('0x20')]=function(_0x2df73a){return _0x2df73a[_0xd9ca('0x21')](/^\S+@\S+$/)?!![]:![];};exports[_0xd9ca('0x22')]=function(_0xc67f92){var _0x11b74f=[];_0xc67f92[_0xd9ca('0x2')](/[ ,]+/)[_0xd9ca('0x23')](function(_0x4d236e){_0x4d236e=_0x4d236e[_0xd9ca('0x24')](/([^:]")"+/g,'$1');_0x4d236e='+'+_0x4d236e+'*';if(_0x4d236e[_0xd9ca('0x25')]('@'))_0x4d236e='\x22'+_0x4d236e+'\x22';_0x11b74f[_0xd9ca('0x26')](_0x4d236e);});return _0x11b74f[_0xd9ca('0x27')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 20ab886..3a1379c 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f15=['static','views','engine','html','ejs','urlencoded','50mb','json','initialize','serve-favicon','body-parser','cookie-parser','errorhandler','passport','cors','moment','../mysqldb','default','get','env','production','set','appPath','join','root','public','test','client','use','split'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x2f15,0xbd));var _0x52f1=function(_0x4e5b7c,_0x291c10){_0x4e5b7c=_0x4e5b7c-0x0;var _0x2c89af=_0x2f15[_0x4e5b7c];return _0x2c89af;};'use strict';var express=require('express');var favicon=require(_0x52f1('0x0'));var bodyParser=require(_0x52f1('0x1'));var methodOverride=require('method-override');var cookieParser=require(_0x52f1('0x2'));var errorHandler=require(_0x52f1('0x3'));var path=require('path');var passport=require(_0x52f1('0x4'));var cors=require(_0x52f1('0x5'));var moment=require(_0x52f1('0x6'));var config=require('./environment');var db=require(_0x52f1('0x7'))['db'];exports[_0x52f1('0x8')]=function(_0x320149){var _0x2ee936=_0x320149[_0x52f1('0x9')](_0x52f1('0xa'));if(_0x2ee936===_0x52f1('0xb')){_0x320149[_0x52f1('0xc')](_0x52f1('0xd'),path[_0x52f1('0xe')](config[_0x52f1('0xf')],_0x52f1('0x10')));}if(_0x2ee936==='development'||_0x2ee936===_0x52f1('0x11')){_0x320149[_0x52f1('0xc')](_0x52f1('0xd'),path['join'](config[_0x52f1('0xf')],_0x52f1('0x12')));_0x320149[_0x52f1('0x13')](errorHandler());}_0x320149[_0x52f1('0xc')]('json\x20replacer',function(_0x453e70,_0x1ce514){if(this[_0x453e70]instanceof Date){_0x1ce514=this[_0x453e70]['toISOString']()[_0x52f1('0x14')]('.')[0x0]+'Z';}return _0x1ce514;});_0x320149['use'](express[_0x52f1('0x15')](_0x320149[_0x52f1('0x9')](_0x52f1('0xd'))));_0x320149['set'](_0x52f1('0x16'),config[_0x52f1('0xf')]+'/server/views');_0x320149[_0x52f1('0x17')](_0x52f1('0x18'),require(_0x52f1('0x19'))['renderFile']);_0x320149[_0x52f1('0xc')]('view\x20engine','html');_0x320149[_0x52f1('0x13')](bodyParser[_0x52f1('0x1a')]({'limit':_0x52f1('0x1b'),'extended':!![]}));_0x320149[_0x52f1('0x13')](bodyParser[_0x52f1('0x1c')]({'limit':'50mb'}));_0x320149[_0x52f1('0x13')](cors());_0x320149['use'](methodOverride());_0x320149[_0x52f1('0x13')](cookieParser());_0x320149[_0x52f1('0x13')](passport[_0x52f1('0x1d')]());}; \ No newline at end of file +var _0xa809=['passport','moment','./environment','../mysqldb','get','env','production','set','appPath','join','root','public','development','test','use','json\x20replacer','toISOString','split','static','views','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','50mb','json','initialize','express','serve-favicon','method-override','errorhandler','path'];(function(_0x44dff6,_0x5d385b){var _0x396551=function(_0xe0f820){while(--_0xe0f820){_0x44dff6['push'](_0x44dff6['shift']());}};_0x396551(++_0x5d385b);}(_0xa809,0xf0));var _0x9a80=function(_0x40da45,_0x29029f){_0x40da45=_0x40da45-0x0;var _0x29f717=_0xa809[_0x40da45];return _0x29f717;};'use strict';var express=require(_0x9a80('0x0'));var favicon=require(_0x9a80('0x1'));var bodyParser=require('body-parser');var methodOverride=require(_0x9a80('0x2'));var cookieParser=require('cookie-parser');var errorHandler=require(_0x9a80('0x3'));var path=require(_0x9a80('0x4'));var passport=require(_0x9a80('0x5'));var cors=require('cors');var moment=require(_0x9a80('0x6'));var config=require(_0x9a80('0x7'));var db=require(_0x9a80('0x8'))['db'];exports['default']=function(_0x1178af){var _0x4b5b0c=_0x1178af[_0x9a80('0x9')](_0x9a80('0xa'));if(_0x4b5b0c===_0x9a80('0xb')){_0x1178af[_0x9a80('0xc')](_0x9a80('0xd'),path[_0x9a80('0xe')](config[_0x9a80('0xf')],_0x9a80('0x10')));}if(_0x4b5b0c===_0x9a80('0x11')||_0x4b5b0c===_0x9a80('0x12')){_0x1178af['set']('appPath',path['join'](config[_0x9a80('0xf')],'client'));_0x1178af[_0x9a80('0x13')](errorHandler());}_0x1178af['set'](_0x9a80('0x14'),function(_0x10454f,_0x4e03fc){if(this[_0x10454f]instanceof Date){_0x4e03fc=this[_0x10454f][_0x9a80('0x15')]()[_0x9a80('0x16')]('.')[0x0]+'Z';}return _0x4e03fc;});_0x1178af[_0x9a80('0x13')](express[_0x9a80('0x17')](_0x1178af[_0x9a80('0x9')](_0x9a80('0xd'))));_0x1178af['set'](_0x9a80('0x18'),config[_0x9a80('0xf')]+_0x9a80('0x19'));_0x1178af[_0x9a80('0x1a')](_0x9a80('0x1b'),require(_0x9a80('0x1c'))[_0x9a80('0x1d')]);_0x1178af[_0x9a80('0xc')](_0x9a80('0x1e'),'html');_0x1178af[_0x9a80('0x13')](bodyParser[_0x9a80('0x1f')]({'limit':_0x9a80('0x20'),'extended':!![]}));_0x1178af[_0x9a80('0x13')](bodyParser[_0x9a80('0x21')]({'limit':_0x9a80('0x20')}));_0x1178af[_0x9a80('0x13')](cors());_0x1178af['use'](methodOverride());_0x1178af[_0x9a80('0x13')](cookieParser());_0x1178af['use'](passport[_0x9a80('0x22')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 0170e9d..53dd5f1 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 _0x9589=['127.0.0.1','getFirstInterface','orderBy','cpus','map','model','createHash','update','hex','getUuid','platform','win32','utf8','replace','macAddress','ipAddress','md5','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','keys','length','filter','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address'];(function(_0x3130d8,_0x3cd28f){var _0x337c46=function(_0x43e8de){while(--_0x43e8de){_0x3130d8['push'](_0x3130d8['shift']());}};_0x337c46(++_0x3cd28f);}(_0x9589,0xbc));var _0x9958=function(_0x582b38,_0x3dc3a4){_0x582b38=_0x582b38-0x0;var _0x2614a9=_0x9589[_0x582b38];return _0x2614a9;};'use strict';var _=require(_0x9958('0x0'));var os=require('os');var crypto=require(_0x9958('0x1'));var machine=require(_0x9958('0x2'));var exec=require(_0x9958('0x3'))[_0x9958('0x4')];function getInterfaces(){var _0x5f379e=[];var _0x3eec38=os[_0x9958('0x5')]();var _0xe7c0e=_['orderBy'](_[_0x9958('0x6')](_0x3eec38));for(var _0xcc753a=0x0;_0xcc753a<_0xe7c0e[_0x9958('0x7')];_0xcc753a++){var _0x52386d=_0x3eec38[_0xe7c0e[_0xcc753a]][_0x9958('0x8')](function(_0x2c3eaf){return _0x2c3eaf['family']===_0x9958('0x9')&&_0x2c3eaf[_0x9958('0xa')]===![];});_0x5f379e=_0x5f379e[_0x9958('0xb')](_0x52386d);}return _0x5f379e;}function getFirstInterface(){var _0xdeddab=_[_0x9958('0xc')](getInterfaces());return{'macAddress':_0xdeddab&&_0xdeddab[_0x9958('0xd')]?_0xdeddab[_0x9958('0xd')]:_0x9958('0xe'),'ipAddress':_0xdeddab&&_0xdeddab[_0x9958('0xf')]?_0xdeddab[_0x9958('0xf')]:_0x9958('0x10')};}exports[_0x9958('0x11')]=getFirstInterface;function getCPUhash(){var _0x242f1b=_[_0x9958('0x12')](os[_0x9958('0x13')]()[_0x9958('0x14')](function(_0x3649c0){return _0x3649c0[_0x9958('0x15')];}))['join'](':');return crypto[_0x9958('0x16')]('md5')[_0x9958('0x17')](_0x242f1b)['digest'](_0x9958('0x18'));}exports[_0x9958('0x19')]=function(){switch(os[_0x9958('0x1a')]()){case _0x9958('0x1b'):return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x9958('0x1c')})[_0x9958('0x1d')]('\x0d\x0a','');default:var _0x5caedb=getFirstInterface();var _0x5638c5=getCPUhash();var _0x1e3397=_0x5638c5+'|'+os['hostname']()+'|'+_0x5caedb[_0x9958('0x1e')]+'|'+_0x5caedb[_0x9958('0x1f')];var _0x3c0b8b=crypto[_0x9958('0x16')](_0x9958('0x20'))[_0x9958('0x17')](_0x1e3397)['digest']('hex');return _0x3c0b8b[_0x9958('0x21')](0x0,0x8)+'-'+_0x3c0b8b['substring'](0x8,0xc)+'-'+_0x3c0b8b['substring'](0xc,0x10)+'-'+_0x3c0b8b[_0x9958('0x21')](0x10,0x14)+'-'+_0x3c0b8b['substring'](0x14);}}; \ No newline at end of file +var _0x98a8=['lodash','crypto','bimedia-machine-uuid','child_process','execSync','orderBy','keys','length','filter','family','internal','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','map','model','update','digest','hex','getUuid','platform','win32','utf8','macAddress','createHash','md5','substring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x98a8,0x12c));var _0x898a=function(_0xe4eb9a,_0x10c9e){_0xe4eb9a=_0xe4eb9a-0x0;var _0x10d039=_0x98a8[_0xe4eb9a];return _0x10d039;};'use strict';var _=require(_0x898a('0x0'));var os=require('os');var crypto=require(_0x898a('0x1'));var machine=require(_0x898a('0x2'));var exec=require(_0x898a('0x3'))[_0x898a('0x4')];function getInterfaces(){var _0x226db7=[];var _0x69c61f=os['networkInterfaces']();var _0x2bb3e2=_[_0x898a('0x5')](_[_0x898a('0x6')](_0x69c61f));for(var _0x101b7b=0x0;_0x101b7b<_0x2bb3e2[_0x898a('0x7')];_0x101b7b++){var _0x5d7e59=_0x69c61f[_0x2bb3e2[_0x101b7b]][_0x898a('0x8')](function(_0x564583){return _0x564583[_0x898a('0x9')]==='IPv4'&&_0x564583[_0x898a('0xa')]===![];});_0x226db7=_0x226db7[_0x898a('0xb')](_0x5d7e59);}return _0x226db7;}function getFirstInterface(){var _0x2101b3=_[_0x898a('0xc')](getInterfaces());return{'macAddress':_0x2101b3&&_0x2101b3[_0x898a('0xd')]?_0x2101b3[_0x898a('0xd')]:_0x898a('0xe'),'ipAddress':_0x2101b3&&_0x2101b3[_0x898a('0xf')]?_0x2101b3[_0x898a('0xf')]:'127.0.0.1'};}exports[_0x898a('0x10')]=getFirstInterface;function getCPUhash(){var _0x502e95=_[_0x898a('0x5')](os['cpus']()[_0x898a('0x11')](function(_0x2c76b7){return _0x2c76b7[_0x898a('0x12')];}))['join'](':');return crypto['createHash']('md5')[_0x898a('0x13')](_0x502e95)[_0x898a('0x14')](_0x898a('0x15'));}exports[_0x898a('0x16')]=function(){switch(os[_0x898a('0x17')]()){case _0x898a('0x18'):return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x898a('0x19')})['replace']('\x0d\x0a','');default:var _0x3fec7a=getFirstInterface();var _0x5c96a6=getCPUhash();var _0x303321=_0x5c96a6+'|'+os['hostname']()+'|'+_0x3fec7a[_0x898a('0x1a')]+'|'+_0x3fec7a['ipAddress'];var _0xee4408=crypto[_0x898a('0x1b')](_0x898a('0x1c'))['update'](_0x303321)[_0x898a('0x14')]('hex');return _0xee4408['substring'](0x0,0x8)+'-'+_0xee4408[_0x898a('0x1d')](0x8,0xc)+'-'+_0xee4408[_0x898a('0x1d')](0xc,0x10)+'-'+_0xee4408['substring'](0x10,0x14)+'-'+_0xee4408['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 3d7a85a..c04c5ba 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 _0xb8b7=['../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','data1','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','update','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware'];(function(_0x40b3f2,_0x2c4f5f){var _0x4ce90c=function(_0x516f31){while(--_0x516f31){_0x40b3f2['push'](_0x40b3f2['shift']());}};_0x4ce90c(++_0x2c4f5f);}(_0xb8b7,0x127));var _0x7b8b=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xb8b7[_0x341e0f];return _0x59555a;};'use strict';var util=require(_0x7b8b('0x0'));var moment=require(_0x7b8b('0x1'));var rp=require(_0x7b8b('0x2'));var BPromise=require(_0x7b8b('0x3'));var pkginfo=require(_0x7b8b('0x4'))(module,_0x7b8b('0x5'));var db=require(_0x7b8b('0x6'))['db'];var encryptor=require(_0x7b8b('0x7'));var hardware=require(_0x7b8b('0x8'));var logger=require(_0x7b8b('0x9'))(_0x7b8b('0xa'));var HOST=_0x7b8b('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x386dde){return new BPromise(function(_0x53c4f4,_0x192e93){var _0x3dd665=util[_0x7b8b('0xc')](_0x7b8b('0xd'),HOST,_0x386dde,module[_0x7b8b('0xe')][_0x7b8b('0x5')]);if(oldToken){_0x3dd665=util['format'](_0x7b8b('0xf'),HOST,_0x386dde,module[_0x7b8b('0xe')]['version'],oldToken);}var _0x4ace4e={'uri':_0x3dd665,'method':_0x7b8b('0x10'),'timeout':0xea60,'json':!![]};return rp(_0x4ace4e)[_0x7b8b('0x11')](function(_0x38b211){_0x53c4f4(_0x38b211);})[_0x7b8b('0x12')](function(_0x9ebf8d){_0x192e93(_0x9ebf8d);});});}function manageLicense(_0x115df1,_0x401380){var _0x4147ec=_0x401380['get']({'plain':!![]});if(!isOldTokenSent&&_0x4147ec[_0x7b8b('0x13')]!==_0x115df1&&!_0x4147ec[_0x7b8b('0x14')]){oldToken=_0x4147ec[_0x7b8b('0x13')];}httpRequest(_0x115df1)[_0x7b8b('0x11')](function(_0x2fa2ff){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2fa2ff['active']){isOldTokenSent=![];if(!_0x4147ec['license']&&_0x4147ec[_0x7b8b('0xa')]!=_0x2fa2ff[_0x7b8b('0xa')]||_0x4147ec[_0x7b8b('0xa')]&&_0x4147ec[_0x7b8b('0x14')]){logger[_0x7b8b('0x15')](_0x7b8b('0x16'));}if(_0x4147ec[_0x7b8b('0xa')]&&!_0x4147ec['data2']&&_0x4147ec['license']!=_0x2fa2ff[_0x7b8b('0xa')]){logger[_0x7b8b('0x15')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x4147ec['license']&&!_0x4147ec['data2']&&_0x4147ec['license']==_0x2fa2ff[_0x7b8b('0xa')]){return _0x401380;}return _0x401380['update']({'data1':_0x115df1,'data2':null,'license':_0x2fa2ff['license']});}else{if(_0x2fa2ff[_0x7b8b('0xa')]||_0x4147ec[_0x7b8b('0xa')]){if(!_0x4147ec[_0x7b8b('0x14')]){if(_0x4147ec[_0x7b8b('0x13')]==_0x115df1){GRAY_PERIOD_REASON='Disabled';logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4147ec[_0x7b8b('0x13')],_0x115df1);}logger['info'](_0x7b8b('0x17'),GRAY_PERIOD_REASON[_0x7b8b('0x18')](),moment()[_0x7b8b('0xc')]('YYYY-MM-DD\x20HH:mm'));return _0x401380[_0x7b8b('0x19')]({'data2':encryptor['encryptString'](moment()[_0x7b8b('0xc')](_0x7b8b('0x1a')))});}else{if(moment()[_0x7b8b('0x1b')](encryptor[_0x7b8b('0x1c')](_0x4147ec[_0x7b8b('0x14')]),_0x7b8b('0x1d'))>DAYS){logger[_0x7b8b('0x15')]('DEMO\x20START\x20AT\x20%s',moment()[_0x7b8b('0xc')](_0x7b8b('0x1a')));isOldTokenSent=![];return _0x401380['update']({'data1':_0x115df1,'data2':null,'license':null});}}}else{if(_0x4147ec[_0x7b8b('0x13')]!=_0x115df1){logger[_0x7b8b('0x15')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4147ec[_0x7b8b('0x13')],_0x115df1);return _0x401380[_0x7b8b('0x19')]({'data1':_0x115df1,'data2':null,'license':null});}}}return _0x401380;})[_0x7b8b('0x11')](function(_0x1c1cb1){_0x401380=_0x1c1cb1;})[_0x7b8b('0x12')](function(_0x38e891){logger[_0x7b8b('0x1e')](_0x38e891[_0x7b8b('0x1f')]);})[_0x7b8b('0x20')](function(){setTimeout(function(){manageLicense(hardware[_0x7b8b('0x21')](),_0x401380);},TIME);});}function defaultLicense(){var _0x4cc27a=hardware['getUuid']();if(_0x4cc27a){return db[_0x7b8b('0x22')][_0x7b8b('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x4cc27a}})[_0x7b8b('0x24')](function(_0x2ab26c,_0x5b10f8){logger[_0x7b8b('0x15')](_0x7b8b('0x25'),_0x4cc27a);manageLicense(_0x4cc27a,_0x2ab26c);})[_0x7b8b('0x12')](function(_0x101306){logger[_0x7b8b('0x1e')](_0x101306[_0x7b8b('0x1f')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x0a8c=['getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','request-promise','version','../logger','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','get','data1','data2','then','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','DEMO\x20START\x20AT\x20%s','message','finally'];(function(_0x4302b9,_0x43fc87){var _0x23e4f8=function(_0x2bf2ce){while(--_0x2bf2ce){_0x4302b9['push'](_0x4302b9['shift']());}};_0x23e4f8(++_0x43fc87);}(_0x0a8c,0xf1));var _0xc0a8=function(_0x1fdf54,_0x5a646f){_0x1fdf54=_0x1fdf54-0x0;var _0x4c5e64=_0x0a8c[_0x1fdf54];return _0x4c5e64;};'use strict';var util=require(_0xc0a8('0x0'));var moment=require('moment');var rp=require(_0xc0a8('0x1'));var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0xc0a8('0x2'));var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require(_0xc0a8('0x3'))('license');var HOST=_0xc0a8('0x4');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0xc9fecb){return new BPromise(function(_0x5b1777,_0x384a43){var _0x1ff909=util[_0xc0a8('0x5')]('%s/api/servers/%s/check?version=%s',HOST,_0xc9fecb,module[_0xc0a8('0x6')][_0xc0a8('0x2')]);if(oldToken){_0x1ff909=util['format'](_0xc0a8('0x7'),HOST,_0xc9fecb,module['exports'][_0xc0a8('0x2')],oldToken);}var _0x6f6b27={'uri':_0x1ff909,'method':_0xc0a8('0x8'),'timeout':0xea60,'json':!![]};return rp(_0x6f6b27)['then'](function(_0x407fc3){_0x5b1777(_0x407fc3);})[_0xc0a8('0x9')](function(_0x2a6d65){_0x384a43(_0x2a6d65);});});}function manageLicense(_0x5e1a48,_0x5e4f45){var _0x3ce694=_0x5e4f45[_0xc0a8('0xa')]({'plain':!![]});if(!isOldTokenSent&&_0x3ce694[_0xc0a8('0xb')]!==_0x5e1a48&&!_0x3ce694[_0xc0a8('0xc')]){oldToken=_0x3ce694[_0xc0a8('0xb')];}httpRequest(_0x5e1a48)[_0xc0a8('0xd')](function(_0x312dc4){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x312dc4[_0xc0a8('0xe')]){isOldTokenSent=![];if(!_0x3ce694[_0xc0a8('0xf')]&&_0x3ce694[_0xc0a8('0xf')]!=_0x312dc4['license']||_0x3ce694[_0xc0a8('0xf')]&&_0x3ce694[_0xc0a8('0xc')]){logger[_0xc0a8('0x10')](_0xc0a8('0x11'));}if(_0x3ce694[_0xc0a8('0xf')]&&!_0x3ce694[_0xc0a8('0xc')]&&_0x3ce694[_0xc0a8('0xf')]!=_0x312dc4[_0xc0a8('0xf')]){logger['info'](_0xc0a8('0x12'));}if(_0x3ce694[_0xc0a8('0xf')]&&!_0x3ce694[_0xc0a8('0xc')]&&_0x3ce694['license']==_0x312dc4['license']){return _0x5e4f45;}return _0x5e4f45[_0xc0a8('0x13')]({'data1':_0x5e1a48,'data2':null,'license':_0x312dc4[_0xc0a8('0xf')]});}else{if(_0x312dc4['license']||_0x3ce694['license']){if(!_0x3ce694[_0xc0a8('0xc')]){if(_0x3ce694[_0xc0a8('0xb')]==_0x5e1a48){GRAY_PERIOD_REASON=_0xc0a8('0x14');logger[_0xc0a8('0x10')](_0xc0a8('0x15'));}else{GRAY_PERIOD_REASON=_0xc0a8('0x16');logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3ce694['data1'],_0x5e1a48);}logger[_0xc0a8('0x10')](_0xc0a8('0x17'),GRAY_PERIOD_REASON[_0xc0a8('0x18')](),moment()['format'](_0xc0a8('0x19')));return _0x5e4f45[_0xc0a8('0x13')]({'data2':encryptor[_0xc0a8('0x1a')](moment()[_0xc0a8('0x5')](_0xc0a8('0x19')))});}else{if(moment()[_0xc0a8('0x1b')](encryptor['decryptString'](_0x3ce694[_0xc0a8('0xc')]),_0xc0a8('0x1c'))>DAYS){logger[_0xc0a8('0x10')](_0xc0a8('0x1d'),moment()[_0xc0a8('0x5')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x5e4f45['update']({'data1':_0x5e1a48,'data2':null,'license':null});}}}else{if(_0x3ce694[_0xc0a8('0xb')]!=_0x5e1a48){logger[_0xc0a8('0x10')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3ce694[_0xc0a8('0xb')],_0x5e1a48);return _0x5e4f45[_0xc0a8('0x13')]({'data1':_0x5e1a48,'data2':null,'license':null});}}}return _0x5e4f45;})[_0xc0a8('0xd')](function(_0x9114fd){_0x5e4f45=_0x9114fd;})[_0xc0a8('0x9')](function(_0x2d65a7){logger['error'](_0x2d65a7[_0xc0a8('0x1e')]);})[_0xc0a8('0x1f')](function(){setTimeout(function(){manageLicense(hardware[_0xc0a8('0x20')](),_0x5e4f45);},TIME);});}function defaultLicense(){var _0x1a7167=hardware[_0xc0a8('0x20')]();if(_0x1a7167){return db[_0xc0a8('0x21')][_0xc0a8('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0x1a7167}})[_0xc0a8('0x23')](function(_0x1e9669,_0x7872da){logger['info'](_0xc0a8('0x24'),_0x1a7167);manageLicense(_0x1a7167,_0x1e9669);})[_0xc0a8('0x9')](function(_0x113e04){logger[_0xc0a8('0x25')](_0x113e04[_0xc0a8('0x1e')]);});}}exports[_0xc0a8('0x26')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index e5eea58..b1a615d 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 _0x4d84=['changed','disabled','message','User','findAll','sequelize','COUNT','col','role','admin','user','telephone','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s','parse','demo','gray','deadline','add','days','format','grayReason','machineUuid'];(function(_0x1e1c1d,_0x11cd66){var _0x36bbdb=function(_0x2f19e0){while(--_0x2f19e0){_0x1e1c1d['push'](_0x1e1c1d['shift']());}};_0x36bbdb(++_0x11cd66);}(_0x4d84,0x1a2));var _0x44d8=function(_0x475574,_0x528747){_0x475574=_0x475574-0x0;var _0x1f90de=_0x4d84[_0x475574];return _0x1f90de;};'use strict';var util=require(_0x44d8('0x0'));var _=require(_0x44d8('0x1'));var moment=require(_0x44d8('0x2'));var BPromise=require(_0x44d8('0x3'));var hardware=require(_0x44d8('0x4'));var encryptor=require(_0x44d8('0x5'));var db=require(_0x44d8('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x44d8('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x44d8('0x8'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x44d8('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x44d8('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x239ae4){return new BPromise(function(_0x28003a,_0x3ef9e7){return db[_0x44d8('0xa')]['find'](_[_0x44d8('0xb')](_0x239ae4,{'raw':!![],'where':{'id':0x1}}))[_0x44d8('0xc')](function(_0x24ae82){return checkLicense(_0x24ae82,null);})[_0x44d8('0xc')](function(_0x3d9704){_0x28003a(_0x3d9704);return;})[_0x44d8('0xd')](function(_0x1974b4){_0x3ef9e7(_0x1974b4);});});}function checkLicense(_0x399b2b,_0xc09f63){if(!_0x399b2b){demoLicense[_0x44d8('0xe')]=_0x399b2b[_0x44d8('0xf')];return demoLicense;}try{var _0x5ea6cb=_0xc09f63||_0x399b2b[_0x44d8('0x10')];if(_[_0x44d8('0x11')](_0x5ea6cb)){throw new Error(_0x44d8('0x12'));}var _0x4714c1=_0x399b2b[_0x44d8('0xf')];var _0x1dd30d=_0x399b2b[_0x44d8('0x13')];var _0x353944=_0x4714c1[_0x44d8('0x14')]('-')[0x4];var _0x2b8e1e=_0x4714c1[_0x44d8('0x14')]('-')[0x0];var _0x54a785=encryptor[_0x44d8('0x15')](_0x5ea6cb,util['format'](_0x44d8('0x16'),_0x353944,_0x4714c1,_0x2b8e1e));var _0x51d96c=JSON[_0x44d8('0x17')](_0x54a785);_0x51d96c[_0x44d8('0x18')]=![];_0x51d96c[_0x44d8('0xe')]=_0x4714c1;_0x51d96c['machineUuid']=hardware['getUuid']();if(_0x1dd30d){var _0x25e527=encryptor[_0x44d8('0x15')](_0x1dd30d);_0x51d96c[_0x44d8('0x19')]=_0x25e527;_0x51d96c[_0x44d8('0x1a')]=moment(_0x25e527)[_0x44d8('0x1b')](0x7,_0x44d8('0x1c'))[_0x44d8('0x1d')]();_0x51d96c[_0x44d8('0x1e')]=_0x51d96c[_0x44d8('0xe')]!=_0x51d96c[_0x44d8('0x1f')]?_0x44d8('0x20'):_0x44d8('0x21');}return _0x51d96c;}catch(_0x1c9f2e){breakingLicense['uuid']=_0x399b2b[_0x44d8('0xf')];breakingLicense[_0x44d8('0x22')]=_0x1c9f2e['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x6e143f,_0x498ab3){getLicense()['then'](function(_0x3bb117){return db[_0x44d8('0x23')][_0x44d8('0x24')]({'attributes':['role',[db[_0x44d8('0x25')]['fn'](_0x44d8('0x26'),db[_0x44d8('0x25')][_0x44d8('0x27')](_0x44d8('0x28'))),'count']],'group':_0x44d8('0x28'),'where':{'role':{'$or':[_0x44d8('0x29'),_0x44d8('0x2a'),_0x44d8('0x2b')]}},'raw':!![]})[_0x44d8('0xc')](function(_0x3a244e){var _0x2e875f={'user':_0x3bb117['users']||0x0,'telephone':_0x3bb117[_0x44d8('0x2c')]||0x0};_0x3a244e[_0x44d8('0x2d')](function(_0x5ac8c1){var _0x11b6d9=_0x5ac8c1[_0x44d8('0x28')]===_0x44d8('0x29')?'user':_0x5ac8c1[_0x44d8('0x28')];_0x2e875f[_0x11b6d9]-=_0x5ac8c1['count'];if(_0x2e875f[_0x11b6d9]<0x0)_0x2e875f[_0x11b6d9]=0x0;});_0x6e143f(_0x2e875f);return;});})[_0x44d8('0xd')](function(_0x50f58f){_0x498ab3(_0x50f58f);});});}function checkUserLimits(_0x43bea1){return new BPromise(function(_0x524550,_0x11e8bb){getLimits()[_0x44d8('0xc')](function(_0x1aa997){var _0x57165e=_[_0x44d8('0x2e')](_[_0x44d8('0x2f')](_0x43bea1,_0x44d8('0x28')),[_0x44d8('0x29'),_0x44d8('0x2a'),_0x44d8('0x2b')]);var _0x4646a8=(_0x57165e['admin']||0x0)+(_0x57165e[_0x44d8('0x2a')]||0x0);var _0x26c104=_0x57165e[_0x44d8('0x2b')]||0x0;if(_0x4646a8>_0x1aa997[_0x44d8('0x2a')])return _0x11e8bb('License\x20limit\x20reached\x20for\x20users');if(_0x26c104>_0x1aa997['telephone'])return _0x11e8bb(_0x44d8('0x30'));return _0x524550();})[_0x44d8('0xd')](function(_0x5b3a37){_0x11e8bb(_0x5b3a37);});});}module[_0x44d8('0x31')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x0dc3=['findAll','sequelize','COUNT','col','count','role','forEach','admin','user','countBy','telephone','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','find','defaults','then','catch','data1','license','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s','demo','uuid','machineUuid','gray','deadline','add','days','grayReason','changed','message','User'];(function(_0x5c2829,_0x2e1482){var _0x4d6544=function(_0x63b01e){while(--_0x63b01e){_0x5c2829['push'](_0x5c2829['shift']());}};_0x4d6544(++_0x2e1482);}(_0x0dc3,0x65));var _0x30dc=function(_0xd0cd0b,_0x490956){_0xd0cd0b=_0xd0cd0b-0x0;var _0x59cced=_0x0dc3[_0xd0cd0b];return _0x59cced;};'use strict';var util=require(_0x30dc('0x0'));var _=require('lodash');var moment=require(_0x30dc('0x1'));var BPromise=require('bluebird');var hardware=require(_0x30dc('0x2'));var encryptor=require(_0x30dc('0x3'));var db=require(_0x30dc('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x30dc('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x30dc('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x30dc('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x30dc('0x7'),'machineUuid':hardware[_0x30dc('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x503a08){return new BPromise(function(_0x34081c,_0x46e827){return db[_0x30dc('0x8')][_0x30dc('0x9')](_[_0x30dc('0xa')](_0x503a08,{'raw':!![],'where':{'id':0x1}}))[_0x30dc('0xb')](function(_0x26f831){return checkLicense(_0x26f831,null);})[_0x30dc('0xb')](function(_0x2476f6){_0x34081c(_0x2476f6);return;})[_0x30dc('0xc')](function(_0x554d7d){_0x46e827(_0x554d7d);});});}function checkLicense(_0x1c00d4,_0x8f20f8){if(!_0x1c00d4){demoLicense['uuid']=_0x1c00d4[_0x30dc('0xd')];return demoLicense;}try{var _0x4dc2d9=_0x8f20f8||_0x1c00d4[_0x30dc('0xe')];if(_['isEmpty'](_0x4dc2d9)){throw new Error(_0x30dc('0xf'));}var _0xdfbe25=_0x1c00d4['data1'];var _0x2b5dae=_0x1c00d4[_0x30dc('0x10')];var _0x27d239=_0xdfbe25[_0x30dc('0x11')]('-')[0x4];var _0x3aa0ce=_0xdfbe25[_0x30dc('0x11')]('-')[0x0];var _0x4fa806=encryptor[_0x30dc('0x12')](_0x4dc2d9,util['format'](_0x30dc('0x13'),_0x27d239,_0xdfbe25,_0x3aa0ce));var _0x1c3e46=JSON['parse'](_0x4fa806);_0x1c3e46[_0x30dc('0x14')]=![];_0x1c3e46[_0x30dc('0x15')]=_0xdfbe25;_0x1c3e46[_0x30dc('0x16')]=hardware['getUuid']();if(_0x2b5dae){var _0x300315=encryptor['decryptString'](_0x2b5dae);_0x1c3e46[_0x30dc('0x17')]=_0x300315;_0x1c3e46[_0x30dc('0x18')]=moment(_0x300315)[_0x30dc('0x19')](0x7,_0x30dc('0x1a'))['format']();_0x1c3e46[_0x30dc('0x1b')]=_0x1c3e46[_0x30dc('0x15')]!=_0x1c3e46[_0x30dc('0x16')]?_0x30dc('0x1c'):'disabled';}return _0x1c3e46;}catch(_0x3dc11c){breakingLicense[_0x30dc('0x15')]=_0x1c00d4[_0x30dc('0xd')];breakingLicense[_0x30dc('0x1d')]=_0x3dc11c['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x98b8c3,_0x16694a){getLicense()[_0x30dc('0xb')](function(_0x5b6bfb){return db[_0x30dc('0x1e')][_0x30dc('0x1f')]({'attributes':['role',[db[_0x30dc('0x20')]['fn'](_0x30dc('0x21'),db[_0x30dc('0x20')][_0x30dc('0x22')]('role')),_0x30dc('0x23')]],'group':_0x30dc('0x24'),'where':{'role':{'$or':['admin','user','telephone']}},'raw':!![]})[_0x30dc('0xb')](function(_0x491499){var _0x69ca7f={'user':_0x5b6bfb['users']||0x0,'telephone':_0x5b6bfb['telephones']||0x0};_0x491499[_0x30dc('0x25')](function(_0x2dcd30){var _0x4e5f0d=_0x2dcd30[_0x30dc('0x24')]===_0x30dc('0x26')?_0x30dc('0x27'):_0x2dcd30[_0x30dc('0x24')];_0x69ca7f[_0x4e5f0d]-=_0x2dcd30[_0x30dc('0x23')];if(_0x69ca7f[_0x4e5f0d]<0x0)_0x69ca7f[_0x4e5f0d]=0x0;});_0x98b8c3(_0x69ca7f);return;});})[_0x30dc('0xc')](function(_0x4515c5){_0x16694a(_0x4515c5);});});}function checkUserLimits(_0xcf0c26){return new BPromise(function(_0x1bc0b3,_0x5917a9){getLimits()[_0x30dc('0xb')](function(_0x3bc643){var _0x57f1e1=_['pick'](_[_0x30dc('0x28')](_0xcf0c26,_0x30dc('0x24')),[_0x30dc('0x26'),_0x30dc('0x27'),_0x30dc('0x29')]);var _0x3c73da=(_0x57f1e1[_0x30dc('0x26')]||0x0)+(_0x57f1e1[_0x30dc('0x27')]||0x0);var _0x5c940f=_0x57f1e1[_0x30dc('0x29')]||0x0;if(_0x3c73da>_0x3bc643[_0x30dc('0x27')])return _0x5917a9('License\x20limit\x20reached\x20for\x20users');if(_0x5c940f>_0x3bc643[_0x30dc('0x29')])return _0x5917a9(_0x30dc('0x2a'));return _0x1bc0b3();})[_0x30dc('0xc')](function(_0x80ed6){_0x5917a9(_0x80ed6);});});}module[_0x30dc('0x2b')]={'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 424740e..6423f75 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 _0xd5e5=['app-id','http://localhost:9000'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xd5e5,0x187));var _0x5d5e=function(_0x26a672,_0x59f5be){_0x26a672=_0x26a672-0x0;var _0x348f43=_0xd5e5[_0x26a672];return _0x348f43;};'use strict';module['exports']={'DOMAIN':_0x5d5e('0x0'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x5d5e('0x1'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x0b95=['http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0xea6018,_0x4cf082){var _0x57b54d=function(_0x49099a){while(--_0x49099a){_0xea6018['push'](_0xea6018['shift']());}};_0x57b54d(++_0x4cf082);}(_0x0b95,0x198));var _0x50b9=function(_0x50736d,_0x5064a7){_0x50736d=_0x50736d-0x0;var _0x32b493=_0x0b95[_0x50736d];return _0x32b493;};'use strict';module['exports']={'DOMAIN':_0x50b9('0x0'),'SESSION_SECRET':_0x50b9('0x1'),'GOOGLE_ID':_0x50b9('0x2'),'GOOGLE_SECRET':_0x50b9('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 9fcddd2..ecf0316 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3069=['format','message','replace','{{{','}}}','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','exports','Logger','transports','File','%s-%s','error','info','env','debugLevel','winston','util','path','INFO','join','/var','log','xcally'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x3069,0x1d8));var _0x9306=function(_0x333b9a,_0x14ce97){_0x333b9a=_0x333b9a-0x0;var _0x18670e=_0x3069[_0x333b9a];return _0x18670e;};'use strict';var moment=require('moment');var winston=require(_0x9306('0x0'));var util=require(_0x9306('0x1'));var path=require(_0x9306('0x2'));var debugLevel=_0x9306('0x3');function filename(_0x44c56e,_0x39f669){return path[_0x9306('0x4')](_0x9306('0x5'),_0x9306('0x6'),_0x9306('0x7'),util[_0x9306('0x8')]('%s-%s.log',_0x44c56e,_0x39f669));}function formatter(_0x1dce4a,_0x5d4a72){_0x5d4a72[_0x9306('0x9')]=_0x5d4a72[_0x9306('0x9')][_0x9306('0xa')](/@@{/g,_0x9306('0xb'))['replace'](/}@@/g,_0x9306('0xc'))['replace'](/@{/g,'{{')[_0x9306('0xa')](/}@/g,'}}');return util[_0x9306('0x8')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x9306('0x8')](_0x9306('0xd')),_0x5d4a72['level'][_0x9306('0xe')](),_0x1dce4a,_0x5d4a72[_0x9306('0x9')]);}module[_0x9306('0xf')]=function(_0x219c29){return new winston[(_0x9306('0x10'))]({'transports':[new winston[(_0x9306('0x11'))][(_0x9306('0x12'))]({'name':util[_0x9306('0x8')](_0x9306('0x13'),_0x219c29,_0x9306('0x14')),'filename':filename(_0x219c29,_0x9306('0x14')),'level':_0x9306('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2c4ec2){return formatter(_0x219c29,_0x2c4ec2);}}),new winston[(_0x9306('0x11'))]['File']({'name':util[_0x9306('0x8')](_0x9306('0x13'),_0x219c29,_0x9306('0x15')),'filename':filename(_0x219c29,_0x9306('0x15')),'level':_0x9306('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x31a010){return formatter(_0x219c29,_0x31a010);}}),new winston[(_0x9306('0x11'))]['Console']({'level':process[_0x9306('0x16')][_0x9306('0x17')]||debugLevel,'json':![],'formatter':function(_0x12aec8){return formatter(_0x219c29,_0x12aec8);}})]});}; \ No newline at end of file +var _0xf77a=['YYYY-MM-DD\x20HH:mm:ss','toUpperCase','exports','Logger','transports','File','%s-%s','error','info','Console','moment','winston','util','path','INFO','join','xcally','%s-%s.log','message','replace','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s'];(function(_0x7e678c,_0x2aa892){var _0x59a688=function(_0x2d9149){while(--_0x2d9149){_0x7e678c['push'](_0x7e678c['shift']());}};_0x59a688(++_0x2aa892);}(_0xf77a,0x17a));var _0xaf77=function(_0x50c4e7,_0x4705b9){_0x50c4e7=_0x50c4e7-0x0;var _0x2aa946=_0xf77a[_0x50c4e7];return _0x2aa946;};'use strict';var moment=require(_0xaf77('0x0'));var winston=require(_0xaf77('0x1'));var util=require(_0xaf77('0x2'));var path=require(_0xaf77('0x3'));var debugLevel=_0xaf77('0x4');function filename(_0x962714,_0x129286){return path[_0xaf77('0x5')]('/var','log',_0xaf77('0x6'),util['format'](_0xaf77('0x7'),_0x962714,_0x129286));}function formatter(_0x4ac178,_0x3e9419){_0x3e9419[_0xaf77('0x8')]=_0x3e9419[_0xaf77('0x8')][_0xaf77('0x9')](/@@{/g,'{{{')[_0xaf77('0x9')](/}@@/g,_0xaf77('0xa'))[_0xaf77('0x9')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xaf77('0xb')](_0xaf77('0xc'),moment()['format'](_0xaf77('0xd')),_0x3e9419['level'][_0xaf77('0xe')](),_0x4ac178,_0x3e9419[_0xaf77('0x8')]);}module[_0xaf77('0xf')]=function(_0x4f34d2){return new winston[(_0xaf77('0x10'))]({'transports':[new winston[(_0xaf77('0x11'))][(_0xaf77('0x12'))]({'name':util[_0xaf77('0xb')](_0xaf77('0x13'),_0x4f34d2,_0xaf77('0x14')),'filename':filename(_0x4f34d2,_0xaf77('0x14')),'level':_0xaf77('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x48733e){return formatter(_0x4f34d2,_0x48733e);}}),new winston[(_0xaf77('0x11'))][(_0xaf77('0x12'))]({'name':util['format'](_0xaf77('0x13'),_0x4f34d2,_0xaf77('0x15')),'filename':filename(_0x4f34d2,_0xaf77('0x15')),'level':_0xaf77('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5b6df2){return formatter(_0x4f34d2,_0x5b6df2);}}),new winston[(_0xaf77('0x11'))][(_0xaf77('0x16'))]({'level':process['env']['debugLevel']||debugLevel,'json':![],'formatter':function(_0x5ce058){return formatter(_0x4f34d2,_0x5ce058);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index eb5ff13..8c65cfe 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 _0x57fa=['express','../../services/express/index.js','ami','join','../../services/agi/index.js','email','../../services/email/index.js','xdr','exports'];(function(_0x2473dc,_0x2d05c9){var _0x1920db=function(_0x2459f1){while(--_0x2459f1){_0x2473dc['push'](_0x2473dc['shift']());}};_0x1920db(++_0x2d05c9);}(_0x57fa,0x7e));var _0xa57f=function(_0x1af913,_0x4e148c){_0x1af913=_0x1af913-0x0;var _0x5b23ef=_0x57fa[_0x1af913];return _0x5b23ef;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0xa57f('0x0'),'script':path['join'](__dirname,_0xa57f('0x1'))},{'name':_0xa57f('0x2'),'script':path[_0xa57f('0x3')](__dirname,'../../services/ami/index.js')},{'name':'agi','script':path[_0xa57f('0x3')](__dirname,_0xa57f('0x4'))},{'name':_0xa57f('0x5'),'script':path[_0xa57f('0x3')](__dirname,_0xa57f('0x6'))},{'name':'routing','script':path[_0xa57f('0x3')](__dirname,'../../services/routing/index.js')},{'name':_0xa57f('0x7'),'script':path['join'](__dirname,'../../services/xdr/index.js')}]};module[_0xa57f('0x8')]=config; \ No newline at end of file +var _0xb205=['ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','xdr','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js'];(function(_0x5b4742,_0x304b37){var _0x2c6b94=function(_0x34b922){while(--_0x34b922){_0x5b4742['push'](_0x5b4742['shift']());}};_0x2c6b94(++_0x304b37);}(_0xb205,0xcc));var _0x5b20=function(_0x412b97,_0x584710){_0x412b97=_0x412b97-0x0;var _0xffc2e4=_0xb205[_0x412b97];return _0xffc2e4;};'use strict';var path=require(_0x5b20('0x0'));var os=require('os');var config={'apps':[{'name':_0x5b20('0x1'),'script':path[_0x5b20('0x2')](__dirname,_0x5b20('0x3'))},{'name':_0x5b20('0x4'),'script':path['join'](__dirname,_0x5b20('0x5'))},{'name':_0x5b20('0x6'),'script':path[_0x5b20('0x2')](__dirname,_0x5b20('0x7'))},{'name':_0x5b20('0x8'),'script':path[_0x5b20('0x2')](__dirname,_0x5b20('0x9'))},{'name':'routing','script':path['join'](__dirname,'../../services/routing/index.js')},{'name':_0x5b20('0xa'),'script':path[_0x5b20('0x2')](__dirname,_0x5b20('0xb'))}]};module[_0x5b20('0xc')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 02b9f43..fd03f7b 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 _0x4986=['./config','connect','start','then','stop','disconnect','restart','list','describe','delete','dump','saved','pm2','bluebird'];(function(_0x3561dd,_0x4bb77e){var _0x5e3a90=function(_0x83f6c5){while(--_0x83f6c5){_0x3561dd['push'](_0x3561dd['shift']());}};_0x5e3a90(++_0x4bb77e);}(_0x4986,0x6e));var _0x6498=function(_0x369a82,_0x381e46){_0x369a82=_0x369a82-0x0;var _0x5d26ac=_0x4986[_0x369a82];return _0x5d26ac;};'use strict';var pm2=require(_0x6498('0x0'));var BPromise=require(_0x6498('0x1'));var config=require(_0x6498('0x2'));function connect(){return new BPromise(function(_0x5c0f72,_0x5ab420){return pm2[_0x6498('0x3')](function(_0x40bbc9){if(_0x40bbc9){return _0x5ab420(_0x40bbc9);}return _0x5c0f72('connected');});});};exports[_0x6498('0x4')]=function(_0x12a6fb){return connect()[_0x6498('0x5')](function(){return new BPromise(function(_0x10967e,_0x117a31){return pm2[_0x6498('0x4')](_0x12a6fb,function(_0x26476d,_0x49b00a){if(_0x26476d){return _0x117a31(_0x26476d);}pm2['disconnect']();return _0x10967e(_0x49b00a);});});});};exports[_0x6498('0x6')]=function(_0x2472af){return connect()[_0x6498('0x5')](function(){return new BPromise(function(_0x465333,_0x1c590e){return pm2['stop'](_0x2472af,function(_0x3edea9,_0x45c75c){if(_0x3edea9){return _0x1c590e(_0x3edea9);}pm2[_0x6498('0x7')]();return _0x465333(_0x45c75c);});});});};exports['restart']=function(_0x55a564){return connect()[_0x6498('0x5')](function(){return new BPromise(function(_0x5a41a9,_0x1b6f28){return pm2[_0x6498('0x8')](_0x55a564,function(_0x429fcb,_0x17d497){if(_0x429fcb){return _0x1b6f28(_0x429fcb);}pm2[_0x6498('0x7')]();return _0x5a41a9(_0x17d497);});});});};exports[_0x6498('0x9')]=function(){return connect()[_0x6498('0x5')](function(){return new BPromise(function(_0x4eaf5d,_0x5e1e56){return pm2[_0x6498('0x9')](function(_0xfde02b,_0x3ae8e5){if(_0xfde02b){return _0x5e1e56(_0xfde02b);}pm2[_0x6498('0x7')]();return _0x4eaf5d(_0x3ae8e5);});});});};exports[_0x6498('0xa')]=function(_0x59833d){return connect()[_0x6498('0x5')](function(){return new BPromise(function(_0x2ab98d,_0x172b0e){return pm2[_0x6498('0xa')](_0x59833d,function(_0x2713fa,_0x1b4083){if(_0x2713fa){return _0x172b0e(_0x2713fa);}pm2[_0x6498('0x7')]();return _0x2ab98d(_0x1b4083);});});});};exports['delete']=function(_0x43ae3b){return connect()[_0x6498('0x5')](function(){return new BPromise(function(_0x2a1247,_0x2f8fdb){return pm2[_0x6498('0xb')](_0x43ae3b,function(_0x5ce1fc,_0x4a5466){if(_0x5ce1fc){return _0x2f8fdb(_0x5ce1fc);}pm2[_0x6498('0x7')]();return _0x2a1247(_0x4a5466);});});});};exports[_0x6498('0xc')]=function(){return connect()[_0x6498('0x5')](function(){return new BPromise(function(_0x39ee79,_0xde1ea0){return pm2[_0x6498('0xc')](function(_0x32a297){if(_0x32a297){return _0xde1ea0(_0x32a297);}return _0x39ee79(_0x6498('0xd'));});});});}; \ No newline at end of file +var _0x25fa=['./config','connect','connected','then','start','disconnect','stop','restart','list','describe','delete','dump','saved','pm2'];(function(_0x3450c8,_0x120aa7){var _0x14defc=function(_0x139793){while(--_0x139793){_0x3450c8['push'](_0x3450c8['shift']());}};_0x14defc(++_0x120aa7);}(_0x25fa,0x109));var _0xa25f=function(_0x3d434b,_0x259794){_0x3d434b=_0x3d434b-0x0;var _0x3cbc64=_0x25fa[_0x3d434b];return _0x3cbc64;};'use strict';var pm2=require(_0xa25f('0x0'));var BPromise=require('bluebird');var config=require(_0xa25f('0x1'));function connect(){return new BPromise(function(_0x37129d,_0x57e272){return pm2[_0xa25f('0x2')](function(_0xb88bd8){if(_0xb88bd8){return _0x57e272(_0xb88bd8);}return _0x37129d(_0xa25f('0x3'));});});};exports['start']=function(_0x4e444d){return connect()[_0xa25f('0x4')](function(){return new BPromise(function(_0x50dafc,_0x2ea9ea){return pm2[_0xa25f('0x5')](_0x4e444d,function(_0x29666d,_0x455225){if(_0x29666d){return _0x2ea9ea(_0x29666d);}pm2[_0xa25f('0x6')]();return _0x50dafc(_0x455225);});});});};exports[_0xa25f('0x7')]=function(_0x64bbbf){return connect()[_0xa25f('0x4')](function(){return new BPromise(function(_0xa27a42,_0x55ef98){return pm2[_0xa25f('0x7')](_0x64bbbf,function(_0x31bd1d,_0x507a36){if(_0x31bd1d){return _0x55ef98(_0x31bd1d);}pm2[_0xa25f('0x6')]();return _0xa27a42(_0x507a36);});});});};exports[_0xa25f('0x8')]=function(_0x1f65b3){return connect()[_0xa25f('0x4')](function(){return new BPromise(function(_0x5168c1,_0x2f7fc5){return pm2[_0xa25f('0x8')](_0x1f65b3,function(_0x5962e7,_0x3e970c){if(_0x5962e7){return _0x2f7fc5(_0x5962e7);}pm2[_0xa25f('0x6')]();return _0x5168c1(_0x3e970c);});});});};exports['list']=function(){return connect()[_0xa25f('0x4')](function(){return new BPromise(function(_0x20f411,_0x1c6052){return pm2[_0xa25f('0x9')](function(_0x199e18,_0x2a627f){if(_0x199e18){return _0x1c6052(_0x199e18);}pm2[_0xa25f('0x6')]();return _0x20f411(_0x2a627f);});});});};exports[_0xa25f('0xa')]=function(_0x465809){return connect()[_0xa25f('0x4')](function(){return new BPromise(function(_0x1e5836,_0x1859ba){return pm2['describe'](_0x465809,function(_0x2d4f0f,_0x471679){if(_0x2d4f0f){return _0x1859ba(_0x2d4f0f);}pm2[_0xa25f('0x6')]();return _0x1e5836(_0x471679);});});});};exports[_0xa25f('0xb')]=function(_0x18705c){return connect()[_0xa25f('0x4')](function(){return new BPromise(function(_0x4a4805,_0x292171){return pm2['delete'](_0x18705c,function(_0x32b868,_0x562573){if(_0x32b868){return _0x292171(_0x32b868);}pm2['disconnect']();return _0x4a4805(_0x562573);});});});};exports[_0xa25f('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x46bb31,_0x131c68){return pm2[_0xa25f('0xc')](function(_0x3c2665){if(_0x3c2665){return _0x131c68(_0x3c2665);}return _0x46bb31(_0xa25f('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 6274398..a7e67af 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 _0x7d3e=['update','timeout','YYYY-MM-DD\x20HH:mm:ss','chatInteraction:update','error','inspect','start','lodash','moment','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join'];(function(_0x3f03c0,_0x1840e6){var _0x5dba29=function(_0x371b3a){while(--_0x371b3a){_0x3f03c0['push'](_0x3f03c0['shift']());}};_0x5dba29(++_0x1840e6);}(_0x7d3e,0x64));var _0xe7d3=function(_0x21e7e0,_0x41bd89){_0x21e7e0=_0x21e7e0-0x0;var _0x5105af=_0x7d3e[_0x21e7e0];return _0x5105af;};'use strict';var _=require(_0xe7d3('0x0'));var moment=require(_0xe7d3('0x1'));var Redis=require('ioredis');var util=require(_0xe7d3('0x2'));var config=require(_0xe7d3('0x3'));var db=require(_0xe7d3('0x4'))['db'];var logger=require(_0xe7d3('0x5'))(_0xe7d3('0x6'));config[_0xe7d3('0x7')]=_[_0xe7d3('0x8')](config[_0xe7d3('0x7')],{'host':_0xe7d3('0x9'),'port':0x18eb});var io=require(_0xe7d3('0xa'))(new Redis(config['redis']));function closeInteractions(){var _0x475439=0x0;var _0x1b123a=[];return db[_0xe7d3('0xb')][_0xe7d3('0xc')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xe7d3('0xd')](function(_0x474e77){_0x475439=_0x474e77[_0xe7d3('0xe')];if(_0x475439){return db[_0xe7d3('0xf')][_0xe7d3('0x10')]({'raw':!![],'attributes':['id',_0xe7d3('0x11')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x474e77[_0xe7d3('0xe')],_0xe7d3('0x12'))}}});}else{return[];}})[_0xe7d3('0xd')](function(_0x4f848e){if(_0x4f848e&&_0x4f848e[_0xe7d3('0x13')]){_0x1b123a=_[_0xe7d3('0x14')](_0x4f848e||[],'id');logger[_0xe7d3('0x15')](_0xe7d3('0x16'),_0x1b123a[_0xe7d3('0x17')]());return db[_0xe7d3('0xf')][_0xe7d3('0x18')]({'closeReason':'system','disposition':_0xe7d3('0x19'),'closed':!![],'closedAt':moment()['format'](_0xe7d3('0x1a'))},{'where':{'id':_0x1b123a}});}})[_0xe7d3('0xd')](function(){if(_0x1b123a&&_0x1b123a[_0xe7d3('0x13')]){logger[_0xe7d3('0x15')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x1b123a[_0xe7d3('0x17')]());for(var _0x34aff4=0x0;_0x34aff4<_0x1b123a['length'];_0x34aff4++){io['emit'](_0xe7d3('0x1b'),{'id':_0x1b123a[_0x34aff4],'closed':!![]});}}})['catch'](function(_0x52672d){logger[_0xe7d3('0x1c')]('[CHAT]\x20Error\x20closing\x20interactions',_0x52672d?util[_0xe7d3('0x1d')](_0x52672d,{'showHidden':![],'depth':null}):'');});}exports[_0xe7d3('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x1396=['then','ChatInteraction','findAll','lastMsgAt','subtract','length','info','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','moment','../../config/environment','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter','chatTimeout'];(function(_0x134192,_0x36adc5){var _0x3cd080=function(_0x134371){while(--_0x134371){_0x134192['push'](_0x134192['shift']());}};_0x3cd080(++_0x36adc5);}(_0x1396,0x87));var _0x6139=function(_0x874cf1,_0x2a4954){_0x874cf1=_0x874cf1-0x0;var _0x233579=_0x1396[_0x874cf1];return _0x233579;};'use strict';var _=require(_0x6139('0x0'));var moment=require(_0x6139('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x6139('0x2'));var db=require(_0x6139('0x3'))['db'];var logger=require(_0x6139('0x4'))('schedule');config[_0x6139('0x5')]=_[_0x6139('0x6')](config[_0x6139('0x5')],{'host':_0x6139('0x7'),'port':0x18eb});var io=require(_0x6139('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x5d4adf=0x0;var _0x1e358b=[];return db['Setting']['find']({'raw':!![],'attributes':['id',_0x6139('0x9')],'where':{'id':0x1}})[_0x6139('0xa')](function(_0x32f9fe){_0x5d4adf=_0x32f9fe[_0x6139('0x9')];if(_0x5d4adf){return db[_0x6139('0xb')][_0x6139('0xc')]({'raw':!![],'attributes':['id',_0x6139('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x6139('0xe')](_0x32f9fe[_0x6139('0x9')],'minutes')}}});}else{return[];}})[_0x6139('0xa')](function(_0x4d9c32){if(_0x4d9c32&&_0x4d9c32[_0x6139('0xf')]){_0x1e358b=_['map'](_0x4d9c32||[],'id');logger[_0x6139('0x10')]('[CHAT]\x20Interactions\x20to\x20close:',_0x1e358b[_0x6139('0x11')]());return db[_0x6139('0xb')][_0x6139('0x12')]({'closeReason':_0x6139('0x13'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x6139('0x14')](_0x6139('0x15'))},{'where':{'id':_0x1e358b}});}})['then'](function(){if(_0x1e358b&&_0x1e358b[_0x6139('0xf')]){logger[_0x6139('0x10')](_0x6139('0x16'),_0x1e358b[_0x6139('0x11')]());for(var _0x3a1993=0x0;_0x3a1993<_0x1e358b['length'];_0x3a1993++){io[_0x6139('0x17')](_0x6139('0x18'),{'id':_0x1e358b[_0x3a1993],'closed':!![]});}}})[_0x6139('0x19')](function(_0x503ea5){logger[_0x6139('0x1a')](_0x6139('0x1b'),_0x503ea5?util[_0x6139('0x1c')](_0x503ea5,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 744c295..06c4af9 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 _0xe5c1=['keys','jobs','map','toString','difference','intersection','exists','stop','deleteJob','delete\x20cron','index','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','stop\x20cron','length','update\x20cron','run','util','path','lodash','moment','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','%s.%s','basename','savename','extname','zip','status','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Sent','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','runReport','DefaultReportId','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','MailServerOut'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe5c1,0x71));var _0x1e5c=function(_0x1685fc,_0x4cd713){_0x1685fc=_0x1685fc-0x0;var _0x369b8f=_0xe5c1[_0x1685fc];return _0x369b8f;};'use strict';var fs=require('fs');var util=require(_0x1e5c('0x0'));var path=require(_0x1e5c('0x1'));var _=require(_0x1e5c('0x2'));var moment=require(_0x1e5c('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require(_0x1e5c('0x4'));var logger=require('../logger')(_0x1e5c('0x5'));var db=require(_0x1e5c('0x6'))['db'];var analyticCustomReportController=require(_0x1e5c('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x1e5c('0x8')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x550fc0,_0x49c35a){return function(){logger[_0x1e5c('0x9')](_0x1e5c('0xa'),_0x550fc0[_0x1e5c('0xb')]);var _0x8e092b=!![];var _0x2eee3d={'tls':{'rejectUnauthorized':![]}};if(_0x550fc0[_0x1e5c('0xc')][_0x1e5c('0xd')][_0x1e5c('0xe')]){_0x2eee3d[_0x1e5c('0xe')]=_0x550fc0[_0x1e5c('0xc')][_0x1e5c('0xd')][_0x1e5c('0xe')];}else{_0x2eee3d[_0x1e5c('0xf')]=_0x550fc0[_0x1e5c('0xc')][_0x1e5c('0xd')][_0x1e5c('0xf')];_0x2eee3d[_0x1e5c('0x10')]=_0x550fc0[_0x1e5c('0xc')]['Smtp'][_0x1e5c('0x10')];_0x2eee3d[_0x1e5c('0x11')]=_0x550fc0[_0x1e5c('0xc')][_0x1e5c('0xd')][_0x1e5c('0x11')];}if(_0x550fc0[_0x1e5c('0xc')][_0x1e5c('0xd')][_0x1e5c('0x12')]){_0x2eee3d[_0x1e5c('0x13')]={'user':_0x550fc0[_0x1e5c('0xc')][_0x1e5c('0xd')][_0x1e5c('0x14')],'pass':_0x550fc0[_0x1e5c('0xc')][_0x1e5c('0xd')]['pass']};}var _0x3d7c88={'account':_0x2eee3d,'message':{'from':util[_0x1e5c('0x15')](_0x1e5c('0x16'),_0x550fc0[_0x1e5c('0xc')][_0x1e5c('0x17')],_0x550fc0[_0x1e5c('0xc')][_0x1e5c('0xb')]||_0x550fc0[_0x1e5c('0xc')][_0x1e5c('0xd')][_0x1e5c('0x14')]),'to':_0x550fc0['email'],'cc':_0x550fc0['cc'],'bcc':_0x550fc0[_0x1e5c('0x18')],'subject':util['format'](_0x1e5c('0x19'),_0x49c35a['name'],_0x550fc0[_0x1e5c('0x1a')],_0x550fc0['subtractUnit'])}};var _0x5ed18a=path[_0x1e5c('0x1b')](__dirname,'../../files/reports');var _0x4c40b4=_0x49c35a['savename'];var _0x569278=util[_0x1e5c('0x15')](_0x1e5c('0x1c'),path[_0x1e5c('0x1d')](_0x49c35a[_0x1e5c('0x1e')],path[_0x1e5c('0x1f')](_0x49c35a['savename'])),_0x1e5c('0x20'));var _0x5a974d=path[_0x1e5c('0x1b')](_0x5ed18a,_0x4c40b4);var _0x6ff74e=path[_0x1e5c('0x1b')](_0x5ed18a,_0x569278);if(fs['existsSync'](_0x5a974d)){_0x49c35a[_0x1e5c('0x21')]='Sent';_0x3d7c88[_0x1e5c('0x22')][_0x1e5c('0x23')]=[{'filename':_0x4c40b4,'path':_0x5a974d}];_0x3d7c88[_0x1e5c('0x22')][_0x1e5c('0x24')]=util[_0x1e5c('0x15')](_0x1e5c('0x25'),JSON[_0x1e5c('0x26')](_0x49c35a,null,0x2));}else if(fs['existsSync'](_0x6ff74e)){_0x49c35a['status']=_0x1e5c('0x27');_0x3d7c88['message'][_0x1e5c('0x23')]=[{'filename':_0x569278,'path':_0x6ff74e}];}else{_0x3d7c88[_0x1e5c('0x22')]['text']='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x550fc0[_0x1e5c('0x28')]){_0x8e092b=![];logger[_0x1e5c('0x9')](_0x1e5c('0x29'));}}if(_0x8e092b){return client[_0x1e5c('0x2a')](_0x1e5c('0x2b'),_0x3d7c88)[_0x1e5c('0x2c')](function(_0x3a103e){if(_0x3a103e[_0x1e5c('0x2d')]){return logger[_0x1e5c('0x2d')](_0x1e5c('0x2e'),JSON['stringify'](_0x3a103e));}return logger[_0x1e5c('0x9')]('email\x20sent');})['catch'](function(_0x328606){return logger['error'](_0x1e5c('0x2e'),JSON['stringify'](_0x328606));});}};}function handleError(){return function(_0x463a96){return logger['error'](JSON['stringify'](_0x463a96));};}function handleResult(_0x250051){return function(_0x17741e){logger[_0x1e5c('0x9')](_0x1e5c('0x2f'),JSON[_0x1e5c('0x26')](_0x17741e));if(_0x250051[_0x1e5c('0xc')]&&_0x250051['MailAccount'][_0x1e5c('0xd')]&&!_[_0x1e5c('0x30')](_0x250051[_0x1e5c('0xb')])){setTimeout(handleSendEmail(_0x250051,_0x17741e),0x3c*0x3e8);}};}function handleJob(_0x4916a0){return function(){try{if(_[_0x1e5c('0x30')](_0x4916a0[_0x1e5c('0x1a')])){return logger[_0x1e5c('0x9')](_0x1e5c('0x31'));}if(_[_0x1e5c('0x30')](_0x4916a0[_0x1e5c('0x32')])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x48eed5={'startDate':moment()['subtract'](_0x4916a0[_0x1e5c('0x1a')],_0x4916a0[_0x1e5c('0x32')])[_0x1e5c('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x1e5c('0x15')](_0x1e5c('0x33')),'type':_0x1e5c('0x34'),'output':_0x4916a0[_0x1e5c('0x35')],'name':_0x4916a0[_0x1e5c('0x17')]};if(!_['isNil'](_0x4916a0['DefaultReportId'])){logger['info'](_0x1e5c('0x36'),_0x4916a0['DefaultReportId']);return analyticDefaultReportController[_0x1e5c('0x37')]({'id':_0x4916a0[_0x1e5c('0x38')]},_0x48eed5)[_0x1e5c('0x2c')](handleResult(_0x4916a0))[_0x1e5c('0x39')](handleError());}if(!_[_0x1e5c('0x30')](_0x4916a0[_0x1e5c('0x3a')])){logger[_0x1e5c('0x9')](_0x1e5c('0x3b'),_0x4916a0[_0x1e5c('0x3a')]);return analyticCustomReportController[_0x1e5c('0x37')]({'id':_0x4916a0[_0x1e5c('0x3a')]},_0x48eed5)[_0x1e5c('0x2c')](handleResult(_0x4916a0))[_0x1e5c('0x39')](handleError());}}catch(_0x4c11fa){logger[_0x1e5c('0x2d')](JSON[_0x1e5c('0x26')](_0x4c11fa));}return logger[_0x1e5c('0x9')](_0x1e5c('0x3c'));};}function getJobs(_0x1eec9d){var _0x5b51f1={};if(_0x1eec9d){_0x5b51f1['id']=_0x1eec9d;}return db[_0x1e5c('0x3d')]['findAll']({'where':_0x5b51f1,'include':[{'model':db['MailAccount'],'attributes':['id',_0x1e5c('0x17'),_0x1e5c('0xb')],'include':[{'model':db[_0x1e5c('0x3e')],'as':_0x1e5c('0xd')}]}]})[_0x1e5c('0x2c')](function(_0x23313a){var _0x214897=_[_0x1e5c('0x3f')](manager[_0x1e5c('0x40')]);var _0x587047=_[_0x1e5c('0x41')](_0x23313a,function(_0x17edd1){return _0x17edd1['id'][_0x1e5c('0x42')]();});var _0x36ac7e=_['keyBy'](_0x23313a,function(_0x24f0f1){return _0x24f0f1['id'][_0x1e5c('0x42')]();});var _0x379cd5=_0x1eec9d?_0x587047:_[_0x1e5c('0x43')](_0x587047,_0x214897);var _0x5f4840=_[_0x1e5c('0x44')](_0x587047,_0x214897);var _0x32fe83=_[_0x1e5c('0x43')](_0x214897,_0x587047);var _0x1a9a42;var _0x80d60a;for(_0x1a9a42=0x0;_0x1a9a42<_0x32fe83['length']&&!_0x1eec9d;_0x1a9a42+=0x1){_0x80d60a=_0x32fe83[_0x1a9a42][_0x1e5c('0x42')]();if(manager[_0x1e5c('0x45')](_0x80d60a)){manager[_0x1e5c('0x46')](_0x80d60a);manager[_0x1e5c('0x47')](_0x80d60a);logger[_0x1e5c('0x9')](_0x1e5c('0x48'),_0x80d60a);}}logger[_0x1e5c('0x9')]('toRun',JSON['stringify'](_0x379cd5));for(_0x1a9a42=0x0;_0x1a9a42<_0x379cd5['length'];_0x1a9a42+=0x1){_0x80d60a=_0x379cd5[_0x1a9a42][_0x1e5c('0x42')]();logger[_0x1e5c('0x9')](_0x1e5c('0x49'),_0x80d60a);if(_0x1eec9d){logger[_0x1e5c('0x9')]('my\x20id',_0x1eec9d);logger[_0x1e5c('0x9')](JSON[_0x1e5c('0x26')](_0x36ac7e[_0x80d60a]));BPromise[_0x1e5c('0x4a')]()['then'](handleJob(_0x36ac7e[_0x80d60a]));logger['info'](_0x1e5c('0x4b'),_0x36ac7e[_0x80d60a][_0x1e5c('0x17')],_0x36ac7e[_0x80d60a][_0x1e5c('0x4c')]);}else if(_0x36ac7e[_0x80d60a][_0x1e5c('0x4c')]&&_0x36ac7e[_0x80d60a][_0x1e5c('0x4d')]&&moment()[_0x1e5c('0x4e')](_0x36ac7e[_0x80d60a][_0x1e5c('0x4f')],_0x36ac7e[_0x80d60a][_0x1e5c('0x50')])){manager[_0x1e5c('0x51')](_0x80d60a,_0x36ac7e[_0x80d60a][_0x1e5c('0x4c')],handleJob(_0x36ac7e[_0x80d60a]));manager[_0x1e5c('0x52')](_0x80d60a);logger[_0x1e5c('0x9')](_0x1e5c('0x53'),_0x36ac7e[_0x80d60a][_0x1e5c('0x17')],_0x36ac7e[_0x80d60a][_0x1e5c('0x4c')]);}else if(manager[_0x1e5c('0x45')](_0x80d60a)){manager[_0x1e5c('0x46')](_0x80d60a);manager['deleteJob'](_0x80d60a);logger[_0x1e5c('0x9')](_0x1e5c('0x54'),_0x36ac7e[_0x80d60a][_0x1e5c('0x17')],_0x36ac7e[_0x80d60a]['cron']);}}for(_0x1a9a42=0x0,_0x80d60a;_0x1a9a42<_0x5f4840[_0x1e5c('0x55')]&&!_0x1eec9d;_0x1a9a42+=0x1){_0x80d60a=_0x5f4840[_0x1a9a42][_0x1e5c('0x42')]();if(manager[_0x1e5c('0x45')](_0x80d60a)){if(_0x36ac7e[_0x80d60a]['cron']&&_0x36ac7e[_0x80d60a][_0x1e5c('0x4d')]&&moment()['isBetween'](_0x36ac7e[_0x80d60a][_0x1e5c('0x4f')],_0x36ac7e[_0x80d60a][_0x1e5c('0x50')])){manager['update'](_0x80d60a,_0x36ac7e[_0x80d60a][_0x1e5c('0x4c')],handleJob(_0x36ac7e[_0x80d60a]));logger[_0x1e5c('0x9')](_0x1e5c('0x56'),_0x36ac7e[_0x80d60a]['name'],_0x36ac7e[_0x80d60a][_0x1e5c('0x4c')]);}else{manager[_0x1e5c('0x46')](_0x80d60a);manager[_0x1e5c('0x47')](_0x80d60a);logger[_0x1e5c('0x9')](_0x1e5c('0x54'),_0x36ac7e[_0x80d60a][_0x1e5c('0x17')],_0x36ac7e[_0x80d60a]['cron']);}}}})[_0x1e5c('0x39')](function(_0x4ecddb){logger[_0x1e5c('0x2d')](JSON[_0x1e5c('0x26')](_0x4ecddb));});}exports[_0x1e5c('0x57')]=function(_0x15022d){return getJobs(_0x15022d);};exports[_0x1e5c('0x52')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x909a=['../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','info','email','MailAccount','Smtp','service','port','secure','authentication','auth','user','pass','format','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractUnit','../../files/reports','savename','%s.%s','basename','extname','zip','join','Sent','message','attachments','existsSync','status','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','stringify','isNil','subtractNumber','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','no\x20report\x20id','Schedule','MailServerOut','keys','jobs','map','keyBy','difference','intersection','length','stop','deleteJob','toRun','toString','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add\x20cron','exists','update','update\x20cron','stop\x20cron','start','path','moment','cron-job-manager','jayson/promise','bluebird'];(function(_0x2f71bf,_0x161acb){var _0x540399=function(_0x1a88e7){while(--_0x1a88e7){_0x2f71bf['push'](_0x2f71bf['shift']());}};_0x540399(++_0x161acb);}(_0x909a,0x100));var _0xa909=function(_0x280146,_0x45c87d){_0x280146=_0x280146-0x0;var _0x5ede73=_0x909a[_0x280146];return _0x5ede73;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xa909('0x0'));var _=require('lodash');var moment=require(_0xa909('0x1'));var CronJobManager=require(_0xa909('0x2'));var jayson=require(_0xa909('0x3'));var BPromise=require(_0xa909('0x4'));var logger=require(_0xa909('0x5'))(_0xa909('0x6'));var db=require(_0xa909('0x7'))['db'];var analyticCustomReportController=require(_0xa909('0x8'));var analyticDefaultReportController=require(_0xa909('0x9'));var client=jayson['client']['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3a0cf5,_0x103f65){return function(){logger[_0xa909('0xa')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x3a0cf5[_0xa909('0xb')]);var _0x2ce2be=!![];var _0x43b232={'tls':{'rejectUnauthorized':![]}};if(_0x3a0cf5[_0xa909('0xc')][_0xa909('0xd')][_0xa909('0xe')]){_0x43b232[_0xa909('0xe')]=_0x3a0cf5[_0xa909('0xc')][_0xa909('0xd')][_0xa909('0xe')];}else{_0x43b232['host']=_0x3a0cf5[_0xa909('0xc')][_0xa909('0xd')]['host'];_0x43b232[_0xa909('0xf')]=_0x3a0cf5[_0xa909('0xc')]['Smtp'][_0xa909('0xf')];_0x43b232[_0xa909('0x10')]=_0x3a0cf5[_0xa909('0xc')][_0xa909('0xd')][_0xa909('0x10')];}if(_0x3a0cf5['MailAccount']['Smtp'][_0xa909('0x11')]){_0x43b232[_0xa909('0x12')]={'user':_0x3a0cf5['MailAccount'][_0xa909('0xd')][_0xa909('0x13')],'pass':_0x3a0cf5[_0xa909('0xc')][_0xa909('0xd')][_0xa909('0x14')]};}var _0x2c055c={'account':_0x43b232,'message':{'from':util[_0xa909('0x15')]('\x22%s\x22\x20<%s>',_0x3a0cf5['MailAccount']['name'],_0x3a0cf5['MailAccount'][_0xa909('0xb')]||_0x3a0cf5[_0xa909('0xc')][_0xa909('0xd')][_0xa909('0x13')]),'to':_0x3a0cf5['email'],'cc':_0x3a0cf5['cc'],'bcc':_0x3a0cf5[_0xa909('0x16')],'subject':util[_0xa909('0x15')](_0xa909('0x17'),_0x103f65[_0xa909('0x18')],_0x3a0cf5['subtractNumber'],_0x3a0cf5[_0xa909('0x19')])}};var _0x5b1a54=path['join'](__dirname,_0xa909('0x1a'));var _0x2dcd34=_0x103f65[_0xa909('0x1b')];var _0x39e7ae=util[_0xa909('0x15')](_0xa909('0x1c'),path[_0xa909('0x1d')](_0x103f65[_0xa909('0x1b')],path[_0xa909('0x1e')](_0x103f65[_0xa909('0x1b')])),_0xa909('0x1f'));var _0x17b54c=path[_0xa909('0x20')](_0x5b1a54,_0x2dcd34);var _0x1b519e=path[_0xa909('0x20')](_0x5b1a54,_0x39e7ae);if(fs['existsSync'](_0x17b54c)){_0x103f65['status']=_0xa909('0x21');_0x2c055c[_0xa909('0x22')][_0xa909('0x23')]=[{'filename':_0x2dcd34,'path':_0x17b54c}];_0x2c055c['message']['text']=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON['stringify'](_0x103f65,null,0x2));}else if(fs[_0xa909('0x24')](_0x1b519e)){_0x103f65[_0xa909('0x25')]='Sent';_0x2c055c['message'][_0xa909('0x23')]=[{'filename':_0x39e7ae,'path':_0x1b519e}];}else{_0x2c055c[_0xa909('0x22')]['text']='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x3a0cf5[_0xa909('0x26')]){_0x2ce2be=![];logger[_0xa909('0xa')](_0xa909('0x27'));}}if(_0x2ce2be){return client[_0xa909('0x28')](_0xa909('0x29'),_0x2c055c)[_0xa909('0x2a')](function(_0x39ddc6){if(_0x39ddc6[_0xa909('0x2b')]){return logger[_0xa909('0x2b')](_0xa909('0x2c'),JSON['stringify'](_0x39ddc6));}return logger[_0xa909('0xa')](_0xa909('0x2d'));})[_0xa909('0x2e')](function(_0x1c1762){return logger[_0xa909('0x2b')](_0xa909('0x2c'),JSON['stringify'](_0x1c1762));});}};}function handleError(){return function(_0x236ba2){return logger[_0xa909('0x2b')](JSON[_0xa909('0x2f')](_0x236ba2));};}function handleResult(_0xbd1793){return function(_0x47ba66){logger[_0xa909('0xa')]('data',JSON['stringify'](_0x47ba66));if(_0xbd1793[_0xa909('0xc')]&&_0xbd1793[_0xa909('0xc')][_0xa909('0xd')]&&!_[_0xa909('0x30')](_0xbd1793[_0xa909('0xb')])){setTimeout(handleSendEmail(_0xbd1793,_0x47ba66),0x3c*0x3e8);}};}function handleJob(_0x5f5403){return function(){try{if(_[_0xa909('0x30')](_0x5f5403[_0xa909('0x31')])){return logger[_0xa909('0xa')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xa909('0x30')](_0x5f5403[_0xa909('0x19')])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x2a4a88={'startDate':moment()[_0xa909('0x32')](_0x5f5403[_0xa909('0x31')],_0x5f5403[_0xa909('0x19')])['format'](_0xa909('0x33')),'endDate':moment()[_0xa909('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xa909('0x34'),'output':_0x5f5403[_0xa909('0x35')],'name':_0x5f5403[_0xa909('0x18')]};if(!_[_0xa909('0x30')](_0x5f5403[_0xa909('0x36')])){logger[_0xa909('0xa')](_0xa909('0x37'),_0x5f5403[_0xa909('0x36')]);return analyticDefaultReportController[_0xa909('0x38')]({'id':_0x5f5403[_0xa909('0x36')]},_0x2a4a88)['then'](handleResult(_0x5f5403))[_0xa909('0x2e')](handleError());}if(!_['isNil'](_0x5f5403[_0xa909('0x39')])){logger[_0xa909('0xa')]('exec\x20custom\x20report\x20id:%s',_0x5f5403[_0xa909('0x39')]);return analyticCustomReportController['runReport']({'id':_0x5f5403[_0xa909('0x39')]},_0x2a4a88)[_0xa909('0x2a')](handleResult(_0x5f5403))[_0xa909('0x2e')](handleError());}}catch(_0x59e12d){logger[_0xa909('0x2b')](JSON[_0xa909('0x2f')](_0x59e12d));}return logger[_0xa909('0xa')](_0xa909('0x3a'));};}function getJobs(_0x4050ce){var _0x3266b3={};if(_0x4050ce){_0x3266b3['id']=_0x4050ce;}return db[_0xa909('0x3b')]['findAll']({'where':_0x3266b3,'include':[{'model':db[_0xa909('0xc')],'attributes':['id','name','email'],'include':[{'model':db[_0xa909('0x3c')],'as':_0xa909('0xd')}]}]})['then'](function(_0x415a2c){var _0x199002=_[_0xa909('0x3d')](manager[_0xa909('0x3e')]);var _0x503dc5=_[_0xa909('0x3f')](_0x415a2c,function(_0x4e82cd){return _0x4e82cd['id']['toString']();});var _0x205951=_[_0xa909('0x40')](_0x415a2c,function(_0x42a852){return _0x42a852['id']['toString']();});var _0x12b237=_0x4050ce?_0x503dc5:_[_0xa909('0x41')](_0x503dc5,_0x199002);var _0x271f6f=_[_0xa909('0x42')](_0x503dc5,_0x199002);var _0x437092=_[_0xa909('0x41')](_0x199002,_0x503dc5);var _0x27db3f;var _0x228be4;for(_0x27db3f=0x0;_0x27db3f<_0x437092[_0xa909('0x43')]&&!_0x4050ce;_0x27db3f+=0x1){_0x228be4=_0x437092[_0x27db3f]['toString']();if(manager['exists'](_0x228be4)){manager[_0xa909('0x44')](_0x228be4);manager[_0xa909('0x45')](_0x228be4);logger[_0xa909('0xa')]('delete\x20cron',_0x228be4);}}logger[_0xa909('0xa')](_0xa909('0x46'),JSON[_0xa909('0x2f')](_0x12b237));for(_0x27db3f=0x0;_0x27db3f<_0x12b237[_0xa909('0x43')];_0x27db3f+=0x1){_0x228be4=_0x12b237[_0x27db3f][_0xa909('0x47')]();logger[_0xa909('0xa')](_0xa909('0x48'),_0x228be4);if(_0x4050ce){logger[_0xa909('0xa')](_0xa909('0x49'),_0x4050ce);logger[_0xa909('0xa')](JSON[_0xa909('0x2f')](_0x205951[_0x228be4]));BPromise[_0xa909('0x4a')]()['then'](handleJob(_0x205951[_0x228be4]));logger[_0xa909('0xa')](_0xa909('0x4b'),_0x205951[_0x228be4][_0xa909('0x18')],_0x205951[_0x228be4]['cron']);}else if(_0x205951[_0x228be4][_0xa909('0x4c')]&&_0x205951[_0x228be4][_0xa909('0x4d')]&&moment()[_0xa909('0x4e')](_0x205951[_0x228be4][_0xa909('0x4f')],_0x205951[_0x228be4][_0xa909('0x50')])){manager['add'](_0x228be4,_0x205951[_0x228be4][_0xa909('0x4c')],handleJob(_0x205951[_0x228be4]));manager['start'](_0x228be4);logger[_0xa909('0xa')](_0xa909('0x51'),_0x205951[_0x228be4][_0xa909('0x18')],_0x205951[_0x228be4][_0xa909('0x4c')]);}else if(manager[_0xa909('0x52')](_0x228be4)){manager['stop'](_0x228be4);manager[_0xa909('0x45')](_0x228be4);logger[_0xa909('0xa')]('stop\x20cron',_0x205951[_0x228be4][_0xa909('0x18')],_0x205951[_0x228be4][_0xa909('0x4c')]);}}for(_0x27db3f=0x0,_0x228be4;_0x27db3f<_0x271f6f[_0xa909('0x43')]&&!_0x4050ce;_0x27db3f+=0x1){_0x228be4=_0x271f6f[_0x27db3f][_0xa909('0x47')]();if(manager['exists'](_0x228be4)){if(_0x205951[_0x228be4][_0xa909('0x4c')]&&_0x205951[_0x228be4][_0xa909('0x4d')]&&moment()[_0xa909('0x4e')](_0x205951[_0x228be4][_0xa909('0x4f')],_0x205951[_0x228be4][_0xa909('0x50')])){manager[_0xa909('0x53')](_0x228be4,_0x205951[_0x228be4][_0xa909('0x4c')],handleJob(_0x205951[_0x228be4]));logger['info'](_0xa909('0x54'),_0x205951[_0x228be4]['name'],_0x205951[_0x228be4]['cron']);}else{manager[_0xa909('0x44')](_0x228be4);manager[_0xa909('0x45')](_0x228be4);logger[_0xa909('0xa')](_0xa909('0x55'),_0x205951[_0x228be4]['name'],_0x205951[_0x228be4]['cron']);}}}})[_0xa909('0x2e')](function(_0x5d78b6){logger[_0xa909('0x2b')](JSON[_0xa909('0x2f')](_0x5d78b6));});}exports['run']=function(_0x2b91a3){return getJobs(_0x2b91a3);};exports[_0xa909('0x56')]=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 40b5b71..4dbfb9a 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 _0xb898=['tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','data1','sentimentRegion','SentimentScore','Positive','Negative','Neutral','update','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','Cloud\x20Provider\x20not\x20available','forEach','push','all','start','lodash','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','Comprehend','detectSentiment','substring','info','format','data2','transcribeName','then','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated'];(function(_0xd4488a,_0x598bb6){var _0x50614c=function(_0xb76d22){while(--_0xb76d22){_0xd4488a['push'](_0xd4488a['shift']());}};_0x50614c(++_0x598bb6);}(_0xb898,0x18f));var _0x8b89=function(_0x8e8ca7,_0x5a5e07){_0x8e8ca7=_0x8e8ca7-0x0;var _0x561381=_0xb898[_0x8e8ca7];return _0x561381;};var _=require(_0x8b89('0x0'));var AWS=require('aws-sdk');var rp=require(_0x8b89('0x1'));var util=require('util');var BPromise=require(_0x8b89('0x2'));var db=require(_0x8b89('0x3'))['db'];var logger=require(_0x8b89('0x4'))(_0x8b89('0x5'));function getTranscriptionJob(_0x47bc73,_0x2f7b63,_0x27fa02,_0x5758bf){return new Promise(function(_0x174f67,_0x12bea5){var _0x185786=new AWS[(_0x8b89('0x6'))]({'accessKeyId':_0x2f7b63,'secretAccessKey':_0x47bc73,'region':_0x27fa02});_0x185786['getTranscriptionJob']({'TranscriptionJobName':_0x5758bf},function(_0x2c3b3d,_0x42f86e){if(_0x2c3b3d){return _0x12bea5(_0x2c3b3d);}else{return _0x174f67(_0x42f86e);}});});}function sentiment(_0x40bb59,_0x3ccd40,_0x4656a1,_0x2651d4,_0x1efcdc){return new Promise(function(_0x19e2c2,_0x6c0699){var _0x31288f=new AWS[(_0x8b89('0x7'))]({'accessKeyId':_0x3ccd40,'secretAccessKey':_0x40bb59,'region':_0x4656a1});_0x31288f[_0x8b89('0x8')]({'Text':_0x2651d4,'LanguageCode':_0x1efcdc[_0x8b89('0x9')](0x0,0x2)},function(_0x211e76,_0x82f049){if(_0x211e76){return _0x6c0699(_0x211e76);}else{return _0x19e2c2(_0x82f049);}});});}function checkTranscribeJob(_0x5f57bf,_0x39ea44,_0x124ce7){var _0x1828be;return new BPromise(function(_0x4ba9fd,_0x3f9482){logger[_0x8b89('0xa')](util[_0x8b89('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x5f57bf['id'],_0x5f57bf['transcribeName']));return getTranscriptionJob(_0x124ce7['data1'],_0x124ce7[_0x8b89('0xc')],_0x39ea44['transcribeRegion'],_0x5f57bf[_0x8b89('0xd')])[_0x8b89('0xe')](function(_0x453f35){logger[_0x8b89('0xa')](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x5f57bf['id'],_0x5f57bf['transcribeName'],_0x453f35[_0x8b89('0xf')][_0x8b89('0x10')]));if(!_0x5f57bf[_0x8b89('0x11')]){switch(_0x453f35[_0x8b89('0xf')]['TranscriptionJobStatus']){case _0x8b89('0x12'):var _0x3c1fd3={'transcribeStatus':_0x453f35['TranscriptionJob'][_0x8b89('0x10')],'fileUri':_0x453f35[_0x8b89('0xf')][_0x8b89('0x13')][_0x8b89('0x14')]};logger['info'](util[_0x8b89('0xb')]('[RECORDING:%d]\x20Get\x20transcript',_0x5f57bf['id']));return rp({'uri':_0x453f35[_0x8b89('0xf')][_0x8b89('0x13')][_0x8b89('0x14')],'json':!![]})[_0x8b89('0xe')](function(_0x3a5fbd){logger[_0x8b89('0xa')](util[_0x8b89('0xb')](_0x8b89('0x15'),_0x5f57bf['id']));if(_0x3a5fbd&&_0x3a5fbd[_0x8b89('0x16')]&&_0x3a5fbd[_0x8b89('0x16')][_0x8b89('0x17')]&&_0x3a5fbd['results'][_0x8b89('0x17')][_0x8b89('0x18')]){_0x3c1fd3[_0x8b89('0x11')]='';for(var _0x1b21c7=0x0;_0x1b21c7<_0x3a5fbd[_0x8b89('0x16')][_0x8b89('0x17')][_0x8b89('0x18')];_0x1b21c7++){_0x3c1fd3[_0x8b89('0x11')]+=_0x3a5fbd['results'][_0x8b89('0x17')][_0x1b21c7][_0x8b89('0x19')]+'';}}return _0x5f57bf['update'](_0x3c1fd3);})[_0x8b89('0xe')](function(){logger['info'](util[_0x8b89('0xb')](_0x8b89('0x1a'),_0x5f57bf['id']));if(!_0x5f57bf[_0x8b89('0x1b')]){throw new db[(_0x8b89('0x1c'))][(_0x8b89('0x1d'))](_0x8b89('0x1e'));}if(!_0x39ea44[_0x8b89('0x1f')]||!_0x39ea44['sentimentAccountId']||!_0x39ea44['sentimentRegion']||!_0x39ea44[_0x8b89('0x20')]||!_0x39ea44[_0x8b89('0x21')]){throw new db[(_0x8b89('0x1c'))][(_0x8b89('0x1d'))](_0x8b89('0x22'));}if(!_0x3c1fd3[_0x8b89('0x11')]){throw new Error(_0x8b89('0x23'));}if(_0x39ea44[_0x8b89('0x24')]===_0x124ce7['id']){return _0x124ce7;}else{return db[_0x8b89('0x25')][_0x8b89('0x26')]({'where':{'id':_settings[_0x8b89('0x24')]}});}})[_0x8b89('0xe')](function(_0x7a1e3d){if(!_0x7a1e3d){throw new db['Sequelize'][(_0x8b89('0x1d'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x7a1e3d['data1']||!_0x7a1e3d['data2']){throw new db[(_0x8b89('0x1c'))][(_0x8b89('0x1d'))]('Cloud\x20Provider\x20not\x20configured');}_0x1828be=_0x7a1e3d;logger[_0x8b89('0xa')](util[_0x8b89('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5f57bf['id']));return sentiment(_0x1828be[_0x8b89('0x27')],_0x1828be['data2'],_0x39ea44[_0x8b89('0x28')],_0x3c1fd3['fileText'],_0x39ea44[_0x8b89('0x20')]);})[_0x8b89('0xe')](function(_0x302d73){logger[_0x8b89('0xa')](util[_0x8b89('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x5f57bf['id']));return _0x5f57bf['update']({'sentiment':_0x302d73['Sentiment'],'sPositive':_0x302d73[_0x8b89('0x29')][_0x8b89('0x2a')],'sNegative':_0x302d73[_0x8b89('0x29')][_0x8b89('0x2b')],'sMixed':_0x302d73[_0x8b89('0x29')]['Mixed'],'sNeutral':_0x302d73[_0x8b89('0x29')][_0x8b89('0x2c')]});})[_0x8b89('0xe')](function(){logger['info'](util[_0x8b89('0xb')](_0x8b89('0x1a'),_0x5f57bf['id']));_0x4ba9fd();});case'FAILED':return _0x5f57bf[_0x8b89('0x2d')]({'transcribeStatus':_0x8b89('0x2e'),'failureReason':_0x453f35[_0x8b89('0xf')]['FailureReason']})[_0x8b89('0xe')](function(){logger['info'](util[_0x8b89('0xb')](_0x8b89('0x1a'),_0x5f57bf['id']));_0x4ba9fd();});default:logger['info'](util['format'](_0x8b89('0x2f'),_0x5f57bf['id']));break;}}else{return BPromise[_0x8b89('0x30')]()[_0x8b89('0xe')](function(){if(!_0x5f57bf['tempSentiment']){throw new db[(_0x8b89('0x1c'))][(_0x8b89('0x1d'))](_0x8b89('0x1e'));}if(!_0x39ea44[_0x8b89('0x1f')]||!_0x39ea44[_0x8b89('0x24')]||!_0x39ea44[_0x8b89('0x28')]||!_0x39ea44['language']||!_0x39ea44[_0x8b89('0x21')]){throw new db[(_0x8b89('0x1c'))][(_0x8b89('0x1d'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x5f57bf['fileText']){throw new Error(_0x8b89('0x23'));}if(_0x39ea44['sentimentAccountId']===_0x124ce7['id']){return _0x124ce7;}else{return db[_0x8b89('0x25')][_0x8b89('0x26')]({'where':{'id':_settings[_0x8b89('0x24')]}});}})['then'](function(_0x171496){if(!_0x171496){throw new db['Sequelize'][(_0x8b89('0x1d'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x171496['data1']||!_0x171496[_0x8b89('0xc')]){throw new db[(_0x8b89('0x1c'))]['ValidationError'](_0x8b89('0x31'));}_0x1828be=_0x171496;logger[_0x8b89('0xa')](util[_0x8b89('0xb')](_0x8b89('0x32'),_0x5f57bf['id']));return sentiment(_0x1828be[_0x8b89('0x27')],_0x1828be['data2'],_0x39ea44[_0x8b89('0x28')],_0x5f57bf['fileText'],_0x39ea44[_0x8b89('0x20')]);})['then'](function(_0x2b6d69){logger['info'](util[_0x8b89('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x5f57bf['id']));return _0x5f57bf['update']({'sentiment':_0x2b6d69['Sentiment'],'sPositive':_0x2b6d69[_0x8b89('0x29')][_0x8b89('0x2a')],'sNegative':_0x2b6d69['SentimentScore'][_0x8b89('0x2b')],'sMixed':_0x2b6d69[_0x8b89('0x29')]['Mixed'],'sNeutral':_0x2b6d69['SentimentScore']['Neutral'],'transcribeStatus':_0x8b89('0x12')});})[_0x8b89('0xe')](function(){logger[_0x8b89('0xa')](util[_0x8b89('0xb')](_0x8b89('0x1a'),_0x5f57bf['id']));_0x4ba9fd();});}})[_0x8b89('0x33')](function(_0xa0b9ea){if(_0xa0b9ea){if(!_0xa0b9ea[_0x8b89('0x34')]||_0xa0b9ea[_0x8b89('0x34')]!==_0x8b89('0x35')){logger[_0x8b89('0x36')](util[_0x8b89('0xb')](_0x8b89('0x37'),_0x5f57bf['id']),util[_0x8b89('0x38')](_0xa0b9ea,{'showHidden':![],'depth':null}));}}_0x4ba9fd();});});}function checkTranscribe(){var _0x1081a0;var _0xd8a4cc;var _0xdb54c2;return db[_0x8b89('0x39')][_0x8b89('0x3a')]({'where':{'transcribeStatus':_0x8b89('0x3b')}})[_0x8b89('0xe')](function(_0x205407){if(!_0x205407||!_0x205407[_0x8b89('0x18')]){throw new db[(_0x8b89('0x1c'))][(_0x8b89('0x1d'))](_0x8b89('0x3c'));}_0x1081a0=_0x205407;return db[_0x8b89('0x3d')][_0x8b89('0x26')]({'where':{'id':0x1}});})['then'](function(_0x43f26f){if(!_0x43f26f){throw new db[(_0x8b89('0x1c'))][(_0x8b89('0x1d'))](_0x8b89('0x3e'));}_0xd8a4cc=_0x43f26f;if(!_0xd8a4cc[_0x8b89('0x5')]||!_0xd8a4cc[_0x8b89('0x3f')]||!_0xd8a4cc[_0x8b89('0x40')]||!_0xd8a4cc[_0x8b89('0x20')]||!_0xd8a4cc[_0x8b89('0x21')]){throw new db[(_0x8b89('0x1c'))][(_0x8b89('0x1d'))](_0x8b89('0x41'));}return db[_0x8b89('0x25')][_0x8b89('0x26')]({'where':{'id':_0xd8a4cc[_0x8b89('0x3f')]}});})['then'](function(_0x55ed9a){if(!_0x55ed9a){throw new db[(_0x8b89('0x1c'))][(_0x8b89('0x1d'))](_0x8b89('0x42'));}if(!_0x55ed9a[_0x8b89('0x27')]||!_0x55ed9a[_0x8b89('0xc')]){throw new db['Sequelize'][(_0x8b89('0x1d'))](_0x8b89('0x31'));}_0xdb54c2=_0x55ed9a;var _0x33bea0=[];_0x1081a0[_0x8b89('0x43')](function(_0x3a2a08){_0x33bea0[_0x8b89('0x44')](checkTranscribeJob(_0x3a2a08,_0xd8a4cc,_0xdb54c2));});return BPromise[_0x8b89('0x45')](_0x33bea0);})[_0x8b89('0x33')](function(_0x302717){if(_0x302717){if(!_0x302717[_0x8b89('0x34')]||_0x302717[_0x8b89('0x34')]!==_0x8b89('0x35')){logger[_0x8b89('0x36')](util[_0x8b89('0x38')](_0x302717,{'showHidden':![],'depth':null}));}}});}exports[_0x8b89('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x72e2=['Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','Negative','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','push','all','catch','error','start','lodash','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','substring','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','info','format','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','then','Cloud\x20Provider\x20not\x20available','data1','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Mixed'];(function(_0x3247cc,_0x33dfc7){var _0x58fb80=function(_0x200d79){while(--_0x200d79){_0x3247cc['push'](_0x3247cc['shift']());}};_0x58fb80(++_0x33dfc7);}(_0x72e2,0x131));var _0x272e=function(_0x180b16,_0x3fad7f){_0x180b16=_0x180b16-0x0;var _0x1041c1=_0x72e2[_0x180b16];return _0x1041c1;};var _=require(_0x272e('0x0'));var AWS=require('aws-sdk');var rp=require(_0x272e('0x1'));var util=require('util');var BPromise=require(_0x272e('0x2'));var db=require(_0x272e('0x3'))['db'];var logger=require(_0x272e('0x4'))(_0x272e('0x5'));function getTranscriptionJob(_0x27fb80,_0x3579b0,_0x455949,_0x434b20){return new Promise(function(_0x186328,_0x1f6c17){var _0x5bfb01=new AWS[(_0x272e('0x6'))]({'accessKeyId':_0x3579b0,'secretAccessKey':_0x27fb80,'region':_0x455949});_0x5bfb01[_0x272e('0x7')]({'TranscriptionJobName':_0x434b20},function(_0x313f5c,_0x4383b7){if(_0x313f5c){return _0x1f6c17(_0x313f5c);}else{return _0x186328(_0x4383b7);}});});}function sentiment(_0x37316c,_0x1aeeae,_0x409082,_0x2a2e8a,_0x4880cc){return new Promise(function(_0x2126f9,_0x4e027b){var _0x8c98e0=new AWS['Comprehend']({'accessKeyId':_0x1aeeae,'secretAccessKey':_0x37316c,'region':_0x409082});_0x8c98e0[_0x272e('0x8')]({'Text':_0x2a2e8a,'LanguageCode':_0x4880cc[_0x272e('0x9')](0x0,0x2)},function(_0xbe0a5d,_0x5eaab0){if(_0xbe0a5d){return _0x4e027b(_0xbe0a5d);}else{return _0x2126f9(_0x5eaab0);}});});}function checkTranscribeJob(_0x4f19f3,_0x2ffe99,_0x3b62ad){var _0x414d1a;return new BPromise(function(_0x5803bd,_0x2b614d){logger['info'](util['format'](_0x272e('0xa'),_0x4f19f3['id'],_0x4f19f3[_0x272e('0xb')]));return getTranscriptionJob(_0x3b62ad['data1'],_0x3b62ad[_0x272e('0xc')],_0x2ffe99['transcribeRegion'],_0x4f19f3[_0x272e('0xb')])['then'](function(_0x1b205e){logger['info'](util['format'](_0x272e('0xd'),_0x4f19f3['id'],_0x4f19f3['transcribeName'],_0x1b205e[_0x272e('0xe')]['TranscriptionJobStatus']));if(!_0x4f19f3[_0x272e('0xf')]){switch(_0x1b205e[_0x272e('0xe')][_0x272e('0x10')]){case _0x272e('0x11'):var _0x500cbb={'transcribeStatus':_0x1b205e[_0x272e('0xe')][_0x272e('0x10')],'fileUri':_0x1b205e[_0x272e('0xe')][_0x272e('0x12')]['TranscriptFileUri']};logger[_0x272e('0x13')](util[_0x272e('0x14')]('[RECORDING:%d]\x20Get\x20transcript',_0x4f19f3['id']));return rp({'uri':_0x1b205e[_0x272e('0xe')][_0x272e('0x12')]['TranscriptFileUri'],'json':!![]})['then'](function(_0x384b2b){logger[_0x272e('0x13')](util['format']('[RECORDING:%d]\x20Transcript\x20downloaded',_0x4f19f3['id']));if(_0x384b2b&&_0x384b2b[_0x272e('0x15')]&&_0x384b2b['results']['transcripts']&&_0x384b2b[_0x272e('0x15')][_0x272e('0x16')][_0x272e('0x17')]){_0x500cbb[_0x272e('0xf')]='';for(var _0x5d5ee1=0x0;_0x5d5ee1<_0x384b2b[_0x272e('0x15')]['transcripts'][_0x272e('0x17')];_0x5d5ee1++){_0x500cbb[_0x272e('0xf')]+=_0x384b2b[_0x272e('0x15')][_0x272e('0x16')][_0x5d5ee1]['transcript']+'';}}return _0x4f19f3[_0x272e('0x18')](_0x500cbb);})['then'](function(){logger[_0x272e('0x13')](util['format'](_0x272e('0x19'),_0x4f19f3['id']));if(!_0x4f19f3[_0x272e('0x1a')]){throw new db[(_0x272e('0x1b'))][(_0x272e('0x1c'))](_0x272e('0x1d'));}if(!_0x2ffe99['sentiment']||!_0x2ffe99[_0x272e('0x1e')]||!_0x2ffe99[_0x272e('0x1f')]||!_0x2ffe99['language']||!_0x2ffe99[_0x272e('0x20')]){throw new db[(_0x272e('0x1b'))][(_0x272e('0x1c'))](_0x272e('0x21'));}if(!_0x500cbb['fileText']){throw new Error(_0x272e('0x22'));}if(_0x2ffe99['sentimentAccountId']===_0x3b62ad['id']){return _0x3b62ad;}else{return db[_0x272e('0x23')][_0x272e('0x24')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x272e('0x25')](function(_0x5cb7b0){if(!_0x5cb7b0){throw new db[(_0x272e('0x1b'))]['ValidationError'](_0x272e('0x26'));}if(!_0x5cb7b0[_0x272e('0x27')]||!_0x5cb7b0[_0x272e('0xc')]){throw new db[(_0x272e('0x1b'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x414d1a=_0x5cb7b0;logger[_0x272e('0x13')](util[_0x272e('0x14')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4f19f3['id']));return sentiment(_0x414d1a[_0x272e('0x27')],_0x414d1a[_0x272e('0xc')],_0x2ffe99[_0x272e('0x1f')],_0x500cbb[_0x272e('0xf')],_0x2ffe99[_0x272e('0x28')]);})['then'](function(_0x4e8bcd){logger[_0x272e('0x13')](util['format'](_0x272e('0x29'),_0x4f19f3['id']));return _0x4f19f3['update']({'sentiment':_0x4e8bcd['Sentiment'],'sPositive':_0x4e8bcd[_0x272e('0x2a')][_0x272e('0x2b')],'sNegative':_0x4e8bcd[_0x272e('0x2a')]['Negative'],'sMixed':_0x4e8bcd[_0x272e('0x2a')][_0x272e('0x2c')],'sNeutral':_0x4e8bcd[_0x272e('0x2a')][_0x272e('0x2d')]});})[_0x272e('0x25')](function(){logger[_0x272e('0x13')](util[_0x272e('0x14')](_0x272e('0x19'),_0x4f19f3['id']));_0x5803bd();});case _0x272e('0x2e'):return _0x4f19f3[_0x272e('0x18')]({'transcribeStatus':_0x272e('0x2e'),'failureReason':_0x1b205e[_0x272e('0xe')][_0x272e('0x2f')]})['then'](function(){logger[_0x272e('0x13')](util[_0x272e('0x14')](_0x272e('0x19'),_0x4f19f3['id']));_0x5803bd();});default:logger['info'](util[_0x272e('0x14')](_0x272e('0x30'),_0x4f19f3['id']));break;}}else{return BPromise[_0x272e('0x31')]()[_0x272e('0x25')](function(){if(!_0x4f19f3[_0x272e('0x1a')]){throw new db[(_0x272e('0x1b'))][(_0x272e('0x1c'))](_0x272e('0x1d'));}if(!_0x2ffe99[_0x272e('0x32')]||!_0x2ffe99[_0x272e('0x1e')]||!_0x2ffe99['sentimentRegion']||!_0x2ffe99['language']||!_0x2ffe99[_0x272e('0x20')]){throw new db[(_0x272e('0x1b'))]['ValidationError'](_0x272e('0x21'));}if(!_0x4f19f3[_0x272e('0xf')]){throw new Error(_0x272e('0x22'));}if(_0x2ffe99[_0x272e('0x1e')]===_0x3b62ad['id']){return _0x3b62ad;}else{return db[_0x272e('0x23')][_0x272e('0x24')]({'where':{'id':_settings[_0x272e('0x1e')]}});}})[_0x272e('0x25')](function(_0x379206){if(!_0x379206){throw new db['Sequelize'][(_0x272e('0x1c'))](_0x272e('0x26'));}if(!_0x379206[_0x272e('0x27')]||!_0x379206[_0x272e('0xc')]){throw new db['Sequelize'][(_0x272e('0x1c'))](_0x272e('0x33'));}_0x414d1a=_0x379206;logger[_0x272e('0x13')](util[_0x272e('0x14')](_0x272e('0x34'),_0x4f19f3['id']));return sentiment(_0x414d1a[_0x272e('0x27')],_0x414d1a['data2'],_0x2ffe99['sentimentRegion'],_0x4f19f3['fileText'],_0x2ffe99[_0x272e('0x28')]);})[_0x272e('0x25')](function(_0xce7f55){logger['info'](util['format'](_0x272e('0x29'),_0x4f19f3['id']));return _0x4f19f3[_0x272e('0x18')]({'sentiment':_0xce7f55[_0x272e('0x35')],'sPositive':_0xce7f55[_0x272e('0x2a')][_0x272e('0x2b')],'sNegative':_0xce7f55[_0x272e('0x2a')][_0x272e('0x36')],'sMixed':_0xce7f55[_0x272e('0x2a')]['Mixed'],'sNeutral':_0xce7f55[_0x272e('0x2a')][_0x272e('0x2d')],'transcribeStatus':'COMPLETED'});})[_0x272e('0x25')](function(){logger[_0x272e('0x13')](util[_0x272e('0x14')](_0x272e('0x19'),_0x4f19f3['id']));_0x5803bd();});}})['catch'](function(_0x3d160c){if(_0x3d160c){if(!_0x3d160c[_0x272e('0x37')]||_0x3d160c[_0x272e('0x37')]!==_0x272e('0x38')){logger['error'](util['format'](_0x272e('0x39'),_0x4f19f3['id']),util[_0x272e('0x3a')](_0x3d160c,{'showHidden':![],'depth':null}));}}_0x5803bd();});});}function checkTranscribe(){var _0x38fc5b;var _0x2062c3;var _0xf34253;return db[_0x272e('0x3b')]['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x272e('0x25')](function(_0x5542ef){if(!_0x5542ef||!_0x5542ef[_0x272e('0x17')]){throw new db[(_0x272e('0x1b'))][(_0x272e('0x1c'))](_0x272e('0x3c'));}_0x38fc5b=_0x5542ef;return db[_0x272e('0x3d')][_0x272e('0x24')]({'where':{'id':0x1}});})[_0x272e('0x25')](function(_0x50f6b6){if(!_0x50f6b6){throw new db[(_0x272e('0x1b'))][(_0x272e('0x1c'))](_0x272e('0x3e'));}_0x2062c3=_0x50f6b6;if(!_0x2062c3[_0x272e('0x5')]||!_0x2062c3[_0x272e('0x3f')]||!_0x2062c3['transcribeRegion']||!_0x2062c3['language']||!_0x2062c3['bucket']){throw new db[(_0x272e('0x1b'))]['ValidationError']('Transcribe\x20not\x20configured');}return db[_0x272e('0x23')][_0x272e('0x24')]({'where':{'id':_0x2062c3['transcribeAccountId']}});})['then'](function(_0x224db2){if(!_0x224db2){throw new db[(_0x272e('0x1b'))][(_0x272e('0x1c'))](_0x272e('0x26'));}if(!_0x224db2[_0x272e('0x27')]||!_0x224db2[_0x272e('0xc')]){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0xf34253=_0x224db2;var _0x275972=[];_0x38fc5b[_0x272e('0x40')](function(_0x1c422a){_0x275972[_0x272e('0x41')](checkTranscribeJob(_0x1c422a,_0x2062c3,_0xf34253));});return BPromise[_0x272e('0x42')](_0x275972);})[_0x272e('0x43')](function(_0x543c63){if(_0x543c63){if(!_0x543c63[_0x272e('0x37')]||_0x543c63[_0x272e('0x37')]!==_0x272e('0x38')){logger[_0x272e('0x44')](util[_0x272e('0x3a')](_0x543c63,{'showHidden':![],'depth':null}));}}});}exports[_0x272e('0x45')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 228582f..d5a5406 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 _0x4dee=['redis','defaults','localhost','socket.io-emitter','subtract','hours','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x4dee,0x1a5));var _0xe4de=function(_0x350120,_0x5a6920){_0x350120=_0x350120-0x0;var _0x1182ea=_0x4dee[_0x350120];return _0x1182ea;};'use strict';var _=require(_0xe4de('0x0'));var moment=require(_0xe4de('0x1'));var Redis=require(_0xe4de('0x2'));var util=require(_0xe4de('0x3'));var config=require(_0xe4de('0x4'));var db=require(_0xe4de('0x5'))['db'];var logger=require(_0xe4de('0x6'))(_0xe4de('0x7'));config[_0xe4de('0x8')]=_[_0xe4de('0x9')](config[_0xe4de('0x8')],{'host':_0xe4de('0xa'),'port':0x18eb});var io=require(_0xe4de('0xb'))(new Redis(config[_0xe4de('0x8')]));function closeInteractions(){var _0x3ce7e1=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xe4de('0xc')](0x18,_0xe4de('0xd'))}}})['then'](function(_0x158d72){if(_0x158d72&&_0x158d72[_0xe4de('0xe')]){_0x3ce7e1=_[_0xe4de('0xf')](_0x158d72||[],'id');logger['info'](_0xe4de('0x10'),_0x3ce7e1[_0xe4de('0x11')]());return db[_0xe4de('0x12')][_0xe4de('0x13')]({'closeReason':_0xe4de('0x14'),'disposition':_0xe4de('0x15'),'closed':!![],'closedAt':moment()[_0xe4de('0x16')](_0xe4de('0x17'))},{'where':{'id':_0x3ce7e1}});}})['then'](function(){if(_0x3ce7e1&&_0x3ce7e1[_0xe4de('0xe')]){logger[_0xe4de('0x18')](_0xe4de('0x19'),_0x3ce7e1[_0xe4de('0x11')]());for(var _0x1bd112=0x0;_0x1bd112<_0x3ce7e1[_0xe4de('0xe')];_0x1bd112++){io[_0xe4de('0x1a')](_0xe4de('0x1b'),{'id':_0x3ce7e1[_0x1bd112],'closed':!![]});}}})[_0xe4de('0x1c')](function(_0x59908c){logger[_0xe4de('0x1d')](_0xe4de('0x1e'),_0x59908c?util[_0xe4de('0x1f')](_0x59908c,{'showHidden':![],'depth':null}):'');});}exports[_0xe4de('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x451d=['whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','lodash','moment','ioredis','util','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','WhatsappInteraction','findAll','hours','then','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','timeout','YYYY-MM-DD\x20HH:mm:ss','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x451d,0x1a3));var _0xd451=function(_0x21415f,_0x9c483d){_0x21415f=_0x21415f-0x0;var _0x3ca17a=_0x451d[_0x21415f];return _0x3ca17a;};'use strict';var _=require(_0xd451('0x0'));var moment=require(_0xd451('0x1'));var Redis=require(_0xd451('0x2'));var util=require(_0xd451('0x3'));var config=require('../../config/environment');var db=require(_0xd451('0x4'))['db'];var logger=require(_0xd451('0x5'))(_0xd451('0x6'));config[_0xd451('0x7')]=_[_0xd451('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xd451('0x9'))(new Redis(config[_0xd451('0x7')]));function closeInteractions(){var _0x35718c=[];return db[_0xd451('0xa')][_0xd451('0xb')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xd451('0xc'))}}})[_0xd451('0xd')](function(_0x450215){if(_0x450215&&_0x450215['length']){_0x35718c=_[_0xd451('0xe')](_0x450215||[],'id');logger[_0xd451('0xf')](_0xd451('0x10'),_0x35718c[_0xd451('0x11')]());return db['WhatsappInteraction']['update']({'closeReason':'system','disposition':_0xd451('0x12'),'closed':!![],'closedAt':moment()['format'](_0xd451('0x13'))},{'where':{'id':_0x35718c}});}})[_0xd451('0xd')](function(){if(_0x35718c&&_0x35718c[_0xd451('0x14')]){logger[_0xd451('0xf')](_0xd451('0x15'),_0x35718c[_0xd451('0x11')]());for(var _0x163441=0x0;_0x163441<_0x35718c[_0xd451('0x14')];_0x163441++){io[_0xd451('0x16')](_0xd451('0x17'),{'id':_0x35718c[_0x163441],'closed':!![]});}}})[_0xd451('0x18')](function(_0x185fd0){logger['error'](_0xd451('0x19'),_0x185fd0?util['inspect'](_0x185fd0,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 2914566..d505800 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c13=['@xcally.com','CmContact','destroy','then','bulkCreate','log','hopper1','finished\x20populating','contacts2','CmHopper','hopper2','catch','../mysqldb','push','Biondo','now','Innocenzo','innocenzo.biondo'];(function(_0x4b8a93,_0x252a45){var _0x2715f6=function(_0x1f6333){while(--_0x1f6333){_0x4b8a93['push'](_0x4b8a93['shift']());}};_0x2715f6(++_0x252a45);}(_0x4c13,0xc0));var _0x34c1=function(_0x7810a8,_0x2b19dd){_0x7810a8=_0x7810a8-0x0;var _0x2645c6=_0x4c13[_0x7810a8];return _0x2645c6;};'use strict';var util=require('util');var db=require(_0x34c1('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x34c1('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x34c1('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x34c1('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x34c1('0x4')+i,'lastName':_0x34c1('0x2')+i,'phone':0xf879fb460+i,'email':_0x34c1('0x5')+i+_0x34c1('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x34c1('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x34c1('0x3')]()});}db[_0x34c1('0x7')][_0x34c1('0x8')]({'where':{}})[_0x34c1('0x9')](function(){return db[_0x34c1('0x7')][_0x34c1('0xa')](contacts);})['then'](function(){console[_0x34c1('0xb')]('finished\x20populating','contacts1');return db['CmHopper'][_0x34c1('0x8')]({'where':{}});})[_0x34c1('0x9')](function(){return db['CmHopper'][_0x34c1('0xa')](hopper);})['then'](function(){console['log']('finished\x20populating',_0x34c1('0xc'));return db['CmContact'][_0x34c1('0xa')](contacts2);})[_0x34c1('0x9')](function(){console[_0x34c1('0xb')](_0x34c1('0xd'),_0x34c1('0xe'));return db[_0x34c1('0xf')][_0x34c1('0xa')](hopper2);})[_0x34c1('0x9')](function(){console[_0x34c1('0xb')]('finished\x20populating',_0x34c1('0x10'));})[_0x34c1('0x11')](function(_0x2d4341){console[_0x34c1('0xb')](_0x2d4341);}); \ No newline at end of file +var _0x3734=['Biondo','@xcally.com','now','innocenzo.biondo','CmContact','destroy','then','finished\x20populating','bulkCreate','log','CmHopper','hopper2','push','Innocenzo'];(function(_0x47354e,_0x4328c9){var _0x46cbe2=function(_0x30f8bb){while(--_0x30f8bb){_0x47354e['push'](_0x47354e['shift']());}};_0x46cbe2(++_0x4328c9);}(_0x3734,0x98));var _0x4373=function(_0x4efe4f,_0x5df9d6){_0x4efe4f=_0x4efe4f-0x0;var _0x5111bc=_0x3734[_0x4efe4f];return _0x5111bc;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x4373('0x0')]({'id':i,'firstName':_0x4373('0x1')+i,'lastName':_0x4373('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x4373('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x4373('0x0')]({'id':i,'active':![],'scheduledat':Date[_0x4373('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x4373('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x4373('0x0')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x4373('0x2')+i,'phone':0xf879fb460+i,'email':_0x4373('0x5')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x4373('0x0')]({'id':i,'active':![],'scheduledat':Date[_0x4373('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4373('0x4')](),'updatedAt':Date[_0x4373('0x4')]()});}db[_0x4373('0x6')][_0x4373('0x7')]({'where':{}})['then'](function(){return db[_0x4373('0x6')]['bulkCreate'](contacts);})[_0x4373('0x8')](function(){console['log'](_0x4373('0x9'),'contacts1');return db['CmHopper'][_0x4373('0x7')]({'where':{}});})[_0x4373('0x8')](function(){return db['CmHopper'][_0x4373('0xa')](hopper);})[_0x4373('0x8')](function(){console[_0x4373('0xb')](_0x4373('0x9'),'hopper1');return db['CmContact']['bulkCreate'](contacts2);})[_0x4373('0x8')](function(){console[_0x4373('0xb')](_0x4373('0x9'),'contacts2');return db[_0x4373('0xc')][_0x4373('0xa')](hopper2);})[_0x4373('0x8')](function(){console[_0x4373('0xb')](_0x4373('0x9'),_0x4373('0xd'));})['catch'](function(_0x3a96ed){console[_0x4373('0xb')](_0x3a96ed);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 89296b6..e161f1b 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc6b=['%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','then','log','add\x20user','catch','push','format'];(function(_0x4c6cf0,_0x826f70){var _0x108145=function(_0x299f69){while(--_0x299f69){_0x4c6cf0['push'](_0x4c6cf0['shift']());}};_0x108145(++_0x826f70);}(_0xfc6b,0x142));var _0xbfc6=function(_0x1dffa3,_0x3c967a){_0x1dffa3=_0x1dffa3-0x0;var _0x49e93e=_0xfc6b[_0x1dffa3];return _0x49e93e;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xbfc6('0x0')]({'name':util[_0xbfc6('0x1')](_0xbfc6('0x2'),_0xbfc6('0x3'),i),'fullname':util[_0xbfc6('0x1')]('%s%s',_0xbfc6('0x3'),i),'email':util[_0xbfc6('0x1')](_0xbfc6('0x4'),_0xbfc6('0x3'),i),'role':_0xbfc6('0x3'),'password':_0xbfc6('0x5'),'internal':0xfa0+i,'type':_0xbfc6('0x6'),'transport':[_0xbfc6('0x7'),'ws',_0xbfc6('0x8')],'disallow':['all'],'allow':['ulaw'],'defaultuser':util['format'](_0xbfc6('0x2'),_0xbfc6('0x3'),i),'encryption':_0xbfc6('0x9'),'avpf':'yes','force_avp':_0xbfc6('0x9'),'icesupport':_0xbfc6('0x9'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xbfc6('0xa'),'dtlsprivatekey':_0xbfc6('0xb'),'dtlssetup':_0xbfc6('0xc'),'callerid':util[_0xbfc6('0x1')](_0xbfc6('0xd'),util[_0xbfc6('0x1')](_0xbfc6('0x2'),_0xbfc6('0x3'),i),0xfa0+i)});}db['User']['bulkCreate'](users)[_0xbfc6('0xe')](function(){console[_0xbfc6('0xf')](_0xbfc6('0x10'));})[_0xbfc6('0x11')](function(_0x31df2e){console[_0xbfc6('0xf')](_0x31df2e);}); \ No newline at end of file +var _0xf251=['agent','password','udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','format','%s%s'];(function(_0x14e5e0,_0x478f9c){var _0x2076de=function(_0x339a20){while(--_0x339a20){_0x14e5e0['push'](_0x14e5e0['shift']());}};_0x2076de(++_0x478f9c);}(_0xf251,0xb8));var _0x1f25=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0xf251[_0x1a7846];return _0x48049;};'use strict';var util=require(_0x1f25('0x0'));var db=require(_0x1f25('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x1f25('0x2')]({'name':util[_0x1f25('0x3')](_0x1f25('0x4'),'agent',i),'fullname':util['format'](_0x1f25('0x4'),'agent',i),'email':util[_0x1f25('0x3')]('%s%s@xcally.com','agent',i),'role':_0x1f25('0x5'),'password':_0x1f25('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0x1f25('0x7'),'ws','wss'],'disallow':[_0x1f25('0x8')],'allow':[_0x1f25('0x9')],'defaultuser':util[_0x1f25('0x3')](_0x1f25('0x4'),_0x1f25('0x5'),i),'encryption':_0x1f25('0xa'),'avpf':_0x1f25('0xa'),'force_avp':_0x1f25('0xa'),'icesupport':'yes','dtlsenable':_0x1f25('0xa'),'dtlsverify':'no','dtlscertfile':_0x1f25('0xb'),'dtlsprivatekey':_0x1f25('0xc'),'dtlssetup':_0x1f25('0xd'),'callerid':util[_0x1f25('0x3')](_0x1f25('0xe'),util['format'](_0x1f25('0x4'),_0x1f25('0x5'),i),0xfa0+i)});}db[_0x1f25('0xf')][_0x1f25('0x10')](users)[_0x1f25('0x11')](function(){console[_0x1f25('0x12')](_0x1f25('0x13'));})[_0x1f25('0x14')](function(_0x174b9d){console[_0x1f25('0x12')](_0x174b9d);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 127e2c8..ce35a0b 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x144a=['all','chat','fax','sms','mail','openchannel','whatsapp','format','telephone:%s','trunk:%s','campaign:%s:%s','leave','ChatInteractions','emit','user_has_chat_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','setMaxListeners','address','request','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','type','UserProfileSection','findOne','then','ChatQueues','FaxQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','MailInteractions','FaxInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','ChatQueue','push','FaxQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueues','MailQueues','MailQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues'];(function(_0x124298,_0x542004){var _0x35ac24=function(_0x49afe8){while(--_0x49afe8){_0x124298['push'](_0x124298['shift']());}};_0x35ac24(++_0x542004);}(_0x144a,0xe7));var _0xa144=function(_0x1b716d,_0x1f9962){_0x1b716d=_0x1b716d-0x0;var _0x517dcc=_0x144a[_0x1b716d];return _0x517dcc;};'use strict';var _=require(_0xa144('0x0'));var util=require(_0xa144('0x1'));var BPromise=require(_0xa144('0x2'));var db=require(_0xa144('0x3'))['db'];var config=require(_0xa144('0x4'));var queryQueues={'attributes':['id',_0xa144('0x5')],'include':[{'as':_0xa144('0x6'),'model':db[_0xa144('0x7')],'attributes':['id',_0xa144('0x5'),_0xa144('0x8')],'raw':!![],'where':{'role':_0xa144('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xa144('0x5')],'where':{'role':_0xa144('0xa')}};var queryTrunks={'raw':!![],'attributes':['id',_0xa144('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0xa144('0x5')],'where':{'role':_0xa144('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xa144('0x5'),_0xa144('0xb')],'where':{'type':'ivr'}};function getAssociatedResources(_0x2afb2d,_0xe845ad,_0x2e26e4){return db[_0xa144('0xc')][_0xa144('0xd')]({'where':{'name':_0x2afb2d,'userProfileId':_0xe845ad},'raw':!![]})[_0xa144('0xe')](function(_0x45e2ea){if(_0x45e2ea){if(_0x45e2ea['autoAssociation']){switch(_0x2afb2d){case'VoiceQueues':case _0xa144('0xf'):case _0xa144('0x10'):case'SmsQueues':case'MailQueues':case _0xa144('0x11'):case _0xa144('0x12'):return db[_0x2e26e4][_0xa144('0x13')](queryQueues);case _0xa144('0x14'):return db[_0x2e26e4]['findAll'](queryTelephones);case _0xa144('0x15'):return db[_0x2e26e4][_0xa144('0x13')](queryTrunks);case _0xa144('0x16'):return db[_0x2e26e4][_0xa144('0x13')](queryCampaigns);}}else{return db[_0xa144('0x17')][_0xa144('0x13')]({'attributes':[_0xa144('0x18')],'where':{'sectionId':_0x45e2ea['id']},'raw':!![]})['then'](function(_0x2b8029){if(_0x2b8029){var _0x4f6a71={'where':{'id':_[_0xa144('0x19')](_0x2b8029,_0xa144('0x18'))},'raw':!![]};switch(_0x2e26e4){case _0xa144('0x7'):_0x4f6a71[_0xa144('0x1a')][_0xa144('0x8')]=_0xa144('0xa');break;case _0xa144('0x1b'):_0x4f6a71[_0xa144('0x1a')][_0xa144('0xb')]='ivr';break;}return db[_0x2e26e4][_0xa144('0x13')](_0x4f6a71);}else{return[];}});}}else{return[];}})['then'](function(_0x187e09){return _0x187e09;});}function joinOrLeaveQueues(_0x26c377,_0x133986,_0x517f16,_0x4eafb4){_0x26c377[_0x133986](util['format'](_0xa144('0x1c'),_0x517f16,_0x4eafb4[_0xa144('0x5')]));if(_0x4eafb4['Agents']){for(var _0x2aa390=0x0;_0x2aa390<_0x4eafb4[_0xa144('0x6')][_0xa144('0x1d')];_0x2aa390+=0x1){_0x26c377[_0x133986](util['format'](_0xa144('0x1e'),_0x4eafb4[_0xa144('0x6')][_0x2aa390][_0xa144('0x5')]));}}}function joinOrLeave(_0x53c96b,_0x5072ad,_0x40d5f9){var _0x3b7c73;if(_0x53c96b[_0xa144('0x1f')][_0xa144('0x20')]['id']){db[_0xa144('0x7')][_0xa144('0x21')]({'attributes':['id',_0xa144('0x5'),'role',_0xa144('0x22')],'where':{'id':_0x53c96b[_0xa144('0x1f')]['query']['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xa144('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xa144('0x24')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xa144('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xa144('0x26')],'as':_0xa144('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xa144('0x28')],'as':_0xa144('0x29'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x21675c){if(_0x21675c){_0x3b7c73=_0x21675c;_0x53c96b[_0x5072ad](util['format'](_0xa144('0x1e'),_0x21675c[_0xa144('0x5')]));var _0x3f1030=[];switch(_0x21675c[_0xa144('0x8')]){case _0xa144('0x2a'):_0x53c96b[_0x5072ad](_0xa144('0x2b'));_0x53c96b[_0x5072ad](_0xa144('0x2c'));if(queryQueues[_0xa144('0x2d')](_0xa144('0x2e'))){delete queryQueues[_0xa144('0x2e')];}_0x3f1030['push'](db[_0xa144('0x2f')][_0xa144('0x13')](queryQueues));_0x3f1030['push'](db[_0xa144('0x30')]['findAll'](queryQueues));_0x3f1030[_0xa144('0x31')](db[_0xa144('0x32')][_0xa144('0x13')](queryQueues));_0x3f1030[_0xa144('0x31')](db['SmsQueue'][_0xa144('0x13')](queryQueues));_0x3f1030['push'](db['MailQueue'][_0xa144('0x13')](queryQueues));_0x3f1030[_0xa144('0x31')](db[_0xa144('0x33')][_0xa144('0x13')](queryQueues));_0x3f1030[_0xa144('0x31')](db[_0xa144('0x34')][_0xa144('0x13')](queryQueues));_0x3f1030[_0xa144('0x31')](db['User'][_0xa144('0x13')](queryTelephones));_0x3f1030[_0xa144('0x31')](db[_0xa144('0x35')]['findAll'](queryTrunks));_0x3f1030[_0xa144('0x31')](db['Campaign']['findAll'](queryCampaigns));_0x3f1030[_0xa144('0x31')](db[_0xa144('0x7')][_0xa144('0x13')](queryAgents));break;case _0xa144('0x36'):_0x53c96b[_0x5072ad]('voice:inbound');_0x53c96b[_0x5072ad](_0xa144('0x2c'));_0x3f1030[_0xa144('0x31')](getAssociatedResources(_0xa144('0x37'),_0x21675c[_0xa144('0x22')],_0xa144('0x2f')));_0x3f1030['push'](getAssociatedResources(_0xa144('0xf'),_0x21675c[_0xa144('0x22')],_0xa144('0x30')));_0x3f1030['push'](getAssociatedResources(_0xa144('0x10'),_0x21675c[_0xa144('0x22')],'FaxQueue'));_0x3f1030[_0xa144('0x31')](getAssociatedResources('SmsQueues',_0x21675c[_0xa144('0x22')],'SmsQueue'));_0x3f1030[_0xa144('0x31')](getAssociatedResources(_0xa144('0x38'),_0x21675c[_0xa144('0x22')],_0xa144('0x39')));_0x3f1030['push'](getAssociatedResources(_0xa144('0x11'),_0x21675c[_0xa144('0x22')],'OpenchannelQueue'));_0x3f1030[_0xa144('0x31')](getAssociatedResources('WhatsappQueues',_0x21675c[_0xa144('0x22')],_0xa144('0x34')));_0x3f1030['push'](getAssociatedResources(_0xa144('0x14'),_0x21675c[_0xa144('0x22')],'User'));_0x3f1030['push'](getAssociatedResources(_0xa144('0x15'),_0x21675c['userProfileId'],_0xa144('0x35')));_0x3f1030[_0xa144('0x31')](getAssociatedResources(_0xa144('0x16'),_0x21675c[_0xa144('0x22')],_0xa144('0x1b')));_0x3f1030[_0xa144('0x31')](db[_0xa144('0x7')][_0xa144('0x13')](queryAgents));break;case'agent':_0x53c96b[_0x5072ad]('voice:inbound');_0x53c96b[_0x5072ad](_0xa144('0x2c'));_0x3f1030[_0xa144('0x31')](_0x21675c[_0xa144('0x3a')]({'attributes':['id',_0xa144('0x5')]}));_0x3f1030['push'](_0x21675c[_0xa144('0x3b')]({'attributes':['id',_0xa144('0x5')]}));_0x3f1030[_0xa144('0x31')](_0x21675c[_0xa144('0x3c')]({'attributes':['id',_0xa144('0x5')]}));_0x3f1030[_0xa144('0x31')](_0x21675c[_0xa144('0x3d')]({'attributes':['id',_0xa144('0x5')]}));_0x3f1030[_0xa144('0x31')](_0x21675c[_0xa144('0x3e')]({'attributes':['id',_0xa144('0x5')]}));_0x3f1030['push'](_0x21675c['getOpenchannelQueues']({'attributes':['id','name']}));_0x3f1030[_0xa144('0x31')](_0x21675c['getWhatsappQueues']({'attributes':['id',_0xa144('0x5')]}));break;}return BPromise[_0xa144('0x3f')](_0x3f1030);}})[_0xa144('0xe')](function(_0x15a2f5){if(_0x15a2f5&&_0x15a2f5[_0xa144('0x1d')]){for(var _0x271ce0=0x0;_0x271ce0<_0x15a2f5[_0xa144('0x1d')];_0x271ce0+=0x1){for(var _0x12fcb5=0x0;_0x12fcb5<_0x15a2f5[_0x271ce0][_0xa144('0x1d')];_0x12fcb5+=0x1){switch(_0x271ce0){case 0x0:joinOrLeaveQueues(_0x53c96b,_0x5072ad,'voice',_0x15a2f5[_0x271ce0][_0x12fcb5]);break;case 0x1:joinOrLeaveQueues(_0x53c96b,_0x5072ad,_0xa144('0x40'),_0x15a2f5[_0x271ce0][_0x12fcb5]);break;case 0x2:joinOrLeaveQueues(_0x53c96b,_0x5072ad,_0xa144('0x41'),_0x15a2f5[_0x271ce0][_0x12fcb5]);break;case 0x3:joinOrLeaveQueues(_0x53c96b,_0x5072ad,_0xa144('0x42'),_0x15a2f5[_0x271ce0][_0x12fcb5]);break;case 0x4:joinOrLeaveQueues(_0x53c96b,_0x5072ad,_0xa144('0x43'),_0x15a2f5[_0x271ce0][_0x12fcb5]);break;case 0x5:joinOrLeaveQueues(_0x53c96b,_0x5072ad,_0xa144('0x44'),_0x15a2f5[_0x271ce0][_0x12fcb5]);break;case 0x6:joinOrLeaveQueues(_0x53c96b,_0x5072ad,_0xa144('0x45'),_0x15a2f5[_0x271ce0][_0x12fcb5]);break;case 0x7:if(_0x3b7c73['role']!==_0xa144('0x9'))_0x53c96b[_0x5072ad](util[_0xa144('0x46')](_0xa144('0x47'),_0x15a2f5[_0x271ce0][_0x12fcb5]['name']));break;case 0x8:if(_0x3b7c73[_0xa144('0x8')]!=='agent')_0x53c96b[_0x5072ad](util[_0xa144('0x46')](_0xa144('0x48'),_0x15a2f5[_0x271ce0][_0x12fcb5][_0xa144('0x5')]));break;case 0x9:if(_0x3b7c73[_0xa144('0x8')]!==_0xa144('0x9'))_0x53c96b[_0x5072ad](util[_0xa144('0x46')](_0xa144('0x49'),_0x15a2f5[_0x271ce0][_0x12fcb5][_0xa144('0xb')],_0x15a2f5[_0x271ce0][_0x12fcb5]['name']));break;case 0xa:_0x53c96b[_0x5072ad](util[_0xa144('0x46')]('user:%s',_0x15a2f5[_0x271ce0][_0x12fcb5][_0xa144('0x5')]));break;}}}}})[_0xa144('0xe')](function(){if(_0x5072ad===_0xa144('0x4a')){var _0x29de1e=_[_0xa144('0x19')](_0x3b7c73[_0xa144('0x4b')],'id');return _0x3b7c73['removeChatInteractions'](_0x29de1e)[_0xa144('0xe')](function(){for(var _0x140c9d=0x0;_0x140c9d<_0x29de1e[_0xa144('0x1d')];_0x140c9d+=0x1){_0x40d5f9[_0xa144('0x4c')](_0xa144('0x4d'),{'ChatInteractionId':Number(_0x29de1e[_0x140c9d]),'UserId':Number(_0x3b7c73['id'])});}});}})[_0xa144('0xe')](function(){if(_0x5072ad===_0xa144('0x4a')){var _0x11620a=_['map'](_0x3b7c73[_0xa144('0x23')],'id');return _0x3b7c73['removeMailInteractions'](_0x11620a)[_0xa144('0xe')](function(){for(var _0x1f4440=0x0;_0x1f4440<_0x11620a['length'];_0x1f4440+=0x1){_0x40d5f9[_0xa144('0x4c')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x11620a[_0x1f4440]),'UserId':Number(_0x3b7c73['id'])});}});}})[_0xa144('0xe')](function(){if(_0x5072ad===_0xa144('0x4a')){var _0x30f0df=_[_0xa144('0x19')](_0x3b7c73['FaxInteractions'],'id');return _0x3b7c73[_0xa144('0x4e')](_0x30f0df)[_0xa144('0xe')](function(){for(var _0x4b15b4=0x0;_0x4b15b4<_0x30f0df[_0xa144('0x1d')];_0x4b15b4+=0x1){_0x40d5f9[_0xa144('0x4c')](_0xa144('0x4f'),{'FaxInteractionId':Number(_0x30f0df[_0x4b15b4]),'UserId':Number(_0x3b7c73['id'])});}});}})[_0xa144('0xe')](function(){if(_0x5072ad===_0xa144('0x4a')){var _0x1a8912=_[_0xa144('0x19')](_0x3b7c73[_0xa144('0x25')],'id');return _0x3b7c73[_0xa144('0x50')](_0x1a8912)['then'](function(){for(var _0x584042=0x0;_0x584042<_0x1a8912[_0xa144('0x1d')];_0x584042+=0x1){_0x40d5f9['emit'](_0xa144('0x51'),{'SmsInteractionId':Number(_0x1a8912[_0x584042]),'UserId':Number(_0x3b7c73['id'])});}});}})[_0xa144('0xe')](function(){if(_0x5072ad===_0xa144('0x4a')){var _0x33be83=_[_0xa144('0x19')](_0x3b7c73[_0xa144('0x27')],'id');return _0x3b7c73[_0xa144('0x52')](_0x33be83)[_0xa144('0xe')](function(){for(var _0x43c242=0x0;_0x43c242<_0x33be83[_0xa144('0x1d')];_0x43c242+=0x1){_0x40d5f9[_0xa144('0x4c')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x33be83[_0x43c242]),'UserId':Number(_0x3b7c73['id'])});}});}})['then'](function(){if(_0x5072ad===_0xa144('0x4a')){var _0x3c94e5=_[_0xa144('0x19')](_0x3b7c73['WhatsappInteractions'],'id');return _0x3b7c73[_0xa144('0x53')](_0x3c94e5)['then'](function(){for(var _0x265e05=0x0;_0x265e05<_0x3c94e5[_0xa144('0x1d')];_0x265e05+=0x1){_0x40d5f9[_0xa144('0x4c')](_0xa144('0x54'),{'WhatsappInteractionId':Number(_0x3c94e5[_0x265e05]),'UserId':Number(_0x3b7c73['id'])});}});}})[_0xa144('0x55')](function(_0x362369){_0x53c96b[_0xa144('0x56')](_0x362369);});}}function onDisconnect(_0x401cd2,_0x1558f8){joinOrLeave(_0x401cd2,_0xa144('0x4a'),_0x1558f8);}function onConnect(_0xa23208){joinOrLeave(_0xa23208,_0xa144('0x57'));}exports['default']=function(_0x1a47a4){_0x1a47a4['on'](_0xa144('0x58'),function(_0x420f2e){_0x420f2e[_0xa144('0x59')](0x0);_0x420f2e[_0xa144('0x5a')]=_0x420f2e[_0xa144('0x5b')][_0xa144('0x58')]['remoteAddress']+':'+_0x420f2e[_0xa144('0x5b')][_0xa144('0x58')][_0xa144('0x5c')];_0x420f2e[_0xa144('0x5d')]=new Date();_0x420f2e[_0xa144('0x56')]=function(_0x1c405b){console[_0xa144('0x56')](_0xa144('0x5e')+_0x420f2e[_0xa144('0x5f')][_0xa144('0x5')]+'['+_0x420f2e[_0xa144('0x5a')]+']',_0x1c405b);};_0x420f2e['on'](_0xa144('0x60'),function(){onDisconnect(_0x420f2e,_0x1a47a4);_0x420f2e[_0xa144('0x56')]('DISCONNECTED');});onConnect(_0x420f2e);_0x420f2e[_0xa144('0x56')](_0xa144('0x61'));});}; \ No newline at end of file +var _0x1d0d=['then','map','User','where','Campaign','%s:queue:%s','format','query','find','userProfileId','handshake','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','user:%s','admin','voice:inbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:outbound','VoiceQueue','FaxQueues','SmsQueue','Telephones','IvrCampaigns','getVoiceQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','WhatsappInteractions','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','SocketIO\x20','disconnect','DISCONNECTED','lodash','util','bluebird','../mysqldb','name','Agents','role','telephone','agent','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','UserProfileResource','resourceId'];(function(_0x41b38f,_0xb90fd4){var _0x358d01=function(_0xba7d38){while(--_0xba7d38){_0x41b38f['push'](_0x41b38f['shift']());}};_0x358d01(++_0xb90fd4);}(_0x1d0d,0x184));var _0xd1d0=function(_0x11db20,_0x3a411a){_0x11db20=_0x11db20-0x0;var _0x1f5019=_0x1d0d[_0x11db20];return _0x1f5019;};'use strict';var _=require(_0xd1d0('0x0'));var util=require(_0xd1d0('0x1'));var BPromise=require(_0xd1d0('0x2'));var db=require(_0xd1d0('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xd1d0('0x4')],'include':[{'as':_0xd1d0('0x5'),'model':db['User'],'attributes':['id',_0xd1d0('0x4'),_0xd1d0('0x6')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xd1d0('0x4')],'where':{'role':_0xd1d0('0x7')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xd1d0('0x4')],'where':{'role':_0xd1d0('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xd1d0('0x4'),_0xd1d0('0x9')],'where':{'type':_0xd1d0('0xa')}};function getAssociatedResources(_0x374a19,_0x30389f,_0x100b48){return db[_0xd1d0('0xb')][_0xd1d0('0xc')]({'where':{'name':_0x374a19,'userProfileId':_0x30389f},'raw':!![]})['then'](function(_0x329775){if(_0x329775){if(_0x329775[_0xd1d0('0xd')]){switch(_0x374a19){case _0xd1d0('0xe'):case _0xd1d0('0xf'):case'FaxQueues':case _0xd1d0('0x10'):case _0xd1d0('0x11'):case _0xd1d0('0x12'):case _0xd1d0('0x13'):return db[_0x100b48][_0xd1d0('0x14')](queryQueues);case'Telephones':return db[_0x100b48][_0xd1d0('0x14')](queryTelephones);case _0xd1d0('0x15'):return db[_0x100b48][_0xd1d0('0x14')](queryTrunks);case'IvrCampaigns':return db[_0x100b48][_0xd1d0('0x14')](queryCampaigns);}}else{return db[_0xd1d0('0x16')][_0xd1d0('0x14')]({'attributes':[_0xd1d0('0x17')],'where':{'sectionId':_0x329775['id']},'raw':!![]})[_0xd1d0('0x18')](function(_0x17bd9b){if(_0x17bd9b){var _0x2d1051={'where':{'id':_[_0xd1d0('0x19')](_0x17bd9b,_0xd1d0('0x17'))},'raw':!![]};switch(_0x100b48){case _0xd1d0('0x1a'):_0x2d1051[_0xd1d0('0x1b')]['role']=_0xd1d0('0x7');break;case _0xd1d0('0x1c'):_0x2d1051[_0xd1d0('0x1b')]['type']='ivr';break;}return db[_0x100b48][_0xd1d0('0x14')](_0x2d1051);}else{return[];}});}}else{return[];}})[_0xd1d0('0x18')](function(_0x5d7765){return _0x5d7765;});}function joinOrLeaveQueues(_0x334985,_0x3d9fc9,_0x51759d,_0x36623d){_0x334985[_0x3d9fc9](util['format'](_0xd1d0('0x1d'),_0x51759d,_0x36623d[_0xd1d0('0x4')]));if(_0x36623d['Agents']){for(var _0x1e11a4=0x0;_0x1e11a4<_0x36623d['Agents']['length'];_0x1e11a4+=0x1){_0x334985[_0x3d9fc9](util[_0xd1d0('0x1e')]('user:%s',_0x36623d[_0xd1d0('0x5')][_0x1e11a4][_0xd1d0('0x4')]));}}}function joinOrLeave(_0xf357cd,_0x2064d3,_0x272ea2){var _0x3169c7;if(_0xf357cd['handshake'][_0xd1d0('0x1f')]['id']){db[_0xd1d0('0x1a')][_0xd1d0('0x20')]({'attributes':['id','name',_0xd1d0('0x6'),_0xd1d0('0x21')],'where':{'id':_0xf357cd[_0xd1d0('0x22')][_0xd1d0('0x1f')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0xd1d0('0x23'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xd1d0('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xd1d0('0x25')],'as':_0xd1d0('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xd1d0('0x27')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xd1d0('0x28')],'as':_0xd1d0('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xd1d0('0x2a')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})['then'](function(_0x5b9735){if(_0x5b9735){_0x3169c7=_0x5b9735;_0xf357cd[_0x2064d3](util[_0xd1d0('0x1e')](_0xd1d0('0x2b'),_0x5b9735[_0xd1d0('0x4')]));var _0x51c5fb=[];switch(_0x5b9735[_0xd1d0('0x6')]){case _0xd1d0('0x2c'):_0xf357cd[_0x2064d3](_0xd1d0('0x2d'));_0xf357cd[_0x2064d3]('voice:outbound');if(queryQueues[_0xd1d0('0x2e')](_0xd1d0('0x2f'))){delete queryQueues[_0xd1d0('0x2f')];}_0x51c5fb[_0xd1d0('0x30')](db['VoiceQueue'][_0xd1d0('0x14')](queryQueues));_0x51c5fb[_0xd1d0('0x30')](db[_0xd1d0('0x31')][_0xd1d0('0x14')](queryQueues));_0x51c5fb[_0xd1d0('0x30')](db[_0xd1d0('0x32')][_0xd1d0('0x14')](queryQueues));_0x51c5fb[_0xd1d0('0x30')](db['SmsQueue'][_0xd1d0('0x14')](queryQueues));_0x51c5fb['push'](db[_0xd1d0('0x33')][_0xd1d0('0x14')](queryQueues));_0x51c5fb[_0xd1d0('0x30')](db[_0xd1d0('0x34')]['findAll'](queryQueues));_0x51c5fb[_0xd1d0('0x30')](db[_0xd1d0('0x35')][_0xd1d0('0x14')](queryQueues));_0x51c5fb[_0xd1d0('0x30')](db['User'][_0xd1d0('0x14')](queryTelephones));_0x51c5fb[_0xd1d0('0x30')](db[_0xd1d0('0x36')][_0xd1d0('0x14')](queryTrunks));_0x51c5fb[_0xd1d0('0x30')](db[_0xd1d0('0x1c')][_0xd1d0('0x14')](queryCampaigns));_0x51c5fb['push'](db[_0xd1d0('0x1a')]['findAll'](queryAgents));break;case _0xd1d0('0x37'):_0xf357cd[_0x2064d3](_0xd1d0('0x2d'));_0xf357cd[_0x2064d3](_0xd1d0('0x38'));_0x51c5fb[_0xd1d0('0x30')](getAssociatedResources(_0xd1d0('0xe'),_0x5b9735['userProfileId'],_0xd1d0('0x39')));_0x51c5fb['push'](getAssociatedResources(_0xd1d0('0xf'),_0x5b9735[_0xd1d0('0x21')],_0xd1d0('0x31')));_0x51c5fb['push'](getAssociatedResources(_0xd1d0('0x3a'),_0x5b9735['userProfileId'],_0xd1d0('0x32')));_0x51c5fb['push'](getAssociatedResources(_0xd1d0('0x10'),_0x5b9735['userProfileId'],_0xd1d0('0x3b')));_0x51c5fb[_0xd1d0('0x30')](getAssociatedResources('MailQueues',_0x5b9735['userProfileId'],_0xd1d0('0x33')));_0x51c5fb[_0xd1d0('0x30')](getAssociatedResources(_0xd1d0('0x12'),_0x5b9735[_0xd1d0('0x21')],_0xd1d0('0x34')));_0x51c5fb[_0xd1d0('0x30')](getAssociatedResources(_0xd1d0('0x13'),_0x5b9735['userProfileId'],_0xd1d0('0x35')));_0x51c5fb[_0xd1d0('0x30')](getAssociatedResources(_0xd1d0('0x3c'),_0x5b9735['userProfileId'],_0xd1d0('0x1a')));_0x51c5fb[_0xd1d0('0x30')](getAssociatedResources(_0xd1d0('0x15'),_0x5b9735['userProfileId'],'Trunk'));_0x51c5fb[_0xd1d0('0x30')](getAssociatedResources(_0xd1d0('0x3d'),_0x5b9735['userProfileId'],_0xd1d0('0x1c')));_0x51c5fb[_0xd1d0('0x30')](db[_0xd1d0('0x1a')][_0xd1d0('0x14')](queryAgents));break;case _0xd1d0('0x8'):_0xf357cd[_0x2064d3](_0xd1d0('0x2d'));_0xf357cd[_0x2064d3](_0xd1d0('0x38'));_0x51c5fb[_0xd1d0('0x30')](_0x5b9735[_0xd1d0('0x3e')]({'attributes':['id',_0xd1d0('0x4')]}));_0x51c5fb[_0xd1d0('0x30')](_0x5b9735['getChatQueues']({'attributes':['id',_0xd1d0('0x4')]}));_0x51c5fb[_0xd1d0('0x30')](_0x5b9735[_0xd1d0('0x3f')]({'attributes':['id',_0xd1d0('0x4')]}));_0x51c5fb['push'](_0x5b9735[_0xd1d0('0x40')]({'attributes':['id',_0xd1d0('0x4')]}));_0x51c5fb[_0xd1d0('0x30')](_0x5b9735[_0xd1d0('0x41')]({'attributes':['id','name']}));_0x51c5fb[_0xd1d0('0x30')](_0x5b9735[_0xd1d0('0x42')]({'attributes':['id','name']}));_0x51c5fb[_0xd1d0('0x30')](_0x5b9735[_0xd1d0('0x43')]({'attributes':['id',_0xd1d0('0x4')]}));break;}return BPromise[_0xd1d0('0x44')](_0x51c5fb);}})[_0xd1d0('0x18')](function(_0x571a01){if(_0x571a01&&_0x571a01['length']){for(var _0x1e2179=0x0;_0x1e2179<_0x571a01[_0xd1d0('0x45')];_0x1e2179+=0x1){for(var _0x61e3=0x0;_0x61e3<_0x571a01[_0x1e2179]['length'];_0x61e3+=0x1){switch(_0x1e2179){case 0x0:joinOrLeaveQueues(_0xf357cd,_0x2064d3,_0xd1d0('0x46'),_0x571a01[_0x1e2179][_0x61e3]);break;case 0x1:joinOrLeaveQueues(_0xf357cd,_0x2064d3,_0xd1d0('0x47'),_0x571a01[_0x1e2179][_0x61e3]);break;case 0x2:joinOrLeaveQueues(_0xf357cd,_0x2064d3,_0xd1d0('0x48'),_0x571a01[_0x1e2179][_0x61e3]);break;case 0x3:joinOrLeaveQueues(_0xf357cd,_0x2064d3,_0xd1d0('0x49'),_0x571a01[_0x1e2179][_0x61e3]);break;case 0x4:joinOrLeaveQueues(_0xf357cd,_0x2064d3,_0xd1d0('0x4a'),_0x571a01[_0x1e2179][_0x61e3]);break;case 0x5:joinOrLeaveQueues(_0xf357cd,_0x2064d3,_0xd1d0('0x4b'),_0x571a01[_0x1e2179][_0x61e3]);break;case 0x6:joinOrLeaveQueues(_0xf357cd,_0x2064d3,_0xd1d0('0x4c'),_0x571a01[_0x1e2179][_0x61e3]);break;case 0x7:if(_0x3169c7[_0xd1d0('0x6')]!==_0xd1d0('0x8'))_0xf357cd[_0x2064d3](util['format'](_0xd1d0('0x4d'),_0x571a01[_0x1e2179][_0x61e3][_0xd1d0('0x4')]));break;case 0x8:if(_0x3169c7[_0xd1d0('0x6')]!=='agent')_0xf357cd[_0x2064d3](util['format']('trunk:%s',_0x571a01[_0x1e2179][_0x61e3][_0xd1d0('0x4')]));break;case 0x9:if(_0x3169c7[_0xd1d0('0x6')]!=='agent')_0xf357cd[_0x2064d3](util['format'](_0xd1d0('0x4e'),_0x571a01[_0x1e2179][_0x61e3]['type'],_0x571a01[_0x1e2179][_0x61e3][_0xd1d0('0x4')]));break;case 0xa:_0xf357cd[_0x2064d3](util[_0xd1d0('0x1e')](_0xd1d0('0x2b'),_0x571a01[_0x1e2179][_0x61e3][_0xd1d0('0x4')]));break;}}}}})[_0xd1d0('0x18')](function(){if(_0x2064d3===_0xd1d0('0x4f')){var _0x4b25bd=_['map'](_0x3169c7['ChatInteractions'],'id');return _0x3169c7['removeChatInteractions'](_0x4b25bd)[_0xd1d0('0x18')](function(){for(var _0x51b987=0x0;_0x51b987<_0x4b25bd['length'];_0x51b987+=0x1){_0x272ea2[_0xd1d0('0x50')](_0xd1d0('0x51'),{'ChatInteractionId':Number(_0x4b25bd[_0x51b987]),'UserId':Number(_0x3169c7['id'])});}});}})[_0xd1d0('0x18')](function(){if(_0x2064d3===_0xd1d0('0x4f')){var _0x16aded=_[_0xd1d0('0x19')](_0x3169c7[_0xd1d0('0x24')],'id');return _0x3169c7[_0xd1d0('0x52')](_0x16aded)[_0xd1d0('0x18')](function(){for(var _0x384e65=0x0;_0x384e65<_0x16aded[_0xd1d0('0x45')];_0x384e65+=0x1){_0x272ea2[_0xd1d0('0x50')](_0xd1d0('0x53'),{'MailInteractionId':Number(_0x16aded[_0x384e65]),'UserId':Number(_0x3169c7['id'])});}});}})[_0xd1d0('0x18')](function(){if(_0x2064d3===_0xd1d0('0x4f')){var _0x4f05b7=_[_0xd1d0('0x19')](_0x3169c7[_0xd1d0('0x26')],'id');return _0x3169c7['removeFaxInteractions'](_0x4f05b7)['then'](function(){for(var _0x5520d1=0x0;_0x5520d1<_0x4f05b7['length'];_0x5520d1+=0x1){_0x272ea2[_0xd1d0('0x50')](_0xd1d0('0x54'),{'FaxInteractionId':Number(_0x4f05b7[_0x5520d1]),'UserId':Number(_0x3169c7['id'])});}});}})[_0xd1d0('0x18')](function(){if(_0x2064d3===_0xd1d0('0x4f')){var _0x1b713e=_['map'](_0x3169c7[_0xd1d0('0x55')],'id');return _0x3169c7[_0xd1d0('0x56')](_0x1b713e)[_0xd1d0('0x18')](function(){for(var _0xff07e2=0x0;_0xff07e2<_0x1b713e[_0xd1d0('0x45')];_0xff07e2+=0x1){_0x272ea2['emit'](_0xd1d0('0x57'),{'SmsInteractionId':Number(_0x1b713e[_0xff07e2]),'UserId':Number(_0x3169c7['id'])});}});}})['then'](function(){if(_0x2064d3===_0xd1d0('0x4f')){var _0x1ebce3=_['map'](_0x3169c7[_0xd1d0('0x29')],'id');return _0x3169c7['removeOpenchannelInteractions'](_0x1ebce3)['then'](function(){for(var _0x23ef2b=0x0;_0x23ef2b<_0x1ebce3[_0xd1d0('0x45')];_0x23ef2b+=0x1){_0x272ea2['emit'](_0xd1d0('0x58'),{'OpenchannelInteractionId':Number(_0x1ebce3[_0x23ef2b]),'UserId':Number(_0x3169c7['id'])});}});}})[_0xd1d0('0x18')](function(){if(_0x2064d3===_0xd1d0('0x4f')){var _0x262f7b=_[_0xd1d0('0x19')](_0x3169c7[_0xd1d0('0x59')],'id');return _0x3169c7['removeWhatsappInteractions'](_0x262f7b)[_0xd1d0('0x18')](function(){for(var _0x180913=0x0;_0x180913<_0x262f7b[_0xd1d0('0x45')];_0x180913+=0x1){_0x272ea2[_0xd1d0('0x50')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x262f7b[_0x180913]),'UserId':Number(_0x3169c7['id'])});}});}})[_0xd1d0('0x5a')](function(_0x5e9a5d){_0xf357cd[_0xd1d0('0x5b')](_0x5e9a5d);});}}function onDisconnect(_0x3caff6,_0x4eec9a){joinOrLeave(_0x3caff6,'leave',_0x4eec9a);}function onConnect(_0x36283f){joinOrLeave(_0x36283f,_0xd1d0('0x5c'));}exports[_0xd1d0('0x5d')]=function(_0x2d8610){_0x2d8610['on'](_0xd1d0('0x5e'),function(_0x1187b2){_0x1187b2[_0xd1d0('0x5f')](0x0);_0x1187b2[_0xd1d0('0x60')]=_0x1187b2[_0xd1d0('0x61')]['connection'][_0xd1d0('0x62')]+':'+_0x1187b2[_0xd1d0('0x61')][_0xd1d0('0x5e')][_0xd1d0('0x63')];_0x1187b2['connectedAt']=new Date();_0x1187b2[_0xd1d0('0x5b')]=function(_0x76aa63){console[_0xd1d0('0x5b')](_0xd1d0('0x64')+_0x1187b2['nsp']['name']+'['+_0x1187b2[_0xd1d0('0x60')]+']',_0x76aa63);};_0x1187b2['on'](_0xd1d0('0x65'),function(){onDisconnect(_0x1187b2,_0x2d8610);_0x1187b2['log'](_0xd1d0('0x66'));});onConnect(_0x1187b2);_0x1187b2[_0xd1d0('0x5b')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index c10a152..9db7322 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 _0x8fa7=['client','http','Chat','ChatInteraction','newinteraction','closedinteraction','afterCreate','newmessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','FaxInteraction','Fax','afterUpdate','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','then','info','Trigger,\x20%s','EventManager','error','catch','get','direction','UserId','User','find','name','interface','format','incomingmessage','outgoingmessage','channel','opened','closed','event','SIP/%s','default','model','hook','../../mysqldb','jayson/promise','triggers'];(function(_0x18cf50,_0x3d88f9){var _0x408c31=function(_0x57fe02){while(--_0x57fe02){_0x18cf50['push'](_0x18cf50['shift']());}};_0x408c31(++_0x3d88f9);}(_0x8fa7,0xcd));var _0x78fa=function(_0x2f5a22,_0x5e9f03){_0x2f5a22=_0x2f5a22-0x0;var _0x326b70=_0x8fa7[_0x2f5a22];return _0x326b70;};'use strict';var util=require('util');var db=require(_0x78fa('0x0'))['db'];var jayson=require(_0x78fa('0x1'));var logger=require('../logger')(_0x78fa('0x2'));var client=jayson[_0x78fa('0x3')][_0x78fa('0x4')]({'port':0x232a});var triggers=[{'channel':_0x78fa('0x5'),'model':_0x78fa('0x6'),'event':'afterCreate','condition':_0x78fa('0x7'),'callback':afterCreate},{'channel':'Chat','model':'ChatInteraction','event':'afterUpdate','condition':_0x78fa('0x8'),'callback':afterUpdate},{'channel':_0x78fa('0x5'),'model':'ChatMessage','event':_0x78fa('0x9'),'condition':_0x78fa('0xa'),'callback':afterCreateMessage},{'channel':_0x78fa('0xb'),'model':_0x78fa('0xc'),'event':'afterCreate','condition':_0x78fa('0x7'),'callback':afterCreate},{'channel':'Sms','model':_0x78fa('0xc'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x78fa('0xb'),'model':_0x78fa('0xd'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x78fa('0xe'),'model':_0x78fa('0xf'),'event':_0x78fa('0x9'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x78fa('0xe'),'model':_0x78fa('0xf'),'event':'afterUpdate','condition':_0x78fa('0x8'),'callback':afterUpdate},{'channel':_0x78fa('0xe'),'model':_0x78fa('0x10'),'event':_0x78fa('0x9'),'condition':_0x78fa('0xa'),'callback':afterCreateMessage},{'channel':'Fax','model':_0x78fa('0x11'),'event':_0x78fa('0x9'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x78fa('0x12'),'model':_0x78fa('0x11'),'event':_0x78fa('0x13'),'condition':_0x78fa('0x8'),'callback':afterUpdate},{'channel':_0x78fa('0x12'),'model':_0x78fa('0x14'),'event':_0x78fa('0x9'),'condition':_0x78fa('0xa'),'callback':afterCreateMessage},{'channel':_0x78fa('0x15'),'model':_0x78fa('0x16'),'event':_0x78fa('0x9'),'condition':_0x78fa('0x7'),'callback':afterCreate},{'channel':'Mail','model':_0x78fa('0x16'),'event':_0x78fa('0x13'),'condition':_0x78fa('0x8'),'callback':afterUpdate},{'channel':_0x78fa('0x15'),'model':_0x78fa('0x17'),'event':'afterCreate','condition':_0x78fa('0xa'),'callback':afterCreateMessage},{'channel':_0x78fa('0x18'),'model':_0x78fa('0x19'),'event':'afterCreate','condition':_0x78fa('0x7'),'callback':afterCreate},{'channel':'Openchannel','model':_0x78fa('0x19'),'event':'afterUpdate','condition':_0x78fa('0x8'),'callback':afterUpdate},{'channel':_0x78fa('0x18'),'model':_0x78fa('0x1a'),'event':'afterCreate','condition':_0x78fa('0xa'),'callback':afterCreateMessage}];function request(_0x3bce3c){return client[_0x78fa('0x1b')]('EventManager',_0x3bce3c)[_0x78fa('0x1c')](function(_0x16413a){logger[_0x78fa('0x1d')](_0x78fa('0x1e'),_0x78fa('0x1f'),_0x16413a);if(_0x16413a[_0x78fa('0x20')]){if(_0x16413a[_0x78fa('0x20')]['code']===0x1f4){logger[_0x78fa('0x20')](_0x78fa('0x1e'),_0x78fa('0x1f'),_0x16413a[_0x78fa('0x20')]);}}})[_0x78fa('0x21')](function(_0x2de724){logger[_0x78fa('0x20')](_0x78fa('0x1e'),_0x78fa('0x1f'),_0x2de724);});}function afterCreateMessage(_0x381c80,_0x8ca578){return function(_0x1868e8,_0xd9b0e7){_0x1868e8=_0x1868e8[_0x78fa('0x22')]({'plain':!![]});_0x1868e8['channel']=_0x381c80;_0x1868e8['event']=_0x1868e8[_0x78fa('0x23')];if(_0x1868e8[_0x78fa('0x24')]){return db[_0x78fa('0x25')][_0x78fa('0x26')]({'where':{'id':_0x1868e8['UserId']},'attributes':['id',_0x78fa('0x27')],'raw':!![]})[_0x78fa('0x1c')](function(_0x193fc7){_0x1868e8[_0x78fa('0x28')]=util[_0x78fa('0x29')]('SIP/%s',_0x193fc7[_0x78fa('0x27')]);_0x1868e8['channel']=_0x381c80;return request({'event':_0x78fa('0x2a'),'message':_0x1868e8});})[_0x78fa('0x21')](function(_0x522122){console[_0x78fa('0x20')](_0x522122);});}else{return request({'event':_0x78fa('0x2b'),'message':_0x1868e8});}};}function afterCreate(_0x2d4996,_0x315255){return function(_0x47a87d,_0x414a1c){_0x47a87d=_0x47a87d[_0x78fa('0x22')]({'plain':!![]});_0x47a87d[_0x78fa('0x2c')]=_0x2d4996;_0x47a87d['event']=_0x78fa('0x2d');return request({'event':_0x315255,'message':_0x47a87d});};}function afterUpdate(_0x521032,_0x4b7c2e){return function(_0xba4f4,_0x38e3a1){if(_0xba4f4['changed'](_0x78fa('0x2e'))&&_0xba4f4['closed']){_0xba4f4=_0xba4f4['get']({'plain':!![]});_0xba4f4['channel']=_0x521032;_0xba4f4[_0x78fa('0x2f')]=_0x78fa('0x2e');if(_0xba4f4[_0x78fa('0x24')]){return db['User'][_0x78fa('0x26')]({'where':{'id':_0xba4f4['UserId']},'attributes':['id','name'],'raw':!![]})[_0x78fa('0x1c')](function(_0x43a5d8){_0xba4f4[_0x78fa('0x28')]=util[_0x78fa('0x29')](_0x78fa('0x30'),_0x43a5d8[_0x78fa('0x27')]);return request({'event':_0x4b7c2e,'message':_0xba4f4});})['catch'](function(_0x120257){console[_0x78fa('0x20')](_0x120257);});}else{return request({'event':_0x4b7c2e,'message':_0xba4f4});}}};}exports[_0x78fa('0x31')]=function(){for(var _0x3be943=0x0;_0x3be943=_0x53f77d[_0xce55('0x15')]){throw Error(_0xce55('0x16'));}_0x55d6d1(_0x453ca2);})[_0xce55('0x17')](function(_0x473378){_0x4f3c7a(_0x473378);});});}; \ No newline at end of file +var _0x9749=['isValidChannel','toLowerCase','clearBlockUser','blockedAt','updateAttributes','getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','./license/util','voice','mail','chat','fax','sms','whatsapp','openchannel','getChannels'];(function(_0xf15036,_0x52e137){var _0x2985dd=function(_0x2d2dca){while(--_0x2d2dca){_0xf15036['push'](_0xf15036['shift']());}};_0x2985dd(++_0x52e137);}(_0x9749,0x72));var _0x9974=function(_0x4febd6,_0x1ddcc1){_0x4febd6=_0x4febd6-0x0;var _0x2eff01=_0x9749[_0x4febd6];return _0x2eff01;};'use strict';var _=require(_0x9974('0x0'));var BPromise=require(_0x9974('0x1'));var db=require('../mysqldb')['db'];var util=require(_0x9974('0x2'));var channels=[_0x9974('0x3'),_0x9974('0x4'),_0x9974('0x5'),_0x9974('0x6'),_0x9974('0x7'),_0x9974('0x8'),_0x9974('0x9')];exports[_0x9974('0xa')]=function(){return channels;};exports[_0x9974('0xb')]=function(_0x4f71fc){_0x4f71fc=_0x4f71fc[_0x9974('0xc')]();return _['includes'](channels,_0x4f71fc);};exports[_0x9974('0xd')]=function(_0x44e832,_0x4f6662,_0x291395,_0x3b3c27){var _0x4ad6a7={'loginAttempts':_0x4f6662,'blocked':_0x291395};if(!_['isUndefined'](_0x3b3c27)){_0x4ad6a7[_0x9974('0xe')]=_0x3b3c27;}return _0x44e832[_0x9974('0xf')](_0x4ad6a7);};exports[_0x9974('0x10')]=function(_0x93f021){return new BPromise(function(_0x2c28b9,_0xc821de){var _0x234dce=0x0;if(_0x93f021[_0x9974('0x11')]!==_0x9974('0x12')){_0x2c28b9(_0x93f021);}db[_0x9974('0x13')][_0x9974('0x14')]({'where':{'role':_0x9974('0x12'),'online':!![],'id':{'$ne':_0x93f021['id']}}})[_0x9974('0x15')](function(_0x315164){_0x234dce=_0x315164;return util[_0x9974('0x10')]();})[_0x9974('0x15')](function(_0x437bb7){if(_0x437bb7&&_0x437bb7[_0x9974('0x16')]&&_0x234dce>=_0x437bb7[_0x9974('0x16')]){throw Error(_0x9974('0x17'));}_0x2c28b9(_0x93f021);})[_0x9974('0x18')](function(_0x91c481){_0xc821de(_0x91c481);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index c4374da..77693d4 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3940=['status','render','json','exports','404'];(function(_0x289313,_0x420c00){var _0x5488a2=function(_0x9cc3d3){while(--_0x9cc3d3){_0x289313['push'](_0x289313['shift']());}};_0x5488a2(++_0x420c00);}(_0x3940,0x1f2));var _0x0394=function(_0x375b84,_0x4a22cf){_0x375b84=_0x375b84-0x0;var _0x1f37df=_0x3940[_0x375b84];return _0x1f37df;};'use strict';module[_0x0394('0x0')][0x194]=function pageNotFound(_0x3e652c,_0x58f212){var _0x311982=_0x0394('0x1');var _0x1d4d35=0x194;var _0x519ea3={'status':_0x1d4d35};_0x58f212[_0x0394('0x2')](_0x519ea3['status']);_0x58f212[_0x0394('0x3')](_0x311982,{},function(_0x493b25,_0x38c87f){if(_0x493b25){return _0x58f212[_0x0394('0x2')](_0x519ea3[_0x0394('0x2')])[_0x0394('0x4')](_0x519ea3);}_0x58f212['send'](_0x38c87f);});}; \ No newline at end of file +var _0x5a95=['status','json','exports','404'];(function(_0x421725,_0x318a04){var _0x51b322=function(_0xe58018){while(--_0xe58018){_0x421725['push'](_0x421725['shift']());}};_0x51b322(++_0x318a04);}(_0x5a95,0x146));var _0x55a9=function(_0x516459,_0x1914b7){_0x516459=_0x516459-0x0;var _0x5427fe=_0x5a95[_0x516459];return _0x5427fe;};'use strict';module[_0x55a9('0x0')][0x194]=function pageNotFound(_0x4cd4ff,_0x356522){var _0x38ab8a=_0x55a9('0x1');var _0x13e335=0x194;var _0x372555={'status':_0x13e335};_0x356522['status'](_0x372555[_0x55a9('0x2')]);_0x356522['render'](_0x38ab8a,{},function(_0x28d385,_0x460d37){if(_0x28d385){return _0x356522['status'](_0x372555['status'])[_0x55a9('0x3')](_0x372555);}_0x356522['send'](_0x460d37);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 8c56b83..e5df2a6 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31c4=['Disposition','../api/disposition/disposition.model','Condition','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/sound/sound.model','Tag','../api/template/template.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','hasOne','VoiceMail','cascade','VoiceRecording','Recordings','VoiceQueuesRt','UserId','hasMany','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','SenderId','belongsTo','userProfileId','chat_group_has_users','belongsToMany','Contacts','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','FaxQueue','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','VoicePrefix','user_has_voice_prefixes','user_has_chat_websites','FaxAccounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','WhatsappAccount','user_has_whatsapp_accounts','SquareProjects','SpiedAgents','ChanSpyId','VoiceContext','Applications','Sound','Sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','Trunk','TrunkBackup','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','mailboxuser','VoiceQueueReport','QueueCalls','uniqueid','Contact','ContactId','MailServerIn','MailAccount','MailAccountId','Smtp','Answers','Messages','Interactions','List','ListId','Template','TemplateId','mandatoryDispositionPause','team_has_mail_queues','MailInteractionId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Interaction','Account','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','restrict','TagId','DashboardItem','Items','Dispositions','FaxAccountId','FaxApplication','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','Users','FaxMessage','AttachmentId','FaxQueueReport','SmsAccountId','user_has_sms_accounts','sms_interaction_has_tags','user_has_sms_interactions','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','ChatQueue','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','Attachments','team_has_chat_queues','ChatGroupId','Website','CompanyId','CmHopperHistory','JscriptySessions','Company','cm_user_has_contacts','cm_contact_has_tags','Agent','CampaignId','OwnerId','All','OneAll','AutomationAllId','Automation','AutomationAnyId','Actions','MailApplications','ChatApplications','moh_has_sounds','whatsapp_interaction_has_tags','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','CustomReportId','MetricId','Configurations','Subjects','Descriptions','DescriptionId','FieldId','SalesforceAccount','AccountId','Subject','SubjectId','Description','Field','VariableId','int_desk_configuration_has_tags','ZohoConfiguration','ZendeskConfiguration','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerConfiguration','VtigerField','ServicenowField','Dynamics365Account','Dynamics365Field','FromId','ToId','SessionId','ProjectId','ChatQueues','team_has_fax_queues','team_has_whatsapp_queues','TrunkId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','FromChatWebsiteId','ToUserId','ToChatQueueId','ToChatWebsiteId','ToAccount','FromAccount','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','CmCustomField','CustomFields','Queues','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','path','sequelize','lodash','determine','defaultsDeep','motion2','xcall','127.0.0.1','mysql','utf8mb4','name','utf8_general_ci','sequelizeHistory','utf8','database','username','options','password','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','../api/faxQueueReport/faxQueueReport.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','ReportAgentPreview','../api/cmCustomField/cmCustomField.model','Action','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model'];(function(_0x36e059,_0x19ee27){var _0x52ee13=function(_0x3dbfb1){while(--_0x3dbfb1){_0x36e059['push'](_0x36e059['shift']());}};_0x52ee13(++_0x19ee27);}(_0x31c4,0x172));var _0x431c=function(_0x3f323b,_0x11a74a){_0x3f323b=_0x3f323b-0x0;var _0x5dc5ad=_0x31c4[_0x3f323b];return _0x5dc5ad;};'use strict';var path=require(_0x431c('0x0'));var config=require('../config/environment');var Sequelize=require(_0x431c('0x1'));var _=require(_0x431c('0x2'));var jstz=require('jstz');var timezone=jstz[_0x431c('0x3')]();config[_0x431c('0x1')]=_[_0x431c('0x4')](config['sequelize'],{'database':_0x431c('0x5'),'username':_0x431c('0x6'),'password':'xC@LL1234','options':{'host':_0x431c('0x7'),'port':0xcea,'dialect':_0x431c('0x8'),'dialectOptions':{'charset':_0x431c('0x9')},'logging':![],'timezone':timezone[_0x431c('0xa')](),'define':{'charset':'utf8','collate':_0x431c('0xb')}}});config['sequelizeHistory']=_['defaultsDeep'](config[_0x431c('0xc')],{'database':_0x431c('0x5'),'username':_0x431c('0x6'),'password':'xC@LL1234','options':{'host':_0x431c('0x7'),'port':0xcea,'dialect':_0x431c('0x8'),'dialectOptions':{'charset':_0x431c('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x431c('0xd'),'collate':_0x431c('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x431c('0x1')][_0x431c('0xe')],config[_0x431c('0x1')][_0x431c('0xf')],config['sequelize']['password'],config['sequelize'][_0x431c('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x431c('0xc')][_0x431c('0xe')],config['sequelizeHistory'][_0x431c('0xf')],config[_0x431c('0xc')][_0x431c('0x11')],config[_0x431c('0xc')][_0x431c('0x10')])};db[_0x431c('0x12')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x14'));db[_0x431c('0x15')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x16'));db['VoiceContext']=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x17'));db[_0x431c('0x18')]=db['sequelize'][_0x431c('0x13')]('../api/voiceExtension/voiceExtension.model');db[_0x431c('0x19')]=db['sequelize'][_0x431c('0x13')](_0x431c('0x1a'));db[_0x431c('0x1b')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x1c'));db['VoiceRecording']=db[_0x431c('0x1')]['import'](_0x431c('0x1d'));db['ScreenRecording']=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x1e'));db['VoiceMail']=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x1f'));db[_0x431c('0x20')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x21'));db[_0x431c('0x22')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x23'));db['VoiceDialReport']=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x24'));db[_0x431c('0x25')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x26'));db['VoiceQueueReport']=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x27'));db[_0x431c('0x28')]=db['sequelize'][_0x431c('0x13')](_0x431c('0x29'));db['Trunk']=db['sequelize']['import'](_0x431c('0x2a'));db['VoiceTransferReport']=db['sequelize'][_0x431c('0x13')](_0x431c('0x2b'));db[_0x431c('0x2c')]=db['sequelize']['import'](_0x431c('0x2d'));db[_0x431c('0x2e')]=db['sequelize'][_0x431c('0x13')](_0x431c('0x2f'));db[_0x431c('0x30')]=db['sequelize'][_0x431c('0x13')]('../api/userChatQueue/userChatQueue.model');db[_0x431c('0x31')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x32'));db[_0x431c('0x33')]=db['sequelize']['import']('../api/userFaxQueue/userFaxQueue.model');db[_0x431c('0x34')]=db['sequelize']['import'](_0x431c('0x35'));db[_0x431c('0x36')]=db[_0x431c('0x1')]['import']('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x431c('0x37')]=db[_0x431c('0x1')]['import'](_0x431c('0x38'));db['MailServerIn']=db['sequelize'][_0x431c('0x13')]('../api/mailServerIn/mailServerIn.model');db[_0x431c('0x39')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x3a'));db['MailAccount']=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x3b'));db[_0x431c('0x3c')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x3d'));db[_0x431c('0x3e')]=db['sequelize'][_0x431c('0x13')]('../api/mailSubstatus/mailSubstatus.model');db[_0x431c('0x3f')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x40'));db[_0x431c('0x41')]=db['sequelize']['import'](_0x431c('0x42'));db[_0x431c('0x43')]=db['sequelize'][_0x431c('0x13')]('../api/mailApplication/mailApplication.model');db[_0x431c('0x44')]=db['sequelize'][_0x431c('0x13')](_0x431c('0x45'));db[_0x431c('0x46')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x47'));db['DashboardItem']=db['sequelize'][_0x431c('0x13')]('../api/dashboardItem/dashboardItem.model');db[_0x431c('0x48')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x49'));db['FaxApplication']=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x4a'));db[_0x431c('0x4b')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x4c'));db['FaxMessage']=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x4d'));db['FaxQueue']=db[_0x431c('0x1')]['import']('../api/faxQueue/faxQueue.model');db['FaxQueueReport']=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x4e'));db['SmsAccount']=db[_0x431c('0x1')][_0x431c('0x13')]('../api/smsAccount/smsAccount.model');db[_0x431c('0x4f')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x50'));db[_0x431c('0x51')]=db[_0x431c('0x1')]['import'](_0x431c('0x52'));db[_0x431c('0x53')]=db['sequelize'][_0x431c('0x13')](_0x431c('0x54'));db[_0x431c('0x55')]=db['sequelize'][_0x431c('0x13')](_0x431c('0x56'));db[_0x431c('0x57')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x58'));db['OpenchannelApplication']=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x59'));db[_0x431c('0x5a')]=db[_0x431c('0x1')]['import'](_0x431c('0x5b'));db[_0x431c('0x5c')]=db[_0x431c('0x1')]['import'](_0x431c('0x5d'));db[_0x431c('0x5e')]=db[_0x431c('0x1')]['import'](_0x431c('0x5f'));db[_0x431c('0x60')]=db[_0x431c('0x1')][_0x431c('0x13')]('../api/chatWebsite/chatWebsite.model');db[_0x431c('0x61')]=db[_0x431c('0x1')]['import'](_0x431c('0x62'));db[_0x431c('0x63')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x64'));db['ChatInteraction']=db[_0x431c('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x431c('0x65')]=db['sequelize'][_0x431c('0x13')](_0x431c('0x66'));db['ChatOfflineMessage']=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x67'));db['ChatQueue']=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x68'));db[_0x431c('0x69')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x6a'));db[_0x431c('0x6b')]=db['sequelize'][_0x431c('0x13')](_0x431c('0x6c'));db[_0x431c('0x6d')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x6e'));db[_0x431c('0x6f')]=db['sequelize'][_0x431c('0x13')](_0x431c('0x70'));db[_0x431c('0x71')]=db[_0x431c('0x1')]['import'](_0x431c('0x72'));db[_0x431c('0x73')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x74'));db[_0x431c('0x75')]=db['sequelize'][_0x431c('0x13')]('../api/cmHopperFinal/cmHopperFinal.model');db['CmHopperHistory']=db[_0x431c('0x1')]['import']('../api/cmHopperHistory/cmHopperHistory.model');db[_0x431c('0x76')]=db['sequelize'][_0x431c('0x13')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x77'));db[_0x431c('0x78')]=db['sequelize']['import']('../api/action/action.model');db['Automation']=db['sequelize'][_0x431c('0x13')](_0x431c('0x79'));db[_0x431c('0x7a')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x7b'));db[_0x431c('0x7c')]=db[_0x431c('0x1')]['import'](_0x431c('0x7d'));db[_0x431c('0x7e')]=db[_0x431c('0x1')][_0x431c('0x13')]('../api/condition/condition.model');db['Interval']=db[_0x431c('0x1')][_0x431c('0x13')]('../api/interval/interval.model');db[_0x431c('0x7f')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x80'));db[_0x431c('0x81')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x82'));db[_0x431c('0x83')]=db[_0x431c('0x1')]['import'](_0x431c('0x84'));db[_0x431c('0x85')]=db[_0x431c('0x1')]['import']('../api/schedule/schedule.model');db['Sound']=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x86'));db[_0x431c('0x87')]=db[_0x431c('0x1')]['import']('../api/tag/tag.model');db['Template']=db[_0x431c('0x1')]['import'](_0x431c('0x88'));db['Trigger']=db[_0x431c('0x1')][_0x431c('0x13')]('../api/trigger/trigger.model');db[_0x431c('0x89')]=db[_0x431c('0x1')]['import'](_0x431c('0x8a'));db[_0x431c('0x8b')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x8c'));db[_0x431c('0x8d')]=db[_0x431c('0x1')]['import'](_0x431c('0x8e'));db['AnalyticCustomReport']=db[_0x431c('0x1')][_0x431c('0x13')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x431c('0x8f')]=db['sequelize'][_0x431c('0x13')](_0x431c('0x90'));db[_0x431c('0x91')]=db[_0x431c('0x1')]['import'](_0x431c('0x92'));db[_0x431c('0x93')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x94'));db[_0x431c('0x95')]=db[_0x431c('0x1')]['import'](_0x431c('0x96'));db[_0x431c('0x97')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x98'));db['SalesforceAccount']=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x99'));db[_0x431c('0x9a')]=db['sequelize']['import'](_0x431c('0x9b'));db[_0x431c('0x9c')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0x9d'));db[_0x431c('0x9e')]=db[_0x431c('0x1')][_0x431c('0x13')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x431c('0x9f')]=db[_0x431c('0x1')]['import'](_0x431c('0xa0'));db[_0x431c('0xa1')]=db['sequelize'][_0x431c('0x13')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x431c('0xa2')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0xa3'));db[_0x431c('0xa4')]=db['sequelize'][_0x431c('0x13')](_0x431c('0xa5'));db[_0x431c('0xa6')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0xa7'));db[_0x431c('0xa8')]=db['sequelize'][_0x431c('0x13')](_0x431c('0xa9'));db['ZohoConfiguration']=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0xaa'));db[_0x431c('0xab')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0xac'));db[_0x431c('0xad')]=db['sequelize'][_0x431c('0x13')](_0x431c('0xae'));db['ZendeskConfiguration']=db[_0x431c('0x1')][_0x431c('0x13')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x431c('0xaf')]=db['sequelize'][_0x431c('0x13')](_0x431c('0xb0'));db[_0x431c('0xb1')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0xb2'));db[_0x431c('0xb3')]=db[_0x431c('0x1')]['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x431c('0xb4')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0xb5'));db[_0x431c('0xb6')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0xb7'));db['VtigerConfiguration']=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0xb8'));db['VtigerField']=db[_0x431c('0x1')][_0x431c('0x13')]('../api/intVtigerField/intVtigerField.model');db[_0x431c('0xb9')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0xba'));db[_0x431c('0xbb')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0xbc'));db['ServicenowField']=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0xbd'));db['Dynamics365Account']=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0xbe'));db[_0x431c('0xbf')]=db[_0x431c('0x1')][_0x431c('0x13')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db['Dynamics365Field']=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0xc0'));db[_0x431c('0xc1')]=db[_0x431c('0x1')][_0x431c('0x13')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x431c('0xc2')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0xc3'));db[_0x431c('0xc4')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0xc5'));db['Integration']=db[_0x431c('0x1')][_0x431c('0x13')]('../api/integration/integration.model');db[_0x431c('0xc6')]=db[_0x431c('0x1')]['import'](_0x431c('0xc7'));db[_0x431c('0xc8')]=db['sequelize'][_0x431c('0x13')](_0x431c('0xc9'));db[_0x431c('0xca')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0xcb'));db[_0x431c('0xcc')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0xcd'));db[_0x431c('0xce')]=db[_0x431c('0x1')][_0x431c('0x13')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x431c('0xcf')]=db[_0x431c('0x1')][_0x431c('0x13')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x431c('0xd0')]=db['sequelize'][_0x431c('0x13')](_0x431c('0xd1'));db[_0x431c('0xd2')]=db[_0x431c('0x1')]['import'](_0x431c('0xd3'));db['SquareDetailsReport']=db[_0x431c('0x1')]['import'](_0x431c('0xd4'));db[_0x431c('0xd5')]=db[_0x431c('0x1')][_0x431c('0x13')]('../api/jscriptyProject/jscriptyProject.model');db[_0x431c('0xd6')]=db[_0x431c('0x1')]['import'](_0x431c('0xd7'));db[_0x431c('0xd8')]=db[_0x431c('0x1')]['import']('../api/squareOdbc/squareOdbc.model');db[_0x431c('0xd9')]=db['sequelize'][_0x431c('0x13')](_0x431c('0xda'));db[_0x431c('0xdb')]=db[_0x431c('0x1')]['import']('../api/squareRecording/squareRecording.model');db[_0x431c('0xdc')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0xdd'));db[_0x431c('0xde')]=db['sequelize'][_0x431c('0x13')]('../api/team/team.model');db[_0x431c('0xdf')]=db[_0x431c('0x1')][_0x431c('0x13')]('../api/license/license.model');db[_0x431c('0xe0')]=db['sequelize'][_0x431c('0x13')](_0x431c('0xe1'));db['Migration']=db['sequelize'][_0x431c('0x13')](_0x431c('0xe2'));db[_0x431c('0xe3')]=db[_0x431c('0x1')][_0x431c('0x13')]('../api/attachment/attachment.model');db[_0x431c('0xe4')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0xe5'));db[_0x431c('0xe6')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0xe7'));db[_0x431c('0xe8')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0xe9'));db[_0x431c('0xea')]=db[_0x431c('0x1')][_0x431c('0x13')]('../api/faxTransferReport/faxTransferReport.model');db[_0x431c('0xeb')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0xec'));db[_0x431c('0xed')]=db['sequelize'][_0x431c('0x13')](_0x431c('0xee'));db[_0x431c('0xef')]=db[_0x431c('0x1')][_0x431c('0x13')]('../api/cmList/cmList.model');db['VoicePrefix']=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0xf0'));db[_0x431c('0xf1')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0xf2'));db[_0x431c('0xf3')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0xf4'));db[_0x431c('0xf5')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0xf6'));db[_0x431c('0xf7')]=db[_0x431c('0x1')][_0x431c('0x13')]('../api/userNotification/userNotification.model');db['WhatsappAccount']=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0xf8'));db[_0x431c('0xf9')]=db[_0x431c('0x1')][_0x431c('0x13')]('../api/whatsappApplication/whatsappApplication.model');db[_0x431c('0xfa')]=db[_0x431c('0x1')]['import'](_0x431c('0xfb'));db[_0x431c('0xfc')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0xfd'));db[_0x431c('0xfe')]=db[_0x431c('0x1')][_0x431c('0x13')](_0x431c('0xff'));db[_0x431c('0x100')]=db[_0x431c('0x1')]['import']('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x431c('0x101')]=db[_0x431c('0x1')]['import']('../api/whatsappQueue/whatsappQueue.model');db[_0x431c('0x102')]=db['sequelize'][_0x431c('0x13')](_0x431c('0x103'));db[_0x431c('0x104')]=db[_0x431c('0x1')][_0x431c('0x13')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x431c('0x12')][_0x431c('0x105')](db[_0x431c('0x106')],{'as':_0x431c('0x106'),'onDelete':_0x431c('0x107'),'foreignKey':'UserId'});db[_0x431c('0x12')]['hasMany'](db[_0x431c('0x108')],{'as':_0x431c('0x109'),'foreignKey':'UserId'});db['User']['hasMany'](db['UserVoiceQueueRt'],{'as':_0x431c('0x10a'),'foreignKey':_0x431c('0x10b')});db['User'][_0x431c('0x10c')](db['VoiceExtension'],{'as':_0x431c('0x10d'),'onDelete':_0x431c('0x107'),'hooks':!![]});db['User']['hasMany'](db[_0x431c('0x75')],{'as':_0x431c('0x10e'),'foreignKey':_0x431c('0x10b')});db[_0x431c('0x12')]['hasMany'](db['CmHopperHistory'],{'as':_0x431c('0x10f'),'foreignKey':_0x431c('0x10b')});db['User'][_0x431c('0x10c')](db['ReportAgentPreview'],{'as':_0x431c('0x76'),'foreignKey':'UserId'});db[_0x431c('0x12')][_0x431c('0x10c')](db[_0x431c('0x5a')],{'as':_0x431c('0x110'),'foreignKey':_0x431c('0x10b')});db[_0x431c('0x12')][_0x431c('0x10c')](db[_0x431c('0x111')],{'as':_0x431c('0x112'),'foreignKey':_0x431c('0x10b')});db[_0x431c('0x12')]['hasMany'](db['SmsInteraction'],{'as':_0x431c('0x113'),'foreignKey':_0x431c('0x10b')});db['User'][_0x431c('0x10c')](db[_0x431c('0x4b')],{'as':_0x431c('0x114'),'foreignKey':_0x431c('0x10b')});db[_0x431c('0x12')][_0x431c('0x10c')](db[_0x431c('0x3f')],{'as':_0x431c('0x115'),'foreignKey':_0x431c('0x10b')});db[_0x431c('0x12')]['hasMany'](db[_0x431c('0xfa')],{'as':_0x431c('0x116'),'foreignKey':_0x431c('0x10b')});db['User'][_0x431c('0x10c')](db[_0x431c('0xf7')],{'as':'UserNotifications','foreignKey':_0x431c('0x117')});db[_0x431c('0x12')][_0x431c('0x118')](db[_0x431c('0xf1')],{'as':'UserProfile','foreignKey':_0x431c('0x119')});db[_0x431c('0x12')]['belongsToMany'](db[_0x431c('0x69')],{'as':'Groups','through':_0x431c('0x11a')});db[_0x431c('0x12')][_0x431c('0x11b')](db[_0x431c('0x6f')],{'as':_0x431c('0x11c'),'through':'cm_user_has_contacts'});db[_0x431c('0x12')][_0x431c('0x11b')](db[_0x431c('0xef')],{'as':'Lists','through':_0x431c('0x11d')});db[_0x431c('0x12')][_0x431c('0x11b')](db['Team'],{'through':_0x431c('0x11e')});db[_0x431c('0x12')][_0x431c('0x11b')](db['MailInteraction'],{'as':_0x431c('0x115'),'through':_0x431c('0x11f')});db[_0x431c('0x12')][_0x431c('0x11b')](db[_0x431c('0x111')],{'as':_0x431c('0x112'),'through':_0x431c('0x120')});db['User'][_0x431c('0x11b')](db[_0x431c('0x4b')],{'as':_0x431c('0x114'),'through':_0x431c('0x121')});db[_0x431c('0x12')][_0x431c('0x11b')](db[_0x431c('0x51')],{'as':'SmsInteractions','through':'user_has_sms_interactions'});db[_0x431c('0x12')]['belongsToMany'](db[_0x431c('0x5a')],{'as':'OpenchannelInteractions','through':_0x431c('0x122')});db[_0x431c('0x12')]['belongsToMany'](db[_0x431c('0xfa')],{'as':_0x431c('0x116'),'through':_0x431c('0x123')});db['User'][_0x431c('0x11b')](db[_0x431c('0x1b')],{'as':_0x431c('0x124'),'through':_0x431c('0x2e'),'required':![]});db['User'][_0x431c('0x11b')](db['MailQueue'],{'as':_0x431c('0x125'),'through':_0x431c('0x31'),'required':![]});db[_0x431c('0x12')]['belongsToMany'](db['ChatQueue'],{'as':'ChatQueues','through':'UserChatQueue','required':![],'hooks':!![]});db[_0x431c('0x12')][_0x431c('0x11b')](db[_0x431c('0x126')],{'as':_0x431c('0x127'),'through':_0x431c('0x33'),'required':![]});db['User'][_0x431c('0x11b')](db['SmsQueue'],{'as':_0x431c('0x128'),'through':_0x431c('0x34'),'required':![]});db[_0x431c('0x12')][_0x431c('0x11b')](db[_0x431c('0x5e')],{'as':_0x431c('0x129'),'through':_0x431c('0x36'),'required':![]});db[_0x431c('0x12')][_0x431c('0x11b')](db[_0x431c('0x101')],{'as':_0x431c('0x12a'),'through':'UserWhatsappQueue','required':![]});db[_0x431c('0x12')][_0x431c('0x11b')](db['CmList'],{'through':_0x431c('0x11d')});db[_0x431c('0x12')][_0x431c('0x11b')](db[_0x431c('0x12b')],{'as':'VoicePrefixes','through':_0x431c('0x12c'),'required':![]});db[_0x431c('0x12')][_0x431c('0x11b')](db[_0x431c('0x60')],{'as':'ChatWebsites','through':_0x431c('0x12d')});db[_0x431c('0x12')][_0x431c('0x11b')](db[_0x431c('0x48')],{'as':_0x431c('0x12e'),'through':'user_has_fax_accounts'});db['User'][_0x431c('0x11b')](db['MailAccount'],{'as':_0x431c('0x12f'),'through':_0x431c('0x130')});db['User']['belongsToMany'](db[_0x431c('0x57')],{'as':'OpenchannelAccounts','through':_0x431c('0x131')});db['User'][_0x431c('0x11b')](db[_0x431c('0x132')],{'as':_0x431c('0x133'),'through':'user_has_sms_accounts'});db[_0x431c('0x12')][_0x431c('0x11b')](db[_0x431c('0x134')],{'as':'WhatsappAccounts','through':_0x431c('0x135')});db['User']['belongsToMany'](db[_0x431c('0xd9')],{'as':_0x431c('0x136'),'through':'user_has_square_projects'});db[_0x431c('0x15')]['hasMany'](db[_0x431c('0x18')],{'as':_0x431c('0x137'),'onDelete':_0x431c('0x107'),'foreignKey':_0x431c('0x138')});db[_0x431c('0x139')][_0x431c('0x10c')](db['VoiceExtension'],{'onDelete':'cascade'});db[_0x431c('0x18')][_0x431c('0x10c')](db['VoiceExtension'],{'as':_0x431c('0x13a'),'onDelete':_0x431c('0x107')});db['VoiceMusicOnHold'][_0x431c('0x11b')](db[_0x431c('0x13b')],{'as':_0x431c('0x13c'),'through':'moh_has_sounds'});db[_0x431c('0x1b')][_0x431c('0x10c')](db[_0x431c('0x2c')],{'as':_0x431c('0x13d'),'foreignKey':_0x431c('0x13e')});db[_0x431c('0x1b')]['hasMany'](db[_0x431c('0x71')],{'as':_0x431c('0x13f'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x431c('0x10c')](db[_0x431c('0x75')],{'as':_0x431c('0x10e'),'foreignKey':_0x431c('0x13e')});db[_0x431c('0x1b')]['hasMany'](db['CmHopperHistory'],{'as':_0x431c('0x140'),'foreignKey':_0x431c('0x13e')});db[_0x431c('0x1b')]['hasMany'](db['ReportAgentPreview'],{'as':_0x431c('0x76'),'foreignKey':_0x431c('0x13e')});db['VoiceQueue'][_0x431c('0x10c')](db[_0x431c('0x73')],{'as':_0x431c('0x141'),'foreignKey':_0x431c('0x13e')});db[_0x431c('0x1b')][_0x431c('0x10c')](db[_0x431c('0xcf')],{'as':'JscriptySessions','foreignKey':_0x431c('0x13e')});db[_0x431c('0x1b')]['belongsTo'](db['Trunk'],{'as':_0x431c('0x142'),'foreignKey':'TrunkId'});db[_0x431c('0x1b')][_0x431c('0x118')](db[_0x431c('0x142')],{'as':_0x431c('0x143'),'foreignKey':_0x431c('0x144')});db[_0x431c('0x1b')][_0x431c('0x118')](db[_0x431c('0x145')],{'as':_0x431c('0x145'),'foreignKey':_0x431c('0x146')});db[_0x431c('0x1b')][_0x431c('0x118')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x431c('0x147')});db[_0x431c('0x1b')][_0x431c('0x11b')](db[_0x431c('0xef')],{'as':_0x431c('0x148'),'through':_0x431c('0x149')});db[_0x431c('0x1b')]['belongsToMany'](db[_0x431c('0x12')],{'as':_0x431c('0x14a'),'through':'UserVoiceQueue'});db[_0x431c('0x1b')]['belongsToMany'](db[_0x431c('0xde')],{'as':_0x431c('0x14b'),'through':'TeamVoiceQueue'});db[_0x431c('0x1b')][_0x431c('0x11b')](db['CmList'],{'as':_0x431c('0x14c'),'through':_0x431c('0x14d')});db[_0x431c('0x108')][_0x431c('0x118')](db[_0x431c('0x12')],{'as':_0x431c('0x12'),'foreignKey':_0x431c('0x10b')});db[_0x431c('0x14e')]['belongsTo'](db[_0x431c('0x12')],{'as':_0x431c('0x12'),'foreignKey':_0x431c('0x10b')});db[_0x431c('0x106')][_0x431c('0x10c')](db[_0x431c('0x20')],{'as':'Messages','onDelete':_0x431c('0x107'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db[_0x431c('0x20')][_0x431c('0x118')](db[_0x431c('0x106')],{'foreignKey':_0x431c('0x14f'),'targetKey':'mailbox'});db['VoiceCallReport'][_0x431c('0x10c')](db[_0x431c('0x150')],{'as':_0x431c('0x151'),'foreignKey':_0x431c('0x152'),'constraints':![]});db[_0x431c('0x22')][_0x431c('0x10c')](db['VoiceAgentReport'],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db[_0x431c('0x22')]['belongsTo'](db[_0x431c('0x12')],{'as':'User','foreignKey':_0x431c('0x10b')});db[_0x431c('0x22')]['belongsTo'](db[_0x431c('0x6f')],{'as':_0x431c('0x153'),'foreignKey':_0x431c('0x154')});db[_0x431c('0x155')][_0x431c('0x118')](db[_0x431c('0x156')],{'as':_0x431c('0x156'),'foreignKey':_0x431c('0x157')});db[_0x431c('0x39')][_0x431c('0x118')](db['MailAccount'],{'as':_0x431c('0x156'),'foreignKey':'MailAccountId'});db[_0x431c('0x156')][_0x431c('0x105')](db[_0x431c('0x155')],{'as':'Imap','onDelete':_0x431c('0x107')});db['MailAccount'][_0x431c('0x105')](db[_0x431c('0x39')],{'as':_0x431c('0x158'),'onDelete':'cascade'});db[_0x431c('0x156')]['hasMany'](db[_0x431c('0x7c')],{'as':'Dispositions','foreignKey':_0x431c('0x157')});db['MailAccount'][_0x431c('0x10c')](db['CannedAnswer'],{'as':_0x431c('0x159'),'foreignKey':'MailAccountId'});db[_0x431c('0x156')]['hasMany'](db[_0x431c('0x41')],{'as':_0x431c('0x15a'),'foreignKey':_0x431c('0x157')});db['MailAccount']['hasMany'](db[_0x431c('0x3f')],{'as':_0x431c('0x15b')});db[_0x431c('0x156')]['hasMany'](db[_0x431c('0x43')],{'as':'Applications'});db[_0x431c('0x156')][_0x431c('0x118')](db[_0x431c('0xef')],{'as':_0x431c('0x15c'),'foreignKey':_0x431c('0x15d')});db['MailAccount'][_0x431c('0x118')](db[_0x431c('0x15e')],{'as':_0x431c('0x15e'),'foreignKey':_0x431c('0x15f')});db['MailAccount'][_0x431c('0x118')](db[_0x431c('0x7f')],{'as':_0x431c('0x160'),'foreignKey':_0x431c('0x147')});db[_0x431c('0x156')][_0x431c('0x11b')](db['User'],{'as':_0x431c('0x14a'),'through':_0x431c('0x130')});db[_0x431c('0x3c')]['belongsToMany'](db[_0x431c('0x12')],{'as':_0x431c('0x14a'),'through':_0x431c('0x31')});db[_0x431c('0x3c')][_0x431c('0x11b')](db[_0x431c('0xde')],{'through':_0x431c('0x161'),'as':'Teams'});db['MailInteraction'][_0x431c('0x10c')](db['MailMessage'],{'as':_0x431c('0x15a'),'onDelete':'cascade','foreignKey':_0x431c('0x162')});db[_0x431c('0x3f')]['belongsTo'](db[_0x431c('0x156')],{'as':'Account','foreignKey':_0x431c('0x157')});db[_0x431c('0x3f')][_0x431c('0x118')](db[_0x431c('0x6f')],{'as':_0x431c('0x153'),'foreignKey':_0x431c('0x154')});db[_0x431c('0x3f')][_0x431c('0x118')](db[_0x431c('0x12')],{'as':_0x431c('0x163'),'foreignKey':_0x431c('0x10b')});db['MailInteraction'][_0x431c('0x11b')](db[_0x431c('0x87')],{'through':_0x431c('0x164'),'as':_0x431c('0x165')});db['MailInteraction'][_0x431c('0x11b')](db[_0x431c('0x87')],{'through':_0x431c('0x164'),'as':_0x431c('0x166')});db[_0x431c('0x3f')][_0x431c('0x11b')](db[_0x431c('0x12')],{'as':'Users','through':_0x431c('0x11f'),'foreignKey':'MailInteractionId'});db[_0x431c('0x41')][_0x431c('0x10c')](db[_0x431c('0xe3')],{'as':'Attachments','onDelete':_0x431c('0x107')});db[_0x431c('0x41')][_0x431c('0x118')](db['User'],{'as':_0x431c('0x12')});db[_0x431c('0x41')]['belongsTo'](db[_0x431c('0x6f')],{'onDelete':_0x431c('0x107'),'as':_0x431c('0x153')});db[_0x431c('0x41')][_0x431c('0x118')](db[_0x431c('0x3f')],{'as':_0x431c('0x167'),'foreignKey':_0x431c('0x162')});db[_0x431c('0x41')]['belongsTo'](db['MailAccount'],{'as':_0x431c('0x168'),'foreignKey':_0x431c('0x157')});db[_0x431c('0x41')]['belongsTo'](db[_0x431c('0x60')],{'as':'ChatWebsite','foreignKey':_0x431c('0x169')});db[_0x431c('0x41')]['belongsTo'](db[_0x431c('0x16a')],{'as':_0x431c('0x16a'),'foreignKey':_0x431c('0x16b')});db['MailApplication']['belongsTo'](db[_0x431c('0x12')],{'onDelete':_0x431c('0x16c')});db[_0x431c('0x43')][_0x431c('0x118')](db[_0x431c('0x3c')],{'onDelete':'restrict'});db[_0x431c('0x43')][_0x431c('0x118')](db[_0x431c('0x156')],{'onDelete':'restrict'});db[_0x431c('0x43')]['belongsTo'](db[_0x431c('0x145')],{'onDelete':_0x431c('0x16c'),'foreignKey':'IntervalId'});db['MailApplication'][_0x431c('0x118')](db[_0x431c('0x87')],{'onDelete':_0x431c('0x16c'),'foreignKey':_0x431c('0x16d')});db[_0x431c('0x44')][_0x431c('0x118')](db[_0x431c('0x156')],{});db[_0x431c('0x44')]['belongsTo'](db[_0x431c('0xef')],{'as':'List','foreignKey':_0x431c('0x15d')});db[_0x431c('0x44')][_0x431c('0x118')](db['CmContact'],{'as':_0x431c('0x153'),'foreignKey':_0x431c('0x154')});db[_0x431c('0x44')][_0x431c('0x118')](db[_0x431c('0x3f')],{});db['MailQueueReport'][_0x431c('0x118')](db['MailMessage'],{});db[_0x431c('0x44')][_0x431c('0x118')](db['User'],{});db[_0x431c('0x44')][_0x431c('0x118')](db[_0x431c('0x3c')],{});db[_0x431c('0x46')][_0x431c('0x10c')](db[_0x431c('0x16e')],{'as':_0x431c('0x16f'),'onDelete':'cascade'});db[_0x431c('0x48')][_0x431c('0x10c')](db[_0x431c('0x7c')],{'as':_0x431c('0x170'),'foreignKey':_0x431c('0x171')});db[_0x431c('0x48')][_0x431c('0x10c')](db['CannedAnswer'],{'as':_0x431c('0x159'),'foreignKey':_0x431c('0x171')});db[_0x431c('0x48')][_0x431c('0x10c')](db['FaxInteraction'],{'as':_0x431c('0x15b')});db['FaxAccount'][_0x431c('0x10c')](db[_0x431c('0x172')],{'as':_0x431c('0x13a')});db[_0x431c('0x48')][_0x431c('0x10c')](db[_0x431c('0x18')],{'as':'Exntensions','onDelete':_0x431c('0x107')});db[_0x431c('0x48')][_0x431c('0x10c')](db['FaxMessage'],{'as':_0x431c('0x15a')});db[_0x431c('0x48')][_0x431c('0x118')](db[_0x431c('0x142')],{'as':_0x431c('0x142')});db[_0x431c('0x48')][_0x431c('0x118')](db[_0x431c('0xef')],{'as':_0x431c('0x15c'),'foreignKey':'ListId'});db[_0x431c('0x48')][_0x431c('0x118')](db['Pause'],{'as':_0x431c('0x160'),'foreignKey':_0x431c('0x147')});db[_0x431c('0x48')]['belongsToMany'](db['User'],{'as':_0x431c('0x14a'),'through':_0x431c('0x173')});db['FaxApplication'][_0x431c('0x118')](db[_0x431c('0x12')],{'onDelete':_0x431c('0x16c')});db[_0x431c('0x172')]['belongsTo'](db['FaxQueue'],{'onDelete':_0x431c('0x16c')});db['FaxApplication'][_0x431c('0x118')](db['FaxAccount'],{'onDelete':'restrict'});db['FaxApplication']['belongsTo'](db[_0x431c('0x87')],{'onDelete':_0x431c('0x16c'),'foreignKey':'TagId'});db[_0x431c('0x4b')][_0x431c('0x10c')](db['FaxMessage'],{'as':'Messages','onDelete':_0x431c('0x107'),'foreignKey':_0x431c('0x174')});db[_0x431c('0x4b')]['belongsTo'](db['FaxAccount'],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x431c('0x4b')][_0x431c('0x118')](db[_0x431c('0x6f')],{'as':_0x431c('0x153'),'foreignKey':_0x431c('0x154')});db[_0x431c('0x4b')]['belongsTo'](db[_0x431c('0x12')],{'as':'Owner','foreignKey':_0x431c('0x10b')});db[_0x431c('0x4b')]['belongsToMany'](db['Tag'],{'through':_0x431c('0x175'),'as':_0x431c('0x165')});db[_0x431c('0x4b')]['belongsToMany'](db['Tag'],{'through':'fax_interaction_has_tags','as':_0x431c('0x166')});db[_0x431c('0x4b')]['belongsToMany'](db[_0x431c('0x12')],{'as':_0x431c('0x176'),'through':_0x431c('0x121'),'foreignKey':'FaxInteractionId'});db[_0x431c('0x177')][_0x431c('0x118')](db[_0x431c('0x12')],{'onDelete':_0x431c('0x107'),'as':_0x431c('0x12')});db[_0x431c('0x177')][_0x431c('0x118')](db[_0x431c('0x4b')],{'as':_0x431c('0x167'),'foreignKey':_0x431c('0x174')});db[_0x431c('0x177')]['belongsTo'](db[_0x431c('0x6f')],{'onDelete':'cascade','as':_0x431c('0x153')});db[_0x431c('0x177')]['belongsTo'](db['Attachment'],{'as':_0x431c('0xe3'),'foreignKey':_0x431c('0x178')});db['FaxMessage'][_0x431c('0x118')](db['FaxAccount'],{'as':_0x431c('0x168'),'foreignKey':_0x431c('0x171')});db[_0x431c('0x126')][_0x431c('0x11b')](db[_0x431c('0x12')],{'as':_0x431c('0x14a'),'through':_0x431c('0x33')});db['FaxQueue'][_0x431c('0x11b')](db[_0x431c('0xde')],{'through':'team_has_fax_queues','as':_0x431c('0x14b')});db[_0x431c('0x179')][_0x431c('0x118')](db[_0x431c('0x48')],{});db[_0x431c('0x179')]['belongsTo'](db[_0x431c('0xef')],{'as':_0x431c('0x15c'),'foreignKey':'ListId'});db[_0x431c('0x179')]['belongsTo'](db[_0x431c('0x6f')],{'as':'Contact','foreignKey':_0x431c('0x154')});db[_0x431c('0x179')][_0x431c('0x118')](db[_0x431c('0x4b')],{});db['FaxQueueReport'][_0x431c('0x118')](db[_0x431c('0x177')],{});db['FaxQueueReport'][_0x431c('0x118')](db[_0x431c('0x12')],{});db[_0x431c('0x179')][_0x431c('0x118')](db['FaxQueue'],{});db['SmsAccount']['hasMany'](db[_0x431c('0x7c')],{'as':_0x431c('0x170'),'foreignKey':'SmsAccountId'});db[_0x431c('0x132')][_0x431c('0x10c')](db[_0x431c('0x7a')],{'as':_0x431c('0x159'),'foreignKey':_0x431c('0x17a')});db[_0x431c('0x132')][_0x431c('0x10c')](db[_0x431c('0x53')],{'as':_0x431c('0x15a'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0x431c('0x10c')](db[_0x431c('0x51')],{'as':_0x431c('0x15b')});db[_0x431c('0x132')]['hasMany'](db['SmsApplication'],{'as':_0x431c('0x13a')});db[_0x431c('0x132')][_0x431c('0x118')](db[_0x431c('0xef')],{'as':'List','foreignKey':_0x431c('0x15d')});db['SmsAccount'][_0x431c('0x118')](db[_0x431c('0x7f')],{'as':_0x431c('0x160'),'foreignKey':_0x431c('0x147')});db['SmsAccount'][_0x431c('0x11b')](db['User'],{'as':'Agents','through':_0x431c('0x17b')});db[_0x431c('0x4f')]['belongsTo'](db[_0x431c('0x12')],{'onDelete':_0x431c('0x16c')});db['SmsApplication'][_0x431c('0x118')](db[_0x431c('0x55')],{'onDelete':_0x431c('0x16c')});db['SmsApplication']['belongsTo'](db[_0x431c('0x132')],{'onDelete':_0x431c('0x16c')});db[_0x431c('0x4f')][_0x431c('0x118')](db['Interval'],{'onDelete':_0x431c('0x16c'),'foreignKey':_0x431c('0x146')});db[_0x431c('0x4f')][_0x431c('0x118')](db[_0x431c('0x87')],{'onDelete':_0x431c('0x16c'),'foreignKey':_0x431c('0x16d')});db['SmsInteraction']['hasMany'](db[_0x431c('0x53')],{'as':_0x431c('0x15a'),'onDelete':_0x431c('0x107'),'foreignKey':'SmsInteractionId'});db[_0x431c('0x51')][_0x431c('0x118')](db['SmsAccount'],{'as':_0x431c('0x168'),'foreignKey':'SmsAccountId'});db[_0x431c('0x51')][_0x431c('0x118')](db[_0x431c('0x6f')],{'as':_0x431c('0x153'),'foreignKey':_0x431c('0x154')});db[_0x431c('0x51')][_0x431c('0x118')](db['User'],{'as':_0x431c('0x163'),'foreignKey':_0x431c('0x10b')});db[_0x431c('0x51')][_0x431c('0x11b')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0x431c('0x165')});db[_0x431c('0x51')]['belongsToMany'](db[_0x431c('0x87')],{'through':_0x431c('0x17c'),'as':_0x431c('0x166')});db[_0x431c('0x51')]['belongsToMany'](db[_0x431c('0x12')],{'as':'Users','through':_0x431c('0x17d'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0x431c('0x118')](db[_0x431c('0x12')],{'as':_0x431c('0x12')});db[_0x431c('0x53')][_0x431c('0x118')](db[_0x431c('0x6f')],{'onDelete':_0x431c('0x107'),'as':_0x431c('0x153')});db['SmsMessage'][_0x431c('0x118')](db[_0x431c('0x51')],{'onDelete':_0x431c('0x107'),'as':_0x431c('0x167'),'foreignKey':_0x431c('0x17e')});db[_0x431c('0x53')]['belongsTo'](db[_0x431c('0x132')],{'as':_0x431c('0x168'),'foreignKey':_0x431c('0x17a')});db[_0x431c('0x55')][_0x431c('0x11b')](db[_0x431c('0x12')],{'as':_0x431c('0x14a'),'through':_0x431c('0x34'),'foreignKey':_0x431c('0x17f')});db['SmsQueue']['belongsToMany'](db[_0x431c('0xde')],{'through':_0x431c('0x180'),'as':_0x431c('0x14b')});db[_0x431c('0x57')][_0x431c('0x10c')](db[_0x431c('0x7c')],{'as':'Dispositions','foreignKey':'OpenchannelAccountId'});db[_0x431c('0x57')][_0x431c('0x10c')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x431c('0x181')});db['OpenchannelAccount'][_0x431c('0x10c')](db[_0x431c('0x5a')],{'as':_0x431c('0x15b'),'foreignKey':_0x431c('0x181')});db[_0x431c('0x57')][_0x431c('0x10c')](db[_0x431c('0x5c')],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db[_0x431c('0x57')][_0x431c('0x10c')](db[_0x431c('0x182')],{'as':'Applications','foreignKey':_0x431c('0x181')});db[_0x431c('0x57')][_0x431c('0x118')](db[_0x431c('0xef')],{'as':'List','foreignKey':'ListId'});db['OpenchannelAccount'][_0x431c('0x118')](db[_0x431c('0x7f')],{'as':_0x431c('0x160'),'foreignKey':_0x431c('0x147')});db[_0x431c('0x57')][_0x431c('0x11b')](db[_0x431c('0x12')],{'as':_0x431c('0x14a'),'through':'user_has_openchannel_accounts'});db[_0x431c('0x182')]['belongsTo'](db['User'],{'onDelete':'restrict'});db['OpenchannelApplication'][_0x431c('0x118')](db[_0x431c('0x5e')],{'onDelete':_0x431c('0x16c'),'foreignKey':_0x431c('0x183')});db[_0x431c('0x182')][_0x431c('0x118')](db[_0x431c('0x57')],{'onDelete':_0x431c('0x16c'),'foreignKey':_0x431c('0x181')});db['OpenchannelApplication'][_0x431c('0x118')](db['Interval'],{'onDelete':_0x431c('0x16c'),'foreignKey':_0x431c('0x146')});db[_0x431c('0x182')][_0x431c('0x118')](db['Tag'],{'onDelete':_0x431c('0x16c'),'foreignKey':_0x431c('0x16d')});db[_0x431c('0x5a')]['hasMany'](db[_0x431c('0x5c')],{'as':_0x431c('0x15a'),'onDelete':_0x431c('0x107'),'foreignKey':_0x431c('0x184')});db['OpenchannelInteraction']['belongsTo'](db[_0x431c('0x57')],{'as':_0x431c('0x168'),'foreignKey':_0x431c('0x181')});db['OpenchannelInteraction'][_0x431c('0x118')](db[_0x431c('0x6f')],{'as':'Contact','foreignKey':'ContactId'});db['OpenchannelInteraction'][_0x431c('0x118')](db[_0x431c('0x12')],{'as':_0x431c('0x163'),'foreignKey':_0x431c('0x10b')});db['OpenchannelInteraction'][_0x431c('0x11b')](db[_0x431c('0x87')],{'through':'openchannel_interaction_has_tags','as':_0x431c('0x165')});db[_0x431c('0x5a')][_0x431c('0x11b')](db[_0x431c('0x87')],{'through':_0x431c('0x185'),'as':_0x431c('0x166')});db[_0x431c('0x5a')]['belongsToMany'](db[_0x431c('0x12')],{'as':_0x431c('0x176'),'through':_0x431c('0x122'),'foreignKey':_0x431c('0x184')});db[_0x431c('0x5c')]['belongsTo'](db[_0x431c('0x12')],{'onDelete':_0x431c('0x107'),'as':'User'});db[_0x431c('0x5c')][_0x431c('0x118')](db[_0x431c('0x6f')],{'onDelete':_0x431c('0x107'),'as':_0x431c('0x153')});db[_0x431c('0x5c')][_0x431c('0x118')](db['OpenchannelInteraction'],{'onDelete':_0x431c('0x107'),'as':_0x431c('0x167'),'foreignKey':_0x431c('0x184')});db['OpenchannelMessage']['belongsTo'](db[_0x431c('0xe3')],{'as':_0x431c('0xe3'),'foreignKey':'AttachmentId'});db['OpenchannelMessage'][_0x431c('0x118')](db[_0x431c('0x57')],{'as':_0x431c('0x168'),'foreignKey':_0x431c('0x181')});db[_0x431c('0x5e')][_0x431c('0x11b')](db[_0x431c('0x12')],{'as':'Agents','through':_0x431c('0x36'),'foreignKey':'OpenchannelQueueId'});db[_0x431c('0x5e')][_0x431c('0x11b')](db[_0x431c('0xde')],{'through':_0x431c('0x186'),'as':'Teams'});db[_0x431c('0x60')][_0x431c('0x10c')](db[_0x431c('0x7c')],{'as':_0x431c('0x170'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0x431c('0x10c')](db[_0x431c('0x7a')],{'as':_0x431c('0x159'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite']['hasMany'](db['ChatProactiveAction'],{'as':_0x431c('0x187')});db[_0x431c('0x60')][_0x431c('0x10c')](db[_0x431c('0x111')],{'as':'Interactions'});db[_0x431c('0x60')][_0x431c('0x10c')](db[_0x431c('0x63')],{'as':'Applications'});db[_0x431c('0x60')][_0x431c('0x10c')](db[_0x431c('0x65')],{'as':'Messages'});db[_0x431c('0x60')][_0x431c('0x118')](db[_0x431c('0xef')],{'as':_0x431c('0x15c'),'foreignKey':_0x431c('0x15d')});db['ChatWebsite']['belongsTo'](db['Interval'],{'as':_0x431c('0x145'),'foreignKey':_0x431c('0x146')});db[_0x431c('0x60')][_0x431c('0x118')](db[_0x431c('0x156')],{'as':_0x431c('0x156'),'foreignKey':_0x431c('0x157')});db[_0x431c('0x60')][_0x431c('0x118')](db[_0x431c('0x7f')],{'as':_0x431c('0x160'),'foreignKey':'mandatoryDispositionPauseId'});db['ChatWebsite'][_0x431c('0x11b')](db[_0x431c('0x12')],{'as':_0x431c('0x14a'),'through':_0x431c('0x12d')});db[_0x431c('0x61')][_0x431c('0x118')](db[_0x431c('0x57')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x431c('0xef')],{'as':_0x431c('0x15c'),'foreignKey':_0x431c('0x15d')});db['OpenchannelQueueReport']['belongsTo'](db[_0x431c('0x6f')],{'as':_0x431c('0x153'),'foreignKey':_0x431c('0x154')});db[_0x431c('0x61')][_0x431c('0x118')](db['OpenchannelInteraction'],{});db[_0x431c('0x61')][_0x431c('0x118')](db['OpenchannelMessage'],{});db['OpenchannelQueueReport'][_0x431c('0x118')](db[_0x431c('0x12')],{});db[_0x431c('0x61')][_0x431c('0x118')](db['OpenchannelQueue'],{});db[_0x431c('0x63')][_0x431c('0x118')](db[_0x431c('0x12')],{'as':'Agent','foreignKey':_0x431c('0x10b'),'onDelete':_0x431c('0x16c')});db[_0x431c('0x63')][_0x431c('0x118')](db[_0x431c('0x188')],{'as':_0x431c('0x189'),'foreignKey':_0x431c('0x18a'),'onDelete':'restrict'});db[_0x431c('0x63')][_0x431c('0x118')](db[_0x431c('0x60')],{'as':'Website','foreignKey':_0x431c('0x169'),'onDelete':'restrict'});db[_0x431c('0x63')][_0x431c('0x118')](db[_0x431c('0x87')],{'onDelete':_0x431c('0x16c'),'foreignKey':_0x431c('0x16d')});db[_0x431c('0x111')][_0x431c('0x10c')](db[_0x431c('0x65')],{'as':'Messages','onDelete':_0x431c('0x107'),'foreignKey':_0x431c('0x18b')});db['ChatInteraction'][_0x431c('0x118')](db[_0x431c('0x60')],{'as':_0x431c('0x168'),'foreignKey':_0x431c('0x169')});db[_0x431c('0x111')][_0x431c('0x118')](db[_0x431c('0x6f')],{'as':_0x431c('0x153'),'foreignKey':_0x431c('0x154')});db[_0x431c('0x111')]['belongsTo'](db[_0x431c('0x12')],{'as':_0x431c('0x163'),'foreignKey':_0x431c('0x10b')});db[_0x431c('0x111')][_0x431c('0x11b')](db[_0x431c('0x87')],{'through':_0x431c('0x18c'),'as':_0x431c('0x165')});db['ChatInteraction'][_0x431c('0x11b')](db[_0x431c('0x87')],{'through':_0x431c('0x18c'),'as':_0x431c('0x166')});db[_0x431c('0x111')][_0x431c('0x11b')](db[_0x431c('0x12')],{'as':_0x431c('0x176'),'through':_0x431c('0x120'),'foreignKey':_0x431c('0x18b')});db['ChatMessage'][_0x431c('0x118')](db[_0x431c('0x12')],{'onDelete':'cascade','as':_0x431c('0x12')});db[_0x431c('0x65')][_0x431c('0x118')](db[_0x431c('0x6f')],{'onDelete':_0x431c('0x107'),'as':_0x431c('0x153'),'foreignKey':_0x431c('0x154')});db['ChatMessage'][_0x431c('0x118')](db[_0x431c('0x111')],{'onDelete':_0x431c('0x107'),'as':'Interaction','foreignKey':_0x431c('0x18b')});db[_0x431c('0x65')][_0x431c('0x118')](db['Attachment'],{'as':_0x431c('0xe3'),'foreignKey':'AttachmentId'});db['ChatMessage']['belongsTo'](db[_0x431c('0x60')],{'as':_0x431c('0x168'),'foreignKey':'ChatWebsiteId'});db[_0x431c('0x16a')][_0x431c('0x10c')](db[_0x431c('0xe3')],{'as':_0x431c('0x18d'),'foreignKey':_0x431c('0x16b'),'onDelete':_0x431c('0x107'),'hooks':!![]});db[_0x431c('0x16a')]['belongsTo'](db[_0x431c('0x6f')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x431c('0x154')});db[_0x431c('0x16a')][_0x431c('0x118')](db[_0x431c('0x60')],{'as':_0x431c('0x168'),'foreignKey':'ChatWebsiteId'});db['ChatQueue'][_0x431c('0x11b')](db['User'],{'as':_0x431c('0x14a'),'through':'UserChatQueue','hooks':!![]});db[_0x431c('0x188')]['belongsToMany'](db[_0x431c('0xde')],{'through':_0x431c('0x18e'),'as':'Teams'});db[_0x431c('0x69')][_0x431c('0x10c')](db['ChatInternalMessage'],{'as':_0x431c('0x15a'),'foreignKey':_0x431c('0x18f'),'onDelete':_0x431c('0x107')});db['ChatGroup']['belongsToMany'](db['User'],{'as':_0x431c('0x13d'),'through':'chat_group_has_users'});db[_0x431c('0x6b')]['belongsTo'](db[_0x431c('0x60')],{'as':_0x431c('0x190'),'foreignKey':'ChatWebsiteId'});db[_0x431c('0x6d')]['hasMany'](db[_0x431c('0x6f')],{'as':_0x431c('0x11c'),'foreignKey':_0x431c('0x191')});db['CmContact'][_0x431c('0x10c')](db[_0x431c('0x71')],{'as':_0x431c('0x13f'),'foreignKey':_0x431c('0x154')});db['CmContact'][_0x431c('0x10c')](db[_0x431c('0x75')],{'as':_0x431c('0x10e'),'foreignKey':_0x431c('0x154')});db['CmContact']['hasMany'](db[_0x431c('0x192')],{'as':'HopperHistories','foreignKey':'ContactId'});db[_0x431c('0x6f')][_0x431c('0x10c')](db[_0x431c('0x76')],{'as':_0x431c('0x76'),'foreignKey':_0x431c('0x154')});db['CmContact']['hasMany'](db[_0x431c('0xcf')],{'as':_0x431c('0x193'),'foreignKey':'ContactId'});db[_0x431c('0x6f')][_0x431c('0x10c')](db[_0x431c('0x5a')],{'as':_0x431c('0x110'),'foreignKey':_0x431c('0x154'),'onDelete':_0x431c('0x16c')});db[_0x431c('0x6f')]['hasMany'](db[_0x431c('0x111')],{'as':_0x431c('0x112'),'foreignKey':_0x431c('0x154'),'onDelete':_0x431c('0x16c')});db[_0x431c('0x6f')][_0x431c('0x10c')](db[_0x431c('0x51')],{'as':_0x431c('0x113'),'foreignKey':_0x431c('0x154'),'onDelete':_0x431c('0x16c')});db['CmContact'][_0x431c('0x10c')](db[_0x431c('0x4b')],{'as':'FaxInteractions','foreignKey':_0x431c('0x154'),'onDelete':'restrict'});db[_0x431c('0x6f')][_0x431c('0x10c')](db[_0x431c('0x3f')],{'as':_0x431c('0x115'),'foreignKey':'ContactId','onDelete':'restrict'});db['CmContact'][_0x431c('0x118')](db['CmCompany'],{'as':_0x431c('0x194'),'foreignKey':_0x431c('0x191')});db['CmContact'][_0x431c('0x118')](db[_0x431c('0xef')],{'as':'List','foreignKey':'ListId','onDelete':_0x431c('0x107')});db[_0x431c('0x6f')]['belongsToMany'](db[_0x431c('0x12')],{'as':_0x431c('0x176'),'through':_0x431c('0x195')});db[_0x431c('0x6f')][_0x431c('0x11b')](db['Tag'],{'as':_0x431c('0x165'),'through':_0x431c('0x196')});db['CmContact'][_0x431c('0x11b')](db[_0x431c('0x87')],{'through':_0x431c('0x196'),'as':_0x431c('0x166')});db['CmHopper']['belongsTo'](db[_0x431c('0x6f')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0x431c('0x107')});db[_0x431c('0x71')]['belongsTo'](db[_0x431c('0xef')],{'as':_0x431c('0x15c'),'foreignKey':'ListId','onDelete':_0x431c('0x107')});db[_0x431c('0x71')][_0x431c('0x118')](db[_0x431c('0x12')],{'as':_0x431c('0x197'),'foreignKey':_0x431c('0x10b')});db['CmHopper'][_0x431c('0x118')](db[_0x431c('0x1b')],{'as':_0x431c('0x189'),'foreignKey':_0x431c('0x13e'),'onDelete':_0x431c('0x107')});db['CmHopper'][_0x431c('0x118')](db[_0x431c('0xe0')],{'as':_0x431c('0xe0'),'foreignKey':_0x431c('0x198'),'onDelete':_0x431c('0x107')});db[_0x431c('0x71')][_0x431c('0x118')](db[_0x431c('0x12')],{'as':'Owner','foreignKey':_0x431c('0x199')});db[_0x431c('0x73')][_0x431c('0x118')](db[_0x431c('0x6f')],{'as':_0x431c('0x153'),'foreignKey':_0x431c('0x154'),'onDelete':_0x431c('0x107')});db['CmHopperBlack'][_0x431c('0x118')](db[_0x431c('0xef')],{'as':_0x431c('0x15c'),'foreignKey':_0x431c('0x15d'),'onDelete':'cascade'});db[_0x431c('0x73')]['belongsTo'](db['VoiceQueue'],{'as':_0x431c('0x189'),'foreignKey':_0x431c('0x13e'),'onDelete':'cascade'});db[_0x431c('0x73')][_0x431c('0x118')](db['Campaign'],{'as':_0x431c('0xe0'),'foreignKey':_0x431c('0x198'),'onDelete':_0x431c('0x107')});db['Automation']['hasMany'](db[_0x431c('0x7e')],{'as':{'plural':_0x431c('0x19a'),'singular':_0x431c('0x19b')},'foreignKey':_0x431c('0x19c'),'onDelete':'cascade','hooks':!![]});db[_0x431c('0x19d')][_0x431c('0x10c')](db[_0x431c('0x7e')],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':_0x431c('0x19e'),'onDelete':_0x431c('0x107'),'hooks':!![]});db['Automation'][_0x431c('0x10c')](db[_0x431c('0x78')],{'as':_0x431c('0x19f'),'foreignKey':'AutomationId','onDelete':_0x431c('0x107'),'hooks':!![]});db[_0x431c('0x7c')][_0x431c('0x10c')](db['Disposition'],{'as':_0x431c('0x170'),'foreignKey':'ParentId','onDelete':_0x431c('0x107')});db[_0x431c('0x145')][_0x431c('0x10c')](db[_0x431c('0x145')],{'as':'Intervals','foreignKey':'IntervalId','onDelete':_0x431c('0x107'),'hooks':!![],'required':![]});db[_0x431c('0x145')][_0x431c('0x10c')](db[_0x431c('0x18')],{'as':_0x431c('0x10d'),'foreignKey':_0x431c('0x146'),'onDelete':_0x431c('0x16c')});db['Interval']['hasMany'](db[_0x431c('0x43')],{'as':_0x431c('0x1a0'),'foreignKey':'IntervalId'});db[_0x431c('0x145')]['hasMany'](db[_0x431c('0x63')],{'as':_0x431c('0x1a1'),'foreignKey':_0x431c('0x146')});db[_0x431c('0x145')][_0x431c('0x10c')](db[_0x431c('0x172')],{'as':'FaxApplications','foreignKey':_0x431c('0x146')});db['Interval']['hasMany'](db[_0x431c('0x4f')],{'as':'SmsApplications','foreignKey':'IntervalId'});db['Schedule'][_0x431c('0x118')](db[_0x431c('0x156')],{});db['Schedule'][_0x431c('0x118')](db[_0x431c('0x8f')],{'foreignKey':'DefaultReportId'});db[_0x431c('0x85')][_0x431c('0x118')](db['AnalyticCustomReport'],{'foreignKey':'CustomReportId'});db[_0x431c('0x13b')][_0x431c('0x11b')](db[_0x431c('0x19')],{'as':'Mohs','through':_0x431c('0x1a2'),'onDelete':'restrict'});db[_0x431c('0x87')][_0x431c('0x11b')](db[_0x431c('0x6f')],{'through':'cm_contact_has_tags'});db[_0x431c('0x87')]['belongsToMany'](db[_0x431c('0x111')],{'through':_0x431c('0x18c')});db['Tag'][_0x431c('0x11b')](db[_0x431c('0x3f')],{'through':_0x431c('0x164')});db['Tag'][_0x431c('0x11b')](db[_0x431c('0x51')],{'through':'sms_interaction_has_tags'});db[_0x431c('0x87')][_0x431c('0x11b')](db['FaxInteraction'],{'through':_0x431c('0x175')});db[_0x431c('0x87')][_0x431c('0x11b')](db[_0x431c('0x5a')],{'through':_0x431c('0x185')});db['Tag']['belongsToMany'](db[_0x431c('0xfa')],{'through':_0x431c('0x1a3')});db[_0x431c('0x1a4')][_0x431c('0x10c')](db['Condition'],{'as':{'plural':_0x431c('0x1a5'),'singular':_0x431c('0x1a6')},'foreignKey':_0x431c('0x1a7'),'onDelete':'cascade','hooks':!![]});db[_0x431c('0x1a4')][_0x431c('0x10c')](db[_0x431c('0x7e')],{'as':{'plural':_0x431c('0x1a8'),'singular':_0x431c('0x1a9')},'foreignKey':_0x431c('0x1aa'),'onDelete':'cascade','hooks':!![]});db[_0x431c('0x1a4')][_0x431c('0x10c')](db[_0x431c('0x78')],{'as':_0x431c('0x19f'),'foreignKey':'TriggerId','onDelete':'cascade','hooks':!![]});db[_0x431c('0x1ab')]['hasMany'](db[_0x431c('0x95')],{'as':_0x431c('0x1ac'),'onDelete':'cascade','foreignKey':_0x431c('0x1ad'),'hooks':!![]});db['AnalyticDefaultReport'][_0x431c('0x10c')](db[_0x431c('0x95')],{'as':'Fields','onDelete':_0x431c('0x107'),'foreignKey':'DefaultReportId'});db['AnalyticMetric'][_0x431c('0x10c')](db[_0x431c('0x95')],{'as':'Fields','onDelete':_0x431c('0x107'),'foreignKey':_0x431c('0x1ae')});db[_0x431c('0x95')][_0x431c('0x118')](db[_0x431c('0x93')],{'foreignKey':_0x431c('0x1ae')});db['SalesforceAccount'][_0x431c('0x10c')](db[_0x431c('0x9a')],{'as':_0x431c('0x1af'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x431c('0x9a')][_0x431c('0x10c')](db[_0x431c('0x9c')],{'as':_0x431c('0x1b0'),'onDelete':'cascade','foreignKey':'SubjectId'});db['SalesforceConfiguration'][_0x431c('0x10c')](db[_0x431c('0x9c')],{'as':_0x431c('0x1b1'),'onDelete':_0x431c('0x107'),'foreignKey':_0x431c('0x1b2')});db['SalesforceConfiguration']['hasMany'](db[_0x431c('0x9c')],{'as':_0x431c('0x1ac'),'onDelete':_0x431c('0x107'),'foreignKey':_0x431c('0x1b3')});db[_0x431c('0x9a')][_0x431c('0x118')](db[_0x431c('0x1b4')],{'as':_0x431c('0x168'),'foreignKey':_0x431c('0x1b5')});db['SalesforceField'][_0x431c('0x10c')](db[_0x431c('0x9c')],{'as':_0x431c('0x1b6'),'foreignKey':_0x431c('0x1b7')});db['SalesforceField']['hasMany'](db[_0x431c('0x9c')],{'as':_0x431c('0x1b8'),'foreignKey':_0x431c('0x1b2')});db[_0x431c('0x9c')][_0x431c('0x10c')](db[_0x431c('0x9c')],{'as':_0x431c('0x1b9'),'foreignKey':_0x431c('0x1b3')});db[_0x431c('0x9c')][_0x431c('0x118')](db[_0x431c('0x89')],{'as':_0x431c('0x89'),'foreignKey':_0x431c('0x1ba')});db[_0x431c('0x9e')][_0x431c('0x10c')](db[_0x431c('0x9f')],{'as':_0x431c('0x1af'),'onDelete':_0x431c('0x107'),'foreignKey':_0x431c('0x1b5')});db[_0x431c('0x9f')][_0x431c('0x10c')](db[_0x431c('0xa1')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x431c('0x1b7')});db['SugarcrmConfiguration']['hasMany'](db[_0x431c('0xa1')],{'as':_0x431c('0x1b1'),'onDelete':'cascade','foreignKey':_0x431c('0x1b2')});db[_0x431c('0x9f')]['hasMany'](db[_0x431c('0xa1')],{'as':_0x431c('0x1ac'),'onDelete':'cascade','foreignKey':_0x431c('0x1b3')});db[_0x431c('0x9f')]['belongsTo'](db[_0x431c('0x9e')],{'as':_0x431c('0x168'),'foreignKey':_0x431c('0x1b5')});db['SugarcrmField']['hasMany'](db[_0x431c('0xa1')],{'as':_0x431c('0x1b6'),'foreignKey':'SubjectId'});db[_0x431c('0xa1')][_0x431c('0x10c')](db[_0x431c('0xa1')],{'as':_0x431c('0x1b8'),'foreignKey':_0x431c('0x1b2')});db[_0x431c('0xa1')]['hasMany'](db['SugarcrmField'],{'as':_0x431c('0x1b9'),'foreignKey':_0x431c('0x1b3')});db[_0x431c('0xa1')][_0x431c('0x118')](db[_0x431c('0x89')],{'as':_0x431c('0x89'),'foreignKey':_0x431c('0x1ba')});db[_0x431c('0xa2')][_0x431c('0x10c')](db[_0x431c('0xa4')],{'as':_0x431c('0x1af'),'onDelete':_0x431c('0x107'),'foreignKey':_0x431c('0x1b5')});db[_0x431c('0xa4')][_0x431c('0x10c')](db[_0x431c('0xa6')],{'as':_0x431c('0x1b0'),'onDelete':_0x431c('0x107'),'foreignKey':'SubjectId'});db[_0x431c('0xa4')][_0x431c('0x10c')](db[_0x431c('0xa6')],{'as':_0x431c('0x1b1'),'onDelete':'cascade','foreignKey':_0x431c('0x1b2')});db[_0x431c('0xa4')][_0x431c('0x10c')](db[_0x431c('0xa6')],{'as':'Fields','onDelete':_0x431c('0x107'),'foreignKey':_0x431c('0x1b3')});db['DeskConfiguration']['belongsTo'](db[_0x431c('0xa2')],{'as':_0x431c('0x168'),'foreignKey':_0x431c('0x1b5')});db[_0x431c('0xa4')][_0x431c('0x11b')](db[_0x431c('0x87')],{'through':_0x431c('0x1bb')});db[_0x431c('0xa6')][_0x431c('0x10c')](db[_0x431c('0xa6')],{'as':'Subject','foreignKey':_0x431c('0x1b7')});db['DeskField'][_0x431c('0x10c')](db[_0x431c('0xa6')],{'as':_0x431c('0x1b8'),'foreignKey':_0x431c('0x1b2')});db[_0x431c('0xa6')][_0x431c('0x10c')](db[_0x431c('0xa6')],{'as':'Field','foreignKey':_0x431c('0x1b3')});db['DeskField']['belongsTo'](db[_0x431c('0x89')],{'as':_0x431c('0x89'),'foreignKey':_0x431c('0x1ba')});db['ZohoAccount'][_0x431c('0x10c')](db[_0x431c('0x1bc')],{'as':_0x431c('0x1af'),'onDelete':'cascade','foreignKey':_0x431c('0x1b5')});db[_0x431c('0x1bc')]['hasMany'](db[_0x431c('0xab')],{'as':_0x431c('0x1b0'),'onDelete':'cascade','foreignKey':_0x431c('0x1b7')});db[_0x431c('0x1bc')][_0x431c('0x10c')](db['ZohoField'],{'as':_0x431c('0x1b1'),'onDelete':'cascade','foreignKey':_0x431c('0x1b2')});db['ZohoConfiguration'][_0x431c('0x10c')](db[_0x431c('0xab')],{'as':_0x431c('0x1ac'),'onDelete':_0x431c('0x107'),'foreignKey':'FieldId'});db['ZohoConfiguration']['belongsTo'](db[_0x431c('0xa8')],{'as':_0x431c('0x168'),'foreignKey':_0x431c('0x1b5')});db[_0x431c('0xab')][_0x431c('0x10c')](db[_0x431c('0xab')],{'as':_0x431c('0x1b6'),'foreignKey':'SubjectId'});db[_0x431c('0xab')]['hasMany'](db['ZohoField'],{'as':_0x431c('0x1b8'),'foreignKey':_0x431c('0x1b2')});db['ZohoField'][_0x431c('0x10c')](db[_0x431c('0xab')],{'as':_0x431c('0x1b9'),'foreignKey':_0x431c('0x1b3')});db['ZohoField'][_0x431c('0x118')](db[_0x431c('0x89')],{'as':'Variable','foreignKey':_0x431c('0x1ba')});db[_0x431c('0xad')]['hasMany'](db[_0x431c('0x1bd')],{'as':_0x431c('0x1af'),'onDelete':'cascade','foreignKey':_0x431c('0x1b5')});db['ZendeskConfiguration'][_0x431c('0x10c')](db[_0x431c('0xaf')],{'as':_0x431c('0x1b0'),'foreignKey':_0x431c('0x1b7')});db[_0x431c('0x1bd')][_0x431c('0x10c')](db['ZendeskField'],{'as':'Descriptions','foreignKey':_0x431c('0x1b2')});db[_0x431c('0x1bd')]['hasMany'](db[_0x431c('0xaf')],{'as':_0x431c('0x1ac'),'foreignKey':_0x431c('0x1b3')});db[_0x431c('0x1bd')][_0x431c('0x118')](db['ZendeskAccount'],{'as':_0x431c('0x168'),'foreignKey':_0x431c('0x1b5')});db[_0x431c('0x1bd')][_0x431c('0x11b')](db[_0x431c('0x87')],{'through':_0x431c('0x1be')});db[_0x431c('0xaf')]['hasMany'](db[_0x431c('0xaf')],{'as':_0x431c('0x1b6'),'foreignKey':'SubjectId'});db['ZendeskField'][_0x431c('0x10c')](db[_0x431c('0xaf')],{'as':_0x431c('0x1b8'),'foreignKey':_0x431c('0x1b2')});db[_0x431c('0xaf')]['hasMany'](db['ZendeskField'],{'as':_0x431c('0x1b9'),'foreignKey':_0x431c('0x1b3')});db[_0x431c('0xaf')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x431c('0x1ba')});db[_0x431c('0xb1')][_0x431c('0x10c')](db[_0x431c('0xb3')],{'as':_0x431c('0x1af'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x431c('0xb3')][_0x431c('0x10c')](db['FreshdeskField'],{'as':_0x431c('0x1b0'),'onDelete':_0x431c('0x107'),'foreignKey':_0x431c('0x1b7')});db['FreshdeskConfiguration'][_0x431c('0x10c')](db[_0x431c('0xb4')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x431c('0x1b2')});db[_0x431c('0xb3')][_0x431c('0x10c')](db[_0x431c('0xb4')],{'as':'Fields','onDelete':_0x431c('0x107'),'foreignKey':'FieldId'});db[_0x431c('0xb3')][_0x431c('0x118')](db[_0x431c('0xb1')],{'as':'Account','foreignKey':_0x431c('0x1b5')});db[_0x431c('0xb3')][_0x431c('0x11b')](db['Tag'],{'through':_0x431c('0x1bf')});db[_0x431c('0xb4')][_0x431c('0x10c')](db['FreshdeskField'],{'as':_0x431c('0x1b6'),'foreignKey':_0x431c('0x1b7')});db[_0x431c('0xb4')][_0x431c('0x10c')](db[_0x431c('0xb4')],{'as':_0x431c('0x1b8'),'foreignKey':_0x431c('0x1b2')});db[_0x431c('0xb4')]['hasMany'](db[_0x431c('0xb4')],{'as':'Field','foreignKey':'FieldId'});db[_0x431c('0xb4')][_0x431c('0x118')](db[_0x431c('0x89')],{'as':_0x431c('0x89'),'foreignKey':_0x431c('0x1ba')});db[_0x431c('0xb6')][_0x431c('0x10c')](db[_0x431c('0x1c0')],{'as':_0x431c('0x1af'),'onDelete':_0x431c('0x107'),'foreignKey':_0x431c('0x1b5')});db['VtigerConfiguration'][_0x431c('0x10c')](db['VtigerField'],{'as':'Subjects','foreignKey':_0x431c('0x1b7')});db[_0x431c('0x1c0')][_0x431c('0x10c')](db[_0x431c('0x1c1')],{'as':_0x431c('0x1b1'),'foreignKey':_0x431c('0x1b2')});db[_0x431c('0x1c0')]['hasMany'](db[_0x431c('0x1c1')],{'as':_0x431c('0x1ac'),'foreignKey':'FieldId'});db[_0x431c('0x1c0')]['belongsTo'](db[_0x431c('0xb6')],{'as':_0x431c('0x168'),'foreignKey':_0x431c('0x1b5')});db['VtigerField'][_0x431c('0x10c')](db[_0x431c('0x1c1')],{'as':'Subject','foreignKey':_0x431c('0x1b7')});db[_0x431c('0x1c1')][_0x431c('0x10c')](db[_0x431c('0x1c1')],{'as':'Description','foreignKey':_0x431c('0x1b2')});db[_0x431c('0x1c1')][_0x431c('0x10c')](db[_0x431c('0x1c1')],{'as':_0x431c('0x1b9'),'foreignKey':_0x431c('0x1b3')});db[_0x431c('0x1c1')][_0x431c('0x118')](db['Variable'],{'as':_0x431c('0x89'),'foreignKey':_0x431c('0x1ba')});db[_0x431c('0xb9')][_0x431c('0x10c')](db[_0x431c('0xbb')],{'as':_0x431c('0x1af'),'onDelete':_0x431c('0x107'),'foreignKey':_0x431c('0x1b5')});db[_0x431c('0xbb')][_0x431c('0x10c')](db[_0x431c('0x1c2')],{'as':_0x431c('0x1b0'),'foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0x431c('0x10c')](db[_0x431c('0x1c2')],{'as':_0x431c('0x1b1'),'foreignKey':_0x431c('0x1b2')});db[_0x431c('0xbb')][_0x431c('0x10c')](db[_0x431c('0x1c2')],{'as':_0x431c('0x1ac'),'foreignKey':'FieldId'});db[_0x431c('0xbb')][_0x431c('0x118')](db[_0x431c('0xb9')],{'as':_0x431c('0x168'),'foreignKey':_0x431c('0x1b5')});db['ServicenowField'][_0x431c('0x10c')](db['ServicenowField'],{'as':_0x431c('0x1b6'),'foreignKey':'SubjectId'});db['ServicenowField']['hasMany'](db[_0x431c('0x1c2')],{'as':'Description','foreignKey':_0x431c('0x1b2')});db[_0x431c('0x1c2')][_0x431c('0x10c')](db[_0x431c('0x1c2')],{'as':_0x431c('0x1b9'),'foreignKey':_0x431c('0x1b3')});db[_0x431c('0x1c2')][_0x431c('0x118')](db['Variable'],{'as':'Variable','foreignKey':_0x431c('0x1ba')});db[_0x431c('0x1c3')]['hasMany'](db['Dynamics365Configuration'],{'as':_0x431c('0x1af'),'onDelete':_0x431c('0x107'),'foreignKey':_0x431c('0x1b5')});db[_0x431c('0xbf')][_0x431c('0x10c')](db['Dynamics365Field'],{'as':'Subjects','onDelete':_0x431c('0x107'),'foreignKey':_0x431c('0x1b7')});db[_0x431c('0xbf')][_0x431c('0x10c')](db[_0x431c('0x1c4')],{'as':_0x431c('0x1b1'),'onDelete':_0x431c('0x107'),'foreignKey':_0x431c('0x1b2')});db[_0x431c('0xbf')][_0x431c('0x10c')](db[_0x431c('0x1c4')],{'as':_0x431c('0x1ac'),'onDelete':_0x431c('0x107'),'foreignKey':_0x431c('0x1b3')});db[_0x431c('0xbf')][_0x431c('0x118')](db[_0x431c('0x1c3')],{'as':_0x431c('0x168'),'foreignKey':'AccountId'});db['Dynamics365Field'][_0x431c('0x10c')](db[_0x431c('0x1c4')],{'as':_0x431c('0x1b6'),'foreignKey':_0x431c('0x1b7')});db['Dynamics365Field'][_0x431c('0x10c')](db[_0x431c('0x1c4')],{'as':_0x431c('0x1b8'),'foreignKey':_0x431c('0x1b2')});db['Dynamics365Field'][_0x431c('0x10c')](db['Dynamics365Field'],{'as':_0x431c('0x1b9'),'foreignKey':_0x431c('0x1b3')});db[_0x431c('0x1c4')][_0x431c('0x118')](db[_0x431c('0x89')],{'as':'Variable','foreignKey':'VariableId'});db['FreshsalesAccount'][_0x431c('0x10c')](db[_0x431c('0xc2')],{'as':_0x431c('0x1af'),'onDelete':_0x431c('0x107'),'foreignKey':'AccountId'});db['FreshsalesConfiguration'][_0x431c('0x10c')](db[_0x431c('0xc4')],{'as':_0x431c('0x1b0'),'foreignKey':_0x431c('0x1b7')});db['FreshsalesConfiguration']['hasMany'](db['FreshsalesField'],{'as':_0x431c('0x1b1'),'foreignKey':_0x431c('0x1b2')});db[_0x431c('0xc2')][_0x431c('0x10c')](db[_0x431c('0xc4')],{'as':_0x431c('0x1ac'),'foreignKey':'FieldId'});db['FreshsalesConfiguration']['belongsTo'](db[_0x431c('0xc1')],{'as':_0x431c('0x168'),'foreignKey':_0x431c('0x1b5')});db['FreshsalesField'][_0x431c('0x10c')](db[_0x431c('0xc4')],{'as':'Subject','foreignKey':_0x431c('0x1b7')});db[_0x431c('0xc4')][_0x431c('0x10c')](db[_0x431c('0xc4')],{'as':_0x431c('0x1b8'),'foreignKey':_0x431c('0x1b2')});db['FreshsalesField']['hasMany'](db['FreshsalesField'],{'as':_0x431c('0x1b9'),'foreignKey':_0x431c('0x1b3')});db['FreshsalesField'][_0x431c('0x118')](db[_0x431c('0x89')],{'as':_0x431c('0x89'),'foreignKey':'VariableId'});db[_0x431c('0xc8')][_0x431c('0x118')](db[_0x431c('0x60')],{});db[_0x431c('0xc8')][_0x431c('0x118')](db[_0x431c('0xef')],{'as':_0x431c('0x15c'),'foreignKey':_0x431c('0x15d')});db[_0x431c('0xc8')]['belongsTo'](db[_0x431c('0x6f')],{'as':_0x431c('0x153'),'foreignKey':_0x431c('0x154')});db['ChatQueueReport']['belongsTo'](db['ChatInteraction'],{});db[_0x431c('0xc8')][_0x431c('0x118')](db[_0x431c('0x65')],{});db[_0x431c('0xc8')][_0x431c('0x118')](db[_0x431c('0x12')],{});db[_0x431c('0xc8')][_0x431c('0x118')](db[_0x431c('0x188')],{});db[_0x431c('0xca')][_0x431c('0x118')](db['User'],{'onDelete':_0x431c('0x107'),'foreignKey':_0x431c('0x1c5')});db['ChatInternalMessage'][_0x431c('0x118')](db[_0x431c('0x12')],{'onDelete':_0x431c('0x107'),'foreignKey':_0x431c('0x1c6')});db[_0x431c('0xcf')][_0x431c('0x10c')](db[_0x431c('0xce')],{'foreignKey':_0x431c('0x1c7'),'onDelete':_0x431c('0x107')});db['JscriptySessionReport'][_0x431c('0x10c')](db['JscriptyAnswerReport'],{'foreignKey':_0x431c('0x1c7'),'onDelete':_0x431c('0x107')});db['SmsQueueReport'][_0x431c('0x118')](db['SmsAccount'],{});db[_0x431c('0xd0')]['belongsTo'](db[_0x431c('0xef')],{'as':'List','foreignKey':_0x431c('0x15d')});db['SmsQueueReport'][_0x431c('0x118')](db[_0x431c('0x6f')],{'as':_0x431c('0x153'),'foreignKey':_0x431c('0x154')});db['SmsQueueReport'][_0x431c('0x118')](db[_0x431c('0x51')],{});db[_0x431c('0xd0')][_0x431c('0x118')](db[_0x431c('0x53')],{});db['SmsQueueReport']['belongsTo'](db[_0x431c('0x12')],{});db[_0x431c('0xd0')]['belongsTo'](db[_0x431c('0x55')],{});db[_0x431c('0xd5')][_0x431c('0x10c')](db['JscriptySessionReport'],{'foreignKey':_0x431c('0x1c8')});db['JscriptyProject']['hasMany'](db[_0x431c('0xce')],{'foreignKey':_0x431c('0x1c8')});db[_0x431c('0xd5')]['hasMany'](db[_0x431c('0xcc')],{'foreignKey':_0x431c('0x1c8')});db[_0x431c('0xd9')]['belongsToMany'](db[_0x431c('0x12')],{'as':_0x431c('0x176'),'through':'user_has_square_projects'});db[_0x431c('0xde')][_0x431c('0x11b')](db[_0x431c('0x12')],{'as':_0x431c('0x14a'),'through':_0x431c('0x11e')});db[_0x431c('0xde')]['belongsToMany'](db[_0x431c('0x1b')],{'through':_0x431c('0x104'),'as':_0x431c('0x124')});db[_0x431c('0xde')]['belongsToMany'](db[_0x431c('0x3c')],{'through':'team_has_mail_queues','as':'MailQueues'});db[_0x431c('0xde')][_0x431c('0x11b')](db[_0x431c('0x188')],{'through':_0x431c('0x18e'),'as':_0x431c('0x1c9')});db['Team']['belongsToMany'](db['FaxQueue'],{'through':_0x431c('0x1ca'),'as':'FaxQueues'});db['Team']['belongsToMany'](db[_0x431c('0x55')],{'through':_0x431c('0x180'),'as':_0x431c('0x128')});db[_0x431c('0xde')]['belongsToMany'](db[_0x431c('0x5e')],{'through':'team_has_openchannel_queues','as':_0x431c('0x129')});db[_0x431c('0xde')][_0x431c('0x11b')](db[_0x431c('0x101')],{'through':_0x431c('0x1cb'),'as':_0x431c('0x12a')});db[_0x431c('0xe0')][_0x431c('0x10c')](db[_0x431c('0x71')],{'as':_0x431c('0x13f'),'foreignKey':_0x431c('0x198')});db['Campaign']['hasMany'](db[_0x431c('0x75')],{'as':'HopperFinals','foreignKey':_0x431c('0x198')});db[_0x431c('0xe0')]['hasMany'](db[_0x431c('0x192')],{'as':_0x431c('0x140'),'foreignKey':'CampaignId'});db[_0x431c('0xe0')][_0x431c('0x10c')](db[_0x431c('0x73')],{'as':_0x431c('0x141'),'foreignKey':_0x431c('0x198')});db[_0x431c('0xe0')][_0x431c('0x118')](db[_0x431c('0x142')],{'as':_0x431c('0x142'),'foreignKey':_0x431c('0x1cc')});db['Campaign'][_0x431c('0x118')](db[_0x431c('0x142')],{'as':'TrunkBackup','foreignKey':_0x431c('0x144')});db[_0x431c('0xe0')][_0x431c('0x118')](db[_0x431c('0x145')],{'as':_0x431c('0x145'),'foreignKey':_0x431c('0x146')});db[_0x431c('0xe0')][_0x431c('0x118')](db[_0x431c('0xd9')],{'as':_0x431c('0xd9'),'foreignKey':_0x431c('0x1cd')});db[_0x431c('0xe0')]['belongsToMany'](db['CmList'],{'as':_0x431c('0x148'),'through':_0x431c('0x1ce')});db[_0x431c('0xe0')][_0x431c('0x11b')](db[_0x431c('0xef')],{'as':'BlackLists','through':_0x431c('0x1cf')});db[_0x431c('0xe3')][_0x431c('0x118')](db[_0x431c('0x16a')],{'as':_0x431c('0x16a'),'foreignKey':_0x431c('0x16b')});db[_0x431c('0xe6')][_0x431c('0x118')](db['MailMessage'],{});db[_0x431c('0xe6')][_0x431c('0x118')](db[_0x431c('0x3f')],{});db[_0x431c('0xe6')][_0x431c('0x118')](db[_0x431c('0x156')],{'foreignKey':_0x431c('0x1d0'),'as':'FromAccount'});db[_0x431c('0xe6')]['belongsTo'](db[_0x431c('0x12')],{'foreignKey':_0x431c('0x1d1'),'as':_0x431c('0x1d2')});db[_0x431c('0xe6')]['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':_0x431c('0x1d3')});db[_0x431c('0xe6')][_0x431c('0x118')](db['MailQueue'],{'foreignKey':_0x431c('0x1d4'),'as':_0x431c('0x1d5')});db['MailTransferReport']['belongsTo'](db[_0x431c('0x156')],{'foreignKey':_0x431c('0x1d6'),'as':'ToAccount'});db[_0x431c('0xe8')]['belongsTo'](db[_0x431c('0x65')],{});db[_0x431c('0xe8')]['belongsTo'](db[_0x431c('0x111')],{});db['ChatTransferReport'][_0x431c('0x118')](db[_0x431c('0x60')],{'foreignKey':_0x431c('0x1d7'),'as':'FromAccount'});db[_0x431c('0xe8')][_0x431c('0x118')](db['User'],{'foreignKey':_0x431c('0x1d1'),'as':_0x431c('0x1d2')});db[_0x431c('0xe8')][_0x431c('0x118')](db[_0x431c('0x12')],{'foreignKey':_0x431c('0x1d8'),'as':'ToAgent'});db['ChatTransferReport'][_0x431c('0x118')](db[_0x431c('0x188')],{'foreignKey':_0x431c('0x1d9'),'as':_0x431c('0x1d5')});db[_0x431c('0xe8')][_0x431c('0x118')](db[_0x431c('0x60')],{'foreignKey':_0x431c('0x1da'),'as':_0x431c('0x1db')});db[_0x431c('0xea')][_0x431c('0x118')](db['FaxMessage'],{});db[_0x431c('0xea')][_0x431c('0x118')](db['FaxInteraction'],{});db[_0x431c('0xea')][_0x431c('0x118')](db['FaxAccount'],{'foreignKey':'FromFaxAccountId','as':_0x431c('0x1dc')});db['FaxTransferReport'][_0x431c('0x118')](db[_0x431c('0x12')],{'foreignKey':'FromUserId','as':_0x431c('0x1d2')});db[_0x431c('0xea')]['belongsTo'](db[_0x431c('0x12')],{'foreignKey':_0x431c('0x1d8'),'as':'ToAgent'});db[_0x431c('0xea')]['belongsTo'](db[_0x431c('0x126')],{'foreignKey':_0x431c('0x1dd'),'as':'ToQueue'});db[_0x431c('0xea')][_0x431c('0x118')](db[_0x431c('0x48')],{'foreignKey':_0x431c('0x1de'),'as':_0x431c('0x1db')});db[_0x431c('0xeb')][_0x431c('0x118')](db[_0x431c('0x5c')],{});db['OpenchannelTransferReport'][_0x431c('0x118')](db[_0x431c('0x5a')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0x431c('0x1df'),'as':_0x431c('0x1dc')});db['OpenchannelTransferReport'][_0x431c('0x118')](db[_0x431c('0x12')],{'foreignKey':_0x431c('0x1d1'),'as':_0x431c('0x1d2')});db['OpenchannelTransferReport'][_0x431c('0x118')](db[_0x431c('0x12')],{'foreignKey':_0x431c('0x1d8'),'as':_0x431c('0x1d3')});db[_0x431c('0xeb')][_0x431c('0x118')](db[_0x431c('0x5e')],{'foreignKey':_0x431c('0x1e0'),'as':_0x431c('0x1d5')});db[_0x431c('0xeb')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0x431c('0x1e1'),'as':_0x431c('0x1db')});db['SmsTransferReport']['belongsTo'](db['SmsMessage'],{});db['SmsTransferReport'][_0x431c('0x118')](db[_0x431c('0x51')],{});db[_0x431c('0xed')][_0x431c('0x118')](db[_0x431c('0x132')],{'foreignKey':'FromSmsAccountId','as':_0x431c('0x1dc')});db[_0x431c('0xed')][_0x431c('0x118')](db[_0x431c('0x12')],{'foreignKey':_0x431c('0x1d1'),'as':_0x431c('0x1d2')});db[_0x431c('0xed')]['belongsTo'](db[_0x431c('0x12')],{'foreignKey':_0x431c('0x1d8'),'as':_0x431c('0x1d3')});db[_0x431c('0xed')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':'ToQueue'});db['SmsTransferReport'][_0x431c('0x118')](db[_0x431c('0x132')],{'foreignKey':'ToSmsAccountId','as':_0x431c('0x1db')});db[_0x431c('0xef')][_0x431c('0x10c')](db[_0x431c('0x7c')],{'as':_0x431c('0x170'),'foreignKey':_0x431c('0x15d')});db['CmList'][_0x431c('0x10c')](db[_0x431c('0x1e2')],{'as':_0x431c('0x1e3'),'foreignKey':_0x431c('0x15d')});db[_0x431c('0xef')][_0x431c('0x10c')](db['CmContact'],{'as':_0x431c('0x11c'),'onDelete':'cascade','foreignKey':_0x431c('0x15d')});db[_0x431c('0xef')]['hasMany'](db[_0x431c('0x75')],{'as':_0x431c('0x10e'),'foreignKey':_0x431c('0x15d')});db['CmList'][_0x431c('0x10c')](db[_0x431c('0x192')],{'as':_0x431c('0x10f'),'foreignKey':'ListId'});db[_0x431c('0xef')][_0x431c('0x10c')](db[_0x431c('0x76')],{'as':_0x431c('0x76'),'foreignKey':_0x431c('0x15d')});db[_0x431c('0xef')][_0x431c('0x11b')](db[_0x431c('0x1b')],{'as':_0x431c('0x1e4'),'through':'voice_queues_has_cm_lists'});db[_0x431c('0xef')][_0x431c('0x11b')](db[_0x431c('0x12')],{'as':_0x431c('0x14a'),'through':'cm_user_has_lists'});db[_0x431c('0x12b')][_0x431c('0x10c')](db[_0x431c('0x18')],{'as':_0x431c('0x10d'),'onDelete':_0x431c('0x107')});db[_0x431c('0x12b')][_0x431c('0x11b')](db['User'],{'as':_0x431c('0x14a'),'through':_0x431c('0x12c')});db[_0x431c('0xf1')][_0x431c('0x10c')](db[_0x431c('0x12')],{'as':_0x431c('0x176'),'foreignKey':_0x431c('0x119')});db[_0x431c('0xf1')][_0x431c('0x10c')](db[_0x431c('0xf3')],{'as':_0x431c('0x1e5'),'foreignKey':_0x431c('0x119'),'onDelete':_0x431c('0x107')});db['UserProfileSection'][_0x431c('0x10c')](db[_0x431c('0xf5')],{'as':_0x431c('0x1e6'),'foreignKey':_0x431c('0x1e7'),'onDelete':'cascade'});db['WhatsappAccount'][_0x431c('0x10c')](db[_0x431c('0x7c')],{'as':_0x431c('0x170'),'foreignKey':_0x431c('0x1e8')});db[_0x431c('0x134')][_0x431c('0x10c')](db['CannedAnswer'],{'as':_0x431c('0x159'),'foreignKey':'WhatsappAccountId'});db[_0x431c('0x134')][_0x431c('0x10c')](db[_0x431c('0xfc')],{'as':_0x431c('0x15a'),'foreignKey':_0x431c('0x1e8')});db[_0x431c('0x134')]['hasMany'](db[_0x431c('0xfa')],{'as':_0x431c('0x15b')});db[_0x431c('0x134')]['hasMany'](db[_0x431c('0xf9')],{'as':_0x431c('0x13a')});db[_0x431c('0x134')][_0x431c('0x118')](db['CmList'],{'as':_0x431c('0x15c'),'foreignKey':_0x431c('0x15d')});db[_0x431c('0x134')]['belongsTo'](db[_0x431c('0x7f')],{'as':_0x431c('0x160'),'foreignKey':_0x431c('0x147')});db[_0x431c('0x134')][_0x431c('0x11b')](db[_0x431c('0x12')],{'as':_0x431c('0x14a'),'through':_0x431c('0x135')});db[_0x431c('0xf9')][_0x431c('0x118')](db['User'],{'onDelete':_0x431c('0x16c')});db[_0x431c('0xf9')]['belongsTo'](db['WhatsappQueue'],{'onDelete':'restrict'});db[_0x431c('0xf9')][_0x431c('0x118')](db[_0x431c('0x134')],{'onDelete':_0x431c('0x16c')});db[_0x431c('0xf9')][_0x431c('0x118')](db[_0x431c('0x145')],{'onDelete':_0x431c('0x16c'),'foreignKey':_0x431c('0x146')});db[_0x431c('0xf9')][_0x431c('0x118')](db[_0x431c('0x87')],{'onDelete':_0x431c('0x16c'),'foreignKey':_0x431c('0x16d')});db[_0x431c('0xfa')][_0x431c('0x10c')](db[_0x431c('0xfc')],{'as':_0x431c('0x15a'),'onDelete':_0x431c('0x107'),'foreignKey':_0x431c('0x1e9')});db['WhatsappInteraction']['belongsTo'](db[_0x431c('0x134')],{'as':_0x431c('0x168'),'foreignKey':_0x431c('0x1e8')});db[_0x431c('0xfa')][_0x431c('0x118')](db[_0x431c('0x6f')],{'as':_0x431c('0x153'),'foreignKey':_0x431c('0x154')});db[_0x431c('0xfa')][_0x431c('0x118')](db[_0x431c('0x12')],{'as':_0x431c('0x163'),'foreignKey':_0x431c('0x10b')});db[_0x431c('0xfa')]['belongsToMany'](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0x431c('0x165')});db[_0x431c('0xfa')]['belongsToMany'](db[_0x431c('0x87')],{'through':_0x431c('0x1a3'),'as':_0x431c('0x166')});db[_0x431c('0xfa')][_0x431c('0x11b')](db[_0x431c('0x12')],{'as':_0x431c('0x176'),'through':_0x431c('0x123'),'foreignKey':_0x431c('0x1e9')});db[_0x431c('0xfc')]['belongsTo'](db[_0x431c('0x12')],{'as':_0x431c('0x12')});db['WhatsappMessage'][_0x431c('0x118')](db[_0x431c('0x6f')],{'onDelete':_0x431c('0x107'),'as':_0x431c('0x153')});db[_0x431c('0xfc')][_0x431c('0x118')](db[_0x431c('0xfa')],{'onDelete':_0x431c('0x107'),'as':_0x431c('0x167'),'foreignKey':_0x431c('0x1e9')});db[_0x431c('0xfc')]['belongsTo'](db[_0x431c('0x134')],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0x431c('0xfe')][_0x431c('0x118')](db[_0x431c('0x134')],{});db['WhatsappQueueReport'][_0x431c('0x118')](db[_0x431c('0xef')],{'as':_0x431c('0x15c'),'foreignKey':_0x431c('0x15d')});db[_0x431c('0xfe')][_0x431c('0x118')](db['CmContact'],{'as':_0x431c('0x153'),'foreignKey':_0x431c('0x154')});db[_0x431c('0xfe')][_0x431c('0x118')](db[_0x431c('0xfa')],{});db['WhatsappQueueReport'][_0x431c('0x118')](db[_0x431c('0x101')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x431c('0xfc')],{});db['WhatsappQueueReport'][_0x431c('0x118')](db['User'],{});db['WhatsappTransferReport'][_0x431c('0x118')](db['WhatsappMessage'],{});db[_0x431c('0x100')]['belongsTo'](db[_0x431c('0xfa')],{});db[_0x431c('0x100')][_0x431c('0x118')](db[_0x431c('0x134')],{'foreignKey':'FromWhatsappAccountId','as':_0x431c('0x1dc')});db['WhatsappTransferReport']['belongsTo'](db[_0x431c('0x134')],{'foreignKey':_0x431c('0x1ea'),'as':'ToAccount'});db[_0x431c('0x100')][_0x431c('0x118')](db['WhatsappQueue'],{'foreignKey':_0x431c('0x1eb'),'as':_0x431c('0x1d5')});db[_0x431c('0x100')][_0x431c('0x118')](db[_0x431c('0x12')],{'foreignKey':_0x431c('0x1d1'),'as':_0x431c('0x1d2')});db[_0x431c('0x100')][_0x431c('0x118')](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x431c('0x101')][_0x431c('0x11b')](db[_0x431c('0x12')],{'as':'Agents','through':_0x431c('0x37'),'foreignKey':_0x431c('0x1ec')});db['WhatsappQueue'][_0x431c('0x11b')](db[_0x431c('0xde')],{'through':_0x431c('0x1cb'),'as':_0x431c('0x14b')});module[_0x431c('0x1ed')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x89b3=['FaxAccounts','user_has_fax_accounts','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sound','Sounds','moh_has_sounds','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','Trunk','TrunkId','TrunkBackup','TrunkBackupId','Pause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','MailAccountId','Dispositions','Answers','Interactions','List','ListId','mandatoryDispositionPause','user_has_mail_accounts','UserMailQueue','Team','team_has_mail_queues','Teams','MailMessage','MailInteractionId','CmContact','Owner','Tag','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Account','ChatOfflineMessageId','restrict','MailApplication','IntervalId','TagId','MailQueueReport','ContactId','Items','FaxAccount','FaxAccountId','Exntensions','Messages','fax_interaction_has_tags','user_has_fax_interactions','FaxInteractionId','AttachmentId','FaxQueueReport','SmsAccountId','SmsMessage','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','Interaction','team_has_chat_queues','ChatGroupId','Members','chat_group_has_users','CmCompany','CompanyId','Hoppers','CmHopperFinal','cm_contact_has_tags','OwnerId','CampaignId','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','Extensions','MailApplications','ChatApplications','FaxApplications','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyCondition','Fields','AnalyticDefaultReport','DefaultReportId','AnalyticMetric','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','Subject','Description','Field','Variable','VariableId','SugarcrmConfiguration','FieldId','DeskAccount','int_desk_configuration_has_tags','ZohoConfiguration','ZohoField','FreshdeskAccount','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowAccount','ServicenowField','Dynamics365Account','Dynamics365Configuration','FreshsalesConfiguration','FreshsalesField','FreshsalesAccount','ChatQueueReport','FromId','ToId','SessionId','ProjectId','JscriptyAnswerReport','team_has_fax_queues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ToAgent','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','user_has_voice_prefixes','UserProfileSection','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','user_has_whatsapp_interactions','WhatsappQueueReport','WhatsappTransferReport','ToWhatsappAccountId','ToQueueId','UserWhatsappQueue','WhatsappQueueId','exports','path','../config/environment','sequelize','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8_general_ci','sequelizeHistory','name','utf8','username','password','database','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/memberReport/memberReport.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','Automation','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','cascade','hasMany','Recordings','UserId','HopperFinals','CmHopperHistory','HopperHistory','ChatInteractions','SmsInteraction','SmsInteractions','MailInteractions','WhatsappInteractions','UserNotifications','belongsTo','userProfileId','ChatGroup','Groups','Contacts','cm_user_has_contacts','belongsToMany','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','FaxInteractions','OpenchannelInteraction','OpenchannelInteractions','user_has_openchannel_interactions','VoiceQueues','MailQueues','ChatQueues','FaxQueues','UserFaxQueue','SmsQueue','SmsQueues','UserSmsQueue','WhatsappQueues','CmList','VoicePrefixes','user_has_chat_websites'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x89b3,0xd1));var _0x389b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x89b3[_0x122ef9];return _0x42fba0;};'use strict';var path=require(_0x389b('0x0'));var config=require(_0x389b('0x1'));var Sequelize=require(_0x389b('0x2'));var _=require('lodash');var jstz=require(_0x389b('0x3'));var timezone=jstz[_0x389b('0x4')]();config['sequelize']=_[_0x389b('0x5')](config[_0x389b('0x2')],{'database':_0x389b('0x6'),'username':_0x389b('0x7'),'password':_0x389b('0x8'),'options':{'host':_0x389b('0x9'),'port':0xcea,'dialect':_0x389b('0xa'),'dialectOptions':{'charset':_0x389b('0xb')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x389b('0xc')}}});config[_0x389b('0xd')]=_[_0x389b('0x5')](config[_0x389b('0xd')],{'database':'motion2','username':_0x389b('0x7'),'password':_0x389b('0x8'),'options':{'host':_0x389b('0x9'),'port':0xcea,'dialect':_0x389b('0xa'),'dialectOptions':{'charset':_0x389b('0xb')},'logging':![],'timezone':timezone[_0x389b('0xe')](),'define':{'charset':_0x389b('0xf'),'collate':_0x389b('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x389b('0x2')][_0x389b('0x10')],config[_0x389b('0x2')][_0x389b('0x11')],config['sequelize']['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x389b('0x12')],config['sequelizeHistory'][_0x389b('0x10')],config['sequelizeHistory'][_0x389b('0x11')],config['sequelizeHistory'][_0x389b('0x13')])};db[_0x389b('0x14')]=db['sequelize'][_0x389b('0x15')](_0x389b('0x16'));db[_0x389b('0x17')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x18'));db[_0x389b('0x19')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x1a'));db[_0x389b('0x1b')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x1c'));db[_0x389b('0x1d')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x1e'));db[_0x389b('0x1f')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x20'));db[_0x389b('0x21')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x22'));db[_0x389b('0x23')]=db[_0x389b('0x2')]['import'](_0x389b('0x24'));db[_0x389b('0x25')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x26'));db[_0x389b('0x27')]=db['sequelize'][_0x389b('0x15')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x389b('0x28')]=db['sequelize'][_0x389b('0x15')](_0x389b('0x29'));db[_0x389b('0x2a')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x2b'));db[_0x389b('0x2c')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x2d'));db[_0x389b('0x2e')]=db[_0x389b('0x2')][_0x389b('0x15')]('../api/voiceQueueReport/voiceQueueReport.model');db['MemberReport']=db['sequelize'][_0x389b('0x15')](_0x389b('0x2f'));db['Trunk']=db['sequelize'][_0x389b('0x15')]('../api/trunk/trunk.model');db[_0x389b('0x30')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x31'));db[_0x389b('0x32')]=db[_0x389b('0x2')]['import'](_0x389b('0x33'));db[_0x389b('0x34')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x35'));db[_0x389b('0x36')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x37'));db['UserMailQueue']=db['sequelize'][_0x389b('0x15')](_0x389b('0x38'));db['UserFaxQueue']=db[_0x389b('0x2')]['import'](_0x389b('0x39'));db['UserSmsQueue']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x3a'));db[_0x389b('0x3b')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x3c'));db['UserWhatsappQueue']=db[_0x389b('0x2')][_0x389b('0x15')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x389b('0x3d')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x3e'));db[_0x389b('0x3f')]=db['sequelize']['import'](_0x389b('0x40'));db[_0x389b('0x41')]=db['sequelize'][_0x389b('0x15')](_0x389b('0x42'));db[_0x389b('0x43')]=db['sequelize'][_0x389b('0x15')]('../api/mailQueue/mailQueue.model');db[_0x389b('0x44')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x45'));db[_0x389b('0x46')]=db[_0x389b('0x2')]['import'](_0x389b('0x47'));db['MailMessage']=db['sequelize'][_0x389b('0x15')](_0x389b('0x48'));db['MailApplication']=db[_0x389b('0x2')]['import'](_0x389b('0x49'));db['MailQueueReport']=db[_0x389b('0x2')]['import'](_0x389b('0x4a'));db['Dashboard']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x4b'));db[_0x389b('0x4c')]=db[_0x389b('0x2')][_0x389b('0x15')]('../api/dashboardItem/dashboardItem.model');db['FaxAccount']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x4d'));db[_0x389b('0x4e')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x4f'));db[_0x389b('0x50')]=db[_0x389b('0x2')]['import']('../api/faxInteraction/faxInteraction.model');db[_0x389b('0x51')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x52'));db[_0x389b('0x53')]=db['sequelize'][_0x389b('0x15')](_0x389b('0x54'));db['FaxQueueReport']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x55'));db[_0x389b('0x56')]=db['sequelize'][_0x389b('0x15')]('../api/smsAccount/smsAccount.model');db[_0x389b('0x57')]=db['sequelize'][_0x389b('0x15')](_0x389b('0x58'));db['SmsInteraction']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x59'));db['SmsMessage']=db['sequelize'][_0x389b('0x15')]('../api/smsMessage/smsMessage.model');db['SmsQueue']=db['sequelize']['import'](_0x389b('0x5a'));db[_0x389b('0x5b')]=db[_0x389b('0x2')][_0x389b('0x15')]('../api/openchannelAccount/openchannelAccount.model');db[_0x389b('0x5c')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x5d'));db['OpenchannelInteraction']=db[_0x389b('0x2')][_0x389b('0x15')]('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db['sequelize'][_0x389b('0x15')](_0x389b('0x5e'));db[_0x389b('0x5f')]=db['sequelize']['import'](_0x389b('0x60'));db[_0x389b('0x61')]=db[_0x389b('0x2')]['import'](_0x389b('0x62'));db[_0x389b('0x63')]=db['sequelize'][_0x389b('0x15')](_0x389b('0x64'));db[_0x389b('0x65')]=db[_0x389b('0x2')][_0x389b('0x15')]('../api/chatApplication/chatApplication.model');db[_0x389b('0x66')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x67'));db[_0x389b('0x68')]=db[_0x389b('0x2')]['import'](_0x389b('0x69'));db[_0x389b('0x6a')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x6b'));db[_0x389b('0x6c')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x6d'));db['ChatGroup']=db[_0x389b('0x2')]['import'](_0x389b('0x6e'));db[_0x389b('0x6f')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x70'));db['CmCompany']=db[_0x389b('0x2')]['import'](_0x389b('0x71'));db['CmContact']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x72'));db[_0x389b('0x73')]=db[_0x389b('0x2')]['import']('../api/cmHopper/cmHopper.model');db[_0x389b('0x74')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x75'));db['CmHopperFinal']=db[_0x389b('0x2')][_0x389b('0x15')]('../api/cmHopperFinal/cmHopperFinal.model');db['CmHopperHistory']=db['sequelize'][_0x389b('0x15')](_0x389b('0x76'));db[_0x389b('0x77')]=db['sequelize'][_0x389b('0x15')](_0x389b('0x78'));db[_0x389b('0x79')]=db[_0x389b('0x2')]['import']('../api/cmCustomField/cmCustomField.model');db[_0x389b('0x7a')]=db[_0x389b('0x2')]['import']('../api/action/action.model');db[_0x389b('0x7b')]=db[_0x389b('0x2')]['import'](_0x389b('0x7c'));db[_0x389b('0x7d')]=db[_0x389b('0x2')][_0x389b('0x15')]('../api/cannedAnswer/cannedAnswer.model');db[_0x389b('0x7e')]=db[_0x389b('0x2')]['import'](_0x389b('0x7f'));db[_0x389b('0x80')]=db[_0x389b('0x2')]['import'](_0x389b('0x81'));db[_0x389b('0x82')]=db['sequelize']['import'](_0x389b('0x83'));db['Pause']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x84'));db[_0x389b('0x85')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x86'));db[_0x389b('0x87')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x88'));db[_0x389b('0x89')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x8a'));db['Sound']=db[_0x389b('0x2')][_0x389b('0x15')]('../api/sound/sound.model');db['Tag']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x8b'));db[_0x389b('0x8c')]=db['sequelize'][_0x389b('0x15')](_0x389b('0x8d'));db[_0x389b('0x8e')]=db['sequelize'][_0x389b('0x15')](_0x389b('0x8f'));db['Variable']=db['sequelize'][_0x389b('0x15')](_0x389b('0x90'));db[_0x389b('0x91')]=db['sequelize'][_0x389b('0x15')](_0x389b('0x92'));db[_0x389b('0x93')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x94'));db[_0x389b('0x95')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x96'));db['AnalyticDefaultReport']=db['sequelize']['import'](_0x389b('0x97'));db[_0x389b('0x98')]=db[_0x389b('0x2')][_0x389b('0x15')]('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db[_0x389b('0x2')][_0x389b('0x15')]('../api/analyticMetric/analyticMetric.model');db[_0x389b('0x99')]=db[_0x389b('0x2')]['import'](_0x389b('0x9a'));db[_0x389b('0x9b')]=db['sequelize'][_0x389b('0x15')](_0x389b('0x9c'));db[_0x389b('0x9d')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x9e'));db[_0x389b('0x9f')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xa0'));db[_0x389b('0xa1')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xa2'));db[_0x389b('0xa3')]=db['sequelize']['import'](_0x389b('0xa4'));db['SugarcrmConfiguration']=db[_0x389b('0x2')]['import']('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x389b('0xa5')]=db['sequelize'][_0x389b('0x15')](_0x389b('0xa6'));db['DeskAccount']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xa7'));db[_0x389b('0xa8')]=db[_0x389b('0x2')]['import'](_0x389b('0xa9'));db[_0x389b('0xaa')]=db['sequelize'][_0x389b('0x15')]('../api/intDeskField/intDeskField.model');db[_0x389b('0xab')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xac'));db['ZohoConfiguration']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xad'));db['ZohoField']=db['sequelize'][_0x389b('0x15')](_0x389b('0xae'));db[_0x389b('0xaf')]=db[_0x389b('0x2')]['import'](_0x389b('0xb0'));db[_0x389b('0xb1')]=db[_0x389b('0x2')][_0x389b('0x15')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x389b('0xb2')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xb3'));db['FreshdeskAccount']=db[_0x389b('0x2')]['import'](_0x389b('0xb4'));db[_0x389b('0xb5')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xb6'));db['FreshdeskField']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xb7'));db['VtigerAccount']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xb8'));db['VtigerConfiguration']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xb9'));db[_0x389b('0xba')]=db[_0x389b('0x2')]['import'](_0x389b('0xbb'));db['ServicenowAccount']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xbc'));db[_0x389b('0xbd')]=db[_0x389b('0x2')][_0x389b('0x15')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db['ServicenowField']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xbe'));db['Dynamics365Account']=db['sequelize'][_0x389b('0x15')]('../api/intDynamics365Account/intDynamics365Account.model');db['Dynamics365Configuration']=db['sequelize'][_0x389b('0x15')](_0x389b('0xbf'));db[_0x389b('0xc0')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xc1'));db['FreshsalesAccount']=db[_0x389b('0x2')][_0x389b('0x15')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db['FreshsalesConfiguration']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xc2'));db['FreshsalesField']=db[_0x389b('0x2')][_0x389b('0x15')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x389b('0x91')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x92'));db[_0x389b('0xc3')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xc4'));db['ChatQueueReport']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xc5'));db[_0x389b('0xc6')]=db['sequelize'][_0x389b('0x15')](_0x389b('0xc7'));db['JscriptyAnswerReport']=db['sequelize'][_0x389b('0x15')](_0x389b('0xc8'));db[_0x389b('0xc9')]=db['sequelize'][_0x389b('0x15')](_0x389b('0xca'));db[_0x389b('0xcb')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xcc'));db[_0x389b('0xcd')]=db['sequelize'][_0x389b('0x15')]('../api/smsQueueReport/smsQueueReport.model');db[_0x389b('0xce')]=db['sequelize'][_0x389b('0x15')](_0x389b('0xcf'));db[_0x389b('0xd0')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xd1'));db[_0x389b('0xd2')]=db['sequelize']['import'](_0x389b('0xd3'));db[_0x389b('0xd4')]=db['sequelize']['import'](_0x389b('0xd5'));db[_0x389b('0xd6')]=db['sequelize']['import'](_0x389b('0xd7'));db[_0x389b('0xd8')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xd9'));db['SquareRecording']=db[_0x389b('0x2')]['import'](_0x389b('0xda'));db[_0x389b('0xdb')]=db['sequelize'][_0x389b('0x15')](_0x389b('0xdc'));db['Team']=db[_0x389b('0x2')]['import'](_0x389b('0xdd'));db['License']=db[_0x389b('0x2')][_0x389b('0x15')]('../api/license/license.model');db[_0x389b('0xde')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xdf'));db[_0x389b('0xe0')]=db['sequelize'][_0x389b('0x15')](_0x389b('0xe1'));db[_0x389b('0xe2')]=db['sequelize'][_0x389b('0x15')]('../api/attachment/attachment.model');db['Plugin']=db[_0x389b('0x2')]['import'](_0x389b('0xe3'));db[_0x389b('0xe4')]=db['sequelize']['import'](_0x389b('0xe5'));db[_0x389b('0xe6')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xe7'));db['FaxTransferReport']=db[_0x389b('0x2')]['import'](_0x389b('0xe8'));db['OpenchannelTransferReport']=db[_0x389b('0x2')]['import'](_0x389b('0xe9'));db[_0x389b('0xea')]=db['sequelize']['import'](_0x389b('0xeb'));db['CmList']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xec'));db[_0x389b('0xed')]=db[_0x389b('0x2')][_0x389b('0x15')]('../api/voicePrefix/voicePrefix.model');db[_0x389b('0xee')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xef'));db['UserProfileSection']=db[_0x389b('0x2')]['import'](_0x389b('0xf0'));db['UserProfileResource']=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xf1'));db[_0x389b('0xf2')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xf3'));db[_0x389b('0xf4')]=db[_0x389b('0x2')][_0x389b('0x15')]('../api/whatsappAccount/whatsappAccount.model');db[_0x389b('0xf5')]=db[_0x389b('0x2')]['import'](_0x389b('0xf6'));db[_0x389b('0xf7')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xf8'));db['WhatsappMessage']=db[_0x389b('0x2')]['import']('../api/whatsappMessage/whatsappMessage.model');db['WhatsappQueueReport']=db[_0x389b('0x2')]['import'](_0x389b('0xf9'));db['WhatsappTransferReport']=db['sequelize'][_0x389b('0x15')](_0x389b('0xfa'));db[_0x389b('0xfb')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xfc'));db[_0x389b('0xfd')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0xfe'));db[_0x389b('0xff')]=db[_0x389b('0x2')][_0x389b('0x15')](_0x389b('0x100'));db['User'][_0x389b('0x101')](db[_0x389b('0x25')],{'as':_0x389b('0x25'),'onDelete':_0x389b('0x102'),'foreignKey':'UserId'});db[_0x389b('0x14')][_0x389b('0x103')](db[_0x389b('0x21')],{'as':_0x389b('0x104'),'foreignKey':_0x389b('0x105')});db[_0x389b('0x14')][_0x389b('0x103')](db[_0x389b('0x32')],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db[_0x389b('0x14')][_0x389b('0x103')](db['VoiceExtension'],{'as':'Extensions','onDelete':'cascade','hooks':!![]});db[_0x389b('0x14')][_0x389b('0x103')](db['CmHopperFinal'],{'as':_0x389b('0x106'),'foreignKey':_0x389b('0x105')});db['User'][_0x389b('0x103')](db[_0x389b('0x107')],{'as':_0x389b('0x108'),'foreignKey':_0x389b('0x105')});db['User'][_0x389b('0x103')](db['ReportAgentPreview'],{'as':_0x389b('0x77'),'foreignKey':_0x389b('0x105')});db[_0x389b('0x14')][_0x389b('0x103')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0x389b('0x105')});db['User'][_0x389b('0x103')](db['ChatInteraction'],{'as':_0x389b('0x109'),'foreignKey':_0x389b('0x105')});db[_0x389b('0x14')][_0x389b('0x103')](db[_0x389b('0x10a')],{'as':_0x389b('0x10b'),'foreignKey':'UserId'});db[_0x389b('0x14')][_0x389b('0x103')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':_0x389b('0x105')});db[_0x389b('0x14')]['hasMany'](db[_0x389b('0x46')],{'as':_0x389b('0x10c'),'foreignKey':_0x389b('0x105')});db[_0x389b('0x14')]['hasMany'](db[_0x389b('0xf7')],{'as':_0x389b('0x10d'),'foreignKey':_0x389b('0x105')});db['User'][_0x389b('0x103')](db[_0x389b('0xf2')],{'as':_0x389b('0x10e'),'foreignKey':'SenderId'});db[_0x389b('0x14')][_0x389b('0x10f')](db['UserProfile'],{'as':_0x389b('0xee'),'foreignKey':_0x389b('0x110')});db[_0x389b('0x14')]['belongsToMany'](db[_0x389b('0x111')],{'as':_0x389b('0x112'),'through':'chat_group_has_users'});db[_0x389b('0x14')]['belongsToMany'](db['CmContact'],{'as':_0x389b('0x113'),'through':_0x389b('0x114')});db[_0x389b('0x14')][_0x389b('0x115')](db['CmList'],{'as':_0x389b('0x116'),'through':_0x389b('0x117')});db[_0x389b('0x14')][_0x389b('0x115')](db['Team'],{'through':_0x389b('0x118')});db[_0x389b('0x14')][_0x389b('0x115')](db['MailInteraction'],{'as':'MailInteractions','through':_0x389b('0x119')});db[_0x389b('0x14')]['belongsToMany'](db[_0x389b('0x66')],{'as':_0x389b('0x109'),'through':'user_has_chat_interactions'});db[_0x389b('0x14')][_0x389b('0x115')](db[_0x389b('0x50')],{'as':_0x389b('0x11a'),'through':'user_has_fax_interactions'});db[_0x389b('0x14')][_0x389b('0x115')](db['SmsInteraction'],{'as':'SmsInteractions','through':'user_has_sms_interactions'});db[_0x389b('0x14')]['belongsToMany'](db[_0x389b('0x11b')],{'as':_0x389b('0x11c'),'through':_0x389b('0x11d')});db[_0x389b('0x14')][_0x389b('0x115')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db['User']['belongsToMany'](db[_0x389b('0x1f')],{'as':_0x389b('0x11e'),'through':_0x389b('0x34'),'required':![]});db['User'][_0x389b('0x115')](db['MailQueue'],{'as':_0x389b('0x11f'),'through':'UserMailQueue','required':![]});db[_0x389b('0x14')]['belongsToMany'](db[_0x389b('0x6c')],{'as':_0x389b('0x120'),'through':'UserChatQueue','required':![],'hooks':!![]});db['User'][_0x389b('0x115')](db[_0x389b('0x53')],{'as':_0x389b('0x121'),'through':_0x389b('0x122'),'required':![]});db['User'][_0x389b('0x115')](db[_0x389b('0x123')],{'as':_0x389b('0x124'),'through':_0x389b('0x125'),'required':![]});db[_0x389b('0x14')][_0x389b('0x115')](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':_0x389b('0x3b'),'required':![]});db[_0x389b('0x14')][_0x389b('0x115')](db[_0x389b('0xfb')],{'as':_0x389b('0x126'),'through':'UserWhatsappQueue','required':![]});db[_0x389b('0x14')]['belongsToMany'](db[_0x389b('0x127')],{'through':_0x389b('0x117')});db['User'][_0x389b('0x115')](db[_0x389b('0xed')],{'as':_0x389b('0x128'),'through':'user_has_voice_prefixes','required':![]});db['User'][_0x389b('0x115')](db[_0x389b('0x61')],{'as':'ChatWebsites','through':_0x389b('0x129')});db[_0x389b('0x14')][_0x389b('0x115')](db['FaxAccount'],{'as':_0x389b('0x12a'),'through':_0x389b('0x12b')});db[_0x389b('0x14')][_0x389b('0x115')](db[_0x389b('0x41')],{'as':_0x389b('0x12c'),'through':'user_has_mail_accounts'});db['User'][_0x389b('0x115')](db[_0x389b('0x5b')],{'as':_0x389b('0x12d'),'through':_0x389b('0x12e')});db[_0x389b('0x14')][_0x389b('0x115')](db[_0x389b('0x56')],{'as':_0x389b('0x12f'),'through':_0x389b('0x130')});db['User'][_0x389b('0x115')](db[_0x389b('0xf4')],{'as':'WhatsappAccounts','through':_0x389b('0x131')});db[_0x389b('0x14')]['belongsToMany'](db[_0x389b('0xd8')],{'as':_0x389b('0x132'),'through':_0x389b('0x133')});db[_0x389b('0x17')][_0x389b('0x103')](db['VoiceExtension'],{'as':_0x389b('0x134'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x135')});db[_0x389b('0x19')][_0x389b('0x103')](db[_0x389b('0x1b')],{'onDelete':'cascade'});db['VoiceExtension'][_0x389b('0x103')](db[_0x389b('0x1b')],{'as':_0x389b('0x136'),'onDelete':_0x389b('0x102')});db[_0x389b('0x1d')]['belongsToMany'](db[_0x389b('0x137')],{'as':_0x389b('0x138'),'through':_0x389b('0x139')});db[_0x389b('0x1f')]['hasMany'](db[_0x389b('0x32')],{'as':'Members','foreignKey':'VoiceQueueId'});db[_0x389b('0x1f')]['hasMany'](db[_0x389b('0x73')],{'as':'Hoppers','foreignKey':_0x389b('0x13a')});db[_0x389b('0x1f')][_0x389b('0x103')](db['CmHopperFinal'],{'as':_0x389b('0x106'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x389b('0x103')](db[_0x389b('0x107')],{'as':_0x389b('0x13b'),'foreignKey':_0x389b('0x13a')});db[_0x389b('0x1f')][_0x389b('0x103')](db['ReportAgentPreview'],{'as':_0x389b('0x77'),'foreignKey':_0x389b('0x13a')});db[_0x389b('0x1f')][_0x389b('0x103')](db[_0x389b('0x74')],{'as':_0x389b('0x13c'),'foreignKey':_0x389b('0x13a')});db[_0x389b('0x1f')]['hasMany'](db[_0x389b('0xcb')],{'as':_0x389b('0x13d'),'foreignKey':_0x389b('0x13a')});db['VoiceQueue'][_0x389b('0x10f')](db[_0x389b('0x13e')],{'as':_0x389b('0x13e'),'foreignKey':_0x389b('0x13f')});db['VoiceQueue']['belongsTo'](db[_0x389b('0x13e')],{'as':_0x389b('0x140'),'foreignKey':_0x389b('0x141')});db[_0x389b('0x1f')][_0x389b('0x10f')](db['Interval'],{'as':'Interval','foreignKey':'IntervalId'});db[_0x389b('0x1f')][_0x389b('0x10f')](db[_0x389b('0x142')],{'as':'mandatoryDispositionPause','foreignKey':_0x389b('0x143')});db[_0x389b('0x1f')][_0x389b('0x115')](db[_0x389b('0x127')],{'as':_0x389b('0x116'),'through':_0x389b('0x144')});db[_0x389b('0x1f')][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x145'),'through':_0x389b('0x34')});db[_0x389b('0x1f')][_0x389b('0x115')](db['Team'],{'as':'Teams','through':_0x389b('0xff')});db['VoiceQueue']['belongsToMany'](db[_0x389b('0x127')],{'as':_0x389b('0x146'),'through':_0x389b('0x147')});db['VoiceRecording']['belongsTo'](db[_0x389b('0x14')],{'as':_0x389b('0x14'),'foreignKey':_0x389b('0x105')});db[_0x389b('0x23')]['belongsTo'](db[_0x389b('0x14')],{'as':'User','foreignKey':_0x389b('0x105')});db[_0x389b('0x25')][_0x389b('0x103')](db['VoiceMailMessage'],{'as':'Messages','onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x148'),'sourceKey':_0x389b('0x149')});db[_0x389b('0x27')][_0x389b('0x10f')](db[_0x389b('0x25')],{'foreignKey':_0x389b('0x148'),'targetKey':'mailbox'});db[_0x389b('0x28')][_0x389b('0x103')](db['VoiceQueueReport'],{'as':_0x389b('0x14a'),'foreignKey':_0x389b('0x14b'),'constraints':![]});db[_0x389b('0x28')][_0x389b('0x103')](db['VoiceAgentReport'],{'as':_0x389b('0x14c'),'foreignKey':'uniqueid','constraints':![]});db[_0x389b('0x28')][_0x389b('0x10f')](db[_0x389b('0x14')],{'as':_0x389b('0x14'),'foreignKey':_0x389b('0x105')});db[_0x389b('0x28')][_0x389b('0x10f')](db['CmContact'],{'as':_0x389b('0x14d'),'foreignKey':'ContactId'});db[_0x389b('0x3d')][_0x389b('0x10f')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0x389b('0x14e')});db[_0x389b('0x3f')][_0x389b('0x10f')](db[_0x389b('0x41')],{'as':_0x389b('0x41'),'foreignKey':'MailAccountId'});db[_0x389b('0x41')][_0x389b('0x101')](db[_0x389b('0x3d')],{'as':'Imap','onDelete':_0x389b('0x102')});db[_0x389b('0x41')][_0x389b('0x101')](db['MailServerOut'],{'as':'Smtp','onDelete':_0x389b('0x102')});db[_0x389b('0x41')][_0x389b('0x103')](db[_0x389b('0x7e')],{'as':_0x389b('0x14f'),'foreignKey':_0x389b('0x14e')});db['MailAccount']['hasMany'](db[_0x389b('0x7d')],{'as':_0x389b('0x150'),'foreignKey':_0x389b('0x14e')});db['MailAccount']['hasMany'](db['MailMessage'],{'as':'Messages','foreignKey':'MailAccountId'});db[_0x389b('0x41')]['hasMany'](db['MailInteraction'],{'as':_0x389b('0x151')});db[_0x389b('0x41')][_0x389b('0x103')](db['MailApplication'],{'as':_0x389b('0x136')});db[_0x389b('0x41')][_0x389b('0x10f')](db['CmList'],{'as':_0x389b('0x152'),'foreignKey':_0x389b('0x153')});db[_0x389b('0x41')][_0x389b('0x10f')](db[_0x389b('0x8c')],{'as':'Template','foreignKey':'TemplateId'});db[_0x389b('0x41')][_0x389b('0x10f')](db[_0x389b('0x142')],{'as':_0x389b('0x154'),'foreignKey':'mandatoryDispositionPauseId'});db['MailAccount']['belongsToMany'](db[_0x389b('0x14')],{'as':'Agents','through':_0x389b('0x155')});db['MailQueue'][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x145'),'through':_0x389b('0x156')});db[_0x389b('0x43')]['belongsToMany'](db[_0x389b('0x157')],{'through':_0x389b('0x158'),'as':_0x389b('0x159')});db[_0x389b('0x46')][_0x389b('0x103')](db[_0x389b('0x15a')],{'as':'Messages','onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x15b')});db[_0x389b('0x46')][_0x389b('0x10f')](db[_0x389b('0x41')],{'as':'Account','foreignKey':'MailAccountId'});db['MailInteraction'][_0x389b('0x10f')](db[_0x389b('0x15c')],{'as':'Contact','foreignKey':'ContactId'});db[_0x389b('0x46')]['belongsTo'](db[_0x389b('0x14')],{'as':_0x389b('0x15d'),'foreignKey':_0x389b('0x105')});db[_0x389b('0x46')]['belongsToMany'](db[_0x389b('0x15e')],{'through':_0x389b('0x15f'),'as':_0x389b('0x160')});db[_0x389b('0x46')]['belongsToMany'](db[_0x389b('0x15e')],{'through':_0x389b('0x15f'),'as':_0x389b('0x161')});db[_0x389b('0x46')][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x162'),'through':_0x389b('0x119'),'foreignKey':_0x389b('0x15b')});db[_0x389b('0x15a')][_0x389b('0x103')](db[_0x389b('0xe2')],{'as':_0x389b('0x163'),'onDelete':_0x389b('0x102')});db[_0x389b('0x15a')][_0x389b('0x10f')](db[_0x389b('0x14')],{'as':_0x389b('0x14')});db[_0x389b('0x15a')][_0x389b('0x10f')](db[_0x389b('0x15c')],{'onDelete':'cascade','as':_0x389b('0x14d')});db[_0x389b('0x15a')][_0x389b('0x10f')](db[_0x389b('0x46')],{'as':'Interaction','foreignKey':_0x389b('0x15b')});db['MailMessage'][_0x389b('0x10f')](db[_0x389b('0x41')],{'as':_0x389b('0x164'),'foreignKey':_0x389b('0x14e')});db[_0x389b('0x15a')][_0x389b('0x10f')](db[_0x389b('0x61')],{'as':_0x389b('0x61'),'foreignKey':'ChatWebsiteId'});db['MailMessage'][_0x389b('0x10f')](db[_0x389b('0x6a')],{'as':_0x389b('0x6a'),'foreignKey':_0x389b('0x165')});db['MailApplication']['belongsTo'](db[_0x389b('0x14')],{'onDelete':_0x389b('0x166')});db['MailApplication']['belongsTo'](db['MailQueue'],{'onDelete':'restrict'});db['MailApplication']['belongsTo'](db[_0x389b('0x41')],{'onDelete':_0x389b('0x166')});db[_0x389b('0x167')][_0x389b('0x10f')](db[_0x389b('0x82')],{'onDelete':'restrict','foreignKey':_0x389b('0x168')});db[_0x389b('0x167')]['belongsTo'](db[_0x389b('0x15e')],{'onDelete':_0x389b('0x166'),'foreignKey':_0x389b('0x169')});db[_0x389b('0x16a')][_0x389b('0x10f')](db[_0x389b('0x41')],{});db['MailQueueReport'][_0x389b('0x10f')](db[_0x389b('0x127')],{'as':_0x389b('0x152'),'foreignKey':_0x389b('0x153')});db['MailQueueReport'][_0x389b('0x10f')](db[_0x389b('0x15c')],{'as':'Contact','foreignKey':_0x389b('0x16b')});db[_0x389b('0x16a')][_0x389b('0x10f')](db['MailInteraction'],{});db[_0x389b('0x16a')]['belongsTo'](db['MailMessage'],{});db[_0x389b('0x16a')][_0x389b('0x10f')](db[_0x389b('0x14')],{});db[_0x389b('0x16a')][_0x389b('0x10f')](db[_0x389b('0x43')],{});db['Dashboard']['hasMany'](db[_0x389b('0x4c')],{'as':_0x389b('0x16c'),'onDelete':_0x389b('0x102')});db[_0x389b('0x16d')][_0x389b('0x103')](db[_0x389b('0x7e')],{'as':_0x389b('0x14f'),'foreignKey':'FaxAccountId'});db[_0x389b('0x16d')][_0x389b('0x103')](db['CannedAnswer'],{'as':_0x389b('0x150'),'foreignKey':_0x389b('0x16e')});db[_0x389b('0x16d')]['hasMany'](db['FaxInteraction'],{'as':_0x389b('0x151')});db[_0x389b('0x16d')]['hasMany'](db[_0x389b('0x4e')],{'as':_0x389b('0x136')});db[_0x389b('0x16d')][_0x389b('0x103')](db[_0x389b('0x1b')],{'as':_0x389b('0x16f'),'onDelete':_0x389b('0x102')});db['FaxAccount']['hasMany'](db[_0x389b('0x51')],{'as':_0x389b('0x170')});db[_0x389b('0x16d')][_0x389b('0x10f')](db[_0x389b('0x13e')],{'as':'Trunk'});db[_0x389b('0x16d')][_0x389b('0x10f')](db['CmList'],{'as':_0x389b('0x152'),'foreignKey':_0x389b('0x153')});db[_0x389b('0x16d')]['belongsTo'](db[_0x389b('0x142')],{'as':_0x389b('0x154'),'foreignKey':_0x389b('0x143')});db[_0x389b('0x16d')][_0x389b('0x115')](db[_0x389b('0x14')],{'as':'Agents','through':'user_has_fax_accounts'});db[_0x389b('0x4e')]['belongsTo'](db['User'],{'onDelete':_0x389b('0x166')});db[_0x389b('0x4e')][_0x389b('0x10f')](db['FaxQueue'],{'onDelete':'restrict'});db[_0x389b('0x4e')][_0x389b('0x10f')](db['FaxAccount'],{'onDelete':'restrict'});db[_0x389b('0x4e')][_0x389b('0x10f')](db[_0x389b('0x15e')],{'onDelete':_0x389b('0x166'),'foreignKey':_0x389b('0x169')});db[_0x389b('0x50')][_0x389b('0x103')](db['FaxMessage'],{'as':_0x389b('0x170'),'onDelete':'cascade','foreignKey':'FaxInteractionId'});db[_0x389b('0x50')][_0x389b('0x10f')](db[_0x389b('0x16d')],{'as':_0x389b('0x164'),'foreignKey':_0x389b('0x16e')});db[_0x389b('0x50')][_0x389b('0x10f')](db[_0x389b('0x15c')],{'as':'Contact','foreignKey':'ContactId'});db[_0x389b('0x50')][_0x389b('0x10f')](db['User'],{'as':_0x389b('0x15d'),'foreignKey':_0x389b('0x105')});db[_0x389b('0x50')][_0x389b('0x115')](db[_0x389b('0x15e')],{'through':_0x389b('0x171'),'as':_0x389b('0x160')});db[_0x389b('0x50')]['belongsToMany'](db[_0x389b('0x15e')],{'through':_0x389b('0x171'),'as':'ThroughTags'});db[_0x389b('0x50')]['belongsToMany'](db[_0x389b('0x14')],{'as':_0x389b('0x162'),'through':_0x389b('0x172'),'foreignKey':'FaxInteractionId'});db[_0x389b('0x51')][_0x389b('0x10f')](db['User'],{'onDelete':_0x389b('0x102'),'as':'User'});db[_0x389b('0x51')]['belongsTo'](db[_0x389b('0x50')],{'as':'Interaction','foreignKey':_0x389b('0x173')});db['FaxMessage'][_0x389b('0x10f')](db['CmContact'],{'onDelete':_0x389b('0x102'),'as':_0x389b('0x14d')});db[_0x389b('0x51')][_0x389b('0x10f')](db[_0x389b('0xe2')],{'as':_0x389b('0xe2'),'foreignKey':_0x389b('0x174')});db[_0x389b('0x51')]['belongsTo'](db[_0x389b('0x16d')],{'as':'Account','foreignKey':_0x389b('0x16e')});db['FaxQueue'][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x145'),'through':_0x389b('0x122')});db[_0x389b('0x53')][_0x389b('0x115')](db[_0x389b('0x157')],{'through':'team_has_fax_queues','as':_0x389b('0x159')});db['FaxQueueReport'][_0x389b('0x10f')](db[_0x389b('0x16d')],{});db[_0x389b('0x175')][_0x389b('0x10f')](db[_0x389b('0x127')],{'as':_0x389b('0x152'),'foreignKey':_0x389b('0x153')});db['FaxQueueReport']['belongsTo'](db[_0x389b('0x15c')],{'as':_0x389b('0x14d'),'foreignKey':'ContactId'});db['FaxQueueReport'][_0x389b('0x10f')](db['FaxInteraction'],{});db[_0x389b('0x175')][_0x389b('0x10f')](db[_0x389b('0x51')],{});db[_0x389b('0x175')][_0x389b('0x10f')](db['User'],{});db[_0x389b('0x175')]['belongsTo'](db[_0x389b('0x53')],{});db['SmsAccount'][_0x389b('0x103')](db[_0x389b('0x7e')],{'as':_0x389b('0x14f'),'foreignKey':_0x389b('0x176')});db[_0x389b('0x56')][_0x389b('0x103')](db[_0x389b('0x7d')],{'as':'Answers','foreignKey':_0x389b('0x176')});db[_0x389b('0x56')]['hasMany'](db[_0x389b('0x177')],{'as':_0x389b('0x170'),'foreignKey':'SmsAccountId'});db[_0x389b('0x56')][_0x389b('0x103')](db[_0x389b('0x10a')],{'as':_0x389b('0x151')});db['SmsAccount']['hasMany'](db[_0x389b('0x57')],{'as':_0x389b('0x136')});db[_0x389b('0x56')]['belongsTo'](db[_0x389b('0x127')],{'as':_0x389b('0x152'),'foreignKey':_0x389b('0x153')});db[_0x389b('0x56')]['belongsTo'](db[_0x389b('0x142')],{'as':_0x389b('0x154'),'foreignKey':_0x389b('0x143')});db[_0x389b('0x56')][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x145'),'through':_0x389b('0x130')});db[_0x389b('0x57')][_0x389b('0x10f')](db[_0x389b('0x14')],{'onDelete':'restrict'});db[_0x389b('0x57')]['belongsTo'](db['SmsQueue'],{'onDelete':_0x389b('0x166')});db['SmsApplication'][_0x389b('0x10f')](db[_0x389b('0x56')],{'onDelete':_0x389b('0x166')});db[_0x389b('0x57')][_0x389b('0x10f')](db[_0x389b('0x82')],{'onDelete':_0x389b('0x166'),'foreignKey':_0x389b('0x168')});db['SmsApplication'][_0x389b('0x10f')](db[_0x389b('0x15e')],{'onDelete':_0x389b('0x166'),'foreignKey':_0x389b('0x169')});db[_0x389b('0x10a')][_0x389b('0x103')](db[_0x389b('0x177')],{'as':_0x389b('0x170'),'onDelete':'cascade','foreignKey':_0x389b('0x178')});db[_0x389b('0x10a')]['belongsTo'](db['SmsAccount'],{'as':_0x389b('0x164'),'foreignKey':_0x389b('0x176')});db[_0x389b('0x10a')][_0x389b('0x10f')](db[_0x389b('0x15c')],{'as':_0x389b('0x14d'),'foreignKey':'ContactId'});db[_0x389b('0x10a')][_0x389b('0x10f')](db[_0x389b('0x14')],{'as':_0x389b('0x15d'),'foreignKey':_0x389b('0x105')});db[_0x389b('0x10a')][_0x389b('0x115')](db['Tag'],{'through':_0x389b('0x179'),'as':_0x389b('0x160')});db[_0x389b('0x10a')][_0x389b('0x115')](db[_0x389b('0x15e')],{'through':_0x389b('0x179'),'as':_0x389b('0x161')});db[_0x389b('0x10a')][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x162'),'through':'user_has_sms_interactions','foreignKey':'SmsInteractionId'});db['SmsMessage']['belongsTo'](db[_0x389b('0x14')],{'as':_0x389b('0x14')});db[_0x389b('0x177')][_0x389b('0x10f')](db[_0x389b('0x15c')],{'onDelete':'cascade','as':_0x389b('0x14d')});db[_0x389b('0x177')][_0x389b('0x10f')](db[_0x389b('0x10a')],{'onDelete':_0x389b('0x102'),'as':'Interaction','foreignKey':_0x389b('0x178')});db['SmsMessage'][_0x389b('0x10f')](db[_0x389b('0x56')],{'as':_0x389b('0x164'),'foreignKey':'SmsAccountId'});db[_0x389b('0x123')][_0x389b('0x115')](db['User'],{'as':_0x389b('0x145'),'through':_0x389b('0x125'),'foreignKey':_0x389b('0x17a')});db['SmsQueue'][_0x389b('0x115')](db[_0x389b('0x157')],{'through':_0x389b('0x17b'),'as':_0x389b('0x159')});db[_0x389b('0x5b')][_0x389b('0x103')](db[_0x389b('0x7e')],{'as':'Dispositions','foreignKey':_0x389b('0x17c')});db[_0x389b('0x5b')]['hasMany'](db[_0x389b('0x7d')],{'as':_0x389b('0x150'),'foreignKey':_0x389b('0x17c')});db[_0x389b('0x5b')][_0x389b('0x103')](db[_0x389b('0x11b')],{'as':'Interactions','foreignKey':_0x389b('0x17c')});db[_0x389b('0x5b')][_0x389b('0x103')](db[_0x389b('0x17d')],{'as':'Messages','foreignKey':_0x389b('0x17c')});db['OpenchannelAccount'][_0x389b('0x103')](db[_0x389b('0x5c')],{'as':'Applications','foreignKey':_0x389b('0x17c')});db[_0x389b('0x5b')][_0x389b('0x10f')](db[_0x389b('0x127')],{'as':'List','foreignKey':_0x389b('0x153')});db[_0x389b('0x5b')][_0x389b('0x10f')](db[_0x389b('0x142')],{'as':_0x389b('0x154'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x389b('0x5b')][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x145'),'through':'user_has_openchannel_accounts'});db[_0x389b('0x5c')][_0x389b('0x10f')](db[_0x389b('0x14')],{'onDelete':'restrict'});db[_0x389b('0x5c')][_0x389b('0x10f')](db[_0x389b('0x5f')],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db['OpenchannelApplication'][_0x389b('0x10f')](db[_0x389b('0x5b')],{'onDelete':'restrict','foreignKey':_0x389b('0x17c')});db[_0x389b('0x5c')][_0x389b('0x10f')](db[_0x389b('0x82')],{'onDelete':_0x389b('0x166'),'foreignKey':_0x389b('0x168')});db['OpenchannelApplication'][_0x389b('0x10f')](db['Tag'],{'onDelete':_0x389b('0x166'),'foreignKey':_0x389b('0x169')});db[_0x389b('0x11b')][_0x389b('0x103')](db[_0x389b('0x17d')],{'as':_0x389b('0x170'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x17e')});db[_0x389b('0x11b')][_0x389b('0x10f')](db[_0x389b('0x5b')],{'as':_0x389b('0x164'),'foreignKey':_0x389b('0x17c')});db[_0x389b('0x11b')]['belongsTo'](db['CmContact'],{'as':_0x389b('0x14d'),'foreignKey':_0x389b('0x16b')});db['OpenchannelInteraction'][_0x389b('0x10f')](db[_0x389b('0x14')],{'as':'Owner','foreignKey':_0x389b('0x105')});db[_0x389b('0x11b')]['belongsToMany'](db[_0x389b('0x15e')],{'through':_0x389b('0x17f'),'as':_0x389b('0x160')});db[_0x389b('0x11b')]['belongsToMany'](db[_0x389b('0x15e')],{'through':_0x389b('0x17f'),'as':_0x389b('0x161')});db['OpenchannelInteraction'][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x162'),'through':_0x389b('0x11d'),'foreignKey':'OpenchannelInteractionId'});db[_0x389b('0x17d')][_0x389b('0x10f')](db['User'],{'onDelete':'cascade','as':_0x389b('0x14')});db[_0x389b('0x17d')]['belongsTo'](db[_0x389b('0x15c')],{'onDelete':_0x389b('0x102'),'as':_0x389b('0x14d')});db[_0x389b('0x17d')][_0x389b('0x10f')](db[_0x389b('0x11b')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x389b('0x17e')});db[_0x389b('0x17d')]['belongsTo'](db['Attachment'],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x389b('0x17d')][_0x389b('0x10f')](db[_0x389b('0x5b')],{'as':_0x389b('0x164'),'foreignKey':_0x389b('0x17c')});db['OpenchannelQueue'][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x145'),'through':_0x389b('0x3b'),'foreignKey':_0x389b('0x180')});db[_0x389b('0x5f')][_0x389b('0x115')](db[_0x389b('0x157')],{'through':_0x389b('0x181'),'as':_0x389b('0x159')});db[_0x389b('0x61')][_0x389b('0x103')](db['Disposition'],{'as':'Dispositions','foreignKey':'ChatWebsiteId'});db[_0x389b('0x61')][_0x389b('0x103')](db[_0x389b('0x7d')],{'as':_0x389b('0x150'),'foreignKey':_0x389b('0x182')});db[_0x389b('0x61')][_0x389b('0x103')](db[_0x389b('0x6f')],{'as':_0x389b('0x183')});db[_0x389b('0x61')][_0x389b('0x103')](db[_0x389b('0x66')],{'as':_0x389b('0x151')});db['ChatWebsite'][_0x389b('0x103')](db[_0x389b('0x65')],{'as':_0x389b('0x136')});db[_0x389b('0x61')][_0x389b('0x103')](db[_0x389b('0x68')],{'as':_0x389b('0x170')});db[_0x389b('0x61')][_0x389b('0x10f')](db['CmList'],{'as':'List','foreignKey':_0x389b('0x153')});db['ChatWebsite'][_0x389b('0x10f')](db[_0x389b('0x82')],{'as':_0x389b('0x82'),'foreignKey':_0x389b('0x168')});db[_0x389b('0x61')][_0x389b('0x10f')](db[_0x389b('0x41')],{'as':_0x389b('0x41'),'foreignKey':_0x389b('0x14e')});db['ChatWebsite'][_0x389b('0x10f')](db['Pause'],{'as':_0x389b('0x154'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x389b('0x61')][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x145'),'through':'user_has_chat_websites'});db['OpenchannelQueueReport'][_0x389b('0x10f')](db[_0x389b('0x5b')],{});db[_0x389b('0x63')]['belongsTo'](db[_0x389b('0x127')],{'as':'List','foreignKey':_0x389b('0x153')});db['OpenchannelQueueReport'][_0x389b('0x10f')](db[_0x389b('0x15c')],{'as':'Contact','foreignKey':'ContactId'});db[_0x389b('0x63')][_0x389b('0x10f')](db['OpenchannelInteraction'],{});db['OpenchannelQueueReport'][_0x389b('0x10f')](db[_0x389b('0x17d')],{});db[_0x389b('0x63')][_0x389b('0x10f')](db[_0x389b('0x14')],{});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelQueue'],{});db['ChatApplication'][_0x389b('0x10f')](db['User'],{'as':_0x389b('0x184'),'foreignKey':_0x389b('0x105'),'onDelete':'restrict'});db[_0x389b('0x65')][_0x389b('0x10f')](db[_0x389b('0x6c')],{'as':_0x389b('0x185'),'foreignKey':_0x389b('0x186'),'onDelete':_0x389b('0x166')});db[_0x389b('0x65')]['belongsTo'](db[_0x389b('0x61')],{'as':_0x389b('0x187'),'foreignKey':'ChatWebsiteId','onDelete':'restrict'});db[_0x389b('0x65')][_0x389b('0x10f')](db[_0x389b('0x15e')],{'onDelete':'restrict','foreignKey':_0x389b('0x169')});db[_0x389b('0x66')]['hasMany'](db[_0x389b('0x68')],{'as':'Messages','onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x188')});db[_0x389b('0x66')]['belongsTo'](db['ChatWebsite'],{'as':_0x389b('0x164'),'foreignKey':_0x389b('0x182')});db['ChatInteraction'][_0x389b('0x10f')](db[_0x389b('0x15c')],{'as':'Contact','foreignKey':'ContactId'});db[_0x389b('0x66')][_0x389b('0x10f')](db[_0x389b('0x14')],{'as':_0x389b('0x15d'),'foreignKey':_0x389b('0x105')});db[_0x389b('0x66')][_0x389b('0x115')](db[_0x389b('0x15e')],{'through':_0x389b('0x189'),'as':_0x389b('0x160')});db[_0x389b('0x66')][_0x389b('0x115')](db[_0x389b('0x15e')],{'through':_0x389b('0x189'),'as':_0x389b('0x161')});db[_0x389b('0x66')][_0x389b('0x115')](db[_0x389b('0x14')],{'as':'Users','through':_0x389b('0x18a'),'foreignKey':_0x389b('0x188')});db['ChatMessage'][_0x389b('0x10f')](db['User'],{'onDelete':'cascade','as':_0x389b('0x14')});db[_0x389b('0x68')][_0x389b('0x10f')](db['CmContact'],{'onDelete':_0x389b('0x102'),'as':_0x389b('0x14d'),'foreignKey':_0x389b('0x16b')});db[_0x389b('0x68')][_0x389b('0x10f')](db[_0x389b('0x66')],{'onDelete':'cascade','as':_0x389b('0x18b'),'foreignKey':'ChatInteractionId'});db[_0x389b('0x68')][_0x389b('0x10f')](db['Attachment'],{'as':_0x389b('0xe2'),'foreignKey':_0x389b('0x174')});db[_0x389b('0x68')][_0x389b('0x10f')](db['ChatWebsite'],{'as':_0x389b('0x164'),'foreignKey':_0x389b('0x182')});db[_0x389b('0x6a')][_0x389b('0x103')](db[_0x389b('0xe2')],{'as':'Attachments','foreignKey':_0x389b('0x165'),'onDelete':_0x389b('0x102'),'hooks':!![]});db[_0x389b('0x6a')][_0x389b('0x10f')](db[_0x389b('0x15c')],{'onDelete':'cascade','as':_0x389b('0x14d'),'foreignKey':_0x389b('0x16b')});db[_0x389b('0x6a')]['belongsTo'](db['ChatWebsite'],{'as':'Account','foreignKey':'ChatWebsiteId'});db['ChatQueue'][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x145'),'through':'UserChatQueue','hooks':!![]});db['ChatQueue'][_0x389b('0x115')](db[_0x389b('0x157')],{'through':_0x389b('0x18c'),'as':_0x389b('0x159')});db['ChatGroup'][_0x389b('0x103')](db[_0x389b('0xc6')],{'as':_0x389b('0x170'),'foreignKey':_0x389b('0x18d'),'onDelete':_0x389b('0x102')});db['ChatGroup']['belongsToMany'](db[_0x389b('0x14')],{'as':_0x389b('0x18e'),'through':_0x389b('0x18f')});db[_0x389b('0x6f')][_0x389b('0x10f')](db[_0x389b('0x61')],{'as':_0x389b('0x187'),'foreignKey':'ChatWebsiteId'});db[_0x389b('0x190')][_0x389b('0x103')](db[_0x389b('0x15c')],{'as':_0x389b('0x113'),'foreignKey':_0x389b('0x191')});db[_0x389b('0x15c')][_0x389b('0x103')](db[_0x389b('0x73')],{'as':_0x389b('0x192'),'foreignKey':_0x389b('0x16b')});db[_0x389b('0x15c')][_0x389b('0x103')](db[_0x389b('0x193')],{'as':_0x389b('0x106'),'foreignKey':_0x389b('0x16b')});db[_0x389b('0x15c')][_0x389b('0x103')](db[_0x389b('0x107')],{'as':'HopperHistories','foreignKey':_0x389b('0x16b')});db['CmContact'][_0x389b('0x103')](db[_0x389b('0x77')],{'as':_0x389b('0x77'),'foreignKey':'ContactId'});db['CmContact'][_0x389b('0x103')](db[_0x389b('0xcb')],{'as':_0x389b('0x13d'),'foreignKey':'ContactId'});db['CmContact'][_0x389b('0x103')](db[_0x389b('0x11b')],{'as':_0x389b('0x11c'),'foreignKey':_0x389b('0x16b'),'onDelete':_0x389b('0x166')});db['CmContact'][_0x389b('0x103')](db[_0x389b('0x66')],{'as':_0x389b('0x109'),'foreignKey':_0x389b('0x16b'),'onDelete':_0x389b('0x166')});db[_0x389b('0x15c')][_0x389b('0x103')](db[_0x389b('0x10a')],{'as':'SmsInteractions','foreignKey':_0x389b('0x16b'),'onDelete':_0x389b('0x166')});db[_0x389b('0x15c')][_0x389b('0x103')](db[_0x389b('0x50')],{'as':'FaxInteractions','foreignKey':_0x389b('0x16b'),'onDelete':'restrict'});db['CmContact']['hasMany'](db[_0x389b('0x46')],{'as':'MailInteractions','foreignKey':_0x389b('0x16b'),'onDelete':_0x389b('0x166')});db[_0x389b('0x15c')][_0x389b('0x10f')](db[_0x389b('0x190')],{'as':'Company','foreignKey':'CompanyId'});db[_0x389b('0x15c')]['belongsTo'](db['CmList'],{'as':_0x389b('0x152'),'foreignKey':_0x389b('0x153'),'onDelete':'cascade'});db[_0x389b('0x15c')][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x162'),'through':_0x389b('0x114')});db[_0x389b('0x15c')][_0x389b('0x115')](db[_0x389b('0x15e')],{'as':_0x389b('0x160'),'through':_0x389b('0x194')});db['CmContact'][_0x389b('0x115')](db['Tag'],{'through':_0x389b('0x194'),'as':_0x389b('0x161')});db['CmHopper'][_0x389b('0x10f')](db[_0x389b('0x15c')],{'as':'Contact','foreignKey':_0x389b('0x16b'),'onDelete':_0x389b('0x102')});db['CmHopper']['belongsTo'](db[_0x389b('0x127')],{'as':'List','foreignKey':_0x389b('0x153'),'onDelete':'cascade'});db[_0x389b('0x73')][_0x389b('0x10f')](db[_0x389b('0x14')],{'as':'Agent','foreignKey':_0x389b('0x105')});db[_0x389b('0x73')][_0x389b('0x10f')](db[_0x389b('0x1f')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0x389b('0x102')});db[_0x389b('0x73')][_0x389b('0x10f')](db['Campaign'],{'as':'Campaign','foreignKey':'CampaignId','onDelete':'cascade'});db[_0x389b('0x73')]['belongsTo'](db[_0x389b('0x14')],{'as':'Owner','foreignKey':_0x389b('0x195')});db[_0x389b('0x74')][_0x389b('0x10f')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId','onDelete':'cascade'});db[_0x389b('0x74')][_0x389b('0x10f')](db['CmList'],{'as':_0x389b('0x152'),'foreignKey':_0x389b('0x153'),'onDelete':_0x389b('0x102')});db[_0x389b('0x74')][_0x389b('0x10f')](db[_0x389b('0x1f')],{'as':_0x389b('0x185'),'foreignKey':_0x389b('0x13a'),'onDelete':'cascade'});db[_0x389b('0x74')][_0x389b('0x10f')](db[_0x389b('0xde')],{'as':_0x389b('0xde'),'foreignKey':_0x389b('0x196'),'onDelete':_0x389b('0x102')});db['Automation']['hasMany'](db[_0x389b('0x80')],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':_0x389b('0x197'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0x389b('0x103')](db['Condition'],{'as':{'plural':_0x389b('0x198'),'singular':_0x389b('0x199')},'foreignKey':_0x389b('0x19a'),'onDelete':_0x389b('0x102'),'hooks':!![]});db['Automation']['hasMany'](db[_0x389b('0x7a')],{'as':_0x389b('0x19b'),'foreignKey':_0x389b('0x19c'),'onDelete':_0x389b('0x102'),'hooks':!![]});db['Disposition'][_0x389b('0x103')](db['Disposition'],{'as':_0x389b('0x14f'),'foreignKey':_0x389b('0x19d'),'onDelete':'cascade'});db[_0x389b('0x82')]['hasMany'](db[_0x389b('0x82')],{'as':_0x389b('0x19e'),'foreignKey':_0x389b('0x168'),'onDelete':_0x389b('0x102'),'hooks':!![],'required':![]});db[_0x389b('0x82')]['hasMany'](db[_0x389b('0x1b')],{'as':_0x389b('0x19f'),'foreignKey':_0x389b('0x168'),'onDelete':_0x389b('0x166')});db['Interval'][_0x389b('0x103')](db[_0x389b('0x167')],{'as':_0x389b('0x1a0'),'foreignKey':_0x389b('0x168')});db['Interval'][_0x389b('0x103')](db['ChatApplication'],{'as':_0x389b('0x1a1'),'foreignKey':_0x389b('0x168')});db[_0x389b('0x82')][_0x389b('0x103')](db[_0x389b('0x4e')],{'as':_0x389b('0x1a2'),'foreignKey':'IntervalId'});db['Interval'][_0x389b('0x103')](db[_0x389b('0x57')],{'as':'SmsApplications','foreignKey':_0x389b('0x168')});db[_0x389b('0x89')][_0x389b('0x10f')](db[_0x389b('0x41')],{});db[_0x389b('0x89')][_0x389b('0x10f')](db['AnalyticDefaultReport'],{'foreignKey':'DefaultReportId'});db[_0x389b('0x89')][_0x389b('0x10f')](db[_0x389b('0x95')],{'foreignKey':_0x389b('0x1a3')});db['Sound'][_0x389b('0x115')](db[_0x389b('0x1d')],{'as':_0x389b('0x1a4'),'through':_0x389b('0x139'),'onDelete':_0x389b('0x166')});db['Tag'][_0x389b('0x115')](db[_0x389b('0x15c')],{'through':'cm_contact_has_tags'});db['Tag']['belongsToMany'](db['ChatInteraction'],{'through':_0x389b('0x189')});db[_0x389b('0x15e')][_0x389b('0x115')](db[_0x389b('0x46')],{'through':_0x389b('0x15f')});db['Tag']['belongsToMany'](db[_0x389b('0x10a')],{'through':_0x389b('0x179')});db[_0x389b('0x15e')][_0x389b('0x115')](db[_0x389b('0x50')],{'through':_0x389b('0x171')});db[_0x389b('0x15e')][_0x389b('0x115')](db['OpenchannelInteraction'],{'through':_0x389b('0x17f')});db[_0x389b('0x15e')][_0x389b('0x115')](db[_0x389b('0xf7')],{'through':_0x389b('0x1a5')});db[_0x389b('0x8e')][_0x389b('0x103')](db[_0x389b('0x80')],{'as':{'plural':_0x389b('0x1a6'),'singular':_0x389b('0x1a7')},'foreignKey':_0x389b('0x1a8'),'onDelete':_0x389b('0x102'),'hooks':!![]});db['Trigger'][_0x389b('0x103')](db[_0x389b('0x80')],{'as':{'plural':'AnyConditions','singular':_0x389b('0x1a9')},'foreignKey':'TriggerAnyId','onDelete':_0x389b('0x102'),'hooks':!![]});db[_0x389b('0x8e')][_0x389b('0x103')](db[_0x389b('0x7a')],{'as':_0x389b('0x19b'),'foreignKey':'TriggerId','onDelete':'cascade','hooks':!![]});db[_0x389b('0x95')][_0x389b('0x103')](db['AnalyticFieldReport'],{'as':_0x389b('0x1aa'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1a3'),'hooks':!![]});db[_0x389b('0x1ab')]['hasMany'](db[_0x389b('0x99')],{'as':_0x389b('0x1aa'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1ac')});db[_0x389b('0x1ad')][_0x389b('0x103')](db['AnalyticFieldReport'],{'as':_0x389b('0x1aa'),'onDelete':_0x389b('0x102'),'foreignKey':'MetricId'});db[_0x389b('0x99')][_0x389b('0x10f')](db[_0x389b('0x1ad')],{'foreignKey':_0x389b('0x1ae')});db[_0x389b('0x9d')][_0x389b('0x103')](db[_0x389b('0x9f')],{'as':_0x389b('0x1af'),'onDelete':'cascade','foreignKey':_0x389b('0x1b0')});db[_0x389b('0x9f')]['hasMany'](db[_0x389b('0xa1')],{'as':_0x389b('0x1b1'),'onDelete':'cascade','foreignKey':_0x389b('0x1b2')});db[_0x389b('0x9f')]['hasMany'](db[_0x389b('0xa1')],{'as':_0x389b('0x1b3'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1b4')});db[_0x389b('0x9f')][_0x389b('0x103')](db[_0x389b('0xa1')],{'as':_0x389b('0x1aa'),'onDelete':_0x389b('0x102'),'foreignKey':'FieldId'});db['SalesforceConfiguration']['belongsTo'](db[_0x389b('0x9d')],{'as':_0x389b('0x164'),'foreignKey':_0x389b('0x1b0')});db[_0x389b('0xa1')][_0x389b('0x103')](db[_0x389b('0xa1')],{'as':_0x389b('0x1b5'),'foreignKey':_0x389b('0x1b2')});db[_0x389b('0xa1')]['hasMany'](db[_0x389b('0xa1')],{'as':_0x389b('0x1b6'),'foreignKey':_0x389b('0x1b4')});db['SalesforceField']['hasMany'](db[_0x389b('0xa1')],{'as':_0x389b('0x1b7'),'foreignKey':'FieldId'});db[_0x389b('0xa1')][_0x389b('0x10f')](db[_0x389b('0x1b8')],{'as':_0x389b('0x1b8'),'foreignKey':_0x389b('0x1b9')});db[_0x389b('0xa3')][_0x389b('0x103')](db[_0x389b('0x1ba')],{'as':_0x389b('0x1af'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1b0')});db[_0x389b('0x1ba')][_0x389b('0x103')](db[_0x389b('0xa5')],{'as':_0x389b('0x1b1'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1b2')});db[_0x389b('0x1ba')][_0x389b('0x103')](db[_0x389b('0xa5')],{'as':_0x389b('0x1b3'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1b4')});db[_0x389b('0x1ba')][_0x389b('0x103')](db[_0x389b('0xa5')],{'as':_0x389b('0x1aa'),'onDelete':'cascade','foreignKey':_0x389b('0x1bb')});db['SugarcrmConfiguration']['belongsTo'](db[_0x389b('0xa3')],{'as':_0x389b('0x164'),'foreignKey':'AccountId'});db[_0x389b('0xa5')]['hasMany'](db[_0x389b('0xa5')],{'as':_0x389b('0x1b5'),'foreignKey':_0x389b('0x1b2')});db[_0x389b('0xa5')][_0x389b('0x103')](db[_0x389b('0xa5')],{'as':_0x389b('0x1b6'),'foreignKey':_0x389b('0x1b4')});db[_0x389b('0xa5')][_0x389b('0x103')](db[_0x389b('0xa5')],{'as':_0x389b('0x1b7'),'foreignKey':_0x389b('0x1bb')});db[_0x389b('0xa5')]['belongsTo'](db[_0x389b('0x1b8')],{'as':'Variable','foreignKey':'VariableId'});db['DeskAccount'][_0x389b('0x103')](db[_0x389b('0xa8')],{'as':'Configurations','onDelete':_0x389b('0x102'),'foreignKey':'AccountId'});db[_0x389b('0xa8')][_0x389b('0x103')](db['DeskField'],{'as':'Subjects','onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1b2')});db[_0x389b('0xa8')]['hasMany'](db['DeskField'],{'as':_0x389b('0x1b3'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1b4')});db[_0x389b('0xa8')]['hasMany'](db[_0x389b('0xaa')],{'as':_0x389b('0x1aa'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1bb')});db['DeskConfiguration'][_0x389b('0x10f')](db[_0x389b('0x1bc')],{'as':'Account','foreignKey':_0x389b('0x1b0')});db[_0x389b('0xa8')][_0x389b('0x115')](db['Tag'],{'through':_0x389b('0x1bd')});db['DeskField']['hasMany'](db[_0x389b('0xaa')],{'as':'Subject','foreignKey':_0x389b('0x1b2')});db[_0x389b('0xaa')]['hasMany'](db[_0x389b('0xaa')],{'as':'Description','foreignKey':_0x389b('0x1b4')});db[_0x389b('0xaa')][_0x389b('0x103')](db[_0x389b('0xaa')],{'as':_0x389b('0x1b7'),'foreignKey':'FieldId'});db[_0x389b('0xaa')][_0x389b('0x10f')](db[_0x389b('0x1b8')],{'as':'Variable','foreignKey':'VariableId'});db[_0x389b('0xab')][_0x389b('0x103')](db[_0x389b('0x1be')],{'as':_0x389b('0x1af'),'onDelete':_0x389b('0x102'),'foreignKey':'AccountId'});db[_0x389b('0x1be')]['hasMany'](db[_0x389b('0x1bf')],{'as':_0x389b('0x1b1'),'onDelete':_0x389b('0x102'),'foreignKey':'SubjectId'});db[_0x389b('0x1be')]['hasMany'](db[_0x389b('0x1bf')],{'as':_0x389b('0x1b3'),'onDelete':'cascade','foreignKey':_0x389b('0x1b4')});db[_0x389b('0x1be')][_0x389b('0x103')](db[_0x389b('0x1bf')],{'as':_0x389b('0x1aa'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x389b('0x1be')][_0x389b('0x10f')](db[_0x389b('0xab')],{'as':'Account','foreignKey':'AccountId'});db[_0x389b('0x1bf')][_0x389b('0x103')](db[_0x389b('0x1bf')],{'as':_0x389b('0x1b5'),'foreignKey':_0x389b('0x1b2')});db[_0x389b('0x1bf')][_0x389b('0x103')](db[_0x389b('0x1bf')],{'as':_0x389b('0x1b6'),'foreignKey':_0x389b('0x1b4')});db[_0x389b('0x1bf')]['hasMany'](db[_0x389b('0x1bf')],{'as':_0x389b('0x1b7'),'foreignKey':_0x389b('0x1bb')});db['ZohoField']['belongsTo'](db[_0x389b('0x1b8')],{'as':_0x389b('0x1b8'),'foreignKey':_0x389b('0x1b9')});db['ZendeskAccount'][_0x389b('0x103')](db['ZendeskConfiguration'],{'as':_0x389b('0x1af'),'onDelete':'cascade','foreignKey':_0x389b('0x1b0')});db['ZendeskConfiguration'][_0x389b('0x103')](db['ZendeskField'],{'as':_0x389b('0x1b1'),'foreignKey':_0x389b('0x1b2')});db['ZendeskConfiguration'][_0x389b('0x103')](db[_0x389b('0xb2')],{'as':_0x389b('0x1b3'),'foreignKey':_0x389b('0x1b4')});db[_0x389b('0xb1')]['hasMany'](db[_0x389b('0xb2')],{'as':'Fields','foreignKey':'FieldId'});db[_0x389b('0xb1')][_0x389b('0x10f')](db[_0x389b('0xaf')],{'as':_0x389b('0x164'),'foreignKey':_0x389b('0x1b0')});db[_0x389b('0xb1')][_0x389b('0x115')](db['Tag'],{'through':'int_zendesk_configuration_has_tags'});db[_0x389b('0xb2')][_0x389b('0x103')](db[_0x389b('0xb2')],{'as':_0x389b('0x1b5'),'foreignKey':_0x389b('0x1b2')});db[_0x389b('0xb2')]['hasMany'](db['ZendeskField'],{'as':'Description','foreignKey':_0x389b('0x1b4')});db['ZendeskField']['hasMany'](db[_0x389b('0xb2')],{'as':_0x389b('0x1b7'),'foreignKey':'FieldId'});db[_0x389b('0xb2')][_0x389b('0x10f')](db['Variable'],{'as':_0x389b('0x1b8'),'foreignKey':_0x389b('0x1b9')});db[_0x389b('0x1c0')]['hasMany'](db[_0x389b('0xb5')],{'as':_0x389b('0x1af'),'onDelete':'cascade','foreignKey':_0x389b('0x1b0')});db[_0x389b('0xb5')][_0x389b('0x103')](db[_0x389b('0x1c1')],{'as':'Subjects','onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1b2')});db[_0x389b('0xb5')][_0x389b('0x103')](db['FreshdeskField'],{'as':_0x389b('0x1b3'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1b4')});db[_0x389b('0xb5')]['hasMany'](db[_0x389b('0x1c1')],{'as':_0x389b('0x1aa'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1bb')});db[_0x389b('0xb5')]['belongsTo'](db['FreshdeskAccount'],{'as':_0x389b('0x164'),'foreignKey':_0x389b('0x1b0')});db['FreshdeskConfiguration'][_0x389b('0x115')](db['Tag'],{'through':_0x389b('0x1c2')});db[_0x389b('0x1c1')]['hasMany'](db[_0x389b('0x1c1')],{'as':'Subject','foreignKey':_0x389b('0x1b2')});db[_0x389b('0x1c1')][_0x389b('0x103')](db['FreshdeskField'],{'as':_0x389b('0x1b6'),'foreignKey':'DescriptionId'});db[_0x389b('0x1c1')]['hasMany'](db['FreshdeskField'],{'as':'Field','foreignKey':'FieldId'});db[_0x389b('0x1c1')][_0x389b('0x10f')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db['VtigerAccount']['hasMany'](db[_0x389b('0x1c3')],{'as':_0x389b('0x1af'),'onDelete':'cascade','foreignKey':_0x389b('0x1b0')});db[_0x389b('0x1c3')][_0x389b('0x103')](db[_0x389b('0xba')],{'as':'Subjects','foreignKey':_0x389b('0x1b2')});db['VtigerConfiguration'][_0x389b('0x103')](db['VtigerField'],{'as':'Descriptions','foreignKey':_0x389b('0x1b4')});db[_0x389b('0x1c3')]['hasMany'](db[_0x389b('0xba')],{'as':_0x389b('0x1aa'),'foreignKey':_0x389b('0x1bb')});db[_0x389b('0x1c3')]['belongsTo'](db['VtigerAccount'],{'as':_0x389b('0x164'),'foreignKey':'AccountId'});db[_0x389b('0xba')][_0x389b('0x103')](db[_0x389b('0xba')],{'as':_0x389b('0x1b5'),'foreignKey':_0x389b('0x1b2')});db[_0x389b('0xba')]['hasMany'](db[_0x389b('0xba')],{'as':_0x389b('0x1b6'),'foreignKey':_0x389b('0x1b4')});db[_0x389b('0xba')]['hasMany'](db[_0x389b('0xba')],{'as':'Field','foreignKey':_0x389b('0x1bb')});db[_0x389b('0xba')][_0x389b('0x10f')](db['Variable'],{'as':_0x389b('0x1b8'),'foreignKey':_0x389b('0x1b9')});db[_0x389b('0x1c4')][_0x389b('0x103')](db[_0x389b('0xbd')],{'as':_0x389b('0x1af'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1b0')});db[_0x389b('0xbd')][_0x389b('0x103')](db[_0x389b('0x1c5')],{'as':'Subjects','foreignKey':_0x389b('0x1b2')});db['ServicenowConfiguration']['hasMany'](db[_0x389b('0x1c5')],{'as':_0x389b('0x1b3'),'foreignKey':_0x389b('0x1b4')});db[_0x389b('0xbd')][_0x389b('0x103')](db[_0x389b('0x1c5')],{'as':_0x389b('0x1aa'),'foreignKey':_0x389b('0x1bb')});db[_0x389b('0xbd')][_0x389b('0x10f')](db[_0x389b('0x1c4')],{'as':_0x389b('0x164'),'foreignKey':'AccountId'});db[_0x389b('0x1c5')]['hasMany'](db[_0x389b('0x1c5')],{'as':_0x389b('0x1b5'),'foreignKey':_0x389b('0x1b2')});db['ServicenowField'][_0x389b('0x103')](db[_0x389b('0x1c5')],{'as':'Description','foreignKey':_0x389b('0x1b4')});db[_0x389b('0x1c5')]['hasMany'](db[_0x389b('0x1c5')],{'as':_0x389b('0x1b7'),'foreignKey':_0x389b('0x1bb')});db[_0x389b('0x1c5')][_0x389b('0x10f')](db[_0x389b('0x1b8')],{'as':'Variable','foreignKey':'VariableId'});db[_0x389b('0x1c6')][_0x389b('0x103')](db[_0x389b('0x1c7')],{'as':_0x389b('0x1af'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1b0')});db[_0x389b('0x1c7')][_0x389b('0x103')](db['Dynamics365Field'],{'as':'Subjects','onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1b2')});db[_0x389b('0x1c7')][_0x389b('0x103')](db[_0x389b('0xc0')],{'as':_0x389b('0x1b3'),'onDelete':_0x389b('0x102'),'foreignKey':'DescriptionId'});db[_0x389b('0x1c7')]['hasMany'](db[_0x389b('0xc0')],{'as':_0x389b('0x1aa'),'onDelete':_0x389b('0x102'),'foreignKey':'FieldId'});db[_0x389b('0x1c7')][_0x389b('0x10f')](db[_0x389b('0x1c6')],{'as':_0x389b('0x164'),'foreignKey':'AccountId'});db[_0x389b('0xc0')][_0x389b('0x103')](db[_0x389b('0xc0')],{'as':_0x389b('0x1b5'),'foreignKey':_0x389b('0x1b2')});db['Dynamics365Field']['hasMany'](db[_0x389b('0xc0')],{'as':_0x389b('0x1b6'),'foreignKey':'DescriptionId'});db[_0x389b('0xc0')][_0x389b('0x103')](db[_0x389b('0xc0')],{'as':'Field','foreignKey':'FieldId'});db[_0x389b('0xc0')][_0x389b('0x10f')](db[_0x389b('0x1b8')],{'as':'Variable','foreignKey':'VariableId'});db['FreshsalesAccount']['hasMany'](db[_0x389b('0x1c8')],{'as':_0x389b('0x1af'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1b0')});db[_0x389b('0x1c8')]['hasMany'](db[_0x389b('0x1c9')],{'as':_0x389b('0x1b1'),'foreignKey':_0x389b('0x1b2')});db['FreshsalesConfiguration'][_0x389b('0x103')](db['FreshsalesField'],{'as':'Descriptions','foreignKey':_0x389b('0x1b4')});db[_0x389b('0x1c8')]['hasMany'](db[_0x389b('0x1c9')],{'as':_0x389b('0x1aa'),'foreignKey':_0x389b('0x1bb')});db[_0x389b('0x1c8')]['belongsTo'](db[_0x389b('0x1ca')],{'as':_0x389b('0x164'),'foreignKey':'AccountId'});db['FreshsalesField'][_0x389b('0x103')](db[_0x389b('0x1c9')],{'as':_0x389b('0x1b5'),'foreignKey':'SubjectId'});db[_0x389b('0x1c9')]['hasMany'](db[_0x389b('0x1c9')],{'as':_0x389b('0x1b6'),'foreignKey':_0x389b('0x1b4')});db[_0x389b('0x1c9')][_0x389b('0x103')](db[_0x389b('0x1c9')],{'as':'Field','foreignKey':_0x389b('0x1bb')});db[_0x389b('0x1c9')]['belongsTo'](db[_0x389b('0x1b8')],{'as':_0x389b('0x1b8'),'foreignKey':_0x389b('0x1b9')});db[_0x389b('0x1cb')][_0x389b('0x10f')](db[_0x389b('0x61')],{});db[_0x389b('0x1cb')][_0x389b('0x10f')](db[_0x389b('0x127')],{'as':'List','foreignKey':'ListId'});db[_0x389b('0x1cb')][_0x389b('0x10f')](db[_0x389b('0x15c')],{'as':_0x389b('0x14d'),'foreignKey':'ContactId'});db[_0x389b('0x1cb')][_0x389b('0x10f')](db[_0x389b('0x66')],{});db[_0x389b('0x1cb')][_0x389b('0x10f')](db[_0x389b('0x68')],{});db[_0x389b('0x1cb')][_0x389b('0x10f')](db['User'],{});db[_0x389b('0x1cb')]['belongsTo'](db[_0x389b('0x6c')],{});db[_0x389b('0xc6')]['belongsTo'](db[_0x389b('0x14')],{'onDelete':'cascade','foreignKey':_0x389b('0x1cc')});db[_0x389b('0xc6')][_0x389b('0x10f')](db['User'],{'onDelete':'cascade','foreignKey':_0x389b('0x1cd')});db[_0x389b('0xcb')][_0x389b('0x103')](db[_0x389b('0xc9')],{'foreignKey':_0x389b('0x1ce'),'onDelete':'cascade'});db['JscriptySessionReport'][_0x389b('0x103')](db['JscriptyAnswerReport'],{'foreignKey':_0x389b('0x1ce'),'onDelete':_0x389b('0x102')});db[_0x389b('0xcd')][_0x389b('0x10f')](db[_0x389b('0x56')],{});db[_0x389b('0xcd')][_0x389b('0x10f')](db[_0x389b('0x127')],{'as':'List','foreignKey':_0x389b('0x153')});db[_0x389b('0xcd')]['belongsTo'](db[_0x389b('0x15c')],{'as':_0x389b('0x14d'),'foreignKey':_0x389b('0x16b')});db['SmsQueueReport'][_0x389b('0x10f')](db[_0x389b('0x10a')],{});db[_0x389b('0xcd')]['belongsTo'](db[_0x389b('0x177')],{});db['SmsQueueReport'][_0x389b('0x10f')](db[_0x389b('0x14')],{});db[_0x389b('0xcd')][_0x389b('0x10f')](db[_0x389b('0x123')],{});db[_0x389b('0xd2')][_0x389b('0x103')](db[_0x389b('0xcb')],{'foreignKey':'ProjectId'});db[_0x389b('0xd2')][_0x389b('0x103')](db['JscriptyQuestionReport'],{'foreignKey':_0x389b('0x1cf')});db[_0x389b('0xd2')][_0x389b('0x103')](db[_0x389b('0x1d0')],{'foreignKey':_0x389b('0x1cf')});db[_0x389b('0xd8')][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x162'),'through':_0x389b('0x133')});db[_0x389b('0x157')]['belongsToMany'](db['User'],{'as':_0x389b('0x145'),'through':_0x389b('0x118')});db['Team']['belongsToMany'](db[_0x389b('0x1f')],{'through':'TeamVoiceQueue','as':'VoiceQueues'});db['Team'][_0x389b('0x115')](db[_0x389b('0x43')],{'through':'team_has_mail_queues','as':_0x389b('0x11f')});db[_0x389b('0x157')]['belongsToMany'](db[_0x389b('0x6c')],{'through':_0x389b('0x18c'),'as':_0x389b('0x120')});db[_0x389b('0x157')][_0x389b('0x115')](db[_0x389b('0x53')],{'through':_0x389b('0x1d1'),'as':_0x389b('0x121')});db[_0x389b('0x157')][_0x389b('0x115')](db[_0x389b('0x123')],{'through':_0x389b('0x17b'),'as':_0x389b('0x124')});db[_0x389b('0x157')][_0x389b('0x115')](db[_0x389b('0x5f')],{'through':_0x389b('0x181'),'as':'OpenchannelQueues'});db[_0x389b('0x157')]['belongsToMany'](db[_0x389b('0xfb')],{'through':_0x389b('0x1d2'),'as':_0x389b('0x126')});db[_0x389b('0xde')][_0x389b('0x103')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x389b('0x196')});db[_0x389b('0xde')][_0x389b('0x103')](db[_0x389b('0x193')],{'as':_0x389b('0x106'),'foreignKey':_0x389b('0x196')});db['Campaign'][_0x389b('0x103')](db[_0x389b('0x107')],{'as':_0x389b('0x13b'),'foreignKey':_0x389b('0x196')});db[_0x389b('0xde')][_0x389b('0x103')](db['CmHopperBlack'],{'as':_0x389b('0x13c'),'foreignKey':_0x389b('0x196')});db[_0x389b('0xde')]['belongsTo'](db[_0x389b('0x13e')],{'as':_0x389b('0x13e'),'foreignKey':_0x389b('0x13f')});db[_0x389b('0xde')][_0x389b('0x10f')](db[_0x389b('0x13e')],{'as':_0x389b('0x140'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x389b('0x10f')](db[_0x389b('0x82')],{'as':_0x389b('0x82'),'foreignKey':'IntervalId'});db['Campaign'][_0x389b('0x10f')](db[_0x389b('0xd8')],{'as':_0x389b('0xd8'),'foreignKey':_0x389b('0x1d3')});db[_0x389b('0xde')][_0x389b('0x115')](db[_0x389b('0x127')],{'as':'Lists','through':_0x389b('0x1d4')});db[_0x389b('0xde')][_0x389b('0x115')](db[_0x389b('0x127')],{'as':_0x389b('0x146'),'through':_0x389b('0x1d5')});db[_0x389b('0xe2')][_0x389b('0x10f')](db[_0x389b('0x6a')],{'as':_0x389b('0x6a'),'foreignKey':_0x389b('0x165')});db['MailTransferReport'][_0x389b('0x10f')](db[_0x389b('0x15a')],{});db['MailTransferReport']['belongsTo'](db[_0x389b('0x46')],{});db[_0x389b('0xe4')][_0x389b('0x10f')](db[_0x389b('0x41')],{'foreignKey':_0x389b('0x1d6'),'as':_0x389b('0x1d7')});db[_0x389b('0xe4')][_0x389b('0x10f')](db[_0x389b('0x14')],{'foreignKey':_0x389b('0x1d8'),'as':_0x389b('0x1d9')});db[_0x389b('0xe4')]['belongsTo'](db['User'],{'foreignKey':_0x389b('0x1da'),'as':'ToAgent'});db[_0x389b('0xe4')]['belongsTo'](db[_0x389b('0x43')],{'foreignKey':_0x389b('0x1db'),'as':_0x389b('0x1dc')});db[_0x389b('0xe4')][_0x389b('0x10f')](db[_0x389b('0x41')],{'foreignKey':_0x389b('0x1dd'),'as':_0x389b('0x1de')});db[_0x389b('0xe6')][_0x389b('0x10f')](db[_0x389b('0x68')],{});db[_0x389b('0xe6')]['belongsTo'](db[_0x389b('0x66')],{});db['ChatTransferReport'][_0x389b('0x10f')](db[_0x389b('0x61')],{'foreignKey':'FromChatWebsiteId','as':_0x389b('0x1d7')});db['ChatTransferReport']['belongsTo'](db[_0x389b('0x14')],{'foreignKey':_0x389b('0x1d8'),'as':_0x389b('0x1d9')});db[_0x389b('0xe6')][_0x389b('0x10f')](db[_0x389b('0x14')],{'foreignKey':_0x389b('0x1da'),'as':_0x389b('0x1df')});db[_0x389b('0xe6')]['belongsTo'](db[_0x389b('0x6c')],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db[_0x389b('0xe6')][_0x389b('0x10f')](db[_0x389b('0x61')],{'foreignKey':_0x389b('0x1e0'),'as':'ToAccount'});db[_0x389b('0x1e1')]['belongsTo'](db[_0x389b('0x51')],{});db[_0x389b('0x1e1')][_0x389b('0x10f')](db[_0x389b('0x50')],{});db[_0x389b('0x1e1')]['belongsTo'](db[_0x389b('0x16d')],{'foreignKey':_0x389b('0x1e2'),'as':'FromAccount'});db[_0x389b('0x1e1')]['belongsTo'](db[_0x389b('0x14')],{'foreignKey':_0x389b('0x1d8'),'as':_0x389b('0x1d9')});db[_0x389b('0x1e1')][_0x389b('0x10f')](db[_0x389b('0x14')],{'foreignKey':_0x389b('0x1da'),'as':'ToAgent'});db['FaxTransferReport']['belongsTo'](db[_0x389b('0x53')],{'foreignKey':_0x389b('0x1e3'),'as':'ToQueue'});db[_0x389b('0x1e1')][_0x389b('0x10f')](db[_0x389b('0x16d')],{'foreignKey':_0x389b('0x1e4'),'as':_0x389b('0x1de')});db[_0x389b('0x1e5')][_0x389b('0x10f')](db[_0x389b('0x17d')],{});db[_0x389b('0x1e5')][_0x389b('0x10f')](db[_0x389b('0x11b')],{});db['OpenchannelTransferReport'][_0x389b('0x10f')](db[_0x389b('0x5b')],{'foreignKey':_0x389b('0x1e6'),'as':_0x389b('0x1d7')});db[_0x389b('0x1e5')][_0x389b('0x10f')](db[_0x389b('0x14')],{'foreignKey':'FromUserId','as':_0x389b('0x1d9')});db[_0x389b('0x1e5')][_0x389b('0x10f')](db[_0x389b('0x14')],{'foreignKey':'ToUserId','as':_0x389b('0x1df')});db['OpenchannelTransferReport'][_0x389b('0x10f')](db['OpenchannelQueue'],{'foreignKey':'ToOpenchannelQueueId','as':_0x389b('0x1dc')});db[_0x389b('0x1e5')][_0x389b('0x10f')](db[_0x389b('0x5b')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db[_0x389b('0xea')][_0x389b('0x10f')](db[_0x389b('0x177')],{});db[_0x389b('0xea')][_0x389b('0x10f')](db[_0x389b('0x10a')],{});db['SmsTransferReport'][_0x389b('0x10f')](db[_0x389b('0x56')],{'foreignKey':'FromSmsAccountId','as':_0x389b('0x1d7')});db['SmsTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x389b('0x1d8'),'as':_0x389b('0x1d9')});db[_0x389b('0xea')][_0x389b('0x10f')](db[_0x389b('0x14')],{'foreignKey':_0x389b('0x1da'),'as':_0x389b('0x1df')});db['SmsTransferReport']['belongsTo'](db[_0x389b('0x123')],{'foreignKey':_0x389b('0x1e7'),'as':_0x389b('0x1dc')});db[_0x389b('0xea')][_0x389b('0x10f')](db[_0x389b('0x56')],{'foreignKey':_0x389b('0x1e8'),'as':_0x389b('0x1de')});db[_0x389b('0x127')]['hasMany'](db[_0x389b('0x7e')],{'as':_0x389b('0x14f'),'foreignKey':_0x389b('0x153')});db[_0x389b('0x127')][_0x389b('0x103')](db[_0x389b('0x79')],{'as':_0x389b('0x1e9'),'foreignKey':_0x389b('0x153')});db[_0x389b('0x127')]['hasMany'](db[_0x389b('0x15c')],{'as':'Contacts','onDelete':_0x389b('0x102'),'foreignKey':'ListId'});db['CmList']['hasMany'](db[_0x389b('0x193')],{'as':_0x389b('0x106'),'foreignKey':_0x389b('0x153')});db[_0x389b('0x127')][_0x389b('0x103')](db[_0x389b('0x107')],{'as':_0x389b('0x108'),'foreignKey':'ListId'});db[_0x389b('0x127')][_0x389b('0x103')](db['ReportAgentPreview'],{'as':_0x389b('0x77'),'foreignKey':_0x389b('0x153')});db[_0x389b('0x127')][_0x389b('0x115')](db[_0x389b('0x1f')],{'as':_0x389b('0x1ea'),'through':_0x389b('0x144')});db[_0x389b('0x127')][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x145'),'through':'cm_user_has_lists'});db[_0x389b('0xed')][_0x389b('0x103')](db[_0x389b('0x1b')],{'as':_0x389b('0x19f'),'onDelete':_0x389b('0x102')});db[_0x389b('0xed')][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x145'),'through':_0x389b('0x1eb')});db[_0x389b('0xee')][_0x389b('0x103')](db[_0x389b('0x14')],{'as':_0x389b('0x162'),'foreignKey':_0x389b('0x110')});db[_0x389b('0xee')][_0x389b('0x103')](db[_0x389b('0x1ec')],{'as':'UserProfileSections','foreignKey':'userProfileId','onDelete':'cascade'});db['UserProfileSection']['hasMany'](db[_0x389b('0x1ed')],{'as':_0x389b('0x1ee'),'foreignKey':_0x389b('0x1ef'),'onDelete':_0x389b('0x102')});db[_0x389b('0xf4')][_0x389b('0x103')](db[_0x389b('0x7e')],{'as':_0x389b('0x14f'),'foreignKey':_0x389b('0x1f0')});db[_0x389b('0xf4')][_0x389b('0x103')](db[_0x389b('0x7d')],{'as':_0x389b('0x150'),'foreignKey':_0x389b('0x1f0')});db['WhatsappAccount'][_0x389b('0x103')](db['WhatsappMessage'],{'as':_0x389b('0x170'),'foreignKey':_0x389b('0x1f0')});db[_0x389b('0xf4')]['hasMany'](db[_0x389b('0xf7')],{'as':_0x389b('0x151')});db[_0x389b('0xf4')][_0x389b('0x103')](db[_0x389b('0xf5')],{'as':_0x389b('0x136')});db[_0x389b('0xf4')]['belongsTo'](db[_0x389b('0x127')],{'as':_0x389b('0x152'),'foreignKey':_0x389b('0x153')});db[_0x389b('0xf4')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x389b('0x143')});db['WhatsappAccount']['belongsToMany'](db[_0x389b('0x14')],{'as':_0x389b('0x145'),'through':_0x389b('0x131')});db['WhatsappApplication'][_0x389b('0x10f')](db[_0x389b('0x14')],{'onDelete':_0x389b('0x166')});db['WhatsappApplication'][_0x389b('0x10f')](db[_0x389b('0xfb')],{'onDelete':_0x389b('0x166')});db[_0x389b('0xf5')]['belongsTo'](db['WhatsappAccount'],{'onDelete':_0x389b('0x166')});db['WhatsappApplication'][_0x389b('0x10f')](db[_0x389b('0x82')],{'onDelete':'restrict','foreignKey':_0x389b('0x168')});db[_0x389b('0xf5')][_0x389b('0x10f')](db[_0x389b('0x15e')],{'onDelete':_0x389b('0x166'),'foreignKey':'TagId'});db['WhatsappInteraction'][_0x389b('0x103')](db[_0x389b('0x1f1')],{'as':_0x389b('0x170'),'onDelete':_0x389b('0x102'),'foreignKey':_0x389b('0x1f2')});db[_0x389b('0xf7')][_0x389b('0x10f')](db[_0x389b('0xf4')],{'as':_0x389b('0x164'),'foreignKey':'WhatsappAccountId'});db[_0x389b('0xf7')][_0x389b('0x10f')](db[_0x389b('0x15c')],{'as':'Contact','foreignKey':_0x389b('0x16b')});db[_0x389b('0xf7')][_0x389b('0x10f')](db[_0x389b('0x14')],{'as':_0x389b('0x15d'),'foreignKey':'UserId'});db[_0x389b('0xf7')][_0x389b('0x115')](db[_0x389b('0x15e')],{'through':'whatsapp_interaction_has_tags','as':_0x389b('0x160')});db[_0x389b('0xf7')][_0x389b('0x115')](db['Tag'],{'through':_0x389b('0x1a5'),'as':_0x389b('0x161')});db[_0x389b('0xf7')][_0x389b('0x115')](db[_0x389b('0x14')],{'as':_0x389b('0x162'),'through':_0x389b('0x1f3'),'foreignKey':'WhatsappInteractionId'});db[_0x389b('0x1f1')]['belongsTo'](db[_0x389b('0x14')],{'as':'User'});db[_0x389b('0x1f1')][_0x389b('0x10f')](db[_0x389b('0x15c')],{'onDelete':_0x389b('0x102'),'as':_0x389b('0x14d')});db[_0x389b('0x1f1')][_0x389b('0x10f')](db[_0x389b('0xf7')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x389b('0x1f2')});db[_0x389b('0x1f1')][_0x389b('0x10f')](db[_0x389b('0xf4')],{'as':_0x389b('0x164'),'foreignKey':_0x389b('0x1f0')});db[_0x389b('0x1f4')][_0x389b('0x10f')](db[_0x389b('0xf4')],{});db[_0x389b('0x1f4')]['belongsTo'](db[_0x389b('0x127')],{'as':_0x389b('0x152'),'foreignKey':_0x389b('0x153')});db[_0x389b('0x1f4')][_0x389b('0x10f')](db[_0x389b('0x15c')],{'as':_0x389b('0x14d'),'foreignKey':_0x389b('0x16b')});db[_0x389b('0x1f4')][_0x389b('0x10f')](db[_0x389b('0xf7')],{});db['WhatsappQueueReport'][_0x389b('0x10f')](db[_0x389b('0xfb')],{});db['WhatsappQueueReport'][_0x389b('0x10f')](db[_0x389b('0x1f1')],{});db['WhatsappQueueReport'][_0x389b('0x10f')](db['User'],{});db[_0x389b('0x1f5')][_0x389b('0x10f')](db['WhatsappMessage'],{});db[_0x389b('0x1f5')][_0x389b('0x10f')](db[_0x389b('0xf7')],{});db[_0x389b('0x1f5')][_0x389b('0x10f')](db[_0x389b('0xf4')],{'foreignKey':'FromWhatsappAccountId','as':'FromAccount'});db[_0x389b('0x1f5')][_0x389b('0x10f')](db[_0x389b('0xf4')],{'foreignKey':_0x389b('0x1f6'),'as':_0x389b('0x1de')});db[_0x389b('0x1f5')][_0x389b('0x10f')](db['WhatsappQueue'],{'foreignKey':_0x389b('0x1f7'),'as':_0x389b('0x1dc')});db['WhatsappTransferReport'][_0x389b('0x10f')](db[_0x389b('0x14')],{'foreignKey':_0x389b('0x1d8'),'as':_0x389b('0x1d9')});db[_0x389b('0x1f5')][_0x389b('0x10f')](db[_0x389b('0x14')],{'foreignKey':_0x389b('0x1da'),'as':_0x389b('0x1df')});db[_0x389b('0xfb')][_0x389b('0x115')](db[_0x389b('0x14')],{'as':'Agents','through':_0x389b('0x1f8'),'foreignKey':_0x389b('0x1f9')});db[_0x389b('0xfb')]['belongsToMany'](db[_0x389b('0x157')],{'through':_0x389b('0x1d2'),'as':_0x389b('0x159')});module[_0x389b('0x1fa')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 2234f8a..57b4ff7 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x99fd=['./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','./api/campaign','/api/attachments','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/auth/google','./api/authGoogle','/api/jira','/api/rpc','./api/rpc','/api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','3.0.0','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','route','resolve','get','appPath','password','newPassword','lastName','street','mobile','fax','email','clientId','clientSecret','accessKey','token','channelSecret','accessToken','accessTokenSecret','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','registry','isPlainObject','isArray','length','replace','@@{','lodash','path','./errors','./config/environment','api','./config/logger','auth','default','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','method','headers','x-forwarded-for','connection','statusCode','responseTime','user','name','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','role','other','agent_name','url','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/messages','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_final','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./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/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings'];(function(_0x178e46,_0x279575){var _0x3a3a71=function(_0x5f5819){while(--_0x5f5819){_0x178e46['push'](_0x178e46['shift']());}};_0x3a3a71(++_0x279575);}(_0x99fd,0x67));var _0xd99f=function(_0x2a4d7f,_0x1714ea){_0x2a4d7f=_0x2a4d7f-0x0;var _0x3eeb75=_0x99fd[_0x2a4d7f];return _0x3eeb75;};'use strict';var _=require(_0xd99f('0x0'));var path=require(_0xd99f('0x1'));var express=require('express');var ewinston=require('express-winston');var util=require('util');var errors=require(_0xd99f('0x2'));var config=require(_0xd99f('0x3'));var logger=require('./config/logger')(_0xd99f('0x4'));var authLogger=require(_0xd99f('0x5'))(_0xd99f('0x6'));exports[_0xd99f('0x7')]=function(_0x554875){_0x554875[_0xd99f('0x8')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x53b7c7,_0x5c37bc){var _0x32790d=_0xd99f('0x9');if(!_[_0xd99f('0xa')](_0x53b7c7[_0xd99f('0xb')])){_0x32790d+=_0xd99f('0xc');var _0x42ad6a=_0x53b7c7[_0xd99f('0xb')];maskSensitiveData(_0x42ad6a);}return util['format'](_0x32790d,_0x53b7c7[_0xd99f('0xd')],_0x53b7c7[_0xd99f('0xe')]['x-forwarded-for']?_0x53b7c7['headers'][_0xd99f('0xf')]:_0x53b7c7[_0xd99f('0x10')]['remoteAddress']||_0x53b7c7['ip'],_0x53b7c7['url'],_0x5c37bc[_0xd99f('0x11')],_0x5c37bc[_0xd99f('0x12')],_0x53b7c7['user']?_0x53b7c7['user']['id']:null,_0x53b7c7[_0xd99f('0x13')]?_0x53b7c7[_0xd99f('0x13')][_0xd99f('0x14')]:null,_0x53b7c7['user']?_0x53b7c7[_0xd99f('0x13')]['role']:null,_0x42ad6a?util[_0xd99f('0x15')](_0x42ad6a,![],null):'');}}));_0x554875[_0xd99f('0x8')](ewinston[_0xd99f('0x16')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x91d515,_0xa2b880){var _0x321d4e=_0xd99f('0x17');if(_0x91d515[_0xd99f('0xb')]&&_0x91d515[_0xd99f('0xb')][_0xd99f('0x18')]&&_0x91d515['body'][_0xd99f('0x19')]){_0x321d4e=_0xd99f('0x1a');}return util['format'](_0x321d4e,_0x91d515[_0xd99f('0xd')],_0x91d515[_0xd99f('0xe')]['x-forwarded-for']?_0x91d515[_0xd99f('0xe')][_0xd99f('0xf')]:_0x91d515[_0xd99f('0x10')]['remoteAddress']||_0x91d515['ip'],_0x91d515['url'],_0xa2b880['statusCode'],_0xa2b880[_0xd99f('0x12')],_0x91d515['user']?_0x91d515[_0xd99f('0x13')]['id']:null,_0x91d515[_0xd99f('0x13')]?_0x91d515[_0xd99f('0x13')][_0xd99f('0x14')]:null,_0x91d515[_0xd99f('0x13')]?_0x91d515[_0xd99f('0x13')][_0xd99f('0x1b')]:null,_0x91d515[_0xd99f('0xb')]&&_0x91d515[_0xd99f('0xb')][_0xd99f('0x18')]?_0x91d515['body'][_0xd99f('0x18')]:_0xd99f('0x1c'),_0x91d515[_0xd99f('0xb')]&&_0x91d515['body'][_0xd99f('0x19')]?_0x91d515[_0xd99f('0xb')]['agent_id']:'',_0x91d515[_0xd99f('0xb')]&&_0x91d515[_0xd99f('0xb')][_0xd99f('0x1d')]?_0x91d515['body'][_0xd99f('0x1d')]:'');},'ignoreRoute':function(_0x2df09d){var _0x39610a=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x39610a['test'](_0x2df09d[_0xd99f('0x1e')]);}}));_0x554875[_0xd99f('0x8')](_0xd99f('0x1f'),require(_0xd99f('0x20')));_0x554875[_0xd99f('0x8')](_0xd99f('0x21'),require(_0xd99f('0x22')));_0x554875['use'](_0xd99f('0x23'),require('./api/voiceContext'));_0x554875['use']('/api/voice/extensions',require('./api/voiceExtension'));_0x554875['use'](_0xd99f('0x24'),require('./api/voiceMusicOnHold'));_0x554875[_0xd99f('0x8')](_0xd99f('0x25'),require(_0xd99f('0x26')));_0x554875['use'](_0xd99f('0x27'),require(_0xd99f('0x28')));_0x554875[_0xd99f('0x8')](_0xd99f('0x29'),require(_0xd99f('0x2a')));_0x554875[_0xd99f('0x8')](_0xd99f('0x2b'),require(_0xd99f('0x2c')));_0x554875[_0xd99f('0x8')](_0xd99f('0x2d'),require(_0xd99f('0x2e')));_0x554875['use']('/api/voice/calls/reports',require(_0xd99f('0x2f')));_0x554875[_0xd99f('0x8')]('/api/voice/dials/reports',require(_0xd99f('0x30')));_0x554875[_0xd99f('0x8')](_0xd99f('0x31'),require(_0xd99f('0x32')));_0x554875[_0xd99f('0x8')](_0xd99f('0x33'),require(_0xd99f('0x34')));_0x554875[_0xd99f('0x8')](_0xd99f('0x35'),require(_0xd99f('0x36')));_0x554875[_0xd99f('0x8')](_0xd99f('0x37'),require('./api/trunk'));_0x554875[_0xd99f('0x8')](_0xd99f('0x38'),require('./api/voiceTransferReport'));_0x554875[_0xd99f('0x8')]('/api/mail/out_servers',require(_0xd99f('0x39')));_0x554875[_0xd99f('0x8')](_0xd99f('0x3a'),require('./api/mailAccount'));_0x554875[_0xd99f('0x8')](_0xd99f('0x3b'),require(_0xd99f('0x3c')));_0x554875[_0xd99f('0x8')](_0xd99f('0x3d'),require(_0xd99f('0x3e')));_0x554875[_0xd99f('0x8')](_0xd99f('0x3f'),require(_0xd99f('0x40')));_0x554875['use']('/api/mail/messages',require(_0xd99f('0x41')));_0x554875['use']('/api/mail/applications',require(_0xd99f('0x42')));_0x554875[_0xd99f('0x8')](_0xd99f('0x43'),require(_0xd99f('0x44')));_0x554875[_0xd99f('0x8')]('/api/dashboards',require(_0xd99f('0x45')));_0x554875[_0xd99f('0x8')](_0xd99f('0x46'),require(_0xd99f('0x47')));_0x554875[_0xd99f('0x8')]('/api/fax/accounts',require('./api/faxAccount'));_0x554875[_0xd99f('0x8')](_0xd99f('0x48'),require('./api/faxApplication'));_0x554875[_0xd99f('0x8')](_0xd99f('0x49'),require(_0xd99f('0x4a')));_0x554875[_0xd99f('0x8')](_0xd99f('0x4b'),require('./api/faxMessage'));_0x554875['use'](_0xd99f('0x4c'),require(_0xd99f('0x4d')));_0x554875[_0xd99f('0x8')]('/api/fax/reports/queue',require(_0xd99f('0x4e')));_0x554875[_0xd99f('0x8')](_0xd99f('0x4f'),require(_0xd99f('0x50')));_0x554875[_0xd99f('0x8')]('/api/sms/applications',require('./api/smsApplication'));_0x554875[_0xd99f('0x8')]('/api/sms/interactions',require('./api/smsInteraction'));_0x554875[_0xd99f('0x8')](_0xd99f('0x51'),require('./api/smsMessage'));_0x554875[_0xd99f('0x8')](_0xd99f('0x52'),require('./api/smsQueue'));_0x554875['use'](_0xd99f('0x53'),require(_0xd99f('0x54')));_0x554875[_0xd99f('0x8')](_0xd99f('0x55'),require(_0xd99f('0x56')));_0x554875[_0xd99f('0x8')](_0xd99f('0x57'),require('./api/openchannelInteraction'));_0x554875[_0xd99f('0x8')](_0xd99f('0x58'),require('./api/openchannelMessage'));_0x554875[_0xd99f('0x8')](_0xd99f('0x59'),require(_0xd99f('0x5a')));_0x554875[_0xd99f('0x8')](_0xd99f('0x5b'),require(_0xd99f('0x5c')));_0x554875['use'](_0xd99f('0x5d'),require(_0xd99f('0x5e')));_0x554875[_0xd99f('0x8')](_0xd99f('0x5f'),require('./api/chatApplication'));_0x554875[_0xd99f('0x8')](_0xd99f('0x60'),require(_0xd99f('0x61')));_0x554875[_0xd99f('0x8')](_0xd99f('0x62'),require('./api/chatMessage'));_0x554875[_0xd99f('0x8')](_0xd99f('0x63'),require(_0xd99f('0x64')));_0x554875[_0xd99f('0x8')](_0xd99f('0x65'),require(_0xd99f('0x66')));_0x554875['use'](_0xd99f('0x67'),require(_0xd99f('0x68')));_0x554875[_0xd99f('0x8')](_0xd99f('0x69'),require('./api/chatProactiveAction'));_0x554875[_0xd99f('0x8')](_0xd99f('0x6a'),require('./api/cmCompany'));_0x554875[_0xd99f('0x8')](_0xd99f('0x6b'),require('./api/cmContact'));_0x554875[_0xd99f('0x8')](_0xd99f('0x6c'),require(_0xd99f('0x6d')));_0x554875[_0xd99f('0x8')]('/api/cm/hopper_black',require('./api/cmHopperBlack'));_0x554875[_0xd99f('0x8')](_0xd99f('0x6e'),require('./api/cmHopperFinal'));_0x554875[_0xd99f('0x8')]('/api/cm/hopper_history',require(_0xd99f('0x6f')));_0x554875[_0xd99f('0x8')](_0xd99f('0x70'),require(_0xd99f('0x71')));_0x554875[_0xd99f('0x8')](_0xd99f('0x72'),require(_0xd99f('0x73')));_0x554875[_0xd99f('0x8')](_0xd99f('0x74'),require(_0xd99f('0x75')));_0x554875[_0xd99f('0x8')](_0xd99f('0x76'),require(_0xd99f('0x77')));_0x554875[_0xd99f('0x8')](_0xd99f('0x78'),require(_0xd99f('0x79')));_0x554875[_0xd99f('0x8')](_0xd99f('0x7a'),require(_0xd99f('0x7b')));_0x554875[_0xd99f('0x8')](_0xd99f('0x7c'),require(_0xd99f('0x7d')));_0x554875[_0xd99f('0x8')](_0xd99f('0x7e'),require(_0xd99f('0x7f')));_0x554875[_0xd99f('0x8')]('/api/cdr',require(_0xd99f('0x80')));_0x554875['use'](_0xd99f('0x81'),require(_0xd99f('0x82')));_0x554875['use'](_0xd99f('0x83'),require(_0xd99f('0x84')));_0x554875['use']('/api/sounds',require(_0xd99f('0x85')));_0x554875['use']('/api/tags',require(_0xd99f('0x86')));_0x554875[_0xd99f('0x8')](_0xd99f('0x87'),require(_0xd99f('0x88')));_0x554875[_0xd99f('0x8')](_0xd99f('0x89'),require(_0xd99f('0x8a')));_0x554875[_0xd99f('0x8')]('/api/variables',require('./api/variable'));_0x554875[_0xd99f('0x8')](_0xd99f('0x8b'),require(_0xd99f('0x8c')));_0x554875[_0xd99f('0x8')](_0xd99f('0x8d'),require('./api/integrationReport'));_0x554875[_0xd99f('0x8')](_0xd99f('0x8e'),require(_0xd99f('0x8f')));_0x554875[_0xd99f('0x8')](_0xd99f('0x90'),require(_0xd99f('0x91')));_0x554875[_0xd99f('0x8')](_0xd99f('0x92'),require(_0xd99f('0x93')));_0x554875[_0xd99f('0x8')](_0xd99f('0x94'),require(_0xd99f('0x95')));_0x554875[_0xd99f('0x8')](_0xd99f('0x96'),require(_0xd99f('0x97')));_0x554875[_0xd99f('0x8')](_0xd99f('0x98'),require(_0xd99f('0x99')));_0x554875['use'](_0xd99f('0x9a'),require(_0xd99f('0x9b')));_0x554875['use'](_0xd99f('0x9c'),require(_0xd99f('0x9d')));_0x554875[_0xd99f('0x8')](_0xd99f('0x9e'),require('./api/intSalesforceField'));_0x554875[_0xd99f('0x8')]('/api/integrations/sugarcrm/accounts',require(_0xd99f('0x9f')));_0x554875[_0xd99f('0x8')](_0xd99f('0xa0'),require(_0xd99f('0xa1')));_0x554875[_0xd99f('0x8')](_0xd99f('0xa2'),require(_0xd99f('0xa3')));_0x554875[_0xd99f('0x8')](_0xd99f('0xa4'),require(_0xd99f('0xa5')));_0x554875[_0xd99f('0x8')](_0xd99f('0xa6'),require(_0xd99f('0xa7')));_0x554875[_0xd99f('0x8')](_0xd99f('0xa8'),require(_0xd99f('0xa9')));_0x554875['use']('/api/integrations/zoho/accounts',require(_0xd99f('0xaa')));_0x554875[_0xd99f('0x8')](_0xd99f('0xab'),require(_0xd99f('0xac')));_0x554875[_0xd99f('0x8')]('/api/integrations/zoho/fields',require(_0xd99f('0xad')));_0x554875[_0xd99f('0x8')](_0xd99f('0xae'),require('./api/intZendeskAccount'));_0x554875[_0xd99f('0x8')](_0xd99f('0xaf'),require(_0xd99f('0xb0')));_0x554875[_0xd99f('0x8')](_0xd99f('0xb1'),require(_0xd99f('0xb2')));_0x554875[_0xd99f('0x8')](_0xd99f('0xb3'),require('./api/intFreshdeskAccount'));_0x554875[_0xd99f('0x8')](_0xd99f('0xb4'),require('./api/intFreshdeskConfiguration'));_0x554875[_0xd99f('0x8')](_0xd99f('0xb5'),require('./api/intFreshdeskField'));_0x554875[_0xd99f('0x8')](_0xd99f('0xb6'),require('./api/intVtigerAccount'));_0x554875[_0xd99f('0x8')](_0xd99f('0xb7'),require(_0xd99f('0xb8')));_0x554875[_0xd99f('0x8')](_0xd99f('0xb9'),require(_0xd99f('0xba')));_0x554875[_0xd99f('0x8')](_0xd99f('0xbb'),require('./api/intServicenowAccount'));_0x554875[_0xd99f('0x8')](_0xd99f('0xbc'),require(_0xd99f('0xbd')));_0x554875['use'](_0xd99f('0xbe'),require(_0xd99f('0xbf')));_0x554875[_0xd99f('0x8')](_0xd99f('0xc0'),require(_0xd99f('0xc1')));_0x554875[_0xd99f('0x8')](_0xd99f('0xc2'),require('./api/intDynamics365Configuration'));_0x554875['use'](_0xd99f('0xc3'),require(_0xd99f('0xc4')));_0x554875[_0xd99f('0x8')](_0xd99f('0xc5'),require(_0xd99f('0xc6')));_0x554875[_0xd99f('0x8')](_0xd99f('0xc7'),require(_0xd99f('0xc8')));_0x554875[_0xd99f('0x8')]('/api/integrations/freshsales/fields',require('./api/intFreshsalesField'));_0x554875[_0xd99f('0x8')](_0xd99f('0xc9'),require(_0xd99f('0xca')));_0x554875[_0xd99f('0x8')](_0xd99f('0xcb'),require(_0xd99f('0xcc')));_0x554875['use']('/api/chat/internal/messages',require(_0xd99f('0xcd')));_0x554875[_0xd99f('0x8')](_0xd99f('0xce'),require('./api/jscriptyAnswerReport'));_0x554875[_0xd99f('0x8')](_0xd99f('0xcf'),require(_0xd99f('0xd0')));_0x554875[_0xd99f('0x8')](_0xd99f('0xd1'),require(_0xd99f('0xd2')));_0x554875[_0xd99f('0x8')]('/api/sms/reports/queue',require(_0xd99f('0xd3')));_0x554875[_0xd99f('0x8')](_0xd99f('0xd4'),require(_0xd99f('0xd5')));_0x554875[_0xd99f('0x8')](_0xd99f('0xd6'),require('./api/squareReportDetail'));_0x554875[_0xd99f('0x8')](_0xd99f('0xd7'),require(_0xd99f('0xd8')));_0x554875['use'](_0xd99f('0xd9'),require(_0xd99f('0xda')));_0x554875[_0xd99f('0x8')](_0xd99f('0xdb'),require(_0xd99f('0xdc')));_0x554875[_0xd99f('0x8')]('/api/square/projects',require(_0xd99f('0xdd')));_0x554875[_0xd99f('0x8')](_0xd99f('0xde'),require('./api/squareRecording'));_0x554875[_0xd99f('0x8')](_0xd99f('0xdf'),require(_0xd99f('0xe0')));_0x554875[_0xd99f('0x8')](_0xd99f('0xe1'),require(_0xd99f('0xe2')));_0x554875[_0xd99f('0x8')](_0xd99f('0xe3'),require(_0xd99f('0xe4')));_0x554875[_0xd99f('0x8')]('/api/campaigns',require(_0xd99f('0xe5')));_0x554875['use']('/api/migrations',require('./api/migration'));_0x554875[_0xd99f('0x8')](_0xd99f('0xe6'),require(_0xd99f('0xe7')));_0x554875[_0xd99f('0x8')](_0xd99f('0xe8'),require('./api/plugin'));_0x554875[_0xd99f('0x8')](_0xd99f('0xe9'),require(_0xd99f('0xea')));_0x554875[_0xd99f('0x8')](_0xd99f('0xeb'),require('./api/chatTransferReport'));_0x554875[_0xd99f('0x8')](_0xd99f('0xec'),require('./api/faxTransferReport'));_0x554875[_0xd99f('0x8')](_0xd99f('0xed'),require(_0xd99f('0xee')));_0x554875['use'](_0xd99f('0xef'),require(_0xd99f('0xf0')));_0x554875['use']('/api/cm/lists',require(_0xd99f('0xf1')));_0x554875[_0xd99f('0x8')](_0xd99f('0xf2'),require(_0xd99f('0xf3')));_0x554875[_0xd99f('0x8')](_0xd99f('0xf4'),require('./api/userProfile'));_0x554875['use'](_0xd99f('0xf5'),require(_0xd99f('0xf6')));_0x554875[_0xd99f('0x8')](_0xd99f('0xf7'),require('./api/userProfileResource'));_0x554875['use'](_0xd99f('0xf8'),require('./api/userNotification'));_0x554875[_0xd99f('0x8')](_0xd99f('0xf9'),require(_0xd99f('0xfa')));_0x554875[_0xd99f('0x8')](_0xd99f('0xfb'),require(_0xd99f('0xfc')));_0x554875[_0xd99f('0x8')](_0xd99f('0xfd'),require(_0xd99f('0xfe')));_0x554875[_0xd99f('0x8')](_0xd99f('0xff'),require(_0xd99f('0x100')));_0x554875[_0xd99f('0x8')](_0xd99f('0x101'),require('./api/whatsappQueueReport'));_0x554875[_0xd99f('0x8')](_0xd99f('0x102'),require(_0xd99f('0x103')));_0x554875[_0xd99f('0x8')](_0xd99f('0x104'),require(_0xd99f('0x105')));_0x554875[_0xd99f('0x8')]('/api/cloudProviders',require(_0xd99f('0x106')));_0x554875[_0xd99f('0x8')]('/api/auth/local',require('./api/authLocal'));_0x554875[_0xd99f('0x8')](_0xd99f('0x107'),require(_0xd99f('0x108')));_0x554875['use'](_0xd99f('0x109'),require('./api/jira'));_0x554875[_0xd99f('0x8')](_0xd99f('0x10a'),require(_0xd99f('0x10b')));_0x554875['use'](_0xd99f('0x10c'),require('./api/version'));_0x554875[_0xd99f('0x8')](_0xd99f('0x10d'),require('./api/system'));_0x554875[_0xd99f('0x8')](_0xd99f('0x10e'),require(_0xd99f('0x10f')));_0x554875['use'](_0xd99f('0x110'),require(_0xd99f('0x111')));_0x554875['use'](_0xd99f('0x112'),express[_0xd99f('0x113')](path[_0xd99f('0x114')](config[_0xd99f('0x115')],_0xd99f('0x112'))));_0x554875[_0xd99f('0x8')](_0xd99f('0x116'),express['static'](path['join'](config['root'],'/www')));_0x554875[_0xd99f('0x8')](_0xd99f('0x117'),express['static'](path[_0xd99f('0x114')](config['root'],_0xd99f('0x117'))));_0x554875['use']('/snippet',express[_0xd99f('0x113')](path[_0xd99f('0x114')](config[_0xd99f('0x115')],'snippet',_0xd99f('0x118'))));_0x554875[_0xd99f('0x8')](_0xd99f('0x119'),express[_0xd99f('0x113')](path[_0xd99f('0x114')](config[_0xd99f('0x115')],_0xd99f('0x11a'))));_0x554875['route'](_0xd99f('0x11b'))['get'](errors[0x194]);_0x554875[_0xd99f('0x11c')]('/*')['get'](function(_0x154ae0,_0x3e8086){_0x3e8086['sendFile'](path[_0xd99f('0x11d')](_0x554875[_0xd99f('0x11e')](_0xd99f('0x11f'))+'/index.html'));});};var sensitiveFields=['username',_0xd99f('0x120'),_0xd99f('0x121'),'apiKey','firstName',_0xd99f('0x122'),_0xd99f('0x123'),'phone',_0xd99f('0x124'),_0xd99f('0x125'),_0xd99f('0x126'),_0xd99f('0x127'),_0xd99f('0x128'),'securityToken','code',_0xd99f('0x129'),'tenantId',_0xd99f('0x12a'),_0xd99f('0x12b'),_0xd99f('0x12c'),_0xd99f('0x12d'),'authToken','consumerKey',_0xd99f('0x12e'),_0xd99f('0x12f'),_0xd99f('0x130'),_0xd99f('0x131'),_0xd99f('0x132'),_0xd99f('0x133'),_0xd99f('0x134'),'privateKey',_0xd99f('0x135'),_0xd99f('0x136'),_0xd99f('0x137'),_0xd99f('0x13'),_0xd99f('0x138'),_0xd99f('0x139'),_0xd99f('0x13a'),'dsn','secret',_0xd99f('0x13b'),'oldPassword'];function maskSensitiveData(_0x391833){var _0x2600de=/(?!^)[\s\S](?!$)/g;if(!_[_0xd99f('0x13c')](_0x391833))return;for(var _0x9b9745 in _0x391833){if(_[_0xd99f('0x13d')](_0x391833[_0x9b9745])){for(var _0x1ac7f3=0x0;_0x1ac7f3<_0x391833[_0x9b9745][_0xd99f('0x13e')];_0x1ac7f3++){maskSensitiveData(_0x391833[_0x9b9745][_0x1ac7f3]);}}else if(_[_0xd99f('0x13c')](_0x391833[_0x9b9745])){maskSensitiveData(_0x391833[_0x9b9745]);}else if(_['isString'](_0x391833[_0x9b9745])){_0x391833[_0x9b9745]=_0x391833[_0x9b9745][_0xd99f('0x13f')](/{{{/g,_0xd99f('0x140'))['replace'](/}}}/g,'}@@')[_0xd99f('0x13f')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x9b9745)){_0x391833[_0x9b9745]=_0x391833[_0x9b9745]['replace'](_0x2600de,'*');}}}} \ No newline at end of file +var _0xdda2=['./api/variable','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','./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/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/recordings','/api/square/messages','./api/squareMessage','./api/team','./api/license','/api/campaigns','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','/api/jira','./api/jira','/api/rpc','/api/version','/api/system','./api/system','./api/pm2','/api/webbar','./api/webbar','/apidoc','root','/www','static','join','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','appPath','/index.html','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','code','tenantId','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','registry','isArray','length','isPlainObject','isString','replace','@@{','}@@','includes','lodash','path','express','express-winston','util','./errors','./config/environment','./config/logger','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','remoteAddress','statusCode','user','name','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','connection','url','responseTime','agent_id','agent_name','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/triggers','./api/trigger','/api/variables'];(function(_0x5639bc,_0x2a84a7){var _0x2d83f1=function(_0x2b3d9b){while(--_0x2b3d9b){_0x5639bc['push'](_0x5639bc['shift']());}};_0x2d83f1(++_0x2a84a7);}(_0xdda2,0xbd));var _0x2dda=function(_0x4c9d24,_0x3eb4ce){_0x4c9d24=_0x4c9d24-0x0;var _0xcb0cda=_0xdda2[_0x4c9d24];return _0xcb0cda;};'use strict';var _=require(_0x2dda('0x0'));var path=require(_0x2dda('0x1'));var express=require(_0x2dda('0x2'));var ewinston=require(_0x2dda('0x3'));var util=require(_0x2dda('0x4'));var errors=require(_0x2dda('0x5'));var config=require(_0x2dda('0x6'));var logger=require(_0x2dda('0x7'))('api');var authLogger=require(_0x2dda('0x7'))(_0x2dda('0x8'));exports[_0x2dda('0x9')]=function(_0x54af73){_0x54af73[_0x2dda('0xa')](ewinston[_0x2dda('0xb')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x1bdb81,_0x3e140b){var _0x50a1e3=_0x2dda('0xc');if(!_[_0x2dda('0xd')](_0x1bdb81[_0x2dda('0xe')])){_0x50a1e3+=_0x2dda('0xf');var _0x20e478=_0x1bdb81['body'];maskSensitiveData(_0x20e478);}return util[_0x2dda('0x10')](_0x50a1e3,_0x1bdb81[_0x2dda('0x11')],_0x1bdb81[_0x2dda('0x12')][_0x2dda('0x13')]?_0x1bdb81[_0x2dda('0x12')][_0x2dda('0x13')]:_0x1bdb81['connection'][_0x2dda('0x14')]||_0x1bdb81['ip'],_0x1bdb81['url'],_0x3e140b[_0x2dda('0x15')],_0x3e140b['responseTime'],_0x1bdb81[_0x2dda('0x16')]?_0x1bdb81[_0x2dda('0x16')]['id']:null,_0x1bdb81['user']?_0x1bdb81[_0x2dda('0x16')][_0x2dda('0x17')]:null,_0x1bdb81[_0x2dda('0x16')]?_0x1bdb81[_0x2dda('0x16')][_0x2dda('0x18')]:null,_0x20e478?util[_0x2dda('0x19')](_0x20e478,![],null):'');}}));_0x54af73[_0x2dda('0xa')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0xb1ce17,_0x5520f2){var _0x49a944=_0x2dda('0x1a');if(_0xb1ce17[_0x2dda('0xe')]&&_0xb1ce17['body'][_0x2dda('0x1b')]&&_0xb1ce17['body']['agent_id']){_0x49a944=_0x2dda('0x1c');}return util[_0x2dda('0x10')](_0x49a944,_0xb1ce17[_0x2dda('0x11')],_0xb1ce17[_0x2dda('0x12')][_0x2dda('0x13')]?_0xb1ce17[_0x2dda('0x12')][_0x2dda('0x13')]:_0xb1ce17[_0x2dda('0x1d')]['remoteAddress']||_0xb1ce17['ip'],_0xb1ce17[_0x2dda('0x1e')],_0x5520f2['statusCode'],_0x5520f2[_0x2dda('0x1f')],_0xb1ce17[_0x2dda('0x16')]?_0xb1ce17[_0x2dda('0x16')]['id']:null,_0xb1ce17['user']?_0xb1ce17[_0x2dda('0x16')][_0x2dda('0x17')]:null,_0xb1ce17[_0x2dda('0x16')]?_0xb1ce17['user'][_0x2dda('0x18')]:null,_0xb1ce17[_0x2dda('0xe')]&&_0xb1ce17[_0x2dda('0xe')][_0x2dda('0x1b')]?_0xb1ce17[_0x2dda('0xe')][_0x2dda('0x1b')]:'other',_0xb1ce17[_0x2dda('0xe')]&&_0xb1ce17['body'][_0x2dda('0x20')]?_0xb1ce17['body'][_0x2dda('0x20')]:'',_0xb1ce17['body']&&_0xb1ce17[_0x2dda('0xe')][_0x2dda('0x21')]?_0xb1ce17['body']['agent_name']:'');},'ignoreRoute':function(_0x468626){var _0x5d22d4=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5d22d4['test'](_0x468626[_0x2dda('0x1e')]);}}));_0x54af73[_0x2dda('0xa')](_0x2dda('0x22'),require(_0x2dda('0x23')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x24'),require('./api/voiceChanSpy'));_0x54af73[_0x2dda('0xa')](_0x2dda('0x25'),require(_0x2dda('0x26')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x27'),require(_0x2dda('0x28')));_0x54af73['use'](_0x2dda('0x29'),require(_0x2dda('0x2a')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x2b'),require(_0x2dda('0x2c')));_0x54af73['use'](_0x2dda('0x2d'),require(_0x2dda('0x2e')));_0x54af73[_0x2dda('0xa')]('/api/screen/recordings',require(_0x2dda('0x2f')));_0x54af73['use'](_0x2dda('0x30'),require(_0x2dda('0x31')));_0x54af73['use'](_0x2dda('0x32'),require(_0x2dda('0x33')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x34'),require(_0x2dda('0x35')));_0x54af73[_0x2dda('0xa')]('/api/voice/dials/reports',require(_0x2dda('0x36')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x37'),require(_0x2dda('0x38')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x39'),require(_0x2dda('0x3a')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x3b'),require('./api/memberReport'));_0x54af73['use'](_0x2dda('0x3c'),require('./api/trunk'));_0x54af73[_0x2dda('0xa')]('/api/voice/transfers/reports',require(_0x2dda('0x3d')));_0x54af73['use'](_0x2dda('0x3e'),require(_0x2dda('0x3f')));_0x54af73['use']('/api/mail/accounts',require(_0x2dda('0x40')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x41'),require(_0x2dda('0x42')));_0x54af73[_0x2dda('0xa')]('/api/mail/substatuses',require(_0x2dda('0x43')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x44'),require(_0x2dda('0x45')));_0x54af73['use'](_0x2dda('0x46'),require('./api/mailMessage'));_0x54af73[_0x2dda('0xa')](_0x2dda('0x47'),require(_0x2dda('0x48')));_0x54af73['use'](_0x2dda('0x49'),require(_0x2dda('0x4a')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x4b'),require(_0x2dda('0x4c')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x4d'),require(_0x2dda('0x4e')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x4f'),require(_0x2dda('0x50')));_0x54af73['use']('/api/fax/applications',require('./api/faxApplication'));_0x54af73['use'](_0x2dda('0x51'),require(_0x2dda('0x52')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x53'),require(_0x2dda('0x54')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x55'),require(_0x2dda('0x56')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x57'),require(_0x2dda('0x58')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x59'),require(_0x2dda('0x5a')));_0x54af73['use'](_0x2dda('0x5b'),require(_0x2dda('0x5c')));_0x54af73['use'](_0x2dda('0x5d'),require(_0x2dda('0x5e')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x5f'),require(_0x2dda('0x60')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x61'),require(_0x2dda('0x62')));_0x54af73[_0x2dda('0xa')]('/api/openchannel/accounts',require(_0x2dda('0x63')));_0x54af73['use'](_0x2dda('0x64'),require(_0x2dda('0x65')));_0x54af73[_0x2dda('0xa')]('/api/openchannel/interactions',require(_0x2dda('0x66')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x67'),require('./api/openchannelMessage'));_0x54af73[_0x2dda('0xa')](_0x2dda('0x68'),require('./api/openchannelQueue'));_0x54af73['use']('/api/chat/websites',require(_0x2dda('0x69')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x6a'),require(_0x2dda('0x6b')));_0x54af73['use'](_0x2dda('0x6c'),require(_0x2dda('0x6d')));_0x54af73['use'](_0x2dda('0x6e'),require(_0x2dda('0x6f')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x70'),require('./api/chatMessage'));_0x54af73[_0x2dda('0xa')](_0x2dda('0x71'),require(_0x2dda('0x72')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x73'),require(_0x2dda('0x74')));_0x54af73['use']('/api/chat/groups',require(_0x2dda('0x75')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x76'),require(_0x2dda('0x77')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x78'),require('./api/cmCompany'));_0x54af73[_0x2dda('0xa')](_0x2dda('0x79'),require(_0x2dda('0x7a')));_0x54af73['use'](_0x2dda('0x7b'),require(_0x2dda('0x7c')));_0x54af73['use'](_0x2dda('0x7d'),require(_0x2dda('0x7e')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x7f'),require(_0x2dda('0x80')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x81'),require(_0x2dda('0x82')));_0x54af73['use'](_0x2dda('0x83'),require(_0x2dda('0x84')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x85'),require(_0x2dda('0x86')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x87'),require(_0x2dda('0x88')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x89'),require(_0x2dda('0x8a')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x8b'),require(_0x2dda('0x8c')));_0x54af73[_0x2dda('0xa')]('/api/conditions',require(_0x2dda('0x8d')));_0x54af73['use'](_0x2dda('0x8e'),require(_0x2dda('0x8f')));_0x54af73[_0x2dda('0xa')]('/api/pauses',require(_0x2dda('0x90')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x91'),require(_0x2dda('0x92')));_0x54af73['use'](_0x2dda('0x93'),require('./api/voiceQueuesLog'));_0x54af73['use'](_0x2dda('0x94'),require(_0x2dda('0x95')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x96'),require(_0x2dda('0x97')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x98'),require(_0x2dda('0x99')));_0x54af73[_0x2dda('0xa')]('/api/templates',require('./api/template'));_0x54af73[_0x2dda('0xa')](_0x2dda('0x9a'),require(_0x2dda('0x9b')));_0x54af73['use'](_0x2dda('0x9c'),require(_0x2dda('0x9d')));_0x54af73['use'](_0x2dda('0x9e'),require(_0x2dda('0x9f')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xa0'),require('./api/integrationReport'));_0x54af73[_0x2dda('0xa')](_0x2dda('0xa1'),require(_0x2dda('0xa2')));_0x54af73['use'](_0x2dda('0xa3'),require(_0x2dda('0xa4')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xa5'),require('./api/analyticExtractedReport'));_0x54af73[_0x2dda('0xa')](_0x2dda('0xa6'),require(_0x2dda('0xa7')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xa8'),require(_0x2dda('0xa9')));_0x54af73[_0x2dda('0xa')]('/api/analytics/tree_reports',require(_0x2dda('0xaa')));_0x54af73[_0x2dda('0xa')]('/api/integrations/salesforce/accounts',require(_0x2dda('0xab')));_0x54af73['use'](_0x2dda('0xac'),require(_0x2dda('0xad')));_0x54af73['use']('/api/integrations/salesforce/fields',require(_0x2dda('0xae')));_0x54af73['use'](_0x2dda('0xaf'),require(_0x2dda('0xb0')));_0x54af73[_0x2dda('0xa')]('/api/integrations/sugarcrm/configurations',require(_0x2dda('0xb1')));_0x54af73[_0x2dda('0xa')]('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0x54af73[_0x2dda('0xa')](_0x2dda('0xb2'),require(_0x2dda('0xb3')));_0x54af73[_0x2dda('0xa')]('/api/integrations/desk/configurations',require(_0x2dda('0xb4')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xb5'),require(_0x2dda('0xb6')));_0x54af73[_0x2dda('0xa')]('/api/integrations/zoho/accounts',require(_0x2dda('0xb7')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xb8'),require(_0x2dda('0xb9')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xba'),require(_0x2dda('0xbb')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xbc'),require(_0x2dda('0xbd')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xbe'),require(_0x2dda('0xbf')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xc0'),require(_0x2dda('0xc1')));_0x54af73[_0x2dda('0xa')]('/api/integrations/freshdesk/accounts',require(_0x2dda('0xc2')));_0x54af73[_0x2dda('0xa')]('/api/integrations/freshdesk/configurations',require(_0x2dda('0xc3')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xc4'),require(_0x2dda('0xc5')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xc6'),require(_0x2dda('0xc7')));_0x54af73['use']('/api/integrations/vtiger/configurations',require(_0x2dda('0xc8')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xc9'),require(_0x2dda('0xca')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xcb'),require(_0x2dda('0xcc')));_0x54af73[_0x2dda('0xa')]('/api/integrations/servicenow/configurations',require('./api/intServicenowConfiguration'));_0x54af73['use'](_0x2dda('0xcd'),require(_0x2dda('0xce')));_0x54af73['use']('/api/integrations/dynamics365/accounts',require(_0x2dda('0xcf')));_0x54af73[_0x2dda('0xa')]('/api/integrations/dynamics365/configurations',require(_0x2dda('0xd0')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xd1'),require(_0x2dda('0xd2')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xd3'),require(_0x2dda('0xd4')));_0x54af73[_0x2dda('0xa')]('/api/integrations/freshsales/configurations',require(_0x2dda('0xd5')));_0x54af73['use'](_0x2dda('0xd6'),require(_0x2dda('0xd7')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xd8'),require(_0x2dda('0xd9')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xda'),require('./api/chatQueueReport'));_0x54af73[_0x2dda('0xa')](_0x2dda('0xdb'),require(_0x2dda('0xdc')));_0x54af73[_0x2dda('0xa')]('/api/jscripty/answers/reports',require(_0x2dda('0xdd')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xde'),require(_0x2dda('0xdf')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xe0'),require('./api/jscriptySessionReport'));_0x54af73[_0x2dda('0xa')](_0x2dda('0xe1'),require(_0x2dda('0xe2')));_0x54af73['use']('/api/square/reports',require(_0x2dda('0xe3')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xe4'),require('./api/squareReportDetail'));_0x54af73[_0x2dda('0xa')](_0x2dda('0xe5'),require(_0x2dda('0xe6')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xe7'),require(_0x2dda('0xe8')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xe9'),require(_0x2dda('0xea')));_0x54af73[_0x2dda('0xa')]('/api/square/projects',require('./api/squareProject'));_0x54af73[_0x2dda('0xa')](_0x2dda('0xeb'),require('./api/squareRecording'));_0x54af73[_0x2dda('0xa')](_0x2dda('0xec'),require(_0x2dda('0xed')));_0x54af73[_0x2dda('0xa')]('/api/teams',require(_0x2dda('0xee')));_0x54af73[_0x2dda('0xa')]('/api/license',require(_0x2dda('0xef')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xf0'),require('./api/campaign'));_0x54af73[_0x2dda('0xa')](_0x2dda('0xf1'),require(_0x2dda('0xf2')));_0x54af73['use'](_0x2dda('0xf3'),require(_0x2dda('0xf4')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xf5'),require(_0x2dda('0xf6')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xf7'),require(_0x2dda('0xf8')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xf9'),require(_0x2dda('0xfa')));_0x54af73[_0x2dda('0xa')](_0x2dda('0xfb'),require(_0x2dda('0xfc')));_0x54af73[_0x2dda('0xa')]('/api/openchannel/reports/transfer',require('./api/openchannelTransferReport'));_0x54af73['use'](_0x2dda('0xfd'),require('./api/smsTransferReport'));_0x54af73[_0x2dda('0xa')](_0x2dda('0xfe'),require(_0x2dda('0xff')));_0x54af73[_0x2dda('0xa')]('/api/voice/prefixes',require(_0x2dda('0x100')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x101'),require('./api/userProfile'));_0x54af73[_0x2dda('0xa')](_0x2dda('0x102'),require(_0x2dda('0x103')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x104'),require(_0x2dda('0x105')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x106'),require(_0x2dda('0x107')));_0x54af73[_0x2dda('0xa')]('/api/whatsapp/accounts',require(_0x2dda('0x108')));_0x54af73['use'](_0x2dda('0x109'),require(_0x2dda('0x10a')));_0x54af73['use'](_0x2dda('0x10b'),require(_0x2dda('0x10c')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x10d'),require(_0x2dda('0x10e')));_0x54af73['use'](_0x2dda('0x10f'),require(_0x2dda('0x110')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x111'),require('./api/whatsappTransferReport'));_0x54af73[_0x2dda('0xa')](_0x2dda('0x112'),require(_0x2dda('0x113')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x114'),require(_0x2dda('0x115')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x116'),require(_0x2dda('0x117')));_0x54af73['use'](_0x2dda('0x118'),require('./api/authGoogle'));_0x54af73['use'](_0x2dda('0x119'),require(_0x2dda('0x11a')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x11b'),require('./api/rpc'));_0x54af73[_0x2dda('0xa')](_0x2dda('0x11c'),require('./api/version'));_0x54af73['use'](_0x2dda('0x11d'),require(_0x2dda('0x11e')));_0x54af73[_0x2dda('0xa')]('/api/pm2',require(_0x2dda('0x11f')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x120'),require(_0x2dda('0x121')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x122'),express['static'](path['join'](config[_0x2dda('0x123')],_0x2dda('0x122'))));_0x54af73['use'](_0x2dda('0x124'),express[_0x2dda('0x125')](path[_0x2dda('0x126')](config['root'],_0x2dda('0x124'))));_0x54af73[_0x2dda('0xa')](_0x2dda('0x127'),express[_0x2dda('0x125')](path[_0x2dda('0x126')](config[_0x2dda('0x123')],'/demo')));_0x54af73[_0x2dda('0xa')](_0x2dda('0x128'),express[_0x2dda('0x125')](path['join'](config['root'],_0x2dda('0x129'),'3.0.0')));_0x54af73['use'](_0x2dda('0x12a'),express[_0x2dda('0x125')](path[_0x2dda('0x126')](config[_0x2dda('0x123')],_0x2dda('0x12b'))));_0x54af73[_0x2dda('0x12c')](_0x2dda('0x12d'))['get'](errors[0x194]);_0x54af73[_0x2dda('0x12c')]('/*')['get'](function(_0x1f0815,_0x557d72){_0x557d72['sendFile'](path['resolve'](_0x54af73[_0x2dda('0x12e')](_0x2dda('0x12f'))+_0x2dda('0x130')));});};var sensitiveFields=[_0x2dda('0x131'),_0x2dda('0x132'),_0x2dda('0x133'),_0x2dda('0x134'),_0x2dda('0x135'),_0x2dda('0x136'),_0x2dda('0x137'),_0x2dda('0x138'),_0x2dda('0x139'),_0x2dda('0x13a'),_0x2dda('0x13b'),_0x2dda('0x13c'),_0x2dda('0x13d'),_0x2dda('0x13e'),_0x2dda('0x13f'),'accessKey',_0x2dda('0x140'),'token','channelSecret',_0x2dda('0x141'),'accessTokenSecret',_0x2dda('0x142'),'consumerKey',_0x2dda('0x143'),_0x2dda('0x144'),_0x2dda('0x145'),'calleridnum',_0x2dda('0x146'),_0x2dda('0x147'),_0x2dda('0x148'),_0x2dda('0x149'),_0x2dda('0x14a'),_0x2dda('0x14b'),_0x2dda('0x14c'),_0x2dda('0x16'),_0x2dda('0x14d'),_0x2dda('0x14e'),_0x2dda('0x14f'),_0x2dda('0x150'),'secret',_0x2dda('0x151'),'oldPassword'];function maskSensitiveData(_0x1cbcc9){var _0x367511=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x1cbcc9))return;for(var _0x195e72 in _0x1cbcc9){if(_[_0x2dda('0x152')](_0x1cbcc9[_0x195e72])){for(var _0x32dc06=0x0;_0x32dc06<_0x1cbcc9[_0x195e72][_0x2dda('0x153')];_0x32dc06++){maskSensitiveData(_0x1cbcc9[_0x195e72][_0x32dc06]);}}else if(_[_0x2dda('0x154')](_0x1cbcc9[_0x195e72])){maskSensitiveData(_0x1cbcc9[_0x195e72]);}else if(_[_0x2dda('0x155')](_0x1cbcc9[_0x195e72])){_0x1cbcc9[_0x195e72]=_0x1cbcc9[_0x195e72][_0x2dda('0x156')](/{{{/g,_0x2dda('0x157'))[_0x2dda('0x156')](/}}}/g,_0x2dda('0x158'))[_0x2dda('0x156')](/{{/g,'@{')[_0x2dda('0x156')](/}}/g,'}@');if(_[_0x2dda('0x159')](sensitiveFields,_0x195e72)){_0x1cbcc9[_0x195e72]=_0x1cbcc9[_0x195e72]['replace'](_0x367511,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 672bdf5..86a91c3 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbfc0=['../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.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','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.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/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc'];(function(_0x3fd3a3,_0x36c863){var _0xa3e4d5=function(_0x1fd03b){while(--_0x1fd03b){_0x3fd3a3['push'](_0x3fd3a3['shift']());}};_0xa3e4d5(++_0x36c863);}(_0xbfc0,0x72));var _0x0bfc=function(_0x5b64a1,_0x2ec810){_0x5b64a1=_0x5b64a1-0x0;var _0x4b6f55=_0xbfc0[_0x5b64a1];return _0x4b6f55;};'use strict';var jayson=require(_0x0bfc('0x0'));var BPromise=require(_0x0bfc('0x1'));var _=require('lodash');var config=require('../config/environment');exports[_0x0bfc('0x2')]=function(){return new BPromise(function(_0x540f4f,_0x395119){var _0x299be7={};_0x299be7=_['merge'](_0x299be7,require(_0x0bfc('0x3')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x5')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x6')));_0x299be7=_['merge'](_0x299be7,require('../api/voiceRecording/voiceRecording.rpc'));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x299be7=_['merge'](_0x299be7,require(_0x0bfc('0x7')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x8')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x9')));_0x299be7=_['merge'](_0x299be7,require(_0x0bfc('0xa')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require('../api/mailServerIn/mailServerIn.rpc'));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0xb')));_0x299be7=_['merge'](_0x299be7,require(_0x0bfc('0xc')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require('../api/mailInteraction/mailInteraction.rpc'));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0xd')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0xe')));_0x299be7=_['merge'](_0x299be7,require(_0x0bfc('0xf')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x10')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require('../api/faxApplication/faxApplication.rpc'));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x11')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x12')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require('../api/faxQueue/faxQueue.rpc'));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x13')));_0x299be7=_['merge'](_0x299be7,require(_0x0bfc('0x14')));_0x299be7=_['merge'](_0x299be7,require('../api/smsMessage/smsMessage.rpc'));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x15')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x16')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x17')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x18')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x19')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x1a')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x1b')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x1c')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x1d')));_0x299be7=_['merge'](_0x299be7,require(_0x0bfc('0x1e')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require('../api/cmHopper/cmHopper.rpc'));_0x299be7=_['merge'](_0x299be7,require(_0x0bfc('0x1f')));_0x299be7=_['merge'](_0x299be7,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x20')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x21')));_0x299be7=_['merge'](_0x299be7,require(_0x0bfc('0x22')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x23')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require('../api/template/template.rpc'));_0x299be7=_['merge'](_0x299be7,require(_0x0bfc('0x24')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x25')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x26')));_0x299be7=_['merge'](_0x299be7,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x27')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x28')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x29')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x2a')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x2b')));_0x299be7=_['merge'](_0x299be7,require(_0x0bfc('0x2c')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x2d')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x2e')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x299be7=_['merge'](_0x299be7,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require('../api/squareReport/squareReport.rpc'));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x2f')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x30')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x31')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x32')));_0x299be7=_['merge'](_0x299be7,require(_0x0bfc('0x33')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x34')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x35')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x36')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x37')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x38')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x39')));_0x299be7=_['merge'](_0x299be7,require(_0x0bfc('0x3a')));_0x299be7=_[_0x0bfc('0x4')](_0x299be7,require(_0x0bfc('0x3b')));var _0x3a6b14=jayson[_0x0bfc('0x3c')](_0x299be7)['http']();var _0x100af9=config[_0x0bfc('0x3d')][_0x0bfc('0x3e')]||config[_0x0bfc('0x3e')]+0x1;var _0x41f29f=config[_0x0bfc('0x3d')]['ip']||'localhost';_0x3a6b14['on'](_0x0bfc('0x3f'),function(_0x4a8183){return _0x395119(_0x4a8183);});_0x3a6b14[_0x0bfc('0x2')](_0x100af9,_0x41f29f,function(){console[_0x0bfc('0x40')](_0x0bfc('0x41'),_0x41f29f,_0x100af9);require(_0x0bfc('0x42'))[_0x0bfc('0x43')]();return _0x540f4f(_0x0bfc('0x44')+_0x41f29f+':'+_0x100af9);});});}; \ No newline at end of file +var _0xaceb=['../api/chatQueue/chatQueue.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/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc'];(function(_0x576d8a,_0x2d7bde){var _0x3dc3ef=function(_0xc76758){while(--_0xc76758){_0x576d8a['push'](_0x576d8a['shift']());}};_0x3dc3ef(++_0x2d7bde);}(_0xaceb,0x190));var _0xbace=function(_0x4b6800,_0x315e58){_0x4b6800=_0x4b6800-0x0;var _0x48f4cb=_0xaceb[_0x4b6800];return _0x48f4cb;};'use strict';var jayson=require(_0xbace('0x0'));var BPromise=require(_0xbace('0x1'));var _=require('lodash');var config=require('../config/environment');exports[_0xbace('0x2')]=function(){return new BPromise(function(_0x33ef95,_0x598c1d){var _0x29356a={};_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x4')));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x5')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x6')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require('../api/voiceRecording/voiceRecording.rpc'));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x7')));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x8')));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x9')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0xa')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0xb')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0xc')));_0x29356a=_['merge'](_0x29356a,require('../api/mailServerIn/mailServerIn.rpc'));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0xd')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0xe')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0xf')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x10')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require('../api/mailApplication/mailApplication.rpc'));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x11')));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x12')));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x13')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require('../api/faxInteraction/faxInteraction.rpc'));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x14')));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x15')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x16')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x17')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require('../api/smsInteraction/smsInteraction.rpc'));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x18')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require('../api/smsQueue/smsQueue.rpc'));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x19')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x1a')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x1b')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x1c')));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x1d')));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x1e')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x1f')));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x20')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require('../api/cmContact/cmContact.rpc'));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x21')));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x22')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x23')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x24')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x25')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x26')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require('../api/sound/sound.rpc'));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x27')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x28')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x29')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x2a')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x2b')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x2c')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x2d')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x2e')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x2f')));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x30')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x31')));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x32')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x33')));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x34')));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x35')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x36')));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x37')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x38')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x39')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x3a')));_0x29356a=_['merge'](_0x29356a,require('../api/attachment/attachment.rpc'));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x3b')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x29356a=_[_0xbace('0x3')](_0x29356a,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x29356a=_['merge'](_0x29356a,require(_0xbace('0x3c')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x3d')));_0x29356a=_[_0xbace('0x3')](_0x29356a,require(_0xbace('0x3e')));var _0x1bbcfe=jayson[_0xbace('0x3f')](_0x29356a)[_0xbace('0x40')]();var _0x1e5ed4=config[_0xbace('0x41')]['port']||config['port']+0x1;var _0x3fcadf=config[_0xbace('0x41')]['ip']||_0xbace('0x42');_0x1bbcfe['on'](_0xbace('0x43'),function(_0xb2d197){return _0x598c1d(_0xb2d197);});_0x1bbcfe[_0xbace('0x2')](_0x1e5ed4,_0x3fcadf,function(){console[_0xbace('0x44')](_0xbace('0x45'),_0x3fcadf,_0x1e5ed4);require(_0xbace('0x46'))['default']();return _0x33ef95(_0xbace('0x47')+_0x3fcadf+':'+_0x1e5ed4);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 674a2eb..7ec9b61 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 _0xa9e0=['utf8','setTimeout','setEncoding','ready','line','toLowerCase','hangup','emit','520\x20End\x20of\x20proper','function','substring','replace','result=','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','write','inherits','prototype','sendRequest','command','sync','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','label','exports','util','lodash','events','./error','call'];(function(_0xde0ee0,_0x29d046){var _0x416307=function(_0x3cf21f){while(--_0x3cf21f){_0xde0ee0['push'](_0xde0ee0['shift']());}};_0x416307(++_0x29d046);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x0a9e('0x3'));function AGIChannel(_0x4ce2f1){var _0x333808=this,_0x432180=new AGIReply(),_0x2ab90b=![],_0x991246={};EventEmitter[_0x0a9e('0x4')](_0x333808);_0x4ce2f1['setEncoding'](_0x0a9e('0x5'));_0x4ce2f1[_0x0a9e('0x6')](0x8*0x3c*0x3c*0x3e8);_0x432180[_0x0a9e('0x7')]('utf8');_0x432180['on']('headers',function(_0xe42b77){for(var _0x56465b in _0xe42b77){_0x333808[_0x56465b]=_0xe42b77[_0x56465b];}_0x333808['emit'](_0x0a9e('0x8'));});_0x432180['on'](_0x0a9e('0x9'),function(_0x307b3e){if(_0x307b3e[_0x0a9e('0xa')]()==_0x0a9e('0xb')){_0x333808[_0x0a9e('0xc')]('hangup');return;}if(_0x307b3e['substring'](0x0,0xb)=='520-Invalid'){_0x2ab90b=!![];}if(_0x2ab90b){_0x991246['rx']+=_0x307b3e+'\x0a';if(_0x307b3e['search'](_0x0a9e('0xd'))!=-0x1){_0x2ab90b=![];}}else{_0x991246['rx']=_0x307b3e;}if(_0x2ab90b){return;}if(typeof _0x991246['cb']==_0x0a9e('0xe')){var _0xd5b662=_0x991246['rx'][_0x0a9e('0xf')](0x0,0x3),_0x26d672=null,_0x32d742=null;_0xd5b662=parseInt(_0xd5b662);if(isNaN(_0xd5b662)){_0x991246['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0xd5b662!=0xc8){_0x991246['cb'](null,{'code':_0xd5b662,'result':-0x1,'extra':'KO'});return;}_0x26d672=_0x991246['rx'][_0x0a9e('0xf')](0x4)[_0x0a9e('0x10')](_0x0a9e('0x11'),'');if(_0x26d672[_0x0a9e('0x12')]('\x20')!=-0x1){_0x26d672=_0x26d672[_0x0a9e('0x13')](0x0,_0x26d672[_0x0a9e('0x12')]('\x20'));}if(_['startsWith'](_0x26d672,'-1')){_0x26d672=parseInt(_0x26d672);}_0x32d742=_0x991246['rx'][_0x0a9e('0x14')]('\x20');if(_0x32d742['length']==0x3){_0x32d742=_0x32d742[0x2][_0x0a9e('0xf')](0x1,_0x32d742[0x2]['length']-0x1);}else if(_0x32d742[_0x0a9e('0x15')]>0x3){var _0x12066b=/\((.+)\)/;var _0x48f32d=_0x991246['rx'][_0x0a9e('0x16')](_0x12066b);if(_0x48f32d){_0x32d742=_0x48f32d[0x1];}else{_0x32d742=null;}}else{_0x32d742=null;}_0x991246['cb'](null,{'code':_0xd5b662,'result':_0x26d672,'extra':_0x32d742});}});_0x4ce2f1['on']('error',function(_0x459eb1){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x17'),new AGIError(_0x0a9e('0x18'),_0x459eb1[_0x0a9e('0x19')]));});_0x4ce2f1['on'](_0x0a9e('0x1a'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1a'),new AGIError(_0x0a9e('0x1b')));});_0x4ce2f1['on'](_0x0a9e('0x1c'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x4ce2f1[_0x0a9e('0x1d')]();});_0x4ce2f1[_0x0a9e('0x1e')](_0x432180);this['command']=function(_0x20f109,_0x5a09ef){var _0x20f109=_0x20f109||'',_0x5a09ef=typeof _0x5a09ef==_0x0a9e('0xe')?_0x5a09ef:new Function();_0x991246={'tx':_0x20f109,'rx':'','cb':_0x5a09ef};_0x4ce2f1[_0x0a9e('0x1f')](_0x20f109+'\x0a');},this[_0x0a9e('0x1a')]=function(){_0x4ce2f1['destroy']();};}util[_0x0a9e('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x22')]=function(_0x4d00e6){return this[_0x0a9e('0x23')][_0x0a9e('0x24')](this,_0x4d00e6);};AGIChannel[_0x0a9e('0x21')]['answer']=function(){return this['sendRequest'](_0x0a9e('0x25'));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x26')]=function(_0x33161b,_0x526cf3,_0x384319){_0x33161b=_0x33161b===undefined?'beep':_0x33161b;_0x526cf3=_0x526cf3===undefined?'5':_0x526cf3;_0x384319=_0x384319===undefined?'1':_0x384319;return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x27'),_0x33161b,_0x526cf3*0x3e8,_0x384319));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x28')]=function(_0x14433c){_0x14433c=_0x14433c||_0x0a9e('0x29');return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2b'),_0x14433c));};AGIChannel['prototype'][_0x0a9e('0x2c')]=function(_0x468813,_0x2b1f27){if(_[_0x0a9e('0x2d')](_0x2b1f27)){return this['sendRequest'](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27[_0x0a9e('0x2f')](',')));}return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x30')]=function(_0x1dbde2){return this['sendRequest'](util[_0x0a9e('0x2a')]('SET\x20CONTEXT\x20%s',_0x1dbde2));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x31')]=function(_0x1122db){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20EXTENSION\x20%s',_0x1122db));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x32')]=function(_0x40cb85){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x33'),_0x40cb85));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0xb')]=function(){return this['sendRequest'](_0x0a9e('0x34'));};AGIChannel['prototype'][_0x0a9e('0x35')]=function(_0x14b13f,_0x2b7e7f){var _0x3f3d41=_['isBoolean'](_0x2b7e7f)||_[_0x0a9e('0x36')](_0x2b7e7f)?_0x2b7e7f[_0x0a9e('0x37')]():_0x2b7e7f;return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x14b13f,_0x3f3d41?_0x3f3d41['toString']()[_0x0a9e('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x0a9e('0x38')]=function(_0x3d9717,_0x381c37){return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x39'),_0x3d9717,_0x381c37));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3a')]=function(_0x533942,_0x1dbf74){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SAY\x20DIGITS\x20%s\x20%s',_0x533942,_0x1dbf74));};AGIChannel['prototype'][_0x0a9e('0x3b')]=function(_0x40d766,_0x5adda1){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3c'),_0x40d766,_0x5adda1));};AGIChannel[_0x0a9e('0x21')]['continueAt']=function(_0x5a594b,_0x15e37d,_0x45b3d0){_0x15e37d=_0x15e37d||this['extension'];_0x45b3d0=_0x45b3d0||0x1;this[_0x0a9e('0x30')](_0x5a594b);this[_0x0a9e('0x31')](_0x15e37d);this[_0x0a9e('0x32')](_0x45b3d0);return this['noop'](util[_0x0a9e('0x2a')](_0x0a9e('0x3d'),_0x5a594b,_0x15e37d,_0x45b3d0));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3e')]=function(_0x13cb1f){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3f'),_0x13cb1f));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x40')]=function(_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x37f6cc,_0x4d04c8){_0x148007=_0x148007||'wav';_0x1a7bce=_0x1a7bce||'';_0x11ca30=_0x11ca30===undefined?-0x1:_0x11ca30==='-1'?-0x1:_0x11ca30*0x3e8;_0x37f6cc=_0x37f6cc===undefined?'':'s='+_0x37f6cc;_0x4d04c8=_0x4d04c8?_0x0a9e('0x41'):'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x42'),_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x4d04c8,_0x37f6cc));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x43')]=function(_0x10b040,_0x445e25){_0x445e25=_0x445e25||'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x44'),_0x10b040,_0x445e25));};AGIChannel[_0x0a9e('0x21')]['agi']=function(_0x117c99){return this[_0x0a9e('0x2c')](_0x0a9e('0x45'),_0x117c99);};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x46')]=function(_0xbe9d19){return this[_0x0a9e('0x2c')](_0x0a9e('0x47'),_0xbe9d19);};AGIChannel['prototype'][_0x0a9e('0x17')]=function(_0x48fd45,_0x473dc8){this[_0x0a9e('0x28')](util[_0x0a9e('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x48fd45['id'],_0x48fd45[_0x0a9e('0x48')],_0x473dc8));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x0a9e('0x49')]=AGIChannel; \ No newline at end of file +var _0xa9e0=['utf8','setTimeout','setEncoding','ready','line','toLowerCase','hangup','emit','520\x20End\x20of\x20proper','function','substring','replace','result=','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','write','inherits','prototype','sendRequest','command','sync','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','label','exports','util','lodash','events','./error','call'];(function(_0x38877e,_0x2bf44c){var _0x4ed8f0=function(_0x4c4eb1){while(--_0x4c4eb1){_0x38877e['push'](_0x38877e['shift']());}};_0x4ed8f0(++_0x2bf44c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x0a9e('0x3'));function AGIChannel(_0x4ce2f1){var _0x333808=this,_0x432180=new AGIReply(),_0x2ab90b=![],_0x991246={};EventEmitter[_0x0a9e('0x4')](_0x333808);_0x4ce2f1['setEncoding'](_0x0a9e('0x5'));_0x4ce2f1[_0x0a9e('0x6')](0x8*0x3c*0x3c*0x3e8);_0x432180[_0x0a9e('0x7')]('utf8');_0x432180['on']('headers',function(_0xe42b77){for(var _0x56465b in _0xe42b77){_0x333808[_0x56465b]=_0xe42b77[_0x56465b];}_0x333808['emit'](_0x0a9e('0x8'));});_0x432180['on'](_0x0a9e('0x9'),function(_0x307b3e){if(_0x307b3e[_0x0a9e('0xa')]()==_0x0a9e('0xb')){_0x333808[_0x0a9e('0xc')]('hangup');return;}if(_0x307b3e['substring'](0x0,0xb)=='520-Invalid'){_0x2ab90b=!![];}if(_0x2ab90b){_0x991246['rx']+=_0x307b3e+'\x0a';if(_0x307b3e['search'](_0x0a9e('0xd'))!=-0x1){_0x2ab90b=![];}}else{_0x991246['rx']=_0x307b3e;}if(_0x2ab90b){return;}if(typeof _0x991246['cb']==_0x0a9e('0xe')){var _0xd5b662=_0x991246['rx'][_0x0a9e('0xf')](0x0,0x3),_0x26d672=null,_0x32d742=null;_0xd5b662=parseInt(_0xd5b662);if(isNaN(_0xd5b662)){_0x991246['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0xd5b662!=0xc8){_0x991246['cb'](null,{'code':_0xd5b662,'result':-0x1,'extra':'KO'});return;}_0x26d672=_0x991246['rx'][_0x0a9e('0xf')](0x4)[_0x0a9e('0x10')](_0x0a9e('0x11'),'');if(_0x26d672[_0x0a9e('0x12')]('\x20')!=-0x1){_0x26d672=_0x26d672[_0x0a9e('0x13')](0x0,_0x26d672[_0x0a9e('0x12')]('\x20'));}if(_['startsWith'](_0x26d672,'-1')){_0x26d672=parseInt(_0x26d672);}_0x32d742=_0x991246['rx'][_0x0a9e('0x14')]('\x20');if(_0x32d742['length']==0x3){_0x32d742=_0x32d742[0x2][_0x0a9e('0xf')](0x1,_0x32d742[0x2]['length']-0x1);}else if(_0x32d742[_0x0a9e('0x15')]>0x3){var _0x12066b=/\((.+)\)/;var _0x48f32d=_0x991246['rx'][_0x0a9e('0x16')](_0x12066b);if(_0x48f32d){_0x32d742=_0x48f32d[0x1];}else{_0x32d742=null;}}else{_0x32d742=null;}_0x991246['cb'](null,{'code':_0xd5b662,'result':_0x26d672,'extra':_0x32d742});}});_0x4ce2f1['on']('error',function(_0x459eb1){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x17'),new AGIError(_0x0a9e('0x18'),_0x459eb1[_0x0a9e('0x19')]));});_0x4ce2f1['on'](_0x0a9e('0x1a'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1a'),new AGIError(_0x0a9e('0x1b')));});_0x4ce2f1['on'](_0x0a9e('0x1c'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x4ce2f1[_0x0a9e('0x1d')]();});_0x4ce2f1[_0x0a9e('0x1e')](_0x432180);this['command']=function(_0x20f109,_0x5a09ef){var _0x20f109=_0x20f109||'',_0x5a09ef=typeof _0x5a09ef==_0x0a9e('0xe')?_0x5a09ef:new Function();_0x991246={'tx':_0x20f109,'rx':'','cb':_0x5a09ef};_0x4ce2f1[_0x0a9e('0x1f')](_0x20f109+'\x0a');},this[_0x0a9e('0x1a')]=function(){_0x4ce2f1['destroy']();};}util[_0x0a9e('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x22')]=function(_0x4d00e6){return this[_0x0a9e('0x23')][_0x0a9e('0x24')](this,_0x4d00e6);};AGIChannel[_0x0a9e('0x21')]['answer']=function(){return this['sendRequest'](_0x0a9e('0x25'));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x26')]=function(_0x33161b,_0x526cf3,_0x384319){_0x33161b=_0x33161b===undefined?'beep':_0x33161b;_0x526cf3=_0x526cf3===undefined?'5':_0x526cf3;_0x384319=_0x384319===undefined?'1':_0x384319;return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x27'),_0x33161b,_0x526cf3*0x3e8,_0x384319));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x28')]=function(_0x14433c){_0x14433c=_0x14433c||_0x0a9e('0x29');return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2b'),_0x14433c));};AGIChannel['prototype'][_0x0a9e('0x2c')]=function(_0x468813,_0x2b1f27){if(_[_0x0a9e('0x2d')](_0x2b1f27)){return this['sendRequest'](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27[_0x0a9e('0x2f')](',')));}return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x30')]=function(_0x1dbde2){return this['sendRequest'](util[_0x0a9e('0x2a')]('SET\x20CONTEXT\x20%s',_0x1dbde2));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x31')]=function(_0x1122db){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20EXTENSION\x20%s',_0x1122db));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x32')]=function(_0x40cb85){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x33'),_0x40cb85));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0xb')]=function(){return this['sendRequest'](_0x0a9e('0x34'));};AGIChannel['prototype'][_0x0a9e('0x35')]=function(_0x14b13f,_0x2b7e7f){var _0x3f3d41=_['isBoolean'](_0x2b7e7f)||_[_0x0a9e('0x36')](_0x2b7e7f)?_0x2b7e7f[_0x0a9e('0x37')]():_0x2b7e7f;return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x14b13f,_0x3f3d41?_0x3f3d41['toString']()[_0x0a9e('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x0a9e('0x38')]=function(_0x3d9717,_0x381c37){return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x39'),_0x3d9717,_0x381c37));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3a')]=function(_0x533942,_0x1dbf74){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SAY\x20DIGITS\x20%s\x20%s',_0x533942,_0x1dbf74));};AGIChannel['prototype'][_0x0a9e('0x3b')]=function(_0x40d766,_0x5adda1){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3c'),_0x40d766,_0x5adda1));};AGIChannel[_0x0a9e('0x21')]['continueAt']=function(_0x5a594b,_0x15e37d,_0x45b3d0){_0x15e37d=_0x15e37d||this['extension'];_0x45b3d0=_0x45b3d0||0x1;this[_0x0a9e('0x30')](_0x5a594b);this[_0x0a9e('0x31')](_0x15e37d);this[_0x0a9e('0x32')](_0x45b3d0);return this['noop'](util[_0x0a9e('0x2a')](_0x0a9e('0x3d'),_0x5a594b,_0x15e37d,_0x45b3d0));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3e')]=function(_0x13cb1f){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3f'),_0x13cb1f));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x40')]=function(_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x37f6cc,_0x4d04c8){_0x148007=_0x148007||'wav';_0x1a7bce=_0x1a7bce||'';_0x11ca30=_0x11ca30===undefined?-0x1:_0x11ca30==='-1'?-0x1:_0x11ca30*0x3e8;_0x37f6cc=_0x37f6cc===undefined?'':'s='+_0x37f6cc;_0x4d04c8=_0x4d04c8?_0x0a9e('0x41'):'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x42'),_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x4d04c8,_0x37f6cc));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x43')]=function(_0x10b040,_0x445e25){_0x445e25=_0x445e25||'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x44'),_0x10b040,_0x445e25));};AGIChannel[_0x0a9e('0x21')]['agi']=function(_0x117c99){return this[_0x0a9e('0x2c')](_0x0a9e('0x45'),_0x117c99);};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x46')]=function(_0xbe9d19){return this[_0x0a9e('0x2c')](_0x0a9e('0x47'),_0xbe9d19);};AGIChannel['prototype'][_0x0a9e('0x17')]=function(_0x48fd45,_0x473dc8){this[_0x0a9e('0x28')](util[_0x0a9e('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x48fd45['id'],_0x48fd45[_0x0a9e('0x48')],_0x473dc8));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x0a9e('0x49')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index e6bdd59..4b1db74 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 _0x39e0=['push','format','message','name','exports','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED'];(function(_0x5c75cb,_0x2a8e50){var _0x2cf47c=function(_0xd24ac9){while(--_0xd24ac9){_0x5c75cb['push'](_0x5c75cb['shift']());}};_0x2cf47c(++_0x2a8e50);}(_0x39e0,0x1c5));var _0x039e=function(_0x9eb202,_0x1d10f3){_0x9eb202=_0x9eb202-0x0;var _0xa2f29=_0x39e0[_0x9eb202];return _0xa2f29;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x039e('0x0'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x039e('0x1'),'E_AGI_SERVER_MAXCONNECTION':_0x039e('0x2'),'E_AGI_SERVER_VOICE_DISABLED':_0x039e('0x3'),'E_AGI_SOCKET_ERROR':_0x039e('0x4'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x039e('0x5'),'E_AGI_COMMAND_EMPTY':_0x039e('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x039e('0x7'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x2be3e2){var _0x2be3e2=_0x2be3e2||null,_0x2093ab=_0x2093ab||[],_0x3b6574=0x1,_0x44ff81='';if(!error[_0x2be3e2]){_0x2be3e2=_0x039e('0x8');}_0x2093ab[_0x039e('0x9')](error[_0x2be3e2]);while(arguments[_0x3b6574]){_0x2093ab[_0x039e('0x9')](arguments[_0x3b6574]);_0x3b6574++;}_0x44ff81=util[_0x039e('0xa')]['apply'](util,_0x2093ab);this[_0x039e('0xb')]=_0x44ff81;this[_0x039e('0xc')]=_0x2be3e2;}module[_0x039e('0xd')]=AGIError; \ No newline at end of file +var _0x2367=['exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','message','name'];(function(_0x210720,_0x3bebf1){var _0x2309b9=function(_0x3b3e1c){while(--_0x3b3e1c){_0x210720['push'](_0x210720['shift']());}};_0x2309b9(++_0x3bebf1);}(_0x2367,0x7f));var _0x7236=function(_0x7c572,_0x4f740e){_0x7c572=_0x7c572-0x0;var _0x1186d2=_0x2367[_0x7c572];return _0x1186d2;};'use strict';var util=require(_0x7236('0x0'));var error={'E_AGI_UNDEFINED':_0x7236('0x1'),'E_AGI_ARGUMENT_PORT':_0x7236('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x7236('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x7236('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x7236('0x5'),'E_AGI_SOCKET_ERROR':_0x7236('0x6'),'E_AGI_SOCKET_CLOSE':_0x7236('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x7236('0x8'),'E_AGI_COMMAND_EMPTY':_0x7236('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x7236('0xa'),'E_AGI_IVR_ENTRY':_0x7236('0xb')};function AGIError(_0x3189ac){var _0x3189ac=_0x3189ac||null,_0xe5f0b3=_0xe5f0b3||[],_0x8322ed=0x1,_0x2cfc6a='';if(!error[_0x3189ac]){_0x3189ac=_0x7236('0xc');}_0xe5f0b3[_0x7236('0xd')](error[_0x3189ac]);while(arguments[_0x8322ed]){_0xe5f0b3[_0x7236('0xd')](arguments[_0x8322ed]);_0x8322ed++;}_0x2cfc6a=util['format'][_0x7236('0xe')](util,_0xe5f0b3);this[_0x7236('0xf')]=_0x2cfc6a;this[_0x7236('0x10')]=_0x3189ac;}module[_0x7236('0x11')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 246c0f8..6241bef 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 _0x6b24=['menu','getdigits','numberOfEdges','addVertex','vertices','addEdge','edges','push','prototype','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','condition','vswitch','target','default','agicommand','invalid','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found','exports','../../../config/logger','agi'];(function(_0x4ba5c1,_0x4f3560){var _0x242506=function(_0x528831){while(--_0x528831){_0x4ba5c1['push'](_0x4ba5c1['shift']());}};_0x242506(++_0x4f3560);}(_0x6b24,0x1ce));var _0x46b2=function(_0x2a608d,_0x298459){_0x2a608d=_0x2a608d-0x0;var _0x1bee3e=_0x6b24[_0x2a608d];return _0x1bee3e;};'use strict';var _=require('lodash');var logger=require(_0x46b2('0x0'))(_0x46b2('0x1'));var verticesWithRetry=[_0x46b2('0x2'),_0x46b2('0x3'),'getsecretdigits'];var Graph=function(){this['vertices']={};this['edges']={};this[_0x46b2('0x4')]=0x0;};Graph['prototype'][_0x46b2('0x5')]=function(_0x49d2b5){this[_0x46b2('0x6')][_0x49d2b5['id']]=_0x49d2b5;this['edges'][_0x49d2b5['id']]=[];};Graph['prototype'][_0x46b2('0x7')]=function(_0x233ccf,_0x1f81b8,_0x1531c){this[_0x46b2('0x8')][_0x233ccf][_0x46b2('0x9')]({'target':_0x1f81b8,'condition':_0x1531c});this[_0x46b2('0x4')]+=0x1;};Graph[_0x46b2('0xa')][_0x46b2('0xb')]=function(){return _['size'](this['vertices']);};Graph[_0x46b2('0xa')][_0x46b2('0xc')]=function(){return this[_0x46b2('0x4')];};Graph['prototype'][_0x46b2('0xd')]=function(_0x3c5665){return this[_0x46b2('0x6')][_0x3c5665];};Graph['prototype'][_0x46b2('0xe')]=function(_0x886e41,_0x411208){if(!this[_0x46b2('0x6')][_0x886e41]){return logger[_0x46b2('0xf')](_0x46b2('0x10'));}var _0x3ff25d=_0x411208(this[_0x46b2('0x6')][_0x886e41]);if(!_0x3ff25d){return logger[_0x46b2('0xf')](_0x46b2('0x11'));}if(this['edges'][_0x886e41][_0x46b2('0x12')]===0x0){return logger[_0x46b2('0xf')]('no\x20edge/s\x20available');}for(var _0x179bd9=0x0,_0xd9554a=[],_0xe3d3d9=![];_0x179bd9\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','omit','mxCell','isArray','length','source','addEdge','value','getSquareProject','then','catch','createSquareReport','indexOf','debug','stringify','close','timeout','evtHangup','hangup','sync','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','[LICENSE]\x20CHANNELS:\x20%s','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','./server','listening','connection','xml2json','lodash','util','../../config/environment','../../config/logger','agi','../../config/license/util','./mailRpc','defaults','nextTick','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d'];(function(_0x53f04f,_0x419aa8){var _0x16a824=function(_0x5712c9){while(--_0x5712c9){_0x53f04f['push'](_0x53f04f['shift']());}};_0x16a824(++_0x419aa8);}(_0x5292,0xf7));var _0x2529=function(_0x1c413e,_0x51788b){_0x1c413e=_0x1c413e-0x0;var _0x1d8309=_0x5292[_0x1c413e];return _0x1d8309;};'use strict';var parser=require(_0x2529('0x0'));var _=require(_0x2529('0x1'));var syncho=require('syncho');var util=require(_0x2529('0x2'));var moment=require('moment');var config=require(_0x2529('0x3'));var logger=require(_0x2529('0x4'))(_0x2529('0x5'));var utilLicense=require(_0x2529('0x6'));var rpc=require('./rpc');var mailRpc=require(_0x2529('0x7'));var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x2529('0x8')](config[_0x2529('0x5')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x5c3355){process[_0x2529('0x9')](function(){syncho(function(){try{setChannelVariables(_0x5c3355);agiHandler(_0x5c3355);}catch(_0x2a0306){logger['error'](_0x2a0306[_0x2529('0xa')]);}});});}function listeningHandler(){console[_0x2529('0xb')](_0x2529('0xc'),config[_0x2529('0x5')][_0x2529('0xd')]);logger[_0x2529('0xe')](util[_0x2529('0xf')](_0x2529('0x10'),config['agi']['ip'],config[_0x2529('0x5')][_0x2529('0xd')]));}function errorHandler(_0x521a43){if(_0x521a43&&_0x521a43[_0x2529('0x11')]&&_0x521a43[_0x2529('0x12')]){logger[_0x2529('0x13')](util[_0x2529('0xf')](_0x2529('0x14'),_0x521a43[_0x2529('0x11')],_0x521a43[_0x2529('0x12')]));}else{logger['error'](util[_0x2529('0xf')](_0x2529('0x15'),_0x521a43[_0x2529('0xa')]));}}function closeHandler(){logger[_0x2529('0xe')](util[_0x2529('0xf')](_0x2529('0x16'),this[_0x2529('0x17')],this[_0x2529('0x18')],this['callerid'],this[_0x2529('0x19')],this['uniqueid']));try{createSquareReport(this);}catch(_0x337720){logger[_0x2529('0x13')](_0x337720[_0x2529('0xa')]);}}function timeoutHandler(){logger['info'](util['format'](_0x2529('0x1a'),this[_0x2529('0x17')],this[_0x2529('0x18')],this[_0x2529('0x1b')],this[_0x2529('0x19')],this['uniqueid']));}function hangupHandler(){logger[_0x2529('0xe')](util[_0x2529('0xf')](_0x2529('0x1c'),this[_0x2529('0x17')],this['calleridname'],this[_0x2529('0x1b')],this[_0x2529('0x19')],this[_0x2529('0x1d')]));this['evtHangup']=!![];}function getRoot(_0x3d5d17){return parser[_0x2529('0x1e')](_0x3d5d17,{'object':!![]})[_0x2529('0x1f')][_0x2529('0x20')];}function addVertex(_0x5540e4,_0x2736f6,_0x2d0c6d){_0x2736f6[_0x2529('0x21')]=_0x2d0c6d;if(_0x2736f6[_0x2529('0x22')](_0x2529('0x23'))){_0x2736f6[_0x2529('0x24')]=parseInt(_0x2736f6['retry'],0xa);}_0x5540e4['addVertex'](_[_0x2529('0x25')](_0x2736f6,_0x2529('0x26')));}function initGraph(_0xbd829f,_0x431c40){var _0x24418a=new Graph();for(var _0x2a8371 in _0xbd829f){if(_0xbd829f[_0x2529('0x22')](_0x2a8371)){if(_[_0x2529('0x27')](_0xbd829f[_0x2a8371])){for(var _0x20c135=0x0;_0x20c135<_0xbd829f[_0x2a8371][_0x2529('0x28')];_0x20c135+=0x1){addVertex(_0x24418a,_0xbd829f[_0x2a8371][_0x20c135],_0x2a8371);}}else{addVertex(_0x24418a,_0xbd829f[_0x2a8371],_0x2a8371);}}}for(var _0x5852aa=0x0;_0x5852aa<_0x431c40[_0x2529('0x28')];_0x5852aa+=0x1){if(_0x431c40[_0x5852aa][_0x2529('0x29')]&&_0x431c40[_0x5852aa]['target']){_0x24418a[_0x2529('0x2a')](_0x431c40[_0x5852aa][_0x2529('0x29')],_0x431c40[_0x5852aa]['target'],_0x431c40[_0x5852aa][_0x2529('0x2b')]);}}return _0x24418a;}function getSquareProject(_0x1d7e98,_0x577c5f){rpc[_0x2529('0x2c')](_0x1d7e98)[_0x2529('0x2d')](function(_0x4a18f6){_0x577c5f(null,_0x4a18f6);})[_0x2529('0x2e')](function(_0x24e437){_0x577c5f(null,_0x24e437);});}function createSquareReport(_0x3c2dba,_0x203acb){rpc[_0x2529('0x2f')](_0x3c2dba)['then'](function(_0x3d3b14){if(_0x203acb){_0x203acb(null,_0x3d3b14);}})[_0x2529('0x2e')](function(_0x35e7db){if(_0x203acb){_0x203acb(null,_0x35e7db);}});}function setChannelVariables(_0x196106){for(var _0x363cbc in _0x196106){if(_0x196106[_0x2529('0x22')](_0x363cbc)){if(_0x363cbc[_0x2529('0x30')]('agi_')===0x0){_0x196106[_0x363cbc['substring'](0x4)]=_0x196106[_0x363cbc];delete _0x196106[_0x363cbc];}}}}function getLogFromObject(_0x14aabd){return util['inspect'](_0x14aabd,{'showHidden':![],'depth':null});}function agiHandler(_0x3f4148){var _0x4b610f,_0x4f438a,_0x543ac5,_0x30cdfb,_0x3c815f;logger[_0x2529('0x31')]('variables',JSON[_0x2529('0x32')](_0x3f4148,null,0x2));logger['info'](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3f4148[_0x2529('0x17')],_0x3f4148[_0x2529('0x18')],_0x3f4148[_0x2529('0x1b')],_0x3f4148[_0x2529('0x19')],_0x3f4148[_0x2529('0x1d')]));_0x3f4148['on'](_0x2529('0x13'),errorHandler);_0x3f4148['on'](_0x2529('0x33'),closeHandler);_0x3f4148['on'](_0x2529('0x34'),timeoutHandler);_0x3f4148[_0x2529('0x35')]=![];_0x3f4148['on'](_0x2529('0x36'),hangupHandler);var _0x3cb99c=getSquareProject[_0x2529('0x37')](null,_0x3f4148[_0x2529('0x17')]);if(_0x3cb99c){if(_0x3cb99c['production']){_0x4b610f=getRoot(_0x3cb99c['production']);if(_0x4b610f&&_0x4b610f[_0x2529('0x38')]){logger[_0x2529('0x31')]('root',JSON[_0x2529('0x32')](_0x4b610f,null,0x2));_0x3f4148[_0x2529('0x39')]=moment()[_0x2529('0xf')](_0x2529('0x3a'));_0x4f438a=initGraph(_[_0x2529('0x25')](_0x4b610f,_0x2529('0x26')),_0x4b610f[_0x2529('0x26')]);_0x543ac5=new Vertices(_0x3f4148,rpc,mailRpc);logger['info'](util[_0x2529('0xf')](_0x2529('0x3b'),_0x3f4148[_0x2529('0x17')],_0x3f4148['calleridname'],_0x3f4148[_0x2529('0x1b')],_0x3f4148[_0x2529('0x19')],_0x3f4148[_0x2529('0x1d')]));_0x4f438a[_0x2529('0x3c')](_0x4b610f[_0x2529('0x38')]['id'],function(_0x33acbf){try{_0x33acbf=_0x543ac5[_0x2529('0x3d')](_0x33acbf);logger[_0x2529('0x31')](_0x2529('0x3e'),JSON['stringify'](_0x33acbf,null,0x2));if(_0x33acbf[_0x2529('0x21')]===_0x2529('0x3f')){logger[_0x2529('0xe')](_0x2529('0x40'));_0x3f4148[_0x2529('0x41')]=_0x33acbf[_0x2529('0x41')]||_0x3f4148[_0x2529('0x41')];_0x3f4148['extension']=_0x33acbf[_0x2529('0x42')];_0x3f4148[_0x2529('0x43')]=_0x33acbf[_0x2529('0x43')]?_0x33acbf[_0x2529('0x43')]-0x1:0x1;return null;}else if(_0x33acbf&&_0x543ac5[_0x33acbf[_0x2529('0x21')]]){_0x3c815f=_0x543ac5[_0x33acbf['agicommand']](_0x33acbf);logger[_0x2529('0xe')](_0x2529('0x44'),JSON[_0x2529('0x32')](_0x3c815f,null,0x2));if(_0x3c815f&&_0x3c815f[_0x2529('0x45')]===AGI_CODE_SUCCESS&&_0x3c815f[_0x2529('0x46')]!==AGI_RESULT_ERROR&&!_0x3f4148[_0x2529('0x35')]){logger['debug']('response',getLogFromObject(_0x3c815f));return _['isUndefined'](_0x3c815f['result'])?null:_0x3c815f[_0x2529('0x46')]['toString']();}else{logger[_0x2529('0x13')](_0x2529('0x44'),getLogFromObject(_0x3c815f));return null;}}else{logger[_0x2529('0x13')](_0x2529('0x47'));return null;}}catch(_0x13ee93){logger['error'](_0x13ee93[_0x2529('0xa')]);return null;}});if(_0x4b610f['finally']){logger[_0x2529('0xe')](util['format'](_0x2529('0x48'),_0x3f4148['arg_1'],_0x3f4148[_0x2529('0x18')],_0x3f4148[_0x2529('0x1b')],_0x3f4148['dnid'],_0x3f4148[_0x2529('0x1d')]));_0x4f438a['traverseBFS'](_0x4b610f[_0x2529('0x49')]['id'],function(_0x4648d1){try{_0x4648d1=_0x543ac5[_0x2529('0x3d')](_0x4648d1);logger[_0x2529('0x31')](_0x2529('0x3e'),JSON[_0x2529('0x32')](_0x4648d1,null,0x2));if(_0x4648d1&&_0x543ac5[_0x4648d1[_0x2529('0x21')]]){_0x3c815f=_0x543ac5[_0x4648d1[_0x2529('0x21')]](_0x4648d1);if(_0x3c815f){logger[_0x2529('0x31')]('response',getLogFromObject(_0x3c815f));return _['isUndefined'](_0x3c815f[_0x2529('0x46')])?null:_0x3c815f[_0x2529('0x46')][_0x2529('0x4a')]();}else{logger[_0x2529('0x13')]('response',getLogFromObject(_0x3c815f));return null;}}else{logger['error'](_0x2529('0x47'));return null;}}catch(_0x4a9fb5){logger[_0x2529('0x13')](_0x4a9fb5[_0x2529('0xa')]);return null;}});}logger[_0x2529('0xe')](util[_0x2529('0xf')](_0x2529('0x4b'),_0x3f4148[_0x2529('0x17')],_0x3f4148[_0x2529('0x18')],_0x3f4148[_0x2529('0x1b')],_0x3f4148['dnid'],_0x3f4148['uniqueid']));logger[_0x2529('0xe')](util[_0x2529('0xf')](_0x2529('0x4c'),_0x3f4148[_0x2529('0x41')],_0x3f4148[_0x2529('0x42')],parseInt(_0x3f4148[_0x2529('0x43')],0xa)+0x1));_0x3f4148[_0x2529('0x4d')](_0x3f4148[_0x2529('0x41')],_0x3f4148[_0x2529('0x42')],parseInt(_0x3f4148[_0x2529('0x43')],0xa)+0x1);_0x3f4148[_0x2529('0x33')]();}}else{logger['error'](util['format'](_0x2529('0x4e'),_0x3f4148[_0x2529('0x17')]));_0x3f4148['continueAt'](_0x3f4148[_0x2529('0x41')],_0x3f4148[_0x2529('0x42')],parseInt(_0x3f4148['priority'],0xa)+0x1);_0x3f4148[_0x2529('0x33')]();}}else{logger[_0x2529('0x13')](util[_0x2529('0xf')](_0x2529('0x4f'),_0x3f4148[_0x2529('0x17')]));_0x3f4148[_0x2529('0x4d')](_0x3f4148[_0x2529('0x41')],_0x3f4148[_0x2529('0x42')],parseInt(_0x3f4148['priority'],0xa)+0x1);_0x3f4148[_0x2529('0x33')]();}}function main(){var _0x55c609;return utilLicense[_0x2529('0x50')]()['then'](function(_0x25da87){if(_0x25da87){if(_0x25da87[_0x2529('0x51')]){if(_0x25da87['callysquare']&&_0x25da87['callysquare']>0x0){logger[_0x2529('0xe')](util[_0x2529('0xf')](_0x2529('0x52'),_0x25da87[_0x2529('0x53')]));_0x55c609=_0x25da87[_0x2529('0x53')];}else{logger['info'](_0x2529('0x54'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x55c609=-0x1;}}})['catch'](function(_0x37e32c){logger[_0x2529('0x13')]('[LICENSE]',_0x37e32c[_0x2529('0xa')]);})[_0x2529('0x49')](function(){var _0x5c1645=require(_0x2529('0x55'))(config[_0x2529('0x5')]['port'],config[_0x2529('0x5')]['ip'],_0x55c609);_0x5c1645['on'](_0x2529('0x13'),errorHandler);_0x5c1645['on'](_0x2529('0x56'),listeningHandler);_0x5c1645['on'](_0x2529('0x57'),connectionHandler);_0x5c1645['on'](_0x2529('0x33'),closeHandler);});}main(); \ No newline at end of file +var _0x4b19=['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','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','response','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','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','connection','xml2json','syncho','util','moment','../../config/logger','agi','../../config/license/util','./mailRpc','./graph','defaults','127.0.0.1','nextTick','error','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','[%s]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','evtHangup','toJson','mxGraphModel','root','agicommand','retry','addVertex','omit','mxCell','hasOwnProperty','length','source','target','addEdge','value','getSquareProject','catch','createSquareReport','then','substring','inspect','debug'];(function(_0x5d5177,_0x24d3c8){var _0x195c11=function(_0x5e4f32){while(--_0x5e4f32){_0x5d5177['push'](_0x5d5177['shift']());}};_0x195c11(++_0x24d3c8);}(_0x4b19,0x195));var _0x94b1=function(_0x52e7f5,_0x54a808){_0x52e7f5=_0x52e7f5-0x0;var _0x27014b=_0x4b19[_0x52e7f5];return _0x27014b;};'use strict';var parser=require(_0x94b1('0x0'));var _=require('lodash');var syncho=require(_0x94b1('0x1'));var util=require(_0x94b1('0x2'));var moment=require(_0x94b1('0x3'));var config=require('../../config/environment');var logger=require(_0x94b1('0x4'))(_0x94b1('0x5'));var utilLicense=require(_0x94b1('0x6'));var rpc=require('./rpc');var mailRpc=require(_0x94b1('0x7'));var Graph=require(_0x94b1('0x8'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x94b1('0x5')]=_[_0x94b1('0x9')](config['agi'],{'ip':_0x94b1('0xa'),'port':0x11dd});function connectionHandler(_0x201a02){process[_0x94b1('0xb')](function(){syncho(function(){try{setChannelVariables(_0x201a02);agiHandler(_0x201a02);}catch(_0x5aee5f){logger[_0x94b1('0xc')](_0x5aee5f['stack']);}});});}function listeningHandler(){console['log'](_0x94b1('0xd'),config[_0x94b1('0x5')][_0x94b1('0xe')]);logger[_0x94b1('0xf')](util[_0x94b1('0x10')](_0x94b1('0x11'),config['agi']['ip'],config[_0x94b1('0x5')][_0x94b1('0xe')]));}function errorHandler(_0x340a29){if(_0x340a29&&_0x340a29[_0x94b1('0x12')]&&_0x340a29['message']){logger['error'](util[_0x94b1('0x10')](_0x94b1('0x13'),_0x340a29['name'],_0x340a29['message']));}else{logger[_0x94b1('0xc')](util[_0x94b1('0x10')]('[ERROR]\x20%s',_0x340a29[_0x94b1('0x14')]));}}function closeHandler(){logger['info'](util['format'](_0x94b1('0x15'),this[_0x94b1('0x16')],this[_0x94b1('0x17')],this[_0x94b1('0x18')],this['dnid'],this[_0x94b1('0x19')]));try{createSquareReport(this);}catch(_0x424c45){logger[_0x94b1('0xc')](_0x424c45[_0x94b1('0x14')]);}}function timeoutHandler(){logger[_0x94b1('0xf')](util[_0x94b1('0x10')](_0x94b1('0x1a'),this['arg_1'],this[_0x94b1('0x17')],this[_0x94b1('0x18')],this[_0x94b1('0x1b')],this['uniqueid']));}function hangupHandler(){logger[_0x94b1('0xf')](util[_0x94b1('0x10')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x94b1('0x16')],this[_0x94b1('0x17')],this[_0x94b1('0x18')],this[_0x94b1('0x1b')],this[_0x94b1('0x19')]));this[_0x94b1('0x1c')]=!![];}function getRoot(_0x36180a){return parser[_0x94b1('0x1d')](_0x36180a,{'object':!![]})[_0x94b1('0x1e')][_0x94b1('0x1f')];}function addVertex(_0x49c248,_0xa333a8,_0xa112b1){_0xa333a8[_0x94b1('0x20')]=_0xa112b1;if(_0xa333a8['hasOwnProperty'](_0x94b1('0x21'))){_0xa333a8['maxRetry']=parseInt(_0xa333a8[_0x94b1('0x21')],0xa);}_0x49c248[_0x94b1('0x22')](_[_0x94b1('0x23')](_0xa333a8,_0x94b1('0x24')));}function initGraph(_0x5ad3e4,_0x4ea6d9){var _0x1d6ea6=new Graph();for(var _0x4d5685 in _0x5ad3e4){if(_0x5ad3e4[_0x94b1('0x25')](_0x4d5685)){if(_['isArray'](_0x5ad3e4[_0x4d5685])){for(var _0x4694de=0x0;_0x4694de<_0x5ad3e4[_0x4d5685][_0x94b1('0x26')];_0x4694de+=0x1){addVertex(_0x1d6ea6,_0x5ad3e4[_0x4d5685][_0x4694de],_0x4d5685);}}else{addVertex(_0x1d6ea6,_0x5ad3e4[_0x4d5685],_0x4d5685);}}}for(var _0x1eda8c=0x0;_0x1eda8c<_0x4ea6d9['length'];_0x1eda8c+=0x1){if(_0x4ea6d9[_0x1eda8c][_0x94b1('0x27')]&&_0x4ea6d9[_0x1eda8c][_0x94b1('0x28')]){_0x1d6ea6[_0x94b1('0x29')](_0x4ea6d9[_0x1eda8c][_0x94b1('0x27')],_0x4ea6d9[_0x1eda8c][_0x94b1('0x28')],_0x4ea6d9[_0x1eda8c][_0x94b1('0x2a')]);}}return _0x1d6ea6;}function getSquareProject(_0x2661ca,_0xcd778f){rpc[_0x94b1('0x2b')](_0x2661ca)['then'](function(_0x2eb1fa){_0xcd778f(null,_0x2eb1fa);})[_0x94b1('0x2c')](function(_0x47f019){_0xcd778f(null,_0x47f019);});}function createSquareReport(_0x42630a,_0x1fe766){rpc[_0x94b1('0x2d')](_0x42630a)[_0x94b1('0x2e')](function(_0x28dc1d){if(_0x1fe766){_0x1fe766(null,_0x28dc1d);}})[_0x94b1('0x2c')](function(_0x5a5148){if(_0x1fe766){_0x1fe766(null,_0x5a5148);}});}function setChannelVariables(_0x1a26eb){for(var _0x5d765b in _0x1a26eb){if(_0x1a26eb[_0x94b1('0x25')](_0x5d765b)){if(_0x5d765b['indexOf']('agi_')===0x0){_0x1a26eb[_0x5d765b[_0x94b1('0x2f')](0x4)]=_0x1a26eb[_0x5d765b];delete _0x1a26eb[_0x5d765b];}}}}function getLogFromObject(_0x171d44){return util[_0x94b1('0x30')](_0x171d44,{'showHidden':![],'depth':null});}function agiHandler(_0x44e595){var _0x35b97c,_0x195514,_0x26f33d,_0x19511b,_0x288ae5;logger[_0x94b1('0x31')](_0x94b1('0x32'),JSON[_0x94b1('0x33')](_0x44e595,null,0x2));logger['info'](util['format'](_0x94b1('0x34'),_0x44e595[_0x94b1('0x16')],_0x44e595[_0x94b1('0x17')],_0x44e595[_0x94b1('0x18')],_0x44e595[_0x94b1('0x1b')],_0x44e595[_0x94b1('0x19')]));_0x44e595['on'](_0x94b1('0xc'),errorHandler);_0x44e595['on'](_0x94b1('0x35'),closeHandler);_0x44e595['on'](_0x94b1('0x36'),timeoutHandler);_0x44e595['evtHangup']=![];_0x44e595['on'](_0x94b1('0x37'),hangupHandler);var _0x4d18e8=getSquareProject[_0x94b1('0x38')](null,_0x44e595[_0x94b1('0x16')]);if(_0x4d18e8){if(_0x4d18e8[_0x94b1('0x39')]){_0x35b97c=getRoot(_0x4d18e8['production']);if(_0x35b97c&&_0x35b97c[_0x94b1('0x3a')]){logger[_0x94b1('0x31')](_0x94b1('0x1f'),JSON['stringify'](_0x35b97c,null,0x2));_0x44e595[_0x94b1('0x3b')]=moment()[_0x94b1('0x10')](_0x94b1('0x3c'));_0x195514=initGraph(_[_0x94b1('0x23')](_0x35b97c,_0x94b1('0x24')),_0x35b97c[_0x94b1('0x24')]);_0x26f33d=new Vertices(_0x44e595,rpc,mailRpc);logger[_0x94b1('0xf')](util[_0x94b1('0x10')](_0x94b1('0x3d'),_0x44e595[_0x94b1('0x16')],_0x44e595[_0x94b1('0x17')],_0x44e595[_0x94b1('0x18')],_0x44e595[_0x94b1('0x1b')],_0x44e595['uniqueid']));_0x195514[_0x94b1('0x3e')](_0x35b97c[_0x94b1('0x3a')]['id'],function(_0xf29a10){try{_0xf29a10=_0x26f33d[_0x94b1('0x3f')](_0xf29a10);logger[_0x94b1('0x31')]('vertex',JSON[_0x94b1('0x33')](_0xf29a10,null,0x2));if(_0xf29a10[_0x94b1('0x20')]===_0x94b1('0x40')){logger[_0x94b1('0xf')](_0x94b1('0x41'));_0x44e595[_0x94b1('0x42')]=_0xf29a10['context']||_0x44e595[_0x94b1('0x42')];_0x44e595[_0x94b1('0x43')]=_0xf29a10['extension'];_0x44e595[_0x94b1('0x44')]=_0xf29a10[_0x94b1('0x44')]?_0xf29a10['priority']-0x1:0x1;return null;}else if(_0xf29a10&&_0x26f33d[_0xf29a10[_0x94b1('0x20')]]){_0x288ae5=_0x26f33d[_0xf29a10[_0x94b1('0x20')]](_0xf29a10);logger[_0x94b1('0xf')]('response',JSON[_0x94b1('0x33')](_0x288ae5,null,0x2));if(_0x288ae5&&_0x288ae5[_0x94b1('0x45')]===AGI_CODE_SUCCESS&&_0x288ae5[_0x94b1('0x46')]!==AGI_RESULT_ERROR&&!_0x44e595[_0x94b1('0x1c')]){logger[_0x94b1('0x31')](_0x94b1('0x47'),getLogFromObject(_0x288ae5));return _[_0x94b1('0x48')](_0x288ae5['result'])?null:_0x288ae5[_0x94b1('0x46')][_0x94b1('0x49')]();}else{logger[_0x94b1('0xc')]('response',getLogFromObject(_0x288ae5));return null;}}else{logger[_0x94b1('0xc')](_0x94b1('0x4a'));return null;}}catch(_0x5323c2){logger[_0x94b1('0xc')](_0x5323c2[_0x94b1('0x14')]);return null;}});if(_0x35b97c[_0x94b1('0x4b')]){logger[_0x94b1('0xf')](util[_0x94b1('0x10')](_0x94b1('0x4c'),_0x44e595[_0x94b1('0x16')],_0x44e595[_0x94b1('0x17')],_0x44e595[_0x94b1('0x18')],_0x44e595[_0x94b1('0x1b')],_0x44e595[_0x94b1('0x19')]));_0x195514[_0x94b1('0x3e')](_0x35b97c[_0x94b1('0x4b')]['id'],function(_0x7753ff){try{_0x7753ff=_0x26f33d[_0x94b1('0x3f')](_0x7753ff);logger[_0x94b1('0x31')](_0x94b1('0x4d'),JSON[_0x94b1('0x33')](_0x7753ff,null,0x2));if(_0x7753ff&&_0x26f33d[_0x7753ff[_0x94b1('0x20')]]){_0x288ae5=_0x26f33d[_0x7753ff['agicommand']](_0x7753ff);if(_0x288ae5){logger[_0x94b1('0x31')]('response',getLogFromObject(_0x288ae5));return _[_0x94b1('0x48')](_0x288ae5[_0x94b1('0x46')])?null:_0x288ae5[_0x94b1('0x46')]['toString']();}else{logger['error']('response',getLogFromObject(_0x288ae5));return null;}}else{logger[_0x94b1('0xc')](_0x94b1('0x4a'));return null;}}catch(_0x276ab1){logger['error'](_0x276ab1['stack']);return null;}});}logger['info'](util[_0x94b1('0x10')](_0x94b1('0x4e'),_0x44e595[_0x94b1('0x16')],_0x44e595[_0x94b1('0x17')],_0x44e595[_0x94b1('0x18')],_0x44e595[_0x94b1('0x1b')],_0x44e595[_0x94b1('0x19')]));logger['info'](util[_0x94b1('0x10')](_0x94b1('0x4f'),_0x44e595[_0x94b1('0x42')],_0x44e595[_0x94b1('0x43')],parseInt(_0x44e595[_0x94b1('0x44')],0xa)+0x1));_0x44e595[_0x94b1('0x50')](_0x44e595[_0x94b1('0x42')],_0x44e595[_0x94b1('0x43')],parseInt(_0x44e595[_0x94b1('0x44')],0xa)+0x1);_0x44e595[_0x94b1('0x35')]();}}else{logger[_0x94b1('0xc')](util[_0x94b1('0x10')](_0x94b1('0x51'),_0x44e595[_0x94b1('0x16')]));_0x44e595['continueAt'](_0x44e595[_0x94b1('0x42')],_0x44e595[_0x94b1('0x43')],parseInt(_0x44e595[_0x94b1('0x44')],0xa)+0x1);_0x44e595[_0x94b1('0x35')]();}}else{logger[_0x94b1('0xc')](util[_0x94b1('0x10')](_0x94b1('0x52'),_0x44e595[_0x94b1('0x16')]));_0x44e595[_0x94b1('0x50')](_0x44e595['context'],_0x44e595[_0x94b1('0x43')],parseInt(_0x44e595[_0x94b1('0x44')],0xa)+0x1);_0x44e595[_0x94b1('0x35')]();}}function main(){var _0x29ccc4;return utilLicense[_0x94b1('0x53')]()[_0x94b1('0x2e')](function(_0x572657){if(_0x572657){if(_0x572657[_0x94b1('0x54')]){if(_0x572657[_0x94b1('0x55')]&&_0x572657[_0x94b1('0x55')]>0x0){logger[_0x94b1('0xf')](util[_0x94b1('0x10')](_0x94b1('0x56'),_0x572657[_0x94b1('0x55')]));_0x29ccc4=_0x572657[_0x94b1('0x55')];}else{logger[_0x94b1('0xf')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger['info'](_0x94b1('0x57'));_0x29ccc4=-0x1;}}})[_0x94b1('0x2c')](function(_0x13228e){logger[_0x94b1('0xc')](_0x94b1('0x58'),_0x13228e[_0x94b1('0x14')]);})[_0x94b1('0x4b')](function(){var _0xcdf3e8=require(_0x94b1('0x59'))(config[_0x94b1('0x5')][_0x94b1('0xe')],config[_0x94b1('0x5')]['ip'],_0x29ccc4);_0xcdf3e8['on'](_0x94b1('0xc'),errorHandler);_0xcdf3e8['on']('listening',listeningHandler);_0xcdf3e8['on'](_0x94b1('0x5a'),connectionHandler);_0xcdf3e8['on'](_0x94b1('0x35'),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 5f2a93c..d5e4249 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 _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x265294,_0x21928e){var _0x3b142b=function(_0x7b1540){while(--_0x7b1540){_0x265294['push'](_0x265294['shift']());}};_0x3b142b(++_0x21928e);}(_0x814b,0x1a2));var _0xb814=function(_0x173dd9,_0x4ecf44){_0x173dd9=_0x173dd9-0x0;var _0x5a0d5a=_0x814b[_0x173dd9];return _0x5a0d5a;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file +var _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x3bebd4,_0x3e7f8a){var _0x3c494a=function(_0x2d210a){while(--_0x2d210a){_0x3bebd4['push'](_0x3bebd4['shift']());}};_0x3c494a(++_0x3e7f8a);}(_0x34e8,0x12c));var _0x834e=function(_0x417017,_0x147c6b){_0x417017=_0x417017-0x0;var _0x2d7135=_0x34e8[_0x417017];return _0x2d7135;};'use strict';var BPromise=require(_0x834e('0x0'));var jayson=require(_0x834e('0x1'));var client=jayson[_0x834e('0x2')][_0x834e('0x3')]({'port':0x232b});function request(_0x530939,_0x832422){return new BPromise(function(_0x21e2e0,_0x472111){return client[_0x834e('0x4')](_0x530939,_0x832422)[_0x834e('0x5')](function(_0x19a3e0){if(_0x19a3e0[_0x834e('0x6')]){return _0x472111(_0x19a3e0['error'][_0x834e('0x7')]);}else{return _0x21e2e0(_0x19a3e0['result']);}})[_0x834e('0x8')](function(_0x3cc2e3){return _0x472111(_0x3cc2e3);});});}exports[_0x834e('0x9')]=function(_0x2e69e2,_0x33ea05){return request(_0x834e('0xa'),{'account':_0x2e69e2,'message':_0x33ea05});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index fb32c75..13b9853 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 _0x7a54=['substring','length','split','indexOf','slice','trim','emit','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','toString','_inBody'];(function(_0x3b0eb9,_0x5da600){var _0x1aa702=function(_0x516434){while(--_0x516434){_0x3b0eb9['push'](_0x3b0eb9['shift']());}};_0x1aa702(++_0x5da600);}(_0x7a54,0x106));var _0x47a5=function(_0x4a9d2c,_0x1844fb){_0x4a9d2c=_0x4a9d2c-0x0;var _0x4734f4=_0x7a54[_0x4a9d2c];return _0x4734f4;};'use strict';var util=require(_0x47a5('0x0'));var Transform=require(_0x47a5('0x1'))[_0x47a5('0x2')];function AGIReply(_0x58157c){Transform[_0x47a5('0x3')](this,_0x58157c);this[_0x47a5('0x4')]='';this['_inBody']=![];}util[_0x47a5('0x5')](AGIReply,Transform);AGIReply[_0x47a5('0x6')][_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){var _0x3d5629='\x0a',_0x59199c=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x343372=-0x1,_0x30e405=-0x1,_0x506eda='',_0x194fb0=0x0,_0x5077f3='',_0x5d90b3='';this[_0x47a5('0x4')]+=_0x3717e1[_0x47a5('0x8')]();_0x5077f3=this['_localBuffer'];if(!this[_0x47a5('0x9')]){_0x194fb0=0x0;while(_0x59199c[_0x194fb0]){while((_0x30e405=_0x5077f3['indexOf'](_0x59199c[_0x194fb0]))!=-0x1){_0x506eda=_0x59199c[_0x194fb0];_0x5d90b3=_0x5077f3['substring'](0x0,_0x30e405);_0x5077f3=_0x5077f3[_0x47a5('0xa')](_0x30e405+_0x506eda[_0x47a5('0xb')]);var _0x2f399b=_0x5d90b3[_0x47a5('0xc')](_0x3d5629),_0x250fad=0x0,_0xd612dd={},_0xd308b8='',_0x1eae59='',_0x5beb89=-0x1;while(_0x2f399b[_0x250fad]){_0x5beb89=_0x2f399b[_0x250fad][_0x47a5('0xd')](':');if(_0x5beb89!=-0x1){_0xd308b8=_0x2f399b[_0x250fad][_0x47a5('0xe')](0x0,_0x5beb89)[_0x47a5('0xf')]();_0x1eae59=_0x2f399b[_0x250fad][_0x47a5('0xe')](_0x5beb89+0x1)[_0x47a5('0xf')]();if(_0xd308b8[_0x47a5('0xb')]>0x0){_0xd612dd[_0xd308b8]=_0x1eae59;}}else{}_0x250fad++;}this[_0x47a5('0x10')]('headers',_0xd612dd);this[_0x47a5('0x9')]=!![];}_0x194fb0++;}this[_0x47a5('0x4')]=_0x5077f3;}else{while((_0x343372=_0x5077f3[_0x47a5('0xd')](_0x3d5629))!=-0x1){_0x5d90b3=_0x5077f3[_0x47a5('0xa')](0x0,_0x343372);this[_0x47a5('0x10')]('line',_0x5d90b3);_0x5077f3=_0x5077f3['substring'](_0x343372+_0x3d5629[_0x47a5('0xb')]);}this['_localBuffer']=_0x5077f3;}_0x545a97();};module['exports']=AGIReply; \ No newline at end of file +var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x4f04e8,_0x5e3c43){var _0x20c11d=function(_0x1bb27d){while(--_0x1bb27d){_0x4f04e8['push'](_0x4f04e8['shift']());}};_0x20c11d(++_0x5e3c43);}(_0x5f2f,0x73));var _0xf5f2=function(_0x264182,_0xba6d7a){_0x264182=_0x264182-0x0;var _0x5a1b53=_0x5f2f[_0x264182];return _0x5a1b53;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 8761171..ee7ba0f 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 _0x5c89=['moment','util','jayson/promise','client','request','error','message','result','getSquareProject','getMailAccountById','ShowMailAccount','Smtp','name','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ListId','ShowPause','agentLogin','LoginUser','PauseUser','agentUnpause','agentLogout','LogoutUser','bluebird'];(function(_0x40b4eb,_0x28be81){var _0x1f966d=function(_0x3d8edf){while(--_0x3d8edf){_0x40b4eb['push'](_0x40b4eb['shift']());}};_0x1f966d(++_0x28be81);}(_0x5c89,0x69));var _0x95c8=function(_0x24540a,_0x493511){_0x24540a=_0x24540a-0x0;var _0x1f59ae=_0x5c89[_0x24540a];return _0x1f59ae;};'use strict';var BPromise=require(_0x95c8('0x0'));var moment=require(_0x95c8('0x1'));var _=require('lodash');var util=require(_0x95c8('0x2'));var jayson=require(_0x95c8('0x3'));var client=jayson[_0x95c8('0x4')]['http']({'port':0x2329});function request(_0x4a037f,_0x3e2a0b){return new BPromise(function(_0x40a32c,_0x487bf7){return client[_0x95c8('0x5')](_0x4a037f,_0x3e2a0b)['then'](function(_0x42529c){if(_0x42529c[_0x95c8('0x6')]){return _0x487bf7(_0x42529c[_0x95c8('0x6')][_0x95c8('0x7')]);}else{return _0x40a32c(_0x42529c[_0x95c8('0x8')]);}})['catch'](function(_0x4dd2c6){return _0x487bf7(_0x4dd2c6);});});}exports[_0x95c8('0x9')]=function(_0x1dd20a){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x1dd20a},'attributes':['production']}});};exports[_0x95c8('0xa')]=function(_0xa960a8){return request(_0x95c8('0xb'),{'options':{'raw':![],'where':{'id':_0xa960a8},'include':[{'model':'MailServerOut','as':_0x95c8('0xc')}],'attributes':['id',_0x95c8('0xd'),'email']}});};exports[_0x95c8('0xe')]=function(_0xc33bed){return request(_0x95c8('0xf'),{'options':{'where':{'id':_0xc33bed},'attributes':[_0x95c8('0xd')]}});};exports[_0x95c8('0x10')]=function(_0x2987e2){return request(_0x95c8('0x11'),{'options':{'where':{'id':_0x2987e2},'attributes':[_0x95c8('0xd')]}});};exports['getVariableById']=function(_0x1f1fb5){return request('ShowVariable',{'options':{'where':{'id':_0x1f1fb5},'attributes':[_0x95c8('0xd')]}});};exports['getSquareOdbcById']=function(_0x509576){return request(_0x95c8('0x12'),{'options':{'where':{'id':_0x509576},'attributes':[_0x95c8('0x13')]}});};exports[_0x95c8('0x14')]=function(_0x3c7abd){return request(_0x95c8('0x15'),{'options':{'where':{'id':_0x3c7abd},'attributes':[_0x95c8('0xd')]}});};exports[_0x95c8('0x16')]=function(_0x340db6){return request(_0x95c8('0x17'),{'options':{'where':{'id':_0x340db6},'attributes':[_0x95c8('0xd')]}});};exports[_0x95c8('0x18')]=function(_0xb78cdc){return request(_0x95c8('0x19'),{'options':{'where':{'id':_0xb78cdc},'attributes':[_0x95c8('0x1a')]}});};exports[_0x95c8('0x1b')]=function(_0x4b4959){return request(_0x95c8('0x1c'),{'options':{'raw':![],'where':{'id':_0x4b4959},'include':[{'model':_0x95c8('0x1d'),'as':_0x95c8('0x1e')}]}});};exports[_0x95c8('0x1f')]=function(_0x307553){return request('ShowSmsAccount',{'options':{'where':{'id':_0x307553},'attributes':['id',_0x95c8('0xd')]}});};exports[_0x95c8('0x20')]=function(_0x4f10f8){return request(_0x95c8('0x21'),{'body':_0x4f10f8});};exports[_0x95c8('0x22')]=function(_0x1885a4){return request(_0x95c8('0x23'),{'body':_0x1885a4});};exports[_0x95c8('0x24')]=function(_0x239613){return request(_0x95c8('0x25'),{'body':_['merge'](_0x239613,{'project_name':_0x239613[_0x95c8('0x26')],'prev_project_name':_0x239613['arg_2']||'','is_subproject':_0x239613['arg_2']?!![]:![],'leaveAt':moment()[_0x95c8('0x27')](_0x95c8('0x28'))})});};exports['createSquareRecording']=function(_0x522a88){return request(_0x95c8('0x29'),{'body':_0x522a88});};exports[_0x95c8('0x2a')]=function(_0x1fd0ba){return request(_0x95c8('0x2b'),{'body':_0x1fd0ba});};exports[_0x95c8('0x2c')]=function(_0x368cd9){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x368cd9['phone'],'ListId':_0x368cd9[_0x95c8('0x2d')]}}})['then'](function(_0x31ec76){if(_0x31ec76){return _0x31ec76;}return request('CreateCmContact',{'body':_0x368cd9});});};exports['getPauseById']=function(_0x82012f){return request(_0x95c8('0x2e'),{'options':{'where':{'id':_0x82012f},'attributes':[_0x95c8('0xd')]}});};exports[_0x95c8('0x2f')]=function(_0x370fba,_0x295a1c){return request(_0x95c8('0x30'),{'body':{'interface':_0x295a1c},'options':{'where':_0x370fba}});};exports['agentPause']=function(_0x3aad32,_0x24b14e,_0x326cff){return request(_0x95c8('0x31'),{'body':{'type':_0x24b14e,'uniqueid':_0x326cff},'options':{'where':_0x3aad32}});};exports[_0x95c8('0x32')]=function(_0x3f789a){return request('UnpauseUser',{'body':{},'options':{'where':_0x3f789a}});};exports[_0x95c8('0x33')]=function(_0x4038ea){return request(_0x95c8('0x34'),{'body':{},'options':{'where':_0x4038ea}});}; \ No newline at end of file +var _0xd5e5=['ShowVariable','getUserById','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_2','format','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','then','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','moment','util','client','http','request','error','message','result','catch','getSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd5e5,0x187));var _0x5d5e=function(_0x190c9f,_0x1c29e7){_0x190c9f=_0x190c9f-0x0;var _0x2151b8=_0xd5e5[_0x190c9f];return _0x2151b8;};'use strict';var BPromise=require('bluebird');var moment=require(_0x5d5e('0x0'));var _=require('lodash');var util=require(_0x5d5e('0x1'));var jayson=require('jayson/promise');var client=jayson[_0x5d5e('0x2')][_0x5d5e('0x3')]({'port':0x2329});function request(_0x3b58c5,_0x4033dd){return new BPromise(function(_0xff3d1,_0x2818ae){return client[_0x5d5e('0x4')](_0x3b58c5,_0x4033dd)['then'](function(_0x38de77){if(_0x38de77[_0x5d5e('0x5')]){return _0x2818ae(_0x38de77[_0x5d5e('0x5')][_0x5d5e('0x6')]);}else{return _0xff3d1(_0x38de77[_0x5d5e('0x7')]);}})[_0x5d5e('0x8')](function(_0x21e55e){return _0x2818ae(_0x21e55e);});});}exports[_0x5d5e('0x9')]=function(_0x35c3f1){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x35c3f1},'attributes':[_0x5d5e('0xa')]}});};exports[_0x5d5e('0xb')]=function(_0x1af62a){return request(_0x5d5e('0xc'),{'options':{'raw':![],'where':{'id':_0x1af62a},'include':[{'model':_0x5d5e('0xd'),'as':_0x5d5e('0xe')}],'attributes':['id',_0x5d5e('0xf'),_0x5d5e('0x10')]}});};exports[_0x5d5e('0x11')]=function(_0xb09e1e){return request(_0x5d5e('0x12'),{'options':{'where':{'id':_0xb09e1e},'attributes':[_0x5d5e('0xf')]}});};exports[_0x5d5e('0x13')]=function(_0x3a7480){return request(_0x5d5e('0x14'),{'options':{'where':{'id':_0x3a7480},'attributes':[_0x5d5e('0xf')]}});};exports[_0x5d5e('0x15')]=function(_0x1eb073){return request(_0x5d5e('0x16'),{'options':{'where':{'id':_0x1eb073},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x2e47f2){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x2e47f2},'attributes':['dsn']}});};exports[_0x5d5e('0x17')]=function(_0x4dfac7){return request('ShowUser',{'options':{'where':{'id':_0x4dfac7},'attributes':[_0x5d5e('0xf')]}});};exports[_0x5d5e('0x18')]=function(_0x219d21){return request(_0x5d5e('0x19'),{'options':{'where':{'id':_0x219d21},'attributes':[_0x5d5e('0xf')]}});};exports[_0x5d5e('0x1a')]=function(_0x4e9bbf){return request(_0x5d5e('0x1b'),{'options':{'where':{'id':_0x4e9bbf},'attributes':[_0x5d5e('0x1c')]}});};exports[_0x5d5e('0x1d')]=function(_0x553c79){return request(_0x5d5e('0x1e'),{'options':{'raw':![],'where':{'id':_0x553c79},'include':[{'model':_0x5d5e('0x1f'),'as':_0x5d5e('0x20')}]}});};exports[_0x5d5e('0x21')]=function(_0x439c11){return request(_0x5d5e('0x22'),{'options':{'where':{'id':_0x439c11},'attributes':['id',_0x5d5e('0xf')]}});};exports['createSmsMessage']=function(_0x7eb0d3){return request(_0x5d5e('0x23'),{'body':_0x7eb0d3});};exports[_0x5d5e('0x24')]=function(_0x2261ae){return request(_0x5d5e('0x25'),{'body':_0x2261ae});};exports[_0x5d5e('0x26')]=function(_0x121402){return request(_0x5d5e('0x27'),{'body':_['merge'](_0x121402,{'project_name':_0x121402['arg_1'],'prev_project_name':_0x121402['arg_2']||'','is_subproject':_0x121402[_0x5d5e('0x28')]?!![]:![],'leaveAt':moment()[_0x5d5e('0x29')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x2798ec){return request('CreateSquareRecording',{'body':_0x2798ec});};exports[_0x5d5e('0x2a')]=function(_0xdeebc6){return request(_0x5d5e('0x2b'),{'body':_0xdeebc6});};exports[_0x5d5e('0x2c')]=function(_0x5132a4){return request(_0x5d5e('0x2d'),{'options':{'raw':![],'where':{'phone':_0x5132a4[_0x5d5e('0x2e')],'ListId':_0x5132a4[_0x5d5e('0x2f')]}}})[_0x5d5e('0x30')](function(_0x2b76b1){if(_0x2b76b1){return _0x2b76b1;}return request(_0x5d5e('0x31'),{'body':_0x5132a4});});};exports[_0x5d5e('0x32')]=function(_0x352487){return request(_0x5d5e('0x33'),{'options':{'where':{'id':_0x352487},'attributes':[_0x5d5e('0xf')]}});};exports[_0x5d5e('0x34')]=function(_0x41cdfc,_0x265532){return request(_0x5d5e('0x35'),{'body':{'interface':_0x265532},'options':{'where':_0x41cdfc}});};exports[_0x5d5e('0x36')]=function(_0x1d4066,_0x569427,_0x1f0bd9){return request(_0x5d5e('0x37'),{'body':{'type':_0x569427,'uniqueid':_0x1f0bd9},'options':{'where':_0x1d4066}});};exports['agentUnpause']=function(_0x192b07){return request(_0x5d5e('0x38'),{'body':{},'options':{'where':_0x192b07}});};exports[_0x5d5e('0x39')]=function(_0x5328d7){return request(_0x5d5e('0x3a'),{'body':{},'options':{'where':_0x5328d7}});}; \ 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 28cfe96..d0cc532 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 polly=require('./polly');var lex=require('./lex');module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xca66=['./polly'];(function(_0x1d211b,_0x475f3b){var _0x47c88b=function(_0x3126f5){while(--_0x3126f5){_0x1d211b['push'](_0x1d211b['shift']());}};_0x47c88b(++_0x475f3b);}(_0xca66,0x8b));var _0x6ca6=function(_0xe91125,_0x791acb){_0xe91125=_0xe91125-0x0;var _0x4536b2=_0xca66[_0xe91125];return _0x4536b2;};var polly=require(_0x6ca6('0x0'));var lex=require('./lex');module['exports']={'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 c1b20ba..97c42ff 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 _0x2904=['exports','./lib/api'];(function(_0x4cce60,_0x30430b){var _0x1f8099=function(_0x384d00){while(--_0x384d00){_0x4cce60['push'](_0x4cce60['shift']());}};_0x1f8099(++_0x30430b);}(_0x2904,0x137));var _0x4290=function(_0xa49880,_0x552f59){_0xa49880=_0xa49880-0x0;var _0x1cda24=_0x2904[_0xa49880];return _0x1cda24;};'use strict';var lex=require(_0x4290('0x0'));module[_0x4290('0x1')]=function(_0x4e57b1,_0x218262,_0x511133,_0x30c1c2,_0x3d09c0,_0x155538){return lex(_0x4e57b1,_0x218262,_0x511133,_0x30c1c2,_0x3d09c0,_0x155538);}; \ No newline at end of file +var _0xac55=['./lib/api','exports'];(function(_0xcac916,_0x360113){var _0x4ae255=function(_0x5f3a69){while(--_0x5f3a69){_0xcac916['push'](_0xcac916['shift']());}};_0x4ae255(++_0x360113);}(_0xac55,0x1c8));var _0x5ac5=function(_0x1ec508,_0x291d20){_0x1ec508=_0x1ec508-0x0;var _0x1cb231=_0xac55[_0x1ec508];return _0x1cb231;};'use strict';var lex=require(_0x5ac5('0x0'));module[_0x5ac5('0x1')]=function(_0x22f811,_0x2de0ff,_0x5ac30d,_0x17b1d9,_0x13fcc6,_0x192f9d){return lex(_0x22f811,_0x2de0ff,_0x5ac30d,_0x17b1d9,_0x13fcc6,_0x192f9d);}; \ 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 f2c3eb7..1ced720 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 _0xb850=['postText','slots','slot_','exports','LexRuntime','$LATEST','aws-sdk'];(function(_0x2bb66c,_0x36c6c6){var _0x1e0f98=function(_0x1e3412){while(--_0x1e3412){_0x2bb66c['push'](_0x2bb66c['shift']());}};_0x1e0f98(++_0x36c6c6);}(_0xb850,0xdf));var _0x0b85=function(_0x5070a4,_0x1db896){_0x5070a4=_0x5070a4-0x0;var _0x179668=_0xb850[_0x5070a4];return _0x179668;};'use strict';var BPromise=require('bluebird');var AWS=require(_0x0b85('0x0'));function lexResult(_0x4e89dd,_0x58222c){return new BPromise(function(_0x3f22b2,_0x8f24a9){_0x4e89dd[_0x0b85('0x1')](_0x58222c,function(_0x8ffab3,_0x590ffa){if(_0x8ffab3){_0x8f24a9(_0x8ffab3);}if(_0x590ffa['slots']){for(const _0x2f7e75 in _0x590ffa['slots']){if(_0x590ffa[_0x0b85('0x2')]['hasOwnProperty'](_0x2f7e75)){var _0x2de286=_0x590ffa[_0x0b85('0x2')][_0x2f7e75];_0x590ffa[_0x0b85('0x3')+_0x2f7e75]=_0x2de286;}}}_0x3f22b2(_0x590ffa);});});}module[_0x0b85('0x4')]=function(_0x2e8a0a,_0x5011ae,_0x47cb7d,_0x273f46,_0x2a6e87,_0x15e6a4){var _0x55fe45=new AWS[(_0x0b85('0x5'))]({'accessKeyId':_0x5011ae,'secretAccessKey':_0x47cb7d,'region':_0x273f46});var _0x85f275={'botAlias':_0x0b85('0x6'),'botName':_0x15e6a4,'inputText':_0x2a6e87,'userId':_0x2e8a0a};return lexResult(_0x55fe45,_0x85f275);}; \ No newline at end of file +var _0xf6c9=['postText','slots','hasOwnProperty','slot_','exports','LexRuntime','$LATEST','aws-sdk'];(function(_0x250e97,_0x388d3a){var _0x382133=function(_0x28f3c6){while(--_0x28f3c6){_0x250e97['push'](_0x250e97['shift']());}};_0x382133(++_0x388d3a);}(_0xf6c9,0x11f));var _0x9f6c=function(_0x30eed2,_0x6786f9){_0x30eed2=_0x30eed2-0x0;var _0x355151=_0xf6c9[_0x30eed2];return _0x355151;};'use strict';var BPromise=require('bluebird');var AWS=require(_0x9f6c('0x0'));function lexResult(_0x4f713e,_0x30ae54){return new BPromise(function(_0xf1ae2c,_0x3e7274){_0x4f713e[_0x9f6c('0x1')](_0x30ae54,function(_0x116463,_0x38dae8){if(_0x116463){_0x3e7274(_0x116463);}if(_0x38dae8[_0x9f6c('0x2')]){for(const _0x4822ec in _0x38dae8[_0x9f6c('0x2')]){if(_0x38dae8[_0x9f6c('0x2')][_0x9f6c('0x3')](_0x4822ec)){var _0x3d5b81=_0x38dae8['slots'][_0x4822ec];_0x38dae8[_0x9f6c('0x4')+_0x4822ec]=_0x3d5b81;}}}_0xf1ae2c(_0x38dae8);});});}module[_0x9f6c('0x5')]=function(_0x4ed219,_0x1b9fb8,_0x544dcc,_0x458707,_0x1a02f2,_0x2dff60){var _0x469e17=new AWS[(_0x9f6c('0x6'))]({'accessKeyId':_0x1b9fb8,'secretAccessKey':_0x544dcc,'region':_0x458707});var _0x5e704d={'botAlias':_0x9f6c('0x7'),'botName':_0x2dff60,'inputText':_0x1a02f2,'userId':_0x4ed219};return lexResult(_0x469e17,_0x5e704d);}; \ 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 bb62410..24cd0da 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 _0x43b5=['./lib/api'];(function(_0x25e2ae,_0x5f589e){var _0x14985=function(_0x43c150){while(--_0x43c150){_0x25e2ae['push'](_0x25e2ae['shift']());}};_0x14985(++_0x5f589e);}(_0x43b5,0x8f));var _0x543b=function(_0x3cfad7,_0x1ccfc0){_0x3cfad7=_0x3cfad7-0x0;var _0x2c91e8=_0x43b5[_0x3cfad7];return _0x2c91e8;};'use strict';var polly=require(_0x543b('0x0'));module['exports']=function(_0x4d57c8,_0x559ab7,_0x1b6364,_0x15b6eb,_0x122478,_0x3cb514,_0xd9a3ca){return polly(_0x4d57c8,_0x559ab7,_0x1b6364,_0x15b6eb,_0x122478,_0x3cb514,_0xd9a3ca);}; \ No newline at end of file +var _0x74a0=['exports'];(function(_0x13117b,_0xb1a8eb){var _0x56b193=function(_0x205655){while(--_0x205655){_0x13117b['push'](_0x13117b['shift']());}};_0x56b193(++_0xb1a8eb);}(_0x74a0,0xf8));var _0x074a=function(_0x45cfd1,_0x215bc7){_0x45cfd1=_0x45cfd1-0x0;var _0x28e9f3=_0x74a0[_0x45cfd1];return _0x28e9f3;};'use strict';var polly=require('./lib/api');module[_0x074a('0x0')]=function(_0x1629f4,_0x355bc4,_0x4ba521,_0x593cd4,_0x24f1cf,_0x13e328,_0x25f3d3){return polly(_0x1629f4,_0x355bc4,_0x4ba521,_0x593cd4,_0x24f1cf,_0x13e328,_0x25f3d3);}; \ 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 e613327..8108e35 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 _0x2acd=['No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','path','bluebird','randomstring','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x1ae31c,_0x8dcd2d){var _0x19519d=function(_0x22b8cd){while(--_0x22b8cd){_0x1ae31c['push'](_0x1ae31c['shift']());}};_0x19519d(++_0x8dcd2d);}(_0x2acd,0x16c));var _0xd2ac=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x2acd[_0x5d2803];return _0xdcad2c;};'use strict';var fs=require('fs');var path=require(_0xd2ac('0x0'));var BPromise=require(_0xd2ac('0x1'));var rs=require(_0xd2ac('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x1cc367,_0x1abc37,_0x389321){return new BPromise(function(_0x5da986,_0x1a2bce){_0x1cc367['synthesizeSpeech'](_0x1abc37,function(_0x95e70e,_0x12a63f){if(_0x95e70e){_0x1a2bce(_0x95e70e);}else if(_0x12a63f){if(_0x12a63f[_0xd2ac('0x3')]instanceof Buffer){fs['writeFile'](_0x389321,_0x12a63f[_0xd2ac('0x3')],function(_0x2622fb){if(_0x2622fb){_0x1a2bce(_0x2622fb);}else{_0x5da986();}});}else{_0x1a2bce(new Error(_0xd2ac('0x4')));}}else{_0x1a2bce(new Error(_0xd2ac('0x5')));}});});}module[_0xd2ac('0x6')]=function(_0x53a061,_0x703bc5,_0x388277,_0x52a0e1,_0x133f7f,_0x22bb60,_0x4f4faa){var _0x166c79=new AWS['Polly']({'accessKeyId':_0x53a061,'secretAccessKey':_0x703bc5,'region':_0x388277});var _0x455bdb={'Text':_0x133f7f,'TextType':_0x22bb60||_0xd2ac('0x7'),'OutputFormat':_0xd2ac('0x8'),'VoiceId':_0x52a0e1};return pollyResult(_0x166c79,_0x455bdb,_0x4f4faa);}; \ No newline at end of file +var _0xea73=['bluebird','randomstring','aws-sdk','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path'];(function(_0x2eed21,_0x575fed){var _0x40c06a=function(_0x145cbe){while(--_0x145cbe){_0x2eed21['push'](_0x2eed21['shift']());}};_0x40c06a(++_0x575fed);}(_0xea73,0x113));var _0x3ea7=function(_0x303c19,_0x4d7002){_0x303c19=_0x303c19-0x0;var _0x1dc836=_0xea73[_0x303c19];return _0x1dc836;};'use strict';var fs=require('fs');var path=require(_0x3ea7('0x0'));var BPromise=require(_0x3ea7('0x1'));var rs=require(_0x3ea7('0x2'));var AWS=require(_0x3ea7('0x3'));function pollyResult(_0x1c5d89,_0x58bf78,_0x285af9){return new BPromise(function(_0x4699b5,_0x4eef4e){_0x1c5d89['synthesizeSpeech'](_0x58bf78,function(_0x540a13,_0x161d6f){if(_0x540a13){_0x4eef4e(_0x540a13);}else if(_0x161d6f){if(_0x161d6f['AudioStream']instanceof Buffer){fs[_0x3ea7('0x4')](_0x285af9,_0x161d6f[_0x3ea7('0x5')],function(_0x4072fb){if(_0x4072fb){_0x4eef4e(_0x4072fb);}else{_0x4699b5();}});}else{_0x4eef4e(new Error(_0x3ea7('0x6')));}}else{_0x4eef4e(new Error(_0x3ea7('0x7')));}});});}module[_0x3ea7('0x8')]=function(_0x1f28f4,_0x183367,_0x10e1fa,_0x15306a,_0x214f6b,_0x4b6944,_0x12196c){var _0x35f6ac=new AWS[(_0x3ea7('0x9'))]({'accessKeyId':_0x1f28f4,'secretAccessKey':_0x183367,'region':_0x10e1fa});var _0x196668={'Text':_0x214f6b,'TextType':_0x4b6944||_0x3ea7('0xa'),'OutputFormat':_0x3ea7('0xb'),'VoiceId':_0x15306a};return pollyResult(_0x35f6ac,_0x196668,_0x12196c);}; \ 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 66f07e9..b0c3847 100644 --- a/server/services/agi/scripts/google/asr/index.js +++ b/server/services/agi/scripts/google/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3001=['exports'];(function(_0x3394da,_0x47b9d2){var _0x2d8fc8=function(_0x573c29){while(--_0x573c29){_0x3394da['push'](_0x3394da['shift']());}};_0x2d8fc8(++_0x47b9d2);}(_0x3001,0x68));var _0x1300=function(_0x573c98,_0x4a86cc){_0x573c98=_0x573c98-0x0;var _0x4b792a=_0x3001[_0x573c98];return _0x4b792a;};'use strict';var asr=require('./lib/api');module[_0x1300('0x0')]=function(_0x4f4f03,_0x1174e5,_0x23958f,_0x4ce472){return asr(_0x4f4f03,_0x1174e5,_0x23958f);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x5302d4,_0x4cf1fb,_0x1ba5f0,_0x47ca5f){return asr(_0x5302d4,_0x4cf1fb,_0x1ba5f0);}; \ 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 3ff1591..2012e71 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 _0xabe7=['length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','exports','string'];(function(_0x4c5c3f,_0x49c006){var _0x337cac=function(_0x1b685a){while(--_0x1b685a){_0x4c5c3f['push'](_0x4c5c3f['shift']());}};_0x337cac(++_0x49c006);}(_0xabe7,0x114));var _0x7abe=function(_0x5781c0,_0xe1e5d1){_0x5781c0=_0x5781c0-0x0;var _0x4e0e19=_0xabe7[_0x5781c0];return _0x4e0e19;};'use strict';var url=require(_0x7abe('0x0'));var BPromise=require(_0x7abe('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x7abe('0x2')]=function(_0x550148,_0x590cc8,_0x5dade9){return new BPromise(function(_0x528eae,_0x428aa7){var _0x1c47b8;if(typeof _0x550148!==_0x7abe('0x3')||_0x550148[_0x7abe('0x4')]===0x0){return _0x428aa7(_0x7abe('0x5'));}if(typeof _0x590cc8!==_0x7abe('0x3')||_0x590cc8[_0x7abe('0x4')]===0x0){return _0x428aa7(_0x7abe('0x6'));}if(typeof _0x5dade9!=='undefined'&&(typeof _0x5dade9!==_0x7abe('0x3')||_0x5dade9['length']===0x0)){return _0x428aa7(_0x7abe('0x7'));}try{_0x1c47b8=fs['readFileSync'](_0x550148)[_0x7abe('0x8')](_0x7abe('0x9'));}catch(_0x555980){return _0x428aa7(_0x555980);}return _0x528eae({'method':_0x7abe('0xa'),'uri':host+_0x7abe('0xb')+_0x590cc8,'body':{'config':{'encoding':_0x7abe('0xc'),'sampleRateHertz':_0x7abe('0xd'),'languageCode':_0x5dade9},'audio':{'content':_0x1c47b8}},'json':!![]});});}; \ No newline at end of file +var _0xd8c8=['https://speech.googleapis.com','exports','filepath\x20should\x20be\x20a\x20string','string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','bluebird'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xd8c8,0x14f));var _0x8d8c=function(_0x20adb6,_0x545b62){_0x20adb6=_0x20adb6-0x0;var _0x433c43=_0xd8c8[_0x20adb6];return _0x433c43;};'use strict';var url=require('url');var BPromise=require(_0x8d8c('0x0'));var fs=require('fs');var host=_0x8d8c('0x1');module[_0x8d8c('0x2')]=function(_0x1bf4e6,_0x31f4c1,_0x1282c2){return new BPromise(function(_0xe78447,_0x341b73){var _0x133d51;if(typeof _0x1bf4e6!=='string'||_0x1bf4e6['length']===0x0){return _0x341b73(_0x8d8c('0x3'));}if(typeof _0x31f4c1!==_0x8d8c('0x4')||_0x31f4c1[_0x8d8c('0x5')]===0x0){return _0x341b73(_0x8d8c('0x6'));}if(typeof _0x1282c2!==_0x8d8c('0x7')&&(typeof _0x1282c2!==_0x8d8c('0x4')||_0x1282c2[_0x8d8c('0x5')]===0x0)){return _0x341b73(_0x8d8c('0x8'));}try{_0x133d51=fs[_0x8d8c('0x9')](_0x1bf4e6)[_0x8d8c('0xa')](_0x8d8c('0xb'));}catch(_0x1b6b0c){return _0x341b73(_0x1b6b0c);}return _0xe78447({'method':_0x8d8c('0xc'),'uri':host+_0x8d8c('0xd')+_0x31f4c1,'body':{'config':{'encoding':_0x8d8c('0xe'),'sampleRateHertz':_0x8d8c('0xf'),'languageCode':_0x1282c2},'audio':{'content':_0x133d51}},'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 1c0c586..3d3a62a 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 _0xfefc=['./asr','exports'];(function(_0x235fac,_0x21bea6){var _0x1f371b=function(_0xf9ea96){while(--_0xf9ea96){_0x235fac['push'](_0x235fac['shift']());}};_0x1f371b(++_0x21bea6);}(_0xfefc,0xfa));var _0xcfef=function(_0x5a0133,_0x1ee2d2){_0x5a0133=_0x5a0133-0x0;var _0x4bcf7b=_0xfefc[_0x5a0133];return _0x4bcf7b;};var asr=require(_0xcfef('0x0'));module[_0xcfef('0x1')]={'asr':asr}; \ No newline at end of file +var _0x7d8a=['exports','./asr'];(function(_0x4d69d1,_0x211712){var _0x4950ad=function(_0x4868b8){while(--_0x4868b8){_0x4d69d1['push'](_0x4d69d1['shift']());}};_0x4950ad(++_0x211712);}(_0x7d8a,0xbf));var _0xa7d8=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0x7d8a[_0x2f71f6];return _0x2b23ea;};var asr=require(_0xa7d8('0x0'));module[_0xa7d8('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 9b37829..a1e928e 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 _0xb5bb=['url','parse','util','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','https:','WHAT_EVER','statusCode','request\x20to\x20','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','error','unlink','download\x20error','end','protocol','host','data','error\x20convert','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','base64','chmodSync','777','split','readFileSync','toString','googleCloudTTS','?key=','input','MP3','then','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','application/x-www-form-urlencoded','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','\x22\x20might\x20not\x20exist','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','textRequest','result','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','Dialogflow\x20V2\x20response:','allRequiredParamsPresent','diagnosticInfo','queryResult','fields','end_conversation','boolValue','fulfillmentText','intent','languageCode','queryText','responseId','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','.mp3','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','freeform=3','sestekNDA','nda','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','bluebird','dialogflow','http','https','md5','path','querystring','randomstring','sox','google-tts-api'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xb5bb,0x176));var _0xbb5b=function(_0x422ec9,_0x3215d1){_0x422ec9=_0x422ec9-0x0;var _0x41b3b8=_0xb5bb[_0x422ec9];return _0x41b3b8;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0xbb5b('0x0'));var dialogflow=require(_0xbb5b('0x1'));var fs=require('fs');var http=require(_0xbb5b('0x2'));var https=require(_0xbb5b('0x3'));var md5=require(_0xbb5b('0x4'));var path=require(_0xbb5b('0x5'));var querystring=require(_0xbb5b('0x6'));var rp=require('request-promise');var rs=require(_0xbb5b('0x7'));var sox=require(_0xbb5b('0x8'));var tts=require(_0xbb5b('0x9'));var urlParse=require(_0xbb5b('0xa'))[_0xbb5b('0xb')];var util=require(_0xbb5b('0xc'));var aws=require('./aws');var google=require(_0xbb5b('0xd'));var sestek=require(_0xbb5b('0xe'));var tilde=require(_0xbb5b('0xf'));var logger=require('../../../config/logger')(_0xbb5b('0x10'));var ISPEECH_API=_0xbb5b('0x11');function downloadFile(_0x51e371,_0x54ef96){return new BPromise(function(_0x10569a,_0x4cedc5){var _0x53c940=urlParse(_0x51e371);var _0x5e605d=_0x53c940['protocol']===_0xbb5b('0x12')?https:http;var _0x340690={'host':_0x53c940['host'],'path':_0x53c940['path'],'headers':{'user-agent':_0xbb5b('0x13')}};_0x5e605d['get'](_0x340690,function(_0x8f7ad){if(_0x8f7ad[_0xbb5b('0x14')]!==0xc8){logger['error'](_0xbb5b('0x15')+_0x51e371+'\x20failed,\x20status\x20code\x20=\x20'+_0x8f7ad['statusCode']+'\x20('+_0x8f7ad[_0xbb5b('0x16')]+')');_0x4cedc5(new Error('request\x20to\x20'+_0x51e371+_0xbb5b('0x17')+_0x8f7ad[_0xbb5b('0x14')]+'\x20('+_0x8f7ad[_0xbb5b('0x16')]+')'));return;}var _0x5e156f=fs[_0xbb5b('0x18')](_0x54ef96);_0x5e156f['on'](_0xbb5b('0x19'),function(){logger[_0xbb5b('0x1a')]('finish\x20download\x20file');_0x5e156f['close'](_0x10569a);});_0x5e156f['on'](_0xbb5b('0x1b'),function(_0xb0e72e){fs[_0xbb5b('0x1c')](_0x54ef96);logger[_0xbb5b('0x1b')](_0xbb5b('0x1d'),_0xb0e72e);_0x4cedc5(_0xb0e72e);});_0x8f7ad['pipe'](_0x5e156f);})['on'](_0xbb5b('0x1b'),function(_0x4307ed){logger[_0xbb5b('0x1b')](_0x4307ed);_0x4cedc5(_0x4307ed);})[_0xbb5b('0x1e')]();});}function uploadFile(_0x546339){return new BPromise(function(_0x344081,_0x5559b7){var _0x128d08=urlParse(_0x546339);var _0x4aba43=_0x128d08[_0xbb5b('0x1f')]===_0xbb5b('0x12')?https:http;var _0x3e8eb1={'host':_0x128d08[_0xbb5b('0x20')],'path':_0x128d08[_0xbb5b('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x4aba43['get'](_0x3e8eb1,function(_0x2d3ac1){if(_0x2d3ac1[_0xbb5b('0x14')]!==0xc8){_0x5559b7(new Error(_0xbb5b('0x15')+_0x546339+_0xbb5b('0x17')+_0x2d3ac1[_0xbb5b('0x14')]+'\x20('+_0x2d3ac1[_0xbb5b('0x16')]+')'));return;}var _0x13fe02='';_0x2d3ac1['on'](_0xbb5b('0x21'),function(_0x5ebf60){_0x13fe02+=_0x5ebf60;});_0x2d3ac1['on']('end',function(){_0x344081(_0x13fe02);});})['on'](_0xbb5b('0x1b'),function(_0xefb220){_0x5559b7(_0xefb220);})[_0xbb5b('0x1e')]();});}function convertFile(_0x8c122e,_0x4a0dbb){return new BPromise(function(_0x343400,_0x232b74){var _0x44d5b0=sox['transcode'](_0x8c122e,_0x4a0dbb,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x44d5b0['on'](_0xbb5b('0x1b'),function(_0x2c2309){logger['error'](_0xbb5b('0x22'),_0x2c2309);_0x232b74(_0x2c2309);});_0x44d5b0['on']('end',function(){logger[_0xbb5b('0x1a')](_0xbb5b('0x23'));_0x343400();});_0x44d5b0['start']();});}function base64Decode(_0x3b2206,_0xf7f30d){var _0x500857=path[_0xbb5b('0x24')](__dirname,_0xbb5b('0x25'),rs[_0xbb5b('0x26')](0x4)+_0xbb5b('0x27'));fs[_0xbb5b('0x28')](_0x500857,_0x3b2206,_0xbb5b('0x29'));return convertFile(_0x500857,_0xf7f30d)['then'](function(){try{fs[_0xbb5b('0x1c')](_0x500857);fs[_0xbb5b('0x2a')](_0xf7f30d,_0xbb5b('0x2b'));}catch(_0x7f4d9b){logger[_0xbb5b('0x1b')](_0x7f4d9b);}return _0xf7f30d[_0xbb5b('0x2c')]('.')[0x0];});}function base64Encode(_0x5e6423){var _0x557c39=fs[_0xbb5b('0x2d')](_0x5e6423);return new Buffer(_0x557c39)[_0xbb5b('0x2e')]('base64');}exports[_0xbb5b('0x2f')]=function(_0x2f51b8,_0x199415,_0x4be4f3,_0x3e7643,_0x354732,_0xe8ca70){var _0x2981c6,_0x2f6f4d;var _0x25abea='https://texttospeech.googleapis.com/v1/';var _0x5a2234=_0xbb5b('0x30')+_0x2f51b8;var _0x33d8bc={};if(_0x199415==='ssml'){_0x33d8bc['input']={'ssml':_0x4be4f3};}else{_0x33d8bc[_0xbb5b('0x31')]={'text':_0x4be4f3};};_0x33d8bc['voice']={'languageCode':_0x3e7643,'ssmlGender':_0x354732};_0x33d8bc['audioConfig']={'audioEncoding':_0xbb5b('0x32'),'sampleRateHertz':0x1f40};var _0x3e6593={'url':_0x25abea+'text:synthesize'+_0x5a2234,'method':'POST','json':!![],'body':_0x33d8bc};return rp(_0x3e6593)[_0xbb5b('0x33')](function(_0x496ae4){return new BPromise(function(_0x429456,_0x9d17a3){_0x2981c6=path['resolve'](__dirname,_0xbb5b('0x25'),rs[_0xbb5b('0x26')](0x4)+'.mp3');var _0x101f05=Buffer[_0xbb5b('0x34')](_0x496ae4[_0xbb5b('0x35')],_0xbb5b('0x29'));return fs[_0xbb5b('0x36')](_0x2981c6,_0x101f05,function(_0x7cdc3){_0x9d17a3(_0x7cdc3);},function(_0x37aa66){fs['chmodSync'](_0x2981c6,'777');_0x429456(_0x37aa66);});});})[_0xbb5b('0x33')](function(_0x5db8c1){_0x2f6f4d=path[_0xbb5b('0x24')](__dirname,_0xbb5b('0x25'),rs['generate'](0x4)+_0xbb5b('0x27'));return convertFile(_0x2981c6,_0x2f6f4d);})[_0xbb5b('0x33')](function(){try{fs['unlink'](_0x2981c6);fs[_0xbb5b('0x2a')](_0x2f6f4d,'777');}catch(_0x5c7418){logger[_0xbb5b('0x1b')](_0x5c7418);}logger[_0xbb5b('0x1a')](_0xbb5b('0x37'),_0x2f6f4d[_0xbb5b('0x2c')]('.')[0x0]);return _0x2f6f4d[_0xbb5b('0x2c')]('.')[0x0];});};exports[_0xbb5b('0x38')]=function(_0x55a8a0,_0x2d5112){var _0x4507f9=_0xbb5b('0x39');var _0x23f063,_0x1a8cf2;var _0x25cf87;var _0x44d024={'encoding':_0xbb5b('0x3a'),'method':_0xbb5b('0x3b'),'timeout':0x2710,'url':_0x4507f9,'headers':{'Content-Type':_0xbb5b('0x3c')},'body':'f.req='+encodeURIComponent(JSON[_0xbb5b('0x3d')]([[['jQ1olc',JSON[_0xbb5b('0x3d')]([_0x55a8a0,_0x2d5112||'en',![],_0xbb5b('0x3e')]),null,_0xbb5b('0x3f')]]]))};return rp(_0x44d024)[_0xbb5b('0x33')](function(_0x2bce41){try{_0x25cf87=eval(_0x2bce41[_0xbb5b('0x40')](0x5))[0x0][0x2];}catch(_0x28e912){throw new Error(_0xbb5b('0x41')+_0x2bce41[_0xbb5b('0x21')]);}if(!_0x25cf87){if(_0x55a8a0['length']>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error('lang\x20\x22'+_0x2d5112+_0xbb5b('0x42'));}}try{_0x25cf87=eval(_0x25cf87)[0x0];}catch(_0x5cbc10){throw new Error(_0xbb5b('0x41')+res[_0xbb5b('0x21')]);}const _0x1c7341=_0x25cf87;_0x23f063=path[_0xbb5b('0x24')](__dirname,'tmp',rs[_0xbb5b('0x26')](0x4)+'.mp3');fs[_0xbb5b('0x28')](_0x23f063,_0x25cf87,{'encoding':_0xbb5b('0x29')});_0x1a8cf2=path['resolve'](__dirname,_0xbb5b('0x25'),rs[_0xbb5b('0x26')](0x4)+_0xbb5b('0x27'));return convertFile(_0x23f063,_0x1a8cf2);})[_0xbb5b('0x33')](function(){try{fs[_0xbb5b('0x1c')](_0x23f063);fs['chmodSync'](_0x1a8cf2,_0xbb5b('0x2b'));}catch(_0x1cdc46){logger[_0xbb5b('0x1b')](_0x1cdc46);}logger[_0xbb5b('0x1a')](_0xbb5b('0x43'),_0x1a8cf2[_0xbb5b('0x2c')]('.')[0x0]);return _0x1a8cf2[_0xbb5b('0x2c')]('.')[0x0];});};exports['googleASR']=function(_0x5416b3,_0x1009ea,_0x1533e5){return google[_0xbb5b('0x44')](_0x5416b3,_0x1009ea,_0x1533e5)[_0xbb5b('0x33')](function(_0x1c72d6){logger[_0xbb5b('0x1a')](_0x1c72d6[_0xbb5b('0x45')]);return rp(_0x1c72d6);})[_0xbb5b('0x33')](function(_0x2d4957){var _0x322911='';var _0x155ab1=0x0;try{fs['unlink'](_0x5416b3);}catch(_0x1ef458){logger['error'](_0x1ef458);}if(_0x2d4957&&_0x2d4957[_0xbb5b('0x46')]){_0x322911=_0x2d4957['results'][_0xbb5b('0x47')](function(_0x333b9d){return _0x333b9d&&_0x333b9d[_0xbb5b('0x48')][0x0]&&_0x333b9d[_0xbb5b('0x48')][0x0]['transcript']?_0x333b9d[_0xbb5b('0x48')][0x0][_0xbb5b('0x49')]:'';})[_0xbb5b('0x4a')]('\x0a');_0x155ab1=_0x2d4957[_0xbb5b('0x46')][_0xbb5b('0x47')](function(_0x12f908){return _0x12f908&&_0x12f908[_0xbb5b('0x48')][0x0]&&_0x12f908[_0xbb5b('0x48')][0x0][_0xbb5b('0x4b')]?_0x12f908[_0xbb5b('0x48')][0x0][_0xbb5b('0x4b')]:0x0;})[_0xbb5b('0x4a')]('\x0a');}logger[_0xbb5b('0x1a')](_0xbb5b('0x4c'),_0x322911);logger[_0xbb5b('0x1a')](_0xbb5b('0x4d'),_0x155ab1);return{'transcript':_0x322911,'confidence':_0x155ab1};})[_0xbb5b('0x4e')](function(_0x4e5808){logger[_0xbb5b('0x1b')](_0xbb5b('0x4f'),_0x4e5808['statusCode'],_0x4e5808[_0xbb5b('0x50')],_0x4e5808['message']);});};exports[_0xbb5b('0x51')]=function(_0x12363a,_0x123d5d,_0x1d805f,_0xe68492){var _0x3611a4=apiai(_0x123d5d,{'language':_0xe68492||'en'});return _0x3611a4[_0xbb5b('0x52')](_0x1d805f,{'sessionId':md5(_0x12363a)})[_0xbb5b('0x33')](function(_0x42d335){logger[_0xbb5b('0x1a')](JSON['stringify'](_0x42d335));return{'source':_0x42d335[_0xbb5b('0x53')]['source'],'resolvedQuery':_0x42d335['result']['resolvedQuery'],'action':_0x42d335[_0xbb5b('0x53')][_0xbb5b('0x54')],'actionIncomplete':_0x42d335[_0xbb5b('0x53')][_0xbb5b('0x55')],'speech':_0x42d335['result'][_0xbb5b('0x56')][_0xbb5b('0x57')],'score':_0x42d335[_0xbb5b('0x53')][_0xbb5b('0x58')],'statusCode':_0x42d335['status'][_0xbb5b('0x59')],'endConversation':_0x42d335[_0xbb5b('0x53')][_0xbb5b('0x5a')][_0xbb5b('0x5b')]||![],'isFallbackIntent':_0x42d335[_0xbb5b('0x53')]['metadata'][_0xbb5b('0x5c')]};});};exports[_0xbb5b('0x5d')]=function(_0x25aa3e,_0x2e351e,_0x4422c3,_0x237c58,_0xf19ada,_0x2accdd){var _0x334f17=_0x237c58[_0xbb5b('0x5e')](/\\n/g,'\x0a');var _0xc7de27={'credentials':{'private_key':_0x334f17,'client_email':_0x4422c3}};var _0x3c2a51=new dialogflow[(_0xbb5b('0x5f'))](_0xc7de27);var _0x3f1e2b=_0x3c2a51['sessionPath'](_0x2e351e,md5(_0x25aa3e));var _0x40ed67={'session':_0x3f1e2b,'queryInput':{'text':{'text':_0xf19ada,'languageCode':_0x2accdd}}};return _0x3c2a51['detectIntent'](_0x40ed67)[_0xbb5b('0x33')](function(_0x25437b){if(_0x25437b&&_0x25437b['length']){logger[_0xbb5b('0x1a')](_0xbb5b('0x60'),JSON[_0xbb5b('0x3d')](_0x25437b));var _0x762ec4=_0x25437b[0x0];if(_0x762ec4){var _0x51ce09={'action':_0x762ec4['queryResult']['action'],'allRequiredParamsPresent':_0x762ec4['queryResult'][_0xbb5b('0x61')],'endConversation':_0x762ec4['queryResult'][_0xbb5b('0x62')]&&_0x762ec4[_0xbb5b('0x63')][_0xbb5b('0x62')][_0xbb5b('0x64')]?_0x762ec4[_0xbb5b('0x63')][_0xbb5b('0x62')][_0xbb5b('0x64')][_0xbb5b('0x65')][_0xbb5b('0x66')]:![],'fulfillmentText':_0x762ec4[_0xbb5b('0x63')][_0xbb5b('0x67')],'intentName':_0x762ec4[_0xbb5b('0x63')][_0xbb5b('0x68')][_0xbb5b('0x50')],'intentDisplayName':_0x762ec4[_0xbb5b('0x63')]['intent']['displayName'],'isFallbackIntent':_0x762ec4[_0xbb5b('0x63')][_0xbb5b('0x68')]['isFallback'],'languageCode':_0x762ec4[_0xbb5b('0x63')][_0xbb5b('0x69')],'queryText':_0x762ec4[_0xbb5b('0x63')][_0xbb5b('0x6a')],'responseId':_0x762ec4[_0xbb5b('0x6b')],'score':_0x762ec4['queryResult']['intentDetectionConfidence'],'speech':_0x762ec4['queryResult'][_0xbb5b('0x67')],'providerResponse':JSON['stringify'](_0x25437b)};return _0x51ce09;}}});};exports[_0xbb5b('0x6c')]=function(_0x17f52a,_0x60b662,_0x500f92,_0x2268e5){return tilde[_0xbb5b('0x44')](_0x17f52a,_0x60b662,_0x500f92,_0x2268e5)['then'](function(_0x39a650){try{fs[_0xbb5b('0x1c')](_0x17f52a);}catch(_0x3d32c3){logger['error'](_0x3d32c3);}logger[_0xbb5b('0x1a')]('Tilde\x20ASR\x20transcription',_0x39a650[_0xbb5b('0x49')]);logger['info'](_0xbb5b('0x6d'),_0x39a650[_0xbb5b('0x4b')]);return _0x39a650;});};exports[_0xbb5b('0x6e')]=function(_0x1ad886,_0x366e29,_0x185760,_0x4c4ed2,_0x8bb7c9,_0x211d81){var _0x1538b4=path[_0xbb5b('0x24')](__dirname,'tmp',rs['generate'](0x4)+_0xbb5b('0x6f'));var _0x469b54;return aws[_0xbb5b('0x70')](_0x1ad886,_0x366e29,_0x185760,_0x4c4ed2,_0x8bb7c9,_0x211d81,_0x1538b4)[_0xbb5b('0x33')](function(){_0x469b54=path[_0xbb5b('0x24')](__dirname,_0xbb5b('0x25'),rs[_0xbb5b('0x26')](0x4)+_0xbb5b('0x27'));return convertFile(_0x1538b4,_0x469b54);})['then'](function(){try{fs[_0xbb5b('0x1c')](_0x1538b4);fs[_0xbb5b('0x2a')](_0x469b54,'777');}catch(_0x59542a){logger[_0xbb5b('0x1b')](_0x59542a);}return _0x469b54[_0xbb5b('0x2c')]('.')[0x0];});};exports[_0xbb5b('0x71')]=function(_0x1a86bb,_0x18d63d,_0x1ff80b,_0x851341,_0x5ec308,_0x22f705){return aws['lex'](_0x1a86bb,_0x18d63d,_0x1ff80b,_0x851341,_0x5ec308,_0x22f705)['then'](function(_0x5283fd){logger[_0xbb5b('0x1a')](JSON[_0xbb5b('0x3d')](_0x5283fd));return _0x5283fd;});};exports[_0xbb5b('0x72')]=function(_0x45e098,_0x419202,_0x5b23f4,_0x5d4134){var _0x382bfd=util[_0xbb5b('0x73')](_0xbb5b('0x74'),ISPEECH_API,_0x45e098,encodeURIComponent(_0x419202),_0x5b23f4,_0x5d4134);var _0x5808d9=path[_0xbb5b('0x24')](__dirname,_0xbb5b('0x25'),rs[_0xbb5b('0x26')](0x4)+_0xbb5b('0x6f'));var _0x4b106c;return downloadFile(_0x382bfd,_0x5808d9)['then'](function(){_0x4b106c=path[_0xbb5b('0x24')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x5808d9,_0x4b106c);})[_0xbb5b('0x33')](function(){try{fs[_0xbb5b('0x1c')](_0x5808d9);fs['chmodSync'](_0x4b106c,_0xbb5b('0x2b'));}catch(_0x3e51d6){logger[_0xbb5b('0x1b')](_0x3e51d6);}return _0x4b106c['split']('.')[0x0];});};exports['ispeechASR']=function(_0x513e42,_0x5b254e,_0x1e1a52,_0x569333){var _0x4b87d1=util[_0xbb5b('0x73')](_0xbb5b('0x75'),ISPEECH_API,_0x5b254e,_0x1e1a52,base64Encode(_0x513e42),_0x569333?util[_0xbb5b('0x73')](_0xbb5b('0x76'),encodeURIComponent(_0x569333)):_0xbb5b('0x77'));return uploadFile(_0x4b87d1)[_0xbb5b('0x33')](function(_0x1b7955){return querystring[_0xbb5b('0xb')](_0x1b7955);});};exports[_0xbb5b('0x78')]=function(_0x3995b3,_0x4815f0){return sestek[_0xbb5b('0x79')](_0x3995b3,_0x4815f0)[_0xbb5b('0x33')](function(_0xc59a32){logger['info'](JSON['stringify'](_0xc59a32));var _0x5e14f8={'speech':_0xc59a32['text'],'action':_0xc59a32[_0xbb5b('0x7a')]?_0xc59a32['channelData']['CustomAction']:undefined,'actiondata':_0xc59a32[_0xbb5b('0x7a')]?_0xc59a32[_0xbb5b('0x7a')][_0xbb5b('0x7b')]:undefined};if(_0xc59a32[_0xbb5b('0x7a')]&&_0xc59a32['channelData']['AudioFromTts']){return base64Decode(_0xc59a32[_0xbb5b('0x7a')][_0xbb5b('0x7c')][_0xbb5b('0x7d')],path['resolve'](__dirname,_0xbb5b('0x25'),rs[_0xbb5b('0x26')](0x4)+_0xbb5b('0x27')))[_0xbb5b('0x33')](function(_0xb762e7){_0x5e14f8[_0xbb5b('0x7e')]=_0xb762e7;return _0x5e14f8;});}return _0x5e14f8;});};exports[_0xbb5b('0x7f')]=function(){return __dirname;}; \ No newline at end of file +var _0xd5ba=['resolve','tmp','generate','.wav','writeFileSync','base64','then','unlink','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','from','audioContent','writeFile','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','stringify','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','length','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','googleASR','asr','uri','alternatives','transcript','results','confidence','join','googleASR\x20transcription','catch','name','message','googleDialogflow','textRequest','source','result','action','actionIncomplete','fulfillment','speech','score','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','polly','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','text','CustomAction','channelData','CustomActionData','AudioFromTts','Data','dirName','http','https','md5','path','querystring','request-promise','randomstring','google-tts-api','parse','./aws','./google','./tilde','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','download\x20error','pipe','data','end','transcode','wav','error\x20convert','info','finish\x20to\x20convert'];(function(_0xf23ae0,_0x13041f){var _0x441c81=function(_0x3964c9){while(--_0x3964c9){_0xf23ae0['push'](_0xf23ae0['shift']());}};_0x441c81(++_0x13041f);}(_0xd5ba,0x1ee));var _0xad5b=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xd5ba[_0x5f09c5];return _0x426ad9;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0xad5b('0x0'));var https=require(_0xad5b('0x1'));var md5=require(_0xad5b('0x2'));var path=require(_0xad5b('0x3'));var querystring=require(_0xad5b('0x4'));var rp=require(_0xad5b('0x5'));var rs=require(_0xad5b('0x6'));var sox=require('sox');var tts=require(_0xad5b('0x7'));var urlParse=require('url')[_0xad5b('0x8')];var util=require('util');var aws=require(_0xad5b('0x9'));var google=require(_0xad5b('0xa'));var sestek=require('./sestek');var tilde=require(_0xad5b('0xb'));var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0xad5b('0xc');function downloadFile(_0x24cf6f,_0x413ae9){return new BPromise(function(_0x677bfa,_0x12f9bd){var _0x1f1f7f=urlParse(_0x24cf6f);var _0x405899=_0x1f1f7f[_0xad5b('0xd')]===_0xad5b('0xe')?https:http;var _0x2d3e64={'host':_0x1f1f7f[_0xad5b('0xf')],'path':_0x1f1f7f[_0xad5b('0x3')],'headers':{'user-agent':_0xad5b('0x10')}};_0x405899[_0xad5b('0x11')](_0x2d3e64,function(_0x14fa58){if(_0x14fa58[_0xad5b('0x12')]!==0xc8){logger[_0xad5b('0x13')](_0xad5b('0x14')+_0x24cf6f+'\x20failed,\x20status\x20code\x20=\x20'+_0x14fa58[_0xad5b('0x12')]+'\x20('+_0x14fa58[_0xad5b('0x15')]+')');_0x12f9bd(new Error('request\x20to\x20'+_0x24cf6f+_0xad5b('0x16')+_0x14fa58[_0xad5b('0x12')]+'\x20('+_0x14fa58[_0xad5b('0x15')]+')'));return;}var _0x4dcbc0=fs[_0xad5b('0x17')](_0x413ae9);_0x4dcbc0['on'](_0xad5b('0x18'),function(){logger['info']('finish\x20download\x20file');_0x4dcbc0['close'](_0x677bfa);});_0x4dcbc0['on']('error',function(_0x2ef372){fs['unlink'](_0x413ae9);logger[_0xad5b('0x13')](_0xad5b('0x19'),_0x2ef372);_0x12f9bd(_0x2ef372);});_0x14fa58[_0xad5b('0x1a')](_0x4dcbc0);})['on'](_0xad5b('0x13'),function(_0x53d94c){logger[_0xad5b('0x13')](_0x53d94c);_0x12f9bd(_0x53d94c);})['end']();});}function uploadFile(_0x2c2635){return new BPromise(function(_0x446302,_0x354f8c){var _0x53c499=urlParse(_0x2c2635);var _0x2a9b30=_0x53c499[_0xad5b('0xd')]===_0xad5b('0xe')?https:http;var _0x194480={'host':_0x53c499['host'],'path':_0x53c499[_0xad5b('0x3')],'headers':{'user-agent':_0xad5b('0x10')}};_0x2a9b30[_0xad5b('0x11')](_0x194480,function(_0x1b5504){if(_0x1b5504[_0xad5b('0x12')]!==0xc8){_0x354f8c(new Error(_0xad5b('0x14')+_0x2c2635+'\x20failed,\x20status\x20code\x20=\x20'+_0x1b5504[_0xad5b('0x12')]+'\x20('+_0x1b5504[_0xad5b('0x15')]+')'));return;}var _0xcdf7da='';_0x1b5504['on'](_0xad5b('0x1b'),function(_0x5030c1){_0xcdf7da+=_0x5030c1;});_0x1b5504['on'](_0xad5b('0x1c'),function(){_0x446302(_0xcdf7da);});})['on'](_0xad5b('0x13'),function(_0x183f78){_0x354f8c(_0x183f78);})[_0xad5b('0x1c')]();});}function convertFile(_0xc59535,_0x3e3108){return new BPromise(function(_0x5568e2,_0x15ff84){var _0x3fcf35=sox[_0xad5b('0x1d')](_0xc59535,_0x3e3108,{'sampleRate':0x1f40,'format':_0xad5b('0x1e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3fcf35['on']('error',function(_0x47548a){logger[_0xad5b('0x13')](_0xad5b('0x1f'),_0x47548a);_0x15ff84(_0x47548a);});_0x3fcf35['on'](_0xad5b('0x1c'),function(){logger[_0xad5b('0x20')](_0xad5b('0x21'));_0x5568e2();});_0x3fcf35['start']();});}function base64Decode(_0x207cc7,_0xc29536){var _0x21df72=path[_0xad5b('0x22')](__dirname,_0xad5b('0x23'),rs[_0xad5b('0x24')](0x4)+_0xad5b('0x25'));fs[_0xad5b('0x26')](_0x21df72,_0x207cc7,_0xad5b('0x27'));return convertFile(_0x21df72,_0xc29536)[_0xad5b('0x28')](function(){try{fs[_0xad5b('0x29')](_0x21df72);fs[_0xad5b('0x2a')](_0xc29536,_0xad5b('0x2b'));}catch(_0x1d42a0){logger['error'](_0x1d42a0);}return _0xc29536[_0xad5b('0x2c')]('.')[0x0];});}function base64Encode(_0x244c9f){var _0xfd3783=fs[_0xad5b('0x2d')](_0x244c9f);return new Buffer(_0xfd3783)[_0xad5b('0x2e')](_0xad5b('0x27'));}exports[_0xad5b('0x2f')]=function(_0x410dc5,_0x24222f,_0x146963,_0x282465,_0x13ba2f,_0x2c79c8){var _0x1c6653,_0x3de8ff;var _0x65025b=_0xad5b('0x30');var _0x4c62a0='?key='+_0x410dc5;var _0x37dea8={};if(_0x24222f===_0xad5b('0x31')){_0x37dea8[_0xad5b('0x32')]={'ssml':_0x146963};}else{_0x37dea8['input']={'text':_0x146963};};_0x37dea8[_0xad5b('0x33')]={'languageCode':_0x282465,'ssmlGender':_0x13ba2f};_0x37dea8[_0xad5b('0x34')]={'audioEncoding':_0xad5b('0x35'),'sampleRateHertz':0x1f40};var _0x16ef77={'url':_0x65025b+_0xad5b('0x36')+_0x4c62a0,'method':_0xad5b('0x37'),'json':!![],'body':_0x37dea8};return rp(_0x16ef77)[_0xad5b('0x28')](function(_0x2824f5){return new BPromise(function(_0x53a0b7,_0x2e6cd3){_0x1c6653=path['resolve'](__dirname,'tmp',rs[_0xad5b('0x24')](0x4)+'.mp3');var _0x15ebef=Buffer[_0xad5b('0x38')](_0x2824f5[_0xad5b('0x39')],_0xad5b('0x27'));return fs[_0xad5b('0x3a')](_0x1c6653,_0x15ebef,function(_0x5a31ce){_0x2e6cd3(_0x5a31ce);},function(_0x63eb33){fs[_0xad5b('0x2a')](_0x1c6653,'777');_0x53a0b7(_0x63eb33);});});})[_0xad5b('0x28')](function(_0x4e98da){_0x3de8ff=path['resolve'](__dirname,_0xad5b('0x23'),rs['generate'](0x4)+_0xad5b('0x25'));return convertFile(_0x1c6653,_0x3de8ff);})[_0xad5b('0x28')](function(){try{fs['unlink'](_0x1c6653);fs[_0xad5b('0x2a')](_0x3de8ff,_0xad5b('0x2b'));}catch(_0x1c03b2){logger[_0xad5b('0x13')](_0x1c03b2);}logger[_0xad5b('0x20')](_0xad5b('0x3b'),_0x3de8ff[_0xad5b('0x2c')]('.')[0x0]);return _0x3de8ff['split']('.')[0x0];});};exports['googleTTS']=function(_0x224b6b,_0x40013f){var _0x1f40f6=_0xad5b('0x3c');var _0x1182fc,_0x833ae5;var _0x15b99d;var _0x401e81={'encoding':_0xad5b('0x3d'),'method':_0xad5b('0x37'),'timeout':0x2710,'url':_0x1f40f6,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON[_0xad5b('0x3e')]([[[_0xad5b('0x3f'),JSON['stringify']([_0x224b6b,_0x40013f||'en',![],_0xad5b('0x40')]),null,_0xad5b('0x41')]]]))};return rp(_0x401e81)[_0xad5b('0x28')](function(_0x37681e){try{_0x15b99d=eval(_0x37681e['slice'](0x5))[0x0][0x2];}catch(_0x3b0e6b){throw new Error(_0xad5b('0x42')+_0x37681e[_0xad5b('0x1b')]);}if(!_0x15b99d){if(_0x224b6b[_0xad5b('0x43')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xad5b('0x44')+_0x40013f+_0xad5b('0x45'));}}try{_0x15b99d=eval(_0x15b99d)[0x0];}catch(_0x5a74e5){throw new Error(_0xad5b('0x42')+res[_0xad5b('0x1b')]);}const _0xe58001=_0x15b99d;_0x1182fc=path[_0xad5b('0x22')](__dirname,_0xad5b('0x23'),rs[_0xad5b('0x24')](0x4)+_0xad5b('0x46'));fs[_0xad5b('0x26')](_0x1182fc,_0x15b99d,{'encoding':_0xad5b('0x27')});_0x833ae5=path['resolve'](__dirname,_0xad5b('0x23'),rs[_0xad5b('0x24')](0x4)+'.wav');return convertFile(_0x1182fc,_0x833ae5);})['then'](function(){try{fs[_0xad5b('0x29')](_0x1182fc);fs['chmodSync'](_0x833ae5,_0xad5b('0x2b'));}catch(_0x15e8e){logger['error'](_0x15e8e);}logger[_0xad5b('0x20')]('goggleTTS\x20path',_0x833ae5[_0xad5b('0x2c')]('.')[0x0]);return _0x833ae5[_0xad5b('0x2c')]('.')[0x0];});};exports[_0xad5b('0x47')]=function(_0x29c356,_0x5b1589,_0x3183d9){return google[_0xad5b('0x48')](_0x29c356,_0x5b1589,_0x3183d9)[_0xad5b('0x28')](function(_0x354de8){logger[_0xad5b('0x20')](_0x354de8[_0xad5b('0x49')]);return rp(_0x354de8);})[_0xad5b('0x28')](function(_0x2cd9a9){var _0x148719='';var _0x35b221=0x0;try{fs[_0xad5b('0x29')](_0x29c356);}catch(_0x213cc7){logger[_0xad5b('0x13')](_0x213cc7);}if(_0x2cd9a9&&_0x2cd9a9['results']){_0x148719=_0x2cd9a9['results']['map'](function(_0x48b1ac){return _0x48b1ac&&_0x48b1ac['alternatives'][0x0]&&_0x48b1ac[_0xad5b('0x4a')][0x0][_0xad5b('0x4b')]?_0x48b1ac[_0xad5b('0x4a')][0x0][_0xad5b('0x4b')]:'';})['join']('\x0a');_0x35b221=_0x2cd9a9[_0xad5b('0x4c')]['map'](function(_0x5b40c6){return _0x5b40c6&&_0x5b40c6[_0xad5b('0x4a')][0x0]&&_0x5b40c6[_0xad5b('0x4a')][0x0]['confidence']?_0x5b40c6[_0xad5b('0x4a')][0x0][_0xad5b('0x4d')]:0x0;})[_0xad5b('0x4e')]('\x0a');}logger[_0xad5b('0x20')](_0xad5b('0x4f'),_0x148719);logger['info']('googleASR\x20confidence',_0x35b221);return{'transcript':_0x148719,'confidence':_0x35b221};})[_0xad5b('0x50')](function(_0xdbf1f2){logger[_0xad5b('0x13')]('[%s]\x20%s:%s',_0xdbf1f2[_0xad5b('0x12')],_0xdbf1f2[_0xad5b('0x51')],_0xdbf1f2[_0xad5b('0x52')]);});};exports[_0xad5b('0x53')]=function(_0x56cd6b,_0x122b95,_0x5b7c47,_0xe85af9){var _0x255fdc=apiai(_0x122b95,{'language':_0xe85af9||'en'});return _0x255fdc[_0xad5b('0x54')](_0x5b7c47,{'sessionId':md5(_0x56cd6b)})[_0xad5b('0x28')](function(_0x1b8f79){logger[_0xad5b('0x20')](JSON[_0xad5b('0x3e')](_0x1b8f79));return{'source':_0x1b8f79['result'][_0xad5b('0x55')],'resolvedQuery':_0x1b8f79[_0xad5b('0x56')]['resolvedQuery'],'action':_0x1b8f79[_0xad5b('0x56')][_0xad5b('0x57')],'actionIncomplete':_0x1b8f79[_0xad5b('0x56')][_0xad5b('0x58')],'speech':_0x1b8f79[_0xad5b('0x56')][_0xad5b('0x59')][_0xad5b('0x5a')],'score':_0x1b8f79['result'][_0xad5b('0x5b')],'statusCode':_0x1b8f79['status']['code'],'endConversation':_0x1b8f79[_0xad5b('0x56')]['metadata'][_0xad5b('0x5c')]||![],'isFallbackIntent':_0x1b8f79['result'][_0xad5b('0x5d')][_0xad5b('0x5e')]};});};exports[_0xad5b('0x5f')]=function(_0x564871,_0x182b04,_0x219cca,_0x496a18,_0x168270,_0x5a26bb){var _0x3e94ab=_0x496a18[_0xad5b('0x60')](/\\n/g,'\x0a');var _0x5daede={'credentials':{'private_key':_0x3e94ab,'client_email':_0x219cca}};var _0x19d9c7=new dialogflow[(_0xad5b('0x61'))](_0x5daede);var _0x2bdf7d=_0x19d9c7[_0xad5b('0x62')](_0x182b04,md5(_0x564871));var _0x571e19={'session':_0x2bdf7d,'queryInput':{'text':{'text':_0x168270,'languageCode':_0x5a26bb}}};return _0x19d9c7[_0xad5b('0x63')](_0x571e19)[_0xad5b('0x28')](function(_0x3ab54c){if(_0x3ab54c&&_0x3ab54c[_0xad5b('0x43')]){logger[_0xad5b('0x20')](_0xad5b('0x64'),JSON[_0xad5b('0x3e')](_0x3ab54c));var _0x4d0fa6=_0x3ab54c[0x0];if(_0x4d0fa6){var _0x2fab88={'action':_0x4d0fa6['queryResult'][_0xad5b('0x57')],'allRequiredParamsPresent':_0x4d0fa6[_0xad5b('0x65')][_0xad5b('0x66')],'endConversation':_0x4d0fa6[_0xad5b('0x65')][_0xad5b('0x67')]&&_0x4d0fa6['queryResult']['diagnosticInfo'][_0xad5b('0x68')]?_0x4d0fa6[_0xad5b('0x65')][_0xad5b('0x67')]['fields']['end_conversation'][_0xad5b('0x69')]:![],'fulfillmentText':_0x4d0fa6['queryResult'][_0xad5b('0x6a')],'intentName':_0x4d0fa6[_0xad5b('0x65')][_0xad5b('0x6b')][_0xad5b('0x51')],'intentDisplayName':_0x4d0fa6['queryResult'][_0xad5b('0x6b')][_0xad5b('0x6c')],'isFallbackIntent':_0x4d0fa6[_0xad5b('0x65')][_0xad5b('0x6b')][_0xad5b('0x6d')],'languageCode':_0x4d0fa6[_0xad5b('0x65')][_0xad5b('0x6e')],'queryText':_0x4d0fa6[_0xad5b('0x65')][_0xad5b('0x6f')],'responseId':_0x4d0fa6[_0xad5b('0x70')],'score':_0x4d0fa6[_0xad5b('0x65')][_0xad5b('0x71')],'speech':_0x4d0fa6[_0xad5b('0x65')][_0xad5b('0x6a')],'providerResponse':JSON[_0xad5b('0x3e')](_0x3ab54c)};return _0x2fab88;}}});};exports[_0xad5b('0x72')]=function(_0x222f7b,_0x51c5a2,_0x533b83,_0x5c1a0b){return tilde[_0xad5b('0x48')](_0x222f7b,_0x51c5a2,_0x533b83,_0x5c1a0b)[_0xad5b('0x28')](function(_0x2b846b){try{fs[_0xad5b('0x29')](_0x222f7b);}catch(_0x603af3){logger[_0xad5b('0x13')](_0x603af3);}logger[_0xad5b('0x20')](_0xad5b('0x73'),_0x2b846b[_0xad5b('0x4b')]);logger[_0xad5b('0x20')]('Tilde\x20ASR\x20confidence',_0x2b846b[_0xad5b('0x4d')]);return _0x2b846b;});};exports['awsPolly']=function(_0x422ab6,_0x32523e,_0x3136c5,_0x1e23a5,_0x5bd7b0,_0x10a06a){var _0x1b20c4=path[_0xad5b('0x22')](__dirname,'tmp',rs[_0xad5b('0x24')](0x4)+_0xad5b('0x46'));var _0xd7f263;return aws[_0xad5b('0x74')](_0x422ab6,_0x32523e,_0x3136c5,_0x1e23a5,_0x5bd7b0,_0x10a06a,_0x1b20c4)[_0xad5b('0x28')](function(){_0xd7f263=path['resolve'](__dirname,_0xad5b('0x23'),rs[_0xad5b('0x24')](0x4)+_0xad5b('0x25'));return convertFile(_0x1b20c4,_0xd7f263);})['then'](function(){try{fs[_0xad5b('0x29')](_0x1b20c4);fs[_0xad5b('0x2a')](_0xd7f263,_0xad5b('0x2b'));}catch(_0x53ae05){logger[_0xad5b('0x13')](_0x53ae05);}return _0xd7f263[_0xad5b('0x2c')]('.')[0x0];});};exports['awsLex']=function(_0x507a38,_0x5407b7,_0x5843bd,_0xc31eed,_0x56cffc,_0x57f38d){return aws[_0xad5b('0x75')](_0x507a38,_0x5407b7,_0x5843bd,_0xc31eed,_0x56cffc,_0x57f38d)[_0xad5b('0x28')](function(_0x51ce57){logger[_0xad5b('0x20')](JSON[_0xad5b('0x3e')](_0x51ce57));return _0x51ce57;});};exports[_0xad5b('0x76')]=function(_0x2b4b62,_0x394fb9,_0x3dc37d,_0x25c1fa){var _0x555144=util['format'](_0xad5b('0x77'),ISPEECH_API,_0x2b4b62,encodeURIComponent(_0x394fb9),_0x3dc37d,_0x25c1fa);var _0x2ff6a6=path[_0xad5b('0x22')](__dirname,_0xad5b('0x23'),rs[_0xad5b('0x24')](0x4)+'.mp3');var _0x1b066e;return downloadFile(_0x555144,_0x2ff6a6)[_0xad5b('0x28')](function(){_0x1b066e=path[_0xad5b('0x22')](__dirname,_0xad5b('0x23'),rs[_0xad5b('0x24')](0x4)+_0xad5b('0x25'));return convertFile(_0x2ff6a6,_0x1b066e);})[_0xad5b('0x28')](function(){try{fs[_0xad5b('0x29')](_0x2ff6a6);fs['chmodSync'](_0x1b066e,_0xad5b('0x2b'));}catch(_0x311482){logger[_0xad5b('0x13')](_0x311482);}return _0x1b066e[_0xad5b('0x2c')]('.')[0x0];});};exports[_0xad5b('0x78')]=function(_0x3308cf,_0x3e1ed1,_0x500f5d,_0x492bff){var _0x18cf83=util[_0xad5b('0x79')](_0xad5b('0x7a'),ISPEECH_API,_0x3e1ed1,_0x500f5d,base64Encode(_0x3308cf),_0x492bff?util[_0xad5b('0x79')](_0xad5b('0x7b'),encodeURIComponent(_0x492bff)):'freeform=3');return uploadFile(_0x18cf83)[_0xad5b('0x28')](function(_0x1a0e13){return querystring[_0xad5b('0x8')](_0x1a0e13);});};exports[_0xad5b('0x7c')]=function(_0x28140a,_0x4a2739){return sestek['nda'](_0x28140a,_0x4a2739)['then'](function(_0x2f3c9b){logger['info'](JSON[_0xad5b('0x3e')](_0x2f3c9b));var _0x5cfea7={'speech':_0x2f3c9b[_0xad5b('0x7d')],'action':_0x2f3c9b['channelData']?_0x2f3c9b['channelData'][_0xad5b('0x7e')]:undefined,'actiondata':_0x2f3c9b[_0xad5b('0x7f')]?_0x2f3c9b[_0xad5b('0x7f')][_0xad5b('0x80')]:undefined};if(_0x2f3c9b[_0xad5b('0x7f')]&&_0x2f3c9b[_0xad5b('0x7f')][_0xad5b('0x81')]){return base64Decode(_0x2f3c9b[_0xad5b('0x7f')][_0xad5b('0x81')][_0xad5b('0x82')],path[_0xad5b('0x22')](__dirname,'tmp',rs['generate'](0x4)+_0xad5b('0x25')))['then'](function(_0xeaa19a){_0x5cfea7['audiofile']=_0xeaa19a;return _0x5cfea7;});}return _0x5cfea7;});};exports[_0xad5b('0x83')]=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 4b0d887..fc9297e 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 _0xa568=['./nda'];(function(_0x22a693,_0xafbdda){var _0x2924bf=function(_0x4573e8){while(--_0x4573e8){_0x22a693['push'](_0x22a693['shift']());}};_0x2924bf(++_0xafbdda);}(_0xa568,0x13d));var _0x8a56=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xa568[_0x46e363];return _0x3fb059;};var nda=require(_0x8a56('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x2d7b=['exports'];(function(_0x549d16,_0x4d069a){var _0x344ccc=function(_0x1d992a){while(--_0x1d992a){_0x549d16['push'](_0x549d16['shift']());}};_0x344ccc(++_0x4d069a);}(_0x2d7b,0x19b));var _0xb2d7=function(_0x2b50be,_0x4e3d61){_0x2b50be=_0x2b50be-0x0;var _0x212cd4=_0x2d7b[_0x2b50be];return _0x212cd4;};var nda=require('./nda');module[_0xb2d7('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 37af8c6..4e4d984 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 _0xb2f0=['POST','ndassistant_url','message','Nda','uniqueid','callerid','dnid','extension','text','Bearer\x20','access_token','project','channelData','ProjectName','ndagenerate_audio','body','AudioOutputSettings','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','resolve','ndauth_url','/token','password','username','then'];(function(_0x6c5964,_0x5c9039){var _0x5338d9=function(_0x5a3d95){while(--_0x5a3d95){_0x6c5964['push'](_0x6c5964['shift']());}};_0x5338d9(++_0x5c9039);}(_0xb2f0,0x16b));var _0x0b2f=function(_0x4fe6e9,_0xf9c130){_0x4fe6e9=_0x4fe6e9-0x0;var _0x8886a1=_0xb2f0[_0x4fe6e9];return _0x8886a1;};'use strict';var rp=require(_0x0b2f('0x0'));var url=require(_0x0b2f('0x1'));var logger=require(_0x0b2f('0x2'))('agi');module['exports']=function(_0x5bcd43,_0x26cb7f){var _0x160247={'method':'POST','uri':url[_0x0b2f('0x3')](_0x26cb7f[_0x0b2f('0x4')],_0x0b2f('0x5')),'form':{'grant_type':_0x0b2f('0x6'),'username':_0x26cb7f[_0x0b2f('0x7')],'password':_0x26cb7f[_0x0b2f('0x6')]},'json':!![]};return rp(_0x160247)[_0x0b2f('0x8')](function(_0xb58b25){var _0x20f55a={'method':_0x0b2f('0x9'),'uri':url[_0x0b2f('0x3')](_0x26cb7f[_0x0b2f('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x26cb7f['ndaactivity_type']||_0x0b2f('0xb'),'channelId':_0x0b2f('0xc'),'conversation':{'id':_0x5bcd43[_0x0b2f('0xd')]},'from':{'id':_0x5bcd43[_0x0b2f('0xe')],'name':_0x5bcd43['calleridname']},'recipient':{'id':_0x5bcd43[_0x0b2f('0xf')],'name':_0x5bcd43[_0x0b2f('0x10')]},'text':_0x26cb7f[_0x0b2f('0x11')],'channelData':{}},'headers':{'Authorization':_0x0b2f('0x12')+_0xb58b25[_0x0b2f('0x13')]},'json':!![]};if(_0x26cb7f[_0x0b2f('0x14')]){_0x20f55a['body'][_0x0b2f('0x15')][_0x0b2f('0x16')]=_0x26cb7f[_0x0b2f('0x14')];}if(_0x26cb7f[_0x0b2f('0x17')]=='1'){_0x20f55a[_0x0b2f('0x18')][_0x0b2f('0x15')][_0x0b2f('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x26cb7f[_0x0b2f('0x1a')]){_0x20f55a[_0x0b2f('0x18')][_0x0b2f('0x15')]['CustomAction']=_0x26cb7f[_0x0b2f('0x1a')];if(_0x26cb7f[_0x0b2f('0x1b')]){_0x20f55a[_0x0b2f('0x18')][_0x0b2f('0x15')][_0x0b2f('0x1c')]=_0x26cb7f[_0x0b2f('0x1b')];}}logger[_0x0b2f('0x1d')](JSON[_0x0b2f('0x1e')](_0x20f55a));return rp(_0x20f55a);});}; \ No newline at end of file +var _0xa0bf=['calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','agi','POST','resolve','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid'];(function(_0x33d928,_0x2b289c){var _0x4c2316=function(_0x901667){while(--_0x901667){_0x33d928['push'](_0x33d928['shift']());}};_0x4c2316(++_0x2b289c);}(_0xa0bf,0x92));var _0xfa0b=function(_0x36e2b9,_0xc2d2a4){_0x36e2b9=_0x36e2b9-0x0;var _0x265d5d=_0xa0bf[_0x36e2b9];return _0x265d5d;};'use strict';var rp=require(_0xfa0b('0x0'));var url=require('url');var logger=require('../../../../../config/logger')(_0xfa0b('0x1'));module['exports']=function(_0x37280c,_0x2de3e4){var _0x18c6af={'method':_0xfa0b('0x2'),'uri':url[_0xfa0b('0x3')](_0x2de3e4['ndauth_url'],'/token'),'form':{'grant_type':_0xfa0b('0x4'),'username':_0x2de3e4[_0xfa0b('0x5')],'password':_0x2de3e4[_0xfa0b('0x4')]},'json':!![]};return rp(_0x18c6af)[_0xfa0b('0x6')](function(_0x530f58){var _0x34fa78={'method':'POST','uri':url[_0xfa0b('0x3')](_0x2de3e4[_0xfa0b('0x7')],_0xfa0b('0x8')),'body':{'type':_0x2de3e4[_0xfa0b('0x9')]||_0xfa0b('0xa'),'channelId':_0xfa0b('0xb'),'conversation':{'id':_0x37280c[_0xfa0b('0xc')]},'from':{'id':_0x37280c[_0xfa0b('0xd')],'name':_0x37280c[_0xfa0b('0xe')]},'recipient':{'id':_0x37280c[_0xfa0b('0xf')],'name':_0x37280c[_0xfa0b('0x10')]},'text':_0x2de3e4[_0xfa0b('0x11')],'channelData':{}},'headers':{'Authorization':_0xfa0b('0x12')+_0x530f58[_0xfa0b('0x13')]},'json':!![]};if(_0x2de3e4[_0xfa0b('0x14')]){_0x34fa78[_0xfa0b('0x15')][_0xfa0b('0x16')][_0xfa0b('0x17')]=_0x2de3e4[_0xfa0b('0x14')];}if(_0x2de3e4[_0xfa0b('0x18')]=='1'){_0x34fa78[_0xfa0b('0x15')][_0xfa0b('0x16')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xfa0b('0x19')};}if(_0x2de3e4[_0xfa0b('0x1a')]){_0x34fa78[_0xfa0b('0x15')][_0xfa0b('0x16')][_0xfa0b('0x1b')]=_0x2de3e4[_0xfa0b('0x1a')];if(_0x2de3e4[_0xfa0b('0x1c')]){_0x34fa78[_0xfa0b('0x15')][_0xfa0b('0x16')][_0xfa0b('0x1d')]=_0x2de3e4[_0xfa0b('0x1c')];}}logger[_0xfa0b('0x1e')](JSON[_0xfa0b('0x1f')](_0x34fa78));return rp(_0x34fa78);});}; \ 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 e64d35a..af40c03 100644 --- a/server/services/agi/scripts/tilde/asr/index.js +++ b/server/services/agi/scripts/tilde/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x1e8ea0,_0x4ed845,_0x171774,_0x58b430){return asr(_0x1e8ea0,_0x4ed845,_0x171774,_0x58b430);}; \ No newline at end of file +var _0x1eaa=['exports'];(function(_0x17abc2,_0xa835c5){var _0x516419=function(_0x19a2e9){while(--_0x19a2e9){_0x17abc2['push'](_0x17abc2['shift']());}};_0x516419(++_0xa835c5);}(_0x1eaa,0x1f0));var _0xa1ea=function(_0x455582,_0xe40e92){_0x455582=_0x455582-0x0;var _0x4048ff=_0x1eaa[_0x455582];return _0x4048ff;};'use strict';var asr=require('./lib/api');module[_0xa1ea('0x0')]=function(_0x3fa40c,_0x2dd0db,_0x2c1b5a,_0x377120){return asr(_0x3fa40c,_0x2dd0db,_0x2c1b5a,_0x377120);}; \ 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 50c9619..49117f9 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 _0x0ae6=['send','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','lodash','moment','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','digest','hex','unix','createReadStream','data'];(function(_0x5d2c6a,_0x196724){var _0x4420af=function(_0x44dc0a){while(--_0x44dc0a){_0x5d2c6a['push'](_0x5d2c6a['shift']());}};_0x4420af(++_0x196724);}(_0x0ae6,0x164));var _0x60ae=function(_0x9a262b,_0x10694a){_0x9a262b=_0x9a262b-0x0;var _0x5de69a=_0x0ae6[_0x9a262b];return _0x5de69a;};'use strict';var BPromise=require(_0x60ae('0x0'));var _=require(_0x60ae('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x60ae('0x2'));var crypto=require('crypto');var logger=require('../../../../../../config/logger')(_0x60ae('0x3'));module['exports']=function(_0x251d71,_0x165cb6,_0x2dc5b7,_0x277a34){return new BPromise(function(_0x3d36d7,_0x456430){logger[_0x60ae('0x4')](_0x60ae('0x5'),_0x277a34||_0x60ae('0x6'));var _0x56b02f=new WebSocket(_0x277a34||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x306238='';var _0x5629ae='0';var _0x581e42='1';var _0x17ee2a=_0x60ae('0x7');function _0x11a0d5(_0x192b3f){var _0x6f0ece=crypto[_0x60ae('0x8')]('sha1');_0x6f0ece['update'](_0x192b3f);return _0x6f0ece[_0x60ae('0x9')](_0x60ae('0xa'));}function _0x2f4483(){try{logger[_0x60ae('0x4')]('Open\x20Tilde\x20ASR\x20socket');var _0x1faddf=moment()[_0x60ae('0xb')]();var _0x4ec823=_0x11a0d5(_0x1faddf+_0x165cb6+_0x2dc5b7);_0x56b02f['send'](JSON['stringify']({'appID':_0x165cb6,'timestamp':_0x1faddf,'appKey':_0x4ec823}));var _0x352b84=fs[_0x60ae('0xc')](_0x251d71);_0x352b84['on'](_0x60ae('0xd'),function(_0x54cf36){_0x56b02f[_0x60ae('0xe')](_0x54cf36);});_0x352b84['on'](_0x60ae('0xf'),function(){_0x56b02f[_0x60ae('0xe')](_0x60ae('0x10'));});}catch(_0x5361d7){logger[_0x60ae('0x11')](_0x60ae('0x12'),JSON[_0x60ae('0x13')](_0x5361d7));_0x56b02f[_0x60ae('0x14')]();}}function _0x45a9ff(_0x11951e){try{if(_0x11951e){var _0x525dac=JSON['parse'](_0x11951e);switch(_0x525dac['status']){case 0x0:if(_0x525dac[_0x60ae('0x15')]){if(_0x525dac[_0x60ae('0x15')][_0x60ae('0x16')]){logger[_0x60ae('0x4')](_0x60ae('0x17'),JSON[_0x60ae('0x13')](_0x525dac[_0x60ae('0x15')][_0x60ae('0x18')]));_0x306238=_0x525dac[_0x60ae('0x15')][_0x60ae('0x18')][0x0]['transcript'];_0x5629ae=_0x525dac[_0x60ae('0x15')]['hypotheses'][0x0][_0x60ae('0x19')];_0x581e42='0';_0x17ee2a=_0x60ae('0x1a');_0x56b02f[_0x60ae('0x14')]();}}break;case 0x1:logger['info'](_0x60ae('0x7'));_0x581e42='1';_0x17ee2a='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x60ae('0x4')](_0x60ae('0x1b'));_0x581e42='2';_0x17ee2a=_0x60ae('0x1b');break;case 0x9:logger['info'](_0x60ae('0x1c'));_0x581e42='9';_0x17ee2a='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info'](_0x60ae('0x1d'));_0x581e42='10';_0x17ee2a='Authentication\x20failed.';break;case 0xb:logger[_0x60ae('0x4')](_0x60ae('0x1e'));_0x581e42='11';_0x17ee2a=_0x60ae('0x1e');}}}catch(_0x214b75){logger[_0x60ae('0x11')](_0x60ae('0x1f'),JSON[_0x60ae('0x13')](_0x214b75));_0x56b02f['terminate']();}}function _0x12d140(){logger['info'](_0x60ae('0x20'));_0x3d36d7({'transcript':_0x306238,'confidence':_0x5629ae,'status':_0x581e42,'status_message':_0x17ee2a});}function _0x35ec7e(_0x6395a7){logger['error'](_0x60ae('0x21'));if(!_[_0x60ae('0x22')](_0x6395a7)){logger['error'](_[_0x60ae('0x23')](_0x6395a7)?JSON['stringify'](_0x6395a7):_0x6395a7);}}_0x56b02f['on']('open',_0x2f4483);_0x56b02f['on'](_0x60ae('0x24'),_0x45a9ff);_0x56b02f['on'](_0x60ae('0xf'),_0x12d140);_0x56b02f['on'](_0x60ae('0x11'),_0x35ec7e);});}; \ No newline at end of file +var _0xbd1f=['Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','message','bluebird','lodash','moment','../../../../../../config/logger','agi','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','close','EOS','error'];(function(_0x462f40,_0x43ae99){var _0xa930e3=function(_0x2223a3){while(--_0x2223a3){_0x462f40['push'](_0x462f40['shift']());}};_0xa930e3(++_0x43ae99);}(_0xbd1f,0x139));var _0xfbd1=function(_0x508c11,_0x308545){_0x508c11=_0x508c11-0x0;var _0x438f65=_0xbd1f[_0x508c11];return _0x438f65;};'use strict';var BPromise=require(_0xfbd1('0x0'));var _=require(_0xfbd1('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xfbd1('0x2'));var crypto=require('crypto');var logger=require(_0xfbd1('0x3'))(_0xfbd1('0x4'));module['exports']=function(_0x4524a9,_0x261954,_0x3b14cb,_0x5942ce){return new BPromise(function(_0x651bcd,_0x29be70){logger[_0xfbd1('0x5')]('Tilde\x20URI',_0x5942ce||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x3c5b5a=new WebSocket(_0x5942ce||_0xfbd1('0x6'),{'perMessageDeflate':![]});var _0x41b2a2='';var _0x43de97='0';var _0x447fe2='1';var _0x471a05=_0xfbd1('0x7');function _0x441945(_0x1fc8f5){var _0x1dddb0=crypto[_0xfbd1('0x8')]('sha1');_0x1dddb0[_0xfbd1('0x9')](_0x1fc8f5);return _0x1dddb0[_0xfbd1('0xa')](_0xfbd1('0xb'));}function _0x20242c(){try{logger[_0xfbd1('0x5')](_0xfbd1('0xc'));var _0x3911ee=moment()[_0xfbd1('0xd')]();var _0x3b263e=_0x441945(_0x3911ee+_0x261954+_0x3b14cb);_0x3c5b5a[_0xfbd1('0xe')](JSON['stringify']({'appID':_0x261954,'timestamp':_0x3911ee,'appKey':_0x3b263e}));var _0x32f1e7=fs[_0xfbd1('0xf')](_0x4524a9);_0x32f1e7['on'](_0xfbd1('0x10'),function(_0x4bd7a2){_0x3c5b5a[_0xfbd1('0xe')](_0x4bd7a2);});_0x32f1e7['on'](_0xfbd1('0x11'),function(){_0x3c5b5a['send'](_0xfbd1('0x12'));});}catch(_0x58dc2e){logger[_0xfbd1('0x13')](_0xfbd1('0x14'),JSON[_0xfbd1('0x15')](_0x58dc2e));_0x3c5b5a[_0xfbd1('0x16')]();}}function _0x55c34b(_0x2d2925){try{if(_0x2d2925){var _0x481dc2=JSON[_0xfbd1('0x17')](_0x2d2925);switch(_0x481dc2[_0xfbd1('0x18')]){case 0x0:if(_0x481dc2[_0xfbd1('0x19')]){if(_0x481dc2[_0xfbd1('0x19')][_0xfbd1('0x1a')]){logger['info'](_0xfbd1('0x1b'),JSON[_0xfbd1('0x15')](_0x481dc2[_0xfbd1('0x19')][_0xfbd1('0x1c')]));_0x41b2a2=_0x481dc2[_0xfbd1('0x19')][_0xfbd1('0x1c')][0x0][_0xfbd1('0x1d')];_0x43de97=_0x481dc2[_0xfbd1('0x19')][_0xfbd1('0x1c')][0x0]['likelihood'];_0x447fe2='0';_0x471a05='Success.';_0x3c5b5a[_0xfbd1('0x16')]();}}break;case 0x1:logger[_0xfbd1('0x5')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x447fe2='1';_0x471a05='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xfbd1('0x5')](_0xfbd1('0x1e'));_0x447fe2='2';_0x471a05=_0xfbd1('0x1e');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x447fe2='9';_0x471a05='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info']('Authentication\x20failed.');_0x447fe2='10';_0x471a05=_0xfbd1('0x1f');break;case 0xb:logger[_0xfbd1('0x5')](_0xfbd1('0x20'));_0x447fe2='11';_0x471a05=_0xfbd1('0x20');}}}catch(_0x2daa5b){logger[_0xfbd1('0x13')]('Tilde\x20ASR\x20parse\x20error',JSON[_0xfbd1('0x15')](_0x2daa5b));_0x3c5b5a['terminate']();}}function _0x325b7b(){logger['info'](_0xfbd1('0x21'));_0x651bcd({'transcript':_0x41b2a2,'confidence':_0x43de97,'status':_0x447fe2,'status_message':_0x471a05});}function _0x553900(_0x119075){logger[_0xfbd1('0x13')](_0xfbd1('0x22'));if(!_['isNil'](_0x119075)){logger['error'](_[_0xfbd1('0x23')](_0x119075)?JSON[_0xfbd1('0x15')](_0x119075):_0x119075);}}_0x3c5b5a['on']('open',_0x20242c);_0x3c5b5a['on'](_0xfbd1('0x24'),_0x55c34b);_0x3c5b5a['on'](_0xfbd1('0x11'),_0x325b7b);_0x3c5b5a['on']('error',_0x553900);});}; \ 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 bf5077d..a27f2ac 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 _0x905b=['exports'];(function(_0x24a3e7,_0x3f4354){var _0x48220a=function(_0x27a9de){while(--_0x27a9de){_0x24a3e7['push'](_0x24a3e7['shift']());}};_0x48220a(++_0x3f4354);}(_0x905b,0x98));var _0xb905=function(_0xafc039,_0x4d59d6){_0xafc039=_0xafc039-0x0;var _0x29cac6=_0x905b[_0xafc039];return _0x29cac6;};var asr=require('./asr');module[_0xb905('0x0')]={'asr':asr}; \ No newline at end of file +var _0x4b1b=['exports','./asr'];(function(_0x1d1e83,_0x434d18){var _0x4cd90e=function(_0x167add){while(--_0x167add){_0x1d1e83['push'](_0x1d1e83['shift']());}};_0x4cd90e(++_0x434d18);}(_0x4b1b,0x17f));var _0xb4b1=function(_0x13da99,_0x568894){_0x13da99=_0x13da99-0x0;var _0x54d8a3=_0x4b1b[_0x13da99];return _0x54d8a3;};var asr=require(_0xb4b1('0x0'));module[_0xb4b1('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 56e4a76..f90fcb5 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 _0x4bd1=['code','close','nextTick','inherits','net','EventEmitter','./error','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','ready'];(function(_0x3bb897,_0x54f55c){var _0x45829b=function(_0x2be4a0){while(--_0x2be4a0){_0x3bb897['push'](_0x3bb897['shift']());}};_0x45829b(++_0x54f55c);}(_0x4bd1,0x90));var _0x14bd=function(_0x50fda9,_0x5ee44b){_0x50fda9=_0x50fda9-0x0;var _0x36b92b=_0x4bd1[_0x50fda9];return _0x36b92b;};'use strict';var util=require('util');var net=require(_0x14bd('0x0'));var EventEmitter=require('events')[_0x14bd('0x1')];var AGIError=require(_0x14bd('0x2'));var AGIChannel=require('./channel');var AGIServer=function(_0x17e7b6,_0x45948d,_0x51fcdb){var _0x4080e1=this,_0x17e7b6=_0x17e7b6||0x11dd,_0x45948d=_0x45948d||_0x14bd('0x3'),_0x31b468=null,_0x5c4680=0x0;EventEmitter[_0x14bd('0x4')](_0x4080e1);function _0xb06dbf(){if(!_0x17e7b6){_0x4080e1[_0x14bd('0x5')](_0x14bd('0x6'),new AGIError(_0x14bd('0x7')));return![];}_0x31b468=net[_0x14bd('0x8')]();_0x31b468[_0x14bd('0x9')](_0x17e7b6,_0x45948d);_0x31b468['on']('listening',function(){_0x4080e1['emit']('listening');});_0x31b468['on'](_0x14bd('0xa'),function(_0x1621fa){_0x31b468[_0x14bd('0xb')](function(_0x550f7f,_0x3a3ca0){if(_0x550f7f){_0x4080e1[_0x14bd('0x5')](_0x14bd('0x6'),new AGIError(_0x14bd('0xc'),_0x550f7f));}else if(_0x51fcdb&&_0x51fcdb<0x0){_0x4080e1[_0x14bd('0x5')](_0x14bd('0x6'),new AGIError(_0x14bd('0xd')));_0x1621fa[_0x14bd('0xe')]();}else if(_0x51fcdb&&_0x51fcdb>0x0&&_0x51fcdb<_0x3a3ca0){_0x5c4680+=0x1;_0x4080e1['emit'](_0x14bd('0x6'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x5c4680));_0x1621fa[_0x14bd('0xe')]();}else{var _0x47e495=new AGIChannel(_0x1621fa);_0x47e495['on'](_0x14bd('0xf'),function(){_0x4080e1[_0x14bd('0x5')]('connection',_0x47e495);});}});});_0x31b468['on'](_0x14bd('0x6'),function(_0x49ed59){_0x4080e1[_0x14bd('0x5')](_0x14bd('0x6'),new AGIError(_0x14bd('0xc'),_0x49ed59[_0x14bd('0x10')]));});_0x31b468['on'](_0x14bd('0x11'),function(){_0x4080e1[_0x14bd('0x5')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x14bd('0x12')](function(){_0xb06dbf();});};util[_0x14bd('0x13')](AGIServer,EventEmitter);module['exports']=function(_0x522001,_0x1f09fa,_0x24a5a3){return new AGIServer(_0x522001,_0x1f09fa,_0x24a5a3);}; \ No newline at end of file +var _0x0d6a=['E_AGI_SERVER_CLOSE','nextTick','inherits','util','net','EventEmitter','./error','./channel','127.0.0.1','call','emit','error','createServer','listening','getConnections','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','destroy','ready','E_AGI_SERVER_ERROR','code','close'];(function(_0x514401,_0x2e4fba){var _0x464b38=function(_0x41450b){while(--_0x41450b){_0x514401['push'](_0x514401['shift']());}};_0x464b38(++_0x2e4fba);}(_0x0d6a,0xc9));var _0xa0d6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0d6a[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0xa0d6('0x0'));var net=require(_0xa0d6('0x1'));var EventEmitter=require('events')[_0xa0d6('0x2')];var AGIError=require(_0xa0d6('0x3'));var AGIChannel=require(_0xa0d6('0x4'));var AGIServer=function(_0xa452b8,_0x71d654,_0x236047){var _0x344b8d=this,_0xa452b8=_0xa452b8||0x11dd,_0x71d654=_0x71d654||_0xa0d6('0x5'),_0x179a70=null,_0x4857ce=0x0;EventEmitter[_0xa0d6('0x6')](_0x344b8d);function _0xba6194(){if(!_0xa452b8){_0x344b8d[_0xa0d6('0x7')](_0xa0d6('0x8'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x179a70=net[_0xa0d6('0x9')]();_0x179a70['listen'](_0xa452b8,_0x71d654);_0x179a70['on'](_0xa0d6('0xa'),function(){_0x344b8d['emit'](_0xa0d6('0xa'));});_0x179a70['on']('connection',function(_0x419a08){_0x179a70[_0xa0d6('0xb')](function(_0x25653e,_0x37e9e2){if(_0x25653e){_0x344b8d[_0xa0d6('0x7')](_0xa0d6('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x25653e));}else if(_0x236047&&_0x236047<0x0){_0x344b8d[_0xa0d6('0x7')](_0xa0d6('0x8'),new AGIError(_0xa0d6('0xc')));_0x419a08['destroy']();}else if(_0x236047&&_0x236047>0x0&&_0x236047<_0x37e9e2){_0x4857ce+=0x1;_0x344b8d[_0xa0d6('0x7')](_0xa0d6('0x8'),new AGIError(_0xa0d6('0xd'),_0x4857ce));_0x419a08[_0xa0d6('0xe')]();}else{var _0x3c3c15=new AGIChannel(_0x419a08);_0x3c3c15['on'](_0xa0d6('0xf'),function(){_0x344b8d[_0xa0d6('0x7')]('connection',_0x3c3c15);});}});});_0x179a70['on']('error',function(_0x39e63f){_0x344b8d[_0xa0d6('0x7')](_0xa0d6('0x8'),new AGIError(_0xa0d6('0x10'),_0x39e63f[_0xa0d6('0x11')]));});_0x179a70['on'](_0xa0d6('0x12'),function(){_0x344b8d[_0xa0d6('0x7')]('close',new AGIError(_0xa0d6('0x13')));});}process[_0xa0d6('0x14')](function(){_0xba6194();});};util[_0xa0d6('0x15')](AGIServer,EventEmitter);module['exports']=function(_0xf4b8e2,_0x54020a,_0x1dc618){return new AGIServer(_0xf4b8e2,_0x54020a,_0x1dc618);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index decca11..4e12099 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 _0x3bda=['Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','util','lodash','shelljs','odbc','randomstring','moment','request-promise','../../config/logger','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','channel','rpc','getVariable','then','name','catch','getVoiceQueue','getSquareProject','prototype','getSquareOdbc','dsn','getUser','getUserById','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','mailRpc','getIntervals','IntervalId','map','Intervals','interval','format','%s/sounds/converted/%s','getQueryOdbc','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','arg_1','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','getPause','getPauseById','agentPause','agentUnpause','agent','callerid','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','restAPI','method','timeout','number','includes','POST','PUT','body','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','url','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','model','awsPolly','aws_secret_access_key','Amy','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','saveRestApiResult','%s.%s','length','setVariable','split','replaceAll','extra','toString','getAndSetVariable','result','maxRetry','sync','retry','mrcpsynth','label','isConfigured','noop','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','no\x20list\x20selected','delay','add','minutes','callback_priority','custom_app','application','exec','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','MRCPSynth','lumenvoxasr','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','query','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','DIAL','SIP/%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','password','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','variable_id','getData','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','streamFile','unlink','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','NOBEEP','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','FIND\x20AGENT\x20%s\x20BY\x20%s','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','response','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','Executed\x20command\x20%s\x20%s','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','Smtp','no\x20mail\x20account\x20found','email','user','bcc','subject','service','host','port','secure','auth','pass','template_id','sendMail\x20message','account_id','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','Enter\x20in\x20SENDSMS\x20(%s)\x20block','getSmsAccount','no\x20sms\x20account\x20found','sendSMS\x20message','sms_account_id','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set'];(function(_0x1ec6d1,_0x1885c4){var _0x5eafc2=function(_0x1cf7b0){while(--_0x1cf7b0){_0x1ec6d1['push'](_0x1ec6d1['shift']());}};_0x5eafc2(++_0x1885c4);}(_0x3bda,0x1ea));var _0xa3bd=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x3bda[_0x53ccf2];return _0x5a2964;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xa3bd('0x0'));var _=require(_0xa3bd('0x1'));var sh=require(_0xa3bd('0x2'));var odbc=require(_0xa3bd('0x3'))();var rs=require(_0xa3bd('0x4'));var moment=require(_0xa3bd('0x5'));var Mustache=require('mustache');var rp=require(_0xa3bd('0x6'));var logger=require(_0xa3bd('0x7'))('agi');var config=require('../../config/environment');var scripts=require(_0xa3bd('0x8'));var FILES_PATH=_0xa3bd('0x9');var recursiveMapAttributes=[_0xa3bd('0xa'),'rawBody'];var verticesWithRetry=[_0xa3bd('0xb'),_0xa3bd('0xc'),_0xa3bd('0xd')];var AGIVertices=function(_0x2b5c1a,_0x38188d,_0x11537d){this[_0xa3bd('0xe')]=_0x2b5c1a;this[_0xa3bd('0xf')]=_0x38188d;this['mailRpc']=_0x11537d;};AGIVertices['prototype'][_0xa3bd('0x10')]=function(_0xc7802f,_0x3c5291){this[_0xa3bd('0xf')]['getVariableById'](_0xc7802f)[_0xa3bd('0x11')](function(_0x10c3f6){_0x3c5291(null,_0x10c3f6?_0x10c3f6[_0xa3bd('0x12')]:![]);})[_0xa3bd('0x13')](function(_0x51d688){_0x3c5291(_0x51d688);});};AGIVertices['prototype'][_0xa3bd('0x14')]=function(_0x5b805a,_0x37003f){this[_0xa3bd('0xf')]['getVoiceQueueById'](_0x5b805a)[_0xa3bd('0x11')](function(_0x4f5219){_0x37003f(null,_0x4f5219?_0x4f5219['name']:![]);})[_0xa3bd('0x13')](function(_0x1cd1bb){_0x37003f(_0x1cd1bb);});};AGIVertices['prototype'][_0xa3bd('0x15')]=function(_0x308c39,_0x48ea5a){this[_0xa3bd('0xf')]['getSquareProjectById'](_0x308c39)[_0xa3bd('0x11')](function(_0x57cf34){_0x48ea5a(null,_0x57cf34?_0x57cf34[_0xa3bd('0x12')]:![]);})[_0xa3bd('0x13')](function(_0x3c5388){_0x48ea5a(_0x3c5388);});};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x17')]=function(_0xb60e91,_0x57d98b){this[_0xa3bd('0xf')]['getSquareOdbcById'](_0xb60e91)[_0xa3bd('0x11')](function(_0x47ecdc){_0x57d98b(null,_0x47ecdc?_0x47ecdc[_0xa3bd('0x18')]:![]);})['catch'](function(_0x54cd2){_0x57d98b(_0x54cd2);});};AGIVertices['prototype'][_0xa3bd('0x19')]=function(_0x509e6c,_0x31f924){this['rpc'][_0xa3bd('0x1a')](_0x509e6c)['then'](function(_0xf313dd){_0x31f924(null,_0xf313dd?_0xf313dd[_0xa3bd('0x12')]:![]);})[_0xa3bd('0x13')](function(_0x325927){_0x31f924(_0x325927);});};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x1b')]=function(_0x15cfe6,_0x42e66d){this[_0xa3bd('0xf')][_0xa3bd('0x1c')](_0x15cfe6)[_0xa3bd('0x11')](function(_0x59d1bc){_0x42e66d(null,_0x59d1bc?_0x59d1bc[_0xa3bd('0x12')]:![]);})[_0xa3bd('0x13')](function(_0x3ecc37){_0x42e66d(_0x3ecc37);});};AGIVertices[_0xa3bd('0x16')]['getSound']=function(_0x3b5381,_0x9553d0){var _0x13a2dd=this;this[_0xa3bd('0xf')][_0xa3bd('0x1d')](_0x3b5381)[_0xa3bd('0x11')](function(_0x5969b1){_0x9553d0(null,_0x5969b1?_0x13a2dd[_0xa3bd('0x1e')](_0x5969b1[_0xa3bd('0x1f')]):![]);})[_0xa3bd('0x13')](function(_0x4b164e){_0x9553d0(_0x4b164e);});};AGIVertices['prototype'][_0xa3bd('0x20')]=function(_0x3cd7f0,_0x469dbe){this[_0xa3bd('0xf')]['getMailAccountById'](_0x3cd7f0)['then'](function(_0x399a7e){_0x469dbe(null,_0x399a7e?_0x399a7e:![]);})[_0xa3bd('0x13')](function(_0x1cd3ad){_0x469dbe(_0x1cd3ad);});};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x21')]=function(_0x5e6e63,_0x43c750,_0x226ddc){this[_0xa3bd('0x22')][_0xa3bd('0x21')](_0x5e6e63,_0x43c750)[_0xa3bd('0x11')](function(){_0x226ddc(null);})[_0xa3bd('0x13')](function(_0x351c87){_0x226ddc(_0x351c87);});};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x23')]=function(_0x3bea55,_0x23e308){this[_0xa3bd('0xf')]['getIntervalById'](_0x3bea55)[_0xa3bd('0x11')](function(_0x21f5c6){if(_0x21f5c6){if(_0x21f5c6[_0xa3bd('0x24')]){_0x23e308(null,[_0x21f5c6['interval']]);}else{_0x23e308(null,_[_0xa3bd('0x25')](_0x21f5c6[_0xa3bd('0x26')],_0xa3bd('0x27')));}}else{_0x23e308(null,![]);}})['catch'](function(_0x2eec46){_0x23e308(_0x2eec46);});};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x1e')]=function(_0x53722c){return util[_0xa3bd('0x28')](_0xa3bd('0x29'),FILES_PATH,_0x53722c);};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x2a')]=function(_0x350107,_0x554d9e,_0x1679eb){odbc['open'](_0x350107,function(_0x2f1c40){if(_0x2f1c40){logger['error'](_0xa3bd('0x2b'),_0x2f1c40);_0x1679eb(_0x2f1c40);}else{logger[_0xa3bd('0x2c')](_0xa3bd('0x2d'));odbc['query'](_0x554d9e,function(_0x363ea8,_0x40d70d){if(_0x363ea8){logger[_0xa3bd('0x2c')]('Error\x20executing\x20query\x20%s',_0x554d9e);_0x1679eb(_0x363ea8);}else{logger[_0xa3bd('0x2c')](_0xa3bd('0x2e'),_0x554d9e);odbc[_0xa3bd('0x2f')](function(_0x22087c){if(_0x22087c){logger[_0xa3bd('0x30')](_0xa3bd('0x31'),_0x22087c);}_0x1679eb(null,_0x40d70d);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x14c8cd,_0x5656f9){this['rpc'][_0xa3bd('0x32')](_0x14c8cd)[_0xa3bd('0x11')](function(_0x15d61f){_0x5656f9(null,_0x15d61f?_0x15d61f:![]);})['catch'](function(_0x50ac50){_0x5656f9(_0x50ac50);});};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x33')]=function(_0x27af38,_0x177d27){this[_0xa3bd('0xf')][_0xa3bd('0x33')](_0x27af38)[_0xa3bd('0x11')](function(_0x2cd755){_0x177d27(null,_0x2cd755);})[_0xa3bd('0x13')](function(_0x2913a9){_0x177d27(_0x2913a9);});};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x34')]=function(_0x403644,_0x23593b,_0x5ea62e){this[_0xa3bd('0xf')][_0xa3bd('0x34')]({'uniqueid':this['channel'][_0xa3bd('0x35')],'node':_0x403644['label'],'application':_0x403644[_0xa3bd('0x36')],'data':_0x23593b||null,'project_name':this['channel'][_0xa3bd('0x37')],'callerid':this[_0xa3bd('0xe')]['callerid']})['then'](function(_0x16ce77){if(_0x5ea62e){_0x5ea62e(null,_0x16ce77);}})[_0xa3bd('0x13')](function(_0x17959b){if(_0x5ea62e){_0x5ea62e(_0x17959b);}});};AGIVertices[_0xa3bd('0x16')]['createSquareRecording']=function(_0x49373d,_0x4f93d8,_0x2a82c5,_0x31fdb8){this['rpc'][_0xa3bd('0x38')]({'uniqueid':this[_0xa3bd('0xe')][_0xa3bd('0x35')],'callerid':this[_0xa3bd('0xe')]['callerid'],'calleridname':this['channel'][_0xa3bd('0x39')],'context':this[_0xa3bd('0xe')][_0xa3bd('0x3a')],'extension':this[_0xa3bd('0xe')][_0xa3bd('0x3b')],'priority':this[_0xa3bd('0xe')][_0xa3bd('0x3c')],'accountcode':this['channel'][_0xa3bd('0x3d')],'dnid':this[_0xa3bd('0xe')][_0xa3bd('0x3e')],'projectName':this[_0xa3bd('0xe')][_0xa3bd('0x37')],'saveName':_0x4f93d8,'filename':_0x49373d[_0xa3bd('0x3f')]||_0x4f93d8,'savePath':_0x2a82c5})[_0xa3bd('0x11')](function(_0x1f11c6){_0x31fdb8(null,_0x1f11c6);})['catch'](function(_0x1db4e6){_0x31fdb8(_0x1db4e6);});};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x40')]=function(_0x2da55c,_0x577be7,_0x39f629,_0x2648f6,_0x5e76c0){this[_0xa3bd('0xf')][_0xa3bd('0x40')]({'uniqueid':this[_0xa3bd('0xe')]['uniqueid'],'body':_0x2da55c,'direction':_0x577be7,'providerName':_0x39f629,'providerResponse':_0x2648f6})[_0xa3bd('0x11')](function(_0x15f1a5){if(_0x5e76c0){_0x5e76c0(null,_0x15f1a5);}})[_0xa3bd('0x13')](function(_0xb89ddc){if(_0x5e76c0){_0x5e76c0(_0xb89ddc);}});};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x41')]=function(_0x2e8eb1,_0x479a99){this[_0xa3bd('0xf')][_0xa3bd('0x41')]({'firstName':_[_0xa3bd('0x42')](_0x2e8eb1[_0xa3bd('0x12')])||_[_0xa3bd('0x43')](_0x2e8eb1[_0xa3bd('0x12')])?_0xa3bd('0x44')+Math[_0xa3bd('0x45')]():_0x2e8eb1[_0xa3bd('0x12')],'lastName':_[_0xa3bd('0x42')](_0x2e8eb1[_0xa3bd('0x46')])||_['isNil'](_0x2e8eb1[_0xa3bd('0x46')])?null:_0x2e8eb1[_0xa3bd('0x46')],'phone':_0x2e8eb1[_0xa3bd('0x47')],'ListId':_0x2e8eb1[_0xa3bd('0x48')],'scheduledat':_0x2e8eb1[_0xa3bd('0x49')],'callbackUniqueid':this[_0xa3bd('0xe')][_0xa3bd('0x35')],'tags':_0xa3bd('0x4a'),'description':_0xa3bd('0x4b')+_0x2e8eb1[_0xa3bd('0x49')]['toString'](),'priority':_0x2e8eb1['callback_priority']})[_0xa3bd('0x11')](function(_0x44cffd){_0x479a99(null,_0x44cffd);})[_0xa3bd('0x13')](function(_0x6dade2){_0x479a99(_0x6dade2);});};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x4c')]=function(_0xd313a4,_0x11c663){this[_0xa3bd('0xf')][_0xa3bd('0x4d')](_0xd313a4)['then'](function(_0x6d1f97){_0x11c663(null,_0x6d1f97?_0x6d1f97[_0xa3bd('0x12')]:![]);})[_0xa3bd('0x13')](function(_0x5e24b1){_0x11c663(_0x5e24b1);});};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x4e')]=function(_0xc4504c,_0x3283f3,_0x49fb67){var _0x13fbb4={'role':'agent'};_0x13fbb4[_0xc4504c]=this['channel']['callerid'];this[_0xa3bd('0xf')]['agentPause'](_0x13fbb4,_0x3283f3,this['channel'][_0xa3bd('0x35')])['then'](function(_0x4f9ce9){_0x49fb67(null,_['isNil'](_0x4f9ce9)?![]:!![]);})['catch'](function(_0x51b886){logger[_0xa3bd('0x30')](_0x51b886);_0x49fb67(null,![]);});};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x4f')]=function(_0x8f69b3,_0x524409){var _0x3accf7={'role':_0xa3bd('0x50')};_0x3accf7[_0x8f69b3]=this['channel']['callerid'];this['rpc'][_0xa3bd('0x4f')](_0x3accf7)[_0xa3bd('0x11')](function(_0x504c46){_0x524409(null,_[_0xa3bd('0x43')](_0x504c46)?![]:!![]);})[_0xa3bd('0x13')](function(_0x4ac3ed){logger[_0xa3bd('0x30')](_0x4ac3ed);_0x524409(null,![]);});};AGIVertices[_0xa3bd('0x16')]['agentLogout']=function(_0x18f67e,_0x14756d){var _0x466042={'role':_0xa3bd('0x50')};_0x466042[_0x18f67e]=this['channel'][_0xa3bd('0x51')];this['rpc'][_0xa3bd('0x52')](_0x466042)['then'](function(_0x153455){_0x14756d(null,_[_0xa3bd('0x43')](_0x153455)?![]:!![]);})[_0xa3bd('0x13')](function(_0x1a2c81){logger[_0xa3bd('0x30')](_0x1a2c81);_0x14756d(null,![]);});};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x53')]=function(_0x1e50ca,_0x13ff3f){var _0x263a0a={'role':_0xa3bd('0x50')};_0x263a0a[_0x1e50ca]=this[_0xa3bd('0xe')][_0xa3bd('0x51')];var _0x1de972=_0x1e50ca!=_0xa3bd('0x54')?util[_0xa3bd('0x28')](_0xa3bd('0x55'),_0xa3bd('0x56'),this[_0xa3bd('0xe')][_0xa3bd('0x51')]):undefined;this['rpc'][_0xa3bd('0x53')](_0x263a0a,_0x1de972)[_0xa3bd('0x11')](function(_0x74ede7){_0x13ff3f(null,_['isNil'](_0x74ede7)?![]:!![]);})[_0xa3bd('0x13')](function(_0x598439){logger[_0xa3bd('0x30')](_0x598439);_0x13ff3f(null,![]);});};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x57')]=function(_0x15118c,_0x3fcb97){sh['exec'](_[_0xa3bd('0x58')](_0x15118c),function(_0x2e3184,_0x39c21e){var _0x4a29cf=_0x39c21e[_0xa3bd('0x59')](/(\r\n|\n|\r)/gm,'');_0x3fcb97(null,_0x4a29cf);});};AGIVertices[_0xa3bd('0x16')]['googleCloudTTS']=function(_0x4535a3,_0x34387e){scripts[_0xa3bd('0x5a')](_0x4535a3[_0xa3bd('0x5b')],_0x4535a3[_0xa3bd('0x5c')]||_0xa3bd('0x5d'),_0x4535a3[_0xa3bd('0x5d')],_0x4535a3[_0xa3bd('0x5e')]||_0xa3bd('0x5f'),_0x4535a3[_0xa3bd('0x60')]||_0xa3bd('0x61'),_0x4535a3[_0xa3bd('0x62')]||_0xa3bd('0x63'))[_0xa3bd('0x11')](function(_0x2ae58b){_0x34387e(null,_0x2ae58b);})[_0xa3bd('0x13')](function(_0x214bde){_0x34387e(_0x214bde);});};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x64')]=function(_0x40f5bf,_0x1f2e36){scripts[_0xa3bd('0x64')](_0x40f5bf['text'],_0x40f5bf['google_tts_language']||'en',0x1)[_0xa3bd('0x11')](function(_0x3d04b7){_0x1f2e36(null,_0x3d04b7);})[_0xa3bd('0x13')](function(_0x1a2223){_0x1f2e36(_0x1a2223);});};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x65')]=function(_0x568380,_0xff884e){var _0x7d72ca={'uri':_0x568380['url'],'method':_0x568380[_0xa3bd('0x66')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x568380[_0xa3bd('0x67')])===_0xa3bd('0x68')&&parseInt(_0x568380[_0xa3bd('0x67')])>=0x1?parseInt(_0x568380[_0xa3bd('0x67')])*0x3e8:0x5*0x3e8};if(_[_0xa3bd('0x69')]([_0xa3bd('0x6a'),_0xa3bd('0x6b')],_0x7d72ca['method']['toUpperCase']())){try{_0x7d72ca[_0xa3bd('0x6c')]=_0x568380[_0xa3bd('0x6d')]?JSON['parse'](_0x568380[_0xa3bd('0x6d')]):{};}catch(_0x2bbbf2){logger[_0xa3bd('0x30')](_0xa3bd('0x6e'),_0x2bbbf2);}}try{_0x7d72ca['headers']=_0x568380[_0xa3bd('0xa')]?JSON[_0xa3bd('0x6f')](_0x568380[_0xa3bd('0xa')]):{};}catch(_0x599ce5){logger[_0xa3bd('0x30')](_0xa3bd('0x70'),_0x599ce5);}if(_0x568380['computedVariables']){try{var _0x1acf6c=require(_0x568380[_0xa3bd('0x71')])['sync'](this,_0x7d72ca);_0x7d72ca[_0xa3bd('0x72')]=Mustache[_0xa3bd('0x73')](_0x568380[_0xa3bd('0x74')],_0x1acf6c,{},['$$','$$']);if(_0x7d72ca[_0xa3bd('0x75')]){_0x7d72ca[_0xa3bd('0x75')]=JSON[_0xa3bd('0x6f')](Mustache['render'](JSON[_0xa3bd('0x76')](_0x7d72ca[_0xa3bd('0x75')]),_0x1acf6c,{},['$$','$$']));}if(_0x7d72ca['body']){_0x7d72ca['body']=JSON['parse'](Mustache[_0xa3bd('0x73')](JSON[_0xa3bd('0x76')](_0x7d72ca[_0xa3bd('0x6c')]),_0x1acf6c,{},['$$','$$']));}}catch(_0x1fb44f){logger['error'](_0xa3bd('0x77'),_0x1fb44f);}}rp(_0x7d72ca)[_0xa3bd('0x11')](function(_0x546f60){var _0x305393={'statusCode':_0x546f60['statusCode']||0xc8,'statusMessage':_0x546f60[_0xa3bd('0x78')]||'OK','headers':_0x546f60[_0xa3bd('0x75')]||{},'body':_0x546f60[_0xa3bd('0x6c')]||{}};_0xff884e(null,_0x305393);})['catch'](function(_0x165c59){var _0x479fb4={'statusCode':_0x165c59[_0xa3bd('0x79')]||0x1f4,'statusMessage':_0x165c59[_0xa3bd('0x7a')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x165c59[_0xa3bd('0x7b')]['headers']||{},'body':_0x165c59['options'][_0xa3bd('0x6c')]||{}};_0xff884e(null,_0x479fb4);});};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x7c')]=function(_0x116ca8,_0x3d37ad){scripts[_0xa3bd('0x7c')](this[_0xa3bd('0xe')][_0xa3bd('0x35')],_0x116ca8[_0xa3bd('0x7d')],_0x116ca8[_0xa3bd('0x5d')],_0x116ca8[_0xa3bd('0x7e')]||'en')['then'](function(_0x5da945){_0x3d37ad(null,_0x5da945);})[_0xa3bd('0x13')](function(_0x3deb13){_0x3d37ad(_0x3deb13);});};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x7f')]=function(_0x29f1b3,_0x5b1735){scripts['googleDialogflowV2'](this[_0xa3bd('0xe')][_0xa3bd('0x35')],_0x29f1b3[_0xa3bd('0x80')],_0x29f1b3[_0xa3bd('0x81')],_0x29f1b3['private_key'],_0x29f1b3[_0xa3bd('0x5d')],_0x29f1b3[_0xa3bd('0x82')]||'en')[_0xa3bd('0x11')](function(_0x36a513){_0x5b1735(null,_0x36a513);})[_0xa3bd('0x13')](function(_0x51211f){_0x5b1735(_0x51211f);});};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x83')]=function(_0x243701,_0x537ed9){scripts[_0xa3bd('0x83')](this[_0xa3bd('0xe')],_0x243701)['then'](function(_0x39cd99){_0x537ed9(null,_0x39cd99);})[_0xa3bd('0x13')](function(_0x3c1c84){_0x537ed9(_0x3c1c84);});};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x84')]=function(_0x256551,_0x4f48f2){scripts[_0xa3bd('0x84')](_0x256551[_0xa3bd('0x7d')],_0x256551[_0xa3bd('0x5d')],_0x256551[_0xa3bd('0x85')]||_0xa3bd('0x5f'),_0x256551[_0xa3bd('0x86')])['then'](function(_0x1ae835){_0x4f48f2(null,_0x1ae835);})[_0xa3bd('0x13')](function(_0x3bd0ac){_0x4f48f2(_0x3bd0ac);});};AGIVertices[_0xa3bd('0x16')]['ispeechASR']=function(_0x200879,_0x43b93d,_0xbee3b5){scripts[_0xa3bd('0x87')](_0x43b93d,_0x200879[_0xa3bd('0x7d')],_0x200879['ispeech_asr_language']||_0xa3bd('0x5f'),this['isConfigured'](_0x200879['model'])?_0x200879[_0xa3bd('0x88')]:undefined)[_0xa3bd('0x11')](function(_0x42a5f9){_0xbee3b5(null,_0x42a5f9);})[_0xa3bd('0x13')](function(_0x4edbbe){_0xbee3b5(_0x4edbbe);});};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x89')]=function(_0x152430,_0x2b2f2e){scripts[_0xa3bd('0x89')](_0x152430['aws_access_key_id'],_0x152430[_0xa3bd('0x8a')],_0x152430['aws_polly_region'],_0x152430['aws_polly_voice']||_0xa3bd('0x8b'),_0x152430[_0xa3bd('0x5d')],_0x152430[_0xa3bd('0x8c')]||_0xa3bd('0x5d'))[_0xa3bd('0x11')](function(_0x47692e){_0x2b2f2e(null,_0x47692e);})['catch'](function(_0x1a76f5){_0x2b2f2e(_0x1a76f5);});};AGIVertices['prototype'][_0xa3bd('0x8d')]=function(_0x17622e,_0x51e05e){scripts[_0xa3bd('0x8d')](this[_0xa3bd('0xe')][_0xa3bd('0x35')],_0x17622e[_0xa3bd('0x8e')],_0x17622e['aws_secret_access_key'],_0x17622e[_0xa3bd('0x8f')],_0x17622e[_0xa3bd('0x5d')],_0x17622e['aws_bot_name'])['then'](function(_0x2f9801){_0x51e05e(null,_0x2f9801);})['catch'](function(_0x11d362){_0x51e05e(_0x11d362);});};AGIVertices['prototype']['googleASR']=function(_0x186193,_0x1564e8,_0x3c91a8){scripts[_0xa3bd('0x90')](_0x1564e8,_0x186193[_0xa3bd('0x7d')],_0x186193[_0xa3bd('0x91')]||'en-US')[_0xa3bd('0x11')](function(_0x9f2ab8){_0x3c91a8(null,_0x9f2ab8);})['catch'](function(_0x41965f){_0x3c91a8(_0x41965f);});};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x92')]=function(_0x1ad7d3,_0x4c5811,_0x1cbc88){scripts[_0xa3bd('0x92')](_0x4c5811,_0x1ad7d3[_0xa3bd('0x93')],_0x1ad7d3[_0xa3bd('0x94')],_0x1ad7d3['uri'])[_0xa3bd('0x11')](function(_0x458ca3){_0x1cbc88(null,_0x458ca3);})[_0xa3bd('0x13')](function(_0x591498){_0x1cbc88(_0x591498);});};AGIVertices['prototype']['clear']=function(_0x17c806){var _0x2903df=_[_0xa3bd('0x69')](verticesWithRetry,_0x17c806[_0xa3bd('0x36')])?_0x17c806:_[_0xa3bd('0x95')](_0x17c806);for(var _0x53f40e in _0x2903df){if(_0x2903df[_0xa3bd('0x96')](_0x53f40e)){if(_0x2903df[_0x53f40e]&&_[_0xa3bd('0x97')](_0x2903df[_0x53f40e])){if(_[_0xa3bd('0x69')](recursiveMapAttributes,_0x53f40e)){_0x2903df[_0x53f40e]=this['replaceObjectAllVariables'](_0x2903df[_0x53f40e]);}else{_0x2903df[_0x53f40e]=this[_0xa3bd('0x98')](_0x2903df[_0x53f40e]);}}}}return _0x2903df;};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x99')]=function(_0x5673b2){for(var _0x344a51 in _0x5673b2){if(_0x5673b2['hasOwnProperty'](_0x344a51)){if(_[_0xa3bd('0x9a')](_0x5673b2[_0x344a51])){this[_0xa3bd('0x99')](_0x5673b2[_0x344a51]);}else if(_[_0xa3bd('0x9b')](_0x5673b2[_0x344a51])){for(var _0x511c3c=0x0;_0x511c3c<_0x5673b2[_0x344a51]['length'];_0x511c3c++){this['recursiveNodeIndex'](_0x5673b2[_0x344a51][_0x511c3c]);}}else if(_[_0xa3bd('0x97')](_0x5673b2[_0x344a51])){_0x5673b2[_0x344a51]=this[_0xa3bd('0x98')](_0x5673b2[_0x344a51]);}}}};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x9c')]=function(_0x41522d,_0x296b6e){for(var _0x55a8ed in _0x41522d){if(_0x41522d[_0xa3bd('0x96')](_0x55a8ed)){if(_[_0xa3bd('0x9a')](_0x41522d[_0x55a8ed])){if(!_['isEmpty'](_0x41522d[_0x55a8ed])){this[_0xa3bd('0x9c')](_0x41522d[_0x55a8ed],util['format'](_0xa3bd('0x9d'),_0x296b6e,_0x55a8ed));}}else if(_[_0xa3bd('0x9b')](_0x41522d[_0x55a8ed])){for(var _0x5af61e=0x0;_0x5af61e<_0x41522d[_0x55a8ed][_0xa3bd('0x9e')];_0x5af61e++){this[_0xa3bd('0x9c')](_0x41522d[_0x55a8ed][_0x5af61e],util[_0xa3bd('0x28')](_0xa3bd('0x9d'),_0x296b6e,_0x55a8ed+'['+_0x5af61e+']'));}}else{if(!_[_0xa3bd('0x43')](_0x41522d[_0x55a8ed])){this[_0xa3bd('0xe')][_0xa3bd('0x9f')](util[_0xa3bd('0x28')]('%s.%s',_0x296b6e,_0x55a8ed),_0x41522d[_0x55a8ed]);}}}}};AGIVertices[_0xa3bd('0x16')]['replaceObjectAllVariables']=function(_0x8d594e){try{var _0x2a4c2f=JSON[_0xa3bd('0x6f')](_0x8d594e);this[_0xa3bd('0x99')](_0x2a4c2f);return JSON[_0xa3bd('0x76')](_0x2a4c2f);}catch(_0xaae73f){return this[_0xa3bd('0x98')](_0x8d594e);}};AGIVertices[_0xa3bd('0x16')]['replaceAllVariables']=function(_0x555a8b){var _0x3e5430=_0x555a8b[_0xa3bd('0xa0')]('{');for(var _0x319596=0x1;_0x319596<_0x3e5430[_0xa3bd('0x9e')];_0x319596+=0x1){var _0x1e56cb=_0x3e5430[_0x319596][_0xa3bd('0xa0')]('}');if(_0x1e56cb[_0xa3bd('0x9e')]>0x1){_0x555a8b=_0x555a8b[_0xa3bd('0xa1')]('{'+_0x1e56cb[0x0]+'}',this[_0xa3bd('0xe')][_0xa3bd('0x10')](_0x1e56cb[0x0])[_0xa3bd('0xa2')]||_0x1e56cb[0x0]);}}if(_0x3e5430[_0xa3bd('0x9e')]===0x1){return _0x555a8b[_0xa3bd('0xa3')]();}return this[_0xa3bd('0x98')](_0x555a8b);};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0xa4')]=function(_0x41596e,_0x1dd4ba){var _0x3323b6=this[_0xa3bd('0xe')][_0xa3bd('0x10')](_0x41596e);if(_0x3323b6[_0xa3bd('0xa5')]===-0x1){return _0x3323b6;}logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x1dd4ba,_0x3323b6[_0xa3bd('0xa2')]));return this['channel'][_0xa3bd('0x9f')](_0x1dd4ba,_0x3323b6[_0xa3bd('0xa2')]);};AGIVertices['prototype']['isConfigured']=function(_0x16bf58){return _0x16bf58&&_0x16bf58!=='0'&&_0x16bf58!=='-1'&&_0x16bf58!=='';};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0xa6')]=function(_0xc18b04){this[_0xa3bd('0x34')][_0xa3bd('0xa7')](this,_0xc18b04,'-');_0xc18b04[_0xa3bd('0xa8')]=_0xc18b04[_0xa3bd('0xa6')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0xa9')]=function(_0x54a1d0){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x54a1d0[_0xa3bd('0xaa')]));if(!this[_0xa3bd('0xab')](_0x54a1d0[_0xa3bd('0x5d')])){return this['channel'][_0xa3bd('0xac')](_0xa3bd('0xad'));}var _0x5dae74='\x22'+_0x54a1d0[_0xa3bd('0x5d')]+'\x22';if(this[_0xa3bd('0xab')](_0x54a1d0['options'])){_0x5dae74+=','+_0x54a1d0[_0xa3bd('0x7b')];}var _0x2c075c=this[_0xa3bd('0xe')]['exec']('MRCPSynth',_0x5dae74);if(_0x2c075c[_0xa3bd('0xa5')]===-0x1){return _0x2c075c;}return this['channel']['noop'](util[_0xa3bd('0x28')](_0xa3bd('0xae'),_0x5dae74));};AGIVertices[_0xa3bd('0x16')]['mrcprecog']=function(_0x326b54){logger[_0xa3bd('0x2c')](util['format'](_0xa3bd('0xaf'),_0x326b54[_0xa3bd('0xaa')]));if(!this[_0xa3bd('0xab')](_0x326b54[_0xa3bd('0xb0')])){return this[_0xa3bd('0xe')][_0xa3bd('0xac')](_0xa3bd('0xb1'));}var _0x116520=_0x326b54[_0xa3bd('0xb0')];if(this[_0xa3bd('0xab')](_0x326b54[_0xa3bd('0x7b')])){_0x116520+=','+_0x326b54[_0xa3bd('0x7b')];}var _0x23e8ca=this[_0xa3bd('0xe')]['exec']('MRCPRecog',_0x116520);if(_0x23e8ca[_0xa3bd('0xa5')]===-0x1){return _0x23e8ca;}var _0x293afd=this[_0xa3bd('0xa4')](_0xa3bd('0xb2'),_0xa3bd('0xb3'));if(_0x293afd[_0xa3bd('0xa5')]===-0x1){return _0x293afd;}var _0x1f4863=this[_0xa3bd('0xa4')](_0xa3bd('0xb4'),_0xa3bd('0xb5'));if(_0x1f4863[_0xa3bd('0xa5')]===-0x1){return _0x1f4863;}var _0x3ee7d2=this[_0xa3bd('0xa4')]('RECOG_INSTANCE()',_0xa3bd('0xb6'));if(_0x3ee7d2['result']===-0x1){return _0x3ee7d2;}return this['channel'][_0xa3bd('0xac')](util[_0xa3bd('0x28')](_0xa3bd('0xb7'),_0x116520));};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0xb8')]=function(_0x5d281d){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x5d281d['label']));return this[_0xa3bd('0xe')][_0xa3bd('0xb8')]([_0x5d281d[_0xa3bd('0xb9')],_0x5d281d[_0xa3bd('0xba')]]);};AGIVertices[_0xa3bd('0x16')]['answer']=function(_0x590ae2){logger['info'](util[_0xa3bd('0x28')](_0xa3bd('0xbb'),_0x590ae2[_0xa3bd('0xaa')]));if(this[_0xa3bd('0xab')](_0x590ae2[_0xa3bd('0x67')])){logger[_0xa3bd('0x2c')](util['format'](_0xa3bd('0xbc'),_0x590ae2[_0xa3bd('0x67')]));var _0x475b0d=this[_0xa3bd('0xe')][_0xa3bd('0xbd')](_0x590ae2[_0xa3bd('0x67')]);if(_0x475b0d['result']===-0x1){return _0x475b0d;}}return this['channel'][_0xa3bd('0xbe')]();};AGIVertices['prototype']['callback']=function(_0x4e2873){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x4e2873[_0xa3bd('0xaa')]));if(!this[_0xa3bd('0xab')](_0x4e2873[_0xa3bd('0x48')])){return this['channel'][_0xa3bd('0x30')](_0x4e2873,_0xa3bd('0xbf'));}_0x4e2873['scheduledAt']=moment();if(this['isConfigured'](_0x4e2873[_0xa3bd('0xc0')])){_0x4e2873['scheduledAt']=moment()[_0xa3bd('0xc1')](_0x4e2873[_0xa3bd('0xc0')],_0xa3bd('0xc2'));}if(!this['isConfigured'](_0x4e2873[_0xa3bd('0xc3')])){_0x4e2873['callback_priority']=0x2;}this[_0xa3bd('0x41')][_0xa3bd('0xa7')](this,_0x4e2873);return this[_0xa3bd('0xe')][_0xa3bd('0xac')](util[_0xa3bd('0x28')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x4e2873[_0xa3bd('0x47')],_0x4e2873[_0xa3bd('0x48')],_0x4e2873[_0xa3bd('0x49')]));};AGIVertices['prototype'][_0xa3bd('0xc4')]=function(_0x52a20e){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x52a20e['label']));var _0x1cc59e=this[_0xa3bd('0xe')]['exec'](_0x52a20e[_0xa3bd('0xc5')],_0x52a20e[_0xa3bd('0x7b')]);if(_0x1cc59e['result']===-0x1){return _0x1cc59e;}return this[_0xa3bd('0xe')][_0xa3bd('0xac')](util[_0xa3bd('0x28')]('Executed\x20command\x20%s\x20%s',_0x52a20e[_0xa3bd('0xc5')],_0x52a20e[_0xa3bd('0x7b')]));};AGIVertices[_0xa3bd('0x16')]['lumenvoxtts']=function(_0x1ac899){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x1ac899[_0xa3bd('0xaa')]));if(!this[_0xa3bd('0xab')](_0x1ac899['text'])){return this[_0xa3bd('0xe')][_0xa3bd('0xac')](_0xa3bd('0xad'));}var _0x322855='\x22'+_0x1ac899[_0xa3bd('0x5d')]+'\x22';if(this[_0xa3bd('0xab')](_0x1ac899[_0xa3bd('0x7b')])){_0x322855+=','+_0x1ac899['options'];}var _0x4a86d7=this[_0xa3bd('0xe')][_0xa3bd('0xc6')]('MRCPSynth',_0x322855);if(_0x4a86d7[_0xa3bd('0xa5')]===-0x1){return _0x4a86d7;}return this['channel']['noop'](util[_0xa3bd('0x28')](_0xa3bd('0xae'),_0x322855));};AGIVertices[_0xa3bd('0x16')]['sestektts']=function(_0x7017d2){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')](_0xa3bd('0xc7'),_0x7017d2[_0xa3bd('0xaa')]));if(!this[_0xa3bd('0xab')](_0x7017d2[_0xa3bd('0x5d')])){return this[_0xa3bd('0xe')][_0xa3bd('0xac')](_0xa3bd('0xad'));}var _0x23934e='\x22'+_0x7017d2[_0xa3bd('0x5d')]+'\x22';if(this[_0xa3bd('0xab')](_0x7017d2[_0xa3bd('0x7b')])){_0x23934e+=','+_0x7017d2['options'];}var _0x20fa6a=this[_0xa3bd('0xe')][_0xa3bd('0xc6')](_0xa3bd('0xc8'),_0x23934e);if(_0x20fa6a[_0xa3bd('0xa5')]===-0x1){return _0x20fa6a;}return this[_0xa3bd('0xe')][_0xa3bd('0xac')](util[_0xa3bd('0x28')](_0xa3bd('0xae'),_0x23934e));};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0xc9')]=function(_0x5654e7){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x5654e7[_0xa3bd('0xaa')]));if(!this[_0xa3bd('0xab')](_0x5654e7[_0xa3bd('0xb0')])){return this[_0xa3bd('0xe')]['noop'](_0xa3bd('0xb1'));}var _0x2a56f7=_0x5654e7[_0xa3bd('0xb0')];if(this[_0xa3bd('0xab')](_0x5654e7[_0xa3bd('0x7b')])){_0x2a56f7+=','+_0x5654e7[_0xa3bd('0x7b')];}var _0x32a7f5=this[_0xa3bd('0xe')][_0xa3bd('0xc6')](_0xa3bd('0xca'),_0x2a56f7);if(_0x32a7f5['result']===-0x1){return _0x32a7f5;}var _0xd22369=this[_0xa3bd('0xa4')](_0xa3bd('0xb2'),_0xa3bd('0xcb'));if(_0xd22369[_0xa3bd('0xa5')]===-0x1){return _0xd22369;}var _0x24d9b1=this['getAndSetVariable'](_0xa3bd('0xb4'),_0xa3bd('0xcc'));if(_0x24d9b1[_0xa3bd('0xa5')]===-0x1){return _0x24d9b1;}var _0x2f6c73=this[_0xa3bd('0xa4')](_0xa3bd('0xcd'),_0xa3bd('0xce'));if(_0x2f6c73['result']===-0x1){return _0x2f6c73;}return this[_0xa3bd('0xe')]['noop'](util[_0xa3bd('0x28')](_0xa3bd('0xb7'),_0x2a56f7));};AGIVertices['prototype'][_0xa3bd('0xcf')]=function(_0x3436d7){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')](_0xa3bd('0xd0'),_0x3436d7['label']));if(!this[_0xa3bd('0xab')](_0x3436d7[_0xa3bd('0xb0')])){return this[_0xa3bd('0xe')]['noop'](_0xa3bd('0xb1'));}var _0x509bb3=_0x3436d7[_0xa3bd('0xb0')];if(this[_0xa3bd('0xab')](_0x3436d7[_0xa3bd('0x7b')])){_0x509bb3+=','+_0x3436d7[_0xa3bd('0x7b')];}var _0x5ef6d4=this[_0xa3bd('0xe')]['exec'](_0xa3bd('0xca'),_0x509bb3);if(_0x5ef6d4[_0xa3bd('0xa5')]===-0x1){return _0x5ef6d4;}var _0x4e03fd=this[_0xa3bd('0xa4')](_0xa3bd('0xb2'),'SESTEK_ASR_CONFIDENCE');if(_0x4e03fd[_0xa3bd('0xa5')]===-0x1){return _0x4e03fd;}var _0x1ceb36=this[_0xa3bd('0xa4')]('RECOG_INPUT()',_0xa3bd('0xd1'));if(_0x1ceb36['result']===-0x1){return _0x1ceb36;}var _0x27c0cd=this[_0xa3bd('0xa4')](_0xa3bd('0xcd'),_0xa3bd('0xd2'));if(_0x27c0cd['result']===-0x1){return _0x27c0cd;}return this[_0xa3bd('0xe')]['noop'](util[_0xa3bd('0x28')](_0xa3bd('0xb7'),_0x509bb3));};AGIVertices['prototype']['database']=function(_0x2fd040){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')](_0xa3bd('0xd3'),_0x2fd040[_0xa3bd('0xaa')]));if(!this[_0xa3bd('0xab')](_0x2fd040[_0xa3bd('0xd4')])){return this[_0xa3bd('0xe')]['error'](_0x2fd040,_0xa3bd('0xd5'));}var _0x5112e6=this[_0xa3bd('0x17')][_0xa3bd('0xa7')](this,_0x2fd040['odbc_id']);if(!_0x5112e6){return this[_0xa3bd('0xe')]['error'](_0x2fd040,'no\x20odbc\x20database\x20found');}if(!this[_0xa3bd('0xab')](_0x2fd040[_0xa3bd('0xd6')])){return this[_0xa3bd('0xe')][_0xa3bd('0x30')](_0x2fd040,_0xa3bd('0xd7'));}var _0x5adbd2=_0x2fd040['query'][_0xa3bd('0x59')](/(\r\n|\n|\r)/gm,'\x20');this[_0xa3bd('0xe')][_0xa3bd('0xac')](util[_0xa3bd('0x28')](_0xa3bd('0xd8'),_0x5adbd2));var _0x28b35d=this['getQueryOdbc'][_0xa3bd('0xa7')](this,_0x5112e6,_0x5adbd2);this[_0xa3bd('0x34')][_0xa3bd('0xa7')](this,_0x2fd040,_0x5adbd2);if(!this[_0xa3bd('0xab')](_0x2fd040['variable_id'])){return this[_0xa3bd('0xe')][_0xa3bd('0xac')](_0xa3bd('0xd9'));}var _0x528083=this[_0xa3bd('0x10')][_0xa3bd('0xa7')](this,_0x2fd040['variable_id']);if(!_0x528083){return this[_0xa3bd('0xe')][_0xa3bd('0x30')](_0x2fd040,_0xa3bd('0xda'));}var _0x4e3269=this;_0x28b35d['forEach'](function(_0x1b2687,_0x903674){Object[_0xa3bd('0xdb')](_0x1b2687)[_0xa3bd('0xdc')](function(_0x32fcb8){_0x4e3269[_0xa3bd('0xe')][_0xa3bd('0x9f')](util[_0xa3bd('0x28')]('%s[%s][%s]',_0x528083,_0x903674,_0x32fcb8),_0x1b2687[_0x32fcb8]);});});this[_0xa3bd('0xe')][_0xa3bd('0x9f')](util['format'](_0xa3bd('0xdd'),_0x528083),_0x28b35d[_0xa3bd('0x9e')]);return this[_0xa3bd('0xe')]['noop'](util[_0xa3bd('0x28')](_0xa3bd('0xde'),_0x528083));};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0xdf')]=function(_0x10fe4e){logger[_0xa3bd('0xe0')](util[_0xa3bd('0x28')](_0xa3bd('0xe1'),_0x10fe4e[_0xa3bd('0xaa')]));if(!this['isConfigured'](_0x10fe4e[_0xa3bd('0xe2')])){return this['channel'][_0xa3bd('0x30')](_0x10fe4e,_0xa3bd('0xe3'));}var _0x213050=this[_0xa3bd('0x19')][_0xa3bd('0xa7')](this,_0x10fe4e[_0xa3bd('0xe2')]);if(!_0x213050){return this['channel'][_0xa3bd('0x30')](_0x10fe4e,'no\x20user\x20found');}var _0x188940=this[_0xa3bd('0xe')][_0xa3bd('0xc6')](_0xa3bd('0xe4'),[util[_0xa3bd('0x28')](_0xa3bd('0xe5'),_0x213050),_0x10fe4e['timeout'],_0x10fe4e['opts'],_0x10fe4e[_0xa3bd('0x74')]]);if(_0x188940['result']===-0x1){return _0x188940;}return this[_0xa3bd('0xe')][_0xa3bd('0xac')](util[_0xa3bd('0x28')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0xe6')]=function(_0x308e5f){logger[_0xa3bd('0x2c')](util['format'](_0xa3bd('0xe7'),_0x308e5f[_0xa3bd('0xaa')]));if(!this[_0xa3bd('0xab')](_0x308e5f[_0xa3bd('0x7d')])){return this[_0xa3bd('0xe')]['noop'](_0xa3bd('0xe8'));}if(!this['isConfigured'](_0x308e5f['text'])){return this[_0xa3bd('0xe')][_0xa3bd('0xac')](_0xa3bd('0xad'));}this[_0xa3bd('0xe')][_0xa3bd('0xe9')]=!![];this[_0xa3bd('0x34')](_0x308e5f);this[_0xa3bd('0x40')](_0x308e5f[_0xa3bd('0x5d')],'in','','');this['channel']['noop'](util[_0xa3bd('0x28')]('Trying\x20Dialogflow:\x20%s',_0x308e5f[_0xa3bd('0x5d')]));var _0x92d106=this[_0xa3bd('0x7c')][_0xa3bd('0xa7')](this,_0x308e5f);if(_0x92d106){for(var _0x2954e4 in _0x92d106){if(_0x92d106['hasOwnProperty'](_0x2954e4)){this[_0xa3bd('0xe')]['setVariable'](util['format'](_0xa3bd('0xea'),_0x2954e4[_0xa3bd('0xeb')]()),_0x92d106[_0x2954e4]);}}this[_0xa3bd('0x40')](_0x92d106[_0xa3bd('0xec')],_0xa3bd('0xed'),_0xa3bd('0xe6'),'');return this[_0xa3bd('0xe')][_0xa3bd('0xac')](util[_0xa3bd('0x28')](_0xa3bd('0xee'),_0x92d106[_0xa3bd('0xec')]));}return this[_0xa3bd('0xe')][_0xa3bd('0x30')](_0x308e5f,_0xa3bd('0xef'));};AGIVertices['prototype'][_0xa3bd('0xf0')]=function(_0x3260f1){logger[_0xa3bd('0x2c')](util['format'](_0xa3bd('0xf1'),_0x3260f1['label']));if(!this[_0xa3bd('0xab')](_0x3260f1[_0xa3bd('0x80')])){return this[_0xa3bd('0xe')][_0xa3bd('0xac')](_0xa3bd('0xf2'));}if(!this['isConfigured'](_0x3260f1[_0xa3bd('0x81')])){return this['channel'][_0xa3bd('0xac')](_0xa3bd('0xf3'));}if(!this[_0xa3bd('0xab')](_0x3260f1[_0xa3bd('0xf4')])){return this[_0xa3bd('0xe')]['noop'](_0xa3bd('0xf5'));}if(!this[_0xa3bd('0xab')](_0x3260f1[_0xa3bd('0x82')])){return this[_0xa3bd('0xe')][_0xa3bd('0xac')](_0xa3bd('0xf6'));}if(!this['isConfigured'](_0x3260f1[_0xa3bd('0x5d')])){return this[_0xa3bd('0xe')]['noop'](_0xa3bd('0xad'));}this[_0xa3bd('0xe')][_0xa3bd('0xe9')]=!![];this['createSquareDetailsReport'](_0x3260f1);this['createSquareMessage'](_0x3260f1[_0xa3bd('0x5d')],'in','','');this[_0xa3bd('0xe')][_0xa3bd('0xac')](util[_0xa3bd('0x28')](_0xa3bd('0xf7'),_0x3260f1[_0xa3bd('0x5d')]));var _0x3fd352=this[_0xa3bd('0x7f')][_0xa3bd('0xa7')](this,_0x3260f1);if(_0x3fd352){for(var _0x2793ef in _0x3fd352){if(_0x3fd352['hasOwnProperty'](_0x2793ef)){if(_0x2793ef!=='providerResponse'){this[_0xa3bd('0xe')]['setVariable'](util[_0xa3bd('0x28')](_0xa3bd('0xea'),_0x2793ef[_0xa3bd('0xeb')]()),_0x3fd352[_0x2793ef]);}}}this[_0xa3bd('0x40')](_0x3fd352[_0xa3bd('0xec')],'out','dialogflowV2',_0x3fd352['providerResponse']);return this[_0xa3bd('0xe')]['noop'](util[_0xa3bd('0x28')](_0xa3bd('0xf8'),_0x3fd352['speech']));}return this[_0xa3bd('0xe')][_0xa3bd('0x30')](_0x3260f1,_0xa3bd('0xf9'));};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0xfa')]=function(_0x1efa21){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')](_0xa3bd('0xfb'),_0x1efa21[_0xa3bd('0xaa')]));if(!this[_0xa3bd('0xab')](_0x1efa21[_0xa3bd('0xfc')])){return this['channel'][_0xa3bd('0xac')](_0xa3bd('0xfd'));}if(!this[_0xa3bd('0xab')](_0x1efa21['username'])){return this[_0xa3bd('0xe')][_0xa3bd('0xac')]('no\x20username\x20configured');}if(!this[_0xa3bd('0xab')](_0x1efa21[_0xa3bd('0xfe')])){return this[_0xa3bd('0xe')][_0xa3bd('0xac')](_0xa3bd('0xff'));}if(!this['isConfigured'](_0x1efa21[_0xa3bd('0x100')])){return this['channel'][_0xa3bd('0xac')]('no\x20text\x20configured');}this[_0xa3bd('0xe')][_0xa3bd('0xe9')]=!![];this['createSquareDetailsReport'](_0x1efa21);this['createSquareMessage'](_0x1efa21[_0xa3bd('0x5d')],'in','','');this[_0xa3bd('0xe')][_0xa3bd('0xac')](util[_0xa3bd('0x28')]('Trying\x20SestekNDA:\x20%s',_0x1efa21['text']));var _0x77a7f=this[_0xa3bd('0x83')]['sync'](this,_0x1efa21);if(_0x77a7f){for(var _0x41bdb5 in _0x77a7f){if(_0x77a7f[_0xa3bd('0x96')](_0x41bdb5)){this[_0xa3bd('0xe')][_0xa3bd('0x9f')](util[_0xa3bd('0x28')](_0xa3bd('0x101'),_0x41bdb5[_0xa3bd('0xeb')]()),_0x77a7f[_0x41bdb5]);}}this[_0xa3bd('0x40')](_0x77a7f[_0xa3bd('0xec')],_0xa3bd('0xed'),_0xa3bd('0xfa'),'');if(_0x77a7f['audiofile']){this['channel'][_0xa3bd('0xac')](util['format'](_0xa3bd('0x102'),_0x77a7f['audiofile']));var _0x2366e2=this[_0xa3bd('0xe')]['streamFile'](_0x77a7f['audiofile']);try{fs['unlink'](_0x77a7f[_0xa3bd('0x103')]+_0xa3bd('0x104'));}catch(_0x1f0089){logger[_0xa3bd('0x30')](_0x1f0089);}return _0x2366e2;}else{return this[_0xa3bd('0xe')][_0xa3bd('0xac')](util[_0xa3bd('0x28')](_0xa3bd('0x105'),_0x77a7f['speech']));}}return this[_0xa3bd('0xe')]['error'](_0x1efa21,_0xa3bd('0x106'));};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x107')]=function(_0x8cee3c){logger['info'](util[_0xa3bd('0x28')](_0xa3bd('0x108'),_0x8cee3c[_0xa3bd('0xaa')]));return this[_0xa3bd('0xe')]['noop']('end');};AGIVertices['prototype'][_0xa3bd('0x109')]=function(_0x3d880c){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')](_0xa3bd('0x10a'),_0x3d880c[_0xa3bd('0xaa')]));var _0x3b75bc='';if(_0x3d880c[_0xa3bd('0x10b')]){if(!this[_0xa3bd('0xab')](_0x3d880c[_0xa3bd('0x10b')])){return this[_0xa3bd('0xe')][_0xa3bd('0x30')](_0x3d880c,_0xa3bd('0x10c'));}else{var _0x5e1157=parseInt(_0x3d880c[_0xa3bd('0x10b')],0xa);if(isNaN(_0x5e1157)){_0x3b75bc=_0x3d880c['trunk_id'];}else{_0x3b75bc=this[_0xa3bd('0x1b')][_0xa3bd('0xa7')](this,_0x3d880c['trunk_id']);if(!_0x3b75bc){return this['channel'][_0xa3bd('0x30')](_0x3d880c,_0xa3bd('0x10d'));}}}}else if(_0x3d880c[_0xa3bd('0x10e')]){_0x3b75bc=_0x3d880c[_0xa3bd('0x10e')];}else{return this[_0xa3bd('0xe')][_0xa3bd('0x30')](_0x3d880c,_0xa3bd('0x10c'));}var _0x4956b7=this[_0xa3bd('0xe')][_0xa3bd('0xc6')](_0xa3bd('0xe4'),[util[_0xa3bd('0x28')]('SIP/%s/%s',_0x3b75bc,_0x3d880c[_0xa3bd('0x47')]),_0x3d880c['timeout'],_0x3d880c[_0xa3bd('0x10f')],_0x3d880c[_0xa3bd('0x74')]]);if(_0x4956b7[_0xa3bd('0xa5')]===-0x1){return _0x4956b7;}return this[_0xa3bd('0xe')][_0xa3bd('0xac')](util['format']('Executed\x20command\x20%s',_0xa3bd('0xe4')));};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x110')]=function(_0x2f1eb9){logger[_0xa3bd('0x2c')](util['format'](_0xa3bd('0x111'),_0x2f1eb9[_0xa3bd('0xaa')]));return this[_0xa3bd('0xe')][_0xa3bd('0xac')](_0xa3bd('0x110'));};AGIVertices[_0xa3bd('0x16')]['getdigits']=function(_0x2885ee){logger['info'](util[_0xa3bd('0x28')](_0xa3bd('0x112'),_0x2885ee[_0xa3bd('0xaa')]));if(_0x2885ee[_0xa3bd('0xa8')]===0x0){return this[_0xa3bd('0xa6')](_0x2885ee);}_0x2885ee['retry']-=0x1;if(!this[_0xa3bd('0xab')](_0x2885ee[_0xa3bd('0x113')])){return this[_0xa3bd('0xe')]['error'](_0x2885ee,_0xa3bd('0x114'));}var _0x54a4f7=this[_0xa3bd('0x115')][_0xa3bd('0xa7')](this,_0x2885ee[_0xa3bd('0x113')]);if(!_0x54a4f7){return this[_0xa3bd('0xe')][_0xa3bd('0x30')](_0x2885ee,_0xa3bd('0x116'));}if(!this[_0xa3bd('0xab')](_0x2885ee[_0xa3bd('0x117')])){return this[_0xa3bd('0xe')][_0xa3bd('0x30')](_0xa3bd('0xd9'));}var _0x1a8948=this[_0xa3bd('0xe')][_0xa3bd('0x118')](_0x54a4f7,_0x2885ee['response'],_0x2885ee[_0xa3bd('0x119')]);var _0x4dc8cc=_0x1a8948[_0xa3bd('0xa5')]?_0x1a8948['result'][_0xa3bd('0xa3')]():'';logger['info'](_0xa3bd('0x11a'),JSON[_0xa3bd('0x76')](_0x1a8948));if(_0x1a8948[_0xa3bd('0xa5')]===-0x1){this[_0xa3bd('0x34')][_0xa3bd('0xa7')](this,_0x2885ee,_0x4dc8cc);return _0x1a8948;}else if(_0x1a8948[_0xa3bd('0xa2')]==='timeout'){_0x1a8948[_0xa3bd('0xa5')]=_0x4dc8cc['length']>=parseInt(_0x2885ee[_0xa3bd('0x11b')])?'x':'i';}else{_0x1a8948[_0xa3bd('0xa5')]=_0x4dc8cc['length']>=parseInt(_0x2885ee[_0xa3bd('0x11b')])&&_0x4dc8cc[_0xa3bd('0x9e')]<=parseInt(_0x2885ee[_0xa3bd('0x119')])?'x':'i';}var _0x3abcd9=this[_0xa3bd('0x10')][_0xa3bd('0xa7')](this,_0x2885ee[_0xa3bd('0x117')]);if(!_0x3abcd9){return this[_0xa3bd('0xe')][_0xa3bd('0x30')](_0x2885ee,_0xa3bd('0xda'));}this['channel'][_0xa3bd('0x9f')](_0x3abcd9,_0x4dc8cc);if(this[_0xa3bd('0xab')](_0x2885ee['hiddendigitsnum'])){var _0x36265a=parseInt(_0x2885ee[_0xa3bd('0x11c')],0xa);var _0x1a9ee0=rs[_0xa3bd('0x11d')]({'charset':'*','length':_0x36265a});var _0x70e3ae=_0x4dc8cc['length'];if(_0x70e3ae>0x0){if(_0x70e3ae>_0x36265a){this[_0xa3bd('0x34')][_0xa3bd('0xa7')](this,_0x2885ee,_0x2885ee[_0xa3bd('0x11e')]==='first'?_0x1a9ee0+_0x4dc8cc[_0xa3bd('0x11f')](_0x36265a):_0x4dc8cc[_0xa3bd('0x11f')](0x0,_0x70e3ae-_0x36265a)+_0x1a9ee0);}else{this[_0xa3bd('0x34')]['sync'](this,_0x2885ee,rs['generate']({'charset':'*','length':_0x70e3ae}));}}else{this[_0xa3bd('0x34')][_0xa3bd('0xa7')](this,_0x2885ee,'');}}else{this[_0xa3bd('0x34')]['sync'](this,_0x2885ee,_0x4dc8cc);}return _0x1a8948;};AGIVertices[_0xa3bd('0x16')]['getsecretdigits']=function(_0x426012){logger[_0xa3bd('0x2c')](util['format']('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x426012['label']));return this[_0xa3bd('0xc')](_0x426012);};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x120')]=function(_0x48e2b3){logger[_0xa3bd('0x2c')](util['format'](_0xa3bd('0x121'),_0x48e2b3['label']));this[_0xa3bd('0x34')][_0xa3bd('0xa7')](this,_0x48e2b3,_0x48e2b3['goalname']);return this[_0xa3bd('0xe')]['noop'](util[_0xa3bd('0x28')](_0xa3bd('0x122'),_0x48e2b3[_0xa3bd('0x123')]));};AGIVertices[_0xa3bd('0x16')]['awspolly']=function(_0x5a4798){logger['info'](util['format'](_0xa3bd('0x124'),_0x5a4798[_0xa3bd('0xaa')]));if(!this[_0xa3bd('0xab')](_0x5a4798[_0xa3bd('0x8e')])||!this['isConfigured'](_0x5a4798['aws_secret_access_key'])){return this['channel'][_0xa3bd('0xac')](_0xa3bd('0x125'));}if(!this['isConfigured'](_0x5a4798[_0xa3bd('0x5d')])){return this[_0xa3bd('0xe')][_0xa3bd('0xac')]('no\x20text\x20configured');}this[_0xa3bd('0xe')][_0xa3bd('0xac')](util[_0xa3bd('0x28')](_0xa3bd('0x126'),_0x5a4798['text']));var _0x2f20c2=this['awsPolly'][_0xa3bd('0xa7')](this,_0x5a4798);if(_0x2f20c2){this[_0xa3bd('0xe')][_0xa3bd('0xac')](util[_0xa3bd('0x28')]('aws\x20Polly\x20%s\x20file\x20created',_0x2f20c2));var _0x44b508=this[_0xa3bd('0xe')][_0xa3bd('0x127')](_0x2f20c2);try{fs[_0xa3bd('0x128')](_0x2f20c2+'.wav');}catch(_0x2fbce0){logger[_0xa3bd('0x30')](_0x2fbce0);}return _0x44b508;}return this[_0xa3bd('0xe')]['error'](_0x5a4798,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xa3bd('0x16')]['awslex']=function(_0x588267){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x588267[_0xa3bd('0xaa')]));if(!this[_0xa3bd('0xab')](_0x588267[_0xa3bd('0x8e')])||!this[_0xa3bd('0xab')](_0x588267[_0xa3bd('0x8a')])){return this[_0xa3bd('0xe')][_0xa3bd('0xac')](_0xa3bd('0x125'));}if(!this['isConfigured'](_0x588267[_0xa3bd('0x129')])){return this[_0xa3bd('0xe')][_0xa3bd('0xac')](_0xa3bd('0x12a'));}if(!this[_0xa3bd('0xab')](_0x588267['text'])){return this[_0xa3bd('0xe')][_0xa3bd('0xac')](_0xa3bd('0xad'));}this[_0xa3bd('0xe')][_0xa3bd('0xe9')]=!![];this[_0xa3bd('0x34')](_0x588267);this['createSquareMessage'](_0x588267[_0xa3bd('0x5d')],'in','','');this[_0xa3bd('0xe')]['noop'](util[_0xa3bd('0x28')](_0xa3bd('0x12b'),_0x588267[_0xa3bd('0x5d')]));var _0x84421d=this[_0xa3bd('0x8d')][_0xa3bd('0xa7')](this,_0x588267);if(_0x84421d){for(var _0x542ee0 in _0x84421d){if(_0x84421d['hasOwnProperty'](_0x542ee0)&&_[_0xa3bd('0x97')](_0x84421d[_0x542ee0])){this['channel']['setVariable'](util[_0xa3bd('0x28')](_0xa3bd('0x12c'),_0x542ee0[_0xa3bd('0xeb')]()),_0x84421d[_0x542ee0]);}}if(_[_0xa3bd('0x43')](_0x84421d[_0xa3bd('0x7a')])){return this[_0xa3bd('0xe')][_0xa3bd('0xac')](_0xa3bd('0x12d'));}else{this[_0xa3bd('0x40')](_0x84421d['message'],_0xa3bd('0xed'),_0xa3bd('0x12e'),'');return this['channel'][_0xa3bd('0xac')](util[_0xa3bd('0x28')](_0xa3bd('0x12f'),_0x84421d['message']));}}return this[_0xa3bd('0xe')][_0xa3bd('0x30')](_0x588267,_0xa3bd('0x130'));};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x131')]=function(_0xa13d30){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0xa13d30[_0xa3bd('0xaa')],_0xa13d30[_0xa3bd('0x67')]));if(!this[_0xa3bd('0xab')](_0xa13d30['key'])){return this[_0xa3bd('0xe')]['noop'](_0xa3bd('0xe8'));}var _0x1c5dbe=_0xa3bd('0x132');var _0x29926c=util[_0xa3bd('0x28')]('%s/recordings/%s',FILES_PATH,rs[_0xa3bd('0x11d')](0x4));var _0x370d6f=util['format'](_0xa3bd('0x9d'),_0x29926c,_0x1c5dbe);var _0x2e00f4=!![];if(_0xa13d30[_0xa3bd('0x133')]==='NOBEEP'){_0x2e00f4=![];}var _0x5823a4=this['channel'][_0xa3bd('0x134')](_0x29926c,_0x1c5dbe,_0xa13d30[_0xa3bd('0x135')],_0xa13d30[_0xa3bd('0x67')],undefined,_0x2e00f4);if(_0x5823a4[_0xa3bd('0xa5')]!==-0x1){this[_0xa3bd('0xe')]['noop'](util[_0xa3bd('0x28')](_0xa3bd('0x136'),_0x370d6f));var _0x2f5368=this[_0xa3bd('0x90')]['sync'](this,_0xa13d30,_0x370d6f);if(_0x2f5368){for(var _0xa8a4b5 in _0x2f5368){if(_0x2f5368[_0xa3bd('0x96')](_0xa8a4b5)){this[_0xa3bd('0xe')][_0xa3bd('0x9f')](util['format'](_0xa3bd('0x137'),_0xa8a4b5['toUpperCase']()),_0x2f5368[_0xa8a4b5]);}}return this[_0xa3bd('0xe')][_0xa3bd('0xac')](util[_0xa3bd('0x28')]('GoogleASR\x20Result\x20%s',JSON[_0xa3bd('0x76')](_0x2f5368)));}}return _0x5823a4;};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x138')]=function(_0x542e36){logger[_0xa3bd('0x2c')](util['format'](_0xa3bd('0x139'),_0x542e36[_0xa3bd('0xaa')]));if(!this[_0xa3bd('0xab')](_0x542e36[_0xa3bd('0x93')])){return this[_0xa3bd('0xe')][_0xa3bd('0xac')](_0xa3bd('0x13a'));}if(!this[_0xa3bd('0xab')](_0x542e36['appsecret'])){return this[_0xa3bd('0xe')][_0xa3bd('0xac')](_0xa3bd('0x13b'));}var _0x2ec94c='wav';var _0x16c36a=util[_0xa3bd('0x28')](_0xa3bd('0x13c'),FILES_PATH,rs[_0xa3bd('0x11d')](0x4));var _0xf2157=util[_0xa3bd('0x28')]('%s.%s',_0x16c36a,_0x2ec94c);var _0x458113=!![];if(_0x542e36[_0xa3bd('0x133')]===_0xa3bd('0x13d')){_0x458113=![];}var _0x54e71f=this[_0xa3bd('0xe')][_0xa3bd('0x134')](_0x16c36a,_0x2ec94c,_0x542e36['intKey'],_0x542e36['timeout'],undefined,_0x458113);if(_0x54e71f[_0xa3bd('0xa5')]!==-0x1){this[_0xa3bd('0xe')][_0xa3bd('0xac')](util[_0xa3bd('0x28')]('tilde\x20%s\x20file\x20created',_0xf2157));var _0x56ec22=this['tildeASR']['sync'](this,_0x542e36,_0xf2157);if(_0x56ec22){for(var _0x4925cc in _0x56ec22){if(_0x56ec22[_0xa3bd('0x96')](_0x4925cc)){this['channel'][_0xa3bd('0x9f')](util[_0xa3bd('0x28')](_0xa3bd('0x13e'),_0x4925cc[_0xa3bd('0xeb')]()),_0x56ec22[_0x4925cc]);}}return this[_0xa3bd('0xe')][_0xa3bd('0xac')](util[_0xa3bd('0x28')](_0xa3bd('0x13f'),JSON[_0xa3bd('0x76')](_0x56ec22)));}}return _0x54e71f;};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x140')]=function(_0x41c08c){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')](_0xa3bd('0x141'),_0x41c08c[_0xa3bd('0xaa')]));return this[_0xa3bd('0xe')][_0xa3bd('0x142')](_0x41c08c[_0xa3bd('0x3a')],_0x41c08c[_0xa3bd('0x3b')],_0x41c08c[_0xa3bd('0x3c')]);};AGIVertices[_0xa3bd('0x16')]['gotoif']=function(_0x3b561c){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')](_0xa3bd('0x143'),_0x3b561c[_0xa3bd('0xaa')]));if(!this[_0xa3bd('0xab')](_0x3b561c['condition'])){return this[_0xa3bd('0xe')][_0xa3bd('0x30')](_0x3b561c,_0xa3bd('0x144'));}try{var _0x5ba363=eval(_0x3b561c[_0xa3bd('0x145')])?_0xa3bd('0x146'):'false';this[_0xa3bd('0xe')][_0xa3bd('0xac')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x3b561c[_0xa3bd('0x145')],_0x5ba363));return{'code':0xc8,'result':_0x5ba363};}catch(_0x41660a){return{'code':0xc8,'result':_0xa3bd('0x147')};}};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x148')]=function(_0x2fb9d2){logger['info'](util[_0xa3bd('0x28')](_0xa3bd('0x149'),_0x2fb9d2['label']));if(!this['isConfigured'](_0x2fb9d2[_0xa3bd('0x14a')])){return this['channel'][_0xa3bd('0x30')](_0x2fb9d2,_0xa3bd('0x14b'));}var _0x4381df=this[_0xa3bd('0x23')][_0xa3bd('0xa7')](this,_0x2fb9d2[_0xa3bd('0x14a')]);if(!_0x4381df){return this[_0xa3bd('0xe')][_0xa3bd('0x30')](_0x2fb9d2,_0xa3bd('0x14c'));}for(var _0xdf3a5f=0x0;_0xdf3a5f<_0x4381df['length'];_0xdf3a5f+=0x1){var _0x55c89f=this[_0xa3bd('0xe')][_0xa3bd('0x10')](util[_0xa3bd('0x28')]('IFTIME(%s?true:false)',_0x4381df[_0xdf3a5f]));if(_0x55c89f[_0xa3bd('0xa5')]===-0x1){return _0x55c89f;}logger['info'](util['format']('IFTIME\x20%s\x20%s',_0x4381df[_0xdf3a5f],_0x55c89f['extra']));if(_0x55c89f[_0xa3bd('0xa2')]===_0xa3bd('0x146')){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')](_0xa3bd('0x14d'),_0x4381df[_0xdf3a5f],_0xa3bd('0x146')));this[_0xa3bd('0xe')][_0xa3bd('0xac')](util[_0xa3bd('0x28')](_0xa3bd('0x14d'),_0x4381df[_0xdf3a5f],_0xa3bd('0x146')));return{'code':0xc8,'result':_0xa3bd('0x146')};}else{logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')](_0xa3bd('0x14d'),_0x4381df[_0xdf3a5f],_0xa3bd('0x147')));this[_0xa3bd('0xe')][_0xa3bd('0xac')](util[_0xa3bd('0x28')](_0xa3bd('0x14d'),_0x4381df[_0xdf3a5f],_0xa3bd('0x147')));}}return{'code':0xc8,'result':_0xa3bd('0x147')};};AGIVertices[_0xa3bd('0x16')]['hangup']=function(_0x331a12){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')](_0xa3bd('0x14e'),_0x331a12['label']));return this[_0xa3bd('0xe')][_0xa3bd('0x14f')]();};AGIVertices[_0xa3bd('0x16')]['ispeechasr']=function(_0x8edb2d){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x8edb2d[_0xa3bd('0xaa')]));if(!this[_0xa3bd('0xab')](_0x8edb2d['key'])){return this[_0xa3bd('0xe')]['noop']('no\x20key\x20configured');}var _0x445f62=_0xa3bd('0x132');var _0x5df3dd=util['format'](_0xa3bd('0x13c'),FILES_PATH,rs['generate'](0x4));var _0xab8c12=util[_0xa3bd('0x28')](_0xa3bd('0x9d'),_0x5df3dd,_0x445f62);var _0x2f6ecc=!![];if(_0x8edb2d[_0xa3bd('0x133')]===_0xa3bd('0x13d')){_0x2f6ecc=![];}var _0x25e132=this['channel'][_0xa3bd('0x134')](_0x5df3dd,_0x445f62,_0x8edb2d[_0xa3bd('0x135')],_0x8edb2d[_0xa3bd('0x67')],undefined,_0x2f6ecc);if(_0x25e132['result']!==-0x1){this[_0xa3bd('0xe')][_0xa3bd('0xac')](util[_0xa3bd('0x28')](_0xa3bd('0x150'),_0xab8c12));var _0x5e35a4=this[_0xa3bd('0x87')]['sync'](this,_0x8edb2d,_0xab8c12);if(_0x5e35a4){for(var _0xcbe57c in _0x5e35a4){if(_0x5e35a4[_0xa3bd('0x96')](_0xcbe57c)){this[_0xa3bd('0xe')][_0xa3bd('0x9f')](util[_0xa3bd('0x28')](_0xa3bd('0x151'),_0xcbe57c[_0xa3bd('0xeb')]()),_0x5e35a4[_0xcbe57c]);}}return this[_0xa3bd('0xe')][_0xa3bd('0xac')](util[_0xa3bd('0x28')](_0xa3bd('0x152'),JSON[_0xa3bd('0x76')](_0x5e35a4)));}}return _0x25e132;};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x153')]=function(_0x384009){logger['info'](util[_0xa3bd('0x28')](_0xa3bd('0x154'),_0x384009[_0xa3bd('0xaa')]));if(!this['isConfigured'](_0x384009[_0xa3bd('0x7d')])){return this[_0xa3bd('0xe')][_0xa3bd('0xac')](_0xa3bd('0xe8'));}if(!this['isConfigured'](_0x384009['text'])){return this[_0xa3bd('0xe')]['noop']('no\x20text\x20configured');}this[_0xa3bd('0xe')][_0xa3bd('0xac')](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x384009[_0xa3bd('0x5d')]));var _0x1aaaa2=this[_0xa3bd('0x84')]['sync'](this,_0x384009);if(_0x1aaaa2){this['channel']['noop'](util[_0xa3bd('0x28')]('ispeech\x20%s\x20file\x20created',_0x1aaaa2));var _0x302d24=this[_0xa3bd('0xe')]['streamFile'](_0x1aaaa2,_0x384009[_0xa3bd('0x135')]);try{fs['unlink'](_0x1aaaa2+_0xa3bd('0x104'));}catch(_0x4b82d0){logger[_0xa3bd('0x30')](_0x4b82d0);}return _0x302d24;}return this[_0xa3bd('0xe')][_0xa3bd('0x30')](_0x384009,_0xa3bd('0x155'));};AGIVertices[_0xa3bd('0x16')]['login']=function(_0x764d4f){logger[_0xa3bd('0x2c')](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x764d4f[_0xa3bd('0xaa')]));if(!this[_0xa3bd('0xab')](_0x764d4f[_0xa3bd('0x156')])){return this[_0xa3bd('0xe')][_0xa3bd('0x30')](_0x764d4f,_0xa3bd('0x157'));}logger['info'](util[_0xa3bd('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xa3bd('0xe')][_0xa3bd('0x51')],_0x764d4f[_0xa3bd('0x156')]));var _0x59c2e1=this[_0xa3bd('0x53')]['sync'](this,_0x764d4f[_0xa3bd('0x156')]);if(_0x59c2e1){logger[_0xa3bd('0x2c')](util['format'](_0xa3bd('0x158'),this[_0xa3bd('0xe')]['callerid'],_0x764d4f[_0xa3bd('0x156')]));this[_0xa3bd('0xe')]['noop'](util[_0xa3bd('0x28')](_0xa3bd('0x158'),this['channel'][_0xa3bd('0x51')],_0x764d4f['findBy']));return{'code':0xc8,'result':_0xa3bd('0x159')};}else{logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')](_0xa3bd('0x15a'),this[_0xa3bd('0xe')][_0xa3bd('0x51')],_0x764d4f[_0xa3bd('0x156')]));this['channel'][_0xa3bd('0xac')](util[_0xa3bd('0x28')](_0xa3bd('0x15a'),this[_0xa3bd('0xe')][_0xa3bd('0x51')],_0x764d4f[_0xa3bd('0x156')]));return{'code':0xc8,'result':_0xa3bd('0x15b')};}};AGIVertices['prototype']['logout']=function(_0x1df938){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x1df938['label']));if(!this[_0xa3bd('0xab')](_0x1df938[_0xa3bd('0x156')])){return this['channel'][_0xa3bd('0x30')](_0x1df938,'no\x20find\x20by\x20configured');}logger['info'](util[_0xa3bd('0x28')](_0xa3bd('0x15c'),this[_0xa3bd('0xe')][_0xa3bd('0x51')],_0x1df938[_0xa3bd('0x156')]));var _0x12f069=this[_0xa3bd('0x52')]['sync'](this,_0x1df938['findBy']);if(_0x12f069){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')](_0xa3bd('0x158'),this[_0xa3bd('0xe')][_0xa3bd('0x51')],_0x1df938['findBy']));this[_0xa3bd('0xe')]['noop'](util[_0xa3bd('0x28')](_0xa3bd('0x158'),this[_0xa3bd('0xe')][_0xa3bd('0x51')],_0x1df938[_0xa3bd('0x156')]));return{'code':0xc8,'result':_0xa3bd('0x159')};}else{logger[_0xa3bd('0x2c')](util['format'](_0xa3bd('0x15a'),this['channel'][_0xa3bd('0x51')],_0x1df938[_0xa3bd('0x156')]));this['channel'][_0xa3bd('0xac')](util[_0xa3bd('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa3bd('0xe')][_0xa3bd('0x51')],_0x1df938[_0xa3bd('0x156')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype']['math']=function(_0x2e0027){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')](_0xa3bd('0x15d'),_0x2e0027['label']));if(!this[_0xa3bd('0xab')](_0x2e0027[_0xa3bd('0x15e')])){return this[_0xa3bd('0xe')][_0xa3bd('0x30')](_0x2e0027,_0xa3bd('0x15f'));}this['channel'][_0xa3bd('0xac')](util['format'](_0xa3bd('0x160'),_0x2e0027[_0xa3bd('0x15e')]));var _0xcc5695=eval(_0x2e0027[_0xa3bd('0x15e')]);if(!this['isConfigured'](_0x2e0027[_0xa3bd('0x117')])){return this['channel']['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x198bb4=this['getVariable'][_0xa3bd('0xa7')](this,_0x2e0027[_0xa3bd('0x117')]);if(!_0x198bb4){return this[_0xa3bd('0xe')]['error'](_0x2e0027,_0xa3bd('0xda'));}if(_['isArray'](_0xcc5695)){var _0x21a545=this;_0xcc5695[_0xa3bd('0xdc')](function(_0xe918f5,_0x56cf1e){_0x21a545[_0xa3bd('0xe')]['setVariable'](util[_0xa3bd('0x28')](_0xa3bd('0x161'),_0x198bb4,_0x56cf1e),_0xe918f5);});return this[_0xa3bd('0xe')][_0xa3bd('0xac')](util[_0xa3bd('0x28')](_0xa3bd('0x162'),_0x198bb4));}else{return this[_0xa3bd('0xe')][_0xa3bd('0x9f')](_0x198bb4,_0xcc5695);}};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0xb')]=function(_0x115b14){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x115b14[_0xa3bd('0xaa')]));if(_0x115b14[_0xa3bd('0xa8')]===0x0){return this[_0xa3bd('0xa6')](_0x115b14);}_0x115b14[_0xa3bd('0xa8')]-=0x1;if(!this[_0xa3bd('0xab')](_0x115b14['file_id'])){return this[_0xa3bd('0xe')][_0xa3bd('0x30')](_0x115b14,_0xa3bd('0x114'));}var _0x5e33c2=this[_0xa3bd('0x115')][_0xa3bd('0xa7')](this,_0x115b14[_0xa3bd('0x113')]);if(!_0x5e33c2){return this[_0xa3bd('0xe')][_0xa3bd('0x30')](_0x115b14,_0xa3bd('0x116'));}var _0x13fabe=this[_0xa3bd('0xe')][_0xa3bd('0x118')](_0x5e33c2,_0x115b14[_0xa3bd('0x163')],_0x115b14['digit']);var _0x338ab8=_0x13fabe[_0xa3bd('0xa5')];if(_0x13fabe[_0xa3bd('0xa5')]===-0x1){this[_0xa3bd('0x34')][_0xa3bd('0xa7')](this,_0x115b14,'-1');return _0x13fabe;}else if(_0x13fabe[_0xa3bd('0xa2')]===_0xa3bd('0x67')){_0x13fabe[_0xa3bd('0xa5')]=_0x13fabe[_0xa3bd('0xa5')][_0xa3bd('0x9e')]>0x0?_0x13fabe[_0xa3bd('0xa5')]:'t';}else if(_[_0xa3bd('0x42')](_0x13fabe['result'])){_0x13fabe[_0xa3bd('0xa5')]='#';_0x338ab8='#';}if(!this['isConfigured'](_0x115b14[_0xa3bd('0x117')])){this[_0xa3bd('0xe')][_0xa3bd('0xac')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x80e433=this[_0xa3bd('0x10')][_0xa3bd('0xa7')](this,_0x115b14['variable_id']);if(!_0x80e433){return this[_0xa3bd('0xe')][_0xa3bd('0x30')](_0x115b14,_0xa3bd('0xda'));}this[_0xa3bd('0xe')][_0xa3bd('0x9f')](_0x80e433,_0x338ab8);}this['createSquareDetailsReport'][_0xa3bd('0xa7')](this,_0x115b14,_0x338ab8);return _0x13fabe;};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0xac')]=function(_0x40444e){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')](_0xa3bd('0x164'),_0x40444e['label']));return this['channel'][_0xa3bd('0xac')](_0x40444e[_0xa3bd('0x165')]||_0x40444e[_0xa3bd('0xaa')]);};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x166')]=function(_0x8558f2){logger[_0xa3bd('0x2c')](util['format']('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x8558f2['label']));if(!this[_0xa3bd('0xab')](_0x8558f2[_0xa3bd('0x156')])){return this['channel'][_0xa3bd('0x30')](_0x8558f2,_0xa3bd('0x157'));}logger['info'](util[_0xa3bd('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xa3bd('0x51')],_0x8558f2[_0xa3bd('0x156')]));var _0x2ef6c2=this['getPause'][_0xa3bd('0xa7')](this,_0x8558f2['pause_id']);var _0x4f0fd7=this['agentPause']['sync'](this,_0x8558f2['findBy'],_0x2ef6c2);if(_0x4f0fd7){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')](_0xa3bd('0x158'),this[_0xa3bd('0xe')][_0xa3bd('0x51')],_0x8558f2[_0xa3bd('0x156')]));this['channel']['noop'](util[_0xa3bd('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x8558f2[_0xa3bd('0x156')]));return{'code':0xc8,'result':_0xa3bd('0x159')};}else{logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa3bd('0xe')][_0xa3bd('0x51')],_0x8558f2[_0xa3bd('0x156')]));this[_0xa3bd('0xe')][_0xa3bd('0xac')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xa3bd('0x51')],_0x8558f2['findBy']));return{'code':0xc8,'result':_0xa3bd('0x15b')};}};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x167')]=function(_0x50ea8d){logger['info'](util['format'](_0xa3bd('0x168'),_0x50ea8d['label']));if(!this[_0xa3bd('0xab')](_0x50ea8d[_0xa3bd('0x113')])){return this[_0xa3bd('0xe')][_0xa3bd('0x30')](_0x50ea8d,'no\x20file\x20audio\x20selected');}var _0x694f82=this['getSound'][_0xa3bd('0xa7')](this,_0x50ea8d[_0xa3bd('0x113')]);if(!_0x694f82){return this[_0xa3bd('0xe')]['error'](_0x50ea8d,_0xa3bd('0x116'));}var _0x2acc2e=this[_0xa3bd('0xe')][_0xa3bd('0xc6')](_0xa3bd('0x169'),[_0x694f82,_0x50ea8d['opts']]);if(_0x2acc2e[_0xa3bd('0xa5')]===-0x1){return _0x2acc2e;}return this[_0xa3bd('0xe')]['noop'](util[_0xa3bd('0x28')]('Executed\x20command\x20%s\x20%s',_0xa3bd('0x169'),_0x694f82));};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x16a')]=function(_0x1a39c4){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x1a39c4['label']));if(!this[_0xa3bd('0xab')](_0x1a39c4[_0xa3bd('0x16b')])){return this[_0xa3bd('0xe')][_0xa3bd('0x30')](_0x1a39c4,_0xa3bd('0x16c'));}var _0x5c88ff='';var _0x1534cf=parseInt(_0x1a39c4[_0xa3bd('0x16b')],0xa);if(isNaN(_0x1534cf)){_0x5c88ff=_0x1a39c4[_0xa3bd('0x16b')];}else{_0x5c88ff=this[_0xa3bd('0x14')]['sync'](this,_0x1a39c4[_0xa3bd('0x16b')]);if(!_0x5c88ff){return this[_0xa3bd('0xe')]['error'](_0x1a39c4,_0xa3bd('0x16d'));}}var _0x12cb31='';if(this[_0xa3bd('0xab')](_0x1a39c4['file_id'])){var _0x9f0d40=this[_0xa3bd('0x115')][_0xa3bd('0xa7')](this,_0x1a39c4['file_id']);if(_0x9f0d40){_0x12cb31=_0x9f0d40;}}this[_0xa3bd('0x34')][_0xa3bd('0xa7')](this,_0x1a39c4,_0x5c88ff);if(_0x1a39c4[_0xa3bd('0x10f')][_0xa3bd('0x16e')]('x')<0x0){_0x1a39c4[_0xa3bd('0x10f')]+='x';}if(_0x1a39c4[_0xa3bd('0x10f')][_0xa3bd('0x16e')]('X')<0x0){_0x1a39c4[_0xa3bd('0x10f')]+='X';}this[_0xa3bd('0xe')]['setVariable'](_0xa3bd('0x16f'),_0x5c88ff?_0x5c88ff[_0xa3bd('0x170')]():'');var _0xea92c3=this[_0xa3bd('0xe')][_0xa3bd('0xc6')](_0xa3bd('0x171'),[_0x5c88ff,_0x1a39c4[_0xa3bd('0x10f')],_0x1a39c4[_0xa3bd('0x74')],_0x12cb31,_0x1a39c4[_0xa3bd('0x67')],_0x1a39c4['agi'],_0x1a39c4[_0xa3bd('0x172')],_0x1a39c4[_0xa3bd('0x173')],'',_0x1a39c4[_0xa3bd('0x174')]]);if(_0xea92c3[_0xa3bd('0xa5')]===-0x1){return _0xea92c3;}return this[_0xa3bd('0xe')][_0xa3bd('0xac')](util[_0xa3bd('0x28')](_0xa3bd('0x175'),_0xa3bd('0x171'),_0x5c88ff));};AGIVertices['prototype']['record']=function(_0x2ad7ee){logger['info'](util[_0xa3bd('0x28')](_0xa3bd('0x176'),_0x2ad7ee['label']));var _0x51f13c=_0x2ad7ee['recordingFormat']||_0xa3bd('0x132');var _0x27746b=util[_0xa3bd('0x28')](_0xa3bd('0x177'),this['channel'][_0xa3bd('0x35')],rs[_0xa3bd('0x11d')](0x5));var _0x1a9047=util[_0xa3bd('0x28')](_0xa3bd('0x178'),FILES_PATH,_0x27746b,_0x51f13c);var _0x20f462=util[_0xa3bd('0x28')]('%s/recordings/%s',FILES_PATH,_0x27746b);this['createSquareRecording']['sync'](this,_0x2ad7ee,_0x27746b,_0x1a9047);this[_0xa3bd('0xe')][_0xa3bd('0x9f')](_0xa3bd('0x179'),_0x27746b);logger['info'](_0xa3bd('0x17a'),_0x20f462,_0x51f13c,_0x2ad7ee['escape_digits'],_0x2ad7ee[_0xa3bd('0x67')]);return this[_0xa3bd('0xe')][_0xa3bd('0x134')](_0x20f462,_0x51f13c,_0x2ad7ee[_0xa3bd('0x17b')],_0x2ad7ee[_0xa3bd('0x67')],undefined,!![]);};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x17c')]=function(_0x15c41b){logger[_0xa3bd('0x2c')](util['format'](_0xa3bd('0x17d'),_0x15c41b[_0xa3bd('0xaa')]));if(!this[_0xa3bd('0xab')](_0x15c41b[_0xa3bd('0x74')])){return this[_0xa3bd('0xe')]['noop']('no\x20url\x20configured');}var _0x49684b=this[_0xa3bd('0x65')]['sync'](this,_0x15c41b);logger[_0xa3bd('0x2c')](util['format'](_0xa3bd('0x17e'),util['inspect'](_0x49684b,{'showHidden':![],'depth':null})));if(!this[_0xa3bd('0xab')](_0x15c41b[_0xa3bd('0x117')])){return this['channel'][_0xa3bd('0xac')](_0xa3bd('0x17f'));}var _0x44b0e1=this[_0xa3bd('0x10')][_0xa3bd('0xa7')](this,_0x15c41b['variable_id']);if(!_0x44b0e1){return this[_0xa3bd('0xe')]['error'](_0x15c41b,_0xa3bd('0xda'));}this['channel'][_0xa3bd('0x9f')](util[_0xa3bd('0x28')]('%s_STATUS_CODE',_0x44b0e1),_0x49684b[_0xa3bd('0x79')]?_0x49684b[_0xa3bd('0x79')]:_0xa3bd('0x180'));this[_0xa3bd('0xe')]['setVariable'](util[_0xa3bd('0x28')](_0xa3bd('0x181'),_0x44b0e1),_0x49684b[_0xa3bd('0x78')]?_0x49684b[_0xa3bd('0x78')]:'OK');if(_0x49684b[_0xa3bd('0x6c')]){try{this[_0xa3bd('0x9c')](_0x49684b['body'],_0x44b0e1);}catch(_0x4d8563){logger['error'](util[_0xa3bd('0x28')](_0xa3bd('0x182'),_0x44b0e1));}}return this[_0xa3bd('0xe')]['noop'](util['format'](_0xa3bd('0xde'),_0x44b0e1));};AGIVertices['prototype'][_0xa3bd('0x183')]=function(_0x424052){logger['info'](util['format'](_0xa3bd('0x184'),_0x424052['label']));return this[_0xa3bd('0xe')][_0xa3bd('0x185')](_0x424052[_0xa3bd('0x186')][_0xa3bd('0x59')](/\s+/g,''),_0x424052[_0xa3bd('0x17b')]);};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x187')]=function(_0x15a67e){logger[_0xa3bd('0x2c')](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x15a67e[_0xa3bd('0xaa')]));return this[_0xa3bd('0xe')]['sayNumber'](_0x15a67e[_0xa3bd('0x68')][_0xa3bd('0x59')](/\s+/g,''),_0x15a67e[_0xa3bd('0x17b')]);};AGIVertices['prototype'][_0xa3bd('0x188')]=function(_0x29eaf2){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')](_0xa3bd('0x189'),_0x29eaf2['label']));return this[_0xa3bd('0xe')][_0xa3bd('0x18a')](_0x29eaf2[_0xa3bd('0x5d')],_0x29eaf2['escape_digits']);};AGIVertices['prototype'][_0xa3bd('0x18b')]=function(_0x558cfa){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')](_0xa3bd('0x18c'),_0x558cfa[_0xa3bd('0xaa')]));if(!this[_0xa3bd('0xab')](_0x558cfa['account_id'])){return this[_0xa3bd('0xe')][_0xa3bd('0xac')]('no\x20mail\x20account\x20configured');}var _0x2bcd80=this['getMailAccount'][_0xa3bd('0xa7')](this,_0x558cfa['account_id']);if(!_0x2bcd80||!_0x2bcd80[_0xa3bd('0x18d')]){return this[_0xa3bd('0xe')][_0xa3bd('0x30')](_0x558cfa,_0xa3bd('0x18e'));}var _0xc5da2e={'from':util[_0xa3bd('0x28')]('\x22%s\x22\x20<%s>',_0x2bcd80[_0xa3bd('0x12')],_0x2bcd80[_0xa3bd('0x18f')]||_0x2bcd80[_0xa3bd('0x18d')][_0xa3bd('0x190')]),'to':_0x558cfa['to']||'','cc':_0x558cfa['cc']||'','bcc':_0x558cfa[_0xa3bd('0x191')]||'','subject':_0x558cfa[_0xa3bd('0x192')],'html':_0x558cfa[_0xa3bd('0x5d')],'text':_0x558cfa[_0xa3bd('0x5d')]};var _0x74463b={'tls':{'rejectUnauthorized':![]}};if(_0x2bcd80['Smtp']['service']){_0x74463b[_0xa3bd('0x193')]=_0x2bcd80[_0xa3bd('0x18d')][_0xa3bd('0x193')];}else{_0x74463b[_0xa3bd('0x194')]=_0x2bcd80['Smtp'][_0xa3bd('0x194')];_0x74463b[_0xa3bd('0x195')]=_0x2bcd80['Smtp'][_0xa3bd('0x195')];_0x74463b[_0xa3bd('0x196')]=_0x2bcd80[_0xa3bd('0x18d')]['secure'];}if(_0x2bcd80['Smtp']['authentication']){_0x74463b[_0xa3bd('0x197')]={'user':_0x2bcd80[_0xa3bd('0x18d')]['user'],'pass':_0x2bcd80[_0xa3bd('0x18d')][_0xa3bd('0x198')]};}if(this[_0xa3bd('0xab')](_0x558cfa[_0xa3bd('0x199')])){}logger[_0xa3bd('0xe0')](_0xa3bd('0x19a'),JSON['stringify'](_0xc5da2e));this[_0xa3bd('0x34')][_0xa3bd('0xa7')](this,_0x558cfa,_0x558cfa[_0xa3bd('0x19b')]);this['channel'][_0xa3bd('0xac')](util[_0xa3bd('0x28')](_0xa3bd('0x19c'),_0x2bcd80[_0xa3bd('0x12')]));this['sendMailMessage'][_0xa3bd('0xa7')](this,_0x74463b,_0xc5da2e);return this[_0xa3bd('0xe')]['noop'](_0xa3bd('0x19d'));};AGIVertices['prototype'][_0xa3bd('0x19e')]=function(_0x3f22c9){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')](_0xa3bd('0x19f'),_0x3f22c9[_0xa3bd('0xaa')]));return this['channel'][_0xa3bd('0xac')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xa3bd('0x16')]['sendSMS']=function(_0x4bf026){logger['info'](util['format'](_0xa3bd('0x1a0'),_0x4bf026['label']));if(!this['isConfigured'](_0x4bf026['sms_account_id'])){return this['channel'][_0xa3bd('0xac')]('no\x20sms\x20account\x20configured');}var _0xac5a89=this[_0xa3bd('0x1a1')][_0xa3bd('0xa7')](this,_0x4bf026['sms_account_id']);if(!_0xac5a89){return this[_0xa3bd('0xe')][_0xa3bd('0x30')](_0x4bf026,_0xa3bd('0x1a2'));}var _0x23ad9a={'body':_0x4bf026['sms_text'],'phone':_0x4bf026['to']||'','SmsAccountId':_0xac5a89['id']};logger[_0xa3bd('0xe0')](_0xa3bd('0x1a3'),JSON[_0xa3bd('0x76')](_0x23ad9a));this[_0xa3bd('0x34')][_0xa3bd('0xa7')](this,_0x4bf026,_0x4bf026[_0xa3bd('0x1a4')]);this[_0xa3bd('0xe')][_0xa3bd('0xac')](util[_0xa3bd('0x28')](_0xa3bd('0x1a5'),_0xac5a89['name']));this['createSmsMessage'][_0xa3bd('0xa7')](this,_0x23ad9a);return this[_0xa3bd('0xe')][_0xa3bd('0xac')](_0xa3bd('0x1a6'));};AGIVertices['prototype'][_0xa3bd('0x1a7')]=function(_0x3e8338){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')](_0xa3bd('0x1a8'),_0x3e8338['label']));if(!this['isConfigured'](_0x3e8338[_0xa3bd('0x117')])){return this[_0xa3bd('0xe')][_0xa3bd('0x30')](_0x3e8338,_0xa3bd('0x1a9'));}var _0x6fbacb=this['getVariable'][_0xa3bd('0xa7')](this,_0x3e8338[_0xa3bd('0x117')]);if(!_0x6fbacb){return this[_0xa3bd('0xe')][_0xa3bd('0x30')](_0x3e8338,'no\x20variable\x20found');}return this[_0xa3bd('0xe')][_0xa3bd('0x9f')](_0x6fbacb,_0x3e8338['variable_value']);};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x1aa')]=function(_0xb528c3){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')](_0xa3bd('0x1ab'),_0xb528c3[_0xa3bd('0xaa')]));this[_0xa3bd('0xe')][_0xa3bd('0xac')](_0xa3bd('0x1ac'));if(_0xb528c3[_0xa3bd('0xbe')]==='yes'){this['channel'][_0xa3bd('0xac')](_0xa3bd('0x1ad'));return this[_0xa3bd('0xe')]['answer']();}return this[_0xa3bd('0xe')][_0xa3bd('0xac')](_0xa3bd('0x1ae'));};AGIVertices[_0xa3bd('0x16')]['subproject']=function(_0x2129f0){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')](_0xa3bd('0x1af'),_0x2129f0[_0xa3bd('0xaa')]));if(!this['isConfigured'](_0x2129f0['project_id'])){return this[_0xa3bd('0xe')]['error'](_0x2129f0,_0xa3bd('0x1b0'));}var _0x2b457e=this['getSquareProject'][_0xa3bd('0xa7')](this,_0x2129f0['project_id']);if(!this[_0xa3bd('0xab')](_0x2b457e)){return this[_0xa3bd('0xe')][_0xa3bd('0x30')](_0x2129f0,util[_0xa3bd('0x28')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x2129f0[_0xa3bd('0x1b1')]));}if(_0x2b457e===this[_0xa3bd('0xe')][_0xa3bd('0x37')]){return this['channel'][_0xa3bd('0x30')](_0x2129f0,_0xa3bd('0x1b2'));}this[_0xa3bd('0x34')]['sync'](this,_0x2129f0,_0x2b457e);var _0x34383b=this['channel']['exec'](_0xa3bd('0x1b3'),util[_0xa3bd('0x28')](_0xa3bd('0x1b4'),config[_0xa3bd('0xb8')][_0xa3bd('0x194')]||_0xa3bd('0x1b5'),_0x2b457e,this[_0xa3bd('0xe')][_0xa3bd('0x37')]));if(_0x34383b['result']===-0x1){return _0x34383b;}return this[_0xa3bd('0xe')][_0xa3bd('0xac')](util[_0xa3bd('0x28')](_0xa3bd('0x175'),_0xa3bd('0x1b3'),_0x2b457e));};AGIVertices[_0xa3bd('0x16')]['system']=function(_0x17b95f){logger['info'](util[_0xa3bd('0x28')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x17b95f[_0xa3bd('0xaa')]));var _0x1a0618=this['shellCommand']['sync'](this,_0x17b95f['command']);this[_0xa3bd('0x34')]['sync'](this,_0x17b95f,_0x17b95f[_0xa3bd('0xb9')]);if(this[_0xa3bd('0xab')](_0x17b95f[_0xa3bd('0x117')])){var _0x578dfa=this[_0xa3bd('0x10')]['sync'](this,_0x17b95f[_0xa3bd('0x117')]);if(_0x578dfa){this[_0xa3bd('0xe')]['setVariable'](_0x578dfa,_0x1a0618);return this[_0xa3bd('0xe')][_0xa3bd('0xac')](util[_0xa3bd('0x28')](_0xa3bd('0x1b6'),_0x17b95f[_0xa3bd('0xb9')],_0x578dfa));}}return this[_0xa3bd('0xe')][_0xa3bd('0xac')](util[_0xa3bd('0x28')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x17b95f['command']));};AGIVertices['prototype'][_0xa3bd('0x1b7')]=function(_0x33584a){logger['info'](util[_0xa3bd('0x28')](_0xa3bd('0x1b8'),_0x33584a[_0xa3bd('0xaa')]));_0x33584a['text']=_0x33584a[_0xa3bd('0x5d')][_0xa3bd('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa3bd('0xab')](_0x33584a[_0xa3bd('0x5b')])){return this['channel']['noop'](_0xa3bd('0x1b9'));}if(!this[_0xa3bd('0xab')](_0x33584a['text'])){return this[_0xa3bd('0xe')][_0xa3bd('0xac')]('no\x20text\x20configured');}this[_0xa3bd('0xe')][_0xa3bd('0xac')](util[_0xa3bd('0x28')](_0xa3bd('0x1ba'),_0x33584a[_0xa3bd('0x5d')]));var _0x16047d=this['googleCloudTTS'][_0xa3bd('0xa7')](this,_0x33584a);if(_0x16047d){this[_0xa3bd('0xe')]['noop'](util['format'](_0xa3bd('0x1bb'),_0x16047d));var _0x1675a1=this['channel'][_0xa3bd('0x127')](_0x16047d);try{fs[_0xa3bd('0x128')](_0x16047d+_0xa3bd('0x104'));}catch(_0x247362){logger[_0xa3bd('0x30')](_0x247362);}return _0x1675a1;}return this[_0xa3bd('0xe')][_0xa3bd('0x30')](_0x33584a,_0xa3bd('0x1bc'));};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x1bd')]=function(_0xd620ee){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')](_0xa3bd('0x1be'),_0xd620ee[_0xa3bd('0xaa')]));_0xd620ee[_0xa3bd('0x5d')]=_0xd620ee['text'][_0xa3bd('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa3bd('0xab')](_0xd620ee[_0xa3bd('0x5d')])){return this['channel'][_0xa3bd('0xac')](_0xa3bd('0xad'));}this[_0xa3bd('0xe')]['noop'](util[_0xa3bd('0x28')](_0xa3bd('0x1bf'),_0xd620ee[_0xa3bd('0x5d')]));var _0x21df04=this[_0xa3bd('0x64')]['sync'](this,_0xd620ee);if(_0x21df04){this[_0xa3bd('0xe')][_0xa3bd('0xac')](util['format'](_0xa3bd('0x1c0'),_0x21df04));var _0x1a16ed=this['channel']['streamFile'](_0x21df04);try{fs[_0xa3bd('0x128')](_0x21df04+'.wav');}catch(_0x1909e7){logger[_0xa3bd('0x30')](_0x1909e7);}return _0x1a16ed;}return this[_0xa3bd('0xe')]['error'](_0xd620ee,_0xa3bd('0x1c1'));};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x1c2')]=function(_0x281c86){logger['info'](util[_0xa3bd('0x28')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x281c86[_0xa3bd('0xaa')]));if(!this[_0xa3bd('0xab')](_0x281c86[_0xa3bd('0x156')])){return this[_0xa3bd('0xe')][_0xa3bd('0x30')](_0x281c86,_0xa3bd('0x157'));}logger['info'](util[_0xa3bd('0x28')](_0xa3bd('0x15c'),this[_0xa3bd('0xe')][_0xa3bd('0x51')],_0x281c86[_0xa3bd('0x156')]));var _0x4bad1f=this['agentUnpause']['sync'](this,_0x281c86[_0xa3bd('0x156')]);if(_0x4bad1f){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')](_0xa3bd('0x158'),this[_0xa3bd('0xe')][_0xa3bd('0x51')],_0x281c86[_0xa3bd('0x156')]));this[_0xa3bd('0xe')][_0xa3bd('0xac')](util[_0xa3bd('0x28')](_0xa3bd('0x158'),this[_0xa3bd('0xe')][_0xa3bd('0x51')],_0x281c86[_0xa3bd('0x156')]));return{'code':0xc8,'result':_0xa3bd('0x159')};}else{logger['info'](util[_0xa3bd('0x28')](_0xa3bd('0x15a'),this[_0xa3bd('0xe')]['callerid'],_0x281c86[_0xa3bd('0x156')]));this[_0xa3bd('0xe')][_0xa3bd('0xac')](util[_0xa3bd('0x28')](_0xa3bd('0x15a'),this[_0xa3bd('0xe')][_0xa3bd('0x51')],_0x281c86[_0xa3bd('0x156')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x1c3')]=function(_0x2ab2bc){logger['info'](util[_0xa3bd('0x28')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x2ab2bc[_0xa3bd('0xaa')]));var _0xe791d8=this[_0xa3bd('0xe')][_0xa3bd('0xc6')](_0xa3bd('0x1c4'),[_0x2ab2bc[_0xa3bd('0x1c5')],_0x2ab2bc[_0xa3bd('0x7b')]]);if(_0xe791d8[_0xa3bd('0xa5')]===-0x1){return _0xe791d8;}return this['channel'][_0xa3bd('0xac')](util['format'](_0xa3bd('0x175'),_0xa3bd('0x1c4'),_0x2ab2bc[_0xa3bd('0x1c5')]));};AGIVertices[_0xa3bd('0x16')][_0xa3bd('0x1c6')]=function(_0x53cb5a){logger[_0xa3bd('0x2c')](util[_0xa3bd('0x28')](_0xa3bd('0x1c7'),_0x53cb5a[_0xa3bd('0xaa')]));if(!this[_0xa3bd('0xab')](_0x53cb5a['variable_id'])){return this[_0xa3bd('0xe')][_0xa3bd('0x30')](_0x53cb5a,'no\x20variable\x20selected');}var _0x41eb10=this[_0xa3bd('0x10')][_0xa3bd('0xa7')](this,_0x53cb5a[_0xa3bd('0x117')]);if(!_0x41eb10){return this['channel'][_0xa3bd('0x30')](_0x53cb5a,_0xa3bd('0xda'));}var _0x47fc3b=this[_0xa3bd('0xe')][_0xa3bd('0x10')](_0x41eb10);return{'code':0xc8,'result':_0x47fc3b[_0xa3bd('0xa2')]?_0x47fc3b[_0xa3bd('0xa2')]:'-'};};String[_0xa3bd('0x16')][_0xa3bd('0xa1')]=function(_0x3d1d42,_0x13d771){return this[_0xa3bd('0xa0')](_0x3d1d42)[_0xa3bd('0x1c8')](_0x13d771);};module['exports']=AGIVertices; \ No newline at end of file +var _0x2e54=['Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','context','extension','priority','accountcode','dnid','file','createCmContact','isEmpty','callback_','random','lastName','isNil','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','internal','LOCAL','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','url','method','timeout','includes','POST','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','uri','render','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','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_voice','aws_text_type','awsLex','aws_bot_name','googleASR','tildeASR','clone','hasOwnProperty','isString','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','replaceObjectAllVariables','replaceAllVariables','split','replaceAll','getAndSetVariable','result','extra','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','callback','delay','add','minutes','sync','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','createSquareMessage','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20is\x20unreachable','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','variable_id','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','streamFile','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','GoogleASR\x20Result\x20%s','tildeasr','appid','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','intKey','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','%s/recordings/%s','recordFile','ispeech\x20%s\x20file\x20created','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','file_id','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','QUEUE','macro','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','restAPI','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','service','host','port','authentication','pass','template_id','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','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','join','exports','path','util','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','./scripts','rawHeaders','rawBody','menu','getsecretdigits','channel','mailRpc','getVariable','rpc','getVariableById','then','name','catch','prototype','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbcById','dsn','getUser','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','getQueryOdbc','error','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s'];(function(_0x127e74,_0x241e1e){var _0x9ca186=function(_0x84398){while(--_0x84398){_0x127e74['push'](_0x127e74['shift']());}};_0x9ca186(++_0x241e1e);}(_0x2e54,0x194));var _0x42e5=function(_0x38d1a5,_0x10402f){_0x38d1a5=_0x38d1a5-0x0;var _0x2e4d92=_0x2e54[_0x38d1a5];return _0x2e4d92;};'use strict';var fs=require('fs');var path=require(_0x42e5('0x0'));var util=require(_0x42e5('0x1'));var _=require('lodash');var sh=require(_0x42e5('0x2'));var odbc=require(_0x42e5('0x3'))();var rs=require(_0x42e5('0x4'));var moment=require(_0x42e5('0x5'));var Mustache=require(_0x42e5('0x6'));var rp=require(_0x42e5('0x7'));var logger=require(_0x42e5('0x8'))(_0x42e5('0x9'));var config=require('../../config/environment');var scripts=require(_0x42e5('0xa'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x42e5('0xb'),_0x42e5('0xc')];var verticesWithRetry=[_0x42e5('0xd'),'getdigits',_0x42e5('0xe')];var AGIVertices=function(_0x2f2792,_0x570fc0,_0x1bfbbf){this[_0x42e5('0xf')]=_0x2f2792;this['rpc']=_0x570fc0;this[_0x42e5('0x10')]=_0x1bfbbf;};AGIVertices['prototype'][_0x42e5('0x11')]=function(_0x59ab19,_0x5e455f){this[_0x42e5('0x12')][_0x42e5('0x13')](_0x59ab19)[_0x42e5('0x14')](function(_0x37b3db){_0x5e455f(null,_0x37b3db?_0x37b3db[_0x42e5('0x15')]:![]);})[_0x42e5('0x16')](function(_0x4bfd67){_0x5e455f(_0x4bfd67);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x18')]=function(_0x39207f,_0x227dea){this[_0x42e5('0x12')][_0x42e5('0x19')](_0x39207f)[_0x42e5('0x14')](function(_0x4cf7cd){_0x227dea(null,_0x4cf7cd?_0x4cf7cd['name']:![]);})[_0x42e5('0x16')](function(_0x4b89eb){_0x227dea(_0x4b89eb);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x1a')]=function(_0x376519,_0x5cc2ce){this['rpc'][_0x42e5('0x1b')](_0x376519)[_0x42e5('0x14')](function(_0x49578e){_0x5cc2ce(null,_0x49578e?_0x49578e[_0x42e5('0x15')]:![]);})['catch'](function(_0x283cd4){_0x5cc2ce(_0x283cd4);});};AGIVertices[_0x42e5('0x17')]['getSquareOdbc']=function(_0x3f6339,_0x2185a5){this[_0x42e5('0x12')][_0x42e5('0x1c')](_0x3f6339)[_0x42e5('0x14')](function(_0x69a594){_0x2185a5(null,_0x69a594?_0x69a594[_0x42e5('0x1d')]:![]);})['catch'](function(_0x283a32){_0x2185a5(_0x283a32);});};AGIVertices['prototype'][_0x42e5('0x1e')]=function(_0x20b216,_0x5c427c){this[_0x42e5('0x12')]['getUserById'](_0x20b216)['then'](function(_0x3abf5a){_0x5c427c(null,_0x3abf5a?_0x3abf5a[_0x42e5('0x15')]:![]);})[_0x42e5('0x16')](function(_0x317c09){_0x5c427c(_0x317c09);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x1f')]=function(_0x4cad60,_0xb96af){this[_0x42e5('0x12')][_0x42e5('0x20')](_0x4cad60)[_0x42e5('0x14')](function(_0x21bcc6){_0xb96af(null,_0x21bcc6?_0x21bcc6[_0x42e5('0x15')]:![]);})['catch'](function(_0x467019){_0xb96af(_0x467019);});};AGIVertices['prototype'][_0x42e5('0x21')]=function(_0xc24ba0,_0x374186){var _0x23b60b=this;this['rpc'][_0x42e5('0x22')](_0xc24ba0)[_0x42e5('0x14')](function(_0x2b40a2){_0x374186(null,_0x2b40a2?_0x23b60b[_0x42e5('0x23')](_0x2b40a2[_0x42e5('0x24')]):![]);})[_0x42e5('0x16')](function(_0xca10af){_0x374186(_0xca10af);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x25')]=function(_0x53c349,_0x4c84a7){this['rpc']['getMailAccountById'](_0x53c349)[_0x42e5('0x14')](function(_0x4b4dfa){_0x4c84a7(null,_0x4b4dfa?_0x4b4dfa:![]);})[_0x42e5('0x16')](function(_0x150da2){_0x4c84a7(_0x150da2);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x26')]=function(_0x34f65c,_0x5761ba,_0x1b4348){this[_0x42e5('0x10')]['sendMailMessage'](_0x34f65c,_0x5761ba)[_0x42e5('0x14')](function(){_0x1b4348(null);})[_0x42e5('0x16')](function(_0x5f178b){_0x1b4348(_0x5f178b);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x27')]=function(_0x419598,_0x39e9b3){this['rpc'][_0x42e5('0x28')](_0x419598)[_0x42e5('0x14')](function(_0x4cedb6){if(_0x4cedb6){if(_0x4cedb6[_0x42e5('0x29')]){_0x39e9b3(null,[_0x4cedb6[_0x42e5('0x2a')]]);}else{_0x39e9b3(null,_[_0x42e5('0x2b')](_0x4cedb6[_0x42e5('0x2c')],_0x42e5('0x2a')));}}else{_0x39e9b3(null,![]);}})['catch'](function(_0x5cc409){_0x39e9b3(_0x5cc409);});};AGIVertices['prototype'][_0x42e5('0x23')]=function(_0x469915){return util[_0x42e5('0x2d')]('%s/sounds/converted/%s',FILES_PATH,_0x469915);};AGIVertices['prototype'][_0x42e5('0x2e')]=function(_0x5bbe7c,_0x33eb95,_0xa8b42a){odbc['open'](_0x5bbe7c,function(_0x4353d2){if(_0x4353d2){logger[_0x42e5('0x2f')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x4353d2);_0xa8b42a(_0x4353d2);}else{logger[_0x42e5('0x30')](_0x42e5('0x31'));odbc[_0x42e5('0x32')](_0x33eb95,function(_0x4e3431,_0x131795){if(_0x4e3431){logger[_0x42e5('0x30')](_0x42e5('0x33'),_0x33eb95);_0xa8b42a(_0x4e3431);}else{logger['info'](_0x42e5('0x34'),_0x33eb95);odbc[_0x42e5('0x35')](function(_0x4d0f40){if(_0x4d0f40){logger[_0x42e5('0x2f')](_0x42e5('0x36'),_0x4d0f40);}_0xa8b42a(null,_0x131795);});}});}});};AGIVertices[_0x42e5('0x17')]['getSmsAccount']=function(_0x12fca7,_0xbb961b){this['rpc'][_0x42e5('0x37')](_0x12fca7)[_0x42e5('0x14')](function(_0x22b0b4){_0xbb961b(null,_0x22b0b4?_0x22b0b4:![]);})[_0x42e5('0x16')](function(_0x49263b){_0xbb961b(_0x49263b);});};AGIVertices['prototype'][_0x42e5('0x38')]=function(_0x4cdc7c,_0x14b950){this['rpc'][_0x42e5('0x38')](_0x4cdc7c)['then'](function(_0x5bd760){_0x14b950(null,_0x5bd760);})[_0x42e5('0x16')](function(_0x3ba7ef){_0x14b950(_0x3ba7ef);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x39')]=function(_0x58f8e0,_0x1ea6f2,_0x4892aa){this[_0x42e5('0x12')][_0x42e5('0x39')]({'uniqueid':this[_0x42e5('0xf')][_0x42e5('0x3a')],'node':_0x58f8e0[_0x42e5('0x3b')],'application':_0x58f8e0[_0x42e5('0x3c')],'data':_0x1ea6f2||null,'project_name':this[_0x42e5('0xf')][_0x42e5('0x3d')],'callerid':this[_0x42e5('0xf')][_0x42e5('0x3e')]})['then'](function(_0x442da1){if(_0x4892aa){_0x4892aa(null,_0x442da1);}})[_0x42e5('0x16')](function(_0x5300e0){if(_0x4892aa){_0x4892aa(_0x5300e0);}});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x3f')]=function(_0x5101b8,_0x443a72,_0x985197,_0x228e30){this[_0x42e5('0x12')][_0x42e5('0x3f')]({'uniqueid':this[_0x42e5('0xf')][_0x42e5('0x3a')],'callerid':this[_0x42e5('0xf')][_0x42e5('0x3e')],'calleridname':this[_0x42e5('0xf')]['calleridname'],'context':this[_0x42e5('0xf')][_0x42e5('0x40')],'extension':this['channel'][_0x42e5('0x41')],'priority':this['channel'][_0x42e5('0x42')],'accountcode':this[_0x42e5('0xf')][_0x42e5('0x43')],'dnid':this['channel'][_0x42e5('0x44')],'projectName':this['channel']['arg_1'],'saveName':_0x443a72,'filename':_0x5101b8[_0x42e5('0x45')]||_0x443a72,'savePath':_0x985197})[_0x42e5('0x14')](function(_0x114253){_0x228e30(null,_0x114253);})[_0x42e5('0x16')](function(_0x15ebb6){_0x228e30(_0x15ebb6);});};AGIVertices[_0x42e5('0x17')]['createSquareMessage']=function(_0xf6fa09,_0x2cad69,_0x19663c,_0x5cae7e,_0x33b405){this['rpc']['createSquareMessage']({'uniqueid':this['channel'][_0x42e5('0x3a')],'body':_0xf6fa09,'direction':_0x2cad69,'providerName':_0x19663c,'providerResponse':_0x5cae7e})[_0x42e5('0x14')](function(_0x46b4ee){if(_0x33b405){_0x33b405(null,_0x46b4ee);}})[_0x42e5('0x16')](function(_0xd323f5){if(_0x33b405){_0x33b405(_0xd323f5);}});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x46')]=function(_0x5cecfc,_0x1a8383){this[_0x42e5('0x12')][_0x42e5('0x46')]({'firstName':_[_0x42e5('0x47')](_0x5cecfc['name'])||_['isNil'](_0x5cecfc[_0x42e5('0x15')])?_0x42e5('0x48')+Math[_0x42e5('0x49')]():_0x5cecfc[_0x42e5('0x15')],'lastName':_['isEmpty'](_0x5cecfc[_0x42e5('0x4a')])||_[_0x42e5('0x4b')](_0x5cecfc[_0x42e5('0x4a')])?null:_0x5cecfc['lastName'],'phone':_0x5cecfc[_0x42e5('0x4c')],'ListId':_0x5cecfc[_0x42e5('0x4d')],'scheduledat':_0x5cecfc[_0x42e5('0x4e')],'callbackUniqueid':this[_0x42e5('0xf')][_0x42e5('0x3a')],'tags':'callback','description':_0x42e5('0x4f')+_0x5cecfc['scheduledAt'][_0x42e5('0x50')](),'priority':_0x5cecfc[_0x42e5('0x51')]})[_0x42e5('0x14')](function(_0x990f4f){_0x1a8383(null,_0x990f4f);})[_0x42e5('0x16')](function(_0x427958){_0x1a8383(_0x427958);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x52')]=function(_0xe4044b,_0x4c096c){this[_0x42e5('0x12')][_0x42e5('0x53')](_0xe4044b)[_0x42e5('0x14')](function(_0x172cb4){_0x4c096c(null,_0x172cb4?_0x172cb4[_0x42e5('0x15')]:![]);})[_0x42e5('0x16')](function(_0x491a47){_0x4c096c(_0x491a47);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x54')]=function(_0x8a2a00,_0x3bc7b0,_0x33bef5){var _0x22ddda={'role':_0x42e5('0x55')};_0x22ddda[_0x8a2a00]=this[_0x42e5('0xf')][_0x42e5('0x3e')];this[_0x42e5('0x12')][_0x42e5('0x54')](_0x22ddda,_0x3bc7b0,this[_0x42e5('0xf')]['uniqueid'])[_0x42e5('0x14')](function(_0x5d16a0){_0x33bef5(null,_[_0x42e5('0x4b')](_0x5d16a0)?![]:!![]);})[_0x42e5('0x16')](function(_0x5097e7){logger[_0x42e5('0x2f')](_0x5097e7);_0x33bef5(null,![]);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x56')]=function(_0x4c6da6,_0x18e744){var _0x575fe9={'role':_0x42e5('0x55')};_0x575fe9[_0x4c6da6]=this[_0x42e5('0xf')][_0x42e5('0x3e')];this[_0x42e5('0x12')][_0x42e5('0x56')](_0x575fe9)[_0x42e5('0x14')](function(_0x6fd6f5){_0x18e744(null,_['isNil'](_0x6fd6f5)?![]:!![]);})[_0x42e5('0x16')](function(_0x2fff29){logger['error'](_0x2fff29);_0x18e744(null,![]);});};AGIVertices['prototype'][_0x42e5('0x57')]=function(_0x4b96e4,_0x2b50e0){var _0x52b142={'role':'agent'};_0x52b142[_0x4b96e4]=this['channel'][_0x42e5('0x3e')];this[_0x42e5('0x12')][_0x42e5('0x57')](_0x52b142)[_0x42e5('0x14')](function(_0x44b741){_0x2b50e0(null,_[_0x42e5('0x4b')](_0x44b741)?![]:!![]);})['catch'](function(_0xb48140){logger[_0x42e5('0x2f')](_0xb48140);_0x2b50e0(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x3bc923,_0x21cdd8){var _0x3d4401={'role':_0x42e5('0x55')};_0x3d4401[_0x3bc923]=this[_0x42e5('0xf')]['callerid'];var _0xd6b6f8=_0x3bc923!=_0x42e5('0x58')?util[_0x42e5('0x2d')]('%s/%s@from-sip/n',_0x42e5('0x59'),this['channel'][_0x42e5('0x3e')]):undefined;this[_0x42e5('0x12')][_0x42e5('0x5a')](_0x3d4401,_0xd6b6f8)[_0x42e5('0x14')](function(_0x2340fb){_0x21cdd8(null,_[_0x42e5('0x4b')](_0x2340fb)?![]:!![]);})['catch'](function(_0x6a5ba9){logger['error'](_0x6a5ba9);_0x21cdd8(null,![]);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x5b')]=function(_0x5b7182,_0x1b126f){sh[_0x42e5('0x5c')](_[_0x42e5('0x5d')](_0x5b7182),function(_0x2a1e71,_0x2dabe7){var _0xeba431=_0x2dabe7[_0x42e5('0x5e')](/(\r\n|\n|\r)/gm,'');_0x1b126f(null,_0xeba431);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x5f')]=function(_0x46f462,_0x354c13){scripts[_0x42e5('0x5f')](_0x46f462[_0x42e5('0x60')],_0x46f462[_0x42e5('0x61')]||_0x42e5('0x62'),_0x46f462[_0x42e5('0x62')],_0x46f462['languageCode']||_0x42e5('0x63'),_0x46f462[_0x42e5('0x64')]||_0x42e5('0x65'),_0x46f462[_0x42e5('0x66')]||_0x42e5('0x67'))['then'](function(_0x1c5b46){_0x354c13(null,_0x1c5b46);})[_0x42e5('0x16')](function(_0x53037d){_0x354c13(_0x53037d);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x68')]=function(_0x2e1ef9,_0x5515b7){scripts[_0x42e5('0x68')](_0x2e1ef9['text'],_0x2e1ef9[_0x42e5('0x69')]||'en',0x1)['then'](function(_0x259e05){_0x5515b7(null,_0x259e05);})[_0x42e5('0x16')](function(_0x430436){_0x5515b7(_0x430436);});};AGIVertices['prototype']['restAPI']=function(_0x20fc33,_0x2eb2d8){var _0x37fd62={'uri':_0x20fc33[_0x42e5('0x6a')],'method':_0x20fc33[_0x42e5('0x6b')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x20fc33[_0x42e5('0x6c')])==='number'&&parseInt(_0x20fc33[_0x42e5('0x6c')])>=0x1?parseInt(_0x20fc33[_0x42e5('0x6c')])*0x3e8:0x5*0x3e8};if(_[_0x42e5('0x6d')]([_0x42e5('0x6e'),_0x42e5('0x6f')],_0x37fd62[_0x42e5('0x6b')][_0x42e5('0x70')]())){try{_0x37fd62[_0x42e5('0x71')]=_0x20fc33[_0x42e5('0xc')]?JSON[_0x42e5('0x72')](_0x20fc33[_0x42e5('0xc')]):{};}catch(_0x419f98){logger[_0x42e5('0x2f')](_0x42e5('0x73'),_0x419f98);}}try{_0x37fd62[_0x42e5('0x74')]=_0x20fc33[_0x42e5('0xb')]?JSON[_0x42e5('0x72')](_0x20fc33[_0x42e5('0xb')]):{};}catch(_0x79ae4a){logger['error'](_0x42e5('0x75'),_0x79ae4a);}if(_0x20fc33['computedVariables']){try{var _0x2e6b25=require(_0x20fc33['computedVariables'])['sync'](this,_0x37fd62);_0x37fd62[_0x42e5('0x76')]=Mustache['render'](_0x20fc33[_0x42e5('0x6a')],_0x2e6b25,{},['$$','$$']);if(_0x37fd62[_0x42e5('0x74')]){_0x37fd62[_0x42e5('0x74')]=JSON['parse'](Mustache[_0x42e5('0x77')](JSON['stringify'](_0x37fd62[_0x42e5('0x74')]),_0x2e6b25,{},['$$','$$']));}if(_0x37fd62[_0x42e5('0x71')]){_0x37fd62[_0x42e5('0x71')]=JSON[_0x42e5('0x72')](Mustache[_0x42e5('0x77')](JSON[_0x42e5('0x78')](_0x37fd62[_0x42e5('0x71')]),_0x2e6b25,{},['$$','$$']));}}catch(_0x2aba45){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x2aba45);}}rp(_0x37fd62)[_0x42e5('0x14')](function(_0xdef73b){var _0x4f2125={'statusCode':_0xdef73b[_0x42e5('0x79')]||0xc8,'statusMessage':_0xdef73b[_0x42e5('0x7a')]||'OK','headers':_0xdef73b[_0x42e5('0x74')]||{},'body':_0xdef73b['body']||{}};_0x2eb2d8(null,_0x4f2125);})[_0x42e5('0x16')](function(_0x265e41){var _0x472a2b={'statusCode':_0x265e41[_0x42e5('0x79')]||0x1f4,'statusMessage':_0x265e41[_0x42e5('0x7b')]||_0x42e5('0x7c'),'headers':_0x265e41[_0x42e5('0x7d')][_0x42e5('0x74')]||{},'body':_0x265e41['options']['body']||{}};_0x2eb2d8(null,_0x472a2b);});};AGIVertices['prototype']['googleDialogflow']=function(_0x444ba7,_0x1a7605){scripts[_0x42e5('0x7e')](this['channel'][_0x42e5('0x3a')],_0x444ba7['key'],_0x444ba7['text'],_0x444ba7['dialogflow_language']||'en')[_0x42e5('0x14')](function(_0xe5ac2d){_0x1a7605(null,_0xe5ac2d);})[_0x42e5('0x16')](function(_0x58e572){_0x1a7605(_0x58e572);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x7f')]=function(_0x26d5dd,_0x4e32ae){scripts[_0x42e5('0x7f')](this['channel'][_0x42e5('0x3a')],_0x26d5dd[_0x42e5('0x80')],_0x26d5dd[_0x42e5('0x81')],_0x26d5dd[_0x42e5('0x82')],_0x26d5dd[_0x42e5('0x62')],_0x26d5dd[_0x42e5('0x83')]||'en')[_0x42e5('0x14')](function(_0xc88258){_0x4e32ae(null,_0xc88258);})[_0x42e5('0x16')](function(_0x352693){_0x4e32ae(_0x352693);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x84')]=function(_0x4d57f8,_0x4e129e){scripts[_0x42e5('0x84')](this[_0x42e5('0xf')],_0x4d57f8)[_0x42e5('0x14')](function(_0x4fe47e){_0x4e129e(null,_0x4fe47e);})[_0x42e5('0x16')](function(_0x4241c9){_0x4e129e(_0x4241c9);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x85')]=function(_0xcfee0b,_0x468054){scripts[_0x42e5('0x85')](_0xcfee0b[_0x42e5('0x86')],_0xcfee0b['text'],_0xcfee0b[_0x42e5('0x87')]||_0x42e5('0x63'),_0xcfee0b[_0x42e5('0x88')])[_0x42e5('0x14')](function(_0x2d20ae){_0x468054(null,_0x2d20ae);})['catch'](function(_0x4286f0){_0x468054(_0x4286f0);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x89')]=function(_0x139b98,_0x4c7154,_0x8bda98){scripts[_0x42e5('0x89')](_0x4c7154,_0x139b98[_0x42e5('0x86')],_0x139b98[_0x42e5('0x8a')]||_0x42e5('0x63'),this[_0x42e5('0x8b')](_0x139b98[_0x42e5('0x8c')])?_0x139b98['model']:undefined)['then'](function(_0x5e9638){_0x8bda98(null,_0x5e9638);})[_0x42e5('0x16')](function(_0x490408){_0x8bda98(_0x490408);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x8d')]=function(_0x1c0921,_0x4a57aa){scripts['awsPolly'](_0x1c0921[_0x42e5('0x8e')],_0x1c0921[_0x42e5('0x8f')],_0x1c0921['aws_polly_region'],_0x1c0921[_0x42e5('0x90')]||'Amy',_0x1c0921[_0x42e5('0x62')],_0x1c0921[_0x42e5('0x91')]||_0x42e5('0x62'))[_0x42e5('0x14')](function(_0x23c4cb){_0x4a57aa(null,_0x23c4cb);})['catch'](function(_0x5d1905){_0x4a57aa(_0x5d1905);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x92')]=function(_0x3cd210,_0x3bfc42){scripts[_0x42e5('0x92')](this[_0x42e5('0xf')][_0x42e5('0x3a')],_0x3cd210['aws_access_key_id'],_0x3cd210[_0x42e5('0x8f')],_0x3cd210['aws_lex_region'],_0x3cd210[_0x42e5('0x62')],_0x3cd210[_0x42e5('0x93')])['then'](function(_0x44bb48){_0x3bfc42(null,_0x44bb48);})[_0x42e5('0x16')](function(_0x204b8b){_0x3bfc42(_0x204b8b);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x94')]=function(_0xade95a,_0x15dd54,_0x49753f){scripts['googleASR'](_0x15dd54,_0xade95a[_0x42e5('0x86')],_0xade95a['google_asr_language']||_0x42e5('0x63'))[_0x42e5('0x14')](function(_0x4aaaf2){_0x49753f(null,_0x4aaaf2);})[_0x42e5('0x16')](function(_0x667f3a){_0x49753f(_0x667f3a);});};AGIVertices[_0x42e5('0x17')][_0x42e5('0x95')]=function(_0x29c655,_0x1d32e4,_0xa3e98e){scripts[_0x42e5('0x95')](_0x1d32e4,_0x29c655['appid'],_0x29c655['appsecret'],_0x29c655[_0x42e5('0x76')])[_0x42e5('0x14')](function(_0x1bc5ea){_0xa3e98e(null,_0x1bc5ea);})[_0x42e5('0x16')](function(_0x4bf123){_0xa3e98e(_0x4bf123);});};AGIVertices['prototype']['clear']=function(_0x379ce7){var _0xd79d2d=_[_0x42e5('0x6d')](verticesWithRetry,_0x379ce7[_0x42e5('0x3c')])?_0x379ce7:_[_0x42e5('0x96')](_0x379ce7);for(var _0x1c929e in _0xd79d2d){if(_0xd79d2d[_0x42e5('0x97')](_0x1c929e)){if(_0xd79d2d[_0x1c929e]&&_[_0x42e5('0x98')](_0xd79d2d[_0x1c929e])){if(_[_0x42e5('0x6d')](recursiveMapAttributes,_0x1c929e)){_0xd79d2d[_0x1c929e]=this['replaceObjectAllVariables'](_0xd79d2d[_0x1c929e]);}else{_0xd79d2d[_0x1c929e]=this['replaceAllVariables'](_0xd79d2d[_0x1c929e]);}}}}return _0xd79d2d;};AGIVertices['prototype'][_0x42e5('0x99')]=function(_0x2167fc){for(var _0x1e8508 in _0x2167fc){if(_0x2167fc['hasOwnProperty'](_0x1e8508)){if(_[_0x42e5('0x9a')](_0x2167fc[_0x1e8508])){this[_0x42e5('0x99')](_0x2167fc[_0x1e8508]);}else if(_[_0x42e5('0x9b')](_0x2167fc[_0x1e8508])){for(var _0x5baed1=0x0;_0x5baed1<_0x2167fc[_0x1e8508][_0x42e5('0x9c')];_0x5baed1++){this[_0x42e5('0x99')](_0x2167fc[_0x1e8508][_0x5baed1]);}}else if(_[_0x42e5('0x98')](_0x2167fc[_0x1e8508])){_0x2167fc[_0x1e8508]=this['replaceAllVariables'](_0x2167fc[_0x1e8508]);}}}};AGIVertices[_0x42e5('0x17')][_0x42e5('0x9d')]=function(_0x3447a5,_0x37a10c){for(var _0x255fe2 in _0x3447a5){if(_0x3447a5[_0x42e5('0x97')](_0x255fe2)){if(_[_0x42e5('0x9a')](_0x3447a5[_0x255fe2])){if(!_[_0x42e5('0x47')](_0x3447a5[_0x255fe2])){this[_0x42e5('0x9d')](_0x3447a5[_0x255fe2],util['format']('%s.%s',_0x37a10c,_0x255fe2));}}else if(_[_0x42e5('0x9b')](_0x3447a5[_0x255fe2])){for(var _0x48bae1=0x0;_0x48bae1<_0x3447a5[_0x255fe2]['length'];_0x48bae1++){this['saveRestApiResult'](_0x3447a5[_0x255fe2][_0x48bae1],util[_0x42e5('0x2d')](_0x42e5('0x9e'),_0x37a10c,_0x255fe2+'['+_0x48bae1+']'));}}else{if(!_[_0x42e5('0x4b')](_0x3447a5[_0x255fe2])){this[_0x42e5('0xf')][_0x42e5('0x9f')](util[_0x42e5('0x2d')](_0x42e5('0x9e'),_0x37a10c,_0x255fe2),_0x3447a5[_0x255fe2]);}}}}};AGIVertices[_0x42e5('0x17')][_0x42e5('0xa0')]=function(_0x4c6337){try{var _0x4fa665=JSON[_0x42e5('0x72')](_0x4c6337);this[_0x42e5('0x99')](_0x4fa665);return JSON['stringify'](_0x4fa665);}catch(_0x2de54e){return this[_0x42e5('0xa1')](_0x4c6337);}};AGIVertices[_0x42e5('0x17')]['replaceAllVariables']=function(_0x2bdea2){var _0x492169=_0x2bdea2[_0x42e5('0xa2')]('{');for(var _0x5adc55=0x1;_0x5adc55<_0x492169[_0x42e5('0x9c')];_0x5adc55+=0x1){var _0x4e1a2b=_0x492169[_0x5adc55][_0x42e5('0xa2')]('}');if(_0x4e1a2b[_0x42e5('0x9c')]>0x1){_0x2bdea2=_0x2bdea2[_0x42e5('0xa3')]('{'+_0x4e1a2b[0x0]+'}',this[_0x42e5('0xf')][_0x42e5('0x11')](_0x4e1a2b[0x0])['extra']||_0x4e1a2b[0x0]);}}if(_0x492169['length']===0x1){return _0x2bdea2[_0x42e5('0x50')]();}return this[_0x42e5('0xa1')](_0x2bdea2);};AGIVertices[_0x42e5('0x17')][_0x42e5('0xa4')]=function(_0x4cfe57,_0x2a274c){var _0x56f3fd=this[_0x42e5('0xf')][_0x42e5('0x11')](_0x4cfe57);if(_0x56f3fd[_0x42e5('0xa5')]===-0x1){return _0x56f3fd;}logger[_0x42e5('0x30')](util[_0x42e5('0x2d')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x2a274c,_0x56f3fd[_0x42e5('0xa6')]));return this[_0x42e5('0xf')][_0x42e5('0x9f')](_0x2a274c,_0x56f3fd['extra']);};AGIVertices[_0x42e5('0x17')][_0x42e5('0x8b')]=function(_0x249b32){return _0x249b32&&_0x249b32!=='0'&&_0x249b32!=='-1'&&_0x249b32!=='';};AGIVertices['prototype'][_0x42e5('0xa7')]=function(_0x18e89c){this[_0x42e5('0x39')]['sync'](this,_0x18e89c,'-');_0x18e89c['retry']=_0x18e89c[_0x42e5('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x42e5('0x17')][_0x42e5('0xa8')]=function(_0xb7eab4){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0xa9'),_0xb7eab4[_0x42e5('0x3b')]));if(!this['isConfigured'](_0xb7eab4[_0x42e5('0x62')])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0xab'));}var _0x2d67b9='\x22'+_0xb7eab4[_0x42e5('0x62')]+'\x22';if(this['isConfigured'](_0xb7eab4[_0x42e5('0x7d')])){_0x2d67b9+=','+_0xb7eab4[_0x42e5('0x7d')];}var _0x206cbe=this[_0x42e5('0xf')]['exec'](_0x42e5('0xac'),_0x2d67b9);if(_0x206cbe[_0x42e5('0xa5')]===-0x1){return _0x206cbe;}return this['channel'][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0xad'),_0x2d67b9));};AGIVertices[_0x42e5('0x17')][_0x42e5('0xae')]=function(_0x2371a0){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0xaf'),_0x2371a0['label']));if(!this['isConfigured'](_0x2371a0[_0x42e5('0xb0')])){return this[_0x42e5('0xf')]['noop'](_0x42e5('0xb1'));}var _0x283f09=_0x2371a0[_0x42e5('0xb0')];if(this[_0x42e5('0x8b')](_0x2371a0['options'])){_0x283f09+=','+_0x2371a0['options'];}var _0x2346cd=this[_0x42e5('0xf')][_0x42e5('0x5c')](_0x42e5('0xb2'),_0x283f09);if(_0x2346cd[_0x42e5('0xa5')]===-0x1){return _0x2346cd;}var _0x17bdec=this[_0x42e5('0xa4')](_0x42e5('0xb3'),_0x42e5('0xb4'));if(_0x17bdec[_0x42e5('0xa5')]===-0x1){return _0x17bdec;}var _0x4479fc=this[_0x42e5('0xa4')]('RECOG_INPUT()',_0x42e5('0xb5'));if(_0x4479fc[_0x42e5('0xa5')]===-0x1){return _0x4479fc;}var _0x21790e=this[_0x42e5('0xa4')](_0x42e5('0xb6'),'MRCP_RECOG_INSTANCE');if(_0x21790e['result']===-0x1){return _0x21790e;}return this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0xb7'),_0x283f09));};AGIVertices[_0x42e5('0x17')]['agi']=function(_0x1b267c){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0xb8'),_0x1b267c[_0x42e5('0x3b')]));return this[_0x42e5('0xf')][_0x42e5('0x9')]([_0x1b267c[_0x42e5('0xb9')],_0x1b267c[_0x42e5('0xba')]]);};AGIVertices['prototype'][_0x42e5('0xbb')]=function(_0x339c0e){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0xbc'),_0x339c0e[_0x42e5('0x3b')]));if(this[_0x42e5('0x8b')](_0x339c0e[_0x42e5('0x6c')])){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0xbd'),_0x339c0e[_0x42e5('0x6c')]));var _0x48ffc3=this[_0x42e5('0xf')]['wait'](_0x339c0e[_0x42e5('0x6c')]);if(_0x48ffc3['result']===-0x1){return _0x48ffc3;}}return this[_0x42e5('0xf')][_0x42e5('0xbb')]();};AGIVertices[_0x42e5('0x17')][_0x42e5('0xbe')]=function(_0xdb28e4){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0xdb28e4[_0x42e5('0x3b')]));if(!this['isConfigured'](_0xdb28e4['list_id'])){return this[_0x42e5('0xf')]['error'](_0xdb28e4,'no\x20list\x20selected');}_0xdb28e4[_0x42e5('0x4e')]=moment();if(this['isConfigured'](_0xdb28e4[_0x42e5('0xbf')])){_0xdb28e4[_0x42e5('0x4e')]=moment()[_0x42e5('0xc0')](_0xdb28e4[_0x42e5('0xbf')],_0x42e5('0xc1'));}if(!this[_0x42e5('0x8b')](_0xdb28e4[_0x42e5('0x51')])){_0xdb28e4[_0x42e5('0x51')]=0x2;}this['createCmContact'][_0x42e5('0xc2')](this,_0xdb28e4);return this[_0x42e5('0xf')][_0x42e5('0xaa')](util['format'](_0x42e5('0xc3'),_0xdb28e4[_0x42e5('0x4c')],_0xdb28e4[_0x42e5('0x4d')],_0xdb28e4[_0x42e5('0x4e')]));};AGIVertices[_0x42e5('0x17')][_0x42e5('0xc4')]=function(_0xadf4c){logger['info'](util['format'](_0x42e5('0xc5'),_0xadf4c[_0x42e5('0x3b')]));var _0x2bf5e3=this[_0x42e5('0xf')][_0x42e5('0x5c')](_0xadf4c['application'],_0xadf4c['options']);if(_0x2bf5e3[_0x42e5('0xa5')]===-0x1){return _0x2bf5e3;}return this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0xc6'),_0xadf4c[_0x42e5('0xc7')],_0xadf4c['options']));};AGIVertices[_0x42e5('0x17')][_0x42e5('0xc8')]=function(_0x23ce2a){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x23ce2a[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x23ce2a['text'])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0xab'));}var _0x581986='\x22'+_0x23ce2a[_0x42e5('0x62')]+'\x22';if(this[_0x42e5('0x8b')](_0x23ce2a['options'])){_0x581986+=','+_0x23ce2a[_0x42e5('0x7d')];}var _0xb49a33=this['channel'][_0x42e5('0x5c')](_0x42e5('0xac'),_0x581986);if(_0xb49a33[_0x42e5('0xa5')]===-0x1){return _0xb49a33;}return this[_0x42e5('0xf')][_0x42e5('0xaa')](util['format'](_0x42e5('0xad'),_0x581986));};AGIVertices[_0x42e5('0x17')]['sestektts']=function(_0x5799e2){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x5799e2[_0x42e5('0x3b')]));if(!this['isConfigured'](_0x5799e2[_0x42e5('0x62')])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0xab'));}var _0x5c3ab0='\x22'+_0x5799e2[_0x42e5('0x62')]+'\x22';if(this[_0x42e5('0x8b')](_0x5799e2[_0x42e5('0x7d')])){_0x5c3ab0+=','+_0x5799e2[_0x42e5('0x7d')];}var _0x18423d=this['channel'][_0x42e5('0x5c')](_0x42e5('0xac'),_0x5c3ab0);if(_0x18423d[_0x42e5('0xa5')]===-0x1){return _0x18423d;}return this[_0x42e5('0xf')][_0x42e5('0xaa')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x5c3ab0));};AGIVertices[_0x42e5('0x17')]['lumenvoxasr']=function(_0x505356){logger[_0x42e5('0x30')](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x505356[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x505356[_0x42e5('0xb0')])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0xb1'));}var _0x27aae3=_0x505356['grammar'];if(this[_0x42e5('0x8b')](_0x505356['options'])){_0x27aae3+=','+_0x505356[_0x42e5('0x7d')];}var _0x33241a=this[_0x42e5('0xf')][_0x42e5('0x5c')]('MRCPRecog',_0x27aae3);if(_0x33241a[_0x42e5('0xa5')]===-0x1){return _0x33241a;}var _0x5a97e2=this[_0x42e5('0xa4')](_0x42e5('0xb3'),_0x42e5('0xc9'));if(_0x5a97e2[_0x42e5('0xa5')]===-0x1){return _0x5a97e2;}var _0x14abfa=this[_0x42e5('0xa4')](_0x42e5('0xca'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x14abfa[_0x42e5('0xa5')]===-0x1){return _0x14abfa;}var _0x56fcf0=this[_0x42e5('0xa4')](_0x42e5('0xb6'),_0x42e5('0xcb'));if(_0x56fcf0[_0x42e5('0xa5')]===-0x1){return _0x56fcf0;}return this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0xb7'),_0x27aae3));};AGIVertices[_0x42e5('0x17')][_0x42e5('0xcc')]=function(_0x356938){logger['info'](util[_0x42e5('0x2d')](_0x42e5('0xcd'),_0x356938['label']));if(!this[_0x42e5('0x8b')](_0x356938[_0x42e5('0xb0')])){return this['channel']['noop'](_0x42e5('0xb1'));}var _0x4178da=_0x356938[_0x42e5('0xb0')];if(this[_0x42e5('0x8b')](_0x356938[_0x42e5('0x7d')])){_0x4178da+=','+_0x356938[_0x42e5('0x7d')];}var _0x53a4a4=this['channel'][_0x42e5('0x5c')]('MRCPRecog',_0x4178da);if(_0x53a4a4[_0x42e5('0xa5')]===-0x1){return _0x53a4a4;}var _0x74e0ee=this[_0x42e5('0xa4')](_0x42e5('0xb3'),_0x42e5('0xce'));if(_0x74e0ee[_0x42e5('0xa5')]===-0x1){return _0x74e0ee;}var _0x1477d1=this[_0x42e5('0xa4')](_0x42e5('0xca'),_0x42e5('0xcf'));if(_0x1477d1[_0x42e5('0xa5')]===-0x1){return _0x1477d1;}var _0x58daf9=this['getAndSetVariable'](_0x42e5('0xb6'),_0x42e5('0xd0'));if(_0x58daf9[_0x42e5('0xa5')]===-0x1){return _0x58daf9;}return this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0xb7'),_0x4178da));};AGIVertices['prototype'][_0x42e5('0xd1')]=function(_0xa13dc2){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0xd2'),_0xa13dc2[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0xa13dc2[_0x42e5('0xd3')])){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0xa13dc2,_0x42e5('0xd4'));}var _0x22adec=this[_0x42e5('0xd5')][_0x42e5('0xc2')](this,_0xa13dc2['odbc_id']);if(!_0x22adec){return this['channel']['error'](_0xa13dc2,_0x42e5('0xd6'));}if(!this[_0x42e5('0x8b')](_0xa13dc2[_0x42e5('0x32')])){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0xa13dc2,_0x42e5('0xd7'));}var _0x1e44a5=_0xa13dc2[_0x42e5('0x32')][_0x42e5('0x5e')](/(\r\n|\n|\r)/gm,'\x20');this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0xd8'),_0x1e44a5));var _0x566a7e=this[_0x42e5('0x2e')]['sync'](this,_0x22adec,_0x1e44a5);this['createSquareDetailsReport'][_0x42e5('0xc2')](this,_0xa13dc2,_0x1e44a5);if(!this['isConfigured'](_0xa13dc2['variable_id'])){return this['channel'][_0x42e5('0xaa')](_0x42e5('0xd9'));}var _0x5cf1f3=this[_0x42e5('0x11')][_0x42e5('0xc2')](this,_0xa13dc2['variable_id']);if(!_0x5cf1f3){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0xa13dc2,_0x42e5('0xda'));}var _0x49bf67=this;_0x566a7e[_0x42e5('0xdb')](function(_0x5030f8,_0x4835c6){Object[_0x42e5('0xdc')](_0x5030f8)[_0x42e5('0xdb')](function(_0x16bf58){_0x49bf67[_0x42e5('0xf')][_0x42e5('0x9f')](util[_0x42e5('0x2d')](_0x42e5('0xdd'),_0x5cf1f3,_0x4835c6,_0x16bf58),_0x5030f8[_0x16bf58]);});});this[_0x42e5('0xf')][_0x42e5('0x9f')](util[_0x42e5('0x2d')](_0x42e5('0xde'),_0x5cf1f3),_0x566a7e[_0x42e5('0x9c')]);return this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')]('variable\x20%s\x20set',_0x5cf1f3));};AGIVertices[_0x42e5('0x17')]['dial']=function(_0x9b89e6){logger[_0x42e5('0xdf')](util[_0x42e5('0x2d')](_0x42e5('0xe0'),_0x9b89e6[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x9b89e6[_0x42e5('0xe1')])){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x9b89e6,'no\x20user\x20selected');}var _0x1e56d4=this['getUser'][_0x42e5('0xc2')](this,_0x9b89e6[_0x42e5('0xe1')]);if(!_0x1e56d4){return this[_0x42e5('0xf')]['error'](_0x9b89e6,'no\x20user\x20found');}var _0x19421f=this[_0x42e5('0xf')]['exec'](_0x42e5('0xe2'),[util[_0x42e5('0x2d')]('SIP/%s',_0x1e56d4),_0x9b89e6[_0x42e5('0x6c')],_0x9b89e6[_0x42e5('0xe3')],_0x9b89e6[_0x42e5('0x6a')]]);if(_0x19421f[_0x42e5('0xa5')]===-0x1){return _0x19421f;}return this[_0x42e5('0xf')]['noop'](util['format'](_0x42e5('0xe4'),'DIAL'));};AGIVertices[_0x42e5('0x17')][_0x42e5('0xe5')]=function(_0x2852de){logger['info'](util[_0x42e5('0x2d')](_0x42e5('0xe6'),_0x2852de[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x2852de['key'])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0xe7'));}if(!this['isConfigured'](_0x2852de[_0x42e5('0x62')])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0xab'));}this[_0x42e5('0xf')][_0x42e5('0xe8')]=!![];this['createSquareDetailsReport'](_0x2852de);this[_0x42e5('0xe9')](_0x2852de[_0x42e5('0x62')],'in','','');this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0xea'),_0x2852de['text']));var _0x330af9=this['googleDialogflow'][_0x42e5('0xc2')](this,_0x2852de);if(_0x330af9){for(var _0x465173 in _0x330af9){if(_0x330af9[_0x42e5('0x97')](_0x465173)){this[_0x42e5('0xf')][_0x42e5('0x9f')](util[_0x42e5('0x2d')](_0x42e5('0xeb'),_0x465173[_0x42e5('0x70')]()),_0x330af9[_0x465173]);}}this[_0x42e5('0xe9')](_0x330af9[_0x42e5('0xec')],_0x42e5('0xed'),_0x42e5('0xe5'),'');return this[_0x42e5('0xf')]['noop'](util['format'](_0x42e5('0xee'),_0x330af9[_0x42e5('0xec')]));}return this[_0x42e5('0xf')]['error'](_0x2852de,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0x42e5('0xef')]=function(_0x4d954c){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0xf0'),_0x4d954c[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x4d954c[_0x42e5('0x80')])){return this['channel'][_0x42e5('0xaa')](_0x42e5('0xf1'));}if(!this[_0x42e5('0x8b')](_0x4d954c['client_email'])){return this['channel']['noop']('no\x20client_email\x20configured');}if(!this[_0x42e5('0x8b')](_0x4d954c[_0x42e5('0x82')])){return this[_0x42e5('0xf')]['noop'](_0x42e5('0xf2'));}if(!this['isConfigured'](_0x4d954c['dialogflowV2_language'])){return this[_0x42e5('0xf')]['noop']('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x4d954c[_0x42e5('0x62')])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0xab'));}this[_0x42e5('0xf')]['bot']=!![];this['createSquareDetailsReport'](_0x4d954c);this[_0x42e5('0xe9')](_0x4d954c['text'],'in','','');this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0xf3'),_0x4d954c[_0x42e5('0x62')]));var _0x41783b=this[_0x42e5('0x7f')]['sync'](this,_0x4d954c);if(_0x41783b){for(var _0x1cd60e in _0x41783b){if(_0x41783b[_0x42e5('0x97')](_0x1cd60e)){if(_0x1cd60e!==_0x42e5('0xf4')){this[_0x42e5('0xf')]['setVariable'](util[_0x42e5('0x2d')]('DIALOGFLOW_%s',_0x1cd60e[_0x42e5('0x70')]()),_0x41783b[_0x1cd60e]);}}}this[_0x42e5('0xe9')](_0x41783b[_0x42e5('0xec')],'out','dialogflowV2',_0x41783b[_0x42e5('0xf4')]);return this[_0x42e5('0xf')][_0x42e5('0xaa')](util['format']('DialogflowV2\x20Result\x20%s',_0x41783b['speech']));}return this[_0x42e5('0xf')]['error'](_0x4d954c,_0x42e5('0xf5'));};AGIVertices[_0x42e5('0x17')]['sesteknda']=function(_0x39f203){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x39f203[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x39f203[_0x42e5('0xf6')])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0xf7'));}if(!this[_0x42e5('0x8b')](_0x39f203['username'])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0xf8'));}if(!this['isConfigured'](_0x39f203[_0x42e5('0xf9')])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0xfa'));}if(!this[_0x42e5('0x8b')](_0x39f203['ndassistant_url'])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0xab'));}this[_0x42e5('0xf')][_0x42e5('0xe8')]=!![];this[_0x42e5('0x39')](_0x39f203);this[_0x42e5('0xe9')](_0x39f203[_0x42e5('0x62')],'in','','');this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0xfb'),_0x39f203[_0x42e5('0x62')]));var _0x3ebcc7=this[_0x42e5('0x84')][_0x42e5('0xc2')](this,_0x39f203);if(_0x3ebcc7){for(var _0x33cd3a in _0x3ebcc7){if(_0x3ebcc7[_0x42e5('0x97')](_0x33cd3a)){this[_0x42e5('0xf')][_0x42e5('0x9f')](util[_0x42e5('0x2d')](_0x42e5('0xfc'),_0x33cd3a[_0x42e5('0x70')]()),_0x3ebcc7[_0x33cd3a]);}}this[_0x42e5('0xe9')](_0x3ebcc7[_0x42e5('0xec')],'out',_0x42e5('0xfd'),'');if(_0x3ebcc7[_0x42e5('0xfe')]){this['channel'][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0xff'),_0x3ebcc7[_0x42e5('0xfe')]));var _0x5bdb14=this[_0x42e5('0xf')]['streamFile'](_0x3ebcc7['audiofile']);try{fs[_0x42e5('0x100')](_0x3ebcc7['audiofile']+_0x42e5('0x101'));}catch(_0x133a9e){logger[_0x42e5('0x2f')](_0x133a9e);}return _0x5bdb14;}else{return this[_0x42e5('0xf')][_0x42e5('0xaa')](util['format'](_0x42e5('0x102'),_0x3ebcc7[_0x42e5('0xec')]));}}return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x39f203,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x42e5('0x17')][_0x42e5('0x103')]=function(_0x419328){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x104'),_0x419328[_0x42e5('0x3b')]));return this[_0x42e5('0xf')]['noop'](_0x42e5('0x103'));};AGIVertices[_0x42e5('0x17')][_0x42e5('0x105')]=function(_0x4fa716){logger['info'](util['format'](_0x42e5('0x106'),_0x4fa716['label']));var _0x168ed9='';if(_0x4fa716[_0x42e5('0x107')]){if(!this['isConfigured'](_0x4fa716['trunk_id'])){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x4fa716,_0x42e5('0x108'));}else{var _0x2e5a01=parseInt(_0x4fa716[_0x42e5('0x107')],0xa);if(isNaN(_0x2e5a01)){_0x168ed9=_0x4fa716[_0x42e5('0x107')];}else{_0x168ed9=this['getTrunk'][_0x42e5('0xc2')](this,_0x4fa716[_0x42e5('0x107')]);if(!_0x168ed9){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x4fa716,_0x42e5('0x109'));}}}}else if(_0x4fa716['trunk_name']){_0x168ed9=_0x4fa716[_0x42e5('0x10a')];}else{return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x4fa716,_0x42e5('0x108'));}var _0x20a318=this[_0x42e5('0xf')]['exec'](_0x42e5('0xe2'),[util[_0x42e5('0x2d')]('SIP/%s/%s',_0x168ed9,_0x4fa716[_0x42e5('0x4c')]),_0x4fa716[_0x42e5('0x6c')],_0x4fa716[_0x42e5('0xe3')],_0x4fa716[_0x42e5('0x6a')]]);if(_0x20a318[_0x42e5('0xa5')]===-0x1){return _0x20a318;}return this[_0x42e5('0xf')]['noop'](util[_0x42e5('0x2d')]('Executed\x20command\x20%s','DIAL'));};AGIVertices['prototype']['finally']=function(_0x5928a8){logger['info'](util[_0x42e5('0x2d')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x5928a8['label']));return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0x10b'));};AGIVertices[_0x42e5('0x17')][_0x42e5('0x10c')]=function(_0x584e0){logger[_0x42e5('0x30')](util['format'](_0x42e5('0x10d'),_0x584e0['label']));if(_0x584e0[_0x42e5('0x10e')]===0x0){return this[_0x42e5('0xa7')](_0x584e0);}_0x584e0[_0x42e5('0x10e')]-=0x1;if(!this['isConfigured'](_0x584e0['file_id'])){return this[_0x42e5('0xf')]['error'](_0x584e0,_0x42e5('0x10f'));}var _0x455a7c=this[_0x42e5('0x21')][_0x42e5('0xc2')](this,_0x584e0['file_id']);if(!_0x455a7c){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x584e0,_0x42e5('0x110'));}if(!this[_0x42e5('0x8b')](_0x584e0[_0x42e5('0x111')])){return this['channel'][_0x42e5('0x2f')](_0x42e5('0xd9'));}var _0x4f5f1c=this['channel']['getData'](_0x455a7c,_0x584e0[_0x42e5('0x112')],_0x584e0[_0x42e5('0x113')]);var _0xde4e38=_0x4f5f1c[_0x42e5('0xa5')]?_0x4f5f1c[_0x42e5('0xa5')][_0x42e5('0x50')]():'';logger[_0x42e5('0x30')](_0x42e5('0x114'),JSON['stringify'](_0x4f5f1c));if(_0x4f5f1c[_0x42e5('0xa5')]===-0x1){this[_0x42e5('0x39')][_0x42e5('0xc2')](this,_0x584e0,_0xde4e38);return _0x4f5f1c;}else if(_0x4f5f1c[_0x42e5('0xa6')]===_0x42e5('0x6c')){_0x4f5f1c[_0x42e5('0xa5')]=_0xde4e38[_0x42e5('0x9c')]>=parseInt(_0x584e0[_0x42e5('0x115')])?'x':'i';}else{_0x4f5f1c[_0x42e5('0xa5')]=_0xde4e38[_0x42e5('0x9c')]>=parseInt(_0x584e0[_0x42e5('0x115')])&&_0xde4e38[_0x42e5('0x9c')]<=parseInt(_0x584e0[_0x42e5('0x113')])?'x':'i';}var _0x2bb03d=this['getVariable'][_0x42e5('0xc2')](this,_0x584e0['variable_id']);if(!_0x2bb03d){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x584e0,_0x42e5('0xda'));}this['channel'][_0x42e5('0x9f')](_0x2bb03d,_0xde4e38);if(this['isConfigured'](_0x584e0[_0x42e5('0x116')])){var _0x278a9b=parseInt(_0x584e0[_0x42e5('0x116')],0xa);var _0x422355=rs[_0x42e5('0x117')]({'charset':'*','length':_0x278a9b});var _0x538080=_0xde4e38[_0x42e5('0x9c')];if(_0x538080>0x0){if(_0x538080>_0x278a9b){this[_0x42e5('0x39')][_0x42e5('0xc2')](this,_0x584e0,_0x584e0[_0x42e5('0x118')]===_0x42e5('0x119')?_0x422355+_0xde4e38[_0x42e5('0x11a')](_0x278a9b):_0xde4e38[_0x42e5('0x11a')](0x0,_0x538080-_0x278a9b)+_0x422355);}else{this[_0x42e5('0x39')][_0x42e5('0xc2')](this,_0x584e0,rs['generate']({'charset':'*','length':_0x538080}));}}else{this[_0x42e5('0x39')][_0x42e5('0xc2')](this,_0x584e0,'');}}else{this['createSquareDetailsReport'][_0x42e5('0xc2')](this,_0x584e0,_0xde4e38);}return _0x4f5f1c;};AGIVertices[_0x42e5('0x17')][_0x42e5('0xe')]=function(_0x259e31){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x11b'),_0x259e31['label']));return this[_0x42e5('0x10c')](_0x259e31);};AGIVertices[_0x42e5('0x17')]['goal']=function(_0x3264f2){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x11c'),_0x3264f2[_0x42e5('0x3b')]));this[_0x42e5('0x39')]['sync'](this,_0x3264f2,_0x3264f2[_0x42e5('0x11d')]);return this['channel'][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0x11e'),_0x3264f2[_0x42e5('0x11d')]));};AGIVertices[_0x42e5('0x17')][_0x42e5('0x11f')]=function(_0x48fd16){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x120'),_0x48fd16['label']));if(!this[_0x42e5('0x8b')](_0x48fd16['aws_access_key_id'])||!this[_0x42e5('0x8b')](_0x48fd16[_0x42e5('0x8f')])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0x121'));}if(!this[_0x42e5('0x8b')](_0x48fd16[_0x42e5('0x62')])){return this[_0x42e5('0xf')]['noop'](_0x42e5('0xab'));}this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')]('Trying\x20aws\x20Polly\x20%s',_0x48fd16[_0x42e5('0x62')]));var _0x1b16c0=this[_0x42e5('0x8d')][_0x42e5('0xc2')](this,_0x48fd16);if(_0x1b16c0){this[_0x42e5('0xf')][_0x42e5('0xaa')](util['format'](_0x42e5('0x122'),_0x1b16c0));var _0x1bad06=this[_0x42e5('0xf')][_0x42e5('0x123')](_0x1b16c0);try{fs[_0x42e5('0x100')](_0x1b16c0+_0x42e5('0x101'));}catch(_0x375d39){logger[_0x42e5('0x2f')](_0x375d39);}return _0x1bad06;}return this['channel'][_0x42e5('0x2f')](_0x48fd16,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0x42e5('0x124')]=function(_0x5442b8){logger['info'](util['format'](_0x42e5('0x125'),_0x5442b8[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x5442b8[_0x42e5('0x8e')])||!this[_0x42e5('0x8b')](_0x5442b8[_0x42e5('0x8f')])){return this['channel']['noop'](_0x42e5('0x121'));}if(!this[_0x42e5('0x8b')](_0x5442b8[_0x42e5('0x93')])){return this[_0x42e5('0xf')]['noop'](_0x42e5('0x126'));}if(!this[_0x42e5('0x8b')](_0x5442b8['text'])){return this['channel'][_0x42e5('0xaa')](_0x42e5('0xab'));}this['channel'][_0x42e5('0xe8')]=!![];this[_0x42e5('0x39')](_0x5442b8);this[_0x42e5('0xe9')](_0x5442b8['text'],'in','','');this[_0x42e5('0xf')][_0x42e5('0xaa')](util['format'](_0x42e5('0x127'),_0x5442b8[_0x42e5('0x62')]));var _0x109c6b=this['awsLex'][_0x42e5('0xc2')](this,_0x5442b8);if(_0x109c6b){for(var _0x3e0151 in _0x109c6b){if(_0x109c6b[_0x42e5('0x97')](_0x3e0151)&&_['isString'](_0x109c6b[_0x3e0151])){this[_0x42e5('0xf')][_0x42e5('0x9f')](util[_0x42e5('0x2d')](_0x42e5('0x128'),_0x3e0151['toUpperCase']()),_0x109c6b[_0x3e0151]);}}if(_[_0x42e5('0x4b')](_0x109c6b[_0x42e5('0x7b')])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0x129'));}else{this[_0x42e5('0xe9')](_0x109c6b[_0x42e5('0x7b')],_0x42e5('0xed'),_0x42e5('0x12a'),'');return this['channel'][_0x42e5('0xaa')](util['format'](_0x42e5('0x12b'),_0x109c6b[_0x42e5('0x7b')]));}}return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x5442b8,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x42e5('0x17')]['googleasr']=function(_0x11ece8){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x12c'),_0x11ece8[_0x42e5('0x3b')],_0x11ece8['timeout']));if(!this[_0x42e5('0x8b')](_0x11ece8[_0x42e5('0x86')])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0xe7'));}var _0x3598fe=_0x42e5('0x12d');var _0x2e7bfb=util['format']('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x4307a5=util[_0x42e5('0x2d')](_0x42e5('0x9e'),_0x2e7bfb,_0x3598fe);var _0x5d0e30=!![];if(_0x11ece8[_0x42e5('0x12e')]===_0x42e5('0x12f')){_0x5d0e30=![];}var _0x5d044a=this[_0x42e5('0xf')]['recordFile'](_0x2e7bfb,_0x3598fe,_0x11ece8['intKey'],_0x11ece8['timeout'],undefined,_0x5d0e30);if(_0x5d044a[_0x42e5('0xa5')]!==-0x1){this[_0x42e5('0xf')][_0x42e5('0xaa')](util['format']('google\x20%s\x20file\x20created',_0x4307a5));var _0x2c70ad=this[_0x42e5('0x94')][_0x42e5('0xc2')](this,_0x11ece8,_0x4307a5);if(_0x2c70ad){for(var _0x548b5f in _0x2c70ad){if(_0x2c70ad['hasOwnProperty'](_0x548b5f)){this[_0x42e5('0xf')][_0x42e5('0x9f')](util[_0x42e5('0x2d')]('GOOGLE_ASR_%s',_0x548b5f['toUpperCase']()),_0x2c70ad[_0x548b5f]);}}return this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0x130'),JSON[_0x42e5('0x78')](_0x2c70ad)));}}return _0x5d044a;};AGIVertices[_0x42e5('0x17')][_0x42e5('0x131')]=function(_0x2f6da7){logger[_0x42e5('0x30')](util['format']('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x2f6da7[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x2f6da7[_0x42e5('0x132')])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0x133'));}if(!this[_0x42e5('0x8b')](_0x2f6da7[_0x42e5('0x134')])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0x135'));}var _0x5c8ff2=_0x42e5('0x12d');var _0x2f61d7=util[_0x42e5('0x2d')]('%s/recordings/%s',FILES_PATH,rs[_0x42e5('0x117')](0x4));var _0x2dedc2=util[_0x42e5('0x2d')](_0x42e5('0x9e'),_0x2f61d7,_0x5c8ff2);var _0x133120=!![];if(_0x2f6da7[_0x42e5('0x12e')]===_0x42e5('0x12f')){_0x133120=![];}var _0x2b22ec=this[_0x42e5('0xf')]['recordFile'](_0x2f61d7,_0x5c8ff2,_0x2f6da7[_0x42e5('0x136')],_0x2f6da7[_0x42e5('0x6c')],undefined,_0x133120);if(_0x2b22ec[_0x42e5('0xa5')]!==-0x1){this['channel'][_0x42e5('0xaa')](util[_0x42e5('0x2d')]('tilde\x20%s\x20file\x20created',_0x2dedc2));var _0x28666b=this[_0x42e5('0x95')]['sync'](this,_0x2f6da7,_0x2dedc2);if(_0x28666b){for(var _0x42a8bc in _0x28666b){if(_0x28666b[_0x42e5('0x97')](_0x42a8bc)){this[_0x42e5('0xf')][_0x42e5('0x9f')](util[_0x42e5('0x2d')](_0x42e5('0x137'),_0x42a8bc['toUpperCase']()),_0x28666b[_0x42a8bc]);}}return this[_0x42e5('0xf')]['noop'](util[_0x42e5('0x2d')](_0x42e5('0x138'),JSON[_0x42e5('0x78')](_0x28666b)));}}return _0x2b22ec;};AGIVertices[_0x42e5('0x17')][_0x42e5('0x139')]=function(_0x260762){logger[_0x42e5('0x30')](util['format'](_0x42e5('0x13a'),_0x260762[_0x42e5('0x3b')]));return this[_0x42e5('0xf')][_0x42e5('0x13b')](_0x260762[_0x42e5('0x40')],_0x260762[_0x42e5('0x41')],_0x260762[_0x42e5('0x42')]);};AGIVertices['prototype'][_0x42e5('0x13c')]=function(_0xfb7ed1){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x13d'),_0xfb7ed1[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0xfb7ed1['condition'])){return this['channel'][_0x42e5('0x2f')](_0xfb7ed1,_0x42e5('0x13e'));}try{var _0x347c56=eval(_0xfb7ed1[_0x42e5('0x13f')])?_0x42e5('0x140'):_0x42e5('0x141');this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0x142'),_0xfb7ed1[_0x42e5('0x13f')],_0x347c56));return{'code':0xc8,'result':_0x347c56};}catch(_0x53b9a9){return{'code':0xc8,'result':_0x42e5('0x141')};}};AGIVertices[_0x42e5('0x17')][_0x42e5('0x143')]=function(_0x233e35){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x144'),_0x233e35[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x233e35[_0x42e5('0x145')])){return this['channel'][_0x42e5('0x2f')](_0x233e35,_0x42e5('0x146'));}var _0x547002=this[_0x42e5('0x27')][_0x42e5('0xc2')](this,_0x233e35[_0x42e5('0x145')]);if(!_0x547002){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x233e35,'no\x20intervals\x20found');}for(var _0x1392e0=0x0;_0x1392e0<_0x547002[_0x42e5('0x9c')];_0x1392e0+=0x1){var _0xf53c50=this[_0x42e5('0xf')]['getVariable'](util[_0x42e5('0x2d')](_0x42e5('0x147'),_0x547002[_0x1392e0]));if(_0xf53c50['result']===-0x1){return _0xf53c50;}logger[_0x42e5('0x30')](util[_0x42e5('0x2d')]('IFTIME\x20%s\x20%s',_0x547002[_0x1392e0],_0xf53c50[_0x42e5('0xa6')]));if(_0xf53c50['extra']===_0x42e5('0x140')){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')]('IFTIME\x20%s\x20%s',_0x547002[_0x1392e0],_0x42e5('0x140')));this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0x148'),_0x547002[_0x1392e0],'true'));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0x42e5('0x2d')]('IFTIME\x20%s\x20%s',_0x547002[_0x1392e0],_0x42e5('0x141')));this[_0x42e5('0xf')]['noop'](util[_0x42e5('0x2d')](_0x42e5('0x148'),_0x547002[_0x1392e0],_0x42e5('0x141')));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype'][_0x42e5('0x149')]=function(_0x477086){logger[_0x42e5('0x30')](util['format'](_0x42e5('0x14a'),_0x477086['label']));return this[_0x42e5('0xf')][_0x42e5('0x149')]();};AGIVertices[_0x42e5('0x17')][_0x42e5('0x14b')]=function(_0x50e982){logger['info'](util[_0x42e5('0x2d')](_0x42e5('0x14c'),_0x50e982[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x50e982[_0x42e5('0x86')])){return this[_0x42e5('0xf')]['noop'](_0x42e5('0xe7'));}var _0x31087d=_0x42e5('0x12d');var _0x2db7b9=util[_0x42e5('0x2d')](_0x42e5('0x14d'),FILES_PATH,rs['generate'](0x4));var _0x3da8c4=util[_0x42e5('0x2d')]('%s.%s',_0x2db7b9,_0x31087d);var _0x4d69db=!![];if(_0x50e982[_0x42e5('0x12e')]===_0x42e5('0x12f')){_0x4d69db=![];}var _0x5744fd=this[_0x42e5('0xf')][_0x42e5('0x14e')](_0x2db7b9,_0x31087d,_0x50e982[_0x42e5('0x136')],_0x50e982['timeout'],undefined,_0x4d69db);if(_0x5744fd['result']!==-0x1){this[_0x42e5('0xf')][_0x42e5('0xaa')](util['format'](_0x42e5('0x14f'),_0x3da8c4));var _0x23579a=this[_0x42e5('0x89')][_0x42e5('0xc2')](this,_0x50e982,_0x3da8c4);if(_0x23579a){for(var _0x5ea662 in _0x23579a){if(_0x23579a[_0x42e5('0x97')](_0x5ea662)){this['channel'][_0x42e5('0x9f')](util['format']('ISPEECH_ASR_%s',_0x5ea662[_0x42e5('0x70')]()),_0x23579a[_0x5ea662]);}}return this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x23579a)));}}return _0x5744fd;};AGIVertices['prototype'][_0x42e5('0x150')]=function(_0x4e19ca){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x151'),_0x4e19ca[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x4e19ca[_0x42e5('0x86')])){return this['channel'][_0x42e5('0xaa')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x4e19ca['text'])){return this[_0x42e5('0xf')][_0x42e5('0xaa')]('no\x20text\x20configured');}this['channel'][_0x42e5('0xaa')](util[_0x42e5('0x2d')]('Trying\x20ispeech\x20TTS\x20%s',_0x4e19ca['text']));var _0x2e58ec=this[_0x42e5('0x85')]['sync'](this,_0x4e19ca);if(_0x2e58ec){this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')]('ispeech\x20%s\x20file\x20created',_0x2e58ec));var _0xccbf2b=this[_0x42e5('0xf')]['streamFile'](_0x2e58ec,_0x4e19ca[_0x42e5('0x136')]);try{fs[_0x42e5('0x100')](_0x2e58ec+'.wav');}catch(_0x1a614a){logger[_0x42e5('0x2f')](_0x1a614a);}return _0xccbf2b;}return this['channel'][_0x42e5('0x2f')](_0x4e19ca,_0x42e5('0x152'));};AGIVertices[_0x42e5('0x17')][_0x42e5('0x153')]=function(_0x22c72c){logger[_0x42e5('0x30')](util['format'](_0x42e5('0x154'),_0x22c72c[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x22c72c['findBy'])){return this[_0x42e5('0xf')]['error'](_0x22c72c,'no\x20find\x20by\x20configured');}logger[_0x42e5('0x30')](util[_0x42e5('0x2d')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x42e5('0xf')][_0x42e5('0x3e')],_0x22c72c['findBy']));var _0x585d2e=this[_0x42e5('0x5a')]['sync'](this,_0x22c72c[_0x42e5('0x155')]);if(_0x585d2e){logger[_0x42e5('0x30')](util['format'](_0x42e5('0x156'),this[_0x42e5('0xf')][_0x42e5('0x3e')],_0x22c72c[_0x42e5('0x155')]));this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0x156'),this['channel'][_0x42e5('0x3e')],_0x22c72c[_0x42e5('0x155')]));return{'code':0xc8,'result':_0x42e5('0x157')};}else{logger['info'](util[_0x42e5('0x2d')](_0x42e5('0x158'),this[_0x42e5('0xf')][_0x42e5('0x3e')],_0x22c72c[_0x42e5('0x155')]));this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0x158'),this[_0x42e5('0xf')][_0x42e5('0x3e')],_0x22c72c[_0x42e5('0x155')]));return{'code':0xc8,'result':_0x42e5('0x159')};}};AGIVertices[_0x42e5('0x17')][_0x42e5('0x15a')]=function(_0x277911){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x15b'),_0x277911['label']));if(!this[_0x42e5('0x8b')](_0x277911[_0x42e5('0x155')])){return this['channel'][_0x42e5('0x2f')](_0x277911,_0x42e5('0x15c'));}logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x15d'),this[_0x42e5('0xf')]['callerid'],_0x277911[_0x42e5('0x155')]));var _0x33d564=this[_0x42e5('0x57')][_0x42e5('0xc2')](this,_0x277911[_0x42e5('0x155')]);if(_0x33d564){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x42e5('0xf')][_0x42e5('0x3e')],_0x277911[_0x42e5('0x155')]));this[_0x42e5('0xf')][_0x42e5('0xaa')](util['format'](_0x42e5('0x156'),this['channel']['callerid'],_0x277911[_0x42e5('0x155')]));return{'code':0xc8,'result':_0x42e5('0x157')};}else{logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x158'),this[_0x42e5('0xf')][_0x42e5('0x3e')],_0x277911[_0x42e5('0x155')]));this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0x158'),this[_0x42e5('0xf')][_0x42e5('0x3e')],_0x277911[_0x42e5('0x155')]));return{'code':0xc8,'result':_0x42e5('0x159')};}};AGIVertices[_0x42e5('0x17')]['math']=function(_0x1861c9){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x15e'),_0x1861c9['label']));if(!this[_0x42e5('0x8b')](_0x1861c9[_0x42e5('0x15f')])){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x1861c9,_0x42e5('0x160'));}this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')]('math\x20%s',_0x1861c9[_0x42e5('0x15f')]));var _0x2d2b13=eval(_0x1861c9[_0x42e5('0x15f')]);if(!this['isConfigured'](_0x1861c9[_0x42e5('0x111')])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0xd9'));}var _0x275587=this[_0x42e5('0x11')][_0x42e5('0xc2')](this,_0x1861c9[_0x42e5('0x111')]);if(!_0x275587){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x1861c9,_0x42e5('0xda'));}if(_[_0x42e5('0x9b')](_0x2d2b13)){var _0x1db3d7=this;_0x2d2b13[_0x42e5('0xdb')](function(_0x2ddd33,_0x39dc7a){_0x1db3d7[_0x42e5('0xf')][_0x42e5('0x9f')](util[_0x42e5('0x2d')](_0x42e5('0x161'),_0x275587,_0x39dc7a),_0x2ddd33);});return this[_0x42e5('0xf')][_0x42e5('0xaa')](util['format'](_0x42e5('0x162'),_0x275587));}else{return this[_0x42e5('0xf')][_0x42e5('0x9f')](_0x275587,_0x2d2b13);}};AGIVertices['prototype']['menu']=function(_0x3b7351){logger['info'](util[_0x42e5('0x2d')](_0x42e5('0x163'),_0x3b7351['label']));if(_0x3b7351[_0x42e5('0x10e')]===0x0){return this[_0x42e5('0xa7')](_0x3b7351);}_0x3b7351[_0x42e5('0x10e')]-=0x1;if(!this[_0x42e5('0x8b')](_0x3b7351[_0x42e5('0x164')])){return this['channel']['error'](_0x3b7351,_0x42e5('0x10f'));}var _0x513fea=this[_0x42e5('0x21')][_0x42e5('0xc2')](this,_0x3b7351[_0x42e5('0x164')]);if(!_0x513fea){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x3b7351,'no\x20file\x20audio\x20found');}var _0x21a349=this[_0x42e5('0xf')]['getData'](_0x513fea,_0x3b7351['response'],_0x3b7351['digit']);var _0x2cc911=_0x21a349[_0x42e5('0xa5')];if(_0x21a349[_0x42e5('0xa5')]===-0x1){this[_0x42e5('0x39')][_0x42e5('0xc2')](this,_0x3b7351,'-1');return _0x21a349;}else if(_0x21a349[_0x42e5('0xa6')]===_0x42e5('0x6c')){_0x21a349['result']=_0x21a349[_0x42e5('0xa5')][_0x42e5('0x9c')]>0x0?_0x21a349[_0x42e5('0xa5')]:'t';}else if(_[_0x42e5('0x47')](_0x21a349[_0x42e5('0xa5')])){_0x21a349[_0x42e5('0xa5')]='#';_0x2cc911='#';}if(!this[_0x42e5('0x8b')](_0x3b7351[_0x42e5('0x111')])){this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0xd9'));}else{var _0x42d96d=this[_0x42e5('0x11')][_0x42e5('0xc2')](this,_0x3b7351['variable_id']);if(!_0x42d96d){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x3b7351,_0x42e5('0xda'));}this[_0x42e5('0xf')][_0x42e5('0x9f')](_0x42d96d,_0x2cc911);}this[_0x42e5('0x39')][_0x42e5('0xc2')](this,_0x3b7351,_0x2cc911);return _0x21a349;};AGIVertices[_0x42e5('0x17')][_0x42e5('0xaa')]=function(_0x3d1807){logger['info'](util['format'](_0x42e5('0x165'),_0x3d1807[_0x42e5('0x3b')]));return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x3d1807[_0x42e5('0x166')]||_0x3d1807[_0x42e5('0x3b')]);};AGIVertices[_0x42e5('0x17')][_0x42e5('0x167')]=function(_0x15986c){logger[_0x42e5('0x30')](util['format'](_0x42e5('0x168'),_0x15986c[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x15986c[_0x42e5('0x155')])){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x15986c,'no\x20find\x20by\x20configured');}logger[_0x42e5('0x30')](util[_0x42e5('0x2d')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x42e5('0xf')][_0x42e5('0x3e')],_0x15986c[_0x42e5('0x155')]));var _0x4873a6=this[_0x42e5('0x52')]['sync'](this,_0x15986c[_0x42e5('0x169')]);var _0x3346a0=this['agentPause']['sync'](this,_0x15986c[_0x42e5('0x155')],_0x4873a6);if(_0x3346a0){logger[_0x42e5('0x30')](util['format'](_0x42e5('0x156'),this[_0x42e5('0xf')][_0x42e5('0x3e')],_0x15986c[_0x42e5('0x155')]));this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x42e5('0x3e')],_0x15986c[_0x42e5('0x155')]));return{'code':0xc8,'result':_0x42e5('0x157')};}else{logger['info'](util[_0x42e5('0x2d')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x42e5('0x3e')],_0x15986c['findBy']));this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0x156'),this[_0x42e5('0xf')][_0x42e5('0x3e')],_0x15986c[_0x42e5('0x155')]));return{'code':0xc8,'result':_0x42e5('0x159')};}};AGIVertices[_0x42e5('0x17')][_0x42e5('0x16a')]=function(_0x743a2f){logger['info'](util['format'](_0x42e5('0x16b'),_0x743a2f['label']));if(!this[_0x42e5('0x8b')](_0x743a2f[_0x42e5('0x164')])){return this['channel'][_0x42e5('0x2f')](_0x743a2f,_0x42e5('0x10f'));}var _0x2aa311=this[_0x42e5('0x21')]['sync'](this,_0x743a2f[_0x42e5('0x164')]);if(!_0x2aa311){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x743a2f,'no\x20file\x20audio\x20found');}var _0xdda89a=this['channel'][_0x42e5('0x5c')](_0x42e5('0x16c'),[_0x2aa311,_0x743a2f[_0x42e5('0xe3')]]);if(_0xdda89a[_0x42e5('0xa5')]===-0x1){return _0xdda89a;}return this[_0x42e5('0xf')]['noop'](util[_0x42e5('0x2d')]('Executed\x20command\x20%s\x20%s',_0x42e5('0x16c'),_0x2aa311));};AGIVertices[_0x42e5('0x17')][_0x42e5('0x16d')]=function(_0x52f931){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x16e'),_0x52f931[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x52f931[_0x42e5('0x16f')])){return this['channel'][_0x42e5('0x2f')](_0x52f931,'no\x20queue\x20selected');}var _0x4f4b78='';var _0xef5b18=parseInt(_0x52f931['queue_id'],0xa);if(isNaN(_0xef5b18)){_0x4f4b78=_0x52f931[_0x42e5('0x16f')];}else{_0x4f4b78=this[_0x42e5('0x18')]['sync'](this,_0x52f931[_0x42e5('0x16f')]);if(!_0x4f4b78){return this[_0x42e5('0xf')]['error'](_0x52f931,_0x42e5('0x170'));}}var _0x6df173='';if(this[_0x42e5('0x8b')](_0x52f931['file_id'])){var _0x4aa1fc=this[_0x42e5('0x21')][_0x42e5('0xc2')](this,_0x52f931[_0x42e5('0x164')]);if(_0x4aa1fc){_0x6df173=_0x4aa1fc;}}this[_0x42e5('0x39')][_0x42e5('0xc2')](this,_0x52f931,_0x4f4b78);if(_0x52f931[_0x42e5('0xe3')]['indexOf']('x')<0x0){_0x52f931[_0x42e5('0xe3')]+='x';}if(_0x52f931[_0x42e5('0xe3')][_0x42e5('0x171')]('X')<0x0){_0x52f931[_0x42e5('0xe3')]+='X';}this[_0x42e5('0xf')][_0x42e5('0x9f')]('XMCS-QUEUE',_0x4f4b78?_0x4f4b78['toLowerCase']():'');var _0x24346e=this[_0x42e5('0xf')][_0x42e5('0x5c')](_0x42e5('0x172'),[_0x4f4b78,_0x52f931['opts'],_0x52f931['url'],_0x6df173,_0x52f931[_0x42e5('0x6c')],_0x52f931['agi'],_0x52f931[_0x42e5('0x173')],_0x52f931['gosub'],'',_0x52f931['position']]);if(_0x24346e[_0x42e5('0xa5')]===-0x1){return _0x24346e;}return this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0xc6'),_0x42e5('0x172'),_0x4f4b78));};AGIVertices[_0x42e5('0x17')][_0x42e5('0x174')]=function(_0x2d6cfb){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x175'),_0x2d6cfb[_0x42e5('0x3b')]));var _0x114897=_0x2d6cfb[_0x42e5('0x176')]||'wav';var _0x1d7c48=util[_0x42e5('0x2d')](_0x42e5('0x177'),this[_0x42e5('0xf')][_0x42e5('0x3a')],rs['generate'](0x5));var _0x2aa6e6=util[_0x42e5('0x2d')](_0x42e5('0x178'),FILES_PATH,_0x1d7c48,_0x114897);var _0x5321aa=util[_0x42e5('0x2d')](_0x42e5('0x14d'),FILES_PATH,_0x1d7c48);this[_0x42e5('0x3f')][_0x42e5('0xc2')](this,_0x2d6cfb,_0x1d7c48,_0x2aa6e6);this['channel'][_0x42e5('0x9f')](_0x42e5('0x179'),_0x1d7c48);logger[_0x42e5('0x30')](_0x42e5('0x17a'),_0x5321aa,_0x114897,_0x2d6cfb[_0x42e5('0x17b')],_0x2d6cfb[_0x42e5('0x6c')]);return this['channel'][_0x42e5('0x14e')](_0x5321aa,_0x114897,_0x2d6cfb[_0x42e5('0x17b')],_0x2d6cfb['timeout'],undefined,!![]);};AGIVertices[_0x42e5('0x17')][_0x42e5('0x17c')]=function(_0x3dd7f4){logger['info'](util[_0x42e5('0x2d')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x3dd7f4[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x3dd7f4[_0x42e5('0x6a')])){return this[_0x42e5('0xf')]['noop'](_0x42e5('0x17d'));}var _0x59de76=this[_0x42e5('0x17e')][_0x42e5('0xc2')](this,_0x3dd7f4);logger[_0x42e5('0x30')](util[_0x42e5('0x2d')]('Response:',util['inspect'](_0x59de76,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x3dd7f4[_0x42e5('0x111')])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0x17f'));}var _0x1eef2d=this['getVariable'][_0x42e5('0xc2')](this,_0x3dd7f4[_0x42e5('0x111')]);if(!_0x1eef2d){return this['channel'][_0x42e5('0x2f')](_0x3dd7f4,'no\x20variable\x20found');}this['channel'][_0x42e5('0x9f')](util[_0x42e5('0x2d')](_0x42e5('0x180'),_0x1eef2d),_0x59de76['statusCode']?_0x59de76['statusCode']:_0x42e5('0x181'));this['channel'][_0x42e5('0x9f')](util['format']('%s_STATUS_MESSAGE',_0x1eef2d),_0x59de76['statusMessage']?_0x59de76[_0x42e5('0x7a')]:'OK');if(_0x59de76[_0x42e5('0x71')]){try{this['saveRestApiResult'](_0x59de76['body'],_0x1eef2d);}catch(_0x5d2e6b){logger['error'](util[_0x42e5('0x2d')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x1eef2d));}}return this[_0x42e5('0xf')]['noop'](util[_0x42e5('0x2d')](_0x42e5('0x182'),_0x1eef2d));};AGIVertices[_0x42e5('0x17')][_0x42e5('0x183')]=function(_0x3af492){logger[_0x42e5('0x30')](util['format'](_0x42e5('0x184'),_0x3af492[_0x42e5('0x3b')]));return this[_0x42e5('0xf')][_0x42e5('0x185')](_0x3af492['digits'][_0x42e5('0x5e')](/\s+/g,''),_0x3af492[_0x42e5('0x17b')]);};AGIVertices['prototype']['saynumber']=function(_0x370ece){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x186'),_0x370ece[_0x42e5('0x3b')]));return this[_0x42e5('0xf')][_0x42e5('0x187')](_0x370ece['number'][_0x42e5('0x5e')](/\s+/g,''),_0x370ece[_0x42e5('0x17b')]);};AGIVertices[_0x42e5('0x17')][_0x42e5('0x188')]=function(_0x3dcba3){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x189'),_0x3dcba3[_0x42e5('0x3b')]));return this[_0x42e5('0xf')][_0x42e5('0x18a')](_0x3dcba3[_0x42e5('0x62')],_0x3dcba3[_0x42e5('0x17b')]);};AGIVertices[_0x42e5('0x17')][_0x42e5('0x18b')]=function(_0x5f0401){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x18c'),_0x5f0401[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x5f0401[_0x42e5('0x18d')])){return this[_0x42e5('0xf')][_0x42e5('0xaa')]('no\x20mail\x20account\x20configured');}var _0x4c47e0=this[_0x42e5('0x25')][_0x42e5('0xc2')](this,_0x5f0401[_0x42e5('0x18d')]);if(!_0x4c47e0||!_0x4c47e0[_0x42e5('0x18e')]){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x5f0401,_0x42e5('0x18f'));}var _0x544fac={'from':util[_0x42e5('0x2d')](_0x42e5('0x190'),_0x4c47e0[_0x42e5('0x15')],_0x4c47e0[_0x42e5('0x191')]||_0x4c47e0[_0x42e5('0x18e')][_0x42e5('0x192')]),'to':_0x5f0401['to']||'','cc':_0x5f0401['cc']||'','bcc':_0x5f0401[_0x42e5('0x193')]||'','subject':_0x5f0401['subject'],'html':_0x5f0401[_0x42e5('0x62')],'text':_0x5f0401[_0x42e5('0x62')]};var _0x37f48e={'tls':{'rejectUnauthorized':![]}};if(_0x4c47e0[_0x42e5('0x18e')][_0x42e5('0x194')]){_0x37f48e[_0x42e5('0x194')]=_0x4c47e0[_0x42e5('0x18e')][_0x42e5('0x194')];}else{_0x37f48e['host']=_0x4c47e0[_0x42e5('0x18e')][_0x42e5('0x195')];_0x37f48e[_0x42e5('0x196')]=_0x4c47e0['Smtp'][_0x42e5('0x196')];_0x37f48e['secure']=_0x4c47e0[_0x42e5('0x18e')]['secure'];}if(_0x4c47e0[_0x42e5('0x18e')][_0x42e5('0x197')]){_0x37f48e['auth']={'user':_0x4c47e0[_0x42e5('0x18e')][_0x42e5('0x192')],'pass':_0x4c47e0[_0x42e5('0x18e')][_0x42e5('0x198')]};}if(this[_0x42e5('0x8b')](_0x5f0401[_0x42e5('0x199')])){}logger['debug']('sendMail\x20message',JSON[_0x42e5('0x78')](_0x544fac));this['createSquareDetailsReport'][_0x42e5('0xc2')](this,_0x5f0401,_0x5f0401[_0x42e5('0x18d')]);this['channel'][_0x42e5('0xaa')](util['format'](_0x42e5('0x19a'),_0x4c47e0[_0x42e5('0x15')]));this[_0x42e5('0x26')][_0x42e5('0xc2')](this,_0x37f48e,_0x544fac);return this[_0x42e5('0xf')][_0x42e5('0xaa')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x42e5('0x17')][_0x42e5('0x19b')]=function(_0xf24c88){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x19c'),_0xf24c88[_0x42e5('0x3b')]));return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0x19d'));};AGIVertices[_0x42e5('0x17')][_0x42e5('0x19e')]=function(_0x4dbb18){logger['info'](util[_0x42e5('0x2d')](_0x42e5('0x19f'),_0x4dbb18[_0x42e5('0x3b')]));if(!this['isConfigured'](_0x4dbb18[_0x42e5('0x1a0')])){return this['channel']['noop'](_0x42e5('0x1a1'));}var _0x5ec47b=this[_0x42e5('0x1a2')][_0x42e5('0xc2')](this,_0x4dbb18[_0x42e5('0x1a0')]);if(!_0x5ec47b){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x4dbb18,_0x42e5('0x1a3'));}var _0x4f372d={'body':_0x4dbb18[_0x42e5('0x1a4')],'phone':_0x4dbb18['to']||'','SmsAccountId':_0x5ec47b['id']};logger[_0x42e5('0xdf')](_0x42e5('0x1a5'),JSON[_0x42e5('0x78')](_0x4f372d));this[_0x42e5('0x39')]['sync'](this,_0x4dbb18,_0x4dbb18['sms_account_id']);this['channel'][_0x42e5('0xaa')](util['format'](_0x42e5('0x1a6'),_0x5ec47b['name']));this[_0x42e5('0x38')][_0x42e5('0xc2')](this,_0x4f372d);return this['channel'][_0x42e5('0xaa')](_0x42e5('0x1a7'));};AGIVertices['prototype']['set']=function(_0x3c1667){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x1a8'),_0x3c1667[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x3c1667['variable_id'])){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x3c1667,_0x42e5('0x1a9'));}var _0x42401a=this[_0x42e5('0x11')][_0x42e5('0xc2')](this,_0x3c1667['variable_id']);if(!_0x42401a){return this[_0x42e5('0xf')]['error'](_0x3c1667,_0x42e5('0xda'));}return this[_0x42e5('0xf')]['setVariable'](_0x42401a,_0x3c1667[_0x42e5('0x1aa')]);};AGIVertices['prototype']['start']=function(_0x5c2d7e){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')]('Enter\x20in\x20START\x20(%s)\x20block',_0x5c2d7e['label']));this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0x1ab'));if(_0x5c2d7e[_0x42e5('0xbb')]===_0x42e5('0x1ac')){this['channel'][_0x42e5('0xaa')](_0x42e5('0x1ad'));return this['channel'][_0x42e5('0xbb')]();}return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0x1ae'));};AGIVertices['prototype'][_0x42e5('0x1af')]=function(_0x2a6d97){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x1b0'),_0x2a6d97[_0x42e5('0x3b')]));if(!this[_0x42e5('0x8b')](_0x2a6d97[_0x42e5('0x1b1')])){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x2a6d97,_0x42e5('0x1b2'));}var _0x36958a=this[_0x42e5('0x1a')][_0x42e5('0xc2')](this,_0x2a6d97[_0x42e5('0x1b1')]);if(!this[_0x42e5('0x8b')](_0x36958a)){return this[_0x42e5('0xf')]['error'](_0x2a6d97,util[_0x42e5('0x2d')](_0x42e5('0x1b3'),_0x2a6d97[_0x42e5('0x1b1')]));}if(_0x36958a===this['channel'][_0x42e5('0x3d')]){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x2a6d97,_0x42e5('0x1b4'));}this[_0x42e5('0x39')]['sync'](this,_0x2a6d97,_0x36958a);var _0x540829=this['channel']['exec'](_0x42e5('0x1b5'),util[_0x42e5('0x2d')](_0x42e5('0x1b6'),config[_0x42e5('0x9')][_0x42e5('0x195')]||_0x42e5('0x1b7'),_0x36958a,this[_0x42e5('0xf')][_0x42e5('0x3d')]));if(_0x540829[_0x42e5('0xa5')]===-0x1){return _0x540829;}return this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0xc6'),_0x42e5('0x1b5'),_0x36958a));};AGIVertices[_0x42e5('0x17')][_0x42e5('0x1b8')]=function(_0x1fb6f6){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x1fb6f6[_0x42e5('0x3b')]));var _0x5cba68=this['shellCommand'][_0x42e5('0xc2')](this,_0x1fb6f6[_0x42e5('0xb9')]);this[_0x42e5('0x39')]['sync'](this,_0x1fb6f6,_0x1fb6f6[_0x42e5('0xb9')]);if(this[_0x42e5('0x8b')](_0x1fb6f6['variable_id'])){var _0x3a423a=this[_0x42e5('0x11')][_0x42e5('0xc2')](this,_0x1fb6f6['variable_id']);if(_0x3a423a){this['channel'][_0x42e5('0x9f')](_0x3a423a,_0x5cba68);return this['channel']['noop'](util['format'](_0x42e5('0x1b9'),_0x1fb6f6['command'],_0x3a423a));}}return this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0x1ba'),_0x1fb6f6['command']));};AGIVertices[_0x42e5('0x17')][_0x42e5('0x1bb')]=function(_0x30c2d4){logger[_0x42e5('0x30')](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x30c2d4[_0x42e5('0x3b')]));_0x30c2d4[_0x42e5('0x62')]=_0x30c2d4[_0x42e5('0x62')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x42e5('0x8b')](_0x30c2d4[_0x42e5('0x60')])){return this['channel'][_0x42e5('0xaa')](_0x42e5('0x1bc'));}if(!this['isConfigured'](_0x30c2d4['text'])){return this['channel'][_0x42e5('0xaa')]('no\x20text\x20configured');}this[_0x42e5('0xf')][_0x42e5('0xaa')](util['format']('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x30c2d4[_0x42e5('0x62')]));var _0x2ab5ed=this[_0x42e5('0x5f')][_0x42e5('0xc2')](this,_0x30c2d4);if(_0x2ab5ed){this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x2ab5ed));var _0x2f5abb=this[_0x42e5('0xf')][_0x42e5('0x123')](_0x2ab5ed);try{fs[_0x42e5('0x100')](_0x2ab5ed+'.wav');}catch(_0x266bd0){logger[_0x42e5('0x2f')](_0x266bd0);}return _0x2f5abb;}return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x30c2d4,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype']['tts']=function(_0x57d595){logger['info'](util[_0x42e5('0x2d')](_0x42e5('0x1bd'),_0x57d595[_0x42e5('0x3b')]));_0x57d595['text']=_0x57d595[_0x42e5('0x62')][_0x42e5('0x5e')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x57d595['text'])){return this[_0x42e5('0xf')][_0x42e5('0xaa')](_0x42e5('0xab'));}this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0x1be'),_0x57d595[_0x42e5('0x62')]));var _0x371e9c=this[_0x42e5('0x68')][_0x42e5('0xc2')](this,_0x57d595);if(_0x371e9c){this[_0x42e5('0xf')][_0x42e5('0xaa')](util['format'](_0x42e5('0x1bf'),_0x371e9c));var _0x229ec0=this[_0x42e5('0xf')][_0x42e5('0x123')](_0x371e9c);try{fs[_0x42e5('0x100')](_0x371e9c+'.wav');}catch(_0x1a4084){logger[_0x42e5('0x2f')](_0x1a4084);}return _0x229ec0;}return this['channel'][_0x42e5('0x2f')](_0x57d595,_0x42e5('0x1c0'));};AGIVertices[_0x42e5('0x17')][_0x42e5('0x1c1')]=function(_0x32b6ea){logger['info'](util[_0x42e5('0x2d')](_0x42e5('0x1c2'),_0x32b6ea['label']));if(!this['isConfigured'](_0x32b6ea['findBy'])){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x32b6ea,_0x42e5('0x15c'));}logger['info'](util[_0x42e5('0x2d')](_0x42e5('0x15d'),this[_0x42e5('0xf')][_0x42e5('0x3e')],_0x32b6ea[_0x42e5('0x155')]));var _0x10f098=this[_0x42e5('0x56')][_0x42e5('0xc2')](this,_0x32b6ea['findBy']);if(_0x10f098){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x156'),this['channel'][_0x42e5('0x3e')],_0x32b6ea['findBy']));this[_0x42e5('0xf')][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0x156'),this['channel']['callerid'],_0x32b6ea[_0x42e5('0x155')]));return{'code':0xc8,'result':'success'};}else{logger[_0x42e5('0x30')](util[_0x42e5('0x2d')](_0x42e5('0x158'),this[_0x42e5('0xf')][_0x42e5('0x3e')],_0x32b6ea[_0x42e5('0x155')]));this[_0x42e5('0xf')][_0x42e5('0xaa')](util['format'](_0x42e5('0x158'),this['channel'][_0x42e5('0x3e')],_0x32b6ea['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x42e5('0x17')][_0x42e5('0x1c3')]=function(_0x34bab8){logger['info'](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x34bab8[_0x42e5('0x3b')]));var _0x4a6df6=this[_0x42e5('0xf')][_0x42e5('0x5c')](_0x42e5('0x1c4'),[_0x34bab8[_0x42e5('0x1c5')],_0x34bab8[_0x42e5('0x7d')]]);if(_0x4a6df6[_0x42e5('0xa5')]===-0x1){return _0x4a6df6;}return this['channel'][_0x42e5('0xaa')](util[_0x42e5('0x2d')](_0x42e5('0xc6'),_0x42e5('0x1c4'),_0x34bab8['mailbox']));};AGIVertices[_0x42e5('0x17')]['vswitch']=function(_0x23dc9e){logger[_0x42e5('0x30')](util[_0x42e5('0x2d')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x23dc9e[_0x42e5('0x3b')]));if(!this['isConfigured'](_0x23dc9e[_0x42e5('0x111')])){return this[_0x42e5('0xf')]['error'](_0x23dc9e,_0x42e5('0x1a9'));}var _0x1f77cb=this['getVariable'][_0x42e5('0xc2')](this,_0x23dc9e['variable_id']);if(!_0x1f77cb){return this[_0x42e5('0xf')][_0x42e5('0x2f')](_0x23dc9e,_0x42e5('0xda'));}var _0x150bcf=this[_0x42e5('0xf')]['getVariable'](_0x1f77cb);return{'code':0xc8,'result':_0x150bcf[_0x42e5('0xa6')]?_0x150bcf['extra']:'-'};};String['prototype'][_0x42e5('0xa3')]=function(_0x17e8f1,_0x3fa4e0){return this[_0x42e5('0xa2')](_0x17e8f1)[_0x42e5('0x1c6')](_0x3fa4e0);};module[_0x42e5('0x1c7')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 203415e..6583a80 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 _0x4b84=['catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[TIMER][STOP][AGENT:%s]','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','../../../config/logger','../rpc/voiceAgentReport','voiceQueues','timers','channels','syncAgentConnect','syncHangupRequest','bind','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','syncAgentConnectPreview','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','name','mandatoryDispositionPause','Action','QueuePause','then','agents','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','timer','stopAcw','format','updateAcw','lastPauseAt','update','uniqueid'];(function(_0x2407f7,_0x196839){var _0xc02d7c=function(_0x209d8c){while(--_0x209d8c){_0x2407f7['push'](_0x2407f7['shift']());}};_0xc02d7c(++_0x196839);}(_0x4b84,0x1cc));var _0x44b8=function(_0x175a55,_0x4082fd){_0x175a55=_0x175a55-0x0;var _0x167adf=_0x4b84[_0x175a55];return _0x167adf;};'use strict';var util=require(_0x44b8('0x0'));var _=require(_0x44b8('0x1'));var moment=require('moment');var ami=require('../ami');var logger=require(_0x44b8('0x2'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x44b8('0x3'));function Acw(_0x31282a){this[_0x44b8('0x4')]=_0x31282a['voiceQueues'];this['agents']=_0x31282a['agents'];this[_0x44b8('0x5')]=_0x31282a['timers'];this[_0x44b8('0x6')]={};ami['on']('agentconnect',this[_0x44b8('0x7')]['bind'](this));ami['on']('hanguprequest',this[_0x44b8('0x8')][_0x44b8('0x9')](this));ami['on'](_0x44b8('0xa'),this['syncHangup'][_0x44b8('0x9')](this));ami['on'](_0x44b8('0xb'),this[_0x44b8('0xc')][_0x44b8('0x9')](this));ami['on'](_0x44b8('0xd'),this[_0x44b8('0xe')][_0x44b8('0x9')](this));ami['on']('blindtransfer',this[_0x44b8('0xf')][_0x44b8('0x9')](this));ami['on']('custom:agentConnectPreview',this[_0x44b8('0x10')]['bind'](this));}function getDiff(_0x833ea3){var _0x18d642=moment()['milliseconds'](0x0);var _0x63e8f6=moment(_0x833ea3)['milliseconds'](0x0);return _0x18d642['diff'](_0x63e8f6,_0x44b8('0x11'));}Acw[_0x44b8('0x12')][_0x44b8('0x13')]=function(_0x41ab46){try{var _0x5e52f2=this;var _0x495c74=this['channels'][_0x41ab46][_0x44b8('0x14')];var _0x5b7803=this[_0x44b8('0x6')][_0x41ab46][_0x44b8('0x15')];var _0x55e258=this[_0x44b8('0x4')][_0x5b7803];var _0xe3de8f=![];var _0x5103f5=_0x44b8('0x16');if(_0x55e258[_0x44b8('0x17')]){if(_0x55e258['mandatoryDispositionPause'][_0x44b8('0x18')]){_0xe3de8f=!![];_0x5103f5=_0x55e258[_0x44b8('0x19')][_0x44b8('0x18')];}}ami[_0x44b8('0x1a')]({'action':_0x44b8('0x1b'),'interface':_0x495c74,'paused':!![],'reason':_0x5103f5})[_0x44b8('0x1c')](function(_0x452f2f){if(_0x5e52f2[_0x44b8('0x1d')][_0x495c74]){return RpcUser[_0x44b8('0x1e')](_0x5e52f2[_0x44b8('0x1d')][_0x495c74]['id'])[_0x44b8('0x1c')](function(_0x14996c){if(_0x14996c&&!_0x14996c['voicePause']){logger[_0x44b8('0x1f')](_0x44b8('0x20'),_0x41ab46,_0x495c74,_0x5b7803);var _0x416b34=_0x5e52f2[_0x44b8('0x6')][_0x41ab46][_0x44b8('0x21')]&&_0x5e52f2['channels'][_0x41ab46][_0x44b8('0x22')]?_0x5e52f2['channels'][_0x41ab46][_0x44b8('0x22')]:_0x41ab46;return RpcUser[_0x44b8('0x23')](_0x5e52f2[_0x44b8('0x1d')][_0x495c74],_0x5103f5,_0x416b34)[_0x44b8('0x1c')](function(_0x230a3d){if(!_0xe3de8f){_0x5e52f2['timers'][_0x495c74]={};logger[_0x44b8('0x1f')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x41ab46,_0x5e52f2[_0x44b8('0x4')][_0x5b7803][_0x44b8('0x24')],_0x495c74,_0x5b7803);_0x5e52f2['timers'][_0x495c74][_0x44b8('0x25')]=setTimeout(_0x5e52f2[_0x44b8('0x26')][_0x44b8('0x9')](_0x5e52f2,_0x495c74),_0x5e52f2['voiceQueues'][_0x5b7803][_0x44b8('0x24')]*0x3e8);_0x5e52f2[_0x44b8('0x5')][_0x495c74]['lastPauseAt']=moment()[_0x44b8('0x27')]('YYYY-MM-DD\x20HH:mm:ss');_0x5e52f2[_0x44b8('0x5')][_0x495c74]['uniqueid']=_0x41ab46;_0x5e52f2['timers'][_0x495c74]['queue']=_0x5b7803;_0x5e52f2[_0x44b8('0x5')][_0x495c74][_0x44b8('0x28')]=function(){var _0x44ce5a=getDiff(_0x5e52f2[_0x44b8('0x5')][_0x495c74][_0x44b8('0x29')]);clearTimeout(_0x5e52f2[_0x44b8('0x5')][_0x495c74][_0x44b8('0x25')]);_0x5e52f2[_0x44b8('0x5')][_0x495c74][_0x44b8('0x25')]=![];RpcVoiceAgentReport[_0x44b8('0x2a')]({'acwtime':_0x44ce5a},_0x5e52f2[_0x44b8('0x5')][_0x495c74][_0x44b8('0x2b')],_0x495c74)[_0x44b8('0x1c')](function(_0x5189dd){logger[_0x44b8('0x1f')]('[%s][UPDATE][ACWTIME:%s]',_0x41ab46,_0x44ce5a,_0x5189dd);})[_0x44b8('0x2c')](function(_0x1652cb){logger[_0x44b8('0x2d')](_0x44b8('0x2e'),_0x41ab46,_0x1652cb);});delete _0x5e52f2[_0x44b8('0x5')][_0x495c74];};}});}else{logger['info'](_0x44b8('0x2f'),_0x41ab46,_0x495c74,_0x5b7803);}});}})[_0x44b8('0x2c')](function(_0x26265f){logger[_0x44b8('0x2d')](_0x44b8('0x30'),_0x41ab46,_0x5e52f2['voiceQueues'][_0x5b7803][_0x44b8('0x24')],_0x495c74,_0x5b7803);})[_0x44b8('0x31')](function(){delete _0x5e52f2[_0x44b8('0x6')][_0x41ab46];});}catch(_0x3e93af){logger[_0x44b8('0x2d')](_0x44b8('0x32'),_0x3e93af[_0x44b8('0x33')]);}};Acw[_0x44b8('0x12')][_0x44b8('0x26')]=function(_0x181761){try{var _0x13994c=this;if(_0x13994c[_0x44b8('0x5')][_0x181761]){_0x13994c[_0x44b8('0x5')][_0x181761][_0x44b8('0x25')]=![];var _0x1e1a8a=_0x13994c[_0x44b8('0x5')][_0x181761][_0x44b8('0x2b')];var _0xeff999=_0x13994c[_0x44b8('0x5')][_0x181761][_0x44b8('0x15')];var _0x2c02d6=_0x13994c[_0x44b8('0x4')][_0xeff999]['acwTimeout'];logger[_0x44b8('0x1f')](_0x44b8('0x34'),_0x181761);RpcUser['saveUnpause'](this[_0x44b8('0x1d')][_0x181761]);RpcVoiceAgentReport[_0x44b8('0x2a')]({'acwtime':_0x2c02d6,'agentacw':!![]},_0x1e1a8a,_0x181761)[_0x44b8('0x1c')](function(_0x332c2b){logger['info'](_0x44b8('0x35'),_0x1e1a8a,_0x2c02d6,_0x332c2b);})[_0x44b8('0x2c')](function(_0x3611b4){logger[_0x44b8('0x2d')](_0x44b8('0x2e'),_0x1e1a8a,_0x3611b4);});}else{logger[_0x44b8('0x2d')](_0x44b8('0x36'),_0x181761);if(_0x13994c[_0x44b8('0x5')]){logger[_0x44b8('0x1f')](_0x44b8('0x37'),JSON[_0x44b8('0x38')](_0x13994c[_0x44b8('0x5')]));}}}catch(_0xd69398){logger[_0x44b8('0x2d')](_0x44b8('0x39'),_0xd69398[_0x44b8('0x33')]);}};Acw['prototype'][_0x44b8('0x7')]=function(_0x43e43a){try{if(this[_0x44b8('0x4')][_0x43e43a['queue']]&&(this[_0x44b8('0x4')][_0x43e43a[_0x44b8('0x15')]][_0x44b8('0x3a')]||this['voiceQueues'][_0x43e43a[_0x44b8('0x15')]][_0x44b8('0x17')])){if(this[_0x44b8('0x1d')][_0x43e43a[_0x44b8('0x14')]]){this[_0x44b8('0x6')][_0x43e43a['uniqueid']]={'queue':_0x43e43a['queue'],'interface':_0x43e43a[_0x44b8('0x14')],'destlinkedid':_0x43e43a[_0x44b8('0x22')]};}}}catch(_0x430257){logger[_0x44b8('0x2d')](_0x44b8('0x3b'),_0x430257[_0x44b8('0x33')]);}};Acw[_0x44b8('0x12')][_0x44b8('0x10')]=function(_0x455fd6){try{if(this[_0x44b8('0x4')][_0x455fd6[_0x44b8('0x15')]]&&(this[_0x44b8('0x4')][_0x455fd6[_0x44b8('0x15')]][_0x44b8('0x3a')]||this[_0x44b8('0x4')][_0x455fd6[_0x44b8('0x15')]][_0x44b8('0x17')])){if(this[_0x44b8('0x1d')][_0x455fd6[_0x44b8('0x14')]]){this['channels'][_0x455fd6['uniqueid']]={'queue':_0x455fd6[_0x44b8('0x15')],'interface':_0x455fd6[_0x44b8('0x14')]};}}}catch(_0x15f183){logger[_0x44b8('0x2d')](_0x44b8('0x3c'),_0x15f183[_0x44b8('0x33')]);}};Acw[_0x44b8('0x12')]['syncHangupRequest']=function(_0x156070){try{if(this['channels'][_0x156070[_0x44b8('0x2b')]]&&_[_0x44b8('0x3d')](this[_0x44b8('0x6')][_0x156070[_0x44b8('0x2b')]][_0x44b8('0x21')])){logger[_0x44b8('0x1f')]('[%s][HANGUP:UNIQUEID]',_0x156070[_0x44b8('0x2b')]);this[_0x44b8('0x13')](_0x156070[_0x44b8('0x2b')]);}else if(this[_0x44b8('0x6')][_0x156070['linkedid']]&&_[_0x44b8('0x3d')](this[_0x44b8('0x6')][_0x156070[_0x44b8('0x3e')]][_0x44b8('0x21')])){logger[_0x44b8('0x1f')](_0x44b8('0x3f'),_0x156070['linkedid']);this[_0x44b8('0x13')](_0x156070[_0x44b8('0x3e')]);}}catch(_0x2c5c27){logger[_0x44b8('0x2d')](_0x44b8('0x40'),_0x2c5c27['message']);}};Acw['prototype'][_0x44b8('0x41')]=function(_0x4eb344){try{if(this[_0x44b8('0x6')][_0x4eb344['uniqueid']]&&this[_0x44b8('0x6')][_0x4eb344[_0x44b8('0x2b')]][_0x44b8('0x21')]){logger[_0x44b8('0x1f')](_0x44b8('0x42'),_0x4eb344[_0x44b8('0x2b')]);this[_0x44b8('0x13')](_0x4eb344['uniqueid']);}else if(this[_0x44b8('0x6')][_0x4eb344[_0x44b8('0x3e')]]&&this[_0x44b8('0x6')][_0x4eb344['linkedid']][_0x44b8('0x21')]){logger[_0x44b8('0x1f')](_0x44b8('0x43'),_0x4eb344[_0x44b8('0x3e')]);this['startAcw'](_0x4eb344[_0x44b8('0x3e')]);}}catch(_0x308f7b){logger['error'](_0x44b8('0x44'),_0x308f7b[_0x44b8('0x33')]);}};Acw[_0x44b8('0x12')][_0x44b8('0xe')]=function(_0xe86e34){try{if(!_['isNil'](this['channels'][_0xe86e34[_0x44b8('0x45')]])){this[_0x44b8('0x13')](_0xe86e34[_0x44b8('0x45')]);if(this[_0x44b8('0x6')][_0xe86e34[_0x44b8('0x46')]]){this[_0x44b8('0x6')][_0xe86e34[_0x44b8('0x46')]][_0x44b8('0x21')]=!![];this[_0x44b8('0x6')][_0xe86e34[_0x44b8('0x47')]]=this[_0x44b8('0x6')][_0xe86e34[_0x44b8('0x46')]];delete this['channels'][_0xe86e34[_0x44b8('0x46')]];}}else if(!_[_0x44b8('0x48')](this[_0x44b8('0x6')][_0xe86e34[_0x44b8('0x47')]])){this[_0x44b8('0x13')](_0xe86e34[_0x44b8('0x47')]);if(this[_0x44b8('0x6')][_0xe86e34[_0x44b8('0x49')]]){this[_0x44b8('0x6')][_0xe86e34[_0x44b8('0x49')]][_0x44b8('0x21')]=!![];this[_0x44b8('0x6')][_0xe86e34[_0x44b8('0x45')]]=this[_0x44b8('0x6')][_0xe86e34[_0x44b8('0x49')]];delete this[_0x44b8('0x6')][_0xe86e34[_0x44b8('0x49')]];}}}catch(_0x20e563){logger['error'](_0x44b8('0x4a'),_0x20e563[_0x44b8('0x33')]);}};Acw[_0x44b8('0x12')][_0x44b8('0xf')]=function(_0x51f763){try{if(this[_0x44b8('0x6')][_0x51f763[_0x44b8('0x4b')]]){logger['info'](_0x44b8('0x4c'),JSON[_0x44b8('0x38')](_0x51f763['transfereruniqueid']));this[_0x44b8('0x13')](_0x51f763[_0x44b8('0x4b')]);}else if(this['channels'][_0x51f763[_0x44b8('0x4d')]]){logger[_0x44b8('0x1f')](_0x44b8('0x4e'),JSON['stringify'](_0x51f763[_0x44b8('0x4d')]));this['startAcw'](_0x51f763[_0x44b8('0x4d')]);}}catch(_0x5161ea){logger[_0x44b8('0x2d')](_0x44b8('0x4f'),_0x5161ea[_0x44b8('0x33')]);}};Acw[_0x44b8('0x12')][_0x44b8('0xc')]=function(_0x230b6a){try{if(this['voiceQueues'][_0x230b6a[_0x44b8('0x15')]]&&this['voiceQueues'][_0x230b6a[_0x44b8('0x15')]][_0x44b8('0x50')]==='all'){if(this[_0x44b8('0x1d')][_0x230b6a[_0x44b8('0x14')]]){logger[_0x44b8('0x1f')](_0x44b8('0x51'),_0x230b6a[_0x44b8('0x2b')],_0x230b6a[_0x44b8('0x14')],_0x230b6a[_0x44b8('0x15')]);return RpcUser[_0x44b8('0x23')](this[_0x44b8('0x1d')][_0x230b6a[_0x44b8('0x14')]],_0x44b8('0x52'),_0x230b6a[_0x44b8('0x2b')]);}}}catch(_0x52381a){logger[_0x44b8('0x2d')](_0x44b8('0x53'),_0x52381a[_0x44b8('0x33')]);}};module['exports']=Acw; \ No newline at end of file +var _0x0e85=['[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','uniqueid','queue','updateAcw','update','catch','error','[%s][UPDATE][ERRORS:%s]','[ACW][START]\x20%s','prototype','[TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','message','acw','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','linkedid','isUndefined','attended','[%s][HANGUP:LINKEDID]','startAcw','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfertargetuniqueid','secondtransfereruniqueid','origtransfereruniqueid','transfereeuniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','../ami','../../../config/logger','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','milliseconds','diff','seconds','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','Action','QueuePause','then','voicePause','info','destlinkedid','savePause'];(function(_0x57700c,_0x2ce00d){var _0x4af434=function(_0x4ebeab){while(--_0x4ebeab){_0x57700c['push'](_0x57700c['shift']());}};_0x4af434(++_0x2ce00d);}(_0x0e85,0x7c));var _0x50e8=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x0e85[_0x476bf4];return _0x788ffe;};'use strict';var util=require(_0x50e8('0x0'));var _=require(_0x50e8('0x1'));var moment=require('moment');var ami=require(_0x50e8('0x2'));var logger=require(_0x50e8('0x3'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x236cf3){this['voiceQueues']=_0x236cf3[_0x50e8('0x4')];this[_0x50e8('0x5')]=_0x236cf3[_0x50e8('0x5')];this[_0x50e8('0x6')]=_0x236cf3['timers'];this[_0x50e8('0x7')]={};ami['on'](_0x50e8('0x8'),this[_0x50e8('0x9')][_0x50e8('0xa')](this));ami['on'](_0x50e8('0xb'),this[_0x50e8('0xc')]['bind'](this));ami['on'](_0x50e8('0xd'),this[_0x50e8('0xe')][_0x50e8('0xa')](this));ami['on'](_0x50e8('0xf'),this[_0x50e8('0x10')][_0x50e8('0xa')](this));ami['on'](_0x50e8('0x11'),this[_0x50e8('0x12')]['bind'](this));ami['on']('blindtransfer',this[_0x50e8('0x13')][_0x50e8('0xa')](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview'][_0x50e8('0xa')](this));}function getDiff(_0x2abda1){var _0x1a4c85=moment()[_0x50e8('0x14')](0x0);var _0x54efd3=moment(_0x2abda1)[_0x50e8('0x14')](0x0);return _0x1a4c85[_0x50e8('0x15')](_0x54efd3,_0x50e8('0x16'));}Acw['prototype']['startAcw']=function(_0x30a872){try{var _0xf02b48=this;var _0x40c184=this[_0x50e8('0x7')][_0x30a872][_0x50e8('0x17')];var _0x1f0338=this['channels'][_0x30a872]['queue'];var _0x441f25=this[_0x50e8('0x4')][_0x1f0338];var _0x40d060=![];var _0x45ce11=_0x50e8('0x18');if(_0x441f25[_0x50e8('0x19')]){if(_0x441f25[_0x50e8('0x1a')]['name']){_0x40d060=!![];_0x45ce11=_0x441f25[_0x50e8('0x1a')]['name'];}}ami[_0x50e8('0x1b')]({'action':_0x50e8('0x1c'),'interface':_0x40c184,'paused':!![],'reason':_0x45ce11})[_0x50e8('0x1d')](function(_0x20f835){if(_0xf02b48[_0x50e8('0x5')][_0x40c184]){return RpcUser['getAgent'](_0xf02b48[_0x50e8('0x5')][_0x40c184]['id'])[_0x50e8('0x1d')](function(_0x58110d){if(_0x58110d&&!_0x58110d[_0x50e8('0x1e')]){logger[_0x50e8('0x1f')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x30a872,_0x40c184,_0x1f0338);var _0x1ce7fc=_0xf02b48[_0x50e8('0x7')][_0x30a872]['attended']&&_0xf02b48['channels'][_0x30a872]['destlinkedid']?_0xf02b48[_0x50e8('0x7')][_0x30a872][_0x50e8('0x20')]:_0x30a872;return RpcUser[_0x50e8('0x21')](_0xf02b48[_0x50e8('0x5')][_0x40c184],_0x45ce11,_0x1ce7fc)[_0x50e8('0x1d')](function(_0x13b6e9){if(!_0x40d060){_0xf02b48['timers'][_0x40c184]={};logger[_0x50e8('0x1f')](_0x50e8('0x22'),_0x30a872,_0xf02b48['voiceQueues'][_0x1f0338][_0x50e8('0x23')],_0x40c184,_0x1f0338);_0xf02b48[_0x50e8('0x6')][_0x40c184][_0x50e8('0x24')]=setTimeout(_0xf02b48[_0x50e8('0x25')]['bind'](_0xf02b48,_0x40c184),_0xf02b48[_0x50e8('0x4')][_0x1f0338]['acwTimeout']*0x3e8);_0xf02b48[_0x50e8('0x6')][_0x40c184][_0x50e8('0x26')]=moment()[_0x50e8('0x27')]('YYYY-MM-DD\x20HH:mm:ss');_0xf02b48[_0x50e8('0x6')][_0x40c184][_0x50e8('0x28')]=_0x30a872;_0xf02b48[_0x50e8('0x6')][_0x40c184][_0x50e8('0x29')]=_0x1f0338;_0xf02b48[_0x50e8('0x6')][_0x40c184][_0x50e8('0x2a')]=function(){var _0x2c6fb3=getDiff(_0xf02b48['timers'][_0x40c184][_0x50e8('0x26')]);clearTimeout(_0xf02b48[_0x50e8('0x6')][_0x40c184]['timer']);_0xf02b48['timers'][_0x40c184][_0x50e8('0x24')]=![];RpcVoiceAgentReport[_0x50e8('0x2b')]({'acwtime':_0x2c6fb3},_0xf02b48[_0x50e8('0x6')][_0x40c184]['uniqueid'],_0x40c184)['then'](function(_0x3e58a9){logger[_0x50e8('0x1f')]('[%s][UPDATE][ACWTIME:%s]',_0x30a872,_0x2c6fb3,_0x3e58a9);})[_0x50e8('0x2c')](function(_0x17c6a5){logger[_0x50e8('0x2d')](_0x50e8('0x2e'),_0x30a872,_0x17c6a5);});delete _0xf02b48['timers'][_0x40c184];};}});}else{logger[_0x50e8('0x1f')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x30a872,_0x40c184,_0x1f0338);}});}})[_0x50e8('0x2c')](function(_0x33fc5b){logger[_0x50e8('0x2d')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x30a872,_0xf02b48[_0x50e8('0x4')][_0x1f0338][_0x50e8('0x23')],_0x40c184,_0x1f0338);})['finally'](function(){delete _0xf02b48[_0x50e8('0x7')][_0x30a872];});}catch(_0x1c2fdb){logger[_0x50e8('0x2d')](_0x50e8('0x2f'),_0x1c2fdb['message']);}};Acw[_0x50e8('0x30')][_0x50e8('0x25')]=function(_0x24d3ea){try{var _0x4e2a37=this;if(_0x4e2a37['timers'][_0x24d3ea]){_0x4e2a37[_0x50e8('0x6')][_0x24d3ea][_0x50e8('0x24')]=![];var _0x3f01ee=_0x4e2a37['timers'][_0x24d3ea]['uniqueid'];var _0x5dff99=_0x4e2a37[_0x50e8('0x6')][_0x24d3ea][_0x50e8('0x29')];var _0x2cbee3=_0x4e2a37[_0x50e8('0x4')][_0x5dff99][_0x50e8('0x23')];logger[_0x50e8('0x1f')](_0x50e8('0x31'),_0x24d3ea);RpcUser[_0x50e8('0x32')](this[_0x50e8('0x5')][_0x24d3ea]);RpcVoiceAgentReport[_0x50e8('0x2b')]({'acwtime':_0x2cbee3,'agentacw':!![]},_0x3f01ee,_0x24d3ea)['then'](function(_0x3371a4){logger[_0x50e8('0x1f')](_0x50e8('0x33'),_0x3f01ee,_0x2cbee3,_0x3371a4);})[_0x50e8('0x2c')](function(_0x5dbbe1){logger[_0x50e8('0x2d')](_0x50e8('0x2e'),_0x3f01ee,_0x5dbbe1);});}else{logger[_0x50e8('0x2d')](_0x50e8('0x34'),_0x24d3ea);if(_0x4e2a37[_0x50e8('0x6')]){logger['info']('[ACW][TIMERS]',JSON[_0x50e8('0x35')](_0x4e2a37[_0x50e8('0x6')]));}}}catch(_0x53705e){logger[_0x50e8('0x2d')](_0x50e8('0x36'),_0x53705e[_0x50e8('0x37')]);}};Acw[_0x50e8('0x30')][_0x50e8('0x9')]=function(_0x313e7b){try{if(this[_0x50e8('0x4')][_0x313e7b[_0x50e8('0x29')]]&&(this['voiceQueues'][_0x313e7b[_0x50e8('0x29')]][_0x50e8('0x38')]||this[_0x50e8('0x4')][_0x313e7b[_0x50e8('0x29')]]['mandatoryDisposition'])){if(this[_0x50e8('0x5')][_0x313e7b[_0x50e8('0x17')]]){this[_0x50e8('0x7')][_0x313e7b[_0x50e8('0x28')]]={'queue':_0x313e7b['queue'],'interface':_0x313e7b[_0x50e8('0x17')],'destlinkedid':_0x313e7b['destlinkedid']};}}}catch(_0x4a2619){logger['error'](_0x50e8('0x39'),_0x4a2619[_0x50e8('0x37')]);}};Acw['prototype'][_0x50e8('0x3a')]=function(_0x2007c4){try{if(this[_0x50e8('0x4')][_0x2007c4[_0x50e8('0x29')]]&&(this[_0x50e8('0x4')][_0x2007c4[_0x50e8('0x29')]]['acw']||this[_0x50e8('0x4')][_0x2007c4['queue']][_0x50e8('0x19')])){if(this[_0x50e8('0x5')][_0x2007c4['interface']]){this[_0x50e8('0x7')][_0x2007c4['uniqueid']]={'queue':_0x2007c4[_0x50e8('0x29')],'interface':_0x2007c4[_0x50e8('0x17')]};}}}catch(_0x2e55ed){logger[_0x50e8('0x2d')](_0x50e8('0x3b'),_0x2e55ed[_0x50e8('0x37')]);}};Acw[_0x50e8('0x30')][_0x50e8('0xc')]=function(_0x141bd4){try{if(this[_0x50e8('0x7')][_0x141bd4[_0x50e8('0x28')]]&&_['isUndefined'](this[_0x50e8('0x7')][_0x141bd4[_0x50e8('0x28')]]['attended'])){logger[_0x50e8('0x1f')]('[%s][HANGUP:UNIQUEID]',_0x141bd4[_0x50e8('0x28')]);this['startAcw'](_0x141bd4[_0x50e8('0x28')]);}else if(this[_0x50e8('0x7')][_0x141bd4[_0x50e8('0x3c')]]&&_[_0x50e8('0x3d')](this[_0x50e8('0x7')][_0x141bd4[_0x50e8('0x3c')]][_0x50e8('0x3e')])){logger['info'](_0x50e8('0x3f'),_0x141bd4[_0x50e8('0x3c')]);this[_0x50e8('0x40')](_0x141bd4[_0x50e8('0x3c')]);}}catch(_0x3303f5){logger[_0x50e8('0x2d')]('[ACW][syncHangupRequest]\x20%s',_0x3303f5[_0x50e8('0x37')]);}};Acw[_0x50e8('0x30')][_0x50e8('0xe')]=function(_0x27c80a){try{if(this['channels'][_0x27c80a[_0x50e8('0x28')]]&&this[_0x50e8('0x7')][_0x27c80a[_0x50e8('0x28')]][_0x50e8('0x3e')]){logger[_0x50e8('0x1f')](_0x50e8('0x41'),_0x27c80a[_0x50e8('0x28')]);this['startAcw'](_0x27c80a['uniqueid']);}else if(this['channels'][_0x27c80a[_0x50e8('0x3c')]]&&this[_0x50e8('0x7')][_0x27c80a[_0x50e8('0x3c')]][_0x50e8('0x3e')]){logger[_0x50e8('0x1f')](_0x50e8('0x42'),_0x27c80a['linkedid']);this[_0x50e8('0x40')](_0x27c80a[_0x50e8('0x3c')]);}}catch(_0x460c8e){logger[_0x50e8('0x2d')]('[ACW][syncHangup]\x20%s',_0x460c8e[_0x50e8('0x37')]);}};Acw[_0x50e8('0x30')][_0x50e8('0x12')]=function(_0x1cc5ba){try{if(!_[_0x50e8('0x43')](this[_0x50e8('0x7')][_0x1cc5ba['transfereeuniqueid']])){this[_0x50e8('0x40')](_0x1cc5ba['transfereeuniqueid']);if(this['channels'][_0x1cc5ba['secondtransfereruniqueid']]){this[_0x50e8('0x7')][_0x1cc5ba['secondtransfereruniqueid']][_0x50e8('0x3e')]=!![];this[_0x50e8('0x7')][_0x1cc5ba[_0x50e8('0x44')]]=this[_0x50e8('0x7')][_0x1cc5ba[_0x50e8('0x45')]];delete this[_0x50e8('0x7')][_0x1cc5ba[_0x50e8('0x45')]];}}else if(!_['isNil'](this[_0x50e8('0x7')][_0x1cc5ba[_0x50e8('0x44')]])){this[_0x50e8('0x40')](_0x1cc5ba['transfertargetuniqueid']);if(this['channels'][_0x1cc5ba['origtransfereruniqueid']]){this[_0x50e8('0x7')][_0x1cc5ba[_0x50e8('0x46')]][_0x50e8('0x3e')]=!![];this[_0x50e8('0x7')][_0x1cc5ba[_0x50e8('0x47')]]=this[_0x50e8('0x7')][_0x1cc5ba['origtransfereruniqueid']];delete this[_0x50e8('0x7')][_0x1cc5ba['origtransfereruniqueid']];}}}catch(_0x255b48){logger[_0x50e8('0x2d')]('[ACW][syncAttendedTransfer]\x20%s',_0x255b48['message']);}};Acw['prototype'][_0x50e8('0x13')]=function(_0x3588f0){try{if(this['channels'][_0x3588f0[_0x50e8('0x48')]]){logger[_0x50e8('0x1f')](_0x50e8('0x49'),JSON[_0x50e8('0x35')](_0x3588f0[_0x50e8('0x48')]));this['startAcw'](_0x3588f0[_0x50e8('0x48')]);}else if(this[_0x50e8('0x7')][_0x3588f0[_0x50e8('0x4a')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x50e8('0x35')](_0x3588f0[_0x50e8('0x4a')]));this[_0x50e8('0x40')](_0x3588f0[_0x50e8('0x4a')]);}}catch(_0x2b59f5){logger[_0x50e8('0x2d')]('[ACW][syncBlindTransfer]\x20%s',_0x2b59f5['message']);}};Acw[_0x50e8('0x30')]['syncAgentRingNoAnswer']=function(_0x1fc530){try{if(this[_0x50e8('0x4')][_0x1fc530['queue']]&&this[_0x50e8('0x4')][_0x1fc530['queue']]['autopause']==='all'){if(this[_0x50e8('0x5')][_0x1fc530[_0x50e8('0x17')]]){logger[_0x50e8('0x1f')](_0x50e8('0x4b'),_0x1fc530['uniqueid'],_0x1fc530['interface'],_0x1fc530[_0x50e8('0x29')]);return RpcUser[_0x50e8('0x21')](this[_0x50e8('0x5')][_0x1fc530[_0x50e8('0x17')]],_0x50e8('0x4c'),_0x1fc530[_0x50e8('0x28')]);}}}catch(_0x42e1dd){logger[_0x50e8('0x2d')](_0x50e8('0x4d'),_0x42e1dd[_0x50e8('0x37')]);}};module[_0x50e8('0x4e')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 312f253..028a8c5 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 _0x0414=['Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','info','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','log','exports','asterisk-manager','bluebird','moment','lodash','../../config/logger','ami','../../config/environment','asterisk','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','username','actionSipShowRegistry','sipshowregistry','devicestatelist','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','once','close','connect','shutdown'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x0414,0x100));var _0x4041=function(_0x4358f5,_0x5b1ac6){_0x4358f5=_0x4358f5-0x0;var _0x4d8104=_0x0414[_0x4358f5];return _0x4d8104;};'use strict';var Manager=require(_0x4041('0x0'));var BPromise=require(_0x4041('0x1'));var moment=require(_0x4041('0x2'));var util=require('util');var _=require(_0x4041('0x3'));var logger=require(_0x4041('0x4'))(_0x4041('0x5'));var config=require(_0x4041('0x6'));var ami=new Manager(config['asterisk']['port'],config[_0x4041('0x7')]['ip'],config[_0x4041('0x7')]['username'],config['asterisk'][_0x4041('0x8')],!![]);ami[_0x4041('0x9')]();ami[_0x4041('0xa')]=BPromise[_0x4041('0xb')](ami[_0x4041('0xc')]);function error(_0x1910fd){logger[_0x4041('0xd')](util[_0x4041('0xe')](_0x4041('0xf'),config[_0x4041('0x7')]['username'],config['asterisk']['ip'],config[_0x4041('0x7')][_0x4041('0x10')],util['inspect'](_0x1910fd,![],null)));}function close(){logger[_0x4041('0xd')](util[_0x4041('0xe')](_0x4041('0x11'),config[_0x4041('0x7')][_0x4041('0x12')],config[_0x4041('0x7')]['ip'],config['asterisk'][_0x4041('0x10')]));}ami[_0x4041('0x13')]=function(){return function(){return ami['Action']({'action':_0x4041('0x14')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x4041('0xa')]({'action':_0x4041('0x15')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x4041('0xa')]({'action':_0x4041('0x16')});};};ami[_0x4041('0x17')]=function(){return function(){return ami[_0x4041('0xa')]({'action':_0x4041('0x18')});};};ami[_0x4041('0x19')]=function(){return function(){return ami['Action']({'action':_0x4041('0x1a')});};};function connect(_0x202b1b){logger['info'](util[_0x4041('0xe')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk'][_0x4041('0x12')],config[_0x4041('0x7')]['ip'],config[_0x4041('0x7')]['port']));ami[_0x4041('0x1b')]('error',error);ami[_0x4041('0x1b')](_0x4041('0x1c'),close);}ami['on'](_0x4041('0x1d'),connect);ami['on'](_0x4041('0x1e'),function(_0x4fa648){logger['info'](util['format'](_0x4041('0x1f'),config[_0x4041('0x7')][_0x4041('0x12')],config[_0x4041('0x7')]['ip'],config[_0x4041('0x7')][_0x4041('0x10')],util[_0x4041('0x20')](_0x4fa648,![],null)));});ami['on'](_0x4041('0x21'),function(_0x94f19b){logger[_0x4041('0x22')](util[_0x4041('0xe')](_0x4041('0x23'),config[_0x4041('0x7')][_0x4041('0x12')],config[_0x4041('0x7')]['ip'],config['asterisk']['port']));return BPromise[_0x4041('0x24')]()[_0x4041('0x25')](ami[_0x4041('0x13')]())[_0x4041('0x25')](ami['actionDeviceStateList']())[_0x4041('0x25')](ami['actionSipPeerStatus']())['then'](ami['actionQueueSummary']())[_0x4041('0x25')](ami[_0x4041('0x19')]())[_0x4041('0x26')](function(_0x1cd174){console[_0x4041('0x27')](_0x1cd174);});});ami['once'](_0x4041('0xd'),error);ami[_0x4041('0x1b')](_0x4041('0x1c'),close);module[_0x4041('0x28')]=ami; \ No newline at end of file +var _0x65b3=['Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','log','exports','asterisk-manager','bluebird','util','lodash','../../config/logger','ami','../../config/environment','asterisk','port','password','keepConnected'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x65b3,0x18f));var _0x365b=function(_0x3f94f9,_0x42774b){_0x3f94f9=_0x3f94f9-0x0;var _0x46f84f=_0x65b3[_0x3f94f9];return _0x46f84f;};'use strict';var Manager=require(_0x365b('0x0'));var BPromise=require(_0x365b('0x1'));var moment=require('moment');var util=require(_0x365b('0x2'));var _=require(_0x365b('0x3'));var logger=require(_0x365b('0x4'))(_0x365b('0x5'));var config=require(_0x365b('0x6'));var ami=new Manager(config[_0x365b('0x7')][_0x365b('0x8')],config[_0x365b('0x7')]['ip'],config[_0x365b('0x7')]['username'],config['asterisk'][_0x365b('0x9')],!![]);ami[_0x365b('0xa')]();ami[_0x365b('0xb')]=BPromise[_0x365b('0xc')](ami[_0x365b('0xd')]);function error(_0xe71860){logger[_0x365b('0xe')](util[_0x365b('0xf')](_0x365b('0x10'),config[_0x365b('0x7')][_0x365b('0x11')],config[_0x365b('0x7')]['ip'],config[_0x365b('0x7')][_0x365b('0x8')],util[_0x365b('0x12')](_0xe71860,![],null)));}function close(){logger[_0x365b('0xe')](util[_0x365b('0xf')](_0x365b('0x13'),config[_0x365b('0x7')][_0x365b('0x11')],config['asterisk']['ip'],config[_0x365b('0x7')][_0x365b('0x8')]));}ami[_0x365b('0x14')]=function(){return function(){return ami['Action']({'action':_0x365b('0x15')});};};ami[_0x365b('0x16')]=function(){return function(){return ami[_0x365b('0xb')]({'action':_0x365b('0x17')});};};ami[_0x365b('0x18')]=function(){return function(){return ami[_0x365b('0xb')]({'action':_0x365b('0x19')});};};ami[_0x365b('0x1a')]=function(){return function(){return ami[_0x365b('0xb')]({'action':'queuesummary'});};};ami[_0x365b('0x1b')]=function(){return function(){return ami['Action']({'action':_0x365b('0x1c')});};};function connect(_0x180649){logger[_0x365b('0x1d')](util['format'](_0x365b('0x1e'),config[_0x365b('0x7')][_0x365b('0x11')],config[_0x365b('0x7')]['ip'],config[_0x365b('0x7')][_0x365b('0x8')]));ami[_0x365b('0x1f')](_0x365b('0xe'),error);ami[_0x365b('0x1f')]('close',close);}ami['on'](_0x365b('0x20'),connect);ami['on'](_0x365b('0x21'),function(_0x56ca2f){logger[_0x365b('0x1d')](util[_0x365b('0xf')](_0x365b('0x22'),config[_0x365b('0x7')][_0x365b('0x11')],config['asterisk']['ip'],config[_0x365b('0x7')][_0x365b('0x8')],util[_0x365b('0x12')](_0x56ca2f,![],null)));});ami['on'](_0x365b('0x23'),function(_0x227d7a){logger[_0x365b('0x1d')](util[_0x365b('0xf')](_0x365b('0x24'),config[_0x365b('0x7')][_0x365b('0x11')],config[_0x365b('0x7')]['ip'],config['asterisk'][_0x365b('0x8')]));return BPromise[_0x365b('0x25')]()[_0x365b('0x26')](ami[_0x365b('0x14')]())['then'](ami[_0x365b('0x16')]())[_0x365b('0x26')](ami[_0x365b('0x18')]())['then'](ami['actionQueueSummary']())[_0x365b('0x26')](ami[_0x365b('0x1b')]())['catch'](function(_0x558d84){console[_0x365b('0x27')](_0x558d84);});});ami['once'](_0x365b('0xe'),error);ami[_0x365b('0x1f')]('close',close);module[_0x365b('0x28')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index bbeaded..22c1d38 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 _0x1167=['then','debug','rpc','memberReport','error','message','result','catch','exports','bluebird','../../config/logger','ami','client','http','Request','request'];(function(_0x32404d,_0x1c843e){var _0xc65b07=function(_0x28752f){while(--_0x28752f){_0x32404d['push'](_0x32404d['shift']());}};_0xc65b07(++_0x1c843e);}(_0x1167,0xc9));var _0x7116=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1167[_0x17d9e3];return _0x14192d;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x7116('0x0'));var logger=require(_0x7116('0x1'))(_0x7116('0x2'));var client=jayson[_0x7116('0x3')][_0x7116('0x4')]({'port':0x2329});client[_0x7116('0x5')]=function(_0x5812f6,_0x2ac1f6){return new BPromise(function(_0x386780,_0x174b93){return client[_0x7116('0x6')](_0x5812f6,_0x2ac1f6)[_0x7116('0x7')](function(_0x2cf09a){logger[_0x7116('0x8')](_0x7116('0x9'),_0x7116('0xa'),_0x5812f6,_0x2ac1f6,_0x2cf09a);if(_0x2cf09a[_0x7116('0xb')]){logger[_0x7116('0xb')](_0x7116('0x9'),_0x7116('0xa'),_0x5812f6,_0x2cf09a['error'][_0x7116('0xc')],_0x2ac1f6);return _0x174b93(_0x2cf09a['error'][_0x7116('0xc')]);}else{return _0x386780(_0x2cf09a[_0x7116('0xd')]);}})[_0x7116('0xe')](function(_0x24debf){logger['error'](_0x7116('0x9'),_0x7116('0xa'),_0x5812f6,_0x24debf,_0x2ac1f6);return _0x174b93(_0x24debf);});});};module[_0x7116('0xf')]=client; \ No newline at end of file +var _0x5f74=['debug','rpc','memberReport','error','message','result','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','then'];(function(_0x4d935e,_0x1c3a7c){var _0x217fe5=function(_0x2a4650){while(--_0x2a4650){_0x4d935e['push'](_0x4d935e['shift']());}};_0x217fe5(++_0x1c3a7c);}(_0x5f74,0x12d));var _0x45f7=function(_0x502773,_0x482c17){_0x502773=_0x502773-0x0;var _0x55a2f6=_0x5f74[_0x502773];return _0x55a2f6;};'use strict';var jayson=require(_0x45f7('0x0'));var BPromise=require(_0x45f7('0x1'));var logger=require(_0x45f7('0x2'))('ami');var client=jayson[_0x45f7('0x3')][_0x45f7('0x4')]({'port':0x2329});client[_0x45f7('0x5')]=function(_0xb313d,_0x4c7fa1){return new BPromise(function(_0x9abe0b,_0x2ae1fa){return client['request'](_0xb313d,_0x4c7fa1)[_0x45f7('0x6')](function(_0x1ae1ae){logger[_0x45f7('0x7')](_0x45f7('0x8'),_0x45f7('0x9'),_0xb313d,_0x4c7fa1,_0x1ae1ae);if(_0x1ae1ae[_0x45f7('0xa')]){logger['error'](_0x45f7('0x8'),_0x45f7('0x9'),_0xb313d,_0x1ae1ae[_0x45f7('0xa')][_0x45f7('0xb')],_0x4c7fa1);return _0x2ae1fa(_0x1ae1ae[_0x45f7('0xa')][_0x45f7('0xb')]);}else{return _0x9abe0b(_0x1ae1ae[_0x45f7('0xc')]);}})['catch'](function(_0x20ad23){logger[_0x45f7('0xa')](_0x45f7('0x8'),_0x45f7('0x9'),_0xb313d,_0x20ad23,_0x4c7fa1);return _0x2ae1fa(_0x20ad23);});});};module[_0x45f7('0xd')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 3e00bab..3cd9a8c 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 _0x55f7=['dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','lastName','number','queue','active','type'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x55f7,0xe1));var _0x755f=function(_0x256879,_0x4c11a7){_0x256879=_0x256879-0x0;var _0x247021=_0x55f7[_0x256879];return _0x247021;};'use strict';var util=require(_0x755f('0x0'));var _=require(_0x755f('0x1'));var moment=require(_0x755f('0x2'));function checkNameSurname(_0x42bd9e,_0x281fc6,_0x470f13){var _0x356d12='';if(!_[_0x755f('0x3')](_0x281fc6)&&_0x755f('0x4')===typeof _0x281fc6){_0x356d12+=_0x281fc6;}if(!_[_0x755f('0x3')](_0x470f13)&&'string'===typeof _0x470f13){_0x356d12+='\x20'+_0x470f13;}if(_0x356d12!==''){return _0x356d12;}return _0x42bd9e;}function Action(_0x383941,_0x5cce63,_0x49c334){this[_0x755f('0x5')]=_0x383941;this[_0x755f('0x6')]=_0x49c334||undefined;this[_0x755f('0x7')]=checkNameSurname(_0x5cce63[_0x755f('0x8')][_0x755f('0x9')],_0x5cce63['Contact']['firstName'],_0x5cce63[_0x755f('0x8')][_0x755f('0xa')]);this[_0x755f('0xb')]=_0x5cce63['Contact'][_0x755f('0x9')];this[_0x755f('0xc')]=_0x383941[_0x755f('0x7')];this[_0x755f('0xd')]=_0x5cce63['active']||![];this[_0x755f('0xe')]=_0x383941[_0x755f('0xe')];this[_0x755f('0xf')]=_0x383941[_0x755f('0xf')]||0x3;this['scheduledat']=_0x5cce63[_0x755f('0x10')];this[_0x755f('0x11')]=_0x5cce63['countbusyretry'];this[_0x755f('0x12')]=_0x5cce63[_0x755f('0x12')];this[_0x755f('0x13')]=_0x5cce63[_0x755f('0x13')];this[_0x755f('0x14')]=_0x5cce63[_0x755f('0x14')];this['countdropretry']=_0x5cce63[_0x755f('0x15')];this['countabandonedretry']=_0x5cce63[_0x755f('0x16')];this['countmachineretry']=_0x5cce63[_0x755f('0x17')];this[_0x755f('0x18')]=_0x5cce63['countagentrejectretry'];this[_0x755f('0x19')]=_0x5cce63['ContactId'];this[_0x755f('0x1a')]=_0x5cce63[_0x755f('0x1a')];this[_0x755f('0x1b')]=_0x5cce63[_0x755f('0x1b')];this[_0x755f('0x1c')]=_0x5cce63[_0x755f('0x1c')];this[_0x755f('0x1d')]=_0x5cce63['CampaignId'];this[_0x755f('0x1e')]=_0x5cce63['id'];this[_0x755f('0x1f')]=_0x5cce63['Contact'][_0x755f('0x20')]||'';this[_0x755f('0x21')]=moment()['format'](_0x755f('0x22'));this[_0x755f('0x23')]=_0x5cce63[_0x755f('0x23')];this['callbackuniqueid']=_0x5cce63[_0x755f('0x24')];this[_0x755f('0x25')]=_0x5cce63[_0x755f('0x25')];this[_0x755f('0x26')]=_0x5cce63[_0x755f('0x26')];this[_0x755f('0x27')]='';this[_0x755f('0x28')]='';}Action[_0x755f('0x29')][_0x755f('0x2a')]=function(){return util[_0x755f('0x2b')](_0x755f('0x2c'),this[_0x755f('0x7')],this[_0x755f('0x5')][_0x755f('0x2d')]>0x0?this[_0x755f('0xb')][_0x755f('0x2e')](this[_0x755f('0x5')][_0x755f('0x2d')]):this[_0x755f('0xb')]);};Action['prototype'][_0x755f('0x2f')]=function(){return this['queue'];};module['exports']=Action; \ No newline at end of file +var _0xf603=['getCaller','\x22%s\x22\x20<%s>','substring','dialCutDigit','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype'];(function(_0x470d3d,_0x48eac8){var _0x35c062=function(_0x2c1e4c){while(--_0x2c1e4c){_0x470d3d['push'](_0x470d3d['shift']());}};_0x35c062(++_0x48eac8);}(_0xf603,0xeb));var _0x3f60=function(_0x295928,_0xaea684){_0x295928=_0x295928-0x0;var _0x2271aa=_0xf603[_0x295928];return _0x2271aa;};'use strict';var util=require(_0x3f60('0x0'));var _=require(_0x3f60('0x1'));var moment=require(_0x3f60('0x2'));function checkNameSurname(_0x5a9fe7,_0x16d28f,_0xb20102){var _0x3da9d6='';if(!_[_0x3f60('0x3')](_0x16d28f)&&_0x3f60('0x4')===typeof _0x16d28f){_0x3da9d6+=_0x16d28f;}if(!_['isNil'](_0xb20102)&&_0x3f60('0x4')===typeof _0xb20102){_0x3da9d6+='\x20'+_0xb20102;}if(_0x3da9d6!==''){return _0x3da9d6;}return _0x5a9fe7;}function Action(_0x5559e4,_0x5914cd,_0x2910c7){this[_0x3f60('0x5')]=_0x5559e4;this[_0x3f60('0x6')]=_0x2910c7||undefined;this[_0x3f60('0x7')]=checkNameSurname(_0x5914cd[_0x3f60('0x8')][_0x3f60('0x9')],_0x5914cd['Contact'][_0x3f60('0xa')],_0x5914cd[_0x3f60('0x8')][_0x3f60('0xb')]);this[_0x3f60('0xc')]=_0x5914cd['Contact']['phone'];this[_0x3f60('0xd')]=_0x5559e4[_0x3f60('0x7')];this[_0x3f60('0xe')]=_0x5914cd['active']||![];this[_0x3f60('0xf')]=_0x5559e4[_0x3f60('0xf')];this[_0x3f60('0x10')]=_0x5559e4['dialQueueTimeout']||0x3;this[_0x3f60('0x11')]=_0x5914cd[_0x3f60('0x11')];this[_0x3f60('0x12')]=_0x5914cd[_0x3f60('0x12')];this[_0x3f60('0x13')]=_0x5914cd[_0x3f60('0x13')];this[_0x3f60('0x14')]=_0x5914cd[_0x3f60('0x14')];this['countnosuchnumberretry']=_0x5914cd['countnosuchnumberretry'];this['countdropretry']=_0x5914cd[_0x3f60('0x15')];this[_0x3f60('0x16')]=_0x5914cd[_0x3f60('0x16')];this[_0x3f60('0x17')]=_0x5914cd[_0x3f60('0x17')];this[_0x3f60('0x18')]=_0x5914cd[_0x3f60('0x18')];this[_0x3f60('0x19')]=_0x5914cd[_0x3f60('0x19')];this['ListId']=_0x5914cd[_0x3f60('0x1a')];this[_0x3f60('0x1b')]=_0x5914cd[_0x3f60('0x1b')];this[_0x3f60('0x1c')]=_0x5914cd['VoiceQueueId'];this['CampaignId']=_0x5914cd[_0x3f60('0x1d')];this[_0x3f60('0x1e')]=_0x5914cd['id'];this[_0x3f60('0x1f')]=_0x5914cd[_0x3f60('0x8')]['firstName']||'';this[_0x3f60('0x20')]=moment()[_0x3f60('0x21')]('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0x5914cd[_0x3f60('0x22')];this[_0x3f60('0x23')]=_0x5914cd[_0x3f60('0x23')];this[_0x3f60('0x24')]=_0x5914cd['callbackat'];this[_0x3f60('0x25')]=_0x5914cd[_0x3f60('0x25')];this[_0x3f60('0x26')]='';this[_0x3f60('0x27')]='';}Action[_0x3f60('0x28')][_0x3f60('0x29')]=function(){return util[_0x3f60('0x21')](_0x3f60('0x2a'),this[_0x3f60('0x7')],this[_0x3f60('0x5')]['dialCutDigit']>0x0?this[_0x3f60('0xc')][_0x3f60('0x2b')](this[_0x3f60('0x5')][_0x3f60('0x2c')]):this[_0x3f60('0xc')]);};Action[_0x3f60('0x28')]['getQueue']=function(){return this[_0x3f60('0xd')];};module[_0x3f60('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 51931e0..e22d882 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 _0x0841=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','queue','membername','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','state','statedesc','Answer','type','campaigntype','outbound','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','name','calleridnum','number','starttime','responsetime','answertime'];(function(_0x37ab7b,_0x37dbd1){var _0x4403f2=function(_0x5b9d89){while(--_0x5b9d89){_0x37ab7b['push'](_0x37ab7b['shift']());}};_0x4403f2(++_0x37dbd1);}(_0x0841,0x17a));var _0x1084=function(_0x2b8af4,_0x4391b1){_0x2b8af4=_0x2b8af4-0x0;var _0x8bedf0=_0x0841[_0x2b8af4];return _0x8bedf0;};'use strict';var util=require(_0x1084('0x0'));var _=require(_0x1084('0x1'));var moment=require(_0x1084('0x2'));function getSeconds(_0x413778,_0x46e4f4){var _0x26a053=moment(_0x413778)['milliseconds'](0x0);var _0x5cb9bf=moment(_0x46e4f4)[_0x1084('0x3')](0x0);return _0x26a053['diff'](_0x5cb9bf,_0x1084('0x4'));}function AgentComplete(_0x15476b,_0x4f606a){this[_0x1084('0x5')]=0x4;this[_0x1084('0x6')]=_0x1084('0x7');this['scheduledat']=_0x15476b['scheduledat'];this[_0x1084('0x8')]=_0x15476b[_0x1084('0x8')];this[_0x1084('0x9')]=_0x15476b['type']===_0x1084('0xa')?'queue':_0x15476b['type'];this[_0x1084('0xb')]=_0x15476b['countbusyretry'];this[_0x1084('0xc')]=_0x15476b[_0x1084('0xc')];this['countnoanswerretry']=_0x15476b['countnoanswerretry'];this[_0x1084('0xd')]=_0x15476b[_0x1084('0xb')]+_0x15476b[_0x1084('0xc')]+_0x15476b[_0x1084('0xe')]+_0x15476b[_0x1084('0xf')]+_0x15476b[_0x1084('0x10')]+_0x15476b['countabandonedretry']+_0x15476b[_0x1084('0x11')]+_0x15476b[_0x1084('0x12')];this[_0x1084('0xf')]=_0x15476b['countnosuchnumberretry'];this[_0x1084('0x10')]=_0x15476b[_0x1084('0x10')];this[_0x1084('0x13')]=_0x15476b[_0x1084('0x13')];this[_0x1084('0x11')]=_0x15476b[_0x1084('0x11')];this['countagentrejectretry']=_0x15476b[_0x1084('0x12')];this['uniqueid']=_0x4f606a['uniqueid'];this[_0x1084('0x14')]=_0x15476b[_0x1084('0x15')];this[_0x1084('0x16')]=_0x15476b[_0x1084('0x17')];this[_0x1084('0x18')]=_0x15476b['starttime'];this[_0x1084('0x19')]=_0x15476b['responsetime'];this[_0x1084('0x1a')]=_0x15476b[_0x1084('0x1a')];this[_0x1084('0x1b')]=moment()[_0x1084('0x1c')](_0x1084('0x1d'));this['ringtime']=getSeconds(_0x15476b['responsetime'],_0x15476b[_0x1084('0x18')]);this[_0x1084('0x1e')]=getSeconds(_0x15476b[_0x1084('0x1a')],_0x15476b[_0x1084('0x19')]);this['talktime']=getSeconds(this[_0x1084('0x1b')],_0x15476b['answertime']);this[_0x1084('0x1f')]=_0x4f606a['queue'];this[_0x1084('0x20')]=_0x4f606a[_0x1084('0x20')];this[_0x1084('0x21')]=_0x4f606a['reason'];this[_0x1084('0x22')]=_0x15476b[_0x1084('0x22')];this['callbackuniqueid']=_0x15476b['callbackuniqueid'];this[_0x1084('0x23')]=_0x15476b['callbackat'];this[_0x1084('0x24')]=_0x15476b['recallme'];this[_0x1084('0x25')]=_0x15476b[_0x1084('0x25')];this[_0x1084('0x26')]=_0x15476b[_0x1084('0x26')];this[_0x1084('0x27')]=_0x15476b[_0x1084('0x27')];this['VoiceQueueId']=_0x15476b[_0x1084('0x28')];this[_0x1084('0x29')]=_0x15476b['CampaignId'];this['originatecalleridnum']=_0x15476b[_0x1084('0x2a')]||'';this[_0x1084('0x2b')]=_0x15476b[_0x1084('0x2b')]||'';}module[_0x1084('0x2c')]=AgentComplete; \ No newline at end of file +var _0xa724=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','statedesc','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','calleridnum','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason'];(function(_0x6c0123,_0x4c8d3b){var _0x5a87d2=function(_0x1ff614){while(--_0x1ff614){_0x6c0123['push'](_0x6c0123['shift']());}};_0x5a87d2(++_0x4c8d3b);}(_0xa724,0xe2));var _0x4a72=function(_0x15d4fc,_0x5d91dc){_0x15d4fc=_0x15d4fc-0x0;var _0x126ee2=_0xa724[_0x15d4fc];return _0x126ee2;};'use strict';var util=require('util');var _=require(_0x4a72('0x0'));var moment=require(_0x4a72('0x1'));function getSeconds(_0x14b3b2,_0x18feed){var _0x636fe2=moment(_0x14b3b2)[_0x4a72('0x2')](0x0);var _0x4ea2c1=moment(_0x18feed)[_0x4a72('0x2')](0x0);return _0x636fe2[_0x4a72('0x3')](_0x4ea2c1,'seconds');}function AgentComplete(_0x21e327,_0x7787cd){this['state']=0x4;this[_0x4a72('0x4')]='Answer';this[_0x4a72('0x5')]=_0x21e327[_0x4a72('0x5')];this[_0x4a72('0x6')]=_0x21e327['type'];this[_0x4a72('0x7')]=_0x21e327['type']==='outbound'?_0x4a72('0x8'):_0x21e327[_0x4a72('0x6')];this[_0x4a72('0x9')]=_0x21e327[_0x4a72('0x9')];this[_0x4a72('0xa')]=_0x21e327[_0x4a72('0xa')];this[_0x4a72('0xb')]=_0x21e327[_0x4a72('0xb')];this[_0x4a72('0xc')]=_0x21e327['countbusyretry']+_0x21e327[_0x4a72('0xa')]+_0x21e327[_0x4a72('0xb')]+_0x21e327['countnosuchnumberretry']+_0x21e327[_0x4a72('0xd')]+_0x21e327[_0x4a72('0xe')]+_0x21e327[_0x4a72('0xf')]+_0x21e327['countagentrejectretry'];this[_0x4a72('0x10')]=_0x21e327[_0x4a72('0x10')];this[_0x4a72('0xd')]=_0x21e327[_0x4a72('0xd')];this[_0x4a72('0xe')]=_0x21e327[_0x4a72('0xe')];this['countmachineretry']=_0x21e327[_0x4a72('0xf')];this[_0x4a72('0x11')]=_0x21e327[_0x4a72('0x11')];this[_0x4a72('0x12')]=_0x7787cd[_0x4a72('0x12')];this[_0x4a72('0x13')]=_0x21e327['name'];this[_0x4a72('0x14')]=_0x21e327['number'];this[_0x4a72('0x15')]=_0x21e327['starttime'];this[_0x4a72('0x16')]=_0x21e327[_0x4a72('0x16')];this[_0x4a72('0x17')]=_0x21e327[_0x4a72('0x17')];this[_0x4a72('0x18')]=moment()[_0x4a72('0x19')](_0x4a72('0x1a'));this[_0x4a72('0x1b')]=getSeconds(_0x21e327[_0x4a72('0x16')],_0x21e327['starttime']);this[_0x4a72('0x1c')]=getSeconds(_0x21e327[_0x4a72('0x17')],_0x21e327[_0x4a72('0x16')]);this[_0x4a72('0x1d')]=getSeconds(this[_0x4a72('0x18')],_0x21e327['answertime']);this[_0x4a72('0x8')]=_0x7787cd[_0x4a72('0x8')];this[_0x4a72('0x1e')]=_0x7787cd[_0x4a72('0x1e')];this[_0x4a72('0x1f')]=_0x7787cd['reason'];this['callback']=_0x21e327['callback'];this[_0x4a72('0x20')]=_0x21e327['callbackuniqueid'];this[_0x4a72('0x21')]=_0x21e327[_0x4a72('0x21')];this['recallme']=_0x21e327[_0x4a72('0x22')];this[_0x4a72('0x23')]=_0x21e327[_0x4a72('0x23')];this[_0x4a72('0x24')]=_0x21e327[_0x4a72('0x24')];this[_0x4a72('0x25')]=_0x21e327['UserId'];this[_0x4a72('0x26')]=_0x21e327[_0x4a72('0x26')];this['CampaignId']=_0x21e327[_0x4a72('0x27')];this[_0x4a72('0x28')]=_0x21e327['originatecalleridnum']||'';this[_0x4a72('0x29')]=_0x21e327[_0x4a72('0x29')]||'';}module[_0x4a72('0x2a')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index c68ebf6..b2b2857 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 _0x4e01=['countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','util','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x4e01,0xa5));var _0x14e0=function(_0x15242f,_0x882cfd){_0x15242f=_0x15242f-0x0;var _0xf13785=_0x4e01[_0x15242f];return _0xf13785;};'use strict';var util=require(_0x14e0('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x376ecf,_0x1d2483){var _0x1c12d3=moment(_0x376ecf)[_0x14e0('0x1')](0x0);var _0x4fa8a7=moment(_0x1d2483)[_0x14e0('0x1')](0x0);return _0x1c12d3[_0x14e0('0x2')](_0x4fa8a7,_0x14e0('0x3'));}function Final(_0x56b669){this[_0x14e0('0x4')]=_0x56b669[_0x14e0('0x4')];this[_0x14e0('0x5')]=_0x56b669[_0x14e0('0x5')];this[_0x14e0('0x6')]=_0x56b669[_0x14e0('0x6')];this[_0x14e0('0x7')]=_0x56b669['type']==='outbound'?_0x14e0('0x8'):_0x56b669[_0x14e0('0x6')];this[_0x14e0('0x9')]=_0x56b669[_0x14e0('0x9')];this[_0x14e0('0xa')]=_0x56b669[_0x14e0('0xa')];this[_0x14e0('0xb')]=_0x56b669[_0x14e0('0xb')];this[_0x14e0('0xc')]=_0x56b669[_0x14e0('0x9')]+_0x56b669['countcongestionretry']+_0x56b669[_0x14e0('0xb')]+_0x56b669[_0x14e0('0xd')]+_0x56b669[_0x14e0('0xe')]+_0x56b669[_0x14e0('0xf')]+_0x56b669[_0x14e0('0x10')]+_0x56b669[_0x14e0('0x11')];this[_0x14e0('0xd')]=_0x56b669[_0x14e0('0xd')];this[_0x14e0('0xe')]=_0x56b669[_0x14e0('0xe')];this[_0x14e0('0xf')]=_0x56b669['countabandonedretry'];this['countmachineretry']=_0x56b669[_0x14e0('0x10')];this['countagentrejectretry']=_0x56b669[_0x14e0('0x11')];this[_0x14e0('0x8')]=_0x56b669[_0x14e0('0x8')];this[_0x14e0('0x12')]=_0x56b669[_0x14e0('0x12')];this['calleridnum']=_0x56b669[_0x14e0('0x13')];this[_0x14e0('0x14')]=_0x56b669['starttime'];this[_0x14e0('0x15')]=_0x56b669[_0x14e0('0x15')];this[_0x14e0('0x16')]=_0x56b669['responsetime'];this[_0x14e0('0x17')]=_0x56b669['ringtime']||0x0;this[_0x14e0('0x18')]=_0x56b669[_0x14e0('0x18')]||0x0;this['talktime']=_0x56b669[_0x14e0('0x19')]||0x0;this[_0x14e0('0x1a')]=_0x56b669[_0x14e0('0x1a')];this['callbackuniqueid']=_0x56b669[_0x14e0('0x1b')];this[_0x14e0('0x1c')]=_0x56b669[_0x14e0('0x1c')];this[_0x14e0('0x1d')]=_0x56b669[_0x14e0('0x1d')];this[_0x14e0('0x1e')]=_0x56b669['ContactId'];this[_0x14e0('0x1f')]=_0x56b669[_0x14e0('0x1f')];this[_0x14e0('0x20')]=_0x56b669['UserId'];this[_0x14e0('0x21')]=_0x56b669['VoiceQueueId'];this[_0x14e0('0x22')]=_0x56b669['CampaignId'];this['originatecalleridnum']=_0x56b669['originatecalleridnum']||'';this[_0x14e0('0x23')]=_0x56b669[_0x14e0('0x23')]||'';}module['exports']=Final; \ No newline at end of file +var _0x23d5=['scheduledat','type','campaigntype','outbound','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','diff','seconds'];(function(_0x43d191,_0x1a6715){var _0x59ce92=function(_0x45464f){while(--_0x45464f){_0x43d191['push'](_0x43d191['shift']());}};_0x59ce92(++_0x1a6715);}(_0x23d5,0x1f4));var _0x523d=function(_0x100fdb,_0x3f53ac){_0x100fdb=_0x100fdb-0x0;var _0xd6670b=_0x23d5[_0x100fdb];return _0xd6670b;};'use strict';var util=require('util');var _=require(_0x523d('0x0'));var moment=require(_0x523d('0x1'));function getSeconds(_0x2979e2,_0x9b2d05){var _0x310098=moment(_0x2979e2)['milliseconds'](0x0);var _0x1e0b5d=moment(_0x9b2d05)['milliseconds'](0x0);return _0x310098[_0x523d('0x2')](_0x1e0b5d,_0x523d('0x3'));}function Final(_0x3a9448){this['uniqueid']=_0x3a9448['uniqueid'];this[_0x523d('0x4')]=_0x3a9448[_0x523d('0x4')];this[_0x523d('0x5')]=_0x3a9448[_0x523d('0x5')];this[_0x523d('0x6')]=_0x3a9448[_0x523d('0x5')]===_0x523d('0x7')?'queue':_0x3a9448[_0x523d('0x5')];this['countbusyretry']=_0x3a9448['countbusyretry'];this[_0x523d('0x8')]=_0x3a9448[_0x523d('0x8')];this[_0x523d('0x9')]=_0x3a9448[_0x523d('0x9')];this[_0x523d('0xa')]=_0x3a9448[_0x523d('0xb')]+_0x3a9448[_0x523d('0x8')]+_0x3a9448['countnoanswerretry']+_0x3a9448[_0x523d('0xc')]+_0x3a9448[_0x523d('0xd')]+_0x3a9448[_0x523d('0xe')]+_0x3a9448[_0x523d('0xf')]+_0x3a9448[_0x523d('0x10')];this[_0x523d('0xc')]=_0x3a9448['countnosuchnumberretry'];this[_0x523d('0xd')]=_0x3a9448['countdropretry'];this[_0x523d('0xe')]=_0x3a9448['countabandonedretry'];this[_0x523d('0xf')]=_0x3a9448[_0x523d('0xf')];this[_0x523d('0x10')]=_0x3a9448[_0x523d('0x10')];this[_0x523d('0x11')]=_0x3a9448[_0x523d('0x11')];this['calleridname']=_0x3a9448[_0x523d('0x12')];this[_0x523d('0x13')]=_0x3a9448['calleridnum'];this[_0x523d('0x14')]=_0x3a9448[_0x523d('0x14')];this[_0x523d('0x15')]=_0x3a9448[_0x523d('0x15')];this[_0x523d('0x16')]=_0x3a9448[_0x523d('0x15')];this['ringtime']=_0x3a9448[_0x523d('0x17')]||0x0;this[_0x523d('0x18')]=_0x3a9448['holdtime']||0x0;this[_0x523d('0x19')]=_0x3a9448['talktime']||0x0;this['callback']=_0x3a9448[_0x523d('0x1a')];this['callbackuniqueid']=_0x3a9448[_0x523d('0x1b')];this['callbackat']=_0x3a9448['callbackat'];this['recallme']=_0x3a9448[_0x523d('0x1c')];this[_0x523d('0x1d')]=_0x3a9448[_0x523d('0x1d')];this[_0x523d('0x1e')]=_0x3a9448[_0x523d('0x1e')];this[_0x523d('0x1f')]=_0x3a9448[_0x523d('0x1f')];this[_0x523d('0x20')]=_0x3a9448[_0x523d('0x20')];this[_0x523d('0x21')]=_0x3a9448[_0x523d('0x21')];this[_0x523d('0x22')]=_0x3a9448[_0x523d('0x22')]||'';this[_0x523d('0x23')]=_0x3a9448[_0x523d('0x23')]||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 3cae3cc..51f9a37 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 _0xc8d2=['format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','milliseconds','seconds','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','calleridnum','starttime','responsetime','endtime'];(function(_0x57c6b1,_0x28134c){var _0x2339de=function(_0x40e530){while(--_0x40e530){_0x57c6b1['push'](_0x57c6b1['shift']());}};_0x2339de(++_0x28134c);}(_0xc8d2,0x195));var _0x2c8d=function(_0x4803f0,_0x2b3931){_0x4803f0=_0x4803f0-0x0;var _0x2896f0=_0xc8d2[_0x4803f0];return _0x2896f0;};'use strict';var util=require(_0x2c8d('0x0'));var _=require(_0x2c8d('0x1'));var moment=require('moment');function getSeconds(_0x45a235,_0x7337aa){var _0x23ec8e=moment(_0x45a235)[_0x2c8d('0x2')](0x0);var _0x457568=moment(_0x7337aa)[_0x2c8d('0x2')](0x0);return _0x23ec8e['diff'](_0x457568,_0x2c8d('0x3'));}function Hangup(_0x1d0f4f,_0x4d4a79){this[_0x2c8d('0x4')]=0x4;this[_0x2c8d('0x5')]='Answer';this[_0x2c8d('0x6')]=_0x1d0f4f['scheduledat'];this['type']=_0x1d0f4f[_0x2c8d('0x7')];this[_0x2c8d('0x8')]=_0x1d0f4f[_0x2c8d('0x7')]===_0x2c8d('0x9')?_0x2c8d('0xa'):_0x1d0f4f[_0x2c8d('0x7')];this[_0x2c8d('0xb')]=_0x1d0f4f[_0x2c8d('0xb')];this[_0x2c8d('0xc')]=_0x1d0f4f[_0x2c8d('0xc')];this[_0x2c8d('0xd')]=_0x1d0f4f[_0x2c8d('0xd')];this[_0x2c8d('0xe')]=_0x1d0f4f[_0x2c8d('0xb')]+_0x1d0f4f['countcongestionretry']+_0x1d0f4f[_0x2c8d('0xd')]+_0x1d0f4f[_0x2c8d('0xf')]+_0x1d0f4f['countdropretry']+_0x1d0f4f['countabandonedretry']+_0x1d0f4f['countmachineretry']+_0x1d0f4f[_0x2c8d('0x10')];this[_0x2c8d('0xf')]=_0x1d0f4f[_0x2c8d('0xf')];this['countdropretry']=_0x1d0f4f['countdropretry'];this[_0x2c8d('0x11')]=_0x1d0f4f['countabandonedretry'];this[_0x2c8d('0x12')]=_0x1d0f4f[_0x2c8d('0x12')];this[_0x2c8d('0x10')]=_0x1d0f4f[_0x2c8d('0x10')];this['uniqueid']=_0x4d4a79[_0x2c8d('0x13')];this['calleridname']=_0x1d0f4f['name'];this[_0x2c8d('0x14')]=_0x1d0f4f['number'];this[_0x2c8d('0x15')]=_0x1d0f4f['starttime'];this[_0x2c8d('0x16')]=_0x1d0f4f[_0x2c8d('0x16')];this[_0x2c8d('0x17')]=moment()[_0x2c8d('0x18')](_0x2c8d('0x19'));this[_0x2c8d('0x1a')]=getSeconds(_0x1d0f4f['responsetime'],_0x1d0f4f[_0x2c8d('0x15')]);this[_0x2c8d('0x1b')]=0x0;this['talktime']=getSeconds(this['endtime'],_0x1d0f4f['responsetime']);this[_0x2c8d('0xa')]=_0x1d0f4f['queue'];this[_0x2c8d('0x1c')]='IVR';this[_0x2c8d('0x1d')]=_0x4d4a79['cause-txt'];this[_0x2c8d('0x1e')]=_0x1d0f4f[_0x2c8d('0x1e')];this[_0x2c8d('0x1f')]=_0x1d0f4f[_0x2c8d('0x1f')];this[_0x2c8d('0x20')]=_0x1d0f4f[_0x2c8d('0x20')];this[_0x2c8d('0x21')]=_0x1d0f4f[_0x2c8d('0x21')];this[_0x2c8d('0x22')]=_0x1d0f4f[_0x2c8d('0x22')];this[_0x2c8d('0x23')]=_0x1d0f4f[_0x2c8d('0x23')];this[_0x2c8d('0x24')]=_0x1d0f4f[_0x2c8d('0x24')];this['VoiceQueueId']=_0x1d0f4f[_0x2c8d('0x25')];this[_0x2c8d('0x26')]=_0x1d0f4f[_0x2c8d('0x26')];}module['exports']=Hangup; \ No newline at end of file +var _0x1868=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','membername','IVR','reason','callback','callbackuniqueid'];(function(_0x31e584,_0x4d9f7f){var _0x5686d0=function(_0x1f9e99){while(--_0x1f9e99){_0x31e584['push'](_0x31e584['shift']());}};_0x5686d0(++_0x4d9f7f);}(_0x1868,0x168));var _0x8186=function(_0xa19ec5,_0x5742bf){_0xa19ec5=_0xa19ec5-0x0;var _0x3d2c82=_0x1868[_0xa19ec5];return _0x3d2c82;};'use strict';var util=require(_0x8186('0x0'));var _=require(_0x8186('0x1'));var moment=require(_0x8186('0x2'));function getSeconds(_0x2eef77,_0x3a6c95){var _0x3b43c9=moment(_0x2eef77)[_0x8186('0x3')](0x0);var _0x220a7f=moment(_0x3a6c95)[_0x8186('0x3')](0x0);return _0x3b43c9[_0x8186('0x4')](_0x220a7f,'seconds');}function Hangup(_0x5be6d0,_0x593e71){this[_0x8186('0x5')]=0x4;this[_0x8186('0x6')]=_0x8186('0x7');this['scheduledat']=_0x5be6d0[_0x8186('0x8')];this[_0x8186('0x9')]=_0x5be6d0['type'];this['campaigntype']=_0x5be6d0[_0x8186('0x9')]===_0x8186('0xa')?_0x8186('0xb'):_0x5be6d0['type'];this[_0x8186('0xc')]=_0x5be6d0[_0x8186('0xc')];this[_0x8186('0xd')]=_0x5be6d0[_0x8186('0xd')];this[_0x8186('0xe')]=_0x5be6d0['countnoanswerretry'];this[_0x8186('0xf')]=_0x5be6d0['countbusyretry']+_0x5be6d0[_0x8186('0xd')]+_0x5be6d0[_0x8186('0xe')]+_0x5be6d0[_0x8186('0x10')]+_0x5be6d0[_0x8186('0x11')]+_0x5be6d0['countabandonedretry']+_0x5be6d0[_0x8186('0x12')]+_0x5be6d0[_0x8186('0x13')];this[_0x8186('0x10')]=_0x5be6d0[_0x8186('0x10')];this[_0x8186('0x11')]=_0x5be6d0[_0x8186('0x11')];this['countabandonedretry']=_0x5be6d0[_0x8186('0x14')];this['countmachineretry']=_0x5be6d0[_0x8186('0x12')];this[_0x8186('0x13')]=_0x5be6d0[_0x8186('0x13')];this[_0x8186('0x15')]=_0x593e71[_0x8186('0x15')];this[_0x8186('0x16')]=_0x5be6d0[_0x8186('0x17')];this['calleridnum']=_0x5be6d0[_0x8186('0x18')];this[_0x8186('0x19')]=_0x5be6d0[_0x8186('0x19')];this[_0x8186('0x1a')]=_0x5be6d0[_0x8186('0x1a')];this['endtime']=moment()[_0x8186('0x1b')](_0x8186('0x1c'));this[_0x8186('0x1d')]=getSeconds(_0x5be6d0[_0x8186('0x1a')],_0x5be6d0[_0x8186('0x19')]);this['holdtime']=0x0;this[_0x8186('0x1e')]=getSeconds(this['endtime'],_0x5be6d0[_0x8186('0x1a')]);this[_0x8186('0xb')]=_0x5be6d0[_0x8186('0xb')];this[_0x8186('0x1f')]=_0x8186('0x20');this[_0x8186('0x21')]=_0x593e71['cause-txt'];this[_0x8186('0x22')]=_0x5be6d0[_0x8186('0x22')];this['callbackuniqueid']=_0x5be6d0[_0x8186('0x23')];this[_0x8186('0x24')]=_0x5be6d0[_0x8186('0x24')];this[_0x8186('0x25')]=_0x5be6d0[_0x8186('0x25')];this[_0x8186('0x26')]=_0x5be6d0[_0x8186('0x26')];this[_0x8186('0x27')]=_0x5be6d0[_0x8186('0x27')];this[_0x8186('0x28')]=_0x5be6d0[_0x8186('0x28')];this[_0x8186('0x29')]=_0x5be6d0[_0x8186('0x29')];this[_0x8186('0x2a')]=_0x5be6d0[_0x8186('0x2a')];}module[_0x8186('0x2b')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index d7a15a6..28a8bee 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 _0x3468=['exports','util','milliseconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridnum','number','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x228aae,_0x36f2a4){var _0x4c9447=function(_0x2b3e60){while(--_0x2b3e60){_0x228aae['push'](_0x228aae['shift']());}};_0x4c9447(++_0x36f2a4);}(_0x3468,0x8d));var _0x8346=function(_0x51701e,_0x41c6e4){_0x51701e=_0x51701e-0x0;var _0x1d2b1f=_0x3468[_0x51701e];return _0x1d2b1f;};'use strict';var util=require(_0x8346('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x1946ad,_0x584cd0){var _0x47b806=moment(_0x1946ad)[_0x8346('0x1')](0x0);var _0x1a7eb9=moment(_0x584cd0)[_0x8346('0x1')](0x0);return _0x47b806['diff'](_0x1a7eb9,'seconds');}function History(_0x5a71dc){this[_0x8346('0x2')]=_0x5a71dc['uniqueid'];this[_0x8346('0x3')]=_0x5a71dc[_0x8346('0x3')]||undefined;this[_0x8346('0x4')]=_0x5a71dc[_0x8346('0x4')];this[_0x8346('0x5')]=_0x5a71dc[_0x8346('0x4')]===_0x8346('0x6')?_0x8346('0x7'):_0x5a71dc[_0x8346('0x4')];this[_0x8346('0x8')]=_0x5a71dc[_0x8346('0x8')];this[_0x8346('0x9')]=_0x5a71dc[_0x8346('0x9')];this['countnoanswerretry']=_0x5a71dc[_0x8346('0xa')];this[_0x8346('0xb')]=_0x5a71dc[_0x8346('0x8')]+_0x5a71dc[_0x8346('0x9')]+_0x5a71dc[_0x8346('0xa')]+_0x5a71dc[_0x8346('0xc')]+_0x5a71dc['countdropretry']+_0x5a71dc[_0x8346('0xd')]+_0x5a71dc[_0x8346('0xe')]+_0x5a71dc[_0x8346('0xf')];this[_0x8346('0xc')]=_0x5a71dc[_0x8346('0xc')];this[_0x8346('0x10')]=_0x5a71dc[_0x8346('0x10')];this['countabandonedretry']=_0x5a71dc[_0x8346('0xd')];this['countmachineretry']=_0x5a71dc[_0x8346('0xe')];this['countagentrejectretry']=_0x5a71dc[_0x8346('0xf')];this['queue']=_0x5a71dc[_0x8346('0x7')];this['calleridname']=_0x5a71dc['name'];this[_0x8346('0x11')]=_0x5a71dc[_0x8346('0x12')];this['starttime']=_0x5a71dc[_0x8346('0x13')];this[_0x8346('0x14')]=_0x5a71dc[_0x8346('0x14')];this['endtime']=_0x5a71dc[_0x8346('0x14')];this[_0x8346('0x15')]=getSeconds(_0x5a71dc[_0x8346('0x14')],_0x5a71dc['starttime']);this[_0x8346('0x16')]=0x0;this[_0x8346('0x17')]=0x0;this[_0x8346('0x18')]=_0x5a71dc['callback'];this[_0x8346('0x19')]=_0x5a71dc[_0x8346('0x19')];this[_0x8346('0x1a')]=_0x5a71dc[_0x8346('0x1a')];this['recallme']=_0x5a71dc['recallme'];this[_0x8346('0x1b')]=_0x5a71dc['ContactId'];this[_0x8346('0x1c')]=_0x5a71dc[_0x8346('0x1c')];this[_0x8346('0x1d')]=_0x5a71dc[_0x8346('0x1d')];this['VoiceQueueId']=_0x5a71dc[_0x8346('0x1e')];this[_0x8346('0x1f')]=_0x5a71dc[_0x8346('0x1f')];this[_0x8346('0x20')]=_0x5a71dc[_0x8346('0x20')]||'';this[_0x8346('0x21')]=_0x5a71dc[_0x8346('0x21')]||'';}module[_0x8346('0x22')]=History; \ No newline at end of file +var _0x151b=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme'];(function(_0x39d7bb,_0xd40500){var _0x4dfafb=function(_0x557635){while(--_0x557635){_0x39d7bb['push'](_0x39d7bb['shift']());}};_0x4dfafb(++_0xd40500);}(_0x151b,0x1dc));var _0xb151=function(_0x2317f5,_0x2fbcfc){_0x2317f5=_0x2317f5-0x0;var _0x25d4f5=_0x151b[_0x2317f5];return _0x25d4f5;};'use strict';var util=require(_0xb151('0x0'));var _=require('lodash');var moment=require(_0xb151('0x1'));function getSeconds(_0x4540ec,_0x1e9a47){var _0x1f7d2b=moment(_0x4540ec)['milliseconds'](0x0);var _0x44eba9=moment(_0x1e9a47)['milliseconds'](0x0);return _0x1f7d2b[_0xb151('0x2')](_0x44eba9,_0xb151('0x3'));}function History(_0x3dd447){this[_0xb151('0x4')]=_0x3dd447[_0xb151('0x4')];this[_0xb151('0x5')]=_0x3dd447[_0xb151('0x5')]||undefined;this[_0xb151('0x6')]=_0x3dd447['type'];this[_0xb151('0x7')]=_0x3dd447['type']==='outbound'?_0xb151('0x8'):_0x3dd447[_0xb151('0x6')];this[_0xb151('0x9')]=_0x3dd447[_0xb151('0x9')];this[_0xb151('0xa')]=_0x3dd447[_0xb151('0xa')];this['countnoanswerretry']=_0x3dd447[_0xb151('0xb')];this[_0xb151('0xc')]=_0x3dd447['countbusyretry']+_0x3dd447[_0xb151('0xa')]+_0x3dd447[_0xb151('0xb')]+_0x3dd447[_0xb151('0xd')]+_0x3dd447[_0xb151('0xe')]+_0x3dd447[_0xb151('0xf')]+_0x3dd447[_0xb151('0x10')]+_0x3dd447[_0xb151('0x11')];this[_0xb151('0xd')]=_0x3dd447[_0xb151('0xd')];this[_0xb151('0xe')]=_0x3dd447[_0xb151('0xe')];this[_0xb151('0xf')]=_0x3dd447[_0xb151('0xf')];this[_0xb151('0x10')]=_0x3dd447[_0xb151('0x10')];this[_0xb151('0x11')]=_0x3dd447[_0xb151('0x11')];this[_0xb151('0x8')]=_0x3dd447['queue'];this[_0xb151('0x12')]=_0x3dd447[_0xb151('0x13')];this[_0xb151('0x14')]=_0x3dd447[_0xb151('0x15')];this[_0xb151('0x16')]=_0x3dd447[_0xb151('0x16')];this['responsetime']=_0x3dd447[_0xb151('0x17')];this[_0xb151('0x18')]=_0x3dd447[_0xb151('0x17')];this[_0xb151('0x19')]=getSeconds(_0x3dd447[_0xb151('0x17')],_0x3dd447['starttime']);this[_0xb151('0x1a')]=0x0;this[_0xb151('0x1b')]=0x0;this[_0xb151('0x1c')]=_0x3dd447[_0xb151('0x1c')];this['callbackuniqueid']=_0x3dd447[_0xb151('0x1d')];this['callbackat']=_0x3dd447['callbackat'];this[_0xb151('0x1e')]=_0x3dd447[_0xb151('0x1e')];this[_0xb151('0x1f')]=_0x3dd447[_0xb151('0x1f')];this[_0xb151('0x20')]=_0x3dd447['ListId'];this[_0xb151('0x21')]=_0x3dd447['UserId'];this[_0xb151('0x22')]=_0x3dd447[_0xb151('0x22')];this[_0xb151('0x23')]=_0x3dd447['CampaignId'];this[_0xb151('0x24')]=_0x3dd447[_0xb151('0x24')]||'';this['originatecalleridname']=_0x3dd447[_0xb151('0x25')]||'';}module[_0xb151('0x26')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 9d16c2f..694950b 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 _0x63e1=['custom:agentnosuchnumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','noanswer','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','[getDataPredictive]','check\x20failure','outboundQueuePauses','abandonmentRate','[CatchErlangB]','busyFactor','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Agent','voicePause','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','dialOrderByScheduledAt','[countReScheduled]\x20','ACTIVE','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','moment','md5','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','booked','predictive','syncQueueSummary','redis','defaults','localhost','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','./action','./history','./final','./agentComplete','./hangup','env','127.0.0.1','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','syncNewExten','varset','syncVarSet','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','AGENTS_NOT_LOGGED','name','message','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','[ifTime][Action]','Error','stringify','milliseconds','seconds','emit','type','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startProgressive','Trunk','active','callerid','format','voice:queue:%s','ivr','campaign:save','isEmpty','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','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','erlangAbandonmentRate','---------------------------','merge','diff','clearing\x20variable\x20start\x20predictive','handlePredictive','outbound','string','\x22%s\x22\x20<%s>','error','inspect','stack','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','actions','[actions]','prototype','isNil','status','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','countReScheduled','resolve','then','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','loggerHandler','emptyContact','notFound','ContactId','UserId','CampaignId','[emptyContact][createHistory]','[emptyContact]','Success','isTrunkReachable','reachable','SIP/%s','unmonitored','saveInDb','uniqueid','variable','amdstatus','xcally-motion-dialer','dialAMDActive','HANGUP','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','Machine','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ListId','VoiceQueueId','HangupInAMD','membername','[syncHangupInAMDIvr][createHistory]','countcongestionretry','reason19\x20machine....','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','Unknow','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','locked','paused','stateinterface','rrmemory','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','roundrobin','run','finally','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','length','unlockRR','Agent:\x20','pick','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','TrunkBackup','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','Action','command','interval','content','indexOf','true','iftime\x20%s,%s','all','some','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','dialPowerLevel','launchHandleIvr','handleIvr','checkIfTime','dialGlobalInterval','dialTimezone','[syncQueueSummary]','syncCampaigns','[syncCampaigns]','\x5cw{0,','pow','replace','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','Contact','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','originate\x20action\x20Error','getQueue','isSuccess','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAbandonedMaxRetry','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','[callProgressDetecting]','reason','NoSuchNumber'];(function(_0x38943f,_0x5295cb){var _0x1d8caf=function(_0x326dbd){while(--_0x326dbd){_0x38943f['push'](_0x38943f['shift']());}};_0x1d8caf(++_0x5295cb);}(_0x63e1,0x6d));var _0x163e=function(_0x1eb812,_0x214031){_0x1eb812=_0x1eb812-0x0;var _0x301aa2=_0x63e1[_0x1eb812];return _0x301aa2;};'use strict';var util=require(_0x163e('0x0'));var _=require(_0x163e('0x1'));var BPromise=require('bluebird');var uuid=require(_0x163e('0x2'));var moment=require(_0x163e('0x3'));var rr=require('rr');var md5=require(_0x163e('0x4'));var Redis=require('ioredis');var ut=require(_0x163e('0x5'));var config=require(_0x163e('0x6'));var logger=require('../../../config/logger')(_0x163e('0x7'));var loggerBooked=require(_0x163e('0x8'))(_0x163e('0x9'));var loggerPredictive=require('../../../config/logger')(_0x163e('0xa'));var loggerPredictiveCalls=require(_0x163e('0x8'))('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')(_0x163e('0xb'));var ami=require('../ami');config[_0x163e('0xc')]=_[_0x163e('0xd')](config['redis'],{'host':_0x163e('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x163e('0xc')]));var cmHopper=require(_0x163e('0xf'));var cmHopperHistory=require(_0x163e('0x10'));var cmHopperBlack=require(_0x163e('0x11'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0x163e('0x12'));var History=require(_0x163e('0x13'));var Final=require(_0x163e('0x14'));var AgentComplete=require(_0x163e('0x15'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x163e('0x16'));var ipAgi=process[_0x163e('0x17')]['XCALLY_IP_AGI']||_0x163e('0x18');var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};var Sequence=function(){};Sequence['prototype'][_0x163e('0x19')]=function(_0x2f4ed2){this[_0x163e('0x1a')]=this[_0x163e('0x1a')]?this[_0x163e('0x1a')]['finally'](_0x2f4ed2):_0x2f4ed2();};function Dialer(_0x54a38c,_0x1eb602){this[_0x163e('0x1b')]=new Sequence();this[_0x163e('0x1c')]=_0x1eb602;this['voiceQueues']=_0x54a38c[_0x163e('0x1d')];this['campaigns']=_0x54a38c[_0x163e('0x1e')];this['agents']=_0x54a38c[_0x163e('0x1f')];this['trunks']=_0x54a38c[_0x163e('0x20')];this['maxNumberOriginate']=config[_0x163e('0x21')]||0x2;this[_0x163e('0x22')]={};this['actions']={};this[_0x163e('0x23')]={};this[_0x163e('0x24')]={};this[_0x163e('0x25')]={};this[_0x163e('0x26')]={};this['startProgressive']={};this[_0x163e('0x27')]={};this[_0x163e('0x28')]={};this['queueBookedRR']={};ami['on'](_0x163e('0x29'),this[_0x163e('0x2a')][_0x163e('0x2b')](this));ami['on']('queuecallerabandon',this[_0x163e('0x2c')][_0x163e('0x2b')](this));ami['on'](_0x163e('0x2d'),this[_0x163e('0x2e')][_0x163e('0x2b')](this));ami['on'](_0x163e('0x2f'),this[_0x163e('0x30')][_0x163e('0x2b')](this));ami['on'](_0x163e('0x31'),this['syncQueueSummary'][_0x163e('0x2b')](this));ami['on'](_0x163e('0x32'),this[_0x163e('0x33')][_0x163e('0x2b')](this));ami['on']('newexten',this[_0x163e('0x34')]['bind'](this));ami['on'](_0x163e('0x35'),this[_0x163e('0x36')][_0x163e('0x2b')](this));ami['on']('queuemember',this['syncQueueMember'][_0x163e('0x2b')](this));ami['on']('queuestatuscomplete',this[_0x163e('0x37')][_0x163e('0x2b')](this));this[_0x163e('0x38')]();this[_0x163e('0x39')]();}function isNotNull(_0x5bf123){return _0x5bf123!==null&&!_[_0x163e('0x3a')](_0x5bf123);}function checkIsLoggedIn(_0x177b82,_0xb0ac0e){return function(){if(_0xb0ac0e<=0x0){_0x177b82['message']=_0x163e('0x3b');throw _0x177b82[_0x163e('0x3c')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x132ba5){return _0x132ba5;}function checkIsActive(_0x462bb1,_0x42bd1e){return function(){if(!isActive(_0x42bd1e)){_0x462bb1[_0x163e('0x3d')]=_0x163e('0x3e');throw _0x462bb1[_0x163e('0x3c')]+_0x163e('0x3f');}};}function checkInterval(_0x2078d2){return function(){if(!isNotNull(_0x2078d2['Interval'])){_0x2078d2[_0x163e('0x3d')]=_0x163e('0x40');throw _0x2078d2['name']+_0x163e('0x41');}if(!isNotNull(_0x2078d2[_0x163e('0x42')][_0x163e('0x43')])){_0x2078d2[_0x163e('0x3d')]=_0x163e('0x40');throw _0x2078d2[_0x163e('0x3c')]+_0x163e('0x41');}if(!isNotNull(_['isEmpty'](_0x2078d2['Interval'][_0x163e('0x43')]))){_0x2078d2[_0x163e('0x3d')]=_0x163e('0x40');throw _0x2078d2['name']+_0x163e('0x41');}};}function msgResponse(_0x2253bb,_0x1d7ae3,_0x2ee7e0){return{'action':_0x2253bb,'response':_0x1d7ae3,'message':_0x2ee7e0,'stack':_0x2ee7e0};}function myreject(_0x51cd8e){return function(_0x27c4e7){return _0x51cd8e(msgResponse(_0x163e('0x44'),_0x163e('0x45'),JSON[_0x163e('0x46')](_0x27c4e7)));};}function getSeconds(_0x42a539,_0x3d5176){var _0x465602=moment(_0x42a539)[_0x163e('0x47')](0x0);var _0x1ca0a4=moment(_0x3d5176)['milliseconds'](0x0);return _0x465602['diff'](_0x1ca0a4,_0x163e('0x48'));}function emit(_0x45162d,_0x35c180,_0x32bc31){io['to'](_0x45162d)[_0x163e('0x49')](_0x35c180,_0x32bc31);}function emitVoiceQueueSummary(_0x5c36cf){if(_0x5c36cf[_0x163e('0x4a')]==='outbound'){var _0x3b71a9={'id':_0x5c36cf['id'],'name':_0x5c36cf[_0x163e('0x3c')],'strategy':_0x5c36cf[_0x163e('0x4b')],'answered':_0x5c36cf[_0x163e('0x4c')],'available':_0x5c36cf[_0x163e('0x4d')],'loggedIn':_0x5c36cf[_0x163e('0x4e')],'pTalking':_0x5c36cf[_0x163e('0x4f')],'sumBillable':_0x5c36cf[_0x163e('0x50')],'sumDuration':_0x5c36cf[_0x163e('0x51')],'sumHoldTime':_0x5c36cf[_0x163e('0x52')]||0x0,'talking':_0x5c36cf[_0x163e('0x53')],'total':_0x5c36cf[_0x163e('0x54')],'type':_0x5c36cf[_0x163e('0x4a')],'unmanaged':_0x5c36cf[_0x163e('0x55')],'abandoned':_0x5c36cf[_0x163e('0x56')],'waiting':_0x5c36cf[_0x163e('0x57')],'loggedInDb':_0x5c36cf['loggedInDb'],'dialActive':_0x5c36cf[_0x163e('0x58')],'dialMethod':_0x5c36cf[_0x163e('0x59')],'dialOriginateCallerIdName':_0x5c36cf[_0x163e('0x5a')],'dialOriginateCallerIdNumber':_0x5c36cf['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x5c36cf['dialOriginateTimeout'],'dialPrefix':_0x5c36cf['dialPrefix'],'outboundAnswerAgiCallsDay':_0x5c36cf[_0x163e('0x5b')],'outboundAnswerCallsDay':_0x5c36cf[_0x163e('0x5c')],'outboundBlacklistCallsDay':_0x5c36cf[_0x163e('0x5d')],'outboundBusyCallsDay':_0x5c36cf[_0x163e('0x5e')],'outboundCongestionCallsDay':_0x5c36cf[_0x163e('0x5f')],'outboundDropCallsDayACS':_0x5c36cf['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x5c36cf['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x5c36cf[_0x163e('0x60')],'outboundNoAnswerCallsDay':_0x5c36cf[_0x163e('0x61')],'outboundNoSuchCallsDay':_0x5c36cf[_0x163e('0x62')],'outboundOriginateFailureCallsDay':_0x5c36cf[_0x163e('0x63')],'outboundReCallsDay':_0x5c36cf[_0x163e('0x64')],'outboundRejectCallsDay':_0x5c36cf['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x5c36cf['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x5c36cf[_0x163e('0x65')],'predictiveIntervalAvgHoldtime':_0x5c36cf[_0x163e('0x66')],'predictiveIntervalAvgTalktime':_0x5c36cf[_0x163e('0x67')],'predictiveIntervalDroppedCallsCallersExit':_0x5c36cf[_0x163e('0x68')],'predictiveIntervalDroppedCallsTimeout':_0x5c36cf[_0x163e('0x69')],'predictiveIntervalErlangCalls':_0x5c36cf['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x5c36cf[_0x163e('0x6a')],'predictiveIntervalHitRate':_0x5c36cf[_0x163e('0x6b')],'predictiveIntervalMultiplicativeFactor':_0x5c36cf['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x5c36cf[_0x163e('0x6c')],'predictiveIntervalAvailable':_0x5c36cf[_0x163e('0x6d')],'predictiveIntervalTotalCalls':_0x5c36cf['predictiveIntervalTotalCalls'],'message':_0x5c36cf[_0x163e('0x3d')],'originated':_0x5c36cf[_0x163e('0x6e')],'erlangCalls':_0x5c36cf[_0x163e('0x6f')],'erlangCallToSecond':_0x5c36cf[_0x163e('0x70')],'erlangAbandonmentRate':_0x5c36cf['erlangAbandonmentRate'],'erlangBusyFactor':_0x5c36cf[_0x163e('0x71')],'startPredictive':_0x5c36cf['startPredictive'],'startProgressive':_0x5c36cf[_0x163e('0x72')]};if(_0x5c36cf[_0x163e('0x73')]){_0x3b71a9[_0x163e('0x73')]={'id':_0x5c36cf[_0x163e('0x73')]['id'],'name':_0x5c36cf['Trunk'][_0x163e('0x3c')],'active':_0x5c36cf[_0x163e('0x73')][_0x163e('0x74')],'callerid':_0x5c36cf[_0x163e('0x73')][_0x163e('0x75')]};}if(_0x5c36cf[_0x163e('0x42')]){_0x3b71a9[_0x163e('0x42')]={'id':_0x5c36cf['Interval']['id'],'name':_0x5c36cf['Interval'][_0x163e('0x3c')]};}var _0x117199=md5(JSON[_0x163e('0x46')](_0x3b71a9));if(_0x5c36cf[_0x163e('0x4')]!==_0x117199){_0x5c36cf['md5']=_0x117199;emit(util[_0x163e('0x76')](_0x163e('0x77'),_0x3b71a9['name']),'voice_queue:save',_0x3b71a9);}}}function emitCampaignSummary(_0x3b1a9b){if(_0x3b1a9b[_0x163e('0x4a')]===_0x163e('0x78')){emit(util[_0x163e('0x76')]('campaign:ivr:%s',_0x3b1a9b['name']),_0x163e('0x79'),_0x3b1a9b);}}function checkGetDataPredictive(_0x2ba4b0){if(isNotNull(_0x2ba4b0)&&!_[_0x163e('0x7a')](_0x2ba4b0)){loggerPredictive['info'](_0x163e('0x7b'));loggerPredictive[_0x163e('0x7c')](_0x163e('0x7d'),_0x2ba4b0['predictiveIntervalTotalCalls']);loggerPredictive['info'](_0x163e('0x7e'),_0x2ba4b0[_0x163e('0x65')]);loggerPredictive[_0x163e('0x7c')](_0x163e('0x7f'),_0x2ba4b0[_0x163e('0x69')]);loggerPredictive['info'](_0x163e('0x80'),_0x2ba4b0['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info'](_0x163e('0x81'),_0x2ba4b0[_0x163e('0x66')]);loggerPredictive['info'](_0x163e('0x82'),_0x2ba4b0['predictiveIntervalAvgTalktime']);loggerPredictive[_0x163e('0x7c')]('---------------------------');if(_0x2ba4b0[_0x163e('0x83')]>0x0){if(!_[_0x163e('0x3a')](_0x2ba4b0['predictiveIntervalAvgTalktime'])&&_0x2ba4b0['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x163e('0x7c')](_0x163e('0x84'));if(!_[_0x163e('0x3a')](_0x2ba4b0['predictiveIntervalAvgHoldtime'])&&_0x2ba4b0[_0x163e('0x66')]>0x0){return!![];}loggerPredictive['info'](_0x163e('0x85'));}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x163e('0x7c')](_0x163e('0x86'));}return![];}function mergeDataErlangB(_0x574f54){return function(_0x311248){loggerPredictive[_0x163e('0x7c')](_0x163e('0x87'));loggerPredictive['info'](_0x163e('0x88'),_0x311248[_0x163e('0x6f')]);loggerPredictive[_0x163e('0x7c')](_0x163e('0x89'),_0x311248[_0x163e('0x70')]);loggerPredictive[_0x163e('0x7c')](_0x163e('0x8a'),_0x311248[_0x163e('0x8b')]);loggerPredictive[_0x163e('0x7c')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x311248[_0x163e('0x71')]);loggerPredictive[_0x163e('0x7c')](_0x163e('0x8a'),_0x311248[_0x163e('0x8b')]);loggerPredictive[_0x163e('0x7c')](_0x163e('0x8c'));_[_0x163e('0x8d')](_0x574f54,_0x311248);};}function getDiff(_0x268184){var _0x37271a=moment()[_0x163e('0x47')](0x0);var _0x2b5005=moment(_0x268184)['milliseconds'](0x0);return _0x37271a[_0x163e('0x8e')](_0x2b5005,_0x163e('0x48'));}function ifInterval(_0x3d33de,_0x37d094){if(_['isUndefined'](_0x37d094)){return![];}return getDiff(_0x37d094)<_0x3d33de*0x3c;}function freeVariablesPredictive(_0x5c5288){if(isNotNull(_0x5c5288)){if(!_['isUndefined'](_0x5c5288[_0x163e('0x72')])){_0x5c5288[_0x163e('0x72')]=undefined;loggerPredictive[_0x163e('0x7c')](_0x5c5288['name'],'clearing\x20variable\x20start\x20progressive');}if(!_['isUndefined'](_0x5c5288[_0x163e('0x26')])){_0x5c5288['startPredictive']=undefined;loggerPredictive['info'](_0x5c5288[_0x163e('0x3c')],_0x163e('0x8f'));}if(!_[_0x163e('0x3a')](_0x5c5288[_0x163e('0x90')])){clearInterval(_0x5c5288[_0x163e('0x90')]);_0x5c5288[_0x163e('0x90')]=undefined;loggerPredictive[_0x163e('0x7c')](_0x5c5288[_0x163e('0x3c')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x377f02,_0x3538d8){if(_0x3538d8===0x0){return 0x0;}var _0x114d9b=0x1;for(var _0x234b00=0x1;_0x234b00<=_0x3538d8;_0x234b00+=0x1){_0x114d9b=0x1+_0x114d9b*_0x234b00/_0x377f02;}return 0x1/_0x114d9b;}function isVoiceQueueOutbound(_0x2b4be5){return _0x2b4be5===_0x163e('0x91');}function isNotPreview(_0x4ccc27){return _0x4ccc27!==_0x163e('0x1c');}function isCampaignIvr(_0x62707c){return _0x62707c===_0x163e('0x78');}function getCallerId(_0x2e5812,_0x8573c0,_0x374993){if(!_[_0x163e('0x3a')](_0x374993)&&typeof _0x374993===_0x163e('0x92')&&!_[_0x163e('0x7a')](_0x374993)){if(!_[_0x163e('0x3a')](_0x8573c0)&&typeof _0x8573c0===_0x163e('0x92')&&!_['isEmpty'](_0x8573c0)){return util['format'](_0x163e('0x93'),_0x8573c0,_0x374993);}return util[_0x163e('0x76')](_0x163e('0x93'),_0x374993,_0x374993);}if(!_[_0x163e('0x3a')](_0x2e5812)&&typeof _0x2e5812==='string'&&!_[_0x163e('0x7a')](_0x2e5812)){return _0x2e5812;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x4bb40c,_0x225deb){return function(_0x48338e){freeVariablesPredictive(_0x225deb);emitVoiceQueueSummary(_0x225deb);emitCampaignSummary(_0x225deb);loggerSyncQueueSummary[_0x163e('0x94')](_0x4bb40c,util[_0x163e('0x95')](_0x48338e,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x2b2107,_0x43bd42){return function(_0x3ce7e5){loggerPredictive['error'](_0x43bd42[_0x163e('0x3c')],_0x2b2107);loggerPredictive[_0x163e('0x94')](_0x3ce7e5[_0x163e('0x96')]);freeVariablesPredictive(_0x43bd42);};}function loggerCatch(_0x4ce7a0){return function(_0x1714fa){logger[_0x163e('0x94')](_0x4ce7a0,util[_0x163e('0x95')](_0x1714fa,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x13c087){return _0x13c087&&!_['isUndefined'](_0x13c087)&&_0x13c087['length']>0x0;}function decremetOriginate(_0x2588a5){if(!_[_0x163e('0x3a')](_0x2588a5)&&_0x2588a5!==null){if(typeof _0x2588a5['originated']!==_0x163e('0x97')){if(_0x2588a5[_0x163e('0x6e')]>0x0){_0x2588a5[_0x163e('0x6e')]-=0x1;}else{logger[_0x163e('0x94')](_0x163e('0x98'));}}}else{logger['error'](_0x163e('0x99'));}}function checkContactLowerLimitOriginate(_0x15bed4,_0x173b22,_0x2eeda2){if(_0x173b22>_0x2eeda2){for(var _0xc07c6d=0x0;_0xc07c6d<_0x173b22-_0x2eeda2;_0xc07c6d+=0x1){decremetOriginate(_0x15bed4);}}}function loggerGetContactDialer(_0x2f153e,_0x1afe8d,_0x311a49){return function(_0x5cc0df){checkContactLowerLimitOriginate(_0x1afe8d,_0x311a49,0x0);logger[_0x163e('0x94')](_0x2f153e,util[_0x163e('0x95')](_0x5cc0df,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3caf17){return function(_0x43150d){if(isNotNull(_0x43150d)&&isNotNull(_0x43150d[0x0])){if(_0x43150d[0x0][_0x163e('0x9a')]>0x0){_0x3caf17[_0x163e('0x3d')]=_0x163e('0x9b');logger[_0x163e('0x7c')](_0x163e('0x9c')+_0x3caf17[_0x163e('0x3c')],_0x43150d[0x0][_0x163e('0x9a')],'contacts');}else{_0x3caf17[_0x163e('0x3d')]=_0x163e('0x9d');logger[_0x163e('0x7c')]('[getContactDialer2][Empty]'+_0x3caf17[_0x163e('0x3c')]);}}};}function notSendMessagesQueue(_0x326f2b){if(_0x326f2b['sendMessageOneNotActive']){freeVariablesPredictive(_0x326f2b);if(_0x326f2b[_0x163e('0x6e')]===0x0&&_0x326f2b['talking']===0x0&&_0x326f2b['waiting']===0x0&&(_0x326f2b[_0x163e('0x4f')]||0x0)===0x0){_0x326f2b[_0x163e('0x9e')]=![];_0x326f2b[_0x163e('0x4d')]=0x0;_0x326f2b['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0x163e('0x94')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x326f2b[_0x163e('0x3c')],'is\x20not\x20active');}else{_0x326f2b['message']=_0x163e('0x9f');loggerSyncQueueSummary['error'](_0x163e('0xa0'),_0x326f2b['name'],_0x163e('0xa1'));}emitVoiceQueueSummary(_0x326f2b);}}function notSendMessagesCampaign(_0x23e930){if(_0x23e930[_0x163e('0x9e')]){if(_0x23e930['originated']===0x0){_0x23e930[_0x163e('0x9e')]=![];_0x23e930[_0x163e('0x3d')]=_0x163e('0x3e');loggerSyncQueueSummary[_0x163e('0x94')](_0x163e('0xa2'),_0x23e930['name'],_0x163e('0xa3'));}else{_0x23e930['message']=_0x163e('0x9f');loggerSyncQueueSummary[_0x163e('0x94')](_0x163e('0xa2'),_0x23e930[_0x163e('0x3c')],_0x163e('0xa1'));}emitCampaignSummary(_0x23e930);}}function createObjHistory(_0x45ab86,_0x482a7e,_0x519f5d,_0x55519b,_0x31954f){_0x45ab86['message']=_0x519f5d;var _0x2df7a1=new Action(_0x45ab86,_0x482a7e);var _0x40492e=new History(_0x2df7a1);_0x40492e[_0x163e('0xa4')]=_0x55519b;_0x40492e[_0x163e('0xa5')]=_0x31954f;_0x40492e[_0x163e('0xa6')]=_0x2df7a1[_0x163e('0xa7')];return _0x40492e;}Dialer['prototype'][_0x163e('0x39')]=function(){var _0x42e0f4=this;setInterval(function(){_0x42e0f4[_0x163e('0xa8')](_0x42e0f4[_0x163e('0x24')],_0x163e('0xa9'));_0x42e0f4['clearZombieChannels'](_0x42e0f4[_0x163e('0xaa')],_0x163e('0xab'));},0x32c8);};Dialer[_0x163e('0xac')]['clearZombieChannels']=function(_0x15fb27,_0x42c54e){var _0x45418b=this;for(var _0x2ebd53 in _0x15fb27){if(typeof _0x15fb27[_0x2ebd53]!=='undefined'){this[_0x163e('0x1b')][_0x163e('0x19')](function(){if(!_[_0x163e('0xad')](_0x15fb27[_0x2ebd53])){return ami['Action']({'action':_0x163e('0xae'),'channel':_0x15fb27[_0x2ebd53]['channel']})[_0x163e('0xaf')](function(_0x485874){if(_0x485874[_0x163e('0x3d')]===_0x163e('0xb0')){setTimeout(function(){if(_0x15fb27[_0x2ebd53]&&_0x15fb27[_0x2ebd53][_0x163e('0x4a')]!==_0x163e('0x78')){_0x45418b[_0x163e('0xb1')](_0x45418b['voiceQueues'][_0x15fb27[_0x2ebd53][_0x163e('0xb2')]]);logger[_0x163e('0x94')](_0x163e('0xb3'),_0x42c54e,_0x2ebd53,_0x15fb27[_0x2ebd53][_0x163e('0xb2')]);delete _0x15fb27[_0x2ebd53];}if(_0x15fb27[_0x2ebd53]&&_0x15fb27[_0x2ebd53]['type']===_0x163e('0x78')){_0x45418b[_0x163e('0xb1')](_0x45418b[_0x163e('0x1e')][_0x15fb27[_0x2ebd53][_0x163e('0xb2')]]);logger[_0x163e('0x94')]('[Dialer][checkChannel][ivr]',_0x42c54e,_0x2ebd53,_0x15fb27[_0x2ebd53][_0x163e('0xb2')]);delete _0x15fb27[_0x2ebd53];}},0x2328);}});}});}}};Dialer[_0x163e('0xac')][_0x163e('0xb4')]=function(_0x4d0561){return BPromise[_0x163e('0xb5')]()[_0x163e('0xb6')](cmHopper['countReScheduled'](_0x4d0561))['catch'](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x163e('0xac')]['checkIsBlackList']=function(_0x53b549){return BPromise[_0x163e('0xb5')]()[_0x163e('0xb6')](cmHopperBlack['checkIsBlackList'](_0x53b549))[_0x163e('0xaf')](loggerCatch(_0x163e('0xb7')));};Dialer[_0x163e('0xac')][_0x163e('0xb8')]=function(_0x5e4896){return BPromise['resolve']()[_0x163e('0xb6')](cmHopperBlack['checkIsBlackListIvr'](_0x5e4896))[_0x163e('0xaf')](loggerCatch(_0x163e('0xb9')));};Dialer[_0x163e('0xac')][_0x163e('0xba')]=function(_0x1e5543){return BPromise['resolve']()['then'](cmHopperHistory[_0x163e('0xbb')](_0x1e5543))[_0x163e('0xaf')](loggerCatch(_0x163e('0xbc')));};Dialer[_0x163e('0xac')]['rescheduleContact']=function(_0x3093a9){return BPromise[_0x163e('0xb5')]()['then'](cmHopper[_0x163e('0xbd')](_0x3093a9))[_0x163e('0xaf')](loggerCatch(_0x163e('0xbe')));};Dialer[_0x163e('0xac')]['unlockContact']=function(_0x389441,_0x418a16,_0x91ab44){return BPromise['resolve']()['then'](cmHopper[_0x163e('0xbf')](_0x389441,_0x418a16,_0x91ab44))[_0x163e('0xaf')](loggerCatch(_0x163e('0xc0')));};Dialer[_0x163e('0xac')][_0x163e('0xc1')]=function(_0xf3f960,_0x363451,_0x406ef3,_0x223be1){return BPromise['resolve']()[_0x163e('0xb6')](cmHopper[_0x163e('0xc1')](_0xf3f960,_0x363451,_0x406ef3,_0x223be1))[_0x163e('0xaf')](loggerCatch(_0x163e('0xc2')));};Dialer[_0x163e('0xac')][_0x163e('0xc3')]=function(_0x44de96,_0x7840ad,_0x115588){return BPromise[_0x163e('0xb5')]()[_0x163e('0xb6')](cmHopper['getContactDialerIvr'](_0x44de96,_0x7840ad,_0x115588))[_0x163e('0xaf')](loggerCatch(_0x163e('0xc2')));};Dialer[_0x163e('0xac')][_0x163e('0xc4')]=function(_0x524c81){return BPromise[_0x163e('0xb5')]()[_0x163e('0xb6')](voiceQueueRt[_0x163e('0xc4')](_0x524c81))[_0x163e('0xaf')](loggerCatch(_0x163e('0xc5')));};Dialer[_0x163e('0xac')][_0x163e('0xc6')]=function(_0xe3e519){return BPromise[_0x163e('0xb5')]()[_0x163e('0xb6')](cmHopper[_0x163e('0xc6')](_0xe3e519))[_0x163e('0xaf')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x163e('0xac')]['createHistory']=function(_0x37bbad){return BPromise[_0x163e('0xb5')]()[_0x163e('0xb6')](cmHopperHistory[_0x163e('0xc7')](_0x37bbad))[_0x163e('0xaf')](loggerCatch('[createHistory]\x20'));};Dialer[_0x163e('0xac')]['updateOriginated']=function(_0x25a2be){if(!_[_0x163e('0x3a')](_0x25a2be)&&_0x25a2be!==null){if(typeof _0x25a2be[_0x163e('0x6e')]!==_0x163e('0x97')){if(_0x25a2be['originated']>0x0){_0x25a2be[_0x163e('0x6e')]-=0x1;}else{logger[_0x163e('0x94')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x163e('0xac')][_0x163e('0xc8')]=function(_0x530791,_0x1ce73b){var _0xad53cd=this;return function(_0x44c2fd){_0xad53cd[_0x163e('0xb1')](_0x1ce73b);logger['error'](_0x530791,util[_0x163e('0x95')](_0x44c2fd,{'showHidden':![],'depth':null}));};};Dialer[_0x163e('0xac')][_0x163e('0xc9')]=function(_0x949bd1,_0x15d0c0,_0x56649c){var _0x5ac30a={'state':0x19,'statedesc':_0x163e('0xca')};this[_0x163e('0xb1')](_0x15d0c0);this['saveInDb'](_[_0x163e('0x8d')](_0x5ac30a,_['pick'](_0x56649c,[_0x163e('0xcb'),'ListId',_0x163e('0xcc'),'VoiceQueueId',_0x163e('0xcd')])),_0x163e('0xce'),_0x163e('0xcf'));logger[_0x163e('0x94')](_0x949bd1);};Dialer[_0x163e('0xac')]['isSuccess']=function(_0x21416b){return _0x21416b===_0x163e('0xd0');};Dialer[_0x163e('0xac')][_0x163e('0xd1')]=function(_0x1f0f2d){return!_[_0x163e('0x3a')](_0x1f0f2d)&&_0x1f0f2d&&!_[_0x163e('0x3a')](_0x1f0f2d[_0x163e('0x3c')])&&!_['isUndefined'](_0x1f0f2d[_0x163e('0x74')])&&_0x1f0f2d[_0x163e('0x74')]&&(this[_0x163e('0x20')][util[_0x163e('0x76')]('SIP/%s',_0x1f0f2d[_0x163e('0x3c')])]['status']===_0x163e('0xd2')||this['trunks'][util[_0x163e('0x76')](_0x163e('0xd3'),_0x1f0f2d[_0x163e('0x3c')])][_0x163e('0xae')]===_0x163e('0xd4'));};Dialer['prototype'][_0x163e('0xd5')]=function(_0x118c0b,_0x1c62bb,_0x4906a6){this[_0x163e('0xc7')](_0x118c0b)['catch'](loggerCatch(_0x1c62bb));this[_0x163e('0xc6')](_0x118c0b)['catch'](loggerCatch(_0x4906a6));};Dialer[_0x163e('0xac')]['syncVarSet']=function(_0xd67a5e){var _0x1f7faa=this[_0x163e('0x24')][_0xd67a5e[_0x163e('0xd6')]];var _0x1f3a2d;if(!_['isNil'](_0xd67a5e)&&!_[_0x163e('0xad')](_0xd67a5e['variable'])&&!_['isNil'](_0xd67a5e[_0x163e('0xd7')][_0x163e('0xd8')])&&_0xd67a5e['exten']===_0x163e('0xd9')&&_0x1f7faa){if(_0x1f7faa['type']!==_0x163e('0x78')&&this['voiceQueues'][_0x1f7faa[_0x163e('0xb2')]][_0x163e('0xda')]&&_0xd67a5e['value']===_0x163e('0xdb')){delete this[_0x163e('0x24')][_0xd67a5e[_0x163e('0xd6')]];this[_0x163e('0xb1')](this[_0x163e('0x1d')][_0x1f7faa[_0x163e('0xb2')]]);this[_0x163e('0x1d')][_0x1f7faa[_0x163e('0xb2')]][_0x163e('0x5c')]+=0x1;this['voiceQueues'][_0x1f7faa[_0x163e('0xb2')]][_0x163e('0x5b')]+=0x1;_0x1f3a2d=new Hangup(_0x1f7faa,_0xd67a5e);_0x1f3a2d[_0x163e('0xa4')]=0x12;_0x1f3a2d[_0x163e('0xa5')]='HangupInAMD';_0x1f3a2d['membername']=_0x163e('0xdc');this[_0x163e('0xd5')](_0x1f3a2d,_0x163e('0xdd'),_0x163e('0xde'));}if(_0x1f7faa['type']!==_0x163e('0x78')&&this[_0x163e('0x1d')][_0x1f7faa[_0x163e('0xb2')]][_0x163e('0xda')]&&_0xd67a5e[_0x163e('0xdf')]===_0x163e('0xe0')){var _0x2aa1dd=this;return new BPromise(function(_0x3d6bc3,_0x1806c1){delete _0x2aa1dd[_0x163e('0x24')][_0xd67a5e[_0x163e('0xd6')]];_0x2aa1dd[_0x163e('0xb1')](_0x2aa1dd['voiceQueues'][_0x1f7faa[_0x163e('0xb2')]]);_0x2aa1dd[_0x163e('0x1d')][_0x1f7faa[_0x163e('0xb2')]]['outboundAnswerCallsDay']+=0x1;_0x2aa1dd[_0x163e('0x1d')][_0x1f7faa[_0x163e('0xb2')]][_0x163e('0x5b')]+=0x1;var _0x4ec196=_0x2aa1dd['voiceQueues'][_0x1f7faa['queue']];var _0x31f93a=new Hangup(_0x1f7faa,_0xd67a5e);_0x31f93a['state']=0x13;_0x31f93a[_0x163e('0xa5')]=_0x163e('0xe1');_0x31f93a['membername']=_0x163e('0xdc');_0x31f93a[_0x163e('0xe2')]+=0x1;_0x31f93a[_0x163e('0xe3')]+=0x1;_0x31f93a[_0x163e('0xe4')]=!![];_0x2aa1dd[_0x163e('0xc7')](_0x31f93a)[_0x163e('0xaf')](loggerCatch(_0x163e('0xe5')));if(_0x31f93a[_0x163e('0xe6')]+_0x31f93a['countcongestionretry']+_0x31f93a['countnoanswerretry']+_0x31f93a[_0x163e('0xe7')]+_0x31f93a[_0x163e('0xe8')]+_0x31f93a[_0x163e('0xe9')]+_0x31f93a[_0x163e('0xe2')]+_0x31f93a[_0x163e('0xea')]>=_0x4ec196[_0x163e('0xeb')]){_0x2aa1dd[_0x163e('0xec')](_0x31f93a,_0x3d6bc3,_0x1806c1,'reason19\x20machine....');}else{if(_0x31f93a['countmachineretry']>=_0x4ec196[_0x163e('0xed')]){_0x2aa1dd[_0x163e('0xee')](_0x31f93a,_0x3d6bc3,_0x1806c1,_0x163e('0xef'));}else{_0x2aa1dd[_0x163e('0xbd')]({'active':![],'countmachineretry':_0x31f93a['countmachineretry'],'scheduledat':moment()[_0x163e('0xf0')](_0x4ec196[_0x163e('0xf1')],_0x163e('0xf2'))[_0x163e('0x76')](_0x163e('0xf3')),'ContactId':_0x31f93a[_0x163e('0xcb')],'ListId':_0x31f93a[_0x163e('0xf4')],'VoiceQueueId':_0x31f93a[_0x163e('0xf5')]||undefined,'CampaignId':_0x31f93a[_0x163e('0xcd')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x3d6bc3({'reschedule':0x1});}}});}if(_0x1f7faa[_0x163e('0x4a')]===_0x163e('0x78')&&this[_0x163e('0x1e')][_0x1f7faa[_0x163e('0xb2')]][_0x163e('0xda')]&&_0xd67a5e[_0x163e('0xdf')]===_0x163e('0xdb')){delete this['uniqueId'][_0xd67a5e[_0x163e('0xd6')]];this[_0x163e('0xb1')](this[_0x163e('0x1e')][_0x1f7faa['queue']]);_0x1f3a2d=new Hangup(_0x1f7faa,_0xd67a5e);_0x1f3a2d[_0x163e('0xa4')]=0x12;_0x1f3a2d[_0x163e('0xa5')]=_0x163e('0xf6');_0x1f3a2d[_0x163e('0xf7')]=_0x163e('0xdc');this['saveInDb'](_0x1f3a2d,_0x163e('0xf8'),'[syncHangupInAMDIvr]');}if(_0x1f7faa[_0x163e('0x4a')]==='ivr'&&this[_0x163e('0x1e')][_0x1f7faa[_0x163e('0xb2')]]['dialAMDActive']&&_0xd67a5e[_0x163e('0xdf')]==='MACHINE'){var _0x2aa1dd=this;return new BPromise(function(_0x540255,_0x23c263){delete _0x2aa1dd['uniqueId'][_0xd67a5e['uniqueid']];_0x2aa1dd[_0x163e('0xb1')](_0x2aa1dd[_0x163e('0x1e')][_0x1f7faa[_0x163e('0xb2')]]);_0x2aa1dd['campaigns'][_0x1f7faa[_0x163e('0xb2')]][_0x163e('0x5c')]+=0x1;_0x2aa1dd[_0x163e('0x1e')][_0x1f7faa[_0x163e('0xb2')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x226d25=_0x2aa1dd[_0x163e('0x1e')][_0x1f7faa['queue']];var _0x403293=new Hangup(_0x1f7faa,_0xd67a5e);_0x403293['state']=0x13;_0x403293[_0x163e('0xa5')]=_0x163e('0xe1');_0x403293['membername']=_0x163e('0xdc');_0x403293[_0x163e('0xe2')]+=0x1;_0x403293['countglobal']+=0x1;_0x403293[_0x163e('0xe4')]=!![];_0x2aa1dd[_0x163e('0xc7')](_0x403293)['catch'](loggerCatch(_0x163e('0xe5')));if(_0x403293[_0x163e('0xe6')]+_0x403293[_0x163e('0xf9')]+_0x403293['countnoanswerretry']+_0x403293['countnosuchnumberretry']+_0x403293[_0x163e('0xe8')]+_0x403293[_0x163e('0xe9')]+_0x403293[_0x163e('0xe2')]+_0x403293[_0x163e('0xea')]>=_0x226d25[_0x163e('0xeb')]){_0x2aa1dd['stateGlobal'](_0x403293,_0x540255,_0x23c263,_0x163e('0xfa'));}else{if(_0x403293['countmachineretry']>=_0x226d25[_0x163e('0xed')]){_0x2aa1dd[_0x163e('0xee')](_0x403293,_0x540255,_0x23c263,_0x163e('0xef'));}else{_0x2aa1dd['rescheduleContact']({'active':![],'countmachineretry':_0x403293['countmachineretry'],'scheduledat':moment()[_0x163e('0xf0')](_0x226d25[_0x163e('0xf1')],_0x163e('0xf2'))[_0x163e('0x76')](_0x163e('0xf3')),'ContactId':_0x403293[_0x163e('0xcb')],'ListId':_0x403293[_0x163e('0xf4')],'VoiceQueueId':_0x403293[_0x163e('0xf5')]||undefined,'CampaignId':_0x403293[_0x163e('0xcd')]||undefined})[_0x163e('0xaf')](loggerCatch(_0x163e('0xfb')));_0x540255({'reschedule':0x1});}}});}}};Dialer[_0x163e('0xac')][_0x163e('0x33')]=function(_0x5a507a){var _0x40cd8e=this[_0x163e('0x24')][_0x5a507a[_0x163e('0xd6')]];var _0xe66b4b=this;var _0x3ccea7;if(_0x40cd8e&&_0x40cd8e[_0x163e('0x4a')]==='ivr'){delete this['uniqueId'][_0x5a507a[_0x163e('0xd6')]];this['updateOriginated'](this['campaigns'][_0x40cd8e[_0x163e('0xb2')]]);this['campaigns'][_0x40cd8e[_0x163e('0xb2')]][_0x163e('0xfc')]+=0x1;_0x3ccea7=new Hangup(_0x40cd8e,_0x5a507a);this[_0x163e('0xc7')](_0x3ccea7)[_0x163e('0xaf')](loggerCatch(_0x163e('0xfd')));this[_0x163e('0xc6')](_0x3ccea7)[_0x163e('0xaf')](loggerCatch(_0x163e('0xfe')));}if(_0x40cd8e&&_0x40cd8e[_0x163e('0x4a')]!==_0x163e('0x78')&&isNotNull(this['voiceQueues'][_0x40cd8e['queue']][_0x163e('0xff')])){delete this['uniqueId'][_0x5a507a['uniqueid']];this[_0x163e('0xb1')](this['voiceQueues'][_0x40cd8e[_0x163e('0xb2')]]);this['voiceQueues'][_0x40cd8e[_0x163e('0xb2')]][_0x163e('0x5c')]+=0x1;this[_0x163e('0x1d')][_0x40cd8e[_0x163e('0xb2')]][_0x163e('0x5b')]+=0x1;_0x3ccea7=new Hangup(_0x40cd8e,_0x5a507a);_0x3ccea7[_0x163e('0xa4')]=0x10;_0x3ccea7[_0x163e('0xa5')]=_0x163e('0x100');_0x3ccea7[_0x163e('0xf7')]=_0x163e('0x101');this[_0x163e('0xc7')](_0x3ccea7)['catch'](loggerCatch(_0x163e('0xfd')));this[_0x163e('0xc6')](_0x3ccea7)[_0x163e('0xaf')](loggerCatch(_0x163e('0xfe')));}if(_0x40cd8e&&_0x40cd8e[_0x163e('0x4a')]!==_0x163e('0x78')&&!isNotNull(this[_0x163e('0x1d')][_0x40cd8e['queue']]['dialQueueProject'])){delete this[_0x163e('0x24')][_0x5a507a[_0x163e('0xd6')]];this['updateOriginated'](this[_0x163e('0x1d')][_0x40cd8e[_0x163e('0xb2')]]);this['voiceQueues'][_0x40cd8e['queue']][_0x163e('0x102')]+=0x1;_0x3ccea7=new Hangup(_0x40cd8e,_0x5a507a);_0x3ccea7[_0x163e('0xa4')]=0xc;_0x3ccea7['statedesc']=_0x5a507a[_0x163e('0x103')];_0x3ccea7[_0x163e('0xf7')]=_0x163e('0x104');this[_0x163e('0xc7')](_0x3ccea7)[_0x163e('0xaf')](loggerCatch(_0x163e('0xfd')));this[_0x163e('0xc6')](_0x3ccea7)[_0x163e('0xaf')](loggerCatch(_0x163e('0xfe')));}};Dialer[_0x163e('0xac')]['syncAgentComplete']=function(_0x57db1c){var _0x143a88=this[_0x163e('0x24')][_0x57db1c[_0x163e('0xd6')]];var _0x3d5924=this;if(this['voiceQueues'][_0x57db1c['queue']]){if(_0x143a88&&_0x143a88['type']!==_0x163e('0x78')){delete this[_0x163e('0x24')][_0x57db1c[_0x163e('0xd6')]];this[_0x163e('0x1d')][_0x57db1c['queue']][_0x163e('0x5c')]+=0x1;var _0x2c6c96=new AgentComplete(_0x143a88,_0x57db1c);if(_0x57db1c['reason']==='agent'){_0x2c6c96[_0x163e('0x105')]=this[_0x163e('0x1d')][_0x57db1c['queue']][_0x163e('0x106')]&&this[_0x163e('0x1d')][_0x57db1c[_0x163e('0xb2')]][_0x163e('0x107')]?moment()[_0x163e('0x76')](_0x163e('0xf3')):undefined;}this[_0x163e('0xc7')](_0x2c6c96)['catch'](loggerCatch(_0x163e('0x108')));this[_0x163e('0xc6')](_0x2c6c96)[_0x163e('0xaf')](loggerCatch(_0x163e('0x109')));}}};Dialer[_0x163e('0xac')][_0x163e('0x2a')]=function(_0x477115){if(this['voiceQueues'][_0x477115[_0x163e('0xb2')]]){if(this[_0x163e('0x24')][_0x477115[_0x163e('0xd6')]]&&this[_0x163e('0x24')][_0x477115[_0x163e('0xd6')]][_0x163e('0x4a')]!==_0x163e('0x78')){this[_0x163e('0xb1')](this[_0x163e('0x1d')][_0x477115[_0x163e('0xb2')]]);this[_0x163e('0x24')][_0x477115['uniqueid']]['answertime']=moment()[_0x163e('0x76')](_0x163e('0xf3'));}}};Dialer[_0x163e('0xac')][_0x163e('0x10a')]=function(_0x65ff91){this[_0x163e('0xc7')](_0x65ff91)[_0x163e('0xaf')](loggerCatch(_0x163e('0x108')));this[_0x163e('0xc6')](_0x65ff91)[_0x163e('0xaf')](loggerCatch(_0x163e('0x10b')));};Dialer[_0x163e('0xac')][_0x163e('0x2c')]=function(_0x1c3de2){var _0x2fc181=this[_0x163e('0x24')][_0x1c3de2[_0x163e('0xd6')]];var _0x5bb392=this;if(this[_0x163e('0x1d')][_0x1c3de2[_0x163e('0xb2')]]){if(_0x2fc181&&_0x2fc181[_0x163e('0x4a')]!==_0x163e('0x78')){delete this[_0x163e('0x24')][_0x1c3de2['uniqueid']];this[_0x163e('0xb1')](this[_0x163e('0x1d')][_0x1c3de2[_0x163e('0xb2')]]);_0x2fc181[_0x163e('0x10c')]=moment()[_0x163e('0x76')](_0x163e('0xf3'));var _0x5548ec=new QueueCallerAbandon(_0x2fc181,_0x1c3de2);if(getSeconds(_0x2fc181['droptime'],_0x2fc181[_0x163e('0x10d')])>=_0x2fc181[_0x163e('0x10e')]){this[_0x163e('0x1d')][_0x1c3de2[_0x163e('0xb2')]][_0x163e('0x69')]+=0x1;this[_0x163e('0x1d')][_0x1c3de2[_0x163e('0xb2')]][_0x163e('0x60')]+=0x1;this['voiceQueues'][_0x1c3de2[_0x163e('0xb2')]][_0x163e('0x6a')]+=0x1;_0x5548ec[_0x163e('0xa4')]=0xa;_0x5548ec['statedesc']=_0x163e('0x10f');_0x5548ec[_0x163e('0x110')]=_0x163e('0x111');_0x5548ec[_0x163e('0x105')]=this[_0x163e('0x1d')][_0x1c3de2[_0x163e('0xb2')]][_0x163e('0x106')]?moment()[_0x163e('0x76')](_0x163e('0xf3')):undefined;_0x5548ec[_0x163e('0xe8')]+=0x1;_0x5548ec[_0x163e('0xe3')]+=0x1;if(_0x5548ec[_0x163e('0xe8')]>=this[_0x163e('0x1d')][_0x1c3de2[_0x163e('0xb2')]][_0x163e('0x112')]){this[_0x163e('0x10a')](_0x5548ec);}else{this[_0x163e('0xbd')]({'active':![],'countdropretry':_0x5548ec[_0x163e('0xe8')],'scheduledat':moment()[_0x163e('0xf0')](this['voiceQueues'][_0x1c3de2[_0x163e('0xb2')]][_0x163e('0x113')],_0x163e('0xf2'))[_0x163e('0x76')](_0x163e('0xf3')),'ContactId':_0x2fc181[_0x163e('0xcb')],'ListId':_0x2fc181['ListId'],'VoiceQueueId':_0x2fc181[_0x163e('0xf5')]||undefined,'CampaignId':_0x2fc181[_0x163e('0xcd')]||undefined})['catch'](loggerCatch(_0x163e('0x114')));var _0x2cb7fb=new History(_0x5548ec);_0x2cb7fb['state']=0xa;_0x2cb7fb[_0x163e('0xa5')]=_0x163e('0x10f');_0x2cb7fb[_0x163e('0xa7')]=moment()[_0x163e('0x76')](_0x163e('0xf3'));_0x2cb7fb[_0x163e('0xa6')]=_0x2cb7fb['starttime'];_0x2cb7fb[_0x163e('0x115')]=_0x5548ec[_0x163e('0x115')];_0x2cb7fb[_0x163e('0x116')]=_0x5548ec['calleridnum'];this[_0x163e('0xc7')](_0x2cb7fb)[_0x163e('0xaf')](loggerCatch(_0x163e('0x117')));}}else{this[_0x163e('0x1d')][_0x1c3de2['queue']][_0x163e('0x68')]+=0x1;this[_0x163e('0x1d')][_0x1c3de2[_0x163e('0xb2')]][_0x163e('0x118')]+=0x1;_0x5548ec[_0x163e('0xa4')]=0xb;_0x5548ec['statedesc']=_0x163e('0x119');_0x5548ec[_0x163e('0x110')]=_0x163e('0x11a');_0x5548ec['countabandonedretry']+=0x1;_0x5548ec[_0x163e('0xe3')]+=0x1;if(_0x5548ec[_0x163e('0xe9')]>=this[_0x163e('0x1d')][_0x1c3de2['queue']]['dialAbandonedMaxRetry']){this[_0x163e('0x10a')](_0x5548ec);}else{this[_0x163e('0xbd')]({'active':![],'countabandonedretry':_0x5548ec[_0x163e('0xe9')],'scheduledat':moment()[_0x163e('0xf0')](this['voiceQueues'][_0x1c3de2[_0x163e('0xb2')]][_0x163e('0x11b')],_0x163e('0xf2'))['format'](_0x163e('0xf3')),'ContactId':_0x2fc181[_0x163e('0xcb')],'ListId':_0x2fc181[_0x163e('0xf4')],'VoiceQueueId':_0x2fc181[_0x163e('0xf5')]||undefined,'CampaignId':_0x2fc181['CampaignId']||undefined})[_0x163e('0xaf')](loggerCatch(_0x163e('0x11c')));var _0x2cb7fb=new History(_0x5548ec);_0x2cb7fb[_0x163e('0xa4')]=0xb;_0x2cb7fb[_0x163e('0xa5')]=_0x163e('0x119');_0x2cb7fb[_0x163e('0xa7')]=moment()[_0x163e('0x76')]('YYYY-MM-DD\x20HH:mm:ss');_0x2cb7fb[_0x163e('0xa6')]=_0x2cb7fb['starttime'];_0x2cb7fb['calleridname']=_0x5548ec[_0x163e('0x115')];_0x2cb7fb['calleridnum']=_0x5548ec['calleridnum'];this[_0x163e('0xc7')](_0x2cb7fb)['catch'](loggerCatch(_0x163e('0x11d')));}}}}};Dialer['prototype']['syncNewExten']=function(_0x63a955){if(this['actions'][_0x63a955[_0x163e('0xd6')]]){this[_0x163e('0xaa')][_0x63a955['uniqueid']][_0x163e('0x11e')]=_0x63a955[_0x163e('0x11e')];}if(this[_0x163e('0x24')][_0x63a955[_0x163e('0xd6')]]){this[_0x163e('0x24')][_0x63a955['uniqueid']][_0x163e('0x11e')]=_0x63a955[_0x163e('0x11e')];}};Dialer['prototype']['syncQueueMember']=function(_0x2cf179){if(strategy[this[_0x163e('0x1d')][this[_0x163e('0xaa')][_0x2cf179[_0x163e('0x11f')]][_0x163e('0xb2')]][_0x163e('0x4b')]]==='roundrobin'){if(this['actions'][_0x2cf179[_0x163e('0x11f')]]&&_['isNil'](this[_0x163e('0xaa')][_0x2cf179[_0x163e('0x11f')]][_0x163e('0x120')])&&_0x2cf179[_0x163e('0xae')]==='1'&&_0x2cf179[_0x163e('0x121')]==='0'){if(this[_0x163e('0x1f')][_0x2cf179[_0x163e('0x122')]]){if(!this[_0x163e('0x1f')][_0x2cf179[_0x163e('0x122')]]['locked']){this['agents'][_0x2cf179[_0x163e('0x122')]]['locked']=!![];this['actions'][_0x2cf179[_0x163e('0x11f')]][_0x163e('0x120')]=!![];this[_0x163e('0xaa')][_0x2cf179[_0x163e('0x11f')]][_0x163e('0x122')]=_0x2cf179[_0x163e('0x122')];}}}}else if((strategy[this[_0x163e('0x1d')][this[_0x163e('0xaa')][_0x2cf179[_0x163e('0x11f')]][_0x163e('0xb2')]]['strategy']]||_0x163e('0x123'))===_0x163e('0x123')){if(this[_0x163e('0xaa')][_0x2cf179[_0x163e('0x11f')]]){if(this[_0x163e('0x1f')][_0x2cf179[_0x163e('0x122')]]){this[_0x163e('0xaa')][_0x2cf179['actionid']][_0x163e('0x122')]=_0x2cf179[_0x163e('0x122')];if(_['isNil'](this[_0x163e('0x28')][this[_0x163e('0xaa')][_0x2cf179['actionid']]['queue']])){this[_0x163e('0x28')][this[_0x163e('0xaa')][_0x2cf179['actionid']]['queue']]=[];}this['queueBooked'][this[_0x163e('0xaa')][_0x2cf179[_0x163e('0x11f')]][_0x163e('0xb2')]][_0x163e('0x124')](_[_0x163e('0x8d')](_['pick'](this['actions'][_0x2cf179[_0x163e('0x11f')]],[_0x163e('0x125'),_0x163e('0x122')]),{'status':_0x2cf179['status'],'paused':_0x2cf179[_0x163e('0x121')]}));}}}};function unlockQueueStatus(_0xa05646,_0x328ee7){setTimeout(function(){if(_['isUndefined'](_0xa05646[_0x163e('0x126')])){loggerBooked[_0x163e('0x94')](_0x163e('0x127'),_0x328ee7);}_0xa05646[_0x163e('0x126')]=!![];loggerBooked['info'](_0x163e('0x128'),_0x328ee7,JSON['stringify'](_['pick'](_0xa05646,[_0x163e('0x3c'),_0x163e('0x126')])));},0x1f3);}Dialer[_0x163e('0xac')][_0x163e('0x37')]=function(_0x2125c7){var _0x530f00=this;var _0x3e621b=_0x530f00[_0x163e('0x1d')][_0x530f00[_0x163e('0xaa')][_0x2125c7[_0x163e('0x11f')]][_0x163e('0xb2')]];if(strategy[this[_0x163e('0x1d')][this['actions'][_0x2125c7[_0x163e('0x11f')]][_0x163e('0xb2')]]['strategy']]===_0x163e('0x129')){if(this['actions'][_0x2125c7['actionid']]&&this[_0x163e('0xaa')][_0x2125c7['actionid']]['stateinterface']){this[_0x163e('0x1c')][_0x163e('0x12a')](this[_0x163e('0xaa')][_0x2125c7[_0x163e('0x11f')]]['idHopper'],this[_0x163e('0xaa')][_0x2125c7[_0x163e('0x11f')]]['stateinterface'])[_0x163e('0xaf')](function(_0x42f68b){logger['error']('[Catch][Preview][syncQueueStatusComplete]',util[_0x163e('0x95')](_0x42f68b,{'showHidden':![],'depth':null}));})[_0x163e('0x12b')](function(){_0x530f00['updateOriginated'](_0x530f00[_0x163e('0x1d')][_0x530f00[_0x163e('0xaa')][_0x2125c7['actionid']][_0x163e('0xb2')]]);_0x530f00[_0x163e('0x1f')][_0x530f00[_0x163e('0xaa')][_0x2125c7[_0x163e('0x11f')]][_0x163e('0x122')]]['locked']=![];delete _0x530f00[_0x163e('0xaa')][_0x2125c7[_0x163e('0x11f')]];unlockQueueStatus(_0x3e621b);});}else{this[_0x163e('0xb1')](this['voiceQueues'][this[_0x163e('0xaa')][_0x2125c7[_0x163e('0x11f')]][_0x163e('0xb2')]]);this[_0x163e('0xbd')]({'active':![],'ContactId':this['actions'][_0x2125c7[_0x163e('0x11f')]][_0x163e('0xcb')],'ListId':this[_0x163e('0xaa')][_0x2125c7[_0x163e('0x11f')]][_0x163e('0xf4')],'VoiceQueueId':this[_0x163e('0xaa')][_0x2125c7[_0x163e('0x11f')]]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x2125c7[_0x163e('0x11f')]][_0x163e('0xcd')]||undefined})[_0x163e('0xaf')](loggerCatch(_0x163e('0x12c')));delete this[_0x163e('0xaa')][_0x2125c7[_0x163e('0x11f')]];unlockQueueStatus(_0x3e621b);}}else if((strategy[this[_0x163e('0x1d')][this[_0x163e('0xaa')][_0x2125c7[_0x163e('0x11f')]][_0x163e('0xb2')]][_0x163e('0x4b')]]||'rrmemory')===_0x163e('0x123')){var _0x484b5f;if(this[_0x163e('0xaa')][_0x2125c7[_0x163e('0x11f')]]&&!_['isEmpty'](this[_0x163e('0x28')][this[_0x163e('0xaa')][_0x2125c7[_0x163e('0x11f')]]['queue']])){if(this[_0x163e('0x12d')][_0x530f00[_0x163e('0xaa')][_0x2125c7[_0x163e('0x11f')]][_0x163e('0xb2')]]){this['queueBookedRR'][_0x530f00[_0x163e('0xaa')][_0x2125c7[_0x163e('0x11f')]][_0x163e('0xb2')]]=this['queueBookedRR'][this['actions'][_0x2125c7['actionid']][_0x163e('0xb2')]]?this['queueBookedRR'][this[_0x163e('0xaa')][_0x2125c7[_0x163e('0x11f')]][_0x163e('0xb2')]]:this[_0x163e('0x28')][this[_0x163e('0xaa')][_0x2125c7[_0x163e('0x11f')]][_0x163e('0xb2')]]?this['queueBooked'][this['actions'][_0x2125c7[_0x163e('0x11f')]][_0x163e('0xb2')]][_0x163e('0x12e')]||0x0:0x0;}this[_0x163e('0x28')][this[_0x163e('0xaa')][_0x2125c7[_0x163e('0x11f')]]['queue']]['_rr']=this[_0x163e('0x12d')][this[_0x163e('0xaa')][_0x2125c7[_0x163e('0x11f')]][_0x163e('0xb2')]];for(var _0x4010ab=0x0;_0x4010ab=0x0;})[_0x163e('0xaf')](myreject(_0x4ac063)));}}else{_0x1dc245[_0x163e('0x124')](ami['Action']({'action':'command','command':util['format'](_0x163e('0x14a'),_0x90898f,!_[_0x163e('0x3a')](config[_0x163e('0x141')][_0x720a45])?_0x720a45:'')})[_0x163e('0xb6')](function(_0x112d07){return _0x112d07[_0x163e('0x147')]['indexOf'](_0x163e('0x149'))>=0x0;})['catch'](myreject(_0x4ac063)));}BPromise[_0x163e('0x14b')](_0x1dc245)[_0x163e('0xb6')](function(_0x3bc784){var _0x3d446a=_[_0x163e('0x14c')](_0x3bc784);if(_0x3d446a){return _0x3ea718(_0x3d446a);}else{_0x1ff14a[_0x163e('0x3d')]=_0x55e6c8?'GLOBAL_INTERVAL_IS_OVERTIME':'INTERVAL_IS_OVERTIME';return _0x4ac063(msgResponse(_0x163e('0x14d'),_0x163e('0x13d'),_0x163e('0x14e')+_0x55e6c8+'\x20'+_0x159ebc+_0x163e('0x14f')+util[_0x163e('0x95')](_0x90898f,{'showHidden':![],'depth':null})+_0x163e('0x150')+_0x720a45));}})[_0x163e('0xaf')](function(_0x1c2a39){return _0x4ac063(msgResponse(_0x163e('0x13b'),'Failure',JSON[_0x163e('0x46')](_0x1c2a39)));});});};Dialer[_0x163e('0xac')][_0x163e('0x151')]=function(_0x37e699){var _0xf7a8e5=this;return function(){switch(_0x37e699['dialMethod']){case'progressive':freeVariablesPredictive(_0x37e699);_0xf7a8e5['handlePower'](_0x37e699,0x1);break;case'power':freeVariablesPredictive(_0x37e699);_0xf7a8e5[_0x163e('0x152')](_0x37e699,_0x37e699[_0x163e('0x153')]);break;case'predictive':_0xf7a8e5[_0x163e('0xa')](_0x37e699);break;case _0x163e('0x9'):freeVariablesPredictive(_0x37e699);_0xf7a8e5[_0x163e('0x152')](_0x37e699,0x1);break;default:freeVariablesPredictive(_0x37e699);logger[_0x163e('0x94')]('Queue',_0x37e699['name'],'method\x20not\x20recognized');}};};Dialer[_0x163e('0xac')][_0x163e('0x154')]=function(_0x4dbcfe){var _0x3cd756=this;return function(){_0x3cd756[_0x163e('0x155')](_0x4dbcfe);};};Dialer['prototype'][_0x163e('0xb')]=function(_0x44f95f){var _0xdf61e6=this;if(isNotPreview(_0x44f95f[_0x163e('0x59')])){if(isVoiceQueueOutbound(_0x44f95f[_0x163e('0x4a')])&&isActive(_0x44f95f['dialActive'])){_0x44f95f['sendMessageOneNotActive']=!![];BPromise[_0x163e('0xb5')]()[_0x163e('0xb6')](checkIsLoggedIn(_0x44f95f,_0x44f95f[_0x163e('0x4e')]))[_0x163e('0xb6')](checkIsActive(_0x44f95f,_0x44f95f[_0x163e('0x58')]))[_0x163e('0xb6')](checkInterval(_0x44f95f))['then'](_0xdf61e6[_0x163e('0x139')](_0x44f95f))[_0x163e('0xb6')](_0xdf61e6[_0x163e('0x156')](_0x44f95f[_0x163e('0x157')],_0x44f95f[_0x163e('0x158')],_0x44f95f[_0x163e('0x3c')],_0x44f95f))[_0x163e('0xb6')](_0xdf61e6[_0x163e('0x13c')](_0x44f95f[_0x163e('0x42')],_0x44f95f[_0x163e('0x158')],_0x44f95f[_0x163e('0x3c')],_0x44f95f))['then'](_0xdf61e6[_0x163e('0x151')](_0x44f95f))[_0x163e('0xaf')](loggerCatchQueueSummary(_0x163e('0x159'),_0x44f95f));}else{notSendMessagesQueue(_0x44f95f);}}else{freeVariablesPredictive(_0x44f95f);}};Dialer[_0x163e('0xac')][_0x163e('0x15a')]=function(){var _0x5c39ce=this;var _0xc94874;for(var _0x392676 in this[_0x163e('0x1e')]){if(typeof this['campaigns'][_0x392676]!==_0x163e('0x97')){_0xc94874=this[_0x163e('0x1e')][_0x392676];if(isCampaignIvr(_0xc94874[_0x163e('0x4a')])&&isActive(_0xc94874[_0x163e('0x74')])){_0xc94874[_0x163e('0x9e')]=!![];BPromise[_0x163e('0xb5')]()[_0x163e('0xb6')](checkIsActive(_0xc94874,_0xc94874[_0x163e('0x74')]))[_0x163e('0xb6')](checkInterval(_0xc94874))[_0x163e('0xb6')](_0x5c39ce[_0x163e('0x139')](_0xc94874))[_0x163e('0xb6')](_0x5c39ce[_0x163e('0x156')](_0xc94874[_0x163e('0x157')],_0xc94874[_0x163e('0x158')],_0xc94874[_0x163e('0x3c')],_0xc94874))[_0x163e('0xb6')](_0x5c39ce[_0x163e('0x13c')](_0xc94874[_0x163e('0x42')],_0xc94874['dialTimezone'],_0xc94874[_0x163e('0x3c')],_0xc94874))[_0x163e('0xb6')](_0x5c39ce[_0x163e('0x154')](_0xc94874))[_0x163e('0xaf')](loggerCatchQueueSummary(_0x163e('0x15b'),_0xc94874));}else{notSendMessagesCampaign(_0xc94874);}}}};function getCallerIdRandom(_0x21d395,_0x384f3c){var _0x5324e0;var _0x3c4a14;var _0x4a6f8e;if(_0x384f3c<=0x0){_0x384f3c=0x1;}_0x5324e0=new RegExp(_0x163e('0x15c')+_0x384f3c+'}$');_0x3c4a14=Math[_0x163e('0x15d')](0xa,_0x384f3c-0x1);_0x4a6f8e=Math['pow'](0xa,_0x384f3c)-0x1;return util[_0x163e('0x76')]('%s',_[_0x163e('0x15e')](_0x21d395,_0x5324e0,_['random'](_0x3c4a14,_0x4a6f8e)));}function extractCalleridName(_0x5449c8){var _0x53a14d=_0x5449c8['match'](/"(.*?)"/);return _0x53a14d?_0x53a14d[0x1]:_0x5449c8;}function extractCalleridNumber(_0x3621fe){var _0x12f7bd=_0x3621fe[_0x163e('0x15f')](/<(.*?)>/);return _0x12f7bd?_0x12f7bd[0x1]:_0x3621fe;}Dialer[_0x163e('0xac')][_0x163e('0x160')]=function(_0x23cb5c,_0x5f1ff7){var _0x18dfac=this;var _0x24f7e8=uuid['v4']();this[_0x163e('0xaa')][_0x24f7e8]=new Action(_0x23cb5c,_0x5f1ff7,_0x24f7e8);return new BPromise(function(_0x3ce835,_0x4edd86){if(_[_0x163e('0x3a')](_0x23cb5c)&&typeof _0x23cb5c!==_0x163e('0x161')){return _0x4edd86(msgResponse(_0x163e('0x162'),_0x163e('0x13d'),_0x163e('0x163')));}if(_[_0x163e('0x3a')](_0x5f1ff7['Contact'][_0x163e('0x164')])||_0x5f1ff7[_0x163e('0x165')][_0x163e('0x164')]===null){return _0x4edd86(msgResponse('originate',_0x163e('0x13d'),_0x163e('0x166')));}var _0x43da98={'XMD-CALLERID':_0x18dfac[_0x163e('0xaa')][_0x24f7e8][_0x163e('0x167')](),'XMD-AGI':_0x23cb5c[_0x163e('0xff')]?util[_0x163e('0x76')](_0x163e('0x168'),ipAgi,_0x23cb5c[_0x163e('0xff')]):_0x163e('0x169'),'XMD-AGIAFTER':_0x23cb5c['dialQueueProject2']?util['format'](_0x163e('0x168'),ipAgi,_0x23cb5c[_0x163e('0x106')]):_0x163e('0x169'),'XMD-QUEUE':_0x23cb5c[_0x163e('0x4a')]===_0x163e('0x91')?util[_0x163e('0x76')]('\x22%s,%s%s,,,%s\x22',_0x23cb5c['name'],_0x23cb5c[_0x163e('0x16a')]||'',_0x23cb5c['dialAgiAfterHangupAgent']?'c':'',_0x23cb5c['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x5f1ff7[_0x163e('0xcb')],'XMD-CDRTYPE':_0x163e('0x7'),'CALLERID(all)':_0x18dfac[_0x163e('0xaa')][_0x24f7e8]['getCaller'](),'XMD-AMD':_0x23cb5c[_0x163e('0xda')]?'ACTIVE':_0x163e('0x169'),'XMD-DESTINATION':_0x163e('0xd9')};if(_0x23cb5c[_0x163e('0xda')]){_0x43da98['XMD-AMDINITIALSILENCE']=_0x23cb5c['dialAMDInitialSilence']||0x9c4;_0x43da98[_0x163e('0x16b')]=_0x23cb5c[_0x163e('0x16c')]||0x5dc;_0x43da98[_0x163e('0x16d')]=_0x23cb5c['dialAMDAfterGreetingSilence']||0x320;_0x43da98[_0x163e('0x16e')]=_0x23cb5c[_0x163e('0x16f')]||0x1388;_0x43da98[_0x163e('0x170')]=_0x23cb5c[_0x163e('0x171')]||0x64;_0x43da98[_0x163e('0x172')]=_0x23cb5c[_0x163e('0x173')]||0x32;_0x43da98[_0x163e('0x174')]=_0x23cb5c['dialAMDMaximumNumberOfWords']||0x3;_0x43da98[_0x163e('0x175')]=_0x23cb5c[_0x163e('0x176')]||0x100;_0x43da98[_0x163e('0x177')]=_0x23cb5c[_0x163e('0x178')]||0x1388;}if(_0x23cb5c[_0x163e('0x4a')]==='outbound'){_0x43da98[_0x163e('0x179')]=_0x5f1ff7['VoiceQueueId'];}else{_0x43da98[_0x163e('0x17a')]=_0x5f1ff7['CampaignId'];}for(var _0x3cbfa8 in _0x5f1ff7['Contact']){if(typeof _0x5f1ff7[_0x163e('0x165')][_0x3cbfa8]!==_0x163e('0x97')){if(isNotNull(_0x5f1ff7[_0x163e('0x165')][_0x3cbfa8])&&_0x3cbfa8!=='id'&&_0x3cbfa8!==_0x163e('0x17b')&&_0x3cbfa8!=='createdAt'&&_0x3cbfa8!==_0x163e('0x17c')){_0x43da98[util['format'](_0x163e('0x17d'),_0x163e('0x17e'),_[_0x163e('0x17f')](_0x3cbfa8))]=_0x5f1ff7[_0x163e('0x165')][_0x3cbfa8];}}}var _0x137786=_0x18dfac[_0x163e('0xd1')](_0x23cb5c[_0x163e('0x73')])?getCallerId(_0x23cb5c['Trunk'][_0x163e('0x75')],_0x23cb5c[_0x163e('0x5a')],_0x23cb5c[_0x163e('0x180')]>0x0?getCallerIdRandom(_0x23cb5c[_0x163e('0x181')],_0x23cb5c[_0x163e('0x180')]):_0x23cb5c['dialOriginateCallerIdNumber']):getCallerId(_[_0x163e('0xad')](_0x23cb5c[_0x163e('0x13a')])?_0x23cb5c[_0x163e('0x73')]['callerid']:_0x23cb5c['TrunkBackup'][_0x163e('0x75')],_0x23cb5c['dialOriginateCallerIdName'],_0x23cb5c[_0x163e('0x180')]>0x0?getCallerIdRandom(_0x23cb5c[_0x163e('0x181')],_0x23cb5c['dialRandomLastDigitCallerIdNumber']):_0x23cb5c['dialOriginateCallerIdNumber']);if(_0x137786){_0x43da98[_0x163e('0x182')]=_0x18dfac[_0x163e('0xaa')][_0x24f7e8][_0x163e('0x183')]=extractCalleridName(_0x137786);_0x43da98[_0x163e('0x184')]=_0x18dfac[_0x163e('0xaa')][_0x24f7e8][_0x163e('0x185')]=extractCalleridNumber(_0x137786);}return ami['Action']({'actionid':_0x24f7e8,'action':_0x163e('0x162'),'channel':_0x18dfac[_0x163e('0xd1')](_0x23cb5c[_0x163e('0x73')])?util['format'](_0x163e('0x186'),_0x23cb5c['Trunk']['name'],isNotNull(_0x23cb5c[_0x163e('0x187')])?_0x23cb5c[_0x163e('0x187')][_0x163e('0x188')]()||'':'',_0x23cb5c[_0x163e('0x189')]>0x0?_0x5f1ff7['Contact']['phone'][_0x163e('0x18a')](_0x23cb5c[_0x163e('0x189')]):_0x5f1ff7['Contact'][_0x163e('0x164')]):util[_0x163e('0x76')]('SIP/%s/%s%s',_['isNil'](_0x23cb5c['TrunkBackup'])?_0x23cb5c[_0x163e('0x73')][_0x163e('0x3c')]:_0x23cb5c['TrunkBackup'][_0x163e('0x3c')],isNotNull(_0x23cb5c[_0x163e('0x187')])?_0x23cb5c[_0x163e('0x187')]['trim']()||'':'',_0x23cb5c[_0x163e('0x189')]>0x0?_0x5f1ff7[_0x163e('0x165')]['phone'][_0x163e('0x18a')](_0x23cb5c[_0x163e('0x189')]):_0x5f1ff7[_0x163e('0x165')][_0x163e('0x164')]),'callerid':_0x137786,'Exten':_0x163e('0xd9'),'Context':_0x163e('0x18b'),'Priority':'1','variable':_0x43da98,'timeout':(_0x23cb5c[_0x163e('0x18c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x24f7e8})[_0x163e('0xb6')](function(_0x305e41){return _0x3ce835(_0x305e41);})[_0x163e('0xaf')](function(_0x2f0469){_0x23cb5c[_0x163e('0x63')]+=0x1;var _0x385db4=new History(_0x18dfac['actions'][_0x24f7e8]);logger[_0x163e('0x94')](util[_0x163e('0x76')](_0x163e('0x18d'),JSON[_0x163e('0x46')](_0x2f0469)));_0x385db4[_0x163e('0xa4')]=0xe;_0x385db4[_0x163e('0xa5')]=_0x163e('0x18e');_0x385db4[_0x163e('0xa7')]=moment()['format'](_0x163e('0xf3'));_0x385db4['endtime']=_0x385db4[_0x163e('0xa7')];_0x18dfac[_0x163e('0xc7')](_0x385db4)[_0x163e('0xaf')](loggerCatch('[originate][error]'));_0x18dfac[_0x163e('0xc6')](_0x385db4)[_0x163e('0xaf')](loggerCatch('[originate][error]'))[_0x163e('0x12b')](function(){delete _0x18dfac[_0x163e('0xaa')][_0x24f7e8];return _0x4edd86(msgResponse('originate',_0x163e('0x45'),_0x163e('0x18f')));});});});};Dialer[_0x163e('0xac')][_0x163e('0x2e')]=function(_0xef0a50){var _0x1a28d9=this[_0x163e('0xaa')][_0xef0a50[_0x163e('0x11f')]];if(_0x1a28d9){delete this[_0x163e('0xaa')][_0xef0a50[_0x163e('0x11f')]];_0x1a28d9[_0x163e('0x10d')]=moment()[_0x163e('0x76')]('YYYY-MM-DD\x20HH:mm:ss');var _0x5cd4e8=_0x1a28d9['type']===_0x163e('0x78')?this['campaigns'][_0x1a28d9[_0x163e('0xb2')]]:this['voiceQueues'][_0x1a28d9[_0x163e('0x190')]()];if(!this[_0x163e('0x191')](_0xef0a50[_0x163e('0x192')])){this['updateOriginated'](_0x5cd4e8);return this[_0x163e('0x193')](_0x1a28d9,_0x5cd4e8,_0xef0a50)['catch'](loggerCatch(_0x163e('0x194')));}this[_0x163e('0x24')][_0xef0a50[_0x163e('0xd6')]]=_0x1a28d9;}};Dialer[_0x163e('0xac')][_0x163e('0x195')]=function(_0x4abe8b,_0x1a0d07,_0x5c0f9a){var _0x3caba2=new History(_0x1a0d07);if(_0x3caba2[_0x163e('0xe6')]+_0x3caba2['countcongestionretry']+_0x3caba2[_0x163e('0x196')]+_0x3caba2[_0x163e('0xe7')]+_0x3caba2['countdropretry']+_0x3caba2[_0x163e('0xe9')]+_0x3caba2[_0x163e('0xe2')]+_0x3caba2['countagentrejectretry']>=_0x5c0f9a[_0x163e('0xeb')]-0x1){return!![];}switch(_0x4abe8b){case 0x3:if(_0x3caba2['countnoanswerretry']>=_0x5c0f9a[_0x163e('0x197')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x3caba2['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x163e('0xf0')](_0x5c0f9a[_0x163e('0x198')],_0x163e('0xf2'))[_0x163e('0x76')](_0x163e('0xf3')),'ContactId':_0x3caba2[_0x163e('0xcb')],'ListId':_0x3caba2['ListId'],'VoiceQueueId':_0x3caba2['VoiceQueueId']||undefined,'CampaignId':_0x3caba2[_0x163e('0xcd')]||undefined})[_0x163e('0xaf')](loggerCatch(_0x163e('0x199')));break;case 0x5:if(_0x3caba2[_0x163e('0xe6')]>=_0x5c0f9a[_0x163e('0x19a')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x3caba2[_0x163e('0xe6')]+=0x1,'scheduledat':moment()[_0x163e('0xf0')](_0x5c0f9a[_0x163e('0x19b')],_0x163e('0xf2'))['format'](_0x163e('0xf3')),'ContactId':_0x3caba2[_0x163e('0xcb')],'ListId':_0x3caba2[_0x163e('0xf4')],'VoiceQueueId':_0x3caba2[_0x163e('0xf5')]||undefined,'CampaignId':_0x3caba2['CampaignId']||undefined})[_0x163e('0xaf')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x3caba2[_0x163e('0xf9')]>=_0x5c0f9a[_0x163e('0x19c')]-0x1){return!![];}this[_0x163e('0xbd')]({'active':![],'countcongestionretry':_0x3caba2['countcongestionretry']+=0x1,'scheduledat':moment()[_0x163e('0xf0')](_0x5c0f9a['dialCongestionRetryFrequency'],'minutes')[_0x163e('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3caba2['ContactId'],'ListId':_0x3caba2['ListId'],'VoiceQueueId':_0x3caba2[_0x163e('0xf5')]||undefined,'CampaignId':_0x3caba2[_0x163e('0xcd')]||undefined})['catch'](loggerCatch(_0x163e('0x19d')));break;case 0x0:if(_0x3caba2[_0x163e('0xe7')]>=_0x5c0f9a[_0x163e('0x19e')]-0x1){return!![];}else{this[_0x163e('0xbd')]({'active':![],'countnosuchnumberretry':_0x3caba2['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x163e('0xf0')](_0x5c0f9a[_0x163e('0x19f')],_0x163e('0xf2'))[_0x163e('0x76')](_0x163e('0xf3')),'ContactId':_0x3caba2[_0x163e('0xcb')],'ListId':_0x3caba2[_0x163e('0xf4')],'VoiceQueueId':_0x3caba2['VoiceQueueId']||undefined,'CampaignId':_0x3caba2[_0x163e('0xcd')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x3caba2[_0x163e('0xe8')]>=_0x5c0f9a[_0x163e('0x112')]-0x1){return!![];}this[_0x163e('0xbd')]({'active':![],'countdropretry':_0x3caba2[_0x163e('0xe8')]+=0x1,'scheduledat':moment()[_0x163e('0xf0')](_0x5c0f9a[_0x163e('0x113')],'minutes')['format'](_0x163e('0xf3')),'ContactId':_0x3caba2[_0x163e('0xcb')],'ListId':_0x3caba2[_0x163e('0xf4')],'VoiceQueueId':_0x3caba2[_0x163e('0xf5')]||undefined,'CampaignId':_0x3caba2[_0x163e('0xcd')]||undefined})[_0x163e('0xaf')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x3caba2[_0x163e('0xe9')]>=_0x5c0f9a[_0x163e('0x1a0')]-0x1){return!![];}this[_0x163e('0xbd')]({'active':![],'countabandonedretry':_0x3caba2['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x5c0f9a[_0x163e('0x11b')],_0x163e('0xf2'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3caba2[_0x163e('0xcb')],'ListId':_0x3caba2['ListId'],'VoiceQueueId':_0x3caba2['VoiceQueueId']||undefined,'CampaignId':_0x3caba2[_0x163e('0xcd')]||undefined})[_0x163e('0xaf')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x3caba2[_0x163e('0xe2')]>=_0x5c0f9a[_0x163e('0xed')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x3caba2['countmachineretry']+=0x1,'scheduledat':moment()[_0x163e('0xf0')](_0x5c0f9a[_0x163e('0xf1')],'minutes')[_0x163e('0x76')](_0x163e('0xf3')),'ContactId':_0x3caba2[_0x163e('0xcb')],'ListId':_0x3caba2[_0x163e('0xf4')],'VoiceQueueId':_0x3caba2['VoiceQueueId']||undefined,'CampaignId':_0x3caba2[_0x163e('0xcd')]||undefined})[_0x163e('0xaf')](loggerCatch(_0x163e('0xfb')));break;case 0x14:if(_0x3caba2[_0x163e('0xea')]>=_0x5c0f9a['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0x163e('0xbd')]({'active':![],'countagentrejectretry':_0x3caba2[_0x163e('0xea')]+=0x1,'scheduledat':moment()['add'](_0x5c0f9a['dialAgentRejectRetryFrequency'],'minutes')[_0x163e('0x76')](_0x163e('0xf3')),'ContactId':_0x3caba2[_0x163e('0xcb')],'ListId':_0x3caba2[_0x163e('0xf4')],'VoiceQueueId':_0x3caba2[_0x163e('0xf5')]||undefined,'CampaignId':_0x3caba2[_0x163e('0xcd')]||undefined})[_0x163e('0xaf')](loggerCatch(_0x163e('0x1a1')));break;default:return!![];}};Dialer[_0x163e('0xac')][_0x163e('0x193')]=function(_0xcdb02c,_0x499eea,_0x4aed5e){var _0x1be69c=this;var _0x23f79a=new History(_0xcdb02c);return new BPromise(function(_0x236182,_0x549650){if(_['isUndefined'](_0x499eea)&&typeof _0x499eea!==_0x163e('0x161')){return _0x549650(msgResponse('[callProgressDetecting]',_0x163e('0x13d'),_0x163e('0x1a2')));}if(_[_0x163e('0x3a')](_0x4aed5e)&&typeof _0x4aed5e!==_0x163e('0x161')){return _0x549650(msgResponse(_0x163e('0x1a3'),_0x163e('0x13d'),'evt\x20is\x20undefine'));}switch(_0x4aed5e[_0x163e('0x1a4')]){case'0':_0x499eea[_0x163e('0x62')]+=0x1;_0x23f79a[_0x163e('0xa4')]=0x0;_0x23f79a[_0x163e('0xa5')]=_0x163e('0x1a5');_0x23f79a[_0x163e('0xe7')]+=0x1;_0x23f79a[_0x163e('0xe3')]+=0x1;ami['emit'](_0x163e('0x1a6'),ut[_0x163e('0x1a7')](_0xcdb02c,_0x163e('0x1a8')));_0x1be69c['createHistory'](_0x23f79a)[_0x163e('0xaf')](loggerCatch(_0x163e('0xe5')));if(_0x1be69c[_0x163e('0x195')](0x0,_0xcdb02c,_0x499eea)){if(_0x23f79a[_0x163e('0xe7')]>=_0x499eea[_0x163e('0x19e')]){_0x1be69c[_0x163e('0xee')](_0x23f79a,_0x236182,_0x549650,_0x163e('0x1a9'));}else{_0x1be69c[_0x163e('0xec')](_0x23f79a,_0x236182,_0x549650,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x499eea[_0x163e('0x61')]+=0x1;_0x23f79a[_0x163e('0xa4')]=0x3;_0x23f79a[_0x163e('0xa5')]='NoAnswer';_0x23f79a[_0x163e('0x196')]+=0x1;_0x23f79a[_0x163e('0xe3')]+=0x1;ami[_0x163e('0x49')](_0x163e('0x1aa'),ut[_0x163e('0x1a7')](_0xcdb02c,_0x163e('0x1ab')));_0x1be69c[_0x163e('0xc7')](_0x23f79a)['catch'](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x1be69c[_0x163e('0x195')](0x3,_0xcdb02c,_0x499eea)){if(_0x23f79a[_0x163e('0x196')]>=_0x499eea['dialNoAnswerMaxRetry']){_0x1be69c['createStateFinal'](_0x23f79a,_0x236182,_0x549650,'reason\x203\x20ringing\x20no\x20answer');}else{_0x1be69c[_0x163e('0xec')](_0x23f79a,_0x236182,_0x549650,_0x163e('0x1ac'));}}break;case'5':_0x499eea[_0x163e('0x5e')]+=0x1;_0x23f79a['state']=0x5;_0x23f79a[_0x163e('0xa5')]='Busy';_0x23f79a[_0x163e('0xe6')]+=0x1;_0x23f79a[_0x163e('0xe3')]+=0x1;ami[_0x163e('0x49')](_0x163e('0x1ad'),ut[_0x163e('0x1a7')](_0xcdb02c,_0x163e('0x1ae')));_0x1be69c[_0x163e('0xc7')](_0x23f79a)[_0x163e('0xaf')](loggerCatch(_0x163e('0x1af')));if(_0x1be69c['checkRetriveMax'](0x5,_0xcdb02c,_0x499eea)){if(_0x23f79a[_0x163e('0xe6')]>=_0x499eea[_0x163e('0x19a')]){_0x1be69c[_0x163e('0xee')](_0x23f79a,_0x236182,_0x549650,'reason\x205\x20busy');}else{_0x1be69c[_0x163e('0xec')](_0x23f79a,_0x236182,_0x549650,_0x163e('0x1b0'));}}break;case'8':_0x499eea['outboundCongestionCallsDay']+=0x1;_0x23f79a['state']=0x8;_0x23f79a['statedesc']=_0x163e('0x1b1');_0x23f79a[_0x163e('0xf9')]+=0x1;_0x23f79a[_0x163e('0xe3')]+=0x1;ami['emit'](_0x163e('0x1b2'),ut[_0x163e('0x1a7')](_0xcdb02c,_0x163e('0x1b3')));_0x1be69c[_0x163e('0xc7')](_0x23f79a)[_0x163e('0xaf')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x1be69c['checkRetriveMax'](0x8,_0xcdb02c,_0x499eea)){if(_0x23f79a['countcongestionretry']>=_0x499eea[_0x163e('0x19c')]){_0x1be69c[_0x163e('0xee')](_0x23f79a,_0x236182,_0x549650,_0x163e('0x1b4'));}else{_0x1be69c[_0x163e('0xec')](_0x23f79a,_0x236182,_0x549650,_0x163e('0x1b4'));}}break;case'11':_0x499eea[_0x163e('0x1b5')]+=0x1;_0x23f79a[_0x163e('0xa4')]=0xb;_0x23f79a[_0x163e('0xa5')]=_0x163e('0x119');_0x23f79a[_0x163e('0xe9')]+=0x1;_0x23f79a['countglobal']+=0x1;_0x1be69c[_0x163e('0xc7')](_0x23f79a)[_0x163e('0xaf')](loggerCatch(_0x163e('0x11d')));if(_0x1be69c[_0x163e('0x195')](0xb,_0xcdb02c,_0x499eea)){if(_0x23f79a[_0x163e('0xe9')]>=_0x499eea[_0x163e('0x1a0')]){_0x1be69c[_0x163e('0xee')](_0x23f79a,_0x236182,_0x549650,_0x163e('0x1b6'));}else{_0x1be69c[_0x163e('0xec')](_0x23f79a,_0x236182,_0x549650,_0x163e('0x1b6'));}}break;case'20':_0x499eea['outboundRejectCallsDay']+=0x1;_0x23f79a[_0x163e('0xa4')]=0x14;_0x23f79a[_0x163e('0xa5')]=_0x163e('0x1b7');_0x23f79a['countagentrejectretry']+=0x1;_0x23f79a[_0x163e('0xe3')]+=0x1;ami[_0x163e('0x49')](_0x163e('0x1b8'),ut['buildObj'](_0xcdb02c,_0x163e('0x1b9')));_0x1be69c[_0x163e('0xc7')](_0x23f79a)[_0x163e('0xaf')](loggerCatch(_0x163e('0x1ba')));if(_0x1be69c['checkRetriveMax'](0x14,_0xcdb02c,_0x499eea)){if(_0x23f79a['countagentrejectretry']>=_0x499eea[_0x163e('0x1bb')]){_0x1be69c[_0x163e('0xee')](_0x23f79a,_0x236182,_0x549650,_0x163e('0x1bc'));}else{_0x1be69c[_0x163e('0xec')](_0x23f79a,_0x236182,_0x549650,_0x163e('0x1bc'));}}break;default:_0x499eea[_0x163e('0x102')]+=0x1;_0x23f79a[_0x163e('0xa4')]=0xc;_0x23f79a[_0x163e('0xa5')]=_0x4aed5e[_0x163e('0x1a4')];_0x1be69c['createHistory'](_0x23f79a)[_0x163e('0xaf')](loggerCatch(_0x163e('0x1bd')));if(_0x1be69c[_0x163e('0x195')](_0x4aed5e['reason'],_0xcdb02c,_0x499eea)){if(_0x23f79a[_0x163e('0xe6')]+_0x23f79a[_0x163e('0xf9')]+_0x23f79a[_0x163e('0x196')]+_0x23f79a[_0x163e('0xe7')]+_0x23f79a[_0x163e('0xe8')]+_0x23f79a[_0x163e('0xe9')]+_0x23f79a[_0x163e('0xe2')]+_0x23f79a['countagentrejectretry']>=_0x499eea[_0x163e('0xeb')]){_0x1be69c[_0x163e('0xec')](_0x23f79a,_0x236182,_0x549650,_0x4aed5e[_0x163e('0x1a4')]);}else{_0x1be69c['createStateFinal'](_0x23f79a,_0x236182,_0x549650,_0x4aed5e[_0x163e('0x1a4')]);}}}});};Dialer[_0x163e('0xac')][_0x163e('0xec')]=function(_0x1ad607,_0x6e6b4e,_0x448503,_0x320dd8){var _0x4af452=new Final(_0x1ad607);_0x4af452['state']=0xf;_0x4af452[_0x163e('0xa5')]='Global';this[_0x163e('0xee')](_0x4af452,_0x6e6b4e,_0x448503,_0x320dd8);};Dialer[_0x163e('0xac')][_0x163e('0xee')]=function(_0x5bed11,_0x1dcce2,_0x13e150,_0x480729){this[_0x163e('0xc6')](_0x5bed11)[_0x163e('0xb6')](function(){return _0x1dcce2(msgResponse(_0x163e('0x1a3'),_0x163e('0xd0'),_0x480729));})['catch'](function(){return _0x13e150(msgResponse(_0x163e('0x1be'),_0x163e('0x13d'),_0x163e('0x1bf')));});};Dialer['prototype']['predictive']=function(_0x5c84cf){var _0x579894=_0x5c84cf[_0x163e('0x1c0')]/0x64;var _0x1e503c=_0x5c84cf[_0x163e('0x60')]/(_0x5c84cf[_0x163e('0x60')]+_0x5c84cf[_0x163e('0x5c')]);var _0x5b2d48=Math['round'](_0x5c84cf[_0x163e('0x6d')]*(_0x5c84cf[_0x163e('0x1c1')]/0x64));var _0x1d0b70=Math['round'](_0x5c84cf[_0x163e('0x6d')]*(_0x5c84cf[_0x163e('0x1c2')]/0x64));var _0x48d6dc=_0x5c84cf[_0x163e('0x4d')]+_0x5c84cf[_0x163e('0x53')];var _0x1dc8a3=Math[_0x163e('0x1c3')](_0x5c84cf[_0x163e('0x6f')]*_0x5c84cf[_0x163e('0x8b')]*_0x5c84cf[_0x163e('0x6b')]*_0x5c84cf[_0x163e('0x1c4')]);if(_[_0x163e('0x3a')](_0x5c84cf[_0x163e('0x72')])){if(!_[_0x163e('0x3a')](_0x5c84cf[_0x163e('0x26')])){_0x5c84cf['startPredictive']=undefined;loggerPredictive[_0x163e('0x94')](_0x163e('0x1c5'),_0x163e('0x1c6'));}if(!_[_0x163e('0x3a')](_0x5c84cf[_0x163e('0x90')])){loggerPredictive[_0x163e('0x94')](_0x163e('0x1c5'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x5c84cf[_0x163e('0x90')]);_0x5c84cf[_0x163e('0x90')]=undefined;}_0x5c84cf[_0x163e('0x72')]=moment()[_0x163e('0x76')](_0x163e('0xf3'));loggerPredictive[_0x163e('0x7c')](_0x5c84cf[_0x163e('0x3c')],_0x163e('0x1c7'),_0x5c84cf[_0x163e('0x72')]);this['handlePower'](_0x5c84cf,0x1);}else if(ifInterval(_0x5c84cf[_0x163e('0x1c8')],_0x5c84cf[_0x163e('0x72')])){this[_0x163e('0x152')](_0x5c84cf,0x1);loggerPredictiveCalls[_0x163e('0x7c')](_0x163e('0x1c9'),_0x5c84cf[_0x163e('0x72')],_0x5c84cf[_0x163e('0x3c')]);_0x5c84cf[_0x163e('0x6f')]=0x0;_0x5c84cf[_0x163e('0x6a')]=0x0;}else if(_0x579894<_0x1e503c&&_0x5c84cf[_0x163e('0x1ca')]===_0x163e('0x1cb')){freeVariablesPredictive(_0x5c84cf);loggerPredictive['info'](_0x163e('0x1cc'),'Dropped\x20calls\x20day',_0x1e503c,_0x163e('0x72'),_0x5c84cf[_0x163e('0x3c')]);}else if(_0x1dc8a3<_0x5c84cf['predictiveIntervalErlangCallsDroppedCalls']&&_0x5c84cf[_0x163e('0x1ca')]===_0x163e('0x1cb')){freeVariablesPredictive(_0x5c84cf);loggerPredictive[_0x163e('0x7c')](_0x163e('0x1cd'),'Max\x20Drop\x20',_0x1dc8a3,'Drop\x20in\x20this\x20interval',_0x5c84cf[_0x163e('0x6a')],'startProgressive',_0x5c84cf[_0x163e('0x3c')]);}else if(!ifInterval(_0x5c84cf[_0x163e('0x1c8')],_0x5c84cf['startProgressive'])&&_[_0x163e('0x3a')](_0x5c84cf['startPredictive'])&&!_[_0x163e('0x3a')](_0x5c84cf[_0x163e('0x72')])){_0x5c84cf[_0x163e('0x26')]=moment()[_0x163e('0x76')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x163e('0x7c')](_0x5c84cf[_0x163e('0x3c')],_0x163e('0x1ce'),_0x5c84cf[_0x163e('0x26')]);this[_0x163e('0xba')](_0x5c84cf[_0x163e('0x1c8')])['then'](this[_0x163e('0x1cf')](_0x5c84cf))[_0x163e('0xb6')](mergeDataErlangB(_0x5c84cf))[_0x163e('0xb6')](this[_0x163e('0x1d0')](_0x5c84cf))[_0x163e('0xaf')](loggerCatchPredictive(_0x163e('0x1d1'),_0x5c84cf));}else if(!ifInterval(_0x5c84cf['dialPredictiveInterval'],_0x5c84cf['startPredictive'])){_0x5c84cf[_0x163e('0x6a')]=0x0;_0x5c84cf[_0x163e('0x26')]=moment()[_0x163e('0x76')](_0x163e('0xf3'));loggerPredictive[_0x163e('0x7c')](_0x5c84cf[_0x163e('0x3c')],'recalculate\x20predictive\x20at',_0x5c84cf[_0x163e('0x26')]);clearInterval(_0x5c84cf['handlePredictive']);_0x5c84cf['handlePredictive']=undefined;this[_0x163e('0xba')](_0x5c84cf['dialPredictiveInterval'])['then'](this[_0x163e('0x1cf')](_0x5c84cf))[_0x163e('0xb6')](mergeDataErlangB(_0x5c84cf))[_0x163e('0xb6')](this[_0x163e('0x1d0')](_0x5c84cf))['catch'](loggerCatchPredictive(_0x163e('0x1d2'),_0x5c84cf));}else if(_0x5c84cf[_0x163e('0x6d')]&&_0x48d6dc<_0x5c84cf[_0x163e('0x6d')]-_0x1d0b70){freeVariablesPredictive(_0x5c84cf);loggerPredictive[_0x163e('0x7c')](_0x5c84cf[_0x163e('0x3c')],_0x163e('0x1d3'),_0x48d6dc,_0x163e('0x1d4'),_0x5c84cf[_0x163e('0x6d')],'-',_0x1d0b70,'=',_0x5c84cf[_0x163e('0x6d')]-_0x1d0b70,')');}else if(_0x5c84cf[_0x163e('0x6d')]&&_0x48d6dc>_0x5c84cf['predictiveIntervalAvailable']+_0x5b2d48){freeVariablesPredictive(_0x5c84cf);loggerPredictive['info'](_0x5c84cf['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x48d6dc,_0x163e('0x1d5'),_0x5c84cf[_0x163e('0x6d')],'+',_0x5b2d48,'=',_0x5c84cf[_0x163e('0x6d')]+_0x5b2d48,')');}};Dialer[_0x163e('0xac')]['getDataPredictive']=function(_0x41125b){var _0xc8cd9e=this;return function(_0x26eec1){return new BPromise(function(_0x281a53,_0x24f48a){_[_0x163e('0x8d')](_0x41125b,_0x26eec1[0x0]);if(checkGetDataPredictive(_0x26eec1[0x0])){var _0x443408=_0x41125b[_0x163e('0x6d')]=_0x41125b[_0x163e('0x53')]+_0x41125b[_0x163e('0x4d')];var _0x1beb84=_0x41125b[_0x163e('0x1c8')]*0x3c;var _0x276ae5=_0x26eec1[0x0][_0x163e('0x67')]+_0x26eec1[0x0][_0x163e('0x66')];var _0x252731=(_0x26eec1[0x0][_0x163e('0x65')]+_0x26eec1[0x0][_0x163e('0x69')]+_0x26eec1[0x0][_0x163e('0x68')])/_0x26eec1[0x0][_0x163e('0x83')];_0x41125b[_0x163e('0x6b')]=_0x252731>0x0?_0x252731:0x1;switch(_0x41125b[_0x163e('0x1ca')]){case'dropRate':var _0x4812fe=_0x41125b[_0x163e('0x1c0')]/0x64;return _0xc8cd9e['abandonmentRate'](_0x443408,_0x1beb84,_0x276ae5,_0x252731,_0x4812fe)[_0x163e('0xb6')](function(_0x53a504){return _0x281a53(_0x53a504);});case _0x163e('0x1d6'):var _0x3a8f69=_0x41125b[_0x163e('0x1c0')]/0x64;return _0xc8cd9e['busyFactor'](_0x443408,_0x1beb84,_0x276ae5,_0x252731,_0x3a8f69)[_0x163e('0xb6')](function(_0x101407){return _0x281a53(_0x101407);});default:return _0x24f48a(msgResponse(_0x163e('0x1d7'),_0x163e('0x13d'),'Unknown\x20Predictive'));}}else{return _0x24f48a(msgResponse(_0x163e('0x1d7'),_0x163e('0x13d'),_0x163e('0x1d8')));}});};};Dialer[_0x163e('0xac')]['getDataPredictiveOld']=function(_0x2ecf3c){var _0x3a58bd=this;return function(_0x2adde2){return new BPromise(function(_0x2cc096,_0x21eae4){_[_0x163e('0x8d')](_0x2ecf3c,_0x2adde2[0x0]);if(checkGetDataPredictive(_0x2adde2[0x0])){loggerPredictive['info'](JSON['stringify'](_0x2adde2[0x0]));if(_0x2ecf3c[_0x163e('0x1ca')]===_0x163e('0x1cb')){return _0x3a58bd['getVoiceQueueRtPauses'](_0x2ecf3c['id'])[_0x163e('0xb6')](function(_0x4ba38c){var _0x4762c8=_0x2ecf3c[_0x163e('0x4e')]-_0x4ba38c[0x0][_0x163e('0x1d9')];var _0x20035a=_0x2ecf3c[_0x163e('0x1c8')]*0x3c;var _0x12ecb4=_0x2adde2[0x0][_0x163e('0x67')]+_0x2adde2[0x0][_0x163e('0x66')];var _0x232c48=(_0x2adde2[0x0][_0x163e('0x65')]+_0x2adde2[0x0][_0x163e('0x69')]+_0x2adde2[0x0][_0x163e('0x68')])/_0x2adde2[0x0][_0x163e('0x83')];var _0x55b7a0=_0x2ecf3c[_0x163e('0x1c0')]/0x64;_0x2ecf3c[_0x163e('0x6c')]=_0x4ba38c[0x0]['outboundQueuePauses']||0x0;_0x2ecf3c[_0x163e('0x6b')]=_0x232c48>0x0?_0x232c48:0x1;return _0x3a58bd[_0x163e('0x1da')](_0x4762c8,_0x20035a,_0x12ecb4,_0x232c48,_0x55b7a0);})[_0x163e('0xb6')](function(_0x135418){return _0x2cc096(_0x135418);})[_0x163e('0xaf')](function(_0x2461d8){return _0x21eae4(msgResponse(_0x163e('0x1db'),_0x163e('0x13d'),JSON[_0x163e('0x46')](_0x2461d8)));});}if(_0x2ecf3c[_0x163e('0x1ca')]==='agentBusyFactor'){return _0x3a58bd['getVoiceQueueRtPauses'](_0x2ecf3c['id'])[_0x163e('0xb6')](function(_0x3fb066){var _0xdee52b=_0x2ecf3c[_0x163e('0x4e')]-_0x3fb066[0x0]['outboundQueuePauses'];var _0x41fb3a=_0x2ecf3c['dialPredictiveInterval']*0x3c;var _0x485cd6=_0x2adde2[0x0][_0x163e('0x67')]+_0x2adde2[0x0][_0x163e('0x66')];var _0x7532fe=(_0x2adde2[0x0][_0x163e('0x65')]+_0x2adde2[0x0][_0x163e('0x69')]+_0x2adde2[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2adde2[0x0]['predictiveIntervalTotalCalls'];var _0x3ef04d=_0x2ecf3c[_0x163e('0x1c0')]/0x64;_0x2ecf3c[_0x163e('0x6c')]=_0x3fb066[0x0][_0x163e('0x1d9')]||0x0;_0x2ecf3c[_0x163e('0x6b')]=_0x7532fe>0x0?_0x7532fe:0x1;return _0x3a58bd[_0x163e('0x1dc')](_0xdee52b,_0x41fb3a,_0x485cd6,_0x7532fe,_0x3ef04d);})[_0x163e('0xb6')](function(_0x25dc75){return _0x2cc096(_0x25dc75);})[_0x163e('0xaf')](function(_0x37e6db){return _0x21eae4(msgResponse(_0x163e('0x1db'),_0x163e('0x13d'),JSON[_0x163e('0x46')](_0x37e6db)));});}}else{return _0x21eae4(msgResponse(_0x163e('0x1d7'),_0x163e('0x13d'),_0x163e('0x1d8')));}});};};Dialer[_0x163e('0xac')]['startMethodPredictive']=function(_0x21d697){var _0x505e86=this;return function(){var _0x1b1e33=0x0;var _0x21a302=Math[_0x163e('0x1c3')](_0x21d697[_0x163e('0x70')]*0x3e8);if(_0x21a302>0x0){_0x21a302=_0x21a302<0x64?0x64:_0x21a302;loggerPredictive[_0x163e('0x7c')](_0x21d697[_0x163e('0x3c')],_0x163e('0x1dd'),_0x21a302,'milliseconds');_0x21d697['handlePredictive']=setInterval(function(){_0x505e86[_0x163e('0x90')](_0x21d697);loggerPredictiveCalls[_0x163e('0x7c')]('[handlePredictive]',_0x1b1e33+=0x1);},_0x21a302);}else{loggerPredictive[_0x163e('0x7c')](_0x21d697[_0x163e('0x3c')],_0x163e('0x1de'));}};};Dialer[_0x163e('0xac')][_0x163e('0x1df')]=function(_0x135f8d,_0xe2fb01){var _0x3bb076=this;return function(_0x5dc22c){if(_['isEmpty'](_0x5dc22c)){if(_[_0x163e('0xad')](_0xe2fb01[_0x163e('0xcc')])||!_0xe2fb01['recallme']){if(_0x135f8d[_0x163e('0x59')]===_0x163e('0x9')){_0x135f8d[_0x163e('0x126')]=_[_0x163e('0x3a')](_0x135f8d[_0x163e('0x126')])?!![]:_0x135f8d[_0x163e('0x126')];var _0x2057a7=uuid['v4']();_0x3bb076[_0x163e('0xaa')][_0x2057a7]=new Action(_0x135f8d,_0xe2fb01,_0x2057a7);loggerBooked['info'](_0x163e('0x1e0'),_0x2057a7,'queueStatusComplete:\x20',JSON[_0x163e('0x46')](_0x135f8d[_0x163e('0x126')]),_0x163e('0x1e1'),_0x135f8d[_0x163e('0x3c')]);if(_0x135f8d['queueStatusComplete']){_0x135f8d[_0x163e('0x126')]=![];_0x3bb076[_0x163e('0x28')][_0x3bb076['actions'][_0x2057a7][_0x163e('0xb2')]]=[];ami['Action']({'actionid':_0x2057a7,'action':_0x163e('0x1e2'),'queue':_0x135f8d['name']})['catch'](function(){_0x3bb076['updateOriginated'](_0x135f8d);_0x3bb076[_0x163e('0xbd')]({'active':![],'ContactId':_0x3bb076[_0x163e('0xaa')][_0x2057a7][_0x163e('0xcb')],'ListId':_0x3bb076[_0x163e('0xaa')][_0x2057a7][_0x163e('0xf4')],'VoiceQueueId':_0x3bb076[_0x163e('0xaa')][_0x2057a7][_0x163e('0xf5')]||undefined,'CampaignId':_0x3bb076[_0x163e('0xaa')][_0x2057a7][_0x163e('0xcd')]||undefined})[_0x163e('0xaf')](loggerCatch(_0x163e('0x1e3')));delete _0x3bb076[_0x163e('0xaa')][_0x2057a7];});}else{loggerBooked[_0x163e('0x7c')](_0x163e('0x1e4'),JSON[_0x163e('0x46')](_0x135f8d['queueStatusComplete']),_0x163e('0x1e1'),_0x135f8d[_0x163e('0x3c')]);_0x3bb076['updateOriginated'](_0x135f8d);_0x3bb076[_0x163e('0xbd')]({'active':![],'ContactId':_0x3bb076[_0x163e('0xaa')][_0x2057a7]['ContactId'],'ListId':_0x3bb076[_0x163e('0xaa')][_0x2057a7][_0x163e('0xf4')],'VoiceQueueId':_0x3bb076[_0x163e('0xaa')][_0x2057a7][_0x163e('0xf5')]||undefined,'CampaignId':_0x3bb076['actions'][_0x2057a7][_0x163e('0xcd')]||undefined})[_0x163e('0xaf')](loggerCatch(_0x163e('0x1e3')));delete _0x3bb076['actions'][_0x2057a7];}}else{return _0x3bb076['actionOriginate'](_0x135f8d,_0xe2fb01);}}else{if(getDiff(_0xe2fb01['scheduledat'])<_0x135f8d['dialRecallMeTimeout']*0x3c){if(_0xe2fb01[_0x163e('0x1e5')]&&!_0xe2fb01[_0x163e('0x1e5')][_0x163e('0x1e6')]){_0x3bb076[_0x163e('0x1c')][_0x163e('0x12a')](_0xe2fb01['id'])[_0x163e('0x12b')](function(){_0x3bb076[_0x163e('0xb1')](_0x135f8d);});}else{_0x3bb076[_0x163e('0xbf')]({'active':![]},_0xe2fb01['id'],0x1)[_0x163e('0x12b')](function(){_0x3bb076['updateOriginated'](_0x135f8d);});}}else{_0x135f8d[_0x163e('0x64')]+=0x1;_0x3bb076[_0x163e('0xb1')](_0x135f8d);if(_0x135f8d[_0x163e('0x1e7')]){_0x3bb076[_0x163e('0xbd')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0xe2fb01[_0x163e('0xcb')],'ListId':_0xe2fb01[_0x163e('0xf4')],'VoiceQueueId':_0xe2fb01[_0x163e('0xf5')]||undefined,'CampaignId':_0xe2fb01[_0x163e('0xcd')]||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x3bb076[_0x163e('0xc7')](createObjHistory(_0x135f8d,_0xe2fb01,_0x163e('0x1e8'),0x17,_0x163e('0x1e9')))[_0x163e('0xaf')](loggerCatch(_0x163e('0x1ea')));}else{_0x3bb076['saveInDb'](createObjHistory(_0x135f8d,_0xe2fb01,_0x163e('0x1eb'),0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]',_0x163e('0x1ec'));}}}}else{_0x135f8d[_0x163e('0x5d')]+=0x1;_0x3bb076[_0x163e('0xd5')](createObjHistory(_0x135f8d,_0xe2fb01,_0x163e('0x1ed'),0xd,'Blacklist'),'[Originate][historyBlacklist]',_0x163e('0x1ee'));throw _0x163e('0x1ef');}};};Dialer['prototype']['handleIvr']=function(_0x50837c){var _0x55cece=this;var _0xca5169=_0x50837c[_0x163e('0x1f0')]-_0x50837c[_0x163e('0x6e')]-_0x50837c[_0x163e('0x1f1')];emitCampaignSummary(_0x50837c);if(_0xca5169>0x0){if(_0xca5169>this[_0x163e('0x21')]){_0xca5169=this[_0x163e('0x21')];}_0x50837c['temp']+=_0xca5169;this['getContactDialerIvr'](_0x50837c['id'],_0xca5169,_0x50837c['dialOrderByScheduledAt'])['then'](function(_0x3aec27){_0x50837c[_0x163e('0x1f1')]-=_0xca5169;_0x50837c[_0x163e('0x1f1')]=_0x50837c[_0x163e('0x1f1')]>0x0?_0x50837c[_0x163e('0x1f1')]:0x0;if(!checkContactEmpty(_0x3aec27)){_0x50837c[_0x163e('0x3d')]=_0x163e('0x9d');logger[_0x163e('0x7c')](_0x163e('0x1f2')+_0x50837c[_0x163e('0x3c')]);}else{_0x50837c['originated']+=_0x3aec27[_0x163e('0x12f')];_0x50837c[_0x163e('0x3d')]=_0x163e('0x1f3');for(var _0xba61b5=0x0;_0xba61b5<_0x3aec27[_0x163e('0x12f')];_0xba61b5+=0x1){_0x50837c['ivrTotalCallsDays']+=0x1;if(_[_0x163e('0xad')](_0x3aec27[_0xba61b5])||_[_0x163e('0xad')](_0x3aec27[_0xba61b5]['Contact'])||_[_0x163e('0xad')](_0x3aec27[_0xba61b5][_0x163e('0x165')][_0x163e('0x164')])){_0x55cece['emptyContact'](_0x163e('0x1f4'),_0x50837c,_0x3aec27[_0xba61b5]);}else{_0x55cece['checkIsBlackListIvr'](_[_0x163e('0x132')](_0x3aec27[_0xba61b5],['CampaignId',_0x163e('0x1f5')]))[_0x163e('0xb6')](_0x55cece[_0x163e('0x1df')](_0x50837c,_0x3aec27[_0xba61b5]))[_0x163e('0xaf')](_0x55cece[_0x163e('0xc8')](_0x163e('0x1f6'),_0x50837c));}}}})[_0x163e('0xaf')](loggerGetContactDialer(_0x163e('0x1f7'),_0x50837c,_0xca5169));}};Dialer['prototype'][_0x163e('0x152')]=function(_0x354416,_0x5b47fe){var _0x4f624a=this;var _0xfc603a=[];var _0x4e24ad=_0x5b47fe>=0x1?_0x5b47fe:0x1;if(_0x354416['dialMethod']===_0x163e('0x9')){_0x4e24ad=0x1;}var _0x216e00=Math[_0x163e('0x1c3')](_0x354416['available']*_0x4e24ad)-_0x354416[_0x163e('0x6e')]-_0x354416[_0x163e('0x1f1')];emitVoiceQueueSummary(_0x354416);if(_0x354416['dialLimitQueue']>0x0){var _0x2d7593=_0x354416[_0x163e('0x1f8')]-_0x354416[_0x163e('0x6e')]-_0x354416[_0x163e('0x53')]-_0x354416['temp']-_0x354416[_0x163e('0x4f')];if(_0x216e00>_0x2d7593){_0x216e00=_0x2d7593;}}if(_0x216e00>0x0){if(_0x354416[_0x163e('0x59')]===_0x163e('0x9')){_0x216e00=0x1;}if(_0x216e00>this['maxNumberOriginate']){_0x216e00=this[_0x163e('0x21')];}_0x354416[_0x163e('0x1f1')]+=_0x216e00;for(var _0x2e5d31 in this[_0x163e('0x1f')]){if(typeof this[_0x163e('0x1f')][_0x2e5d31]!=='undefined'){if(this['agents'][_0x2e5d31][_0x163e('0xa4')]===_0x163e('0x1f9')&&this[_0x163e('0x1f')][_0x2e5d31]['status']===_0x163e('0xd2')){_0xfc603a[_0x163e('0x124')](this[_0x163e('0x1f')][_0x2e5d31]['id']);}}}this[_0x163e('0xc1')](_0x354416['id'],_0xfc603a,_0x216e00,_0x354416[_0x163e('0x1fa')])[_0x163e('0xb6')](function(_0x1cd4f1){_0x354416['temp']-=_0x216e00;_0x354416['temp']=_0x354416[_0x163e('0x1f1')]>0x0?_0x354416[_0x163e('0x1f1')]:0x0;if(!checkContactEmpty(_0x1cd4f1)){_0x4f624a[_0x163e('0xb4')](_0x354416)[_0x163e('0xb6')](sendMessageReschedule(_0x354416))[_0x163e('0xaf')](loggerCatch(_0x163e('0x1fb')));}else{_0x354416['originated']+=_0x1cd4f1[_0x163e('0x12f')];_0x354416[_0x163e('0x3d')]=_0x354416[_0x163e('0x59')]==='booked'?_0x163e('0x1fc'):_0x163e('0x1f3');for(var _0x156153=0x0;_0x156153<_0x1cd4f1[_0x163e('0x12f')];_0x156153+=0x1){if(_['isNil'](_0x1cd4f1[_0x156153])||_[_0x163e('0xad')](_0x1cd4f1[_0x156153][_0x163e('0x165')])||_[_0x163e('0xad')](_0x1cd4f1[_0x156153][_0x163e('0x165')][_0x163e('0x164')])){_0x4f624a[_0x163e('0xc9')](_0x163e('0x1f4'),_0x354416,_0x1cd4f1[_0x156153]);}else{_0x4f624a[_0x163e('0x1fd')](_[_0x163e('0x132')](_0x1cd4f1[_0x156153],[_0x163e('0xf5'),_0x163e('0x1f5')]))[_0x163e('0xb6')](_0x4f624a[_0x163e('0x1df')](_0x354416,_0x1cd4f1[_0x156153]))['catch'](_0x4f624a[_0x163e('0xc8')](_0x163e('0x1f4'),_0x354416));}}}})['catch'](loggerGetContactDialer(_0x163e('0x1fe'),_0x354416,_0x216e00));}};Dialer[_0x163e('0xac')][_0x163e('0x90')]=function(_0x18ec0f){if(_0x18ec0f['dialLimitQueue']>0x0){var _0x4e731d=_0x18ec0f[_0x163e('0x1f8')]-_0x18ec0f['originated']-_0x18ec0f[_0x163e('0x53')];if(_0x4e731d>0x0){this[_0x163e('0x1ff')](_0x18ec0f);}else{loggerPredictiveCalls['info'](_0x163e('0x200'));}}else{this[_0x163e('0x1ff')](_0x18ec0f);}};Dialer[_0x163e('0xac')][_0x163e('0x1ff')]=function(_0xcde98a){var _0x897688=this;var _0x4fe58b=[];_0xcde98a[_0x163e('0x6e')]+=0x1;for(var _0x5258c4 in this['agents']){if(typeof this[_0x163e('0x1f')][_0x5258c4]!==_0x163e('0x97')){if(this[_0x163e('0x1f')][_0x5258c4][_0x163e('0xa4')]==='not_inuse'&&this[_0x163e('0x1f')][_0x5258c4]['status']===_0x163e('0xd2')){_0x4fe58b[_0x163e('0x124')](this[_0x163e('0x1f')][_0x5258c4]['id']);}}}this['getContactDialer'](_0xcde98a['id'],_0x4fe58b,0x1,_0xcde98a[_0x163e('0x1fa')])[_0x163e('0xb6')](function(_0x203e38){if(!checkContactEmpty(_0x203e38)){checkContactLowerLimitOriginate(_0xcde98a,0x1,0x0);_0x897688[_0x163e('0xb4')](_0xcde98a)[_0x163e('0xb6')](sendMessageReschedule(_0xcde98a))[_0x163e('0xaf')](loggerCatch(_0x163e('0x1fb')));}else{_0xcde98a[_0x163e('0x3d')]=_0x163e('0x1f3');if(_['isNil'](_0x203e38[0x0])||_['isNil'](_0x203e38[0x0][_0x163e('0x165')])||_[_0x163e('0xad')](_0x203e38[0x0][_0x163e('0x165')][_0x163e('0x164')])){_0x897688['emptyContact'](_0x163e('0x1f4'),_0xcde98a,_0x203e38[0x0]);}else{_0x897688[_0x163e('0x1fd')](_['pick'](_0x203e38[0x0],[_0x163e('0xf5'),_0x163e('0x1f5')]))[_0x163e('0xb6')](_0x897688[_0x163e('0x1df')](_0xcde98a,_0x203e38[0x0]))[_0x163e('0xaf')](_0x897688[_0x163e('0xc8')](_0x163e('0x201'),_0xcde98a));}}})[_0x163e('0xaf')](loggerGetContactDialer('[getContactDialerPredictive]',_0xcde98a,0x1));emitVoiceQueueSummary(_0xcde98a);};Dialer[_0x163e('0xac')][_0x163e('0x1da')]=function(_0x4629c4,_0x310d50,_0xde3be5,_0x476d8f,_0x13bb1b,_0x23065a){loggerPredictive[_0x163e('0x7c')](_0x163e('0x202'));loggerPredictive[_0x163e('0x7c')](_0x163e('0x203'),_0x4629c4);loggerPredictive[_0x163e('0x7c')](_0x163e('0x204'),_0x310d50);loggerPredictive[_0x163e('0x7c')](_0x163e('0x205'),_0xde3be5);loggerPredictive[_0x163e('0x7c')](_0x163e('0x206'),_0x476d8f);loggerPredictive[_0x163e('0x7c')](_0x163e('0x207'),_0x13bb1b);loggerPredictive[_0x163e('0x7c')](_0x163e('0x8c'));return new BPromise(function(_0x15f611,_0x1c4535){if(_0x4629c4<=0x0||isNaN(_0x4629c4)){return _0x1c4535(msgResponse(_0x163e('0x208'),_0x163e('0x45'),_0x163e('0x209')+_0x4629c4));}if(_0xde3be5<=0x0||isNaN(_0xde3be5)){return _0x1c4535(msgResponse('[abandonmentRate]',_0x163e('0x45'),_0x163e('0x20a')+_0xde3be5));}if(_0x476d8f<=0x0||isNaN(_0x476d8f)){return _0x1c4535(msgResponse(_0x163e('0x208'),_0x163e('0x45'),_0x163e('0x20b')+_0x476d8f));}if(_0x310d50<=0x0||isNaN(_0x310d50)){return _0x1c4535(msgResponse(_0x163e('0x208'),_0x163e('0x45'),'interval\x20=\x20'+_0x310d50));}if(_0x13bb1b<=0x0||isNaN(_0x13bb1b)){return _0x1c4535(msgResponse(_0x163e('0x208'),_0x163e('0x45'),_0x163e('0x20c')+_0x13bb1b));}_0x23065a=_0x23065a||0x0;var _0x3ab908=0x1/_0xde3be5;var _0xe4e1c3=0x0;var _0x4676c7=0x0;var _0xe48f4c=0x0;var _0x54dbcf=0x0;for(var _0xf6eeb=0x0;_0xe48f4c<_0x13bb1b;_0xf6eeb+=0x1){_0x4676c7=_0xf6eeb/_0x310d50;_0xe4e1c3=(_0x476d8f*_0x4676c7+_0x23065a)/_0x3ab908;_0xe48f4c=erlangb(_0xe4e1c3,_0x4629c4);_0x54dbcf=_0xe4e1c3/_0x4629c4*(0x1-erlangb(_0xe4e1c3,_0x4629c4));}return _0x15f611({'erlangCalls':_0xf6eeb,'erlangCallToSecond':_0x310d50/_0xf6eeb,'erlangAbandonmentRate':_0xe48f4c,'erlangBusyFactor':_0x54dbcf});});};Dialer[_0x163e('0xac')]['busyFactor']=function(_0x329322,_0x4fb4f3,_0x3f7760,_0x518e52,_0x24c6f3,_0x2d8ec1){loggerPredictive[_0x163e('0x7c')](_0x163e('0x20d'));loggerPredictive[_0x163e('0x7c')](_0x163e('0x203'),_0x329322);loggerPredictive['info'](_0x163e('0x204'),_0x4fb4f3);loggerPredictive[_0x163e('0x7c')](_0x163e('0x205'),_0x3f7760);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x518e52);loggerPredictive[_0x163e('0x7c')](_0x163e('0x20e'),_0x24c6f3);loggerPredictive[_0x163e('0x7c')](_0x163e('0x8c'));return new BPromise(function(_0x4ab4e3,_0x1fa9b3){if(_0x329322<=0x0||isNaN(_0x329322)){return _0x1fa9b3(msgResponse(_0x163e('0x20f'),_0x163e('0x45'),_0x163e('0x209')+_0x329322));}if(_0x3f7760<=0x0||isNaN(_0x3f7760)){return _0x1fa9b3(msgResponse('[busyFactor]',_0x163e('0x45'),_0x163e('0x20a')+_0x3f7760));}if(_0x518e52<=0x0||isNaN(_0x518e52)){return _0x1fa9b3(msgResponse('[busyFactor]',_0x163e('0x45'),_0x163e('0x20b')+_0x518e52));}if(_0x4fb4f3<=0x0||isNaN(_0x4fb4f3)){return _0x1fa9b3(msgResponse(_0x163e('0x20f'),'Error',_0x163e('0x210')+_0x4fb4f3));}if(_0x24c6f3<=0x0||isNaN(_0x24c6f3)){return _0x1fa9b3(msgResponse(_0x163e('0x20f'),_0x163e('0x45'),_0x163e('0x211')+_0x24c6f3));}_0x2d8ec1=_0x2d8ec1||0x0;var _0x399c7e=0x1/_0x3f7760;var _0x475619=0x0;var _0x2ddf75=0x0;var _0x422ac0=0x0;var _0x5ee9fc=0x0;for(var _0x1c8e12=0x0;_0x5ee9fc<_0x24c6f3;_0x1c8e12+=0x1){_0x2ddf75=_0x1c8e12/_0x4fb4f3;_0x475619=(_0x518e52*_0x2ddf75+_0x2d8ec1)/_0x399c7e;_0x422ac0=erlangb(_0x475619,_0x329322);_0x5ee9fc=_0x475619/_0x329322*(0x1-erlangb(_0x475619,_0x329322));}return _0x4ab4e3({'erlangCalls':_0x1c8e12,'erlangCallToSecond':_0x4fb4f3/_0x1c8e12,'erlangAbandonmentRate':_0x422ac0,'erlangBusyFactor':_0x5ee9fc});});};module[_0x163e('0x212')]=Dialer; \ No newline at end of file +var _0xcae6=['notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','status','reachable','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','HANGUP','membername','[syncHangupInAMD]','dialAMDActive','value','MACHINE','statedesc','Machine','AMD','countglobal','amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','CampaignId','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','state','countbusyretry','dialGlobalMaxRetry','createStateFinal','minutes','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','Unknow','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','paused','stateinterface','locked','push','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','Failure','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','interval','content','indexOf','true','iftime\x20%s,%s','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialTimezone','checkDialMethod','[syncQueueSummary]','syncCampaigns','dialGlobalInterval','[syncCampaigns]','\x5cw{0,','pow','random','match','object','originate','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','dialCutDigit','SIP/%s/%s%s','trim','substring','[originateError]:\x20%s','OriginateError','[originate][error]','getQueue','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','checkRetriveMax','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','reason','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalTotalCalls','abandonmentRate','agentBusyFactor','busyFactor','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','[getDataPredictive]','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[booked][checkContactBlack][else]','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','temp','maxNumberOriginate','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','dialLimitQueue','pTalking','not_inuse','[countReScheduled]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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]','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','preview','voiceQueues','campaigns','agents','trunks','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','agentcomplete','syncAgentComplete','hangup','syncHangup','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','isUndefined','message','name','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','loggedIn','sumBillable','sumDuration','sumHoldTime','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','stringify','format','voice:queue:%s','ivr','campaign:ivr:%s','campaign:save','info','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','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','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','inspect','error','stack','length','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','talking','sendMessageOneNotActive','available','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','endtime','starttime','loopClearZombieChannels','clearZombieChannels','[uniqueid]','actions','[actions]','sequence','isNil','Action','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','checkIsBlackList','catch','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact'];(function(_0x47d067,_0x48eed6){var _0x3e2163=function(_0x3d7a6d){while(--_0x3d7a6d){_0x47d067['push'](_0x47d067['shift']());}};_0x3e2163(++_0x48eed6);}(_0xcae6,0x146));var _0x6cae=function(_0x47bc58,_0x1e1998){_0x47bc58=_0x47bc58-0x0;var _0x4a0860=_0xcae6[_0x47bc58];return _0x4a0860;};'use strict';var util=require(_0x6cae('0x0'));var _=require(_0x6cae('0x1'));var BPromise=require('bluebird');var uuid=require(_0x6cae('0x2'));var moment=require('moment');var rr=require('rr');var md5=require('md5');var Redis=require('ioredis');var ut=require(_0x6cae('0x3'));var config=require(_0x6cae('0x4'));var logger=require(_0x6cae('0x5'))(_0x6cae('0x6'));var loggerBooked=require(_0x6cae('0x5'))(_0x6cae('0x7'));var loggerPredictive=require(_0x6cae('0x5'))(_0x6cae('0x8'));var loggerPredictiveCalls=require(_0x6cae('0x5'))(_0x6cae('0x9'));var loggerSyncQueueSummary=require(_0x6cae('0x5'))(_0x6cae('0xa'));var ami=require(_0x6cae('0xb'));config[_0x6cae('0xc')]=_[_0x6cae('0xd')](config[_0x6cae('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x6cae('0xe'))(new Redis(config[_0x6cae('0xc')]));var cmHopper=require(_0x6cae('0xf'));var cmHopperHistory=require(_0x6cae('0x10'));var cmHopperBlack=require(_0x6cae('0x11'));var voiceQueueRt=require(_0x6cae('0x12'));var Action=require(_0x6cae('0x13'));var History=require(_0x6cae('0x14'));var Final=require(_0x6cae('0x15'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x6cae('0x16'));var Hangup=require(_0x6cae('0x17'));var ipAgi=process[_0x6cae('0x18')][_0x6cae('0x19')]||_0x6cae('0x1a');var strategy={'rrmemory':_0x6cae('0x1b'),'roundrobin':_0x6cae('0x1c')};var Sequence=function(){};Sequence[_0x6cae('0x1d')]['enqueue']=function(_0x262354){this['tail']=this[_0x6cae('0x1e')]?this[_0x6cae('0x1e')][_0x6cae('0x1f')](_0x262354):_0x262354();};function Dialer(_0x3968f9,_0x52a4f3){this['sequence']=new Sequence();this[_0x6cae('0x20')]=_0x52a4f3;this['voiceQueues']=_0x3968f9[_0x6cae('0x21')];this[_0x6cae('0x22')]=_0x3968f9[_0x6cae('0x22')];this[_0x6cae('0x23')]=_0x3968f9[_0x6cae('0x23')];this[_0x6cae('0x24')]=_0x3968f9[_0x6cae('0x24')];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this['channels']={};this['actions']={};this[_0x6cae('0x25')]={};this[_0x6cae('0x26')]={};this[_0x6cae('0x27')]={};this[_0x6cae('0x28')]={};this[_0x6cae('0x29')]={};this[_0x6cae('0x2a')]={};this[_0x6cae('0x2b')]={};this[_0x6cae('0x2c')]={};ami['on'](_0x6cae('0x2d'),this[_0x6cae('0x2e')][_0x6cae('0x2f')](this));ami['on'](_0x6cae('0x30'),this['syncQueueCallerAbandon'][_0x6cae('0x2f')](this));ami['on']('originateresponse',this['syncOriginateResponse']['bind'](this));ami['on'](_0x6cae('0x31'),this[_0x6cae('0x32')][_0x6cae('0x2f')](this));ami['on']('custom:queuesummary',this[_0x6cae('0xa')][_0x6cae('0x2f')](this));ami['on'](_0x6cae('0x33'),this[_0x6cae('0x34')][_0x6cae('0x2f')](this));ami['on']('newexten',this[_0x6cae('0x35')]['bind'](this));ami['on'](_0x6cae('0x36'),this[_0x6cae('0x37')]['bind'](this));ami['on'](_0x6cae('0x38'),this[_0x6cae('0x39')]['bind'](this));ami['on'](_0x6cae('0x3a'),this[_0x6cae('0x3b')][_0x6cae('0x2f')](this));this[_0x6cae('0x3c')]();this['loopClearZombieChannels']();}function isNotNull(_0x26cefe){return _0x26cefe!==null&&!_[_0x6cae('0x3d')](_0x26cefe);}function checkIsLoggedIn(_0x2cbbf0,_0x21a8e1){return function(){if(_0x21a8e1<=0x0){_0x2cbbf0[_0x6cae('0x3e')]='AGENTS_NOT_LOGGED';throw _0x2cbbf0[_0x6cae('0x3f')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x18d077){return _0x18d077;}function checkIsActive(_0x5916d5,_0x1c570c){return function(){if(!isActive(_0x1c570c)){_0x5916d5['message']=_0x6cae('0x40');throw _0x5916d5[_0x6cae('0x3f')]+_0x6cae('0x41');}};}function checkInterval(_0x5168d3){return function(){if(!isNotNull(_0x5168d3[_0x6cae('0x42')])){_0x5168d3[_0x6cae('0x3e')]=_0x6cae('0x43');throw _0x5168d3[_0x6cae('0x3f')]+_0x6cae('0x44');}if(!isNotNull(_0x5168d3[_0x6cae('0x42')]['Intervals'])){_0x5168d3[_0x6cae('0x3e')]=_0x6cae('0x43');throw _0x5168d3[_0x6cae('0x3f')]+_0x6cae('0x44');}if(!isNotNull(_[_0x6cae('0x45')](_0x5168d3['Interval']['Intervals']))){_0x5168d3['message']=_0x6cae('0x43');throw _0x5168d3['name']+_0x6cae('0x44');}};}function msgResponse(_0x3cd50d,_0x2e7da1,_0x3a7d6a){return{'action':_0x3cd50d,'response':_0x2e7da1,'message':_0x3a7d6a,'stack':_0x3a7d6a};}function myreject(_0x4f0ef7){return function(_0x239235){return _0x4f0ef7(msgResponse(_0x6cae('0x46'),_0x6cae('0x47'),JSON['stringify'](_0x239235)));};}function getSeconds(_0x233ddc,_0x2e9a56){var _0x2190ca=moment(_0x233ddc)[_0x6cae('0x48')](0x0);var _0x52eebf=moment(_0x2e9a56)['milliseconds'](0x0);return _0x2190ca[_0x6cae('0x49')](_0x52eebf,_0x6cae('0x4a'));}function emit(_0x5c1724,_0xd97848,_0x168cc7){io['to'](_0x5c1724)[_0x6cae('0x4b')](_0xd97848,_0x168cc7);}function emitVoiceQueueSummary(_0x1f5c1f){if(_0x1f5c1f[_0x6cae('0x4c')]===_0x6cae('0x4d')){var _0x12b858={'id':_0x1f5c1f['id'],'name':_0x1f5c1f[_0x6cae('0x3f')],'strategy':_0x1f5c1f[_0x6cae('0x4e')],'answered':_0x1f5c1f[_0x6cae('0x4f')],'available':_0x1f5c1f['available'],'loggedIn':_0x1f5c1f[_0x6cae('0x50')],'pTalking':_0x1f5c1f['pTalking'],'sumBillable':_0x1f5c1f[_0x6cae('0x51')],'sumDuration':_0x1f5c1f[_0x6cae('0x52')],'sumHoldTime':_0x1f5c1f[_0x6cae('0x53')]||0x0,'talking':_0x1f5c1f['talking'],'total':_0x1f5c1f[_0x6cae('0x54')],'type':_0x1f5c1f[_0x6cae('0x4c')],'unmanaged':_0x1f5c1f[_0x6cae('0x55')],'abandoned':_0x1f5c1f['abandoned'],'waiting':_0x1f5c1f[_0x6cae('0x56')],'loggedInDb':_0x1f5c1f[_0x6cae('0x57')],'dialActive':_0x1f5c1f[_0x6cae('0x58')],'dialMethod':_0x1f5c1f[_0x6cae('0x59')],'dialOriginateCallerIdName':_0x1f5c1f['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x1f5c1f[_0x6cae('0x5a')],'dialOriginateTimeout':_0x1f5c1f[_0x6cae('0x5b')],'dialPrefix':_0x1f5c1f[_0x6cae('0x5c')],'outboundAnswerAgiCallsDay':_0x1f5c1f[_0x6cae('0x5d')],'outboundAnswerCallsDay':_0x1f5c1f[_0x6cae('0x5e')],'outboundBlacklistCallsDay':_0x1f5c1f[_0x6cae('0x5f')],'outboundBusyCallsDay':_0x1f5c1f[_0x6cae('0x60')],'outboundCongestionCallsDay':_0x1f5c1f[_0x6cae('0x61')],'outboundDropCallsDayACS':_0x1f5c1f[_0x6cae('0x62')],'outboundDropCallsDayCallersExit':_0x1f5c1f[_0x6cae('0x63')],'outboundDropCallsDayTimeout':_0x1f5c1f['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x1f5c1f[_0x6cae('0x64')],'outboundNoSuchCallsDay':_0x1f5c1f['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x1f5c1f[_0x6cae('0x65')],'outboundReCallsDay':_0x1f5c1f[_0x6cae('0x66')],'outboundRejectCallsDay':_0x1f5c1f[_0x6cae('0x67')],'outboundUnknownCallsDay':_0x1f5c1f[_0x6cae('0x68')],'predictiveIntervalAnsweredCalls':_0x1f5c1f[_0x6cae('0x69')],'predictiveIntervalAvgHoldtime':_0x1f5c1f['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x1f5c1f[_0x6cae('0x6a')],'predictiveIntervalDroppedCallsCallersExit':_0x1f5c1f[_0x6cae('0x6b')],'predictiveIntervalDroppedCallsTimeout':_0x1f5c1f[_0x6cae('0x6c')],'predictiveIntervalErlangCalls':_0x1f5c1f['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x1f5c1f[_0x6cae('0x6d')],'predictiveIntervalHitRate':_0x1f5c1f[_0x6cae('0x6e')],'predictiveIntervalMultiplicativeFactor':_0x1f5c1f[_0x6cae('0x6f')],'predictiveIntervalPauses':_0x1f5c1f[_0x6cae('0x70')],'predictiveIntervalAvailable':_0x1f5c1f[_0x6cae('0x71')],'predictiveIntervalTotalCalls':_0x1f5c1f['predictiveIntervalTotalCalls'],'message':_0x1f5c1f['message'],'originated':_0x1f5c1f['originated'],'erlangCalls':_0x1f5c1f['erlangCalls'],'erlangCallToSecond':_0x1f5c1f[_0x6cae('0x72')],'erlangAbandonmentRate':_0x1f5c1f[_0x6cae('0x73')],'erlangBusyFactor':_0x1f5c1f[_0x6cae('0x74')],'startPredictive':_0x1f5c1f[_0x6cae('0x28')],'startProgressive':_0x1f5c1f[_0x6cae('0x29')]};if(_0x1f5c1f[_0x6cae('0x75')]){_0x12b858['Trunk']={'id':_0x1f5c1f[_0x6cae('0x75')]['id'],'name':_0x1f5c1f['Trunk'][_0x6cae('0x3f')],'active':_0x1f5c1f[_0x6cae('0x75')][_0x6cae('0x76')],'callerid':_0x1f5c1f[_0x6cae('0x75')][_0x6cae('0x77')]};}if(_0x1f5c1f[_0x6cae('0x42')]){_0x12b858[_0x6cae('0x42')]={'id':_0x1f5c1f[_0x6cae('0x42')]['id'],'name':_0x1f5c1f['Interval'][_0x6cae('0x3f')]};}var _0x16409e=md5(JSON[_0x6cae('0x78')](_0x12b858));if(_0x1f5c1f['md5']!==_0x16409e){_0x1f5c1f['md5']=_0x16409e;emit(util[_0x6cae('0x79')](_0x6cae('0x7a'),_0x12b858[_0x6cae('0x3f')]),'voice_queue:save',_0x12b858);}}}function emitCampaignSummary(_0x3a7e7f){if(_0x3a7e7f[_0x6cae('0x4c')]===_0x6cae('0x7b')){emit(util[_0x6cae('0x79')](_0x6cae('0x7c'),_0x3a7e7f['name']),_0x6cae('0x7d'),_0x3a7e7f);}}function checkGetDataPredictive(_0x18dc1d){if(isNotNull(_0x18dc1d)&&!_[_0x6cae('0x45')](_0x18dc1d)){loggerPredictive[_0x6cae('0x7e')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x6cae('0x7e')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x18dc1d['predictiveIntervalTotalCalls']);loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x7f'),_0x18dc1d['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x80'),_0x18dc1d[_0x6cae('0x6c')]);loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x81'),_0x18dc1d['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x6cae('0x7e')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x18dc1d['predictiveIntervalAvgHoldtime']);loggerPredictive['info'](_0x6cae('0x82'),_0x18dc1d[_0x6cae('0x6a')]);loggerPredictive['info'](_0x6cae('0x83'));if(_0x18dc1d['predictiveIntervalTotalCalls']>0x0){if(!_[_0x6cae('0x3d')](_0x18dc1d[_0x6cae('0x6a')])&&_0x18dc1d[_0x6cae('0x6a')]>0x0){return!![];}loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x84'));if(!_[_0x6cae('0x3d')](_0x18dc1d[_0x6cae('0x85')])&&_0x18dc1d[_0x6cae('0x85')]>0x0){return!![];}loggerPredictive[_0x6cae('0x7e')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x86'));}}else{loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x87'));}return![];}function mergeDataErlangB(_0xe666aa){return function(_0x1127d1){loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x88'));loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x89'),_0x1127d1[_0x6cae('0x8a')]);loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x8b'),_0x1127d1[_0x6cae('0x72')]);loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x8c'),_0x1127d1[_0x6cae('0x73')]);loggerPredictive['info'](_0x6cae('0x8d'),_0x1127d1[_0x6cae('0x74')]);loggerPredictive[_0x6cae('0x7e')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1127d1['erlangAbandonmentRate']);loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x83'));_[_0x6cae('0x8e')](_0xe666aa,_0x1127d1);};}function getDiff(_0x7cedbc){var _0x3bcb29=moment()['milliseconds'](0x0);var _0xef1a1e=moment(_0x7cedbc)[_0x6cae('0x48')](0x0);return _0x3bcb29[_0x6cae('0x49')](_0xef1a1e,_0x6cae('0x4a'));}function ifInterval(_0x1b9e58,_0x3d2b19){if(_[_0x6cae('0x3d')](_0x3d2b19)){return![];}return getDiff(_0x3d2b19)<_0x1b9e58*0x3c;}function freeVariablesPredictive(_0x387077){if(isNotNull(_0x387077)){if(!_['isUndefined'](_0x387077[_0x6cae('0x29')])){_0x387077['startProgressive']=undefined;loggerPredictive[_0x6cae('0x7e')](_0x387077[_0x6cae('0x3f')],'clearing\x20variable\x20start\x20progressive');}if(!_['isUndefined'](_0x387077[_0x6cae('0x28')])){_0x387077[_0x6cae('0x28')]=undefined;loggerPredictive[_0x6cae('0x7e')](_0x387077[_0x6cae('0x3f')],_0x6cae('0x8f'));}if(!_['isUndefined'](_0x387077[_0x6cae('0x90')])){clearInterval(_0x387077[_0x6cae('0x90')]);_0x387077[_0x6cae('0x90')]=undefined;loggerPredictive[_0x6cae('0x7e')](_0x387077['name'],_0x6cae('0x91'));}}}function erlangb(_0x36b41d,_0x2147d9){if(_0x2147d9===0x0){return 0x0;}var _0x4e9460=0x1;for(var _0x9d70e=0x1;_0x9d70e<=_0x2147d9;_0x9d70e+=0x1){_0x4e9460=0x1+_0x4e9460*_0x9d70e/_0x36b41d;}return 0x1/_0x4e9460;}function isVoiceQueueOutbound(_0x20c234){return _0x20c234==='outbound';}function isNotPreview(_0x2c47b3){return _0x2c47b3!=='preview';}function isCampaignIvr(_0x175545){return _0x175545==='ivr';}function getCallerId(_0x408d87,_0x27bfbc,_0x545a2e){if(!_[_0x6cae('0x3d')](_0x545a2e)&&typeof _0x545a2e===_0x6cae('0x92')&&!_[_0x6cae('0x45')](_0x545a2e)){if(!_[_0x6cae('0x3d')](_0x27bfbc)&&typeof _0x27bfbc===_0x6cae('0x92')&&!_[_0x6cae('0x45')](_0x27bfbc)){return util[_0x6cae('0x79')](_0x6cae('0x93'),_0x27bfbc,_0x545a2e);}return util[_0x6cae('0x79')]('\x22%s\x22\x20<%s>',_0x545a2e,_0x545a2e);}if(!_[_0x6cae('0x3d')](_0x408d87)&&typeof _0x408d87===_0x6cae('0x92')&&!_[_0x6cae('0x45')](_0x408d87)){return _0x408d87;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x36b188,_0x24035d){return function(_0x569925){freeVariablesPredictive(_0x24035d);emitVoiceQueueSummary(_0x24035d);emitCampaignSummary(_0x24035d);loggerSyncQueueSummary['error'](_0x36b188,util[_0x6cae('0x94')](_0x569925,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x5246ad,_0x478596){return function(_0x2338a0){loggerPredictive[_0x6cae('0x95')](_0x478596[_0x6cae('0x3f')],_0x5246ad);loggerPredictive[_0x6cae('0x95')](_0x2338a0[_0x6cae('0x96')]);freeVariablesPredictive(_0x478596);};}function loggerCatch(_0x4a0d9f){return function(_0x561046){logger[_0x6cae('0x95')](_0x4a0d9f,util[_0x6cae('0x94')](_0x561046,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x519c6a){return _0x519c6a&&!_['isUndefined'](_0x519c6a)&&_0x519c6a[_0x6cae('0x97')]>0x0;}function decremetOriginate(_0x2e1200){if(!_[_0x6cae('0x3d')](_0x2e1200)&&_0x2e1200!==null){if(typeof _0x2e1200[_0x6cae('0x98')]!==_0x6cae('0x99')){if(_0x2e1200[_0x6cae('0x98')]>0x0){_0x2e1200['originated']-=0x1;}else{logger[_0x6cae('0x95')](_0x6cae('0x9a'));}}}else{logger[_0x6cae('0x95')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x3e4e5b,_0x36ed10,_0xca926f){if(_0x36ed10>_0xca926f){for(var _0x1783fd=0x0;_0x1783fd<_0x36ed10-_0xca926f;_0x1783fd+=0x1){decremetOriginate(_0x3e4e5b);}}}function loggerGetContactDialer(_0x20774e,_0x2367e4,_0x1393bb){return function(_0x1deda9){checkContactLowerLimitOriginate(_0x2367e4,_0x1393bb,0x0);logger[_0x6cae('0x95')](_0x20774e,util[_0x6cae('0x94')](_0x1deda9,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1b1c70){return function(_0x278be9){if(isNotNull(_0x278be9)&&isNotNull(_0x278be9[0x0])){if(_0x278be9[0x0][_0x6cae('0x9b')]>0x0){_0x1b1c70[_0x6cae('0x3e')]='RESCHEDULED_CONTACTS';logger[_0x6cae('0x7e')](_0x6cae('0x9c')+_0x1b1c70[_0x6cae('0x3f')],_0x278be9[0x0]['contactsRescheduled'],_0x6cae('0x9d'));}else{_0x1b1c70[_0x6cae('0x3e')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x6cae('0x7e')](_0x6cae('0x9e')+_0x1b1c70['name']);}}};}function notSendMessagesQueue(_0x16f364){if(_0x16f364['sendMessageOneNotActive']){freeVariablesPredictive(_0x16f364);if(_0x16f364[_0x6cae('0x98')]===0x0&&_0x16f364[_0x6cae('0x9f')]===0x0&&_0x16f364[_0x6cae('0x56')]===0x0&&(_0x16f364['pTalking']||0x0)===0x0){_0x16f364[_0x6cae('0xa0')]=![];_0x16f364[_0x6cae('0xa1')]=0x0;_0x16f364[_0x6cae('0x3e')]=_0x6cae('0x40');loggerSyncQueueSummary[_0x6cae('0x95')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x16f364[_0x6cae('0x3f')],'is\x20not\x20active');}else{_0x16f364[_0x6cae('0x3e')]=_0x6cae('0xa2');loggerSyncQueueSummary[_0x6cae('0x95')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x16f364['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x16f364);}}function notSendMessagesCampaign(_0x402f37){if(_0x402f37[_0x6cae('0xa0')]){if(_0x402f37[_0x6cae('0x98')]===0x0){_0x402f37[_0x6cae('0xa0')]=![];_0x402f37[_0x6cae('0x3e')]=_0x6cae('0x40');loggerSyncQueueSummary[_0x6cae('0x95')](_0x6cae('0xa3'),_0x402f37['name'],_0x6cae('0xa4'));}else{_0x402f37[_0x6cae('0x3e')]=_0x6cae('0xa2');loggerSyncQueueSummary[_0x6cae('0x95')](_0x6cae('0xa3'),_0x402f37[_0x6cae('0x3f')],'is\x20disactive');}emitCampaignSummary(_0x402f37);}}function createObjHistory(_0x3c75f0,_0x366e32,_0x3f8bd2,_0x4c9b72,_0x4b9bfd){_0x3c75f0[_0x6cae('0x3e')]=_0x3f8bd2;var _0x11e5e3=new Action(_0x3c75f0,_0x366e32);var _0x3d7879=new History(_0x11e5e3);_0x3d7879['state']=_0x4c9b72;_0x3d7879['statedesc']=_0x4b9bfd;_0x3d7879[_0x6cae('0xa5')]=_0x11e5e3[_0x6cae('0xa6')];return _0x3d7879;}Dialer[_0x6cae('0x1d')][_0x6cae('0xa7')]=function(){var _0x1fd942=this;setInterval(function(){_0x1fd942[_0x6cae('0xa8')](_0x1fd942[_0x6cae('0x26')],_0x6cae('0xa9'));_0x1fd942['clearZombieChannels'](_0x1fd942[_0x6cae('0xaa')],_0x6cae('0xab'));},0x32c8);};Dialer[_0x6cae('0x1d')]['clearZombieChannels']=function(_0x3a8838,_0x1aeace){var _0x27e709=this;for(var _0x1b28a8 in _0x3a8838){if(typeof _0x3a8838[_0x1b28a8]!=='undefined'){this[_0x6cae('0xac')]['enqueue'](function(){if(!_[_0x6cae('0xad')](_0x3a8838[_0x1b28a8])){return ami[_0x6cae('0xae')]({'action':'status','channel':_0x3a8838[_0x1b28a8][_0x6cae('0xaf')]})['catch'](function(_0x2fa3b7){if(_0x2fa3b7[_0x6cae('0x3e')]===_0x6cae('0xb0')){setTimeout(function(){if(_0x3a8838[_0x1b28a8]&&_0x3a8838[_0x1b28a8]['type']!==_0x6cae('0x7b')){_0x27e709[_0x6cae('0xb1')](_0x27e709[_0x6cae('0x21')][_0x3a8838[_0x1b28a8][_0x6cae('0xb2')]]);logger[_0x6cae('0x95')](_0x6cae('0xb3'),_0x1aeace,_0x1b28a8,_0x3a8838[_0x1b28a8]['queue']);delete _0x3a8838[_0x1b28a8];}if(_0x3a8838[_0x1b28a8]&&_0x3a8838[_0x1b28a8]['type']===_0x6cae('0x7b')){_0x27e709[_0x6cae('0xb1')](_0x27e709['campaigns'][_0x3a8838[_0x1b28a8][_0x6cae('0xb2')]]);logger['error'](_0x6cae('0xb4'),_0x1aeace,_0x1b28a8,_0x3a8838[_0x1b28a8]['queue']);delete _0x3a8838[_0x1b28a8];}},0x2328);}});}});}}};Dialer[_0x6cae('0x1d')][_0x6cae('0xb5')]=function(_0x68f9aa){return BPromise[_0x6cae('0xb6')]()[_0x6cae('0xb7')](cmHopper[_0x6cae('0xb5')](_0x68f9aa))['catch'](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x6cae('0x1d')][_0x6cae('0xb8')]=function(_0x2b4100){return BPromise['resolve']()[_0x6cae('0xb7')](cmHopperBlack[_0x6cae('0xb8')](_0x2b4100))[_0x6cae('0xb9')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x6cae('0x1d')][_0x6cae('0xba')]=function(_0xaea9fd){return BPromise[_0x6cae('0xb6')]()['then'](cmHopperBlack[_0x6cae('0xba')](_0xaea9fd))[_0x6cae('0xb9')](loggerCatch(_0x6cae('0xbb')));};Dialer['prototype'][_0x6cae('0xbc')]=function(_0x28a973){return BPromise[_0x6cae('0xb6')]()['then'](cmHopperHistory['avgHandleTime'](_0x28a973))[_0x6cae('0xb9')](loggerCatch(_0x6cae('0xbd')));};Dialer[_0x6cae('0x1d')][_0x6cae('0xbe')]=function(_0xda3009){return BPromise[_0x6cae('0xb6')]()[_0x6cae('0xb7')](cmHopper[_0x6cae('0xbe')](_0xda3009))[_0x6cae('0xb9')](loggerCatch(_0x6cae('0xbf')));};Dialer[_0x6cae('0x1d')][_0x6cae('0xc0')]=function(_0x1a4fe1,_0x2119fd,_0x56426a){return BPromise['resolve']()[_0x6cae('0xb7')](cmHopper[_0x6cae('0xc0')](_0x1a4fe1,_0x2119fd,_0x56426a))[_0x6cae('0xb9')](loggerCatch(_0x6cae('0xc1')));};Dialer[_0x6cae('0x1d')][_0x6cae('0xc2')]=function(_0xc7d01d,_0x196d5e,_0x36153b,_0x2786ea){return BPromise[_0x6cae('0xb6')]()[_0x6cae('0xb7')](cmHopper[_0x6cae('0xc2')](_0xc7d01d,_0x196d5e,_0x36153b,_0x2786ea))['catch'](loggerCatch(_0x6cae('0xc3')));};Dialer['prototype']['getContactDialerIvr']=function(_0x327aa1,_0x16635e,_0x547c77){return BPromise['resolve']()[_0x6cae('0xb7')](cmHopper[_0x6cae('0xc4')](_0x327aa1,_0x16635e,_0x547c77))['catch'](loggerCatch(_0x6cae('0xc3')));};Dialer[_0x6cae('0x1d')][_0x6cae('0xc5')]=function(_0x32b6f2){return BPromise[_0x6cae('0xb6')]()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x32b6f2))[_0x6cae('0xb9')](loggerCatch(_0x6cae('0xc6')));};Dialer[_0x6cae('0x1d')][_0x6cae('0xc7')]=function(_0x4065ad){return BPromise[_0x6cae('0xb6')]()[_0x6cae('0xb7')](cmHopper[_0x6cae('0xc7')](_0x4065ad))[_0x6cae('0xb9')](loggerCatch(_0x6cae('0xc8')));};Dialer[_0x6cae('0x1d')][_0x6cae('0xc9')]=function(_0x5413de){return BPromise['resolve']()[_0x6cae('0xb7')](cmHopperHistory[_0x6cae('0xc9')](_0x5413de))[_0x6cae('0xb9')](loggerCatch(_0x6cae('0xca')));};Dialer['prototype'][_0x6cae('0xb1')]=function(_0x6448d0){if(!_[_0x6cae('0x3d')](_0x6448d0)&&_0x6448d0!==null){if(typeof _0x6448d0[_0x6cae('0x98')]!==_0x6cae('0x99')){if(_0x6448d0[_0x6cae('0x98')]>0x0){_0x6448d0['originated']-=0x1;}else{logger[_0x6cae('0x95')](_0x6cae('0xcb'));}}}else{logger[_0x6cae('0x95')](_0x6cae('0xcc'));}};Dialer['prototype'][_0x6cae('0xcd')]=function(_0x49de16,_0x2b8aea){var _0x48d6f7=this;return function(_0x27e313){_0x48d6f7[_0x6cae('0xb1')](_0x2b8aea);logger[_0x6cae('0x95')](_0x49de16,util[_0x6cae('0x94')](_0x27e313,{'showHidden':![],'depth':null}));};};Dialer[_0x6cae('0x1d')][_0x6cae('0xce')]=function(_0x3ed9b9,_0x32acda,_0x50b281){var _0x50a8c9={'state':0x19,'statedesc':_0x6cae('0xcf')};this[_0x6cae('0xb1')](_0x32acda);this[_0x6cae('0xd0')](_['merge'](_0x50a8c9,_[_0x6cae('0xd1')](_0x50b281,[_0x6cae('0xd2'),_0x6cae('0xd3'),_0x6cae('0xd4'),_0x6cae('0xd5'),'CampaignId'])),_0x6cae('0xd6'),_0x6cae('0xd7'));logger[_0x6cae('0x95')](_0x3ed9b9);};Dialer[_0x6cae('0x1d')][_0x6cae('0xd8')]=function(_0x739f6a){return _0x739f6a===_0x6cae('0xd9');};Dialer[_0x6cae('0x1d')][_0x6cae('0xda')]=function(_0x3a67a3){return!_['isUndefined'](_0x3a67a3)&&_0x3a67a3&&!_['isUndefined'](_0x3a67a3[_0x6cae('0x3f')])&&!_[_0x6cae('0x3d')](_0x3a67a3[_0x6cae('0x76')])&&_0x3a67a3[_0x6cae('0x76')]&&(this[_0x6cae('0x24')][util[_0x6cae('0x79')]('SIP/%s',_0x3a67a3['name'])][_0x6cae('0xdb')]===_0x6cae('0xdc')||this[_0x6cae('0x24')][util[_0x6cae('0x79')]('SIP/%s',_0x3a67a3[_0x6cae('0x3f')])][_0x6cae('0xdb')]===_0x6cae('0xdd'));};Dialer[_0x6cae('0x1d')][_0x6cae('0xd0')]=function(_0x5c3bb2,_0x312bb8,_0x329641){this[_0x6cae('0xc9')](_0x5c3bb2)[_0x6cae('0xb9')](loggerCatch(_0x312bb8));this['moveContactManagedDialer'](_0x5c3bb2)[_0x6cae('0xb9')](loggerCatch(_0x329641));};Dialer[_0x6cae('0x1d')][_0x6cae('0x37')]=function(_0x298ff0){var _0x58a826=this[_0x6cae('0x26')][_0x298ff0[_0x6cae('0xde')]];var _0x11de65;if(!_[_0x6cae('0xad')](_0x298ff0)&&!_[_0x6cae('0xad')](_0x298ff0[_0x6cae('0xdf')])&&!_[_0x6cae('0xad')](_0x298ff0[_0x6cae('0xdf')][_0x6cae('0xe0')])&&_0x298ff0[_0x6cae('0xe1')]===_0x6cae('0xe2')&&_0x58a826){if(_0x58a826[_0x6cae('0x4c')]!==_0x6cae('0x7b')&&this['voiceQueues'][_0x58a826['queue']]['dialAMDActive']&&_0x298ff0['value']===_0x6cae('0xe3')){delete this[_0x6cae('0x26')][_0x298ff0[_0x6cae('0xde')]];this[_0x6cae('0xb1')](this[_0x6cae('0x21')][_0x58a826['queue']]);this[_0x6cae('0x21')][_0x58a826[_0x6cae('0xb2')]][_0x6cae('0x5e')]+=0x1;this['voiceQueues'][_0x58a826[_0x6cae('0xb2')]]['outboundAnswerAgiCallsDay']+=0x1;_0x11de65=new Hangup(_0x58a826,_0x298ff0);_0x11de65['state']=0x12;_0x11de65['statedesc']='HangupInAMD';_0x11de65[_0x6cae('0xe4')]='AMD';this[_0x6cae('0xd0')](_0x11de65,'[syncHangupInAMD][createHistory]',_0x6cae('0xe5'));}if(_0x58a826['type']!==_0x6cae('0x7b')&&this[_0x6cae('0x21')][_0x58a826[_0x6cae('0xb2')]][_0x6cae('0xe6')]&&_0x298ff0[_0x6cae('0xe7')]===_0x6cae('0xe8')){var _0x12bf97=this;return new BPromise(function(_0x5e2879,_0xa3bbca){delete _0x12bf97['uniqueId'][_0x298ff0[_0x6cae('0xde')]];_0x12bf97[_0x6cae('0xb1')](_0x12bf97[_0x6cae('0x21')][_0x58a826[_0x6cae('0xb2')]]);_0x12bf97[_0x6cae('0x21')][_0x58a826[_0x6cae('0xb2')]]['outboundAnswerCallsDay']+=0x1;_0x12bf97[_0x6cae('0x21')][_0x58a826[_0x6cae('0xb2')]][_0x6cae('0x5d')]+=0x1;var _0x901d3=_0x12bf97[_0x6cae('0x21')][_0x58a826[_0x6cae('0xb2')]];var _0x1814ba=new Hangup(_0x58a826,_0x298ff0);_0x1814ba['state']=0x13;_0x1814ba[_0x6cae('0xe9')]=_0x6cae('0xea');_0x1814ba[_0x6cae('0xe4')]=_0x6cae('0xeb');_0x1814ba['countmachineretry']+=0x1;_0x1814ba[_0x6cae('0xec')]+=0x1;_0x1814ba[_0x6cae('0xed')]=!![];_0x12bf97['createHistory'](_0x1814ba)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0xee')));if(_0x1814ba['countbusyretry']+_0x1814ba[_0x6cae('0xef')]+_0x1814ba[_0x6cae('0xf0')]+_0x1814ba[_0x6cae('0xf1')]+_0x1814ba[_0x6cae('0xf2')]+_0x1814ba[_0x6cae('0xf3')]+_0x1814ba[_0x6cae('0xf4')]+_0x1814ba[_0x6cae('0xf5')]>=_0x901d3['dialGlobalMaxRetry']){_0x12bf97[_0x6cae('0xf6')](_0x1814ba,_0x5e2879,_0xa3bbca,_0x6cae('0xf7'));}else{if(_0x1814ba['countmachineretry']>=_0x901d3[_0x6cae('0xf8')]){_0x12bf97['createStateFinal'](_0x1814ba,_0x5e2879,_0xa3bbca,_0x6cae('0xf9'));}else{_0x12bf97[_0x6cae('0xbe')]({'active':![],'countmachineretry':_0x1814ba[_0x6cae('0xf4')],'scheduledat':moment()[_0x6cae('0xfa')](_0x901d3[_0x6cae('0xfb')],'minutes')[_0x6cae('0x79')](_0x6cae('0xfc')),'ContactId':_0x1814ba['ContactId'],'ListId':_0x1814ba['ListId'],'VoiceQueueId':_0x1814ba[_0x6cae('0xd5')]||undefined,'CampaignId':_0x1814ba[_0x6cae('0xfd')]||undefined})[_0x6cae('0xb9')](loggerCatch(_0x6cae('0xfe')));_0x5e2879({'reschedule':0x1});}}});}if(_0x58a826[_0x6cae('0x4c')]===_0x6cae('0x7b')&&this['campaigns'][_0x58a826[_0x6cae('0xb2')]][_0x6cae('0xe6')]&&_0x298ff0[_0x6cae('0xe7')]===_0x6cae('0xe3')){delete this[_0x6cae('0x26')][_0x298ff0[_0x6cae('0xde')]];this[_0x6cae('0xb1')](this[_0x6cae('0x22')][_0x58a826[_0x6cae('0xb2')]]);_0x11de65=new Hangup(_0x58a826,_0x298ff0);_0x11de65['state']=0x12;_0x11de65[_0x6cae('0xe9')]='HangupInAMD';_0x11de65['membername']=_0x6cae('0xeb');this[_0x6cae('0xd0')](_0x11de65,'[syncHangupInAMDIvr][createHistory]',_0x6cae('0xff'));}if(_0x58a826[_0x6cae('0x4c')]===_0x6cae('0x7b')&&this['campaigns'][_0x58a826[_0x6cae('0xb2')]]['dialAMDActive']&&_0x298ff0[_0x6cae('0xe7')]===_0x6cae('0xe8')){var _0x12bf97=this;return new BPromise(function(_0x4ba228,_0x1fdcbc){delete _0x12bf97['uniqueId'][_0x298ff0[_0x6cae('0xde')]];_0x12bf97[_0x6cae('0xb1')](_0x12bf97[_0x6cae('0x22')][_0x58a826['queue']]);_0x12bf97[_0x6cae('0x22')][_0x58a826[_0x6cae('0xb2')]][_0x6cae('0x5e')]+=0x1;_0x12bf97[_0x6cae('0x22')][_0x58a826['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x5e46ff=_0x12bf97[_0x6cae('0x22')][_0x58a826['queue']];var _0x5553f6=new Hangup(_0x58a826,_0x298ff0);_0x5553f6[_0x6cae('0x100')]=0x13;_0x5553f6[_0x6cae('0xe9')]=_0x6cae('0xea');_0x5553f6[_0x6cae('0xe4')]=_0x6cae('0xeb');_0x5553f6['countmachineretry']+=0x1;_0x5553f6[_0x6cae('0xec')]+=0x1;_0x5553f6['amd']=!![];_0x12bf97['createHistory'](_0x5553f6)['catch'](loggerCatch(_0x6cae('0xee')));if(_0x5553f6[_0x6cae('0x101')]+_0x5553f6['countcongestionretry']+_0x5553f6[_0x6cae('0xf0')]+_0x5553f6['countnosuchnumberretry']+_0x5553f6['countdropretry']+_0x5553f6[_0x6cae('0xf3')]+_0x5553f6['countmachineretry']+_0x5553f6[_0x6cae('0xf5')]>=_0x5e46ff[_0x6cae('0x102')]){_0x12bf97[_0x6cae('0xf6')](_0x5553f6,_0x4ba228,_0x1fdcbc,_0x6cae('0xf7'));}else{if(_0x5553f6[_0x6cae('0xf4')]>=_0x5e46ff['dialMachineMaxRetry']){_0x12bf97[_0x6cae('0x103')](_0x5553f6,_0x4ba228,_0x1fdcbc,'reason\x2019\x20machine....');}else{_0x12bf97[_0x6cae('0xbe')]({'active':![],'countmachineretry':_0x5553f6[_0x6cae('0xf4')],'scheduledat':moment()[_0x6cae('0xfa')](_0x5e46ff['dialMachineRetryFrequency'],_0x6cae('0x104'))[_0x6cae('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5553f6[_0x6cae('0xd2')],'ListId':_0x5553f6['ListId'],'VoiceQueueId':_0x5553f6[_0x6cae('0xd5')]||undefined,'CampaignId':_0x5553f6[_0x6cae('0xfd')]||undefined})[_0x6cae('0xb9')](loggerCatch(_0x6cae('0xfe')));_0x4ba228({'reschedule':0x1});}}});}}};Dialer[_0x6cae('0x1d')][_0x6cae('0x34')]=function(_0x3e5472){var _0x4175a1=this[_0x6cae('0x26')][_0x3e5472[_0x6cae('0xde')]];var _0x5603ba=this;var _0xd6b15b;if(_0x4175a1&&_0x4175a1['type']===_0x6cae('0x7b')){delete this['uniqueId'][_0x3e5472[_0x6cae('0xde')]];this[_0x6cae('0xb1')](this[_0x6cae('0x22')][_0x4175a1['queue']]);this['campaigns'][_0x4175a1[_0x6cae('0xb2')]][_0x6cae('0x105')]+=0x1;_0xd6b15b=new Hangup(_0x4175a1,_0x3e5472);this['createHistory'](_0xd6b15b)['catch'](loggerCatch(_0x6cae('0x106')));this[_0x6cae('0xc7')](_0xd6b15b)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x107')));}if(_0x4175a1&&_0x4175a1[_0x6cae('0x4c')]!==_0x6cae('0x7b')&&isNotNull(this[_0x6cae('0x21')][_0x4175a1['queue']][_0x6cae('0x108')])){delete this[_0x6cae('0x26')][_0x3e5472[_0x6cae('0xde')]];this[_0x6cae('0xb1')](this[_0x6cae('0x21')][_0x4175a1[_0x6cae('0xb2')]]);this[_0x6cae('0x21')][_0x4175a1[_0x6cae('0xb2')]]['outboundAnswerCallsDay']+=0x1;this[_0x6cae('0x21')][_0x4175a1[_0x6cae('0xb2')]][_0x6cae('0x5d')]+=0x1;_0xd6b15b=new Hangup(_0x4175a1,_0x3e5472);_0xd6b15b[_0x6cae('0x100')]=0x10;_0xd6b15b[_0x6cae('0xe9')]=_0x6cae('0x109');_0xd6b15b['membername']=_0x6cae('0x10a');this['createHistory'](_0xd6b15b)['catch'](loggerCatch(_0x6cae('0x106')));this['moveContactManagedDialer'](_0xd6b15b)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x107')));}if(_0x4175a1&&_0x4175a1['type']!=='ivr'&&!isNotNull(this['voiceQueues'][_0x4175a1['queue']][_0x6cae('0x108')])){delete this['uniqueId'][_0x3e5472[_0x6cae('0xde')]];this[_0x6cae('0xb1')](this[_0x6cae('0x21')][_0x4175a1[_0x6cae('0xb2')]]);this['voiceQueues'][_0x4175a1[_0x6cae('0xb2')]][_0x6cae('0x68')]+=0x1;_0xd6b15b=new Hangup(_0x4175a1,_0x3e5472);_0xd6b15b[_0x6cae('0x100')]=0xc;_0xd6b15b[_0x6cae('0xe9')]=_0x3e5472['cause-txt'];_0xd6b15b[_0x6cae('0xe4')]=_0x6cae('0x10b');this[_0x6cae('0xc9')](_0xd6b15b)['catch'](loggerCatch(_0x6cae('0x106')));this['moveContactManagedDialer'](_0xd6b15b)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x107')));}};Dialer[_0x6cae('0x1d')][_0x6cae('0x32')]=function(_0x29b0fa){var _0x4416b1=this[_0x6cae('0x26')][_0x29b0fa[_0x6cae('0xde')]];var _0x2f0c1c=this;if(this[_0x6cae('0x21')][_0x29b0fa['queue']]){if(_0x4416b1&&_0x4416b1[_0x6cae('0x4c')]!==_0x6cae('0x7b')){delete this[_0x6cae('0x26')][_0x29b0fa[_0x6cae('0xde')]];this[_0x6cae('0x21')][_0x29b0fa[_0x6cae('0xb2')]][_0x6cae('0x5e')]+=0x1;var _0x462442=new AgentComplete(_0x4416b1,_0x29b0fa);if(_0x29b0fa['reason']===_0x6cae('0x10c')){_0x462442[_0x6cae('0x10d')]=this[_0x6cae('0x21')][_0x29b0fa[_0x6cae('0xb2')]][_0x6cae('0x10e')]&&this[_0x6cae('0x21')][_0x29b0fa[_0x6cae('0xb2')]][_0x6cae('0x10f')]?moment()[_0x6cae('0x79')](_0x6cae('0xfc')):undefined;}this[_0x6cae('0xc9')](_0x462442)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x110')));this[_0x6cae('0xc7')](_0x462442)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x111')));}}};Dialer[_0x6cae('0x1d')][_0x6cae('0x2e')]=function(_0x45c63a){if(this[_0x6cae('0x21')][_0x45c63a['queue']]){if(this[_0x6cae('0x26')][_0x45c63a[_0x6cae('0xde')]]&&this['uniqueId'][_0x45c63a['uniqueid']][_0x6cae('0x4c')]!==_0x6cae('0x7b')){this[_0x6cae('0xb1')](this[_0x6cae('0x21')][_0x45c63a[_0x6cae('0xb2')]]);this['uniqueId'][_0x45c63a[_0x6cae('0xde')]][_0x6cae('0x112')]=moment()[_0x6cae('0x79')](_0x6cae('0xfc'));}}};Dialer['prototype'][_0x6cae('0x113')]=function(_0x5138d4){this['createHistory'](_0x5138d4)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x110')));this[_0x6cae('0xc7')](_0x5138d4)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x114')));};Dialer[_0x6cae('0x1d')][_0x6cae('0x115')]=function(_0x3a789c){var _0x385157=this[_0x6cae('0x26')][_0x3a789c[_0x6cae('0xde')]];var _0x9146d3=this;if(this[_0x6cae('0x21')][_0x3a789c[_0x6cae('0xb2')]]){if(_0x385157&&_0x385157[_0x6cae('0x4c')]!==_0x6cae('0x7b')){delete this[_0x6cae('0x26')][_0x3a789c[_0x6cae('0xde')]];this['updateOriginated'](this[_0x6cae('0x21')][_0x3a789c[_0x6cae('0xb2')]]);_0x385157['droptime']=moment()[_0x6cae('0x79')](_0x6cae('0xfc'));var _0xb7557=new QueueCallerAbandon(_0x385157,_0x3a789c);if(getSeconds(_0x385157['droptime'],_0x385157[_0x6cae('0x116')])>=_0x385157[_0x6cae('0x117')]){this[_0x6cae('0x21')][_0x3a789c['queue']][_0x6cae('0x6c')]+=0x1;this[_0x6cae('0x21')][_0x3a789c[_0x6cae('0xb2')]][_0x6cae('0x118')]+=0x1;this[_0x6cae('0x21')][_0x3a789c['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0xb7557[_0x6cae('0x100')]=0xa;_0xb7557['statedesc']=_0x6cae('0x119');_0xb7557[_0x6cae('0x11a')]=_0x6cae('0x11b');_0xb7557['agiafterat']=this[_0x6cae('0x21')][_0x3a789c[_0x6cae('0xb2')]][_0x6cae('0x10e')]?moment()['format'](_0x6cae('0xfc')):undefined;_0xb7557['countdropretry']+=0x1;_0xb7557[_0x6cae('0xec')]+=0x1;if(_0xb7557[_0x6cae('0xf2')]>=this[_0x6cae('0x21')][_0x3a789c['queue']][_0x6cae('0x11c')]){this['queueCallerAbandonCreateState'](_0xb7557);}else{this[_0x6cae('0xbe')]({'active':![],'countdropretry':_0xb7557[_0x6cae('0xf2')],'scheduledat':moment()[_0x6cae('0xfa')](this[_0x6cae('0x21')][_0x3a789c[_0x6cae('0xb2')]]['dialDropRetryFrequency'],_0x6cae('0x104'))[_0x6cae('0x79')](_0x6cae('0xfc')),'ContactId':_0x385157[_0x6cae('0xd2')],'ListId':_0x385157[_0x6cae('0xd3')],'VoiceQueueId':_0x385157[_0x6cae('0xd5')]||undefined,'CampaignId':_0x385157[_0x6cae('0xfd')]||undefined})[_0x6cae('0xb9')](loggerCatch('[rescheduleContact][Drop]'));var _0x4a779d=new History(_0xb7557);_0x4a779d[_0x6cae('0x100')]=0xa;_0x4a779d['statedesc']=_0x6cae('0x119');_0x4a779d[_0x6cae('0xa6')]=moment()['format'](_0x6cae('0xfc'));_0x4a779d[_0x6cae('0xa5')]=_0x4a779d[_0x6cae('0xa6')];_0x4a779d[_0x6cae('0x11d')]=_0xb7557[_0x6cae('0x11d')];_0x4a779d['calleridnum']=_0xb7557[_0x6cae('0x11e')];this[_0x6cae('0xc9')](_0x4a779d)['catch'](loggerCatch(_0x6cae('0x11f')));}}else{this[_0x6cae('0x21')][_0x3a789c[_0x6cae('0xb2')]][_0x6cae('0x6b')]+=0x1;this[_0x6cae('0x21')][_0x3a789c['queue']][_0x6cae('0x63')]+=0x1;_0xb7557['state']=0xb;_0xb7557[_0x6cae('0xe9')]=_0x6cae('0x120');_0xb7557['dropreason']='CALLEREXIT';_0xb7557['countabandonedretry']+=0x1;_0xb7557[_0x6cae('0xec')]+=0x1;if(_0xb7557[_0x6cae('0xf3')]>=this[_0x6cae('0x21')][_0x3a789c[_0x6cae('0xb2')]][_0x6cae('0x121')]){this[_0x6cae('0x113')](_0xb7557);}else{this[_0x6cae('0xbe')]({'active':![],'countabandonedretry':_0xb7557['countabandonedretry'],'scheduledat':moment()[_0x6cae('0xfa')](this[_0x6cae('0x21')][_0x3a789c[_0x6cae('0xb2')]][_0x6cae('0x122')],'minutes')[_0x6cae('0x79')](_0x6cae('0xfc')),'ContactId':_0x385157[_0x6cae('0xd2')],'ListId':_0x385157['ListId'],'VoiceQueueId':_0x385157[_0x6cae('0xd5')]||undefined,'CampaignId':_0x385157[_0x6cae('0xfd')]||undefined})[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x123')));var _0x4a779d=new History(_0xb7557);_0x4a779d[_0x6cae('0x100')]=0xb;_0x4a779d[_0x6cae('0xe9')]=_0x6cae('0x120');_0x4a779d[_0x6cae('0xa6')]=moment()[_0x6cae('0x79')](_0x6cae('0xfc'));_0x4a779d['endtime']=_0x4a779d[_0x6cae('0xa6')];_0x4a779d[_0x6cae('0x11d')]=_0xb7557['calleridname'];_0x4a779d[_0x6cae('0x11e')]=_0xb7557['calleridnum'];this['createHistory'](_0x4a779d)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x124')));}}}}};Dialer[_0x6cae('0x1d')][_0x6cae('0x35')]=function(_0xf16465){if(this[_0x6cae('0xaa')][_0xf16465[_0x6cae('0xde')]]){this[_0x6cae('0xaa')][_0xf16465[_0x6cae('0xde')]][_0x6cae('0xaf')]=_0xf16465[_0x6cae('0xaf')];}if(this[_0x6cae('0x26')][_0xf16465[_0x6cae('0xde')]]){this[_0x6cae('0x26')][_0xf16465[_0x6cae('0xde')]][_0x6cae('0xaf')]=_0xf16465[_0x6cae('0xaf')];}};Dialer[_0x6cae('0x1d')][_0x6cae('0x39')]=function(_0x4cf257){if(strategy[this[_0x6cae('0x21')][this[_0x6cae('0xaa')][_0x4cf257[_0x6cae('0x125')]][_0x6cae('0xb2')]][_0x6cae('0x4e')]]===_0x6cae('0x1c')){if(this[_0x6cae('0xaa')][_0x4cf257['actionid']]&&_[_0x6cae('0xad')](this['actions'][_0x4cf257[_0x6cae('0x125')]]['locked'])&&_0x4cf257[_0x6cae('0xdb')]==='1'&&_0x4cf257[_0x6cae('0x126')]==='0'){if(this[_0x6cae('0x23')][_0x4cf257[_0x6cae('0x127')]]){if(!this[_0x6cae('0x23')][_0x4cf257[_0x6cae('0x127')]][_0x6cae('0x128')]){this['agents'][_0x4cf257[_0x6cae('0x127')]][_0x6cae('0x128')]=!![];this[_0x6cae('0xaa')][_0x4cf257[_0x6cae('0x125')]][_0x6cae('0x128')]=!![];this[_0x6cae('0xaa')][_0x4cf257[_0x6cae('0x125')]][_0x6cae('0x127')]=_0x4cf257[_0x6cae('0x127')];}}}}else if((strategy[this[_0x6cae('0x21')][this['actions'][_0x4cf257[_0x6cae('0x125')]][_0x6cae('0xb2')]][_0x6cae('0x4e')]]||_0x6cae('0x1b'))===_0x6cae('0x1b')){if(this[_0x6cae('0xaa')][_0x4cf257['actionid']]){if(this['agents'][_0x4cf257[_0x6cae('0x127')]]){this[_0x6cae('0xaa')][_0x4cf257[_0x6cae('0x125')]]['stateinterface']=_0x4cf257[_0x6cae('0x127')];if(_[_0x6cae('0xad')](this[_0x6cae('0x2b')][this[_0x6cae('0xaa')][_0x4cf257[_0x6cae('0x125')]][_0x6cae('0xb2')]])){this[_0x6cae('0x2b')][this['actions'][_0x4cf257[_0x6cae('0x125')]][_0x6cae('0xb2')]]=[];}this[_0x6cae('0x2b')][this[_0x6cae('0xaa')][_0x4cf257[_0x6cae('0x125')]][_0x6cae('0xb2')]][_0x6cae('0x129')](_[_0x6cae('0x8e')](_['pick'](this[_0x6cae('0xaa')][_0x4cf257['actionid']],[_0x6cae('0x12a'),'stateinterface']),{'status':_0x4cf257['status'],'paused':_0x4cf257[_0x6cae('0x126')]}));}}}};function unlockQueueStatus(_0xcc14ee,_0x195d43){setTimeout(function(){if(_[_0x6cae('0x3d')](_0xcc14ee[_0x6cae('0x12b')])){loggerBooked[_0x6cae('0x95')]('[unlockQueueStatus][undefined]',_0x195d43);}_0xcc14ee['queueStatusComplete']=!![];loggerBooked[_0x6cae('0x7e')](_0x6cae('0x12c'),_0x195d43,JSON[_0x6cae('0x78')](_[_0x6cae('0xd1')](_0xcc14ee,[_0x6cae('0x3f'),_0x6cae('0x12b')])));},0x1f3);}Dialer[_0x6cae('0x1d')][_0x6cae('0x3b')]=function(_0x1301f9){var _0x1973dc=this;var _0x31a78a=_0x1973dc[_0x6cae('0x21')][_0x1973dc[_0x6cae('0xaa')][_0x1301f9[_0x6cae('0x125')]][_0x6cae('0xb2')]];if(strategy[this[_0x6cae('0x21')][this['actions'][_0x1301f9['actionid']]['queue']][_0x6cae('0x4e')]]==='roundrobin'){if(this[_0x6cae('0xaa')][_0x1301f9[_0x6cae('0x125')]]&&this['actions'][_0x1301f9[_0x6cae('0x125')]][_0x6cae('0x127')]){this[_0x6cae('0x20')][_0x6cae('0x12d')](this[_0x6cae('0xaa')][_0x1301f9[_0x6cae('0x125')]]['idHopper'],this['actions'][_0x1301f9[_0x6cae('0x125')]][_0x6cae('0x127')])['catch'](function(_0x423f2d){logger['error'](_0x6cae('0x12e'),util['inspect'](_0x423f2d,{'showHidden':![],'depth':null}));})[_0x6cae('0x1f')](function(){_0x1973dc[_0x6cae('0xb1')](_0x1973dc[_0x6cae('0x21')][_0x1973dc[_0x6cae('0xaa')][_0x1301f9[_0x6cae('0x125')]][_0x6cae('0xb2')]]);_0x1973dc['agents'][_0x1973dc[_0x6cae('0xaa')][_0x1301f9[_0x6cae('0x125')]][_0x6cae('0x127')]]['locked']=![];delete _0x1973dc[_0x6cae('0xaa')][_0x1301f9['actionid']];unlockQueueStatus(_0x31a78a);});}else{this[_0x6cae('0xb1')](this['voiceQueues'][this[_0x6cae('0xaa')][_0x1301f9['actionid']][_0x6cae('0xb2')]]);this[_0x6cae('0xbe')]({'active':![],'ContactId':this[_0x6cae('0xaa')][_0x1301f9['actionid']][_0x6cae('0xd2')],'ListId':this[_0x6cae('0xaa')][_0x1301f9['actionid']]['ListId'],'VoiceQueueId':this[_0x6cae('0xaa')][_0x1301f9['actionid']][_0x6cae('0xd5')]||undefined,'CampaignId':this['actions'][_0x1301f9['actionid']][_0x6cae('0xfd')]||undefined})[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x12f')));delete this[_0x6cae('0xaa')][_0x1301f9[_0x6cae('0x125')]];unlockQueueStatus(_0x31a78a);}}else if((strategy[this[_0x6cae('0x21')][this['actions'][_0x1301f9[_0x6cae('0x125')]][_0x6cae('0xb2')]][_0x6cae('0x4e')]]||'rrmemory')==='rrmemory'){var _0xed72b4;if(this[_0x6cae('0xaa')][_0x1301f9[_0x6cae('0x125')]]&&!_[_0x6cae('0x45')](this[_0x6cae('0x2b')][this['actions'][_0x1301f9[_0x6cae('0x125')]][_0x6cae('0xb2')]])){if(this[_0x6cae('0x2c')][_0x1973dc['actions'][_0x1301f9['actionid']][_0x6cae('0xb2')]]){this[_0x6cae('0x2c')][_0x1973dc[_0x6cae('0xaa')][_0x1301f9['actionid']][_0x6cae('0xb2')]]=this[_0x6cae('0x2c')][this[_0x6cae('0xaa')][_0x1301f9[_0x6cae('0x125')]][_0x6cae('0xb2')]]?this[_0x6cae('0x2c')][this['actions'][_0x1301f9['actionid']][_0x6cae('0xb2')]]:this['queueBooked'][this[_0x6cae('0xaa')][_0x1301f9[_0x6cae('0x125')]]['queue']]?this[_0x6cae('0x2b')][this[_0x6cae('0xaa')][_0x1301f9[_0x6cae('0x125')]]['queue']][_0x6cae('0x130')]||0x0:0x0;}this[_0x6cae('0x2b')][this[_0x6cae('0xaa')][_0x1301f9[_0x6cae('0x125')]][_0x6cae('0xb2')]][_0x6cae('0x130')]=this['queueBookedRR'][this[_0x6cae('0xaa')][_0x1301f9[_0x6cae('0x125')]][_0x6cae('0xb2')]];for(var _0x38e452=0x0;_0x38e452=0x0;})[_0x6cae('0xb9')](myreject(_0x1afa4a)));}}else{_0x48d1f9[_0x6cae('0x129')](ami['Action']({'action':'command','command':util[_0x6cae('0x79')](_0x6cae('0x14a'),_0x1c6475,!_['isUndefined'](config[_0x6cae('0x142')][_0x2702d4])?_0x2702d4:'')})[_0x6cae('0xb7')](function(_0x1199f1){return _0x1199f1[_0x6cae('0x147')][_0x6cae('0x148')]('true')>=0x0;})[_0x6cae('0xb9')](myreject(_0x1afa4a)));}BPromise[_0x6cae('0x14b')](_0x48d1f9)[_0x6cae('0xb7')](function(_0x10de09){var _0x5e80d9=_[_0x6cae('0x14c')](_0x10de09);if(_0x5e80d9){return _0x2d22cc(_0x5e80d9);}else{_0x59289d['message']=_0x4bd25c?_0x6cae('0x14d'):_0x6cae('0x14e');return _0x1afa4a(msgResponse(_0x6cae('0x14f'),_0x6cae('0x13f'),_0x6cae('0x150')+_0x4bd25c+'\x20'+_0x5db3b7+_0x6cae('0x151')+util[_0x6cae('0x94')](_0x1c6475,{'showHidden':![],'depth':null})+_0x6cae('0x152')+_0x2702d4));}})[_0x6cae('0xb9')](function(_0x5e5c29){return _0x1afa4a(msgResponse('ifTime',_0x6cae('0x13f'),JSON['stringify'](_0x5e5c29)));});});};Dialer['prototype']['checkDialMethod']=function(_0x59892c){var _0x29b3e9=this;return function(){switch(_0x59892c[_0x6cae('0x59')]){case'progressive':freeVariablesPredictive(_0x59892c);_0x29b3e9[_0x6cae('0x153')](_0x59892c,0x1);break;case'power':freeVariablesPredictive(_0x59892c);_0x29b3e9[_0x6cae('0x153')](_0x59892c,_0x59892c[_0x6cae('0x154')]);break;case _0x6cae('0x8'):_0x29b3e9[_0x6cae('0x8')](_0x59892c);break;case _0x6cae('0x7'):freeVariablesPredictive(_0x59892c);_0x29b3e9['handlePower'](_0x59892c,0x1);break;default:freeVariablesPredictive(_0x59892c);logger[_0x6cae('0x95')](_0x6cae('0x155'),_0x59892c[_0x6cae('0x3f')],_0x6cae('0x156'));}};};Dialer[_0x6cae('0x1d')][_0x6cae('0x157')]=function(_0x315f82){var _0x34713f=this;return function(){_0x34713f[_0x6cae('0x158')](_0x315f82);};};Dialer['prototype'][_0x6cae('0xa')]=function(_0x98f098){var _0x15b0ed=this;if(isNotPreview(_0x98f098[_0x6cae('0x59')])){if(isVoiceQueueOutbound(_0x98f098['type'])&&isActive(_0x98f098[_0x6cae('0x58')])){_0x98f098[_0x6cae('0xa0')]=!![];BPromise[_0x6cae('0xb6')]()[_0x6cae('0xb7')](checkIsLoggedIn(_0x98f098,_0x98f098[_0x6cae('0x50')]))[_0x6cae('0xb7')](checkIsActive(_0x98f098,_0x98f098['dialActive']))[_0x6cae('0xb7')](checkInterval(_0x98f098))['then'](_0x15b0ed[_0x6cae('0x139')](_0x98f098))[_0x6cae('0xb7')](_0x15b0ed['checkIfTime'](_0x98f098['dialGlobalInterval'],_0x98f098[_0x6cae('0x159')],_0x98f098[_0x6cae('0x3f')],_0x98f098))['then'](_0x15b0ed['checkIfTimeIntervals'](_0x98f098['Interval'],_0x98f098['dialTimezone'],_0x98f098[_0x6cae('0x3f')],_0x98f098))[_0x6cae('0xb7')](_0x15b0ed[_0x6cae('0x15a')](_0x98f098))[_0x6cae('0xb9')](loggerCatchQueueSummary(_0x6cae('0x15b'),_0x98f098));}else{notSendMessagesQueue(_0x98f098);}}else{freeVariablesPredictive(_0x98f098);}};Dialer['prototype'][_0x6cae('0x15c')]=function(){var _0x5c7d99=this;var _0x5190c7;for(var _0x535b69 in this[_0x6cae('0x22')]){if(typeof this[_0x6cae('0x22')][_0x535b69]!=='undefined'){_0x5190c7=this['campaigns'][_0x535b69];if(isCampaignIvr(_0x5190c7[_0x6cae('0x4c')])&&isActive(_0x5190c7[_0x6cae('0x76')])){_0x5190c7[_0x6cae('0xa0')]=!![];BPromise[_0x6cae('0xb6')]()['then'](checkIsActive(_0x5190c7,_0x5190c7[_0x6cae('0x76')]))['then'](checkInterval(_0x5190c7))[_0x6cae('0xb7')](_0x5c7d99[_0x6cae('0x139')](_0x5190c7))[_0x6cae('0xb7')](_0x5c7d99[_0x6cae('0x13c')](_0x5190c7[_0x6cae('0x15d')],_0x5190c7[_0x6cae('0x159')],_0x5190c7['name'],_0x5190c7))[_0x6cae('0xb7')](_0x5c7d99['checkIfTimeIntervals'](_0x5190c7[_0x6cae('0x42')],_0x5190c7['dialTimezone'],_0x5190c7[_0x6cae('0x3f')],_0x5190c7))[_0x6cae('0xb7')](_0x5c7d99[_0x6cae('0x157')](_0x5190c7))[_0x6cae('0xb9')](loggerCatchQueueSummary(_0x6cae('0x15e'),_0x5190c7));}else{notSendMessagesCampaign(_0x5190c7);}}}};function getCallerIdRandom(_0x1802af,_0xc0648b){var _0x78f044;var _0x39c3c1;var _0x1313a5;if(_0xc0648b<=0x0){_0xc0648b=0x1;}_0x78f044=new RegExp(_0x6cae('0x15f')+_0xc0648b+'}$');_0x39c3c1=Math[_0x6cae('0x160')](0xa,_0xc0648b-0x1);_0x1313a5=Math[_0x6cae('0x160')](0xa,_0xc0648b)-0x1;return util['format']('%s',_['replace'](_0x1802af,_0x78f044,_[_0x6cae('0x161')](_0x39c3c1,_0x1313a5)));}function extractCalleridName(_0x57817d){var _0x2102ec=_0x57817d[_0x6cae('0x162')](/"(.*?)"/);return _0x2102ec?_0x2102ec[0x1]:_0x57817d;}function extractCalleridNumber(_0x21b98e){var _0x5a09ca=_0x21b98e[_0x6cae('0x162')](/<(.*?)>/);return _0x5a09ca?_0x5a09ca[0x1]:_0x21b98e;}Dialer[_0x6cae('0x1d')]['actionOriginate']=function(_0x201e6,_0x2abbc3){var _0x14424a=this;var _0x1cc3ac=uuid['v4']();this[_0x6cae('0xaa')][_0x1cc3ac]=new Action(_0x201e6,_0x2abbc3,_0x1cc3ac);return new BPromise(function(_0x43d4ca,_0x505685){if(_[_0x6cae('0x3d')](_0x201e6)&&typeof _0x201e6!==_0x6cae('0x163')){return _0x505685(msgResponse(_0x6cae('0x164'),_0x6cae('0x13f'),'voiceQueue\x20is\x20undefine'));}if(_[_0x6cae('0x3d')](_0x2abbc3['Contact'][_0x6cae('0x165')])||_0x2abbc3['Contact'][_0x6cae('0x165')]===null){return _0x505685(msgResponse(_0x6cae('0x164'),'Failure',_0x6cae('0x166')));}var _0x20b513={'XMD-CALLERID':_0x14424a[_0x6cae('0xaa')][_0x1cc3ac][_0x6cae('0x167')](),'XMD-AGI':_0x201e6[_0x6cae('0x108')]?util[_0x6cae('0x79')](_0x6cae('0x168'),ipAgi,_0x201e6[_0x6cae('0x108')]):_0x6cae('0x169'),'XMD-AGIAFTER':_0x201e6['dialQueueProject2']?util[_0x6cae('0x79')]('\x22agi://%s/square,%s\x22',ipAgi,_0x201e6['dialQueueProject2']):_0x6cae('0x169'),'XMD-QUEUE':_0x201e6['type']==='outbound'?util['format'](_0x6cae('0x16a'),_0x201e6[_0x6cae('0x3f')],_0x201e6['dialQueueOptions']||'',_0x201e6[_0x6cae('0x10f')]?'c':'',_0x201e6[_0x6cae('0x117')]||0x3):'NONE','XMD-CONTACTID':_0x2abbc3[_0x6cae('0xd2')],'XMD-CDRTYPE':_0x6cae('0x6'),'CALLERID(all)':_0x14424a[_0x6cae('0xaa')][_0x1cc3ac][_0x6cae('0x167')](),'XMD-AMD':_0x201e6[_0x6cae('0xe6')]?_0x6cae('0x16b'):_0x6cae('0x169'),'XMD-DESTINATION':_0x6cae('0xe2')};if(_0x201e6[_0x6cae('0xe6')]){_0x20b513[_0x6cae('0x16c')]=_0x201e6[_0x6cae('0x16d')]||0x9c4;_0x20b513[_0x6cae('0x16e')]=_0x201e6['dialAMDGreeting']||0x5dc;_0x20b513[_0x6cae('0x16f')]=_0x201e6[_0x6cae('0x170')]||0x320;_0x20b513[_0x6cae('0x171')]=_0x201e6[_0x6cae('0x172')]||0x1388;_0x20b513[_0x6cae('0x173')]=_0x201e6['dialAMDMinWordLength']||0x64;_0x20b513[_0x6cae('0x174')]=_0x201e6['dialAMDBetweenWordsSilence']||0x32;_0x20b513[_0x6cae('0x175')]=_0x201e6[_0x6cae('0x176')]||0x3;_0x20b513[_0x6cae('0x177')]=_0x201e6[_0x6cae('0x178')]||0x100;_0x20b513['XMD-AMDMAXIMUMWORDLENGTH']=_0x201e6[_0x6cae('0x179')]||0x1388;}if(_0x201e6[_0x6cae('0x4c')]===_0x6cae('0x4d')){_0x20b513[_0x6cae('0x17a')]=_0x2abbc3[_0x6cae('0xd5')];}else{_0x20b513[_0x6cae('0x17b')]=_0x2abbc3[_0x6cae('0xfd')];}for(var _0x41255b in _0x2abbc3[_0x6cae('0x17c')]){if(typeof _0x2abbc3[_0x6cae('0x17c')][_0x41255b]!==_0x6cae('0x99')){if(isNotNull(_0x2abbc3[_0x6cae('0x17c')][_0x41255b])&&_0x41255b!=='id'&&_0x41255b!==_0x6cae('0x17d')&&_0x41255b!==_0x6cae('0x17e')&&_0x41255b!=='updatedAt'){_0x20b513[util[_0x6cae('0x79')]('%s%s',_0x6cae('0x17f'),_[_0x6cae('0x180')](_0x41255b))]=_0x2abbc3['Contact'][_0x41255b];}}}var _0x402fa8=_0x14424a[_0x6cae('0xda')](_0x201e6[_0x6cae('0x75')])?getCallerId(_0x201e6[_0x6cae('0x75')][_0x6cae('0x77')],_0x201e6[_0x6cae('0x181')],_0x201e6[_0x6cae('0x182')]>0x0?getCallerIdRandom(_0x201e6['dialOriginateCallerIdNumber'],_0x201e6[_0x6cae('0x182')]):_0x201e6['dialOriginateCallerIdNumber']):getCallerId(_[_0x6cae('0xad')](_0x201e6[_0x6cae('0x13a')])?_0x201e6[_0x6cae('0x75')][_0x6cae('0x77')]:_0x201e6[_0x6cae('0x13a')]['callerid'],_0x201e6['dialOriginateCallerIdName'],_0x201e6[_0x6cae('0x182')]>0x0?getCallerIdRandom(_0x201e6[_0x6cae('0x5a')],_0x201e6[_0x6cae('0x182')]):_0x201e6['dialOriginateCallerIdNumber']);if(_0x402fa8){_0x20b513[_0x6cae('0x183')]=_0x14424a['actions'][_0x1cc3ac][_0x6cae('0x184')]=extractCalleridName(_0x402fa8);_0x20b513['XMD-ORIGINATECALLERIDNUM']=_0x14424a['actions'][_0x1cc3ac][_0x6cae('0x185')]=extractCalleridNumber(_0x402fa8);}return ami[_0x6cae('0xae')]({'actionid':_0x1cc3ac,'action':_0x6cae('0x164'),'channel':_0x14424a['isTrunkReachable'](_0x201e6[_0x6cae('0x75')])?util[_0x6cae('0x79')]('SIP/%s/%s%s',_0x201e6[_0x6cae('0x75')][_0x6cae('0x3f')],isNotNull(_0x201e6[_0x6cae('0x5c')])?_0x201e6[_0x6cae('0x5c')]['trim']()||'':'',_0x201e6[_0x6cae('0x186')]>0x0?_0x2abbc3[_0x6cae('0x17c')]['phone']['substring'](_0x201e6[_0x6cae('0x186')]):_0x2abbc3['Contact'][_0x6cae('0x165')]):util[_0x6cae('0x79')](_0x6cae('0x187'),_['isNil'](_0x201e6[_0x6cae('0x13a')])?_0x201e6['Trunk'][_0x6cae('0x3f')]:_0x201e6[_0x6cae('0x13a')][_0x6cae('0x3f')],isNotNull(_0x201e6[_0x6cae('0x5c')])?_0x201e6[_0x6cae('0x5c')][_0x6cae('0x188')]()||'':'',_0x201e6[_0x6cae('0x186')]>0x0?_0x2abbc3['Contact'][_0x6cae('0x165')][_0x6cae('0x189')](_0x201e6[_0x6cae('0x186')]):_0x2abbc3['Contact'][_0x6cae('0x165')]),'callerid':_0x402fa8,'Exten':'xcally-motion-dialer','Context':'from-sip','Priority':'1','variable':_0x20b513,'timeout':(_0x201e6[_0x6cae('0x5b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1cc3ac})['then'](function(_0x108cc6){return _0x43d4ca(_0x108cc6);})[_0x6cae('0xb9')](function(_0x28d2d5){_0x201e6[_0x6cae('0x65')]+=0x1;var _0x5293e5=new History(_0x14424a[_0x6cae('0xaa')][_0x1cc3ac]);logger[_0x6cae('0x95')](util[_0x6cae('0x79')](_0x6cae('0x18a'),JSON[_0x6cae('0x78')](_0x28d2d5)));_0x5293e5[_0x6cae('0x100')]=0xe;_0x5293e5[_0x6cae('0xe9')]=_0x6cae('0x18b');_0x5293e5[_0x6cae('0xa6')]=moment()[_0x6cae('0x79')](_0x6cae('0xfc'));_0x5293e5[_0x6cae('0xa5')]=_0x5293e5[_0x6cae('0xa6')];_0x14424a[_0x6cae('0xc9')](_0x5293e5)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x18c')));_0x14424a[_0x6cae('0xc7')](_0x5293e5)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x18c')))[_0x6cae('0x1f')](function(){delete _0x14424a[_0x6cae('0xaa')][_0x1cc3ac];return _0x505685(msgResponse(_0x6cae('0x164'),'Error','originate\x20action\x20Error'));});});});};Dialer[_0x6cae('0x1d')]['syncOriginateResponse']=function(_0x2f7342){var _0xafe339=this[_0x6cae('0xaa')][_0x2f7342[_0x6cae('0x125')]];if(_0xafe339){delete this[_0x6cae('0xaa')][_0x2f7342[_0x6cae('0x125')]];_0xafe339['responsetime']=moment()[_0x6cae('0x79')](_0x6cae('0xfc'));var _0xa6b54e=_0xafe339[_0x6cae('0x4c')]===_0x6cae('0x7b')?this[_0x6cae('0x22')][_0xafe339[_0x6cae('0xb2')]]:this[_0x6cae('0x21')][_0xafe339[_0x6cae('0x18d')]()];if(!this[_0x6cae('0xd8')](_0x2f7342['response'])){this[_0x6cae('0xb1')](_0xa6b54e);return this[_0x6cae('0x18e')](_0xafe339,_0xa6b54e,_0x2f7342)['catch'](loggerCatch(_0x6cae('0x18f')));}this[_0x6cae('0x26')][_0x2f7342['uniqueid']]=_0xafe339;}};Dialer[_0x6cae('0x1d')]['checkRetriveMax']=function(_0x383e03,_0x184ca6,_0x3fc190){var _0x178b7d=new History(_0x184ca6);if(_0x178b7d[_0x6cae('0x101')]+_0x178b7d[_0x6cae('0xef')]+_0x178b7d[_0x6cae('0xf0')]+_0x178b7d['countnosuchnumberretry']+_0x178b7d[_0x6cae('0xf2')]+_0x178b7d[_0x6cae('0xf3')]+_0x178b7d[_0x6cae('0xf4')]+_0x178b7d[_0x6cae('0xf5')]>=_0x3fc190['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x383e03){case 0x3:if(_0x178b7d['countnoanswerretry']>=_0x3fc190['dialNoAnswerMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x178b7d[_0x6cae('0xf0')]+=0x1,'scheduledat':moment()[_0x6cae('0xfa')](_0x3fc190[_0x6cae('0x190')],_0x6cae('0x104'))[_0x6cae('0x79')](_0x6cae('0xfc')),'ContactId':_0x178b7d[_0x6cae('0xd2')],'ListId':_0x178b7d[_0x6cae('0xd3')],'VoiceQueueId':_0x178b7d[_0x6cae('0xd5')]||undefined,'CampaignId':_0x178b7d[_0x6cae('0xfd')]||undefined})[_0x6cae('0xb9')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x178b7d['countbusyretry']>=_0x3fc190[_0x6cae('0x191')]-0x1){return!![];}this[_0x6cae('0xbe')]({'active':![],'countbusyretry':_0x178b7d['countbusyretry']+=0x1,'scheduledat':moment()[_0x6cae('0xfa')](_0x3fc190[_0x6cae('0x192')],'minutes')[_0x6cae('0x79')](_0x6cae('0xfc')),'ContactId':_0x178b7d[_0x6cae('0xd2')],'ListId':_0x178b7d['ListId'],'VoiceQueueId':_0x178b7d['VoiceQueueId']||undefined,'CampaignId':_0x178b7d['CampaignId']||undefined})[_0x6cae('0xb9')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x178b7d[_0x6cae('0xef')]>=_0x3fc190[_0x6cae('0x193')]-0x1){return!![];}this[_0x6cae('0xbe')]({'active':![],'countcongestionretry':_0x178b7d['countcongestionretry']+=0x1,'scheduledat':moment()[_0x6cae('0xfa')](_0x3fc190[_0x6cae('0x194')],_0x6cae('0x104'))[_0x6cae('0x79')](_0x6cae('0xfc')),'ContactId':_0x178b7d[_0x6cae('0xd2')],'ListId':_0x178b7d[_0x6cae('0xd3')],'VoiceQueueId':_0x178b7d[_0x6cae('0xd5')]||undefined,'CampaignId':_0x178b7d[_0x6cae('0xfd')]||undefined})[_0x6cae('0xb9')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x178b7d[_0x6cae('0xf1')]>=_0x3fc190['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x6cae('0xbe')]({'active':![],'countnosuchnumberretry':_0x178b7d['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x6cae('0xfa')](_0x3fc190['dialNoSuchNumberRetryFrequency'],_0x6cae('0x104'))[_0x6cae('0x79')](_0x6cae('0xfc')),'ContactId':_0x178b7d['ContactId'],'ListId':_0x178b7d[_0x6cae('0xd3')],'VoiceQueueId':_0x178b7d[_0x6cae('0xd5')]||undefined,'CampaignId':_0x178b7d[_0x6cae('0xfd')]||undefined})['catch'](loggerCatch(_0x6cae('0x195')));}break;case 0xa:if(_0x178b7d[_0x6cae('0xf2')]>=_0x3fc190[_0x6cae('0x11c')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x178b7d[_0x6cae('0xf2')]+=0x1,'scheduledat':moment()[_0x6cae('0xfa')](_0x3fc190['dialDropRetryFrequency'],_0x6cae('0x104'))['format'](_0x6cae('0xfc')),'ContactId':_0x178b7d[_0x6cae('0xd2')],'ListId':_0x178b7d[_0x6cae('0xd3')],'VoiceQueueId':_0x178b7d['VoiceQueueId']||undefined,'CampaignId':_0x178b7d[_0x6cae('0xfd')]||undefined})[_0x6cae('0xb9')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x178b7d[_0x6cae('0xf3')]>=_0x3fc190[_0x6cae('0x121')]-0x1){return!![];}this[_0x6cae('0xbe')]({'active':![],'countabandonedretry':_0x178b7d[_0x6cae('0xf3')]+=0x1,'scheduledat':moment()[_0x6cae('0xfa')](_0x3fc190[_0x6cae('0x122')],'minutes')['format'](_0x6cae('0xfc')),'ContactId':_0x178b7d[_0x6cae('0xd2')],'ListId':_0x178b7d[_0x6cae('0xd3')],'VoiceQueueId':_0x178b7d[_0x6cae('0xd5')]||undefined,'CampaignId':_0x178b7d[_0x6cae('0xfd')]||undefined})['catch'](loggerCatch(_0x6cae('0x123')));break;case 0x13:if(_0x178b7d['countmachineretry']>=_0x3fc190[_0x6cae('0xf8')]-0x1){return!![];}this[_0x6cae('0xbe')]({'active':![],'countmachineretry':_0x178b7d[_0x6cae('0xf4')]+=0x1,'scheduledat':moment()[_0x6cae('0xfa')](_0x3fc190[_0x6cae('0xfb')],_0x6cae('0x104'))[_0x6cae('0x79')](_0x6cae('0xfc')),'ContactId':_0x178b7d[_0x6cae('0xd2')],'ListId':_0x178b7d[_0x6cae('0xd3')],'VoiceQueueId':_0x178b7d[_0x6cae('0xd5')]||undefined,'CampaignId':_0x178b7d[_0x6cae('0xfd')]||undefined})['catch'](loggerCatch(_0x6cae('0xfe')));break;case 0x14:if(_0x178b7d[_0x6cae('0xf5')]>=_0x3fc190[_0x6cae('0x196')]-0x1){return!![];}this[_0x6cae('0xbe')]({'active':![],'countagentrejectretry':_0x178b7d[_0x6cae('0xf5')]+=0x1,'scheduledat':moment()['add'](_0x3fc190['dialAgentRejectRetryFrequency'],_0x6cae('0x104'))[_0x6cae('0x79')](_0x6cae('0xfc')),'ContactId':_0x178b7d['ContactId'],'ListId':_0x178b7d[_0x6cae('0xd3')],'VoiceQueueId':_0x178b7d[_0x6cae('0xd5')]||undefined,'CampaignId':_0x178b7d[_0x6cae('0xfd')]||undefined})[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x197')));break;default:return!![];}};Dialer[_0x6cae('0x1d')]['callProgressDetecting']=function(_0x3dbd15,_0x59682a,_0x9482ca){var _0x477ec1=this;var _0x165477=new History(_0x3dbd15);return new BPromise(function(_0x294ff6,_0x484cd6){if(_[_0x6cae('0x3d')](_0x59682a)&&typeof _0x59682a!==_0x6cae('0x163')){return _0x484cd6(msgResponse(_0x6cae('0x198'),_0x6cae('0x13f'),_0x6cae('0x199')));}if(_[_0x6cae('0x3d')](_0x9482ca)&&typeof _0x9482ca!==_0x6cae('0x163')){return _0x484cd6(msgResponse(_0x6cae('0x198'),_0x6cae('0x13f'),'evt\x20is\x20undefine'));}switch(_0x9482ca['reason']){case'0':_0x59682a['outboundNoSuchCallsDay']+=0x1;_0x165477[_0x6cae('0x100')]=0x0;_0x165477[_0x6cae('0xe9')]=_0x6cae('0x19a');_0x165477[_0x6cae('0xf1')]+=0x1;_0x165477['countglobal']+=0x1;ami[_0x6cae('0x4b')](_0x6cae('0x19b'),ut[_0x6cae('0x19c')](_0x3dbd15,_0x6cae('0x19d')));_0x477ec1[_0x6cae('0xc9')](_0x165477)['catch'](loggerCatch(_0x6cae('0xee')));if(_0x477ec1['checkRetriveMax'](0x0,_0x3dbd15,_0x59682a)){if(_0x165477[_0x6cae('0xf1')]>=_0x59682a['dialNoSuchNumberMaxRetry']){_0x477ec1['createStateFinal'](_0x165477,_0x294ff6,_0x484cd6,'reason\x200\x20no\x20such\x20number....');}else{_0x477ec1[_0x6cae('0xf6')](_0x165477,_0x294ff6,_0x484cd6,_0x6cae('0x19e'));}}break;case'3':_0x59682a[_0x6cae('0x64')]+=0x1;_0x165477[_0x6cae('0x100')]=0x3;_0x165477[_0x6cae('0xe9')]='NoAnswer';_0x165477[_0x6cae('0xf0')]+=0x1;_0x165477[_0x6cae('0xec')]+=0x1;ami[_0x6cae('0x4b')](_0x6cae('0x19f'),ut[_0x6cae('0x19c')](_0x3dbd15,_0x6cae('0x1a0')));_0x477ec1['createHistory'](_0x165477)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x1a1')));if(_0x477ec1[_0x6cae('0x1a2')](0x3,_0x3dbd15,_0x59682a)){if(_0x165477[_0x6cae('0xf0')]>=_0x59682a[_0x6cae('0x1a3')]){_0x477ec1[_0x6cae('0x103')](_0x165477,_0x294ff6,_0x484cd6,_0x6cae('0x1a4'));}else{_0x477ec1[_0x6cae('0xf6')](_0x165477,_0x294ff6,_0x484cd6,_0x6cae('0x1a4'));}}break;case'5':_0x59682a[_0x6cae('0x60')]+=0x1;_0x165477['state']=0x5;_0x165477['statedesc']='Busy';_0x165477['countbusyretry']+=0x1;_0x165477[_0x6cae('0xec')]+=0x1;ami[_0x6cae('0x4b')](_0x6cae('0x1a5'),ut[_0x6cae('0x19c')](_0x3dbd15,'busy'));_0x477ec1['createHistory'](_0x165477)['catch'](loggerCatch(_0x6cae('0x1a6')));if(_0x477ec1[_0x6cae('0x1a2')](0x5,_0x3dbd15,_0x59682a)){if(_0x165477[_0x6cae('0x101')]>=_0x59682a['dialBusyMaxRetry']){_0x477ec1['createStateFinal'](_0x165477,_0x294ff6,_0x484cd6,_0x6cae('0x1a7'));}else{_0x477ec1['stateGlobal'](_0x165477,_0x294ff6,_0x484cd6,_0x6cae('0x1a7'));}}break;case'8':_0x59682a[_0x6cae('0x61')]+=0x1;_0x165477['state']=0x8;_0x165477[_0x6cae('0xe9')]=_0x6cae('0x1a8');_0x165477['countcongestionretry']+=0x1;_0x165477[_0x6cae('0xec')]+=0x1;ami[_0x6cae('0x4b')](_0x6cae('0x1a9'),ut['buildObj'](_0x3dbd15,_0x6cae('0x1aa')));_0x477ec1[_0x6cae('0xc9')](_0x165477)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x1ab')));if(_0x477ec1[_0x6cae('0x1a2')](0x8,_0x3dbd15,_0x59682a)){if(_0x165477[_0x6cae('0xef')]>=_0x59682a[_0x6cae('0x193')]){_0x477ec1[_0x6cae('0x103')](_0x165477,_0x294ff6,_0x484cd6,'reason\x208\x20congestion');}else{_0x477ec1[_0x6cae('0xf6')](_0x165477,_0x294ff6,_0x484cd6,_0x6cae('0x1ac'));}}break;case'11':_0x59682a[_0x6cae('0x1ad')]+=0x1;_0x165477[_0x6cae('0x100')]=0xb;_0x165477['statedesc']='Abandoned';_0x165477['countabandonedretry']+=0x1;_0x165477[_0x6cae('0xec')]+=0x1;_0x477ec1[_0x6cae('0xc9')](_0x165477)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x124')));if(_0x477ec1[_0x6cae('0x1a2')](0xb,_0x3dbd15,_0x59682a)){if(_0x165477[_0x6cae('0xf3')]>=_0x59682a[_0x6cae('0x121')]){_0x477ec1['createStateFinal'](_0x165477,_0x294ff6,_0x484cd6,'reason\x2011\x20abandoned');}else{_0x477ec1[_0x6cae('0xf6')](_0x165477,_0x294ff6,_0x484cd6,_0x6cae('0x1ae'));}}break;case'20':_0x59682a['outboundRejectCallsDay']+=0x1;_0x165477[_0x6cae('0x100')]=0x14;_0x165477['statedesc']=_0x6cae('0x1af');_0x165477[_0x6cae('0xf5')]+=0x1;_0x165477[_0x6cae('0xec')]+=0x1;ami[_0x6cae('0x4b')](_0x6cae('0x1b0'),ut[_0x6cae('0x19c')](_0x3dbd15,_0x6cae('0x1b1')));_0x477ec1[_0x6cae('0xc9')](_0x165477)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x1b2')));if(_0x477ec1[_0x6cae('0x1a2')](0x14,_0x3dbd15,_0x59682a)){if(_0x165477[_0x6cae('0xf5')]>=_0x59682a[_0x6cae('0x196')]){_0x477ec1[_0x6cae('0x103')](_0x165477,_0x294ff6,_0x484cd6,_0x6cae('0x1b3'));}else{_0x477ec1[_0x6cae('0xf6')](_0x165477,_0x294ff6,_0x484cd6,_0x6cae('0x1b3'));}}break;default:_0x59682a[_0x6cae('0x68')]+=0x1;_0x165477[_0x6cae('0x100')]=0xc;_0x165477[_0x6cae('0xe9')]=_0x9482ca['reason'];_0x477ec1[_0x6cae('0xc9')](_0x165477)[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x1b4')));if(_0x477ec1[_0x6cae('0x1a2')](_0x9482ca[_0x6cae('0x1b5')],_0x3dbd15,_0x59682a)){if(_0x165477['countbusyretry']+_0x165477[_0x6cae('0xef')]+_0x165477[_0x6cae('0xf0')]+_0x165477['countnosuchnumberretry']+_0x165477[_0x6cae('0xf2')]+_0x165477[_0x6cae('0xf3')]+_0x165477[_0x6cae('0xf4')]+_0x165477[_0x6cae('0xf5')]>=_0x59682a[_0x6cae('0x102')]){_0x477ec1['stateGlobal'](_0x165477,_0x294ff6,_0x484cd6,_0x9482ca[_0x6cae('0x1b5')]);}else{_0x477ec1['createStateFinal'](_0x165477,_0x294ff6,_0x484cd6,_0x9482ca[_0x6cae('0x1b5')]);}}}});};Dialer[_0x6cae('0x1d')][_0x6cae('0xf6')]=function(_0x4a63e0,_0x2060af,_0x1b0720,_0x4de3e2){var _0x15efdd=new Final(_0x4a63e0);_0x15efdd[_0x6cae('0x100')]=0xf;_0x15efdd[_0x6cae('0xe9')]=_0x6cae('0x1b6');this[_0x6cae('0x103')](_0x15efdd,_0x2060af,_0x1b0720,_0x4de3e2);};Dialer[_0x6cae('0x1d')][_0x6cae('0x103')]=function(_0x4a3c4e,_0x3ca558,_0x55958f,_0x1b73b3){this['moveContactManagedDialer'](_0x4a3c4e)[_0x6cae('0xb7')](function(){return _0x3ca558(msgResponse(_0x6cae('0x198'),_0x6cae('0xd9'),_0x1b73b3));})[_0x6cae('0xb9')](function(){return _0x55958f(msgResponse(_0x6cae('0x1b7'),_0x6cae('0x13f'),_0x6cae('0x1b8')));});};Dialer[_0x6cae('0x1d')][_0x6cae('0x8')]=function(_0x17df85){var _0x2a8464=_0x17df85[_0x6cae('0x1b9')]/0x64;var _0x1d7e1b=_0x17df85[_0x6cae('0x118')]/(_0x17df85['outboundDropCallsDayTimeout']+_0x17df85['outboundAnswerCallsDay']);var _0xf84e51=Math[_0x6cae('0x1ba')](_0x17df85[_0x6cae('0x71')]*(_0x17df85[_0x6cae('0x1bb')]/0x64));var _0x3d6424=Math[_0x6cae('0x1ba')](_0x17df85['predictiveIntervalAvailable']*(_0x17df85['predictiveIntervalMinThreshold']/0x64));var _0x43d6fb=_0x17df85[_0x6cae('0xa1')]+_0x17df85['talking'];var _0x3fbf86=Math[_0x6cae('0x1bc')](_0x17df85['erlangCalls']*_0x17df85[_0x6cae('0x73')]*_0x17df85[_0x6cae('0x6e')]*_0x17df85[_0x6cae('0x6f')]);if(_[_0x6cae('0x3d')](_0x17df85['startProgressive'])){if(!_[_0x6cae('0x3d')](_0x17df85[_0x6cae('0x28')])){_0x17df85[_0x6cae('0x28')]=undefined;loggerPredictive[_0x6cae('0x95')](_0x6cae('0x1bd'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x6cae('0x3d')](_0x17df85[_0x6cae('0x90')])){loggerPredictive[_0x6cae('0x95')]('[startMethodPredictive][StartProgressive]',_0x6cae('0x1be'));clearInterval(_0x17df85['handlePredictive']);_0x17df85[_0x6cae('0x90')]=undefined;}_0x17df85[_0x6cae('0x29')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x17df85[_0x6cae('0x3f')],_0x6cae('0x1bf'),_0x17df85[_0x6cae('0x29')]);this[_0x6cae('0x153')](_0x17df85,0x1);}else if(ifInterval(_0x17df85[_0x6cae('0x1c0')],_0x17df85[_0x6cae('0x29')])){this[_0x6cae('0x153')](_0x17df85,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x17df85[_0x6cae('0x29')],_0x17df85[_0x6cae('0x3f')]);_0x17df85['erlangCalls']=0x0;_0x17df85['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x2a8464<_0x1d7e1b&&_0x17df85[_0x6cae('0x1c1')]===_0x6cae('0x1c2')){freeVariablesPredictive(_0x17df85);loggerPredictive[_0x6cae('0x7e')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x6cae('0x1c3'),_0x1d7e1b,_0x6cae('0x29'),_0x17df85['name']);}else if(_0x3fbf86<_0x17df85[_0x6cae('0x6d')]&&_0x17df85[_0x6cae('0x1c1')]===_0x6cae('0x1c2')){freeVariablesPredictive(_0x17df85);loggerPredictive['info'](_0x6cae('0x1c4'),_0x6cae('0x1c5'),_0x3fbf86,_0x6cae('0x1c6'),_0x17df85['predictiveIntervalErlangCallsDroppedCalls'],_0x6cae('0x29'),_0x17df85[_0x6cae('0x3f')]);}else if(!ifInterval(_0x17df85['dialPredictiveInterval'],_0x17df85[_0x6cae('0x29')])&&_[_0x6cae('0x3d')](_0x17df85[_0x6cae('0x28')])&&!_['isUndefined'](_0x17df85[_0x6cae('0x29')])){_0x17df85[_0x6cae('0x28')]=moment()[_0x6cae('0x79')](_0x6cae('0xfc'));loggerPredictive['info'](_0x17df85['name'],'started\x20in\x20predictive\x20at',_0x17df85[_0x6cae('0x28')]);this[_0x6cae('0xbc')](_0x17df85[_0x6cae('0x1c0')])[_0x6cae('0xb7')](this[_0x6cae('0x1c7')](_0x17df85))[_0x6cae('0xb7')](mergeDataErlangB(_0x17df85))[_0x6cae('0xb7')](this['startMethodPredictive'](_0x17df85))[_0x6cae('0xb9')](loggerCatchPredictive(_0x6cae('0x1c8'),_0x17df85));}else if(!ifInterval(_0x17df85['dialPredictiveInterval'],_0x17df85['startPredictive'])){_0x17df85['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x17df85[_0x6cae('0x28')]=moment()[_0x6cae('0x79')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x17df85['name'],_0x6cae('0x1c9'),_0x17df85[_0x6cae('0x28')]);clearInterval(_0x17df85[_0x6cae('0x90')]);_0x17df85[_0x6cae('0x90')]=undefined;this[_0x6cae('0xbc')](_0x17df85[_0x6cae('0x1c0')])['then'](this[_0x6cae('0x1c7')](_0x17df85))[_0x6cae('0xb7')](mergeDataErlangB(_0x17df85))[_0x6cae('0xb7')](this[_0x6cae('0x1ca')](_0x17df85))['catch'](loggerCatchPredictive(_0x6cae('0x1cb'),_0x17df85));}else if(_0x17df85[_0x6cae('0x71')]&&_0x43d6fb<_0x17df85['predictiveIntervalAvailable']-_0x3d6424){freeVariablesPredictive(_0x17df85);loggerPredictive[_0x6cae('0x7e')](_0x17df85[_0x6cae('0x3f')],_0x6cae('0x1cc'),_0x43d6fb,_0x6cae('0x1cd'),_0x17df85['predictiveIntervalAvailable'],'-',_0x3d6424,'=',_0x17df85[_0x6cae('0x71')]-_0x3d6424,')');}else if(_0x17df85[_0x6cae('0x71')]&&_0x43d6fb>_0x17df85[_0x6cae('0x71')]+_0xf84e51){freeVariablesPredictive(_0x17df85);loggerPredictive[_0x6cae('0x7e')](_0x17df85[_0x6cae('0x3f')],_0x6cae('0x1cc'),_0x43d6fb,_0x6cae('0x1ce'),_0x17df85[_0x6cae('0x71')],'+',_0xf84e51,'=',_0x17df85[_0x6cae('0x71')]+_0xf84e51,')');}};Dialer['prototype'][_0x6cae('0x1c7')]=function(_0x35e49e){var _0x34ed0d=this;return function(_0x2c68c3){return new BPromise(function(_0x430c71,_0x3231dd){_[_0x6cae('0x8e')](_0x35e49e,_0x2c68c3[0x0]);if(checkGetDataPredictive(_0x2c68c3[0x0])){var _0x4203e6=_0x35e49e[_0x6cae('0x71')]=_0x35e49e[_0x6cae('0x9f')]+_0x35e49e[_0x6cae('0xa1')];var _0x23dc0e=_0x35e49e['dialPredictiveInterval']*0x3c;var _0x52fef4=_0x2c68c3[0x0][_0x6cae('0x6a')]+_0x2c68c3[0x0]['predictiveIntervalAvgHoldtime'];var _0x519009=(_0x2c68c3[0x0][_0x6cae('0x69')]+_0x2c68c3[0x0][_0x6cae('0x6c')]+_0x2c68c3[0x0][_0x6cae('0x6b')])/_0x2c68c3[0x0][_0x6cae('0x1cf')];_0x35e49e[_0x6cae('0x6e')]=_0x519009>0x0?_0x519009:0x1;switch(_0x35e49e[_0x6cae('0x1c1')]){case _0x6cae('0x1c2'):var _0x43d5e2=_0x35e49e[_0x6cae('0x1b9')]/0x64;return _0x34ed0d[_0x6cae('0x1d0')](_0x4203e6,_0x23dc0e,_0x52fef4,_0x519009,_0x43d5e2)[_0x6cae('0xb7')](function(_0x24c4f9){return _0x430c71(_0x24c4f9);});case _0x6cae('0x1d1'):var _0x2778a7=_0x35e49e[_0x6cae('0x1b9')]/0x64;return _0x34ed0d[_0x6cae('0x1d2')](_0x4203e6,_0x23dc0e,_0x52fef4,_0x519009,_0x2778a7)[_0x6cae('0xb7')](function(_0x3e649e){return _0x430c71(_0x3e649e);});default:return _0x3231dd(msgResponse('[getDataPredictive]',_0x6cae('0x13f'),'Unknown\x20Predictive'));}}else{return _0x3231dd(msgResponse('[getDataPredictive]',_0x6cae('0x13f'),_0x6cae('0x1d3')));}});};};Dialer[_0x6cae('0x1d')][_0x6cae('0x1d4')]=function(_0x480779){var _0x287ac2=this;return function(_0x2a2ce6){return new BPromise(function(_0x1cd111,_0x5d877a){_['merge'](_0x480779,_0x2a2ce6[0x0]);if(checkGetDataPredictive(_0x2a2ce6[0x0])){loggerPredictive['info'](JSON[_0x6cae('0x78')](_0x2a2ce6[0x0]));if(_0x480779[_0x6cae('0x1c1')]==='dropRate'){return _0x287ac2[_0x6cae('0xc5')](_0x480779['id'])['then'](function(_0x27e662){var _0x4e3ab6=_0x480779['loggedIn']-_0x27e662[0x0]['outboundQueuePauses'];var _0x12f7c8=_0x480779[_0x6cae('0x1c0')]*0x3c;var _0x2fafdc=_0x2a2ce6[0x0][_0x6cae('0x6a')]+_0x2a2ce6[0x0][_0x6cae('0x85')];var _0x1b221c=(_0x2a2ce6[0x0]['predictiveIntervalAnsweredCalls']+_0x2a2ce6[0x0][_0x6cae('0x6c')]+_0x2a2ce6[0x0][_0x6cae('0x6b')])/_0x2a2ce6[0x0][_0x6cae('0x1cf')];var _0x41ad83=_0x480779['dialPredictiveOptimizationPercentage']/0x64;_0x480779[_0x6cae('0x70')]=_0x27e662[0x0][_0x6cae('0x1d5')]||0x0;_0x480779[_0x6cae('0x6e')]=_0x1b221c>0x0?_0x1b221c:0x1;return _0x287ac2[_0x6cae('0x1d0')](_0x4e3ab6,_0x12f7c8,_0x2fafdc,_0x1b221c,_0x41ad83);})[_0x6cae('0xb7')](function(_0x19ba06){return _0x1cd111(_0x19ba06);})['catch'](function(_0x235fb7){return _0x5d877a(msgResponse('[CatchErlangB]',_0x6cae('0x13f'),JSON[_0x6cae('0x78')](_0x235fb7)));});}if(_0x480779[_0x6cae('0x1c1')]===_0x6cae('0x1d1')){return _0x287ac2['getVoiceQueueRtPauses'](_0x480779['id'])[_0x6cae('0xb7')](function(_0x419740){var _0x1fa839=_0x480779[_0x6cae('0x50')]-_0x419740[0x0][_0x6cae('0x1d5')];var _0x3b1eea=_0x480779[_0x6cae('0x1c0')]*0x3c;var _0x2bf610=_0x2a2ce6[0x0]['predictiveIntervalAvgTalktime']+_0x2a2ce6[0x0][_0x6cae('0x85')];var _0x34c756=(_0x2a2ce6[0x0]['predictiveIntervalAnsweredCalls']+_0x2a2ce6[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2a2ce6[0x0][_0x6cae('0x6b')])/_0x2a2ce6[0x0]['predictiveIntervalTotalCalls'];var _0xae04e0=_0x480779['dialPredictiveOptimizationPercentage']/0x64;_0x480779[_0x6cae('0x70')]=_0x419740[0x0][_0x6cae('0x1d5')]||0x0;_0x480779[_0x6cae('0x6e')]=_0x34c756>0x0?_0x34c756:0x1;return _0x287ac2[_0x6cae('0x1d2')](_0x1fa839,_0x3b1eea,_0x2bf610,_0x34c756,_0xae04e0);})[_0x6cae('0xb7')](function(_0x74d09f){return _0x1cd111(_0x74d09f);})[_0x6cae('0xb9')](function(_0x8c15f6){return _0x5d877a(msgResponse(_0x6cae('0x1d6'),_0x6cae('0x13f'),JSON[_0x6cae('0x78')](_0x8c15f6)));});}}else{return _0x5d877a(msgResponse(_0x6cae('0x1d7'),'Failure',_0x6cae('0x1d3')));}});};};Dialer[_0x6cae('0x1d')][_0x6cae('0x1ca')]=function(_0x5cf4a8){var _0x5c5bc1=this;return function(){var _0x4dcf80=0x0;var _0x394ccd=Math[_0x6cae('0x1bc')](_0x5cf4a8[_0x6cae('0x72')]*0x3e8);if(_0x394ccd>0x0){_0x394ccd=_0x394ccd<0x64?0x64:_0x394ccd;loggerPredictive[_0x6cae('0x7e')](_0x5cf4a8['name'],_0x6cae('0x1d8'),_0x394ccd,_0x6cae('0x48'));_0x5cf4a8['handlePredictive']=setInterval(function(){_0x5c5bc1['handlePredictive'](_0x5cf4a8);loggerPredictiveCalls[_0x6cae('0x7e')]('[handlePredictive]',_0x4dcf80+=0x1);},_0x394ccd);}else{loggerPredictive[_0x6cae('0x7e')](_0x5cf4a8[_0x6cae('0x3f')],_0x6cae('0x1d9'));}};};Dialer[_0x6cae('0x1d')][_0x6cae('0x1da')]=function(_0x602876,_0x3eddda){var _0x78bea5=this;return function(_0x515d12){if(_['isEmpty'](_0x515d12)){if(_['isNil'](_0x3eddda[_0x6cae('0xd4')])||!_0x3eddda[_0x6cae('0x1db')]){if(_0x602876[_0x6cae('0x59')]===_0x6cae('0x7')){_0x602876[_0x6cae('0x12b')]=_['isUndefined'](_0x602876[_0x6cae('0x12b')])?!![]:_0x602876['queueStatusComplete'];var _0x3d1182=uuid['v4']();_0x78bea5[_0x6cae('0xaa')][_0x3d1182]=new Action(_0x602876,_0x3eddda,_0x3d1182);loggerBooked[_0x6cae('0x7e')](_0x6cae('0x1dc'),_0x3d1182,_0x6cae('0x1dd'),JSON[_0x6cae('0x78')](_0x602876['queueStatusComplete']),'Queue:\x20',_0x602876[_0x6cae('0x3f')]);if(_0x602876[_0x6cae('0x12b')]){_0x602876[_0x6cae('0x12b')]=![];_0x78bea5[_0x6cae('0x2b')][_0x78bea5[_0x6cae('0xaa')][_0x3d1182][_0x6cae('0xb2')]]=[];ami[_0x6cae('0xae')]({'actionid':_0x3d1182,'action':_0x6cae('0x1de'),'queue':_0x602876['name']})[_0x6cae('0xb9')](function(){_0x78bea5[_0x6cae('0xb1')](_0x602876);_0x78bea5[_0x6cae('0xbe')]({'active':![],'ContactId':_0x78bea5[_0x6cae('0xaa')][_0x3d1182][_0x6cae('0xd2')],'ListId':_0x78bea5[_0x6cae('0xaa')][_0x3d1182]['ListId'],'VoiceQueueId':_0x78bea5[_0x6cae('0xaa')][_0x3d1182]['VoiceQueueId']||undefined,'CampaignId':_0x78bea5[_0x6cae('0xaa')][_0x3d1182][_0x6cae('0xfd')]||undefined})[_0x6cae('0xb9')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x78bea5[_0x6cae('0xaa')][_0x3d1182];});}else{loggerBooked['info'](_0x6cae('0x1df'),JSON['stringify'](_0x602876[_0x6cae('0x12b')]),_0x6cae('0x1e0'),_0x602876[_0x6cae('0x3f')]);_0x78bea5[_0x6cae('0xb1')](_0x602876);_0x78bea5[_0x6cae('0xbe')]({'active':![],'ContactId':_0x78bea5[_0x6cae('0xaa')][_0x3d1182]['ContactId'],'ListId':_0x78bea5[_0x6cae('0xaa')][_0x3d1182][_0x6cae('0xd3')],'VoiceQueueId':_0x78bea5[_0x6cae('0xaa')][_0x3d1182]['VoiceQueueId']||undefined,'CampaignId':_0x78bea5[_0x6cae('0xaa')][_0x3d1182][_0x6cae('0xfd')]||undefined})['catch'](loggerCatch(_0x6cae('0x1e1')));delete _0x78bea5['actions'][_0x3d1182];}}else{return _0x78bea5[_0x6cae('0x1e2')](_0x602876,_0x3eddda);}}else{if(getDiff(_0x3eddda[_0x6cae('0x1e3')])<_0x602876[_0x6cae('0x1e4')]*0x3c){if(_0x3eddda[_0x6cae('0x1e5')]&&!_0x3eddda['Agent'][_0x6cae('0x1e6')]){_0x78bea5['preview'][_0x6cae('0x12d')](_0x3eddda['id'])[_0x6cae('0x1f')](function(){_0x78bea5[_0x6cae('0xb1')](_0x602876);});}else{_0x78bea5[_0x6cae('0xc0')]({'active':![]},_0x3eddda['id'],0x1)[_0x6cae('0x1f')](function(){_0x78bea5[_0x6cae('0xb1')](_0x602876);});}}else{_0x602876[_0x6cae('0x66')]+=0x1;_0x78bea5[_0x6cae('0xb1')](_0x602876);if(_0x602876[_0x6cae('0x1e7')]){_0x78bea5['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3eddda[_0x6cae('0xd2')],'ListId':_0x3eddda[_0x6cae('0xd3')],'VoiceQueueId':_0x3eddda['VoiceQueueId']||undefined,'CampaignId':_0x3eddda[_0x6cae('0xfd')]||undefined})[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x1e8')));_0x78bea5['createHistory'](createObjHistory(_0x602876,_0x3eddda,_0x6cae('0x1e9'),0x17,_0x6cae('0x1ea')))[_0x6cae('0xb9')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x78bea5[_0x6cae('0xd0')](createObjHistory(_0x602876,_0x3eddda,_0x6cae('0x1eb'),0x16,_0x6cae('0x1ec')),_0x6cae('0x1ed'),_0x6cae('0x1ee'));}}}}else{_0x602876[_0x6cae('0x5f')]+=0x1;_0x78bea5[_0x6cae('0xd0')](createObjHistory(_0x602876,_0x3eddda,'BLACKLIST',0xd,_0x6cae('0x1ef')),_0x6cae('0x1f0'),'[Originate][MoveBlacklist]');throw _0x6cae('0x1f1');}};};Dialer[_0x6cae('0x1d')][_0x6cae('0x158')]=function(_0x164b42){var _0x433d96=this;var _0x51bd74=_0x164b42[_0x6cae('0x1f2')]-_0x164b42[_0x6cae('0x98')]-_0x164b42[_0x6cae('0x1f3')];emitCampaignSummary(_0x164b42);if(_0x51bd74>0x0){if(_0x51bd74>this[_0x6cae('0x1f4')]){_0x51bd74=this[_0x6cae('0x1f4')];}_0x164b42[_0x6cae('0x1f3')]+=_0x51bd74;this[_0x6cae('0xc4')](_0x164b42['id'],_0x51bd74,_0x164b42[_0x6cae('0x1f5')])[_0x6cae('0xb7')](function(_0xf1d3df){_0x164b42['temp']-=_0x51bd74;_0x164b42[_0x6cae('0x1f3')]=_0x164b42['temp']>0x0?_0x164b42[_0x6cae('0x1f3')]:0x0;if(!checkContactEmpty(_0xf1d3df)){_0x164b42[_0x6cae('0x3e')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x6cae('0x7e')](_0x6cae('0x1f6')+_0x164b42['name']);}else{_0x164b42[_0x6cae('0x98')]+=_0xf1d3df[_0x6cae('0x97')];_0x164b42['message']=_0x6cae('0x1f7');for(var _0x2cfff2=0x0;_0x2cfff2<_0xf1d3df[_0x6cae('0x97')];_0x2cfff2+=0x1){_0x164b42['ivrTotalCallsDays']+=0x1;if(_[_0x6cae('0xad')](_0xf1d3df[_0x2cfff2])||_['isNil'](_0xf1d3df[_0x2cfff2][_0x6cae('0x17c')])||_[_0x6cae('0xad')](_0xf1d3df[_0x2cfff2]['Contact'][_0x6cae('0x165')])){_0x433d96[_0x6cae('0xce')](_0x6cae('0x1f8'),_0x164b42,_0xf1d3df[_0x2cfff2]);}else{_0x433d96[_0x6cae('0xba')](_[_0x6cae('0xd1')](_0xf1d3df[_0x2cfff2],[_0x6cae('0xfd'),_0x6cae('0x1f9')]))[_0x6cae('0xb7')](_0x433d96[_0x6cae('0x1da')](_0x164b42,_0xf1d3df[_0x2cfff2]))[_0x6cae('0xb9')](_0x433d96[_0x6cae('0xcd')](_0x6cae('0x1fa'),_0x164b42));}}}})['catch'](loggerGetContactDialer('[getContactCampaign2]',_0x164b42,_0x51bd74));}};Dialer[_0x6cae('0x1d')][_0x6cae('0x153')]=function(_0x5a8959,_0x47b79d){var _0x2163e1=this;var _0x30ff00=[];var _0x4432d7=_0x47b79d>=0x1?_0x47b79d:0x1;if(_0x5a8959[_0x6cae('0x59')]===_0x6cae('0x7')){_0x4432d7=0x1;}var _0x16dba5=Math['floor'](_0x5a8959[_0x6cae('0xa1')]*_0x4432d7)-_0x5a8959['originated']-_0x5a8959[_0x6cae('0x1f3')];emitVoiceQueueSummary(_0x5a8959);if(_0x5a8959[_0x6cae('0x1fb')]>0x0){var _0x45b8b5=_0x5a8959[_0x6cae('0x1fb')]-_0x5a8959[_0x6cae('0x98')]-_0x5a8959[_0x6cae('0x9f')]-_0x5a8959[_0x6cae('0x1f3')]-_0x5a8959[_0x6cae('0x1fc')];if(_0x16dba5>_0x45b8b5){_0x16dba5=_0x45b8b5;}}if(_0x16dba5>0x0){if(_0x5a8959[_0x6cae('0x59')]===_0x6cae('0x7')){_0x16dba5=0x1;}if(_0x16dba5>this[_0x6cae('0x1f4')]){_0x16dba5=this['maxNumberOriginate'];}_0x5a8959['temp']+=_0x16dba5;for(var _0x4f8fa9 in this['agents']){if(typeof this['agents'][_0x4f8fa9]!==_0x6cae('0x99')){if(this['agents'][_0x4f8fa9][_0x6cae('0x100')]===_0x6cae('0x1fd')&&this['agents'][_0x4f8fa9][_0x6cae('0xdb')]===_0x6cae('0xdc')){_0x30ff00[_0x6cae('0x129')](this[_0x6cae('0x23')][_0x4f8fa9]['id']);}}}this[_0x6cae('0xc2')](_0x5a8959['id'],_0x30ff00,_0x16dba5,_0x5a8959[_0x6cae('0x1f5')])['then'](function(_0x422308){_0x5a8959['temp']-=_0x16dba5;_0x5a8959[_0x6cae('0x1f3')]=_0x5a8959[_0x6cae('0x1f3')]>0x0?_0x5a8959[_0x6cae('0x1f3')]:0x0;if(!checkContactEmpty(_0x422308)){_0x2163e1['countReScheduled'](_0x5a8959)[_0x6cae('0xb7')](sendMessageReschedule(_0x5a8959))[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x1fe')));}else{_0x5a8959['originated']+=_0x422308[_0x6cae('0x97')];_0x5a8959['message']=_0x5a8959['dialMethod']==='booked'?_0x6cae('0x16b'):_0x6cae('0x1f7');for(var _0x2ba916=0x0;_0x2ba916<_0x422308[_0x6cae('0x97')];_0x2ba916+=0x1){if(_['isNil'](_0x422308[_0x2ba916])||_[_0x6cae('0xad')](_0x422308[_0x2ba916][_0x6cae('0x17c')])||_[_0x6cae('0xad')](_0x422308[_0x2ba916][_0x6cae('0x17c')][_0x6cae('0x165')])){_0x2163e1[_0x6cae('0xce')]('[actionOriginate]\x20',_0x5a8959,_0x422308[_0x2ba916]);}else{_0x2163e1[_0x6cae('0xb8')](_['pick'](_0x422308[_0x2ba916],[_0x6cae('0xd5'),'Contact.phone']))['then'](_0x2163e1[_0x6cae('0x1da')](_0x5a8959,_0x422308[_0x2ba916]))[_0x6cae('0xb9')](_0x2163e1[_0x6cae('0xcd')]('[actionOriginate]\x20',_0x5a8959));}}}})['catch'](loggerGetContactDialer(_0x6cae('0x1ff'),_0x5a8959,_0x16dba5));}};Dialer[_0x6cae('0x1d')][_0x6cae('0x90')]=function(_0x3cdc54){if(_0x3cdc54['dialLimitQueue']>0x0){var _0x492aef=_0x3cdc54['dialLimitQueue']-_0x3cdc54[_0x6cae('0x98')]-_0x3cdc54[_0x6cae('0x9f')];if(_0x492aef>0x0){this[_0x6cae('0x200')](_0x3cdc54);}else{loggerPredictiveCalls[_0x6cae('0x7e')](_0x6cae('0x201'));}}else{this[_0x6cae('0x200')](_0x3cdc54);}};Dialer[_0x6cae('0x1d')][_0x6cae('0x200')]=function(_0x5c9139){var _0xe20bb1=this;var _0x317eb2=[];_0x5c9139[_0x6cae('0x98')]+=0x1;for(var _0x27ceb5 in this[_0x6cae('0x23')]){if(typeof this[_0x6cae('0x23')][_0x27ceb5]!==_0x6cae('0x99')){if(this[_0x6cae('0x23')][_0x27ceb5][_0x6cae('0x100')]===_0x6cae('0x1fd')&&this[_0x6cae('0x23')][_0x27ceb5][_0x6cae('0xdb')]===_0x6cae('0xdc')){_0x317eb2[_0x6cae('0x129')](this[_0x6cae('0x23')][_0x27ceb5]['id']);}}}this['getContactDialer'](_0x5c9139['id'],_0x317eb2,0x1,_0x5c9139[_0x6cae('0x1f5')])['then'](function(_0x7337dc){if(!checkContactEmpty(_0x7337dc)){checkContactLowerLimitOriginate(_0x5c9139,0x1,0x0);_0xe20bb1['countReScheduled'](_0x5c9139)['then'](sendMessageReschedule(_0x5c9139))[_0x6cae('0xb9')](loggerCatch(_0x6cae('0x1fe')));}else{_0x5c9139[_0x6cae('0x3e')]=_0x6cae('0x1f7');if(_['isNil'](_0x7337dc[0x0])||_['isNil'](_0x7337dc[0x0][_0x6cae('0x17c')])||_[_0x6cae('0xad')](_0x7337dc[0x0][_0x6cae('0x17c')][_0x6cae('0x165')])){_0xe20bb1[_0x6cae('0xce')](_0x6cae('0x1f8'),_0x5c9139,_0x7337dc[0x0]);}else{_0xe20bb1[_0x6cae('0xb8')](_[_0x6cae('0xd1')](_0x7337dc[0x0],[_0x6cae('0xd5'),'Contact.phone']))[_0x6cae('0xb7')](_0xe20bb1[_0x6cae('0x1da')](_0x5c9139,_0x7337dc[0x0]))[_0x6cae('0xb9')](_0xe20bb1[_0x6cae('0xcd')](_0x6cae('0x202'),_0x5c9139));}}})[_0x6cae('0xb9')](loggerGetContactDialer(_0x6cae('0x203'),_0x5c9139,0x1));emitVoiceQueueSummary(_0x5c9139);};Dialer[_0x6cae('0x1d')][_0x6cae('0x1d0')]=function(_0x7e9e34,_0x143915,_0x5dcf0b,_0x3a70e0,_0x51d714,_0x204882){loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x204'));loggerPredictive['info']('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',_0x7e9e34);loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x205'),_0x143915);loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x206'),_0x5dcf0b);loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x207'),_0x3a70e0);loggerPredictive['info'](_0x6cae('0x208'),_0x51d714);loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x83'));return new BPromise(function(_0x2c9132,_0x3b46f9){if(_0x7e9e34<=0x0||isNaN(_0x7e9e34)){return _0x3b46f9(msgResponse('[abandonmentRate]',_0x6cae('0x47'),_0x6cae('0x209')+_0x7e9e34));}if(_0x5dcf0b<=0x0||isNaN(_0x5dcf0b)){return _0x3b46f9(msgResponse(_0x6cae('0x20a'),'Error','Ts\x20=\x20'+_0x5dcf0b));}if(_0x3a70e0<=0x0||isNaN(_0x3a70e0)){return _0x3b46f9(msgResponse(_0x6cae('0x20a'),_0x6cae('0x47'),'p\x20=\x20'+_0x3a70e0));}if(_0x143915<=0x0||isNaN(_0x143915)){return _0x3b46f9(msgResponse(_0x6cae('0x20a'),_0x6cae('0x47'),'interval\x20=\x20'+_0x143915));}if(_0x51d714<=0x0||isNaN(_0x51d714)){return _0x3b46f9(msgResponse(_0x6cae('0x20a'),'Error',_0x6cae('0x20b')+_0x51d714));}_0x204882=_0x204882||0x0;var _0x2958f8=0x1/_0x5dcf0b;var _0x32e031=0x0;var _0x4f82db=0x0;var _0x415ab3=0x0;var _0x3de05a=0x0;for(var _0x3b9dd3=0x0;_0x415ab3<_0x51d714;_0x3b9dd3+=0x1){_0x4f82db=_0x3b9dd3/_0x143915;_0x32e031=(_0x3a70e0*_0x4f82db+_0x204882)/_0x2958f8;_0x415ab3=erlangb(_0x32e031,_0x7e9e34);_0x3de05a=_0x32e031/_0x7e9e34*(0x1-erlangb(_0x32e031,_0x7e9e34));}return _0x2c9132({'erlangCalls':_0x3b9dd3,'erlangCallToSecond':_0x143915/_0x3b9dd3,'erlangAbandonmentRate':_0x415ab3,'erlangBusyFactor':_0x3de05a});});};Dialer[_0x6cae('0x1d')][_0x6cae('0x1d2')]=function(_0x3f505b,_0x5e8d4d,_0x43adde,_0x1f089a,_0x2be63f,_0x22f5a8){loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x20c'));loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x20d'),_0x3f505b);loggerPredictive['info'](_0x6cae('0x205'),_0x5e8d4d);loggerPredictive['info'](_0x6cae('0x206'),_0x43adde);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1f089a);loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x20e'),_0x2be63f);loggerPredictive[_0x6cae('0x7e')](_0x6cae('0x83'));return new BPromise(function(_0x178f43,_0x94198){if(_0x3f505b<=0x0||isNaN(_0x3f505b)){return _0x94198(msgResponse(_0x6cae('0x20f'),_0x6cae('0x47'),_0x6cae('0x209')+_0x3f505b));}if(_0x43adde<=0x0||isNaN(_0x43adde)){return _0x94198(msgResponse(_0x6cae('0x20f'),_0x6cae('0x47'),_0x6cae('0x210')+_0x43adde));}if(_0x1f089a<=0x0||isNaN(_0x1f089a)){return _0x94198(msgResponse(_0x6cae('0x20f'),'Error',_0x6cae('0x211')+_0x1f089a));}if(_0x5e8d4d<=0x0||isNaN(_0x5e8d4d)){return _0x94198(msgResponse(_0x6cae('0x20f'),_0x6cae('0x47'),_0x6cae('0x212')+_0x5e8d4d));}if(_0x2be63f<=0x0||isNaN(_0x2be63f)){return _0x94198(msgResponse(_0x6cae('0x20f'),_0x6cae('0x47'),_0x6cae('0x213')+_0x2be63f));}_0x22f5a8=_0x22f5a8||0x0;var _0x2a3cee=0x1/_0x43adde;var _0x1ee2e9=0x0;var _0x5b4c7d=0x0;var _0x1277db=0x0;var _0xfe7c3f=0x0;for(var _0x328ea7=0x0;_0xfe7c3f<_0x2be63f;_0x328ea7+=0x1){_0x5b4c7d=_0x328ea7/_0x5e8d4d;_0x1ee2e9=(_0x1f089a*_0x5b4c7d+_0x22f5a8)/_0x2a3cee;_0x1277db=erlangb(_0x1ee2e9,_0x3f505b);_0xfe7c3f=_0x1ee2e9/_0x3f505b*(0x1-erlangb(_0x1ee2e9,_0x3f505b));}return _0x178f43({'erlangCalls':_0x328ea7,'erlangCallToSecond':_0x5e8d4d/_0x328ea7,'erlangAbandonmentRate':_0x1277db,'erlangBusyFactor':_0xfe7c3f});});};module[_0x6cae('0x214')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index eb06fb6..a57dd65 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 _0x84ec=['countdropretry','uniqueid','name','number','starttime','responsetime','droptime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','diff','seconds','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x3a5dfd,_0x576fa5){var _0x26636d=function(_0x3f4706){while(--_0x3f4706){_0x3a5dfd['push'](_0x3a5dfd['shift']());}};_0x26636d(++_0x576fa5);}(_0x84ec,0x136));var _0xc84e=function(_0x45640e,_0x31a1d7){_0x45640e=_0x45640e-0x0;var _0x315fa2=_0x84ec[_0x45640e];return _0x315fa2;};'use strict';var util=require(_0xc84e('0x0'));var _=require(_0xc84e('0x1'));var moment=require('moment');function getSeconds(_0x4b32b3,_0x28909e){var _0x4c427f=moment(_0x4b32b3)['milliseconds'](0x0);var _0x52087f=moment(_0x28909e)['milliseconds'](0x0);return _0x4c427f[_0xc84e('0x2')](_0x52087f,_0xc84e('0x3'));}function QueueCallerAbandon(_0x2831dc,_0x3f390c){this['scheduledat']=_0x2831dc['scheduledat'];this[_0xc84e('0x4')]=_0x2831dc[_0xc84e('0x4')];this[_0xc84e('0x5')]=_0x2831dc[_0xc84e('0x4')]===_0xc84e('0x6')?'queue':_0x2831dc[_0xc84e('0x4')];this[_0xc84e('0x7')]=_0x2831dc[_0xc84e('0x7')];this[_0xc84e('0x8')]=_0x2831dc[_0xc84e('0x8')];this[_0xc84e('0x9')]=_0x2831dc[_0xc84e('0x9')];this['countglobal']=_0x2831dc[_0xc84e('0x7')]+_0x2831dc[_0xc84e('0x8')]+_0x2831dc[_0xc84e('0x9')]+_0x2831dc[_0xc84e('0xa')]+_0x2831dc['countdropretry']+_0x2831dc[_0xc84e('0xb')]+_0x2831dc[_0xc84e('0xc')]+_0x2831dc[_0xc84e('0xd')];this['countnosuchnumberretry']=_0x2831dc[_0xc84e('0xa')];this[_0xc84e('0xe')]=_0x2831dc[_0xc84e('0xe')];this['countabandonedretry']=_0x2831dc[_0xc84e('0xb')];this[_0xc84e('0xc')]=_0x2831dc[_0xc84e('0xc')];this[_0xc84e('0xd')]=_0x2831dc[_0xc84e('0xd')];this[_0xc84e('0xf')]=_0x3f390c[_0xc84e('0xf')];this['calleridname']=_0x2831dc[_0xc84e('0x10')];this['calleridnum']=_0x2831dc[_0xc84e('0x11')];this['starttime']=_0x2831dc[_0xc84e('0x12')];this[_0xc84e('0x13')]=_0x2831dc[_0xc84e('0x13')];this[_0xc84e('0x14')]=_0x2831dc[_0xc84e('0x14')];this['endtime']=this['droptime'];this['ringtime']=getSeconds(_0x2831dc[_0xc84e('0x13')],_0x2831dc[_0xc84e('0x12')]);this['holdtime']=getSeconds(this[_0xc84e('0x14')],_0x2831dc[_0xc84e('0x13')]);this[_0xc84e('0x15')]=0x0;this[_0xc84e('0x16')]=_0x3f390c[_0xc84e('0x16')];this[_0xc84e('0x17')]=_0x3f390c['connectedlinename'];this[_0xc84e('0x18')]=_0x3f390c['reason'];this[_0xc84e('0x19')]=_0x2831dc[_0xc84e('0x19')];this[_0xc84e('0x1a')]=_0x2831dc['callbackuniqueid'];this['callbackat']=_0x2831dc[_0xc84e('0x1b')];this['recallme']=_0x2831dc[_0xc84e('0x1c')];this['ContactId']=_0x2831dc[_0xc84e('0x1d')];this['ListId']=_0x2831dc[_0xc84e('0x1e')];this[_0xc84e('0x1f')]=_0x2831dc[_0xc84e('0x1f')];this[_0xc84e('0x20')]=_0x2831dc[_0xc84e('0x20')];this[_0xc84e('0x21')]=_0x2831dc[_0xc84e('0x21')];this[_0xc84e('0x22')]=_0x2831dc['originatecalleridnum']||'';this[_0xc84e('0x23')]=_0x2831dc['originatecalleridname']||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0xdfc1=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','ringtime','holdtime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x723cce,_0x1740f9){var _0x1b3c1f=function(_0x481d3d){while(--_0x481d3d){_0x723cce['push'](_0x723cce['shift']());}};_0x1b3c1f(++_0x1740f9);}(_0xdfc1,0xbf));var _0x1dfc=function(_0x558fe9,_0x1ca3f7){_0x558fe9=_0x558fe9-0x0;var _0x554d2a=_0xdfc1[_0x558fe9];return _0x554d2a;};'use strict';var util=require(_0x1dfc('0x0'));var _=require(_0x1dfc('0x1'));var moment=require(_0x1dfc('0x2'));function getSeconds(_0x300438,_0x5d4467){var _0x3ecf1d=moment(_0x300438)[_0x1dfc('0x3')](0x0);var _0x38e1b9=moment(_0x5d4467)[_0x1dfc('0x3')](0x0);return _0x3ecf1d[_0x1dfc('0x4')](_0x38e1b9,'seconds');}function QueueCallerAbandon(_0x56347a,_0x39709f){this[_0x1dfc('0x5')]=_0x56347a[_0x1dfc('0x5')];this[_0x1dfc('0x6')]=_0x56347a[_0x1dfc('0x6')];this[_0x1dfc('0x7')]=_0x56347a[_0x1dfc('0x6')]===_0x1dfc('0x8')?_0x1dfc('0x9'):_0x56347a['type'];this[_0x1dfc('0xa')]=_0x56347a[_0x1dfc('0xa')];this[_0x1dfc('0xb')]=_0x56347a['countcongestionretry'];this[_0x1dfc('0xc')]=_0x56347a['countnoanswerretry'];this[_0x1dfc('0xd')]=_0x56347a[_0x1dfc('0xa')]+_0x56347a['countcongestionretry']+_0x56347a[_0x1dfc('0xc')]+_0x56347a[_0x1dfc('0xe')]+_0x56347a[_0x1dfc('0xf')]+_0x56347a[_0x1dfc('0x10')]+_0x56347a[_0x1dfc('0x11')]+_0x56347a[_0x1dfc('0x12')];this[_0x1dfc('0xe')]=_0x56347a[_0x1dfc('0xe')];this[_0x1dfc('0xf')]=_0x56347a[_0x1dfc('0xf')];this[_0x1dfc('0x10')]=_0x56347a[_0x1dfc('0x10')];this[_0x1dfc('0x11')]=_0x56347a[_0x1dfc('0x11')];this[_0x1dfc('0x12')]=_0x56347a['countagentrejectretry'];this[_0x1dfc('0x13')]=_0x39709f[_0x1dfc('0x13')];this[_0x1dfc('0x14')]=_0x56347a['name'];this[_0x1dfc('0x15')]=_0x56347a[_0x1dfc('0x16')];this[_0x1dfc('0x17')]=_0x56347a['starttime'];this[_0x1dfc('0x18')]=_0x56347a['responsetime'];this[_0x1dfc('0x19')]=_0x56347a[_0x1dfc('0x19')];this['endtime']=this[_0x1dfc('0x19')];this[_0x1dfc('0x1a')]=getSeconds(_0x56347a['responsetime'],_0x56347a['starttime']);this[_0x1dfc('0x1b')]=getSeconds(this['droptime'],_0x56347a[_0x1dfc('0x18')]);this['talktime']=0x0;this[_0x1dfc('0x9')]=_0x39709f['queue'];this['membername']=_0x39709f['connectedlinename'];this[_0x1dfc('0x1c')]=_0x39709f[_0x1dfc('0x1c')];this['callback']=_0x56347a[_0x1dfc('0x1d')];this[_0x1dfc('0x1e')]=_0x56347a['callbackuniqueid'];this[_0x1dfc('0x1f')]=_0x56347a[_0x1dfc('0x1f')];this[_0x1dfc('0x20')]=_0x56347a['recallme'];this[_0x1dfc('0x21')]=_0x56347a[_0x1dfc('0x21')];this[_0x1dfc('0x22')]=_0x56347a[_0x1dfc('0x22')];this[_0x1dfc('0x23')]=_0x56347a[_0x1dfc('0x23')];this[_0x1dfc('0x24')]=_0x56347a['VoiceQueueId'];this[_0x1dfc('0x25')]=_0x56347a[_0x1dfc('0x25')];this[_0x1dfc('0x26')]=_0x56347a[_0x1dfc('0x26')]||'';this[_0x1dfc('0x27')]=_0x56347a[_0x1dfc('0x27')]||'';}module[_0x1dfc('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 f662bb2..75d6f2d 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 _0x2272=['localstationid','headerinfo','path','AttachmentId','util','lodash','%s/%s/%s','Trunk','name','fax'];(function(_0xdc5664,_0x4eef5a){var _0xd65a92=function(_0x73d50){while(--_0x73d50){_0xdc5664['push'](_0xdc5664['shift']());}};_0xd65a92(++_0x4eef5a);}(_0x2272,0x162));var _0x2227=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2272[_0x17d9e3];return _0x14192d;};'use strict';var util=require(_0x2227('0x0'));var _=require(_0x2227('0x1'));var moment=require('moment');function Action(_0x5e6a26,_0x14c82e,_0x2b8115){this['uniqueid']=_0x5e6a26||undefined;this['channel']=util['format'](_0x2227('0x2'),_0x14c82e['tech'],_0x14c82e[_0x2227('0x3')][_0x2227('0x4')],_0x2b8115[_0x2227('0x5')]);this['localstationid']=_0x14c82e[_0x2227('0x6')];this[_0x2227('0x7')]=_0x14c82e[_0x2227('0x7')];this['path']=_0x2b8115[_0x2227('0x8')];this[_0x2227('0x9')]=_0x2b8115['AttachmentId'];}module['exports']=Action; \ No newline at end of file +var _0xe904=['Trunk','fax','localstationid','headerinfo','path','AttachmentId','exports','util','lodash','moment','uniqueid','channel','format','%s/%s/%s'];(function(_0x534e71,_0x46f901){var _0x3b5fcc=function(_0x3d4407){while(--_0x3d4407){_0x534e71['push'](_0x534e71['shift']());}};_0x3b5fcc(++_0x46f901);}(_0xe904,0x149));var _0x4e90=function(_0x33b94a,_0x275fc3){_0x33b94a=_0x33b94a-0x0;var _0x33efca=_0xe904[_0x33b94a];return _0x33efca;};'use strict';var util=require(_0x4e90('0x0'));var _=require(_0x4e90('0x1'));var moment=require(_0x4e90('0x2'));function Action(_0x250798,_0x436418,_0xb31b56){this[_0x4e90('0x3')]=_0x250798||undefined;this[_0x4e90('0x4')]=util[_0x4e90('0x5')](_0x4e90('0x6'),_0x436418['tech'],_0x436418[_0x4e90('0x7')]['name'],_0xb31b56[_0x4e90('0x8')]);this[_0x4e90('0x9')]=_0x436418[_0x4e90('0x9')];this[_0x4e90('0xa')]=_0x436418[_0x4e90('0xa')];this[_0x4e90('0xb')]=_0xb31b56[_0x4e90('0xb')];this[_0x4e90('0xc')]=_0xb31b56[_0x4e90('0xc')];}module[_0x4e90('0xd')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 17bfe4d..2f20ee6 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 _0x03be=['util','lodash','moment','path','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','originateresponse','syncOriginateResponse','context','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','syncVarSet','variable','value','prototype','channelstate','channelstatedesc','syncNewExten','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','message','create','parse','.pdf','application/pdf','notify','error','\x20notify\x20','\x20receiveFax\x20','stringify','merge','pick','update','AttachmentId','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','catch','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','faxpages','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','send','execOriginate','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','format','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid'];(function(_0x54f127,_0x573d75){var _0x40a483=function(_0x108d77){while(--_0x108d77){_0x54f127['push'](_0x54f127['shift']());}};_0x40a483(++_0x573d75);}(_0x03be,0xe8));var _0xe03b=function(_0x1ef16d,_0x2a49e0){_0x1ef16d=_0x1ef16d-0x0;var _0x337826=_0x03be[_0x1ef16d];return _0x337826;};'use strict';var util=require(_0xe03b('0x0'));var _=require(_0xe03b('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0xe03b('0x2'));var path=require(_0xe03b('0x3'));var tiff2pdf=require(_0xe03b('0x4'));var gs=require(_0xe03b('0x5'));var logger=require('../../../config/logger')(_0xe03b('0x6'));var ami=require(_0xe03b('0x7'));var rpcDb=require(_0xe03b('0x8'));var Channel=require(_0xe03b('0x9'));var ut=require(_0xe03b('0xa'));var Action=require(_0xe03b('0xb'));var faxAccount=require(_0xe03b('0xc'));var attachment=require(_0xe03b('0xd'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x4c9674){this[_0xe03b('0xe')]={};this[_0xe03b('0xf')]=_0x4c9674[_0xe03b('0xf')];this[_0xe03b('0x10')]=_0x4c9674[_0xe03b('0x10')];this[_0xe03b('0x11')]={};ami['on'](_0xe03b('0x12'),this[_0xe03b('0x13')][_0xe03b('0x14')](this));ami['on'](_0xe03b('0x15'),this['syncVarSet']['bind'](this));ami['on'](_0xe03b('0x16'),this[_0xe03b('0x17')][_0xe03b('0x14')](this));ami['on'](_0xe03b('0x18'),this['syncNewExten']['bind'](this));ami['on'](_0xe03b('0x19'),this[_0xe03b('0x1a')][_0xe03b('0x14')](this));ami['on'](_0xe03b('0x1b'),this[_0xe03b('0x1c')][_0xe03b('0x14')](this));ami['on']('hangup',this['syncHangup'][_0xe03b('0x14')](this));ami['on'](_0xe03b('0x1d'),this[_0xe03b('0x1e')]['bind'](this));}Fax['prototype'][_0xe03b('0x13')]=function(_0x158706){if(_0x158706[_0xe03b('0x1f')]==='from-voip-provider'){for(var _0x2b353e in this[_0xe03b('0xf')]){if(this[_0xe03b('0xf')][_0xe03b('0x20')](_0x2b353e)){if(_0x158706['exten']===this['faxAccounts'][_0x2b353e][_0xe03b('0x21')]){this['channels'][_0x158706['uniqueid']]={};this[_0xe03b('0xe')][_0x158706[_0xe03b('0x22')]][_0xe03b('0x23')]=_0x158706[_0xe03b('0x23')];this[_0xe03b('0xe')][_0x158706['uniqueid']]['id']=this[_0xe03b('0xf')][_0x2b353e]['id'];this[_0xe03b('0xe')][_0x158706[_0xe03b('0x22')]][_0xe03b('0x24')]=this['faxAccounts'][_0x2b353e][_0xe03b('0x24')];logger[_0xe03b('0x25')](_0x158706[_0xe03b('0x22')],_0xe03b('0x26'));}}}}if(this['actions'][_0x158706[_0xe03b('0x22')]]){this[_0xe03b('0xe')][_0x158706['uniqueid']]={};this[_0xe03b('0xe')][_0x158706[_0xe03b('0x22')]][_0xe03b('0x23')]=_0x158706[_0xe03b('0x23')];logger[_0xe03b('0x25')](_0x158706[_0xe03b('0x22')],_0xe03b('0x26'));}};Fax['prototype'][_0xe03b('0x27')]=function(_0x403bad){if(this['channels'][_0x403bad[_0xe03b('0x22')]]){for(var _0x3fc6a1 in _0x403bad['variable']){if(_0x403bad[_0xe03b('0x28')][_0xe03b('0x20')](_0x3fc6a1)){this[_0xe03b('0xe')][_0x403bad[_0xe03b('0x22')]][_0x3fc6a1]=_0x403bad[_0xe03b('0x29')];}}}};Fax[_0xe03b('0x2a')][_0xe03b('0x17')]=function(_0x2a5765){if(this[_0xe03b('0xe')][_0x2a5765[_0xe03b('0x22')]]){this[_0xe03b('0xe')][_0x2a5765['uniqueid']][_0xe03b('0x2b')]=_0x2a5765[_0xe03b('0x2b')];this[_0xe03b('0xe')][_0x2a5765['uniqueid']][_0xe03b('0x2c')]=_0x2a5765['channelstatedesc'];}};Fax[_0xe03b('0x2a')][_0xe03b('0x2d')]=function(_0x3d593a){if(this[_0xe03b('0xe')][_0x3d593a[_0xe03b('0x22')]]){for(var _0x2ed8a4 in _0x3d593a[_0xe03b('0x28')]){if(_0x3d593a[_0xe03b('0x28')][_0xe03b('0x20')](_0x2ed8a4)){this[_0xe03b('0xe')][_0x3d593a[_0xe03b('0x22')]][_0x2ed8a4]=_0x3d593a['value'];}}}};Fax['prototype']['syncFaxStatus']=function(_0x8881e6){if(this[_0xe03b('0xe')][_0x8881e6['uniqueid']]){this['channels'][_0x8881e6[_0xe03b('0x22')]][_0xe03b('0x2e')]=_0x8881e6[_0xe03b('0x2e')];this[_0xe03b('0xe')][_0x8881e6['uniqueid']][_0xe03b('0x2f')]=_0x8881e6[_0xe03b('0x2f')];this['channels'][_0x8881e6[_0xe03b('0x22')]][_0xe03b('0x21')]=_0x8881e6[_0xe03b('0x21')];this['channels'][_0x8881e6[_0xe03b('0x22')]]['filename']=_0x8881e6[_0xe03b('0x30')];logger['info'](_0x8881e6[_0xe03b('0x22')],'\x20syncFaxStatus\x20');}};Fax[_0xe03b('0x2a')][_0xe03b('0x1c')]=function(_0x442a08){var _0x564e06=this;if(this[_0xe03b('0xe')][_0x442a08['uniqueid']]){var _0x2ec301=this[_0xe03b('0xe')][_0x442a08[_0xe03b('0x22')]]['id'];this['channels'][_0x442a08[_0xe03b('0x22')]][_0xe03b('0x31')]=_0x442a08['remotestationid'];this[_0xe03b('0xe')][_0x442a08['uniqueid']]['pagestransferred']=_0x442a08[_0xe03b('0x32')];this[_0xe03b('0xe')][_0x442a08[_0xe03b('0x22')]][_0xe03b('0x21')]=_0x442a08[_0xe03b('0x21')];this[_0xe03b('0xe')][_0x442a08['uniqueid']][_0xe03b('0x33')]=_0x442a08[_0xe03b('0x33')];this['channels'][_0x442a08[_0xe03b('0x22')]][_0xe03b('0x34')]=_0x442a08['transferrate'];this[_0xe03b('0xe')][_0x442a08[_0xe03b('0x22')]][_0xe03b('0x30')]=_0x442a08[_0xe03b('0x30')];this[_0xe03b('0xe')][_0x442a08[_0xe03b('0x22')]][_0xe03b('0x35')]=_0x442a08[_0xe03b('0x35')];if(this[_0xe03b('0xe')][_0x442a08[_0xe03b('0x22')]][_0xe03b('0x32')]>0x0){tiff2pdf(_0x442a08[_0xe03b('0x30')],'/var/opt/motion2/server/files/attachments/',function(_0x2a65c8){logger['info'](_0x442a08[_0xe03b('0x22')],'\x20result\x20conversion\x20file\x20',_0x2a65c8[_0xe03b('0x36')]);attachment[_0xe03b('0x37')]({'name':path['parse'](_0x442a08[_0xe03b('0x30')])[_0xe03b('0x24')],'basename':path[_0xe03b('0x38')](_0x442a08[_0xe03b('0x30')])[_0xe03b('0x24')]+_0xe03b('0x39'),'type':_0xe03b('0x3a')})['then'](function(_0x17c504){faxAccount[_0xe03b('0x3b')](_0x2ec301,{'from':_0x442a08[_0xe03b('0x35')],'mapKey':_0xe03b('0x6'),'body':path[_0xe03b('0x38')](_0x442a08[_0xe03b('0x30')])[_0xe03b('0x24')]+_0xe03b('0x39'),'AttachmentId':_0x17c504['id']})['catch'](function(_0x2d7470){logger[_0xe03b('0x3c')](_0x442a08[_0xe03b('0x22')],_0xe03b('0x3d'),JSON['stringify'](_0x2d7470));});})['catch'](function(_0x23028e){logger[_0xe03b('0x3c')](_0x442a08[_0xe03b('0x22')],_0xe03b('0x3e'),JSON[_0xe03b('0x3f')](_0x23028e));});});}logger[_0xe03b('0x25')](_0x442a08[_0xe03b('0x22')],_0xe03b('0x3e'));}};Fax['prototype'][_0xe03b('0x1e')]=function(_0x2fa44f){if(this[_0xe03b('0x11')][_0x2fa44f[_0xe03b('0x22')]]){_[_0xe03b('0x40')](this[_0xe03b('0xe')][_0x2fa44f[_0xe03b('0x22')]],_[_0xe03b('0x41')](_0x2fa44f,['response','reason']));}};function updateStatus(_0x6617e8){if(_0x6617e8['AttachmentId']){faxMessage[_0xe03b('0x42')](_0x6617e8[_0xe03b('0x43')],{'failMessage':_0xe03b('0x44')})[_0xe03b('0x45')](function(_0x455135){ut[_0xe03b('0x46')](_0xe03b('0x47'),_0x455135);})['catch'](function(_0x5f4230){ut[_0xe03b('0x46')]('[Fax][Message][Error][NoUpdate1]',_0x5f4230);});}else{ut[_0xe03b('0x46')](_0xe03b('0x48'));}}Fax['prototype'][_0xe03b('0x49')]=function(_0x186dba,_0x1539fa,_0x5d36ba){var _0x351531=this;var _0x39154b={};if(_0x1539fa){_0x39154b={'read':_0x1539fa};}else{_0x39154b={'failMessage':_0x5d36ba};}if(this[_0xe03b('0x11')][_0x186dba]['AttachmentId']){faxMessage[_0xe03b('0x42')](this[_0xe03b('0x11')][_0x186dba][_0xe03b('0x43')],_0x39154b)[_0xe03b('0x45')](function(_0x1e7ece){ut[_0xe03b('0x46')](_0xe03b('0x4a'),_0x1e7ece);})[_0xe03b('0x4b')](function(_0xd2e495){ut[_0xe03b('0x46')](_0xe03b('0x4c'),_0xd2e495);})['finally'](function(){delete _0x351531[_0xe03b('0xe')][_0x186dba];delete _0x351531[_0xe03b('0x11')][_0x186dba];});}else{ut[_0xe03b('0x46')](_0xe03b('0x4d'));delete this[_0xe03b('0xe')][_0x186dba];delete this['actions'][_0x186dba];}};Fax[_0xe03b('0x2a')][_0xe03b('0x4e')]=function(_0x3dad22){var _0x16ce65=this;if(this[_0xe03b('0xe')][_0x3dad22[_0xe03b('0x22')]]){if(this['actions'][_0x3dad22['uniqueid']]){this[_0xe03b('0xe')][_0x3dad22['uniqueid']]['id']=this[_0xe03b('0x11')][_0x3dad22['uniqueid']]['id'];this[_0xe03b('0xe')][_0x3dad22[_0xe03b('0x22')]]['name']=this[_0xe03b('0x11')][_0x3dad22[_0xe03b('0x22')]]['name'];}logger[_0xe03b('0x25')](_0x3dad22['uniqueid'],this['actions'][_0x3dad22[_0xe03b('0x22')]]?_0xe03b('0x4f'):'\x20hangup\x20faxRiceive\x20',JSON[_0xe03b('0x3f')](this[_0xe03b('0xe')][_0x3dad22[_0xe03b('0x22')]]));if(this[_0xe03b('0x11')][_0x3dad22['uniqueid']]){if(this[_0xe03b('0xe')][_0x3dad22[_0xe03b('0x22')]][_0xe03b('0x50')]>0x0&&this[_0xe03b('0xe')][_0x3dad22[_0xe03b('0x22')]][_0xe03b('0x19')]==='SUCCESS'){this[_0xe03b('0x49')](_0x3dad22['uniqueid'],!![]);}else{this[_0xe03b('0x49')](_0x3dad22[_0xe03b('0x22')],![],this[_0xe03b('0xe')][_0x3dad22[_0xe03b('0x22')]]['faxstatusstring']?_0xe03b('0x51')+this[_0xe03b('0xe')][_0x3dad22['uniqueid']][_0xe03b('0x52')]:_0xe03b('0x53'));}}}};Fax['prototype'][_0xe03b('0x54')]=function(_0x106673){var _0x10a04c=this;return new BPromise(function(_0x2a6c83,_0x2e220b){_0x10a04c[_0xe03b('0x55')](_0x106673,_0x10a04c[_0xe03b('0xf')][_0x106673['FaxAccountId']])[_0xe03b('0x45')](function(_0x664fde){ut[_0xe03b('0x46')]('[Fax][execOriginate][success]',_0x664fde);_0x2a6c83(ut[_0xe03b('0x36')](_0xe03b('0x56')));})['catch'](function(_0x6f345){ut[_0xe03b('0x46')](_0xe03b('0x57'),_0x6f345);updateStatus(_0x106673);_0x2e220b(ut['message'](_0xe03b('0x58')));});});};Fax[_0xe03b('0x2a')]['checkAfterSend']=function(_0xef8d92){var _0x12f511=this;return new BPromise(function(_0xf48b71,_0xadf22c){var _0x44269d=_0x12f511[_0xe03b('0x59')](_0x12f511['faxAccounts'][_0xef8d92[_0xe03b('0x5a')]][_0xe03b('0x5b')],_0xef8d92);if(_0x44269d[_0xe03b('0x5c')]){_0xf48b71(ut[_0xe03b('0x36')](_0xe03b('0x5d')));}else{_0xadf22c(ut[_0xe03b('0x36')](_0x44269d['message']));}});};function originate(_0x33a8bb,_0x4b4176,_0x30936e){return new BPromise(function(_0x1767bc,_0x1cd25c){if(_0x30936e){var _0x12b91b=util['format'](_0xe03b('0x5e'),path[_0xe03b('0x38')](_0x33a8bb[_0xe03b('0x3')])[_0xe03b('0x24')],_0x33a8bb[_0xe03b('0x3')]);gs[_0xe03b('0x5f')](_0x12b91b)[_0xe03b('0x45')](function(){_0x33a8bb[_0xe03b('0x3')]=util[_0xe03b('0x60')](_0xe03b('0x61'),path[_0xe03b('0x38')](_0x33a8bb['path'])['dir'],path[_0xe03b('0x38')](_0x33a8bb['path'])[_0xe03b('0x24')]);_0x4b4176[_0xe03b('0x62')]=_0x33a8bb[_0xe03b('0x3')];ut['logger'](_0xe03b('0x63'),'');ami[_0xe03b('0x64')](ut[_0xe03b('0x65')](_0x33a8bb,_0x4b4176))[_0xe03b('0x45')](function(_0x47a609){_0x1767bc(_0x47a609);})[_0xe03b('0x4b')](function(_0x85e208){_0x1cd25c(_0x85e208);});})[_0xe03b('0x4b')](function(_0x578fa1){_0x1cd25c(_0x578fa1);});}else{ami['Action'](ut['variablesAction'](_0x33a8bb,_0x4b4176))[_0xe03b('0x45')](function(_0x15cd99){_0x1767bc(_0x15cd99);})['catch'](function(_0x5afe3b){_0x1cd25c(_0x5afe3b);});}});}Fax[_0xe03b('0x2a')][_0xe03b('0x55')]=function(_0x43cf62,_0x3ecec1){var _0x351848=this;return new BPromise(function(_0x4afbfd,_0x240c15){var _0xd9db5f=uuid['v4']();var _0x575122=ut[_0xe03b('0x66')](_0x43cf62,_0x3ecec1);_0x351848[_0xe03b('0x11')][_0xd9db5f]=new Action(_0xd9db5f,_0x3ecec1,_0x43cf62);var _0x30248a=_0x351848[_0xe03b('0x11')][_0xd9db5f];if(path[_0xe03b('0x38')](_0x43cf62[_0xe03b('0x3')])[_0xe03b('0x67')]===_0xe03b('0x39')){originate(_0x30248a,_0x575122,!![])[_0xe03b('0x45')](function(_0x56a70c){_0x4afbfd(_0x56a70c);})[_0xe03b('0x4b')](function(_0x43cdc3){_0x240c15(_0x43cdc3);});}else{originate(_0x30248a,_0x575122,![])['then'](function(_0x1b1c61){_0x4afbfd(_0x1b1c61);})[_0xe03b('0x4b')](function(_0x462771){_0x240c15(_0x462771);});}});};Fax['prototype'][_0xe03b('0x68')]=function(_0x4b2fa1){return!_[_0xe03b('0x69')](_0x4b2fa1)&&!_[_0xe03b('0x69')](_0x4b2fa1[_0xe03b('0x24')])&&!_[_0xe03b('0x69')](_0x4b2fa1[_0xe03b('0x6a')])&&_0x4b2fa1[_0xe03b('0x6a')]&&!_['isNil'](this['trunks'][util[_0xe03b('0x60')]('SIP/%s',_0x4b2fa1[_0xe03b('0x24')])])&&!_['isNil'](this['trunks'][util[_0xe03b('0x60')](_0xe03b('0x6b'),_0x4b2fa1[_0xe03b('0x24')])]['status'])&&(this['trunks'][util['format'](_0xe03b('0x6b'),_0x4b2fa1[_0xe03b('0x24')])][_0xe03b('0x2f')]==='reachable'||this[_0xe03b('0x10')][util[_0xe03b('0x60')](_0xe03b('0x6b'),_0x4b2fa1[_0xe03b('0x24')])]['status']===_0xe03b('0x6c'));};Fax[_0xe03b('0x2a')][_0xe03b('0x59')]=function(_0x1bbef6,_0x49b10d){if(!this[_0xe03b('0x68')](_0x1bbef6)){ut[_0xe03b('0x46')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0xe03b('0x69')](_0x1bbef6)?'':_0x1bbef6[_0xe03b('0x24')]+_0xe03b('0x6d'));return{'isValid':![],'message':_0xe03b('0x6e')};}if(_[_0xe03b('0x69')](_0x49b10d[_0xe03b('0x6')])){ut[_0xe03b('0x46')](_0xe03b('0x6f'),JSON['stringify'](_0x49b10d));return{'isValid':![],'message':_0xe03b('0x70')};}if(_[_0xe03b('0x69')](_0x49b10d[_0xe03b('0x3')])){ut[_0xe03b('0x46')](_0xe03b('0x71'),JSON[_0xe03b('0x3f')](_0x49b10d));return{'isValid':![],'message':_0xe03b('0x72')};}return{'isValid':!![],'message':_0xe03b('0x73')};};module['exports']=Fax; \ No newline at end of file +var _0x3425=['./util/gs','../../../config/logger','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','bind','varset','syncVarSet','newstate','syncNewState','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','syncNewchannel','context','from-voip-provider','localstationid','channel','uniqueid','name','info','\x20syncNewchannel\x20','prototype','variable','hasOwnProperty','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','actions','AttachmentId','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','execOriginate','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path'];(function(_0x158e6c,_0xaab4ed){var _0x3c26db=function(_0x3c57dd){while(--_0x3c57dd){_0x158e6c['push'](_0x158e6c['shift']());}};_0x3c26db(++_0xaab4ed);}(_0x3425,0xee));var _0x5342=function(_0x2a9d1f,_0x2d2116){_0x2a9d1f=_0x2a9d1f-0x0;var _0x161345=_0x3425[_0x2a9d1f];return _0x161345;};'use strict';var util=require(_0x5342('0x0'));var _=require(_0x5342('0x1'));var BPromise=require(_0x5342('0x2'));var uuid=require(_0x5342('0x3'));var moment=require(_0x5342('0x4'));var path=require(_0x5342('0x5'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x5342('0x6'));var logger=require(_0x5342('0x7'))('fax');var ami=require(_0x5342('0x8'));var rpcDb=require(_0x5342('0x9'));var Channel=require(_0x5342('0xa'));var ut=require(_0x5342('0xb'));var Action=require(_0x5342('0xc'));var faxAccount=require(_0x5342('0xd'));var attachment=require(_0x5342('0xe'));var faxMessage=require(_0x5342('0xf'));function Fax(_0x2bb545){this[_0x5342('0x10')]={};this[_0x5342('0x11')]=_0x2bb545[_0x5342('0x11')];this[_0x5342('0x12')]=_0x2bb545[_0x5342('0x12')];this['actions']={};ami['on'](_0x5342('0x13'),this['syncNewchannel'][_0x5342('0x14')](this));ami['on'](_0x5342('0x15'),this[_0x5342('0x16')][_0x5342('0x14')](this));ami['on'](_0x5342('0x17'),this[_0x5342('0x18')][_0x5342('0x14')](this));ami['on']('newexten',this[_0x5342('0x19')]['bind'](this));ami['on'](_0x5342('0x1a'),this[_0x5342('0x1b')][_0x5342('0x14')](this));ami['on'](_0x5342('0x1c'),this[_0x5342('0x1d')][_0x5342('0x14')](this));ami['on']('hangup',this[_0x5342('0x1e')]['bind'](this));ami['on'](_0x5342('0x1f'),this[_0x5342('0x20')]['bind'](this));}Fax['prototype'][_0x5342('0x21')]=function(_0x2289a6){if(_0x2289a6[_0x5342('0x22')]===_0x5342('0x23')){for(var _0x53258e in this[_0x5342('0x11')]){if(this[_0x5342('0x11')]['hasOwnProperty'](_0x53258e)){if(_0x2289a6['exten']===this['faxAccounts'][_0x53258e][_0x5342('0x24')]){this[_0x5342('0x10')][_0x2289a6['uniqueid']]={};this[_0x5342('0x10')][_0x2289a6['uniqueid']]['channel']=_0x2289a6[_0x5342('0x25')];this['channels'][_0x2289a6['uniqueid']]['id']=this[_0x5342('0x11')][_0x53258e]['id'];this['channels'][_0x2289a6[_0x5342('0x26')]][_0x5342('0x27')]=this[_0x5342('0x11')][_0x53258e]['name'];logger[_0x5342('0x28')](_0x2289a6['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x2289a6[_0x5342('0x26')]]){this[_0x5342('0x10')][_0x2289a6['uniqueid']]={};this['channels'][_0x2289a6[_0x5342('0x26')]][_0x5342('0x25')]=_0x2289a6[_0x5342('0x25')];logger[_0x5342('0x28')](_0x2289a6[_0x5342('0x26')],_0x5342('0x29'));}};Fax[_0x5342('0x2a')][_0x5342('0x16')]=function(_0x4389ec){if(this['channels'][_0x4389ec[_0x5342('0x26')]]){for(var _0x2bc287 in _0x4389ec[_0x5342('0x2b')]){if(_0x4389ec[_0x5342('0x2b')][_0x5342('0x2c')](_0x2bc287)){this[_0x5342('0x10')][_0x4389ec[_0x5342('0x26')]][_0x2bc287]=_0x4389ec[_0x5342('0x2d')];}}}};Fax[_0x5342('0x2a')][_0x5342('0x18')]=function(_0x625c42){if(this[_0x5342('0x10')][_0x625c42[_0x5342('0x26')]]){this[_0x5342('0x10')][_0x625c42['uniqueid']][_0x5342('0x2e')]=_0x625c42[_0x5342('0x2e')];this[_0x5342('0x10')][_0x625c42[_0x5342('0x26')]][_0x5342('0x2f')]=_0x625c42[_0x5342('0x2f')];}};Fax[_0x5342('0x2a')][_0x5342('0x19')]=function(_0xa75188){if(this['channels'][_0xa75188['uniqueid']]){for(var _0x3594e6 in _0xa75188['variable']){if(_0xa75188[_0x5342('0x2b')][_0x5342('0x2c')](_0x3594e6)){this[_0x5342('0x10')][_0xa75188[_0x5342('0x26')]][_0x3594e6]=_0xa75188['value'];}}}};Fax['prototype']['syncFaxStatus']=function(_0x2d2fbc){if(this[_0x5342('0x10')][_0x2d2fbc[_0x5342('0x26')]]){this['channels'][_0x2d2fbc['uniqueid']]['operation']=_0x2d2fbc[_0x5342('0x30')];this[_0x5342('0x10')][_0x2d2fbc[_0x5342('0x26')]][_0x5342('0x31')]=_0x2d2fbc[_0x5342('0x31')];this['channels'][_0x2d2fbc['uniqueid']]['localstationid']=_0x2d2fbc[_0x5342('0x24')];this['channels'][_0x2d2fbc['uniqueid']][_0x5342('0x32')]=_0x2d2fbc['filename'];logger[_0x5342('0x28')](_0x2d2fbc[_0x5342('0x26')],_0x5342('0x33'));}};Fax[_0x5342('0x2a')][_0x5342('0x1d')]=function(_0x3c7b67){var _0x33f0e4=this;if(this[_0x5342('0x10')][_0x3c7b67[_0x5342('0x26')]]){var _0x9e7dcb=this[_0x5342('0x10')][_0x3c7b67[_0x5342('0x26')]]['id'];this[_0x5342('0x10')][_0x3c7b67[_0x5342('0x26')]][_0x5342('0x34')]=_0x3c7b67[_0x5342('0x34')];this[_0x5342('0x10')][_0x3c7b67[_0x5342('0x26')]]['pagestransferred']=_0x3c7b67[_0x5342('0x35')];this[_0x5342('0x10')][_0x3c7b67['uniqueid']][_0x5342('0x24')]=_0x3c7b67[_0x5342('0x24')];this['channels'][_0x3c7b67[_0x5342('0x26')]][_0x5342('0x36')]=_0x3c7b67[_0x5342('0x36')];this['channels'][_0x3c7b67[_0x5342('0x26')]][_0x5342('0x37')]=_0x3c7b67[_0x5342('0x37')];this[_0x5342('0x10')][_0x3c7b67[_0x5342('0x26')]][_0x5342('0x32')]=_0x3c7b67[_0x5342('0x32')];this[_0x5342('0x10')][_0x3c7b67[_0x5342('0x26')]][_0x5342('0x38')]=_0x3c7b67[_0x5342('0x38')];if(this[_0x5342('0x10')][_0x3c7b67[_0x5342('0x26')]][_0x5342('0x35')]>0x0){tiff2pdf(_0x3c7b67['filename'],_0x5342('0x39'),function(_0x227ea8){logger['info'](_0x3c7b67[_0x5342('0x26')],_0x5342('0x3a'),_0x227ea8[_0x5342('0x3b')]);attachment[_0x5342('0x3c')]({'name':path[_0x5342('0x3d')](_0x3c7b67['filename'])[_0x5342('0x27')],'basename':path[_0x5342('0x3d')](_0x3c7b67[_0x5342('0x32')])['name']+_0x5342('0x3e'),'type':_0x5342('0x3f')})['then'](function(_0x4519e8){faxAccount[_0x5342('0x40')](_0x9e7dcb,{'from':_0x3c7b67[_0x5342('0x38')],'mapKey':'fax','body':path['parse'](_0x3c7b67[_0x5342('0x32')])[_0x5342('0x27')]+_0x5342('0x3e'),'AttachmentId':_0x4519e8['id']})[_0x5342('0x41')](function(_0x131a10){logger[_0x5342('0x42')](_0x3c7b67[_0x5342('0x26')],_0x5342('0x43'),JSON[_0x5342('0x44')](_0x131a10));});})['catch'](function(_0x4ab3e2){logger[_0x5342('0x42')](_0x3c7b67[_0x5342('0x26')],'\x20receiveFax\x20',JSON['stringify'](_0x4ab3e2));});});}logger[_0x5342('0x28')](_0x3c7b67[_0x5342('0x26')],_0x5342('0x45'));}};Fax[_0x5342('0x2a')][_0x5342('0x20')]=function(_0x1cc91e){if(this['actions'][_0x1cc91e['uniqueid']]){_[_0x5342('0x46')](this[_0x5342('0x10')][_0x1cc91e['uniqueid']],_[_0x5342('0x47')](_0x1cc91e,[_0x5342('0x48'),_0x5342('0x49')]));}};function updateStatus(_0x152bfd){if(_0x152bfd['AttachmentId']){faxMessage[_0x5342('0x4a')](_0x152bfd['AttachmentId'],{'failMessage':_0x5342('0x4b')})[_0x5342('0x4c')](function(_0x5526b7){ut[_0x5342('0x4d')]('[Fax][Message][Error][Updated]',_0x5526b7);})['catch'](function(_0x43fada){ut['logger'](_0x5342('0x4e'),_0x43fada);});}else{ut[_0x5342('0x4d')](_0x5342('0x4f'));}}Fax['prototype'][_0x5342('0x50')]=function(_0x3ad44a,_0x469960,_0x5c073d){var _0x47abb5=this;var _0x105afb={};if(_0x469960){_0x105afb={'read':_0x469960};}else{_0x105afb={'failMessage':_0x5c073d};}if(this[_0x5342('0x51')][_0x3ad44a][_0x5342('0x52')]){faxMessage[_0x5342('0x4a')](this['actions'][_0x3ad44a][_0x5342('0x52')],_0x105afb)[_0x5342('0x4c')](function(_0x3df967){ut[_0x5342('0x4d')](_0x5342('0x53'),_0x3df967);})[_0x5342('0x41')](function(_0xbd0a37){ut[_0x5342('0x4d')](_0x5342('0x54'),_0xbd0a37);})[_0x5342('0x55')](function(){delete _0x47abb5[_0x5342('0x10')][_0x3ad44a];delete _0x47abb5[_0x5342('0x51')][_0x3ad44a];});}else{ut[_0x5342('0x4d')](_0x5342('0x56'));delete this[_0x5342('0x10')][_0x3ad44a];delete this[_0x5342('0x51')][_0x3ad44a];}};Fax['prototype'][_0x5342('0x1e')]=function(_0x3dbe3d){var _0xbbf92=this;if(this[_0x5342('0x10')][_0x3dbe3d[_0x5342('0x26')]]){if(this[_0x5342('0x51')][_0x3dbe3d['uniqueid']]){this[_0x5342('0x10')][_0x3dbe3d['uniqueid']]['id']=this['actions'][_0x3dbe3d[_0x5342('0x26')]]['id'];this[_0x5342('0x10')][_0x3dbe3d[_0x5342('0x26')]]['name']=this[_0x5342('0x51')][_0x3dbe3d[_0x5342('0x26')]][_0x5342('0x27')];}logger['info'](_0x3dbe3d[_0x5342('0x26')],this[_0x5342('0x51')][_0x3dbe3d[_0x5342('0x26')]]?'\x20hangup\x20sendFile\x20':'\x20hangup\x20faxRiceive\x20',JSON[_0x5342('0x44')](this[_0x5342('0x10')][_0x3dbe3d[_0x5342('0x26')]]));if(this['actions'][_0x3dbe3d['uniqueid']]){if(this[_0x5342('0x10')][_0x3dbe3d['uniqueid']][_0x5342('0x57')]>0x0&&this[_0x5342('0x10')][_0x3dbe3d[_0x5342('0x26')]]['faxstatus']===_0x5342('0x58')){this[_0x5342('0x50')](_0x3dbe3d[_0x5342('0x26')],!![]);}else{this[_0x5342('0x50')](_0x3dbe3d[_0x5342('0x26')],![],this[_0x5342('0x10')][_0x3dbe3d[_0x5342('0x26')]][_0x5342('0x59')]?'SENDING\x20FAILED:\x20'+this[_0x5342('0x10')][_0x3dbe3d['uniqueid']][_0x5342('0x59')]:_0x5342('0x5a'));}}}};Fax['prototype'][_0x5342('0x5b')]=function(_0x42c676){var _0x10c1fa=this;return new BPromise(function(_0x50d1de,_0x50b478){_0x10c1fa[_0x5342('0x5c')](_0x42c676,_0x10c1fa[_0x5342('0x11')][_0x42c676['FaxAccountId']])[_0x5342('0x4c')](function(_0x287c8f){ut[_0x5342('0x4d')]('[Fax][execOriginate][success]',_0x287c8f);_0x50d1de(ut[_0x5342('0x3b')](_0x5342('0x5d')));})[_0x5342('0x41')](function(_0x192e4d){ut[_0x5342('0x4d')]('[Fax][execOriginate][failure]',_0x192e4d);updateStatus(_0x42c676);_0x50b478(ut[_0x5342('0x3b')](_0x5342('0x5e')));});});};Fax['prototype'][_0x5342('0x5f')]=function(_0x4566cc){var _0x1b81cc=this;return new BPromise(function(_0x22d591,_0x19df23){var _0x4f27b7=_0x1b81cc[_0x5342('0x60')](_0x1b81cc['faxAccounts'][_0x4566cc[_0x5342('0x61')]][_0x5342('0x62')],_0x4566cc);if(_0x4f27b7[_0x5342('0x63')]){_0x22d591(ut[_0x5342('0x3b')](_0x5342('0x64')));}else{_0x19df23(ut[_0x5342('0x3b')](_0x4f27b7[_0x5342('0x3b')]));}});};function originate(_0x3ef1f6,_0x1e6dc0,_0x1cdbe3){return new BPromise(function(_0x2603b0,_0x182e74){if(_0x1cdbe3){var _0x8371d3=util[_0x5342('0x65')](_0x5342('0x66'),path[_0x5342('0x3d')](_0x3ef1f6['path'])[_0x5342('0x27')],_0x3ef1f6[_0x5342('0x5')]);gs[_0x5342('0x67')](_0x8371d3)[_0x5342('0x4c')](function(){_0x3ef1f6[_0x5342('0x5')]=util[_0x5342('0x65')](_0x5342('0x68'),path['parse'](_0x3ef1f6[_0x5342('0x5')])[_0x5342('0x69')],path[_0x5342('0x3d')](_0x3ef1f6['path'])[_0x5342('0x27')]);_0x1e6dc0['XMF-PATH']=_0x3ef1f6[_0x5342('0x5')];ut[_0x5342('0x4d')](_0x5342('0x6a'),'');ami[_0x5342('0x6b')](ut['variablesAction'](_0x3ef1f6,_0x1e6dc0))['then'](function(_0x32988c){_0x2603b0(_0x32988c);})[_0x5342('0x41')](function(_0x4a82dc){_0x182e74(_0x4a82dc);});})[_0x5342('0x41')](function(_0x34b702){_0x182e74(_0x34b702);});}else{ami[_0x5342('0x6b')](ut[_0x5342('0x6c')](_0x3ef1f6,_0x1e6dc0))['then'](function(_0x1501c6){_0x2603b0(_0x1501c6);})[_0x5342('0x41')](function(_0x307030){_0x182e74(_0x307030);});}});}Fax[_0x5342('0x2a')][_0x5342('0x5c')]=function(_0x30f915,_0x29cc90){var _0x5090ef=this;return new BPromise(function(_0xbc8d6b,_0x2e66ba){var _0x332f00=uuid['v4']();var _0x199b8c=ut[_0x5342('0x6d')](_0x30f915,_0x29cc90);_0x5090ef[_0x5342('0x51')][_0x332f00]=new Action(_0x332f00,_0x29cc90,_0x30f915);var _0xff0636=_0x5090ef[_0x5342('0x51')][_0x332f00];if(path[_0x5342('0x3d')](_0x30f915['path'])['ext']==='.pdf'){originate(_0xff0636,_0x199b8c,!![])['then'](function(_0x4151dd){_0xbc8d6b(_0x4151dd);})[_0x5342('0x41')](function(_0x38671e){_0x2e66ba(_0x38671e);});}else{originate(_0xff0636,_0x199b8c,![])[_0x5342('0x4c')](function(_0x26d973){_0xbc8d6b(_0x26d973);})[_0x5342('0x41')](function(_0x4f344b){_0x2e66ba(_0x4f344b);});}});};Fax[_0x5342('0x2a')][_0x5342('0x6e')]=function(_0x2c6257){return!_['isNil'](_0x2c6257)&&!_[_0x5342('0x6f')](_0x2c6257[_0x5342('0x27')])&&!_[_0x5342('0x6f')](_0x2c6257[_0x5342('0x70')])&&_0x2c6257[_0x5342('0x70')]&&!_['isNil'](this['trunks'][util[_0x5342('0x65')](_0x5342('0x71'),_0x2c6257[_0x5342('0x27')])])&&!_[_0x5342('0x6f')](this[_0x5342('0x12')][util[_0x5342('0x65')](_0x5342('0x71'),_0x2c6257[_0x5342('0x27')])][_0x5342('0x31')])&&(this[_0x5342('0x12')][util[_0x5342('0x65')](_0x5342('0x71'),_0x2c6257[_0x5342('0x27')])][_0x5342('0x31')]===_0x5342('0x72')||this[_0x5342('0x12')][util[_0x5342('0x65')](_0x5342('0x71'),_0x2c6257[_0x5342('0x27')])][_0x5342('0x31')]===_0x5342('0x73'));};Fax[_0x5342('0x2a')]['checkTrunk']=function(_0x37b49b,_0x232c67){if(!this[_0x5342('0x6e')](_0x37b49b)){ut[_0x5342('0x4d')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x5342('0x6f')](_0x37b49b)?'':_0x37b49b[_0x5342('0x27')]+_0x5342('0x74'));return{'isValid':![],'message':_0x5342('0x75')};}if(_[_0x5342('0x6f')](_0x232c67['fax'])){ut[_0x5342('0x4d')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x5342('0x44')](_0x232c67));return{'isValid':![],'message':_0x5342('0x76')};}if(_[_0x5342('0x6f')](_0x232c67[_0x5342('0x5')])){ut['logger'](_0x5342('0x77'),JSON[_0x5342('0x44')](_0x232c67));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x5342('0x78')};};module[_0x5342('0x79')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 4d73b3d..48115bd 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 _0x32fa=['bluebird','../../../config/logger','preview','../rpc/faxAccount','error','inspect','notify','resolve','then','[Notify]\x20','util'];(function(_0x114b7c,_0xc4b93b){var _0x47185f=function(_0x5b4cfa){while(--_0x5b4cfa){_0x114b7c['push'](_0x114b7c['shift']());}};_0x47185f(++_0xc4b93b);}(_0x32fa,0x18b));var _0xa32f=function(_0x504f60,_0x198682){_0x504f60=_0x504f60-0x0;var _0x3a7283=_0x32fa[_0x504f60];return _0x3a7283;};'use strict';var util=require(_0xa32f('0x0'));var BPromise=require(_0xa32f('0x1'));var logger=require(_0xa32f('0x2'))(_0xa32f('0x3'));var _=require('lodash');var faxAccount=require(_0xa32f('0x4'));function loggerCatch(_0x214325){return function(_0x455eb5){logger[_0xa32f('0x5')](_0x214325,util[_0xa32f('0x6')](_0x455eb5,{'showHidden':![],'depth':null}));};}exports[_0xa32f('0x7')]=function(_0x1fdf7e,_0x2dd0d1){return BPromise[_0xa32f('0x8')]()[_0xa32f('0x9')](faxAccount[_0xa32f('0x7')](_0x1fdf7e,_0x2dd0d1))['catch'](loggerCatch(_0xa32f('0xa')));}; \ No newline at end of file +var _0x97c0=['../../../config/logger','lodash','inspect','notify','resolve','then','catch','[Notify]\x20','util'];(function(_0x103303,_0x114a7c){var _0x297960=function(_0x2837d7){while(--_0x2837d7){_0x103303['push'](_0x103303['shift']());}};_0x297960(++_0x114a7c);}(_0x97c0,0xa1));var _0x097c=function(_0x26fc17,_0x5ab35e){_0x26fc17=_0x26fc17-0x0;var _0x47be11=_0x97c0[_0x26fc17];return _0x47be11;};'use strict';var util=require(_0x097c('0x0'));var BPromise=require('bluebird');var logger=require(_0x097c('0x1'))('preview');var _=require(_0x097c('0x2'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x430d3f){return function(_0x403727){logger['error'](_0x430d3f,util[_0x097c('0x3')](_0x403727,{'showHidden':![],'depth':null}));};}exports[_0x097c('0x4')]=function(_0x461dc2,_0x3c9b8b){return BPromise[_0x097c('0x5')]()[_0x097c('0x6')](faxAccount['notify'](_0x461dc2,_0x3c9b8b))[_0x097c('0x7')](loggerCatch(_0x097c('0x8')));}; \ 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 3f1c18b..dfbdb63 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 _0x9dd7=['execute','info','Exec\x20gs','util','../../../../config/logger','fax','bluebird','child_process','exec'];(function(_0x2778da,_0x1e31ea){var _0x1981f6=function(_0x5ad447){while(--_0x5ad447){_0x2778da['push'](_0x2778da['shift']());}};_0x1981f6(++_0x1e31ea);}(_0x9dd7,0x9c));var _0x79dd=function(_0x2bdc0a,_0x1e03d0){_0x2bdc0a=_0x2bdc0a-0x0;var _0x3f0837=_0x9dd7[_0x2bdc0a];return _0x3f0837;};'use strict';var util=require(_0x79dd('0x0'));var logger=require(_0x79dd('0x1'))(_0x79dd('0x2'));var BPromise=require(_0x79dd('0x3'));var exec=require(_0x79dd('0x4'))[_0x79dd('0x5')];exports[_0x79dd('0x6')]=function(_0xb7cc29){return new BPromise(function(_0x4a706a,_0x586a8d){exec(_0xb7cc29,function(_0x59cdc4,_0x5539f9,_0x46b442){logger[_0x79dd('0x7')]('Exec\x20gs',_0x5539f9);if(_0x59cdc4){logger[_0x79dd('0x7')](_0x79dd('0x8'),'\x20Error\x20:',util['inspect'](_0x59cdc4,{'showHidden':![],'depth':null}),_0x5539f9,_0x46b442);_0x586a8d(_0x59cdc4);}_0x4a706a(_0x5539f9);});});}; \ No newline at end of file +var _0x0035=['info','Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger','fax','bluebird','exec'];(function(_0x2795cd,_0x1e59d4){var _0x208d9c=function(_0x386f2f){while(--_0x386f2f){_0x2795cd['push'](_0x2795cd['shift']());}};_0x208d9c(++_0x1e59d4);}(_0x0035,0x1cc));var _0x5003=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0x0035[_0x469a3c];return _0x968f4;};'use strict';var util=require('util');var logger=require(_0x5003('0x0'))(_0x5003('0x1'));var BPromise=require(_0x5003('0x2'));var exec=require('child_process')[_0x5003('0x3')];exports['execute']=function(_0x5d1815){return new BPromise(function(_0x1965fc,_0x1134ec){exec(_0x5d1815,function(_0xe9829f,_0x8f149c,_0x133284){logger[_0x5003('0x4')](_0x5003('0x5'),_0x8f149c);if(_0xe9829f){logger[_0x5003('0x4')](_0x5003('0x5'),_0x5003('0x6'),util[_0x5003('0x7')](_0xe9829f,{'showHidden':![],'depth':null}),_0x8f149c,_0x133284);_0x1134ec(_0xe9829f);}_0x1965fc(_0x8f149c);});});}; \ 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 95a9c19..b2be6de 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 _0x2547=['xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','uniqueid','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','maxrate','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','originate'];(function(_0x20cc69,_0x31fb2b){var _0x200c61=function(_0x3ecee2){while(--_0x3ecee2){_0x20cc69['push'](_0x20cc69['shift']());}};_0x200c61(++_0x31fb2b);}(_0x2547,0x1cd));var _0x7254=function(_0x287279,_0x596445){_0x287279=_0x287279-0x0;var _0x421779=_0x2547[_0x287279];return _0x421779;};'use strict';var util=require('util');var _=require(_0x7254('0x0'));var moment=require(_0x7254('0x1'));var logger=require(_0x7254('0x2'))(_0x7254('0x3'));exports[_0x7254('0x4')]=function(_0x1a36de){return{'message':_0x1a36de};};exports[_0x7254('0x5')]=function(_0x265ebf,_0x53a02f){logger[_0x7254('0x6')](_0x265ebf,util[_0x7254('0x7')](_0x53a02f,{'showHidden':![],'depth':null}));};exports[_0x7254('0x8')]=function(_0x119f66,_0x4b845f){var _0x253b1e={'XMF-ECM':_0x4b845f[_0x7254('0x9')],'XMF-HEADERINFO':_0x4b845f[_0x7254('0xa')],'XMF-MINRATE':_0x4b845f['minrate'],'XMF-MAXRATE':_0x4b845f[_0x7254('0xb')],'XMF-MODEM':util['format']('\x22%s\x22',_0x4b845f['modem']),'XMF-GATEWAY':_0x4b845f[_0x7254('0xc')],'XMF-FAXDETECT':_0x4b845f[_0x7254('0xd')],'XMF-T38TIMEOUT':_0x4b845f[_0x7254('0xe')],'XMF-LOCALSTATIONID':_0x4b845f[_0x7254('0xf')],'XMF-PATH':_0x119f66[_0x7254('0x10')]};return _0x253b1e;};exports[_0x7254('0x11')]=function(_0x4d19e8,_0x3275bd){return{'actionid':_0x4d19e8['uniqueid'],'action':_0x7254('0x12'),'channel':_0x4d19e8['channel'],'Exten':_0x7254('0x13'),'Context':_0x7254('0x14'),'Priority':'1','callerid':util[_0x7254('0x15')](_0x7254('0x16'),_0x4d19e8[_0x7254('0xa')]?_0x4d19e8[_0x7254('0xa')]:'',_0x4d19e8[_0x7254('0xf')]),'variable':_0x3275bd,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4d19e8[_0x7254('0x17')]};}; \ No newline at end of file +var _0xec56=['xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel'];(function(_0x522ae8,_0x3b637e){var _0x3189b9=function(_0x3115d4){while(--_0x3115d4){_0x522ae8['push'](_0x522ae8['shift']());}};_0x3189b9(++_0x3b637e);}(_0xec56,0x1bd));var _0x6ec5=function(_0x202d63,_0xb52947){_0x202d63=_0x202d63-0x0;var _0x103b6f=_0xec56[_0x202d63];return _0x103b6f;};'use strict';var util=require(_0x6ec5('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x6ec5('0x1'))(_0x6ec5('0x2'));exports[_0x6ec5('0x3')]=function(_0x240ccf){return{'message':_0x240ccf};};exports[_0x6ec5('0x4')]=function(_0x399441,_0x469679){logger[_0x6ec5('0x5')](_0x399441,util[_0x6ec5('0x6')](_0x469679,{'showHidden':![],'depth':null}));};exports[_0x6ec5('0x7')]=function(_0x2d0a93,_0x3bb683){var _0x35be4e={'XMF-ECM':_0x3bb683[_0x6ec5('0x8')],'XMF-HEADERINFO':_0x3bb683[_0x6ec5('0x9')],'XMF-MINRATE':_0x3bb683[_0x6ec5('0xa')],'XMF-MAXRATE':_0x3bb683[_0x6ec5('0xb')],'XMF-MODEM':util[_0x6ec5('0xc')](_0x6ec5('0xd'),_0x3bb683['modem']),'XMF-GATEWAY':_0x3bb683[_0x6ec5('0xe')],'XMF-FAXDETECT':_0x3bb683[_0x6ec5('0xf')],'XMF-T38TIMEOUT':_0x3bb683[_0x6ec5('0x10')],'XMF-LOCALSTATIONID':_0x3bb683[_0x6ec5('0x11')],'XMF-PATH':_0x2d0a93[_0x6ec5('0x12')]};return _0x35be4e;};exports[_0x6ec5('0x13')]=function(_0x1d5b76,_0x50eb2d){return{'actionid':_0x1d5b76[_0x6ec5('0x14')],'action':_0x6ec5('0x15'),'channel':_0x1d5b76[_0x6ec5('0x16')],'Exten':_0x6ec5('0x17'),'Context':_0x6ec5('0x18'),'Priority':'1','callerid':util[_0x6ec5('0xc')](_0x6ec5('0x19'),_0x1d5b76[_0x6ec5('0x9')]?_0x1d5b76['headerinfo']:'',_0x1d5b76[_0x6ec5('0x11')]),'variable':_0x50eb2d,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1d5b76['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 4eda31a..91f55dd 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 _0xa6a9=['./rpc/integrations/servicenow','./rpc/integrations/dynamics365','hour','get','resolve','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales'];(function(_0x129467,_0x63cd90){var _0x209024=function(_0x7114e0){while(--_0x7114e0){_0x129467['push'](_0x129467['shift']());}};_0x209024(++_0x63cd90);}(_0xa6a9,0x102));var _0x9a6a=function(_0x21cb7f,_0x48cd16){_0x21cb7f=_0x21cb7f-0x0;var _0x5a079a=_0xa6a9[_0x21cb7f];return _0x5a079a;};'use strict';var BPromise=require(_0x9a6a('0x0'));var util=require(_0x9a6a('0x1'));var moment=require(_0x9a6a('0x2'));var server=require(_0x9a6a('0x3'));var Realtime=require(_0x9a6a('0x4'));var Report=require(_0x9a6a('0x5'));var Acw=require(_0x9a6a('0x6'));var Trigger=require(_0x9a6a('0x7'));var Dialer=require('./dialer');var Preview=require(_0x9a6a('0x8'));var Fax=require(_0x9a6a('0x9'));var user=require(_0x9a6a('0xa'));var voiceQueue=require(_0x9a6a('0xb'));var voiceQueueReport=require(_0x9a6a('0xc'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x9a6a('0xd'));var trigger=require(_0x9a6a('0xe'));var template=require(_0x9a6a('0xf'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x9a6a('0x10'));var voiceExtension=require(_0x9a6a('0x11'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x9a6a('0x12'));var salesforce=require(_0x9a6a('0x13'));var sugarcrm=require(_0x9a6a('0x14'));var freshdesk=require(_0x9a6a('0x15'));var desk=require(_0x9a6a('0x16'));var zoho=require(_0x9a6a('0x17'));var vtiger=require(_0x9a6a('0x18'));var freshsales=require(_0x9a6a('0x19'));var servicenow=require(_0x9a6a('0x1a'));var dynamics365=require(_0x9a6a('0x1b'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x9a6a('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x9a6a('0x1d')](_0x9a6a('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x9a6a('0x1e')]()['then'](user['getAgents']())[_0x9a6a('0x1f')](realtime[_0x9a6a('0x20')]())[_0x9a6a('0x1f')](user[_0x9a6a('0x21')]())[_0x9a6a('0x1f')](realtime[_0x9a6a('0x22')]())[_0x9a6a('0x1f')](trunk[_0x9a6a('0x23')]())[_0x9a6a('0x1f')](realtime[_0x9a6a('0x24')]())[_0x9a6a('0x1f')](voiceQueue[_0x9a6a('0x25')]())[_0x9a6a('0x1f')](realtime['initVoiceQueues']())[_0x9a6a('0x1f')](trigger[_0x9a6a('0x26')]())[_0x9a6a('0x1f')](realtime[_0x9a6a('0x27')]())[_0x9a6a('0x1f')](template[_0x9a6a('0x28')]())[_0x9a6a('0x1f')](realtime[_0x9a6a('0x29')]())[_0x9a6a('0x1f')](zendesk[_0x9a6a('0x2a')]())[_0x9a6a('0x1f')](realtime[_0x9a6a('0x2b')]())[_0x9a6a('0x1f')](salesforce['getSalesforceAccounts']())[_0x9a6a('0x1f')](realtime[_0x9a6a('0x2c')]())[_0x9a6a('0x1f')](sugarcrm[_0x9a6a('0x2d')]())[_0x9a6a('0x1f')](realtime[_0x9a6a('0x2e')]())[_0x9a6a('0x1f')](freshdesk['getFreshdeskAccounts']())['then'](realtime['initFreshdeskAccounts']())[_0x9a6a('0x1f')](desk[_0x9a6a('0x2f')]())[_0x9a6a('0x1f')](realtime['initDeskAccounts']())[_0x9a6a('0x1f')](zoho['getZohoAccounts']())[_0x9a6a('0x1f')](realtime[_0x9a6a('0x30')]())[_0x9a6a('0x1f')](vtiger[_0x9a6a('0x31')]())['then'](realtime[_0x9a6a('0x32')]())[_0x9a6a('0x1f')](freshsales['getFreshsalesAccounts']())[_0x9a6a('0x1f')](realtime['initFreshsalesAccounts']())[_0x9a6a('0x1f')](servicenow[_0x9a6a('0x33')]())[_0x9a6a('0x1f')](realtime[_0x9a6a('0x34')]())[_0x9a6a('0x1f')](dynamics365[_0x9a6a('0x35')]())[_0x9a6a('0x1f')](realtime[_0x9a6a('0x36')]())[_0x9a6a('0x1f')](campaign['getCampaigns']())[_0x9a6a('0x1f')](realtime[_0x9a6a('0x37')]())[_0x9a6a('0x1f')](voiceExtension[_0x9a6a('0x38')]())[_0x9a6a('0x1f')](realtime['initVoiceExtensions']())[_0x9a6a('0x1f')](faxAccount[_0x9a6a('0x39')]())['then'](realtime[_0x9a6a('0x3a')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x9a6a('0x1e')]()[_0x9a6a('0x1f')](voiceQueueReport[_0x9a6a('0x3b')]())[_0x9a6a('0x1f')](realtime[_0x9a6a('0x3c')]())['then'](cmHopperHistory[_0x9a6a('0x3d')]())[_0x9a6a('0x1f')](realtime[_0x9a6a('0x3e')]())[_0x9a6a('0x1f')](cmHopperHistory[_0x9a6a('0x3f')]())['then'](realtime[_0x9a6a('0x40')]())[_0x9a6a('0x1f')](voiceCallReport[_0x9a6a('0x41')]())[_0x9a6a('0x1f')](realtime[_0x9a6a('0x42')]())[_0x9a6a('0x1f')](function(_0x30a8ce){})[_0x9a6a('0x43')](function(_0x371102){console[_0x9a6a('0x44')](_0x371102);});}function main(){return server[_0x9a6a('0x45')](realtime,preview,fax)[_0x9a6a('0x1f')](function(_0x587d01){return initRealtime();})[_0x9a6a('0x1f')](function(){return initParams();})[_0x9a6a('0x1f')](function(){report[_0x9a6a('0x46')]();setInterval(initRealtime,0x1388);})[_0x9a6a('0x43')](function(_0x33f9cc){console[_0x9a6a('0x44')](_0x33f9cc);});}main(); \ No newline at end of file +var _0x9c42=['./dialer','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','then','getAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','resolve','initVoiceQueueReports','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','bluebird','util','moment','./server','./realtime','./trigger'];(function(_0x203153,_0x47984d){var _0x577060=function(_0x5dff91){while(--_0x5dff91){_0x203153['push'](_0x203153['shift']());}};_0x577060(++_0x47984d);}(_0x9c42,0xf2));var _0x29c4=function(_0x24a654,_0x2ca441){_0x24a654=_0x24a654-0x0;var _0x458651=_0x9c42[_0x24a654];return _0x458651;};'use strict';var BPromise=require(_0x29c4('0x0'));var util=require(_0x29c4('0x1'));var moment=require(_0x29c4('0x2'));var server=require(_0x29c4('0x3'));var Realtime=require(_0x29c4('0x4'));var Report=require('./report');var Acw=require('./acw');var Trigger=require(_0x29c4('0x5'));var Dialer=require(_0x29c4('0x6'));var Preview=require('./preview');var Fax=require('./fax');var user=require(_0x29c4('0x7'));var voiceQueue=require(_0x29c4('0x8'));var voiceQueueReport=require(_0x29c4('0x9'));var voiceCallReport=require(_0x29c4('0xa'));var trunk=require(_0x29c4('0xb'));var trigger=require(_0x29c4('0xc'));var template=require(_0x29c4('0xd'));var cmHopperHistory=require(_0x29c4('0xe'));var campaign=require(_0x29c4('0xf'));var voiceExtension=require(_0x29c4('0x10'));var faxAccount=require(_0x29c4('0x11'));var zendesk=require(_0x29c4('0x12'));var salesforce=require(_0x29c4('0x13'));var sugarcrm=require(_0x29c4('0x14'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require('./rpc/integrations/desk');var zoho=require(_0x29c4('0x15'));var vtiger=require(_0x29c4('0x16'));var freshsales=require(_0x29c4('0x17'));var servicenow=require(_0x29c4('0x18'));var dynamics365=require(_0x29c4('0x19'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x29c4('0x1a')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x29c4('0x1a')](_0x29c4('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x29c4('0x1c')](user[_0x29c4('0x1d')]())['then'](realtime['initAgents']())[_0x29c4('0x1c')](user[_0x29c4('0x1e')]())['then'](realtime[_0x29c4('0x1f')]())['then'](trunk[_0x29c4('0x20')]())[_0x29c4('0x1c')](realtime['initTrunks']())[_0x29c4('0x1c')](voiceQueue[_0x29c4('0x21')]())['then'](realtime[_0x29c4('0x22')]())[_0x29c4('0x1c')](trigger['getTriggers']())[_0x29c4('0x1c')](realtime[_0x29c4('0x23')]())[_0x29c4('0x1c')](template['getTemplates']())[_0x29c4('0x1c')](realtime[_0x29c4('0x24')]())[_0x29c4('0x1c')](zendesk[_0x29c4('0x25')]())[_0x29c4('0x1c')](realtime[_0x29c4('0x26')]())[_0x29c4('0x1c')](salesforce[_0x29c4('0x27')]())['then'](realtime[_0x29c4('0x28')]())['then'](sugarcrm[_0x29c4('0x29')]())[_0x29c4('0x1c')](realtime[_0x29c4('0x2a')]())[_0x29c4('0x1c')](freshdesk[_0x29c4('0x2b')]())['then'](realtime['initFreshdeskAccounts']())[_0x29c4('0x1c')](desk[_0x29c4('0x2c')]())[_0x29c4('0x1c')](realtime['initDeskAccounts']())['then'](zoho['getZohoAccounts']())[_0x29c4('0x1c')](realtime['initZohoAccounts']())[_0x29c4('0x1c')](vtiger['getVtigerAccounts']())[_0x29c4('0x1c')](realtime['initVtigerAccounts']())[_0x29c4('0x1c')](freshsales[_0x29c4('0x2d')]())[_0x29c4('0x1c')](realtime['initFreshsalesAccounts']())['then'](servicenow[_0x29c4('0x2e')]())[_0x29c4('0x1c')](realtime[_0x29c4('0x2f')]())['then'](dynamics365['getDynamics365Accounts']())[_0x29c4('0x1c')](realtime[_0x29c4('0x30')]())[_0x29c4('0x1c')](campaign[_0x29c4('0x31')]())[_0x29c4('0x1c')](realtime[_0x29c4('0x32')]())['then'](voiceExtension[_0x29c4('0x33')]())[_0x29c4('0x1c')](realtime['initVoiceExtensions']())[_0x29c4('0x1c')](faxAccount[_0x29c4('0x34')]())[_0x29c4('0x1c')](realtime['initFaxAccounts']())[_0x29c4('0x1c')](function(){return realtime;});}function initParams(){return BPromise[_0x29c4('0x35')]()[_0x29c4('0x1c')](voiceQueueReport['getVoiceQueueReports']())[_0x29c4('0x1c')](realtime[_0x29c4('0x36')]())[_0x29c4('0x1c')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x29c4('0x1c')](realtime[_0x29c4('0x37')]())[_0x29c4('0x1c')](cmHopperHistory['getCampaignHopperHistory']())[_0x29c4('0x1c')](realtime[_0x29c4('0x38')]())[_0x29c4('0x1c')](voiceCallReport[_0x29c4('0x39')]())[_0x29c4('0x1c')](realtime[_0x29c4('0x3a')]())[_0x29c4('0x1c')](function(_0x57d6e8){})[_0x29c4('0x3b')](function(_0x1b8150){console[_0x29c4('0x3c')](_0x1b8150);});}function main(){return server[_0x29c4('0x3d')](realtime,preview,fax)[_0x29c4('0x1c')](function(_0x5284f4){return initRealtime();})[_0x29c4('0x1c')](function(){return initParams();})[_0x29c4('0x1c')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x29c4('0x3b')](function(_0x54de05){console[_0x29c4('0x3c')](_0x54de05);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 7d7bf31..a07790a 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 _0x7cf4=['local','prototype','updateStatusRealtime','toLowerCase','inuse','talking','statePause','voiceStatusTime','toNumber','format','stringify','user:%s','emit','user:save','user:presence','util','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','stateTime','status','address','mobile','interface','online','voiceStatus','unknown','voiceStatusCallerIdNumber','voiceStatusQueue','onhold'];(function(_0x339129,_0x86dcc6){var _0x1570df=function(_0x3b537e){while(--_0x3b537e){_0x339129['push'](_0x339129['shift']());}};_0x1570df(++_0x86dcc6);}(_0x7cf4,0x19f));var _0x47cf=function(_0x3e9b5a,_0x5a118c){_0x3e9b5a=_0x3e9b5a-0x0;var _0x4dad64=_0x7cf4[_0x3e9b5a];return _0x4dad64;};'use strict';var _=require('lodash');var util=require(_0x47cf('0x0'));var moment=require(_0x47cf('0x1'));var md5=require(_0x47cf('0x2'));var Redis=require(_0x47cf('0x3'));var config=require(_0x47cf('0x4'));config[_0x47cf('0x5')]=_[_0x47cf('0x6')](config[_0x47cf('0x5')],{'host':_0x47cf('0x7'),'port':0x18eb});var io=require(_0x47cf('0x8'))(new Redis(config['redis']));function Agent(_0x32698a){this['id']=_0x32698a['id']||0x0;this['name']=_0x32698a[_0x47cf('0x9')]||'';this[_0x47cf('0xa')]=_0x32698a['email']||'';this[_0x47cf('0xb')]=_0x32698a[_0x47cf('0xb')]||'';this[_0x47cf('0xc')]=_0x32698a[_0x47cf('0xc')]||'';this[_0x47cf('0xd')]='unknown';this[_0x47cf('0xe')]=0x0;this[_0x47cf('0xf')]='unknown';this[_0x47cf('0x10')]='';this['phone']='';this[_0x47cf('0x11')]='';this[_0x47cf('0x12')]='';this[_0x47cf('0x13')]=_0x32698a[_0x47cf('0x13')]||![];this[_0x47cf('0x14')]=_0x47cf('0x15');this['voiceStatusTime']=0x0;this[_0x47cf('0x16')]='';this[_0x47cf('0x17')]='';this[_0x47cf('0x18')]=![];this[_0x47cf('0x19')]=![];this['md5']='';}Agent[_0x47cf('0x1a')][_0x47cf('0x1b')]=function(_0xdb31cd){var _0x1cd39e;if(_0xdb31cd&&_0xdb31cd[_0x47cf('0xd')]){_0x1cd39e=_0xdb31cd[_0x47cf('0xd')][_0x47cf('0x1c')]();switch(_0x1cd39e){case'not_inuse':_0x1cd39e='idle';break;case _0x47cf('0x1d'):_0x1cd39e=_0x47cf('0x1e');break;}}if(_0x1cd39e&&this['voiceStatus']!==_0x1cd39e||_0xdb31cd[_0x47cf('0x1f')]){this[_0x47cf('0x20')]=_[_0x47cf('0x21')](moment()[_0x47cf('0x22')]('x'));}if(_0x1cd39e){this['voiceStatus']=_0x1cd39e;}var _0x42dfd1={'id':this['id'],'name':this[_0x47cf('0x9')],'email':this[_0x47cf('0xa')],'accountcode':this['accountcode'],'fullname':this[_0x47cf('0xc')],'state':this['state'],'stateTime':this[_0x47cf('0xe')],'status':this[_0x47cf('0xf')],'address':this[_0x47cf('0x10')],'online':this[_0x47cf('0x13')],'voiceStatus':this[_0x47cf('0x14')],'voiceStatusTime':this[_0x47cf('0x20')],'voiceStatusCallerIdNumber':this[_0x47cf('0x16')],'voiceStatusQueue':this[_0x47cf('0x17')],'interface':this[_0x47cf('0x12')],'onhold':this['onhold']};var _0x5a12c2=md5(JSON[_0x47cf('0x23')](_0x42dfd1));if(this[_0x47cf('0x2')]!==_0x5a12c2){this[_0x47cf('0x2')]=_0x5a12c2;io['to'](util[_0x47cf('0x22')](_0x47cf('0x24'),_0x42dfd1[_0x47cf('0x9')]))[_0x47cf('0x25')](_0x47cf('0x26'),_0x42dfd1);io[_0x47cf('0x25')](_0x47cf('0x27'),_0x42dfd1);}};module['exports']=Agent; \ No newline at end of file +var _0x8d63=['ioredis','../../../config/environment','redis','defaults','localhost','email','accountcode','fullname','state','unknown','status','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','idle','inuse','talking','statePause','toNumber','name','stateTime','voiceStatusCallerIdNumber','stringify','format','user:%s','emit','user:save','user:presence','exports','lodash','util','moment','md5'];(function(_0xa20401,_0x1d3e18){var _0x1106f9=function(_0x143654){while(--_0x143654){_0xa20401['push'](_0xa20401['shift']());}};_0x1106f9(++_0x1d3e18);}(_0x8d63,0xa4));var _0x38d6=function(_0x34260d,_0x401ebb){_0x34260d=_0x34260d-0x0;var _0x174c68=_0x8d63[_0x34260d];return _0x174c68;};'use strict';var _=require(_0x38d6('0x0'));var util=require(_0x38d6('0x1'));var moment=require(_0x38d6('0x2'));var md5=require(_0x38d6('0x3'));var Redis=require(_0x38d6('0x4'));var config=require(_0x38d6('0x5'));config[_0x38d6('0x6')]=_[_0x38d6('0x7')](config[_0x38d6('0x6')],{'host':_0x38d6('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x38d6('0x6')]));function Agent(_0x377f45){this['id']=_0x377f45['id']||0x0;this['name']=_0x377f45['name']||'';this[_0x38d6('0x9')]=_0x377f45[_0x38d6('0x9')]||'';this[_0x38d6('0xa')]=_0x377f45['accountcode']||'';this[_0x38d6('0xb')]=_0x377f45[_0x38d6('0xb')]||'';this[_0x38d6('0xc')]=_0x38d6('0xd');this['stateTime']=0x0;this[_0x38d6('0xe')]=_0x38d6('0xd');this['address']='';this[_0x38d6('0xf')]='';this[_0x38d6('0x10')]='';this[_0x38d6('0x11')]='';this['online']=_0x377f45[_0x38d6('0x12')]||![];this[_0x38d6('0x13')]=_0x38d6('0xd');this[_0x38d6('0x14')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x38d6('0x15')]='';this[_0x38d6('0x16')]=![];this[_0x38d6('0x17')]=![];this[_0x38d6('0x3')]='';}Agent[_0x38d6('0x18')][_0x38d6('0x19')]=function(_0x2e1001){var _0x666e42;if(_0x2e1001&&_0x2e1001[_0x38d6('0xc')]){_0x666e42=_0x2e1001[_0x38d6('0xc')][_0x38d6('0x1a')]();switch(_0x666e42){case'not_inuse':_0x666e42=_0x38d6('0x1b');break;case _0x38d6('0x1c'):_0x666e42=_0x38d6('0x1d');break;}}if(_0x666e42&&this['voiceStatus']!==_0x666e42||_0x2e1001[_0x38d6('0x1e')]){this[_0x38d6('0x14')]=_[_0x38d6('0x1f')](moment()['format']('x'));}if(_0x666e42){this[_0x38d6('0x13')]=_0x666e42;}var _0x373151={'id':this['id'],'name':this[_0x38d6('0x20')],'email':this[_0x38d6('0x9')],'accountcode':this[_0x38d6('0xa')],'fullname':this[_0x38d6('0xb')],'state':this[_0x38d6('0xc')],'stateTime':this[_0x38d6('0x21')],'status':this[_0x38d6('0xe')],'address':this['address'],'online':this['online'],'voiceStatus':this[_0x38d6('0x13')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x38d6('0x22')],'voiceStatusQueue':this[_0x38d6('0x15')],'interface':this[_0x38d6('0x11')],'onhold':this[_0x38d6('0x16')]};var _0x5a0a03=md5(JSON[_0x38d6('0x23')](_0x373151));if(this[_0x38d6('0x3')]!==_0x5a0a03){this[_0x38d6('0x3')]=_0x5a0a03;io['to'](util[_0x38d6('0x24')](_0x38d6('0x25'),_0x373151[_0x38d6('0x20')]))[_0x38d6('0x26')](_0x38d6('0x27'),_0x373151);io[_0x38d6('0x26')](_0x38d6('0x28'),_0x373151);}};module[_0x38d6('0x29')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index f55a744..352a0e7 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 _0x4ff3=['dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x4ff3,0x68));var _0x34ff=function(_0x5947eb,_0x1451c0){_0x5947eb=_0x5947eb-0x0;var _0x3a28ea=_0x4ff3[_0x5947eb];return _0x3a28ea;};'use strict';function Campaign(_0x58fba2){this['id']=_0x58fba2['id']||0x0;this['name']=_0x58fba2[_0x34ff('0x0')]||'';this[_0x34ff('0x1')]=_0x58fba2['type']||_0x34ff('0x2');this[_0x34ff('0x3')]=0x0;this[_0x34ff('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x34ff('0x5')]=0x0;this[_0x34ff('0x6')]='';this['sendMessageOneNotActive']=!![];this[_0x34ff('0x7')]=_0x58fba2['active'];this[_0x34ff('0x8')]=_0x58fba2[_0x34ff('0x8')];this[_0x34ff('0x9')]=_0x58fba2[_0x34ff('0x9')]||null;this['dialGlobalInterval']=_0x58fba2['dialGlobalInterval']?_0x58fba2[_0x34ff('0xa')]:null;this[_0x34ff('0xb')]=_0x58fba2[_0x34ff('0xb')];this[_0x34ff('0xc')]=_0x58fba2[_0x34ff('0xc')];this[_0x34ff('0xd')]=_0x58fba2[_0x34ff('0xd')]||0x1e;this[_0x34ff('0xe')]=_0x58fba2[_0x34ff('0xe')];this['dialCongestionRetryFrequency']=_0x58fba2[_0x34ff('0xf')];this[_0x34ff('0x10')]=_0x58fba2[_0x34ff('0x10')];this['dialBusyRetryFrequency']=_0x58fba2['dialBusyRetryFrequency'];this[_0x34ff('0x11')]=_0x58fba2[_0x34ff('0x11')];this['dialNoAnswerRetryFrequency']=_0x58fba2[_0x34ff('0x12')];this[_0x34ff('0x13')]=_0x58fba2['dialGlobalMaxRetry'];this[_0x34ff('0x14')]=_0x58fba2[_0x34ff('0x14')]||0x3;this[_0x34ff('0x15')]=_0x58fba2[_0x34ff('0x15')]||0x96;this[_0x34ff('0x16')]=_0x58fba2[_0x34ff('0x16')]||0x3;this['dialDropRetryFrequency']=_0x58fba2['dialDropRetryFrequency']||0x96;this[_0x34ff('0x17')]=_0x58fba2['dialAbandonedMaxRetry']||0x3;this[_0x34ff('0x18')]=_0x58fba2[_0x34ff('0x18')]||0x96;this[_0x34ff('0x19')]=_0x58fba2[_0x34ff('0x19')]||0x3;this['dialMachineRetryFrequency']=_0x58fba2['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x58fba2[_0x34ff('0x1a')]||0x3;this[_0x34ff('0x1b')]=_0x58fba2['dialAgentRejectRetryFrequency']||0x96;this[_0x34ff('0x1c')]=_0x58fba2[_0x34ff('0x1c')]||_0x34ff('0x1d');this[_0x34ff('0x1e')]=_0x58fba2[_0x34ff('0x1e')]||undefined;this[_0x34ff('0x1f')]=_0x58fba2[_0x34ff('0x1f')]||undefined;this['dialCutDigit']=_0x58fba2[_0x34ff('0x20')]||undefined;this[_0x34ff('0x21')]=_0x58fba2['TrunkBackup']?_0x58fba2[_0x34ff('0x21')]:undefined;this[_0x34ff('0x22')]=_0x58fba2[_0x34ff('0x22')]?_0x58fba2['Trunk']:undefined;this['Interval']=_0x58fba2[_0x34ff('0x23')]?_0x58fba2['Interval']:undefined;this[_0x34ff('0x24')]=_0x58fba2[_0x34ff('0x24')]?_0x58fba2[_0x34ff('0x24')]:undefined;this[_0x34ff('0x25')]=_0x58fba2[_0x34ff('0x24')]?_0x58fba2[_0x34ff('0x24')][_0x34ff('0x0')]:undefined;this[_0x34ff('0x26')]=_0x58fba2['dialAMDActive']||![];this[_0x34ff('0x27')]=_0x58fba2[_0x34ff('0x27')];this['dialAMDGreeting']=_0x58fba2[_0x34ff('0x28')];this[_0x34ff('0x29')]=_0x58fba2['dialAMDAfterGreetingSilence'];this[_0x34ff('0x2a')]=_0x58fba2[_0x34ff('0x2a')];this[_0x34ff('0x2b')]=_0x58fba2[_0x34ff('0x2b')];this[_0x34ff('0x2c')]=_0x58fba2[_0x34ff('0x2c')];this[_0x34ff('0x2d')]=_0x58fba2['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x58fba2[_0x34ff('0x2e')];this[_0x34ff('0x2f')]=_0x58fba2[_0x34ff('0x2f')];}module[_0x34ff('0x30')]=Campaign; \ No newline at end of file +var _0x4b66=['SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval'];(function(_0x5621e3,_0x26c84c){var _0x4f225b=function(_0x3fb651){while(--_0x3fb651){_0x5621e3['push'](_0x5621e3['shift']());}};_0x4f225b(++_0x26c84c);}(_0x4b66,0x6a));var _0x64b6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4b66[_0x321bb2];return _0x9c12ed;};'use strict';function Campaign(_0xe4c8ed){this['id']=_0xe4c8ed['id']||0x0;this[_0x64b6('0x0')]=_0xe4c8ed[_0x64b6('0x0')]||'';this[_0x64b6('0x1')]=_0xe4c8ed[_0x64b6('0x1')]||_0x64b6('0x2');this['originated']=0x0;this['temp']=0x0;this[_0x64b6('0x3')]=0x0;this[_0x64b6('0x4')]=0x0;this['message']='';this[_0x64b6('0x5')]=!![];this[_0x64b6('0x6')]=_0xe4c8ed[_0x64b6('0x6')];this[_0x64b6('0x7')]=_0xe4c8ed[_0x64b6('0x7')];this[_0x64b6('0x8')]=_0xe4c8ed['dialTimezone']||null;this['dialGlobalInterval']=_0xe4c8ed[_0x64b6('0x9')]?_0xe4c8ed[_0x64b6('0x9')]:null;this['dialOriginateCallerIdName']=_0xe4c8ed[_0x64b6('0xa')];this[_0x64b6('0xb')]=_0xe4c8ed[_0x64b6('0xb')];this['dialOriginateTimeout']=_0xe4c8ed['dialOriginateTimeout']||0x1e;this[_0x64b6('0xc')]=_0xe4c8ed[_0x64b6('0xc')];this[_0x64b6('0xd')]=_0xe4c8ed[_0x64b6('0xd')];this[_0x64b6('0xe')]=_0xe4c8ed['dialBusyMaxRetry'];this[_0x64b6('0xf')]=_0xe4c8ed['dialBusyRetryFrequency'];this[_0x64b6('0x10')]=_0xe4c8ed[_0x64b6('0x10')];this[_0x64b6('0x11')]=_0xe4c8ed[_0x64b6('0x11')];this['dialGlobalMaxRetry']=_0xe4c8ed[_0x64b6('0x12')];this[_0x64b6('0x13')]=_0xe4c8ed['dialNoSuchNumberMaxRetry']||0x3;this[_0x64b6('0x14')]=_0xe4c8ed[_0x64b6('0x14')]||0x96;this['dialDropMaxRetry']=_0xe4c8ed['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0xe4c8ed[_0x64b6('0x15')]||0x96;this[_0x64b6('0x16')]=_0xe4c8ed['dialAbandonedMaxRetry']||0x3;this[_0x64b6('0x17')]=_0xe4c8ed[_0x64b6('0x17')]||0x96;this[_0x64b6('0x18')]=_0xe4c8ed[_0x64b6('0x18')]||0x3;this[_0x64b6('0x19')]=_0xe4c8ed[_0x64b6('0x19')]||0x96;this[_0x64b6('0x1a')]=_0xe4c8ed['dialAgentRejectMaxRetry']||0x3;this[_0x64b6('0x1b')]=_0xe4c8ed[_0x64b6('0x1b')]||0x96;this[_0x64b6('0x1c')]=_0xe4c8ed['dialOrderByScheduledAt']||'DESC';this[_0x64b6('0x1d')]=_0xe4c8ed[_0x64b6('0x1d')]||undefined;this[_0x64b6('0x1e')]=_0xe4c8ed['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x64b6('0x1f')]=_0xe4c8ed[_0x64b6('0x1f')]||undefined;this['TrunkBackup']=_0xe4c8ed[_0x64b6('0x20')]?_0xe4c8ed[_0x64b6('0x20')]:undefined;this[_0x64b6('0x21')]=_0xe4c8ed[_0x64b6('0x21')]?_0xe4c8ed[_0x64b6('0x21')]:undefined;this[_0x64b6('0x22')]=_0xe4c8ed[_0x64b6('0x22')]?_0xe4c8ed[_0x64b6('0x22')]:undefined;this[_0x64b6('0x23')]=_0xe4c8ed[_0x64b6('0x23')]?_0xe4c8ed[_0x64b6('0x23')]:undefined;this['dialQueueProject']=_0xe4c8ed[_0x64b6('0x23')]?_0xe4c8ed[_0x64b6('0x23')][_0x64b6('0x0')]:undefined;this[_0x64b6('0x24')]=_0xe4c8ed[_0x64b6('0x24')]||![];this[_0x64b6('0x25')]=_0xe4c8ed[_0x64b6('0x25')];this[_0x64b6('0x26')]=_0xe4c8ed['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0xe4c8ed[_0x64b6('0x27')];this[_0x64b6('0x28')]=_0xe4c8ed[_0x64b6('0x28')];this[_0x64b6('0x29')]=_0xe4c8ed[_0x64b6('0x29')];this['dialAMDBetweenWordsSilence']=_0xe4c8ed[_0x64b6('0x2a')];this['dialAMDMaximumNumberOfWords']=_0xe4c8ed[_0x64b6('0x2b')];this['dialAMDSilenceThreshold']=_0xe4c8ed[_0x64b6('0x2c')];this[_0x64b6('0x2d')]=_0xe4c8ed[_0x64b6('0x2d')];}module[_0x64b6('0x2e')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index a7b3468..5aa362d 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 _0x2396=['connectedlinenum','accountcode','context','uniqueid','linkedid','exten','answertime','endtime','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','disposition','monitor','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','destinationchannel','calleridnum','calleridname'];(function(_0x505e39,_0x5a76d6){var _0x4575b7=function(_0x333dfc){while(--_0x333dfc){_0x505e39['push'](_0x505e39['shift']());}};_0x4575b7(++_0x5a76d6);}(_0x2396,0xb9));var _0x6239=function(_0xcf807,_0x4c736b){_0xcf807=_0xcf807-0x0;var _0x2ef9e9=_0x2396[_0xcf807];return _0x2ef9e9;};'use strict';function Channel(){this[_0x6239('0x0')]=null;this['channel']='';this[_0x6239('0x1')]='';this[_0x6239('0x2')]=0x0;this[_0x6239('0x3')]='';this[_0x6239('0x4')]=undefined;this['connectedlinename']=undefined;this[_0x6239('0x5')]=0x0;this[_0x6239('0x6')]='';this[_0x6239('0x7')]=0x0;this[_0x6239('0x8')]=0x0;this[_0x6239('0x9')]=0x0;this['answered']=![];this[_0x6239('0xa')]=null;this[_0x6239('0xb')]=null;this['unmanaged']=![];this[_0x6239('0xc')]=![];this[_0x6239('0xd')]='';this[_0x6239('0xe')]='';this[_0x6239('0xf')]=0x0;this[_0x6239('0x10')]=0x0;this[_0x6239('0x11')]=0x0;this[_0x6239('0x12')]=null;this['tag']=null;this[_0x6239('0x13')]=null;this[_0x6239('0x14')]=![];this[_0x6239('0x15')]=null;this['queue']=null;this[_0x6239('0x16')]=[];this[_0x6239('0x17')]=undefined;this[_0x6239('0x18')]=undefined;this[_0x6239('0x19')]=0x0;}module[_0x6239('0x1a')]=Channel; \ No newline at end of file +var _0x6426=['channel','destinationchannel','calleridnum','calleridname','connectedlinename','accountcode','uniqueid','linkedid','exten','answered','answertime','endtime','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transferconnectedlinenum','mohtime','exports','starttime'];(function(_0x460f08,_0x9d73f1){var _0x5b64ad=function(_0x26de9b){while(--_0x26de9b){_0x460f08['push'](_0x460f08['shift']());}};_0x5b64ad(++_0x9d73f1);}(_0x6426,0x15b));var _0x6642=function(_0x19f748,_0x502312){_0x19f748=_0x19f748-0x0;var _0x5c4b0b=_0x6426[_0x19f748];return _0x5c4b0b;};'use strict';function Channel(){this[_0x6642('0x0')]=null;this[_0x6642('0x1')]='';this[_0x6642('0x2')]='';this[_0x6642('0x3')]=0x0;this[_0x6642('0x4')]='';this['connectedlinenum']=undefined;this[_0x6642('0x5')]=undefined;this[_0x6642('0x6')]=0x0;this['context']='';this[_0x6642('0x7')]=0x0;this[_0x6642('0x8')]=0x0;this[_0x6642('0x9')]=0x0;this[_0x6642('0xa')]=![];this[_0x6642('0xb')]=null;this[_0x6642('0xc')]=null;this['unmanaged']=![];this[_0x6642('0xd')]=![];this[_0x6642('0xe')]='';this[_0x6642('0xf')]='';this[_0x6642('0x10')]=0x0;this[_0x6642('0x11')]=0x0;this[_0x6642('0x12')]=0x0;this[_0x6642('0x13')]=null;this[_0x6642('0x14')]=null;this[_0x6642('0x15')]=null;this[_0x6642('0x16')]=![];this[_0x6642('0x17')]=null;this[_0x6642('0x18')]=null;this[_0x6642('0x19')]=[];this['transfercalleridnum']=undefined;this[_0x6642('0x1a')]=undefined;this[_0x6642('0x1b')]=0x0;}module[_0x6642('0x1c')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index dd483c2..32913bb 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 _0x16d8=['consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','exports','name','username','remoteUri','authType','password'];(function(_0x48ae85,_0x4f6363){var _0x2257bc=function(_0x406d8f){while(--_0x406d8f){_0x48ae85['push'](_0x48ae85['shift']());}};_0x2257bc(++_0x4f6363);}(_0x16d8,0xa3));var _0x816d=function(_0x41822e,_0x51b105){_0x41822e=_0x41822e-0x0;var _0x35e55d=_0x16d8[_0x41822e];return _0x35e55d;};'use strict';function DeskAccount(_0x3dbdf3){this['id']=_0x3dbdf3['id']||0x0;this[_0x816d('0x0')]=_0x3dbdf3[_0x816d('0x0')]||'';this[_0x816d('0x1')]=_0x3dbdf3[_0x816d('0x1')]||'';this[_0x816d('0x2')]=_0x3dbdf3[_0x816d('0x2')]||'';this[_0x816d('0x3')]=_0x3dbdf3[_0x816d('0x3')]||'';this[_0x816d('0x4')]=_0x3dbdf3['password']||'';this[_0x816d('0x5')]=_0x3dbdf3['consumerKey']||'';this[_0x816d('0x6')]=_0x3dbdf3[_0x816d('0x6')]||'';this[_0x816d('0x7')]=_0x3dbdf3[_0x816d('0x7')]||'';this[_0x816d('0x8')]=_0x3dbdf3['tokenSecret']||'';this[_0x816d('0x9')]=_0x3dbdf3[_0x816d('0x9')]||'';this[_0x816d('0xa')]=_0x3dbdf3['serverUrl']||'';this['Configurations']=_0x3dbdf3['Configurations']||{};}module[_0x816d('0xb')]=DeskAccount; \ No newline at end of file +var _0xe8f7=['username','remoteUri','authType','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name'];(function(_0x29e6de,_0x4b4df5){var _0x3cd844=function(_0x2bd136){while(--_0x2bd136){_0x29e6de['push'](_0x29e6de['shift']());}};_0x3cd844(++_0x4b4df5);}(_0xe8f7,0x137));var _0x7e8f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe8f7[_0x2641f9];return _0x585741;};'use strict';function DeskAccount(_0x277c33){this['id']=_0x277c33['id']||0x0;this['name']=_0x277c33[_0x7e8f('0x0')]||'';this[_0x7e8f('0x1')]=_0x277c33[_0x7e8f('0x1')]||'';this[_0x7e8f('0x2')]=_0x277c33[_0x7e8f('0x2')]||'';this[_0x7e8f('0x3')]=_0x277c33[_0x7e8f('0x3')]||'';this['password']=_0x277c33['password']||'';this[_0x7e8f('0x4')]=_0x277c33[_0x7e8f('0x4')]||'';this['consumerSecret']=_0x277c33[_0x7e8f('0x5')]||'';this[_0x7e8f('0x6')]=_0x277c33[_0x7e8f('0x6')]||'';this[_0x7e8f('0x7')]=_0x277c33[_0x7e8f('0x7')]||'';this[_0x7e8f('0x8')]=_0x277c33[_0x7e8f('0x8')]||'';this['serverUrl']=_0x277c33[_0x7e8f('0x9')]||'';this[_0x7e8f('0xa')]=_0x277c33['Configurations']||{};}module[_0x7e8f('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 08ce803..2115d2f 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 _0xbfab=['serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x480f02,_0x6634ec){var _0x4121b7=function(_0x250d44){while(--_0x250d44){_0x480f02['push'](_0x480f02['shift']());}};_0x4121b7(++_0x6634ec);}(_0xbfab,0x8f));var _0xbbfa=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xbfab[_0x24237f];return _0x48298e;};'use strict';function Dynamics365Account(_0x5881c7){this['id']=_0x5881c7['id']||0x0;this[_0xbbfa('0x0')]=_0x5881c7[_0xbbfa('0x0')]||'';this['username']=_0x5881c7[_0xbbfa('0x1')]||'';this[_0xbbfa('0x2')]=_0x5881c7[_0xbbfa('0x2')]||'';this[_0xbbfa('0x3')]=_0x5881c7['remoteUri']||'';this[_0xbbfa('0x4')]=_0x5881c7[_0xbbfa('0x4')]||'';this[_0xbbfa('0x5')]=_0x5881c7[_0xbbfa('0x5')]||'';this['clientSecret']=_0x5881c7[_0xbbfa('0x6')]||{};this['serverUrl']=_0x5881c7[_0xbbfa('0x7')]||'';this['Configurations']=_0x5881c7[_0xbbfa('0x8')]||{};}module[_0xbbfa('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x3840=['password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name','username'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x3840,0x94));var _0x0384=function(_0x483df9,_0x2eafef){_0x483df9=_0x483df9-0x0;var _0x4d2796=_0x3840[_0x483df9];return _0x4d2796;};'use strict';function Dynamics365Account(_0x2380ac){this['id']=_0x2380ac['id']||0x0;this['name']=_0x2380ac[_0x0384('0x0')]||'';this[_0x0384('0x1')]=_0x2380ac[_0x0384('0x1')]||'';this['password']=_0x2380ac[_0x0384('0x2')]||'';this[_0x0384('0x3')]=_0x2380ac[_0x0384('0x3')]||'';this[_0x0384('0x4')]=_0x2380ac['tenantId']||'';this['clientId']=_0x2380ac[_0x0384('0x5')]||'';this[_0x0384('0x6')]=_0x2380ac[_0x0384('0x6')]||{};this[_0x0384('0x7')]=_0x2380ac['serverUrl']||'';this[_0x0384('0x8')]=_0x2380ac[_0x0384('0x8')]||{};}module[_0x0384('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index dfc7756..9c4fcc0 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 _0x394d=['modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','description','ecm','headerinfo','localstationid','minrate','maxrate'];(function(_0x385c76,_0xb97335){var _0x5c8367=function(_0xdfcd3){while(--_0xdfcd3){_0x385c76['push'](_0x385c76['shift']());}};_0x5c8367(++_0xb97335);}(_0x394d,0x12a));var _0xd394=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x394d[_0x36ed48];return _0x51c63a;};'use strict';function FaxAccount(_0x4c1947){this['id']=_0x4c1947['id']||0x0;this['name']=_0x4c1947['name']||'';this['description']=_0x4c1947[_0xd394('0x0')];this[_0xd394('0x1')]=_0x4c1947['ecm'];this[_0xd394('0x2')]=_0x4c1947['headerinfo'];this[_0xd394('0x3')]=_0x4c1947['localstationid'];this['minrate']=_0x4c1947[_0xd394('0x4')]||0x960;this['maxrate']=_0x4c1947[_0xd394('0x5')]||0x3840;this['modem']=_0x4c1947[_0xd394('0x6')]||'v17,v27,v29';this[_0xd394('0x7')]=_0x4c1947['gateway']||'no';this[_0xd394('0x8')]=_0x4c1947['faxdetect']||'no';this['t38timeout']=_0x4c1947[_0xd394('0x9')]||0x1388;this['tech']=_0x4c1947[_0xd394('0xa')]||_0xd394('0xb');this[_0xd394('0xc')]=_0x4c1947[_0xd394('0xc')]?_0x4c1947[_0xd394('0xc')]:undefined;this['ListId']=_0x4c1947[_0xd394('0xd')];this[_0xd394('0xe')]=_0x4c1947[_0xd394('0xe')];}module[_0xd394('0xf')]=FaxAccount; \ No newline at end of file +var _0x05f4=['modem','gateway','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x05f4,0x149));var _0x405f=function(_0x4185d6,_0x2a3eda){_0x4185d6=_0x4185d6-0x0;var _0x31b522=_0x05f4[_0x4185d6];return _0x31b522;};'use strict';function FaxAccount(_0x55a068){this['id']=_0x55a068['id']||0x0;this[_0x405f('0x0')]=_0x55a068[_0x405f('0x0')]||'';this[_0x405f('0x1')]=_0x55a068[_0x405f('0x1')];this[_0x405f('0x2')]=_0x55a068[_0x405f('0x2')];this[_0x405f('0x3')]=_0x55a068[_0x405f('0x3')];this[_0x405f('0x4')]=_0x55a068['localstationid'];this[_0x405f('0x5')]=_0x55a068['minrate']||0x960;this[_0x405f('0x6')]=_0x55a068[_0x405f('0x6')]||0x3840;this[_0x405f('0x7')]=_0x55a068[_0x405f('0x7')]||'v17,v27,v29';this[_0x405f('0x8')]=_0x55a068['gateway']||'no';this['faxdetect']=_0x55a068['faxdetect']||'no';this[_0x405f('0x9')]=_0x55a068[_0x405f('0x9')]||0x1388;this[_0x405f('0xa')]=_0x55a068['tech']||_0x405f('0xb');this[_0x405f('0xc')]=_0x55a068['Trunk']?_0x55a068[_0x405f('0xc')]:undefined;this[_0x405f('0xd')]=_0x55a068['ListId'];this['key']=_0x55a068[_0x405f('0xe')];}module[_0x405f('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index d51aaec..d9a9ac6 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 _0x2c20=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x58e173,_0x46eb42){var _0x2d89c0=function(_0x2b350b){while(--_0x2b350b){_0x58e173['push'](_0x58e173['shift']());}};_0x2d89c0(++_0x46eb42);}(_0x2c20,0x126));var _0x02c2=function(_0x3007c,_0x2cd422){_0x3007c=_0x3007c-0x0;var _0x1c9b8f=_0x2c20[_0x3007c];return _0x1c9b8f;};'use strict';function FreshdeskAccount(_0x130d12){this['id']=_0x130d12['id']||0x0;this[_0x02c2('0x0')]=_0x130d12[_0x02c2('0x0')]||'';this['username']=_0x130d12[_0x02c2('0x1')]||'';this[_0x02c2('0x2')]=_0x130d12[_0x02c2('0x3')]||'';this[_0x02c2('0x4')]=_0x130d12[_0x02c2('0x4')]||'';this[_0x02c2('0x5')]=_0x130d12[_0x02c2('0x5')]||'';this['Configurations']=_0x130d12[_0x02c2('0x6')]||{};}module[_0x02c2('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x84f6=['token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x54afe9,_0x281c8d){var _0x3afef4=function(_0x3c1930){while(--_0x3c1930){_0x54afe9['push'](_0x54afe9['shift']());}};_0x3afef4(++_0x281c8d);}(_0x84f6,0x67));var _0x684f=function(_0x14a862,_0x2b559d){_0x14a862=_0x14a862-0x0;var _0x245eb5=_0x84f6[_0x14a862];return _0x245eb5;};'use strict';function FreshdeskAccount(_0x18b3f6){this['id']=_0x18b3f6['id']||0x0;this[_0x684f('0x0')]=_0x18b3f6['name']||'';this[_0x684f('0x1')]=_0x18b3f6['username']||'';this['apiKey']=_0x18b3f6[_0x684f('0x2')]||'';this[_0x684f('0x3')]=_0x18b3f6[_0x684f('0x3')]||'';this['serverUrl']=_0x18b3f6[_0x684f('0x4')]||'';this[_0x684f('0x5')]=_0x18b3f6[_0x684f('0x5')]||{};}module[_0x684f('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 2298b81..83398ba 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 _0xde00=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xde00,0x19b));var _0x0de0=function(_0x5b96f6,_0x26fe54){_0x5b96f6=_0x5b96f6-0x0;var _0xe67cd8=_0xde00[_0x5b96f6];return _0xe67cd8;};'use strict';function FreshsalesAccount(_0x401c8d){this['id']=_0x401c8d['id']||0x0;this[_0x0de0('0x0')]=_0x401c8d[_0x0de0('0x0')]||'';this[_0x0de0('0x1')]=_0x401c8d[_0x0de0('0x1')]||'';this[_0x0de0('0x2')]=_0x401c8d[_0x0de0('0x3')]||'';this[_0x0de0('0x4')]=_0x401c8d[_0x0de0('0x4')]||'';this[_0x0de0('0x5')]=_0x401c8d[_0x0de0('0x5')]||'';this[_0x0de0('0x6')]=_0x401c8d[_0x0de0('0x6')]||{};}module[_0x0de0('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0xfc22=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x27ba79,_0x466682){var _0x22837c=function(_0x4f9d36){while(--_0x4f9d36){_0x27ba79['push'](_0x27ba79['shift']());}};_0x22837c(++_0x466682);}(_0xfc22,0xd7));var _0x2fc2=function(_0x3b724b,_0xed6fb6){_0x3b724b=_0x3b724b-0x0;var _0x4aefa5=_0xfc22[_0x3b724b];return _0x4aefa5;};'use strict';function FreshsalesAccount(_0x4e1012){this['id']=_0x4e1012['id']||0x0;this[_0x2fc2('0x0')]=_0x4e1012[_0x2fc2('0x0')]||'';this[_0x2fc2('0x1')]=_0x4e1012[_0x2fc2('0x1')]||'';this[_0x2fc2('0x2')]=_0x4e1012[_0x2fc2('0x3')]||'';this[_0x2fc2('0x4')]=_0x4e1012['remoteUri']||'';this[_0x2fc2('0x5')]=_0x4e1012[_0x2fc2('0x5')]||'';this[_0x2fc2('0x6')]=_0x4e1012[_0x2fc2('0x6')]||{};}module[_0x2fc2('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 5560982..28f7dd5 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 _0x814b=['priority','holdtime','mohtime','variables','exports','type','inbound','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','channel','connectedlinename','context','exten'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x814b,0x1bd));var _0xb814=function(_0x4e6fb2,_0x3cf23e){_0x4e6fb2=_0x4e6fb2-0x0;var _0x2f1636=_0x814b[_0x4e6fb2];return _0x2f1636;};'use strict';function QueueReport(){this[_0xb814('0x0')]=_0xb814('0x1');this['uniqueid']='';this[_0xb814('0x2')]='';this[_0xb814('0x3')]='';this[_0xb814('0x4')]='';this[_0xb814('0x5')]=null;this[_0xb814('0x6')]=null;this['position']=0x1;this['count']=0x1;this[_0xb814('0x7')]=![];this[_0xb814('0x8')]=null;this[_0xb814('0x9')]=![];this[_0xb814('0xa')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this[_0xb814('0xb')]='';this['connectedlinenum']='';this[_0xb814('0xc')]='';this['accountcode']='';this[_0xb814('0xd')]='';this[_0xb814('0xe')]='';this[_0xb814('0xf')]='';this[_0xb814('0x10')]=0x0;this['assigned']=![];this['lastAssignedTo']='';this[_0xb814('0x11')]=0x0;this[_0xb814('0x12')]={};}module[_0xb814('0x13')]=QueueReport; \ No newline at end of file +var _0xef1e=['queuecallerabandon','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','context','exten','priority','holdtime','lastAssignedTo','mohtime','variables','exports','type','inbound','calleridname','queuecallerleaveAt','position','count'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xef1e,0x10b));var _0xeef1=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xef1e[_0x17d9e3];return _0x14192d;};'use strict';function QueueReport(){this[_0xeef1('0x0')]=_0xeef1('0x1');this['uniqueid']='';this['calleridnum']='';this[_0xeef1('0x2')]='';this['queue']='';this['queuecallerjoinAt']=null;this[_0xeef1('0x3')]=null;this[_0xeef1('0x4')]=0x1;this[_0xeef1('0x5')]=0x1;this[_0xeef1('0x6')]=![];this['queuecallerabandonAt']=null;this[_0xeef1('0x7')]=![];this['queuecallercompleteAt']=null;this[_0xeef1('0x8')]=![];this[_0xeef1('0x9')]=null;this[_0xeef1('0xa')]=0x1;this['channel']='';this[_0xeef1('0xb')]='';this[_0xeef1('0xc')]='';this['accountcode']='';this[_0xeef1('0xd')]='';this[_0xeef1('0xe')]='';this[_0xeef1('0xf')]='';this[_0xeef1('0x10')]=0x0;this['assigned']=![];this[_0xeef1('0x11')]='';this[_0xeef1('0x12')]=0x0;this[_0xeef1('0x13')]={};}module[_0xeef1('0x14')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index e550c49..f456a14 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 _0xf48e=['Configurations','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl'];(function(_0x18c545,_0x358a34){var _0x4127a2=function(_0x15a042){while(--_0x15a042){_0x18c545['push'](_0x18c545['shift']());}};_0x4127a2(++_0x358a34);}(_0xf48e,0xe8));var _0xef48=function(_0x466c49,_0x40a20e){_0x466c49=_0x466c49-0x0;var _0x152618=_0xf48e[_0x466c49];return _0x152618;};'use strict';function SalesforceAccount(_0xca4cc9){this['id']=_0xca4cc9['id']||0x0;this[_0xef48('0x0')]=_0xca4cc9[_0xef48('0x0')]||'';this[_0xef48('0x1')]=_0xca4cc9[_0xef48('0x1')]||'';this[_0xef48('0x2')]=_0xca4cc9[_0xef48('0x2')]||'';this[_0xef48('0x3')]=_0xca4cc9['password']||'';this[_0xef48('0x4')]=_0xca4cc9['clientId']||'';this['clientSecret']=_0xca4cc9[_0xef48('0x5')]||'';this[_0xef48('0x6')]=_0xca4cc9['securityToken']||'';this[_0xef48('0x7')]=_0xca4cc9[_0xef48('0x7')]||_0xef48('0x8');this[_0xef48('0x9')]=_0xca4cc9[_0xef48('0x9')]||'';this[_0xef48('0xa')]=_0xca4cc9['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x71c2=['username','remoteUri','password','clientId','clientSecret','securityToken','serverUrl','Configurations','exports'];(function(_0x45cb89,_0x99520e){var _0x5948c1=function(_0x4c81c3){while(--_0x4c81c3){_0x45cb89['push'](_0x45cb89['shift']());}};_0x5948c1(++_0x99520e);}(_0x71c2,0x132));var _0x271c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x71c2[_0x3dd15e];return _0x231fd0;};'use strict';function SalesforceAccount(_0x4ead2f){this['id']=_0x4ead2f['id']||0x0;this['name']=_0x4ead2f['name']||'';this['username']=_0x4ead2f[_0x271c('0x0')]||'';this[_0x271c('0x1')]=_0x4ead2f[_0x271c('0x1')]||'';this[_0x271c('0x2')]=_0x4ead2f[_0x271c('0x2')]||'';this[_0x271c('0x3')]=_0x4ead2f[_0x271c('0x3')]||'';this[_0x271c('0x4')]=_0x4ead2f[_0x271c('0x4')]||'';this['securityToken']=_0x4ead2f[_0x271c('0x5')]||'';this['type']=_0x4ead2f['type']||'integrationTab';this[_0x271c('0x6')]=_0x4ead2f[_0x271c('0x6')]||'';this['Configurations']=_0x4ead2f[_0x271c('0x7')]||{};}module[_0x271c('0x8')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 860003a..6d75456 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 _0xe8dd=['username','password','serverUrl','Configurations','name'];(function(_0x5c643f,_0x262327){var _0x3a3b57=function(_0x3151c7){while(--_0x3151c7){_0x5c643f['push'](_0x5c643f['shift']());}};_0x3a3b57(++_0x262327);}(_0xe8dd,0x1e9));var _0xde8d=function(_0x520575,_0x1a9ac9){_0x520575=_0x520575-0x0;var _0xdde816=_0xe8dd[_0x520575];return _0xdde816;};'use strict';function ServicenowAccount(_0x2a974b){this['id']=_0x2a974b['id']||0x0;this[_0xde8d('0x0')]=_0x2a974b[_0xde8d('0x0')]||'';this[_0xde8d('0x1')]=_0x2a974b[_0xde8d('0x1')]||'';this[_0xde8d('0x2')]=_0x2a974b[_0xde8d('0x2')]||'';this['remoteUri']=_0x2a974b['remoteUri']||'';this[_0xde8d('0x3')]=_0x2a974b['serverUrl']||'';this[_0xde8d('0x4')]=_0x2a974b['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xd0b2=['Configurations','exports','name','username','password','remoteUri'];(function(_0x58212d,_0x59edaf){var _0x24277d=function(_0x52e5b3){while(--_0x52e5b3){_0x58212d['push'](_0x58212d['shift']());}};_0x24277d(++_0x59edaf);}(_0xd0b2,0x74));var _0x2d0b=function(_0x4adec4,_0x31740d){_0x4adec4=_0x4adec4-0x0;var _0x338cc5=_0xd0b2[_0x4adec4];return _0x338cc5;};'use strict';function ServicenowAccount(_0x5f1ef9){this['id']=_0x5f1ef9['id']||0x0;this['name']=_0x5f1ef9[_0x2d0b('0x0')]||'';this[_0x2d0b('0x1')]=_0x5f1ef9['username']||'';this[_0x2d0b('0x2')]=_0x5f1ef9['password']||'';this[_0x2d0b('0x3')]=_0x5f1ef9['remoteUri']||'';this['serverUrl']=_0x5f1ef9['serverUrl']||'';this['Configurations']=_0x5f1ef9[_0x2d0b('0x4')]||{};}module[_0x2d0b('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 44a3f84..395f0a5 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 _0x4757=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x51faa1,_0x15a088){var _0x43aae9=function(_0x11c1ee){while(--_0x11c1ee){_0x51faa1['push'](_0x51faa1['shift']());}};_0x43aae9(++_0x15a088);}(_0x4757,0x139));var _0x7475=function(_0x14476b,_0xd1a7a4){_0x14476b=_0x14476b-0x0;var _0x24e2e8=_0x4757[_0x14476b];return _0x24e2e8;};'use strict';function SugarcrmAccount(_0x2157a6){this['id']=_0x2157a6['id']||0x0;this[_0x7475('0x0')]=_0x2157a6[_0x7475('0x0')]||'';this[_0x7475('0x1')]=_0x2157a6[_0x7475('0x1')]||'';this[_0x7475('0x2')]=_0x2157a6[_0x7475('0x2')]||'';this[_0x7475('0x3')]=_0x2157a6[_0x7475('0x3')]||'';this[_0x7475('0x4')]=_0x2157a6[_0x7475('0x4')]||'';this[_0x7475('0x5')]=_0x2157a6['Configurations']||{};}module[_0x7475('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xe244=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x528056,_0x3522a0){var _0x57cb6a=function(_0x4929d4){while(--_0x4929d4){_0x528056['push'](_0x528056['shift']());}};_0x57cb6a(++_0x3522a0);}(_0xe244,0x1e1));var _0x4e24=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xe244[_0x160c73];return _0xd9302;};'use strict';function SugarcrmAccount(_0x427569){this['id']=_0x427569['id']||0x0;this[_0x4e24('0x0')]=_0x427569[_0x4e24('0x0')]||'';this[_0x4e24('0x1')]=_0x427569[_0x4e24('0x1')]||'';this['password']=_0x427569[_0x4e24('0x2')]||'';this[_0x4e24('0x3')]=_0x427569['remoteUri']||'';this[_0x4e24('0x4')]=_0x427569[_0x4e24('0x4')]||'';this[_0x4e24('0x5')]=_0x427569['Configurations']||{};}module[_0x4e24('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 7c20152..4024f61 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 _0x4352=['exports','name','accountcode','state','address'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4352,0x92));var _0x2435=function(_0x405279,_0x452349){_0x405279=_0x405279-0x0;var _0x77b91c=_0x4352[_0x405279];return _0x77b91c;};'use strict';function Telephone(_0x3d13c1){this['id']=_0x3d13c1['id']||0x0;this[_0x2435('0x0')]=_0x3d13c1[_0x2435('0x0')]||'';this[_0x2435('0x1')]=_0x3d13c1[_0x2435('0x1')]||'';this[_0x2435('0x2')]='unknown';this['stateTime']=0x0;this['status']='unknown';this[_0x2435('0x3')]='';}module[_0x2435('0x4')]=Telephone; \ No newline at end of file +var _0xee0b=['name','accountcode','state','unknown','stateTime','status','address','exports'];(function(_0x324adb,_0x3106d3){var _0x45f1ac=function(_0x26f651){while(--_0x26f651){_0x324adb['push'](_0x324adb['shift']());}};_0x45f1ac(++_0x3106d3);}(_0xee0b,0x138));var _0xbee0=function(_0x2485d8,_0xb06cc3){_0x2485d8=_0x2485d8-0x0;var _0xd3fefb=_0xee0b[_0x2485d8];return _0xd3fefb;};'use strict';function Telephone(_0x2a79d9){this['id']=_0x2a79d9['id']||0x0;this[_0xbee0('0x0')]=_0x2a79d9[_0xbee0('0x0')]||'';this[_0xbee0('0x1')]=_0x2a79d9[_0xbee0('0x1')]||'';this[_0xbee0('0x2')]=_0xbee0('0x3');this[_0xbee0('0x4')]=0x0;this[_0xbee0('0x5')]=_0xbee0('0x3');this[_0xbee0('0x6')]='';}module[_0xbee0('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 c526ce9..7753bfe 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 _0xccc8=['html','name'];(function(_0x35d568,_0x4d47ae){var _0x5dac84=function(_0x265aaf){while(--_0x265aaf){_0x35d568['push'](_0x35d568['shift']());}};_0x5dac84(++_0x4d47ae);}(_0xccc8,0xa3));var _0x8ccc=function(_0x28f1de,_0x355054){_0x28f1de=_0x28f1de-0x0;var _0x5b5dad=_0xccc8[_0x28f1de];return _0x5b5dad;};'use strict';function template(_0x5a3808){this['id']=_0x5a3808['id']||0x0;this['name']=_0x5a3808[_0x8ccc('0x0')]||'';this[_0x8ccc('0x1')]=_0x5a3808[_0x8ccc('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0x7fc4=['exports','name','html'];(function(_0x58712a,_0x1d88a9){var _0x342032=function(_0x5365f0){while(--_0x5365f0){_0x58712a['push'](_0x58712a['shift']());}};_0x342032(++_0x1d88a9);}(_0x7fc4,0x1cf));var _0x47fc=function(_0x5efc1a,_0x3c3aa7){_0x5efc1a=_0x5efc1a-0x0;var _0x4184a2=_0x7fc4[_0x5efc1a];return _0x4184a2;};'use strict';function template(_0x4fc577){this['id']=_0x4fc577['id']||0x0;this[_0x47fc('0x0')]=_0x4fc577['name']||'';this[_0x47fc('0x1')]=_0x4fc577['html']||'';}module[_0x47fc('0x2')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index ee1cbf8..9b13a11 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 _0x3e74=['Actions','name','channel','status','AllConditions','AnyConditions'];(function(_0x5340fc,_0x3cc227){var _0x4efede=function(_0x41a1a7){while(--_0x41a1a7){_0x5340fc['push'](_0x5340fc['shift']());}};_0x4efede(++_0x3cc227);}(_0x3e74,0x175));var _0x43e7=function(_0x346fbc,_0x477fa0){_0x346fbc=_0x346fbc-0x0;var _0x33f699=_0x3e74[_0x346fbc];return _0x33f699;};'use strict';function Trigger(_0x284ef8){this['id']=_0x284ef8['id']||0x0;this['name']=_0x284ef8[_0x43e7('0x0')]||'';this[_0x43e7('0x1')]=_0x284ef8[_0x43e7('0x1')]||'voice';this['status']=_0x284ef8[_0x43e7('0x2')]||![];this['AllConditions']=_0x284ef8[_0x43e7('0x3')]||[];this[_0x43e7('0x4')]=_0x284ef8[_0x43e7('0x4')]||[];this[_0x43e7('0x5')]=_0x284ef8[_0x43e7('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0xa41a=['AnyConditions','Actions','name','channel','voice','status','AllConditions'];(function(_0x21c64a,_0x3f4839){var _0x2e038d=function(_0x5a8ae4){while(--_0x5a8ae4){_0x21c64a['push'](_0x21c64a['shift']());}};_0x2e038d(++_0x3f4839);}(_0xa41a,0x6b));var _0xaa41=function(_0x1e7518,_0x2f66b5){_0x1e7518=_0x1e7518-0x0;var _0x377f20=_0xa41a[_0x1e7518];return _0x377f20;};'use strict';function Trigger(_0x33e667){this['id']=_0x33e667['id']||0x0;this[_0xaa41('0x0')]=_0x33e667['name']||'';this[_0xaa41('0x1')]=_0x33e667[_0xaa41('0x1')]||_0xaa41('0x2');this[_0xaa41('0x3')]=_0x33e667[_0xaa41('0x3')]||![];this[_0xaa41('0x4')]=_0x33e667[_0xaa41('0x4')]||[];this[_0xaa41('0x5')]=_0x33e667['AnyConditions']||[];this[_0xaa41('0x6')]=_0x33e667[_0xaa41('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index e7b5d68..0267180 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 _0xebae=['registrationtime','address','active','unknown','stateTime','registry','indexOf','host','port','domain','domainport','stateRegistry'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xebae,0x1ee));var _0xeeba=function(_0x4450b1,_0x214ace){_0x4450b1=_0x4450b1-0x0;var _0x399b0b=_0xebae[_0x4450b1];return _0x399b0b;};'use strict';function Trunk(_0x41e0f7){this['id']=_0x41e0f7['id']||0x0;this[_0xeeba('0x0')]=_0x41e0f7['active']||![];this['name']=_0x41e0f7['name']||'';this['state']=_0xeeba('0x1');this[_0xeeba('0x2')]=0x0;this['status']='unknown';this[_0xeeba('0x3')]=_0x41e0f7[_0xeeba('0x3')]&&_0x41e0f7[_0xeeba('0x3')][_0xeeba('0x4')](':')?_0x41e0f7['registry']['split'](':')[0x0]:'';this[_0xeeba('0x5')]='';this[_0xeeba('0x6')]='';this[_0xeeba('0x7')]='';this[_0xeeba('0x8')]='';this['refresh']='';this[_0xeeba('0x9')]=_0xeeba('0x1');this[_0xeeba('0xa')]='';this[_0xeeba('0xb')]='';}module['exports']=Trunk; \ No newline at end of file +var _0x553f=['stateRegistry','unknown','registrationtime','address','exports','active','name','stateTime','registry','host','port','domainport'];(function(_0x2c6294,_0x5c270c){var _0x14199e=function(_0xb38fe1){while(--_0xb38fe1){_0x2c6294['push'](_0x2c6294['shift']());}};_0x14199e(++_0x5c270c);}(_0x553f,0xc5));var _0xf553=function(_0x4e0fe8,_0x276220){_0x4e0fe8=_0x4e0fe8-0x0;var _0x1ee15b=_0x553f[_0x4e0fe8];return _0x1ee15b;};'use strict';function Trunk(_0x1d5097){this['id']=_0x1d5097['id']||0x0;this[_0xf553('0x0')]=_0x1d5097[_0xf553('0x0')]||![];this[_0xf553('0x1')]=_0x1d5097[_0xf553('0x1')]||'';this['state']='unknown';this[_0xf553('0x2')]=0x0;this['status']='unknown';this['registry']=_0x1d5097[_0xf553('0x3')]&&_0x1d5097[_0xf553('0x3')]['indexOf'](':')?_0x1d5097[_0xf553('0x3')]['split'](':')[0x0]:'';this[_0xf553('0x4')]='';this[_0xf553('0x5')]='';this['domain']='';this[_0xf553('0x6')]='';this['refresh']='';this[_0xf553('0x7')]=_0xf553('0x8');this[_0xf553('0x9')]='';this[_0xf553('0xa')]='';}module[_0xf553('0xb')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index e1530c0..8f44245 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 _0xdd7a=['exports','exten','mandatoryDisposition'];(function(_0x21bedb,_0x628fba){var _0x316ef8=function(_0x30c979){while(--_0x30c979){_0x21bedb['push'](_0x21bedb['shift']());}};_0x316ef8(++_0x628fba);}(_0xdd7a,0x94));var _0xadd7=function(_0x3d217c,_0x412b63){_0x3d217c=_0x3d217c-0x0;var _0x153227=_0xdd7a[_0x3d217c];return _0x153227;};'use strict';function voiceExtension(_0x271c3c){this['id']=_0x271c3c['id']||0x0;this[_0xadd7('0x0')]=_0x271c3c[_0xadd7('0x0')]||'';this['recordingFormat']=_0x271c3c['recordingFormat']||'none';this[_0xadd7('0x1')]=_0x271c3c[_0xadd7('0x1')]||![];}module[_0xadd7('0x2')]=voiceExtension; \ No newline at end of file +var _0xb017=['none','mandatoryDisposition','exten','recordingFormat'];(function(_0x2f8be8,_0x46cff7){var _0x58b0d7=function(_0x3fc1a8){while(--_0x3fc1a8){_0x2f8be8['push'](_0x2f8be8['shift']());}};_0x58b0d7(++_0x46cff7);}(_0xb017,0x76));var _0x7b01=function(_0x13bbaf,_0x3004d3){_0x13bbaf=_0x13bbaf-0x0;var _0xb5ee38=_0xb017[_0x13bbaf];return _0xb5ee38;};'use strict';function voiceExtension(_0x50e266){this['id']=_0x50e266['id']||0x0;this[_0x7b01('0x0')]=_0x50e266[_0x7b01('0x0')]||'';this[_0x7b01('0x1')]=_0x50e266[_0x7b01('0x1')]||_0x7b01('0x2');this[_0x7b01('0x3')]=_0x50e266[_0x7b01('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index cb5023e..bd862b4 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 _0x3062=['predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumBillable','unmanaged','abandoned','loggedIn','acw','acwTimeout','autopause','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3062,0x187));var _0x2306=function(_0x5c0dcb,_0x16cd83){_0x5c0dcb=_0x5c0dcb-0x0;var _0x183a0e=_0x3062[_0x5c0dcb];return _0x183a0e;};'use strict';var statusDesc=[_0x2306('0x0'),_0x2306('0x1'),_0x2306('0x2'),_0x2306('0x3'),'invalid',_0x2306('0x4'),_0x2306('0x5'),_0x2306('0x6'),_0x2306('0x7')];var monitorFormat={'wav':_0x2306('0x8'),'wav49':_0x2306('0x9'),'gsm':_0x2306('0xa')};var strategy={'rrmemory':_0x2306('0xb'),'roundrobin':_0x2306('0xc')};function VoiceQueue(_0x3f42ce){this['id']=_0x3f42ce['id']||0x0;this[_0x2306('0xd')]=_0x3f42ce['name']||'';this['monitor_format']=_0x3f42ce[_0x2306('0xe')]||'';this[_0x2306('0xf')]=_0x3f42ce[_0x2306('0xf')]||_0x2306('0x10');this[_0x2306('0x11')]=0x0;this[_0x2306('0x12')]=0x0;this[_0x2306('0x13')]=0x0;this[_0x2306('0x14')]=0x0;this[_0x2306('0x15')]=0x0;this['sumHoldTime']=0x0;this[_0x2306('0x16')]=0x0;this[_0x2306('0x17')]=0x0;this[_0x2306('0x18')]=0x0;this[_0x2306('0x19')]=0x0;this['available']=0x0;this['acw']=_0x3f42ce[_0x2306('0x1a')]||![];this[_0x2306('0x1b')]=_0x3f42ce['acwTimeout']||0xa;this[_0x2306('0x1c')]=_0x3f42ce['autopause']||'no';this['sendMessageOneNotActive']=!![];this[_0x2306('0x1d')]='';this[_0x2306('0x1e')]=0x0;this[_0x2306('0x1f')]=0x0;this[_0x2306('0x20')]=_0x3f42ce['dialTimezone']||null;this['dialGlobalInterval']=_0x3f42ce[_0x2306('0x21')]?_0x3f42ce[_0x2306('0x21')]:null;this['dialActive']=_0x3f42ce[_0x2306('0x22')];this['dialMethod']=_0x3f42ce[_0x2306('0x23')]||_0x2306('0x24');this[_0x2306('0x25')]=_0x3f42ce[_0x2306('0x25')]||0x0;this[_0x2306('0x26')]=_0x3f42ce[_0x2306('0x26')]||0x0;this[_0x2306('0x27')]=_0x3f42ce[_0x2306('0x27')]||0x1;this[_0x2306('0x28')]=_0x3f42ce[_0x2306('0x28')]||_0x2306('0x29');this[_0x2306('0x2a')]=_0x3f42ce['dialPredictiveOptimizationPercentage']||0.03;this[_0x2306('0x2b')]=_0x3f42ce[_0x2306('0x2b')]||0x258;this['dialOriginateCallerIdName']=_0x3f42ce[_0x2306('0x2c')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x3f42ce[_0x2306('0x2d')]||_0x2306('0x2e');this[_0x2306('0x2f')]=_0x3f42ce[_0x2306('0x2f')]||0x1e;this[_0x2306('0x30')]=_0x3f42ce[_0x2306('0x30')]||_0x2306('0x31');this['dialQueueTimeout']=_0x3f42ce['dialQueueTimeout']||0x3;this[_0x2306('0x32')]=_0x3f42ce[_0x2306('0x32')]||undefined;this[_0x2306('0x33')]=_0x3f42ce[_0x2306('0x33')]||0x3;this[_0x2306('0x34')]=_0x3f42ce[_0x2306('0x34')]||0x96;this[_0x2306('0x35')]=_0x3f42ce[_0x2306('0x35')]||0x3;this[_0x2306('0x36')]=_0x3f42ce[_0x2306('0x36')]||0x96;this[_0x2306('0x37')]=_0x3f42ce[_0x2306('0x37')]||0x3;this['dialNoAnswerRetryFrequency']=_0x3f42ce[_0x2306('0x38')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x3f42ce[_0x2306('0x39')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x3f42ce['dialNoSuchNumberRetryFrequency']||0x96;this[_0x2306('0x3a')]=_0x3f42ce[_0x2306('0x3a')]||0x3;this['dialDropRetryFrequency']=_0x3f42ce['dialDropRetryFrequency']||0x96;this[_0x2306('0x3b')]=_0x3f42ce[_0x2306('0x3b')]||0x3;this['dialAbandonedRetryFrequency']=_0x3f42ce[_0x2306('0x3c')]||0x96;this[_0x2306('0x3d')]=_0x3f42ce[_0x2306('0x3d')]||0x3;this['dialMachineRetryFrequency']=_0x3f42ce[_0x2306('0x3e')]||0x96;this[_0x2306('0x3f')]=_0x3f42ce['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x3f42ce[_0x2306('0x40')]||0x96;this[_0x2306('0x41')]=_0x3f42ce[_0x2306('0x41')]||0x4;this[_0x2306('0x42')]=_0x3f42ce[_0x2306('0x42')]?_0x3f42ce[_0x2306('0x42')]:undefined;this[_0x2306('0x43')]=_0x3f42ce[_0x2306('0x43')]?_0x3f42ce['TrunkBackup']:undefined;this[_0x2306('0x44')]=_0x3f42ce[_0x2306('0x44')]||undefined;this[_0x2306('0x45')]=_0x3f42ce[_0x2306('0x45')]?_0x3f42ce[_0x2306('0x45')]:undefined;this[_0x2306('0x46')]=_0x3f42ce[_0x2306('0x46')]||_0x2306('0x47');this['dialRandomLastDigitCallerIdNumber']=_0x3f42ce[_0x2306('0x48')]||undefined;this[_0x2306('0x49')]=_0x3f42ce[_0x2306('0x49')]||undefined;this['strategy']=strategy[_0x3f42ce[_0x2306('0x4a')]]||_0x2306('0xb');this[_0x2306('0x4b')]=!![];this[_0x2306('0x4c')]=_0x3f42ce[_0x2306('0x4c')]||![];this[_0x2306('0x4d')]=_0x3f42ce[_0x2306('0x4d')];this[_0x2306('0x4e')]=_0x3f42ce['dialAMDGreeting'];this[_0x2306('0x4f')]=_0x3f42ce[_0x2306('0x4f')];this[_0x2306('0x50')]=_0x3f42ce[_0x2306('0x50')];this['dialAMDMinWordLength']=_0x3f42ce[_0x2306('0x51')];this[_0x2306('0x52')]=_0x3f42ce[_0x2306('0x52')];this[_0x2306('0x53')]=_0x3f42ce[_0x2306('0x53')];this[_0x2306('0x54')]=_0x3f42ce[_0x2306('0x54')];this[_0x2306('0x55')]=_0x3f42ce[_0x2306('0x55')];this['outboundRejectCallsDay']=0x0;this[_0x2306('0x56')]=0x0;this[_0x2306('0x57')]=_0x3f42ce[_0x2306('0x57')];this[_0x2306('0x58')]=0x0;this[_0x2306('0x59')]=0x0;this[_0x2306('0x5a')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x2306('0x5b')]=0x0;this[_0x2306('0x5c')]=0x0;this[_0x2306('0x5d')]=0x0;this[_0x2306('0x5e')]=0x0;this[_0x2306('0x5f')]=0x0;this[_0x2306('0x60')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x2306('0x61')]=0x0;this['outboundReCallsDay']=0x0;this[_0x2306('0x62')]=0x0;this['startProgressive']=undefined;this[_0x2306('0x63')]=undefined;this[_0x2306('0x64')]=undefined;this[_0x2306('0x65')]=1.05;this[_0x2306('0x66')]=0x0;this[_0x2306('0x67')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x2306('0x68')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x2306('0x69')]=0x0;this[_0x2306('0x6a')]=0x0;this[_0x2306('0x6b')]=0x0;this['predictiveIntervalMaxThreshold']=_0x3f42ce[_0x2306('0x6c')]||0x14;this[_0x2306('0x6d')]=_0x3f42ce[_0x2306('0x6c')]||0xa;this[_0x2306('0x6e')]=0x0;this[_0x2306('0x6f')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x2306('0x70')]=0x0;this[_0x2306('0x71')]=0x0;this[_0x2306('0x72')]=0x0;this[_0x2306('0x73')]=0x0;this[_0x2306('0x74')]=_0x3f42ce[_0x2306('0x74')]||0x1e;this[_0x2306('0x75')]=_0x3f42ce[_0x2306('0x75')]||![];this[_0x2306('0x76')]=_0x3f42ce[_0x2306('0x76')]||undefined;this['dialAgiAfterHangupClient']=_0x3f42ce[_0x2306('0x77')]||![];this['dialAgiAfterHangupAgent']=_0x3f42ce[_0x2306('0x78')]||![];this[_0x2306('0xe')]=monitorFormat[_0x3f42ce[_0x2306('0xe')]]?monitorFormat[_0x3f42ce[_0x2306('0xe')]]:undefined;this[_0x2306('0x79')]=_0x3f42ce[_0x2306('0x79')]||![];this[_0x2306('0x7a')]=_0x3f42ce['mandatoryDispositionPause']?_0x3f42ce['mandatoryDispositionPause']:undefined;}module[_0x2306('0x7b')]=VoiceQueue; \ No newline at end of file +var _0xb7be=['name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','acw','acwTimeout','autopause','sendMessageOneNotActive','message','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','ringing','ringinuse','onhold','wav','wav49','gsm'];(function(_0x2607ab,_0x10cd53){var _0x24a92b=function(_0x51f282){while(--_0x51f282){_0x2607ab['push'](_0x2607ab['shift']());}};_0x24a92b(++_0x10cd53);}(_0xb7be,0x6a));var _0xeb7b=function(_0xe1f858,_0xb86c44){_0xe1f858=_0xe1f858-0x0;var _0x367af6=_0xb7be[_0xe1f858];return _0x367af6;};'use strict';var statusDesc=[_0xeb7b('0x0'),_0xeb7b('0x1'),_0xeb7b('0x2'),_0xeb7b('0x3'),'invalid','unavailable',_0xeb7b('0x4'),_0xeb7b('0x5'),_0xeb7b('0x6')];var monitorFormat={'wav':_0xeb7b('0x7'),'wav49':_0xeb7b('0x8'),'gsm':_0xeb7b('0x9')};var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};function VoiceQueue(_0x5d52a2){this['id']=_0x5d52a2['id']||0x0;this[_0xeb7b('0xa')]=_0x5d52a2[_0xeb7b('0xa')]||'';this['monitor_format']=_0x5d52a2[_0xeb7b('0xb')]||'';this[_0xeb7b('0xc')]=_0x5d52a2['type']||_0xeb7b('0xd');this[_0xeb7b('0xe')]=0x0;this[_0xeb7b('0xf')]=0x0;this[_0xeb7b('0x10')]=0x0;this[_0xeb7b('0x11')]=0x0;this[_0xeb7b('0x12')]=0x0;this[_0xeb7b('0x13')]=0x0;this[_0xeb7b('0x14')]=0x0;this[_0xeb7b('0x15')]=0x0;this[_0xeb7b('0x16')]=0x0;this['loggedIn']=0x0;this['available']=0x0;this['acw']=_0x5d52a2[_0xeb7b('0x17')]||![];this['acwTimeout']=_0x5d52a2[_0xeb7b('0x18')]||0xa;this[_0xeb7b('0x19')]=_0x5d52a2[_0xeb7b('0x19')]||'no';this[_0xeb7b('0x1a')]=!![];this[_0xeb7b('0x1b')]='';this['originated']=0x0;this['temp']=0x0;this['dialTimezone']=_0x5d52a2[_0xeb7b('0x1c')]||null;this[_0xeb7b('0x1d')]=_0x5d52a2[_0xeb7b('0x1d')]?_0x5d52a2[_0xeb7b('0x1d')]:null;this[_0xeb7b('0x1e')]=_0x5d52a2[_0xeb7b('0x1e')];this[_0xeb7b('0x1f')]=_0x5d52a2[_0xeb7b('0x1f')]||_0xeb7b('0x20');this['dialLimitChannel']=_0x5d52a2[_0xeb7b('0x21')]||0x0;this[_0xeb7b('0x22')]=_0x5d52a2[_0xeb7b('0x22')]||0x0;this[_0xeb7b('0x23')]=_0x5d52a2[_0xeb7b('0x23')]||0x1;this['dialPredictiveOptimization']=_0x5d52a2[_0xeb7b('0x24')]||'dropRate';this[_0xeb7b('0x25')]=_0x5d52a2[_0xeb7b('0x25')]||0.03;this['dialPredictiveInterval']=_0x5d52a2[_0xeb7b('0x26')]||0x258;this[_0xeb7b('0x27')]=_0x5d52a2[_0xeb7b('0x27')]||'anonymous';this[_0xeb7b('0x28')]=_0x5d52a2['dialOriginateCallerIdNumber']||_0xeb7b('0x29');this[_0xeb7b('0x2a')]=_0x5d52a2['dialOriginateTimeout']||0x1e;this[_0xeb7b('0x2b')]=_0x5d52a2['dialQueueOptions']||_0xeb7b('0x2c');this[_0xeb7b('0x2d')]=_0x5d52a2[_0xeb7b('0x2d')]||0x3;this[_0xeb7b('0x2e')]=_0x5d52a2['dialQueueProject']||undefined;this[_0xeb7b('0x2f')]=_0x5d52a2[_0xeb7b('0x2f')]||0x3;this[_0xeb7b('0x30')]=_0x5d52a2[_0xeb7b('0x30')]||0x96;this[_0xeb7b('0x31')]=_0x5d52a2['dialBusyMaxRetry']||0x3;this[_0xeb7b('0x32')]=_0x5d52a2[_0xeb7b('0x32')]||0x96;this[_0xeb7b('0x33')]=_0x5d52a2[_0xeb7b('0x33')]||0x3;this[_0xeb7b('0x34')]=_0x5d52a2['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x5d52a2[_0xeb7b('0x35')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x5d52a2[_0xeb7b('0x36')]||0x96;this[_0xeb7b('0x37')]=_0x5d52a2[_0xeb7b('0x37')]||0x3;this['dialDropRetryFrequency']=_0x5d52a2['dialDropRetryFrequency']||0x96;this[_0xeb7b('0x38')]=_0x5d52a2[_0xeb7b('0x38')]||0x3;this[_0xeb7b('0x39')]=_0x5d52a2[_0xeb7b('0x39')]||0x96;this[_0xeb7b('0x3a')]=_0x5d52a2[_0xeb7b('0x3a')]||0x3;this[_0xeb7b('0x3b')]=_0x5d52a2[_0xeb7b('0x3b')]||0x96;this[_0xeb7b('0x3c')]=_0x5d52a2[_0xeb7b('0x3c')]||0x3;this[_0xeb7b('0x3d')]=_0x5d52a2[_0xeb7b('0x3d')]||0x96;this['dialGlobalMaxRetry']=_0x5d52a2[_0xeb7b('0x3e')]||0x4;this['Trunk']=_0x5d52a2[_0xeb7b('0x3f')]?_0x5d52a2['Trunk']:undefined;this[_0xeb7b('0x40')]=_0x5d52a2[_0xeb7b('0x40')]?_0x5d52a2[_0xeb7b('0x40')]:undefined;this[_0xeb7b('0x41')]=_0x5d52a2[_0xeb7b('0x41')]||undefined;this['Interval']=_0x5d52a2[_0xeb7b('0x42')]?_0x5d52a2[_0xeb7b('0x42')]:undefined;this[_0xeb7b('0x43')]=_0x5d52a2[_0xeb7b('0x43')]||_0xeb7b('0x44');this[_0xeb7b('0x45')]=_0x5d52a2[_0xeb7b('0x45')]||undefined;this[_0xeb7b('0x46')]=_0x5d52a2[_0xeb7b('0x46')]||undefined;this[_0xeb7b('0x47')]=strategy[_0x5d52a2[_0xeb7b('0x47')]]||_0xeb7b('0x48');this['queueStatusComplete']=!![];this[_0xeb7b('0x49')]=_0x5d52a2[_0xeb7b('0x49')]||![];this[_0xeb7b('0x4a')]=_0x5d52a2[_0xeb7b('0x4a')];this[_0xeb7b('0x4b')]=_0x5d52a2[_0xeb7b('0x4b')];this[_0xeb7b('0x4c')]=_0x5d52a2[_0xeb7b('0x4c')];this[_0xeb7b('0x4d')]=_0x5d52a2[_0xeb7b('0x4d')];this['dialAMDMinWordLength']=_0x5d52a2[_0xeb7b('0x4e')];this[_0xeb7b('0x4f')]=_0x5d52a2[_0xeb7b('0x4f')];this[_0xeb7b('0x50')]=_0x5d52a2[_0xeb7b('0x50')];this[_0xeb7b('0x51')]=_0x5d52a2[_0xeb7b('0x51')];this[_0xeb7b('0x52')]=_0x5d52a2[_0xeb7b('0x52')];this['outboundRejectCallsDay']=0x0;this[_0xeb7b('0x53')]=0x0;this[_0xeb7b('0x54')]=_0x5d52a2[_0xeb7b('0x54')];this[_0xeb7b('0x55')]=0x0;this[_0xeb7b('0x56')]=0x0;this[_0xeb7b('0x57')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xeb7b('0x58')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xeb7b('0x59')]=0x0;this[_0xeb7b('0x5a')]=0x0;this[_0xeb7b('0x5b')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xeb7b('0x5c')]=0x0;this[_0xeb7b('0x5d')]=0x0;this['startProgressive']=undefined;this[_0xeb7b('0x5e')]=undefined;this['handlePredictive']=undefined;this[_0xeb7b('0x5f')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xeb7b('0x60')]=0x0;this[_0xeb7b('0x61')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xeb7b('0x62')]=0x0;this[_0xeb7b('0x63')]=0x0;this[_0xeb7b('0x64')]=_0x5d52a2[_0xeb7b('0x65')]||0x14;this[_0xeb7b('0x66')]=_0x5d52a2['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xeb7b('0x67')]=0x0;this[_0xeb7b('0x68')]=0x0;this[_0xeb7b('0x69')]=0x1;this[_0xeb7b('0x6a')]=0x0;this[_0xeb7b('0x6b')]=0x0;this[_0xeb7b('0x6c')]=0x0;this['erlangBusyFactor']=0x0;this[_0xeb7b('0x6d')]=_0x5d52a2[_0xeb7b('0x6d')]||0x1e;this['dialRecallInQueue']=_0x5d52a2[_0xeb7b('0x6e')]||![];this[_0xeb7b('0x6f')]=_0x5d52a2[_0xeb7b('0x6f')]||undefined;this[_0xeb7b('0x70')]=_0x5d52a2[_0xeb7b('0x70')]||![];this['dialAgiAfterHangupAgent']=_0x5d52a2['dialAgiAfterHangupAgent']||![];this[_0xeb7b('0xb')]=monitorFormat[_0x5d52a2['monitor_format']]?monitorFormat[_0x5d52a2[_0xeb7b('0xb')]]:undefined;this[_0xeb7b('0x71')]=_0x5d52a2[_0xeb7b('0x71')]||![];this[_0xeb7b('0x72')]=_0x5d52a2['mandatoryDispositionPause']?_0x5d52a2[_0xeb7b('0x72')]:undefined;}module[_0xeb7b('0x73')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index f680c70..8316d42 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 _0x8d07=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x343285,_0x368e0d){var _0x4d9616=function(_0x2b57b9){while(--_0x2b57b9){_0x343285['push'](_0x343285['shift']());}};_0x4d9616(++_0x368e0d);}(_0x8d07,0x10c));var _0x78d0=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x8d07[_0x47b58b];return _0x46bebe;};'use strict';function VtigerAccount(_0x300ae1){this['id']=_0x300ae1['id']||0x0;this[_0x78d0('0x0')]=_0x300ae1[_0x78d0('0x0')]||'';this[_0x78d0('0x1')]=_0x300ae1[_0x78d0('0x1')]||'';this[_0x78d0('0x2')]=_0x300ae1[_0x78d0('0x2')]||'';this['remoteUri']=_0x300ae1[_0x78d0('0x3')]||'';this[_0x78d0('0x4')]=_0x300ae1[_0x78d0('0x4')]||'';this[_0x78d0('0x5')]=_0x300ae1['Configurations']||{};}module[_0x78d0('0x6')]=VtigerAccount; \ No newline at end of file +var _0x8ed9=['name','username','accessKey','remoteUri','serverUrl','exports'];(function(_0x3fecf4,_0x34047e){var _0x388ba6=function(_0x3aec46){while(--_0x3aec46){_0x3fecf4['push'](_0x3fecf4['shift']());}};_0x388ba6(++_0x34047e);}(_0x8ed9,0x186));var _0x98ed=function(_0x4bdad2,_0x3bb56b){_0x4bdad2=_0x4bdad2-0x0;var _0x249aa7=_0x8ed9[_0x4bdad2];return _0x249aa7;};'use strict';function VtigerAccount(_0x2557e2){this['id']=_0x2557e2['id']||0x0;this[_0x98ed('0x0')]=_0x2557e2[_0x98ed('0x0')]||'';this[_0x98ed('0x1')]=_0x2557e2[_0x98ed('0x1')]||'';this[_0x98ed('0x2')]=_0x2557e2['accessKey']||'';this[_0x98ed('0x3')]=_0x2557e2[_0x98ed('0x3')]||'';this['serverUrl']=_0x2557e2[_0x98ed('0x4')]||'';this['Configurations']=_0x2557e2['Configurations']||{};}module[_0x98ed('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index e7dd239..82592fc 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 _0x5f2f=['authType','type','integrationTab','serverUrl','Configurations','name','username','password','token','remoteUri'];(function(_0x34fa63,_0x10c942){var _0x5e23d9=function(_0x2a912a){while(--_0x2a912a){_0x34fa63['push'](_0x34fa63['shift']());}};_0x5e23d9(++_0x10c942);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5f5270,_0x20d689){_0x5f5270=_0x5f5270-0x0;var _0xc24108=_0x5f2f[_0x5f5270];return _0xc24108;};'use strict';function ZendeskAccount(_0x7c86d8){this['id']=_0x7c86d8['id']||0x0;this[_0xf5f2('0x0')]=_0x7c86d8[_0xf5f2('0x0')]||'';this[_0xf5f2('0x1')]=_0x7c86d8[_0xf5f2('0x1')]||'';this[_0xf5f2('0x2')]=_0x7c86d8[_0xf5f2('0x2')]||'';this[_0xf5f2('0x3')]=_0x7c86d8['token']||'';this['remoteUri']=_0x7c86d8[_0xf5f2('0x4')]||'';this[_0xf5f2('0x5')]=_0x7c86d8[_0xf5f2('0x5')]||'';this[_0xf5f2('0x6')]=_0x7c86d8[_0xf5f2('0x6')]||_0xf5f2('0x7');this['serverUrl']=_0x7c86d8[_0xf5f2('0x8')]||'';this[_0xf5f2('0x9')]=_0x7c86d8[_0xf5f2('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0xadb5=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xadb5,0xad));var _0x5adb=function(_0x340699,_0x18d5f4){_0x340699=_0x340699-0x0;var _0x5b1374=_0xadb5[_0x340699];return _0x5b1374;};'use strict';function ZendeskAccount(_0x1f969c){this['id']=_0x1f969c['id']||0x0;this[_0x5adb('0x0')]=_0x1f969c['name']||'';this[_0x5adb('0x1')]=_0x1f969c[_0x5adb('0x1')]||'';this[_0x5adb('0x2')]=_0x1f969c['password']||'';this[_0x5adb('0x3')]=_0x1f969c[_0x5adb('0x3')]||'';this[_0x5adb('0x4')]=_0x1f969c['remoteUri']||'';this[_0x5adb('0x5')]=_0x1f969c[_0x5adb('0x5')]||'';this[_0x5adb('0x6')]=_0x1f969c[_0x5adb('0x6')]||_0x5adb('0x7');this[_0x5adb('0x8')]=_0x1f969c[_0x5adb('0x8')]||'';this[_0x5adb('0x9')]=_0x1f969c[_0x5adb('0x9')]||{};}module[_0x5adb('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 904abe3..14c2d4b 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 _0x3495=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret'];(function(_0x1377d0,_0x110ac4){var _0x590bd6=function(_0x100279){while(--_0x100279){_0x1377d0['push'](_0x1377d0['shift']());}};_0x590bd6(++_0x110ac4);}(_0x3495,0x1de));var _0x5349=function(_0x1bcf88,_0x449c23){_0x1bcf88=_0x1bcf88-0x0;var _0x40b0f7=_0x3495[_0x1bcf88];return _0x40b0f7;};'use strict';function ZohoAccount(_0x38495a){this['id']=_0x38495a['id']||0x0;this[_0x5349('0x0')]=_0x38495a[_0x5349('0x0')]||'';this[_0x5349('0x1')]=_0x38495a[_0x5349('0x1')]||'';this[_0x5349('0x2')]=_0x38495a[_0x5349('0x2')]||'';this[_0x5349('0x3')]=_0x38495a[_0x5349('0x3')]||'';this['clientId']=_0x38495a[_0x5349('0x4')]||'';this[_0x5349('0x5')]=_0x38495a['clientSecret']||'';this[_0x5349('0x6')]=_0x38495a['serverUrl']||'';this[_0x5349('0x7')]=_0x38495a['code']||'';this[_0x5349('0x8')]=_0x38495a['refreshToken']||'';this[_0x5349('0x9')]=_0x38495a[_0x5349('0x9')]||{};}module[_0x5349('0xa')]=ZohoAccount; \ No newline at end of file +var _0x7fb3=['description','host','zone','clientId','clientSecret','serverUrl','code','Configurations','exports','name'];(function(_0x5df7a0,_0x4bd2e6){var _0x50f924=function(_0x125a1d){while(--_0x125a1d){_0x5df7a0['push'](_0x5df7a0['shift']());}};_0x50f924(++_0x4bd2e6);}(_0x7fb3,0xf9));var _0x37fb=function(_0x2a3e5f,_0x24c745){_0x2a3e5f=_0x2a3e5f-0x0;var _0xfdbebc=_0x7fb3[_0x2a3e5f];return _0xfdbebc;};'use strict';function ZohoAccount(_0x23e22f){this['id']=_0x23e22f['id']||0x0;this[_0x37fb('0x0')]=_0x23e22f[_0x37fb('0x0')]||'';this[_0x37fb('0x1')]=_0x23e22f['description']||'';this[_0x37fb('0x2')]=_0x23e22f[_0x37fb('0x2')]||'';this[_0x37fb('0x3')]=_0x23e22f[_0x37fb('0x3')]||'';this['clientId']=_0x23e22f[_0x37fb('0x4')]||'';this[_0x37fb('0x5')]=_0x23e22f[_0x37fb('0x5')]||'';this[_0x37fb('0x6')]=_0x23e22f[_0x37fb('0x6')]||'';this[_0x37fb('0x7')]=_0x23e22f['code']||'';this['refreshToken']=_0x23e22f['refreshToken']||'';this[_0x37fb('0x8')]=_0x23e22f[_0x37fb('0x8')]||{};}module[_0x37fb('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 6b47e69..f4a433b 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 _0x92d3=['moment','isNil','string','uniqueid','name','type','queue','dialAnswer','membername','Agent','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','scheduledat','countbusyretry','countnoanswerretry','countcongestionretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','prototype','format','\x22%s\x22\x20<%s>','number','exports','util','lodash'];(function(_0x7dbd65,_0x18da49){var _0x33d551=function(_0x7ce789){while(--_0x7ce789){_0x7dbd65['push'](_0x7dbd65['shift']());}};_0x33d551(++_0x18da49);}(_0x92d3,0x11d));var _0x392d=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x92d3[_0x1beef3];return _0x5af964;};'use strict';var util=require(_0x392d('0x0'));var _=require(_0x392d('0x1'));var moment=require(_0x392d('0x2'));function checkNameSurname(_0x270817,_0x4e5f33,_0x42f1fe){var _0x5f18a6='';if(!_[_0x392d('0x3')](_0x4e5f33)&&'string'===typeof _0x4e5f33){_0x5f18a6+=_0x4e5f33;}if(!_['isNil'](_0x42f1fe)&&_0x392d('0x4')===typeof _0x42f1fe){_0x5f18a6+='\x20'+_0x42f1fe;}if(_0x5f18a6!==''){return _0x5f18a6;}return _0x270817;}function Action(_0xaac205,_0x54c571,_0xef7562,_0x47f82e,_0x134c71){this[_0x392d('0x5')]=_0xef7562||undefined;this['idContact']=_0xaac205['id'];this['queue']=_0x54c571[_0x392d('0x6')];this[_0x392d('0x7')]=_0x54c571['type'];this['campaigntype']=_0x392d('0x8');this[_0x392d('0x9')]=![];this[_0x392d('0xa')]=_[_0x392d('0x3')](_0xaac205['Agent'])?undefined:_0xaac205[_0x392d('0xb')][_0x392d('0x6')];this['channelAgent']=this[_0x392d('0xa')]?util['format'](_0x392d('0xc'),this[_0x392d('0xa')]):_0x47f82e||undefined;this[_0x392d('0xd')]=checkNameSurname(_0xaac205[_0x392d('0xe')][_0x392d('0xf')],_0xaac205[_0x392d('0xe')][_0x392d('0x10')],_0xaac205[_0x392d('0xe')][_0x392d('0x11')]);this[_0x392d('0x12')]=_0xaac205['active']||![];this['calleridnum']=_0xaac205['Contact'][_0x392d('0xf')];this[_0x392d('0x13')]=_0xaac205[_0x392d('0x13')];this['countbusyretry']=_0xaac205[_0x392d('0x14')]||0x0;this['countcongestionretry']=_0xaac205['countcongestionretry']||0x0;this[_0x392d('0x15')]=_0xaac205[_0x392d('0x15')]||0x0;this['countglobal']=(_0xaac205[_0x392d('0x14')]||0x0)+(_0xaac205[_0x392d('0x16')]||0x0)+(_0xaac205['countnoanswerretry']||0x0)+(_0xaac205['countnosuchnumberretry']||0x0)+(_0xaac205['countdropretry']||0x0)+(_0xaac205[_0x392d('0x17')]||0x0)+(_0xaac205[_0x392d('0x18')]||0x0)+(_0xaac205[_0x392d('0x19')]||0x0);this[_0x392d('0x1a')]=_0xaac205['countnosuchnumberretry']||0x0;this[_0x392d('0x1b')]=_0xaac205['countdropretry']||0x0;this[_0x392d('0x17')]=_0xaac205[_0x392d('0x17')]||0x0;this['countmachineretry']=_0xaac205[_0x392d('0x18')]||0x0;this[_0x392d('0x19')]=_0xaac205['countagentrejectretry']||0x0;this[_0x392d('0x1c')]=_0xaac205[_0x392d('0x1c')];this['callbackuniqueid']=_0xaac205[_0x392d('0x1d')];this[_0x392d('0x1e')]=_0xaac205['callbackat'];this[_0x392d('0x1f')]=_0xaac205[_0x392d('0x1f')];this[_0x392d('0x20')]=_0xaac205[_0x392d('0x20')];this[_0x392d('0x21')]=_0xaac205['ListId'];this['UserId']=_[_0x392d('0x3')](_0xaac205[_0x392d('0xb')])?_0xaac205[_0x392d('0x22')]:_0xaac205['Agent']['id'];this[_0x392d('0x23')]=_0xaac205[_0x392d('0x23')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x392d('0x24')]['getCaller']=function(){return util[_0x392d('0x25')](_0x392d('0x26'),this[_0x392d('0xd')],this[_0x392d('0x27')]);};module[_0x392d('0x28')]=Action; \ No newline at end of file +var _0xcb87=['number','exports','util','moment','isNil','string','uniqueid','idContact','queue','name','type','membername','Agent','channelAgent','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','calleridname'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xcb87,0xb2));var _0x7cb8=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xcb87[_0x3511d3];return _0x5d6321;};'use strict';var util=require(_0x7cb8('0x0'));var _=require('lodash');var moment=require(_0x7cb8('0x1'));function checkNameSurname(_0x22b38f,_0x302099,_0x576091){var _0x137d4b='';if(!_[_0x7cb8('0x2')](_0x302099)&&_0x7cb8('0x3')===typeof _0x302099){_0x137d4b+=_0x302099;}if(!_['isNil'](_0x576091)&&_0x7cb8('0x3')===typeof _0x576091){_0x137d4b+='\x20'+_0x576091;}if(_0x137d4b!==''){return _0x137d4b;}return _0x22b38f;}function Action(_0x5da7fd,_0xcca257,_0x43dea2,_0x3e3b21,_0x28a23a){this[_0x7cb8('0x4')]=_0x43dea2||undefined;this[_0x7cb8('0x5')]=_0x5da7fd['id'];this[_0x7cb8('0x6')]=_0xcca257[_0x7cb8('0x7')];this[_0x7cb8('0x8')]=_0xcca257[_0x7cb8('0x8')];this['campaigntype']='queue';this['dialAnswer']=![];this[_0x7cb8('0x9')]=_[_0x7cb8('0x2')](_0x5da7fd[_0x7cb8('0xa')])?undefined:_0x5da7fd[_0x7cb8('0xa')][_0x7cb8('0x7')];this[_0x7cb8('0xb')]=this[_0x7cb8('0x9')]?util['format']('SIP/%s',this[_0x7cb8('0x9')]):_0x3e3b21||undefined;this['calleridname']=checkNameSurname(_0x5da7fd[_0x7cb8('0xc')][_0x7cb8('0xd')],_0x5da7fd[_0x7cb8('0xc')][_0x7cb8('0xe')],_0x5da7fd[_0x7cb8('0xc')][_0x7cb8('0xf')]);this[_0x7cb8('0x10')]=_0x5da7fd[_0x7cb8('0x10')]||![];this[_0x7cb8('0x11')]=_0x5da7fd[_0x7cb8('0xc')][_0x7cb8('0xd')];this[_0x7cb8('0x12')]=_0x5da7fd[_0x7cb8('0x12')];this['countbusyretry']=_0x5da7fd[_0x7cb8('0x13')]||0x0;this[_0x7cb8('0x14')]=_0x5da7fd[_0x7cb8('0x14')]||0x0;this[_0x7cb8('0x15')]=_0x5da7fd[_0x7cb8('0x15')]||0x0;this[_0x7cb8('0x16')]=(_0x5da7fd['countbusyretry']||0x0)+(_0x5da7fd['countcongestionretry']||0x0)+(_0x5da7fd[_0x7cb8('0x15')]||0x0)+(_0x5da7fd[_0x7cb8('0x17')]||0x0)+(_0x5da7fd['countdropretry']||0x0)+(_0x5da7fd[_0x7cb8('0x18')]||0x0)+(_0x5da7fd[_0x7cb8('0x19')]||0x0)+(_0x5da7fd['countagentrejectretry']||0x0);this['countnosuchnumberretry']=_0x5da7fd['countnosuchnumberretry']||0x0;this[_0x7cb8('0x1a')]=_0x5da7fd[_0x7cb8('0x1a')]||0x0;this[_0x7cb8('0x18')]=_0x5da7fd[_0x7cb8('0x18')]||0x0;this[_0x7cb8('0x19')]=_0x5da7fd['countmachineretry']||0x0;this[_0x7cb8('0x1b')]=_0x5da7fd[_0x7cb8('0x1b')]||0x0;this[_0x7cb8('0x1c')]=_0x5da7fd['callback'];this[_0x7cb8('0x1d')]=_0x5da7fd[_0x7cb8('0x1d')];this[_0x7cb8('0x1e')]=_0x5da7fd[_0x7cb8('0x1e')];this[_0x7cb8('0x1f')]=_0x5da7fd[_0x7cb8('0x1f')];this[_0x7cb8('0x20')]=_0x5da7fd['ContactId'];this['ListId']=_0x5da7fd['ListId'];this[_0x7cb8('0x21')]=_[_0x7cb8('0x2')](_0x5da7fd[_0x7cb8('0xa')])?_0x5da7fd[_0x7cb8('0x21')]:_0x5da7fd[_0x7cb8('0xa')]['id'];this[_0x7cb8('0x22')]=_0x5da7fd['VoiceQueueId'];this[_0x7cb8('0x23')]='';this[_0x7cb8('0x24')]='';}Action[_0x7cb8('0x25')][_0x7cb8('0x26')]=function(){return util[_0x7cb8('0x27')](_0x7cb8('0x28'),this[_0x7cb8('0x29')],this[_0x7cb8('0x2a')]);};module[_0x7cb8('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 3536837..2d9bd2a 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 _0xc7bd=['NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','activeContact','CONGESTION','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','countcongestionretry','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlockContact','getContactPreview','recallme','isValid','checkIsBlackList','Contact.phone','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','isTrunkReachable','Trunk\x20not\x20work','\x20Not\x20Active','Is\x20Valid','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','originatecalleridname','originatecalleridnum','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','channel','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','[syncHangup][talking]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','addVariable','variables','filterKey','keys','variable','value','error','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','lodash','bluebird','moment','ioredis','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','redis','defaults','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncBlindTransfer','loopCampaigns','type','name','strategy','available','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','stringify','md5','format','voice:queue:%s','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','message','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','outbound','setMessage','recallMe','isNil','info','[clearZombieChannels][talking]','Queue','originated:\x20','queue','pTalking:\x20','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','catch','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','clearZombieChannel','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','rescheduleContactInQueue','createBody','RecallFailedTimeout','createCustomerHistory','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','loggedIn','isActive','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','NoSuchNumber','custom:agentnosuchnumber','buildObj','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','linkedid','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','buildAcw','complete','answered','[16]','totalGlobal','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','countbusyretry','Busy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','unlockAgent','NOANSWER','countnoanswerretry','countglobal'];(function(_0x30ae29,_0x4a5a50){var _0x31bcd5=function(_0xb0eb12){while(--_0xb0eb12){_0x30ae29['push'](_0x30ae29['shift']());}};_0x31bcd5(++_0x4a5a50);}(_0xc7bd,0x86));var _0xdc7b=function(_0x2809d6,_0x5d2312){_0x2809d6=_0x2809d6-0x0;var _0x3e9aa6=_0xc7bd[_0x2809d6];return _0x3e9aa6;};'use strict';var util=require('util');var _=require(_0xdc7b('0x0'));var BPromise=require(_0xdc7b('0x1'));var uuid=require('uuid');var moment=require(_0xdc7b('0x2'));var md5=require('md5');var Redis=require(_0xdc7b('0x3'));var config=require('../../../config/environment');var logger=require(_0xdc7b('0x4'))(_0xdc7b('0x5'));var loggerAction=require(_0xdc7b('0x4'))(_0xdc7b('0x6'));var ami=require(_0xdc7b('0x7'));var rpcDb=require(_0xdc7b('0x8'));var Action=require(_0xdc7b('0x9'));var ut=require('./util/util');config[_0xdc7b('0xa')]=_[_0xdc7b('0xb')](config[_0xdc7b('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdc7b('0xa')]));var Sequence=function(){};Sequence[_0xdc7b('0xc')][_0xdc7b('0xd')]=function(_0x295800){this[_0xdc7b('0xe')]=this[_0xdc7b('0xe')]?this['tail'][_0xdc7b('0xf')](_0x295800):_0x295800();};function Preview(_0x359a53){this[_0xdc7b('0x10')]=new Sequence();this[_0xdc7b('0x11')]=_0x359a53[_0xdc7b('0x12')];this[_0xdc7b('0x13')]=_0x359a53['trunks'];this[_0xdc7b('0x14')]={};this[_0xdc7b('0x15')]=_0x359a53['agents'];this[_0xdc7b('0x16')]=0x0;ami['on']('originateresponse',this[_0xdc7b('0x17')][_0xdc7b('0x18')](this));ami['on'](_0xdc7b('0x19'),this[_0xdc7b('0x1a')]['bind'](this));ami['on'](_0xdc7b('0x1b'),this[_0xdc7b('0x1c')]['bind'](this));ami['on'](_0xdc7b('0x1d'),this[_0xdc7b('0x1e')][_0xdc7b('0x18')](this));ami['on'](_0xdc7b('0x1f'),this[_0xdc7b('0x20')][_0xdc7b('0x18')](this));ami['on'](_0xdc7b('0x21'),this[_0xdc7b('0x22')]['bind'](this));ami['on'](_0xdc7b('0x23'),this['syncAttendedTransfer'][_0xdc7b('0x18')](this));ami['on']('blindtransfer',this[_0xdc7b('0x24')][_0xdc7b('0x18')](this));this[_0xdc7b('0x25')](this[_0xdc7b('0x11')]);}function emit(_0x1f516d,_0x4c39db,_0x570d3b){io['to'](_0x1f516d)['emit'](_0x4c39db,_0x570d3b);}function emitCampaignPreview(_0x3e6972){if(_0x3e6972[_0xdc7b('0x26')]==='outbound'){var _0x2665cb={'id':_0x3e6972['id'],'name':_0x3e6972[_0xdc7b('0x27')],'strategy':_0x3e6972[_0xdc7b('0x28')],'answered':_0x3e6972['answered'],'available':_0x3e6972[_0xdc7b('0x29')],'loggedIn':_0x3e6972['loggedIn'],'pTalking':_0x3e6972[_0xdc7b('0x2a')],'sumBillable':_0x3e6972[_0xdc7b('0x2b')],'sumDuration':_0x3e6972[_0xdc7b('0x2c')],'sumHoldTime':_0x3e6972[_0xdc7b('0x2d')]||0x0,'talking':_0x3e6972[_0xdc7b('0x2e')],'total':_0x3e6972[_0xdc7b('0x2f')],'type':_0x3e6972[_0xdc7b('0x26')],'unmanaged':_0x3e6972[_0xdc7b('0x30')],'abandoned':_0x3e6972[_0xdc7b('0x31')],'waiting':_0x3e6972['waiting'],'loggedInDb':_0x3e6972[_0xdc7b('0x32')],'dialActive':_0x3e6972[_0xdc7b('0x33')],'dialMethod':_0x3e6972[_0xdc7b('0x34')],'dialOriginateCallerIdName':_0x3e6972[_0xdc7b('0x35')],'dialOriginateCallerIdNumber':_0x3e6972['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x3e6972[_0xdc7b('0x36')],'dialPrefix':_0x3e6972['dialPrefix'],'outboundAnswerAgiCallsDay':_0x3e6972[_0xdc7b('0x37')],'outboundAnswerCallsDay':_0x3e6972[_0xdc7b('0x38')],'outboundBlacklistCallsDay':_0x3e6972[_0xdc7b('0x39')],'outboundBusyCallsDay':_0x3e6972['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x3e6972[_0xdc7b('0x3a')],'outboundDropCallsDayACS':_0x3e6972[_0xdc7b('0x3b')],'outboundDropCallsDayCallersExit':_0x3e6972[_0xdc7b('0x3c')],'outboundDropCallsDayTimeout':_0x3e6972[_0xdc7b('0x3d')],'outboundNoAnswerCallsDay':_0x3e6972[_0xdc7b('0x3e')],'outboundNoSuchCallsDay':_0x3e6972['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x3e6972[_0xdc7b('0x3f')],'outboundReCallsDay':_0x3e6972[_0xdc7b('0x40')],'outboundRejectCallsDay':_0x3e6972[_0xdc7b('0x41')],'outboundUnknownCallsDay':_0x3e6972[_0xdc7b('0x42')],'outboundAbandonedCallsDay':_0x3e6972['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x3e6972[_0xdc7b('0x43')],'predictiveIntervalAvgHoldtime':_0x3e6972[_0xdc7b('0x44')],'predictiveIntervalAvgTalktime':_0x3e6972[_0xdc7b('0x45')],'predictiveIntervalDroppedCallsCallersExit':_0x3e6972[_0xdc7b('0x46')],'predictiveIntervalDroppedCallsTimeout':_0x3e6972['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x3e6972[_0xdc7b('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x3e6972[_0xdc7b('0x48')],'predictiveIntervalHitRate':_0x3e6972[_0xdc7b('0x49')],'predictiveIntervalMultiplicativeFactor':_0x3e6972[_0xdc7b('0x4a')],'predictiveIntervalPauses':_0x3e6972[_0xdc7b('0x4b')],'predictiveIntervalAvailable':_0x3e6972['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x3e6972[_0xdc7b('0x4c')],'message':_0x3e6972['message'],'originated':_0x3e6972[_0xdc7b('0x4d')],'erlangCalls':_0x3e6972[_0xdc7b('0x4e')],'erlangCallToSecond':_0x3e6972[_0xdc7b('0x4f')],'erlangAbandonmentRate':_0x3e6972['erlangAbandonmentRate'],'erlangBusyFactor':_0x3e6972[_0xdc7b('0x50')],'startPredictive':_0x3e6972[_0xdc7b('0x51')],'startProgressive':_0x3e6972[_0xdc7b('0x52')]};if(_0x3e6972['Trunk']){_0x2665cb[_0xdc7b('0x53')]={'id':_0x3e6972[_0xdc7b('0x53')]['id'],'name':_0x3e6972['Trunk'][_0xdc7b('0x27')],'active':_0x3e6972['Trunk'][_0xdc7b('0x54')],'callerid':_0x3e6972[_0xdc7b('0x53')]['callerid']};}if(_0x3e6972[_0xdc7b('0x55')]){_0x2665cb[_0xdc7b('0x55')]={'id':_0x3e6972[_0xdc7b('0x55')]['id'],'name':_0x3e6972[_0xdc7b('0x55')][_0xdc7b('0x27')]};}var _0x1fc5f6=md5(JSON[_0xdc7b('0x56')](_0x2665cb));if(_0x3e6972[_0xdc7b('0x57')]!==_0x1fc5f6){_0x3e6972['md5']=_0x1fc5f6;emit(util[_0xdc7b('0x58')](_0xdc7b('0x59'),_0x2665cb[_0xdc7b('0x27')]),'voice_queue:save',_0x2665cb);}}}function emitVoiceQueueChannelRemove(_0x5dc9d5){logger['info'](_0xdc7b('0x5a'),JSON[_0xdc7b('0x56')](_0x5dc9d5));emit(util[_0xdc7b('0x58')](_0xdc7b('0x59'),_0x5dc9d5[_0xdc7b('0x27')]),_0xdc7b('0x5b'),_0x5dc9d5);this[_0xdc7b('0x5c')](_0xdc7b('0x5d'),_0x5dc9d5);}function notSendMessagesQueue(_0xa15419){if(_0xa15419[_0xdc7b('0x5e')]){if(_0xa15419['originated']===0x0&&_0xa15419[_0xdc7b('0x2a')]===0x0){_0xa15419[_0xdc7b('0x5e')]=![];_0xa15419['available']=0x0;_0xa15419['paused']=0x0;_0xa15419[_0xdc7b('0x5f')]=_0xdc7b('0x60');ut[_0xdc7b('0x61')](_0xdc7b('0x62'),_0xa15419[_0xdc7b('0x27')]+_0xdc7b('0x63'));}else{_0xa15419[_0xdc7b('0x5f')]=_0xdc7b('0x64');ut[_0xdc7b('0x61')](_0xdc7b('0x62'),_0xa15419['name']+_0xdc7b('0x65'));}emitCampaignPreview(_0xa15419);}}Preview[_0xdc7b('0xc')][_0xdc7b('0x25')]=function(){var _0x517246=this;setInterval(function(){_0x517246[_0xdc7b('0x66')]();},0x7cf);};Preview[_0xdc7b('0xc')][_0xdc7b('0x66')]=function(){var _0x155bf4=this[_0xdc7b('0x11')];this[_0xdc7b('0x16')]+=0x1;for(var _0xf2c27a in _0x155bf4){if(_0x155bf4[_0xdc7b('0x67')](_0xf2c27a)&&(_0x155bf4[_0xf2c27a][_0xdc7b('0x34')]===_0xdc7b('0x5')||_0x155bf4[_0xf2c27a]['dialMethod']===_0xdc7b('0x68'))&&_0x155bf4[_0xf2c27a][_0xdc7b('0x26')]===_0xdc7b('0x69')){if(this[_0xdc7b('0x16')]>0x7){this[_0xdc7b('0x16')]=0x0;this['clearZombieChannels']();}}if(_0x155bf4[_0xdc7b('0x67')](_0xf2c27a)&&_0x155bf4[_0xf2c27a][_0xdc7b('0x34')]===_0xdc7b('0x5')&&_0x155bf4[_0xf2c27a]['type']===_0xdc7b('0x69')){if(_0x155bf4[_0xf2c27a][_0xdc7b('0x33')]){this[_0xdc7b('0x6a')](_0x155bf4[_0xf2c27a]);this[_0xdc7b('0x6b')](_0x155bf4[_0xf2c27a]);}else{notSendMessagesQueue(_0x155bf4[_0xf2c27a]);}}}};Preview['prototype']['clearZombieChannel']=function(_0x2e3c76){var _0x4ea569=this;this['sequence'][_0xdc7b('0xd')](function(){if(!_[_0xdc7b('0x6c')](_0x4ea569[_0xdc7b('0x14')][_0x2e3c76])){loggerAction[_0xdc7b('0x6d')](_0xdc7b('0x6e'),_0x2e3c76,_0xdc7b('0x6f'),_0x4ea569['actions'][_0x2e3c76]['queue'],_0xdc7b('0x70'),JSON[_0xdc7b('0x56')](_0x4ea569[_0xdc7b('0x11')][_0x4ea569[_0xdc7b('0x14')][_0x2e3c76][_0xdc7b('0x71')]][_0xdc7b('0x4d')]),_0xdc7b('0x72'),JSON[_0xdc7b('0x56')](_0x4ea569[_0xdc7b('0x11')][_0x4ea569[_0xdc7b('0x14')][_0x2e3c76][_0xdc7b('0x71')]]['pTalking']),JSON[_0xdc7b('0x56')](_0x4ea569[_0xdc7b('0x14')][_0x2e3c76]['dialAnswer']),JSON['stringify'](_[_0xdc7b('0x73')](_0x4ea569[_0xdc7b('0x14')][_0x2e3c76],[_0xdc7b('0x74'),_0xdc7b('0x75'),_0xdc7b('0x76'),_0xdc7b('0x77')])));return ami[_0xdc7b('0x78')]({'action':_0xdc7b('0x79'),'channel':_0x4ea569['actions'][_0x2e3c76]['channel']})[_0xdc7b('0x7a')](function(_0xa1ce25){if(_0xa1ce25[_0xdc7b('0x5f')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x4ea569['actions'][_0x2e3c76]){ut[_0xdc7b('0x7b')](_0x4ea569[_0xdc7b('0x11')][_0x4ea569['actions'][_0x2e3c76][_0xdc7b('0x71')]],_0xdc7b('0x7c'));if(_0x4ea569['actions'][_0x2e3c76][_0xdc7b('0x7d')]===!![]){ut[_0xdc7b('0x7e')](_0x4ea569[_0xdc7b('0x11')][_0x4ea569[_0xdc7b('0x14')][_0x2e3c76]['queue']],_0xdc7b('0x7c'));ut[_0xdc7b('0x7f')](_0xdc7b('0x80')+_0x2e3c76,_0x4ea569[_0xdc7b('0x14')][_0x2e3c76][_0xdc7b('0x71')]);}ut[_0xdc7b('0x7f')](_0xdc7b('0x81')+_0x2e3c76,_0x4ea569[_0xdc7b('0x14')][_0x2e3c76]['queue']);delete _0x4ea569[_0xdc7b('0x14')][_0x2e3c76];}},0x2328);}});}});};Preview[_0xdc7b('0xc')][_0xdc7b('0x82')]=function(){var _0x163657=this;loggerAction[_0xdc7b('0x6d')]('[action]',_[_0xdc7b('0x83')](this[_0xdc7b('0x14')]));for(var _0xc0e47b in this[_0xdc7b('0x14')]){if(_0x163657[_0xdc7b('0x14')][_0xdc7b('0x67')](_0xc0e47b)){_0x163657[_0xdc7b('0x84')](_0xc0e47b);}}};Preview[_0xdc7b('0xc')]['recallMe']=function(_0x71dca4){var _0x55b859=this;rpcDb[_0xdc7b('0x85')](_0x71dca4['id'],ut[_0xdc7b('0x86')](this[_0xdc7b('0x15')]))[_0xdc7b('0x87')](function(_0x2794e0){if(!_[_0xdc7b('0x6c')](_0x2794e0)){for(var _0xfeeda4=0x0;_0xfeeda4<_0x2794e0[_0xdc7b('0x88')];_0xfeeda4+=0x1){if(ut[_0xdc7b('0x89')](_0x2794e0[_0xfeeda4][_0xdc7b('0x8a')])<_0x71dca4['dialRecallMeTimeout']*0x3c){if(_0x2794e0[_0xfeeda4][_0xdc7b('0x8b')]&&!_0x2794e0[_0xfeeda4]['Agent'][_0xdc7b('0x8c')]){_0x55b859[_0xdc7b('0x8d')](_0x2794e0[_0xfeeda4]['id'])['then'](ut[_0xdc7b('0x8e')](_0xdc7b('0x8f')))[_0xdc7b('0x7a')](ut[_0xdc7b('0x8e')](_0xdc7b('0x8f')));}else{rpcDb[_0xdc7b('0x90')](_0x2794e0[_0xfeeda4]['id']);}}else{var _0x2c2021=new Action(_0x2794e0[_0xfeeda4],_0x71dca4);_0x2c2021[_0xdc7b('0x91')]=moment()[_0xdc7b('0x58')](_0xdc7b('0x92'));_0x71dca4[_0xdc7b('0x40')]+=0x1;ut[_0xdc7b('0x93')](_0x2c2021,0x17,'RecallInQueue');if(_0x71dca4['dialRecallInQueue']){rpcDb[_0xdc7b('0x94')](ut[_0xdc7b('0x95')](_0x2794e0[_0xfeeda4]));rpcDb['createCustomerHistory'](_0x2c2021,'[HistoryDialRecallInQueue][historyCatch]');}else{ut['logCustomer'](_0x2c2021,0x16,_0xdc7b('0x96'));rpcDb[_0xdc7b('0x97')](_0x2c2021,'[HistoryRecallClose]');rpcDb[_0xdc7b('0x98')](_0x2c2021,_0xdc7b('0x99'));}}}}})[_0xdc7b('0x7a')](ut[_0xdc7b('0x8e')](_0xdc7b('0x9a')));};Preview[_0xdc7b('0xc')][_0xdc7b('0x6a')]=function(_0x105149){_0x105149[_0xdc7b('0x5e')]=!![];if(ut[_0xdc7b('0x9b')](_0x105149[_0xdc7b('0x9c')])){_0x105149['message']='AGENTS_NOT_LOGGED';}else if(!ut[_0xdc7b('0x9d')](_0x105149['dialActive'])){_0x105149[_0xdc7b('0x5f')]=_0xdc7b('0x60');}else if(!this['isTrunkReachable'](_0x105149[_0xdc7b('0x53')])){if(!this['isTrunkReachable'](_0x105149[_0xdc7b('0x9e')])){_0x105149[_0xdc7b('0x5f')]='TRUNK_IS_NOT_REACHABLE';}else{_0x105149[_0xdc7b('0x5f')]=_0xdc7b('0x9f');}}else{_0x105149[_0xdc7b('0x5f')]=_0xdc7b('0x9f');}emitCampaignPreview(_0x105149);};Preview[_0xdc7b('0xc')][_0xdc7b('0xa0')]=function(_0x167251,_0x501121,_0x54ea78){var _0x29262f=this;var _0x555b23=this[_0xdc7b('0x14')][_0x501121];var _0x36d2ad=this['campaignsPreview'][_0x555b23[_0xdc7b('0x71')]];var _0x3ed700;if(_0x36d2ad){switch(_0x54ea78){case'1':_0x36d2ad['outboundNoSuchCallsDay']+=0x1;_0x555b23[_0xdc7b('0xa1')]+=0x1;_0x555b23['countglobal']=ut['totalGlobal'](_0x555b23);ut[_0xdc7b('0x93')](_0x555b23,0x0,_0xdc7b('0xa2'));ami[_0xdc7b('0x5c')](_0xdc7b('0xa3'),ut[_0xdc7b('0xa4')](_0x555b23,'nosuchnumber'));rpcDb[_0xdc7b('0x97')](_0x555b23,'[callProgressDetectingCustomer][logNoSuch]');if(ut['totalGlobal'](_0x555b23)>=_0x36d2ad[_0xdc7b('0xa5')]){_0x3ed700=ut[_0xdc7b('0xa6')](_0x555b23,0xf,_0xdc7b('0xa7'));rpcDb[_0xdc7b('0x98')](_0x3ed700,_0xdc7b('0xa8'));}else{if(_0x555b23[_0xdc7b('0xa1')]>=_0x36d2ad[_0xdc7b('0xa9')]){rpcDb[_0xdc7b('0x98')](_0x555b23,_0xdc7b('0xa8'));}else{rpcDb[_0xdc7b('0xaa')](ut[_0xdc7b('0xab')](_0x555b23,_0xdc7b('0xa1'),_0x36d2ad[_0xdc7b('0xac')]),_0x555b23['unlockAgent'],_0x555b23['activeContact']);}}delete this[_0xdc7b('0x14')][_0x167251[_0xdc7b('0xad')]];break;case'ANSWER':var _0x1de292=moment()['format'](_0xdc7b('0x92'));_0x555b23[_0xdc7b('0xae')]=_0x1de292;_0x555b23[_0xdc7b('0xaf')]=_0x1de292;_0x555b23[_0xdc7b('0x7d')]=!![];_0x36d2ad[_0xdc7b('0x2a')]+=0x1;logger[_0xdc7b('0x6d')](_0xdc7b('0xb0'),_0x555b23[_0xdc7b('0xb1')],_0xdc7b('0xb2'),_0x36d2ad[_0xdc7b('0x27')],'pTalking:\x20',_0x36d2ad[_0xdc7b('0x2a')]);ami['emit'](_0xdc7b('0xb3'),ut[_0xdc7b('0xa4')](_0x555b23,_0xdc7b('0xb4'),this[_0xdc7b('0x11')][_0x555b23[_0xdc7b('0x71')]]));if(_0x36d2ad['acw']){ami[_0xdc7b('0x5c')]('custom:agentConnectPreview',ut[_0xdc7b('0xb5')](_0x555b23));}break;case'16':ami[_0xdc7b('0x5c')]('custom:agentcomplete',ut[_0xdc7b('0xa4')](_0x555b23,_0xdc7b('0xb6'),this['campaignsPreview'][_0x555b23[_0xdc7b('0x71')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x555b23,_0xdc7b('0xb6')));_0x36d2ad['outboundAnswerCallsDay']+=0x1;_0x36d2ad[_0xdc7b('0x2f')]+=0x1;_0x36d2ad[_0xdc7b('0xb7')]+=0x1;ut[_0xdc7b('0x7e')](_0x36d2ad,_0xdc7b('0xb8'));_0x555b23['countglobal']=ut[_0xdc7b('0xb9')](_0x555b23);ut[_0xdc7b('0x93')](_0x555b23,0x4,_0xdc7b('0xba'));rpcDb[_0xdc7b('0x97')](_0x555b23,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xdc7b('0x98')](_0x555b23,_0xdc7b('0xbb'));rpcDb['crateCustomerReportQueue'](_0x555b23);_0x36d2ad[_0xdc7b('0x2c')]+=_0x555b23[_0xdc7b('0xbc')];_0x36d2ad['sumBillable']+=_0x555b23[_0xdc7b('0xbc')];logger[_0xdc7b('0x6d')](_0xdc7b('0xbd'),_0x555b23['uniqueid'],_0xdc7b('0xb2'),_0x36d2ad['name'],_0xdc7b('0x72'),_0x36d2ad['pTalking']);delete this['actions'][_0x167251[_0xdc7b('0xad')]];break;case'BUSY':_0x36d2ad['outboundBusyCallsDay']+=0x1;_0x555b23[_0xdc7b('0xbe')]+=0x1;_0x555b23['countglobal']=ut[_0xdc7b('0xb9')](_0x555b23);ut[_0xdc7b('0x93')](_0x555b23,0x5,_0xdc7b('0xbf'));ami[_0xdc7b('0x5c')]('custom:agentbusy',ut[_0xdc7b('0xa4')](_0x555b23,_0xdc7b('0xc0')));rpcDb[_0xdc7b('0x97')](_0x555b23,_0xdc7b('0xc1'));if(ut['totalGlobal'](_0x555b23)>=_0x36d2ad[_0xdc7b('0xa5')]){_0x3ed700=ut['cloneAction'](_0x555b23,0xf,'Global');rpcDb['createCustomerFinal'](_0x3ed700,_0xdc7b('0xc2'));}else{if(_0x555b23[_0xdc7b('0xbe')]>=_0x36d2ad[_0xdc7b('0xc3')]){rpcDb['createCustomerFinal'](_0x555b23,_0xdc7b('0xc1'));}else{rpcDb[_0xdc7b('0xaa')](ut[_0xdc7b('0xab')](_0x555b23,'countbusyretry',_0x36d2ad[_0xdc7b('0xc4')]),_0x555b23[_0xdc7b('0xc5')],_0x555b23['activeContact']);}}break;case _0xdc7b('0xc6'):_0x36d2ad['outboundNoAnswerCallsDay']+=0x1;_0x555b23[_0xdc7b('0xc7')]+=0x1;_0x555b23[_0xdc7b('0xc8')]=ut['totalGlobal'](_0x555b23);ut[_0xdc7b('0x93')](_0x555b23,0x3,_0xdc7b('0xc9'));ami[_0xdc7b('0x5c')](_0xdc7b('0xca'),ut[_0xdc7b('0xa4')](_0x555b23,_0xdc7b('0xcb')));rpcDb[_0xdc7b('0x97')](_0x555b23,_0xdc7b('0xcc'));if(ut[_0xdc7b('0xb9')](_0x555b23)>=_0x36d2ad['dialGlobalMaxRetry']){_0x3ed700=ut['cloneAction'](_0x555b23,0xf,_0xdc7b('0xa7'));rpcDb[_0xdc7b('0x98')](_0x3ed700,_0xdc7b('0xcd'));}else{if(_0x555b23['countnoanswerretry']>=_0x36d2ad[_0xdc7b('0xce')]){rpcDb[_0xdc7b('0x98')](_0x555b23,_0xdc7b('0xcc'));}else{rpcDb[_0xdc7b('0xaa')](ut[_0xdc7b('0xab')](_0x555b23,_0xdc7b('0xc7'),_0x36d2ad[_0xdc7b('0xcf')]),_0x555b23[_0xdc7b('0xc5')],_0x555b23[_0xdc7b('0xd0')]);}}break;case _0xdc7b('0xd1'):_0x36d2ad['outboundCongestionCallsDay']+=0x1;_0x555b23['countcongestionretry']+=0x1;_0x555b23[_0xdc7b('0xc8')]=ut[_0xdc7b('0xb9')](_0x555b23);ut[_0xdc7b('0x93')](_0x555b23,0x8,_0xdc7b('0xd2'));ami[_0xdc7b('0x5c')](_0xdc7b('0xd3'),ut[_0xdc7b('0xa4')](_0x555b23,_0xdc7b('0xd4')));rpcDb['createCustomerHistory'](_0x555b23,_0xdc7b('0xd5'));if(ut[_0xdc7b('0xb9')](_0x555b23)>=_0x36d2ad[_0xdc7b('0xa5')]){_0x3ed700=ut[_0xdc7b('0xa6')](_0x555b23,0xf,_0xdc7b('0xa7'));rpcDb[_0xdc7b('0x98')](_0x3ed700,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x555b23[_0xdc7b('0xd6')]>=_0x36d2ad[_0xdc7b('0xd7')]){rpcDb[_0xdc7b('0x98')](_0x555b23,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0xdc7b('0xaa')](ut[_0xdc7b('0xab')](_0x555b23,'countcongestionretry',_0x36d2ad[_0xdc7b('0xc4')]),_0x555b23['unlockAgent'],_0x555b23['activeContact']);}}break;case _0xdc7b('0xd8'):_0x36d2ad[_0xdc7b('0x41')]+=0x1;_0x555b23[_0xdc7b('0xd9')]+=0x1;_0x555b23[_0xdc7b('0xc8')]=ut[_0xdc7b('0xb9')](_0x555b23);ut[_0xdc7b('0x93')](_0x555b23,0x14,_0xdc7b('0xda'));ami[_0xdc7b('0x5c')](_0xdc7b('0xdb'),ut[_0xdc7b('0xa4')](_0x555b23,_0xdc7b('0xdc')));rpcDb[_0xdc7b('0x97')](_0x555b23,_0xdc7b('0xdd'));if(ut[_0xdc7b('0xb9')](_0x555b23)>=_0x36d2ad[_0xdc7b('0xa5')]){_0x3ed700=ut['cloneAction'](_0x555b23,0x14,_0xdc7b('0xda'));rpcDb[_0xdc7b('0x98')](_0x3ed700,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x555b23[_0xdc7b('0xd9')]>=_0x36d2ad[_0xdc7b('0xde')]){rpcDb[_0xdc7b('0x98')](_0x555b23,_0xdc7b('0xdf'));}else{rpcDb[_0xdc7b('0xaa')](ut[_0xdc7b('0xab')](_0x555b23,_0xdc7b('0xd9'),_0x36d2ad[_0xdc7b('0xe0')]),_0x555b23[_0xdc7b('0xc5')],_0x555b23[_0xdc7b('0xd0')]);}}break;case _0xdc7b('0xe1'):_0x36d2ad[_0xdc7b('0xe2')]+=0x1;_0x555b23[_0xdc7b('0xe3')]+=0x1;_0x555b23['countglobal']=ut['totalGlobal'](_0x555b23);ut[_0xdc7b('0x93')](_0x555b23,0xb,_0xdc7b('0xe4'));rpcDb[_0xdc7b('0x97')](_0x555b23,_0xdc7b('0xe5'));if(ut[_0xdc7b('0xb9')](_0x555b23)>=_0x36d2ad[_0xdc7b('0xa5')]){_0x3ed700=ut['cloneAction'](_0x555b23,0xf,_0xdc7b('0xa7'));rpcDb[_0xdc7b('0x98')](_0x3ed700,_0xdc7b('0xe5'));}else{if(_0x555b23[_0xdc7b('0xe6')]>=_0x36d2ad[_0xdc7b('0xe7')]){rpcDb[_0xdc7b('0x98')](_0x555b23,_0xdc7b('0xe5'));}else{rpcDb['rescheduleContact'](ut[_0xdc7b('0xab')](_0x555b23,'countabandonedretry',_0x36d2ad[_0xdc7b('0xe8')]),_0x555b23['unlockAgent'],_0x555b23['activeContact']);}}break;default:if(_0x555b23[_0xdc7b('0x7d')]){ut[_0xdc7b('0x7e')](_0x36d2ad,_0xdc7b('0xe9'));ut[_0xdc7b('0x7f')](_0xdc7b('0xea')+_0x36d2ad[_0xdc7b('0x27')],_0x167251);}_0x36d2ad['outboundUnknownCallsDay']+=0x1;_0x555b23['countglobal']=ut['totalGlobal'](_0x555b23);ut[_0xdc7b('0x93')](_0x555b23,0xc,_0x167251[_0xdc7b('0xeb')]||_0x167251[_0xdc7b('0xec')]);rpcDb[_0xdc7b('0x97')](_0x555b23,_0xdc7b('0xed'));if(ut[_0xdc7b('0xb9')](_0x555b23)>=_0x36d2ad[_0xdc7b('0xa5')]){_0x3ed700=ut[_0xdc7b('0xa6')](_0x555b23,0xf,_0xdc7b('0xa7'));rpcDb[_0xdc7b('0x98')](_0x3ed700,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb['createCustomerFinal'](_0x555b23,_0xdc7b('0xee'));}delete this[_0xdc7b('0x14')][_0x167251[_0xdc7b('0xad')]];}if(!(_0x555b23[_0xdc7b('0x7d')]&&_0x54ea78==='16')){ut[_0xdc7b('0x7b')](_0x36d2ad,'[callProgressDetectingCustomer]');logger['info'](_0xdc7b('0xef'),_0x555b23[_0xdc7b('0xb1')],_0xdc7b('0xb2'),_0x36d2ad[_0xdc7b('0x27')],_0xdc7b('0x70'),_0x36d2ad['originated']);}if(_0x54ea78!==_0xdc7b('0xf0')){delete this[_0xdc7b('0x14')][_0x167251['linkedid']];delete this['actions'][_0x167251[_0xdc7b('0xf1')]];}}};Preview[_0xdc7b('0xc')]['callProgressDetectingAgent']=function(_0x1825a7,_0x470a0f,_0x41ca82){if(_[_0xdc7b('0xf2')](_0x470a0f)&&_0xdc7b('0xf3')!==typeof _0x470a0f){return;}if(_[_0xdc7b('0xf2')](_0x41ca82)&&'object'!==typeof _0x41ca82){return;}switch(_0x41ca82['reason']){case'0':ut[_0xdc7b('0xf4')](_0x1825a7,0x0,_0xdc7b('0xa2'));rpcDb[_0xdc7b('0xf5')](_0x1825a7,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0xdc7b('0xf4')](_0x1825a7,0x3,'NoAnswer');rpcDb['createAgentHistory'](_0x1825a7,_0xdc7b('0xf6'));break;case'5':ut[_0xdc7b('0xf4')](_0x1825a7,0x5,_0xdc7b('0xbf'));rpcDb[_0xdc7b('0xf5')](_0x1825a7,_0xdc7b('0xf7'));break;case'8':ut[_0xdc7b('0xf4')](_0x1825a7,0x8,_0xdc7b('0xd2'));rpcDb['createAgentHistory'](_0x1825a7,_0xdc7b('0xf8'));break;case'22':ut['logAgent'](_0x1825a7,0x16,_0xdc7b('0xf9'));rpcDb[_0xdc7b('0xf5')](_0x1825a7,_0xdc7b('0xfa'));break;default:ut[_0xdc7b('0xf4')](_0x1825a7,0xc,_0x41ca82[_0xdc7b('0xfb')]);rpcDb[_0xdc7b('0xf5')](_0x1825a7,_0xdc7b('0xf8'));}ut['updateOriginated'](_0x470a0f,'[callProgressDetectingAgent]');logger[_0xdc7b('0x6d')]('[originated][decrement][callProgressDetectingAgent]',_0x1825a7[_0xdc7b('0xb1')],_0xdc7b('0xb2'),_0x470a0f[_0xdc7b('0x27')],_0xdc7b('0x70'),_0x470a0f[_0xdc7b('0x4d')]);delete this['actions'][_0x1825a7[_0xdc7b('0xb1')]];};Preview[_0xdc7b('0xc')]['checkInBlack']=function(_0x121a65,_0x1fbb70,_0x5b3cc2,_0x1c1854,_0x1d30bb){var _0x2bcedf=this;return new BPromise(function(_0x56c418,_0x2b8cb7){if(_[_0xdc7b('0x6c')](_0x1fbb70)||_[_0xdc7b('0x6c')](_0x1fbb70[_0xdc7b('0xfc')])||_['isNil'](_0x1fbb70[_0xdc7b('0xfc')][_0xdc7b('0xfd')])||_['isNil'](_0x1fbb70[_0xdc7b('0x76')])){_0x2b8cb7(ut[_0xdc7b('0x5f')](_0xdc7b('0xfe'),_0x1c1854,_0x1d30bb));return;}var _0xc2c41f=uuid['v4']();var _0x4adfbc=_0x2bcedf['campaignsPreview'][_0x1fbb70[_0xdc7b('0x6f')][_0xdc7b('0x27')]];var _0x495950=_0x5b3cc2?_0x2bcedf[_0xdc7b('0x15')][_0x5b3cc2]['id']:undefined;_0x2bcedf[_0xdc7b('0x14')][_0xc2c41f]=new Action(_0x1fbb70,_0x4adfbc,_0xc2c41f,_0x5b3cc2,_0x495950);var _0xadcee7=_0x2bcedf[_0xdc7b('0x14')][_0xc2c41f];_0xadcee7[_0xdc7b('0xc5')]=_0x1c1854;_0xadcee7[_0xdc7b('0xd0')]=_0x1d30bb;_0xadcee7[_0xdc7b('0xff')]=_0x5b3cc2;if(_[_0xdc7b('0x100')](_0x121a65)){_0x2bcedf['execCall'](_0xadcee7,_0x4adfbc,_0x1fbb70,_0x5b3cc2)[_0xdc7b('0x87')](function(_0x35d68e){logger[_0xdc7b('0x6d')](_0xdc7b('0x101'),_0xdc7b('0x102')+_0xadcee7['queue']+_0xdc7b('0x103')+_0xadcee7[_0xdc7b('0x104')],JSON[_0xdc7b('0x56')](_0x35d68e));ami[_0xdc7b('0x5c')](_0xdc7b('0x105'),ut[_0xdc7b('0xa4')](_0xadcee7,_0xdc7b('0x106'),_0x2bcedf['campaignsPreview'][_0xadcee7['queue']]));_0x56c418(ut['message'](_0xdc7b('0x107')));})[_0xdc7b('0x7a')](function(_0x27deba){ut[_0xdc7b('0x61')](_0xdc7b('0x108'),_0x27deba);_0x2b8cb7(ut['message'](_0xdc7b('0x109'),_0x1c1854,_0x1d30bb));});}else{_0x4adfbc['outboundBlacklistCallsDay']+=0x1;ut[_0xdc7b('0x10a')](_0xadcee7);rpcDb[_0xdc7b('0x10b')](_0xadcee7,'[Blacklist][error]');delete _0x2bcedf[_0xdc7b('0x14')][_0xc2c41f];_0x2b8cb7(ut[_0xdc7b('0x5f')](_0xdc7b('0x10c'),_0x1c1854,_0x1d30bb));}});};Preview[_0xdc7b('0xc')]['isTrunkReachable']=function(_0x36e8a3){return!_['isNil'](_0x36e8a3)&&!_[_0xdc7b('0x6c')](_0x36e8a3[_0xdc7b('0x27')])&&!_[_0xdc7b('0x6c')](_0x36e8a3[_0xdc7b('0x54')])&&_0x36e8a3[_0xdc7b('0x54')]&&!_['isNil'](this[_0xdc7b('0x13')][util[_0xdc7b('0x58')](_0xdc7b('0x10d'),_0x36e8a3[_0xdc7b('0x27')])])&&!_[_0xdc7b('0x6c')](this['trunks'][util['format'](_0xdc7b('0x10d'),_0x36e8a3['name'])]['status'])&&(this['trunks'][util[_0xdc7b('0x58')](_0xdc7b('0x10d'),_0x36e8a3[_0xdc7b('0x27')])][_0xdc7b('0x79')]===_0xdc7b('0x10e')||this[_0xdc7b('0x13')][util['format'](_0xdc7b('0x10d'),_0x36e8a3[_0xdc7b('0x27')])]['status']===_0xdc7b('0x10f'));};Preview[_0xdc7b('0xc')]['run']=function(_0x2f6e4d,_0x51eb1e){var _0x136551=this;return new BPromise(function(_0x528156,_0x53725c){_0x136551[_0xdc7b('0x110')](_0x2f6e4d,_0x51eb1e)[_0xdc7b('0x87')](function(_0x3ed153){_0x528156(_[_0xdc7b('0x73')](_0x3ed153,[_0xdc7b('0x5f')]));})[_0xdc7b('0x7a')](function(_0x174181){if(_0x174181['unlock']){rpcDb[_0xdc7b('0x111')](_0x2f6e4d);}if(_0x174181[_0xdc7b('0x54')]){rpcDb[_0xdc7b('0x90')](_0x2f6e4d);}_0x53725c(_[_0xdc7b('0x73')](_0x174181,[_0xdc7b('0x5f')]));});});};Preview[_0xdc7b('0xc')]['execRun']=function(_0x49c4bb,_0x436b84){var _0x46c498=this;return new BPromise(function(_0x3a155f,_0x8fb851){var _0x13ba78,_0x11ad47;rpcDb[_0xdc7b('0x112')](_0x49c4bb)[_0xdc7b('0x87')](function(_0x430e82){if(!_[_0xdc7b('0x6c')](_0x430e82[0x0])){_0x11ad47=_0x430e82[0x0][_0xdc7b('0x113')]?![]:!![];_0x13ba78=_0x430e82[0x0]['recallme']?!![]:![];_0x13ba78=_0x436b84?!![]:_0x13ba78;}var _0x4235d0=_0x46c498['validateContact'](_0x430e82);if(_0x4235d0[_0xdc7b('0x114')]){rpcDb[_0xdc7b('0x115')](_[_0xdc7b('0x73')](_0x430e82[0x0],[_0xdc7b('0x76'),_0xdc7b('0x116')]))[_0xdc7b('0x87')](function(_0x448dcb){_0x46c498['checkInBlack'](_0x448dcb,_0x430e82[0x0],_0x436b84,_0x11ad47,_0x13ba78)['then'](function(_0x500435){_0x3a155f(_0x500435);})['catch'](function(_0x3b0d90){_0x8fb851(_0x3b0d90);});})[_0xdc7b('0x7a')](function(_0x479872){ut[_0xdc7b('0x61')]('[Preview][checkIsBlackList]',_0x479872);_0x8fb851(ut[_0xdc7b('0x5f')]('Call\x20unsuccessful',_0x11ad47,_0x13ba78));});}else{_0x8fb851(ut[_0xdc7b('0x5f')](_0x4235d0[_0xdc7b('0x5f')],_0x11ad47,_0x13ba78));}})[_0xdc7b('0x7a')](function(_0x271d07){ut[_0xdc7b('0x61')](_0xdc7b('0x117'),_0x271d07);_0x8fb851(ut[_0xdc7b('0x5f')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0xdc7b('0xc')]['validateContact']=function(_0x5bfa13){if(_['isNil'](_0x5bfa13)||_[_0xdc7b('0x100')](_0x5bfa13)||!_[_0xdc7b('0x6c')](_0x5bfa13[0x0][_0xdc7b('0x8b')])&&_[_0xdc7b('0x6c')](_0x5bfa13[0x0][_0xdc7b('0x8b')][_0xdc7b('0x27')])){ut[_0xdc7b('0x61')](_0xdc7b('0x118'),_0x5bfa13);return{'isValid':![],'message':_0xdc7b('0x119')};}var _0x1e96fd=this[_0xdc7b('0x11')][_0x5bfa13[0x0]['Queue'][_0xdc7b('0x27')]];_0x1e96fd[_0xdc7b('0x5f')]=_0xdc7b('0x9f');if(_[_0xdc7b('0x6c')](_0x1e96fd)){ut['logger'](_0xdc7b('0x11a'),_0x1e96fd);return{'isValid':![],'message':_0xdc7b('0x11b')};}if(!this['isTrunkReachable'](_0x1e96fd[_0xdc7b('0x53')])){ut[_0xdc7b('0x61')](_0xdc7b('0x11c'),_0xdc7b('0x11d')+_0x1e96fd['name']+_0xdc7b('0x11e'));if(!this[_0xdc7b('0x11f')](_0x1e96fd[_0xdc7b('0x9e')])){ut[_0xdc7b('0x61')](_0xdc7b('0x11c'),_0x1e96fd[_0xdc7b('0x27')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xdc7b('0x120')};}}if(!ut[_0xdc7b('0x9d')](_0x1e96fd[_0xdc7b('0x33')])){ut[_0xdc7b('0x61')]('[Preview][validateContact][Campaign\x20Active]',_0x1e96fd['name']+_0xdc7b('0x121'));return{'isValid':![],'message':_0xdc7b('0x11d')+_0x1e96fd[_0xdc7b('0x27')]+_0xdc7b('0x121')};}return{'isValid':!![],'message':_0xdc7b('0x122')};};Preview[_0xdc7b('0xc')]['execCall']=function(_0x324d2b,_0x42756e,_0x331a0d,_0x39eb46){var _0x304d5f=this;return new BPromise(function(_0xf86d34,_0x2fb692){var _0x24e03f=_0x324d2b[_0xdc7b('0xb1')];var _0x2fe353=_0x304d5f[_0xdc7b('0x11f')](_0x42756e[_0xdc7b('0x53')])?util[_0xdc7b('0x58')]('SIP/%s/%s%s',_0x42756e[_0xdc7b('0x53')]['name'],_[_0xdc7b('0x6c')](_0x42756e[_0xdc7b('0x123')])?'':_0x42756e[_0xdc7b('0x123')][_0xdc7b('0x124')]()||'',_0x42756e[_0xdc7b('0x125')]>0x0?_0x331a0d[_0xdc7b('0xfc')]['phone'][_0xdc7b('0x126')](_0x42756e['dialCutDigit']):_0x331a0d['Contact'][_0xdc7b('0xfd')]):util[_0xdc7b('0x58')](_0xdc7b('0x127'),_[_0xdc7b('0x6c')](_0x42756e[_0xdc7b('0x9e')])?_0x42756e[_0xdc7b('0x53')][_0xdc7b('0x27')]:_0x42756e['TrunkBackup']['name'],_[_0xdc7b('0x6c')](_0x42756e[_0xdc7b('0x123')])?'':_0x42756e[_0xdc7b('0x123')][_0xdc7b('0x124')]()||'',_0x42756e[_0xdc7b('0x125')]>0x0?_0x331a0d[_0xdc7b('0xfc')][_0xdc7b('0xfd')][_0xdc7b('0x126')](_0x42756e[_0xdc7b('0x125')]):_0x331a0d[_0xdc7b('0xfc')][_0xdc7b('0xfd')]);var _0x1f812f=_0x304d5f['isTrunkReachable'](_0x42756e[_0xdc7b('0x53')])?ut[_0xdc7b('0x128')](_0x42756e['Trunk']['callerid'],_0x42756e[_0xdc7b('0x35')],_0x42756e[_0xdc7b('0x129')]>0x0?ut[_0xdc7b('0x12a')](_0x42756e[_0xdc7b('0x12b')],_0x42756e[_0xdc7b('0x129')]):_0x42756e[_0xdc7b('0x12b')]):ut[_0xdc7b('0x128')](_[_0xdc7b('0x6c')](_0x42756e['TrunkBackup'])?_0x42756e[_0xdc7b('0x53')][_0xdc7b('0x12c')]:_0x42756e[_0xdc7b('0x9e')][_0xdc7b('0x12c')],_0x42756e['dialOriginateCallerIdName'],_0x42756e[_0xdc7b('0x129')]>0x0?ut['getCallerIdRandom'](_0x42756e[_0xdc7b('0x12b')],_0x42756e['dialRandomLastDigitCallerIdNumber']):_0x42756e['dialOriginateCallerIdNumber']);if(_0x1f812f){_0x324d2b[_0xdc7b('0x12d')]=ut['extractCalleridName'](_0x1f812f);_0x324d2b[_0xdc7b('0x12e')]=ut['extractCalleridNumber'](_0x1f812f);}var _0xa5c97a=ut[_0xdc7b('0x12f')](_0x42756e,_0x331a0d,_0x2fe353,_0x1f812f,_0x24e03f,_0x324d2b);_[_0xdc7b('0x130')](_0x324d2b,ut[_0xdc7b('0x131')](_0xa5c97a));_0x324d2b['starttime']=moment()[_0xdc7b('0x58')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0xdc7b('0x78')](ut[_0xdc7b('0x132')](_0x324d2b,_0x42756e,_0xa5c97a,_0x324d2b[_0xdc7b('0xd0')],_0x39eb46))['then'](function(_0x3339f7){_0x42756e[_0xdc7b('0x4d')]+=0x1;logger[_0xdc7b('0x6d')](_0xdc7b('0x133'),_0x24e03f,_0xdc7b('0xb2'),_0x42756e[_0xdc7b('0x27')],_0xdc7b('0x70'),_0x42756e[_0xdc7b('0x4d')]);_0xf86d34(_0x3339f7);})[_0xdc7b('0x7a')](function(_0x31756c){ut['logAgent'](_0x324d2b,0xe,'OriginateError');rpcDb[_0xdc7b('0xf5')](_0x324d2b,'[originateFailure][logOriginateFailure]');_0x2fb692(_0x31756c);});});};Preview[_0xdc7b('0xc')][_0xdc7b('0x20')]=function(_0xd4e474){if(this[_0xdc7b('0x14')][_0xd4e474[_0xdc7b('0xad')]]){this[_0xdc7b('0x14')][_0xd4e474[_0xdc7b('0xad')]][_0xdc7b('0x134')]=_0xd4e474[_0xdc7b('0x134')];}};Preview[_0xdc7b('0xc')][_0xdc7b('0x17')]=function(_0x38cf23){var _0x121daa=this;var _0x27d939=this[_0xdc7b('0x14')][_0x38cf23['actionid']];if(_0x27d939){if(_0x27d939['lookAgent']&&this[_0xdc7b('0x15')][_0x27d939[_0xdc7b('0xff')]]){ut[_0xdc7b('0x135')](_0x27d939,this['agents'][_0x27d939['lookAgent']][_0xdc7b('0x27')],this[_0xdc7b('0x15')][_0x27d939[_0xdc7b('0xff')]]['id']);}var _0x5e8914=_[_0xdc7b('0x136')](_0x27d939);_0x5e8914[_0xdc7b('0xae')]=moment()[_0xdc7b('0x58')]('YYYY-MM-DD\x20HH:mm:ss');var _0x344ab7=_0x121daa[_0xdc7b('0x11')][_0x27d939[_0xdc7b('0x71')]];if(ut[_0xdc7b('0x137')](_0x38cf23[_0xdc7b('0x138')])){if(_0x27d939[_0xdc7b('0xc5')]){rpcDb[_0xdc7b('0x111')](_0x27d939['idContact']);}if(_0x27d939[_0xdc7b('0xd0')]){rpcDb[_0xdc7b('0x90')](_0x27d939[_0xdc7b('0x104')]);}ami[_0xdc7b('0x5c')](_0xdc7b('0x139'),ut[_0xdc7b('0xa4')](_0x27d939,_0xdc7b('0x13a'),this[_0xdc7b('0x11')][_0x27d939[_0xdc7b('0x71')]]));this['callProgressDetectingAgent'](_0x5e8914,_0x344ab7,_0x38cf23);}else{_0x27d939['starttime']=moment()[_0xdc7b('0x58')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0xdc7b('0xf4')](_0x5e8914,0x4,_0xdc7b('0xba'));rpcDb[_0xdc7b('0xf5')](_0x5e8914,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0xdc7b('0xc')][_0xdc7b('0x1a')]=function(_0x3b8c33){var _0x5d4d06=this;var _0x2b511b=this[_0xdc7b('0x14')][_0x3b8c33[_0xdc7b('0xad')]];var _0x58a31a;if(_0x2b511b){_0x58a31a=this['campaignsPreview'][_0x2b511b[_0xdc7b('0x71')]];logger['info'](_0xdc7b('0x13b'),_0x3b8c33[_0xdc7b('0xad')],_0xdc7b('0xb2'),_0x58a31a[_0xdc7b('0x27')],_0xdc7b('0x72'),_0x58a31a['pTalking']);}if(this[_0xdc7b('0x14')][_0x3b8c33[_0xdc7b('0xad')]]&&_0x3b8c33[_0xdc7b('0xad')]!==_0x3b8c33['uniqueid']){if(_0x3b8c33['cause']==='16'&&this[_0xdc7b('0x14')][_0x3b8c33[_0xdc7b('0xad')]][_0xdc7b('0x7d')]){this[_0xdc7b('0xa0')](_0x3b8c33,_0x3b8c33['linkedid'],_0x3b8c33['cause']);}else if(this[_0xdc7b('0x14')][_0x3b8c33[_0xdc7b('0xad')]][_0xdc7b('0x7d')]){logger[_0xdc7b('0x6d')]('[syncHangup][talking][cause]',_0x3b8c33[_0xdc7b('0xad')],_0x3b8c33[_0xdc7b('0x13c')],'\x20Queue',_0x58a31a[_0xdc7b('0x27')],'pTalking:\x20',_0x58a31a[_0xdc7b('0x2a')]);this['callProgressDetectingCustomer'](_0x3b8c33,_0x3b8c33[_0xdc7b('0xad')],_0x3b8c33[_0xdc7b('0x13c')]);}}else if(_0x2b511b&&_['isNil'](_0x2b511b[_0xdc7b('0x13d')])&&_0x58a31a[_0xdc7b('0x13e')]&&_0x3b8c33['linkedid']===_0x3b8c33[_0xdc7b('0xb1')]&&_[_0xdc7b('0x6c')](_0x3b8c33[_0xdc7b('0xfb')])&&_0x3b8c33[_0xdc7b('0x13c')]==='16'&&_0x3b8c33[_0xdc7b('0x13f')]==='6'&&_[_0xdc7b('0xf2')](_0x2b511b[_0xdc7b('0x140')])){if(_0x2b511b[_0xdc7b('0xc5')]){rpcDb[_0xdc7b('0x111')](_0x2b511b['idContact']);}if(_0x2b511b['activeContact']){rpcDb[_0xdc7b('0x90')](_0x2b511b[_0xdc7b('0x104')]);}_0x3b8c33[_0xdc7b('0xfb')]='22';this['callProgressDetectingAgent'](_0x2b511b,_0x58a31a,_0x3b8c33);}else if(_0x2b511b&&_0x2b511b[_0xdc7b('0x140')]){if(_0x3b8c33[_0xdc7b('0x13c')]==='16'&&this['actions'][_0x3b8c33[_0xdc7b('0xad')]][_0xdc7b('0x7d')]){logger[_0xdc7b('0x6d')](_0xdc7b('0x141'),_0x3b8c33['linkedid'],_0x3b8c33[_0xdc7b('0x13c')],'\x20Queue',_0x58a31a[_0xdc7b('0x27')],'pTalking:\x20',_0x58a31a[_0xdc7b('0x2a')]);this[_0xdc7b('0xa0')](_0x3b8c33,_0x3b8c33[_0xdc7b('0xad')],_0x3b8c33[_0xdc7b('0x13c')]);}else if(this[_0xdc7b('0x14')][_0x3b8c33[_0xdc7b('0xad')]][_0xdc7b('0x7d')]){logger[_0xdc7b('0x6d')](_0xdc7b('0x142'),_0x3b8c33[_0xdc7b('0xad')],_0x3b8c33[_0xdc7b('0x13c')],_0xdc7b('0xb2'),_0x58a31a[_0xdc7b('0x27')],_0xdc7b('0x72'),_0x58a31a['pTalking']);this[_0xdc7b('0xa0')](_0x3b8c33,_0x3b8c33[_0xdc7b('0xad')],_0x3b8c33[_0xdc7b('0x13c')]);}}};Preview[_0xdc7b('0xc')][_0xdc7b('0x1e')]=function(_0x780072){if(this[_0xdc7b('0x14')][_0x780072[_0xdc7b('0xf1')]]&&_0x780072[_0xdc7b('0xf1')]!==_0x780072['destuniqueid']){this[_0xdc7b('0xa0')](_0x780072,_0x780072[_0xdc7b('0xf1')],_0x780072[_0xdc7b('0xec')]);}};Preview[_0xdc7b('0xc')]['syncHangupRequest']=function(_0x11c944){if(this['actions'][_0x11c944[_0xdc7b('0xad')]]&&_0x11c944['linkedid']!==_0x11c944[_0xdc7b('0xb1')]&&!this['actions'][_0x11c944[_0xdc7b('0xad')]][_0xdc7b('0x7d')]){if(_0x11c944[_0xdc7b('0x13c')]==='1'){this['callProgressDetectingCustomer'](_0x11c944,_0x11c944[_0xdc7b('0xad')],_0x11c944[_0xdc7b('0x13c')]);}}};Preview[_0xdc7b('0xc')][_0xdc7b('0x143')]=function(_0x450a47,_0x5660d1,_0x1e579b){if(this['actions'][_0x450a47]){if(_[_0xdc7b('0x6c')](this[_0xdc7b('0x14')][_0x450a47][_0xdc7b('0x144')])){this[_0xdc7b('0x14')][_0x450a47][_0xdc7b('0x144')]={};}this[_0xdc7b('0x14')][_0x450a47][_0xdc7b('0x144')][_0x5660d1]=_0x1e579b;}};Preview[_0xdc7b('0xc')][_0xdc7b('0x22')]=function(_0x44e6f8){try{if(!_[_0xdc7b('0x6c')](_0x44e6f8)){if(ut[_0xdc7b('0x145')](_[_0xdc7b('0x146')](_0x44e6f8[_0xdc7b('0x147')])[0x0])){this['addVariable'](_0x44e6f8[_0xdc7b('0xb1')],_[_0xdc7b('0x146')](_0x44e6f8[_0xdc7b('0x147')])[0x0],_0x44e6f8[_0xdc7b('0x148')]);}}}catch(_0x4cf9dc){logger[_0xdc7b('0x149')]('[syncVarSet][Preview]',util[_0xdc7b('0x14a')](_0x4cf9dc,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0xdc7b('0x14b')]=function(_0x404c4d){if(_0x404c4d){if(this[_0xdc7b('0x14')][_0x404c4d[_0xdc7b('0x14c')]]){this[_0xdc7b('0x14')][_0x404c4d['transfertargetlinkedid']][_0xdc7b('0x140')]=!![];}}};Preview[_0xdc7b('0xc')][_0xdc7b('0x24')]=function(_0x17a7be){if(_0x17a7be){if(this[_0xdc7b('0x14')][_0x17a7be['transfererlinkedid']]){this['actions'][_0x17a7be[_0xdc7b('0x14d')]]['transfer']=!![];}}};module[_0xdc7b('0x14e')]=Preview; \ No newline at end of file +var _0x5655=['destuniqueid','variables','filterKey','keys','variable','addVariable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','../../../config/logger','actionPreview','../ami','./rpcDb','./action','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','syncNewExten','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','outbound','name','answered','loggedIn','pTalking','sumHoldTime','talking','total','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','Interval','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','voice_queue_presence:remove','sendMessageOneNotActive','message','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','syncCampaigns','prototype','hasOwnProperty','preview','booked','type','setMessage','recallMe','clearZombieChannel','sequence','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','dialNoSuchNumberRetryFrequency','activeContact','responsetime','answertime','uniqueid','\x20Queue','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','linkedid','BUSY','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','unlockAgent','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','countabandonedetry','dialAbandonedMaxRety','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','[default]','outboundUnknownCallsDay','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','SIP/%s','unmonitored','run','execRun','pick','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','getCallerId','dialOriginateCallerIdName','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','Action','variablesAction','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','reason','channelstate','transfer','disableContact','[syncHangup][talking][transfer]'];(function(_0x4cbb1d,_0x121d99){var _0x133d6f=function(_0xea0575){while(--_0xea0575){_0x4cbb1d['push'](_0x4cbb1d['shift']());}};_0x133d6f(++_0x121d99);}(_0x5655,0x15e));var _0x5565=function(_0x1bba35,_0x4c4eb5){_0x1bba35=_0x1bba35-0x0;var _0x3002ad=_0x5655[_0x1bba35];return _0x3002ad;};'use strict';var util=require(_0x5565('0x0'));var _=require(_0x5565('0x1'));var BPromise=require(_0x5565('0x2'));var uuid=require(_0x5565('0x3'));var moment=require(_0x5565('0x4'));var md5=require(_0x5565('0x5'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x5565('0x6'))('preview');var loggerAction=require(_0x5565('0x6'))(_0x5565('0x7'));var ami=require(_0x5565('0x8'));var rpcDb=require(_0x5565('0x9'));var Action=require(_0x5565('0xa'));var ut=require('./util/util');config[_0x5565('0xb')]=_[_0x5565('0xc')](config[_0x5565('0xb')],{'host':_0x5565('0xd'),'port':0x18eb});var io=require(_0x5565('0xe'))(new Redis(config[_0x5565('0xb')]));var Sequence=function(){};Sequence['prototype'][_0x5565('0xf')]=function(_0x367ce8){this['tail']=this['tail']?this[_0x5565('0x10')][_0x5565('0x11')](_0x367ce8):_0x367ce8();};function Preview(_0x5d0d99){this['sequence']=new Sequence();this[_0x5565('0x12')]=_0x5d0d99[_0x5565('0x13')];this[_0x5565('0x14')]=_0x5d0d99[_0x5565('0x14')];this[_0x5565('0x15')]={};this[_0x5565('0x16')]=_0x5d0d99[_0x5565('0x16')];this[_0x5565('0x17')]=0x0;ami['on']('originateresponse',this[_0x5565('0x18')][_0x5565('0x19')](this));ami['on'](_0x5565('0x1a'),this[_0x5565('0x1b')]['bind'](this));ami['on'](_0x5565('0x1c'),this[_0x5565('0x1d')][_0x5565('0x19')](this));ami['on'](_0x5565('0x1e'),this[_0x5565('0x1f')]['bind'](this));ami['on']('newexten',this[_0x5565('0x20')][_0x5565('0x19')](this));ami['on']('varset',this[_0x5565('0x21')][_0x5565('0x19')](this));ami['on'](_0x5565('0x22'),this[_0x5565('0x23')]['bind'](this));ami['on']('blindtransfer',this[_0x5565('0x24')][_0x5565('0x19')](this));this[_0x5565('0x25')](this[_0x5565('0x12')]);}function emit(_0x183e20,_0x298f4f,_0x47b0e3){io['to'](_0x183e20)[_0x5565('0x26')](_0x298f4f,_0x47b0e3);}function emitCampaignPreview(_0x11e42b){if(_0x11e42b['type']===_0x5565('0x27')){var _0x25f8c9={'id':_0x11e42b['id'],'name':_0x11e42b[_0x5565('0x28')],'strategy':_0x11e42b['strategy'],'answered':_0x11e42b[_0x5565('0x29')],'available':_0x11e42b['available'],'loggedIn':_0x11e42b[_0x5565('0x2a')],'pTalking':_0x11e42b[_0x5565('0x2b')],'sumBillable':_0x11e42b['sumBillable'],'sumDuration':_0x11e42b['sumDuration'],'sumHoldTime':_0x11e42b[_0x5565('0x2c')]||0x0,'talking':_0x11e42b[_0x5565('0x2d')],'total':_0x11e42b[_0x5565('0x2e')],'type':_0x11e42b['type'],'unmanaged':_0x11e42b['unmanaged'],'abandoned':_0x11e42b[_0x5565('0x2f')],'waiting':_0x11e42b[_0x5565('0x30')],'loggedInDb':_0x11e42b['loggedInDb'],'dialActive':_0x11e42b[_0x5565('0x31')],'dialMethod':_0x11e42b[_0x5565('0x32')],'dialOriginateCallerIdName':_0x11e42b['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x11e42b[_0x5565('0x33')],'dialOriginateTimeout':_0x11e42b['dialOriginateTimeout'],'dialPrefix':_0x11e42b[_0x5565('0x34')],'outboundAnswerAgiCallsDay':_0x11e42b[_0x5565('0x35')],'outboundAnswerCallsDay':_0x11e42b[_0x5565('0x36')],'outboundBlacklistCallsDay':_0x11e42b[_0x5565('0x37')],'outboundBusyCallsDay':_0x11e42b[_0x5565('0x38')],'outboundCongestionCallsDay':_0x11e42b[_0x5565('0x39')],'outboundDropCallsDayACS':_0x11e42b[_0x5565('0x3a')],'outboundDropCallsDayCallersExit':_0x11e42b[_0x5565('0x3b')],'outboundDropCallsDayTimeout':_0x11e42b[_0x5565('0x3c')],'outboundNoAnswerCallsDay':_0x11e42b['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x11e42b[_0x5565('0x3d')],'outboundOriginateFailureCallsDay':_0x11e42b['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x11e42b['outboundReCallsDay'],'outboundRejectCallsDay':_0x11e42b[_0x5565('0x3e')],'outboundUnknownCallsDay':_0x11e42b['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x11e42b[_0x5565('0x3f')],'predictiveIntervalAnsweredCalls':_0x11e42b[_0x5565('0x40')],'predictiveIntervalAvgHoldtime':_0x11e42b[_0x5565('0x41')],'predictiveIntervalAvgTalktime':_0x11e42b['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x11e42b['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x11e42b[_0x5565('0x42')],'predictiveIntervalErlangCalls':_0x11e42b[_0x5565('0x43')],'predictiveIntervalErlangCallsDroppedCalls':_0x11e42b[_0x5565('0x44')],'predictiveIntervalHitRate':_0x11e42b['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x11e42b['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x11e42b[_0x5565('0x45')],'predictiveIntervalAvailable':_0x11e42b['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x11e42b[_0x5565('0x46')],'message':_0x11e42b['message'],'originated':_0x11e42b[_0x5565('0x47')],'erlangCalls':_0x11e42b['erlangCalls'],'erlangCallToSecond':_0x11e42b['erlangCallToSecond'],'erlangAbandonmentRate':_0x11e42b[_0x5565('0x48')],'erlangBusyFactor':_0x11e42b[_0x5565('0x49')],'startPredictive':_0x11e42b['startPredictive'],'startProgressive':_0x11e42b[_0x5565('0x4a')]};if(_0x11e42b[_0x5565('0x4b')]){_0x25f8c9[_0x5565('0x4b')]={'id':_0x11e42b[_0x5565('0x4b')]['id'],'name':_0x11e42b[_0x5565('0x4b')][_0x5565('0x28')],'active':_0x11e42b[_0x5565('0x4b')][_0x5565('0x4c')],'callerid':_0x11e42b[_0x5565('0x4b')][_0x5565('0x4d')]};}if(_0x11e42b['Interval']){_0x25f8c9[_0x5565('0x4e')]={'id':_0x11e42b[_0x5565('0x4e')]['id'],'name':_0x11e42b['Interval'][_0x5565('0x28')]};}var _0x2480bf=md5(JSON['stringify'](_0x25f8c9));if(_0x11e42b[_0x5565('0x5')]!==_0x2480bf){_0x11e42b[_0x5565('0x5')]=_0x2480bf;emit(util['format']('voice:queue:%s',_0x25f8c9[_0x5565('0x28')]),_0x5565('0x4f'),_0x25f8c9);}}}function emitVoiceQueueChannelRemove(_0x29b2f9){logger[_0x5565('0x50')](_0x5565('0x51'),JSON[_0x5565('0x52')](_0x29b2f9));emit(util[_0x5565('0x53')](_0x5565('0x54'),_0x29b2f9['name']),'voice_queue_channel:remove',_0x29b2f9);this['emit'](_0x5565('0x55'),_0x29b2f9);}function notSendMessagesQueue(_0x16a0f9){if(_0x16a0f9['sendMessageOneNotActive']){if(_0x16a0f9[_0x5565('0x47')]===0x0&&_0x16a0f9['pTalking']===0x0){_0x16a0f9[_0x5565('0x56')]=![];_0x16a0f9['available']=0x0;_0x16a0f9['paused']=0x0;_0x16a0f9[_0x5565('0x57')]=_0x5565('0x58');ut[_0x5565('0x59')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x16a0f9[_0x5565('0x28')]+'\x20is\x20not\x20active');}else{_0x16a0f9[_0x5565('0x57')]='IS_DISACTIVED';ut['logger'](_0x5565('0x5a'),_0x16a0f9['name']+_0x5565('0x5b'));}emitCampaignPreview(_0x16a0f9);}}Preview['prototype']['loopCampaigns']=function(){var _0x269b22=this;setInterval(function(){_0x269b22[_0x5565('0x5c')]();},0x7cf);};Preview[_0x5565('0x5d')][_0x5565('0x5c')]=function(){var _0x1dda95=this[_0x5565('0x12')];this[_0x5565('0x17')]+=0x1;for(var _0x556ef7 in _0x1dda95){if(_0x1dda95[_0x5565('0x5e')](_0x556ef7)&&(_0x1dda95[_0x556ef7][_0x5565('0x32')]===_0x5565('0x5f')||_0x1dda95[_0x556ef7][_0x5565('0x32')]===_0x5565('0x60'))&&_0x1dda95[_0x556ef7][_0x5565('0x61')]===_0x5565('0x27')){if(this[_0x5565('0x17')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x1dda95['hasOwnProperty'](_0x556ef7)&&_0x1dda95[_0x556ef7][_0x5565('0x32')]===_0x5565('0x5f')&&_0x1dda95[_0x556ef7][_0x5565('0x61')]===_0x5565('0x27')){if(_0x1dda95[_0x556ef7]['dialActive']){this[_0x5565('0x62')](_0x1dda95[_0x556ef7]);this[_0x5565('0x63')](_0x1dda95[_0x556ef7]);}else{notSendMessagesQueue(_0x1dda95[_0x556ef7]);}}}};Preview[_0x5565('0x5d')][_0x5565('0x64')]=function(_0x216e4e){var _0x5c9931=this;this[_0x5565('0x65')]['enqueue'](function(){if(!_[_0x5565('0x66')](_0x5c9931[_0x5565('0x15')][_0x216e4e])){loggerAction[_0x5565('0x50')](_0x5565('0x67'),_0x216e4e,_0x5565('0x68'),_0x5c9931[_0x5565('0x15')][_0x216e4e][_0x5565('0x69')],_0x5565('0x6a'),JSON['stringify'](_0x5c9931[_0x5565('0x12')][_0x5c9931[_0x5565('0x15')][_0x216e4e]['queue']][_0x5565('0x47')]),_0x5565('0x6b'),JSON['stringify'](_0x5c9931['campaignsPreview'][_0x5c9931[_0x5565('0x15')][_0x216e4e]['queue']][_0x5565('0x2b')]),JSON[_0x5565('0x52')](_0x5c9931['actions'][_0x216e4e][_0x5565('0x6c')]),JSON['stringify'](_['pick'](_0x5c9931['actions'][_0x216e4e],[_0x5565('0x6d'),_0x5565('0x6e'),_0x5565('0x6f'),'ListId'])));return ami['Action']({'action':_0x5565('0x70'),'channel':_0x5c9931[_0x5565('0x15')][_0x216e4e][_0x5565('0x71')]})[_0x5565('0x72')](function(_0x143472){if(_0x143472['message']===_0x5565('0x73')){setTimeout(function(){if(_0x5c9931['actions'][_0x216e4e]){ut[_0x5565('0x74')](_0x5c9931[_0x5565('0x12')][_0x5c9931[_0x5565('0x15')][_0x216e4e][_0x5565('0x69')]],_0x5565('0x75'));if(_0x5c9931[_0x5565('0x15')][_0x216e4e][_0x5565('0x6c')]===!![]){ut[_0x5565('0x76')](_0x5c9931[_0x5565('0x12')][_0x5c9931[_0x5565('0x15')][_0x216e4e][_0x5565('0x69')]],_0x5565('0x75'));ut[_0x5565('0x77')](_0x5565('0x78')+_0x216e4e,_0x5c9931[_0x5565('0x15')][_0x216e4e][_0x5565('0x69')]);}ut[_0x5565('0x77')](_0x5565('0x79')+_0x216e4e,_0x5c9931[_0x5565('0x15')][_0x216e4e][_0x5565('0x69')]);delete _0x5c9931['actions'][_0x216e4e];}},0x2328);}});}});};Preview[_0x5565('0x5d')][_0x5565('0x7a')]=function(){var _0x2213c9=this;loggerAction[_0x5565('0x50')](_0x5565('0x7b'),_[_0x5565('0x7c')](this['actions']));for(var _0x30f0da in this[_0x5565('0x15')]){if(_0x2213c9[_0x5565('0x15')][_0x5565('0x5e')](_0x30f0da)){_0x2213c9['clearZombieChannel'](_0x30f0da);}}};Preview[_0x5565('0x5d')]['recallMe']=function(_0x1e26af){var _0x3a5e7c=this;rpcDb[_0x5565('0x7d')](_0x1e26af['id'],ut[_0x5565('0x7e')](this[_0x5565('0x16')]))[_0x5565('0x7f')](function(_0x51a5f0){if(!_[_0x5565('0x66')](_0x51a5f0)){for(var _0x2db1e6=0x0;_0x2db1e6<_0x51a5f0[_0x5565('0x80')];_0x2db1e6+=0x1){if(ut[_0x5565('0x81')](_0x51a5f0[_0x2db1e6][_0x5565('0x82')])<_0x1e26af[_0x5565('0x83')]*0x3c){if(_0x51a5f0[_0x2db1e6][_0x5565('0x84')]&&!_0x51a5f0[_0x2db1e6]['Agent'][_0x5565('0x85')]){_0x3a5e7c['run'](_0x51a5f0[_0x2db1e6]['id'])['then'](ut[_0x5565('0x86')]('[RecallMe]'))['catch'](ut[_0x5565('0x86')](_0x5565('0x87')));}else{rpcDb['disableContact'](_0x51a5f0[_0x2db1e6]['id']);}}else{var _0x1e4ee9=new Action(_0x51a5f0[_0x2db1e6],_0x1e26af);_0x1e4ee9[_0x5565('0x88')]=moment()['format'](_0x5565('0x89'));_0x1e26af['outboundReCallsDay']+=0x1;ut[_0x5565('0x8a')](_0x1e4ee9,0x17,_0x5565('0x8b'));if(_0x1e26af[_0x5565('0x8c')]){rpcDb[_0x5565('0x8d')](ut[_0x5565('0x8e')](_0x51a5f0[_0x2db1e6]));rpcDb[_0x5565('0x8f')](_0x1e4ee9,_0x5565('0x90'));}else{ut[_0x5565('0x8a')](_0x1e4ee9,0x16,_0x5565('0x91'));rpcDb['createCustomerHistory'](_0x1e4ee9,_0x5565('0x92'));rpcDb[_0x5565('0x93')](_0x1e4ee9,_0x5565('0x92'));}}}}})['catch'](ut['logger2'](_0x5565('0x94')));};Preview[_0x5565('0x5d')]['setMessage']=function(_0x3288e7){_0x3288e7['sendMessageOneNotActive']=!![];if(ut[_0x5565('0x95')](_0x3288e7[_0x5565('0x2a')])){_0x3288e7[_0x5565('0x57')]=_0x5565('0x96');}else if(!ut[_0x5565('0x97')](_0x3288e7[_0x5565('0x31')])){_0x3288e7[_0x5565('0x57')]=_0x5565('0x58');}else if(!this[_0x5565('0x98')](_0x3288e7['Trunk'])){if(!this[_0x5565('0x98')](_0x3288e7[_0x5565('0x99')])){_0x3288e7[_0x5565('0x57')]='TRUNK_IS_NOT_REACHABLE';}else{_0x3288e7[_0x5565('0x57')]=_0x5565('0x9a');}}else{_0x3288e7[_0x5565('0x57')]='ACTIVE';}emitCampaignPreview(_0x3288e7);};Preview[_0x5565('0x5d')][_0x5565('0x9b')]=function(_0x30aef3,_0x5981e4,_0x163846){var _0xceb74e=this;var _0x36435b=this['actions'][_0x5981e4];var _0x2f8d41=this[_0x5565('0x12')][_0x36435b[_0x5565('0x69')]];var _0x374122;if(_0x2f8d41){switch(_0x163846){case'1':_0x2f8d41[_0x5565('0x3d')]+=0x1;_0x36435b[_0x5565('0x9c')]+=0x1;_0x36435b[_0x5565('0x9d')]=ut[_0x5565('0x9e')](_0x36435b);ut['logCustomer'](_0x36435b,0x0,_0x5565('0x9f'));ami[_0x5565('0x26')](_0x5565('0xa0'),ut[_0x5565('0xa1')](_0x36435b,_0x5565('0xa2')));rpcDb['createCustomerHistory'](_0x36435b,_0x5565('0xa3'));if(ut[_0x5565('0x9e')](_0x36435b)>=_0x2f8d41[_0x5565('0xa4')]){_0x374122=ut[_0x5565('0xa5')](_0x36435b,0xf,_0x5565('0xa6'));rpcDb[_0x5565('0x93')](_0x374122,_0x5565('0xa7'));}else{if(_0x36435b['countnosuchnumberretry']>=_0x2f8d41[_0x5565('0xa8')]){rpcDb[_0x5565('0x93')](_0x36435b,_0x5565('0xa7'));}else{rpcDb['rescheduleContact'](ut[_0x5565('0xa9')](_0x36435b,_0x5565('0x9c'),_0x2f8d41[_0x5565('0xaa')]),_0x36435b['unlockAgent'],_0x36435b[_0x5565('0xab')]);}}delete this[_0x5565('0x15')][_0x30aef3['linkedid']];break;case'ANSWER':var _0x5b77f4=moment()[_0x5565('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x36435b[_0x5565('0xac')]=_0x5b77f4;_0x36435b[_0x5565('0xad')]=_0x5b77f4;_0x36435b[_0x5565('0x6c')]=!![];_0x2f8d41[_0x5565('0x2b')]+=0x1;logger[_0x5565('0x50')]('[syncHangup][talking][increment]',_0x36435b[_0x5565('0xae')],_0x5565('0xaf'),_0x2f8d41[_0x5565('0x28')],'pTalking:\x20',_0x2f8d41[_0x5565('0x2b')]);ami[_0x5565('0x26')](_0x5565('0xb0'),ut[_0x5565('0xa1')](_0x36435b,'connect',this['campaignsPreview'][_0x36435b['queue']]));if(_0x2f8d41[_0x5565('0xb1')]){ami['emit'](_0x5565('0xb2'),ut[_0x5565('0xb3')](_0x36435b));}break;case'16':ami[_0x5565('0x26')](_0x5565('0xb4'),ut[_0x5565('0xa1')](_0x36435b,'complete',this['campaignsPreview'][_0x36435b[_0x5565('0x69')]]));emitVoiceQueueChannelRemove(ut[_0x5565('0xa1')](_0x36435b,_0x5565('0xb5')));_0x2f8d41[_0x5565('0x36')]+=0x1;_0x2f8d41[_0x5565('0x2e')]+=0x1;_0x2f8d41[_0x5565('0x29')]+=0x1;ut[_0x5565('0x76')](_0x2f8d41,_0x5565('0xb6'));_0x36435b['countglobal']=ut[_0x5565('0x9e')](_0x36435b);ut[_0x5565('0x8a')](_0x36435b,0x4,_0x5565('0xb7'));rpcDb[_0x5565('0x8f')](_0x36435b,_0x5565('0xb8'));rpcDb[_0x5565('0x93')](_0x36435b,_0x5565('0xb9'));rpcDb['crateCustomerReportQueue'](_0x36435b);_0x2f8d41[_0x5565('0xba')]+=_0x36435b[_0x5565('0xbb')];_0x2f8d41[_0x5565('0xbc')]+=_0x36435b[_0x5565('0xbb')];logger[_0x5565('0x50')](_0x5565('0xbd'),_0x36435b[_0x5565('0xae')],_0x5565('0xaf'),_0x2f8d41[_0x5565('0x28')],_0x5565('0x6b'),_0x2f8d41[_0x5565('0x2b')]);delete this['actions'][_0x30aef3[_0x5565('0xbe')]];break;case _0x5565('0xbf'):_0x2f8d41['outboundBusyCallsDay']+=0x1;_0x36435b[_0x5565('0xc0')]+=0x1;_0x36435b[_0x5565('0x9d')]=ut[_0x5565('0x9e')](_0x36435b);ut[_0x5565('0x8a')](_0x36435b,0x5,'Busy');ami[_0x5565('0x26')](_0x5565('0xc1'),ut['buildObj'](_0x36435b,_0x5565('0xc2')));rpcDb[_0x5565('0x8f')](_0x36435b,_0x5565('0xc3'));if(ut[_0x5565('0x9e')](_0x36435b)>=_0x2f8d41['dialGlobalMaxRetry']){_0x374122=ut[_0x5565('0xa5')](_0x36435b,0xf,_0x5565('0xa6'));rpcDb[_0x5565('0x93')](_0x374122,_0x5565('0xc4'));}else{if(_0x36435b['countbusyretry']>=_0x2f8d41[_0x5565('0xc5')]){rpcDb['createCustomerFinal'](_0x36435b,_0x5565('0xc3'));}else{rpcDb[_0x5565('0xc6')](ut[_0x5565('0xa9')](_0x36435b,'countbusyretry',_0x2f8d41['dialBusyRetryFrequency']),_0x36435b[_0x5565('0xc7')],_0x36435b[_0x5565('0xab')]);}}break;case'NOANSWER':_0x2f8d41['outboundNoAnswerCallsDay']+=0x1;_0x36435b[_0x5565('0xc8')]+=0x1;_0x36435b[_0x5565('0x9d')]=ut[_0x5565('0x9e')](_0x36435b);ut[_0x5565('0x8a')](_0x36435b,0x3,_0x5565('0xc9'));ami[_0x5565('0x26')](_0x5565('0xca'),ut['buildObj'](_0x36435b,_0x5565('0xcb')));rpcDb[_0x5565('0x8f')](_0x36435b,_0x5565('0xcc'));if(ut['totalGlobal'](_0x36435b)>=_0x2f8d41['dialGlobalMaxRetry']){_0x374122=ut[_0x5565('0xa5')](_0x36435b,0xf,'Global');rpcDb[_0x5565('0x93')](_0x374122,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x36435b[_0x5565('0xc8')]>=_0x2f8d41[_0x5565('0xcd')]){rpcDb[_0x5565('0x93')](_0x36435b,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb['rescheduleContact'](ut[_0x5565('0xa9')](_0x36435b,_0x5565('0xc8'),_0x2f8d41['dialNoAnswerRetryFrequency']),_0x36435b['unlockAgent'],_0x36435b[_0x5565('0xab')]);}}break;case _0x5565('0xce'):_0x2f8d41[_0x5565('0x39')]+=0x1;_0x36435b[_0x5565('0xcf')]+=0x1;_0x36435b[_0x5565('0x9d')]=ut[_0x5565('0x9e')](_0x36435b);ut[_0x5565('0x8a')](_0x36435b,0x8,'Congestion');ami['emit'](_0x5565('0xd0'),ut[_0x5565('0xa1')](_0x36435b,_0x5565('0xd1')));rpcDb[_0x5565('0x8f')](_0x36435b,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x5565('0x9e')](_0x36435b)>=_0x2f8d41[_0x5565('0xa4')]){_0x374122=ut[_0x5565('0xa5')](_0x36435b,0xf,_0x5565('0xa6'));rpcDb[_0x5565('0x93')](_0x374122,_0x5565('0xd2'));}else{if(_0x36435b[_0x5565('0xcf')]>=_0x2f8d41[_0x5565('0xd3')]){rpcDb['createCustomerFinal'](_0x36435b,_0x5565('0xd4'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x36435b,_0x5565('0xcf'),_0x2f8d41['dialBusyRetryFrequency']),_0x36435b['unlockAgent'],_0x36435b[_0x5565('0xab')]);}}break;case _0x5565('0xd5'):_0x2f8d41[_0x5565('0x3e')]+=0x1;_0x36435b[_0x5565('0xd6')]+=0x1;_0x36435b[_0x5565('0x9d')]=ut[_0x5565('0x9e')](_0x36435b);ut[_0x5565('0x8a')](_0x36435b,0x14,_0x5565('0xd7'));ami[_0x5565('0x26')](_0x5565('0xd8'),ut['buildObj'](_0x36435b,'agentreject'));rpcDb[_0x5565('0x8f')](_0x36435b,_0x5565('0xd9'));if(ut[_0x5565('0x9e')](_0x36435b)>=_0x2f8d41[_0x5565('0xa4')]){_0x374122=ut['cloneAction'](_0x36435b,0x14,_0x5565('0xd7'));rpcDb['createCustomerFinal'](_0x374122,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x36435b[_0x5565('0xd6')]>=_0x2f8d41[_0x5565('0xda')]){rpcDb['createCustomerFinal'](_0x36435b,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x5565('0xc6')](ut[_0x5565('0xa9')](_0x36435b,'countagentrejectretry',_0x2f8d41[_0x5565('0xdb')]),_0x36435b[_0x5565('0xc7')],_0x36435b[_0x5565('0xab')]);}}break;case _0x5565('0xdc'):_0x2f8d41['outboundAbandonedCallsDay']+=0x1;_0x36435b[_0x5565('0xdd')]+=0x1;_0x36435b[_0x5565('0x9d')]=ut['totalGlobal'](_0x36435b);ut[_0x5565('0x8a')](_0x36435b,0xb,'Abandoned');rpcDb[_0x5565('0x8f')](_0x36435b,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x5565('0x9e')](_0x36435b)>=_0x2f8d41[_0x5565('0xa4')]){_0x374122=ut[_0x5565('0xa5')](_0x36435b,0xf,_0x5565('0xa6'));rpcDb[_0x5565('0x93')](_0x374122,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x36435b[_0x5565('0xde')]>=_0x2f8d41[_0x5565('0xdf')]){rpcDb[_0x5565('0x93')](_0x36435b,_0x5565('0xe0'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x36435b,_0x5565('0xdd'),_0x2f8d41[_0x5565('0xe1')]),_0x36435b[_0x5565('0xc7')],_0x36435b[_0x5565('0xab')]);}}break;default:if(_0x36435b['dialAnswer']){ut[_0x5565('0x76')](_0x2f8d41,_0x5565('0xe2'));ut[_0x5565('0x77')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x2f8d41[_0x5565('0x28')],_0x30aef3);}_0x2f8d41[_0x5565('0xe3')]+=0x1;_0x36435b[_0x5565('0x9d')]=ut[_0x5565('0x9e')](_0x36435b);ut['logCustomer'](_0x36435b,0xc,_0x30aef3[_0x5565('0xe4')]||_0x30aef3[_0x5565('0xe5')]);rpcDb[_0x5565('0x8f')](_0x36435b,_0x5565('0xe6'));if(ut[_0x5565('0x9e')](_0x36435b)>=_0x2f8d41[_0x5565('0xa4')]){_0x374122=ut[_0x5565('0xa5')](_0x36435b,0xf,_0x5565('0xa6'));rpcDb[_0x5565('0x93')](_0x374122,_0x5565('0xe7'));}else{rpcDb[_0x5565('0x93')](_0x36435b,_0x5565('0xe7'));}delete this[_0x5565('0x15')][_0x30aef3['linkedid']];}if(!(_0x36435b[_0x5565('0x6c')]&&_0x163846==='16')){ut[_0x5565('0x74')](_0x2f8d41,_0x5565('0xe8'));logger[_0x5565('0x50')](_0x5565('0xe9'),_0x36435b[_0x5565('0xae')],_0x5565('0xaf'),_0x2f8d41[_0x5565('0x28')],'originated:\x20',_0x2f8d41[_0x5565('0x47')]);}if(_0x163846!=='ANSWER'){delete this['actions'][_0x30aef3[_0x5565('0xbe')]];delete this['actions'][_0x30aef3[_0x5565('0xea')]];}}};Preview[_0x5565('0x5d')][_0x5565('0xeb')]=function(_0x2c9e51,_0x3a740f,_0xd14d62){if(_['isUndefined'](_0x3a740f)&&'object'!==typeof _0x3a740f){return;}if(_['isUndefined'](_0xd14d62)&&'object'!==typeof _0xd14d62){return;}switch(_0xd14d62['reason']){case'0':ut['logAgent'](_0x2c9e51,0x0,_0x5565('0x9f'));rpcDb['createAgentHistory'](_0x2c9e51,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x5565('0xec')](_0x2c9e51,0x3,'NoAnswer');rpcDb[_0x5565('0xed')](_0x2c9e51,_0x5565('0xee'));break;case'5':ut[_0x5565('0xec')](_0x2c9e51,0x5,_0x5565('0xef'));rpcDb[_0x5565('0xed')](_0x2c9e51,_0x5565('0xf0'));break;case'8':ut[_0x5565('0xec')](_0x2c9e51,0x8,_0x5565('0xf1'));rpcDb['createAgentHistory'](_0x2c9e51,_0x5565('0xf2'));break;case'22':ut['logAgent'](_0x2c9e51,0x16,_0x5565('0xf3'));rpcDb['createAgentHistory'](_0x2c9e51,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x5565('0xec')](_0x2c9e51,0xc,_0xd14d62['reason']);rpcDb[_0x5565('0xed')](_0x2c9e51,_0x5565('0xf2'));}ut['updateOriginated'](_0x3a740f,_0x5565('0xf4'));logger[_0x5565('0x50')](_0x5565('0xf5'),_0x2c9e51[_0x5565('0xae')],'\x20Queue',_0x3a740f[_0x5565('0x28')],_0x5565('0x6a'),_0x3a740f[_0x5565('0x47')]);delete this[_0x5565('0x15')][_0x2c9e51['uniqueid']];};Preview[_0x5565('0x5d')][_0x5565('0xf6')]=function(_0xaff99b,_0x313244,_0x56ad33,_0x588d21,_0x13764b){var _0x25ddc5=this;return new BPromise(function(_0x25f4a0,_0x5bb66c){if(_[_0x5565('0x66')](_0x313244)||_[_0x5565('0x66')](_0x313244['Contact'])||_[_0x5565('0x66')](_0x313244[_0x5565('0xf7')][_0x5565('0xf8')])||_[_0x5565('0x66')](_0x313244[_0x5565('0x6f')])){_0x5bb66c(ut[_0x5565('0x57')](_0x5565('0xf9'),_0x588d21,_0x13764b));return;}var _0x32def6=uuid['v4']();var _0x228b0b=_0x25ddc5['campaignsPreview'][_0x313244[_0x5565('0x68')][_0x5565('0x28')]];var _0x577840=_0x56ad33?_0x25ddc5[_0x5565('0x16')][_0x56ad33]['id']:undefined;_0x25ddc5[_0x5565('0x15')][_0x32def6]=new Action(_0x313244,_0x228b0b,_0x32def6,_0x56ad33,_0x577840);var _0x1e14da=_0x25ddc5[_0x5565('0x15')][_0x32def6];_0x1e14da['unlockAgent']=_0x588d21;_0x1e14da[_0x5565('0xab')]=_0x13764b;_0x1e14da[_0x5565('0xfa')]=_0x56ad33;if(_[_0x5565('0xfb')](_0xaff99b)){_0x25ddc5[_0x5565('0xfc')](_0x1e14da,_0x228b0b,_0x313244,_0x56ad33)[_0x5565('0x7f')](function(_0x2b781b){logger[_0x5565('0x50')](_0x5565('0xfd'),_0x5565('0xfe')+_0x1e14da[_0x5565('0x69')]+_0x5565('0xff')+_0x1e14da[_0x5565('0x100')],JSON[_0x5565('0x52')](_0x2b781b));ami[_0x5565('0x26')](_0x5565('0x101'),ut[_0x5565('0xa1')](_0x1e14da,_0x5565('0x102'),_0x25ddc5['campaignsPreview'][_0x1e14da[_0x5565('0x69')]]));_0x25f4a0(ut[_0x5565('0x57')](_0x5565('0x103')));})[_0x5565('0x72')](function(_0x491017){ut[_0x5565('0x59')](_0x5565('0x104'),_0x491017);_0x5bb66c(ut['message'](_0x5565('0x105'),_0x588d21,_0x13764b));});}else{_0x228b0b[_0x5565('0x37')]+=0x1;ut[_0x5565('0x106')](_0x1e14da);rpcDb[_0x5565('0x107')](_0x1e14da,'[Blacklist][error]');delete _0x25ddc5[_0x5565('0x15')][_0x32def6];_0x5bb66c(ut[_0x5565('0x57')]('Contact\x20in\x20black\x20List',_0x588d21,_0x13764b));}});};Preview[_0x5565('0x5d')][_0x5565('0x98')]=function(_0x389a97){return!_[_0x5565('0x66')](_0x389a97)&&!_[_0x5565('0x66')](_0x389a97[_0x5565('0x28')])&&!_[_0x5565('0x66')](_0x389a97[_0x5565('0x4c')])&&_0x389a97['active']&&!_[_0x5565('0x66')](this[_0x5565('0x14')][util[_0x5565('0x53')](_0x5565('0x108'),_0x389a97[_0x5565('0x28')])])&&!_[_0x5565('0x66')](this[_0x5565('0x14')][util[_0x5565('0x53')](_0x5565('0x108'),_0x389a97[_0x5565('0x28')])][_0x5565('0x70')])&&(this[_0x5565('0x14')][util[_0x5565('0x53')](_0x5565('0x108'),_0x389a97[_0x5565('0x28')])]['status']==='reachable'||this[_0x5565('0x14')][util[_0x5565('0x53')](_0x5565('0x108'),_0x389a97[_0x5565('0x28')])][_0x5565('0x70')]===_0x5565('0x109'));};Preview['prototype'][_0x5565('0x10a')]=function(_0x274ad2,_0x5b3c04){var _0x33dfc1=this;return new BPromise(function(_0xecbd65,_0x178e05){_0x33dfc1[_0x5565('0x10b')](_0x274ad2,_0x5b3c04)[_0x5565('0x7f')](function(_0xd32387){_0xecbd65(_[_0x5565('0x10c')](_0xd32387,[_0x5565('0x57')]));})[_0x5565('0x72')](function(_0x25928b){if(_0x25928b[_0x5565('0x10d')]){rpcDb[_0x5565('0x10e')](_0x274ad2);}if(_0x25928b[_0x5565('0x4c')]){rpcDb['disableContact'](_0x274ad2);}_0x178e05(_[_0x5565('0x10c')](_0x25928b,['message']));});});};Preview[_0x5565('0x5d')][_0x5565('0x10b')]=function(_0xa107dd,_0x8c7c1d){var _0x191772=this;return new BPromise(function(_0x2502f9,_0x9bc0d3){var _0x1d1683,_0x496fc1;rpcDb[_0x5565('0x10f')](_0xa107dd)[_0x5565('0x7f')](function(_0x119782){if(!_[_0x5565('0x66')](_0x119782[0x0])){_0x496fc1=_0x119782[0x0][_0x5565('0x110')]?![]:!![];_0x1d1683=_0x119782[0x0][_0x5565('0x110')]?!![]:![];_0x1d1683=_0x8c7c1d?!![]:_0x1d1683;}var _0x2dfc59=_0x191772[_0x5565('0x111')](_0x119782);if(_0x2dfc59[_0x5565('0x112')]){rpcDb[_0x5565('0x113')](_[_0x5565('0x10c')](_0x119782[0x0],[_0x5565('0x6f'),_0x5565('0x114')]))[_0x5565('0x7f')](function(_0x5704ee){_0x191772[_0x5565('0xf6')](_0x5704ee,_0x119782[0x0],_0x8c7c1d,_0x496fc1,_0x1d1683)['then'](function(_0x1d149e){_0x2502f9(_0x1d149e);})[_0x5565('0x72')](function(_0x47b311){_0x9bc0d3(_0x47b311);});})['catch'](function(_0x48c77a){ut[_0x5565('0x59')]('[Preview][checkIsBlackList]',_0x48c77a);_0x9bc0d3(ut['message'](_0x5565('0x115'),_0x496fc1,_0x1d1683));});}else{_0x9bc0d3(ut[_0x5565('0x57')](_0x2dfc59[_0x5565('0x57')],_0x496fc1,_0x1d1683));}})[_0x5565('0x72')](function(_0x167580){ut[_0x5565('0x59')](_0x5565('0x116'),_0x167580);_0x9bc0d3(ut['message']('Call\x20unsuccessful',![],!![]));});});};Preview['prototype'][_0x5565('0x111')]=function(_0x456d63){if(_[_0x5565('0x66')](_0x456d63)||_[_0x5565('0xfb')](_0x456d63)||!_[_0x5565('0x66')](_0x456d63[0x0][_0x5565('0x84')])&&_[_0x5565('0x66')](_0x456d63[0x0][_0x5565('0x84')][_0x5565('0x28')])){ut[_0x5565('0x59')](_0x5565('0x117'),_0x456d63);return{'isValid':![],'message':_0x5565('0x118')};}var _0x5700ee=this[_0x5565('0x12')][_0x456d63[0x0][_0x5565('0x68')][_0x5565('0x28')]];_0x5700ee[_0x5565('0x57')]=_0x5565('0x9a');if(_[_0x5565('0x66')](_0x5700ee)){ut[_0x5565('0x59')](_0x5565('0x119'),_0x5700ee);return{'isValid':![],'message':_0x5565('0x11a')};}if(!this[_0x5565('0x98')](_0x5700ee[_0x5565('0x4b')])){ut[_0x5565('0x59')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x5565('0x11b')+_0x5700ee[_0x5565('0x28')]+_0x5565('0x11c'));if(!this['isTrunkReachable'](_0x5700ee[_0x5565('0x99')])){ut['logger'](_0x5565('0x11d'),_0x5700ee[_0x5565('0x28')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x5565('0x11e')};}}if(!ut[_0x5565('0x97')](_0x5700ee[_0x5565('0x31')])){ut[_0x5565('0x59')](_0x5565('0x11f'),_0x5700ee[_0x5565('0x28')]+_0x5565('0x120'));return{'isValid':![],'message':_0x5565('0x11b')+_0x5700ee[_0x5565('0x28')]+_0x5565('0x120')};}return{'isValid':!![],'message':_0x5565('0x121')};};Preview['prototype'][_0x5565('0xfc')]=function(_0x269af0,_0x31a448,_0x428a1d,_0x4ec859){var _0x488787=this;return new BPromise(function(_0x5c9ca1,_0x900282){var _0x3e0550=_0x269af0[_0x5565('0xae')];var _0x2161a2=_0x488787[_0x5565('0x98')](_0x31a448[_0x5565('0x4b')])?util['format'](_0x5565('0x122'),_0x31a448['Trunk'][_0x5565('0x28')],_['isNil'](_0x31a448[_0x5565('0x34')])?'':_0x31a448[_0x5565('0x34')][_0x5565('0x123')]()||'',_0x31a448[_0x5565('0x124')]>0x0?_0x428a1d[_0x5565('0xf7')][_0x5565('0xf8')][_0x5565('0x125')](_0x31a448[_0x5565('0x124')]):_0x428a1d[_0x5565('0xf7')][_0x5565('0xf8')]):util[_0x5565('0x53')](_0x5565('0x122'),_[_0x5565('0x66')](_0x31a448[_0x5565('0x99')])?_0x31a448['Trunk'][_0x5565('0x28')]:_0x31a448[_0x5565('0x99')]['name'],_[_0x5565('0x66')](_0x31a448[_0x5565('0x34')])?'':_0x31a448[_0x5565('0x34')][_0x5565('0x123')]()||'',_0x31a448[_0x5565('0x124')]>0x0?_0x428a1d['Contact'][_0x5565('0xf8')][_0x5565('0x125')](_0x31a448[_0x5565('0x124')]):_0x428a1d[_0x5565('0xf7')]['phone']);var _0x405df9=_0x488787[_0x5565('0x98')](_0x31a448[_0x5565('0x4b')])?ut['getCallerId'](_0x31a448[_0x5565('0x4b')][_0x5565('0x4d')],_0x31a448['dialOriginateCallerIdName'],_0x31a448[_0x5565('0x126')]>0x0?ut[_0x5565('0x127')](_0x31a448[_0x5565('0x33')],_0x31a448[_0x5565('0x126')]):_0x31a448['dialOriginateCallerIdNumber']):ut[_0x5565('0x128')](_[_0x5565('0x66')](_0x31a448[_0x5565('0x99')])?_0x31a448['Trunk'][_0x5565('0x4d')]:_0x31a448['TrunkBackup'][_0x5565('0x4d')],_0x31a448[_0x5565('0x129')],_0x31a448[_0x5565('0x126')]>0x0?ut[_0x5565('0x127')](_0x31a448['dialOriginateCallerIdNumber'],_0x31a448[_0x5565('0x126')]):_0x31a448[_0x5565('0x33')]);if(_0x405df9){_0x269af0[_0x5565('0x12a')]=ut[_0x5565('0x12b')](_0x405df9);_0x269af0[_0x5565('0x12c')]=ut[_0x5565('0x12d')](_0x405df9);}var _0x4bed05=ut[_0x5565('0x12e')](_0x31a448,_0x428a1d,_0x2161a2,_0x405df9,_0x3e0550,_0x269af0);_[_0x5565('0x12f')](_0x269af0,ut['toLowerVariables'](_0x4bed05));_0x269af0[_0x5565('0x88')]=moment()[_0x5565('0x53')](_0x5565('0x89'));ami[_0x5565('0x130')](ut[_0x5565('0x131')](_0x269af0,_0x31a448,_0x4bed05,_0x269af0[_0x5565('0xab')],_0x4ec859))[_0x5565('0x7f')](function(_0x2c1507){_0x31a448['originated']+=0x1;logger[_0x5565('0x50')]('[originated][increment]',_0x3e0550,_0x5565('0xaf'),_0x31a448['name'],_0x5565('0x6a'),_0x31a448[_0x5565('0x47')]);_0x5c9ca1(_0x2c1507);})[_0x5565('0x72')](function(_0x5f07de){ut['logAgent'](_0x269af0,0xe,'OriginateError');rpcDb[_0x5565('0xed')](_0x269af0,_0x5565('0x132'));_0x900282(_0x5f07de);});});};Preview[_0x5565('0x5d')][_0x5565('0x20')]=function(_0x5d96f2){if(this[_0x5565('0x15')][_0x5d96f2['linkedid']]){this[_0x5565('0x15')][_0x5d96f2[_0x5565('0xbe')]]['channel']=_0x5d96f2[_0x5565('0x71')];}};Preview[_0x5565('0x5d')][_0x5565('0x18')]=function(_0x254442){var _0x37a4cb=this;var _0x3549ad=this[_0x5565('0x15')][_0x254442[_0x5565('0x133')]];if(_0x3549ad){if(_0x3549ad[_0x5565('0xfa')]&&this[_0x5565('0x16')][_0x3549ad[_0x5565('0xfa')]]){ut[_0x5565('0x134')](_0x3549ad,this['agents'][_0x3549ad['lookAgent']][_0x5565('0x28')],this[_0x5565('0x16')][_0x3549ad[_0x5565('0xfa')]]['id']);}var _0x16c29d=_[_0x5565('0x135')](_0x3549ad);_0x16c29d['responsetime']=moment()[_0x5565('0x53')](_0x5565('0x89'));var _0x481460=_0x37a4cb[_0x5565('0x12')][_0x3549ad[_0x5565('0x69')]];if(ut[_0x5565('0x136')](_0x254442[_0x5565('0x137')])){if(_0x3549ad[_0x5565('0xc7')]){rpcDb[_0x5565('0x10e')](_0x3549ad[_0x5565('0x100')]);}if(_0x3549ad[_0x5565('0xab')]){rpcDb['disableContact'](_0x3549ad[_0x5565('0x100')]);}ami[_0x5565('0x26')](_0x5565('0x138'),ut[_0x5565('0xa1')](_0x3549ad,_0x5565('0x139'),this[_0x5565('0x12')][_0x3549ad[_0x5565('0x69')]]));this[_0x5565('0xeb')](_0x16c29d,_0x481460,_0x254442);}else{_0x3549ad[_0x5565('0x88')]=moment()[_0x5565('0x53')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x5565('0xec')](_0x16c29d,0x4,_0x5565('0xb7'));rpcDb[_0x5565('0xed')](_0x16c29d,_0x5565('0x13a'));}}};Preview[_0x5565('0x5d')]['syncHangup']=function(_0x49bc8f){var _0x4b565b=this;var _0x5085ee=this['actions'][_0x49bc8f[_0x5565('0xbe')]];var _0x16e264;if(_0x5085ee){_0x16e264=this['campaignsPreview'][_0x5085ee['queue']];logger['info']('[syncHangup][talking]',_0x49bc8f[_0x5565('0xbe')],_0x5565('0xaf'),_0x16e264[_0x5565('0x28')],_0x5565('0x6b'),_0x16e264[_0x5565('0x2b')]);}if(this[_0x5565('0x15')][_0x49bc8f['linkedid']]&&_0x49bc8f['linkedid']!==_0x49bc8f['uniqueid']){if(_0x49bc8f['cause']==='16'&&this[_0x5565('0x15')][_0x49bc8f[_0x5565('0xbe')]]['dialAnswer']){this[_0x5565('0x9b')](_0x49bc8f,_0x49bc8f[_0x5565('0xbe')],_0x49bc8f[_0x5565('0x13b')]);}else if(this['actions'][_0x49bc8f[_0x5565('0xbe')]][_0x5565('0x6c')]){logger['info'](_0x5565('0x13c'),_0x49bc8f[_0x5565('0xbe')],_0x49bc8f[_0x5565('0x13b')],_0x5565('0xaf'),_0x16e264['name'],'pTalking:\x20',_0x16e264[_0x5565('0x2b')]);this[_0x5565('0x9b')](_0x49bc8f,_0x49bc8f[_0x5565('0xbe')],_0x49bc8f[_0x5565('0x13b')]);}}else if(_0x5085ee&&_[_0x5565('0x66')](_0x5085ee[_0x5565('0x13d')])&&_0x16e264[_0x5565('0x13e')]&&_0x49bc8f[_0x5565('0xbe')]===_0x49bc8f[_0x5565('0xae')]&&_[_0x5565('0x66')](_0x49bc8f[_0x5565('0x13f')])&&_0x49bc8f[_0x5565('0x13b')]==='16'&&_0x49bc8f[_0x5565('0x140')]==='6'&&_['isUndefined'](_0x5085ee[_0x5565('0x141')])){if(_0x5085ee['unlockAgent']){rpcDb[_0x5565('0x10e')](_0x5085ee[_0x5565('0x100')]);}if(_0x5085ee[_0x5565('0xab')]){rpcDb[_0x5565('0x142')](_0x5085ee[_0x5565('0x100')]);}_0x49bc8f['reason']='22';this[_0x5565('0xeb')](_0x5085ee,_0x16e264,_0x49bc8f);}else if(_0x5085ee&&_0x5085ee[_0x5565('0x141')]){if(_0x49bc8f[_0x5565('0x13b')]==='16'&&this['actions'][_0x49bc8f[_0x5565('0xbe')]][_0x5565('0x6c')]){logger[_0x5565('0x50')](_0x5565('0x143'),_0x49bc8f[_0x5565('0xbe')],_0x49bc8f[_0x5565('0x13b')],_0x5565('0xaf'),_0x16e264[_0x5565('0x28')],_0x5565('0x6b'),_0x16e264[_0x5565('0x2b')]);this[_0x5565('0x9b')](_0x49bc8f,_0x49bc8f[_0x5565('0xbe')],_0x49bc8f[_0x5565('0x13b')]);}else if(this['actions'][_0x49bc8f[_0x5565('0xbe')]][_0x5565('0x6c')]){logger[_0x5565('0x50')](_0x5565('0x13c'),_0x49bc8f['linkedid'],_0x49bc8f[_0x5565('0x13b')],'\x20Queue',_0x16e264[_0x5565('0x28')],_0x5565('0x6b'),_0x16e264[_0x5565('0x2b')]);this[_0x5565('0x9b')](_0x49bc8f,_0x49bc8f[_0x5565('0xbe')],_0x49bc8f['cause']);}}};Preview[_0x5565('0x5d')][_0x5565('0x1f')]=function(_0x4450cb){if(this[_0x5565('0x15')][_0x4450cb[_0x5565('0xea')]]&&_0x4450cb[_0x5565('0xea')]!==_0x4450cb[_0x5565('0x144')]){this[_0x5565('0x9b')](_0x4450cb,_0x4450cb['destlinkedid'],_0x4450cb['dialstatus']);}};Preview[_0x5565('0x5d')][_0x5565('0x1d')]=function(_0x34c240){if(this[_0x5565('0x15')][_0x34c240[_0x5565('0xbe')]]&&_0x34c240[_0x5565('0xbe')]!==_0x34c240[_0x5565('0xae')]&&!this['actions'][_0x34c240['linkedid']]['dialAnswer']){if(_0x34c240[_0x5565('0x13b')]==='1'){this[_0x5565('0x9b')](_0x34c240,_0x34c240[_0x5565('0xbe')],_0x34c240[_0x5565('0x13b')]);}}};Preview['prototype']['addVariable']=function(_0x25362d,_0x1eeacf,_0x2c4eb6){if(this[_0x5565('0x15')][_0x25362d]){if(_['isNil'](this[_0x5565('0x15')][_0x25362d]['variables'])){this[_0x5565('0x15')][_0x25362d][_0x5565('0x145')]={};}this[_0x5565('0x15')][_0x25362d][_0x5565('0x145')][_0x1eeacf]=_0x2c4eb6;}};Preview[_0x5565('0x5d')][_0x5565('0x21')]=function(_0xeacf41){try{if(!_[_0x5565('0x66')](_0xeacf41)){if(ut[_0x5565('0x146')](_[_0x5565('0x147')](_0xeacf41[_0x5565('0x148')])[0x0])){this[_0x5565('0x149')](_0xeacf41[_0x5565('0xae')],_[_0x5565('0x147')](_0xeacf41['variable'])[0x0],_0xeacf41[_0x5565('0x14a')]);}}}catch(_0x53a45f){logger[_0x5565('0x14b')](_0x5565('0x14c'),util[_0x5565('0x14d')](_0x53a45f,{'showHidden':![],'depth':null}));}};Preview[_0x5565('0x5d')]['syncAttendedTransfer']=function(_0xd5d48e){if(_0xd5d48e){if(this['actions'][_0xd5d48e[_0x5565('0x14e')]]){this[_0x5565('0x15')][_0xd5d48e[_0x5565('0x14e')]][_0x5565('0x141')]=!![];}}};Preview[_0x5565('0x5d')][_0x5565('0x24')]=function(_0x384bd0){if(_0x384bd0){if(this[_0x5565('0x15')][_0x384bd0[_0x5565('0x14f')]]){this['actions'][_0x384bd0[_0x5565('0x14f')]][_0x5565('0x141')]=!![];}}};module[_0x5565('0x150')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 109490f..58da8ac 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 _0x2123=['rescheduleContactInQueue','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','endtime','context','exten','xcally-motion-preview','holdtime','lastAssignedTo','membername','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x2123,0x190));var _0x3212=function(_0x4145f9,_0x2872e7){_0x4145f9=_0x4145f9-0x0;var _0x27cd33=_0x2123[_0x4145f9];return _0x27cd33;};'use strict';var util=require(_0x3212('0x0'));var BPromise=require(_0x3212('0x1'));var logger=require(_0x3212('0x2'))(_0x3212('0x3'));var _=require(_0x3212('0x4'));var cmHopper=require(_0x3212('0x5'));var cmHopperFinal=require(_0x3212('0x6'));var cmHopperHistory=require(_0x3212('0x7'));var cmHopperBlack=require(_0x3212('0x8'));var voiceQueueRt=require(_0x3212('0x9'));var agentReportPreview=require(_0x3212('0xa'));var voiceQueueReport=require(_0x3212('0xb'));function loggerCatch(_0x5d9d36){return function(_0x3859e4){logger[_0x3212('0xc')](_0x5d9d36,util[_0x3212('0xd')](_0x3859e4,{'showHidden':![],'depth':null}));};}function create(_0x4b35e9){return BPromise[_0x3212('0xe')]()['then'](cmHopperHistory[_0x3212('0xf')](_0x4b35e9))[_0x3212('0x10')](loggerCatch(_0x3212('0x11')));}function createAgent(_0x1db498){return BPromise['resolve']()['then'](agentReportPreview[_0x3212('0xf')](_0x1db498))[_0x3212('0x10')](loggerCatch(_0x3212('0x11')));}function moveContact(_0x23f7e3){return BPromise[_0x3212('0xe')]()[_0x3212('0x12')](cmHopper[_0x3212('0x13')](_0x23f7e3,!![]))[_0x3212('0x10')](loggerCatch(_0x3212('0x14')));}exports[_0x3212('0x15')]=function(_0x40745f){return BPromise[_0x3212('0xe')]()[_0x3212('0x12')](cmHopperBlack[_0x3212('0x15')](_0x40745f))[_0x3212('0x10')](loggerCatch(_0x3212('0x16')));};exports[_0x3212('0x17')]=function(_0x1bfe20){return BPromise[_0x3212('0xe')]()[_0x3212('0x12')](cmHopper[_0x3212('0x17')](_0x1bfe20))[_0x3212('0x10')](loggerCatch('[getContactPreview]\x20'));};exports[_0x3212('0xf')]=function(_0x1719a5,_0x2720c6){create(_0x1719a5)[_0x3212('0x10')](loggerCatch(_0x2720c6));moveContact(_0x1719a5)[_0x3212('0x10')](loggerCatch(_0x2720c6));};exports[_0x3212('0x18')]=function(_0x21954a,_0x5b952f){createAgent(_0x21954a)['catch'](loggerCatch(_0x5b952f));};exports[_0x3212('0x19')]=function(_0x49f5c2,_0x2380e8){create(_0x49f5c2)[_0x3212('0x10')](loggerCatch(_0x2380e8));};exports[_0x3212('0x1a')]=function(_0x28a4cd,_0x27ccad){moveContact(_0x28a4cd)['catch'](loggerCatch(_0x27ccad));};exports[_0x3212('0x1b')]=function(_0x462094,_0x49c598,_0x459b55){if(_0x49c598){_0x462094[_0x3212('0x1c')]=null;}if(_0x459b55){_0x462094[_0x3212('0x1d')]=![];}return BPromise['resolve']()['then'](cmHopper[_0x3212('0x1b')](_0x462094))[_0x3212('0x10')](loggerCatch(_0x3212('0x1e')));};exports[_0x3212('0x1f')]=function(_0x3ceb3c){return BPromise[_0x3212('0xe')]()['then'](cmHopper['countReScheduled'](_0x3ceb3c))[_0x3212('0x10')](loggerCatch('[countReScheduled]\x20'));};exports[_0x3212('0x20')]=function(_0x3108a6){return BPromise[_0x3212('0xe')]()['then'](cmHopper[_0x3212('0x20')]({'UserId':null},_0x3108a6,0x1))[_0x3212('0x10')](loggerCatch(_0x3212('0x21')));};exports['disableContact']=function(_0x206980){return BPromise[_0x3212('0xe')]()[_0x3212('0x12')](cmHopper[_0x3212('0x20')]({'active':![]},_0x206980,0x1))[_0x3212('0x10')](loggerCatch(_0x3212('0x22')));};exports[_0x3212('0x23')]=function(_0x3813a3){var _0x1de338={};_0x1de338[_0x3212('0x24')]=_0x3813a3[_0x3212('0x24')];_0x1de338[_0x3212('0x25')]=_0x3813a3['uniqueid'];_0x1de338[_0x3212('0x26')]=_0x3813a3[_0x3212('0x26')];_0x1de338[_0x3212('0x27')]=_0x3813a3[_0x3212('0x27')];_0x1de338[_0x3212('0x28')]=_0x3813a3[_0x3212('0x28')];_0x1de338[_0x3212('0x29')]=_0x3813a3['answertime'];_0x1de338[_0x3212('0x2a')]=_0x3813a3['answertime'];_0x1de338[_0x3212('0x2b')]=0x1;_0x1de338['queuecallercompleteAt']=_0x3813a3[_0x3212('0x2c')];_0x1de338['connectedlinename']=_0x3813a3['membername'];_0x1de338[_0x3212('0x2d')]='from-sip';_0x1de338[_0x3212('0x2e')]=_0x3212('0x2f');_0x1de338[_0x3212('0x30')]=0x0;_0x1de338['assigned']=0x1;_0x1de338[_0x3212('0x31')]=_0x3813a3[_0x3212('0x32')];_0x1de338[_0x3212('0x33')]='COMPLETED';return BPromise[_0x3212('0xe')]()[_0x3212('0x12')](voiceQueueReport[_0x3212('0x34')](_0x1de338))[_0x3212('0x10')](loggerCatch(_0x3212('0x35')));};exports['getContactRecallMe']=function(_0x2b0437,_0x3fc885){return BPromise[_0x3212('0xe')]()['then'](cmHopper[_0x3212('0x36')](_0x2b0437,_0x3fc885))[_0x3212('0x10')](loggerCatch(_0x3212('0x37')));};exports[_0x3212('0x38')]=function(_0x4e0d38){return BPromise[_0x3212('0xe')]()[_0x3212('0x12')](cmHopper[_0x3212('0x1b')](_0x4e0d38,!![],!![]))[_0x3212('0x10')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0xcb66=['uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','createAgentHistory','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type'];(function(_0x2f5035,_0x46e6b7){var _0x54dd06=function(_0x1a91e5){while(--_0x1a91e5){_0x2f5035['push'](_0x2f5035['shift']());}};_0x54dd06(++_0x46e6b7);}(_0xcb66,0x19f));var _0x6cb6=function(_0x319e2e,_0x2f727f){_0x319e2e=_0x319e2e-0x0;var _0x302524=_0xcb66[_0x319e2e];return _0x302524;};'use strict';var util=require('util');var BPromise=require(_0x6cb6('0x0'));var logger=require(_0x6cb6('0x1'))(_0x6cb6('0x2'));var _=require(_0x6cb6('0x3'));var cmHopper=require(_0x6cb6('0x4'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x6cb6('0x5'));var cmHopperBlack=require(_0x6cb6('0x6'));var voiceQueueRt=require(_0x6cb6('0x7'));var agentReportPreview=require(_0x6cb6('0x8'));var voiceQueueReport=require(_0x6cb6('0x9'));function loggerCatch(_0x506d14){return function(_0x53078d){logger[_0x6cb6('0xa')](_0x506d14,util[_0x6cb6('0xb')](_0x53078d,{'showHidden':![],'depth':null}));};}function create(_0x1028b3){return BPromise[_0x6cb6('0xc')]()[_0x6cb6('0xd')](cmHopperHistory[_0x6cb6('0xe')](_0x1028b3))[_0x6cb6('0xf')](loggerCatch(_0x6cb6('0x10')));}function createAgent(_0x332bce){return BPromise[_0x6cb6('0xc')]()[_0x6cb6('0xd')](agentReportPreview[_0x6cb6('0xe')](_0x332bce))[_0x6cb6('0xf')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x4923a2){return BPromise['resolve']()['then'](cmHopper[_0x6cb6('0x11')](_0x4923a2,!![]))[_0x6cb6('0xf')](loggerCatch(_0x6cb6('0x12')));}exports[_0x6cb6('0x13')]=function(_0x585233){return BPromise[_0x6cb6('0xc')]()[_0x6cb6('0xd')](cmHopperBlack['checkIsBlackList'](_0x585233))[_0x6cb6('0xf')](loggerCatch(_0x6cb6('0x14')));};exports['getContactPreview']=function(_0x107492){return BPromise[_0x6cb6('0xc')]()['then'](cmHopper['getContactPreview'](_0x107492))['catch'](loggerCatch('[getContactPreview]\x20'));};exports[_0x6cb6('0xe')]=function(_0x298daa,_0x9c901a){create(_0x298daa)[_0x6cb6('0xf')](loggerCatch(_0x9c901a));moveContact(_0x298daa)[_0x6cb6('0xf')](loggerCatch(_0x9c901a));};exports[_0x6cb6('0x15')]=function(_0x5b8a17,_0x1e8b7e){createAgent(_0x5b8a17)[_0x6cb6('0xf')](loggerCatch(_0x1e8b7e));};exports['createCustomerHistory']=function(_0x4b9da5,_0x5ef3d2){create(_0x4b9da5)['catch'](loggerCatch(_0x5ef3d2));};exports['createCustomerFinal']=function(_0x5e5349,_0x390c9b){moveContact(_0x5e5349)[_0x6cb6('0xf')](loggerCatch(_0x390c9b));};exports[_0x6cb6('0x16')]=function(_0x2d41c4,_0xc5dea0,_0x5e14c8){if(_0xc5dea0){_0x2d41c4['UserId']=null;}if(_0x5e14c8){_0x2d41c4[_0x6cb6('0x17')]=![];}return BPromise[_0x6cb6('0xc')]()[_0x6cb6('0xd')](cmHopper[_0x6cb6('0x16')](_0x2d41c4))['catch'](loggerCatch(_0x6cb6('0x18')));};exports[_0x6cb6('0x19')]=function(_0x58a6ed){return BPromise['resolve']()[_0x6cb6('0xd')](cmHopper['countReScheduled'](_0x58a6ed))[_0x6cb6('0xf')](loggerCatch(_0x6cb6('0x1a')));};exports[_0x6cb6('0x1b')]=function(_0x18ecb9){return BPromise[_0x6cb6('0xc')]()[_0x6cb6('0xd')](cmHopper[_0x6cb6('0x1b')]({'UserId':null},_0x18ecb9,0x1))[_0x6cb6('0xf')](loggerCatch(_0x6cb6('0x1c')));};exports[_0x6cb6('0x1d')]=function(_0x47a81b){return BPromise['resolve']()['then'](cmHopper[_0x6cb6('0x1b')]({'active':![]},_0x47a81b,0x1))[_0x6cb6('0xf')](loggerCatch(_0x6cb6('0x1e')));};exports[_0x6cb6('0x1f')]=function(_0x1f8c9d){var _0x3b62e6={};_0x3b62e6['type']=_0x1f8c9d[_0x6cb6('0x20')];_0x3b62e6['uniqueid']=_0x1f8c9d[_0x6cb6('0x21')];_0x3b62e6['calleridnum']=_0x1f8c9d[_0x6cb6('0x22')];_0x3b62e6[_0x6cb6('0x23')]=_0x1f8c9d[_0x6cb6('0x23')];_0x3b62e6['queue']=_0x1f8c9d[_0x6cb6('0x24')];_0x3b62e6[_0x6cb6('0x25')]=_0x1f8c9d[_0x6cb6('0x26')];_0x3b62e6['queuecallerleaveAt']=_0x1f8c9d[_0x6cb6('0x26')];_0x3b62e6[_0x6cb6('0x27')]=0x1;_0x3b62e6[_0x6cb6('0x28')]=_0x1f8c9d['endtime'];_0x3b62e6[_0x6cb6('0x29')]=_0x1f8c9d[_0x6cb6('0x2a')];_0x3b62e6['context']=_0x6cb6('0x2b');_0x3b62e6[_0x6cb6('0x2c')]=_0x6cb6('0x2d');_0x3b62e6[_0x6cb6('0x2e')]=0x0;_0x3b62e6[_0x6cb6('0x2f')]=0x1;_0x3b62e6[_0x6cb6('0x30')]=_0x1f8c9d[_0x6cb6('0x2a')];_0x3b62e6[_0x6cb6('0x31')]=_0x6cb6('0x32');return BPromise[_0x6cb6('0xc')]()['then'](voiceQueueReport[_0x6cb6('0x33')](_0x3b62e6))[_0x6cb6('0xf')](loggerCatch(_0x6cb6('0x34')));};exports[_0x6cb6('0x35')]=function(_0x586cf9,_0x558494){return BPromise['resolve']()[_0x6cb6('0xd')](cmHopper[_0x6cb6('0x35')](_0x586cf9,_0x558494))[_0x6cb6('0xf')](loggerCatch(_0x6cb6('0x36')));};exports[_0x6cb6('0x37')]=function(_0xa9f21b){return BPromise[_0x6cb6('0xc')]()[_0x6cb6('0xd')](cmHopper['rescheduleContact'](_0xa9f21b,!![],!![]))[_0x6cb6('0xf')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ 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 e5f0486..8d2b0df 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 _0x2973=['variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','calleridnum','from-sip','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','mandatoryDisposition','queue','interface','agentReadyId','not_inuse','status','reachable','push','getDiff','diff','createBody','CampaignId','filterKey','idContact','type','dialAnswer','countbusyretry','callback','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-callerid','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','match','extractCalleridNumber','util','moment','../../../../config/logger','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','loggerCatch','inspect','logger','loggerError','error','logger2','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','statedesc','starttime','responsetime','endtime','logAgent','state','logLookAgent','membername','UserId','logCustomer','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','answertime'];(function(_0x173e65,_0x24a8bf){var _0x37d496=function(_0x34b441){while(--_0x34b441){_0x173e65['push'](_0x173e65['shift']());}};_0x37d496(++_0x24a8bf);}(_0x2973,0x15d));var _0x3297=function(_0x33f9c6,_0x24cc4f){_0x33f9c6=_0x33f9c6-0x0;var _0x1edc0d=_0x2973[_0x33f9c6];return _0x1edc0d;};'use strict';var util=require(_0x3297('0x0'));var _=require('lodash');var moment=require(_0x3297('0x1'));var logger=require(_0x3297('0x2'))('preview');var ipAgi=process['env'][_0x3297('0x3')]||_0x3297('0x4');function getSeconds(_0x5189a8,_0x55febe){var _0x50a988=moment(_0x5189a8)[_0x3297('0x5')](0x0);var _0x49c42d=moment(_0x55febe)[_0x3297('0x5')](0x0);return _0x50a988['diff'](_0x49c42d,_0x3297('0x6'));}exports[_0x3297('0x7')]=function(_0x599998){return function(_0x2bc6d1){logger['error'](_0x599998,util[_0x3297('0x8')](_0x2bc6d1,{'showHidden':![],'depth':null}));};};exports[_0x3297('0x9')]=function(_0x5db9a6,_0x2f3534){logger['info'](_0x5db9a6,util[_0x3297('0x8')](_0x2f3534,{'showHidden':![],'depth':null}));};exports[_0x3297('0xa')]=function(_0x50bf20,_0x1982df){logger[_0x3297('0xb')](_0x50bf20,util['inspect'](_0x1982df,{'showHidden':![],'depth':null}));};exports[_0x3297('0xc')]=function(_0x3aef47){return function(_0x23beba){logger['info'](_0x3aef47,util['inspect'](_0x23beba,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x480c64,_0x47f05f,_0x454360){return{'message':_0x480c64,'unlock':_0x47f05f,'active':_0x454360};};exports[_0x3297('0xd')]=function(_0x58921d,_0x5b72ca,_0x46c22b){if(!_['isUndefined'](_0x46c22b)&&_0x3297('0xe')===typeof _0x46c22b&&!_[_0x3297('0xf')](_0x46c22b)){if(!_[_0x3297('0x10')](_0x5b72ca)&&'string'===typeof _0x5b72ca&&!_[_0x3297('0xf')](_0x5b72ca)){return util[_0x3297('0x11')](_0x3297('0x12'),_0x5b72ca,_0x46c22b);}return util[_0x3297('0x11')](_0x3297('0x12'),_0x46c22b,_0x46c22b);}if(!_[_0x3297('0x10')](_0x58921d)&&_0x3297('0xe')===typeof _0x58921d&&!_['isEmpty'](_0x58921d)){return _0x58921d;}return _0x3297('0x13');};exports[_0x3297('0x14')]=function(_0x1ee506){if(_[_0x3297('0x15')](_0x1ee506)){return![];}return _0x1ee506;};exports[_0x3297('0x16')]=function(_0x13d7ca,_0x2a0844,_0x39b92b,_0x26e42c,_0x2d09e9,_0x18551b){var _0x5a8e88={'XMD-QUEUE':_0x2a0844[_0x3297('0x17')]?_0x2a0844[_0x3297('0x17')][_0x3297('0x18')]:'','XMD-CALLERID':_0x26e42c,'XMD-CALLERID-PREVIEW':_0x18551b?util[_0x3297('0x11')](_0x3297('0x12'),_0x18551b[_0x3297('0x19')],_0x18551b['calleridnum']):_0x26e42c,'XMD-DIALID':_0x2d09e9,'XMD-CONTACTID':_0x2a0844[_0x3297('0x1a')],'XMD-CDRTYPE':_0x3297('0x1b'),'CALLERID(all)':_0x26e42c,'XMD-VOICEQUEUEID':_0x2a0844['VoiceQueueId'],'XMD-DIALCHANNEL':_0x39b92b,'XMD-DIALTIMEOUT':_0x13d7ca[_0x3297('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x3297('0x11')](_0x3297('0x1d'),_0x13d7ca[_0x3297('0x1e')]?'g':'',_[_0x3297('0xf')](_0x13d7ca['monitor_format'])?'':_0x3297('0x1f')),'XMD-DIALURL':_0x13d7ca['dialPreviewUrl']||'','XMD-AGI':_0x13d7ca[_0x3297('0x20')]?util[_0x3297('0x11')](_0x3297('0x21'),ipAgi,_0x13d7ca[_0x3297('0x20')]):_0x3297('0x22'),'XMD-AGIAFTER':_0x13d7ca[_0x3297('0x1e')]?util[_0x3297('0x11')](_0x3297('0x21'),ipAgi,_0x13d7ca[_0x3297('0x1e')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x18551b?_0x18551b[_0x3297('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x18551b?_0x18551b[_0x3297('0x24')]:'','XMD-DESTINATION':_0x3297('0x25')};if(!_[_0x3297('0xf')](_0x13d7ca[_0x3297('0x26')])){_0x5a8e88[util['format']('%s',_0x3297('0x27'))]=_0x13d7ca[_0x3297('0x26')];_0x5a8e88[util[_0x3297('0x11')]('%s',_0x3297('0x28'))]=_0x2d09e9;}if(_0x2a0844&&_0x2a0844[_0x3297('0x29')]){for(var _0x3229dd in _0x2a0844[_0x3297('0x29')]){if(_0x2a0844[_0x3297('0x29')][_0x3297('0x2a')](_0x3229dd)){if(!_[_0x3297('0x15')](_0x2a0844[_0x3297('0x29')][_0x3229dd])&&_0x3229dd!=='id'&&_0x3229dd!==_0x3297('0x2b')&&_0x3229dd!==_0x3297('0x2c')&&_0x3229dd!=='updatedAt'){_0x5a8e88[util[_0x3297('0x11')](_0x3297('0x2d'),_0x3297('0x2e'),_[_0x3297('0x2f')](_0x3229dd))]=_0x2a0844['Contact'][_0x3229dd];}}}}return _0x5a8e88;};exports[_0x3297('0x30')]=function(_0x46aea8){var _0x20e338={};for(var _0x1aff49 in _0x46aea8){if(_0x46aea8[_0x3297('0x2a')](_0x1aff49)){_0x20e338[util[_0x3297('0x11')]('%s',_[_0x3297('0x31')](_0x1aff49))]=_0x46aea8[_0x1aff49];}}return{'variables':_0x20e338};};exports[_0x3297('0x32')]=function(_0x100d7c,_0x161dce){if(!_['isNil'](_0x100d7c)){if(_0x100d7c['hasOwnProperty']('originated')){if(_0x100d7c[_0x3297('0x33')]>0x0){_0x100d7c[_0x3297('0x33')]-=0x1;}else{logger[_0x3297('0xb')](_0x3297('0x34'),_0x161dce);}}}else{logger['error'](_0x3297('0x35'),_0x161dce);}};exports['logBlacklist']=function(_0x164559){var _0x4e4557=moment()[_0x3297('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x164559['state']=0xd;_0x164559[_0x3297('0x36')]='Blacklist';_0x164559[_0x3297('0x37')]=_0x4e4557;_0x164559[_0x3297('0x38')]=_0x4e4557;_0x164559[_0x3297('0x39')]=_0x4e4557;};exports[_0x3297('0x3a')]=function(_0x34a422,_0x183d1d,_0x2642b0){var _0x4ad3a3=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x34a422[_0x3297('0x3b')]=_0x183d1d;_0x34a422['statedesc']=_0x2642b0;_0x34a422['responsetime']=_0x4ad3a3;_0x34a422['ringtime']=getSeconds(_0x34a422[_0x3297('0x38')],_0x34a422[_0x3297('0x37')]);};exports[_0x3297('0x3c')]=function(_0x43562c,_0x25e2c4,_0x2e7d59){_0x43562c[_0x3297('0x3d')]=_0x25e2c4;_0x43562c[_0x3297('0x3e')]=_0x2e7d59;};exports[_0x3297('0x3f')]=function(_0x16896e,_0x47002f,_0x207882){var _0x2e8d4f=moment()['format'](_0x3297('0x40'));_0x16896e[_0x3297('0x3b')]=_0x47002f;_0x16896e['statedesc']=_0x207882;_0x16896e[_0x3297('0x38')]=_0x16896e[_0x3297('0x38')]?_0x16896e[_0x3297('0x38')]:_0x2e8d4f;_0x16896e['endtime']=_0x16896e['endtime']?_0x16896e[_0x3297('0x39')]:_0x2e8d4f;_0x16896e[_0x3297('0x41')]=getSeconds(_0x16896e[_0x3297('0x38')]||0x0,_0x16896e[_0x3297('0x37')]||0x0);_0x16896e[_0x3297('0x42')]=_0x16896e[_0x3297('0x43')]?getSeconds(_0x16896e['endtime'],_0x16896e['answertime']):0x0;};exports['isFailure']=function(_0x127e3e){return _0x127e3e==='Failure';};exports[_0x3297('0x44')]=function(_0x5548bb,_0x500a8e,_0x4c7bb2,_0x37f9ef,_0x54c84d){var _0x153fbd=_0x37f9ef?_0x3297('0x45'):_0x5548bb[_0x3297('0x19')];_0x153fbd=_0x54c84d?_0x3297('0x46'):_0x153fbd;return{'actionid':_0x5548bb[_0x3297('0x47')],'action':_0x3297('0x48'),'channel':_0x5548bb[_0x3297('0x49')],'callerid':util[_0x3297('0x11')](_0x3297('0x12'),_0x153fbd,_0x5548bb[_0x3297('0x4a')]),'Exten':'xcally-motion-preview','Context':_0x3297('0x4b'),'Priority':'1','variable':_0x4c7bb2,'timeout':(_0x500a8e['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x5548bb[_0x3297('0x47')]};};exports['totalGlobal']=function(_0x24f409){return _0x24f409['countbusyretry']+_0x24f409[_0x3297('0x4c')]+_0x24f409[_0x3297('0x4d')]+_0x24f409['countagentrejectretry']+_0x24f409[_0x3297('0x4e')];};exports[_0x3297('0x4f')]=function(_0x12e16d){var _0x587a7a=_[_0x3297('0x50')](_0x12e16d);_0x587a7a[_0x3297('0x3b')]=0xf;_0x587a7a[_0x3297('0x36')]=_0x3297('0x51');return _0x587a7a;};exports[_0x3297('0x52')]=function(_0x193e20,_0x3dcb2f,_0x33ca5e){var _0x2f0c52={};_0x2f0c52[_0x3dcb2f]=_0x193e20[_0x3dcb2f];_0x2f0c52[_0x3297('0x53')]=![];_0x2f0c52[_0x3297('0x54')]=moment()['add'](_0x33ca5e,_0x3297('0x55'))[_0x3297('0x11')](_0x3297('0x40'));_0x2f0c52['ContactId']=_0x193e20['ContactId'];_0x2f0c52[_0x3297('0x56')]=_0x193e20[_0x3297('0x56')];_0x2f0c52[_0x3297('0x57')]=_0x193e20[_0x3297('0x57')]||undefined;return _0x2f0c52;};exports[_0x3297('0x58')]=function(_0xb3287e,_0x7bd7db){if(!_['isNil'](_0xb3287e)){if(_0xb3287e[_0x3297('0x59')]>0x0){_0xb3287e[_0x3297('0x59')]-=0x1;}else{logger['error'](_0x7bd7db,_0x3297('0x5a'));}}else{logger[_0x3297('0xb')](_0x7bd7db,_0x3297('0x5b'));}};exports[_0x3297('0x5c')]=function(_0x27ec17){if(_0x27ec17<=0x0){return!![];}return![];};exports['buildObj']=function(_0x5360f0,_0x1515db,_0x1d971f){_0x5360f0['lastevent']=_0x1515db;_0x5360f0['name']=_0x5360f0['queue'];_0x5360f0['interface']=_0x5360f0[_0x3297('0x49')];if(_0x1d971f){_0x5360f0[_0x3297('0x5d')]=_0x1d971f[_0x3297('0x5d')];}return _0x5360f0;};exports['buildAcw']=function(_0x3e98bf){var _0x124ea2={};_0x124ea2[_0x3297('0x5e')]=_0x3e98bf[_0x3297('0x5e')];_0x124ea2[_0x3297('0x5f')]=_0x3e98bf[_0x3297('0x49')];_0x124ea2[_0x3297('0x47')]=_0x3e98bf[_0x3297('0x47')];return _0x124ea2;};exports[_0x3297('0x60')]=function(_0x111ef1){var _0x3ae9a3=[];for(var _0x8f75e5 in _0x111ef1){if(_0x111ef1[_0x3297('0x2a')](_0x8f75e5)){if(!_['isNil'](_0x111ef1[_0x8f75e5])&&_0x111ef1[_0x8f75e5][_0x3297('0x3b')]===_0x3297('0x61')&&_0x111ef1[_0x8f75e5][_0x3297('0x62')]===_0x3297('0x63')){_0x3ae9a3[_0x3297('0x64')](_0x111ef1[_0x8f75e5]['id']);}}}return _0x3ae9a3;};exports[_0x3297('0x65')]=function(_0x18b236){var _0x1be9e5=moment()[_0x3297('0x5')](0x0);var _0x456c41=moment(_0x18b236)[_0x3297('0x5')](0x0);return _0x1be9e5[_0x3297('0x66')](_0x456c41,_0x3297('0x6'));};exports[_0x3297('0x67')]=function(_0x94db41){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x94db41[_0x3297('0x1a')],'ListId':_0x94db41[_0x3297('0x56')],'VoiceQueueId':_0x94db41[_0x3297('0x57')]||undefined,'CampaignId':_0x94db41[_0x3297('0x68')]||undefined};};exports[_0x3297('0x69')]=function(_0x4f1c75){if(_0x4f1c75===_0x3297('0x47')||_0x4f1c75===_0x3297('0x6a')||_0x4f1c75===_0x3297('0x5e')||_0x4f1c75===_0x3297('0x6b')||_0x4f1c75==='campaigntype'||_0x4f1c75===_0x3297('0x6c')||_0x4f1c75===_0x3297('0x3d')||_0x4f1c75===_0x3297('0x49')||_0x4f1c75==='calleridname'||_0x4f1c75===_0x3297('0x53')||_0x4f1c75===_0x3297('0x4a')||_0x4f1c75===_0x3297('0x54')||_0x4f1c75===_0x3297('0x6d')||_0x4f1c75===_0x3297('0x4c')||_0x4f1c75==='countnoanswerretry'||_0x4f1c75==='countglobal'||_0x4f1c75===_0x3297('0x6e')||_0x4f1c75==='callbackuniqueid'||_0x4f1c75==='callbackat'||_0x4f1c75===_0x3297('0x6f')||_0x4f1c75==='ContactId'||_0x4f1c75===_0x3297('0x56')||_0x4f1c75==='UserId'||_0x4f1c75===_0x3297('0x57')||_0x4f1c75===_0x3297('0x70')||_0x4f1c75===_0x3297('0x71')||_0x4f1c75===_0x3297('0x72')||_0x4f1c75===_0x3297('0x73')||_0x4f1c75===_0x3297('0x74')||_0x4f1c75===_0x3297('0x75')||_0x4f1c75===_0x3297('0x76')||_0x4f1c75===_0x3297('0x77')||_0x4f1c75===_0x3297('0x78')||_0x4f1c75==='xmd-dialchannel'||_0x4f1c75===_0x3297('0x79')||_0x4f1c75==='xmd-cdrtype'||_0x4f1c75===_0x3297('0x7a')||_0x4f1c75==='xmd-agiafter'||_0x4f1c75==='xmd-agi'||_0x4f1c75==='rtpaudioqos'||_0x4f1c75===_0x3297('0x7b')||_0x4f1c75===_0x3297('0x7c')||_0x4f1c75===_0x3297('0x7d')||_0x4f1c75===_0x3297('0x7e')||_0x4f1c75===_0x3297('0x7f')||_0x4f1c75===_0x3297('0x80')||_0x4f1c75===_0x3297('0x81')||_0x4f1c75===_0x3297('0x82')||_0x4f1c75===_0x3297('0x7b')||_0x4f1c75==='rtpaudioqosjitter'||_0x4f1c75===_0x3297('0x7d')||_0x4f1c75===_0x3297('0x7e')||_0x4f1c75===_0x3297('0x7f')||_0x4f1c75===_0x3297('0x80')||_0x4f1c75==='rtpaudioqosrttbridged'||_0x4f1c75===_0x3297('0x83')||_0x4f1c75===_0x3297('0x84')||_0x4f1c75==='state'||_0x4f1c75===_0x3297('0x36')){return![];}return!![];};exports[_0x3297('0x85')]=function(_0x1c16e8,_0x309d71){var _0x39c8f7,_0x17fd0d,_0x10156e;if(_0x309d71<=0x0){_0x309d71=0x1;}_0x39c8f7=new RegExp(_0x3297('0x86')+_0x309d71+'}$');_0x17fd0d=Math[_0x3297('0x87')](0xa,_0x309d71-0x1);_0x10156e=Math['pow'](0xa,_0x309d71)-0x1;return util[_0x3297('0x11')]('%s',_['replace'](_0x1c16e8,_0x39c8f7,_[_0x3297('0x88')](_0x17fd0d,_0x10156e)));};exports['extractCalleridName']=function(_0x5d4c91){var _0x318c81=_0x5d4c91[_0x3297('0x89')](/"(.*?)"/);return _0x318c81?_0x318c81[0x1]:_0x5d4c91;};exports[_0x3297('0x8a')]=function(_0x240848){var _0x5da783=_0x240848[_0x3297('0x89')](/<(.*?)>/);return _0x5da783?_0x5da783[0x1]:_0x240848;}; \ No newline at end of file +var _0x13cc=['getDiff','seconds','createBody','filterKey','idContact','type','campaigntype','dialAnswer','active','calleridnum','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialoptions','xmd-dialid','xmd-cdrtype','xmd-agiafter','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','extractCalleridNumber','match','util','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','milliseconds','diff','loggerCatch','error','logger','info','inspect','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','updatedAt','%s%s','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','endtime','logAgent','responsetime','ringtime','logLookAgent','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','BOOKED','originate','channelAgent','from-sip','timeout','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','queue','interface','mandatoryDisposition','agentReadyId','not_inuse','status','reachable','push'];(function(_0x32d330,_0xe907c8){var _0xe81a43=function(_0x322e56){while(--_0x322e56){_0x32d330['push'](_0x32d330['shift']());}};_0xe81a43(++_0xe907c8);}(_0x13cc,0x142));var _0xc13c=function(_0x32a4b4,_0x233a38){_0x32a4b4=_0x32a4b4-0x0;var _0x3c7f32=_0x13cc[_0x32a4b4];return _0x3c7f32;};'use strict';var util=require(_0xc13c('0x0'));var _=require(_0xc13c('0x1'));var moment=require(_0xc13c('0x2'));var logger=require(_0xc13c('0x3'))('preview');var ipAgi=process[_0xc13c('0x4')][_0xc13c('0x5')]||'127.0.0.1';function getSeconds(_0x2d9ad3,_0x1f49b2){var _0x286444=moment(_0x2d9ad3)[_0xc13c('0x6')](0x0);var _0x56baa4=moment(_0x1f49b2)['milliseconds'](0x0);return _0x286444[_0xc13c('0x7')](_0x56baa4,'seconds');}exports[_0xc13c('0x8')]=function(_0x2fa60a){return function(_0x4f94df){logger[_0xc13c('0x9')](_0x2fa60a,util['inspect'](_0x4f94df,{'showHidden':![],'depth':null}));};};exports[_0xc13c('0xa')]=function(_0x576e37,_0x2ba7fb){logger[_0xc13c('0xb')](_0x576e37,util[_0xc13c('0xc')](_0x2ba7fb,{'showHidden':![],'depth':null}));};exports[_0xc13c('0xd')]=function(_0x3f4667,_0x1a8bbc){logger['error'](_0x3f4667,util[_0xc13c('0xc')](_0x1a8bbc,{'showHidden':![],'depth':null}));};exports[_0xc13c('0xe')]=function(_0xc25735){return function(_0x14c1e2){logger['info'](_0xc25735,util[_0xc13c('0xc')](_0x14c1e2,{'showHidden':![],'depth':null}));};};exports[_0xc13c('0xf')]=function(_0x5227b6,_0x31268f,_0x5842a0){return{'message':_0x5227b6,'unlock':_0x31268f,'active':_0x5842a0};};exports[_0xc13c('0x10')]=function(_0x49f65f,_0x28ef75,_0x22e4cc){if(!_[_0xc13c('0x11')](_0x22e4cc)&&_0xc13c('0x12')===typeof _0x22e4cc&&!_['isEmpty'](_0x22e4cc)){if(!_[_0xc13c('0x11')](_0x28ef75)&&_0xc13c('0x12')===typeof _0x28ef75&&!_[_0xc13c('0x13')](_0x28ef75)){return util[_0xc13c('0x14')](_0xc13c('0x15'),_0x28ef75,_0x22e4cc);}return util['format']('\x22%s\x22\x20<%s>',_0x22e4cc,_0x22e4cc);}if(!_['isUndefined'](_0x49f65f)&&_0xc13c('0x12')===typeof _0x49f65f&&!_[_0xc13c('0x13')](_0x49f65f)){return _0x49f65f;}return _0xc13c('0x16');};exports[_0xc13c('0x17')]=function(_0x368869){if(_[_0xc13c('0x18')](_0x368869)){return![];}return _0x368869;};exports[_0xc13c('0x19')]=function(_0x19e752,_0x54dcbf,_0x30c412,_0x59ca4a,_0xa1df7,_0x27dda4){var _0x5b85cd={'XMD-QUEUE':_0x54dcbf['Queue']?_0x54dcbf[_0xc13c('0x1a')][_0xc13c('0x1b')]:'','XMD-CALLERID':_0x59ca4a,'XMD-CALLERID-PREVIEW':_0x27dda4?util[_0xc13c('0x14')]('\x22%s\x22\x20<%s>',_0x27dda4[_0xc13c('0x1c')],_0x27dda4['calleridnum']):_0x59ca4a,'XMD-DIALID':_0xa1df7,'XMD-CONTACTID':_0x54dcbf[_0xc13c('0x1d')],'XMD-CDRTYPE':_0xc13c('0x1e'),'CALLERID(all)':_0x59ca4a,'XMD-VOICEQUEUEID':_0x54dcbf[_0xc13c('0x1f')],'XMD-DIALCHANNEL':_0x30c412,'XMD-DIALTIMEOUT':_0x19e752[_0xc13c('0x20')]||0x1e,'XMD-DIALOPTIONS':util[_0xc13c('0x14')]('\x22rtTxX%s%s\x22',_0x19e752[_0xc13c('0x21')]?'g':'',_[_0xc13c('0x13')](_0x19e752[_0xc13c('0x22')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x19e752[_0xc13c('0x23')]||'','XMD-AGI':_0x19e752[_0xc13c('0x24')]?util[_0xc13c('0x14')](_0xc13c('0x25'),ipAgi,_0x19e752[_0xc13c('0x24')]):_0xc13c('0x26'),'XMD-AGIAFTER':_0x19e752['dialQueueProject2']?util[_0xc13c('0x14')](_0xc13c('0x25'),ipAgi,_0x19e752[_0xc13c('0x21')]):_0xc13c('0x26'),'XMD-ORIGINATECALLERIDNUM':_0x27dda4?_0x27dda4['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x27dda4?_0x27dda4[_0xc13c('0x27')]:'','XMD-DESTINATION':_0xc13c('0x28')};if(!_[_0xc13c('0x13')](_0x19e752[_0xc13c('0x22')])){_0x5b85cd[util[_0xc13c('0x14')]('%s',_0xc13c('0x29'))]=_0x19e752[_0xc13c('0x22')];_0x5b85cd[util[_0xc13c('0x14')]('%s',_0xc13c('0x2a'))]=_0xa1df7;}if(_0x54dcbf&&_0x54dcbf['Contact']){for(var _0x4b2a3c in _0x54dcbf[_0xc13c('0x2b')]){if(_0x54dcbf[_0xc13c('0x2b')][_0xc13c('0x2c')](_0x4b2a3c)){if(!_[_0xc13c('0x18')](_0x54dcbf[_0xc13c('0x2b')][_0x4b2a3c])&&_0x4b2a3c!=='id'&&_0x4b2a3c!==_0xc13c('0x2d')&&_0x4b2a3c!=='createdAt'&&_0x4b2a3c!==_0xc13c('0x2e')){_0x5b85cd[util['format'](_0xc13c('0x2f'),'XMD-',_[_0xc13c('0x30')](_0x4b2a3c))]=_0x54dcbf[_0xc13c('0x2b')][_0x4b2a3c];}}}}return _0x5b85cd;};exports[_0xc13c('0x31')]=function(_0xd2b570){var _0x1f510c={};for(var _0x1aabde in _0xd2b570){if(_0xd2b570[_0xc13c('0x2c')](_0x1aabde)){_0x1f510c[util[_0xc13c('0x14')]('%s',_[_0xc13c('0x32')](_0x1aabde))]=_0xd2b570[_0x1aabde];}}return{'variables':_0x1f510c};};exports[_0xc13c('0x33')]=function(_0x2ca466,_0x54afb7){if(!_[_0xc13c('0x18')](_0x2ca466)){if(_0x2ca466[_0xc13c('0x2c')]('originated')){if(_0x2ca466[_0xc13c('0x34')]>0x0){_0x2ca466[_0xc13c('0x34')]-=0x1;}else{logger[_0xc13c('0x9')](_0xc13c('0x35'),_0x54afb7);}}}else{logger[_0xc13c('0x9')](_0xc13c('0x36'),_0x54afb7);}};exports[_0xc13c('0x37')]=function(_0x256c67){var _0x5de39f=moment()[_0xc13c('0x14')](_0xc13c('0x38'));_0x256c67[_0xc13c('0x39')]=0xd;_0x256c67[_0xc13c('0x3a')]=_0xc13c('0x3b');_0x256c67[_0xc13c('0x3c')]=_0x5de39f;_0x256c67['responsetime']=_0x5de39f;_0x256c67[_0xc13c('0x3d')]=_0x5de39f;};exports[_0xc13c('0x3e')]=function(_0x4da5b3,_0x38519a,_0x59a216){var _0x53a6b4=moment()[_0xc13c('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x4da5b3[_0xc13c('0x39')]=_0x38519a;_0x4da5b3[_0xc13c('0x3a')]=_0x59a216;_0x4da5b3[_0xc13c('0x3f')]=_0x53a6b4;_0x4da5b3[_0xc13c('0x40')]=getSeconds(_0x4da5b3[_0xc13c('0x3f')],_0x4da5b3[_0xc13c('0x3c')]);};exports[_0xc13c('0x41')]=function(_0x2d6aab,_0x391cc5,_0x172b31){_0x2d6aab['membername']=_0x391cc5;_0x2d6aab[_0xc13c('0x42')]=_0x172b31;};exports[_0xc13c('0x43')]=function(_0x3b7a4,_0x4546da,_0x305313){var _0x18c132=moment()[_0xc13c('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x3b7a4[_0xc13c('0x39')]=_0x4546da;_0x3b7a4[_0xc13c('0x3a')]=_0x305313;_0x3b7a4[_0xc13c('0x3f')]=_0x3b7a4['responsetime']?_0x3b7a4[_0xc13c('0x3f')]:_0x18c132;_0x3b7a4['endtime']=_0x3b7a4[_0xc13c('0x3d')]?_0x3b7a4['endtime']:_0x18c132;_0x3b7a4[_0xc13c('0x40')]=getSeconds(_0x3b7a4[_0xc13c('0x3f')]||0x0,_0x3b7a4[_0xc13c('0x3c')]||0x0);_0x3b7a4[_0xc13c('0x44')]=_0x3b7a4[_0xc13c('0x45')]?getSeconds(_0x3b7a4[_0xc13c('0x3d')],_0x3b7a4[_0xc13c('0x45')]):0x0;};exports[_0xc13c('0x46')]=function(_0x3b424b){return _0x3b424b===_0xc13c('0x47');};exports[_0xc13c('0x48')]=function(_0x2c61fb,_0x3a314e,_0x43195a,_0x49f8c1,_0x2ef17a){var _0x4d0b4b=_0x49f8c1?'RECALL':_0x2c61fb[_0xc13c('0x1c')];_0x4d0b4b=_0x2ef17a?_0xc13c('0x49'):_0x4d0b4b;return{'actionid':_0x2c61fb['uniqueid'],'action':_0xc13c('0x4a'),'channel':_0x2c61fb[_0xc13c('0x4b')],'callerid':util[_0xc13c('0x14')]('\x22%s\x22\x20<%s>',_0x4d0b4b,_0x2c61fb['calleridnum']),'Exten':'xcally-motion-preview','Context':_0xc13c('0x4c'),'Priority':'1','variable':_0x43195a,'timeout':(_0x3a314e[_0xc13c('0x4d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2c61fb[_0xc13c('0x4e')]};};exports[_0xc13c('0x4f')]=function(_0x419acf){return _0x419acf[_0xc13c('0x50')]+_0x419acf[_0xc13c('0x51')]+_0x419acf[_0xc13c('0x52')]+_0x419acf[_0xc13c('0x53')]+_0x419acf[_0xc13c('0x54')];};exports[_0xc13c('0x55')]=function(_0x3eaf20){var _0x331302=_[_0xc13c('0x56')](_0x3eaf20);_0x331302[_0xc13c('0x39')]=0xf;_0x331302[_0xc13c('0x3a')]='Global';return _0x331302;};exports[_0xc13c('0x57')]=function(_0x1ceb9a,_0x3d5274,_0x205bee){var _0x13afc3={};_0x13afc3[_0x3d5274]=_0x1ceb9a[_0x3d5274];_0x13afc3['active']=![];_0x13afc3[_0xc13c('0x58')]=moment()[_0xc13c('0x59')](_0x205bee,_0xc13c('0x5a'))[_0xc13c('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x13afc3['ContactId']=_0x1ceb9a[_0xc13c('0x1d')];_0x13afc3[_0xc13c('0x5b')]=_0x1ceb9a[_0xc13c('0x5b')];_0x13afc3[_0xc13c('0x1f')]=_0x1ceb9a['VoiceQueueId']||undefined;return _0x13afc3;};exports[_0xc13c('0x5c')]=function(_0x5363cf,_0x220930){if(!_[_0xc13c('0x18')](_0x5363cf)){if(_0x5363cf[_0xc13c('0x5d')]>0x0){_0x5363cf['pTalking']-=0x1;}else{logger[_0xc13c('0x9')](_0x220930,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xc13c('0x9')](_0x220930,_0xc13c('0x5e'));}};exports[_0xc13c('0x5f')]=function(_0x4069ca){if(_0x4069ca<=0x0){return!![];}return![];};exports['buildObj']=function(_0x32ceb0,_0x223aed,_0x12ff1a){_0x32ceb0['lastevent']=_0x223aed;_0x32ceb0[_0xc13c('0x1b')]=_0x32ceb0[_0xc13c('0x60')];_0x32ceb0[_0xc13c('0x61')]=_0x32ceb0['channelAgent'];if(_0x12ff1a){_0x32ceb0[_0xc13c('0x62')]=_0x12ff1a[_0xc13c('0x62')];}return _0x32ceb0;};exports['buildAcw']=function(_0x2d0617){var _0x480c80={};_0x480c80['queue']=_0x2d0617[_0xc13c('0x60')];_0x480c80[_0xc13c('0x61')]=_0x2d0617['channelAgent'];_0x480c80['uniqueid']=_0x2d0617[_0xc13c('0x4e')];return _0x480c80;};exports[_0xc13c('0x63')]=function(_0x1470e5){var _0x3f04c6=[];for(var _0x4af0d0 in _0x1470e5){if(_0x1470e5[_0xc13c('0x2c')](_0x4af0d0)){if(!_[_0xc13c('0x18')](_0x1470e5[_0x4af0d0])&&_0x1470e5[_0x4af0d0]['state']===_0xc13c('0x64')&&_0x1470e5[_0x4af0d0][_0xc13c('0x65')]===_0xc13c('0x66')){_0x3f04c6[_0xc13c('0x67')](_0x1470e5[_0x4af0d0]['id']);}}}return _0x3f04c6;};exports[_0xc13c('0x68')]=function(_0x868766){var _0x5ba137=moment()[_0xc13c('0x6')](0x0);var _0x5a46b6=moment(_0x868766)[_0xc13c('0x6')](0x0);return _0x5ba137['diff'](_0x5a46b6,_0xc13c('0x69'));};exports[_0xc13c('0x6a')]=function(_0x34b858){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x34b858['ContactId'],'ListId':_0x34b858[_0xc13c('0x5b')],'VoiceQueueId':_0x34b858['VoiceQueueId']||undefined,'CampaignId':_0x34b858['CampaignId']||undefined};};exports[_0xc13c('0x6b')]=function(_0x17c87a){if(_0x17c87a===_0xc13c('0x4e')||_0x17c87a===_0xc13c('0x6c')||_0x17c87a===_0xc13c('0x60')||_0x17c87a===_0xc13c('0x6d')||_0x17c87a===_0xc13c('0x6e')||_0x17c87a===_0xc13c('0x6f')||_0x17c87a==='membername'||_0x17c87a===_0xc13c('0x4b')||_0x17c87a===_0xc13c('0x1c')||_0x17c87a===_0xc13c('0x70')||_0x17c87a===_0xc13c('0x71')||_0x17c87a===_0xc13c('0x58')||_0x17c87a===_0xc13c('0x50')||_0x17c87a==='countcongestionretry'||_0x17c87a===_0xc13c('0x52')||_0x17c87a==='countglobal'||_0x17c87a===_0xc13c('0x72')||_0x17c87a===_0xc13c('0x73')||_0x17c87a===_0xc13c('0x74')||_0x17c87a===_0xc13c('0x75')||_0x17c87a===_0xc13c('0x1d')||_0x17c87a===_0xc13c('0x5b')||_0x17c87a===_0xc13c('0x42')||_0x17c87a===_0xc13c('0x1f')||_0x17c87a===_0xc13c('0x76')||_0x17c87a===_0xc13c('0x77')||_0x17c87a===_0xc13c('0x78')||_0x17c87a==='xmd-phone'||_0x17c87a===_0xc13c('0x79')||_0x17c87a==='xmd-dialurl'||_0x17c87a==='xmd-dialtimeout'||_0x17c87a===_0xc13c('0x7a')||_0x17c87a===_0xc13c('0x7b')||_0x17c87a==='xmd-dialchannel'||_0x17c87a==='xmd-contactid'||_0x17c87a===_0xc13c('0x7c')||_0x17c87a==='xmd-callerid'||_0x17c87a===_0xc13c('0x7d')||_0x17c87a==='xmd-agi'||_0x17c87a===_0xc13c('0x7e')||_0x17c87a==='rtpaudioqosbridged'||_0x17c87a===_0xc13c('0x7f')||_0x17c87a==='rtpaudioqosjitterbridged'||_0x17c87a===_0xc13c('0x80')||_0x17c87a===_0xc13c('0x81')||_0x17c87a===_0xc13c('0x82')||_0x17c87a===_0xc13c('0x83')||_0x17c87a==='rtpaudioqos'||_0x17c87a==='rtpaudioqosbridged'||_0x17c87a===_0xc13c('0x7f')||_0x17c87a===_0xc13c('0x84')||_0x17c87a==='rtpaudioqosloss'||_0x17c87a===_0xc13c('0x81')||_0x17c87a===_0xc13c('0x82')||_0x17c87a===_0xc13c('0x83')||_0x17c87a===_0xc13c('0x85')||_0x17c87a===_0xc13c('0x86')||_0x17c87a===_0xc13c('0x39')||_0x17c87a==='statedesc'){return![];}return!![];};exports[_0xc13c('0x87')]=function(_0x130d96,_0x191468){var _0x1c4b74,_0x338a67,_0x4f427e;if(_0x191468<=0x0){_0x191468=0x1;}_0x1c4b74=new RegExp(_0xc13c('0x88')+_0x191468+'}$');_0x338a67=Math[_0xc13c('0x89')](0xa,_0x191468-0x1);_0x4f427e=Math[_0xc13c('0x89')](0xa,_0x191468)-0x1;return util[_0xc13c('0x14')]('%s',_['replace'](_0x130d96,_0x1c4b74,_[_0xc13c('0x8a')](_0x338a67,_0x4f427e)));};exports[_0xc13c('0x8b')]=function(_0x4e7b60){var _0x475615=_0x4e7b60['match'](/"(.*?)"/);return _0x475615?_0x475615[0x1]:_0x4e7b60;};exports[_0xc13c('0x8c')]=function(_0x26f92a){var _0x2ddab3=_0x26f92a[_0xc13c('0x8d')](/<(.*?)>/);return _0x2ddab3?_0x2ddab3[0x1]:_0x26f92a;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index e926b75..f06092b 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 _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x14e22f,_0x2b05d6){var _0x2b6e0b=function(_0x58dcdd){while(--_0x58dcdd){_0x14e22f['push'](_0x14e22f['shift']());}};_0x2b6e0b(++_0x2b05d6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1cf093,_0x52f1cf){_0x1cf093=_0x1cf093-0x0;var _0x4b7d62=_0x5f2f[_0x1cf093];return _0x4b7d62;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x7a54=['number','boolean','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x3b65ed,_0x5b8cb1){var _0x3a1a19=function(_0x40185a){while(--_0x40185a){_0x3b65ed['push'](_0x3b65ed['shift']());}};_0x3a1a19(++_0x5b8cb1);}(_0x7a54,0x106));var _0x47a5=function(_0x20acfd,_0x151f7f){_0x20acfd=_0x20acfd-0x0;var _0x5d0359=_0x7a54[_0x20acfd];return _0x5d0359;};'use strict';exports[_0x47a5('0x0')]={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x47a5('0x2'),'required':![]},'paused':{'type':_0x47a5('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]}};exports[_0x47a5('0x4')]={'interface':{'type':_0x47a5('0x1'),'required':!![]},'paused':{'type':_0x47a5('0x3')},'reason':{'type':'string','required':![]}};exports[_0x47a5('0x5')]={'module':{'type':'string','required':![]}};exports[_0x47a5('0x6')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x47a5('0x7')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'exten':{'type':'string','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 69e8e86..e58ab72 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 _0x4344=['outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','isUndefined','mergeFromDatabase','initTelephones','length','initVoiceQueues','initTriggers','triggers','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','seconds','queuecallercomplete','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','faxAccounts','exports','bluebird','lodash','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay'];(function(_0x9090a9,_0x2ef81e){var _0x3c5b7a=function(_0x4b7832){while(--_0x4b7832){_0x9090a9['push'](_0x9090a9['shift']());}};_0x3c5b7a(++_0x2ef81e);}(_0x4344,0x170));var _0x4434=function(_0x4c2cf6,_0x196957){_0x4c2cf6=_0x4c2cf6-0x0;var _0x1ce295=_0x4344[_0x4c2cf6];return _0x1ce295;};'use strict';var BPromise=require(_0x4434('0x0'));var util=require('util');var _=require(_0x4434('0x1'));var moment=require('moment');var Agent=require('../model/agent');var Telephone=require(_0x4434('0x2'));var Trunk=require(_0x4434('0x3'));var VoiceQueue=require(_0x4434('0x4'));var Trigger=require(_0x4434('0x5'));var Template=require(_0x4434('0x6'));var Campaign=require(_0x4434('0x7'));var VoiceExtension=require(_0x4434('0x8'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x4434('0x9'));var FreshdeskAccount=require(_0x4434('0xa'));var SugarcrmAccount=require(_0x4434('0xb'));var ZohoAccount=require(_0x4434('0xc'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x4434('0xd'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x4434('0xe'));var FreshsalesAccount=require(_0x4434('0xf'));var FaxAccount=require(_0x4434('0x10'));var Realtime=function(){this[_0x4434('0x11')]={};this[_0x4434('0x12')]={};this[_0x4434('0x13')]={};this[_0x4434('0x14')]={};this['triggers']={};this[_0x4434('0x15')]={};this[_0x4434('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x4434('0x17')]={};this[_0x4434('0x18')]={};this['queueChannels']={};this[_0x4434('0x19')]={};this[_0x4434('0x1a')]={};this[_0x4434('0x1b')]={};this[_0x4434('0x1c')]={};this[_0x4434('0x1d')]={};this[_0x4434('0x1e')]={};this['zohoAccounts']={};this[_0x4434('0x1f')]={};this[_0x4434('0x20')]={};this['servicenowAccounts']={};this[_0x4434('0x21')]={};this[_0x4434('0x22')]={};this['faxAccounts']={};};function freeIsNotKey(_0xb16bc4,_0x5d1a84,_0x48e308){var _0x3f5126=_[_0x4434('0x23')](_0xb16bc4,function(_0x5a805a,_0x430f38){return _0x5a805a[_0x48e308];});for(var _0x1b871b in _0x5d1a84){if(_0x5d1a84[_0x4434('0x24')](_0x1b871b)){if(!_0x3f5126[_0x1b871b]){delete _0x5d1a84[_0x1b871b];}}}}function freeIsNotKeySip(_0x321c10,_0x24cd69){var _0x3f13e4=_['mapKeys'](_0x321c10,function(_0x3118dc,_0x4d4d71){return util[_0x4434('0x25')](_0x4434('0x26'),_0x3118dc[_0x4434('0x27')]);});for(var _0x2ac000 in _0x24cd69){if(_0x24cd69['hasOwnProperty'](_0x2ac000)){if(!_0x3f13e4[_0x2ac000]){delete _0x24cd69[_0x2ac000];}}}}function freeIsNotKeyAgent(_0x26a6a1,_0x33a1f0){var _0xbfa3a7=_[_0x4434('0x23')](_0x26a6a1,function(_0x439f89,_0x5c10df){var _0x435df4=_[_0x4434('0x28')](_0x439f89[_0x4434('0x29')])?util[_0x4434('0x25')]('SIP/%s',_0x439f89[_0x4434('0x27')]):_0x439f89[_0x4434('0x29')];return _0x435df4;});for(var _0x506939 in _0x33a1f0){if(_0x33a1f0[_0x4434('0x24')](_0x506939)){if(!_0xbfa3a7[_0x506939]){delete _0x33a1f0[_0x506939];}}}}function clearVoiceCallReports(_0x4310b3){_0x4310b3[_0x4434('0x2a')]=0x0;_0x4310b3[_0x4434('0x2b')]=0x0;_0x4310b3[_0x4434('0x2c')]=0x0;_0x4310b3[_0x4434('0x2d')]=0x0;_0x4310b3[_0x4434('0x2e')]=0x0;}function clearCampaigns(_0x12ad7c){if(!_[_0x4434('0x2f')](_0x12ad7c)){for(var _0x4c67c0 in _0x12ad7c){if(_0x12ad7c['hasOwnProperty'](_0x4c67c0)){_0x12ad7c[_0x4c67c0][_0x4434('0x30')]=0x0;_0x12ad7c[_0x4c67c0][_0x4434('0x31')]=0x0;}}}}function clearVoiceQueues(_0x2e3aa8){if(!_['isEmpty'](_0x2e3aa8)){for(var _0x53b49f in _0x2e3aa8){if(_0x2e3aa8[_0x4434('0x24')](_0x53b49f)){_0x2e3aa8[_0x53b49f][_0x4434('0x2a')]=0x0;_0x2e3aa8[_0x53b49f]['answered']=0x0;_0x2e3aa8[_0x53b49f]['unmanaged']=0x0;_0x2e3aa8[_0x53b49f][_0x4434('0x32')]=0x0;_0x2e3aa8[_0x53b49f][_0x4434('0x2c')]=0x0;_0x2e3aa8[_0x53b49f][_0x4434('0x2d')]=0x0;_0x2e3aa8[_0x53b49f][_0x4434('0x2e')]=0x0;_0x2e3aa8[_0x53b49f][_0x4434('0x33')]=0x0;_0x2e3aa8[_0x53b49f][_0x4434('0x34')]=0x0;_0x2e3aa8[_0x53b49f][_0x4434('0x35')]=0x0;_0x2e3aa8[_0x53b49f][_0x4434('0x36')]=0x0;_0x2e3aa8[_0x53b49f][_0x4434('0x37')]=0x0;_0x2e3aa8[_0x53b49f][_0x4434('0x38')]=0x0;_0x2e3aa8[_0x53b49f]['outboundDropCallsDayTimeout']=0x0;_0x2e3aa8[_0x53b49f]['outboundDropCallsDayCallersExit']=0x0;_0x2e3aa8[_0x53b49f][_0x4434('0x39')]=0x0;_0x2e3aa8[_0x53b49f]['outboundOriginateFailureCallsDay']=0x0;_0x2e3aa8[_0x53b49f]['outboundRejectCallsDay']=0x0;_0x2e3aa8[_0x53b49f][_0x4434('0x3a')]=0x0;_0x2e3aa8[_0x53b49f][_0x4434('0x33')]=0x0;_0x2e3aa8[_0x53b49f][_0x4434('0x3b')]=0x0;_0x2e3aa8[_0x53b49f][_0x4434('0x3c')]=!![];}}}}Realtime[_0x4434('0x3d')]['mergeFromDatabase']=function(_0x4216e1,_0x16367b){for(var _0x167c14 in _0x16367b){if(_0x4216e1[_0x4434('0x24')](_0x167c14)){_0x4216e1[_0x167c14]=_0x16367b[_0x167c14];}}};Realtime[_0x4434('0x3d')]['initAgents']=function(){var _0x2f5d7d=this;return function(_0x47d9f5){if(_0x47d9f5){freeIsNotKeyAgent(_0x47d9f5,_0x2f5d7d[_0x4434('0x11')]);for(var _0xba4844=0x0,_0x105fac={},_0x379281={};_0xba4844<_0x47d9f5['length'];_0xba4844+=0x1){_0x105fac=_0x47d9f5[_0xba4844];var _0x57d40b=_[_0x4434('0x28')](_0x105fac[_0x4434('0x29')])?util[_0x4434('0x25')](_0x4434('0x26'),_0x105fac[_0x4434('0x27')]):_0x105fac[_0x4434('0x29')];if(_[_0x4434('0x3e')](_0x2f5d7d[_0x4434('0x11')][_0x57d40b])){_0x2f5d7d[_0x4434('0x11')][_0x57d40b]=new Agent(_0x105fac);}else{_0x2f5d7d[_0x4434('0x3f')](_0x2f5d7d['agents'][_0x57d40b],_0x105fac);}}}return _0x2f5d7d[_0x4434('0x11')];};};Realtime['prototype'][_0x4434('0x40')]=function(){var _0x4c4f7a=this;return function(_0x5eeb31){if(_0x5eeb31){freeIsNotKeySip(_0x5eeb31,_0x4c4f7a[_0x4434('0x12')]);for(var _0x37010d=0x0,_0x494bc4={},_0x2ad49f={};_0x37010d<_0x5eeb31[_0x4434('0x41')];_0x37010d+=0x1){_0x494bc4=_0x5eeb31[_0x37010d];if(_[_0x4434('0x3e')](_0x4c4f7a[_0x4434('0x12')][util['format'](_0x4434('0x26'),_0x494bc4[_0x4434('0x27')])])){_0x4c4f7a['telephones'][util[_0x4434('0x25')](_0x4434('0x26'),_0x494bc4[_0x4434('0x27')])]=new Telephone(_0x494bc4);}else{_0x4c4f7a[_0x4434('0x3f')](_0x4c4f7a[_0x4434('0x12')][util[_0x4434('0x25')]('SIP/%s',_0x494bc4[_0x4434('0x27')])],_0x494bc4);}}}return _0x4c4f7a[_0x4434('0x12')];};};Realtime[_0x4434('0x3d')]['initTrunks']=function(){var _0x302102=this;return function(_0x3d189f){if(_0x3d189f){freeIsNotKeySip(_0x3d189f,_0x302102[_0x4434('0x13')]);for(var _0x2cd34d=0x0,_0x16a76c={},_0x1ae16e={};_0x2cd34d<_0x3d189f['length'];_0x2cd34d+=0x1){_0x16a76c=_0x3d189f[_0x2cd34d];if(_[_0x4434('0x3e')](_0x302102[_0x4434('0x13')][util[_0x4434('0x25')](_0x4434('0x26'),_0x16a76c[_0x4434('0x27')])])){_0x302102[_0x4434('0x13')][util['format'](_0x4434('0x26'),_0x16a76c[_0x4434('0x27')])]=new Trunk(_0x16a76c);}else{_0x302102[_0x4434('0x3f')](_0x302102[_0x4434('0x13')][util[_0x4434('0x25')]('SIP/%s',_0x16a76c[_0x4434('0x27')])],_0x16a76c);}}}return _0x302102['trunks'];};};Realtime[_0x4434('0x3d')][_0x4434('0x42')]=function(){var _0x5ceeb0=this;return function(_0x4632ab){if(_0x4632ab){freeIsNotKey(_0x4632ab,_0x5ceeb0[_0x4434('0x14')],_0x4434('0x27'));for(var _0x1aea80=0x0,_0x2f43cc={},_0x266ce1={};_0x1aea80<_0x4632ab[_0x4434('0x41')];_0x1aea80+=0x1){_0x2f43cc=_0x4632ab[_0x1aea80];if(_['isUndefined'](_0x5ceeb0[_0x4434('0x14')][_0x2f43cc[_0x4434('0x27')]])){_0x5ceeb0[_0x4434('0x14')][_0x2f43cc[_0x4434('0x27')]]=new VoiceQueue(_0x2f43cc);}else{_0x5ceeb0[_0x4434('0x3f')](_0x5ceeb0['voiceQueues'][_0x2f43cc[_0x4434('0x27')]],_0x2f43cc);}}}return _0x5ceeb0[_0x4434('0x14')];};};Realtime[_0x4434('0x3d')][_0x4434('0x43')]=function(){var _0x5a6224=this;return function(_0x236061){if(_0x236061){freeIsNotKey(_0x236061,_0x5a6224[_0x4434('0x44')],'id');for(var _0x11d719=0x0,_0x3cff37={},_0x2e4474={};_0x11d719<_0x236061[_0x4434('0x41')];_0x11d719+=0x1){_0x3cff37=_0x236061[_0x11d719];if(_[_0x4434('0x3e')](_0x5a6224['triggers'][_0x3cff37['id']])){_0x5a6224[_0x4434('0x44')][_0x3cff37['id']]=new Trigger(_0x3cff37);}else{_0x5a6224[_0x4434('0x3f')](_0x5a6224['triggers'][_0x3cff37['id']],_0x3cff37);}}}return _0x5a6224['triggers'];};};Realtime[_0x4434('0x3d')]['initTemplates']=function(){var _0x8f0a6a=this;return function(_0x5487be){if(_0x5487be){freeIsNotKey(_0x5487be,_0x8f0a6a[_0x4434('0x16')],'id');for(var _0x4adfe9=0x0,_0x8705ab={},_0x38b293={};_0x4adfe9<_0x5487be[_0x4434('0x41')];_0x4adfe9+=0x1){_0x8705ab=_0x5487be[_0x4adfe9];if(_[_0x4434('0x3e')](_0x8f0a6a[_0x4434('0x16')][_0x8705ab['id']])){_0x8f0a6a[_0x4434('0x16')][_0x8705ab['id']]=new Template(_0x8705ab);}else{_0x8f0a6a[_0x4434('0x3f')](_0x8f0a6a[_0x4434('0x16')][_0x8705ab['id']],_0x8705ab);}}}return _0x8f0a6a[_0x4434('0x16')];};};Realtime[_0x4434('0x3d')][_0x4434('0x45')]=function(){var _0x381d9c=this;return function(_0x4d3a9f){if(_0x4d3a9f){freeIsNotKey(_0x4d3a9f,_0x381d9c[_0x4434('0x1b')],'id');for(var _0x338d80=0x0,_0x3ce444={},_0x1b8c1b={};_0x338d80<_0x4d3a9f[_0x4434('0x41')];_0x338d80+=0x1){_0x3ce444=_0x4d3a9f[_0x338d80];if(_[_0x4434('0x3e')](_0x381d9c[_0x4434('0x1b')][_0x3ce444['id']])){_0x381d9c['zendeskAccounts'][_0x3ce444['id']]=new ZendeskAccount(_0x3ce444);}else{_0x381d9c[_0x4434('0x3f')](_0x381d9c[_0x4434('0x1b')][_0x3ce444['id']],_0x3ce444);}}}return _0x381d9c[_0x4434('0x1b')];};};Realtime[_0x4434('0x3d')][_0x4434('0x46')]=function(){var _0xe2cb5e=this;return function(_0x363eda){if(_0x363eda){freeIsNotKey(_0x363eda,_0xe2cb5e['salesforceAccounts'],'id');for(var _0x33182a=0x0,_0x115614={},_0x24434d={};_0x33182a<_0x363eda[_0x4434('0x41')];_0x33182a+=0x1){_0x115614=_0x363eda[_0x33182a];if(_[_0x4434('0x3e')](_0xe2cb5e[_0x4434('0x1c')][_0x115614['id']])){_0xe2cb5e['salesforceAccounts'][_0x115614['id']]=new SalesforceAccount(_0x115614);}else{_0xe2cb5e[_0x4434('0x3f')](_0xe2cb5e[_0x4434('0x1c')][_0x115614['id']],_0x115614);}}}return _0xe2cb5e[_0x4434('0x1c')];};};Realtime[_0x4434('0x3d')][_0x4434('0x47')]=function(){var _0x2ac204=this;return function(_0x5b4ec7){if(_0x5b4ec7){freeIsNotKey(_0x5b4ec7,_0x2ac204[_0x4434('0x1e')],'id');for(var _0x5b6114=0x0,_0x3fd158={},_0x138d8b={};_0x5b6114<_0x5b4ec7[_0x4434('0x41')];_0x5b6114+=0x1){_0x3fd158=_0x5b4ec7[_0x5b6114];if(_[_0x4434('0x3e')](_0x2ac204[_0x4434('0x1e')][_0x3fd158['id']])){_0x2ac204[_0x4434('0x1e')][_0x3fd158['id']]=new FreshdeskAccount(_0x3fd158);}else{_0x2ac204[_0x4434('0x3f')](_0x2ac204[_0x4434('0x1e')][_0x3fd158['id']],_0x3fd158);}}}return _0x2ac204[_0x4434('0x1e')];};};Realtime[_0x4434('0x3d')][_0x4434('0x48')]=function(){var _0x4b0b6f=this;return function(_0x1b7539){if(_0x1b7539){freeIsNotKey(_0x1b7539,_0x4b0b6f[_0x4434('0x49')],'id');for(var _0x37dbaa=0x0,_0x2f97f3={},_0x355838={};_0x37dbaa<_0x1b7539[_0x4434('0x41')];_0x37dbaa+=0x1){_0x2f97f3=_0x1b7539[_0x37dbaa];if(_[_0x4434('0x3e')](_0x4b0b6f[_0x4434('0x49')][_0x2f97f3['id']])){_0x4b0b6f[_0x4434('0x49')][_0x2f97f3['id']]=new ZohoAccount(_0x2f97f3);}else{_0x4b0b6f[_0x4434('0x3f')](_0x4b0b6f[_0x4434('0x49')][_0x2f97f3['id']],_0x2f97f3);}}}return _0x4b0b6f[_0x4434('0x49')];};};Realtime['prototype'][_0x4434('0x4a')]=function(){var _0x3683ab=this;return function(_0x4191c5){if(_0x4191c5){freeIsNotKey(_0x4191c5,_0x3683ab[_0x4434('0x1f')],'id');for(var _0x59dcd7=0x0,_0x19185b={},_0xd7e790={};_0x59dcd7<_0x4191c5[_0x4434('0x41')];_0x59dcd7+=0x1){_0x19185b=_0x4191c5[_0x59dcd7];if(_[_0x4434('0x3e')](_0x3683ab[_0x4434('0x1f')][_0x19185b['id']])){_0x3683ab[_0x4434('0x1f')][_0x19185b['id']]=new DeskAccount(_0x19185b);}else{_0x3683ab[_0x4434('0x3f')](_0x3683ab[_0x4434('0x1f')][_0x19185b['id']],_0x19185b);}}}return _0x3683ab['deskAccounts'];};};Realtime[_0x4434('0x3d')][_0x4434('0x4b')]=function(){var _0x1b43d9=this;return function(_0x525931){if(_0x525931){freeIsNotKey(_0x525931,_0x1b43d9['sugarcrmAccounts'],'id');for(var _0x3f0967=0x0,_0x377dc2={},_0x2aa667={};_0x3f0967<_0x525931[_0x4434('0x41')];_0x3f0967+=0x1){_0x377dc2=_0x525931[_0x3f0967];if(_[_0x4434('0x3e')](_0x1b43d9[_0x4434('0x1d')][_0x377dc2['id']])){_0x1b43d9[_0x4434('0x1d')][_0x377dc2['id']]=new SugarcrmAccount(_0x377dc2);}else{_0x1b43d9['mergeFromDatabase'](_0x1b43d9[_0x4434('0x1d')][_0x377dc2['id']],_0x377dc2);}}}return _0x1b43d9[_0x4434('0x1d')];};};Realtime[_0x4434('0x3d')]['initVtigerAccounts']=function(){var _0x24aa32=this;return function(_0x562959){if(_0x562959){freeIsNotKey(_0x562959,_0x24aa32[_0x4434('0x20')],'id');for(var _0x344281=0x0,_0x2a5a3b={},_0x2e5c79={};_0x344281<_0x562959[_0x4434('0x41')];_0x344281+=0x1){_0x2a5a3b=_0x562959[_0x344281];if(_[_0x4434('0x3e')](_0x24aa32[_0x4434('0x20')][_0x2a5a3b['id']])){_0x24aa32[_0x4434('0x20')][_0x2a5a3b['id']]=new VtigerAccount(_0x2a5a3b);}else{_0x24aa32[_0x4434('0x3f')](_0x24aa32['vtigerAccounts'][_0x2a5a3b['id']],_0x2a5a3b);}}}return _0x24aa32[_0x4434('0x20')];};};Realtime[_0x4434('0x3d')][_0x4434('0x4c')]=function(){var _0x26b7b7=this;return function(_0x3d12aa){if(_0x3d12aa){freeIsNotKey(_0x3d12aa,_0x26b7b7['servicenowAccounts'],'id');for(var _0x579bf9=0x0,_0x50c736={},_0x29a7e1={};_0x579bf9<_0x3d12aa[_0x4434('0x41')];_0x579bf9+=0x1){_0x50c736=_0x3d12aa[_0x579bf9];if(_[_0x4434('0x3e')](_0x26b7b7[_0x4434('0x4d')][_0x50c736['id']])){_0x26b7b7['servicenowAccounts'][_0x50c736['id']]=new ServicenowAccount(_0x50c736);}else{_0x26b7b7[_0x4434('0x3f')](_0x26b7b7[_0x4434('0x4d')][_0x50c736['id']],_0x50c736);}}}return _0x26b7b7[_0x4434('0x4d')];};};Realtime[_0x4434('0x3d')][_0x4434('0x4e')]=function(){var _0x561d85=this;return function(_0x877527){if(_0x877527){freeIsNotKey(_0x877527,_0x561d85['dynamics365Accounts'],'id');for(var _0x4b4a29=0x0,_0x52c90a={},_0xa7deec={};_0x4b4a29<_0x877527['length'];_0x4b4a29+=0x1){_0x52c90a=_0x877527[_0x4b4a29];if(_[_0x4434('0x3e')](_0x561d85[_0x4434('0x21')][_0x52c90a['id']])){_0x561d85[_0x4434('0x21')][_0x52c90a['id']]=new Dynamics365Account(_0x52c90a);}else{_0x561d85[_0x4434('0x3f')](_0x561d85[_0x4434('0x21')][_0x52c90a['id']],_0x52c90a);}}}return _0x561d85['dynamics365Accounts'];};};Realtime[_0x4434('0x3d')][_0x4434('0x4f')]=function(){var _0x42af40=this;return function(_0x1ec47c){if(_0x1ec47c){freeIsNotKey(_0x1ec47c,_0x42af40['freshsalesAccounts'],'id');for(var _0x55dc1c=0x0,_0x7488e4={},_0x43d0bc={};_0x55dc1c<_0x1ec47c[_0x4434('0x41')];_0x55dc1c+=0x1){_0x7488e4=_0x1ec47c[_0x55dc1c];if(_['isUndefined'](_0x42af40['freshsalesAccounts'][_0x7488e4['id']])){_0x42af40[_0x4434('0x22')][_0x7488e4['id']]=new FreshsalesAccount(_0x7488e4);}else{_0x42af40['mergeFromDatabase'](_0x42af40[_0x4434('0x22')][_0x7488e4['id']],_0x7488e4);}}}return _0x42af40[_0x4434('0x22')];};};Realtime['prototype'][_0x4434('0x50')]=function(){var _0x5b1c29=this;return function(_0x234ceb){for(var _0xd65137=0x0;_0xd65137<_0x234ceb['length'];_0xd65137+=0x1){_[_0x4434('0x51')](_0x5b1c29[_0x4434('0x14')][_0x234ceb[_0xd65137]['name']],_0x234ceb[_0xd65137]);}return _0x5b1c29[_0x4434('0x14')];};};Realtime[_0x4434('0x3d')][_0x4434('0x52')]=function(){var _0x5e61f5=this;return function(_0x41f91c){clearVoiceQueues(_0x5e61f5[_0x4434('0x14')]);if(_0x41f91c){_0x41f91c=_[_0x4434('0x53')](_0x41f91c,'uniqueid');for(var _0x333cb5 in _0x41f91c){if(_0x41f91c['hasOwnProperty'](_0x333cb5)){var _0x13ea8a={};for(var _0x22175c=0x0;_0x22175c<_0x41f91c[_0x333cb5]['length'];_0x22175c+=0x1){var _0x4f1403=_0x41f91c[_0x333cb5][_0x22175c][_0x4434('0x54')];if(_0x5e61f5[_0x4434('0x14')][_0x4f1403]){if(_0x41f91c[_0x333cb5][_0x22175c][_0x4434('0x55')]){_0x5e61f5[_0x4434('0x14')][_0x4f1403]['unmanaged']+=0x1;}if(_0x41f91c[_0x333cb5][_0x22175c][_0x4434('0x56')]){_0x5e61f5[_0x4434('0x14')][_0x4f1403][_0x4434('0x32')]+=0x1;}_0x5e61f5[_0x4434('0x14')][_0x4f1403][_0x4434('0x2c')]+=moment(_0x41f91c[_0x333cb5][_0x22175c][_0x4434('0x57')])[_0x4434('0x58')](moment(_0x41f91c[_0x333cb5][_0x22175c][_0x4434('0x59')]),'seconds')||0x0;if(_0x22175c===_0x41f91c[_0x333cb5][_0x4434('0x41')]-0x1){_0x5e61f5[_0x4434('0x14')][_0x4f1403]['sumDuration']+=moment(_0x41f91c[_0x333cb5][_0x22175c][_0x4434('0x5a')]||_0x41f91c[_0x333cb5][_0x22175c][_0x4434('0x5b')]||_0x41f91c[_0x333cb5][_0x22175c]['queuecallerexitAt'])[_0x4434('0x58')](moment(_0x41f91c[_0x333cb5][_0x22175c][_0x4434('0x59')]),_0x4434('0x5c'))||0x0;_0x5e61f5[_0x4434('0x14')][_0x4f1403][_0x4434('0x2a')]+=0x1;if(_0x41f91c[_0x333cb5][_0x22175c][_0x4434('0x5d')]){_0x5e61f5[_0x4434('0x14')][_0x4f1403][_0x4434('0x2b')]+=0x1;_0x5e61f5[_0x4434('0x14')][_0x4f1403][_0x4434('0x2e')]+=moment(_0x41f91c[_0x333cb5][_0x22175c][_0x4434('0x5a')])['diff'](moment(_0x41f91c[_0x333cb5][_0x22175c][_0x4434('0x57')]),_0x4434('0x5c'))||0x0;}}else{_0x5e61f5[_0x4434('0x14')][_0x4f1403]['sumDuration']+=_0x5e61f5[_0x4434('0x14')][_0x4f1403][_0x4434('0x2c')]||0x0;}}}}}}return _0x5e61f5[_0x4434('0x14')];};};Realtime[_0x4434('0x3d')][_0x4434('0x5e')]=function(){var _0x587292=this;return function(_0x58b87a){clearVoiceCallReports(_0x587292[_0x4434('0x5f')]);if(_0x58b87a){for(var _0x27a54b=0x0;_0x27a54b<_0x58b87a['length'];_0x27a54b+=0x1){_0x587292[_0x4434('0x5f')][_0x4434('0x2a')]+=0x1;_0x587292[_0x4434('0x5f')][_0x4434('0x2d')]+=_0x58b87a[_0x27a54b][_0x4434('0x60')];if(_0x58b87a[_0x27a54b][_0x4434('0x61')]===_0x4434('0x62')){_0x587292['outbound']['answered']+=0x1;_0x587292[_0x4434('0x5f')]['sumHoldTime']+=_0x58b87a[_0x27a54b][_0x4434('0x60')]-_0x58b87a[_0x27a54b][_0x4434('0x63')]||0x0;_0x587292[_0x4434('0x5f')][_0x4434('0x2e')]+=_0x58b87a[_0x27a54b][_0x4434('0x63')];}}}return _0x587292[_0x4434('0x5f')];};};Realtime[_0x4434('0x3d')]['initCampaigns']=function(){var _0x2cb844=this;return function(_0x40ac3e){if(_0x40ac3e){freeIsNotKey(_0x40ac3e,_0x2cb844[_0x4434('0x15')],_0x4434('0x27'));for(var _0x2cc2a8=0x0,_0x4bda55={};_0x2cc2a8<_0x40ac3e[_0x4434('0x41')];_0x2cc2a8+=0x1){_0x4bda55=_0x40ac3e[_0x2cc2a8];if(_[_0x4434('0x3e')](_0x2cb844['campaigns'][_0x4bda55[_0x4434('0x27')]])){_0x2cb844['campaigns'][_0x4bda55[_0x4434('0x27')]]=new Campaign(_0x4bda55);}else{_0x2cb844['mergeFromDatabase'](_0x2cb844[_0x4434('0x15')][_0x4bda55[_0x4434('0x27')]],_0x4bda55);_0x2cb844[_0x4434('0x15')][_0x4bda55[_0x4434('0x27')]]['dialQueueProject']=_0x4bda55[_0x4434('0x64')]?_0x4bda55['SquareProject'][_0x4434('0x27')]:undefined;}}}return _0x2cb844[_0x4434('0x15')];};};Realtime[_0x4434('0x3d')][_0x4434('0x65')]=function(){var _0x45961c=this;return function(_0x322107){if(_0x322107){freeIsNotKey(_0x322107,_0x45961c[_0x4434('0x17')],'id');for(var _0x1b1ea4=0x0,_0x1b37c6={};_0x1b1ea4<_0x322107[_0x4434('0x41')];_0x1b1ea4+=0x1){_0x1b37c6=_0x322107[_0x1b1ea4];if(_[_0x4434('0x3e')](_0x45961c[_0x4434('0x17')][_0x1b37c6['id']])){_0x45961c['voiceExtensions'][_0x1b37c6['id']]=new VoiceExtension(_0x1b37c6);}else{_0x45961c[_0x4434('0x3f')](_0x45961c['voiceExtensions'][_0x1b37c6['id']],_0x1b37c6);}}}return _0x45961c[_0x4434('0x17')];};};Realtime['prototype'][_0x4434('0x66')]=function(){var _0x5bb3f6=this;return function(_0x3c0064){clearCampaigns(_0x5bb3f6['campaigns']);for(var _0x576bad=0x0;_0x576bad<_0x3c0064['length'];_0x576bad+=0x1){_[_0x4434('0x51')](_0x5bb3f6[_0x4434('0x15')][_0x3c0064[_0x576bad]['name']],_0x3c0064[_0x576bad]);}return _0x5bb3f6[_0x4434('0x15')];};};Realtime[_0x4434('0x3d')][_0x4434('0x67')]=function(){var _0x781d6=this;return function(_0x1b0415){if(_0x1b0415){freeIsNotKey(_0x1b0415,_0x781d6[_0x4434('0x68')],'id');for(var _0x332715=0x0,_0xdb0bf6={},_0x46f927={};_0x332715<_0x1b0415[_0x4434('0x41')];_0x332715+=0x1){_0xdb0bf6=_0x1b0415[_0x332715];if(_[_0x4434('0x3e')](_0x781d6[_0x4434('0x68')][_0xdb0bf6['id']])){_0x781d6['faxAccounts'][_0xdb0bf6['id']]=new FaxAccount(_0xdb0bf6);}else{_0x781d6[_0x4434('0x3f')](_0x781d6[_0x4434('0x68')][_0xdb0bf6['id']],_0xdb0bf6);}}}return _0x781d6[_0x4434('0x68')];};};module[_0x4434('0x69')]=Realtime; \ No newline at end of file +var _0xa1ab=['queuecallerleaveAt','initVoiceCallReports','duration','ANSWERED','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','exports','lodash','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/faxAccount','trunks','voiceQueues','triggers','campaigns','outbound','voiceExtensions','queueChannels','outboundChannels','timers','zendeskAccounts','sugarcrmAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','SIP/%s','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','agents','length','isUndefined','prototype','initTelephones','telephones','initVoiceQueues','initTriggers','initTemplates','templates','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','queue','queuecallerexit','queuecallerabandon','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete'];(function(_0x5db80a,_0x1cc26d){var _0x5984fc=function(_0x233557){while(--_0x233557){_0x5db80a['push'](_0x5db80a['shift']());}};_0x5984fc(++_0x1cc26d);}(_0xa1ab,0x1ae));var _0xba1a=function(_0x5eba49,_0x55282f){_0x5eba49=_0x5eba49-0x0;var _0x2cc0d9=_0xa1ab[_0x5eba49];return _0x2cc0d9;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xba1a('0x0'));var moment=require('moment');var Agent=require(_0xba1a('0x1'));var Telephone=require(_0xba1a('0x2'));var Trunk=require(_0xba1a('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0xba1a('0x4'));var Template=require(_0xba1a('0x5'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0xba1a('0x6'));var ZendeskAccount=require(_0xba1a('0x7'));var SalesforceAccount=require(_0xba1a('0x8'));var FreshdeskAccount=require(_0xba1a('0x9'));var SugarcrmAccount=require(_0xba1a('0xa'));var ZohoAccount=require(_0xba1a('0xb'));var DeskAccount=require(_0xba1a('0xc'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xba1a('0xd'));var Realtime=function(){this['agents']={};this['telephones']={};this[_0xba1a('0xe')]={};this[_0xba1a('0xf')]={};this[_0xba1a('0x10')]={};this[_0xba1a('0x11')]={};this['templates']={};this[_0xba1a('0x12')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xba1a('0x13')]={};this['channels']={};this[_0xba1a('0x14')]={};this[_0xba1a('0x15')]={};this[_0xba1a('0x16')]={};this[_0xba1a('0x17')]={};this['salesforceAccounts']={};this[_0xba1a('0x18')]={};this['freshdeskAccounts']={};this[_0xba1a('0x19')]={};this['deskAccounts']={};this[_0xba1a('0x1a')]={};this[_0xba1a('0x1b')]={};this[_0xba1a('0x1c')]={};this[_0xba1a('0x1d')]={};this[_0xba1a('0x1e')]={};};function freeIsNotKey(_0x28a818,_0x127158,_0x58464f){var _0x511d8a=_[_0xba1a('0x1f')](_0x28a818,function(_0x27133c,_0x464dae){return _0x27133c[_0x58464f];});for(var _0x3434ed in _0x127158){if(_0x127158[_0xba1a('0x20')](_0x3434ed)){if(!_0x511d8a[_0x3434ed]){delete _0x127158[_0x3434ed];}}}}function freeIsNotKeySip(_0x5ea513,_0x72bde3){var _0x5099d8=_[_0xba1a('0x1f')](_0x5ea513,function(_0x15a068,_0x27a73b){return util[_0xba1a('0x21')]('SIP/%s',_0x15a068[_0xba1a('0x22')]);});for(var _0x59b48d in _0x72bde3){if(_0x72bde3[_0xba1a('0x20')](_0x59b48d)){if(!_0x5099d8[_0x59b48d]){delete _0x72bde3[_0x59b48d];}}}}function freeIsNotKeyAgent(_0x78ac04,_0x3f37f7){var _0x435b94=_[_0xba1a('0x1f')](_0x78ac04,function(_0x24d5c2,_0x4d77e2){var _0x11a6f2=_[_0xba1a('0x23')](_0x24d5c2[_0xba1a('0x24')])?util[_0xba1a('0x21')](_0xba1a('0x25'),_0x24d5c2['name']):_0x24d5c2['interface'];return _0x11a6f2;});for(var _0x1805b0 in _0x3f37f7){if(_0x3f37f7['hasOwnProperty'](_0x1805b0)){if(!_0x435b94[_0x1805b0]){delete _0x3f37f7[_0x1805b0];}}}}function clearVoiceCallReports(_0x5af364){_0x5af364[_0xba1a('0x26')]=0x0;_0x5af364[_0xba1a('0x27')]=0x0;_0x5af364[_0xba1a('0x28')]=0x0;_0x5af364[_0xba1a('0x29')]=0x0;_0x5af364[_0xba1a('0x2a')]=0x0;}function clearCampaigns(_0x545633){if(!_[_0xba1a('0x2b')](_0x545633)){for(var _0x50069a in _0x545633){if(_0x545633['hasOwnProperty'](_0x50069a)){_0x545633[_0x50069a][_0xba1a('0x2c')]=0x0;_0x545633[_0x50069a][_0xba1a('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x2b1469){if(!_[_0xba1a('0x2b')](_0x2b1469)){for(var _0x405ab4 in _0x2b1469){if(_0x2b1469[_0xba1a('0x20')](_0x405ab4)){_0x2b1469[_0x405ab4][_0xba1a('0x26')]=0x0;_0x2b1469[_0x405ab4]['answered']=0x0;_0x2b1469[_0x405ab4]['unmanaged']=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x2e')]=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x28')]=0x0;_0x2b1469[_0x405ab4]['sumDuration']=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x2a')]=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x2f')]=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x30')]=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x31')]=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x32')]=0x0;_0x2b1469[_0x405ab4]['outboundNoSuchCallsDay']=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x33')]=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x34')]=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x35')]=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x36')]=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x37')]=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x38')]=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x39')]=0x0;_0x2b1469[_0x405ab4]['outboundAnswerAgiCallsDay']=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x3a')]=0x0;_0x2b1469[_0x405ab4][_0xba1a('0x3b')]=!![];}}}}Realtime['prototype'][_0xba1a('0x3c')]=function(_0x2a6b82,_0x58eecb){for(var _0x63126e in _0x58eecb){if(_0x2a6b82[_0xba1a('0x20')](_0x63126e)){_0x2a6b82[_0x63126e]=_0x58eecb[_0x63126e];}}};Realtime['prototype'][_0xba1a('0x3d')]=function(){var _0xcc27d3=this;return function(_0x5cf891){if(_0x5cf891){freeIsNotKeyAgent(_0x5cf891,_0xcc27d3[_0xba1a('0x3e')]);for(var _0x345326=0x0,_0x26382c={},_0x52a308={};_0x345326<_0x5cf891[_0xba1a('0x3f')];_0x345326+=0x1){_0x26382c=_0x5cf891[_0x345326];var _0x3f5e1f=_[_0xba1a('0x23')](_0x26382c[_0xba1a('0x24')])?util['format']('SIP/%s',_0x26382c[_0xba1a('0x22')]):_0x26382c[_0xba1a('0x24')];if(_[_0xba1a('0x40')](_0xcc27d3[_0xba1a('0x3e')][_0x3f5e1f])){_0xcc27d3['agents'][_0x3f5e1f]=new Agent(_0x26382c);}else{_0xcc27d3[_0xba1a('0x3c')](_0xcc27d3[_0xba1a('0x3e')][_0x3f5e1f],_0x26382c);}}}return _0xcc27d3[_0xba1a('0x3e')];};};Realtime[_0xba1a('0x41')][_0xba1a('0x42')]=function(){var _0x31ab76=this;return function(_0x2fe79c){if(_0x2fe79c){freeIsNotKeySip(_0x2fe79c,_0x31ab76['telephones']);for(var _0x573642=0x0,_0x2bbdf0={},_0x18b659={};_0x573642<_0x2fe79c[_0xba1a('0x3f')];_0x573642+=0x1){_0x2bbdf0=_0x2fe79c[_0x573642];if(_[_0xba1a('0x40')](_0x31ab76[_0xba1a('0x43')][util[_0xba1a('0x21')](_0xba1a('0x25'),_0x2bbdf0[_0xba1a('0x22')])])){_0x31ab76[_0xba1a('0x43')][util[_0xba1a('0x21')](_0xba1a('0x25'),_0x2bbdf0[_0xba1a('0x22')])]=new Telephone(_0x2bbdf0);}else{_0x31ab76[_0xba1a('0x3c')](_0x31ab76[_0xba1a('0x43')][util[_0xba1a('0x21')](_0xba1a('0x25'),_0x2bbdf0[_0xba1a('0x22')])],_0x2bbdf0);}}}return _0x31ab76[_0xba1a('0x43')];};};Realtime[_0xba1a('0x41')]['initTrunks']=function(){var _0x3d1b8a=this;return function(_0x45b84e){if(_0x45b84e){freeIsNotKeySip(_0x45b84e,_0x3d1b8a[_0xba1a('0xe')]);for(var _0x5d9943=0x0,_0x4c1fc4={},_0x45a22f={};_0x5d9943<_0x45b84e[_0xba1a('0x3f')];_0x5d9943+=0x1){_0x4c1fc4=_0x45b84e[_0x5d9943];if(_[_0xba1a('0x40')](_0x3d1b8a[_0xba1a('0xe')][util['format']('SIP/%s',_0x4c1fc4[_0xba1a('0x22')])])){_0x3d1b8a['trunks'][util['format'](_0xba1a('0x25'),_0x4c1fc4['name'])]=new Trunk(_0x4c1fc4);}else{_0x3d1b8a[_0xba1a('0x3c')](_0x3d1b8a[_0xba1a('0xe')][util['format'](_0xba1a('0x25'),_0x4c1fc4[_0xba1a('0x22')])],_0x4c1fc4);}}}return _0x3d1b8a['trunks'];};};Realtime[_0xba1a('0x41')][_0xba1a('0x44')]=function(){var _0x37e0b5=this;return function(_0x57384c){if(_0x57384c){freeIsNotKey(_0x57384c,_0x37e0b5[_0xba1a('0xf')],'name');for(var _0x116ee4=0x0,_0x13ebdd={},_0x3e1995={};_0x116ee4<_0x57384c[_0xba1a('0x3f')];_0x116ee4+=0x1){_0x13ebdd=_0x57384c[_0x116ee4];if(_['isUndefined'](_0x37e0b5[_0xba1a('0xf')][_0x13ebdd[_0xba1a('0x22')]])){_0x37e0b5[_0xba1a('0xf')][_0x13ebdd[_0xba1a('0x22')]]=new VoiceQueue(_0x13ebdd);}else{_0x37e0b5[_0xba1a('0x3c')](_0x37e0b5[_0xba1a('0xf')][_0x13ebdd['name']],_0x13ebdd);}}}return _0x37e0b5[_0xba1a('0xf')];};};Realtime[_0xba1a('0x41')][_0xba1a('0x45')]=function(){var _0x4dc0e4=this;return function(_0x4ab269){if(_0x4ab269){freeIsNotKey(_0x4ab269,_0x4dc0e4[_0xba1a('0x10')],'id');for(var _0x388589=0x0,_0x54d60b={},_0x4fcc23={};_0x388589<_0x4ab269[_0xba1a('0x3f')];_0x388589+=0x1){_0x54d60b=_0x4ab269[_0x388589];if(_[_0xba1a('0x40')](_0x4dc0e4['triggers'][_0x54d60b['id']])){_0x4dc0e4[_0xba1a('0x10')][_0x54d60b['id']]=new Trigger(_0x54d60b);}else{_0x4dc0e4[_0xba1a('0x3c')](_0x4dc0e4[_0xba1a('0x10')][_0x54d60b['id']],_0x54d60b);}}}return _0x4dc0e4[_0xba1a('0x10')];};};Realtime[_0xba1a('0x41')][_0xba1a('0x46')]=function(){var _0x243586=this;return function(_0x7e5cce){if(_0x7e5cce){freeIsNotKey(_0x7e5cce,_0x243586[_0xba1a('0x47')],'id');for(var _0x4f1ed3=0x0,_0x3001c6={},_0x473019={};_0x4f1ed3<_0x7e5cce[_0xba1a('0x3f')];_0x4f1ed3+=0x1){_0x3001c6=_0x7e5cce[_0x4f1ed3];if(_[_0xba1a('0x40')](_0x243586['templates'][_0x3001c6['id']])){_0x243586[_0xba1a('0x47')][_0x3001c6['id']]=new Template(_0x3001c6);}else{_0x243586['mergeFromDatabase'](_0x243586['templates'][_0x3001c6['id']],_0x3001c6);}}}return _0x243586['templates'];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0x17e191=this;return function(_0x5d2837){if(_0x5d2837){freeIsNotKey(_0x5d2837,_0x17e191[_0xba1a('0x17')],'id');for(var _0x11612e=0x0,_0x544d4a={},_0x4c2692={};_0x11612e<_0x5d2837[_0xba1a('0x3f')];_0x11612e+=0x1){_0x544d4a=_0x5d2837[_0x11612e];if(_[_0xba1a('0x40')](_0x17e191[_0xba1a('0x17')][_0x544d4a['id']])){_0x17e191[_0xba1a('0x17')][_0x544d4a['id']]=new ZendeskAccount(_0x544d4a);}else{_0x17e191[_0xba1a('0x3c')](_0x17e191['zendeskAccounts'][_0x544d4a['id']],_0x544d4a);}}}return _0x17e191[_0xba1a('0x17')];};};Realtime['prototype'][_0xba1a('0x48')]=function(){var _0x426d9c=this;return function(_0x328b6a){if(_0x328b6a){freeIsNotKey(_0x328b6a,_0x426d9c[_0xba1a('0x49')],'id');for(var _0x2c1261=0x0,_0x5b2d46={},_0x215751={};_0x2c1261<_0x328b6a[_0xba1a('0x3f')];_0x2c1261+=0x1){_0x5b2d46=_0x328b6a[_0x2c1261];if(_[_0xba1a('0x40')](_0x426d9c[_0xba1a('0x49')][_0x5b2d46['id']])){_0x426d9c[_0xba1a('0x49')][_0x5b2d46['id']]=new SalesforceAccount(_0x5b2d46);}else{_0x426d9c['mergeFromDatabase'](_0x426d9c['salesforceAccounts'][_0x5b2d46['id']],_0x5b2d46);}}}return _0x426d9c[_0xba1a('0x49')];};};Realtime['prototype'][_0xba1a('0x4a')]=function(){var _0x1cb404=this;return function(_0x52942d){if(_0x52942d){freeIsNotKey(_0x52942d,_0x1cb404['freshdeskAccounts'],'id');for(var _0x332036=0x0,_0x4c57a8={},_0x5ce3b9={};_0x332036<_0x52942d[_0xba1a('0x3f')];_0x332036+=0x1){_0x4c57a8=_0x52942d[_0x332036];if(_['isUndefined'](_0x1cb404[_0xba1a('0x4b')][_0x4c57a8['id']])){_0x1cb404['freshdeskAccounts'][_0x4c57a8['id']]=new FreshdeskAccount(_0x4c57a8);}else{_0x1cb404[_0xba1a('0x3c')](_0x1cb404[_0xba1a('0x4b')][_0x4c57a8['id']],_0x4c57a8);}}}return _0x1cb404['freshdeskAccounts'];};};Realtime['prototype'][_0xba1a('0x4c')]=function(){var _0x499281=this;return function(_0x335059){if(_0x335059){freeIsNotKey(_0x335059,_0x499281['zohoAccounts'],'id');for(var _0x58af3d=0x0,_0x2fc2a9={},_0x3cf85e={};_0x58af3d<_0x335059['length'];_0x58af3d+=0x1){_0x2fc2a9=_0x335059[_0x58af3d];if(_[_0xba1a('0x40')](_0x499281['zohoAccounts'][_0x2fc2a9['id']])){_0x499281[_0xba1a('0x19')][_0x2fc2a9['id']]=new ZohoAccount(_0x2fc2a9);}else{_0x499281[_0xba1a('0x3c')](_0x499281[_0xba1a('0x19')][_0x2fc2a9['id']],_0x2fc2a9);}}}return _0x499281[_0xba1a('0x19')];};};Realtime[_0xba1a('0x41')][_0xba1a('0x4d')]=function(){var _0x402010=this;return function(_0x30bf93){if(_0x30bf93){freeIsNotKey(_0x30bf93,_0x402010[_0xba1a('0x4e')],'id');for(var _0x2e28c4=0x0,_0x1e46b7={},_0x1564c5={};_0x2e28c4<_0x30bf93['length'];_0x2e28c4+=0x1){_0x1e46b7=_0x30bf93[_0x2e28c4];if(_['isUndefined'](_0x402010[_0xba1a('0x4e')][_0x1e46b7['id']])){_0x402010[_0xba1a('0x4e')][_0x1e46b7['id']]=new DeskAccount(_0x1e46b7);}else{_0x402010[_0xba1a('0x3c')](_0x402010[_0xba1a('0x4e')][_0x1e46b7['id']],_0x1e46b7);}}}return _0x402010[_0xba1a('0x4e')];};};Realtime[_0xba1a('0x41')][_0xba1a('0x4f')]=function(){var _0x50b860=this;return function(_0x5846a4){if(_0x5846a4){freeIsNotKey(_0x5846a4,_0x50b860[_0xba1a('0x18')],'id');for(var _0x23c221=0x0,_0x378298={},_0x3cf6f3={};_0x23c221<_0x5846a4[_0xba1a('0x3f')];_0x23c221+=0x1){_0x378298=_0x5846a4[_0x23c221];if(_[_0xba1a('0x40')](_0x50b860[_0xba1a('0x18')][_0x378298['id']])){_0x50b860[_0xba1a('0x18')][_0x378298['id']]=new SugarcrmAccount(_0x378298);}else{_0x50b860[_0xba1a('0x3c')](_0x50b860[_0xba1a('0x18')][_0x378298['id']],_0x378298);}}}return _0x50b860[_0xba1a('0x18')];};};Realtime[_0xba1a('0x41')][_0xba1a('0x50')]=function(){var _0x26858e=this;return function(_0x475675){if(_0x475675){freeIsNotKey(_0x475675,_0x26858e[_0xba1a('0x1a')],'id');for(var _0x5c39cf=0x0,_0x2680fc={},_0x2987f5={};_0x5c39cf<_0x475675[_0xba1a('0x3f')];_0x5c39cf+=0x1){_0x2680fc=_0x475675[_0x5c39cf];if(_[_0xba1a('0x40')](_0x26858e[_0xba1a('0x1a')][_0x2680fc['id']])){_0x26858e['vtigerAccounts'][_0x2680fc['id']]=new VtigerAccount(_0x2680fc);}else{_0x26858e[_0xba1a('0x3c')](_0x26858e[_0xba1a('0x1a')][_0x2680fc['id']],_0x2680fc);}}}return _0x26858e[_0xba1a('0x1a')];};};Realtime[_0xba1a('0x41')][_0xba1a('0x51')]=function(){var _0x295fdc=this;return function(_0x266dff){if(_0x266dff){freeIsNotKey(_0x266dff,_0x295fdc[_0xba1a('0x1b')],'id');for(var _0x1fdb47=0x0,_0x3d14fe={},_0x197c14={};_0x1fdb47<_0x266dff[_0xba1a('0x3f')];_0x1fdb47+=0x1){_0x3d14fe=_0x266dff[_0x1fdb47];if(_[_0xba1a('0x40')](_0x295fdc[_0xba1a('0x1b')][_0x3d14fe['id']])){_0x295fdc[_0xba1a('0x1b')][_0x3d14fe['id']]=new ServicenowAccount(_0x3d14fe);}else{_0x295fdc['mergeFromDatabase'](_0x295fdc[_0xba1a('0x1b')][_0x3d14fe['id']],_0x3d14fe);}}}return _0x295fdc[_0xba1a('0x1b')];};};Realtime['prototype'][_0xba1a('0x52')]=function(){var _0x3aaeff=this;return function(_0x2ba468){if(_0x2ba468){freeIsNotKey(_0x2ba468,_0x3aaeff[_0xba1a('0x1c')],'id');for(var _0x5049f4=0x0,_0x9d835c={},_0x114bb1={};_0x5049f4<_0x2ba468[_0xba1a('0x3f')];_0x5049f4+=0x1){_0x9d835c=_0x2ba468[_0x5049f4];if(_[_0xba1a('0x40')](_0x3aaeff[_0xba1a('0x1c')][_0x9d835c['id']])){_0x3aaeff[_0xba1a('0x1c')][_0x9d835c['id']]=new Dynamics365Account(_0x9d835c);}else{_0x3aaeff[_0xba1a('0x3c')](_0x3aaeff['dynamics365Accounts'][_0x9d835c['id']],_0x9d835c);}}}return _0x3aaeff[_0xba1a('0x1c')];};};Realtime[_0xba1a('0x41')]['initFreshsalesAccounts']=function(){var _0x4c0387=this;return function(_0x328f16){if(_0x328f16){freeIsNotKey(_0x328f16,_0x4c0387[_0xba1a('0x1d')],'id');for(var _0x109599=0x0,_0xa38df5={},_0xbffd4c={};_0x109599<_0x328f16['length'];_0x109599+=0x1){_0xa38df5=_0x328f16[_0x109599];if(_[_0xba1a('0x40')](_0x4c0387[_0xba1a('0x1d')][_0xa38df5['id']])){_0x4c0387[_0xba1a('0x1d')][_0xa38df5['id']]=new FreshsalesAccount(_0xa38df5);}else{_0x4c0387[_0xba1a('0x3c')](_0x4c0387[_0xba1a('0x1d')][_0xa38df5['id']],_0xa38df5);}}}return _0x4c0387[_0xba1a('0x1d')];};};Realtime[_0xba1a('0x41')][_0xba1a('0x53')]=function(){var _0x131bf=this;return function(_0x5f4674){for(var _0x129ae7=0x0;_0x129ae7<_0x5f4674[_0xba1a('0x3f')];_0x129ae7+=0x1){_['merge'](_0x131bf['voiceQueues'][_0x5f4674[_0x129ae7][_0xba1a('0x22')]],_0x5f4674[_0x129ae7]);}return _0x131bf['voiceQueues'];};};Realtime[_0xba1a('0x41')][_0xba1a('0x54')]=function(){var _0xba951a=this;return function(_0x575324){clearVoiceQueues(_0xba951a[_0xba1a('0xf')]);if(_0x575324){_0x575324=_[_0xba1a('0x55')](_0x575324,'uniqueid');for(var _0x18ea6b in _0x575324){if(_0x575324[_0xba1a('0x20')](_0x18ea6b)){var _0x1ed222={};for(var _0x45c901=0x0;_0x45c901<_0x575324[_0x18ea6b][_0xba1a('0x3f')];_0x45c901+=0x1){var _0x117c98=_0x575324[_0x18ea6b][_0x45c901][_0xba1a('0x56')];if(_0xba951a[_0xba1a('0xf')][_0x117c98]){if(_0x575324[_0x18ea6b][_0x45c901][_0xba1a('0x57')]){_0xba951a['voiceQueues'][_0x117c98]['unmanaged']+=0x1;}if(_0x575324[_0x18ea6b][_0x45c901][_0xba1a('0x58')]){_0xba951a[_0xba1a('0xf')][_0x117c98][_0xba1a('0x2e')]+=0x1;}_0xba951a[_0xba1a('0xf')][_0x117c98][_0xba1a('0x28')]+=moment(_0x575324[_0x18ea6b][_0x45c901]['queuecallerleaveAt'])[_0xba1a('0x59')](moment(_0x575324[_0x18ea6b][_0x45c901]['queuecallerjoinAt']),_0xba1a('0x5a'))||0x0;if(_0x45c901===_0x575324[_0x18ea6b][_0xba1a('0x3f')]-0x1){_0xba951a[_0xba1a('0xf')][_0x117c98][_0xba1a('0x29')]+=moment(_0x575324[_0x18ea6b][_0x45c901][_0xba1a('0x5b')]||_0x575324[_0x18ea6b][_0x45c901]['queuecallerabandonAt']||_0x575324[_0x18ea6b][_0x45c901][_0xba1a('0x5c')])[_0xba1a('0x59')](moment(_0x575324[_0x18ea6b][_0x45c901][_0xba1a('0x5d')]),'seconds')||0x0;_0xba951a[_0xba1a('0xf')][_0x117c98][_0xba1a('0x26')]+=0x1;if(_0x575324[_0x18ea6b][_0x45c901][_0xba1a('0x5e')]){_0xba951a[_0xba1a('0xf')][_0x117c98][_0xba1a('0x27')]+=0x1;_0xba951a[_0xba1a('0xf')][_0x117c98][_0xba1a('0x2a')]+=moment(_0x575324[_0x18ea6b][_0x45c901][_0xba1a('0x5b')])['diff'](moment(_0x575324[_0x18ea6b][_0x45c901][_0xba1a('0x5f')]),_0xba1a('0x5a'))||0x0;}}else{_0xba951a[_0xba1a('0xf')][_0x117c98][_0xba1a('0x29')]+=_0xba951a[_0xba1a('0xf')][_0x117c98][_0xba1a('0x28')]||0x0;}}}}}}return _0xba951a['voiceQueues'];};};Realtime[_0xba1a('0x41')][_0xba1a('0x60')]=function(){var _0xd21272=this;return function(_0x3a1e73){clearVoiceCallReports(_0xd21272[_0xba1a('0x12')]);if(_0x3a1e73){for(var _0x5c4f7f=0x0;_0x5c4f7f<_0x3a1e73[_0xba1a('0x3f')];_0x5c4f7f+=0x1){_0xd21272['outbound'][_0xba1a('0x26')]+=0x1;_0xd21272['outbound'][_0xba1a('0x29')]+=_0x3a1e73[_0x5c4f7f][_0xba1a('0x61')];if(_0x3a1e73[_0x5c4f7f]['disposition']===_0xba1a('0x62')){_0xd21272[_0xba1a('0x12')][_0xba1a('0x27')]+=0x1;_0xd21272['outbound']['sumHoldTime']+=_0x3a1e73[_0x5c4f7f]['duration']-_0x3a1e73[_0x5c4f7f][_0xba1a('0x63')]||0x0;_0xd21272['outbound'][_0xba1a('0x2a')]+=_0x3a1e73[_0x5c4f7f][_0xba1a('0x63')];}}}return _0xd21272[_0xba1a('0x12')];};};Realtime['prototype']['initCampaigns']=function(){var _0x5ed6d1=this;return function(_0x1525be){if(_0x1525be){freeIsNotKey(_0x1525be,_0x5ed6d1[_0xba1a('0x11')],_0xba1a('0x22'));for(var _0x5d668d=0x0,_0x53de40={};_0x5d668d<_0x1525be[_0xba1a('0x3f')];_0x5d668d+=0x1){_0x53de40=_0x1525be[_0x5d668d];if(_[_0xba1a('0x40')](_0x5ed6d1[_0xba1a('0x11')][_0x53de40[_0xba1a('0x22')]])){_0x5ed6d1[_0xba1a('0x11')][_0x53de40[_0xba1a('0x22')]]=new Campaign(_0x53de40);}else{_0x5ed6d1[_0xba1a('0x3c')](_0x5ed6d1[_0xba1a('0x11')][_0x53de40['name']],_0x53de40);_0x5ed6d1[_0xba1a('0x11')][_0x53de40[_0xba1a('0x22')]][_0xba1a('0x64')]=_0x53de40['SquareProject']?_0x53de40[_0xba1a('0x65')][_0xba1a('0x22')]:undefined;}}}return _0x5ed6d1[_0xba1a('0x11')];};};Realtime[_0xba1a('0x41')][_0xba1a('0x66')]=function(){var _0x331b90=this;return function(_0x71e03a){if(_0x71e03a){freeIsNotKey(_0x71e03a,_0x331b90['voiceExtensions'],'id');for(var _0x56ba94=0x0,_0x5a10de={};_0x56ba94<_0x71e03a[_0xba1a('0x3f')];_0x56ba94+=0x1){_0x5a10de=_0x71e03a[_0x56ba94];if(_[_0xba1a('0x40')](_0x331b90['voiceExtensions'][_0x5a10de['id']])){_0x331b90[_0xba1a('0x13')][_0x5a10de['id']]=new VoiceExtension(_0x5a10de);}else{_0x331b90[_0xba1a('0x3c')](_0x331b90[_0xba1a('0x13')][_0x5a10de['id']],_0x5a10de);}}}return _0x331b90[_0xba1a('0x13')];};};Realtime[_0xba1a('0x41')][_0xba1a('0x67')]=function(){var _0x3e4887=this;return function(_0x30bd34){clearCampaigns(_0x3e4887[_0xba1a('0x11')]);for(var _0x48829e=0x0;_0x48829e<_0x30bd34[_0xba1a('0x3f')];_0x48829e+=0x1){_['merge'](_0x3e4887['campaigns'][_0x30bd34[_0x48829e][_0xba1a('0x22')]],_0x30bd34[_0x48829e]);}return _0x3e4887[_0xba1a('0x11')];};};Realtime[_0xba1a('0x41')]['initFaxAccounts']=function(){var _0x12fe95=this;return function(_0x22d33c){if(_0x22d33c){freeIsNotKey(_0x22d33c,_0x12fe95[_0xba1a('0x1e')],'id');for(var _0x905965=0x0,_0x2532f7={},_0x575ea4={};_0x905965<_0x22d33c[_0xba1a('0x3f')];_0x905965+=0x1){_0x2532f7=_0x22d33c[_0x905965];if(_['isUndefined'](_0x12fe95[_0xba1a('0x1e')][_0x2532f7['id']])){_0x12fe95[_0xba1a('0x1e')][_0x2532f7['id']]=new FaxAccount(_0x2532f7);}else{_0x12fe95['mergeFromDatabase'](_0x12fe95[_0xba1a('0x1e')][_0x2532f7['id']],_0x2532f7);}}}return _0x12fe95[_0xba1a('0x1e')];};};module[_0xba1a('0x68')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 13428f3..38d353c 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 _0xd081=['moment','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','accountcode','name','isNil','find','interface','SIP/%s','length','assigned','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','destination','exten','type','dialer','lastapplication','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridnum','originatecalleridnum','destinationchannel','channel','calleridpreview','disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','linkedid','uniqueid','transfers','monitor','monitorFilename','monitors','filename','connectedlinename','membername','xcally-motion-dialer','voiceAgentReport','forEach','startsWith','Local','indexOf','mobile','phone','substring','lastIndexOf','transfererlinkedid'];(function(_0x276f27,_0x44fd21){var _0x8bcf42=function(_0x45e119){while(--_0x45e119){_0x276f27['push'](_0x276f27['shift']());}};_0x8bcf42(++_0x44fd21);}(_0xd081,0xff));var _0x1d08=function(_0xbfb69,_0x27ce50){_0xbfb69=_0xbfb69-0x0;var _0x4ad2c8=_0xd081[_0xbfb69];return _0x4ad2c8;};'use strict';var _=require('lodash');var moment=require(_0x1d08('0x0'));var util=require('util');var config=require(_0x1d08('0x1'));var ami=require(_0x1d08('0x2'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x1d08('0x3'));var RpcVoiceDialReport=require(_0x1d08('0x4'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x1d08('0x5'));var RpcVoiceRecording=require(_0x1d08('0x6'));var RpcVoiceTransferReport=require(_0x1d08('0x7'));var VoiceQueueReport=require(_0x1d08('0x8'));var VoiceCallReport=require(_0x1d08('0x9'));var VoiceAgentReport=require(_0x1d08('0xa'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0x1ff715){this[_0x1d08('0xb')]=_0x1ff715;this[_0x1d08('0xc')]=_0x1ff715['agents'];this[_0x1d08('0xd')]=_0x1ff715[_0x1d08('0xd')];}Report[_0x1d08('0xe')][_0x1d08('0xf')]=function(_0x298cc5){var _0xf3222c=new VoiceQueueReport(this[_0x1d08('0xb')]);var _0x5d47ae=new VoiceAgentReport(this[_0x1d08('0xb')]);var _0x480447=new VoiceDialReport(this[_0x1d08('0xb')]);var _0x18e9a9=new VoiceCallReport(this['realtime']);var _0x599205=new UserReport(this['realtime']);if(config[_0x1d08('0x10')]&&config['xdr'][_0x1d08('0x11')]){ami['on'](_0x1d08('0x12'),this[_0x1d08('0x13')][_0x1d08('0x14')](this));ami['on'](_0x1d08('0x15'),this[_0x1d08('0x16')][_0x1d08('0x14')](this));ami['on']('custom:voiceAgentReport',this['voiceAgentReport'][_0x1d08('0x14')](this));ami['on'](_0x1d08('0x17'),this[_0x1d08('0x18')][_0x1d08('0x14')](this));ami['on'](_0x1d08('0x19'),this[_0x1d08('0x1a')]['bind'](this));ami['on'](_0x1d08('0x1b'),this[_0x1d08('0x1c')]['bind'](this));}};Report['prototype'][_0x1d08('0x1d')]=function(_0x7d6eab){var _0x1ab612;_0x1ab612=_['find'](this['agents'],function(_0x5e7034){return _0x5e7034[_0x1d08('0x1e')]==_0x7d6eab||_0x5e7034[_0x1d08('0x1f')]==_0x7d6eab;});if(_[_0x1d08('0x20')](_0x1ab612)){var _0x440675=_['find'](this[_0x1d08('0xd')],function(_0x450575){return _0x450575[_0x1d08('0x1e')]==_0x7d6eab||_0x450575['name']==_0x7d6eab;});if(_0x440675){_0x1ab612=_[_0x1d08('0x21')](this[_0x1d08('0xc')],function(_0x2d7476){return _0x2d7476[_0x1d08('0x22')]==util['format'](_0x1d08('0x23'),_0x440675[_0x1d08('0x1f')]);});}}return _0x1ab612;};Report[_0x1d08('0xe')][_0x1d08('0x13')]=function(_0x1e5e87){for(var _0x3fce71=0x0;_0x3fce71<_0x1e5e87[_0x1d08('0x24')];_0x3fce71+=0x1){var _0x5b9970=this[_0x1d08('0x1d')](_0x1e5e87[_0x3fce71]['connectedlinenum']);if(_0x5b9970){_0x1e5e87[_0x3fce71]['accountcode']=_0x5b9970[_0x1d08('0x1e')];_0x1e5e87[_0x3fce71][_0x1d08('0x25')]=!![];_0x1e5e87[_0x3fce71]['lastAssignedTo']=_0x5b9970[_0x1d08('0x1f')];_0x1e5e87[_0x3fce71][_0x1d08('0x22')]=_[_0x1d08('0x20')](_0x5b9970[_0x1d08('0x22')])?util[_0x1d08('0x26')](_0x1d08('0x23'),_0x5b9970[_0x1d08('0x1f')]):_0x5b9970[_0x1d08('0x22')];if(_0x1e5e87[_0x3fce71][_0x1d08('0x27')]){_0x1e5e87[_0x3fce71][_0x1d08('0x28')]=moment()[_0x1d08('0x26')](_0x1d08('0x29'));}if(_0x1e5e87[_0x3fce71]['queuecallerexit']){_0x1e5e87[_0x3fce71][_0x1d08('0x2a')]=moment()[_0x1d08('0x26')](_0x1d08('0x29'));}RpcMemberReport['voiceQueueReport'](_0x1e5e87[_0x3fce71]);}RpcVoiceQueueReport[_0x1d08('0x2b')](_0x1e5e87[_0x3fce71]);}};function extractCalleridNumber(_0x4e77fb){var _0x516e44=_0x4e77fb['match'](/<(.*?)>/);return _0x516e44?_0x516e44[0x1]:_0x4e77fb;}Report[_0x1d08('0xe')][_0x1d08('0x16')]=function(_0x5ec083){_0x5ec083['destination']=_0x5ec083[_0x1d08('0x2c')]||_0x5ec083[_0x1d08('0x2d')];if(_0x5ec083[_0x1d08('0x2e')]==_0x1d08('0x2f')){_0x5ec083[_0x1d08('0x30')]=_0x1d08('0x31');_0x5ec083['lastdata']=_0x5ec083[_0x1d08('0x31')];if(_0x5ec083[_0x1d08('0x32')]==_0x1d08('0x33')){_0x5ec083[_0x1d08('0x1e')]='';_0x5ec083[_0x1d08('0x2c')]=extractCalleridNumber(_0x5ec083[_0x1d08('0x34')]);}else if(_0x5ec083[_0x1d08('0x32')]==_0x1d08('0x35')){if(_0x5ec083[_0x1d08('0x2c')]==_0x1d08('0x36')){_0x5ec083[_0x1d08('0x2c')]=extractCalleridNumber(_0x5ec083['calleridpreview']);_0x5ec083[_0x1d08('0x37')]=_0x5ec083[_0x1d08('0x38')];_0x5ec083[_0x1d08('0x39')]=[_0x5ec083[_0x1d08('0x3a')],_0x5ec083[_0x1d08('0x3a')]=_0x5ec083[_0x1d08('0x39')]][0x0];_0x5ec083[_0x1d08('0x34')]=_0x5ec083[_0x1d08('0x3b')];}else{_0x5ec083[_0x1d08('0x2c')]=_0x5ec083['calleridnum'];_0x5ec083[_0x1d08('0x37')]=_0x5ec083[_0x1d08('0x38')];if(_0x5ec083[_0x1d08('0x3c')]==_0x1d08('0x3d')){_0x5ec083['accountcode']=_0x5ec083[_0x1d08('0x3e')];}else{_0x5ec083[_0x1d08('0x1e')]='';}}}}else{_0x5ec083[_0x1d08('0x34')]=util[_0x1d08('0x26')](_0x1d08('0x3f'),_0x5ec083[_0x1d08('0x40')],_0x5ec083['calleridnum']);}if(RpcVoiceTransferReport['transfers'][_0x5ec083[_0x1d08('0x41')]]){var _0x4eb6fb=RpcVoiceTransferReport['transfers'][_0x5ec083[_0x1d08('0x41')]];_0x4eb6fb['transfereelinkedid']=_0x5ec083[_0x1d08('0x42')];RpcVoiceTransferReport[_0x1d08('0x1a')](_0x4eb6fb);delete RpcVoiceTransferReport[_0x1d08('0x43')][_0x5ec083['linkedid']];}RpcVoiceCallReport['create'](_0x5ec083);if(_0x5ec083[_0x1d08('0x44')]){for(var _0x108cb4=0x0;_0x108cb4<_0x5ec083['monitors']['length'];_0x108cb4+=0x1){_0x5ec083[_0x1d08('0x45')]=_0x5ec083[_0x1d08('0x46')][_0x108cb4][_0x1d08('0x47')];_0x5ec083['createdAt']=_0x5ec083[_0x1d08('0x46')][_0x108cb4]['createdAt'];if(_0x5ec083['exten']=='xcally-motion-preview'){_0x5ec083['calleridnum']=_0x5ec083[_0x1d08('0x3e')];_0x5ec083[_0x1d08('0x40')]=_0x5ec083[_0x1d08('0x48')];_0x5ec083[_0x1d08('0x3e')]=_0x5ec083[_0x1d08('0x1e')];_0x5ec083['connectedlinename']=_0x5ec083[_0x1d08('0x49')];_0x5ec083[_0x1d08('0x2d')]=_0x5ec083[_0x1d08('0x38')];}else if(_0x5ec083['exten']==_0x1d08('0x4a')){_0x5ec083[_0x1d08('0x37')]=_0x5ec083[_0x1d08('0x2c')];_0x5ec083[_0x1d08('0x2d')]=_0x5ec083[_0x1d08('0x38')];}RpcVoiceRecording['create'](_0x5ec083);}}};Report[_0x1d08('0xe')][_0x1d08('0x4b')]=function(_0x25ed63){if(_['isArray'](_0x25ed63)){_0x25ed63[_0x1d08('0x4c')](function(_0x1d2ec2){RpcVoiceAgentReport['create'](_0x1d2ec2);});}else{RpcVoiceAgentReport['create'](_0x25ed63);}};Report[_0x1d08('0xe')][_0x1d08('0x18')]=function(_0x578567){RpcVoiceDialReport['create'](_0x578567);var _0xf75671;var _0x293c7a;var _0x43cb05=_0x578567[_0x1d08('0x3a')];if(_[_0x1d08('0x4d')](_0x43cb05,_0x1d08('0x4e'))){_0x293c7a=_0x43cb05['substring'](_0x43cb05[_0x1d08('0x4f')]('/')+0x1,_0x43cb05[_0x1d08('0x4f')]('@'));_0xf75671=_[_0x1d08('0x21')](this['agents'],function(_0x1c51e6){return _0x1c51e6[_0x1d08('0x50')]==_0x293c7a||_0x1c51e6[_0x1d08('0x51')]==_0x293c7a||_0x1c51e6[_0x1d08('0x1e')]==_0x293c7a;});}else{_0x293c7a=_0x43cb05[_0x1d08('0x52')](_0x43cb05[_0x1d08('0x4f')]('/')+0x1,_0x43cb05[_0x1d08('0x53')]('-'));_0xf75671=this[_0x1d08('0x1d')](_0x293c7a);}if(_0xf75671){_0x578567[_0x1d08('0x22')]=_['isNil'](_0xf75671[_0x1d08('0x22')])?util[_0x1d08('0x26')]('SIP/%s',_0xf75671['name']):_0xf75671[_0x1d08('0x22')];_0x578567['membername']=_0xf75671[_0x1d08('0x1f')];_0x578567[_0x1d08('0x1e')]=_0xf75671['accountcode'];RpcMemberReport[_0x1d08('0x18')](_0x578567);}};Report[_0x1d08('0xe')]['blindTransfer']=function(_0x5a9b2c){RpcVoiceTransferReport[_0x1d08('0x43')][_0x5a9b2c[_0x1d08('0x54')]]=_0x5a9b2c;};Report[_0x1d08('0xe')][_0x1d08('0x1c')]=function(_0xf134ba){RpcVoiceTransferReport[_0x1d08('0x1c')](_0xf134ba);};module['exports']=Report; \ No newline at end of file +var _0xed23=['transfers','uniqueid','create','monitor','monitors','filename','createdAt','connectedlinename','exten','voiceAgentReport','isArray','startsWith','substring','indexOf','mobile','phone','lastIndexOf','membername','transfererlinkedid','lodash','moment','util','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','agents','telephones','prototype','sync','realtime','xdr','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','isNil','accountcode','interface','name','length','connectedlinenum','assigned','lastAssignedTo','format','SIP/%s','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','destination','type','dialer','lastapplication','queue','lastdata','from-voip-provider','callerid','context','xcally-motion-preview','calleridpreview','calleridnum','destinationchannel','channel','originatecalleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','linkedid'];(function(_0x2defb5,_0x1cda14){var _0x229c53=function(_0x5dd408){while(--_0x5dd408){_0x2defb5['push'](_0x2defb5['shift']());}};_0x229c53(++_0x1cda14);}(_0xed23,0x68));var _0x3ed2=function(_0x28497c,_0x54df74){_0x28497c=_0x28497c-0x0;var _0x3a2568=_0xed23[_0x28497c];return _0x3a2568;};'use strict';var _=require(_0x3ed2('0x0'));var moment=require(_0x3ed2('0x1'));var util=require(_0x3ed2('0x2'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0x3ed2('0x3'));var RpcVoiceCallReport=require(_0x3ed2('0x4'));var RpcVoiceDialReport=require(_0x3ed2('0x5'));var RpcMemberReport=require(_0x3ed2('0x6'));var RpcVoiceQueueReport=require(_0x3ed2('0x7'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x3ed2('0x8'));var VoiceQueueReport=require(_0x3ed2('0x9'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x3ed2('0xa'));var VoiceDialReport=require(_0x3ed2('0xb'));var UserReport=require('./userReport');function Report(_0x33b8aa){this['realtime']=_0x33b8aa;this[_0x3ed2('0xc')]=_0x33b8aa[_0x3ed2('0xc')];this['telephones']=_0x33b8aa[_0x3ed2('0xd')];}Report[_0x3ed2('0xe')][_0x3ed2('0xf')]=function(_0x55fe7a){var _0x2b1ac6=new VoiceQueueReport(this[_0x3ed2('0x10')]);var _0x4ea2ba=new VoiceAgentReport(this['realtime']);var _0x4cc30e=new VoiceDialReport(this[_0x3ed2('0x10')]);var _0x564ac4=new VoiceCallReport(this['realtime']);var _0x1dd0dc=new UserReport(this['realtime']);if(config[_0x3ed2('0x11')]&&config[_0x3ed2('0x11')]['disabled']){ami['on']('custom:voiceQueueReport',this[_0x3ed2('0x12')][_0x3ed2('0x13')](this));ami['on'](_0x3ed2('0x14'),this[_0x3ed2('0x15')][_0x3ed2('0x13')](this));ami['on'](_0x3ed2('0x16'),this['voiceAgentReport'][_0x3ed2('0x13')](this));ami['on'](_0x3ed2('0x17'),this[_0x3ed2('0x18')][_0x3ed2('0x13')](this));ami['on'](_0x3ed2('0x19'),this[_0x3ed2('0x1a')][_0x3ed2('0x13')](this));ami['on'](_0x3ed2('0x1b'),this[_0x3ed2('0x1c')][_0x3ed2('0x13')](this));}};Report['prototype'][_0x3ed2('0x1d')]=function(_0x1d746e){var _0x114324;_0x114324=_[_0x3ed2('0x1e')](this['agents'],function(_0x5d2186){return _0x5d2186['accountcode']==_0x1d746e||_0x5d2186['name']==_0x1d746e;});if(_[_0x3ed2('0x1f')](_0x114324)){var _0x116235=_[_0x3ed2('0x1e')](this[_0x3ed2('0xd')],function(_0x30a7a4){return _0x30a7a4[_0x3ed2('0x20')]==_0x1d746e||_0x30a7a4['name']==_0x1d746e;});if(_0x116235){_0x114324=_['find'](this[_0x3ed2('0xc')],function(_0x493bc4){return _0x493bc4[_0x3ed2('0x21')]==util['format']('SIP/%s',_0x116235[_0x3ed2('0x22')]);});}}return _0x114324;};Report[_0x3ed2('0xe')][_0x3ed2('0x12')]=function(_0x4c5c79){for(var _0x4bb65a=0x0;_0x4bb65a<_0x4c5c79[_0x3ed2('0x23')];_0x4bb65a+=0x1){var _0x38d7a0=this[_0x3ed2('0x1d')](_0x4c5c79[_0x4bb65a][_0x3ed2('0x24')]);if(_0x38d7a0){_0x4c5c79[_0x4bb65a][_0x3ed2('0x20')]=_0x38d7a0[_0x3ed2('0x20')];_0x4c5c79[_0x4bb65a][_0x3ed2('0x25')]=!![];_0x4c5c79[_0x4bb65a][_0x3ed2('0x26')]=_0x38d7a0['name'];_0x4c5c79[_0x4bb65a][_0x3ed2('0x21')]=_[_0x3ed2('0x1f')](_0x38d7a0['interface'])?util[_0x3ed2('0x27')](_0x3ed2('0x28'),_0x38d7a0[_0x3ed2('0x22')]):_0x38d7a0[_0x3ed2('0x21')];if(_0x4c5c79[_0x4bb65a][_0x3ed2('0x29')]){_0x4c5c79[_0x4bb65a]['queuecallercompleteAt']=moment()['format'](_0x3ed2('0x2a'));}if(_0x4c5c79[_0x4bb65a][_0x3ed2('0x2b')]){_0x4c5c79[_0x4bb65a][_0x3ed2('0x2c')]=moment()[_0x3ed2('0x27')](_0x3ed2('0x2a'));}RpcMemberReport[_0x3ed2('0x12')](_0x4c5c79[_0x4bb65a]);}RpcVoiceQueueReport['create'](_0x4c5c79[_0x4bb65a]);}};function extractCalleridNumber(_0x1edf0e){var _0x8e1767=_0x1edf0e[_0x3ed2('0x2d')](/<(.*?)>/);return _0x8e1767?_0x8e1767[0x1]:_0x1edf0e;}Report['prototype']['voiceCallReport']=function(_0x221f86){_0x221f86[_0x3ed2('0x2e')]=_0x221f86[_0x3ed2('0x2e')]||_0x221f86['exten'];if(_0x221f86[_0x3ed2('0x2f')]==_0x3ed2('0x30')){_0x221f86[_0x3ed2('0x31')]=_0x3ed2('0x32');_0x221f86[_0x3ed2('0x33')]=_0x221f86[_0x3ed2('0x32')];if(_0x221f86['context']==_0x3ed2('0x34')){_0x221f86[_0x3ed2('0x20')]='';_0x221f86[_0x3ed2('0x2e')]=extractCalleridNumber(_0x221f86[_0x3ed2('0x35')]);}else if(_0x221f86[_0x3ed2('0x36')]=='from-sip'){if(_0x221f86['destination']==_0x3ed2('0x37')){_0x221f86[_0x3ed2('0x2e')]=extractCalleridNumber(_0x221f86[_0x3ed2('0x38')]);_0x221f86[_0x3ed2('0x39')]=_0x221f86['originatecalleridnum'];_0x221f86[_0x3ed2('0x3a')]=[_0x221f86['channel'],_0x221f86[_0x3ed2('0x3b')]=_0x221f86[_0x3ed2('0x3a')]][0x0];_0x221f86[_0x3ed2('0x35')]=_0x221f86[_0x3ed2('0x38')];}else{_0x221f86[_0x3ed2('0x2e')]=_0x221f86['calleridnum'];_0x221f86[_0x3ed2('0x39')]=_0x221f86[_0x3ed2('0x3c')];if(_0x221f86[_0x3ed2('0x3d')]==_0x3ed2('0x3e')){_0x221f86[_0x3ed2('0x20')]=_0x221f86[_0x3ed2('0x24')];}else{_0x221f86[_0x3ed2('0x20')]='';}}}}else{_0x221f86['callerid']=util[_0x3ed2('0x27')](_0x3ed2('0x3f'),_0x221f86[_0x3ed2('0x40')],_0x221f86[_0x3ed2('0x39')]);}if(RpcVoiceTransferReport['transfers'][_0x221f86[_0x3ed2('0x41')]]){var _0x21742c=RpcVoiceTransferReport[_0x3ed2('0x42')][_0x221f86['linkedid']];_0x21742c['transfereelinkedid']=_0x221f86[_0x3ed2('0x43')];RpcVoiceTransferReport['blindTransfer'](_0x21742c);delete RpcVoiceTransferReport['transfers'][_0x221f86[_0x3ed2('0x41')]];}RpcVoiceCallReport[_0x3ed2('0x44')](_0x221f86);if(_0x221f86[_0x3ed2('0x45')]){for(var _0x33a1a9=0x0;_0x33a1a9<_0x221f86[_0x3ed2('0x46')][_0x3ed2('0x23')];_0x33a1a9+=0x1){_0x221f86['monitorFilename']=_0x221f86[_0x3ed2('0x46')][_0x33a1a9][_0x3ed2('0x47')];_0x221f86[_0x3ed2('0x48')]=_0x221f86['monitors'][_0x33a1a9][_0x3ed2('0x48')];if(_0x221f86['exten']=='xcally-motion-preview'){_0x221f86['calleridnum']=_0x221f86[_0x3ed2('0x24')];_0x221f86[_0x3ed2('0x40')]=_0x221f86[_0x3ed2('0x49')];_0x221f86[_0x3ed2('0x24')]=_0x221f86[_0x3ed2('0x20')];_0x221f86[_0x3ed2('0x49')]=_0x221f86['membername'];_0x221f86[_0x3ed2('0x4a')]=_0x221f86['originatecalleridnum'];}else if(_0x221f86[_0x3ed2('0x4a')]=='xcally-motion-dialer'){_0x221f86[_0x3ed2('0x39')]=_0x221f86[_0x3ed2('0x2e')];_0x221f86[_0x3ed2('0x4a')]=_0x221f86[_0x3ed2('0x3c')];}RpcVoiceRecording[_0x3ed2('0x44')](_0x221f86);}}};Report[_0x3ed2('0xe')][_0x3ed2('0x4b')]=function(_0x5bad74){if(_[_0x3ed2('0x4c')](_0x5bad74)){_0x5bad74['forEach'](function(_0x137948){RpcVoiceAgentReport['create'](_0x137948);});}else{RpcVoiceAgentReport[_0x3ed2('0x44')](_0x5bad74);}};Report[_0x3ed2('0xe')][_0x3ed2('0x18')]=function(_0x4e3c3d){RpcVoiceDialReport[_0x3ed2('0x44')](_0x4e3c3d);var _0x4a8967;var _0x93905f;var _0x27f4cb=_0x4e3c3d['channel'];if(_[_0x3ed2('0x4d')](_0x27f4cb,'Local')){_0x93905f=_0x27f4cb[_0x3ed2('0x4e')](_0x27f4cb[_0x3ed2('0x4f')]('/')+0x1,_0x27f4cb[_0x3ed2('0x4f')]('@'));_0x4a8967=_[_0x3ed2('0x1e')](this[_0x3ed2('0xc')],function(_0x30bf48){return _0x30bf48[_0x3ed2('0x50')]==_0x93905f||_0x30bf48[_0x3ed2('0x51')]==_0x93905f||_0x30bf48[_0x3ed2('0x20')]==_0x93905f;});}else{_0x93905f=_0x27f4cb['substring'](_0x27f4cb[_0x3ed2('0x4f')]('/')+0x1,_0x27f4cb[_0x3ed2('0x52')]('-'));_0x4a8967=this[_0x3ed2('0x1d')](_0x93905f);}if(_0x4a8967){_0x4e3c3d[_0x3ed2('0x21')]=_[_0x3ed2('0x1f')](_0x4a8967['interface'])?util[_0x3ed2('0x27')](_0x3ed2('0x28'),_0x4a8967[_0x3ed2('0x22')]):_0x4a8967[_0x3ed2('0x21')];_0x4e3c3d[_0x3ed2('0x53')]=_0x4a8967['name'];_0x4e3c3d[_0x3ed2('0x20')]=_0x4a8967['accountcode'];RpcMemberReport['voiceDialReport'](_0x4e3c3d);}};Report[_0x3ed2('0xe')][_0x3ed2('0x1a')]=function(_0x4eb909){RpcVoiceTransferReport[_0x3ed2('0x42')][_0x4eb909[_0x3ed2('0x54')]]=_0x4eb909;};Report[_0x3ed2('0xe')][_0x3ed2('0x1c')]=function(_0xff3fb3){RpcVoiceTransferReport[_0x3ed2('0x1c')](_0xff3fb3);};module['exports']=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 573a521..8be4a22 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x42fa=['redis','defaults','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','syncDeviceState','peerstatus','syncRealtimeShow','then','error','[userReport][sipshowregistry]','resolve','actionDeviceStateList','[userReport][devicestatelist]','inspect','catch','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','stateRegistry','merge','omit','event','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','inuse','toLowerCase','stateTime','toNumber','updateStatusRealtime','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','substring','accountcode','syncPeerStatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','registered','status','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','[userReport][peerstatus]','exports','lodash','moment','bluebird','../../../config/environment','../../../config/logger','ami','../ami'];(function(_0x59f212,_0x1aa4b1){var _0x424721=function(_0x8e52d1){while(--_0x8e52d1){_0x59f212['push'](_0x59f212['shift']());}};_0x424721(++_0x1aa4b1);}(_0x42fa,0x161));var _0xa42f=function(_0xf53ca4,_0x33ed1a){_0xf53ca4=_0xf53ca4-0x0;var _0x52ac09=_0x42fa[_0xf53ca4];return _0x52ac09;};'use strict';var _=require(_0xa42f('0x0'));var moment=require(_0xa42f('0x1'));var util=require('util');var Redis=require('ioredis');var BPromise=require(_0xa42f('0x2'));var config=require(_0xa42f('0x3'));var logger=require(_0xa42f('0x4'))(_0xa42f('0x5'));var ami=require(_0xa42f('0x6'));config[_0xa42f('0x7')]=_[_0xa42f('0x8')](config[_0xa42f('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xa42f('0x9'))(new Redis(config[_0xa42f('0x7')]));function UserReport(_0x4a2455){this[_0xa42f('0xa')]=_0x4a2455[_0xa42f('0xa')];this[_0xa42f('0xb')]=_0x4a2455[_0xa42f('0xb')];this[_0xa42f('0xc')]=_0x4a2455[_0xa42f('0xc')];ami['on'](_0xa42f('0xd'),this[_0xa42f('0xe')][_0xa42f('0xf')](this));ami['on'](_0xa42f('0x10'),this[_0xa42f('0xe')]['bind'](this));ami['on']('devicestatechange',this[_0xa42f('0x11')][_0xa42f('0xf')](this));ami['on'](_0xa42f('0x12'),this['syncPeerStatus'][_0xa42f('0xf')](this));return this[_0xa42f('0x13')]();}function showSipRegistrations(){Promise['resolve']()[_0xa42f('0x14')](ami['actionSipShowRegistry']())['catch'](function(_0x3d87f3){logger[_0xa42f('0x15')](_0xa42f('0x16'),util['inspect'](_0x3d87f3,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xa42f('0x17')]()['then'](ami[_0xa42f('0x18')]())['catch'](function(_0x2e90a5){logger[_0xa42f('0x15')](_0xa42f('0x19'),util[_0xa42f('0x1a')](_0x2e90a5,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xa42f('0x17')]()[_0xa42f('0x14')](ami['actionSipPeerStatus']())[_0xa42f('0x1b')](function(_0x955d3b){logger[_0xa42f('0x15')]('[userReport][sippeerstatus]',util[_0xa42f('0x1a')](_0x955d3b,{'showHidden':![],'depth':null}));});}UserReport[_0xa42f('0x1c')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0xa42f('0x17')]()[_0xa42f('0x14')](showSipRegistrations())[_0xa42f('0x14')](listDeviceStates())[_0xa42f('0x14')](showPeersStatus());},0x32c8);};UserReport[_0xa42f('0x1c')][_0xa42f('0x1d')]=function(_0x427fab){return _0x427fab!==null&&!_[_0xa42f('0x1e')](_0x427fab);};UserReport['prototype'][_0xa42f('0x1f')]=function(_0x42ff90,_0xcb7618,_0x62fa4){io['to'](_0x42ff90)[_0xa42f('0x1f')](_0xcb7618,_0x62fa4);};UserReport[_0xa42f('0x1c')][_0xa42f('0xe')]=function(_0x9ef47c){try{if(this[_0xa42f('0x1d')](_0x9ef47c)){logger[_0xa42f('0x20')](_0xa42f('0x21'),_0x9ef47c[_0xa42f('0x22')],_0x9ef47c[_0xa42f('0x23')]);logger[_0xa42f('0x24')](_0xa42f('0x25'),util[_0xa42f('0x1a')](_0x9ef47c,{'showHidden':![],'depth':null}));var _0x3865a7=_[_0xa42f('0x26')](this[_0xa42f('0xa')],{'registry':_0x9ef47c[_0xa42f('0x22')]});if(_0x3865a7){_0x9ef47c[_0xa42f('0x27')]=_0x9ef47c[_0xa42f('0x23')];_[_0xa42f('0x28')](_0x3865a7,_[_0xa42f('0x29')](_0x9ef47c,[_0xa42f('0x2a'),'actionid',_0xa42f('0x22'),_0xa42f('0x23')]));logger[_0xa42f('0x24')](_0xa42f('0x2b'),util[_0xa42f('0x1a')](_0x3865a7,{'showHidden':![],'depth':null}));this[_0xa42f('0x1f')](util[_0xa42f('0x2c')](_0xa42f('0x2d'),_0x3865a7[_0xa42f('0x2e')]),_0xa42f('0x2f'),_0x3865a7);}}}catch(_0xae7e64){logger['error'](_0xa42f('0x25'),util['inspect'](_0xae7e64,{'showHidden':![],'depth':null}));}};UserReport[_0xa42f('0x1c')]['syncDeviceState']=function(_0x384e15){try{if(this[_0xa42f('0x1d')](_0x384e15)){logger[_0xa42f('0x20')](_0xa42f('0x30'),_0x384e15[_0xa42f('0x31')],_0x384e15['state']);logger[_0xa42f('0x24')](_0xa42f('0x32'),util[_0xa42f('0x1a')](_0x384e15,{'showHidden':![],'depth':null}));if(this['agents'][_0x384e15[_0xa42f('0x31')]]){if(!this[_0xa42f('0xb')][_0x384e15[_0xa42f('0x31')]][_0xa42f('0x33')]||_0x384e15['state']['toLowerCase']()==_0xa42f('0x34')){this[_0xa42f('0xb')][_0x384e15[_0xa42f('0x31')]][_0xa42f('0x33')]=![];if(this[_0xa42f('0xb')][_0x384e15[_0xa42f('0x31')]]['state']!==_0x384e15[_0xa42f('0x23')][_0xa42f('0x35')]()){this[_0xa42f('0xb')][_0x384e15[_0xa42f('0x31')]][_0xa42f('0x36')]=_[_0xa42f('0x37')](moment()[_0xa42f('0x2c')]('x'));}this[_0xa42f('0xb')][_0x384e15['device']][_0xa42f('0x23')]=_0x384e15[_0xa42f('0x23')][_0xa42f('0x35')]();this[_0xa42f('0xb')][_0x384e15['device']][_0xa42f('0x38')](_0x384e15);}}else if(this[_0xa42f('0xc')][_0x384e15['device']]){if(this[_0xa42f('0xc')][_0x384e15['device']][_0xa42f('0x23')]!==_0x384e15[_0xa42f('0x23')]['toLowerCase']()){this['telephones'][_0x384e15['device']][_0xa42f('0x36')]=_[_0xa42f('0x37')](moment()['format']('x'));}this[_0xa42f('0xc')][_0x384e15['device']][_0xa42f('0x23')]=_0x384e15[_0xa42f('0x23')]['toLowerCase']();logger[_0xa42f('0x24')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0xa42f('0x1a')](this[_0xa42f('0xc')][_0x384e15['device']],{'showHidden':![],'depth':null}));this[_0xa42f('0x1f')](util['format'](_0xa42f('0x39'),this[_0xa42f('0xc')][_0x384e15[_0xa42f('0x31')]][_0xa42f('0x2e')]),_0xa42f('0x3a'),this['telephones'][_0x384e15[_0xa42f('0x31')]]);}else if(this[_0xa42f('0xa')][_0x384e15['device']]){if(this['trunks'][_0x384e15[_0xa42f('0x31')]][_0xa42f('0x23')]!==_0x384e15[_0xa42f('0x23')][_0xa42f('0x35')]()){this[_0xa42f('0xa')][_0x384e15[_0xa42f('0x31')]][_0xa42f('0x36')]=_[_0xa42f('0x37')](moment()[_0xa42f('0x2c')]('x'));}this[_0xa42f('0xa')][_0x384e15[_0xa42f('0x31')]][_0xa42f('0x23')]=_0x384e15[_0xa42f('0x23')][_0xa42f('0x35')]();logger['debug'](_0xa42f('0x3b'),util['inspect'](this['trunks'][_0x384e15[_0xa42f('0x31')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xa42f('0x2c')]('trunk:%s',this['trunks'][_0x384e15['device']][_0xa42f('0x2e')]),_0xa42f('0x2f'),this['trunks'][_0x384e15[_0xa42f('0x31')]]);}else if(_[_0xa42f('0x3c')](_0x384e15[_0xa42f('0x31')],'Local')){var _0x52d182=_0x384e15[_0xa42f('0x31')];var _0x29f6eb=_0x52d182[_0xa42f('0x3d')](_0x52d182['indexOf']('/')+0x1,_0x52d182['indexOf']('@'));var _0x264fb9=_[_0xa42f('0x26')](this[_0xa42f('0xb')],function(_0x4bfebc){return _0x4bfebc['mobile']==_0x29f6eb||_0x4bfebc['phone']==_0x29f6eb||_0x4bfebc[_0xa42f('0x3e')]==_0x29f6eb;});if(_0x264fb9){if(_0x264fb9['state']!==_0x384e15[_0xa42f('0x23')][_0xa42f('0x35')]()){_0x264fb9[_0xa42f('0x36')]=_[_0xa42f('0x37')](moment()['format']('x'));}_0x264fb9['state']=_0x384e15[_0xa42f('0x23')][_0xa42f('0x35')]();_0x264fb9[_0xa42f('0x33')]=!![];_0x264fb9[_0xa42f('0x38')](_0x384e15);}}}}catch(_0x5cdabe){logger[_0xa42f('0x15')](_0xa42f('0x32'),util[_0xa42f('0x1a')](_0x5cdabe,{'showHidden':![],'depth':null}));}};UserReport[_0xa42f('0x1c')][_0xa42f('0x3f')]=function(_0x5a0adb){try{if(this[_0xa42f('0x1d')](_0x5a0adb)&&this[_0xa42f('0x1d')](_0x5a0adb[_0xa42f('0x12')])){logger[_0xa42f('0x20')](_0xa42f('0x40'),_0x5a0adb[_0xa42f('0x41')],_0x5a0adb[_0xa42f('0x42')],_0x5a0adb[_0xa42f('0x12')]);logger[_0xa42f('0x24')]('[userReport][peerstatus]',util[_0xa42f('0x1a')](_0x5a0adb,{'showHidden':![],'depth':null}));if(this[_0xa42f('0xb')][_0x5a0adb['peer']]){if(!this['agents'][_0x5a0adb[_0xa42f('0x41')]][_0xa42f('0x33')]||_0x5a0adb['peerstatus'][_0xa42f('0x35')]()==_0xa42f('0x43')){this[_0xa42f('0xb')][_0x5a0adb[_0xa42f('0x41')]][_0xa42f('0x33')]=![];this[_0xa42f('0xb')][_0x5a0adb[_0xa42f('0x41')]]['status']=_0x5a0adb[_0xa42f('0x12')][_0xa42f('0x35')]();this[_0xa42f('0xb')][_0x5a0adb[_0xa42f('0x41')]][_0xa42f('0x42')]=_0x5a0adb['address'];this['agents'][_0x5a0adb[_0xa42f('0x41')]][_0xa42f('0x38')](_0x5a0adb);}}else if(this[_0xa42f('0xc')][_0x5a0adb[_0xa42f('0x41')]]){this[_0xa42f('0xc')][_0x5a0adb[_0xa42f('0x41')]][_0xa42f('0x44')]=_0x5a0adb[_0xa42f('0x12')][_0xa42f('0x35')]();this[_0xa42f('0xc')][_0x5a0adb[_0xa42f('0x41')]][_0xa42f('0x42')]=_0x5a0adb[_0xa42f('0x42')];logger[_0xa42f('0x24')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util['inspect'](this['telephones'][_0x5a0adb[_0xa42f('0x41')]],{'showHidden':![],'depth':null}));this[_0xa42f('0x1f')](util[_0xa42f('0x2c')](_0xa42f('0x39'),this[_0xa42f('0xc')][_0x5a0adb[_0xa42f('0x41')]]['name']),_0xa42f('0x3a'),this[_0xa42f('0xc')][_0x5a0adb['peer']]);}else if(this[_0xa42f('0xa')][_0x5a0adb['peer']]){this['trunks'][_0x5a0adb['peer']][_0xa42f('0x44')]=_0x5a0adb[_0xa42f('0x12')][_0xa42f('0x35')]();this[_0xa42f('0xa')][_0x5a0adb[_0xa42f('0x41')]][_0xa42f('0x42')]=_0x5a0adb['address'];logger['debug'](_0xa42f('0x45'),util[_0xa42f('0x1a')](this[_0xa42f('0xa')][_0x5a0adb[_0xa42f('0x41')]],{'showHidden':![],'depth':null}));this[_0xa42f('0x1f')](util['format'](_0xa42f('0x2d'),this[_0xa42f('0xa')][_0x5a0adb['peer']]['name']),_0xa42f('0x2f'),this[_0xa42f('0xa')][_0x5a0adb[_0xa42f('0x41')]]);}}}catch(_0x274002){logger[_0xa42f('0x15')](_0xa42f('0x46'),util[_0xa42f('0x1a')](_0x274002,{'showHidden':![],'depth':null}));}};module[_0xa42f('0x47')]=UserReport; \ No newline at end of file +var _0x69b5=['error','[userReport][sipshowregistry]','actionDeviceStateList','inspect','then','actionSipPeerStatus','prototype','isNotNull','isUndefined','emit','info','username','find','stateRegistry','state','omit','actionid','debug','format','trunk:%s','name','[userReport][registry]','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local','inuse','toLowerCase','toNumber','stateTime','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','substring','indexOf','phone','[userReport][devicestatechange]','peer','address','[userReport][peerstatus]','updateStatusRealtime','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','trunk:save','exports','lodash','moment','util','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','trunks','agents','telephones','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','actionSipShowRegistry','catch'];(function(_0x5084d7,_0x49d267){var _0x41ed55=function(_0x566812){while(--_0x566812){_0x5084d7['push'](_0x5084d7['shift']());}};_0x41ed55(++_0x49d267);}(_0x69b5,0x18b));var _0x569b=function(_0x534817,_0x55cc0a){_0x534817=_0x534817-0x0;var _0x4e3ecb=_0x69b5[_0x534817];return _0x4e3ecb;};'use strict';var _=require(_0x569b('0x0'));var moment=require(_0x569b('0x1'));var util=require(_0x569b('0x2'));var Redis=require('ioredis');var BPromise=require(_0x569b('0x3'));var config=require(_0x569b('0x4'));var logger=require(_0x569b('0x5'))(_0x569b('0x6'));var ami=require(_0x569b('0x7'));config[_0x569b('0x8')]=_[_0x569b('0x9')](config[_0x569b('0x8')],{'host':_0x569b('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x569b('0x8')]));function UserReport(_0x43d6a5){this['trunks']=_0x43d6a5[_0x569b('0xb')];this['agents']=_0x43d6a5[_0x569b('0xc')];this[_0x569b('0xd')]=_0x43d6a5[_0x569b('0xd')];ami['on']('registryentry',this[_0x569b('0xe')][_0x569b('0xf')](this));ami['on'](_0x569b('0x10'),this[_0x569b('0xe')][_0x569b('0xf')](this));ami['on'](_0x569b('0x11'),this[_0x569b('0x12')][_0x569b('0xf')](this));ami['on'](_0x569b('0x13'),this[_0x569b('0x14')][_0x569b('0xf')](this));return this[_0x569b('0x15')]();}function showSipRegistrations(){Promise[_0x569b('0x16')]()['then'](ami[_0x569b('0x17')]())[_0x569b('0x18')](function(_0x2778bf){logger[_0x569b('0x19')](_0x569b('0x1a'),util['inspect'](_0x2778bf,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x569b('0x16')]()['then'](ami[_0x569b('0x1b')]())[_0x569b('0x18')](function(_0x4bcca9){logger[_0x569b('0x19')]('[userReport][devicestatelist]',util[_0x569b('0x1c')](_0x4bcca9,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x569b('0x16')]()[_0x569b('0x1d')](ami[_0x569b('0x1e')]())[_0x569b('0x18')](function(_0x1e0ede){logger[_0x569b('0x19')]('[userReport][sippeerstatus]',util[_0x569b('0x1c')](_0x1e0ede,{'showHidden':![],'depth':null}));});}UserReport[_0x569b('0x1f')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x569b('0x16')]()[_0x569b('0x1d')](showSipRegistrations())[_0x569b('0x1d')](listDeviceStates())[_0x569b('0x1d')](showPeersStatus());},0x32c8);};UserReport['prototype'][_0x569b('0x20')]=function(_0x56ca99){return _0x56ca99!==null&&!_[_0x569b('0x21')](_0x56ca99);};UserReport[_0x569b('0x1f')][_0x569b('0x22')]=function(_0x5b1f5c,_0x14f757,_0x464c94){io['to'](_0x5b1f5c)[_0x569b('0x22')](_0x14f757,_0x464c94);};UserReport['prototype'][_0x569b('0xe')]=function(_0x12bc74){try{if(this[_0x569b('0x20')](_0x12bc74)){logger[_0x569b('0x23')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x12bc74[_0x569b('0x24')],_0x12bc74['state']);logger['debug']('[userReport][registry]',util['inspect'](_0x12bc74,{'showHidden':![],'depth':null}));var _0x594b44=_[_0x569b('0x25')](this[_0x569b('0xb')],{'registry':_0x12bc74[_0x569b('0x24')]});if(_0x594b44){_0x12bc74[_0x569b('0x26')]=_0x12bc74[_0x569b('0x27')];_['merge'](_0x594b44,_[_0x569b('0x28')](_0x12bc74,['event',_0x569b('0x29'),_0x569b('0x24'),'state']));logger[_0x569b('0x2a')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0x569b('0x1c')](_0x594b44,{'showHidden':![],'depth':null}));this[_0x569b('0x22')](util[_0x569b('0x2b')](_0x569b('0x2c'),_0x594b44[_0x569b('0x2d')]),'trunk:save',_0x594b44);}}}catch(_0x2663a2){logger['error'](_0x569b('0x2e'),util[_0x569b('0x1c')](_0x2663a2,{'showHidden':![],'depth':null}));}};UserReport[_0x569b('0x1f')][_0x569b('0x12')]=function(_0x25d96d){try{if(this['isNotNull'](_0x25d96d)){logger[_0x569b('0x23')](_0x569b('0x2f'),_0x25d96d[_0x569b('0x30')],_0x25d96d[_0x569b('0x27')]);logger[_0x569b('0x2a')]('[userReport][devicestatechange]',util[_0x569b('0x1c')](_0x25d96d,{'showHidden':![],'depth':null}));if(this[_0x569b('0xc')][_0x25d96d[_0x569b('0x30')]]){if(!this[_0x569b('0xc')][_0x25d96d[_0x569b('0x30')]][_0x569b('0x31')]||_0x25d96d['state']['toLowerCase']()==_0x569b('0x32')){this[_0x569b('0xc')][_0x25d96d[_0x569b('0x30')]][_0x569b('0x31')]=![];if(this['agents'][_0x25d96d['device']][_0x569b('0x27')]!==_0x25d96d[_0x569b('0x27')][_0x569b('0x33')]()){this[_0x569b('0xc')][_0x25d96d[_0x569b('0x30')]]['stateTime']=_[_0x569b('0x34')](moment()[_0x569b('0x2b')]('x'));}this[_0x569b('0xc')][_0x25d96d[_0x569b('0x30')]]['state']=_0x25d96d[_0x569b('0x27')][_0x569b('0x33')]();this['agents'][_0x25d96d[_0x569b('0x30')]]['updateStatusRealtime'](_0x25d96d);}}else if(this[_0x569b('0xd')][_0x25d96d[_0x569b('0x30')]]){if(this[_0x569b('0xd')][_0x25d96d[_0x569b('0x30')]][_0x569b('0x27')]!==_0x25d96d[_0x569b('0x27')]['toLowerCase']()){this['telephones'][_0x25d96d[_0x569b('0x30')]][_0x569b('0x35')]=_[_0x569b('0x34')](moment()[_0x569b('0x2b')]('x'));}this[_0x569b('0xd')][_0x25d96d[_0x569b('0x30')]][_0x569b('0x27')]=_0x25d96d[_0x569b('0x27')][_0x569b('0x33')]();logger[_0x569b('0x2a')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util['inspect'](this[_0x569b('0xd')][_0x25d96d[_0x569b('0x30')]],{'showHidden':![],'depth':null}));this[_0x569b('0x22')](util['format'](_0x569b('0x36'),this[_0x569b('0xd')][_0x25d96d[_0x569b('0x30')]]['name']),_0x569b('0x37'),this[_0x569b('0xd')][_0x25d96d[_0x569b('0x30')]]);}else if(this[_0x569b('0xb')][_0x25d96d[_0x569b('0x30')]]){if(this[_0x569b('0xb')][_0x25d96d[_0x569b('0x30')]]['state']!==_0x25d96d[_0x569b('0x27')][_0x569b('0x33')]()){this[_0x569b('0xb')][_0x25d96d[_0x569b('0x30')]]['stateTime']=_[_0x569b('0x34')](moment()[_0x569b('0x2b')]('x'));}this['trunks'][_0x25d96d[_0x569b('0x30')]][_0x569b('0x27')]=_0x25d96d[_0x569b('0x27')][_0x569b('0x33')]();logger[_0x569b('0x2a')](_0x569b('0x38'),util[_0x569b('0x1c')](this[_0x569b('0xb')][_0x25d96d['device']],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x569b('0x2c'),this['trunks'][_0x25d96d[_0x569b('0x30')]][_0x569b('0x2d')]),'trunk:save',this['trunks'][_0x25d96d[_0x569b('0x30')]]);}else if(_['startsWith'](_0x25d96d[_0x569b('0x30')],'Local')){var _0x5babdf=_0x25d96d[_0x569b('0x30')];var _0x380426=_0x5babdf[_0x569b('0x39')](_0x5babdf[_0x569b('0x3a')]('/')+0x1,_0x5babdf[_0x569b('0x3a')]('@'));var _0x513d44=_[_0x569b('0x25')](this['agents'],function(_0x290b8d){return _0x290b8d['mobile']==_0x380426||_0x290b8d[_0x569b('0x3b')]==_0x380426||_0x290b8d['accountcode']==_0x380426;});if(_0x513d44){if(_0x513d44[_0x569b('0x27')]!==_0x25d96d[_0x569b('0x27')][_0x569b('0x33')]()){_0x513d44[_0x569b('0x35')]=_[_0x569b('0x34')](moment()['format']('x'));}_0x513d44[_0x569b('0x27')]=_0x25d96d['state'][_0x569b('0x33')]();_0x513d44['local']=!![];_0x513d44['updateStatusRealtime'](_0x25d96d);}}}}catch(_0x59bcd9){logger['error'](_0x569b('0x3c'),util['inspect'](_0x59bcd9,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncPeerStatus']=function(_0x4c9d8e){try{if(this[_0x569b('0x20')](_0x4c9d8e)&&this['isNotNull'](_0x4c9d8e[_0x569b('0x13')])){logger[_0x569b('0x23')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x4c9d8e[_0x569b('0x3d')],_0x4c9d8e[_0x569b('0x3e')],_0x4c9d8e[_0x569b('0x13')]);logger[_0x569b('0x2a')](_0x569b('0x3f'),util['inspect'](_0x4c9d8e,{'showHidden':![],'depth':null}));if(this[_0x569b('0xc')][_0x4c9d8e['peer']]){if(!this['agents'][_0x4c9d8e['peer']][_0x569b('0x31')]||_0x4c9d8e[_0x569b('0x13')][_0x569b('0x33')]()=='registered'){this[_0x569b('0xc')][_0x4c9d8e['peer']]['local']=![];this[_0x569b('0xc')][_0x4c9d8e[_0x569b('0x3d')]]['status']=_0x4c9d8e[_0x569b('0x13')][_0x569b('0x33')]();this[_0x569b('0xc')][_0x4c9d8e['peer']][_0x569b('0x3e')]=_0x4c9d8e['address'];this[_0x569b('0xc')][_0x4c9d8e['peer']][_0x569b('0x40')](_0x4c9d8e);}}else if(this[_0x569b('0xd')][_0x4c9d8e[_0x569b('0x3d')]]){this[_0x569b('0xd')][_0x4c9d8e[_0x569b('0x3d')]][_0x569b('0x41')]=_0x4c9d8e[_0x569b('0x13')][_0x569b('0x33')]();this['telephones'][_0x4c9d8e[_0x569b('0x3d')]][_0x569b('0x3e')]=_0x4c9d8e[_0x569b('0x3e')];logger[_0x569b('0x2a')](_0x569b('0x42'),util['inspect'](this[_0x569b('0xd')][_0x4c9d8e['peer']],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x569b('0x36'),this[_0x569b('0xd')][_0x4c9d8e['peer']]['name']),'telephone:save',this['telephones'][_0x4c9d8e[_0x569b('0x3d')]]);}else if(this[_0x569b('0xb')][_0x4c9d8e['peer']]){this[_0x569b('0xb')][_0x4c9d8e[_0x569b('0x3d')]][_0x569b('0x41')]=_0x4c9d8e[_0x569b('0x13')]['toLowerCase']();this['trunks'][_0x4c9d8e[_0x569b('0x3d')]][_0x569b('0x3e')]=_0x4c9d8e[_0x569b('0x3e')];logger[_0x569b('0x2a')](_0x569b('0x43'),util[_0x569b('0x1c')](this[_0x569b('0xb')][_0x4c9d8e['peer']],{'showHidden':![],'depth':null}));this[_0x569b('0x22')](util[_0x569b('0x2b')](_0x569b('0x2c'),this[_0x569b('0xb')][_0x4c9d8e[_0x569b('0x3d')]]['name']),_0x569b('0x44'),this[_0x569b('0xb')][_0x4c9d8e['peer']]);}}}catch(_0x39bd4d){logger[_0x569b('0x19')](_0x569b('0x3f'),util[_0x569b('0x1c')](_0x39bd4d,{'showHidden':![],'depth':null}));}};module[_0x569b('0x45')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 8e2aa0d..ba6d13d 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c04=['type','inbound','merge','omit','event','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','inspect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','info','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','agentringnoanswer','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','transfer','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','syncVarSet','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','syncHangup','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','agentcompleteAt','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','talktime','diff','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','syncBlindTransfer','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','[%s][voiceAgentReport][blindtransfer]','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','syncAgentRingNoAnswer','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','hangup','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','prototype','emit','isNotNull','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','destuniqueid','debug','uniqueid','isUndefined','called','mandatoryDisposition','queue'];(function(_0xfeb9e3,_0x4f3194){var _0x4f2dcf=function(_0x569f95){while(--_0x569f95){_0xfeb9e3['push'](_0xfeb9e3['shift']());}};_0x4f2dcf(++_0x4f3194);}(_0x9c04,0x1b5));var _0x49c0=function(_0x1e035c,_0xf906b){_0x1e035c=_0x1e035c-0x0;var _0x3a63f0=_0x9c04[_0x1e035c];return _0x3a63f0;};'use strict';var _=require('lodash');var moment=require(_0x49c0('0x0'));var util=require(_0x49c0('0x1'));var Redis=require(_0x49c0('0x2'));var config=require(_0x49c0('0x3'));var logger=require(_0x49c0('0x4'))(_0x49c0('0x5'));var ami=require(_0x49c0('0x6'));config[_0x49c0('0x7')]=_[_0x49c0('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x49c0('0x9'))(new Redis(config[_0x49c0('0x7')]));function VoiceAgentReport(_0x395391){this[_0x49c0('0xa')]={};this['voiceQueues']=_0x395391[_0x49c0('0xb')];this[_0x49c0('0xc')]=_0x395391[_0x49c0('0xc')];this[_0x49c0('0xd')]={};ami['on'](_0x49c0('0xe'),this[_0x49c0('0xf')][_0x49c0('0x10')](this));ami['on'](_0x49c0('0x11'),this[_0x49c0('0x12')][_0x49c0('0x10')](this));ami['on']('agentringnoanswer',this[_0x49c0('0x13')]['bind'](this));ami['on']('queuecallerabandon',this[_0x49c0('0x14')][_0x49c0('0x10')](this));ami['on'](_0x49c0('0x15'),this[_0x49c0('0x16')][_0x49c0('0x10')](this));ami['on'](_0x49c0('0x17'),this['syncVarSet'][_0x49c0('0x10')](this));ami['on'](_0x49c0('0x18'),this['syncHangup']['bind'](this));ami['on']('musiconholdstart',this[_0x49c0('0x19')][_0x49c0('0x10')](this));ami['on'](_0x49c0('0x1a'),this[_0x49c0('0x1b')]['bind'](this));ami['on'](_0x49c0('0x1c'),this[_0x49c0('0x1d')][_0x49c0('0x10')](this));ami['on'](_0x49c0('0x1e'),this['syncBlindTransfer'][_0x49c0('0x10')](this));}VoiceAgentReport[_0x49c0('0x1f')][_0x49c0('0x20')]=function(_0x3a5027,_0x4e6c61,_0x746346){io['to'](_0x3a5027)['emit'](_0x4e6c61,_0x746346);};VoiceAgentReport['prototype'][_0x49c0('0x21')]=function(_0x57f6c3){return _0x57f6c3!==null&&!_['isUndefined'](_0x57f6c3);};VoiceAgentReport[_0x49c0('0x1f')][_0x49c0('0xf')]=function(_0x21b73c){try{if(this[_0x49c0('0x21')](_0x21b73c)){logger['info'](_0x49c0('0x22'),_0x21b73c['uniqueid'],_0x21b73c[_0x49c0('0x23')],_0x21b73c[_0x49c0('0x24')]);logger[_0x49c0('0x25')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x21b73c[_0x49c0('0x26')],util['inspect'](_0x21b73c,{'showHidden':![],'depth':null}));if(_[_0x49c0('0x27')](this[_0x49c0('0xa')][_0x21b73c[_0x49c0('0x26')]])){this['channels'][_0x21b73c[_0x49c0('0x26')]]={};}if(_[_0x49c0('0x27')](this[_0x49c0('0xa')][_0x21b73c[_0x49c0('0x26')]][_0x21b73c[_0x49c0('0x24')]])){this[_0x49c0('0xa')][_0x21b73c['uniqueid']][_0x21b73c[_0x49c0('0x24')]]={'agentcalledAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x49c0('0x28'),'mandatoryDisposition':this[_0x49c0('0xb')][_0x21b73c['queue']]?this['voiceQueues'][_0x21b73c['queue']][_0x49c0('0x29')]||![]:![],'type':this[_0x49c0('0xb')][_0x21b73c[_0x49c0('0x2a')]]?this[_0x49c0('0xb')][_0x21b73c[_0x49c0('0x2a')]][_0x49c0('0x2b')]||_0x49c0('0x2c'):_0x49c0('0x2c'),'variables':this[_0x49c0('0xd')][_0x21b73c['uniqueid']]};}_[_0x49c0('0x2d')](this[_0x49c0('0xa')][_0x21b73c[_0x49c0('0x26')]][_0x21b73c[_0x49c0('0x24')]],_[_0x49c0('0x2e')](_0x21b73c,[_0x49c0('0x2f'),'privilege']));logger[_0x49c0('0x25')](_0x49c0('0x30'),_0x21b73c['uniqueid'],util[_0x49c0('0x31')](this[_0x49c0('0xa')][_0x21b73c[_0x49c0('0x26')]][_0x21b73c[_0x49c0('0x24')]],{'showHidden':![],'depth':null}));ami[_0x49c0('0x20')]('custom:agentcalled',this[_0x49c0('0xa')][_0x21b73c[_0x49c0('0x26')]][_0x21b73c['destuniqueid']]);logger['debug'](_0x49c0('0x32'),_0x21b73c[_0x49c0('0x26')],util[_0x49c0('0x31')](this['channels'][_0x21b73c[_0x49c0('0x26')]][_0x21b73c[_0x49c0('0x24')]],{'showHidden':![],'depth':null}));this[_0x49c0('0x20')](util[_0x49c0('0x33')](_0x49c0('0x34'),_0x21b73c[_0x49c0('0x23')]),_0x49c0('0x35'),this[_0x49c0('0xa')][_0x21b73c[_0x49c0('0x26')]][_0x21b73c['destuniqueid']]);}}catch(_0x117e4b){logger[_0x49c0('0x36')](_0x49c0('0x37'),_0x21b73c[_0x49c0('0x26')],util['inspect'](_0x117e4b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x49c0('0x1f')][_0x49c0('0x12')]=function(_0x52123e){try{if(this['isNotNull'](_0x52123e)){if(this[_0x49c0('0xa')][_0x52123e['uniqueid']]){logger[_0x49c0('0x25')](_0x49c0('0x38'),_0x52123e[_0x49c0('0x26')],util['inspect'](_0x52123e,{'showHidden':![],'depth':null}));for(var _0x51c2cc in this[_0x49c0('0xa')][_0x52123e[_0x49c0('0x26')]]){if(this[_0x49c0('0xa')][_0x52123e['uniqueid']][_0x49c0('0x39')](_0x51c2cc)){if(_0x52123e[_0x49c0('0x24')]===_0x51c2cc){logger[_0x49c0('0x3a')](_0x49c0('0x3b'),_0x52123e['uniqueid'],_0x52123e[_0x49c0('0x23')],_0x52123e[_0x49c0('0x24')]);this[_0x49c0('0xa')][_0x52123e[_0x49c0('0x26')]][_0x51c2cc][_0x49c0('0x3c')]=moment()['format'](_0x49c0('0x3d'));this[_0x49c0('0xa')][_0x52123e[_0x49c0('0x26')]][_0x51c2cc][_0x49c0('0x3e')]=_0x52123e[_0x49c0('0x3e')];this[_0x49c0('0xa')][_0x52123e[_0x49c0('0x26')]][_0x51c2cc][_0x49c0('0x3f')]=_0x52123e[_0x49c0('0x3f')];this['channels'][_0x52123e['uniqueid']][_0x51c2cc][_0x49c0('0x40')]=_0x52123e['destchannelstate'];this['channels'][_0x52123e[_0x49c0('0x26')]][_0x51c2cc][_0x49c0('0x41')]=_0x52123e[_0x49c0('0x41')];this['channels'][_0x52123e[_0x49c0('0x26')]][_0x51c2cc]['holdtime']=_0x52123e[_0x49c0('0x42')];this[_0x49c0('0xa')][_0x52123e[_0x49c0('0x26')]][_0x51c2cc][_0x49c0('0x43')]=_0x49c0('0x44');_['merge'](this['agents'][_0x52123e[_0x49c0('0x45')]],_[_0x49c0('0x46')](_0x52123e,['queue',_0x49c0('0x47')]));logger[_0x49c0('0x25')](_0x49c0('0x48'),_0x52123e[_0x49c0('0x26')],util[_0x49c0('0x31')](this['channels'][_0x52123e[_0x49c0('0x26')]][_0x52123e[_0x49c0('0x24')]],{'showHidden':![],'depth':null}));ami[_0x49c0('0x20')]('custom:agentconnect',this[_0x49c0('0xa')][_0x52123e[_0x49c0('0x26')]][_0x52123e[_0x49c0('0x24')]]);logger[_0x49c0('0x25')](_0x49c0('0x49'),_0x52123e[_0x49c0('0x26')],util['inspect'](this[_0x49c0('0xa')][_0x52123e[_0x49c0('0x26')]][_0x52123e[_0x49c0('0x24')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x49c0('0x33')](_0x49c0('0x34'),_0x52123e['membername']),_0x49c0('0x4a'),this['channels'][_0x52123e[_0x49c0('0x26')]][_0x52123e[_0x49c0('0x24')]]);}else if(!this[_0x49c0('0xa')][_0x52123e['uniqueid']][_0x51c2cc]['agentringnoanswer']&&!this[_0x49c0('0xa')][_0x52123e[_0x49c0('0x26')]][_0x51c2cc][_0x49c0('0x15')]){logger[_0x49c0('0x3a')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x52123e[_0x49c0('0x26')],this[_0x49c0('0xa')][_0x52123e[_0x49c0('0x26')]][_0x51c2cc][_0x49c0('0x23')],_0x51c2cc);this[_0x49c0('0xa')][_0x52123e['uniqueid']][_0x51c2cc][_0x49c0('0x4b')]=!![];this['channels'][_0x52123e[_0x49c0('0x26')]][_0x51c2cc][_0x49c0('0x4c')]=moment()[_0x49c0('0x33')](_0x49c0('0x3d'));this[_0x49c0('0xa')][_0x52123e[_0x49c0('0x26')]][_0x51c2cc][_0x49c0('0x4d')]=_0x52123e['destuniqueid'];this[_0x49c0('0xa')][_0x52123e[_0x49c0('0x26')]][_0x51c2cc][_0x49c0('0x4e')]=_0x52123e[_0x49c0('0x23')];this[_0x49c0('0xa')][_0x52123e[_0x49c0('0x26')]][_0x51c2cc][_0x49c0('0x43')]=_0x49c0('0x4f');this[_0x49c0('0xa')][_0x52123e[_0x49c0('0x26')]][_0x51c2cc][_0x49c0('0x50')]='answered_elsewhere';logger[_0x49c0('0x25')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x52123e['uniqueid'],util['inspect'](this['channels'][_0x52123e['uniqueid']][_0x51c2cc],{'showHidden':![],'depth':null}));ami[_0x49c0('0x20')](_0x49c0('0x51'),this[_0x49c0('0xa')][_0x52123e[_0x49c0('0x26')]][_0x51c2cc]);}}}}}}catch(_0x59ff30){logger['error'](_0x49c0('0x52'),_0x52123e['uniqueid'],util[_0x49c0('0x31')](_0x59ff30,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x49c0('0x1f')][_0x49c0('0x13')]=function(_0x6c24c){try{if(this['isNotNull'](_0x6c24c)){logger[_0x49c0('0x25')](_0x49c0('0x53'),_0x6c24c[_0x49c0('0x26')],util[_0x49c0('0x31')](_0x6c24c,{'showHidden':![],'depth':null}));if(this[_0x49c0('0xa')][_0x6c24c['uniqueid']]&&this['channels'][_0x6c24c[_0x49c0('0x26')]][_0x6c24c['destuniqueid']]){logger[_0x49c0('0x3a')](_0x49c0('0x54'),_0x6c24c['uniqueid'],_0x6c24c[_0x49c0('0x23')],_0x6c24c['destuniqueid']);this[_0x49c0('0xa')][_0x6c24c['uniqueid']][_0x6c24c[_0x49c0('0x24')]]['agentringnoanswer']=!![];this[_0x49c0('0xa')][_0x6c24c[_0x49c0('0x26')]][_0x6c24c['destuniqueid']][_0x49c0('0x4c')]=moment()['format'](_0x49c0('0x3d'));this[_0x49c0('0xa')][_0x6c24c[_0x49c0('0x26')]][_0x6c24c['destuniqueid']]['lastevent']=_0x49c0('0x55');this[_0x49c0('0xa')][_0x6c24c[_0x49c0('0x26')]][_0x6c24c['destuniqueid']][_0x49c0('0x50')]=_0x49c0('0x55');logger[_0x49c0('0x25')](_0x49c0('0x56'),_0x6c24c[_0x49c0('0x26')],util[_0x49c0('0x31')](this[_0x49c0('0xa')][_0x6c24c[_0x49c0('0x26')]][_0x6c24c['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x49c0('0x20')](_0x49c0('0x57'),this[_0x49c0('0xa')][_0x6c24c[_0x49c0('0x26')]][_0x6c24c[_0x49c0('0x24')]]);}}}catch(_0x957fc){logger['error'](_0x49c0('0x58'),_0x6c24c[_0x49c0('0x26')],util[_0x49c0('0x31')](_0x957fc,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x49c0('0x14')]=function(_0x317af2){try{if(this[_0x49c0('0x21')](_0x317af2)){logger[_0x49c0('0x25')](_0x49c0('0x59'),_0x317af2['uniqueid'],util['inspect'](_0x317af2,{'showHidden':![],'depth':null}));if(this[_0x49c0('0xa')][_0x317af2[_0x49c0('0x26')]]){for(var _0x3861ec in this[_0x49c0('0xa')][_0x317af2[_0x49c0('0x26')]]){if(this['channels'][_0x317af2[_0x49c0('0x26')]][_0x49c0('0x39')](_0x3861ec)&&!this[_0x49c0('0xa')][_0x317af2[_0x49c0('0x26')]][_0x3861ec][_0x49c0('0x4b')]&&!this['channels'][_0x317af2['uniqueid']][_0x3861ec][_0x49c0('0x15')]){logger[_0x49c0('0x3a')](_0x49c0('0x5a'),_0x317af2[_0x49c0('0x26')],this[_0x49c0('0xa')][_0x317af2['uniqueid']][_0x3861ec][_0x49c0('0x23')],_0x3861ec);this[_0x49c0('0xa')][_0x317af2[_0x49c0('0x26')]][_0x3861ec][_0x49c0('0x4b')]=!![];this[_0x49c0('0xa')][_0x317af2['uniqueid']][_0x3861ec][_0x49c0('0x4c')]=moment()[_0x49c0('0x33')](_0x49c0('0x3d'));this[_0x49c0('0xa')][_0x317af2[_0x49c0('0x26')]][_0x3861ec][_0x49c0('0x43')]=_0x49c0('0x5b');this[_0x49c0('0xa')][_0x317af2[_0x49c0('0x26')]][_0x3861ec]['reason']=_0x49c0('0x5b');logger['debug'](_0x49c0('0x5c'),_0x317af2[_0x49c0('0x26')],util[_0x49c0('0x31')](this[_0x49c0('0xa')][_0x317af2[_0x49c0('0x26')]][_0x3861ec],{'showHidden':![],'depth':null}));ami[_0x49c0('0x20')]('custom:agentqueuecallerabandon',this[_0x49c0('0xa')][_0x317af2['uniqueid']][_0x3861ec]);}}}}}catch(_0x476a9b){logger[_0x49c0('0x36')](_0x49c0('0x5d'),_0x317af2['uniqueid'],util[_0x49c0('0x31')](_0x476a9b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x49c0('0x1f')][_0x49c0('0x16')]=function(_0x42f1e4){try{if(this[_0x49c0('0x21')](_0x42f1e4)){logger['debug'](_0x49c0('0x5e'),_0x42f1e4['uniqueid'],util[_0x49c0('0x31')](_0x42f1e4,{'showHidden':![],'depth':null}));if(this['channels'][_0x42f1e4[_0x49c0('0x26')]]){for(var _0x58ba3c in this[_0x49c0('0xa')][_0x42f1e4[_0x49c0('0x26')]]){if(this[_0x49c0('0xa')][_0x42f1e4[_0x49c0('0x26')]][_0x49c0('0x39')](_0x58ba3c)){if(this[_0x49c0('0xa')][_0x42f1e4[_0x49c0('0x26')]][_0x58ba3c][_0x49c0('0x3c')]&&!this[_0x49c0('0xa')][_0x42f1e4['uniqueid']][_0x58ba3c][_0x49c0('0x15')]){logger['info'](_0x49c0('0x5f'),_0x42f1e4['uniqueid'],this['channels'][_0x42f1e4[_0x49c0('0x26')]][_0x58ba3c][_0x49c0('0x23')],_0x58ba3c);this['channels'][_0x42f1e4[_0x49c0('0x26')]][_0x58ba3c][_0x49c0('0x15')]=!![];this['channels'][_0x42f1e4['uniqueid']][_0x58ba3c]['agentcompleteAt']=moment()['format'](_0x49c0('0x3d'));this[_0x49c0('0xa')][_0x42f1e4[_0x49c0('0x26')]][_0x58ba3c][_0x49c0('0x43')]=_0x49c0('0x60');this[_0x49c0('0xa')][_0x42f1e4['uniqueid']][_0x58ba3c][_0x49c0('0x50')]=_0x42f1e4[_0x49c0('0x50')]==_0x49c0('0x61')?'agent':_0x42f1e4['reason'];this[_0x49c0('0xa')][_0x42f1e4[_0x49c0('0x26')]][_0x58ba3c]['talktime']=_0x42f1e4['talktime'];if(this[_0x49c0('0xb')][_0x42f1e4[_0x49c0('0x2a')]]&&this[_0x49c0('0xb')][_0x42f1e4[_0x49c0('0x2a')]][_0x49c0('0x62')]){this[_0x49c0('0xa')][_0x42f1e4[_0x49c0('0x26')]][_0x58ba3c][_0x49c0('0x63')]=this[_0x49c0('0xb')][_0x42f1e4[_0x49c0('0x2a')]][_0x49c0('0x64')];this[_0x49c0('0xa')][_0x42f1e4[_0x49c0('0x26')]][_0x58ba3c][_0x49c0('0x65')]=!![];}this['agents'][_0x42f1e4[_0x49c0('0x45')]]=_[_0x49c0('0x2e')](this[_0x49c0('0xc')][_0x42f1e4[_0x49c0('0x45')]],[_0x49c0('0x2a'),_0x49c0('0x47')]);logger[_0x49c0('0x25')](_0x49c0('0x66'),_0x42f1e4[_0x49c0('0x26')],util[_0x49c0('0x31')](this['channels'][_0x42f1e4['uniqueid']][_0x58ba3c],{'showHidden':![],'depth':null}));ami[_0x49c0('0x20')](_0x49c0('0x67'),this[_0x49c0('0xa')][_0x42f1e4[_0x49c0('0x26')]][_0x58ba3c]);logger[_0x49c0('0x25')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x42f1e4[_0x49c0('0x26')],util[_0x49c0('0x31')](this[_0x49c0('0xa')][_0x42f1e4[_0x49c0('0x26')]][_0x58ba3c],{'showHidden':![],'depth':null}));this[_0x49c0('0x20')](util[_0x49c0('0x33')](_0x49c0('0x34'),_0x42f1e4[_0x49c0('0x23')]),_0x49c0('0x68'),this['channels'][_0x42f1e4[_0x49c0('0x26')]][_0x58ba3c]);}}}}}}catch(_0x408f1b){logger['error'](_0x49c0('0x69'),_0x42f1e4['uniqueid'],util[_0x49c0('0x31')](_0x408f1b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x49c0('0x1f')][_0x49c0('0x6a')]=function(_0x3e00e1){try{if(this[_0x49c0('0x21')](_0x3e00e1)){logger[_0x49c0('0x25')]('[%s][voiceAgentReport][varset]\x20event:',_0x3e00e1[_0x49c0('0x26')],util[_0x49c0('0x31')](_0x3e00e1,{'showHidden':![],'depth':null}));this[_0x49c0('0x6b')](_0x3e00e1[_0x49c0('0x26')],_[_0x49c0('0x6c')](_0x3e00e1[_0x49c0('0x6d')])[0x0],_0x3e00e1[_0x49c0('0x6e')]);if(this[_0x49c0('0xa')][_0x3e00e1[_0x49c0('0x26')]]){for(var _0x2fcd0a in this[_0x49c0('0xa')][_0x3e00e1[_0x49c0('0x26')]]){if(this['channels'][_0x3e00e1['uniqueid']][_0x49c0('0x39')](_0x2fcd0a)){logger['info'](_0x49c0('0x6f'),_0x3e00e1['uniqueid'],_0x2fcd0a,_['keys'](_0x3e00e1[_0x49c0('0x6d')])[0x0],_0x3e00e1[_0x49c0('0x6e')]);if(_['isUndefined'](this[_0x49c0('0xa')][_0x3e00e1[_0x49c0('0x26')]][_0x2fcd0a][_0x49c0('0xd')])){this[_0x49c0('0xa')][_0x3e00e1[_0x49c0('0x26')]][_0x2fcd0a]['variables']={};}this['channels'][_0x3e00e1[_0x49c0('0x26')]][_0x2fcd0a][_0x49c0('0xd')]=this[_0x49c0('0xd')][_0x3e00e1[_0x49c0('0x26')]];}}}}}catch(_0x2c1432){logger['error'](_0x49c0('0x70'),_0x3e00e1['uniqueid'],util['inspect'](_0x2c1432,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x49c0('0x1f')]['addVariable']=function(_0x75671c,_0x2294ae,_0x19bd27){var _0x4a9b49=[_0x49c0('0x71'),'rtpaudioqosbridged',_0x49c0('0x72'),_0x49c0('0x73'),_0x49c0('0x74'),'rtpaudioqoslossbridged',_0x49c0('0x75'),_0x49c0('0x76'),_0x49c0('0x77'),_0x49c0('0x78'),_0x49c0('0x79'),_0x49c0('0x7a'),'membercalls',_0x49c0('0x7b'),_0x49c0('0x7c'),_0x49c0('0x7d'),_0x49c0('0x23'),_0x49c0('0x7e'),_0x49c0('0x7f')];if(!_['isNil'](_0x2294ae)&&!_[_0x49c0('0x80')](_0x4a9b49,_0x2294ae)){if(_[_0x49c0('0x27')](this[_0x49c0('0xd')][_0x75671c])){this[_0x49c0('0xd')][_0x75671c]={};}this[_0x49c0('0xd')][_0x75671c][_0x2294ae]=_0x19bd27;}};VoiceAgentReport[_0x49c0('0x1f')][_0x49c0('0x81')]=function(_0x3aa373){try{if(this[_0x49c0('0x21')](_0x3aa373)){logger['debug'](_0x49c0('0x82'),_0x3aa373[_0x49c0('0x26')],util[_0x49c0('0x31')](_0x3aa373,{'showHidden':![],'depth':null}));if(this[_0x49c0('0xa')][_0x3aa373[_0x49c0('0x26')]]){for(var _0x237dd9 in this[_0x49c0('0xa')][_0x3aa373[_0x49c0('0x26')]]){if(this['channels'][_0x3aa373[_0x49c0('0x26')]]['hasOwnProperty'](_0x237dd9)){if(this[_0x49c0('0xa')][_0x3aa373[_0x49c0('0x26')]][_0x237dd9][_0x49c0('0x50')]==_0x49c0('0x61')&&this[_0x49c0('0xa')][_0x3aa373[_0x49c0('0x26')]][_0x237dd9][_0x49c0('0x15')]){logger[_0x49c0('0x3a')](_0x49c0('0x83'),_0x3aa373[_0x49c0('0x26')],_0x237dd9);this[_0x49c0('0xa')][_0x3aa373[_0x49c0('0x26')]][_0x237dd9][_0x49c0('0x84')]=moment()[_0x49c0('0x33')](_0x49c0('0x3d'));}}}logger[_0x49c0('0x25')](_0x49c0('0x85'),_0x3aa373[_0x49c0('0x26')],util[_0x49c0('0x31')](_[_0x49c0('0x86')](this['channels'][_0x3aa373[_0x49c0('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x49c0('0x20')](_0x49c0('0x87'),_[_0x49c0('0x86')](this[_0x49c0('0xa')][_0x3aa373[_0x49c0('0x26')]]));delete this[_0x49c0('0xa')][_0x3aa373['uniqueid']];}if(this[_0x49c0('0xd')][_0x3aa373[_0x49c0('0x26')]]){delete this[_0x49c0('0xd')][_0x3aa373[_0x49c0('0x26')]];}}}catch(_0xd01d44){logger[_0x49c0('0x36')](_0x49c0('0x88'),_0x3aa373['uniqueid'],util['inspect'](_0xd01d44,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x49c0('0x1f')]['syncAttendedTransfer']=function(_0xbbaf6e){try{if(this[_0x49c0('0x21')](_0xbbaf6e)){logger[_0x49c0('0x25')](_0x49c0('0x89'),_0xbbaf6e['uniqueid'],util[_0x49c0('0x31')](_0xbbaf6e,{'showHidden':![],'depth':null}));if(this[_0x49c0('0xa')][_0xbbaf6e[_0x49c0('0x8a')]]){for(var _0xe410ae in this[_0x49c0('0xa')][_0xbbaf6e[_0x49c0('0x8a')]]){if(this['channels'][_0xbbaf6e[_0x49c0('0x8a')]][_0x49c0('0x39')](_0xe410ae)){if(_0xbbaf6e[_0x49c0('0x8b')]===_0xe410ae){logger[_0x49c0('0x3a')](_0x49c0('0x8c'),_0xbbaf6e['uniqueid'],this[_0x49c0('0xa')][_0xbbaf6e[_0x49c0('0x8a')]][_0xe410ae]['membername'],_0xe410ae);var _0x171ef1=moment();this[_0x49c0('0xa')][_0xbbaf6e['transfereeuniqueid']][_0xe410ae][_0x49c0('0x15')]=!![];this[_0x49c0('0xa')][_0xbbaf6e[_0x49c0('0x8a')]][_0xe410ae][_0x49c0('0x84')]=moment()[_0x49c0('0x33')](_0x49c0('0x3d'));this[_0x49c0('0xa')][_0xbbaf6e[_0x49c0('0x8a')]][_0xe410ae]['lastevent']='complete';this['channels'][_0xbbaf6e[_0x49c0('0x8a')]][_0xe410ae][_0x49c0('0x50')]='transfer';this[_0x49c0('0xa')][_0xbbaf6e[_0x49c0('0x8a')]][_0xe410ae][_0x49c0('0x8d')]=_0x171ef1[_0x49c0('0x8e')](this[_0x49c0('0xa')][_0xbbaf6e['transfereeuniqueid']][_0xe410ae][_0x49c0('0x3c')],'seconds');}}}}if(this['channels'][_0xbbaf6e[_0x49c0('0x8f')]]){var _0x9f8d6a=this[_0x49c0('0xa')][_0xbbaf6e[_0x49c0('0x8f')]];this[_0x49c0('0xa')][_0xbbaf6e[_0x49c0('0x8f')]]=this[_0x49c0('0xa')][_0xbbaf6e[_0x49c0('0x8a')]];this[_0x49c0('0xa')][_0xbbaf6e[_0x49c0('0x8a')]]=_0x9f8d6a;}}}catch(_0x286e10){logger['error'](_0x49c0('0x90'),_0xbbaf6e['uniqueid'],util[_0x49c0('0x31')](_0x286e10,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x49c0('0x1f')][_0x49c0('0x91')]=function(_0x44058d){try{if(this[_0x49c0('0x21')](_0x44058d)){logger[_0x49c0('0x25')](_0x49c0('0x92'),_0x44058d[_0x49c0('0x26')],util[_0x49c0('0x31')](_0x44058d,{'showHidden':![],'depth':null}));if(this[_0x49c0('0xa')][_0x44058d['transfereeuniqueid']]){for(var _0x34e83b in this[_0x49c0('0xa')][_0x44058d['transfereeuniqueid']]){if(this[_0x49c0('0xa')][_0x44058d[_0x49c0('0x8a')]][_0x49c0('0x39')](_0x34e83b)){if(_0x44058d['transfereruniqueid']===_0x34e83b){logger[_0x49c0('0x3a')](_0x49c0('0x93'),_0x44058d[_0x49c0('0x26')],this[_0x49c0('0xa')][_0x44058d['transfereeuniqueid']][_0x34e83b]['membername'],_0x34e83b);var _0x4db1cc=moment();this[_0x49c0('0xa')][_0x44058d[_0x49c0('0x8a')]][_0x34e83b][_0x49c0('0x15')]=!![];this['channels'][_0x44058d[_0x49c0('0x8a')]][_0x34e83b][_0x49c0('0x84')]=_0x4db1cc;this[_0x49c0('0xa')][_0x44058d[_0x49c0('0x8a')]][_0x34e83b][_0x49c0('0x43')]='complete';this[_0x49c0('0xa')][_0x44058d[_0x49c0('0x8a')]][_0x34e83b][_0x49c0('0x50')]=_0x49c0('0x61');this[_0x49c0('0xa')][_0x44058d[_0x49c0('0x8a')]][_0x34e83b]['talktime']=_0x4db1cc[_0x49c0('0x8e')](this[_0x49c0('0xa')][_0x44058d[_0x49c0('0x8a')]][_0x34e83b]['agentconnectAt'],_0x49c0('0x94'));}}}}}}catch(_0x521591){logger[_0x49c0('0x36')](_0x49c0('0x95'),_0x44058d[_0x49c0('0x26')],util['inspect'](_0x521591,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x49c0('0x1f')][_0x49c0('0x19')]=function(_0x8d45d1){var _0x21a4f9='';try{if(this[_0x49c0('0x21')](_0x8d45d1)){logger[_0x49c0('0x25')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x8d45d1[_0x49c0('0x26')],util['inspect'](_0x8d45d1,{'showHidden':![],'depth':null}));if(_0x8d45d1['channel']){_0x21a4f9=_0x8d45d1[_0x49c0('0x96')][_0x49c0('0x97')](0x0,_0x8d45d1[_0x49c0('0x96')]['lastIndexOf']('-'));if(this['agents'][_0x21a4f9]){logger[_0x49c0('0x3a')](_0x49c0('0x98'),_0x8d45d1[_0x49c0('0x26')],_0x21a4f9);this['agents'][_0x21a4f9][_0x49c0('0x99')]=!![];}}}}catch(_0x4f37c0){logger[_0x49c0('0x36')](_0x49c0('0x9a'),_0x8d45d1[_0x49c0('0x26')],util[_0x49c0('0x31')](_0x4f37c0,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x49c0('0x1b')]=function(_0x26144e){var _0x5826cb='';try{if(this[_0x49c0('0x21')](_0x26144e)){logger[_0x49c0('0x25')](_0x49c0('0x9b'),_0x26144e[_0x49c0('0x26')],util[_0x49c0('0x31')](_0x26144e,{'showHidden':![],'depth':null}));if(_0x26144e[_0x49c0('0x96')]){_0x5826cb=_0x26144e[_0x49c0('0x96')][_0x49c0('0x97')](0x0,_0x26144e[_0x49c0('0x96')][_0x49c0('0x9c')]('-'));if(this[_0x49c0('0xc')][_0x5826cb]){logger[_0x49c0('0x3a')](_0x49c0('0x9d'),_0x26144e[_0x49c0('0x26')],_0x5826cb);this['agents'][_0x5826cb][_0x49c0('0x99')]=![];}}}}catch(_0x277caa){logger[_0x49c0('0x36')](_0x49c0('0x9e'),_0x26144e[_0x49c0('0x26')],util[_0x49c0('0x31')](_0x277caa,{'showHidden':![],'depth':null}));}};module[_0x49c0('0x9f')]=VoiceAgentReport; \ No newline at end of file +var _0xce93=['emit','prototype','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','channels','format','called','queue','mandatoryDisposition','type','inbound','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','isNotNull','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinenum','destchannelstatedesc','holdtime','lastevent','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','agentringnoanswer','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20event:','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','talktime','acw','acwtime','acwTimeout','agentacw','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]','exports','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','voiceQueues','agents','variables','agentcalled','agentconnect','syncAgentConnect','bind','queuecallerabandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce93,0x10f));var _0x3ce9=function(_0x187e24,_0x393e15){_0x187e24=_0x187e24-0x0;var _0x39b658=_0xce93[_0x187e24];return _0x39b658;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x3ce9('0x0'));var Redis=require(_0x3ce9('0x1'));var config=require(_0x3ce9('0x2'));var logger=require(_0x3ce9('0x3'))('ami');var ami=require(_0x3ce9('0x4'));config[_0x3ce9('0x5')]=_[_0x3ce9('0x6')](config['redis'],{'host':_0x3ce9('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceAgentReport(_0x525a32){this['channels']={};this[_0x3ce9('0x8')]=_0x525a32[_0x3ce9('0x8')];this['agents']=_0x525a32[_0x3ce9('0x9')];this[_0x3ce9('0xa')]={};ami['on'](_0x3ce9('0xb'),this['syncAgentCalled']['bind'](this));ami['on'](_0x3ce9('0xc'),this[_0x3ce9('0xd')][_0x3ce9('0xe')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x3ce9('0xe')](this));ami['on'](_0x3ce9('0xf'),this['syncQueueCallerAbandon'][_0x3ce9('0xe')](this));ami['on'](_0x3ce9('0x10'),this[_0x3ce9('0x11')][_0x3ce9('0xe')](this));ami['on'](_0x3ce9('0x12'),this[_0x3ce9('0x13')]['bind'](this));ami['on'](_0x3ce9('0x14'),this[_0x3ce9('0x15')][_0x3ce9('0xe')](this));ami['on'](_0x3ce9('0x16'),this['syncMusicOnHoldStart'][_0x3ce9('0xe')](this));ami['on'](_0x3ce9('0x17'),this[_0x3ce9('0x18')][_0x3ce9('0xe')](this));ami['on'](_0x3ce9('0x19'),this[_0x3ce9('0x1a')][_0x3ce9('0xe')](this));ami['on'](_0x3ce9('0x1b'),this[_0x3ce9('0x1c')][_0x3ce9('0xe')](this));}VoiceAgentReport['prototype'][_0x3ce9('0x1d')]=function(_0x2e8345,_0x2eaa0c,_0x5d14d5){io['to'](_0x2e8345)[_0x3ce9('0x1d')](_0x2eaa0c,_0x5d14d5);};VoiceAgentReport[_0x3ce9('0x1e')]['isNotNull']=function(_0x4a7e92){return _0x4a7e92!==null&&!_[_0x3ce9('0x1f')](_0x4a7e92);};VoiceAgentReport[_0x3ce9('0x1e')]['syncAgentCalled']=function(_0x4f71b2){try{if(this['isNotNull'](_0x4f71b2)){logger[_0x3ce9('0x20')](_0x3ce9('0x21'),_0x4f71b2[_0x3ce9('0x22')],_0x4f71b2[_0x3ce9('0x23')],_0x4f71b2[_0x3ce9('0x24')]);logger[_0x3ce9('0x25')](_0x3ce9('0x26'),_0x4f71b2[_0x3ce9('0x22')],util[_0x3ce9('0x27')](_0x4f71b2,{'showHidden':![],'depth':null}));if(_[_0x3ce9('0x1f')](this[_0x3ce9('0x28')][_0x4f71b2[_0x3ce9('0x22')]])){this[_0x3ce9('0x28')][_0x4f71b2['uniqueid']]={};}if(_[_0x3ce9('0x1f')](this['channels'][_0x4f71b2[_0x3ce9('0x22')]][_0x4f71b2['destuniqueid']])){this[_0x3ce9('0x28')][_0x4f71b2['uniqueid']][_0x4f71b2[_0x3ce9('0x24')]]={'agentcalledAt':moment()[_0x3ce9('0x29')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x3ce9('0x2a'),'mandatoryDisposition':this[_0x3ce9('0x8')][_0x4f71b2['queue']]?this[_0x3ce9('0x8')][_0x4f71b2[_0x3ce9('0x2b')]][_0x3ce9('0x2c')]||![]:![],'type':this[_0x3ce9('0x8')][_0x4f71b2[_0x3ce9('0x2b')]]?this[_0x3ce9('0x8')][_0x4f71b2[_0x3ce9('0x2b')]][_0x3ce9('0x2d')]||_0x3ce9('0x2e'):_0x3ce9('0x2e'),'variables':this[_0x3ce9('0xa')][_0x4f71b2[_0x3ce9('0x22')]]};}_['merge'](this[_0x3ce9('0x28')][_0x4f71b2[_0x3ce9('0x22')]][_0x4f71b2[_0x3ce9('0x24')]],_['omit'](_0x4f71b2,[_0x3ce9('0x2f'),_0x3ce9('0x30')]));logger['debug'](_0x3ce9('0x31'),_0x4f71b2[_0x3ce9('0x22')],util[_0x3ce9('0x27')](this['channels'][_0x4f71b2[_0x3ce9('0x22')]][_0x4f71b2[_0x3ce9('0x24')]],{'showHidden':![],'depth':null}));ami[_0x3ce9('0x1d')]('custom:agentcalled',this[_0x3ce9('0x28')][_0x4f71b2[_0x3ce9('0x22')]][_0x4f71b2[_0x3ce9('0x24')]]);logger[_0x3ce9('0x25')](_0x3ce9('0x32'),_0x4f71b2[_0x3ce9('0x22')],util[_0x3ce9('0x27')](this[_0x3ce9('0x28')][_0x4f71b2['uniqueid']][_0x4f71b2[_0x3ce9('0x24')]],{'showHidden':![],'depth':null}));this[_0x3ce9('0x1d')](util[_0x3ce9('0x29')](_0x3ce9('0x33'),_0x4f71b2[_0x3ce9('0x23')]),_0x3ce9('0x34'),this[_0x3ce9('0x28')][_0x4f71b2['uniqueid']][_0x4f71b2['destuniqueid']]);}}catch(_0x2919a1){logger[_0x3ce9('0x35')](_0x3ce9('0x36'),_0x4f71b2[_0x3ce9('0x22')],util[_0x3ce9('0x27')](_0x2919a1,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x3ce9('0xd')]=function(_0x34931c){try{if(this[_0x3ce9('0x37')](_0x34931c)){if(this[_0x3ce9('0x28')][_0x34931c[_0x3ce9('0x22')]]){logger['debug']('[%s][voiceAgentReport][agentconnect]\x20event:',_0x34931c[_0x3ce9('0x22')],util['inspect'](_0x34931c,{'showHidden':![],'depth':null}));for(var _0x11d3b1 in this['channels'][_0x34931c[_0x3ce9('0x22')]]){if(this[_0x3ce9('0x28')][_0x34931c[_0x3ce9('0x22')]][_0x3ce9('0x38')](_0x11d3b1)){if(_0x34931c['destuniqueid']===_0x11d3b1){logger[_0x3ce9('0x20')](_0x3ce9('0x39'),_0x34931c[_0x3ce9('0x22')],_0x34931c['membername'],_0x34931c[_0x3ce9('0x24')]);this[_0x3ce9('0x28')][_0x34931c['uniqueid']][_0x11d3b1][_0x3ce9('0x3a')]=moment()['format'](_0x3ce9('0x3b'));this['channels'][_0x34931c['uniqueid']][_0x11d3b1]['connectedlinename']=_0x34931c['connectedlinename'];this[_0x3ce9('0x28')][_0x34931c['uniqueid']][_0x11d3b1][_0x3ce9('0x3c')]=_0x34931c[_0x3ce9('0x3c')];this[_0x3ce9('0x28')][_0x34931c[_0x3ce9('0x22')]][_0x11d3b1]['destchannelstate']=_0x34931c['destchannelstate'];this[_0x3ce9('0x28')][_0x34931c['uniqueid']][_0x11d3b1][_0x3ce9('0x3d')]=_0x34931c[_0x3ce9('0x3d')];this[_0x3ce9('0x28')][_0x34931c[_0x3ce9('0x22')]][_0x11d3b1][_0x3ce9('0x3e')]=_0x34931c['holdtime'];this['channels'][_0x34931c[_0x3ce9('0x22')]][_0x11d3b1][_0x3ce9('0x3f')]='connect';_['merge'](this[_0x3ce9('0x9')][_0x34931c[_0x3ce9('0x40')]],_[_0x3ce9('0x41')](_0x34931c,[_0x3ce9('0x2b'),_0x3ce9('0x42')]));logger[_0x3ce9('0x25')](_0x3ce9('0x43'),_0x34931c[_0x3ce9('0x22')],util[_0x3ce9('0x27')](this['channels'][_0x34931c[_0x3ce9('0x22')]][_0x34931c[_0x3ce9('0x24')]],{'showHidden':![],'depth':null}));ami[_0x3ce9('0x1d')](_0x3ce9('0x44'),this[_0x3ce9('0x28')][_0x34931c[_0x3ce9('0x22')]][_0x34931c['destuniqueid']]);logger[_0x3ce9('0x25')](_0x3ce9('0x45'),_0x34931c[_0x3ce9('0x22')],util['inspect'](this[_0x3ce9('0x28')][_0x34931c['uniqueid']][_0x34931c['destuniqueid']],{'showHidden':![],'depth':null}));this['emit'](util['format']('user:%s',_0x34931c[_0x3ce9('0x23')]),'user:agentconnect',this[_0x3ce9('0x28')][_0x34931c['uniqueid']][_0x34931c[_0x3ce9('0x24')]]);}else if(!this[_0x3ce9('0x28')][_0x34931c[_0x3ce9('0x22')]][_0x11d3b1][_0x3ce9('0x46')]&&!this[_0x3ce9('0x28')][_0x34931c[_0x3ce9('0x22')]][_0x11d3b1][_0x3ce9('0x10')]){logger['info'](_0x3ce9('0x47'),_0x34931c[_0x3ce9('0x22')],this[_0x3ce9('0x28')][_0x34931c[_0x3ce9('0x22')]][_0x11d3b1]['membername'],_0x11d3b1);this[_0x3ce9('0x28')][_0x34931c['uniqueid']][_0x11d3b1]['agentringnoanswer']=!![];this[_0x3ce9('0x28')][_0x34931c[_0x3ce9('0x22')]][_0x11d3b1][_0x3ce9('0x48')]=moment()[_0x3ce9('0x29')](_0x3ce9('0x3b'));this[_0x3ce9('0x28')][_0x34931c[_0x3ce9('0x22')]][_0x11d3b1][_0x3ce9('0x49')]=_0x34931c[_0x3ce9('0x24')];this[_0x3ce9('0x28')][_0x34931c[_0x3ce9('0x22')]][_0x11d3b1][_0x3ce9('0x4a')]=_0x34931c[_0x3ce9('0x23')];this[_0x3ce9('0x28')][_0x34931c[_0x3ce9('0x22')]][_0x11d3b1]['lastevent']=_0x3ce9('0x4b');this[_0x3ce9('0x28')][_0x34931c[_0x3ce9('0x22')]][_0x11d3b1][_0x3ce9('0x4c')]='answered_elsewhere';logger[_0x3ce9('0x25')](_0x3ce9('0x4d'),_0x34931c[_0x3ce9('0x22')],util[_0x3ce9('0x27')](this[_0x3ce9('0x28')][_0x34931c[_0x3ce9('0x22')]][_0x11d3b1],{'showHidden':![],'depth':null}));ami['emit'](_0x3ce9('0x4e'),this['channels'][_0x34931c[_0x3ce9('0x22')]][_0x11d3b1]);}}}}}}catch(_0x31c102){logger[_0x3ce9('0x35')](_0x3ce9('0x4f'),_0x34931c[_0x3ce9('0x22')],util[_0x3ce9('0x27')](_0x31c102,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x3ce9('0x50')]=function(_0x3f2664){try{if(this[_0x3ce9('0x37')](_0x3f2664)){logger[_0x3ce9('0x25')](_0x3ce9('0x51'),_0x3f2664['uniqueid'],util[_0x3ce9('0x27')](_0x3f2664,{'showHidden':![],'depth':null}));if(this[_0x3ce9('0x28')][_0x3f2664[_0x3ce9('0x22')]]&&this[_0x3ce9('0x28')][_0x3f2664[_0x3ce9('0x22')]][_0x3f2664[_0x3ce9('0x24')]]){logger['info']('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x3f2664['uniqueid'],_0x3f2664[_0x3ce9('0x23')],_0x3f2664['destuniqueid']);this[_0x3ce9('0x28')][_0x3f2664['uniqueid']][_0x3f2664[_0x3ce9('0x24')]]['agentringnoanswer']=!![];this[_0x3ce9('0x28')][_0x3f2664[_0x3ce9('0x22')]][_0x3f2664[_0x3ce9('0x24')]]['agentringnoanswerAt']=moment()[_0x3ce9('0x29')](_0x3ce9('0x3b'));this[_0x3ce9('0x28')][_0x3f2664['uniqueid']][_0x3f2664[_0x3ce9('0x24')]][_0x3ce9('0x3f')]=_0x3ce9('0x52');this['channels'][_0x3f2664[_0x3ce9('0x22')]][_0x3f2664[_0x3ce9('0x24')]][_0x3ce9('0x4c')]='rejected';logger[_0x3ce9('0x25')](_0x3ce9('0x53'),_0x3f2664[_0x3ce9('0x22')],util[_0x3ce9('0x27')](this[_0x3ce9('0x28')][_0x3f2664[_0x3ce9('0x22')]][_0x3f2664[_0x3ce9('0x24')]],{'showHidden':![],'depth':null}));ami['emit'](_0x3ce9('0x54'),this[_0x3ce9('0x28')][_0x3f2664[_0x3ce9('0x22')]][_0x3f2664[_0x3ce9('0x24')]]);}}}catch(_0xecbef5){logger[_0x3ce9('0x35')](_0x3ce9('0x55'),_0x3f2664[_0x3ce9('0x22')],util[_0x3ce9('0x27')](_0xecbef5,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x3ce9('0x56')]=function(_0x46b1de){try{if(this[_0x3ce9('0x37')](_0x46b1de)){logger[_0x3ce9('0x25')](_0x3ce9('0x57'),_0x46b1de[_0x3ce9('0x22')],util['inspect'](_0x46b1de,{'showHidden':![],'depth':null}));if(this[_0x3ce9('0x28')][_0x46b1de[_0x3ce9('0x22')]]){for(var _0x4b74c8 in this['channels'][_0x46b1de[_0x3ce9('0x22')]]){if(this[_0x3ce9('0x28')][_0x46b1de[_0x3ce9('0x22')]][_0x3ce9('0x38')](_0x4b74c8)&&!this[_0x3ce9('0x28')][_0x46b1de[_0x3ce9('0x22')]][_0x4b74c8][_0x3ce9('0x46')]&&!this[_0x3ce9('0x28')][_0x46b1de[_0x3ce9('0x22')]][_0x4b74c8][_0x3ce9('0x10')]){logger[_0x3ce9('0x20')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x46b1de[_0x3ce9('0x22')],this[_0x3ce9('0x28')][_0x46b1de[_0x3ce9('0x22')]][_0x4b74c8][_0x3ce9('0x23')],_0x4b74c8);this[_0x3ce9('0x28')][_0x46b1de[_0x3ce9('0x22')]][_0x4b74c8]['agentringnoanswer']=!![];this[_0x3ce9('0x28')][_0x46b1de[_0x3ce9('0x22')]][_0x4b74c8][_0x3ce9('0x48')]=moment()[_0x3ce9('0x29')](_0x3ce9('0x3b'));this[_0x3ce9('0x28')][_0x46b1de[_0x3ce9('0x22')]][_0x4b74c8]['lastevent']=_0x3ce9('0x58');this[_0x3ce9('0x28')][_0x46b1de[_0x3ce9('0x22')]][_0x4b74c8]['reason']=_0x3ce9('0x58');logger[_0x3ce9('0x25')](_0x3ce9('0x59'),_0x46b1de[_0x3ce9('0x22')],util[_0x3ce9('0x27')](this[_0x3ce9('0x28')][_0x46b1de[_0x3ce9('0x22')]][_0x4b74c8],{'showHidden':![],'depth':null}));ami[_0x3ce9('0x1d')](_0x3ce9('0x5a'),this[_0x3ce9('0x28')][_0x46b1de[_0x3ce9('0x22')]][_0x4b74c8]);}}}}}catch(_0x2262d6){logger['error'](_0x3ce9('0x5b'),_0x46b1de[_0x3ce9('0x22')],util[_0x3ce9('0x27')](_0x2262d6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3ce9('0x1e')][_0x3ce9('0x11')]=function(_0x24278d){try{if(this[_0x3ce9('0x37')](_0x24278d)){logger[_0x3ce9('0x25')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x24278d['uniqueid'],util[_0x3ce9('0x27')](_0x24278d,{'showHidden':![],'depth':null}));if(this['channels'][_0x24278d[_0x3ce9('0x22')]]){for(var _0x2e3198 in this[_0x3ce9('0x28')][_0x24278d['uniqueid']]){if(this[_0x3ce9('0x28')][_0x24278d['uniqueid']][_0x3ce9('0x38')](_0x2e3198)){if(this['channels'][_0x24278d['uniqueid']][_0x2e3198][_0x3ce9('0x3a')]&&!this[_0x3ce9('0x28')][_0x24278d[_0x3ce9('0x22')]][_0x2e3198]['agentcomplete']){logger[_0x3ce9('0x20')](_0x3ce9('0x5c'),_0x24278d['uniqueid'],this['channels'][_0x24278d['uniqueid']][_0x2e3198][_0x3ce9('0x23')],_0x2e3198);this[_0x3ce9('0x28')][_0x24278d['uniqueid']][_0x2e3198][_0x3ce9('0x10')]=!![];this[_0x3ce9('0x28')][_0x24278d['uniqueid']][_0x2e3198][_0x3ce9('0x5d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x3ce9('0x28')][_0x24278d[_0x3ce9('0x22')]][_0x2e3198]['lastevent']=_0x3ce9('0x5e');this[_0x3ce9('0x28')][_0x24278d[_0x3ce9('0x22')]][_0x2e3198][_0x3ce9('0x4c')]=_0x24278d['reason']==_0x3ce9('0x5f')?'agent':_0x24278d['reason'];this[_0x3ce9('0x28')][_0x24278d[_0x3ce9('0x22')]][_0x2e3198][_0x3ce9('0x60')]=_0x24278d[_0x3ce9('0x60')];if(this['voiceQueues'][_0x24278d['queue']]&&this[_0x3ce9('0x8')][_0x24278d['queue']][_0x3ce9('0x61')]){this['channels'][_0x24278d[_0x3ce9('0x22')]][_0x2e3198][_0x3ce9('0x62')]=this[_0x3ce9('0x8')][_0x24278d[_0x3ce9('0x2b')]][_0x3ce9('0x63')];this[_0x3ce9('0x28')][_0x24278d[_0x3ce9('0x22')]][_0x2e3198][_0x3ce9('0x64')]=!![];}this[_0x3ce9('0x9')][_0x24278d[_0x3ce9('0x40')]]=_['omit'](this['agents'][_0x24278d[_0x3ce9('0x40')]],[_0x3ce9('0x2b'),_0x3ce9('0x42')]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x24278d[_0x3ce9('0x22')],util['inspect'](this[_0x3ce9('0x28')][_0x24278d[_0x3ce9('0x22')]][_0x2e3198],{'showHidden':![],'depth':null}));ami['emit'](_0x3ce9('0x65'),this[_0x3ce9('0x28')][_0x24278d['uniqueid']][_0x2e3198]);logger[_0x3ce9('0x25')](_0x3ce9('0x66'),_0x24278d[_0x3ce9('0x22')],util[_0x3ce9('0x27')](this[_0x3ce9('0x28')][_0x24278d[_0x3ce9('0x22')]][_0x2e3198],{'showHidden':![],'depth':null}));this['emit'](util[_0x3ce9('0x29')](_0x3ce9('0x33'),_0x24278d[_0x3ce9('0x23')]),_0x3ce9('0x67'),this[_0x3ce9('0x28')][_0x24278d['uniqueid']][_0x2e3198]);}}}}}}catch(_0x63dff0){logger[_0x3ce9('0x35')](_0x3ce9('0x68'),_0x24278d[_0x3ce9('0x22')],util['inspect'](_0x63dff0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3ce9('0x1e')]['syncVarSet']=function(_0x35f913){try{if(this[_0x3ce9('0x37')](_0x35f913)){logger[_0x3ce9('0x25')]('[%s][voiceAgentReport][varset]\x20event:',_0x35f913[_0x3ce9('0x22')],util[_0x3ce9('0x27')](_0x35f913,{'showHidden':![],'depth':null}));this['addVariable'](_0x35f913[_0x3ce9('0x22')],_[_0x3ce9('0x69')](_0x35f913[_0x3ce9('0x6a')])[0x0],_0x35f913[_0x3ce9('0x6b')]);if(this[_0x3ce9('0x28')][_0x35f913[_0x3ce9('0x22')]]){for(var _0x386c1a in this[_0x3ce9('0x28')][_0x35f913[_0x3ce9('0x22')]]){if(this['channels'][_0x35f913[_0x3ce9('0x22')]][_0x3ce9('0x38')](_0x386c1a)){logger[_0x3ce9('0x20')](_0x3ce9('0x6c'),_0x35f913[_0x3ce9('0x22')],_0x386c1a,_[_0x3ce9('0x69')](_0x35f913[_0x3ce9('0x6a')])[0x0],_0x35f913[_0x3ce9('0x6b')]);if(_['isUndefined'](this[_0x3ce9('0x28')][_0x35f913[_0x3ce9('0x22')]][_0x386c1a][_0x3ce9('0xa')])){this['channels'][_0x35f913['uniqueid']][_0x386c1a][_0x3ce9('0xa')]={};}this[_0x3ce9('0x28')][_0x35f913[_0x3ce9('0x22')]][_0x386c1a][_0x3ce9('0xa')]=this['variables'][_0x35f913[_0x3ce9('0x22')]];}}}}}catch(_0x5dcef6){logger['error'](_0x3ce9('0x6d'),_0x35f913['uniqueid'],util[_0x3ce9('0x27')](_0x5dcef6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3ce9('0x1e')][_0x3ce9('0x6e')]=function(_0x450cd3,_0x2c81e6,_0x9719c5){var _0x230dcb=['rtpaudioqos','rtpaudioqosbridged',_0x3ce9('0x6f'),_0x3ce9('0x70'),'rtpaudioqosloss',_0x3ce9('0x71'),_0x3ce9('0x72'),_0x3ce9('0x73'),_0x3ce9('0x74'),_0x3ce9('0x75'),'bridgepeer',_0x3ce9('0x76'),_0x3ce9('0x77'),_0x3ce9('0x78'),_0x3ce9('0x79'),_0x3ce9('0x7a'),'membername',_0x3ce9('0x7b'),_0x3ce9('0x7c')];if(!_['isNil'](_0x2c81e6)&&!_[_0x3ce9('0x7d')](_0x230dcb,_0x2c81e6)){if(_[_0x3ce9('0x1f')](this['variables'][_0x450cd3])){this[_0x3ce9('0xa')][_0x450cd3]={};}this['variables'][_0x450cd3][_0x2c81e6]=_0x9719c5;}};VoiceAgentReport[_0x3ce9('0x1e')][_0x3ce9('0x15')]=function(_0x5558d2){try{if(this[_0x3ce9('0x37')](_0x5558d2)){logger[_0x3ce9('0x25')](_0x3ce9('0x7e'),_0x5558d2[_0x3ce9('0x22')],util[_0x3ce9('0x27')](_0x5558d2,{'showHidden':![],'depth':null}));if(this[_0x3ce9('0x28')][_0x5558d2[_0x3ce9('0x22')]]){for(var _0x51233f in this[_0x3ce9('0x28')][_0x5558d2['uniqueid']]){if(this[_0x3ce9('0x28')][_0x5558d2[_0x3ce9('0x22')]][_0x3ce9('0x38')](_0x51233f)){if(this[_0x3ce9('0x28')][_0x5558d2['uniqueid']][_0x51233f]['reason']==_0x3ce9('0x5f')&&this[_0x3ce9('0x28')][_0x5558d2['uniqueid']][_0x51233f][_0x3ce9('0x10')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x5558d2[_0x3ce9('0x22')],_0x51233f);this[_0x3ce9('0x28')][_0x5558d2[_0x3ce9('0x22')]][_0x51233f][_0x3ce9('0x5d')]=moment()[_0x3ce9('0x29')](_0x3ce9('0x3b'));}}}logger['debug'](_0x3ce9('0x7f'),_0x5558d2[_0x3ce9('0x22')],util[_0x3ce9('0x27')](_[_0x3ce9('0x80')](this[_0x3ce9('0x28')][_0x5558d2['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0x3ce9('0x1d')](_0x3ce9('0x81'),_[_0x3ce9('0x80')](this[_0x3ce9('0x28')][_0x5558d2[_0x3ce9('0x22')]]));delete this['channels'][_0x5558d2[_0x3ce9('0x22')]];}if(this[_0x3ce9('0xa')][_0x5558d2[_0x3ce9('0x22')]]){delete this[_0x3ce9('0xa')][_0x5558d2[_0x3ce9('0x22')]];}}}catch(_0x19ba75){logger[_0x3ce9('0x35')]('[%s][voiceAgentReport][hangup]',_0x5558d2[_0x3ce9('0x22')],util[_0x3ce9('0x27')](_0x19ba75,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3ce9('0x1e')][_0x3ce9('0x1a')]=function(_0x57cde2){try{if(this[_0x3ce9('0x37')](_0x57cde2)){logger['debug'](_0x3ce9('0x82'),_0x57cde2[_0x3ce9('0x22')],util[_0x3ce9('0x27')](_0x57cde2,{'showHidden':![],'depth':null}));if(this[_0x3ce9('0x28')][_0x57cde2[_0x3ce9('0x83')]]){for(var _0x45f42f in this['channels'][_0x57cde2[_0x3ce9('0x83')]]){if(this[_0x3ce9('0x28')][_0x57cde2[_0x3ce9('0x83')]][_0x3ce9('0x38')](_0x45f42f)){if(_0x57cde2[_0x3ce9('0x84')]===_0x45f42f){logger[_0x3ce9('0x20')](_0x3ce9('0x85'),_0x57cde2[_0x3ce9('0x22')],this['channels'][_0x57cde2['transfereeuniqueid']][_0x45f42f][_0x3ce9('0x23')],_0x45f42f);var _0x32d8b3=moment();this['channels'][_0x57cde2[_0x3ce9('0x83')]][_0x45f42f][_0x3ce9('0x10')]=!![];this[_0x3ce9('0x28')][_0x57cde2['transfereeuniqueid']][_0x45f42f][_0x3ce9('0x5d')]=moment()[_0x3ce9('0x29')](_0x3ce9('0x3b'));this[_0x3ce9('0x28')][_0x57cde2[_0x3ce9('0x83')]][_0x45f42f][_0x3ce9('0x3f')]=_0x3ce9('0x5e');this[_0x3ce9('0x28')][_0x57cde2['transfereeuniqueid']][_0x45f42f][_0x3ce9('0x4c')]=_0x3ce9('0x5f');this[_0x3ce9('0x28')][_0x57cde2['transfereeuniqueid']][_0x45f42f][_0x3ce9('0x60')]=_0x32d8b3[_0x3ce9('0x86')](this[_0x3ce9('0x28')][_0x57cde2[_0x3ce9('0x83')]][_0x45f42f][_0x3ce9('0x3a')],'seconds');}}}}if(this[_0x3ce9('0x28')][_0x57cde2[_0x3ce9('0x87')]]){var _0x287f05=this[_0x3ce9('0x28')][_0x57cde2[_0x3ce9('0x87')]];this[_0x3ce9('0x28')][_0x57cde2['secondtransfereruniqueid']]=this[_0x3ce9('0x28')][_0x57cde2[_0x3ce9('0x83')]];this[_0x3ce9('0x28')][_0x57cde2[_0x3ce9('0x83')]]=_0x287f05;}}}catch(_0xc1ad4c){logger[_0x3ce9('0x35')](_0x3ce9('0x88'),_0x57cde2[_0x3ce9('0x22')],util[_0x3ce9('0x27')](_0xc1ad4c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3ce9('0x1e')]['syncBlindTransfer']=function(_0x8afa75){try{if(this[_0x3ce9('0x37')](_0x8afa75)){logger[_0x3ce9('0x25')](_0x3ce9('0x89'),_0x8afa75[_0x3ce9('0x22')],util[_0x3ce9('0x27')](_0x8afa75,{'showHidden':![],'depth':null}));if(this[_0x3ce9('0x28')][_0x8afa75[_0x3ce9('0x83')]]){for(var _0x246958 in this[_0x3ce9('0x28')][_0x8afa75[_0x3ce9('0x83')]]){if(this['channels'][_0x8afa75[_0x3ce9('0x83')]][_0x3ce9('0x38')](_0x246958)){if(_0x8afa75[_0x3ce9('0x8a')]===_0x246958){logger[_0x3ce9('0x20')](_0x3ce9('0x8b'),_0x8afa75['uniqueid'],this[_0x3ce9('0x28')][_0x8afa75[_0x3ce9('0x83')]][_0x246958][_0x3ce9('0x23')],_0x246958);var _0x41f375=moment();this[_0x3ce9('0x28')][_0x8afa75['transfereeuniqueid']][_0x246958][_0x3ce9('0x10')]=!![];this[_0x3ce9('0x28')][_0x8afa75[_0x3ce9('0x83')]][_0x246958][_0x3ce9('0x5d')]=_0x41f375;this[_0x3ce9('0x28')][_0x8afa75[_0x3ce9('0x83')]][_0x246958]['lastevent']=_0x3ce9('0x5e');this[_0x3ce9('0x28')][_0x8afa75[_0x3ce9('0x83')]][_0x246958]['reason']=_0x3ce9('0x5f');this[_0x3ce9('0x28')][_0x8afa75[_0x3ce9('0x83')]][_0x246958]['talktime']=_0x41f375[_0x3ce9('0x86')](this[_0x3ce9('0x28')][_0x8afa75['transfereeuniqueid']][_0x246958][_0x3ce9('0x3a')],_0x3ce9('0x8c'));}}}}}}catch(_0x337ca1){logger[_0x3ce9('0x35')](_0x3ce9('0x8d'),_0x8afa75[_0x3ce9('0x22')],util[_0x3ce9('0x27')](_0x337ca1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3ce9('0x1e')]['syncMusicOnHoldStart']=function(_0x569c53){var _0x1b4b5d='';try{if(this[_0x3ce9('0x37')](_0x569c53)){logger[_0x3ce9('0x25')](_0x3ce9('0x8e'),_0x569c53[_0x3ce9('0x22')],util['inspect'](_0x569c53,{'showHidden':![],'depth':null}));if(_0x569c53[_0x3ce9('0x8f')]){_0x1b4b5d=_0x569c53[_0x3ce9('0x8f')][_0x3ce9('0x90')](0x0,_0x569c53[_0x3ce9('0x8f')]['lastIndexOf']('-'));if(this[_0x3ce9('0x9')][_0x1b4b5d]){logger[_0x3ce9('0x20')](_0x3ce9('0x91'),_0x569c53[_0x3ce9('0x22')],_0x1b4b5d);this[_0x3ce9('0x9')][_0x1b4b5d][_0x3ce9('0x92')]=!![];}}}}catch(_0x59dd5e){logger[_0x3ce9('0x35')]('[%s][voiceAgentReport][musiconholdstart]',_0x569c53[_0x3ce9('0x22')],util['inspect'](_0x59dd5e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x3ce9('0x18')]=function(_0x5be634){var _0x4419a7='';try{if(this[_0x3ce9('0x37')](_0x5be634)){logger[_0x3ce9('0x25')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x5be634[_0x3ce9('0x22')],util['inspect'](_0x5be634,{'showHidden':![],'depth':null}));if(_0x5be634[_0x3ce9('0x8f')]){_0x4419a7=_0x5be634[_0x3ce9('0x8f')]['substring'](0x0,_0x5be634['channel'][_0x3ce9('0x93')]('-'));if(this['agents'][_0x4419a7]){logger[_0x3ce9('0x20')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x5be634['uniqueid'],_0x4419a7);this[_0x3ce9('0x9')][_0x4419a7][_0x3ce9('0x92')]=![];}}}}catch(_0x726afe){logger[_0x3ce9('0x35')](_0x3ce9('0x94'),_0x5be634[_0x3ce9('0x22')],util[_0x3ce9('0x27')](_0x726afe,{'showHidden':![],'depth':null}));}};module[_0x3ce9('0x95')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index eb35fea..2c23170 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf7df=['channelstate','from-sip','split','destconnectedlinenum','exten','accountcode','format','user:%s','[%s][voiceCallReport][newchannel]','application','toLowerCase','applicationdata','appdata','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','disposition','pick','lastapplication','lastdata','startsWith','cdr(','match','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','membername','name','UserId','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','monitorFilename','monitors','rec','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','value','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','parse','syncHangup','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','isNil','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','exports','bluebird','moment','util','path','../../../config/environment','ami','../ami','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','set','queue','agi','dial','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','varset','syncVarSet','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','info','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','keys','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','context','starttime','toNumber'];(function(_0x1dc855,_0x52a9ca){var _0x2e6b5c=function(_0x4e35d1){while(--_0x4e35d1){_0x1dc855['push'](_0x1dc855['shift']());}};_0x2e6b5c(++_0x52a9ca);}(_0xf7df,0x68));var _0xff7d=function(_0x33868d,_0x4e71e7){_0x33868d=_0x33868d-0x0;var _0x4d7590=_0xf7df[_0x33868d];return _0x4d7590;};'use strict';var BPromise=require(_0xff7d('0x0'));var _=require('lodash');var moment=require(_0xff7d('0x1'));var util=require(_0xff7d('0x2'));var path=require(_0xff7d('0x3'));var Redis=require('ioredis');var config=require(_0xff7d('0x4'));var logger=require('../../../config/logger')(_0xff7d('0x5'));var ami=require(_0xff7d('0x6'));var Channel=require('../model/channel');var statusDesc=[_0xff7d('0x7'),_0xff7d('0x8'),_0xff7d('0x9'),_0xff7d('0xa'),_0xff7d('0xb'),_0xff7d('0xc'),_0xff7d('0xd'),_0xff7d('0xe'),_0xff7d('0xf')];var applications=[_0xff7d('0x10'),_0xff7d('0x11'),_0xff7d('0x12'),_0xff7d('0x13'),'playback',_0xff7d('0x14')];var dispositions=[_0xff7d('0x15'),_0xff7d('0x16'),'FAILED',_0xff7d('0x15'),_0xff7d('0x15'),_0xff7d('0x15'),_0xff7d('0x17'),_0xff7d('0x18'),'FAILED',_0xff7d('0x16'),_0xff7d('0x16')];var actions={};config['redis']=_['defaults'](config[_0xff7d('0x19')],{'host':_0xff7d('0x1a'),'port':0x18eb});var io=require(_0xff7d('0x1b'))(new Redis(config[_0xff7d('0x19')]));function VoiceCallReport(_0x382696){this[_0xff7d('0x1c')]=_0x382696[_0xff7d('0x1c')];this[_0xff7d('0x1d')]=_0x382696['agents'];this[_0xff7d('0x1e')]={};ami['on'](_0xff7d('0x1f'),this[_0xff7d('0x20')][_0xff7d('0x21')](this));ami['on'](_0xff7d('0x22'),this[_0xff7d('0x20')][_0xff7d('0x21')](this));ami['on'](_0xff7d('0x23'),this[_0xff7d('0x24')][_0xff7d('0x21')](this));ami['on'](_0xff7d('0x25'),this['syncNewState'][_0xff7d('0x21')](this));ami['on'](_0xff7d('0x26'),this[_0xff7d('0x27')][_0xff7d('0x21')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on']('newcallerid',this[_0xff7d('0x28')][_0xff7d('0x21')](this));ami['on'](_0xff7d('0x29'),this[_0xff7d('0x2a')][_0xff7d('0x21')](this));ami['on'](_0xff7d('0x2b'),this[_0xff7d('0x2c')][_0xff7d('0x21')](this));ami['on'](_0xff7d('0x2d'),this[_0xff7d('0x2e')]['bind'](this));ami['on'](_0xff7d('0x2f'),this[_0xff7d('0x30')]['bind'](this));try{logger['info'](_0xff7d('0x31'));ami[_0xff7d('0x32')]();}catch(_0x2b1246){logger[_0xff7d('0x33')](_0xff7d('0x34'),util[_0xff7d('0x35')](_0x2b1246,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xff7d('0x36')][_0xff7d('0x37')]=function(_0x12567d){return _0x12567d!==null&&!_[_0xff7d('0x38')](_0x12567d);};VoiceCallReport['prototype'][_0xff7d('0x39')]=function(_0x2b2b49,_0x2dc0bb,_0x5408cb){io['to'](_0x2b2b49)[_0xff7d('0x39')](_0x2dc0bb,_0x5408cb);};VoiceCallReport['prototype'][_0xff7d('0x28')]=function(_0x45a1e2){try{if(this[_0xff7d('0x37')](_0x45a1e2)){logger[_0xff7d('0x3a')](_0xff7d('0x3b'),_0x45a1e2[_0xff7d('0x3c')],_0x45a1e2[_0xff7d('0x3d')],_0x45a1e2[_0xff7d('0x3e')]);logger[_0xff7d('0x3f')](_0xff7d('0x40'),_0x45a1e2[_0xff7d('0x3c')],util[_0xff7d('0x35')](_0x45a1e2,{'showHidden':![],'depth':null}));if(_0x45a1e2['uniqueid']===_0x45a1e2[_0xff7d('0x41')]){if(!_[_0xff7d('0x38')](this[_0xff7d('0x1c')][_0x45a1e2[_0xff7d('0x3c')]])){_[_0xff7d('0x42')](this[_0xff7d('0x1c')][_0x45a1e2[_0xff7d('0x3c')]],_['pick'](_0x45a1e2,_[_0xff7d('0x43')](this['channels'][_0x45a1e2[_0xff7d('0x3c')]])));}}}}catch(_0x18de61){logger['error'](_0xff7d('0x44'),_0x45a1e2[_0xff7d('0x3c')],util[_0xff7d('0x35')](_0x18de61,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xff7d('0x36')][_0xff7d('0x24')]=function(_0x1ee13e){try{if(this[_0xff7d('0x37')](_0x1ee13e)){logger['debug'](_0xff7d('0x45'),_0x1ee13e[_0xff7d('0x3c')],util[_0xff7d('0x35')](_0x1ee13e,{'showHidden':![],'depth':null}));if(_0x1ee13e[_0xff7d('0x3c')]===_0x1ee13e[_0xff7d('0x41')]&&_0x1ee13e[_0xff7d('0x46')]!=_0xff7d('0x47')){if(_[_0xff7d('0x38')](this[_0xff7d('0x1c')][_0x1ee13e['uniqueid']])){logger[_0xff7d('0x3a')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x1ee13e[_0xff7d('0x3c')],_0x1ee13e[_0xff7d('0x48')],_0x1ee13e['exten']);this[_0xff7d('0x1c')][_0x1ee13e[_0xff7d('0x3c')]]=new Channel();this[_0xff7d('0x1c')][_0x1ee13e[_0xff7d('0x3c')]][_0xff7d('0x49')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x1ee13e[_0xff7d('0x3c')]]['disposition']=dispositions[_[_0xff7d('0x4a')](_0x1ee13e[_0xff7d('0x4b')])];_[_0xff7d('0x42')](this[_0xff7d('0x1c')][_0x1ee13e['uniqueid']],_['pick'](_0x1ee13e,_[_0xff7d('0x43')](this[_0xff7d('0x1c')][_0x1ee13e[_0xff7d('0x3c')]])));if(_0x1ee13e[_0xff7d('0x48')]===_0xff7d('0x4c')){if(this['agents'][_0x1ee13e[_0xff7d('0x46')][_0xff7d('0x4d')]('-')[0x0]]){this[_0xff7d('0x1d')][_0x1ee13e[_0xff7d('0x46')]['split']('-')[0x0]][_0xff7d('0x4e')]=_0x1ee13e[_0xff7d('0x4f')];logger['debug']('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x1ee13e[_0xff7d('0x3c')],util['inspect']({'destaccountcode':this[_0xff7d('0x1d')][_0x1ee13e['channel']['split']('-')[0x0]][_0xff7d('0x50')],'destconnectedlinenum':_0x1ee13e[_0xff7d('0x4f')]},{'showHidden':![],'depth':null}));this[_0xff7d('0x39')](util[_0xff7d('0x51')](_0xff7d('0x52'),this['agents'][_0x1ee13e[_0xff7d('0x46')][_0xff7d('0x4d')]('-')[0x0]]['name']),'user:agentconnect',{'destaccountcode':this[_0xff7d('0x1d')][_0x1ee13e[_0xff7d('0x46')][_0xff7d('0x4d')]('-')[0x0]][_0xff7d('0x50')],'destconnectedlinenum':_0x1ee13e[_0xff7d('0x4f')]});}}}}}}catch(_0x5893c8){logger[_0xff7d('0x33')](_0xff7d('0x53'),_0x1ee13e[_0xff7d('0x3c')],util['inspect'](_0x5893c8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xff7d('0x36')][_0xff7d('0x20')]=function(_0x266638){try{if(this[_0xff7d('0x37')](_0x266638)){logger[_0xff7d('0x3f')]('[%s][voiceCallReport][newexten]\x20event:',_0x266638[_0xff7d('0x3c')],util['inspect'](_0x266638,{'showHidden':![],'depth':null}));if(_0x266638[_0xff7d('0x3c')]===_0x266638['linkedid']&&_0x266638[_0xff7d('0x4f')]!='h'&&_0x266638[_0xff7d('0x46')]!='OutgoingSpoolFailed'){_0x266638[_0xff7d('0x54')]=_0x266638[_0xff7d('0x54')][_0xff7d('0x55')]();_0x266638[_0xff7d('0x56')]=(_0x266638[_0xff7d('0x57')]||_0x266638['applicationdata'])[_0xff7d('0x55')]();logger[_0xff7d('0x3a')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x266638[_0xff7d('0x3c')],_0x266638[_0xff7d('0x54')],_0x266638[_0xff7d('0x56')]);if(_[_0xff7d('0x38')](this[_0xff7d('0x1c')][_0x266638[_0xff7d('0x3c')]])){this[_0xff7d('0x1c')][_0x266638['uniqueid']]=new Channel();this[_0xff7d('0x1c')][_0x266638['uniqueid']]['starttime']=_0x266638[_0xff7d('0x58')]?moment()['subtract'](moment[_0xff7d('0x58')](_0x266638[_0xff7d('0x58')])[_0xff7d('0x59')](),_0xff7d('0x59'))[_0xff7d('0x51')](_0xff7d('0x5a')):moment()[_0xff7d('0x51')](_0xff7d('0x5a'));this[_0xff7d('0x1c')][_0x266638['uniqueid']][_0xff7d('0x5b')]=_0xff7d('0x15');}_[_0xff7d('0x42')](this[_0xff7d('0x1c')][_0x266638[_0xff7d('0x3c')]],_[_0xff7d('0x5c')](_0x266638,_[_0xff7d('0x43')](this[_0xff7d('0x1c')][_0x266638['uniqueid']])));if(_['includes'](applications,_0x266638[_0xff7d('0x54')])){this['channels'][_0x266638['uniqueid']][_0xff7d('0x5d')]=_0x266638['application'];this[_0xff7d('0x1c')][_0x266638['uniqueid']][_0xff7d('0x5e')]=_0x266638[_0xff7d('0x56')];if(_0x266638[_0xff7d('0x54')]===_0xff7d('0x10')&&_[_0xff7d('0x5f')](_0x266638[_0xff7d('0x56')],_0xff7d('0x60'))){var _0x58684d=_0x266638[_0xff7d('0x56')]['split']('=');var _0x5acac0=_0x58684d[0x0][_0xff7d('0x61')](/cdr\((.*)\)/);if(_0x5acac0){this[_0xff7d('0x1c')][_0x266638[_0xff7d('0x3c')]][_0x5acac0[0x1]]=_0x58684d[0x1];}}else if(_0x266638['application']==='queue'){this['channels'][_0x266638[_0xff7d('0x3c')]][_0xff7d('0x11')]=_0x266638[_0xff7d('0x56')][_0xff7d('0x4d')](',')[0x0];}}}}}catch(_0x4c75bb){logger[_0xff7d('0x33')](_0xff7d('0x62'),_0x266638[_0xff7d('0x3c')],util[_0xff7d('0x35')](_0x4c75bb,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xff7d('0x36')][_0xff7d('0x63')]=function(_0x3a1d91){try{if(this[_0xff7d('0x37')](_0x3a1d91)){logger['info'](_0xff7d('0x64'),_0x3a1d91[_0xff7d('0x3c')],_0x3a1d91[_0xff7d('0x41')],_0x3a1d91['calleridname'],_0x3a1d91['calleridnum']);logger[_0xff7d('0x3f')](_0xff7d('0x65'),_0x3a1d91[_0xff7d('0x3c')],util[_0xff7d('0x35')](_0x3a1d91,{'showHidden':![],'depth':null}));if(_0x3a1d91[_0xff7d('0x3c')]!==_0x3a1d91[_0xff7d('0x41')]){if(this[_0xff7d('0x1c')][_0x3a1d91[_0xff7d('0x41')]]){if(_0x3a1d91['channelstate']==='6'){if(!this[_0xff7d('0x1c')][_0x3a1d91[_0xff7d('0x41')]][_0xff7d('0x66')]){var _0x4829bd=moment();this[_0xff7d('0x1c')][_0x3a1d91['linkedid']]['answered']=!![];this[_0xff7d('0x1c')][_0x3a1d91[_0xff7d('0x41')]][_0xff7d('0x67')]=_0x4829bd[_0xff7d('0x51')](_0xff7d('0x5a'));if(this[_0xff7d('0x1c')][_0x3a1d91['linkedid']]['starttime']){this[_0xff7d('0x1c')][_0x3a1d91[_0xff7d('0x41')]][_0xff7d('0x68')]=_0x4829bd[_0xff7d('0x69')](this['channels'][_0x3a1d91[_0xff7d('0x41')]][_0xff7d('0x49')],_0xff7d('0x59'));}}this[_0xff7d('0x1c')][_0x3a1d91[_0xff7d('0x41')]]['linkedid']=_0x3a1d91[_0xff7d('0x3c')];if(_0x3a1d91['calleridnum']!==_0xff7d('0x6a')){this['channels'][_0x3a1d91['linkedid']][_0xff7d('0x6b')]=_0x3a1d91['calleridnum'];}this[_0xff7d('0x1c')][_0x3a1d91[_0xff7d('0x41')]][_0xff7d('0x6c')]=_0x3a1d91[_0xff7d('0x3d')];this[_0xff7d('0x1c')][_0x3a1d91[_0xff7d('0x41')]][_0xff7d('0x6d')]=_0x3a1d91[_0xff7d('0x46')];this[_0xff7d('0x1c')][_0x3a1d91[_0xff7d('0x41')]]['disposition']=dispositions[_[_0xff7d('0x4a')](_0x3a1d91[_0xff7d('0x4b')])];if(this[_0xff7d('0x1d')][_0x3a1d91['channel']['split']('-')[0x0]]){this[_0xff7d('0x1c')][_0x3a1d91[_0xff7d('0x41')]]['UserId']=this[_0xff7d('0x1d')][_0x3a1d91['channel']['split']('-')[0x0]]['id'];this['channels'][_0x3a1d91[_0xff7d('0x41')]][_0xff7d('0x6e')]=this['agents'][_0x3a1d91[_0xff7d('0x46')][_0xff7d('0x4d')]('-')[0x0]][_0xff7d('0x6f')];}}}}else{if(this['channels'][_0x3a1d91[_0xff7d('0x3c')]]){if(_0x3a1d91[_0xff7d('0x4b')]==='6'){if(this[_0xff7d('0x1d')][_0x3a1d91[_0xff7d('0x46')][_0xff7d('0x4d')]('-')[0x0]]){this[_0xff7d('0x1c')][_0x3a1d91[_0xff7d('0x3c')]][_0xff7d('0x70')]=this[_0xff7d('0x1d')][_0x3a1d91['channel']['split']('-')[0x0]]['id'];this[_0xff7d('0x1c')][_0x3a1d91[_0xff7d('0x3c')]]['membername']=this[_0xff7d('0x1d')][_0x3a1d91[_0xff7d('0x46')][_0xff7d('0x4d')]('-')[0x0]][_0xff7d('0x6f')];}}}}}}catch(_0x3c5b3a){logger[_0xff7d('0x33')](_0xff7d('0x71'),_0x3a1d91['uniqueid'],util[_0xff7d('0x35')](_0x3c5b3a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xff7d('0x36')][_0xff7d('0x72')]=function(_0x5ac124,_0x1f13d9){try{if(this[_0xff7d('0x1c')][_0x5ac124]){logger[_0xff7d('0x3a')](_0xff7d('0x73'),_0x5ac124,_0x1f13d9);this['channels'][_0x5ac124][_0xff7d('0x74')]=!![];if(_['endsWith'](_0x1f13d9,_0xff7d('0x75'))){_0x1f13d9=_0x1f13d9['replace'](_0xff7d('0x75'),'.WAV');}this['channels'][_0x5ac124][_0xff7d('0x76')]=_0x1f13d9;var _0x50de55=_['find'](this['channels'][_0x5ac124][_0xff7d('0x77')],{'filename':_0x1f13d9});if(_['isNil'](_0x50de55)){this[_0xff7d('0x1c')][_0x5ac124][_0xff7d('0x77')]['push']({'filename':_0x1f13d9,'createdAt':moment()[_0xff7d('0x51')](_0xff7d('0x5a')),'mixmonitorid':'','status':_0xff7d('0x78')});}}}catch(_0x9ba78){logger[_0xff7d('0x33')]('[%s][voiceCallReport][mixMonitorFilename]',_0x5ac124,util['inspect'](_0x9ba78,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xff7d('0x27')]=function(_0x25d0b5){try{if(this[_0xff7d('0x37')](_0x25d0b5)){logger[_0xff7d('0x3f')]('[%s][voiceCallReport][varset]\x20event:',_0x25d0b5[_0xff7d('0x3c')],util[_0xff7d('0x35')](_0x25d0b5,{'showHidden':![],'depth':null}));if(this[_0xff7d('0x1c')][_0x25d0b5['uniqueid']]&&_0x25d0b5[_0xff7d('0x46')]!=_0xff7d('0x47')){if(this[_0xff7d('0x37')](_0x25d0b5['variable'])){if(this[_0xff7d('0x37')](_0x25d0b5[_0xff7d('0x79')][_0xff7d('0x7a')])){logger[_0xff7d('0x3a')](_0xff7d('0x7b'),_0x25d0b5[_0xff7d('0x3c')],_0x25d0b5['value']);this[_0xff7d('0x72')](_0x25d0b5['uniqueid'],_0x25d0b5['value']);}else if(this[_0xff7d('0x37')](_0x25d0b5[_0xff7d('0x79')][_0xff7d('0x7c')])){logger[_0xff7d('0x3a')](_0xff7d('0x7d'),_0x25d0b5[_0xff7d('0x3c')],_0x25d0b5[_0xff7d('0x7e')]);this[_0xff7d('0x1c')][_0x25d0b5[_0xff7d('0x3c')]][_0xff7d('0x3e')]=_0x25d0b5['value'];}else if(this[_0xff7d('0x37')](_0x25d0b5['variable']['xmd-callerid'])){logger[_0xff7d('0x3a')](_0xff7d('0x7f'),_0x25d0b5[_0xff7d('0x3c')],_0x25d0b5[_0xff7d('0x7e')]);this[_0xff7d('0x1c')][_0x25d0b5[_0xff7d('0x3c')]]['callerid']=_0x25d0b5['value'];}else if(this[_0xff7d('0x37')](_0x25d0b5[_0xff7d('0x79')][_0xff7d('0x80')])){logger['info'](_0xff7d('0x81'),_0x25d0b5[_0xff7d('0x3c')],_0x25d0b5[_0xff7d('0x7e')]);this[_0xff7d('0x1c')][_0x25d0b5['uniqueid']][_0xff7d('0x82')]=_0x25d0b5[_0xff7d('0x7e')];}else if(this[_0xff7d('0x37')](_0x25d0b5[_0xff7d('0x79')][_0xff7d('0x83')])){logger[_0xff7d('0x3a')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x25d0b5['uniqueid'],_0x25d0b5[_0xff7d('0x7e')][_0xff7d('0x4d')](',')[0x0]);this[_0xff7d('0x1c')][_0x25d0b5[_0xff7d('0x3c')]][_0xff7d('0x11')]=_0x25d0b5[_0xff7d('0x7e')][_0xff7d('0x4d')](',')[0x0];}else if(this['isNotNull'](_0x25d0b5[_0xff7d('0x79')][_0xff7d('0x84')])){logger[_0xff7d('0x3a')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x25d0b5[_0xff7d('0x3c')],_0x25d0b5[_0xff7d('0x7e')]);this[_0xff7d('0x1c')][_0x25d0b5['uniqueid']][_0xff7d('0x85')]=_0x25d0b5['value'];}else if(this[_0xff7d('0x37')](_0x25d0b5['variable']['xmd-destination'])){logger[_0xff7d('0x3a')](_0xff7d('0x86'),_0x25d0b5[_0xff7d('0x3c')],_0x25d0b5['value']);this[_0xff7d('0x1c')][_0x25d0b5[_0xff7d('0x3c')]][_0xff7d('0x87')]=_0x25d0b5[_0xff7d('0x7e')];}else if(this[_0xff7d('0x37')](_0x25d0b5[_0xff7d('0x79')][_0xff7d('0x88')])){logger[_0xff7d('0x3a')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x25d0b5[_0xff7d('0x3c')],_0x25d0b5['value']);this[_0xff7d('0x1c')][_0x25d0b5[_0xff7d('0x3c')]]['calleridpreview']=_0x25d0b5[_0xff7d('0x7e')];}else if(this[_0xff7d('0x37')](_0x25d0b5[_0xff7d('0x79')][_0xff7d('0x89')])){logger['info'](_0xff7d('0x8a'),_0x25d0b5[_0xff7d('0x3c')],_0x25d0b5[_0xff7d('0x7e')]);this['channels'][_0x25d0b5['uniqueid']][_0xff7d('0x11')]=_0x25d0b5[_0xff7d('0x7e')];}else if(this[_0xff7d('0x37')](_0x25d0b5[_0xff7d('0x79')][_0xff7d('0x8b')])){logger[_0xff7d('0x3a')](_0xff7d('0x8c'),_0x25d0b5[_0xff7d('0x3c')],_0x25d0b5['value']);this[_0xff7d('0x1c')][_0x25d0b5['uniqueid']]['sipcalluniqueid']=_0x25d0b5[_0xff7d('0x7e')];}}}else if(this[_0xff7d('0x37')](_0x25d0b5[_0xff7d('0x79')]['mixmonitor_filename'])){if(_0x25d0b5[_0xff7d('0x7e')]){var _0x2a46ef=path[_0xff7d('0x8d')](_0x25d0b5[_0xff7d('0x7e')])['name'];logger[_0xff7d('0x3a')](_0xff7d('0x7b'),_0x2a46ef,_0x25d0b5[_0xff7d('0x7e')]);this['syncMixMonitorFilename'](_0x2a46ef,_0x25d0b5[_0xff7d('0x7e')]);}}else if(this['channels'][_0x25d0b5[_0xff7d('0x41')]]){if(this[_0xff7d('0x37')](_0x25d0b5[_0xff7d('0x79')])){if(this[_0xff7d('0x37')](_0x25d0b5[_0xff7d('0x79')]['sipcallid'])){logger[_0xff7d('0x3a')](_0xff7d('0x8c'),_0x25d0b5[_0xff7d('0x41')],_0x25d0b5[_0xff7d('0x7e')]);this['channels'][_0x25d0b5[_0xff7d('0x41')]]['sipcalllinkedid']=_0x25d0b5[_0xff7d('0x7e')];}}}}}catch(_0xafc417){logger[_0xff7d('0x33')]('[%s][voiceCallReport][varset]',_0x25d0b5[_0xff7d('0x3c')],util['inspect'](_0xafc417,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xff7d('0x8e')]=function(_0x567a10){try{if(this[_0xff7d('0x37')](_0x567a10)){logger[_0xff7d('0x3f')](_0xff7d('0x8f'),_0x567a10[_0xff7d('0x3c')],util[_0xff7d('0x35')](_0x567a10,{'showHidden':![],'depth':null}));if(this[_0xff7d('0x1c')][_0x567a10['uniqueid']]){logger[_0xff7d('0x3a')](_0xff7d('0x90'),_0x567a10[_0xff7d('0x3c')],_0x567a10[_0xff7d('0x91')]);var _0x1af5fb=moment();this[_0xff7d('0x1c')][_0x567a10['uniqueid']]['endtime']=_0x1af5fb[_0xff7d('0x51')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x567a10[_0xff7d('0x3c')]][_0xff7d('0x58')]=_0x1af5fb['diff'](this[_0xff7d('0x1c')][_0x567a10['uniqueid']]['starttime'],_0xff7d('0x59'));if(this[_0xff7d('0x1c')][_0x567a10[_0xff7d('0x3c')]][_0xff7d('0x66')]){this[_0xff7d('0x1c')][_0x567a10['uniqueid']][_0xff7d('0x92')]=_0x1af5fb['diff'](this[_0xff7d('0x1c')][_0x567a10[_0xff7d('0x3c')]][_0xff7d('0x67')],'seconds');this['channels'][_0x567a10['uniqueid']][_0xff7d('0x68')]=this[_0xff7d('0x1c')][_0x567a10[_0xff7d('0x3c')]]['duration']-this[_0xff7d('0x1c')][_0x567a10['uniqueid']][_0xff7d('0x92')];}if(_0x567a10['context']==='from-sip'){if(this[_0xff7d('0x1d')][_0x567a10[_0xff7d('0x46')][_0xff7d('0x4d')]('-')[0x0]]){this['agents'][_0x567a10[_0xff7d('0x46')][_0xff7d('0x4d')]('-')[0x0]]=_[_0xff7d('0x93')](this[_0xff7d('0x1d')][_0x567a10[_0xff7d('0x46')][_0xff7d('0x4d')]('-')[0x0]],['destconnectedlinenum']);logger[_0xff7d('0x3f')](_0xff7d('0x94'),_0x567a10['uniqueid'],util[_0xff7d('0x35')]({'destaccountcode':this[_0xff7d('0x1d')][_0x567a10[_0xff7d('0x46')][_0xff7d('0x4d')]('-')[0x0]][_0xff7d('0x50')]},{'showHidden':![],'depth':null}));this[_0xff7d('0x39')](util[_0xff7d('0x51')](_0xff7d('0x52'),this[_0xff7d('0x1d')][_0x567a10[_0xff7d('0x46')][_0xff7d('0x4d')]('-')[0x0]]['name']),_0xff7d('0x95'),{'destaccountcode':this[_0xff7d('0x1d')][_0x567a10[_0xff7d('0x46')][_0xff7d('0x4d')]('-')[0x0]]['accountcode']});}}if(_0x567a10[_0xff7d('0x96')]===_0xff7d('0x97')){this['blindTransfers'][_0x567a10['uniqueid']]=this[_0xff7d('0x1c')][_0x567a10[_0xff7d('0x3c')]];}else{if(this[_0xff7d('0x1c')][_0x567a10[_0xff7d('0x3c')]]['type']===_0xff7d('0x98')&&this['blindTransfers'][_0x567a10[_0xff7d('0x3c')]]){this[_0xff7d('0x1c')][_0x567a10[_0xff7d('0x3c')]][_0xff7d('0x3c')]=[this[_0xff7d('0x1c')][_0x567a10['uniqueid']][_0xff7d('0x41')],this[_0xff7d('0x1c')][_0x567a10[_0xff7d('0x3c')]]['linkedid']=this[_0xff7d('0x1c')][_0x567a10[_0xff7d('0x3c')]][_0xff7d('0x3c')]][0x0];delete this[_0xff7d('0x1e')][_0x567a10[_0xff7d('0x3c')]];}}logger[_0xff7d('0x3f')](_0xff7d('0x99'),_0x567a10[_0xff7d('0x3c')],util[_0xff7d('0x35')](this[_0xff7d('0x1c')][_0x567a10[_0xff7d('0x3c')]],{'showHidden':![],'depth':null}));ami[_0xff7d('0x39')](_0xff7d('0x9a'),this[_0xff7d('0x1c')][_0x567a10[_0xff7d('0x3c')]]);delete this[_0xff7d('0x1c')][_0x567a10['uniqueid']];}}}catch(_0xea0a4f){logger[_0xff7d('0x33')](_0xff7d('0x9b'),_0x567a10[_0xff7d('0x3c')],util[_0xff7d('0x35')](_0xea0a4f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xff7d('0x36')][_0xff7d('0x2a')]=function(_0x4ef4b7){try{if(this[_0xff7d('0x37')](_0x4ef4b7)){logger[_0xff7d('0x3a')](_0xff7d('0x9c'),_0x4ef4b7[_0xff7d('0x3c')],_0x4ef4b7[_0xff7d('0x9d')],_0x4ef4b7[_0xff7d('0x9e')]);logger['debug'](_0xff7d('0x9f'),_0x4ef4b7['uniqueid'],util[_0xff7d('0x35')](_0x4ef4b7,{'showHidden':![],'depth':null}));if(this[_0xff7d('0x1c')][_0x4ef4b7[_0xff7d('0xa0')]]){this[_0xff7d('0x1c')][_0x4ef4b7[_0xff7d('0xa0')]][_0xff7d('0xa1')]=_0x4ef4b7[_0xff7d('0x9d')];this['channels'][_0x4ef4b7[_0xff7d('0xa0')]][_0xff7d('0xa2')]=_0x4ef4b7[_0xff7d('0x9e')];if(this[_0xff7d('0x1c')][_0x4ef4b7[_0xff7d('0xa3')]]){var _0x3b73a8=this['channels'][_0x4ef4b7[_0xff7d('0xa3')]];this[_0xff7d('0x1c')][_0x4ef4b7[_0xff7d('0xa3')]]=this[_0xff7d('0x1c')][_0x4ef4b7['transfereeuniqueid']];this[_0xff7d('0x1c')][_0x4ef4b7[_0xff7d('0xa0')]]=_0x3b73a8;}}else if(this['channels'][_0x4ef4b7[_0xff7d('0xa4')]]){this[_0xff7d('0x1c')][_0x4ef4b7[_0xff7d('0xa4')]][_0xff7d('0xa1')]=_0x4ef4b7[_0xff7d('0x9d')];this[_0xff7d('0x1c')][_0x4ef4b7[_0xff7d('0xa4')]]['transferconnectedlinenum']=_0x4ef4b7[_0xff7d('0x9e')];if(this['channels'][_0x4ef4b7[_0xff7d('0xa5')]]){var _0x3b73a8=this['channels'][_0x4ef4b7['origtransfereruniqueid']];this[_0xff7d('0x1c')][_0x4ef4b7[_0xff7d('0xa5')]]=this[_0xff7d('0x1c')][_0x4ef4b7[_0xff7d('0xa4')]];this[_0xff7d('0x1c')][_0x4ef4b7[_0xff7d('0xa4')]]=_0x3b73a8;}}}}catch(_0x40e642){logger[_0xff7d('0x33')]('[%s][voiceCallReport][attendedtransfer]',_0x4ef4b7[_0xff7d('0x3c')],util['inspect'](_0x40e642,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xff7d('0x36')][_0xff7d('0x2c')]=function(_0x5c86b9){try{if(this[_0xff7d('0x37')](_0x5c86b9)){logger['info']('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x5c86b9['uniqueid'],_0x5c86b9[_0xff7d('0xa6')],_0x5c86b9[_0xff7d('0xa7')]);logger[_0xff7d('0x3f')](_0xff7d('0xa8'),_0x5c86b9[_0xff7d('0x3c')],util[_0xff7d('0x35')](_0x5c86b9,{'showHidden':![],'depth':null}));if(this[_0xff7d('0x1c')][_0x5c86b9[_0xff7d('0xa0')]]){this[_0xff7d('0x1c')][_0x5c86b9[_0xff7d('0xa0')]][_0xff7d('0xa1')]=_0x5c86b9[_0xff7d('0xa6')];this[_0xff7d('0x1c')][_0x5c86b9[_0xff7d('0xa0')]]['transferconnectedlinenum']=_0x5c86b9['extension'];this[_0xff7d('0x8e')]({'event':_0xff7d('0x97'),'uniqueid':_0x5c86b9[_0xff7d('0xa0')],'context':_0x5c86b9[_0xff7d('0x48')],'channel':_0x5c86b9[_0xff7d('0xa9')]});}}}catch(_0x38502a){logger['error'](_0xff7d('0xaa'),_0x5c86b9[_0xff7d('0x3c')],util[_0xff7d('0x35')](_0x38502a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xff7d('0x36')][_0xff7d('0x2e')]=function(_0x54e310){try{if(this[_0xff7d('0x37')](_0x54e310)){logger[_0xff7d('0x3f')](_0xff7d('0xab'),_0x54e310[_0xff7d('0x3c')],util[_0xff7d('0x35')](_0x54e310,{'showHidden':![],'depth':null}));if(this[_0xff7d('0x1c')][_0x54e310['uniqueid']]){if(!_[_0xff7d('0xac')](this[_0xff7d('0x1c')][_0x54e310[_0xff7d('0x3c')]][_0xff7d('0x67')])){this[_0xff7d('0x1c')][_0x54e310[_0xff7d('0x3c')]][_0xff7d('0xad')]=moment()[_0xff7d('0x51')](_0xff7d('0x5a'));logger['info'](_0xff7d('0xae'),_0x54e310[_0xff7d('0x3c')],this[_0xff7d('0x1c')][_0x54e310[_0xff7d('0x3c')]][_0xff7d('0xad')]);}}}}catch(_0x303dca){logger[_0xff7d('0x33')](_0xff7d('0xaf'),_0x54e310['uniqueid'],util[_0xff7d('0x35')](_0x303dca,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xff7d('0x36')][_0xff7d('0x30')]=function(_0x5ca117){try{if(this[_0xff7d('0x37')](_0x5ca117)){logger[_0xff7d('0x3f')]('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x5ca117['uniqueid'],util['inspect'](_0x5ca117,{'showHidden':![],'depth':null}));if(this[_0xff7d('0x1c')][_0x5ca117[_0xff7d('0x3c')]]){if(!_['isNil'](this[_0xff7d('0x1c')][_0x5ca117[_0xff7d('0x3c')]][_0xff7d('0xad')])){this[_0xff7d('0x1c')][_0x5ca117['uniqueid']][_0xff7d('0xb0')]+=moment()['milliseconds'](0x0)[_0xff7d('0x69')](this[_0xff7d('0x1c')][_0x5ca117[_0xff7d('0x3c')]][_0xff7d('0xad')],_0xff7d('0x59'));logger[_0xff7d('0x3a')](_0xff7d('0xb1'),_0x5ca117[_0xff7d('0x3c')],this[_0xff7d('0x1c')][_0x5ca117['uniqueid']][_0xff7d('0xb0')]);delete this[_0xff7d('0x1c')][_0x5ca117['uniqueid']][_0xff7d('0xad')];}}}}catch(_0x34cd6b){logger[_0xff7d('0x33')]('[%s][voiceCallReport][musiconholdstop]',_0x5ca117[_0xff7d('0x3c')],util[_0xff7d('0x35')](_0x34cd6b,{'showHidden':![],'depth':null}));}};module[_0xff7d('0xb2')]=VoiceCallReport; \ No newline at end of file +var _0x5caa=['channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','pick','split','destconnectedlinenum','exten','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','name','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','duration','subtract','seconds','includes','lastapplication','lastdata','startsWith','cdr(','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','toNumber','UserId','membername','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','.wav49','.WAV','monitorFilename','find','isNil','monitors','rec','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','from-sip','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','[%s][voiceCallReport][musiconholdstop]','lodash','moment','path','ioredis','../../../config/environment','../ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','defaults','redis','localhost','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newchannel','syncNewChannel','syncNewState','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','emit','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','isUndefined','merge','keys','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:'];(function(_0x20ebf7,_0x6dc038){var _0x15ca11=function(_0x287c73){while(--_0x287c73){_0x20ebf7['push'](_0x20ebf7['shift']());}};_0x15ca11(++_0x6dc038);}(_0x5caa,0x137));var _0xa5ca=function(_0x11adbd,_0x5055f5){_0x11adbd=_0x11adbd-0x0;var _0x270029=_0x5caa[_0x11adbd];return _0x270029;};'use strict';var BPromise=require('bluebird');var _=require(_0xa5ca('0x0'));var moment=require(_0xa5ca('0x1'));var util=require('util');var path=require(_0xa5ca('0x2'));var Redis=require(_0xa5ca('0x3'));var config=require(_0xa5ca('0x4'));var logger=require('../../../config/logger')('ami');var ami=require(_0xa5ca('0x5'));var Channel=require(_0xa5ca('0x6'));var statusDesc=[_0xa5ca('0x7'),_0xa5ca('0x8'),_0xa5ca('0x9'),_0xa5ca('0xa'),_0xa5ca('0xb'),_0xa5ca('0xc'),_0xa5ca('0xd'),_0xa5ca('0xe'),'onhold'];var applications=[_0xa5ca('0xf'),_0xa5ca('0x10'),_0xa5ca('0x11'),_0xa5ca('0x12'),_0xa5ca('0x13'),_0xa5ca('0x14')];var dispositions=[_0xa5ca('0x15'),'FAILED',_0xa5ca('0x16'),_0xa5ca('0x15'),_0xa5ca('0x15'),_0xa5ca('0x15'),_0xa5ca('0x17'),_0xa5ca('0x18'),_0xa5ca('0x16'),_0xa5ca('0x16'),_0xa5ca('0x16')];var actions={};config['redis']=_[_0xa5ca('0x19')](config[_0xa5ca('0x1a')],{'host':_0xa5ca('0x1b'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa5ca('0x1a')]));function VoiceCallReport(_0x1ea152){this[_0xa5ca('0x1c')]=_0x1ea152[_0xa5ca('0x1c')];this[_0xa5ca('0x1d')]=_0x1ea152[_0xa5ca('0x1d')];this[_0xa5ca('0x1e')]={};ami['on'](_0xa5ca('0x1f'),this[_0xa5ca('0x20')][_0xa5ca('0x21')](this));ami['on']('newexten',this[_0xa5ca('0x20')][_0xa5ca('0x21')](this));ami['on'](_0xa5ca('0x22'),this[_0xa5ca('0x23')]['bind'](this));ami['on']('newstate',this[_0xa5ca('0x24')][_0xa5ca('0x21')](this));ami['on']('varset',this['syncVarSet'][_0xa5ca('0x21')](this));ami['on']('hangup',this[_0xa5ca('0x25')][_0xa5ca('0x21')](this));ami['on'](_0xa5ca('0x26'),this[_0xa5ca('0x27')][_0xa5ca('0x21')](this));ami['on'](_0xa5ca('0x28'),this[_0xa5ca('0x29')]['bind'](this));ami['on']('blindtransfer',this[_0xa5ca('0x2a')][_0xa5ca('0x21')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0xa5ca('0x21')](this));ami['on'](_0xa5ca('0x2b'),this[_0xa5ca('0x2c')][_0xa5ca('0x21')](this));try{logger[_0xa5ca('0x2d')](_0xa5ca('0x2e'));ami[_0xa5ca('0x2f')]();}catch(_0x332acc){logger[_0xa5ca('0x30')](_0xa5ca('0x31'),util[_0xa5ca('0x32')](_0x332acc,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xa5ca('0x33')]['isNotNull']=function(_0x5e0b5e){return _0x5e0b5e!==null&&!_['isUndefined'](_0x5e0b5e);};VoiceCallReport['prototype']['emit']=function(_0xfb43b4,_0x2e1e79,_0x31615a){io['to'](_0xfb43b4)[_0xa5ca('0x34')](_0x2e1e79,_0x31615a);};VoiceCallReport[_0xa5ca('0x33')][_0xa5ca('0x27')]=function(_0x1733c4){try{if(this[_0xa5ca('0x35')](_0x1733c4)){logger[_0xa5ca('0x2d')](_0xa5ca('0x36'),_0x1733c4[_0xa5ca('0x37')],_0x1733c4[_0xa5ca('0x38')],_0x1733c4['calleridnum']);logger[_0xa5ca('0x39')](_0xa5ca('0x3a'),_0x1733c4[_0xa5ca('0x37')],util[_0xa5ca('0x32')](_0x1733c4,{'showHidden':![],'depth':null}));if(_0x1733c4[_0xa5ca('0x37')]===_0x1733c4[_0xa5ca('0x3b')]){if(!_[_0xa5ca('0x3c')](this['channels'][_0x1733c4['uniqueid']])){_[_0xa5ca('0x3d')](this[_0xa5ca('0x1c')][_0x1733c4['uniqueid']],_['pick'](_0x1733c4,_[_0xa5ca('0x3e')](this['channels'][_0x1733c4[_0xa5ca('0x37')]])));}}}}catch(_0x22a4a3){logger['error'](_0xa5ca('0x3f'),_0x1733c4[_0xa5ca('0x37')],util[_0xa5ca('0x32')](_0x22a4a3,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa5ca('0x23')]=function(_0x356786){try{if(this[_0xa5ca('0x35')](_0x356786)){logger[_0xa5ca('0x39')](_0xa5ca('0x40'),_0x356786[_0xa5ca('0x37')],util[_0xa5ca('0x32')](_0x356786,{'showHidden':![],'depth':null}));if(_0x356786[_0xa5ca('0x37')]===_0x356786['linkedid']&&_0x356786[_0xa5ca('0x41')]!=_0xa5ca('0x42')){if(_[_0xa5ca('0x3c')](this[_0xa5ca('0x1c')][_0x356786[_0xa5ca('0x37')]])){logger['info'](_0xa5ca('0x43'),_0x356786[_0xa5ca('0x37')],_0x356786[_0xa5ca('0x44')],_0x356786['exten']);this[_0xa5ca('0x1c')][_0x356786[_0xa5ca('0x37')]]=new Channel();this[_0xa5ca('0x1c')][_0x356786[_0xa5ca('0x37')]][_0xa5ca('0x45')]=moment()[_0xa5ca('0x46')](_0xa5ca('0x47'));this['channels'][_0x356786['uniqueid']][_0xa5ca('0x48')]=dispositions[_['toNumber'](_0x356786[_0xa5ca('0x49')])];_[_0xa5ca('0x3d')](this['channels'][_0x356786['uniqueid']],_[_0xa5ca('0x4a')](_0x356786,_['keys'](this[_0xa5ca('0x1c')][_0x356786[_0xa5ca('0x37')]])));if(_0x356786[_0xa5ca('0x44')]==='from-sip'){if(this['agents'][_0x356786[_0xa5ca('0x41')]['split']('-')[0x0]]){this[_0xa5ca('0x1d')][_0x356786[_0xa5ca('0x41')][_0xa5ca('0x4b')]('-')[0x0]][_0xa5ca('0x4c')]=_0x356786[_0xa5ca('0x4d')];logger[_0xa5ca('0x39')](_0xa5ca('0x4e'),_0x356786[_0xa5ca('0x37')],util[_0xa5ca('0x32')]({'destaccountcode':this[_0xa5ca('0x1d')][_0x356786[_0xa5ca('0x41')]['split']('-')[0x0]][_0xa5ca('0x4f')],'destconnectedlinenum':_0x356786['exten']},{'showHidden':![],'depth':null}));this['emit'](util[_0xa5ca('0x46')](_0xa5ca('0x50'),this[_0xa5ca('0x1d')][_0x356786[_0xa5ca('0x41')][_0xa5ca('0x4b')]('-')[0x0]][_0xa5ca('0x51')]),_0xa5ca('0x52'),{'destaccountcode':this[_0xa5ca('0x1d')][_0x356786['channel'][_0xa5ca('0x4b')]('-')[0x0]][_0xa5ca('0x4f')],'destconnectedlinenum':_0x356786[_0xa5ca('0x4d')]});}}}}}}catch(_0x33a076){logger[_0xa5ca('0x30')](_0xa5ca('0x53'),_0x356786['uniqueid'],util[_0xa5ca('0x32')](_0x33a076,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa5ca('0x33')]['syncNewExten']=function(_0x35ce36){try{if(this[_0xa5ca('0x35')](_0x35ce36)){logger[_0xa5ca('0x39')](_0xa5ca('0x54'),_0x35ce36[_0xa5ca('0x37')],util[_0xa5ca('0x32')](_0x35ce36,{'showHidden':![],'depth':null}));if(_0x35ce36[_0xa5ca('0x37')]===_0x35ce36[_0xa5ca('0x3b')]&&_0x35ce36[_0xa5ca('0x4d')]!='h'&&_0x35ce36[_0xa5ca('0x41')]!=_0xa5ca('0x42')){_0x35ce36[_0xa5ca('0x55')]=_0x35ce36[_0xa5ca('0x55')][_0xa5ca('0x56')]();_0x35ce36[_0xa5ca('0x57')]=(_0x35ce36[_0xa5ca('0x58')]||_0x35ce36[_0xa5ca('0x57')])[_0xa5ca('0x56')]();logger[_0xa5ca('0x2d')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x35ce36['uniqueid'],_0x35ce36['application'],_0x35ce36['applicationdata']);if(_[_0xa5ca('0x3c')](this[_0xa5ca('0x1c')][_0x35ce36['uniqueid']])){this['channels'][_0x35ce36['uniqueid']]=new Channel();this[_0xa5ca('0x1c')][_0x35ce36[_0xa5ca('0x37')]][_0xa5ca('0x45')]=_0x35ce36[_0xa5ca('0x59')]?moment()[_0xa5ca('0x5a')](moment[_0xa5ca('0x59')](_0x35ce36[_0xa5ca('0x59')])[_0xa5ca('0x5b')](),_0xa5ca('0x5b'))[_0xa5ca('0x46')](_0xa5ca('0x47')):moment()[_0xa5ca('0x46')](_0xa5ca('0x47'));this[_0xa5ca('0x1c')][_0x35ce36['uniqueid']][_0xa5ca('0x48')]=_0xa5ca('0x15');}_[_0xa5ca('0x3d')](this[_0xa5ca('0x1c')][_0x35ce36[_0xa5ca('0x37')]],_['pick'](_0x35ce36,_['keys'](this['channels'][_0x35ce36[_0xa5ca('0x37')]])));if(_[_0xa5ca('0x5c')](applications,_0x35ce36[_0xa5ca('0x55')])){this['channels'][_0x35ce36[_0xa5ca('0x37')]][_0xa5ca('0x5d')]=_0x35ce36[_0xa5ca('0x55')];this['channels'][_0x35ce36[_0xa5ca('0x37')]][_0xa5ca('0x5e')]=_0x35ce36[_0xa5ca('0x57')];if(_0x35ce36[_0xa5ca('0x55')]===_0xa5ca('0xf')&&_[_0xa5ca('0x5f')](_0x35ce36[_0xa5ca('0x57')],_0xa5ca('0x60'))){var _0x1b4971=_0x35ce36[_0xa5ca('0x57')][_0xa5ca('0x4b')]('=');var _0x2a6830=_0x1b4971[0x0][_0xa5ca('0x61')](/cdr\((.*)\)/);if(_0x2a6830){this['channels'][_0x35ce36[_0xa5ca('0x37')]][_0x2a6830[0x1]]=_0x1b4971[0x1];}}else if(_0x35ce36[_0xa5ca('0x55')]===_0xa5ca('0x10')){this[_0xa5ca('0x1c')][_0x35ce36[_0xa5ca('0x37')]][_0xa5ca('0x10')]=_0x35ce36[_0xa5ca('0x57')][_0xa5ca('0x4b')](',')[0x0];}}}}}catch(_0x48318c){logger[_0xa5ca('0x30')](_0xa5ca('0x62'),_0x35ce36[_0xa5ca('0x37')],util[_0xa5ca('0x32')](_0x48318c,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa5ca('0x24')]=function(_0x92acc3){try{if(this[_0xa5ca('0x35')](_0x92acc3)){logger[_0xa5ca('0x2d')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x92acc3[_0xa5ca('0x37')],_0x92acc3[_0xa5ca('0x3b')],_0x92acc3[_0xa5ca('0x38')],_0x92acc3['calleridnum']);logger[_0xa5ca('0x39')](_0xa5ca('0x63'),_0x92acc3[_0xa5ca('0x37')],util['inspect'](_0x92acc3,{'showHidden':![],'depth':null}));if(_0x92acc3['uniqueid']!==_0x92acc3['linkedid']){if(this[_0xa5ca('0x1c')][_0x92acc3['linkedid']]){if(_0x92acc3['channelstate']==='6'){if(!this['channels'][_0x92acc3[_0xa5ca('0x3b')]][_0xa5ca('0x64')]){var _0x140fad=moment();this[_0xa5ca('0x1c')][_0x92acc3['linkedid']][_0xa5ca('0x64')]=!![];this['channels'][_0x92acc3['linkedid']][_0xa5ca('0x65')]=_0x140fad[_0xa5ca('0x46')](_0xa5ca('0x47'));if(this[_0xa5ca('0x1c')][_0x92acc3[_0xa5ca('0x3b')]][_0xa5ca('0x45')]){this[_0xa5ca('0x1c')][_0x92acc3[_0xa5ca('0x3b')]][_0xa5ca('0x66')]=_0x140fad[_0xa5ca('0x67')](this[_0xa5ca('0x1c')][_0x92acc3['linkedid']][_0xa5ca('0x45')],_0xa5ca('0x5b'));}}this[_0xa5ca('0x1c')][_0x92acc3[_0xa5ca('0x3b')]][_0xa5ca('0x3b')]=_0x92acc3[_0xa5ca('0x37')];if(_0x92acc3[_0xa5ca('0x68')]!==_0xa5ca('0x69')){this[_0xa5ca('0x1c')][_0x92acc3['linkedid']][_0xa5ca('0x6a')]=_0x92acc3[_0xa5ca('0x68')];}this[_0xa5ca('0x1c')][_0x92acc3[_0xa5ca('0x3b')]][_0xa5ca('0x6b')]=_0x92acc3['calleridname'];this[_0xa5ca('0x1c')][_0x92acc3[_0xa5ca('0x3b')]][_0xa5ca('0x6c')]=_0x92acc3['channel'];this[_0xa5ca('0x1c')][_0x92acc3[_0xa5ca('0x3b')]][_0xa5ca('0x48')]=dispositions[_[_0xa5ca('0x6d')](_0x92acc3['channelstate'])];if(this['agents'][_0x92acc3[_0xa5ca('0x41')][_0xa5ca('0x4b')]('-')[0x0]]){this[_0xa5ca('0x1c')][_0x92acc3[_0xa5ca('0x3b')]]['UserId']=this[_0xa5ca('0x1d')][_0x92acc3[_0xa5ca('0x41')][_0xa5ca('0x4b')]('-')[0x0]]['id'];this[_0xa5ca('0x1c')][_0x92acc3['linkedid']]['membername']=this[_0xa5ca('0x1d')][_0x92acc3[_0xa5ca('0x41')][_0xa5ca('0x4b')]('-')[0x0]]['name'];}}}}else{if(this[_0xa5ca('0x1c')][_0x92acc3['uniqueid']]){if(_0x92acc3[_0xa5ca('0x49')]==='6'){if(this[_0xa5ca('0x1d')][_0x92acc3[_0xa5ca('0x41')][_0xa5ca('0x4b')]('-')[0x0]]){this[_0xa5ca('0x1c')][_0x92acc3[_0xa5ca('0x37')]][_0xa5ca('0x6e')]=this[_0xa5ca('0x1d')][_0x92acc3[_0xa5ca('0x41')]['split']('-')[0x0]]['id'];this[_0xa5ca('0x1c')][_0x92acc3['uniqueid']][_0xa5ca('0x6f')]=this[_0xa5ca('0x1d')][_0x92acc3['channel'][_0xa5ca('0x4b')]('-')[0x0]][_0xa5ca('0x51')];}}}}}}catch(_0x1ef5bf){logger[_0xa5ca('0x30')]('[%s][voiceCallReport][newstate]',_0x92acc3[_0xa5ca('0x37')],util['inspect'](_0x1ef5bf,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa5ca('0x33')][_0xa5ca('0x70')]=function(_0x3132e8,_0x128f5f){try{if(this[_0xa5ca('0x1c')][_0x3132e8]){logger[_0xa5ca('0x2d')](_0xa5ca('0x71'),_0x3132e8,_0x128f5f);this['channels'][_0x3132e8]['monitor']=!![];if(_[_0xa5ca('0x72')](_0x128f5f,_0xa5ca('0x73'))){_0x128f5f=_0x128f5f['replace'](_0xa5ca('0x73'),_0xa5ca('0x74'));}this['channels'][_0x3132e8][_0xa5ca('0x75')]=_0x128f5f;var _0x1ebb4e=_[_0xa5ca('0x76')](this['channels'][_0x3132e8]['monitors'],{'filename':_0x128f5f});if(_[_0xa5ca('0x77')](_0x1ebb4e)){this[_0xa5ca('0x1c')][_0x3132e8][_0xa5ca('0x78')]['push']({'filename':_0x128f5f,'createdAt':moment()[_0xa5ca('0x46')](_0xa5ca('0x47')),'mixmonitorid':'','status':_0xa5ca('0x79')});}}}catch(_0x124714){logger[_0xa5ca('0x30')]('[%s][voiceCallReport][mixMonitorFilename]',_0x3132e8,util['inspect'](_0x124714,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa5ca('0x33')]['syncVarSet']=function(_0x12ca6a){try{if(this[_0xa5ca('0x35')](_0x12ca6a)){logger['debug'](_0xa5ca('0x7a'),_0x12ca6a['uniqueid'],util[_0xa5ca('0x32')](_0x12ca6a,{'showHidden':![],'depth':null}));if(this[_0xa5ca('0x1c')][_0x12ca6a[_0xa5ca('0x37')]]&&_0x12ca6a[_0xa5ca('0x41')]!=_0xa5ca('0x42')){if(this['isNotNull'](_0x12ca6a[_0xa5ca('0x7b')])){if(this[_0xa5ca('0x35')](_0x12ca6a[_0xa5ca('0x7b')][_0xa5ca('0x7c')])){logger['info'](_0xa5ca('0x7d'),_0x12ca6a['uniqueid'],_0x12ca6a[_0xa5ca('0x7e')]);this[_0xa5ca('0x70')](_0x12ca6a['uniqueid'],_0x12ca6a[_0xa5ca('0x7e')]);}else if(this[_0xa5ca('0x35')](_0x12ca6a[_0xa5ca('0x7b')][_0xa5ca('0x7f')])){logger[_0xa5ca('0x2d')](_0xa5ca('0x80'),_0x12ca6a[_0xa5ca('0x37')],_0x12ca6a[_0xa5ca('0x7e')]);this[_0xa5ca('0x1c')][_0x12ca6a[_0xa5ca('0x37')]]['calleridnum']=_0x12ca6a[_0xa5ca('0x7e')];}else if(this[_0xa5ca('0x35')](_0x12ca6a[_0xa5ca('0x7b')][_0xa5ca('0x81')])){logger[_0xa5ca('0x2d')](_0xa5ca('0x82'),_0x12ca6a[_0xa5ca('0x37')],_0x12ca6a[_0xa5ca('0x7e')]);this[_0xa5ca('0x1c')][_0x12ca6a[_0xa5ca('0x37')]][_0xa5ca('0x83')]=_0x12ca6a['value'];}else if(this[_0xa5ca('0x35')](_0x12ca6a['variable'][_0xa5ca('0x84')])){logger[_0xa5ca('0x2d')](_0xa5ca('0x85'),_0x12ca6a[_0xa5ca('0x37')],_0x12ca6a['value']);this[_0xa5ca('0x1c')][_0x12ca6a['uniqueid']][_0xa5ca('0x86')]=_0x12ca6a['value'];}else if(this['isNotNull'](_0x12ca6a[_0xa5ca('0x7b')][_0xa5ca('0x87')])){logger['info'](_0xa5ca('0x88'),_0x12ca6a['uniqueid'],_0x12ca6a[_0xa5ca('0x7e')]['split'](',')[0x0]);this[_0xa5ca('0x1c')][_0x12ca6a['uniqueid']][_0xa5ca('0x10')]=_0x12ca6a[_0xa5ca('0x7e')][_0xa5ca('0x4b')](',')[0x0];}else if(this[_0xa5ca('0x35')](_0x12ca6a['variable'][_0xa5ca('0x89')])){logger[_0xa5ca('0x2d')](_0xa5ca('0x8a'),_0x12ca6a['uniqueid'],_0x12ca6a['value']);this[_0xa5ca('0x1c')][_0x12ca6a[_0xa5ca('0x37')]][_0xa5ca('0x8b')]=_0x12ca6a['value'];}else if(this[_0xa5ca('0x35')](_0x12ca6a[_0xa5ca('0x7b')][_0xa5ca('0x8c')])){logger[_0xa5ca('0x2d')](_0xa5ca('0x8d'),_0x12ca6a[_0xa5ca('0x37')],_0x12ca6a[_0xa5ca('0x7e')]);this[_0xa5ca('0x1c')][_0x12ca6a[_0xa5ca('0x37')]][_0xa5ca('0x8e')]=_0x12ca6a[_0xa5ca('0x7e')];}else if(this[_0xa5ca('0x35')](_0x12ca6a[_0xa5ca('0x7b')]['xmd-callerid-preview'])){logger[_0xa5ca('0x2d')](_0xa5ca('0x8f'),_0x12ca6a[_0xa5ca('0x37')],_0x12ca6a[_0xa5ca('0x7e')]);this[_0xa5ca('0x1c')][_0x12ca6a[_0xa5ca('0x37')]][_0xa5ca('0x90')]=_0x12ca6a[_0xa5ca('0x7e')];}else if(this[_0xa5ca('0x35')](_0x12ca6a[_0xa5ca('0x7b')][_0xa5ca('0x91')])){logger[_0xa5ca('0x2d')](_0xa5ca('0x92'),_0x12ca6a[_0xa5ca('0x37')],_0x12ca6a[_0xa5ca('0x7e')]);this[_0xa5ca('0x1c')][_0x12ca6a['uniqueid']]['queue']=_0x12ca6a[_0xa5ca('0x7e')];}else if(this[_0xa5ca('0x35')](_0x12ca6a[_0xa5ca('0x7b')][_0xa5ca('0x93')])){logger[_0xa5ca('0x2d')](_0xa5ca('0x94'),_0x12ca6a['uniqueid'],_0x12ca6a['value']);this[_0xa5ca('0x1c')][_0x12ca6a[_0xa5ca('0x37')]][_0xa5ca('0x95')]=_0x12ca6a['value'];}}}else if(this[_0xa5ca('0x35')](_0x12ca6a[_0xa5ca('0x7b')][_0xa5ca('0x7c')])){if(_0x12ca6a[_0xa5ca('0x7e')]){var _0x1afd75=path[_0xa5ca('0x96')](_0x12ca6a['value'])['name'];logger[_0xa5ca('0x2d')](_0xa5ca('0x7d'),_0x1afd75,_0x12ca6a['value']);this['syncMixMonitorFilename'](_0x1afd75,_0x12ca6a[_0xa5ca('0x7e')]);}}else if(this[_0xa5ca('0x1c')][_0x12ca6a[_0xa5ca('0x3b')]]){if(this[_0xa5ca('0x35')](_0x12ca6a[_0xa5ca('0x7b')])){if(this[_0xa5ca('0x35')](_0x12ca6a[_0xa5ca('0x7b')][_0xa5ca('0x93')])){logger[_0xa5ca('0x2d')](_0xa5ca('0x94'),_0x12ca6a['linkedid'],_0x12ca6a['value']);this[_0xa5ca('0x1c')][_0x12ca6a[_0xa5ca('0x3b')]][_0xa5ca('0x97')]=_0x12ca6a[_0xa5ca('0x7e')];}}}}}catch(_0x34c5a3){logger['error']('[%s][voiceCallReport][varset]',_0x12ca6a['uniqueid'],util[_0xa5ca('0x32')](_0x34c5a3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa5ca('0x33')][_0xa5ca('0x25')]=function(_0x205ede){try{if(this[_0xa5ca('0x35')](_0x205ede)){logger[_0xa5ca('0x39')](_0xa5ca('0x98'),_0x205ede[_0xa5ca('0x37')],util[_0xa5ca('0x32')](_0x205ede,{'showHidden':![],'depth':null}));if(this[_0xa5ca('0x1c')][_0x205ede[_0xa5ca('0x37')]]){logger[_0xa5ca('0x2d')](_0xa5ca('0x99'),_0x205ede[_0xa5ca('0x37')],_0x205ede[_0xa5ca('0x9a')]);var _0x42c484=moment();this[_0xa5ca('0x1c')][_0x205ede['uniqueid']][_0xa5ca('0x9b')]=_0x42c484[_0xa5ca('0x46')](_0xa5ca('0x47'));this[_0xa5ca('0x1c')][_0x205ede[_0xa5ca('0x37')]][_0xa5ca('0x59')]=_0x42c484[_0xa5ca('0x67')](this[_0xa5ca('0x1c')][_0x205ede[_0xa5ca('0x37')]][_0xa5ca('0x45')],_0xa5ca('0x5b'));if(this['channels'][_0x205ede[_0xa5ca('0x37')]]['answered']){this[_0xa5ca('0x1c')][_0x205ede[_0xa5ca('0x37')]][_0xa5ca('0x9c')]=_0x42c484[_0xa5ca('0x67')](this['channels'][_0x205ede[_0xa5ca('0x37')]][_0xa5ca('0x65')],_0xa5ca('0x5b'));this[_0xa5ca('0x1c')][_0x205ede['uniqueid']][_0xa5ca('0x66')]=this[_0xa5ca('0x1c')][_0x205ede[_0xa5ca('0x37')]][_0xa5ca('0x59')]-this[_0xa5ca('0x1c')][_0x205ede[_0xa5ca('0x37')]][_0xa5ca('0x9c')];}if(_0x205ede[_0xa5ca('0x44')]===_0xa5ca('0x9d')){if(this[_0xa5ca('0x1d')][_0x205ede[_0xa5ca('0x41')]['split']('-')[0x0]]){this['agents'][_0x205ede[_0xa5ca('0x41')][_0xa5ca('0x4b')]('-')[0x0]]=_[_0xa5ca('0x9e')](this['agents'][_0x205ede['channel']['split']('-')[0x0]],[_0xa5ca('0x4c')]);logger['debug'](_0xa5ca('0x9f'),_0x205ede[_0xa5ca('0x37')],util[_0xa5ca('0x32')]({'destaccountcode':this['agents'][_0x205ede[_0xa5ca('0x41')]['split']('-')[0x0]][_0xa5ca('0x4f')]},{'showHidden':![],'depth':null}));this['emit'](util[_0xa5ca('0x46')](_0xa5ca('0x50'),this['agents'][_0x205ede['channel'][_0xa5ca('0x4b')]('-')[0x0]]['name']),'user:agentcomplete',{'destaccountcode':this[_0xa5ca('0x1d')][_0x205ede['channel'][_0xa5ca('0x4b')]('-')[0x0]][_0xa5ca('0x4f')]});}}if(_0x205ede[_0xa5ca('0xa0')]===_0xa5ca('0xa1')){this[_0xa5ca('0x1e')][_0x205ede[_0xa5ca('0x37')]]=this[_0xa5ca('0x1c')][_0x205ede[_0xa5ca('0x37')]];}else{if(this['channels'][_0x205ede[_0xa5ca('0x37')]][_0xa5ca('0x86')]===_0xa5ca('0xa2')&&this[_0xa5ca('0x1e')][_0x205ede[_0xa5ca('0x37')]]){this[_0xa5ca('0x1c')][_0x205ede[_0xa5ca('0x37')]]['uniqueid']=[this[_0xa5ca('0x1c')][_0x205ede[_0xa5ca('0x37')]][_0xa5ca('0x3b')],this[_0xa5ca('0x1c')][_0x205ede[_0xa5ca('0x37')]]['linkedid']=this[_0xa5ca('0x1c')][_0x205ede[_0xa5ca('0x37')]][_0xa5ca('0x37')]][0x0];delete this[_0xa5ca('0x1e')][_0x205ede['uniqueid']];}}logger[_0xa5ca('0x39')](_0xa5ca('0xa3'),_0x205ede[_0xa5ca('0x37')],util[_0xa5ca('0x32')](this['channels'][_0x205ede[_0xa5ca('0x37')]],{'showHidden':![],'depth':null}));ami[_0xa5ca('0x34')](_0xa5ca('0xa4'),this[_0xa5ca('0x1c')][_0x205ede[_0xa5ca('0x37')]]);delete this[_0xa5ca('0x1c')][_0x205ede[_0xa5ca('0x37')]];}}}catch(_0x2b7b15){logger['error'](_0xa5ca('0xa5'),_0x205ede['uniqueid'],util['inspect'](_0x2b7b15,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa5ca('0x33')][_0xa5ca('0x29')]=function(_0x3a94f0){try{if(this[_0xa5ca('0x35')](_0x3a94f0)){logger['info']('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x3a94f0[_0xa5ca('0x37')],_0x3a94f0[_0xa5ca('0xa6')],_0x3a94f0[_0xa5ca('0xa7')]);logger[_0xa5ca('0x39')](_0xa5ca('0xa8'),_0x3a94f0[_0xa5ca('0x37')],util[_0xa5ca('0x32')](_0x3a94f0,{'showHidden':![],'depth':null}));if(this[_0xa5ca('0x1c')][_0x3a94f0[_0xa5ca('0xa9')]]){this[_0xa5ca('0x1c')][_0x3a94f0['transfereeuniqueid']]['transfercalleridnum']=_0x3a94f0[_0xa5ca('0xa6')];this[_0xa5ca('0x1c')][_0x3a94f0[_0xa5ca('0xa9')]][_0xa5ca('0xaa')]=_0x3a94f0[_0xa5ca('0xa7')];if(this[_0xa5ca('0x1c')][_0x3a94f0[_0xa5ca('0xab')]]){var _0x22ebb2=this[_0xa5ca('0x1c')][_0x3a94f0[_0xa5ca('0xab')]];this['channels'][_0x3a94f0[_0xa5ca('0xab')]]=this[_0xa5ca('0x1c')][_0x3a94f0['transfereeuniqueid']];this[_0xa5ca('0x1c')][_0x3a94f0[_0xa5ca('0xa9')]]=_0x22ebb2;}}else if(this['channels'][_0x3a94f0['transfertargetuniqueid']]){this[_0xa5ca('0x1c')][_0x3a94f0[_0xa5ca('0xac')]][_0xa5ca('0xad')]=_0x3a94f0[_0xa5ca('0xa6')];this['channels'][_0x3a94f0[_0xa5ca('0xac')]]['transferconnectedlinenum']=_0x3a94f0[_0xa5ca('0xa7')];if(this['channels'][_0x3a94f0[_0xa5ca('0xae')]]){var _0x22ebb2=this[_0xa5ca('0x1c')][_0x3a94f0['origtransfereruniqueid']];this[_0xa5ca('0x1c')][_0x3a94f0[_0xa5ca('0xae')]]=this[_0xa5ca('0x1c')][_0x3a94f0[_0xa5ca('0xac')]];this[_0xa5ca('0x1c')][_0x3a94f0[_0xa5ca('0xac')]]=_0x22ebb2;}}}}catch(_0x237a54){logger[_0xa5ca('0x30')](_0xa5ca('0xaf'),_0x3a94f0['uniqueid'],util[_0xa5ca('0x32')](_0x237a54,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa5ca('0x33')][_0xa5ca('0x2a')]=function(_0x132e7c){try{if(this['isNotNull'](_0x132e7c)){logger[_0xa5ca('0x2d')]('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x132e7c['uniqueid'],_0x132e7c[_0xa5ca('0xb0')],_0x132e7c[_0xa5ca('0xb1')]);logger[_0xa5ca('0x39')](_0xa5ca('0xb2'),_0x132e7c[_0xa5ca('0x37')],util['inspect'](_0x132e7c,{'showHidden':![],'depth':null}));if(this[_0xa5ca('0x1c')][_0x132e7c[_0xa5ca('0xa9')]]){this['channels'][_0x132e7c[_0xa5ca('0xa9')]]['transfercalleridnum']=_0x132e7c[_0xa5ca('0xb0')];this[_0xa5ca('0x1c')][_0x132e7c[_0xa5ca('0xa9')]][_0xa5ca('0xaa')]=_0x132e7c[_0xa5ca('0xb1')];this[_0xa5ca('0x25')]({'event':_0xa5ca('0xa1'),'uniqueid':_0x132e7c['transfereeuniqueid'],'context':_0x132e7c[_0xa5ca('0x44')],'channel':_0x132e7c[_0xa5ca('0xb3')]});}}}catch(_0x5ac6d5){logger['error'](_0xa5ca('0xb4'),_0x132e7c[_0xa5ca('0x37')],util['inspect'](_0x5ac6d5,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMusicOnHoldStart']=function(_0x1adee0){try{if(this[_0xa5ca('0x35')](_0x1adee0)){logger[_0xa5ca('0x39')](_0xa5ca('0xb5'),_0x1adee0[_0xa5ca('0x37')],util[_0xa5ca('0x32')](_0x1adee0,{'showHidden':![],'depth':null}));if(this[_0xa5ca('0x1c')][_0x1adee0[_0xa5ca('0x37')]]){if(!_[_0xa5ca('0x77')](this[_0xa5ca('0x1c')][_0x1adee0[_0xa5ca('0x37')]][_0xa5ca('0x65')])){this[_0xa5ca('0x1c')][_0x1adee0[_0xa5ca('0x37')]][_0xa5ca('0xb6')]=moment()[_0xa5ca('0x46')](_0xa5ca('0x47'));logger[_0xa5ca('0x2d')](_0xa5ca('0xb7'),_0x1adee0['uniqueid'],this[_0xa5ca('0x1c')][_0x1adee0[_0xa5ca('0x37')]][_0xa5ca('0xb6')]);}}}}catch(_0x50c562){logger[_0xa5ca('0x30')]('[%s][voiceCallReport][musiconholdstart]',_0x1adee0[_0xa5ca('0x37')],util[_0xa5ca('0x32')](_0x50c562,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa5ca('0x2c')]=function(_0x22553d){try{if(this[_0xa5ca('0x35')](_0x22553d)){logger[_0xa5ca('0x39')]('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x22553d[_0xa5ca('0x37')],util[_0xa5ca('0x32')](_0x22553d,{'showHidden':![],'depth':null}));if(this[_0xa5ca('0x1c')][_0x22553d[_0xa5ca('0x37')]]){if(!_[_0xa5ca('0x77')](this[_0xa5ca('0x1c')][_0x22553d[_0xa5ca('0x37')]][_0xa5ca('0xb6')])){this[_0xa5ca('0x1c')][_0x22553d['uniqueid']]['mohtime']+=moment()[_0xa5ca('0xb8')](0x0)['diff'](this[_0xa5ca('0x1c')][_0x22553d['uniqueid']][_0xa5ca('0xb6')],_0xa5ca('0x5b'));logger['info'](_0xa5ca('0xb9'),_0x22553d[_0xa5ca('0x37')],this[_0xa5ca('0x1c')][_0x22553d[_0xa5ca('0x37')]][_0xa5ca('0xba')]);delete this[_0xa5ca('0x1c')][_0x22553d[_0xa5ca('0x37')]][_0xa5ca('0xb6')];}}}}catch(_0x5e71ed){logger[_0xa5ca('0x30')](_0xa5ca('0xbb'),_0x22553d['uniqueid'],util[_0xa5ca('0x32')](_0x5e71ed,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index fd87064..4683bc7 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x09e1=['redis','localhost','socket.io-emitter','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','syncHangup','prototype','isUndefined','emit','isNotNull','debug','uniqueid','channels','merge','format','called','channel','substring','lastIndexOf','omit','event','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','inspect','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinename','answertime','YYYY-MM-DD\x20HH:mm:ss','lastevent','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','value','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','duration','endtime','diff','seconds','total','answered','holdtime','sumHoldTime','sumBillable','billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','exports','lodash','util','ioredis','../../../config/logger','ami'];(function(_0x1dbe9c,_0x83b20c){var _0x1e938c=function(_0x16fc61){while(--_0x16fc61){_0x1dbe9c['push'](_0x1dbe9c['shift']());}};_0x1e938c(++_0x83b20c);}(_0x09e1,0x183));var _0x109e=function(_0x55c5c7,_0x560bf7){_0x55c5c7=_0x55c5c7-0x0;var _0x20a9da=_0x09e1[_0x55c5c7];return _0x20a9da;};'use strict';var _=require(_0x109e('0x0'));var moment=require('moment');var util=require(_0x109e('0x1'));var Redis=require(_0x109e('0x2'));var config=require('../../../config/environment');var logger=require(_0x109e('0x3'))(_0x109e('0x4'));var ami=require('../ami');config[_0x109e('0x5')]=_['defaults'](config['redis'],{'host':_0x109e('0x6'),'port':0x18eb});var io=require(_0x109e('0x7'))(new Redis(config['redis']));function VoiceDialReport(_0x2dd2f4){this['channels']=_0x2dd2f4['outboundChannels'];this[_0x109e('0x8')]=_0x2dd2f4[_0x109e('0x8')];this[_0x109e('0x9')]={};ami['on'](_0x109e('0xa'),this[_0x109e('0xb')][_0x109e('0xc')](this));ami['on'](_0x109e('0xd'),this[_0x109e('0xe')][_0x109e('0xc')](this));ami['on'](_0x109e('0xf'),this[_0x109e('0x10')][_0x109e('0xc')](this));ami['on'](_0x109e('0x11'),this[_0x109e('0x12')][_0x109e('0xc')](this));}VoiceDialReport[_0x109e('0x13')]['isNotNull']=function(_0x376be0){return _0x376be0!==null&&!_[_0x109e('0x14')](_0x376be0);};VoiceDialReport[_0x109e('0x13')][_0x109e('0x15')]=function(_0x39a4c1,_0x2341e1,_0x224f65){io['to'](_0x39a4c1)[_0x109e('0x15')](_0x2341e1,_0x224f65);};VoiceDialReport[_0x109e('0x13')][_0x109e('0xb')]=function(_0x48eace){try{if(this[_0x109e('0x16')](_0x48eace)){logger[_0x109e('0x17')]('[%s][voiceDialReport][dialbegin]\x20event:',_0x48eace[_0x109e('0x18')],util['inspect'](_0x48eace,{'showHidden':![],'depth':null}));if(this[_0x109e('0x19')][_0x48eace['uniqueid']]){_[_0x109e('0x1a')](this[_0x109e('0x19')][_0x48eace['uniqueid']],{'starttime':moment()[_0x109e('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x109e('0x1c'),'interface':_0x48eace[_0x109e('0x1d')][_0x109e('0x1e')](0x0,_0x48eace[_0x109e('0x1d')][_0x109e('0x1f')]('-')),'membername':_0x48eace[_0x109e('0x1d')][_0x109e('0x1e')](_0x48eace[_0x109e('0x1d')]['lastIndexOf']('/')+0x1,_0x48eace[_0x109e('0x1d')]['lastIndexOf']('-'))},_[_0x109e('0x20')](_0x48eace,[_0x109e('0x21'),'privilege']));logger[_0x109e('0x22')](_0x109e('0x23'),_0x48eace[_0x109e('0x18')],this['channels'][_0x48eace[_0x109e('0x18')]][_0x109e('0x24')],this['channels'][_0x48eace[_0x109e('0x18')]]['interface']);logger[_0x109e('0x17')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x48eace['uniqueid'],util[_0x109e('0x25')](this['channels'][_0x48eace['uniqueid']],{'showHidden':![],'depth':null}));this[_0x109e('0x15')](_0x109e('0x26'),_0x109e('0x27'),this[_0x109e('0x19')][_0x48eace[_0x109e('0x18')]]);logger[_0x109e('0x17')](_0x109e('0x28'),_0x48eace[_0x109e('0x18')],util[_0x109e('0x25')](this[_0x109e('0x19')][_0x48eace[_0x109e('0x18')]],{'showHidden':![],'depth':null}));ami[_0x109e('0x15')](_0x109e('0x29'),this[_0x109e('0x19')][_0x48eace[_0x109e('0x18')]]);}}}catch(_0x240f7b){logger[_0x109e('0x2a')]('[%s][voiceDialReport][dialbegin]',_0x48eace[_0x109e('0x18')],util[_0x109e('0x25')](_0x240f7b,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x109e('0x13')][_0x109e('0xe')]=function(_0x466dbe){try{if(this['isNotNull'](_0x466dbe)){logger[_0x109e('0x17')](_0x109e('0x2b'),_0x466dbe[_0x109e('0x18')],util['inspect'](_0x466dbe,{'showHidden':![],'depth':null}));if(this[_0x109e('0x19')][_0x466dbe[_0x109e('0x18')]]){this['channels'][_0x466dbe[_0x109e('0x18')]][_0x109e('0x2c')]=_0x466dbe['dialstatus'];if(_0x466dbe[_0x109e('0x2c')]===_0x109e('0x2d')){this[_0x109e('0x19')][_0x466dbe[_0x109e('0x18')]]['connectedlinenum']=_0x466dbe['connectedlinenum'];this[_0x109e('0x19')][_0x466dbe['uniqueid']][_0x109e('0x2e')]=_0x466dbe[_0x109e('0x2e')];this[_0x109e('0x19')][_0x466dbe['uniqueid']][_0x109e('0x2f')]=moment()[_0x109e('0x1b')](_0x109e('0x30'));this[_0x109e('0x19')][_0x466dbe['uniqueid']][_0x109e('0x31')]='connect';logger[_0x109e('0x22')](_0x109e('0x32'),_0x466dbe['uniqueid'],_0x466dbe[_0x109e('0x1d')][_0x109e('0x1e')](_0x466dbe[_0x109e('0x1d')]['lastIndexOf']('/')+0x1,_0x466dbe['channel'][_0x109e('0x1f')]('-')));logger[_0x109e('0x17')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x466dbe[_0x109e('0x18')],util[_0x109e('0x25')](this[_0x109e('0x19')][_0x466dbe[_0x109e('0x18')]],{'showHidden':![],'depth':null}));ami[_0x109e('0x15')]('custom:dialconnect',this[_0x109e('0x19')][_0x466dbe[_0x109e('0x18')]]);}logger['debug'](_0x109e('0x33'),_0x466dbe[_0x109e('0x18')],util['inspect'](this[_0x109e('0x19')][_0x466dbe[_0x109e('0x18')]],{'showHidden':![],'depth':null}));this[_0x109e('0x15')]('voice:outbound',_0x109e('0x27'),this['channels'][_0x466dbe[_0x109e('0x18')]]);}}}catch(_0x1681f0){logger[_0x109e('0x2a')](_0x109e('0x34'),_0x466dbe['uniqueid'],util[_0x109e('0x25')](_0x1681f0,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x109e('0x10')]=function(_0x583571){try{if(this['isNotNull'](_0x583571)){logger['debug'](_0x109e('0x35'),_0x583571['uniqueid'],util['inspect'](_0x583571,{'showHidden':![],'depth':null}));this[_0x109e('0x36')](_0x583571[_0x109e('0x18')],_[_0x109e('0x37')](_0x583571[_0x109e('0x38')])[0x0],_0x583571['value']);if(this[_0x109e('0x16')](_0x583571[_0x109e('0x38')])&&this[_0x109e('0x16')](_0x583571[_0x109e('0x38')][_0x109e('0x39')])){if(_[_0x109e('0x14')](this['channels'][_0x583571[_0x109e('0x18')]])){this[_0x109e('0x19')][_0x583571[_0x109e('0x18')]]={'routeId':_0x583571['value'],'variables':this[_0x109e('0x9')][_0x583571[_0x109e('0x18')]]};logger['info'](_0x109e('0x3a'),_0x583571[_0x109e('0x18')],_0x583571[_0x109e('0x38')][_0x109e('0x39')],_[_0x109e('0x37')](_0x583571[_0x109e('0x38')])[0x0],_0x583571[_0x109e('0x3b')]);logger['debug'](_0x109e('0x3c'),_0x583571[_0x109e('0x18')],util[_0x109e('0x25')](this[_0x109e('0x19')][_0x583571[_0x109e('0x18')]],{'showHidden':![],'depth':null}));this[_0x109e('0x15')](_0x109e('0x26'),_0x109e('0x27'),this[_0x109e('0x19')][_0x583571[_0x109e('0x18')]]);}}}}catch(_0x21b9cd){logger[_0x109e('0x2a')](_0x109e('0x3d'),_0x583571['uniqueid'],util[_0x109e('0x25')](_0x21b9cd,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x109e('0x13')]['addVariable']=function(_0x18ecb2,_0x350999,_0x26c7c6){var _0x47a874=[_0x109e('0x3e'),_0x109e('0x3f'),_0x109e('0x40'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0x109e('0x41'),_0x109e('0x42'),_0x109e('0x43'),'sipcallid',_0x109e('0x44'),_0x109e('0x45'),_0x109e('0x46'),'membercalls',_0x109e('0x47'),_0x109e('0x48'),_0x109e('0x49'),'membername','memberpenalty','memberrealtime'];if(!_['isNil'](_0x350999)&&!_[_0x109e('0x4a')](_0x47a874,_0x350999)){if(_[_0x109e('0x14')](this[_0x109e('0x9')][_0x18ecb2])){this['variables'][_0x18ecb2]={};}this[_0x109e('0x9')][_0x18ecb2][_0x350999]=_0x26c7c6;}};VoiceDialReport[_0x109e('0x13')][_0x109e('0x12')]=function(_0x2d25ef){try{if(this[_0x109e('0x16')](_0x2d25ef)){logger[_0x109e('0x17')](_0x109e('0x4b'),_0x2d25ef['uniqueid'],util['inspect'](_0x2d25ef,{'showHidden':![],'depth':null}));if(this[_0x109e('0x19')][_0x2d25ef[_0x109e('0x18')]]){logger[_0x109e('0x22')](_0x109e('0x4c'),_0x2d25ef[_0x109e('0x18')],_0x2d25ef['cause-txt']);this['channels'][_0x2d25ef['uniqueid']]['endtime']=moment()['format'](_0x109e('0x30'));this[_0x109e('0x19')][_0x2d25ef[_0x109e('0x18')]][_0x109e('0x4d')]=moment(this['channels'][_0x2d25ef['uniqueid']][_0x109e('0x4e')])[_0x109e('0x4f')](this[_0x109e('0x19')][_0x2d25ef['uniqueid']]['starttime'],_0x109e('0x50'));this[_0x109e('0x19')][_0x2d25ef[_0x109e('0x18')]][_0x109e('0x31')]='complete';this[_0x109e('0x8')][_0x109e('0x51')]+=0x1;if(this[_0x109e('0x19')][_0x2d25ef[_0x109e('0x18')]]['answertime']){this[_0x109e('0x8')][_0x109e('0x52')]+=0x1;this[_0x109e('0x19')][_0x2d25ef[_0x109e('0x18')]][_0x109e('0x53')]=moment(this[_0x109e('0x19')][_0x2d25ef[_0x109e('0x18')]]['answertime'])[_0x109e('0x4f')](this['channels'][_0x2d25ef[_0x109e('0x18')]]['starttime'],_0x109e('0x50'));this[_0x109e('0x19')][_0x2d25ef[_0x109e('0x18')]]['billableseconds']=moment(this[_0x109e('0x19')][_0x2d25ef[_0x109e('0x18')]][_0x109e('0x4e')])['diff'](this[_0x109e('0x19')][_0x2d25ef['uniqueid']][_0x109e('0x2f')],_0x109e('0x50'));this[_0x109e('0x8')][_0x109e('0x54')]+=this['channels'][_0x2d25ef['uniqueid']][_0x109e('0x53')]||0x0;this[_0x109e('0x8')][_0x109e('0x55')]+=this[_0x109e('0x19')][_0x2d25ef[_0x109e('0x18')]][_0x109e('0x56')];}this[_0x109e('0x8')][_0x109e('0x57')]+=this[_0x109e('0x19')][_0x2d25ef[_0x109e('0x18')]]['duration'];logger[_0x109e('0x17')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x2d25ef[_0x109e('0x18')],util[_0x109e('0x25')](this[_0x109e('0x19')][_0x2d25ef['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x109e('0x15')]('custom:voiceDialReport',this[_0x109e('0x19')][_0x2d25ef[_0x109e('0x18')]]);logger['debug'](_0x109e('0x58'),_0x2d25ef['uniqueid'],util[_0x109e('0x25')](this[_0x109e('0x19')][_0x2d25ef['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x109e('0x15')](_0x109e('0x59'),this[_0x109e('0x19')][_0x2d25ef[_0x109e('0x18')]]);logger[_0x109e('0x17')](_0x109e('0x5a'),_0x2d25ef[_0x109e('0x18')],util[_0x109e('0x25')](this[_0x109e('0x19')][_0x2d25ef['uniqueid']],{'showHidden':![],'depth':null}));this[_0x109e('0x15')](_0x109e('0x26'),_0x109e('0x5b'),this['outbound']);logger[_0x109e('0x22')](_0x109e('0x5c'),JSON['stringify'](this[_0x109e('0x19')][_0x2d25ef[_0x109e('0x18')]]));logger['debug'](_0x109e('0x5d'),_0x2d25ef[_0x109e('0x18')],util[_0x109e('0x25')](this[_0x109e('0x19')][_0x2d25ef[_0x109e('0x18')]],{'showHidden':![],'depth':null}));this[_0x109e('0x15')](_0x109e('0x26'),_0x109e('0x5e'),this[_0x109e('0x19')][_0x2d25ef[_0x109e('0x18')]]);delete this[_0x109e('0x19')][_0x2d25ef['uniqueid']];}else if(this[_0x109e('0x19')][_0x2d25ef['linkedid']]){this[_0x109e('0x19')][_0x2d25ef[_0x109e('0x5f')]]['uniqueid']=this[_0x109e('0x19')][_0x2d25ef[_0x109e('0x5f')]][_0x109e('0x60')];}if(this[_0x109e('0x9')][_0x2d25ef[_0x109e('0x18')]]){delete this[_0x109e('0x9')][_0x2d25ef['uniqueid']];}}}catch(_0x4e4738){logger['error']('[%s][voiceDialReport][hangup]',_0x2d25ef[_0x109e('0x18')],util[_0x109e('0x25')](_0x4e4738,{'showHidden':![],'depth':null}));}};module[_0x109e('0x61')]=VoiceDialReport; \ No newline at end of file +var _0x73cd=['rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','cause-txt','endtime','duration','diff','seconds','lastevent','complete','total','answered','starttime','holdtime','billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','linkedid','destuniqueid','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','syncDialEnd','varset','syncVarSet','hangup','isNotNull','isUndefined','prototype','emit','debug','uniqueid','inspect','format','called','channel','substring','lastIndexOf','omit','event','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','connectedlinenum','connectedlinename','answertime','YYYY-MM-DD\x20HH:mm:ss','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt'];(function(_0x3996fa,_0x3e5a86){var _0x3fe730=function(_0x3e1eb6){while(--_0x3e1eb6){_0x3996fa['push'](_0x3996fa['shift']());}};_0x3fe730(++_0x3e5a86);}(_0x73cd,0x94));var _0xd73c=function(_0x25a136,_0x57320e){_0x25a136=_0x25a136-0x0;var _0x5b7159=_0x73cd[_0x25a136];return _0x5b7159;};'use strict';var _=require(_0xd73c('0x0'));var moment=require(_0xd73c('0x1'));var util=require(_0xd73c('0x2'));var Redis=require(_0xd73c('0x3'));var config=require(_0xd73c('0x4'));var logger=require(_0xd73c('0x5'))(_0xd73c('0x6'));var ami=require(_0xd73c('0x7'));config[_0xd73c('0x8')]=_[_0xd73c('0x9')](config[_0xd73c('0x8')],{'host':_0xd73c('0xa'),'port':0x18eb});var io=require(_0xd73c('0xb'))(new Redis(config[_0xd73c('0x8')]));function VoiceDialReport(_0xb1b05c){this[_0xd73c('0xc')]=_0xb1b05c[_0xd73c('0xd')];this['outbound']=_0xb1b05c[_0xd73c('0xe')];this[_0xd73c('0xf')]={};ami['on'](_0xd73c('0x10'),this[_0xd73c('0x11')][_0xd73c('0x12')](this));ami['on']('dialend',this[_0xd73c('0x13')]['bind'](this));ami['on'](_0xd73c('0x14'),this[_0xd73c('0x15')][_0xd73c('0x12')](this));ami['on'](_0xd73c('0x16'),this['syncHangup'][_0xd73c('0x12')](this));}VoiceDialReport['prototype'][_0xd73c('0x17')]=function(_0x53114d){return _0x53114d!==null&&!_[_0xd73c('0x18')](_0x53114d);};VoiceDialReport[_0xd73c('0x19')][_0xd73c('0x1a')]=function(_0x71f2c5,_0x413229,_0x1cf689){io['to'](_0x71f2c5)[_0xd73c('0x1a')](_0x413229,_0x1cf689);};VoiceDialReport[_0xd73c('0x19')][_0xd73c('0x11')]=function(_0x4fbcae){try{if(this[_0xd73c('0x17')](_0x4fbcae)){logger[_0xd73c('0x1b')]('[%s][voiceDialReport][dialbegin]\x20event:',_0x4fbcae[_0xd73c('0x1c')],util[_0xd73c('0x1d')](_0x4fbcae,{'showHidden':![],'depth':null}));if(this[_0xd73c('0xc')][_0x4fbcae[_0xd73c('0x1c')]]){_['merge'](this['channels'][_0x4fbcae[_0xd73c('0x1c')]],{'starttime':moment()[_0xd73c('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xd73c('0x1f'),'interface':_0x4fbcae[_0xd73c('0x20')][_0xd73c('0x21')](0x0,_0x4fbcae['channel'][_0xd73c('0x22')]('-')),'membername':_0x4fbcae[_0xd73c('0x20')][_0xd73c('0x21')](_0x4fbcae['channel'][_0xd73c('0x22')]('/')+0x1,_0x4fbcae[_0xd73c('0x20')]['lastIndexOf']('-'))},_[_0xd73c('0x23')](_0x4fbcae,[_0xd73c('0x24'),'privilege']));logger[_0xd73c('0x25')](_0xd73c('0x26'),_0x4fbcae['uniqueid'],this[_0xd73c('0xc')][_0x4fbcae[_0xd73c('0x1c')]][_0xd73c('0x27')],this[_0xd73c('0xc')][_0x4fbcae[_0xd73c('0x1c')]][_0xd73c('0x28')]);logger[_0xd73c('0x1b')](_0xd73c('0x29'),_0x4fbcae['uniqueid'],util[_0xd73c('0x1d')](this['channels'][_0x4fbcae['uniqueid']],{'showHidden':![],'depth':null}));this[_0xd73c('0x1a')](_0xd73c('0x2a'),_0xd73c('0x2b'),this['channels'][_0x4fbcae['uniqueid']]);logger[_0xd73c('0x1b')](_0xd73c('0x2c'),_0x4fbcae[_0xd73c('0x1c')],util[_0xd73c('0x1d')](this['channels'][_0x4fbcae[_0xd73c('0x1c')]],{'showHidden':![],'depth':null}));ami[_0xd73c('0x1a')]('custom:dialbegin',this[_0xd73c('0xc')][_0x4fbcae[_0xd73c('0x1c')]]);}}}catch(_0x32a22b){logger[_0xd73c('0x2d')](_0xd73c('0x2e'),_0x4fbcae[_0xd73c('0x1c')],util[_0xd73c('0x1d')](_0x32a22b,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd73c('0x19')][_0xd73c('0x13')]=function(_0x44dd6f){try{if(this[_0xd73c('0x17')](_0x44dd6f)){logger[_0xd73c('0x1b')](_0xd73c('0x2f'),_0x44dd6f['uniqueid'],util[_0xd73c('0x1d')](_0x44dd6f,{'showHidden':![],'depth':null}));if(this[_0xd73c('0xc')][_0x44dd6f[_0xd73c('0x1c')]]){this['channels'][_0x44dd6f[_0xd73c('0x1c')]][_0xd73c('0x30')]=_0x44dd6f[_0xd73c('0x30')];if(_0x44dd6f[_0xd73c('0x30')]==='ANSWER'){this[_0xd73c('0xc')][_0x44dd6f['uniqueid']]['connectedlinenum']=_0x44dd6f[_0xd73c('0x31')];this[_0xd73c('0xc')][_0x44dd6f[_0xd73c('0x1c')]]['connectedlinename']=_0x44dd6f[_0xd73c('0x32')];this['channels'][_0x44dd6f[_0xd73c('0x1c')]][_0xd73c('0x33')]=moment()[_0xd73c('0x1e')](_0xd73c('0x34'));this[_0xd73c('0xc')][_0x44dd6f[_0xd73c('0x1c')]]['lastevent']=_0xd73c('0x35');logger[_0xd73c('0x25')](_0xd73c('0x36'),_0x44dd6f['uniqueid'],_0x44dd6f[_0xd73c('0x20')][_0xd73c('0x21')](_0x44dd6f[_0xd73c('0x20')][_0xd73c('0x22')]('/')+0x1,_0x44dd6f[_0xd73c('0x20')][_0xd73c('0x22')]('-')));logger[_0xd73c('0x1b')](_0xd73c('0x37'),_0x44dd6f[_0xd73c('0x1c')],util[_0xd73c('0x1d')](this[_0xd73c('0xc')][_0x44dd6f['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xd73c('0x1a')](_0xd73c('0x38'),this['channels'][_0x44dd6f[_0xd73c('0x1c')]]);}logger['debug'](_0xd73c('0x39'),_0x44dd6f[_0xd73c('0x1c')],util['inspect'](this['channels'][_0x44dd6f['uniqueid']],{'showHidden':![],'depth':null}));this[_0xd73c('0x1a')](_0xd73c('0x2a'),'voice_outbound_channel:save',this[_0xd73c('0xc')][_0x44dd6f[_0xd73c('0x1c')]]);}}}catch(_0x2909df){logger['error'](_0xd73c('0x3a'),_0x44dd6f['uniqueid'],util['inspect'](_0x2909df,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd73c('0x19')]['syncVarSet']=function(_0x2d3086){try{if(this['isNotNull'](_0x2d3086)){logger[_0xd73c('0x1b')](_0xd73c('0x3b'),_0x2d3086['uniqueid'],util[_0xd73c('0x1d')](_0x2d3086,{'showHidden':![],'depth':null}));this[_0xd73c('0x3c')](_0x2d3086['uniqueid'],_[_0xd73c('0x3d')](_0x2d3086[_0xd73c('0x3e')])[0x0],_0x2d3086[_0xd73c('0x3f')]);if(this[_0xd73c('0x17')](_0x2d3086[_0xd73c('0x3e')])&&this[_0xd73c('0x17')](_0x2d3086[_0xd73c('0x3e')]['outboundrouteid'])){if(_[_0xd73c('0x18')](this[_0xd73c('0xc')][_0x2d3086[_0xd73c('0x1c')]])){this[_0xd73c('0xc')][_0x2d3086['uniqueid']]={'routeId':_0x2d3086[_0xd73c('0x3f')],'variables':this[_0xd73c('0xf')][_0x2d3086['uniqueid']]};logger['info'](_0xd73c('0x40'),_0x2d3086[_0xd73c('0x1c')],_0x2d3086['variable']['outboundrouteid'],_[_0xd73c('0x3d')](_0x2d3086['variable'])[0x0],_0x2d3086[_0xd73c('0x3f')]);logger[_0xd73c('0x1b')](_0xd73c('0x41'),_0x2d3086['uniqueid'],util['inspect'](this[_0xd73c('0xc')][_0x2d3086[_0xd73c('0x1c')]],{'showHidden':![],'depth':null}));this[_0xd73c('0x1a')](_0xd73c('0x2a'),_0xd73c('0x2b'),this[_0xd73c('0xc')][_0x2d3086[_0xd73c('0x1c')]]);}}}}catch(_0x334326){logger[_0xd73c('0x2d')](_0xd73c('0x42'),_0x2d3086['uniqueid'],util['inspect'](_0x334326,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['addVariable']=function(_0x3bad27,_0x53d7c0,_0x13f87a){var _0x6bdfac=['rtpaudioqos','rtpaudioqosbridged',_0xd73c('0x43'),_0xd73c('0x44'),_0xd73c('0x45'),_0xd73c('0x46'),_0xd73c('0x47'),_0xd73c('0x48'),_0xd73c('0x49'),_0xd73c('0x4a'),_0xd73c('0x4b'),_0xd73c('0x4c'),_0xd73c('0x4d'),_0xd73c('0x4e'),_0xd73c('0x4f'),_0xd73c('0x50'),'membername',_0xd73c('0x51'),_0xd73c('0x52')];if(!_[_0xd73c('0x53')](_0x53d7c0)&&!_[_0xd73c('0x54')](_0x6bdfac,_0x53d7c0)){if(_[_0xd73c('0x18')](this[_0xd73c('0xf')][_0x3bad27])){this[_0xd73c('0xf')][_0x3bad27]={};}this[_0xd73c('0xf')][_0x3bad27][_0x53d7c0]=_0x13f87a;}};VoiceDialReport[_0xd73c('0x19')]['syncHangup']=function(_0x400c68){try{if(this[_0xd73c('0x17')](_0x400c68)){logger[_0xd73c('0x1b')](_0xd73c('0x55'),_0x400c68[_0xd73c('0x1c')],util[_0xd73c('0x1d')](_0x400c68,{'showHidden':![],'depth':null}));if(this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]]){logger[_0xd73c('0x25')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x400c68[_0xd73c('0x1c')],_0x400c68[_0xd73c('0x56')]);this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]][_0xd73c('0x57')]=moment()[_0xd73c('0x1e')](_0xd73c('0x34'));this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]][_0xd73c('0x58')]=moment(this[_0xd73c('0xc')][_0x400c68['uniqueid']][_0xd73c('0x57')])[_0xd73c('0x59')](this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]]['starttime'],_0xd73c('0x5a'));this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]][_0xd73c('0x5b')]=_0xd73c('0x5c');this[_0xd73c('0xe')][_0xd73c('0x5d')]+=0x1;if(this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]][_0xd73c('0x33')]){this[_0xd73c('0xe')][_0xd73c('0x5e')]+=0x1;this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]]['holdtime']=moment(this['channels'][_0x400c68[_0xd73c('0x1c')]][_0xd73c('0x33')])['diff'](this['channels'][_0x400c68[_0xd73c('0x1c')]][_0xd73c('0x5f')],_0xd73c('0x5a'));this['channels'][_0x400c68[_0xd73c('0x1c')]]['billableseconds']=moment(this[_0xd73c('0xc')][_0x400c68['uniqueid']][_0xd73c('0x57')])['diff'](this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]][_0xd73c('0x33')],'seconds');this[_0xd73c('0xe')]['sumHoldTime']+=this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]][_0xd73c('0x60')]||0x0;this[_0xd73c('0xe')]['sumBillable']+=this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]][_0xd73c('0x61')];}this[_0xd73c('0xe')][_0xd73c('0x62')]+=this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]]['duration'];logger[_0xd73c('0x1b')](_0xd73c('0x63'),_0x400c68[_0xd73c('0x1c')],util['inspect'](this[_0xd73c('0xc')][_0x400c68['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xd73c('0x1a')](_0xd73c('0x64'),this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]]);logger[_0xd73c('0x1b')](_0xd73c('0x65'),_0x400c68[_0xd73c('0x1c')],util[_0xd73c('0x1d')](this[_0xd73c('0xc')][_0x400c68['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0xd73c('0x66'),this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]]);logger[_0xd73c('0x1b')](_0xd73c('0x67'),_0x400c68[_0xd73c('0x1c')],util[_0xd73c('0x1d')](this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]],{'showHidden':![],'depth':null}));this[_0xd73c('0x1a')](_0xd73c('0x2a'),'voice_outbound:save',this[_0xd73c('0xe')]);logger[_0xd73c('0x25')](_0xd73c('0x68'),JSON[_0xd73c('0x69')](this[_0xd73c('0xc')][_0x400c68['uniqueid']]));logger[_0xd73c('0x1b')](_0xd73c('0x6a'),_0x400c68['uniqueid'],util[_0xd73c('0x1d')](this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]],{'showHidden':![],'depth':null}));this[_0xd73c('0x1a')](_0xd73c('0x2a'),'voice_outbound_channel:remove',this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x1c')]]);delete this['channels'][_0x400c68['uniqueid']];}else if(this[_0xd73c('0xc')][_0x400c68['linkedid']]){this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x6b')]][_0xd73c('0x1c')]=this[_0xd73c('0xc')][_0x400c68[_0xd73c('0x6b')]][_0xd73c('0x6c')];}if(this['variables'][_0x400c68[_0xd73c('0x1c')]]){delete this['variables'][_0x400c68[_0xd73c('0x1c')]];}}}catch(_0x5bdd65){logger[_0xd73c('0x2d')]('[%s][voiceDialReport][hangup]',_0x400c68[_0xd73c('0x1c')],util[_0xd73c('0x1d')](_0x5bdd65,{'showHidden':![],'depth':null}));}};module[_0xd73c('0x6d')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index c695c4d..9b9e836 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6fe=['loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','clearZombieChannels','switch','isNil','Action','status','channel','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','debug',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','voice:queue:%s','name','voice_queue_channel:save','voice_queue_presence:save','[%s][voiceQueueReport][','voice_queue_presence:remove','type','inbound','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','Trunk','active','callerid','Interval','stringify','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isUndefined','queues','[voiceQueueReport][queues]','[voiceQueueReport][queuesummary]','syncQueueSummary','isNotNull','queue','[voiceQueueReport][queuesummary]\x20event:','info','[voiceQueueReport][queuesummary]\x20name:%s','countBy','callers','toNumber','loggedin','emitVoiceQueueSummary','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','position','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','keys','push','emitVoiceQueueChannelSave','queuecallerjoin','[%s][voiceQueueReport][queuecallerjoin]','syncQueueCallerAbandon','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandon','queuecallerabandonAt','queuecallerexitreason','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','queuecallerleaveAt','connectedlinenum','connectedlinename','[%s][voiceQueueReport][queuecallerleave]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','membername','queuecallerexit','queuecallerexitAt','transfer','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','local/','linkedid','last','add','seconds','FORWARDTRANSFER','transfertype','transferexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','agentcomplete','[%s][voiceQueueReport][agentcomplete]','addVariable','value','variable','queuestatus','CONTINUE','lastevent','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','[%s][voiceQueueReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','syncHangup','[%s][voiceQueueReport][hangup]','diff','length','milliseconds','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','custom:queuecallerabandon','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfereruniqueid','ATTENDEDTRANSFER','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','syncMusicOnHoldStop','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','exports','lodash','moment','md5','ioredis','../../../config/environment','ami','../model/queueReport','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','queuesummarycomplete','syncQueueSummaryComplete','syncQueueCallerJoin','bind','queuecallerleave','syncQueueCallerLeave','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopQueueSummary'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xc6fe,0xbc));var _0xec6f=function(_0x3d2c72,_0x142d07){_0x3d2c72=_0x3d2c72-0x0;var _0x48bf2b=_0xc6fe[_0x3d2c72];return _0x48bf2b;};'use strict';var _=require(_0xec6f('0x0'));var moment=require(_0xec6f('0x1'));var util=require('util');var md5=require(_0xec6f('0x2'));var Redis=require(_0xec6f('0x3'));var config=require(_0xec6f('0x4'));var logger=require('../../../config/logger')(_0xec6f('0x5'));var ami=require('../ami');var QueueReport=require(_0xec6f('0x6'));config[_0xec6f('0x7')]=_[_0xec6f('0x8')](config[_0xec6f('0x7')],{'host':_0xec6f('0x9'),'port':0x18eb});var io=require(_0xec6f('0xa'))(new Redis(config[_0xec6f('0x7')]));var Sequence=function(){};Sequence[_0xec6f('0xb')][_0xec6f('0xc')]=function(_0x38485a){this['tail']=this[_0xec6f('0xd')]?this[_0xec6f('0xd')][_0xec6f('0xe')](_0x38485a):_0x38485a();};function VoiceQueueReport(_0x138d0b){this[_0xec6f('0xf')]=new Sequence();this[_0xec6f('0x10')]={};this[_0xec6f('0x11')]=_0x138d0b[_0xec6f('0x11')];this[_0xec6f('0x12')]=_0x138d0b[_0xec6f('0x13')];this[_0xec6f('0x14')]=_0x138d0b['voiceQueues'];this[_0xec6f('0x15')]=!![];this[_0xec6f('0x16')]=_0x138d0b[_0xec6f('0x16')];this[_0xec6f('0x17')]={};ami['on'](_0xec6f('0x18'),this['syncQueueSummary']['bind'](this));ami['on'](_0xec6f('0x19'),this[_0xec6f('0x1a')]['bind'](this));ami['on']('queuecallerjoin',this[_0xec6f('0x1b')][_0xec6f('0x1c')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0xec6f('0x1c')](this));ami['on'](_0xec6f('0x1d'),this[_0xec6f('0x1e')][_0xec6f('0x1c')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0xec6f('0x1c')](this));ami['on'](_0xec6f('0x1f'),this[_0xec6f('0x20')][_0xec6f('0x1c')](this));ami['on'](_0xec6f('0x21'),this[_0xec6f('0x22')][_0xec6f('0x1c')](this));ami['on'](_0xec6f('0x23'),this['syncHangup'][_0xec6f('0x1c')](this));ami['on'](_0xec6f('0x24'),this[_0xec6f('0x25')][_0xec6f('0x1c')](this));ami['on'](_0xec6f('0x26'),this[_0xec6f('0x27')]['bind'](this));ami['on'](_0xec6f('0x28'),this['syncMusicOnHoldStop'][_0xec6f('0x1c')](this));ami['on'](_0xec6f('0x29'),this[_0xec6f('0x2a')][_0xec6f('0x1c')](this));ami['on']('blindtransfer',this[_0xec6f('0x2b')]['bind'](this));this[_0xec6f('0x2c')]();this[_0xec6f('0x2d')]();}function clearChannels(_0xcf978){if(!_[_0xec6f('0x2e')](_0xcf978)){for(var _0x339a6e in _0xcf978){if(_0xcf978[_0xec6f('0x2f')](_0x339a6e)){delete _0xcf978[_0x339a6e];}}}}function clearCampaigns(_0x4e5798){if(!_[_0xec6f('0x2e')](_0x4e5798)){for(var _0x2251fe in _0x4e5798){if(_0x4e5798[_0xec6f('0x2f')](_0x2251fe)){_0x4e5798[_0x2251fe][_0xec6f('0x30')]=0x0;}}}}function clearVoiceQueues(_0x1953cb){if(!_[_0xec6f('0x2e')](_0x1953cb)){for(var _0x19e542 in _0x1953cb){if(_0x1953cb['hasOwnProperty'](_0x19e542)){_0x1953cb[_0x19e542][_0xec6f('0x30')]=0x0;_0x1953cb[_0x19e542][_0xec6f('0x31')]=0x0;_0x1953cb[_0x19e542][_0xec6f('0x32')]=0x0;_0x1953cb[_0x19e542][_0xec6f('0x33')]=0x0;_0x1953cb[_0x19e542][_0xec6f('0x34')]=!![];}}}}function clearAgentBooked(_0x29e06a){if(!_['isEmpty'](_0x29e06a)){for(var _0x5aff82 in _0x29e06a){if(_0x29e06a[_0xec6f('0x2f')](_0x5aff82)){_0x29e06a[_0x5aff82]['unlockRR']=!![];}}}}VoiceQueueReport[_0xec6f('0xb')][_0xec6f('0x35')]=function(){var _0x32dc26=this;for(var _0x3180eb in this[_0xec6f('0x12')]){if(this['channels'][_0xec6f('0x2f')](_0x3180eb)&&!this['channels'][_0x3180eb][_0xec6f('0x36')]){this[_0xec6f('0xf')][_0xec6f('0xc')](function(){if(!_[_0xec6f('0x37')](_0x32dc26['channels'][_0x3180eb])){return ami[_0xec6f('0x38')]({'action':_0xec6f('0x39'),'channel':_0x32dc26[_0xec6f('0x12')][_0x3180eb][_0xec6f('0x3a')]})[_0xec6f('0x3b')](function(_0xbbadd4){if(_0xbbadd4[_0xec6f('0x3c')]===_0xec6f('0x3d')){setTimeout(function(){if(_0x32dc26['channels'][_0x3180eb]){delete _0x32dc26[_0xec6f('0x12')][_0x3180eb];logger[_0xec6f('0x3e')](_0xec6f('0x3f'),_0x3180eb,util[_0xec6f('0x40')](_0xbbadd4,{'showHidden':![],'depth':null}));}if(_0x32dc26['queueReports'][_0x3180eb]){delete _0x32dc26['queueReports'][_0x3180eb];logger[_0xec6f('0x3e')](_0xec6f('0x41'),_0x3180eb,util[_0xec6f('0x40')](_0xbbadd4,{'showHidden':![],'depth':null}));}if(_0x32dc26['variables'][_0x3180eb]){delete _0x32dc26[_0xec6f('0x17')][_0x3180eb];logger[_0xec6f('0x3e')]('[%s][voiceQueueReport][checkVariables]',_0x3180eb,util[_0xec6f('0x40')](_0xbbadd4,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype']['syncFullyBooted']=function(){logger[_0xec6f('0x3e')](_0xec6f('0x42'));clearChannels(this['channels']);this[_0xec6f('0x43')](this[_0xec6f('0x10')]);clearAgentBooked(this[_0xec6f('0x11')]);clearVoiceQueues(this[_0xec6f('0x14')]);clearCampaigns(this['campaigns']);};VoiceQueueReport[_0xec6f('0xb')][_0xec6f('0x43')]=function(_0x5888f8){var _0x55b5e6=this;if(!_[_0xec6f('0x2e')](_0x5888f8)){for(var _0x4306ca in _0x5888f8){if(_0x5888f8[_0xec6f('0x2f')](_0x4306ca)){_0x55b5e6[_0xec6f('0x44')](_0x5888f8[_0x4306ca],_0xec6f('0x45'));delete _0x5888f8[_0x4306ca];}}}};VoiceQueueReport[_0xec6f('0xb')][_0xec6f('0x46')]=function(_0x1f8f97,_0x24f50e,_0x381dd8){io['to'](_0x1f8f97)[_0xec6f('0x46')](_0x24f50e,_0x381dd8);};VoiceQueueReport[_0xec6f('0xb')]['emitVoiceQueueChannelSave']=function(_0x1fdb95,_0x346228){logger[_0xec6f('0x47')]('[%s][voiceQueueReport]['+_0x346228+_0xec6f('0x48'),_0x1fdb95[_0xec6f('0x49')],util['inspect'](_0x1fdb95,{'showHidden':![],'depth':null}));this[_0xec6f('0x46')](util['format'](_0xec6f('0x4a'),_0x1fdb95[_0xec6f('0x4b')]),_0xec6f('0x4c'),_0x1fdb95);io[_0xec6f('0x46')](_0xec6f('0x4d'),_0x1fdb95);};VoiceQueueReport['prototype']['emitVoiceQueueChannelRemove']=function(_0xa45bf8,_0x228f69){logger[_0xec6f('0x47')](_0xec6f('0x4e')+_0x228f69+']\x20sending\x20voice_queue_channel:remove\x20event:',_0xa45bf8['uniqueid'],util['inspect'](_0xa45bf8,{'showHidden':![],'depth':null}));this[_0xec6f('0x46')](util['format'](_0xec6f('0x4a'),_0xa45bf8[_0xec6f('0x4b')]),'voice_queue_channel:remove',_0xa45bf8);io[_0xec6f('0x46')](_0xec6f('0x4f'),_0xa45bf8);};VoiceQueueReport[_0xec6f('0xb')]['emitVoiceQueueSummary']=function(_0x1f0f94,_0x2a98bd){if(_0x1f0f94[_0xec6f('0x50')]===_0xec6f('0x51')){var _0x75fc51={'id':_0x1f0f94['id'],'name':_0x1f0f94[_0xec6f('0x4b')],'strategy':_0x1f0f94['strategy'],'answered':_0x1f0f94[_0xec6f('0x52')],'available':_0x1f0f94[_0xec6f('0x53')],'loggedIn':_0x1f0f94[_0xec6f('0x54')],'pTalking':_0x1f0f94[_0xec6f('0x32')],'sumBillable':_0x1f0f94[_0xec6f('0x55')],'sumDuration':_0x1f0f94[_0xec6f('0x56')],'sumHoldTime':_0x1f0f94[_0xec6f('0x57')]||0x0,'talking':_0x1f0f94[_0xec6f('0x31')],'total':_0x1f0f94[_0xec6f('0x58')],'type':_0x1f0f94[_0xec6f('0x50')],'unmanaged':_0x1f0f94[_0xec6f('0x59')],'abandoned':_0x1f0f94[_0xec6f('0x5a')],'waiting':_0x1f0f94[_0xec6f('0x33')]};if(_0x1f0f94[_0xec6f('0x5b')]){_0x75fc51['Trunk']={'id':_0x1f0f94[_0xec6f('0x5b')]['id'],'name':_0x1f0f94[_0xec6f('0x5b')]['name'],'active':_0x1f0f94[_0xec6f('0x5b')][_0xec6f('0x5c')],'callerid':_0x1f0f94[_0xec6f('0x5b')][_0xec6f('0x5d')]};}if(_0x1f0f94[_0xec6f('0x5e')]){_0x75fc51['Interval']={'id':_0x1f0f94['Interval']['id'],'name':_0x1f0f94[_0xec6f('0x5e')]['name']};}var _0x3f738f=md5(JSON[_0xec6f('0x5f')](_0x75fc51));if(_0x1f0f94[_0xec6f('0x2')]!==_0x3f738f){_0x1f0f94[_0xec6f('0x2')]=_0x3f738f;logger[_0xec6f('0x47')](_0xec6f('0x60')+_0x2a98bd+_0xec6f('0x61'),util['inspect'](_0x75fc51,{'showHidden':![],'depth':null}));this[_0xec6f('0x46')](util['format'](_0xec6f('0x4a'),_0x75fc51['name']),_0xec6f('0x62'),_0x75fc51);}}};VoiceQueueReport['prototype']['isNotNull']=function(_0x2bd32c){return _0x2bd32c!==null&&!_[_0xec6f('0x63')](_0x2bd32c);};VoiceQueueReport[_0xec6f('0xb')][_0xec6f('0x2d')]=function(){var _0x117f5d=this;setInterval(function(){_0x117f5d[_0xec6f('0x35')]();ami['Action']({'action':_0xec6f('0x64')})[_0xec6f('0x3b')](function(_0x2f1738){logger['error'](_0xec6f('0x65'),util[_0xec6f('0x40')](_0x2f1738,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xec6f('0xb')][_0xec6f('0x2c')]=function(){var _0x20d8ae=this;setInterval(function(){if(_0x20d8ae['flagQueueSummary']){return ami['Action']({'action':'queuesummary'})['then'](function(_0x26b1c3){_0x20d8ae[_0xec6f('0x15')]=![];})[_0xec6f('0x3b')](function(_0x5c47ac){logger[_0xec6f('0x3e')](_0xec6f('0x66'),util[_0xec6f('0x40')](_0x5c47ac,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xec6f('0xb')][_0xec6f('0x67')]=function(_0x5b91f5){try{if(this[_0xec6f('0x68')](_0x5b91f5)&&this[_0xec6f('0x68')](_0x5b91f5[_0xec6f('0x69')])){logger[_0xec6f('0x47')](_0xec6f('0x6a'),util[_0xec6f('0x40')](_0x5b91f5,{'showHidden':![],'depth':null}));if(this[_0xec6f('0x14')][_0x5b91f5[_0xec6f('0x69')]]){logger[_0xec6f('0x6b')](_0xec6f('0x6c'),_0x5b91f5[_0xec6f('0x69')]);var _0x45ce53=_[_0xec6f('0x6d')](this[_0xec6f('0x12')],'queue')[_0x5b91f5['queue']]||0x0;var _0x66e44d=_0x45ce53-_0x5b91f5['callers'];if(this['voiceQueues'][_0x5b91f5['queue']][_0xec6f('0x33')]!==_['toNumber'](_0x5b91f5[_0xec6f('0x6e')])||this[_0xec6f('0x14')][_0x5b91f5[_0xec6f('0x69')]][_0xec6f('0x54')]!==_[_0xec6f('0x6f')](_0x5b91f5[_0xec6f('0x70')])||this[_0xec6f('0x14')][_0x5b91f5[_0xec6f('0x69')]][_0xec6f('0x53')]!==_['toNumber'](_0x5b91f5[_0xec6f('0x53')])||this['voiceQueues'][_0x5b91f5[_0xec6f('0x69')]]['talking']!==_0x66e44d){this[_0xec6f('0x14')][_0x5b91f5[_0xec6f('0x69')]][_0xec6f('0x33')]=_['toNumber'](_0x5b91f5['callers']);this['voiceQueues'][_0x5b91f5['queue']][_0xec6f('0x54')]=_[_0xec6f('0x6f')](_0x5b91f5[_0xec6f('0x70')]);this[_0xec6f('0x14')][_0x5b91f5[_0xec6f('0x69')]]['available']=_[_0xec6f('0x6f')](_0x5b91f5[_0xec6f('0x53')]);this[_0xec6f('0x14')][_0x5b91f5['queue']][_0xec6f('0x31')]=_0x66e44d>0x0?_0x66e44d:0x0;this[_0xec6f('0x14')][_0x5b91f5[_0xec6f('0x69')]]['talking']=this[_0xec6f('0x14')][_0x5b91f5[_0xec6f('0x69')]][_0xec6f('0x31')]>_[_0xec6f('0x6f')](_0x5b91f5[_0xec6f('0x70')])?_[_0xec6f('0x6f')](_0x5b91f5[_0xec6f('0x70')]):this[_0xec6f('0x14')][_0x5b91f5[_0xec6f('0x69')]][_0xec6f('0x31')];this[_0xec6f('0x71')](this[_0xec6f('0x14')][_0x5b91f5[_0xec6f('0x69')]],'queuesummary');}logger[_0xec6f('0x47')](_0xec6f('0x72'),util[_0xec6f('0x40')](this[_0xec6f('0x14')][_0x5b91f5[_0xec6f('0x69')]],{'showHidden':![],'depth':null}));ami['emit'](_0xec6f('0x73'),this[_0xec6f('0x14')][_0x5b91f5[_0xec6f('0x69')]]);}}}catch(_0x419411){logger[_0xec6f('0x3e')](_0xec6f('0x66'),util['inspect'](_0x419411,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xec6f('0x1a')]=function(_0x244bd0){logger[_0xec6f('0x47')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0xec6f('0x40')](_0x244bd0,{'showHidden':![],'depth':null}));this[_0xec6f('0x15')]=!![];};VoiceQueueReport[_0xec6f('0xb')][_0xec6f('0x1b')]=function(_0x124ca1){try{if(this[_0xec6f('0x68')](_0x124ca1)){logger[_0xec6f('0x47')]('[%s][voiceQueueReport][queuecallerjoin]',_0x124ca1[_0xec6f('0x49')],util[_0xec6f('0x40')](_0x124ca1,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xec6f('0x10')][_0x124ca1[_0xec6f('0x49')]])){this[_0xec6f('0x10')][_0x124ca1['uniqueid']]=[];this[_0xec6f('0x12')][_0x124ca1[_0xec6f('0x49')]]={};}var _0x43d400=new QueueReport();_0x43d400['name']=_0x124ca1[_0xec6f('0x69')];_0x43d400[_0xec6f('0x50')]=this[_0xec6f('0x14')][_0x43d400[_0xec6f('0x4b')]]&&this['voiceQueues'][_0x43d400[_0xec6f('0x4b')]][_0xec6f('0x50')]?this['voiceQueues'][_0x43d400[_0xec6f('0x4b')]][_0xec6f('0x50')]||_0xec6f('0x51'):_0xec6f('0x51');_0x43d400['queue']=_0x124ca1[_0xec6f('0x69')];_0x43d400[_0xec6f('0x74')]=moment()[_0xec6f('0x75')](_0xec6f('0x76'));_0x43d400[_0xec6f('0x77')]=_0x124ca1['position'];_0x43d400[_0xec6f('0x78')]=_0x124ca1['count'];_0x43d400[_0xec6f('0x49')]=_0x124ca1[_0xec6f('0x49')];logger[_0xec6f('0x6b')](_0xec6f('0x79'),_0x43d400['name'],_0x43d400['type']);_[_0xec6f('0x7a')](_0x43d400,_[_0xec6f('0x7b')](_0x124ca1,_[_0xec6f('0x7c')](_0x43d400)));this[_0xec6f('0x10')][_0x124ca1[_0xec6f('0x49')]][_0xec6f('0x7d')](_0x43d400);this['channels'][_0x124ca1[_0xec6f('0x49')]]=_0x43d400;this[_0xec6f('0x7e')](_0x43d400,_0xec6f('0x7f'));}}catch(_0x5bd8ab){logger[_0xec6f('0x3e')](_0xec6f('0x80'),_0x124ca1[_0xec6f('0x49')],util[_0xec6f('0x40')](_0x5bd8ab,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xec6f('0x81')]=function(_0x519435){try{if(this['isNotNull'](_0x519435)){logger[_0xec6f('0x47')]('[%s][voiceQueueReport][queuecallerabandon]',_0x519435[_0xec6f('0x49')],util[_0xec6f('0x40')](_0x519435,{'showHidden':![],'depth':null}));if(this[_0xec6f('0x10')][_0x519435['uniqueid']]){var _0x1f09d6=_['last'](this[_0xec6f('0x10')][_0x519435['uniqueid']]);_0x1f09d6[_0xec6f('0x82')]=![];_0x1f09d6[_0xec6f('0x83')]=null;_0x1f09d6[_0xec6f('0x84')]=_0x519435[_0xec6f('0x84')];_0x1f09d6['originalposition']=_0x519435[_0xec6f('0x85')];_0x1f09d6[_0xec6f('0x86')]=!![];_0x1f09d6[_0xec6f('0x87')]=moment()[_0xec6f('0x75')](_0xec6f('0x76'));_0x1f09d6[_0xec6f('0x88')]=_0xec6f('0x89');_0x1f09d6[_0xec6f('0x8a')]=null;logger[_0xec6f('0x6b')](_0xec6f('0x8b'),_0x1f09d6[_0xec6f('0x4b')],_0x1f09d6[_0xec6f('0x50')]);this[_0xec6f('0x12')][_0x519435[_0xec6f('0x49')]]=_0x1f09d6;this[_0xec6f('0x44')](_0x1f09d6,'queuecallerabandon');}}}catch(_0x1eb45d){logger[_0xec6f('0x3e')]('[%s][voiceQueueReport][queuecallerabandon]',_0x519435['uniqueid'],util[_0xec6f('0x40')](_0x1eb45d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xec6f('0xb')]['syncQueueCallerLeave']=function(_0x5bd68a){try{if(this[_0xec6f('0x68')](_0x5bd68a)){logger[_0xec6f('0x47')]('[%s][voiceQueueReport][queuecallerleave]',_0x5bd68a['uniqueid'],util['inspect'](_0x5bd68a,{'showHidden':![],'depth':null}));if(this[_0xec6f('0x10')][_0x5bd68a[_0xec6f('0x49')]]){var _0x1152d2=_['last'](this[_0xec6f('0x10')][_0x5bd68a[_0xec6f('0x49')]]);_0x1152d2[_0xec6f('0x8c')]=moment()[_0xec6f('0x75')]('YYYY-MM-DD\x20HH:mm:ss');_0x1152d2[_0xec6f('0x8d')]=_0x5bd68a[_0xec6f('0x8d')];_0x1152d2[_0xec6f('0x8e')]=_0x5bd68a[_0xec6f('0x8e')];logger[_0xec6f('0x6b')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x1152d2[_0xec6f('0x4b')],_0x1152d2[_0xec6f('0x50')],_0x5bd68a[_0xec6f('0x8d')],_0x5bd68a[_0xec6f('0x8e')]);this[_0xec6f('0x12')][_0x5bd68a[_0xec6f('0x49')]]=_0x1152d2;this[_0xec6f('0x7e')](_0x1152d2,_0xec6f('0x1d'));}}}catch(_0x1e8d63){logger['error'](_0xec6f('0x8f'),_0x5bd68a['uniqueid'],util['inspect'](_0x1e8d63,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xec6f('0x20')]=function(_0x4e0b0d){try{if(this[_0xec6f('0x68')](_0x4e0b0d)){logger[_0xec6f('0x47')]('[%s][voiceQueueReport][agentconnect]',_0x4e0b0d[_0xec6f('0x49')],util[_0xec6f('0x40')](_0x4e0b0d,{'showHidden':![],'depth':null}));if(this[_0xec6f('0x10')][_0x4e0b0d[_0xec6f('0x49')]]){var _0x249db3=_['last'](this[_0xec6f('0x10')][_0x4e0b0d['uniqueid']]);_0x249db3[_0xec6f('0x82')]=!![];_0x249db3[_0xec6f('0x88')]=_0xec6f('0x90');logger[_0xec6f('0x6b')](_0xec6f('0x91'),_0x249db3[_0xec6f('0x4b')],_0x249db3['type']);}}}catch(_0x419187){logger[_0xec6f('0x3e')](_0xec6f('0x92'),_0x4e0b0d[_0xec6f('0x49')],util[_0xec6f('0x40')](_0x419187,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xec6f('0xb')]['syncAgentComplete']=function(_0x32cf02){try{if(this[_0xec6f('0x68')](_0x32cf02)){logger[_0xec6f('0x47')]('[%s][voiceQueueReport][agentcomplete]',_0x32cf02['uniqueid'],util[_0xec6f('0x40')](_0x32cf02,{'showHidden':![],'depth':null}));if(this[_0xec6f('0x10')][_0x32cf02[_0xec6f('0x49')]]){var _0x4a1f0f=_['last'](this[_0xec6f('0x10')][_0x32cf02[_0xec6f('0x49')]]);_0x4a1f0f[_0xec6f('0x86')]=![];_0x4a1f0f['queuecallerabandonAt']=null;_0x4a1f0f['assigned']=!![];_0x4a1f0f[_0xec6f('0x8a')]=_0x32cf02[_0xec6f('0x93')];_0x4a1f0f['holdtime']=_0x32cf02[_0xec6f('0x84')];_0x4a1f0f[_0xec6f('0x82')]=!![];_0x4a1f0f[_0xec6f('0x94')]=![];_0x4a1f0f[_0xec6f('0x95')]=null;if(!_0x4a1f0f[_0xec6f('0x96')]){if(_0x32cf02['reason']=='transfer'){_0x4a1f0f[_0xec6f('0x88')]=_0xec6f('0x97');logger['info'](_0xec6f('0x98'),_0x4a1f0f['name'],_0x4a1f0f[_0xec6f('0x50')]);}else{if(_[_0xec6f('0x99')](_0x32cf02[_0xec6f('0x3a')][_0xec6f('0x9a')](),_0xec6f('0x9b'))){if(this[_0xec6f('0x10')][_0x32cf02[_0xec6f('0x9c')]]){var _0x516566=_[_0xec6f('0x9d')](this[_0xec6f('0x10')][_0x32cf02[_0xec6f('0x9c')]]);_0x516566['queuecallercomplete']=![];_0x516566[_0xec6f('0x94')]=!![];_0x516566[_0xec6f('0x95')]=moment(_0x4a1f0f['queuecallerjoinAt'])[_0xec6f('0x9e')](_0x32cf02[_0xec6f('0x84')],_0xec6f('0x9f'))[_0xec6f('0x75')](_0xec6f('0x76'));_0x516566[_0xec6f('0x88')]=_0xec6f('0xa0');_0x516566['transfer']=!![];_0x516566[_0xec6f('0xa1')]='FORWARD';_0x516566[_0xec6f('0xa2')]=_0x32cf02['destexten'];_0x516566[_0xec6f('0xa3')]=_0x32cf02[_0xec6f('0x49')];logger[_0xec6f('0x6b')](_0xec6f('0xa4'),_0x516566[_0xec6f('0x4b')],_0x516566[_0xec6f('0x50')]);var _0x5603db=this[_0xec6f('0x10')][_0x32cf02[_0xec6f('0x9c')]];this[_0xec6f('0x10')][_0x32cf02['linkedid']]=this[_0xec6f('0x10')][_0x32cf02[_0xec6f('0x49')]];this[_0xec6f('0x10')][_0x32cf02[_0xec6f('0x49')]]=_0x5603db;}}else{_0x4a1f0f[_0xec6f('0x88')]=_0xec6f('0xa5')+_0x32cf02['reason'][_0xec6f('0xa6')]();logger[_0xec6f('0x6b')](_0xec6f('0xa7'),_0x4a1f0f[_0xec6f('0x4b')],_0x4a1f0f[_0xec6f('0x50')],_0x4a1f0f[_0xec6f('0x88')]);}}}this[_0xec6f('0x12')][_0x32cf02[_0xec6f('0x49')]]=_0x4a1f0f;this[_0xec6f('0x44')](_0x4a1f0f,_0xec6f('0xa8'));}}}catch(_0x5cb3f9){logger['error'](_0xec6f('0xa9'),_0x32cf02[_0xec6f('0x49')],util['inspect'](_0x5cb3f9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xec6f('0xb')]['syncVarSet']=function(_0x1afca3){try{if(this[_0xec6f('0x68')](_0x1afca3)){logger[_0xec6f('0x47')]('[%s][voiceQueueReport][varset]',_0x1afca3[_0xec6f('0x49')],util[_0xec6f('0x40')](_0x1afca3,{'showHidden':![],'depth':null}));this[_0xec6f('0xaa')](_0x1afca3[_0xec6f('0x49')],_[_0xec6f('0x7c')](_0x1afca3['variable'])[0x0],_0x1afca3[_0xec6f('0xab')]);if(this[_0xec6f('0x10')][_0x1afca3[_0xec6f('0x49')]]){var _0x38975a=_[_0xec6f('0x9d')](this['queueReports'][_0x1afca3[_0xec6f('0x49')]]);if(_0x38975a){if(this['isNotNull'](_0x1afca3[_0xec6f('0xac')])&&this[_0xec6f('0x68')](_0x1afca3[_0xec6f('0xac')][_0xec6f('0xad')])){switch(_0x1afca3[_0xec6f('0xab')]){case _0xec6f('0xae'):_0x38975a[_0xec6f('0x94')]=![];_0x38975a[_0xec6f('0x95')]=null;break;case'TIMEOUT':_0x38975a[_0xec6f('0xaf')]='timeout';_0x38975a[_0xec6f('0x94')]=!![];_0x38975a[_0xec6f('0x95')]=moment()[_0xec6f('0x75')](_0xec6f('0x76'));_0x38975a[_0xec6f('0x8c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0xec6f('0x47')](_0xec6f('0xb0'),_0x1afca3[_0xec6f('0x49')],util[_0xec6f('0x40')](_0x38975a,{'showHidden':![],'depth':null}));ami[_0xec6f('0x46')](_0xec6f('0xb1'),_0x38975a);break;default:_0x38975a[_0xec6f('0x94')]=!![];_0x38975a[_0xec6f('0x95')]=moment()['format'](_0xec6f('0x76'));_0x38975a['queuecallerleaveAt']=moment()[_0xec6f('0x75')](_0xec6f('0x76'));}_0x38975a[_0xec6f('0x86')]=![];_0x38975a[_0xec6f('0x87')]=null;_0x38975a[_0xec6f('0x88')]=_0x1afca3[_0xec6f('0xab')];this[_0xec6f('0x12')][_0x1afca3[_0xec6f('0x49')]]=_0x38975a;this[_0xec6f('0x44')](_0x38975a,_0xec6f('0x21'));}else if(this[_0xec6f('0x68')](_0x1afca3[_0xec6f('0xac')])&&this[_0xec6f('0x68')](_0x1afca3[_0xec6f('0xac')][_0xec6f('0xb2')])){if(!_0x38975a[_0xec6f('0x86')]){_0x38975a[_0xec6f('0x94')]=!![];_0x38975a['queuecallerexitAt']=moment()[_0xec6f('0x75')]('YYYY-MM-DD\x20HH:mm:ss');_0x38975a[_0xec6f('0x88')]='EXITWITHKEY';_0x38975a['queuecallerleaveAt']=moment()[_0xec6f('0x75')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xec6f('0x12')][_0x1afca3[_0xec6f('0x49')]]=_0x38975a;}}logger[_0xec6f('0x6b')](_0xec6f('0xb3'),_0x1afca3[_0xec6f('0x49')],_0x38975a[_0xec6f('0x4b')],_0x38975a[_0xec6f('0x50')],_['keys'](_0x1afca3[_0xec6f('0xac')])[0x0],_0x1afca3[_0xec6f('0xab')]);_0x38975a['variables']=this[_0xec6f('0x17')][_0x1afca3[_0xec6f('0x49')]];}}}}catch(_0x3bdf3e){logger[_0xec6f('0x3e')](_0xec6f('0xb4'),_0x1afca3['uniqueid'],util[_0xec6f('0x40')](_0x3bdf3e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xec6f('0xaa')]=function(_0x3e1317,_0x2ef1f6,_0xd4ebd6){var _0x241254=[_0xec6f('0xb5'),_0xec6f('0xb6'),_0xec6f('0xb7'),_0xec6f('0xb8'),_0xec6f('0xb9'),_0xec6f('0xba'),_0xec6f('0xbb'),_0xec6f('0xbc'),_0xec6f('0xbd'),_0xec6f('0xbe'),'bridgepeer',_0xec6f('0xbf'),_0xec6f('0xc0'),'memberdynamic',_0xec6f('0xc1'),_0xec6f('0xc2'),_0xec6f('0x93'),_0xec6f('0xc3'),_0xec6f('0xc4')];if(!_[_0xec6f('0x37')](_0x2ef1f6)&&!_[_0xec6f('0xc5')](_0x241254,_0x2ef1f6)){if(_[_0xec6f('0x63')](this['variables'][_0x3e1317])){this['variables'][_0x3e1317]={};}this['variables'][_0x3e1317][_0x2ef1f6]=_0xd4ebd6;}};VoiceQueueReport[_0xec6f('0xb')][_0xec6f('0xc6')]=function(_0x190e91){try{if(this[_0xec6f('0x68')](_0x190e91)){logger['debug'](_0xec6f('0xc7'),_0x190e91['uniqueid'],util[_0xec6f('0x40')](_0x190e91,{'showHidden':![],'depth':null}));if(this[_0xec6f('0x10')][_0x190e91[_0xec6f('0x49')]]){for(var _0x3e1eac=0x0,_0x5462c6={};_0x3e1eac0x0?_0x2e4298:0x0;this[_0xd373('0x12')][_0x1f52e9[_0xd373('0x6c')]][_0xd373('0x31')]=this[_0xd373('0x12')][_0x1f52e9[_0xd373('0x6c')]]['talking']>_[_0xd373('0x70')](_0x1f52e9[_0xd373('0x71')])?_[_0xd373('0x70')](_0x1f52e9['loggedin']):this[_0xd373('0x12')][_0x1f52e9[_0xd373('0x6c')]][_0xd373('0x31')];this[_0xd373('0x73')](this[_0xd373('0x12')][_0x1f52e9[_0xd373('0x6c')]],_0xd373('0x14'));}logger['debug'](_0xd373('0x74'),util[_0xd373('0x3f')](this[_0xd373('0x12')][_0x1f52e9[_0xd373('0x6c')]],{'showHidden':![],'depth':null}));ami[_0xd373('0x47')](_0xd373('0x75'),this[_0xd373('0x12')][_0x1f52e9[_0xd373('0x6c')]]);}}}catch(_0x4fbf72){logger[_0xd373('0x40')]('[voiceQueueReport][queuesummary]',util[_0xd373('0x3f')](_0x4fbf72,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd373('0x36')][_0xd373('0x17')]=function(_0x2a9582){logger[_0xd373('0x4d')](_0xd373('0x76'),util[_0xd373('0x3f')](_0x2a9582,{'showHidden':![],'depth':null}));this[_0xd373('0x67')]=!![];};VoiceQueueReport['prototype'][_0xd373('0x19')]=function(_0x5c5855){try{if(this[_0xd373('0x6a')](_0x5c5855)){logger[_0xd373('0x4d')](_0xd373('0x77'),_0x5c5855[_0xd373('0x4a')],util[_0xd373('0x3f')](_0x5c5855,{'showHidden':![],'depth':null}));if(_[_0xd373('0x63')](this[_0xd373('0xf')][_0x5c5855['uniqueid']])){this[_0xd373('0xf')][_0x5c5855[_0xd373('0x4a')]]=[];this[_0xd373('0x10')][_0x5c5855['uniqueid']]={};}var _0x4035d4=new QueueReport();_0x4035d4[_0xd373('0x4b')]=_0x5c5855[_0xd373('0x6c')];_0x4035d4[_0xd373('0x51')]=this[_0xd373('0x12')][_0x4035d4[_0xd373('0x4b')]]&&this[_0xd373('0x12')][_0x4035d4[_0xd373('0x4b')]][_0xd373('0x51')]?this[_0xd373('0x12')][_0x4035d4[_0xd373('0x4b')]][_0xd373('0x51')]||'inbound':_0xd373('0x52');_0x4035d4[_0xd373('0x6c')]=_0x5c5855[_0xd373('0x6c')];_0x4035d4['queuecallerjoinAt']=moment()[_0xd373('0x61')](_0xd373('0x78'));_0x4035d4[_0xd373('0x79')]=_0x5c5855['position'];_0x4035d4[_0xd373('0x7a')]=_0x5c5855['count'];_0x4035d4[_0xd373('0x4a')]=_0x5c5855[_0xd373('0x4a')];logger[_0xd373('0x7b')](_0xd373('0x7c'),_0x4035d4['name'],_0x4035d4[_0xd373('0x51')]);_['merge'](_0x4035d4,_[_0xd373('0x7d')](_0x5c5855,_[_0xd373('0x7e')](_0x4035d4)));this[_0xd373('0xf')][_0x5c5855[_0xd373('0x4a')]][_0xd373('0x7f')](_0x4035d4);this[_0xd373('0x10')][_0x5c5855['uniqueid']]=_0x4035d4;this[_0xd373('0x48')](_0x4035d4,'queuecallerjoin');}}catch(_0xd456f8){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x5c5855[_0xd373('0x4a')],util[_0xd373('0x3f')](_0xd456f8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd373('0x36')][_0xd373('0x1b')]=function(_0x5a5651){try{if(this['isNotNull'](_0x5a5651)){logger[_0xd373('0x4d')](_0xd373('0x80'),_0x5a5651[_0xd373('0x4a')],util[_0xd373('0x3f')](_0x5a5651,{'showHidden':![],'depth':null}));if(this[_0xd373('0xf')][_0x5a5651[_0xd373('0x4a')]]){var _0x16e708=_[_0xd373('0x81')](this[_0xd373('0xf')][_0x5a5651[_0xd373('0x4a')]]);_0x16e708['queuecallercomplete']=![];_0x16e708[_0xd373('0x82')]=null;_0x16e708[_0xd373('0x83')]=_0x5a5651[_0xd373('0x83')];_0x16e708[_0xd373('0x84')]=_0x5a5651[_0xd373('0x84')];_0x16e708[_0xd373('0x1a')]=!![];_0x16e708[_0xd373('0x85')]=moment()['format'](_0xd373('0x78'));_0x16e708['queuecallerexitreason']='ABANDONED';_0x16e708[_0xd373('0x86')]=null;logger[_0xd373('0x7b')](_0xd373('0x87'),_0x16e708[_0xd373('0x4b')],_0x16e708[_0xd373('0x51')]);this[_0xd373('0x10')][_0x5a5651['uniqueid']]=_0x16e708;this[_0xd373('0x46')](_0x16e708,_0xd373('0x1a'));}}}catch(_0x6114a5){logger['error'](_0xd373('0x80'),_0x5a5651[_0xd373('0x4a')],util[_0xd373('0x3f')](_0x6114a5,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd373('0x1d')]=function(_0x33bebe){try{if(this[_0xd373('0x6a')](_0x33bebe)){logger['debug'](_0xd373('0x88'),_0x33bebe[_0xd373('0x4a')],util[_0xd373('0x3f')](_0x33bebe,{'showHidden':![],'depth':null}));if(this[_0xd373('0xf')][_0x33bebe[_0xd373('0x4a')]]){var _0x3c47c6=_[_0xd373('0x81')](this[_0xd373('0xf')][_0x33bebe[_0xd373('0x4a')]]);_0x3c47c6[_0xd373('0x89')]=moment()[_0xd373('0x61')](_0xd373('0x78'));_0x3c47c6[_0xd373('0x8a')]=_0x33bebe['connectedlinenum'];_0x3c47c6[_0xd373('0x8b')]=_0x33bebe[_0xd373('0x8b')];logger[_0xd373('0x7b')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x3c47c6[_0xd373('0x4b')],_0x3c47c6[_0xd373('0x51')],_0x33bebe['connectedlinenum'],_0x33bebe[_0xd373('0x8b')]);this['channels'][_0x33bebe[_0xd373('0x4a')]]=_0x3c47c6;this[_0xd373('0x48')](_0x3c47c6,_0xd373('0x1c'));}}}catch(_0x3bc47a){logger[_0xd373('0x40')](_0xd373('0x88'),_0x33bebe['uniqueid'],util[_0xd373('0x3f')](_0x3bc47a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd373('0x20')]=function(_0xc56e62){try{if(this[_0xd373('0x6a')](_0xc56e62)){logger[_0xd373('0x4d')](_0xd373('0x8c'),_0xc56e62['uniqueid'],util[_0xd373('0x3f')](_0xc56e62,{'showHidden':![],'depth':null}));if(this[_0xd373('0xf')][_0xc56e62[_0xd373('0x4a')]]){var _0x12ffc0=_[_0xd373('0x81')](this[_0xd373('0xf')][_0xc56e62['uniqueid']]);_0x12ffc0[_0xd373('0x8d')]=!![];_0x12ffc0[_0xd373('0x8e')]=_0xd373('0x8f');logger['info'](_0xd373('0x90'),_0x12ffc0[_0xd373('0x4b')],_0x12ffc0['type']);}}}catch(_0x191fa3){logger['error'](_0xd373('0x8c'),_0xc56e62['uniqueid'],util['inspect'](_0x191fa3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd373('0x36')][_0xd373('0x1e')]=function(_0x212d7a){try{if(this[_0xd373('0x6a')](_0x212d7a)){logger[_0xd373('0x4d')]('[%s][voiceQueueReport][agentcomplete]',_0x212d7a[_0xd373('0x4a')],util['inspect'](_0x212d7a,{'showHidden':![],'depth':null}));if(this[_0xd373('0xf')][_0x212d7a[_0xd373('0x4a')]]){var _0xc8f4e6=_['last'](this[_0xd373('0xf')][_0x212d7a['uniqueid']]);_0xc8f4e6[_0xd373('0x1a')]=![];_0xc8f4e6[_0xd373('0x85')]=null;_0xc8f4e6[_0xd373('0x91')]=!![];_0xc8f4e6[_0xd373('0x86')]=_0x212d7a[_0xd373('0x92')];_0xc8f4e6['holdtime']=_0x212d7a[_0xd373('0x83')];_0xc8f4e6[_0xd373('0x8d')]=!![];_0xc8f4e6[_0xd373('0x93')]=![];_0xc8f4e6[_0xd373('0x94')]=null;if(!_0xc8f4e6[_0xd373('0x95')]){if(_0x212d7a[_0xd373('0x96')]==_0xd373('0x95')){_0xc8f4e6['queuecallerexitreason']=_0xd373('0x97');logger[_0xd373('0x7b')](_0xd373('0x98'),_0xc8f4e6[_0xd373('0x4b')],_0xc8f4e6[_0xd373('0x51')]);}else{if(_[_0xd373('0x99')](_0x212d7a[_0xd373('0x3a')][_0xd373('0x9a')](),_0xd373('0x9b'))){if(this[_0xd373('0xf')][_0x212d7a[_0xd373('0x9c')]]){var _0x40d7e5=_[_0xd373('0x81')](this[_0xd373('0xf')][_0x212d7a[_0xd373('0x9c')]]);_0x40d7e5[_0xd373('0x8d')]=![];_0x40d7e5[_0xd373('0x93')]=!![];_0x40d7e5['queuecallerexitAt']=moment(_0xc8f4e6[_0xd373('0x9d')])[_0xd373('0x9e')](_0x212d7a['holdtime'],'seconds')[_0xd373('0x61')](_0xd373('0x78'));_0x40d7e5['queuecallerexitreason']=_0xd373('0x9f');_0x40d7e5[_0xd373('0x95')]=!![];_0x40d7e5[_0xd373('0xa0')]=_0xd373('0xa1');_0x40d7e5[_0xd373('0xa2')]=_0x212d7a[_0xd373('0xa3')];_0x40d7e5[_0xd373('0xa4')]=_0x212d7a[_0xd373('0x4a')];logger[_0xd373('0x7b')](_0xd373('0xa5'),_0x40d7e5[_0xd373('0x4b')],_0x40d7e5['type']);var _0x4e8b06=this[_0xd373('0xf')][_0x212d7a[_0xd373('0x9c')]];this['queueReports'][_0x212d7a[_0xd373('0x9c')]]=this[_0xd373('0xf')][_0x212d7a[_0xd373('0x4a')]];this[_0xd373('0xf')][_0x212d7a[_0xd373('0x4a')]]=_0x4e8b06;}}else{_0xc8f4e6[_0xd373('0x8e')]='COMPLETEDBY'+_0x212d7a[_0xd373('0x96')][_0xd373('0xa6')]();logger[_0xd373('0x7b')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0xc8f4e6[_0xd373('0x4b')],_0xc8f4e6[_0xd373('0x51')],_0xc8f4e6[_0xd373('0x8e')]);}}}this['channels'][_0x212d7a[_0xd373('0x4a')]]=_0xc8f4e6;this[_0xd373('0x46')](_0xc8f4e6,'agentcomplete');}}}catch(_0xa9b233){logger[_0xd373('0x40')]('[%s][voiceQueueReport][agentcomplete]',_0x212d7a[_0xd373('0x4a')],util['inspect'](_0xa9b233,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd373('0x36')][_0xd373('0xa7')]=function(_0x3b6ba5){try{if(this['isNotNull'](_0x3b6ba5)){logger['debug']('[%s][voiceQueueReport][varset]',_0x3b6ba5[_0xd373('0x4a')],util['inspect'](_0x3b6ba5,{'showHidden':![],'depth':null}));this[_0xd373('0xa8')](_0x3b6ba5[_0xd373('0x4a')],_['keys'](_0x3b6ba5[_0xd373('0xa9')])[0x0],_0x3b6ba5['value']);if(this[_0xd373('0xf')][_0x3b6ba5[_0xd373('0x4a')]]){var _0x15eb3d=_[_0xd373('0x81')](this[_0xd373('0xf')][_0x3b6ba5[_0xd373('0x4a')]]);if(_0x15eb3d){if(this['isNotNull'](_0x3b6ba5[_0xd373('0xa9')])&&this['isNotNull'](_0x3b6ba5[_0xd373('0xa9')][_0xd373('0xaa')])){switch(_0x3b6ba5[_0xd373('0xab')]){case _0xd373('0xac'):_0x15eb3d[_0xd373('0x93')]=![];_0x15eb3d[_0xd373('0x94')]=null;break;case'TIMEOUT':_0x15eb3d[_0xd373('0xad')]=_0xd373('0xae');_0x15eb3d[_0xd373('0x93')]=!![];_0x15eb3d['queuecallerexitAt']=moment()[_0xd373('0x61')](_0xd373('0x78'));_0x15eb3d[_0xd373('0x89')]=moment()[_0xd373('0x61')](_0xd373('0x78'));logger[_0xd373('0x4d')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x3b6ba5[_0xd373('0x4a')],util['inspect'](_0x15eb3d,{'showHidden':![],'depth':null}));ami[_0xd373('0x47')](_0xd373('0xaf'),_0x15eb3d);break;default:_0x15eb3d[_0xd373('0x93')]=!![];_0x15eb3d[_0xd373('0x94')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x15eb3d[_0xd373('0x89')]=moment()[_0xd373('0x61')](_0xd373('0x78'));}_0x15eb3d[_0xd373('0x1a')]=![];_0x15eb3d[_0xd373('0x85')]=null;_0x15eb3d[_0xd373('0x8e')]=_0x3b6ba5['value'];this[_0xd373('0x10')][_0x3b6ba5[_0xd373('0x4a')]]=_0x15eb3d;this['emitVoiceQueueChannelRemove'](_0x15eb3d,_0xd373('0x21'));}else if(this[_0xd373('0x6a')](_0x3b6ba5[_0xd373('0xa9')])&&this['isNotNull'](_0x3b6ba5[_0xd373('0xa9')][_0xd373('0xb0')])){if(!_0x15eb3d['queuecallerabandon']){_0x15eb3d['queuecallerexit']=!![];_0x15eb3d[_0xd373('0x94')]=moment()[_0xd373('0x61')](_0xd373('0x78'));_0x15eb3d[_0xd373('0x8e')]=_0xd373('0xb1');_0x15eb3d[_0xd373('0x89')]=moment()[_0xd373('0x61')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xd373('0x10')][_0x3b6ba5[_0xd373('0x4a')]]=_0x15eb3d;}}logger[_0xd373('0x7b')](_0xd373('0xb2'),_0x3b6ba5[_0xd373('0x4a')],_0x15eb3d['name'],_0x15eb3d[_0xd373('0x51')],_[_0xd373('0x7e')](_0x3b6ba5['variable'])[0x0],_0x3b6ba5[_0xd373('0xab')]);_0x15eb3d['variables']=this[_0xd373('0x13')][_0x3b6ba5[_0xd373('0x4a')]];}}}}catch(_0x1816a7){logger[_0xd373('0x40')](_0xd373('0xb3'),_0x3b6ba5[_0xd373('0x4a')],util[_0xd373('0x3f')](_0x1816a7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd373('0x36')]['addVariable']=function(_0x3f98d4,_0x4384f0,_0x13b085){var _0x34e385=[_0xd373('0xb4'),_0xd373('0xb5'),'rtpaudioqosjitter',_0xd373('0xb6'),_0xd373('0xb7'),_0xd373('0xb8'),_0xd373('0xb9'),_0xd373('0xba'),_0xd373('0xbb'),_0xd373('0xbc'),_0xd373('0xbd'),_0xd373('0xbe'),'membercalls',_0xd373('0xbf'),_0xd373('0xc0'),_0xd373('0xc1'),'membername',_0xd373('0xc2'),'memberrealtime'];if(!_['isNil'](_0x4384f0)&&!_[_0xd373('0xc3')](_0x34e385,_0x4384f0)){if(_['isUndefined'](this[_0xd373('0x13')][_0x3f98d4])){this['variables'][_0x3f98d4]={};}this['variables'][_0x3f98d4][_0x4384f0]=_0x13b085;}};VoiceQueueReport['prototype']['syncHangup']=function(_0x4934ac){try{if(this[_0xd373('0x6a')](_0x4934ac)){logger[_0xd373('0x4d')](_0xd373('0xc4'),_0x4934ac[_0xd373('0x4a')],util['inspect'](_0x4934ac,{'showHidden':![],'depth':null}));if(this[_0xd373('0xf')][_0x4934ac[_0xd373('0x4a')]]){for(var _0x39cfbf=0x0,_0x1ad6e7={};_0x39cfbf=0x0?moment(_0x14abb1[_0x695e('0x16')])[_0x695e('0x14')](_0x14abb1[_0x695e('0x15')],'seconds'):null,'data1':_0x695e('0x17'),'data2':_0x14abb1[_0x695e('0x10')],'data3':_0x14abb1[_0x695e('0xd')],'data4':_0x14abb1[_0x695e('0x18')]||null,'role':_0x695e('0xf'),'internal':_0x14abb1[_0x695e('0x10')]?_[_0x695e('0x11')](_0x14abb1[_0x695e('0x10')]):undefined,'uniqueid':_0x14abb1[_0x695e('0x12')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x6449=['uniqueid','moment','lodash','util','voiceQueueReport','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','voiceDialReport','membername','endtime','starttime','dialstring'];(function(_0x3640e4,_0x502913){var _0x36d2ed=function(_0x537a31){while(--_0x537a31){_0x3640e4['push'](_0x3640e4['shift']());}};_0x36d2ed(++_0x502913);}(_0x6449,0x79));var _0x9644=function(_0x5b7788,_0x309ae5){_0x5b7788=_0x5b7788-0x0;var _0x573871=_0x6449[_0x5b7788];return _0x573871;};'use strict';var moment=require(_0x9644('0x0'));var _=require(_0x9644('0x1'));var util=require(_0x9644('0x2'));var client=require('../client');exports[_0x9644('0x3')]=function(_0x436589){var _0x2e41e6=_0x436589['queuecallercompleteAt']||_0x436589[_0x9644('0x4')];return client[_0x9644('0x5')](_0x9644('0x6'),{'body':{'channel':_0x9644('0x7'),'membername':_0x436589[_0x9644('0x8')],'interface':_[_0x9644('0x9')](_0x436589[_0x9644('0xa')])?util[_0x9644('0xb')](_0x9644('0xc'),_0x436589[_0x9644('0x8')]):_0x436589[_0x9644('0xa')],'type':_0x9644('0xd'),'enterAt':_0x436589[_0x9644('0xe')],'exitAt':_0x2e41e6,'duration':moment(_0x2e41e6)[_0x9644('0xf')](_0x436589[_0x9644('0xe')],_0x9644('0x10')),'data1':_0x9644('0x11'),'data2':_0x436589[_0x9644('0x12')],'data3':_0x436589[_0x9644('0x13')],'data4':null,'data5':_0x436589[_0x9644('0x14')],'role':_0x9644('0x15'),'internal':_0x436589[_0x9644('0x16')]?_[_0x9644('0x17')](_0x436589['accountcode']):undefined,'uniqueid':_0x436589['uniqueid']},'log':_0x9644('0x6')});};exports[_0x9644('0x18')]=function(_0x1cd966){return client[_0x9644('0x5')](_0x9644('0x6'),{'body':{'channel':_0x9644('0x7'),'membername':_0x1cd966[_0x9644('0x19')],'interface':_0x1cd966[_0x9644('0xa')],'type':_0x9644('0xd'),'enterAt':_0x1cd966['starttime'],'exitAt':_0x1cd966[_0x9644('0x1a')],'duration':moment(_0x1cd966[_0x9644('0x1a')])[_0x9644('0xf')](_0x1cd966['starttime'],_0x9644('0x10'))>=0x0?moment(_0x1cd966[_0x9644('0x1a')])[_0x9644('0xf')](_0x1cd966[_0x9644('0x1b')],_0x9644('0x10')):null,'data1':'outbound','data2':_0x1cd966[_0x9644('0x16')],'data3':_0x1cd966[_0x9644('0x13')],'data4':_0x1cd966[_0x9644('0x1c')]||null,'role':_0x9644('0x15'),'internal':_0x1cd966[_0x9644('0x16')]?_[_0x9644('0x17')](_0x1cd966[_0x9644('0x16')]):undefined,'uniqueid':_0x1cd966[_0x9644('0x1d')]},'log':_0x9644('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 640da8f..95357e5 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 _0x9f4d=['name','html','../client','getTemplates','Request','GetTemplate'];(function(_0x4f4d19,_0x574245){var _0x27a258=function(_0x38da3e){while(--_0x38da3e){_0x4f4d19['push'](_0x4f4d19['shift']());}};_0x27a258(++_0x574245);}(_0x9f4d,0xb0));var _0xd9f4=function(_0x31f207,_0x33353a){_0x31f207=_0x31f207-0x0;var _0x1089ef=_0x9f4d[_0x31f207];return _0x1089ef;};'use strict';var client=require(_0xd9f4('0x0'));exports[_0xd9f4('0x1')]=function(_0x34f803){return function(_0xd40ae2){return client[_0xd9f4('0x2')](_0xd9f4('0x3'),{'options':{'raw':!![],'attributes':['id',_0xd9f4('0x4'),_0xd9f4('0x5')]},'log':_0xd9f4('0x3')});};}; \ No newline at end of file +var _0x58a4=['getTemplates','Request','GetTemplate','name','html','../client'];(function(_0x4896c4,_0x34ef36){var _0x2d9312=function(_0x548620){while(--_0x548620){_0x4896c4['push'](_0x4896c4['shift']());}};_0x2d9312(++_0x34ef36);}(_0x58a4,0xbf));var _0x458a=function(_0x470615,_0x1c7aaa){_0x470615=_0x470615-0x0;var _0x189c81=_0x58a4[_0x470615];return _0x189c81;};'use strict';var client=require(_0x458a('0x0'));exports[_0x458a('0x1')]=function(_0x4043ce){return function(_0x1e23ea){return client[_0x458a('0x2')](_0x458a('0x3'),{'options':{'raw':!![],'attributes':['id',_0x458a('0x4'),_0x458a('0x5')]},'log':_0x458a('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index a0f1386..ed86a7c 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 _0x1310=['data4','data5','data6','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','operator','value','AnyConditions','field','Action','Actions','action','data1','data2'];(function(_0x4cf6d1,_0x2ca6d7){var _0x537c9e=function(_0x4c3f18){while(--_0x4c3f18){_0x4cf6d1['push'](_0x4cf6d1['shift']());}};_0x537c9e(++_0x2ca6d7);}(_0x1310,0x67));var _0x0131=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1310[_0x321bb2];return _0x9c12ed;};'use strict';var client=require('../client');exports[_0x0131('0x0')]=function(_0x4ba919){return function(_0xff93b0){return client[_0x0131('0x1')](_0x0131('0x2'),{'options':{'raw':![],'attributes':['id',_0x0131('0x3'),_0x0131('0x4'),_0x0131('0x5')],'include':[{'model':_0x0131('0x6'),'as':_0x0131('0x7'),'attributes':['id','field',_0x0131('0x8'),_0x0131('0x9')]},{'model':'Condition','as':_0x0131('0xa'),'attributes':['id',_0x0131('0xb'),_0x0131('0x8'),_0x0131('0x9')]},{'model':_0x0131('0xc'),'as':_0x0131('0xd'),'attributes':['id',_0x0131('0xe'),_0x0131('0xf'),_0x0131('0x10'),'data3',_0x0131('0x11'),_0x0131('0x12'),_0x0131('0x13'),'data7']}]},'log':_0x0131('0x2')});};}; \ No newline at end of file +var _0x96d4=['operator','value','data1','data2','data3','data4','data5','data6','data7','../client','getTriggers','Request','name','status','Condition','AllConditions','field'];(function(_0x226f1d,_0x2f09f4){var _0x386700=function(_0x22d35f){while(--_0x22d35f){_0x226f1d['push'](_0x226f1d['shift']());}};_0x386700(++_0x2f09f4);}(_0x96d4,0x108));var _0x496d=function(_0xcfb094,_0x3e6258){_0xcfb094=_0xcfb094-0x0;var _0x158a5e=_0x96d4[_0xcfb094];return _0x158a5e;};'use strict';var client=require(_0x496d('0x0'));exports[_0x496d('0x1')]=function(_0x57e1a3){return function(_0x2add8c){return client[_0x496d('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x496d('0x3'),'channel',_0x496d('0x4')],'include':[{'model':_0x496d('0x5'),'as':_0x496d('0x6'),'attributes':['id',_0x496d('0x7'),_0x496d('0x8'),_0x496d('0x9')]},{'model':'Condition','as':'AnyConditions','attributes':['id',_0x496d('0x7'),_0x496d('0x8'),_0x496d('0x9')]},{'model':'Action','as':'Actions','attributes':['id','action',_0x496d('0xa'),_0x496d('0xb'),_0x496d('0xc'),_0x496d('0xd'),_0x496d('0xe'),_0x496d('0xf'),_0x496d('0x10')]}]},'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 925ac8f..43867a0 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 _0xf507=['getTrunks','registry','../client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf507,0x80));var _0x7f50=function(_0x4f6262,_0x57c45e){_0x4f6262=_0x4f6262-0x0;var _0x539458=_0xf507[_0x4f6262];return _0x539458;};'use strict';var client=require(_0x7f50('0x0'));exports[_0x7f50('0x1')]=function(_0x1c3588){return function(_0x1bac40){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x7f50('0x2')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x8367=['../client','Request','GetTrunk','name','registry'];(function(_0x344eac,_0x3a5e6a){var _0x11a4f5=function(_0x1b4ad0){while(--_0x1b4ad0){_0x344eac['push'](_0x344eac['shift']());}};_0x11a4f5(++_0x3a5e6a);}(_0x8367,0x1ae));var _0x7836=function(_0xa8d025,_0x3a5cbe){_0xa8d025=_0xa8d025-0x0;var _0x29e44e=_0x8367[_0xa8d025];return _0x29e44e;};'use strict';var client=require(_0x7836('0x0'));exports['getTrunks']=function(_0xc33e9){return function(_0x23b0cf){return client[_0x7836('0x1')](_0x7836('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x7836('0x3'),_0x7836('0x4')]},'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 a3a8e82..f867232 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 _0x6a16=['mobile','interface','telephone','internal','savePause','saveUnpause','getAgent','email','../client','Request','GetUser','agent','name','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone'];(function(_0x30c2ae,_0x4c98a2){var _0x1ee1cc=function(_0x165922){while(--_0x165922){_0x30c2ae['push'](_0x30c2ae['shift']());}};_0x1ee1cc(++_0x4c98a2);}(_0x6a16,0x9b));var _0x66a1=function(_0x56d148,_0x4f23da){_0x56d148=_0x56d148-0x0;var _0x838dd5=_0x6a16[_0x56d148];return _0x838dd5;};'use strict';var client=require(_0x66a1('0x0'));exports['getAgents']=function(){return function(){return client[_0x66a1('0x1')](_0x66a1('0x2'),{'options':{'raw':![],'where':{'role':_0x66a1('0x3')},'attributes':['id',_0x66a1('0x4'),'email',_0x66a1('0x5'),_0x66a1('0x6'),_0x66a1('0x7'),_0x66a1('0x8'),_0x66a1('0x9'),_0x66a1('0xa'),_0x66a1('0xb'),_0x66a1('0xc'),_0x66a1('0xd'),_0x66a1('0xe')]},'log':'getAgents'});};};exports['getTelephones']=function(){return function(){return client[_0x66a1('0x1')](_0x66a1('0x2'),{'options':{'raw':!![],'where':{'role':_0x66a1('0xf')},'attributes':['id','name',_0x66a1('0x5'),_0x66a1('0x10')]},'log':'getTelephones'});};};exports[_0x66a1('0x11')]=function(_0x5f20db,_0x5cb4ba,_0x1ea662){return client[_0x66a1('0x1')]('PauseUser',{'body':{'type':_0x5cb4ba,'uniqueid':_0x1ea662},'options':{'where':{'id':_0x5f20db['id']}},'log':'savePause'});};exports[_0x66a1('0x12')]=function(_0x5e5309){return client[_0x66a1('0x1')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5e5309['id']}},'log':_0x66a1('0x11')});};exports[_0x66a1('0x13')]=function(_0x12a968){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x66a1('0x3'),'id':_0x12a968},'attributes':['id','name',_0x66a1('0x14'),'accountcode',_0x66a1('0x6'),_0x66a1('0x7'),_0x66a1('0x8'),_0x66a1('0x9'),_0x66a1('0xa'),_0x66a1('0xb'),_0x66a1('0xe')]},'log':'getAgent'});}; \ No newline at end of file +var _0xc7dc=['lastLoginAt','pauseType','lastPauseAt','voicePause','phone','interface','getAgents','getTelephones','telephone','savePause','PauseUser','saveUnpause','agent','email','getAgent','../client','Request','GetUser','name','accountcode','fullname','online'];(function(_0x197ed0,_0x4d2080){var _0x380e72=function(_0x3f5a36){while(--_0x3f5a36){_0x197ed0['push'](_0x197ed0['shift']());}};_0x380e72(++_0x4d2080);}(_0xc7dc,0xeb));var _0xcc7d=function(_0x3b5a4a,_0x4096e5){_0x3b5a4a=_0x3b5a4a-0x0;var _0xaaec44=_0xc7dc[_0x3b5a4a];return _0xaaec44;};'use strict';var client=require(_0xcc7d('0x0'));exports['getAgents']=function(){return function(){return client[_0xcc7d('0x1')](_0xcc7d('0x2'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0xcc7d('0x3'),'email',_0xcc7d('0x4'),_0xcc7d('0x5'),_0xcc7d('0x6'),_0xcc7d('0x7'),_0xcc7d('0x8'),_0xcc7d('0x9'),_0xcc7d('0xa'),_0xcc7d('0xb'),'mobile',_0xcc7d('0xc')]},'log':_0xcc7d('0xd')});};};exports[_0xcc7d('0xe')]=function(){return function(){return client[_0xcc7d('0x1')](_0xcc7d('0x2'),{'options':{'raw':!![],'where':{'role':_0xcc7d('0xf')},'attributes':['id',_0xcc7d('0x3'),'accountcode','internal']},'log':_0xcc7d('0xe')});};};exports[_0xcc7d('0x10')]=function(_0x21b3ba,_0x4263f1,_0x4bc36e){return client[_0xcc7d('0x1')](_0xcc7d('0x11'),{'body':{'type':_0x4263f1,'uniqueid':_0x4bc36e},'options':{'where':{'id':_0x21b3ba['id']}},'log':'savePause'});};exports[_0xcc7d('0x12')]=function(_0x4db744){return client[_0xcc7d('0x1')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x4db744['id']}},'log':'savePause'});};exports['getAgent']=function(_0x4dcc2e){return client[_0xcc7d('0x1')]('ShowUser',{'options':{'raw':![],'where':{'role':_0xcc7d('0x13'),'id':_0x4dcc2e},'attributes':['id',_0xcc7d('0x3'),_0xcc7d('0x14'),_0xcc7d('0x4'),_0xcc7d('0x5'),'online','lastLoginAt',_0xcc7d('0x8'),_0xcc7d('0x9'),_0xcc7d('0xa'),_0xcc7d('0xc')]},'log':_0xcc7d('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 6a3d0cf..e139165 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 _0xda33=['create','CreateVoiceAgentReport','Request','UpdateVoiceAgentReport','../client'];(function(_0x57d4b2,_0x43236a){var _0x57fc1c=function(_0x348421){while(--_0x348421){_0x57d4b2['push'](_0x57d4b2['shift']());}};_0x57fc1c(++_0x43236a);}(_0xda33,0x1b7));var _0x3da3=function(_0x2ed3a1,_0x164168){_0x2ed3a1=_0x2ed3a1-0x0;var _0x5396b5=_0xda33[_0x2ed3a1];return _0x5396b5;};'use strict';var client=require(_0x3da3('0x0'));exports[_0x3da3('0x1')]=function(_0x321000){return client['Request'](_0x3da3('0x2'),{'body':_0x321000,'log':_0x3da3('0x2')});};exports['update']=function(_0x1664de,_0x98339d,_0x24501d){return client[_0x3da3('0x3')](_0x3da3('0x4'),{'body':_0x1664de,'options':{'where':{'uniqueid':_0x98339d,'interface':_0x24501d,'agentcomplete':!![]}},'log':_0x3da3('0x4')});}; \ No newline at end of file +var _0x85b5=['CreateVoiceAgentReport','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x5d6052,_0x1be6e9){var _0x28743f=function(_0x3f00af){while(--_0x3f00af){_0x5d6052['push'](_0x5d6052['shift']());}};_0x28743f(++_0x1be6e9);}(_0x85b5,0x7f));var _0x585b=function(_0x1c5bee,_0x232ef4){_0x1c5bee=_0x1c5bee-0x0;var _0x52c6f0=_0x85b5[_0x1c5bee];return _0x52c6f0;};'use strict';var client=require(_0x585b('0x0'));exports[_0x585b('0x1')]=function(_0x4df8b9){return client[_0x585b('0x2')]('CreateVoiceAgentReport',{'body':_0x4df8b9,'log':_0x585b('0x3')});};exports['update']=function(_0x4d5064,_0x331fe8,_0x4f37a9){return client[_0x585b('0x2')](_0x585b('0x4'),{'body':_0x4d5064,'options':{'where':{'uniqueid':_0x331fe8,'interface':_0x4f37a9,'agentcomplete':!![]}},'log':_0x585b('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 0a4fb21..c71ec2d 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 _0x05a2=['outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','calleridnum','context','DOCUMENTATION','getVoiceCallReports'];(function(_0x58547b,_0x4b89c2){var _0x1d3fd2=function(_0x4ac500){while(--_0x4ac500){_0x58547b['push'](_0x58547b['shift']());}};_0x1d3fd2(++_0x4b89c2);}(_0x05a2,0x112));var _0x205a=function(_0x510749,_0x11ea16){_0x510749=_0x510749-0x0;var _0x582f17=_0x05a2[_0x510749];return _0x582f17;};'use strict';var moment=require(_0x205a('0x0'));var util=require(_0x205a('0x1'));var _=require(_0x205a('0x2'));var client=require(_0x205a('0x3'));exports[_0x205a('0x4')]=function(_0x244eaa){return client[_0x205a('0x5')](_0x205a('0x6'),{'body':_['merge'](_0x244eaa,{'source':_0x244eaa[_0x205a('0x7')],'destinationcontext':_0x244eaa[_0x205a('0x8')],'callerid':_0x244eaa['callerid'],'amaflags':_0x205a('0x9')}),'log':_0x205a('0x6')});};exports[_0x205a('0xa')]=function(){return function(){return client[_0x205a('0x5')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x205a('0xb')],'createdAt':{'$between':[moment()['startOf'](_0x205a('0xc'))[_0x205a('0xd')](_0x205a('0xe')),moment()[_0x205a('0xf')](_0x205a('0xc'))['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x205a('0x10'),'disposition','duration',_0x205a('0x11')]},'log':_0x205a('0x12')});};}; \ No newline at end of file +var _0x4509=['moment','util','lodash','Request','CreateVoiceCallReport','merge','callerid','DOCUMENTATION','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration','billableseconds'];(function(_0x4bf7f2,_0x123a78){var _0x329e1b=function(_0x1a74b2){while(--_0x1a74b2){_0x4bf7f2['push'](_0x4bf7f2['shift']());}};_0x329e1b(++_0x123a78);}(_0x4509,0x170));var _0x9450=function(_0x245e9c,_0xeab8e9){_0x245e9c=_0x245e9c-0x0;var _0x358ccf=_0x4509[_0x245e9c];return _0x358ccf;};'use strict';var moment=require(_0x9450('0x0'));var util=require(_0x9450('0x1'));var _=require(_0x9450('0x2'));var client=require('../client');exports['create']=function(_0x394bf0){return client[_0x9450('0x3')](_0x9450('0x4'),{'body':_[_0x9450('0x5')](_0x394bf0,{'source':_0x394bf0['calleridnum'],'destinationcontext':_0x394bf0['context'],'callerid':_0x394bf0[_0x9450('0x6')],'amaflags':_0x9450('0x7')}),'log':_0x9450('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x9450('0x3')]('GetVoiceCallReport',{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x9450('0x8')](_0x9450('0x9'))[_0x9450('0xa')](_0x9450('0xb')),moment()[_0x9450('0xc')](_0x9450('0x9'))[_0x9450('0xa')](_0x9450('0xb'))]}},'attributes':['type',_0x9450('0xd'),_0x9450('0xe'),_0x9450('0xf')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index ce9a91e..327690a 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 _0x6c1b=['Request','CreateVoiceDialReport'];(function(_0x115554,_0x23229b){var _0x17b479=function(_0x2d6280){while(--_0x2d6280){_0x115554['push'](_0x115554['shift']());}};_0x17b479(++_0x23229b);}(_0x6c1b,0x1da));var _0xb6c1=function(_0x2a76fb,_0x2405e2){_0x2a76fb=_0x2a76fb-0x0;var _0x5781c7=_0x6c1b[_0x2a76fb];return _0x5781c7;};'use strict';var client=require('../client');exports['create']=function(_0x183613){return client[_0xb6c1('0x0')]('CreateVoiceDialReport',{'body':_0x183613,'log':_0xb6c1('0x1')});}; \ No newline at end of file +var _0xbe6d=['CreateVoiceDialReport','../client','create','Request'];(function(_0x171033,_0x2e022d){var _0x79ee76=function(_0x500e5c){while(--_0x500e5c){_0x171033['push'](_0x171033['shift']());}};_0x79ee76(++_0x2e022d);}(_0xbe6d,0xc9));var _0xdbe6=function(_0x268857,_0x58a836){_0x268857=_0x268857-0x0;var _0x21b1a2=_0xbe6d[_0x268857];return _0x21b1a2;};'use strict';var client=require(_0xdbe6('0x0'));exports[_0xdbe6('0x1')]=function(_0x572a7e){return client[_0xdbe6('0x2')](_0xdbe6('0x3'),{'body':_0x572a7e,'log':_0xdbe6('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index b883dbb..7da5aad 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 _0x063e=['GetVoiceExtension','exten','recordingFormat','../client','getVoiceExtensions','Request'];(function(_0x320b8e,_0x1da3fe){var _0x55a10a=function(_0x148a56){while(--_0x148a56){_0x320b8e['push'](_0x320b8e['shift']());}};_0x55a10a(++_0x1da3fe);}(_0x063e,0x111));var _0xe063=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x063e[_0x4fde08];return _0x12e725;};'use strict';var client=require(_0xe063('0x0'));exports[_0xe063('0x1')]=function(){return function(){return client[_0xe063('0x2')](_0xe063('0x3'),{'options':{'raw':!![],'attributes':['id',_0xe063('0x4'),_0xe063('0x5')],'where':{'VoiceExtensionId':null}},'log':_0xe063('0x1')});};}; \ No newline at end of file +var _0x9649=['../client','getVoiceExtensions','GetVoiceExtension','exten','recordingFormat'];(function(_0x559084,_0x10053f){var _0x29e0f6=function(_0x3d4f34){while(--_0x3d4f34){_0x559084['push'](_0x559084['shift']());}};_0x29e0f6(++_0x10053f);}(_0x9649,0x118));var _0x9964=function(_0x218d4d,_0x10cc35){_0x218d4d=_0x218d4d-0x0;var _0x466019=_0x9649[_0x218d4d];return _0x466019;};'use strict';var client=require(_0x9964('0x0'));exports[_0x9964('0x1')]=function(){return function(){return client['Request'](_0x9964('0x2'),{'options':{'raw':!![],'attributes':['id',_0x9964('0x3'),_0x9964('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 6df57cf..1626650 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 _0xd19e=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','callerid','Pause','TrunkBackup','active','Interval','Intervals','interval','getVoiceQueues','../client','Request','name','acw','autopause','type','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x4de5ce,_0x2bd38a){var _0xed634a=function(_0x3eb2b8){while(--_0x3eb2b8){_0x4de5ce['push'](_0x4de5ce['shift']());}};_0xed634a(++_0x2bd38a);}(_0xd19e,0xc3));var _0xed19=function(_0x3be70e,_0xcaf8e){_0x3be70e=_0x3be70e-0x0;var _0x34fb6c=_0xd19e[_0x3be70e];return _0x34fb6c;};'use strict';var client=require(_0xed19('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0xed19('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0xed19('0x2'),_0xed19('0x3'),'acwTimeout',_0xed19('0x4'),'monitor_format',_0xed19('0x5'),_0xed19('0x6'),'dialMethod',_0xed19('0x7'),_0xed19('0x8'),_0xed19('0x9'),'dialPredictiveOptimization',_0xed19('0xa'),'dialPredictiveInterval',_0xed19('0xb'),'dialOriginateCallerIdNumber',_0xed19('0xc'),_0xed19('0xd'),_0xed19('0xe'),_0xed19('0xf'),_0xed19('0x10'),_0xed19('0x11'),_0xed19('0x12'),_0xed19('0x13'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency',_0xed19('0x14'),_0xed19('0x15'),_0xed19('0x16'),_0xed19('0x17'),_0xed19('0x18'),'dialAMDActive',_0xed19('0x19'),_0xed19('0x1a'),_0xed19('0x1b'),_0xed19('0x1c'),'dialAMDMinWordLength',_0xed19('0x1d'),'dialAMDMaximumNumberOfWords',_0xed19('0x1e'),_0xed19('0x1f'),_0xed19('0x20'),_0xed19('0x21'),_0xed19('0x22'),_0xed19('0x23'),_0xed19('0x24'),_0xed19('0x25'),_0xed19('0x26'),'monitor_format','strategy',_0xed19('0x27'),_0xed19('0x28'),'dialNoSuchNumberMaxRetry',_0xed19('0x29'),'dialDropMaxRetry',_0xed19('0x2a'),_0xed19('0x2b'),_0xed19('0x2c'),_0xed19('0x2d'),_0xed19('0x2e'),_0xed19('0x2f'),_0xed19('0x30'),_0xed19('0x31'),_0xed19('0x32'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':'Trunk','as':_0xed19('0x33'),'attributes':['id',_0xed19('0x2'),_0xed19('0x34'),'active']},{'model':_0xed19('0x35'),'as':'mandatoryDispositionPause','attributes':['id',_0xed19('0x2')]},{'model':_0xed19('0x33'),'as':_0xed19('0x36'),'attributes':['id',_0xed19('0x2'),_0xed19('0x34'),_0xed19('0x37')]},{'model':_0xed19('0x38'),'as':_0xed19('0x38'),'attributes':['id',_0xed19('0x2')],'include':[{'model':_0xed19('0x38'),'as':_0xed19('0x39'),'attributes':['id','name',_0xed19('0x3a')]}]}]},'log':_0xed19('0x3b')});};}; \ No newline at end of file +var _0xdbb1=['dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','mandatoryDispositionPause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','type','dialActive'];(function(_0x460740,_0x428a68){var _0x51bba1=function(_0x485c99){while(--_0x485c99){_0x460740['push'](_0x460740['shift']());}};_0x51bba1(++_0x428a68);}(_0xdbb1,0xb3));var _0x1dbb=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xdbb1[_0x33032e];return _0x13316b;};'use strict';var client=require(_0x1dbb('0x0'));exports[_0x1dbb('0x1')]=function(){return function(){return client[_0x1dbb('0x2')](_0x1dbb('0x3'),{'options':{'raw':![],'attributes':['id',_0x1dbb('0x4'),'acw',_0x1dbb('0x5'),_0x1dbb('0x6'),_0x1dbb('0x7'),_0x1dbb('0x8'),_0x1dbb('0x9'),_0x1dbb('0xa'),_0x1dbb('0xb'),_0x1dbb('0xc'),'dialPowerLevel',_0x1dbb('0xd'),_0x1dbb('0xe'),_0x1dbb('0xf'),_0x1dbb('0x10'),_0x1dbb('0x11'),'dialOriginateTimeout',_0x1dbb('0x12'),'dialQueueTimeout','dialQueueProject',_0x1dbb('0x13'),_0x1dbb('0x14'),_0x1dbb('0x15'),_0x1dbb('0x16'),_0x1dbb('0x17'),_0x1dbb('0x18'),_0x1dbb('0x19'),_0x1dbb('0x1a'),_0x1dbb('0x1b'),_0x1dbb('0x1c'),_0x1dbb('0x1d'),'dialAMDActive',_0x1dbb('0x1e'),_0x1dbb('0x1f'),_0x1dbb('0x20'),_0x1dbb('0x21'),_0x1dbb('0x22'),_0x1dbb('0x23'),_0x1dbb('0x24'),_0x1dbb('0x25'),'dialAMDMaximumWordLength','timeout',_0x1dbb('0x26'),'dialRecallInQueue',_0x1dbb('0x27'),'dialAgiAfterHangupAgent',_0x1dbb('0x28'),'dialQueueProject2',_0x1dbb('0x7'),_0x1dbb('0x29'),_0x1dbb('0x2a'),_0x1dbb('0x2b'),_0x1dbb('0x2c'),_0x1dbb('0x2d'),_0x1dbb('0x2e'),_0x1dbb('0x2f'),_0x1dbb('0x30'),_0x1dbb('0x31'),_0x1dbb('0x32'),_0x1dbb('0x33'),_0x1dbb('0x34'),_0x1dbb('0x35'),'mandatoryDisposition',_0x1dbb('0x36'),_0x1dbb('0x37')],'include':[{'model':_0x1dbb('0x38'),'as':_0x1dbb('0x38'),'attributes':['id',_0x1dbb('0x4'),_0x1dbb('0x39'),_0x1dbb('0x3a')]},{'model':'Pause','as':_0x1dbb('0x3b'),'attributes':['id',_0x1dbb('0x4')]},{'model':_0x1dbb('0x38'),'as':_0x1dbb('0x3c'),'attributes':['id',_0x1dbb('0x4'),_0x1dbb('0x39'),_0x1dbb('0x3a')]},{'model':_0x1dbb('0x3d'),'as':_0x1dbb('0x3d'),'attributes':['id',_0x1dbb('0x4')],'include':[{'model':_0x1dbb('0x3d'),'as':'Intervals','attributes':['id',_0x1dbb('0x4'),_0x1dbb('0x3e')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 387faf4..8378328 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 _0x2cad=['queuecallercompleteAt','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','day','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2cad,0x181));var _0xd2ca=function(_0x459b74,_0x5773bd){_0x459b74=_0x459b74-0x0;var _0x46cb16=_0x2cad[_0x459b74];return _0x46cb16;};'use strict';var moment=require('moment');var _=require(_0xd2ca('0x0'));var client=require(_0xd2ca('0x1'));exports[_0xd2ca('0x2')]=function(_0x5e770f){return client[_0xd2ca('0x3')](_0xd2ca('0x4'),{'body':_0x5e770f,'log':_0xd2ca('0x4')});};exports[_0xd2ca('0x5')]=function(){return function(){return client[_0xd2ca('0x3')](_0xd2ca('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0xd2ca('0x7'))[_0xd2ca('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0xd2ca('0x7'))[_0xd2ca('0x8')](_0xd2ca('0x9'))]}},'attributes':[_0xd2ca('0xa'),_0xd2ca('0xb'),_0xd2ca('0xc'),_0xd2ca('0xd'),_0xd2ca('0xe'),_0xd2ca('0xf'),'queuecallerexit',_0xd2ca('0x10'),_0xd2ca('0x11'),_0xd2ca('0x12')]},'log':_0xd2ca('0x13')});};}; \ No newline at end of file +var _0xb044=['getVoiceQueueReports','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','lodash','create','Request','CreateVoiceQueueReport'];(function(_0x4ec612,_0x57dfd6){var _0x52a015=function(_0x2771d1){while(--_0x2771d1){_0x4ec612['push'](_0x4ec612['shift']());}};_0x52a015(++_0x57dfd6);}(_0xb044,0x74));var _0x4b04=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb044[_0x2641f9];return _0x585741;};'use strict';var moment=require('moment');var _=require(_0x4b04('0x0'));var client=require('../client');exports[_0x4b04('0x1')]=function(_0x2d0644){return client[_0x4b04('0x2')](_0x4b04('0x3'),{'body':_0x2d0644,'log':_0x4b04('0x3')});};exports[_0x4b04('0x4')]=function(){return function(){return client[_0x4b04('0x2')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0x4b04('0x5')](_0x4b04('0x6'))[_0x4b04('0x7')](_0x4b04('0x8')),moment()['endOf'](_0x4b04('0x6'))[_0x4b04('0x7')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x4b04('0x9'),_0x4b04('0xa'),_0x4b04('0xb'),_0x4b04('0xc'),_0x4b04('0xd'),_0x4b04('0xe'),_0x4b04('0xf'),_0x4b04('0x10'),_0x4b04('0x11'),_0x4b04('0x12')]},'log':_0x4b04('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index b671ccd..c7272c2 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 _0xcc4d=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0xc24c3,_0x2e6c00){var _0x1cc270=function(_0x512b22){while(--_0x512b22){_0xc24c3['push'](_0xc24c3['shift']());}};_0x1cc270(++_0x2e6c00);}(_0xcc4d,0x103));var _0xdcc4=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xcc4d[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0xdcc4('0x0'));exports[_0xdcc4('0x1')]=function(_0x52135c){return function(){return client['Request'](_0xdcc4('0x2'),{'options':{'where':{'VoiceQueueId':_0x52135c,'paused':!![]},'raw':!![]},'log':_0xdcc4('0x1')});};}; \ No newline at end of file +var _0xf94a=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x3d2012,_0x3d02b9){var _0x53d542=function(_0x8f2be8){while(--_0x8f2be8){_0x3d2012['push'](_0x3d2012['shift']());}};_0x53d542(++_0x3d02b9);}(_0xf94a,0x1cd));var _0xaf94=function(_0x2dbbe5,_0x5010e8){_0x2dbbe5=_0x2dbbe5-0x0;var _0x2c5d65=_0xf94a[_0x2dbbe5];return _0x2c5d65;};'use strict';var client=require('../client');exports[_0xaf94('0x0')]=function(_0x1875e8){return function(){return client[_0xaf94('0x1')](_0xaf94('0x2'),{'options':{'where':{'VoiceQueueId':_0x1875e8,'paused':!![]},'raw':!![]},'log':_0xaf94('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index a27bd1c..95979a9 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 _0x02f2=['Request','merge','monitorFilename','CreateVoiceRecording','../client'];(function(_0x3eb947,_0xd5b29){var _0x2da8b1=function(_0x299f09){while(--_0x299f09){_0x3eb947['push'](_0x3eb947['shift']());}};_0x2da8b1(++_0xd5b29);}(_0x02f2,0x18a));var _0x202f=function(_0x59d1b6,_0x22f5ec){_0x59d1b6=_0x59d1b6-0x0;var _0x3037ec=_0x02f2[_0x59d1b6];return _0x3037ec;};'use strict';var _=require('lodash');var client=require(_0x202f('0x0'));exports['create']=function(_0x408d37){return client[_0x202f('0x1')]('CreateVoiceRecording',{'body':_[_0x202f('0x2')](_0x408d37,{'value':_0x408d37[_0x202f('0x3')]}),'log':_0x202f('0x4')});}; \ No newline at end of file +var _0xf614=['../client','Request','merge','monitorFilename','lodash'];(function(_0x1839fe,_0x3e6c3f){var _0x4ade79=function(_0x4ab05e){while(--_0x4ab05e){_0x1839fe['push'](_0x1839fe['shift']());}};_0x4ade79(++_0x3e6c3f);}(_0xf614,0xa4));var _0x4f61=function(_0x55a89e,_0x1a05ab){_0x55a89e=_0x55a89e-0x0;var _0x3aa2bd=_0xf614[_0x55a89e];return _0x3aa2bd;};'use strict';var _=require(_0x4f61('0x0'));var client=require(_0x4f61('0x1'));exports['create']=function(_0x5a198b){return client[_0x4f61('0x2')]('CreateVoiceRecording',{'body':_[_0x4f61('0x3')](_0x5a198b,{'value':_0x5a198b[_0x4f61('0x4')]}),'log':'CreateVoiceRecording'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 9216de7..1251913 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 _0x497c=['transferercalleridnum','transfererconnectedlinenum','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','Request','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','transfers','blindTransfer','CreateVoiceTransferReport','result','transfererchannel'];(function(_0xacf72e,_0x711fe4){var _0x2fb32b=function(_0x22dfc0){while(--_0x22dfc0){_0xacf72e['push'](_0xacf72e['shift']());}};_0x2fb32b(++_0x711fe4);}(_0x497c,0x1b7));var _0xc497=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x497c[_0x42bdad];return _0x122626;};'use strict';var client=require('../client');exports[_0xc497('0x0')]={};exports[_0xc497('0x1')]=function(_0x553c28){return client['Request'](_0xc497('0x2'),{'body':{'result':_0x553c28[_0xc497('0x3')],'transfererchannel':_0x553c28[_0xc497('0x4')],'transferercalleridnum':_0x553c28[_0xc497('0x5')],'transferercalleridname':_0x553c28['transferercalleridname'],'transfererconnectedlinenum':_0x553c28[_0xc497('0x6')],'transfererconnectedlinename':_0x553c28['transfererconnectedlinename'],'transfereraccountcode':_0x553c28['transfereraccountcode'],'transferercontext':_0x553c28['transferercontext'],'transfererexten':_0x553c28[_0xc497('0x7')],'transfererlinkedid':_0x553c28[_0xc497('0x8')],'transfereechannel':_0x553c28[_0xc497('0x9')],'transfereecalleridnum':_0x553c28['transfereecalleridnum'],'transfereecalleridname':_0x553c28[_0xc497('0xa')],'transfereeconnectedlinenum':_0x553c28[_0xc497('0xb')],'transfereeconnectedlinename':_0x553c28[_0xc497('0xc')],'transfereeaccountcode':_0x553c28[_0xc497('0xd')],'transfereecontext':_0x553c28[_0xc497('0xe')],'transfereeexten':_0x553c28[_0xc497('0xf')],'transfereelinkedid':_0x553c28[_0xc497('0x10')],'isexternal':_0x553c28[_0xc497('0x11')],'context':_0x553c28[_0xc497('0x12')],'extension':_0x553c28[_0xc497('0x13')],'type':_0xc497('0x14')},'log':_0xc497('0x2')});};exports[_0xc497('0x15')]=function(_0x219dd1){return client[_0xc497('0x16')](_0xc497('0x2'),{'body':{'result':_0x219dd1[_0xc497('0x3')],'transfererchannel':_0x219dd1['origtransfererchannel'],'transferercalleridnum':_0x219dd1[_0xc497('0x17')],'transferercalleridname':_0x219dd1[_0xc497('0x18')],'transfererconnectedlinenum':_0x219dd1[_0xc497('0x19')],'transfererconnectedlinename':_0x219dd1[_0xc497('0x1a')],'transfereraccountcode':_0x219dd1['origtransfereraccountcode'],'transferercontext':_0x219dd1[_0xc497('0x1b')],'transfererexten':_0x219dd1['secondtransfererexten'],'transfererlinkedid':_0x219dd1['origtransfererlinkedid'],'transfereechannel':_0x219dd1[_0xc497('0x1c')],'transfereecalleridnum':_0x219dd1[_0xc497('0x1d')],'transfereecalleridname':_0x219dd1[_0xc497('0x1e')],'transfereeconnectedlinenum':_0x219dd1[_0xc497('0x1f')],'transfereeconnectedlinename':_0x219dd1[_0xc497('0x20')],'transfereeaccountcode':_0x219dd1['transfertargetaccountcode'],'transfereecontext':_0x219dd1[_0xc497('0x21')],'transfereeexten':_0x219dd1[_0xc497('0x22')],'transfereelinkedid':_0x219dd1[_0xc497('0x23')],'isexternal':_0x219dd1[_0xc497('0x11')],'context':_0x219dd1[_0xc497('0x24')],'extension':_0x219dd1['origtransfererexten'],'type':'attended'},'log':_0xc497('0x2')});}; \ No newline at end of file +var _0x9216=['attended','../client','blindTransfer','Request','CreateVoiceTransferReport','transfereraccountcode','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereecontext','transfereeexten','transfereelinkedid','context','blind','result','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','isexternal','origtransferercontext','origtransfererexten'];(function(_0x3b6c59,_0x10c316){var _0x6d60c8=function(_0x4c38f9){while(--_0x4c38f9){_0x3b6c59['push'](_0x3b6c59['shift']());}};_0x6d60c8(++_0x10c316);}(_0x9216,0x175));var _0x6921=function(_0xb7e28a,_0x5cf4be){_0xb7e28a=_0xb7e28a-0x0;var _0x369be6=_0x9216[_0xb7e28a];return _0x369be6;};'use strict';var client=require(_0x6921('0x0'));exports['transfers']={};exports[_0x6921('0x1')]=function(_0x396574){return client[_0x6921('0x2')](_0x6921('0x3'),{'body':{'result':_0x396574['result'],'transfererchannel':_0x396574['transfererchannel'],'transferercalleridnum':_0x396574['transferercalleridnum'],'transferercalleridname':_0x396574['transferercalleridname'],'transfererconnectedlinenum':_0x396574['transfererconnectedlinenum'],'transfererconnectedlinename':_0x396574['transfererconnectedlinename'],'transfereraccountcode':_0x396574[_0x6921('0x4')],'transferercontext':_0x396574['transferercontext'],'transfererexten':_0x396574[_0x6921('0x5')],'transfererlinkedid':_0x396574[_0x6921('0x6')],'transfereechannel':_0x396574['transfereechannel'],'transfereecalleridnum':_0x396574[_0x6921('0x7')],'transfereecalleridname':_0x396574[_0x6921('0x8')],'transfereeconnectedlinenum':_0x396574['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x396574['transfereeconnectedlinename'],'transfereeaccountcode':_0x396574['transfereeaccountcode'],'transfereecontext':_0x396574[_0x6921('0x9')],'transfereeexten':_0x396574[_0x6921('0xa')],'transfereelinkedid':_0x396574[_0x6921('0xb')],'isexternal':_0x396574['isexternal'],'context':_0x396574[_0x6921('0xc')],'extension':_0x396574['extension'],'type':_0x6921('0xd')},'log':_0x6921('0x3')});};exports['attendedTransfer']=function(_0x3affd7){return client[_0x6921('0x2')](_0x6921('0x3'),{'body':{'result':_0x3affd7[_0x6921('0xe')],'transfererchannel':_0x3affd7['origtransfererchannel'],'transferercalleridnum':_0x3affd7[_0x6921('0xf')],'transferercalleridname':_0x3affd7['origtransferercalleridname'],'transfererconnectedlinenum':_0x3affd7[_0x6921('0x10')],'transfererconnectedlinename':_0x3affd7[_0x6921('0x11')],'transfereraccountcode':_0x3affd7[_0x6921('0x12')],'transferercontext':_0x3affd7[_0x6921('0x13')],'transfererexten':_0x3affd7[_0x6921('0x14')],'transfererlinkedid':_0x3affd7[_0x6921('0x15')],'transfereechannel':_0x3affd7[_0x6921('0x16')],'transfereecalleridnum':_0x3affd7['transfertargetcalleridnum'],'transfereecalleridname':_0x3affd7[_0x6921('0x17')],'transfereeconnectedlinenum':_0x3affd7[_0x6921('0x18')],'transfereeconnectedlinename':_0x3affd7[_0x6921('0x19')],'transfereeaccountcode':_0x3affd7['transfertargetaccountcode'],'transfereecontext':_0x3affd7['transfertargetcontext'],'transfereeexten':_0x3affd7[_0x6921('0x1a')],'transfereelinkedid':_0x3affd7['transfertargetlinkedid'],'isexternal':_0x3affd7[_0x6921('0x1b')],'context':_0x3affd7[_0x6921('0x1c')],'extension':_0x3affd7[_0x6921('0x1d')],'type':_0x6921('0x1e')},'log':_0x6921('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 2a9385c..1353096 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 _0x4c7c=['../ami','listen','%s/%s','SIP','name','timers','timer','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','pick','module','action','Action','then','catch','message','username','ami\x20disconnected','join','command','Command','content','voiceQueues','hasOwnProperty','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','callerid','Interval','length','values','channels','voicechannel','validate','find','filename','format','channel','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','uniqueid','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','%s.%s','stop','StopMixMonitor\x20Success','map','queueChannels','voicequeuechannelhangup','voicequeuechannelredirect','exten','context','outboundChannels','outbound','run','event','custom:','faxAccounts','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','bluebird','../../../config/environment','../properties'];(function(_0x636567,_0x4476e0){var _0x89e340=function(_0x24ea3a){while(--_0x24ea3a){_0x636567['push'](_0x636567['shift']());}};_0x89e340(++_0x4476e0);}(_0x4c7c,0x184));var _0xc4c7=function(_0x289891,_0x49a0fa){_0x289891=_0x289891-0x0;var _0x31cf2e=_0x4c7c[_0x289891];return _0x31cf2e;};'use strict';var _=require(_0xc4c7('0x0'));var util=require(_0xc4c7('0x1'));var jayson=require('jayson/promise');var schema=require('validate');var BPromise=require(_0xc4c7('0x2'));var moment=require('moment');var config=require(_0xc4c7('0x3'));var properties=require(_0xc4c7('0x4'));var ami=require(_0xc4c7('0x5'));exports[_0xc4c7('0x6')]=function(_0x330e92,_0x470854,_0x57c145){return new BPromise(function(_0x1be9ef,_0x27ae10){var _0x25f2dd={'QueuePause':function(_0x5c3034){return new Promise(function(_0x1df6df,_0x49ee38){var _0x191b11=util['format'](_0xc4c7('0x7'),_0xc4c7('0x8'),_0x5c3034[_0xc4c7('0x9')]);if(_0x330e92[_0xc4c7('0xa')]&&_0x330e92[_0xc4c7('0xa')][_0x191b11]&&_0x330e92[_0xc4c7('0xa')][_0x191b11][_0xc4c7('0xb')]){_0x330e92[_0xc4c7('0xa')][_0x191b11]['updateAcw']();}if(_0x330e92['agents'][_0x191b11]){_0x330e92[_0xc4c7('0xc')][_0x191b11][_0xc4c7('0xd')]({'statePause':_0x5c3034[_0xc4c7('0xe')]?!![]:![]});}_0x1df6df({'code':0xc8,'message':_0xc4c7('0xf')});});},'Reload':function(_0x170065){var _0x19f908=this;return new Promise(function(_0x30894d,_0x587ea4){if(ami[_0xc4c7('0x10')]()==![]){return _0x587ea4(_0x19f908[_0xc4c7('0x11')](0x1f4,[config['asterisk']['ip'],config[_0xc4c7('0x12')]['username'],'ami\x20disconnected']['join']('\x20')));}_0x170065=_[_0xc4c7('0x13')](_0x170065,_['keys'](properties[_0xc4c7('0x14')]));_0x170065[_0xc4c7('0x15')]='Reload';return ami[_0xc4c7('0x16')](_0x170065)[_0xc4c7('0x17')](function(_0x394831){_0x30894d({'code':0xc8,'message':_0x394831['message']});})[_0xc4c7('0x18')](function(_0x5b0e0c){_0x587ea4(_0x19f908[_0xc4c7('0x11')](0x1f5,_0x5b0e0c[_0xc4c7('0x19')]));});});},'Command':function(_0x4ba215){var _0x526cf5=this;return new Promise(function(_0x124122,_0x5c11f2){if(ami[_0xc4c7('0x10')]()==![]){return _0x5c11f2(_0x526cf5['error'](0x1f4,[config[_0xc4c7('0x12')]['ip'],config[_0xc4c7('0x12')][_0xc4c7('0x1a')],_0xc4c7('0x1b')][_0xc4c7('0x1c')]('\x20')));}_0x4ba215=_[_0xc4c7('0x13')](_0x4ba215,_0xc4c7('0x1d'));_0x4ba215[_0xc4c7('0x15')]=_0xc4c7('0x1e');return ami['Action'](_0x4ba215)[_0xc4c7('0x17')](function(_0x1e1924){_0x124122({'code':0xc8,'message':_0x1e1924[_0xc4c7('0x1f')]});})[_0xc4c7('0x18')](function(_0x347e92){_0x5c11f2(_0x526cf5[_0xc4c7('0x11')](0x1f5,_0x347e92[_0xc4c7('0x19')]));});});},'VoiceQueues':function(_0x454c9e){return new Promise(function(_0x2f2a18,_0x36bd26){var _0x5e49fc=[];for(var _0x231d0e in _0x330e92[_0xc4c7('0x20')]){if(_0x330e92[_0xc4c7('0x20')][_0xc4c7('0x21')](_0x231d0e)){var _0x391e7e=_0x330e92[_0xc4c7('0x20')][_0x231d0e];var _0x328762={'id':_0x391e7e['id'],'name':_0x391e7e[_0xc4c7('0x9')],'strategy':_0x391e7e['strategy'],'answered':_0x391e7e[_0xc4c7('0x22')],'available':_0x391e7e[_0xc4c7('0x23')],'loggedIn':_0x391e7e[_0xc4c7('0x24')],'pTalking':_0x391e7e[_0xc4c7('0x25')],'sumBillable':_0x391e7e[_0xc4c7('0x26')],'sumDuration':_0x391e7e[_0xc4c7('0x27')],'sumHoldTime':_0x391e7e[_0xc4c7('0x28')]||0x0,'talking':_0x391e7e[_0xc4c7('0x29')],'total':_0x391e7e[_0xc4c7('0x2a')],'type':_0x391e7e['type'],'unmanaged':_0x391e7e[_0xc4c7('0x2b')],'abandoned':_0x391e7e[_0xc4c7('0x2c')],'waiting':_0x391e7e[_0xc4c7('0x2d')],'loggedInDb':_0x391e7e[_0xc4c7('0x2e')]};if(_0x391e7e['type']==='outbound'){_0x328762['dialActive']=_0x391e7e[_0xc4c7('0x2f')];_0x328762[_0xc4c7('0x30')]=_0x391e7e[_0xc4c7('0x30')];_0x328762[_0xc4c7('0x31')]=_0x391e7e[_0xc4c7('0x31')];_0x328762[_0xc4c7('0x32')]=_0x391e7e['dialOriginateCallerIdNumber'];_0x328762[_0xc4c7('0x33')]=_0x391e7e[_0xc4c7('0x33')];_0x328762[_0xc4c7('0x34')]=_0x391e7e[_0xc4c7('0x34')];_0x328762[_0xc4c7('0x35')]=_0x391e7e['outboundAnswerAgiCallsDay'];_0x328762[_0xc4c7('0x36')]=_0x391e7e[_0xc4c7('0x36')];_0x328762[_0xc4c7('0x37')]=_0x391e7e[_0xc4c7('0x37')];_0x328762[_0xc4c7('0x38')]=_0x391e7e[_0xc4c7('0x38')];_0x328762['outboundCongestionCallsDay']=_0x391e7e['outboundCongestionCallsDay'];_0x328762[_0xc4c7('0x39')]=_0x391e7e[_0xc4c7('0x39')];_0x328762[_0xc4c7('0x3a')]=_0x391e7e[_0xc4c7('0x3a')];_0x328762[_0xc4c7('0x3b')]=_0x391e7e[_0xc4c7('0x3b')];_0x328762['outboundNoAnswerCallsDay']=_0x391e7e[_0xc4c7('0x3c')];_0x328762[_0xc4c7('0x3d')]=_0x391e7e[_0xc4c7('0x3d')];_0x328762[_0xc4c7('0x3e')]=_0x391e7e['outboundOriginateFailureCallsDay'];_0x328762[_0xc4c7('0x3f')]=_0x391e7e[_0xc4c7('0x3f')];_0x328762[_0xc4c7('0x40')]=_0x391e7e['outboundRejectCallsDay'];_0x328762[_0xc4c7('0x41')]=_0x391e7e[_0xc4c7('0x41')];_0x328762['predictiveIntervalAnsweredCalls']=_0x391e7e[_0xc4c7('0x42')];_0x328762[_0xc4c7('0x43')]=_0x391e7e[_0xc4c7('0x43')];_0x328762[_0xc4c7('0x44')]=_0x391e7e[_0xc4c7('0x44')];_0x328762['predictiveIntervalDroppedCallsCallersExit']=_0x391e7e['predictiveIntervalDroppedCallsCallersExit'];_0x328762['predictiveIntervalDroppedCallsTimeout']=_0x391e7e['predictiveIntervalDroppedCallsTimeout'];_0x328762[_0xc4c7('0x45')]=_0x391e7e[_0xc4c7('0x45')];_0x328762[_0xc4c7('0x46')]=_0x391e7e[_0xc4c7('0x46')];_0x328762['predictiveIntervalHitRate']=_0x391e7e[_0xc4c7('0x47')];_0x328762[_0xc4c7('0x48')]=_0x391e7e[_0xc4c7('0x48')];_0x328762[_0xc4c7('0x49')]=_0x391e7e['predictiveIntervalPauses'];_0x328762[_0xc4c7('0x4a')]=_0x391e7e[_0xc4c7('0x4a')];_0x328762[_0xc4c7('0x4b')]=_0x391e7e[_0xc4c7('0x4b')];_0x328762['message']=_0x391e7e['message'];_0x328762[_0xc4c7('0x4c')]=_0x391e7e['originated'];_0x328762[_0xc4c7('0x4d')]=_0x391e7e[_0xc4c7('0x4d')];_0x328762[_0xc4c7('0x4e')]=_0x391e7e[_0xc4c7('0x4e')];_0x328762[_0xc4c7('0x4f')]=_0x391e7e[_0xc4c7('0x4f')];_0x328762[_0xc4c7('0x50')]=_0x391e7e[_0xc4c7('0x50')];_0x328762[_0xc4c7('0x51')]=_0x391e7e[_0xc4c7('0x51')];_0x328762['startProgressive']=_0x391e7e['startProgressive'];}if(_0x391e7e[_0xc4c7('0x52')]){_0x328762['Trunk']={'id':_0x391e7e[_0xc4c7('0x52')]['id'],'name':_0x391e7e[_0xc4c7('0x52')][_0xc4c7('0x9')],'active':_0x391e7e[_0xc4c7('0x52')]['active'],'callerid':_0x391e7e[_0xc4c7('0x52')][_0xc4c7('0x53')]};}if(_0x391e7e['Interval']){_0x328762[_0xc4c7('0x54')]={'id':_0x391e7e[_0xc4c7('0x54')]['id'],'name':_0x391e7e[_0xc4c7('0x54')][_0xc4c7('0x9')]};}_0x5e49fc['push'](_0x328762);}}_0x2f2a18({'count':_0x5e49fc[_0xc4c7('0x55')],'rows':_0x5e49fc});});},'VoiceChannels':function(_0x2ba07b){return new Promise(function(_0x6ec9df,_0x10fa9c){var _0x44a507=_[_0xc4c7('0x56')](_0x330e92[_0xc4c7('0x57')]);_0x6ec9df({'count':_0x44a507['length'],'rows':_0x44a507});});},'VoiceChannelMixMonitor':function(_0xca915c){var _0x155917=this;return new Promise(function(_0x37fa12,_0x162d41){if(ami['isConnected']()==![]){return _0x162d41(_0x155917['error'](0x1f4,[config[_0xc4c7('0x12')]['ip'],config[_0xc4c7('0x12')][_0xc4c7('0x1a')],_0xc4c7('0x1b')]['join']('\x20')));}var _0x211690=schema(properties[_0xc4c7('0x58')])[_0xc4c7('0x59')](_0xca915c);if(_0x211690[_0xc4c7('0x55')]>0x0){return _0x162d41(_0x155917[_0xc4c7('0x11')](0x1f4,_['map'](_0x211690,'message')[_0xc4c7('0x1c')](',\x20')));}var _0x2fc699=_[_0xc4c7('0x5a')](_0x330e92[_0xc4c7('0x57')],{'uniqueid':_0xca915c['uniqueid']});if(_0x2fc699&&_0x2fc699['channel']){var _0x174747=util['format']('%s.%s',_0xca915c[_0xc4c7('0x5b')]||_0xca915c['uniqueid'],_0xca915c[_0xc4c7('0x5c')]||'wav');return ami[_0xc4c7('0x16')]({'action':'MixMonitor','channel':_0x2fc699[_0xc4c7('0x5d')],'file':_0x174747,'options':_0xc4c7('0x5e')})['then'](function(_0x104695){var _0x1787c3=_['find'](_0x2fc699[_0xc4c7('0x5f')],{'filename':_0xc4c7('0x60')+_0x174747[_0xc4c7('0x61')]()});if(_[_0xc4c7('0x62')](_0x1787c3)){_0x2fc699[_0xc4c7('0x5f')][_0xc4c7('0x63')]({'filename':_0xc4c7('0x60')+_0x174747[_0xc4c7('0x61')](),'createdAt':moment()['format'](_0xc4c7('0x64')),'mixmonitorid':_0x104695[_0xc4c7('0x65')],'status':_0xc4c7('0x66')});}else{_0x1787c3[_0xc4c7('0x65')]=_0x104695[_0xc4c7('0x65')];_0x1787c3[_0xc4c7('0x67')]='rec';}_0x37fa12({'code':0xc8,'message':[_0xca915c[_0xc4c7('0x68')],'MixMonitor\x20Success',_0x104695['mixmonitorid']][_0xc4c7('0x1c')]('\x20'),'mixmonitorid':_0x104695[_0xc4c7('0x65')]});})['catch'](function(_0x59fee4){_0x162d41(_0x155917['error'](0x1f5,[_0xca915c[_0xc4c7('0x68')],_0x59fee4[_0xc4c7('0x19')][_0xc4c7('0x61')]()][_0xc4c7('0x1c')]('\x20')));});}else{return _0x162d41(_0x155917['error'](0x1f5,_0xc4c7('0x69')));}});},'VoiceChannelStopMixMonitor':function(_0x53f5c3){var _0x3d3b53=this;return new Promise(function(_0x5bf409,_0x683863){if(ami[_0xc4c7('0x10')]()==![]){return _0x683863(_0x3d3b53[_0xc4c7('0x11')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xc4c7('0x1a')],_0xc4c7('0x1b')][_0xc4c7('0x1c')]('\x20')));}var _0x471ae2=schema(properties['voicechannel'])[_0xc4c7('0x59')](_0x53f5c3);if(_0x471ae2[_0xc4c7('0x55')]>0x0){return _0x683863(_0x3d3b53['error'](0x1f4,_['map'](_0x471ae2,_0xc4c7('0x19'))['join'](',\x20')));}var _0x2babdf=_[_0xc4c7('0x5a')](_0x330e92[_0xc4c7('0x57')],{'uniqueid':_0x53f5c3[_0xc4c7('0x68')]});if(_0x2babdf){return BPromise[_0xc4c7('0x6a')]()[_0xc4c7('0x17')](function(){if(_0x2babdf['channel']){return ami[_0xc4c7('0x16')]({'action':_0xc4c7('0x6b'),'channel':_0x2babdf[_0xc4c7('0x5d')],'mixmonitorid':_0x53f5c3[_0xc4c7('0x65')]})[_0xc4c7('0x18')](function(_0x46c826){});}})['then'](function(){if(_0x2babdf[_0xc4c7('0x6c')]){return ami[_0xc4c7('0x16')]({'action':'StopMixMonitor','channel':_0x2babdf[_0xc4c7('0x6c')],'mixmonitorid':_0x53f5c3[_0xc4c7('0x65')]})['catch'](function(_0x136e46){});}})[_0xc4c7('0x17')](function(_0x553a7f){var _0x480769=_['find'](_0x2babdf[_0xc4c7('0x5f')],{'mixmonitorid':_0x53f5c3[_0xc4c7('0x65')]});if(_0x480769){_0x480769['status']='stop';}})[_0xc4c7('0x17')](function(){var _0x411e68=util[_0xc4c7('0x5c')](_0xc4c7('0x6d'),_0x53f5c3['filename']||_0x53f5c3[_0xc4c7('0x68')],_0x53f5c3[_0xc4c7('0x5c')]||'wav');var _0x56fa8e=_[_0xc4c7('0x5a')](_0x2babdf['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x411e68[_0xc4c7('0x61')]()});if(_0x56fa8e){_0x56fa8e[_0xc4c7('0x67')]=_0xc4c7('0x6e');}})[_0xc4c7('0x17')](function(){_0x5bf409({'code':0xc8,'message':[_0x53f5c3[_0xc4c7('0x68')],_0xc4c7('0x6f')]['join']('\x20')});})[_0xc4c7('0x18')](function(_0x84e067){_0x683863(_0x3d3b53[_0xc4c7('0x11')](0x1f5,[_0x53f5c3[_0xc4c7('0x68')],_0x84e067[_0xc4c7('0x19')][_0xc4c7('0x61')]()]['join']('\x20')));});}else{return _0x683863(_0x3d3b53[_0xc4c7('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x54852b){return new Promise(function(_0x38886b,_0x2a168a){var _0x1f6daf=_[_0xc4c7('0x56')](_0x330e92['queueChannels']);_0x38886b({'count':_0x1f6daf[_0xc4c7('0x55')],'rows':_0x1f6daf});});},'VoiceQueuesChannel':function(_0x534d06){var _0x33fa45=this;return new Promise(function(_0x1ed7a3,_0x504253){var _0x2c825e=schema(properties['voicequeuechannel'])[_0xc4c7('0x59')](_0x534d06);if(_0x2c825e['length']>0x0){return _0x504253(_0x33fa45[_0xc4c7('0x11')](0x1f4,_[_0xc4c7('0x70')](_0x2c825e,_0xc4c7('0x19'))['join'](',\x20')));}var _0x5a0781=_[_0xc4c7('0x5a')](_0x330e92[_0xc4c7('0x71')],{'uniqueid':_0x534d06['uniqueid']});if(_0x5a0781){_0x1ed7a3(_0x5a0781);}else{return _0x504253(_0x33fa45[_0xc4c7('0x11')](0x1f5,_0xc4c7('0x69')));}});},'VoiceQueuesChannelHangup':function(_0x4320d1){var _0x4ba156=this;return new Promise(function(_0x563635,_0x4f03b9){if(ami[_0xc4c7('0x10')]()==![]){return _0x4f03b9(_0x4ba156[_0xc4c7('0x11')](0x1f4,[config[_0xc4c7('0x12')]['ip'],config[_0xc4c7('0x12')][_0xc4c7('0x1a')],_0xc4c7('0x1b')][_0xc4c7('0x1c')]('\x20')));}var _0x326108=schema(properties[_0xc4c7('0x72')])['validate'](_0x4320d1);if(_0x326108[_0xc4c7('0x55')]>0x0){return _0x4f03b9(_0x4ba156[_0xc4c7('0x11')](0x1f4,_[_0xc4c7('0x70')](_0x326108,_0xc4c7('0x19'))['join'](',\x20')));}var _0x2546a7=_[_0xc4c7('0x5a')](_0x330e92[_0xc4c7('0x71')],{'uniqueid':_0x4320d1[_0xc4c7('0x68')]});if(_0x2546a7&&_0x2546a7[_0xc4c7('0x5d')]){return ami['Action']({'action':'Hangup','channel':_0x2546a7['channel']})['then'](function(_0xf4f8f2){_0x563635({'code':0xc8,'message':[_0x4320d1[_0xc4c7('0x68')],_0xf4f8f2[_0xc4c7('0x19')]['toLowerCase']()][_0xc4c7('0x1c')]('\x20')});})[_0xc4c7('0x18')](function(_0xcaf516){_0x4f03b9(_0x4ba156[_0xc4c7('0x11')](0x1f5,[_0x4320d1[_0xc4c7('0x68')],_0xcaf516['message'][_0xc4c7('0x61')]()][_0xc4c7('0x1c')]('\x20')));});}else{return _0x4f03b9(_0x4ba156[_0xc4c7('0x11')](0x1f5,_0xc4c7('0x69')));}});},'VoiceQueuesChannelRedirect':function(_0x3c5f8b){var _0x4be9fe=this;return new Promise(function(_0x5093a1,_0x221cd4){if(ami[_0xc4c7('0x10')]()==![]){return _0x221cd4(_0x4be9fe[_0xc4c7('0x11')](0x1f4,[config['asterisk']['ip'],config[_0xc4c7('0x12')]['username'],_0xc4c7('0x1b')][_0xc4c7('0x1c')]('\x20')));}var _0x7b1242=schema(properties[_0xc4c7('0x73')])[_0xc4c7('0x59')](_0x3c5f8b);if(_0x7b1242[_0xc4c7('0x55')]>0x0){return _0x221cd4(_0x4be9fe['error'](0x1f4,_[_0xc4c7('0x70')](_0x7b1242,_0xc4c7('0x19'))[_0xc4c7('0x1c')](',\x20')));}var _0x2d9227=_[_0xc4c7('0x5a')](_0x330e92[_0xc4c7('0x71')],{'uniqueid':_0x3c5f8b[_0xc4c7('0x68')]});if(_0x2d9227&&_0x2d9227[_0xc4c7('0x5d')]){return ami[_0xc4c7('0x16')]({'action':'Redirect','channel':_0x2d9227[_0xc4c7('0x5d')],'exten':_0x3c5f8b[_0xc4c7('0x74')],'context':_0x3c5f8b['context']||_0x2d9227[_0xc4c7('0x75')],'priority':0x1})[_0xc4c7('0x17')](function(_0xec2205){_0x5093a1({'code':0xc8,'message':[_0x3c5f8b[_0xc4c7('0x68')],_0xec2205[_0xc4c7('0x19')][_0xc4c7('0x61')]()][_0xc4c7('0x1c')]('\x20')});})[_0xc4c7('0x18')](function(_0x5578b3){_0x221cd4(_0x4be9fe['error'](0x1f5,[_0x3c5f8b['uniqueid'],_0x5578b3[_0xc4c7('0x19')][_0xc4c7('0x61')]()][_0xc4c7('0x1c')]('\x20')));});}else{return _0x221cd4(_0x4be9fe[_0xc4c7('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x249b87){return new Promise(function(_0x421bd1,_0xdceeea){var _0x4cbc25=_['values'](_0x330e92[_0xc4c7('0xc')]);_0x421bd1({'count':_0x4cbc25['length'],'rows':_0x4cbc25});});},'Telephones':function(_0x5bdf80){return new Promise(function(_0x378614,_0x151b2e){var _0x3c3048=_['values'](_0x330e92['telephones']);_0x378614({'count':_0x3c3048['length'],'rows':_0x3c3048});});},'Trunks':function(_0x349dce){return new Promise(function(_0x8868cc,_0x341a37){var _0x48792d=_[_0xc4c7('0x56')](_0x330e92['trunks']);_0x8868cc({'count':_0x48792d[_0xc4c7('0x55')],'rows':_0x48792d});});},'OutboundChannels':function(_0x2e073e){return new Promise(function(_0x40df9a,_0x5ba6f8){var _0x3c260d=_[_0xc4c7('0x56')](_0x330e92[_0xc4c7('0x76')]);_0x40df9a({'count':_0x3c260d[_0xc4c7('0x55')],'rows':_0x3c260d});});},'Outbound':function(_0x796558){return new Promise(function(_0x1df8ba,_0x3e6d76){_0x1df8ba(_0x330e92[_0xc4c7('0x77')]);});},'Campaigns':function(_0x1b5ea6){return new Promise(function(_0x527fae,_0x48bd11){var _0x10147a=_[_0xc4c7('0x56')](_0x330e92['campaigns']);_0x527fae({'count':_0x10147a[_0xc4c7('0x55')],'rows':_0x10147a});});},'VoiceQueuesPreview':function(_0x4492b1){var _0x9d7f5f=this;return new Promise(function(_0x3cf316,_0x30d2b6){_0x470854[_0xc4c7('0x78')](_0x4492b1['id'])['then'](function(_0x31d91c){_0x3cf316({'code':0xc8,'message':_0x31d91c[_0xc4c7('0x19')]});})[_0xc4c7('0x18')](function(_0x50cd16){_0x30d2b6(_0x9d7f5f['error'](0x1f4,_0x50cd16['message']));});});},'EventManager':function(_0x4dacd2){var _0xd0e04c=this;return new Promise(function(_0x376a40,_0x1e6093){if(!_0x4dacd2[_0xc4c7('0x79')]){return _0x1e6093(_0xd0e04c[_0xc4c7('0x11')](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0xc4c7('0x7a')+_0x4dacd2['event'],_0x4dacd2[_0xc4c7('0x19')]);_0x376a40({'code':0xc8,'message':_0x4dacd2});});},'FaxAccounts':function(_0x2843cc){return new Promise(function(_0x1c4245,_0x1e0241){var _0x2e582b=_[_0xc4c7('0x56')](_0x330e92[_0xc4c7('0x7b')]);_0x1c4245({'count':_0x2e582b[_0xc4c7('0x55')],'rows':_0x2e582b});});},'SendFax':function(_0x388b01){var _0x1a5a51=this;return new Promise(function(_0x4f8091,_0x24ba59){_0x57c145['send'](_0x388b01)[_0xc4c7('0x17')](function(_0x3a8f33){_0x4f8091({'code':0xc8,'message':_0x3a8f33[_0xc4c7('0x19')]});})[_0xc4c7('0x18')](function(_0x1d6e8f){_0x24ba59(_0x1a5a51[_0xc4c7('0x11')](0x1f4,_0x1d6e8f[_0xc4c7('0x19')]));});});},'CheckAfterSend':function(_0x2574d4){var _0x44a5d1=this;return new Promise(function(_0x282e0e,_0x159b86){_0x57c145[_0xc4c7('0x7c')](_0x2574d4)[_0xc4c7('0x17')](function(_0x52091c){_0x282e0e({'code':0xc8,'message':_0x52091c[_0xc4c7('0x19')]});})[_0xc4c7('0x18')](function(_0x4c66d9){_0x159b86(_0x44a5d1[_0xc4c7('0x11')](0x1f4,_0x4c66d9[_0xc4c7('0x19')]));});});}};var _0x3fc1a7=jayson[_0xc4c7('0x7d')](_0x25f2dd)[_0xc4c7('0x7e')]();_0x3fc1a7['on'](_0xc4c7('0x11'),function(_0x2f09ff){return _0x27ae10(_0x2f09ff);});_0x3fc1a7[_0xc4c7('0x6')](0x232a,_0xc4c7('0x7f'),function(){console[_0xc4c7('0x80')](_0xc4c7('0x81'),0x232a);return _0x1be9ef(_0xc4c7('0x82')+0x232a);});});}; \ No newline at end of file +var _0xbbe3=['monitors','stop','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','telephones','trunks','outboundChannels','outbound','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','checkAfterSend','server','listen','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','../../../config/environment','../properties','format','%s/%s','name','timers','updateAcw','agents','updateStatusRealtime','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','answered','available','loggedIn','pTalking','sumBillable','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','length','values','channels','voicechannel','map','find','uniqueid','channel','%s.%s','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','push','rec','mixmonitorid','status','toLowerCase','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','filename','wav'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbbe3,0x1b1));var _0x3bbe=function(_0x4797b7,_0x22cd77){_0x4797b7=_0x4797b7-0x0;var _0x41f40c=_0xbbe3[_0x4797b7];return _0x41f40c;};'use strict';var _=require(_0x3bbe('0x0'));var util=require(_0x3bbe('0x1'));var jayson=require(_0x3bbe('0x2'));var schema=require(_0x3bbe('0x3'));var BPromise=require(_0x3bbe('0x4'));var moment=require('moment');var config=require(_0x3bbe('0x5'));var properties=require(_0x3bbe('0x6'));var ami=require('../ami');exports['listen']=function(_0x41a958,_0x1257c2,_0x559c21){return new BPromise(function(_0x3e8ee1,_0x4d1430){var _0x4fee0c={'QueuePause':function(_0x127ee7){return new Promise(function(_0x30e943,_0x5819aa){var _0x272f46=util[_0x3bbe('0x7')](_0x3bbe('0x8'),'SIP',_0x127ee7[_0x3bbe('0x9')]);if(_0x41a958[_0x3bbe('0xa')]&&_0x41a958[_0x3bbe('0xa')][_0x272f46]&&_0x41a958[_0x3bbe('0xa')][_0x272f46]['timer']){_0x41a958[_0x3bbe('0xa')][_0x272f46][_0x3bbe('0xb')]();}if(_0x41a958['agents'][_0x272f46]){_0x41a958[_0x3bbe('0xc')][_0x272f46][_0x3bbe('0xd')]({'statePause':_0x127ee7['pause']?!![]:![]});}_0x30e943({'code':0xc8,'message':_0x3bbe('0xe')});});},'Reload':function(_0x3e9382){var _0x1a1f77=this;return new Promise(function(_0x12c06d,_0xf70be){if(ami[_0x3bbe('0xf')]()==![]){return _0xf70be(_0x1a1f77[_0x3bbe('0x10')](0x1f4,[config[_0x3bbe('0x11')]['ip'],config[_0x3bbe('0x11')][_0x3bbe('0x12')],_0x3bbe('0x13')][_0x3bbe('0x14')]('\x20')));}_0x3e9382=_[_0x3bbe('0x15')](_0x3e9382,_[_0x3bbe('0x16')](properties[_0x3bbe('0x17')]));_0x3e9382[_0x3bbe('0x18')]=_0x3bbe('0x19');return ami[_0x3bbe('0x1a')](_0x3e9382)[_0x3bbe('0x1b')](function(_0x1ffdfe){_0x12c06d({'code':0xc8,'message':_0x1ffdfe[_0x3bbe('0x1c')]});})[_0x3bbe('0x1d')](function(_0x5aafb1){_0xf70be(_0x1a1f77[_0x3bbe('0x10')](0x1f5,_0x5aafb1[_0x3bbe('0x1c')]));});});},'Command':function(_0x573285){var _0x19147b=this;return new Promise(function(_0x3f92cf,_0x598a58){if(ami['isConnected']()==![]){return _0x598a58(_0x19147b[_0x3bbe('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x3bbe('0x11')][_0x3bbe('0x12')],_0x3bbe('0x13')][_0x3bbe('0x14')]('\x20')));}_0x573285=_[_0x3bbe('0x15')](_0x573285,_0x3bbe('0x1e'));_0x573285[_0x3bbe('0x18')]=_0x3bbe('0x1f');return ami[_0x3bbe('0x1a')](_0x573285)[_0x3bbe('0x1b')](function(_0x168e48){_0x3f92cf({'code':0xc8,'message':_0x168e48[_0x3bbe('0x20')]});})[_0x3bbe('0x1d')](function(_0x349ea7){_0x598a58(_0x19147b[_0x3bbe('0x10')](0x1f5,_0x349ea7['message']));});});},'VoiceQueues':function(_0x3e88fe){return new Promise(function(_0x4cf416,_0x59b53f){var _0x54719a=[];for(var _0x194671 in _0x41a958[_0x3bbe('0x21')]){if(_0x41a958[_0x3bbe('0x21')]['hasOwnProperty'](_0x194671)){var _0x1d16f8=_0x41a958[_0x3bbe('0x21')][_0x194671];var _0x1ea40f={'id':_0x1d16f8['id'],'name':_0x1d16f8[_0x3bbe('0x9')],'strategy':_0x1d16f8['strategy'],'answered':_0x1d16f8[_0x3bbe('0x22')],'available':_0x1d16f8[_0x3bbe('0x23')],'loggedIn':_0x1d16f8[_0x3bbe('0x24')],'pTalking':_0x1d16f8[_0x3bbe('0x25')],'sumBillable':_0x1d16f8[_0x3bbe('0x26')],'sumDuration':_0x1d16f8['sumDuration'],'sumHoldTime':_0x1d16f8['sumHoldTime']||0x0,'talking':_0x1d16f8[_0x3bbe('0x27')],'total':_0x1d16f8[_0x3bbe('0x28')],'type':_0x1d16f8[_0x3bbe('0x29')],'unmanaged':_0x1d16f8[_0x3bbe('0x2a')],'abandoned':_0x1d16f8[_0x3bbe('0x2b')],'waiting':_0x1d16f8[_0x3bbe('0x2c')],'loggedInDb':_0x1d16f8[_0x3bbe('0x2d')]};if(_0x1d16f8[_0x3bbe('0x29')]==='outbound'){_0x1ea40f['dialActive']=_0x1d16f8['dialActive'];_0x1ea40f[_0x3bbe('0x2e')]=_0x1d16f8['dialMethod'];_0x1ea40f[_0x3bbe('0x2f')]=_0x1d16f8[_0x3bbe('0x2f')];_0x1ea40f[_0x3bbe('0x30')]=_0x1d16f8[_0x3bbe('0x30')];_0x1ea40f[_0x3bbe('0x31')]=_0x1d16f8[_0x3bbe('0x31')];_0x1ea40f[_0x3bbe('0x32')]=_0x1d16f8[_0x3bbe('0x32')];_0x1ea40f[_0x3bbe('0x33')]=_0x1d16f8[_0x3bbe('0x33')];_0x1ea40f[_0x3bbe('0x34')]=_0x1d16f8['outboundAnswerCallsDay'];_0x1ea40f[_0x3bbe('0x35')]=_0x1d16f8[_0x3bbe('0x35')];_0x1ea40f[_0x3bbe('0x36')]=_0x1d16f8[_0x3bbe('0x36')];_0x1ea40f[_0x3bbe('0x37')]=_0x1d16f8['outboundCongestionCallsDay'];_0x1ea40f[_0x3bbe('0x38')]=_0x1d16f8['outboundDropCallsDayACS'];_0x1ea40f[_0x3bbe('0x39')]=_0x1d16f8[_0x3bbe('0x39')];_0x1ea40f['outboundDropCallsDayTimeout']=_0x1d16f8[_0x3bbe('0x3a')];_0x1ea40f[_0x3bbe('0x3b')]=_0x1d16f8[_0x3bbe('0x3b')];_0x1ea40f['outboundNoSuchCallsDay']=_0x1d16f8[_0x3bbe('0x3c')];_0x1ea40f[_0x3bbe('0x3d')]=_0x1d16f8[_0x3bbe('0x3d')];_0x1ea40f['outboundReCallsDay']=_0x1d16f8[_0x3bbe('0x3e')];_0x1ea40f['outboundRejectCallsDay']=_0x1d16f8[_0x3bbe('0x3f')];_0x1ea40f['outboundUnknownCallsDay']=_0x1d16f8[_0x3bbe('0x40')];_0x1ea40f['predictiveIntervalAnsweredCalls']=_0x1d16f8[_0x3bbe('0x41')];_0x1ea40f['predictiveIntervalAvgHoldtime']=_0x1d16f8[_0x3bbe('0x42')];_0x1ea40f[_0x3bbe('0x43')]=_0x1d16f8['predictiveIntervalAvgTalktime'];_0x1ea40f[_0x3bbe('0x44')]=_0x1d16f8[_0x3bbe('0x44')];_0x1ea40f[_0x3bbe('0x45')]=_0x1d16f8[_0x3bbe('0x45')];_0x1ea40f[_0x3bbe('0x46')]=_0x1d16f8['predictiveIntervalErlangCalls'];_0x1ea40f[_0x3bbe('0x47')]=_0x1d16f8[_0x3bbe('0x47')];_0x1ea40f['predictiveIntervalHitRate']=_0x1d16f8[_0x3bbe('0x48')];_0x1ea40f[_0x3bbe('0x49')]=_0x1d16f8[_0x3bbe('0x49')];_0x1ea40f['predictiveIntervalPauses']=_0x1d16f8[_0x3bbe('0x4a')];_0x1ea40f['predictiveIntervalAvailable']=_0x1d16f8[_0x3bbe('0x4b')];_0x1ea40f[_0x3bbe('0x4c')]=_0x1d16f8['predictiveIntervalTotalCalls'];_0x1ea40f[_0x3bbe('0x1c')]=_0x1d16f8[_0x3bbe('0x1c')];_0x1ea40f['originated']=_0x1d16f8[_0x3bbe('0x4d')];_0x1ea40f[_0x3bbe('0x4e')]=_0x1d16f8[_0x3bbe('0x4e')];_0x1ea40f[_0x3bbe('0x4f')]=_0x1d16f8['erlangCallToSecond'];_0x1ea40f[_0x3bbe('0x50')]=_0x1d16f8[_0x3bbe('0x50')];_0x1ea40f[_0x3bbe('0x51')]=_0x1d16f8[_0x3bbe('0x51')];_0x1ea40f[_0x3bbe('0x52')]=_0x1d16f8['startPredictive'];_0x1ea40f['startProgressive']=_0x1d16f8[_0x3bbe('0x53')];}if(_0x1d16f8[_0x3bbe('0x54')]){_0x1ea40f['Trunk']={'id':_0x1d16f8[_0x3bbe('0x54')]['id'],'name':_0x1d16f8[_0x3bbe('0x54')][_0x3bbe('0x9')],'active':_0x1d16f8[_0x3bbe('0x54')][_0x3bbe('0x55')],'callerid':_0x1d16f8[_0x3bbe('0x54')][_0x3bbe('0x56')]};}if(_0x1d16f8[_0x3bbe('0x57')]){_0x1ea40f[_0x3bbe('0x57')]={'id':_0x1d16f8['Interval']['id'],'name':_0x1d16f8[_0x3bbe('0x57')][_0x3bbe('0x9')]};}_0x54719a['push'](_0x1ea40f);}}_0x4cf416({'count':_0x54719a[_0x3bbe('0x58')],'rows':_0x54719a});});},'VoiceChannels':function(_0xa0a7ad){return new Promise(function(_0xbb0374,_0x35cc28){var _0x1a0a88=_[_0x3bbe('0x59')](_0x41a958[_0x3bbe('0x5a')]);_0xbb0374({'count':_0x1a0a88['length'],'rows':_0x1a0a88});});},'VoiceChannelMixMonitor':function(_0x19cd3b){var _0x557908=this;return new Promise(function(_0x583b35,_0x5cc98a){if(ami['isConnected']()==![]){return _0x5cc98a(_0x557908[_0x3bbe('0x10')](0x1f4,[config[_0x3bbe('0x11')]['ip'],config[_0x3bbe('0x11')][_0x3bbe('0x12')],_0x3bbe('0x13')][_0x3bbe('0x14')]('\x20')));}var _0x418ce3=schema(properties[_0x3bbe('0x5b')])[_0x3bbe('0x3')](_0x19cd3b);if(_0x418ce3[_0x3bbe('0x58')]>0x0){return _0x5cc98a(_0x557908['error'](0x1f4,_[_0x3bbe('0x5c')](_0x418ce3,_0x3bbe('0x1c'))[_0x3bbe('0x14')](',\x20')));}var _0x138f83=_[_0x3bbe('0x5d')](_0x41a958[_0x3bbe('0x5a')],{'uniqueid':_0x19cd3b[_0x3bbe('0x5e')]});if(_0x138f83&&_0x138f83[_0x3bbe('0x5f')]){var _0x265f13=util[_0x3bbe('0x7')](_0x3bbe('0x60'),_0x19cd3b['filename']||_0x19cd3b[_0x3bbe('0x5e')],_0x19cd3b[_0x3bbe('0x7')]||'wav');return ami[_0x3bbe('0x1a')]({'action':_0x3bbe('0x61'),'channel':_0x138f83[_0x3bbe('0x5f')],'file':_0x265f13,'options':_0x3bbe('0x62')})['then'](function(_0x3fff3f){var _0x554d7e=_['find'](_0x138f83['monitors'],{'filename':_0x3bbe('0x63')+_0x265f13['toLowerCase']()});if(_['isNil'](_0x554d7e)){_0x138f83['monitors'][_0x3bbe('0x64')]({'filename':'/var/spool/asterisk/monitor/'+_0x265f13['toLowerCase'](),'createdAt':moment()[_0x3bbe('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x3fff3f['mixmonitorid'],'status':_0x3bbe('0x65')});}else{_0x554d7e[_0x3bbe('0x66')]=_0x3fff3f['mixmonitorid'];_0x554d7e[_0x3bbe('0x67')]=_0x3bbe('0x65');}_0x583b35({'code':0xc8,'message':[_0x19cd3b[_0x3bbe('0x5e')],'MixMonitor\x20Success',_0x3fff3f[_0x3bbe('0x66')]][_0x3bbe('0x14')]('\x20'),'mixmonitorid':_0x3fff3f[_0x3bbe('0x66')]});})[_0x3bbe('0x1d')](function(_0x2aa5b0){_0x5cc98a(_0x557908['error'](0x1f5,[_0x19cd3b[_0x3bbe('0x5e')],_0x2aa5b0[_0x3bbe('0x1c')][_0x3bbe('0x68')]()]['join']('\x20')));});}else{return _0x5cc98a(_0x557908[_0x3bbe('0x10')](0x1f5,_0x3bbe('0x69')));}});},'VoiceChannelStopMixMonitor':function(_0x519bb9){var _0x1e0fe3=this;return new Promise(function(_0x1c051e,_0x26bc46){if(ami['isConnected']()==![]){return _0x26bc46(_0x1e0fe3[_0x3bbe('0x10')](0x1f4,[config[_0x3bbe('0x11')]['ip'],config['asterisk']['username'],_0x3bbe('0x13')][_0x3bbe('0x14')]('\x20')));}var _0x3dff2d=schema(properties[_0x3bbe('0x5b')])[_0x3bbe('0x3')](_0x519bb9);if(_0x3dff2d['length']>0x0){return _0x26bc46(_0x1e0fe3['error'](0x1f4,_['map'](_0x3dff2d,'message')[_0x3bbe('0x14')](',\x20')));}var _0x4e3973=_['find'](_0x41a958['channels'],{'uniqueid':_0x519bb9[_0x3bbe('0x5e')]});if(_0x4e3973){return BPromise[_0x3bbe('0x6a')]()[_0x3bbe('0x1b')](function(){if(_0x4e3973[_0x3bbe('0x5f')]){return ami[_0x3bbe('0x1a')]({'action':_0x3bbe('0x6b'),'channel':_0x4e3973['channel'],'mixmonitorid':_0x519bb9['mixmonitorid']})[_0x3bbe('0x1d')](function(_0x47e7a8){});}})[_0x3bbe('0x1b')](function(){if(_0x4e3973[_0x3bbe('0x6c')]){return ami[_0x3bbe('0x1a')]({'action':_0x3bbe('0x6b'),'channel':_0x4e3973[_0x3bbe('0x6c')],'mixmonitorid':_0x519bb9[_0x3bbe('0x66')]})['catch'](function(_0x5e2863){});}})[_0x3bbe('0x1b')](function(_0xdea0d){var _0x2860d9=_[_0x3bbe('0x5d')](_0x4e3973['monitors'],{'mixmonitorid':_0x519bb9[_0x3bbe('0x66')]});if(_0x2860d9){_0x2860d9[_0x3bbe('0x67')]='stop';}})[_0x3bbe('0x1b')](function(){var _0x464e41=util[_0x3bbe('0x7')](_0x3bbe('0x60'),_0x519bb9[_0x3bbe('0x6d')]||_0x519bb9[_0x3bbe('0x5e')],_0x519bb9[_0x3bbe('0x7')]||_0x3bbe('0x6e'));var _0x43e451=_[_0x3bbe('0x5d')](_0x4e3973[_0x3bbe('0x6f')],{'filename':'/var/spool/asterisk/monitor/'+_0x464e41[_0x3bbe('0x68')]()});if(_0x43e451){_0x43e451[_0x3bbe('0x67')]=_0x3bbe('0x70');}})['then'](function(){_0x1c051e({'code':0xc8,'message':[_0x519bb9[_0x3bbe('0x5e')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x3bbe('0x1d')](function(_0x2911bf){_0x26bc46(_0x1e0fe3[_0x3bbe('0x10')](0x1f5,[_0x519bb9['uniqueid'],_0x2911bf[_0x3bbe('0x1c')][_0x3bbe('0x68')]()][_0x3bbe('0x14')]('\x20')));});}else{return _0x26bc46(_0x1e0fe3[_0x3bbe('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x5b9ff3){return new Promise(function(_0x40af68,_0x51461a){var _0x26ef06=_[_0x3bbe('0x59')](_0x41a958[_0x3bbe('0x71')]);_0x40af68({'count':_0x26ef06[_0x3bbe('0x58')],'rows':_0x26ef06});});},'VoiceQueuesChannel':function(_0x25e904){var _0x3b9a27=this;return new Promise(function(_0x335cdf,_0x24ce8e){var _0x3f25ae=schema(properties['voicequeuechannel'])[_0x3bbe('0x3')](_0x25e904);if(_0x3f25ae[_0x3bbe('0x58')]>0x0){return _0x24ce8e(_0x3b9a27[_0x3bbe('0x10')](0x1f4,_[_0x3bbe('0x5c')](_0x3f25ae,_0x3bbe('0x1c'))[_0x3bbe('0x14')](',\x20')));}var _0x4890fb=_[_0x3bbe('0x5d')](_0x41a958['queueChannels'],{'uniqueid':_0x25e904['uniqueid']});if(_0x4890fb){_0x335cdf(_0x4890fb);}else{return _0x24ce8e(_0x3b9a27[_0x3bbe('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x24ea53){var _0x4c5123=this;return new Promise(function(_0x57ba6b,_0x458d42){if(ami[_0x3bbe('0xf')]()==![]){return _0x458d42(_0x4c5123[_0x3bbe('0x10')](0x1f4,[config[_0x3bbe('0x11')]['ip'],config['asterisk'][_0x3bbe('0x12')],_0x3bbe('0x13')][_0x3bbe('0x14')]('\x20')));}var _0x2cf322=schema(properties[_0x3bbe('0x72')])[_0x3bbe('0x3')](_0x24ea53);if(_0x2cf322['length']>0x0){return _0x458d42(_0x4c5123[_0x3bbe('0x10')](0x1f4,_[_0x3bbe('0x5c')](_0x2cf322,_0x3bbe('0x1c'))[_0x3bbe('0x14')](',\x20')));}var _0x2ff6d6=_[_0x3bbe('0x5d')](_0x41a958[_0x3bbe('0x71')],{'uniqueid':_0x24ea53['uniqueid']});if(_0x2ff6d6&&_0x2ff6d6[_0x3bbe('0x5f')]){return ami[_0x3bbe('0x1a')]({'action':_0x3bbe('0x73'),'channel':_0x2ff6d6[_0x3bbe('0x5f')]})[_0x3bbe('0x1b')](function(_0x437460){_0x57ba6b({'code':0xc8,'message':[_0x24ea53[_0x3bbe('0x5e')],_0x437460[_0x3bbe('0x1c')][_0x3bbe('0x68')]()][_0x3bbe('0x14')]('\x20')});})[_0x3bbe('0x1d')](function(_0x1af3b5){_0x458d42(_0x4c5123['error'](0x1f5,[_0x24ea53[_0x3bbe('0x5e')],_0x1af3b5[_0x3bbe('0x1c')][_0x3bbe('0x68')]()][_0x3bbe('0x14')]('\x20')));});}else{return _0x458d42(_0x4c5123['error'](0x1f5,_0x3bbe('0x69')));}});},'VoiceQueuesChannelRedirect':function(_0x304a3f){var _0x3fcf1a=this;return new Promise(function(_0x4479b8,_0x4ac1c8){if(ami[_0x3bbe('0xf')]()==![]){return _0x4ac1c8(_0x3fcf1a[_0x3bbe('0x10')](0x1f4,[config[_0x3bbe('0x11')]['ip'],config[_0x3bbe('0x11')][_0x3bbe('0x12')],_0x3bbe('0x13')][_0x3bbe('0x14')]('\x20')));}var _0x74f2e3=schema(properties[_0x3bbe('0x74')])[_0x3bbe('0x3')](_0x304a3f);if(_0x74f2e3[_0x3bbe('0x58')]>0x0){return _0x4ac1c8(_0x3fcf1a[_0x3bbe('0x10')](0x1f4,_['map'](_0x74f2e3,_0x3bbe('0x1c'))['join'](',\x20')));}var _0x478762=_[_0x3bbe('0x5d')](_0x41a958['queueChannels'],{'uniqueid':_0x304a3f['uniqueid']});if(_0x478762&&_0x478762[_0x3bbe('0x5f')]){return ami['Action']({'action':_0x3bbe('0x75'),'channel':_0x478762[_0x3bbe('0x5f')],'exten':_0x304a3f[_0x3bbe('0x76')],'context':_0x304a3f['context']||_0x478762['context'],'priority':0x1})[_0x3bbe('0x1b')](function(_0x1fae00){_0x4479b8({'code':0xc8,'message':[_0x304a3f[_0x3bbe('0x5e')],_0x1fae00[_0x3bbe('0x1c')][_0x3bbe('0x68')]()]['join']('\x20')});})[_0x3bbe('0x1d')](function(_0x450628){_0x4ac1c8(_0x3fcf1a[_0x3bbe('0x10')](0x1f5,[_0x304a3f[_0x3bbe('0x5e')],_0x450628['message']['toLowerCase']()]['join']('\x20')));});}else{return _0x4ac1c8(_0x3fcf1a['error'](0x1f5,_0x3bbe('0x69')));}});},'Agents':function(_0x3a77a2){return new Promise(function(_0x2abe40,_0x533f94){var _0x3f933e=_['values'](_0x41a958[_0x3bbe('0xc')]);_0x2abe40({'count':_0x3f933e['length'],'rows':_0x3f933e});});},'Telephones':function(_0x161833){return new Promise(function(_0x2dbf94,_0x1bd91d){var _0x5549b2=_[_0x3bbe('0x59')](_0x41a958[_0x3bbe('0x77')]);_0x2dbf94({'count':_0x5549b2['length'],'rows':_0x5549b2});});},'Trunks':function(_0xddc669){return new Promise(function(_0x138a89,_0x27784c){var _0x2bcbc7=_[_0x3bbe('0x59')](_0x41a958[_0x3bbe('0x78')]);_0x138a89({'count':_0x2bcbc7[_0x3bbe('0x58')],'rows':_0x2bcbc7});});},'OutboundChannels':function(_0x19beeb){return new Promise(function(_0x2922ab,_0x2ed070){var _0x2b7da7=_[_0x3bbe('0x59')](_0x41a958[_0x3bbe('0x79')]);_0x2922ab({'count':_0x2b7da7[_0x3bbe('0x58')],'rows':_0x2b7da7});});},'Outbound':function(_0x393004){return new Promise(function(_0x4aee7c,_0x71072e){_0x4aee7c(_0x41a958[_0x3bbe('0x7a')]);});},'Campaigns':function(_0x3732c2){return new Promise(function(_0x5a7809,_0x29023c){var _0x461605=_['values'](_0x41a958[_0x3bbe('0x7b')]);_0x5a7809({'count':_0x461605[_0x3bbe('0x58')],'rows':_0x461605});});},'VoiceQueuesPreview':function(_0xa6c35b){var _0x279f5d=this;return new Promise(function(_0x288755,_0x5a07a3){_0x1257c2[_0x3bbe('0x7c')](_0xa6c35b['id'])['then'](function(_0x1aad1a){_0x288755({'code':0xc8,'message':_0x1aad1a[_0x3bbe('0x1c')]});})[_0x3bbe('0x1d')](function(_0x57e0b8){_0x5a07a3(_0x279f5d[_0x3bbe('0x10')](0x1f4,_0x57e0b8[_0x3bbe('0x1c')]));});});},'EventManager':function(_0x47b80c){var _0x209ca8=this;return new Promise(function(_0x34eabc,_0x10208c){if(!_0x47b80c[_0x3bbe('0x7d')]){return _0x10208c(_0x209ca8['error'](0x1f4,_0x3bbe('0x7e')));}ami[_0x3bbe('0x7f')](_0x3bbe('0x80')+_0x47b80c[_0x3bbe('0x7d')],_0x47b80c['message']);_0x34eabc({'code':0xc8,'message':_0x47b80c});});},'FaxAccounts':function(_0x541316){return new Promise(function(_0x2430a6,_0x21b3e8){var _0x433b83=_[_0x3bbe('0x59')](_0x41a958[_0x3bbe('0x81')]);_0x2430a6({'count':_0x433b83[_0x3bbe('0x58')],'rows':_0x433b83});});},'SendFax':function(_0x4d2f36){var _0x18f447=this;return new Promise(function(_0x138348,_0x45b2ed){_0x559c21['send'](_0x4d2f36)[_0x3bbe('0x1b')](function(_0x3c6700){_0x138348({'code':0xc8,'message':_0x3c6700[_0x3bbe('0x1c')]});})[_0x3bbe('0x1d')](function(_0xf64c6e){_0x45b2ed(_0x18f447[_0x3bbe('0x10')](0x1f4,_0xf64c6e[_0x3bbe('0x1c')]));});});},'CheckAfterSend':function(_0x297f83){var _0x3db668=this;return new Promise(function(_0x59418d,_0x55e18f){_0x559c21[_0x3bbe('0x82')](_0x297f83)[_0x3bbe('0x1b')](function(_0x52118b){_0x59418d({'code':0xc8,'message':_0x52118b[_0x3bbe('0x1c')]});})[_0x3bbe('0x1d')](function(_0x279f33){_0x55e18f(_0x3db668[_0x3bbe('0x10')](0x1f4,_0x279f33[_0x3bbe('0x1c')]));});});}};var _0x333443=jayson[_0x3bbe('0x83')](_0x4fee0c)['http']();_0x333443['on'](_0x3bbe('0x10'),function(_0x546985){return _0x4d1430(_0x546985);});_0x333443[_0x3bbe('0x84')](0x232a,_0x3bbe('0x85'),function(){console[_0x3bbe('0x86')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3e8ee1(_0x3bbe('0x87')+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 1b21681..34c0bf0 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 _0x44c0=['localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','data1','data2','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','calleridnum','firstName','lastName','mobile','createdAt','updatedAt','union','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','uniqueid','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','destcalleridnum','calleridname','','Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Contact\x20created:%s','push','format','user:%s','name','action','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults'];(function(_0x462a4d,_0x4b1e70){var _0x4ff52c=function(_0x272cf0){while(--_0x272cf0){_0x462a4d['push'](_0x462a4d['shift']());}};_0x4ff52c(++_0x4b1e70);}(_0x44c0,0x1be));var _0x044c=function(_0xc3d6b3,_0x1ce5b4){_0xc3d6b3=_0xc3d6b3-0x0;var _0x3a0c71=_0x44c0[_0xc3d6b3];return _0x3a0c71;};'use strict';var _=require(_0x044c('0x0'));var BPromise=require(_0x044c('0x1'));var Redis=require(_0x044c('0x2'));var util=require(_0x044c('0x3'));var config=require(_0x044c('0x4'));var logger=require(_0x044c('0x5'))(_0x044c('0x6'));var cmContactRpc=require(_0x044c('0x7'));config[_0x044c('0x8')]=_[_0x044c('0x9')](config[_0x044c('0x8')],{'host':_0x044c('0xa'),'port':0x18eb});var io=require(_0x044c('0xb'))(new Redis(config[_0x044c('0x8')]));function emit(_0x311a58,_0x599fc8,_0x3a2040,_0x3470ed,_0x37e7b0){logger[_0x044c('0xc')](_0x044c('0xd'),_0x311a58,_0x599fc8['id'],_0x3a2040,_0x3470ed,JSON[_0x044c('0xe')](_0x37e7b0));io['to'](_0x3a2040)[_0x044c('0xf')](_0x3470ed,_0x37e7b0);}exports['exec']=function(_0x27f336,_0x45e11d,_0x210eef,_0x30d0d2){var _0x6a7d4f,_0x2db349;var _0x48cebe={};var _0x3f32b4=Number(_0x210eef[_0x044c('0x10')]);var _0xe46dc0=_0x210eef[_0x044c('0x11')]?Boolean(Number(_0x210eef[_0x044c('0x11')])):![];var _0xcea05f;if(_0x30d0d2[_0x044c('0x12')]){_0x48cebe['id']=_0x30d0d2[_0x044c('0x12')];}if(!_0x48cebe['id']){_0x48cebe[_0x044c('0x13')]=_0x3f32b4;_0xcea05f=_0x210eef[_0x044c('0x14')]&&_0x210eef[_0x044c('0x14')]!=='0'?_0x210eef[_0x044c('0x14')][_0x044c('0x15')](','):[_0x044c('0x16')];_0x48cebe[_0x044c('0x17')]=_[_0x044c('0x18')](_0xcea05f,function(_0x3400ec){var _0x550046={};_0x550046[_0x3400ec]=_0x30d0d2[_0x044c('0x19')]?_0x30d0d2['destcalleridnum']:_0x30d0d2[_0x044c('0x1a')];return _0x550046;});}var _0x2d88f5=['id',_0x044c('0x1b'),_0x044c('0x1c'),_0x044c('0x16'),_0x044c('0x1d'),'fax',_0x044c('0x13'),_0x044c('0x1e'),'scheduledAt',_0x044c('0x1f')];var _0x5475cd=_[_0x044c('0x20')](_0x2d88f5,_0xcea05f);BPromise[_0x044c('0x21')]()[_0x044c('0x22')](cmContactRpc['getContacts']({'attributes':_0x5475cd,'where':_0x48cebe}))[_0x044c('0x22')](function(_0x399392){_0x2db349=_0x399392;if(!_[_0x044c('0x23')](_0x2db349)){if(_0x2db349[_0x044c('0x24')]===0x1){_0x6a7d4f=_0x2db349[0x0];logger[_0x044c('0xc')](_0x044c('0x25'),_0x30d0d2['uniqueid'],_0x45e11d['id'],_0x6a7d4f['id']);}else{logger[_0x044c('0xc')](_0x044c('0x26'),_0x30d0d2['uniqueid'],_0x45e11d['id'],_[_0x044c('0x18')](_0x2db349,'id')[_0x044c('0x27')](','));}return;}else{logger[_0x044c('0xc')](_0x044c('0x28'),_0x30d0d2[_0x044c('0x29')],_0x45e11d['id']);var _0xe4bbb3={'ListId':_0x3f32b4};var _0x79f744=_0x210eef[_0x044c('0x2a')]&&_0x210eef[_0x044c('0x2a')]!=='0'?_0x210eef[_0x044c('0x2a')]:'phone';if(_0xe46dc0){logger[_0x044c('0xc')](_0x044c('0x2b'),_0x30d0d2[_0x044c('0x29')],_0x45e11d['id']);_0xe4bbb3[_0x79f744]=_[_0x044c('0x2c')](_0x30d0d2[_0x044c('0x19')])?_0x30d0d2[_0x044c('0x1a')]:_0x30d0d2[_0x044c('0x2d')];if(_[_0x044c('0x2c')](_0x30d0d2[_0x044c('0x19')])){_0xe4bbb3[_0x044c('0x1b')]=_0x30d0d2[_0x044c('0x2e')]&&_0x30d0d2[_0x044c('0x2e')]!==_0x044c('0x2f')?_0x30d0d2['calleridname']:_0x044c('0x30');}else{_0xe4bbb3['firstName']=_0x30d0d2['destcalleridname']&&_0x30d0d2[_0x044c('0x31')]!==_0x044c('0x2f')?_0x30d0d2[_0x044c('0x31')]:_0x044c('0x30');}return BPromise[_0x044c('0x21')]()[_0x044c('0x22')](cmContactRpc[_0x044c('0x32')](_0xe4bbb3))['then'](function(_0x3ffa6a){_0x6a7d4f=_0x3ffa6a;_0x2db349['push'](_0x3ffa6a);if(_0x6a7d4f){logger['info'](_0x044c('0x33'),_0x30d0d2[_0x044c('0x29')],_0x45e11d['id'],_0x6a7d4f['id']);}return;});}else{logger[_0x044c('0xc')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x30d0d2['uniqueid'],_0x45e11d['id']);_0xe4bbb3[_0x79f744]=_[_0x044c('0x2c')](_0x30d0d2[_0x044c('0x19')])?_0x30d0d2[_0x044c('0x1a')]:_0x30d0d2[_0x044c('0x2d')];if(_['isNil'](_0x30d0d2[_0x044c('0x19')])){_0xe4bbb3[_0x044c('0x1b')]=_0x30d0d2[_0x044c('0x2e')]&&_0x30d0d2[_0x044c('0x2e')]!==_0x044c('0x2f')?_0x30d0d2['calleridname']:_0x044c('0x30');}else{_0xe4bbb3['firstName']=_0x30d0d2['destcalleridname']&&_0x30d0d2[_0x044c('0x31')]!==_0x044c('0x2f')?_0x30d0d2['destcalleridname']:_0x044c('0x30');}_0x6a7d4f=_0xe4bbb3;_0x2db349[_0x044c('0x34')](_0xe4bbb3);return;}}})['then'](function(){if(_0x27f336){emit(_0x30d0d2[_0x044c('0x29')],_0x45e11d,util[_0x044c('0x35')](_0x044c('0x36'),_0x27f336[_0x044c('0x37')]),util[_0x044c('0x35')]('trigger:%s',_0x210eef[_0x044c('0x38')]['toLowerCase']()),{'evt':_['merge'](_0x30d0d2,{'autoCreate':_0xe46dc0}),'contact':_0x6a7d4f===undefined?{}:_0x6a7d4f,'contacts':_0x2db349[_0x044c('0x24')]===0x0?undefined:_0x2db349});}});}; \ No newline at end of file +var _0x755b=['[CM][%s][%s]\x20Autocreate\x20enabled','isNil','routeId','calleridname','firstName','destcalleridname','','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','format','trigger:%s','action','toLowerCase','merge','lodash','bluebird','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','data1','data2','xmd-contactid','ListId','data3','split','$or','destcalleridnum','calleridnum','lastName','mobile','fax','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Contact\x20not\x20found','data4','phone'];(function(_0x883d7,_0x28edb8){var _0x1559d6=function(_0x2a245b){while(--_0x2a245b){_0x883d7['push'](_0x883d7['shift']());}};_0x1559d6(++_0x28edb8);}(_0x755b,0xfb));var _0xb755=function(_0x276341,_0x4ff417){_0x276341=_0x276341-0x0;var _0x5f2f4c=_0x755b[_0x276341];return _0x5f2f4c;};'use strict';var _=require(_0xb755('0x0'));var BPromise=require(_0xb755('0x1'));var Redis=require('ioredis');var util=require(_0xb755('0x2'));var config=require(_0xb755('0x3'));var logger=require(_0xb755('0x4'))('trigger');var cmContactRpc=require(_0xb755('0x5'));config[_0xb755('0x6')]=_[_0xb755('0x7')](config[_0xb755('0x6')],{'host':_0xb755('0x8'),'port':0x18eb});var io=require(_0xb755('0x9'))(new Redis(config[_0xb755('0x6')]));function emit(_0x3e911b,_0x56df76,_0x3bd3ff,_0x2e1d2c,_0x33a1bf){logger[_0xb755('0xa')](_0xb755('0xb'),_0x3e911b,_0x56df76['id'],_0x3bd3ff,_0x2e1d2c,JSON[_0xb755('0xc')](_0x33a1bf));io['to'](_0x3bd3ff)[_0xb755('0xd')](_0x2e1d2c,_0x33a1bf);}exports['exec']=function(_0x36e672,_0x3e3bed,_0x3e1bb0,_0x3759ef){var _0x84c1e9,_0x2be75d;var _0x1d89f7={};var _0x290996=Number(_0x3e1bb0[_0xb755('0xe')]);var _0x2d8668=_0x3e1bb0[_0xb755('0xf')]?Boolean(Number(_0x3e1bb0[_0xb755('0xf')])):![];var _0x2737fd;if(_0x3759ef[_0xb755('0x10')]){_0x1d89f7['id']=_0x3759ef[_0xb755('0x10')];}if(!_0x1d89f7['id']){_0x1d89f7[_0xb755('0x11')]=_0x290996;_0x2737fd=_0x3e1bb0[_0xb755('0x12')]&&_0x3e1bb0[_0xb755('0x12')]!=='0'?_0x3e1bb0[_0xb755('0x12')][_0xb755('0x13')](','):['phone'];_0x1d89f7[_0xb755('0x14')]=_['map'](_0x2737fd,function(_0x1d10b8){var _0x5dc58b={};_0x5dc58b[_0x1d10b8]=_0x3759ef['routeId']?_0x3759ef[_0xb755('0x15')]:_0x3759ef[_0xb755('0x16')];return _0x5dc58b;});}var _0xac1767=['id','firstName',_0xb755('0x17'),'phone',_0xb755('0x18'),_0xb755('0x19'),_0xb755('0x11'),'createdAt',_0xb755('0x1a'),_0xb755('0x1b')];var _0x25b51d=_[_0xb755('0x1c')](_0xac1767,_0x2737fd);BPromise[_0xb755('0x1d')]()[_0xb755('0x1e')](cmContactRpc[_0xb755('0x1f')]({'attributes':_0x25b51d,'where':_0x1d89f7}))[_0xb755('0x1e')](function(_0x54be1d){_0x2be75d=_0x54be1d;if(!_[_0xb755('0x20')](_0x2be75d)){if(_0x2be75d[_0xb755('0x21')]===0x1){_0x84c1e9=_0x2be75d[0x0];logger['info'](_0xb755('0x22'),_0x3759ef[_0xb755('0x23')],_0x3e3bed['id'],_0x84c1e9['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x3759ef[_0xb755('0x23')],_0x3e3bed['id'],_['map'](_0x2be75d,'id')['join'](','));}return;}else{logger[_0xb755('0xa')](_0xb755('0x24'),_0x3759ef[_0xb755('0x23')],_0x3e3bed['id']);var _0x14ab98={'ListId':_0x290996};var _0x366646=_0x3e1bb0[_0xb755('0x25')]&&_0x3e1bb0[_0xb755('0x25')]!=='0'?_0x3e1bb0[_0xb755('0x25')]:_0xb755('0x26');if(_0x2d8668){logger['info'](_0xb755('0x27'),_0x3759ef['uniqueid'],_0x3e3bed['id']);_0x14ab98[_0x366646]=_[_0xb755('0x28')](_0x3759ef[_0xb755('0x29')])?_0x3759ef['calleridnum']:_0x3759ef[_0xb755('0x15')];if(_[_0xb755('0x28')](_0x3759ef[_0xb755('0x29')])){_0x14ab98['firstName']=_0x3759ef['calleridname']&&_0x3759ef[_0xb755('0x2a')]!==''?_0x3759ef['calleridname']:'Unknown';}else{_0x14ab98[_0xb755('0x2b')]=_0x3759ef[_0xb755('0x2c')]&&_0x3759ef[_0xb755('0x2c')]!==_0xb755('0x2d')?_0x3759ef['destcalleridname']:_0xb755('0x2e');}return BPromise[_0xb755('0x1d')]()[_0xb755('0x1e')](cmContactRpc[_0xb755('0x2f')](_0x14ab98))[_0xb755('0x1e')](function(_0x591413){_0x84c1e9=_0x591413;_0x2be75d[_0xb755('0x30')](_0x591413);if(_0x84c1e9){logger[_0xb755('0xa')](_0xb755('0x31'),_0x3759ef[_0xb755('0x23')],_0x3e3bed['id'],_0x84c1e9['id']);}return;});}else{logger[_0xb755('0xa')](_0xb755('0x32'),_0x3759ef[_0xb755('0x23')],_0x3e3bed['id']);_0x14ab98[_0x366646]=_[_0xb755('0x28')](_0x3759ef[_0xb755('0x29')])?_0x3759ef[_0xb755('0x16')]:_0x3759ef['destcalleridnum'];if(_[_0xb755('0x28')](_0x3759ef['routeId'])){_0x14ab98[_0xb755('0x2b')]=_0x3759ef['calleridname']&&_0x3759ef[_0xb755('0x2a')]!==_0xb755('0x2d')?_0x3759ef[_0xb755('0x2a')]:'Unknown';}else{_0x14ab98[_0xb755('0x2b')]=_0x3759ef[_0xb755('0x2c')]&&_0x3759ef[_0xb755('0x2c')]!==_0xb755('0x2d')?_0x3759ef[_0xb755('0x2c')]:_0xb755('0x2e');}_0x84c1e9=_0x14ab98;_0x2be75d[_0xb755('0x30')](_0x14ab98);return;}}})[_0xb755('0x1e')](function(){if(_0x36e672){emit(_0x3759ef[_0xb755('0x23')],_0x3e3bed,util['format'](_0xb755('0x33'),_0x36e672[_0xb755('0x34')]),util[_0xb755('0x35')](_0xb755('0x36'),_0x3e1bb0[_0xb755('0x37')][_0xb755('0x38')]()),{'evt':_[_0xb755('0x39')](_0x3759ef,{'autoCreate':_0x2d8668}),'contact':_0x84c1e9===undefined?{}:_0x84c1e9,'contacts':_0x2be75d[_0xb755('0x21')]===0x0?undefined:_0x2be75d});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 728fe4d..bd75ba7 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 _0xb922=['stringify','checkTriggers','interface','status','variables','Actions','toLowerCase','contactmanager','motionbar','data1','data2','render','html','template\x20not\x20found','buildUri','data3','isNil','data4','location','uriLocation','windowWidth','800','data5','windowHeight','data6','600','winApplication','user:%s','format','merge','jscripty','name','trigger:%s','action','exec','queue','routeId','urlforward','script','parse','query','search','checkTrigger','AllConditions','length','every','checkConditions','channel','AnyConditions','some','field','account','chat','ChatWebsiteId','value','upperFirst','AccountId','operator','interaction','message','event','agent','membername','lastevent','exports','util','lodash','url','./urlforward','./integration','./cmContact','../../../config/environment','../../../config/logger','trigger','defaults','redis','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','zohoAccounts','custom:agentcalled','syncCustomEvent','custom:agentconnect','custom:agentringnoanswer','bind','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:rejectmessage','prototype','emit','info'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xb922,0x12d));var _0x2b92=function(_0x3ef2d8,_0x4fdf2e){_0x3ef2d8=_0x3ef2d8-0x0;var _0x5c86a5=_0xb922[_0x3ef2d8];return _0x5c86a5;};'use strict';var util=require(_0x2b92('0x0'));var _=require(_0x2b92('0x1'));var url=require(_0x2b92('0x2'));var Mustache=require('mustache');var Redis=require('ioredis');var urlforward=require(_0x2b92('0x3'));var integration=require(_0x2b92('0x4'));var cmContact=require(_0x2b92('0x5'));var script=require('./script');var config=require(_0x2b92('0x6'));var logger=require(_0x2b92('0x7'))(_0x2b92('0x8'));var ami=require('../ami');config['redis']=_[_0x2b92('0x9')](config[_0x2b92('0xa')],{'host':_0x2b92('0xb'),'port':0x18eb});var io=require(_0x2b92('0xc'))(new Redis(config[_0x2b92('0xa')]));var operators={'equals':function(_0x1165ed,_0x5e9c11){return _0x1165ed==_0x5e9c11;},'not_equals':function(_0x5c8f88,_0x458a66){return _0x5c8f88!=_0x458a66;}};var barAndWebActions=[_0x2b92('0xd'),_0x2b92('0x2'),_0x2b92('0xe')];function Trigger(_0x2acf2e){this[_0x2b92('0xf')]=_0x2acf2e[_0x2b92('0xf')];this[_0x2b92('0x10')]=_0x2acf2e[_0x2b92('0x10')];this[_0x2b92('0x11')]=_0x2acf2e[_0x2b92('0x11')];this['templates']=_0x2acf2e[_0x2b92('0x12')];this[_0x2b92('0x13')]=_0x2acf2e[_0x2b92('0x13')];this[_0x2b92('0x14')]=_0x2acf2e['zendeskAccounts'];this['freshdeskAccounts']=_0x2acf2e[_0x2b92('0x15')];this['salesforceAccounts']=_0x2acf2e[_0x2b92('0x16')];this[_0x2b92('0x17')]=_0x2acf2e[_0x2b92('0x17')];this['zohoAccounts']=_0x2acf2e['zohoAccounts'];this[_0x2b92('0x18')]=_0x2acf2e[_0x2b92('0x18')];this[_0x2b92('0x19')]=_0x2acf2e[_0x2b92('0x19')];this['servicenowAccounts']=_0x2acf2e[_0x2b92('0x1a')];this[_0x2b92('0x1b')]=_0x2acf2e[_0x2b92('0x1b')];this[_0x2b92('0x1c')]=_0x2acf2e[_0x2b92('0x1c')];this[_0x2b92('0x1d')]={'zendesk':this[_0x2b92('0x14')],'salesforce':this[_0x2b92('0x16')],'freshdesk':this[_0x2b92('0x15')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x2b92('0x1e')],'desk':this[_0x2b92('0x18')],'vtiger':this[_0x2b92('0x19')],'dynamics365':this[_0x2b92('0x1b')],'freshsales':this[_0x2b92('0x1c')],'servicenow':this[_0x2b92('0x1a')]};ami['on'](_0x2b92('0x1f'),this[_0x2b92('0x20')]['bind'](this));ami['on'](_0x2b92('0x21'),this[_0x2b92('0x20')]['bind'](this));ami['on'](_0x2b92('0x22'),this[_0x2b92('0x20')][_0x2b92('0x23')](this));ami['on'](_0x2b92('0x24'),this['syncCustomEvent'][_0x2b92('0x23')](this));ami['on'](_0x2b92('0x25'),this[_0x2b92('0x20')][_0x2b92('0x23')](this));ami['on'](_0x2b92('0x26'),this[_0x2b92('0x20')][_0x2b92('0x23')](this));ami['on'](_0x2b92('0x27'),this['syncCustomEvent'][_0x2b92('0x23')](this));ami['on'](_0x2b92('0x28'),this[_0x2b92('0x20')][_0x2b92('0x23')](this));ami['on']('custom:agentreject',this[_0x2b92('0x20')][_0x2b92('0x23')](this));ami['on'](_0x2b92('0x29'),this[_0x2b92('0x20')][_0x2b92('0x23')](this));ami['on'](_0x2b92('0x2a'),this['syncCustomEvent'][_0x2b92('0x23')](this));ami['on'](_0x2b92('0x2b'),this[_0x2b92('0x2c')][_0x2b92('0x23')](this));ami['on'](_0x2b92('0x2d'),this[_0x2b92('0x2c')][_0x2b92('0x23')](this));ami['on']('custom:dialend',this[_0x2b92('0x2c')][_0x2b92('0x23')](this));ami['on'](_0x2b92('0x2e'),this['syncCustomEvent'][_0x2b92('0x23')](this));ami['on'](_0x2b92('0x2f'),this[_0x2b92('0x20')][_0x2b92('0x23')](this));ami['on'](_0x2b92('0x30'),this[_0x2b92('0x20')][_0x2b92('0x23')](this));ami['on']('custom:outgoingmessage',this['syncCustomEvent'][_0x2b92('0x23')](this));ami['on']('custom:acceptmessage',this[_0x2b92('0x20')][_0x2b92('0x23')](this));ami['on'](_0x2b92('0x31'),this[_0x2b92('0x20')][_0x2b92('0x23')](this));}Trigger[_0x2b92('0x32')][_0x2b92('0x33')]=function(_0x6b1e8e,_0x4a555e,_0x19dae5){logger[_0x2b92('0x34')](_0x6b1e8e,_0x4a555e,JSON[_0x2b92('0x35')](_0x19dae5));io['to'](_0x6b1e8e)[_0x2b92('0x33')](_0x4a555e,_0x19dae5);};Trigger[_0x2b92('0x32')][_0x2b92('0x20')]=function(_0x1258eb){var _0x34ba5a=_['clone'](_0x1258eb);this[_0x2b92('0x36')](_0x34ba5a);};Trigger[_0x2b92('0x32')]['syncAgentDial']=function(_0x3fdbb6){if(this[_0x2b92('0x10')][_0x3fdbb6[_0x2b92('0x37')]]){this[_0x2b92('0x20')](_0x3fdbb6);}};Trigger['prototype'][_0x2b92('0x36')]=function(_0x4f5431){var _0x513b7b;for(var _0x207d6c in this[_0x2b92('0xf')]){if(this[_0x2b92('0xf')]['hasOwnProperty'](_0x207d6c)){if(this[_0x2b92('0xf')][_0x207d6c][_0x2b92('0x38')]){_0x513b7b=this['checkTrigger'](this[_0x2b92('0xf')][_0x207d6c],_0x4f5431);if(_0x513b7b){_['merge'](_0x4f5431,_0x4f5431[_0x2b92('0x39')]);for(var _0x49f711=0x0,_0x38a158,_0x3ab7ff,_0x113aae;_0x49f7110x0){_0x546166=_[_0xe67a('0x26')](_0x12108c,_0x1c6cb3);}return _0x546166;}function getCustomFields(_0x419a7d,_0x240810){var _0x560e12=[];var _0x5704ed={'custom_fields':{}};if(_0x419a7d[_0xe67a('0x25')]>0x0){_[_0xe67a('0x27')](_0x419a7d,function(_0x4cd887){if(_[_0xe67a('0x28')](['string',_0xe67a('0x29')],_0x4cd887[_0xe67a('0x2a')])&&_0x4cd887[_0xe67a('0x2b')]&&!_0x4cd887[_0xe67a('0x2c')]){_0x5704ed[_0x4cd887[_0xe67a('0x2b')][_0xe67a('0x2d')]()]=_0x4cd887[_0xe67a('0x2e')][_0xe67a('0x1e')]();}else if(_[_0xe67a('0x28')]([_0xe67a('0x2f'),_0xe67a('0x29')],_0x4cd887[_0xe67a('0x2a')])&&_0x4cd887[_0xe67a('0x30')]&&_0x4cd887['customField']){_0x5704ed[_0xe67a('0x31')][_0x4cd887[_0xe67a('0x30')]]=_0x4cd887[_0xe67a('0x2e')][_0xe67a('0x1e')]();}else if(_0x4cd887[_0xe67a('0x2a')]===_0xe67a('0x32')&&_0x4cd887[_0xe67a('0x33')]&&_0x4cd887[_0xe67a('0x30')]&&_0x4cd887[_0xe67a('0x2c')]){_0x240810[_0x4cd887[_0xe67a('0x33')]]&&(_0x5704ed[_0xe67a('0x31')][_0x4cd887[_0xe67a('0x30')]]=_0x240810[_0x4cd887[_0xe67a('0x33')]][_0xe67a('0x1e')]());}else if(_0x4cd887['type']==='customVariable'&&_0x4cd887[_0xe67a('0x34')]&&_0x4cd887[_0xe67a('0x34')]['name']&&_0x4cd887[_0xe67a('0x30')]&&_0x4cd887[_0xe67a('0x2c')]){_0x240810[_0x4cd887['Variable']['name'][_0xe67a('0x2d')]()]&&(_0x5704ed[_0xe67a('0x31')][_0x4cd887[_0xe67a('0x30')]]=_0x240810[_0x4cd887[_0xe67a('0x34')][_0xe67a('0x35')][_0xe67a('0x2d')]()][_0xe67a('0x1e')]());}});}if(_0x5704ed['priority']){_0x5704ed[_0xe67a('0x36')]=Number(_0x5704ed[_0xe67a('0x36')]);}return _0x5704ed;}function getTicket(_0x42365b,_0x4a82d3,_0x5a33cf,_0x4dc400,_0xd576bd){logger[_0xe67a('0x11')](_0xe67a('0x37'));var _0x230823=_[_0xe67a('0x38')]({'subject':intUtil['getString'](_0x4dc400[_0xe67a('0x39')],_0xd576bd,'\x20'),'type':'phone','status':_0xe67a('0x3a'),'labels':[_0xe67a('0x3b'),_0xe67a('0x3c'),_0xe67a('0x3d')][_0xe67a('0x3e')](getTags(_0x4dc400[_0xe67a('0x3f')],_0xe67a('0x35'))),'description':intUtil[_0xe67a('0x40')](_0x4dc400[_0xe67a('0x41')],_0xd576bd,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xe67a('0x42'),_0x4a82d3['id']),'class':_0xe67a('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x4dc400['Descriptions'],_0xd576bd,'\x0a')}},getCustomFields(_0x4dc400[_0xe67a('0x44')],_0xd576bd));return request({'uri':util[_0xe67a('0xa')](_0xe67a('0x45'),_0x42365b[_0xe67a('0xc')],_0x5a33cf['id']),'method':_0xe67a('0x23'),'body':_0x230823});}exports[_0xe67a('0x46')]=function(_0x16e663,_0x5039eb,_0x3c684d,_0x42305a,_0x1e439e,_0x2b263b){var _0x2ad26e,_0x1487ed;_0x2b263b[_0xe67a('0xc')]=intUtil[_0xe67a('0x47')](_0x2b263b[_0xe67a('0xc')]);_0x2b263b['serverUrl']=intUtil['stripTrailingSlash'](_0x2b263b[_0xe67a('0x48')]);if(_0x1e439e&&_0x1e439e[_0xe67a('0x49')]){logger['info']('[QUEUE]',_0xe67a('0x4a'));_0x5039eb['recordingURL']=util[_0xe67a('0xa')](_0xe67a('0x4b'),_0x2b263b[_0xe67a('0x48')],_0x5039eb[_0xe67a('0x4c')],md5(_0x5039eb[_0xe67a('0x4c')]));}else{_0x5039eb[_0xe67a('0x4d')]='';}headers['Authorization']=getAuth(_0x2b263b);return getUser(_0x2b263b,_0x42305a[_0xe67a('0x4e')])[_0xe67a('0xd')](function(_0x59474d){_0x2ad26e=_0x59474d;logger[_0xe67a('0x11')](_0xe67a('0x4f'),_0x2ad26e['id']);return getEndUser(_0x2b263b,_0x5039eb['calleridname'],_0x5039eb['calleridnum']);})[_0xe67a('0xd')](function(_0x4a2435){_0x1487ed=_0x4a2435;logger[_0xe67a('0x11')](_0xe67a('0x50'),_0x1487ed['id']);return getTicket(_0x2b263b,_0x2ad26e,_0x1487ed,_0x3c684d,_0x5039eb);})[_0xe67a('0xd')](function(_0x511552){if(_0x511552){logger['info'](_0xe67a('0x51'));logger[_0xe67a('0x11')](_0xe67a('0x52'),_0x511552['id']);switch(_0x2b263b[_0xe67a('0x2a')]){case _0xe67a('0x53'):logger['info'](_0xe67a('0x54'),_0xe67a('0x55'));emit(util[_0xe67a('0xa')](_0xe67a('0x56'),_0x42305a['name']),_0xe67a('0x57'),{'recordId':_0x511552['id']});break;case _0xe67a('0x58'):logger[_0xe67a('0x11')]('[QUEUE]',_0xe67a('0x59'));emit(util['format'](_0xe67a('0x56'),_0x42305a[_0xe67a('0x35')]),_0xe67a('0x5a'),{'uri':util[_0xe67a('0xa')](_0xe67a('0x5b'),_0x511552['id'])});break;default:logger[_0xe67a('0x5c')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})[_0xe67a('0x5d')](function(_0xe93fc3){console[_0xe67a('0x5c')](_0xe93fc3);logger[_0xe67a('0x5c')]('[QUEUE]',JSON[_0xe67a('0x5e')](_0xe93fc3));});};exports['outbound']=function(_0x564cfc,_0x359cd7,_0x35a9c1,_0x4a4988,_0x5c649a,_0x3ce56e,_0x335d74){var _0x2d623d,_0x5c4b3d;_0x3ce56e[_0xe67a('0xc')]=intUtil['stripTrailingSlash'](_0x3ce56e[_0xe67a('0xc')]);_0x3ce56e[_0xe67a('0x48')]=intUtil[_0xe67a('0x47')](_0x3ce56e['serverUrl']);if(_0x335d74&&_0x335d74[_0xe67a('0x5f')]&&_0x335d74[_0xe67a('0x5f')]!==_0xe67a('0x60')){logger['info'](_0xe67a('0x61'),_0xe67a('0x4a'));_0x359cd7['recordingURL']=util[_0xe67a('0xa')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ce56e[_0xe67a('0x48')],_0x359cd7[_0xe67a('0x4c')],md5(_0x359cd7['uniqueid']));}headers[_0xe67a('0x62')]=getAuth(_0x3ce56e);return getUser(_0x3ce56e,_0x4a4988[_0xe67a('0x4e')])[_0xe67a('0xd')](function(_0x4391ca){_0x2d623d=_0x4391ca;logger['info']('The\x20User\x20ID\x20is:',_0x2d623d['id']);return getEndUser(_0x3ce56e,_0x359cd7[_0xe67a('0x63')],_0x359cd7[_0xe67a('0x64')]);})[_0xe67a('0xd')](function(_0x434b7f){_0x5c4b3d=_0x434b7f;logger[_0xe67a('0x11')](_0xe67a('0x50'),_0x5c4b3d['id']);return getTicket(_0x3ce56e,_0x2d623d,_0x5c4b3d,_0x35a9c1,_0x359cd7);})[_0xe67a('0xd')](function(_0x407d37){if(_0x407d37){logger[_0xe67a('0x11')](_0xe67a('0x51'));logger['info'](_0xe67a('0x52'),_0x407d37['id']);switch(_0x3ce56e[_0xe67a('0x2a')]){case'integrationTab':logger['info']('[QUEUE]',_0xe67a('0x55'));emit(util['format'](_0xe67a('0x56'),_0x4a4988[_0xe67a('0x35')]),_0xe67a('0x57'),{'recordId':_0x407d37['id']});break;case'newTab':logger['info'](_0xe67a('0x54'),_0xe67a('0x59'));emit(util[_0xe67a('0xa')](_0xe67a('0x56'),_0x4a4988[_0xe67a('0x35')]),_0xe67a('0x5a'),{'uri':util[_0xe67a('0xa')]('%s/agent/tickets/%s',_0x3ce56e[_0xe67a('0xc')],_0x407d37['id'])});break;default:logger[_0xe67a('0x5c')](_0xe67a('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x347823){logger[_0xe67a('0x5c')](_0xe67a('0x61'),JSON[_0xe67a('0x5e')](_0x347823));});};exports[_0xe67a('0x65')]=function(_0x1caf9f,_0x11358e,_0x4966c1,_0xbfe67d,_0x65f456,_0x3e7456){var _0xb8094b,_0x5f3a09;_0x3e7456['remoteUri']=intUtil[_0xe67a('0x47')](_0x3e7456['remoteUri']);_0x3e7456[_0xe67a('0x48')]=intUtil[_0xe67a('0x47')](_0x3e7456[_0xe67a('0x48')]);if(_0x65f456&&_0x65f456['monitor_format']){logger[_0xe67a('0x11')]('['+_0x11358e[_0xe67a('0x66')][_0xe67a('0x67')]()+']','Recording\x20is\x20enabled!');_0x11358e[_0xe67a('0x4d')]=util[_0xe67a('0xa')](_0xe67a('0x4b'),_0x3e7456[_0xe67a('0x48')],_0x11358e[_0xe67a('0x4c')],md5(_0x11358e[_0xe67a('0x4c')]));}else{_0x11358e[_0xe67a('0x4d')]='';}headers[_0xe67a('0x62')]=getAuth(_0x3e7456);return getUser(_0x3e7456)[_0xe67a('0xd')](function(_0xd592b){_0xb8094b=_0xd592b;logger[_0xe67a('0x11')](_0xe67a('0x4f'),_0xb8094b['id']);return getEndUser(_0x3e7456,_0x11358e['calleridname'],_0x11358e[_0xe67a('0x68')]);})[_0xe67a('0xd')](function(_0x2ccd99){_0x5f3a09=_0x2ccd99;logger[_0xe67a('0x11')]('The\x20Enduser\x20ID\x20is:',_0x5f3a09['id']);return getTicket(_0x3e7456,_0xb8094b,_0x5f3a09,_0x4966c1,_0x11358e);})[_0xe67a('0xd')](function(_0x40f180){if(_0x40f180){logger[_0xe67a('0x11')](_0xe67a('0x51'));logger['info'](_0xe67a('0x52'),_0x40f180['id']);}})[_0xe67a('0x5d')](function(_0x21dce8){logger['error']('['+_0x11358e[_0xe67a('0x66')]['toUpperCase']()+']',JSON[_0xe67a('0x5e')](_0x21dce8));});}; \ No newline at end of file +var _0xc3de=['toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers','POST','work','length','map','forEach','includes','string','picklist','nameField','toLowerCase','type','customField','idField','content','variable','variableName','custom_fields','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','merge','Subjects','phone','new','xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','integrationTab','user:%s','newTab','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','recordingFormat','none','[OUTBOUND]','Authorization','email','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','lastevent','toUpperCase','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','[HTTP]','stringify','%s:%s','username','password','authType','token','%s/token:%s','Basic\x20%s'];(function(_0x565e97,_0x4d7dd6){var _0x295db5=function(_0x4bc15d){while(--_0x4bc15d){_0x565e97['push'](_0x565e97['shift']());}};_0x295db5(++_0x4d7dd6);}(_0xc3de,0xbc));var _0xec3d=function(_0x220244,_0x6ecb9c){_0x220244=_0x220244-0x0;var _0x58801c=_0xc3de[_0x220244];return _0x58801c;};'use strict';var _=require('lodash');var rp=require(_0xec3d('0x0'));var md5=require(_0xec3d('0x1'));var util=require(_0xec3d('0x2'));var Redis=require(_0xec3d('0x3'));var intUtil=require('./util');var config=require(_0xec3d('0x4'));var logger=require(_0xec3d('0x5'))(_0xec3d('0x6'));config[_0xec3d('0x7')]=_[_0xec3d('0x8')](config['redis'],{'host':_0xec3d('0x9'),'port':0x18eb});var io=require(_0xec3d('0xa'))(new Redis(config[_0xec3d('0x7')]));function emit(_0x321985,_0xbd4f9c,_0x485c08){io['to'](_0x321985)['emit'](_0xbd4f9c,_0x485c08);}var headers={'Content-Type':_0xec3d('0xb'),'Accept':_0xec3d('0xb')};function getUser(_0xbde746,_0x5c405c){if(intUtil[_0xec3d('0xc')](_0x5c405c)===!![]){logger[_0xec3d('0xd')](_0xec3d('0xe'),_0x5c405c);return request({'uri':util[_0xec3d('0xf')](_0xec3d('0x10'),_0xbde746[_0xec3d('0x11')])})[_0xec3d('0x12')](function(_0x25d17a){if(_0x25d17a[_0xec3d('0x13')]){return _[_0xec3d('0x14')](_0x25d17a['_embedded'][_0xec3d('0x15')],{'email':_0x5c405c});}})[_0xec3d('0x12')](function(_0xb9d767){if(_0xb9d767){logger[_0xec3d('0xd')](_0xec3d('0x16'));return _0xb9d767;}else{logger[_0xec3d('0xd')](_0xec3d('0x17'));return request({'uri':util[_0xec3d('0xf')](_0xec3d('0x18'),_0xbde746['remoteUri'])});}});}else{logger[_0xec3d('0xd')](_0xec3d('0x19'));return request({'uri':util[_0xec3d('0xf')]('%s/users/me',_0xbde746['remoteUri'])});}}function request(_0x18af71){logger[_0xec3d('0x1a')](_0xec3d('0x1b'),JSON[_0xec3d('0x1c')](_0x18af71));return rp(_['defaults'](_0x18af71,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x1d547d){var _0xce97f7;if(_0x1d547d['authType']==='basic'){_0xce97f7=util[_0xec3d('0xf')](_0xec3d('0x1d'),_0x1d547d[_0xec3d('0x1e')],_0x1d547d[_0xec3d('0x1f')]);}else if(_0x1d547d[_0xec3d('0x20')]===_0xec3d('0x21')){_0xce97f7=util[_0xec3d('0xf')](_0xec3d('0x22'),_0x1d547d[_0xec3d('0x1e')],_0x1d547d[_0xec3d('0x21')]);}return util[_0xec3d('0xf')](_0xec3d('0x23'),new Buffer(_0xce97f7)[_0xec3d('0x24')](_0xec3d('0x25')));}function getEndUser(_0x1b2c5b,_0xf0c3e1,_0x109018){logger[_0xec3d('0xd')](_0xec3d('0x26'),_0x109018);return request({'uri':util[_0xec3d('0xf')]('%s/customers/search',_0x1b2c5b[_0xec3d('0x11')]),'qs':{'phone':_0x109018}})[_0xec3d('0x12')](function(_0x15c9db){if(_0x15c9db[_0xec3d('0x13')]){logger[_0xec3d('0xd')]('Enduser\x20found!');return _0x15c9db['_embedded']['entries'][0x0];}else{logger[_0xec3d('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0xec3d('0x27'),_0x1b2c5b[_0xec3d('0x11')]),'method':_0xec3d('0x28'),'body':{'first_name':_0xf0c3e1,'title':_0xf0c3e1,'phone_numbers':[{'type':_0xec3d('0x29'),'value':_0x109018}]}});}});}function getTags(_0x54619b,_0x858597){var _0x57c21a=[];if(_0x54619b&&_0x54619b[_0xec3d('0x2a')]>0x0){_0x57c21a=_[_0xec3d('0x2b')](_0x54619b,_0x858597);}return _0x57c21a;}function getCustomFields(_0x54e41b,_0x429677){var _0x52586c=[];var _0x52f2a5={'custom_fields':{}};if(_0x54e41b[_0xec3d('0x2a')]>0x0){_[_0xec3d('0x2c')](_0x54e41b,function(_0x474122){if(_[_0xec3d('0x2d')]([_0xec3d('0x2e'),_0xec3d('0x2f')],_0x474122['type'])&&_0x474122['nameField']&&!_0x474122['customField']){_0x52f2a5[_0x474122[_0xec3d('0x30')][_0xec3d('0x31')]()]=_0x474122['content'][_0xec3d('0x24')]();}else if(_[_0xec3d('0x2d')]([_0xec3d('0x2e'),_0xec3d('0x2f')],_0x474122[_0xec3d('0x32')])&&_0x474122['idField']&&_0x474122[_0xec3d('0x33')]){_0x52f2a5['custom_fields'][_0x474122[_0xec3d('0x34')]]=_0x474122[_0xec3d('0x35')]['toString']();}else if(_0x474122['type']===_0xec3d('0x36')&&_0x474122[_0xec3d('0x37')]&&_0x474122[_0xec3d('0x34')]&&_0x474122[_0xec3d('0x33')]){_0x429677[_0x474122[_0xec3d('0x37')]]&&(_0x52f2a5[_0xec3d('0x38')][_0x474122[_0xec3d('0x34')]]=_0x429677[_0x474122[_0xec3d('0x37')]]['toString']());}else if(_0x474122['type']===_0xec3d('0x39')&&_0x474122[_0xec3d('0x3a')]&&_0x474122[_0xec3d('0x3a')][_0xec3d('0x3b')]&&_0x474122[_0xec3d('0x34')]&&_0x474122[_0xec3d('0x33')]){_0x429677[_0x474122[_0xec3d('0x3a')][_0xec3d('0x3b')][_0xec3d('0x31')]()]&&(_0x52f2a5[_0xec3d('0x38')][_0x474122[_0xec3d('0x34')]]=_0x429677[_0x474122[_0xec3d('0x3a')][_0xec3d('0x3b')]['toLowerCase']()][_0xec3d('0x24')]());}});}if(_0x52f2a5[_0xec3d('0x3c')]){_0x52f2a5['priority']=Number(_0x52f2a5['priority']);}return _0x52f2a5;}function getTicket(_0x50e2f8,_0xd1cef4,_0x3133b8,_0x5dca59,_0x3dc106){logger[_0xec3d('0xd')](_0xec3d('0x3d'));var _0x51ff70=_[_0xec3d('0x3e')]({'subject':intUtil['getString'](_0x5dca59[_0xec3d('0x3f')],_0x3dc106,'\x20'),'type':_0xec3d('0x40'),'status':_0xec3d('0x41'),'labels':[_0xec3d('0x42'),_0xec3d('0x43'),_0xec3d('0x44')][_0xec3d('0x45')](getTags(_0x5dca59[_0xec3d('0x46')],_0xec3d('0x3b'))),'description':intUtil[_0xec3d('0x47')](_0x5dca59[_0xec3d('0x48')],_0x3dc106,'\x0a'),'_links':{'assigned_user':{'href':util[_0xec3d('0xf')]('/api/v2/users/%d',_0xd1cef4['id']),'class':_0xec3d('0x49')}},'message':{'direction':'in','body':intUtil[_0xec3d('0x47')](_0x5dca59[_0xec3d('0x48')],_0x3dc106,'\x0a')}},getCustomFields(_0x5dca59[_0xec3d('0x4a')],_0x3dc106));return request({'uri':util[_0xec3d('0xf')](_0xec3d('0x4b'),_0x50e2f8[_0xec3d('0x11')],_0x3133b8['id']),'method':'POST','body':_0x51ff70});}exports[_0xec3d('0x4c')]=function(_0x5d9fe4,_0x263601,_0x5d26c5,_0x318df4,_0x3615dd,_0x3b4617){var _0x42b603,_0x4e648;_0x3b4617[_0xec3d('0x11')]=intUtil[_0xec3d('0x4d')](_0x3b4617[_0xec3d('0x11')]);_0x3b4617[_0xec3d('0x4e')]=intUtil[_0xec3d('0x4d')](_0x3b4617[_0xec3d('0x4e')]);if(_0x3615dd&&_0x3615dd[_0xec3d('0x4f')]){logger[_0xec3d('0xd')](_0xec3d('0x50'),_0xec3d('0x51'));_0x263601[_0xec3d('0x52')]=util[_0xec3d('0xf')](_0xec3d('0x53'),_0x3b4617[_0xec3d('0x4e')],_0x263601['uniqueid'],md5(_0x263601[_0xec3d('0x54')]));}else{_0x263601[_0xec3d('0x52')]='';}headers['Authorization']=getAuth(_0x3b4617);return getUser(_0x3b4617,_0x318df4['email'])[_0xec3d('0x12')](function(_0x2fb3d2){_0x42b603=_0x2fb3d2;logger['info'](_0xec3d('0x55'),_0x42b603['id']);return getEndUser(_0x3b4617,_0x263601[_0xec3d('0x56')],_0x263601[_0xec3d('0x57')]);})[_0xec3d('0x12')](function(_0x4b45a9){_0x4e648=_0x4b45a9;logger[_0xec3d('0xd')](_0xec3d('0x58'),_0x4e648['id']);return getTicket(_0x3b4617,_0x42b603,_0x4e648,_0x5d26c5,_0x263601);})[_0xec3d('0x12')](function(_0x15c48b){if(_0x15c48b){logger[_0xec3d('0xd')](_0xec3d('0x59'));logger[_0xec3d('0xd')]('The\x20Ticket\x20ID\x20is:',_0x15c48b['id']);switch(_0x3b4617['type']){case _0xec3d('0x5a'):logger[_0xec3d('0xd')](_0xec3d('0x50'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xec3d('0xf')](_0xec3d('0x5b'),_0x318df4[_0xec3d('0x3b')]),'trigger:desk:display',{'recordId':_0x15c48b['id']});break;case _0xec3d('0x5c'):logger[_0xec3d('0xd')](_0xec3d('0x50'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xec3d('0xf')](_0xec3d('0x5b'),_0x318df4['name']),_0xec3d('0x5d'),{'uri':util[_0xec3d('0xf')](_0xec3d('0x5e'),_0x15c48b['id'])});break;default:logger[_0xec3d('0x5f')](_0xec3d('0x50'),_0xec3d('0x60'));}}})[_0xec3d('0x61')](function(_0x50ade0){console[_0xec3d('0x5f')](_0x50ade0);logger[_0xec3d('0x5f')](_0xec3d('0x50'),JSON[_0xec3d('0x1c')](_0x50ade0));});};exports['outbound']=function(_0x5a9c43,_0x27dc64,_0x44d77c,_0x2de33c,_0x3e8413,_0x59ddcc,_0x3400d3){var _0x5b7788,_0x2b4869;_0x59ddcc[_0xec3d('0x11')]=intUtil[_0xec3d('0x4d')](_0x59ddcc[_0xec3d('0x11')]);_0x59ddcc[_0xec3d('0x4e')]=intUtil[_0xec3d('0x4d')](_0x59ddcc[_0xec3d('0x4e')]);if(_0x3400d3&&_0x3400d3[_0xec3d('0x62')]&&_0x3400d3[_0xec3d('0x62')]!==_0xec3d('0x63')){logger[_0xec3d('0xd')](_0xec3d('0x64'),'Recording\x20is\x20enabled!');_0x27dc64[_0xec3d('0x52')]=util[_0xec3d('0xf')](_0xec3d('0x53'),_0x59ddcc['serverUrl'],_0x27dc64['uniqueid'],md5(_0x27dc64[_0xec3d('0x54')]));}headers[_0xec3d('0x65')]=getAuth(_0x59ddcc);return getUser(_0x59ddcc,_0x2de33c[_0xec3d('0x66')])[_0xec3d('0x12')](function(_0x68873){_0x5b7788=_0x68873;logger[_0xec3d('0xd')](_0xec3d('0x55'),_0x5b7788['id']);return getEndUser(_0x59ddcc,_0x27dc64[_0xec3d('0x67')],_0x27dc64[_0xec3d('0x68')]);})[_0xec3d('0x12')](function(_0x1323a7){_0x2b4869=_0x1323a7;logger['info'](_0xec3d('0x58'),_0x2b4869['id']);return getTicket(_0x59ddcc,_0x5b7788,_0x2b4869,_0x44d77c,_0x27dc64);})[_0xec3d('0x12')](function(_0x12ea0c){if(_0x12ea0c){logger['info'](_0xec3d('0x59'));logger[_0xec3d('0xd')](_0xec3d('0x69'),_0x12ea0c['id']);switch(_0x59ddcc['type']){case _0xec3d('0x5a'):logger[_0xec3d('0xd')]('[QUEUE]',_0xec3d('0x6a'));emit(util[_0xec3d('0xf')](_0xec3d('0x5b'),_0x2de33c[_0xec3d('0x3b')]),_0xec3d('0x6b'),{'recordId':_0x12ea0c['id']});break;case _0xec3d('0x5c'):logger[_0xec3d('0xd')](_0xec3d('0x50'),_0xec3d('0x6c'));emit(util[_0xec3d('0xf')](_0xec3d('0x5b'),_0x2de33c[_0xec3d('0x3b')]),_0xec3d('0x5d'),{'uri':util[_0xec3d('0xf')](_0xec3d('0x6d'),_0x59ddcc['remoteUri'],_0x12ea0c['id'])});break;default:logger['error'](_0xec3d('0x64'),_0xec3d('0x60'));}}})[_0xec3d('0x61')](function(_0x2ff6b2){logger[_0xec3d('0x5f')](_0xec3d('0x64'),JSON['stringify'](_0x2ff6b2));});};exports['unmanaged']=function(_0x136ca8,_0x16af6d,_0x4306a8,_0x23477f,_0x9b50ea,_0x1f2465){var _0x575ab8,_0x58a112;_0x1f2465[_0xec3d('0x11')]=intUtil[_0xec3d('0x4d')](_0x1f2465[_0xec3d('0x11')]);_0x1f2465[_0xec3d('0x4e')]=intUtil[_0xec3d('0x4d')](_0x1f2465[_0xec3d('0x4e')]);if(_0x9b50ea&&_0x9b50ea['monitor_format']){logger['info']('['+_0x16af6d[_0xec3d('0x6e')][_0xec3d('0x6f')]()+']',_0xec3d('0x51'));_0x16af6d['recordingURL']=util[_0xec3d('0xf')](_0xec3d('0x53'),_0x1f2465[_0xec3d('0x4e')],_0x16af6d[_0xec3d('0x54')],md5(_0x16af6d[_0xec3d('0x54')]));}else{_0x16af6d[_0xec3d('0x52')]='';}headers[_0xec3d('0x65')]=getAuth(_0x1f2465);return getUser(_0x1f2465)[_0xec3d('0x12')](function(_0x4d002d){_0x575ab8=_0x4d002d;logger[_0xec3d('0xd')](_0xec3d('0x55'),_0x575ab8['id']);return getEndUser(_0x1f2465,_0x16af6d[_0xec3d('0x56')],_0x16af6d['calleridnum']);})['then'](function(_0x22cc28){_0x58a112=_0x22cc28;logger[_0xec3d('0xd')](_0xec3d('0x58'),_0x58a112['id']);return getTicket(_0x1f2465,_0x575ab8,_0x58a112,_0x4306a8,_0x16af6d);})[_0xec3d('0x12')](function(_0x40c3c5){if(_0x40c3c5){logger[_0xec3d('0xd')](_0xec3d('0x59'));logger[_0xec3d('0xd')](_0xec3d('0x69'),_0x40c3c5['id']);}})[_0xec3d('0x61')](function(_0x4e7dac){logger[_0xec3d('0x5f')]('['+_0x16af6d['lastevent'][_0xec3d('0x6f')]()+']',JSON['stringify'](_0x4e7dac));});}; \ 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 37a29be..7c00259 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 _0xf40b=['catch','error','toUpperCase',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','validateEmail','userEmail','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','message','outbound','calleridnum','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','4.0','destcalleridnum','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','picklist','type','customField','idField','toLowerCase','indexOf','content','ticketType','incident','assign','getString','Subjects','/contacts(','Fields','phonecalls','Descriptions','callDirection','queue','format','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','ticketId',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','util','./util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','then','access_token'];(function(_0x2b3bd8,_0x2d3b69){var _0x2299b3=function(_0x12d911){while(--_0x12d911){_0x2b3bd8['push'](_0x2b3bd8['shift']());}};_0x2299b3(++_0x2d3b69);}(_0xf40b,0xb0));var _0xbf40=function(_0x168c60,_0x539d96){_0x168c60=_0x168c60-0x0;var _0x29bea4=_0xf40b[_0x168c60];return _0x29bea4;};'use strict';var _=require('lodash');var BPromise=require(_0xbf40('0x0'));var rp=require(_0xbf40('0x1'));var util=require(_0xbf40('0x2'));var intUtil=require(_0xbf40('0x3'));var md5=require('md5');var Redis=require(_0xbf40('0x4'));var logger=require(_0xbf40('0x5'))(_0xbf40('0x6'));var config=require(_0xbf40('0x7'));config[_0xbf40('0x8')]=_['defaults'](config[_0xbf40('0x8')],{'host':_0xbf40('0x9'),'port':0x18eb});var io=require(_0xbf40('0xa'))(new Redis(config[_0xbf40('0x8')]));function getAuthToken(_0x1d5add,_0x4c0875,_0x5f525c){var _0x31cd41={'method':_0xbf40('0xb'),'uri':_0x4c0875,'form':{'client_id':_0x1d5add[_0xbf40('0xc')],'resource':_0x1d5add[_0xbf40('0xd')],'username':_0x1d5add[_0xbf40('0xe')],'password':_0x1d5add[_0xbf40('0xf')],'grant_type':_0xbf40('0xf'),'client_secret':_0x1d5add['clientSecret']},'json':!![]};return rp(_0x31cd41)[_0xbf40('0x10')](function(_0x38d607){return _0x38d607[_0xbf40('0x11')];})[_0xbf40('0x12')](function(_0x380a1e){logger[_0xbf40('0x13')]('['+[_0x5f525c[_0xbf40('0x14')]()]+_0xbf40('0x15'));return _0x380a1e['message'];});}function getUser(_0x592293,_0x6e3496,_0x3f86b5,_0x2cecca,_0x106e68,_0x562346){return new BPromise(function(_0xb61909,_0x3c9329){return getAuthToken(_0x6e3496,_0x2cecca,_0x562346)[_0xbf40('0x10')](function(_0x347473){var _0x39a323={'method':_0xbf40('0x16'),'uri':_0x106e68+_0xbf40('0x17'),'headers':{'Authorization':_0xbf40('0x18')+_0x347473,'OData-Version':'4.0'},'json':!![]};return rp(_0x39a323);})[_0xbf40('0x10')](function(_0xe9cc90){var _0x28b9e1=_0xe9cc90[_0xbf40('0x19')];var _0x391ea1=![];var _0x414123=null;if(!_[_0xbf40('0x1a')](_0x3f86b5)){if(intUtil[_0xbf40('0x1b')](_0x3f86b5['email'])){_0x592293[_0xbf40('0x1c')]=_0x3f86b5[_0xbf40('0x1d')];for(_0x414123=0x0;_0x414123<_0x28b9e1[_0xbf40('0x1e')];_0x414123++){if(_0x28b9e1[_0x414123][_0xbf40('0x1f')]===_0x3f86b5['email']&&!_0x28b9e1[_0x414123][_0xbf40('0x20')]){_0x391ea1=!![];logger[_0xbf40('0x21')]('['+[_0x562346[_0xbf40('0x14')]()]+_0xbf40('0x22')+_0x28b9e1[_0x414123][_0xbf40('0x23')]+'!');_0x592293[_0xbf40('0x24')]=_0x28b9e1[_0x414123][_0xbf40('0x23')];}}}}if(!_0x391ea1){logger[_0xbf40('0x21')]('['+[_0x562346[_0xbf40('0x14')]()]+_0xbf40('0x25'));_0x592293[_0xbf40('0x1c')]=_0x6e3496[_0xbf40('0xe')];for(_0x414123=0x0;_0x414123<_0x28b9e1[_0xbf40('0x1e')];_0x414123++){if(_0x28b9e1[_0x414123][_0xbf40('0x1f')]===_0x6e3496[_0xbf40('0xe')]){_0x592293[_0xbf40('0x24')]=_0x28b9e1[_0x414123]['systemuserid'];}}}_0xb61909(_0x592293);})[_0xbf40('0x12')](function(_0x1a4b48){_0x3c9329(_0x1a4b48[_0xbf40('0x26')]);});});}function createEndUser(_0xb9adcd,_0x2d3936,_0x383b1c,_0x2464d9,_0x1ceb97,_0x40f563){return new BPromise(function(_0x266468,_0x2faef5){return getAuthToken(_0x2d3936,_0x383b1c,_0x40f563)[_0xbf40('0x10')](function(_0x2af9ce){var _0x3db5e7=_0x40f563['toLowerCase']()===_0xbf40('0x27')?_0x1ceb97['destcalleridnum']:_0x1ceb97[_0xbf40('0x28')];var _0x3db8bc={'method':_0xbf40('0xb'),'uri':_0x2464d9+'contacts','body':{'telephone1':_0x3db5e7,'fullname':_0x3db5e7,'firstname':_0x3db5e7,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xbf40('0x29')+_0xb9adcd[_0xbf40('0x24')]+')'},'headers':{'Authorization':_0xbf40('0x18')+_0x2af9ce,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x3db8bc);})[_0xbf40('0x10')](function(_0x5b99ea){var _0x186dc1=_0x5b99ea[_0xbf40('0x2a')][_0xbf40('0x2b')];var _0x53f872=_0x186dc1[_0xbf40('0x2c')](_0x186dc1[_0xbf40('0x2d')]('(')+0x1,_0x186dc1[_0xbf40('0x2d')](')'));_0xb9adcd[_0xbf40('0x2e')]=_0x53f872;_0x266468(_0xb9adcd);})[_0xbf40('0x12')](function(_0x38e39f){_0x2faef5(_0x38e39f[_0xbf40('0x26')]);});});}function getEndUser(_0x387f15,_0x274af2,_0x47c24c,_0x379fa1,_0xcf3823,_0x237bff){return new BPromise(function(_0x4d8ee,_0x5c5e79){return getAuthToken(_0x274af2,_0x47c24c,_0x237bff)[_0xbf40('0x10')](function(_0x5dae1f){var _0x4acd9e={'method':_0xbf40('0x16'),'uri':_0x379fa1+_0xbf40('0x2f'),'headers':{'Authorization':'Bearer\x20'+_0x5dae1f,'If-None-Match':null,'OData-Version':_0xbf40('0x30')},'json':!![]};return rp(_0x4acd9e);})[_0xbf40('0x10')](function(_0x2edb11){var _0xba837b=null;if(_0x2edb11){var _0x22860d=_0x2edb11['value'];var _0x19a31d=![];for(_0xba837b=0x0;_0xba837b<_0x22860d[_0xbf40('0x1e')];_0xba837b++){var _0xa7ad3a=_0x237bff['toLowerCase']()===_0xbf40('0x27')?_0xcf3823[_0xbf40('0x31')]:_0xcf3823[_0xbf40('0x28')];if(_0x22860d[_0xba837b]['telephone1']===_0xa7ad3a){_0x19a31d=!![];_0x387f15[_0xbf40('0x2e')]=_0x22860d[_0xba837b][_0xbf40('0x32')];}}if(_0x19a31d){_0x4d8ee(_0x387f15);}else{return createEndUser(_0x387f15,_0x274af2,_0x47c24c,_0x379fa1,_0xcf3823,_0x237bff)[_0xbf40('0x10')](function(_0x3b4231){logger[_0xbf40('0x21')]('['+[_0x237bff[_0xbf40('0x14')]()]+_0xbf40('0x33'),_0x3b4231[_0xbf40('0x2e')]);_0x4d8ee(_0x3b4231);});}}else{return createEndUser(_0x387f15,_0x274af2,_0x47c24c,_0x379fa1,_0xcf3823,_0x237bff)[_0xbf40('0x10')](function(_0x3fea7e){logger[_0xbf40('0x21')]('['+[_0x237bff[_0xbf40('0x14')]()]+_0xbf40('0x34'),_0x3fea7e[_0xbf40('0x2e')]);_0x4d8ee(_0x3fea7e);});}});});}function getCustomFields(_0x566861,_0xf2ff2a,_0x554e3d){var _0x17aa55={};if(_0x566861[_0xbf40('0x1e')]>0x0){_[_0xbf40('0x35')](_0x566861,function(_0x1d9cfe){if(_[_0xbf40('0x36')](['string',_0xbf40('0x37')],_0x1d9cfe[_0xbf40('0x38')])&&_0x1d9cfe['nameField']&&!_0x1d9cfe[_0xbf40('0x39')]){var _0x58bd28=_0x1d9cfe[_0xbf40('0x3a')][_0xbf40('0x3b')]();var _0x21db9b=_0x58bd28[_0xbf40('0x2c')](0x0,_0x58bd28[_0xbf40('0x3c')]('_'));var _0x2d370c=_0x58bd28[_0xbf40('0x2c')](_0x58bd28['indexOf']('_')+0x1);if(_0x21db9b===_0x554e3d){_0x17aa55[_0x2d370c]=_0x1d9cfe[_0xbf40('0x3d')];}}});}return _0x17aa55;}function getTicket(_0x36e38a,_0xdd2a0,_0xaf4311,_0x1aa935,_0x234ba1,_0x1da001,_0x165a36){return new BPromise(function(_0x589613,_0x1c11c9){var _0x5f167f;return getAuthToken(_0xdd2a0,_0xaf4311,_0x165a36)[_0xbf40('0x10')](function(_0x2ff937){if(_0x1da001[_0xbf40('0x3e')]===_0xbf40('0x3f')){_0x5f167f={'method':'POST','uri':_0x1aa935+'incidents','body':Object[_0xbf40('0x40')]({},{'title':intUtil[_0xbf40('0x41')](_0x1da001[_0xbf40('0x42')],_0x234ba1,'\x20'),'description':intUtil['getString'](_0x1da001['Descriptions'],_0x234ba1,'\x0a'),'customerid_contact@odata.bind':_0xbf40('0x43')+_0x36e38a['enduserId']+')','ownerid@odata.bind':_0xbf40('0x29')+_0x36e38a['userId']+')','caseorigincode':'1'},getCustomFields(_0x1da001[_0xbf40('0x44')],_0x234ba1,_0x1da001[_0xbf40('0x3e')])),'headers':{'Authorization':'Bearer\x20'+_0x2ff937,'OData-Version':_0xbf40('0x30')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1da001[_0xbf40('0x3e')]==='phonecall'){_0x5f167f={'method':'POST','uri':_0x1aa935+_0xbf40('0x45'),'body':Object[_0xbf40('0x40')]({},{'subject':intUtil['getString'](_0x1da001[_0xbf40('0x42')],_0x234ba1,'\x20'),'phonenumber':String(_0x234ba1[_0xbf40('0x28')]),'description':intUtil[_0xbf40('0x41')](_0x1da001[_0xbf40('0x46')],_0x234ba1,'\x0a'),'regardingobjectid_contact@odata.bind':_0xbf40('0x43')+_0x36e38a['enduserId']+')','ownerid@odata.bind':_0xbf40('0x29')+_0x36e38a[_0xbf40('0x24')]+')','directioncode':_0x36e38a[_0xbf40('0x47')]===_0xbf40('0x48')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xbf40('0x29')+_0x36e38a[_0xbf40('0x24')]+')','participationtypemask':_0x36e38a[_0xbf40('0x47')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x36e38a[_0xbf40('0x2e')]+')','participationtypemask':_0x36e38a[_0xbf40('0x47')]==='queue'?0x1:0x2}]},getCustomFields(_0x1da001[_0xbf40('0x44')],_0x234ba1,_0x1da001[_0xbf40('0x3e')])),'headers':{'Authorization':_0xbf40('0x18')+_0x2ff937,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5f167f);})[_0xbf40('0x10')](function(_0x39010d){var _0x468a44=_0x39010d['headers'][_0xbf40('0x2b')];var _0x57e200=_0x468a44[_0xbf40('0x2c')](_0x468a44['lastIndexOf']('(')+0x1,_0x468a44[_0xbf40('0x2d')](')'));_0x36e38a['ticketId']=_0x57e200;_0x589613(_0x36e38a);})[_0xbf40('0x12')](function(_0x39515b){_0x1c11c9(_0x39515b[_0xbf40('0x26')]);});});}function emit(_0x3ec9cf,_0x12837f,_0x35c15b,_0x360c82){var _0x3cda5d={'uri':util[_0xbf40('0x49')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x3ec9cf,_0x35c15b,_0x360c82)};io['to'](util[_0xbf40('0x49')]('user:%s',_0x12837f))['emit'](_0xbf40('0x4a'),_0x3cda5d);}exports['cs']=function(_0x551dca,_0x44804c,_0xb8a729,_0x7575c7,_0x3a78f6,_0x52e5ed,_0x4b4107,_0x2b18ed){var _0xc604e4={};_0x52e5ed['remoteUri']=intUtil[_0xbf40('0x4b')](_0x52e5ed['remoteUri']);_0x52e5ed[_0xbf40('0x4c')]=intUtil['stripTrailingSlash'](_0x52e5ed['serverUrl']);_0xc604e4['callDirection']=_0x2b18ed==='queue'||_0x2b18ed==='unmanaged'?_0xbf40('0x48'):_0xbf40('0x27');var _0x3294d6=util[_0xbf40('0x49')](_0xbf40('0x4d'),_0x52e5ed['remoteUri']);var _0x280578=util[_0xbf40('0x49')](_0xbf40('0x4e'),_0x52e5ed[_0xbf40('0x4f')]);var _0x2bf5ce=util[_0xbf40('0x49')](_0xbf40('0x50'),_0x52e5ed[_0xbf40('0x4c')],_0x44804c[_0xbf40('0x51')],md5(_0x44804c[_0xbf40('0x51')]));if(_0x3a78f6&&_0x3a78f6['monitor_format']){logger['info'](_0xbf40('0x52'),_0xbf40('0x53'));_0x44804c[_0xbf40('0x54')]=_0x2bf5ce;}else if(_0x4b4107&&_0x4b4107[_0xbf40('0x55')]&&_0x4b4107[_0xbf40('0x55')]!=='none'){logger[_0xbf40('0x21')](_0xbf40('0x56'),_0xbf40('0x53'));_0x44804c[_0xbf40('0x54')]=_0x2bf5ce;}else{_0x44804c[_0xbf40('0x54')]='';}return getUser(_0xc604e4,_0x52e5ed,_0x7575c7,_0x280578,_0x3294d6,_0x2b18ed)[_0xbf40('0x10')](function(_0x52148a){logger['info']('['+_0x2b18ed[_0xbf40('0x14')]()+_0xbf40('0x57'),_0x52148a[_0xbf40('0x24')]);logger['info']('['+_0x2b18ed[_0xbf40('0x14')]()+_0xbf40('0x58'),_0x52148a[_0xbf40('0x1c')]);return getEndUser(_0x52148a,_0x52e5ed,_0x280578,_0x3294d6,_0x44804c,_0x2b18ed);})[_0xbf40('0x10')](function(_0x3df531){logger[_0xbf40('0x21')]('['+_0x2b18ed[_0xbf40('0x14')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x3df531['enduserId']);logger[_0xbf40('0x21')]('['+_0x2b18ed[_0xbf40('0x14')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x44804c[_0xbf40('0x28')]);return getTicket(_0x3df531,_0x52e5ed,_0x280578,_0x3294d6,_0x44804c,_0xb8a729,_0x2b18ed);})[_0xbf40('0x10')](function(_0x168627){logger[_0xbf40('0x21')](util[_0xbf40('0x49')]('['+_0x2b18ed['toUpperCase']()+_0xbf40('0x59'),_0xb8a729[_0xbf40('0x3e')],_0x168627['ticketId']));logger[_0xbf40('0x21')](util[_0xbf40('0x49')]('['+_0x2b18ed[_0xbf40('0x14')]()+_0xbf40('0x5a'),_0x2b18ed));if(_0x2b18ed!==_0xbf40('0x5b')){logger[_0xbf40('0x21')]('['+_0x2b18ed[_0xbf40('0x14')]()+']',_0xbf40('0x5c'));emit(_0x52e5ed[_0xbf40('0xd')],_0x7575c7[_0xbf40('0x5d')],_0xb8a729[_0xbf40('0x3e')],_0x168627[_0xbf40('0x5e')]);}})['catch'](function(_0x507d26){logger[_0xbf40('0x13')]('['+_0x2b18ed[_0xbf40('0x14')]()+_0xbf40('0x5f'),util[_0xbf40('0x60')](_0x507d26,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xda19=['%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','ticketId',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','./util','ioredis','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','clientId','username','password','clientSecret','then','access_token','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','validateEmail','email','userEmail','length','internalemailaddress','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','POST','contacts','/systemusers(','odata-entityid','lastIndexOf','enduserId','catch','Bearer\x20','outbound','destcalleridnum','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','picklist','substring','indexOf','content','ticketType','incident','incidents','getString','Subjects','/contacts(','Fields','phonecall','phonecalls','calleridnum','Descriptions','queue','callDirection','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','unmanaged'];(function(_0x3dc1a0,_0x1c10de){var _0x5c9f7f=function(_0x590234){while(--_0x590234){_0x3dc1a0['push'](_0x3dc1a0['shift']());}};_0x5c9f7f(++_0x1c10de);}(_0xda19,0xd5));var _0x9da1=function(_0x1178c3,_0x1e719f){_0x1178c3=_0x1178c3-0x0;var _0x23acab=_0xda19[_0x1178c3];return _0x23acab;};'use strict';var _=require('lodash');var BPromise=require(_0x9da1('0x0'));var rp=require(_0x9da1('0x1'));var util=require('util');var intUtil=require(_0x9da1('0x2'));var md5=require('md5');var Redis=require(_0x9da1('0x3'));var logger=require('../../../../config/logger')(_0x9da1('0x4'));var config=require(_0x9da1('0x5'));config[_0x9da1('0x6')]=_[_0x9da1('0x7')](config[_0x9da1('0x6')],{'host':_0x9da1('0x8'),'port':0x18eb});var io=require(_0x9da1('0x9'))(new Redis(config[_0x9da1('0x6')]));function getAuthToken(_0x1c24e6,_0x5e2d18,_0x47df89){var _0x55f66b={'method':'POST','uri':_0x5e2d18,'form':{'client_id':_0x1c24e6[_0x9da1('0xa')],'resource':_0x1c24e6['remoteUri'],'username':_0x1c24e6[_0x9da1('0xb')],'password':_0x1c24e6[_0x9da1('0xc')],'grant_type':_0x9da1('0xc'),'client_secret':_0x1c24e6[_0x9da1('0xd')]},'json':!![]};return rp(_0x55f66b)[_0x9da1('0xe')](function(_0x396e23){return _0x396e23[_0x9da1('0xf')];})['catch'](function(_0x51bc88){logger[_0x9da1('0x10')]('['+[_0x47df89['toUpperCase']()]+_0x9da1('0x11'));return _0x51bc88[_0x9da1('0x12')];});}function getUser(_0xd2d225,_0x1ffa2a,_0x4b75cc,_0x2837e3,_0x535a13,_0x4d17e1){return new BPromise(function(_0x40ba9d,_0x479ccd){return getAuthToken(_0x1ffa2a,_0x2837e3,_0x4d17e1)[_0x9da1('0xe')](function(_0x43c093){var _0x37653d={'method':_0x9da1('0x13'),'uri':_0x535a13+_0x9da1('0x14'),'headers':{'Authorization':'Bearer\x20'+_0x43c093,'OData-Version':_0x9da1('0x15')},'json':!![]};return rp(_0x37653d);})[_0x9da1('0xe')](function(_0xf83bf8){var _0x77347a=_0xf83bf8[_0x9da1('0x16')];var _0x42a9c7=![];var _0x497676=null;if(!_['isNil'](_0x4b75cc)){if(intUtil[_0x9da1('0x17')](_0x4b75cc[_0x9da1('0x18')])){_0xd2d225[_0x9da1('0x19')]=_0x4b75cc[_0x9da1('0x18')];for(_0x497676=0x0;_0x497676<_0x77347a[_0x9da1('0x1a')];_0x497676++){if(_0x77347a[_0x497676][_0x9da1('0x1b')]===_0x4b75cc[_0x9da1('0x18')]&&!_0x77347a[_0x497676]['isdisabled']){_0x42a9c7=!![];logger[_0x9da1('0x1c')]('['+[_0x4d17e1[_0x9da1('0x1d')]()]+_0x9da1('0x1e')+_0x77347a[_0x497676][_0x9da1('0x1f')]+'!');_0xd2d225[_0x9da1('0x20')]=_0x77347a[_0x497676]['systemuserid'];}}}}if(!_0x42a9c7){logger['info']('['+[_0x4d17e1[_0x9da1('0x1d')]()]+_0x9da1('0x21'));_0xd2d225[_0x9da1('0x19')]=_0x1ffa2a[_0x9da1('0xb')];for(_0x497676=0x0;_0x497676<_0x77347a[_0x9da1('0x1a')];_0x497676++){if(_0x77347a[_0x497676][_0x9da1('0x1b')]===_0x1ffa2a['username']){_0xd2d225[_0x9da1('0x20')]=_0x77347a[_0x497676][_0x9da1('0x1f')];}}}_0x40ba9d(_0xd2d225);})['catch'](function(_0x45fcce){_0x479ccd(_0x45fcce[_0x9da1('0x12')]);});});}function createEndUser(_0x534210,_0x2fd49c,_0x16e12f,_0x4b1152,_0x36b87a,_0x1d6af5){return new BPromise(function(_0x55cd3d,_0x5c09ed){return getAuthToken(_0x2fd49c,_0x16e12f,_0x1d6af5)[_0x9da1('0xe')](function(_0x47055e){var _0x5eca5b=_0x1d6af5[_0x9da1('0x22')]()==='outbound'?_0x36b87a['destcalleridnum']:_0x36b87a['calleridnum'];var _0x31b826={'method':_0x9da1('0x23'),'uri':_0x4b1152+_0x9da1('0x24'),'body':{'telephone1':_0x5eca5b,'fullname':_0x5eca5b,'firstname':_0x5eca5b,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x9da1('0x25')+_0x534210[_0x9da1('0x20')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x47055e,'OData-Version':_0x9da1('0x15')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x31b826);})['then'](function(_0x1feae0){var _0x235ced=_0x1feae0['headers'][_0x9da1('0x26')];var _0x2eb48f=_0x235ced['substring'](_0x235ced[_0x9da1('0x27')]('(')+0x1,_0x235ced[_0x9da1('0x27')](')'));_0x534210[_0x9da1('0x28')]=_0x2eb48f;_0x55cd3d(_0x534210);})[_0x9da1('0x29')](function(_0x581e9f){_0x5c09ed(_0x581e9f['message']);});});}function getEndUser(_0x4733c3,_0x354733,_0x1ea84f,_0x3ddd57,_0x193273,_0x559645){return new BPromise(function(_0x4b83f3,_0x343c64){return getAuthToken(_0x354733,_0x1ea84f,_0x559645)[_0x9da1('0xe')](function(_0x1d2106){var _0x45a068={'method':_0x9da1('0x13'),'uri':_0x3ddd57+'contacts?$select=telephone1','headers':{'Authorization':_0x9da1('0x2a')+_0x1d2106,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x45a068);})['then'](function(_0x3e62e1){var _0x484f39=null;if(_0x3e62e1){var _0x35879f=_0x3e62e1[_0x9da1('0x16')];var _0x35be8b=![];for(_0x484f39=0x0;_0x484f39<_0x35879f[_0x9da1('0x1a')];_0x484f39++){var _0x98b294=_0x559645[_0x9da1('0x22')]()===_0x9da1('0x2b')?_0x193273[_0x9da1('0x2c')]:_0x193273['calleridnum'];if(_0x35879f[_0x484f39][_0x9da1('0x2d')]===_0x98b294){_0x35be8b=!![];_0x4733c3['enduserId']=_0x35879f[_0x484f39][_0x9da1('0x2e')];}}if(_0x35be8b){_0x4b83f3(_0x4733c3);}else{return createEndUser(_0x4733c3,_0x354733,_0x1ea84f,_0x3ddd57,_0x193273,_0x559645)['then'](function(_0x5eaa7e){logger[_0x9da1('0x1c')]('['+[_0x559645['toUpperCase']()]+_0x9da1('0x2f'),_0x5eaa7e[_0x9da1('0x28')]);_0x4b83f3(_0x5eaa7e);});}}else{return createEndUser(_0x4733c3,_0x354733,_0x1ea84f,_0x3ddd57,_0x193273,_0x559645)['then'](function(_0x38242c){logger[_0x9da1('0x1c')]('['+[_0x559645[_0x9da1('0x1d')]()]+_0x9da1('0x30'),_0x38242c['enduserId']);_0x4b83f3(_0x38242c);});}});});}function getCustomFields(_0x257c2e,_0x5e7846,_0x2bb9e4){var _0x4bdaf1={};if(_0x257c2e[_0x9da1('0x1a')]>0x0){_[_0x9da1('0x31')](_0x257c2e,function(_0x58e165){if(_[_0x9da1('0x32')]([_0x9da1('0x33'),_0x9da1('0x34')],_0x58e165['type'])&&_0x58e165['nameField']&&!_0x58e165['customField']){var _0x27e78c=_0x58e165['idField'][_0x9da1('0x22')]();var _0x287afe=_0x27e78c[_0x9da1('0x35')](0x0,_0x27e78c[_0x9da1('0x36')]('_'));var _0x54f188=_0x27e78c[_0x9da1('0x35')](_0x27e78c[_0x9da1('0x36')]('_')+0x1);if(_0x287afe===_0x2bb9e4){_0x4bdaf1[_0x54f188]=_0x58e165[_0x9da1('0x37')];}}});}return _0x4bdaf1;}function getTicket(_0x173dc6,_0x28fc88,_0x26c225,_0x28e0b2,_0x4f78b1,_0x467350,_0x515f3f){return new BPromise(function(_0x3bb1da,_0x516685){var _0x5e8ebe;return getAuthToken(_0x28fc88,_0x26c225,_0x515f3f)[_0x9da1('0xe')](function(_0x599211){if(_0x467350[_0x9da1('0x38')]===_0x9da1('0x39')){_0x5e8ebe={'method':'POST','uri':_0x28e0b2+_0x9da1('0x3a'),'body':Object['assign']({},{'title':intUtil[_0x9da1('0x3b')](_0x467350[_0x9da1('0x3c')],_0x4f78b1,'\x20'),'description':intUtil['getString'](_0x467350['Descriptions'],_0x4f78b1,'\x0a'),'customerid_contact@odata.bind':_0x9da1('0x3d')+_0x173dc6[_0x9da1('0x28')]+')','ownerid@odata.bind':_0x9da1('0x25')+_0x173dc6[_0x9da1('0x20')]+')','caseorigincode':'1'},getCustomFields(_0x467350[_0x9da1('0x3e')],_0x4f78b1,_0x467350[_0x9da1('0x38')])),'headers':{'Authorization':_0x9da1('0x2a')+_0x599211,'OData-Version':_0x9da1('0x15')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x467350['ticketType']===_0x9da1('0x3f')){_0x5e8ebe={'method':_0x9da1('0x23'),'uri':_0x28e0b2+_0x9da1('0x40'),'body':Object['assign']({},{'subject':intUtil[_0x9da1('0x3b')](_0x467350[_0x9da1('0x3c')],_0x4f78b1,'\x20'),'phonenumber':String(_0x4f78b1[_0x9da1('0x41')]),'description':intUtil['getString'](_0x467350[_0x9da1('0x42')],_0x4f78b1,'\x0a'),'regardingobjectid_contact@odata.bind':_0x9da1('0x3d')+_0x173dc6[_0x9da1('0x28')]+')','ownerid@odata.bind':'/systemusers('+_0x173dc6[_0x9da1('0x20')]+')','directioncode':_0x173dc6['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x9da1('0x25')+_0x173dc6[_0x9da1('0x20')]+')','participationtypemask':_0x173dc6['callDirection']===_0x9da1('0x43')?0x2:0x1},{'partyid_contact@odata.bind':_0x9da1('0x3d')+_0x173dc6['enduserId']+')','participationtypemask':_0x173dc6[_0x9da1('0x44')]===_0x9da1('0x43')?0x1:0x2}]},getCustomFields(_0x467350[_0x9da1('0x3e')],_0x4f78b1,_0x467350[_0x9da1('0x38')])),'headers':{'Authorization':_0x9da1('0x2a')+_0x599211,'OData-Version':_0x9da1('0x15')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5e8ebe);})[_0x9da1('0xe')](function(_0x167ada){var _0x3889f4=_0x167ada['headers'][_0x9da1('0x26')];var _0xe6c667=_0x3889f4[_0x9da1('0x35')](_0x3889f4[_0x9da1('0x27')]('(')+0x1,_0x3889f4['lastIndexOf'](')'));_0x173dc6['ticketId']=_0xe6c667;_0x3bb1da(_0x173dc6);})[_0x9da1('0x29')](function(_0x6ca1ac){_0x516685(_0x6ca1ac[_0x9da1('0x12')]);});});}function emit(_0x1f11c5,_0x929f80,_0x315b7b,_0x43aa83){var _0x1b1148={'uri':util[_0x9da1('0x45')](_0x9da1('0x46'),_0x1f11c5,_0x315b7b,_0x43aa83)};io['to'](util[_0x9da1('0x45')](_0x9da1('0x47'),_0x929f80))[_0x9da1('0x48')](_0x9da1('0x49'),_0x1b1148);}exports['cs']=function(_0x4c99e8,_0x26ecdb,_0x1fbb5d,_0x4d241a,_0x227872,_0x4a1e45,_0x2c6145,_0x4f4980){var _0x5df0d8={};_0x4a1e45[_0x9da1('0x4a')]=intUtil[_0x9da1('0x4b')](_0x4a1e45[_0x9da1('0x4a')]);_0x4a1e45[_0x9da1('0x4c')]=intUtil[_0x9da1('0x4b')](_0x4a1e45[_0x9da1('0x4c')]);_0x5df0d8[_0x9da1('0x44')]=_0x4f4980===_0x9da1('0x43')||_0x4f4980===_0x9da1('0x4d')?'queue':_0x9da1('0x2b');var _0x1de7d9=util[_0x9da1('0x45')](_0x9da1('0x4e'),_0x4a1e45[_0x9da1('0x4a')]);var _0x4607a9=util[_0x9da1('0x45')](_0x9da1('0x4f'),_0x4a1e45[_0x9da1('0x50')]);var _0x3f52c9=util['format'](_0x9da1('0x51'),_0x4a1e45[_0x9da1('0x4c')],_0x26ecdb['uniqueid'],md5(_0x26ecdb[_0x9da1('0x52')]));if(_0x227872&&_0x227872[_0x9da1('0x53')]){logger[_0x9da1('0x1c')](_0x9da1('0x54'),_0x9da1('0x55'));_0x26ecdb[_0x9da1('0x56')]=_0x3f52c9;}else if(_0x2c6145&&_0x2c6145[_0x9da1('0x57')]&&_0x2c6145['recordingFormat']!==_0x9da1('0x58')){logger[_0x9da1('0x1c')](_0x9da1('0x59'),_0x9da1('0x55'));_0x26ecdb['recordingURL']=_0x3f52c9;}else{_0x26ecdb[_0x9da1('0x56')]='';}return getUser(_0x5df0d8,_0x4a1e45,_0x4d241a,_0x4607a9,_0x1de7d9,_0x4f4980)['then'](function(_0x27ac84){logger[_0x9da1('0x1c')]('['+_0x4f4980[_0x9da1('0x1d')]()+_0x9da1('0x5a'),_0x27ac84[_0x9da1('0x20')]);logger[_0x9da1('0x1c')]('['+_0x4f4980['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x27ac84[_0x9da1('0x19')]);return getEndUser(_0x27ac84,_0x4a1e45,_0x4607a9,_0x1de7d9,_0x26ecdb,_0x4f4980);})['then'](function(_0x5bf7b7){logger['info']('['+_0x4f4980[_0x9da1('0x1d')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x5bf7b7[_0x9da1('0x28')]);logger['info']('['+_0x4f4980[_0x9da1('0x1d')]()+_0x9da1('0x5b'),_0x26ecdb['calleridnum']);return getTicket(_0x5bf7b7,_0x4a1e45,_0x4607a9,_0x1de7d9,_0x26ecdb,_0x1fbb5d,_0x4f4980);})[_0x9da1('0xe')](function(_0x388a9f){logger['info'](util[_0x9da1('0x45')]('['+_0x4f4980[_0x9da1('0x1d')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x1fbb5d['ticketType'],_0x388a9f[_0x9da1('0x5c')]));logger[_0x9da1('0x1c')](util[_0x9da1('0x45')]('['+_0x4f4980[_0x9da1('0x1d')]()+_0x9da1('0x5d'),_0x4f4980));if(_0x4f4980!==_0x9da1('0x4d')){logger['info']('['+_0x4f4980[_0x9da1('0x1d')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x4a1e45['remoteUri'],_0x4d241a[_0x9da1('0x5e')],_0x1fbb5d[_0x9da1('0x38')],_0x388a9f[_0x9da1('0x5c')]);}})[_0x9da1('0x29')](function(_0x3382b1){logger[_0x9da1('0x10')]('['+_0x4f4980[_0x9da1('0x1d')]()+_0x9da1('0x5f'),util[_0x9da1('0x60')](_0x3382b1,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index 8a750ec..b445d2e 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 _0x6100=['debug','stringify','GET','map','includes','picklist','toLowerCase','content','string','type','idField','push','variableName','customField','Variable','queue','stripTrailingSlash','Recording\x20is\x20enabled!','recordingURL','serverUrl','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','catch','error','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridname','destcalleridnum','[OUTBOUND]','user:%s','unmanaged','monitor_format','toUpperCase','calleridname','The\x20Ticket\x20ID\x20is:','lastevent','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','application/json','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','getString','Descriptions','
','Tags','name','Fields','custom_fields','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','contact','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64'];(function(_0x48ac58,_0x27efe2){var _0x560abc=function(_0x5e21fa){while(--_0x5e21fa){_0x48ac58['push'](_0x48ac58['shift']());}};_0x560abc(++_0x27efe2);}(_0x6100,0x1e1));var _0x0610=function(_0x573ce4,_0x23105a){_0x573ce4=_0x573ce4-0x0;var _0x593218=_0x6100[_0x573ce4];return _0x593218;};'use strict';var _=require(_0x0610('0x0'));var rp=require(_0x0610('0x1'));var md5=require(_0x0610('0x2'));var util=require(_0x0610('0x3'));var Redis=require(_0x0610('0x4'));var intUtil=require('./util');var config=require(_0x0610('0x5'));var logger=require(_0x0610('0x6'))(_0x0610('0x7'));config[_0x0610('0x8')]=_[_0x0610('0x9')](config[_0x0610('0x8')],{'host':_0x0610('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0610('0x8')]));var headers={'Content-Type':'application/json','Accept':_0x0610('0xb')};function emit(_0x1befc0,_0x3757e5,_0x27c33d){io['to'](_0x1befc0)['emit'](_0x3757e5,_0x27c33d);}function getTicket(_0x8cf044,_0x598081,_0x111cc2,_0x1c24e0,_0x3306de){logger[_0x0610('0xc')](_0x0610('0xd'));var _0x44b794=_[_0x0610('0xe')]({'responder_id':_0x598081['id'],'requester_id':_0x111cc2['id'],'name':util[_0x0610('0xf')](_0x0610('0x10'),_0x3306de['calleridname']),'phone':_0x3306de[_0x0610('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x0610('0x12')](_0x1c24e0['Subjects'],_0x3306de,'\x20'),'description':intUtil[_0x0610('0x12')](_0x1c24e0[_0x0610('0x13')],_0x3306de,_0x0610('0x14')),'tags':getTags(_0x1c24e0[_0x0610('0x15')],_0x0610('0x16'))},getCustomFields(_0x1c24e0[_0x0610('0x17')],_0x3306de));_0x44b794[_0x0610('0x18')]=_['mapValues'](_['keyBy'](_0x44b794['custom_fields'],'id'),'value');return request({'uri':util[_0x0610('0xf')]('%s/api/v2/tickets',_0x8cf044[_0x0610('0x19')]),'method':_0x0610('0x1a'),'body':_0x44b794})[_0x0610('0x1b')](function(_0x39184a){logger[_0x0610('0xc')](_0x0610('0x1c'));return _0x39184a;});}function getUser(_0x3862d4,_0x33c61f){if(intUtil[_0x0610('0x1d')](_0x33c61f)){return request({'uri':util[_0x0610('0xf')](_0x0610('0x1e'),_0x3862d4[_0x0610('0x19')]),'qs':{'email':_0x33c61f}})['then'](function(_0x1aedab){if(_0x1aedab[_0x0610('0x1f')]){logger[_0x0610('0xc')](_0x0610('0x20'));return _['find'](_0x1aedab,function(_0x17cf80){return _0x17cf80[_0x0610('0x21')]['email']===_0x33c61f;});}else{logger[_0x0610('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x0610('0x22'),_0x3862d4[_0x0610('0x19')])})['then'](function(_0x2cd125){logger[_0x0610('0xc')](_0x0610('0x23'));return _0x2cd125;});}});}else{logger[_0x0610('0xc')](_0x0610('0x24'));return request({'uri':util[_0x0610('0xf')]('%s/api/v2/agents/me',_0x3862d4[_0x0610('0x19')])})['then'](function(_0x429444){logger[_0x0610('0xc')](_0x0610('0x23'));return _0x429444;});}}function getEndUser(_0x77f89b,_0x3e24fe,_0x17dba4){logger[_0x0610('0xc')](_0x0610('0x25'),_0x17dba4);return request({'uri':util[_0x0610('0xf')](_0x0610('0x26'),_0x77f89b[_0x0610('0x19')]),'qs':{'phone':_0x17dba4}})[_0x0610('0x1b')](function(_0x3c4536){if(_0x3c4536[_0x0610('0x1f')]){logger['info'](_0x0610('0x27'));return _[_0x0610('0x28')](_0x3c4536,{'phone':_0x17dba4});}else{logger['info'](_0x0610('0x29'));return request({'uri':util['format'](_0x0610('0x26'),_0x77f89b[_0x0610('0x19')]),'method':_0x0610('0x1a'),'body':{'name':_0x3e24fe,'phone':_0x17dba4}})[_0x0610('0x1b')](function(_0x5b37c0){logger[_0x0610('0xc')](_0x0610('0x2a'));return _0x5b37c0;});}});}function getAuth(_0x42cde0){return util[_0x0610('0xf')](_0x0610('0x2b'),new Buffer(_0x42cde0[_0x0610('0x2c')]+':X')[_0x0610('0x2d')](_0x0610('0x2e')));}function request(_0x5ad88a){logger[_0x0610('0x2f')]('[HTTP]',JSON[_0x0610('0x30')](_0x5ad88a));return rp(_[_0x0610('0x9')](_0x5ad88a,{'method':_0x0610('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x481b31,_0x47ffec){var _0x10bf13=[];if(_0x481b31&&_0x481b31[_0x0610('0x1f')]>0x0){_0x10bf13=_[_0x0610('0x32')](_0x481b31,_0x47ffec);}return _0x10bf13;}function getCustomFields(_0x55f8cf,_0x23013f){var _0x56b304=[];var _0x3ef55d={'custom_fields':[]};if(_0x55f8cf[_0x0610('0x1f')]>0x0){_['forEach'](_0x55f8cf,function(_0x5476ef){if(_[_0x0610('0x33')](['string',_0x0610('0x34')],_0x5476ef['type'])&&_0x5476ef['nameField']&&!_0x5476ef['customField']){_0x3ef55d[_0x5476ef['nameField'][_0x0610('0x35')]()]=_0x5476ef[_0x0610('0x36')][_0x0610('0x2d')]();}else if(_['includes']([_0x0610('0x37'),'picklist'],_0x5476ef[_0x0610('0x38')])&&_0x5476ef[_0x0610('0x39')]&&_0x5476ef['customField']){_0x3ef55d[_0x0610('0x18')][_0x0610('0x3a')]({'id':_0x5476ef[_0x0610('0x39')],'value':_0x5476ef[_0x0610('0x36')]['toString']()});}else if(_0x5476ef[_0x0610('0x38')]==='variable'&&_0x5476ef[_0x0610('0x3b')]&&_0x5476ef[_0x0610('0x39')]&&_0x5476ef[_0x0610('0x3c')]){_0x23013f[_0x5476ef[_0x0610('0x3b')]]&&_0x3ef55d[_0x0610('0x18')][_0x0610('0x3a')]({'id':_0x5476ef[_0x0610('0x39')],'value':_0x23013f[_0x5476ef[_0x0610('0x3b')]][_0x0610('0x2d')]()});}else if(_0x5476ef[_0x0610('0x38')]==='customVariable'&&_0x5476ef[_0x0610('0x3d')]&&_0x5476ef['Variable']['name']&&_0x5476ef[_0x0610('0x39')]&&_0x5476ef[_0x0610('0x3c')]){_0x23013f[_0x5476ef[_0x0610('0x3d')][_0x0610('0x16')]['toLowerCase']()]&&_0x3ef55d[_0x0610('0x18')]['push']({'id':_0x5476ef[_0x0610('0x39')],'value':_0x23013f[_0x5476ef['Variable'][_0x0610('0x16')][_0x0610('0x35')]()][_0x0610('0x2d')]()});}});}return _0x3ef55d;}exports[_0x0610('0x3e')]=function(_0x3d8e3f,_0x27f06c,_0x13b752,_0x346d66,_0x93a8fd,_0x298436){var _0x55b426,_0x1cb46f;_0x298436[_0x0610('0x19')]=intUtil['stripTrailingSlash'](_0x298436[_0x0610('0x19')]);_0x298436['serverUrl']=intUtil[_0x0610('0x3f')](_0x298436['serverUrl']);if(_0x93a8fd&&_0x93a8fd['monitor_format']){logger[_0x0610('0xc')]('[QUEUE]',_0x0610('0x40'));_0x27f06c[_0x0610('0x41')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x298436[_0x0610('0x42')],_0x27f06c['uniqueid'],md5(_0x27f06c[_0x0610('0x43')]));}else{_0x27f06c[_0x0610('0x41')]='';}headers[_0x0610('0x44')]=getAuth(_0x298436);return getUser(_0x298436,_0x346d66['email'])['then'](function(_0x1050c1){_0x55b426=_0x1050c1;logger[_0x0610('0xc')](_0x0610('0x45'),_0x55b426['id']);return getEndUser(_0x298436,_0x27f06c['calleridname'],_0x27f06c[_0x0610('0x11')]);})['then'](function(_0x48d464){_0x1cb46f=_0x48d464;logger[_0x0610('0xc')](_0x0610('0x46'),_0x1cb46f['id']);return getTicket(_0x298436,_0x55b426,_0x1cb46f,_0x13b752,_0x27f06c);})['then'](function(_0x19a8b1){if(_0x19a8b1&&_0x19a8b1['id']){logger[_0x0610('0xc')](_0x0610('0x1c'));logger[_0x0610('0xc')]('The\x20Ticket\x20ID\x20is:',_0x19a8b1['id']);logger[_0x0610('0xc')]('[QUEUE]',_0x0610('0x47'));emit(util['format']('user:%s',_0x346d66[_0x0610('0x16')]),'trigger:browser:url',{'uri':util[_0x0610('0xf')](_0x0610('0x48'),_0x298436[_0x0610('0x19')],_0x19a8b1['id'])});}})[_0x0610('0x49')](function(_0x5e9803){logger[_0x0610('0x4a')]('[QUEUE]',JSON[_0x0610('0x30')](_0x5e9803));});};exports[_0x0610('0x4b')]=function(_0x510c37,_0x5536ad,_0x43eeec,_0x3ff60d,_0x11e076,_0x2b5ec2,_0x1785bb){var _0x4807b,_0x38f0e4;_0x2b5ec2[_0x0610('0x19')]=intUtil[_0x0610('0x3f')](_0x2b5ec2[_0x0610('0x19')]);_0x2b5ec2[_0x0610('0x42')]=intUtil['stripTrailingSlash'](_0x2b5ec2[_0x0610('0x42')]);if(_0x1785bb&&_0x1785bb['recordingFormat']&&_0x1785bb['recordingFormat']!=='none'){logger[_0x0610('0xc')]('[OUTBOUND]',_0x0610('0x40'));_0x5536ad[_0x0610('0x41')]=util[_0x0610('0xf')](_0x0610('0x4c'),_0x2b5ec2[_0x0610('0x42')],_0x5536ad['uniqueid'],md5(_0x5536ad['uniqueid']));}headers[_0x0610('0x44')]=getAuth(_0x2b5ec2);return getUser(_0x2b5ec2,_0x3ff60d[_0x0610('0x4d')])[_0x0610('0x1b')](function(_0x421539){_0x4807b=_0x421539;logger['info'](_0x0610('0x45'),_0x4807b['id']);return getEndUser(_0x2b5ec2,_0x5536ad[_0x0610('0x4e')],_0x5536ad[_0x0610('0x4f')]);})[_0x0610('0x1b')](function(_0x4242ad){_0x38f0e4=_0x4242ad;logger[_0x0610('0xc')](_0x0610('0x46'),_0x38f0e4['id']);return getTicket(_0x2b5ec2,_0x4807b,_0x38f0e4,_0x43eeec,_0x5536ad);})[_0x0610('0x1b')](function(_0x229fdb){if(_0x229fdb&&_0x229fdb['id']){logger[_0x0610('0xc')](_0x0610('0x1c'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x229fdb['id']);logger[_0x0610('0xc')](_0x0610('0x50'),_0x0610('0x47'));emit(util['format'](_0x0610('0x51'),_0x3ff60d[_0x0610('0x16')]),'trigger:browser:url',{'uri':util['format']('%s/helpdesk/tickets/%d',_0x2b5ec2[_0x0610('0x19')],_0x229fdb['id'])});}})[_0x0610('0x49')](function(_0x3be2ed){logger[_0x0610('0x4a')](_0x0610('0x50'),JSON[_0x0610('0x30')](_0x3be2ed));});};exports[_0x0610('0x52')]=function(_0x14dd2a,_0x2e054f,_0x198297,_0x297af9,_0x3f5376,_0x418bf1){var _0x1435e1,_0x2c249d;_0x418bf1[_0x0610('0x19')]=intUtil[_0x0610('0x3f')](_0x418bf1[_0x0610('0x19')]);_0x418bf1[_0x0610('0x42')]=intUtil[_0x0610('0x3f')](_0x418bf1[_0x0610('0x42')]);if(_0x3f5376&&_0x3f5376[_0x0610('0x53')]){logger[_0x0610('0xc')]('['+_0x2e054f['lastevent'][_0x0610('0x54')]()+']',_0x0610('0x40'));_0x2e054f[_0x0610('0x41')]=util[_0x0610('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x418bf1[_0x0610('0x42')],_0x2e054f['uniqueid'],md5(_0x2e054f['uniqueid']));}else{_0x2e054f[_0x0610('0x41')]='';}headers[_0x0610('0x44')]=getAuth(_0x418bf1);return getUser(_0x418bf1,'')[_0x0610('0x1b')](function(_0x48b623){_0x1435e1=_0x48b623;logger['info'](_0x0610('0x45'),_0x1435e1['id']);return getEndUser(_0x418bf1,_0x2e054f[_0x0610('0x55')],_0x2e054f[_0x0610('0x11')]);})[_0x0610('0x1b')](function(_0x40bed0){_0x2c249d=_0x40bed0;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2c249d['id']);return getTicket(_0x418bf1,_0x1435e1,_0x2c249d,_0x198297,_0x2e054f);})[_0x0610('0x1b')](function(_0x2984b8){if(_0x2984b8){logger[_0x0610('0xc')]('Ticket\x20created!');logger['info'](_0x0610('0x56'),_0x2984b8['id']);}})['catch'](function(_0x2a93f3){logger['error']('['+_0x2e054f[_0x0610('0x57')][_0x0610('0x54')]()+']',JSON[_0x0610('0x30')](_0x2a93f3));});}; \ No newline at end of file +var _0xc3be=['calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','catch','error','stringify','outbound','stripTrailingSlash','recordingFormat','none','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','monitor_format','Authorization','lastevent','toUpperCase','lodash','request-promise','util','ioredis','./util','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','Subjects','
','Tags','Fields','custom_fields','mapValues','keyBy','value','validateEmail','%s/api/v2/agents','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','then','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','GET','length','map','forEach','includes','string','picklist','customField','toLowerCase','content','type','idField','push','variable','variableName','customVariable','Variable','name','queue','serverUrl','[QUEUE]','recordingURL','uniqueid','The\x20User\x20ID\x20is:'];(function(_0x45977c,_0x7eaed0){var _0x399413=function(_0x41cc76){while(--_0x41cc76){_0x45977c['push'](_0x45977c['shift']());}};_0x399413(++_0x7eaed0);}(_0xc3be,0x7b));var _0xec3b=function(_0x495c2b,_0x5044b0){_0x495c2b=_0x495c2b-0x0;var _0x370520=_0xc3be[_0x495c2b];return _0x370520;};'use strict';var _=require(_0xec3b('0x0'));var rp=require(_0xec3b('0x1'));var md5=require('md5');var util=require(_0xec3b('0x2'));var Redis=require(_0xec3b('0x3'));var intUtil=require(_0xec3b('0x4'));var config=require('../../../../config/environment');var logger=require(_0xec3b('0x5'))(_0xec3b('0x6'));config[_0xec3b('0x7')]=_[_0xec3b('0x8')](config[_0xec3b('0x7')],{'host':_0xec3b('0x9'),'port':0x18eb});var io=require(_0xec3b('0xa'))(new Redis(config[_0xec3b('0x7')]));var headers={'Content-Type':'application/json','Accept':_0xec3b('0xb')};function emit(_0xe0061d,_0x249963,_0x1b9206){io['to'](_0xe0061d)[_0xec3b('0xc')](_0x249963,_0x1b9206);}function getTicket(_0x35126f,_0x19543a,_0x43ba66,_0x2cc068,_0x406f09){logger[_0xec3b('0xd')](_0xec3b('0xe'));var _0xf721a5=_[_0xec3b('0xf')]({'responder_id':_0x19543a['id'],'requester_id':_0x43ba66['id'],'name':util[_0xec3b('0x10')](_0xec3b('0x11'),_0x406f09[_0xec3b('0x12')]),'phone':_0x406f09['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x2cc068[_0xec3b('0x13')],_0x406f09,'\x20'),'description':intUtil['getString'](_0x2cc068['Descriptions'],_0x406f09,_0xec3b('0x14')),'tags':getTags(_0x2cc068[_0xec3b('0x15')],'name')},getCustomFields(_0x2cc068[_0xec3b('0x16')],_0x406f09));_0xf721a5[_0xec3b('0x17')]=_[_0xec3b('0x18')](_[_0xec3b('0x19')](_0xf721a5[_0xec3b('0x17')],'id'),_0xec3b('0x1a'));return request({'uri':util[_0xec3b('0x10')]('%s/api/v2/tickets',_0x35126f['remoteUri']),'method':'POST','body':_0xf721a5})['then'](function(_0x50f3d3){logger[_0xec3b('0xd')]('Ticket\x20created!');return _0x50f3d3;});}function getUser(_0x398700,_0x1776f0){if(intUtil[_0xec3b('0x1b')](_0x1776f0)){return request({'uri':util['format'](_0xec3b('0x1c'),_0x398700['remoteUri']),'qs':{'email':_0x1776f0}})['then'](function(_0x488430){if(_0x488430['length']){logger[_0xec3b('0xd')](_0xec3b('0x1d'));return _[_0xec3b('0x1e')](_0x488430,function(_0x2d72b2){return _0x2d72b2[_0xec3b('0x1f')][_0xec3b('0x20')]===_0x1776f0;});}else{logger['info'](_0xec3b('0x21'));return request({'uri':util[_0xec3b('0x10')]('%s/api/v2/agents/me',_0x398700[_0xec3b('0x22')])})[_0xec3b('0x23')](function(_0x2afc95){logger[_0xec3b('0xd')](_0xec3b('0x24'));return _0x2afc95;});}});}else{logger[_0xec3b('0xd')](_0xec3b('0x25'));return request({'uri':util[_0xec3b('0x10')](_0xec3b('0x26'),_0x398700[_0xec3b('0x22')])})[_0xec3b('0x23')](function(_0x6460bf){logger['info'](_0xec3b('0x24'));return _0x6460bf;});}}function getEndUser(_0x57696d,_0x12963b,_0x2371c0){logger['info'](_0xec3b('0x27'),_0x2371c0);return request({'uri':util['format'](_0xec3b('0x28'),_0x57696d[_0xec3b('0x22')]),'qs':{'phone':_0x2371c0}})['then'](function(_0x323c70){if(_0x323c70['length']){logger[_0xec3b('0xd')](_0xec3b('0x29'));return _[_0xec3b('0x1e')](_0x323c70,{'phone':_0x2371c0});}else{logger[_0xec3b('0xd')](_0xec3b('0x2a'));return request({'uri':util[_0xec3b('0x10')](_0xec3b('0x28'),_0x57696d[_0xec3b('0x22')]),'method':_0xec3b('0x2b'),'body':{'name':_0x12963b,'phone':_0x2371c0}})['then'](function(_0x4fabf9){logger['info'](_0xec3b('0x2c'));return _0x4fabf9;});}});}function getAuth(_0xd15866){return util[_0xec3b('0x10')](_0xec3b('0x2d'),new Buffer(_0xd15866[_0xec3b('0x2e')]+':X')[_0xec3b('0x2f')](_0xec3b('0x30')));}function request(_0x285ddb){logger[_0xec3b('0x31')](_0xec3b('0x32'),JSON['stringify'](_0x285ddb));return rp(_[_0xec3b('0x8')](_0x285ddb,{'method':_0xec3b('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x4f8f38,_0x52312a){var _0x51fb5e=[];if(_0x4f8f38&&_0x4f8f38[_0xec3b('0x34')]>0x0){_0x51fb5e=_[_0xec3b('0x35')](_0x4f8f38,_0x52312a);}return _0x51fb5e;}function getCustomFields(_0x392822,_0x590b00){var _0xa137e1=[];var _0xbe1b44={'custom_fields':[]};if(_0x392822[_0xec3b('0x34')]>0x0){_[_0xec3b('0x36')](_0x392822,function(_0x52a71c){if(_[_0xec3b('0x37')]([_0xec3b('0x38'),_0xec3b('0x39')],_0x52a71c['type'])&&_0x52a71c['nameField']&&!_0x52a71c[_0xec3b('0x3a')]){_0xbe1b44[_0x52a71c['nameField'][_0xec3b('0x3b')]()]=_0x52a71c[_0xec3b('0x3c')][_0xec3b('0x2f')]();}else if(_[_0xec3b('0x37')](['string','picklist'],_0x52a71c[_0xec3b('0x3d')])&&_0x52a71c[_0xec3b('0x3e')]&&_0x52a71c[_0xec3b('0x3a')]){_0xbe1b44[_0xec3b('0x17')][_0xec3b('0x3f')]({'id':_0x52a71c['idField'],'value':_0x52a71c[_0xec3b('0x3c')]['toString']()});}else if(_0x52a71c[_0xec3b('0x3d')]===_0xec3b('0x40')&&_0x52a71c[_0xec3b('0x41')]&&_0x52a71c['idField']&&_0x52a71c['customField']){_0x590b00[_0x52a71c[_0xec3b('0x41')]]&&_0xbe1b44[_0xec3b('0x17')]['push']({'id':_0x52a71c[_0xec3b('0x3e')],'value':_0x590b00[_0x52a71c['variableName']][_0xec3b('0x2f')]()});}else if(_0x52a71c['type']===_0xec3b('0x42')&&_0x52a71c['Variable']&&_0x52a71c[_0xec3b('0x43')][_0xec3b('0x44')]&&_0x52a71c['idField']&&_0x52a71c[_0xec3b('0x3a')]){_0x590b00[_0x52a71c['Variable']['name']['toLowerCase']()]&&_0xbe1b44[_0xec3b('0x17')]['push']({'id':_0x52a71c[_0xec3b('0x3e')],'value':_0x590b00[_0x52a71c[_0xec3b('0x43')][_0xec3b('0x44')][_0xec3b('0x3b')]()][_0xec3b('0x2f')]()});}});}return _0xbe1b44;}exports[_0xec3b('0x45')]=function(_0x3dfc88,_0x4e31bd,_0x1a2468,_0x2267b9,_0x27e63f,_0x3f5b9a){var _0x246f58,_0x47bcc6;_0x3f5b9a['remoteUri']=intUtil['stripTrailingSlash'](_0x3f5b9a[_0xec3b('0x22')]);_0x3f5b9a[_0xec3b('0x46')]=intUtil['stripTrailingSlash'](_0x3f5b9a['serverUrl']);if(_0x27e63f&&_0x27e63f['monitor_format']){logger['info'](_0xec3b('0x47'),'Recording\x20is\x20enabled!');_0x4e31bd[_0xec3b('0x48')]=util[_0xec3b('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3f5b9a[_0xec3b('0x46')],_0x4e31bd[_0xec3b('0x49')],md5(_0x4e31bd[_0xec3b('0x49')]));}else{_0x4e31bd[_0xec3b('0x48')]='';}headers['Authorization']=getAuth(_0x3f5b9a);return getUser(_0x3f5b9a,_0x2267b9['email'])['then'](function(_0x3d537c){_0x246f58=_0x3d537c;logger[_0xec3b('0xd')](_0xec3b('0x4a'),_0x246f58['id']);return getEndUser(_0x3f5b9a,_0x4e31bd[_0xec3b('0x12')],_0x4e31bd[_0xec3b('0x4b')]);})[_0xec3b('0x23')](function(_0x38bd38){_0x47bcc6=_0x38bd38;logger['info'](_0xec3b('0x4c'),_0x47bcc6['id']);return getTicket(_0x3f5b9a,_0x246f58,_0x47bcc6,_0x1a2468,_0x4e31bd);})[_0xec3b('0x23')](function(_0x13b142){if(_0x13b142&&_0x13b142['id']){logger[_0xec3b('0xd')](_0xec3b('0x4d'));logger[_0xec3b('0xd')](_0xec3b('0x4e'),_0x13b142['id']);logger[_0xec3b('0xd')](_0xec3b('0x47'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xec3b('0x4f'),_0x2267b9[_0xec3b('0x44')]),_0xec3b('0x50'),{'uri':util[_0xec3b('0x10')]('%s/helpdesk/tickets/%d',_0x3f5b9a[_0xec3b('0x22')],_0x13b142['id'])});}})[_0xec3b('0x51')](function(_0x4901b6){logger[_0xec3b('0x52')]('[QUEUE]',JSON[_0xec3b('0x53')](_0x4901b6));});};exports[_0xec3b('0x54')]=function(_0x4cb39a,_0x39186a,_0x17b030,_0x485272,_0x3f7de0,_0x3f9b79,_0x4d5aec){var _0x566a1b,_0x1ad7f0;_0x3f9b79[_0xec3b('0x22')]=intUtil[_0xec3b('0x55')](_0x3f9b79['remoteUri']);_0x3f9b79[_0xec3b('0x46')]=intUtil[_0xec3b('0x55')](_0x3f9b79[_0xec3b('0x46')]);if(_0x4d5aec&&_0x4d5aec['recordingFormat']&&_0x4d5aec[_0xec3b('0x56')]!==_0xec3b('0x57')){logger[_0xec3b('0xd')]('[OUTBOUND]',_0xec3b('0x58'));_0x39186a[_0xec3b('0x48')]=util[_0xec3b('0x10')](_0xec3b('0x59'),_0x3f9b79[_0xec3b('0x46')],_0x39186a[_0xec3b('0x49')],md5(_0x39186a[_0xec3b('0x49')]));}headers['Authorization']=getAuth(_0x3f9b79);return getUser(_0x3f9b79,_0x485272[_0xec3b('0x20')])[_0xec3b('0x23')](function(_0x12cfab){_0x566a1b=_0x12cfab;logger[_0xec3b('0xd')](_0xec3b('0x4a'),_0x566a1b['id']);return getEndUser(_0x3f9b79,_0x39186a[_0xec3b('0x5a')],_0x39186a[_0xec3b('0x5b')]);})[_0xec3b('0x23')](function(_0x1214f9){_0x1ad7f0=_0x1214f9;logger[_0xec3b('0xd')](_0xec3b('0x4c'),_0x1ad7f0['id']);return getTicket(_0x3f9b79,_0x566a1b,_0x1ad7f0,_0x17b030,_0x39186a);})[_0xec3b('0x23')](function(_0x9becee){if(_0x9becee&&_0x9becee['id']){logger['info']('Ticket\x20created!');logger[_0xec3b('0xd')](_0xec3b('0x4e'),_0x9becee['id']);logger[_0xec3b('0xd')](_0xec3b('0x5c'),_0xec3b('0x5d'));emit(util[_0xec3b('0x10')]('user:%s',_0x485272['name']),_0xec3b('0x50'),{'uri':util['format'](_0xec3b('0x5e'),_0x3f9b79[_0xec3b('0x22')],_0x9becee['id'])});}})['catch'](function(_0x301f11){logger[_0xec3b('0x52')](_0xec3b('0x5c'),JSON[_0xec3b('0x53')](_0x301f11));});};exports['unmanaged']=function(_0x22cf5b,_0x5c5be9,_0x10dbab,_0x5c5855,_0xe9f759,_0x2dbd41){var _0x125277,_0xe50480;_0x2dbd41[_0xec3b('0x22')]=intUtil[_0xec3b('0x55')](_0x2dbd41[_0xec3b('0x22')]);_0x2dbd41[_0xec3b('0x46')]=intUtil[_0xec3b('0x55')](_0x2dbd41[_0xec3b('0x46')]);if(_0xe9f759&&_0xe9f759[_0xec3b('0x5f')]){logger['info']('['+_0x5c5be9['lastevent']['toUpperCase']()+']',_0xec3b('0x58'));_0x5c5be9['recordingURL']=util[_0xec3b('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2dbd41[_0xec3b('0x46')],_0x5c5be9[_0xec3b('0x49')],md5(_0x5c5be9['uniqueid']));}else{_0x5c5be9[_0xec3b('0x48')]='';}headers[_0xec3b('0x60')]=getAuth(_0x2dbd41);return getUser(_0x2dbd41,'')[_0xec3b('0x23')](function(_0x50a0fc){_0x125277=_0x50a0fc;logger[_0xec3b('0xd')](_0xec3b('0x4a'),_0x125277['id']);return getEndUser(_0x2dbd41,_0x5c5be9[_0xec3b('0x12')],_0x5c5be9[_0xec3b('0x4b')]);})['then'](function(_0x2956ac){_0xe50480=_0x2956ac;logger[_0xec3b('0xd')]('The\x20Enduser\x20ID\x20is:',_0xe50480['id']);return getTicket(_0x2dbd41,_0x125277,_0xe50480,_0x10dbab,_0x5c5be9);})[_0xec3b('0x23')](function(_0x4b4659){if(_0x4b4659){logger[_0xec3b('0xd')]('Ticket\x20created!');logger[_0xec3b('0xd')]('The\x20Ticket\x20ID\x20is:',_0x4b4659['id']);}})['catch'](function(_0x25b9de){logger[_0xec3b('0x52')]('['+_0x5c5be9[_0xec3b('0x61')][_0xec3b('0x62')]()+']',JSON['stringify'](_0x25b9de));});}; \ 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 fb23041..4bb3b44 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 _0xcf71=['monitor_format','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','GET','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','userId','User\x20found:','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','getString','Descriptions','Contact','format','ticketId','task','Task\x20created:','/contacts/','emit','trigger:browser:url','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0x8b9b95,_0xc036db){var _0x74548d=function(_0x5f0bbc){while(--_0x5f0bbc){_0x8b9b95['push'](_0x8b9b95['shift']());}};_0x74548d(++_0xc036db);}(_0xcf71,0xba));var _0x1cf7=function(_0x3f4027,_0x221cbb){_0x3f4027=_0x3f4027-0x0;var _0x4aea2e=_0xcf71[_0x3f4027];return _0x4aea2e;};'use strict';var _=require(_0x1cf7('0x0'));var rp=require(_0x1cf7('0x1'));var md5=require(_0x1cf7('0x2'));var util=require(_0x1cf7('0x3'));var moment=require('moment');var Promise=require(_0x1cf7('0x4'));var Redis=require(_0x1cf7('0x5'));var intUtil=require(_0x1cf7('0x6'));var config=require(_0x1cf7('0x7'));var logger=require(_0x1cf7('0x8'))(_0x1cf7('0x9'));config[_0x1cf7('0xa')]=_[_0x1cf7('0xb')](config[_0x1cf7('0xa')],{'host':_0x1cf7('0xc'),'port':0x18eb});var io=require(_0x1cf7('0xd'))(new Redis(config[_0x1cf7('0xa')]));function getAdminId(_0x4f908a,_0x52c8c8,_0xb4e19f,_0x21d3dd){return new Promise(function(_0x406ba0,_0x540557){var _0x318b81=![];var _0x57eab0={'method':'GET','uri':_0x21d3dd+_0x1cf7('0xe'),'json':!![]};_0x57eab0[_0x1cf7('0xf')]=_0xb4e19f;logger[_0x1cf7('0x10')](_0x1cf7('0x11'));return rp(_0x57eab0)[_0x1cf7('0x12')](function(_0x114592){if(_0x114592){var _0x5d0d31=_0x114592[_0x1cf7('0x13')];var _0x58c99f=null;for(_0x58c99f=0x0;_0x58c99f<_0x5d0d31[_0x1cf7('0x14')];_0x58c99f++){if(_0x5d0d31[_0x58c99f]['email']===_0x4f908a[_0x1cf7('0x15')]){_0x4f908a[_0x1cf7('0x16')]=_0x5d0d31[_0x58c99f]['id'];_0x318b81=!![];}}if(_0x318b81){logger['info'](_0x1cf7('0x17'),_0x4f908a[_0x1cf7('0x16')]);_0x406ba0(_0x4f908a);}else{_0x540557({'statusCode':0x194,'message':_0x1cf7('0x18')});}}else{_0x540557({'statusCode':0x194,'message':_0x1cf7('0x18')});}})[_0x1cf7('0x19')](function(_0x43d6e){logger[_0x1cf7('0x1a')]('['+[_0x52c8c8[_0x1cf7('0x1b')]()]+']',_0x43d6e[_0x1cf7('0x1c')]);_0x540557(_0x43d6e);});});}function getUser(_0x36653f,_0x2a3671,_0x148f07){return function(_0x3f762b){return new Promise(function(_0x49c948,_0x391553){var _0x1a8a23={'method':_0x1cf7('0x1d'),'uri':_0x148f07+'/api/selector/owners','json':!![]};_0x1a8a23[_0x1cf7('0xf')]=_0x2a3671;logger[_0x1cf7('0x10')](_0x1cf7('0x1e'));return rp(_0x1a8a23)['then'](function(_0x4cebf9){if(_0x4cebf9){var _0x2cf1ca=_0x4cebf9[_0x1cf7('0x13')];var _0x37fc26=![];var _0x2c20c4=null;if(_0x3f762b[_0x1cf7('0x1f')]!==null){logger[_0x1cf7('0x10')](_0x1cf7('0x20'),_0x3f762b[_0x1cf7('0x1f')]);_0x3f762b[_0x1cf7('0x21')]=_0x3f762b['agentEmail'];for(_0x2c20c4=0x0;_0x2c20c4<_0x2cf1ca[_0x1cf7('0x14')];_0x2c20c4++){if(_0x2cf1ca[_0x2c20c4][_0x1cf7('0x22')]===_0x3f762b[_0x1cf7('0x1f')]){_0x37fc26=!![];_0x3f762b[_0x1cf7('0x23')]=_0x2cf1ca[_0x2c20c4]['id'];logger[_0x1cf7('0x10')](_0x1cf7('0x24'),_0x3f762b[_0x1cf7('0x23')]);}}}if(!_0x37fc26){logger[_0x1cf7('0x10')]('Admin\x20selected');_0x3f762b['userEmail']=_0x3f762b['adminEmail'];_0x3f762b[_0x1cf7('0x23')]=_0x3f762b['adminId'];_0x37fc26=!![];}if(_0x37fc26){_0x49c948(_0x3f762b);}else{_0x391553({'statusCode':0x194,'message':_0x1cf7('0x18')});}}else{_0x391553({'statusCode':0x194,'message':_0x1cf7('0x18')});}})[_0x1cf7('0x19')](function(_0x1ce3ae){logger['error']('['+[_0x36653f['toUpperCase']()]+']',_0x1ce3ae[_0x1cf7('0x1c')]);_0x391553(_0x1ce3ae);});});};}function searchContact(_0x4273de,_0x1a9b20,_0x43b316,_0xc603ee){return new Promise(function(_0x1c4c04,_0x131e8b){var _0x5e2047={'method':_0x1cf7('0x1d'),'headers':_0x1a9b20,'uri':_0x4273de+'/api/lookup?q='+_0xc603ee+_0x1cf7('0x25')+_0x43b316+_0x1cf7('0x26'),'json':!![]};rp(_0x5e2047)[_0x1cf7('0x12')](function(_0x3afde2){var _0x3c56a1=_[_0x1cf7('0x27')](_0x3afde2[_0x1cf7('0x28')][_0x1cf7('0x28')],[_0x43b316,_0xc603ee]);_0x1c4c04(_0x3c56a1);})['catch'](function(_0x47f088){_0x131e8b(_0x47f088);});});}function getEndUser(_0x17608f,_0x3e1252,_0x290539){return function(_0x3a0312){return new Promise(function(_0x3e8da8,_0x5605f2){logger[_0x1cf7('0x10')](util['format'](_0x1cf7('0x29'),_0x3a0312[_0x1cf7('0x2a')]));searchContact(_0x290539,_0x3e1252,'mobile_number',_0x3a0312[_0x1cf7('0x2a')])[_0x1cf7('0x12')](function(_0x29a731){if(_0x29a731){_0x3a0312[_0x1cf7('0x2b')]=_0x29a731['id'];logger[_0x1cf7('0x10')](_0x1cf7('0x2c'),_0x3a0312['endUserId']);return _0x3e8da8(_0x3a0312);}searchContact(_0x290539,_0x3e1252,_0x1cf7('0x2d'),_0x3a0312['contactNumber'])['then'](function(_0x3f634c){if(_0x3f634c){_0x3a0312[_0x1cf7('0x2b')]=_0x3f634c['id'];logger[_0x1cf7('0x10')](_0x1cf7('0x2e'),_0x3a0312[_0x1cf7('0x2b')]);return _0x3e8da8(_0x3a0312);}createEndUser(_0x3a0312,_0x17608f,_0x3e1252,_0x290539)[_0x1cf7('0x12')](function(_0x49c6ae){logger['info'](_0x1cf7('0x2f'),_0x49c6ae[_0x1cf7('0x2b')]);return _0x3e8da8(_0x49c6ae);});});})[_0x1cf7('0x19')](function(_0x46a3ac){_0x5605f2(_0x46a3ac);});});};}function createEndUser(_0x410247,_0x429713,_0x4536d8,_0xb39bbf){return new Promise(function(_0x2dbbaf,_0x4212c1){var _0x5afa86=moment();var _0x43035d={'method':'POST','uri':_0xb39bbf+_0x1cf7('0x30'),'body':{'contact':{'last_name':_0x410247[_0x1cf7('0x2a')],'work_number':_0x410247['contactNumber'],'mobile_number':_0x410247['contactNumber'],'owner_id':_0x410247['userId'],'created_at':_0x5afa86['format'](_0x1cf7('0x31'))}},'json':!![]};_0x43035d[_0x1cf7('0xf')]=_0x4536d8;logger[_0x1cf7('0x10')](_0x1cf7('0x32'));return rp(_0x43035d)[_0x1cf7('0x12')](function(_0x7e723e){_0x410247[_0x1cf7('0x2b')]=_0x7e723e[_0x1cf7('0x33')]['id'];_0x2dbbaf(_0x410247);})['catch'](function(_0x11a45d){logger[_0x1cf7('0x1a')]('['+[_0x429713[_0x1cf7('0x1b')]()]+']',_0x11a45d[_0x1cf7('0x1c')]);_0x4212c1(_0x11a45d[_0x1cf7('0x1c')]);});});}function getTicket(_0x24100d,_0x3c8dba,_0x29924b,_0xa7e3e6,_0xcdef76){return function(_0x41c4b0){logger[_0x1cf7('0x10')](_0x1cf7('0x34'));return new Promise(function(_0x4788ca,_0x365c07){var _0x20d844=moment();var _0x16bf17={'method':_0x1cf7('0x35'),'uri':_0x29924b+'/api/tasks','body':{'title':intUtil[_0x1cf7('0x36')](_0xa7e3e6['Subjects'],_0xcdef76,'\x20'),'description':intUtil[_0x1cf7('0x36')](_0xa7e3e6[_0x1cf7('0x37')],_0xcdef76,'\x0a'),'owner_id':_0x41c4b0[_0x1cf7('0x23')],'creater_id':_0x41c4b0[_0x1cf7('0x16')],'targetable_id':_0x41c4b0[_0x1cf7('0x2b')],'targetable_type':_0x1cf7('0x38'),'created_at':_0x20d844[_0x1cf7('0x39')](_0x1cf7('0x31')),'due_date':_0x20d844['add'](0x1e,'m')[_0x1cf7('0x39')](_0x1cf7('0x31'))},'json':!![]};_0x16bf17[_0x1cf7('0xf')]=_0x3c8dba;return rp(_0x16bf17)[_0x1cf7('0x12')](function(_0x3ce8e3){_0x41c4b0[_0x1cf7('0x3a')]=_0x3ce8e3[_0x1cf7('0x3b')]['id'];logger[_0x1cf7('0x10')](_0x1cf7('0x3c'),_0x41c4b0['ticketId']);_0x4788ca(_0x41c4b0);})[_0x1cf7('0x19')](function(_0x29d2a3){logger[_0x1cf7('0x1a')]('['+[_0x24100d['toUpperCase']()]+']',_0x29d2a3[_0x1cf7('0x1c')]);_0x365c07(_0x29d2a3[_0x1cf7('0x1c')]);});});};}function emit(_0x6ccc3a,_0x338ebf,_0x1488e7){var _0x3a3add={'uri':_0x6ccc3a+_0x1cf7('0x3d')+_0x1488e7};io['to'](util[_0x1cf7('0x39')]('user:%s',_0x338ebf))[_0x1cf7('0x3e')](_0x1cf7('0x3f'),_0x3a3add);}exports['cs']=function(_0x3828d0,_0x2885b0,_0x117b8d,_0x18fdf8,_0x31c6e6,_0x1ea5e6,_0x26bc61,_0x4f27fc){var _0xa608b6={};var _0x229c9f={'Authorization':'Token\x20token='+_0x1ea5e6[_0x1cf7('0x40')]};_0x1ea5e6[_0x1cf7('0x41')]=intUtil[_0x1cf7('0x42')](_0x1ea5e6[_0x1cf7('0x41')]);_0x1ea5e6[_0x1cf7('0x43')]=intUtil[_0x1cf7('0x42')](_0x1ea5e6[_0x1cf7('0x43')]);var _0x649881=_0x1ea5e6['remoteUri'];_0xa608b6['adminEmail']=_0x1ea5e6[_0x1cf7('0x44')];_0xa608b6[_0x1cf7('0x2a')]=_0x4f27fc[_0x1cf7('0x45')]()===_0x1cf7('0x46')?_0x2885b0[_0x1cf7('0x47')]:_0x2885b0[_0x1cf7('0x48')];_0xa608b6[_0x1cf7('0x49')]=_0x4f27fc===_0x1cf7('0x4a')||_0x4f27fc===_0x1cf7('0x4b')?_0x1cf7('0x4a'):_0x1cf7('0x46');if(_0x18fdf8){_0xa608b6[_0x1cf7('0x1f')]=_0x18fdf8[_0x1cf7('0x22')];}var _0x216604=util['format'](_0x1cf7('0x4c'),_0x1ea5e6[_0x1cf7('0x43')],_0x2885b0['uniqueid'],md5(_0x2885b0[_0x1cf7('0x4d')]));if(_0x31c6e6&&_0x31c6e6[_0x1cf7('0x4e')]){logger[_0x1cf7('0x10')](_0x1cf7('0x4f'),'Recording\x20is\x20enabled!');_0x2885b0[_0x1cf7('0x50')]=_0x216604;}else if(_0x26bc61&&_0x26bc61[_0x1cf7('0x51')]&&_0x26bc61[_0x1cf7('0x51')]!=='none'){logger['info'](_0x1cf7('0x52'),_0x1cf7('0x53'));_0x2885b0[_0x1cf7('0x50')]=_0x216604;}else{_0x2885b0[_0x1cf7('0x50')]='';}return getAdminId(_0xa608b6,_0x4f27fc,_0x229c9f,_0x649881)[_0x1cf7('0x12')](getUser(_0x4f27fc,_0x229c9f,_0x649881))[_0x1cf7('0x12')](getEndUser(_0x4f27fc,_0x229c9f,_0x649881))[_0x1cf7('0x12')](getTicket(_0x4f27fc,_0x229c9f,_0x649881,_0x117b8d,_0x2885b0))['then'](function(_0x311e31){logger['info'](util[_0x1cf7('0x39')](_0x1cf7('0x54'),_0x311e31['ticketId']));if(_0x4f27fc!==_0x1cf7('0x4b')){logger[_0x1cf7('0x10')]('['+[_0x4f27fc[_0x1cf7('0x1b')]()]+']',_0x1cf7('0x55'));emit(_0x649881,_0x18fdf8['name'],_0x311e31[_0x1cf7('0x2b')]);}})[_0x1cf7('0x19')](function(_0x440ca1){logger[_0x1cf7('0x1a')]('['+[_0x4f27fc['toUpperCase']()]+_0x1cf7('0x56'),util[_0x1cf7('0x57')](_0x440ca1,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2a9a=['outbound','destcalleridnum','calleridnum','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','GET','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','Admin\x20found:','catch','error','message','/api/selector/owners','Getting\x20user\x20list','agentEmail','userEmail','Admin\x20selected','userId','adminId','Requested\x20Resource\x20not\x20Found','toUpperCase','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','add','task','Task\x20created:','ticketId','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x2a9a,0x64));var _0xa2a9=function(_0x2e0dc2,_0x40a0bd){_0x2e0dc2=_0x2e0dc2-0x0;var _0x37dcd0=_0x2a9a[_0x2e0dc2];return _0x37dcd0;};'use strict';var _=require(_0xa2a9('0x0'));var rp=require('request-promise');var md5=require(_0xa2a9('0x1'));var util=require('util');var moment=require('moment');var Promise=require(_0xa2a9('0x2'));var Redis=require(_0xa2a9('0x3'));var intUtil=require(_0xa2a9('0x4'));var config=require(_0xa2a9('0x5'));var logger=require(_0xa2a9('0x6'))('freshsales');config[_0xa2a9('0x7')]=_[_0xa2a9('0x8')](config[_0xa2a9('0x7')],{'host':_0xa2a9('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminId(_0x540979,_0x523164,_0x40d8b2,_0x1cc641){return new Promise(function(_0x3eaaa6,_0x710040){var _0x47a690=![];var _0x2daf1c={'method':_0xa2a9('0xa'),'uri':_0x1cc641+'/api/selector/owners','json':!![]};_0x2daf1c[_0xa2a9('0xb')]=_0x40d8b2;logger[_0xa2a9('0xc')](_0xa2a9('0xd'));return rp(_0x2daf1c)[_0xa2a9('0xe')](function(_0x4fb822){if(_0x4fb822){var _0x18f13d=_0x4fb822[_0xa2a9('0xf')];var _0x31b217=null;for(_0x31b217=0x0;_0x31b217<_0x18f13d[_0xa2a9('0x10')];_0x31b217++){if(_0x18f13d[_0x31b217][_0xa2a9('0x11')]===_0x540979[_0xa2a9('0x12')]){_0x540979['adminId']=_0x18f13d[_0x31b217]['id'];_0x47a690=!![];}}if(_0x47a690){logger[_0xa2a9('0xc')](_0xa2a9('0x13'),_0x540979['adminId']);_0x3eaaa6(_0x540979);}else{_0x710040({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x710040({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xa2a9('0x14')](function(_0x53a6a1){logger[_0xa2a9('0x15')]('['+[_0x523164['toUpperCase']()]+']',_0x53a6a1[_0xa2a9('0x16')]);_0x710040(_0x53a6a1);});});}function getUser(_0x11838f,_0x657934,_0x74e4a5){return function(_0x4d8707){return new Promise(function(_0x23f9bb,_0x574964){var _0x2d9864={'method':'GET','uri':_0x74e4a5+_0xa2a9('0x17'),'json':!![]};_0x2d9864['headers']=_0x657934;logger[_0xa2a9('0xc')](_0xa2a9('0x18'));return rp(_0x2d9864)[_0xa2a9('0xe')](function(_0x12a238){if(_0x12a238){var _0x39b378=_0x12a238[_0xa2a9('0xf')];var _0x17ccc3=![];var _0x447338=null;if(_0x4d8707[_0xa2a9('0x19')]!==null){logger[_0xa2a9('0xc')]('Getting\x20user\x20with\x20email',_0x4d8707[_0xa2a9('0x19')]);_0x4d8707[_0xa2a9('0x1a')]=_0x4d8707[_0xa2a9('0x19')];for(_0x447338=0x0;_0x447338<_0x39b378[_0xa2a9('0x10')];_0x447338++){if(_0x39b378[_0x447338][_0xa2a9('0x11')]===_0x4d8707[_0xa2a9('0x19')]){_0x17ccc3=!![];_0x4d8707['userId']=_0x39b378[_0x447338]['id'];logger[_0xa2a9('0xc')]('User\x20found:',_0x4d8707['userId']);}}}if(!_0x17ccc3){logger['info'](_0xa2a9('0x1b'));_0x4d8707[_0xa2a9('0x1a')]=_0x4d8707['adminEmail'];_0x4d8707[_0xa2a9('0x1c')]=_0x4d8707[_0xa2a9('0x1d')];_0x17ccc3=!![];}if(_0x17ccc3){_0x23f9bb(_0x4d8707);}else{_0x574964({'statusCode':0x194,'message':_0xa2a9('0x1e')});}}else{_0x574964({'statusCode':0x194,'message':_0xa2a9('0x1e')});}})['catch'](function(_0x3be9c0){logger[_0xa2a9('0x15')]('['+[_0x11838f[_0xa2a9('0x1f')]()]+']',_0x3be9c0['message']);_0x574964(_0x3be9c0);});});};}function searchContact(_0x29cff8,_0x1089ca,_0x44ea8e,_0x48ca76){return new Promise(function(_0x5f27d9,_0x4cfd47){var _0x10b84f={'method':_0xa2a9('0xa'),'headers':_0x1089ca,'uri':_0x29cff8+_0xa2a9('0x20')+_0x48ca76+_0xa2a9('0x21')+_0x44ea8e+_0xa2a9('0x22'),'json':!![]};rp(_0x10b84f)['then'](function(_0x247fc5){var _0x309fec=_[_0xa2a9('0x23')](_0x247fc5[_0xa2a9('0x24')][_0xa2a9('0x24')],[_0x44ea8e,_0x48ca76]);_0x5f27d9(_0x309fec);})['catch'](function(_0x4bfa9b){_0x4cfd47(_0x4bfa9b);});});}function getEndUser(_0x3a0100,_0x57bbbd,_0x5a4ca6){return function(_0x6825cf){return new Promise(function(_0x391d7c,_0x1a6b77){logger['info'](util[_0xa2a9('0x25')](_0xa2a9('0x26'),_0x6825cf[_0xa2a9('0x27')]));searchContact(_0x5a4ca6,_0x57bbbd,_0xa2a9('0x28'),_0x6825cf['contactNumber'])[_0xa2a9('0xe')](function(_0x466d49){if(_0x466d49){_0x6825cf[_0xa2a9('0x29')]=_0x466d49['id'];logger[_0xa2a9('0xc')]('Contact\x20found\x20mobile_number:',_0x6825cf[_0xa2a9('0x29')]);return _0x391d7c(_0x6825cf);}searchContact(_0x5a4ca6,_0x57bbbd,'work_number',_0x6825cf[_0xa2a9('0x27')])['then'](function(_0x4451b3){if(_0x4451b3){_0x6825cf[_0xa2a9('0x29')]=_0x4451b3['id'];logger[_0xa2a9('0xc')]('Contact\x20found\x20work_number:',_0x6825cf['endUserId']);return _0x391d7c(_0x6825cf);}createEndUser(_0x6825cf,_0x3a0100,_0x57bbbd,_0x5a4ca6)[_0xa2a9('0xe')](function(_0x4ecbcf){logger[_0xa2a9('0xc')]('Contact\x20created:',_0x4ecbcf[_0xa2a9('0x29')]);return _0x391d7c(_0x4ecbcf);});});})['catch'](function(_0x11d7e3){_0x1a6b77(_0x11d7e3);});});};}function createEndUser(_0x4eff2a,_0x556a9e,_0x597a20,_0x563803){return new Promise(function(_0x329f57,_0x1ee592){var _0xc49323=moment();var _0x560bed={'method':_0xa2a9('0x2a'),'uri':_0x563803+_0xa2a9('0x2b'),'body':{'contact':{'last_name':_0x4eff2a['contactNumber'],'work_number':_0x4eff2a['contactNumber'],'mobile_number':_0x4eff2a[_0xa2a9('0x27')],'owner_id':_0x4eff2a[_0xa2a9('0x1c')],'created_at':_0xc49323['format'](_0xa2a9('0x2c'))}},'json':!![]};_0x560bed[_0xa2a9('0xb')]=_0x597a20;logger['info'](_0xa2a9('0x2d'));return rp(_0x560bed)[_0xa2a9('0xe')](function(_0x4752d2){_0x4eff2a[_0xa2a9('0x29')]=_0x4752d2[_0xa2a9('0x2e')]['id'];_0x329f57(_0x4eff2a);})[_0xa2a9('0x14')](function(_0x1ddec3){logger[_0xa2a9('0x15')]('['+[_0x556a9e[_0xa2a9('0x1f')]()]+']',_0x1ddec3[_0xa2a9('0x16')]);_0x1ee592(_0x1ddec3[_0xa2a9('0x16')]);});});}function getTicket(_0x4605bd,_0x18626b,_0x451295,_0x5d5e7c,_0x2b2525){return function(_0x529fcf){logger[_0xa2a9('0xc')](_0xa2a9('0x2f'));return new Promise(function(_0xbdf19a,_0x1404ce){var _0x125bc0=moment();var _0x20fd9b={'method':'POST','uri':_0x451295+_0xa2a9('0x30'),'body':{'title':intUtil[_0xa2a9('0x31')](_0x5d5e7c['Subjects'],_0x2b2525,'\x20'),'description':intUtil['getString'](_0x5d5e7c[_0xa2a9('0x32')],_0x2b2525,'\x0a'),'owner_id':_0x529fcf['userId'],'creater_id':_0x529fcf['adminId'],'targetable_id':_0x529fcf['endUserId'],'targetable_type':_0xa2a9('0x33'),'created_at':_0x125bc0['format'](_0xa2a9('0x2c')),'due_date':_0x125bc0[_0xa2a9('0x34')](0x1e,'m')[_0xa2a9('0x25')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x20fd9b[_0xa2a9('0xb')]=_0x18626b;return rp(_0x20fd9b)[_0xa2a9('0xe')](function(_0x3af766){_0x529fcf['ticketId']=_0x3af766[_0xa2a9('0x35')]['id'];logger[_0xa2a9('0xc')](_0xa2a9('0x36'),_0x529fcf[_0xa2a9('0x37')]);_0xbdf19a(_0x529fcf);})[_0xa2a9('0x14')](function(_0xcc471c){logger[_0xa2a9('0x15')]('['+[_0x4605bd[_0xa2a9('0x1f')]()]+']',_0xcc471c[_0xa2a9('0x16')]);_0x1404ce(_0xcc471c[_0xa2a9('0x16')]);});});};}function emit(_0x18f6e8,_0x21e9a8,_0x4fd341){var _0x488172={'uri':_0x18f6e8+_0xa2a9('0x38')+_0x4fd341};io['to'](util[_0xa2a9('0x25')](_0xa2a9('0x39'),_0x21e9a8))[_0xa2a9('0x3a')](_0xa2a9('0x3b'),_0x488172);}exports['cs']=function(_0x23a5e8,_0x2d2d5d,_0x2d7df7,_0x56f492,_0x18ea5a,_0x1d02cb,_0x53e2dc,_0x323406){var _0x569e6a={};var _0x2c99ee={'Authorization':_0xa2a9('0x3c')+_0x1d02cb[_0xa2a9('0x3d')]};_0x1d02cb[_0xa2a9('0x3e')]=intUtil['stripTrailingSlash'](_0x1d02cb[_0xa2a9('0x3e')]);_0x1d02cb['serverUrl']=intUtil['stripTrailingSlash'](_0x1d02cb[_0xa2a9('0x3f')]);var _0x2489c0=_0x1d02cb[_0xa2a9('0x3e')];_0x569e6a[_0xa2a9('0x12')]=_0x1d02cb['username'];_0x569e6a['contactNumber']=_0x323406['toLowerCase']()===_0xa2a9('0x40')?_0x2d2d5d[_0xa2a9('0x41')]:_0x2d2d5d[_0xa2a9('0x42')];_0x569e6a['callDirection']=_0x323406===_0xa2a9('0x43')||_0x323406===_0xa2a9('0x44')?'queue':_0xa2a9('0x40');if(_0x56f492){_0x569e6a[_0xa2a9('0x19')]=_0x56f492['email'];}var _0x33c12d=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1d02cb[_0xa2a9('0x3f')],_0x2d2d5d[_0xa2a9('0x45')],md5(_0x2d2d5d[_0xa2a9('0x45')]));if(_0x18ea5a&&_0x18ea5a[_0xa2a9('0x46')]){logger['info'](_0xa2a9('0x47'),_0xa2a9('0x48'));_0x2d2d5d[_0xa2a9('0x49')]=_0x33c12d;}else if(_0x53e2dc&&_0x53e2dc['recordingFormat']&&_0x53e2dc[_0xa2a9('0x4a')]!==_0xa2a9('0x4b')){logger[_0xa2a9('0xc')](_0xa2a9('0x4c'),_0xa2a9('0x48'));_0x2d2d5d[_0xa2a9('0x49')]=_0x33c12d;}else{_0x2d2d5d[_0xa2a9('0x49')]='';}return getAdminId(_0x569e6a,_0x323406,_0x2c99ee,_0x2489c0)[_0xa2a9('0xe')](getUser(_0x323406,_0x2c99ee,_0x2489c0))[_0xa2a9('0xe')](getEndUser(_0x323406,_0x2c99ee,_0x2489c0))[_0xa2a9('0xe')](getTicket(_0x323406,_0x2c99ee,_0x2489c0,_0x2d7df7,_0x2d2d5d))[_0xa2a9('0xe')](function(_0x25cf6b){logger[_0xa2a9('0xc')](util[_0xa2a9('0x25')](_0xa2a9('0x4d'),_0x25cf6b[_0xa2a9('0x37')]));if(_0x323406!==_0xa2a9('0x44')){logger[_0xa2a9('0xc')]('['+[_0x323406[_0xa2a9('0x1f')]()]+']',_0xa2a9('0x4e'));emit(_0x2489c0,_0x56f492[_0xa2a9('0x4f')],_0x25cf6b[_0xa2a9('0x29')]);}})['catch'](function(_0x3c5efb){logger[_0xa2a9('0x15')]('['+[_0x323406[_0xa2a9('0x1f')]()]+_0xa2a9('0x50'),util[_0xa2a9('0x51')](_0x3c5efb,{'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 77fd80e..5173f70 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 _0xd8b0=['dynamics365','freshsales','servicenow','exec','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','freshdesk','vtiger','unknown\x20integration','../../../../config/logger','error','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./freshdesk','./zoho','./desk','./vtiger','./servicenow','zendesk','salesforce','sugarcrm','zoho','desk'];(function(_0xdd6ba3,_0x5b935f){var _0x17bbf8=function(_0x3aa78d){while(--_0x3aa78d){_0xdd6ba3['push'](_0xdd6ba3['shift']());}};_0x17bbf8(++_0x5b935f);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x0d8b('0x2'));var zoho=require(_0x0d8b('0x3'));var desk=require(_0x0d8b('0x4'));var vtiger=require(_0x0d8b('0x5'));var servicenow=require(_0x0d8b('0x6'));var dynamics365=require('./dynamics365');var freshsales=require('./freshsales');var integrations=[_0x0d8b('0x7'),_0x0d8b('0x8'),_0x0d8b('0x9'),'freshdesk',_0x0d8b('0xa'),_0x0d8b('0xb'),'vtiger',_0x0d8b('0xc'),_0x0d8b('0xd'),_0x0d8b('0xe')];exports[_0x0d8b('0xf')]=function(_0x28ff7f,_0x1cac62,_0x2c5e9e,_0x28f87c,_0x48fa16,_0x3c4bfa){if(_0x2c5e9e){if(_['includes'](integrations,_0x28ff7f[_0x0d8b('0x10')][_0x0d8b('0x11')]())){try{var _0x340cc4=null;var _0x92cdd8='';var _0x35a07b=_0x2c5e9e[_0x28ff7f[_0x0d8b('0x10')][_0x0d8b('0x11')]()];if(_0x35a07b){var _0x31a8cc=_0x35a07b[_0x28ff7f[_0x0d8b('0x12')]];if(_0x31a8cc){var _0x2ce75e=_[_0x0d8b('0x13')](_0x31a8cc[_0x0d8b('0x14')],{'id':parseInt(_0x28ff7f[_0x0d8b('0x15')],0xa)});if(_0x2ce75e){if(_0x28f87c){if(_0x48fa16&&_0x1cac62[_0x0d8b('0x16')]){_0x92cdd8='queue';}else if(_0x1cac62[_0x0d8b('0x17')]){_0x92cdd8=_0x0d8b('0x18');}else{console[_0x0d8b('0x19')](_0x0d8b('0x1a'),_0x1cac62);}}else{_0x92cdd8=_0x0d8b('0x1b');}switch(_0x28ff7f['data1'][_0x0d8b('0x11')]()){case _0x0d8b('0x7'):zendesk[_0x92cdd8](_0x28ff7f,_0x1cac62,_0x2ce75e,_0x28f87c,_0x48fa16,_0x31a8cc,_0x3c4bfa);break;case _0x0d8b('0x8'):salesforce[_0x92cdd8](_0x28ff7f,_0x1cac62,_0x2ce75e,_0x28f87c,_0x48fa16,_0x31a8cc,_0x3c4bfa);break;case _0x0d8b('0x9'):sugarcrm[_0x92cdd8](_0x28ff7f,_0x1cac62,_0x2ce75e,_0x28f87c,_0x48fa16,_0x31a8cc,_0x3c4bfa);break;case _0x0d8b('0x1c'):freshdesk[_0x92cdd8](_0x28ff7f,_0x1cac62,_0x2ce75e,_0x28f87c,_0x48fa16,_0x31a8cc,_0x3c4bfa);break;case _0x0d8b('0xa'):zoho[_0x92cdd8](_0x28ff7f,_0x1cac62,_0x2ce75e,_0x28f87c,_0x48fa16,_0x31a8cc,_0x3c4bfa);break;case _0x0d8b('0xb'):desk[_0x92cdd8](_0x28ff7f,_0x1cac62,_0x2ce75e,_0x28f87c,_0x48fa16,_0x31a8cc,_0x3c4bfa);break;case _0x0d8b('0x1d'):vtiger[_0x92cdd8](_0x28ff7f,_0x1cac62,_0x2ce75e,_0x28f87c,_0x48fa16,_0x31a8cc,_0x3c4bfa);break;case'freshsales':freshsales['cs'](_0x28ff7f,_0x1cac62,_0x2ce75e,_0x28f87c,_0x48fa16,_0x31a8cc,_0x3c4bfa,_0x92cdd8);break;case _0x0d8b('0xe'):servicenow['cs'](_0x28ff7f,_0x1cac62,_0x2ce75e,_0x28f87c,_0x48fa16,_0x31a8cc,_0x3c4bfa,_0x92cdd8);break;case _0x0d8b('0xc'):dynamics365['cs'](_0x28ff7f,_0x1cac62,_0x2ce75e,_0x28f87c,_0x48fa16,_0x31a8cc,_0x3c4bfa,_0x92cdd8);break;default:console[_0x0d8b('0x19')](_0x0d8b('0x1e'));}}else{_0x340cc4=require(_0x0d8b('0x1f'))(_0x28ff7f[_0x0d8b('0x10')][_0x0d8b('0x11')]());_0x340cc4[_0x0d8b('0x20')]('[EXEC]',util['format'](_0x0d8b('0x21'),_0x28ff7f['data1']['toLowerCase'](),_0x28ff7f['data3']));}}else{_0x340cc4=require(_0x0d8b('0x1f'))(_0x28ff7f[_0x0d8b('0x10')][_0x0d8b('0x11')]());_0x340cc4[_0x0d8b('0x20')](_0x0d8b('0x22'),util[_0x0d8b('0x23')](_0x0d8b('0x24'),_0x28ff7f[_0x0d8b('0x10')][_0x0d8b('0x11')](),_0x28ff7f['data2']));}}else{}}catch(_0xe8bbee){console[_0x0d8b('0x20')](_0xe8bbee);}}}}; \ No newline at end of file +var _0x93e9=['EVENT\x20UNKNOWN','unmanaged','desk','unknown\x20integration','../../../../config/logger','error','format','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','vtiger','dynamics365','freshsales','servicenow','exec','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log'];(function(_0x2aeba4,_0x47184c){var _0x3db727=function(_0x4b5056){while(--_0x4b5056){_0x2aeba4['push'](_0x2aeba4['shift']());}};_0x3db727(++_0x47184c);}(_0x93e9,0xcc));var _0x993e=function(_0x2c856c,_0x1eeaa6){_0x2c856c=_0x2c856c-0x0;var _0xa9d840=_0x93e9[_0x2c856c];return _0xa9d840;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var zendesk=require(_0x993e('0x2'));var salesforce=require(_0x993e('0x3'));var sugarcrm=require(_0x993e('0x4'));var freshdesk=require(_0x993e('0x5'));var zoho=require(_0x993e('0x6'));var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0x993e('0x7'));var dynamics365=require(_0x993e('0x8'));var freshsales=require(_0x993e('0x9'));var integrations=[_0x993e('0xa'),_0x993e('0xb'),_0x993e('0xc'),_0x993e('0xd'),_0x993e('0xe'),'desk',_0x993e('0xf'),_0x993e('0x10'),_0x993e('0x11'),_0x993e('0x12')];exports[_0x993e('0x13')]=function(_0x27a28f,_0x1c2324,_0x48291a,_0x196f6d,_0x10cf0e,_0x4fe40b){if(_0x48291a){if(_['includes'](integrations,_0x27a28f[_0x993e('0x14')]['toLowerCase']())){try{var _0x333aa9=null;var _0x5d5c0d='';var _0x4c2707=_0x48291a[_0x27a28f[_0x993e('0x14')][_0x993e('0x15')]()];if(_0x4c2707){var _0x156bef=_0x4c2707[_0x27a28f[_0x993e('0x16')]];if(_0x156bef){var _0x3e082b=_[_0x993e('0x17')](_0x156bef[_0x993e('0x18')],{'id':parseInt(_0x27a28f[_0x993e('0x19')],0xa)});if(_0x3e082b){if(_0x196f6d){if(_0x10cf0e&&_0x1c2324[_0x993e('0x1a')]){_0x5d5c0d=_0x993e('0x1a');}else if(_0x1c2324[_0x993e('0x1b')]){_0x5d5c0d=_0x993e('0x1c');}else{console[_0x993e('0x1d')](_0x993e('0x1e'),_0x1c2324);}}else{_0x5d5c0d=_0x993e('0x1f');}switch(_0x27a28f[_0x993e('0x14')][_0x993e('0x15')]()){case'zendesk':zendesk[_0x5d5c0d](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b);break;case _0x993e('0xb'):salesforce[_0x5d5c0d](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b);break;case _0x993e('0xc'):sugarcrm[_0x5d5c0d](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b);break;case _0x993e('0xd'):freshdesk[_0x5d5c0d](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b);break;case _0x993e('0xe'):zoho[_0x5d5c0d](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b);break;case _0x993e('0x20'):desk[_0x5d5c0d](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b);break;case _0x993e('0xf'):vtiger[_0x5d5c0d](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b);break;case'freshsales':freshsales['cs'](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b,_0x5d5c0d);break;case _0x993e('0x12'):servicenow['cs'](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b,_0x5d5c0d);break;case _0x993e('0x10'):dynamics365['cs'](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b,_0x5d5c0d);break;default:console[_0x993e('0x1d')](_0x993e('0x21'));}}else{_0x333aa9=require(_0x993e('0x22'))(_0x27a28f[_0x993e('0x14')][_0x993e('0x15')]());_0x333aa9[_0x993e('0x23')]('[EXEC]',util[_0x993e('0x24')]('%s\x20configuration\x20#%s\x20not\x20found',_0x27a28f[_0x993e('0x14')][_0x993e('0x15')](),_0x27a28f[_0x993e('0x19')]));}}else{_0x333aa9=require('../../../../config/logger')(_0x27a28f[_0x993e('0x14')][_0x993e('0x15')]());_0x333aa9[_0x993e('0x23')](_0x993e('0x25'),util[_0x993e('0x24')](_0x993e('0x26'),_0x27a28f[_0x993e('0x14')][_0x993e('0x15')](),_0x27a28f[_0x993e('0x16')]));}}else{}}catch(_0x18f6ac){console[_0x993e('0x23')](_0x18f6ac);}}}}; \ 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 94053c1..3107370 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 _0xb7a2=['Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','queue','user:%s','trigger:browser:url','%s/%s/e','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','stringify','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','integrationTab','trigger:salesforce:display','newTab','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','util','../../../../config/environment','../../../../config/logger','salesforce','defaults','redis','socket.io-emitter','emit','getString','Subjects','ticketType','Task','ActivityDate','IsReminderSet','IsRecurrence','WhoId','Case','endUserType','contact','ContactId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','User','find','execute','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','moduleSearch','Contact','length','Lead','Phone','attributes','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','upperFirst','forEach','string','picklist','idField','content','toString','variable','variableName'];(function(_0x167117,_0x2dee70){var _0x387b70=function(_0x58f7e0){while(--_0x58f7e0){_0x167117['push'](_0x167117['shift']());}};_0x387b70(++_0x2dee70);}(_0xb7a2,0xa4));var _0x2b7a=function(_0x13eef2,_0x2413a6){_0x13eef2=_0x13eef2-0x0;var _0x827a26=_0xb7a2[_0x13eef2];return _0x827a26;};'use strict';var _=require(_0x2b7a('0x0'));var rp=require(_0x2b7a('0x1'));var moment=require(_0x2b7a('0x2'));var BPromise=require(_0x2b7a('0x3'));var md5=require('md5');var jsforce=require(_0x2b7a('0x4'));var util=require(_0x2b7a('0x5'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x2b7a('0x6'));var logger=require(_0x2b7a('0x7'))(_0x2b7a('0x8'));config['redis']=_[_0x2b7a('0x9')](config[_0x2b7a('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x2b7a('0xb'))(new Redis(config['redis']));function emit(_0x2934fb,_0xf09ed8,_0x5affac){io['to'](_0x2934fb)[_0x2b7a('0xc')](_0xf09ed8,_0x5affac);}function getTicket(_0x1f8071,_0x425c08,_0x1fbada,_0x269ab8,_0x1e551f,_0x5de533,_0x359038,_0x267200){var _0x4acbd9=Object['assign']({},{'OwnerId':_0x425c08['id'],'Subject':intUtil[_0x2b7a('0xd')](_0x269ab8[_0x2b7a('0xe')],_0x1e551f,'\x20'),'Description':intUtil[_0x2b7a('0xd')](_0x269ab8['Descriptions'],_0x1e551f,'\x0a')},getCustomFields(_0x5de533,_0x1e551f));if(_0x1fbada){if(_0x269ab8[_0x2b7a('0xf')]===_0x2b7a('0x10')){_0x4acbd9[_0x2b7a('0x11')]=moment['utc']();_0x4acbd9[_0x2b7a('0x12')]=![];_0x4acbd9[_0x2b7a('0x13')]=![];_0x4acbd9[_0x2b7a('0x14')]=_0x1fbada['id'];}else if(_0x269ab8['ticketType']===_0x2b7a('0x15')){if(_0x1fbada[_0x2b7a('0x16')]===_0x2b7a('0x17')){_0x4acbd9[_0x2b7a('0x18')]=_0x1fbada['id'];}else if(_0x1fbada[_0x2b7a('0x16')]===_0x2b7a('0x19')&&_0x269ab8[_0x2b7a('0x1a')]){_0x4acbd9[_0x269ab8[_0x2b7a('0x1a')]]=_0x1fbada['id'];}else{logger[_0x2b7a('0x1b')](_0x2b7a('0x1c'));}}}return _0x359038[_0x2b7a('0x1d')](_0x269ab8[_0x2b7a('0xf')])[_0x2b7a('0x1e')](_0x4acbd9);}function getUser(_0x50c145,_0x1d9607,_0x13c7d1){if(!_[_0x2b7a('0x1f')](_0x1d9607)&&intUtil['validateEmail'](_0x1d9607)){var _0x54522d={'Email':_0x1d9607};var _0x250f87={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x13c7d1['sobject'](_0x2b7a('0x20'))[_0x2b7a('0x21')](_0x54522d,_0x250f87)[_0x2b7a('0x22')]()['then'](function(_0x412349){if(_0x412349['length']){var _0x37b371=_[_0x2b7a('0x21')](_0x412349,function(_0x27cacd){return _0x27cacd[_0x2b7a('0x23')]===_0x1d9607;});if(_0x37b371){logger[_0x2b7a('0x1b')](_0x2b7a('0x24'),_0x1d9607);return BPromise[_0x2b7a('0x25')]({'id':_0x37b371['Id'],'name':_0x37b371[_0x2b7a('0x26')]});}}else{logger[_0x2b7a('0x1b')](_0x2b7a('0x27'),_0x1d9607);return _0x13c7d1[_0x2b7a('0x28')]()[_0x2b7a('0x29')](function(_0x2e9f38){return BPromise[_0x2b7a('0x25')]({'id':_0x2e9f38[_0x2b7a('0x2a')],'name':_0x2e9f38['display_name']});});}});}else{logger['info'](_0x2b7a('0x27'),_0x1d9607);return _0x13c7d1[_0x2b7a('0x28')]()[_0x2b7a('0x29')](function(_0x579a0d){return BPromise['resolve']({'id':_0x579a0d[_0x2b7a('0x2a')],'name':_0x579a0d[_0x2b7a('0x2b')]});});}}function getEndUser(_0x23a8e4,_0x20c347,_0xd56bfe,_0x3a5f32,_0x44ced2){var _0x3b6165={'Phone':_0x3a5f32};var _0x5abc08={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){logger[_0x2b7a('0x1b')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x3a5f32,_0x20c347['moduleSearch']);switch(_0x20c347[_0x2b7a('0x2c')]){case'contact_lead':return _0x44ced2[_0x2b7a('0x1d')](_0x2b7a('0x2d'))[_0x2b7a('0x21')](_0x3b6165,_0x5abc08)[_0x2b7a('0x22')]()[_0x2b7a('0x29')](function(_0x4061a6){if(_0x4061a6&&_0x4061a6[_0x2b7a('0x2e')]){return _0x4061a6;}else{return _0x44ced2[_0x2b7a('0x1d')](_0x2b7a('0x2f'))[_0x2b7a('0x21')](_0x3b6165,_0x5abc08);}});case'contact':return _0x44ced2[_0x2b7a('0x1d')](_0x2b7a('0x2d'))['find'](_0x3b6165,_0x5abc08)[_0x2b7a('0x22')]();case _0x2b7a('0x19'):return _0x44ced2['sobject'](_0x2b7a('0x2f'))[_0x2b7a('0x21')](_0x3b6165,_0x5abc08);default:return null;}})[_0x2b7a('0x29')](function(_0x1e4ea7){if(_0x1e4ea7&&_0x1e4ea7[_0x2b7a('0x2e')]){var _0x34169a=_[_0x2b7a('0x21')](_0x1e4ea7,function(_0x2bf55f){return _0x2bf55f[_0x2b7a('0x30')]===_0x3a5f32;});if(_0x34169a){return BPromise['resolve']({'id':_0x34169a['Id'],'name':_0x34169a[_0x2b7a('0x26')],'phone':_0x34169a[_0x2b7a('0x30')],'endUserType':_0x34169a[_0x2b7a('0x31')][_0x2b7a('0x32')][_0x2b7a('0x33')]()});}}})[_0x2b7a('0x29')](function(_0x310863){if(_0x310863){logger[_0x2b7a('0x1b')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x310863[_0x2b7a('0x16')],_0x3a5f32);return BPromise[_0x2b7a('0x25')](_0x310863);}else{logger[_0x2b7a('0x1b')](_0x2b7a('0x34'),_0x3a5f32);var _0x1dcdc1={'LastName':_0xd56bfe!==_0x2b7a('0x35')?_0xd56bfe:util[_0x2b7a('0x36')](_0x2b7a('0x37'),_0x3a5f32),'Phone':_0x3a5f32};if(_0x20c347['moduleCreate']){if(_0x20c347[_0x2b7a('0x38')]===_0x2b7a('0x17')){logger[_0x2b7a('0x1b')](_0x2b7a('0x39'),_0x3a5f32,_0x20c347[_0x2b7a('0x38')]);}else if(_0x20c347[_0x2b7a('0x38')]===_0x2b7a('0x19')){logger[_0x2b7a('0x1b')](_0x2b7a('0x39'),_0x3a5f32,_0x20c347[_0x2b7a('0x38')]);_0x1dcdc1[_0x2b7a('0x3a')]='No\x20Company';}else{return null;}}return _0x44ced2[_0x2b7a('0x1d')](_[_0x2b7a('0x3b')](_0x20c347[_0x2b7a('0x38')]))[_0x2b7a('0x1e')](_0x1dcdc1)[_0x2b7a('0x29')](function(_0x35f76d){return BPromise[_0x2b7a('0x25')]({'id':_0x35f76d['id'],'endUserType':_0x20c347[_0x2b7a('0x38')]});});}});}function getCustomFields(_0x13a47b,_0x49ffdc){var _0x4411cd={};if(_0x13a47b['length']>0x0){_[_0x2b7a('0x3c')](_0x13a47b,function(_0xfd755f){if(_['includes']([_0x2b7a('0x3d'),_0x2b7a('0x3e')],_0xfd755f['type'])&&_0xfd755f[_0x2b7a('0x3f')]){_0x4411cd[_0xfd755f[_0x2b7a('0x3f')]]=_0xfd755f[_0x2b7a('0x40')][_0x2b7a('0x41')]();}else if(_0xfd755f[_0x2b7a('0x32')]===_0x2b7a('0x42')&&_0xfd755f[_0x2b7a('0x43')]&&_0xfd755f['idField']){_0x49ffdc[_0xfd755f[_0x2b7a('0x43')]]&&(_0x4411cd[_0xfd755f['idField']]=_0x49ffdc[_0xfd755f['variableName']]['toString']());}else if(_0xfd755f[_0x2b7a('0x32')]==='customVariable'&&_0xfd755f[_0x2b7a('0x44')]&&_0xfd755f['Variable'][_0x2b7a('0x45')]&&_0xfd755f[_0x2b7a('0x3f')]){_0x49ffdc[_0xfd755f[_0x2b7a('0x44')][_0x2b7a('0x45')][_0x2b7a('0x33')]()]&&(_0x4411cd[_0xfd755f[_0x2b7a('0x3f')]]=_0x49ffdc[_0xfd755f[_0x2b7a('0x44')][_0x2b7a('0x45')]['toLowerCase']()][_0x2b7a('0x41')]());}});}return _0x4411cd;}function getConnection(_0x85c1a2){var _0x223fdf=_0x85c1a2[_0x2b7a('0x46')][_0x2b7a('0x47')](_0x85c1a2[_0x2b7a('0x48')]);var _0x44fc2f=new jsforce[(_0x2b7a('0x49'))]({'oauth2':{'loginUrl':_0x85c1a2[_0x2b7a('0x4a')]||_0x2b7a('0x4b'),'clientId':_0x85c1a2[_0x2b7a('0x4c')],'clientSecret':_0x85c1a2[_0x2b7a('0x4d')]}});return _0x44fc2f['login'](_0x85c1a2[_0x2b7a('0x4e')],_0x223fdf)[_0x2b7a('0x29')](function(){logger['info'](_0x2b7a('0x4f'));return _0x44fc2f;});}exports['queue']=function(_0x2b1db9,_0x303e8c,_0x2517dc,_0x2a148e,_0x1b2f66,_0x543cb8){var _0x2def60,_0x354ae1,_0x198afa,_0x29da20;_0x543cb8[_0x2b7a('0x50')]=intUtil[_0x2b7a('0x51')](_0x543cb8[_0x2b7a('0x50')]);_0x543cb8[_0x2b7a('0x4a')]=intUtil[_0x2b7a('0x51')](_0x543cb8[_0x2b7a('0x4a')]);if(_0x1b2f66&&_0x1b2f66[_0x2b7a('0x52')]){logger[_0x2b7a('0x1b')](_0x2b7a('0x53'),_0x2b7a('0x54'));_0x303e8c[_0x2b7a('0x55')]=util['format'](_0x2b7a('0x56'),_0x543cb8[_0x2b7a('0x50')],_0x303e8c[_0x2b7a('0x57')],md5(_0x303e8c[_0x2b7a('0x57')]));}else{_0x303e8c[_0x2b7a('0x55')]='';}return getConnection(_0x543cb8)[_0x2b7a('0x29')](function(_0x5d6916){_0x29da20=_0x5d6916;return getUser(_0x543cb8,_0x2a148e['email'],_0x29da20);})[_0x2b7a('0x29')](function(_0x11f206){_0x2def60=_0x11f206;return getEndUser(_0x543cb8,_0x2517dc,_0x303e8c[_0x2b7a('0x58')],_0x303e8c[_0x2b7a('0x59')],_0x29da20);})[_0x2b7a('0x29')](function(_0x57373a){_0x354ae1=_0x57373a;return getTicket(_0x543cb8,_0x2def60,_0x354ae1,_0x2517dc,_0x303e8c,_0x2517dc['Fields'],_0x29da20,_0x2b7a('0x5a'));})[_0x2b7a('0x29')](function(_0x16bfda){_0x198afa=_0x16bfda;logger[_0x2b7a('0x1b')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x198afa['id']);logger[_0x2b7a('0x1b')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x198afa['id'],_0x2a148e[_0x2b7a('0x45')],_0x543cb8[_0x2b7a('0x32')]);switch(_0x543cb8[_0x2b7a('0x32')]){case'integrationTab':emit(util[_0x2b7a('0x36')](_0x2b7a('0x5b'),_0x2a148e['name']),'trigger:salesforce:display',{'recordId':_0x198afa['id']});break;case'newTab':emit(util['format']('user:%s',_0x2a148e[_0x2b7a('0x45')]),_0x2b7a('0x5c'),{'uri':util[_0x2b7a('0x36')](_0x2b7a('0x5d'),_0x29da20['instanceUrl'],_0x198afa['id'])});break;default:logger['error'](_0x2b7a('0x5e'));}})[_0x2b7a('0x5f')](function(_0x3663bd){logger[_0x2b7a('0x60')](_0x2b7a('0x53'),JSON[_0x2b7a('0x61')](_0x3663bd));});};exports[_0x2b7a('0x62')]=function(_0x498385,_0x5e5d02,_0x383742,_0x50e69a,_0x11eb86,_0x374b27,_0x2e2a5a){var _0x1b423e,_0xcea9ea,_0x430132,_0xa1edfa;_0x374b27[_0x2b7a('0x50')]=intUtil[_0x2b7a('0x51')](_0x374b27[_0x2b7a('0x50')]);_0x374b27['remoteUri']=intUtil[_0x2b7a('0x51')](_0x374b27['remoteUri']);if(_0x2e2a5a&&_0x2e2a5a['recordingFormat']&&_0x2e2a5a[_0x2b7a('0x63')]!==_0x2b7a('0x64')){logger[_0x2b7a('0x1b')](_0x2b7a('0x65'),_0x2b7a('0x54'));_0x5e5d02[_0x2b7a('0x55')]=util[_0x2b7a('0x36')](_0x2b7a('0x56'),_0x374b27['serverUrl'],_0x5e5d02[_0x2b7a('0x57')],md5(_0x5e5d02[_0x2b7a('0x57')]));}return getConnection(_0x374b27)['then'](function(_0x57fa96){_0xa1edfa=_0x57fa96;return getUser(_0x374b27,_0x50e69a[_0x2b7a('0x66')],_0xa1edfa);})[_0x2b7a('0x29')](function(_0x4fbc10){_0x1b423e=_0x4fbc10;return getEndUser(_0x374b27,_0x383742,_0x5e5d02[_0x2b7a('0x67')],_0x5e5d02['destcalleridnum'],_0xa1edfa);})[_0x2b7a('0x29')](function(_0x26ceea){_0xcea9ea=_0x26ceea;return getTicket(_0x374b27,_0x1b423e,_0xcea9ea,_0x383742,_0x5e5d02,_0x383742[_0x2b7a('0x68')],_0xa1edfa,_0x2b7a('0x62'));})['then'](function(_0x56a08a){_0x430132=_0x56a08a;logger['info'](_0x2b7a('0x69'),_0x430132['id']);logger['info']('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x430132['id'],_0x50e69a[_0x2b7a('0x45')],_0x374b27[_0x2b7a('0x32')]);switch(_0x374b27[_0x2b7a('0x32')]){case _0x2b7a('0x6a'):emit(util[_0x2b7a('0x36')]('user:%s',_0x50e69a[_0x2b7a('0x45')]),_0x2b7a('0x6b'),{'recordId':_0x430132['id']});break;case _0x2b7a('0x6c'):emit(util[_0x2b7a('0x36')]('user:%s',_0x50e69a[_0x2b7a('0x45')]),_0x2b7a('0x5c'),{'uri':util[_0x2b7a('0x36')](_0x2b7a('0x5d'),_0xa1edfa[_0x2b7a('0x6d')],_0x430132['id'])});break;default:logger[_0x2b7a('0x60')](_0x2b7a('0x65'),_0x2b7a('0x6e'));}})[_0x2b7a('0x5f')](function(_0x10ad84){logger[_0x2b7a('0x60')](_0x2b7a('0x65'),JSON[_0x2b7a('0x61')](_0x10ad84));});};exports[_0x2b7a('0x6f')]=function(_0xf37b9,_0xfeca1,_0x2ea7d3,_0xe29727,_0x1f04ad,_0x5b745a){var _0x39b36f,_0x1e0328,_0x15eca3,_0x23a553;_0x5b745a[_0x2b7a('0x50')]=intUtil[_0x2b7a('0x51')](_0x5b745a[_0x2b7a('0x50')]);_0x5b745a[_0x2b7a('0x4a')]=intUtil[_0x2b7a('0x51')](_0x5b745a[_0x2b7a('0x4a')]);if(_0x1f04ad&&_0x1f04ad[_0x2b7a('0x52')]){logger[_0x2b7a('0x1b')]('['+_0xfeca1[_0x2b7a('0x70')]['toUpperCase']()+']',_0x2b7a('0x54'));_0xfeca1['recordingURL']=util['format'](_0x2b7a('0x56'),_0x5b745a['serverUrl'],_0xfeca1[_0x2b7a('0x57')],md5(_0xfeca1['uniqueid']));}else{_0xfeca1[_0x2b7a('0x55')]='';}return getConnection(_0x5b745a)[_0x2b7a('0x29')](function(_0x1c23e5){_0x23a553=_0x1c23e5;if(!_['isNil'](_0xe29727)){return getUser(_0x5b745a,_0xe29727[_0x2b7a('0x45')],_0x23a553);}else{return getUser(_0x5b745a,null,_0x23a553);}})[_0x2b7a('0x29')](function(_0x40d63b){_0x39b36f=_0x40d63b;return getEndUser(_0x5b745a,_0x2ea7d3,_0xfeca1[_0x2b7a('0x58')],_0xfeca1[_0x2b7a('0x59')],_0x23a553);})[_0x2b7a('0x29')](function(_0x2f3e0d){_0x1e0328=_0x2f3e0d;return getTicket(_0x5b745a,_0x39b36f,_0x1e0328,_0x2ea7d3,_0xfeca1,_0x2ea7d3['Fields'],_0x23a553);})[_0x2b7a('0x29')](function(_0x226fce){_0x15eca3=_0x226fce;logger[_0x2b7a('0x1b')]('['+_0xfeca1[_0x2b7a('0x70')][_0x2b7a('0x71')]()+_0x2b7a('0x72'),_0x15eca3['id']);logger[_0x2b7a('0x1b')]('['+_0xfeca1[_0x2b7a('0x70')][_0x2b7a('0x71')]()+_0x2b7a('0x73'),_0x5b745a['type']);})['catch'](function(_0x353e40){logger['error']('['+_0xfeca1[_0x2b7a('0x70')]['toUpperCase']()+']',JSON[_0x2b7a('0x61')](_0x353e40));});}; \ No newline at end of file +var _0x65c5=['trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','error','catch','stringify','outbound','recordingFormat','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','calleridnum','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','ioredis','./util','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','WhoId','Case','endUserType','contact','ContactId','lead','leadId','info','isNil','User','find','execute','then','Email','Agent\x20%s\x20found.','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','length','sobject','Lead','Phone','Name','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','upperFirst','create','forEach','string','type','idField','content','toString','variable','variableName','customVariable','Variable','name','concat','securityToken','remoteUri','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s'];(function(_0x34594e,_0x381c98){var _0x1a7f8b=function(_0x514e72){while(--_0x514e72){_0x34594e['push'](_0x34594e['shift']());}};_0x1a7f8b(++_0x381c98);}(_0x65c5,0x8a));var _0x565c=function(_0xc06a29,_0x3ea273){_0xc06a29=_0xc06a29-0x0;var _0x528394=_0x65c5[_0xc06a29];return _0x528394;};'use strict';var _=require(_0x565c('0x0'));var rp=require(_0x565c('0x1'));var moment=require(_0x565c('0x2'));var BPromise=require(_0x565c('0x3'));var md5=require('md5');var jsforce=require('jsforce');var util=require('util');var Redis=require(_0x565c('0x4'));var intUtil=require(_0x565c('0x5'));var config=require('../../../../config/environment');var logger=require(_0x565c('0x6'))(_0x565c('0x7'));config[_0x565c('0x8')]=_[_0x565c('0x9')](config['redis'],{'host':_0x565c('0xa'),'port':0x18eb});var io=require(_0x565c('0xb'))(new Redis(config[_0x565c('0x8')]));function emit(_0xa9b5d0,_0x4e7a69,_0x21a1aa){io['to'](_0xa9b5d0)[_0x565c('0xc')](_0x4e7a69,_0x21a1aa);}function getTicket(_0x29d40f,_0x3a4d3a,_0x246bba,_0x53873c,_0x1a4b1b,_0x2f9cf7,_0x3a9a61,_0x3a0098){var _0x18d306=Object[_0x565c('0xd')]({},{'OwnerId':_0x3a4d3a['id'],'Subject':intUtil['getString'](_0x53873c[_0x565c('0xe')],_0x1a4b1b,'\x20'),'Description':intUtil['getString'](_0x53873c[_0x565c('0xf')],_0x1a4b1b,'\x0a')},getCustomFields(_0x2f9cf7,_0x1a4b1b));if(_0x246bba){if(_0x53873c[_0x565c('0x10')]===_0x565c('0x11')){_0x18d306[_0x565c('0x12')]=moment[_0x565c('0x13')]();_0x18d306[_0x565c('0x14')]=![];_0x18d306['IsRecurrence']=![];_0x18d306[_0x565c('0x15')]=_0x246bba['id'];}else if(_0x53873c[_0x565c('0x10')]===_0x565c('0x16')){if(_0x246bba[_0x565c('0x17')]===_0x565c('0x18')){_0x18d306[_0x565c('0x19')]=_0x246bba['id'];}else if(_0x246bba['endUserType']===_0x565c('0x1a')&&_0x53873c[_0x565c('0x1b')]){_0x18d306[_0x53873c['leadId']]=_0x246bba['id'];}else{logger[_0x565c('0x1c')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x3a9a61['sobject'](_0x53873c['ticketType'])['create'](_0x18d306);}function getUser(_0x48d48b,_0x2a482b,_0x1ecdba){if(!_[_0x565c('0x1d')](_0x2a482b)&&intUtil['validateEmail'](_0x2a482b)){var _0x3f238d={'Email':_0x2a482b};var _0x111871={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1ecdba['sobject'](_0x565c('0x1e'))[_0x565c('0x1f')](_0x3f238d,_0x111871)[_0x565c('0x20')]()[_0x565c('0x21')](function(_0x3b4576){if(_0x3b4576['length']){var _0x1bc17b=_[_0x565c('0x1f')](_0x3b4576,function(_0x4d4dad){return _0x4d4dad[_0x565c('0x22')]===_0x2a482b;});if(_0x1bc17b){logger[_0x565c('0x1c')](_0x565c('0x23'),_0x2a482b);return BPromise['resolve']({'id':_0x1bc17b['Id'],'name':_0x1bc17b['Name']});}}else{logger[_0x565c('0x1c')](_0x565c('0x24'),_0x2a482b);return _0x1ecdba['identity']()['then'](function(_0x25c44e){return BPromise[_0x565c('0x25')]({'id':_0x25c44e[_0x565c('0x26')],'name':_0x25c44e[_0x565c('0x27')]});});}});}else{logger[_0x565c('0x1c')](_0x565c('0x24'),_0x2a482b);return _0x1ecdba[_0x565c('0x28')]()['then'](function(_0x2217ac){return BPromise[_0x565c('0x25')]({'id':_0x2217ac[_0x565c('0x26')],'name':_0x2217ac['display_name']});});}}function getEndUser(_0x18cdb6,_0x1f50ce,_0x34655f,_0x27b4f4,_0x5ebedc){var _0x31ca51={'Phone':_0x27b4f4};var _0x3f8b03={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x565c('0x25')]()[_0x565c('0x21')](function(){logger[_0x565c('0x1c')](_0x565c('0x29'),_0x27b4f4,_0x1f50ce['moduleSearch']);switch(_0x1f50ce[_0x565c('0x2a')]){case _0x565c('0x2b'):return _0x5ebedc['sobject'](_0x565c('0x2c'))[_0x565c('0x1f')](_0x31ca51,_0x3f8b03)['execute']()[_0x565c('0x21')](function(_0x5c8fa2){if(_0x5c8fa2&&_0x5c8fa2[_0x565c('0x2d')]){return _0x5c8fa2;}else{return _0x5ebedc[_0x565c('0x2e')]('Lead')[_0x565c('0x1f')](_0x31ca51,_0x3f8b03);}});case _0x565c('0x18'):return _0x5ebedc[_0x565c('0x2e')]('Contact')['find'](_0x31ca51,_0x3f8b03)[_0x565c('0x20')]();case _0x565c('0x1a'):return _0x5ebedc[_0x565c('0x2e')](_0x565c('0x2f'))[_0x565c('0x1f')](_0x31ca51,_0x3f8b03);default:return null;}})[_0x565c('0x21')](function(_0x4d6538){if(_0x4d6538&&_0x4d6538['length']){var _0x11d3e1=_[_0x565c('0x1f')](_0x4d6538,function(_0x3dea72){return _0x3dea72[_0x565c('0x30')]===_0x27b4f4;});if(_0x11d3e1){return BPromise[_0x565c('0x25')]({'id':_0x11d3e1['Id'],'name':_0x11d3e1[_0x565c('0x31')],'phone':_0x11d3e1[_0x565c('0x30')],'endUserType':_0x11d3e1[_0x565c('0x32')]['type'][_0x565c('0x33')]()});}}})[_0x565c('0x21')](function(_0x26601a){if(_0x26601a){logger[_0x565c('0x1c')](_0x565c('0x34'),_0x26601a[_0x565c('0x17')],_0x27b4f4);return BPromise[_0x565c('0x25')](_0x26601a);}else{logger[_0x565c('0x1c')](_0x565c('0x35'),_0x27b4f4);var _0xa18683={'LastName':_0x34655f!==_0x565c('0x36')?_0x34655f:util[_0x565c('0x37')](_0x565c('0x38'),_0x27b4f4),'Phone':_0x27b4f4};if(_0x1f50ce[_0x565c('0x39')]){if(_0x1f50ce['moduleCreate']===_0x565c('0x18')){logger[_0x565c('0x1c')](_0x565c('0x3a'),_0x27b4f4,_0x1f50ce['moduleCreate']);}else if(_0x1f50ce[_0x565c('0x39')]===_0x565c('0x1a')){logger[_0x565c('0x1c')](_0x565c('0x3a'),_0x27b4f4,_0x1f50ce[_0x565c('0x39')]);_0xa18683[_0x565c('0x3b')]='No\x20Company';}else{return null;}}return _0x5ebedc[_0x565c('0x2e')](_[_0x565c('0x3c')](_0x1f50ce[_0x565c('0x39')]))[_0x565c('0x3d')](_0xa18683)[_0x565c('0x21')](function(_0x3e3f04){return BPromise[_0x565c('0x25')]({'id':_0x3e3f04['id'],'endUserType':_0x1f50ce[_0x565c('0x39')]});});}});}function getCustomFields(_0x2ada1e,_0x1147aa){var _0x4b8993={};if(_0x2ada1e[_0x565c('0x2d')]>0x0){_[_0x565c('0x3e')](_0x2ada1e,function(_0x5a56a8){if(_['includes']([_0x565c('0x3f'),'picklist'],_0x5a56a8[_0x565c('0x40')])&&_0x5a56a8[_0x565c('0x41')]){_0x4b8993[_0x5a56a8[_0x565c('0x41')]]=_0x5a56a8[_0x565c('0x42')][_0x565c('0x43')]();}else if(_0x5a56a8['type']===_0x565c('0x44')&&_0x5a56a8[_0x565c('0x45')]&&_0x5a56a8[_0x565c('0x41')]){_0x1147aa[_0x5a56a8[_0x565c('0x45')]]&&(_0x4b8993[_0x5a56a8[_0x565c('0x41')]]=_0x1147aa[_0x5a56a8[_0x565c('0x45')]]['toString']());}else if(_0x5a56a8[_0x565c('0x40')]===_0x565c('0x46')&&_0x5a56a8[_0x565c('0x47')]&&_0x5a56a8['Variable'][_0x565c('0x48')]&&_0x5a56a8[_0x565c('0x41')]){_0x1147aa[_0x5a56a8['Variable']['name'][_0x565c('0x33')]()]&&(_0x4b8993[_0x5a56a8[_0x565c('0x41')]]=_0x1147aa[_0x5a56a8[_0x565c('0x47')][_0x565c('0x48')][_0x565c('0x33')]()][_0x565c('0x43')]());}});}return _0x4b8993;}function getConnection(_0x50ff96){var _0x2c9150=_0x50ff96['password'][_0x565c('0x49')](_0x50ff96[_0x565c('0x4a')]);var _0x1b024e=new jsforce['Connection']({'oauth2':{'loginUrl':_0x50ff96[_0x565c('0x4b')]||'https://login.salesforce.com','clientId':_0x50ff96['clientId'],'clientSecret':_0x50ff96[_0x565c('0x4c')]}});return _0x1b024e[_0x565c('0x4d')](_0x50ff96[_0x565c('0x4e')],_0x2c9150)[_0x565c('0x21')](function(){logger[_0x565c('0x1c')](_0x565c('0x4f'));return _0x1b024e;});}exports[_0x565c('0x50')]=function(_0x16412c,_0x1c21c8,_0x20c830,_0x34b9df,_0x13ba59,_0x1d37b9){var _0x429dfb,_0x3bf8d1,_0xc2aa94,_0x5e2192;_0x1d37b9[_0x565c('0x51')]=intUtil[_0x565c('0x52')](_0x1d37b9[_0x565c('0x51')]);_0x1d37b9['remoteUri']=intUtil[_0x565c('0x52')](_0x1d37b9[_0x565c('0x4b')]);if(_0x13ba59&&_0x13ba59[_0x565c('0x53')]){logger[_0x565c('0x1c')]('[QUEUE]',_0x565c('0x54'));_0x1c21c8[_0x565c('0x55')]=util[_0x565c('0x37')](_0x565c('0x56'),_0x1d37b9[_0x565c('0x51')],_0x1c21c8[_0x565c('0x57')],md5(_0x1c21c8[_0x565c('0x57')]));}else{_0x1c21c8[_0x565c('0x55')]='';}return getConnection(_0x1d37b9)[_0x565c('0x21')](function(_0x1f1db3){_0x5e2192=_0x1f1db3;return getUser(_0x1d37b9,_0x34b9df['email'],_0x5e2192);})[_0x565c('0x21')](function(_0x1852e9){_0x429dfb=_0x1852e9;return getEndUser(_0x1d37b9,_0x20c830,_0x1c21c8[_0x565c('0x58')],_0x1c21c8['calleridnum'],_0x5e2192);})[_0x565c('0x21')](function(_0x14ad87){_0x3bf8d1=_0x14ad87;return getTicket(_0x1d37b9,_0x429dfb,_0x3bf8d1,_0x20c830,_0x1c21c8,_0x20c830[_0x565c('0x59')],_0x5e2192,'queue');})[_0x565c('0x21')](function(_0x35624c){_0xc2aa94=_0x35624c;logger['info'](_0x565c('0x5a'),_0xc2aa94['id']);logger[_0x565c('0x1c')](_0x565c('0x5b'),_0xc2aa94['id'],_0x34b9df[_0x565c('0x48')],_0x1d37b9['type']);switch(_0x1d37b9[_0x565c('0x40')]){case _0x565c('0x5c'):emit(util['format'](_0x565c('0x5d'),_0x34b9df['name']),_0x565c('0x5e'),{'recordId':_0xc2aa94['id']});break;case _0x565c('0x5f'):emit(util[_0x565c('0x37')](_0x565c('0x5d'),_0x34b9df[_0x565c('0x48')]),_0x565c('0x60'),{'uri':util[_0x565c('0x37')](_0x565c('0x61'),_0x5e2192['instanceUrl'],_0xc2aa94['id'])});break;default:logger[_0x565c('0x62')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x565c('0x63')](function(_0x30e6c7){logger['error']('[QUEUE]',JSON[_0x565c('0x64')](_0x30e6c7));});};exports[_0x565c('0x65')]=function(_0x562b19,_0x3fcbdb,_0x1cea70,_0xc5df70,_0x3d7899,_0x695c82,_0x1546e8){var _0xc94e1f,_0x5bc1e0,_0x1708ac,_0x57982e;_0x695c82[_0x565c('0x51')]=intUtil[_0x565c('0x52')](_0x695c82[_0x565c('0x51')]);_0x695c82[_0x565c('0x4b')]=intUtil[_0x565c('0x52')](_0x695c82[_0x565c('0x4b')]);if(_0x1546e8&&_0x1546e8[_0x565c('0x66')]&&_0x1546e8[_0x565c('0x66')]!=='none'){logger[_0x565c('0x1c')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x3fcbdb['recordingURL']=util[_0x565c('0x37')](_0x565c('0x56'),_0x695c82['serverUrl'],_0x3fcbdb[_0x565c('0x57')],md5(_0x3fcbdb['uniqueid']));}return getConnection(_0x695c82)[_0x565c('0x21')](function(_0x21e6e5){_0x57982e=_0x21e6e5;return getUser(_0x695c82,_0xc5df70[_0x565c('0x67')],_0x57982e);})['then'](function(_0x159d9f){_0xc94e1f=_0x159d9f;return getEndUser(_0x695c82,_0x1cea70,_0x3fcbdb[_0x565c('0x68')],_0x3fcbdb[_0x565c('0x69')],_0x57982e);})[_0x565c('0x21')](function(_0x3d7b3a){_0x5bc1e0=_0x3d7b3a;return getTicket(_0x695c82,_0xc94e1f,_0x5bc1e0,_0x1cea70,_0x3fcbdb,_0x1cea70[_0x565c('0x59')],_0x57982e,_0x565c('0x65'));})['then'](function(_0x4f3102){_0x1708ac=_0x4f3102;logger[_0x565c('0x1c')](_0x565c('0x6a'),_0x1708ac['id']);logger[_0x565c('0x1c')](_0x565c('0x6b'),_0x1708ac['id'],_0xc5df70[_0x565c('0x48')],_0x695c82['type']);switch(_0x695c82['type']){case _0x565c('0x5c'):emit(util[_0x565c('0x37')]('user:%s',_0xc5df70[_0x565c('0x48')]),_0x565c('0x5e'),{'recordId':_0x1708ac['id']});break;case _0x565c('0x5f'):emit(util[_0x565c('0x37')](_0x565c('0x5d'),_0xc5df70['name']),'trigger:browser:url',{'uri':util[_0x565c('0x37')](_0x565c('0x61'),_0x57982e['instanceUrl'],_0x1708ac['id'])});break;default:logger[_0x565c('0x62')](_0x565c('0x6c'),_0x565c('0x6d'));}})[_0x565c('0x63')](function(_0x2cedfd){logger[_0x565c('0x62')](_0x565c('0x6c'),JSON['stringify'](_0x2cedfd));});};exports[_0x565c('0x6e')]=function(_0x455054,_0x521508,_0xa2e0d,_0x32e7d1,_0x5a9e6f,_0x2c8229){var _0x1fd90a,_0x19e00e,_0x31fcb2,_0x7ae906;_0x2c8229[_0x565c('0x51')]=intUtil[_0x565c('0x52')](_0x2c8229[_0x565c('0x51')]);_0x2c8229[_0x565c('0x4b')]=intUtil[_0x565c('0x52')](_0x2c8229['remoteUri']);if(_0x5a9e6f&&_0x5a9e6f['monitor_format']){logger['info']('['+_0x521508[_0x565c('0x6f')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x521508[_0x565c('0x55')]=util[_0x565c('0x37')](_0x565c('0x56'),_0x2c8229[_0x565c('0x51')],_0x521508[_0x565c('0x57')],md5(_0x521508['uniqueid']));}else{_0x521508[_0x565c('0x55')]='';}return getConnection(_0x2c8229)[_0x565c('0x21')](function(_0x2f02c9){_0x7ae906=_0x2f02c9;if(!_['isNil'](_0x32e7d1)){return getUser(_0x2c8229,_0x32e7d1[_0x565c('0x48')],_0x7ae906);}else{return getUser(_0x2c8229,null,_0x7ae906);}})[_0x565c('0x21')](function(_0x1e114d){_0x1fd90a=_0x1e114d;return getEndUser(_0x2c8229,_0xa2e0d,_0x521508['calleridname'],_0x521508[_0x565c('0x70')],_0x7ae906);})['then'](function(_0x2762bd){_0x19e00e=_0x2762bd;return getTicket(_0x2c8229,_0x1fd90a,_0x19e00e,_0xa2e0d,_0x521508,_0xa2e0d['Fields'],_0x7ae906);})['then'](function(_0x1eb205){_0x31fcb2=_0x1eb205;logger[_0x565c('0x1c')]('['+_0x521508[_0x565c('0x6f')][_0x565c('0x71')]()+_0x565c('0x72'),_0x31fcb2['id']);logger[_0x565c('0x1c')]('['+_0x521508[_0x565c('0x6f')][_0x565c('0x71')]()+_0x565c('0x73'),_0x2c8229['type']);})['catch'](function(_0x179c33){logger['error']('['+_0x521508['lastevent']['toUpperCase']()+']',JSON[_0x565c('0x64')](_0x179c33));});}; \ 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 5ee53b9..a635bd2 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 _0x5fdc=['picklist','type','nameField','customField','toString','idField','content','variable','toLowerCase','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','username','password','sysparm_display_value=true','stripTrailingSlash','serverUrl','%s/api/now/table/','remoteUri','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','true','userId','sys_id','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x5fdc,0x127));var _0xc5fd=function(_0x3c7aa7,_0x257006){_0x3c7aa7=_0x3c7aa7-0x0;var _0x15eb52=_0x5fdc[_0x3c7aa7];return _0x15eb52;};'use strict';var _=require(_0xc5fd('0x0'));var Promise=require(_0xc5fd('0x1'));var rp=require(_0xc5fd('0x2'));var util=require(_0xc5fd('0x3'));var md5=require(_0xc5fd('0x4'));var Redis=require(_0xc5fd('0x5'));var intUtil=require(_0xc5fd('0x6'));var config=require(_0xc5fd('0x7'));var logger=require(_0xc5fd('0x8'))(_0xc5fd('0x9'));config[_0xc5fd('0xa')]=_[_0xc5fd('0xb')](config[_0xc5fd('0xa')],{'host':_0xc5fd('0xc'),'port':0x18eb});var io=require(_0xc5fd('0xd'))(new Redis(config['redis']));function getAdminUser(_0x5d86e5,_0x493389,_0x224801,_0x46bce3,_0x158e58,_0x45c91f){return new Promise(function(_0x4e6d35,_0x4e1e94){var _0x3442dd={'method':_0xc5fd('0xe'),'uri':_0x46bce3+_0xc5fd('0xf')+'&'+_0x158e58+'&'+_0x45c91f,'auth':_0x493389,'json':!![]};return rp(_0x3442dd)[_0xc5fd('0x10')](function(_0x468f58){if(_0x468f58[_0xc5fd('0x11')]['length']>0x0){_0x224801[_0xc5fd('0x12')]=_0x468f58['result'][0x0]['sys_id'];}logger[_0xc5fd('0x13')]('['+[_0x5d86e5[_0xc5fd('0x14')]()]+_0xc5fd('0x15'),_0x224801);_0x4e6d35(_0x224801);})[_0xc5fd('0x16')](function(_0x2e77a8){logger[_0xc5fd('0x17')]('['+[_0x5d86e5[_0xc5fd('0x14')]()]+']',_0x2e77a8[_0xc5fd('0x18')]);_0x4e1e94(_0x2e77a8['message']);});});}function getUser(_0x124651,_0x103c3d,_0x2221da,_0x3404e0,_0x4d3636){return function(_0x4fd364){logger['info']('['+[_0x124651['toUpperCase']()]+'],\x20getUser\x20input\x20crm',_0x4fd364);return new Promise(function(_0x35a9d0,_0x430e52){if(intUtil[_0xc5fd('0x19')](_0x4fd364[_0xc5fd('0x1a')])){var _0x2ee392={'method':_0xc5fd('0xe'),'uri':_0x2221da+_0xc5fd('0x1b')+_0x4fd364['userEmail']+'&'+_0x3404e0+'&'+_0x4d3636,'auth':_0x103c3d,'json':!![]};logger[_0xc5fd('0x13')]('['+[_0x124651[_0xc5fd('0x14')]()]+_0xc5fd('0x1c'),_0x2ee392);return rp(_0x2ee392)[_0xc5fd('0x10')](function(_0x3b3093){logger['info']('['+[_0x124651[_0xc5fd('0x14')]()]+_0xc5fd('0x1d'),_0x3b3093);if(_0x3b3093[_0xc5fd('0x11')][_0xc5fd('0x1e')]>0x0&&String(_0x3b3093['result'][0x0]['active'])===_0xc5fd('0x1f')){_0x4fd364[_0xc5fd('0x20')]=_0x3b3093[_0xc5fd('0x11')][0x0][_0xc5fd('0x21')];}else{_0x4fd364[_0xc5fd('0x20')]=_0x4fd364[_0xc5fd('0x12')];_0x4fd364['userEmail']=_0x4fd364[_0xc5fd('0x22')];}logger[_0xc5fd('0x13')]('['+[_0x124651[_0xc5fd('0x14')]()]+_0xc5fd('0x23'),_0x4fd364);_0x35a9d0(_0x4fd364);})[_0xc5fd('0x16')](function(_0x4020af){logger[_0xc5fd('0x17')]('['+[_0x124651['toUpperCase']()]+']',_0x4020af[_0xc5fd('0x18')]);_0x430e52(_0x4020af['message']);});}else{logger[_0xc5fd('0x13')]('['+[_0x124651[_0xc5fd('0x14')]()]+_0xc5fd('0x24'));_0x4fd364[_0xc5fd('0x20')]=_0x4fd364['adminId'];_0x4fd364[_0xc5fd('0x1a')]=_0x4fd364[_0xc5fd('0x22')];_0x35a9d0(_0x4fd364);}});};}function createEndUser(_0x19c4a0,_0x42cbf0,_0x19df33,_0x209975,_0x541c12){logger[_0xc5fd('0x13')]('['+[_0x19c4a0['toUpperCase']()]+'],\x20createEndUser\x20input\x20crm',_0x19df33);return new Promise(function(_0x12a962,_0x165ee2){var _0x39b21a={'method':_0xc5fd('0x25'),'uri':_0x209975+_0xc5fd('0x26')+_0x541c12,'body':{'user_name':_0x19df33[_0xc5fd('0x27')],'roles':_0xc5fd('0x28'),'first_name':_0x19df33[_0xc5fd('0x27')],'active':'true','date_format':_0xc5fd('0x29'),'phone':_0x19df33[_0xc5fd('0x27')]},'auth':_0x42cbf0,'json':!![]};return rp(_0x39b21a)[_0xc5fd('0x10')](function(_0x3b9699){logger[_0xc5fd('0x13')]('['+[_0x19c4a0[_0xc5fd('0x14')]()]+_0xc5fd('0x2a'),_0x3b9699[_0xc5fd('0x11')]);_0x19df33[_0xc5fd('0x2b')]=_0x3b9699[_0xc5fd('0x11')][_0xc5fd('0x21')];_0x12a962(_0x19df33);})[_0xc5fd('0x16')](function(_0x4937a8){logger[_0xc5fd('0x17')]('['+[_0x19c4a0[_0xc5fd('0x14')]()]+']',_0x4937a8[_0xc5fd('0x18')]);_0x165ee2(_0x4937a8[_0xc5fd('0x18')]);});});}function getEndUser(_0x308ba4,_0x3a003b,_0x3fefbe,_0xb719be,_0x358883){return function(_0x545bfc){logger[_0xc5fd('0x13')]('['+[_0x308ba4[_0xc5fd('0x14')]()]+_0xc5fd('0x2c'),_0x545bfc);return new Promise(function(_0xc2c90b,_0x5fe679){var _0x52267e={'method':_0xc5fd('0xe'),'uri':_0x3fefbe+'sys_user?sysparm_query=phone%3D'+_0x545bfc[_0xc5fd('0x27')]+'&'+_0xb719be+'&'+_0x358883,'auth':_0x3a003b,'json':!![]};return rp(_0x52267e)[_0xc5fd('0x10')](function(_0x57f3fc){if(_0x57f3fc[_0xc5fd('0x11')]['length']>0x0){_0x545bfc[_0xc5fd('0x2b')]=_0x57f3fc[_0xc5fd('0x11')][0x0][_0xc5fd('0x21')];logger['info']('['+[_0x308ba4[_0xc5fd('0x14')]()]+_0xc5fd('0x2d'),_0x545bfc);_0xc2c90b(_0x545bfc);}else{return createEndUser(_0x308ba4,_0x3a003b,_0x545bfc,_0x3fefbe,_0xb719be)['then'](function(_0x2e20e0){logger[_0xc5fd('0x13')]('['+[_0x308ba4[_0xc5fd('0x14')]()]+_0xc5fd('0x2e'),_0x2e20e0);_0xc2c90b(_0x2e20e0);});}})[_0xc5fd('0x16')](function(_0x33f669){logger['error']('['+[_0x308ba4[_0xc5fd('0x14')]()]+']',_0x33f669[_0xc5fd('0x18')]);_0x5fe679(_0x33f669[_0xc5fd('0x18')]);});});};}function getCustomFields(_0x2a368e,_0x5d3fce){var _0x559ec4={};if(_0x2a368e['length']>0x0){_[_0xc5fd('0x2f')](_0x2a368e,function(_0x336f2a){if(_[_0xc5fd('0x30')]([_0xc5fd('0x31'),_0xc5fd('0x32')],_0x336f2a[_0xc5fd('0x33')])&&_0x336f2a[_0xc5fd('0x34')]&&!_0x336f2a[_0xc5fd('0x35')]){_0x559ec4[_0x336f2a[_0xc5fd('0x34')]['toLowerCase']()]=_0x336f2a['content'][_0xc5fd('0x36')]();}else if(_['includes']([_0xc5fd('0x31'),_0xc5fd('0x32')],_0x336f2a[_0xc5fd('0x33')])&&_0x336f2a['idField']&&_0x336f2a[_0xc5fd('0x35')]){_0x559ec4[_0x336f2a[_0xc5fd('0x37')]['toLowerCase']()]=_0x336f2a[_0xc5fd('0x38')][_0xc5fd('0x36')]();}else if(_0x336f2a['type']===_0xc5fd('0x39')&&_0x336f2a['variableName']&&_0x336f2a[_0xc5fd('0x37')]&&_0x336f2a[_0xc5fd('0x35')]){_0x559ec4[_0x336f2a['idField'][_0xc5fd('0x3a')]()]=_0x5d3fce[_0x336f2a[_0xc5fd('0x3b')]][_0xc5fd('0x36')]();}else if(_0x336f2a['type']===_0xc5fd('0x3c')&&_0x336f2a[_0xc5fd('0x3d')]&&_0x336f2a['Variable']['name']&&_0x336f2a[_0xc5fd('0x37')]&&_0x336f2a['customField']){_0x559ec4[_0x336f2a['idField']['toLowerCase']()]=_0x5d3fce[_0x336f2a[_0xc5fd('0x3d')][_0xc5fd('0x3e')][_0xc5fd('0x3a')]()][_0xc5fd('0x36')]();}});}return _0x559ec4;}function getTicket(_0x453b02,_0x39eca0,_0x480011,_0x4fde42,_0x4ce654,_0x1d550c){return function(_0x23f4b5){logger[_0xc5fd('0x13')]('['+[_0x453b02['toUpperCase']()]+_0xc5fd('0x3f'),_0x23f4b5);return new Promise(function(_0x51641b,_0x884680){var _0x1c1541=_0x453b02[_0xc5fd('0x3a')]()===_0xc5fd('0x40')?_0x23f4b5[_0xc5fd('0x20')]:_0x23f4b5[_0xc5fd('0x2b')];var _0x54d86c={'method':_0xc5fd('0x25'),'uri':_0x480011+_0xc5fd('0x41')+'?'+_0x1d550c,'body':Object['assign']({},{'active':'true','caller_id':_0x1c1541,'assigned_to':_0x23f4b5[_0xc5fd('0x20')],'short_description':intUtil['getString'](_0x4fde42['Subjects'],_0x4ce654,'\x20'),'description':intUtil[_0xc5fd('0x42')](_0x4fde42[_0xc5fd('0x43')],_0x4ce654,'\x0a')},getCustomFields(_0x4fde42['Fields'],_0x4ce654)),'auth':_0x39eca0,'json':!![]};return rp(_0x54d86c)[_0xc5fd('0x10')](function(_0x53fd29){logger['info']('['+[_0x453b02[_0xc5fd('0x14')]()]+_0xc5fd('0x44'),_0x53fd29[_0xc5fd('0x11')]);_0x23f4b5[_0xc5fd('0x45')]=_0x53fd29[_0xc5fd('0x11')][_0xc5fd('0x21')];_0x23f4b5[_0xc5fd('0x46')]=_0x53fd29[_0xc5fd('0x11')][_0xc5fd('0x47')];logger[_0xc5fd('0x13')]('['+[_0x453b02[_0xc5fd('0x14')]()]+']\x20getTicket\x20crm',_0x23f4b5);_0x51641b(_0x23f4b5);})[_0xc5fd('0x16')](function(_0x101b8f){logger[_0xc5fd('0x17')]('['+[_0x453b02['toUpperCase']()]+']',_0x101b8f[_0xc5fd('0x18')]);_0x884680(_0x101b8f[_0xc5fd('0x18')]);});});};}function createRemoteTag(_0x1a30d5,_0x2ee934,_0x5c7d68,_0xcbd63b){return new Promise(function(_0x5b5ecd,_0x520993){var _0x1ce72c={'method':_0xc5fd('0x25'),'uri':_0x5c7d68+_0xc5fd('0x48')+'?'+_0xcbd63b,'body':{'short_description':_0x1a30d5,'global':!![],'active':!![],'name':_0x1a30d5},'auth':_0x2ee934,'json':!![]};return rp(_0x1ce72c)[_0xc5fd('0x10')](function(_0x275e18){var _0x47cff9=_0x275e18['result'][_0xc5fd('0x21')];_0x5b5ecd(_0x47cff9);});});}function getRemoteTag(_0x7e176e,_0x49194c,_0x4e9495,_0x50e0c7,_0x437c8e){return new Promise(function(_0x5dc7c8,_0x168c53){var _0x476fea={'method':_0xc5fd('0xe'),'uri':_0x4e9495+_0xc5fd('0x48')+_0xc5fd('0x49')+_0x7e176e+'&'+_0x50e0c7,'auth':_0x49194c,'json':!![]};return rp(_0x476fea)[_0xc5fd('0x10')](function(_0x1a8190){if(_0x1a8190['result'][_0xc5fd('0x1e')]>0x0){var _0x390bac=_0x1a8190[_0xc5fd('0x11')][0x0]['sys_id'];_0x5dc7c8(_0x390bac);}else{return createRemoteTag(_0x7e176e,_0x49194c,_0x4e9495,_0x50e0c7)['then'](function(_0x1da8b2){_0x5dc7c8(_0x1da8b2);});}});});}function assignTagToIncident(_0x160469,_0x2f30d6,_0x149483,_0x69367,_0x45f9fd){return new Promise(function(_0x469316,_0x435c61){var _0x2ea29a={'method':_0xc5fd('0x25'),'uri':_0x149483+_0xc5fd('0x4a')+'?'+_0x45f9fd,'body':{'label':_0x160469,'table':_0xc5fd('0x41'),'id_type':_0xc5fd('0x4b'),'table_key':_0x69367[_0xc5fd('0x45')],'title':_0xc5fd('0x4c')+_0x69367[_0xc5fd('0x46')],'id_display':_0x69367['ticketNumber']},'auth':_0x2f30d6,'json':!![]};return rp(_0x2ea29a)[_0xc5fd('0x10')](function(_0xc05f80){_0x469316();})[_0xc5fd('0x16')](function(){_0x469316();});});}function manageTags(_0x53a3ee,_0x32a240,_0x2c1252,_0x277616,_0x3d9bde,_0x522985,_0x1733e7){return new Promise(function(_0xfe9144,_0x5dfd9c){var _0x27a1f5=[];_0x32a240['forEach'](function(_0x2849c3){_0x27a1f5[_0xc5fd('0x4d')](getRemoteTag(_0x2849c3,_0x2c1252,_0x277616,_0x522985,_0x1733e7));});return Promise[_0xc5fd('0x4e')](_0x27a1f5)[_0xc5fd('0x10')](function(_0x3bfa8d){if(_0x3bfa8d[_0xc5fd('0x1e')]){logger['info']('['+[_0x53a3ee['toUpperCase']()]+_0xc5fd('0x4f'),_0x3bfa8d);var _0x1ff40b=[];_0x3bfa8d[_0xc5fd('0x2f')](function(_0xfacbc9){_0x1ff40b[_0xc5fd('0x4d')](assignTagToIncident(_0xfacbc9,_0x2c1252,_0x277616,_0x3d9bde,_0x522985));});return Promise[_0xc5fd('0x4e')](_0x1ff40b)[_0xc5fd('0x10')](function(){_0xfe9144();})[_0xc5fd('0x16')](function(){_0xfe9144();});}else{_0xfe9144();}});});}function getTags(_0x4d6f97,_0x34a414,_0x1dab2e,_0x5b337a,_0x5353f0,_0xb31758){return function(_0x2c4c0e){return new Promise(function(_0xf4bb91,_0x545de8){var _0x302a73=[];var _0x310a7b=_0x5b337a[_0xc5fd('0x50')];if(_0x310a7b&&_0x310a7b[_0xc5fd('0x1e')]>0x0){_0x302a73=_['map'](_0x310a7b,_0xc5fd('0x3e'));}if(_0x302a73[_0xc5fd('0x1e')]>0x0){return manageTags(_0x4d6f97,_0x302a73,_0x34a414,_0x1dab2e,_0x2c4c0e,_0x5353f0,_0xb31758)['then'](function(){_0xf4bb91(_0x2c4c0e);});}else{_0xf4bb91(_0x2c4c0e);}});};}function emit(_0x451015,_0x3e6cf3,_0x49473a){var _0x4591be=_0xc5fd('0x51')+_0xc5fd('0x52')+_0xc5fd('0x53')+_0xc5fd('0x54');var _0x31b753={'uri':_0x451015+_0xc5fd('0x55')+_0x49473a+_0x4591be};io['to'](util[_0xc5fd('0x56')](_0xc5fd('0x57'),_0x3e6cf3))[_0xc5fd('0x58')]('trigger:browser:url',_0x31b753);}exports['cs']=function(_0x5131ba,_0x36ad3c,_0x10538c,_0x138ac4,_0x5a494b,_0xf7c5cb,_0x57193b,_0x2696be){var _0x4daefa={};var _0x282255={'user':_0xf7c5cb[_0xc5fd('0x59')],'pass':_0xf7c5cb[_0xc5fd('0x5a')]};var _0x480355='sysparm_limit=1';var _0x3cd0cb=_0xc5fd('0x5b');_0xf7c5cb['remoteUri']=intUtil[_0xc5fd('0x5c')](_0xf7c5cb['remoteUri']);_0xf7c5cb[_0xc5fd('0x5d')]=intUtil[_0xc5fd('0x5c')](_0xf7c5cb['serverUrl']);var _0x51242e=util[_0xc5fd('0x56')](_0xc5fd('0x5e'),_0xf7c5cb[_0xc5fd('0x5f')]);_0x4daefa[_0xc5fd('0x1a')]=!_[_0xc5fd('0x60')](_0x138ac4)?_0x138ac4[_0xc5fd('0x61')]:null;_0x4daefa['adminEmail']=_0xf7c5cb[_0xc5fd('0x61')];_0x4daefa[_0xc5fd('0x27')]=_0x2696be[_0xc5fd('0x3a')]()===_0xc5fd('0x40')?_0x36ad3c[_0xc5fd('0x62')]:_0x36ad3c[_0xc5fd('0x63')];_0x4daefa[_0xc5fd('0x64')]=_0x2696be===_0xc5fd('0x65')||_0x2696be===_0xc5fd('0x66')?'queue':_0xc5fd('0x40');var _0x58ca76=util[_0xc5fd('0x56')](_0xc5fd('0x67'),_0xf7c5cb[_0xc5fd('0x5d')],_0x36ad3c['uniqueid'],md5(_0x36ad3c[_0xc5fd('0x68')]));if(_0x5a494b&&_0x5a494b['monitor_format']){logger['info'](_0xc5fd('0x69'),_0xc5fd('0x6a'));_0x36ad3c[_0xc5fd('0x6b')]=_0x58ca76;}else if(_0x57193b&&_0x57193b[_0xc5fd('0x6c')]&&_0x57193b[_0xc5fd('0x6c')]!==_0xc5fd('0x6d')){logger['info'](_0xc5fd('0x6e'),_0xc5fd('0x6a'));_0x36ad3c[_0xc5fd('0x6b')]=_0x58ca76;}else{_0x36ad3c[_0xc5fd('0x6b')]='';}return getAdminUser(_0x2696be,_0x282255,_0x4daefa,_0x51242e,_0x3cd0cb,_0x480355)[_0xc5fd('0x10')](getUser(_0x2696be,_0x282255,_0x51242e,_0x3cd0cb,_0x480355))['then'](getEndUser(_0x2696be,_0x282255,_0x51242e,_0x3cd0cb,_0x480355))[_0xc5fd('0x10')](getTicket(_0x2696be,_0x282255,_0x51242e,_0x10538c,_0x36ad3c,_0x3cd0cb))[_0xc5fd('0x10')](function(_0x40ac22){logger[_0xc5fd('0x13')](util[_0xc5fd('0x56')](_0xc5fd('0x6f'),_0x40ac22[_0xc5fd('0x45')]));logger['info'](util[_0xc5fd('0x56')](_0xc5fd('0x70'),_0x2696be));if(_0x2696be!==_0xc5fd('0x66')){logger[_0xc5fd('0x13')]('['+[_0x2696be['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0xf7c5cb['remoteUri'],_0x138ac4[_0xc5fd('0x3e')],_0x40ac22[_0xc5fd('0x45')]);}})[_0xc5fd('0x16')](function(_0x5f2c45){logger[_0xc5fd('0x17')]('['+[_0x2696be[_0xc5fd('0x14')]()]+_0xc5fd('0x71'),util[_0xc5fd('0x72')](_0x5f2c45,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x955f=['Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','ticketId',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','./util','servicenow','defaults','redis','localhost','sys_user?sysparm_query=user_name%3Dadmin','result','length','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','userEmail','GET','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','active','true','userId','sys_id','adminId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','user','endUserNumber','System','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','incident','assign','Subjects'];(function(_0x4156e2,_0x416565){var _0x8bfdf2=function(_0x53508f){while(--_0x53508f){_0x4156e2['push'](_0x4156e2['shift']());}};_0x8bfdf2(++_0x416565);}(_0x955f,0x1eb));var _0xf955=function(_0x2d2853,_0x383709){_0x2d2853=_0x2d2853-0x0;var _0x4b7166=_0x955f[_0x2d2853];return _0x4b7166;};'use strict';var _=require(_0xf955('0x0'));var Promise=require(_0xf955('0x1'));var rp=require(_0xf955('0x2'));var util=require(_0xf955('0x3'));var md5=require(_0xf955('0x4'));var Redis=require('ioredis');var intUtil=require(_0xf955('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xf955('0x6'));config['redis']=_[_0xf955('0x7')](config[_0xf955('0x8')],{'host':_0xf955('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf955('0x8')]));function getAdminUser(_0x20c096,_0x4f58fb,_0x254b38,_0x151034,_0x168ffb,_0x38b190){return new Promise(function(_0x134c1b,_0x421e4a){var _0x186719={'method':'GET','uri':_0x151034+_0xf955('0xa')+'&'+_0x168ffb+'&'+_0x38b190,'auth':_0x4f58fb,'json':!![]};return rp(_0x186719)['then'](function(_0x2d59e9){if(_0x2d59e9[_0xf955('0xb')][_0xf955('0xc')]>0x0){_0x254b38['adminId']=_0x2d59e9[_0xf955('0xb')][0x0]['sys_id'];}logger[_0xf955('0xd')]('['+[_0x20c096['toUpperCase']()]+_0xf955('0xe'),_0x254b38);_0x134c1b(_0x254b38);})[_0xf955('0xf')](function(_0x22507a){logger[_0xf955('0x10')]('['+[_0x20c096[_0xf955('0x11')]()]+']',_0x22507a[_0xf955('0x12')]);_0x421e4a(_0x22507a[_0xf955('0x12')]);});});}function getUser(_0x2783f2,_0x3c6af7,_0x24e75c,_0x5350e4,_0xc29b35){return function(_0x54e60b){logger[_0xf955('0xd')]('['+[_0x2783f2[_0xf955('0x11')]()]+_0xf955('0x13'),_0x54e60b);return new Promise(function(_0x15c07c,_0x50930d){if(intUtil['validateEmail'](_0x54e60b[_0xf955('0x14')])){var _0xe6de5c={'method':_0xf955('0x15'),'uri':_0x24e75c+'sys_user?sysparm_query=email%3D'+_0x54e60b[_0xf955('0x14')]+'&'+_0x5350e4+'&'+_0xc29b35,'auth':_0x3c6af7,'json':!![]};logger[_0xf955('0xd')]('['+[_0x2783f2[_0xf955('0x11')]()]+_0xf955('0x16'),_0xe6de5c);return rp(_0xe6de5c)[_0xf955('0x17')](function(_0x5f4d9a){logger[_0xf955('0xd')]('['+[_0x2783f2[_0xf955('0x11')]()]+_0xf955('0x18'),_0x5f4d9a);if(_0x5f4d9a['result'][_0xf955('0xc')]>0x0&&String(_0x5f4d9a['result'][0x0][_0xf955('0x19')])===_0xf955('0x1a')){_0x54e60b[_0xf955('0x1b')]=_0x5f4d9a[_0xf955('0xb')][0x0][_0xf955('0x1c')];}else{_0x54e60b['userId']=_0x54e60b[_0xf955('0x1d')];_0x54e60b[_0xf955('0x14')]=_0x54e60b[_0xf955('0x1e')];}logger[_0xf955('0xd')]('['+[_0x2783f2[_0xf955('0x11')]()]+_0xf955('0x1f'),_0x54e60b);_0x15c07c(_0x54e60b);})[_0xf955('0xf')](function(_0x552cf3){logger[_0xf955('0x10')]('['+[_0x2783f2[_0xf955('0x11')]()]+']',_0x552cf3[_0xf955('0x12')]);_0x50930d(_0x552cf3[_0xf955('0x12')]);});}else{logger[_0xf955('0xd')]('['+[_0x2783f2[_0xf955('0x11')]()]+_0xf955('0x20'));_0x54e60b['userId']=_0x54e60b[_0xf955('0x1d')];_0x54e60b[_0xf955('0x14')]=_0x54e60b[_0xf955('0x1e')];_0x15c07c(_0x54e60b);}});};}function createEndUser(_0xbd0b74,_0x28fa9c,_0x264f6d,_0x4d4af0,_0x2232a7){logger[_0xf955('0xd')]('['+[_0xbd0b74['toUpperCase']()]+_0xf955('0x21'),_0x264f6d);return new Promise(function(_0x2c8df1,_0xf3c870){var _0x1ef794={'method':'POST','uri':_0x4d4af0+_0xf955('0x22')+_0x2232a7,'body':{'user_name':_0x264f6d['endUserNumber'],'roles':_0xf955('0x23'),'first_name':_0x264f6d[_0xf955('0x24')],'active':_0xf955('0x1a'),'date_format':_0xf955('0x25'),'phone':_0x264f6d[_0xf955('0x24')]},'auth':_0x28fa9c,'json':!![]};return rp(_0x1ef794)[_0xf955('0x17')](function(_0xd5dfb0){logger[_0xf955('0xd')]('['+[_0xbd0b74['toUpperCase']()]+_0xf955('0x26'),_0xd5dfb0[_0xf955('0xb')]);_0x264f6d[_0xf955('0x27')]=_0xd5dfb0[_0xf955('0xb')]['sys_id'];_0x2c8df1(_0x264f6d);})[_0xf955('0xf')](function(_0x31dad5){logger[_0xf955('0x10')]('['+[_0xbd0b74[_0xf955('0x11')]()]+']',_0x31dad5[_0xf955('0x12')]);_0xf3c870(_0x31dad5['message']);});});}function getEndUser(_0x4d7155,_0x5480db,_0x2626cb,_0x3783dc,_0x374e95){return function(_0x6d564c){logger[_0xf955('0xd')]('['+[_0x4d7155[_0xf955('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x6d564c);return new Promise(function(_0x3acc4b,_0x515dc6){var _0x8f842f={'method':_0xf955('0x15'),'uri':_0x2626cb+_0xf955('0x28')+_0x6d564c['endUserNumber']+'&'+_0x3783dc+'&'+_0x374e95,'auth':_0x5480db,'json':!![]};return rp(_0x8f842f)[_0xf955('0x17')](function(_0x4bef80){if(_0x4bef80[_0xf955('0xb')][_0xf955('0xc')]>0x0){_0x6d564c[_0xf955('0x27')]=_0x4bef80[_0xf955('0xb')][0x0]['sys_id'];logger[_0xf955('0xd')]('['+[_0x4d7155[_0xf955('0x11')]()]+'],\x20getEndUser\x20crm',_0x6d564c);_0x3acc4b(_0x6d564c);}else{return createEndUser(_0x4d7155,_0x5480db,_0x6d564c,_0x2626cb,_0x3783dc)[_0xf955('0x17')](function(_0x460aa7){logger[_0xf955('0xd')]('['+[_0x4d7155['toUpperCase']()]+_0xf955('0x29'),_0x460aa7);_0x3acc4b(_0x460aa7);});}})[_0xf955('0xf')](function(_0x11b7e2){logger['error']('['+[_0x4d7155[_0xf955('0x11')]()]+']',_0x11b7e2[_0xf955('0x12')]);_0x515dc6(_0x11b7e2[_0xf955('0x12')]);});});};}function getCustomFields(_0x2069f3,_0x2bfbe4){var _0x3c4b29={};if(_0x2069f3[_0xf955('0xc')]>0x0){_[_0xf955('0x2a')](_0x2069f3,function(_0x5671c7){if(_[_0xf955('0x2b')]([_0xf955('0x2c'),_0xf955('0x2d')],_0x5671c7[_0xf955('0x2e')])&&_0x5671c7[_0xf955('0x2f')]&&!_0x5671c7[_0xf955('0x30')]){_0x3c4b29[_0x5671c7[_0xf955('0x2f')][_0xf955('0x31')]()]=_0x5671c7[_0xf955('0x32')][_0xf955('0x33')]();}else if(_[_0xf955('0x2b')]([_0xf955('0x2c'),_0xf955('0x2d')],_0x5671c7[_0xf955('0x2e')])&&_0x5671c7[_0xf955('0x34')]&&_0x5671c7[_0xf955('0x30')]){_0x3c4b29[_0x5671c7[_0xf955('0x34')][_0xf955('0x31')]()]=_0x5671c7[_0xf955('0x32')]['toString']();}else if(_0x5671c7[_0xf955('0x2e')]===_0xf955('0x35')&&_0x5671c7[_0xf955('0x36')]&&_0x5671c7['idField']&&_0x5671c7[_0xf955('0x30')]){_0x3c4b29[_0x5671c7['idField'][_0xf955('0x31')]()]=_0x2bfbe4[_0x5671c7['variableName']][_0xf955('0x33')]();}else if(_0x5671c7[_0xf955('0x2e')]===_0xf955('0x37')&&_0x5671c7[_0xf955('0x38')]&&_0x5671c7['Variable'][_0xf955('0x39')]&&_0x5671c7[_0xf955('0x34')]&&_0x5671c7[_0xf955('0x30')]){_0x3c4b29[_0x5671c7['idField']['toLowerCase']()]=_0x2bfbe4[_0x5671c7[_0xf955('0x38')][_0xf955('0x39')][_0xf955('0x31')]()][_0xf955('0x33')]();}});}return _0x3c4b29;}function getTicket(_0x5e4a88,_0x265587,_0x152f57,_0x1ced36,_0x5a350d,_0x388e59){return function(_0x5ba567){logger[_0xf955('0xd')]('['+[_0x5e4a88[_0xf955('0x11')]()]+_0xf955('0x3a'),_0x5ba567);return new Promise(function(_0x4dd592,_0x3e24c9){var _0x3c8634=_0x5e4a88[_0xf955('0x31')]()===_0xf955('0x3b')?_0x5ba567['userId']:_0x5ba567[_0xf955('0x27')];var _0x4ff0f1={'method':_0xf955('0x3c'),'uri':_0x152f57+_0xf955('0x3d')+'?'+_0x388e59,'body':Object[_0xf955('0x3e')]({},{'active':'true','caller_id':_0x3c8634,'assigned_to':_0x5ba567[_0xf955('0x1b')],'short_description':intUtil['getString'](_0x1ced36[_0xf955('0x3f')],_0x5a350d,'\x20'),'description':intUtil['getString'](_0x1ced36[_0xf955('0x40')],_0x5a350d,'\x0a')},getCustomFields(_0x1ced36['Fields'],_0x5a350d)),'auth':_0x265587,'json':!![]};return rp(_0x4ff0f1)['then'](function(_0x3151b4){logger[_0xf955('0xd')]('['+[_0x5e4a88['toUpperCase']()]+_0xf955('0x41'),_0x3151b4['result']);_0x5ba567['ticketId']=_0x3151b4['result']['sys_id'];_0x5ba567[_0xf955('0x42')]=_0x3151b4[_0xf955('0xb')]['number'];logger['info']('['+[_0x5e4a88[_0xf955('0x11')]()]+_0xf955('0x43'),_0x5ba567);_0x4dd592(_0x5ba567);})[_0xf955('0xf')](function(_0x412a5a){logger[_0xf955('0x10')]('['+[_0x5e4a88[_0xf955('0x11')]()]+']',_0x412a5a[_0xf955('0x12')]);_0x3e24c9(_0x412a5a[_0xf955('0x12')]);});});};}function createRemoteTag(_0x376974,_0x141314,_0x1b7b73,_0x350873){return new Promise(function(_0x47a3a6,_0x2e74be){var _0x2e1186={'method':_0xf955('0x3c'),'uri':_0x1b7b73+_0xf955('0x44')+'?'+_0x350873,'body':{'short_description':_0x376974,'global':!![],'active':!![],'name':_0x376974},'auth':_0x141314,'json':!![]};return rp(_0x2e1186)[_0xf955('0x17')](function(_0x4dc34b){var _0xf5d575=_0x4dc34b[_0xf955('0xb')][_0xf955('0x1c')];_0x47a3a6(_0xf5d575);});});}function getRemoteTag(_0x33a054,_0x1e0ef0,_0x9057df,_0x228d59,_0x60c8a2){return new Promise(function(_0x2f9606,_0x1881f6){var _0x54a6b8={'method':_0xf955('0x15'),'uri':_0x9057df+_0xf955('0x44')+_0xf955('0x45')+_0x33a054+'&'+_0x228d59,'auth':_0x1e0ef0,'json':!![]};return rp(_0x54a6b8)[_0xf955('0x17')](function(_0x116458){if(_0x116458[_0xf955('0xb')][_0xf955('0xc')]>0x0){var _0x30b673=_0x116458[_0xf955('0xb')][0x0][_0xf955('0x1c')];_0x2f9606(_0x30b673);}else{return createRemoteTag(_0x33a054,_0x1e0ef0,_0x9057df,_0x228d59)[_0xf955('0x17')](function(_0x2b8173){_0x2f9606(_0x2b8173);});}});});}function assignTagToIncident(_0x5ce480,_0x1388a0,_0x452de9,_0x381cf0,_0x3eb727){return new Promise(function(_0x3c2cfd,_0x3171ba){var _0x1c4e2d={'method':'POST','uri':_0x452de9+'label_entry'+'?'+_0x3eb727,'body':{'label':_0x5ce480,'table':'incident','id_type':_0xf955('0x46'),'table_key':_0x381cf0['ticketId'],'title':'Incident\x20-\x20'+_0x381cf0[_0xf955('0x42')],'id_display':_0x381cf0['ticketNumber']},'auth':_0x1388a0,'json':!![]};return rp(_0x1c4e2d)[_0xf955('0x17')](function(_0x3fa5b5){_0x3c2cfd();})[_0xf955('0xf')](function(){_0x3c2cfd();});});}function manageTags(_0x30cb80,_0x4c88ae,_0x349d76,_0x9e3437,_0xabf581,_0x3149b3,_0x36364d){return new Promise(function(_0x545c1f,_0x189468){var _0x5990d7=[];_0x4c88ae[_0xf955('0x2a')](function(_0xdacba8){_0x5990d7[_0xf955('0x47')](getRemoteTag(_0xdacba8,_0x349d76,_0x9e3437,_0x3149b3,_0x36364d));});return Promise['all'](_0x5990d7)[_0xf955('0x17')](function(_0x40ca54){if(_0x40ca54[_0xf955('0xc')]){logger[_0xf955('0xd')]('['+[_0x30cb80[_0xf955('0x11')]()]+_0xf955('0x48'),_0x40ca54);var _0x3761f2=[];_0x40ca54['forEach'](function(_0x5f2d6c){_0x3761f2[_0xf955('0x47')](assignTagToIncident(_0x5f2d6c,_0x349d76,_0x9e3437,_0xabf581,_0x3149b3));});return Promise[_0xf955('0x49')](_0x3761f2)[_0xf955('0x17')](function(){_0x545c1f();})[_0xf955('0xf')](function(){_0x545c1f();});}else{_0x545c1f();}});});}function getTags(_0xab5eed,_0x34f52a,_0x52803a,_0x319e62,_0x2ceeb4,_0x2d20af){return function(_0x71ee3a){return new Promise(function(_0x4ff892,_0x2fdca9){var _0x4916c3=[];var _0x431729=_0x319e62['Tags'];if(_0x431729&&_0x431729['length']>0x0){_0x4916c3=_[_0xf955('0x4a')](_0x431729,_0xf955('0x39'));}if(_0x4916c3['length']>0x0){return manageTags(_0xab5eed,_0x4916c3,_0x34f52a,_0x52803a,_0x71ee3a,_0x2ceeb4,_0x2d20af)[_0xf955('0x17')](function(){_0x4ff892(_0x71ee3a);});}else{_0x4ff892(_0x71ee3a);}});};}function emit(_0x28e662,_0x5e8f86,_0x50b722){var _0x1e418=_0xf955('0x4b')+_0xf955('0x4c')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xf955('0x4d');var _0x29763d={'uri':_0x28e662+_0xf955('0x4e')+_0x50b722+_0x1e418};io['to'](util[_0xf955('0x4f')](_0xf955('0x50'),_0x5e8f86))[_0xf955('0x51')](_0xf955('0x52'),_0x29763d);}exports['cs']=function(_0xf1e40b,_0x5a45da,_0x3960ec,_0x1bc7b9,_0x58eb99,_0x45dba4,_0x243d61,_0x54dac){var _0x3fa0bc={};var _0x4e0e3f={'user':_0x45dba4[_0xf955('0x53')],'pass':_0x45dba4[_0xf955('0x54')]};var _0x4b85c2='sysparm_limit=1';var _0x2fe31b=_0xf955('0x55');_0x45dba4[_0xf955('0x56')]=intUtil[_0xf955('0x57')](_0x45dba4['remoteUri']);_0x45dba4[_0xf955('0x58')]=intUtil[_0xf955('0x57')](_0x45dba4[_0xf955('0x58')]);var _0x425d42=util[_0xf955('0x4f')](_0xf955('0x59'),_0x45dba4[_0xf955('0x56')]);_0x3fa0bc[_0xf955('0x14')]=!_[_0xf955('0x5a')](_0x1bc7b9)?_0x1bc7b9[_0xf955('0x5b')]:null;_0x3fa0bc[_0xf955('0x1e')]=_0x45dba4[_0xf955('0x5b')];_0x3fa0bc[_0xf955('0x24')]=_0x54dac['toLowerCase']()===_0xf955('0x3b')?_0x5a45da[_0xf955('0x5c')]:_0x5a45da[_0xf955('0x5d')];_0x3fa0bc[_0xf955('0x5e')]=_0x54dac==='queue'||_0x54dac===_0xf955('0x5f')?_0xf955('0x60'):_0xf955('0x3b');var _0x8bdcf2=util[_0xf955('0x4f')](_0xf955('0x61'),_0x45dba4[_0xf955('0x58')],_0x5a45da[_0xf955('0x62')],md5(_0x5a45da[_0xf955('0x62')]));if(_0x58eb99&&_0x58eb99[_0xf955('0x63')]){logger[_0xf955('0xd')]('[QUEUE]',_0xf955('0x64'));_0x5a45da[_0xf955('0x65')]=_0x8bdcf2;}else if(_0x243d61&&_0x243d61[_0xf955('0x66')]&&_0x243d61[_0xf955('0x66')]!==_0xf955('0x67')){logger[_0xf955('0xd')](_0xf955('0x68'),'Recording\x20is\x20enabled!');_0x5a45da[_0xf955('0x65')]=_0x8bdcf2;}else{_0x5a45da['recordingURL']='';}return getAdminUser(_0x54dac,_0x4e0e3f,_0x3fa0bc,_0x425d42,_0x2fe31b,_0x4b85c2)[_0xf955('0x17')](getUser(_0x54dac,_0x4e0e3f,_0x425d42,_0x2fe31b,_0x4b85c2))['then'](getEndUser(_0x54dac,_0x4e0e3f,_0x425d42,_0x2fe31b,_0x4b85c2))[_0xf955('0x17')](getTicket(_0x54dac,_0x4e0e3f,_0x425d42,_0x3960ec,_0x5a45da,_0x2fe31b))[_0xf955('0x17')](function(_0x3f76ce){logger[_0xf955('0xd')](util[_0xf955('0x4f')](_0xf955('0x69'),_0x3f76ce['ticketId']));logger[_0xf955('0xd')](util[_0xf955('0x4f')](_0xf955('0x6a'),_0x54dac));if(_0x54dac!=='unmanaged'){logger['info']('['+[_0x54dac[_0xf955('0x11')]()]+']',_0xf955('0x6b'));emit(_0x45dba4[_0xf955('0x56')],_0x1bc7b9['name'],_0x3f76ce[_0xf955('0x6c')]);}})['catch'](function(_0x36c23e){logger['error']('['+[_0x54dac[_0xf955('0x11')]()]+_0xf955('0x6d'),util[_0xf955('0x6e')](_0x36c23e,{'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 6041010..bd7bc98 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 _0xa63a=['emit','info','Creating\x20new\x20ticket...','name','description','getString','Descriptions','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','Contacts','parent_name','forEach','variableName','push','idField','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','stringify','isNil','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','user_id','Searching\x20enduser\x20with\x20phone','phone_home','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Enduser\x20created.','debug','[HTTP]','merge','type','string','nameField','customField','content','custom_fields','customVariable','Variable','toLowerCase','POST','login','PLAIN','xCALLY\x20Motion\x20integration','sessionID','remoteUri','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%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','serverUrl','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','Outbound','Ticket\x20created!','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','unmanaged','uri','toUpperCase','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults'];(function(_0x46c58a,_0x4246ba){var _0x279d97=function(_0x12cfab){while(--_0x12cfab){_0x46c58a['push'](_0x46c58a['shift']());}};_0x279d97(++_0x4246ba);}(_0xa63a,0x154));var _0xaa63=function(_0x19f5fc,_0x4c658a){_0x19f5fc=_0x19f5fc-0x0;var _0x315fa3=_0xa63a[_0x19f5fc];return _0x315fa3;};'use strict';var _=require('lodash');var rp=require(_0xaa63('0x0'));var BPromise=require(_0xaa63('0x1'));var md5=require(_0xaa63('0x2'));var util=require(_0xaa63('0x3'));var Redis=require(_0xaa63('0x4'));var intUtil=require(_0xaa63('0x5'));var config=require(_0xaa63('0x6'));var logger=require(_0xaa63('0x7'))(_0xaa63('0x8'));config[_0xaa63('0x9')]=_[_0xaa63('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xaa63('0x9')]));var def={'method':'POST','json':!![]};function emit(_0x42f55d,_0x37abe2,_0x4be7f7){io['to'](_0x42f55d)[_0xaa63('0xb')](_0x37abe2,_0x4be7f7);}function getTicket(_0x146c00,_0x1ac54f,_0x2e0dcf,_0x7d1c77,_0x12de55,_0xc170dd,_0x501bd1,_0x365500){logger[_0xaa63('0xc')](_0xaa63('0xd'));var _0x35e802=new Date();var _0x13b7b3=[{'name':_0xaa63('0xe'),'value':intUtil['getString'](_0x7d1c77['Subjects'],_0x12de55,'\x20')},{'name':'assigned_user_id','value':_0x1ac54f['id']},{'name':'created_by','value':_0x1ac54f['id']},{'name':_0xaa63('0xf'),'value':intUtil[_0xaa63('0x10')](_0x7d1c77[_0xaa63('0x11')],_0x12de55,'\x0a')},{'name':_0xaa63('0x12'),'value':_0x35e802[_0xaa63('0x13')]()[_0xaa63('0x14')](0x0,0x13)[_0xaa63('0x15')]('T','\x20')},{'name':_0xaa63('0x16'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xaa63('0x17'),'value':_0x2e0dcf['id']},{'name':_0xaa63('0x18'),'value':_0xaa63('0x19')},{'name':_0xaa63('0x1a'),'value':_0x2e0dcf[_0xaa63('0xe')]},{'name':'direction','value':_0x365500}];if(_0xc170dd['length']){_[_0xaa63('0x1b')](_0xc170dd,function(_0x442e72){if(_0x12de55[_0x442e72[_0xaa63('0x1c')]]){_0x13b7b3[_0xaa63('0x1d')]({'name':_0x442e72[_0xaa63('0x1e')],'value':_0x12de55[_0x442e72[_0xaa63('0x1c')]]});}});}return request({'form':{'method':_0xaa63('0x1f'),'input_type':_0xaa63('0x20'),'response_type':_0xaa63('0x20'),'rest_data':JSON['stringify']({'session':_0x501bd1['id'],'module_name':_0xaa63('0x21'),'name_value_list':_0x13b7b3})}});}function getAuth(_0x4bb43e){return util[_0xaa63('0x22')](_0xaa63('0x23'),new Buffer(_0x4bb43e[_0xaa63('0x24')]+':X')[_0xaa63('0x25')](_0xaa63('0x26')));}function getServerInfo(_0x14a782){return request({'form':{'method':_0xaa63('0x27'),'input_type':_0xaa63('0x20'),'response_type':_0xaa63('0x20'),'rest_data':JSON[_0xaa63('0x28')]({'session':_0x14a782['id']})}});}function getUser(_0x494112,_0x3f4f64,_0x224e69){if(!_[_0xaa63('0x29')](_0x3f4f64)){logger[_0xaa63('0xc')]('Getting\x20agent\x20with\x20name',_0x3f4f64);return request({'form':{'method':_0xaa63('0x2a'),'input_type':_0xaa63('0x20'),'response_type':_0xaa63('0x20'),'rest_data':JSON[_0xaa63('0x28')]({'session':_0x224e69['id'],'module_name':_0xaa63('0x2b'),'query':util['format'](_0xaa63('0x2c'),_0x3f4f64),'order_by':'','offset':'0','select_fields':['id',_0xaa63('0xe'),_0xaa63('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xaa63('0x2e')](function(_0x2dcaac){if(_0x2dcaac[_0xaa63('0x2f')]['length']){var _0x98e919=_[_0xaa63('0x30')](_0x2dcaac['entry_list'],function(_0x134d17){return _0x134d17[_0xaa63('0x31')][_0xaa63('0x2d')][_0xaa63('0x32')]===_0x3f4f64;});if(_0x98e919){logger[_0xaa63('0xc')](_0xaa63('0x33'));return BPromise[_0xaa63('0x34')]({'id':_0x98e919['name_value_list']['id'][_0xaa63('0x32')],'name':_0x98e919['name_value_list'][_0xaa63('0xe')][_0xaa63('0x32')]});}}logger[_0xaa63('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xaa63('0x34')]({'id':_0x224e69[_0xaa63('0x31')][_0xaa63('0x35')][_0xaa63('0x32')],'name':_0x224e69[_0xaa63('0x31')][_0xaa63('0x2d')][_0xaa63('0x32')]});});}else{logger['info']('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x224e69[_0xaa63('0x31')][_0xaa63('0x35')][_0xaa63('0x32')],'name':_0x224e69[_0xaa63('0x31')][_0xaa63('0x2d')][_0xaa63('0x32')]});}}function getEndUser(_0x53b167,_0x47bbfa,_0x19178c,_0x429ec8){logger['info'](_0xaa63('0x36'),_0x19178c);return request({'form':{'method':_0xaa63('0x2a'),'input_type':_0xaa63('0x20'),'response_type':_0xaa63('0x20'),'rest_data':JSON[_0xaa63('0x28')]({'session':_0x429ec8['id'],'module_name':_0xaa63('0x19'),'query':util[_0xaa63('0x22')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x19178c),'order_by':'','offset':'0','select_fields':['id','name',_0xaa63('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x218958){if(_0x218958[_0xaa63('0x2f')][_0xaa63('0x38')]){var _0x3739fa=_['find'](_0x218958[_0xaa63('0x2f')],function(_0x4612cf){return _0x4612cf[_0xaa63('0x31')][_0xaa63('0x37')]['value']===_0x19178c;});if(_0x3739fa){logger[_0xaa63('0xc')](_0xaa63('0x39'));return BPromise[_0xaa63('0x34')]({'id':_0x3739fa[_0xaa63('0x31')]['id'][_0xaa63('0x32')],'name':_0x3739fa[_0xaa63('0x31')][_0xaa63('0xe')][_0xaa63('0x32')],'phone':_0x3739fa['name_value_list']['phone_home'][_0xaa63('0x32')]});}}else{logger[_0xaa63('0xc')](_0xaa63('0x3a'));return request({'form':{'method':_0xaa63('0x1f'),'input_type':_0xaa63('0x20'),'response_type':_0xaa63('0x20'),'rest_data':JSON[_0xaa63('0x28')]({'session':_0x429ec8['id'],'module_name':'Contacts','name_value_list':[{'name':_0xaa63('0x3b'),'value':_0x47bbfa!==_0xaa63('0x3c')?_0x47bbfa:util['format']('Caller\x20-\x20%s',_0x19178c)},{'name':'phone_home','value':_0x19178c}]})}})[_0xaa63('0x2e')](function(_0x2cc4e4){logger[_0xaa63('0xc')](_0xaa63('0x3d'));return BPromise[_0xaa63('0x34')]({'id':_0x2cc4e4['id'],'name':_0x2cc4e4[_0xaa63('0x2f')][_0xaa63('0x3b')][_0xaa63('0x32')],'phone':_0x2cc4e4[_0xaa63('0x2f')][_0xaa63('0x37')]['value']});});}});}function request(_0x4918a4){logger[_0xaa63('0x3e')](_0xaa63('0x3f'),JSON[_0xaa63('0x28')](_0x4918a4));return rp(_[_0xaa63('0x40')](def,_0x4918a4));}function getTags(_0x5c0f3a,_0x26f6d7){var _0x4b2e4c=[];if(_0x5c0f3a&&_0x5c0f3a['length']>0x0){_0x4b2e4c=_['map'](_0x5c0f3a,_0x26f6d7);}return _0x4b2e4c;}function getCustomFields(_0x4a55db,_0x393822){var _0x254bae=[];var _0x10d2e0={'custom_fields':[]};if(_0x4a55db[_0xaa63('0x38')]>0x0){_[_0xaa63('0x1b')](_0x4a55db,function(_0x606a2b){if(_0x606a2b[_0xaa63('0x41')]===_0xaa63('0x42')&&_0x606a2b[_0xaa63('0x43')]&&!_0x606a2b[_0xaa63('0x44')]){_0x10d2e0[_0x606a2b['nameField']['toLowerCase']()]=_0x606a2b['content'][_0xaa63('0x25')]();}else if(_0x606a2b['type']===_0xaa63('0x42')&&_0x606a2b[_0xaa63('0x1e')]&&_0x606a2b['customField']){_0x10d2e0['custom_fields']['push']({'id':_0x606a2b[_0xaa63('0x1e')],'value':_0x606a2b[_0xaa63('0x45')][_0xaa63('0x25')]()});}else if(_0x606a2b[_0xaa63('0x41')]==='variable'&&_0x606a2b[_0xaa63('0x1c')]&&_0x606a2b['idField']&&_0x606a2b[_0xaa63('0x44')]){_0x393822[_0x606a2b[_0xaa63('0x1c')]]&&_0x10d2e0[_0xaa63('0x46')][_0xaa63('0x1d')]({'id':_0x606a2b['idField'],'value':_0x393822[_0x606a2b[_0xaa63('0x1c')]][_0xaa63('0x25')]()});}else if(_0x606a2b[_0xaa63('0x41')]===_0xaa63('0x47')&&_0x606a2b[_0xaa63('0x48')]&&_0x606a2b[_0xaa63('0x48')][_0xaa63('0xe')]&&_0x606a2b['idField']&&_0x606a2b['customField']){_0x393822[_0x606a2b[_0xaa63('0x48')]['name']['toLowerCase']()]&&_0x10d2e0[_0xaa63('0x46')][_0xaa63('0x1d')]({'id':_0x606a2b[_0xaa63('0x1e')],'value':_0x393822[_0x606a2b['Variable'][_0xaa63('0xe')][_0xaa63('0x49')]()]['toString']()});}});}return _0x10d2e0;}function getConnection(_0x43cbe4){return request({'method':_0xaa63('0x4a'),'form':{'method':_0xaa63('0x4b'),'input_type':_0xaa63('0x20'),'response_type':'JSON','rest_data':JSON[_0xaa63('0x28')]({'user_auth':{'user_name':_0x43cbe4['username'],'password':_0x43cbe4['password'],'encryption':_0xaa63('0x4c')},'application':_0xaa63('0x4d')})}})['then'](function(_0xf33b7e){var _0x205d33=_0xf33b7e;if(_0x205d33['id']){def[_0xaa63('0x4e')]=_0x205d33['id'];return BPromise[_0xaa63('0x34')](_0x205d33);}else{throw new Error(util[_0xaa63('0x22')]('Account\x20%d\x20is\x20not\x20valid',_0x43cbe4['id']));}});}function setRelationship(_0x1b811c,_0x503f3a,_0x31f57b,_0x1072bb){return request({'form':{'method':'set_relationship','input_type':_0xaa63('0x20'),'response_type':_0xaa63('0x20'),'rest_data':JSON[_0xaa63('0x28')]({'session':_0x1b811c['id'],'module_name':_0xaa63('0x21'),'module_id':_0x31f57b['id'],'link_field_name':_0x1072bb,'related_ids':[_0x503f3a['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x464528,_0x540f15,_0xb76cf2,_0x1b53dd,_0xf53966,_0x59f838){var _0x9186d8,_0x2668c8,_0x5c976d,_0x34fe2f;_0x59f838[_0xaa63('0x4f')]=intUtil[_0xaa63('0x50')](_0x59f838[_0xaa63('0x4f')]);_0x59f838['serverUrl']=intUtil['stripTrailingSlash'](_0x59f838['serverUrl']);def['uri']=util[_0xaa63('0x22')]('%s/service/v4_1/rest.php',_0x59f838[_0xaa63('0x4f')]);if(_0xf53966&&_0xf53966[_0xaa63('0x51')]){logger['info'](_0xaa63('0x52'),'Recording\x20is\x20enabled!');_0x540f15[_0xaa63('0x53')]=util[_0xaa63('0x22')](_0xaa63('0x54'),_0x59f838['serverUrl'],_0x540f15[_0xaa63('0x55')],md5(_0x540f15['uniqueid']));}else{_0x540f15[_0xaa63('0x53')]='';}return getConnection(_0x59f838)[_0xaa63('0x2e')](function(_0x15a572){_0x34fe2f=_0x15a572;return getUser(_0x59f838,_0x1b53dd[_0xaa63('0xe')],_0x34fe2f);})[_0xaa63('0x2e')](function(_0x12c05f){_0x9186d8=_0x12c05f;logger[_0xaa63('0xc')](_0xaa63('0x56'),_0x9186d8['id']);return getEndUser(_0x59f838,_0x540f15[_0xaa63('0x57')],_0x540f15[_0xaa63('0x58')],_0x34fe2f);})[_0xaa63('0x2e')](function(_0x29d5a9){_0x2668c8=_0x29d5a9;logger[_0xaa63('0xc')](_0xaa63('0x59'),_0x2668c8['id']);return getTicket(_0x59f838,_0x9186d8,_0x2668c8,_0xb76cf2,_0x540f15,_0xb76cf2[_0xaa63('0x5a')],_0x34fe2f,_0xaa63('0x5b'));})[_0xaa63('0x2e')](function(_0x4209fe){_0x5c976d=_0x4209fe;logger[_0xaa63('0xc')]('Ticket\x20created!');logger['info'](_0xaa63('0x5c'),_0x5c976d['id']);return setRelationship(_0x34fe2f,_0x9186d8,_0x5c976d,_0xaa63('0x5d'));})[_0xaa63('0x2e')](function(){return setRelationship(_0x34fe2f,_0x2668c8,_0x5c976d,_0xaa63('0x5e'));})['then'](function(){return getServerInfo(_0x34fe2f);})[_0xaa63('0x2e')](function(_0x5bb3d7){var _0x1cb5fa=parseInt(_0x5bb3d7[_0xaa63('0x5f')][_0xaa63('0x60')](0x0));var _0x58c465=util[_0xaa63('0x22')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x59f838[_0xaa63('0x4f')],_0x5c976d['id']);if(_0x1cb5fa>0x6){_0x58c465=util[_0xaa63('0x22')](_0xaa63('0x61'),_0x59f838[_0xaa63('0x4f')],_0x5c976d['id']);}logger[_0xaa63('0xc')]('[QUEUE]',_0xaa63('0x62'));emit(util['format'](_0xaa63('0x63'),_0x1b53dd[_0xaa63('0xe')]),_0xaa63('0x64'),{'uri':_0x58c465});})[_0xaa63('0x65')](function(_0xa1e7aa){logger[_0xaa63('0x66')]('[QUEUE]',JSON['stringify'](_0xa1e7aa));});};exports[_0xaa63('0x67')]=function(_0x1206f6,_0x5b9f48,_0x23b8b4,_0x1aeb20,_0x253de8,_0x100cc5,_0x17f817){var _0x5b102f,_0x5df779,_0x1cbb46,_0x2349dc;_0x100cc5[_0xaa63('0x4f')]=intUtil[_0xaa63('0x50')](_0x100cc5[_0xaa63('0x4f')]);_0x100cc5[_0xaa63('0x68')]=intUtil['stripTrailingSlash'](_0x100cc5['serverUrl']);def['uri']=util[_0xaa63('0x22')](_0xaa63('0x69'),_0x100cc5[_0xaa63('0x4f')]);if(_0x17f817&&_0x17f817[_0xaa63('0x6a')]&&_0x17f817[_0xaa63('0x6a')]!==_0xaa63('0x6b')){logger[_0xaa63('0xc')](_0xaa63('0x6c'),_0xaa63('0x6d'));_0x5b9f48[_0xaa63('0x53')]=util[_0xaa63('0x22')](_0xaa63('0x54'),_0x100cc5[_0xaa63('0x68')],_0x5b9f48[_0xaa63('0x55')],md5(_0x5b9f48['uniqueid']));}return getConnection(_0x100cc5)['then'](function(_0x5aba41){_0x2349dc=_0x5aba41;return getUser(_0x100cc5,_0x1aeb20[_0xaa63('0xe')],_0x2349dc);})[_0xaa63('0x2e')](function(_0x2566c8){_0x5b102f=_0x2566c8;logger[_0xaa63('0xc')](_0xaa63('0x56'),_0x5b102f['id']);return getEndUser(_0x100cc5,_0x5b9f48[_0xaa63('0x6e')],_0x5b9f48['destcalleridnum'],_0x2349dc);})[_0xaa63('0x2e')](function(_0x19df5e){_0x5df779=_0x19df5e;logger[_0xaa63('0xc')](_0xaa63('0x59'),_0x5df779['id']);return getTicket(_0x100cc5,_0x5b102f,_0x5df779,_0x23b8b4,_0x5b9f48,_0x23b8b4[_0xaa63('0x5a')],_0x2349dc,_0xaa63('0x6f'));})['then'](function(_0x2e3e19){_0x1cbb46=_0x2e3e19;logger['info'](_0xaa63('0x70'));logger[_0xaa63('0xc')]('The\x20Ticket\x20ID\x20is:',_0x1cbb46['id']);return setRelationship(_0x2349dc,_0x5b102f,_0x1cbb46,_0xaa63('0x5d'));})[_0xaa63('0x2e')](function(){return setRelationship(_0x2349dc,_0x5df779,_0x1cbb46,'contacts');})[_0xaa63('0x2e')](function(){return getServerInfo(_0x2349dc);})[_0xaa63('0x2e')](function(_0x2bec14){var _0x3c00cb=parseInt(_0x2bec14['version'][_0xaa63('0x60')](0x0));var _0x1cf647=util['format'](_0xaa63('0x71'),_0x100cc5[_0xaa63('0x4f')],_0x1cbb46['id']);if(_0x3c00cb>0x6){_0x1cf647=util[_0xaa63('0x22')](_0xaa63('0x61'),_0x100cc5[_0xaa63('0x4f')],_0x1cbb46['id']);}logger['info'](_0xaa63('0x6c'),_0xaa63('0x62'));emit(util[_0xaa63('0x22')]('user:%s',_0x1aeb20['name']),_0xaa63('0x64'),{'uri':_0x1cf647});})[_0xaa63('0x65')](function(_0x5b7623){logger[_0xaa63('0x66')]('[OUTBOUND]',JSON[_0xaa63('0x28')](_0x5b7623));});};exports[_0xaa63('0x72')]=function(_0x5184e2,_0x16a457,_0x1288a7,_0x3ea8f5,_0x34390b,_0x182731){var _0x19c257,_0x55e747,_0x218493,_0x2f011f;_0x182731[_0xaa63('0x4f')]=intUtil[_0xaa63('0x50')](_0x182731[_0xaa63('0x4f')]);_0x182731[_0xaa63('0x68')]=intUtil[_0xaa63('0x50')](_0x182731['serverUrl']);def[_0xaa63('0x73')]=util[_0xaa63('0x22')](_0xaa63('0x69'),_0x182731[_0xaa63('0x4f')]);if(_0x34390b&&_0x34390b[_0xaa63('0x51')]){logger[_0xaa63('0xc')]('['+_0x16a457['lastevent'][_0xaa63('0x74')]()+']',_0xaa63('0x6d'));_0x16a457[_0xaa63('0x53')]=util[_0xaa63('0x22')](_0xaa63('0x54'),_0x182731['serverUrl'],_0x16a457[_0xaa63('0x55')],md5(_0x16a457['uniqueid']));}else{_0x16a457['recordingURL']='';}return getConnection(_0x182731)[_0xaa63('0x2e')](function(_0x173785){_0x2f011f=_0x173785;if(!_[_0xaa63('0x29')](_0x3ea8f5)){return getUser(_0x182731,_0x3ea8f5[_0xaa63('0xe')],_0x2f011f);}else{return getUser(_0x182731,null,_0x2f011f);}})[_0xaa63('0x2e')](function(_0x1aab93){_0x19c257=_0x1aab93;logger[_0xaa63('0xc')](_0xaa63('0x56'),_0x19c257['id']);return getEndUser(_0x182731,_0x16a457[_0xaa63('0x57')],_0x16a457['calleridnum'],_0x2f011f);})[_0xaa63('0x2e')](function(_0x34ab02){_0x55e747=_0x34ab02;logger[_0xaa63('0xc')](_0xaa63('0x59'),_0x55e747['id']);return getTicket(_0x182731,_0x19c257,_0x55e747,_0x1288a7,_0x16a457,_0x1288a7[_0xaa63('0x5a')],_0x2f011f,_0xaa63('0x5b'));})[_0xaa63('0x2e')](function(_0x326487){_0x218493=_0x326487;logger[_0xaa63('0xc')](_0xaa63('0x70'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x218493['id']);return setRelationship(_0x2f011f,_0x19c257,_0x218493,_0xaa63('0x5d'));})[_0xaa63('0x2e')](function(){return setRelationship(_0x2f011f,_0x55e747,_0x218493,_0xaa63('0x5e'));})[_0xaa63('0x2e')](function(){return getServerInfo(_0x2f011f);})[_0xaa63('0x65')](function(_0x88bece){logger['error']('['+_0x16a457['lastevent'][_0xaa63('0x74')]()+']',JSON['stringify'](_0x88bece));});}; \ No newline at end of file +var _0xe205=['merge','map','type','string','nameField','customField','toLowerCase','content','custom_fields','push','variable','customVariable','Variable','username','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','[QUEUE]','recordingURL','uniqueid','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','outbound','%s/service/v4_1/rest.php','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Ticket\x20created!','trigger:browser:url','error','unmanaged','lastevent','toUpperCase','isNil','The\x20User\x20ID\x20is:','lodash','request-promise','md5','ioredis','./util','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','description','Descriptions','date_start','slice','replace','parent_id','parent_type','name','direction','length','forEach','variableName','idField','set_entry','JSON','stringify','Calls','format','apiKey','toString','base64','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','find','name_value_list','value','Agent\x20found!','resolve','user_id','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]'];(function(_0x1824c9,_0x475d83){var _0x3ad7e9=function(_0x346a23){while(--_0x346a23){_0x1824c9['push'](_0x1824c9['shift']());}};_0x3ad7e9(++_0x475d83);}(_0xe205,0xb0));var _0x5e20=function(_0x4e328e,_0x48ae8c){_0x4e328e=_0x4e328e-0x0;var _0x2334b2=_0xe205[_0x4e328e];return _0x2334b2;};'use strict';var _=require(_0x5e20('0x0'));var rp=require(_0x5e20('0x1'));var BPromise=require('bluebird');var md5=require(_0x5e20('0x2'));var util=require('util');var Redis=require(_0x5e20('0x3'));var intUtil=require(_0x5e20('0x4'));var config=require('../../../../config/environment');var logger=require(_0x5e20('0x5'))(_0x5e20('0x6'));config[_0x5e20('0x7')]=_[_0x5e20('0x8')](config[_0x5e20('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x5e20('0x9'))(new Redis(config[_0x5e20('0x7')]));var def={'method':_0x5e20('0xa'),'json':!![]};function emit(_0x4253ec,_0x567778,_0xfef9a5){io['to'](_0x4253ec)[_0x5e20('0xb')](_0x567778,_0xfef9a5);}function getTicket(_0x592768,_0x243f14,_0x7da11e,_0x3a2905,_0x2ac9f5,_0x43f3b6,_0x42b442,_0x2d0530){logger[_0x5e20('0xc')](_0x5e20('0xd'));var _0x4708da=new Date();var _0x17caee=[{'name':'name','value':intUtil[_0x5e20('0xe')](_0x3a2905[_0x5e20('0xf')],_0x2ac9f5,'\x20')},{'name':_0x5e20('0x10'),'value':_0x243f14['id']},{'name':'created_by','value':_0x243f14['id']},{'name':_0x5e20('0x11'),'value':intUtil[_0x5e20('0xe')](_0x3a2905[_0x5e20('0x12')],_0x2ac9f5,'\x0a')},{'name':_0x5e20('0x13'),'value':_0x4708da['toISOString']()[_0x5e20('0x14')](0x0,0x13)[_0x5e20('0x15')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x5e20('0x16'),'value':_0x7da11e['id']},{'name':_0x5e20('0x17'),'value':'Contacts'},{'name':'parent_name','value':_0x7da11e[_0x5e20('0x18')]},{'name':_0x5e20('0x19'),'value':_0x2d0530}];if(_0x43f3b6[_0x5e20('0x1a')]){_[_0x5e20('0x1b')](_0x43f3b6,function(_0x547204){if(_0x2ac9f5[_0x547204[_0x5e20('0x1c')]]){_0x17caee['push']({'name':_0x547204[_0x5e20('0x1d')],'value':_0x2ac9f5[_0x547204[_0x5e20('0x1c')]]});}});}return request({'form':{'method':_0x5e20('0x1e'),'input_type':_0x5e20('0x1f'),'response_type':_0x5e20('0x1f'),'rest_data':JSON[_0x5e20('0x20')]({'session':_0x42b442['id'],'module_name':_0x5e20('0x21'),'name_value_list':_0x17caee})}});}function getAuth(_0x50772c){return util[_0x5e20('0x22')]('Basic\x20%s',new Buffer(_0x50772c[_0x5e20('0x23')]+':X')[_0x5e20('0x24')](_0x5e20('0x25')));}function getServerInfo(_0x2c0b82){return request({'form':{'method':'get_server_info','input_type':_0x5e20('0x1f'),'response_type':_0x5e20('0x1f'),'rest_data':JSON[_0x5e20('0x20')]({'session':_0x2c0b82['id']})}});}function getUser(_0x1d7cae,_0x32ed18,_0x494985){if(!_['isNil'](_0x32ed18)){logger['info'](_0x5e20('0x26'),_0x32ed18);return request({'form':{'method':_0x5e20('0x27'),'input_type':'JSON','response_type':_0x5e20('0x1f'),'rest_data':JSON[_0x5e20('0x20')]({'session':_0x494985['id'],'module_name':_0x5e20('0x28'),'query':util[_0x5e20('0x22')](_0x5e20('0x29'),_0x32ed18),'order_by':'','offset':'0','select_fields':['id',_0x5e20('0x18'),_0x5e20('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x57dcb8){if(_0x57dcb8[_0x5e20('0x2b')]['length']){var _0x56d496=_[_0x5e20('0x2c')](_0x57dcb8[_0x5e20('0x2b')],function(_0x539c7a){return _0x539c7a[_0x5e20('0x2d')][_0x5e20('0x2a')][_0x5e20('0x2e')]===_0x32ed18;});if(_0x56d496){logger['info'](_0x5e20('0x2f'));return BPromise[_0x5e20('0x30')]({'id':_0x56d496[_0x5e20('0x2d')]['id'][_0x5e20('0x2e')],'name':_0x56d496[_0x5e20('0x2d')]['name'][_0x5e20('0x2e')]});}}logger[_0x5e20('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x5e20('0x30')]({'id':_0x494985[_0x5e20('0x2d')][_0x5e20('0x31')][_0x5e20('0x2e')],'name':_0x494985[_0x5e20('0x2d')]['user_name'][_0x5e20('0x2e')]});});}else{logger[_0x5e20('0xc')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x5e20('0x30')]({'id':_0x494985['name_value_list'][_0x5e20('0x31')][_0x5e20('0x2e')],'name':_0x494985['name_value_list'][_0x5e20('0x2a')][_0x5e20('0x2e')]});}}function getEndUser(_0x226549,_0x4241d5,_0x3e1058,_0xdb3647){logger['info'](_0x5e20('0x32'),_0x3e1058);return request({'form':{'method':'get_entry_list','input_type':_0x5e20('0x1f'),'response_type':_0x5e20('0x1f'),'rest_data':JSON[_0x5e20('0x20')]({'session':_0xdb3647['id'],'module_name':_0x5e20('0x33'),'query':util[_0x5e20('0x22')](_0x5e20('0x34'),_0x3e1058),'order_by':'','offset':'0','select_fields':['id',_0x5e20('0x18'),_0x5e20('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5e20('0x36')](function(_0x20f6a4){if(_0x20f6a4[_0x5e20('0x2b')][_0x5e20('0x1a')]){var _0x41981e=_['find'](_0x20f6a4[_0x5e20('0x2b')],function(_0x1acea0){return _0x1acea0['name_value_list'][_0x5e20('0x35')][_0x5e20('0x2e')]===_0x3e1058;});if(_0x41981e){logger[_0x5e20('0xc')](_0x5e20('0x37'));return BPromise['resolve']({'id':_0x41981e[_0x5e20('0x2d')]['id']['value'],'name':_0x41981e['name_value_list'][_0x5e20('0x18')][_0x5e20('0x2e')],'phone':_0x41981e['name_value_list']['phone_home'][_0x5e20('0x2e')]});}}else{logger[_0x5e20('0xc')](_0x5e20('0x38'));return request({'form':{'method':_0x5e20('0x1e'),'input_type':_0x5e20('0x1f'),'response_type':_0x5e20('0x1f'),'rest_data':JSON[_0x5e20('0x20')]({'session':_0xdb3647['id'],'module_name':_0x5e20('0x33'),'name_value_list':[{'name':_0x5e20('0x39'),'value':_0x4241d5!==''?_0x4241d5:util[_0x5e20('0x22')](_0x5e20('0x3a'),_0x3e1058)},{'name':_0x5e20('0x35'),'value':_0x3e1058}]})}})['then'](function(_0x525e3d){logger[_0x5e20('0xc')](_0x5e20('0x3b'));return BPromise[_0x5e20('0x30')]({'id':_0x525e3d['id'],'name':_0x525e3d[_0x5e20('0x2b')][_0x5e20('0x39')][_0x5e20('0x2e')],'phone':_0x525e3d[_0x5e20('0x2b')][_0x5e20('0x35')]['value']});});}});}function request(_0x505830){logger[_0x5e20('0x3c')](_0x5e20('0x3d'),JSON[_0x5e20('0x20')](_0x505830));return rp(_[_0x5e20('0x3e')](def,_0x505830));}function getTags(_0x57fa8d,_0x26f8ad){var _0x5ce1e7=[];if(_0x57fa8d&&_0x57fa8d[_0x5e20('0x1a')]>0x0){_0x5ce1e7=_[_0x5e20('0x3f')](_0x57fa8d,_0x26f8ad);}return _0x5ce1e7;}function getCustomFields(_0x570a83,_0x539ec3){var _0x1b7c74=[];var _0x406e2b={'custom_fields':[]};if(_0x570a83['length']>0x0){_[_0x5e20('0x1b')](_0x570a83,function(_0x24ab70){if(_0x24ab70[_0x5e20('0x40')]===_0x5e20('0x41')&&_0x24ab70[_0x5e20('0x42')]&&!_0x24ab70[_0x5e20('0x43')]){_0x406e2b[_0x24ab70[_0x5e20('0x42')][_0x5e20('0x44')]()]=_0x24ab70[_0x5e20('0x45')][_0x5e20('0x24')]();}else if(_0x24ab70[_0x5e20('0x40')]===_0x5e20('0x41')&&_0x24ab70[_0x5e20('0x1d')]&&_0x24ab70[_0x5e20('0x43')]){_0x406e2b[_0x5e20('0x46')][_0x5e20('0x47')]({'id':_0x24ab70['idField'],'value':_0x24ab70[_0x5e20('0x45')][_0x5e20('0x24')]()});}else if(_0x24ab70[_0x5e20('0x40')]===_0x5e20('0x48')&&_0x24ab70[_0x5e20('0x1c')]&&_0x24ab70[_0x5e20('0x1d')]&&_0x24ab70['customField']){_0x539ec3[_0x24ab70[_0x5e20('0x1c')]]&&_0x406e2b['custom_fields'][_0x5e20('0x47')]({'id':_0x24ab70[_0x5e20('0x1d')],'value':_0x539ec3[_0x24ab70[_0x5e20('0x1c')]][_0x5e20('0x24')]()});}else if(_0x24ab70[_0x5e20('0x40')]===_0x5e20('0x49')&&_0x24ab70[_0x5e20('0x4a')]&&_0x24ab70[_0x5e20('0x4a')][_0x5e20('0x18')]&&_0x24ab70[_0x5e20('0x1d')]&&_0x24ab70[_0x5e20('0x43')]){_0x539ec3[_0x24ab70[_0x5e20('0x4a')][_0x5e20('0x18')][_0x5e20('0x44')]()]&&_0x406e2b[_0x5e20('0x46')][_0x5e20('0x47')]({'id':_0x24ab70[_0x5e20('0x1d')],'value':_0x539ec3[_0x24ab70[_0x5e20('0x4a')][_0x5e20('0x18')][_0x5e20('0x44')]()][_0x5e20('0x24')]()});}});}return _0x406e2b;}function getConnection(_0x532b75){return request({'method':_0x5e20('0xa'),'form':{'method':'login','input_type':_0x5e20('0x1f'),'response_type':_0x5e20('0x1f'),'rest_data':JSON[_0x5e20('0x20')]({'user_auth':{'user_name':_0x532b75[_0x5e20('0x4b')],'password':_0x532b75['password'],'encryption':_0x5e20('0x4c')},'application':_0x5e20('0x4d')})}})[_0x5e20('0x36')](function(_0x4c0969){var _0x383e04=_0x4c0969;if(_0x383e04['id']){def['sessionID']=_0x383e04['id'];return BPromise[_0x5e20('0x30')](_0x383e04);}else{throw new Error(util[_0x5e20('0x22')](_0x5e20('0x4e'),_0x532b75['id']));}});}function setRelationship(_0x114ad3,_0xeaadcf,_0x4718f2,_0x396ef5){return request({'form':{'method':_0x5e20('0x4f'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x5e20('0x20')]({'session':_0x114ad3['id'],'module_name':_0x5e20('0x21'),'module_id':_0x4718f2['id'],'link_field_name':_0x396ef5,'related_ids':[_0xeaadcf['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x5e20('0x50')]=function(_0x4450f4,_0x3c03ad,_0x5c277c,_0x277a26,_0x4c0bc3,_0x42261d){var _0x408ace,_0x25f9ae,_0x38a60a,_0x208256;_0x42261d[_0x5e20('0x51')]=intUtil[_0x5e20('0x52')](_0x42261d[_0x5e20('0x51')]);_0x42261d['serverUrl']=intUtil[_0x5e20('0x52')](_0x42261d[_0x5e20('0x53')]);def[_0x5e20('0x54')]=util[_0x5e20('0x22')]('%s/service/v4_1/rest.php',_0x42261d[_0x5e20('0x51')]);if(_0x4c0bc3&&_0x4c0bc3[_0x5e20('0x55')]){logger[_0x5e20('0xc')](_0x5e20('0x56'),'Recording\x20is\x20enabled!');_0x3c03ad[_0x5e20('0x57')]=util[_0x5e20('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x42261d[_0x5e20('0x53')],_0x3c03ad[_0x5e20('0x58')],md5(_0x3c03ad[_0x5e20('0x58')]));}else{_0x3c03ad[_0x5e20('0x57')]='';}return getConnection(_0x42261d)[_0x5e20('0x36')](function(_0x1cde10){_0x208256=_0x1cde10;return getUser(_0x42261d,_0x277a26['name'],_0x208256);})[_0x5e20('0x36')](function(_0x4facaf){_0x408ace=_0x4facaf;logger[_0x5e20('0xc')]('The\x20User\x20ID\x20is:',_0x408ace['id']);return getEndUser(_0x42261d,_0x3c03ad['calleridname'],_0x3c03ad[_0x5e20('0x59')],_0x208256);})['then'](function(_0xb0414e){_0x25f9ae=_0xb0414e;logger[_0x5e20('0xc')](_0x5e20('0x5a'),_0x25f9ae['id']);return getTicket(_0x42261d,_0x408ace,_0x25f9ae,_0x5c277c,_0x3c03ad,_0x5c277c[_0x5e20('0x5b')],_0x208256,_0x5e20('0x5c'));})[_0x5e20('0x36')](function(_0xf0db25){_0x38a60a=_0xf0db25;logger['info']('Ticket\x20created!');logger['info'](_0x5e20('0x5d'),_0x38a60a['id']);return setRelationship(_0x208256,_0x408ace,_0x38a60a,_0x5e20('0x5e'));})['then'](function(){return setRelationship(_0x208256,_0x25f9ae,_0x38a60a,_0x5e20('0x5f'));})[_0x5e20('0x36')](function(){return getServerInfo(_0x208256);})[_0x5e20('0x36')](function(_0x7862b4){var _0x358dba=parseInt(_0x7862b4[_0x5e20('0x60')][_0x5e20('0x61')](0x0));var _0x413d4d=util[_0x5e20('0x22')](_0x5e20('0x62'),_0x42261d[_0x5e20('0x51')],_0x38a60a['id']);if(_0x358dba>0x6){_0x413d4d=util[_0x5e20('0x22')](_0x5e20('0x63'),_0x42261d[_0x5e20('0x51')],_0x38a60a['id']);}logger[_0x5e20('0xc')](_0x5e20('0x56'),_0x5e20('0x64'));emit(util['format'](_0x5e20('0x65'),_0x277a26[_0x5e20('0x18')]),'trigger:browser:url',{'uri':_0x413d4d});})[_0x5e20('0x66')](function(_0x5702a3){logger['error'](_0x5e20('0x56'),JSON[_0x5e20('0x20')](_0x5702a3));});};exports[_0x5e20('0x67')]=function(_0x5b3438,_0x4409b3,_0x18b238,_0x45267c,_0x34d27e,_0x2ee446,_0x296486){var _0x1384fb,_0x18f20f,_0x9e1173,_0x2d4b78;_0x2ee446[_0x5e20('0x51')]=intUtil[_0x5e20('0x52')](_0x2ee446[_0x5e20('0x51')]);_0x2ee446['serverUrl']=intUtil[_0x5e20('0x52')](_0x2ee446[_0x5e20('0x53')]);def[_0x5e20('0x54')]=util['format'](_0x5e20('0x68'),_0x2ee446[_0x5e20('0x51')]);if(_0x296486&&_0x296486[_0x5e20('0x69')]&&_0x296486[_0x5e20('0x69')]!=='none'){logger[_0x5e20('0xc')](_0x5e20('0x6a'),_0x5e20('0x6b'));_0x4409b3['recordingURL']=util[_0x5e20('0x22')](_0x5e20('0x6c'),_0x2ee446[_0x5e20('0x53')],_0x4409b3[_0x5e20('0x58')],md5(_0x4409b3[_0x5e20('0x58')]));}return getConnection(_0x2ee446)['then'](function(_0x1fa928){_0x2d4b78=_0x1fa928;return getUser(_0x2ee446,_0x45267c[_0x5e20('0x18')],_0x2d4b78);})['then'](function(_0x20c674){_0x1384fb=_0x20c674;logger[_0x5e20('0xc')]('The\x20User\x20ID\x20is:',_0x1384fb['id']);return getEndUser(_0x2ee446,_0x4409b3[_0x5e20('0x6d')],_0x4409b3[_0x5e20('0x6e')],_0x2d4b78);})[_0x5e20('0x36')](function(_0x208664){_0x18f20f=_0x208664;logger['info'](_0x5e20('0x5a'),_0x18f20f['id']);return getTicket(_0x2ee446,_0x1384fb,_0x18f20f,_0x18b238,_0x4409b3,_0x18b238[_0x5e20('0x5b')],_0x2d4b78,'Outbound');})[_0x5e20('0x36')](function(_0x5e2592){_0x9e1173=_0x5e2592;logger[_0x5e20('0xc')](_0x5e20('0x6f'));logger['info'](_0x5e20('0x5d'),_0x9e1173['id']);return setRelationship(_0x2d4b78,_0x1384fb,_0x9e1173,_0x5e20('0x5e'));})['then'](function(){return setRelationship(_0x2d4b78,_0x18f20f,_0x9e1173,'contacts');})[_0x5e20('0x36')](function(){return getServerInfo(_0x2d4b78);})[_0x5e20('0x36')](function(_0x42b2c7){var _0xf563d6=parseInt(_0x42b2c7['version'][_0x5e20('0x61')](0x0));var _0x1d8553=util[_0x5e20('0x22')](_0x5e20('0x62'),_0x2ee446[_0x5e20('0x51')],_0x9e1173['id']);if(_0xf563d6>0x6){_0x1d8553=util['format'](_0x5e20('0x63'),_0x2ee446[_0x5e20('0x51')],_0x9e1173['id']);}logger[_0x5e20('0xc')](_0x5e20('0x6a'),_0x5e20('0x64'));emit(util[_0x5e20('0x22')]('user:%s',_0x45267c[_0x5e20('0x18')]),_0x5e20('0x70'),{'uri':_0x1d8553});})[_0x5e20('0x66')](function(_0x5e1331){logger[_0x5e20('0x71')](_0x5e20('0x6a'),JSON['stringify'](_0x5e1331));});};exports[_0x5e20('0x72')]=function(_0x110636,_0x52fa47,_0x5d38ce,_0x2081eb,_0x3ef0d0,_0x11faa7){var _0x1b8c23,_0x13cd62,_0x67e349,_0x1ef562;_0x11faa7['remoteUri']=intUtil[_0x5e20('0x52')](_0x11faa7[_0x5e20('0x51')]);_0x11faa7[_0x5e20('0x53')]=intUtil[_0x5e20('0x52')](_0x11faa7[_0x5e20('0x53')]);def[_0x5e20('0x54')]=util[_0x5e20('0x22')](_0x5e20('0x68'),_0x11faa7[_0x5e20('0x51')]);if(_0x3ef0d0&&_0x3ef0d0[_0x5e20('0x55')]){logger[_0x5e20('0xc')]('['+_0x52fa47[_0x5e20('0x73')][_0x5e20('0x74')]()+']',_0x5e20('0x6b'));_0x52fa47[_0x5e20('0x57')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x11faa7[_0x5e20('0x53')],_0x52fa47[_0x5e20('0x58')],md5(_0x52fa47['uniqueid']));}else{_0x52fa47[_0x5e20('0x57')]='';}return getConnection(_0x11faa7)['then'](function(_0x2b805a){_0x1ef562=_0x2b805a;if(!_[_0x5e20('0x75')](_0x2081eb)){return getUser(_0x11faa7,_0x2081eb['name'],_0x1ef562);}else{return getUser(_0x11faa7,null,_0x1ef562);}})[_0x5e20('0x36')](function(_0x13004e){_0x1b8c23=_0x13004e;logger[_0x5e20('0xc')](_0x5e20('0x76'),_0x1b8c23['id']);return getEndUser(_0x11faa7,_0x52fa47['calleridname'],_0x52fa47[_0x5e20('0x59')],_0x1ef562);})['then'](function(_0x5e937a){_0x13cd62=_0x5e937a;logger[_0x5e20('0xc')]('The\x20Enduser\x20ID\x20is:',_0x13cd62['id']);return getTicket(_0x11faa7,_0x1b8c23,_0x13cd62,_0x5d38ce,_0x52fa47,_0x5d38ce[_0x5e20('0x5b')],_0x1ef562,_0x5e20('0x5c'));})[_0x5e20('0x36')](function(_0x46c09b){_0x67e349=_0x46c09b;logger[_0x5e20('0xc')](_0x5e20('0x6f'));logger[_0x5e20('0xc')]('The\x20Ticket\x20ID\x20is:',_0x67e349['id']);return setRelationship(_0x1ef562,_0x1b8c23,_0x67e349,_0x5e20('0x5e'));})[_0x5e20('0x36')](function(){return setRelationship(_0x1ef562,_0x13cd62,_0x67e349,_0x5e20('0x5f'));})[_0x5e20('0x36')](function(){return getServerInfo(_0x1ef562);})[_0x5e20('0x66')](function(_0x5b455e){logger[_0x5e20('0x71')]('['+_0x52fa47[_0x5e20('0x73')]['toUpperCase']()+']',JSON[_0x5e20('0x20')](_0x5b455e));});}; \ 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 9e4e8b9..3b5fdb1 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 _0x3c17=['util','sortBy','length','type','push','variable','variableName','toString','customVariable','Variable','name','keyValue','keyType','string','key','keyContent','format','%s:\x20%s','toLowerCase','join','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','lodash'];(function(_0xb3efae,_0x34af7d){var _0x3013e1=function(_0x4f2df1){while(--_0x4f2df1){_0xb3efae['push'](_0xb3efae['shift']());}};_0x3013e1(++_0x34af7d);}(_0x3c17,0x67));var _0x73c1=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x3c17[_0x40bffc];return _0x3007e9;};'use strict';var _=require(_0x73c1('0x0'));var util=require(_0x73c1('0x1'));exports['getString']=function(_0x243526,_0x5e4506,_0x3d4c31){var _0x5cf7b3=[];if(_0x243526['length']>0x0){var _0x5eb408=_[_0x73c1('0x2')](_0x243526,['id']);for(var _0x1f0ec9=0x0;_0x1f0ec9<_0x5eb408[_0x73c1('0x3')];_0x1f0ec9++){var _0x2fa30a=_0x5eb408[_0x1f0ec9];if(_0x2fa30a[_0x73c1('0x4')]==='string'){_0x5cf7b3[_0x73c1('0x5')](_0x2fa30a['content']);}else if(_0x2fa30a[_0x73c1('0x4')]===_0x73c1('0x6')&&_0x2fa30a[_0x73c1('0x7')]){_0x5e4506[_0x2fa30a['variableName']]&&_0x5cf7b3['push'](_0x5e4506[_0x2fa30a['variableName']][_0x73c1('0x8')]());}else if(_0x2fa30a[_0x73c1('0x4')]===_0x73c1('0x9')&&_0x2fa30a[_0x73c1('0xa')]&&_0x2fa30a[_0x73c1('0xa')]['name']){_0x5e4506[_0x2fa30a['Variable']['name']['toLowerCase']()]&&_0x5cf7b3[_0x73c1('0x5')](_0x5e4506[_0x2fa30a[_0x73c1('0xa')][_0x73c1('0xb')]['toLowerCase']()][_0x73c1('0x8')]());}else if(_0x2fa30a['type']===_0x73c1('0xc')){if(_0x2fa30a[_0x73c1('0xd')]===_0x73c1('0xe')&&_0x2fa30a['key']){_0x5cf7b3[_0x73c1('0x5')](util['format']('%s:\x20%s',_0x2fa30a[_0x73c1('0xf')],_0x2fa30a[_0x73c1('0x10')]));}else if(_0x2fa30a[_0x73c1('0xd')]==='variable'&&_0x2fa30a['variableName']&&_0x2fa30a[_0x73c1('0xf')]){_0x5e4506[_0x2fa30a['variableName']]&&_0x5cf7b3[_0x73c1('0x5')](util[_0x73c1('0x11')](_0x73c1('0x12'),_0x2fa30a[_0x73c1('0xf')],_0x5e4506[_0x2fa30a[_0x73c1('0x7')]]));}else if(_0x2fa30a[_0x73c1('0xd')]===_0x73c1('0x9')&&_0x2fa30a['Variable']&&_0x2fa30a[_0x73c1('0xa')][_0x73c1('0xb')]&&_0x2fa30a['key']){_0x5e4506[_0x2fa30a[_0x73c1('0xa')][_0x73c1('0xb')][_0x73c1('0x13')]()]&&_0x5cf7b3[_0x73c1('0x5')](util[_0x73c1('0x11')](_0x73c1('0x12'),_0x2fa30a[_0x73c1('0xf')],_0x5e4506[_0x2fa30a[_0x73c1('0xa')][_0x73c1('0xb')][_0x73c1('0x13')]()]));}}}}return _0x5cf7b3[_0x73c1('0x14')](_0x3d4c31);};exports[_0x73c1('0x15')]=function(_0x1fbba7){var _0xc76f62=_0x1fbba7['slice'](-0x1);if(_0xc76f62==='/'){_0x1fbba7=_0x1fbba7[_0x73c1('0x16')](0x0,_0x1fbba7[_0x73c1('0x17')](_0xc76f62));}return _0x1fbba7;};exports[_0x73c1('0x18')]=function(_0x1192eb){if(!_[_0x73c1('0x19')](_0x1192eb)&&_0x1192eb!==''){var _0x490de5=/^(([^<>()\[\]\\.,;:\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 _0x490de5['test'](String(_0x1192eb)[_0x73c1('0x13')]());}else{return![];}}; \ No newline at end of file +var _0xf17c=['slice','substring','validateEmail','isNil','test','lodash','util','getString','sortBy','length','string','content','type','variable','variableName','push','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','keyContent','format','%s:\x20%s','join','stripTrailingSlash'];(function(_0x1dc580,_0x5ebbcf){var _0x52b69b=function(_0x3ad2fd){while(--_0x3ad2fd){_0x1dc580['push'](_0x1dc580['shift']());}};_0x52b69b(++_0x5ebbcf);}(_0xf17c,0xb3));var _0xcf17=function(_0x31a47b,_0x23a044){_0x31a47b=_0x31a47b-0x0;var _0x3808f8=_0xf17c[_0x31a47b];return _0x3808f8;};'use strict';var _=require(_0xcf17('0x0'));var util=require(_0xcf17('0x1'));exports[_0xcf17('0x2')]=function(_0x5514e5,_0x4122ed,_0x13c7d8){var _0x46c199=[];if(_0x5514e5['length']>0x0){var _0xbd4ca7=_[_0xcf17('0x3')](_0x5514e5,['id']);for(var _0x48e773=0x0;_0x48e773<_0xbd4ca7[_0xcf17('0x4')];_0x48e773++){var _0xda06ea=_0xbd4ca7[_0x48e773];if(_0xda06ea['type']===_0xcf17('0x5')){_0x46c199['push'](_0xda06ea[_0xcf17('0x6')]);}else if(_0xda06ea[_0xcf17('0x7')]===_0xcf17('0x8')&&_0xda06ea['variableName']){_0x4122ed[_0xda06ea[_0xcf17('0x9')]]&&_0x46c199[_0xcf17('0xa')](_0x4122ed[_0xda06ea['variableName']][_0xcf17('0xb')]());}else if(_0xda06ea[_0xcf17('0x7')]===_0xcf17('0xc')&&_0xda06ea[_0xcf17('0xd')]&&_0xda06ea[_0xcf17('0xd')][_0xcf17('0xe')]){_0x4122ed[_0xda06ea[_0xcf17('0xd')][_0xcf17('0xe')]['toLowerCase']()]&&_0x46c199[_0xcf17('0xa')](_0x4122ed[_0xda06ea[_0xcf17('0xd')]['name'][_0xcf17('0xf')]()][_0xcf17('0xb')]());}else if(_0xda06ea['type']===_0xcf17('0x10')){if(_0xda06ea[_0xcf17('0x11')]===_0xcf17('0x5')&&_0xda06ea[_0xcf17('0x12')]){_0x46c199[_0xcf17('0xa')](util['format']('%s:\x20%s',_0xda06ea[_0xcf17('0x12')],_0xda06ea[_0xcf17('0x13')]));}else if(_0xda06ea[_0xcf17('0x11')]===_0xcf17('0x8')&&_0xda06ea[_0xcf17('0x9')]&&_0xda06ea['key']){_0x4122ed[_0xda06ea[_0xcf17('0x9')]]&&_0x46c199['push'](util[_0xcf17('0x14')](_0xcf17('0x15'),_0xda06ea['key'],_0x4122ed[_0xda06ea[_0xcf17('0x9')]]));}else if(_0xda06ea[_0xcf17('0x11')]===_0xcf17('0xc')&&_0xda06ea[_0xcf17('0xd')]&&_0xda06ea[_0xcf17('0xd')]['name']&&_0xda06ea[_0xcf17('0x12')]){_0x4122ed[_0xda06ea[_0xcf17('0xd')]['name']['toLowerCase']()]&&_0x46c199['push'](util[_0xcf17('0x14')](_0xcf17('0x15'),_0xda06ea[_0xcf17('0x12')],_0x4122ed[_0xda06ea[_0xcf17('0xd')]['name'][_0xcf17('0xf')]()]));}}}}return _0x46c199[_0xcf17('0x16')](_0x13c7d8);};exports[_0xcf17('0x17')]=function(_0x27fa45){var _0xe9343f=_0x27fa45[_0xcf17('0x18')](-0x1);if(_0xe9343f==='/'){_0x27fa45=_0x27fa45[_0xcf17('0x19')](0x0,_0x27fa45['lastIndexOf'](_0xe9343f));}return _0x27fa45;};exports[_0xcf17('0x1a')]=function(_0x4e4fa6){if(!_[_0xcf17('0x1b')](_0x4e4fa6)&&_0x4e4fa6!==''){var _0x53fe73=/^(([^<>()\[\]\\.,;:\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 _0x53fe73[_0xcf17('0x1c')](String(_0x4e4fa6)[_0xcf17('0xf')]());}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 816ccbb..a5bca98 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 _0x97bb=['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;','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Contacts','phone','accessKey','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','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','trigger:browser:url','outbound','recordingFormat','destcalleridnum','split','[OUTBOUND]','unmanaged','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','emit','length','includes','string','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','format','%s/webservice.php','remoteUri','create','username','HelpDesk','then','success','resolve','stringify','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser'];(function(_0x31a71e,_0x2d0c36){var _0x17fe16=function(_0x5ad66b){while(--_0x5ad66b){_0x31a71e['push'](_0x31a71e['shift']());}};_0x17fe16(++_0x2d0c36);}(_0x97bb,0x1c2));var _0xb97b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x97bb[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb97b('0x0'));var rp=require(_0xb97b('0x1'));var BPromise=require(_0xb97b('0x2'));var md5=require(_0xb97b('0x3'));var util=require(_0xb97b('0x4'));var Redis=require(_0xb97b('0x5'));var intUtil=require(_0xb97b('0x6'));var config=require(_0xb97b('0x7'));var logger=require(_0xb97b('0x8'))(_0xb97b('0x9'));config[_0xb97b('0xa')]=_[_0xb97b('0xb')](config[_0xb97b('0xa')],{'host':_0xb97b('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb97b('0xa')]));function emit(_0x119bea,_0x5b0ada,_0x52b79e){io['to'](_0x119bea)[_0xb97b('0xd')](_0x5b0ada,_0x52b79e);}function getCustomFields(_0x192778,_0x5e4073){var _0x124c42={};if(_0x192778[_0xb97b('0xe')]>0x0){_['forEach'](_0x192778,function(_0x307e41){if(_[_0xb97b('0xf')]([_0xb97b('0x10'),'picklist'],_0x307e41[_0xb97b('0x11')])&&_0x307e41['idField']){_0x124c42[_0x307e41[_0xb97b('0x12')]]=_0x307e41['content'][_0xb97b('0x13')]();}else if(_0x307e41[_0xb97b('0x11')]===_0xb97b('0x14')&&_0x307e41[_0xb97b('0x15')]&&_0x307e41['idField']&&_0x5e4073[_0x307e41[_0xb97b('0x15')]]){_0x124c42[_0x307e41[_0xb97b('0x12')]]=_0x5e4073[_0x307e41[_0xb97b('0x15')]][_0xb97b('0x13')]();}else if(_0x307e41['type']===_0xb97b('0x16')&&_0x307e41['Variable']&&_0x307e41[_0xb97b('0x17')][_0xb97b('0x18')]&&_0x307e41[_0xb97b('0x12')]&&_0x5e4073[_0x307e41[_0xb97b('0x17')][_0xb97b('0x18')][_0xb97b('0x19')]()]){_0x124c42[_0x307e41[_0xb97b('0x12')]]=_0x5e4073[_0x307e41[_0xb97b('0x17')][_0xb97b('0x18')]['toLowerCase']()][_0xb97b('0x13')]();}});}return _0x124c42;}function createTicket(_0x1423ac,_0x1b10a5,_0x71ed08,_0xe361ac,_0x1fdf04,_0x4b8f30,_0x1900ab){logger[_0xb97b('0x1a')](_0xb97b('0x1b'));var _0x21dcf6=_['merge']({'parent_id':'','assigned_user_id':_0x1b10a5['id'],'ticketpriorities':_0xb97b('0x1c'),'ticketstatus':_0xb97b('0x1d'),'ticket_title':intUtil['getString'](_0xe361ac[_0xb97b('0x1e')],_0x1fdf04,'\x20'),'description':intUtil['getString'](_0xe361ac['Descriptions'],_0x1fdf04,'\x0a'),'contact_id':_0x71ed08['id']},getCustomFields(_0x4b8f30,_0x1fdf04));var _0x5871fe={'method':'POST','uri':util[_0xb97b('0x1f')](_0xb97b('0x20'),_0x1423ac[_0xb97b('0x21')]),'form':{'operation':_0xb97b('0x22'),'username':_0x1423ac[_0xb97b('0x23')],'sessionName':_0x1900ab['sessionName'],'elementType':_0xb97b('0x24'),'element':JSON['stringify'](_0x21dcf6)},'json':!![]};return request(_0x5871fe)[_0xb97b('0x25')](function(_0xc2c09c){if(_0xc2c09c[_0xb97b('0x26')]){return BPromise[_0xb97b('0x27')]({'id':_0xc2c09c['result']['id']});}else{throw new Error(util[_0xb97b('0x1f')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0xb97b('0x28')](_0xc2c09c[_0xb97b('0x29')])));}})[_0xb97b('0x2a')](function(_0xeaf57d){var _0x50b7ef=_0xeaf57d[_0xb97b('0x2b')]||0x1f4;logger[_0xb97b('0x29')](_0xb97b('0x2c'),_0xb97b('0x2d'),_0x50b7ef,JSON['stringify'](_0xeaf57d));});}function getUser(_0x20cb1d,_0x29df6a,_0x31735a){if(intUtil[_0xb97b('0x2e')](_0x29df6a)){logger[_0xb97b('0x1a')](_0xb97b('0x2f'),_0x29df6a);return request({'method':_0xb97b('0x30'),'uri':util[_0xb97b('0x1f')](_0xb97b('0x20'),_0x20cb1d['remoteUri']),'qs':{'operation':_0xb97b('0x31'),'username':_0x20cb1d['username'],'sessionName':_0x31735a[_0xb97b('0x32')],'query':util[_0xb97b('0x1f')](_0xb97b('0x33'),_0x29df6a)},'json':!![]})[_0xb97b('0x25')](function(_0x309364){if(_0x309364[_0xb97b('0x26')]&&_0x309364[_0xb97b('0x34')][_0xb97b('0xe')]){logger[_0xb97b('0x1a')](_0xb97b('0x35'));return BPromise['resolve']({'id':_0x309364['result'][0x0]['id'],'email':_0x309364[_0xb97b('0x34')][0x0][_0xb97b('0x36')],'name':_0x309364[_0xb97b('0x34')][0x0]['first_name']+'\x20'+_0x309364[_0xb97b('0x34')][_0xb97b('0x37')]});}else{logger[_0xb97b('0x1a')](_0xb97b('0x38'));return BPromise[_0xb97b('0x27')]({'id':_0x31735a[_0xb97b('0x39')],'email':_0x20cb1d[_0xb97b('0x23')],'name':_0xb97b('0x3a')});}})[_0xb97b('0x2a')](function(_0xcbd60d){var _0x40df2f=_0xcbd60d[_0xb97b('0x2b')]||0x1f4;logger['error'](_0xb97b('0x2c'),_0xb97b('0x3b'),_0x40df2f,JSON[_0xb97b('0x28')](_0xcbd60d));});}else{logger[_0xb97b('0x1a')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xb97b('0x27')]({'id':_0x31735a[_0xb97b('0x39')],'email':_0x20cb1d[_0xb97b('0x23')],'name':_0xb97b('0x3a')})[_0xb97b('0x2a')](function(_0x5a6cec){var _0x1a6f3e=_0x5a6cec['statusCode']||0x1f4;logger[_0xb97b('0x29')](_0xb97b('0x2c'),_0xb97b('0x3b'),_0x1a6f3e,JSON[_0xb97b('0x28')](_0x5a6cec));});}}function getEndUser(_0x10b76f,_0x554ff2,_0x4c5647,_0x2be419){logger['info'](_0xb97b('0x3c'),_0x4c5647);return request({'method':_0xb97b('0x30'),'uri':util[_0xb97b('0x1f')]('%s/webservice.php',_0x10b76f[_0xb97b('0x21')]),'qs':{'operation':_0xb97b('0x31'),'username':_0x10b76f[_0xb97b('0x23')],'sessionName':_0x2be419[_0xb97b('0x32')],'query':util[_0xb97b('0x1f')](_0xb97b('0x3d'),_0x4c5647,_0x4c5647,_0x4c5647,_0x4c5647,_0x4c5647)},'json':!![]})[_0xb97b('0x25')](function(_0x4d1fa2){if(_0x4d1fa2[_0xb97b('0x26')]&&_0x4d1fa2[_0xb97b('0x34')][_0xb97b('0xe')]){logger[_0xb97b('0x1a')]('Enduser\x20found!');return BPromise['resolve']({'id':_0x4d1fa2[_0xb97b('0x34')][0x0]['id'],'name':_0x4d1fa2[_0xb97b('0x34')][0x0]['firstname']+'\x20'+_0x4d1fa2[_0xb97b('0x34')][0x0][_0xb97b('0x3e')],'phone':_0x4c5647});}else{logger[_0xb97b('0x1a')](_0xb97b('0x3f'));return request({'method':_0xb97b('0x40'),'uri':util['format'](_0xb97b('0x20'),_0x10b76f[_0xb97b('0x21')]),'form':{'operation':_0xb97b('0x22'),'sessionName':_0x2be419[_0xb97b('0x32')],'elementType':_0xb97b('0x41'),'element':JSON[_0xb97b('0x28')]({'lastname':_0x554ff2,'phone':_0x4c5647,'assigned_user_id':'\x20'})},'json':!![]})[_0xb97b('0x25')](function(_0x4ae27a){logger['info']('Enduser\x20created.');return BPromise[_0xb97b('0x27')]({'id':_0x4ae27a[_0xb97b('0x34')]['id'],'name':_0x4ae27a[_0xb97b('0x34')][_0xb97b('0x3e')],'phone':_0x4ae27a[_0xb97b('0x34')][_0xb97b('0x42')]});})[_0xb97b('0x2a')](function(_0x25fc44){var _0x362f4=_0x25fc44['statusCode']||0x1f4;logger[_0xb97b('0x29')](_0xb97b('0x2c'),'getEndUser',_0x362f4,JSON['stringify'](_0x25fc44));});}});}function getConnection(_0x5400a4){var _0x2e08fb=_0x5400a4['username'];var _0x1af255=_0x5400a4[_0xb97b('0x43')];return request({'method':'GET','uri':util[_0xb97b('0x1f')](_0xb97b('0x20'),_0x5400a4[_0xb97b('0x21')]),'qs':{'operation':'getchallenge','username':_0x2e08fb},'json':!![]})[_0xb97b('0x25')](function(_0x2a7769){if(_0x2a7769['success']){return request({'method':'POST','uri':util['format'](_0xb97b('0x20'),_0x5400a4[_0xb97b('0x21')]),'form':{'operation':_0xb97b('0x44'),'username':_0x2e08fb,'accessKey':md5(_0x2a7769['result'][_0xb97b('0x45')]+_0x1af255)},'json':!![]});}})[_0xb97b('0x25')](function(_0x5a0e4b){if(_0x5a0e4b[_0xb97b('0x26')]){return BPromise[_0xb97b('0x27')](_0x5a0e4b[_0xb97b('0x34')]);}else{throw new Error(util[_0xb97b('0x1f')](_0xb97b('0x46'),_0x5400a4['id']));}})['catch'](function(_0x4ab8fd){var _0x4c2784=_0x4ab8fd[_0xb97b('0x2b')]||0x1f4;logger[_0xb97b('0x29')](_0xb97b('0x2c'),_0xb97b('0x47'),_0x4c2784,JSON['stringify'](_0x4ab8fd));});}function request(_0x5ad389){logger[_0xb97b('0x1a')](_0xb97b('0x48'),JSON['stringify'](_0x5ad389));return rp(_0x5ad389);}exports[_0xb97b('0x49')]=function(_0x24e692,_0xefdedb,_0x4c2c5b,_0x238cfb,_0x54c52f,_0x5bd4a3){var _0x30341a,_0x309e49,_0x37e303,_0x5ed7ed;_0x5bd4a3[_0xb97b('0x21')]=intUtil[_0xb97b('0x4a')](_0x5bd4a3[_0xb97b('0x21')]);if(_0x54c52f&&_0x54c52f[_0xb97b('0x4b')]){logger[_0xb97b('0x1a')](_0xb97b('0x4c'),_0xb97b('0x4d'));_0xefdedb[_0xb97b('0x4e')]=util[_0xb97b('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5bd4a3[_0xb97b('0x4f')],_0xefdedb[_0xb97b('0x50')],md5(_0xefdedb[_0xb97b('0x50')]));}else{_0xefdedb[_0xb97b('0x4e')]='';}return getConnection(_0x5bd4a3)[_0xb97b('0x25')](function(_0x9cf92b){_0x5ed7ed=_0x9cf92b;return getUser(_0x5bd4a3,_0x238cfb[_0xb97b('0x51')],_0x5ed7ed);})[_0xb97b('0x25')](function(_0x2196e9){_0x30341a=_0x2196e9;logger[_0xb97b('0x1a')](_0xb97b('0x52'),_0x30341a['id']);return getEndUser(_0x5bd4a3,_0xefdedb[_0xb97b('0x53')],_0xefdedb[_0xb97b('0x54')],_0x5ed7ed);})[_0xb97b('0x25')](function(_0x36c491){_0x309e49=_0x36c491;logger['info'](_0xb97b('0x55'),_0x309e49['id']);return createTicket(_0x5bd4a3,_0x30341a,_0x309e49,_0x4c2c5b,_0xefdedb,_0x4c2c5b[_0xb97b('0x56')],_0x5ed7ed);})[_0xb97b('0x25')](function(_0x4d9d1f){_0x37e303=_0x4d9d1f;logger['info'](_0xb97b('0x57'));logger[_0xb97b('0x1a')](_0xb97b('0x58'),_0x37e303['id']);var _0x5d0266=util[_0xb97b('0x1f')](_0xb97b('0x59'),_0x5bd4a3[_0xb97b('0x21')],_['split'](_0x37e303['id'],'x')[0x1]);logger[_0xb97b('0x1a')](_0xb97b('0x4c'),_0xb97b('0x5a'));emit(util[_0xb97b('0x1f')](_0xb97b('0x5b'),_0x238cfb[_0xb97b('0x18')]),_0xb97b('0x5c'),{'uri':_0x5d0266});})[_0xb97b('0x2a')](function(_0x32acb1){logger['error'](_0xb97b('0x4c'),JSON[_0xb97b('0x28')](_0x32acb1));});};exports[_0xb97b('0x5d')]=function(_0x20d6bb,_0x1049a9,_0x515717,_0x1c9fc9,_0x530fcf,_0x183bc1,_0x1c6cf7){var _0x2bf861,_0x250800,_0x5795d4,_0xd2c077;_0x183bc1[_0xb97b('0x21')]=intUtil[_0xb97b('0x4a')](_0x183bc1[_0xb97b('0x21')]);_0x183bc1[_0xb97b('0x4f')]=intUtil[_0xb97b('0x4a')](_0x183bc1[_0xb97b('0x4f')]);if(_0x1c6cf7&&_0x1c6cf7[_0xb97b('0x5e')]&&_0x1c6cf7[_0xb97b('0x5e')]!=='none'){logger[_0xb97b('0x1a')]('[OUTBOUND]',_0xb97b('0x4d'));_0x1049a9[_0xb97b('0x4e')]=util[_0xb97b('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x183bc1[_0xb97b('0x4f')],_0x1049a9[_0xb97b('0x50')],md5(_0x1049a9['uniqueid']));}return getConnection(_0x183bc1)[_0xb97b('0x25')](function(_0x38ca8d){_0xd2c077=_0x38ca8d;return getUser(_0x183bc1,_0x1c9fc9[_0xb97b('0x51')],_0xd2c077);})[_0xb97b('0x25')](function(_0x297252){_0x2bf861=_0x297252;logger[_0xb97b('0x1a')](_0xb97b('0x52'),_0x2bf861['id']);return getEndUser(_0x183bc1,_0x1049a9['destcalleridname'],_0x1049a9[_0xb97b('0x5f')],_0xd2c077);})[_0xb97b('0x25')](function(_0x4a52c5){_0x250800=_0x4a52c5;logger[_0xb97b('0x1a')](_0xb97b('0x55'),_0x250800['id']);return createTicket(_0x183bc1,_0x2bf861,_0x250800,_0x515717,_0x1049a9,_0x515717[_0xb97b('0x56')],_0xd2c077);})[_0xb97b('0x25')](function(_0x1844a8){_0x5795d4=_0x1844a8;logger[_0xb97b('0x1a')]('Ticket\x20created!');logger[_0xb97b('0x1a')](_0xb97b('0x58'),_0x5795d4['id']);var _0x2f4a73=util[_0xb97b('0x1f')](_0xb97b('0x59'),_0x183bc1[_0xb97b('0x21')],_[_0xb97b('0x60')](_0x5795d4['id'],'x')[0x1]);logger[_0xb97b('0x1a')](_0xb97b('0x61'),_0xb97b('0x5a'));emit(util[_0xb97b('0x1f')](_0xb97b('0x5b'),_0x1c9fc9[_0xb97b('0x18')]),'trigger:browser:url',{'uri':_0x2f4a73});})['catch'](function(_0x3a25eb){logger[_0xb97b('0x29')](_0xb97b('0x61'),JSON['stringify'](_0x3a25eb));});};exports[_0xb97b('0x62')]=function(_0x31a59b,_0x250d76,_0x49b362,_0x20d6cf,_0x58692f,_0x208ae4){var _0x12517f,_0x2778d7,_0x175caf,_0x2fe0de;_0x208ae4[_0xb97b('0x21')]=intUtil[_0xb97b('0x4a')](_0x208ae4[_0xb97b('0x21')]);_0x208ae4[_0xb97b('0x4f')]=intUtil['stripTrailingSlash'](_0x208ae4['serverUrl']);if(_0x58692f&&_0x58692f[_0xb97b('0x4b')]){logger[_0xb97b('0x1a')]('['+_0x250d76[_0xb97b('0x63')][_0xb97b('0x64')]()+']',_0xb97b('0x4d'));_0x250d76[_0xb97b('0x4e')]=util[_0xb97b('0x1f')](_0xb97b('0x65'),_0x208ae4[_0xb97b('0x4f')],_0x250d76[_0xb97b('0x50')],md5(_0x250d76[_0xb97b('0x50')]));}else{_0x250d76[_0xb97b('0x4e')]='';}return getConnection(_0x208ae4)[_0xb97b('0x25')](function(_0x4dd719){_0x2fe0de=_0x4dd719;return getUser(_0x208ae4,'',_0x2fe0de);})[_0xb97b('0x25')](function(_0x273d22){_0x12517f=_0x273d22;logger['info']('The\x20User\x20ID\x20is:',_0x12517f['id']);return getEndUser(_0x208ae4,_0x250d76[_0xb97b('0x53')],_0x250d76[_0xb97b('0x54')],_0x2fe0de);})['then'](function(_0x19486a){_0x2778d7=_0x19486a;logger[_0xb97b('0x1a')](_0xb97b('0x55'),_0x2778d7['id']);return createTicket(_0x208ae4,_0x12517f,_0x2778d7,_0x49b362,_0x250d76,_0x49b362[_0xb97b('0x56')],_0x2fe0de);})[_0xb97b('0x25')](function(_0x25e905){_0x175caf=_0x25e905;logger[_0xb97b('0x1a')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x175caf['id']);})['catch'](function(_0x1b507c){logger[_0xb97b('0x29')]('['+_0x250d76['lastevent'][_0xb97b('0x64')]()+']',JSON[_0xb97b('0x28')](_0x1b507c));});}; \ No newline at end of file +var _0x3e41=['ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','defaults','redis','emit','length','includes','picklist','idField','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','Descriptions','POST','format','create','sessionName','HelpDesk','stringify','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','remoteUri','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','getEndUser','accessKey','getchallenge','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','outbound','stripTrailingSlash','serverUrl','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','unmanaged','lastevent','toUpperCase','recordingURL','lodash','request-promise','bluebird','md5','util'];(function(_0x1b3115,_0xd3aa16){var _0x544296=function(_0x301c7a){while(--_0x301c7a){_0x1b3115['push'](_0x1b3115['shift']());}};_0x544296(++_0xd3aa16);}(_0x3e41,0x67));var _0x13e4=function(_0x485eb8,_0x171720){_0x485eb8=_0x485eb8-0x0;var _0x55dfcb=_0x3e41[_0x485eb8];return _0x55dfcb;};'use strict';var _=require(_0x13e4('0x0'));var rp=require(_0x13e4('0x1'));var BPromise=require(_0x13e4('0x2'));var md5=require(_0x13e4('0x3'));var util=require(_0x13e4('0x4'));var Redis=require(_0x13e4('0x5'));var intUtil=require(_0x13e4('0x6'));var config=require(_0x13e4('0x7'));var logger=require(_0x13e4('0x8'))(_0x13e4('0x9'));config['redis']=_[_0x13e4('0xa')](config[_0x13e4('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x2aeb29,_0x2070c6,_0x571d59){io['to'](_0x2aeb29)[_0x13e4('0xc')](_0x2070c6,_0x571d59);}function getCustomFields(_0xbafc04,_0x4eb14e){var _0x1b7b4d={};if(_0xbafc04[_0x13e4('0xd')]>0x0){_['forEach'](_0xbafc04,function(_0x168c8b){if(_[_0x13e4('0xe')](['string',_0x13e4('0xf')],_0x168c8b['type'])&&_0x168c8b['idField']){_0x1b7b4d[_0x168c8b[_0x13e4('0x10')]]=_0x168c8b['content'][_0x13e4('0x11')]();}else if(_0x168c8b[_0x13e4('0x12')]===_0x13e4('0x13')&&_0x168c8b[_0x13e4('0x14')]&&_0x168c8b[_0x13e4('0x10')]&&_0x4eb14e[_0x168c8b[_0x13e4('0x14')]]){_0x1b7b4d[_0x168c8b['idField']]=_0x4eb14e[_0x168c8b['variableName']][_0x13e4('0x11')]();}else if(_0x168c8b[_0x13e4('0x12')]===_0x13e4('0x15')&&_0x168c8b[_0x13e4('0x16')]&&_0x168c8b[_0x13e4('0x16')][_0x13e4('0x17')]&&_0x168c8b[_0x13e4('0x10')]&&_0x4eb14e[_0x168c8b[_0x13e4('0x16')][_0x13e4('0x17')][_0x13e4('0x18')]()]){_0x1b7b4d[_0x168c8b[_0x13e4('0x10')]]=_0x4eb14e[_0x168c8b['Variable'][_0x13e4('0x17')][_0x13e4('0x18')]()][_0x13e4('0x11')]();}});}return _0x1b7b4d;}function createTicket(_0x3a101f,_0x329be9,_0x37639c,_0x34c1ab,_0x13823b,_0x4d4249,_0x5cee8f){logger[_0x13e4('0x19')](_0x13e4('0x1a'));var _0x5235e9=_[_0x13e4('0x1b')]({'parent_id':'','assigned_user_id':_0x329be9['id'],'ticketpriorities':_0x13e4('0x1c'),'ticketstatus':_0x13e4('0x1d'),'ticket_title':intUtil[_0x13e4('0x1e')](_0x34c1ab[_0x13e4('0x1f')],_0x13823b,'\x20'),'description':intUtil[_0x13e4('0x1e')](_0x34c1ab[_0x13e4('0x20')],_0x13823b,'\x0a'),'contact_id':_0x37639c['id']},getCustomFields(_0x4d4249,_0x13823b));var _0x2ff076={'method':_0x13e4('0x21'),'uri':util[_0x13e4('0x22')]('%s/webservice.php',_0x3a101f['remoteUri']),'form':{'operation':_0x13e4('0x23'),'username':_0x3a101f['username'],'sessionName':_0x5cee8f[_0x13e4('0x24')],'elementType':_0x13e4('0x25'),'element':JSON[_0x13e4('0x26')](_0x5235e9)},'json':!![]};return request(_0x2ff076)[_0x13e4('0x27')](function(_0x44c390){if(_0x44c390[_0x13e4('0x28')]){return BPromise[_0x13e4('0x29')]({'id':_0x44c390[_0x13e4('0x2a')]['id']});}else{throw new Error(util[_0x13e4('0x22')](_0x13e4('0x2b'),JSON[_0x13e4('0x26')](_0x44c390[_0x13e4('0x2c')])));}})[_0x13e4('0x2d')](function(_0x3fab54){var _0x9e6dc1=_0x3fab54[_0x13e4('0x2e')]||0x1f4;logger['error'](_0x13e4('0x2f'),_0x13e4('0x30'),_0x9e6dc1,JSON[_0x13e4('0x26')](_0x3fab54));});}function getUser(_0x130d7d,_0x21559e,_0x7206c2){if(intUtil[_0x13e4('0x31')](_0x21559e)){logger[_0x13e4('0x19')](_0x13e4('0x32'),_0x21559e);return request({'method':_0x13e4('0x33'),'uri':util[_0x13e4('0x22')](_0x13e4('0x34'),_0x130d7d['remoteUri']),'qs':{'operation':_0x13e4('0x35'),'username':_0x130d7d[_0x13e4('0x36')],'sessionName':_0x7206c2['sessionName'],'query':util[_0x13e4('0x22')](_0x13e4('0x37'),_0x21559e)},'json':!![]})[_0x13e4('0x27')](function(_0x5daa21){if(_0x5daa21[_0x13e4('0x28')]&&_0x5daa21['result'][_0x13e4('0xd')]){logger[_0x13e4('0x19')](_0x13e4('0x38'));return BPromise[_0x13e4('0x29')]({'id':_0x5daa21[_0x13e4('0x2a')][0x0]['id'],'email':_0x5daa21[_0x13e4('0x2a')][0x0][_0x13e4('0x39')],'name':_0x5daa21[_0x13e4('0x2a')][0x0][_0x13e4('0x3a')]+'\x20'+_0x5daa21[_0x13e4('0x2a')][_0x13e4('0x3b')]});}else{logger[_0x13e4('0x19')](_0x13e4('0x3c'));return BPromise[_0x13e4('0x29')]({'id':_0x7206c2[_0x13e4('0x3d')],'email':_0x130d7d[_0x13e4('0x36')],'name':'admin'});}})[_0x13e4('0x2d')](function(_0x48898e){var _0x39743f=_0x48898e[_0x13e4('0x2e')]||0x1f4;logger['error'](_0x13e4('0x2f'),_0x13e4('0x3e'),_0x39743f,JSON[_0x13e4('0x26')](_0x48898e));});}else{logger[_0x13e4('0x19')](_0x13e4('0x3c'));return BPromise['resolve']({'id':_0x7206c2[_0x13e4('0x3d')],'email':_0x130d7d[_0x13e4('0x36')],'name':_0x13e4('0x3f')})[_0x13e4('0x2d')](function(_0x57404e){var _0x23b55a=_0x57404e['statusCode']||0x1f4;logger[_0x13e4('0x2c')](_0x13e4('0x2f'),_0x13e4('0x3e'),_0x23b55a,JSON[_0x13e4('0x26')](_0x57404e));});}}function getEndUser(_0x6ec76f,_0xf36683,_0x558319,_0x29b884){logger[_0x13e4('0x19')](_0x13e4('0x40'),_0x558319);return request({'method':_0x13e4('0x33'),'uri':util[_0x13e4('0x22')](_0x13e4('0x34'),_0x6ec76f[_0x13e4('0x41')]),'qs':{'operation':_0x13e4('0x35'),'username':_0x6ec76f[_0x13e4('0x36')],'sessionName':_0x29b884[_0x13e4('0x24')],'query':util[_0x13e4('0x22')]('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;',_0x558319,_0x558319,_0x558319,_0x558319,_0x558319)},'json':!![]})[_0x13e4('0x27')](function(_0x585999){if(_0x585999['success']&&_0x585999[_0x13e4('0x2a')]['length']){logger[_0x13e4('0x19')](_0x13e4('0x42'));return BPromise['resolve']({'id':_0x585999[_0x13e4('0x2a')][0x0]['id'],'name':_0x585999[_0x13e4('0x2a')][0x0][_0x13e4('0x43')]+'\x20'+_0x585999[_0x13e4('0x2a')][0x0][_0x13e4('0x44')],'phone':_0x558319});}else{logger[_0x13e4('0x19')](_0x13e4('0x45'));return request({'method':'POST','uri':util[_0x13e4('0x22')](_0x13e4('0x34'),_0x6ec76f[_0x13e4('0x41')]),'form':{'operation':_0x13e4('0x23'),'sessionName':_0x29b884[_0x13e4('0x24')],'elementType':_0x13e4('0x46'),'element':JSON[_0x13e4('0x26')]({'lastname':_0xf36683,'phone':_0x558319,'assigned_user_id':'\x20'})},'json':!![]})[_0x13e4('0x27')](function(_0x4a1d0a){logger[_0x13e4('0x19')]('Enduser\x20created.');return BPromise[_0x13e4('0x29')]({'id':_0x4a1d0a[_0x13e4('0x2a')]['id'],'name':_0x4a1d0a[_0x13e4('0x2a')][_0x13e4('0x44')],'phone':_0x4a1d0a[_0x13e4('0x2a')][_0x13e4('0x47')]});})[_0x13e4('0x2d')](function(_0x3efc5f){var _0x201825=_0x3efc5f[_0x13e4('0x2e')]||0x1f4;logger[_0x13e4('0x2c')](_0x13e4('0x2f'),_0x13e4('0x48'),_0x201825,JSON['stringify'](_0x3efc5f));});}});}function getConnection(_0x5f762f){var _0x585f85=_0x5f762f[_0x13e4('0x36')];var _0x1aedb5=_0x5f762f[_0x13e4('0x49')];return request({'method':_0x13e4('0x33'),'uri':util[_0x13e4('0x22')](_0x13e4('0x34'),_0x5f762f[_0x13e4('0x41')]),'qs':{'operation':_0x13e4('0x4a'),'username':_0x585f85},'json':!![]})[_0x13e4('0x27')](function(_0x326b36){if(_0x326b36[_0x13e4('0x28')]){return request({'method':'POST','uri':util[_0x13e4('0x22')](_0x13e4('0x34'),_0x5f762f[_0x13e4('0x41')]),'form':{'operation':_0x13e4('0x4b'),'username':_0x585f85,'accessKey':md5(_0x326b36[_0x13e4('0x2a')]['token']+_0x1aedb5)},'json':!![]});}})[_0x13e4('0x27')](function(_0xcd2baa){if(_0xcd2baa['success']){return BPromise['resolve'](_0xcd2baa['result']);}else{throw new Error(util[_0x13e4('0x22')](_0x13e4('0x4c'),_0x5f762f['id']));}})['catch'](function(_0xe2c9b8){var _0x2215d5=_0xe2c9b8[_0x13e4('0x2e')]||0x1f4;logger[_0x13e4('0x2c')](_0x13e4('0x2f'),_0x13e4('0x4d'),_0x2215d5,JSON[_0x13e4('0x26')](_0xe2c9b8));});}function request(_0x450a0f){logger[_0x13e4('0x19')](_0x13e4('0x4e'),JSON[_0x13e4('0x26')](_0x450a0f));return rp(_0x450a0f);}exports[_0x13e4('0x4f')]=function(_0x5a04f2,_0x273466,_0xa444ca,_0x555f8e,_0xd173b1,_0x4cb265){var _0x50b687,_0x2b8703,_0x11fc4e,_0x9622d4;_0x4cb265['remoteUri']=intUtil['stripTrailingSlash'](_0x4cb265[_0x13e4('0x41')]);if(_0xd173b1&&_0xd173b1[_0x13e4('0x50')]){logger[_0x13e4('0x19')](_0x13e4('0x51'),_0x13e4('0x52'));_0x273466['recordingURL']=util[_0x13e4('0x22')](_0x13e4('0x53'),_0x4cb265['serverUrl'],_0x273466[_0x13e4('0x54')],md5(_0x273466[_0x13e4('0x54')]));}else{_0x273466['recordingURL']='';}return getConnection(_0x4cb265)[_0x13e4('0x27')](function(_0x3479e4){_0x9622d4=_0x3479e4;return getUser(_0x4cb265,_0x555f8e[_0x13e4('0x55')],_0x9622d4);})[_0x13e4('0x27')](function(_0x25644f){_0x50b687=_0x25644f;logger['info'](_0x13e4('0x56'),_0x50b687['id']);return getEndUser(_0x4cb265,_0x273466[_0x13e4('0x57')],_0x273466[_0x13e4('0x58')],_0x9622d4);})[_0x13e4('0x27')](function(_0x24d4c1){_0x2b8703=_0x24d4c1;logger[_0x13e4('0x19')](_0x13e4('0x59'),_0x2b8703['id']);return createTicket(_0x4cb265,_0x50b687,_0x2b8703,_0xa444ca,_0x273466,_0xa444ca[_0x13e4('0x5a')],_0x9622d4);})[_0x13e4('0x27')](function(_0x5f4283){_0x11fc4e=_0x5f4283;logger[_0x13e4('0x19')]('Ticket\x20created!');logger[_0x13e4('0x19')]('The\x20Ticket\x20ID\x20is:',_0x11fc4e['id']);var _0x543d37=util[_0x13e4('0x22')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4cb265[_0x13e4('0x41')],_[_0x13e4('0x5b')](_0x11fc4e['id'],'x')[0x1]);logger[_0x13e4('0x19')](_0x13e4('0x51'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x13e4('0x22')]('user:%s',_0x555f8e['name']),_0x13e4('0x5c'),{'uri':_0x543d37});})['catch'](function(_0x32bd36){logger[_0x13e4('0x2c')]('[QUEUE]',JSON['stringify'](_0x32bd36));});};exports[_0x13e4('0x5d')]=function(_0x812025,_0x50f55b,_0x3f5b0e,_0x5328a8,_0x222ec4,_0x49db95,_0x401ec2){var _0x5ec88b,_0x1c94ce,_0x1e1b22,_0x340bc0;_0x49db95[_0x13e4('0x41')]=intUtil[_0x13e4('0x5e')](_0x49db95[_0x13e4('0x41')]);_0x49db95[_0x13e4('0x5f')]=intUtil[_0x13e4('0x5e')](_0x49db95[_0x13e4('0x5f')]);if(_0x401ec2&&_0x401ec2[_0x13e4('0x60')]&&_0x401ec2['recordingFormat']!=='none'){logger[_0x13e4('0x19')](_0x13e4('0x61'),_0x13e4('0x52'));_0x50f55b['recordingURL']=util[_0x13e4('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x49db95['serverUrl'],_0x50f55b[_0x13e4('0x54')],md5(_0x50f55b[_0x13e4('0x54')]));}return getConnection(_0x49db95)[_0x13e4('0x27')](function(_0x57eabb){_0x340bc0=_0x57eabb;return getUser(_0x49db95,_0x5328a8[_0x13e4('0x55')],_0x340bc0);})['then'](function(_0x4b8d29){_0x5ec88b=_0x4b8d29;logger[_0x13e4('0x19')](_0x13e4('0x56'),_0x5ec88b['id']);return getEndUser(_0x49db95,_0x50f55b[_0x13e4('0x62')],_0x50f55b[_0x13e4('0x63')],_0x340bc0);})[_0x13e4('0x27')](function(_0x4a0a57){_0x1c94ce=_0x4a0a57;logger[_0x13e4('0x19')](_0x13e4('0x59'),_0x1c94ce['id']);return createTicket(_0x49db95,_0x5ec88b,_0x1c94ce,_0x3f5b0e,_0x50f55b,_0x3f5b0e['Fields'],_0x340bc0);})[_0x13e4('0x27')](function(_0x3283b7){_0x1e1b22=_0x3283b7;logger[_0x13e4('0x19')](_0x13e4('0x64'));logger[_0x13e4('0x19')](_0x13e4('0x65'),_0x1e1b22['id']);var _0x5e9def=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x49db95[_0x13e4('0x41')],_[_0x13e4('0x5b')](_0x1e1b22['id'],'x')[0x1]);logger[_0x13e4('0x19')]('[OUTBOUND]',_0x13e4('0x66'));emit(util['format'](_0x13e4('0x67'),_0x5328a8[_0x13e4('0x17')]),_0x13e4('0x5c'),{'uri':_0x5e9def});})[_0x13e4('0x2d')](function(_0x4e0033){logger[_0x13e4('0x2c')](_0x13e4('0x61'),JSON[_0x13e4('0x26')](_0x4e0033));});};exports[_0x13e4('0x68')]=function(_0x5624bd,_0x2aa4a3,_0x3ae90d,_0x300d01,_0x4f3a7f,_0x3c1a02){var _0x2ce2fb,_0x6093e2,_0x56fa78,_0x3b3612;_0x3c1a02[_0x13e4('0x41')]=intUtil['stripTrailingSlash'](_0x3c1a02[_0x13e4('0x41')]);_0x3c1a02[_0x13e4('0x5f')]=intUtil[_0x13e4('0x5e')](_0x3c1a02['serverUrl']);if(_0x4f3a7f&&_0x4f3a7f[_0x13e4('0x50')]){logger[_0x13e4('0x19')]('['+_0x2aa4a3[_0x13e4('0x69')][_0x13e4('0x6a')]()+']',_0x13e4('0x52'));_0x2aa4a3[_0x13e4('0x6b')]=util['format'](_0x13e4('0x53'),_0x3c1a02[_0x13e4('0x5f')],_0x2aa4a3[_0x13e4('0x54')],md5(_0x2aa4a3[_0x13e4('0x54')]));}else{_0x2aa4a3[_0x13e4('0x6b')]='';}return getConnection(_0x3c1a02)['then'](function(_0x2686e3){_0x3b3612=_0x2686e3;return getUser(_0x3c1a02,'',_0x3b3612);})[_0x13e4('0x27')](function(_0x288851){_0x2ce2fb=_0x288851;logger[_0x13e4('0x19')](_0x13e4('0x56'),_0x2ce2fb['id']);return getEndUser(_0x3c1a02,_0x2aa4a3[_0x13e4('0x57')],_0x2aa4a3[_0x13e4('0x58')],_0x3b3612);})[_0x13e4('0x27')](function(_0x3f3f3e){_0x6093e2=_0x3f3f3e;logger['info'](_0x13e4('0x59'),_0x6093e2['id']);return createTicket(_0x3c1a02,_0x2ce2fb,_0x6093e2,_0x3ae90d,_0x2aa4a3,_0x3ae90d[_0x13e4('0x5a')],_0x3b3612);})[_0x13e4('0x27')](function(_0x44eaf5){_0x56fa78=_0x44eaf5;logger[_0x13e4('0x19')]('Ticket\x20created!');logger[_0x13e4('0x19')]('The\x20Ticket\x20ID\x20is:',_0x56fa78['id']);})['catch'](function(_0x8c90d4){logger[_0x13e4('0x2c')]('['+_0x2aa4a3['lastevent'][_0x13e4('0x6a')]()+']',JSON['stringify'](_0x8c90d4));});}; \ 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 6cb094d..4d186a4 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 _0x08de=['Agent\x20found!','find','results','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','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','%s:%s','username','password','authType','token','%s/token:%s','Basic\x20%s','base64','debug','[HTTP]','stringify','length','map','forEach','includes','string','type','nameField','customField','toLowerCase','content','toString','idField','custom_fields','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','none','[OUTBOUND]','recordingURL','Authorization','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','emit','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','name','getString','Descriptions','then','info','Ticket\x20created!','ticket','validateEmail','%s/search.json','type:user\x20role:agent\x20email:%s','count'];(function(_0x197065,_0x2e79d0){var _0x3d9404=function(_0xf582a7){while(--_0xf582a7){_0x197065['push'](_0x197065['shift']());}};_0x3d9404(++_0x2e79d0);}(_0x08de,0xcc));var _0xe08d=function(_0x5e8c32,_0x1b1f3f){_0x5e8c32=_0x5e8c32-0x0;var _0x595f7b=_0x08de[_0x5e8c32];return _0x595f7b;};'use strict';var _=require(_0xe08d('0x0'));var rp=require(_0xe08d('0x1'));var md5=require('md5');var util=require(_0xe08d('0x2'));var Redis=require(_0xe08d('0x3'));var intUtil=require(_0xe08d('0x4'));var config=require(_0xe08d('0x5'));var logger=require(_0xe08d('0x6'))('zendesk');config['redis']=_[_0xe08d('0x7')](config[_0xe08d('0x8')],{'host':_0xe08d('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe08d('0x8')]));function emit(_0x896deb,_0x3e582a,_0x31bd2c){io['to'](_0x896deb)[_0xe08d('0xa')](_0x3e582a,_0x31bd2c);}var headers={'Content-Type':'application/json','Accept':_0xe08d('0xb')};function getTicket(_0x5bb3b4,_0x417847,_0x252b48,_0x4de5ed,_0x46f7bb){logger['info'](_0xe08d('0xc'));return request({'uri':util[_0xe08d('0xd')](_0xe08d('0xe'),_0x5bb3b4[_0xe08d('0xf')]),'method':'POST','body':{'ticket':_[_0xe08d('0x10')]({'requester_id':_0x252b48['id'],'submitter_id':_0x417847?_0x417847['id']:undefined,'assignee_id':_0x417847?_0x417847['id']:undefined,'tags':getTags(_0x4de5ed['Tags'],_0xe08d('0x11')),'subject':intUtil['getString'](_0x4de5ed['Subjects'],_0x46f7bb,'\x20'),'description':intUtil[_0xe08d('0x12')](_0x4de5ed[_0xe08d('0x13')],_0x46f7bb,'\x0a'),'comment':{'public':![],'body':intUtil[_0xe08d('0x12')](_0x4de5ed[_0xe08d('0x13')],_0x46f7bb,'\x0a')}},getCustomFields(_0x4de5ed['Fields'],_0x46f7bb))}})[_0xe08d('0x14')](function(_0x45166c){logger[_0xe08d('0x15')](_0xe08d('0x16'));return _0x45166c[_0xe08d('0x17')];});}function getUser(_0x1e7a1b,_0x4b2806){if(intUtil[_0xe08d('0x18')](_0x4b2806)){logger[_0xe08d('0x15')]('Getting\x20agent\x20with\x20email',_0x4b2806);return request({'uri':util['format'](_0xe08d('0x19'),_0x1e7a1b['remoteUri']),'qs':{'query':util[_0xe08d('0xd')](_0xe08d('0x1a'),_0x4b2806)}})[_0xe08d('0x14')](function(_0x2f338a){if(_0x2f338a[_0xe08d('0x1b')]){logger[_0xe08d('0x15')](_0xe08d('0x1c'));return _[_0xe08d('0x1d')](_0x2f338a[_0xe08d('0x1e')],{'email':_0x4b2806,'role':_0xe08d('0x1f')});}else{logger[_0xe08d('0x15')](_0xe08d('0x20'));return request({'uri':util['format'](_0xe08d('0x21'),_0x1e7a1b[_0xe08d('0xf')])})[_0xe08d('0x14')](function(_0x34600e){logger[_0xe08d('0x15')](_0xe08d('0x22'));return _0x34600e['user'];});}});}else{logger[_0xe08d('0x15')](_0xe08d('0x20'));return request({'uri':util[_0xe08d('0xd')](_0xe08d('0x21'),_0x1e7a1b[_0xe08d('0xf')])})['then'](function(_0x1e7352){logger[_0xe08d('0x15')](_0xe08d('0x22'));return _0x1e7352[_0xe08d('0x23')];});}}function getEndUser(_0x4791b1,_0x5455a9,_0x1fe4e8){logger['info'](_0xe08d('0x24'),_0x1fe4e8);return request({'uri':util['format']('%s/search.json',_0x4791b1[_0xe08d('0xf')]),'qs':{'query':util[_0xe08d('0xd')](_0xe08d('0x25'),_0x1fe4e8)}})[_0xe08d('0x14')](function(_0x34ea19){var _0x452f1e;if(_0x34ea19[_0xe08d('0x1e')]['length']){_0x34ea19[_0xe08d('0x1e')]=_[_0xe08d('0x26')](_0x34ea19[_0xe08d('0x1e')],{'suspended':![],'role':_0xe08d('0x27')});if(_0x34ea19[_0xe08d('0x1e')]['length']){_0x452f1e=_[_0xe08d('0x28')](_0x34ea19['results']);}}if(_0x452f1e){logger[_0xe08d('0x15')](_0xe08d('0x29'));return _0x452f1e;}else{logger[_0xe08d('0x15')](_0xe08d('0x2a'));return request({'uri':util[_0xe08d('0xd')](_0xe08d('0x2b'),_0x4791b1[_0xe08d('0xf')]),'method':_0xe08d('0x2c'),'body':{'user':{'role':'end-user','name':util[_0xe08d('0xd')](_0xe08d('0x2d'),_0x5455a9||_0x1fe4e8),'phone':_0x1fe4e8}}})['then'](function(_0xdfb452){logger[_0xe08d('0x15')](_0xe08d('0x2e'));return _0xdfb452['user'];});}});}function getAuth(_0xc11ea0){var _0x111d9e;if(_0xc11ea0['authType']==='password'){_0x111d9e=util[_0xe08d('0xd')](_0xe08d('0x2f'),_0xc11ea0[_0xe08d('0x30')],_0xc11ea0[_0xe08d('0x31')]);}else if(_0xc11ea0[_0xe08d('0x32')]===_0xe08d('0x33')){_0x111d9e=util[_0xe08d('0xd')](_0xe08d('0x34'),_0xc11ea0[_0xe08d('0x30')],_0xc11ea0[_0xe08d('0x33')]);}return util['format'](_0xe08d('0x35'),new Buffer(_0x111d9e)['toString'](_0xe08d('0x36')));}function request(_0x3a65e9){logger[_0xe08d('0x37')](_0xe08d('0x38'),JSON[_0xe08d('0x39')](_0x3a65e9));return rp(_[_0xe08d('0x7')](_0x3a65e9,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x48ddb2,_0x2d1e91){var _0x1145ca=[];if(_0x48ddb2&&_0x48ddb2[_0xe08d('0x3a')]>0x0){_0x1145ca=_[_0xe08d('0x3b')](_0x48ddb2,_0x2d1e91);}return _0x1145ca;}function getCustomFields(_0x2b2a7c,_0x2897aa){var _0x4f4f9e=[];var _0x3831e9={'custom_fields':[]};if(_0x2b2a7c[_0xe08d('0x3a')]>0x0){_[_0xe08d('0x3c')](_0x2b2a7c,function(_0x590187){if(_[_0xe08d('0x3d')]([_0xe08d('0x3e'),'picklist'],_0x590187[_0xe08d('0x3f')])&&_0x590187[_0xe08d('0x40')]&&!_0x590187[_0xe08d('0x41')]){_0x3831e9[_0x590187['nameField'][_0xe08d('0x42')]()]=_0x590187[_0xe08d('0x43')][_0xe08d('0x44')]();}else if(_['includes'](['string','picklist'],_0x590187[_0xe08d('0x3f')])&&_0x590187[_0xe08d('0x45')]&&_0x590187[_0xe08d('0x41')]){_0x3831e9[_0xe08d('0x46')][_0xe08d('0x47')]({'id':_0x590187[_0xe08d('0x45')],'value':_0x590187['content'][_0xe08d('0x44')]()});}else if(_0x590187[_0xe08d('0x3f')]===_0xe08d('0x48')&&_0x590187['variableName']&&_0x590187[_0xe08d('0x45')]&&_0x590187[_0xe08d('0x41')]){_0x2897aa[_0x590187[_0xe08d('0x49')]]&&_0x3831e9[_0xe08d('0x46')][_0xe08d('0x47')]({'id':_0x590187['idField'],'value':_0x2897aa[_0x590187[_0xe08d('0x49')]][_0xe08d('0x44')]()});}else if(_0x590187[_0xe08d('0x3f')]===_0xe08d('0x4a')&&_0x590187['Variable']&&_0x590187[_0xe08d('0x4b')][_0xe08d('0x11')]&&_0x590187['idField']&&_0x590187[_0xe08d('0x41')]){_0x2897aa[_0x590187[_0xe08d('0x4b')][_0xe08d('0x11')][_0xe08d('0x42')]()]&&_0x3831e9[_0xe08d('0x46')][_0xe08d('0x47')]({'id':_0x590187[_0xe08d('0x45')],'value':_0x2897aa[_0x590187[_0xe08d('0x4b')][_0xe08d('0x11')]['toLowerCase']()][_0xe08d('0x44')]()});}});}return _0x3831e9;}exports[_0xe08d('0x4c')]=function(_0xf303ab,_0x4494df,_0x533680,_0x58c527,_0x1c2d73,_0x179183){var _0x657ef7,_0x5ab403;_0x179183['remoteUri']=intUtil[_0xe08d('0x4d')](_0x179183[_0xe08d('0xf')]);_0x179183[_0xe08d('0x4e')]=intUtil[_0xe08d('0x4d')](_0x179183['serverUrl']);if(_0x1c2d73&&_0x1c2d73['monitor_format']){logger['info'](_0xe08d('0x4f'),_0xe08d('0x50'));_0x4494df['recordingURL']=util[_0xe08d('0xd')](_0xe08d('0x51'),_0x179183['serverUrl'],_0x4494df[_0xe08d('0x52')],md5(_0x4494df[_0xe08d('0x52')]));}else{_0x4494df['recordingURL']='';}headers['Authorization']=getAuth(_0x179183);return getUser(_0x179183,_0x58c527[_0xe08d('0x53')])[_0xe08d('0x14')](function(_0x156f19){_0x657ef7=_0x156f19;logger[_0xe08d('0x15')](_0xe08d('0x54'),_0x657ef7['id']);return getEndUser(_0x179183,_0x4494df[_0xe08d('0x55')],_0x4494df[_0xe08d('0x56')]);})[_0xe08d('0x14')](function(_0x1d485a){_0x5ab403=_0x1d485a;logger['info'](_0xe08d('0x57'),_0x5ab403['id']);return getTicket(_0x179183,_0x657ef7,_0x5ab403,_0x533680,_0x4494df);})[_0xe08d('0x14')](function(_0x8f9192){if(_0x8f9192){logger[_0xe08d('0x15')](_0xe08d('0x58'),_0x8f9192['id']);switch(_0x179183[_0xe08d('0x3f')]){case _0xe08d('0x59'):logger['info'](_0xe08d('0x4f'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xe08d('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x179183[_0xe08d('0xf')],_0x657ef7['id'],_0x8f9192['id']),'method':'POST'});case _0xe08d('0x5a'):logger['info']('[QUEUE]',_0xe08d('0x5b'));emit(util[_0xe08d('0xd')](_0xe08d('0x5c'),_0x58c527[_0xe08d('0x11')]),_0xe08d('0x5d'),{'uri':util[_0xe08d('0xd')](_0xe08d('0x5e'),_0x179183['remoteUri'][_0xe08d('0x5f')](_0xe08d('0x60'),''),_0x8f9192['id'])});break;default:logger[_0xe08d('0x61')]('[QUEUE]',_0xe08d('0x62'));}}})['catch'](function(_0x40c278){logger[_0xe08d('0x61')](_0xe08d('0x63'),util[_0xe08d('0x64')](_0x40c278,{'showHidden':!![],'depth':null}));});};exports[_0xe08d('0x65')]=function(_0x123ad2,_0x295f25,_0x492baf,_0x425d0c,_0x3c107d,_0x5c341a,_0x7b36cc){var _0x4d19ee,_0x4cec22;_0x5c341a[_0xe08d('0xf')]=intUtil[_0xe08d('0x4d')](_0x5c341a[_0xe08d('0xf')]);_0x5c341a[_0xe08d('0x4e')]=intUtil[_0xe08d('0x4d')](_0x5c341a[_0xe08d('0x4e')]);if(_0x7b36cc&&_0x7b36cc['recordingFormat']&&_0x7b36cc['recordingFormat']!==_0xe08d('0x66')){logger['info'](_0xe08d('0x67'),'Recording\x20is\x20enabled!');_0x295f25[_0xe08d('0x68')]=util[_0xe08d('0xd')](_0xe08d('0x51'),_0x5c341a[_0xe08d('0x4e')],_0x295f25[_0xe08d('0x52')],md5(_0x295f25[_0xe08d('0x52')]));}headers[_0xe08d('0x69')]=getAuth(_0x5c341a);return getUser(_0x5c341a,_0x425d0c[_0xe08d('0x53')])[_0xe08d('0x14')](function(_0x548ca4){_0x4d19ee=_0x548ca4;logger[_0xe08d('0x15')](_0xe08d('0x54'),_0x4d19ee['id']);return getEndUser(_0x5c341a,_0x295f25[_0xe08d('0x6a')],_0x295f25[_0xe08d('0x6b')]);})[_0xe08d('0x14')](function(_0x34836f){_0x4cec22=_0x34836f;logger[_0xe08d('0x15')](_0xe08d('0x57'),_0x4cec22['id']);return getTicket(_0x5c341a,_0x4d19ee,_0x4cec22,_0x492baf,_0x295f25);})['then'](function(_0x390377){if(_0x390377){logger['info']('The\x20Ticket\x20ID\x20is:',_0x390377['id']);switch(_0x5c341a['type']){case'integrationTab':logger[_0xe08d('0x15')]('[OUTBOUND]',_0xe08d('0x6c'));return request({'uri':util[_0xe08d('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x5c341a[_0xe08d('0xf')],_0x4d19ee['id'],_0x390377['id']),'method':'POST'});case _0xe08d('0x5a'):logger['info']('[OUTBOUND]',_0xe08d('0x5b'));emit(util['format'](_0xe08d('0x5c'),_0x425d0c[_0xe08d('0x11')]),'trigger:browser:url',{'uri':util['format'](_0xe08d('0x5e'),_0x5c341a[_0xe08d('0xf')]['replace'](_0xe08d('0x60'),''),_0x390377['id'])});break;default:logger[_0xe08d('0x61')](_0xe08d('0x67'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xe08d('0x6d')](function(_0x5e250d){logger['error'](_0xe08d('0x6e'),util[_0xe08d('0x64')](_0x5e250d,{'showHidden':!![],'depth':null}));});};exports[_0xe08d('0x6f')]=function(_0x6c8ea1,_0x1ae8c7,_0x2b73ff,_0x4fee36,_0x1528bf,_0x3e1db6){var _0x1cdd79,_0x46a954;_0x3e1db6[_0xe08d('0xf')]=intUtil['stripTrailingSlash'](_0x3e1db6[_0xe08d('0xf')]);_0x3e1db6[_0xe08d('0x4e')]=intUtil[_0xe08d('0x4d')](_0x3e1db6[_0xe08d('0x4e')]);if(_0x1528bf&&_0x1528bf[_0xe08d('0x70')]){logger[_0xe08d('0x15')]('['+_0x1ae8c7[_0xe08d('0x71')][_0xe08d('0x72')]()+']',_0xe08d('0x50'));_0x1ae8c7[_0xe08d('0x68')]=util[_0xe08d('0xd')](_0xe08d('0x51'),_0x3e1db6[_0xe08d('0x4e')],_0x1ae8c7['uniqueid'],md5(_0x1ae8c7[_0xe08d('0x52')]));}else{_0x1ae8c7[_0xe08d('0x68')]='';}headers['Authorization']=getAuth(_0x3e1db6);return getUser(_0x3e1db6)[_0xe08d('0x14')](function(_0x2297fb){_0x1cdd79=_0x2297fb;logger['info'](_0xe08d('0x54'),_0x1cdd79['id']);return getEndUser(_0x3e1db6,_0x1ae8c7['calleridname'],_0x1ae8c7[_0xe08d('0x56')]);})[_0xe08d('0x14')](function(_0x277d00){_0x46a954=_0x277d00;logger[_0xe08d('0x15')](_0xe08d('0x57'),_0x46a954['id']);return getTicket(_0x3e1db6,_0x1cdd79,_0x46a954,_0x2b73ff,_0x1ae8c7);})[_0xe08d('0x14')](function(_0x35c3fa){if(_0x35c3fa){logger[_0xe08d('0x15')]('The\x20Ticket\x20ID\x20is:',_0x35c3fa['id']);}})[_0xe08d('0x6d')](function(_0x55bb5c){logger[_0xe08d('0x61')]('['+_0x1ae8c7[_0xe08d('0x71')]['toUpperCase']()+']'+_0xe08d('0x73'),util[_0xe08d('0x64')](_0x55bb5c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x95cd=['%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Descriptions','Fields','then','Ticket\x20created!','Getting\x20agent\x20with\x20email','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','forEach','includes','string','picklist','nameField','customField','type','idField','custom_fields','push','content','variable','customVariable','Variable','toLowerCase','queue','serverUrl','stripTrailingSlash','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','destcalleridnum','[OUTBOUND]','/api/v2','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','toUpperCase','Recording\x20is\x20enabled!','The\x20Ticket\x20ID\x20is:','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','application/json','info','Creating\x20new\x20ticket...','format'];(function(_0x31fc11,_0x2d3c80){var _0x35030f=function(_0x33c5ca){while(--_0x33c5ca){_0x31fc11['push'](_0x31fc11['shift']());}};_0x35030f(++_0x2d3c80);}(_0x95cd,0x132));var _0xd95c=function(_0x1a10b5,_0x409bbc){_0x1a10b5=_0x1a10b5-0x0;var _0x2d734f=_0x95cd[_0x1a10b5];return _0x2d734f;};'use strict';var _=require(_0xd95c('0x0'));var rp=require('request-promise');var md5=require(_0xd95c('0x1'));var util=require(_0xd95c('0x2'));var Redis=require('ioredis');var intUtil=require(_0xd95c('0x3'));var config=require(_0xd95c('0x4'));var logger=require(_0xd95c('0x5'))(_0xd95c('0x6'));config[_0xd95c('0x7')]=_['defaults'](config[_0xd95c('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd95c('0x7')]));function emit(_0x3c68af,_0x3e8f91,_0x4d88a3){io['to'](_0x3c68af)['emit'](_0x3e8f91,_0x4d88a3);}var headers={'Content-Type':_0xd95c('0x8'),'Accept':_0xd95c('0x8')};function getTicket(_0x540061,_0x1799e7,_0x324024,_0x4e106e,_0x13a99f){logger[_0xd95c('0x9')](_0xd95c('0xa'));return request({'uri':util[_0xd95c('0xb')](_0xd95c('0xc'),_0x540061[_0xd95c('0xd')]),'method':_0xd95c('0xe'),'body':{'ticket':_[_0xd95c('0xf')]({'requester_id':_0x324024['id'],'submitter_id':_0x1799e7?_0x1799e7['id']:undefined,'assignee_id':_0x1799e7?_0x1799e7['id']:undefined,'tags':getTags(_0x4e106e[_0xd95c('0x10')],_0xd95c('0x11')),'subject':intUtil[_0xd95c('0x12')](_0x4e106e['Subjects'],_0x13a99f,'\x20'),'description':intUtil['getString'](_0x4e106e['Descriptions'],_0x13a99f,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x4e106e[_0xd95c('0x13')],_0x13a99f,'\x0a')}},getCustomFields(_0x4e106e[_0xd95c('0x14')],_0x13a99f))}})[_0xd95c('0x15')](function(_0x16ae1c){logger[_0xd95c('0x9')](_0xd95c('0x16'));return _0x16ae1c['ticket'];});}function getUser(_0x341776,_0xab19c7){if(intUtil['validateEmail'](_0xab19c7)){logger['info'](_0xd95c('0x17'),_0xab19c7);return request({'uri':util[_0xd95c('0xb')]('%s/search.json',_0x341776[_0xd95c('0xd')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0xab19c7)}})[_0xd95c('0x15')](function(_0x560da1){if(_0x560da1[_0xd95c('0x18')]){logger['info'](_0xd95c('0x19'));return _[_0xd95c('0x1a')](_0x560da1[_0xd95c('0x1b')],{'email':_0xab19c7,'role':_0xd95c('0x1c')});}else{logger['info'](_0xd95c('0x1d'));return request({'uri':util['format']('%s/users/me.json',_0x341776['remoteUri'])})['then'](function(_0x118d58){logger[_0xd95c('0x9')](_0xd95c('0x1e'));return _0x118d58[_0xd95c('0x1f')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xd95c('0xb')]('%s/users/me.json',_0x341776['remoteUri'])})[_0xd95c('0x15')](function(_0x307989){logger[_0xd95c('0x9')](_0xd95c('0x1e'));return _0x307989[_0xd95c('0x1f')];});}}function getEndUser(_0xe78c5d,_0x19284b,_0x193896){logger[_0xd95c('0x9')](_0xd95c('0x20'),_0x193896);return request({'uri':util['format']('%s/search.json',_0xe78c5d['remoteUri']),'qs':{'query':util[_0xd95c('0xb')](_0xd95c('0x21'),_0x193896)}})[_0xd95c('0x15')](function(_0xa498c7){var _0x1b2cc8;if(_0xa498c7[_0xd95c('0x1b')][_0xd95c('0x22')]){_0xa498c7[_0xd95c('0x1b')]=_[_0xd95c('0x23')](_0xa498c7[_0xd95c('0x1b')],{'suspended':![],'role':_0xd95c('0x24')});if(_0xa498c7['results'][_0xd95c('0x22')]){_0x1b2cc8=_[_0xd95c('0x25')](_0xa498c7[_0xd95c('0x1b')]);}}if(_0x1b2cc8){logger[_0xd95c('0x9')](_0xd95c('0x26'));return _0x1b2cc8;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xd95c('0xb')]('%s/users.json',_0xe78c5d['remoteUri']),'method':'POST','body':{'user':{'role':'end-user','name':util['format']('Caller\x20-\x20%s',_0x19284b||_0x193896),'phone':_0x193896}}})['then'](function(_0x1b381a){logger[_0xd95c('0x9')]('Enduser\x20created.');return _0x1b381a[_0xd95c('0x1f')];});}});}function getAuth(_0x3d3d27){var _0xcacb08;if(_0x3d3d27[_0xd95c('0x27')]===_0xd95c('0x28')){_0xcacb08=util[_0xd95c('0xb')](_0xd95c('0x29'),_0x3d3d27[_0xd95c('0x2a')],_0x3d3d27[_0xd95c('0x28')]);}else if(_0x3d3d27[_0xd95c('0x27')]===_0xd95c('0x2b')){_0xcacb08=util[_0xd95c('0xb')](_0xd95c('0x2c'),_0x3d3d27[_0xd95c('0x2a')],_0x3d3d27[_0xd95c('0x2b')]);}return util[_0xd95c('0xb')](_0xd95c('0x2d'),new Buffer(_0xcacb08)[_0xd95c('0x2e')](_0xd95c('0x2f')));}function request(_0xf4b4b3){logger[_0xd95c('0x30')](_0xd95c('0x31'),JSON[_0xd95c('0x32')](_0xf4b4b3));return rp(_['defaults'](_0xf4b4b3,{'method':_0xd95c('0x33'),'headers':headers,'json':!![]}));}function getTags(_0xa56739,_0x16145f){var _0xedb3e8=[];if(_0xa56739&&_0xa56739[_0xd95c('0x22')]>0x0){_0xedb3e8=_['map'](_0xa56739,_0x16145f);}return _0xedb3e8;}function getCustomFields(_0xf7f82d,_0x20ac1a){var _0x3338d4=[];var _0x28ef2b={'custom_fields':[]};if(_0xf7f82d[_0xd95c('0x22')]>0x0){_[_0xd95c('0x34')](_0xf7f82d,function(_0x16d962){if(_[_0xd95c('0x35')]([_0xd95c('0x36'),_0xd95c('0x37')],_0x16d962['type'])&&_0x16d962[_0xd95c('0x38')]&&!_0x16d962[_0xd95c('0x39')]){_0x28ef2b[_0x16d962[_0xd95c('0x38')]['toLowerCase']()]=_0x16d962['content'][_0xd95c('0x2e')]();}else if(_[_0xd95c('0x35')]([_0xd95c('0x36'),_0xd95c('0x37')],_0x16d962[_0xd95c('0x3a')])&&_0x16d962[_0xd95c('0x3b')]&&_0x16d962[_0xd95c('0x39')]){_0x28ef2b[_0xd95c('0x3c')][_0xd95c('0x3d')]({'id':_0x16d962['idField'],'value':_0x16d962[_0xd95c('0x3e')][_0xd95c('0x2e')]()});}else if(_0x16d962[_0xd95c('0x3a')]===_0xd95c('0x3f')&&_0x16d962['variableName']&&_0x16d962[_0xd95c('0x3b')]&&_0x16d962['customField']){_0x20ac1a[_0x16d962['variableName']]&&_0x28ef2b[_0xd95c('0x3c')][_0xd95c('0x3d')]({'id':_0x16d962[_0xd95c('0x3b')],'value':_0x20ac1a[_0x16d962['variableName']][_0xd95c('0x2e')]()});}else if(_0x16d962[_0xd95c('0x3a')]===_0xd95c('0x40')&&_0x16d962['Variable']&&_0x16d962[_0xd95c('0x41')][_0xd95c('0x11')]&&_0x16d962[_0xd95c('0x3b')]&&_0x16d962['customField']){_0x20ac1a[_0x16d962[_0xd95c('0x41')][_0xd95c('0x11')][_0xd95c('0x42')]()]&&_0x28ef2b[_0xd95c('0x3c')]['push']({'id':_0x16d962['idField'],'value':_0x20ac1a[_0x16d962[_0xd95c('0x41')]['name'][_0xd95c('0x42')]()][_0xd95c('0x2e')]()});}});}return _0x28ef2b;}exports[_0xd95c('0x43')]=function(_0x192ed8,_0x4b8d82,_0x1c523e,_0x1af0be,_0x1560c4,_0x452c31){var _0x1a72ed,_0x3d9f59;_0x452c31['remoteUri']=intUtil['stripTrailingSlash'](_0x452c31[_0xd95c('0xd')]);_0x452c31[_0xd95c('0x44')]=intUtil[_0xd95c('0x45')](_0x452c31[_0xd95c('0x44')]);if(_0x1560c4&&_0x1560c4[_0xd95c('0x46')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x4b8d82[_0xd95c('0x47')]=util[_0xd95c('0xb')](_0xd95c('0x48'),_0x452c31[_0xd95c('0x44')],_0x4b8d82['uniqueid'],md5(_0x4b8d82[_0xd95c('0x49')]));}else{_0x4b8d82[_0xd95c('0x47')]='';}headers[_0xd95c('0x4a')]=getAuth(_0x452c31);return getUser(_0x452c31,_0x1af0be[_0xd95c('0x4b')])['then'](function(_0x442755){_0x1a72ed=_0x442755;logger[_0xd95c('0x9')](_0xd95c('0x4c'),_0x1a72ed['id']);return getEndUser(_0x452c31,_0x4b8d82[_0xd95c('0x4d')],_0x4b8d82[_0xd95c('0x4e')]);})[_0xd95c('0x15')](function(_0x256339){_0x3d9f59=_0x256339;logger[_0xd95c('0x9')](_0xd95c('0x4f'),_0x3d9f59['id']);return getTicket(_0x452c31,_0x1a72ed,_0x3d9f59,_0x1c523e,_0x4b8d82);})[_0xd95c('0x15')](function(_0x13cc0f){if(_0x13cc0f){logger[_0xd95c('0x9')]('The\x20Ticket\x20ID\x20is:',_0x13cc0f['id']);switch(_0x452c31['type']){case _0xd95c('0x50'):logger[_0xd95c('0x9')](_0xd95c('0x51'),_0xd95c('0x52'));return request({'uri':util[_0xd95c('0xb')](_0xd95c('0x53'),_0x452c31[_0xd95c('0xd')],_0x1a72ed['id'],_0x13cc0f['id']),'method':_0xd95c('0xe')});case _0xd95c('0x54'):logger['info']('[QUEUE]',_0xd95c('0x55'));emit(util['format'](_0xd95c('0x56'),_0x1af0be[_0xd95c('0x11')]),_0xd95c('0x57'),{'uri':util['format'](_0xd95c('0x58'),_0x452c31['remoteUri'][_0xd95c('0x59')]('/api/v2',''),_0x13cc0f['id'])});break;default:logger[_0xd95c('0x5a')](_0xd95c('0x51'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x268cba){logger['error'](_0xd95c('0x5b'),util[_0xd95c('0x5c')](_0x268cba,{'showHidden':!![],'depth':null}));});};exports[_0xd95c('0x5d')]=function(_0x18985d,_0x5be592,_0x19f934,_0xb5f30b,_0x6eb507,_0x2be779,_0x4dc339){var _0x38cef3,_0x3e584b;_0x2be779['remoteUri']=intUtil[_0xd95c('0x45')](_0x2be779[_0xd95c('0xd')]);_0x2be779[_0xd95c('0x44')]=intUtil[_0xd95c('0x45')](_0x2be779[_0xd95c('0x44')]);if(_0x4dc339&&_0x4dc339[_0xd95c('0x5e')]&&_0x4dc339[_0xd95c('0x5e')]!==_0xd95c('0x5f')){logger[_0xd95c('0x9')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5be592[_0xd95c('0x47')]=util[_0xd95c('0xb')](_0xd95c('0x48'),_0x2be779['serverUrl'],_0x5be592[_0xd95c('0x49')],md5(_0x5be592['uniqueid']));}headers[_0xd95c('0x4a')]=getAuth(_0x2be779);return getUser(_0x2be779,_0xb5f30b[_0xd95c('0x4b')])[_0xd95c('0x15')](function(_0x598eba){_0x38cef3=_0x598eba;logger[_0xd95c('0x9')](_0xd95c('0x4c'),_0x38cef3['id']);return getEndUser(_0x2be779,_0x5be592['destcalleridname'],_0x5be592[_0xd95c('0x60')]);})['then'](function(_0x73359b){_0x3e584b=_0x73359b;logger[_0xd95c('0x9')](_0xd95c('0x4f'),_0x3e584b['id']);return getTicket(_0x2be779,_0x38cef3,_0x3e584b,_0x19f934,_0x5be592);})[_0xd95c('0x15')](function(_0x532a00){if(_0x532a00){logger['info']('The\x20Ticket\x20ID\x20is:',_0x532a00['id']);switch(_0x2be779[_0xd95c('0x3a')]){case _0xd95c('0x50'):logger[_0xd95c('0x9')](_0xd95c('0x61'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xd95c('0xb')](_0xd95c('0x53'),_0x2be779[_0xd95c('0xd')],_0x38cef3['id'],_0x532a00['id']),'method':_0xd95c('0xe')});case _0xd95c('0x54'):logger[_0xd95c('0x9')]('[OUTBOUND]',_0xd95c('0x55'));emit(util[_0xd95c('0xb')](_0xd95c('0x56'),_0xb5f30b['name']),_0xd95c('0x57'),{'uri':util[_0xd95c('0xb')]('%s/agent/tickets/%s',_0x2be779['remoteUri']['replace'](_0xd95c('0x62'),''),_0x532a00['id'])});break;default:logger[_0xd95c('0x5a')]('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xd95c('0x63')](function(_0x3894f2){logger[_0xd95c('0x5a')](_0xd95c('0x64'),util[_0xd95c('0x5c')](_0x3894f2,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x59433f,_0x305b7f,_0x501441,_0x11349c,_0x2207fa,_0x2d1173){var _0x46a00,_0x5b9222;_0x2d1173['remoteUri']=intUtil[_0xd95c('0x45')](_0x2d1173[_0xd95c('0xd')]);_0x2d1173[_0xd95c('0x44')]=intUtil[_0xd95c('0x45')](_0x2d1173['serverUrl']);if(_0x2207fa&&_0x2207fa[_0xd95c('0x46')]){logger[_0xd95c('0x9')]('['+_0x305b7f['lastevent'][_0xd95c('0x65')]()+']',_0xd95c('0x66'));_0x305b7f[_0xd95c('0x47')]=util[_0xd95c('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2d1173[_0xd95c('0x44')],_0x305b7f[_0xd95c('0x49')],md5(_0x305b7f[_0xd95c('0x49')]));}else{_0x305b7f[_0xd95c('0x47')]='';}headers['Authorization']=getAuth(_0x2d1173);return getUser(_0x2d1173)[_0xd95c('0x15')](function(_0x529848){_0x46a00=_0x529848;logger['info'](_0xd95c('0x4c'),_0x46a00['id']);return getEndUser(_0x2d1173,_0x305b7f[_0xd95c('0x4d')],_0x305b7f[_0xd95c('0x4e')]);})[_0xd95c('0x15')](function(_0x208afd){_0x5b9222=_0x208afd;logger[_0xd95c('0x9')](_0xd95c('0x4f'),_0x5b9222['id']);return getTicket(_0x2d1173,_0x46a00,_0x5b9222,_0x501441,_0x305b7f);})[_0xd95c('0x15')](function(_0x19e93b){if(_0x19e93b){logger['info'](_0xd95c('0x67'),_0x19e93b['id']);}})[_0xd95c('0x63')](function(_0x194b70){logger[_0xd95c('0x5a')]('['+_0x305b7f[_0xd95c('0x68')][_0xd95c('0x65')]()+']'+_0xd95c('0x69'),util[_0xd95c('0x5c')](_0x194b70,{'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 e643c7b..1cc9b52 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 _0xa902=['defaults','localhost','emit','debug','[HTTP]','length','string','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','then','add','catch','stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','error','data','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','enduserType','Error:\x20','CREATE\x20ERROR','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','nothing','contact','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','Creating\x20new\x20call...','Owner','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','Call_Result','Called','complete','Answered','rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','Fields','details','log','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','com','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','/downloads?type=uniqueid&token=','zoho.eu','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','unmanaged','toUpperCase','lodash','request-promise','md5','util','./util','ioredis','../../../../config/logger','zoho','redis'];(function(_0x265a39,_0x292daf){var _0x5630fb=function(_0x46ee1f){while(--_0x46ee1f){_0x265a39['push'](_0x265a39['shift']());}};_0x5630fb(++_0x292daf);}(_0xa902,0x8d));var _0x2a90=function(_0x139354,_0x3dc98b){_0x139354=_0x139354-0x0;var _0x3de2a1=_0xa902[_0x139354];return _0x3de2a1;};'use strict';var _=require(_0x2a90('0x0'));var rp=require(_0x2a90('0x1'));var md5=require(_0x2a90('0x2'));var util=require(_0x2a90('0x3'));var intUtil=require(_0x2a90('0x4'));var moment=require('moment');var Redis=require(_0x2a90('0x5'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require(_0x2a90('0x6'))(_0x2a90('0x7'));config[_0x2a90('0x8')]=_[_0x2a90('0x9')](config[_0x2a90('0x8')],{'host':_0x2a90('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2a90('0x8')]));function emit(_0x570659,_0x5ec2b9,_0xc75b6e){io['to'](_0x570659)[_0x2a90('0xb')](_0x5ec2b9,_0xc75b6e);}function request(_0xe500bc){logger[_0x2a90('0xc')](_0x2a90('0xd'),JSON['stringify'](_0xe500bc));return rp(_0xe500bc);}function getCustomFields(_0x361571,_0x3dadc2){var _0x43c56d={};if(_0x361571[_0x2a90('0xe')]>0x0){_['forEach'](_0x361571,function(_0x40e6aa){if(_['includes']([_0x2a90('0xf'),'picklist'],_0x40e6aa[_0x2a90('0x10')])&&_0x40e6aa['idField']){_0x43c56d[_0x40e6aa[_0x2a90('0x11')]]=_0x40e6aa[_0x2a90('0x12')][_0x2a90('0x13')]();}else if(_0x40e6aa['type']==='variable'&&_0x40e6aa['variableName']&&_0x40e6aa[_0x2a90('0x11')]&&_0x3dadc2[_0x40e6aa[_0x2a90('0x14')]]){_0x43c56d[_0x40e6aa['idField']]=_0x3dadc2[_0x40e6aa[_0x2a90('0x14')]][_0x2a90('0x13')]();}else if(_0x40e6aa[_0x2a90('0x10')]===_0x2a90('0x15')&&_0x40e6aa[_0x2a90('0x16')]&&_0x40e6aa[_0x2a90('0x16')][_0x2a90('0x17')]&&_0x40e6aa[_0x2a90('0x11')]&&_0x3dadc2[_0x40e6aa[_0x2a90('0x16')]['name'][_0x2a90('0x18')]()]){_0x43c56d[_0x40e6aa[_0x2a90('0x11')]]=_0x3dadc2[_0x40e6aa[_0x2a90('0x16')]['name'][_0x2a90('0x18')]()][_0x2a90('0x13')]();}});}return _0x43c56d;}function getName(_0x148d18){if(_0x148d18[_0x2a90('0x19')]('\x20')>0x0){var _0x13809a=_0x148d18[_0x2a90('0x1a')](/ (.+)/);if(_0x13809a[0x1]){return _0x13809a;}}return[_0x148d18,_0x148d18];}var accountsTokens={};function getAccessToken(_0x312cd5){return new Promise(function(_0x114d42,_0xf97adb){if(!_[_0x2a90('0x1b')](accountsTokens[_0x312cd5['id']])&&!_[_0x2a90('0x1b')](accountsTokens[_0x312cd5['id']][_0x2a90('0x1c')])){if(moment()['isBefore'](accountsTokens[_0x312cd5['id']][_0x2a90('0x1d')])){_0x114d42(accountsTokens[_0x312cd5['id']][_0x2a90('0x1c')]);}}var _0x2955a9;switch(_0x312cd5[_0x2a90('0x1e')]){case'US':_0x2955a9='https://accounts.zoho.com';break;case'AU':_0x2955a9=_0x2a90('0x1f');break;case'EU':_0x2955a9=_0x2a90('0x20');break;case'IN':_0x2955a9='https://accounts.zoho.in';break;case'CN':_0x2955a9=_0x2a90('0x21');break;default:_0x2955a9=_0x2a90('0x20');break;}var _0x10a6dd={'method':_0x2a90('0x22'),'uri':_0x2955a9+_0x2a90('0x23'),'qs':{'refresh_token':_0x312cd5[_0x2a90('0x24')],'client_id':_0x312cd5[_0x2a90('0x25')],'client_secret':_0x312cd5[_0x2a90('0x26')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x10a6dd)[_0x2a90('0x27')](function(_0x17f978){accountsTokens[_0x312cd5['id']]={'access_token':_0x17f978[_0x2a90('0x1c')],'expires_in':moment()[_0x2a90('0x28')](_0x17f978[_0x2a90('0x1d')],'seconds')};_0x114d42(_0x17f978['access_token']);})[_0x2a90('0x29')](function(_0x4ed64a){logger['error']('Failing\x20creating\x20the\x20access_token',_0x4ed64a[_0x2a90('0x2a')]);_0xf97adb(_0x4ed64a);});});}function getUser(_0x3c78f5,_0x595638,_0x5bd700,_0x1add9a){logger['info'](_0x2a90('0x2b'));return request({'method':_0x2a90('0x2c'),'uri':util[_0x2a90('0x2d')](_0x2a90('0x2e'),_0x595638),'qs':{'type':_0x2a90('0x2f')},'headers':{'Authorization':_0x2a90('0x30')+_0x3c78f5},'json':!![]})[_0x2a90('0x27')](function(_0x4a0bfa){if(_0x4a0bfa[_0x2a90('0x31')]){var _0x22b1f3=-0x1;if(_[_0x2a90('0x32')](_0x4a0bfa['users'])){if(!_[_0x2a90('0x1b')](_0x1add9a)){_0x22b1f3=_[_0x2a90('0x33')](_0x4a0bfa[_0x2a90('0x31')],function(_0x17dce6){return _0x17dce6['email']===_0x1add9a;});}if(_0x22b1f3>=0x0){logger[_0x2a90('0x34')](_0x2a90('0x35'));}else{logger[_0x2a90('0x34')](_0x2a90('0x36'));_0x22b1f3=_[_0x2a90('0x33')](_0x4a0bfa[_0x2a90('0x31')],function(_0x4d4149){return _0x4d4149[_0x2a90('0x37')][_0x2a90('0x17')]===_0x2a90('0x38');});}return _0x4a0bfa[_0x2a90('0x31')][_0x22b1f3];}else{if(_0x4a0bfa['user'][_0x2a90('0x37')][_0x2a90('0x17')]==='Administrator'){logger[_0x2a90('0x34')](_0x2a90('0x36'));user=_0x4a0bfa['user'];return user;}else{logger['error'](_0x2a90('0x39'),JSON[_0x2a90('0x3a')](_0x4a0bfa));throw new Error(_0x2a90('0x3b')+JSON['stringify'](_0x4a0bfa));}}}else{logger[_0x2a90('0x3c')]('The\x20failing\x20result\x20is',JSON[_0x2a90('0x3a')](_0x4a0bfa));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x2a90('0x3a')](_0x4a0bfa));}})['catch'](function(_0x5322dc){console[_0x2a90('0x3c')](_0x5322dc);});}function getZohoUser(_0x47d568,_0x463721){return new BPromise(function(_0x97448,_0x218727){request(_0x47d568)['then'](function(_0x57a2a5){var _0x12f858=null;if(_0x57a2a5){_0x12f858=_0x57a2a5[_0x2a90('0x3d')][0x0];_0x12f858['enduserType']=_0x463721;}_0x97448(_0x12f858);})[_0x2a90('0x29')](function(_0x2d6a44){_0x218727(_0x2d6a44);});});}function createEndUser(_0x1a9c04,_0x580667,_0x1aa096,_0x1db9d8,_0x504643,_0x2771e8){var _0x1aa096=getName(_0x1aa096);return request({'method':_0x2a90('0x22'),'uri':_0x2a90('0x3e')+_0x580667+_0x2a90('0x3f')+_[_0x2a90('0x40')](_0x2771e8[_0x2a90('0x41')])+'s','body':{'data':[{'Last_Name':_0x1aa096[0x1],'First_Name':_0x1aa096[0x0],'Phone':_0x1db9d8,'Owner':{'name':!_[_0x2a90('0x1b')](_0x504643[_0x2a90('0x42')][_0x2a90('0x17')])?_0x504643[_0x2a90('0x42')][_0x2a90('0x17')]:!_[_0x2a90('0x1b')](_0x504643[_0x2a90('0x43')])?_0x504643['first_name']+'\x20'+_0x504643[_0x2a90('0x44')]:_0x504643[_0x2a90('0x44')],'id':_0x504643['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1a9c04},'json':!![]})[_0x2a90('0x27')](function(_0x1e971c){if(_0x1e971c&&_0x1e971c[_0x2a90('0x3d')][0x0][_0x2a90('0x45')]===_0x2a90('0x46')){var _0x54b290=_0x1e971c[_0x2a90('0x3d')][0x0]['details'];_0x54b290[_0x2a90('0x47')]=_['startCase'](_0x2771e8[_0x2a90('0x41')])+'s';return _0x54b290;}logger[_0x2a90('0x3c')](_0x2a90('0x39'),JSON[_0x2a90('0x3a')](data));throw new Error(_0x2a90('0x48')+JSON[_0x2a90('0x3a')](data));})[_0x2a90('0x29')](function(_0x48d464){console['log'](_0x2a90('0x49'),_0x48d464);});}function getEndUser(_0x388613,_0x401eab,_0x28944c,_0x1ae049,_0xff4f4a,_0x654803,_0x1fb729){var _0x4fdbca={'method':_0x2a90('0x2c'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x388613},'json':!![]};switch(_0x1fb729[_0x2a90('0x4a')]){case _0x2a90('0x4b'):_0x4fdbca['uri']=_0x2a90('0x3e')+_0x401eab+_0x2a90('0x4c')+_0xff4f4a+'))';return getZohoUser(_0x4fdbca,_0x2a90('0x4d'))[_0x2a90('0x27')](function(_0x175d59){if(_0x175d59)return _0x175d59;_0x4fdbca[_0x2a90('0x4e')]=_0x2a90('0x3e')+_0x401eab+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0xff4f4a+'))';return getZohoUser(_0x4fdbca,'Leads')[_0x2a90('0x27')](function(_0x2611d0){if(_0x2611d0)return _0x2611d0;if(_0x1fb729[_0x2a90('0x41')]!=_0x2a90('0x4f')){return createEndUser(_0x388613,_0x401eab,_0x1ae049,_0xff4f4a,_0x654803,_0x1fb729);}else{return{};}});});break;case _0x2a90('0x50'):_0x4fdbca['uri']='https://www.zohoapis.'+_0x401eab+_0x2a90('0x4c')+_0xff4f4a+'))';return getZohoUser(_0x4fdbca,_0x2a90('0x4d'))['then'](function(_0x5f15e0){if(_0x5f15e0)return _0x5f15e0;if(_0x1fb729['moduleCreate']!=_0x2a90('0x4f')){return createEndUser(_0x388613,_0x401eab,_0x1ae049,_0xff4f4a,_0x654803,_0x1fb729);}else{return{};}});break;case'lead':_0x4fdbca[_0x2a90('0x4e')]=_0x2a90('0x3e')+_0x401eab+_0x2a90('0x51')+_0xff4f4a+'))';return getZohoUser(_0x4fdbca,_0x2a90('0x52'))[_0x2a90('0x27')](function(_0x3ade08){if(_0x3ade08)return _0x3ade08;if(_0x1fb729['moduleCreate']!=_0x2a90('0x4f')){return createEndUser(_0x388613,_0x401eab,_0x1ae049,_0xff4f4a,_0x654803,_0x1fb729);}else{return{};}});break;}}function getCall(_0x46115e,_0x48d3bc,_0x265769,_0x4d1303,_0x4c8bae,_0x46f687,_0xe47c6b,_0x5819ab){logger['info'](_0x2a90('0x53'));var _0x5951eb={};_0x5951eb[_0x2a90('0x54')]={'name':!_[_0x2a90('0x1b')](_0x4d1303['role'][_0x2a90('0x17')])&&!_[_0x2a90('0x1b')](_0x4d1303[_0x2a90('0x37')]['name'])&&_0x4d1303[_0x2a90('0x37')][_0x2a90('0x17')]==='administrator'?_0x4d1303['role'][_0x2a90('0x17')]:!_[_0x2a90('0x1b')](_0x4d1303['first_name'])?_0x4d1303[_0x2a90('0x43')]+'\x20'+_0x4d1303['last_name']:_0x4d1303[_0x2a90('0x44')],'id':_0x4d1303['id']};_0x5951eb['Subject']=intUtil[_0x2a90('0x55')](_0x46f687[_0x2a90('0x56')],_0xe47c6b,'\x20');_0x5951eb[_0x2a90('0x57')]=intUtil['getString'](_0x46f687['Descriptions'],_0xe47c6b,'\x0a');if(_0x4c8bae['enduserType']===_0x2a90('0x4d')){_0x5951eb[_0x2a90('0x58')]={'name':!_[_0x2a90('0x1b')](_0x4c8bae[_0x2a90('0x59')])?_0x4c8bae[_0x2a90('0x59')]:!_[_0x2a90('0x1b')](_0x4c8bae[_0x2a90('0x5a')])?_0x4c8bae[_0x2a90('0x5a')]+'\x20'+_0x4c8bae[_0x2a90('0x5b')]:_0x4c8bae[_0x2a90('0x5b')],'id':_0x4c8bae['id']};}if(_0x4c8bae[_0x2a90('0x47')]===_0x2a90('0x52')){_0x5951eb[_0x2a90('0x5c')]={'name':!_['isNil'](_0x4c8bae['Full_Name'])?_0x4c8bae['Full_Name']:!_[_0x2a90('0x1b')](_0x4c8bae[_0x2a90('0x5a')])?_0x4c8bae[_0x2a90('0x5a')]+'\x20'+_0x4c8bae[_0x2a90('0x5b')]:_0x4c8bae[_0x2a90('0x5b')],'id':_0x4c8bae['id']};_0x5951eb[_0x2a90('0x5d')]=_[_0x2a90('0x40')](_0x4c8bae[_0x2a90('0x47')]);}if(_0xe47c6b[_0x2a90('0x5e')]){_0x5951eb[_0x2a90('0x5f')]=moment[_0x2a90('0x60')](parseInt(_0xe47c6b[_0x2a90('0x5e')])*0x3e8)[_0x2a90('0x2d')](_0x2a90('0x61'));}else if(_0xe47c6b[_0x2a90('0x62')]&&_0xe47c6b[_0x2a90('0x63')]){_0x5951eb['Call_Duration']=moment[_0x2a90('0x60')](moment(_0xe47c6b['endtime'],_0x2a90('0x64'))[_0x2a90('0x65')](moment(_0xe47c6b[_0x2a90('0x66')],_0x2a90('0x64'))))[_0x2a90('0x2d')](_0x2a90('0x61'));}switch(_0xe47c6b[_0x2a90('0x67')]){case'called':_0x5951eb[_0x2a90('0x68')]=_0x2a90('0x69');break;case _0x2a90('0x6a'):case'connect':_0x5951eb[_0x2a90('0x68')]=_0x2a90('0x6b');break;case _0x2a90('0x6c'):_0x5951eb[_0x2a90('0x68')]='Rejected';break;case _0x2a90('0x6d'):_0x5951eb['Call_Result']=_0x2a90('0x6e');break;case _0x2a90('0x6f'):_0x5951eb[_0x2a90('0x68')]=_0x2a90('0x70');default:}_0x5951eb[_0x2a90('0x71')]=(_0x5819ab===_0x2a90('0x72')?moment(_0xe47c6b['starttime'])[_0x2a90('0x2d')](_0x2a90('0x64')):moment(_0xe47c6b[_0x2a90('0x73')])[_0x2a90('0x2d')](_0x2a90('0x64')))||moment()[_0x2a90('0x2d')](_0x2a90('0x64'));_0x5951eb[_0x2a90('0x74')]=_0x5819ab||_0x2a90('0x75');_0x5951eb=_['merge'](_0x5951eb,getCustomFields(_0x46f687[_0x2a90('0x76')],_0xe47c6b));return request({'method':_0x2a90('0x22'),'uri':_0x2a90('0x3e')+_0x48d3bc+'/crm/v2/Calls','headers':{'Authorization':_0x2a90('0x30')+_0x46115e},'body':{'data':[_0x5951eb]},'json':!![]})[_0x2a90('0x27')](function(_0x4565c6){if(_0x4565c6&&_0x4565c6[_0x2a90('0x3d')][0x0][_0x2a90('0x45')]==='SUCCESS'){logger[_0x2a90('0x34')]('Call\x20created!');return{'id':_0x4565c6['data'][0x0][_0x2a90('0x77')]['id']};}})['catch'](function(_0x49dcda){logger[_0x2a90('0x34')]('err',_0x49dcda[_0x2a90('0x2a')]);console[_0x2a90('0x78')]('err',_0x49dcda);});}exports['queue']=function(_0x14100e,_0x4eaacb,_0x51f11d,_0xd52ae2,_0x164bfd,_0x1db063){var _0x2ec221,_0x5bdd4d,_0x4eaee2;_0x1db063[_0x2a90('0x79')]=intUtil[_0x2a90('0x7a')](_0x1db063[_0x2a90('0x79')]);_0x1db063[_0x2a90('0x7b')]=intUtil[_0x2a90('0x7a')](_0x1db063[_0x2a90('0x7b')]);if(_0x164bfd&&_0x164bfd[_0x2a90('0x7c')]){logger[_0x2a90('0x34')](_0x2a90('0x7d'),_0x2a90('0x7e'));_0x4eaacb[_0x2a90('0x7f')]=_0x1db063[_0x2a90('0x7b')]+'/api/voice/recordings/'+_0x4eaacb[_0x2a90('0x80')]+'/downloads?type=uniqueid&token='+md5(_0x4eaacb[_0x2a90('0x80')]);}else{_0x4eaacb['recordingURL']='';}var _0x261a84=_0x1db063['host']==='zoho.eu'?'eu':_0x2a90('0x81');return getAccessToken(_0x1db063)[_0x2a90('0x27')](function(_0x2bd7d8){_0x4eaee2=_0x2bd7d8;return getUser(_0x4eaee2,_0x261a84,_0x1db063,_0xd52ae2[_0x2a90('0x82')]);})['then'](function(_0x5550d2){_0x2ec221=_0x5550d2;logger[_0x2a90('0x34')](_0x2a90('0x83'),_0x2ec221['id']);return getEndUser(_0x4eaee2,_0x261a84,_0x1db063,_0x4eaacb[_0x2a90('0x84')],_0x4eaacb[_0x2a90('0x85')],_0x2ec221,_0x51f11d);})[_0x2a90('0x27')](function(_0x3b0d5e){_0x5bdd4d=_0x3b0d5e;return getCall(_0x4eaee2,_0x261a84,_0x1db063,_0x2ec221,_0x5bdd4d,_0x51f11d,_0x4eaacb,_0x2a90('0x75'));})[_0x2a90('0x27')](function(_0x42474d){if(_0x42474d){logger[_0x2a90('0x34')](_0x2a90('0x86'),_0x42474d['id']);logger[_0x2a90('0x34')]('[QUEUE]',_0x2a90('0x87'));emit(util[_0x2a90('0x2d')](_0x2a90('0x88'),_0xd52ae2[_0x2a90('0x17')]),_0x2a90('0x89'),{'uri':_0x2a90('0x8a')+_0x1db063[_0x2a90('0x79')]+_0x2a90('0x8b')+_0x42474d['id']});}})['catch'](function(_0x3de173){logger[_0x2a90('0x3c')]('[QUEUE]',JSON[_0x2a90('0x3a')](_0x3de173));});};exports[_0x2a90('0x72')]=function(_0x46e1d5,_0xaf1b4a,_0x365c36,_0x16e9e7,_0x4b4a47,_0x45ea35,_0x4123e9){var _0x22edda,_0x1c0aa6,_0x4695ee;_0x45ea35[_0x2a90('0x79')]=intUtil[_0x2a90('0x7a')](_0x45ea35[_0x2a90('0x79')]);_0x45ea35['serverUrl']=intUtil[_0x2a90('0x7a')](_0x45ea35[_0x2a90('0x7b')]);if(_0x4123e9&&_0x4123e9[_0x2a90('0x8c')]&&_0x4123e9[_0x2a90('0x8c')]!==_0x2a90('0x8d')){logger[_0x2a90('0x34')]('[OUTBOUND]',_0x2a90('0x7e'));_0xaf1b4a[_0x2a90('0x7f')]=_0x45ea35[_0x2a90('0x7b')]+'/api/voice/recordings/'+_0xaf1b4a[_0x2a90('0x80')]+_0x2a90('0x8e')+md5(_0xaf1b4a[_0x2a90('0x80')]);}var _0x5c0a1b=_0x45ea35['host']===_0x2a90('0x8f')?'eu':_0x2a90('0x81');return getAccessToken(_0x45ea35)['then'](function(_0x475fe8){_0x4695ee=_0x475fe8;return getUser(_0x4695ee,_0x5c0a1b,_0x45ea35,_0x16e9e7[_0x2a90('0x82')]);})['then'](function(_0x241d4b){_0x22edda=_0x241d4b;logger[_0x2a90('0x34')]('The\x20User\x20ID\x20is:',_0x22edda['id']);return getEndUser(_0x4695ee,_0x5c0a1b,_0x45ea35,_0xaf1b4a[_0x2a90('0x90')],_0xaf1b4a[_0x2a90('0x91')],_0x22edda,_0x365c36);})['then'](function(_0x58905e){_0x1c0aa6=_0x58905e;return getCall(_0x4695ee,_0x5c0a1b,_0x45ea35,_0x22edda,_0x1c0aa6,_0x365c36,_0xaf1b4a,_0x2a90('0x92'));})[_0x2a90('0x27')](function(_0x184263){if(_0x184263){logger[_0x2a90('0x34')](_0x2a90('0x86'),_0x184263['id']);logger[_0x2a90('0x34')](_0x2a90('0x93'),_0x2a90('0x87'));emit(util[_0x2a90('0x2d')](_0x2a90('0x88'),_0x16e9e7[_0x2a90('0x17')]),'trigger:browser:url',{'uri':_0x2a90('0x8a')+_0x45ea35[_0x2a90('0x79')]+_0x2a90('0x8b')+_0x184263['id']});}})['catch'](function(_0x1e364b){logger[_0x2a90('0x3c')](_0x2a90('0x93'),JSON['stringify'](_0x1e364b));});};exports[_0x2a90('0x94')]=function(_0x11a311,_0x25d206,_0x123c72,_0x3ae81b,_0x27f42f,_0x271fbd){var _0x5f05fa,_0x514063,_0x14fe23;_0x271fbd['host']=intUtil[_0x2a90('0x7a')](_0x271fbd[_0x2a90('0x79')]);_0x271fbd['serverUrl']=intUtil[_0x2a90('0x7a')](_0x271fbd[_0x2a90('0x7b')]);if(_0x27f42f&&_0x27f42f[_0x2a90('0x7c')]){logger[_0x2a90('0x34')]('['+_0x25d206[_0x2a90('0x67')][_0x2a90('0x95')]()+']',_0x2a90('0x7e'));_0x25d206[_0x2a90('0x7f')]=_0x271fbd[_0x2a90('0x7b')]+'/api/voice/recordings/'+_0x25d206['uniqueid']+_0x2a90('0x8e')+md5(_0x25d206[_0x2a90('0x80')]);}else{_0x25d206[_0x2a90('0x7f')]='';}var _0x3cceb5=_0x271fbd[_0x2a90('0x79')]===_0x2a90('0x8f')?'eu':_0x2a90('0x81');return getAccessToken(_0x271fbd)[_0x2a90('0x27')](function(_0x10050f){_0x14fe23=_0x10050f;return getUser(_0x14fe23,_0x3cceb5,_0x271fbd);})[_0x2a90('0x27')](function(_0x1d6400){_0x5f05fa=_0x1d6400;logger[_0x2a90('0x34')](_0x2a90('0x83'),_0x5f05fa['id']);return getEndUser(_0x14fe23,_0x3cceb5,_0x271fbd,_0x25d206[_0x2a90('0x84')],_0x25d206[_0x2a90('0x85')],_0x5f05fa,_0x123c72);})[_0x2a90('0x27')](function(_0x46b9de){_0x514063=_0x46b9de;return getCall(_0x14fe23,_0x3cceb5,_0x271fbd,_0x5f05fa,_0x514063,_0x123c72,_0x25d206,'Inbound');})[_0x2a90('0x27')](function(_0x41d882){if(_0x41d882){logger[_0x2a90('0x34')](_0x2a90('0x86'),_0x41d882['id']);}})['catch'](function(_0x202c2b){logger[_0x2a90('0x3c')]('['+_0x25d206[_0x2a90('0x67')]['toUpperCase']()+']',JSON[_0x2a90('0x3a')](_0x202c2b));});}; \ No newline at end of file +var _0x5b02=['Zoho-oauthtoken\x20','code','SUCCESS','details','moduleCreate','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','Creating\x20new\x20call...','Owner','Subject','getString','Subjects','Description','Contacts','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','answertime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Called','complete','Call_Result','Rejected','abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','Call\x20created!','err','queue','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://crm.','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','/downloads?type=uniqueid&token=','com','destcalleridnum','Outbound','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','toUpperCase','The\x20User\x20ID\x20is:','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','stringify','length','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','isArrayLikeObject','users','findIndex','email','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5b02,0xe9));var _0x25b0=function(_0xae4ade,_0x5a8d5b){_0xae4ade=_0xae4ade-0x0;var _0x271600=_0x5b02[_0xae4ade];return _0x271600;};'use strict';var _=require(_0x25b0('0x0'));var rp=require(_0x25b0('0x1'));var md5=require(_0x25b0('0x2'));var util=require(_0x25b0('0x3'));var intUtil=require('./util');var moment=require('moment');var Redis=require(_0x25b0('0x4'));var BPromise=require('bluebird');var config=require(_0x25b0('0x5'));var logger=require(_0x25b0('0x6'))(_0x25b0('0x7'));config[_0x25b0('0x8')]=_[_0x25b0('0x9')](config['redis'],{'host':_0x25b0('0xa'),'port':0x18eb});var io=require(_0x25b0('0xb'))(new Redis(config['redis']));function emit(_0x412954,_0x4d3e71,_0x56feca){io['to'](_0x412954)[_0x25b0('0xc')](_0x4d3e71,_0x56feca);}function request(_0x45429b){logger[_0x25b0('0xd')]('[HTTP]',JSON[_0x25b0('0xe')](_0x45429b));return rp(_0x45429b);}function getCustomFields(_0x466612,_0x135afb){var _0x250d31={};if(_0x466612[_0x25b0('0xf')]>0x0){_[_0x25b0('0x10')](_0x466612,function(_0x44afbc){if(_[_0x25b0('0x11')]([_0x25b0('0x12'),_0x25b0('0x13')],_0x44afbc[_0x25b0('0x14')])&&_0x44afbc[_0x25b0('0x15')]){_0x250d31[_0x44afbc[_0x25b0('0x15')]]=_0x44afbc[_0x25b0('0x16')][_0x25b0('0x17')]();}else if(_0x44afbc[_0x25b0('0x14')]===_0x25b0('0x18')&&_0x44afbc[_0x25b0('0x19')]&&_0x44afbc[_0x25b0('0x15')]&&_0x135afb[_0x44afbc[_0x25b0('0x19')]]){_0x250d31[_0x44afbc[_0x25b0('0x15')]]=_0x135afb[_0x44afbc['variableName']]['toString']();}else if(_0x44afbc[_0x25b0('0x14')]==='customVariable'&&_0x44afbc[_0x25b0('0x1a')]&&_0x44afbc[_0x25b0('0x1a')][_0x25b0('0x1b')]&&_0x44afbc[_0x25b0('0x15')]&&_0x135afb[_0x44afbc['Variable'][_0x25b0('0x1b')][_0x25b0('0x1c')]()]){_0x250d31[_0x44afbc[_0x25b0('0x15')]]=_0x135afb[_0x44afbc[_0x25b0('0x1a')][_0x25b0('0x1b')][_0x25b0('0x1c')]()]['toString']();}});}return _0x250d31;}function getName(_0x348d36){if(_0x348d36[_0x25b0('0x1d')]('\x20')>0x0){var _0x24e7a0=_0x348d36[_0x25b0('0x1e')](/ (.+)/);if(_0x24e7a0[0x1]){return _0x24e7a0;}}return[_0x348d36,_0x348d36];}var accountsTokens={};function getAccessToken(_0x1dc691){return new Promise(function(_0xea4162,_0x232be7){if(!_[_0x25b0('0x1f')](accountsTokens[_0x1dc691['id']])&&!_[_0x25b0('0x1f')](accountsTokens[_0x1dc691['id']][_0x25b0('0x20')])){if(moment()[_0x25b0('0x21')](accountsTokens[_0x1dc691['id']][_0x25b0('0x22')])){_0xea4162(accountsTokens[_0x1dc691['id']]['access_token']);}}var _0x9f432e;switch(_0x1dc691[_0x25b0('0x23')]){case'US':_0x9f432e='https://accounts.zoho.com';break;case'AU':_0x9f432e=_0x25b0('0x24');break;case'EU':_0x9f432e=_0x25b0('0x25');break;case'IN':_0x9f432e=_0x25b0('0x26');break;case'CN':_0x9f432e='https://accounts.zoho.com.cn';break;default:_0x9f432e='https://accounts.zoho.eu';break;}var _0x50089e={'method':_0x25b0('0x27'),'uri':_0x9f432e+_0x25b0('0x28'),'qs':{'refresh_token':_0x1dc691[_0x25b0('0x29')],'client_id':_0x1dc691[_0x25b0('0x2a')],'client_secret':_0x1dc691[_0x25b0('0x2b')],'grant_type':_0x25b0('0x2c')},'json':!![]};return rp(_0x50089e)[_0x25b0('0x2d')](function(_0x75ce7a){accountsTokens[_0x1dc691['id']]={'access_token':_0x75ce7a[_0x25b0('0x20')],'expires_in':moment()['add'](_0x75ce7a[_0x25b0('0x22')],_0x25b0('0x2e'))};_0xea4162(_0x75ce7a['access_token']);})['catch'](function(_0x5de43d){logger[_0x25b0('0x2f')](_0x25b0('0x30'),_0x5de43d[_0x25b0('0x31')]);_0x232be7(_0x5de43d);});});}function getUser(_0x105129,_0x214377,_0x3285ae,_0x12676b){logger[_0x25b0('0x32')](_0x25b0('0x33'));return request({'method':_0x25b0('0x34'),'uri':util[_0x25b0('0x35')](_0x25b0('0x36'),_0x214377),'qs':{'type':_0x25b0('0x37')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x105129},'json':!![]})['then'](function(_0x7ce48f){if(_0x7ce48f['users']){var _0x4dfeea=-0x1;if(_[_0x25b0('0x38')](_0x7ce48f[_0x25b0('0x39')])){if(!_[_0x25b0('0x1f')](_0x12676b)){_0x4dfeea=_[_0x25b0('0x3a')](_0x7ce48f[_0x25b0('0x39')],function(_0x5d64dc){return _0x5d64dc[_0x25b0('0x3b')]===_0x12676b;});}if(_0x4dfeea>=0x0){logger[_0x25b0('0x32')]('Agent\x20found!');}else{logger[_0x25b0('0x32')](_0x25b0('0x3c'));_0x4dfeea=_['findIndex'](_0x7ce48f[_0x25b0('0x39')],function(_0x49b3a5){return _0x49b3a5[_0x25b0('0x3d')][_0x25b0('0x1b')]===_0x25b0('0x3e');});}return _0x7ce48f[_0x25b0('0x39')][_0x4dfeea];}else{if(_0x7ce48f[_0x25b0('0x3f')][_0x25b0('0x3d')][_0x25b0('0x1b')]===_0x25b0('0x3e')){logger[_0x25b0('0x32')]('Using\x20the\x20admin\x20account!');user=_0x7ce48f[_0x25b0('0x3f')];return user;}else{logger[_0x25b0('0x2f')](_0x25b0('0x40'),JSON[_0x25b0('0xe')](_0x7ce48f));throw new Error(_0x25b0('0x41')+JSON[_0x25b0('0xe')](_0x7ce48f));}}}else{logger[_0x25b0('0x2f')](_0x25b0('0x40'),JSON[_0x25b0('0xe')](_0x7ce48f));throw new Error(_0x25b0('0x41')+JSON['stringify'](_0x7ce48f));}})[_0x25b0('0x42')](function(_0x104b35){console[_0x25b0('0x2f')](_0x104b35);});}function getZohoUser(_0x4834f6,_0x20d98b){return new BPromise(function(_0x42a0ed,_0x2ce2ca){request(_0x4834f6)[_0x25b0('0x2d')](function(_0x17f67c){var _0xa35c6a=null;if(_0x17f67c){_0xa35c6a=_0x17f67c[_0x25b0('0x43')][0x0];_0xa35c6a[_0x25b0('0x44')]=_0x20d98b;}_0x42a0ed(_0xa35c6a);})['catch'](function(_0x4ae0aa){_0x2ce2ca(_0x4ae0aa);});});}function createEndUser(_0x447a18,_0x30d1e3,_0x3f4ae0,_0x52c0af,_0x9c6ab4,_0x48aeb6){var _0x3f4ae0=getName(_0x3f4ae0);return request({'method':_0x25b0('0x27'),'uri':_0x25b0('0x45')+_0x30d1e3+_0x25b0('0x46')+_[_0x25b0('0x47')](_0x48aeb6['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x3f4ae0[0x1],'First_Name':_0x3f4ae0[0x0],'Phone':_0x52c0af,'Owner':{'name':!_[_0x25b0('0x1f')](_0x9c6ab4[_0x25b0('0x48')][_0x25b0('0x1b')])?_0x9c6ab4[_0x25b0('0x48')][_0x25b0('0x1b')]:!_['isNil'](_0x9c6ab4[_0x25b0('0x49')])?_0x9c6ab4[_0x25b0('0x49')]+'\x20'+_0x9c6ab4[_0x25b0('0x4a')]:_0x9c6ab4[_0x25b0('0x4a')],'id':_0x9c6ab4['id']}}]},'headers':{'Authorization':_0x25b0('0x4b')+_0x447a18},'json':!![]})[_0x25b0('0x2d')](function(_0x51deba){if(_0x51deba&&_0x51deba[_0x25b0('0x43')][0x0][_0x25b0('0x4c')]===_0x25b0('0x4d')){var _0x124d4b=_0x51deba['data'][0x0][_0x25b0('0x4e')];_0x124d4b['enduserType']=_[_0x25b0('0x47')](_0x48aeb6[_0x25b0('0x4f')])+'s';return _0x124d4b;}logger[_0x25b0('0x2f')](_0x25b0('0x40'),JSON['stringify'](data));throw new Error(_0x25b0('0x50')+JSON[_0x25b0('0xe')](data));})[_0x25b0('0x42')](function(_0x5cf035){console[_0x25b0('0x51')](_0x25b0('0x52'),_0x5cf035);});}function getEndUser(_0xfbe61d,_0x4434b1,_0x3b6679,_0x3c6ec1,_0x28bdc4,_0x55ff4c,_0x3ad3b3){var _0x295193={'method':_0x25b0('0x34'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xfbe61d},'json':!![]};switch(_0x3ad3b3[_0x25b0('0x53')]){case _0x25b0('0x54'):_0x295193[_0x25b0('0x55')]=_0x25b0('0x45')+_0x4434b1+_0x25b0('0x56')+_0x28bdc4+'))';return getZohoUser(_0x295193,'Contacts')[_0x25b0('0x2d')](function(_0x1cf933){if(_0x1cf933)return _0x1cf933;_0x295193[_0x25b0('0x55')]='https://www.zohoapis.'+_0x4434b1+_0x25b0('0x57')+_0x28bdc4+'))';return getZohoUser(_0x295193,_0x25b0('0x58'))[_0x25b0('0x2d')](function(_0x1d6d55){if(_0x1d6d55)return _0x1d6d55;if(_0x3ad3b3[_0x25b0('0x4f')]!=_0x25b0('0x59')){return createEndUser(_0xfbe61d,_0x4434b1,_0x3c6ec1,_0x28bdc4,_0x55ff4c,_0x3ad3b3);}else{return{};}});});break;case'contact':_0x295193['uri']='https://www.zohoapis.'+_0x4434b1+_0x25b0('0x56')+_0x28bdc4+'))';return getZohoUser(_0x295193,'Contacts')['then'](function(_0x2c5b9e){if(_0x2c5b9e)return _0x2c5b9e;if(_0x3ad3b3['moduleCreate']!=_0x25b0('0x59')){return createEndUser(_0xfbe61d,_0x4434b1,_0x3c6ec1,_0x28bdc4,_0x55ff4c,_0x3ad3b3);}else{return{};}});break;case'lead':_0x295193['uri']=_0x25b0('0x45')+_0x4434b1+_0x25b0('0x57')+_0x28bdc4+'))';return getZohoUser(_0x295193,_0x25b0('0x58'))[_0x25b0('0x2d')](function(_0x42d139){if(_0x42d139)return _0x42d139;if(_0x3ad3b3[_0x25b0('0x4f')]!=_0x25b0('0x59')){return createEndUser(_0xfbe61d,_0x4434b1,_0x3c6ec1,_0x28bdc4,_0x55ff4c,_0x3ad3b3);}else{return{};}});break;}}function getCall(_0x2d5522,_0x2e68ad,_0x20d56f,_0x48fb71,_0x4d3e9e,_0x582f36,_0xf1e6bf,_0xa45e87){logger[_0x25b0('0x32')](_0x25b0('0x5a'));var _0x14db4c={};_0x14db4c[_0x25b0('0x5b')]={'name':!_[_0x25b0('0x1f')](_0x48fb71['role'][_0x25b0('0x1b')])&&!_['isNil'](_0x48fb71[_0x25b0('0x3d')]['name'])&&_0x48fb71['profile'][_0x25b0('0x1b')]==='administrator'?_0x48fb71['role'][_0x25b0('0x1b')]:!_[_0x25b0('0x1f')](_0x48fb71[_0x25b0('0x49')])?_0x48fb71[_0x25b0('0x49')]+'\x20'+_0x48fb71[_0x25b0('0x4a')]:_0x48fb71[_0x25b0('0x4a')],'id':_0x48fb71['id']};_0x14db4c[_0x25b0('0x5c')]=intUtil[_0x25b0('0x5d')](_0x582f36[_0x25b0('0x5e')],_0xf1e6bf,'\x20');_0x14db4c[_0x25b0('0x5f')]=intUtil['getString'](_0x582f36['Descriptions'],_0xf1e6bf,'\x0a');if(_0x4d3e9e[_0x25b0('0x44')]===_0x25b0('0x60')){_0x14db4c['Who_Id']={'name':!_[_0x25b0('0x1f')](_0x4d3e9e[_0x25b0('0x61')])?_0x4d3e9e[_0x25b0('0x61')]:!_[_0x25b0('0x1f')](_0x4d3e9e[_0x25b0('0x62')])?_0x4d3e9e['First_Name']+'\x20'+_0x4d3e9e[_0x25b0('0x63')]:_0x4d3e9e[_0x25b0('0x63')],'id':_0x4d3e9e['id']};}if(_0x4d3e9e[_0x25b0('0x44')]==='Leads'){_0x14db4c[_0x25b0('0x64')]={'name':!_[_0x25b0('0x1f')](_0x4d3e9e[_0x25b0('0x61')])?_0x4d3e9e[_0x25b0('0x61')]:!_[_0x25b0('0x1f')](_0x4d3e9e[_0x25b0('0x62')])?_0x4d3e9e[_0x25b0('0x62')]+'\x20'+_0x4d3e9e[_0x25b0('0x63')]:_0x4d3e9e[_0x25b0('0x63')],'id':_0x4d3e9e['id']};_0x14db4c[_0x25b0('0x65')]=_[_0x25b0('0x47')](_0x4d3e9e[_0x25b0('0x44')]);}if(_0xf1e6bf[_0x25b0('0x66')]){_0x14db4c[_0x25b0('0x67')]=moment['utc'](parseInt(_0xf1e6bf[_0x25b0('0x66')])*0x3e8)[_0x25b0('0x35')]('mm:ss');}else if(_0xf1e6bf[_0x25b0('0x68')]&&_0xf1e6bf['endtime']){_0x14db4c[_0x25b0('0x67')]=moment[_0x25b0('0x69')](moment(_0xf1e6bf['endtime'],_0x25b0('0x6a'))[_0x25b0('0x6b')](moment(_0xf1e6bf[_0x25b0('0x6c')],'YYYY-MM-DDTHH:mm:ss')))[_0x25b0('0x35')]('mm:ss');}switch(_0xf1e6bf[_0x25b0('0x6d')]){case _0x25b0('0x6e'):_0x14db4c['Call_Result']=_0x25b0('0x6f');break;case _0x25b0('0x70'):case'connect':_0x14db4c[_0x25b0('0x71')]='Answered';break;case'rejected':_0x14db4c['Call_Result']=_0x25b0('0x72');break;case _0x25b0('0x73'):_0x14db4c[_0x25b0('0x71')]='Abandoned';break;case _0x25b0('0x74'):_0x14db4c[_0x25b0('0x71')]=_0x25b0('0x75');default:}_0x14db4c[_0x25b0('0x76')]=(_0xa45e87===_0x25b0('0x77')?moment(_0xf1e6bf[_0x25b0('0x6c')])[_0x25b0('0x35')](_0x25b0('0x6a')):moment(_0xf1e6bf[_0x25b0('0x78')])[_0x25b0('0x35')](_0x25b0('0x6a')))||moment()[_0x25b0('0x35')](_0x25b0('0x6a'));_0x14db4c[_0x25b0('0x79')]=_0xa45e87||_0x25b0('0x7a');_0x14db4c=_[_0x25b0('0x7b')](_0x14db4c,getCustomFields(_0x582f36[_0x25b0('0x7c')],_0xf1e6bf));return request({'method':'POST','uri':_0x25b0('0x45')+_0x2e68ad+'/crm/v2/Calls','headers':{'Authorization':_0x25b0('0x4b')+_0x2d5522},'body':{'data':[_0x14db4c]},'json':!![]})[_0x25b0('0x2d')](function(_0x3e3416){if(_0x3e3416&&_0x3e3416[_0x25b0('0x43')][0x0]['code']===_0x25b0('0x4d')){logger[_0x25b0('0x32')](_0x25b0('0x7d'));return{'id':_0x3e3416[_0x25b0('0x43')][0x0][_0x25b0('0x4e')]['id']};}})[_0x25b0('0x42')](function(_0x5eaf94){logger['info'](_0x25b0('0x7e'),_0x5eaf94['stack']);console[_0x25b0('0x51')](_0x25b0('0x7e'),_0x5eaf94);});}exports[_0x25b0('0x7f')]=function(_0x5279ab,_0x2934c2,_0x1259ad,_0x3953e5,_0x1331dd,_0x56509b){var _0x19347f,_0x14d5b6,_0x2a06c6;_0x56509b['host']=intUtil[_0x25b0('0x80')](_0x56509b[_0x25b0('0x81')]);_0x56509b[_0x25b0('0x82')]=intUtil[_0x25b0('0x80')](_0x56509b[_0x25b0('0x82')]);if(_0x1331dd&&_0x1331dd[_0x25b0('0x83')]){logger[_0x25b0('0x32')](_0x25b0('0x84'),'Recording\x20is\x20enabled!');_0x2934c2[_0x25b0('0x85')]=_0x56509b[_0x25b0('0x82')]+_0x25b0('0x86')+_0x2934c2[_0x25b0('0x87')]+'/downloads?type=uniqueid&token='+md5(_0x2934c2['uniqueid']);}else{_0x2934c2[_0x25b0('0x85')]='';}var _0x330daa=_0x56509b[_0x25b0('0x81')]===_0x25b0('0x88')?'eu':'com';return getAccessToken(_0x56509b)[_0x25b0('0x2d')](function(_0x4ac6b7){_0x2a06c6=_0x4ac6b7;return getUser(_0x2a06c6,_0x330daa,_0x56509b,_0x3953e5['email']);})[_0x25b0('0x2d')](function(_0x23e75b){_0x19347f=_0x23e75b;logger['info']('The\x20User\x20ID\x20is:',_0x19347f['id']);return getEndUser(_0x2a06c6,_0x330daa,_0x56509b,_0x2934c2[_0x25b0('0x89')],_0x2934c2[_0x25b0('0x8a')],_0x19347f,_0x1259ad);})[_0x25b0('0x2d')](function(_0x2ea20e){_0x14d5b6=_0x2ea20e;return getCall(_0x2a06c6,_0x330daa,_0x56509b,_0x19347f,_0x14d5b6,_0x1259ad,_0x2934c2,_0x25b0('0x7a'));})[_0x25b0('0x2d')](function(_0x2b43d4){if(_0x2b43d4){logger[_0x25b0('0x32')](_0x25b0('0x8b'),_0x2b43d4['id']);logger[_0x25b0('0x32')](_0x25b0('0x84'),_0x25b0('0x8c'));emit(util[_0x25b0('0x35')]('user:%s',_0x3953e5[_0x25b0('0x1b')]),'trigger:browser:url',{'uri':_0x25b0('0x8d')+_0x56509b[_0x25b0('0x81')]+'/crm/EntityInfo.do?module=Calls&id='+_0x2b43d4['id']});}})[_0x25b0('0x42')](function(_0x703de9){logger[_0x25b0('0x2f')](_0x25b0('0x84'),JSON[_0x25b0('0xe')](_0x703de9));});};exports[_0x25b0('0x77')]=function(_0x1854f1,_0x3f6b41,_0x2e729f,_0xd5351e,_0x36252f,_0x581e22,_0x4de403){var _0x24b839,_0xe3b71,_0x5d3202;_0x581e22['host']=intUtil[_0x25b0('0x80')](_0x581e22['host']);_0x581e22[_0x25b0('0x82')]=intUtil[_0x25b0('0x80')](_0x581e22['serverUrl']);if(_0x4de403&&_0x4de403[_0x25b0('0x8e')]&&_0x4de403[_0x25b0('0x8e')]!=='none'){logger[_0x25b0('0x32')](_0x25b0('0x8f'),_0x25b0('0x90'));_0x3f6b41[_0x25b0('0x85')]=_0x581e22[_0x25b0('0x82')]+'/api/voice/recordings/'+_0x3f6b41['uniqueid']+_0x25b0('0x91')+md5(_0x3f6b41['uniqueid']);}var _0x5adb23=_0x581e22['host']===_0x25b0('0x88')?'eu':_0x25b0('0x92');return getAccessToken(_0x581e22)[_0x25b0('0x2d')](function(_0x4e321b){_0x5d3202=_0x4e321b;return getUser(_0x5d3202,_0x5adb23,_0x581e22,_0xd5351e['email']);})[_0x25b0('0x2d')](function(_0x3aaddc){_0x24b839=_0x3aaddc;logger['info']('The\x20User\x20ID\x20is:',_0x24b839['id']);return getEndUser(_0x5d3202,_0x5adb23,_0x581e22,_0x3f6b41['destcalleridname'],_0x3f6b41[_0x25b0('0x93')],_0x24b839,_0x2e729f);})[_0x25b0('0x2d')](function(_0x1e64de){_0xe3b71=_0x1e64de;return getCall(_0x5d3202,_0x5adb23,_0x581e22,_0x24b839,_0xe3b71,_0x2e729f,_0x3f6b41,_0x25b0('0x94'));})['then'](function(_0x829aa5){if(_0x829aa5){logger[_0x25b0('0x32')](_0x25b0('0x8b'),_0x829aa5['id']);logger[_0x25b0('0x32')](_0x25b0('0x8f'),_0x25b0('0x8c'));emit(util[_0x25b0('0x35')](_0x25b0('0x95'),_0xd5351e[_0x25b0('0x1b')]),_0x25b0('0x96'),{'uri':_0x25b0('0x8d')+_0x581e22[_0x25b0('0x81')]+_0x25b0('0x97')+_0x829aa5['id']});}})[_0x25b0('0x42')](function(_0x1911d2){logger[_0x25b0('0x2f')](_0x25b0('0x8f'),JSON[_0x25b0('0xe')](_0x1911d2));});};exports['unmanaged']=function(_0x5b0091,_0x14ac78,_0x5c6c77,_0x2893b3,_0x53908c,_0x494088){var _0x5abcad,_0x4cb24c,_0x4a083a;_0x494088[_0x25b0('0x81')]=intUtil[_0x25b0('0x80')](_0x494088[_0x25b0('0x81')]);_0x494088['serverUrl']=intUtil[_0x25b0('0x80')](_0x494088[_0x25b0('0x82')]);if(_0x53908c&&_0x53908c['monitor_format']){logger[_0x25b0('0x32')]('['+_0x14ac78[_0x25b0('0x6d')][_0x25b0('0x98')]()+']',_0x25b0('0x90'));_0x14ac78[_0x25b0('0x85')]=_0x494088[_0x25b0('0x82')]+_0x25b0('0x86')+_0x14ac78[_0x25b0('0x87')]+_0x25b0('0x91')+md5(_0x14ac78[_0x25b0('0x87')]);}else{_0x14ac78[_0x25b0('0x85')]='';}var _0x116f56=_0x494088[_0x25b0('0x81')]===_0x25b0('0x88')?'eu':_0x25b0('0x92');return getAccessToken(_0x494088)[_0x25b0('0x2d')](function(_0x20b00b){_0x4a083a=_0x20b00b;return getUser(_0x4a083a,_0x116f56,_0x494088);})['then'](function(_0x2e6b99){_0x5abcad=_0x2e6b99;logger[_0x25b0('0x32')](_0x25b0('0x99'),_0x5abcad['id']);return getEndUser(_0x4a083a,_0x116f56,_0x494088,_0x14ac78[_0x25b0('0x89')],_0x14ac78[_0x25b0('0x8a')],_0x5abcad,_0x5c6c77);})['then'](function(_0x765c81){_0x4cb24c=_0x765c81;return getCall(_0x4a083a,_0x116f56,_0x494088,_0x5abcad,_0x4cb24c,_0x5c6c77,_0x14ac78,'Inbound');})[_0x25b0('0x2d')](function(_0x514269){if(_0x514269){logger['info'](_0x25b0('0x8b'),_0x514269['id']);}})['catch'](function(_0x363d46){logger[_0x25b0('0x2f')]('['+_0x14ac78['lastevent'][_0x25b0('0x98')]()+']',JSON[_0x25b0('0xe')](_0x363d46));});}; \ 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 609b6ad..f778c1f 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 _0x7a54=['mustache','trigger','exec','data2','Script','data3','%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(_0x2a4903,_0x2121c8){var _0x268891=function(_0x28838a){while(--_0x28838a){_0x2a4903['push'](_0x2a4903['shift']());}};_0x268891(++_0x2121c8);}(_0x7a54,0x106));var _0x47a5=function(_0x3cfcd6,_0xac363a){_0x3cfcd6=_0x3cfcd6-0x0;var _0x1b0cbd=_0x7a54[_0x3cfcd6];return _0x1b0cbd;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ No newline at end of file +var _0x7a54=['mustache','trigger','exec','data2','Script','data3','%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(_0x3564ce,_0x177213){var _0x4940fe=function(_0x394635){while(--_0x394635){_0x3564ce['push'](_0x3564ce['shift']());}};_0x4940fe(++_0x177213);}(_0x7a54,0x106));var _0x47a5=function(_0x43a9c0,_0x7cd2b7){_0x43a9c0=_0x43a9c0-0x0;var _0x20bc84=_0x7a54[_0x43a9c0];return _0x20bc84;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ 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 e9bad20..31992c4 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 _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0xed1fae,_0x22b011){var _0x194490=function(_0x106c21){while(--_0x106c21){_0xed1fae['push'](_0xed1fae['shift']());}};_0x194490(++_0x22b011);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2d6a11,_0x19a53c){_0x2d6a11=_0x2d6a11-0x0;var _0x53bc7b=_0x5f2f[_0x2d6a11];return _0x53bc7b;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file +var _0xb10b=['number','headers','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data1','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data5'];(function(_0x3e300b,_0x22ac82){var _0xe1ea37=function(_0x4242e3){while(--_0x4242e3){_0x3e300b['push'](_0x3e300b['shift']());}};_0xe1ea37(++_0x22ac82);}(_0xb10b,0x12a));var _0xbb10=function(_0x348b29,_0x3be5e9){_0x348b29=_0x348b29-0x0;var _0xc260c5=_0xb10b[_0x348b29];return _0xc260c5;};'use strict';var rp=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var Mustache=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('trigger');exports[_0xbb10('0x4')]=function(_0x9bbed,_0x460981){var _0x22320e,_0x49baf4;var _0x312b72={'method':_0x9bbed['data1'][_0xbb10('0x5')](),'uri':Mustache[_0xbb10('0x6')](_0x9bbed['data2'],_0x460981),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x9bbed[_0xbb10('0x7')])===_0xbb10('0x8')&&parseInt(_0x9bbed[_0xbb10('0x7')])>=0x1&&parseInt(_0x9bbed[_0xbb10('0x7')])<=0xa?parseInt(_0x9bbed[_0xbb10('0x7')])*0x3e8:0x5*0x3e8};try{_0x312b72[_0xbb10('0x9')]=_0x9bbed[_0xbb10('0xa')]?JSON[_0xbb10('0xb')](Mustache['render'](_0x9bbed['data6'],_0x460981)):{};}catch(_0x20bd61){logger[_0xbb10('0xc')](_0x20bd61[_0xbb10('0xd')]);}switch(_0x9bbed['data1'][_0xbb10('0x5')]()){case'GET':case _0xbb10('0xe'):_0x22320e=null;_0x312b72['qs']=_0x460981;break;case _0xbb10('0xf'):case _0xbb10('0x10'):if(_0x9bbed[_0xbb10('0x11')]){try{_0x22320e=JSON[_0xbb10('0xb')](Mustache[_0xbb10('0x6')](_0x9bbed['data7'],_0x460981));_0x312b72[_0xbb10('0x12')]=_0x22320e;}catch(_0x42d7e4){logger[_0xbb10('0xc')](_0x42d7e4[_0xbb10('0xd')]);logger[_0xbb10('0xc')](_0xbb10('0x13'));}}else{_0x22320e=_0x460981;_0x312b72[_0xbb10('0x12')]=_0x22320e;}break;}logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x16'),_0x9bbed['data1'],_0x9bbed[_0xbb10('0x17')],JSON[_0xbb10('0x18')](_0x312b72)));rp(_0x312b72)[_0xbb10('0x19')](function(_0x42db98){_0x22320e=!_[_0xbb10('0x1a')](_0x22320e)?_0xbb10('0x1b')+_0x22320e:'';_0x49baf4=typeof _0x42db98[_0xbb10('0x12')]===_0xbb10('0x1c')?JSON[_0xbb10('0x18')](_0x42db98[_0xbb10('0x12')]):_0x42db98['body'];logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x1d'),_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x42db98[_0xbb10('0x1f')],_0x49baf4));})['catch'](function(_0x12f888){logger[_0xbb10('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x12f888[_0xbb10('0x1f')],_0x12f888[_0xbb10('0x20')],_0x12f888[_0xbb10('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 27e024c..f673f02 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 _0x04f1=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','debug','rpc','routing','error','message'];(function(_0x3b7d42,_0x34c0b2){var _0x1d646e=function(_0x8e1564){while(--_0x8e1564){_0x3b7d42['push'](_0x3b7d42['shift']());}};_0x1d646e(++_0x34c0b2);}(_0x04f1,0x92));var _0x104f=function(_0x3ab281,_0x4c06d9){_0x3ab281=_0x3ab281-0x0;var _0x3b4133=_0x04f1[_0x3ab281];return _0x3b4133;};'use strict';var jayson=require(_0x104f('0x0'));var BPromise=require(_0x104f('0x1'));var logger=require(_0x104f('0x2'))('routing');var client=jayson['client'][_0x104f('0x3')]({'port':0x2329});client[_0x104f('0x4')]=function(_0xd152c1,_0x55c56e){return new BPromise(function(_0x4b4197,_0x495aad){return client['request'](_0xd152c1,_0x55c56e)['then'](function(_0x20a746){logger[_0x104f('0x5')](_0x104f('0x6'),_0x104f('0x7'),_0xd152c1,_0x55c56e,_0x20a746);if(_0x20a746['error']){logger[_0x104f('0x8')](_0x104f('0x6'),_0x104f('0x7'),_0xd152c1,_0x20a746[_0x104f('0x8')]['message'],_0x55c56e);return _0x495aad(_0x20a746['error'][_0x104f('0x9')]);}else{return _0x4b4197(_0x20a746[_0x104f('0xa')]);}})[_0x104f('0xb')](function(_0x2a62e7){logger[_0x104f('0x8')](_0x104f('0x6'),_0x104f('0x7'),_0xd152c1,_0x2a62e7,_0x55c56e);return _0x495aad(_0x2a62e7);});});};module[_0x104f('0xc')]=client; \ No newline at end of file +var _0x34aa=['error','message','result','catch','exports','jayson/promise','../../config/logger','routing','client','http','request','then','debug','rpc'];(function(_0x5d67e1,_0x308ffc){var _0x156bda=function(_0x45f853){while(--_0x45f853){_0x5d67e1['push'](_0x5d67e1['shift']());}};_0x156bda(++_0x308ffc);}(_0x34aa,0x171));var _0xa34a=function(_0x316c42,_0x3391f0){_0x316c42=_0x316c42-0x0;var _0x2b38f7=_0x34aa[_0x316c42];return _0x2b38f7;};'use strict';var jayson=require(_0xa34a('0x0'));var BPromise=require('bluebird');var logger=require(_0xa34a('0x1'))(_0xa34a('0x2'));var client=jayson[_0xa34a('0x3')][_0xa34a('0x4')]({'port':0x2329});client['Request']=function(_0x1d7a4f,_0x30f3a2){return new BPromise(function(_0x284561,_0x1db413){return client[_0xa34a('0x5')](_0x1d7a4f,_0x30f3a2)[_0xa34a('0x6')](function(_0x27349c){logger[_0xa34a('0x7')](_0xa34a('0x8'),_0xa34a('0x2'),_0x1d7a4f,_0x30f3a2,_0x27349c);if(_0x27349c[_0xa34a('0x9')]){logger['error'](_0xa34a('0x8'),_0xa34a('0x2'),_0x1d7a4f,_0x27349c[_0xa34a('0x9')][_0xa34a('0xa')],_0x30f3a2);return _0x1db413(_0x27349c[_0xa34a('0x9')]['message']);}else{return _0x284561(_0x27349c[_0xa34a('0xb')]);}})[_0xa34a('0xc')](function(_0x1c8e32){logger[_0xa34a('0x9')](_0xa34a('0x8'),_0xa34a('0x2'),_0x1d7a4f,_0x1c8e32,_0x30f3a2);return _0x1db413(_0x1c8e32);});});};module[_0xa34a('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index f7cd08e..e556aef 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 _0xd6bb=['log','bluebird','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','resolve','getMailAccounts','then','initMailAccounts','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency','catch'];(function(_0x1b9c31,_0x4c7e0d){var _0x258ab8=function(_0x56a97b){while(--_0x56a97b){_0x1b9c31['push'](_0x1b9c31['shift']());}};_0x258ab8(++_0x4c7e0d);}(_0xd6bb,0x1cc));var _0xbd6b=function(_0xb725be,_0x45bd01){_0xb725be=_0xb725be-0x0;var _0x2f2424=_0xd6bb[_0xb725be];return _0x2f2424;};'use strict';var BPromise=require(_0xbd6b('0x0'));var server=require('./server');var Realtime=require(_0xbd6b('0x1'));var EmailChannel=require(_0xbd6b('0x2'));var mailAccount=require(_0xbd6b('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xbd6b('0x4'))['db'];function initRealtime(){return BPromise[_0xbd6b('0x5')]()['then'](mailAccount[_0xbd6b('0x6')]())[_0xbd6b('0x7')](realtime[_0xbd6b('0x8')]())['then'](function(){email[_0xbd6b('0x9')](realtime[_0xbd6b('0xa')]);return realtime;});}function main(){return server[_0xbd6b('0xb')](realtime,email)[_0xbd6b('0x7')](function(_0x31cae6){return initRealtime();})[_0xbd6b('0x7')](function(_0x146037){return db[_0xbd6b('0xc')][_0xbd6b('0xd')]({'attributes':['id',_0xbd6b('0xe')],'raw':!![]});})[_0xbd6b('0x7')](function(_0x5a810b){return setInterval(initRealtime,_0x5a810b[_0xbd6b('0xe')]*0x3e8);})[_0xbd6b('0xf')](function(_0x47c02d){console[_0xbd6b('0x10')](_0x47c02d);});}main(); \ No newline at end of file +var _0xb4c7=['./lib/email','./rpc/mailAccount','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency','catch','log','bluebird','./server','./realtime'];(function(_0x165e1e,_0x37665c){var _0x2b7ff6=function(_0x2e1fa4){while(--_0x2e1fa4){_0x165e1e['push'](_0x165e1e['shift']());}};_0x2b7ff6(++_0x37665c);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x5cf21f,_0x548f55){_0x5cf21f=_0x5cf21f-0x0;var _0x5087b0=_0xb4c7[_0x5cf21f];return _0x5087b0;};'use strict';var BPromise=require(_0x7b4c('0x0'));var server=require(_0x7b4c('0x1'));var Realtime=require(_0x7b4c('0x2'));var EmailChannel=require(_0x7b4c('0x3'));var mailAccount=require(_0x7b4c('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise[_0x7b4c('0x5')]()[_0x7b4c('0x6')](mailAccount[_0x7b4c('0x7')]())[_0x7b4c('0x6')](realtime[_0x7b4c('0x8')]())['then'](function(){email[_0x7b4c('0x9')](realtime[_0x7b4c('0xa')]);return realtime;});}function main(){return server[_0x7b4c('0xb')](realtime,email)['then'](function(_0x2d7b7e){return initRealtime();})[_0x7b4c('0x6')](function(_0x570daa){return db[_0x7b4c('0xc')][_0x7b4c('0xd')]({'attributes':['id',_0x7b4c('0xe')],'raw':!![]});})[_0x7b4c('0x6')](function(_0x365225){return setInterval(initRealtime,_0x365225[_0x7b4c('0xe')]*0x3e8);})[_0x7b4c('0xf')](function(_0xc62104){console[_0x7b4c('0x10')](_0xc62104);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 407ce5f..952202c 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 _0xc3e2=['connected','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapError','sendMail','smtp','send','Smtp','verify','catch','exports','lodash','../../../config/environment','../../../config/logger','email','redis','defaults','socket.io-emitter','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','prototype','emit','active','Imap','messageStatus','total','stringify','md5','mailAccount:update','refresh','hasOwnProperty','imapAccounts','box','handleImapBox','bind','handleImapEmail','handleImapEnd','error','isNil','status','disabled'];(function(_0x206f4b,_0x346117){var _0x20599c=function(_0x2f15b3){while(--_0x2f15b3){_0x206f4b['push'](_0x206f4b['shift']());}};_0x20599c(++_0x346117);}(_0xc3e2,0x144));var _0x2c3e=function(_0x55bef6,_0x16603c){_0x55bef6=_0x55bef6-0x0;var _0x4ff451=_0xc3e2[_0x55bef6];return _0x4ff451;};'use strict';var _=require(_0x2c3e('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require('md5');var Redis=require('ioredis');var config=require(_0x2c3e('0x1'));var logger=require(_0x2c3e('0x2'))(_0x2c3e('0x3'));config[_0x2c3e('0x4')]=_[_0x2c3e('0x5')](config[_0x2c3e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x2c3e('0x6'))(new Redis(config[_0x2c3e('0x4')]));var EmailImap=require(_0x2c3e('0x7'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x2c3e('0x8'));var md5Accounts={};function EmailChannel(_0x53087d){logger[_0x2c3e('0x9')](_0x2c3e('0xa'));this[_0x2c3e('0xb')]=_0x53087d[_0x2c3e('0xb')];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel[_0x2c3e('0xc')][_0x2c3e('0xd')]=function(_0x5ab09d){var _0x43ab25=this[_0x2c3e('0xb')][_0x5ab09d];var _0x3f6c79={'id':_0x43ab25['id'],'name':_0x43ab25['name'],'key':_0x43ab25['key'],'active':_0x43ab25[_0x2c3e('0xe')],'Imap':{'status':_0x43ab25[_0x2c3e('0xf')]['status'],'messageStatus':_0x43ab25[_0x2c3e('0xf')][_0x2c3e('0x10')],'total':_0x43ab25[_0x2c3e('0xf')][_0x2c3e('0x11')]}};if(_['isNil'](md5Accounts[_0x5ab09d])){md5Accounts[_0x5ab09d]={};}var _0x5abd50=md5(JSON[_0x2c3e('0x12')](_0x3f6c79));if(md5Accounts[_0x5ab09d][_0x2c3e('0x13')]!==_0x5abd50){md5Accounts[_0x5ab09d][_0x2c3e('0x13')]=_0x5abd50;io[_0x2c3e('0xd')](_0x2c3e('0x14'),_0x3f6c79);}};EmailChannel[_0x2c3e('0xc')][_0x2c3e('0x15')]=function(_0x3ff6ee){for(var _0x29ed48 in _0x3ff6ee){if(_0x3ff6ee[_0x2c3e('0x16')](_0x29ed48)){if(_0x3ff6ee[_0x29ed48]['Imap']&&_0x3ff6ee[_0x29ed48]['active']){var _0x32a26e=_0x3ff6ee[_0x29ed48][_0x2c3e('0xf')];if(!this['imapAccounts'][_0x2c3e('0x16')](_0x32a26e['id'])){this[_0x2c3e('0x17')][_0x32a26e['id']]=new EmailImap(_0x32a26e,_0x3ff6ee[_0x29ed48][_0x2c3e('0x3')]);this[_0x2c3e('0x17')][_0x32a26e['id']]['on'](_0x2c3e('0x18'),this[_0x2c3e('0x19')][_0x2c3e('0x1a')](this,_0x29ed48));this['imapAccounts'][_0x32a26e['id']]['on']('email',this[_0x2c3e('0x1b')][_0x2c3e('0x1a')](this,_0x29ed48));this['imapAccounts'][_0x32a26e['id']]['on']('end',this[_0x2c3e('0x1c')]['bind'](this,_0x29ed48));this[_0x2c3e('0x17')][_0x32a26e['id']]['on'](_0x2c3e('0x1d'),this['handleImapError'][_0x2c3e('0x1a')](this,_0x29ed48));}}else{if(_[_0x2c3e('0x1e')](this[_0x2c3e('0xb')][_0x29ed48][_0x2c3e('0xf')])){this[_0x2c3e('0xb')][_0x29ed48]['Imap']={};}this['mailAccounts'][_0x29ed48][_0x2c3e('0xf')][_0x2c3e('0x1f')]=_0x2c3e('0x20');this[_0x2c3e('0xb')][_0x29ed48][_0x2c3e('0xf')]['messageStatus']='';this[_0x2c3e('0xd')](_0x29ed48);}}}};EmailChannel[_0x2c3e('0xc')][_0x2c3e('0x19')]=function(_0x2f45d5,_0x14ed86){if(this['mailAccounts'][_0x2f45d5]){this[_0x2c3e('0xb')][_0x2f45d5]['Imap']['status']=_0x2c3e('0x21');this[_0x2c3e('0xb')][_0x2f45d5][_0x2c3e('0xf')][_0x2c3e('0x10')]=_0x14ed86[_0x2c3e('0x22')];if(_0x14ed86[_0x2c3e('0x23')]){this[_0x2c3e('0xb')][_0x2f45d5][_0x2c3e('0xf')][_0x2c3e('0x11')]=_0x14ed86['messages'][_0x2c3e('0x11')];}return this['emit'](_0x2f45d5);}};EmailChannel['prototype'][_0x2c3e('0x1b')]=function(_0x4294c0,_0x4ff8be){logger[_0x2c3e('0x9')](_0x2c3e('0x24'),_0x4ff8be[_0x2c3e('0x25')],_0x4ff8be['lastName'],_0x4ff8be[_0x2c3e('0x26')],_0x4294c0);if(this[_0x2c3e('0xb')][_0x4294c0]){return mailAccount[_0x2c3e('0x27')](_0x4294c0,_0x4ff8be)[_0x2c3e('0x28')](function(_0x10bcb0){if(_0x10bcb0){logger[_0x2c3e('0x9')](_0x2c3e('0x29'));}})['catch'](function(_0x446ec1){logger[_0x2c3e('0x1d')](_0x2c3e('0x2a'),JSON[_0x2c3e('0x12')](_0x446ec1));});}};EmailChannel['prototype']['handleImapEnd']=function(_0xed1e84){if(this[_0x2c3e('0xb')][_0xed1e84]&&this[_0x2c3e('0xb')][_0xed1e84][_0x2c3e('0xf')]){if(this['imapAccounts'][this[_0x2c3e('0xb')][_0xed1e84][_0x2c3e('0xf')]['id']]){delete this['imapAccounts'][this[_0x2c3e('0xb')][_0xed1e84]['Imap']['id']];}this[_0x2c3e('0xb')][_0xed1e84][_0x2c3e('0xf')]['lastSync']=moment();this['emit'](_0xed1e84);}};EmailChannel['prototype'][_0x2c3e('0x2b')]=function(_0x4f6436,_0x507742){if(this[_0x2c3e('0xb')][_0x4f6436]){this['mailAccounts'][_0x4f6436][_0x2c3e('0xf')][_0x2c3e('0x1f')]=_0x2c3e('0x1d');this['mailAccounts'][_0x4f6436][_0x2c3e('0xf')][_0x2c3e('0x10')]=_0x507742;return this[_0x2c3e('0xd')](_0x4f6436);}};EmailChannel[_0x2c3e('0xc')][_0x2c3e('0x2c')]=function(_0x593dec,_0x11a252){return this[_0x2c3e('0x2d')][_0x2c3e('0x2e')](_0x593dec,_0x11a252);};EmailChannel[_0x2c3e('0xc')]['verifySmtp']=function(_0x1511d8){var _0x40bbc6=this;if(this[_0x2c3e('0xb')][_0x1511d8['id']]){if(_[_0x2c3e('0x1e')](this[_0x2c3e('0xb')][_0x1511d8['id']][_0x2c3e('0x2f')])){this[_0x2c3e('0xb')][_0x1511d8['id']][_0x2c3e('0x2f')]={};}this[_0x2c3e('0xb')][_0x1511d8['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x2969bc,_0x39ea1b){return _0x40bbc6[_0x2c3e('0x2d')][_0x2c3e('0x30')](_0x1511d8)[_0x2c3e('0x28')](function(_0x20c2e8){_0x40bbc6[_0x2c3e('0xb')][_0x1511d8['id']]['Smtp'][_0x2c3e('0x1f')]='verified';_0x40bbc6['mailAccounts'][_0x1511d8['id']]['Smtp'][_0x2c3e('0x10')]='';_0x40bbc6[_0x2c3e('0xd')](_0x1511d8['id']);_0x2969bc(_0x20c2e8);})[_0x2c3e('0x31')](function(_0x53bbff){_0x40bbc6[_0x2c3e('0xb')][_0x1511d8['id']][_0x2c3e('0x2f')][_0x2c3e('0x1f')]='error';_0x40bbc6[_0x2c3e('0xb')][_0x1511d8['id']][_0x2c3e('0x2f')]['messageStatus']=_0x53bbff;_0x40bbc6[_0x2c3e('0xd')](_0x1511d8['id']);_0x39ea1b(_0x53bbff);});});}return this[_0x2c3e('0x2d')]['verify'](_0x1511d8);};module[_0x2c3e('0x32')]=EmailChannel; \ No newline at end of file +var _0x1aed=['sendMail','send','Smtp','verify','verified','moment','md5','../../../config/environment','../../../config/logger','email','redis','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','emit','key','Imap','status','messageStatus','isNil','stringify','mailAccount:update','prototype','refresh','active','hasOwnProperty','box','handleImapEmail','bind','end','handleImapEnd','error','disabled','messages','total','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1aed,0x69));var _0xd1ae=function(_0x1088f3,_0x567939){_0x1088f3=_0x1088f3-0x0;var _0x386077=_0x1aed[_0x1088f3];return _0x386077;};'use strict';var _=require('lodash');var moment=require(_0xd1ae('0x0'));var BPromise=require('bluebird');var md5=require(_0xd1ae('0x1'));var Redis=require('ioredis');var config=require(_0xd1ae('0x2'));var logger=require(_0xd1ae('0x3'))(_0xd1ae('0x4'));config[_0xd1ae('0x5')]=_['defaults'](config[_0xd1ae('0x5')],{'host':_0xd1ae('0x6'),'port':0x18eb});var io=require(_0xd1ae('0x7'))(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require(_0xd1ae('0x8'));var mailAccount=require(_0xd1ae('0x9'));var md5Accounts={};function EmailChannel(_0x499923){logger['info'](_0xd1ae('0xa'));this[_0xd1ae('0xb')]=_0x499923[_0xd1ae('0xb')];this[_0xd1ae('0xc')]={};this[_0xd1ae('0xd')]=new EmailSmtp();}EmailChannel['prototype'][_0xd1ae('0xe')]=function(_0x21732a){var _0x1bf4de=this[_0xd1ae('0xb')][_0x21732a];var _0x3ec5a3={'id':_0x1bf4de['id'],'name':_0x1bf4de['name'],'key':_0x1bf4de[_0xd1ae('0xf')],'active':_0x1bf4de['active'],'Imap':{'status':_0x1bf4de[_0xd1ae('0x10')][_0xd1ae('0x11')],'messageStatus':_0x1bf4de[_0xd1ae('0x10')][_0xd1ae('0x12')],'total':_0x1bf4de[_0xd1ae('0x10')]['total']}};if(_[_0xd1ae('0x13')](md5Accounts[_0x21732a])){md5Accounts[_0x21732a]={};}var _0x14e954=md5(JSON[_0xd1ae('0x14')](_0x3ec5a3));if(md5Accounts[_0x21732a]['md5']!==_0x14e954){md5Accounts[_0x21732a][_0xd1ae('0x1')]=_0x14e954;io[_0xd1ae('0xe')](_0xd1ae('0x15'),_0x3ec5a3);}};EmailChannel[_0xd1ae('0x16')][_0xd1ae('0x17')]=function(_0x927001){for(var _0x42a993 in _0x927001){if(_0x927001['hasOwnProperty'](_0x42a993)){if(_0x927001[_0x42a993][_0xd1ae('0x10')]&&_0x927001[_0x42a993][_0xd1ae('0x18')]){var _0x393038=_0x927001[_0x42a993][_0xd1ae('0x10')];if(!this[_0xd1ae('0xc')][_0xd1ae('0x19')](_0x393038['id'])){this['imapAccounts'][_0x393038['id']]=new EmailImap(_0x393038,_0x927001[_0x42a993]['email']);this[_0xd1ae('0xc')][_0x393038['id']]['on'](_0xd1ae('0x1a'),this['handleImapBox']['bind'](this,_0x42a993));this[_0xd1ae('0xc')][_0x393038['id']]['on'](_0xd1ae('0x4'),this[_0xd1ae('0x1b')][_0xd1ae('0x1c')](this,_0x42a993));this[_0xd1ae('0xc')][_0x393038['id']]['on'](_0xd1ae('0x1d'),this[_0xd1ae('0x1e')][_0xd1ae('0x1c')](this,_0x42a993));this['imapAccounts'][_0x393038['id']]['on'](_0xd1ae('0x1f'),this['handleImapError'][_0xd1ae('0x1c')](this,_0x42a993));}}else{if(_[_0xd1ae('0x13')](this[_0xd1ae('0xb')][_0x42a993][_0xd1ae('0x10')])){this['mailAccounts'][_0x42a993][_0xd1ae('0x10')]={};}this['mailAccounts'][_0x42a993][_0xd1ae('0x10')][_0xd1ae('0x11')]=_0xd1ae('0x20');this[_0xd1ae('0xb')][_0x42a993][_0xd1ae('0x10')]['messageStatus']='';this[_0xd1ae('0xe')](_0x42a993);}}}};EmailChannel[_0xd1ae('0x16')]['handleImapBox']=function(_0x1dacc1,_0x27937d){if(this[_0xd1ae('0xb')][_0x1dacc1]){this[_0xd1ae('0xb')][_0x1dacc1][_0xd1ae('0x10')][_0xd1ae('0x11')]='connected';this['mailAccounts'][_0x1dacc1][_0xd1ae('0x10')][_0xd1ae('0x12')]=_0x27937d['name'];if(_0x27937d[_0xd1ae('0x21')]){this[_0xd1ae('0xb')][_0x1dacc1][_0xd1ae('0x10')][_0xd1ae('0x22')]=_0x27937d['messages'][_0xd1ae('0x22')];}return this[_0xd1ae('0xe')](_0x1dacc1);}};EmailChannel['prototype']['handleImapEmail']=function(_0x56c20d,_0x2690d5){logger[_0xd1ae('0x23')](_0xd1ae('0x24'),_0x2690d5['firstName'],_0x2690d5[_0xd1ae('0x25')],_0x2690d5['from'],_0x56c20d);if(this[_0xd1ae('0xb')][_0x56c20d]){return mailAccount[_0xd1ae('0x26')](_0x56c20d,_0x2690d5)[_0xd1ae('0x27')](function(_0x4770df){if(_0x4770df){logger['info'](_0xd1ae('0x28'));}})[_0xd1ae('0x29')](function(_0x4c86cd){logger[_0xd1ae('0x1f')](_0xd1ae('0x2a'),JSON[_0xd1ae('0x14')](_0x4c86cd));});}};EmailChannel[_0xd1ae('0x16')]['handleImapEnd']=function(_0x4d198d){if(this[_0xd1ae('0xb')][_0x4d198d]&&this[_0xd1ae('0xb')][_0x4d198d]['Imap']){if(this[_0xd1ae('0xc')][this['mailAccounts'][_0x4d198d][_0xd1ae('0x10')]['id']]){delete this[_0xd1ae('0xc')][this[_0xd1ae('0xb')][_0x4d198d][_0xd1ae('0x10')]['id']];}this[_0xd1ae('0xb')][_0x4d198d][_0xd1ae('0x10')][_0xd1ae('0x2b')]=moment();this['emit'](_0x4d198d);}};EmailChannel[_0xd1ae('0x16')][_0xd1ae('0x2c')]=function(_0x4d16a7,_0x4483c1){if(this[_0xd1ae('0xb')][_0x4d16a7]){this[_0xd1ae('0xb')][_0x4d16a7][_0xd1ae('0x10')][_0xd1ae('0x11')]=_0xd1ae('0x1f');this[_0xd1ae('0xb')][_0x4d16a7]['Imap']['messageStatus']=_0x4483c1;return this[_0xd1ae('0xe')](_0x4d16a7);}};EmailChannel[_0xd1ae('0x16')][_0xd1ae('0x2d')]=function(_0x414b85,_0x4d6c3b){return this[_0xd1ae('0xd')][_0xd1ae('0x2e')](_0x414b85,_0x4d6c3b);};EmailChannel['prototype']['verifySmtp']=function(_0x4295b2){var _0x40052d=this;if(this['mailAccounts'][_0x4295b2['id']]){if(_[_0xd1ae('0x13')](this[_0xd1ae('0xb')][_0x4295b2['id']][_0xd1ae('0x2f')])){this[_0xd1ae('0xb')][_0x4295b2['id']]['Smtp']={};}this[_0xd1ae('0xb')][_0x4295b2['id']][_0xd1ae('0x2f')][_0xd1ae('0x2b')]=moment();return new BPromise(function(_0x5bf959,_0x28a867){return _0x40052d[_0xd1ae('0xd')][_0xd1ae('0x30')](_0x4295b2)[_0xd1ae('0x27')](function(_0x5bcf01){_0x40052d['mailAccounts'][_0x4295b2['id']][_0xd1ae('0x2f')][_0xd1ae('0x11')]=_0xd1ae('0x31');_0x40052d['mailAccounts'][_0x4295b2['id']]['Smtp'][_0xd1ae('0x12')]='';_0x40052d['emit'](_0x4295b2['id']);_0x5bf959(_0x5bcf01);})['catch'](function(_0x3a6574){_0x40052d[_0xd1ae('0xb')][_0x4295b2['id']][_0xd1ae('0x2f')][_0xd1ae('0x11')]='error';_0x40052d['mailAccounts'][_0x4295b2['id']]['Smtp'][_0xd1ae('0x12')]=_0x3a6574;_0x40052d['emit'](_0x4295b2['id']);_0x28a867(_0x3a6574);});});}return this[_0xd1ae('0xd')][_0xd1ae('0x30')](_0x4295b2);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index fe0b653..60924f9 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 _0x3c35=['host','port','tls','required','getHost','service','anonymous@xcally.com','openBox','handleOpenBox','emit','readUnseen','handleCloseBox','handleReadUnseen','fetch','message','handleFetchMessage','closeBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','handleFetchError','stringify','textCode','hasOwnProperty','upperFirst','exports','util','imap','lodash','mailparser','simpleParser','iconv','Iconv','events','./utils','../../../config/logger','email','INBOX','account','getAccount','once','ready','handleReady','bind','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','authentication','user','password'];(function(_0x2534cf,_0x545be6){var _0x221461=function(_0x379e83){while(--_0x379e83){_0x2534cf['push'](_0x2534cf['shift']());}};_0x221461(++_0x545be6);}(_0x3c35,0x14f));var _0x53c3=function(_0x18bd67,_0x5cd060){_0x18bd67=_0x18bd67-0x0;var _0x35e392=_0x3c35[_0x18bd67];return _0x35e392;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x53c3('0x0'));var Imap=require(_0x53c3('0x1'));var _=require(_0x53c3('0x2'));var rs=require('randomstring');var simpleParser=require(_0x53c3('0x3'))[_0x53c3('0x4')];var Iconv=require(_0x53c3('0x5'))[_0x53c3('0x6')];var EventEmitter=require(_0x53c3('0x7'))['EventEmitter'];var utils=require(_0x53c3('0x8'));var logger=require(_0x53c3('0x9'))(_0x53c3('0xa'));function EmailImap(_0x5a30ba,_0x596629){this['mailbox']=_0x53c3('0xb');this[_0x53c3('0xc')]=this[_0x53c3('0xd')](_0x5a30ba,_0x596629);this[_0x53c3('0x1')]=new Imap(this['account']);this[_0x53c3('0x1')][_0x53c3('0xe')](_0x53c3('0xf'),this[_0x53c3('0x10')][_0x53c3('0x11')](this));this['imap']['once'](_0x53c3('0x12'),this[_0x53c3('0x13')]['bind'](this));this[_0x53c3('0x1')]['on'](_0x53c3('0x14'),this[_0x53c3('0x15')][_0x53c3('0x11')](this));this['imap'][_0x53c3('0x16')]();}util[_0x53c3('0x17')](EmailImap,EventEmitter);EmailImap[_0x53c3('0x18')][_0x53c3('0xd')]=function(_0x55defb,_0x596fed){var _0x281ea3={'connTimeout':_0x55defb[_0x53c3('0x19')]?_0x55defb[_0x53c3('0x19')]*0x3e8:0x2710,'authTimeout':_0x55defb[_0x53c3('0x1a')]?_0x55defb[_0x53c3('0x1a')]*0x3e8:0x1388};if(_[_0x53c3('0x1b')](_0x55defb['service'])){if(_0x55defb[_0x53c3('0x1c')]){_0x281ea3[_0x53c3('0x1d')]=_0x55defb[_0x53c3('0x1d')];_0x281ea3[_0x53c3('0x1e')]=_0x55defb[_0x53c3('0x1e')];}_0x281ea3[_0x53c3('0x1f')]=_0x55defb[_0x53c3('0x1f')];_0x281ea3[_0x53c3('0x20')]=_0x55defb[_0x53c3('0x20')]||0x3e1;if(_0x55defb[_0x53c3('0x21')]){_0x281ea3[_0x53c3('0x21')]=!![];}else{_0x281ea3[_0x53c3('0x21')]=![];_0x281ea3['autotls']=_0x53c3('0x22');}}else{_0x281ea3['user']=_0x55defb['user'];_0x281ea3[_0x53c3('0x1e')]=_0x55defb[_0x53c3('0x1e')];_0x281ea3[_0x53c3('0x1f')]=utils[_0x53c3('0x23')](_0x55defb[_0x53c3('0x24')]);_0x281ea3[_0x53c3('0x20')]=0x3e1;_0x281ea3['tls']=!![];}_0x281ea3[_0x53c3('0xa')]=_0x596fed||_0x55defb['user']||_0x53c3('0x25');return _0x281ea3;};EmailImap[_0x53c3('0x18')]['handleReady']=function(){this[_0x53c3('0x1')][_0x53c3('0x26')](this['mailbox'],![],this[_0x53c3('0x27')][_0x53c3('0x11')](this));};EmailImap[_0x53c3('0x18')][_0x53c3('0x27')]=function(_0x3745be,_0x4bbaf9){if(_0x3745be){this['handleError'](_0x3745be,!![]);}else{this[_0x53c3('0x28')]('box',_0x4bbaf9);this[_0x53c3('0x29')]();}};EmailImap[_0x53c3('0x18')][_0x53c3('0x2a')]=function(_0x4a67ec){if(_0x4a67ec){this['handleError'](_0x4a67ec,!![]);}else{this[_0x53c3('0x1')][_0x53c3('0x12')]();}};EmailImap[_0x53c3('0x18')][_0x53c3('0x29')]=function(){this[_0x53c3('0x1')]['search'](['UNSEEN'],this[_0x53c3('0x2b')][_0x53c3('0x11')](this));};EmailImap['prototype'][_0x53c3('0x2b')]=function(_0x305860,_0x96749d){if(_0x305860){this[_0x53c3('0x15')](_0x305860,!![]);}else{if(_0x96749d['length']){try{var _0x3ff171=this[_0x53c3('0x1')][_0x53c3('0x2c')](_0x96749d,{'bodies':'','markSeen':!![]});_0x3ff171['on'](_0x53c3('0x2d'),this[_0x53c3('0x2e')][_0x53c3('0x11')](this));_0x3ff171[_0x53c3('0xe')](_0x53c3('0x14'),this['handleFetchError'][_0x53c3('0x11')](this));_0x3ff171[_0x53c3('0xe')](_0x53c3('0x12'),this['handleFetchEnd']['bind'](this));}catch(_0x285f93){logger[_0x53c3('0x14')](_0x285f93);}}else{this[_0x53c3('0x1')][_0x53c3('0x2f')](!![],this[_0x53c3('0x2a')][_0x53c3('0x11')](this));}}};EmailImap[_0x53c3('0x18')][_0x53c3('0x2e')]=function(_0x2016f1,_0x1c39c3){_0x2016f1['on'](_0x53c3('0x30'),this[_0x53c3('0x31')][_0x53c3('0x11')](this));_0x2016f1[_0x53c3('0xe')]('attributes',this[_0x53c3('0x32')][_0x53c3('0x11')](this));_0x2016f1[_0x53c3('0xe')]('end',this[_0x53c3('0x33')][_0x53c3('0x11')](this));};EmailImap[_0x53c3('0x18')]['handleMessageBody']=function(_0xc711ea,_0x574492){simpleParser(_0xc711ea,{'Iconv':Iconv},this[_0x53c3('0x34')][_0x53c3('0x11')](this));};EmailImap[_0x53c3('0x18')]['handleMessageAttributes']=function(_0x590044){};EmailImap[_0x53c3('0x18')][_0x53c3('0x33')]=function(){};EmailImap[_0x53c3('0x18')][_0x53c3('0x34')]=function(_0x392207,_0x346412){if(_0x392207){logger[_0x53c3('0x14')](_0x392207);}else{var _0xb36bab=this;utils[_0x53c3('0x35')](this[_0x53c3('0xc')],_0x346412,function(_0x20b2e6){_0xb36bab['emit'](_0x53c3('0xa'),_0x20b2e6);});}};EmailImap[_0x53c3('0x18')][_0x53c3('0x36')]=function(){this[_0x53c3('0x1')][_0x53c3('0x2f')](!![],this[_0x53c3('0x2a')]['bind'](this));};EmailImap[_0x53c3('0x18')][_0x53c3('0x37')]=function(_0x2aca62){this[_0x53c3('0x15')](_0x2aca62);this[_0x53c3('0x1')]['closeBox'](!![],this['handleCloseBox'][_0x53c3('0x11')](this));};EmailImap[_0x53c3('0x18')]['handleEnd']=function(){this[_0x53c3('0x28')](_0x53c3('0x12'));};EmailImap[_0x53c3('0x18')][_0x53c3('0x15')]=function(_0x18178b,_0x50fb1a){logger['error'](_0x53c3('0x15'),this['account']['email'],JSON[_0x53c3('0x38')](_0x18178b));var _0x34d07c='';if(_0x18178b){if(_0x18178b[_0x53c3('0x39')]){_0x34d07c=_0x18178b['textCode'];}else{for(var _0x2b5b4b in _0x18178b){if(_0x18178b[_0x53c3('0x3a')](_0x2b5b4b)){_0x34d07c+=_[_0x53c3('0x3b')](_0x2b5b4b)+':\x20'+_0x18178b[_0x2b5b4b]+'\x0a';}}}}if(_0x50fb1a){this['imap'][_0x53c3('0x12')]();}else{this['emit']('error',_0x34d07c);this[_0x53c3('0x28')](_0x53c3('0x12'));}};module[_0x53c3('0x3c')]=EmailImap; \ No newline at end of file +var _0x058c=['prototype','connTimeout','authTimeout','isNil','service','user','password','port','tls','host','anonymous@xcally.com','handleReady','openBox','handleOpenBox','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','end','error','closeBox','handleCloseBox','body','attributes','handleMessageAttributes','handleMessageEnd','account','textCode','hasOwnProperty','upperFirst','imap','lodash','randomstring','mailparser','simpleParser','events','EventEmitter','email','mailbox','getAccount','once','ready','bind','handleEnd','handleError','connect','inherits'];(function(_0x5dc3be,_0x4415cc){var _0x4ddbfc=function(_0x436a4b){while(--_0x436a4b){_0x5dc3be['push'](_0x5dc3be['shift']());}};_0x4ddbfc(++_0x4415cc);}(_0x058c,0x169));var _0xc058=function(_0x17d6c6,_0x2f8c73){_0x17d6c6=_0x17d6c6-0x0;var _0x3a90bc=_0x058c[_0x17d6c6];return _0x3a90bc;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var Imap=require(_0xc058('0x0'));var _=require(_0xc058('0x1'));var rs=require(_0xc058('0x2'));var simpleParser=require(_0xc058('0x3'))[_0xc058('0x4')];var Iconv=require('iconv')['Iconv'];var EventEmitter=require(_0xc058('0x5'))[_0xc058('0x6')];var utils=require('./utils');var logger=require('../../../config/logger')(_0xc058('0x7'));function EmailImap(_0x550bc0,_0xc4db7e){this[_0xc058('0x8')]='INBOX';this['account']=this[_0xc058('0x9')](_0x550bc0,_0xc4db7e);this[_0xc058('0x0')]=new Imap(this['account']);this['imap'][_0xc058('0xa')](_0xc058('0xb'),this['handleReady'][_0xc058('0xc')](this));this[_0xc058('0x0')][_0xc058('0xa')]('end',this[_0xc058('0xd')][_0xc058('0xc')](this));this['imap']['on']('error',this[_0xc058('0xe')][_0xc058('0xc')](this));this['imap'][_0xc058('0xf')]();}util[_0xc058('0x10')](EmailImap,EventEmitter);EmailImap[_0xc058('0x11')][_0xc058('0x9')]=function(_0x50a053,_0x3a067e){var _0x4e3a51={'connTimeout':_0x50a053[_0xc058('0x12')]?_0x50a053[_0xc058('0x12')]*0x3e8:0x2710,'authTimeout':_0x50a053[_0xc058('0x13')]?_0x50a053['authTimeout']*0x3e8:0x1388};if(_[_0xc058('0x14')](_0x50a053[_0xc058('0x15')])){if(_0x50a053['authentication']){_0x4e3a51[_0xc058('0x16')]=_0x50a053['user'];_0x4e3a51[_0xc058('0x17')]=_0x50a053[_0xc058('0x17')];}_0x4e3a51['host']=_0x50a053['host'];_0x4e3a51['port']=_0x50a053[_0xc058('0x18')]||0x3e1;if(_0x50a053[_0xc058('0x19')]){_0x4e3a51[_0xc058('0x19')]=!![];}else{_0x4e3a51['tls']=![];_0x4e3a51['autotls']='required';}}else{_0x4e3a51['user']=_0x50a053[_0xc058('0x16')];_0x4e3a51['password']=_0x50a053[_0xc058('0x17')];_0x4e3a51[_0xc058('0x1a')]=utils['getHost'](_0x50a053[_0xc058('0x15')]);_0x4e3a51[_0xc058('0x18')]=0x3e1;_0x4e3a51[_0xc058('0x19')]=!![];}_0x4e3a51['email']=_0x3a067e||_0x50a053[_0xc058('0x16')]||_0xc058('0x1b');return _0x4e3a51;};EmailImap[_0xc058('0x11')][_0xc058('0x1c')]=function(){this[_0xc058('0x0')][_0xc058('0x1d')](this[_0xc058('0x8')],![],this[_0xc058('0x1e')][_0xc058('0xc')](this));};EmailImap[_0xc058('0x11')]['handleOpenBox']=function(_0x2f879a,_0x1df8d3){if(_0x2f879a){this[_0xc058('0xe')](_0x2f879a,!![]);}else{this[_0xc058('0x1f')](_0xc058('0x20'),_0x1df8d3);this[_0xc058('0x21')]();}};EmailImap[_0xc058('0x11')]['handleCloseBox']=function(_0x8abbec){if(_0x8abbec){this[_0xc058('0xe')](_0x8abbec,!![]);}else{this[_0xc058('0x0')]['end']();}};EmailImap['prototype'][_0xc058('0x21')]=function(){this[_0xc058('0x0')][_0xc058('0x22')]([_0xc058('0x23')],this[_0xc058('0x24')][_0xc058('0xc')](this));};EmailImap[_0xc058('0x11')]['handleReadUnseen']=function(_0x2e4cea,_0x84e00f){if(_0x2e4cea){this[_0xc058('0xe')](_0x2e4cea,!![]);}else{if(_0x84e00f[_0xc058('0x25')]){try{var _0xc6a11e=this['imap'][_0xc058('0x26')](_0x84e00f,{'bodies':'','markSeen':!![]});_0xc6a11e['on'](_0xc058('0x27'),this[_0xc058('0x28')][_0xc058('0xc')](this));_0xc6a11e[_0xc058('0xa')]('error',this[_0xc058('0x29')]['bind'](this));_0xc6a11e['once'](_0xc058('0x2a'),this['handleFetchEnd'][_0xc058('0xc')](this));}catch(_0x412caf){logger[_0xc058('0x2b')](_0x412caf);}}else{this[_0xc058('0x0')][_0xc058('0x2c')](!![],this[_0xc058('0x2d')][_0xc058('0xc')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x1d882e,_0x2ae96d){_0x1d882e['on'](_0xc058('0x2e'),this['handleMessageBody'][_0xc058('0xc')](this));_0x1d882e[_0xc058('0xa')](_0xc058('0x2f'),this[_0xc058('0x30')][_0xc058('0xc')](this));_0x1d882e[_0xc058('0xa')](_0xc058('0x2a'),this[_0xc058('0x31')][_0xc058('0xc')](this));};EmailImap[_0xc058('0x11')]['handleMessageBody']=function(_0x3762db,_0x2d1216){simpleParser(_0x3762db,{'Iconv':Iconv},this['handleSimpleParser'][_0xc058('0xc')](this));};EmailImap['prototype'][_0xc058('0x30')]=function(_0x4363df){};EmailImap[_0xc058('0x11')]['handleMessageEnd']=function(){};EmailImap[_0xc058('0x11')]['handleSimpleParser']=function(_0x5b3217,_0x155d01){if(_0x5b3217){logger['error'](_0x5b3217);}else{var _0x52dee3=this;utils['parser'](this[_0xc058('0x32')],_0x155d01,function(_0x33cc3c){_0x52dee3[_0xc058('0x1f')](_0xc058('0x7'),_0x33cc3c);});}};EmailImap[_0xc058('0x11')]['handleFetchEnd']=function(){this['imap'][_0xc058('0x2c')](!![],this[_0xc058('0x2d')][_0xc058('0xc')](this));};EmailImap[_0xc058('0x11')][_0xc058('0x29')]=function(_0x41c141){this[_0xc058('0xe')](_0x41c141);this[_0xc058('0x0')][_0xc058('0x2c')](!![],this[_0xc058('0x2d')][_0xc058('0xc')](this));};EmailImap[_0xc058('0x11')][_0xc058('0xd')]=function(){this[_0xc058('0x1f')](_0xc058('0x2a'));};EmailImap['prototype']['handleError']=function(_0x13301c,_0xb0565d){logger[_0xc058('0x2b')](_0xc058('0xe'),this['account'][_0xc058('0x7')],JSON['stringify'](_0x13301c));var _0x1445c9='';if(_0x13301c){if(_0x13301c[_0xc058('0x33')]){_0x1445c9=_0x13301c[_0xc058('0x33')];}else{for(var _0x5c135c in _0x13301c){if(_0x13301c[_0xc058('0x34')](_0x5c135c)){_0x1445c9+=_[_0xc058('0x35')](_0x5c135c)+':\x20'+_0x13301c[_0x5c135c]+'\x0a';}}}}if(_0xb0565d){this[_0xc058('0x0')][_0xc058('0x2a')]();}else{this[_0xc058('0x1f')](_0xc058('0x2b'),_0x1445c9);this[_0xc058('0x1f')]('end');}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 98dc4f8..6736428 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 _0xab81=['nodemailer-plugin-inline-base64','prototype','send','compile','toString','verify','createTransport','Not\x20verifired','nodemailer'];(function(_0x7b9c0d,_0x1d64f9){var _0x11651f=function(_0x313df7){while(--_0x313df7){_0x7b9c0d['push'](_0x7b9c0d['shift']());}};_0x11651f(++_0x1d64f9);}(_0xab81,0xe9));var _0x1ab8=function(_0xa7762c,_0x4100c9){_0xa7762c=_0xa7762c-0x0;var _0x2327bd=_0xab81[_0xa7762c];return _0x2327bd;};'use strict';var nodemailer=require(_0x1ab8('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0x1ab8('0x1'));function EmailSmtp(){}EmailSmtp[_0x1ab8('0x2')][_0x1ab8('0x3')]=function(_0x3d7da8,_0x58d1ef){return new BPromise(function(_0x4c25e8,_0x5148c3){var _0x4745e5=nodemailer['createTransport'](_0x3d7da8);_0x4745e5['use'](_0x1ab8('0x4'),inlineBase64());_0x4745e5['sendMail'](_0x58d1ef,function(_0x4795b0,_0x2b7cb9){if(_0x4795b0){_0x5148c3(_0x4795b0[_0x1ab8('0x5')]());}else{_0x4c25e8(_0x2b7cb9);}});});};EmailSmtp['prototype'][_0x1ab8('0x6')]=function(_0x2c8bfe){return new BPromise(function(_0x43020b,_0x31ce18){var _0x15eb34=nodemailer[_0x1ab8('0x7')](_0x2c8bfe);_0x15eb34['verify'](function(_0x5b7939,_0xfbfcc2){if(_0x5b7939){_0x31ce18(_0x5b7939[_0x1ab8('0x5')]());}else{if(_0xfbfcc2){_0x43020b(_0xfbfcc2);}else{_0x31ce18(_0x1ab8('0x8'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x29e5=['exports','nodemailer','bluebird','prototype','send','createTransport','use','compile','sendMail','toString','verify','Not\x20verifired'];(function(_0x376703,_0x5aa7c3){var _0x219e48=function(_0x59498d){while(--_0x59498d){_0x376703['push'](_0x376703['shift']());}};_0x219e48(++_0x5aa7c3);}(_0x29e5,0xb5));var _0x529e=function(_0x3d07ad,_0x3d4abe){_0x3d07ad=_0x3d07ad-0x0;var _0x511f22=_0x29e5[_0x3d07ad];return _0x511f22;};'use strict';var nodemailer=require(_0x529e('0x0'));var BPromise=require(_0x529e('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x529e('0x2')][_0x529e('0x3')]=function(_0x111c2c,_0x3a5eae){return new BPromise(function(_0x2d1c33,_0x479b69){var _0x3c9a38=nodemailer[_0x529e('0x4')](_0x111c2c);_0x3c9a38[_0x529e('0x5')](_0x529e('0x6'),inlineBase64());_0x3c9a38[_0x529e('0x7')](_0x3a5eae,function(_0x367011,_0x1779fb){if(_0x367011){_0x479b69(_0x367011[_0x529e('0x8')]());}else{_0x2d1c33(_0x1779fb);}});});};EmailSmtp[_0x529e('0x2')][_0x529e('0x9')]=function(_0x388bdd){return new BPromise(function(_0x3f1932,_0x92d2fe){var _0x2d738e=nodemailer[_0x529e('0x4')](_0x388bdd);_0x2d738e[_0x529e('0x9')](function(_0x5ab51e,_0x34e8c2){if(_0x5ab51e){_0x92d2fe(_0x5ab51e[_0x529e('0x8')]());}else{if(_0x34e8c2){_0x3f1932(_0x34e8c2);}else{_0x92d2fe(_0x529e('0xa'));}}});});};module[_0x529e('0xb')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index bb2873f..252e3d6 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 _0x5233=['value','address','anonymous','generate','@xcally.com','name','length','slice','join','Anonymous','split','html','replace','includes','\x20[Attachment:\x20','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','127.0.0.1','randomstring','node-tnef','../../../config/logger','email','../../../config/environment','head'];(function(_0x5a6c6d,_0x48b780){var _0x3b8089=function(_0x1ec3fb){while(--_0x1ec3fb){_0x5a6c6d['push'](_0x5a6c6d['shift']());}};_0x3b8089(++_0x48b780);}(_0x5233,0x10e));var _0x3523=function(_0x119a0b,_0x3d5901){_0x119a0b=_0x119a0b-0x0;var _0x11363e=_0x5233[_0x119a0b];return _0x11363e;};'use strict';var _=require('lodash');var moment=require('moment');var random=require(_0x3523('0x0'));var fs=require('fs');var path=require('path');var util=require('util');var tnef=require(_0x3523('0x1'));var logger=require(_0x3523('0x2'))(_0x3523('0x3'));var config=require(_0x3523('0x4'));function getAddress(_0x51571a){var _0x31a21b=_[_0x3523('0x5')](_0x51571a[_0x3523('0x6')]);return _0x31a21b&&_0x31a21b['address']?_0x31a21b[_0x3523('0x7')]:_0x3523('0x8')+random[_0x3523('0x9')](0x6)+_0x3523('0xa');}function getFirstName(_0x18ed1e){var _0x3df085=_[_0x3523('0x5')](_0x18ed1e['value']);if(_0x3df085&&_0x3df085['name']){var _0x1d2047=_0x3df085[_0x3523('0xb')]['split'](/\s+/);return _0x1d2047[_0x3523('0xc')]?_0x1d2047[_0x3523('0xd')](0x0,-0x1)[_0x3523('0xe')]('\x20'):_0x3df085['name'];}return _0x3523('0xf');}function getLastName(_0x2da38a){var _0x340295=_[_0x3523('0x5')](_0x2da38a[_0x3523('0x6')]);if(_0x340295&&_0x340295[_0x3523('0xb')]){var _0x1a97b6=_0x340295[_0x3523('0xb')][_0x3523('0x10')](/\s+/);return _0x1a97b6[_0x3523('0xc')]>0x1?_0x1a97b6['pop']():'';}return'';}function getMails(_0x1eee22,_0x5002ee){var _0x9f1c0e='';for(var _0x436c1d=0x0;_0x436c1d<_0x5002ee['value'][_0x3523('0xc')];_0x436c1d+=0x1){if(_0x5002ee[_0x3523('0x6')][_0x436c1d][_0x3523('0x7')]!==_0x1eee22){if(!_['isEmpty'](_0x9f1c0e)){_0x9f1c0e+=',';}_0x9f1c0e+=_0x5002ee[_0x3523('0x6')][_0x436c1d][_0x3523('0xb')]||_0x5002ee[_0x3523('0x6')][_0x436c1d][_0x3523('0x7')]||'';_0x9f1c0e+='\x20<';_0x9f1c0e+=_0x5002ee['value'][_0x436c1d]['address']?_0x5002ee[_0x3523('0x6')][_0x436c1d][_0x3523('0x7')]:_0x3523('0x8')+random[_0x3523('0x9')](0x6)+'@xcally.com';_0x9f1c0e+='>';}}return _0x9f1c0e;}function parseEmail(_0x35b048,_0x2e4f37,_0x4348e4){if(_0x2e4f37[_0x3523('0x11')]){var _0x72fda1=/)<[^<]*)*<\/script>/gi;while(_0x72fda1['test'](_0x2e4f37['html'])){_0x2e4f37[_0x3523('0x11')]=_0x2e4f37[_0x3523('0x11')][_0x3523('0x12')](_0x72fda1,'');}if(_0x2e4f37[_0x3523('0x11')][_0x3523('0x13')](_0x3523('0x14'))){var _0x274022=[];_0x2e4f37['attachments'][_0x3523('0x15')](_0x42b5f3=>{_0x274022[_0x3523('0x16')](_0x42b5f3[_0x3523('0x17')]);});var _0x57dbda=/]+>/g;var _0x4e48ce=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x5a449f=_0x2e4f37[_0x3523('0x11')][_0x3523('0x12')](_0x4e48ce,'_SRC');var _0x5595b6=_0x5a449f['replace'](_0x57dbda,_0x3523('0x18'));for(let _0x841e58=0x0;_0x841e58<_0x274022[_0x3523('0xc')];_0x841e58++){var _0x419c6a=_0x5595b6['replace'](_0x3523('0x18'),_0x3523('0x19')+_0x274022[_0x841e58]+'\x20]');_0x5595b6=_0x419c6a;}_0x2e4f37['html']=_0x5595b6;}_0x4348e4[_0x3523('0x1a')]=_0x2e4f37[_0x3523('0x11')];}else{_0x4348e4[_0x3523('0x1a')]=_0x2e4f37[_0x3523('0x1b')];}if(_0x4348e4['body']){_0x4348e4['body']=_0x4348e4[_0x3523('0x1a')][_0x3523('0x12')](/Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','name','split','length','slice','join','Anonymous','pop','isEmpty','@xcally.com','html','test','replace','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x1c08e9[_0x88c9('0x11')]():'';}return'';}function getMails(_0x237f10,_0x1cc7b1){var _0x359f3d='';for(var _0x542704=0x0;_0x542704<_0x1cc7b1[_0x88c9('0x7')][_0x88c9('0xd')];_0x542704+=0x1){if(_0x1cc7b1[_0x88c9('0x7')][_0x542704][_0x88c9('0x8')]!==_0x237f10){if(!_[_0x88c9('0x12')](_0x359f3d)){_0x359f3d+=',';}_0x359f3d+=_0x1cc7b1[_0x88c9('0x7')][_0x542704][_0x88c9('0xb')]||_0x1cc7b1['value'][_0x542704][_0x88c9('0x8')]||'';_0x359f3d+='\x20<';_0x359f3d+=_0x1cc7b1[_0x88c9('0x7')][_0x542704][_0x88c9('0x8')]?_0x1cc7b1[_0x88c9('0x7')][_0x542704][_0x88c9('0x8')]:_0x88c9('0x9')+random[_0x88c9('0xa')](0x6)+_0x88c9('0x13');_0x359f3d+='>';}}return _0x359f3d;}function parseEmail(_0x4f3480,_0x297247,_0x176d19){if(_0x297247[_0x88c9('0x14')]){var _0x114146=/)<[^<]*)*<\/script>/gi;while(_0x114146[_0x88c9('0x15')](_0x297247[_0x88c9('0x14')])){_0x297247[_0x88c9('0x14')]=_0x297247[_0x88c9('0x14')][_0x88c9('0x16')](_0x114146,'');}if(_0x297247[_0x88c9('0x14')]['includes'](_0x88c9('0x17'))){var _0x25f314=[];_0x297247[_0x88c9('0x18')][_0x88c9('0x19')](_0x3f19e5=>{_0x25f314[_0x88c9('0x1a')](_0x3f19e5['filename']);});var _0x58a631=/]+>/g;var _0x4d1830=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x1834f3=_0x297247[_0x88c9('0x14')][_0x88c9('0x16')](_0x4d1830,'_SRC');var _0x207bc8=_0x1834f3[_0x88c9('0x16')](_0x58a631,_0x88c9('0x1b'));for(let _0x5c46b0=0x0;_0x5c46b0<_0x25f314[_0x88c9('0xd')];_0x5c46b0++){var _0x11befd=_0x207bc8[_0x88c9('0x16')]('_IMG',_0x88c9('0x1c')+_0x25f314[_0x5c46b0]+_0x88c9('0x1d'));_0x207bc8=_0x11befd;}_0x297247[_0x88c9('0x14')]=_0x207bc8;}_0x176d19['body']=_0x297247[_0x88c9('0x14')];}else{_0x176d19[_0x88c9('0x1e')]=_0x297247[_0x88c9('0x1f')];}if(_0x176d19[_0x88c9('0x1e')]){_0x176d19[_0x88c9('0x1e')]=_0x176d19['body'][_0x88c9('0x16')](/0x0){if(this[_0x17466c+_0xd34b('0x26')]>0x0&&this[_0x17466c+_0xd34b('0x27')]>=this[_0x17466c+_0xd34b('0x26')]){return _0xd34b('0x28');}else{return _0xd34b('0x29');}}else{return _0xd34b('0x2a');}};Agent['prototype'][_0xd34b('0x23')]=function(){var _0x49c485=[_0xd34b('0x2b'),_0xd34b('0x2c'),'openchannel','fax','sms',_0xd34b('0x2d')];for(var _0x187b33=0x0;_0x187b33<_0x49c485[_0xd34b('0x2e')];_0x187b33+=0x1){var _0x594413=this[_0xd34b('0x25')](_0x49c485[_0x187b33]);if(this[_0x49c485[_0x187b33]+_0xd34b('0x2f')]!==_0x594413){this[_0x49c485[_0x187b33]+'StatusTime']=_[_0xd34b('0x30')](moment()[_0xd34b('0x31')]('x'));}this[_0x49c485[_0x187b33]+_0xd34b('0x2f')]=_0x594413;}var _0x5a121a={'id':this['id'],'name':this[_0xd34b('0x32')],'online':this['online'],'voicePause':this[_0xd34b('0x8')],'chatPause':this[_0xd34b('0x9')],'mailPause':this[_0xd34b('0xa')],'smsPause':this['smsPause'],'faxPause':this[_0xd34b('0xb')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xd34b('0xe')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xd34b('0x10')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xd34b('0x12')],'mailStatusTime':this[_0xd34b('0x33')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0xd34b('0x34')],'faxStatus':this[_0xd34b('0x15')],'faxStatusTime':this[_0xd34b('0x16')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xd34b('0x18')],'smsStatus':this[_0xd34b('0x35')],'smsStatusTime':this[_0xd34b('0x36')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xd34b('0x1a')],'whatsappStatus':this[_0xd34b('0x37')],'whatsappStatusTime':this[_0xd34b('0x1b')],'whatsappCapacity':this[_0xd34b('0x1c')],'whatsappCurrentCapacity':this[_0xd34b('0x1d')],'openchannelStatus':this[_0xd34b('0x38')],'openchannelStatusTime':this[_0xd34b('0x1e')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xd34b('0x20')],'busy':this[_0xd34b('0x21')],'busyQueue':this[_0xd34b('0x22')]};var _0x466129=md5(JSON[_0xd34b('0x39')](_0x5a121a));if(this['md5']!==_0x466129){this[_0xd34b('0x3a')]=_0x466129;io[_0xd34b('0x3b')](_0xd34b('0x3c'),_0x5a121a);}};module['exports']=Agent; \ No newline at end of file +var _0x5f6a=['faxCurrentCapacity','smsCurrentCapacity','whatsappStatusTime','openchannelStatus','openchannelStatusTime','stringify','md5','emit','user:save','exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','mailStatus','unknown','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','working','prototype','mail','chat','openchannel','fax','sms','whatsapp','length','toNumber','format','Status','chatPause','mailStatusTime'];(function(_0x5c13d5,_0x38a129){var _0x361eb9=function(_0x33e1aa){while(--_0x33e1aa){_0x5c13d5['push'](_0x5c13d5['shift']());}};_0x361eb9(++_0x38a129);}(_0x5f6a,0xc4));var _0xa5f6=function(_0x54ec69,_0xa94a59){_0x54ec69=_0x54ec69-0x0;var _0x5a03de=_0x5f6a[_0x54ec69];return _0x5a03de;};'use strict';var _=require(_0xa5f6('0x0'));var moment=require('moment');var md5=require('md5');var Redis=require(_0xa5f6('0x1'));var config=require(_0xa5f6('0x2'));config[_0xa5f6('0x3')]=_[_0xa5f6('0x4')](config['redis'],{'host':_0xa5f6('0x5'),'port':0x18eb});var io=require(_0xa5f6('0x6'))(new Redis(config[_0xa5f6('0x3')]));function Agent(_0xde771e){this['id']=_0xde771e['id']||0x0;this[_0xa5f6('0x7')]=_0xde771e[_0xa5f6('0x7')]||'';this[_0xa5f6('0x8')]=_0xde771e[_0xa5f6('0x8')]||!![];this[_0xa5f6('0x9')]=_0xde771e[_0xa5f6('0x9')]||![];this['chatPause']=_0xde771e['chatPause']||![];this['mailPause']=_0xde771e[_0xa5f6('0xa')]||![];this[_0xa5f6('0xb')]=_0xde771e[_0xa5f6('0xb')]||![];this[_0xa5f6('0xc')]=_0xde771e[_0xa5f6('0xc')]||![];this['openchannelPause']=_0xde771e[_0xa5f6('0xd')]||![];this[_0xa5f6('0xe')]='unknown';this[_0xa5f6('0xf')]=0x0;this['chatCapacity']=_0xde771e[_0xa5f6('0x10')]||0x0;this['chatCurrentCapacity']=0x0;this[_0xa5f6('0x11')]=_0xa5f6('0x12');this['mailStatusTime']=0x0;this[_0xa5f6('0x13')]=_0xde771e[_0xa5f6('0x13')]||0x0;this[_0xa5f6('0x14')]=0x0;this[_0xa5f6('0x15')]='unknown';this[_0xa5f6('0x16')]=0x0;this[_0xa5f6('0x17')]=_0xde771e[_0xa5f6('0x17')]||0x0;this['faxCurrentCapacity']=0x0;this[_0xa5f6('0x18')]=_0xa5f6('0x12');this[_0xa5f6('0x19')]=0x0;this[_0xa5f6('0x1a')]=_0xde771e[_0xa5f6('0x1a')]||0x0;this['smsCurrentCapacity']=0x0;this[_0xa5f6('0x1b')]=_0xa5f6('0x12');this['whatsappStatusTime']=0x0;this[_0xa5f6('0x1c')]=_0xde771e[_0xa5f6('0x1c')]||0x0;this[_0xa5f6('0x1d')]=0x0;this['openchannelStatus']='unknown';this['openchannelStatusTime']=0x0;this[_0xa5f6('0x1e')]=_0xde771e['openchannelCapacity']||0x0;this[_0xa5f6('0x1f')]=0x0;this[_0xa5f6('0x20')]=![];this[_0xa5f6('0x21')]=undefined;this['md5']='';this[_0xa5f6('0x22')]();}Agent['prototype'][_0xa5f6('0x23')]=function(_0x3595f4){if(this[_0x3595f4+_0xa5f6('0x24')]>0x0){if(this[_0x3595f4+_0xa5f6('0x25')]>0x0&&this[_0x3595f4+_0xa5f6('0x24')]>=this[_0x3595f4+'Capacity']){return'maxcapacity';}else{return _0xa5f6('0x26');}}else{return'idle';}};Agent[_0xa5f6('0x27')]['updateRealtime']=function(){var _0x284e00=[_0xa5f6('0x28'),_0xa5f6('0x29'),_0xa5f6('0x2a'),_0xa5f6('0x2b'),_0xa5f6('0x2c'),_0xa5f6('0x2d')];for(var _0x1bf562=0x0;_0x1bf562<_0x284e00[_0xa5f6('0x2e')];_0x1bf562+=0x1){var _0x1ded63=this[_0xa5f6('0x23')](_0x284e00[_0x1bf562]);if(this[_0x284e00[_0x1bf562]+'Status']!==_0x1ded63){this[_0x284e00[_0x1bf562]+'StatusTime']=_[_0xa5f6('0x2f')](moment()[_0xa5f6('0x30')]('x'));}this[_0x284e00[_0x1bf562]+_0xa5f6('0x31')]=_0x1ded63;}var _0x12e192={'id':this['id'],'name':this[_0xa5f6('0x7')],'online':this[_0xa5f6('0x8')],'voicePause':this['voicePause'],'chatPause':this[_0xa5f6('0x32')],'mailPause':this[_0xa5f6('0xa')],'smsPause':this[_0xa5f6('0xc')],'faxPause':this[_0xa5f6('0xb')],'openchannelPause':this[_0xa5f6('0xd')],'chatStatus':this[_0xa5f6('0xe')],'chatStatusTime':this[_0xa5f6('0xf')],'chatCapacity':this[_0xa5f6('0x10')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xa5f6('0x11')],'mailStatusTime':this[_0xa5f6('0x33')],'mailCapacity':this[_0xa5f6('0x13')],'mailCurrentCapacity':this[_0xa5f6('0x14')],'faxStatus':this[_0xa5f6('0x15')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xa5f6('0x17')],'faxCurrentCapacity':this[_0xa5f6('0x34')],'smsStatus':this[_0xa5f6('0x18')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xa5f6('0x1a')],'smsCurrentCapacity':this[_0xa5f6('0x35')],'whatsappStatus':this[_0xa5f6('0x1b')],'whatsappStatusTime':this[_0xa5f6('0x36')],'whatsappCapacity':this[_0xa5f6('0x1c')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xa5f6('0x37')],'openchannelStatusTime':this[_0xa5f6('0x38')],'openchannelCapacity':this[_0xa5f6('0x1e')],'openchannelCurrentCapacity':this[_0xa5f6('0x1f')],'busy':this['busy'],'busyQueue':this[_0xa5f6('0x21')]};var _0x9b2ff1=md5(JSON[_0xa5f6('0x39')](_0x12e192));if(this[_0xa5f6('0x3a')]!==_0x9b2ff1){this['md5']=_0x9b2ff1;io[_0xa5f6('0x3b')](_0xa5f6('0x3c'),_0x12e192);}};module[_0xa5f6('0x3d')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 796239b..d0c06a3 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 _0x24fe=['socket.io-emitter','name','timeout','strategy','Agents','updateRouting','prototype','_rr','mapAgentsId','map','loggedIn','paused','online','chatPause','available','format','chat:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost'];(function(_0x487ab4,_0x1e24e8){var _0x3bef77=function(_0x5ce664){while(--_0x5ce664){_0x487ab4['push'](_0x487ab4['shift']());}};_0x3bef77(++_0x1e24e8);}(_0x24fe,0xaf));var _0xe24f=function(_0x47d321,_0xb39cb0){_0x47d321=_0x47d321-0x0;var _0x7df0aa=_0x24fe[_0x47d321];return _0x7df0aa;};'use strict';var _=require(_0xe24f('0x0'));var md5=require(_0xe24f('0x1'));var util=require(_0xe24f('0x2'));var Redis=require('ioredis');var config=require(_0xe24f('0x3'));config[_0xe24f('0x4')]=_[_0xe24f('0x5')](config[_0xe24f('0x4')],{'host':_0xe24f('0x6'),'port':0x18eb});var io=require(_0xe24f('0x7'))(new Redis(config[_0xe24f('0x4')]));function ChatQueue(_0x4e7bcc){this['id']=_0x4e7bcc['id']||0x0;this[_0xe24f('0x8')]=_0x4e7bcc[_0xe24f('0x8')]||'';this[_0xe24f('0x9')]=_0x4e7bcc[_0xe24f('0x9')]||0xa;this[_0xe24f('0xa')]=_0x4e7bcc['strategy']||'beepall';this[_0xe24f('0xb')]=_0x4e7bcc[_0xe24f('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0xe24f('0x1')]='';this[_0xe24f('0xc')]();this['updateRealtime']();}ChatQueue[_0xe24f('0xd')][_0xe24f('0xc')]=function(){var _0x55a7e2=this['mapAgentsId'][_0xe24f('0xe')];this[_0xe24f('0xf')]=_[_0xe24f('0x10')](this[_0xe24f('0xb')],'id');this['mapAgentsId'][_0xe24f('0xe')]=_0x55a7e2;};ChatQueue['prototype']['updateRealtime']=function(){this[_0xe24f('0x11')]=0x0;this[_0xe24f('0x12')]=0x0;for(var _0x5bd93e=0x0;_0x5bd93e=0x0?this['available']:0x0;var _0x126b42={'id':this['id'],'available':this[_0xe24f('0x15')],'loggedIn':this[_0xe24f('0x11')],'name':this[_0xe24f('0x8')],'paused':this[_0xe24f('0x12')],'waiting':this['waiting']};var _0x1b378e=md5(JSON['stringify'](_0x126b42));if(this[_0xe24f('0x1')]!==_0x1b378e){this[_0xe24f('0x1')]=_0x1b378e;io['to'](util[_0xe24f('0x16')](_0xe24f('0x17'),_0x126b42['name']))[_0xe24f('0x18')]('chat_queue:save',_0x126b42);}};module[_0xe24f('0x19')]=ChatQueue; \ No newline at end of file +var _0x46f9=['paused','available','stringify','format','chat:queue:%s','chat_queue:save','exports','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','_rr','map','prototype','updateRealtime','loggedIn','online','chatPause'];(function(_0x273977,_0x2d5898){var _0x58dbd2=function(_0xf7781){while(--_0xf7781){_0x273977['push'](_0x273977['shift']());}};_0x58dbd2(++_0x2d5898);}(_0x46f9,0x77));var _0x946f=function(_0x4a9be7,_0x274e5e){_0x4a9be7=_0x4a9be7-0x0;var _0x2af3cb=_0x46f9[_0x4a9be7];return _0x2af3cb;};'use strict';var _=require('lodash');var md5=require(_0x946f('0x0'));var util=require(_0x946f('0x1'));var Redis=require(_0x946f('0x2'));var config=require('../../../config/environment');config[_0x946f('0x3')]=_[_0x946f('0x4')](config[_0x946f('0x3')],{'host':_0x946f('0x5'),'port':0x18eb});var io=require(_0x946f('0x6'))(new Redis(config['redis']));function ChatQueue(_0x389f7a){this['id']=_0x389f7a['id']||0x0;this['name']=_0x389f7a[_0x946f('0x7')]||'';this[_0x946f('0x8')]=_0x389f7a[_0x946f('0x8')]||0xa;this[_0x946f('0x9')]=_0x389f7a[_0x946f('0x9')]||_0x946f('0xa');this[_0x946f('0xb')]=_0x389f7a[_0x946f('0xb')];this[_0x946f('0xc')]={};this['waiting']=0x0;this[_0x946f('0x0')]='';this[_0x946f('0xd')]();this['updateRealtime']();}ChatQueue['prototype'][_0x946f('0xd')]=function(){var _0x2f7b42=this[_0x946f('0xc')][_0x946f('0xe')];this[_0x946f('0xc')]=_[_0x946f('0xf')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x2f7b42;};ChatQueue[_0x946f('0x10')][_0x946f('0x11')]=function(){this[_0x946f('0x12')]=0x0;this['paused']=0x0;for(var _0x147e3b=0x0;_0x147e3b=0x0?this['available']:0x0;var _0x26b991={'id':this['id'],'available':this[_0x946f('0x16')],'loggedIn':this[_0x946f('0x12')],'name':this[_0x946f('0x7')],'paused':this[_0x946f('0x15')],'waiting':this['waiting']};var _0x531527=md5(JSON[_0x946f('0x17')](_0x26b991));if(this['md5']!==_0x531527){this[_0x946f('0x0')]=_0x531527;io['to'](util[_0x946f('0x18')](_0x946f('0x19'),_0x26b991[_0x946f('0x7')]))['emit'](_0x946f('0x1a'),_0x26b991);}};module[_0x946f('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 329e511..e31ae7f 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 _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x1f9a15,_0x3aae6e){var _0x112953=function(_0x1bbb9b){while(--_0x1bbb9b){_0x1f9a15['push'](_0x1f9a15['shift']());}};_0x112953(++_0x3aae6e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file +var _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x53f664,_0x47b9ca){var _0x4d9071=function(_0x2e9a7d){while(--_0x2e9a7d){_0x53f664['push'](_0x53f664['shift']());}};_0x4d9071(++_0x47b9ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index a648c92..e9de022 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 _0x8b84=['name','Intervals','exports'];(function(_0x10699f,_0x566101){var _0x343355=function(_0x5cd59f){while(--_0x5cd59f){_0x10699f['push'](_0x10699f['shift']());}};_0x343355(++_0x566101);}(_0x8b84,0x1bf));var _0x48b8=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x8b84[_0x397e5f];return _0x5302b8;};'use strict';function Interval(_0x4a15d1){this['id']=_0x4a15d1['id']||0x0;this[_0x48b8('0x0')]=_0x4a15d1[_0x48b8('0x0')]||'';this[_0x48b8('0x1')]=_0x4a15d1[_0x48b8('0x1')]||{};}module[_0x48b8('0x2')]=Interval; \ No newline at end of file +var _0xabdc=['name','Intervals'];(function(_0x47ef38,_0x3446b0){var _0x23b40d=function(_0x4ca03f){while(--_0x4ca03f){_0x47ef38['push'](_0x47ef38['shift']());}};_0x23b40d(++_0x3446b0);}(_0xabdc,0xc4));var _0xcabd=function(_0x5da77f,_0x4e92d8){_0x5da77f=_0x5da77f-0x0;var _0x132ac8=_0xabdc[_0x5da77f];return _0x132ac8;};'use strict';function Interval(_0x1877a3){this['id']=_0x1877a3['id']||0x0;this[_0xcabd('0x0')]=_0x1877a3[_0xcabd('0x0')]||'';this[_0xcabd('0x1')]=_0x1877a3[_0xcabd('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index b901308..ebf5922 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 _0x2df1=['exports','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','map','prototype','loggedIn','length','online','mailPause','paused','available','waiting','mail:queue:%s','emit','mail_queue:save'];(function(_0x4a7864,_0x4ae8b6){var _0x5c3537=function(_0x98039f){while(--_0x98039f){_0x4a7864['push'](_0x4a7864['shift']());}};_0x5c3537(++_0x4ae8b6);}(_0x2df1,0x1ee));var _0x12df=function(_0x2b305e,_0x2f0b44){_0x2b305e=_0x2b305e-0x0;var _0x1cff27=_0x2df1[_0x2b305e];return _0x1cff27;};'use strict';var _=require(_0x12df('0x0'));var md5=require(_0x12df('0x1'));var util=require(_0x12df('0x2'));var Redis=require(_0x12df('0x3'));var config=require('../../../config/environment');config[_0x12df('0x4')]=_[_0x12df('0x5')](config[_0x12df('0x4')],{'host':_0x12df('0x6'),'port':0x18eb});var io=require(_0x12df('0x7'))(new Redis(config[_0x12df('0x4')]));function MailQueue(_0xea14e1){this['id']=_0xea14e1['id']||0x0;this[_0x12df('0x8')]=_0xea14e1['name']||'';this[_0x12df('0x9')]=_0xea14e1['timeout']||0xa;this[_0x12df('0xa')]=_0xea14e1[_0x12df('0xa')]||_0x12df('0xb');this['Agents']=_0xea14e1[_0x12df('0xc')];this[_0x12df('0xd')]={};this['waiting']=0x0;this['md5']='';this[_0x12df('0xe')]();this[_0x12df('0xf')]();}MailQueue['prototype'][_0x12df('0xe')]=function(){var _0x261749=this[_0x12df('0xd')]['_rr'];this[_0x12df('0xd')]=_[_0x12df('0x10')](this[_0x12df('0xc')],'id');this[_0x12df('0xd')]['_rr']=_0x261749;};MailQueue[_0x12df('0x11')][_0x12df('0xf')]=function(){this[_0x12df('0x12')]=0x0;this['paused']=0x0;for(var _0x34bec2=0x0;_0x34bec2=0x0?this[_0x12df('0x17')]:0x0;var _0x5a843b={'id':this['id'],'available':this[_0x12df('0x17')],'loggedIn':this[_0x12df('0x12')],'name':this[_0x12df('0x8')],'paused':this['paused'],'waiting':this[_0x12df('0x18')]};var _0x10f900=md5(JSON['stringify'](_0x5a843b));if(this[_0x12df('0x1')]!==_0x10f900){this[_0x12df('0x1')]=_0x10f900;io['to'](util['format'](_0x12df('0x19'),_0x5a843b[_0x12df('0x8')]))[_0x12df('0x1a')](_0x12df('0x1b'),_0x5a843b);}};module[_0x12df('0x1c')]=MailQueue; \ No newline at end of file +var _0x21c9=['lodash','md5','util','ioredis','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','updateRouting','prototype','map','updateRealtime','loggedIn','paused','online','mailPause','available','waiting','stringify','mail:queue:%s','mail_queue:save','exports'];(function(_0x39758d,_0x346423){var _0x44ac11=function(_0x175008){while(--_0x175008){_0x39758d['push'](_0x39758d['shift']());}};_0x44ac11(++_0x346423);}(_0x21c9,0xea));var _0x921c=function(_0x3ddb1a,_0xaae356){_0x3ddb1a=_0x3ddb1a-0x0;var _0x767d3b=_0x21c9[_0x3ddb1a];return _0x767d3b;};'use strict';var _=require(_0x921c('0x0'));var md5=require(_0x921c('0x1'));var util=require(_0x921c('0x2'));var Redis=require(_0x921c('0x3'));var config=require('../../../config/environment');config[_0x921c('0x4')]=_[_0x921c('0x5')](config['redis'],{'host':_0x921c('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0x7b6f50){this['id']=_0x7b6f50['id']||0x0;this[_0x921c('0x7')]=_0x7b6f50[_0x921c('0x7')]||'';this[_0x921c('0x8')]=_0x7b6f50[_0x921c('0x8')]||0xa;this[_0x921c('0x9')]=_0x7b6f50['strategy']||'beepall';this[_0x921c('0xa')]=_0x7b6f50['Agents'];this[_0x921c('0xb')]={};this['waiting']=0x0;this[_0x921c('0x1')]='';this[_0x921c('0xc')]();this['updateRealtime']();}MailQueue[_0x921c('0xd')][_0x921c('0xc')]=function(){var _0x55da04=this[_0x921c('0xb')]['_rr'];this[_0x921c('0xb')]=_[_0x921c('0xe')](this[_0x921c('0xa')],'id');this['mapAgentsId']['_rr']=_0x55da04;};MailQueue['prototype'][_0x921c('0xf')]=function(){this[_0x921c('0x10')]=0x0;this[_0x921c('0x11')]=0x0;for(var _0x208857=0x0;_0x208857=0x0?this['available']:0x0;var _0x5a39f6={'id':this['id'],'available':this[_0x921c('0x14')],'loggedIn':this[_0x921c('0x10')],'name':this[_0x921c('0x7')],'paused':this[_0x921c('0x11')],'waiting':this[_0x921c('0x15')]};var _0x44effc=md5(JSON[_0x921c('0x16')](_0x5a39f6));if(this['md5']!==_0x44effc){this[_0x921c('0x1')]=_0x44effc;io['to'](util['format'](_0x921c('0x17'),_0x5a39f6['name']))['emit'](_0x921c('0x18'),_0x5a39f6);}};module[_0x921c('0x19')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index d8b4f13..53d28ee 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 _0xe988=['lodash','md5','ioredis','defaults','localhost','socket.io-emitter','redis','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','exports'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0xe988,0xea));var _0x8e98=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xe988[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0x8e98('0x0'));var md5=require(_0x8e98('0x1'));var util=require('util');var Redis=require(_0x8e98('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x8e98('0x3')](config['redis'],{'host':_0x8e98('0x4'),'port':0x18eb});var io=require(_0x8e98('0x5'))(new Redis(config[_0x8e98('0x6')]));function OpenchannelQueue(_0x330365){this['id']=_0x330365['id']||0x0;this[_0x8e98('0x7')]=_0x330365['name']||'';this['timeout']=_0x330365[_0x8e98('0x8')]||0xa;this['strategy']=_0x330365['strategy']||_0x8e98('0x9');this[_0x8e98('0xa')]=_0x330365[_0x8e98('0xa')];this[_0x8e98('0xb')]={};this[_0x8e98('0xc')]=0x0;this[_0x8e98('0x1')]='';this[_0x8e98('0xd')]();this[_0x8e98('0xe')]();}OpenchannelQueue[_0x8e98('0xf')]['updateRouting']=function(){var _0x178f95=this[_0x8e98('0xb')][_0x8e98('0x10')];this[_0x8e98('0xb')]=_['map'](this[_0x8e98('0xa')],'id');this['mapAgentsId'][_0x8e98('0x10')]=_0x178f95;};OpenchannelQueue[_0x8e98('0xf')][_0x8e98('0xe')]=function(){this[_0x8e98('0x11')]=0x0;this[_0x8e98('0x12')]=0x0;for(var _0x296cbb=0x0;_0x296cbb=0x0?this[_0x8e98('0x14')]:0x0;var _0xc8c02={'id':this['id'],'available':this[_0x8e98('0x14')],'loggedIn':this[_0x8e98('0x11')],'name':this[_0x8e98('0x7')],'paused':this[_0x8e98('0x12')],'waiting':this[_0x8e98('0xc')]};var _0x2b3567=md5(JSON[_0x8e98('0x15')](_0xc8c02));if(this[_0x8e98('0x1')]!==_0x2b3567){this['md5']=_0x2b3567;io['to'](util[_0x8e98('0x16')](_0x8e98('0x17'),_0xc8c02['name']))[_0x8e98('0x18')]('openchannel_queue:save',_0xc8c02);}};module[_0x8e98('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x82e6=['map','prototype','loggedIn','openchannelPause','paused','available','stringify','openchannel:queue:%s','emit','exports','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRealtime','updateRouting'];(function(_0x1440d9,_0x4a2c7e){var _0x4a0cfb=function(_0x9dc96c){while(--_0x9dc96c){_0x1440d9['push'](_0x1440d9['shift']());}};_0x4a0cfb(++_0x4a2c7e);}(_0x82e6,0x1e5));var _0x682e=function(_0x175e89,_0x20835f){_0x175e89=_0x175e89-0x0;var _0x2ed996=_0x82e6[_0x175e89];return _0x2ed996;};'use strict';var _=require('lodash');var md5=require(_0x682e('0x0'));var util=require(_0x682e('0x1'));var Redis=require('ioredis');var config=require(_0x682e('0x2'));config[_0x682e('0x3')]=_[_0x682e('0x4')](config[_0x682e('0x3')],{'host':_0x682e('0x5'),'port':0x18eb});var io=require(_0x682e('0x6'))(new Redis(config[_0x682e('0x3')]));function OpenchannelQueue(_0x4a77b1){this['id']=_0x4a77b1['id']||0x0;this[_0x682e('0x7')]=_0x4a77b1[_0x682e('0x7')]||'';this['timeout']=_0x4a77b1[_0x682e('0x8')]||0xa;this['strategy']=_0x4a77b1['strategy']||_0x682e('0x9');this[_0x682e('0xa')]=_0x4a77b1[_0x682e('0xa')];this[_0x682e('0xb')]={};this[_0x682e('0xc')]=0x0;this[_0x682e('0x0')]='';this['updateRouting']();this[_0x682e('0xd')]();}OpenchannelQueue['prototype'][_0x682e('0xe')]=function(){var _0x27d362=this[_0x682e('0xb')]['_rr'];this[_0x682e('0xb')]=_[_0x682e('0xf')](this[_0x682e('0xa')],'id');this[_0x682e('0xb')]['_rr']=_0x27d362;};OpenchannelQueue[_0x682e('0x10')][_0x682e('0xd')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x4d63c8=0x0;_0x4d63c8=0x0?this[_0x682e('0x14')]:0x0;var _0x24234c={'id':this['id'],'available':this[_0x682e('0x14')],'loggedIn':this[_0x682e('0x11')],'name':this[_0x682e('0x7')],'paused':this[_0x682e('0x13')],'waiting':this[_0x682e('0xc')]};var _0x4e04c7=md5(JSON[_0x682e('0x15')](_0x24234c));if(this[_0x682e('0x0')]!==_0x4e04c7){this[_0x682e('0x0')]=_0x4e04c7;io['to'](util['format'](_0x682e('0x16'),_0x24234c['name']))[_0x682e('0x17')]('openchannel_queue:save',_0x24234c);}};module[_0x682e('0x18')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 65a9441..46762a0 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 _0xb7e7=['util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','paused','available','stringify','sms:queue:%s','emit','exports','lodash'];(function(_0x4b777b,_0x11e99c){var _0x3c59dd=function(_0x2c44a9){while(--_0x2c44a9){_0x4b777b['push'](_0x4b777b['shift']());}};_0x3c59dd(++_0x11e99c);}(_0xb7e7,0x121));var _0x7b7e=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0xb7e7[_0x42f009];return _0x22a1e0;};'use strict';var _=require(_0x7b7e('0x0'));var md5=require('md5');var util=require(_0x7b7e('0x1'));var Redis=require('ioredis');var config=require(_0x7b7e('0x2'));config['redis']=_[_0x7b7e('0x3')](config['redis'],{'host':_0x7b7e('0x4'),'port':0x18eb});var io=require(_0x7b7e('0x5'))(new Redis(config[_0x7b7e('0x6')]));function SmsQueue(_0x52047f){this['id']=_0x52047f['id']||0x0;this['name']=_0x52047f[_0x7b7e('0x7')]||'';this[_0x7b7e('0x8')]=_0x52047f[_0x7b7e('0x8')]||0xa;this['strategy']=_0x52047f[_0x7b7e('0x9')]||_0x7b7e('0xa');this[_0x7b7e('0xb')]=_0x52047f[_0x7b7e('0xb')];this[_0x7b7e('0xc')]={};this[_0x7b7e('0xd')]=0x0;this[_0x7b7e('0xe')]='';this['updateRouting']();this[_0x7b7e('0xf')]();}SmsQueue[_0x7b7e('0x10')][_0x7b7e('0x11')]=function(){var _0x29b622=this[_0x7b7e('0xc')][_0x7b7e('0x12')];this[_0x7b7e('0xc')]=_[_0x7b7e('0x13')](this[_0x7b7e('0xb')],'id');this['mapAgentsId'][_0x7b7e('0x12')]=_0x29b622;};SmsQueue[_0x7b7e('0x10')]['updateRealtime']=function(){this[_0x7b7e('0x14')]=0x0;this['paused']=0x0;for(var _0x4c6011=0x0;_0x4c6011=0x0?this[_0x7b7e('0x18')]:0x0;var _0x200ef7={'id':this['id'],'available':this[_0x7b7e('0x18')],'loggedIn':this[_0x7b7e('0x14')],'name':this[_0x7b7e('0x7')],'paused':this[_0x7b7e('0x17')],'waiting':this[_0x7b7e('0xd')]};var _0x3bec7d=md5(JSON[_0x7b7e('0x19')](_0x200ef7));if(this[_0x7b7e('0xe')]!==_0x3bec7d){this[_0x7b7e('0xe')]=_0x3bec7d;io['to'](util['format'](_0x7b7e('0x1a'),_0x200ef7[_0x7b7e('0x7')]))[_0x7b7e('0x1b')]('sms_queue:save',_0x200ef7);}};module[_0x7b7e('0x1c')]=SmsQueue; \ No newline at end of file +var _0xd8b0=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','smsPause','available','stringify','format','sms:queue:%s','exports','lodash','md5','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x1f4a84,_0x1118c2){var _0x40f4eb=function(_0x5c9e9c){while(--_0x5c9e9c){_0x1f4a84['push'](_0x1f4a84['shift']());}};_0x40f4eb(++_0x1118c2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var md5=require(_0x0d8b('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0d8b('0x2')]=_[_0x0d8b('0x3')](config[_0x0d8b('0x2')],{'host':_0x0d8b('0x4'),'port':0x18eb});var io=require(_0x0d8b('0x5'))(new Redis(config['redis']));function SmsQueue(_0x5e15e6){this['id']=_0x5e15e6['id']||0x0;this[_0x0d8b('0x6')]=_0x5e15e6[_0x0d8b('0x6')]||'';this[_0x0d8b('0x7')]=_0x5e15e6['timeout']||0xa;this[_0x0d8b('0x8')]=_0x5e15e6[_0x0d8b('0x8')]||'beepall';this[_0x0d8b('0x9')]=_0x5e15e6[_0x0d8b('0x9')];this[_0x0d8b('0xa')]={};this[_0x0d8b('0xb')]=0x0;this[_0x0d8b('0x1')]='';this[_0x0d8b('0xc')]();this[_0x0d8b('0xd')]();}SmsQueue[_0x0d8b('0xe')]['updateRouting']=function(){var _0x3c4bfa=this['mapAgentsId'][_0x0d8b('0xf')];this[_0x0d8b('0xa')]=_[_0x0d8b('0x10')](this[_0x0d8b('0x9')],'id');this[_0x0d8b('0xa')][_0x0d8b('0xf')]=_0x3c4bfa;};SmsQueue[_0x0d8b('0xe')][_0x0d8b('0xd')]=function(){this[_0x0d8b('0x11')]=0x0;this[_0x0d8b('0x12')]=0x0;for(var _0x5ad086=0x0;_0x5ad086=0x0?this[_0x0d8b('0x15')]:0x0;var _0x333674={'id':this['id'],'available':this[_0x0d8b('0x15')],'loggedIn':this[_0x0d8b('0x11')],'name':this[_0x0d8b('0x6')],'paused':this['paused'],'waiting':this[_0x0d8b('0xb')]};var _0x23d58f=md5(JSON[_0x0d8b('0x16')](_0x333674));if(this[_0x0d8b('0x1')]!==_0x23d58f){this[_0x0d8b('0x1')]=_0x23d58f;io['to'](util[_0x0d8b('0x17')](_0x0d8b('0x18'),_0x333674[_0x0d8b('0x6')]))['emit']('sms_queue:save',_0x333674);}};module[_0x0d8b('0x19')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 2f1d635..4e83249 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 _0x7286=['prototype','map','mapAgentsId','loggedIn','paused','length','whatsappPause','available','stringify','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime'];(function(_0x20aae1,_0x51efd4){var _0x510601=function(_0x20895f){while(--_0x20895f){_0x20aae1['push'](_0x20aae1['shift']());}};_0x510601(++_0x51efd4);}(_0x7286,0x194));var _0x6728=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x7286[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x6728('0x0'));var md5=require(_0x6728('0x1'));var util=require(_0x6728('0x2'));var Redis=require(_0x6728('0x3'));var config=require(_0x6728('0x4'));config[_0x6728('0x5')]=_[_0x6728('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x6728('0x7'))(new Redis(config[_0x6728('0x5')]));function WhatsappQueue(_0x4be8cb){this['id']=_0x4be8cb['id']||0x0;this[_0x6728('0x8')]=_0x4be8cb[_0x6728('0x8')]||'';this[_0x6728('0x9')]=_0x4be8cb[_0x6728('0x9')]||0xa;this[_0x6728('0xa')]=_0x4be8cb[_0x6728('0xa')]||_0x6728('0xb');this[_0x6728('0xc')]=_0x4be8cb[_0x6728('0xc')];this['mapAgentsId']={};this[_0x6728('0xd')]=0x0;this[_0x6728('0x1')]='';this[_0x6728('0xe')]();this[_0x6728('0xf')]();}WhatsappQueue[_0x6728('0x10')][_0x6728('0xe')]=function(){var _0x1047d6=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0x6728('0x11')](this[_0x6728('0xc')],'id');this[_0x6728('0x12')]['_rr']=_0x1047d6;};WhatsappQueue[_0x6728('0x10')][_0x6728('0xf')]=function(){this[_0x6728('0x13')]=0x0;this[_0x6728('0x14')]=0x0;for(var _0xca8471=0x0;_0xca8471=0x0?this[_0x6728('0x17')]:0x0;var _0x236fb2={'id':this['id'],'available':this[_0x6728('0x17')],'loggedIn':this[_0x6728('0x13')],'name':this[_0x6728('0x8')],'paused':this[_0x6728('0x14')],'waiting':this[_0x6728('0xd')]};var _0x3aa2bb=md5(JSON[_0x6728('0x18')](_0x236fb2));if(this[_0x6728('0x1')]!==_0x3aa2bb){this[_0x6728('0x1')]=_0x3aa2bb;io['to'](util['format']('whatsapp:queue:%s',_0x236fb2[_0x6728('0x8')]))[_0x6728('0x19')](_0x6728('0x1a'),_0x236fb2);}};module[_0x6728('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0x5663=['online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','loggedIn','paused','length'];(function(_0x5bdc3a,_0x18ac2a){var _0x9e0274=function(_0x2821a8){while(--_0x2821a8){_0x5bdc3a['push'](_0x5bdc3a['shift']());}};_0x9e0274(++_0x18ac2a);}(_0x5663,0xe9));var _0x3566=function(_0x3b934f,_0x59dc45){_0x3b934f=_0x3b934f-0x0;var _0x136c82=_0x5663[_0x3b934f];return _0x136c82;};'use strict';var _=require(_0x3566('0x0'));var md5=require(_0x3566('0x1'));var util=require(_0x3566('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x3566('0x3')]=_[_0x3566('0x4')](config[_0x3566('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x3566('0x5'))(new Redis(config[_0x3566('0x3')]));function WhatsappQueue(_0x5f54ec){this['id']=_0x5f54ec['id']||0x0;this[_0x3566('0x6')]=_0x5f54ec['name']||'';this['timeout']=_0x5f54ec[_0x3566('0x7')]||0xa;this['strategy']=_0x5f54ec[_0x3566('0x8')]||'beepall';this[_0x3566('0x9')]=_0x5f54ec[_0x3566('0x9')];this[_0x3566('0xa')]={};this[_0x3566('0xb')]=0x0;this['md5']='';this[_0x3566('0xc')]();this[_0x3566('0xd')]();}WhatsappQueue[_0x3566('0xe')][_0x3566('0xc')]=function(){var _0x4026e5=this[_0x3566('0xa')]['_rr'];this['mapAgentsId']=_[_0x3566('0xf')](this[_0x3566('0x9')],'id');this[_0x3566('0xa')]['_rr']=_0x4026e5;};WhatsappQueue[_0x3566('0xe')]['updateRealtime']=function(){this[_0x3566('0x10')]=0x0;this[_0x3566('0x11')]=0x0;for(var _0x58cd6c=0x0;_0x58cd6c=0x0?this['available']:0x0;var _0x147109={'id':this['id'],'available':this[_0x3566('0x15')],'loggedIn':this[_0x3566('0x10')],'name':this[_0x3566('0x6')],'paused':this[_0x3566('0x11')],'waiting':this['waiting']};var _0x1c3ba0=md5(JSON[_0x3566('0x16')](_0x147109));if(this[_0x3566('0x1')]!==_0x1c3ba0){this['md5']=_0x1c3ba0;io['to'](util[_0x3566('0x17')](_0x3566('0x18'),_0x147109[_0x3566('0x6')]))[_0x3566('0x19')](_0x3566('0x1a'),_0x147109);}};module[_0x3566('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index bd8ef34..115251c 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 _0x7217=['../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','smsQueues','mailQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','isUndefined','initIntervals','mergeFromDatabase','initOpenchannelQueues','updateRouting','updateRealtime','initFaxQueues','exports','bluebird','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7217,0x19e));var _0x7721=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x7217[_0x5037ab];return _0x512adb;};'use strict';var BPromise=require(_0x7721('0x0'));var util=require('util');var _=require(_0x7721('0x1'));var moment=require(_0x7721('0x2'));var Agent=require(_0x7721('0x3'));var Interval=require(_0x7721('0x4'));var OpenchannelQueue=require(_0x7721('0x5'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require('../model/smsQueue');var MailQueue=require(_0x7721('0x6'));var FaxQueue=require(_0x7721('0x7'));var WhatsappQueue=require(_0x7721('0x8'));var Realtime=function(){this[_0x7721('0x9')]={};this[_0x7721('0xa')]={};this[_0x7721('0xb')]={};this[_0x7721('0xc')]={};this[_0x7721('0xd')]={};this[_0x7721('0xe')]={};this[_0x7721('0xf')]={};this[_0x7721('0x10')]={};this[_0x7721('0x11')]={};this[_0x7721('0x12')]={};this[_0x7721('0x13')]={};this[_0x7721('0x14')]={};this['faxQueuesWaitingInteractions']={};this[_0x7721('0x15')]={};};function freeIsNotKey(_0x29bc8f,_0x8729a6,_0xf78099){var _0xa8977c=_[_0x7721('0x16')](_0x29bc8f,function(_0x1e7fd7,_0x27b36b){return _0x1e7fd7[_0xf78099];});for(var _0x55b4ca in _0x8729a6){if(_0x8729a6[_0x7721('0x17')](_0x55b4ca)){if(!_0xa8977c[_0x55b4ca]){delete _0x8729a6[_0x55b4ca];}}}}Realtime[_0x7721('0x18')]['mergeFromDatabase']=function(_0x109900,_0x30da54){for(var _0x3f01c5 in _0x30da54){if(_0x109900[_0x7721('0x17')](_0x3f01c5)){_0x109900[_0x3f01c5]=_0x30da54[_0x3f01c5];}}};Realtime['prototype'][_0x7721('0x19')]=function(){var _0x25b1c0=this;return function(_0x534f1b){if(_0x534f1b){freeIsNotKey(_0x534f1b,_0x25b1c0['agents'],'id');for(var _0x4b183e=0x0,_0x5ed54={},_0x25a628={};_0x4b183e<_0x534f1b[_0x7721('0x1a')];_0x4b183e+=0x1){_0x5ed54=_0x534f1b[_0x4b183e];if(_[_0x7721('0x1b')](_0x25b1c0['agents'][_0x5ed54['id']])){_0x25b1c0[_0x7721('0x9')][_0x5ed54['id']]=new Agent(_0x5ed54);}else{_0x25b1c0['mergeFromDatabase'](_0x25b1c0[_0x7721('0x9')][_0x5ed54['id']],_0x5ed54);}}}return _0x25b1c0['agents'];};};Realtime[_0x7721('0x18')][_0x7721('0x1c')]=function(){var _0x3ab5a5=this;return function(_0x3e140d){if(_0x3e140d){freeIsNotKey(_0x3e140d,_0x3ab5a5[_0x7721('0xa')],'id');for(var _0x40af90=0x0,_0x402820={},_0x413263={};_0x40af90<_0x3e140d[_0x7721('0x1a')];_0x40af90+=0x1){_0x402820=_0x3e140d[_0x40af90];if(_[_0x7721('0x1b')](_0x3ab5a5['intervals'][_0x402820['id']])){_0x3ab5a5[_0x7721('0xa')][_0x402820['id']]=new Interval(_0x402820);}else{_0x3ab5a5[_0x7721('0x1d')](_0x3ab5a5[_0x7721('0xa')][_0x402820['id']],_0x402820);}}}return _0x3ab5a5[_0x7721('0xa')];};};Realtime['prototype'][_0x7721('0x1e')]=function(){var _0x512f31=this;return function(_0xb9e9dd){if(_0xb9e9dd){freeIsNotKey(_0xb9e9dd,_0x512f31[_0x7721('0xb')],'id');for(var _0x3e8a4e=0x0,_0x1caad8={},_0x121cc4={};_0x3e8a4e<_0xb9e9dd[_0x7721('0x1a')];_0x3e8a4e+=0x1){_0x1caad8=_0xb9e9dd[_0x3e8a4e];if(_[_0x7721('0x1b')](_0x512f31['openchannelQueues'][_0x1caad8['id']])){_0x512f31[_0x7721('0xb')][_0x1caad8['id']]=new OpenchannelQueue(_0x1caad8);}else{_0x512f31[_0x7721('0x1d')](_0x512f31[_0x7721('0xb')][_0x1caad8['id']],_0x1caad8);}_0x512f31[_0x7721('0xb')][_0x1caad8['id']][_0x7721('0x1f')]();_0x512f31[_0x7721('0xb')][_0x1caad8['id']][_0x7721('0x20')]();}}return _0x512f31[_0x7721('0xb')];};};Realtime[_0x7721('0x18')]['initChatQueues']=function(){var _0x258ddf=this;return function(_0x5b0551){if(_0x5b0551){freeIsNotKey(_0x5b0551,_0x258ddf['chatQueues'],'id');for(var _0x315202=0x0,_0x343c19={},_0x53c904={};_0x315202<_0x5b0551[_0x7721('0x1a')];_0x315202+=0x1){_0x343c19=_0x5b0551[_0x315202];if(_[_0x7721('0x1b')](_0x258ddf[_0x7721('0xc')][_0x343c19['id']])){_0x258ddf[_0x7721('0xc')][_0x343c19['id']]=new ChatQueue(_0x343c19);}else{_0x258ddf[_0x7721('0x1d')](_0x258ddf['chatQueues'][_0x343c19['id']],_0x343c19);}_0x258ddf[_0x7721('0xc')][_0x343c19['id']][_0x7721('0x1f')]();_0x258ddf['chatQueues'][_0x343c19['id']]['updateRealtime']();}}return _0x258ddf[_0x7721('0xc')];};};Realtime[_0x7721('0x18')]['initSmsQueues']=function(){var _0x46f772=this;return function(_0x4651b5){if(_0x4651b5){freeIsNotKey(_0x4651b5,_0x46f772[_0x7721('0xd')],'id');for(var _0x58d54b=0x0,_0x3d9a32={},_0x1ff31b={};_0x58d54b<_0x4651b5[_0x7721('0x1a')];_0x58d54b+=0x1){_0x3d9a32=_0x4651b5[_0x58d54b];if(_[_0x7721('0x1b')](_0x46f772[_0x7721('0xd')][_0x3d9a32['id']])){_0x46f772['smsQueues'][_0x3d9a32['id']]=new SmsQueue(_0x3d9a32);}else{_0x46f772[_0x7721('0x1d')](_0x46f772[_0x7721('0xd')][_0x3d9a32['id']],_0x3d9a32);}_0x46f772[_0x7721('0xd')][_0x3d9a32['id']]['updateRouting']();_0x46f772[_0x7721('0xd')][_0x3d9a32['id']][_0x7721('0x20')]();}}return _0x46f772['smsQueues'];};};Realtime[_0x7721('0x18')]['initMailQueues']=function(){var _0x2d6ba0=this;return function(_0x326c50){if(_0x326c50){freeIsNotKey(_0x326c50,_0x2d6ba0[_0x7721('0xe')],'id');for(var _0x1d894b=0x0,_0x1c84c0={},_0x13c635={};_0x1d894b<_0x326c50[_0x7721('0x1a')];_0x1d894b+=0x1){_0x1c84c0=_0x326c50[_0x1d894b];if(_[_0x7721('0x1b')](_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']])){_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']]=new MailQueue(_0x1c84c0);}else{_0x2d6ba0[_0x7721('0x1d')](_0x2d6ba0['mailQueues'][_0x1c84c0['id']],_0x1c84c0);}_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']]['updateRouting']();_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']][_0x7721('0x20')]();}}return _0x2d6ba0[_0x7721('0xe')];};};Realtime[_0x7721('0x18')][_0x7721('0x21')]=function(){var _0x378ba5=this;return function(_0x482b70){if(_0x482b70){freeIsNotKey(_0x482b70,_0x378ba5['faxQueues'],'id');for(var _0x4cadef=0x0,_0x539560={},_0x18001c={};_0x4cadef<_0x482b70[_0x7721('0x1a')];_0x4cadef+=0x1){_0x539560=_0x482b70[_0x4cadef];if(_[_0x7721('0x1b')](_0x378ba5[_0x7721('0xf')][_0x539560['id']])){_0x378ba5['faxQueues'][_0x539560['id']]=new FaxQueue(_0x539560);}else{_0x378ba5[_0x7721('0x1d')](_0x378ba5['faxQueues'][_0x539560['id']],_0x539560);}_0x378ba5[_0x7721('0xf')][_0x539560['id']][_0x7721('0x1f')]();_0x378ba5['faxQueues'][_0x539560['id']][_0x7721('0x20')]();}}return _0x378ba5[_0x7721('0xf')];};};Realtime['prototype']['initWhatsappQueues']=function(){var _0x3d84d3=this;return function(_0xfc4dc4){if(_0xfc4dc4){freeIsNotKey(_0xfc4dc4,_0x3d84d3[_0x7721('0x10')],'id');for(var _0x15e34d=0x0,_0x577af9={},_0x2db173={};_0x15e34d<_0xfc4dc4[_0x7721('0x1a')];_0x15e34d+=0x1){_0x577af9=_0xfc4dc4[_0x15e34d];if(_[_0x7721('0x1b')](_0x3d84d3[_0x7721('0x10')][_0x577af9['id']])){_0x3d84d3[_0x7721('0x10')][_0x577af9['id']]=new WhatsappQueue(_0x577af9);}else{_0x3d84d3['mergeFromDatabase'](_0x3d84d3[_0x7721('0x10')][_0x577af9['id']],_0x577af9);}_0x3d84d3['whatsappQueues'][_0x577af9['id']][_0x7721('0x1f')]();_0x3d84d3['whatsappQueues'][_0x577af9['id']][_0x7721('0x20')]();}}return _0x3d84d3[_0x7721('0x10')];};};module[_0x7721('0x22')]=Realtime; \ No newline at end of file +var _0x008c=['faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','mergeFromDatabase','updateRealtime','chatQueues','updateRouting','initSmsQueues','initMailQueues','mailQueues','initFaxQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','smsQueues'];(function(_0x4e71ef,_0x128802){var _0x21e0a7=function(_0x467f34){while(--_0x467f34){_0x4e71ef['push'](_0x4e71ef['shift']());}};_0x21e0a7(++_0x128802);}(_0x008c,0x188));var _0xc008=function(_0x274f14,_0x27dd7f){_0x274f14=_0x274f14-0x0;var _0x13b97e=_0x008c[_0x274f14];return _0x13b97e;};'use strict';var BPromise=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var _=require(_0xc008('0x2'));var moment=require(_0xc008('0x3'));var Agent=require(_0xc008('0x4'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xc008('0x5'));var ChatQueue=require(_0xc008('0x6'));var SmsQueue=require(_0xc008('0x7'));var MailQueue=require(_0xc008('0x8'));var FaxQueue=require(_0xc008('0x9'));var WhatsappQueue=require(_0xc008('0xa'));var Realtime=function(){this[_0xc008('0xb')]={};this[_0xc008('0xc')]={};this[_0xc008('0xd')]={};this['chatQueues']={};this[_0xc008('0xe')]={};this['mailQueues']={};this[_0xc008('0xf')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0xc008('0x10')]={};this[_0xc008('0x11')]={};this['smsQueuesWaitingInteractions']={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x1eacfa,_0xc881aa,_0x5b2004){var _0xae2dab=_[_0xc008('0x12')](_0x1eacfa,function(_0x2ea200,_0x2a5b4e){return _0x2ea200[_0x5b2004];});for(var _0x9ffa93 in _0xc881aa){if(_0xc881aa[_0xc008('0x13')](_0x9ffa93)){if(!_0xae2dab[_0x9ffa93]){delete _0xc881aa[_0x9ffa93];}}}}Realtime[_0xc008('0x14')]['mergeFromDatabase']=function(_0x560e28,_0x33f44c){for(var _0x50c1ab in _0x33f44c){if(_0x560e28[_0xc008('0x13')](_0x50c1ab)){_0x560e28[_0x50c1ab]=_0x33f44c[_0x50c1ab];}}};Realtime[_0xc008('0x14')][_0xc008('0x15')]=function(){var _0x339ffc=this;return function(_0x3f0ecf){if(_0x3f0ecf){freeIsNotKey(_0x3f0ecf,_0x339ffc['agents'],'id');for(var _0x5e894e=0x0,_0x4bd0f4={},_0x11ef38={};_0x5e894e<_0x3f0ecf[_0xc008('0x16')];_0x5e894e+=0x1){_0x4bd0f4=_0x3f0ecf[_0x5e894e];if(_[_0xc008('0x17')](_0x339ffc[_0xc008('0xb')][_0x4bd0f4['id']])){_0x339ffc['agents'][_0x4bd0f4['id']]=new Agent(_0x4bd0f4);}else{_0x339ffc['mergeFromDatabase'](_0x339ffc['agents'][_0x4bd0f4['id']],_0x4bd0f4);}}}return _0x339ffc['agents'];};};Realtime[_0xc008('0x14')][_0xc008('0x18')]=function(){var _0x501137=this;return function(_0x813397){if(_0x813397){freeIsNotKey(_0x813397,_0x501137['intervals'],'id');for(var _0x4bd611=0x0,_0x543e5d={},_0x50261c={};_0x4bd611<_0x813397[_0xc008('0x16')];_0x4bd611+=0x1){_0x543e5d=_0x813397[_0x4bd611];if(_['isUndefined'](_0x501137['intervals'][_0x543e5d['id']])){_0x501137['intervals'][_0x543e5d['id']]=new Interval(_0x543e5d);}else{_0x501137['mergeFromDatabase'](_0x501137['intervals'][_0x543e5d['id']],_0x543e5d);}}}return _0x501137[_0xc008('0xc')];};};Realtime[_0xc008('0x14')][_0xc008('0x19')]=function(){var _0x415af3=this;return function(_0x11cc75){if(_0x11cc75){freeIsNotKey(_0x11cc75,_0x415af3[_0xc008('0xd')],'id');for(var _0x4f43e2=0x0,_0x459fd9={},_0x5c85f2={};_0x4f43e2<_0x11cc75['length'];_0x4f43e2+=0x1){_0x459fd9=_0x11cc75[_0x4f43e2];if(_[_0xc008('0x17')](_0x415af3[_0xc008('0xd')][_0x459fd9['id']])){_0x415af3[_0xc008('0xd')][_0x459fd9['id']]=new OpenchannelQueue(_0x459fd9);}else{_0x415af3[_0xc008('0x1a')](_0x415af3['openchannelQueues'][_0x459fd9['id']],_0x459fd9);}_0x415af3['openchannelQueues'][_0x459fd9['id']]['updateRouting']();_0x415af3[_0xc008('0xd')][_0x459fd9['id']][_0xc008('0x1b')]();}}return _0x415af3[_0xc008('0xd')];};};Realtime[_0xc008('0x14')]['initChatQueues']=function(){var _0x5e2aca=this;return function(_0x4fce9c){if(_0x4fce9c){freeIsNotKey(_0x4fce9c,_0x5e2aca['chatQueues'],'id');for(var _0x4caaf4=0x0,_0x3865c0={},_0x29ba43={};_0x4caaf4<_0x4fce9c[_0xc008('0x16')];_0x4caaf4+=0x1){_0x3865c0=_0x4fce9c[_0x4caaf4];if(_['isUndefined'](_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']])){_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']]=new ChatQueue(_0x3865c0);}else{_0x5e2aca[_0xc008('0x1a')](_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']],_0x3865c0);}_0x5e2aca['chatQueues'][_0x3865c0['id']][_0xc008('0x1d')]();_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']]['updateRealtime']();}}return _0x5e2aca['chatQueues'];};};Realtime['prototype'][_0xc008('0x1e')]=function(){var _0x267abd=this;return function(_0xf831f2){if(_0xf831f2){freeIsNotKey(_0xf831f2,_0x267abd[_0xc008('0xe')],'id');for(var _0x1de04b=0x0,_0xceebc3={},_0x294f97={};_0x1de04b<_0xf831f2[_0xc008('0x16')];_0x1de04b+=0x1){_0xceebc3=_0xf831f2[_0x1de04b];if(_[_0xc008('0x17')](_0x267abd[_0xc008('0xe')][_0xceebc3['id']])){_0x267abd[_0xc008('0xe')][_0xceebc3['id']]=new SmsQueue(_0xceebc3);}else{_0x267abd[_0xc008('0x1a')](_0x267abd['smsQueues'][_0xceebc3['id']],_0xceebc3);}_0x267abd[_0xc008('0xe')][_0xceebc3['id']][_0xc008('0x1d')]();_0x267abd['smsQueues'][_0xceebc3['id']][_0xc008('0x1b')]();}}return _0x267abd[_0xc008('0xe')];};};Realtime[_0xc008('0x14')][_0xc008('0x1f')]=function(){var _0xd0e05a=this;return function(_0x3cd878){if(_0x3cd878){freeIsNotKey(_0x3cd878,_0xd0e05a[_0xc008('0x20')],'id');for(var _0x470e79=0x0,_0x29d4b3={},_0x4f14d2={};_0x470e79<_0x3cd878[_0xc008('0x16')];_0x470e79+=0x1){_0x29d4b3=_0x3cd878[_0x470e79];if(_[_0xc008('0x17')](_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']])){_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']]=new MailQueue(_0x29d4b3);}else{_0xd0e05a[_0xc008('0x1a')](_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']],_0x29d4b3);}_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']]['updateRouting']();_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']][_0xc008('0x1b')]();}}return _0xd0e05a['mailQueues'];};};Realtime[_0xc008('0x14')][_0xc008('0x21')]=function(){var _0x5e38d5=this;return function(_0x263473){if(_0x263473){freeIsNotKey(_0x263473,_0x5e38d5[_0xc008('0xf')],'id');for(var _0x280e9b=0x0,_0x55ff48={},_0x53b353={};_0x280e9b<_0x263473['length'];_0x280e9b+=0x1){_0x55ff48=_0x263473[_0x280e9b];if(_[_0xc008('0x17')](_0x5e38d5['faxQueues'][_0x55ff48['id']])){_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']]=new FaxQueue(_0x55ff48);}else{_0x5e38d5[_0xc008('0x1a')](_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']],_0x55ff48);}_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']][_0xc008('0x1d')]();_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']][_0xc008('0x1b')]();}}return _0x5e38d5[_0xc008('0xf')];};};Realtime[_0xc008('0x14')][_0xc008('0x22')]=function(){var _0x3ebb83=this;return function(_0xdfca2e){if(_0xdfca2e){freeIsNotKey(_0xdfca2e,_0x3ebb83[_0xc008('0x23')],'id');for(var _0x2bf3fd=0x0,_0x4cace5={},_0x3238b4={};_0x2bf3fd<_0xdfca2e[_0xc008('0x16')];_0x2bf3fd+=0x1){_0x4cace5=_0xdfca2e[_0x2bf3fd];if(_[_0xc008('0x17')](_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']])){_0x3ebb83['whatsappQueues'][_0x4cace5['id']]=new WhatsappQueue(_0x4cace5);}else{_0x3ebb83[_0xc008('0x1a')](_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']],_0x4cace5);}_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']][_0xc008('0x1d')]();_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']]['updateRealtime']();}}return _0x3ebb83[_0xc008('0x23')];};};module[_0xc008('0x24')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 38273f7..e62d72f 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 _0x184e=['updateChatInteraction','AddTagsToChatInteraction','../client','update','Request','UpdateChatInteraction'];(function(_0x513254,_0x1305ca){var _0x384c92=function(_0xb22823){while(--_0xb22823){_0x513254['push'](_0x513254['shift']());}};_0x384c92(++_0x1305ca);}(_0x184e,0x1a0));var _0xe184=function(_0x371f33,_0x278a69){_0x371f33=_0x371f33-0x0;var _0x246c96=_0x184e[_0x371f33];return _0x246c96;};'use strict';var client=require(_0xe184('0x0'));exports[_0xe184('0x1')]=function(_0x5e5a68,_0xdeab35){return client[_0xe184('0x2')](_0xe184('0x3'),{'body':_0xdeab35,'options':{'where':{'id':_0x5e5a68}},'log':_0xe184('0x4')});};exports['addTags']=function(_0x1ffddb,_0x3bb403){return client[_0xe184('0x2')](_0xe184('0x5'),{'body':_0x3bb403,'options':{'where':{'id':_0x1ffddb}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x7d05=['../client','update','Request','UpdateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0x1c3afc,_0x1bbf56){var _0x3e47f1=function(_0x5c8b17){while(--_0x5c8b17){_0x1c3afc['push'](_0x1c3afc['shift']());}};_0x3e47f1(++_0x1bbf56);}(_0x7d05,0x1d4));var _0x57d0=function(_0x3bd395,_0x132b83){_0x3bd395=_0x3bd395-0x0;var _0x3e5da2=_0x7d05[_0x3bd395];return _0x3e5da2;};'use strict';var client=require(_0x57d0('0x0'));exports[_0x57d0('0x1')]=function(_0xaa7713,_0x517537){return client[_0x57d0('0x2')](_0x57d0('0x3'),{'body':_0x517537,'options':{'where':{'id':_0xaa7713}},'log':'updateChatInteraction'});};exports[_0x57d0('0x4')]=function(_0x2f243e,_0x145340){return client['Request'](_0x57d0('0x5'),{'body':_0x145340,'options':{'where':{'id':_0x2f243e}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 4dbb66c..2025ed2 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 _0xe4ed=['CreateChatMessage','Request'];(function(_0x3ec358,_0x3df159){var _0x18318d=function(_0xe5a58f){while(--_0xe5a58f){_0x3ec358['push'](_0x3ec358['shift']());}};_0x18318d(++_0x3df159);}(_0xe4ed,0x107));var _0xde4e=function(_0x9acf5a,_0x405549){_0x9acf5a=_0x9acf5a-0x0;var _0x12e5da=_0xe4ed[_0x9acf5a];return _0x12e5da;};'use strict';var client=require('../client');exports['create']=function(_0x31a64a){return client[_0xde4e('0x0')](_0xde4e('0x1'),{'body':_0x31a64a,'log':'createChatMessage'});}; \ No newline at end of file +var _0x22ab=['create','CreateChatMessage','createChatMessage','../client'];(function(_0xa95d11,_0x40bce6){var _0x32366b=function(_0x2ebfa7){while(--_0x2ebfa7){_0xa95d11['push'](_0xa95d11['shift']());}};_0x32366b(++_0x40bce6);}(_0x22ab,0x1ef));var _0xb22a=function(_0x5ebe34,_0x421337){_0x5ebe34=_0x5ebe34-0x0;var _0x36a3ee=_0x22ab[_0x5ebe34];return _0x36a3ee;};'use strict';var client=require(_0xb22a('0x0'));exports[_0xb22a('0x1')]=function(_0x476f53){return client['Request'](_0xb22a('0x2'),{'body':_0x476f53,'log':_0xb22a('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index c0fb264..8a10893 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 _0x3712=['GetChatQueue','timeout','strategy','Agents','name','chatPause','../client','getChatQueues','Request'];(function(_0x8d6777,_0x3d2405){var _0xfb2473=function(_0x25c9cf){while(--_0x25c9cf){_0x8d6777['push'](_0x8d6777['shift']());}};_0xfb2473(++_0x3d2405);}(_0x3712,0xcc));var _0x2371=function(_0x5a7b40,_0x585230){_0x5a7b40=_0x5a7b40-0x0;var _0x463559=_0x3712[_0x5a7b40];return _0x463559;};'use strict';var client=require(_0x2371('0x0'));exports[_0x2371('0x1')]=function(){return function(){return client[_0x2371('0x2')](_0x2371('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x2371('0x4'),_0x2371('0x5')],'include':[{'model':'User','as':_0x2371('0x6'),'attributes':['id',_0x2371('0x7'),'online',_0x2371('0x8')]}]},'log':_0x2371('0x1')});};}; \ No newline at end of file +var _0x36ed=['Request','GetChatQueue','name','User','Agents','chatPause','../client','getChatQueues'];(function(_0x5345fa,_0x5b95f0){var _0x119e0d=function(_0x140c27){while(--_0x140c27){_0x5345fa['push'](_0x5345fa['shift']());}};_0x119e0d(++_0x5b95f0);}(_0x36ed,0xf6));var _0xd36e=function(_0x59cb9d,_0x168910){_0x59cb9d=_0x59cb9d-0x0;var _0x2b8687=_0x36ed[_0x59cb9d];return _0x2b8687;};'use strict';var client=require(_0xd36e('0x0'));exports[_0xd36e('0x1')]=function(){return function(){return client[_0xd36e('0x2')](_0xd36e('0x3'),{'options':{'raw':![],'attributes':['id',_0xd36e('0x4'),'timeout','strategy'],'include':[{'model':_0xd36e('0x5'),'as':_0xd36e('0x6'),'attributes':['id',_0xd36e('0x4'),'online',_0xd36e('0x7')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 6975d09..c756a58 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 _0xb38e=['create','Request','CreateChatQueueReport','update','DESC','UpdateChatQueueReport','../client'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb38e,0xa7));var _0xeb38=function(_0x401891,_0x465844){_0x401891=_0x401891-0x0;var _0x1ac8b8=_0xb38e[_0x401891];return _0x1ac8b8;};'use strict';var client=require(_0xeb38('0x0'));exports[_0xeb38('0x1')]=function(_0x27ac9f){return client[_0xeb38('0x2')](_0xeb38('0x3'),{'body':_0x27ac9f,'log':_0xeb38('0x3')});};exports[_0xeb38('0x4')]=function(_0x503497,_0x33e6e9){return client[_0xeb38('0x2')]('UpdateChatQueueReport',{'body':_0x33e6e9,'options':{'where':{'uniqueid':_0x503497},'order':[['id',_0xeb38('0x5')]],'limit':0x1},'log':_0xeb38('0x6')});}; \ No newline at end of file +var _0x3c7b=['../client','create','Request','CreateChatQueueReport','UpdateChatQueueReport'];(function(_0x12b8ec,_0x1655be){var _0x21af77=function(_0xe59f){while(--_0xe59f){_0x12b8ec['push'](_0x12b8ec['shift']());}};_0x21af77(++_0x1655be);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x1cddb1,_0x4cb675){_0x1cddb1=_0x1cddb1-0x0;var _0x31f198=_0x3c7b[_0x1cddb1];return _0x31f198;};'use strict';var client=require(_0xb3c7('0x0'));exports[_0xb3c7('0x1')]=function(_0xc43ced){return client[_0xb3c7('0x2')](_0xb3c7('0x3'),{'body':_0xc43ced,'log':'CreateChatQueueReport'});};exports['update']=function(_0x500bea,_0x5b34ef){return client[_0xb3c7('0x2')](_0xb3c7('0x4'),{'body':_0x5b34ef,'options':{'where':{'uniqueid':_0x500bea},'order':[['id','DESC']],'limit':0x1},'log':_0xb3c7('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index f71e6aa..ebaaa8c 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 _0x08e3=['Request','UpdateFaxInteraction','updateFaxInteraction','addTagsToFaxInteraction','../client','update'];(function(_0x49f7cf,_0x22e26d){var _0x553c39=function(_0x3f543a){while(--_0x3f543a){_0x49f7cf['push'](_0x49f7cf['shift']());}};_0x553c39(++_0x22e26d);}(_0x08e3,0x124));var _0x308e=function(_0x3fad25,_0xe77c05){_0x3fad25=_0x3fad25-0x0;var _0x3817ee=_0x08e3[_0x3fad25];return _0x3817ee;};'use strict';var client=require(_0x308e('0x0'));exports[_0x308e('0x1')]=function(_0x1221b2,_0x1d101c){return client[_0x308e('0x2')](_0x308e('0x3'),{'body':_0x1d101c,'options':{'where':{'id':_0x1221b2}},'log':_0x308e('0x4')});};exports['addTags']=function(_0x1396ca,_0x22512a){return client[_0x308e('0x2')]('AddTagsToFaxInteraction',{'body':_0x22512a,'options':{'where':{'id':_0x1396ca}},'log':_0x308e('0x5')});}; \ No newline at end of file +var _0x5b45=['updateFaxInteraction','addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction'];(function(_0x3f30b0,_0x34a040){var _0x19c233=function(_0x2e3dae){while(--_0x2e3dae){_0x3f30b0['push'](_0x3f30b0['shift']());}};_0x19c233(++_0x34a040);}(_0x5b45,0x162));var _0x55b4=function(_0x45313f,_0x46caf4){_0x45313f=_0x45313f-0x0;var _0x402910=_0x5b45[_0x45313f];return _0x402910;};'use strict';var client=require(_0x55b4('0x0'));exports[_0x55b4('0x1')]=function(_0x59124f,_0x27489b){return client['Request'](_0x55b4('0x2'),{'body':_0x27489b,'options':{'where':{'id':_0x59124f}},'log':_0x55b4('0x3')});};exports[_0x55b4('0x4')]=function(_0x1d87e7,_0x344057){return client['Request'](_0x55b4('0x5'),{'body':_0x344057,'options':{'where':{'id':_0x1d87e7}},'log':_0x55b4('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 5bf835f..5e7bdd4 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 _0x8601=['create','Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x40dc9c,_0x4836a0){var _0x193d12=function(_0x229248){while(--_0x229248){_0x40dc9c['push'](_0x40dc9c['shift']());}};_0x193d12(++_0x4836a0);}(_0x8601,0x1c6));var _0x1860=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8601[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x1860('0x0'));exports[_0x1860('0x1')]=function(_0x310dd8){return client[_0x1860('0x2')](_0x1860('0x3'),{'body':_0x310dd8,'log':_0x1860('0x4')});}; \ No newline at end of file +var _0x7414=['CreateFaxMessage','createFaxMessage','../client','create','Request'];(function(_0xe9225b,_0x57e738){var _0x8366f6=function(_0x3a8383){while(--_0x3a8383){_0xe9225b['push'](_0xe9225b['shift']());}};_0x8366f6(++_0x57e738);}(_0x7414,0x151));var _0x4741=function(_0x3733ea,_0xe0bfa3){_0x3733ea=_0x3733ea-0x0;var _0x2ca5d1=_0x7414[_0x3733ea];return _0x2ca5d1;};'use strict';var client=require(_0x4741('0x0'));exports[_0x4741('0x1')]=function(_0x516660){return client[_0x4741('0x2')](_0x4741('0x3'),{'body':_0x516660,'log':_0x4741('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index dfb1047..0315661 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 _0x1e8f=['getFaxQueues','Request','GetFaxQueue','timeout','strategy','User','Agents','name','online','faxPause'];(function(_0x14c373,_0x2c9de5){var _0x4e8c9a=function(_0xd919aa){while(--_0xd919aa){_0x14c373['push'](_0x14c373['shift']());}};_0x4e8c9a(++_0x2c9de5);}(_0x1e8f,0x1d7));var _0xf1e8=function(_0x36d9e3,_0x29c9cc){_0x36d9e3=_0x36d9e3-0x0;var _0x18d176=_0x1e8f[_0x36d9e3];return _0x18d176;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0xf1e8('0x0')](_0xf1e8('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xf1e8('0x2'),_0xf1e8('0x3')],'include':[{'model':_0xf1e8('0x4'),'as':_0xf1e8('0x5'),'attributes':['id',_0xf1e8('0x6'),_0xf1e8('0x7'),_0xf1e8('0x8')]}]},'log':_0xf1e8('0x9')});};}; \ No newline at end of file +var _0xf18a=['GetFaxQueue','name','timeout','online','../client','getFaxQueues'];(function(_0x46193e,_0xbaaf70){var _0x3211cd=function(_0x5209fe){while(--_0x5209fe){_0x46193e['push'](_0x46193e['shift']());}};_0x3211cd(++_0xbaaf70);}(_0xf18a,0x1ae));var _0xaf18=function(_0x251a3e,_0x16895f){_0x251a3e=_0x251a3e-0x0;var _0x410395=_0xf18a[_0x251a3e];return _0x410395;};'use strict';var client=require(_0xaf18('0x0'));exports[_0xaf18('0x1')]=function(){return function(){return client['Request'](_0xaf18('0x2'),{'options':{'raw':![],'attributes':['id',_0xaf18('0x3'),_0xaf18('0x4'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0xaf18('0x3'),_0xaf18('0x5'),'faxPause']}]},'log':_0xaf18('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index a71ef17..0685dd8 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 _0x10da=['UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport','update'];(function(_0xeaf4b8,_0x3cb24c){var _0x28c43d=function(_0x1dbfd9){while(--_0x1dbfd9){_0xeaf4b8['push'](_0xeaf4b8['shift']());}};_0x28c43d(++_0x3cb24c);}(_0x10da,0x145));var _0xa10d=function(_0x581aa5,_0x2e6223){_0x581aa5=_0x581aa5-0x0;var _0x44a817=_0x10da[_0x581aa5];return _0x44a817;};'use strict';var client=require(_0xa10d('0x0'));exports[_0xa10d('0x1')]=function(_0x506db4){return client[_0xa10d('0x2')]('CreateFaxQueueReport',{'body':_0x506db4,'log':_0xa10d('0x3')});};exports[_0xa10d('0x4')]=function(_0x241207,_0x85fe91){return client[_0xa10d('0x2')](_0xa10d('0x5'),{'body':_0x85fe91,'options':{'where':{'uniqueid':_0x241207},'order':[['id','DESC']],'limit':0x1},'log':_0xa10d('0x5')});}; \ No newline at end of file +var _0x2d97=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','create'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x2d97,0x1f1));var _0x72d9=function(_0x52eb71,_0x565708){_0x52eb71=_0x52eb71-0x0;var _0x585935=_0x2d97[_0x52eb71];return _0x585935;};'use strict';var client=require('../client');exports[_0x72d9('0x0')]=function(_0x4c19dd){return client[_0x72d9('0x1')](_0x72d9('0x2'),{'body':_0x4c19dd,'log':'CreateFaxQueueReport'});};exports[_0x72d9('0x3')]=function(_0x283ee2,_0x8a0a95){return client[_0x72d9('0x1')](_0x72d9('0x4'),{'body':_0x8a0a95,'options':{'where':{'uniqueid':_0x283ee2},'order':[['id',_0x72d9('0x5')]],'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 65eb74c..c3a714b 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 _0x4849=['Intervals','name','interval','../client','getIntervals','Request','Interval'];(function(_0x3daf35,_0x46a1f5){var _0x495660=function(_0x117e4e){while(--_0x117e4e){_0x3daf35['push'](_0x3daf35['shift']());}};_0x495660(++_0x46a1f5);}(_0x4849,0xf8));var _0x9484=function(_0x414568,_0x1c1ecc){_0x414568=_0x414568-0x0;var _0x19f7fb=_0x4849[_0x414568];return _0x19f7fb;};'use strict';var client=require(_0x9484('0x0'));exports[_0x9484('0x1')]=function(){return function(){return client[_0x9484('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x9484('0x3'),'as':_0x9484('0x4'),'attributes':['id',_0x9484('0x5'),_0x9484('0x6')]}]},'log':_0x9484('0x1')});};}; \ No newline at end of file +var _0x5ec6=['interval','../client','getIntervals','Request','name','Intervals'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x5ec6,0x7f));var _0x65ec=function(_0x529109,_0x18724e){_0x529109=_0x529109-0x0;var _0x3a2914=_0x5ec6[_0x529109];return _0x3a2914;};'use strict';var client=require(_0x65ec('0x0'));exports[_0x65ec('0x1')]=function(){return function(){return client[_0x65ec('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x65ec('0x3')],'include':[{'model':'Interval','as':_0x65ec('0x4'),'attributes':['id','name',_0x65ec('0x5')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 1e26c6a..6c2abe1 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 _0xd53a=['update','UpdateMailInteraction','addTags','AddTagsToMailInteraction','../client'];(function(_0x18daeb,_0x1b8ff3){var _0x425a30=function(_0x271e0c){while(--_0x271e0c){_0x18daeb['push'](_0x18daeb['shift']());}};_0x425a30(++_0x1b8ff3);}(_0xd53a,0x185));var _0xad53=function(_0x1a3d84,_0x267cf8){_0x1a3d84=_0x1a3d84-0x0;var _0x1bc193=_0xd53a[_0x1a3d84];return _0x1bc193;};'use strict';var client=require(_0xad53('0x0'));exports[_0xad53('0x1')]=function(_0x136b44,_0xeca572){return client['Request'](_0xad53('0x2'),{'body':_0xeca572,'options':{'where':{'id':_0x136b44}},'log':'updateMailInteraction'});};exports[_0xad53('0x3')]=function(_0x3c2921,_0x569629){return client['Request'](_0xad53('0x4'),{'body':_0x569629,'options':{'where':{'id':_0x3c2921}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x454d=['../client','update','Request','addTags','addTagsToChatInteraction'];(function(_0x488732,_0x1a7810){var _0x459add=function(_0x13ee65){while(--_0x13ee65){_0x488732['push'](_0x488732['shift']());}};_0x459add(++_0x1a7810);}(_0x454d,0x1e0));var _0xd454=function(_0x57e00e,_0x36e79a){_0x57e00e=_0x57e00e-0x0;var _0x415e60=_0x454d[_0x57e00e];return _0x415e60;};'use strict';var client=require(_0xd454('0x0'));exports[_0xd454('0x1')]=function(_0x504281,_0x3f0fc0){return client[_0xd454('0x2')]('UpdateMailInteraction',{'body':_0x3f0fc0,'options':{'where':{'id':_0x504281}},'log':'updateMailInteraction'});};exports[_0xd454('0x3')]=function(_0xb8678e,_0xea91c){return client['Request']('AddTagsToMailInteraction',{'body':_0xea91c,'options':{'where':{'id':_0xb8678e}},'log':_0xd454('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 0f4cef4..f126024 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 _0x790a=['create','Request','CreateMailMessage','createMailMessage','../client'];(function(_0x17b0a7,_0x5a892f){var _0x73bd2f=function(_0x1292ab){while(--_0x1292ab){_0x17b0a7['push'](_0x17b0a7['shift']());}};_0x73bd2f(++_0x5a892f);}(_0x790a,0x121));var _0xa790=function(_0x2b9cf5,_0x2a7804){_0x2b9cf5=_0x2b9cf5-0x0;var _0xd0cf15=_0x790a[_0x2b9cf5];return _0xd0cf15;};'use strict';var client=require(_0xa790('0x0'));exports[_0xa790('0x1')]=function(_0x297866){return client[_0xa790('0x2')](_0xa790('0x3'),{'body':_0x297866,'log':_0xa790('0x4')});}; \ No newline at end of file +var _0x2a8d=['CreateMailMessage','createMailMessage','../client','create','Request'];(function(_0x2341c0,_0xf1e896){var _0x5bfff3=function(_0x3b4a0e){while(--_0x3b4a0e){_0x2341c0['push'](_0x2341c0['shift']());}};_0x5bfff3(++_0xf1e896);}(_0x2a8d,0x129));var _0xd2a8=function(_0x2c38c1,_0x108063){_0x2c38c1=_0x2c38c1-0x0;var _0x180ee2=_0x2a8d[_0x2c38c1];return _0x180ee2;};'use strict';var client=require(_0xd2a8('0x0'));exports[_0xd2a8('0x1')]=function(_0x24c92e){return client[_0xd2a8('0x2')](_0xd2a8('0x3'),{'body':_0x24c92e,'log':_0xd2a8('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 136a6e7..b617368 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 _0x379e=['mailPause','../client','getMailQueues','Request','GetMailQueue','timeout','strategy','User','Agents','name','online'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x379e,0x156));var _0xe379=function(_0x5a67bf,_0x5c3aa7){_0x5a67bf=_0x5a67bf-0x0;var _0x4b23eb=_0x379e[_0x5a67bf];return _0x4b23eb;};'use strict';var client=require(_0xe379('0x0'));exports[_0xe379('0x1')]=function(){return function(){return client[_0xe379('0x2')](_0xe379('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xe379('0x4'),_0xe379('0x5')],'include':[{'model':_0xe379('0x6'),'as':_0xe379('0x7'),'attributes':['id',_0xe379('0x8'),_0xe379('0x9'),_0xe379('0xa')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x977e=['../client','GetMailQueue','name','timeout','Agents','online','mailPause','getMailQueues'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x977e,0x1c0));var _0xe977=function(_0x1b9138,_0x2e952a){_0x1b9138=_0x1b9138-0x0;var _0x205628=_0x977e[_0x1b9138];return _0x205628;};'use strict';var client=require(_0xe977('0x0'));exports['getMailQueues']=function(){return function(){return client['Request'](_0xe977('0x1'),{'options':{'raw':![],'attributes':['id',_0xe977('0x2'),_0xe977('0x3'),'strategy'],'include':[{'model':'User','as':_0xe977('0x4'),'attributes':['id','name',_0xe977('0x5'),_0xe977('0x6')]}]},'log':_0xe977('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index a72cc8b..543a11b 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 _0x87a4=['UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x87a4,0x164));var _0x487a=function(_0x1be09a,_0x143535){_0x1be09a=_0x1be09a-0x0;var _0x2b25d2=_0x87a4[_0x1be09a];return _0x2b25d2;};'use strict';var client=require(_0x487a('0x0'));exports[_0x487a('0x1')]=function(_0x3dfb2d){return client[_0x487a('0x2')](_0x487a('0x3'),{'body':_0x3dfb2d,'log':_0x487a('0x3')});};exports['update']=function(_0x4f8063,_0x46c3c2){return client['Request'](_0x487a('0x4'),{'body':_0x46c3c2,'options':{'where':{'uniqueid':_0x4f8063},'order':[['id',_0x487a('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x3a9d=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client'];(function(_0x2bdb49,_0x29f6f2){var _0x54b73a=function(_0x58a2c1){while(--_0x58a2c1){_0x2bdb49['push'](_0x2bdb49['shift']());}};_0x54b73a(++_0x29f6f2);}(_0x3a9d,0x17f));var _0xd3a9=function(_0x4c9e59,_0xaeb1d6){_0x4c9e59=_0x4c9e59-0x0;var _0x36c8b0=_0x3a9d[_0x4c9e59];return _0x36c8b0;};'use strict';var client=require(_0xd3a9('0x0'));exports['create']=function(_0x935be3){return client[_0xd3a9('0x1')](_0xd3a9('0x2'),{'body':_0x935be3,'log':_0xd3a9('0x2')});};exports[_0xd3a9('0x3')]=function(_0x4fa66c,_0x291581){return client[_0xd3a9('0x1')](_0xd3a9('0x4'),{'body':_0x291581,'options':{'where':{'uniqueid':_0x4fa66c},'order':[['id',_0xd3a9('0x5')]],'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 692638b..7d293f4 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 _0x85a8=['Request','UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update'];(function(_0x76259d,_0x53fbce){var _0x2cf133=function(_0x21423f){while(--_0x21423f){_0x76259d['push'](_0x76259d['shift']());}};_0x2cf133(++_0x53fbce);}(_0x85a8,0xde));var _0x885a=function(_0xf4c0e5,_0x4e55c7){_0xf4c0e5=_0xf4c0e5-0x0;var _0x3c13ab=_0x85a8[_0xf4c0e5];return _0x3c13ab;};'use strict';var client=require(_0x885a('0x0'));exports[_0x885a('0x1')]=function(_0x3faf7f,_0x50b118){return client[_0x885a('0x2')](_0x885a('0x3'),{'body':_0x50b118,'options':{'where':{'id':_0x3faf7f}},'log':'updateOpenchannelInteraction'});};exports[_0x885a('0x4')]=function(_0x24d590,_0x49ac0a){return client[_0x885a('0x2')](_0x885a('0x5'),{'body':_0x49ac0a,'options':{'where':{'id':_0x24d590}},'log':_0x885a('0x6')});}; \ No newline at end of file +var _0x6c3c=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x427882,_0x129ce9){var _0x4c0f90=function(_0x1fe87a){while(--_0x1fe87a){_0x427882['push'](_0x427882['shift']());}};_0x4c0f90(++_0x129ce9);}(_0x6c3c,0x1b0));var _0xc6c3=function(_0x4d928b,_0xfcda3e){_0x4d928b=_0x4d928b-0x0;var _0x24464e=_0x6c3c[_0x4d928b];return _0x24464e;};'use strict';var client=require('../client');exports['update']=function(_0x404aaa,_0x17fbb7){return client[_0xc6c3('0x0')](_0xc6c3('0x1'),{'body':_0x17fbb7,'options':{'where':{'id':_0x404aaa}},'log':_0xc6c3('0x2')});};exports['addTags']=function(_0x22667b,_0xba640f){return client[_0xc6c3('0x0')](_0xc6c3('0x3'),{'body':_0xba640f,'options':{'where':{'id':_0x22667b}},'log':_0xc6c3('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 22716ea..780dcd1 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 _0xf109=['../client','create'];(function(_0x225a75,_0x43c1de){var _0xee995d=function(_0x31a816){while(--_0x31a816){_0x225a75['push'](_0x225a75['shift']());}};_0xee995d(++_0x43c1de);}(_0xf109,0xce));var _0x9f10=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xf109[_0x19950b];return _0x3c6b41;};'use strict';var client=require(_0x9f10('0x0'));exports[_0x9f10('0x1')]=function(_0x44c4f2){return client['Request']('CreateOpenchannelMessage',{'body':_0x44c4f2,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0xe5b3=['Request','CreateOpenchannelMessage','createOpenchannelMessage','create'];(function(_0x73b1cd,_0x176535){var _0x243426=function(_0x1ee7c0){while(--_0x1ee7c0){_0x73b1cd['push'](_0x73b1cd['shift']());}};_0x243426(++_0x176535);}(_0xe5b3,0x133));var _0x3e5b=function(_0x21c460,_0x12b0f7){_0x21c460=_0x21c460-0x0;var _0x10c857=_0xe5b3[_0x21c460];return _0x10c857;};'use strict';var client=require('../client');exports[_0x3e5b('0x0')]=function(_0xba44a0){return client[_0x3e5b('0x1')](_0x3e5b('0x2'),{'body':_0xba44a0,'log':_0x3e5b('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 4013d74..17f22a0 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 _0x2de6=['GetOpenchannelQueue','name','timeout','strategy','openchannelPause','../client','getOpenchannelQueues','Request'];(function(_0x49913c,_0x34b9bd){var _0x516029=function(_0x13a18e){while(--_0x13a18e){_0x49913c['push'](_0x49913c['shift']());}};_0x516029(++_0x34b9bd);}(_0x2de6,0xed));var _0x62de=function(_0x3b9979,_0x263ea7){_0x3b9979=_0x3b9979-0x0;var _0x44b257=_0x2de6[_0x3b9979];return _0x44b257;};'use strict';var client=require(_0x62de('0x0'));exports[_0x62de('0x1')]=function(){return function(){return client[_0x62de('0x2')](_0x62de('0x3'),{'options':{'raw':![],'attributes':['id',_0x62de('0x4'),_0x62de('0x5'),_0x62de('0x6')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x62de('0x4'),'online',_0x62de('0x7')]}]},'log':_0x62de('0x1')});};}; \ No newline at end of file +var _0x469e=['getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents','openchannelPause','../client'];(function(_0x42d3ac,_0x207868){var _0x264745=function(_0x528a73){while(--_0x528a73){_0x42d3ac['push'](_0x42d3ac['shift']());}};_0x264745(++_0x207868);}(_0x469e,0x9f));var _0xe469=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x469e[_0x4ea69d];return _0x5318e0;};'use strict';var client=require(_0xe469('0x0'));exports[_0xe469('0x1')]=function(){return function(){return client[_0xe469('0x2')](_0xe469('0x3'),{'options':{'raw':![],'attributes':['id',_0xe469('0x4'),_0xe469('0x5'),_0xe469('0x6')],'include':[{'model':_0xe469('0x7'),'as':_0xe469('0x8'),'attributes':['id',_0xe469('0x4'),'online',_0xe469('0x9')]}]},'log':_0xe469('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 91b07fa..22fc490 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 _0x2db3=['CreateOpenchannelQueueReport','update','Request','UpdateOpenchannelQueueReport','../client','create'];(function(_0x310a1b,_0x4c9129){var _0xdea206=function(_0x1f1e8d){while(--_0x1f1e8d){_0x310a1b['push'](_0x310a1b['shift']());}};_0xdea206(++_0x4c9129);}(_0x2db3,0x94));var _0x32db=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x2db3[_0x1b5aea];return _0x15cfc6;};'use strict';var client=require(_0x32db('0x0'));exports[_0x32db('0x1')]=function(_0x17c36d){return client['Request'](_0x32db('0x2'),{'body':_0x17c36d,'log':_0x32db('0x2')});};exports[_0x32db('0x3')]=function(_0x3d9b95,_0x235e7f){return client[_0x32db('0x4')](_0x32db('0x5'),{'body':_0x235e7f,'options':{'where':{'uniqueid':_0x3d9b95},'order':[['id','DESC']],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0xbf5a=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','../client','create'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xbf5a,0xb8));var _0xabf5=function(_0x4dc34b,_0x263344){_0x4dc34b=_0x4dc34b-0x0;var _0x57b304=_0xbf5a[_0x4dc34b];return _0x57b304;};'use strict';var client=require(_0xabf5('0x0'));exports[_0xabf5('0x1')]=function(_0x433f03){return client[_0xabf5('0x2')](_0xabf5('0x3'),{'body':_0x433f03,'log':'CreateOpenchannelQueueReport'});};exports[_0xabf5('0x4')]=function(_0xbeefe9,_0xa9529f){return client[_0xabf5('0x2')]('UpdateOpenchannelQueueReport',{'body':_0xa9529f,'options':{'where':{'uniqueid':_0xbeefe9},'order':[['id','DESC']],'limit':0x1},'log':_0xabf5('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 182a211..932f693 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 _0x6e5f=['update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x1c8c2f,_0x1d99fe){var _0x24fa67=function(_0x15fd50){while(--_0x15fd50){_0x1c8c2f['push'](_0x1c8c2f['shift']());}};_0x24fa67(++_0x1d99fe);}(_0x6e5f,0x17f));var _0xf6e5=function(_0x508860,_0x203f84){_0x508860=_0x508860-0x0;var _0x465e05=_0x6e5f[_0x508860];return _0x465e05;};'use strict';var client=require(_0xf6e5('0x0'));exports[_0xf6e5('0x1')]=function(_0x74fda6,_0x172ed4){return client[_0xf6e5('0x2')](_0xf6e5('0x3'),{'body':_0x172ed4,'options':{'where':{'id':_0x74fda6}},'log':_0xf6e5('0x4')});};exports[_0xf6e5('0x5')]=function(_0x251c6d,_0x5b3ac2){return client[_0xf6e5('0x2')](_0xf6e5('0x6'),{'body':_0x5b3ac2,'options':{'where':{'id':_0x251c6d}},'log':_0xf6e5('0x7')});}; \ No newline at end of file +var _0x6c3d=['updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction'];(function(_0x2de0a7,_0x38d3e7){var _0x429437=function(_0x23c148){while(--_0x23c148){_0x2de0a7['push'](_0x2de0a7['shift']());}};_0x429437(++_0x38d3e7);}(_0x6c3d,0x96));var _0xd6c3=function(_0x4861c2,_0x574489){_0x4861c2=_0x4861c2-0x0;var _0x30bedf=_0x6c3d[_0x4861c2];return _0x30bedf;};'use strict';var client=require(_0xd6c3('0x0'));exports[_0xd6c3('0x1')]=function(_0x3ac5ea,_0x3d9dc1){return client[_0xd6c3('0x2')](_0xd6c3('0x3'),{'body':_0x3d9dc1,'options':{'where':{'id':_0x3ac5ea}},'log':_0xd6c3('0x4')});};exports['addTags']=function(_0x268138,_0x41d965){return client[_0xd6c3('0x2')](_0xd6c3('0x5'),{'body':_0x41d965,'options':{'where':{'id':_0x268138}},'log':_0xd6c3('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 5a545fc..0e1e8fd 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 _0xbabf=['CreateSmsMessage','createSmsMessage','../client','Request'];(function(_0x315aea,_0x318a80){var _0x4a4bdb=function(_0x7c049c){while(--_0x7c049c){_0x315aea['push'](_0x315aea['shift']());}};_0x4a4bdb(++_0x318a80);}(_0xbabf,0x156));var _0xfbab=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0xbabf[_0x5834bc];return _0x3e183a;};'use strict';var client=require(_0xfbab('0x0'));exports['create']=function(_0x549636){return client[_0xfbab('0x1')](_0xfbab('0x2'),{'body':_0x549636,'log':_0xfbab('0x3')});}; \ No newline at end of file +var _0x4d7f=['createSmsMessage','../client','CreateSmsMessage'];(function(_0x2c4570,_0x21871d){var _0x26f4b0=function(_0x56b0dc){while(--_0x56b0dc){_0x2c4570['push'](_0x2c4570['shift']());}};_0x26f4b0(++_0x21871d);}(_0x4d7f,0xc1));var _0xf4d7=function(_0x3ae309,_0x4ea0bd){_0x3ae309=_0x3ae309-0x0;var _0x33a076=_0x4d7f[_0x3ae309];return _0x33a076;};'use strict';var client=require(_0xf4d7('0x0'));exports['create']=function(_0x2f93f4){return client['Request'](_0xf4d7('0x1'),{'body':_0x2f93f4,'log':_0xf4d7('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 2b7eb73..29aca57 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 _0x1487=['Request','GetSmsQueue','timeout','strategy','Agents','name','online','smsPause','getSmsQueues'];(function(_0x5d072b,_0x5ef5c1){var _0x2a2a76=function(_0x493be2){while(--_0x493be2){_0x5d072b['push'](_0x5d072b['shift']());}};_0x2a2a76(++_0x5ef5c1);}(_0x1487,0xf2));var _0x7148=function(_0x1d1963,_0x32cc0e){_0x1d1963=_0x1d1963-0x0;var _0x3f58bb=_0x1487[_0x1d1963];return _0x3f58bb;};'use strict';var client=require('../client');exports[_0x7148('0x0')]=function(){return function(){return client[_0x7148('0x1')](_0x7148('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x7148('0x3'),_0x7148('0x4')],'include':[{'model':'User','as':_0x7148('0x5'),'attributes':['id',_0x7148('0x6'),_0x7148('0x7'),_0x7148('0x8')]}]},'log':_0x7148('0x0')});};}; \ No newline at end of file +var _0xf935=['Request','timeout','strategy','User','Agents','name','online','smsPause','../client','getSmsQueues'];(function(_0x25c997,_0xb97174){var _0xa88319=function(_0x5b5ccb){while(--_0x5b5ccb){_0x25c997['push'](_0x25c997['shift']());}};_0xa88319(++_0xb97174);}(_0xf935,0xbc));var _0x5f93=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf935[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x5f93('0x0'));exports[_0x5f93('0x1')]=function(){return function(){return client[_0x5f93('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x5f93('0x3'),_0x5f93('0x4')],'include':[{'model':_0x5f93('0x5'),'as':_0x5f93('0x6'),'attributes':['id',_0x5f93('0x7'),_0x5f93('0x8'),_0x5f93('0x9')]}]},'log':_0x5f93('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 6486214..2d1d25f 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 _0xa9ba=['DESC','UpdateSmsQueueReport','../client','CreateSmsQueueReport','update','Request'];(function(_0x541ea6,_0x51cab6){var _0x3c3e84=function(_0xc06bed){while(--_0xc06bed){_0x541ea6['push'](_0x541ea6['shift']());}};_0x3c3e84(++_0x51cab6);}(_0xa9ba,0x1e2));var _0xaa9b=function(_0x166886,_0x4a6d17){_0x166886=_0x166886-0x0;var _0x348447=_0xa9ba[_0x166886];return _0x348447;};'use strict';var client=require(_0xaa9b('0x0'));exports['create']=function(_0x15eb8e){return client['Request'](_0xaa9b('0x1'),{'body':_0x15eb8e,'log':'CreateSmsQueueReport'});};exports[_0xaa9b('0x2')]=function(_0x2e8195,_0x3f9126){return client[_0xaa9b('0x3')]('UpdateSmsQueueReport',{'body':_0x3f9126,'options':{'where':{'uniqueid':_0x2e8195},'order':[['id',_0xaa9b('0x4')]],'limit':0x1},'log':_0xaa9b('0x5')});}; \ No newline at end of file +var _0x00dd=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client','create'];(function(_0x5c183c,_0x3d57a4){var _0xfa883d=function(_0xb22fe2){while(--_0xb22fe2){_0x5c183c['push'](_0x5c183c['shift']());}};_0xfa883d(++_0x3d57a4);}(_0x00dd,0xc9));var _0xd00d=function(_0x18b31e,_0x2065a1){_0x18b31e=_0x18b31e-0x0;var _0x132f59=_0x00dd[_0x18b31e];return _0x132f59;};'use strict';var client=require(_0xd00d('0x0'));exports[_0xd00d('0x1')]=function(_0x5157d1){return client[_0xd00d('0x2')](_0xd00d('0x3'),{'body':_0x5157d1,'log':_0xd00d('0x3')});};exports[_0xd00d('0x4')]=function(_0x28fa44,_0x331461){return client[_0xd00d('0x2')](_0xd00d('0x5'),{'body':_0x331461,'options':{'where':{'uniqueid':_0x28fa44},'order':[['id',_0xd00d('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index c048db4..46d91a8 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 _0x6596=['name','online','pauseType','voicePause','chatPause','mailPause','faxPause','smsPause','whatsappPause','chatCapacity','faxCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','getAgents','Request','GetUser'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6596,0x74));var _0x6659=function(_0x13a0e8,_0xc0f4d4){_0x13a0e8=_0x13a0e8-0x0;var _0x1246a4=_0x6596[_0x13a0e8];return _0x1246a4;};'use strict';var client=require('../client');exports[_0x6659('0x0')]=function(){return function(){return client[_0x6659('0x1')](_0x6659('0x2'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x6659('0x3'),_0x6659('0x4'),_0x6659('0x5'),'lastPauseAt',_0x6659('0x6'),_0x6659('0x7'),_0x6659('0x8'),_0x6659('0x9'),_0x6659('0xa'),_0x6659('0xb'),'openchannelPause',_0x6659('0xc'),'mailCapacity',_0x6659('0xd'),_0x6659('0xe'),_0x6659('0xf'),_0x6659('0x10')]},'log':_0x6659('0x0')});};}; \ No newline at end of file +var _0x3de6=['faxPause','smsPause','openchannelPause','mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','../client','getAgents','Request','GetUser','agent','name','online','pauseType','lastPauseAt','voicePause','chatPause','mailPause'];(function(_0xbd32c6,_0x3cde5f){var _0x423dfd=function(_0x1065d0){while(--_0x1065d0){_0xbd32c6['push'](_0xbd32c6['shift']());}};_0x423dfd(++_0x3cde5f);}(_0x3de6,0xc5));var _0x63de=function(_0x41d90f,_0x589fe0){_0x41d90f=_0x41d90f-0x0;var _0x3e6b4e=_0x3de6[_0x41d90f];return _0x3e6b4e;};'use strict';var client=require(_0x63de('0x0'));exports[_0x63de('0x1')]=function(){return function(){return client[_0x63de('0x2')](_0x63de('0x3'),{'options':{'raw':!![],'where':{'role':_0x63de('0x4')},'attributes':['id',_0x63de('0x5'),_0x63de('0x6'),_0x63de('0x7'),_0x63de('0x8'),_0x63de('0x9'),_0x63de('0xa'),_0x63de('0xb'),_0x63de('0xc'),_0x63de('0xd'),'whatsappPause',_0x63de('0xe'),'chatCapacity',_0x63de('0xf'),_0x63de('0x10'),_0x63de('0x11'),_0x63de('0x12'),'openchannelCapacity']},'log':_0x63de('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index cae7d72..3dd692d 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 _0xab5b=['../client','update','Request','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x437ac6,_0x1910b6){var _0x4d8868=function(_0x37a707){while(--_0x37a707){_0x437ac6['push'](_0x437ac6['shift']());}};_0x4d8868(++_0x1910b6);}(_0xab5b,0x11a));var _0xbab5=function(_0x2f053c,_0x26d295){_0x2f053c=_0x2f053c-0x0;var _0x42c264=_0xab5b[_0x2f053c];return _0x42c264;};'use strict';var client=require(_0xbab5('0x0'));exports[_0xbab5('0x1')]=function(_0x52fbcc,_0x431930){return client[_0xbab5('0x2')]('UpdateWhatsappInteraction',{'body':_0x431930,'options':{'where':{'id':_0x52fbcc}},'log':'updateWhatsappInteraction'});};exports[_0xbab5('0x3')]=function(_0x58f49f,_0xa320ef){return client[_0xbab5('0x2')](_0xbab5('0x4'),{'body':_0xa320ef,'options':{'where':{'id':_0x58f49f}},'log':_0xbab5('0x5')});}; \ No newline at end of file +var _0x579c=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','updateWhatsappInteraction'];(function(_0x15dda5,_0x3f0948){var _0x3b920a=function(_0x4fc0d0){while(--_0x4fc0d0){_0x15dda5['push'](_0x15dda5['shift']());}};_0x3b920a(++_0x3f0948);}(_0x579c,0xda));var _0xc579=function(_0x2358b3,_0x441f7e){_0x2358b3=_0x2358b3-0x0;var _0x3c2b44=_0x579c[_0x2358b3];return _0x3c2b44;};'use strict';var client=require(_0xc579('0x0'));exports[_0xc579('0x1')]=function(_0x2757c6,_0x1db849){return client[_0xc579('0x2')]('UpdateWhatsappInteraction',{'body':_0x1db849,'options':{'where':{'id':_0x2757c6}},'log':_0xc579('0x3')});};exports['addTags']=function(_0x21a0a2,_0x3b913c){return client[_0xc579('0x2')](_0xc579('0x4'),{'body':_0x3b913c,'options':{'where':{'id':_0x21a0a2}},'log':_0xc579('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 45a620e..63a747d 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 _0x37d2=['Request','CreateWhatsappMessage','../client'];(function(_0x1cabd6,_0x65c4d3){var _0x1106a2=function(_0x55fac1){while(--_0x55fac1){_0x1cabd6['push'](_0x1cabd6['shift']());}};_0x1106a2(++_0x65c4d3);}(_0x37d2,0xd7));var _0x237d=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x37d2[_0x3bf83f];return _0x22c4a9;};'use strict';var client=require(_0x237d('0x0'));exports['create']=function(_0x14b16b){return client[_0x237d('0x1')](_0x237d('0x2'),{'body':_0x14b16b,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x75ff=['create','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x2f6933,_0x4edbce){var _0x28e69c=function(_0x5a3284){while(--_0x5a3284){_0x2f6933['push'](_0x2f6933['shift']());}};_0x28e69c(++_0x4edbce);}(_0x75ff,0x173));var _0xf75f=function(_0x326c48,_0x31eee6){_0x326c48=_0x326c48-0x0;var _0xf71bc5=_0x75ff[_0x326c48];return _0xf71bc5;};'use strict';var client=require(_0xf75f('0x0'));exports[_0xf75f('0x1')]=function(_0x322773){return client['Request'](_0xf75f('0x2'),{'body':_0x322773,'log':_0xf75f('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 901f7fc..50961e2 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 _0x8130=['Agents','online','../client','getWhatsappQueues','GetWhatsappQueue','name','timeout','strategy','User'];(function(_0x205900,_0xf23585){var _0x573ed8=function(_0x205f10){while(--_0x205f10){_0x205900['push'](_0x205900['shift']());}};_0x573ed8(++_0xf23585);}(_0x8130,0x146));var _0x0813=function(_0x597f83,_0x39a80d){_0x597f83=_0x597f83-0x0;var _0x5e46c1=_0x8130[_0x597f83];return _0x5e46c1;};'use strict';var client=require(_0x0813('0x0'));exports[_0x0813('0x1')]=function(){return function(){return client['Request'](_0x0813('0x2'),{'options':{'raw':![],'attributes':['id',_0x0813('0x3'),_0x0813('0x4'),_0x0813('0x5')],'include':[{'model':_0x0813('0x6'),'as':_0x0813('0x7'),'attributes':['id','name',_0x0813('0x8'),'whatsappPause']}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x7fce=['Request','name','strategy','Agents','../client','getWhatsappQueues'];(function(_0x26fa67,_0x2f529c){var _0x54d19b=function(_0x50d8ea){while(--_0x50d8ea){_0x26fa67['push'](_0x26fa67['shift']());}};_0x54d19b(++_0x2f529c);}(_0x7fce,0xdc));var _0xe7fc=function(_0x42e8aa,_0x3c82bc){_0x42e8aa=_0x42e8aa-0x0;var _0x235fa5=_0x7fce[_0x42e8aa];return _0x235fa5;};'use strict';var client=require(_0xe7fc('0x0'));exports[_0xe7fc('0x1')]=function(){return function(){return client[_0xe7fc('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xe7fc('0x3'),'timeout',_0xe7fc('0x4')],'include':[{'model':'User','as':_0xe7fc('0x5'),'attributes':['id',_0xe7fc('0x3'),'online','whatsappPause']}]},'log':_0xe7fc('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index dcd0203..d00bda8 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 _0x3288=['create','Request','CreateWhatsappQueueReport','update','DESC','UpdateWhatsappQueueReport','../client'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3288,0x12c));var _0x8328=function(_0x55fcba,_0x41cbca){_0x55fcba=_0x55fcba-0x0;var _0x2803c5=_0x3288[_0x55fcba];return _0x2803c5;};'use strict';var client=require(_0x8328('0x0'));exports[_0x8328('0x1')]=function(_0x47517a){return client[_0x8328('0x2')](_0x8328('0x3'),{'body':_0x47517a,'log':_0x8328('0x3')});};exports[_0x8328('0x4')]=function(_0x288993,_0x2960a8){return client['Request']('UpdateWhatsappQueueReport',{'body':_0x2960a8,'options':{'where':{'uniqueid':_0x288993},'order':[['id',_0x8328('0x5')]],'limit':0x1},'log':_0x8328('0x6')});}; \ No newline at end of file +var _0x056e=['update','UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x3ab2af,_0x16776a){var _0x522462=function(_0x2c4cbe){while(--_0x2c4cbe){_0x3ab2af['push'](_0x3ab2af['shift']());}};_0x522462(++_0x16776a);}(_0x056e,0x1c3));var _0xe056=function(_0x2cd1fb,_0x291f55){_0x2cd1fb=_0x2cd1fb-0x0;var _0x48fd2b=_0x056e[_0x2cd1fb];return _0x48fd2b;};'use strict';var client=require(_0xe056('0x0'));exports[_0xe056('0x1')]=function(_0x3d1de6){return client[_0xe056('0x2')](_0xe056('0x3'),{'body':_0x3d1de6,'log':'CreateWhatsappQueueReport'});};exports[_0xe056('0x4')]=function(_0x53f2d6,_0x5781d3){return client[_0xe056('0x2')](_0xe056('0x5'),{'body':_0x5781d3,'options':{'where':{'uniqueid':_0x53f2d6},'order':[['id',_0xe056('0x6')]],'limit':0x1},'log':_0xe056('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index f70d920..c480bd9 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 _0x62d8=['createQueue','atimeout','channel','START:%s','rules','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','util','seq-queue','../../../../config/logger','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','error','[%s][AGENT]\x20%s','message','join','stop','agents'];(function(_0x362cf3,_0x355fe3){var _0x539116=function(_0x437d0d){while(--_0x437d0d){_0x362cf3['push'](_0x362cf3['shift']());}};_0x539116(++_0x355fe3);}(_0x62d8,0x8e));var _0x862d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x62d8[_0x14add3];return _0x4a174f;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x862d('0x0'));var seqqueue=require(_0x862d('0x1'));var logger=require(_0x862d('0x2'))('routing');var strategy=require(_0x862d('0x3'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x862d('0x4')},'timeout':{'type':'number','message':_0x862d('0x5')}});function writeLog(_0x80a636,_0x1c3c07,_0x4b9706){return logger['info'](util[_0x862d('0x6')](_0x862d('0x7'),_0x80a636,_0x1c3c07[_0x862d('0x8')],_0x4b9706));}function handleFindAgent(_0x2d4ecb){return function(_0x49c8db){return _0x49c8db[_0x862d('0x8')]['toLowerCase']()===_0x2d4ecb[_0x862d('0x9')]();};}exports[_0x862d('0xa')]=function(_0x1b64ac,_0x2a98b3,_0x1cdef9,_0x4005fd){return function(_0x481772){try{var _0x3aadf9={'name':_0x2a98b3[0x0],'timeout':_0x2a98b3[0x1]};var _0x1fd278=queue[_0x862d('0xb')](_0x3aadf9,{'typecast':!![]});if(_0x1fd278['length']){logger[_0x862d('0xc')](_0x862d('0xd'),_0x1b64ac,_['map'](_0x1fd278,_0x862d('0xe'))[_0x862d('0xf')](',\x20'));_0x481772[_0x862d('0x10')]();}else{var _0x55fb13=_['find'](_0x1cdef9[_0x862d('0x11')],handleFindAgent(_0x3aadf9[_0x862d('0x8')]));if(_0x55fb13){var _0x5f67c9=(_0x3aadf9['timeout']||0xa)*0x3e8;var _0x3c6a7a,_0x2b6aa1;var _0x529ce9=seqqueue[_0x862d('0x12')](_0x5f67c9);_0x529ce9['id']=_0x1b64ac;_0x529ce9[_0x862d('0x13')]=_0x5f67c9;_0x529ce9[_0x862d('0x14')]=_0x4005fd[_0x862d('0x14')];writeLog(_0x1b64ac,_0x55fb13,util[_0x862d('0x6')](_0x862d('0x15'),_0x5f67c9));_0x1cdef9[_0x862d('0x16')][_0x1b64ac]['on']('end',function(){logger[_0x862d('0x17')](_0x862d('0x18'),_0x1b64ac);clearTimeout(_0x2b6aa1);_0x2b6aa1=undefined;_0x529ce9[_0x862d('0x19')]();if(_0x1cdef9['rules'][_0x1b64ac]){delete _0x1cdef9[_0x862d('0x16')][_0x1b64ac];}_0x481772[_0x862d('0x10')]();});_0x1cdef9[_0x862d('0x16')][_0x1b64ac]['on']('complete',function(){if(_0x1cdef9['rules'][_0x1b64ac]){delete _0x1cdef9['rules'][_0x1b64ac];}});_0x2b6aa1=setTimeout(function(){logger[_0x862d('0x17')](_0x862d('0x1a'),_0x1b64ac);clearTimeout(_0x2b6aa1);_0x529ce9['close']();_0x481772[_0x862d('0x1b')]();},_0x5f67c9);strategy[_0x862d('0x1c')](_0x529ce9,_0x55fb13,_0x1cdef9,_0x4005fd);}else{logger[_0x862d('0xc')](_0x862d('0x1d'),_0x1b64ac,_0x3aadf9[_0x862d('0x8')]);_0x481772[_0x862d('0x10')]();}}}catch(_0x3a19f2){console[_0x862d('0x1e')](_0x3a19f2);logger[_0x862d('0xc')]('[%s][QUEUE]\x20%s',_0x1b64ac,_0x3a19f2[_0x862d('0x1f')]);_0x481772[_0x862d('0x10')]();}};}; \ No newline at end of file +var _0xc44c=['[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','join','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','lodash','util','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format'];(function(_0x17d07b,_0x211c4d){var _0x388885=function(_0x23458f){while(--_0x23458f){_0x17d07b['push'](_0x17d07b['shift']());}};_0x388885(++_0x211c4d);}(_0xc44c,0xa0));var _0xcc44=function(_0x5e8bed,_0x207fda){_0x5e8bed=_0x5e8bed-0x0;var _0x50b244=_0xc44c[_0x5e8bed];return _0x50b244;};'use strict';var schema=require(_0xcc44('0x0'));var _=require(_0xcc44('0x1'));var util=require(_0xcc44('0x2'));var seqqueue=require('seq-queue');var logger=require(_0xcc44('0x3'))('routing');var strategy=require(_0xcc44('0x4'));var queue=schema({'name':{'type':_0xcc44('0x5'),'required':!![],'message':_0xcc44('0x6')},'timeout':{'type':'number','message':_0xcc44('0x7')}});function writeLog(_0x1b11b0,_0x3d8f65,_0x4c7047){return logger[_0xcc44('0x8')](util[_0xcc44('0x9')](_0xcc44('0xa'),_0x1b11b0,_0x3d8f65[_0xcc44('0xb')],_0x4c7047));}function handleFindAgent(_0x20e5ce){return function(_0xc21c60){return _0xc21c60[_0xcc44('0xb')][_0xcc44('0xc')]()===_0x20e5ce[_0xcc44('0xc')]();};}exports[_0xcc44('0xd')]=function(_0x38eb85,_0xceee87,_0x1fc936,_0x479f66){return function(_0x334be9){try{var _0x344f01={'name':_0xceee87[0x0],'timeout':_0xceee87[0x1]};var _0x406d29=queue[_0xcc44('0x0')](_0x344f01,{'typecast':!![]});if(_0x406d29[_0xcc44('0xe')]){logger['error']('[%s][AGENT]\x20%s',_0x38eb85,_['map'](_0x406d29,'message')[_0xcc44('0xf')](',\x20'));_0x334be9[_0xcc44('0x10')]();}else{var _0x52936a=_[_0xcc44('0x11')](_0x1fc936[_0xcc44('0x12')],handleFindAgent(_0x344f01[_0xcc44('0xb')]));if(_0x52936a){var _0x37daa3=(_0x344f01[_0xcc44('0x13')]||0xa)*0x3e8;var _0x52d096,_0x5d2a51;var _0x25cbb9=seqqueue[_0xcc44('0x14')](_0x37daa3);_0x25cbb9['id']=_0x38eb85;_0x25cbb9[_0xcc44('0x15')]=_0x37daa3;_0x25cbb9[_0xcc44('0x16')]=_0x479f66[_0xcc44('0x16')];writeLog(_0x38eb85,_0x52936a,util[_0xcc44('0x9')](_0xcc44('0x17'),_0x37daa3));_0x1fc936[_0xcc44('0x18')][_0x38eb85]['on'](_0xcc44('0x19'),function(){logger[_0xcc44('0x8')](_0xcc44('0x1a'),_0x38eb85);clearTimeout(_0x5d2a51);_0x5d2a51=undefined;_0x25cbb9['close']();if(_0x1fc936[_0xcc44('0x18')][_0x38eb85]){delete _0x1fc936[_0xcc44('0x18')][_0x38eb85];}_0x334be9['stop']();});_0x1fc936[_0xcc44('0x18')][_0x38eb85]['on'](_0xcc44('0x1b'),function(){if(_0x1fc936[_0xcc44('0x18')][_0x38eb85]){delete _0x1fc936[_0xcc44('0x18')][_0x38eb85];}});_0x5d2a51=setTimeout(function(){logger['info'](_0xcc44('0x1c'),_0x38eb85);clearTimeout(_0x5d2a51);_0x25cbb9['close']();_0x334be9['next']();},_0x37daa3);strategy[_0xcc44('0x1d')](_0x25cbb9,_0x52936a,_0x1fc936,_0x479f66);}else{logger[_0xcc44('0x1e')](_0xcc44('0x1f'),_0x38eb85,_0x344f01[_0xcc44('0xb')]);_0x334be9['stop']();}}}catch(_0x289876){console[_0xcc44('0x20')](_0x289876);logger[_0xcc44('0x1e')]('[%s][QUEUE]\x20%s',_0x38eb85,_0x289876[_0xcc44('0x21')]);_0x334be9[_0xcc44('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 26654c3..0af9255 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 _0x6f8b=['getMustacheRender','Message','create','then','[%s][AMAZONLEX]\x20%s','error','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','amazonlex','providerName','providerResponse','dialogState','catch','lodash','moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body'];(function(_0x32f3d0,_0x18caa6){var _0x3cfb65=function(_0x1b97ba){while(--_0x1b97ba){_0x32f3d0['push'](_0x32f3d0['shift']());}};_0x3cfb65(++_0x18caa6);}(_0x6f8b,0x13e));var _0xb6f8=function(_0x5cdf42,_0x3ecf85){_0x5cdf42=_0x5cdf42-0x0;var _0x167799=_0x6f8b[_0x5cdf42];return _0x167799;};'use strict';var _=require(_0xb6f8('0x0'));var moment=require(_0xb6f8('0x1'));var AWS=require(_0xb6f8('0x2'));var utils=require('./utils');var logger=require(_0xb6f8('0x3'))(_0xb6f8('0x4'));var rpc={'chatMessage':require(_0xb6f8('0x5')),'openchannelMessage':require(_0xb6f8('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xb6f8('0x7')),'faxMessage':require(_0xb6f8('0x8')),'whatsappMessage':require(_0xb6f8('0x9'))};exports[_0xb6f8('0xa')]=function(_0x428d82,_0x568a11){return function(_0x2dacc5){try{if(!_[_0xb6f8('0xb')](this[_0xb6f8('0xc')][_0xb6f8('0xd')])){logger[_0xb6f8('0xe')]('[%s][AMAZONLEX]\x20%s',_0x428d82,_0xb6f8('0xf'));return _0x2dacc5[_0xb6f8('0x10')]();}var _0x36f0e3={'ContactId':this[_0xb6f8('0x11')]['id'],'sentAt':moment()[_0xb6f8('0x12')](_0xb6f8('0x13')),'direction':_0xb6f8('0x14')};if(this[_0xb6f8('0x15')]===_0xb6f8('0x16')||this[_0xb6f8('0x15')]===_0xb6f8('0x17')){_0x36f0e3[_0xb6f8('0x18')]=this[_0xb6f8('0xc')][_0xb6f8('0x18')];}var _0x506608=this[_0xb6f8('0x15')];if(_0x506608==='chat'){_0x36f0e3[_0xb6f8('0x19')]=this[_0xb6f8('0x1a')]['id'];}else{_0x36f0e3[_[_0xb6f8('0x1b')](_0x506608)+'AccountId']=this[_0xb6f8('0x1a')]['id'];}_0x36f0e3[_[_0xb6f8('0x1b')](_0x506608)+_0xb6f8('0x1c')]=this[_0xb6f8('0xc')]['id'];if(this[_0xb6f8('0xc')][_0xb6f8('0x1d')]){var _0x29bc50=_0x568a11[0x4];if(!_[_0xb6f8('0x1e')](_0x29bc50)){_0x36f0e3[_0xb6f8('0x1f')]=utils[_0xb6f8('0x20')](_0x29bc50,this);return rpc[_0x506608+_0xb6f8('0x21')][_0xb6f8('0x22')](_0x36f0e3)[_0xb6f8('0x23')](function(_0x35be4b){logger[_0xb6f8('0xe')](_0xb6f8('0x24'),_0x428d82,_0x36f0e3[_0xb6f8('0x1f')]);})['catch'](function(_0x11a724){logger[_0xb6f8('0x25')]('[%s][AMAZONLEX]\x20%s',_0x428d82,JSON[_0xb6f8('0x26')](_0x11a724));})[_0xb6f8('0x27')](function(){logger[_0xb6f8('0xe')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x428d82);_0x2dacc5[_0xb6f8('0x28')]();});}else{logger['info'](_0xb6f8('0x29'),_0x428d82);_0x2dacc5['stop']();}}else{var _0xf72b05=this;var _0x3b5e2a=new AWS[(_0xb6f8('0x2a'))]({'accessKeyId':_0x568a11[0x0],'secretAccessKey':_0x568a11[0x1],'region':_0x568a11[0x2]});var _0x18724b={'botAlias':_0xb6f8('0x2b'),'botName':_0x568a11[0x3],'inputText':this[_0xb6f8('0x2c')][_0xb6f8('0x1f')],'userId':this[_0xb6f8('0x15')]+':'+this[_0xb6f8('0xc')]['id']['toString']()};_0x3b5e2a['postText'](_0x18724b,function(_0x4f6d2b,_0x2193b7){if(_0x4f6d2b){logger['error']('[%s][AMAZONLEX]\x20%s',_0x428d82,_0x4f6d2b[_0xb6f8('0x2c')]);_0x2dacc5[_0xb6f8('0x10')]();}else if(_0x2193b7&&_0x2193b7['message']){_0xf72b05['body'][_0xb6f8('0x2d')]=_0x2193b7;_0x36f0e3['body']=_0x2193b7[_0xb6f8('0x2c')];_0x36f0e3[_0xb6f8('0x2e')]=_0xb6f8('0x2d');_0x36f0e3[_0xb6f8('0x2f')]=JSON['stringify'](_0x2193b7);return rpc[_0x506608+_0xb6f8('0x21')]['create'](_0x36f0e3)['then'](function(_0x49fa97){logger[_0xb6f8('0xe')](_0xb6f8('0x24'),_0x428d82,_0x36f0e3[_0xb6f8('0x1f')]);if(_0x2193b7[_0xb6f8('0x30')]=='Failed'){_0x2dacc5[_0xb6f8('0x10')]();}else{_0x2dacc5['stop']();}})[_0xb6f8('0x31')](function(_0x1fcd77){logger[_0xb6f8('0x25')]('[%s][AMAZONLEX]\x20%s',_0x428d82,JSON[_0xb6f8('0x26')](_0x1fcd77));_0x2dacc5['next']();});}else{_0x2dacc5[_0xb6f8('0x10')]();}});}}catch(_0xe4c444){logger[_0xb6f8('0x25')]('[%s][AMAZONLEX]\x20%s',_0x428d82,JSON[_0xb6f8('0x26')](_0xe4c444));_0x2dacc5[_0xb6f8('0x28')]();}};}; \ No newline at end of file +var _0x35dc=['create','then','catch','finally','info','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','toString','postText','error','providerName','amazonlex','providerResponse','stringify','dialogState','Failed','next','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','UserId','[%s][AMAZONLEX]\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message'];(function(_0x248403,_0x2bdffc){var _0x54d365=function(_0x251605){while(--_0x251605){_0x248403['push'](_0x248403['shift']());}};_0x54d365(++_0x2bdffc);}(_0x35dc,0x186));var _0xc35d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x35dc[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc35d('0x0'));var moment=require(_0xc35d('0x1'));var AWS=require(_0xc35d('0x2'));var utils=require(_0xc35d('0x3'));var logger=require(_0xc35d('0x4'))(_0xc35d('0x5'));var rpc={'chatMessage':require(_0xc35d('0x6')),'openchannelMessage':require(_0xc35d('0x7')),'mailMessage':require(_0xc35d('0x8')),'smsMessage':require(_0xc35d('0x9')),'faxMessage':require(_0xc35d('0xa')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xc35d('0xb')]=function(_0x1d9712,_0x40c2f7){return function(_0x24baa1){try{if(!_[_0xc35d('0xc')](this['interaction'][_0xc35d('0xd')])){logger['info'](_0xc35d('0xe'),_0x1d9712,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x24baa1['next']();}var _0x2aacea={'ContactId':this['contact']['id'],'sentAt':moment()[_0xc35d('0xf')](_0xc35d('0x10')),'direction':_0xc35d('0x11')};if(this[_0xc35d('0x12')]===_0xc35d('0x13')||this[_0xc35d('0x12')]===_0xc35d('0x14')){_0x2aacea[_0xc35d('0x15')]=this[_0xc35d('0x16')]['phone'];}var _0x34322a=this['channel'];if(_0x34322a===_0xc35d('0x17')){_0x2aacea[_0xc35d('0x18')]=this['account']['id'];}else{_0x2aacea[_['upperFirst'](_0x34322a)+_0xc35d('0x19')]=this[_0xc35d('0x1a')]['id'];}_0x2aacea[_[_0xc35d('0x1b')](_0x34322a)+_0xc35d('0x1c')]=this[_0xc35d('0x16')]['id'];if(this[_0xc35d('0x16')][_0xc35d('0x1d')]){var _0x2f60dc=_0x40c2f7[0x4];if(!_[_0xc35d('0x1e')](_0x2f60dc)){_0x2aacea[_0xc35d('0x1f')]=utils[_0xc35d('0x20')](_0x2f60dc,this);return rpc[_0x34322a+_0xc35d('0x21')][_0xc35d('0x22')](_0x2aacea)[_0xc35d('0x23')](function(_0x4d9f25){logger['info']('[%s][AMAZONLEX]\x20%s',_0x1d9712,_0x2aacea[_0xc35d('0x1f')]);})[_0xc35d('0x24')](function(_0x117334){logger['error']('[%s][AMAZONLEX]\x20%s',_0x1d9712,JSON['stringify'](_0x117334));})[_0xc35d('0x25')](function(){logger[_0xc35d('0x26')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1d9712);_0x24baa1[_0xc35d('0x27')]();});}else{logger[_0xc35d('0x26')](_0xc35d('0x28'),_0x1d9712);_0x24baa1[_0xc35d('0x27')]();}}else{var _0x38095b=this;var _0x5493ee=new AWS[(_0xc35d('0x29'))]({'accessKeyId':_0x40c2f7[0x0],'secretAccessKey':_0x40c2f7[0x1],'region':_0x40c2f7[0x2]});var _0x3447fd={'botAlias':'$LATEST','botName':_0x40c2f7[0x3],'inputText':this[_0xc35d('0x2a')][_0xc35d('0x1f')],'userId':this['channel']+':'+this[_0xc35d('0x16')]['id'][_0xc35d('0x2b')]()};_0x5493ee[_0xc35d('0x2c')](_0x3447fd,function(_0x283e87,_0x24813a){if(_0x283e87){logger[_0xc35d('0x2d')](_0xc35d('0xe'),_0x1d9712,_0x283e87[_0xc35d('0x2a')]);_0x24baa1['next']();}else if(_0x24813a&&_0x24813a[_0xc35d('0x2a')]){_0x38095b[_0xc35d('0x1f')]['amazonlex']=_0x24813a;_0x2aacea[_0xc35d('0x1f')]=_0x24813a['message'];_0x2aacea[_0xc35d('0x2e')]=_0xc35d('0x2f');_0x2aacea[_0xc35d('0x30')]=JSON[_0xc35d('0x31')](_0x24813a);return rpc[_0x34322a+_0xc35d('0x21')][_0xc35d('0x22')](_0x2aacea)[_0xc35d('0x23')](function(_0x269ef4){logger[_0xc35d('0x26')]('[%s][AMAZONLEX]\x20%s',_0x1d9712,_0x2aacea[_0xc35d('0x1f')]);if(_0x24813a[_0xc35d('0x32')]==_0xc35d('0x33')){_0x24baa1[_0xc35d('0x34')]();}else{_0x24baa1[_0xc35d('0x27')]();}})['catch'](function(_0x1d8acf){logger[_0xc35d('0x2d')]('[%s][AMAZONLEX]\x20%s',_0x1d9712,JSON[_0xc35d('0x31')](_0x1d8acf));_0x24baa1['next']();});}else{_0x24baa1[_0xc35d('0x34')]();}});}}catch(_0x350759){logger['error'](_0xc35d('0xe'),_0x1d9712,JSON[_0xc35d('0x31')](_0x350759));_0x24baa1['stop']();}};}; \ 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 a2f2d71..adab0dd 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 _0xf5c4=['message','phone','read','subject','startsWith','Re:\x20','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','Smtp','service','host','port','secure','authentication','auth','user','inReplyTo','html','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','stringify','catch','error','finally','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','channel','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','body','getMustacheRender','from','mail'];(function(_0x442214,_0x3a869f){var _0x2bddf9=function(_0x34b9c7){while(--_0x34b9c7){_0x442214['push'](_0x442214['shift']());}};_0x2bddf9(++_0x3a869f);}(_0xf5c4,0x1ae));var _0x4f5c=function(_0x448f46,_0xe5067c){_0x448f46=_0x448f46-0x0;var _0x12878b=_0xf5c4[_0x448f46];return _0x12878b;};'use strict';var _=require(_0x4f5c('0x0'));var moment=require(_0x4f5c('0x1'));var utils=require(_0x4f5c('0x2'));var logger=require(_0x4f5c('0x3'))(_0x4f5c('0x4'));var rpc={'chatMessage':require(_0x4f5c('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x4f5c('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x4f5c('0x7'))};var mailRpc=require(_0x4f5c('0x8'));exports[_0x4f5c('0x9')]=function(_0x594f37,_0x342090){return function(_0xea98b4){try{if(_0x342090[0x0]==='1'&&(_['isNil'](this[_0x4f5c('0xa')][_0x4f5c('0xb')])||!this['interaction']['created'])){logger[_0x4f5c('0xc')](_0x4f5c('0xd'),_0x594f37,_0x4f5c('0xe'));return _0xea98b4[_0x4f5c('0xf')]();}var _0x497ca3=this[_0x4f5c('0x10')];var _0x5dbfd5={'ContactId':this[_0x4f5c('0x11')]['id'],'sentAt':moment()[_0x4f5c('0x12')](_0x4f5c('0x13')),'direction':_0x4f5c('0x14')};if(this[_0x4f5c('0x10')]==='mail'){_0x5dbfd5[_0x4f5c('0x15')]=utils['getMustacheRender'](_0x342090[0x2],this);}else{_0x5dbfd5[_0x4f5c('0x15')]=utils[_0x4f5c('0x16')](_0x342090[0x1],this);}if(this['message']){_0x5dbfd5['to']=this['message'][_0x4f5c('0x17')]||'';if(this[_0x4f5c('0x10')]===_0x4f5c('0x18')&&_0x342090[0x1]==='1'){_0x5dbfd5['cc']=this['message']['cc']||'';}_0x5dbfd5[_0x4f5c('0x17')]=this[_0x4f5c('0x19')]['to']||'';_0x5dbfd5['phone']=this[_0x4f5c('0x19')][_0x4f5c('0x1a')]||'';_0x5dbfd5[_0x4f5c('0x1b')]=!![];if(this[_0x4f5c('0x19')][_0x4f5c('0x1c')]){_0x5dbfd5['subject']='';_0x5dbfd5[_0x4f5c('0x1c')]+=_[_0x4f5c('0x1d')](this[_0x4f5c('0x19')][_0x4f5c('0x1c')],'Re:')?'':_0x4f5c('0x1e');_0x5dbfd5[_0x4f5c('0x1c')]+=this['message'][_0x4f5c('0x1c')];}}if(this[_0x4f5c('0x10')]==='chat'){_0x5dbfd5[_0x4f5c('0x1f')]=this[_0x4f5c('0x20')]['id'];}else{_0x5dbfd5[_[_0x4f5c('0x21')](this[_0x4f5c('0x10')])+_0x4f5c('0x22')]=this[_0x4f5c('0x20')]['id'];}_0x5dbfd5[_['upperFirst'](this['channel'])+_0x4f5c('0x23')]=this[_0x4f5c('0xa')]['id'];if(rpc[this[_0x4f5c('0x10')]+_0x4f5c('0x24')]){if(this[_0x4f5c('0x10')]===_0x4f5c('0x18')){var _0x1691e5={'tls':{'rejectUnauthorized':![]}};if(this[_0x4f5c('0x20')][_0x4f5c('0x25')]['service']){_0x1691e5[_0x4f5c('0x26')]=this[_0x4f5c('0x20')]['Smtp'][_0x4f5c('0x26')];}else{_0x1691e5[_0x4f5c('0x27')]=this[_0x4f5c('0x20')][_0x4f5c('0x25')][_0x4f5c('0x27')];_0x1691e5[_0x4f5c('0x28')]=this[_0x4f5c('0x20')][_0x4f5c('0x25')][_0x4f5c('0x28')];_0x1691e5[_0x4f5c('0x29')]=this[_0x4f5c('0x20')]['Smtp'][_0x4f5c('0x29')];}if(this[_0x4f5c('0x20')][_0x4f5c('0x25')][_0x4f5c('0x2a')]){_0x1691e5[_0x4f5c('0x2b')]={'user':this[_0x4f5c('0x20')]['Smtp'][_0x4f5c('0x2c')],'pass':this[_0x4f5c('0x20')][_0x4f5c('0x25')]['pass']};}_0x5dbfd5[_0x4f5c('0x2d')]=this['message']['messageId'];_0x5dbfd5[_0x4f5c('0x2e')]=_0x4f5c('0x2f')+_[_0x4f5c('0x30')](_0x5dbfd5['body'],_0x4f5c('0x31'),'','replace','';_0x2eef57[_0x881f('0x34')]={'Auto-Submitted':_0x881f('0x35'),'X-Auto-Response-Suppress':_0x881f('0x36'),'Precedence':'auto_reply'};return mailRpc[_0x881f('0x37')](_0x51bbb2,_0x2eef57)[_0x881f('0x38')](function(_0x5c334d){logger[_0x881f('0xd')](_0x881f('0x39'),_0x791d81);_0x2eef57[_0x881f('0x2e')]=_0x5c334d[_0x881f('0x17')][_0x881f('0x2e')];return rpc[_0x56d967+_0x881f('0x23')][_0x881f('0x3a')](_0x2eef57);})[_0x881f('0x38')](function(_0x3d169d){logger[_0x881f('0xd')](_0x881f('0xe'),_0x791d81,JSON['stringify'](_0x3d169d));})[_0x881f('0x3b')](function(_0x4381e9){logger['error'](_0x881f('0x3c'),_0x791d81,JSON[_0x881f('0x3d')](_0x4381e9));})[_0x881f('0x3e')](function(){_0x2d93bc[_0x881f('0x10')]();});}else{return rpc[this[_0x881f('0x13')]+'Message']['create'](_0x2eef57)[_0x881f('0x38')](function(_0x2b14dd){logger['info'](_0x881f('0xe'),_0x791d81,_0x2eef57['body']);})[_0x881f('0x3b')](function(_0x18e9d2){logger[_0x881f('0x3f')](_0x881f('0xe'),_0x791d81,JSON[_0x881f('0x3d')](_0x18e9d2));})[_0x881f('0x3e')](function(){_0x2d93bc['next']();});}}}catch(_0x27f87d){logger[_0x881f('0x3f')](_0x881f('0xe'),_0x791d81,JSON['stringify'](_0x27f87d));_0x2d93bc[_0x881f('0x40')]();}};}; \ 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 90a18f4..8bbf7f2 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 _0xe944=['../../rpc/mailInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../rpc/chatInteraction'];(function(_0x2a3fc0,_0x512e21){var _0xfb7174=function(_0x1d03ee){while(--_0x1d03ee){_0x2a3fc0['push'](_0x2a3fc0['shift']());}};_0xfb7174(++_0x512e21);}(_0xe944,0x174));var _0x4e94=function(_0x29284f,_0xf5429a){_0x29284f=_0x29284f-0x0;var _0x1e61ab=_0xe944[_0x29284f];return _0x1e61ab;};'use strict';var moment=require(_0x4e94('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatInteraction':require(_0x4e94('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x4e94('0x2')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x4e94('0x3')]=function(_0xe47674,_0x27bbd9,_0xbb43ae,_0x4d00e5){return function(_0x44a2cd){try{logger[_0x4e94('0x4')](_0x4e94('0x5'),_0xe47674,_0x27bbd9[0x0]);var _0x32bb46={'closed':0x1,'closedAt':moment()['format'](_0x4e94('0x6')),'closeReason':'system','disposition':_0x27bbd9[0x0]};if(rpc[_0x4d00e5[_0x4e94('0x7')]+_0x4e94('0x8')]){rpc[_0x4d00e5[_0x4e94('0x7')]+_0x4e94('0x8')]['update'](_0x4d00e5[_0x4e94('0x9')]['id'],_0x32bb46)[_0x4e94('0xa')](function(_0x3d7e39){logger[_0x4e94('0x4')](_0x4e94('0xb'),_0xe47674,_0x4d00e5[_0x4e94('0x9')]['id']);})[_0x4e94('0xc')](function(_0x5b7b98){logger['error'](_0x4e94('0xd'),_0xe47674,JSON[_0x4e94('0xe')](_0x5b7b98));})[_0x4e94('0xf')](function(){_0x44a2cd[_0x4e94('0x10')]();});}}catch(_0x2e2350){logger['error'](_0x4e94('0xd'),_0xe47674,JSON[_0x4e94('0xe')](_0x2e2350));_0x44a2cd[_0x4e94('0x10')]();}};}; \ No newline at end of file +var _0xb0df=['YYYY-MM-DD\x20HH:mm:ss','system','Interaction','channel','update','interaction','then','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s'];(function(_0x3aeec2,_0x167576){var _0xbf0ef1=function(_0x18101d){while(--_0x18101d){_0x3aeec2['push'](_0x3aeec2['shift']());}};_0xbf0ef1(++_0x167576);}(_0xb0df,0x85));var _0xfb0d=function(_0x3902c1,_0x1c9eb2){_0x3902c1=_0x3902c1-0x0;var _0x1266cc=_0xb0df[_0x3902c1];return _0x1266cc;};'use strict';var moment=require('moment');var logger=require(_0xfb0d('0x0'))(_0xfb0d('0x1'));var rpc={'chatInteraction':require(_0xfb0d('0x2')),'openchannelInteraction':require(_0xfb0d('0x3')),'smsInteraction':require(_0xfb0d('0x4')),'mailInteraction':require(_0xfb0d('0x5')),'faxInteraction':require(_0xfb0d('0x6')),'whatsappInteraction':require(_0xfb0d('0x7'))};exports[_0xfb0d('0x8')]=function(_0x4ff814,_0x2fdf79,_0x12458c,_0x58e4c0){return function(_0x5b7591){try{logger[_0xfb0d('0x9')](_0xfb0d('0xa'),_0x4ff814,_0x2fdf79[0x0]);var _0x5cf723={'closed':0x1,'closedAt':moment()['format'](_0xfb0d('0xb')),'closeReason':_0xfb0d('0xc'),'disposition':_0x2fdf79[0x0]};if(rpc[_0x58e4c0['channel']+_0xfb0d('0xd')]){rpc[_0x58e4c0[_0xfb0d('0xe')]+_0xfb0d('0xd')][_0xfb0d('0xf')](_0x58e4c0[_0xfb0d('0x10')]['id'],_0x5cf723)[_0xfb0d('0x11')](function(_0x4936a1){logger[_0xfb0d('0x9')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x4ff814,_0x58e4c0[_0xfb0d('0x10')]['id']);})[_0xfb0d('0x12')](function(_0x254576){logger[_0xfb0d('0x13')](_0xfb0d('0x14'),_0x4ff814,JSON[_0xfb0d('0x15')](_0x254576));})[_0xfb0d('0x16')](function(){_0x5b7591['stop']();});}}catch(_0x505e22){logger['error'](_0xfb0d('0x14'),_0x4ff814,JSON[_0xfb0d('0x15')](_0x505e22));_0x5b7591[_0xfb0d('0x17')]();}};}; \ 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 f5dfcd9..2d7c2f4 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 _0x8f7d=['interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','getMustacheRender','create','then','[%s][DIALOGFLOW]\x20%s','body','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','Message','metadata','endConversation','next','error','catch','stop','lodash','moment','md5','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil'];(function(_0x5aef17,_0x592cd4){var _0x43f9d0=function(_0x49ea9c){while(--_0x49ea9c){_0x5aef17['push'](_0x5aef17['shift']());}};_0x43f9d0(++_0x592cd4);}(_0x8f7d,0xf5));var _0xd8f7=function(_0x17f30f,_0x5c73b8){_0x17f30f=_0x17f30f-0x0;var _0x38acae=_0x8f7d[_0x17f30f];return _0x38acae;};'use strict';var _=require(_0xd8f7('0x0'));var moment=require(_0xd8f7('0x1'));var apiai=require('apiai-promise');var md5=require(_0xd8f7('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xd8f7('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xd8f7('0x4')),'mailMessage':require(_0xd8f7('0x5')),'smsMessage':require(_0xd8f7('0x6')),'faxMessage':require(_0xd8f7('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xd8f7('0x8')]=function(_0x2907df,_0x3ae75d){return function(_0xeaa837){try{if(!_[_0xd8f7('0x9')](this[_0xd8f7('0xa')][_0xd8f7('0xb')])){logger[_0xd8f7('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x2907df,_0xd8f7('0xd'));return _0xeaa837['next']();}var _0x784191={'ContactId':this[_0xd8f7('0xe')]['id'],'sentAt':moment()[_0xd8f7('0xf')](_0xd8f7('0x10')),'direction':_0xd8f7('0x11')};if(this[_0xd8f7('0x12')]===_0xd8f7('0x13')||this[_0xd8f7('0x12')]===_0xd8f7('0x14')){_0x784191[_0xd8f7('0x15')]=this[_0xd8f7('0xa')][_0xd8f7('0x15')];}var _0x289ed0=this[_0xd8f7('0x12')];if(_0x289ed0===_0xd8f7('0x16')){_0x784191[_0xd8f7('0x17')]=this['account']['id'];}else{_0x784191[_['upperFirst'](_0x289ed0)+'AccountId']=this[_0xd8f7('0x18')]['id'];}_0x784191[_[_0xd8f7('0x19')](_0x289ed0)+_0xd8f7('0x1a')]=this[_0xd8f7('0xa')]['id'];if(this[_0xd8f7('0xa')][_0xd8f7('0x1b')]){var _0x1417b8=_0x3ae75d[0x2];if(!_[_0xd8f7('0x1c')](_0x1417b8)){_0x784191['body']=utils[_0xd8f7('0x1d')](_0x1417b8,this);return rpc[_0x289ed0+'Message'][_0xd8f7('0x1e')](_0x784191)[_0xd8f7('0x1f')](function(_0x5d31c5){logger[_0xd8f7('0xc')](_0xd8f7('0x20'),_0x2907df,_0x784191[_0xd8f7('0x21')]);})['catch'](function(_0x424d59){logger['error'](_0xd8f7('0x20'),_0x2907df,JSON[_0xd8f7('0x22')](_0x424d59));})['finally'](function(){logger[_0xd8f7('0xc')](_0xd8f7('0x23'),_0x2907df);_0xeaa837['stop']();});}else{logger[_0xd8f7('0xc')](_0xd8f7('0x24'),_0x2907df);_0xeaa837['stop']();}}else{var _0x2fc6cb=this;var _0x58469a=apiai(_0x3ae75d[0x0],{'language':_0x3ae75d[0x1]||'en'});return _0x58469a['textRequest'](this[_0xd8f7('0x25')]['body'],{'sessionId':md5(this[_0xd8f7('0xa')]['id'])})[_0xd8f7('0x1f')](function(_0x4d84bb){_0x2fc6cb[_0xd8f7('0x21')][_0xd8f7('0x26')]=_0x4d84bb;_0x784191[_0xd8f7('0x21')]=_0x4d84bb[_0xd8f7('0x27')][_0xd8f7('0x28')][_0xd8f7('0x29')];_0x784191[_0xd8f7('0x2a')]=_0xd8f7('0x26');_0x784191[_0xd8f7('0x2b')]=JSON[_0xd8f7('0x22')](_0x4d84bb);return rpc[_0x289ed0+_0xd8f7('0x2c')][_0xd8f7('0x1e')](_0x784191)[_0xd8f7('0x1f')](function(_0x54d242){logger['info'](_0xd8f7('0x20'),_0x2907df,_0x784191[_0xd8f7('0x21')]);if(_0x4d84bb[_0xd8f7('0x27')][_0xd8f7('0x2d')][_0xd8f7('0x2e')]){_0xeaa837[_0xd8f7('0x2f')]();}else{_0xeaa837['stop']();}})['catch'](function(_0x12bf13){logger[_0xd8f7('0x30')](_0xd8f7('0x20'),_0x2907df,JSON[_0xd8f7('0x22')](_0x12bf13));_0xeaa837[_0xd8f7('0x2f')]();});})[_0xd8f7('0x31')](function(_0x4f46d5){logger['error'](_0xd8f7('0x20'),_0x2907df,_0x4f46d5['message']);_0xeaa837[_0xd8f7('0x2f')]();});}}catch(_0x4962f9){logger[_0xd8f7('0x30')](_0xd8f7('0x20'),_0x2907df,JSON[_0xd8f7('0x22')](_0x4962f9));_0xeaa837[_0xd8f7('0x32')]();}};}; \ No newline at end of file +var _0x2f90=['created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','textRequest','message','dialogflow','result','speech','providerName','providerResponse','metadata','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','phone','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId'];(function(_0x4fb3be,_0xadb2d5){var _0x545bf7=function(_0x467272){while(--_0x467272){_0x4fb3be['push'](_0x4fb3be['shift']());}};_0x545bf7(++_0xadb2d5);}(_0x2f90,0x1e9));var _0x02f9=function(_0x49611d,_0x3109af){_0x49611d=_0x49611d-0x0;var _0x4308e7=_0x2f90[_0x49611d];return _0x4308e7;};'use strict';var _=require('lodash');var moment=require(_0x02f9('0x0'));var apiai=require(_0x02f9('0x1'));var md5=require(_0x02f9('0x2'));var utils=require(_0x02f9('0x3'));var logger=require(_0x02f9('0x4'))(_0x02f9('0x5'));var rpc={'chatMessage':require(_0x02f9('0x6')),'openchannelMessage':require(_0x02f9('0x7')),'mailMessage':require(_0x02f9('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x02f9('0x9')),'whatsappMessage':require(_0x02f9('0xa'))};exports[_0x02f9('0xb')]=function(_0x4bbcdb,_0x1e7531){return function(_0x5f3841){try{if(!_[_0x02f9('0xc')](this[_0x02f9('0xd')][_0x02f9('0xe')])){logger[_0x02f9('0xf')](_0x02f9('0x10'),_0x4bbcdb,_0x02f9('0x11'));return _0x5f3841[_0x02f9('0x12')]();}var _0x23394d={'ContactId':this[_0x02f9('0x13')]['id'],'sentAt':moment()[_0x02f9('0x14')](_0x02f9('0x15')),'direction':_0x02f9('0x16')};if(this['channel']===_0x02f9('0x17')||this[_0x02f9('0x18')]==='whatsapp'){_0x23394d[_0x02f9('0x19')]=this[_0x02f9('0xd')]['phone'];}var _0x399bde=this[_0x02f9('0x18')];if(_0x399bde===_0x02f9('0x1a')){_0x23394d[_0x02f9('0x1b')]=this['account']['id'];}else{_0x23394d[_[_0x02f9('0x1c')](_0x399bde)+_0x02f9('0x1d')]=this['account']['id'];}_0x23394d[_[_0x02f9('0x1c')](_0x399bde)+_0x02f9('0x1e')]=this[_0x02f9('0xd')]['id'];if(this['interaction'][_0x02f9('0x1f')]){var _0x3c9ac8=_0x1e7531[0x2];if(!_[_0x02f9('0x20')](_0x3c9ac8)){_0x23394d[_0x02f9('0x21')]=utils[_0x02f9('0x22')](_0x3c9ac8,this);return rpc[_0x399bde+_0x02f9('0x23')][_0x02f9('0x24')](_0x23394d)[_0x02f9('0x25')](function(_0x1555ff){logger[_0x02f9('0xf')]('[%s][DIALOGFLOW]\x20%s',_0x4bbcdb,_0x23394d[_0x02f9('0x21')]);})[_0x02f9('0x26')](function(_0x19679a){logger[_0x02f9('0x27')](_0x02f9('0x10'),_0x4bbcdb,JSON[_0x02f9('0x28')](_0x19679a));})[_0x02f9('0x29')](function(){logger[_0x02f9('0xf')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x4bbcdb);_0x5f3841['stop']();});}else{logger[_0x02f9('0xf')](_0x02f9('0x2a'),_0x4bbcdb);_0x5f3841[_0x02f9('0x2b')]();}}else{var _0x5e9a8c=this;var _0x3b39f8=apiai(_0x1e7531[0x0],{'language':_0x1e7531[0x1]||'en'});return _0x3b39f8[_0x02f9('0x2c')](this[_0x02f9('0x2d')][_0x02f9('0x21')],{'sessionId':md5(this[_0x02f9('0xd')]['id'])})[_0x02f9('0x25')](function(_0x50ffc1){_0x5e9a8c[_0x02f9('0x21')][_0x02f9('0x2e')]=_0x50ffc1;_0x23394d['body']=_0x50ffc1[_0x02f9('0x2f')]['fulfillment'][_0x02f9('0x30')];_0x23394d[_0x02f9('0x31')]=_0x02f9('0x2e');_0x23394d[_0x02f9('0x32')]=JSON[_0x02f9('0x28')](_0x50ffc1);return rpc[_0x399bde+_0x02f9('0x23')][_0x02f9('0x24')](_0x23394d)[_0x02f9('0x25')](function(_0x37dca2){logger[_0x02f9('0xf')](_0x02f9('0x10'),_0x4bbcdb,_0x23394d[_0x02f9('0x21')]);if(_0x50ffc1[_0x02f9('0x2f')][_0x02f9('0x33')]['endConversation']){_0x5f3841[_0x02f9('0x12')]();}else{_0x5f3841[_0x02f9('0x2b')]();}})[_0x02f9('0x26')](function(_0x24ad4b){logger[_0x02f9('0x27')](_0x02f9('0x10'),_0x4bbcdb,JSON[_0x02f9('0x28')](_0x24ad4b));_0x5f3841[_0x02f9('0x12')]();});})[_0x02f9('0x26')](function(_0x417892){logger[_0x02f9('0x27')]('[%s][DIALOGFLOW]\x20%s',_0x4bbcdb,_0x417892['message']);_0x5f3841[_0x02f9('0x12')]();});}}catch(_0xcc67cb){logger[_0x02f9('0x27')]('[%s][DIALOGFLOW]\x20%s',_0x4bbcdb,JSON[_0x02f9('0x28')](_0xcc67cb));_0x5f3841[_0x02f9('0x2b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 52feb2a..08fcd7d 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 _0xabf1=['end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerResponse','fulfillmentText','all','md5','bluebird','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','Message','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','out','channel','whatsapp','phone','interaction','chat','ChatWebsiteId','upperFirst','account','InteractionId','created','isEmpty','getMustacheRender','body','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','sessionPath','message','length','dialogflowV2','queryResult','diagnosticInfo','fields'];(function(_0x328bd3,_0x9cf5a5){var _0x458149=function(_0x3f60d9){while(--_0x3f60d9){_0x328bd3['push'](_0x328bd3['shift']());}};_0x458149(++_0x9cf5a5);}(_0xabf1,0x96));var _0x1abf=function(_0x3ae9de,_0x46f134){_0x3ae9de=_0x3ae9de-0x0;var _0x33711b=_0xabf1[_0x3ae9de];return _0x33711b;};'use strict';var _=require('lodash');var dialogflow=require('dialogflow');var md5=require(_0x1abf('0x0'));var moment=require('moment');var Promise=require(_0x1abf('0x1'));var logger=require('../../../../config/logger')('routing');var utils=require(_0x1abf('0x2'));var rpc={'chatMessage':require(_0x1abf('0x3')),'openchannelMessage':require(_0x1abf('0x4')),'mailMessage':require(_0x1abf('0x5')),'smsMessage':require(_0x1abf('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x976a6a,_0x391e6b,_0x545a66,_0x5c5020){return new Promise(function(_0x16145d,_0x5898bd){var _0x56d254=_['clone'](_0x545a66);_0x56d254['body']=_0x5c5020;return rpc[_0x391e6b+_0x1abf('0x7')]['create'](_0x56d254)[_0x1abf('0x8')](function(){logger[_0x1abf('0x9')](_0x1abf('0xa'),_0x976a6a,_0x56d254['body']);_0x16145d();})[_0x1abf('0xb')](function(_0x502f1c){logger[_0x1abf('0xc')](_0x1abf('0xa'),_0x976a6a,JSON[_0x1abf('0xd')](_0x502f1c));_0x5898bd(_0x502f1c);});});}exports[_0x1abf('0xe')]=function(_0x9dea89,_0x2d0407){return function(_0x511ff9){try{if(!_[_0x1abf('0xf')](this['interaction'][_0x1abf('0x10')])){logger[_0x1abf('0x9')](_0x1abf('0xa'),_0x9dea89,_0x1abf('0x11'));return _0x511ff9[_0x1abf('0x12')]();}var _0x42ef01={'ContactId':this['contact']['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x1abf('0x13')};if(this[_0x1abf('0x14')]==='sms'||this[_0x1abf('0x14')]===_0x1abf('0x15')){_0x42ef01[_0x1abf('0x16')]=this[_0x1abf('0x17')][_0x1abf('0x16')];}var _0x4e2764=this[_0x1abf('0x14')];if(_0x4e2764===_0x1abf('0x18')){_0x42ef01[_0x1abf('0x19')]=this['account']['id'];}else{_0x42ef01[_[_0x1abf('0x1a')](_0x4e2764)+'AccountId']=this[_0x1abf('0x1b')]['id'];}_0x42ef01[_[_0x1abf('0x1a')](_0x4e2764)+_0x1abf('0x1c')]=this[_0x1abf('0x17')]['id'];if(this[_0x1abf('0x17')][_0x1abf('0x1d')]){var _0x1092f2=_0x2d0407[0x4];if(!_[_0x1abf('0x1e')](_0x1092f2)){_0x42ef01['body']=utils[_0x1abf('0x1f')](_0x1092f2,this);return rpc[_0x4e2764+_0x1abf('0x7')]['create'](_0x42ef01)['then'](function(_0x3817ef){logger[_0x1abf('0x9')](_0x1abf('0xa'),_0x9dea89,_0x42ef01[_0x1abf('0x20')]);})[_0x1abf('0xb')](function(_0x5ee782){logger[_0x1abf('0xc')](_0x1abf('0xa'),_0x9dea89,JSON['stringify'](_0x5ee782));})[_0x1abf('0x21')](function(){logger[_0x1abf('0x9')](_0x1abf('0x22'),_0x9dea89);_0x511ff9[_0x1abf('0x23')]();});}else{logger[_0x1abf('0x9')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x9dea89);_0x511ff9['stop']();}}else{var _0x193435=this;var _0x13dcde=_0x2d0407[0x2][_0x1abf('0x24')](/\\n/g,'\x0a');var _0x5eacab={'credentials':{'private_key':_0x13dcde,'client_email':_0x2d0407[0x1]}};var _0x329ecf=new dialogflow[(_0x1abf('0x25'))](_0x5eacab);var _0x453c8c=_0x329ecf[_0x1abf('0x26')](_0x2d0407[0x0],md5(_0x193435[_0x1abf('0x17')]['id']));var _0x4a0ec1={'session':_0x453c8c,'queryInput':{'text':{'text':_0x193435[_0x1abf('0x27')][_0x1abf('0x20')],'languageCode':_0x2d0407[0x3]||'en'}}};return _0x329ecf['detectIntent'](_0x4a0ec1)[_0x1abf('0x8')](function(_0x766751){if(_0x766751&&_0x766751[_0x1abf('0x28')]){_0x193435[_0x1abf('0x20')][_0x1abf('0x29')]=_0x766751;var _0x3499db=_0x766751[0x0];var _0x216a4f=_0x3499db[_0x1abf('0x2a')]['diagnosticInfo']&&_0x3499db[_0x1abf('0x2a')][_0x1abf('0x2b')][_0x1abf('0x2c')]?_0x3499db['queryResult'][_0x1abf('0x2b')][_0x1abf('0x2c')][_0x1abf('0x2d')][_0x1abf('0x2e')]:![];_0x193435[_0x1abf('0x20')][_0x1abf('0x2f')]=_0x3499db[_0x1abf('0x2a')][_0x1abf('0x30')];_0x193435[_0x1abf('0x20')][_0x1abf('0x31')]=_0x3499db['queryResult'][_0x1abf('0x32')];_0x193435[_0x1abf('0x20')][_0x1abf('0x33')]=_0x3499db[_0x1abf('0x2a')]['diagnosticInfo']&&_0x3499db[_0x1abf('0x2a')][_0x1abf('0x2b')][_0x1abf('0x2c')]?_0x3499db[_0x1abf('0x2a')][_0x1abf('0x2b')][_0x1abf('0x2c')][_0x1abf('0x2d')][_0x1abf('0x2e')]:![];_0x193435[_0x1abf('0x20')][_0x1abf('0x34')]=_0x3499db[_0x1abf('0x2a')][_0x1abf('0x35')]['name'];_0x193435[_0x1abf('0x20')][_0x1abf('0x36')]=_0x3499db['queryResult']['intent'][_0x1abf('0x37')];_0x193435['body'][_0x1abf('0x38')]=_0x3499db[_0x1abf('0x2a')][_0x1abf('0x35')]['isFallback'];_0x193435[_0x1abf('0x20')]['DIALOGFLOWV2_LANGUAGECODE']=_0x3499db[_0x1abf('0x2a')][_0x1abf('0x39')];_0x193435[_0x1abf('0x20')][_0x1abf('0x3a')]=_0x3499db['queryResult'][_0x1abf('0x3b')];_0x193435['body'][_0x1abf('0x3c')]=_0x3499db['queryResult'][_0x1abf('0x3d')];_0x42ef01['providerName']=_0x1abf('0x29');_0x42ef01[_0x1abf('0x3e')]=JSON[_0x1abf('0xd')](_0x766751);var _0x11e4ab=[];for(var _0x811f0e=0x0;_0x811f0e<_0x766751[_0x1abf('0x28')];_0x811f0e++){var _0x29fb35=_0x766751[_0x811f0e];if(_0x29fb35&&_0x29fb35['queryResult']&&_0x29fb35[_0x1abf('0x2a')][_0x1abf('0x3f')]){_0x11e4ab['push'](createMessage(_0x9dea89,_0x4e2764,_0x42ef01,_0x29fb35['queryResult']['fulfillmentText']));}}return Promise[_0x1abf('0x40')](_0x11e4ab)[_0x1abf('0x8')](function(){if(_0x216a4f){_0x511ff9['next']();}else{_0x511ff9[_0x1abf('0x23')]();}})[_0x1abf('0xb')](function(_0x531567){logger[_0x1abf('0xc')](_0x1abf('0xa'),_0x9dea89,JSON['stringify'](_0x531567));_0x511ff9[_0x1abf('0x12')]();});}})[_0x1abf('0xb')](function(_0x2f5a3f){logger[_0x1abf('0xc')](_0x1abf('0xa'),_0x9dea89,_0x2f5a3f[_0x1abf('0x27')]);_0x511ff9[_0x1abf('0x12')]();});}}catch(_0x17f76d){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x9dea89,JSON[_0x1abf('0xd')](_0x17f76d));_0x511ff9[_0x1abf('0x23')]();}};}; \ No newline at end of file +var _0x289c=['stringify','consequence','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','out','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','getMustacheRender','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','lodash','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','body','catch','error'];(function(_0xdbb2aa,_0x3fde1e){var _0x213543=function(_0x1993c0){while(--_0x1993c0){_0xdbb2aa['push'](_0xdbb2aa['shift']());}};_0x213543(++_0x3fde1e);}(_0x289c,0x1a7));var _0xc289=function(_0x384cdc,_0x595f0e){_0x384cdc=_0x384cdc-0x0;var _0x13ba25=_0x289c[_0x384cdc];return _0x13ba25;};'use strict';var _=require(_0xc289('0x0'));var dialogflow=require('dialogflow');var md5=require(_0xc289('0x1'));var moment=require(_0xc289('0x2'));var Promise=require(_0xc289('0x3'));var logger=require(_0xc289('0x4'))(_0xc289('0x5'));var utils=require(_0xc289('0x6'));var rpc={'chatMessage':require(_0xc289('0x7')),'openchannelMessage':require(_0xc289('0x8')),'mailMessage':require(_0xc289('0x9')),'smsMessage':require(_0xc289('0xa')),'faxMessage':require(_0xc289('0xb')),'whatsappMessage':require(_0xc289('0xc'))};function createMessage(_0x6440bd,_0x1d2da2,_0x6ca89d,_0x19d5a4){return new Promise(function(_0x7c8bc1,_0x2fe6ed){var _0x3d2136=_['clone'](_0x6ca89d);_0x3d2136['body']=_0x19d5a4;return rpc[_0x1d2da2+_0xc289('0xd')][_0xc289('0xe')](_0x3d2136)[_0xc289('0xf')](function(){logger[_0xc289('0x10')](_0xc289('0x11'),_0x6440bd,_0x3d2136[_0xc289('0x12')]);_0x7c8bc1();})[_0xc289('0x13')](function(_0x2c4894){logger[_0xc289('0x14')](_0xc289('0x11'),_0x6440bd,JSON[_0xc289('0x15')](_0x2c4894));_0x2fe6ed(_0x2c4894);});});}exports[_0xc289('0x16')]=function(_0x163eae,_0x1cabcd){return function(_0x25d24c){try{if(!_['isNil'](this[_0xc289('0x17')][_0xc289('0x18')])){logger[_0xc289('0x10')](_0xc289('0x11'),_0x163eae,_0xc289('0x19'));return _0x25d24c[_0xc289('0x1a')]();}var _0x1bc3ea={'ContactId':this['contact']['id'],'sentAt':moment()[_0xc289('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xc289('0x1c')};if(this[_0xc289('0x1d')]===_0xc289('0x1e')||this[_0xc289('0x1d')]==='whatsapp'){_0x1bc3ea[_0xc289('0x1f')]=this[_0xc289('0x17')]['phone'];}var _0x468d00=this[_0xc289('0x1d')];if(_0x468d00===_0xc289('0x20')){_0x1bc3ea[_0xc289('0x21')]=this[_0xc289('0x22')]['id'];}else{_0x1bc3ea[_[_0xc289('0x23')](_0x468d00)+'AccountId']=this[_0xc289('0x22')]['id'];}_0x1bc3ea[_[_0xc289('0x23')](_0x468d00)+_0xc289('0x24')]=this[_0xc289('0x17')]['id'];if(this[_0xc289('0x17')][_0xc289('0x25')]){var _0x3bf728=_0x1cabcd[0x4];if(!_[_0xc289('0x26')](_0x3bf728)){_0x1bc3ea[_0xc289('0x12')]=utils[_0xc289('0x27')](_0x3bf728,this);return rpc[_0x468d00+'Message']['create'](_0x1bc3ea)[_0xc289('0xf')](function(_0x4a50ee){logger[_0xc289('0x10')](_0xc289('0x11'),_0x163eae,_0x1bc3ea['body']);})[_0xc289('0x13')](function(_0x4282ca){logger[_0xc289('0x14')]('[%s][DIALOGFLOWV2]\x20%s',_0x163eae,JSON['stringify'](_0x4282ca));})[_0xc289('0x28')](function(){logger[_0xc289('0x10')](_0xc289('0x29'),_0x163eae);_0x25d24c[_0xc289('0x2a')]();});}else{logger[_0xc289('0x10')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x163eae);_0x25d24c['stop']();}}else{var _0x2c2bab=this;var _0x9f719e=_0x1cabcd[0x2][_0xc289('0x2b')](/\\n/g,'\x0a');var _0x362834={'credentials':{'private_key':_0x9f719e,'client_email':_0x1cabcd[0x1]}};var _0x59db32=new dialogflow[(_0xc289('0x2c'))](_0x362834);var _0x82b963=_0x59db32[_0xc289('0x2d')](_0x1cabcd[0x0],md5(_0x2c2bab[_0xc289('0x17')]['id']));var _0x523c73={'session':_0x82b963,'queryInput':{'text':{'text':_0x2c2bab[_0xc289('0x2e')][_0xc289('0x12')],'languageCode':_0x1cabcd[0x3]||'en'}}};return _0x59db32[_0xc289('0x2f')](_0x523c73)['then'](function(_0x407cde){if(_0x407cde&&_0x407cde[_0xc289('0x30')]){_0x2c2bab[_0xc289('0x12')][_0xc289('0x31')]=_0x407cde;var _0x1d98b6=_0x407cde[0x0];var _0x5c29d0=_0x1d98b6[_0xc289('0x32')][_0xc289('0x33')]&&_0x1d98b6[_0xc289('0x32')][_0xc289('0x33')]['fields']?_0x1d98b6[_0xc289('0x32')][_0xc289('0x33')][_0xc289('0x34')]['end_conversation'][_0xc289('0x35')]:![];_0x2c2bab[_0xc289('0x12')][_0xc289('0x36')]=_0x1d98b6[_0xc289('0x32')][_0xc289('0x37')];_0x2c2bab[_0xc289('0x12')][_0xc289('0x38')]=_0x1d98b6[_0xc289('0x32')][_0xc289('0x39')];_0x2c2bab['body'][_0xc289('0x3a')]=_0x1d98b6[_0xc289('0x32')][_0xc289('0x33')]&&_0x1d98b6['queryResult']['diagnosticInfo']['fields']?_0x1d98b6[_0xc289('0x32')]['diagnosticInfo'][_0xc289('0x34')][_0xc289('0x3b')][_0xc289('0x35')]:![];_0x2c2bab[_0xc289('0x12')][_0xc289('0x3c')]=_0x1d98b6[_0xc289('0x32')]['intent']['name'];_0x2c2bab['body'][_0xc289('0x3d')]=_0x1d98b6[_0xc289('0x32')][_0xc289('0x3e')][_0xc289('0x3f')];_0x2c2bab['body'][_0xc289('0x40')]=_0x1d98b6[_0xc289('0x32')][_0xc289('0x3e')]['isFallback'];_0x2c2bab[_0xc289('0x12')][_0xc289('0x41')]=_0x1d98b6[_0xc289('0x32')]['languageCode'];_0x2c2bab['body'][_0xc289('0x42')]=_0x1d98b6[_0xc289('0x32')][_0xc289('0x43')];_0x2c2bab[_0xc289('0x12')][_0xc289('0x44')]=_0x1d98b6[_0xc289('0x32')][_0xc289('0x45')];_0x1bc3ea[_0xc289('0x46')]=_0xc289('0x31');_0x1bc3ea[_0xc289('0x47')]=JSON['stringify'](_0x407cde);var _0xd72220=[];for(var _0x653a55=0x0;_0x653a55<_0x407cde[_0xc289('0x30')];_0x653a55++){var _0x4561c3=_0x407cde[_0x653a55];if(_0x4561c3&&_0x4561c3[_0xc289('0x32')]&&_0x4561c3[_0xc289('0x32')][_0xc289('0x48')]){_0xd72220[_0xc289('0x49')](createMessage(_0x163eae,_0x468d00,_0x1bc3ea,_0x4561c3[_0xc289('0x32')]['fulfillmentText']));}}return Promise['all'](_0xd72220)[_0xc289('0xf')](function(){if(_0x5c29d0){_0x25d24c[_0xc289('0x1a')]();}else{_0x25d24c['stop']();}})[_0xc289('0x13')](function(_0x212374){logger[_0xc289('0x14')](_0xc289('0x11'),_0x163eae,JSON[_0xc289('0x15')](_0x212374));_0x25d24c['next']();});}})[_0xc289('0x13')](function(_0x430538){logger[_0xc289('0x14')](_0xc289('0x11'),_0x163eae,_0x430538[_0xc289('0x2e')]);_0x25d24c[_0xc289('0x1a')]();});}}catch(_0x337ef4){logger['error'](_0xc289('0x11'),_0x163eae,JSON[_0xc289('0x15')](_0x337ef4));_0x25d24c[_0xc289('0x2a')]();}};}; \ 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 88d3531..0cc1d35 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 _0x3139=['routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','error','[%s][GOTOIF]\x20%s','map','message','condition','priorityTrue','priorityFalse','info','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','stringify','validate','./utils','../../../../config/logger'];(function(_0x1640b8,_0x194695){var _0x43f127=function(_0x51682d){while(--_0x51682d){_0x1640b8['push'](_0x1640b8['shift']());}};_0x43f127(++_0x194695);}(_0x3139,0x183));var _0x9313=function(_0x33adb9,_0x1477bd){_0x33adb9=_0x33adb9-0x0;var _0x29c0b6=_0x3139[_0x33adb9];return _0x29c0b6;};'use strict';var schema=require(_0x9313('0x0'));var _=require('lodash');var htmlToText=require('html-to-text');var utils=require(_0x9313('0x1'));var logger=require(_0x9313('0x2'))(_0x9313('0x3'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x9313('0x4')},'priorityTrue':{'type':_0x9313('0x5'),'message':_0x9313('0x6')},'priorityFalse':{'type':'number','message':_0x9313('0x7')}});exports['consequence']=function(_0x182e7b,_0xa230ef){return function(_0x5f2435){try{var _0x115656={'condition':htmlToText[_0x9313('0x8')](utils[_0x9313('0x9')](_0xa230ef[0x0],this),{'wordwrap':![]})[_0x9313('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0xa230ef[0x1],'priorityFalse':_0xa230ef[0x2]};var _0x13df53=gotoif[_0x9313('0x0')](_0x115656,{'typecast':!![]});if(_0x13df53['length']){logger[_0x9313('0xb')](_0x9313('0xc'),_0x182e7b,_[_0x9313('0xd')](_0x13df53,_0x9313('0xe'))['join'](',\x20'));_0x5f2435['stop']();}else{try{var _0x4cbadc=eval('('+_0x115656[_0x9313('0xf')]+')');var _0x5039bc=_0x4cbadc?_0x115656[_0x9313('0x10')]:_0x115656[_0x9313('0x11')];logger[_0x9313('0x12')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x182e7b,_0x115656['condition'],_0x4cbadc,_0x5039bc||_0x9313('0x13'));if(_0x5039bc){var _0x49fd4c=_[_0x9313('0x14')](_0x5f2435[_0x9313('0x15')](),{'p':_0x5039bc});if(_0x49fd4c>=0x0){logger[_0x9313('0x12')](_0x9313('0x16'),_0x182e7b,_0x5039bc||_0x9313('0x13'),_0x49fd4c);_0x5f2435[_0x9313('0x13')](_0x49fd4c);}else{logger['info'](_0x9313('0x17'),_0x182e7b,_0x5039bc||_0x9313('0x13'));_0x5f2435[_0x9313('0x18')]();}}else{_0x5f2435[_0x9313('0x13')]();}}catch(_0x46f199){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x182e7b,_0x46f199[_0x9313('0xe')]);_0x5f2435['stop']();}}}catch(_0x1f13d7){logger[_0x9313('0xb')](_0x9313('0xc'),_0x182e7b,JSON[_0x9313('0x19')](_0x1f13d7));_0x5f2435['stop']();}};}; \ No newline at end of file +var _0x4b3c=['lodash','html-to-text','../../../../config/logger','routing','string','priority\x20true\x20is\x20a\x20number','number','consequence','fromString','getMustacheRender','replace','validate','length','error','message','join','stop','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','findIndex','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','stringify'];(function(_0xc45fe5,_0x200817){var _0x1e1f06=function(_0x1fe9a7){while(--_0x1fe9a7){_0xc45fe5['push'](_0xc45fe5['shift']());}};_0x1e1f06(++_0x200817);}(_0x4b3c,0x118));var _0xc4b3=function(_0x115a0f,_0x46c0ae){_0x115a0f=_0x115a0f-0x0;var _0x2b53a0=_0x4b3c[_0x115a0f];return _0x2b53a0;};'use strict';var schema=require('validate');var _=require(_0xc4b3('0x0'));var htmlToText=require(_0xc4b3('0x1'));var utils=require('./utils');var logger=require(_0xc4b3('0x2'))(_0xc4b3('0x3'));var gotoif=schema({'condition':{'type':_0xc4b3('0x4'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':'number','message':_0xc4b3('0x5')},'priorityFalse':{'type':_0xc4b3('0x6'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xc4b3('0x7')]=function(_0x553c3e,_0x9753e7){return function(_0xab26c0){try{var _0x589369={'condition':htmlToText[_0xc4b3('0x8')](utils[_0xc4b3('0x9')](_0x9753e7[0x0],this),{'wordwrap':![]})[_0xc4b3('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x9753e7[0x1],'priorityFalse':_0x9753e7[0x2]};var _0x61ffb2=gotoif[_0xc4b3('0xb')](_0x589369,{'typecast':!![]});if(_0x61ffb2[_0xc4b3('0xc')]){logger[_0xc4b3('0xd')]('[%s][GOTOIF]\x20%s',_0x553c3e,_['map'](_0x61ffb2,_0xc4b3('0xe'))[_0xc4b3('0xf')](',\x20'));_0xab26c0[_0xc4b3('0x10')]();}else{try{var _0x22e7ba=eval('('+_0x589369['condition']+')');var _0x95f48d=_0x22e7ba?_0x589369['priorityTrue']:_0x589369[_0xc4b3('0x11')];logger['info'](_0xc4b3('0x12'),_0x553c3e,_0x589369[_0xc4b3('0x13')],_0x22e7ba,_0x95f48d||_0xc4b3('0x14'));if(_0x95f48d){var _0x7521fd=_[_0xc4b3('0x15')](_0xab26c0['rules'](),{'p':_0x95f48d});if(_0x7521fd>=0x0){logger[_0xc4b3('0x16')](_0xc4b3('0x17'),_0x553c3e,_0x95f48d||'next',_0x7521fd);_0xab26c0[_0xc4b3('0x14')](_0x7521fd);}else{logger['info'](_0xc4b3('0x18'),_0x553c3e,_0x95f48d||_0xc4b3('0x14'));_0xab26c0[_0xc4b3('0x10')]();}}else{_0xab26c0[_0xc4b3('0x14')]();}}catch(_0xcf99bf){logger[_0xc4b3('0xd')](_0xc4b3('0x19'),_0x553c3e,_0xcf99bf[_0xc4b3('0xe')]);_0xab26c0['stop']();}}}catch(_0x3d2142){logger[_0xc4b3('0xd')](_0xc4b3('0x1a'),_0x553c3e,JSON[_0xc4b3('0x1b')](_0x3d2142));_0xab26c0[_0xc4b3('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 4867dd4..5e2a9a8 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 _0xea4c=['[%s][GOTOP]\x20priority\x20%s','rules','priority','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xea4c,0x1d1));var _0xcea4=function(_0x431221,_0x5c798d){_0x431221=_0x431221-0x0;var _0x5c3b0e=_0xea4c[_0x431221];return _0x5c3b0e;};'use strict';var schema=require(_0xcea4('0x0'));var _=require(_0xcea4('0x1'));var logger=require(_0xcea4('0x2'))(_0xcea4('0x3'));var gotop=schema({'priority':{'type':_0xcea4('0x4'),'required':!![],'message':_0xcea4('0x5')}});exports[_0xcea4('0x6')]=function(_0x589625,_0x333765){return function(_0xe35ad){try{var _0x2682b9={'priority':_0x333765[0x0]};var _0x30e10e=gotop['validate'](_0x2682b9,{'typecast':!![]});if(_0x30e10e[_0xcea4('0x7')]){logger[_0xcea4('0x8')](_0xcea4('0x9'),_0x589625,_[_0xcea4('0xa')](_0x30e10e,_0xcea4('0xb'))[_0xcea4('0xc')](',\x20'));_0xe35ad[_0xcea4('0xd')]();}else{logger[_0xcea4('0xe')](_0xcea4('0xf'),_0x589625,_0x2682b9['priority']);if(_0x2682b9['priority']){var _0x43f3ac=_['findIndex'](_0xe35ad[_0xcea4('0x10')](),{'p':_0x2682b9[_0xcea4('0x11')]});if(_0x43f3ac>=0x0){logger[_0xcea4('0xe')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x589625,_0x2682b9[_0xcea4('0x11')]||_0xcea4('0x12'),_0x43f3ac);_0xe35ad[_0xcea4('0x12')](_0x43f3ac);}else{logger['info'](_0xcea4('0x13'),_0x589625,_0x2682b9[_0xcea4('0x11')]||'next');_0xe35ad[_0xcea4('0xd')]();}}else{_0xe35ad[_0xcea4('0x12')]();}}}catch(_0x2dea9c){logger['error'](_0xcea4('0x9'),_0x589625,JSON['stringify'](_0x2dea9c));_0xe35ad[_0xcea4('0xd')]();}};}; \ No newline at end of file +var _0x03be=['stop','info','priority','findIndex','rules','next','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','join'];(function(_0x26b199,_0x1f60ac){var _0x1ff319=function(_0x1037d6){while(--_0x1037d6){_0x26b199['push'](_0x26b199['shift']());}};_0x1ff319(++_0x1f60ac);}(_0x03be,0xeb));var _0xe03b=function(_0x3d4567,_0x3170fb){_0x3d4567=_0x3d4567-0x0;var _0x372507=_0x03be[_0x3d4567];return _0x372507;};'use strict';var schema=require(_0xe03b('0x0'));var _=require(_0xe03b('0x1'));var logger=require(_0xe03b('0x2'))(_0xe03b('0x3'));var gotop=schema({'priority':{'type':_0xe03b('0x4'),'required':!![],'message':_0xe03b('0x5')}});exports[_0xe03b('0x6')]=function(_0x214ce9,_0xe1ea63){return function(_0x11813a){try{var _0x21249c={'priority':_0xe1ea63[0x0]};var _0x31917b=gotop[_0xe03b('0x0')](_0x21249c,{'typecast':!![]});if(_0x31917b[_0xe03b('0x7')]){logger[_0xe03b('0x8')](_0xe03b('0x9'),_0x214ce9,_[_0xe03b('0xa')](_0x31917b,'message')[_0xe03b('0xb')](',\x20'));_0x11813a[_0xe03b('0xc')]();}else{logger[_0xe03b('0xd')]('[%s][GOTOP]\x20priority\x20%s',_0x214ce9,_0x21249c[_0xe03b('0xe')]);if(_0x21249c[_0xe03b('0xe')]){var _0xaf875a=_[_0xe03b('0xf')](_0x11813a[_0xe03b('0x10')](),{'p':_0x21249c[_0xe03b('0xe')]});if(_0xaf875a>=0x0){logger[_0xe03b('0xd')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x214ce9,_0x21249c[_0xe03b('0xe')]||_0xe03b('0x11'),_0xaf875a);_0x11813a[_0xe03b('0x11')](_0xaf875a);}else{logger[_0xe03b('0xd')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x214ce9,_0x21249c[_0xe03b('0xe')]||_0xe03b('0x11'));_0x11813a['stop']();}}else{_0x11813a[_0xe03b('0x11')]();}}}catch(_0x4d9cc4){logger[_0xe03b('0x8')]('[%s][GOTOP]\x20%s',_0x214ce9,JSON[_0xe03b('0x12')](_0x4d9cc4));_0x11813a[_0xe03b('0xc')]();}};}; \ 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 cd727c9..bc4fb2d 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 _0x74de=['Message','create','then','info','[%s][MESSAGE]\x20%s','next','error','stringify','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','channel','chat','upperFirst','AccountId','account','InteractionId','interaction'];(function(_0x1ad681,_0xadeb8f){var _0x2b84d7=function(_0x4b3776){while(--_0x4b3776){_0x1ad681['push'](_0x1ad681['shift']());}};_0x2b84d7(++_0xadeb8f);}(_0x74de,0x9f));var _0xe74d=function(_0x5643d9,_0x3391f9){_0x5643d9=_0x5643d9-0x0;var _0x4289d9=_0x74de[_0x5643d9];return _0x4289d9;};'use strict';var _=require('lodash');var utils=require(_0xe74d('0x0'));var logger=require(_0xe74d('0x1'))(_0xe74d('0x2'));var rpc={'chatMessage':require(_0xe74d('0x3')),'openchannelMessage':require(_0xe74d('0x4')),'mailMessage':require(_0xe74d('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xe74d('0x6')),'whatsappMessage':require(_0xe74d('0x7'))};exports['consequence']=function(_0x2ce293,_0x41f63f){return function(_0xca36b8){try{var _0x170e4f={'body':utils[_0xe74d('0x8')](_0x41f63f[0x0],this),'ContactId':this['contact']['id']};if(this[_0xe74d('0x9')]===_0xe74d('0xa')){_0x170e4f['ChatWebsiteId']=this['account']['id'];}else{_0x170e4f[_[_0xe74d('0xb')](this[_0xe74d('0x9')])+_0xe74d('0xc')]=this[_0xe74d('0xd')]['id'];}_0x170e4f[_[_0xe74d('0xb')](this[_0xe74d('0x9')])+_0xe74d('0xe')]=this[_0xe74d('0xf')]['id'];if(rpc[this[_0xe74d('0x9')]+_0xe74d('0x10')]){return rpc[this[_0xe74d('0x9')]+_0xe74d('0x10')][_0xe74d('0x11')](_0x170e4f)[_0xe74d('0x12')](function(_0x239f25){logger[_0xe74d('0x13')](_0xe74d('0x14'),_0x2ce293,_0x170e4f['body']);_0xca36b8[_0xe74d('0x15')]();})['catch'](function(_0x470dde){logger[_0xe74d('0x16')](_0xe74d('0x14'),_0x2ce293,JSON[_0xe74d('0x17')](_0x470dde));_0xca36b8[_0xe74d('0x18')]();});}}catch(_0x25262d){logger['error']('[%s][MESSAGE]\x20%s',_0x2ce293,JSON[_0xe74d('0x17')](_0x25262d));_0xca36b8[_0xe74d('0x18')]();}};}; \ No newline at end of file +var _0x27b2=['./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','interaction','Message','info','[%s][MESSAGE]\x20%s','body','next','catch','stringify','stop','lodash'];(function(_0x5b3b27,_0x3874de){var _0x1c94e8=function(_0x100180){while(--_0x100180){_0x5b3b27['push'](_0x5b3b27['shift']());}};_0x1c94e8(++_0x3874de);}(_0x27b2,0x18f));var _0x227b=function(_0x51fc85,_0x783137){_0x51fc85=_0x51fc85-0x0;var _0x13e93d=_0x27b2[_0x51fc85];return _0x13e93d;};'use strict';var _=require(_0x227b('0x0'));var utils=require(_0x227b('0x1'));var logger=require(_0x227b('0x2'))(_0x227b('0x3'));var rpc={'chatMessage':require(_0x227b('0x4')),'openchannelMessage':require(_0x227b('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x227b('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x227b('0x7')]=function(_0x10b70e,_0x18d6eb){return function(_0x274c75){try{var _0x6ba0ef={'body':utils[_0x227b('0x8')](_0x18d6eb[0x0],this),'ContactId':this[_0x227b('0x9')]['id']};if(this[_0x227b('0xa')]===_0x227b('0xb')){_0x6ba0ef[_0x227b('0xc')]=this[_0x227b('0xd')]['id'];}else{_0x6ba0ef[_['upperFirst'](this['channel'])+_0x227b('0xe')]=this[_0x227b('0xd')]['id'];}_0x6ba0ef[_[_0x227b('0xf')](this['channel'])+'InteractionId']=this[_0x227b('0x10')]['id'];if(rpc[this[_0x227b('0xa')]+'Message']){return rpc[this[_0x227b('0xa')]+_0x227b('0x11')]['create'](_0x6ba0ef)['then'](function(_0x252f04){logger[_0x227b('0x12')](_0x227b('0x13'),_0x10b70e,_0x6ba0ef[_0x227b('0x14')]);_0x274c75[_0x227b('0x15')]();})[_0x227b('0x16')](function(_0x17c83a){logger['error'](_0x227b('0x13'),_0x10b70e,JSON[_0x227b('0x17')](_0x17c83a));_0x274c75[_0x227b('0x18')]();});}}catch(_0x5aa07c){logger['error']('[%s][MESSAGE]\x20%s',_0x10b70e,JSON[_0x227b('0x17')](_0x5aa07c));_0x274c75['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index fac19f6..c6793d0 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 _0xada9=['stop','../../../../config/logger','consequence','info','[%s][NOOP]\x20%s','next','error','stringify'];(function(_0x14c057,_0x66851d){var _0xfca148=function(_0x4754ed){while(--_0x4754ed){_0x14c057['push'](_0x14c057['shift']());}};_0xfca148(++_0x66851d);}(_0xada9,0x101));var _0x9ada=function(_0x47c810,_0x423b94){_0x47c810=_0x47c810-0x0;var _0x1e0096=_0xada9[_0x47c810];return _0x1e0096;};'use strict';var utils=require('./utils');var logger=require(_0x9ada('0x0'))('routing');exports[_0x9ada('0x1')]=function(_0x19a7b6,_0xbd7dd3){return function(_0x36dfc7){try{logger[_0x9ada('0x2')](_0x9ada('0x3'),_0x19a7b6,utils['getMustacheRender'](_0xbd7dd3[0x0],this));_0x36dfc7[_0x9ada('0x4')]();}catch(_0x3d0e20){logger[_0x9ada('0x5')](_0x9ada('0x3'),_0x19a7b6,JSON[_0x9ada('0x6')](_0x3d0e20));_0x36dfc7[_0x9ada('0x7')]();}};}; \ No newline at end of file +var _0x4cdd=['stop','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','stringify'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x4cdd,0x91));var _0xd4cd=function(_0x3cf785,_0x37beb6){_0x3cf785=_0x3cf785-0x0;var _0x481d75=_0x4cdd[_0x3cf785];return _0x481d75;};'use strict';var utils=require(_0xd4cd('0x0'));var logger=require(_0xd4cd('0x1'))(_0xd4cd('0x2'));exports[_0xd4cd('0x3')]=function(_0xca8672,_0x78cfa0){return function(_0x2d0a02){try{logger[_0xd4cd('0x4')](_0xd4cd('0x5'),_0xca8672,utils[_0xd4cd('0x6')](_0x78cfa0[0x0],this));_0x2d0a02['next']();}catch(_0x269f82){logger['error'](_0xd4cd('0x5'),_0xca8672,JSON[_0xd4cd('0x7')](_0x269f82));_0x2d0a02[_0xd4cd('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 6893682..83e2905 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 _0x55ca=['../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','QueueId','interaction','channel','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','create','catch','error','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','QueueReport','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','map','join','find','Queues','createQueue','atimeout','rules','end','close','stop','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','ioredis','../../../../config/environment','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','from','joinAt','emit','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove'];(function(_0x5a0240,_0xed4dde){var _0x20be5a=function(_0x471ee2){while(--_0x471ee2){_0x5a0240['push'](_0x5a0240['shift']());}};_0x20be5a(++_0xed4dde);}(_0x55ca,0x126));var _0xa55c=function(_0x46c1d5,_0x5ca335){_0x46c1d5=_0x46c1d5-0x0;var _0x40fe7b=_0x55ca[_0x46c1d5];return _0x40fe7b;};'use strict';var schema=require(_0xa55c('0x0'));var _=require(_0xa55c('0x1'));var util=require('util');var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));var strategy=require(_0xa55c('0x5'));config[_0xa55c('0x6')]=_[_0xa55c('0x7')](config[_0xa55c('0x6')],{'host':_0xa55c('0x8'),'port':0x18eb});var io=require(_0xa55c('0x9'))(new Redis(config['redis']));var attributes=['id',_0xa55c('0xa'),_0xa55c('0xb'),'queue',_0xa55c('0xc'),_0xa55c('0xd')];function emit(_0x52a3bc,_0x5849ad,_0x473d0e){io['to'](_0x52a3bc)[_0xa55c('0xe')](_0x5849ad,_0x473d0e);}function emitChannelQueueInteraction(_0x381d07,_0x5d8e5a,_0x31646d,_0xe6d826,_0x508342,_0x70c2de,_0x3998f7,_0x15eec8){var _0x5d47ff=_['clone'](_0x31646d);_0x5d47ff[_0xa55c('0xa')]=_0x15eec8;_0x5d47ff['queue']=_0x5d8e5a;_0x5d47ff['account']=_0xe6d826;_0x5d47ff['id']=_0x508342;if(_0x70c2de){_0x3998f7[util['format'](_0xa55c('0xf'),_0x381d07)][_0x508342]=_[_0xa55c('0x10')](_0x5d47ff,attributes);}else{delete _0x3998f7[util[_0xa55c('0x11')](_0xa55c('0xf'),_0x381d07)][_0x508342];}emit(util[_0xa55c('0x11')](_0xa55c('0x12'),_0x381d07,_0x5d8e5a),util['format'](_0xa55c('0x13'),_0x381d07,_0x70c2de?_0xa55c('0x14'):_0xa55c('0x15')),_[_0xa55c('0x10')](_0x5d47ff,attributes));}var rpc={'openchannelQueueReport':require(_0xa55c('0x16')),'mailQueueReport':require(_0xa55c('0x17')),'chatQueueReport':require(_0xa55c('0x18')),'smsQueueReport':require(_0xa55c('0x19')),'faxQueueReport':require(_0xa55c('0x1a')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xa55c('0x1b'),'required':!![],'message':_0xa55c('0x1c')},'timeout':{'type':_0xa55c('0x1d'),'message':_0xa55c('0x1e')}});function startRouting(_0x23a1ae,_0x5426e5,_0x4c0daf,_0x5f5158){if(_0x23a1ae&&_0x5426e5&&_0x4c0daf){_0x5426e5[_0xa55c('0x1f')]+=0x1;var _0x3776ac={'uniqueid':_0x23a1ae,'from':_0x4c0daf[_0xa55c('0x20')]?_0x4c0daf['body'][_0xa55c('0xc')]:'','joinAt':moment()[_0xa55c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4c0daf[_0xa55c('0x21')]?_0x4c0daf[_0xa55c('0x21')]['id']:null,'ListId':_0x4c0daf[_0xa55c('0x22')]?_0x4c0daf[_0xa55c('0x22')]['id']:null};_0x3776ac[_[_0xa55c('0x23')](_0x4c0daf['channel'])+_0xa55c('0x24')]=_0x5426e5['id']||null;_0x3776ac[_['upperFirst'](_0x4c0daf['channel'])+'InteractionId']=_0x4c0daf[_0xa55c('0x25')]?_0x4c0daf['interaction']['id']:null;_0x3776ac[_[_0xa55c('0x23')](_0x4c0daf[_0xa55c('0x26')])+_0xa55c('0x27')]=_0x4c0daf[_0xa55c('0x28')]?_0x4c0daf[_0xa55c('0x28')]['id']:null;_0x3776ac[_[_0xa55c('0x23')](_0x4c0daf[_0xa55c('0x26')])+(_0x4c0daf[_0xa55c('0x26')]!==_0xa55c('0x29')?_0xa55c('0x2a'):_0xa55c('0x2b'))]=_0x4c0daf['account']?_0x4c0daf[_0xa55c('0xb')]['id']:null;logger[_0xa55c('0x2c')](util[_0xa55c('0x11')](_0xa55c('0x2d'),_0x23a1ae,_0x5426e5['name']));emitChannelQueueInteraction(_0x4c0daf[_0xa55c('0x26')],_0x5426e5[_0xa55c('0x2e')],_0x3776ac,_0x4c0daf[_0xa55c('0xb')][_0xa55c('0x2e')],_0x4c0daf[_0xa55c('0x28')]['id'],!![],_0x5f5158,_0x5426e5['id']);if(rpc[_0x4c0daf[_0xa55c('0x26')]+'QueueReport']){return rpc[_0x4c0daf[_0xa55c('0x26')]+'QueueReport'][_0xa55c('0x2f')](_0x3776ac)[_0xa55c('0x30')](function(_0x1cc53e){logger[_0xa55c('0x31')]('create\x20queue\x20report');});}}}function stopRouting(_0x3d28fb,_0x2096ae,_0x331e58,_0x20da31){if(_0x3d28fb&&_0x2096ae){_0x2096ae[_0xa55c('0x1f')]-=0x1;var _0x1225c3={'leaveAt':moment()[_0xa55c('0x11')](_0xa55c('0x32')),'acceptAt':moment()[_0xa55c('0x11')](_0xa55c('0x32')),'reason':_0xa55c('0x33')};logger['info'](util['format'](_0xa55c('0x34'),_0x3d28fb,_0x2096ae[_0xa55c('0x2e')]));emitChannelQueueInteraction(_0x331e58['channel'],_0x2096ae[_0xa55c('0x2e')],_0x331e58[_0xa55c('0x20')],_0x331e58[_0xa55c('0xb')][_0xa55c('0x2e')],_0x331e58[_0xa55c('0x28')]['id'],![],_0x20da31,_0x2096ae['id']);if(rpc[_0x331e58[_0xa55c('0x26')]+_0xa55c('0x35')]){return rpc[_0x331e58[_0xa55c('0x26')]+_0xa55c('0x35')]['update'](_0x3d28fb,_0x1225c3)['catch'](function(_0x4b23d3){logger[_0xa55c('0x31')](_0xa55c('0x36'));});}}}function endRouting(_0x2bb4f0,_0x5802e4,_0x768408,_0x547930){if(_0x2bb4f0&&_0x5802e4){_0x5802e4[_0xa55c('0x1f')]-=0x1;var _0x4ad813={'leaveAt':moment()[_0xa55c('0x11')](_0xa55c('0x32')),'exitAt':moment()[_0xa55c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xa55c('0x37')};logger[_0xa55c('0x2c')](util['format'](_0xa55c('0x38'),_0x2bb4f0,_0x5802e4[_0xa55c('0x2e')]));emitChannelQueueInteraction(_0x768408['channel'],_0x5802e4['name'],_0x768408[_0xa55c('0x20')],_0x768408['account'][_0xa55c('0x2e')],_0x768408[_0xa55c('0x28')]['id'],![],_0x547930);if(rpc[_0x768408['channel']+'QueueReport']){return rpc[_0x768408['channel']+'QueueReport'][_0xa55c('0x39')](_0x2bb4f0,_0x4ad813)[_0xa55c('0x30')](function(_0x429336){logger[_0xa55c('0x31')](_0xa55c('0x36'));});}}}function handleFindQueue(_0x56d17c){return function(_0x3d52d8){return _0x3d52d8[_0xa55c('0x2e')][_0xa55c('0x3a')]()===_0x56d17c[_0xa55c('0x3a')]();};}exports[_0xa55c('0x3b')]=function(_0x23cef5,_0x554620,_0x386e34,_0x5ee63d){return function(_0x57a972){try{var _0x404e7f={'name':_0x554620[0x0],'timeout':_0x554620[0x1]};var _0x1f63d8=queue['validate'](_0x404e7f,{'typecast':!![]});if(_0x1f63d8[_0xa55c('0x3c')]){logger['error']('[%s][QUEUE]\x20%s',_0x23cef5,_[_0xa55c('0x3d')](_0x1f63d8,_0xa55c('0x28'))[_0xa55c('0x3e')](',\x20'));_0x57a972['stop']();}else{var _0x1b2708=_[_0xa55c('0x3f')](_0x386e34[_0x5ee63d['channel']+_0xa55c('0x40')],handleFindQueue(_0x404e7f['name']));if(_0x1b2708){startRouting(_0x23cef5,_0x1b2708,_0x5ee63d,_0x386e34);var _0x39886a=(_0x1b2708[_0xa55c('0x37')]||0xa)*0x3e8;var _0x5be43f=(_0x404e7f[_0xa55c('0x37')]||0x14)*0x3e8;var _0x1dae70,_0x5d834d;if(_0x39886a>_0x5be43f){_0x5be43f=_0x39886a;}var _0x40c352=seqqueue[_0xa55c('0x41')](_0x39886a);_0x40c352['id']=_0x23cef5;_0x40c352[_0xa55c('0x42')]=_0x39886a;_0x40c352['qtimeout']=_0x5be43f;_0x40c352[_0xa55c('0x26')]=_0x5ee63d['channel'];_0x386e34[_0xa55c('0x43')][_0x23cef5]['on'](_0xa55c('0x44'),function(){logger[_0xa55c('0x2c')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x23cef5);stopRouting(_0x23cef5,_0x1b2708,_0x5ee63d,_0x386e34);clearTimeout(_0x1dae70);_0x1dae70=undefined;_0x40c352[_0xa55c('0x45')](!![]);if(_0x386e34[_0xa55c('0x43')][_0x23cef5]){delete _0x386e34['rules'][_0x23cef5];}_0x57a972[_0xa55c('0x46')]();});_0x386e34[_0xa55c('0x43')][_0x23cef5]['on']('complete',function(){if(_0x386e34[_0xa55c('0x43')][_0x23cef5]){delete _0x386e34[_0xa55c('0x43')][_0x23cef5];}});_0x1dae70=setTimeout(function(){logger['info'](_0xa55c('0x47'),_0x23cef5);endRouting(_0x23cef5,_0x1b2708,_0x5ee63d,_0x386e34);clearTimeout(_0x1dae70);_0x40c352[_0xa55c('0x45')](!![]);_0x57a972[_0xa55c('0x48')]();},_0x5be43f);switch(_0x1b2708[_0xa55c('0x49')]){case'rrmemory':strategy[_0xa55c('0x4a')](_0x40c352,_0x1b2708,_0x386e34,_0x5ee63d);break;default:strategy['beepall'](_0x40c352,_0x1b2708,_0x386e34,_0x5ee63d);}}else{logger[_0xa55c('0x31')](_0xa55c('0x4b'),_0x23cef5,_0x404e7f[_0xa55c('0x2e')]);_0x57a972['stop']();}}}catch(_0x39bd3d){console[_0xa55c('0x4c')](_0x39bd3d);logger['error'](_0xa55c('0x4d'),_0x23cef5,_0x39bd3d[_0xa55c('0x4e')]);_0x57a972[_0xa55c('0x46')]();}};}; \ No newline at end of file +var _0x3e74=['beepall','log','stack','validate','util','seq-queue','moment','../../../../config/logger','./strategy','redis','defaults','localhost','queue_id','account','queue','from','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','InteractionId','interaction','MessageId','message','channel','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','find','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','next','strategy','rrmemory'];(function(_0x1a0ef3,_0x535bbf){var _0x2b86da=function(_0x5d30f9){while(--_0x5d30f9){_0x1a0ef3['push'](_0x1a0ef3['shift']());}};_0x2b86da(++_0x535bbf);}(_0x3e74,0x175));var _0x43e7=function(_0x10236c,_0x1b8867){_0x10236c=_0x10236c-0x0;var _0x1a09ce=_0x3e74[_0x10236c];return _0x1a09ce;};'use strict';var schema=require(_0x43e7('0x0'));var _=require('lodash');var util=require(_0x43e7('0x1'));var seqqueue=require(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('routing');var strategy=require(_0x43e7('0x5'));config[_0x43e7('0x6')]=_[_0x43e7('0x7')](config[_0x43e7('0x6')],{'host':_0x43e7('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x43e7('0x6')]));var attributes=['id',_0x43e7('0x9'),_0x43e7('0xa'),_0x43e7('0xb'),_0x43e7('0xc'),'joinAt'];function emit(_0x212c6c,_0x554d44,_0x54948c){io['to'](_0x212c6c)[_0x43e7('0xd')](_0x554d44,_0x54948c);}function emitChannelQueueInteraction(_0x4139c9,_0x5c34f4,_0x2803d9,_0x513707,_0xf7c520,_0x37302c,_0x4ebc8e,_0x3eb206){var _0xc960ea=_[_0x43e7('0xe')](_0x2803d9);_0xc960ea[_0x43e7('0x9')]=_0x3eb206;_0xc960ea['queue']=_0x5c34f4;_0xc960ea['account']=_0x513707;_0xc960ea['id']=_0xf7c520;if(_0x37302c){_0x4ebc8e[util[_0x43e7('0xf')](_0x43e7('0x10'),_0x4139c9)][_0xf7c520]=_[_0x43e7('0x11')](_0xc960ea,attributes);}else{delete _0x4ebc8e[util['format']('%sQueuesWaitingInteractions',_0x4139c9)][_0xf7c520];}emit(util[_0x43e7('0xf')](_0x43e7('0x12'),_0x4139c9,_0x5c34f4),util[_0x43e7('0xf')](_0x43e7('0x13'),_0x4139c9,_0x37302c?'save':'remove'),_[_0x43e7('0x11')](_0xc960ea,attributes));}var rpc={'openchannelQueueReport':require(_0x43e7('0x14')),'mailQueueReport':require(_0x43e7('0x15')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x43e7('0x16')),'whatsappQueueReport':require(_0x43e7('0x17'))};var queue=schema({'name':{'type':_0x43e7('0x18'),'required':!![],'message':_0x43e7('0x19')},'timeout':{'type':_0x43e7('0x1a'),'message':_0x43e7('0x1b')}});function startRouting(_0x619236,_0x1441ef,_0x2377a3,_0xab63cf){if(_0x619236&&_0x1441ef&&_0x2377a3){_0x1441ef[_0x43e7('0x1c')]+=0x1;var _0x177ee1={'uniqueid':_0x619236,'from':_0x2377a3['body']?_0x2377a3[_0x43e7('0x1d')][_0x43e7('0xc')]:'','joinAt':moment()['format'](_0x43e7('0x1e')),'ContactId':_0x2377a3[_0x43e7('0x1f')]?_0x2377a3[_0x43e7('0x1f')]['id']:null,'ListId':_0x2377a3[_0x43e7('0x20')]?_0x2377a3[_0x43e7('0x20')]['id']:null};_0x177ee1[_[_0x43e7('0x21')](_0x2377a3['channel'])+_0x43e7('0x22')]=_0x1441ef['id']||null;_0x177ee1[_['upperFirst'](_0x2377a3['channel'])+_0x43e7('0x23')]=_0x2377a3[_0x43e7('0x24')]?_0x2377a3['interaction']['id']:null;_0x177ee1[_[_0x43e7('0x21')](_0x2377a3['channel'])+_0x43e7('0x25')]=_0x2377a3['message']?_0x2377a3[_0x43e7('0x26')]['id']:null;_0x177ee1[_[_0x43e7('0x21')](_0x2377a3[_0x43e7('0x27')])+(_0x2377a3[_0x43e7('0x27')]!=='chat'?'AccountId':_0x43e7('0x28'))]=_0x2377a3['account']?_0x2377a3[_0x43e7('0xa')]['id']:null;logger[_0x43e7('0x29')](util[_0x43e7('0xf')](_0x43e7('0x2a'),_0x619236,_0x1441ef['name']));emitChannelQueueInteraction(_0x2377a3[_0x43e7('0x27')],_0x1441ef[_0x43e7('0x2b')],_0x177ee1,_0x2377a3[_0x43e7('0xa')][_0x43e7('0x2b')],_0x2377a3[_0x43e7('0x26')]['id'],!![],_0xab63cf,_0x1441ef['id']);if(rpc[_0x2377a3[_0x43e7('0x27')]+_0x43e7('0x2c')]){return rpc[_0x2377a3[_0x43e7('0x27')]+_0x43e7('0x2c')][_0x43e7('0x2d')](_0x177ee1)[_0x43e7('0x2e')](function(_0x19725a){logger[_0x43e7('0x2f')](_0x43e7('0x30'));});}}}function stopRouting(_0x4bdb17,_0x238321,_0x44f6b0,_0x3b8f78){if(_0x4bdb17&&_0x238321){_0x238321[_0x43e7('0x1c')]-=0x1;var _0x4251c8={'leaveAt':moment()['format'](_0x43e7('0x1e')),'acceptAt':moment()[_0x43e7('0xf')](_0x43e7('0x1e')),'reason':_0x43e7('0x31')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x4bdb17,_0x238321[_0x43e7('0x2b')]));emitChannelQueueInteraction(_0x44f6b0[_0x43e7('0x27')],_0x238321[_0x43e7('0x2b')],_0x44f6b0[_0x43e7('0x1d')],_0x44f6b0[_0x43e7('0xa')][_0x43e7('0x2b')],_0x44f6b0['message']['id'],![],_0x3b8f78,_0x238321['id']);if(rpc[_0x44f6b0['channel']+'QueueReport']){return rpc[_0x44f6b0['channel']+'QueueReport']['update'](_0x4bdb17,_0x4251c8)['catch'](function(_0x14d888){logger['error'](_0x43e7('0x32'));});}}}function endRouting(_0x8e9f40,_0x31bc78,_0x50a2d0,_0x40f72f){if(_0x8e9f40&&_0x31bc78){_0x31bc78[_0x43e7('0x1c')]-=0x1;var _0x101d45={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x43e7('0x1e')),'reason':_0x43e7('0x33')};logger[_0x43e7('0x29')](util[_0x43e7('0xf')](_0x43e7('0x34'),_0x8e9f40,_0x31bc78[_0x43e7('0x2b')]));emitChannelQueueInteraction(_0x50a2d0[_0x43e7('0x27')],_0x31bc78[_0x43e7('0x2b')],_0x50a2d0['body'],_0x50a2d0[_0x43e7('0xa')][_0x43e7('0x2b')],_0x50a2d0['message']['id'],![],_0x40f72f);if(rpc[_0x50a2d0[_0x43e7('0x27')]+'QueueReport']){return rpc[_0x50a2d0[_0x43e7('0x27')]+_0x43e7('0x2c')][_0x43e7('0x35')](_0x8e9f40,_0x101d45)[_0x43e7('0x2e')](function(_0x35ac85){logger[_0x43e7('0x2f')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x574a93){return function(_0x30dfa9){return _0x30dfa9[_0x43e7('0x2b')][_0x43e7('0x36')]()===_0x574a93[_0x43e7('0x36')]();};}exports[_0x43e7('0x37')]=function(_0x4a4a85,_0x32a451,_0x4227c4,_0x575439){return function(_0x3628e0){try{var _0x51a69c={'name':_0x32a451[0x0],'timeout':_0x32a451[0x1]};var _0x2ad8ef=queue['validate'](_0x51a69c,{'typecast':!![]});if(_0x2ad8ef[_0x43e7('0x38')]){logger[_0x43e7('0x2f')](_0x43e7('0x39'),_0x4a4a85,_[_0x43e7('0x3a')](_0x2ad8ef,'message')['join'](',\x20'));_0x3628e0[_0x43e7('0x3b')]();}else{var _0x40c509=_[_0x43e7('0x3c')](_0x4227c4[_0x575439[_0x43e7('0x27')]+'Queues'],handleFindQueue(_0x51a69c['name']));if(_0x40c509){startRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);var _0x5dd988=(_0x40c509[_0x43e7('0x33')]||0xa)*0x3e8;var _0x57f5d0=(_0x51a69c[_0x43e7('0x33')]||0x14)*0x3e8;var _0x4b3a59,_0x5b28db;if(_0x5dd988>_0x57f5d0){_0x57f5d0=_0x5dd988;}var _0x46b2e6=seqqueue['createQueue'](_0x5dd988);_0x46b2e6['id']=_0x4a4a85;_0x46b2e6[_0x43e7('0x3d')]=_0x5dd988;_0x46b2e6[_0x43e7('0x3e')]=_0x57f5d0;_0x46b2e6[_0x43e7('0x27')]=_0x575439[_0x43e7('0x27')];_0x4227c4['rules'][_0x4a4a85]['on'](_0x43e7('0x3f'),function(){logger[_0x43e7('0x29')](_0x43e7('0x40'),_0x4a4a85);stopRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);clearTimeout(_0x4b3a59);_0x4b3a59=undefined;_0x46b2e6[_0x43e7('0x41')](!![]);if(_0x4227c4[_0x43e7('0x42')][_0x4a4a85]){delete _0x4227c4[_0x43e7('0x42')][_0x4a4a85];}_0x3628e0['stop']();});_0x4227c4['rules'][_0x4a4a85]['on'](_0x43e7('0x43'),function(){if(_0x4227c4[_0x43e7('0x42')][_0x4a4a85]){delete _0x4227c4[_0x43e7('0x42')][_0x4a4a85];}});_0x4b3a59=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x4a4a85);endRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);clearTimeout(_0x4b3a59);_0x46b2e6['close'](!![]);_0x3628e0[_0x43e7('0x44')]();},_0x57f5d0);switch(_0x40c509[_0x43e7('0x45')]){case'rrmemory':strategy[_0x43e7('0x46')](_0x46b2e6,_0x40c509,_0x4227c4,_0x575439);break;default:strategy[_0x43e7('0x47')](_0x46b2e6,_0x40c509,_0x4227c4,_0x575439);}}else{logger[_0x43e7('0x2f')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4a4a85,_0x51a69c['name']);_0x3628e0['stop']();}}}catch(_0x4de644){console[_0x43e7('0x48')](_0x4de644);logger[_0x43e7('0x2f')]('[%s][QUEUE]\x20%s',_0x4a4a85,_0x4de644[_0x43e7('0x49')]);_0x3628e0[_0x43e7('0x3b')]();}};}; \ 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 55ce7ef..1f329ab 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 _0x1f10=['drained','prototype','handleDrained','info','[%s][AGENT]\x20try\x20with\x20%s','agent','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','realtime','agents','busyQueue','showNotification','notificationId','writeLog','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','STOP','TIMEOUT','exports','uuid','./util','routing','push','handleRun','bind','handleTimeout','squeue'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1f10,0x160));var _0x01f1=function(_0x3a3ff8,_0x2a7663){_0x3a3ff8=_0x3a3ff8-0x0;var _0x1cdbe2=_0x1f10[_0x3a3ff8];return _0x1cdbe2;};'use strict';var _=require('lodash');var uuid=require(_0x01f1('0x0'));var util=require(_0x01f1('0x1'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x38e7bc,_0x36dcb6,_0x58263a,_0x2afb7f){this['notificationId']=uuid['v4']();this['squeue']=_0x38e7bc;this['agent']=_0x36dcb6;this['realtime']=_0x58263a;this[_0x01f1('0x2')]=_0x2afb7f;this['squeue'][_0x01f1('0x3')](this[_0x01f1('0x4')][_0x01f1('0x5')](this),this[_0x01f1('0x6')][_0x01f1('0x5')](this));this[_0x01f1('0x7')]['on']('timeout',this[_0x01f1('0x6')][_0x01f1('0x5')](this));this['squeue']['on'](_0x01f1('0x8'),this['handleDrained']['bind'](this));};Agent[_0x01f1('0x9')][_0x01f1('0x3')]=function(){this[_0x01f1('0x7')][_0x01f1('0x3')](this[_0x01f1('0x4')][_0x01f1('0x5')](this),this['handleTimeout'][_0x01f1('0x5')](this));};Agent['prototype'][_0x01f1('0xa')]=function(){this['handleTimeout'](!![]);};Agent[_0x01f1('0x9')][_0x01f1('0x4')]=function(_0x384c18){logger[_0x01f1('0xb')](_0x01f1('0xc'),this[_0x01f1('0x7')]['id'],this[_0x01f1('0xd')]['id']);if(_['isNil'](this['realtime']['agents'][this[_0x01f1('0xd')]['id']])){logger['info'](_0x01f1('0xe'),this[_0x01f1('0x7')]['id'],this[_0x01f1('0xd')]['id']);setTimeout(this[_0x01f1('0x3')]['bind'](this),0x3e8);}else{if(this[_0x01f1('0x2')][_0x01f1('0xf')]||util[_0x01f1('0x10')](this[_0x01f1('0x7')]['id'],this[_0x01f1('0x11')][_0x01f1('0x12')][this['agent']['id']],this[_0x01f1('0x7')]['channel'],![])){this['realtime'][_0x01f1('0x12')][this['agent']['id']]['busy']=!![];this['realtime'][_0x01f1('0x12')][this[_0x01f1('0xd')]['id']][_0x01f1('0x13')]=undefined;util[_0x01f1('0x14')](this[_0x01f1('0x15')],this[_0x01f1('0x7')]['id'],this[_0x01f1('0x11')][_0x01f1('0x12')][this['agent']['id']],null,this[_0x01f1('0x2')]);util[_0x01f1('0x16')](this['squeue']['id'],this[_0x01f1('0x11')][_0x01f1('0x12')][this[_0x01f1('0xd')]['id']],'RINGING'+(this[_0x01f1('0x2')][_0x01f1('0xf')]?':FORCED':''));}else{logger[_0x01f1('0xb')](_0x01f1('0x17'),this[_0x01f1('0x7')]['id'],this[_0x01f1('0xd')]['id']);setTimeout(this[_0x01f1('0x3')][_0x01f1('0x5')](this),0x3e8);}}};Agent['prototype'][_0x01f1('0x6')]=function(_0x59bb2c){if(_['isNil'](this[_0x01f1('0x11')][_0x01f1('0x12')][this[_0x01f1('0xd')]['id']])){return logger[_0x01f1('0xb')](_0x01f1('0xe'),this[_0x01f1('0x7')]['id'],this['agent']['id']);}else{logger['info'](_0x01f1('0x18'),this[_0x01f1('0x7')]['id'],this[_0x01f1('0xd')]['id']);util[_0x01f1('0x19')](this[_0x01f1('0x15')],this[_0x01f1('0x7')]['id'],this[_0x01f1('0x11')][_0x01f1('0x12')][this['agent']['id']],null,this['routing']);this[_0x01f1('0x11')][_0x01f1('0x12')][this[_0x01f1('0xd')]['id']][_0x01f1('0x1a')]=![];this[_0x01f1('0x11')]['agents'][this[_0x01f1('0xd')]['id']]['busyQueue']=undefined;util[_0x01f1('0x16')](this['squeue']['id'],this[_0x01f1('0x11')][_0x01f1('0x12')][this['agent']['id']],_0x59bb2c?_0x01f1('0x1b'):_0x01f1('0x1c'));}if(!_0x59bb2c){setTimeout(this[_0x01f1('0x3')][_0x01f1('0x5')](this),0x3e8);}};function agent(_0x1b97b2,_0x53f5fc,_0x342c5d,_0x7f45a4){return new Agent(_0x1b97b2,_0x53f5fc,_0x342c5d,_0x7f45a4);}module[_0x01f1('0x1d')]=agent; \ No newline at end of file +var _0x5493=['busy','showNotification','RINGING',':FORCED','hideNotification','busyQueue','writeLog','STOP','TIMEOUT','exports','uuid','./util','../../../../../config/logger','routing','squeue','agent','realtime','push','handleRun','bind','handleTimeout','drained','prototype','handleDrained','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable'];(function(_0x1c8eb5,_0x125c79){var _0x52c6c=function(_0xdcfa04){while(--_0xdcfa04){_0x1c8eb5['push'](_0x1c8eb5['shift']());}};_0x52c6c(++_0x125c79);}(_0x5493,0xe3));var _0x3549=function(_0x3ffc33,_0xc76983){_0x3ffc33=_0x3ffc33-0x0;var _0x42acf6=_0x5493[_0x3ffc33];return _0x42acf6;};'use strict';var _=require('lodash');var uuid=require(_0x3549('0x0'));var util=require(_0x3549('0x1'));var logger=require(_0x3549('0x2'))(_0x3549('0x3'));var Agent=function(_0x1e0253,_0x816ad3,_0x194cb5,_0x3a63de){this['notificationId']=uuid['v4']();this[_0x3549('0x4')]=_0x1e0253;this[_0x3549('0x5')]=_0x816ad3;this[_0x3549('0x6')]=_0x194cb5;this[_0x3549('0x3')]=_0x3a63de;this[_0x3549('0x4')][_0x3549('0x7')](this[_0x3549('0x8')][_0x3549('0x9')](this),this[_0x3549('0xa')]['bind'](this));this[_0x3549('0x4')]['on']('timeout',this[_0x3549('0xa')][_0x3549('0x9')](this));this[_0x3549('0x4')]['on'](_0x3549('0xb'),this['handleDrained'][_0x3549('0x9')](this));};Agent[_0x3549('0xc')][_0x3549('0x7')]=function(){this[_0x3549('0x4')][_0x3549('0x7')](this[_0x3549('0x8')]['bind'](this),this[_0x3549('0xa')][_0x3549('0x9')](this));};Agent[_0x3549('0xc')][_0x3549('0xd')]=function(){this[_0x3549('0xa')](!![]);};Agent[_0x3549('0xc')][_0x3549('0x8')]=function(_0x20d38e){logger[_0x3549('0xe')](_0x3549('0xf'),this[_0x3549('0x4')]['id'],this['agent']['id']);if(_[_0x3549('0x10')](this[_0x3549('0x6')][_0x3549('0x11')][this[_0x3549('0x5')]['id']])){logger['info'](_0x3549('0x12'),this[_0x3549('0x4')]['id'],this['agent']['id']);setTimeout(this[_0x3549('0x7')][_0x3549('0x9')](this),0x3e8);}else{if(this[_0x3549('0x3')][_0x3549('0x13')]||util[_0x3549('0x14')](this[_0x3549('0x4')]['id'],this['realtime'][_0x3549('0x11')][this[_0x3549('0x5')]['id']],this[_0x3549('0x4')]['channel'],![])){this['realtime']['agents'][this['agent']['id']][_0x3549('0x15')]=!![];this[_0x3549('0x6')]['agents'][this[_0x3549('0x5')]['id']]['busyQueue']=undefined;util[_0x3549('0x16')](this['notificationId'],this[_0x3549('0x4')]['id'],this[_0x3549('0x6')]['agents'][this[_0x3549('0x5')]['id']],null,this[_0x3549('0x3')]);util['writeLog'](this[_0x3549('0x4')]['id'],this[_0x3549('0x6')]['agents'][this[_0x3549('0x5')]['id']],_0x3549('0x17')+(this['routing'][_0x3549('0x13')]?_0x3549('0x18'):''));}else{logger['info']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x3549('0x4')]['id'],this[_0x3549('0x5')]['id']);setTimeout(this[_0x3549('0x7')][_0x3549('0x9')](this),0x3e8);}}};Agent[_0x3549('0xc')][_0x3549('0xa')]=function(_0x24a63e){if(_[_0x3549('0x10')](this[_0x3549('0x6')][_0x3549('0x11')][this[_0x3549('0x5')]['id']])){return logger[_0x3549('0xe')](_0x3549('0x12'),this[_0x3549('0x4')]['id'],this[_0x3549('0x5')]['id']);}else{logger[_0x3549('0xe')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x3549('0x4')]['id'],this[_0x3549('0x5')]['id']);util[_0x3549('0x19')](this['notificationId'],this[_0x3549('0x4')]['id'],this[_0x3549('0x6')][_0x3549('0x11')][this['agent']['id']],null,this['routing']);this[_0x3549('0x6')]['agents'][this[_0x3549('0x5')]['id']][_0x3549('0x15')]=![];this[_0x3549('0x6')][_0x3549('0x11')][this['agent']['id']][_0x3549('0x1a')]=undefined;util[_0x3549('0x1b')](this[_0x3549('0x4')]['id'],this[_0x3549('0x6')][_0x3549('0x11')][this[_0x3549('0x5')]['id']],_0x24a63e?_0x3549('0x1c'):_0x3549('0x1d'));}if(!_0x24a63e){setTimeout(this[_0x3549('0x7')]['bind'](this),0x3e8);}};function agent(_0x592a7a,_0x429bab,_0x388813,_0x4eb862){return new Agent(_0x592a7a,_0x429bab,_0x388813,_0x4eb862);}module[_0x3549('0x1e')]=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 75033bb..5aa9e32 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 _0x60d7=['handleRun','bind','handleTimeout','drained','handleDrained','prototype','push','isNil','Agents','length','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','RINGING','busy','busyQueue','name','info','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','notificationId','STOP','TIMEOUT','lodash','./util','../../../../../config/logger','routing','squeue','queue','realtime'];(function(_0x3cd9c6,_0x49a1bd){var _0x5a5b77=function(_0x339b49){while(--_0x339b49){_0x3cd9c6['push'](_0x3cd9c6['shift']());}};_0x5a5b77(++_0x49a1bd);}(_0x60d7,0xf1));var _0x760d=function(_0x52acf0,_0x4fc9b9){_0x52acf0=_0x52acf0-0x0;var _0x3a2099=_0x60d7[_0x52acf0];return _0x3a2099;};'use strict';var _=require(_0x760d('0x0'));var uuid=require('uuid');var util=require(_0x760d('0x1'));var logger=require(_0x760d('0x2'))(_0x760d('0x3'));var Beepall=function(_0x552070,_0x199009,_0x41d9f2,_0x5db45e){this['notificationId']=uuid['v4']();this[_0x760d('0x4')]=_0x552070;this[_0x760d('0x5')]=_0x199009;this[_0x760d('0x6')]=_0x41d9f2;this['routing']=_0x5db45e;this['squeue']['push'](this[_0x760d('0x7')][_0x760d('0x8')](this),this[_0x760d('0x9')][_0x760d('0x8')](this));this[_0x760d('0x4')]['on']('timeout',this['handleTimeout']['bind'](this));this[_0x760d('0x4')]['on'](_0x760d('0xa'),this[_0x760d('0xb')]['bind'](this));};Beepall[_0x760d('0xc')][_0x760d('0xd')]=function(){this[_0x760d('0x4')][_0x760d('0xd')](this[_0x760d('0x7')][_0x760d('0x8')](this),this[_0x760d('0x9')]['bind'](this));};Beepall[_0x760d('0xc')][_0x760d('0xb')]=function(_0x2495cc){this['handleTimeout'](!![]);};Beepall[_0x760d('0xc')][_0x760d('0x7')]=function(_0x8af86){var _0x268cea=!![];if(!_[_0x760d('0xe')](this['queue'])&&!_[_0x760d('0xe')](this[_0x760d('0x5')][_0x760d('0xf')])&&this[_0x760d('0x5')]['Agents']['length']>0x0){for(var _0xdc701=0x0,_0x509a52;_0xdc7010x0){for(var _0x21b1c8=0x0,_0x137803;_0x21b1c80x0&&_0x57620a[_0x9a9e8+_0xa564('0x27')]>=_0x57620a[_0x9a9e8+_0xa564('0x28')]){writeLog(_0x5d23ce,_0x57620a,_0x9a9e8[_0xa564('0x29')]()+_0xa564('0x2a'));return![];}}return!![];};exports[_0xa564('0x2b')]=function(_0x5670fb,_0xd1d655,_0x103462,_0xe8d6fe,_0xca5d47){return sendNotification(!![],_0x5670fb,_0xd1d655,_0x103462,_0xe8d6fe,_0xca5d47);};exports[_0xa564('0x2c')]=function(_0x496999,_0x4326b2,_0x36b6be,_0x5d2a56,_0x2aa11e){return sendNotification(![],_0x496999,_0x4326b2,_0x36b6be,_0x5d2a56,_0x2aa11e);};exports[_0xa564('0x2d')]=writeLog; \ No newline at end of file +var _0xc719=['CurrentCapacity','\x20MAXCAPACITY','showNotification','hideNotification','lodash','util','../utils','mustache','ioredis','../../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','format','user:%s','name','user:save','split','\x20interaction','account','notificationSound','body','queue','msg','error','[%s][QUEUE]\x20%s','message','notification:%s','save','remove','info','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','Capacity','hasOwnProperty'];(function(_0x97c876,_0xd7a80c){var _0x3b2060=function(_0x4188d9){while(--_0x4188d9){_0x97c876['push'](_0x97c876['shift']());}};_0x3b2060(++_0xd7a80c);}(_0xc719,0x1d2));var _0x9c71=function(_0x16bb4b,_0x5fe431){_0x16bb4b=_0x16bb4b-0x0;var _0x8aeb84=_0xc719[_0x16bb4b];return _0x8aeb84;};'use strict';var _=require(_0x9c71('0x0'));var util=require(_0x9c71('0x1'));var utils=require(_0x9c71('0x2'));var Mustache=require(_0x9c71('0x3'));var Redis=require(_0x9c71('0x4'));var config=require('../../../../../config/environment');var logger=require(_0x9c71('0x5'))('routing');config[_0x9c71('0x6')]=_[_0x9c71('0x7')](config[_0x9c71('0x6')],{'host':_0x9c71('0x8'),'port':0x18eb});var io=require(_0x9c71('0x9'))(new Redis(config[_0x9c71('0x6')]));function emit(_0x413519,_0x162af5,_0x55a82e){io['to'](_0x413519)[_0x9c71('0xa')](_0x162af5,_0x55a82e);}function sendNotification(_0x2f212e,_0x27d63c,_0x44f692,_0x37bc17,_0x337d03,_0x365662){io['to'](util[_0x9c71('0xb')](_0x9c71('0xc'),_0x37bc17[_0x9c71('0xd')]))[_0x9c71('0xa')](_0x9c71('0xe'),_0x37bc17);var _0x54f6f5=_0x365662||{};var _0x569071=_0x44f692[_0x9c71('0xf')]('.');var _0x53534e={'uniqueid':_0x27d63c,'channel':_0x569071[0x0],'id':_0x569071[0x1],'title':_0x569071[0x0]+_0x9c71('0x10'),'interactionId':_0x569071[0x2],'queue':_0x337d03?_0x337d03['name']:null,'sound':_0x54f6f5[_0x9c71('0x11')][_0x9c71('0x12')],'shake':_0x54f6f5[_0x9c71('0x11')]['notificationShake']};try{if(!_0x54f6f5[_0x9c71('0x13')]){_0x54f6f5[_0x9c71('0x13')]={};}if(_0x337d03){_0x54f6f5[_0x9c71('0x13')]['queue']=_0x337d03;}else if(_0x54f6f5['body'][_0x9c71('0x14')]){delete _0x54f6f5[_0x9c71('0x13')]['queue'];}_0x53534e['msg']=utils['getMustacheRender'](_0x54f6f5[_0x9c71('0x11')]['notificationTemplate'],_0x54f6f5);}catch(_0x1c8132){_0x53534e[_0x9c71('0x15')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0x9c71('0x16')](util[_0x9c71('0xb')](_0x9c71('0x17'),_0x27d63c,_0x1c8132[_0x9c71('0x18')]));}io['to'](util[_0x9c71('0xb')](_0x9c71('0xc'),_0x37bc17[_0x9c71('0xd')]))[_0x9c71('0xa')](util[_0x9c71('0xb')](_0x9c71('0x19'),_0x2f212e?_0x9c71('0x1a'):_0x9c71('0x1b')),_0x53534e);}function writeLog(_0x138fb3,_0x360714,_0x1300d5){return logger[_0x9c71('0x1c')](util[_0x9c71('0xb')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x138fb3,_0x360714['name'],_0x1300d5));}exports[_0x9c71('0x1d')]=function(_0x5de37b,_0x108153,_0x12c871,_0x4e34e6){if(_0x108153[_0x9c71('0x1e')]){writeLog(_0x5de37b,_0x108153,_0x9c71('0x1f'));return![];}if(!_0x108153[_0x9c71('0x20')]){writeLog(_0x5de37b,_0x108153,_0x9c71('0x21'));return![];}if(_0x108153[_0x12c871+_0x9c71('0x22')]){writeLog(_0x5de37b,_0x108153,_0x9c71('0x23'));return![];}if(_0x4e34e6&&_0x108153['hasOwnProperty'](_0x12c871+_0x9c71('0x24'))&&_0x108153[_0x9c71('0x25')](_0x12c871+_0x9c71('0x26'))){if(_0x108153[_0x12c871+_0x9c71('0x24')]>0x0&&_0x108153[_0x12c871+_0x9c71('0x26')]>=_0x108153[_0x12c871+'Capacity']){writeLog(_0x5de37b,_0x108153,_0x12c871['toUpperCase']()+_0x9c71('0x27'));return![];}}return!![];};exports[_0x9c71('0x28')]=function(_0x4747d0,_0x39670,_0x27e2ec,_0x4836e5,_0xd9ce71){return sendNotification(!![],_0x4747d0,_0x39670,_0x27e2ec,_0x4836e5,_0xd9ce71);};exports[_0x9c71('0x29')]=function(_0x1f96d2,_0x23ad53,_0x14bd5c,_0x172129,_0x4868ea){return sendNotification(![],_0x1f96d2,_0x23ad53,_0x14bd5c,_0x172129,_0x4868ea);};exports['writeLog']=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 d7dc5a9..be09ded 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 _0x9492=['join','info','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','isObject','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][SYSTEM]\x20%s','map'];(function(_0x41debf,_0x3ae6c1){var _0x4d5f3e=function(_0x135997){while(--_0x135997){_0x41debf['push'](_0x41debf['shift']());}};_0x4d5f3e(++_0x3ae6c1);}(_0x9492,0x1f1));var _0x2949=function(_0x20b972,_0x1307e5){_0x20b972=_0x20b972-0x0;var _0x15d1de=_0x9492[_0x20b972];return _0x15d1de;};'use strict';var schema=require(_0x2949('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require(_0x2949('0x1'));var logger=require(_0x2949('0x2'))('routing');var system=schema({'command':{'type':_0x2949('0x3'),'required':!![],'message':_0x2949('0x4')}});exports[_0x2949('0x5')]=function(_0x2525ea,_0x552371){return function(_0x2c86c1){try{var _0x18afd0={'command':_0x552371[0x0]};var _0x502798=system[_0x2949('0x0')](_0x18afd0,{'typecast':!![]});if(_0x502798['length']){logger[_0x2949('0x6')](_0x2949('0x7'),_0x2525ea,_[_0x2949('0x8')](_0x502798,'message')[_0x2949('0x9')](',\x20'));logger[_0x2949('0xa')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x2525ea);_0x2c86c1['next']();}else{var _0x4b251d=this;var _0x1cc270=utils[_0x2949('0xb')](_0x552371[0x0],this);logger[_0x2949('0xa')](_0x2949('0xc'),_0x2525ea,_0x1cc270);sh[_0x2949('0xd')](_['trim'](_0x1cc270),function(_0x1c0fee,_0x43da39){logger[_0x2949('0xa')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x2525ea,_0x1c0fee);if(_0x1c0fee==0x0){var _0x5a248f=_0x43da39[_0x2949('0xe')](/(\r\n|\n|\r)/gm,'');if(_[_0x2949('0xf')](_0x552371[0x1])||_['isEmpty'](_0x552371[0x1])){logger[_0x2949('0xa')](_0x2949('0x10'),_0x2525ea);_0x4b251d[_0x2949('0x11')][_0x552371[0x1]]=_0x5a248f;}else{logger[_0x2949('0xa')](_0x2949('0x12'),_0x2525ea,_0x552371[0x1],_0x5a248f);_0x4b251d[_0x2949('0x11')][_0x552371[0x1]]=_0x5a248f;}}_0x2c86c1[_0x2949('0x13')]();});}}catch(_0x47e1ca){logger[_0x2949('0x6')](_0x2949('0x7'),_0x2525ea,_[_0x2949('0x14')](_0x47e1ca)?JSON['stringify'](_0x47e1ca):_0x47e1ca);logger[_0x2949('0xa')](_0x2949('0x15'),_0x2525ea);_0x2c86c1['next']();}};}; \ No newline at end of file +var _0x281a=['validate','length','error','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','[%s][SYSTEM]\x20%s','isObject','stringify','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence'];(function(_0x43765,_0x263652){var _0x5c8eb7=function(_0x59ca08){while(--_0x59ca08){_0x43765['push'](_0x43765['shift']());}};_0x5c8eb7(++_0x263652);}(_0x281a,0x154));var _0xa281=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x281a[_0x5f0089];return _0x193892;};'use strict';var schema=require('validate');var sh=require(_0xa281('0x0'));var _=require(_0xa281('0x1'));var utils=require(_0xa281('0x2'));var logger=require(_0xa281('0x3'))(_0xa281('0x4'));var system=schema({'command':{'type':_0xa281('0x5'),'required':!![],'message':_0xa281('0x6')}});exports[_0xa281('0x7')]=function(_0x8813bd,_0x47bc63){return function(_0x187dd3){try{var _0x33520a={'command':_0x47bc63[0x0]};var _0x124222=system[_0xa281('0x8')](_0x33520a,{'typecast':!![]});if(_0x124222[_0xa281('0x9')]){logger[_0xa281('0xa')]('[%s][SYSTEM]\x20%s',_0x8813bd,_[_0xa281('0xb')](_0x124222,_0xa281('0xc'))['join'](',\x20'));logger[_0xa281('0xd')](_0xa281('0xe'),_0x8813bd);_0x187dd3['next']();}else{var _0x379a34=this;var _0xe948ed=utils[_0xa281('0xf')](_0x47bc63[0x0],this);logger[_0xa281('0xd')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x8813bd,_0xe948ed);sh[_0xa281('0x10')](_[_0xa281('0x11')](_0xe948ed),function(_0x4c0049,_0x59ddc1){logger[_0xa281('0xd')](_0xa281('0x12'),_0x8813bd,_0x4c0049);if(_0x4c0049==0x0){var _0x33c6fd=_0x59ddc1[_0xa281('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0xa281('0x14')](_0x47bc63[0x1])||_[_0xa281('0x15')](_0x47bc63[0x1])){logger[_0xa281('0xd')](_0xa281('0x16'),_0x8813bd);_0x379a34[_0xa281('0x17')][_0x47bc63[0x1]]=_0x33c6fd;}else{logger['info'](_0xa281('0x18'),_0x8813bd,_0x47bc63[0x1],_0x33c6fd);_0x379a34[_0xa281('0x17')][_0x47bc63[0x1]]=_0x33c6fd;}}_0x187dd3[_0xa281('0x19')]();});}}catch(_0x24f21d){logger[_0xa281('0xa')](_0xa281('0x1a'),_0x8813bd,_[_0xa281('0x1b')](_0x24f21d)?JSON[_0xa281('0x1c')](_0x24f21d):_0x24f21d);logger['info'](_0xa281('0xe'),_0x8813bd);_0x187dd3[_0xa281('0x19')]();}};}; \ 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 7fede30..267941b 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 _0x9898=['../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','isObject','stringify','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction'];(function(_0x18aaaf,_0x385db6){var _0x52d892=function(_0x1ac6da){while(--_0x1ac6da){_0x18aaaf['push'](_0x18aaaf['shift']());}};_0x52d892(++_0x385db6);}(_0x9898,0x15a));var _0x8989=function(_0x44454f,_0x4bfbe8){_0x44454f=_0x44454f-0x0;var _0x475150=_0x9898[_0x44454f];return _0x475150;};'use strict';var schema=require(_0x8989('0x0'));var _=require(_0x8989('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x8989('0x2')),'smsInteraction':require(_0x8989('0x3')),'mailInteraction':require(_0x8989('0x4')),'faxInteraction':require(_0x8989('0x5')),'whatsappInteraction':require(_0x8989('0x6'))};var logger=require('../../../../config/logger')(_0x8989('0x7'));var tag=schema({'tag':{'type':_0x8989('0x8'),'required':!![],'message':_0x8989('0x9')}});exports[_0x8989('0xa')]=function(_0x53a2b8,_0x431472,_0x6feaf,_0xfaacbd){return function(_0x1d0caf){try{var _0x5d3175={'tag':_0x431472[0x0]};var _0x41c3de=tag[_0x8989('0x0')](_0x5d3175,{'typecast':!![]});if(_0x41c3de[_0x8989('0xb')]){logger[_0x8989('0xc')]('[%s][TAG]\x20%s',_0x53a2b8,_[_0x8989('0xd')](_0x41c3de,_0x8989('0xe'))[_0x8989('0xf')](',\x20'));logger[_0x8989('0x10')](_0x8989('0x11'),_0x53a2b8);_0x1d0caf[_0x8989('0x12')]();}else{var _0x5080fc={'ids':[_0x431472[0x0]]};if(rpc[_0xfaacbd[_0x8989('0x13')]+_0x8989('0x14')]){rpc[_0xfaacbd[_0x8989('0x13')]+_0x8989('0x14')]['addTags'](_0xfaacbd[_0x8989('0x15')]['id'],_0x5080fc)['then'](function(_0x438c2b){logger['info'](_0x8989('0x16'),_0x53a2b8,_0x431472[0x1],_0xfaacbd[_0x8989('0x13')],_0xfaacbd[_0x8989('0x15')]['id']);})[_0x8989('0x17')](function(_0xaef576){logger[_0x8989('0xc')](_0x8989('0x18'),_0x53a2b8,JSON['stringify'](_0xaef576));logger[_0x8989('0x10')](_0x8989('0x11'),_0x53a2b8);})['finally'](function(){_0x1d0caf['next']();});}}}catch(_0x4a213b){logger[_0x8989('0xc')](_0x8989('0x18'),_0x53a2b8,_[_0x8989('0x19')](_0x4a213b)?JSON[_0x8989('0x1a')](_0x4a213b):_0x4a213b);logger[_0x8989('0x10')](_0x8989('0x11'),_0x53a2b8);_0x1d0caf[_0x8989('0x12')]();}};}; \ No newline at end of file +var _0xa95a=['../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','Interaction','channel','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','next','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction'];(function(_0x247950,_0x4dce98){var _0x2f5d3f=function(_0x2d0865){while(--_0x2d0865){_0x247950['push'](_0x247950['shift']());}};_0x2f5d3f(++_0x4dce98);}(_0xa95a,0x182));var _0xaa95=function(_0x24b824,_0x3c330e){_0x24b824=_0x24b824-0x0;var _0x2be676=_0xa95a[_0x24b824];return _0x2be676;};'use strict';var schema=require(_0xaa95('0x0'));var _=require(_0xaa95('0x1'));var rpc={'chatInteraction':require(_0xaa95('0x2')),'openchannelInteraction':require(_0xaa95('0x3')),'smsInteraction':require(_0xaa95('0x4')),'mailInteraction':require(_0xaa95('0x5')),'faxInteraction':require(_0xaa95('0x6')),'whatsappInteraction':require(_0xaa95('0x7'))};var logger=require('../../../../config/logger')(_0xaa95('0x8'));var tag=schema({'tag':{'type':_0xaa95('0x9'),'required':!![],'message':_0xaa95('0xa')}});exports[_0xaa95('0xb')]=function(_0x2d4a4e,_0x3aad93,_0x3d6479,_0x51ba27){return function(_0x5d26f3){try{var _0x5021f5={'tag':_0x3aad93[0x0]};var _0x5d03e8=tag[_0xaa95('0x0')](_0x5021f5,{'typecast':!![]});if(_0x5d03e8[_0xaa95('0xc')]){logger[_0xaa95('0xd')](_0xaa95('0xe'),_0x2d4a4e,_['map'](_0x5d03e8,_0xaa95('0xf'))[_0xaa95('0x10')](',\x20'));logger[_0xaa95('0x11')](_0xaa95('0x12'),_0x2d4a4e);_0x5d26f3['next']();}else{var _0xef6e09={'ids':[_0x3aad93[0x0]]};if(rpc[_0x51ba27['channel']+_0xaa95('0x13')]){rpc[_0x51ba27[_0xaa95('0x14')]+_0xaa95('0x13')][_0xaa95('0x15')](_0x51ba27['interaction']['id'],_0xef6e09)[_0xaa95('0x16')](function(_0x30e4c5){logger['info'](_0xaa95('0x17'),_0x2d4a4e,_0x3aad93[0x1],_0x51ba27[_0xaa95('0x14')],_0x51ba27[_0xaa95('0x18')]['id']);})[_0xaa95('0x19')](function(_0x4c4b7c){logger[_0xaa95('0xd')]('[%s][TAG]\x20%s',_0x2d4a4e,JSON['stringify'](_0x4c4b7c));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2d4a4e);})['finally'](function(){_0x5d26f3[_0xaa95('0x1a')]();});}}}catch(_0x3bc44c){logger[_0xaa95('0xd')](_0xaa95('0xe'),_0x2d4a4e,_['isObject'](_0x3bc44c)?JSON[_0xaa95('0x1b')](_0x3bc44c):_0x3bc44c);logger['info'](_0xaa95('0x12'),_0x2d4a4e);_0x5d26f3[_0xaa95('0x1a')]();}};}; \ 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 35dcd7c..7b64c84 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 _0x3308=['list','render','merge','body','message','account','interaction'];(function(_0xdd3a23,_0x501d9b){var _0xa3cbb9=function(_0x254356){while(--_0x254356){_0xdd3a23['push'](_0xdd3a23['shift']());}};_0xa3cbb9(++_0x501d9b);}(_0x3308,0x12e));var _0x8330=function(_0x8d90ad,_0x76e637){_0x8d90ad=_0x8d90ad-0x0;var _0x1e0fe6=_0x3308[_0x8d90ad];return _0x1e0fe6;};'use strict';var Mustache=require('mustache');var _=require('lodash');module['exports']={'getMustacheRender':function(_0x42bb8d,_0x38c12e){return Mustache[_0x8330('0x0')](_0x42bb8d,_[_0x8330('0x1')](_0x38c12e[_0x8330('0x2')],{'contact':_0x38c12e['contact'],'message':_0x38c12e[_0x8330('0x3')],'account':_0x38c12e[_0x8330('0x4')],'interaction':_0x38c12e[_0x8330('0x5')],'list':_0x38c12e[_0x8330('0x6')]}))||'';}}; \ No newline at end of file +var _0x90ae=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x3554e2,_0x2fc7f4){var _0x498ae1=function(_0x5686dd){while(--_0x5686dd){_0x3554e2['push'](_0x3554e2['shift']());}};_0x498ae1(++_0x2fc7f4);}(_0x90ae,0x195));var _0xe90a=function(_0x4cdbfb,_0xb64308){_0x4cdbfb=_0x4cdbfb-0x0;var _0x29c645=_0x90ae[_0x4cdbfb];return _0x29c645;};'use strict';var Mustache=require(_0xe90a('0x0'));var _=require(_0xe90a('0x1'));module[_0xe90a('0x2')]={'getMustacheRender':function(_0x4c6db8,_0xbff9b9){return Mustache[_0xe90a('0x3')](_0x4c6db8,_[_0xe90a('0x4')](_0xbff9b9[_0xe90a('0x5')],{'contact':_0xbff9b9[_0xe90a('0x6')],'message':_0xbff9b9[_0xe90a('0x7')],'account':_0xbff9b9[_0xe90a('0x8')],'interaction':_0xbff9b9[_0xe90a('0x9')],'list':_0xbff9b9[_0xe90a('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index cf56ae4..33f9167 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 _0xbec5=['\x20|\x20','error','execute','Applications\x20executed','stringify','matchPath','emit','complete','stack','routing\x20is\x20empty','agent','agents','busyQueue','QueueReport','update','UserId','catch','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','mailQueues','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','rules','channel','message','interaction','isArray','applications','length','join','app','.js','toLowerCase','appdata','mail','push','slice','dialogflow','split','amazonlex','TagId','%s:%s:%s','./interval','condition','./applications/','consequence','info','Push\x20new\x20rule','intervals'];(function(_0x2e19ab,_0x4d527f){var _0x510981=function(_0x808e9){while(--_0x808e9){_0x2e19ab['push'](_0x2e19ab['shift']());}};_0x510981(++_0x4d527f);}(_0xbec5,0xe5));var _0x5bec=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xbec5[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x5bec('0x2'));var BPromise=require(_0x5bec('0x3'));var uuid=require(_0x5bec('0x4'));var config=require(_0x5bec('0x5'));var logger=require(_0x5bec('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0x5bec('0x7')),'mailQueueReport':require(_0x5bec('0x8')),'chatQueueReport':require(_0x5bec('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x5bec('0xa')),'whatsappQueueReport':require(_0x5bec('0xb'))};var RuleEngine=require(_0x5bec('0xc'));function getId(_0x406e65,_0x43d96e,_0x302aae){return util[_0x5bec('0xd')](_0x5bec('0xe'),_0x406e65,_0x43d96e||0x0,_0x302aae||0x0);}function getIntervals(_0x4d0d29,_0x41a827){var _0x5c2d67=[];if(!_[_0x5bec('0xf')](_0x41a827[_0x5bec('0x10')])&&!_[_0x5bec('0xf')](_0x4d0d29[_0x41a827['IntervalId']])&&!_[_0x5bec('0xf')](_0x4d0d29[_0x41a827[_0x5bec('0x10')]][_0x5bec('0x11')])){_0x5c2d67=_['map'](_0x4d0d29[_0x41a827[_0x5bec('0x10')]][_0x5bec('0x11')],'interval');}else if(!_[_0x5bec('0xf')](_0x41a827[_0x5bec('0x12')])){_0x5c2d67=[_0x41a827[_0x5bec('0x12')]];}return _0x5c2d67;}exports[_0x5bec('0x13')]=function(_0x3198e0){_0x3198e0[_0x5bec('0x14')]={};return new BPromise(function(_0x24dcd6,_0x43fd2a){var _0x259588={'Start':function(_0x3ebc41){var _0x31b9e4=this;return new Promise(function(_0x325daf,_0x11fb8e){if(_0x3ebc41){try{var _0x506639=[];var _0x4ab821=getId(_0x3ebc41[_0x5bec('0x15')],_0x3ebc41[_0x5bec('0x16')]?_0x3ebc41[_0x5bec('0x16')]['id']:0x0,_0x3ebc41[_0x5bec('0x17')]?_0x3ebc41['interaction']['id']:0x0);if(_0x3ebc41['applications']&&_[_0x5bec('0x18')](_0x3ebc41[_0x5bec('0x19')])&&_0x3ebc41['applications'][_0x5bec('0x1a')]){for(var _0xa7e223=0x0;_0xa7e223<_0x3ebc41[_0x5bec('0x19')][_0x5bec('0x1a')];_0xa7e223+=0x1){var _0x554f9f=_0x3ebc41[_0x5bec('0x19')][_0xa7e223];if(fs['existsSync'](path[_0x5bec('0x1b')](__dirname,_0x5bec('0x19'),_0x554f9f[_0x5bec('0x1c')]+_0x5bec('0x1d')))){var _0xfed23=[];switch(_0x554f9f['app'][_0x5bec('0x1e')]()){case'autoreply':var _0x2b2d26=_0x554f9f[_0x5bec('0x1f')]['split'](',');if(_0x3ebc41[_0x5bec('0x15')]===_0x5bec('0x20')){_0xfed23['push'](_0x2b2d26[0x0]);_0xfed23[_0x5bec('0x21')](_0x2b2d26[0x1]);_0xfed23[_0x5bec('0x21')](_0x2b2d26[_0x5bec('0x22')](0x2,_0x2b2d26[_0x5bec('0x1a')])[_0x5bec('0x1b')](','));}else{_0xfed23[_0x5bec('0x21')](_0x2b2d26[0x0]);_0xfed23[_0x5bec('0x21')](_0x2b2d26['slice'](0x1,_0x2b2d26['length'])['join'](','));}break;case _0x5bec('0x23'):var _0x2cdd2f=_0x554f9f[_0x5bec('0x1f')]['split'](',');_0xfed23[_0x5bec('0x21')](_0x2cdd2f[0x0]);_0xfed23[_0x5bec('0x21')](_0x2cdd2f[0x1]);_0xfed23['push'](_0x2cdd2f[_0x5bec('0x22')](0x2,_0x2cdd2f[_0x5bec('0x1a')])['join'](','));break;case'dialogflowv2':var _0x3575e7=_0x554f9f[_0x5bec('0x1f')][_0x5bec('0x24')](',');_0xfed23[_0x5bec('0x21')](_0x3575e7[0x0]);_0xfed23[_0x5bec('0x21')](_0x3575e7[0x1]);_0xfed23[_0x5bec('0x21')](_0x3575e7[0x2]);_0xfed23['push'](_0x3575e7[0x3]);_0xfed23[_0x5bec('0x21')](_0x3575e7['slice'](0x4,_0x3575e7[_0x5bec('0x1a')])[_0x5bec('0x1b')](','));break;case _0x5bec('0x25'):var _0x110bd4=_0x554f9f['appdata'][_0x5bec('0x24')](',');_0xfed23[_0x5bec('0x21')](_0x110bd4[0x0]);_0xfed23[_0x5bec('0x21')](_0x110bd4[0x1]);_0xfed23['push'](_0x110bd4[0x2]);_0xfed23[_0x5bec('0x21')](_0x110bd4[0x3]);_0xfed23['push'](_0x110bd4[_0x5bec('0x22')](0x4,_0x110bd4[_0x5bec('0x1a')])[_0x5bec('0x1b')](','));break;case'message':_0xfed23[_0x5bec('0x21')](_0x554f9f[_0x5bec('0x1f')]);break;case'tag':_0xfed23[_0x5bec('0x21')](_0x554f9f[_0x5bec('0x26')]);_0xfed23[_0x5bec('0x21')](_0x554f9f[_0x5bec('0x1f')]);break;default:_0xfed23=_[_0x5bec('0xf')](_0x554f9f['appdata'])?[]:_0x554f9f[_0x5bec('0x1f')]['split'](',');}var _0x2d3793={'id':util[_0x5bec('0xd')](_0x5bec('0x27'),_0x4ab821,_0x554f9f['id'],_0x554f9f[_0x5bec('0x1c')]),'condition':require(_0x5bec('0x28'))[_0x5bec('0x29')](_0x4ab821,getIntervals(_0x3198e0['intervals'],_0x554f9f),_0x3198e0),'consequence':require(_0x5bec('0x2a')+_0x554f9f[_0x5bec('0x1c')])[_0x5bec('0x2b')](_0x4ab821,_0xfed23,_0x3198e0,_0x3ebc41),'p':_0x554f9f['priority']||0x0};logger[_0x5bec('0x2c')](_0x5bec('0x2d'),_0x2d3793['id'],'on\x20interval',getIntervals(_0x3198e0[_0x5bec('0x2e')],_0x554f9f)['join'](_0x5bec('0x2f')));_0x506639[_0x5bec('0x21')](_0x2d3793);}else{logger[_0x5bec('0x30')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x5bec('0x1b')](__dirname,_0x5bec('0x19'),_0x554f9f[_0x5bec('0x1c')]+_0x5bec('0x1d')));}}_0x3198e0[_0x5bec('0x14')][_0x4ab821]=new RuleEngine(_0x506639);_0x3198e0[_0x5bec('0x14')][_0x4ab821][_0x5bec('0x31')](_0x3ebc41,function(_0x4a8b0b){logger[_0x5bec('0x2c')](_0x5bec('0x32'),JSON[_0x5bec('0x33')](_0x4a8b0b[_0x5bec('0x34')]));if(_0x3198e0['rules'][_0x4ab821]){_0x3198e0[_0x5bec('0x14')][_0x4ab821][_0x5bec('0x35')](_0x5bec('0x36'));}});return _0x325daf({'code':0xc8,'message':_0x3ebc41});}else{logger['info']('No\x20applications\x20to\x20execute');return _0x325daf({'code':0xc8,'message':_0x3ebc41});}}catch(_0x1a57e3){logger[_0x5bec('0x30')](_0x1a57e3[_0x5bec('0x37')]);return _0x11fb8e(_0x31b9e4[_0x5bec('0x30')](0x1f4,_0x1a57e3));}}return _0x11fb8e(_0x5bec('0x38'));});},'AcceptMessage':function(_0x4ec405){var _0x4fee8a=this;return new Promise(function(_0x411306,_0x5cb97e){if(_0x4ec405[_0x5bec('0x39')]&&_0x4ec405[_0x5bec('0x39')]['id']){if(_0x3198e0[_0x5bec('0x3a')][_0x4ec405['agent']['id']]){_0x3198e0[_0x5bec('0x3a')][_0x4ec405[_0x5bec('0x39')]['id']]['busy']=![];_0x3198e0[_0x5bec('0x3a')][_0x4ec405[_0x5bec('0x39')]['id']][_0x5bec('0x3b')]=undefined;}}if(_0x4ec405[_0x5bec('0x16')]&&_0x4ec405[_0x5bec('0x16')]['id']){try{var _0x2724cf=getId(_0x4ec405[_0x5bec('0x15')],_0x4ec405['message']?_0x4ec405['message']['id']:0x0,_0x4ec405[_0x5bec('0x17')]?_0x4ec405['interaction']['id']:0x0);if(_0x3198e0['rules'][_0x2724cf]){_0x3198e0[_0x5bec('0x14')][_0x2724cf]['emit']('end');if(rpc[_0x4ec405['channel']+_0x5bec('0x3c')]){rpc[_0x4ec405[_0x5bec('0x15')]+_0x5bec('0x3c')][_0x5bec('0x3d')](_0x2724cf,{'UserId':_0x4ec405['message'][_0x5bec('0x3e')]})[_0x5bec('0x3f')](function(_0xa4d32){logger[_0x5bec('0x30')]('error\x20update\x20queue\x20report');});}}return _0x411306({'code':0xc8,'message':_0x4ec405});}catch(_0x17f7c9){logger[_0x5bec('0x30')](_0x17f7c9[_0x5bec('0x37')]);return _0x5cb97e(_0x4fee8a['error'](0x1f4,_0x17f7c9));}}logger[_0x5bec('0x30')]('message\x20is\x20empty');return _0x5cb97e(_0x4fee8a[_0x5bec('0x30')](0x1f4,_0x5bec('0x40')));});},'RejectMessage':function(_0x133d5c){var _0x218f7c=this;return new Promise(function(_0x54b11a,_0x32869f){if(_0x133d5c[_0x5bec('0x39')]&&_0x133d5c[_0x5bec('0x39')]['id']){try{if(_0x3198e0[_0x5bec('0x3a')][_0x133d5c[_0x5bec('0x39')]['id']]){_0x3198e0[_0x5bec('0x3a')][_0x133d5c[_0x5bec('0x39')]['id']]['busy']=![];_0x3198e0[_0x5bec('0x3a')][_0x133d5c[_0x5bec('0x39')]['id']]['busyQueue']=undefined;}return _0x54b11a({'code':0xc8,'message':_0x133d5c});}catch(_0x273e09){logger[_0x5bec('0x30')](_0x273e09[_0x5bec('0x37')]);return _0x32869f(_0x218f7c[_0x5bec('0x30')](0x1f4,_0x273e09));}}logger[_0x5bec('0x30')](_0x5bec('0x40'));return _0x32869f(_0x218f7c[_0x5bec('0x30')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x101dcb){var _0x579cd2=this;return new Promise(function(_0x3bbeff,_0x208c7b){if(_0x101dcb[_0x5bec('0x15')]&&_0x101dcb[_0x5bec('0x17')]&&_0x101dcb[_0x5bec('0x17')]['id']){try{var _0x1c6401=getId(_0x101dcb[_0x5bec('0x15')],_0x101dcb[_0x5bec('0x16')]?_0x101dcb[_0x5bec('0x16')]['id']:0x0,_0x101dcb[_0x5bec('0x17')]?_0x101dcb['interaction']['id']:0x0);if(_0x3198e0[_0x5bec('0x14')][_0x1c6401]){_0x3198e0['rules'][_0x1c6401]['emit'](_0x5bec('0x41'));}return _0x3bbeff({'code':0xc8,'message':_0x101dcb});}catch(_0x56ed27){logger['error'](_0x56ed27[_0x5bec('0x37')]);return _0x208c7b(_0x579cd2[_0x5bec('0x30')](0x1f4,_0x56ed27));}}logger[_0x5bec('0x30')]('message\x20is\x20empty');return _0x208c7b(_0x579cd2[_0x5bec('0x30')](0x1f4,_0x5bec('0x40')));});},'AgentCapacity':function(_0x46054f){var _0x442144=this;return new Promise(function(_0x578a94,_0x456575){if(_0x3198e0[_0x5bec('0x3a')][_0x5bec('0x42')](_0x46054f['id'])){for(var _0xc8563a in _0x46054f[_0x5bec('0x43')]){if(_0x46054f[_0x5bec('0x43')][_0x5bec('0x42')](_0xc8563a)){if(_0x3198e0['agents'][_0x46054f['id']]['hasOwnProperty'](_0xc8563a+_0x5bec('0x44'))){_0x3198e0['agents'][_0x46054f['id']][_0xc8563a+_0x5bec('0x44')]=parseInt(_0x46054f[_0x5bec('0x43')][_0xc8563a],0xa);}}}_0x3198e0['agents'][_0x46054f['id']][_0x5bec('0x45')]();return _0x578a94({'code':0xc8,'message':_0x3198e0['agents'][_0x46054f['id']]});}else{return _0x456575(_0x442144[_0x5bec('0x30')](0x1f4,_0x5bec('0x46')));}});},'Agents':function(_0x1399e5){return new Promise(function(_0x17e033,_0x2fb334){var _0x340b42=_[_0x5bec('0x47')](_0x3198e0[_0x5bec('0x3a')]);_0x17e033({'count':_0x340b42[_0x5bec('0x1a')],'rows':_0x340b42});});},'ChatQueues':function(_0x2984b0){return new Promise(function(_0x4ca9c3,_0x2bf910){var _0x20fe7b=[];for(var _0x1e1f30 in _0x3198e0['chatQueues']){if(_0x3198e0[_0x5bec('0x48')][_0x5bec('0x42')](_0x1e1f30)){var _0x432a26=_0x3198e0['chatQueues'][_0x1e1f30];var _0x3801e3={'id':_0x432a26['id'],'available':_0x432a26[_0x5bec('0x49')],'loggedIn':_0x432a26[_0x5bec('0x4a')],'name':_0x432a26[_0x5bec('0x4b')],'paused':_0x432a26[_0x5bec('0x4c')],'waiting':_0x432a26['waiting']};_0x20fe7b[_0x5bec('0x21')](_0x3801e3);}}_0x4ca9c3({'count':_0x20fe7b[_0x5bec('0x1a')],'rows':_0x20fe7b});});},'MailQueues':function(_0x2c282b){return new Promise(function(_0x2abc02,_0x4e6c68){var _0x2af409=[];for(var _0x5dda24 in _0x3198e0[_0x5bec('0x4d')]){if(_0x3198e0[_0x5bec('0x4d')][_0x5bec('0x42')](_0x5dda24)){var _0xc5740a=_0x3198e0['mailQueues'][_0x5dda24];var _0x268cc5={'id':_0xc5740a['id'],'available':_0xc5740a[_0x5bec('0x49')],'loggedIn':_0xc5740a[_0x5bec('0x4a')],'name':_0xc5740a[_0x5bec('0x4b')],'paused':_0xc5740a[_0x5bec('0x4c')],'waiting':_0xc5740a[_0x5bec('0x4e')]};_0x2af409[_0x5bec('0x21')](_0x268cc5);}}_0x2abc02({'count':_0x2af409[_0x5bec('0x1a')],'rows':_0x2af409});});},'OpenchannelQueues':function(_0x407828){return new Promise(function(_0x245932,_0xfa751f){var _0x42d4e4=[];for(var _0x65a9e2 in _0x3198e0[_0x5bec('0x4f')]){if(_0x3198e0[_0x5bec('0x4f')]['hasOwnProperty'](_0x65a9e2)){var _0xeceefc=_0x3198e0[_0x5bec('0x4f')][_0x65a9e2];var _0x4e899c={'id':_0xeceefc['id'],'available':_0xeceefc[_0x5bec('0x49')],'loggedIn':_0xeceefc['loggedIn'],'name':_0xeceefc[_0x5bec('0x4b')],'paused':_0xeceefc[_0x5bec('0x4c')],'waiting':_0xeceefc['waiting']};_0x42d4e4['push'](_0x4e899c);}}_0x245932({'count':_0x42d4e4[_0x5bec('0x1a')],'rows':_0x42d4e4});});},'SmsQueues':function(_0xcac51d){return new Promise(function(_0xb6cf85,_0x17a2bb){var _0x2c7a94=[];for(var _0x558d38 in _0x3198e0[_0x5bec('0x50')]){if(_0x3198e0[_0x5bec('0x50')]['hasOwnProperty'](_0x558d38)){var _0xb57a3a=_0x3198e0[_0x5bec('0x50')][_0x558d38];var _0x44a945={'id':_0xb57a3a['id'],'available':_0xb57a3a[_0x5bec('0x49')],'loggedIn':_0xb57a3a['loggedIn'],'name':_0xb57a3a[_0x5bec('0x4b')],'paused':_0xb57a3a['paused'],'waiting':_0xb57a3a[_0x5bec('0x4e')]};_0x2c7a94[_0x5bec('0x21')](_0x44a945);}}_0xb6cf85({'count':_0x2c7a94[_0x5bec('0x1a')],'rows':_0x2c7a94});});},'FaxQueues':function(_0x34e172){return new Promise(function(_0x31b2c6,_0x222526){var _0x21513e=[];for(var _0x340b5c in _0x3198e0[_0x5bec('0x51')]){if(_0x3198e0[_0x5bec('0x51')][_0x5bec('0x42')](_0x340b5c)){var _0x5bbd32=_0x3198e0['faxQueues'][_0x340b5c];var _0x3c305e={'id':_0x5bbd32['id'],'available':_0x5bbd32[_0x5bec('0x49')],'loggedIn':_0x5bbd32[_0x5bec('0x4a')],'name':_0x5bbd32[_0x5bec('0x4b')],'paused':_0x5bbd32[_0x5bec('0x4c')],'waiting':_0x5bbd32[_0x5bec('0x4e')]};_0x21513e[_0x5bec('0x21')](_0x3c305e);}}_0x31b2c6({'count':_0x21513e['length'],'rows':_0x21513e});});},'WhatsappQueues':function(_0x569829){return new Promise(function(_0xc81e8f,_0x9070da){var _0x40151b=[];for(var _0x3f909a in _0x3198e0[_0x5bec('0x52')]){if(_0x3198e0[_0x5bec('0x52')][_0x5bec('0x42')](_0x3f909a)){var _0x31f45b=_0x3198e0[_0x5bec('0x52')][_0x3f909a];var _0x29b7ae={'id':_0x31f45b['id'],'available':_0x31f45b[_0x5bec('0x49')],'loggedIn':_0x31f45b[_0x5bec('0x4a')],'name':_0x31f45b[_0x5bec('0x4b')],'paused':_0x31f45b[_0x5bec('0x4c')],'waiting':_0x31f45b[_0x5bec('0x4e')]};_0x40151b[_0x5bec('0x21')](_0x29b7ae);}}_0xc81e8f({'count':_0x40151b[_0x5bec('0x1a')],'rows':_0x40151b});});},'ChatQueuesWaitingInteractions':function(_0x37f847){return new Promise(function(_0x2201a3,_0x16b0cf){var _0x55e306=_[_0x5bec('0x47')](_0x3198e0['chatQueuesWaitingInteractions']);_0x2201a3({'count':_0x55e306['length'],'rows':_0x55e306});});},'MailQueuesWaitingInteractions':function(_0x432441){return new Promise(function(_0x5c2306,_0x327b61){var _0x5d6af3=_['values'](_0x3198e0[_0x5bec('0x53')]);_0x5c2306({'count':_0x5d6af3[_0x5bec('0x1a')],'rows':_0x5d6af3});});},'OpenchannelQueuesWaitingInteractions':function(_0x5632cc){return new Promise(function(_0xd79c6b,_0x7c1a19){var _0x5fbda4=_[_0x5bec('0x47')](_0x3198e0[_0x5bec('0x54')]);_0xd79c6b({'count':_0x5fbda4[_0x5bec('0x1a')],'rows':_0x5fbda4});});},'SmsQueuesWaitingInteractions':function(_0xb76af2){return new Promise(function(_0x1b9ebf,_0x4f12ff){var _0x4aa04b=_[_0x5bec('0x47')](_0x3198e0[_0x5bec('0x55')]);_0x1b9ebf({'count':_0x4aa04b[_0x5bec('0x1a')],'rows':_0x4aa04b});});},'FaxQueuesWaitingInteractions':function(_0x4681e3){return new Promise(function(_0x5d8058,_0xf03100){var _0x5e35a6=_[_0x5bec('0x47')](_0x3198e0[_0x5bec('0x56')]);_0x5d8058({'count':_0x5e35a6[_0x5bec('0x1a')],'rows':_0x5e35a6});});},'WhatsappQueuesWaitingInteractions':function(_0x3e0361){return new Promise(function(_0xa7af97,_0x3be924){var _0x38be2d=_[_0x5bec('0x47')](_0x3198e0['whatsappQueuesWaitingInteractions']);_0xa7af97({'count':_0x38be2d[_0x5bec('0x1a')],'rows':_0x38be2d});});}};var _0xe5f9e5=jayson[_0x5bec('0x57')](_0x259588)[_0x5bec('0x58')]();_0xe5f9e5['on'](_0x5bec('0x30'),function(_0x5b81fc){logger[_0x5bec('0x30')](JSON[_0x5bec('0x33')](_0x5b81fc));return _0x43fd2a(_0x5b81fc);});_0xe5f9e5['listen'](0x232c,_0x5bec('0x59'),function(){console['log'](_0x5bec('0x5a'),0x232c);return _0x24dcd6(_0x5bec('0x5b')+0x232c);});});}; \ No newline at end of file +var _0xfd28=['existsSync','app','toLowerCase','autoreply','appdata','split','channel','push','slice','join','dialogflow','dialogflowv2','amazonlex','%s:%s:%s','./interval','condition','intervals','consequence','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','.js','stringify','matchPath','emit','complete','error','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','mailQueues','waiting','openchannelQueues','smsQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','path','bluebird','../../../config/environment','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','IntervalId','map','Intervals','interval','isNil','listen','rules','message','interaction','isArray','applications','length'];(function(_0x2e2946,_0x103f24){var _0x34aa1c=function(_0x41ca30){while(--_0x41ca30){_0x2e2946['push'](_0x2e2946['shift']());}};_0x34aa1c(++_0x103f24);}(_0xfd28,0x148));var _0x8fd2=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xfd28[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require('lodash');var util=require(_0x8fd2('0x0'));var path=require(_0x8fd2('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x8fd2('0x2'));var uuid=require('uuid');var config=require(_0x8fd2('0x3'));var logger=require(_0x8fd2('0x4'))(_0x8fd2('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x8fd2('0x6')),'chatQueueReport':require(_0x8fd2('0x7')),'smsQueueReport':require(_0x8fd2('0x8')),'faxQueueReport':require(_0x8fd2('0x9')),'whatsappQueueReport':require(_0x8fd2('0xa'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x53d938,_0x10fccf,_0x466c3d){return util[_0x8fd2('0xb')]('%s.%s.%s',_0x53d938,_0x10fccf||0x0,_0x466c3d||0x0);}function getIntervals(_0x13cc69,_0x49ca87){var _0x2842f3=[];if(!_['isNil'](_0x49ca87[_0x8fd2('0xc')])&&!_['isNil'](_0x13cc69[_0x49ca87[_0x8fd2('0xc')]])&&!_['isNil'](_0x13cc69[_0x49ca87[_0x8fd2('0xc')]]['Intervals'])){_0x2842f3=_[_0x8fd2('0xd')](_0x13cc69[_0x49ca87[_0x8fd2('0xc')]][_0x8fd2('0xe')],_0x8fd2('0xf'));}else if(!_[_0x8fd2('0x10')](_0x49ca87[_0x8fd2('0xf')])){_0x2842f3=[_0x49ca87[_0x8fd2('0xf')]];}return _0x2842f3;}exports[_0x8fd2('0x11')]=function(_0x2b152c){_0x2b152c[_0x8fd2('0x12')]={};return new BPromise(function(_0x118329,_0x6b8ef){var _0x725d57={'Start':function(_0x40712c){var _0xa65b4=this;return new Promise(function(_0x596639,_0x20daca){if(_0x40712c){try{var _0x5ef478=[];var _0x4f0b17=getId(_0x40712c['channel'],_0x40712c[_0x8fd2('0x13')]?_0x40712c[_0x8fd2('0x13')]['id']:0x0,_0x40712c[_0x8fd2('0x14')]?_0x40712c[_0x8fd2('0x14')]['id']:0x0);if(_0x40712c['applications']&&_[_0x8fd2('0x15')](_0x40712c[_0x8fd2('0x16')])&&_0x40712c[_0x8fd2('0x16')][_0x8fd2('0x17')]){for(var _0x14641a=0x0;_0x14641a<_0x40712c['applications']['length'];_0x14641a+=0x1){var _0x3a0939=_0x40712c['applications'][_0x14641a];if(fs[_0x8fd2('0x18')](path['join'](__dirname,_0x8fd2('0x16'),_0x3a0939[_0x8fd2('0x19')]+'.js'))){var _0x122b60=[];switch(_0x3a0939['app'][_0x8fd2('0x1a')]()){case _0x8fd2('0x1b'):var _0x4e0dc4=_0x3a0939[_0x8fd2('0x1c')][_0x8fd2('0x1d')](',');if(_0x40712c[_0x8fd2('0x1e')]==='mail'){_0x122b60[_0x8fd2('0x1f')](_0x4e0dc4[0x0]);_0x122b60[_0x8fd2('0x1f')](_0x4e0dc4[0x1]);_0x122b60[_0x8fd2('0x1f')](_0x4e0dc4[_0x8fd2('0x20')](0x2,_0x4e0dc4[_0x8fd2('0x17')])[_0x8fd2('0x21')](','));}else{_0x122b60[_0x8fd2('0x1f')](_0x4e0dc4[0x0]);_0x122b60[_0x8fd2('0x1f')](_0x4e0dc4[_0x8fd2('0x20')](0x1,_0x4e0dc4[_0x8fd2('0x17')])[_0x8fd2('0x21')](','));}break;case _0x8fd2('0x22'):var _0x3f16a3=_0x3a0939['appdata']['split'](',');_0x122b60[_0x8fd2('0x1f')](_0x3f16a3[0x0]);_0x122b60[_0x8fd2('0x1f')](_0x3f16a3[0x1]);_0x122b60[_0x8fd2('0x1f')](_0x3f16a3['slice'](0x2,_0x3f16a3[_0x8fd2('0x17')])[_0x8fd2('0x21')](','));break;case _0x8fd2('0x23'):var _0x960869=_0x3a0939[_0x8fd2('0x1c')][_0x8fd2('0x1d')](',');_0x122b60[_0x8fd2('0x1f')](_0x960869[0x0]);_0x122b60['push'](_0x960869[0x1]);_0x122b60[_0x8fd2('0x1f')](_0x960869[0x2]);_0x122b60[_0x8fd2('0x1f')](_0x960869[0x3]);_0x122b60[_0x8fd2('0x1f')](_0x960869[_0x8fd2('0x20')](0x4,_0x960869[_0x8fd2('0x17')])[_0x8fd2('0x21')](','));break;case _0x8fd2('0x24'):var _0x4f6b7b=_0x3a0939['appdata']['split'](',');_0x122b60[_0x8fd2('0x1f')](_0x4f6b7b[0x0]);_0x122b60[_0x8fd2('0x1f')](_0x4f6b7b[0x1]);_0x122b60[_0x8fd2('0x1f')](_0x4f6b7b[0x2]);_0x122b60[_0x8fd2('0x1f')](_0x4f6b7b[0x3]);_0x122b60['push'](_0x4f6b7b['slice'](0x4,_0x4f6b7b[_0x8fd2('0x17')])[_0x8fd2('0x21')](','));break;case _0x8fd2('0x13'):_0x122b60[_0x8fd2('0x1f')](_0x3a0939[_0x8fd2('0x1c')]);break;case'tag':_0x122b60[_0x8fd2('0x1f')](_0x3a0939['TagId']);_0x122b60[_0x8fd2('0x1f')](_0x3a0939['appdata']);break;default:_0x122b60=_[_0x8fd2('0x10')](_0x3a0939['appdata'])?[]:_0x3a0939[_0x8fd2('0x1c')][_0x8fd2('0x1d')](',');}var _0x39092e={'id':util['format'](_0x8fd2('0x25'),_0x4f0b17,_0x3a0939['id'],_0x3a0939['app']),'condition':require(_0x8fd2('0x26'))[_0x8fd2('0x27')](_0x4f0b17,getIntervals(_0x2b152c[_0x8fd2('0x28')],_0x3a0939),_0x2b152c),'consequence':require('./applications/'+_0x3a0939[_0x8fd2('0x19')])[_0x8fd2('0x29')](_0x4f0b17,_0x122b60,_0x2b152c,_0x40712c),'p':_0x3a0939[_0x8fd2('0x2a')]||0x0};logger['info'](_0x8fd2('0x2b'),_0x39092e['id'],_0x8fd2('0x2c'),getIntervals(_0x2b152c[_0x8fd2('0x28')],_0x3a0939)['join'](_0x8fd2('0x2d')));_0x5ef478[_0x8fd2('0x1f')](_0x39092e);}else{logger['error'](_0x8fd2('0x2e'),path[_0x8fd2('0x21')](__dirname,_0x8fd2('0x16'),_0x3a0939[_0x8fd2('0x19')]+_0x8fd2('0x2f')));}}_0x2b152c[_0x8fd2('0x12')][_0x4f0b17]=new RuleEngine(_0x5ef478);_0x2b152c[_0x8fd2('0x12')][_0x4f0b17]['execute'](_0x40712c,function(_0x7c60d){logger['info']('Applications\x20executed',JSON[_0x8fd2('0x30')](_0x7c60d[_0x8fd2('0x31')]));if(_0x2b152c[_0x8fd2('0x12')][_0x4f0b17]){_0x2b152c[_0x8fd2('0x12')][_0x4f0b17][_0x8fd2('0x32')](_0x8fd2('0x33'));}});return _0x596639({'code':0xc8,'message':_0x40712c});}else{logger['info']('No\x20applications\x20to\x20execute');return _0x596639({'code':0xc8,'message':_0x40712c});}}catch(_0x2df1da){logger['error'](_0x2df1da['stack']);return _0x20daca(_0xa65b4[_0x8fd2('0x34')](0x1f4,_0x2df1da));}}return _0x20daca(_0x8fd2('0x35'));});},'AcceptMessage':function(_0x3648e0){var _0x28f927=this;return new Promise(function(_0x56b96d,_0x39cd8e){if(_0x3648e0[_0x8fd2('0x36')]&&_0x3648e0[_0x8fd2('0x36')]['id']){if(_0x2b152c[_0x8fd2('0x37')][_0x3648e0[_0x8fd2('0x36')]['id']]){_0x2b152c[_0x8fd2('0x37')][_0x3648e0[_0x8fd2('0x36')]['id']]['busy']=![];_0x2b152c[_0x8fd2('0x37')][_0x3648e0[_0x8fd2('0x36')]['id']][_0x8fd2('0x38')]=undefined;}}if(_0x3648e0[_0x8fd2('0x13')]&&_0x3648e0[_0x8fd2('0x13')]['id']){try{var _0x12b014=getId(_0x3648e0[_0x8fd2('0x1e')],_0x3648e0['message']?_0x3648e0[_0x8fd2('0x13')]['id']:0x0,_0x3648e0[_0x8fd2('0x14')]?_0x3648e0[_0x8fd2('0x14')]['id']:0x0);if(_0x2b152c[_0x8fd2('0x12')][_0x12b014]){_0x2b152c[_0x8fd2('0x12')][_0x12b014][_0x8fd2('0x32')](_0x8fd2('0x39'));if(rpc[_0x3648e0['channel']+_0x8fd2('0x3a')]){rpc[_0x3648e0['channel']+_0x8fd2('0x3a')]['update'](_0x12b014,{'UserId':_0x3648e0[_0x8fd2('0x13')][_0x8fd2('0x3b')]})[_0x8fd2('0x3c')](function(_0x5c0632){logger[_0x8fd2('0x34')](_0x8fd2('0x3d'));});}}return _0x56b96d({'code':0xc8,'message':_0x3648e0});}catch(_0xd4f904){logger['error'](_0xd4f904[_0x8fd2('0x3e')]);return _0x39cd8e(_0x28f927['error'](0x1f4,_0xd4f904));}}logger[_0x8fd2('0x34')](_0x8fd2('0x3f'));return _0x39cd8e(_0x28f927[_0x8fd2('0x34')](0x1f4,_0x8fd2('0x3f')));});},'RejectMessage':function(_0xc62e9e){var _0x7984c9=this;return new Promise(function(_0x154b61,_0x34ffed){if(_0xc62e9e[_0x8fd2('0x36')]&&_0xc62e9e[_0x8fd2('0x36')]['id']){try{if(_0x2b152c[_0x8fd2('0x37')][_0xc62e9e[_0x8fd2('0x36')]['id']]){_0x2b152c[_0x8fd2('0x37')][_0xc62e9e[_0x8fd2('0x36')]['id']][_0x8fd2('0x40')]=![];_0x2b152c[_0x8fd2('0x37')][_0xc62e9e[_0x8fd2('0x36')]['id']][_0x8fd2('0x38')]=undefined;}return _0x154b61({'code':0xc8,'message':_0xc62e9e});}catch(_0x2fdbe5){logger['error'](_0x2fdbe5['stack']);return _0x34ffed(_0x7984c9[_0x8fd2('0x34')](0x1f4,_0x2fdbe5));}}logger[_0x8fd2('0x34')](_0x8fd2('0x3f'));return _0x34ffed(_0x7984c9['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x177f04){var _0x5603e9=this;return new Promise(function(_0x2f61a5,_0x1295c4){if(_0x177f04[_0x8fd2('0x1e')]&&_0x177f04['interaction']&&_0x177f04[_0x8fd2('0x14')]['id']){try{var _0x1ec30e=getId(_0x177f04['channel'],_0x177f04[_0x8fd2('0x13')]?_0x177f04[_0x8fd2('0x13')]['id']:0x0,_0x177f04[_0x8fd2('0x14')]?_0x177f04['interaction']['id']:0x0);if(_0x2b152c[_0x8fd2('0x12')][_0x1ec30e]){_0x2b152c[_0x8fd2('0x12')][_0x1ec30e][_0x8fd2('0x32')](_0x8fd2('0x39'));}return _0x2f61a5({'code':0xc8,'message':_0x177f04});}catch(_0x3101ac){logger[_0x8fd2('0x34')](_0x3101ac['stack']);return _0x1295c4(_0x5603e9['error'](0x1f4,_0x3101ac));}}logger[_0x8fd2('0x34')](_0x8fd2('0x3f'));return _0x1295c4(_0x5603e9['error'](0x1f4,_0x8fd2('0x3f')));});},'AgentCapacity':function(_0x4a176b){var _0x55d862=this;return new Promise(function(_0x2ef7e6,_0x1eca98){if(_0x2b152c[_0x8fd2('0x37')][_0x8fd2('0x41')](_0x4a176b['id'])){for(var _0x353450 in _0x4a176b[_0x8fd2('0x42')]){if(_0x4a176b['capacity'][_0x8fd2('0x41')](_0x353450)){if(_0x2b152c[_0x8fd2('0x37')][_0x4a176b['id']][_0x8fd2('0x41')](_0x353450+_0x8fd2('0x43'))){_0x2b152c[_0x8fd2('0x37')][_0x4a176b['id']][_0x353450+'CurrentCapacity']=parseInt(_0x4a176b['capacity'][_0x353450],0xa);}}}_0x2b152c['agents'][_0x4a176b['id']]['updateRealtime']();return _0x2ef7e6({'code':0xc8,'message':_0x2b152c['agents'][_0x4a176b['id']]});}else{return _0x1eca98(_0x55d862[_0x8fd2('0x34')](0x1f4,_0x8fd2('0x44')));}});},'Agents':function(_0x18ee30){return new Promise(function(_0x2988d0,_0x21696c){var _0x25abdc=_[_0x8fd2('0x45')](_0x2b152c['agents']);_0x2988d0({'count':_0x25abdc[_0x8fd2('0x17')],'rows':_0x25abdc});});},'ChatQueues':function(_0x5f0cfa){return new Promise(function(_0x351cfe,_0xdd46b1){var _0x478aad=[];for(var _0x52006b in _0x2b152c[_0x8fd2('0x46')]){if(_0x2b152c[_0x8fd2('0x46')][_0x8fd2('0x41')](_0x52006b)){var _0x30a952=_0x2b152c[_0x8fd2('0x46')][_0x52006b];var _0x5476ca={'id':_0x30a952['id'],'available':_0x30a952[_0x8fd2('0x47')],'loggedIn':_0x30a952[_0x8fd2('0x48')],'name':_0x30a952[_0x8fd2('0x49')],'paused':_0x30a952[_0x8fd2('0x4a')],'waiting':_0x30a952['waiting']};_0x478aad[_0x8fd2('0x1f')](_0x5476ca);}}_0x351cfe({'count':_0x478aad[_0x8fd2('0x17')],'rows':_0x478aad});});},'MailQueues':function(_0x3ca4b1){return new Promise(function(_0x23c608,_0x5df526){var _0x4e2b22=[];for(var _0x5e142f in _0x2b152c[_0x8fd2('0x4b')]){if(_0x2b152c[_0x8fd2('0x4b')][_0x8fd2('0x41')](_0x5e142f)){var _0x38fc47=_0x2b152c[_0x8fd2('0x4b')][_0x5e142f];var _0x47ede0={'id':_0x38fc47['id'],'available':_0x38fc47[_0x8fd2('0x47')],'loggedIn':_0x38fc47[_0x8fd2('0x48')],'name':_0x38fc47['name'],'paused':_0x38fc47[_0x8fd2('0x4a')],'waiting':_0x38fc47[_0x8fd2('0x4c')]};_0x4e2b22[_0x8fd2('0x1f')](_0x47ede0);}}_0x23c608({'count':_0x4e2b22[_0x8fd2('0x17')],'rows':_0x4e2b22});});},'OpenchannelQueues':function(_0x305d83){return new Promise(function(_0x5547c7,_0x428034){var _0x3408ff=[];for(var _0x21f1a7 in _0x2b152c[_0x8fd2('0x4d')]){if(_0x2b152c[_0x8fd2('0x4d')][_0x8fd2('0x41')](_0x21f1a7)){var _0x172933=_0x2b152c[_0x8fd2('0x4d')][_0x21f1a7];var _0x1787e4={'id':_0x172933['id'],'available':_0x172933[_0x8fd2('0x47')],'loggedIn':_0x172933[_0x8fd2('0x48')],'name':_0x172933[_0x8fd2('0x49')],'paused':_0x172933[_0x8fd2('0x4a')],'waiting':_0x172933['waiting']};_0x3408ff[_0x8fd2('0x1f')](_0x1787e4);}}_0x5547c7({'count':_0x3408ff[_0x8fd2('0x17')],'rows':_0x3408ff});});},'SmsQueues':function(_0x4b043d){return new Promise(function(_0x5c497e,_0x553fa1){var _0x2bd1d0=[];for(var _0x34a06a in _0x2b152c[_0x8fd2('0x4e')]){if(_0x2b152c[_0x8fd2('0x4e')][_0x8fd2('0x41')](_0x34a06a)){var _0x2eaa0c=_0x2b152c['smsQueues'][_0x34a06a];var _0x349e86={'id':_0x2eaa0c['id'],'available':_0x2eaa0c[_0x8fd2('0x47')],'loggedIn':_0x2eaa0c['loggedIn'],'name':_0x2eaa0c[_0x8fd2('0x49')],'paused':_0x2eaa0c['paused'],'waiting':_0x2eaa0c[_0x8fd2('0x4c')]};_0x2bd1d0[_0x8fd2('0x1f')](_0x349e86);}}_0x5c497e({'count':_0x2bd1d0[_0x8fd2('0x17')],'rows':_0x2bd1d0});});},'FaxQueues':function(_0x31e96f){return new Promise(function(_0x3df1bd,_0x4aaa16){var _0x1a1b40=[];for(var _0xfb0041 in _0x2b152c['faxQueues']){if(_0x2b152c[_0x8fd2('0x4f')]['hasOwnProperty'](_0xfb0041)){var _0x50c6a6=_0x2b152c[_0x8fd2('0x4f')][_0xfb0041];var _0x1d36d2={'id':_0x50c6a6['id'],'available':_0x50c6a6['available'],'loggedIn':_0x50c6a6[_0x8fd2('0x48')],'name':_0x50c6a6[_0x8fd2('0x49')],'paused':_0x50c6a6[_0x8fd2('0x4a')],'waiting':_0x50c6a6['waiting']};_0x1a1b40[_0x8fd2('0x1f')](_0x1d36d2);}}_0x3df1bd({'count':_0x1a1b40[_0x8fd2('0x17')],'rows':_0x1a1b40});});},'WhatsappQueues':function(_0x2d4746){return new Promise(function(_0x59f39b,_0x234800){var _0x31cb0e=[];for(var _0x33603c in _0x2b152c['whatsappQueues']){if(_0x2b152c['whatsappQueues'][_0x8fd2('0x41')](_0x33603c)){var _0xf718ec=_0x2b152c['whatsappQueues'][_0x33603c];var _0x500678={'id':_0xf718ec['id'],'available':_0xf718ec['available'],'loggedIn':_0xf718ec['loggedIn'],'name':_0xf718ec['name'],'paused':_0xf718ec[_0x8fd2('0x4a')],'waiting':_0xf718ec[_0x8fd2('0x4c')]};_0x31cb0e[_0x8fd2('0x1f')](_0x500678);}}_0x59f39b({'count':_0x31cb0e[_0x8fd2('0x17')],'rows':_0x31cb0e});});},'ChatQueuesWaitingInteractions':function(_0x1fa13a){return new Promise(function(_0x5a1c27,_0x2fba70){var _0x181634=_[_0x8fd2('0x45')](_0x2b152c['chatQueuesWaitingInteractions']);_0x5a1c27({'count':_0x181634[_0x8fd2('0x17')],'rows':_0x181634});});},'MailQueuesWaitingInteractions':function(_0x3aaf78){return new Promise(function(_0x5f163a,_0x36631b){var _0x33d05e=_[_0x8fd2('0x45')](_0x2b152c[_0x8fd2('0x50')]);_0x5f163a({'count':_0x33d05e[_0x8fd2('0x17')],'rows':_0x33d05e});});},'OpenchannelQueuesWaitingInteractions':function(_0x2fb611){return new Promise(function(_0xbeb55a,_0x5f5487){var _0x26f8b9=_[_0x8fd2('0x45')](_0x2b152c[_0x8fd2('0x51')]);_0xbeb55a({'count':_0x26f8b9[_0x8fd2('0x17')],'rows':_0x26f8b9});});},'SmsQueuesWaitingInteractions':function(_0x15747d){return new Promise(function(_0x3a83d8,_0x3e8080){var _0x5883c3=_[_0x8fd2('0x45')](_0x2b152c[_0x8fd2('0x52')]);_0x3a83d8({'count':_0x5883c3['length'],'rows':_0x5883c3});});},'FaxQueuesWaitingInteractions':function(_0x2d844e){return new Promise(function(_0x3deb1b,_0x3f8baf){var _0x131ee8=_[_0x8fd2('0x45')](_0x2b152c[_0x8fd2('0x53')]);_0x3deb1b({'count':_0x131ee8[_0x8fd2('0x17')],'rows':_0x131ee8});});},'WhatsappQueuesWaitingInteractions':function(_0x2a0c4){return new Promise(function(_0x52de20,_0x9c765d){var _0x5891bb=_['values'](_0x2b152c['whatsappQueuesWaitingInteractions']);_0x52de20({'count':_0x5891bb[_0x8fd2('0x17')],'rows':_0x5891bb});});}};var _0x58b0fa=jayson[_0x8fd2('0x54')](_0x725d57)['http']();_0x58b0fa['on']('error',function(_0x1d6bdb){logger[_0x8fd2('0x34')](JSON['stringify'](_0x1d6bdb));return _0x6b8ef(_0x1d6bdb);});_0x58b0fa[_0x8fd2('0x11')](0x232c,_0x8fd2('0x55'),function(){console[_0x8fd2('0x56')](_0x8fd2('0x57'),0x232c);return _0x118329('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 14da486..f508be7 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 _0xce34=['http','then','error','result','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','message','indexOf','true','[%s][INTERVAL]\x20%s\x20%s','join','when','log','util','bluebird','jayson/promise','client'];(function(_0x16c4ce,_0xecc974){var _0x1b70ff=function(_0x20060a){while(--_0x20060a){_0x16c4ce['push'](_0x16c4ce['shift']());}};_0x1b70ff(++_0xecc974);}(_0xce34,0x18c));var _0x4ce3=function(_0x479033,_0x577e7b){_0x479033=_0x479033-0x0;var _0x2d3270=_0xce34[_0x479033];return _0x2d3270;};'use strict';var util=require(_0x4ce3('0x0'));var BPromise=require(_0x4ce3('0x1'));var jayson=require(_0x4ce3('0x2'));var _=require('lodash');var logger=require('../../../config/logger')('routing');var client=jayson[_0x4ce3('0x3')][_0x4ce3('0x4')]({'port':0x232a});function request(_0x247b55,_0x3239da){return new BPromise(function(_0x127f0d,_0x50baa7){return client['request'](_0x247b55,_0x3239da)[_0x4ce3('0x5')](function(_0x3ee2a6){if(_0x3ee2a6[_0x4ce3('0x6')]){return _0x50baa7(_0x3ee2a6['error']['message']);}else{return _0x127f0d(_0x3ee2a6[_0x4ce3('0x7')]);}})[_0x4ce3('0x8')](function(_0x14fc2e){return _0x50baa7(_0x14fc2e);});});}exports['condition']=function(_0x3ea4b8,_0x8a6845,_0x5c7c41){return function(_0x369576){if(_0x5c7c41[_0x4ce3('0x9')]&&!_0x5c7c41[_0x4ce3('0x9')][_0x3ea4b8]){logger[_0x4ce3('0xa')](_0x4ce3('0xb'),_0x3ea4b8);return _0x369576[_0x4ce3('0xc')]();}var _0x1b78d1=[];for(var _0x547958=0x0;_0x547958<_0x8a6845[_0x4ce3('0xd')];_0x547958+=0x1){_0x1b78d1[_0x4ce3('0xe')](request(_0x4ce3('0xf'),{'command':util[_0x4ce3('0x10')](_0x4ce3('0x11'),_0x8a6845[_0x547958])})['then'](function(_0x2e1795){return _0x2e1795&&_0x2e1795[_0x4ce3('0x12')]&&_0x2e1795[_0x4ce3('0x12')][_0x4ce3('0x13')](_0x4ce3('0x14'))>=0x0?!![]:![];})[_0x4ce3('0x8')](function(_0x1bf255){logger['error']('[%s][INTERVAL]\x20%s',_0x3ea4b8,_0x8a6845[_0x547958]);}));}BPromise['all'](_0x1b78d1)['then'](function(_0x17288d){var _0x1028c9=_['some'](_0x17288d);logger[_0x4ce3('0xa')](_0x4ce3('0x15'),_0x3ea4b8,_0x8a6845[_0x4ce3('0x16')]('\x20|\x20'),_0x1028c9);_0x369576[_0x4ce3('0x17')](_0x1028c9);})[_0x4ce3('0x8')](function(_0x57205d){console[_0x4ce3('0x18')](_0x57205d);logger[_0x4ce3('0x6')]('[%s][INTERVAL]\x20%s\x20%s',_0x3ea4b8,_0x8a6845['join']('\x20|\x20'),_0x57205d['stack']);_0x369576[_0x4ce3('0xc')]();});};}; \ No newline at end of file +var _0x3d79=['indexOf','true','[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','util','bluebird','lodash','../../../config/logger','routing','http','request','then','error','result','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','format','iftime\x20%s','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d79,0x121));var _0x93d7=function(_0x1b9af1,_0x1fdb0c){_0x1b9af1=_0x1b9af1-0x0;var _0x3acd26=_0x3d79[_0x1b9af1];return _0x3acd26;};'use strict';var util=require(_0x93d7('0x0'));var BPromise=require(_0x93d7('0x1'));var jayson=require('jayson/promise');var _=require(_0x93d7('0x2'));var logger=require(_0x93d7('0x3'))(_0x93d7('0x4'));var client=jayson['client'][_0x93d7('0x5')]({'port':0x232a});function request(_0x36359b,_0xad9bba){return new BPromise(function(_0x486ab6,_0x31a6e5){return client[_0x93d7('0x6')](_0x36359b,_0xad9bba)[_0x93d7('0x7')](function(_0x2c35ce){if(_0x2c35ce['error']){return _0x31a6e5(_0x2c35ce[_0x93d7('0x8')]['message']);}else{return _0x486ab6(_0x2c35ce[_0x93d7('0x9')]);}})['catch'](function(_0x4463e5){return _0x31a6e5(_0x4463e5);});});}exports[_0x93d7('0xa')]=function(_0x30cd47,_0x2bb0b7,_0x3edc79){return function(_0x5a8664){if(_0x3edc79[_0x93d7('0xb')]&&!_0x3edc79['rules'][_0x30cd47]){logger['info'](_0x93d7('0xc'),_0x30cd47);return _0x5a8664[_0x93d7('0xd')]();}var _0x2141f5=[];for(var _0x5dcc63=0x0;_0x5dcc63<_0x2bb0b7[_0x93d7('0xe')];_0x5dcc63+=0x1){_0x2141f5['push'](request(_0x93d7('0xf'),{'command':util[_0x93d7('0x10')](_0x93d7('0x11'),_0x2bb0b7[_0x5dcc63])})[_0x93d7('0x7')](function(_0x4f88c9){return _0x4f88c9&&_0x4f88c9[_0x93d7('0x12')]&&_0x4f88c9['message'][_0x93d7('0x13')](_0x93d7('0x14'))>=0x0?!![]:![];})['catch'](function(_0x1e9612){logger[_0x93d7('0x8')](_0x93d7('0x15'),_0x30cd47,_0x2bb0b7[_0x5dcc63]);}));}BPromise[_0x93d7('0x16')](_0x2141f5)['then'](function(_0xdffc25){var _0x329bf5=_[_0x93d7('0x17')](_0xdffc25);logger[_0x93d7('0x18')](_0x93d7('0x19'),_0x30cd47,_0x2bb0b7[_0x93d7('0x1a')](_0x93d7('0x1b')),_0x329bf5);_0x5a8664['when'](_0x329bf5);})['catch'](function(_0x3b49e7){console['log'](_0x3b49e7);logger[_0x93d7('0x8')](_0x93d7('0x19'),_0x30cd47,_0x2bb0b7[_0x93d7('0x1a')](_0x93d7('0x1b')),_0x3b49e7['stack']);_0x5a8664['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index e116c01..426bb19 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 _0xbca2=['blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][blindtransfer]','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','clone','calleridname','agentconnectAt','agententerreason','secondtransfererlinkedid','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','indexOf','splice','agent','complete','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','calleridnum','connectedlinenum','lastevent','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwTimeout','request','CreateVoiceAgentReport','agentcalled','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','now','timeout','reason','holdtime','ringtime','talktime','push','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','[%s][agents][agentcomplete]'];(function(_0x3c269c,_0x20f01f){var _0x321afb=function(_0x5189d8){while(--_0x5189d8){_0x3c269c['push'](_0x3c269c['shift']());}};_0x321afb(++_0x20f01f);}(_0xbca2,0x184));var _0x2bca=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbca2[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x2bca('0x0'));var util=require('util');var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x314bf0,_0x30bf3c){utils[_0x2bca('0x1')](util[_0x2bca('0x2')](_0x2bca('0x3'),_0x314bf0[_0x2bca('0x4')],_0x314bf0[_0x2bca('0x5')],_0x314bf0['queue'],_0x314bf0[_0x2bca('0x6')],_0x314bf0['interface'],_0x314bf0[_0x2bca('0x7')],_0x314bf0[_0x2bca('0x8')],_0x314bf0[_0x2bca('0x9')]));if(_0x314bf0[_0x2bca('0xa')]){utils[_0x2bca('0xb')](_0x314bf0[_0x2bca('0xa')])[_0x2bca('0xc')](function(_0x2a83fa){if(_0x2a83fa){_0x314bf0[_0x2bca('0xd')]=_0x2a83fa[_0x2bca('0xd')];_0x314bf0[_0x2bca('0xe')]=_0x314bf0[_0x2bca('0xf')]?_0x2a83fa[_0x2bca('0x10')]:![];_0x314bf0['acwtime']=_0x314bf0[_0x2bca('0xe')]?_0x2a83fa[_0x2bca('0x11')]:0x0;}utils[_0x2bca('0x12')](_0x2bca('0x13'),_0x314bf0);});}else{utils['request']('CreateVoiceAgentReport',_0x314bf0);}if(_0x30bf3c){delete transfers[_0x314bf0['uniqueid']];}else{delete agents[_0x314bf0['destuniqueid']];}}exports[_0x2bca('0x14')]=function(_0x2b2023){try{utils['debug'](util['format'](_0x2bca('0x15'),_0x2b2023[_0x2bca('0x4')]),_0x2b2023);agents[_0x2b2023[_0x2bca('0x16')]]=_0x2b2023;agents[_0x2b2023[_0x2bca('0x16')]][_0x2bca('0x17')]=utils['now']();agents[_0x2b2023[_0x2bca('0x16')]]['lastevent']=_0x2bca('0x18');agents[_0x2b2023[_0x2bca('0x16')]][_0x2bca('0x8')]=null;agents[_0x2b2023[_0x2bca('0x16')]][_0x2bca('0x19')]=null;utils[_0x2bca('0x1')](util[_0x2bca('0x2')](_0x2bca('0x1a'),_0x2b2023[_0x2bca('0x4')],agents[_0x2b2023[_0x2bca('0x16')]][_0x2bca('0x6')],_0x2b2023[_0x2bca('0x16')]));}catch(_0x2ef71a){utils[_0x2bca('0x1b')](util[_0x2bca('0x2')](_0x2bca('0x15'),_0x2b2023[_0x2bca('0x4')]),_0x2ef71a);}};exports[_0x2bca('0x1c')]=function(_0x4c094a){try{if(!_['isNil'](agents[_0x4c094a[_0x2bca('0x16')]])){utils[_0x2bca('0x1d')](util[_0x2bca('0x2')](_0x2bca('0x1e'),_0x4c094a[_0x2bca('0x4')]),_0x4c094a);utils[_0x2bca('0x1')](util[_0x2bca('0x2')](_0x2bca('0x1f'),_0x4c094a['uniqueid'],agents[_0x4c094a[_0x2bca('0x16')]]['membername'],_0x4c094a[_0x2bca('0x16')]));agents[_0x4c094a[_0x2bca('0x16')]]['agentringnoanswer']=!![];agents[_0x4c094a[_0x2bca('0x16')]]['agentringnoanswerAt']=utils[_0x2bca('0x20')]();agents[_0x4c094a[_0x2bca('0x16')]][_0x2bca('0x9')]=_0x2bca('0x21');agents[_0x4c094a[_0x2bca('0x16')]][_0x2bca('0x22')]=_0x2bca('0x21');agents[_0x4c094a['destuniqueid']][_0x2bca('0x23')]=_0x4c094a[_0x2bca('0x24')]?parseInt(_0x4c094a[_0x2bca('0x24')])/0x3e8:0x0;agents[_0x4c094a[_0x2bca('0x16')]][_0x2bca('0x25')]=0x0;unanswered[_0x2bca('0x26')](_0x4c094a[_0x2bca('0x16')]);}}catch(_0x876ef6){utils[_0x2bca('0x1b')](util['format'](_0x2bca('0x1e'),_0x4c094a[_0x2bca('0x4')]),_0x876ef6);}};exports['queuecallerabandon']=function(_0x40b09f){try{_[_0x2bca('0x27')](agents,function(_0x31f8bf,_0x52cdf5){if(_0x31f8bf['uniqueid']==_0x40b09f[_0x2bca('0x4')]&&!_[_0x2bca('0x28')](unanswered,_0x31f8bf['destuniqueid'])){utils['debug'](util[_0x2bca('0x2')](_0x2bca('0x29'),_0x40b09f[_0x2bca('0x4')]),_0x40b09f);utils[_0x2bca('0x1')](util[_0x2bca('0x2')](_0x2bca('0x2a'),_0x40b09f[_0x2bca('0x4')],_0x31f8bf[_0x2bca('0x6')],_0x31f8bf[_0x2bca('0x16')]));_0x31f8bf['agentringnoanswer']=!![];_0x31f8bf[_0x2bca('0x2b')]=utils['now']();_0x31f8bf[_0x2bca('0x9')]='abandoned';_0x31f8bf['reason']=_0x2bca('0x2c');_0x31f8bf[_0x2bca('0x23')]=_0x40b09f[_0x2bca('0x23')];_0x31f8bf[_0x2bca('0x25')]=0x0;writeDB(_0x31f8bf);}});}catch(_0x2262fe){utils[_0x2bca('0x1b')](util['format'](_0x2bca('0x29'),_0x40b09f[_0x2bca('0x4')]),_0x2262fe);}};exports[_0x2bca('0x2d')]=function(_0x30ced6){try{if(agents[_0x30ced6[_0x2bca('0x16')]]){utils[_0x2bca('0x1d')](util[_0x2bca('0x2')](_0x2bca('0x2e'),_0x30ced6[_0x2bca('0x4')]),_0x30ced6);utils[_0x2bca('0x1')](util[_0x2bca('0x2')](_0x2bca('0x2f'),_0x30ced6[_0x2bca('0x4')],agents[_0x30ced6[_0x2bca('0x16')]]['membername'],_0x30ced6[_0x2bca('0x16')]));agents[_0x30ced6['destuniqueid']]['agentconnectAt']=utils[_0x2bca('0x20')]();agents[_0x30ced6['destuniqueid']][_0x2bca('0x8')]=_0x30ced6[_0x2bca('0x8')];agents[_0x30ced6['destuniqueid']][_0x2bca('0x19')]=_0x30ced6[_0x2bca('0x19')];agents[_0x30ced6['destuniqueid']][_0x2bca('0x23')]=_0x30ced6[_0x2bca('0x24')];agents[_0x30ced6[_0x2bca('0x16')]][_0x2bca('0x9')]=_0x2bca('0x30');_[_0x2bca('0x27')](agents,function(_0xfc976c,_0x535ff9){if(_0xfc976c[_0x2bca('0x16')]!=_0x30ced6[_0x2bca('0x16')]&&_0xfc976c[_0x2bca('0x4')]==_0x30ced6[_0x2bca('0x4')]){_0xfc976c['talktime']=0x0;_0xfc976c[_0x2bca('0x23')]=_0x30ced6[_0x2bca('0x24')];_0xfc976c[_0x2bca('0x1c')]=!![];_0xfc976c['agentringnoanswerAt']=utils['now']();_0xfc976c[_0x2bca('0x9')]=_0x2bca('0x31');_0xfc976c[_0x2bca('0x22')]=_0x2bca('0x31');_0xfc976c[_0x2bca('0x32')]=_0x30ced6['destuniqueid'];_0xfc976c[_0x2bca('0x33')]=_0x30ced6[_0x2bca('0x6')];writeDB(_0xfc976c);}});}}catch(_0xb924b4){utils[_0x2bca('0x1b')](util['format'](_0x2bca('0x2e'),_0x30ced6[_0x2bca('0x4')]),_0xb924b4);}};exports[_0x2bca('0xf')]=function(_0x24a8c2){try{if(!_[_0x2bca('0x34')](agents[_0x24a8c2['destuniqueid']])){utils[_0x2bca('0x1d')](util[_0x2bca('0x2')]('[%s][agents][agentcomplete]',_0x24a8c2[_0x2bca('0x4')]),_0x24a8c2);utils[_0x2bca('0x1')](util[_0x2bca('0x2')](_0x2bca('0x35'),_0x24a8c2[_0x2bca('0x4')],agents[_0x24a8c2[_0x2bca('0x16')]][_0x2bca('0x6')],_0x24a8c2[_0x2bca('0x16')]));agents[_0x24a8c2[_0x2bca('0x16')]][_0x2bca('0xf')]=!![];agents[_0x24a8c2['destuniqueid']][_0x2bca('0x36')]=utils[_0x2bca('0x20')]();agents[_0x24a8c2[_0x2bca('0x16')]][_0x2bca('0x25')]=utils[_0x2bca('0x37')](agents[_0x24a8c2[_0x2bca('0x16')]][_0x2bca('0x36')],agents[_0x24a8c2['destuniqueid']]['agentconnectAt']);agents[_0x24a8c2[_0x2bca('0x16')]][_0x2bca('0x22')]=_0x24a8c2[_0x2bca('0x22')];agents[_0x24a8c2[_0x2bca('0x16')]]['lastevent']='complete';writeDB(agents[_0x24a8c2[_0x2bca('0x16')]]);}}catch(_0x43d555){utils[_0x2bca('0x1b')](util[_0x2bca('0x2')](_0x2bca('0x38'),_0x24a8c2[_0x2bca('0x4')]),_0x43d555);}};exports[_0x2bca('0x39')]=function(_0x518f86){try{if(!_[_0x2bca('0x34')](agents[_0x518f86[_0x2bca('0x3a')]])){utils[_0x2bca('0x1d')](util['format']('[%s][agents][blindtransfer]',_0x518f86['uniqueid']),_0x518f86);utils[_0x2bca('0x1')](util[_0x2bca('0x2')](_0x2bca('0x3b'),_0x518f86['uniqueid'],agents[_0x518f86[_0x2bca('0x3a')]][_0x2bca('0x6')],agents[_0x518f86[_0x2bca('0x3a')]][_0x2bca('0x4')]));agents[_0x518f86[_0x2bca('0x3a')]][_0x2bca('0x3c')]=!![];agents[_0x518f86[_0x2bca('0x3a')]][_0x2bca('0x3d')]=_0x2bca('0x3e');agents[_0x518f86[_0x2bca('0x3a')]][_0x2bca('0x3f')]=_0x518f86[_0x2bca('0x40')];agents[_0x518f86['transfereruniqueid']][_0x2bca('0x41')]=agents[_0x518f86[_0x2bca('0x3a')]][_0x2bca('0x4')];}}catch(_0x402334){utils[_0x2bca('0x1b')](util[_0x2bca('0x2')](_0x2bca('0x42'),_0x518f86['uniqueid']),_0x402334);}};exports['attendedtransfer']=function(_0x5cd80e){try{utils[_0x2bca('0x1d')](util[_0x2bca('0x2')](_0x2bca('0x43'),_0x5cd80e[_0x2bca('0x44')]),_0x5cd80e);if(_0x5cd80e[_0x2bca('0x44')]==_0x5cd80e[_0x2bca('0x45')]){if(!_['isNil'](agents[_0x5cd80e[_0x2bca('0x46')]])){utils[_0x2bca('0x1')](util[_0x2bca('0x2')](_0x2bca('0x47'),_0x5cd80e[_0x2bca('0x44')],agents[_0x5cd80e[_0x2bca('0x46')]][_0x2bca('0x6')]));agents[_0x5cd80e['secondtransfereruniqueid']][_0x2bca('0x3c')]=!![];agents[_0x5cd80e['secondtransfereruniqueid']][_0x2bca('0x3d')]=_0x2bca('0x48');agents[_0x5cd80e[_0x2bca('0x46')]][_0x2bca('0x3f')]=_0x5cd80e[_0x2bca('0x49')];agents[_0x5cd80e[_0x2bca('0x46')]][_0x2bca('0x41')]=_0x5cd80e[_0x2bca('0x44')];}if(_0x5cd80e[_0x2bca('0x4a')]&&agents[_0x5cd80e[_0x2bca('0x4a')]]){agents[_0x5cd80e[_0x2bca('0x4a')]]['agententerreason']=0x1;transfers[_0x5cd80e[_0x2bca('0x4a')]]=_[_0x2bca('0x4b')](agents[_0x5cd80e['transfereeuniqueid']]);transfers[_0x5cd80e[_0x2bca('0x4a')]][_0x2bca('0x7')]=agents[_0x5cd80e['secondtransfereruniqueid']][_0x2bca('0x7')];transfers[_0x5cd80e['transfereeuniqueid']]['calleridname']=agents[_0x5cd80e[_0x2bca('0x46')]][_0x2bca('0x4c')];transfers[_0x5cd80e['transfereeuniqueid']][_0x2bca('0x17')]=utils[_0x2bca('0x20')]();transfers[_0x5cd80e['transfereeuniqueid']][_0x2bca('0x4d')]=utils[_0x2bca('0x20')]();transfers[_0x5cd80e[_0x2bca('0x4a')]][_0x2bca('0x23')]=0x0;transfers[_0x5cd80e['transfereeuniqueid']][_0x2bca('0x4e')]=0x2;}}else if(_0x5cd80e[_0x2bca('0x46')]==_0x5cd80e[_0x2bca('0x4f')]){if(!_[_0x2bca('0x34')](agents[_0x5cd80e['origtransfereruniqueid']])){utils[_0x2bca('0x1')](util[_0x2bca('0x2')](_0x2bca('0x47'),_0x5cd80e[_0x2bca('0x44')],agents[_0x5cd80e['origtransfereruniqueid']][_0x2bca('0x6')]));agents[_0x5cd80e[_0x2bca('0x44')]][_0x2bca('0x3c')]=!![];agents[_0x5cd80e['origtransfereruniqueid']]['transfertype']='ATTENDED';agents[_0x5cd80e[_0x2bca('0x44')]]['transferexten']=_0x5cd80e['secondtransfererexten'];agents[_0x5cd80e[_0x2bca('0x44')]]['transferuniqueid']=_0x5cd80e[_0x2bca('0x46')];}if(_0x5cd80e[_0x2bca('0x50')]&&agents[_0x5cd80e['transfertargetuniqueid']]){agents[_0x5cd80e['transfertargetuniqueid']][_0x2bca('0x4e')]=0x1;transfers[_0x5cd80e['transfertargetuniqueid']]=_[_0x2bca('0x4b')](agents[_0x5cd80e['transfertargetuniqueid']]);transfers[_0x5cd80e[_0x2bca('0x50')]][_0x2bca('0x7')]=agents[_0x5cd80e[_0x2bca('0x44')]][_0x2bca('0x7')];transfers[_0x5cd80e[_0x2bca('0x50')]][_0x2bca('0x4c')]=agents[_0x5cd80e[_0x2bca('0x44')]][_0x2bca('0x4c')];transfers[_0x5cd80e['transfertargetuniqueid']][_0x2bca('0x17')]=utils[_0x2bca('0x20')]();transfers[_0x5cd80e[_0x2bca('0x50')]][_0x2bca('0x4d')]=utils[_0x2bca('0x20')]();transfers[_0x5cd80e[_0x2bca('0x50')]][_0x2bca('0x23')]=0x0;transfers[_0x5cd80e[_0x2bca('0x50')]][_0x2bca('0x4e')]=0x2;}}}catch(_0x45b961){utils[_0x2bca('0x1b')](util['format'](_0x2bca('0x43'),_0x5cd80e[_0x2bca('0x44')]),_0x45b961);}};exports[_0x2bca('0x51')]=function(_0x469a4e){try{utils[_0x2bca('0x1d')](util[_0x2bca('0x2')](_0x2bca('0x52'),_0x469a4e[_0x2bca('0x4')]),_0x469a4e);if(agents[_0x469a4e[_0x2bca('0x4')]]&&agents[_0x469a4e[_0x2bca('0x4')]][_0x2bca('0x22')]===_0x2bca('0x21')){if(_0x469a4e[_0x2bca('0x53')]==='21'){agents[_0x469a4e[_0x2bca('0x4')]]['reason']='rejected';agents[_0x469a4e[_0x2bca('0x4')]][_0x2bca('0x9')]='rejected';}utils[_0x2bca('0x1')](util[_0x2bca('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x469a4e[_0x2bca('0x4')],agents[_0x469a4e[_0x2bca('0x4')]]['membername'],agents[_0x469a4e[_0x2bca('0x4')]][_0x2bca('0x22')],agents[_0x469a4e[_0x2bca('0x4')]]['lastevent']));writeDB(agents[_0x469a4e['uniqueid']]);var _0x21de6a=unanswered[_0x2bca('0x54')](_0x469a4e[_0x2bca('0x4')]);if(_0x21de6a>-0x1){unanswered[_0x2bca('0x55')](_0x21de6a,0x1);}}if(transfers[_0x469a4e[_0x2bca('0x4')]]){transfers[_0x469a4e[_0x2bca('0x4')]][_0x2bca('0xf')]=!![];transfers[_0x469a4e['uniqueid']][_0x2bca('0x36')]=utils['now']();transfers[_0x469a4e[_0x2bca('0x4')]][_0x2bca('0x25')]=utils['diffTime'](transfers[_0x469a4e[_0x2bca('0x4')]][_0x2bca('0x36')],transfers[_0x469a4e[_0x2bca('0x4')]][_0x2bca('0x4d')]);transfers[_0x469a4e['uniqueid']][_0x2bca('0x22')]=_0x2bca('0x56');transfers[_0x469a4e['uniqueid']][_0x2bca('0x9')]=_0x2bca('0x57');utils['info'](util[_0x2bca('0x2')](_0x2bca('0x58'),_0x469a4e['uniqueid'],transfers[_0x469a4e[_0x2bca('0x4')]][_0x2bca('0x6')],transfers[_0x469a4e['uniqueid']]['reason'],transfers[_0x469a4e[_0x2bca('0x4')]]['lastevent']));writeDB(transfers[_0x469a4e[_0x2bca('0x4')]],!![]);}if(agents[_0x469a4e[_0x2bca('0x4')]]&&agents[_0x469a4e[_0x2bca('0x4')]][_0x2bca('0x4d')]){agents[_0x469a4e[_0x2bca('0x4')]][_0x2bca('0xf')]=!![];agents[_0x469a4e[_0x2bca('0x4')]][_0x2bca('0x36')]=utils[_0x2bca('0x20')]();agents[_0x469a4e[_0x2bca('0x4')]]['talktime']=utils[_0x2bca('0x37')](agents[_0x469a4e['uniqueid']]['agentcompleteAt'],agents[_0x469a4e[_0x2bca('0x4')]][_0x2bca('0x4d')]);agents[_0x469a4e[_0x2bca('0x4')]]['reason']=agents[_0x469a4e[_0x2bca('0x4')]][_0x2bca('0x3c')]?_0x2bca('0x3c'):'agent';agents[_0x469a4e[_0x2bca('0x4')]][_0x2bca('0x9')]=_0x2bca('0x57');utils[_0x2bca('0x1')](util[_0x2bca('0x2')](_0x2bca('0x58'),_0x469a4e[_0x2bca('0x4')],agents[_0x469a4e['uniqueid']]['membername'],agents[_0x469a4e[_0x2bca('0x4')]]['reason'],agents[_0x469a4e[_0x2bca('0x4')]][_0x2bca('0x9')]));writeDB(agents[_0x469a4e[_0x2bca('0x4')]]);}}catch(_0x3901b0){utils['error'](util[_0x2bca('0x2')](_0x2bca('0x52'),_0x469a4e['uniqueid']),_0x3901b0);}}; \ No newline at end of file +var _0x16cc=['channel','queue','lastevent','getVoiceQueueByName','type','agentacw','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','destuniqueid','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinenum','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','agentringnoanswerAt','timeout','holdtime','ringtime','push','error','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','agentconnectAt','connectedlinename','connect','talktime','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]','reason','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','origtransfererexten','transfereeuniqueid','clone','calleridnum','calleridname','secondtransfererlinkedid','transfer','transfertype','ATTENDED','secondtransfererexten','transfertargetuniqueid','agententerreason','hangup','[%s][agents][hangup]','rejected','splice','agentcompleteAt','diffTime','complete','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agent','lodash','info','format','uniqueid'];(function(_0x176d4a,_0x3f14e0){var _0x44b481=function(_0x5c2209){while(--_0x5c2209){_0x176d4a['push'](_0x176d4a['shift']());}};_0x44b481(++_0x3f14e0);}(_0x16cc,0x1dc));var _0xc16c=function(_0x4591ed,_0x114736){_0x4591ed=_0x4591ed-0x0;var _0x1f9efc=_0x16cc[_0x4591ed];return _0x1f9efc;};'use strict';var _=require(_0xc16c('0x0'));var util=require('util');var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x45c015,_0x56f755){utils[_0xc16c('0x1')](util[_0xc16c('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x45c015[_0xc16c('0x3')],_0x45c015[_0xc16c('0x4')],_0x45c015[_0xc16c('0x5')],_0x45c015['membername'],_0x45c015['interface'],_0x45c015['calleridnum'],_0x45c015['connectedlinenum'],_0x45c015[_0xc16c('0x6')]));if(_0x45c015[_0xc16c('0x5')]){utils[_0xc16c('0x7')](_0x45c015[_0xc16c('0x5')])['then'](function(_0x265fc3){if(_0x265fc3){_0x45c015[_0xc16c('0x8')]=_0x265fc3[_0xc16c('0x8')];_0x45c015[_0xc16c('0x9')]=_0x45c015[_0xc16c('0xa')]?_0x265fc3[_0xc16c('0xb')]:![];_0x45c015[_0xc16c('0xc')]=_0x45c015[_0xc16c('0x9')]?_0x265fc3['acwTimeout']:0x0;}utils[_0xc16c('0xd')](_0xc16c('0xe'),_0x45c015);});}else{utils[_0xc16c('0xd')]('CreateVoiceAgentReport',_0x45c015);}if(_0x56f755){delete transfers[_0x45c015[_0xc16c('0x3')]];}else{delete agents[_0x45c015[_0xc16c('0xf')]];}}exports['agentcalled']=function(_0x35bad0){try{utils['debug'](util[_0xc16c('0x2')](_0xc16c('0x10'),_0x35bad0[_0xc16c('0x3')]),_0x35bad0);agents[_0x35bad0[_0xc16c('0xf')]]=_0x35bad0;agents[_0x35bad0['destuniqueid']][_0xc16c('0x11')]=utils[_0xc16c('0x12')]();agents[_0x35bad0['destuniqueid']][_0xc16c('0x6')]=_0xc16c('0x13');agents[_0x35bad0[_0xc16c('0xf')]][_0xc16c('0x14')]=null;agents[_0x35bad0['destuniqueid']]['connectedlinename']=null;utils[_0xc16c('0x1')](util[_0xc16c('0x2')](_0xc16c('0x15'),_0x35bad0[_0xc16c('0x3')],agents[_0x35bad0[_0xc16c('0xf')]][_0xc16c('0x16')],_0x35bad0[_0xc16c('0xf')]));}catch(_0x4d90ab){utils['error'](util[_0xc16c('0x2')](_0xc16c('0x10'),_0x35bad0['uniqueid']),_0x4d90ab);}};exports[_0xc16c('0x17')]=function(_0x1e0e7a){try{if(!_[_0xc16c('0x18')](agents[_0x1e0e7a[_0xc16c('0xf')]])){utils[_0xc16c('0x19')](util[_0xc16c('0x2')](_0xc16c('0x1a'),_0x1e0e7a[_0xc16c('0x3')]),_0x1e0e7a);utils['info'](util[_0xc16c('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x1e0e7a[_0xc16c('0x3')],agents[_0x1e0e7a['destuniqueid']][_0xc16c('0x16')],_0x1e0e7a[_0xc16c('0xf')]));agents[_0x1e0e7a[_0xc16c('0xf')]][_0xc16c('0x17')]=!![];agents[_0x1e0e7a[_0xc16c('0xf')]][_0xc16c('0x1b')]=utils['now']();agents[_0x1e0e7a[_0xc16c('0xf')]][_0xc16c('0x6')]=_0xc16c('0x1c');agents[_0x1e0e7a[_0xc16c('0xf')]]['reason']=_0xc16c('0x1c');agents[_0x1e0e7a[_0xc16c('0xf')]][_0xc16c('0x1d')]=_0x1e0e7a[_0xc16c('0x1e')]?parseInt(_0x1e0e7a[_0xc16c('0x1e')])/0x3e8:0x0;agents[_0x1e0e7a[_0xc16c('0xf')]]['talktime']=0x0;unanswered[_0xc16c('0x1f')](_0x1e0e7a[_0xc16c('0xf')]);}}catch(_0x4802ca){utils[_0xc16c('0x20')](util[_0xc16c('0x2')](_0xc16c('0x1a'),_0x1e0e7a[_0xc16c('0x3')]),_0x4802ca);}};exports['queuecallerabandon']=function(_0x12e3d9){try{_[_0xc16c('0x21')](agents,function(_0x57f7f4,_0x3e942d){if(_0x57f7f4[_0xc16c('0x3')]==_0x12e3d9[_0xc16c('0x3')]&&!_['includes'](unanswered,_0x57f7f4[_0xc16c('0xf')])){utils['debug'](util[_0xc16c('0x2')](_0xc16c('0x22'),_0x12e3d9['uniqueid']),_0x12e3d9);utils[_0xc16c('0x1')](util[_0xc16c('0x2')](_0xc16c('0x23'),_0x12e3d9[_0xc16c('0x3')],_0x57f7f4[_0xc16c('0x16')],_0x57f7f4[_0xc16c('0xf')]));_0x57f7f4['agentringnoanswer']=!![];_0x57f7f4[_0xc16c('0x1b')]=utils[_0xc16c('0x12')]();_0x57f7f4[_0xc16c('0x6')]=_0xc16c('0x24');_0x57f7f4['reason']='abandoned';_0x57f7f4[_0xc16c('0x1d')]=_0x12e3d9[_0xc16c('0x1d')];_0x57f7f4['talktime']=0x0;writeDB(_0x57f7f4);}});}catch(_0xc3b84b){utils[_0xc16c('0x20')](util[_0xc16c('0x2')](_0xc16c('0x22'),_0x12e3d9[_0xc16c('0x3')]),_0xc3b84b);}};exports['agentconnect']=function(_0x4becb5){try{if(agents[_0x4becb5[_0xc16c('0xf')]]){utils[_0xc16c('0x19')](util[_0xc16c('0x2')](_0xc16c('0x25'),_0x4becb5[_0xc16c('0x3')]),_0x4becb5);utils[_0xc16c('0x1')](util[_0xc16c('0x2')](_0xc16c('0x26'),_0x4becb5[_0xc16c('0x3')],agents[_0x4becb5['destuniqueid']]['membername'],_0x4becb5[_0xc16c('0xf')]));agents[_0x4becb5[_0xc16c('0xf')]][_0xc16c('0x27')]=utils['now']();agents[_0x4becb5[_0xc16c('0xf')]][_0xc16c('0x14')]=_0x4becb5[_0xc16c('0x14')];agents[_0x4becb5[_0xc16c('0xf')]]['connectedlinename']=_0x4becb5[_0xc16c('0x28')];agents[_0x4becb5['destuniqueid']][_0xc16c('0x1d')]=_0x4becb5[_0xc16c('0x1e')];agents[_0x4becb5['destuniqueid']][_0xc16c('0x6')]=_0xc16c('0x29');_[_0xc16c('0x21')](agents,function(_0x544800,_0x4ee3d4){if(_0x544800['destuniqueid']!=_0x4becb5['destuniqueid']&&_0x544800['uniqueid']==_0x4becb5[_0xc16c('0x3')]){_0x544800[_0xc16c('0x2a')]=0x0;_0x544800[_0xc16c('0x1d')]=_0x4becb5['ringtime'];_0x544800[_0xc16c('0x17')]=!![];_0x544800[_0xc16c('0x1b')]=utils['now']();_0x544800[_0xc16c('0x6')]='answered_elsewhere';_0x544800['reason']=_0xc16c('0x2b');_0x544800[_0xc16c('0x2c')]=_0x4becb5['destuniqueid'];_0x544800['answeredelsewheremembername']=_0x4becb5[_0xc16c('0x16')];writeDB(_0x544800);}});}}catch(_0x21bc36){utils[_0xc16c('0x20')](util['format'](_0xc16c('0x25'),_0x4becb5[_0xc16c('0x3')]),_0x21bc36);}};exports['agentcomplete']=function(_0xe28330){try{if(!_[_0xc16c('0x18')](agents[_0xe28330[_0xc16c('0xf')]])){utils[_0xc16c('0x19')](util[_0xc16c('0x2')](_0xc16c('0x2d'),_0xe28330[_0xc16c('0x3')]),_0xe28330);utils['info'](util[_0xc16c('0x2')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0xe28330[_0xc16c('0x3')],agents[_0xe28330[_0xc16c('0xf')]][_0xc16c('0x16')],_0xe28330[_0xc16c('0xf')]));agents[_0xe28330[_0xc16c('0xf')]][_0xc16c('0xa')]=!![];agents[_0xe28330['destuniqueid']]['agentcompleteAt']=utils[_0xc16c('0x12')]();agents[_0xe28330[_0xc16c('0xf')]][_0xc16c('0x2a')]=utils['diffTime'](agents[_0xe28330[_0xc16c('0xf')]]['agentcompleteAt'],agents[_0xe28330[_0xc16c('0xf')]]['agentconnectAt']);agents[_0xe28330[_0xc16c('0xf')]][_0xc16c('0x2e')]=_0xe28330[_0xc16c('0x2e')];agents[_0xe28330['destuniqueid']][_0xc16c('0x6')]='complete';writeDB(agents[_0xe28330[_0xc16c('0xf')]]);}}catch(_0xf791e3){utils[_0xc16c('0x20')](util[_0xc16c('0x2')]('[%s][agents][agentcomplete]',_0xe28330[_0xc16c('0x3')]),_0xf791e3);}};exports[_0xc16c('0x2f')]=function(_0x2a4145){try{if(!_['isNil'](agents[_0x2a4145[_0xc16c('0x30')]])){utils[_0xc16c('0x19')](util[_0xc16c('0x2')](_0xc16c('0x31'),_0x2a4145[_0xc16c('0x3')]),_0x2a4145);utils['info'](util[_0xc16c('0x2')](_0xc16c('0x32'),_0x2a4145['uniqueid'],agents[_0x2a4145[_0xc16c('0x30')]][_0xc16c('0x16')],agents[_0x2a4145['transfereruniqueid']][_0xc16c('0x3')]));agents[_0x2a4145['transfereruniqueid']]['transfer']=!![];agents[_0x2a4145[_0xc16c('0x30')]]['transfertype']='blind';agents[_0x2a4145[_0xc16c('0x30')]][_0xc16c('0x33')]=_0x2a4145[_0xc16c('0x34')];agents[_0x2a4145[_0xc16c('0x30')]][_0xc16c('0x35')]=agents[_0x2a4145[_0xc16c('0x30')]][_0xc16c('0x3')];}}catch(_0x3e4090){utils['error'](util[_0xc16c('0x2')](_0xc16c('0x31'),_0x2a4145[_0xc16c('0x3')]),_0x3e4090);}};exports[_0xc16c('0x36')]=function(_0x33b162){try{utils['debug'](util['format'](_0xc16c('0x37'),_0x33b162[_0xc16c('0x38')]),_0x33b162);if(_0x33b162[_0xc16c('0x38')]==_0x33b162['origtransfererlinkedid']){if(!_['isNil'](agents[_0x33b162['secondtransfereruniqueid']])){utils[_0xc16c('0x1')](util[_0xc16c('0x2')](_0xc16c('0x39'),_0x33b162[_0xc16c('0x38')],agents[_0x33b162[_0xc16c('0x3a')]][_0xc16c('0x16')]));agents[_0x33b162[_0xc16c('0x3a')]]['transfer']=!![];agents[_0x33b162[_0xc16c('0x3a')]]['transfertype']='ATTENDED';agents[_0x33b162[_0xc16c('0x3a')]][_0xc16c('0x33')]=_0x33b162[_0xc16c('0x3b')];agents[_0x33b162[_0xc16c('0x3a')]]['transferuniqueid']=_0x33b162[_0xc16c('0x38')];}if(_0x33b162[_0xc16c('0x3c')]&&agents[_0x33b162[_0xc16c('0x3c')]]){agents[_0x33b162['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x33b162[_0xc16c('0x3c')]]=_[_0xc16c('0x3d')](agents[_0x33b162['transfereeuniqueid']]);transfers[_0x33b162[_0xc16c('0x3c')]][_0xc16c('0x3e')]=agents[_0x33b162[_0xc16c('0x3a')]][_0xc16c('0x3e')];transfers[_0x33b162['transfereeuniqueid']][_0xc16c('0x3f')]=agents[_0x33b162[_0xc16c('0x3a')]][_0xc16c('0x3f')];transfers[_0x33b162[_0xc16c('0x3c')]]['agentcalledAt']=utils['now']();transfers[_0x33b162['transfereeuniqueid']]['agentconnectAt']=utils[_0xc16c('0x12')]();transfers[_0x33b162[_0xc16c('0x3c')]][_0xc16c('0x1d')]=0x0;transfers[_0x33b162['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x33b162[_0xc16c('0x3a')]==_0x33b162[_0xc16c('0x40')]){if(!_[_0xc16c('0x18')](agents[_0x33b162[_0xc16c('0x38')]])){utils[_0xc16c('0x1')](util[_0xc16c('0x2')](_0xc16c('0x39'),_0x33b162[_0xc16c('0x38')],agents[_0x33b162[_0xc16c('0x38')]][_0xc16c('0x16')]));agents[_0x33b162[_0xc16c('0x38')]][_0xc16c('0x41')]=!![];agents[_0x33b162[_0xc16c('0x38')]][_0xc16c('0x42')]=_0xc16c('0x43');agents[_0x33b162['origtransfereruniqueid']][_0xc16c('0x33')]=_0x33b162[_0xc16c('0x44')];agents[_0x33b162[_0xc16c('0x38')]][_0xc16c('0x35')]=_0x33b162[_0xc16c('0x3a')];}if(_0x33b162['transfertargetuniqueid']&&agents[_0x33b162[_0xc16c('0x45')]]){agents[_0x33b162[_0xc16c('0x45')]][_0xc16c('0x46')]=0x1;transfers[_0x33b162[_0xc16c('0x45')]]=_[_0xc16c('0x3d')](agents[_0x33b162['transfertargetuniqueid']]);transfers[_0x33b162['transfertargetuniqueid']][_0xc16c('0x3e')]=agents[_0x33b162[_0xc16c('0x38')]][_0xc16c('0x3e')];transfers[_0x33b162[_0xc16c('0x45')]][_0xc16c('0x3f')]=agents[_0x33b162['origtransfereruniqueid']][_0xc16c('0x3f')];transfers[_0x33b162[_0xc16c('0x45')]][_0xc16c('0x11')]=utils[_0xc16c('0x12')]();transfers[_0x33b162[_0xc16c('0x45')]][_0xc16c('0x27')]=utils['now']();transfers[_0x33b162[_0xc16c('0x45')]][_0xc16c('0x1d')]=0x0;transfers[_0x33b162[_0xc16c('0x45')]][_0xc16c('0x46')]=0x2;}}}catch(_0x79178a){utils['error'](util[_0xc16c('0x2')]('[%s][agents][attendedtransfer]',_0x33b162['origtransfereruniqueid']),_0x79178a);}};exports[_0xc16c('0x47')]=function(_0x243bf2){try{utils[_0xc16c('0x19')](util[_0xc16c('0x2')](_0xc16c('0x48'),_0x243bf2[_0xc16c('0x3')]),_0x243bf2);if(agents[_0x243bf2[_0xc16c('0x3')]]&&agents[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x2e')]===_0xc16c('0x1c')){if(_0x243bf2['cause']==='21'){agents[_0x243bf2[_0xc16c('0x3')]]['reason']=_0xc16c('0x49');agents[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x6')]=_0xc16c('0x49');}utils[_0xc16c('0x1')](util[_0xc16c('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x243bf2[_0xc16c('0x3')],agents[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x16')],agents[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x2e')],agents[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x6')]));writeDB(agents[_0x243bf2[_0xc16c('0x3')]]);var _0x41b44d=unanswered['indexOf'](_0x243bf2['uniqueid']);if(_0x41b44d>-0x1){unanswered[_0xc16c('0x4a')](_0x41b44d,0x1);}}if(transfers[_0x243bf2['uniqueid']]){transfers[_0x243bf2['uniqueid']][_0xc16c('0xa')]=!![];transfers[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x4b')]=utils[_0xc16c('0x12')]();transfers[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x2a')]=utils[_0xc16c('0x4c')](transfers[_0x243bf2[_0xc16c('0x3')]]['agentcompleteAt'],transfers[_0x243bf2[_0xc16c('0x3')]]['agentconnectAt']);transfers[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x2e')]='agent';transfers[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x6')]=_0xc16c('0x4d');utils['info'](util[_0xc16c('0x2')](_0xc16c('0x4e'),_0x243bf2[_0xc16c('0x3')],transfers[_0x243bf2['uniqueid']][_0xc16c('0x16')],transfers[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x2e')],transfers[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x6')]));writeDB(transfers[_0x243bf2[_0xc16c('0x3')]],!![]);}if(agents[_0x243bf2[_0xc16c('0x3')]]&&agents[_0x243bf2[_0xc16c('0x3')]]['agentconnectAt']){agents[_0x243bf2[_0xc16c('0x3')]]['agentcomplete']=!![];agents[_0x243bf2[_0xc16c('0x3')]]['agentcompleteAt']=utils[_0xc16c('0x12')]();agents[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x2a')]=utils['diffTime'](agents[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x4b')],agents[_0x243bf2[_0xc16c('0x3')]]['agentconnectAt']);agents[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x2e')]=agents[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x41')]?_0xc16c('0x41'):_0xc16c('0x4f');agents[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x6')]=_0xc16c('0x4d');utils['info'](util[_0xc16c('0x2')](_0xc16c('0x4e'),_0x243bf2[_0xc16c('0x3')],agents[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x16')],agents[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x2e')],agents[_0x243bf2[_0xc16c('0x3')]][_0xc16c('0x6')]));writeDB(agents[_0x243bf2[_0xc16c('0x3')]]);}}catch(_0x54c27c){utils[_0xc16c('0x20')](util[_0xc16c('0x2')](_0xc16c('0x48'),_0x243bf2['uniqueid']),_0x54c27c);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 179b581..722ce2b 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 _0x6e13=['mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','noop','gotoif','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','uniqueid','channel','queue','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','CreateVoiceCallReport','request','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','calleridname','callerid','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','origtransfereruniqueid','secondtransfererchannel','userfield','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]'];(function(_0x1857c6,_0x48840c){var _0x51011c=function(_0x3a4736){while(--_0x3a4736){_0x1857c6['push'](_0x1857c6['shift']());}};_0x51011c(++_0x48840c);}(_0x6e13,0x93));var _0x36e1=function(_0x518fb3,_0x4eecae){_0x518fb3=_0x518fb3-0x0;var _0x57976d=_0x6e13[_0x518fb3];return _0x57976d;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x36e1('0x0'));var dispositions=[_0x36e1('0x1'),'FAILED',_0x36e1('0x2'),_0x36e1('0x1'),_0x36e1('0x1'),'NO\x20ANSWER',_0x36e1('0x3'),_0x36e1('0x4'),'FAILED',_0x36e1('0x2'),_0x36e1('0x2')];var channels={};function writeDB(_0x1bdf62){utils[_0x36e1('0x5')](util[_0x36e1('0x6')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1bdf62[_0x36e1('0x7')],_0x1bdf62[_0x36e1('0x8')],_0x1bdf62[_0x36e1('0x9')],_0x1bdf62['membername'],_0x1bdf62[_0x36e1('0xa')],_0x1bdf62[_0x36e1('0xb')],_0x1bdf62[_0x36e1('0xc')],_0x1bdf62[_0x36e1('0xd')]));if(_0x1bdf62[_0x36e1('0xe')]){utils[_0x36e1('0xf')](_0x1bdf62[_0x36e1('0xe')])[_0x36e1('0x10')](function(_0x111642){if(_0x111642){_0x1bdf62[_0x36e1('0x11')]=_0x111642['id'];}utils['request'](_0x36e1('0x12'),_0x1bdf62);});}else{utils[_0x36e1('0x13')](_0x36e1('0x12'),_0x1bdf62);}if(channels[_0x1bdf62[_0x36e1('0x7')]]){delete channels[_0x1bdf62['uniqueid']];}}exports[_0x36e1('0x14')]=function(_0x31d292){try{utils[_0x36e1('0x15')](util[_0x36e1('0x6')](_0x36e1('0x16'),_0x31d292[_0x36e1('0x7')]),_0x31d292);if(_0x31d292[_0x36e1('0x7')]==_0x31d292[_0x36e1('0x17')]&&_0x31d292['channel']!=_0x36e1('0x18')){utils[_0x36e1('0x5')](util[_0x36e1('0x6')](_0x36e1('0x19'),_0x31d292[_0x36e1('0x7')],_0x31d292[_0x36e1('0x1a')],_0x31d292[_0x36e1('0x1b')]));channels[_0x31d292[_0x36e1('0x7')]]={'uniqueid':_0x31d292[_0x36e1('0x7')],'accountcode':_0x31d292[_0x36e1('0xe')],'source':_0x31d292[_0x36e1('0xb')],'destination':_0x31d292['exten'],'destinationcontext':_0x31d292[_0x36e1('0x1a')],'channel':_0x31d292[_0x36e1('0x8')],'starttime':utils[_0x36e1('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x36e1('0x1'),'amaflags':_0x36e1('0x1d')};}}catch(_0x276787){utils[_0x36e1('0x1e')](util[_0x36e1('0x6')](_0x36e1('0x16'),_0x31d292[_0x36e1('0x7')]),_0x276787);}};exports[_0x36e1('0x1f')]=function(_0x4a065b){try{utils[_0x36e1('0x15')](util[_0x36e1('0x6')](_0x36e1('0x20'),_0x4a065b[_0x36e1('0x7')]),_0x4a065b);if(!_[_0x36e1('0x21')](channels[_0x4a065b[_0x36e1('0x7')]])&&_0x4a065b[_0x36e1('0x22')]==0x6){utils[_0x36e1('0x5')](util[_0x36e1('0x6')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x4a065b[_0x36e1('0x7')],_0x4a065b['context'],_0x4a065b[_0x36e1('0x8')]));if(_[_0x36e1('0x21')](channels[_0x4a065b['uniqueid']][_0x36e1('0x23')])){channels[_0x4a065b[_0x36e1('0x7')]][_0x36e1('0x23')]=utils[_0x36e1('0x1c')]();}}else if(!_[_0x36e1('0x21')](channels[_0x4a065b[_0x36e1('0x17')]])&&_0x4a065b[_0x36e1('0x22')]==0x6&&_0x4a065b[_0x36e1('0x1a')]!=_0x36e1('0x24')){utils[_0x36e1('0x5')](util[_0x36e1('0x6')](_0x36e1('0x25'),_0x4a065b[_0x36e1('0x7')],_0x4a065b[_0x36e1('0x17')],_0x4a065b['context'],_0x4a065b['channel']));channels[_0x4a065b[_0x36e1('0x17')]]['accountcode']=_0x4a065b[_0x36e1('0xe')];channels[_0x4a065b[_0x36e1('0x17')]][_0x36e1('0x26')]=_0x4a065b['channel'];if(_[_0x36e1('0x21')](channels[_0x4a065b[_0x36e1('0x17')]][_0x36e1('0x27')])){channels[_0x4a065b[_0x36e1('0x17')]][_0x36e1('0x27')]=utils[_0x36e1('0x1c')]();}channels[_0x4a065b[_0x36e1('0x17')]][_0x36e1('0x28')]=dispositions[_[_0x36e1('0x29')](_0x4a065b[_0x36e1('0x22')])]||'ANSWERED';}}catch(_0x361648){utils[_0x36e1('0x1e')](util[_0x36e1('0x6')](_0x36e1('0x20'),_0x4a065b[_0x36e1('0x7')]),_0x361648);}};exports[_0x36e1('0x2a')]=function(_0xff4320){try{if(!_[_0x36e1('0x21')](channels[_0xff4320[_0x36e1('0x7')]])){utils['debug'](util[_0x36e1('0x6')](_0x36e1('0x2b'),_0xff4320[_0x36e1('0x7')]),_0xff4320);if(_[_0x36e1('0x21')](channels[_0xff4320[_0x36e1('0x7')]]['callerid'])){channels[_0xff4320[_0x36e1('0x7')]]['callerid']=_0xff4320[_0x36e1('0x2c')]+'\x20<'+_0xff4320[_0x36e1('0xb')]+'>';}utils[_0x36e1('0x5')](util[_0x36e1('0x6')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0xff4320[_0x36e1('0x7')],channels[_0xff4320[_0x36e1('0x7')]][_0x36e1('0x2d')],_0xff4320[_0x36e1('0x2e')]));channels[_0xff4320[_0x36e1('0x7')]][_0x36e1('0x2f')]=utils[_0x36e1('0x1c')]();channels[_0xff4320[_0x36e1('0x7')]][_0x36e1('0x30')]=utils[_0x36e1('0x31')](channels[_0xff4320[_0x36e1('0x7')]][_0x36e1('0x2f')],channels[_0xff4320[_0x36e1('0x7')]][_0x36e1('0x32')]);channels[_0xff4320[_0x36e1('0x7')]][_0x36e1('0x33')]=channels[_0xff4320[_0x36e1('0x7')]]['answertime']?utils['diffTime'](channels[_0xff4320['uniqueid']]['endtime'],channels[_0xff4320[_0x36e1('0x7')]][_0x36e1('0x27')]):0x0;writeDB(channels[_0xff4320[_0x36e1('0x7')]]);}}catch(_0x19d32){utils['error'](util['format']('[%s][calls][hangup]',_0xff4320[_0x36e1('0x7')]),_0x19d32);}};exports[_0x36e1('0x34')]=function(_0x17d417){try{if(!_[_0x36e1('0x21')](channels[_0x17d417[_0x36e1('0x35')]])){utils[_0x36e1('0x15')](util[_0x36e1('0x6')](_0x36e1('0x36'),_0x17d417['origtransfereruniqueid']),_0x17d417);if(channels[_0x17d417[_0x36e1('0x35')]][_0x36e1('0x8')]==_0x17d417[_0x36e1('0x37')]){utils[_0x36e1('0x5')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x17d417[_0x36e1('0x38')],_0x17d417['localtwolinkedid'],_0x17d417['secondtransfererchannel']));channels[_0x17d417[_0x36e1('0x35')]][_0x36e1('0x26')]=_0x17d417[_0x36e1('0x39')];channels[_0x17d417[_0x36e1('0x35')]][_0x36e1('0x3a')]='_attended';}else if(channels[_0x17d417['localtwolinkedid']][_0x36e1('0x8')]=_0x17d417[_0x36e1('0x3b')]){utils['info'](util[_0x36e1('0x6')](_0x36e1('0x3c'),_0x17d417['origtransfereruniqueid'],_0x17d417[_0x36e1('0x35')],_0x17d417[_0x36e1('0x3d')]));channels[_0x17d417[_0x36e1('0x35')]][_0x36e1('0x26')]=_0x17d417[_0x36e1('0x3d')];channels[_0x17d417[_0x36e1('0x35')]][_0x36e1('0x3a')]='_attended';}}}catch(_0x4e67af){utils[_0x36e1('0x1e')](util[_0x36e1('0x6')](_0x36e1('0x36'),_0x17d417[_0x36e1('0x38')]),_0x4e67af);}};exports[_0x36e1('0x3e')]=function(_0x17e70c){try{if(!_[_0x36e1('0x21')](channels[_0x17e70c[_0x36e1('0x7')]])){utils[_0x36e1('0x15')](util['format'](_0x36e1('0x3f'),_0x17e70c[_0x36e1('0x7')]),_0x17e70c);channels[_0x17e70c[_0x36e1('0x7')]][_0x36e1('0x40')]=utils[_0x36e1('0x1c')]();utils[_0x36e1('0x5')](util['format']('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x17e70c['uniqueid'],channels[_0x17e70c['uniqueid']][_0x36e1('0x40')]));}}catch(_0x4568dd){utils[_0x36e1('0x1e')](util['format'](_0x36e1('0x3f'),_0x17e70c[_0x36e1('0x7')]),_0x4568dd);}};exports[_0x36e1('0x41')]=function(_0x3df8dc){try{if(!_[_0x36e1('0x21')](channels[_0x3df8dc['uniqueid']])){utils[_0x36e1('0x15')](util[_0x36e1('0x6')](_0x36e1('0x42'),_0x3df8dc[_0x36e1('0x7')]),_0x3df8dc);if(!_[_0x36e1('0x21')](channels[_0x3df8dc['uniqueid']][_0x36e1('0x40')])){channels[_0x3df8dc['uniqueid']][_0x36e1('0x43')]+=utils[_0x36e1('0x31')](utils[_0x36e1('0x1c')](),channels[_0x3df8dc[_0x36e1('0x7')]][_0x36e1('0x40')]);utils['info'](util[_0x36e1('0x6')](_0x36e1('0x44'),_0x3df8dc[_0x36e1('0x7')],channels[_0x3df8dc['uniqueid']][_0x36e1('0x43')]));delete channels[_0x3df8dc[_0x36e1('0x7')]][_0x36e1('0x40')];}}}catch(_0x7e0fb4){utils[_0x36e1('0x1e')](util['format'](_0x36e1('0x42'),_0x3df8dc[_0x36e1('0x7')]),_0x7e0fb4);}};exports['varset']=function(_0x4a833d){try{if(!_[_0x36e1('0x21')](channels[_0x4a833d['uniqueid']])){utils[_0x36e1('0x15')](util[_0x36e1('0x6')](_0x36e1('0x45'),_0x4a833d[_0x36e1('0x7')]),_0x4a833d);if(!_[_0x36e1('0x21')](_0x4a833d[_0x36e1('0x46')][_0x36e1('0x47')])){utils[_0x36e1('0x5')](util[_0x36e1('0x6')](_0x36e1('0x48'),_0x4a833d[_0x36e1('0x7')],_0x4a833d['value']));channels[_0x4a833d[_0x36e1('0x7')]][_0x36e1('0x49')]=_0x4a833d[_0x36e1('0x4a')];}if(!_[_0x36e1('0x21')](_0x4a833d[_0x36e1('0x46')][_0x36e1('0x4b')])){utils[_0x36e1('0x5')](util[_0x36e1('0x6')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x4a833d[_0x36e1('0x7')],_0x4a833d[_0x36e1('0x4a')]));channels[_0x4a833d['uniqueid']][_0x36e1('0x4c')]=_0x4a833d['value'];channels[_0x4a833d[_0x36e1('0x7')]][_0x36e1('0x2d')]='\x22'+_0x4a833d[_0x36e1('0x4a')]+_0x36e1('0x4d')+_0x4a833d['value']+'>';}if(!_[_0x36e1('0x21')](_0x4a833d['variable'][_0x36e1('0x4e')])||!_[_0x36e1('0x21')](_0x4a833d['variable'][_0x36e1('0x4f')])){utils[_0x36e1('0x5')](util['format'](_0x36e1('0x50'),_0x4a833d['uniqueid'],!_[_0x36e1('0x21')](_0x4a833d[_0x36e1('0x46')][_0x36e1('0x4e')])?_0x36e1('0x4e'):'xmd-callerid',_0x4a833d[_0x36e1('0x4a')]));channels[_0x4a833d[_0x36e1('0x7')]][_0x36e1('0x2d')]=_0x4a833d[_0x36e1('0x4a')];}if(!_[_0x36e1('0x21')](_0x4a833d['variable'][_0x36e1('0x51')])||!_[_0x36e1('0x21')](_0x4a833d[_0x36e1('0x46')][_0x36e1('0x52')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x4a833d[_0x36e1('0x7')],!_[_0x36e1('0x21')](_0x4a833d['variable'][_0x36e1('0x51')])?_0x36e1('0x51'):_0x36e1('0x52'),_0x4a833d[_0x36e1('0x4a')]));channels[_0x4a833d[_0x36e1('0x7')]][_0x36e1('0x53')]=_0x36e1('0x54');channels[_0x4a833d[_0x36e1('0x7')]][_0x36e1('0x55')]=_0x4a833d[_0x36e1('0x4a')];channels[_0x4a833d[_0x36e1('0x7')]][_0x36e1('0x9')]=!![];}if(!_[_0x36e1('0x21')](_0x4a833d[_0x36e1('0x46')]['xmd-contactid'])){utils[_0x36e1('0x5')](util[_0x36e1('0x6')](_0x36e1('0x56'),_0x4a833d[_0x36e1('0x7')],_0x4a833d[_0x36e1('0x4a')]));channels[_0x4a833d[_0x36e1('0x7')]][_0x36e1('0x57')]=_0x4a833d[_0x36e1('0x4a')];}if(!_['isNil'](_0x4a833d['variable']['xmd-cdrtype'])){utils[_0x36e1('0x5')](util[_0x36e1('0x6')](_0x36e1('0x58'),_0x4a833d[_0x36e1('0x7')],_0x4a833d[_0x36e1('0x4a')]));channels[_0x4a833d[_0x36e1('0x7')]]['type']=_0x4a833d[_0x36e1('0x4a')];}if(!_[_0x36e1('0x21')](_0x4a833d[_0x36e1('0x46')][_0x36e1('0x59')])){utils[_0x36e1('0x5')](util[_0x36e1('0x6')](_0x36e1('0x5a'),_0x4a833d[_0x36e1('0x7')],_0x4a833d[_0x36e1('0x4a')]));channels[_0x4a833d[_0x36e1('0x7')]][_0x36e1('0x5b')]=_0x4a833d[_0x36e1('0x4a')];}if(!_['isNil'](_0x4a833d[_0x36e1('0x46')][_0x36e1('0x5c')])){utils[_0x36e1('0x5')](util[_0x36e1('0x6')](_0x36e1('0x5d'),_0x4a833d['uniqueid'],_0x4a833d[_0x36e1('0x4a')]));channels[_0x4a833d[_0x36e1('0x7')]][_0x36e1('0x5c')]=_0x4a833d['value'];}}}catch(_0x48b47a){utils[_0x36e1('0x1e')](util[_0x36e1('0x6')]('[%s][calls][varset]',_0x4a833d[_0x36e1('0x7')]),_0x48b47a);}};exports[_0x36e1('0x5e')]=function(_0x529f62){try{if(!_[_0x36e1('0x21')](channels[_0x529f62[_0x36e1('0x7')]])){utils[_0x36e1('0x15')](util[_0x36e1('0x6')](_0x36e1('0x5f'),_0x529f62[_0x36e1('0x7')]),_0x529f62);utils['info'](util[_0x36e1('0x6')](_0x36e1('0x60'),_0x529f62['uniqueid'],_0x529f62[_0x36e1('0x61')],_0x529f62[_0x36e1('0x62')]));if(_0x529f62[_0x36e1('0x61')]['toLowerCase']()=='set'&&_[_0x36e1('0x63')](_0x529f62[_0x36e1('0x62')][_0x36e1('0x64')](),_0x36e1('0x65'))){var _0x26aa10=_0x529f62['appdata'][_0x36e1('0x66')]('=');var _0x2a911f=_0x26aa10[0x0][_0x36e1('0x67')](_0x26aa10[0x0][_0x36e1('0x68')]('(')+0x1,_0x26aa10[0x0][_0x36e1('0x68')](')'));var _0x3dac0b=_0x26aa10[0x1];channels[_0x529f62[_0x36e1('0x7')]][_0x2a911f]=_0x3dac0b;}if(!_['includes']([_0x36e1('0x2a'),_0x36e1('0x69'),'execif','set',_0x36e1('0x6a')],_0x529f62['application'][_0x36e1('0x64')]())){channels[_0x529f62[_0x36e1('0x7')]][_0x36e1('0x53')]=_0x529f62['application'];channels[_0x529f62[_0x36e1('0x7')]][_0x36e1('0x55')]=_0x529f62[_0x36e1('0x62')];}}}catch(_0x3b3ed4){utils[_0x36e1('0x1e')](util[_0x36e1('0x6')](_0x36e1('0x5f'),_0x529f62[_0x36e1('0x7')]),_0x3b3ed4);}}; \ No newline at end of file +var _0xe0d0=['gotoif','[%s][calls][newexten]','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','exten','calleridnum','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','context','destinationchannel','answertime','toNumber','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','starttime','billableseconds','endtime','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','musiconholdstartAt','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','set','startsWith','appdata','toLowerCase','lastIndexOf','includes','hangup','execif'];(function(_0x389a30,_0x1a4c3d){var _0x407335=function(_0x54d759){while(--_0x54d759){_0x389a30['push'](_0x389a30['shift']());}};_0x407335(++_0x1a4c3d);}(_0xe0d0,0x6f));var _0x0e0d=function(_0x23213d,_0x46696f){_0x23213d=_0x23213d-0x0;var _0x966f81=_0xe0d0[_0x23213d];return _0x966f81;};'use strict';var _=require('lodash');var util=require(_0x0e0d('0x0'));var utils=require(_0x0e0d('0x1'));var dispositions=['NO\x20ANSWER',_0x0e0d('0x2'),_0x0e0d('0x2'),_0x0e0d('0x3'),'NO\x20ANSWER',_0x0e0d('0x3'),_0x0e0d('0x4'),_0x0e0d('0x5'),_0x0e0d('0x2'),'FAILED',_0x0e0d('0x2')];var channels={};function writeDB(_0x48b9de){utils[_0x0e0d('0x6')](util[_0x0e0d('0x7')](_0x0e0d('0x8'),_0x48b9de[_0x0e0d('0x9')],_0x48b9de[_0x0e0d('0xa')],_0x48b9de[_0x0e0d('0xb')],_0x48b9de[_0x0e0d('0xc')],_0x48b9de[_0x0e0d('0xd')],_0x48b9de['calleridnum'],_0x48b9de[_0x0e0d('0xe')],_0x48b9de[_0x0e0d('0xf')]));if(_0x48b9de[_0x0e0d('0x10')]){utils[_0x0e0d('0x11')](_0x48b9de[_0x0e0d('0x10')])[_0x0e0d('0x12')](function(_0x1337ea){if(_0x1337ea){_0x48b9de['UserId']=_0x1337ea['id'];}utils[_0x0e0d('0x13')]('CreateVoiceCallReport',_0x48b9de);});}else{utils[_0x0e0d('0x13')](_0x0e0d('0x14'),_0x48b9de);}if(channels[_0x48b9de[_0x0e0d('0x9')]]){delete channels[_0x48b9de[_0x0e0d('0x9')]];}}exports['newchannel']=function(_0x2c3e78){try{utils[_0x0e0d('0x15')](util['format'](_0x0e0d('0x16'),_0x2c3e78[_0x0e0d('0x9')]),_0x2c3e78);if(_0x2c3e78[_0x0e0d('0x9')]==_0x2c3e78[_0x0e0d('0x17')]&&_0x2c3e78[_0x0e0d('0xa')]!=_0x0e0d('0x18')){utils[_0x0e0d('0x6')](util[_0x0e0d('0x7')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x2c3e78[_0x0e0d('0x9')],_0x2c3e78['context'],_0x2c3e78[_0x0e0d('0x19')]));channels[_0x2c3e78['uniqueid']]={'uniqueid':_0x2c3e78['uniqueid'],'accountcode':_0x2c3e78['accountcode'],'source':_0x2c3e78[_0x0e0d('0x1a')],'destination':_0x2c3e78[_0x0e0d('0x19')],'destinationcontext':_0x2c3e78['context'],'channel':_0x2c3e78[_0x0e0d('0xa')],'starttime':utils[_0x0e0d('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x0e0d('0x3'),'amaflags':_0x0e0d('0x1c')};}}catch(_0x4f7eb8){utils[_0x0e0d('0x1d')](util['format'](_0x0e0d('0x16'),_0x2c3e78['uniqueid']),_0x4f7eb8);}};exports[_0x0e0d('0x1e')]=function(_0x2d041d){try{utils[_0x0e0d('0x15')](util[_0x0e0d('0x7')](_0x0e0d('0x1f'),_0x2d041d[_0x0e0d('0x9')]),_0x2d041d);if(!_[_0x0e0d('0x20')](channels[_0x2d041d[_0x0e0d('0x9')]])&&_0x2d041d['channelstate']==0x6){utils[_0x0e0d('0x6')](util[_0x0e0d('0x7')](_0x0e0d('0x21'),_0x2d041d[_0x0e0d('0x9')],_0x2d041d['context'],_0x2d041d[_0x0e0d('0xa')]));if(_[_0x0e0d('0x20')](channels[_0x2d041d[_0x0e0d('0x9')]][_0x0e0d('0x22')])){channels[_0x2d041d[_0x0e0d('0x9')]]['systemanswertime']=utils[_0x0e0d('0x1b')]();}}else if(!_['isNil'](channels[_0x2d041d['linkedid']])&&_0x2d041d[_0x0e0d('0x23')]==0x6&&_0x2d041d['context']!=_0x0e0d('0x24')){utils['info'](util[_0x0e0d('0x7')](_0x0e0d('0x25'),_0x2d041d[_0x0e0d('0x9')],_0x2d041d[_0x0e0d('0x17')],_0x2d041d[_0x0e0d('0x26')],_0x2d041d['channel']));channels[_0x2d041d['linkedid']][_0x0e0d('0x10')]=_0x2d041d[_0x0e0d('0x10')];channels[_0x2d041d[_0x0e0d('0x17')]][_0x0e0d('0x27')]=_0x2d041d[_0x0e0d('0xa')];if(_[_0x0e0d('0x20')](channels[_0x2d041d[_0x0e0d('0x17')]][_0x0e0d('0x28')])){channels[_0x2d041d[_0x0e0d('0x17')]]['answertime']=utils[_0x0e0d('0x1b')]();}channels[_0x2d041d['linkedid']]['disposition']=dispositions[_[_0x0e0d('0x29')](_0x2d041d[_0x0e0d('0x23')])]||'ANSWERED';}}catch(_0x1296d3){utils[_0x0e0d('0x1d')](util[_0x0e0d('0x7')](_0x0e0d('0x1f'),_0x2d041d['uniqueid']),_0x1296d3);}};exports['hangup']=function(_0x39ce62){try{if(!_['isNil'](channels[_0x39ce62[_0x0e0d('0x9')]])){utils['debug'](util[_0x0e0d('0x7')](_0x0e0d('0x2a'),_0x39ce62[_0x0e0d('0x9')]),_0x39ce62);if(_[_0x0e0d('0x20')](channels[_0x39ce62['uniqueid']][_0x0e0d('0x2b')])){channels[_0x39ce62[_0x0e0d('0x9')]][_0x0e0d('0x2b')]=_0x39ce62[_0x0e0d('0x2c')]+'\x20<'+_0x39ce62['calleridnum']+'>';}utils[_0x0e0d('0x6')](util[_0x0e0d('0x7')](_0x0e0d('0x2d'),_0x39ce62['uniqueid'],channels[_0x39ce62['uniqueid']][_0x0e0d('0x2b')],_0x39ce62[_0x0e0d('0x2e')]));channels[_0x39ce62[_0x0e0d('0x9')]]['endtime']=utils[_0x0e0d('0x1b')]();channels[_0x39ce62['uniqueid']][_0x0e0d('0x2f')]=utils[_0x0e0d('0x30')](channels[_0x39ce62[_0x0e0d('0x9')]]['endtime'],channels[_0x39ce62[_0x0e0d('0x9')]][_0x0e0d('0x31')]);channels[_0x39ce62[_0x0e0d('0x9')]][_0x0e0d('0x32')]=channels[_0x39ce62[_0x0e0d('0x9')]][_0x0e0d('0x28')]?utils[_0x0e0d('0x30')](channels[_0x39ce62[_0x0e0d('0x9')]][_0x0e0d('0x33')],channels[_0x39ce62[_0x0e0d('0x9')]][_0x0e0d('0x28')]):0x0;writeDB(channels[_0x39ce62['uniqueid']]);}}catch(_0x5977d8){utils['error'](util['format']('[%s][calls][hangup]',_0x39ce62[_0x0e0d('0x9')]),_0x5977d8);}};exports[_0x0e0d('0x34')]=function(_0x5b0af6){try{if(!_['isNil'](channels[_0x5b0af6[_0x0e0d('0x35')]])){utils[_0x0e0d('0x15')](util[_0x0e0d('0x7')]('[%s][calls][attendedtransfer]',_0x5b0af6[_0x0e0d('0x36')]),_0x5b0af6);if(channels[_0x5b0af6[_0x0e0d('0x35')]][_0x0e0d('0xa')]==_0x5b0af6[_0x0e0d('0x37')]){utils[_0x0e0d('0x6')](util[_0x0e0d('0x7')](_0x0e0d('0x38'),_0x5b0af6[_0x0e0d('0x36')],_0x5b0af6[_0x0e0d('0x35')],_0x5b0af6['secondtransfererchannel']));channels[_0x5b0af6['localtwolinkedid']][_0x0e0d('0x27')]=_0x5b0af6[_0x0e0d('0x39')];channels[_0x5b0af6['localtwolinkedid']][_0x0e0d('0x3a')]=_0x0e0d('0x3b');}else if(channels[_0x5b0af6[_0x0e0d('0x35')]][_0x0e0d('0xa')]=_0x5b0af6[_0x0e0d('0x3c')]){utils[_0x0e0d('0x6')](util[_0x0e0d('0x7')](_0x0e0d('0x38'),_0x5b0af6[_0x0e0d('0x36')],_0x5b0af6['localtwolinkedid'],_0x5b0af6[_0x0e0d('0x3d')]));channels[_0x5b0af6[_0x0e0d('0x35')]][_0x0e0d('0x27')]=_0x5b0af6[_0x0e0d('0x3d')];channels[_0x5b0af6[_0x0e0d('0x35')]][_0x0e0d('0x3a')]='_attended';}}}catch(_0x2b6da5){utils[_0x0e0d('0x1d')](util[_0x0e0d('0x7')](_0x0e0d('0x3e'),_0x5b0af6[_0x0e0d('0x36')]),_0x2b6da5);}};exports[_0x0e0d('0x3f')]=function(_0x54ea50){try{if(!_['isNil'](channels[_0x54ea50[_0x0e0d('0x9')]])){utils[_0x0e0d('0x15')](util[_0x0e0d('0x7')](_0x0e0d('0x40'),_0x54ea50[_0x0e0d('0x9')]),_0x54ea50);channels[_0x54ea50[_0x0e0d('0x9')]]['musiconholdstartAt']=utils[_0x0e0d('0x1b')]();utils[_0x0e0d('0x6')](util['format'](_0x0e0d('0x41'),_0x54ea50[_0x0e0d('0x9')],channels[_0x54ea50[_0x0e0d('0x9')]]['musiconholdstartAt']));}}catch(_0x17402d){utils[_0x0e0d('0x1d')](util[_0x0e0d('0x7')](_0x0e0d('0x40'),_0x54ea50['uniqueid']),_0x17402d);}};exports['musiconholdstop']=function(_0x51a516){try{if(!_[_0x0e0d('0x20')](channels[_0x51a516[_0x0e0d('0x9')]])){utils['debug'](util[_0x0e0d('0x7')](_0x0e0d('0x42'),_0x51a516[_0x0e0d('0x9')]),_0x51a516);if(!_[_0x0e0d('0x20')](channels[_0x51a516[_0x0e0d('0x9')]]['musiconholdstartAt'])){channels[_0x51a516[_0x0e0d('0x9')]][_0x0e0d('0x43')]+=utils[_0x0e0d('0x30')](utils['now'](),channels[_0x51a516['uniqueid']][_0x0e0d('0x44')]);utils[_0x0e0d('0x6')](util[_0x0e0d('0x7')](_0x0e0d('0x45'),_0x51a516[_0x0e0d('0x9')],channels[_0x51a516[_0x0e0d('0x9')]][_0x0e0d('0x43')]));delete channels[_0x51a516[_0x0e0d('0x9')]]['musiconholdstartAt'];}}}catch(_0x10d845){utils[_0x0e0d('0x1d')](util[_0x0e0d('0x7')](_0x0e0d('0x42'),_0x51a516[_0x0e0d('0x9')]),_0x10d845);}};exports[_0x0e0d('0x46')]=function(_0x18789d){try{if(!_[_0x0e0d('0x20')](channels[_0x18789d['uniqueid']])){utils[_0x0e0d('0x15')](util[_0x0e0d('0x7')](_0x0e0d('0x47'),_0x18789d[_0x0e0d('0x9')]),_0x18789d);if(!_[_0x0e0d('0x20')](_0x18789d[_0x0e0d('0x48')][_0x0e0d('0x49')])){utils[_0x0e0d('0x6')](util[_0x0e0d('0x7')](_0x0e0d('0x4a'),_0x18789d['uniqueid'],_0x18789d[_0x0e0d('0x4b')]));channels[_0x18789d[_0x0e0d('0x9')]][_0x0e0d('0x4c')]=_0x18789d[_0x0e0d('0x4b')];}if(!_['isNil'](_0x18789d[_0x0e0d('0x48')][_0x0e0d('0x4d')])){utils['info'](util[_0x0e0d('0x7')](_0x0e0d('0x4e'),_0x18789d['uniqueid'],_0x18789d[_0x0e0d('0x4b')]));channels[_0x18789d[_0x0e0d('0x9')]][_0x0e0d('0x4f')]=_0x18789d[_0x0e0d('0x4b')];channels[_0x18789d[_0x0e0d('0x9')]][_0x0e0d('0x2b')]='\x22'+_0x18789d['value']+_0x0e0d('0x50')+_0x18789d['value']+'>';}if(!_[_0x0e0d('0x20')](_0x18789d[_0x0e0d('0x48')][_0x0e0d('0x51')])||!_['isNil'](_0x18789d[_0x0e0d('0x48')]['xmd-callerid'])){utils[_0x0e0d('0x6')](util[_0x0e0d('0x7')](_0x0e0d('0x52'),_0x18789d[_0x0e0d('0x9')],!_[_0x0e0d('0x20')](_0x18789d[_0x0e0d('0x48')][_0x0e0d('0x51')])?_0x0e0d('0x51'):_0x0e0d('0x53'),_0x18789d[_0x0e0d('0x4b')]));channels[_0x18789d[_0x0e0d('0x9')]]['callerid']=_0x18789d['value'];}if(!_[_0x0e0d('0x20')](_0x18789d[_0x0e0d('0x48')]['xmd-queue'])||!_['isNil'](_0x18789d['variable'][_0x0e0d('0x54')])){utils[_0x0e0d('0x6')](util[_0x0e0d('0x7')](_0x0e0d('0x52'),_0x18789d[_0x0e0d('0x9')],!_[_0x0e0d('0x20')](_0x18789d[_0x0e0d('0x48')]['xmd-queue'])?'xmd-queue':_0x0e0d('0x54'),_0x18789d[_0x0e0d('0x4b')]));channels[_0x18789d['uniqueid']][_0x0e0d('0x55')]=_0x0e0d('0x56');channels[_0x18789d['uniqueid']][_0x0e0d('0x57')]=_0x18789d[_0x0e0d('0x4b')];channels[_0x18789d[_0x0e0d('0x9')]][_0x0e0d('0xb')]=!![];}if(!_['isNil'](_0x18789d['variable'][_0x0e0d('0x58')])){utils[_0x0e0d('0x6')](util['format'](_0x0e0d('0x59'),_0x18789d[_0x0e0d('0x9')],_0x18789d[_0x0e0d('0x4b')]));channels[_0x18789d[_0x0e0d('0x9')]]['ContactId']=_0x18789d[_0x0e0d('0x4b')];}if(!_[_0x0e0d('0x20')](_0x18789d['variable'][_0x0e0d('0x5a')])){utils['info'](util[_0x0e0d('0x7')](_0x0e0d('0x5b'),_0x18789d[_0x0e0d('0x9')],_0x18789d[_0x0e0d('0x4b')]));channels[_0x18789d[_0x0e0d('0x9')]][_0x0e0d('0x5c')]=_0x18789d[_0x0e0d('0x4b')];}if(!_[_0x0e0d('0x20')](_0x18789d[_0x0e0d('0x48')][_0x0e0d('0x5d')])){utils[_0x0e0d('0x6')](util['format']('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x18789d[_0x0e0d('0x9')],_0x18789d['value']));channels[_0x18789d['uniqueid']]['routeid']=_0x18789d[_0x0e0d('0x4b')];}if(!_[_0x0e0d('0x20')](_0x18789d[_0x0e0d('0x48')][_0x0e0d('0x5e')])){utils[_0x0e0d('0x6')](util[_0x0e0d('0x7')](_0x0e0d('0x5f'),_0x18789d[_0x0e0d('0x9')],_0x18789d[_0x0e0d('0x4b')]));channels[_0x18789d[_0x0e0d('0x9')]][_0x0e0d('0x5e')]=_0x18789d[_0x0e0d('0x4b')];}}}catch(_0x4a8622){utils[_0x0e0d('0x1d')](util[_0x0e0d('0x7')](_0x0e0d('0x47'),_0x18789d['uniqueid']),_0x4a8622);}};exports[_0x0e0d('0x60')]=function(_0x53b0b5){try{if(!_[_0x0e0d('0x20')](channels[_0x53b0b5['uniqueid']])){utils['debug'](util[_0x0e0d('0x7')]('[%s][calls][newexten]',_0x53b0b5[_0x0e0d('0x9')]),_0x53b0b5);utils[_0x0e0d('0x6')](util[_0x0e0d('0x7')](_0x0e0d('0x61'),_0x53b0b5[_0x0e0d('0x9')],_0x53b0b5[_0x0e0d('0x62')],_0x53b0b5['appdata']));if(_0x53b0b5[_0x0e0d('0x62')]['toLowerCase']()==_0x0e0d('0x63')&&_[_0x0e0d('0x64')](_0x53b0b5[_0x0e0d('0x65')][_0x0e0d('0x66')](),'cdr')){var _0x2dba19=_0x53b0b5['appdata']['split']('=');var _0x446e36=_0x2dba19[0x0]['substring'](_0x2dba19[0x0]['lastIndexOf']('(')+0x1,_0x2dba19[0x0][_0x0e0d('0x67')](')'));var _0x12b72c=_0x2dba19[0x1];channels[_0x53b0b5[_0x0e0d('0x9')]][_0x446e36]=_0x12b72c;}if(!_[_0x0e0d('0x68')]([_0x0e0d('0x69'),'noop',_0x0e0d('0x6a'),_0x0e0d('0x63'),_0x0e0d('0x6b')],_0x53b0b5[_0x0e0d('0x62')]['toLowerCase']())){channels[_0x53b0b5['uniqueid']][_0x0e0d('0x55')]=_0x53b0b5[_0x0e0d('0x62')];channels[_0x53b0b5['uniqueid']]['lastdata']=_0x53b0b5[_0x0e0d('0x65')];}}}catch(_0x3ade66){utils['error'](util[_0x0e0d('0x7')](_0x0e0d('0x6c'),_0x53b0b5[_0x0e0d('0x9')]),_0x3ade66);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index e738a7d..ec4303d 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 _0xe7a6=['fullybooted','[core]\x20fullybooted','error','close','[core]\x20close','./utils','connect','info','shutdown','[core]\x20shutdown'];(function(_0x1ea952,_0x2a5ee6){var _0x1415e6=function(_0x39e1c4){while(--_0x39e1c4){_0x1ea952['push'](_0x1ea952['shift']());}};_0x1415e6(++_0x2a5ee6);}(_0xe7a6,0xff));var _0x6e7a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe7a6[_0x321bb2];return _0x9c12ed;};'use strict';var utils=require(_0x6e7a('0x0'));exports[_0x6e7a('0x1')]=function(){utils[_0x6e7a('0x2')]('[core]\x20connected');};exports[_0x6e7a('0x3')]=function(){utils[_0x6e7a('0x2')](_0x6e7a('0x4'));};exports[_0x6e7a('0x5')]=function(){utils[_0x6e7a('0x2')](_0x6e7a('0x6'));};exports[_0x6e7a('0x7')]=function(_0x358095){utils[_0x6e7a('0x7')]('[core]\x20error',_0x358095);};exports[_0x6e7a('0x8')]=function(){utils[_0x6e7a('0x2')](_0x6e7a('0x9'));};exports['managerevent']=function(_0x304f74){}; \ No newline at end of file +var _0x1fb5=['[core]\x20error','close','[core]\x20close','managerevent','./utils','shutdown','info','fullybooted','[core]\x20fullybooted','error'];(function(_0x1d0be2,_0xdeab6c){var _0x52cce2=function(_0x326be7){while(--_0x326be7){_0x1d0be2['push'](_0x1d0be2['shift']());}};_0x52cce2(++_0xdeab6c);}(_0x1fb5,0xa4));var _0x51fb=function(_0x1e821b,_0x57680d){_0x1e821b=_0x1e821b-0x0;var _0x3c5700=_0x1fb5[_0x1e821b];return _0x3c5700;};'use strict';var utils=require(_0x51fb('0x0'));exports['connect']=function(){utils['info']('[core]\x20connected');};exports[_0x51fb('0x1')]=function(){utils[_0x51fb('0x2')]('[core]\x20shutdown');};exports[_0x51fb('0x3')]=function(){utils[_0x51fb('0x2')](_0x51fb('0x4'));};exports[_0x51fb('0x5')]=function(_0x321318){utils[_0x51fb('0x5')](_0x51fb('0x6'),_0x321318);};exports[_0x51fb('0x7')]=function(){utils[_0x51fb('0x2')](_0x51fb('0x8'));};exports[_0x51fb('0x9')]=function(_0x22ea3a){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 4a0b591..ee6dd2e 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 _0xef04=['calleridnum','connectedlinenum','dialstatus','request','newexten','debug','format','[%s][dials][newexten]','application','appdata','toLowerCase','set','cdr(routeid)','split','error','varset','variable','outboundrouteid','info','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','isNil','[%s][dials][dialbegin]','assign','starttime','now','dialend','ANSWER','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid'];(function(_0x8e62a3,_0x52b95e){var _0x9f8255=function(_0x22660a){while(--_0x22660a){_0x8e62a3['push'](_0x8e62a3['shift']());}};_0x9f8255(++_0x52b95e);}(_0xef04,0xc3));var _0x4ef0=function(_0xeb7fc7,_0x1a9dfb){_0xeb7fc7=_0xeb7fc7-0x0;var _0x2288c9=_0xef04[_0xeb7fc7];return _0x2288c9;};'use strict';var _=require(_0x4ef0('0x0'));var util=require(_0x4ef0('0x1'));var utils=require(_0x4ef0('0x2'));var dials={};function writeDB(_0x1d49a7){utils['info'](util['format'](_0x4ef0('0x3'),_0x1d49a7[_0x4ef0('0x4')],_0x1d49a7['channel'],_0x1d49a7['dialstring'],_0x1d49a7[_0x4ef0('0x5')],_0x1d49a7[_0x4ef0('0x6')],_0x1d49a7[_0x4ef0('0x7')]));utils[_0x4ef0('0x8')]('CreateVoiceDialReport',_0x1d49a7);delete dials[_0x1d49a7[_0x4ef0('0x4')]];}exports[_0x4ef0('0x9')]=function(_0x260c27){try{utils[_0x4ef0('0xa')](util[_0x4ef0('0xb')](_0x4ef0('0xc'),_0x260c27[_0x4ef0('0x4')]),_0x260c27);utils['info'](util[_0x4ef0('0xb')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x260c27[_0x4ef0('0x4')],_0x260c27[_0x4ef0('0xd')],_0x260c27[_0x4ef0('0xe')]));if(_0x260c27['application'][_0x4ef0('0xf')]()==_0x4ef0('0x10')&&_['startsWith'](_0x260c27[_0x4ef0('0xe')][_0x4ef0('0xf')](),_0x4ef0('0x11'))){var _0x1965cc=_0x260c27[_0x4ef0('0xe')][_0x4ef0('0x12')]('=');dials[_0x260c27[_0x4ef0('0x4')]]={'routeId':_0x1965cc[0x1]};}}catch(_0x4e79a9){utils[_0x4ef0('0x13')](util[_0x4ef0('0xb')](_0x4ef0('0xc'),_0x260c27[_0x4ef0('0x4')]),_0x4e79a9);}};exports[_0x4ef0('0x14')]=function(_0x2ffd6c){try{utils[_0x4ef0('0xa')](util[_0x4ef0('0xb')]('[%s][dials][varset]',_0x2ffd6c[_0x4ef0('0x4')]),_0x2ffd6c);if(!_['isNil'](_0x2ffd6c[_0x4ef0('0x15')][_0x4ef0('0x16')])){utils[_0x4ef0('0x17')](util[_0x4ef0('0xb')](_0x4ef0('0x18'),_0x2ffd6c[_0x4ef0('0x4')],_0x2ffd6c[_0x4ef0('0x19')]));dials[_0x2ffd6c['uniqueid']]={'routeId':_0x2ffd6c[_0x4ef0('0x19')]};}}catch(_0x4cff58){utils[_0x4ef0('0x13')](util[_0x4ef0('0xb')](_0x4ef0('0x1a'),_0x2ffd6c[_0x4ef0('0x4')]),_0x4cff58);}};exports[_0x4ef0('0x1b')]=function(_0x57f59d){try{if(!_[_0x4ef0('0x1c')](dials[_0x57f59d[_0x4ef0('0x4')]])){utils[_0x4ef0('0xa')](util[_0x4ef0('0xb')](_0x4ef0('0x1d'),_0x57f59d[_0x4ef0('0x4')]),_0x57f59d);dials[_0x57f59d[_0x4ef0('0x4')]]=_[_0x4ef0('0x1e')](dials[_0x57f59d[_0x4ef0('0x4')]],_0x57f59d);dials[_0x57f59d[_0x4ef0('0x4')]][_0x4ef0('0x1f')]=utils[_0x4ef0('0x20')]();dials[_0x57f59d[_0x4ef0('0x4')]]['lastevent']='called';utils[_0x4ef0('0x17')](util['format']('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x57f59d[_0x4ef0('0x4')],dials[_0x57f59d[_0x4ef0('0x4')]][_0x4ef0('0x1f')]));}}catch(_0x21f2b7){utils[_0x4ef0('0x13')](util[_0x4ef0('0xb')](_0x4ef0('0x1d'),_0x57f59d[_0x4ef0('0x4')]),_0x21f2b7);}};exports[_0x4ef0('0x21')]=function(_0x47245a){try{if(!_[_0x4ef0('0x1c')](dials[_0x47245a[_0x4ef0('0x4')]])){utils[_0x4ef0('0xa')](util['format']('[%s][dials][dialend]',_0x47245a[_0x4ef0('0x4')]),_0x47245a);dials[_0x47245a[_0x4ef0('0x4')]]['dialstatus']=_0x47245a[_0x4ef0('0x7')];if(_0x47245a[_0x4ef0('0x7')]==_0x4ef0('0x22')){dials[_0x47245a[_0x4ef0('0x4')]]=_[_0x4ef0('0x1e')](dials[_0x47245a[_0x4ef0('0x4')]],_0x47245a);dials[_0x47245a[_0x4ef0('0x4')]]['answertime']=utils[_0x4ef0('0x20')]();dials[_0x47245a[_0x4ef0('0x4')]][_0x4ef0('0x23')]=_0x4ef0('0x24');utils['info'](util[_0x4ef0('0xb')](_0x4ef0('0x25'),_0x47245a[_0x4ef0('0x4')],_0x47245a['dialstatus'],dials[_0x47245a['uniqueid']][_0x4ef0('0x26')]));}else{utils['info'](util[_0x4ef0('0xb')](_0x4ef0('0x27'),_0x47245a[_0x4ef0('0x4')],_0x47245a[_0x4ef0('0x7')]));}}}catch(_0x1bebd5){utils[_0x4ef0('0x13')](util[_0x4ef0('0xb')](_0x4ef0('0x28'),_0x47245a[_0x4ef0('0x4')]),_0x1bebd5);}};exports[_0x4ef0('0x29')]=function(_0x232ea1){try{if(!_[_0x4ef0('0x1c')](dials[_0x232ea1[_0x4ef0('0x4')]])){utils[_0x4ef0('0xa')](util[_0x4ef0('0xb')](_0x4ef0('0x2a'),_0x232ea1[_0x4ef0('0x4')]),_0x232ea1);utils['info'](util[_0x4ef0('0xb')](_0x4ef0('0x2b'),_0x232ea1[_0x4ef0('0x4')],_0x232ea1['calleridnum'],_0x232ea1[_0x4ef0('0x2c')],_0x232ea1['cause-txt']));dials[_0x232ea1[_0x4ef0('0x4')]]=_['assign'](dials[_0x232ea1[_0x4ef0('0x4')]],{'endtime':utils['now'](),'lastevent':_0x4ef0('0x2d')});dials[_0x232ea1[_0x4ef0('0x4')]]['duration']=utils[_0x4ef0('0x2e')](dials[_0x232ea1[_0x4ef0('0x4')]][_0x4ef0('0x2f')],dials[_0x232ea1[_0x4ef0('0x4')]]['starttime']);dials[_0x232ea1[_0x4ef0('0x4')]][_0x4ef0('0x30')]=utils[_0x4ef0('0x2e')](dials[_0x232ea1[_0x4ef0('0x4')]]['answertime']||dials[_0x232ea1[_0x4ef0('0x4')]][_0x4ef0('0x2f')],dials[_0x232ea1['uniqueid']][_0x4ef0('0x1f')]);dials[_0x232ea1['uniqueid']][_0x4ef0('0x31')]=dials[_0x232ea1[_0x4ef0('0x4')]][_0x4ef0('0x26')]?utils[_0x4ef0('0x2e')](dials[_0x232ea1['uniqueid']][_0x4ef0('0x2f')],dials[_0x232ea1[_0x4ef0('0x4')]][_0x4ef0('0x26')]):0x0;writeDB(dials[_0x232ea1[_0x4ef0('0x4')]]);}}catch(_0x223730){utils[_0x4ef0('0x13')](util[_0x4ef0('0xb')]('[%s][dials][hangup]',_0x232ea1[_0x4ef0('0x4')]),_0x223730);}}; \ No newline at end of file +var _0x2a41=['application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','dialbegin','[%s][dials][dialbegin]','starttime','lastevent','called','dialend','isNil','[%s][dials][dialend]','ANSWER','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','cause-txt','complete','duration','diffTime','endtime','[%s][dials][hangup]','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s'];(function(_0x34d8f9,_0xb4dffa){var _0x4d8bf2=function(_0x2b9b48){while(--_0x2b9b48){_0x34d8f9['push'](_0x34d8f9['shift']());}};_0x4d8bf2(++_0xb4dffa);}(_0x2a41,0x85));var _0x12a4=function(_0x35c1db,_0xd75c15){_0x35c1db=_0x35c1db-0x0;var _0x4173ff=_0x2a41[_0x35c1db];return _0x4173ff;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x12a4('0x0'));var dials={};function writeDB(_0x44917a){utils[_0x12a4('0x1')](util[_0x12a4('0x2')](_0x12a4('0x3'),_0x44917a[_0x12a4('0x4')],_0x44917a[_0x12a4('0x5')],_0x44917a['dialstring'],_0x44917a['calleridnum'],_0x44917a[_0x12a4('0x6')],_0x44917a[_0x12a4('0x7')]));utils[_0x12a4('0x8')](_0x12a4('0x9'),_0x44917a);delete dials[_0x44917a[_0x12a4('0x4')]];}exports[_0x12a4('0xa')]=function(_0x35abcf){try{utils[_0x12a4('0xb')](util[_0x12a4('0x2')](_0x12a4('0xc'),_0x35abcf['uniqueid']),_0x35abcf);utils[_0x12a4('0x1')](util['format'](_0x12a4('0xd'),_0x35abcf[_0x12a4('0x4')],_0x35abcf[_0x12a4('0xe')],_0x35abcf[_0x12a4('0xf')]));if(_0x35abcf[_0x12a4('0xe')][_0x12a4('0x10')]()==_0x12a4('0x11')&&_[_0x12a4('0x12')](_0x35abcf[_0x12a4('0xf')][_0x12a4('0x10')](),_0x12a4('0x13'))){var _0x4a72e0=_0x35abcf[_0x12a4('0xf')][_0x12a4('0x14')]('=');dials[_0x35abcf['uniqueid']]={'routeId':_0x4a72e0[0x1]};}}catch(_0x552d9e){utils[_0x12a4('0x15')](util[_0x12a4('0x2')]('[%s][dials][newexten]',_0x35abcf[_0x12a4('0x4')]),_0x552d9e);}};exports['varset']=function(_0x7311b0){try{utils['debug'](util[_0x12a4('0x2')](_0x12a4('0x16'),_0x7311b0['uniqueid']),_0x7311b0);if(!_['isNil'](_0x7311b0[_0x12a4('0x17')][_0x12a4('0x18')])){utils[_0x12a4('0x1')](util['format'](_0x12a4('0x19'),_0x7311b0[_0x12a4('0x4')],_0x7311b0['value']));dials[_0x7311b0[_0x12a4('0x4')]]={'routeId':_0x7311b0['value']};}}catch(_0xc5e5f8){utils[_0x12a4('0x15')](util[_0x12a4('0x2')](_0x12a4('0x16'),_0x7311b0[_0x12a4('0x4')]),_0xc5e5f8);}};exports[_0x12a4('0x1a')]=function(_0x11f49d){try{if(!_['isNil'](dials[_0x11f49d[_0x12a4('0x4')]])){utils[_0x12a4('0xb')](util[_0x12a4('0x2')](_0x12a4('0x1b'),_0x11f49d['uniqueid']),_0x11f49d);dials[_0x11f49d[_0x12a4('0x4')]]=_['assign'](dials[_0x11f49d['uniqueid']],_0x11f49d);dials[_0x11f49d[_0x12a4('0x4')]][_0x12a4('0x1c')]=utils['now']();dials[_0x11f49d[_0x12a4('0x4')]][_0x12a4('0x1d')]=_0x12a4('0x1e');utils['info'](util[_0x12a4('0x2')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x11f49d['uniqueid'],dials[_0x11f49d[_0x12a4('0x4')]][_0x12a4('0x1c')]));}}catch(_0x318d2a){utils['error'](util[_0x12a4('0x2')](_0x12a4('0x1b'),_0x11f49d[_0x12a4('0x4')]),_0x318d2a);}};exports[_0x12a4('0x1f')]=function(_0x6d0c00){try{if(!_[_0x12a4('0x20')](dials[_0x6d0c00[_0x12a4('0x4')]])){utils[_0x12a4('0xb')](util[_0x12a4('0x2')](_0x12a4('0x21'),_0x6d0c00[_0x12a4('0x4')]),_0x6d0c00);dials[_0x6d0c00[_0x12a4('0x4')]][_0x12a4('0x7')]=_0x6d0c00[_0x12a4('0x7')];if(_0x6d0c00[_0x12a4('0x7')]==_0x12a4('0x22')){dials[_0x6d0c00[_0x12a4('0x4')]]=_[_0x12a4('0x23')](dials[_0x6d0c00[_0x12a4('0x4')]],_0x6d0c00);dials[_0x6d0c00[_0x12a4('0x4')]][_0x12a4('0x24')]=utils['now']();dials[_0x6d0c00[_0x12a4('0x4')]][_0x12a4('0x1d')]=_0x12a4('0x25');utils[_0x12a4('0x1')](util[_0x12a4('0x2')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x6d0c00[_0x12a4('0x4')],_0x6d0c00[_0x12a4('0x7')],dials[_0x6d0c00['uniqueid']][_0x12a4('0x24')]));}else{utils[_0x12a4('0x1')](util['format'](_0x12a4('0x26'),_0x6d0c00[_0x12a4('0x4')],_0x6d0c00[_0x12a4('0x7')]));}}}catch(_0x2ecea9){utils[_0x12a4('0x15')](util['format'](_0x12a4('0x21'),_0x6d0c00[_0x12a4('0x4')]),_0x2ecea9);}};exports[_0x12a4('0x27')]=function(_0x512c88){try{if(!_[_0x12a4('0x20')](dials[_0x512c88[_0x12a4('0x4')]])){utils[_0x12a4('0xb')](util[_0x12a4('0x2')]('[%s][dials][hangup]',_0x512c88[_0x12a4('0x4')]),_0x512c88);utils[_0x12a4('0x1')](util[_0x12a4('0x2')](_0x12a4('0x28'),_0x512c88[_0x12a4('0x4')],_0x512c88[_0x12a4('0x29')],_0x512c88[_0x12a4('0x2a')],_0x512c88[_0x12a4('0x2b')]));dials[_0x512c88['uniqueid']]=_['assign'](dials[_0x512c88[_0x12a4('0x4')]],{'endtime':utils['now'](),'lastevent':_0x12a4('0x2c')});dials[_0x512c88[_0x12a4('0x4')]][_0x12a4('0x2d')]=utils['diffTime'](dials[_0x512c88[_0x12a4('0x4')]]['endtime'],dials[_0x512c88[_0x12a4('0x4')]][_0x12a4('0x1c')]);dials[_0x512c88[_0x12a4('0x4')]]['holdtime']=utils[_0x12a4('0x2e')](dials[_0x512c88[_0x12a4('0x4')]][_0x12a4('0x24')]||dials[_0x512c88['uniqueid']][_0x12a4('0x2f')],dials[_0x512c88['uniqueid']]['starttime']);dials[_0x512c88[_0x12a4('0x4')]]['billableseconds']=dials[_0x512c88['uniqueid']][_0x12a4('0x24')]?utils[_0x12a4('0x2e')](dials[_0x512c88[_0x12a4('0x4')]][_0x12a4('0x2f')],dials[_0x512c88['uniqueid']][_0x12a4('0x24')]):0x0;writeDB(dials[_0x512c88[_0x12a4('0x4')]]);}}catch(_0x3c32a4){utils['error'](util['format'](_0x12a4('0x30'),_0x512c88[_0x12a4('0x4')]),_0x3c32a4);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 842811c..7820423 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 _0xb6be=['./utils','util','asterisk','port','username','password','xdr','disabled','info','XDR\x20DISABLED','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment'];(function(_0x53cf89,_0x437980){var _0x4928de=function(_0x24c7b9){while(--_0x24c7b9){_0x53cf89['push'](_0x53cf89['shift']());}};_0x4928de(++_0x437980);}(_0xb6be,0x190));var _0xeb6b=function(_0x484c03,_0x13c1d2){_0x484c03=_0x484c03-0x0;var _0x294127=_0xb6be[_0x484c03];return _0x294127;};var AsteriskManager=require(_0xeb6b('0x0'));var config=require(_0xeb6b('0x1'));var utils=require(_0xeb6b('0x2'));var util=require(_0xeb6b('0x3'));var ami=new AsteriskManager(config[_0xeb6b('0x4')][_0xeb6b('0x5')],config[_0xeb6b('0x4')]['ip'],config[_0xeb6b('0x4')][_0xeb6b('0x6')],config[_0xeb6b('0x4')][_0xeb6b('0x7')],!![]);ami['keepConnected']();if(config[_0xeb6b('0x8')]&&config['xdr'][_0xeb6b('0x9')]){utils[_0xeb6b('0xa')](_0xeb6b('0xb'));}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require(_0xeb6b('0xc'));var recordings=require('./recordings.controller');var members=require(_0xeb6b('0xd'));var dials=require(_0xeb6b('0xe'));var transfers=require(_0xeb6b('0xf'));var core=require(_0xeb6b('0x10'));ami['on'](_0xeb6b('0x11'),core['connect']);ami['on'](_0xeb6b('0x12'),core[_0xeb6b('0x12')]);ami['on'](_0xeb6b('0x13'),core[_0xeb6b('0x13')]);ami['on'](_0xeb6b('0x14'),core[_0xeb6b('0x14')]);ami['on']('close',core[_0xeb6b('0x15')]);ami['on']('managerevent',core[_0xeb6b('0x16')]);ami['on'](_0xeb6b('0x17'),function(_0x33f68d){try{utils[_0xeb6b('0x18')](util[_0xeb6b('0x19')](_0xeb6b('0x1a'),_0x33f68d[_0xeb6b('0x1b')]),_0x33f68d);members[_0xeb6b('0x17')](_0x33f68d);}catch(_0x1d521c){utils['error'](util[_0xeb6b('0x19')](_0xeb6b('0x1a'),_0x33f68d[_0xeb6b('0x1b')]),_0x1d521c);}});ami['on'](_0xeb6b('0x1c'),function(_0x20525d){try{utils[_0xeb6b('0x18')](util['format'](_0xeb6b('0x1d'),_0x20525d[_0xeb6b('0x1e')]),_0x20525d);agents[_0xeb6b('0x1c')](_0x20525d);}catch(_0x47379d){utils[_0xeb6b('0x14')](util[_0xeb6b('0x19')](_0xeb6b('0x1d'),_0x20525d[_0xeb6b('0x1e')]),_0x47379d);}});ami['on'](_0xeb6b('0x1f'),function(_0x404272){try{utils[_0xeb6b('0x18')](util['format']('[%s][index][agentringnoanswer]',_0x404272['uniqueid']),_0x404272);agents[_0xeb6b('0x1f')](_0x404272);}catch(_0x596dc0){utils['error'](util[_0xeb6b('0x19')](_0xeb6b('0x20'),_0x404272['uniqueid']),_0x596dc0);}});ami['on'](_0xeb6b('0x21'),function(_0x573dac){try{utils[_0xeb6b('0x18')](util['format'](_0xeb6b('0x22'),_0x573dac[_0xeb6b('0x1e')]),_0x573dac);agents['agentconnect'](_0x573dac);queues[_0xeb6b('0x21')](_0x573dac);}catch(_0x5cc77b){utils[_0xeb6b('0x14')](util['format'](_0xeb6b('0x22'),_0x573dac[_0xeb6b('0x1e')]),_0x5cc77b);}});ami['on']('agentcomplete',function(_0xfa3c62){try{utils[_0xeb6b('0x18')](util[_0xeb6b('0x19')](_0xeb6b('0x23'),_0xfa3c62['uniqueid']),_0xfa3c62);agents[_0xeb6b('0x24')](_0xfa3c62);queues[_0xeb6b('0x24')](_0xfa3c62);members['agentcomplete'](_0xfa3c62);}catch(_0x4e84a5){utils[_0xeb6b('0x14')](util[_0xeb6b('0x19')](_0xeb6b('0x23'),_0xfa3c62['uniqueid']),_0x4e84a5);}});ami['on'](_0xeb6b('0x25'),function(_0x4fac13){try{utils['debug'](util['format']('[%s][index][queuecallerabandon]',_0x4fac13[_0xeb6b('0x1e')]),_0x4fac13);agents[_0xeb6b('0x25')](_0x4fac13);queues[_0xeb6b('0x25')](_0x4fac13);}catch(_0x24686d){utils['error'](util[_0xeb6b('0x19')]('[%s][index][queuecallerabandon]',_0x4fac13[_0xeb6b('0x1e')]),_0x24686d);}});ami['on'](_0xeb6b('0x26'),function(_0x424821){try{utils['debug'](util['format'](_0xeb6b('0x27'),_0x424821['uniqueid']),_0x424821);queues[_0xeb6b('0x26')](_0x424821);recordings[_0xeb6b('0x26')](_0x424821);}catch(_0x410510){utils[_0xeb6b('0x14')](util[_0xeb6b('0x19')](_0xeb6b('0x27'),_0x424821[_0xeb6b('0x1e')]),_0x410510);}});ami['on'](_0xeb6b('0x28'),function(_0x142024){try{utils[_0xeb6b('0x18')](util['format'](_0xeb6b('0x29'),_0x142024['uniqueid']),_0x142024);queues[_0xeb6b('0x28')](_0x142024);}catch(_0x1be62b){utils[_0xeb6b('0x14')](util[_0xeb6b('0x19')]('[%s][index][queuecallerleave]',_0x142024[_0xeb6b('0x1e')]),_0x1be62b);}});ami['on']('musiconholdstart',function(_0x2c0eb9){try{utils[_0xeb6b('0x18')](util[_0xeb6b('0x19')](_0xeb6b('0x2a'),_0x2c0eb9[_0xeb6b('0x1e')]),_0x2c0eb9);queues[_0xeb6b('0x2b')](_0x2c0eb9);calls['musiconholdstart'](_0x2c0eb9);}catch(_0x10facd){utils[_0xeb6b('0x14')](util['format']('[%s][index][musiconholdstart]',_0x2c0eb9[_0xeb6b('0x1e')]),_0x10facd);}});ami['on'](_0xeb6b('0x2c'),function(_0x294f07){try{utils['debug'](util[_0xeb6b('0x19')](_0xeb6b('0x2d'),_0x294f07['uniqueid']),_0x294f07);queues[_0xeb6b('0x2c')](_0x294f07);calls[_0xeb6b('0x2c')](_0x294f07);}catch(_0x33cb20){utils['error'](util[_0xeb6b('0x19')](_0xeb6b('0x2d'),_0x294f07['uniqueid']),_0x33cb20);}});ami['on']('newstate',function(_0x37ef03){try{utils[_0xeb6b('0x18')](util[_0xeb6b('0x19')](_0xeb6b('0x2e'),_0x37ef03[_0xeb6b('0x1e')]),_0x37ef03);calls[_0xeb6b('0x2f')](_0x37ef03);recordings[_0xeb6b('0x2f')](_0x37ef03);}catch(_0x3dca51){utils[_0xeb6b('0x14')](util[_0xeb6b('0x19')](_0xeb6b('0x2e'),_0x37ef03[_0xeb6b('0x1e')]),_0x3dca51);}});ami['on'](_0xeb6b('0x30'),function(_0x18e7c4){try{utils['debug'](util['format']('[%s][index][hangup]',_0x18e7c4[_0xeb6b('0x1e')]),_0x18e7c4);calls[_0xeb6b('0x30')](_0x18e7c4);recordings[_0xeb6b('0x30')](_0x18e7c4);dials[_0xeb6b('0x30')](_0x18e7c4);agents[_0xeb6b('0x30')](_0x18e7c4);queues['hangup'](_0x18e7c4);}catch(_0x47cbf8){utils[_0xeb6b('0x14')](util[_0xeb6b('0x19')](_0xeb6b('0x31'),_0x18e7c4['uniqueid']),_0x47cbf8);}});ami['on'](_0xeb6b('0x32'),function(_0x3ca9b0){try{utils['debug'](util['format']('[%s][index][cdr]',_0x3ca9b0['uniqueid']),_0x3ca9b0);members[_0xeb6b('0x32')](_0x3ca9b0);}catch(_0x7b043){utils[_0xeb6b('0x14')](util[_0xeb6b('0x19')]('[%s][index][cdr]',_0x3ca9b0[_0xeb6b('0x1e')]),_0x7b043);}});ami['on'](_0xeb6b('0x33'),function(_0x4afa4b){try{utils[_0xeb6b('0x18')](util[_0xeb6b('0x19')](_0xeb6b('0x34'),_0x4afa4b[_0xeb6b('0x1e')]),_0x4afa4b);queues['blindtransfer'](_0x4afa4b);agents[_0xeb6b('0x33')](_0x4afa4b);transfers['blindtransfer'](_0x4afa4b);}catch(_0xb8198f){utils['error'](util['format']('[%s][index][blindtransfer]',_0x4afa4b[_0xeb6b('0x1e')]),_0xb8198f);}});ami['on'](_0xeb6b('0x35'),function(_0x233cc9){try{utils[_0xeb6b('0x18')](util[_0xeb6b('0x19')](_0xeb6b('0x36'),_0x233cc9[_0xeb6b('0x37')]),_0x233cc9);queues[_0xeb6b('0x35')](_0x233cc9);transfers[_0xeb6b('0x35')](_0x233cc9);agents[_0xeb6b('0x35')](_0x233cc9);calls[_0xeb6b('0x35')](_0x233cc9);}catch(_0x2b5475){utils[_0xeb6b('0x14')](util[_0xeb6b('0x19')](_0xeb6b('0x36'),_0x233cc9['origtransfereruniqueid']),_0x2b5475);}});ami['on'](_0xeb6b('0x38'),function(_0xacdb6c){try{utils['debug'](util[_0xeb6b('0x19')](_0xeb6b('0x39'),_0xacdb6c[_0xeb6b('0x1e')]),_0xacdb6c);queues[_0xeb6b('0x38')](_0xacdb6c);recordings['varset'](_0xacdb6c);calls[_0xeb6b('0x38')](_0xacdb6c);dials[_0xeb6b('0x38')](_0xacdb6c);}catch(_0x1c2f24){utils[_0xeb6b('0x14')](util['format']('[%s][index][varset]',_0xacdb6c[_0xeb6b('0x1e')]),_0x1c2f24);}});ami['on']('newexten',function(_0x1a2b26){try{utils['debug'](util[_0xeb6b('0x19')](_0xeb6b('0x3a'),_0x1a2b26[_0xeb6b('0x1e')]),_0x1a2b26);calls[_0xeb6b('0x3b')](_0x1a2b26);recordings[_0xeb6b('0x3b')](_0x1a2b26);dials[_0xeb6b('0x3b')](_0x1a2b26);}catch(_0x55d72d){utils[_0xeb6b('0x14')](util[_0xeb6b('0x19')]('[%s][index][newexten]',_0x1a2b26[_0xeb6b('0x1e')]),_0x55d72d);}});ami['on'](_0xeb6b('0x3c'),function(_0x14739f){try{utils[_0xeb6b('0x18')](util[_0xeb6b('0x19')](_0xeb6b('0x3d'),_0x14739f[_0xeb6b('0x1e')]),_0x14739f);calls[_0xeb6b('0x3c')](_0x14739f);recordings[_0xeb6b('0x3c')](_0x14739f);}catch(_0x145771){utils[_0xeb6b('0x14')](util[_0xeb6b('0x19')](_0xeb6b('0x3d'),_0x14739f[_0xeb6b('0x1e')]),_0x145771);}});ami['on'](_0xeb6b('0x3e'),function(_0x40db98){try{utils[_0xeb6b('0x18')](util[_0xeb6b('0x19')](_0xeb6b('0x3f'),_0x40db98[_0xeb6b('0x1e')]),_0x40db98);dials[_0xeb6b('0x3e')](_0x40db98);}catch(_0x531813){utils['error'](util[_0xeb6b('0x19')](_0xeb6b('0x40'),_0x40db98['uniqueid']),_0x531813);}});ami['on'](_0xeb6b('0x41'),function(_0x5ede6a){try{utils[_0xeb6b('0x18')](util[_0xeb6b('0x19')](_0xeb6b('0x42'),_0x5ede6a[_0xeb6b('0x1e')]),_0x5ede6a);dials[_0xeb6b('0x41')](_0x5ede6a);}catch(_0x9f36ca){utils['error'](util[_0xeb6b('0x19')](_0xeb6b('0x42'),_0x5ede6a['uniqueid']),_0x9f36ca);}});} \ No newline at end of file +var _0x34ca=['[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','hangup','[%s][index][hangup]','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','port','asterisk','xdr','disabled','info','XDR\x20DISABLED','./queues.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','device','[%s][index][devicestatechange]','agentcalled'];(function(_0x3c0a1b,_0x5a452){var _0x38c9df=function(_0x524383){while(--_0x524383){_0x3c0a1b['push'](_0x3c0a1b['shift']());}};_0x38c9df(++_0x5a452);}(_0x34ca,0xdf));var _0xa34c=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x34ca[_0x126558];return _0x1f6d14;};var AsteriskManager=require(_0xa34c('0x0'));var config=require(_0xa34c('0x1'));var utils=require('./utils');var util=require(_0xa34c('0x2'));var ami=new AsteriskManager(config['asterisk'][_0xa34c('0x3')],config[_0xa34c('0x4')]['ip'],config['asterisk']['username'],config[_0xa34c('0x4')]['password'],!![]);ami['keepConnected']();if(config[_0xa34c('0x5')]&&config[_0xa34c('0x5')][_0xa34c('0x6')]){utils[_0xa34c('0x7')](_0xa34c('0x8'));}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require(_0xa34c('0x9'));var recordings=require('./recordings.controller');var members=require(_0xa34c('0xa'));var dials=require(_0xa34c('0xb'));var transfers=require(_0xa34c('0xc'));var core=require('./core.controller');ami['on'](_0xa34c('0xd'),core[_0xa34c('0xd')]);ami['on'](_0xa34c('0xe'),core[_0xa34c('0xe')]);ami['on'](_0xa34c('0xf'),core['fullybooted']);ami['on'](_0xa34c('0x10'),core[_0xa34c('0x10')]);ami['on'](_0xa34c('0x11'),core[_0xa34c('0x11')]);ami['on'](_0xa34c('0x12'),core[_0xa34c('0x12')]);ami['on'](_0xa34c('0x13'),function(_0x17fc9a){try{utils[_0xa34c('0x14')](util[_0xa34c('0x15')]('[%s][index][devicestatechange]',_0x17fc9a[_0xa34c('0x16')]),_0x17fc9a);members['devicestatechange'](_0x17fc9a);}catch(_0x490c12){utils[_0xa34c('0x10')](util[_0xa34c('0x15')](_0xa34c('0x17'),_0x17fc9a[_0xa34c('0x16')]),_0x490c12);}});ami['on'](_0xa34c('0x18'),function(_0x5ec685){try{utils[_0xa34c('0x14')](util[_0xa34c('0x15')](_0xa34c('0x19'),_0x5ec685[_0xa34c('0x1a')]),_0x5ec685);agents[_0xa34c('0x18')](_0x5ec685);}catch(_0x111aeb){utils['error'](util[_0xa34c('0x15')](_0xa34c('0x19'),_0x5ec685[_0xa34c('0x1a')]),_0x111aeb);}});ami['on'](_0xa34c('0x1b'),function(_0x4dc404){try{utils[_0xa34c('0x14')](util['format'](_0xa34c('0x1c'),_0x4dc404[_0xa34c('0x1a')]),_0x4dc404);agents[_0xa34c('0x1b')](_0x4dc404);}catch(_0x54b11a){utils[_0xa34c('0x10')](util[_0xa34c('0x15')](_0xa34c('0x1c'),_0x4dc404[_0xa34c('0x1a')]),_0x54b11a);}});ami['on'](_0xa34c('0x1d'),function(_0x258a06){try{utils['debug'](util[_0xa34c('0x15')](_0xa34c('0x1e'),_0x258a06['uniqueid']),_0x258a06);agents[_0xa34c('0x1d')](_0x258a06);queues['agentconnect'](_0x258a06);}catch(_0x17410c){utils['error'](util['format'](_0xa34c('0x1e'),_0x258a06[_0xa34c('0x1a')]),_0x17410c);}});ami['on'](_0xa34c('0x1f'),function(_0x171c85){try{utils[_0xa34c('0x14')](util['format'](_0xa34c('0x20'),_0x171c85[_0xa34c('0x1a')]),_0x171c85);agents[_0xa34c('0x1f')](_0x171c85);queues[_0xa34c('0x1f')](_0x171c85);members[_0xa34c('0x1f')](_0x171c85);}catch(_0x48f0fd){utils['error'](util[_0xa34c('0x15')]('[%s][index][agentcomplete]',_0x171c85[_0xa34c('0x1a')]),_0x48f0fd);}});ami['on'](_0xa34c('0x21'),function(_0x1a68ae){try{utils[_0xa34c('0x14')](util[_0xa34c('0x15')](_0xa34c('0x22'),_0x1a68ae[_0xa34c('0x1a')]),_0x1a68ae);agents[_0xa34c('0x21')](_0x1a68ae);queues[_0xa34c('0x21')](_0x1a68ae);}catch(_0x1f095a){utils[_0xa34c('0x10')](util[_0xa34c('0x15')](_0xa34c('0x22'),_0x1a68ae[_0xa34c('0x1a')]),_0x1f095a);}});ami['on'](_0xa34c('0x23'),function(_0x24fafa){try{utils[_0xa34c('0x14')](util[_0xa34c('0x15')]('[%s][index][queuecallerjoin]',_0x24fafa[_0xa34c('0x1a')]),_0x24fafa);queues[_0xa34c('0x23')](_0x24fafa);recordings[_0xa34c('0x23')](_0x24fafa);}catch(_0x463827){utils[_0xa34c('0x10')](util[_0xa34c('0x15')]('[%s][index][queuecallerjoin]',_0x24fafa[_0xa34c('0x1a')]),_0x463827);}});ami['on'](_0xa34c('0x24'),function(_0xfd162e){try{utils[_0xa34c('0x14')](util[_0xa34c('0x15')](_0xa34c('0x25'),_0xfd162e[_0xa34c('0x1a')]),_0xfd162e);queues[_0xa34c('0x24')](_0xfd162e);}catch(_0x473465){utils[_0xa34c('0x10')](util[_0xa34c('0x15')](_0xa34c('0x25'),_0xfd162e[_0xa34c('0x1a')]),_0x473465);}});ami['on'](_0xa34c('0x26'),function(_0x18a831){try{utils['debug'](util[_0xa34c('0x15')](_0xa34c('0x27'),_0x18a831[_0xa34c('0x1a')]),_0x18a831);queues[_0xa34c('0x26')](_0x18a831);calls[_0xa34c('0x26')](_0x18a831);}catch(_0x2b124c){utils[_0xa34c('0x10')](util[_0xa34c('0x15')]('[%s][index][musiconholdstart]',_0x18a831[_0xa34c('0x1a')]),_0x2b124c);}});ami['on'](_0xa34c('0x28'),function(_0x522c9e){try{utils[_0xa34c('0x14')](util[_0xa34c('0x15')]('[%s][index][musiconholdstop]',_0x522c9e['uniqueid']),_0x522c9e);queues[_0xa34c('0x28')](_0x522c9e);calls[_0xa34c('0x28')](_0x522c9e);}catch(_0x11d0fc){utils[_0xa34c('0x10')](util['format'](_0xa34c('0x29'),_0x522c9e[_0xa34c('0x1a')]),_0x11d0fc);}});ami['on'](_0xa34c('0x2a'),function(_0x1f4894){try{utils[_0xa34c('0x14')](util[_0xa34c('0x15')]('[%s][index][newstate]',_0x1f4894[_0xa34c('0x1a')]),_0x1f4894);calls['newstate'](_0x1f4894);recordings[_0xa34c('0x2a')](_0x1f4894);}catch(_0x134bcb){utils['error'](util[_0xa34c('0x15')]('[%s][index][newstate]',_0x1f4894[_0xa34c('0x1a')]),_0x134bcb);}});ami['on'](_0xa34c('0x2b'),function(_0x526f1f){try{utils[_0xa34c('0x14')](util['format'](_0xa34c('0x2c'),_0x526f1f[_0xa34c('0x1a')]),_0x526f1f);calls[_0xa34c('0x2b')](_0x526f1f);recordings[_0xa34c('0x2b')](_0x526f1f);dials[_0xa34c('0x2b')](_0x526f1f);agents[_0xa34c('0x2b')](_0x526f1f);queues[_0xa34c('0x2b')](_0x526f1f);}catch(_0x57cc5f){utils['error'](util[_0xa34c('0x15')](_0xa34c('0x2c'),_0x526f1f[_0xa34c('0x1a')]),_0x57cc5f);}});ami['on']('cdr',function(_0x59a100){try{utils[_0xa34c('0x14')](util[_0xa34c('0x15')]('[%s][index][cdr]',_0x59a100['uniqueid']),_0x59a100);members['cdr'](_0x59a100);}catch(_0x16e8b5){utils[_0xa34c('0x10')](util[_0xa34c('0x15')](_0xa34c('0x2d'),_0x59a100[_0xa34c('0x1a')]),_0x16e8b5);}});ami['on'](_0xa34c('0x2e'),function(_0x4cc865){try{utils[_0xa34c('0x14')](util[_0xa34c('0x15')](_0xa34c('0x2f'),_0x4cc865[_0xa34c('0x1a')]),_0x4cc865);queues[_0xa34c('0x2e')](_0x4cc865);agents[_0xa34c('0x2e')](_0x4cc865);transfers[_0xa34c('0x2e')](_0x4cc865);}catch(_0x4aaa8e){utils[_0xa34c('0x10')](util[_0xa34c('0x15')](_0xa34c('0x2f'),_0x4cc865[_0xa34c('0x1a')]),_0x4aaa8e);}});ami['on'](_0xa34c('0x30'),function(_0x1f0496){try{utils[_0xa34c('0x14')](util[_0xa34c('0x15')](_0xa34c('0x31'),_0x1f0496[_0xa34c('0x32')]),_0x1f0496);queues[_0xa34c('0x30')](_0x1f0496);transfers[_0xa34c('0x30')](_0x1f0496);agents[_0xa34c('0x30')](_0x1f0496);calls[_0xa34c('0x30')](_0x1f0496);}catch(_0x1ff256){utils[_0xa34c('0x10')](util['format'](_0xa34c('0x31'),_0x1f0496[_0xa34c('0x32')]),_0x1ff256);}});ami['on'](_0xa34c('0x33'),function(_0x5b1dd4){try{utils['debug'](util[_0xa34c('0x15')](_0xa34c('0x34'),_0x5b1dd4[_0xa34c('0x1a')]),_0x5b1dd4);queues[_0xa34c('0x33')](_0x5b1dd4);recordings[_0xa34c('0x33')](_0x5b1dd4);calls[_0xa34c('0x33')](_0x5b1dd4);dials[_0xa34c('0x33')](_0x5b1dd4);}catch(_0x3ba8ed){utils[_0xa34c('0x10')](util[_0xa34c('0x15')](_0xa34c('0x34'),_0x5b1dd4[_0xa34c('0x1a')]),_0x3ba8ed);}});ami['on'](_0xa34c('0x35'),function(_0x2237f7){try{utils[_0xa34c('0x14')](util[_0xa34c('0x15')](_0xa34c('0x36'),_0x2237f7[_0xa34c('0x1a')]),_0x2237f7);calls[_0xa34c('0x35')](_0x2237f7);recordings[_0xa34c('0x35')](_0x2237f7);dials[_0xa34c('0x35')](_0x2237f7);}catch(_0x47e851){utils[_0xa34c('0x10')](util[_0xa34c('0x15')](_0xa34c('0x36'),_0x2237f7[_0xa34c('0x1a')]),_0x47e851);}});ami['on'](_0xa34c('0x37'),function(_0x1f4d03){try{utils['debug'](util[_0xa34c('0x15')]('[%s][index][newchannel]',_0x1f4d03[_0xa34c('0x1a')]),_0x1f4d03);calls[_0xa34c('0x37')](_0x1f4d03);recordings['newchannel'](_0x1f4d03);}catch(_0x5b6b50){utils[_0xa34c('0x10')](util['format'](_0xa34c('0x38'),_0x1f4d03['uniqueid']),_0x5b6b50);}});ami['on']('dialbegin',function(_0x49fca5){try{utils[_0xa34c('0x14')](util[_0xa34c('0x15')](_0xa34c('0x39'),_0x49fca5['uniqueid']),_0x49fca5);dials[_0xa34c('0x3a')](_0x49fca5);}catch(_0x492998){utils[_0xa34c('0x10')](util['format'](_0xa34c('0x3b'),_0x49fca5[_0xa34c('0x1a')]),_0x492998);}});ami['on'](_0xa34c('0x3c'),function(_0x3f5401){try{utils[_0xa34c('0x14')](util['format'](_0xa34c('0x3d'),_0x3f5401['uniqueid']),_0x3f5401);dials[_0xa34c('0x3c')](_0x3f5401);}catch(_0x5dd4e3){utils[_0xa34c('0x10')](util['format']('[%s][index][dialend]',_0x3f5401[_0xa34c('0x1a')]),_0x5dd4e3);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 2758901..1f5d4a7 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 _0x2dab=['internal','request','CreateMemberReport','getUserByName','split','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','INUSE','BUSY','voice','TALKING','now','agent','isNil','exitAt','duration','enterAt','agentcomplete','[%s][members][agentcomplete]','queue','assign','cdr','[%s][members][cdr]','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','Queue:','info','format','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','name'];(function(_0x7201c2,_0x240b68){var _0x5c6583=function(_0x150854){while(--_0x150854){_0x7201c2['push'](_0x7201c2['shift']());}};_0x5c6583(++_0x240b68);}(_0x2dab,0x151));var _0xb2da=function(_0x5993e3,_0x553ef3){_0x5993e3=_0x5993e3-0x0;var _0x206102=_0x2dab[_0x5993e3];return _0x206102;};'use strict';var _=require(_0xb2da('0x0'));var util=require('util');var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer',_0xb2da('0x1')];function writeDB(_0x2fc50d){utils[_0xb2da('0x2')](util[_0xb2da('0x3')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x2fc50d[_0xb2da('0x4')],_0x2fc50d[_0xb2da('0x5')],_0x2fc50d[_0xb2da('0x6')],_0x2fc50d[_0xb2da('0x7')],_0x2fc50d[_0xb2da('0x8')],_0x2fc50d[_0xb2da('0x9')]));if(_0x2fc50d[_0xb2da('0x5')]){utils[_0xb2da('0xa')](_0x2fc50d[_0xb2da('0x5')])[_0xb2da('0xb')](function(_0x986185){if(_0x986185){_0x2fc50d[_0xb2da('0x8')]=_0x986185[_0xb2da('0xc')];_0x2fc50d['internal']=_0x986185[_0xb2da('0xd')];utils[_0xb2da('0xe')](_0xb2da('0xf'),_0x2fc50d);}else{utils[_0xb2da('0x10')](_0x2fc50d[_0xb2da('0x5')][_0xb2da('0x11')]('/')[0x1])['then'](function(_0x3c6b25){if(_0x3c6b25){_0x2fc50d[_0xb2da('0x8')]=_0x3c6b25[_0xb2da('0xc')];_0x2fc50d[_0xb2da('0xd')]=_0x3c6b25['internal'];utils[_0xb2da('0xe')](_0xb2da('0xf'),_0x2fc50d);}});}})[_0xb2da('0x12')](function(_0x391f38){utils[_0xb2da('0x13')](util[_0xb2da('0x3')](_0xb2da('0x14'),_0x2fc50d[_0xb2da('0x4')]),_0x391f38);});}delete members[_0x2fc50d['interface']];}function startsWith(_0x20a041,_0x5aa73f){return _[_0xb2da('0x15')](_0x20a041,function(_0x5e863a){return _[_0xb2da('0x16')](_0x5aa73f,_0x5e863a);});}exports[_0xb2da('0x17')]=function(_0x32aa94){try{utils[_0xb2da('0x18')](util[_0xb2da('0x3')](_0xb2da('0x19'),members[_0x32aa94['device']]?members[_0x32aa94[_0xb2da('0x1a')]]['uniqueid']:_0x32aa94[_0xb2da('0x1a')]),_0x32aa94);utils[_0xb2da('0x2')](util['format'](_0xb2da('0x1b'),members[_0x32aa94[_0xb2da('0x1a')]]?members[_0x32aa94['device']]['uniqueid']:_0x32aa94['device'],_0x32aa94['state'],_0x32aa94[_0xb2da('0x1a')]));switch(_0x32aa94['state']){case _0xb2da('0x1c'):case _0xb2da('0x1d'):if(!startsWith(exclude,_0x32aa94['device'])){members[_0x32aa94['device']]={'channel':_0xb2da('0x1e'),'interface':_0x32aa94[_0xb2da('0x1a')],'type':_0xb2da('0x1f'),'enterAt':utils[_0xb2da('0x20')](),'role':_0xb2da('0x21')};}break;case'NOT_INUSE':if(!_[_0xb2da('0x22')](members[_0x32aa94[_0xb2da('0x1a')]])){members[_0x32aa94[_0xb2da('0x1a')]][_0xb2da('0x23')]=utils[_0xb2da('0x20')]();members[_0x32aa94[_0xb2da('0x1a')]][_0xb2da('0x24')]=utils['diffTime'](members[_0x32aa94['device']][_0xb2da('0x23')],members[_0x32aa94[_0xb2da('0x1a')]][_0xb2da('0x25')]);if(members[_0x32aa94['device']][_0xb2da('0x4')]){writeDB(members[_0x32aa94['device']]);}}break;default:break;}}catch(_0x196fe3){utils[_0xb2da('0x13')](util[_0xb2da('0x3')](_0xb2da('0x19'),members[_0x32aa94['device']]?members[_0x32aa94[_0xb2da('0x1a')]]['uniqueid']:_0x32aa94[_0xb2da('0x1a')]),_0x196fe3);}};exports[_0xb2da('0x26')]=function(_0x2af692){try{if(!_[_0xb2da('0x22')](members[_0x2af692['interface']])){utils[_0xb2da('0x18')](util[_0xb2da('0x3')](_0xb2da('0x27'),_0x2af692['uniqueid']),_0x2af692);utils[_0xb2da('0x2')](util[_0xb2da('0x3')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x2af692[_0xb2da('0x4')],_0x2af692['interface'],_0x2af692[_0xb2da('0x28')]));members[_0x2af692[_0xb2da('0x5')]]=_[_0xb2da('0x29')](members[_0x2af692[_0xb2da('0x5')]],{'data4':_0x2af692[_0xb2da('0x28')],'uniqueid':_0x2af692[_0xb2da('0x4')]});}}catch(_0x1d3a18){utils['error'](util[_0xb2da('0x3')](_0xb2da('0x27'),_0x2af692[_0xb2da('0x4')]),_0x1d3a18);}};exports[_0xb2da('0x2a')]=function(_0xf8b68d){try{utils[_0xb2da('0x18')](util[_0xb2da('0x3')](_0xb2da('0x2b'),_0xf8b68d[_0xb2da('0x4')]),_0xf8b68d);if(_0xf8b68d[_0xb2da('0x6')]){var _0xf6e3fe=_0xf8b68d[_0xb2da('0x6')][_0xb2da('0x11')]('-')[0x0];if(!_['isNil'](members[_0xf6e3fe])){members[_0xf6e3fe]=_[_0xb2da('0x29')](members[_0xf6e3fe],{'data1':members[_0xf6e3fe][_0xb2da('0x2c')]||_0xf8b68d['type'],'data2':members[_0xf6e3fe]['data2']||_0xf8b68d[_0xb2da('0x2d')],'data3':members[_0xf6e3fe][_0xb2da('0x2e')]||_0xf8b68d[_0xb2da('0x2f')],'uniqueid':members[_0xf6e3fe][_0xb2da('0x4')]||_0xf8b68d[_0xb2da('0x4')]});utils[_0xb2da('0x2')](util[_0xb2da('0x3')](_0xb2da('0x30'),_0xf8b68d[_0xb2da('0x4')],members[_0xf6e3fe][_0xb2da('0x2c')],members[_0xf6e3fe]['data2'],members[_0xf6e3fe][_0xb2da('0x2e')]));if(members[_0xf6e3fe]['exitAt']){writeDB(members[_0xf6e3fe]);}}}if(_0xf8b68d[_0xb2da('0x31')]){var _0x85c171=_0xf8b68d[_0xb2da('0x31')][_0xb2da('0x11')]('-')[0x0];if(!_['isNil'](members[_0x85c171])){members[_0x85c171]=_[_0xb2da('0x29')](members[_0x85c171],{'data1':members[_0x85c171][_0xb2da('0x2c')]||_0xf8b68d[_0xb2da('0x9')],'data2':members[_0x85c171]['data2']||_0xf8b68d[_0xb2da('0x2d')],'data3':members[_0x85c171][_0xb2da('0x2e')]||_0xf8b68d['destination'],'uniqueid':members[_0x85c171][_0xb2da('0x4')]||_0xf8b68d['uniqueid']});utils[_0xb2da('0x2')](util['format'](_0xb2da('0x30'),_0xf8b68d[_0xb2da('0x4')],members[_0x85c171][_0xb2da('0x2c')],members[_0x85c171]['data2'],members[_0x85c171][_0xb2da('0x2e')]));if(members[_0x85c171][_0xb2da('0x23')]){writeDB(members[_0x85c171]);}}}}catch(_0x212582){utils['error'](util[_0xb2da('0x3')](_0xb2da('0x2b'),_0xf8b68d['uniqueid']),_0x212582);}}; \ No newline at end of file +var _0xb0cf=['data3','destinationchannel','data2','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','[%s][members][cdr]','lodash','./utils','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','type','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','split','name','catch','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','state','INUSE','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','error','cdr','assign','data1','source'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0xb0cf,0x16b));var _0xfb0c=function(_0x3f2647,_0x4447ac){_0x3f2647=_0x3f2647-0x0;var _0xbd8415=_0xb0cf[_0x3f2647];return _0xbd8415;};'use strict';var _=require(_0xfb0c('0x0'));var util=require('util');var utils=require(_0xfb0c('0x1'));var members={};var exclude=['Local/_attended@transfer',_0xfb0c('0x2')];function writeDB(_0x29ecbf){utils[_0xfb0c('0x3')](util[_0xfb0c('0x4')](_0xfb0c('0x5'),_0x29ecbf[_0xfb0c('0x6')],_0x29ecbf[_0xfb0c('0x7')],_0x29ecbf[_0xfb0c('0x8')],_0x29ecbf['data2'],_0x29ecbf[_0xfb0c('0x9')],_0x29ecbf[_0xfb0c('0xa')]));if(_0x29ecbf[_0xfb0c('0x7')]){utils[_0xfb0c('0xb')](_0x29ecbf[_0xfb0c('0x7')])[_0xfb0c('0xc')](function(_0x2b047f){if(_0x2b047f){_0x29ecbf[_0xfb0c('0x9')]=_0x2b047f['name'];_0x29ecbf[_0xfb0c('0xd')]=_0x2b047f[_0xfb0c('0xd')];utils[_0xfb0c('0xe')](_0xfb0c('0xf'),_0x29ecbf);}else{utils[_0xfb0c('0x10')](_0x29ecbf[_0xfb0c('0x7')][_0xfb0c('0x11')]('/')[0x1])[_0xfb0c('0xc')](function(_0x6248fb){if(_0x6248fb){_0x29ecbf[_0xfb0c('0x9')]=_0x6248fb[_0xfb0c('0x12')];_0x29ecbf['internal']=_0x6248fb[_0xfb0c('0xd')];utils['request'](_0xfb0c('0xf'),_0x29ecbf);}});}})[_0xfb0c('0x13')](function(_0x51a8ab){utils['error'](util[_0xfb0c('0x4')](_0xfb0c('0x14'),_0x29ecbf[_0xfb0c('0x6')]),_0x51a8ab);});}delete members[_0x29ecbf[_0xfb0c('0x7')]];}function startsWith(_0xabc5bb,_0x9a40a5){return _[_0xfb0c('0x15')](_0xabc5bb,function(_0x4c1d48){return _[_0xfb0c('0x16')](_0x9a40a5,_0x4c1d48);});}exports[_0xfb0c('0x17')]=function(_0x63bbf5){try{utils[_0xfb0c('0x18')](util['format'](_0xfb0c('0x19'),members[_0x63bbf5[_0xfb0c('0x1a')]]?members[_0x63bbf5[_0xfb0c('0x1a')]][_0xfb0c('0x6')]:_0x63bbf5[_0xfb0c('0x1a')]),_0x63bbf5);utils[_0xfb0c('0x3')](util['format']('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x63bbf5['device']]?members[_0x63bbf5[_0xfb0c('0x1a')]][_0xfb0c('0x6')]:_0x63bbf5[_0xfb0c('0x1a')],_0x63bbf5[_0xfb0c('0x1b')],_0x63bbf5[_0xfb0c('0x1a')]));switch(_0x63bbf5[_0xfb0c('0x1b')]){case _0xfb0c('0x1c'):case'BUSY':if(!startsWith(exclude,_0x63bbf5[_0xfb0c('0x1a')])){members[_0x63bbf5[_0xfb0c('0x1a')]]={'channel':_0xfb0c('0x1d'),'interface':_0x63bbf5[_0xfb0c('0x1a')],'type':_0xfb0c('0x1e'),'enterAt':utils[_0xfb0c('0x1f')](),'role':_0xfb0c('0x20')};}break;case _0xfb0c('0x21'):if(!_[_0xfb0c('0x22')](members[_0x63bbf5[_0xfb0c('0x1a')]])){members[_0x63bbf5['device']][_0xfb0c('0x23')]=utils[_0xfb0c('0x1f')]();members[_0x63bbf5[_0xfb0c('0x1a')]][_0xfb0c('0x24')]=utils['diffTime'](members[_0x63bbf5['device']][_0xfb0c('0x23')],members[_0x63bbf5[_0xfb0c('0x1a')]]['enterAt']);if(members[_0x63bbf5['device']][_0xfb0c('0x6')]){writeDB(members[_0x63bbf5['device']]);}}break;default:break;}}catch(_0x1cc641){utils['error'](util[_0xfb0c('0x4')](_0xfb0c('0x19'),members[_0x63bbf5['device']]?members[_0x63bbf5[_0xfb0c('0x1a')]]['uniqueid']:_0x63bbf5[_0xfb0c('0x1a')]),_0x1cc641);}};exports['agentcomplete']=function(_0x1bf866){try{if(!_[_0xfb0c('0x22')](members[_0x1bf866[_0xfb0c('0x7')]])){utils[_0xfb0c('0x18')](util[_0xfb0c('0x4')](_0xfb0c('0x25'),_0x1bf866['uniqueid']),_0x1bf866);utils[_0xfb0c('0x3')](util[_0xfb0c('0x4')](_0xfb0c('0x26'),_0x1bf866[_0xfb0c('0x6')],_0x1bf866[_0xfb0c('0x7')],_0x1bf866[_0xfb0c('0x27')]));members[_0x1bf866['interface']]=_['assign'](members[_0x1bf866[_0xfb0c('0x7')]],{'data4':_0x1bf866['queue'],'uniqueid':_0x1bf866[_0xfb0c('0x6')]});}}catch(_0x51e9d0){utils[_0xfb0c('0x28')](util[_0xfb0c('0x4')](_0xfb0c('0x25'),_0x1bf866[_0xfb0c('0x6')]),_0x51e9d0);}};exports[_0xfb0c('0x29')]=function(_0x41d886){try{utils['debug'](util[_0xfb0c('0x4')]('[%s][members][cdr]',_0x41d886['uniqueid']),_0x41d886);if(_0x41d886[_0xfb0c('0x8')]){var _0x18e4e0=_0x41d886[_0xfb0c('0x8')]['split']('-')[0x0];if(!_[_0xfb0c('0x22')](members[_0x18e4e0])){members[_0x18e4e0]=_[_0xfb0c('0x2a')](members[_0x18e4e0],{'data1':members[_0x18e4e0][_0xfb0c('0x2b')]||_0x41d886[_0xfb0c('0xa')],'data2':members[_0x18e4e0]['data2']||_0x41d886[_0xfb0c('0x2c')],'data3':members[_0x18e4e0][_0xfb0c('0x2d')]||_0x41d886['destination'],'uniqueid':members[_0x18e4e0][_0xfb0c('0x6')]||_0x41d886['uniqueid']});utils['info'](util[_0xfb0c('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x41d886[_0xfb0c('0x6')],members[_0x18e4e0][_0xfb0c('0x2b')],members[_0x18e4e0]['data2'],members[_0x18e4e0][_0xfb0c('0x2d')]));if(members[_0x18e4e0][_0xfb0c('0x23')]){writeDB(members[_0x18e4e0]);}}}if(_0x41d886[_0xfb0c('0x2e')]){var _0x1fc45f=_0x41d886[_0xfb0c('0x2e')][_0xfb0c('0x11')]('-')[0x0];if(!_['isNil'](members[_0x1fc45f])){members[_0x1fc45f]=_[_0xfb0c('0x2a')](members[_0x1fc45f],{'data1':members[_0x1fc45f][_0xfb0c('0x2b')]||_0x41d886['type'],'data2':members[_0x1fc45f][_0xfb0c('0x2f')]||_0x41d886['source'],'data3':members[_0x1fc45f]['data3']||_0x41d886[_0xfb0c('0x30')],'uniqueid':members[_0x1fc45f][_0xfb0c('0x6')]||_0x41d886['uniqueid']});utils['info'](util[_0xfb0c('0x4')](_0xfb0c('0x31'),_0x41d886['uniqueid'],members[_0x1fc45f][_0xfb0c('0x2b')],members[_0x1fc45f][_0xfb0c('0x2f')],members[_0x1fc45f]['data3']));if(members[_0x1fc45f][_0xfb0c('0x23')]){writeDB(members[_0x1fc45f]);}}}}catch(_0xd33db7){utils[_0xfb0c('0x28')](util['format'](_0xfb0c('0x32'),_0x41d886[_0xfb0c('0x6')]),_0xd33db7);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 6242af7..9d3011c 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 _0xf960=['lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexit','value','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','holdtime','diffTime','queuecallerjoinAt','count','connectedlinename','agentconnect','membername','destaccountcode','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','assigned','transfer','TRANSFER','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDED','transferexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','info','format','uniqueid'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xf960,0x193));var _0x0f96=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xf960[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0x0f96('0x0'));var util=require('util');var utils=require(_0x0f96('0x1'));var queues={};function writeDB(_0x5adf08){utils[_0x0f96('0x2')](util[_0x0f96('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x5adf08[_0x0f96('0x4')],_0x5adf08['channel'],_0x5adf08['queue'],_0x5adf08[_0x0f96('0x5')],_0x5adf08[_0x0f96('0x6')],_0x5adf08[_0x0f96('0x7')],_0x5adf08[_0x0f96('0x8')]));if(_0x5adf08[_0x0f96('0x9')]){utils['getVoiceQueueByName'](_0x5adf08['queue'])[_0x0f96('0xa')](function(_0x354642){if(_0x354642){_0x5adf08[_0x0f96('0xb')]=_0x354642[_0x0f96('0xb')];}utils[_0x0f96('0xc')](_0x0f96('0xd'),_0x5adf08);});}else{utils['request'](_0x0f96('0xd'),_0x5adf08);}if(_0x5adf08['transfereduniqueid']){delete queues[_0x5adf08[_0x0f96('0xe')]];}else{delete queues[_0x5adf08['uniqueid']];}}exports[_0x0f96('0xf')]=function(_0x3cc1c8){try{utils[_0x0f96('0x10')](util[_0x0f96('0x3')]('[%s][queues][queuecallerjoin]',_0x3cc1c8[_0x0f96('0x4')]),_0x3cc1c8);utils[_0x0f96('0x2')](util[_0x0f96('0x3')](_0x0f96('0x11'),_0x3cc1c8['uniqueid'],_0x3cc1c8[_0x0f96('0x9')],_0x3cc1c8[_0x0f96('0x12')]));queues[_0x3cc1c8[_0x0f96('0x4')]]=_[_0x0f96('0x13')](_0x3cc1c8,{'originalposition':_0x3cc1c8[_0x0f96('0x12')],'queuecallerjoinAt':utils[_0x0f96('0x14')](),'mohtime':0x0});}catch(_0x5080c3){utils[_0x0f96('0x15')](util['format']('[%s][queues][queuecallerjoin]',_0x3cc1c8[_0x0f96('0x4')]),_0x5080c3);}};exports[_0x0f96('0x16')]=function(_0x183d93){try{if(!_[_0x0f96('0x17')](queues[_0x183d93[_0x0f96('0x4')]])){utils[_0x0f96('0x10')](util[_0x0f96('0x3')](_0x0f96('0x18'),_0x183d93[_0x0f96('0x4')]),_0x183d93);if(queues[_0x183d93[_0x0f96('0x4')]][_0x0f96('0x19')]){if(!queues[_0x183d93[_0x0f96('0x4')]][_0x0f96('0x1a')]&&!queues[_0x183d93[_0x0f96('0x4')]]['queuecallerexit']){queues[_0x183d93[_0x0f96('0x4')]][_0x0f96('0x1b')]=!![];queues[_0x183d93[_0x0f96('0x4')]][_0x0f96('0x1c')]=utils['now']();queues[_0x183d93[_0x0f96('0x4')]][_0x0f96('0x8')]=_0x0f96('0x1d');}utils['info'](util[_0x0f96('0x3')](_0x0f96('0x1e'),_0x183d93['uniqueid'],queues[_0x183d93[_0x0f96('0x4')]][_0x0f96('0x1f')],queues[_0x183d93[_0x0f96('0x4')]][_0x0f96('0x8')]));writeDB(queues[_0x183d93['uniqueid']]);}else if(queues[_0x183d93[_0x0f96('0x4')]][_0x0f96('0xe')]){utils[_0x0f96('0x2')](util[_0x0f96('0x3')](_0x0f96('0x20'),_0x183d93[_0x0f96('0x4')],queues[_0x183d93[_0x0f96('0x4')]]['name'],queues[_0x183d93[_0x0f96('0x4')]][_0x0f96('0xe')]));queues[queues[_0x183d93[_0x0f96('0x4')]]['transfereduniqueid']]=queues[_0x183d93[_0x0f96('0x4')]];queues[queues[_0x183d93[_0x0f96('0x4')]][_0x0f96('0xe')]][_0x0f96('0x21')]=0x2;delete queues[_0x183d93[_0x0f96('0x4')]];}}}catch(_0x591c91){utils[_0x0f96('0x15')](util[_0x0f96('0x3')](_0x0f96('0x18'),_0x183d93[_0x0f96('0x4')]),_0x591c91);}};exports[_0x0f96('0x22')]=function(_0x1f9f2c){try{utils[_0x0f96('0x10')](util[_0x0f96('0x3')](_0x0f96('0x23'),_0x1f9f2c[_0x0f96('0x4')]),_0x1f9f2c);if(!_['isNil'](_0x1f9f2c[_0x0f96('0x24')][_0x0f96('0x25')])&&_0x1f9f2c['value'][_0x0f96('0x26')]()!==_0x0f96('0x27')){if(!_['isNil'](queues[_0x1f9f2c[_0x0f96('0x4')]])){queues[_0x1f9f2c[_0x0f96('0x4')]][_0x0f96('0x1a')]=![];queues[_0x1f9f2c[_0x0f96('0x4')]][_0x0f96('0x28')]=null;queues[_0x1f9f2c[_0x0f96('0x4')]][_0x0f96('0x29')]=!![];queues[_0x1f9f2c['uniqueid']]['queuecallerexitAt']=utils[_0x0f96('0x14')]();queues[_0x1f9f2c['uniqueid']]['queuecallerexitreason']=_0x1f9f2c['value'][_0x0f96('0x26')]();utils[_0x0f96('0x2')](util[_0x0f96('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x1f9f2c[_0x0f96('0x4')],queues[_0x1f9f2c[_0x0f96('0x4')]][_0x0f96('0x1f')],_0x1f9f2c[_0x0f96('0x2a')],queues[_0x1f9f2c[_0x0f96('0x4')]][_0x0f96('0x8')]));writeDB(queues[_0x1f9f2c[_0x0f96('0x4')]]);}}else if(!_[_0x0f96('0x17')](_0x1f9f2c['variable'][_0x0f96('0x2b')])){if(!_['isNil'](queues[_0x1f9f2c[_0x0f96('0x4')]])&&!queues[_0x1f9f2c[_0x0f96('0x4')]][_0x0f96('0x1a')]){queues[_0x1f9f2c[_0x0f96('0x4')]][_0x0f96('0x1a')]=![];queues[_0x1f9f2c[_0x0f96('0x4')]][_0x0f96('0x28')]=null;queues[_0x1f9f2c['uniqueid']]['queuecallerexit']=!![];queues[_0x1f9f2c[_0x0f96('0x4')]][_0x0f96('0x2c')]=utils[_0x0f96('0x14')]();queues[_0x1f9f2c[_0x0f96('0x4')]]['queuecallerexitreason']=_0x0f96('0x2d');utils[_0x0f96('0x2')](util[_0x0f96('0x3')](_0x0f96('0x2e'),_0x1f9f2c[_0x0f96('0x4')],queues[_0x1f9f2c[_0x0f96('0x4')]][_0x0f96('0x1f')],_0x1f9f2c[_0x0f96('0x2a')],queues[_0x1f9f2c[_0x0f96('0x4')]]['queuecallerexitreason']));}}}catch(_0xa58381){utils[_0x0f96('0x15')](util['format'](_0x0f96('0x23'),_0x1f9f2c[_0x0f96('0x4')]),_0xa58381);}};exports[_0x0f96('0x1a')]=function(_0x5e64cd){try{if(!_[_0x0f96('0x17')](queues[_0x5e64cd[_0x0f96('0x4')]])){utils['debug'](util[_0x0f96('0x3')](_0x0f96('0x2f'),_0x5e64cd['uniqueid']),_0x5e64cd);queues[_0x5e64cd[_0x0f96('0x4')]]['queuecallerexit']=![];queues[_0x5e64cd['uniqueid']][_0x0f96('0x2c')]=null;queues[_0x5e64cd[_0x0f96('0x4')]][_0x0f96('0x1a')]=!![];queues[_0x5e64cd[_0x0f96('0x4')]][_0x0f96('0x28')]=utils[_0x0f96('0x14')]();queues[_0x5e64cd[_0x0f96('0x4')]][_0x0f96('0x8')]='ABANDONED';utils['info'](util[_0x0f96('0x3')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x5e64cd[_0x0f96('0x4')],queues[_0x5e64cd[_0x0f96('0x4')]][_0x0f96('0x1f')],queues[_0x5e64cd[_0x0f96('0x4')]][_0x0f96('0x8')]));}}catch(_0x46b48d){utils[_0x0f96('0x15')](util['format'](_0x0f96('0x2f'),_0x5e64cd[_0x0f96('0x4')]),_0x46b48d);}};exports[_0x0f96('0x30')]=function(_0xaf2a3c){try{if(!_[_0x0f96('0x17')](queues[_0xaf2a3c[_0x0f96('0x4')]])){utils[_0x0f96('0x10')](util[_0x0f96('0x3')](_0x0f96('0x31'),_0xaf2a3c[_0x0f96('0x4')]),_0xaf2a3c);utils[_0x0f96('0x2')](util[_0x0f96('0x3')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0xaf2a3c['uniqueid'],queues[_0xaf2a3c[_0x0f96('0x4')]][_0x0f96('0x1f')],_0xaf2a3c[_0x0f96('0x32')],_0xaf2a3c['connectedlinename']));queues[_0xaf2a3c[_0x0f96('0x4')]][_0x0f96('0x30')]=!![];queues[_0xaf2a3c[_0x0f96('0x4')]][_0x0f96('0x19')]=utils[_0x0f96('0x14')]();queues[_0xaf2a3c['uniqueid']][_0x0f96('0x33')]=utils[_0x0f96('0x34')](queues[_0xaf2a3c['uniqueid']]['queuecallerleaveAt'],queues[_0xaf2a3c[_0x0f96('0x4')]][_0x0f96('0x35')]);queues[_0xaf2a3c[_0x0f96('0x4')]][_0x0f96('0x12')]=_0xaf2a3c[_0x0f96('0x12')];queues[_0xaf2a3c['uniqueid']][_0x0f96('0x36')]=_0xaf2a3c[_0x0f96('0x36')];queues[_0xaf2a3c[_0x0f96('0x4')]][_0x0f96('0x32')]=_0xaf2a3c[_0x0f96('0x32')];queues[_0xaf2a3c[_0x0f96('0x4')]][_0x0f96('0x37')]=_0xaf2a3c[_0x0f96('0x37')];}}catch(_0x52321e){utils[_0x0f96('0x15')](util['format'](_0x0f96('0x31'),_0xaf2a3c[_0x0f96('0x4')]),_0x52321e);}};exports[_0x0f96('0x38')]=function(_0x2b8c34){try{if(!_[_0x0f96('0x17')](queues[_0x2b8c34['uniqueid']])){utils[_0x0f96('0x10')](util['format']('[%s][queues][agentconnect]',_0x2b8c34[_0x0f96('0x4')]),_0x2b8c34);utils[_0x0f96('0x2')](util[_0x0f96('0x3')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x2b8c34['uniqueid'],queues[_0x2b8c34[_0x0f96('0x4')]]['name'],_0x2b8c34[_0x0f96('0x39')],_0x2b8c34[_0x0f96('0x3a')]));queues[_0x2b8c34['uniqueid']]['queuecallerabandon']=![];queues[_0x2b8c34['uniqueid']]['queuecallerabandon']=![];queues[_0x2b8c34[_0x0f96('0x4')]][_0x0f96('0x28')]=null;queues[_0x2b8c34[_0x0f96('0x4')]][_0x0f96('0x29')]=![];queues[_0x2b8c34[_0x0f96('0x4')]][_0x0f96('0x8')]=null;queues[_0x2b8c34[_0x0f96('0x4')]][_0x0f96('0x2c')]=null;queues[_0x2b8c34[_0x0f96('0x4')]]['assigned']=!![];queues[_0x2b8c34[_0x0f96('0x4')]]['accountcode']=_0x2b8c34[_0x0f96('0x3a')];queues[_0x2b8c34[_0x0f96('0x4')]]['lastAssignedTo']=_0x2b8c34[_0x0f96('0x39')];}}catch(_0x484c1d){utils[_0x0f96('0x15')](util['format'](_0x0f96('0x3b'),_0x2b8c34[_0x0f96('0x4')]),_0x484c1d);}};exports[_0x0f96('0x3c')]=function(_0x49c100){try{if(!_[_0x0f96('0x17')](queues[_0x49c100[_0x0f96('0x4')]])){if(queues[_0x49c100[_0x0f96('0x4')]][_0x0f96('0x19')]){utils[_0x0f96('0x10')](util[_0x0f96('0x3')](_0x0f96('0x3d'),_0x49c100['uniqueid']),_0x49c100);queues[_0x49c100[_0x0f96('0x4')]]['queuecallerabandon']=![];queues[_0x49c100[_0x0f96('0x4')]][_0x0f96('0x1a')]=![];queues[_0x49c100[_0x0f96('0x4')]][_0x0f96('0x28')]=null;queues[_0x49c100['uniqueid']][_0x0f96('0x29')]=![];queues[_0x49c100['uniqueid']][_0x0f96('0x2c')]=null;queues[_0x49c100['uniqueid']][_0x0f96('0x3e')]=!![];queues[_0x49c100[_0x0f96('0x4')]]['lastAssignedTo']=_0x49c100['membername'];queues[_0x49c100[_0x0f96('0x4')]]['queuecallercomplete']=!![];queues[_0x49c100['uniqueid']]['queuecallercompleteAt']=utils['now']();if(_0x49c100['reason']==_0x0f96('0x3f')){if(!queues[_0x49c100[_0x0f96('0x4')]][_0x0f96('0x3f')]){queues[_0x49c100[_0x0f96('0x4')]][_0x0f96('0x8')]=_0x0f96('0x40');}}else{queues[_0x49c100[_0x0f96('0x4')]][_0x0f96('0x8')]='COMPLETEDBY'+_0x49c100[_0x0f96('0x41')][_0x0f96('0x26')]();}utils[_0x0f96('0x2')](util['format'](_0x0f96('0x42'),_0x49c100[_0x0f96('0x4')],queues[_0x49c100[_0x0f96('0x4')]]['name'],_0x49c100[_0x0f96('0x39')],queues[_0x49c100['uniqueid']][_0x0f96('0x8')]));writeDB(queues[_0x49c100[_0x0f96('0x4')]]);}}}catch(_0x4de794){utils[_0x0f96('0x15')](util['format'](_0x0f96('0x3d'),_0x49c100[_0x0f96('0x4')]),_0x4de794);}};exports[_0x0f96('0x43')]=function(_0x1368fe){try{if(!_['isNil'](queues[_0x1368fe[_0x0f96('0x44')]])){utils['debug'](util[_0x0f96('0x3')](_0x0f96('0x45'),_0x1368fe[_0x0f96('0x4')]),_0x1368fe);queues[_0x1368fe['transfereeuniqueid']]['transfer']=!![];queues[_0x1368fe['transfereeuniqueid']]['transfertype']=_0x0f96('0x46');queues[_0x1368fe[_0x0f96('0x44')]]['transferexten']=_0x1368fe[_0x0f96('0x47')];queues[_0x1368fe[_0x0f96('0x44')]]['transferuniqueid']=_0x1368fe[_0x0f96('0x44')];queues[_0x1368fe[_0x0f96('0x44')]][_0x0f96('0x8')]='BLINDTRANSFER';utils[_0x0f96('0x2')](util[_0x0f96('0x3')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x1368fe['uniqueid'],queues[_0x1368fe[_0x0f96('0x44')]][_0x0f96('0x1f')],_0x1368fe[_0x0f96('0x44')],_0x1368fe[_0x0f96('0x47')]));}}catch(_0x9e9c43){utils[_0x0f96('0x15')](util[_0x0f96('0x3')](_0x0f96('0x45'),_0x1368fe[_0x0f96('0x4')]),_0x9e9c43);}};exports[_0x0f96('0x48')]=function(_0x38c0a5){try{utils[_0x0f96('0x10')](util[_0x0f96('0x3')](_0x0f96('0x49'),_0x38c0a5[_0x0f96('0x4a')]),_0x38c0a5);if(_0x38c0a5[_0x0f96('0x4a')]==_0x38c0a5[_0x0f96('0x4b')]){if(!_[_0x0f96('0x17')](queues[_0x38c0a5[_0x0f96('0x4c')]])){utils[_0x0f96('0x2')](util[_0x0f96('0x3')](_0x0f96('0x4d'),_0x38c0a5[_0x0f96('0x4a')],queues[_0x38c0a5[_0x0f96('0x4c')]][_0x0f96('0x1f')],_0x38c0a5[_0x0f96('0x4e')]));queues[_0x38c0a5['secondtransfererlinkedid']][_0x0f96('0x3f')]=!![];queues[_0x38c0a5[_0x0f96('0x4c')]][_0x0f96('0x4f')]=_0x0f96('0x50');queues[_0x38c0a5[_0x0f96('0x4c')]][_0x0f96('0x51')]=_0x38c0a5[_0x0f96('0x4e')];queues[_0x38c0a5[_0x0f96('0x4c')]][_0x0f96('0x52')]=_0x38c0a5[_0x0f96('0x4a')];queues[_0x38c0a5['secondtransfererlinkedid']][_0x0f96('0x8')]=_0x0f96('0x53');}if(!_[_0x0f96('0x17')](queues[_0x38c0a5[_0x0f96('0x4b')]])){if(_0x38c0a5[_0x0f96('0x54')]&&queues[_0x38c0a5[_0x0f96('0x54')]]){queues[_0x38c0a5[_0x0f96('0x54')]][_0x0f96('0x21')]=0x1;queues[_0x38c0a5[_0x0f96('0x44')]]=_['clone'](queues[_0x38c0a5[_0x0f96('0x54')]]);queues[_0x38c0a5[_0x0f96('0x44')]]['transfereduniqueid']=_0x38c0a5[_0x0f96('0x55')];queues[_0x38c0a5[_0x0f96('0x44')]][_0x0f96('0x21')]=0x2;queues[_0x38c0a5[_0x0f96('0x44')]][_0x0f96('0x6')]=queues[_0x38c0a5[_0x0f96('0x4c')]][_0x0f96('0x6')];queues[_0x38c0a5['transfereeuniqueid']][_0x0f96('0x56')]=queues[_0x38c0a5[_0x0f96('0x4c')]][_0x0f96('0x56')];queues[_0x38c0a5[_0x0f96('0x44')]]['queuecallerjoinAt']=utils[_0x0f96('0x14')]();queues[_0x38c0a5[_0x0f96('0x44')]][_0x0f96('0x19')]=utils['now']();queues[_0x38c0a5[_0x0f96('0x44')]][_0x0f96('0x33')]=0x0;queues[_0x38c0a5['transfereeuniqueid']][_0x0f96('0x57')]=0x0;utils['info'](util[_0x0f96('0x3')](_0x0f96('0x58'),_0x38c0a5['origtransfereruniqueid'],queues[_0x38c0a5['transfereeuniqueid']][_0x0f96('0x1f')],queues[_0x38c0a5[_0x0f96('0x44')]][_0x0f96('0x6')],queues[_0x38c0a5[_0x0f96('0x44')]][_0x0f96('0x56')]));}else{utils['info'](util[_0x0f96('0x3')](_0x0f96('0x59'),_0x38c0a5[_0x0f96('0x4a')],queues[_0x38c0a5[_0x0f96('0x4b')]]['name'],_0x38c0a5[_0x0f96('0x4c')]));queues[_0x38c0a5[_0x0f96('0x4b')]][_0x0f96('0xe')]=_0x38c0a5[_0x0f96('0x4c')];}}}else if(_0x38c0a5[_0x0f96('0x5a')]==_0x38c0a5[_0x0f96('0x4c')]){if(!_[_0x0f96('0x17')](queues[_0x38c0a5[_0x0f96('0x4b')]])){utils['info'](util['format'](_0x0f96('0x5b'),_0x38c0a5[_0x0f96('0x4a')],queues[_0x38c0a5[_0x0f96('0x4b')]][_0x0f96('0x1f')],_0x38c0a5[_0x0f96('0x5a')],_0x38c0a5[_0x0f96('0x5c')]));queues[_0x38c0a5['origtransfererlinkedid']][_0x0f96('0x3f')]=!![];queues[_0x38c0a5[_0x0f96('0x4b')]]['transfertype']=_0x0f96('0x50');queues[_0x38c0a5[_0x0f96('0x4b')]]['transferexten']=_0x38c0a5['secondtransfererexten'];queues[_0x38c0a5[_0x0f96('0x4b')]][_0x0f96('0x52')]=_0x38c0a5[_0x0f96('0x5a')];queues[_0x38c0a5[_0x0f96('0x4b')]][_0x0f96('0x8')]=_0x0f96('0x53');}if(!_[_0x0f96('0x17')](queues[_0x38c0a5[_0x0f96('0x4c')]])){if(_0x38c0a5[_0x0f96('0x5d')]&&queues[_0x38c0a5[_0x0f96('0x5d')]]){queues[_0x38c0a5[_0x0f96('0x5d')]][_0x0f96('0x21')]=0x1;queues[_0x38c0a5[_0x0f96('0x55')]]=_[_0x0f96('0x5e')](queues[_0x38c0a5[_0x0f96('0x5d')]]);queues[_0x38c0a5[_0x0f96('0x55')]][_0x0f96('0xe')]=_0x38c0a5[_0x0f96('0x55')];queues[_0x38c0a5['transfertargetuniqueid']][_0x0f96('0x21')]=0x2;queues[_0x38c0a5[_0x0f96('0x55')]]['calleridnum']=queues[_0x38c0a5[_0x0f96('0x4b')]][_0x0f96('0x6')];queues[_0x38c0a5[_0x0f96('0x55')]][_0x0f96('0x56')]=queues[_0x38c0a5['origtransfererlinkedid']][_0x0f96('0x56')];queues[_0x38c0a5['transfertargetuniqueid']][_0x0f96('0x35')]=utils[_0x0f96('0x14')]();queues[_0x38c0a5[_0x0f96('0x55')]]['queuecallerleaveAt']=utils[_0x0f96('0x14')]();queues[_0x38c0a5[_0x0f96('0x55')]][_0x0f96('0x33')]=0x0;queues[_0x38c0a5[_0x0f96('0x55')]][_0x0f96('0x57')]=0x0;utils[_0x0f96('0x2')](util[_0x0f96('0x3')](_0x0f96('0x5f'),_0x38c0a5['origtransfereruniqueid'],queues[_0x38c0a5[_0x0f96('0x55')]][_0x0f96('0x1f')],queues[_0x38c0a5[_0x0f96('0x55')]][_0x0f96('0xe')],queues[_0x38c0a5['transfertargetuniqueid']][_0x0f96('0x6')],queues[_0x38c0a5[_0x0f96('0x55')]][_0x0f96('0x56')]));}else{utils['info'](util[_0x0f96('0x3')](_0x0f96('0x59'),_0x38c0a5[_0x0f96('0x4a')],queues[_0x38c0a5[_0x0f96('0x4c')]][_0x0f96('0x1f')],_0x38c0a5[_0x0f96('0x4b')]));queues[_0x38c0a5[_0x0f96('0x4c')]]['transfereduniqueid']=_0x38c0a5['origtransfererlinkedid'];}}}}catch(_0x2b7efa){utils[_0x0f96('0x15')](util[_0x0f96('0x3')]('[%s][queues][attendedtransfer]',_0x38c0a5['origtransfereruniqueid']),_0x2b7efa);}};exports['musiconholdstart']=function(_0x3d20d1){try{if(!_[_0x0f96('0x17')](queues[_0x3d20d1[_0x0f96('0x4')]])){utils[_0x0f96('0x10')](util['format'](_0x0f96('0x60'),_0x3d20d1['uniqueid']),_0x3d20d1);queues[_0x3d20d1[_0x0f96('0x4')]]['musiconholdstartAt']=utils['now']();utils[_0x0f96('0x2')](util[_0x0f96('0x3')](_0x0f96('0x61'),_0x3d20d1[_0x0f96('0x4')],queues[_0x3d20d1[_0x0f96('0x4')]]['name'],queues[_0x3d20d1[_0x0f96('0x4')]]['musiconholdstartAt']));}}catch(_0x5976ff){utils[_0x0f96('0x15')](util[_0x0f96('0x3')](_0x0f96('0x60'),_0x3d20d1[_0x0f96('0x4')]),_0x5976ff);}};exports[_0x0f96('0x62')]=function(_0x27c630){try{if(!_[_0x0f96('0x17')](queues[_0x27c630['uniqueid']])){if(!_['isNil'](queues[_0x27c630[_0x0f96('0x4')]]['musiconholdstartAt'])){utils[_0x0f96('0x10')](util[_0x0f96('0x3')](_0x0f96('0x63'),_0x27c630[_0x0f96('0x4')]),_0x27c630);queues[_0x27c630[_0x0f96('0x4')]][_0x0f96('0x57')]+=utils[_0x0f96('0x34')](utils[_0x0f96('0x14')](),queues[_0x27c630['uniqueid']][_0x0f96('0x64')]);utils[_0x0f96('0x2')](util[_0x0f96('0x3')](_0x0f96('0x65'),_0x27c630[_0x0f96('0x4')],queues[_0x27c630[_0x0f96('0x4')]][_0x0f96('0x1f')],queues[_0x27c630[_0x0f96('0x4')]]['mohtime']));delete queues[_0x27c630['uniqueid']]['musiconholdstartAt'];}}}catch(_0x31e7ce){utils['error'](util['format']('[%s][queues][musiconholdstop]',_0x27c630[_0x0f96('0x4')]),_0x31e7ce);}}; \ No newline at end of file +var _0x97ce=['attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','queuecallerjoinAt','[%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','clone','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','format','uniqueid','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','now','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','varset','isNil','variable','queuestatus','CONTINUE','queuecallerabandonAt','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','holdtime','diffTime','position','agentconnect','[%s][queues][agentconnect]','destaccountcode','membername','agentcomplete','[%s][queues][agentcomplete]','assigned','reason','transfer','COMPLETEDBY','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','BLINDTRANSFER'];(function(_0x1cb618,_0x242970){var _0x28e063=function(_0x2204ce){while(--_0x2204ce){_0x1cb618['push'](_0x1cb618['shift']());}};_0x28e063(++_0x242970);}(_0x97ce,0x151));var _0xe97c=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x97ce[_0x9fd887];return _0x1a54ab;};'use strict';var _=require(_0xe97c('0x0'));var util=require(_0xe97c('0x1'));var utils=require(_0xe97c('0x2'));var queues={};function writeDB(_0x31bf3f){utils['info'](util[_0xe97c('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x31bf3f[_0xe97c('0x4')],_0x31bf3f['channel'],_0x31bf3f[_0xe97c('0x5')],_0x31bf3f[_0xe97c('0x6')],_0x31bf3f[_0xe97c('0x7')],_0x31bf3f[_0xe97c('0x8')],_0x31bf3f[_0xe97c('0x9')]));if(_0x31bf3f[_0xe97c('0x5')]){utils['getVoiceQueueByName'](_0x31bf3f[_0xe97c('0x5')])[_0xe97c('0xa')](function(_0x9ce6d){if(_0x9ce6d){_0x31bf3f['type']=_0x9ce6d[_0xe97c('0xb')];}utils['request'](_0xe97c('0xc'),_0x31bf3f);});}else{utils[_0xe97c('0xd')](_0xe97c('0xc'),_0x31bf3f);}if(_0x31bf3f[_0xe97c('0xe')]){delete queues[_0x31bf3f[_0xe97c('0xe')]];}else{delete queues[_0x31bf3f[_0xe97c('0x4')]];}}exports[_0xe97c('0xf')]=function(_0x5bb134){try{utils[_0xe97c('0x10')](util[_0xe97c('0x3')](_0xe97c('0x11'),_0x5bb134[_0xe97c('0x4')]),_0x5bb134);utils[_0xe97c('0x12')](util[_0xe97c('0x3')](_0xe97c('0x13'),_0x5bb134[_0xe97c('0x4')],_0x5bb134[_0xe97c('0x5')],_0x5bb134['position']));queues[_0x5bb134['uniqueid']]=_[_0xe97c('0x14')](_0x5bb134,{'originalposition':_0x5bb134['position'],'queuecallerjoinAt':utils[_0xe97c('0x15')](),'mohtime':0x0});}catch(_0x4006a6){utils['error'](util['format'](_0xe97c('0x11'),_0x5bb134[_0xe97c('0x4')]),_0x4006a6);}};exports[_0xe97c('0x16')]=function(_0x2e026d){try{if(!_['isNil'](queues[_0x2e026d['uniqueid']])){utils['debug'](util[_0xe97c('0x3')](_0xe97c('0x17'),_0x2e026d[_0xe97c('0x4')]),_0x2e026d);if(queues[_0x2e026d['uniqueid']][_0xe97c('0x18')]){if(!queues[_0x2e026d[_0xe97c('0x4')]][_0xe97c('0x19')]&&!queues[_0x2e026d[_0xe97c('0x4')]][_0xe97c('0x1a')]){queues[_0x2e026d['uniqueid']][_0xe97c('0x1b')]=!![];queues[_0x2e026d[_0xe97c('0x4')]][_0xe97c('0x1c')]=utils[_0xe97c('0x15')]();queues[_0x2e026d[_0xe97c('0x4')]][_0xe97c('0x9')]=_0xe97c('0x1d');}utils[_0xe97c('0x12')](util[_0xe97c('0x3')](_0xe97c('0x1e'),_0x2e026d[_0xe97c('0x4')],queues[_0x2e026d[_0xe97c('0x4')]][_0xe97c('0x1f')],queues[_0x2e026d[_0xe97c('0x4')]][_0xe97c('0x9')]));writeDB(queues[_0x2e026d[_0xe97c('0x4')]]);}else if(queues[_0x2e026d[_0xe97c('0x4')]][_0xe97c('0xe')]){utils[_0xe97c('0x12')](util['format'](_0xe97c('0x20'),_0x2e026d[_0xe97c('0x4')],queues[_0x2e026d[_0xe97c('0x4')]][_0xe97c('0x1f')],queues[_0x2e026d[_0xe97c('0x4')]][_0xe97c('0xe')]));queues[queues[_0x2e026d[_0xe97c('0x4')]][_0xe97c('0xe')]]=queues[_0x2e026d[_0xe97c('0x4')]];queues[queues[_0x2e026d[_0xe97c('0x4')]][_0xe97c('0xe')]][_0xe97c('0x21')]=0x2;delete queues[_0x2e026d['uniqueid']];}}}catch(_0x4a79fb){utils[_0xe97c('0x22')](util[_0xe97c('0x3')](_0xe97c('0x17'),_0x2e026d[_0xe97c('0x4')]),_0x4a79fb);}};exports[_0xe97c('0x23')]=function(_0x6fff8d){try{utils[_0xe97c('0x10')](util['format']('[%s][queues][varset]',_0x6fff8d[_0xe97c('0x4')]),_0x6fff8d);if(!_[_0xe97c('0x24')](_0x6fff8d[_0xe97c('0x25')][_0xe97c('0x26')])&&_0x6fff8d['value']['toUpperCase']()!==_0xe97c('0x27')){if(!_[_0xe97c('0x24')](queues[_0x6fff8d[_0xe97c('0x4')]])){queues[_0x6fff8d['uniqueid']]['queuecallerabandon']=![];queues[_0x6fff8d[_0xe97c('0x4')]][_0xe97c('0x28')]=null;queues[_0x6fff8d[_0xe97c('0x4')]][_0xe97c('0x1a')]=!![];queues[_0x6fff8d[_0xe97c('0x4')]][_0xe97c('0x29')]=utils[_0xe97c('0x15')]();queues[_0x6fff8d['uniqueid']][_0xe97c('0x9')]=_0x6fff8d[_0xe97c('0x2a')]['toUpperCase']();utils[_0xe97c('0x12')](util[_0xe97c('0x3')](_0xe97c('0x2b'),_0x6fff8d[_0xe97c('0x4')],queues[_0x6fff8d[_0xe97c('0x4')]][_0xe97c('0x1f')],_0x6fff8d[_0xe97c('0x2a')],queues[_0x6fff8d[_0xe97c('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x6fff8d['uniqueid']]);}}else if(!_[_0xe97c('0x24')](_0x6fff8d[_0xe97c('0x25')][_0xe97c('0x2c')])){if(!_[_0xe97c('0x24')](queues[_0x6fff8d['uniqueid']])&&!queues[_0x6fff8d[_0xe97c('0x4')]]['queuecallerabandon']){queues[_0x6fff8d[_0xe97c('0x4')]][_0xe97c('0x19')]=![];queues[_0x6fff8d[_0xe97c('0x4')]]['queuecallerabandonAt']=null;queues[_0x6fff8d[_0xe97c('0x4')]][_0xe97c('0x1a')]=!![];queues[_0x6fff8d[_0xe97c('0x4')]][_0xe97c('0x29')]=utils[_0xe97c('0x15')]();queues[_0x6fff8d['uniqueid']][_0xe97c('0x9')]=_0xe97c('0x2d');utils[_0xe97c('0x12')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x6fff8d[_0xe97c('0x4')],queues[_0x6fff8d['uniqueid']][_0xe97c('0x1f')],_0x6fff8d['value'],queues[_0x6fff8d['uniqueid']]['queuecallerexitreason']));}}}catch(_0x112ae7){utils[_0xe97c('0x22')](util[_0xe97c('0x3')](_0xe97c('0x2e'),_0x6fff8d[_0xe97c('0x4')]),_0x112ae7);}};exports['queuecallerabandon']=function(_0x2935dc){try{if(!_['isNil'](queues[_0x2935dc[_0xe97c('0x4')]])){utils[_0xe97c('0x10')](util[_0xe97c('0x3')](_0xe97c('0x2f'),_0x2935dc[_0xe97c('0x4')]),_0x2935dc);queues[_0x2935dc[_0xe97c('0x4')]][_0xe97c('0x1a')]=![];queues[_0x2935dc[_0xe97c('0x4')]]['queuecallerexitAt']=null;queues[_0x2935dc[_0xe97c('0x4')]][_0xe97c('0x19')]=!![];queues[_0x2935dc[_0xe97c('0x4')]][_0xe97c('0x28')]=utils[_0xe97c('0x15')]();queues[_0x2935dc[_0xe97c('0x4')]][_0xe97c('0x9')]=_0xe97c('0x30');utils[_0xe97c('0x12')](util[_0xe97c('0x3')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x2935dc[_0xe97c('0x4')],queues[_0x2935dc[_0xe97c('0x4')]]['name'],queues[_0x2935dc[_0xe97c('0x4')]][_0xe97c('0x9')]));}}catch(_0x1bde24){utils[_0xe97c('0x22')](util['format'](_0xe97c('0x2f'),_0x2935dc['uniqueid']),_0x1bde24);}};exports[_0xe97c('0x31')]=function(_0x373cb2){try{if(!_[_0xe97c('0x24')](queues[_0x373cb2[_0xe97c('0x4')]])){utils[_0xe97c('0x10')](util['format'](_0xe97c('0x32'),_0x373cb2[_0xe97c('0x4')]),_0x373cb2);utils[_0xe97c('0x12')](util[_0xe97c('0x3')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x373cb2[_0xe97c('0x4')],queues[_0x373cb2[_0xe97c('0x4')]]['name'],_0x373cb2[_0xe97c('0x33')],_0x373cb2[_0xe97c('0x34')]));queues[_0x373cb2['uniqueid']]['queuecallerleave']=!![];queues[_0x373cb2[_0xe97c('0x4')]][_0xe97c('0x18')]=utils[_0xe97c('0x15')]();queues[_0x373cb2[_0xe97c('0x4')]][_0xe97c('0x35')]=utils[_0xe97c('0x36')](queues[_0x373cb2[_0xe97c('0x4')]][_0xe97c('0x18')],queues[_0x373cb2[_0xe97c('0x4')]]['queuecallerjoinAt']);queues[_0x373cb2[_0xe97c('0x4')]][_0xe97c('0x37')]=_0x373cb2[_0xe97c('0x37')];queues[_0x373cb2[_0xe97c('0x4')]]['count']=_0x373cb2['count'];queues[_0x373cb2[_0xe97c('0x4')]][_0xe97c('0x33')]=_0x373cb2[_0xe97c('0x33')];queues[_0x373cb2[_0xe97c('0x4')]]['connectedlinename']=_0x373cb2['connectedlinename'];}}catch(_0x5b1420){utils[_0xe97c('0x22')](util[_0xe97c('0x3')](_0xe97c('0x32'),_0x373cb2[_0xe97c('0x4')]),_0x5b1420);}};exports[_0xe97c('0x38')]=function(_0x9251cc){try{if(!_[_0xe97c('0x24')](queues[_0x9251cc[_0xe97c('0x4')]])){utils[_0xe97c('0x10')](util[_0xe97c('0x3')](_0xe97c('0x39'),_0x9251cc[_0xe97c('0x4')]),_0x9251cc);utils[_0xe97c('0x12')](util[_0xe97c('0x3')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x9251cc[_0xe97c('0x4')],queues[_0x9251cc[_0xe97c('0x4')]][_0xe97c('0x1f')],_0x9251cc['membername'],_0x9251cc[_0xe97c('0x3a')]));queues[_0x9251cc['uniqueid']]['queuecallerabandon']=![];queues[_0x9251cc[_0xe97c('0x4')]][_0xe97c('0x19')]=![];queues[_0x9251cc[_0xe97c('0x4')]]['queuecallerabandonAt']=null;queues[_0x9251cc[_0xe97c('0x4')]][_0xe97c('0x1a')]=![];queues[_0x9251cc[_0xe97c('0x4')]][_0xe97c('0x9')]=null;queues[_0x9251cc['uniqueid']]['queuecallerexitAt']=null;queues[_0x9251cc[_0xe97c('0x4')]]['assigned']=!![];queues[_0x9251cc['uniqueid']][_0xe97c('0x8')]=_0x9251cc[_0xe97c('0x3a')];queues[_0x9251cc[_0xe97c('0x4')]]['lastAssignedTo']=_0x9251cc[_0xe97c('0x3b')];}}catch(_0x586910){utils['error'](util[_0xe97c('0x3')]('[%s][queues][agentconnect]',_0x9251cc[_0xe97c('0x4')]),_0x586910);}};exports[_0xe97c('0x3c')]=function(_0x320774){try{if(!_[_0xe97c('0x24')](queues[_0x320774[_0xe97c('0x4')]])){if(queues[_0x320774[_0xe97c('0x4')]][_0xe97c('0x18')]){utils['debug'](util['format'](_0xe97c('0x3d'),_0x320774[_0xe97c('0x4')]),_0x320774);queues[_0x320774['uniqueid']][_0xe97c('0x19')]=![];queues[_0x320774['uniqueid']][_0xe97c('0x19')]=![];queues[_0x320774['uniqueid']][_0xe97c('0x28')]=null;queues[_0x320774['uniqueid']][_0xe97c('0x1a')]=![];queues[_0x320774[_0xe97c('0x4')]]['queuecallerexitAt']=null;queues[_0x320774[_0xe97c('0x4')]][_0xe97c('0x3e')]=!![];queues[_0x320774[_0xe97c('0x4')]][_0xe97c('0x6')]=_0x320774[_0xe97c('0x3b')];queues[_0x320774['uniqueid']][_0xe97c('0x1b')]=!![];queues[_0x320774[_0xe97c('0x4')]][_0xe97c('0x1c')]=utils['now']();if(_0x320774[_0xe97c('0x3f')]==_0xe97c('0x40')){if(!queues[_0x320774['uniqueid']][_0xe97c('0x40')]){queues[_0x320774[_0xe97c('0x4')]][_0xe97c('0x9')]='TRANSFER';}}else{queues[_0x320774[_0xe97c('0x4')]][_0xe97c('0x9')]=_0xe97c('0x41')+_0x320774[_0xe97c('0x3f')][_0xe97c('0x42')]();}utils[_0xe97c('0x12')](util[_0xe97c('0x3')](_0xe97c('0x43'),_0x320774[_0xe97c('0x4')],queues[_0x320774[_0xe97c('0x4')]][_0xe97c('0x1f')],_0x320774[_0xe97c('0x3b')],queues[_0x320774['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x320774['uniqueid']]);}}}catch(_0x366470){utils[_0xe97c('0x22')](util[_0xe97c('0x3')](_0xe97c('0x3d'),_0x320774['uniqueid']),_0x366470);}};exports['blindtransfer']=function(_0x29467d){try{if(!_[_0xe97c('0x24')](queues[_0x29467d[_0xe97c('0x44')]])){utils['debug'](util['format'](_0xe97c('0x45'),_0x29467d['uniqueid']),_0x29467d);queues[_0x29467d['transfereeuniqueid']][_0xe97c('0x40')]=!![];queues[_0x29467d[_0xe97c('0x44')]][_0xe97c('0x46')]=_0xe97c('0x47');queues[_0x29467d[_0xe97c('0x44')]][_0xe97c('0x48')]=_0x29467d[_0xe97c('0x49')];queues[_0x29467d[_0xe97c('0x44')]]['transferuniqueid']=_0x29467d['transfereeuniqueid'];queues[_0x29467d['transfereeuniqueid']]['queuecallerexitreason']=_0xe97c('0x4a');utils[_0xe97c('0x12')](util[_0xe97c('0x3')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x29467d['uniqueid'],queues[_0x29467d[_0xe97c('0x44')]][_0xe97c('0x1f')],_0x29467d[_0xe97c('0x44')],_0x29467d[_0xe97c('0x49')]));}}catch(_0x4bb044){utils[_0xe97c('0x22')](util['format']('[%s][queues][blindtransfer]',_0x29467d[_0xe97c('0x4')]),_0x4bb044);}};exports[_0xe97c('0x4b')]=function(_0x3cd085){try{utils[_0xe97c('0x10')](util[_0xe97c('0x3')](_0xe97c('0x4c'),_0x3cd085[_0xe97c('0x4d')]),_0x3cd085);if(_0x3cd085['origtransfereruniqueid']==_0x3cd085[_0xe97c('0x4e')]){if(!_[_0xe97c('0x24')](queues[_0x3cd085[_0xe97c('0x4f')]])){utils[_0xe97c('0x12')](util['format'](_0xe97c('0x50'),_0x3cd085['origtransfereruniqueid'],queues[_0x3cd085[_0xe97c('0x4f')]][_0xe97c('0x1f')],_0x3cd085[_0xe97c('0x51')]));queues[_0x3cd085[_0xe97c('0x4f')]][_0xe97c('0x40')]=!![];queues[_0x3cd085[_0xe97c('0x4f')]][_0xe97c('0x46')]='ATTENDED';queues[_0x3cd085[_0xe97c('0x4f')]][_0xe97c('0x48')]=_0x3cd085[_0xe97c('0x51')];queues[_0x3cd085[_0xe97c('0x4f')]][_0xe97c('0x52')]=_0x3cd085[_0xe97c('0x4d')];queues[_0x3cd085[_0xe97c('0x4f')]][_0xe97c('0x9')]=_0xe97c('0x53');}if(!_[_0xe97c('0x24')](queues[_0x3cd085[_0xe97c('0x4e')]])){if(_0x3cd085[_0xe97c('0x54')]&&queues[_0x3cd085['transfereelinkedid']]){queues[_0x3cd085['transfereelinkedid']][_0xe97c('0x21')]=0x1;queues[_0x3cd085[_0xe97c('0x44')]]=_['clone'](queues[_0x3cd085['transfereelinkedid']]);queues[_0x3cd085[_0xe97c('0x44')]][_0xe97c('0xe')]=_0x3cd085[_0xe97c('0x55')];queues[_0x3cd085[_0xe97c('0x44')]]['queuecallerenterreason']=0x2;queues[_0x3cd085[_0xe97c('0x44')]][_0xe97c('0x7')]=queues[_0x3cd085[_0xe97c('0x4f')]]['calleridnum'];queues[_0x3cd085['transfereeuniqueid']][_0xe97c('0x56')]=queues[_0x3cd085[_0xe97c('0x4f')]][_0xe97c('0x56')];queues[_0x3cd085[_0xe97c('0x44')]][_0xe97c('0x57')]=utils[_0xe97c('0x15')]();queues[_0x3cd085[_0xe97c('0x44')]][_0xe97c('0x18')]=utils[_0xe97c('0x15')]();queues[_0x3cd085[_0xe97c('0x44')]][_0xe97c('0x35')]=0x0;queues[_0x3cd085[_0xe97c('0x44')]]['mohtime']=0x0;utils[_0xe97c('0x12')](util[_0xe97c('0x3')](_0xe97c('0x58'),_0x3cd085[_0xe97c('0x4d')],queues[_0x3cd085['transfereeuniqueid']][_0xe97c('0x1f')],queues[_0x3cd085['transfereeuniqueid']][_0xe97c('0x7')],queues[_0x3cd085[_0xe97c('0x44')]][_0xe97c('0x56')]));}else{utils[_0xe97c('0x12')](util[_0xe97c('0x3')](_0xe97c('0x59'),_0x3cd085[_0xe97c('0x4d')],queues[_0x3cd085[_0xe97c('0x4e')]][_0xe97c('0x1f')],_0x3cd085[_0xe97c('0x4f')]));queues[_0x3cd085['origtransfererlinkedid']][_0xe97c('0xe')]=_0x3cd085[_0xe97c('0x4f')];}}}else if(_0x3cd085[_0xe97c('0x5a')]==_0x3cd085[_0xe97c('0x4f')]){if(!_[_0xe97c('0x24')](queues[_0x3cd085[_0xe97c('0x4e')]])){utils['info'](util[_0xe97c('0x3')](_0xe97c('0x5b'),_0x3cd085['origtransfereruniqueid'],queues[_0x3cd085[_0xe97c('0x4e')]][_0xe97c('0x1f')],_0x3cd085[_0xe97c('0x5a')],_0x3cd085['secondtransfererexten']));queues[_0x3cd085[_0xe97c('0x4e')]]['transfer']=!![];queues[_0x3cd085[_0xe97c('0x4e')]][_0xe97c('0x46')]='ATTENDED';queues[_0x3cd085[_0xe97c('0x4e')]]['transferexten']=_0x3cd085[_0xe97c('0x5c')];queues[_0x3cd085['origtransfererlinkedid']][_0xe97c('0x52')]=_0x3cd085[_0xe97c('0x5a')];queues[_0x3cd085[_0xe97c('0x4e')]][_0xe97c('0x9')]=_0xe97c('0x53');}if(!_[_0xe97c('0x24')](queues[_0x3cd085[_0xe97c('0x4f')]])){if(_0x3cd085[_0xe97c('0x5d')]&&queues[_0x3cd085['transfertargetlinkedid']]){queues[_0x3cd085['transfertargetlinkedid']][_0xe97c('0x21')]=0x1;queues[_0x3cd085['transfertargetuniqueid']]=_[_0xe97c('0x5e')](queues[_0x3cd085[_0xe97c('0x5d')]]);queues[_0x3cd085['transfertargetuniqueid']][_0xe97c('0xe')]=_0x3cd085[_0xe97c('0x55')];queues[_0x3cd085[_0xe97c('0x55')]][_0xe97c('0x21')]=0x2;queues[_0x3cd085[_0xe97c('0x55')]][_0xe97c('0x7')]=queues[_0x3cd085['origtransfererlinkedid']][_0xe97c('0x7')];queues[_0x3cd085[_0xe97c('0x55')]][_0xe97c('0x56')]=queues[_0x3cd085[_0xe97c('0x4e')]][_0xe97c('0x56')];queues[_0x3cd085[_0xe97c('0x55')]][_0xe97c('0x57')]=utils[_0xe97c('0x15')]();queues[_0x3cd085[_0xe97c('0x55')]][_0xe97c('0x18')]=utils[_0xe97c('0x15')]();queues[_0x3cd085[_0xe97c('0x55')]]['holdtime']=0x0;queues[_0x3cd085['transfertargetuniqueid']][_0xe97c('0x5f')]=0x0;utils[_0xe97c('0x12')](util[_0xe97c('0x3')](_0xe97c('0x60'),_0x3cd085[_0xe97c('0x4d')],queues[_0x3cd085['transfertargetuniqueid']][_0xe97c('0x1f')],queues[_0x3cd085['transfertargetuniqueid']]['transfereduniqueid'],queues[_0x3cd085[_0xe97c('0x55')]][_0xe97c('0x7')],queues[_0x3cd085[_0xe97c('0x55')]][_0xe97c('0x56')]));}else{utils['info'](util['format'](_0xe97c('0x59'),_0x3cd085['origtransfereruniqueid'],queues[_0x3cd085[_0xe97c('0x4f')]]['name'],_0x3cd085[_0xe97c('0x4e')]));queues[_0x3cd085[_0xe97c('0x4f')]][_0xe97c('0xe')]=_0x3cd085[_0xe97c('0x4e')];}}}}catch(_0xc55d6){utils[_0xe97c('0x22')](util[_0xe97c('0x3')](_0xe97c('0x4c'),_0x3cd085[_0xe97c('0x4d')]),_0xc55d6);}};exports[_0xe97c('0x61')]=function(_0x5f1368){try{if(!_[_0xe97c('0x24')](queues[_0x5f1368[_0xe97c('0x4')]])){utils[_0xe97c('0x10')](util['format']('[%s][queues][musiconholdstart]',_0x5f1368[_0xe97c('0x4')]),_0x5f1368);queues[_0x5f1368[_0xe97c('0x4')]][_0xe97c('0x62')]=utils[_0xe97c('0x15')]();utils[_0xe97c('0x12')](util[_0xe97c('0x3')](_0xe97c('0x63'),_0x5f1368[_0xe97c('0x4')],queues[_0x5f1368[_0xe97c('0x4')]]['name'],queues[_0x5f1368[_0xe97c('0x4')]][_0xe97c('0x62')]));}}catch(_0x5e3e9e){utils[_0xe97c('0x22')](util[_0xe97c('0x3')]('[%s][queues][musiconholdstart]',_0x5f1368['uniqueid']),_0x5e3e9e);}};exports[_0xe97c('0x64')]=function(_0x2a5cc4){try{if(!_[_0xe97c('0x24')](queues[_0x2a5cc4['uniqueid']])){if(!_[_0xe97c('0x24')](queues[_0x2a5cc4[_0xe97c('0x4')]][_0xe97c('0x62')])){utils['debug'](util[_0xe97c('0x3')]('[%s][queues][musiconholdstop]',_0x2a5cc4[_0xe97c('0x4')]),_0x2a5cc4);queues[_0x2a5cc4[_0xe97c('0x4')]]['mohtime']+=utils[_0xe97c('0x36')](utils[_0xe97c('0x15')](),queues[_0x2a5cc4[_0xe97c('0x4')]]['musiconholdstartAt']);utils[_0xe97c('0x12')](util['format'](_0xe97c('0x65'),_0x2a5cc4[_0xe97c('0x4')],queues[_0x2a5cc4[_0xe97c('0x4')]][_0xe97c('0x1f')],queues[_0x2a5cc4['uniqueid']]['mohtime']));delete queues[_0x2a5cc4['uniqueid']][_0xe97c('0x62')];}}}catch(_0x339354){utils['error'](util[_0xe97c('0x3')](_0xe97c('0x66'),_0x2a5cc4[_0xe97c('0x4')]),_0x339354);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 3961066..826f8f9 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 _0x45ee=['lodash','util','./utils','info','[%s][recordings][writeDB]','accountcode','getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','format','[%s][recordings][newchannel]','uniqueid','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','isNil','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue'];(function(_0x5322ac,_0x8ccba0){var _0x3b6b30=function(_0x4d199e){while(--_0x4d199e){_0x5322ac['push'](_0x5322ac['shift']());}};_0x3b6b30(++_0x8ccba0);}(_0x45ee,0x1c7));var _0xe45e=function(_0x3afff9,_0x14683c){_0x3afff9=_0x3afff9-0x0;var _0x418145=_0x45ee[_0x3afff9];return _0x418145;};'use strict';var _=require(_0xe45e('0x0'));var util=require(_0xe45e('0x1'));var utils=require(_0xe45e('0x2'));var recordings={};function writeDB(_0x35fddf){utils[_0xe45e('0x3')](util['format'](_0xe45e('0x4'),_0x35fddf['uniqueid']));if(_0x35fddf[_0xe45e('0x5')]){utils[_0xe45e('0x6')](_0x35fddf[_0xe45e('0x5')])['then'](function(_0x326abc){if(_0x326abc){_0x35fddf[_0xe45e('0x7')]=_0x326abc[_0xe45e('0x8')];_0x35fddf[_0xe45e('0x9')]=_0x326abc['id'];}utils[_0xe45e('0xa')](_0xe45e('0xb'),_0x35fddf);});}else{utils[_0xe45e('0xa')](_0xe45e('0xb'),_0x35fddf);}}exports[_0xe45e('0xc')]=function(_0x4155d0){try{utils[_0xe45e('0xd')](util[_0xe45e('0xe')](_0xe45e('0xf'),_0x4155d0[_0xe45e('0x10')]),_0x4155d0);if(_0x4155d0[_0xe45e('0x10')]==_0x4155d0[_0xe45e('0x11')]){utils[_0xe45e('0x3')](util[_0xe45e('0xe')](_0xe45e('0x12'),_0x4155d0[_0xe45e('0x10')],_0x4155d0[_0xe45e('0x13')],_0x4155d0['exten']));recordings[_0x4155d0['uniqueid']]={'uniqueid':_0x4155d0[_0xe45e('0x10')],'accountcode':_0x4155d0[_0xe45e('0x5')],'exten':_0x4155d0[_0xe45e('0x14')],'context':_0x4155d0['context'],'channel':_0x4155d0[_0xe45e('0x15')],'monitors':[]};}}catch(_0x79b61d){utils[_0xe45e('0x16')](util[_0xe45e('0xe')]('[%s][recordings][newchannel]',_0x4155d0['uniqueid']),_0x79b61d);}};exports['newstate']=function(_0xfa5e34){try{utils['debug'](util['format'](_0xe45e('0x17'),_0xfa5e34[_0xe45e('0x10')]),_0xfa5e34);if(!_['isNil'](recordings[_0xfa5e34['uniqueid']])&&_0xfa5e34[_0xe45e('0x18')]==0x6){utils[_0xe45e('0x3')](util[_0xe45e('0xe')](_0xe45e('0x19'),_0xfa5e34[_0xe45e('0x10')],_0xfa5e34[_0xe45e('0x13')],_0xfa5e34[_0xe45e('0x15')]));}else if(!_['isNil'](recordings[_0xfa5e34[_0xe45e('0x11')]])&&_0xfa5e34['channelstate']==0x6&&_0xfa5e34[_0xe45e('0x13')]!=_0xe45e('0x1a')){utils[_0xe45e('0x3')](util[_0xe45e('0xe')](_0xe45e('0x1b'),_0xfa5e34[_0xe45e('0x10')],_0xfa5e34['linkedid'],_0xfa5e34[_0xe45e('0x13')],_0xfa5e34[_0xe45e('0x15')]));recordings[_0xfa5e34['linkedid']]['accountcode']=_0xfa5e34[_0xe45e('0x5')];}}catch(_0x185599){utils[_0xe45e('0x16')](util[_0xe45e('0xe')](_0xe45e('0x17'),_0xfa5e34['uniqueid']),_0x185599);}};exports[_0xe45e('0x1c')]=function(_0x18d68f){try{if(!_['isNil'](_0x18d68f['variable'])&&!_['isNil'](_0x18d68f[_0xe45e('0x1d')][_0xe45e('0x1e')])){utils['debug'](util[_0xe45e('0xe')](_0xe45e('0x1f'),_0x18d68f[_0xe45e('0x10')]),_0x18d68f);utils[_0xe45e('0x3')](util['format'](_0xe45e('0x20'),_0x18d68f[_0xe45e('0x10')],_0x18d68f['variable'],_0x18d68f[_0xe45e('0x21')]));if(_[_0xe45e('0x22')](_0x18d68f['value'],_0xe45e('0x23'))){_0x18d68f['value']=_0x18d68f[_0xe45e('0x21')][_0xe45e('0x24')]('.wav49',_0xe45e('0x25'));}if(recordings[_0x18d68f[_0xe45e('0x11')]]){var _0x2b8c23=_[_0xe45e('0x26')](recordings[_0x18d68f[_0xe45e('0x11')]][_0xe45e('0x27')],{'value':_0x18d68f[_0xe45e('0x21')]});if(_[_0xe45e('0x28')](_0x2b8c23)){recordings[_0x18d68f[_0xe45e('0x11')]][_0xe45e('0x27')][_0xe45e('0x29')]({'value':_0x18d68f[_0xe45e('0x21')]});}}}}catch(_0x427620){utils[_0xe45e('0x16')](util['format'](_0xe45e('0x1f'),_0x18d68f[_0xe45e('0x10')]),_0x427620);}};exports[_0xe45e('0x2a')]=function(_0x515387){try{if(!_['isNil'](recordings[_0x515387[_0xe45e('0x10')]])){utils[_0xe45e('0xd')](util[_0xe45e('0xe')](_0xe45e('0x2b'),_0x515387['uniqueid']),_0x515387);utils[_0xe45e('0x3')](util[_0xe45e('0xe')](_0xe45e('0x2c'),_0x515387[_0xe45e('0x10')],_0x515387[_0xe45e('0x2d')],_0x515387[_0xe45e('0x2e')],_0x515387[_0xe45e('0x2f')]));recordings[_0x515387[_0xe45e('0x10')]][_0xe45e('0x2d')]=_0x515387[_0xe45e('0x2d')];recordings[_0x515387[_0xe45e('0x10')]][_0xe45e('0x2e')]=_0x515387[_0xe45e('0x2e')];recordings[_0x515387[_0xe45e('0x10')]][_0xe45e('0x30')]=_0x515387[_0xe45e('0x30')];recordings[_0x515387[_0xe45e('0x10')]][_0xe45e('0x31')]=_0x515387[_0xe45e('0x31')];if(recordings[_0x515387[_0xe45e('0x10')]][_0xe45e('0x32')]=='outbound'&&recordings[_0x515387[_0xe45e('0x10')]][_0xe45e('0x5')]){recordings[_0x515387['uniqueid']][_0xe45e('0x30')]=recordings[_0x515387[_0xe45e('0x10')]][_0xe45e('0x5')];recordings[_0x515387[_0xe45e('0x10')]][_0xe45e('0x31')]='';}recordings[_0x515387[_0xe45e('0x10')]][_0xe45e('0x27')]['forEach'](function(_0xf24bbe){var _0x4a94ce=_[_0xe45e('0x33')](recordings[_0x515387[_0xe45e('0x10')]]);_0x4a94ce[_0xe45e('0x21')]=_0xf24bbe[_0xe45e('0x21')];writeDB(_0x4a94ce);});delete recordings[_0x515387[_0xe45e('0x10')]];}}catch(_0x3ad6e9){utils[_0xe45e('0x16')](util[_0xe45e('0xe')](_0xe45e('0x2b'),_0x515387[_0xe45e('0x10')]),_0x3ad6e9);}};exports[_0xe45e('0x34')]=function(_0x2c6e1c){try{if(!_[_0xe45e('0x28')](recordings[_0x2c6e1c[_0xe45e('0x10')]])){utils[_0xe45e('0xd')](util['format'](_0xe45e('0x35'),_0x2c6e1c['uniqueid']),_0x2c6e1c);utils[_0xe45e('0x3')](util[_0xe45e('0xe')](_0xe45e('0x36'),_0x2c6e1c['uniqueid'],_0x2c6e1c['application'],_0x2c6e1c['appdata']));if(_0x2c6e1c[_0xe45e('0x37')][_0xe45e('0x38')]()==_0xe45e('0x39')&&_['startsWith'](_0x2c6e1c['appdata'][_0xe45e('0x38')](),_0xe45e('0x3a'))){var _0x24b813=_0x2c6e1c['appdata'][_0xe45e('0x3b')]('=');var _0x4146f6=_0x24b813[0x0]['substring'](_0x24b813[0x0][_0xe45e('0x3c')]('(')+0x1,_0x24b813[0x0][_0xe45e('0x3c')](')'));var _0x197a4e=_0x24b813[0x1];recordings[_0x2c6e1c['uniqueid']][_0x4146f6]=_0x197a4e;}}}catch(_0x31720c){utils[_0xe45e('0x16')](util[_0xe45e('0xe')](_0xe45e('0x35'),_0x2c6e1c[_0xe45e('0x10')]),_0x31720c);}};exports[_0xe45e('0x3d')]=function(_0x31672c){try{if(!_['isNil'](recordings[_0x31672c[_0xe45e('0x10')]])){utils[_0xe45e('0xd')](util[_0xe45e('0xe')](_0xe45e('0x3e'),_0x31672c[_0xe45e('0x10')]),_0x31672c);utils[_0xe45e('0x3')](util[_0xe45e('0xe')](_0xe45e('0x3f'),_0x31672c['uniqueid'],_0x31672c['queue']));recordings[_0x31672c[_0xe45e('0x10')]][_0xe45e('0x40')]=_0x31672c[_0xe45e('0x40')];}}catch(_0x43dc8a){utils[_0xe45e('0x16')](util[_0xe45e('0xe')](_0xe45e('0x3e'),_0x31672c[_0xe45e('0x10')]),_0x43dc8a);}}; \ No newline at end of file +var _0x6610=['calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','split','substring','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','UserId','request','CreateVoiceRecording','newchannel','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','error','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','.WAV','find','monitors','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum'];(function(_0x3a60b8,_0x47caab){var _0x4eb583=function(_0x2251b5){while(--_0x2251b5){_0x3a60b8['push'](_0x3a60b8['shift']());}};_0x4eb583(++_0x47caab);}(_0x6610,0x152));var _0x0661=function(_0x12a806,_0x40468e){_0x12a806=_0x12a806-0x0;var _0x3597bd=_0x6610[_0x12a806];return _0x3597bd;};'use strict';var _=require(_0x0661('0x0'));var util=require('util');var utils=require('./utils');var recordings={};function writeDB(_0x5488dc){utils[_0x0661('0x1')](util[_0x0661('0x2')](_0x0661('0x3'),_0x5488dc[_0x0661('0x4')]));if(_0x5488dc[_0x0661('0x5')]){utils[_0x0661('0x6')](_0x5488dc[_0x0661('0x5')])[_0x0661('0x7')](function(_0x54156a){if(_0x54156a){_0x5488dc[_0x0661('0x8')]=_0x54156a['name'];_0x5488dc[_0x0661('0x9')]=_0x54156a['id'];}utils[_0x0661('0xa')](_0x0661('0xb'),_0x5488dc);});}else{utils[_0x0661('0xa')](_0x0661('0xb'),_0x5488dc);}}exports[_0x0661('0xc')]=function(_0x22a614){try{utils[_0x0661('0xd')](util[_0x0661('0x2')]('[%s][recordings][newchannel]',_0x22a614['uniqueid']),_0x22a614);if(_0x22a614['uniqueid']==_0x22a614[_0x0661('0xe')]){utils[_0x0661('0x1')](util['format'](_0x0661('0xf'),_0x22a614[_0x0661('0x4')],_0x22a614[_0x0661('0x10')],_0x22a614[_0x0661('0x11')]));recordings[_0x22a614[_0x0661('0x4')]]={'uniqueid':_0x22a614[_0x0661('0x4')],'accountcode':_0x22a614[_0x0661('0x5')],'exten':_0x22a614['exten'],'context':_0x22a614[_0x0661('0x10')],'channel':_0x22a614[_0x0661('0x12')],'monitors':[]};}}catch(_0xe2ed02){utils['error'](util['format'](_0x0661('0x13'),_0x22a614[_0x0661('0x4')]),_0xe2ed02);}};exports[_0x0661('0x14')]=function(_0x522a0e){try{utils[_0x0661('0xd')](util[_0x0661('0x2')](_0x0661('0x15'),_0x522a0e[_0x0661('0x4')]),_0x522a0e);if(!_[_0x0661('0x16')](recordings[_0x522a0e[_0x0661('0x4')]])&&_0x522a0e[_0x0661('0x17')]==0x6){utils['info'](util['format'](_0x0661('0x18'),_0x522a0e[_0x0661('0x4')],_0x522a0e[_0x0661('0x10')],_0x522a0e[_0x0661('0x12')]));}else if(!_[_0x0661('0x16')](recordings[_0x522a0e['linkedid']])&&_0x522a0e['channelstate']==0x6&&_0x522a0e[_0x0661('0x10')]!=_0x0661('0x19')){utils['info'](util['format']('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x522a0e[_0x0661('0x4')],_0x522a0e[_0x0661('0xe')],_0x522a0e[_0x0661('0x10')],_0x522a0e['channel']));recordings[_0x522a0e[_0x0661('0xe')]]['accountcode']=_0x522a0e[_0x0661('0x5')];}}catch(_0x48edb2){utils[_0x0661('0x1a')](util[_0x0661('0x2')]('[%s][recordings][newstate]',_0x522a0e['uniqueid']),_0x48edb2);}};exports[_0x0661('0x1b')]=function(_0x3d72de){try{if(!_[_0x0661('0x16')](_0x3d72de[_0x0661('0x1c')])&&!_[_0x0661('0x16')](_0x3d72de[_0x0661('0x1c')]['mixmonitor_filename'])){utils['debug'](util[_0x0661('0x2')](_0x0661('0x1d'),_0x3d72de[_0x0661('0x4')]),_0x3d72de);utils[_0x0661('0x1')](util[_0x0661('0x2')](_0x0661('0x1e'),_0x3d72de[_0x0661('0x4')],_0x3d72de[_0x0661('0x1c')],_0x3d72de['value']));if(_['endsWith'](_0x3d72de[_0x0661('0x1f')],_0x0661('0x20'))){_0x3d72de[_0x0661('0x1f')]=_0x3d72de[_0x0661('0x1f')]['replace']('.wav49',_0x0661('0x21'));}if(recordings[_0x3d72de['linkedid']]){var _0x3ea8b7=_[_0x0661('0x22')](recordings[_0x3d72de[_0x0661('0xe')]][_0x0661('0x23')],{'value':_0x3d72de['value']});if(_[_0x0661('0x16')](_0x3ea8b7)){recordings[_0x3d72de['linkedid']]['monitors']['push']({'value':_0x3d72de[_0x0661('0x1f')]});}}}}catch(_0x3b77f4){utils[_0x0661('0x1a')](util[_0x0661('0x2')](_0x0661('0x1d'),_0x3d72de['uniqueid']),_0x3b77f4);}};exports[_0x0661('0x24')]=function(_0x3e82bf){try{if(!_[_0x0661('0x16')](recordings[_0x3e82bf['uniqueid']])){utils[_0x0661('0xd')](util[_0x0661('0x2')](_0x0661('0x25'),_0x3e82bf[_0x0661('0x4')]),_0x3e82bf);utils['info'](util[_0x0661('0x2')](_0x0661('0x26'),_0x3e82bf['uniqueid'],_0x3e82bf[_0x0661('0x27')],_0x3e82bf[_0x0661('0x28')],_0x3e82bf[_0x0661('0x29')]));recordings[_0x3e82bf['uniqueid']][_0x0661('0x27')]=_0x3e82bf[_0x0661('0x27')];recordings[_0x3e82bf['uniqueid']]['calleridname']=_0x3e82bf[_0x0661('0x28')];recordings[_0x3e82bf['uniqueid']][_0x0661('0x2a')]=_0x3e82bf[_0x0661('0x2a')];recordings[_0x3e82bf[_0x0661('0x4')]][_0x0661('0x2b')]=_0x3e82bf[_0x0661('0x2b')];if(recordings[_0x3e82bf['uniqueid']][_0x0661('0x2c')]==_0x0661('0x2d')&&recordings[_0x3e82bf['uniqueid']][_0x0661('0x5')]){recordings[_0x3e82bf[_0x0661('0x4')]]['connectedlinenum']=recordings[_0x3e82bf[_0x0661('0x4')]][_0x0661('0x5')];recordings[_0x3e82bf[_0x0661('0x4')]]['connectedlinename']='';}recordings[_0x3e82bf['uniqueid']][_0x0661('0x23')][_0x0661('0x2e')](function(_0xb24916){var _0x144229=_[_0x0661('0x2f')](recordings[_0x3e82bf[_0x0661('0x4')]]);_0x144229[_0x0661('0x1f')]=_0xb24916[_0x0661('0x1f')];writeDB(_0x144229);});delete recordings[_0x3e82bf[_0x0661('0x4')]];}}catch(_0x13a779){utils['error'](util[_0x0661('0x2')](_0x0661('0x25'),_0x3e82bf[_0x0661('0x4')]),_0x13a779);}};exports[_0x0661('0x30')]=function(_0x555fe1){try{if(!_[_0x0661('0x16')](recordings[_0x555fe1[_0x0661('0x4')]])){utils['debug'](util[_0x0661('0x2')]('[%s][recordings][newexten]',_0x555fe1['uniqueid']),_0x555fe1);utils[_0x0661('0x1')](util[_0x0661('0x2')](_0x0661('0x31'),_0x555fe1[_0x0661('0x4')],_0x555fe1[_0x0661('0x32')],_0x555fe1[_0x0661('0x33')]));if(_0x555fe1[_0x0661('0x32')]['toLowerCase']()==_0x0661('0x34')&&_[_0x0661('0x35')](_0x555fe1[_0x0661('0x33')][_0x0661('0x36')](),_0x0661('0x37'))){var _0x5adf54=_0x555fe1[_0x0661('0x33')][_0x0661('0x38')]('=');var _0x1184bd=_0x5adf54[0x0][_0x0661('0x39')](_0x5adf54[0x0]['lastIndexOf']('(')+0x1,_0x5adf54[0x0]['lastIndexOf'](')'));var _0x4e41bb=_0x5adf54[0x1];recordings[_0x555fe1[_0x0661('0x4')]][_0x1184bd]=_0x4e41bb;}}}catch(_0x16f566){utils[_0x0661('0x1a')](util[_0x0661('0x2')](_0x0661('0x3a'),_0x555fe1[_0x0661('0x4')]),_0x16f566);}};exports[_0x0661('0x3b')]=function(_0x3f60a8){try{if(!_['isNil'](recordings[_0x3f60a8['uniqueid']])){utils[_0x0661('0xd')](util[_0x0661('0x2')](_0x0661('0x3c'),_0x3f60a8[_0x0661('0x4')]),_0x3f60a8);utils[_0x0661('0x1')](util['format'](_0x0661('0x3d'),_0x3f60a8[_0x0661('0x4')],_0x3f60a8[_0x0661('0x3e')]));recordings[_0x3f60a8[_0x0661('0x4')]][_0x0661('0x3e')]=_0x3f60a8[_0x0661('0x3e')];}}catch(_0x3f7806){utils[_0x0661('0x1a')](util[_0x0661('0x2')](_0x0661('0x3c'),_0x3f60a8[_0x0661('0x4')]),_0x3f7806);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 7410018..d74d96d 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 _0xc3ea=['origtransfererexten','isNil','transfertargetchannel','transfertargetconnectedlinenum','transfertargetcontext','transfertargetexten','error','lodash','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','uniqueid','type','request','CreateVoiceTransferReport','blindtransfer','debug','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfereecalleridname','blind','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransferercontext'];(function(_0x56aed2,_0x28a5e3){var _0x31f602=function(_0x25c8f6){while(--_0x25c8f6){_0x56aed2['push'](_0x56aed2['shift']());}};_0x31f602(++_0x28a5e3);}(_0xc3ea,0x9f));var _0xac3e=function(_0x3cbe3a,_0x78bfce){_0x3cbe3a=_0x3cbe3a-0x0;var _0x24ffc1=_0xc3ea[_0x3cbe3a];return _0x24ffc1;};'use strict';var _=require(_0xac3e('0x0'));var util=require(_0xac3e('0x1'));var utils=require(_0xac3e('0x2'));function writeDB(_0x4b8e80){utils['info'](util[_0xac3e('0x3')](_0xac3e('0x4'),_0x4b8e80['type']===_0xac3e('0x5')?_0x4b8e80[_0xac3e('0x6')]:_0x4b8e80[_0xac3e('0x7')],_0x4b8e80[_0xac3e('0x8')]));utils[_0xac3e('0x9')](_0xac3e('0xa'),_0x4b8e80);}exports[_0xac3e('0xb')]=function(_0x35be3b){try{utils[_0xac3e('0xc')](util[_0xac3e('0x3')]('[%s][transfers][blindtransfer]',_0x35be3b[_0xac3e('0x7')]),_0x35be3b);utils[_0xac3e('0xd')](util[_0xac3e('0x3')](_0xac3e('0xe'),_0x35be3b[_0xac3e('0x7')],_0x35be3b['transferercalleridnum'],_0x35be3b['transferercalleridname'],_0x35be3b['transfereecalleridnum'],_0x35be3b[_0xac3e('0xf')]));_0x35be3b['type']=_0xac3e('0x10');writeDB(_0x35be3b);}catch(_0x400d1d){utils['error'](util[_0xac3e('0x3')]('[%s][transfers][blindtransfer]',_0x35be3b[_0xac3e('0x7')]),_0x400d1d);}};exports[_0xac3e('0x11')]=function(_0x24c3f9){try{utils[_0xac3e('0xc')](util[_0xac3e('0x3')](_0xac3e('0x12'),_0x24c3f9['origtransfereruniqueid']),_0x24c3f9);utils[_0xac3e('0xd')](util[_0xac3e('0x3')](_0xac3e('0x13'),_0x24c3f9[_0xac3e('0x6')],_0x24c3f9[_0xac3e('0x14')],_0x24c3f9[_0xac3e('0x15')],_0x24c3f9[_0xac3e('0x16')],_0x24c3f9[_0xac3e('0x17')]));_0x24c3f9=_[_0xac3e('0x18')](_0x24c3f9,{'transfererchannel':_0x24c3f9[_0xac3e('0x19')],'transferercalleridnum':_0x24c3f9['origtransferercalleridnum'],'transferercalleridname':_0x24c3f9['origtransferercalleridname'],'transfererconnectedlinenum':_0x24c3f9[_0xac3e('0x1a')],'transfererconnectedlinename':_0x24c3f9[_0xac3e('0x1b')],'transfereraccountcode':_0x24c3f9[_0xac3e('0x1c')],'transferercontext':_0x24c3f9['secondtransferercontext'],'transfererexten':_0x24c3f9[_0xac3e('0x1d')],'transfererlinkedid':_0x24c3f9['origtransfererlinkedid'],'context':_0x24c3f9[_0xac3e('0x1e')],'extension':_0x24c3f9[_0xac3e('0x1f')],'type':_0xac3e('0x5')});if(_[_0xac3e('0x20')](_0x24c3f9['transfereechannel'])){_0x24c3f9=_[_0xac3e('0x18')](_0x24c3f9,{'transfereechannel':_0x24c3f9[_0xac3e('0x21')],'transfereecalleridnum':_0x24c3f9[_0xac3e('0x16')],'transfereecalleridname':_0x24c3f9[_0xac3e('0x17')],'transfereeconnectedlinenum':_0x24c3f9[_0xac3e('0x22')],'transfereeconnectedlinename':_0x24c3f9['transfertargetconnectedlinename'],'transfereeaccountcode':_0x24c3f9['transfertargetaccountcode'],'transfereecontext':_0x24c3f9[_0xac3e('0x23')],'transfereeexten':_0x24c3f9[_0xac3e('0x24')],'transfereelinkedid':_0x24c3f9['transfertargetlinkedid']});}writeDB(_0x24c3f9);}catch(_0x14de71){utils[_0xac3e('0x25')](util[_0xac3e('0x3')](_0xac3e('0x12'),_0x24c3f9[_0xac3e('0x6')]),_0x14de71);}}; \ No newline at end of file +var _0x6199=['format','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid','request','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','./utils','info'];(function(_0x44861c,_0x7ca63f){var _0x2b6688=function(_0x5b3cc2){while(--_0x5b3cc2){_0x44861c['push'](_0x44861c['shift']());}};_0x2b6688(++_0x7ca63f);}(_0x6199,0x13c));var _0x9619=function(_0x4aeb71,_0x33dc5d){_0x4aeb71=_0x4aeb71-0x0;var _0x4e94c9=_0x6199[_0x4aeb71];return _0x4e94c9;};'use strict';var _=require(_0x9619('0x0'));var util=require(_0x9619('0x1'));var utils=require(_0x9619('0x2'));function writeDB(_0x5c1d46){utils[_0x9619('0x3')](util[_0x9619('0x4')](_0x9619('0x5'),_0x5c1d46[_0x9619('0x6')]===_0x9619('0x7')?_0x5c1d46['origtransfereruniqueid']:_0x5c1d46[_0x9619('0x8')],_0x5c1d46[_0x9619('0x6')]));utils[_0x9619('0x9')]('CreateVoiceTransferReport',_0x5c1d46);}exports['blindtransfer']=function(_0x262855){try{utils[_0x9619('0xa')](util[_0x9619('0x4')](_0x9619('0xb'),_0x262855['uniqueid']),_0x262855);utils['info'](util[_0x9619('0x4')](_0x9619('0xc'),_0x262855[_0x9619('0x8')],_0x262855[_0x9619('0xd')],_0x262855[_0x9619('0xe')],_0x262855[_0x9619('0xf')],_0x262855[_0x9619('0x10')]));_0x262855[_0x9619('0x6')]=_0x9619('0x11');writeDB(_0x262855);}catch(_0x145a18){utils[_0x9619('0x12')](util[_0x9619('0x4')](_0x9619('0xb'),_0x262855[_0x9619('0x8')]),_0x145a18);}};exports[_0x9619('0x13')]=function(_0x5203d1){try{utils[_0x9619('0xa')](util[_0x9619('0x4')]('[%s][transfers][attendedtransfer]',_0x5203d1[_0x9619('0x14')]),_0x5203d1);utils[_0x9619('0x3')](util[_0x9619('0x4')](_0x9619('0x15'),_0x5203d1[_0x9619('0x14')],_0x5203d1['origtransferercalleridnum'],_0x5203d1['origtransferercalleridname'],_0x5203d1[_0x9619('0x16')],_0x5203d1[_0x9619('0x17')]));_0x5203d1=_[_0x9619('0x18')](_0x5203d1,{'transfererchannel':_0x5203d1[_0x9619('0x19')],'transferercalleridnum':_0x5203d1[_0x9619('0x1a')],'transferercalleridname':_0x5203d1['origtransferercalleridname'],'transfererconnectedlinenum':_0x5203d1[_0x9619('0x1b')],'transfererconnectedlinename':_0x5203d1['secondtransfererconnectedlinename'],'transfereraccountcode':_0x5203d1[_0x9619('0x1c')],'transferercontext':_0x5203d1['secondtransferercontext'],'transfererexten':_0x5203d1[_0x9619('0x1d')],'transfererlinkedid':_0x5203d1[_0x9619('0x1e')],'context':_0x5203d1['origtransferercontext'],'extension':_0x5203d1['origtransfererexten'],'type':_0x9619('0x7')});if(_[_0x9619('0x1f')](_0x5203d1[_0x9619('0x20')])){_0x5203d1=_['assign'](_0x5203d1,{'transfereechannel':_0x5203d1[_0x9619('0x21')],'transfereecalleridnum':_0x5203d1[_0x9619('0x16')],'transfereecalleridname':_0x5203d1[_0x9619('0x17')],'transfereeconnectedlinenum':_0x5203d1['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x5203d1[_0x9619('0x22')],'transfereeaccountcode':_0x5203d1[_0x9619('0x23')],'transfereecontext':_0x5203d1[_0x9619('0x24')],'transfereeexten':_0x5203d1[_0x9619('0x25')],'transfereelinkedid':_0x5203d1[_0x9619('0x26')]});}writeDB(_0x5203d1);}catch(_0x48bc75){utils[_0x9619('0x12')](util[_0x9619('0x4')](_0x9619('0x27'),_0x5203d1[_0x9619('0x14')]),_0x48bc75);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 4c0f06e..92c89fe 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 _0x7a54=['result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtract','format','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','http','xdr','info','debug','error','inspect','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify'];(function(_0x5b2544,_0x10be79){var _0x289d42=function(_0x2ea52b){while(--_0x2ea52b){_0x5b2544['push'](_0x5b2544['shift']());}};_0x289d42(++_0x10be79);}(_0x7a54,0x106));var _0x47a5=function(_0x1769bf,_0x2de3a3){_0x1769bf=_0x1769bf-0x0;var _0x173940=_0x7a54[_0x1769bf];return _0x173940;};'use strict';var BPromise=require(_0x47a5('0x0'));var jayson=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var util=require('util');var client=jayson[_0x47a5('0x3')][_0x47a5('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x47a5('0x5'));exports[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){logger[_0x47a5('0x6')](_0x2a1a7e,_0x3717e1?util['inspect'](_0x3717e1,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x7')]=function(_0x59199c,_0x343372){logger[_0x47a5('0x7')](_0x59199c,_0x343372?util['inspect'](_0x343372,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x8')]=function(_0x5077f3,_0x5d90b3){logger['error'](_0x5077f3,_0x5d90b3?util[_0x47a5('0x9')](_0x5d90b3,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0xa')]=function(_0x5e31dd,_0x2eb0dd){return client['request'](_0x5e31dd,{'body':_0x2eb0dd})['then'](function(_0x1f47f4){logger[_0x47a5('0x7')](_0x47a5('0xb'),_0x5e31dd,_0x1f47f4?util[_0x47a5('0x9')](_0x1f47f4,{'showHidden':![],'depth':null}):'');})[_0x47a5('0xc')](function(_0xd308b8){logger[_0x47a5('0x8')]('[utils][request]\x20name:%s',_0x5e31dd,_0xd308b8?util[_0x47a5('0x9')](_0xd308b8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x221b54){return client[_0x47a5('0xa')](_0x47a5('0xd'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xe'),_0x47a5('0xf'),_0x47a5('0x10')],'where':_0x221b54,'limit':0x1}})[_0x47a5('0x11')](function(_0x4e99a8){logger[_0x47a5('0x7')](_0x47a5('0x12'),JSON[_0x47a5('0x13')](_0x221b54),_0x4e99a8?util[_0x47a5('0x9')](_0x4e99a8,{'showHidden':![],'depth':null}):'');return _0x4e99a8[_0x47a5('0x14')]['length']?_0x4e99a8['result'][0x0]:null;});}exports[_0x47a5('0x15')]=function(_0x4b966e){return new BPromise(function(_0x5247fd,_0x423a81){if(_0x4b966e){return getUser({'internal':_0x4b966e})[_0x47a5('0x11')](function(_0x2ce454){logger[_0x47a5('0x6')](_0x47a5('0x16'),_0x4b966e,_0x2ce454?_0x47a5('0x17'):_0x47a5('0x18'));return _0x5247fd(_0x2ce454);})[_0x47a5('0xc')](function(_0x3aed38){logger['error'](_0x47a5('0x19'),_0x3aed38?util[_0x47a5('0x9')](_0x3aed38,{'showHidden':![],'depth':null}):'');return _0x5247fd(null);});}return _0x5247fd(null);});};exports['getUserByInterface']=function(_0x2b0360){return new BPromise(function(_0x1f03f7,_0x36874d){if(_0x2b0360){return getUser({'interface':_0x2b0360})['then'](function(_0xb8ae6c){logger[_0x47a5('0x6')](_0x47a5('0x1a'),_0x2b0360,_0xb8ae6c?_0x47a5('0x17'):'notfound');return _0x1f03f7(_0xb8ae6c);})[_0x47a5('0xc')](function(_0x385687){logger['error'](_0x47a5('0x1b'),_0x385687?util[_0x47a5('0x9')](_0x385687,{'showHidden':![],'depth':null}):'');return _0x1f03f7(null);});}return _0x1f03f7(null);});};exports[_0x47a5('0x1c')]=function(_0x129ce5){return new BPromise(function(_0x3abd6a,_0x50bf17){if(_0x129ce5){return getUser({'name':_0x129ce5})['then'](function(_0x136745){logger['info'](_0x47a5('0x1d'),_0x129ce5,_0x136745?'found':_0x47a5('0x18'));return _0x3abd6a(_0x136745);})[_0x47a5('0xc')](function(_0x36ad34){logger[_0x47a5('0x8')](_0x47a5('0x1e'),_0x36ad34?util[_0x47a5('0x9')](_0x36ad34,{'showHidden':![],'depth':null}):'');return _0x3abd6a(null);});}return _0x3abd6a(null);});};exports[_0x47a5('0x1f')]=function(_0x136b14){return new BPromise(function(_0x16631f,_0x361bfa){if(_0x136b14){return client[_0x47a5('0xa')](_0x47a5('0x20'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xf'),'type',_0x47a5('0x21'),'acwTimeout'],'where':{'name':_0x136b14},'limit':0x1}})[_0x47a5('0x11')](function(_0x9ac908){logger[_0x47a5('0x7')]('[utils][getVoiceQueueByName]\x20name:%s',_0x136b14,_0x9ac908?util[_0x47a5('0x9')](_0x9ac908,{'showHidden':![],'depth':null}):'');logger[_0x47a5('0x6')](_0x47a5('0x22'),_0x136b14,_0x9ac908?_0x47a5('0x17'):'notfound');return _0x16631f(_0x9ac908['result'][_0x47a5('0x23')]?_0x9ac908[_0x47a5('0x14')][0x0]:null);})['catch'](function(_0x4e1006){logger[_0x47a5('0x8')](_0x47a5('0x24'),_0x4e1006?util['inspect'](_0x4e1006,{'showHidden':![],'depth':null}):'');return _0x16631f(null);});}return _0x16631f(null);});};exports[_0x47a5('0x25')]=function(_0x53119b,_0x122ed6){return moment(_0x53119b)[_0x47a5('0x26')](_0x122ed6,'seconds')['format'](_0x47a5('0x27'));};exports['subtractTime']=function(_0x403028,_0x87e4c9){return moment(_0x403028)[_0x47a5('0x28')](_0x87e4c9,'seconds')[_0x47a5('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x65542e,_0x5a8a7c){return moment(_0x65542e)[_0x47a5('0x2a')](moment(_0x5a8a7c),'seconds');};exports[_0x47a5('0x2b')]=function(_0x3534cb,_0x38c8d4){return parseInt(_0x3534cb,0xa)+parseInt(_0x38c8d4,0xa);};exports[_0x47a5('0x2c')]=function(){return moment()[_0x47a5('0x29')](_0x47a5('0x27'));};exports[_0x47a5('0x2d')]=function(_0x452be5,_0x1a0d23){if(_0x1a0d23){return moment(_0x452be5)['isAfter'](_0x1a0d23);}return!![];};exports[_0x47a5('0x2e')]=function(_0x10f136,_0x511c06){if(_0x511c06){return moment(_0x10f136)[_0x47a5('0x2e')](_0x511c06);}else if(_0x10f136){return!![];}return![];}; \ No newline at end of file +var _0x7a54=['result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtract','format','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','http','xdr','info','debug','error','inspect','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify'];(function(_0x46a7ab,_0x39f289){var _0x1b8196=function(_0x27e6fa){while(--_0x27e6fa){_0x46a7ab['push'](_0x46a7ab['shift']());}};_0x1b8196(++_0x39f289);}(_0x7a54,0x106));var _0x47a5=function(_0x443a23,_0xc52f7b){_0x443a23=_0x443a23-0x0;var _0x5b47a2=_0x7a54[_0x443a23];return _0x5b47a2;};'use strict';var BPromise=require(_0x47a5('0x0'));var jayson=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var util=require('util');var client=jayson[_0x47a5('0x3')][_0x47a5('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x47a5('0x5'));exports[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){logger[_0x47a5('0x6')](_0x2a1a7e,_0x3717e1?util['inspect'](_0x3717e1,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x7')]=function(_0x59199c,_0x343372){logger[_0x47a5('0x7')](_0x59199c,_0x343372?util['inspect'](_0x343372,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x8')]=function(_0x5077f3,_0x5d90b3){logger['error'](_0x5077f3,_0x5d90b3?util[_0x47a5('0x9')](_0x5d90b3,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0xa')]=function(_0x5e31dd,_0x2eb0dd){return client['request'](_0x5e31dd,{'body':_0x2eb0dd})['then'](function(_0x1f47f4){logger[_0x47a5('0x7')](_0x47a5('0xb'),_0x5e31dd,_0x1f47f4?util[_0x47a5('0x9')](_0x1f47f4,{'showHidden':![],'depth':null}):'');})[_0x47a5('0xc')](function(_0xd308b8){logger[_0x47a5('0x8')]('[utils][request]\x20name:%s',_0x5e31dd,_0xd308b8?util[_0x47a5('0x9')](_0xd308b8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x221b54){return client[_0x47a5('0xa')](_0x47a5('0xd'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xe'),_0x47a5('0xf'),_0x47a5('0x10')],'where':_0x221b54,'limit':0x1}})[_0x47a5('0x11')](function(_0x4e99a8){logger[_0x47a5('0x7')](_0x47a5('0x12'),JSON[_0x47a5('0x13')](_0x221b54),_0x4e99a8?util[_0x47a5('0x9')](_0x4e99a8,{'showHidden':![],'depth':null}):'');return _0x4e99a8[_0x47a5('0x14')]['length']?_0x4e99a8['result'][0x0]:null;});}exports[_0x47a5('0x15')]=function(_0x4b966e){return new BPromise(function(_0x5247fd,_0x423a81){if(_0x4b966e){return getUser({'internal':_0x4b966e})[_0x47a5('0x11')](function(_0x2ce454){logger[_0x47a5('0x6')](_0x47a5('0x16'),_0x4b966e,_0x2ce454?_0x47a5('0x17'):_0x47a5('0x18'));return _0x5247fd(_0x2ce454);})[_0x47a5('0xc')](function(_0x3aed38){logger['error'](_0x47a5('0x19'),_0x3aed38?util[_0x47a5('0x9')](_0x3aed38,{'showHidden':![],'depth':null}):'');return _0x5247fd(null);});}return _0x5247fd(null);});};exports['getUserByInterface']=function(_0x2b0360){return new BPromise(function(_0x1f03f7,_0x36874d){if(_0x2b0360){return getUser({'interface':_0x2b0360})['then'](function(_0xb8ae6c){logger[_0x47a5('0x6')](_0x47a5('0x1a'),_0x2b0360,_0xb8ae6c?_0x47a5('0x17'):'notfound');return _0x1f03f7(_0xb8ae6c);})[_0x47a5('0xc')](function(_0x385687){logger['error'](_0x47a5('0x1b'),_0x385687?util[_0x47a5('0x9')](_0x385687,{'showHidden':![],'depth':null}):'');return _0x1f03f7(null);});}return _0x1f03f7(null);});};exports[_0x47a5('0x1c')]=function(_0x129ce5){return new BPromise(function(_0x3abd6a,_0x50bf17){if(_0x129ce5){return getUser({'name':_0x129ce5})['then'](function(_0x136745){logger['info'](_0x47a5('0x1d'),_0x129ce5,_0x136745?'found':_0x47a5('0x18'));return _0x3abd6a(_0x136745);})[_0x47a5('0xc')](function(_0x36ad34){logger[_0x47a5('0x8')](_0x47a5('0x1e'),_0x36ad34?util[_0x47a5('0x9')](_0x36ad34,{'showHidden':![],'depth':null}):'');return _0x3abd6a(null);});}return _0x3abd6a(null);});};exports[_0x47a5('0x1f')]=function(_0x136b14){return new BPromise(function(_0x16631f,_0x361bfa){if(_0x136b14){return client[_0x47a5('0xa')](_0x47a5('0x20'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xf'),'type',_0x47a5('0x21'),'acwTimeout'],'where':{'name':_0x136b14},'limit':0x1}})[_0x47a5('0x11')](function(_0x9ac908){logger[_0x47a5('0x7')]('[utils][getVoiceQueueByName]\x20name:%s',_0x136b14,_0x9ac908?util[_0x47a5('0x9')](_0x9ac908,{'showHidden':![],'depth':null}):'');logger[_0x47a5('0x6')](_0x47a5('0x22'),_0x136b14,_0x9ac908?_0x47a5('0x17'):'notfound');return _0x16631f(_0x9ac908['result'][_0x47a5('0x23')]?_0x9ac908[_0x47a5('0x14')][0x0]:null);})['catch'](function(_0x4e1006){logger[_0x47a5('0x8')](_0x47a5('0x24'),_0x4e1006?util['inspect'](_0x4e1006,{'showHidden':![],'depth':null}):'');return _0x16631f(null);});}return _0x16631f(null);});};exports[_0x47a5('0x25')]=function(_0x53119b,_0x122ed6){return moment(_0x53119b)[_0x47a5('0x26')](_0x122ed6,'seconds')['format'](_0x47a5('0x27'));};exports['subtractTime']=function(_0x403028,_0x87e4c9){return moment(_0x403028)[_0x47a5('0x28')](_0x87e4c9,'seconds')[_0x47a5('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x65542e,_0x5a8a7c){return moment(_0x65542e)[_0x47a5('0x2a')](moment(_0x5a8a7c),'seconds');};exports[_0x47a5('0x2b')]=function(_0x3534cb,_0x38c8d4){return parseInt(_0x3534cb,0xa)+parseInt(_0x38c8d4,0xa);};exports[_0x47a5('0x2c')]=function(){return moment()[_0x47a5('0x29')](_0x47a5('0x27'));};exports[_0x47a5('0x2d')]=function(_0x452be5,_0x1a0d23){if(_0x1a0d23){return moment(_0x452be5)['isAfter'](_0x1a0d23);}return!![];};exports[_0x47a5('0x2e')]=function(_0x10f136,_0x511c06){if(_0x511c06){return moment(_0x10f136)[_0x47a5('0x2e')](_0x511c06);}else if(_0x10f136){return!![];}return![];}; \ No newline at end of file